summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /include
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include')
-rw-r--r--include/IwyuFilter_include.yaml952
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h491
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx1119
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitEnums.h1066
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitGtk.h381
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitInit.h364
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitTypes.h34
-rw-r--r--include/android/compatibility.hxx44
-rw-r--r--include/animations/animationnodehelper.hxx78
-rw-r--r--include/apple_remote/RemoteControl.h117
-rw-r--r--include/apple_remote/RemoteMainController.h57
-rw-r--r--include/avmedia/MediaControlBase.hxx74
-rw-r--r--include/avmedia/avmediadllapi.h34
-rw-r--r--include/avmedia/mediaitem.hxx169
-rw-r--r--include/avmedia/mediaplayer.hxx78
-rw-r--r--include/avmedia/mediatoolbox.hxx55
-rw-r--r--include/avmedia/mediawindow.hxx158
-rw-r--r--include/basegfx/DrawCommands.hxx158
-rw-r--r--include/basegfx/basegfxdllapi.h43
-rw-r--r--include/basegfx/color/bcolor.hxx185
-rw-r--r--include/basegfx/color/bcolormodifier.hxx336
-rw-r--r--include/basegfx/color/bcolortools.hxx43
-rw-r--r--include/basegfx/curve/b2dbeziertools.hxx52
-rw-r--r--include/basegfx/curve/b2dcubicbezier.hxx198
-rw-r--r--include/basegfx/matrix/b2dhommatrix.hxx153
-rw-r--r--include/basegfx/matrix/b2dhommatrixtools.hxx218
-rw-r--r--include/basegfx/matrix/b3dhommatrix.hxx127
-rw-r--r--include/basegfx/matrix/b3dhommatrixtools.hxx44
-rw-r--r--include/basegfx/numeric/ftools.hxx209
-rw-r--r--include/basegfx/pixel/bpixel.hxx98
-rw-r--r--include/basegfx/point/b2dpoint.hxx134
-rw-r--r--include/basegfx/point/b2ipoint.hxx99
-rw-r--r--include/basegfx/point/b3dpoint.hxx123
-rw-r--r--include/basegfx/polygon/WaveLine.hxx38
-rw-r--r--include/basegfx/polygon/b2dlinegeometry.hxx147
-rw-r--r--include/basegfx/polygon/b2dpolygon.hxx279
-rw-r--r--include/basegfx/polygon/b2dpolygonclipper.hxx65
-rw-r--r--include/basegfx/polygon/b2dpolygoncutandtouch.hxx47
-rw-r--r--include/basegfx/polygon/b2dpolygontools.hxx529
-rw-r--r--include/basegfx/polygon/b2dpolygontriangulator.hxx71
-rw-r--r--include/basegfx/polygon/b2dpolypolygon.hxx170
-rw-r--r--include/basegfx/polygon/b2dpolypolygoncutter.hxx144
-rw-r--r--include/basegfx/polygon/b2dpolypolygontools.hxx297
-rw-r--r--include/basegfx/polygon/b2dtrapezoid.hxx108
-rw-r--r--include/basegfx/polygon/b3dpolygon.hxx121
-rw-r--r--include/basegfx/polygon/b3dpolygontools.hxx129
-rw-r--r--include/basegfx/polygon/b3dpolypolygon.hxx113
-rw-r--r--include/basegfx/polygon/b3dpolypolygontools.hxx132
-rw-r--r--include/basegfx/range/Range2D.hxx178
-rw-r--r--include/basegfx/range/b1drange.hxx151
-rw-r--r--include/basegfx/range/b2dconnectedranges.hxx239
-rw-r--r--include/basegfx/range/b2dpolyrange.hxx93
-rw-r--r--include/basegfx/range/b2drange.hxx175
-rw-r--r--include/basegfx/range/b2drangeclipper.hxx39
-rw-r--r--include/basegfx/range/b2drectangle.hxx33
-rw-r--r--include/basegfx/range/b2ibox.hxx190
-rw-r--r--include/basegfx/range/b2irange.hxx141
-rw-r--r--include/basegfx/range/b2irectangle.hxx33
-rw-r--r--include/basegfx/range/b3drange.hxx227
-rw-r--r--include/basegfx/range/basicbox.hxx68
-rw-r--r--include/basegfx/range/basicrange.hxx313
-rw-r--r--include/basegfx/raster/bzpixelraster.hxx91
-rw-r--r--include/basegfx/raster/rasterconvert3d.hxx421
-rw-r--r--include/basegfx/tuple/Tuple2D.hxx157
-rw-r--r--include/basegfx/tuple/Tuple3D.hxx134
-rw-r--r--include/basegfx/tuple/b2dtuple.hxx177
-rw-r--r--include/basegfx/tuple/b2i64tuple.hxx87
-rw-r--r--include/basegfx/tuple/b2ituple.hxx95
-rw-r--r--include/basegfx/tuple/b3dtuple.hxx237
-rw-r--r--include/basegfx/tuple/b3ituple.hxx93
-rw-r--r--include/basegfx/utils/b2dclipstate.hxx92
-rw-r--r--include/basegfx/utils/canvastools.hxx165
-rw-r--r--include/basegfx/utils/common.hxx33
-rw-r--r--include/basegfx/utils/gradienttools.hxx399
-rw-r--r--include/basegfx/utils/keystoplerp.hxx85
-rw-r--r--include/basegfx/utils/lerp.hxx43
-rw-r--r--include/basegfx/utils/rectcliptools.hxx72
-rw-r--r--include/basegfx/utils/systemdependentdata.hxx107
-rw-r--r--include/basegfx/utils/tools.hxx124
-rw-r--r--include/basegfx/utils/unopolypolygon.hxx104
-rw-r--r--include/basegfx/utils/zoomtools.hxx23
-rw-r--r--include/basegfx/vector/b2dsize.hxx33
-rw-r--r--include/basegfx/vector/b2dvector.hxx237
-rw-r--r--include/basegfx/vector/b2enums.hxx65
-rw-r--r--include/basegfx/vector/b2isize.hxx33
-rw-r--r--include/basegfx/vector/b2ivector.hxx129
-rw-r--r--include/basegfx/vector/b3dvector.hxx258
-rw-r--r--include/basic/basicdllapi.h23
-rw-r--r--include/basic/basicmanagerrepository.hxx138
-rw-r--r--include/basic/basmgr.hxx221
-rw-r--r--include/basic/basrdll.hxx43
-rw-r--r--include/basic/codecompletecache.hxx93
-rw-r--r--include/basic/modsizeexceeded.hxx65
-rw-r--r--include/basic/sbdef.hxx79
-rw-r--r--include/basic/sberrors.hxx176
-rw-r--r--include/basic/sbmeth.hxx88
-rw-r--r--include/basic/sbmod.hxx165
-rw-r--r--include/basic/sbstar.hxx157
-rw-r--r--include/basic/sbuno.hxx47
-rw-r--r--include/basic/sbx.hxx213
-rw-r--r--include/basic/sbxcore.hxx135
-rw-r--r--include/basic/sbxdef.hxx219
-rw-r--r--include/basic/sbxmeth.hxx43
-rw-r--r--include/basic/sbxobj.hxx85
-rw-r--r--include/basic/sbxvar.hxx336
-rw-r--r--include/basic/vbahelper.hxx94
-rw-r--r--include/canvas/canvastools.hxx560
-rw-r--r--include/canvas/canvastoolsdllapi.h35
-rw-r--r--include/canvas/elapsedtime.hxx163
-rw-r--r--include/codemaker/codemaker.hxx38
-rw-r--r--include/codemaker/commoncpp.hxx64
-rw-r--r--include/codemaker/commonjava.hxx44
-rw-r--r--include/codemaker/exceptiontree.hxx119
-rw-r--r--include/codemaker/generatedtypeset.hxx70
-rw-r--r--include/codemaker/global.hxx96
-rw-r--r--include/codemaker/options.hxx72
-rw-r--r--include/codemaker/typemanager.hxx77
-rw-r--r--include/codemaker/unotype.hxx88
-rw-r--r--include/com/sun/star/uno/Any.h493
-rw-r--r--include/com/sun/star/uno/Any.hxx765
-rw-r--r--include/com/sun/star/uno/Reference.h571
-rw-r--r--include/com/sun/star/uno/Reference.hxx481
-rw-r--r--include/com/sun/star/uno/Sequence.h361
-rw-r--r--include/com/sun/star/uno/Sequence.hxx406
-rw-r--r--include/com/sun/star/uno/Type.h502
-rw-r--r--include/com/sun/star/uno/Type.hxx231
-rw-r--r--include/com/sun/star/uno/genfunc.h62
-rw-r--r--include/com/sun/star/uno/genfunc.hxx84
-rw-r--r--include/comphelper/AccessibleImplementationHelper.hxx45
-rw-r--r--include/comphelper/ChainablePropertySet.hxx148
-rw-r--r--include/comphelper/ChainablePropertySetInfo.hxx64
-rw-r--r--include/comphelper/DirectoryHelper.hxx38
-rw-r--r--include/comphelper/IdPropArrayHelper.hxx106
-rw-r--r--include/comphelper/MasterPropertySet.hxx135
-rw-r--r--include/comphelper/MasterPropertySetInfo.hxx56
-rw-r--r--include/comphelper/PropertyInfoHash.hxx57
-rw-r--r--include/comphelper/SelectionMultiplex.hxx93
-rw-r--r--include/comphelper/SetFlagContextHelper.hxx71
-rw-r--r--include/comphelper/accessiblecomponenthelper.hxx142
-rw-r--r--include/comphelper/accessiblecontexthelper.hxx219
-rw-r--r--include/comphelper/accessibleeventnotifier.hxx116
-rw-r--r--include/comphelper/accessiblekeybindinghelper.hxx70
-rw-r--r--include/comphelper/accessibleselectionhelper.hxx135
-rw-r--r--include/comphelper/accessibletexthelper.hxx176
-rw-r--r--include/comphelper/accessiblewrapper.hxx401
-rw-r--r--include/comphelper/accimplaccess.hxx73
-rw-r--r--include/comphelper/anycompare.hxx219
-rw-r--r--include/comphelper/anytohash.hxx48
-rw-r--r--include/comphelper/anytostring.hxx45
-rw-r--r--include/comphelper/asyncnotification.hxx226
-rw-r--r--include/comphelper/asyncquithandler.hxx44
-rw-r--r--include/comphelper/attributelist.hxx92
-rw-r--r--include/comphelper/automationinvokedzone.hxx36
-rw-r--r--include/comphelper/backupfilehelper.hxx216
-rw-r--r--include/comphelper/base64.hxx62
-rw-r--r--include/comphelper/basicio.hxx88
-rw-r--r--include/comphelper/broadcasthelper.hxx51
-rw-r--r--include/comphelper/bytereader.hxx44
-rw-r--r--include/comphelper/classids.hxx334
-rw-r--r--include/comphelper/compbase.hxx118
-rw-r--r--include/comphelper/comphelperdllapi.h33
-rw-r--r--include/comphelper/componentbase.hxx139
-rw-r--r--include/comphelper/componentguard.hxx58
-rw-r--r--include/comphelper/configuration.hxx342
-rw-r--r--include/comphelper/configurationhelper.hxx239
-rw-r--r--include/comphelper/configurationlistener.hxx121
-rw-r--r--include/comphelper/container.hxx76
-rw-r--r--include/comphelper/containermultiplexer.hxx106
-rw-r--r--include/comphelper/crashzone.hxx70
-rw-r--r--include/comphelper/debuggerinfo.hxx38
-rw-r--r--include/comphelper/dispatchcommand.hxx43
-rw-r--r--include/comphelper/docpasswordhelper.hxx447
-rw-r--r--include/comphelper/docpasswordrequest.hxx110
-rw-r--r--include/comphelper/documentconstants.hxx130
-rw-r--r--include/comphelper/documentinfo.hxx51
-rw-r--r--include/comphelper/doublecheckedinit.hxx64
-rw-r--r--include/comphelper/embeddedobjectcontainer.hxx193
-rw-r--r--include/comphelper/enumhelper.hxx122
-rw-r--r--include/comphelper/eventattachermgr.hxx48
-rw-r--r--include/comphelper/evtlistenerhlp.hxx49
-rw-r--r--include/comphelper/evtmethodhelper.hxx32
-rw-r--r--include/comphelper/extract.hxx113
-rw-r--r--include/comphelper/fileformat.h34
-rw-r--r--include/comphelper/fileurl.hxx36
-rw-r--r--include/comphelper/flagguard.hxx80
-rw-r--r--include/comphelper/genericpropertyset.hxx43
-rw-r--r--include/comphelper/getexpandeduri.hxx42
-rw-r--r--include/comphelper/graphicmimetype.hxx49
-rw-r--r--include/comphelper/guarding.hxx55
-rw-r--r--include/comphelper/hash.hxx121
-rw-r--r--include/comphelper/indexedpropertyvalues.hxx55
-rw-r--r--include/comphelper/interaction.hxx119
-rw-r--r--include/comphelper/interfacecontainer2.hxx290
-rw-r--r--include/comphelper/interfacecontainer3.hxx379
-rw-r--r--include/comphelper/interfacecontainer4.hxx401
-rw-r--r--include/comphelper/logging.hxx460
-rw-r--r--include/comphelper/lok.hxx117
-rw-r--r--include/comphelper/make_shared_from_uno.hxx68
-rw-r--r--include/comphelper/mimeconfighelper.hxx142
-rw-r--r--include/comphelper/multicontainer2.hxx133
-rw-r--r--include/comphelper/multiinterfacecontainer3.hxx217
-rw-r--r--include/comphelper/multiinterfacecontainer4.hxx190
-rw-r--r--include/comphelper/namecontainer.hxx40
-rw-r--r--include/comphelper/namedvaluecollection.hxx322
-rw-r--r--include/comphelper/newarray.hxx42
-rw-r--r--include/comphelper/numberedcollection.hxx168
-rw-r--r--include/comphelper/numbers.hxx56
-rw-r--r--include/comphelper/ofopxmlhelper.hxx101
-rw-r--r--include/comphelper/oslfile2streamwrap.hxx78
-rw-r--r--include/comphelper/parallelsort.hxx373
-rw-r--r--include/comphelper/processfactory.hxx72
-rw-r--r--include/comphelper/profilezone.hxx92
-rw-r--r--include/comphelper/propagg.hxx325
-rw-r--r--include/comphelper/proparrhlp.hxx141
-rw-r--r--include/comphelper/property.hxx131
-rw-r--r--include/comphelper/propertybag.hxx226
-rw-r--r--include/comphelper/propertycontainer.hxx87
-rw-r--r--include/comphelper/propertycontainerhelper.hxx197
-rw-r--r--include/comphelper/propertysequence.hxx62
-rw-r--r--include/comphelper/propertysethelper.hxx96
-rw-r--r--include/comphelper/propertysetinfo.hxx123
-rw-r--r--include/comphelper/propertystatecontainer.hxx110
-rw-r--r--include/comphelper/propertyvalue.hxx45
-rw-r--r--include/comphelper/propmultiplex.hxx115
-rw-r--r--include/comphelper/propstate.hxx102
-rw-r--r--include/comphelper/proxyaggregation.hxx218
-rw-r--r--include/comphelper/random.hxx39
-rw-r--r--include/comphelper/refcountedmutex.hxx43
-rw-r--r--include/comphelper/scopeguard.hxx92
-rw-r--r--include/comphelper/seekableinput.hxx83
-rw-r--r--include/comphelper/seqstream.hxx135
-rw-r--r--include/comphelper/sequence.hxx322
-rw-r--r--include/comphelper/sequenceashashmap.hxx426
-rw-r--r--include/comphelper/servicedecl.hxx155
-rw-r--r--include/comphelper/servicehelper.hxx152
-rw-r--r--include/comphelper/sharedmutex.hxx77
-rw-r--r--include/comphelper/simplefileaccessinteraction.hxx52
-rw-r--r--include/comphelper/solarmutex.hxx98
-rw-r--r--include/comphelper/stillreadwriteinteraction.hxx62
-rw-r--r--include/comphelper/stl_types.hxx176
-rw-r--r--include/comphelper/storagehelper.hxx206
-rw-r--r--include/comphelper/streamsection.hxx79
-rw-r--r--include/comphelper/string.hxx386
-rw-r--r--include/comphelper/synchronousdispatch.hxx64
-rw-r--r--include/comphelper/syntaxhighlight.hxx84
-rw-r--r--include/comphelper/threadpool.hxx114
-rw-r--r--include/comphelper/traceevent.hxx222
-rw-r--r--include/comphelper/types.hxx88
-rw-r--r--include/comphelper/unique_disposing_ptr.hxx187
-rw-r--r--include/comphelper/uno3.hxx169
-rw-r--r--include/comphelper/unwrapargs.hxx122
-rw-r--r--include/comphelper/weak.hxx64
-rw-r--r--include/comphelper/weakbag.hxx84
-rw-r--r--include/comphelper/weakeventlistener.hxx183
-rw-r--r--include/comphelper/windowsStart.hxx27
-rw-r--r--include/comphelper/windowsdebugoutput.hxx796
-rw-r--r--include/comphelper/windowserrorstring.hxx68
-rw-r--r--include/comphelper/xmlsechelper.hxx46
-rw-r--r--include/comphelper/xmltools.hxx24
-rw-r--r--include/connectivity/BlobHelper.hxx41
-rw-r--r--include/connectivity/CommonTools.hxx167
-rw-r--r--include/connectivity/ConnectionWrapper.hxx92
-rw-r--r--include/connectivity/DriversConfig.hxx82
-rw-r--r--include/connectivity/FValue.hxx490
-rw-r--r--include/connectivity/IParseContext.hxx101
-rw-r--r--include/connectivity/PColumn.hxx148
-rw-r--r--include/connectivity/TColumnsHelper.hxx62
-rw-r--r--include/connectivity/TIndexes.hxx49
-rw-r--r--include/connectivity/TKeys.hxx57
-rw-r--r--include/connectivity/TTableHelper.hxx168
-rw-r--r--include/connectivity/conncleanup.hxx90
-rw-r--r--include/connectivity/dbcharset.hxx149
-rw-r--r--include/connectivity/dbconversion.hxx185
-rw-r--r--include/connectivity/dbexception.hxx332
-rw-r--r--include/connectivity/dbmetadata.hxx194
-rw-r--r--include/connectivity/dbtools.hxx867
-rw-r--r--include/connectivity/dbtoolsdllapi.hxx35
-rw-r--r--include/connectivity/filtermanager.hxx114
-rw-r--r--include/connectivity/formattedcolumnvalue.hxx98
-rw-r--r--include/connectivity/internalnode.hxx51
-rw-r--r--include/connectivity/odbc.hxx94
-rw-r--r--include/connectivity/parameters.hxx415
-rw-r--r--include/connectivity/paramwrapper.hxx196
-rw-r--r--include/connectivity/predicateinput.hxx129
-rw-r--r--include/connectivity/sdbcx/IRefreshable.hxx56
-rw-r--r--include/connectivity/sdbcx/VCollection.hxx225
-rw-r--r--include/connectivity/sdbcx/VColumn.hxx116
-rw-r--r--include/connectivity/sdbcx/VDescriptor.hxx83
-rw-r--r--include/connectivity/sdbcx/VTable.hxx142
-rw-r--r--include/connectivity/sdbcx/VView.hxx93
-rw-r--r--include/connectivity/sqlbison_exports.hxx21
-rw-r--r--include/connectivity/sqlerror.hxx239
-rw-r--r--include/connectivity/sqliterator.hxx341
-rw-r--r--include/connectivity/sqlnode.hxx455
-rw-r--r--include/connectivity/sqlparse.hxx230
-rw-r--r--include/connectivity/sqlscan.hxx67
-rw-r--r--include/connectivity/standardsqlstate.hxx57
-rw-r--r--include/connectivity/statementcomposer.hxx105
-rw-r--r--include/connectivity/warningscontainer.hxx84
-rw-r--r--include/cppcanvas/basegfxfactory.hxx76
-rw-r--r--include/cppcanvas/bitmap.hxx70
-rw-r--r--include/cppcanvas/bitmapcanvas.hxx49
-rw-r--r--include/cppcanvas/canvas.hxx103
-rw-r--r--include/cppcanvas/canvasgraphic.hxx80
-rw-r--r--include/cppcanvas/color.hxx70
-rw-r--r--include/cppcanvas/cppcanvasdllapi.h31
-rw-r--r--include/cppcanvas/customsprite.hxx44
-rw-r--r--include/cppcanvas/polypolygon.hxx76
-rw-r--r--include/cppcanvas/renderer.hxx140
-rw-r--r--include/cppcanvas/sprite.hxx96
-rw-r--r--include/cppcanvas/spritecanvas.hxx63
-rw-r--r--include/cppcanvas/vclfactory.hxx87
-rw-r--r--include/cppu/Enterable.hxx112
-rw-r--r--include/cppu/EnvDcp.hxx70
-rw-r--r--include/cppu/EnvGuards.hxx107
-rw-r--r--include/cppu/Map.hxx109
-rw-r--r--include/cppu/cppudllapi.h24
-rw-r--r--include/cppu/helper/purpenv/Environment.hxx46
-rw-r--r--include/cppu/helper/purpenv/Mapping.hxx66
-rw-r--r--include/cppu/macros.hxx64
-rw-r--r--include/cppu/unotype.hxx412
-rw-r--r--include/cppuhelper/TODO3
-rw-r--r--include/cppuhelper/access_control.hxx115
-rw-r--r--include/cppuhelper/basemutex.hxx47
-rw-r--r--include/cppuhelper/bootstrap.hxx169
-rw-r--r--include/cppuhelper/compbase.hxx133
-rw-r--r--include/cppuhelper/compbase1.hxx152
-rw-r--r--include/cppuhelper/compbase10.hxx152
-rw-r--r--include/cppuhelper/compbase11.hxx152
-rw-r--r--include/cppuhelper/compbase12.hxx152
-rw-r--r--include/cppuhelper/compbase2.hxx153
-rw-r--r--include/cppuhelper/compbase3.hxx152
-rw-r--r--include/cppuhelper/compbase4.hxx152
-rw-r--r--include/cppuhelper/compbase5.hxx152
-rw-r--r--include/cppuhelper/compbase6.hxx152
-rw-r--r--include/cppuhelper/compbase7.hxx152
-rw-r--r--include/cppuhelper/compbase8.hxx152
-rw-r--r--include/cppuhelper/compbase9.hxx151
-rw-r--r--include/cppuhelper/compbase_ex.hxx162
-rw-r--r--include/cppuhelper/component.hxx110
-rw-r--r--include/cppuhelper/component_context.hxx97
-rw-r--r--include/cppuhelper/cppuhelperdllapi.h38
-rw-r--r--include/cppuhelper/exc_hlp.hxx95
-rw-r--r--include/cppuhelper/factory.hxx278
-rw-r--r--include/cppuhelper/findsofficepath.h49
-rw-r--r--include/cppuhelper/implbase.hxx186
-rw-r--r--include/cppuhelper/implbase1.hxx311
-rw-r--r--include/cppuhelper/implbase10.hxx317
-rw-r--r--include/cppuhelper/implbase11.hxx318
-rw-r--r--include/cppuhelper/implbase12.hxx319
-rw-r--r--include/cppuhelper/implbase13.hxx320
-rw-r--r--include/cppuhelper/implbase2.hxx308
-rw-r--r--include/cppuhelper/implbase3.hxx310
-rw-r--r--include/cppuhelper/implbase4.hxx311
-rw-r--r--include/cppuhelper/implbase5.hxx312
-rw-r--r--include/cppuhelper/implbase6.hxx313
-rw-r--r--include/cppuhelper/implbase7.hxx314
-rw-r--r--include/cppuhelper/implbase8.hxx315
-rw-r--r--include/cppuhelper/implbase9.hxx316
-rw-r--r--include/cppuhelper/implbase_ex.hxx167
-rw-r--r--include/cppuhelper/implbase_ex_post.hxx172
-rw-r--r--include/cppuhelper/implbase_ex_pre.hxx37
-rw-r--r--include/cppuhelper/implementationentry.hxx115
-rw-r--r--include/cppuhelper/interfacecontainer.h614
-rw-r--r--include/cppuhelper/interfacecontainer.hxx197
-rw-r--r--include/cppuhelper/propertysetmixin.hxx423
-rw-r--r--include/cppuhelper/propshlp.hxx729
-rw-r--r--include/cppuhelper/proptypehlp.h62
-rw-r--r--include/cppuhelper/proptypehlp.hxx286
-rw-r--r--include/cppuhelper/queryinterface.hxx526
-rw-r--r--include/cppuhelper/shlib.hxx87
-rw-r--r--include/cppuhelper/supportsservice.hxx53
-rw-r--r--include/cppuhelper/typeprovider.hxx232
-rw-r--r--include/cppuhelper/unourl.hxx188
-rw-r--r--include/cppuhelper/weak.hxx176
-rw-r--r--include/cppuhelper/weakagg.hxx107
-rw-r--r--include/cppuhelper/weakref.hxx228
-rw-r--r--include/cppunittester/protectorfactory.hxx41
-rw-r--r--include/cui/cuicharmap.hxx194
-rw-r--r--include/cui/cuidllapi.h23
-rw-r--r--include/cui/numberingpreview.hxx31
-rw-r--r--include/dbaccess/AsynchronousLink.hxx60
-rw-r--r--include/dbaccess/IController.hxx120
-rw-r--r--include/dbaccess/controllerframe.hxx79
-rw-r--r--include/dbaccess/dataview.hxx91
-rw-r--r--include/dbaccess/dbaccessdllapi.h34
-rw-r--r--include/dbaccess/dbaundomanager.hxx111
-rw-r--r--include/dbaccess/dbsubcomponentcontroller.hxx208
-rw-r--r--include/dbaccess/genericcontroller.hxx506
-rw-r--r--include/default.rc64
-rw-r--r--include/desktop/crashreport.hxx118
-rw-r--r--include/desktop/dllapi.h30
-rw-r--r--include/desktop/exithelper.h37
-rw-r--r--include/desktop/minidump.hxx35
-rw-r--r--include/drawinglayer/XShapeDumper.hxx29
-rw-r--r--include/drawinglayer/animation/animationtiming.hxx132
-rw-r--r--include/drawinglayer/attribute/fillgradientattribute.hxx83
-rw-r--r--include/drawinglayer/attribute/fillgraphicattribute.hxx68
-rw-r--r--include/drawinglayer/attribute/fillhatchattribute.hxx90
-rw-r--r--include/drawinglayer/attribute/fontattribute.hxx76
-rw-r--r--include/drawinglayer/attribute/lineattribute.hxx75
-rw-r--r--include/drawinglayer/attribute/linestartendattribute.hxx69
-rw-r--r--include/drawinglayer/attribute/materialattribute3d.hxx78
-rw-r--r--include/drawinglayer/attribute/sdrallattribute3d.hxx71
-rw-r--r--include/drawinglayer/attribute/sdrfillattribute.hxx88
-rw-r--r--include/drawinglayer/attribute/sdrfillgraphicattribute.hxx94
-rw-r--r--include/drawinglayer/attribute/sdrglowattribute.hxx45
-rw-r--r--include/drawinglayer/attribute/sdrlightattribute3d.hxx75
-rw-r--r--include/drawinglayer/attribute/sdrlightingattribute3d.hxx86
-rw-r--r--include/drawinglayer/attribute/sdrlineattribute.hxx89
-rw-r--r--include/drawinglayer/attribute/sdrlinestartendattribute.hxx88
-rw-r--r--include/drawinglayer/attribute/sdrobjectattribute3d.hxx92
-rw-r--r--include/drawinglayer/attribute/sdrsceneattribute3d.hxx80
-rw-r--r--include/drawinglayer/attribute/sdrshadowattribute.hxx83
-rw-r--r--include/drawinglayer/attribute/strokeattribute.hxx63
-rw-r--r--include/drawinglayer/converters.hxx42
-rw-r--r--include/drawinglayer/drawinglayerdllapi.h30
-rw-r--r--include/drawinglayer/geometry/viewinformation2d.hxx150
-rw-r--r--include/drawinglayer/geometry/viewinformation3d.hxx162
-rw-r--r--include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx115
-rw-r--r--include/drawinglayer/primitive2d/CommonTypes.hxx33
-rw-r--r--include/drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx67
-rw-r--r--include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx76
-rw-r--r--include/drawinglayer/primitive2d/PolyPolygonGraphicPrimitive2D.hxx73
-rw-r--r--include/drawinglayer/primitive2d/PolyPolygonHairlinePrimitive2D.hxx73
-rw-r--r--include/drawinglayer/primitive2d/PolyPolygonHatchPrimitive2D.hxx83
-rw-r--r--include/drawinglayer/primitive2d/PolyPolygonMarkerPrimitive2D.hxx82
-rw-r--r--include/drawinglayer/primitive2d/PolyPolygonSelectionPrimitive2D.hxx86
-rw-r--r--include/drawinglayer/primitive2d/PolyPolygonStrokePrimitive2D.hxx82
-rw-r--r--include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx68
-rw-r--r--include/drawinglayer/primitive2d/PolygonMarkerPrimitive2D.hxx91
-rw-r--r--include/drawinglayer/primitive2d/PolygonStrokeArrowPrimitive2D.hxx78
-rw-r--r--include/drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx83
-rw-r--r--include/drawinglayer/primitive2d/PolygonWavePrimitive2D.hxx72
-rw-r--r--include/drawinglayer/primitive2d/Primitive2DContainer.hxx96
-rw-r--r--include/drawinglayer/primitive2d/Primitive2DVisitor.hxx41
-rw-r--r--include/drawinglayer/primitive2d/Tools.hxx51
-rw-r--r--include/drawinglayer/primitive2d/animatedprimitive2d.hxx158
-rw-r--r--include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx84
-rw-r--r--include/drawinglayer/primitive2d/baseprimitive2d.hxx211
-rw-r--r--include/drawinglayer/primitive2d/bitmapprimitive2d.hxx78
-rw-r--r--include/drawinglayer/primitive2d/borderlineprimitive2d.hxx146
-rw-r--r--include/drawinglayer/primitive2d/controlprimitive2d.hxx117
-rw-r--r--include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx70
-rw-r--r--include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx113
-rw-r--r--include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx110
-rw-r--r--include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx113
-rw-r--r--include/drawinglayer/primitive2d/epsprimitive2d.hxx69
-rw-r--r--include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx114
-rw-r--r--include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx80
-rw-r--r--include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx97
-rw-r--r--include/drawinglayer/primitive2d/glowprimitive2d.hxx58
-rw-r--r--include/drawinglayer/primitive2d/graphicprimitive2d.hxx87
-rw-r--r--include/drawinglayer/primitive2d/gridprimitive2d.hxx111
-rw-r--r--include/drawinglayer/primitive2d/groupprimitive2d.hxx93
-rw-r--r--include/drawinglayer/primitive2d/helplineprimitive2d.hxx106
-rw-r--r--include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx56
-rw-r--r--include/drawinglayer/primitive2d/invertprimitive2d.hxx51
-rw-r--r--include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx79
-rw-r--r--include/drawinglayer/primitive2d/maskprimitive2d.hxx71
-rw-r--r--include/drawinglayer/primitive2d/mediaprimitive2d.hxx87
-rw-r--r--include/drawinglayer/primitive2d/metafileprimitive2d.hxx90
-rw-r--r--include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx71
-rw-r--r--include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx65
-rw-r--r--include/drawinglayer/primitive2d/pagehierarchyprimitive2d.hxx46
-rw-r--r--include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx90
-rw-r--r--include/drawinglayer/primitive2d/patternfillprimitive2d.hxx104
-rw-r--r--include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx74
-rw-r--r--include/drawinglayer/primitive2d/primitivetools2d.hxx151
-rw-r--r--include/drawinglayer/primitive2d/sceneprimitive2d.hxx147
-rw-r--r--include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx62
-rw-r--r--include/drawinglayer/primitive2d/shadowprimitive2d.hxx85
-rw-r--r--include/drawinglayer/primitive2d/softedgeprimitive2d.hxx51
-rw-r--r--include/drawinglayer/primitive2d/structuretagprimitive2d.hxx80
-rw-r--r--include/drawinglayer/primitive2d/svggradientprimitive2d.hxx369
-rw-r--r--include/drawinglayer/primitive2d/textbreakuphelper.hxx75
-rw-r--r--include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx124
-rw-r--r--include/drawinglayer/primitive2d/textenumsprimitive2d.hxx95
-rw-r--r--include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx179
-rw-r--r--include/drawinglayer/primitive2d/textlayoutdevice.hxx127
-rw-r--r--include/drawinglayer/primitive2d/textprimitive2d.hxx184
-rw-r--r--include/drawinglayer/primitive2d/transformprimitive2d.hxx75
-rw-r--r--include/drawinglayer/primitive2d/transparenceprimitive2d.hxx80
-rw-r--r--include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx68
-rw-r--r--include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx83
-rw-r--r--include/drawinglayer/primitive3d/Tools.hxx21
-rw-r--r--include/drawinglayer/primitive3d/baseprimitive3d.hxx210
-rw-r--r--include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx54
-rw-r--r--include/drawinglayer/primitive3d/groupprimitive3d.hxx77
-rw-r--r--include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx65
-rw-r--r--include/drawinglayer/primitive3d/polygonprimitive3d.hxx121
-rw-r--r--include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx78
-rw-r--r--include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx61
-rw-r--r--include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx122
-rw-r--r--include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx122
-rw-r--r--include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx128
-rw-r--r--include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx76
-rw-r--r--include/drawinglayer/primitive3d/sdrprimitive3d.hxx86
-rw-r--r--include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx75
-rw-r--r--include/drawinglayer/primitive3d/transformprimitive3d.hxx70
-rw-r--r--include/drawinglayer/processor2d/baseprocessor2d.hxx200
-rw-r--r--include/drawinglayer/processor2d/contourextractor2d.hxx62
-rw-r--r--include/drawinglayer/processor2d/hittestprocessor2d.hxx96
-rw-r--r--include/drawinglayer/processor2d/linegeometryextractor2d.hxx61
-rw-r--r--include/drawinglayer/processor2d/objectinfoextractor2d.hxx54
-rw-r--r--include/drawinglayer/processor2d/processor2dtools.hxx71
-rw-r--r--include/drawinglayer/processor2d/processorfromoutputdevice.hxx47
-rw-r--r--include/drawinglayer/processor2d/textaspolygonextractor2d.hxx94
-rw-r--r--include/drawinglayer/processor3d/baseprocessor3d.hxx71
-rw-r--r--include/drawinglayer/processor3d/cutfindprocessor3d.hxx73
-rw-r--r--include/drawinglayer/tools/primitive2dxmldump.hxx53
-rw-r--r--include/editeng/AccessibleComponentBase.hxx109
-rw-r--r--include/editeng/AccessibleContextBase.hxx341
-rw-r--r--include/editeng/AccessibleEditableTextPara.hxx388
-rw-r--r--include/editeng/AccessibleParaManager.hxx272
-rw-r--r--include/editeng/AccessibleSelectionBase.hxx67
-rw-r--r--include/editeng/AccessibleStaticTextBase.hxx233
-rw-r--r--include/editeng/CustomPropertyField.hxx61
-rw-r--r--include/editeng/SpellPortions.hxx90
-rw-r--r--include/editeng/Trie.hxx39
-rw-r--r--include/editeng/UnoForbiddenCharsTable.hxx58
-rw-r--r--include/editeng/acorrcfg.hxx123
-rw-r--r--include/editeng/adjustitem.hxx143
-rw-r--r--include/editeng/autokernitem.hxx51
-rw-r--r--include/editeng/blinkitem.hxx48
-rw-r--r--include/editeng/borderline.hxx246
-rw-r--r--include/editeng/boxitem.hxx271
-rw-r--r--include/editeng/brushitem.hxx123
-rw-r--r--include/editeng/bulletitem.hxx94
-rw-r--r--include/editeng/charhiddenitem.hxx46
-rw-r--r--include/editeng/charreliefitem.hxx59
-rw-r--r--include/editeng/charrotateitem.hxx107
-rw-r--r--include/editeng/charscaleitem.hxx57
-rw-r--r--include/editeng/cmapitem.hxx59
-rw-r--r--include/editeng/colritem.hxx115
-rw-r--r--include/editeng/contouritem.hxx50
-rw-r--r--include/editeng/crossedoutitem.hxx67
-rw-r--r--include/editeng/editdata.hxx359
-rw-r--r--include/editeng/editeng.hxx655
-rw-r--r--include/editeng/editengdllapi.h34
-rw-r--r--include/editeng/editerr.hxx29
-rw-r--r--include/editeng/editids.hrc162
-rw-r--r--include/editeng/editobj.hxx138
-rw-r--r--include/editeng/editrids.hrc318
-rw-r--r--include/editeng/editstat.hxx144
-rw-r--r--include/editeng/editund2.hxx71
-rw-r--r--include/editeng/editview.hxx382
-rw-r--r--include/editeng/edtdlg.hxx105
-rw-r--r--include/editeng/eedata.hxx48
-rw-r--r--include/editeng/eeitem.hxx148
-rw-r--r--include/editeng/eerdll.hxx52
-rw-r--r--include/editeng/emphasismarkitem.hxx60
-rw-r--r--include/editeng/escapementitem.hxx97
-rw-r--r--include/editeng/fhgtitem.hxx92
-rw-r--r--include/editeng/fieldupdater.hxx46
-rw-r--r--include/editeng/flditem.hxx438
-rw-r--r--include/editeng/flstitem.hxx65
-rw-r--r--include/editeng/fontitem.hxx113
-rw-r--r--include/editeng/forbiddencharacterstable.hxx52
-rw-r--r--include/editeng/forbiddenruleitem.hxx49
-rw-r--r--include/editeng/formatbreakitem.hxx71
-rw-r--r--include/editeng/frmdir.hxx62
-rw-r--r--include/editeng/frmdiritem.hxx64
-rw-r--r--include/editeng/hangulhanja.hxx288
-rw-r--r--include/editeng/hngpnctitem.hxx48
-rw-r--r--include/editeng/hyphenzoneitem.hxx92
-rw-r--r--include/editeng/itemtype.hxx41
-rw-r--r--include/editeng/justifyitem.hxx104
-rw-r--r--include/editeng/keepitem.hxx59
-rw-r--r--include/editeng/kernitem.hxx58
-rw-r--r--include/editeng/langitem.hxx68
-rw-r--r--include/editeng/legacyitem.hxx193
-rw-r--r--include/editeng/lineitem.hxx71
-rw-r--r--include/editeng/lrspitem.hxx168
-rw-r--r--include/editeng/lspcitem.hxx101
-rw-r--r--include/editeng/macros.hxx17
-rw-r--r--include/editeng/measfld.hxx48
-rw-r--r--include/editeng/memberids.h195
-rw-r--r--include/editeng/misspellrange.hxx38
-rw-r--r--include/editeng/nhypitem.hxx42
-rw-r--r--include/editeng/numdef.hxx28
-rw-r--r--include/editeng/numitem.hxx359
-rw-r--r--include/editeng/opaqitem.hxx53
-rw-r--r--include/editeng/optitems.hxx54
-rw-r--r--include/editeng/orphitem.hxx50
-rw-r--r--include/editeng/outliner.hxx989
-rw-r--r--include/editeng/outlobj.hxx204
-rw-r--r--include/editeng/overflowingtxt.hxx130
-rw-r--r--include/editeng/paperinf.hxx66
-rw-r--r--include/editeng/paragraphdata.hxx48
-rw-r--r--include/editeng/paravertalignitem.hxx60
-rw-r--r--include/editeng/pbinitem.hxx58
-rw-r--r--include/editeng/pgrditem.hxx51
-rw-r--r--include/editeng/pmdlitem.hxx70
-rw-r--r--include/editeng/postitem.hxx67
-rw-r--r--include/editeng/prntitem.hxx55
-rw-r--r--include/editeng/protitem.hxx76
-rw-r--r--include/editeng/rsiditem.hxx37
-rw-r--r--include/editeng/scriptspaceitem.hxx50
-rw-r--r--include/editeng/scripttypeitem.hxx52
-rw-r--r--include/editeng/section.hxx35
-rw-r--r--include/editeng/shaditem.hxx84
-rw-r--r--include/editeng/shdditem.hxx53
-rw-r--r--include/editeng/sizeitem.hxx69
-rw-r--r--include/editeng/spltitem.hxx61
-rw-r--r--include/editeng/splwrap.hxx113
-rw-r--r--include/editeng/svxacorr.hxx447
-rw-r--r--include/editeng/svxenum.hxx218
-rw-r--r--include/editeng/svxfont.hxx119
-rw-r--r--include/editeng/svxrtf.hxx295
-rw-r--r--include/editeng/swafopt.hxx140
-rw-r--r--include/editeng/tstpitem.hxx149
-rw-r--r--include/editeng/twolinesitem.hxx63
-rw-r--r--include/editeng/txtrange.hxx83
-rw-r--r--include/editeng/udlnitem.hxx102
-rw-r--r--include/editeng/ulspitem.hxx93
-rw-r--r--include/editeng/unoedhlp.hxx156
-rw-r--r--include/editeng/unoedprx.hxx172
-rw-r--r--include/editeng/unoedsrc.hxx533
-rw-r--r--include/editeng/unofdesc.hxx50
-rw-r--r--include/editeng/unofield.hxx111
-rw-r--r--include/editeng/unofored.hxx93
-rw-r--r--include/editeng/unoforou.hxx121
-rw-r--r--include/editeng/unoipset.hxx87
-rw-r--r--include/editeng/unolingu.hxx133
-rw-r--r--include/editeng/unonames.hxx52
-rw-r--r--include/editeng/unonrule.hxx90
-rw-r--r--include/editeng/unoprnms.hxx361
-rw-r--r--include/editeng/unotext.hxx677
-rw-r--r--include/editeng/unoviwou.hxx56
-rw-r--r--include/editeng/urlfieldhelper.hxx28
-rw-r--r--include/editeng/wghtitem.hxx74
-rw-r--r--include/editeng/widwitem.hxx50
-rw-r--r--include/editeng/writingmodeitem.hxx55
-rw-r--r--include/editeng/wrlmitem.hxx52
-rw-r--r--include/editeng/xmlcnitm.hxx73
-rw-r--r--include/embeddedobj/embeddedupdate.hxx52
-rw-r--r--include/embeddedobj/embobjdllapi.h20
-rw-r--r--include/filter/dllapi.h34
-rw-r--r--include/filter/msfilter/classids.hxx47
-rw-r--r--include/filter/msfilter/countryid.hxx307
-rw-r--r--include/filter/msfilter/dffpropset.hxx74
-rw-r--r--include/filter/msfilter/dffrecordheader.hxx64
-rw-r--r--include/filter/msfilter/escherex.hxx1221
-rw-r--r--include/filter/msfilter/mscodec.hxx499
-rw-r--r--include/filter/msfilter/msdffimp.hxx809
-rw-r--r--include/filter/msfilter/msfilterdllapi.h35
-rw-r--r--include/filter/msfilter/msocximex.hxx84
-rw-r--r--include/filter/msfilter/msoleexp.hxx56
-rw-r--r--include/filter/msfilter/mstoolbar.hxx355
-rw-r--r--include/filter/msfilter/msvbahelper.hxx116
-rw-r--r--include/filter/msfilter/rtfutil.hxx78
-rw-r--r--include/filter/msfilter/svdfppt.hxx1488
-rw-r--r--include/filter/msfilter/svxmsbas.hxx73
-rw-r--r--include/filter/msfilter/util.hxx145
-rw-r--r--include/filter/msfilter/ww8fields.hxx130
-rw-r--r--include/formula/ExternalReferenceHelper.hxx44
-rw-r--r--include/formula/FormulaCompiler.hxx506
-rw-r--r--include/formula/FormulaOpCodeMapperObj.hxx79
-rw-r--r--include/formula/IControlReferenceHandler.hxx44
-rw-r--r--include/formula/IFunctionDescription.hxx161
-rw-r--r--include/formula/compiler.hxx531
-rw-r--r--include/formula/errorcodes.hxx190
-rw-r--r--include/formula/formdata.hxx71
-rw-r--r--include/formula/formula.hxx125
-rw-r--r--include/formula/formuladllapi.h34
-rw-r--r--include/formula/formulahelper.hxx86
-rw-r--r--include/formula/funcutl.hxx182
-rw-r--r--include/formula/funcvarargs.h49
-rw-r--r--include/formula/grammar.hxx247
-rw-r--r--include/formula/opcode.hxx995
-rw-r--r--include/formula/paramclass.hxx81
-rw-r--r--include/formula/token.hxx482
-rw-r--r--include/formula/tokenarray.hxx669
-rw-r--r--include/formula/types.hxx34
-rw-r--r--include/formula/vectortoken.hxx110
-rw-r--r--include/fpicker/fpsofficeResMgr.hxx15
-rw-r--r--include/fpicker/strings.hrc42
-rw-r--r--include/framework/ContextChangeEventMultiplexerTunnel.hxx30
-rw-r--r--include/framework/actiontriggerhelper.hxx65
-rw-r--r--include/framework/addonsoptions.hxx264
-rw-r--r--include/framework/configimporter.hxx49
-rw-r--r--include/framework/desktop.hxx455
-rw-r--r--include/framework/dispatchhelper.hxx111
-rw-r--r--include/framework/documentundoguard.hxx61
-rw-r--r--include/framework/framecontainer.hxx91
-rw-r--r--include/framework/framelistanalyzer.hxx204
-rw-r--r--include/framework/fwkdllapi.h22
-rw-r--r--include/framework/gate.hxx146
-rw-r--r--include/framework/generictoolbarcontroller.hxx73
-rw-r--r--include/framework/imutex.hxx43
-rw-r--r--include/framework/interaction.hxx105
-rw-r--r--include/framework/sfxhelperfunctions.hxx107
-rw-r--r--include/framework/titlehelper.hxx181
-rw-r--r--include/framework/transactionmanager.hxx123
-rw-r--r--include/framework/undomanagerhelper.hxx162
-rw-r--r--include/helpcompiler/HelpIndexer.hxx90
-rw-r--r--include/helpcompiler/HelpSearch.hxx42
-rw-r--r--include/helpcompiler/compilehelp.hxx74
-rw-r--r--include/helpcompiler/dllapi.h34
-rw-r--r--include/i18nlangtag/applelangid.hxx145
-rw-r--r--include/i18nlangtag/i18nlangtagdllapi.h34
-rw-r--r--include/i18nlangtag/lang.h803
-rw-r--r--include/i18nlangtag/languagetag.hxx592
-rw-r--r--include/i18nlangtag/languagetagicu.hxx73
-rw-r--r--include/i18nlangtag/mslangid.hxx338
-rw-r--r--include/i18npool/reservedconstants.hxx29
-rw-r--r--include/i18nutil/calendar.hxx23
-rw-r--r--include/i18nutil/casefolding.hxx91
-rw-r--r--include/i18nutil/i18nutildllapi.h34
-rw-r--r--include/i18nutil/oneToOneMapping.hxx90
-rw-r--r--include/i18nutil/paper.hxx158
-rw-r--r--include/i18nutil/scripttypedetector.hxx38
-rw-r--r--include/i18nutil/searchopt.hxx138
-rw-r--r--include/i18nutil/transliteration.hxx133
-rw-r--r--include/i18nutil/unicode.hxx132
-rw-r--r--include/i18nutil/widthfolding.hxx57
-rw-r--r--include/jvmaccess/classpath.hxx87
-rw-r--r--include/jvmaccess/jvmaccessdllapi.h24
-rw-r--r--include/jvmaccess/unovirtualmachine.hxx100
-rw-r--r--include/jvmaccess/virtualmachine.hxx154
-rw-r--r--include/jvmfwk/framework.hxx671
-rw-r--r--include/jvmfwk/jvmfwkdllapi.hxx23
-rw-r--r--include/linguistic/hyphdta.hxx110
-rw-r--r--include/linguistic/lngdllapi.h35
-rw-r--r--include/linguistic/lngprophelp.hxx306
-rw-r--r--include/linguistic/lngprops.hxx31
-rw-r--r--include/linguistic/misc.hxx196
-rw-r--r--include/linguistic/spelldta.hxx95
-rw-r--r--include/o3tl/any.hxx325
-rw-r--r--include/o3tl/char16_t2wchar_t.hxx59
-rw-r--r--include/o3tl/cow_wrapper.hxx387
-rw-r--r--include/o3tl/cppunittraitshelper.hxx28
-rw-r--r--include/o3tl/deleter.hxx68
-rw-r--r--include/o3tl/enumarray.hxx140
-rw-r--r--include/o3tl/enumrange.hxx87
-rw-r--r--include/o3tl/float_int_conversion.hxx72
-rw-r--r--include/o3tl/functional.hxx63
-rw-r--r--include/o3tl/hash_combine.hxx55
-rw-r--r--include/o3tl/intcmp.hxx132
-rw-r--r--include/o3tl/lazy_update.hxx89
-rw-r--r--include/o3tl/lru_map.hxx299
-rw-r--r--include/o3tl/make_shared.hxx46
-rw-r--r--include/o3tl/numeric.hxx28
-rw-r--r--include/o3tl/runtimetooustring.hxx47
-rw-r--r--include/o3tl/safeCoInitUninit.hxx58
-rw-r--r--include/o3tl/safeint.hxx236
-rw-r--r--include/o3tl/sorted_vector.hxx421
-rw-r--r--include/o3tl/span.hxx100
-rw-r--r--include/o3tl/sprintf.hxx41
-rw-r--r--include/o3tl/string_view.hxx487
-rw-r--r--include/o3tl/strong_int.hxx156
-rw-r--r--include/o3tl/temporary.hxx27
-rw-r--r--include/o3tl/typed_flags_set.hxx325
-rw-r--r--include/o3tl/underlyingenumvalue.hxx29
-rw-r--r--include/o3tl/unit_conversion.hxx261
-rw-r--r--include/o3tl/unreachable.hxx48
-rw-r--r--include/o3tl/unsafe_downcast.hxx35
-rw-r--r--include/o3tl/vector_pool.hxx123
-rw-r--r--include/o3tl/vector_utils.hxx29
-rw-r--r--include/onlineupdate/mar.h198
-rw-r--r--include/onlineupdate/mar_cmdline.h110
-rw-r--r--include/onlineupdate/mar_private.h79
-rw-r--r--include/onlineupdate/mozilla/Assertions.h503
-rw-r--r--include/onlineupdate/mozilla/Attributes.h481
-rw-r--r--include/onlineupdate/mozilla/Compiler.h110
-rw-r--r--include/onlineupdate/mozilla/Likely.h23
-rw-r--r--include/onlineupdate/mozilla/MacroArgs.h105
-rw-r--r--include/onlineupdate/mozilla/TypeTraits.h1116
-rw-r--r--include/onlineupdate/mozilla/Types.h134
-rw-r--r--include/onlineupdate/mozilla/nsTraceRefcnt.h67
-rw-r--r--include/oox/core/binarycodec.hxx42
-rw-r--r--include/oox/core/contexthandler.hxx115
-rw-r--r--include/oox/core/contexthandler2.hxx291
-rw-r--r--include/oox/core/fastparser.hxx118
-rw-r--r--include/oox/core/fasttokenhandler.hxx68
-rw-r--r--include/oox/core/filterbase.hxx274
-rw-r--r--include/oox/core/filterdetect.hxx172
-rw-r--r--include/oox/core/fragmenthandler.hxx139
-rw-r--r--include/oox/core/fragmenthandler2.hxx115
-rw-r--r--include/oox/core/recordparser.hxx88
-rw-r--r--include/oox/core/relations.hxx120
-rw-r--r--include/oox/core/relationshandler.hxx58
-rw-r--r--include/oox/core/xmlfilterbase.hxx297
-rw-r--r--include/oox/crypto/AgileEngine.hxx147
-rw-r--r--include/oox/crypto/CryptTools.hxx120
-rw-r--r--include/oox/crypto/CryptoEngine.hxx66
-rw-r--r--include/oox/crypto/DocumentDecryption.hxx54
-rw-r--r--include/oox/crypto/DocumentEncryption.hxx52
-rw-r--r--include/oox/crypto/Standard2007Engine.hxx61
-rw-r--r--include/oox/crypto/StrongEncryptionDataSpace.hxx76
-rw-r--r--include/oox/dllapi.h33
-rw-r--r--include/oox/drawingml/chart/chartconverter.hxx100
-rw-r--r--include/oox/drawingml/chart/datasourcemodel.hxx66
-rw-r--r--include/oox/drawingml/chart/modelbase.hxx121
-rw-r--r--include/oox/drawingml/clrscheme.hxx103
-rw-r--r--include/oox/drawingml/color.hxx167
-rw-r--r--include/oox/drawingml/connectorshapecontext.hxx59
-rw-r--r--include/oox/drawingml/diagram/diagram.hxx51
-rw-r--r--include/oox/drawingml/drawingmltypes.hxx235
-rw-r--r--include/oox/drawingml/graphicshapecontext.hxx111
-rw-r--r--include/oox/drawingml/shape.hxx430
-rw-r--r--include/oox/drawingml/shapecontext.hxx53
-rw-r--r--include/oox/drawingml/shapegroupcontext.hxx45
-rw-r--r--include/oox/drawingml/shapepropertymap.hxx168
-rw-r--r--include/oox/drawingml/theme.hxx123
-rw-r--r--include/oox/drawingml/themefragmenthandler.hxx57
-rw-r--r--include/oox/dump/dffdumper.hxx64
-rw-r--r--include/oox/dump/dumperbase.hxx1740
-rw-r--r--include/oox/dump/oledumper.hxx849
-rw-r--r--include/oox/dump/pptxdumper.hxx73
-rw-r--r--include/oox/dump/xlsbdumper.hxx90
-rw-r--r--include/oox/export/DMLPresetShapeExport.hxx140
-rw-r--r--include/oox/export/chartexport.hxx279
-rw-r--r--include/oox/export/drawingml.hxx382
-rw-r--r--include/oox/export/shapes.hxx213
-rw-r--r--include/oox/export/utils.hxx80
-rw-r--r--include/oox/export/vmlexport.hxx209
-rw-r--r--include/oox/helper/addtosequence.hxx41
-rw-r--r--include/oox/helper/attributelist.hxx192
-rw-r--r--include/oox/helper/binaryinputstream.hxx385
-rw-r--r--include/oox/helper/binaryoutputstream.hxx208
-rw-r--r--include/oox/helper/binarystreambase.hxx179
-rw-r--r--include/oox/helper/containerhelper.hxx298
-rw-r--r--include/oox/helper/grabbagstack.hxx61
-rw-r--r--include/oox/helper/graphichelper.hxx161
-rw-r--r--include/oox/helper/helper.hxx301
-rw-r--r--include/oox/helper/modelobjecthelper.hxx131
-rw-r--r--include/oox/helper/progressbar.hxx132
-rw-r--r--include/oox/helper/propertymap.hxx130
-rw-r--r--include/oox/helper/propertyset.hxx151
-rw-r--r--include/oox/helper/refmap.hxx144
-rw-r--r--include/oox/helper/refvector.hxx163
-rw-r--r--include/oox/helper/storagebase.hxx192
-rw-r--r--include/oox/helper/textinputstream.hxx121
-rw-r--r--include/oox/helper/zipstorage.hxx94
-rw-r--r--include/oox/mathml/export.hxx45
-rw-r--r--include/oox/mathml/import.hxx51
-rw-r--r--include/oox/mathml/importutils.hxx255
-rw-r--r--include/oox/ole/axbinaryreader.hxx251
-rw-r--r--include/oox/ole/axbinarywriter.hxx164
-rw-r--r--include/oox/ole/axcontrol.hxx993
-rw-r--r--include/oox/ole/axcontrolfragment.hxx76
-rw-r--r--include/oox/ole/axfontdata.hxx86
-rw-r--r--include/oox/ole/olehelper.hxx198
-rw-r--r--include/oox/ole/oleobjecthelper.hxx87
-rw-r--r--include/oox/ole/olestorage.hxx115
-rw-r--r--include/oox/ole/vbacontrol.hxx214
-rw-r--r--include/oox/ole/vbaexport.hxx155
-rw-r--r--include/oox/ole/vbahelper.hxx91
-rw-r--r--include/oox/ole/vbainputstream.hxx74
-rw-r--r--include/oox/ole/vbamodule.hxx123
-rw-r--r--include/oox/ole/vbaproject.hxx211
-rw-r--r--include/oox/ppt/animationspersist.hxx125
-rw-r--r--include/oox/ppt/backgroundproperties.hxx47
-rw-r--r--include/oox/ppt/comments.hxx117
-rw-r--r--include/oox/ppt/customshowlistcontext.hxx59
-rw-r--r--include/oox/ppt/headerfooter.hxx43
-rw-r--r--include/oox/ppt/layoutfragmenthandler.hxx48
-rw-r--r--include/oox/ppt/pptfilterhelpers.hxx99
-rw-r--r--include/oox/ppt/pptgraphicshapecontext.hxx47
-rw-r--r--include/oox/ppt/pptimport.hxx107
-rw-r--r--include/oox/ppt/pptshape.hxx98
-rw-r--r--include/oox/ppt/pptshapecontext.hxx47
-rw-r--r--include/oox/ppt/pptshapegroupcontext.hxx66
-rw-r--r--include/oox/ppt/pptshapepropertiescontext.hxx47
-rw-r--r--include/oox/ppt/presPropsfragmenthandler.hxx44
-rw-r--r--include/oox/ppt/presentationfragmenthandler.hxx74
-rw-r--r--include/oox/ppt/slidefragmenthandler.hxx63
-rw-r--r--include/oox/ppt/slidemastertextstylescontext.hxx47
-rw-r--r--include/oox/ppt/slidepersist.hxx173
-rw-r--r--include/oox/ppt/slidetimingcontext.hxx48
-rw-r--r--include/oox/ppt/slidetransition.hxx82
-rw-r--r--include/oox/ppt/slidetransitioncontext.hxx58
-rw-r--r--include/oox/ppt/soundactioncontext.hxx58
-rw-r--r--include/oox/ppt/timenode.hxx128
-rw-r--r--include/oox/ppt/timenodelistcontext.hxx71
-rw-r--r--include/oox/shape/ShapeContextHandler.hxx156
-rw-r--r--include/oox/shape/ShapeFilterBase.hxx92
-rw-r--r--include/oox/token/namespacemap.hxx49
-rw-r--r--include/oox/token/propertynames.hxx33
-rw-r--r--include/oox/token/relationship.hxx76
-rw-r--r--include/oox/token/tokenmap.hxx95
-rw-r--r--include/oox/vml/vmldrawing.hxx206
-rw-r--r--include/oox/vml/vmldrawingfragment.hxx67
-rw-r--r--include/oox/vml/vmlformatting.hxx285
-rw-r--r--include/oox/vml/vmlinputstream.hxx95
-rw-r--r--include/oox/vml/vmlshape.hxx476
-rw-r--r--include/oox/vml/vmlshapecontainer.hxx144
-rw-r--r--include/oox/vml/vmlshapecontext.hxx191
-rw-r--r--include/oox/vml/vmltextbox.hxx113
-rw-r--r--include/oox/vml/vmltextboxcontext.hxx88
-rw-r--r--include/opencl/OpenCLZone.hxx32
-rw-r--r--include/opencl/openclconfig.hxx100
-rw-r--r--include/opencl/opencldllapi.h34
-rw-r--r--include/opencl/openclwrapper.hxx98
-rw-r--r--include/opencl/platforminfo.hxx51
-rw-r--r--include/osl/conditn.h101
-rw-r--r--include/osl/conditn.hxx172
-rw-r--r--include/osl/detail/android-bootstrap.h59
-rw-r--r--include/osl/detail/component-defines.h47
-rw-r--r--include/osl/detail/component-mapping.h48
-rw-r--r--include/osl/detail/file.h32
-rw-r--r--include/osl/diagnose.h124
-rw-r--r--include/osl/diagnose.hxx200
-rw-r--r--include/osl/doublecheckedlocking.h81
-rw-r--r--include/osl/endian.h155
-rw-r--r--include/osl/file.h1677
-rw-r--r--include/osl/file.hxx1951
-rw-r--r--include/osl/getglobalmutex.hxx44
-rw-r--r--include/osl/interlck.h108
-rw-r--r--include/osl/module.h230
-rw-r--r--include/osl/module.hxx178
-rw-r--r--include/osl/mutex.h84
-rw-r--r--include/osl/mutex.hxx260
-rw-r--r--include/osl/nlsupport.h60
-rw-r--r--include/osl/pipe.h127
-rw-r--r--include/osl/pipe.hxx224
-rw-r--r--include/osl/pipe_decl.hxx242
-rw-r--r--include/osl/process.h425
-rw-r--r--include/osl/profile.h151
-rw-r--r--include/osl/profile.hxx212
-rw-r--r--include/osl/security.h177
-rw-r--r--include/osl/security.hxx110
-rw-r--r--include/osl/security_decl.hxx133
-rw-r--r--include/osl/signal.h112
-rw-r--r--include/osl/socket.h862
-rw-r--r--include/osl/socket.hxx571
-rw-r--r--include/osl/socket_decl.hxx750
-rw-r--r--include/osl/test/uniquepipename.hxx45
-rw-r--r--include/osl/thread.h232
-rw-r--r--include/osl/thread.hxx240
-rw-r--r--include/osl/time.h187
-rw-r--r--include/package/Deflater.hxx62
-rw-r--r--include/package/Inflater.hxx57
-rw-r--r--include/package/packagedllapi.hxx22
-rw-r--r--include/postmac.h25
-rw-r--r--include/postwin.h60
-rw-r--r--include/premac.h25
-rw-r--r--include/prewin.h49
-rw-r--r--include/registry/reader.hxx606
-rw-r--r--include/registry/refltype.hxx77
-rw-r--r--include/registry/regdllapi.h33
-rw-r--r--include/registry/registry.hxx1059
-rw-r--r--include/registry/regtype.h141
-rw-r--r--include/registry/typereg_reader.hxx565
-rw-r--r--include/registry/types.hxx339
-rw-r--r--include/registry/version.h69
-rw-r--r--include/registry/writer.h262
-rw-r--r--include/registry/writer.hxx291
-rw-r--r--include/rtl/alloc.h336
-rw-r--r--include/rtl/bootstrap.h224
-rw-r--r--include/rtl/bootstrap.hxx231
-rw-r--r--include/rtl/byteseq.h331
-rw-r--r--include/rtl/byteseq.hxx144
-rw-r--r--include/rtl/character.hxx526
-rw-r--r--include/rtl/cipher.h282
-rw-r--r--include/rtl/crc.h56
-rw-r--r--include/rtl/digest.h644
-rw-r--r--include/rtl/instance.hxx643
-rw-r--r--include/rtl/locale.h139
-rw-r--r--include/rtl/malformeduriexception.hxx72
-rw-r--r--include/rtl/math.h509
-rw-r--r--include/rtl/math.hxx511
-rw-r--r--include/rtl/process.h83
-rw-r--r--include/rtl/random.h103
-rw-r--r--include/rtl/ref.hxx316
-rw-r--r--include/rtl/strbuf.h143
-rw-r--r--include/rtl/strbuf.hxx1131
-rw-r--r--include/rtl/string.h1462
-rw-r--r--include/rtl/string.hxx2314
-rw-r--r--include/rtl/stringconcat.hxx588
-rw-r--r--include/rtl/stringutils.hxx391
-rw-r--r--include/rtl/tencinfo.h284
-rw-r--r--include/rtl/textcvt.h194
-rw-r--r--include/rtl/textenc.h266
-rw-r--r--include/rtl/unload.h96
-rw-r--r--include/rtl/uri.h357
-rw-r--r--include/rtl/uri.hxx179
-rw-r--r--include/rtl/ustrbuf.h218
-rw-r--r--include/rtl/ustrbuf.hxx1796
-rw-r--r--include/rtl/ustring.h2414
-rw-r--r--include/rtl/ustring.hxx3560
-rw-r--r--include/rtl/uuid.h186
-rw-r--r--include/sal/alloca.h57
-rw-r--r--include/sal/backtrace.hxx49
-rw-r--r--include/sal/config.h122
-rw-r--r--include/sal/detail/log.h108
-rw-r--r--include/sal/log-areas.dox654
-rw-r--r--include/sal/log.hxx436
-rw-r--r--include/sal/macros.h62
-rw-r--r--include/sal/main.h157
-rw-r--r--include/sal/mathconf.h172
-rw-r--r--include/sal/saldllapi.h39
-rw-r--r--include/sal/types.h687
-rw-r--r--include/sal/typesizes.h20
-rw-r--r--include/salhelper/condition.hxx115
-rw-r--r--include/salhelper/dynload.hxx209
-rw-r--r--include/salhelper/linkhelper.hxx79
-rw-r--r--include/salhelper/refobj.hxx102
-rw-r--r--include/salhelper/salhelperdllapi.h38
-rw-r--r--include/salhelper/simplereferenceobject.hxx122
-rw-r--r--include/salhelper/singletonref.hxx203
-rw-r--r--include/salhelper/thread.hxx96
-rw-r--r--include/salhelper/timer.hxx225
-rw-r--r--include/sax/fastattribs.hxx237
-rw-r--r--include/sax/fastparser.hxx79
-rw-r--r--include/sax/fastsaxdllapi.h33
-rw-r--r--include/sax/fshelper.hxx178
-rw-r--r--include/sax/saxdllapi.h33
-rw-r--r--include/sax/tools/converter.hxx313
-rw-r--r--include/sax/tools/documenthandleradapter.hxx214
-rw-r--r--include/sfx2/AccessibilityCheck.hxx34
-rw-r--r--include/sfx2/AccessibilityIssue.hxx59
-rw-r--r--include/sfx2/DocumentMetadataAccess.hxx152
-rw-r--r--include/sfx2/DocumentSigner.hxx47
-rw-r--r--include/sfx2/LokControlHandler.hxx155
-rw-r--r--include/sfx2/Metadatable.hxx170
-rw-r--r--include/sfx2/QuerySaveDocument.hxx43
-rw-r--r--include/sfx2/StyleManager.hxx51
-rw-r--r--include/sfx2/StylePreviewRenderer.hxx57
-rw-r--r--include/sfx2/XmlIdRegistry.hxx67
-rw-r--r--include/sfx2/app.hxx233
-rw-r--r--include/sfx2/basedlgs.hxx136
-rw-r--r--include/sfx2/bindings.hxx208
-rw-r--r--include/sfx2/brokenpackageint.hxx63
-rw-r--r--include/sfx2/chalign.hxx55
-rw-r--r--include/sfx2/charwin.hxx72
-rw-r--r--include/sfx2/childwin.hxx235
-rw-r--r--include/sfx2/classificationhelper.hxx227
-rw-r--r--include/sfx2/ctrlitem.hxx97
-rw-r--r--include/sfx2/devtools/DevelopmentToolChildWindow.hxx27
-rw-r--r--include/sfx2/devtools/DevelopmentToolDockingWindow.hxx72
-rw-r--r--include/sfx2/devtools/DocumentModelTreeHandler.hxx52
-rw-r--r--include/sfx2/devtools/ObjectInspectorTreeHandler.hxx101
-rw-r--r--include/sfx2/devtools/ObjectInspectorWidgets.hxx55
-rw-r--r--include/sfx2/dialoghelper.hxx41
-rw-r--r--include/sfx2/digitalsignatures.hxx38
-rw-r--r--include/sfx2/dinfdlg.hxx579
-rw-r--r--include/sfx2/dispatch.hxx184
-rw-r--r--include/sfx2/dllapi.h36
-rw-r--r--include/sfx2/docfac.hxx96
-rw-r--r--include/sfx2/docfile.hxx309
-rw-r--r--include/sfx2/docfilt.hxx125
-rw-r--r--include/sfx2/docinf.hxx75
-rw-r--r--include/sfx2/docinsert.hxx77
-rw-r--r--include/sfx2/dockwin.hxx130
-rw-r--r--include/sfx2/docmacromode.hxx307
-rw-r--r--include/sfx2/docstoragemodifylistener.hxx82
-rw-r--r--include/sfx2/doctempl.hxx117
-rw-r--r--include/sfx2/event.hxx268
-rw-r--r--include/sfx2/evntconf.hxx102
-rw-r--r--include/sfx2/fcontnr.hxx119
-rw-r--r--include/sfx2/filedlghelper.hxx313
-rw-r--r--include/sfx2/flatpak.hxx33
-rw-r--r--include/sfx2/frame.hxx203
-rw-r--r--include/sfx2/frmdescr.hxx102
-rw-r--r--include/sfx2/frmhtml.hxx38
-rw-r--r--include/sfx2/frmhtmlw.hxx71
-rw-r--r--include/sfx2/groupid.hxx74
-rw-r--r--include/sfx2/htmlmode.hxx31
-rw-r--r--include/sfx2/infobar.hxx140
-rw-r--r--include/sfx2/inputdlg.hxx38
-rw-r--r--include/sfx2/ipclient.hxx101
-rw-r--r--include/sfx2/linkmgr.hxx187
-rw-r--r--include/sfx2/linksrc.hxx118
-rw-r--r--include/sfx2/listview.hxx116
-rw-r--r--include/sfx2/lnkbase.hxx179
-rw-r--r--include/sfx2/lokcallback.hxx51
-rw-r--r--include/sfx2/lokcomponenthelpers.hxx90
-rw-r--r--include/sfx2/lokhelper.hxx171
-rw-r--r--include/sfx2/mailmodelapi.hxx104
-rw-r--r--include/sfx2/mieclip.hxx43
-rw-r--r--include/sfx2/minfitem.hxx70
-rw-r--r--include/sfx2/module.hxx103
-rw-r--r--include/sfx2/msg.hxx264
-rw-r--r--include/sfx2/msgpool.hxx74
-rw-r--r--include/sfx2/navigat.hxx43
-rw-r--r--include/sfx2/new.hxx108
-rw-r--r--include/sfx2/newstyle.hxx55
-rw-r--r--include/sfx2/notebookbar/SfxNotebookBar.hxx89
-rw-r--r--include/sfx2/objface.hxx121
-rw-r--r--include/sfx2/objitem.hxx48
-rw-r--r--include/sfx2/objsh.hxx918
-rw-r--r--include/sfx2/opengrf.hxx72
-rw-r--r--include/sfx2/pageids.hxx71
-rw-r--r--include/sfx2/passwd.hxx130
-rw-r--r--include/sfx2/printer.hxx62
-rw-r--r--include/sfx2/printopt.hxx86
-rw-r--r--include/sfx2/progress.hxx63
-rw-r--r--include/sfx2/request.hxx129
-rw-r--r--include/sfx2/safemode.hxx73
-rw-r--r--include/sfx2/sfxbasecontroller.hxx218
-rw-r--r--include/sfx2/sfxbasemodel.hxx753
-rw-r--r--include/sfx2/sfxdlg.hxx155
-rw-r--r--include/sfx2/sfxhelp.hxx64
-rw-r--r--include/sfx2/sfxhtml.hxx113
-rw-r--r--include/sfx2/sfxmodelfactory.hxx66
-rw-r--r--include/sfx2/sfxresid.hxx30
-rw-r--r--include/sfx2/sfxsids.hrc739
-rw-r--r--include/sfx2/sfxstatuslistener.hxx74
-rw-r--r--include/sfx2/sfxuno.hxx50
-rw-r--r--include/sfx2/shell.hxx587
-rw-r--r--include/sfx2/sidebar/AsynchronousCall.hxx52
-rw-r--r--include/sfx2/sidebar/Context.hxx58
-rw-r--r--include/sfx2/sidebar/ControllerItem.hxx79
-rw-r--r--include/sfx2/sidebar/Deck.hxx87
-rw-r--r--include/sfx2/sidebar/FocusManager.hxx140
-rw-r--r--include/sfx2/sidebar/IContextChangeReceiver.hxx40
-rw-r--r--include/sfx2/sidebar/ILayoutableWindow.hxx40
-rw-r--r--include/sfx2/sidebar/Panel.hxx123
-rw-r--r--include/sfx2/sidebar/PanelLayout.hxx52
-rw-r--r--include/sfx2/sidebar/ResourceManager.hxx132
-rw-r--r--include/sfx2/sidebar/Sidebar.hxx67
-rw-r--r--include/sfx2/sidebar/SidebarChildWindow.hxx46
-rw-r--r--include/sfx2/sidebar/SidebarController.hxx302
-rw-r--r--include/sfx2/sidebar/SidebarDockingWindow.hxx66
-rw-r--r--include/sfx2/sidebar/SidebarModelUpdate.hxx33
-rw-r--r--include/sfx2/sidebar/SidebarPanelBase.hxx102
-rw-r--r--include/sfx2/sidebar/TabBar.hxx136
-rw-r--r--include/sfx2/sidebar/Theme.hxx184
-rw-r--r--include/sfx2/signaturestate.hxx54
-rw-r--r--include/sfx2/stbitem.hxx134
-rw-r--r--include/sfx2/strings.hrc361
-rw-r--r--include/sfx2/styfitem.hxx62
-rw-r--r--include/sfx2/styledlg.hxx52
-rw-r--r--include/sfx2/tabdlg.hxx269
-rw-r--r--include/sfx2/tbxctrl.hxx142
-rw-r--r--include/sfx2/templatedlg.hxx193
-rw-r--r--include/sfx2/templatedlglocalview.hxx72
-rw-r--r--include/sfx2/templatelocalview.hxx192
-rw-r--r--include/sfx2/templateproperties.hxx29
-rw-r--r--include/sfx2/templdlg.hxx46
-rw-r--r--include/sfx2/thumbnailview.hxx331
-rw-r--r--include/sfx2/thumbnailviewitem.hxx138
-rw-r--r--include/sfx2/toolbarids.hxx77
-rw-r--r--include/sfx2/tplpitem.hxx53
-rw-r--r--include/sfx2/userinputinterception.hxx82
-rw-r--r--include/sfx2/viewfac.hxx60
-rw-r--r--include/sfx2/viewfrm.hxx277
-rw-r--r--include/sfx2/viewsh.hxx435
-rw-r--r--include/sfx2/watermarkitem.hxx47
-rw-r--r--include/sfx2/weldutils.hxx67
-rw-r--r--include/sfx2/xmldump.hxx29
-rw-r--r--include/sfx2/zoomitem.hxx81
-rw-r--r--include/sot/exchange.hxx152
-rw-r--r--include/sot/filelist.hxx49
-rw-r--r--include/sot/formats.hxx193
-rw-r--r--include/sot/object.hxx53
-rw-r--r--include/sot/sotdllapi.h34
-rw-r--r--include/sot/stg.hxx317
-rw-r--r--include/sot/storage.hxx172
-rw-r--r--include/sot/storinfo.hxx63
-rw-r--r--include/store/store.h217
-rw-r--r--include/store/store.hxx353
-rw-r--r--include/store/storedllapi.h29
-rw-r--r--include/store/types.h130
-rw-r--r--include/svl/IndexedStyleSheets.hxx182
-rw-r--r--include/svl/PasswordHelper.hxx55
-rw-r--r--include/svl/SfxBroadcaster.hxx71
-rw-r--r--include/svl/adrparse.hxx50
-rw-r--r--include/svl/aeitem.hxx46
-rw-r--r--include/svl/asiancfg.hxx78
-rw-r--r--include/svl/broadcast.hxx103
-rw-r--r--include/svl/cenumitm.hxx60
-rw-r--r--include/svl/cintitem.hxx176
-rw-r--r--include/svl/cjkoptions.hxx50
-rw-r--r--include/svl/converter.hxx33
-rw-r--r--include/svl/cryptosign.hxx98
-rw-r--r--include/svl/ctloptions.hxx85
-rw-r--r--include/svl/currencytable.hxx43
-rw-r--r--include/svl/custritm.hxx70
-rw-r--r--include/svl/documentlockfile.hxx69
-rw-r--r--include/svl/eitem.hxx107
-rw-r--r--include/svl/filenotation.hxx62
-rw-r--r--include/svl/flagitem.hxx56
-rw-r--r--include/svl/fstathelper.hxx58
-rw-r--r--include/svl/globalnameitem.hxx54
-rw-r--r--include/svl/grabbagitem.hxx46
-rw-r--r--include/svl/gridprinter.hxx38
-rw-r--r--include/svl/hint.hxx225
-rw-r--r--include/svl/ilstitem.hxx55
-rw-r--r--include/svl/imageitm.hxx54
-rw-r--r--include/svl/inethist.hxx99
-rw-r--r--include/svl/inettype.hxx263
-rw-r--r--include/svl/instrm.hxx63
-rw-r--r--include/svl/int64item.hxx51
-rw-r--r--include/svl/intitem.hxx130
-rw-r--r--include/svl/isethint.hxx40
-rw-r--r--include/svl/itemiter.hxx60
-rw-r--r--include/svl/itempool.hxx228
-rw-r--r--include/svl/itemprop.hxx203
-rw-r--r--include/svl/itemset.hxx287
-rw-r--r--include/svl/languageoptions.hxx85
-rw-r--r--include/svl/lckbitem.hxx53
-rw-r--r--include/svl/legacyitem.hxx52
-rw-r--r--include/svl/listener.hxx69
-rw-r--r--include/svl/lngmisc.hxx56
-rw-r--r--include/svl/lockfilecommon.hxx77
-rw-r--r--include/svl/lstner.hxx75
-rw-r--r--include/svl/macitem.hxx152
-rw-r--r--include/svl/memberid.h85
-rw-r--r--include/svl/metitem.hxx37
-rw-r--r--include/svl/msodocumentlockfile.hxx55
-rw-r--r--include/svl/nfkeytab.hxx102
-rw-r--r--include/svl/nfsymbol.hxx63
-rw-r--r--include/svl/numformat.hxx750
-rw-r--r--include/svl/numuno.hxx71
-rw-r--r--include/svl/ondemand.hxx349
-rw-r--r--include/svl/outstrm.hxx54
-rw-r--r--include/svl/ownlist.hxx75
-rw-r--r--include/svl/pickerhistoryaccess.hxx44
-rw-r--r--include/svl/poolcach.hxx57
-rw-r--r--include/svl/poolitem.hxx333
-rw-r--r--include/svl/ptitem.hxx62
-rw-r--r--include/svl/rectitem.hxx55
-rw-r--r--include/svl/rngitem.hxx48
-rw-r--r--include/svl/setitem.hxx51
-rw-r--r--include/svl/sharecontrolfile.hxx71
-rw-r--r--include/svl/sharedstring.hxx158
-rw-r--r--include/svl/sharedstringpool.hxx65
-rw-r--r--include/svl/sigstruct.hxx177
-rw-r--r--include/svl/slstitm.hxx72
-rw-r--r--include/svl/solar.hrc96
-rw-r--r--include/svl/srchdefs.hxx50
-rw-r--r--include/svl/srchitem.hxx326
-rw-r--r--include/svl/stritem.hxx45
-rw-r--r--include/svl/style.hxx359
-rw-r--r--include/svl/stylepool.hxx88
-rw-r--r--include/svl/stylesheetuser.hxx41
-rw-r--r--include/svl/svdde.hxx326
-rw-r--r--include/svl/svl.hrc37
-rw-r--r--include/svl/svldllapi.h34
-rw-r--r--include/svl/svlresid.hxx21
-rw-r--r--include/svl/typedwhich.hxx62
-rw-r--r--include/svl/undo.hxx343
-rw-r--r--include/svl/urihelper.hxx173
-rw-r--r--include/svl/urlbmk.hxx53
-rw-r--r--include/svl/visitem.hxx59
-rw-r--r--include/svl/whichranges.hxx128
-rw-r--r--include/svl/whiter.hxx52
-rw-r--r--include/svl/zforlist.hxx381
-rw-r--r--include/svl/zformat.hxx760
-rw-r--r--include/svtools/DocumentToGraphicRenderer.hxx108
-rw-r--r--include/svtools/HtmlWriter.hxx64
-rw-r--r--include/svtools/PlaceEditDialog.hxx100
-rw-r--r--include/svtools/acceleratorexecute.hxx206
-rw-r--r--include/svtools/accessibilityoptions.hxx46
-rw-r--r--include/svtools/addresstemplate.hxx128
-rw-r--r--include/svtools/apearcfg.hxx83
-rw-r--r--include/svtools/asynclink.hxx61
-rw-r--r--include/svtools/bindablecontrolhelper.hxx46
-rw-r--r--include/svtools/borderhelper.hxx47
-rw-r--r--include/svtools/borderline.hxx78
-rw-r--r--include/svtools/brwbox.hxx849
-rw-r--r--include/svtools/brwhead.hxx44
-rw-r--r--include/svtools/cliplistener.hxx52
-rw-r--r--include/svtools/collatorres.hxx54
-rw-r--r--include/svtools/colorcfg.hxx140
-rw-r--r--include/svtools/colrdlg.hxx61
-rw-r--r--include/svtools/ctrlbox.hxx505
-rw-r--r--include/svtools/ctrltool.hxx213
-rw-r--r--include/svtools/dialogclosedlistener.hxx61
-rw-r--r--include/svtools/editbrowsebox.hxx1119
-rw-r--r--include/svtools/ehdl.hxx70
-rw-r--r--include/svtools/embedhlp.hxx135
-rw-r--r--include/svtools/embedtransfer.hxx58
-rw-r--r--include/svtools/extcolorcfg.hxx107
-rw-r--r--include/svtools/filechangedchecker.hxx45
-rw-r--r--include/svtools/fontsubstconfig.hxx41
-rw-r--r--include/svtools/genericunodialog.hxx160
-rw-r--r--include/svtools/helpids.h49
-rw-r--r--include/svtools/htmlcfg.hxx43
-rw-r--r--include/svtools/htmlkywd.hxx689
-rw-r--r--include/svtools/htmlout.hxx96
-rw-r--r--include/svtools/htmltokn.h479
-rw-r--r--include/svtools/imagemgr.hxx137
-rw-r--r--include/svtools/imageresourceaccess.hxx69
-rw-r--r--include/svtools/imgdef.hxx30
-rw-r--r--include/svtools/indexentryres.hxx54
-rw-r--r--include/svtools/inettbc.hxx107
-rw-r--r--include/svtools/insdlg.hxx71
-rw-r--r--include/svtools/javacontext.hxx69
-rw-r--r--include/svtools/javainteractionhandler.hxx62
-rw-r--r--include/svtools/langhelp.hxx29
-rw-r--r--include/svtools/langtab.hxx52
-rw-r--r--include/svtools/languagetoolcfg.hxx59
-rw-r--r--include/svtools/miscopt.hxx70
-rw-r--r--include/svtools/openfiledroptargetlistener.hxx75
-rw-r--r--include/svtools/optionsdrawinglayer.hxx103
-rw-r--r--include/svtools/parhtml.hxx293
-rw-r--r--include/svtools/parrtf.hxx71
-rw-r--r--include/svtools/place.hxx39
-rw-r--r--include/svtools/popupmenucontrollerbase.hxx124
-rw-r--r--include/svtools/popupwindowcontroller.hxx92
-rw-r--r--include/svtools/printoptions.hxx34
-rw-r--r--include/svtools/prnsetup.hxx79
-rw-r--r--include/svtools/querydelete.hxx48
-rw-r--r--include/svtools/recorditemwindow.hxx53
-rw-r--r--include/svtools/restartdialog.hxx85
-rw-r--r--include/svtools/rtfkeywd.hxx1230
-rw-r--r--include/svtools/rtfout.hxx37
-rw-r--r--include/svtools/rtftoken.h1267
-rw-r--r--include/svtools/ruler.hxx799
-rw-r--r--include/svtools/sampletext.hxx40
-rw-r--r--include/svtools/scriptedtext.hxx91
-rw-r--r--include/svtools/sfxecode.hxx74
-rw-r--r--include/svtools/slidesorterbaropt.hxx62
-rw-r--r--include/svtools/soerr.hxx39
-rw-r--r--include/svtools/statusbarcontroller.hxx132
-rw-r--r--include/svtools/strings.hrc344
-rw-r--r--include/svtools/stringtransfer.hxx66
-rw-r--r--include/svtools/svparser.hxx214
-rw-r--r--include/svtools/svtdllapi.h31
-rw-r--r--include/svtools/svtresid.hxx30
-rw-r--r--include/svtools/tabbar.hxx505
-rw-r--r--include/svtools/templatefoldercache.hxx89
-rw-r--r--include/svtools/toolbarmenu.hxx102
-rw-r--r--include/svtools/toolboxcontroller.hxx195
-rw-r--r--include/svtools/unitconv.hxx51
-rw-r--r--include/svtools/unoevent.hxx259
-rw-r--r--include/svtools/unoimap.hxx38
-rw-r--r--include/svtools/urlfilter.hxx42
-rw-r--r--include/svtools/valueset.hxx412
-rw-r--r--include/svx/AccessibilityCheckDialog.hxx59
-rw-r--r--include/svx/AccessibleControlShape.hxx207
-rw-r--r--include/svx/AccessibleGraphicShape.hxx105
-rw-r--r--include/svx/AccessibleOLEShape.hxx112
-rw-r--r--include/svx/AccessibleShape.hxx439
-rw-r--r--include/svx/AccessibleShapeInfo.hxx97
-rw-r--r--include/svx/AccessibleShapeTreeInfo.hxx201
-rw-r--r--include/svx/AccessibleTextHelper.hxx374
-rw-r--r--include/svx/ActionDescriptionProvider.hxx55
-rw-r--r--include/svx/ChildrenManager.hxx214
-rw-r--r--include/svx/ClassificationCommon.hxx65
-rw-r--r--include/svx/ClassificationDialog.hxx99
-rw-r--r--include/svx/ClassificationField.hxx98
-rw-r--r--include/svx/ColorSets.hxx122
-rw-r--r--include/svx/CommonStyleManager.hxx41
-rw-r--r--include/svx/EnhancedCustomShape2d.hxx224
-rw-r--r--include/svx/EnhancedCustomShapeFunctionParser.hxx249
-rw-r--r--include/svx/EnhancedCustomShapeGeometry.hxx105
-rw-r--r--include/svx/EnhancedCustomShapeTypeNames.hxx35
-rw-r--r--include/svx/FileExportedDialog.hxx23
-rw-r--r--include/svx/GenericCheckDialog.hxx104
-rw-r--r--include/svx/IAccessibleParent.hxx103
-rw-r--r--include/svx/IAccessibleViewForwarder.hxx97
-rw-r--r--include/svx/IAccessibleViewForwarderListener.hxx50
-rw-r--r--include/svx/ImageMapInfo.hxx55
-rw-r--r--include/svx/MediaShellHelpers.hxx40
-rw-r--r--include/svx/Palette.hxx67
-rw-r--r--include/svx/PaletteManager.hxx86
-rw-r--r--include/svx/ParaSpacingControl.hxx128
-rw-r--r--include/svx/ParseContext.hxx78
-rw-r--r--include/svx/ShapeTypeHandler.hxx199
-rw-r--r--include/svx/SmartTagItem.hxx82
-rw-r--r--include/svx/SmartTagMgr.hxx231
-rw-r--r--include/svx/SpellDialogChildWindow.hxx115
-rw-r--r--include/svx/SvxColorChildWindow.hxx40
-rw-r--r--include/svx/SvxColorValueSet.hxx51
-rw-r--r--include/svx/SvxNumOptionsTabPageHelper.hxx50
-rw-r--r--include/svx/SvxPresetListBox.hxx66
-rw-r--r--include/svx/SvxShapeTypes.hxx72
-rw-r--r--include/svx/SvxXTextColumns.hxx22
-rw-r--r--include/svx/UnoNamespaceMap.hxx36
-rw-r--r--include/svx/XPropertyEntry.hxx52
-rw-r--r--include/svx/algitem.hxx98
-rw-r--r--include/svx/anchorid.hxx46
-rw-r--r--include/svx/autoformathelper.hxx222
-rw-r--r--include/svx/bmpmask.hxx176
-rw-r--r--include/svx/camera3d.hxx67
-rw-r--r--include/svx/charmap.hxx162
-rw-r--r--include/svx/charthelper.hxx61
-rw-r--r--include/svx/chrtitem.hxx152
-rw-r--r--include/svx/clipboardctl.hxx51
-rw-r--r--include/svx/clipfmtitem.hxx62
-rw-r--r--include/svx/colorbox.hxx100
-rw-r--r--include/svx/colorwindow.hxx136
-rw-r--r--include/svx/compressgraphicdialog.hxx106
-rw-r--r--include/svx/connctrl.hxx68
-rw-r--r--include/svx/contdlg.hxx76
-rw-r--r--include/svx/ctredlin.hxx339
-rw-r--r--include/svx/cube3d.hxx93
-rw-r--r--include/svx/dataaccessdescriptor.hxx131
-rw-r--r--include/svx/databaselocationinput.hxx82
-rw-r--r--include/svx/databaseregistrationui.hxx42
-rw-r--r--include/svx/dbaexchange.hxx277
-rw-r--r--include/svx/dbaobjectex.hxx66
-rw-r--r--include/svx/def3d.hxx43
-rw-r--r--include/svx/deflt3d.hxx97
-rw-r--r--include/svx/diagram/IDiagramHelper.hxx118
-rw-r--r--include/svx/diagram/datamodel.hxx274
-rw-r--r--include/svx/dialcontrol.hxx170
-rw-r--r--include/svx/dialmgr.hxx31
-rw-r--r--include/svx/dialogs.hrc122
-rw-r--r--include/svx/dlgctl3d.hxx183
-rw-r--r--include/svx/dlgctrl.hxx410
-rw-r--r--include/svx/dlgutil.hxx40
-rw-r--r--include/svx/drawitem.hxx201
-rw-r--r--include/svx/e3ditem.hxx49
-rw-r--r--include/svx/e3dsceneupdater.hxx67
-rw-r--r--include/svx/e3dundo.hxx107
-rw-r--r--include/svx/extedit.hxx62
-rw-r--r--include/svx/extrusionbar.hxx56
-rw-r--r--include/svx/f3dchild.hxx42
-rw-r--r--include/svx/fillctrl.hxx109
-rw-r--r--include/svx/flagsdef.hxx126
-rw-r--r--include/svx/float3d.hxx288
-rw-r--r--include/svx/fmdmod.hxx39
-rw-r--r--include/svx/fmdpage.hxx64
-rw-r--r--include/svx/fmgridcl.hxx202
-rw-r--r--include/svx/fmgridif.hxx534
-rw-r--r--include/svx/fmmodel.hxx84
-rw-r--r--include/svx/fmobjfac.hxx39
-rw-r--r--include/svx/fmpage.hxx79
-rw-r--r--include/svx/fmsearch.hxx66
-rw-r--r--include/svx/fmshell.hxx171
-rw-r--r--include/svx/fmsrccfg.hxx145
-rw-r--r--include/svx/fmsrcimp.hxx350
-rw-r--r--include/svx/fmtools.hxx175
-rw-r--r--include/svx/fmview.hxx156
-rw-r--r--include/svx/fntctrl.hxx74
-rw-r--r--include/svx/fontwork.hxx142
-rw-r--r--include/svx/fontworkbar.hxx58
-rw-r--r--include/svx/fontworkgallery.hxx80
-rw-r--r--include/svx/formatpaintbrushctrl.hxx59
-rw-r--r--include/svx/framebordertype.hxx56
-rw-r--r--include/svx/framelink.hxx185
-rw-r--r--include/svx/framelinkarray.hxx326
-rw-r--r--include/svx/frmdirlbox.hxx80
-rw-r--r--include/svx/frmsel.hxx194
-rw-r--r--include/svx/galctrl.hxx119
-rw-r--r--include/svx/gallery.hxx137
-rw-r--r--include/svx/gallery1.hxx146
-rw-r--r--include/svx/gallerybinaryengine.hxx111
-rw-r--r--include/svx/gallerybinaryengineentry.hxx67
-rw-r--r--include/svx/gallerybinarystoragelocations.hxx52
-rw-r--r--include/svx/galleryfilestorage.hxx28
-rw-r--r--include/svx/galleryfilestorageentry.hxx28
-rw-r--r--include/svx/galleryitem.hxx68
-rw-r--r--include/svx/galleryobjectcollection.hxx70
-rw-r--r--include/svx/galleryobjectstorage.hxx32
-rw-r--r--include/svx/gallerystoragelocations.hxx33
-rw-r--r--include/svx/galmisc.hxx202
-rw-r--r--include/svx/galtheme.hxx169
-rw-r--r--include/svx/grafctrl.hxx121
-rw-r--r--include/svx/graphctl.hxx159
-rw-r--r--include/svx/graphichelper.hxx54
-rw-r--r--include/svx/grfcrop.hxx69
-rw-r--r--include/svx/grfflt.hxx43
-rw-r--r--include/svx/gridctrl.hxx600
-rw-r--r--include/svx/hdft.hxx134
-rw-r--r--include/svx/helperhittest3d.hxx99
-rw-r--r--include/svx/hexcolorcontrol.hxx57
-rw-r--r--include/svx/hlnkitem.hxx105
-rw-r--r--include/svx/hyperdlg.hxx50
-rw-r--r--include/svx/ifaceids.hxx36
-rw-r--r--include/svx/imapdlg.hxx145
-rw-r--r--include/svx/insctrl.hxx46
-rw-r--r--include/svx/ipolypolygoneditorcontroller.hxx76
-rw-r--r--include/svx/itemwin.hxx64
-rw-r--r--include/svx/itextprovider.hxx42
-rw-r--r--include/svx/labelitemwindow.hxx30
-rw-r--r--include/svx/langbox.hxx119
-rw-r--r--include/svx/lathe3d.hxx123
-rw-r--r--include/svx/legacyitem.hxx60
-rw-r--r--include/svx/linectrl.hxx92
-rw-r--r--include/svx/linkwarn.hxx38
-rw-r--r--include/svx/measctrl.hxx56
-rw-r--r--include/svx/modctrl.hxx55
-rw-r--r--include/svx/msdffdef.hxx858
-rw-r--r--include/svx/nbdtmg.hxx210
-rw-r--r--include/svx/nbdtmgfact.hxx31
-rw-r--r--include/svx/numfmtsh.hxx229
-rw-r--r--include/svx/numinf.hxx74
-rw-r--r--include/svx/numvset.hxx107
-rw-r--r--include/svx/obj3d.hxx188
-rw-r--r--include/svx/objfac3d.hxx45
-rw-r--r--include/svx/ofaitem.hxx55
-rw-r--r--include/svx/optgenrl.hxx45
-rw-r--r--include/svx/optgrid.hxx136
-rw-r--r--include/svx/pagectrl.hxx153
-rw-r--r--include/svx/pageitem.hxx115
-rw-r--r--include/svx/pagenumberlistbox.hxx42
-rw-r--r--include/svx/papersizelistbox.hxx58
-rw-r--r--include/svx/paraprev.hxx103
-rw-r--r--include/svx/passwd.hxx55
-rw-r--r--include/svx/polypolygoneditor.hxx67
-rw-r--r--include/svx/postattr.hxx100
-rw-r--r--include/svx/pszctrl.hxx48
-rw-r--r--include/svx/rectenum.hxx37
-rw-r--r--include/svx/relfld.hxx70
-rw-r--r--include/svx/rotmodit.hxx61
-rw-r--r--include/svx/rubydialog.hxx140
-rw-r--r--include/svx/ruler.hxx286
-rw-r--r--include/svx/rulritem.hxx236
-rw-r--r--include/svx/samecontentlistbox.hxx32
-rw-r--r--include/svx/scene3d.hxx192
-rw-r--r--include/svx/sdangitm.hxx46
-rw-r--r--include/svx/sdasitm.hxx112
-rw-r--r--include/svx/sderitm.hxx32
-rw-r--r--include/svx/sdgcpitm.hxx45
-rw-r--r--include/svx/sdggaitm.hxx46
-rw-r--r--include/svx/sdgluitm.hxx58
-rw-r--r--include/svx/sdgmoitm.hxx52
-rw-r--r--include/svx/sdmetitm.hxx48
-rw-r--r--include/svx/sdooitm.hxx45
-rw-r--r--include/svx/sdprcitm.hxx59
-rw-r--r--include/svx/sdr/animation/animationstate.hxx58
-rw-r--r--include/svx/sdr/animation/objectanimator.hxx41
-rw-r--r--include/svx/sdr/animation/scheduler.hxx99
-rw-r--r--include/svx/sdr/attribute/sdrallfillattributeshelper.hxx88
-rw-r--r--include/svx/sdr/contact/displayinfo.hxx105
-rw-r--r--include/svx/sdr/contact/objectcontact.hxx176
-rw-r--r--include/svx/sdr/contact/objectcontactofpageview.hxx118
-rw-r--r--include/svx/sdr/contact/viewcontact.hxx154
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dscene.hxx103
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx74
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrobj.hxx80
-rw-r--r--include/svx/sdr/contact/viewcontactofvirtobj.hxx54
-rw-r--r--include/svx/sdr/contact/viewobjectcontact.hxx142
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx64
-rw-r--r--include/svx/sdr/contact/viewobjectcontactredirector.hxx56
-rw-r--r--include/svx/sdr/overlay/overlayanimatedbitmapex.hxx81
-rw-r--r--include/svx/sdr/overlay/overlaybitmapex.hxx61
-rw-r--r--include/svx/sdr/overlay/overlaymanager.hxx130
-rw-r--r--include/svx/sdr/overlay/overlayobject.hxx197
-rw-r--r--include/svx/sdr/overlay/overlayobjectlist.hxx70
-rw-r--r--include/svx/sdr/overlay/overlaypolypolygon.hxx71
-rw-r--r--include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx48
-rw-r--r--include/svx/sdr/overlay/overlayselection.hxx77
-rw-r--r--include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx129
-rw-r--r--include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx57
-rw-r--r--include/svx/sdr/properties/defaultproperties.hxx116
-rw-r--r--include/svx/sdr/properties/properties.hxx190
-rw-r--r--include/svx/sdr/table/tablecontroller.hxx201
-rw-r--r--include/svx/sdr/table/tabledesign.hxx46
-rw-r--r--include/svx/sdrhittesthelper.hxx73
-rw-r--r--include/svx/sdrmasterpagedescriptor.hxx73
-rw-r--r--include/svx/sdrobjectfilter.hxx50
-rw-r--r--include/svx/sdrobjectuser.hxx51
-rw-r--r--include/svx/sdrpageuser.hxx51
-rw-r--r--include/svx/sdrpagewindow.hxx97
-rw-r--r--include/svx/sdrpaintwindow.hxx144
-rw-r--r--include/svx/sdrundomanager.hxx73
-rw-r--r--include/svx/sdshcitm.hxx32
-rw-r--r--include/svx/sdshitm.hxx32
-rw-r--r--include/svx/sdshtitm.hxx32
-rw-r--r--include/svx/sdsxyitm.hxx37
-rw-r--r--include/svx/sdtaaitm.hxx38
-rw-r--r--include/svx/sdtacitm.hxx36
-rw-r--r--include/svx/sdtaditm.hxx50
-rw-r--r--include/svx/sdtagitm.hxx37
-rw-r--r--include/svx/sdtaiitm.hxx51
-rw-r--r--include/svx/sdtaitm.hxx74
-rw-r--r--include/svx/sdtakitm.hxx94
-rw-r--r--include/svx/sdtayitm.hxx35
-rw-r--r--include/svx/sdtcfitm.hxx32
-rw-r--r--include/svx/sdtditm.hxx47
-rw-r--r--include/svx/sdtfchim.hxx44
-rw-r--r--include/svx/sdtfsitm.hxx66
-rw-r--r--include/svx/sdtmfitm.hxx47
-rw-r--r--include/svx/sdynitm.hxx41
-rw-r--r--include/svx/searchcharmap.hxx71
-rw-r--r--include/svx/selctrl.hxx48
-rw-r--r--include/svx/selectioncontroller.hxx87
-rw-r--r--include/svx/shapepropertynotifier.hxx142
-rw-r--r--include/svx/sidebar/AreaPropertyPanelBase.hxx175
-rw-r--r--include/svx/sidebar/AreaTransparencyGradientPopup.hxx66
-rw-r--r--include/svx/sidebar/ContextChangeEventMultiplexer.hxx65
-rw-r--r--include/svx/sidebar/InspectorTextPanel.hxx61
-rw-r--r--include/svx/sidebar/LinePropertyPanelBase.hxx140
-rw-r--r--include/svx/sidebar/LineWidthPopup.hxx71
-rw-r--r--include/svx/sidebar/SelectionAnalyzer.hxx76
-rw-r--r--include/svx/sidebar/SelectionChangeHandler.hxx75
-rw-r--r--include/svx/sidebar/ValueSetWithTextControl.hxx61
-rw-r--r--include/svx/signaturelinehelper.hxx70
-rw-r--r--include/svx/spacinglistbox.hxx41
-rw-r--r--include/svx/sphere3d.hxx89
-rw-r--r--include/svx/srchdlg.hxx270
-rw-r--r--include/svx/strarray.hxx53
-rw-r--r--include/svx/strings.hrc1838
-rw-r--r--include/svx/svdcrtv.hxx168
-rw-r--r--include/svx/svddef.hxx439
-rw-r--r--include/svx/svddrag.hxx177
-rw-r--r--include/svx/svddrgmt.hxx304
-rw-r--r--include/svx/svddrgv.hxx230
-rw-r--r--include/svx/svdedtv.hxx418
-rw-r--r--include/svx/svdedxv.hxx325
-rw-r--r--include/svx/svdetc.hxx211
-rw-r--r--include/svx/svdglev.hxx85
-rw-r--r--include/svx/svdglue.hxx228
-rw-r--r--include/svx/svdhdl.hxx535
-rw-r--r--include/svx/svdhlpln.hxx91
-rw-r--r--include/svx/svditer.hxx74
-rw-r--r--include/svx/svdlayer.hxx164
-rw-r--r--include/svx/svdmark.hxx261
-rw-r--r--include/svx/svdmodel.hxx641
-rw-r--r--include/svx/svdmrkv.hxx469
-rw-r--r--include/svx/svdoashp.hxx253
-rw-r--r--include/svx/svdoattr.hxx66
-rw-r--r--include/svx/svdobj.hxx1036
-rw-r--r--include/svx/svdobjkind.hxx154
-rw-r--r--include/svx/svdocapt.hxx154
-rw-r--r--include/svx/svdocirc.hxx143
-rw-r--r--include/svx/svdoedge.hxx411
-rw-r--r--include/svx/svdograf.hxx301
-rw-r--r--include/svx/svdogrp.hxx122
-rw-r--r--include/svx/svdomeas.hxx203
-rw-r--r--include/svx/svdomedia.hxx83
-rw-r--r--include/svx/svdoole2.hxx213
-rw-r--r--include/svx/svdopage.hxx69
-rw-r--r--include/svx/svdopath.hxx175
-rw-r--r--include/svx/svdorect.hxx127
-rw-r--r--include/svx/svdotable.hxx294
-rw-r--r--include/svx/svdotext.hxx633
-rw-r--r--include/svx/svdouno.hxx145
-rw-r--r--include/svx/svdoutl.hxx51
-rw-r--r--include/svx/svdovirt.hxx156
-rw-r--r--include/svx/svdpage.hxx545
-rw-r--r--include/svx/svdpagv.hxx254
-rw-r--r--include/svx/svdpntv.hxx504
-rw-r--r--include/svx/svdpoev.hxx82
-rw-r--r--include/svx/svdpool.hxx46
-rw-r--r--include/svx/svdsnpv.hxx287
-rw-r--r--include/svx/svdsob.hxx94
-rw-r--r--include/svx/svdtext.hxx81
-rw-r--r--include/svx/svdtrans.hxx286
-rw-r--r--include/svx/svdtypes.hxx90
-rw-r--r--include/svx/svdundo.hxx785
-rw-r--r--include/svx/svdview.hxx281
-rw-r--r--include/svx/svdviter.hxx83
-rw-r--r--include/svx/svdxcgv.hxx113
-rw-r--r--include/svx/svx3ditems.hxx319
-rw-r--r--include/svx/svxdlg.hxx451
-rw-r--r--include/svx/svxdllapi.h41
-rw-r--r--include/svx/svxerr.hxx62
-rw-r--r--include/svx/svxgraphicitem.hxx41
-rw-r--r--include/svx/svxids.hrc1068
-rw-r--r--include/svx/svxitems.hrc95
-rw-r--r--include/svx/swframeexample.hxx94
-rw-r--r--include/svx/swframeposstrings.hxx84
-rw-r--r--include/svx/swframetypes.hxx48
-rw-r--r--include/svx/swframevalidation.hxx85
-rw-r--r--include/svx/sxcecitm.hxx98
-rw-r--r--include/svx/sxcgitm.hxx44
-rw-r--r--include/svx/sxciaitm.hxx37
-rw-r--r--include/svx/sxcllitm.hxx61
-rw-r--r--include/svx/sxctitm.hxx41
-rw-r--r--include/svx/sxekitm.hxx44
-rw-r--r--include/svx/sxelditm.hxx55
-rw-r--r--include/svx/sxenditm.hxx72
-rw-r--r--include/svx/sxmbritm.hxx46
-rw-r--r--include/svx/sxmlhitm.hxx70
-rw-r--r--include/svx/sxmtfitm.hxx70
-rw-r--r--include/svx/sxmtpitm.hxx62
-rw-r--r--include/svx/sxmtritm.hxx54
-rw-r--r--include/svx/sxmuitm.hxx44
-rw-r--r--include/svx/tabarea.hxx37
-rw-r--r--include/svx/tabline.hxx35
-rw-r--r--include/svx/tbcontrl.hxx281
-rw-r--r--include/svx/tbxcolor.hxx59
-rw-r--r--include/svx/tbxctl.hxx54
-rw-r--r--include/svx/transfrmhelper.hxx51
-rw-r--r--include/svx/txencbox.hxx158
-rw-r--r--include/svx/txenctab.hxx35
-rw-r--r--include/svx/ucsubset.hxx74
-rw-r--r--include/svx/uiobject.hxx61
-rw-r--r--include/svx/unoapi.hxx94
-rw-r--r--include/svx/unobrushitemhelper.hxx54
-rw-r--r--include/svx/unodraw/SvxTableShape.hxx44
-rw-r--r--include/svx/unofill.hxx37
-rw-r--r--include/svx/unomaster.hxx76
-rw-r--r--include/svx/unomid.hxx97
-rw-r--r--include/svx/unomod.hxx71
-rw-r--r--include/svx/unomodel.hxx109
-rw-r--r--include/svx/unopage.hxx139
-rw-r--r--include/svx/unopool.hxx98
-rw-r--r--include/svx/unoprov.hxx115
-rw-r--r--include/svx/unoshape.hxx871
-rw-r--r--include/svx/unoshprp.hxx577
-rw-r--r--include/svx/unoshtxt.hxx89
-rw-r--r--include/svx/view3d.hxx120
-rw-r--r--include/svx/viewlayoutitem.hxx51
-rw-r--r--include/svx/viewpt3d.hxx95
-rw-r--r--include/svx/weldeditview.hxx114
-rw-r--r--include/svx/xbitmap.hxx59
-rw-r--r--include/svx/xbtmpit.hxx67
-rw-r--r--include/svx/xcolit.hxx62
-rw-r--r--include/svx/xdash.hxx69
-rw-r--r--include/svx/xdef.hxx151
-rw-r--r--include/svx/xenum.hxx31
-rw-r--r--include/svx/xfillit0.hxx55
-rw-r--r--include/svx/xfilluseslidebackgrounditem.hxx31
-rw-r--r--include/svx/xflasit.hxx42
-rw-r--r--include/svx/xflbckit.hxx49
-rw-r--r--include/svx/xflbmpit.hxx46
-rw-r--r--include/svx/xflbmsli.hxx41
-rw-r--r--include/svx/xflbmsxy.hxx60
-rw-r--r--include/svx/xflbmtit.hxx42
-rw-r--r--include/svx/xflboxy.hxx54
-rw-r--r--include/svx/xflbstit.hxx42
-rw-r--r--include/svx/xflbtoxy.hxx54
-rw-r--r--include/svx/xflclit.hxx56
-rw-r--r--include/svx/xflftrit.hxx63
-rw-r--r--include/svx/xflgrit.hxx64
-rw-r--r--include/svx/xflhtit.hxx63
-rw-r--r--include/svx/xfltrit.hxx46
-rw-r--r--include/svx/xftadit.hxx48
-rw-r--r--include/svx/xftdiit.hxx42
-rw-r--r--include/svx/xftmrit.hxx42
-rw-r--r--include/svx/xftouit.hxx44
-rw-r--r--include/svx/xftshcit.hxx44
-rw-r--r--include/svx/xftshit.hxx48
-rw-r--r--include/svx/xftshxy.hxx57
-rw-r--r--include/svx/xftstit.hxx43
-rw-r--r--include/svx/xgrad.hxx86
-rw-r--r--include/svx/xgrscit.hxx45
-rw-r--r--include/svx/xhatch.hxx59
-rw-r--r--include/svx/xit.hxx70
-rw-r--r--include/svx/xlineit0.hxx48
-rw-r--r--include/svx/xlinjoit.hxx49
-rw-r--r--include/svx/xlnasit.hxx42
-rw-r--r--include/svx/xlncapit.hxx50
-rw-r--r--include/svx/xlnclit.hxx49
-rw-r--r--include/svx/xlndsit.hxx66
-rw-r--r--include/svx/xlnedcit.hxx45
-rw-r--r--include/svx/xlnedit.hxx61
-rw-r--r--include/svx/xlnedwit.hxx48
-rw-r--r--include/svx/xlnstcit.hxx45
-rw-r--r--include/svx/xlnstit.hxx61
-rw-r--r--include/svx/xlnstwit.hxx48
-rw-r--r--include/svx/xlntrit.hxx45
-rw-r--r--include/svx/xlnwtit.hxx46
-rw-r--r--include/svx/xmleohlp.hxx124
-rw-r--r--include/svx/xmlexchg.hxx83
-rw-r--r--include/svx/xmlgrhlp.hxx128
-rw-r--r--include/svx/xmlsecctrl.hxx46
-rw-r--r--include/svx/xoutbmp.hxx74
-rw-r--r--include/svx/xpoly.hxx155
-rw-r--r--include/svx/xpool.hxx50
-rw-r--r--include/svx/xsflclit.hxx40
-rw-r--r--include/svx/xtable.hxx394
-rw-r--r--include/svx/xtextit0.hxx61
-rw-r--r--include/svx/zoom_def.hxx30
-rw-r--r--include/svx/zoomctrl.hxx63
-rw-r--r--include/svx/zoomsliderctrl.hxx56
-rw-r--r--include/svx/zoomslideritem.hxx54
-rw-r--r--include/systools/win32/comtools.hxx249
-rw-r--r--include/systools/win32/oleauto.hxx84
-rw-r--r--include/systools/win32/qswin32.h29
-rw-r--r--include/systools/win32/retry_if_failed.hxx38
-rw-r--r--include/systools/win32/uwinapi.h41
-rw-r--r--include/test/beans/xpropertyset.hxx74
-rw-r--r--include/test/bootstrapfixture.hxx73
-rw-r--r--include/test/calc_unoapi_test.hxx31
-rw-r--r--include/test/callgrind.hxx21
-rw-r--r--include/test/chart/xchartdata.hxx35
-rw-r--r--include/test/container/xchild.hxx34
-rw-r--r--include/test/container/xelementaccess.hxx46
-rw-r--r--include/test/container/xenumeration.hxx36
-rw-r--r--include/test/container/xenumerationaccess.hxx34
-rw-r--r--include/test/container/xindexaccess.hxx46
-rw-r--r--include/test/container/xnameaccess.hxx46
-rw-r--r--include/test/container/xnamecontainer.hxx60
-rw-r--r--include/test/container/xnamed.hxx49
-rw-r--r--include/test/container/xnamereplace.hxx48
-rw-r--r--include/test/cppunitasserthelper.hxx104
-rw-r--r--include/test/document/xactionlockable.hxx36
-rw-r--r--include/test/document/xembeddedobjectsupplier.hxx35
-rw-r--r--include/test/document/xlinktargetsupplier.hxx34
-rw-r--r--include/test/drawing/captionshape.hxx33
-rw-r--r--include/test/drawing/xdrawpages.hxx37
-rw-r--r--include/test/drawing/xgluepointssupplier.hxx33
-rw-r--r--include/test/drawing/xshape.hxx42
-rw-r--r--include/test/drawing/xshapedescriptor.hxx40
-rw-r--r--include/test/drawing/xshapegrouper.hxx44
-rw-r--r--include/test/drawing/xshapes.hxx43
-rw-r--r--include/test/helper/form.hxx64
-rw-r--r--include/test/helper/shape.hxx92
-rw-r--r--include/test/helper/transferable.hxx29
-rw-r--r--include/test/htmltesttools.hxx32
-rw-r--r--include/test/lang/xcomponent.hxx39
-rw-r--r--include/test/lang/xserviceinfo.hxx55
-rw-r--r--include/test/lokcallback.hxx62
-rw-r--r--include/test/screenshot_test.hxx96
-rw-r--r--include/test/sheet/cellarealink.hxx47
-rw-r--r--include/test/sheet/cellproperties.hxx34
-rw-r--r--include/test/sheet/databaseimportdescriptor.hxx35
-rw-r--r--include/test/sheet/databaserange.hxx43
-rw-r--r--include/test/sheet/datapilotfield.hxx36
-rw-r--r--include/test/sheet/datapilotitem.hxx33
-rw-r--r--include/test/sheet/documentsettings.hxx34
-rw-r--r--include/test/sheet/functiondescription.hxx34
-rw-r--r--include/test/sheet/globalsheetsettings.hxx34
-rw-r--r--include/test/sheet/scenario.hxx34
-rw-r--r--include/test/sheet/shape.hxx36
-rw-r--r--include/test/sheet/sheetcell.hxx34
-rw-r--r--include/test/sheet/sheetcellrange.hxx34
-rw-r--r--include/test/sheet/sheetcellranges.hxx34
-rw-r--r--include/test/sheet/sheetfilterdescriptor.hxx34
-rw-r--r--include/test/sheet/sheetlink.hxx34
-rw-r--r--include/test/sheet/sheetsortdescriptor2.hxx34
-rw-r--r--include/test/sheet/spreadsheet.hxx35
-rw-r--r--include/test/sheet/spreadsheetdocumentsettings.hxx34
-rw-r--r--include/test/sheet/spreadsheetviewsettings.hxx34
-rw-r--r--include/test/sheet/subtotaldescriptor.hxx34
-rw-r--r--include/test/sheet/tableautoformat.hxx34
-rw-r--r--include/test/sheet/tablevalidation.hxx34
-rw-r--r--include/test/sheet/xactivationbroadcaster.hxx36
-rw-r--r--include/test/sheet/xarealink.hxx34
-rw-r--r--include/test/sheet/xarealinks.hxx36
-rw-r--r--include/test/sheet/xarrayformularange.hxx32
-rw-r--r--include/test/sheet/xcalculatable.hxx39
-rw-r--r--include/test/sheet/xcelladdressable.hxx31
-rw-r--r--include/test/sheet/xcellformatrangessupplier.hxx34
-rw-r--r--include/test/sheet/xcellrangeaddressable.hxx34
-rw-r--r--include/test/sheet/xcellrangedata.hxx36
-rw-r--r--include/test/sheet/xcellrangeformula.hxx34
-rw-r--r--include/test/sheet/xcellrangemovement.hxx37
-rw-r--r--include/test/sheet/xcellrangereferrer.hxx40
-rw-r--r--include/test/sheet/xcellrangesquery.hxx39
-rw-r--r--include/test/sheet/xcellseries.hxx38
-rw-r--r--include/test/sheet/xconsolidatable.hxx35
-rw-r--r--include/test/sheet/xconsolidationdescriptor.hxx45
-rw-r--r--include/test/sheet/xdatabaserange.hxx38
-rw-r--r--include/test/sheet/xdatabaseranges.hxx34
-rw-r--r--include/test/sheet/xdatapilotdescriptor.hxx52
-rw-r--r--include/test/sheet/xdatapilotfield.hxx34
-rw-r--r--include/test/sheet/xdatapilotfieldgrouping.hxx35
-rw-r--r--include/test/sheet/xdatapilottable.hxx39
-rw-r--r--include/test/sheet/xdatapilottable2.hxx58
-rw-r--r--include/test/sheet/xdatapilottables.hxx35
-rw-r--r--include/test/sheet/xdatapilottablessupplier.hxx34
-rw-r--r--include/test/sheet/xddelink.hxx42
-rw-r--r--include/test/sheet/xddelinks.hxx44
-rw-r--r--include/test/sheet/xdocumentauditing.hxx44
-rw-r--r--include/test/sheet/xformulaquery.hxx57
-rw-r--r--include/test/sheet/xfunctiondescriptions.hxx34
-rw-r--r--include/test/sheet/xgoalseek.hxx32
-rw-r--r--include/test/sheet/xheaderfootercontent.hxx36
-rw-r--r--include/test/sheet/xlabelrange.hxx35
-rw-r--r--include/test/sheet/xlabelranges.hxx35
-rw-r--r--include/test/sheet/xmultiformulatokens.hxx39
-rw-r--r--include/test/sheet/xmultipleoperation.hxx39
-rw-r--r--include/test/sheet/xnamedrange.hxx41
-rw-r--r--include/test/sheet/xnamedranges.hxx59
-rw-r--r--include/test/sheet/xprintareas.hxx41
-rw-r--r--include/test/sheet/xrecentfunctions.hxx36
-rw-r--r--include/test/sheet/xscenario.hxx34
-rw-r--r--include/test/sheet/xscenarioenhanced.hxx34
-rw-r--r--include/test/sheet/xscenarios.hxx35
-rw-r--r--include/test/sheet/xscenariossupplier.hxx34
-rw-r--r--include/test/sheet/xsheetannotation.hxx42
-rw-r--r--include/test/sheet/xsheetannotationanchor.hxx34
-rw-r--r--include/test/sheet/xsheetannotations.hxx43
-rw-r--r--include/test/sheet/xsheetannotationshapesupplier.hxx32
-rw-r--r--include/test/sheet/xsheetannotationssupplier.hxx34
-rw-r--r--include/test/sheet/xsheetauditing.hxx38
-rw-r--r--include/test/sheet/xsheetcellcursor.hxx39
-rw-r--r--include/test/sheet/xsheetcellrange.hxx34
-rw-r--r--include/test/sheet/xsheetcellrangecontainer.hxx39
-rw-r--r--include/test/sheet/xsheetcellranges.hxx36
-rw-r--r--include/test/sheet/xsheetcondition.hxx37
-rw-r--r--include/test/sheet/xsheetconditionalentries.hxx41
-rw-r--r--include/test/sheet/xsheetconditionalentry.hxx34
-rw-r--r--include/test/sheet/xsheetfilterable.hxx38
-rw-r--r--include/test/sheet/xsheetfilterableex.hxx35
-rw-r--r--include/test/sheet/xsheetfilterdescriptor.hxx35
-rw-r--r--include/test/sheet/xsheetfilterdescriptor2.hxx35
-rw-r--r--include/test/sheet/xsheetfilterdescriptor3.hxx35
-rw-r--r--include/test/sheet/xsheetlinkable.hxx35
-rw-r--r--include/test/sheet/xsheetoperation.hxx35
-rw-r--r--include/test/sheet/xsheetoutline.hxx38
-rw-r--r--include/test/sheet/xsheetpagebreak.hxx34
-rw-r--r--include/test/sheet/xspreadsheet.hxx34
-rw-r--r--include/test/sheet/xspreadsheetdocument.hxx37
-rw-r--r--include/test/sheet/xspreadsheets.hxx34
-rw-r--r--include/test/sheet/xspreadsheets2.hxx64
-rw-r--r--include/test/sheet/xspreadsheetview.hxx33
-rw-r--r--include/test/sheet/xsubtotalcalculatable.hxx34
-rw-r--r--include/test/sheet/xsubtotaldescriptor.hxx33
-rw-r--r--include/test/sheet/xsubtotalfield.hxx33
-rw-r--r--include/test/sheet/xuniquecellformatrangessupplier.hxx34
-rw-r--r--include/test/sheet/xusedareacursor.hxx33
-rw-r--r--include/test/sheet/xviewfreezable.hxx31
-rw-r--r--include/test/sheet/xviewpane.hxx35
-rw-r--r--include/test/sheet/xviewsplitable.hxx33
-rw-r--r--include/test/style/xstyleloader.hxx51
-rw-r--r--include/test/table/tablecolumn.hxx41
-rw-r--r--include/test/table/tablerow.hxx36
-rw-r--r--include/test/table/xcell.hxx37
-rw-r--r--include/test/table/xcellcursor.hxx39
-rw-r--r--include/test/table/xcellrange.hxx49
-rw-r--r--include/test/table/xcolumnrowrange.hxx35
-rw-r--r--include/test/table/xtablechart.hxx37
-rw-r--r--include/test/table/xtablecharts.hxx36
-rw-r--r--include/test/table/xtablechartssupplier.hxx34
-rw-r--r--include/test/table/xtablecolumns.hxx57
-rw-r--r--include/test/table/xtablerows.hxx38
-rw-r--r--include/test/testdllapi.hxx39
-rw-r--r--include/test/testinteractionhandler.hxx154
-rw-r--r--include/test/text/baseindex.hxx30
-rw-r--r--include/test/text/textcontent.hxx51
-rw-r--r--include/test/text/textdocumentindex.hxx30
-rw-r--r--include/test/text/textdocumentsettings.hxx29
-rw-r--r--include/test/text/textprintersettings.hxx30
-rw-r--r--include/test/text/textsettings.hxx30
-rw-r--r--include/test/text/xdocumentindex.hxx36
-rw-r--r--include/test/text/xsimpletext.hxx36
-rw-r--r--include/test/text/xtext.hxx33
-rw-r--r--include/test/text/xtextcontent.hxx39
-rw-r--r--include/test/text/xtextfield.hxx37
-rw-r--r--include/test/text/xtextrange.hxx38
-rw-r--r--include/test/unoapi_property_testers.hxx173
-rw-r--r--include/test/unoapi_test.hxx42
-rw-r--r--include/test/util/searchdescriptor.hxx33
-rw-r--r--include/test/util/xindent.hxx35
-rw-r--r--include/test/util/xmergeable.hxx34
-rw-r--r--include/test/util/xrefreshable.hxx36
-rw-r--r--include/test/util/xreplaceable.hxx40
-rw-r--r--include/test/util/xreplacedescriptor.hxx33
-rw-r--r--include/test/util/xsearchable.hxx41
-rw-r--r--include/test/util/xsearchdescriptor.hxx33
-rw-r--r--include/test/view/xcontrolaccess.hxx35
-rw-r--r--include/test/view/xformlayeraccess.hxx43
-rw-r--r--include/test/xmldiff.hxx21
-rw-r--r--include/test/xmldocptr.hxx20
-rw-r--r--include/test/xmltesttools.hxx110
-rw-r--r--include/toolkit/awt/vclxaccessiblecomponent.hxx150
-rw-r--r--include/toolkit/awt/vclxdevice.hxx88
-rw-r--r--include/toolkit/awt/vclxfont.hxx78
-rw-r--r--include/toolkit/awt/vclxmenu.hxx162
-rw-r--r--include/toolkit/awt/vclxwindow.hxx236
-rw-r--r--include/toolkit/awt/vclxwindows.hxx743
-rw-r--r--include/toolkit/controls/unocontrol.hxx231
-rw-r--r--include/toolkit/controls/unocontrolbase.hxx66
-rw-r--r--include/toolkit/controls/unocontrolmodel.hxx183
-rw-r--r--include/toolkit/controls/unocontrols.hxx1490
-rw-r--r--include/toolkit/dllapi.h34
-rw-r--r--include/toolkit/helper/accessiblefactory.hxx145
-rw-r--r--include/toolkit/helper/convert.hxx61
-rw-r--r--include/toolkit/helper/emptyfontdescriptor.hxx40
-rw-r--r--include/toolkit/helper/formpdfexport.hxx55
-rw-r--r--include/toolkit/helper/listenermultiplexer.hxx273
-rw-r--r--include/toolkit/helper/macros.hxx156
-rw-r--r--include/toolkit/helper/mutexandbroadcasthelper.hxx44
-rw-r--r--include/toolkit/helper/property.hxx247
-rw-r--r--include/toolkit/helper/vclunohelper.hxx157
-rw-r--r--include/tools/GenericTypeSerializer.hxx60
-rw-r--r--include/tools/Guid.hxx165
-rw-r--r--include/tools/UnitConversion.hxx122
-rw-r--r--include/tools/XmlWalker.hxx59
-rw-r--r--include/tools/XmlWriter.hxx68
-rw-r--r--include/tools/b3dtrans.hxx217
-rw-r--r--include/tools/bigint.hxx253
-rw-r--r--include/tools/color.hxx516
-rw-r--r--include/tools/config.hxx69
-rw-r--r--include/tools/contnr.hxx29
-rw-r--r--include/tools/cpuid.hxx109
-rw-r--r--include/tools/date.hxx259
-rw-r--r--include/tools/datetime.hxx131
-rw-r--r--include/tools/datetimeutils.hxx26
-rw-r--r--include/tools/debug.hxx62
-rw-r--r--include/tools/degree.hxx60
-rw-r--r--include/tools/diagnose_ex.h194
-rw-r--r--include/tools/extendapplicationenvironment.hxx34
-rw-r--r--include/tools/fileutil.hxx26
-rw-r--r--include/tools/fix16.hxx40
-rw-r--r--include/tools/fldunit.hxx51
-rw-r--r--include/tools/fontenum.hxx457
-rw-r--r--include/tools/fract.hxx119
-rw-r--r--include/tools/gen.hxx793
-rw-r--r--include/tools/globname.hxx77
-rw-r--r--include/tools/helpers.hxx104
-rw-r--r--include/tools/inetmime.hxx241
-rw-r--r--include/tools/inetmsg.hxx187
-rw-r--r--include/tools/inetstrm.hxx64
-rw-r--r--include/tools/json_writer.hxx166
-rw-r--r--include/tools/line.hxx56
-rw-r--r--include/tools/lineend.hxx33
-rw-r--r--include/tools/link.hxx180
-rw-r--r--include/tools/long.hxx39
-rw-r--r--include/tools/mapunit.hxx37
-rw-r--r--include/tools/multisel.hxx170
-rw-r--r--include/tools/pathutils.hxx72
-rw-r--r--include/tools/poly.hxx315
-rw-r--r--include/tools/ref.hxx234
-rw-r--r--include/tools/resary.hxx26
-rw-r--r--include/tools/simd.hxx30
-rw-r--r--include/tools/simdsupport.hxx83
-rw-r--r--include/tools/solar.h119
-rw-r--r--include/tools/stream.hxx682
-rw-r--r--include/tools/svborder.hxx73
-rw-r--r--include/tools/svlibrary.h15
-rw-r--r--include/tools/tenccvt.hxx58
-rw-r--r--include/tools/time.hxx177
-rw-r--r--include/tools/toolsdllapi.h34
-rw-r--r--include/tools/urlobj.hxx1312
-rw-r--r--include/tools/vcompat.hxx65
-rw-r--r--include/tools/weakbase.h159
-rw-r--r--include/tools/weakbase.hxx162
-rw-r--r--include/tools/wintypes.hxx265
-rw-r--r--include/tools/wldcrd.hxx65
-rw-r--r--include/tools/zcodec.hxx82
-rw-r--r--include/typelib/typeclass.h107
-rw-r--r--include/typelib/typedescription.h1046
-rw-r--r--include/typelib/typedescription.hxx239
-rw-r--r--include/typelib/uik.h51
-rw-r--r--include/ucbhelper/activedatasink.hxx57
-rw-r--r--include/ucbhelper/authenticationfallback.hxx48
-rw-r--r--include/ucbhelper/cancelcommandexecution.hxx100
-rw-r--r--include/ucbhelper/commandenvironment.hxx79
-rw-r--r--include/ucbhelper/content.hxx680
-rw-r--r--include/ucbhelper/contenthelper.hxx448
-rw-r--r--include/ucbhelper/contentidentifier.hxx57
-rw-r--r--include/ucbhelper/fd_inputstream.hxx93
-rw-r--r--include/ucbhelper/interactionrequest.hxx547
-rw-r--r--include/ucbhelper/interceptedinteraction.hxx281
-rw-r--r--include/ucbhelper/macros.hxx146
-rw-r--r--include/ucbhelper/propertyvalueset.hxx203
-rw-r--r--include/ucbhelper/providerhelper.hxx246
-rw-r--r--include/ucbhelper/proxydecider.hxx135
-rw-r--r--include/ucbhelper/registerucb.hxx96
-rw-r--r--include/ucbhelper/resultset.hxx435
-rw-r--r--include/ucbhelper/resultsethelper.hxx164
-rw-r--r--include/ucbhelper/resultsetmetadata.hxx341
-rw-r--r--include/ucbhelper/simpleauthenticationrequest.hxx139
-rw-r--r--include/ucbhelper/simplecertificatevalidationrequest.hxx64
-rw-r--r--include/ucbhelper/simpleinteractionrequest.hxx95
-rw-r--r--include/ucbhelper/simplenameclashresolverequest.hxx72
-rw-r--r--include/ucbhelper/ucbhelperdllapi.h34
-rw-r--r--include/uno/Enterable.h110
-rw-r--r--include/uno/EnvDcp.h62
-rw-r--r--include/uno/any2.h174
-rw-r--r--include/uno/current_context.h67
-rw-r--r--include/uno/current_context.hxx122
-rw-r--r--include/uno/data.h255
-rw-r--r--include/uno/dispatcher.h92
-rw-r--r--include/uno/dispatcher.hxx190
-rw-r--r--include/uno/environment.h389
-rw-r--r--include/uno/environment.hxx290
-rw-r--r--include/uno/lbnames.h57
-rw-r--r--include/uno/mapping.h216
-rw-r--r--include/uno/mapping.hxx360
-rw-r--r--include/uno/sequence2.h199
-rw-r--r--include/uno/threadpool.h194
-rw-r--r--include/unoidl/detail/dllapi.hxx25
-rw-r--r--include/unoidl/unoidl.hxx715
-rw-r--r--include/unotest/bootstrapfixturebase.hxx74
-rw-r--r--include/unotest/detail/unotestdllapi.hxx34
-rw-r--r--include/unotest/directories.hxx52
-rw-r--r--include/unotest/filters-test.hxx95
-rw-r--r--include/unotest/getargument.hxx38
-rw-r--r--include/unotest/gettestargument.hxx42
-rw-r--r--include/unotest/macros_test.hxx114
-rw-r--r--include/unotest/officeconnection.hxx65
-rw-r--r--include/unotest/toabsolutefileurl.hxx39
-rw-r--r--include/unotools/VersionConfig.hxx56
-rw-r--r--include/unotools/ZipPackageHelper.hxx64
-rw-r--r--include/unotools/accessiblerelationsethelper.hxx126
-rw-r--r--include/unotools/accessiblestatesethelper.hxx137
-rw-r--r--include/unotools/bootstrap.hxx120
-rw-r--r--include/unotools/calendarwrapper.hxx124
-rw-r--r--include/unotools/caserotate.hxx34
-rw-r--r--include/unotools/charclass.hxx181
-rw-r--r--include/unotools/closeveto.hxx55
-rw-r--r--include/unotools/cmdoptions.hxx119
-rw-r--r--include/unotools/collatorwrapper.hxx64
-rw-r--r--include/unotools/compatibility.hxx200
-rw-r--r--include/unotools/configitem.hxx215
-rw-r--r--include/unotools/configmgr.hxx104
-rw-r--r--include/unotools/confignode.hxx272
-rw-r--r--include/unotools/configpaths.hxx162
-rw-r--r--include/unotools/configvaluecontainer.hxx153
-rw-r--r--include/unotools/datetime.hxx59
-rw-r--r--include/unotools/defaultencoding.hxx31
-rw-r--r--include/unotools/defaultoptions.hxx30
-rw-r--r--include/unotools/desktopterminationobserver.hxx64
-rw-r--r--include/unotools/digitgroupingiterator.hxx194
-rw-r--r--include/unotools/docinfohelper.hxx35
-rw-r--r--include/unotools/dynamicmenuoptions.hxx73
-rw-r--r--include/unotools/eventcfg.hxx88
-rw-r--r--include/unotools/eventlisteneradapter.hxx65
-rw-r--r--include/unotools/extendedsecurityoptions.hxx32
-rw-r--r--include/unotools/fltrcfg.hxx106
-rw-r--r--include/unotools/fontcfg.hxx184
-rw-r--r--include/unotools/fontcvt.hxx64
-rw-r--r--include/unotools/fontdefs.hxx111
-rw-r--r--include/unotools/historyoptions.hxx83
-rw-r--r--include/unotools/intlwrapper.hxx91
-rw-r--r--include/unotools/itemholderbase.hxx68
-rw-r--r--include/unotools/lingucfg.hxx209
-rw-r--r--include/unotools/linguprops.hxx119
-rw-r--r--include/unotools/localedatawrapper.hxx394
-rw-r--r--include/unotools/localfilehelper.hxx42
-rw-r--r--include/unotools/mediadescriptor.hxx339
-rw-r--r--include/unotools/moduleoptions.hxx176
-rw-r--r--include/unotools/nativenumberwrapper.hxx68
-rw-r--r--include/unotools/options.hxx114
-rw-r--r--include/unotools/optionsdlg.hxx48
-rw-r--r--include/unotools/pathoptions.hxx137
-rw-r--r--include/unotools/progresshandlerwrap.hxx53
-rw-r--r--include/unotools/resmgr.hxx76
-rw-r--r--include/unotools/saveopt.hxx82
-rw-r--r--include/unotools/searchopt.hxx114
-rw-r--r--include/unotools/securityoptions.hxx157
-rw-r--r--include/unotools/sharedunocomponent.hxx269
-rw-r--r--include/unotools/streamhelper.hxx70
-rw-r--r--include/unotools/streamwrap.hxx184
-rw-r--r--include/unotools/syslocale.hxx73
-rw-r--r--include/unotools/syslocaleoptions.hxx152
-rw-r--r--include/unotools/tempfile.hxx145
-rw-r--r--include/unotools/textsearch.hxx225
-rw-r--r--include/unotools/transliterationwrapper.hxx122
-rw-r--r--include/unotools/ucbhelper.hxx113
-rw-r--r--include/unotools/ucbstreamhelper.hxx54
-rw-r--r--include/unotools/unotoolsdllapi.h34
-rw-r--r--include/unotools/useroptions.hxx100
-rw-r--r--include/unotools/viewoptions.hxx223
-rw-r--r--include/unotools/weakref.hxx133
-rw-r--r--include/unotools/wincodepage.hxx36
-rw-r--r--include/vbahelper/vbaaccesshelper.hxx78
-rw-r--r--include/vbahelper/vbaapplicationbase.hxx86
-rw-r--r--include/vbahelper/vbacollectionimpl.hxx354
-rw-r--r--include/vbahelper/vbadialogbase.hxx60
-rw-r--r--include/vbahelper/vbadialogsbase.hxx59
-rw-r--r--include/vbahelper/vbadllapi.h34
-rw-r--r--include/vbahelper/vbadocumentbase.hxx87
-rw-r--r--include/vbahelper/vbadocumentsbase.hxx81
-rw-r--r--include/vbahelper/vbaeventshelperbase.hxx228
-rw-r--r--include/vbahelper/vbafontbase.hxx112
-rw-r--r--include/vbahelper/vbaglobalbase.hxx64
-rw-r--r--include/vbahelper/vbahelper.hxx281
-rw-r--r--include/vbahelper/vbahelperinterface.hxx142
-rw-r--r--include/vbahelper/vbapagesetupbase.hxx79
-rw-r--r--include/vbahelper/vbapropvalue.hxx59
-rw-r--r--include/vbahelper/vbareturntypes.hxx54
-rw-r--r--include/vbahelper/vbashape.hxx136
-rw-r--r--include/vbahelper/vbashaperange.hxx105
-rw-r--r--include/vbahelper/vbashapes.hxx100
-rw-r--r--include/vbahelper/vbatextframe.hxx79
-rw-r--r--include/vbahelper/vbawindowbase.hxx101
-rw-r--r--include/vcl/AccessibleBrowseBoxObjType.hxx35
-rw-r--r--include/vcl/BinaryDataContainer.hxx66
-rw-r--r--include/vcl/BinaryDataContainerTools.hxx23
-rw-r--r--include/vcl/BitmapAccessMode.hxx32
-rw-r--r--include/vcl/BitmapAlphaClampFilter.hxx34
-rw-r--r--include/vcl/BitmapBasicMorphologyFilter.hxx71
-rw-r--r--include/vcl/BitmapBuffer.hxx54
-rw-r--r--include/vcl/BitmapColor.hxx82
-rw-r--r--include/vcl/BitmapColorQuantizationFilter.hxx43
-rw-r--r--include/vcl/BitmapConvolutionMatrixFilter.hxx36
-rw-r--r--include/vcl/BitmapDuoToneFilter.hxx36
-rw-r--r--include/vcl/BitmapEmbossGreyFilter.hxx36
-rw-r--r--include/vcl/BitmapFilter.hxx60
-rw-r--r--include/vcl/BitmapFilterStackBlur.hxx33
-rw-r--r--include/vcl/BitmapGaussianSeparableBlurFilter.hxx52
-rw-r--r--include/vcl/BitmapInfoAccess.hxx148
-rw-r--r--include/vcl/BitmapMedianFilter.hxx28
-rw-r--r--include/vcl/BitmapMonochromeFilter.hxx43
-rw-r--r--include/vcl/BitmapMosaicFilter.hxx40
-rw-r--r--include/vcl/BitmapPalette.hxx78
-rw-r--r--include/vcl/BitmapPopArtFilter.hxx33
-rw-r--r--include/vcl/BitmapReadAccess.hxx195
-rw-r--r--include/vcl/BitmapSeparableUnsharpenFilter.hxx37
-rw-r--r--include/vcl/BitmapSepiaFilter.hxx38
-rw-r--r--include/vcl/BitmapShadowFilter.hxx31
-rw-r--r--include/vcl/BitmapSharpenFilter.hxx24
-rw-r--r--include/vcl/BitmapSimpleColorQuantizationFilter.hxx37
-rw-r--r--include/vcl/BitmapSmoothenFilter.hxx34
-rw-r--r--include/vcl/BitmapSobelGreyFilter.hxx26
-rw-r--r--include/vcl/BitmapSolarizeFilter.hxx34
-rw-r--r--include/vcl/BitmapTools.hxx104
-rw-r--r--include/vcl/ColorMask.hxx193
-rw-r--r--include/vcl/EnumContext.hxx167
-rw-r--r--include/vcl/FilterConfigItem.hxx94
-rw-r--r--include/vcl/GestureEvent.hxx61
-rw-r--r--include/vcl/GraphicAttributes.hxx148
-rw-r--r--include/vcl/GraphicExternalLink.hxx31
-rw-r--r--include/vcl/GraphicLoader.hxx27
-rw-r--r--include/vcl/GraphicNativeMetadata.hxx40
-rw-r--r--include/vcl/GraphicNativeTransform.hxx43
-rw-r--r--include/vcl/GraphicObject.hxx302
-rw-r--r--include/vcl/IContext.hxx44
-rw-r--r--include/vcl/IDialogRenderable.hxx47
-rw-r--r--include/vcl/ITiledRenderable.hxx348
-rw-r--r--include/vcl/IconThemeInfo.hxx98
-rw-r--r--include/vcl/ImageTree.hxx95
-rw-r--r--include/vcl/InterimItemWindow.hxx76
-rw-r--r--include/vcl/NotebookbarContextControl.hxx24
-rw-r--r--include/vcl/PrinterSupport.hxx34
-rw-r--r--include/vcl/QueueInfo.hxx55
-rw-r--r--include/vcl/RawBitmap.hxx79
-rw-r--r--include/vcl/Scanline.hxx61
-rw-r--r--include/vcl/TaskStopwatch.hxx117
-rw-r--r--include/vcl/TypeSerializer.hxx60
-rw-r--r--include/vcl/VectorGraphicSearch.hxx71
-rw-r--r--include/vcl/WeldedTabbedNotebookbar.hxx36
-rw-r--r--include/vcl/abstdlg.hxx193
-rw-r--r--include/vcl/accessiblefactory.hxx173
-rw-r--r--include/vcl/accessibletable.hxx174
-rw-r--r--include/vcl/accessibletableprovider.hxx233
-rw-r--r--include/vcl/alpha.hxx75
-rw-r--r--include/vcl/animate/Animation.hxx118
-rw-r--r--include/vcl/animate/AnimationBitmap.hxx78
-rw-r--r--include/vcl/bitmap.hxx570
-rw-r--r--include/vcl/bitmap/BitmapTypes.hxx68
-rw-r--r--include/vcl/bitmapex.hxx512
-rw-r--r--include/vcl/builder.hxx450
-rw-r--r--include/vcl/builderfactory.hxx51
-rw-r--r--include/vcl/builderpage.hxx50
-rw-r--r--include/vcl/cairo.hxx69
-rw-r--r--include/vcl/canvastools.hxx167
-rw-r--r--include/vcl/checksum.hxx84
-rw-r--r--include/vcl/commandevent.hxx354
-rw-r--r--include/vcl/commandinfoprovider.hxx107
-rw-r--r--include/vcl/ctrl.hxx239
-rw-r--r--include/vcl/cursor.hxx113
-rw-r--r--include/vcl/customweld.hxx191
-rw-r--r--include/vcl/cvtgrf.hxx50
-rw-r--r--include/vcl/decoview.hxx95
-rw-r--r--include/vcl/devicecoordinate.hxx27
-rw-r--r--include/vcl/dialoghelper.hxx35
-rw-r--r--include/vcl/dibtools.hxx87
-rw-r--r--include/vcl/dllapi.h47
-rw-r--r--include/vcl/dndhelp.hxx110
-rw-r--r--include/vcl/dockingarea.hxx58
-rw-r--r--include/vcl/dockwin.hxx255
-rw-r--r--include/vcl/embeddedfontshelper.hxx110
-rw-r--r--include/vcl/errcode.hxx279
-rw-r--r--include/vcl/errinf.hxx229
-rw-r--r--include/vcl/event.hxx387
-rw-r--r--include/vcl/evntpost.hxx46
-rw-r--r--include/vcl/exceptiontypes.hxx32
-rw-r--r--include/vcl/extoutdevdata.hxx36
-rw-r--r--include/vcl/fieldvalues.hxx80
-rw-r--r--include/vcl/fileregistration.hxx28
-rw-r--r--include/vcl/filter/PDFiumLibrary.hxx236
-rw-r--r--include/vcl/filter/PngImageReader.hxx56
-rw-r--r--include/vcl/filter/SvmReader.hxx94
-rw-r--r--include/vcl/filter/SvmWriter.hxx94
-rw-r--r--include/vcl/filter/pdfdocument.hxx645
-rw-r--r--include/vcl/filter/pdfobjectcontainer.hxx40
-rw-r--r--include/vcl/fntstyle.hxx41
-rw-r--r--include/vcl/font.hxx194
-rw-r--r--include/vcl/font/Feature.hxx121
-rw-r--r--include/vcl/font/FeatureParser.hxx48
-rw-r--r--include/vcl/fontcapabilities.hxx203
-rw-r--r--include/vcl/fontcharmap.hxx174
-rw-r--r--include/vcl/formatter.hxx316
-rw-r--r--include/vcl/gdimetafiletools.hxx55
-rw-r--r--include/vcl/gdimtf.hxx195
-rw-r--r--include/vcl/gfxlink.hxx114
-rw-r--r--include/vcl/glyphitem.hxx57
-rw-r--r--include/vcl/glyphitemcache.hxx111
-rw-r--r--include/vcl/gradient.hxx99
-rw-r--r--include/vcl/graph.hxx208
-rw-r--r--include/vcl/graphicfilter.hxx392
-rw-r--r--include/vcl/graphictools.hxx369
-rw-r--r--include/vcl/hatch.hxx79
-rw-r--r--include/vcl/headbar.hxx319
-rw-r--r--include/vcl/help.hxx114
-rw-r--r--include/vcl/i18nhelp.hxx77
-rw-r--r--include/vcl/idle.hxx70
-rw-r--r--include/vcl/image.hxx75
-rw-r--r--include/vcl/imap.hxx138
-rw-r--r--include/vcl/imapcirc.hxx69
-rw-r--r--include/vcl/imapobj.hxx129
-rw-r--r--include/vcl/imappoly.hxx73
-rw-r--r--include/vcl/imaprect.hxx67
-rw-r--r--include/vcl/inetimg.hxx58
-rw-r--r--include/vcl/inputctx.hxx81
-rw-r--r--include/vcl/inputtypes.hxx43
-rw-r--r--include/vcl/introwin.hxx40
-rw-r--r--include/vcl/jobset.hxx63
-rw-r--r--include/vcl/jsdialog/executor.hxx93
-rw-r--r--include/vcl/keycod.hxx116
-rw-r--r--include/vcl/keycodes.hxx200
-rw-r--r--include/vcl/layout.hxx842
-rw-r--r--include/vcl/lazydelete.hxx138
-rw-r--r--include/vcl/lineinfo.hxx119
-rw-r--r--include/vcl/locktoplevels.hxx38
-rw-r--r--include/vcl/lok.hxx31
-rw-r--r--include/vcl/mapmod.hxx93
-rw-r--r--include/vcl/menu.hxx539
-rw-r--r--include/vcl/menubarupdateicon.hxx89
-rw-r--r--include/vcl/metaact.hxx1752
-rw-r--r--include/vcl/metaactiontypes.hxx85
-rw-r--r--include/vcl/metric.hxx109
-rw-r--r--include/vcl/mnemonic.hxx75
-rw-r--r--include/vcl/mtfxmldump.hxx63
-rw-r--r--include/vcl/naturalsort.hxx20
-rw-r--r--include/vcl/notebookbar/NotebookBarAddonsMerger.hxx62
-rw-r--r--include/vcl/notebookbar/notebookbar.hxx77
-rw-r--r--include/vcl/oldprintadaptor.hxx53
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx130
-rw-r--r--include/vcl/opengl/OpenGLHelper.hxx124
-rw-r--r--include/vcl/opengl/OpenGLWrapper.hxx31
-rw-r--r--include/vcl/outdev.hxx1930
-rw-r--r--include/vcl/outdev/ScopedStates.hxx41
-rw-r--r--include/vcl/pdf/PDFAnnotationMarker.hxx77
-rw-r--r--include/vcl/pdf/PDFAnnotationSubType.hxx50
-rw-r--r--include/vcl/pdf/PDFBitmapType.hxx26
-rw-r--r--include/vcl/pdf/PDFErrorType.hxx28
-rw-r--r--include/vcl/pdf/PDFFillMode.hxx24
-rw-r--r--include/vcl/pdf/PDFFindFlags.hxx35
-rw-r--r--include/vcl/pdf/PDFObjectType.hxx31
-rw-r--r--include/vcl/pdf/PDFPageObjectType.hxx27
-rw-r--r--include/vcl/pdf/PDFSegmentType.hxx25
-rw-r--r--include/vcl/pdf/PDFTextRenderMode.hxx30
-rw-r--r--include/vcl/pdfextoutdevdata.hxx488
-rw-r--r--include/vcl/pdfread.hxx107
-rw-r--r--include/vcl/pdfwriter.hxx1227
-rw-r--r--include/vcl/pngwrite.hxx60
-rw-r--r--include/vcl/print.hxx615
-rw-r--r--include/vcl/printer/Options.hxx120
-rw-r--r--include/vcl/prntypes.hxx93
-rw-r--r--include/vcl/ptrstyle.hxx125
-rw-r--r--include/vcl/quickselectionengine.hxx91
-rw-r--r--include/vcl/region.hxx167
-rw-r--r--include/vcl/rendercontext/AddFontSubstituteFlags.hxx38
-rw-r--r--include/vcl/rendercontext/AntialiasingFlags.hxx38
-rw-r--r--include/vcl/rendercontext/DrawGridFlags.hxx38
-rw-r--r--include/vcl/rendercontext/DrawImageFlags.hxx41
-rw-r--r--include/vcl/rendercontext/DrawModeFlags.hxx57
-rw-r--r--include/vcl/rendercontext/DrawTextFlags.hxx53
-rw-r--r--include/vcl/rendercontext/GetDefaultFontFlags.hxx36
-rw-r--r--include/vcl/rendercontext/ImplMapRes.hxx36
-rw-r--r--include/vcl/rendercontext/InvertFlags.hxx37
-rw-r--r--include/vcl/rendercontext/RasterOp.hxx31
-rw-r--r--include/vcl/rendercontext/SalLayoutFlags.hxx44
-rw-r--r--include/vcl/rendercontext/State.hxx120
-rw-r--r--include/vcl/rendercontext/SystemTextColorFlags.hxx37
-rw-r--r--include/vcl/roadmapwizard.hxx189
-rw-r--r--include/vcl/salctype.hxx64
-rw-r--r--include/vcl/salgtype.hxx86
-rw-r--r--include/vcl/salnativewidgets.hxx520
-rw-r--r--include/vcl/scheduler.hxx88
-rw-r--r--include/vcl/scopedbitmapaccess.hxx123
-rw-r--r--include/vcl/scrbar.hxx158
-rw-r--r--include/vcl/seleng.hxx240
-rw-r--r--include/vcl/settings.hxx726
-rw-r--r--include/vcl/skia/SkiaHelper.hxx42
-rw-r--r--include/vcl/sound.hxx30
-rw-r--r--include/vcl/specialchars.hxx46
-rw-r--r--include/vcl/split.hxx105
-rw-r--r--include/vcl/splitwin.hxx187
-rw-r--r--include/vcl/status.hxx193
-rw-r--r--include/vcl/stdtext.hxx53
-rw-r--r--include/vcl/svapp.hxx1482
-rw-r--r--include/vcl/svmain.hxx33
-rw-r--r--include/vcl/svtaccessiblefactory.hxx59
-rw-r--r--include/vcl/syschild.hxx67
-rw-r--r--include/vcl/sysdata.hxx201
-rw-r--r--include/vcl/syswin.hxx249
-rw-r--r--include/vcl/tabctrl.hxx232
-rw-r--r--include/vcl/tabpage.hxx77
-rw-r--r--include/vcl/task.hxx115
-rw-r--r--include/vcl/taskpanelist.hxx54
-rw-r--r--include/vcl/test/GraphicsRenderTests.hxx167
-rw-r--r--include/vcl/test/TestResult.hxx26
-rw-r--r--include/vcl/textdata.hxx143
-rw-r--r--include/vcl/texteng.hxx302
-rw-r--r--include/vcl/textfilter.hxx31
-rw-r--r--include/vcl/textrectinfo.hxx61
-rw-r--r--include/vcl/textview.hxx229
-rw-r--r--include/vcl/threadex.hxx174
-rw-r--r--include/vcl/timer.hxx77
-rw-r--r--include/vcl/toolbox.hxx537
-rw-r--r--include/vcl/toolboxid.hxx23
-rw-r--r--include/vcl/toolkit/README2
-rw-r--r--include/vcl/toolkit/button.hxx507
-rw-r--r--include/vcl/toolkit/calendar.hxx98
-rw-r--r--include/vcl/toolkit/combobox.hxx197
-rw-r--r--include/vcl/toolkit/dialog.hxx169
-rw-r--r--include/vcl/toolkit/edit.hxx249
-rw-r--r--include/vcl/toolkit/field.hxx627
-rw-r--r--include/vcl/toolkit/fixed.hxx181
-rw-r--r--include/vcl/toolkit/fixedhyper.hxx118
-rw-r--r--include/vcl/toolkit/floatwin.hxx140
-rw-r--r--include/vcl/toolkit/fmtfield.hxx100
-rw-r--r--include/vcl/toolkit/group.hxx57
-rw-r--r--include/vcl/toolkit/imgctrl.hxx52
-rw-r--r--include/vcl/toolkit/ivctrl.hxx259
-rw-r--r--include/vcl/toolkit/longcurr.hxx74
-rw-r--r--include/vcl/toolkit/lstbox.hxx266
-rw-r--r--include/vcl/toolkit/menubtn.hxx97
-rw-r--r--include/vcl/toolkit/morebtn.hxx56
-rw-r--r--include/vcl/toolkit/prgsbar.hxx80
-rw-r--r--include/vcl/toolkit/roadmap.hxx116
-rw-r--r--include/vcl/toolkit/spin.hxx98
-rw-r--r--include/vcl/toolkit/spinfld.hxx104
-rw-r--r--include/vcl/toolkit/svlbitm.hxx287
-rw-r--r--include/vcl/toolkit/svtabbx.hxx208
-rw-r--r--include/vcl/toolkit/tabdlg.hxx49
-rw-r--r--include/vcl/toolkit/throbber.hxx85
-rw-r--r--include/vcl/toolkit/treelist.hxx296
-rw-r--r--include/vcl/toolkit/treelistbox.hxx690
-rw-r--r--include/vcl/toolkit/treelistentries.hxx23
-rw-r--r--include/vcl/toolkit/treelistentry.hxx131
-rw-r--r--include/vcl/toolkit/unowrap.hxx93
-rw-r--r--include/vcl/toolkit/vclmedit.hxx173
-rw-r--r--include/vcl/toolkit/viewdataentry.hxx85
-rw-r--r--include/vcl/transfer.hxx521
-rw-r--r--include/vcl/txtattr.hxx189
-rw-r--r--include/vcl/uitest/eventdescription.hxx24
-rw-r--r--include/vcl/uitest/factory.hxx27
-rw-r--r--include/vcl/uitest/formattedfielduiobject.hxx37
-rw-r--r--include/vcl/uitest/logger.hxx68
-rw-r--r--include/vcl/uitest/metricfielduiobject.hxx37
-rw-r--r--include/vcl/uitest/uiobject.hxx589
-rw-r--r--include/vcl/uitest/uitest.hxx40
-rw-r--r--include/vcl/unohelp.hxx50
-rw-r--r--include/vcl/unohelp2.hxx68
-rw-r--r--include/vcl/vclenum.hxx418
-rw-r--r--include/vcl/vclevent.hxx220
-rw-r--r--include/vcl/vcllayout.hxx125
-rw-r--r--include/vcl/vclmain.hxx33
-rw-r--r--include/vcl/vclptr.hxx442
-rw-r--r--include/vcl/vclreferencebase.hxx72
-rw-r--r--include/vcl/vectorgraphicdata.hxx139
-rw-r--r--include/vcl/virdev.hxx189
-rw-r--r--include/vcl/wall.hxx117
-rw-r--r--include/vcl/weld.hxx2637
-rw-r--r--include/vcl/weldutils.hxx471
-rw-r--r--include/vcl/window.hxx1586
-rw-r--r--include/vcl/windowstate.hxx83
-rw-r--r--include/vcl/winscheduler.hxx44
-rw-r--r--include/vcl/wizardmachine.hxx356
-rw-r--r--include/vcl/wmf.hxx41
-rw-r--r--include/vcl/wmfexternal.hxx59
-rw-r--r--include/vcl/wrkwin.hxx104
-rw-r--r--include/vcl/xtextedt.hxx39
-rw-r--r--include/version.hrc42
-rw-r--r--include/xmloff/DashStyle.hxx62
-rw-r--r--include/xmloff/DocumentSettingsContext.hxx58
-rw-r--r--include/xmloff/EnumPropertyHdl.hxx49
-rw-r--r--include/xmloff/GradientStyle.hxx64
-rw-r--r--include/xmloff/HatchStyle.hxx61
-rw-r--r--include/xmloff/ImageStyle.hxx45
-rw-r--r--include/xmloff/MarkerStyle.hxx63
-rw-r--r--include/xmloff/NamedBoolPropertyHdl.hxx54
-rw-r--r--include/xmloff/ProgressBarHelper.hxx69
-rw-r--r--include/xmloff/SchXMLExportHelper.hxx62
-rw-r--r--include/xmloff/SchXMLImportHelper.hxx115
-rw-r--r--include/xmloff/SchXMLSeriesHelper.hxx62
-rw-r--r--include/xmloff/SettingsExportHelper.hxx101
-rw-r--r--include/xmloff/SinglePropertySetInfoCache.hxx67
-rw-r--r--include/xmloff/XMLBase64ImportContext.hxx49
-rw-r--r--include/xmloff/XMLCharContext.hxx59
-rw-r--r--include/xmloff/XMLConstantsPropertyHandler.hxx64
-rw-r--r--include/xmloff/XMLDrawingPageStyleContext.hxx42
-rw-r--r--include/xmloff/XMLEventExport.hxx128
-rw-r--r--include/xmloff/XMLEventsImportContext.hxx102
-rw-r--r--include/xmloff/XMLFilterServiceNames.h40
-rw-r--r--include/xmloff/XMLFontAutoStylePool.hxx92
-rw-r--r--include/xmloff/XMLFontStylesContext.hxx74
-rw-r--r--include/xmloff/XMLGraphicsDefaultStyle.hxx44
-rw-r--r--include/xmloff/XMLPageExport.hxx97
-rw-r--r--include/xmloff/XMLSettingsExportContext.hxx60
-rw-r--r--include/xmloff/XMLShapeStyleContext.hxx60
-rw-r--r--include/xmloff/XMLTextListAutoStylePool.hxx76
-rw-r--r--include/xmloff/XMLTextMasterPageContext.hxx81
-rw-r--r--include/xmloff/XMLTextMasterPageExport.hxx50
-rw-r--r--include/xmloff/XMLTextMasterStylesContext.hxx44
-rw-r--r--include/xmloff/XMLTextShapeImportHelper.hxx44
-rw-r--r--include/xmloff/XMLTextShapeStyleContext.hxx53
-rw-r--r--include/xmloff/XMLTextTableContext.hxx36
-rw-r--r--include/xmloff/animationexport.hxx55
-rw-r--r--include/xmloff/animexp.hxx54
-rw-r--r--include/xmloff/attrlist.hxx79
-rw-r--r--include/xmloff/autolayout.hxx67
-rw-r--r--include/xmloff/contextid.hxx43
-rw-r--r--include/xmloff/controlpropertyhdl.hxx128
-rw-r--r--include/xmloff/dllapi.h34
-rw-r--r--include/xmloff/families.hxx115
-rw-r--r--include/xmloff/formlayerexport.hxx185
-rw-r--r--include/xmloff/formlayerimport.hxx133
-rw-r--r--include/xmloff/i18nmap.hxx66
-rw-r--r--include/xmloff/languagetagodf.hxx40
-rw-r--r--include/xmloff/maptype.hxx152
-rw-r--r--include/xmloff/namespacemap.hxx164
-rw-r--r--include/xmloff/numehelp.hxx117
-rw-r--r--include/xmloff/odffields.hxx61
-rw-r--r--include/xmloff/prhdlfac.hxx106
-rw-r--r--include/xmloff/prstylei.hxx118
-rw-r--r--include/xmloff/settingsstore.hxx43
-rw-r--r--include/xmloff/shapeexport.hxx311
-rw-r--r--include/xmloff/shapeimport.hxx263
-rw-r--r--include/xmloff/styleexp.hxx112
-rw-r--r--include/xmloff/table/XMLTableExport.hxx105
-rw-r--r--include/xmloff/table/XMLTableImport.hxx74
-rw-r--r--include/xmloff/txtimp.hxx443
-rw-r--r--include/xmloff/txtimppr.hxx69
-rw-r--r--include/xmloff/txtparae.hxx582
-rw-r--r--include/xmloff/txtprmap.hxx233
-rw-r--r--include/xmloff/txtstyli.hxx100
-rw-r--r--include/xmloff/unoatrcn.hxx82
-rw-r--r--include/xmloff/unointerfacetouniqueidentifiermapper.hxx94
-rw-r--r--include/xmloff/xformsexport.hxx53
-rw-r--r--include/xmloff/xformsimport.hxx75
-rw-r--r--include/xmloff/xmlaustp.hxx135
-rw-r--r--include/xmloff/xmlcnimp.hxx78
-rw-r--r--include/xmloff/xmlement.hxx86
-rw-r--r--include/xmloff/xmlerror.hxx140
-rw-r--r--include/xmloff/xmlevent.hxx141
-rw-r--r--include/xmloff/xmlexp.hxx677
-rw-r--r--include/xmloff/xmlexppr.hxx182
-rw-r--r--include/xmloff/xmlictxt.hxx125
-rw-r--r--include/xmloff/xmlimp.hxx664
-rw-r--r--include/xmloff/xmlimppr.hxx212
-rw-r--r--include/xmloff/xmlmetae.hxx102
-rw-r--r--include/xmloff/xmlmetai.hxx63
-rw-r--r--include/xmloff/xmlnamespace.hxx142
-rw-r--r--include/xmloff/xmlnume.hxx76
-rw-r--r--include/xmloff/xmlnumfe.hxx131
-rw-r--r--include/xmloff/xmlnumfi.hxx217
-rw-r--r--include/xmloff/xmlnumi.hxx82
-rw-r--r--include/xmloff/xmlprcon.hxx68
-rw-r--r--include/xmloff/xmlprhdl.hxx59
-rw-r--r--include/xmloff/xmlprmap.hxx128
-rw-r--r--include/xmloff/xmlscripti.hxx47
-rw-r--r--include/xmloff/xmlstyle.hxx205
-rw-r--r--include/xmloff/xmltkmap.hxx65
-rw-r--r--include/xmloff/xmltoken.hxx3532
-rw-r--r--include/xmloff/xmltypes.hxx301
-rw-r--r--include/xmloff/xmluconv.hxx330
-rw-r--r--include/xmlreader/README28
-rw-r--r--include/xmlreader/detail/xmlreaderdllapi.hxx32
-rw-r--r--include/xmlreader/pad.hxx54
-rw-r--r--include/xmlreader/span.hxx82
-rw-r--r--include/xmlreader/xmlreader.hxx186
-rw-r--r--include/xmlscript/xml_helper.hxx121
-rw-r--r--include/xmlscript/xmldlg_imexp.hxx63
-rw-r--r--include/xmlscript/xmllib_imexp.hxx82
-rw-r--r--include/xmlscript/xmlmod_imexp.hxx54
-rw-r--r--include/xmlscript/xmlns.h38
-rw-r--r--include/xmlscript/xmlscriptdllapi.h30
2539 files changed, 376076 insertions, 0 deletions
diff --git a/include/IwyuFilter_include.yaml b/include/IwyuFilter_include.yaml
new file mode 100644
index 000000000..758ba37a6
--- /dev/null
+++ b/include/IwyuFilter_include.yaml
@@ -0,0 +1,952 @@
+---
+assumeFilename: desktop/source/app/app.cxx
+excludelist:
+ include/sal/typesizes.h:
+ # needed for build to work
+ - config_typesizes.h
+ include/sal/types.h:
+ # needed for build to work
+ - sal/typesizes.h
+ include/sal/mathconf.h:
+ # Platform dependent
+ - cmath
+ include/osl/endian.h:
+ # needed for base types used in macros
+ - sal/types.h
+ include/osl/conditn.h:
+ # ODK API test would fail with fw decl here
+ - osl/time.h
+ include/osl/socket.h:
+ # ODK API test would fail with fw decl here
+ - osl/time.h
+ include/osl/thread.h:
+ # ODK API test would fail with fw decl here
+ - osl/time.h
+ include/osl/conditn.hxx:
+ # ODK API test would fail with fw decl here
+ - osl/time.h
+ include/osl/pipe_decl.hxx:
+ # ODK API test would fail with fw decl here
+ - osl/security.hxx
+ include/osl/socket_decl.hxx:
+ # Needed by socket.hxx for inline function
+ - rtl/byteseq.hxx
+ include/osl/thread.hxx:
+ # ODK API test would fail with fw decl here
+ - osl/time.h
+ include/rtl/instance.hxx:
+ # Needed for template functions
+ - osl/getglobalmutex.hxx
+ include/rtl/math.hxx:
+ # TODO MSVC does not compile basegfx/numeric/ftools.hxx when this is replaced
+ - math.h
+ include/android/compatibility.hxx:
+ # TODO check whether actually needed, just silence this for now
+ - math.h
+ include/LibreOfficeKit/LibreOfficeKit.h:
+ # the unstable API needs C99's bool
+ - stdbool.h
+ - stdint.h
+ include/sfx2/toolbarids.hxx:
+ # needed for enum definition
+ - sal/types.h
+ include/cppuhelper/compbase1.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase1.hxx
+ include/cppuhelper/compbase2.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase2.hxx
+ include/cppuhelper/compbase3.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase3.hxx
+ include/cppuhelper/compbase4.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase4.hxx
+ include/cppuhelper/compbase5.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase5.hxx
+ include/cppuhelper/compbase6.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase6.hxx
+ include/cppuhelper/compbase7.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase7.hxx
+ include/cppuhelper/compbase8.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase8.hxx
+ include/cppuhelper/compbase9.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase9.hxx
+ include/cppuhelper/compbase10.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase10.hxx
+ include/cppuhelper/compbase11.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase11.hxx
+ include/cppuhelper/compbase12.hxx:
+ # Needed for template functions
+ - cppuhelper/implbase12.hxx
+ include/cppuhelper/exc_hlp.hxx:
+ #Needed for implicit destructor
+ - com/sun/star/uno/Any.hxx
+ include/cppuhelper/propertysetmixin.hxx:
+ #Needed for implicit destructor
+ - com/sun/star/uno/Sequence.hxx
+ include/cppuhelper/interfacecontainer.h:
+ #Needed for implicit destructor
+ - com/sun/star/uno/Sequence.hxx
+ include/ucbhelper/activedatasink.hxx:
+ # base class has to be a complete type
+ - com/sun/star/io/XActiveDataSink.hpp
+ include/ucbhelper/commandenvironment.hxx:
+ # base class has to be a complete type
+ - com/sun/star/ucb/XCommandEnvironment.hpp
+ include/ucbhelper/interceptedinteraction.hxx:
+ # base class has to be a complete type
+ - com/sun/star/task/XInteractionHandler.hpp
+ include/ucbhelper/fd_inputstream.hxx:
+ # Needed for typedef
+ - com/sun/star/io/XInputStream.hpp
+ - com/sun/star/io/XSeekable.hpp
+ include/ucbhelper/macros.hxx:
+ # Used in macros defined here
+ - cppuhelper/typeprovider.hxx
+ - cppuhelper/supportsservice.hxx
+ - cppuhelper/factory.hxx
+ include/comphelper/accessiblekeybindinghelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleKeyBinding.hpp
+ include/comphelper/accessiblecomponenthelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleExtendedComponent.hpp
+ include/comphelper/accessiblecontexthelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleContext.hpp
+ - com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp
+ include/comphelper/accessibleselectionhelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleSelection.hpp
+ include/comphelper/accessibletexthelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleText.hpp
+ include/comphelper/accessiblewrapper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleContext.hpp
+ - com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp
+ - com/sun/star/accessibility/XAccessibleEventListener.hpp
+ include/comphelper/accimplaccess.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XUnoTunnel.hpp
+ include/comphelper/attributelist.hxx:
+ # base class has to be a complete type
+ - com/sun/star/util/XCloneable.hpp
+ - com/sun/star/xml/sax/XAttributeList.hpp
+ include/comphelper/ChainablePropertySetInfo.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertySetInfo.hpp
+ include/comphelper/containermultiplexer.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XContainerListener.hpp
+ include/comphelper/docpasswordrequest.hxx:
+ # base class has to be a complete type
+ - com/sun/star/task/XInteractionRequest.hpp
+ include/comphelper/enumhelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XEnumeration.hpp
+ - com/sun/star/lang/XEventListener.hpp
+ include/comphelper/evtlistenerhlp.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XEventListener.hpp
+ include/comphelper/interaction.hxx:
+ # base class has to be a complete type
+ - com/sun/star/task/XInteractionAbort.hpp
+ - com/sun/star/task/XInteractionApprove.hpp
+ - com/sun/star/task/XInteractionDisapprove.hpp
+ - com/sun/star/task/XInteractionRequest.hpp
+ - com/sun/star/task/XInteractionRetry.hpp
+ include/comphelper/SelectionMultiplex.hxx:
+ # base class has to be a complete type
+ - com/sun/star/view/XSelectionChangeListener.hpp
+ include/comphelper/MasterPropertySetInfo.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertySetInfo.hpp
+ include/comphelper/namedvaluecollection.hxx:
+ # Needed for template class
+ - com/sun/star/beans/PropertyValue.hpp
+ - com/sun/star/beans/NamedValue.hpp
+ include/comphelper/numberedcollection.hxx:
+ # base class has to be a complete type
+ - com/sun/star/frame/XUntitledNumbers.hpp
+ include/comphelper/oslfile2streamwrap.hxx:
+ # base class has to be a complete type
+ - com/sun/star/io/XInputStream.hpp
+ - com/sun/star/io/XOutputStream.hpp
+ include/comphelper/propertysetinfo.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertySetInfo.hpp
+ include/comphelper/propmultiplex.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertyChangeListener.hpp
+ include/comphelper/propertystatecontainer.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertyState.hpp
+ include/comphelper/seekableinput.hxx:
+ # base class has to be a complete type
+ - com/sun/star/io/XInputStream.hpp
+ - com/sun/star/io/XSeekable.hpp
+ include/comphelper/seqstream.hxx:
+ # base class has to be a complete type
+ - com/sun/star/io/XInputStream.hpp
+ - com/sun/star/io/XSeekable.hpp
+ include/comphelper/servicedecl.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/uno/XComponentContext.hpp
+ include/comphelper/servicehelper.hxx:
+ # Needed for macro
+ - rtl/instance.hxx
+ include/comphelper/stl_types.hxx:
+ # Needed for std::equal
+ - algorithm
+ include/comphelper/unique_disposing_ptr.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XServiceInfo.hpp
+ include/comphelper/uno3.hxx:
+ # Needed for macro
+ - comphelper/sequence.hxx
+ include/comphelper/weakeventlistener.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XEventListener.hpp
+ - com/sun/star/lang/XComponent.hpp
+ include/basegfx/numeric/ftools.hxx:
+ # MSVC does not compile when this is removed
+ - math.h
+ - cmath
+ include/basegfx/utils/unopolypolygon.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/rendering/XBezierPolyPolygon2D.hpp
+ - com/sun/star/rendering/XLinePolyPolygon2D.hpp
+ include/o3tl/deleter.hxx:
+ # Needed for __COVERITY__
+ - com/sun/star/uno/Exception.hpp
+ - sal/log.hxx
+ include/o3tl/lru_map.hxx:
+ # Needed for std::min
+ - algorithm
+ include/o3tl/make_shared.hxx:
+ # Needed for __COVERITY__
+ - o3tl/deleter.hxx
+ include/o3tl/safeint.hxx:
+ # Needed for std::min
+ - algorithm
+ include/sot/exchange.hxx:
+ # Used in a macro #define
+ - com/sun/star/datatransfer/dnd/DNDConstants.hpp
+ include/tools/color.hxx:
+ # OSL_BIGENDIAN is being checked
+ - osl/endian.h
+ include/tools/debug.hxx:
+ # Used behind #ifndef
+ - tools/toolsdllapi.h
+ include/tools/diagnose_ex.h:
+ # Needed for macros
+ - com/sun/star/lang/IllegalArgumentException.hpp
+ - com/sun/star/uno/RuntimeException.hpp
+ - rtl/ustring.hxx
+ include/tools/fldunit.hxx:
+ # Needed for enum type
+ - sal/types.h
+ include/tools/long.hxx:
+ # Needed on _WIN64
+ - sal/types.h
+ include/tools/svlibrary.h:
+ # Used behind #ifndef
+ - osl/module.h
+ include/tools/simdsupport.hxx:
+ # Needed for CPU intrinsics detection to work
+ - emmintrin.h
+ include/unotools/accessiblestatesethelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleStateSet.hpp
+ include/unotools/accessiblerelationsethelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleRelationSet.hpp
+ include/unotools/eventcfg.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XNameReplace.hpp
+ - com/sun/star/document/XEventsSupplier.hpp
+ include/unotools/fontcfg.hxx:
+ # Needed for a sal_uLong enum
+ - tools/solar.h
+ include/unotools/progresshandlerwrap.hxx:
+ # base class has to be a complete type
+ - com/sun/star/ucb/XProgressHandler.hpp
+ include/unotools/streamwrap.hxx:
+ # base class has to be a complete type
+ - com/sun/star/io/XOutputStream.hpp
+ - com/sun/star/io/XStream.hpp
+ - com/sun/star/io/XTruncate.hpp
+ include/sax/fshelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/xml/sax/XFastAttributeList.hpp
+ include/sax/fastattribs.hxx:
+ # base class has to be a complete type
+ - com/sun/star/xml/sax/XFastAttributeList.hpp
+ include/sax/fastparser.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XInitialization.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/xml/sax/XFastParser.hpp
+ include/svl/numuno.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XUnoTunnel.hpp
+ - com/sun/star/util/XNumberFormatsSupplier.hpp
+ include/svl/urihelper.hxx:
+ # base class has to be a complete type
+ - tools/link.hxx
+ include/svl/style.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XUnoTunnel.hpp
+ - com/sun/star/style/XStyle.hpp
+ include/vcl/FilterConfigItem.hxx:
+ # Needed on Windows with --disable-pch
+ - com/sun/star/beans/PropertyValue.hpp
+ include/vcl/builderfactory.hxx:
+ # Needed for macro #define
+ - vcl/builder.hxx
+ - vcl/vclptr.hxx
+ include/vcl/decoview.hxx:
+ # Full definition needed for VclPtr
+ - vcl/outdev.hxx
+ include/vcl/devicecoordinate.hxx:
+ # Needed for #if configure switch
+ - basegfx/point/b2ipoint.hxx
+ include/vcl/event.hxx:
+ # Needed for enum type
+ - vcl/window.hxx
+ include/vcl/imap.hxx:
+ # Needed for implicit dtor
+ - vcl/imapobj.hxx
+ include/vcl/keycodes.hxx:
+ # Needed for macros
+ - com/sun/star/awt/Key.hpp
+ - com/sun/star/awt/KeyGroup.hpp
+ include/vcl/mtfxmldump.hxx:
+ # Full definition needed for o3tl::enumarray
+ - vcl/metaactiontypes.hxx
+ include/vcl/outdevstate.hxx:
+ # Full definition needed for boost::optional
+ - vcl/mapmod.hxx
+ - tools/color.hxx
+ - tools/gen.hxx
+ include/vcl/transfer.hxx:
+ # base class has to be a complete type
+ - com/sun/star/datatransfer/XTransferable2.hpp
+ - com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp
+ - com/sun/star/datatransfer/dnd/XDragSourceListener.hpp
+ - com/sun/star/lang/XUnoTunnel.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/frame/XTerminateListener.hpp
+ - com/sun/star/datatransfer/dnd/XDragGestureListener.hpp
+ - com/sun/star/datatransfer/dnd/XDropTargetListener.hpp
+ include/vcl/weld.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleRelationSet.hpp
+ - com/sun/star/accessibility/XAccessible.hpp
+ include/toolkit/awt/vclxaccessiblecomponent.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XServiceInfo.hpp
+ include/toolkit/awt/vclxwindow.hxx:
+ # base class has to be a complete type
+ - toolkit/awt/vclxdevice.hxx
+ - com/sun/star/awt/XWindow2.hpp
+ - com/sun/star/awt/XVclWindowPeer.hpp
+ - com/sun/star/awt/XLayoutConstrains.hpp
+ - com/sun/star/awt/XView.hpp
+ - com/sun/star/beans/XPropertySetInfo.hpp
+ - com/sun/star/accessibility/XAccessible.hpp
+ - com/sun/star/awt/XDockableWindow.hpp
+ - com/sun/star/awt/XStyleSettingsSupplier.hpp
+ include/toolkit/awt/vclxwindows.hxx:
+ # base class has to be a complete type
+ - com/sun/star/awt/XListBox.hpp
+ - com/sun/star/awt/XToggleButton.hpp
+ - com/sun/star/awt/XComboBox.hpp
+ - com/sun/star/awt/XItemListListener.hpp
+ include/toolkit/controls/unocontrol.hxx:
+ # base class has to be a complete type
+ - com/sun/star/awt/XControl.hpp
+ - com/sun/star/awt/XWindow2.hpp
+ - com/sun/star/awt/XView.hpp
+ - com/sun/star/beans/XPropertiesChangeListener.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/awt/XUnitConversion.hpp
+ - com/sun/star/awt/XStyleSettingsSupplier.hpp
+ - com/sun/star/accessibility/XAccessible.hpp
+ - com/sun/star/util/XModeChangeBroadcaster.hpp
+ include/toolkit/controls/unocontrolmodel.hxx:
+ # base class has to be a complete type
+ - com/sun/star/awt/XControlModel.hpp
+ - com/sun/star/lang/XComponent.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/beans/XPropertyState.hpp
+ - com/sun/star/io/XPersistObject.hpp
+ - com/sun/star/lang/XUnoTunnel.hpp
+ - com/sun/star/util/XCloneable.hpp
+ include/toolkit/controls/unocontrols.hxx:
+ # base class has to be a complete type
+ - com/sun/star/awt/XTextComponent.hpp
+ - com/sun/star/awt/XTextListener.hpp
+ - com/sun/star/awt/XTextLayoutConstrains.hpp
+ - com/sun/star/awt/XButton.hpp
+ - com/sun/star/awt/XToggleButton.hpp
+ - com/sun/star/awt/XRadioButton.hpp
+ - com/sun/star/awt/XCheckBox.hpp
+ - com/sun/star/awt/XListBox.hpp
+ - com/sun/star/awt/XItemList.hpp
+ include/toolkit/helper/macros.hxx:
+ # Needed for macros
+ - comphelper/servicehelper.hxx
+ - tools/diagnose_ex.h
+ include/xmloff/attrlist.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XUnoTunnel.hpp
+ - com/sun/star/util/XCloneable.hpp
+ - com/sun/star/xml/sax/XAttributeList.hpp
+ include/xmloff/unointerfacetouniqueidentifiermapper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/uno/XInterface.hpp
+ include/xmloff/unoatrcn.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XNameContainer.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/lang/XUnoTunnel.hpp
+ include/xmloff/xmlictxt.hxx:
+ # base class has to be a complete type
+ - com/sun/star/xml/sax/XFastContextHandler.hpp
+ include/xmloff/xmlexp.hxx:
+ # base class has to be a complete type
+ - com/sun/star/document/XFilter.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/document/XExporter.hpp
+ - com/sun/star/lang/XInitialization.hpp
+ - com/sun/star/container/XNamed.hpp
+ - com/sun/star/lang/XUnoTunnel.hpp
+ include/xmloff/xmlmetae.hxx:
+ # base class has to be a complete type
+ - com/sun/star/xml/sax/XDocumentHandler.hpp
+ include/xmloff/xmlimp.hxx:
+ # base class has to be a complete type
+ - com/sun/star/document/XFilter.hpp
+ - com/sun/star/document/XImporter.hpp
+ - com/sun/star/lang/XInitialization.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/lang/XUnoTunnel.hpp
+ - com/sun/star/xml/sax/XExtendedDocumentHandler.hpp
+ - com/sun/star/xml/sax/XFastDocumentHandler.hpp
+ - com/sun/star/xml/sax/XFastParser.hpp
+ include/svtools/asynclink.hxx:
+ # unique_ptr needs complete type
+ - osl/mutex.hxx
+ - vcl/idle.hxx
+ include/svtools/cliplistener.hxx:
+ # base class has to be a complete type
+ - com/sun/star/datatransfer/clipboard/XClipboardListener.hpp
+ include/svtools/dialogclosedlistener.hxx:
+ # base class has to be a complete type
+ - com/sun/star/ui/dialogs/XDialogClosedListener.hpp
+ include/svtools/genericunodialog.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XInitialization.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/ui/dialogs/XExecutableDialog.hpp
+ include/svtools/openfiledroptargetlistener.hxx:
+ # base class has to be a complete type
+ - com/sun/star/datatransfer/dnd/XDropTargetListener.hpp
+ include/svtools/popupmenucontrollerbase.hxx:
+ # base class has to be a complete type
+ - com/sun/star/frame/XDispatch.hpp
+ - com/sun/star/frame/XDispatchProvider.hpp
+ - com/sun/star/frame/XPopupMenuController.hpp
+ - com/sun/star/frame/XStatusListener.hpp
+ - com/sun/star/lang/XInitialization.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ include/svtools/popupwindowcontroller.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XServiceInfo.hpp
+ - svtools/toolboxcontroller.hxx
+ include/svtools/sfxecode.hxx:
+ # Needed for macro defines
+ - class ErrCode
+ include/svtools/statusbarcontroller.hxx:
+ # Don't propose hxx -> h change in URE libs
+ - cppuhelper/interfacecontainer.hxx
+ include/svtools/toolboxcontroller.hxx:
+ # base class has to be a complete type
+ - com/sun/star/frame/XStatusListener.hpp
+ - com/sun/star/frame/XToolbarController.hpp
+ - com/sun/star/util/XUpdatable.hpp
+ - com/sun/star/lang/XInitialization.hpp
+ # Complete type is needed for DispatchInfo struct
+ - com/sun/star/beans/PropertyValue.hpp
+ # Don't propose hxx -> h change in URE libs
+ - cppuhelper/interfacecontainer.hxx
+ include/svtools/unoevent.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XNameReplace.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ include/framework/dispatchhelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/frame/XDispatchHelper.hpp
+ - com/sun/star/frame/XDispatchResultListener.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ include/framework/titlehelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/frame/XTitle.hpp
+ - com/sun/star/frame/XTitleChangeBroadcaster.hpp
+ - com/sun/star/frame/XFrameActionListener.hpp
+ - com/sun/star/document/XDocumentEventListener.hpp
+ # Don't propose hxx -> h change in URE libs
+ - cppuhelper/interfacecontainer.hxx
+ include/linguistic/hyphdta.hxx:
+ # base class has to be a complete type
+ - com/sun/star/linguistic2/XHyphenatedWord.hpp
+ - com/sun/star/linguistic2/XPossibleHyphens.hpp
+ include/linguistic/lngprophelp.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertyChangeListener.hpp
+ - com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp
+ include/linguistic/spelldta.hxx:
+ # base class has to be a complete type
+ - com/sun/star/linguistic2/XSetSpellAlternatives.hpp
+ - com/sun/star/linguistic2/XSpellAlternatives.hpp
+ include/linguistic/misc.hxx:
+ # base class has to be a complete type
+ - com/sun/star/frame/XTerminateListener.hpp
+ include/cppcanvas/renderer.hxx:
+ # Used in boost::optional type
+ - basegfx/matrix/b2dhommatrix.hxx
+ include/basic/modsizeexceeded.hxx:
+ # base class has to be a complete type
+ - com/sun/star/task/XInteractionRequest.hpp
+ include/basic/sberrors.hxx:
+ # Needed for macro defines
+ - vcl/errcode.hxx
+ include/connectivity/BlobHelper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/sdbc/XBlob.hpp
+ include/connectivity/CommonTools.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertySet.hpp
+ - com/sun/star/sdbcx/XColumnsSupplier.hpp
+ # Needed for macro defines
+ - cppuhelper/supportsservice.hxx
+ # Needed for HAVE_FEATURE_JAVA
+ - rtl/ref.hxx
+ include/connectivity/ConnectionWrapper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XUnoTunnel.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ include/connectivity/conncleanup.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertyChangeListener.hpp
+ - com/sun/star/sdbc/XRowSetListener.hpp
+ include/connectivity/parameters.hxx:
+ # base class has to be a complete type
+ - com/sun/star/sdb/XSingleSelectQueryComposer.hpp
+ include/connectivity/paramwrapper.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XEnumerationAccess.hpp
+ - com/sun/star/container/XIndexAccess.hpp
+ include/connectivity/sdbcx/VCollection.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XNameAccess.hpp
+ - com/sun/star/container/XIndexAccess.hpp
+ - com/sun/star/container/XEnumerationAccess.hpp
+ - com/sun/star/container/XContainer.hpp
+ - com/sun/star/sdbc/XColumnLocate.hpp
+ - com/sun/star/util/XRefreshable.hpp
+ - com/sun/star/sdbcx/XDataDescriptorFactory.hpp
+ - com/sun/star/sdbcx/XAppend.hpp
+ - com/sun/star/sdbcx/XDrop.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/beans/XPropertySet.hpp
+ include/connectivity/sdbcx/VCatalog.hxx:
+ # base class has to be a complete type
+ - com/sun/star/sdbcx/XTablesSupplier.hpp
+ - com/sun/star/sdbcx/XViewsSupplier.hpp
+ - com/sun/star/sdbcx/XUsersSupplier.hpp
+ - com/sun/star/sdbcx/XGroupsSupplier.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ include/connectivity/sdbcx/VColumn.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XNamed.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/sdbcx/XDataDescriptorFactory.hpp
+ include/connectivity/sdbcx/VGroup.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XNamed.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/sdbcx/XAuthorizable.hpp
+ - com/sun/star/sdbcx/XUsersSupplier.hpp
+ include/connectivity/sdbcx/VIndex.hxx:
+ # base class has to be a complete type
+ - com/sun/star/sdbcx/XDataDescriptorFactory.hpp
+ include/connectivity/sdbcx/VKey.hxx:
+ # base class has to be a complete type
+ - com/sun/star/sdbcx/XDataDescriptorFactory.hpp
+ include/connectivity/sdbcx/VTypeDef.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XNamed.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/sdbcx/XColumnsSupplier.hpp
+ include/connectivity/sdbcx/VTable.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XNamed.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/sdbcx/XAlterTable.hpp
+ - com/sun/star/sdbcx/XColumnsSupplier.hpp
+ - com/sun/star/sdbcx/XDataDescriptorFactory.hpp
+ - com/sun/star/sdbcx/XIndexesSupplier.hpp
+ - com/sun/star/sdbcx/XKeysSupplier.hpp
+ - com/sun/star/sdbcx/XRename.hpp
+ include/connectivity/sdbcx/VUser.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XNamed.hpp
+ - com/sun/star/sdbcx/XGroupsSupplier.hpp
+ - com/sun/star/sdbcx/XUser.hpp
+ include/connectivity/sdbcx/VView.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XNamed.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/sdbcx/XDataDescriptorFactory.hpp
+ include/drawinglayer/primitive2d/baseprimitive2d.hxx:
+ # base class has to be a complete type
+ - com/sun/star/graphic/XPrimitive2D.hpp
+ - com/sun/star/util/XAccounting.hpp
+ include/drawinglayer/primitive3d/baseprimitive3d.hxx:
+ # base class has to be a complete type
+ - com/sun/star/graphic/XPrimitive3D.hpp
+ include/sfx2/charwin.hxx:
+ # Needed for implicit dtor
+ - vcl/virdev.hxx
+ include/sfx2/dinfdlg.hxx:
+ # Needed for implicit dtor
+ - com/sun/star/document/CmisProperty.hpp
+ include/sfx2/docfile.hxx:
+ # Full type needed for template
+ - tools/link.hxx
+ include/sfx2/docstoragemodifylistener.hxx:
+ # base class has to be a complete type
+ - com/sun/star/util/XModifyListener.hpp
+ include/sfx2/DocumentMetadataAccess.hxx:
+ # base class has to be a complete type
+ - com/sun/star/rdf/XDocumentMetadataAccess.hpp
+ include/sfx2/mieclip.hxx:
+ # Needed for implicit dtor
+ - tools/stream.hxx
+ include/sfx2/sfxbasecontroller.hxx:
+ # base class has to be a complete type
+ - com/sun/star/frame/XController2.hpp
+ - com/sun/star/frame/XControllerBorder.hpp
+ - com/sun/star/frame/XDispatchProvider.hpp
+ - com/sun/star/task/XStatusIndicatorSupplier.hpp
+ - com/sun/star/ui/XContextMenuInterception.hpp
+ - com/sun/star/awt/XUserInputInterception.hpp
+ - com/sun/star/frame/XDispatchInformationProvider.hpp
+ - com/sun/star/frame/XTitle.hpp
+ - com/sun/star/frame/XTitleChangeBroadcaster.hpp
+ - com/sun/star/lang/XInitialization.hpp
+ include/sfx2/sfxbasemodel.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XChild.hpp
+ - com/sun/star/document/XDocumentPropertiesSupplier.hpp
+ - com/sun/star/document/XCmisDocument.hpp
+ - com/sun/star/rdf/XDocumentMetadataAccess.hpp
+ - com/sun/star/document/XDocumentRecovery.hpp
+ - com/sun/star/document/XUndoManagerSupplier.hpp
+ - com/sun/star/document/XEventBroadcaster.hpp
+ - com/sun/star/document/XDocumentEventBroadcaster.hpp
+ - com/sun/star/lang/XEventListener.hpp
+ - com/sun/star/document/XEventsSupplier.hpp
+ - com/sun/star/document/XEmbeddedScripts.hpp
+ - com/sun/star/document/XScriptInvocationContext.hpp
+ - com/sun/star/frame/XModel2.hpp
+ - com/sun/star/util/XModifiable2.hpp
+ - com/sun/star/view/XPrintable.hpp
+ - com/sun/star/view/XPrintJobBroadcaster.hpp
+ - com/sun/star/frame/XStorable2.hpp
+ - com/sun/star/frame/XLoadable.hpp
+ - com/sun/star/script/XStarBasicAccess.hpp
+ - com/sun/star/document/XViewDataSupplier.hpp
+ - com/sun/star/util/XCloseable.hpp
+ - com/sun/star/datatransfer/XTransferable.hpp
+ - com/sun/star/document/XDocumentSubStorageSupplier.hpp
+ - com/sun/star/document/XStorageBasedDocument.hpp
+ - com/sun/star/script/provider/XScriptProviderSupplier.hpp
+ - com/sun/star/ui/XUIConfigurationManagerSupplier.hpp
+ - com/sun/star/embed/XVisualObject.hpp
+ - com/sun/star/lang/XUnoTunnel.hpp
+ - com/sun/star/frame/XModule.hpp
+ - com/sun/star/frame/XTitle.hpp
+ - com/sun/star/frame/XTitleChangeBroadcaster.hpp
+ - com/sun/star/frame/XUntitledNumbers.hpp
+ include/sfx2/sfxsids.hrc:
+ # Needed for sfxitems.sdi to build
+ - svl/memberid.h
+ # Needed for TypedWhichId defines
+ - svl/typedwhich.hxx
+ - class SvxZoomItem
+ - class SfxUInt16Item
+ - class SvxHyperlinkItem
+ - class SfxDocumentInfoItem
+ - class SvxSearchItem
+ include/sfx2/shell.hxx:
+ # Used in macro define
+ - class SfxModule
+ include/sfx2/sfxstatuslistener.hxx:
+ # base class has to be a complete type
+ - com/sun/star/frame/XStatusListener.hpp
+ - com/sun/star/lang/XComponent.hpp
+ include/sfx2/sidebar/SidebarController.hxx:
+ # base class has to be a complete type
+ - com/sun/star/ui/XContextChangeEventListener.hpp
+ - com/sun/star/beans/XPropertyChangeListener.hpp
+ - com/sun/star/ui/XSidebar.hpp
+ - com/sun/star/frame/XStatusListener.hpp
+ - com/sun/star/frame/XFrameActionListener.hpp
+ include/sfx2/sidebar/SidebarPanelBase.hxx:
+ # base class has to be a complete type
+ - com/sun/star/ui/XContextChangeEventListener.hpp
+ - com/sun/star/ui/XUIElement.hpp
+ - com/sun/star/ui/XToolPanel.hpp
+ - com/sun/star/ui/XSidebarPanel.hpp
+ - com/sun/star/ui/XUpdateModel.hpp
+ include/sfx2/sidebar/Theme.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertySet.hpp
+ include/sfx2/sidebar/UnoSidebar.hxx:
+ # base class has to be a complete type
+ - com/sun/star/ui/XSidebarProvider.hpp
+ include/sfx2/viewsh.hxx:
+ # Needed for macro
+ - class SfxViewFactory
+ include/editeng/AccessibleContextBase.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleContext.hpp
+ - com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp
+ - com/sun/star/accessibility/XAccessible.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ include/editeng/AccessibleEditableTextPara.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleComponent.hpp
+ - com/sun/star/accessibility/XAccessibleContext.hpp
+ - com/sun/star/accessibility/XAccessibleEditableText.hpp
+ - com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp
+ - com/sun/star/accessibility/XAccessible.hpp
+ - com/sun/star/accessibility/XAccessibleHypertext.hpp
+ - com/sun/star/accessibility/XAccessibleMultiLineText.hpp
+ - com/sun/star/accessibility/XAccessibleTextAttributes.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ include/editeng/AccessibleStaticTextBase.hxx:
+ # base class has to be a complete type
+ - com/sun/star/accessibility/XAccessibleText.hpp
+ - com/sun/star/accessibility/XAccessibleTextAttributes.hpp
+ include/editeng/editerr.hxx:
+ # Needed for macro defines
+ - vcl/errcode.hxx
+ include/editeng/eeitem.hxx:
+ # Needed for macro defines
+ - svl/typedwhich.hxx
+ - class SfxBoolItem
+ - class SfxGrabBagItem
+ - class SfxInt16Item
+ - class SvxAdjustItem
+ - class SvxAutoKernItem
+ - class SvxCaseMapItem
+ - class SvxCharReliefItem
+ - class SvxCharScaleWidthItem
+ - class SvxColorItem
+ - class SvxContourItem
+ - class SvxCrossedOutItem
+ - class SvxEmphasisMarkItem
+ - class SvxEscapementItem
+ - class SvxFontHeightItem
+ - class SvxFontItem
+ - class SvxForbiddenRuleItem
+ - class SvxFrameDirectionItem
+ - class SvxHangingPunctuationItem
+ - class SvxKerningItem
+ - class SvxLanguageItem
+ - class SvxLineSpacingItem
+ - class SvxLRSpaceItem
+ - class SvxOverlineItem
+ - class SvxPostureItem
+ - class SvXMLAttrContainerItem
+ - class SvxScriptSpaceItem
+ - class SvxShadowedItem
+ - class SvxTabStopItem
+ - class SvxULSpaceItem
+ - class SvxUnderlineItem
+ - class SvxWeightItem
+ - class SvxWordLineModeItem
+ - class SvxBulletItem
+ - class SvxNumBulletItem
+ include/editeng/UnoForbiddenCharsTable.hxx:
+ # base class has to be a complete type
+ - com/sun/star/i18n/XForbiddenCharacters.hpp
+ - com/sun/star/linguistic2/XSupportedLocales.hpp
+ include/editeng/unonrule.hxx:
+ # base class has to be a complete type
+ - com/sun/star/container/XIndexReplace.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/lang/XUnoTunnel.hpp
+ - com/sun/star/ucb/XAnyCompare.hpp
+ - com/sun/star/util/XCloneable.hpp
+ include/editeng/unotext.hxx:
+ # Needed for macro defines
+ - com/sun/star/container/XIndexReplace.hpp
+ - com/sun/star/awt/FontSlant.hpp
+ - com/sun/star/awt/FontDescriptor.hpp
+ - com/sun/star/style/LineSpacing.hpp
+ - com/sun/star/style/TabStop.hpp
+ - editeng/eeitem.hxx
+ include/formula/FormulaOpCodeMapperObj.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/sheet/XFormulaOpCodeMapper.hpp
+ include/formula/paramclass.hxx:
+ # Needed for enum type
+ - sal/types.h
+ include/formula/opcode.hxx:
+ # Needed for enum type
+ - sal/types.h
+ include/formula/tokenarray.hxx:
+ # Needed to avoid linking errors on WIN
+ - formula/ExternalReferenceHelper.hxx
+ include/svx/AccessibleControlShape.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertyChangeListener.hpp
+ - com/sun/star/container/XContainerListener.hpp
+ - com/sun/star/util/XModeChangeListener.hpp
+ include/svx/dbaexchange.hxx:
+ # Needed for implicit dtor
+ - com/sun/star/beans/PropertyValue.hpp
+ include/svx/EnhancedCustomShape2d.hxx:
+ # Needed for implicit dtor
+ - com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp
+ - com/sun/star/drawing/EnhancedCustomShapeSegment.hpp
+ - com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp
+ include/svx/fmgridif.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertyChangeListener.hpp
+ - com/sun/star/container/XContainer.hpp
+ - com/sun/star/container/XEnumerationAccess.hpp
+ - com/sun/star/form/XBoundComponent.hpp
+ - com/sun/star/form/XGridControl.hpp
+ - com/sun/star/form/XGridPeer.hpp
+ - com/sun/star/form/XLoadListener.hpp
+ - com/sun/star/form/XResetListener.hpp
+ - com/sun/star/frame/XDispatchProvider.hpp
+ - com/sun/star/frame/XDispatchProviderInterception.hpp
+ - com/sun/star/frame/XStatusListener.hpp
+ - com/sun/star/sdbc/XRowSetListener.hpp
+ - com/sun/star/sdb/XRowSetSupplier.hpp
+ - com/sun/star/util/XModeSelector.hpp
+ - com/sun/star/util/XModifyBroadcaster.hpp
+ - com/sun/star/view/XSelectionSupplier.hpp
+ - toolkit/awt/vclxwindow.hxx
+ include/svx/fmsrcimp.hxx:
+ # base class has to be a complete type
+ - com/sun/star/beans/XPropertyChangeListener.hpp
+ include/svx/fmtools.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XEventListener.hpp
+ include/svx/ifaceids.hxx:
+ # Keep for macro define
+ - sfx2/shell.hxx
+ include/svx/measctrl.hxx:
+ # Needed for template class
+ - svx/svdobj.hxx
+ include/svx/svddef.hxx:
+ # Used in macro definition
+ - svl/typedwhich.hxx
+ include/svx/svxerr.hxx:
+ # Used in macro definition
+ - vcl/errcode.hxx
+ include/svx/svxids.hrc:
+ # Used in macro definition
+ - svl/typedwhich.hxx
+ include/svx/unopage.hxx:
+ # Don't propose hxx -> h change in URE libs
+ - cppuhelper/interfacecontainer.hxx
+ include/svx/unoshprp.hxx:
+ # Needed for macro defines
+ - com/sun/star/drawing/PointSequence.hpp
+ - com/sun/star/drawing/PointSequenceSequence.hpp
+ - com/sun/star/uno/Sequence.hxx
+ - com/sun/star/drawing/RectanglePoint.hpp
+ - com/sun/star/awt/XBitmap.hpp
+ - com/sun/star/awt/Gradient.hpp
+ - com/sun/star/drawing/Hatch.hpp
+ - com/sun/star/drawing/FillStyle.hpp
+ - com/sun/star/drawing/LineCap.hpp
+ - com/sun/star/drawing/LineDash.hpp
+ - com/sun/star/drawing/LineJoint.hpp
+ - com/sun/star/drawing/LineStyle.hpp
+ - com/sun/star/beans/PropertyAttribute.hpp
+ - com/sun/star/awt/Rectangle.hpp
+ - com/sun/star/drawing/TextAnimationDirection.hpp
+ - com/sun/star/drawing/TextAnimationKind.hpp
+ - com/sun/star/drawing/TextFitToSizeType.hpp
+ - com/sun/star/drawing/TextVerticalAdjust.hpp
+ - com/sun/star/drawing/TextHorizontalAdjust.hpp
+ - com/sun/star/drawing/ConnectorType.hpp
+ - com/sun/star/drawing/XShape.hpp
+ - com/sun/star/drawing/MeasureKind.hpp
+ - com/sun/star/drawing/MeasureTextHorzPos.hpp
+ - com/sun/star/drawing/MeasureTextVertPos.hpp
+ - com/sun/star/drawing/HomogenMatrix3.hpp
+ - com/sun/star/drawing/CircleKind.hpp
+ - com/sun/star/drawing/PolygonKind.hpp
+ - com/sun/star/drawing/PolyPolygonBezierCoords.hpp
+ - com/sun/star/drawing/ColorMode.hpp
+ - com/sun/star/drawing/HomogenMatrix.hpp
+ - com/sun/star/drawing/Direction3D.hpp
+ - com/sun/star/drawing/ProjectionMode.hpp
+ - com/sun/star/drawing/ShadeMode.hpp
+ - com/sun/star/drawing/Position3D.hpp
+ - com/sun/star/drawing/NormalsKind.hpp
+ - com/sun/star/drawing/TextureKind.hpp
+ - com/sun/star/drawing/TextureMode.hpp
+ - com/sun/star/drawing/TextureProjectionMode.hpp
+ - com/sun/star/drawing/PolyPolygonShape3D.hpp
+ - com/sun/star/text/GraphicCrop.hpp
+ - com/sun/star/drawing/BitmapMode.hpp
+ - com/sun/star/drawing/CameraGeometry.hpp
+ - com/sun/star/text/WritingMode.hpp
+ - com/sun/star/graphic/XGraphic.hpp
+ - com/sun/star/drawing/QRCode.hpp
+ - com/sun/star/text/XTextColumns.hpp
+ - com/sun/star/drawing/BarCode.hpp
+ - editeng/unoprnms.hxx
+ - svx/svddef.hxx
+ include/svx/xdef.hxx:
+ # Needed for macro defines
+ - svl/typedwhich.hxx
+ include/svx/svdtext.hxx:
+ # TODO too many replacements would be needed
+ - tools/weakbase.hxx
+ include/oox/helper/helper.hxx:
+ # OSL_BIGENDIAN is being checked
+ - osl/endian.h
+ include/codemaker/global.hxx:
+ # Don't propose hxx -> h change in URE libs
+ - osl/file.hxx
+ include/comphelper/crashzone.hxx:
+ # Needed for sig_atomic_t
+ - csignal
+ include/comphelper/parallelsort.hxx:
+ # Needed when PARALLELSORT_ENABLEPZ is defined
+ - chrono
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
new file mode 100644
index 000000000..aff71dcc1
--- /dev/null
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -0,0 +1,491 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
+#define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
+
+#include <stddef.h>
+
+// the unstable API needs C99's bool
+// TODO remove the C99 types from the API before making stable
+#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+# ifndef _WIN32
+# include <stdbool.h>
+# endif
+# include <stdint.h>
+#endif
+
+#include <LibreOfficeKit/LibreOfficeKitTypes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct _LibreOfficeKit LibreOfficeKit;
+typedef struct _LibreOfficeKitClass LibreOfficeKitClass;
+
+typedef struct _LibreOfficeKitDocument LibreOfficeKitDocument;
+typedef struct _LibreOfficeKitDocumentClass LibreOfficeKitDocumentClass;
+
+// Do we have an extended member in this struct ?
+#define LIBREOFFICEKIT_HAS_MEMBER(strct,member,nSize) \
+ (offsetof(strct, member) < (nSize))
+
+#define LIBREOFFICEKIT_HAS(pKit,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitClass,member,(pKit)->pClass->nSize)
+
+struct _LibreOfficeKit
+{
+ LibreOfficeKitClass* pClass;
+};
+
+struct _LibreOfficeKitClass
+{
+ size_t nSize;
+
+ void (*destroy) (LibreOfficeKit* pThis);
+
+ LibreOfficeKitDocument* (*documentLoad) (LibreOfficeKit* pThis,
+ const char* pURL);
+
+ char* (*getError) (LibreOfficeKit* pThis);
+
+ /// @since LibreOffice 5.0
+ LibreOfficeKitDocument* (*documentLoadWithOptions) (LibreOfficeKit* pThis,
+ const char* pURL,
+ const char* pOptions);
+ /// @since LibreOffice 5.2
+ void (*freeError) (char* pFree);
+
+ /// @since LibreOffice 6.0
+ void (*registerCallback) (LibreOfficeKit* pThis,
+ LibreOfficeKitCallback pCallback,
+ void* pData);
+
+ /** @see lok::Office::getFilterTypes().
+ @since LibreOffice 6.0
+ */
+ char* (*getFilterTypes) (LibreOfficeKit* pThis);
+
+ /** @see lok::Office::setOptionalFeatures().
+ @since LibreOffice 6.0
+ */
+ void (*setOptionalFeatures)(LibreOfficeKit* pThis, unsigned long long features);
+
+ /** @see lok::Office::setDocumentPassword().
+ @since LibreOffice 6.0
+ */
+ void (*setDocumentPassword) (LibreOfficeKit* pThis,
+ char const* pURL,
+ char const* pPassword);
+
+ /** @see lok::Office::getVersionInfo().
+ @since LibreOffice 6.0
+ */
+ char* (*getVersionInfo) (LibreOfficeKit* pThis);
+
+ /** @see lok::Office::runMacro().
+ @since LibreOffice 6.0
+ */
+ int (*runMacro) (LibreOfficeKit *pThis, const char* pURL);
+
+ /** @see lok::Office::signDocument().
+ @since LibreOffice 6.2
+ */
+ bool (*signDocument) (LibreOfficeKit* pThis,
+ const char* pUrl,
+ const unsigned char* pCertificateBinary,
+ const int nCertificateBinarySize,
+ const unsigned char* pPrivateKeyBinary,
+ const int nPrivateKeyBinarySize);
+
+ /// @see lok::Office::runLoop()
+ void (*runLoop) (LibreOfficeKit* pThis,
+ LibreOfficeKitPollCallback pPollCallback,
+ LibreOfficeKitWakeCallback pWakeCallback,
+ void* pData);
+
+ /// @see lok::Office::sendDialogEvent
+ void (*sendDialogEvent) (LibreOfficeKit* pThis,
+ unsigned long long int nLOKWindowId,
+ const char* pArguments);
+
+ /// @see lok::Office::setOption
+ void (*setOption) (LibreOfficeKit* pThis, const char* pOption, const char* pValue);
+};
+
+#define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
+
+struct _LibreOfficeKitDocument
+{
+ LibreOfficeKitDocumentClass* pClass;
+};
+
+struct _LibreOfficeKitDocumentClass
+{
+ size_t nSize;
+
+ void (*destroy) (LibreOfficeKitDocument* pThis);
+
+ int (*saveAs) (LibreOfficeKitDocument* pThis,
+ const char* pUrl,
+ const char* pFormat,
+ const char* pFilterOptions);
+
+ /** @see lok::Document::getDocumentType().
+ @since LibreOffice 6.0
+ */
+ int (*getDocumentType) (LibreOfficeKitDocument* pThis);
+
+#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+ /// @see lok::Document::getParts().
+ int (*getParts) (LibreOfficeKitDocument* pThis);
+
+ /// @see lok::Document::getPartPageRectangles().
+ char* (*getPartPageRectangles) (LibreOfficeKitDocument* pThis);
+
+ /// @see lok::Document::getPart().
+ int (*getPart) (LibreOfficeKitDocument* pThis);
+
+ /// @see lok::Document::setPart().
+ void (*setPart) (LibreOfficeKitDocument* pThis,
+ int nPart);
+
+ /// @see lok::Document::getPartName().
+ char* (*getPartName) (LibreOfficeKitDocument* pThis,
+ int nPart);
+
+ /// @see lok::Document::setPartMode().
+ void (*setPartMode) (LibreOfficeKitDocument* pThis,
+ int nMode);
+
+ /// @see lok::Document::paintTile().
+ void (*paintTile) (LibreOfficeKitDocument* pThis,
+ unsigned char* pBuffer,
+ const int nCanvasWidth,
+ const int nCanvasHeight,
+ const int nTilePosX,
+ const int nTilePosY,
+ const int nTileWidth,
+ const int nTileHeight);
+
+ /// @see lok::Document::getTileMode().
+ int (*getTileMode) (LibreOfficeKitDocument* pThis);
+
+ /// @see lok::Document::getDocumentSize().
+ void (*getDocumentSize) (LibreOfficeKitDocument* pThis,
+ long* pWidth,
+ long* pHeight);
+
+ /// @see lok::Document::initializeForRendering().
+ void (*initializeForRendering) (LibreOfficeKitDocument* pThis,
+ const char* pArguments);
+
+ /// @see lok::Document::registerCallback().
+ void (*registerCallback) (LibreOfficeKitDocument* pThis,
+ LibreOfficeKitCallback pCallback,
+ void* pData);
+
+ /// @see lok::Document::postKeyEvent
+ void (*postKeyEvent) (LibreOfficeKitDocument* pThis,
+ int nType,
+ int nCharCode,
+ int nKeyCode);
+
+ /// @see lok::Document::postMouseEvent
+ void (*postMouseEvent) (LibreOfficeKitDocument* pThis,
+ int nType,
+ int nX,
+ int nY,
+ int nCount,
+ int nButtons,
+ int nModifier);
+
+ /// @see lok::Document::postUnoCommand
+ void (*postUnoCommand) (LibreOfficeKitDocument* pThis,
+ const char* pCommand,
+ const char* pArguments,
+ bool bNotifyWhenFinished);
+
+ /// @see lok::Document::setTextSelection
+ void (*setTextSelection) (LibreOfficeKitDocument* pThis,
+ int nType,
+ int nX,
+ int nY);
+
+ /// @see lok::Document::getTextSelection
+ char* (*getTextSelection) (LibreOfficeKitDocument* pThis,
+ const char* pMimeType,
+ char** pUsedMimeType);
+
+ /// @see lok::Document::paste().
+ bool (*paste) (LibreOfficeKitDocument* pThis,
+ const char* pMimeType,
+ const char* pData,
+ size_t nSize);
+
+ /// @see lok::Document::setGraphicSelection
+ void (*setGraphicSelection) (LibreOfficeKitDocument* pThis,
+ int nType,
+ int nX,
+ int nY);
+
+ /// @see lok::Document::resetSelection
+ void (*resetSelection) (LibreOfficeKitDocument* pThis);
+
+ /// @see lok::Document::getCommandValues().
+ char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand);
+
+ /// @see lok::Document::setClientZoom().
+ void (*setClientZoom) (LibreOfficeKitDocument* pThis,
+ int nTilePixelWidth,
+ int nTilePixelHeight,
+ int nTileTwipWidth,
+ int nTileTwipHeight);
+
+ /// @see lok::Document::setVisibleArea).
+ void (*setClientVisibleArea) (LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight);
+
+ /// @see lok::Document::createView().
+ int (*createView) (LibreOfficeKitDocument* pThis);
+ /// @see lok::Document::destroyView().
+ void (*destroyView) (LibreOfficeKitDocument* pThis, int nId);
+ /// @see lok::Document::setView().
+ void (*setView) (LibreOfficeKitDocument* pThis, int nId);
+ /// @see lok::Document::getView().
+ int (*getView) (LibreOfficeKitDocument* pThis);
+ /// @see lok::Document::getViewsCount().
+ int (*getViewsCount) (LibreOfficeKitDocument* pThis);
+
+ /// @see lok::Document::renderFont().
+ unsigned char* (*renderFont) (LibreOfficeKitDocument* pThis,
+ const char* pFontName,
+ const char* pChar,
+ int* pFontWidth,
+ int* pFontHeight);
+
+ /// @see lok::Document::getPartHash().
+ char* (*getPartHash) (LibreOfficeKitDocument* pThis,
+ int nPart);
+
+ /// Paints a tile from a specific part.
+ /// @see lok::Document::paintTile().
+ void (*paintPartTile) (LibreOfficeKitDocument* pThis,
+ unsigned char* pBuffer,
+ const int nPart,
+ const int nCanvasWidth,
+ const int nCanvasHeight,
+ const int nTilePosX,
+ const int nTilePosY,
+ const int nTileWidth,
+ const int nTileHeight);
+
+ /// @see lok::Document::getViewIds().
+ bool (*getViewIds) (LibreOfficeKitDocument* pThis,
+ int* pArray,
+ size_t nSize);
+
+ /// @see lok::Document::setOutlineState).
+ void (*setOutlineState) (LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden);
+
+ /// Paints window with given id to the buffer
+ /// @see lok::Document::paintWindow().
+ void (*paintWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
+ unsigned char* pBuffer,
+ const int x, const int y,
+ const int width, const int height);
+
+ /// @see lok::Document::postWindow().
+ void (*postWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId, int nAction, const char* pData);
+
+ /// @see lok::Document::postWindowKeyEvent().
+ void (*postWindowKeyEvent) (LibreOfficeKitDocument* pThis,
+ unsigned nWindowId,
+ int nType,
+ int nCharCode,
+ int nKeyCode);
+
+ /// @see lok::Document::postWindowMouseEvent().
+ void (*postWindowMouseEvent) (LibreOfficeKitDocument* pThis,
+ unsigned nWindowId,
+ int nType,
+ int nX,
+ int nY,
+ int nCount,
+ int nButtons,
+ int nModifier);
+
+ /// @see lok::Document::setViewLanguage().
+ void (*setViewLanguage) (LibreOfficeKitDocument* pThis, int nId, const char* language);
+
+ /// @see lok::Document::postWindowExtTextInputEvent
+ void (*postWindowExtTextInputEvent) (LibreOfficeKitDocument* pThis,
+ unsigned nWindowId,
+ int nType,
+ const char* pText);
+
+ /// @see lok::Document::getPartInfo().
+ char* (*getPartInfo) (LibreOfficeKitDocument* pThis, int nPart);
+
+ /// Paints window with given id to the buffer with the give DPI scale
+ /// (every pixel is dpiscale-times larger).
+ /// @see lok::Document::paintWindow().
+ void (*paintWindowDPI) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
+ unsigned char* pBuffer,
+ const int x, const int y,
+ const int width, const int height,
+ const double dpiscale);
+
+#ifdef IOS
+ /// @see lok::Document::paintTileToCGContext().
+ void (*paintTileToCGContext) (LibreOfficeKitDocument* pThis,
+ void* rCGContext,
+ const int nCanvasWidth,
+ const int nCanvasHeight,
+ const int nTilePosX,
+ const int nTilePosY,
+ const int nTileWidth,
+ const int nTileHeight);
+#endif // IOS
+
+// CERTIFICATE AND SIGNING
+
+ /// @see lok::Document::insertCertificate().
+ bool (*insertCertificate) (LibreOfficeKitDocument* pThis,
+ const unsigned char* pCertificateBinary,
+ const int nCertificateBinarySize,
+ const unsigned char* pPrivateKeyBinary,
+ const int nPrivateKeyBinarySize);
+
+ /// @see lok::Document::addCertificate().
+ bool (*addCertificate) (LibreOfficeKitDocument* pThis,
+ const unsigned char* pCertificateBinary,
+ const int nCertificateBinarySize);
+
+ /// @see lok::Document::getSignatureState().
+ int (*getSignatureState) (LibreOfficeKitDocument* pThis);
+// END CERTIFICATE AND SIGNING
+
+ /// @see lok::Document::renderShapeSelection
+ size_t (*renderShapeSelection)(LibreOfficeKitDocument* pThis, char** pOutput);
+
+ /// @see lok::Document::postWindowGestureEvent().
+ void (*postWindowGestureEvent) (LibreOfficeKitDocument* pThis,
+ unsigned nWindowId,
+ const char* pType,
+ int nX,
+ int nY,
+ int nOffset);
+
+ /// @see lok::Document::createViewWithOptions().
+ int (*createViewWithOptions) (LibreOfficeKitDocument* pThis, const char* pOptions);
+
+ /// @see lok::Document::selectPart().
+ void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect);
+
+ /// @see lok::Document::moveSelectedParts().
+ void (*moveSelectedParts) (LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate);
+
+ /// Resize window with given id.
+ /// @see lok::Document::resizeWindow().
+ void (*resizeWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
+ const int width, const int height);
+
+ /// Pass a nullptr terminated array of mime-type strings
+ /// @see lok::Document::getClipboard for more details
+ int (*getClipboard) (LibreOfficeKitDocument* pThis,
+ const char **pMimeTypes,
+ size_t *pOutCount,
+ char ***pOutMimeTypes,
+ size_t **pOutSizes,
+ char ***pOutStreams);
+
+ /// @see lok::Document::setClipboard
+ int (*setClipboard) (LibreOfficeKitDocument* pThis,
+ const size_t nInCount,
+ const char **pInMimeTypes,
+ const size_t *pInSizes,
+ const char **pInStreams);
+
+ /// @see lok::Document::getSelectionType
+ int (*getSelectionType) (LibreOfficeKitDocument* pThis);
+
+ /// @see lok::Document::removeTextContext
+ void (*removeTextContext) (LibreOfficeKitDocument* pThis,
+ unsigned nWindowId,
+ int nBefore,
+ int nAfter);
+
+ /// @see lok::Document::sendDialogEvent
+ void (*sendDialogEvent) (LibreOfficeKitDocument* pThis,
+ unsigned long long int nLOKWindowId,
+ const char* pArguments);
+
+ /// @see lok::Document::renderFontOrientation().
+ unsigned char* (*renderFontOrientation) (LibreOfficeKitDocument* pThis,
+ const char* pFontName,
+ const char* pChar,
+ int* pFontWidth,
+ int* pFontHeight,
+ int pOrientation);
+
+ /// Switches view to viewId if viewId >= 0, and paints window
+ /// @see lok::Document::paintWindowDPI().
+ void (*paintWindowForView) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
+ unsigned char* pBuffer,
+ const int x, const int y,
+ const int width, const int height,
+ const double dpiscale,
+ int viewId);
+
+ /// @see lok::Document::completeFunction().
+ void (*completeFunction) (LibreOfficeKitDocument* pThis, const char* pFunctionName);
+
+ /// @see lok::Document::setWindowTextSelection
+ void (*setWindowTextSelection) (LibreOfficeKitDocument* pThis,
+ unsigned nWindowId,
+ bool bSwap,
+ int nX,
+ int nY);
+
+ /// @see lok::Document::sendFormFieldEvent
+ void (*sendFormFieldEvent) (LibreOfficeKitDocument* pThis,
+ const char* pArguments);
+
+ /// @see lok::Document::setBlockedCommandList
+ void (*setBlockedCommandList) (LibreOfficeKitDocument* pThis,
+ int nViewId,
+ const char* blockedCommandList);
+
+ /// @see lok::Document::renderSearchResult
+ bool (*renderSearchResult) (LibreOfficeKitDocument* pThis,
+ const char* pSearchResult,
+ unsigned char** pBitmapBuffer,
+ int* pWidth, int* pHeight, size_t* pByteSize);
+
+ /// @see lok::Document::sendContentControlEvent().
+ void (*sendContentControlEvent)(LibreOfficeKitDocument* pThis, const char* pArguments);
+
+ /// @see lok::Document::getSelectionTypeAndText
+ /// @since LibreOffice 7.4
+ int (*getSelectionTypeAndText) (LibreOfficeKitDocument* pThis,
+ const char* pMimeType,
+ char** pText,
+ char** pUsedMimeType);
+
+#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
new file mode 100644
index 000000000..6dbfbf964
--- /dev/null
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -0,0 +1,1119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <LibreOfficeKit/LibreOfficeKit.h>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <LibreOfficeKit/LibreOfficeKitInit.h>
+
+/*
+ * The reasons this C++ code is not as pretty as it could be are:
+ * a) provide a pure C API - that's useful for some people
+ * b) allow ABI stability - C++ vtables are not good for that.
+ * c) avoid C++ types as part of the API.
+ */
+namespace lok
+{
+
+/// The lok::Document class represents one loaded document instance.
+class Document
+{
+private:
+ LibreOfficeKitDocument* mpDoc;
+
+public:
+ /// A lok::Document is typically created by the lok::Office::documentLoad() method.
+ Document(LibreOfficeKitDocument* pDoc) :
+ mpDoc(pDoc)
+ {}
+
+ ~Document()
+ {
+ mpDoc->pClass->destroy(mpDoc);
+ }
+
+ /**
+ * Stores the document's persistent data to a URL and
+ * continues to be a representation of the old URL.
+ *
+ * @param pUrl the location where to store the document
+ * @param pFormat the format to use while exporting, when omitted, then deducted from pURL's extension
+ * @param pFilterOptions options for the export filter, e.g. SkipImages.
+ * Another useful FilterOption is "TakeOwnership". It is consumed
+ * by the saveAs() itself, and when provided, the document identity
+ * changes to the provided pUrl - meaning that '.uno:ModifiedStatus'
+ * is triggered as with the "Save As..." in the UI.
+ * "TakeOwnership" mode must not be used when saving to PNG or PDF.
+ */
+ bool saveAs(const char* pUrl, const char* pFormat = NULL, const char* pFilterOptions = NULL)
+ {
+ return mpDoc->pClass->saveAs(mpDoc, pUrl, pFormat, pFilterOptions) != 0;
+ }
+
+ /// Gives access to the underlying C pointer.
+ LibreOfficeKitDocument *get() { return mpDoc; }
+
+ /**
+ * Get document type.
+ *
+ * @since LibreOffice 6.0
+ * @return an element of the LibreOfficeKitDocumentType enum.
+ */
+ int getDocumentType()
+ {
+ return mpDoc->pClass->getDocumentType(mpDoc);
+ }
+
+#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+ /**
+ * Get number of part that the document contains.
+ *
+ * Part refers to either individual sheets in a Calc, or slides in Impress,
+ * and has no relevance for Writer.
+ */
+ int getParts()
+ {
+ return mpDoc->pClass->getParts(mpDoc);
+ }
+
+ /**
+ * Get the logical rectangle of each part in the document.
+ *
+ * A part refers to an individual page in Writer and has no relevant for
+ * Calc or Impress.
+ *
+ * @return a rectangle list, using the same format as
+ * LOK_CALLBACK_TEXT_SELECTION.
+ */
+ char* getPartPageRectangles()
+ {
+ return mpDoc->pClass->getPartPageRectangles(mpDoc);
+ }
+
+ /// Get the current part of the document.
+ int getPart()
+ {
+ return mpDoc->pClass->getPart(mpDoc);
+ }
+
+ /// Set the current part of the document.
+ void setPart(int nPart)
+ {
+ mpDoc->pClass->setPart(mpDoc, nPart);
+ }
+
+ /// Get the current part's name.
+ char* getPartName(int nPart)
+ {
+ return mpDoc->pClass->getPartName(mpDoc, nPart);
+ }
+
+ /// Get the current part's hash.
+ char* getPartHash(int nPart)
+ {
+ return mpDoc->pClass->getPartHash(mpDoc, nPart);
+ }
+
+ void setPartMode(int nMode)
+ {
+ mpDoc->pClass->setPartMode(mpDoc, nMode);
+ }
+
+ /**
+ * Renders a subset of the document to a pre-allocated buffer.
+ *
+ * Note that the buffer size and the tile size implicitly supports
+ * rendering at different zoom levels, as the number of rendered pixels and
+ * the rendered rectangle of the document are independent.
+ *
+ * @param pBuffer pointer to the buffer, its size is determined by nCanvasWidth and nCanvasHeight.
+ * @param nCanvasWidth number of pixels in a row of pBuffer.
+ * @param nCanvasHeight number of pixels in a column of pBuffer.
+ * @param nTilePosX logical X position of the top left corner of the rendered rectangle, in TWIPs.
+ * @param nTilePosY logical Y position of the top left corner of the rendered rectangle, in TWIPs.
+ * @param nTileWidth logical width of the rendered rectangle, in TWIPs.
+ * @param nTileHeight logical height of the rendered rectangle, in TWIPs.
+ */
+ void paintTile(unsigned char* pBuffer,
+ const int nCanvasWidth,
+ const int nCanvasHeight,
+ const int nTilePosX,
+ const int nTilePosY,
+ const int nTileWidth,
+ const int nTileHeight)
+ {
+ return mpDoc->pClass->paintTile(mpDoc, pBuffer, nCanvasWidth, nCanvasHeight,
+ nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+ }
+
+ /**
+ * Renders a window (dialog, popup, etc.) with give id
+ *
+ * @param nWindowId
+ * @param pBuffer Buffer with enough memory allocated to render any dialog
+ * @param x x-coordinate from where the dialog should start painting
+ * @param y y-coordinate from where the dialog should start painting
+ * @param width The width of the dialog image to be painted
+ * @param height The height of the dialog image to be painted
+ * @param dpiscale The dpi scale value used by the client. Please note
+ * that the x, y, width, height are supposed to be the
+ * values with dpiscale applied (ie. dialog covering
+ * 100x100 "normal" pixels with dpiscale '2' will have
+ * 200x200 width x height), so that it is easy to compute
+ * the buffer sizes etc.
+ */
+ void paintWindow(unsigned nWindowId,
+ unsigned char* pBuffer,
+ const int x,
+ const int y,
+ const int width,
+ const int height,
+ const double dpiscale = 1.0,
+ const int viewId = -1)
+ {
+ return mpDoc->pClass->paintWindowForView(mpDoc, nWindowId, pBuffer, x, y,
+ width, height, dpiscale, viewId);
+ }
+
+ /**
+ * Posts a command to the window (dialog, popup, etc.) with given id
+ *
+ * @param nWindowid
+ */
+ void postWindow(unsigned nWindowId, int nAction, const char* pData = nullptr)
+ {
+ return mpDoc->pClass->postWindow(mpDoc, nWindowId, nAction, pData);
+ }
+
+ /**
+ * Gets the tile mode: the pixel format used for the pBuffer of paintTile().
+ *
+ * @return an element of the LibreOfficeKitTileMode enum.
+ */
+ int getTileMode()
+ {
+ return mpDoc->pClass->getTileMode(mpDoc);
+ }
+
+ /// Get the document sizes in TWIPs.
+ void getDocumentSize(long* pWidth, long* pHeight)
+ {
+ mpDoc->pClass->getDocumentSize(mpDoc, pWidth, pHeight);
+ }
+
+ /**
+ * Initialize document for rendering.
+ *
+ * Sets the rendering and document parameters to default values that are
+ * needed to render the document correctly using tiled rendering. This
+ * method has to be called right after documentLoad() in case any of the
+ * tiled rendering methods are to be used later.
+ *
+ * Example argument string for text documents:
+ *
+ * {
+ * ".uno:HideWhitespace":
+ * {
+ * "type": "boolean",
+ * "value": "true"
+ * }
+ * }
+ *
+ * @param pArguments arguments of the rendering
+ */
+ void initializeForRendering(const char* pArguments = NULL)
+ {
+ mpDoc->pClass->initializeForRendering(mpDoc, pArguments);
+ }
+
+ /**
+ * Registers a callback. LOK will invoke this function when it wants to
+ * inform the client about events.
+ *
+ * @param pCallback the callback to invoke
+ * @param pData the user data, will be passed to the callback on invocation
+ */
+ void registerCallback(LibreOfficeKitCallback pCallback, void* pData)
+ {
+ mpDoc->pClass->registerCallback(mpDoc, pCallback, pData);
+ }
+
+ /**
+ * Posts a keyboard event to the focused frame.
+ *
+ * @param nType Event type, like press or release.
+ * @param nCharCode contains the Unicode character generated by this event or 0
+ * @param nKeyCode contains the integer code representing the key of the event (non-zero for control keys)
+ */
+ void postKeyEvent(int nType, int nCharCode, int nKeyCode)
+ {
+ mpDoc->pClass->postKeyEvent(mpDoc, nType, nCharCode, nKeyCode);
+ }
+
+ /**
+ * Posts a keyboard event to the dialog
+ *
+ * @param nWindowId
+ * @param nType Event type, like press or release.
+ * @param nCharCode contains the Unicode character generated by this event or 0
+ * @param nKeyCode contains the integer code representing the key of the event (non-zero for control keys)
+ */
+ void postWindowKeyEvent(unsigned nWindowId, int nType, int nCharCode, int nKeyCode)
+ {
+ mpDoc->pClass->postWindowKeyEvent(mpDoc, nWindowId, nType, nCharCode, nKeyCode);
+ }
+
+ /**
+ * Posts a mouse event to the document.
+ *
+ * @param nType Event type, like down, move or up.
+ * @param nX horizontal position in document coordinates
+ * @param nY vertical position in document coordinates
+ * @param nCount number of clicks: 1 for single click, 2 for double click
+ * @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right
+ * @param nModifier: which keyboard modifier: (see include/vcl/vclenum.hxx for possible values)
+ */
+ void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
+ {
+ mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY, nCount, nButtons, nModifier);
+ }
+
+ /**
+ * Posts a mouse event to the window with given id.
+ *
+ * @param nWindowId
+ * @param nType Event type, like down, move or up.
+ * @param nX horizontal position in document coordinates
+ * @param nY vertical position in document coordinates
+ * @param nCount number of clicks: 1 for single click, 2 for double click
+ * @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right
+ * @param nModifier: which keyboard modifier: (see include/vcl/vclenum.hxx for possible values)
+ */
+ void postWindowMouseEvent(unsigned nWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
+ {
+ mpDoc->pClass->postWindowMouseEvent(mpDoc, nWindowId, nType, nX, nY, nCount, nButtons, nModifier);
+ }
+
+ /**
+ * Posts a dialog event for the window with given id
+ *
+ * @param nWindowId id of the window to notify
+ * @param pArguments arguments of the event.
+ */
+ void sendDialogEvent(unsigned long long int nWindowId, const char* pArguments = NULL)
+ {
+ mpDoc->pClass->sendDialogEvent(mpDoc, nWindowId, pArguments);
+ }
+
+ /**
+ * Posts a UNO command to the document.
+ *
+ * Example argument string:
+ *
+ * {
+ * "SearchItem.SearchString":
+ * {
+ * "type": "string",
+ * "value": "foobar"
+ * },
+ * "SearchItem.Backward":
+ * {
+ * "type": "boolean",
+ * "value": "false"
+ * }
+ * }
+ *
+ * @param pCommand uno command to be posted to the document, like ".uno:Bold"
+ * @param pArguments arguments of the uno command.
+ */
+ void postUnoCommand(const char* pCommand, const char* pArguments = NULL, bool bNotifyWhenFinished = false)
+ {
+ mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments, bNotifyWhenFinished);
+ }
+
+ /**
+ * Sets the start or end of a text selection.
+ *
+ * @param nType @see LibreOfficeKitSetTextSelectionType
+ * @param nX horizontal position in document coordinates
+ * @param nY vertical position in document coordinates
+ */
+ void setTextSelection(int nType, int nX, int nY)
+ {
+ mpDoc->pClass->setTextSelection(mpDoc, nType, nX, nY);
+ }
+
+ /**
+ * Gets the currently selected text.
+ *
+ * @param pMimeType suggests the return format, for example text/plain;charset=utf-8.
+ * @param pUsedMimeType output parameter to inform about the determined format (suggested one or plain text).
+ */
+ char* getTextSelection(const char* pMimeType, char** pUsedMimeType = NULL)
+ {
+ return mpDoc->pClass->getTextSelection(mpDoc, pMimeType, pUsedMimeType);
+ }
+
+ /**
+ * Gets the type of the selected content.
+ *
+ * In most cases it is more efficient to use getSelectionTypeAndText().
+ *
+ * @return an element of the LibreOfficeKitSelectionType enum.
+ */
+ int getSelectionType()
+ {
+ return mpDoc->pClass->getSelectionType(mpDoc);
+ }
+
+ /**
+ * Gets the type of the selected content and possibly its text.
+ *
+ * This function is a more efficient combination of getSelectionType() and getTextSelection().
+ * It returns the same as getSelectionType(), and additionally if the return value is
+ * LOK_SELTYPE_TEXT then it also returns the same as getTextSelection(), otherwise
+ * pText and pUsedMimeType are unchanged.
+ *
+ * @param pMimeType suggests the return format, for example text/plain;charset=utf-8.
+ * @param pText the currently selected text
+ * @param pUsedMimeType output parameter to inform about the determined format (suggested one or plain text).
+ * @return an element of the LibreOfficeKitSelectionType enum.
+ * @since LibreOffice 7.4
+ */
+ int getSelectionTypeAndText(const char* pMimeType, char** pText, char** pUsedMimeType = NULL)
+ {
+ if (LIBREOFFICEKIT_DOCUMENT_HAS(mpDoc, getSelectionTypeAndText))
+ return mpDoc->pClass->getSelectionTypeAndText(mpDoc, pMimeType, pText, pUsedMimeType);
+ int type = mpDoc->pClass->getSelectionType(mpDoc);
+ if(type == LOK_SELTYPE_TEXT && pText)
+ *pText = mpDoc->pClass->getTextSelection(mpDoc, pMimeType, pUsedMimeType);
+ return type;
+ }
+
+ /**
+ * Gets the content on the clipboard for the current view as a series of binary streams.
+ *
+ * NB. returns a complete set of possible selection types if nullptr is passed for pMimeTypes.
+ *
+ * @param pMimeTypes passes in a nullptr terminated list of mime types to fetch
+ * @param pOutCount returns the size of the other @pOut arrays
+ * @param pOutMimeTypes returns an array of mime types
+ * @param pOutSizes returns the size of each pOutStream
+ * @param pOutStreams the content of each mime-type, of length in @pOutSizes
+ *
+ * @returns: true on success, false on error.
+ */
+ bool getClipboard(const char **pMimeTypes,
+ size_t *pOutCount,
+ char ***pOutMimeTypes,
+ size_t **pOutSizes,
+ char ***pOutStreams)
+ {
+ return mpDoc->pClass->getClipboard(mpDoc, pMimeTypes, pOutCount, pOutMimeTypes, pOutSizes, pOutStreams);
+ }
+
+ /**
+ * Populates the clipboard for this view with multiple types of content.
+ *
+ * @param nInCount the number of types to paste
+ * @param pInMimeTypes array of mime type strings
+ * @param pInSizes array of sizes of the data to paste
+ * @param pInStreams array containing the data of the various types
+ *
+ * @return if the supplied data was populated successfully.
+ */
+ bool setClipboard(const size_t nInCount,
+ const char **pInMimeTypes,
+ const size_t *pInSizes,
+ const char **pInStreams)
+ {
+ return mpDoc->pClass->setClipboard(mpDoc, nInCount, pInMimeTypes, pInSizes, pInStreams);
+ }
+
+ /**
+ * Pastes content at the current cursor position.
+ *
+ * @param pMimeType format of pData, for example text/plain;charset=utf-8.
+ * @param pData the actual data to be pasted.
+ * @return if the supplied data was pasted successfully.
+ */
+ bool paste(const char* pMimeType, const char* pData, size_t nSize)
+ {
+ return mpDoc->pClass->paste(mpDoc, pMimeType, pData, nSize);
+ }
+
+ /**
+ * Adjusts the graphic selection.
+ *
+ * @param nType @see LibreOfficeKitSetGraphicSelectionType
+ * @param nX horizontal position in document coordinates
+ * @param nY vertical position in document coordinates
+ */
+ void setGraphicSelection(int nType, int nX, int nY)
+ {
+ mpDoc->pClass->setGraphicSelection(mpDoc, nType, nX, nY);
+ }
+
+ /**
+ * Gets rid of any text or graphic selection.
+ */
+ void resetSelection()
+ {
+ mpDoc->pClass->resetSelection(mpDoc);
+ }
+
+ /**
+ * Returns a json mapping of the possible values for the given command
+ * e.g. {commandName: ".uno:StyleApply", commandValues: {"familyName1" : ["list of style names in the family1"], etc.}}
+ * @param pCommand a UNO command for which the possible values are requested
+ * @return {commandName: unoCmd, commandValues: {possible_values}}
+ */
+ char* getCommandValues(const char* pCommand)
+ {
+ return mpDoc->pClass->getCommandValues(mpDoc, pCommand);
+ }
+
+ /**
+ * Save the client's view so that we can compute the right zoom level
+ * for the mouse events. This only affects CALC.
+ * @param nTilePixelWidth - tile width in pixels
+ * @param nTilePixelHeight - tile height in pixels
+ * @param nTileTwipWidth - tile width in twips
+ * @param nTileTwipHeight - tile height in twips
+ */
+ void setClientZoom(
+ int nTilePixelWidth,
+ int nTilePixelHeight,
+ int nTileTwipWidth,
+ int nTileTwipHeight)
+ {
+ mpDoc->pClass->setClientZoom(mpDoc, nTilePixelWidth, nTilePixelHeight, nTileTwipWidth, nTileTwipHeight);
+ }
+
+ /**
+ * Inform core about the currently visible area of the document on the
+ * client, so that it can perform e.g. page down (which depends on the
+ * visible height) in a sane way.
+ *
+ * @param nX - top left corner horizontal position
+ * @param nY - top left corner vertical position
+ * @param nWidth - area width
+ * @param nHeight - area height
+ */
+ void setClientVisibleArea(int nX, int nY, int nWidth, int nHeight)
+ {
+ mpDoc->pClass->setClientVisibleArea(mpDoc, nX, nY, nWidth, nHeight);
+ }
+
+ /**
+ * Show/Hide a single row/column header outline for Calc documents.
+ *
+ * @param bColumn - if we are dealing with a column or row group
+ * @param nLevel - the level to which the group belongs
+ * @param nIndex - the group entry index
+ * @param bHidden - the new group state (collapsed/expanded)
+ */
+ void setOutlineState(bool bColumn, int nLevel, int nIndex, bool bHidden)
+ {
+ mpDoc->pClass->setOutlineState(mpDoc, bColumn, nLevel, nIndex, bHidden);
+ }
+
+ /**
+ * Create a new view for an existing document with
+ * options similar to documentLoadWithOptions.
+ * By default a loaded document has 1 view.
+ * @return the ID of the new view.
+ */
+ int createView(const char* pOptions = nullptr)
+ {
+ if (LIBREOFFICEKIT_DOCUMENT_HAS(mpDoc, createViewWithOptions))
+ return mpDoc->pClass->createViewWithOptions(mpDoc, pOptions);
+ else
+ return mpDoc->pClass->createView(mpDoc);
+ }
+
+ /**
+ * Destroy a view of an existing document.
+ * @param nId a view ID, returned by createView().
+ */
+ void destroyView(int nId)
+ {
+ mpDoc->pClass->destroyView(mpDoc, nId);
+ }
+
+ /**
+ * Set an existing view of an existing document as current.
+ * @param nId a view ID, returned by createView().
+ */
+ void setView(int nId)
+ {
+ mpDoc->pClass->setView(mpDoc, nId);
+ }
+
+ /**
+ * Get the current view.
+ * @return a view ID, previously returned by createView().
+ */
+ int getView()
+ {
+ return mpDoc->pClass->getView(mpDoc);
+ }
+
+ /**
+ * Get number of views of this document.
+ */
+ int getViewsCount()
+ {
+ return mpDoc->pClass->getViewsCount(mpDoc);
+ }
+
+ /**
+ * Paints a font name or character if provided to be displayed in the font list
+ * @param pFontName the font to be painted
+ */
+ unsigned char* renderFont(const char *pFontName,
+ const char *pChar,
+ int *pFontWidth,
+ int *pFontHeight,
+ int pOrientation=0)
+ {
+ if (LIBREOFFICEKIT_DOCUMENT_HAS(mpDoc, renderFontOrientation))
+ return mpDoc->pClass->renderFontOrientation(mpDoc, pFontName, pChar, pFontWidth, pFontHeight, pOrientation);
+ else
+ return mpDoc->pClass->renderFont(mpDoc, pFontName, pChar, pFontWidth, pFontHeight);
+ }
+
+ /**
+ * Renders a subset of the document's part to a pre-allocated buffer.
+ *
+ * @param nPart the part number of the document of which the tile is painted.
+ * @see paintTile.
+ */
+ void paintPartTile(unsigned char* pBuffer,
+ const int nPart,
+ const int nCanvasWidth,
+ const int nCanvasHeight,
+ const int nTilePosX,
+ const int nTilePosY,
+ const int nTileWidth,
+ const int nTileHeight)
+ {
+ return mpDoc->pClass->paintPartTile(mpDoc, pBuffer, nPart,
+ nCanvasWidth, nCanvasHeight,
+ nTilePosX, nTilePosY,
+ nTileWidth, nTileHeight);
+ }
+
+ /**
+ * Returns the viewID for each existing view. Since viewIDs are not reused,
+ * viewIDs are not the same as the index of the view in the view array over
+ * time. Use getViewsCount() to know the minimal nSize that's large enough.
+ *
+ * @param pArray the array to write the viewIDs into
+ * @param nSize the size of pArray
+ * @returns true if pArray was large enough and result is written, false
+ * otherwise.
+ */
+ bool getViewIds(int* pArray,
+ size_t nSize)
+ {
+ return mpDoc->pClass->getViewIds(mpDoc, pArray, nSize);
+ }
+
+ /**
+ * Set the language tag of the window with the specified nId.
+ *
+ * @param nId a view ID, returned by createView().
+ * @param language Bcp47 languageTag, like en-US or so.
+ */
+ void setViewLanguage(int nId, const char* language)
+ {
+ mpDoc->pClass->setViewLanguage(mpDoc, nId, language);
+ }
+
+ /**
+ * Post the text input from external input window, like IME, to given windowId
+ *
+ * @param nWindowId Specify the window id to post the input event to. If
+ * nWindow is 0, the event is posted into the document
+ * @param nType see LibreOfficeKitExtTextInputType
+ * @param pText Text for LOK_EXT_TEXTINPUT
+ */
+ void postWindowExtTextInputEvent(unsigned nWindowId, int nType, const char* pText)
+ {
+ mpDoc->pClass->postWindowExtTextInputEvent(mpDoc, nWindowId, nType, pText);
+ }
+
+#ifdef IOS
+ /**
+ * Renders a subset of the document to a Core Graphics context.
+ *
+ * Note that the buffer size and the tile size implicitly supports
+ * rendering at different zoom levels, as the number of rendered pixels and
+ * the rendered rectangle of the document are independent.
+ *
+ * @param rCGContext the CGContextRef, cast to a void*.
+ * @param nCanvasHeight number of pixels in a column of pBuffer.
+ * @param nTilePosX logical X position of the top left corner of the rendered rectangle, in TWIPs.
+ * @param nTilePosY logical Y position of the top left corner of the rendered rectangle, in TWIPs.
+ * @param nTileWidth logical width of the rendered rectangle, in TWIPs.
+ * @param nTileHeight logical height of the rendered rectangle, in TWIPs.
+ */
+ void paintTileToCGContext(void* rCGContext,
+ const int nCanvasWidth,
+ const int nCanvasHeight,
+ const int nTilePosX,
+ const int nTilePosY,
+ const int nTileWidth,
+ const int nTileHeight)
+ {
+ return mpDoc->pClass->paintTileToCGContext(mpDoc, rCGContext, nCanvasWidth, nCanvasHeight,
+ nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+ }
+#endif // IOS
+
+ /**
+ * Insert certificate (in binary form) to the certificate store.
+ */
+ bool insertCertificate(const unsigned char* pCertificateBinary,
+ const int pCertificateBinarySize,
+ const unsigned char* pPrivateKeyBinary,
+ const int nPrivateKeyBinarySize)
+ {
+ return mpDoc->pClass->insertCertificate(mpDoc,
+ pCertificateBinary, pCertificateBinarySize,
+ pPrivateKeyBinary, nPrivateKeyBinarySize);
+ }
+
+ /**
+ * Add the certificate (in binary form) to the certificate store.
+ *
+ */
+ bool addCertificate(const unsigned char* pCertificateBinary,
+ const int pCertificateBinarySize)
+ {
+ return mpDoc->pClass->addCertificate(mpDoc,
+ pCertificateBinary, pCertificateBinarySize);
+ }
+
+ /**
+ * Verify signature of the document.
+ *
+ * Check possible values in include/sfx2/signaturestate.hxx
+ */
+ int getSignatureState()
+ {
+ return mpDoc->pClass->getSignatureState(mpDoc);
+ }
+
+ /**
+ * Gets an image of the selected shapes.
+ * @param pOutput contains the result; use free to deallocate.
+ * @return the size of *pOutput in bytes.
+ */
+ size_t renderShapeSelection(char** pOutput)
+ {
+ return mpDoc->pClass->renderShapeSelection(mpDoc, pOutput);
+ }
+
+ /**
+ * Posts a gesture event to the window with given id.
+ *
+ * @param nWindowId
+ * @param pType Event type, like panStart, panEnd, panUpdate.
+ * @param nX horizontal position in document coordinates
+ * @param nY vertical position in document coordinates
+ * @param nOffset difference value from when the gesture started to current value
+ */
+ void postWindowGestureEvent(unsigned nWindowId,
+ const char* pType,
+ int nX, int nY, int nOffset)
+ {
+ return mpDoc->pClass->postWindowGestureEvent(mpDoc, nWindowId, pType, nX, nY, nOffset);
+ }
+
+ /// Set a part's selection mode.
+ /// nSelect is 0 to deselect, 1 to select, and 2 to toggle.
+ void selectPart(int nPart, int nSelect)
+ {
+ mpDoc->pClass->selectPart(mpDoc, nPart, nSelect);
+ }
+
+ /// Moves the selected pages/slides to a new position.
+ /// nPosition is the new position where the selection
+ /// should go. bDuplicate when true will copy instead of move.
+ void moveSelectedParts(int nPosition, bool bDuplicate)
+ {
+ mpDoc->pClass->moveSelectedParts(mpDoc, nPosition, bDuplicate);
+ }
+
+ /**
+ * Resize a window (dialog, popup, etc.) with give id.
+ *
+ * @param nWindowId
+ * @param width The width of the window.
+ * @param height The height of the window.
+ */
+ void resizeWindow(unsigned nWindowId,
+ const int width,
+ const int height)
+ {
+ return mpDoc->pClass->resizeWindow(mpDoc, nWindowId, width, height);
+ }
+
+ /**
+ * For deleting many characters all at once
+ *
+ * @param nWindowId Specify the window id to post the input event to. If
+ * nWindow is 0, the event is posted into the document
+ * @param nBefore The characters to be deleted before the cursor position
+ * @param nAfter The characters to be deleted after the cursor position
+ */
+ void removeTextContext(unsigned nWindowId, int nBefore, int nAfter)
+ {
+ mpDoc->pClass->removeTextContext(mpDoc, nWindowId, nBefore, nAfter);
+ }
+
+ /**
+ * Select the Calc function to be pasted into the formula input box
+ *
+ * @param nIndex is the index of the selected function
+ */
+ void completeFunction(const char* pFunctionName)
+ {
+ mpDoc->pClass->completeFunction(mpDoc, pFunctionName);
+ }
+
+ /**
+ * Sets the start or end of a text selection for a dialog.
+ *
+ * @param nWindowId
+ * @param bSwap swap anchor and cursor position of current selection
+ * @param nX horizontal position in document coordinates
+ * @param nY vertical position in document coordinates
+ */
+ void setWindowTextSelection(unsigned nWindowId, bool bSwap, int nX, int nY)
+ {
+ mpDoc->pClass->setWindowTextSelection(mpDoc, nWindowId, bSwap, nX, nY);
+ }
+
+ /**
+ * Posts an event for the form field at the cursor position.
+ *
+ * @param pArguments arguments of the event.
+ */
+ void sendFormFieldEvent(const char* pArguments)
+ {
+ mpDoc->pClass->sendFormFieldEvent(mpDoc, pArguments);
+ }
+
+ void setBlockedCommandList(int nViewId, const char* blockedCommandList)
+ {
+ mpDoc->pClass->setBlockedCommandList(mpDoc, nViewId, blockedCommandList);
+ }
+ /**
+ * Render input search result to a bitmap buffer.
+ *
+ * @param pSearchResult payload containing the search result data
+ * @param pBitmapBuffer contains the bitmap; use free to deallocate.
+ * @param nWidth output bitmap width
+ * @param nHeight output bitmap height
+ * @param nByteSize output bitmap byte size
+ * @return true if successful
+ */
+ bool renderSearchResult(const char* pSearchResult, unsigned char** pBitmapBuffer,
+ int* pWidth, int* pHeight, size_t* pByteSize)
+ {
+ return mpDoc->pClass->renderSearchResult(mpDoc, pSearchResult, pBitmapBuffer, pWidth, pHeight, pByteSize);
+ }
+
+ /**
+ * Posts an event for the content control at the cursor position.
+ *
+ * @param pArguments arguments of the event.
+ *
+ * Examples:
+ * To select the 3rd list item of the drop-down:
+ * {
+ * "type": "drop-down",
+ * "selected": "2"
+ * }
+ *
+ * To change a picture place-holder:
+ * {
+ * "type": "picture",
+ * "changed": "file:///path/to/test.png"
+ * }
+ *
+ * To select a date of the current date content control:
+ * {
+ * "type": "date",
+ * "selected": "2022-05-29T00:00:00Z"
+ * }
+ */
+ void sendContentControlEvent(const char* pArguments)
+ {
+ mpDoc->pClass->sendContentControlEvent(mpDoc, pArguments);
+ }
+
+#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+};
+
+/// The lok::Office class represents one started LibreOfficeKit instance.
+class Office
+{
+private:
+ LibreOfficeKit* mpThis;
+
+public:
+ /// A lok::Office is typically created by the lok_cpp_init() function.
+ Office(LibreOfficeKit* pThis) :
+ mpThis(pThis)
+ {}
+
+ ~Office()
+ {
+ mpThis->pClass->destroy(mpThis);
+ }
+
+ /**
+ * Loads a document from a URL.
+ *
+ * @param pUrl the URL of the document to load
+ * @param pFilterOptions options for the import filter, e.g. SkipImages.
+ * Another useful FilterOption is "Language=...". It is consumed
+ * by the documentLoad() itself, and when provided, LibreOfficeKit
+ * switches the language accordingly first.
+ * @since pFilterOptions argument added in LibreOffice 5.0
+ */
+ Document* documentLoad(const char* pUrl, const char* pFilterOptions = NULL)
+ {
+ LibreOfficeKitDocument* pDoc = NULL;
+
+ if (LIBREOFFICEKIT_HAS(mpThis, documentLoadWithOptions))
+ pDoc = mpThis->pClass->documentLoadWithOptions(mpThis, pUrl, pFilterOptions);
+ else
+ pDoc = mpThis->pClass->documentLoad(mpThis, pUrl);
+
+ if (pDoc == NULL)
+ return NULL;
+
+ return new Document(pDoc);
+ }
+
+ /// Returns the last error as a string, the returned pointer has to be freed by the caller.
+ char* getError()
+ {
+ return mpThis->pClass->getError(mpThis);
+ }
+
+ /**
+ * Frees the memory pointed to by pFree.
+ *
+ * @since LibreOffice 5.2
+ */
+ void freeError(char* pFree)
+ {
+ mpThis->pClass->freeError(pFree);
+ }
+
+ /**
+ * Registers a callback. LOK will invoke this function when it wants to
+ * inform the client about events.
+ *
+ * @since LibreOffice 6.0
+ * @param pCallback the callback to invoke
+ * @param pData the user data, will be passed to the callback on invocation
+ */
+ void registerCallback(LibreOfficeKitCallback pCallback, void* pData)
+ {
+ mpThis->pClass->registerCallback(mpThis, pCallback, pData);
+ }
+
+ /**
+ * Returns details of filter types.
+ *
+ * Example returned string:
+ *
+ * {
+ * "writer8": {
+ * "MediaType": "application/vnd.oasis.opendocument.text"
+ * },
+ * "calc8": {
+ * "MediaType": "application/vnd.oasis.opendocument.spreadsheet"
+ * }
+ * }
+ *
+ * @since LibreOffice 6.0
+ */
+ char* getFilterTypes()
+ {
+ return mpThis->pClass->getFilterTypes(mpThis);
+ }
+
+ /**
+ * Set bitmask of optional features supported by the client.
+ *
+ * @since LibreOffice 6.0
+ * @see LibreOfficeKitOptionalFeatures
+ */
+ void setOptionalFeatures(unsigned long long features)
+ {
+ return mpThis->pClass->setOptionalFeatures(mpThis, features);
+ }
+
+ /**
+ * Set password required for loading or editing a document.
+ *
+ * Loading the document is blocked until the password is provided.
+ *
+ * @param pURL the URL of the document, as sent to the callback
+ * @param pPassword the password, nullptr indicates no password
+ *
+ * In response to LOK_CALLBACK_DOCUMENT_PASSWORD, a valid password
+ * will continue loading the document, an invalid password will
+ * result in another LOK_CALLBACK_DOCUMENT_PASSWORD request,
+ * and a NULL password will abort loading the document.
+ *
+ * In response to LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY, a valid
+ * password will continue loading the document, an invalid password will
+ * result in another LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY request,
+ * and a NULL password will continue loading the document in read-only
+ * mode.
+ *
+ * @since LibreOffice 6.0
+ */
+ void setDocumentPassword(char const* pURL, char const* pPassword)
+ {
+ mpThis->pClass->setDocumentPassword(mpThis, pURL, pPassword);
+ }
+
+ /**
+ * Get version information of the LOKit process
+ *
+ * @since LibreOffice 6.0
+ * @returns JSON string containing version information in format:
+ * {ProductName: <>, ProductVersion: <>, ProductExtension: <>, BuildId: <>}
+ *
+ * Eg: {"ProductName": "LibreOffice",
+ * "ProductVersion": "5.3",
+ * "ProductExtension": ".0.0.alpha0",
+ * "BuildId": "<full 40 char git hash>"}
+ */
+ char* getVersionInfo()
+ {
+ return mpThis->pClass->getVersionInfo(mpThis);
+ }
+
+ /**
+ * Run a macro.
+ *
+ * Same syntax as on command line is permissible (ie. the macro:// URI forms)
+ *
+ * @since LibreOffice 6.0
+ * @param pURL macro url to run
+ */
+
+ bool runMacro( const char* pURL)
+ {
+ return mpThis->pClass->runMacro( mpThis, pURL );
+ }
+
+ /**
+ * Exports the document and signes its content.
+ */
+ bool signDocument(const char* pURL,
+ const unsigned char* pCertificateBinary, const int nCertificateBinarySize,
+ const unsigned char* pPrivateKeyBinary, const int nPrivateKeyBinarySize)
+ {
+ return mpThis->pClass->signDocument(mpThis, pURL,
+ pCertificateBinary, nCertificateBinarySize,
+ pPrivateKeyBinary, nPrivateKeyBinarySize);
+ }
+
+ /**
+ * Runs the main-loop in the current thread. To trigger this
+ * mode you need to putenv a SAL_LOK_OPTIONS containing 'unipoll'.
+ * The @pPollCallback is called to poll for events from the Kit client
+ * and the @pWakeCallback can be called by internal LibreOfficeKit threads
+ * to wake the caller of 'runLoop' ie. the main thread.
+ *
+ * it is expected that runLoop does not return until Kit exit.
+ *
+ * @pData is a context/closure passed to both methods.
+ */
+ void runLoop(LibreOfficeKitPollCallback pPollCallback,
+ LibreOfficeKitWakeCallback pWakeCallback,
+ void* pData)
+ {
+ mpThis->pClass->runLoop(mpThis, pPollCallback, pWakeCallback, pData);
+ }
+
+ /**
+ * Posts a dialog event for the window with given id
+ *
+ * @param nWindowId id of the window to notify
+ * @param pArguments arguments of the event.
+ */
+ void sendDialogEvent(unsigned long long int nWindowId, const char* pArguments = NULL)
+ {
+ mpThis->pClass->sendDialogEvent(mpThis, nWindowId, pArguments);
+ }
+
+ /**
+ * Generic function to toggle and tweak various things in the core LO
+ *
+ * The currently available option names and their allowed values are:
+ *
+ * "profilezonerecording": "start" or "stop"
+ * Start or stop recording profile zone trace data in the process.
+ *
+ * "sallogoverride": "<string>"
+ * Override the SAL_LOG environment variable
+ *
+ * For the syntax of the string see the documentation for "Basic
+ * logging functionality" in LibreOffice internal API
+ * documentation (include/sal/log.hxx). If the logging selector
+ * has been set by this function to a non-empty value, that is used
+ * instead of the environment variable SAL_LOG.
+ *
+ * The parameter is not copied so you should pass a value that
+ * points to memory that will stay valid until you call setOption
+ * with this option name the next time.
+ *
+ * If you pass nullptr or an empty string as value, the
+ * environment variable SAL_LOG is again used as by default. You
+ * can switch back and forth as you like.
+ *
+ * "addfont": "<string>"
+ *
+ * Adds the font at the URL given.
+ *
+ * @param pOption the option name
+ * @param pValue its value
+ */
+ void setOption(const char* pOption, const char* pValue)
+ {
+ mpThis->pClass->setOption(mpThis, pOption, pValue);
+ }
+};
+
+/// Factory method to create a lok::Office instance.
+inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfileUrl = NULL)
+{
+ LibreOfficeKit* pThis = lok_init_2(pInstallPath, pUserProfileUrl);
+ if (pThis == NULL || pThis->pClass->nSize == 0)
+ return NULL;
+ return new ::lok::Office(pThis);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
new file mode 100644
index 000000000..f1b232851
--- /dev/null
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -0,0 +1,1066 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H
+#define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H
+
+#include <assert.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+typedef enum
+{
+ LOK_DOCTYPE_TEXT,
+ LOK_DOCTYPE_SPREADSHEET,
+ LOK_DOCTYPE_PRESENTATION,
+ LOK_DOCTYPE_DRAWING,
+ LOK_DOCTYPE_OTHER
+}
+LibreOfficeKitDocumentType;
+
+typedef enum
+{
+ LOK_PARTMODE_SLIDES,
+ LOK_PARTMODE_NOTES
+}
+LibreOfficeKitPartMode;
+
+typedef enum
+{
+ LOK_TILEMODE_RGBA,
+ LOK_TILEMODE_BGRA
+}
+LibreOfficeKitTileMode;
+
+typedef enum
+{
+ LOK_WINDOW_CLOSE,
+ LOK_WINDOW_PASTE
+}
+LibreOfficeKitWindowAction;
+
+typedef enum
+{
+ LOK_SELTYPE_NONE,
+ LOK_SELTYPE_TEXT,
+ LOK_SELTYPE_LARGE_TEXT, // unused (same as LOK_SELTYPE_COMPLEX)
+ LOK_SELTYPE_COMPLEX
+}
+LibreOfficeKitSelectionType;
+
+/** Optional features of LibreOfficeKit, in particular callbacks that block
+ * LibreOfficeKit until the corresponding reply is received, which would
+ * deadlock if the client does not support the feature.
+ *
+ * @see lok::Office::setOptionalFeatures().
+ */
+typedef enum
+{
+ /**
+ * Handle LOK_CALLBACK_DOCUMENT_PASSWORD by prompting the user
+ * for a password.
+ *
+ * @see lok::Office::setDocumentPassword().
+ */
+ LOK_FEATURE_DOCUMENT_PASSWORD = (1ULL << 0),
+
+ /**
+ * Handle LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY by prompting the user
+ * for a password.
+ *
+ * @see lok::Office::setDocumentPassword().
+ */
+ LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY = (1ULL << 1),
+
+ /**
+ * Request to have the part number as an 5th value in the
+ * LOK_CALLBACK_INVALIDATE_TILES payload.
+ */
+ LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK = (1ULL << 2),
+
+ /**
+ * Turn off tile rendering for annotations
+ */
+ LOK_FEATURE_NO_TILED_ANNOTATIONS = (1ULL << 3),
+
+ /**
+ * Enable range based header data
+ */
+ LOK_FEATURE_RANGE_HEADERS = (1ULL << 4),
+
+ /**
+ * Request to have the active view's Id as the 1st value in the
+ * LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR payload.
+ */
+ LOK_FEATURE_VIEWID_IN_VISCURSOR_INVALIDATION_CALLBACK = (1ULL << 5)
+}
+LibreOfficeKitOptionalFeatures;
+
+// This enumerates the types of callbacks emitted to a LibreOfficeKit
+// object's callback function or to a LibreOfficeKitDocument object's
+// callback function. No callback type will be emitted to both. It is a
+// bit unfortunate that the same enum contains both kinds of
+// callbacks.
+
+// TODO: We should really add some indication at the documentation for
+// each enum value telling which type of callback it is.
+
+typedef enum
+{
+ /**
+ * Any tiles which are over the rectangle described in the payload are no
+ * longer valid.
+ *
+ * Rectangle format: "x, y, width, height", where all numbers are document
+ * coordinates, in twips. When all tiles are supposed to be dropped, the
+ * format is the "EMPTY" string.
+ *
+ * @see LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK.
+ */
+ LOK_CALLBACK_INVALIDATE_TILES = 0,
+ /**
+ * The size and/or the position of the visible cursor changed.
+ *
+ * Old format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+ * New format is a JSON with 3 elements the 'viewId' element represented by
+ * an integer value, a 'rectangle' element in the format "x, y, width, height",
+ * and a 'misspelledWord' element represented by an integer value: '1' when
+ * a misspelled word is at the cursor position, '0' when the word is
+ * not misspelled.
+ */
+ LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR = 1,
+ /**
+ * The list of rectangles representing the current text selection changed.
+ *
+ * List format is "rectangle1[; rectangle2[; ...]]" (without quotes and
+ * brackets), where rectangleN has the same format as
+ * LOK_CALLBACK_INVALIDATE_TILES. When there is no selection, an empty
+ * string is provided.
+ */
+ LOK_CALLBACK_TEXT_SELECTION = 2,
+ /**
+ * The position and size of the cursor rectangle at the text
+ * selection start. It is used to draw the selection handles.
+ *
+ * This callback must be called prior to LOK_CALLBACK_TEXT_SELECTION every
+ * time the selection is updated.
+ *
+ * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+ */
+ LOK_CALLBACK_TEXT_SELECTION_START = 3,
+ /**
+ * The position and size of the cursor rectangle at the text
+ * selection end. It is used to draw the selection handles.
+ *
+ * This callback must be called prior to LOK_CALLBACK_TEXT_SELECTION every
+ * time the selection is updated.
+ *
+ * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+ */
+ LOK_CALLBACK_TEXT_SELECTION_END = 4,
+ /**
+ * The blinking text cursor is now visible or not.
+ *
+ * Clients should assume that this is true initially and are expected to
+ * hide the blinking cursor at the rectangle described by
+ * LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR once it becomes false. Payload is
+ * either the "true" or the "false" string.
+ */
+ LOK_CALLBACK_CURSOR_VISIBLE = 5,
+ /**
+ * The size and/or the position of the graphic selection changed,
+ * the rotation angle of the embedded graphic object, and a property list
+ * which can be used for informing the client about several properties.
+ *
+ * Format is "x, y, width, height, angle, { list of properties }",
+ * where angle is in 100th of degree, and the property list is optional.
+ *
+ * The "{ list of properties }" part is in JSON format.
+ * Follow some examples of the property list part:
+ *
+ * 1) when the selected object is an image inserted in Writer:
+ *
+ * { "isWriterGraphic": true }
+ *
+ * 2) when the selected object is a chart legend:
+ *
+ * { "isDraggable": true, "isResizable": true, "isRotatable": false }
+ *
+ * 3) when the selected object is a pie segment in a chart:
+ *
+ * {
+ * "isDraggable": true,
+ * "isResizable": false,
+ * "isRotatable": false,
+ * "dragInfo": {
+ * "dragMethod": "PieSegmentDragging",
+ * "initialOffset": 50,
+ * "dragDirection": [x, y],
+ * "svg": "<svg ..."
+ * }
+ * }
+ *
+ * where the "svg" property is a string containing an svg document
+ * which is a representation of the pie segment.
+ */
+ LOK_CALLBACK_GRAPHIC_SELECTION = 6,
+
+ /**
+ * User clicked on a hyperlink that should be handled by other
+ * applications accordingly.
+ */
+ LOK_CALLBACK_HYPERLINK_CLICKED = 7,
+
+ /**
+ * Emit state update to the client.
+ * For example, when cursor is on bold text, this callback is triggered
+ * with payload: ".uno:Bold=true"
+ */
+ LOK_CALLBACK_STATE_CHANGED = 8,
+
+ /**
+ * Start a "status indicator" (here restricted to a progress bar type
+ * indicator). The payload is the descriptive text (or empty). Even if
+ * there is no documentation that would promise so, we assume that de facto
+ * for a document being viewed or edited, there will be at most one status
+ * indicator, and its descriptive text will not change.
+ *
+ * Note that for the case of the progress indication during loading of a
+ * document, the status indicator callbacks will arrive to the callback
+ * registered for the LibreOfficeKit (singleton) object, not a
+ * LibreOfficeKitDocument one, because we are in the very progress of
+ * loading a document and then constructing a LibreOfficeKitDocument
+ * object.
+ */
+ LOK_CALLBACK_STATUS_INDICATOR_START = 9,
+
+ /**
+ * Sets the numeric value of the status indicator.
+ * The payload should be a percentage, an integer between 0 and 100.
+ */
+ LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE = 10,
+
+ /**
+ * Ends the status indicator.
+ *
+ * Not necessarily ever emitted.
+ */
+ LOK_CALLBACK_STATUS_INDICATOR_FINISH = 11,
+
+ /**
+ * No match was found for the search input
+ */
+ LOK_CALLBACK_SEARCH_NOT_FOUND = 12,
+
+ /**
+ * Size of the document changed.
+ *
+ * Payload format is "width, height", i.e. clients get the new size without
+ * having to do an explicit lok::Document::getDocumentSize() call.
+ *
+ * A size change is always preceded by a series of
+ * LOK_CALLBACK_INVALIDATE_TILES events invalidating any areas
+ * need re-rendering to adapt.
+ */
+ LOK_CALLBACK_DOCUMENT_SIZE_CHANGED = 13,
+
+ /**
+ * The current part number is changed.
+ *
+ * Payload is a single 0-based integer.
+ */
+ LOK_CALLBACK_SET_PART = 14,
+
+ /**
+ * Selection rectangles of the search result when find all is performed.
+ *
+ * Payload format example, in case of two matches:
+ *
+ * {
+ * "searchString": "...",
+ * "highlightAll": true|false, // this is a result of 'search all'
+ * "searchResultSelection": [
+ * {
+ * "part": "...",
+ * "rectangles": "..."
+ * },
+ * {
+ * "part": "...",
+ * "rectangles": "..."
+ * }
+ * ]
+ * }
+ *
+ * - searchString is the search query
+ * - searchResultSelection is an array of part-number and rectangle list
+ * pairs, in LOK_CALLBACK_SET_PART / LOK_CALLBACK_TEXT_SELECTION format.
+ */
+ LOK_CALLBACK_SEARCH_RESULT_SELECTION = 15,
+
+ /**
+ * Result of the UNO command execution when bNotifyWhenFinished was set
+ * to 'true' during the postUnoCommand() call.
+ *
+ * The result returns a success / failure state, and potentially
+ * additional data:
+ *
+ * {
+ * "commandName": "...", // the command for which this is the result
+ * "success": true/false, // when the result is "don't know", this is missing
+ * // TODO "result": "..." // UNO Any converted to JSON (not implemented yet)
+ * }
+ */
+ LOK_CALLBACK_UNO_COMMAND_RESULT = 16,
+
+ /**
+ * The size and/or the position of the cell cursor changed.
+ *
+ * Payload format: "x, y, width, height, column, row", where the first
+ * 4 numbers are document coordinates, in twips, and the last 2 are table
+ * coordinates starting from 0.
+ * When the cursor is not shown the payload format is the "EMPTY" string.
+ *
+ * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+ */
+ LOK_CALLBACK_CELL_CURSOR = 17,
+
+ /**
+ * The current mouse pointer style.
+ *
+ * Payload is a css mouse pointer style.
+ */
+ LOK_CALLBACK_MOUSE_POINTER = 18,
+
+ /**
+ * The text content of the formula bar in Calc.
+ */
+ LOK_CALLBACK_CELL_FORMULA = 19,
+
+ /**
+ * Loading a document requires a password.
+ *
+ * Loading the document is blocked until the password is provided via
+ * lok::Office::setDocumentPassword(). The document cannot be loaded
+ * without the password.
+ */
+ LOK_CALLBACK_DOCUMENT_PASSWORD = 20,
+
+ /**
+ * Editing a document requires a password.
+ *
+ * Loading the document is blocked until the password is provided via
+ * lok::Office::setDocumentPassword().
+ */
+ LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY = 21,
+
+ /**
+ * An error happened.
+ *
+ * The payload returns information further identifying the error, like:
+ *
+ * {
+ * "classification": "error" | "warning" | "info"
+ * "kind": "network" etc.
+ * "code": a structured 32-bit error code, the ErrCode from LibreOffice's <tools/errcode.hxx>
+ * "message": freeform description
+ * }
+ */
+ LOK_CALLBACK_ERROR = 22,
+
+ /**
+ * Context menu structure
+ *
+ * Returns the structure of context menu. Contains all the separators &
+ * submenus, example of the returned structure:
+ *
+ * {
+ * "menu": [
+ * { "text": "label text1", "type": "command", "command": ".uno:Something1", "enabled": "true" },
+ * { "text": "label text2", "type": "command", "command": ".uno:Something2", "enabled": "false" },
+ * { "type": "separator" },
+ * { "text": "label text2", "type": "menu", "menu": [ { ... }, { ... }, ... ] },
+ * ...
+ * ]
+ * }
+ *
+ * The 'command' can additionally have a checkable status, like:
+ *
+ * {"text": "label text3", "type": "command", "command": ".uno:Something3", "checktype": "checkmark|radio|auto", "checked": "true|false"}
+ */
+ LOK_CALLBACK_CONTEXT_MENU = 23,
+
+ /**
+ * The size and/or the position of the view cursor changed. A view cursor
+ * is a cursor of another view, the current view can't change it.
+ *
+ * The payload format:
+ *
+ * {
+ * "viewId": "..."
+ * "rectangle": "..."
+ * }
+ *
+ * - viewId is a value returned earlier by lok::Document::createView()
+ * - rectangle uses the format of LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR
+ */
+ LOK_CALLBACK_INVALIDATE_VIEW_CURSOR = 24,
+
+ /**
+ * The text selection in one of the other views has changed.
+ *
+ * The payload format:
+ *
+ * {
+ * "viewId": "..."
+ * "selection": "..."
+ * }
+ *
+ * - viewId is a value returned earlier by lok::Document::createView()
+ * - selection uses the format of LOK_CALLBACK_TEXT_SELECTION.
+ */
+ LOK_CALLBACK_TEXT_VIEW_SELECTION = 25,
+
+ /**
+ * The cell cursor in one of the other views has changed.
+ *
+ * The payload format:
+ *
+ * {
+ * "viewId": "..."
+ * "rectangle": "..."
+ * }
+ *
+ * - viewId is a value returned earlier by lok::Document::createView()
+ * - rectangle uses the format of LOK_CALLBACK_CELL_CURSOR.
+ */
+ LOK_CALLBACK_CELL_VIEW_CURSOR = 26,
+
+ /**
+ * The size and/or the position of a graphic selection in one of the other
+ * views has changed.
+ *
+ * The payload format:
+ *
+ * {
+ * "viewId": "..."
+ * "selection": "..."
+ * }
+ *
+ * - viewId is a value returned earlier by lok::Document::createView()
+ * - selection uses the format of LOK_CALLBACK_INVALIDATE_TILES.
+ */
+ LOK_CALLBACK_GRAPHIC_VIEW_SELECTION = 27,
+
+ /**
+ * The blinking text cursor in one of the other views is now visible or
+ * not.
+ *
+ * The payload format:
+ *
+ * {
+ * "viewId": "..."
+ * "visible": "..."
+ * }
+ *
+ * - viewId is a value returned earlier by lok::Document::createView()
+ * - visible uses the format of LOK_CALLBACK_CURSOR_VISIBLE.
+ */
+ LOK_CALLBACK_VIEW_CURSOR_VISIBLE = 28,
+
+ /**
+ * The size and/or the position of a lock rectangle in one of the other
+ * views has changed.
+ *
+ * The payload format:
+ *
+ * {
+ * "viewId": "..."
+ * "rectangle": "..."
+ * }
+ *
+ * - viewId is a value returned earlier by lok::Document::createView()
+ * - rectangle uses the format of LOK_CALLBACK_INVALIDATE_TILES.
+ */
+ LOK_CALLBACK_VIEW_LOCK = 29,
+
+ /**
+ * The size of the change tracking table has changed.
+ *
+ * The payload example:
+ * {
+ * "redline": {
+ * "action": "Remove",
+ * "index": "1",
+ * "author": "Unknown Author",
+ * "type": "Delete",
+ * "comment": "",
+ * "description": "Delete 'abc'",
+ * "dateTime": "2016-08-18T12:14:00"
+ * }
+ * }
+ *
+ * The format is the same as an entry of
+ * lok::Document::getCommandValues('.uno:AcceptTrackedChanges'), extra
+ * fields:
+ *
+ * - 'action' is either 'Add' or 'Remove', depending on if this is an
+ * insertion into the table or a removal.
+ */
+ LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED = 30,
+
+ /**
+ * An entry in the change tracking table has been modified.
+ *
+ * The payload example:
+ * {
+ * "redline": {
+ * "action": "Modify",
+ * "index": "1",
+ * "author": "Unknown Author",
+ * "type": "Insert",
+ * "comment": "",
+ * "description": "Insert 'abcd'",
+ * "dateTime": "2016-08-18T13:13:00"
+ * }
+ * }
+ *
+ * The format is the same as an entry of
+ * lok::Document::getCommandValues('.uno:AcceptTrackedChanges'), extra
+ * fields:
+ *
+ * - 'action' is 'Modify'.
+ */
+ LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED = 31,
+
+ /**
+ * There is some change in comments in the document
+ *
+ * The payload example:
+ * {
+ * "comment": {
+ * "action": "Add",
+ * "id": "11",
+ * "parent": "4",
+ * "author": "Unknown Author",
+ * "text": "",
+ * "dateTime": "2016-08-18T13:13:00",
+ * "anchorPos": "4529, 3906",
+ * "textRange": "1418, 3906, 3111, 919"
+ * }
+ * }
+ *
+ * The format is the same as an entry of
+ * lok::Document::getCommandValues('.uno:ViewAnnotations'), extra
+ * fields:
+ *
+ * - 'action' can be 'Add', 'Remove' or 'Modify' depending on whether
+ * comment has been added, removed or modified.
+ */
+ LOK_CALLBACK_COMMENT = 32,
+
+ /**
+ * The column/row header is no more valid because of a column/row insertion
+ * or a similar event. Clients must query a new column/row header set.
+ *
+ * The payload says if we are invalidating a row or column header. So,
+ * payload values can be: "row", "column", "all".
+ */
+ LOK_CALLBACK_INVALIDATE_HEADER = 33,
+ /**
+ * The text content of the address field in Calc. Eg: "A7"
+ */
+ LOK_CALLBACK_CELL_ADDRESS = 34,
+ /**
+ * The key ruler related properties on change are reported by this.
+ *
+ * The payload format is:
+ *
+ * {
+ * "margin1": "...",
+ * "margin2": "...",
+ * "leftOffset": "...",
+ * "pageOffset": "...",
+ * "pageWidth": "...",
+ * "unit": "..."
+ * }
+ *
+ * Here all aproperties are same as described in svxruler.
+ */
+ LOK_CALLBACK_RULER_UPDATE = 35,
+ /**
+ * Window related callbacks are emitted under this category. It includes
+ * external windows like dialogs, autopopups for now.
+ *
+ * The payload format is:
+ *
+ * {
+ * "id": "unique integer id of the dialog",
+ * "action": "<see below>",
+ * "type": "<see below>"
+ * "rectangle": "x, y, width, height"
+ * }
+ *
+ * "type" tells the type of the window the action is associated with
+ * - "dialog" - window is a dialog
+ * - "child" - window is a floating window (combo boxes, etc.)
+ * - "deck" - window is a docked/floating deck (i.e. the sidebar)
+ * - "tooltip" - window is a tooltip popup
+ *
+ * "action" can take following values:
+ * - "created" - window is created in the backend, client can render it now
+ * - "title_changed" - window's title is changed
+ * - "size_changed" - window's size is changed
+ * - "invalidate" - the area as described by "rectangle" is invalidated
+ * Clients must request the new area
+ * - "cursor_invalidate" - cursor is invalidated. New position is in "rectangle"
+ * - "cursor_visible" - cursor visible status is changed. Status is available
+ * in "visible" field
+ * - "close" - window is closed
+ * - "show" - show the window
+ * - "hide" - hide the window
+ */
+ LOK_CALLBACK_WINDOW = 36,
+
+ /**
+ * When for the current cell is defined a validity list we need to show
+ * a drop down button in the form of a marker.
+ *
+ * The payload format is: "x, y, visible" where x, y are the current
+ * cell cursor coordinates and visible is set to 0 or 1.
+ */
+ LOK_CALLBACK_VALIDITY_LIST_BUTTON = 37,
+
+ /**
+ * Notification that the clipboard contents have changed.
+ * Typically fired in response to copying to clipboard.
+ *
+ * Payload is optional. When payload is empty, Online gets string from selected text.
+ * Payload format is JSON.
+ * Example: { "mimeType": "text/plain", "content": "some content" }
+ */
+ LOK_CALLBACK_CLIPBOARD_CHANGED = 38,
+
+ /**
+ * When the (editing) context changes - like the user switches from
+ * editing textbox in Impress to editing a shape there.
+ *
+ * Payload is the application ID and context, delimited by space.
+ * Eg. com.sun.star.presentation.PresentationDocument TextObject
+ */
+ LOK_CALLBACK_CONTEXT_CHANGED = 39,
+
+ /**
+ * On-load notification of the document signature status.
+ */
+ LOK_CALLBACK_SIGNATURE_STATUS = 40,
+
+ /**
+ * Profiling tracing information single string of multiple lines
+ * containing <pid> <timestamp> and zone start/stop information
+ */
+ LOK_CALLBACK_PROFILE_FRAME = 41,
+
+ /**
+ * The position and size of the cell selection area. It is used to
+ * draw the selection handles for cells in Calc documents.
+ *
+ * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+ */
+ LOK_CALLBACK_CELL_SELECTION_AREA = 42,
+
+ /**
+ * The position and size of the cell auto fill area. It is used to
+ * trigger auto fill functionality if that area is hit.
+ *
+ * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+ */
+ LOK_CALLBACK_CELL_AUTO_FILL_AREA = 43,
+
+ /**
+ * When the cursor is in a table or a table is selected in the
+ * document, this sends the table's column and row border positions
+ * to the client. If the payload is empty (empty JSON object), then
+ * no table is currently selected or the cursor is not inside a table
+ * cell.
+ */
+ LOK_CALLBACK_TABLE_SELECTED = 44,
+
+ /*
+ * Show reference marks from payload.
+ *
+ * Example payload:
+ * {
+ * "marks": [
+ * { "rectangle": "3825, 3315, 1245, 2010", "color": "0000ff", "part": "0" },
+ * { "rectangle": "8925, 4335, 2520, 735", "color": "ff0000", "part": "0" },
+ * ...
+ * ]
+ * }
+ */
+ LOK_CALLBACK_REFERENCE_MARKS = 45,
+
+ /**
+ * Callback related to native dialogs generated in JavaScript from
+ * the description.
+ */
+ LOK_CALLBACK_JSDIALOG = 46,
+
+ /**
+ * Send the list of functions whose name starts with the characters entered
+ * by the user in the formula input bar.
+ */
+ LOK_CALLBACK_CALC_FUNCTION_LIST = 47,
+
+ /**
+ * Sends the tab stop list for the current of the current cursor position.
+ */
+ LOK_CALLBACK_TAB_STOP_LIST = 48,
+
+ /**
+ * Sends all information for displaying form field button for a text based field.
+ *
+ * It contains the position where the frame with the button should be displayed and
+ * also contains all information that the popup window needs.
+ *
+ * The payload example:
+ * {
+ * "action": "show",
+ * "type": "drop-down",
+ * "textArea": "1418, 3906, 3111, 919",
+ * "params": {
+ * "items": ["January", "February", "July"],
+ * "selected": "2",
+ * "placeholder": "No items specified"
+ * }
+ * }
+ *
+ * or
+ * {
+ * "action": "hide",
+ * "type": "drop-down"
+ * }
+ */
+ LOK_CALLBACK_FORM_FIELD_BUTTON = 49,
+
+ /**
+ * This is Calc specific. Indicates that some or all of the current sheet's
+ * geometry data has changed. Clients must request a full or partial sheet
+ * geometry data set.
+ *
+ * The payload specifies what part of the sheet geometry data has changed.
+ * The payload format is:
+ * 'all|rows|columns [sizes [hidden [filtered [groups]]]]'
+ *
+ * For example, the payload 'rows sizes groups' indicates that the row heights
+ * and row-groups data have changed.
+ */
+ LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY = 50,
+
+ /**
+ * When for the current cell is defined an input help text.
+ *
+ * The payload format is JSON: { "title": "title text", "content": "content text" }
+ */
+ LOK_CALLBACK_VALIDITY_INPUT_HELP = 51,
+
+ /**
+ * This is currently Calc only. Indicates the document background
+ * color in the payload as a RGB hex string (RRGGBB).
+ */
+ LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR = 52,
+
+ /**
+ * When a user tries to use command which is restricted for that user
+ */
+ LOK_COMMAND_BLOCKED = 53,
+
+ /**
+ * The position of the cell cursor jumped to.
+ *
+ * Payload format: "x, y, width, height, column, row", where the first
+ * 4 numbers are document coordinates, in twips, and the last 2 are table
+ * coordinates starting from 0.
+ * When the cursor is not shown the payload format is the "EMPTY" string.
+ *
+ * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+ */
+ LOK_CALLBACK_SC_FOLLOW_JUMP = 54,
+
+ /**
+ * Sends all information for displaying metadata for a text based content control.
+ *
+ * Examples:
+ * Entered a rich text content control:
+ * {
+ * "action": "show",
+ * "rectangles": "1418, 1694, 720, 551; 10291, 1418, 1099, 275"
+ * }
+ *
+ * Left a rich text content control:
+ * {
+ * "action": "hide"
+ * }
+ *
+ * Entered a dropdown content control:
+ * {
+ * "action": "show",
+ * "rectangles": "...",
+ * "items": ["red", "green", "blue"]
+ * }
+ *
+ * Clicked on a picture content control's placeholder:
+ * {
+ * "action": "change-picture"
+ * }
+ *
+ * Entered a date content control:
+ * {
+ * "action": "show",
+ * "rectangles": "...",
+ * "date": "true"
+ * }
+ */
+ LOK_CALLBACK_CONTENT_CONTROL = 55,
+
+ /**
+ * This is Calc specific. The payload contains print ranges of all
+ * sheets in the document.
+ *
+ * Payload example:
+ * {
+ * "printranges" : [
+ * {
+ * "sheet": 0,
+ * "ranges": [
+ * [0, 0, 4, 5],
+ * [5, 100, 8, 150]
+ * ]
+ * },
+ * {
+ * "sheet": 3,
+ * "ranges": [
+ * [1, 0, 6, 10],
+ * [3, 200, 6, 230]
+ * ]
+ * }
+ * ]
+ * }
+ *
+ * The format of the inner "ranges" array for each sheet is
+ * [<startColumn>, <startRow>, <endColumn>, <endRow>]
+ */
+ LOK_CALLBACK_PRINT_RANGES = 56,
+}
+LibreOfficeKitCallbackType;
+
+typedef enum
+{
+ /// A key on the keyboard is pressed.
+ LOK_KEYEVENT_KEYINPUT,
+ /// A key on the keyboard is released.
+ LOK_KEYEVENT_KEYUP
+}
+LibreOfficeKitKeyEventType;
+
+typedef enum
+{
+ /// cf. SalEvent::ExtTextInput
+ LOK_EXT_TEXTINPUT,
+ /// cf. SalEvent::ExtTextInputPos
+ LOK_EXT_TEXTINPUT_POS,
+ /// cf. SalEvent::EndExtTextInput
+ LOK_EXT_TEXTINPUT_END
+}
+LibreOfficeKitExtTextInputType;
+
+/// Returns the string representation of a LibreOfficeKitCallbackType enumeration element.
+static inline const char* lokCallbackTypeToString(int nType)
+{
+ switch (static_cast<LibreOfficeKitCallbackType>(nType))
+ {
+ case LOK_CALLBACK_INVALIDATE_TILES:
+ return "LOK_CALLBACK_INVALIDATE_TILES";
+ case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR:
+ return "LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR";
+ case LOK_CALLBACK_TEXT_SELECTION:
+ return "LOK_CALLBACK_TEXT_SELECTION";
+ case LOK_CALLBACK_TEXT_SELECTION_START:
+ return "LOK_CALLBACK_TEXT_SELECTION_START";
+ case LOK_CALLBACK_TEXT_SELECTION_END:
+ return "LOK_CALLBACK_TEXT_SELECTION_END";
+ case LOK_CALLBACK_CURSOR_VISIBLE:
+ return "LOK_CALLBACK_CURSOR_VISIBLE";
+ case LOK_CALLBACK_VIEW_CURSOR_VISIBLE:
+ return "LOK_CALLBACK_VIEW_CURSOR_VISIBLE";
+ case LOK_CALLBACK_GRAPHIC_SELECTION:
+ return "LOK_CALLBACK_GRAPHIC_SELECTION";
+ case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION:
+ return "LOK_CALLBACK_GRAPHIC_VIEW_SELECTION";
+ case LOK_CALLBACK_CELL_CURSOR:
+ return "LOK_CALLBACK_CELL_CURSOR";
+ case LOK_CALLBACK_HYPERLINK_CLICKED:
+ return "LOK_CALLBACK_HYPERLINK_CLICKED";
+ case LOK_CALLBACK_MOUSE_POINTER:
+ return "LOK_CALLBACK_MOUSE_POINTER";
+ case LOK_CALLBACK_STATE_CHANGED:
+ return "LOK_CALLBACK_STATE_CHANGED";
+ case LOK_CALLBACK_STATUS_INDICATOR_START:
+ return "LOK_CALLBACK_STATUS_INDICATOR_START";
+ case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
+ return "LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE";
+ case LOK_CALLBACK_STATUS_INDICATOR_FINISH:
+ return "LOK_CALLBACK_STATUS_INDICATOR_FINISH";
+ case LOK_CALLBACK_SEARCH_NOT_FOUND:
+ return "LOK_CALLBACK_SEARCH_NOT_FOUND";
+ case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
+ return "LOK_CALLBACK_DOCUMENT_SIZE_CHANGED";
+ case LOK_CALLBACK_SET_PART:
+ return "LOK_CALLBACK_SET_PART";
+ case LOK_CALLBACK_SEARCH_RESULT_SELECTION:
+ return "LOK_CALLBACK_SEARCH_RESULT_SELECTION";
+ case LOK_CALLBACK_DOCUMENT_PASSWORD:
+ return "LOK_CALLBACK_DOCUMENT_PASSWORD";
+ case LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY:
+ return "LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY";
+ case LOK_CALLBACK_CONTEXT_MENU:
+ return "LOK_CALLBACK_CONTEXT_MENU";
+ case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR:
+ return "LOK_CALLBACK_INVALIDATE_VIEW_CURSOR";
+ case LOK_CALLBACK_TEXT_VIEW_SELECTION:
+ return "LOK_CALLBACK_TEXT_VIEW_SELECTION";
+ case LOK_CALLBACK_CELL_VIEW_CURSOR:
+ return "LOK_CALLBACK_CELL_VIEW_CURSOR";
+ case LOK_CALLBACK_CELL_ADDRESS:
+ return "LOK_CALLBACK_CELL_ADDRESS";
+ case LOK_CALLBACK_CELL_FORMULA:
+ return "LOK_CALLBACK_CELL_FORMULA";
+ case LOK_CALLBACK_UNO_COMMAND_RESULT:
+ return "LOK_CALLBACK_UNO_COMMAND_RESULT";
+ case LOK_CALLBACK_ERROR:
+ return "LOK_CALLBACK_ERROR";
+ case LOK_CALLBACK_VIEW_LOCK:
+ return "LOK_CALLBACK_VIEW_LOCK";
+ case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED:
+ return "LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED";
+ case LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED:
+ return "LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED";
+ case LOK_CALLBACK_INVALIDATE_HEADER:
+ return "LOK_CALLBACK_INVALIDATE_HEADER";
+ case LOK_CALLBACK_COMMENT:
+ return "LOK_CALLBACK_COMMENT";
+ case LOK_CALLBACK_RULER_UPDATE:
+ return "LOK_CALLBACK_RULER_UPDATE";
+ case LOK_CALLBACK_WINDOW:
+ return "LOK_CALLBACK_WINDOW";
+ case LOK_CALLBACK_VALIDITY_LIST_BUTTON:
+ return "LOK_CALLBACK_VALIDITY_LIST_BUTTON";
+ case LOK_CALLBACK_VALIDITY_INPUT_HELP:
+ return "LOK_CALLBACK_VALIDITY_INPUT_HELP";
+ case LOK_CALLBACK_CLIPBOARD_CHANGED:
+ return "LOK_CALLBACK_CLIPBOARD_CHANGED";
+ case LOK_CALLBACK_CONTEXT_CHANGED:
+ return "LOK_CALLBACK_CONTEXT_CHANGED";
+ case LOK_CALLBACK_SIGNATURE_STATUS:
+ return "LOK_CALLBACK_SIGNATURE_STATUS";
+ case LOK_CALLBACK_PROFILE_FRAME:
+ return "LOK_CALLBACK_PROFILE_FRAME";
+ case LOK_CALLBACK_CELL_SELECTION_AREA:
+ return "LOK_CALLBACK_CELL_SELECTION_AREA";
+ case LOK_CALLBACK_CELL_AUTO_FILL_AREA:
+ return "LOK_CALLBACK_CELL_AUTO_FILL_AREA";
+ case LOK_CALLBACK_TABLE_SELECTED:
+ return "LOK_CALLBACK_TABLE_SELECTED";
+ case LOK_CALLBACK_REFERENCE_MARKS:
+ return "LOK_CALLBACK_REFERENCE_MARKS";
+ case LOK_CALLBACK_JSDIALOG:
+ return "LOK_CALLBACK_JSDIALOG";
+ case LOK_CALLBACK_CALC_FUNCTION_LIST:
+ return "LOK_CALLBACK_CALC_FUNCTION_LIST";
+ case LOK_CALLBACK_TAB_STOP_LIST:
+ return "LOK_CALLBACK_TAB_STOP_LIST";
+ case LOK_CALLBACK_FORM_FIELD_BUTTON:
+ return "LOK_CALLBACK_FORM_FIELD_BUTTON";
+ case LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY:
+ return "LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY";
+ case LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR:
+ return "LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR";
+ case LOK_COMMAND_BLOCKED:
+ return "LOK_COMMAND_BLOCKED";
+ case LOK_CALLBACK_SC_FOLLOW_JUMP:
+ return "LOK_CALLBACK_SC_FOLLOW_JUMP";
+ case LOK_CALLBACK_CONTENT_CONTROL:
+ return "LOK_CALLBACK_CONTENT_CONTROL";
+ case LOK_CALLBACK_PRINT_RANGES:
+ return "LOK_CALLBACK_PRINT_RANGES";
+ }
+
+ assert(!"Unknown LibreOfficeKitCallbackType type.");
+ return nullptr;
+}
+
+typedef enum
+{
+ /// A mouse button has been pressed down.
+ LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
+ /// A mouse button has been let go.
+ LOK_MOUSEEVENT_MOUSEBUTTONUP,
+ /// The mouse has moved while a button is pressed.
+ LOK_MOUSEEVENT_MOUSEMOVE
+}
+LibreOfficeKitMouseEventType;
+
+typedef enum
+{
+ /// The start of selection is to be adjusted.
+ LOK_SETTEXTSELECTION_START,
+ /// The end of selection is to be adjusted.
+ LOK_SETTEXTSELECTION_END,
+ /// Both the start and the end of selection is to be adjusted.
+ LOK_SETTEXTSELECTION_RESET
+}
+LibreOfficeKitSetTextSelectionType;
+
+typedef enum
+{
+ /**
+ * A move or a resize action starts. It is assumed that there is a valid
+ * graphic selection (see LOK_CALLBACK_GRAPHIC_SELECTION) and the supplied
+ * coordinates are the ones the user tapped on.
+ *
+ * The type of the action is move by default, unless the coordinates are
+ * the position of a handle (see below), in which case it's a resize.
+ *
+ * There are 8 handles for a graphic selection:
+ * - top-left, top-center, top-right
+ * - middle-left, middle-right
+ * - bottom-left, bottom-center, bottom-right
+ */
+ LOK_SETGRAPHICSELECTION_START,
+ /**
+ * A move or resize action stops. It is assumed that this is always used
+ * only after a LOK_SETTEXTSELECTION_START. The supplied coordinates are
+ * the ones where the user released the screen.
+ */
+ LOK_SETGRAPHICSELECTION_END
+}
+LibreOfficeKitSetGraphicSelectionType;
+
+#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
new file mode 100644
index 000000000..83a2a1f75
--- /dev/null
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -0,0 +1,381 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITGTK_H
+#define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITGTK_H
+
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+
+#include <LibreOfficeKit/LibreOfficeKit.h>
+
+G_BEGIN_DECLS
+
+#define LOK_TYPE_DOC_VIEW (lok_doc_view_get_type())
+#define LOK_DOC_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LOK_TYPE_DOC_VIEW, LOKDocView))
+#define LOK_IS_DOC_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LOK_TYPE_DOC_VIEW))
+#define LOK_DOC_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LOK_TYPE_DOC_VIEW, LOKDocViewClass))
+#define LOK_IS_DOC_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), LOK_TYPE_DOC_VIEW))
+#define LOK_DOC_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), LOK_TYPE_DOC_VIEW, LOKDocViewClass))
+
+typedef struct _LOKDocView LOKDocView;
+typedef struct _LOKDocViewClass LOKDocViewClass;
+typedef struct _LOKDocViewPrivate LOKDocViewPrivate;
+
+struct _LOKDocView
+{
+ GtkDrawingArea aDrawingArea;
+};
+
+struct _LOKDocViewClass
+{
+ GtkDrawingAreaClass parent_class;
+};
+
+GType lok_doc_view_get_type (void) G_GNUC_CONST;
+
+/**
+ * lok_doc_view_new:
+ * @pPath: (nullable) (allow-none): LibreOffice install path. Pass null to set it to default
+ * path which in most cases would be $libdir/libreoffice/program
+ * @cancellable: The cancellable object that you can use to cancel this
+ * operation.
+ * @error: The error that will be set if the object fails to initialize.
+ *
+ * Returns: (transfer none): The #LOKDocView widget instance.
+ */
+GtkWidget* lok_doc_view_new (const gchar* pPath,
+ GCancellable *cancellable,
+ GError **error);
+
+/**
+ * lok_doc_view_new_from_user_profile:
+ * @pPath: (nullable) (allow-none): LibreOffice install path. Pass null to set it to default
+ * path which in most cases would be $libdir/libreoffice/program
+ * @pUserProfile: (nullable) (allow-none): User profile URL. Must be either a file URL or a
+ * special vnd.sun.star.pathname URL. Pass non-null to be able to use this
+ * widget and LibreOffice itself in parallel.
+ * @cancellable: The cancellable object that you can use to cancel this
+ * operation.
+ * @error: The error that will be set if the object fails to initialize.
+ *
+ * Returns: (transfer none): The #LOKDocView widget instance.
+ */
+GtkWidget* lok_doc_view_new_from_user_profile (const gchar* pPath,
+ const gchar* pUserProfile,
+ GCancellable *cancellable,
+ GError **error);
+
+/**
+ * lok_doc_view_new_from_widget:
+ * @pDocView: The #LOKDocView instance
+ * @pRenderingArguments: (nullable) (allow-none): lok::Document::initializeForRendering() arguments.
+ *
+ * Returns: (transfer none): The #LOKDocView widget instance.
+ */
+GtkWidget* lok_doc_view_new_from_widget (LOKDocView* pDocView,
+ const gchar* pRenderingArguments);
+
+/**
+ * lok_doc_view_open_document:
+ * @pDocView: The #LOKDocView instance
+ * @pPath: (transfer full): The path of the document that #LOKDocView widget should try to open
+ * @pRenderingArguments: (nullable) (allow-none): lok::Document::initializeForRendering() arguments.
+ * @cancellable:
+ * @callback:
+ * @userdata:
+ */
+void lok_doc_view_open_document (LOKDocView* pDocView,
+ const gchar* pPath,
+ const gchar* pRenderingArguments,
+ GCancellable* cancellable,
+ GAsyncReadyCallback callback,
+ gpointer userdata);
+
+/**
+ * lok_doc_view_open_document_finish:
+ * @pDocView: The #LOKDocView instance
+ * @res:
+ * @error:
+ *
+ * Returns: %TRUE if the document is loaded successfully, %FALSE otherwise
+ */
+gboolean lok_doc_view_open_document_finish (LOKDocView* pDocView,
+ GAsyncResult* res,
+ GError** error);
+
+/**
+ * lok_doc_view_get_document:
+ * @pDocView: The #LOKDocView instance
+ *
+ * Gets the document the viewer displays.
+ *
+ * Returns: The #LibreOfficeKitDocument instance the widget is currently showing
+ */
+LibreOfficeKitDocument* lok_doc_view_get_document (LOKDocView* pDocView);
+
+/**
+ * lok_doc_view_set_zoom:
+ * @pDocView: The #LOKDocView instance
+ * @fZoom: The new zoom level that pDocView must set it into.
+ *
+ * Sets the new zoom level for the widget. Does nothing if fZoom is equal to
+ * existing zoom level. Values outside the range [0.25, 5.0] are clamped into
+ * the nearest allowed value in the interval.
+ */
+void lok_doc_view_set_zoom (LOKDocView* pDocView,
+ float fZoom);
+/**
+ * lok_doc_view_set_visible_area:
+ * @pDocView: The #LOKDocView instance
+ * @pVisibleArea: The new visible area of pDocView in twips.
+ *
+ * Sets the new visible area of the widget. This helps e.g. the page down key
+ * to jump the correct length, which depends on the amount of visible height of
+ * the document.
+ */
+void lok_doc_view_set_visible_area (LOKDocView* pDocView,
+ GdkRectangle* pVisibleArea);
+
+/**
+ * lok_doc_view_get_zoom:
+ * @pDocView: The #LOKDocView instance
+ *
+ * Returns: The current zoom factor value in float for pDocView
+ */
+gfloat lok_doc_view_get_zoom (LOKDocView* pDocView);
+
+/**
+ * lok_doc_view_get_parts:
+ * @pDocView: The #LOKDocView instance
+ *
+ * Returns: Part refers to either individual sheets in a Calc, or slides in Impress,
+ * and has no relevance for Writer. Returns -1 if no document is set currently.
+ */
+gint lok_doc_view_get_parts (LOKDocView* pDocView);
+
+/**
+ * lok_doc_view_get_part:
+ * @pDocView: The #LOKDocView instance
+ *
+ * Returns: Current part number of the document. Returns -1 if no document is set currently.
+ */
+gint lok_doc_view_get_part (LOKDocView* pDocView);
+
+/**
+ * lok_doc_view_set_part:
+ * @pDocView: The #LOKDocView instance
+ * @nPart:
+ */
+void lok_doc_view_set_part (LOKDocView* pDocView,
+ int nPart);
+
+/**
+ * lok_doc_view_get_part_name:
+ * @pDocView: The #LOKDocView instance
+ * @nPart:
+ *
+ * Returns: Get current part name of loaded document. Returns null if no
+ * document is set, or document has been destroyed using lok_doc_view_destroy_document.
+ */
+gchar* lok_doc_view_get_part_name (LOKDocView* pDocView,
+ int nPart);
+
+/**
+ * lok_doc_view_set_partmode:
+ * @pDocView: The #LOKDocView instance
+ * @nPartMode:
+ */
+void lok_doc_view_set_partmode (LOKDocView* pDocView,
+ int nPartMode);
+
+/**
+ * lok_doc_view_reset_view:
+ * @pDocView: The #LOKDocView instance
+ */
+void lok_doc_view_reset_view (LOKDocView* pDocView);
+
+/**
+ * lok_doc_view_set_edit:
+ * @pDocView: The #LOKDocView instance
+ * @bEdit: %TRUE if the pDocView should go in edit mode, %FALSE otherwise
+ *
+ * Sets if the viewer is actually an editor or not.
+ */
+void lok_doc_view_set_edit (LOKDocView* pDocView,
+ gboolean bEdit);
+
+/**
+ * lok_doc_view_get_edit:
+ * @pDocView: The #LOKDocView instance
+ *
+ * Gets if the viewer is actually an editor or not.
+ *
+ * Returns: %TRUE if the given pDocView is in edit mode.
+ */
+gboolean lok_doc_view_get_edit (LOKDocView* pDocView);
+
+/**
+ * lok_doc_view_post_command:
+ * @pDocView: the #LOKDocView instance
+ * @pCommand: the command to issue to LO core
+ * @pArguments: the arguments to the given command
+ * @bNotifyWhenFinished: normally false, but it may be useful for eg. .uno:Save
+ *
+ * Posts the .uno: command to the LibreOfficeKit.
+ */
+void lok_doc_view_post_command (LOKDocView* pDocView,
+ const gchar* pCommand,
+ const gchar* pArguments,
+ gboolean bNotifyWhenFinished);
+
+/**
+ * lok_doc_view_get_command_values:
+ * @pDocView: the #LOKDocView instance
+ * @pCommand: the command to issue to LO core
+ *
+ * Get a json mapping of the possible values for the given command.
+ * In the form of: {commandName: unoCmd, commandValues: {possible_values}}
+ *
+ * Returns: A json mapping of the possible values for the given command
+ */
+gchar * lok_doc_view_get_command_values (LOKDocView* pDocView,
+ const gchar* pCommand);
+
+/**
+ * lok_doc_view_find_next:
+ * @pDocView: The #LOKDocView instance
+ * @pText: text to search for
+ * @bHighlightAll: Whether all the matches should be highlighted or not
+ *
+ * Highlights the next matching text in the view. `search-not-found` signal will
+ * be emitted when no search is found
+ */
+void lok_doc_view_find_next (LOKDocView* pDocView,
+ const gchar* pText,
+ gboolean bHighlightAll);
+
+/**
+ * lok_doc_view_find_prev:
+ * @pDocView: The #LOKDocView instance
+ * @pText: text to search for
+ * @bHighlightAll: Whether all the matches should be highlighted or not
+ *
+ * Highlights the previous matching text in the view. `search-not-found` signal
+ * will be emitted when no search is found
+ */
+void lok_doc_view_find_prev (LOKDocView* pDocView,
+ const gchar* pText,
+ gboolean bHighlightAll);
+
+/**
+ * lok_doc_view_highlight_all:
+ * @pDocView: The #LOKDocView instance
+ * @pText: text to search for
+ *
+ * Highlights all matching texts in the view. `search-not-found` signal
+ * will be emitted when no search is found
+ */
+void lok_doc_view_highlight_all (LOKDocView* pDocView,
+ const gchar* pText);
+
+/**
+ * lok_doc_view_copy_selection:
+ * @pDocView: The #LOKDocView instance
+ * @pMimeType: suggests the return format, for example text/plain;charset=utf-8
+ * @pUsedMimeType: (out): output parameter to inform about the determined format
+ * (suggested or plain text).
+ *
+ * Returns: Selected text. The caller must free the returned buffer after
+ * use. Returns null if no document is set.
+ */
+gchar* lok_doc_view_copy_selection (LOKDocView* pDocView,
+ const gchar* pMimeType,
+ gchar** pUsedMimeType);
+
+/**
+ * lok_doc_view_paste:
+ * @pDocView: The #LOKDocView instance
+ * @pMimeType: format of pData, for example text/plain;charset=utf-8
+ * @pData: the data to be pasted
+ * @nSize: length of data to be pasted
+ *
+ * Pastes the content at the current cursor position
+ *
+ * Returns: if pData was pasted successfully.
+ */
+gboolean lok_doc_view_paste (LOKDocView* pDocView,
+ const gchar* pMimeType,
+ const gchar* pData,
+ gsize nSize);
+
+/**
+ * lok_doc_view_set_document_password:
+ * @pDocView: The #LOKDocView instance
+ * @pURL: the URL of the document to set password for, as sent with signal `password-required`
+ * @pPassword: (nullable) (allow-none): the password, NULL for no password
+ *
+ * Set the password for password protected documents
+ */
+void lok_doc_view_set_document_password (LOKDocView* pDocView,
+ const gchar* pURL,
+ const gchar* pPassword);
+
+/**
+ * lok_doc_view_get_version_info:
+ * @pDocView: The #LOKDocView instance
+ *
+ * Get version information of the LOKit process
+ *
+ * Returns: JSON string containing version information in format:
+ * {ProductName: <>, ProductVersion: <>, ProductExtension: <>, BuildId: <>}
+ *
+ * Eg: {"ProductName": "LibreOffice",
+ * "ProductVersion": "5.3",
+ * "ProductExtension": ".0.0.alpha0",
+ * "BuildId": "<full 40 char git hash>"}
+ */
+gchar* lok_doc_view_get_version_info (LOKDocView* pDocView);
+
+/**
+ * lok_doc_view_pixel_to_twip:
+ * @pDocView: The #LOKDocView instance
+ * @fInput: The value in pixels to convert to twips
+ *
+ * Converts the value in pixels to twips according to zoom level.
+ *
+ * Returns: The corresponding value in twips
+ */
+gfloat lok_doc_view_pixel_to_twip (LOKDocView* pDocView,
+ float fInput);
+
+/**
+ * lok_doc_view_twip_to_pixel:
+ * @pDocView: The #LOKDocView instance
+ * @fInput: The value in twips to convert to pixels
+ *
+ * Converts the value in twips to pixels according to zoom level.
+ *
+ * Returns: The corresponding value in pixels
+ */
+gfloat lok_doc_view_twip_to_pixel (LOKDocView* pDocView,
+ float fInput);
+
+/**
+ * lok_doc_view_send_content_control_event:
+ * @pDocView: The #LOKDocView instance
+ * @pArguments: (nullable) (allow-none): see lok::Document::sendContentControlEvent() for the details.
+ */
+void lok_doc_view_send_content_control_event(LOKDocView* pDocView, const gchar* pArguments);
+
+G_END_DECLS
+
+#endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITGTK_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
new file mode 100644
index 000000000..5bbb722b5
--- /dev/null
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -0,0 +1,364 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITINIT_H
+#define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITINIT_H
+
+#include <LibreOfficeKit/LibreOfficeKit.h>
+
+#if defined __GNUC__ || defined __clang__
+# define LOK_TOLERATE_UNUSED __attribute__((used))
+#else
+# define LOK_TOLERATE_UNUSED
+#endif
+
+#if defined(__linux__) || defined (__FreeBSD__) || defined(_AIX) ||\
+ defined(_WIN32) || defined(__APPLE__) || defined (__NetBSD__) ||\
+ defined (__sun) || defined(__OpenBSD__)
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#ifndef _WIN32
+
+ #include <dlfcn.h>
+
+ #ifdef _AIX
+ # include <sys/ldr.h>
+ #endif
+ #ifdef __APPLE__
+ #define TARGET_LIB "lib" "sofficeapp" ".dylib"
+ #define TARGET_MERGED_LIB "lib" "mergedlo" ".dylib"
+ #else
+ #define TARGET_LIB "lib" "sofficeapp" ".so"
+ #define TARGET_MERGED_LIB "lib" "mergedlo" ".so"
+ #endif
+ #define SEPARATOR '/'
+
+#else
+
+ #if !defined WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+ #endif
+ #include <windows.h>
+ #define TARGET_LIB "sofficeapp" ".dll"
+ #define TARGET_MERGED_LIB "mergedlo" ".dll"
+ #define SEPARATOR '\\'
+ #define UNOPATH "\\..\\URE\\bin"
+
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef _WIN32
+
+#if !defined(IOS)
+ static void *lok_loadlib(const char *pFN)
+ {
+ return dlopen(pFN, RTLD_LAZY
+#if defined LOK_LOADLIB_GLOBAL
+ | RTLD_GLOBAL
+#endif
+ );
+ }
+
+ static char *lok_dlerror(void)
+ {
+ return dlerror();
+ }
+
+ // This function must be called to release memory allocated by lok_dlerror()
+ static void lok_dlerror_free(char *pErrMessage)
+ {
+ (void)pErrMessage;
+ // Do nothing for return of dlerror()
+ }
+
+ static void extendUnoPath(const char *pPath)
+ {
+ (void)pPath;
+ }
+
+ static void *lok_dlsym(void *Hnd, const char *pName)
+ {
+ return dlsym(Hnd, pName);
+ }
+
+ static int lok_dlclose(void *Hnd)
+ {
+ return dlclose(Hnd);
+ }
+#endif // IOS
+
+
+#else
+ static void *lok_loadlib(const char *pFN)
+ {
+ return (void *) LoadLibraryA(pFN);
+ }
+
+ static char *lok_dlerror(void)
+ {
+ LPSTR buf = NULL;
+ FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, GetLastError(), 0, reinterpret_cast<LPSTR>(&buf), 0, NULL);
+ return buf;
+ }
+
+ // This function must be called to release memory allocated by lok_dlerror()
+ static void lok_dlerror_free(char *pErrMessage)
+ {
+ HeapFree(GetProcessHeap(), 0, pErrMessage);
+ }
+
+ static void *lok_dlsym(void *Hnd, const char *pName)
+ {
+ return reinterpret_cast<void *>(GetProcAddress((HINSTANCE) Hnd, pName));
+ }
+
+ static int lok_dlclose(void *Hnd)
+ {
+ return FreeLibrary((HINSTANCE) Hnd);
+ }
+
+ static void extendUnoPath(const char *pPath)
+ {
+ char *sNewPath = NULL, *sEnvPath = NULL;
+ size_t size_sEnvPath = 0, buffer_size = 0;
+ DWORD cChars;
+
+ if (!pPath)
+ return;
+
+ cChars = GetEnvironmentVariableA("PATH", sEnvPath, 0);
+ if (cChars > 0)
+ {
+ sEnvPath = (char *) malloc(cChars);
+ cChars = GetEnvironmentVariableA("PATH", sEnvPath, cChars);
+ //If PATH is not set then it is no error
+ if (cChars == 0 && GetLastError() != ERROR_ENVVAR_NOT_FOUND)
+ {
+ free(sEnvPath);
+ return;
+ }
+ }
+ //prepare the new PATH. Add the Ure/bin directory at the front.
+ //note also adding ';'
+ if(sEnvPath)
+ size_sEnvPath = strlen(sEnvPath);
+ buffer_size = size_sEnvPath + 2*strlen(pPath) + strlen(UNOPATH) + 4;
+ sNewPath = (char *) malloc(buffer_size);
+ sNewPath[0] = L'\0';
+ strcat_s(sNewPath, buffer_size, pPath); // program to PATH
+ strcat_s(sNewPath, buffer_size, ";");
+ strcat_s(sNewPath, buffer_size, UNOPATH); // UNO to PATH
+ if (size_sEnvPath > 0)
+ {
+ strcat_s(sNewPath, buffer_size, ";");
+ strcat_s(sNewPath, buffer_size, sEnvPath);
+ }
+
+ SetEnvironmentVariableA("PATH", sNewPath);
+
+ free(sNewPath);
+ free(sEnvPath);
+ }
+#endif
+
+#if !defined(IOS)
+static void *lok_dlopen( const char *install_path, char ** _imp_lib )
+{
+ char *imp_lib;
+ void *dlhandle;
+
+ size_t partial_length, imp_lib_size;
+ struct stat dir_st;
+
+ *_imp_lib = NULL;
+
+ if (!install_path)
+ return NULL;
+
+ if (stat(install_path, &dir_st) != 0)
+ {
+ fprintf(stderr, "installation path \"%s\" does not exist\n", install_path);
+ return NULL;
+ }
+
+ // allocate large enough buffer
+ partial_length = strlen(install_path);
+ imp_lib_size = partial_length + sizeof(TARGET_LIB) + sizeof(TARGET_MERGED_LIB) + 2;
+ imp_lib = (char *) malloc(imp_lib_size);
+ if (!imp_lib)
+ {
+ fprintf( stderr, "failed to open library : not enough memory\n");
+ return NULL;
+ }
+
+ memcpy(imp_lib, install_path, partial_length);
+
+ extendUnoPath(install_path);
+
+ imp_lib[partial_length++] = SEPARATOR;
+ strncpy(imp_lib + partial_length, TARGET_LIB, imp_lib_size - partial_length);
+
+ dlhandle = lok_loadlib(imp_lib);
+ if (!dlhandle)
+ {
+ // If TARGET_LIB exists, and likely is a real library (not a
+ // small one-line text stub as in the --enable-mergedlib
+ // case), but dlopen failed for some reason, don't try
+ // TARGET_MERGED_LIB.
+ struct stat st;
+ if (stat(imp_lib, &st) == 0 && st.st_size > 100)
+ {
+ char *pErrMessage = lok_dlerror();
+ fprintf(stderr, "failed to open library '%s': %s\n",
+ imp_lib, pErrMessage);
+ lok_dlerror_free(pErrMessage);
+ free(imp_lib);
+ return NULL;
+ }
+
+ strncpy(imp_lib + partial_length, TARGET_MERGED_LIB, imp_lib_size - partial_length);
+
+ dlhandle = lok_loadlib(imp_lib);
+ if (!dlhandle)
+ {
+ char *pErrMessage = lok_dlerror();
+ fprintf(stderr, "failed to open library '%s': %s\n",
+ imp_lib, pErrMessage);
+ lok_dlerror_free(pErrMessage);
+ free(imp_lib);
+ return NULL;
+ }
+ }
+ *_imp_lib = imp_lib;
+ return dlhandle;
+}
+#endif
+
+typedef LibreOfficeKit *(LokHookFunction)( const char *install_path);
+
+typedef LibreOfficeKit *(LokHookFunction2)( const char *install_path, const char *user_profile_url );
+
+typedef int (LokHookPreInit) ( const char *install_path, const char *user_profile_url );
+
+typedef int (LokHookPreInit2) ( const char *install_path, const char *user_profile_url, LibreOfficeKit** kit);
+
+#if defined(IOS) || defined(ANDROID)
+LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* user_profile_path);
+#endif
+
+static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_profile_url )
+{
+#if !defined(IOS) && !defined(ANDROID)
+ void *dlhandle;
+ char *imp_lib;
+ LokHookFunction *pSym;
+ LokHookFunction2 *pSym2;
+
+ dlhandle = lok_dlopen(install_path, &imp_lib);
+ if (!dlhandle)
+ return NULL;
+
+ pSym2 = (LokHookFunction2 *) lok_dlsym(dlhandle, "libreofficekit_hook_2");
+ if (!pSym2)
+ {
+ if (user_profile_url != NULL)
+ {
+ fprintf( stderr, "the LibreOffice version in '%s' does not support passing a user profile to the hook function\n",
+ imp_lib );
+ lok_dlclose( dlhandle );
+ free( imp_lib );
+ return NULL;
+ }
+ pSym = (LokHookFunction *) lok_dlsym( dlhandle, "libreofficekit_hook" );
+ if (!pSym)
+ {
+ fprintf( stderr, "failed to find hook in library '%s'\n", imp_lib );
+ lok_dlclose( dlhandle );
+ free( imp_lib );
+ return NULL;
+ }
+ free( imp_lib );
+ // dlhandle is "leaked"
+ // coverity[leaked_storage] - on purpose
+ return pSym( install_path );
+ }
+
+ if (user_profile_url != NULL && user_profile_url[0] == '/')
+ {
+ // It should be either a file: URL or a vnd.sun.star.pathname: URL.
+ fprintf( stderr, "second parameter to lok_init_2 '%s' should be a URL, not a pathname\n", user_profile_url );
+ lok_dlclose( dlhandle );
+ free( imp_lib );
+ return NULL;
+ }
+
+ free( imp_lib );
+ // dlhandle is "leaked"
+ // coverity[leaked_storage] - on purpose
+ return pSym2( install_path, user_profile_url );
+#else
+ return libreofficekit_hook_2( install_path, user_profile_url );
+#endif
+}
+
+static LOK_TOLERATE_UNUSED
+LibreOfficeKit *lok_init( const char *install_path )
+{
+ return lok_init_2( install_path, NULL );
+}
+
+#if !defined(IOS)
+static LOK_TOLERATE_UNUSED
+int lok_preinit( const char *install_path, const char *user_profile_url )
+{
+ void *dlhandle;
+ char *imp_lib;
+ LokHookPreInit *pSym;
+
+ dlhandle = lok_dlopen(install_path, &imp_lib);
+ if (!dlhandle)
+ return -1;
+
+ pSym = (LokHookPreInit *) lok_dlsym(dlhandle, "lok_preinit");
+ if (!pSym)
+ {
+ fprintf( stderr, "failed to find pre-init hook in library '%s'\n", imp_lib );
+ lok_dlclose( dlhandle );
+ free( imp_lib );
+ return -1;
+ }
+
+ free( imp_lib );
+
+ // dlhandle is "leaked"
+ // coverity[leaked_storage] - on purpose
+ return pSym( install_path, user_profile_url );
+}
+#endif
+
+#undef SEPARATOR // It is used at least in enum class MenuItemType
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // defined(__linux__) || defined (__FreeBSD__) || defined(_AIX) || defined(_WIN32) || defined(__APPLE__)
+
+#endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITINIT_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/LibreOfficeKit/LibreOfficeKitTypes.h b/include/LibreOfficeKit/LibreOfficeKitTypes.h
new file mode 100644
index 000000000..8513ef754
--- /dev/null
+++ b/include/LibreOfficeKit/LibreOfficeKitTypes.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_TYPES_H
+#define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @see lok::Office::registerCallback().
+ @since LibreOffice 6.0
+ */
+typedef void (*LibreOfficeKitCallback)(int nType, const char* pPayload, void* pData);
+
+/** @see lok::Office::runLoop().
+ @since LibreOffice 6.3
+ */
+typedef int (*LibreOfficeKitPollCallback)(void* pData, int timeoutUs);
+typedef void (*LibreOfficeKitWakeCallback)(void* pData);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_TYPES_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/android/compatibility.hxx b/include/android/compatibility.hxx
new file mode 100644
index 000000000..bddb1b8f1
--- /dev/null
+++ b/include/android/compatibility.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <math.h>
+
+#if defined(ARM)
+#include <string>
+#include <sstream>
+#include <cstdlib>
+
+namespace std
+{
+inline double fmax(double x, double y) { return ::fmax(x, y); }
+
+template <typename T> T round(T x) { return ::round(x); }
+
+template <typename T> T trunc(T x) { return ::trunc(x); }
+
+template <typename T> T lround(T x) { return ::lround(x); }
+
+template <typename T> std::string to_string(const T& rNumber)
+{
+ std::ostringstream aStream;
+ aStream << rNumber;
+ return aStream.str();
+}
+}
+#endif
diff --git a/include/animations/animationnodehelper.hxx b/include/animations/animationnodehelper.hxx
new file mode 100644
index 000000000..eee41cd28
--- /dev/null
+++ b/include/animations/animationnodehelper.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
+#define INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+
+#include <vector>
+
+/* Declaration and definition of AnimationNode helper */
+
+namespace anim
+{
+ // TODO(Q1): this could possibly be implemented with a somewhat
+ // more lightweight template, by having the actual worker receive
+ // only a function pointer, and a thin templated wrapper around
+ // that which converts member functions into that.
+
+ /** pushes the given node to the given vector and recursively calls itself for each child node.
+ */
+ inline void create_deep_vector( const css::uno::Reference< css::animations::XAnimationNode >& xNode,
+ std::vector< css::uno::Reference< css::animations::XAnimationNode > >& rVector )
+ {
+ rVector.push_back( xNode );
+
+ try
+ {
+ // get an XEnumerationAccess to the children
+ css::uno::Reference< css::container::XEnumerationAccess >
+ xEnumerationAccess( xNode, css::uno::UNO_QUERY );
+
+ if( xEnumerationAccess.is() )
+ {
+ css::uno::Reference< css::container::XEnumeration >
+ xEnumeration = xEnumerationAccess->createEnumeration();
+
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ css::uno::Reference< css::animations::XAnimationNode >
+ xChildNode( xEnumeration->nextElement(),
+ css::uno::UNO_QUERY_THROW );
+
+ create_deep_vector( xChildNode, rVector );
+ }
+ }
+ }
+ }
+ catch( css::uno::Exception& )
+ {
+ }
+ }
+}
+
+#endif /* INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/apple_remote/RemoteControl.h b/include/apple_remote/RemoteControl.h
new file mode 100644
index 000000000..2d9c189b8
--- /dev/null
+++ b/include/apple_remote/RemoteControl.h
@@ -0,0 +1,117 @@
+/* -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*****************************************************************************
+ * RemoteControl.h
+ * RemoteControlWrapper
+ *
+ * Created by Martin Kahr on 11.03.06 under a MIT-style license.
+ * Copyright (c) 2006 martinkahr.com. All rights reserved.
+ *
+ * Code modified and adapted to OpenOffice.org
+ * by Eric Bachard on 11.08.2008 under the same License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#include <sal/config.h>
+
+#import <Cocoa/Cocoa.h>
+
+#include <sal/types.h>
+
+// notification names that are being used to signal that an application wants to
+// have access to the remote control device or if the application has finished
+// using the remote control device
+extern NSString* REQUEST_FOR_REMOTE_CONTROL_NOTIFICATION;
+extern NSString* FINISHED_USING_REMOTE_CONTROL_NOTIFICATION;
+
+// keys used in user objects for distributed notifications
+extern NSString* kRemoteControlDeviceName;
+extern NSString* kApplicationIdentifier;
+extern NSString* kTargetApplicationIdentifier;
+
+// we have a 6 bit offset to make a hold event out of a normal event
+#define EVENT_TO_HOLD_EVENT_OFFSET 6
+
+@class RemoteControl;
+
+typedef enum {
+ // normal events
+ kRemoteButtonPlus =1<<1,
+ kRemoteButtonMinus =1<<2,
+ kRemoteButtonMenu =1<<3,
+ kRemoteButtonPlay =1<<4,
+ kRemoteButtonRight =1<<5,
+ kRemoteButtonLeft =1<<6,
+
+ // hold events
+ kRemoteButtonPlus_Hold =1<<7,
+ kRemoteButtonMinus_Hold =1<<8,
+ kRemoteButtonMenu_Hold =1<<9,
+ kRemoteButtonPlay_Hold =1<<10,
+ kRemoteButtonRight_Hold =1<<11,
+ kRemoteButtonLeft_Hold =1<<12,
+
+ // special events (not supported by all devices)
+ kRemoteControl_Switched =1<<13,
+
+ // New values for the "metallic" Remote (2009 model)
+ kMetallicRemote2009ButtonPlay =1<<14,
+ kMetallicRemote2009ButtonMiddlePlay =1<<15
+
+} RemoteControlEventIdentifier;
+
+@interface NSObject(RemoteControlDelegate)
+
+- (void) sendRemoteButtonEvent: (RemoteControlEventIdentifier) event pressedDown: (BOOL) pressedDown remoteControl: (RemoteControl*) remoteControl;
+
+@end
+
+/*
+ Base Interface for Remote Control devices
+*/
+SAL_DLLPUBLIC_EXPORT @interface RemoteControl : NSObject {
+ id delegate;
+}
+
+// returns nil if the remote control device is not available
+- (id) initWithDelegate: (id) remoteControlDelegate;
+
+- (void) setListeningToRemote: (BOOL) value;
+- (BOOL) isListeningToRemote;
+
+- (BOOL) isOpenInExclusiveMode;
+- (void) setOpenInExclusiveMode: (BOOL) value;
+
+- (void) startListening: (id) sender;
+- (void) stopListening: (id) sender;
+
+// is this remote control sending the given event?
+- (BOOL) sendsEventForButtonIdentifier: (RemoteControlEventIdentifier) identifier;
+
+// sending of notifications between applications
++ (void) sendFinishedNotificationForAppIdentifier: (NSString*) identifier;
++ (void) sendRequestForRemoteControlNotification;
+
+// name of the device
++ (const char*) remoteControlDeviceName;
+
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/apple_remote/RemoteMainController.h b/include/apple_remote/RemoteMainController.h
new file mode 100644
index 000000000..3d1951d31
--- /dev/null
+++ b/include/apple_remote/RemoteMainController.h
@@ -0,0 +1,57 @@
+/* -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*****************************************************************************
+ * RemoteMainController.h
+ *
+ *
+ * Created by Martin Kahr on 11.03.06 under a MIT-style license.
+ * Copyright (c) 2006 martinkahr.com. All rights reserved.
+ *
+ * Code modified and adapted to OpenOffice.org
+ * by Eric Bachard on 11.08.2008 under the same License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#include <sal/config.h>
+
+#import <Cocoa/Cocoa.h>
+
+#include <sal/types.h>
+
+#define AppleRemoteControlEvent 15
+
+@class RemoteControl;
+@class MultiClickRemoteBehavior;
+
+//static void sendTheEvent( unichar, int );
+
+SAL_DLLPUBLIC_EXPORT @interface AppleRemoteMainController : NSObject
+{
+@public // else remoteControl is not reachable from GetSalData()->mpMainController
+ RemoteControl* remoteControl;
+@private
+ MultiClickRemoteBehavior* remoteControlBehavior;
+}
+- (RemoteControl*)remoteControl;
+- (MultiClickRemoteBehavior*)remoteBehavior;
+
+@end
+
+ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/MediaControlBase.hxx b/include/avmedia/MediaControlBase.hxx
new file mode 100644
index 000000000..1379a4364
--- /dev/null
+++ b/include/avmedia/MediaControlBase.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_AVMEDIA_MEDIACONTROLBASE_HXX
+#define INCLUDED_AVMEDIA_MEDIACONTROLBASE_HXX
+
+#include <config_options.h>
+#include <vcl/weld.hxx>
+
+#include <avmedia/avmediadllapi.h>
+
+namespace avmedia { class MediaItem; }
+
+#define AVMEDIA_TIME_RANGE 2048
+
+#define AVMEDIA_ZOOMLEVEL_50 0
+#define AVMEDIA_ZOOMLEVEL_100 1
+#define AVMEDIA_ZOOMLEVEL_200 2
+#define AVMEDIA_ZOOMLEVEL_FIT 3
+#define AVMEDIA_ZOOMLEVEL_SCALED 4
+#define AVMEDIA_ZOOMLEVEL_INVALID 65535
+
+namespace avmedia {
+
+enum class MediaControlStyle
+{
+ SingleLine = 0,
+ MultiLine = 1
+};
+
+class UNLESS_MERGELIBS(AVMEDIA_DLLPUBLIC) MediaControlBase
+{
+public:
+ MediaControlBase();
+ virtual ~MediaControlBase(){};
+
+protected:
+ std::unique_ptr<weld::Toolbar> mxPlayToolBox;
+ std::unique_ptr<weld::Scale> mxTimeSlider;
+ std::unique_ptr<weld::Toolbar> mxMuteToolBox;
+ std::unique_ptr<weld::Scale> mxVolumeSlider;
+ std::unique_ptr<weld::ComboBox> mxZoomListBox;
+ std::unique_ptr<weld::Entry> mxTimeEdit;
+ bool mbCurrentlySettingZoom;
+
+ virtual void InitializeWidgets();
+ virtual void UpdateToolBoxes(const MediaItem& rMediaItem);
+ void UpdateVolumeSlider( MediaItem const & aMediaItem );
+ void UpdateTimeSlider( MediaItem const & aMediaItem );
+ void UpdateTimeField( MediaItem const & aMediaItem, double fTime );
+ void UpdatePlayState(const MediaItem& rMediaItem);
+ void SelectPlayToolBoxItem( MediaItem& aExecItem, MediaItem const & aItem, std::string_view rId);
+ void disposeWidgets();
+};
+
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/avmediadllapi.h b/include/avmedia/avmediadllapi.h
new file mode 100644
index 000000000..abe4fb48c
--- /dev/null
+++ b/include/avmedia/avmediadllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_AVMEDIA_AVMEDIADLLAPI_H
+#define INCLUDED_AVMEDIA_AVMEDIADLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(AVMEDIA_DLLIMPLEMENTATION)
+#define AVMEDIA_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define AVMEDIA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define AVMEDIA_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_AVMEDIA_AVMEDIADLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediaitem.hxx b/include/avmedia/mediaitem.hxx
new file mode 100644
index 000000000..bbb5e06e4
--- /dev/null
+++ b/include/avmedia/mediaitem.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_AVMEDIA_MEDIAITEM_HXX
+#define INCLUDED_AVMEDIA_MEDIAITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <com/sun/star/media/ZoomLevel.hpp>
+#include <avmedia/avmediadllapi.h>
+#include <memory>
+#include <string_view>
+
+#include <o3tl/typed_flags_set.hxx>
+#include <utility>
+
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::io { class XStream; }
+namespace com::sun::star::text { struct GraphicCrop; }
+class Graphic;
+
+enum class AVMediaSetMask
+{
+ NONE = 0x000,
+ STATE = 0x001,
+ DURATION = 0x002,
+ TIME = 0x004,
+ LOOP = 0x008,
+ MUTE = 0x010,
+ VOLUMEDB = 0x020,
+ ZOOM = 0x040,
+ URL = 0x080,
+ MIME_TYPE = 0x100,
+ GRAPHIC = 0x200,
+ CROP = 0x400,
+ ALL = 0x7ff,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<AVMediaSetMask> : is_typed_flags<AVMediaSetMask, 0x7ff> {};
+}
+
+
+namespace avmedia
+{
+
+
+enum class MediaState
+{
+ Stop, Play, Pause
+};
+
+
+class AVMEDIA_DLLPUBLIC MediaItem final : public SfxPoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit MediaItem( sal_uInt16 i_nWhich = 0,
+ AVMediaSetMask nMaskSet = AVMediaSetMask::NONE );
+ MediaItem( const MediaItem& rMediaItem );
+ virtual ~MediaItem() override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual MediaItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreUnit,
+ MapUnit ePresUnit,
+ OUString& rText,
+ const IntlWrapper& rIntl ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ bool merge(const MediaItem& rMediaItem);
+
+ AVMediaSetMask getMaskSet() const;
+
+ bool setState(MediaState eState);
+ MediaState getState() const;
+
+ bool setDuration(double fDuration);
+ double getDuration() const;
+
+ bool setTime(double fTime);
+ double getTime() const;
+
+ bool setLoop(bool bLoop);
+ bool isLoop() const;
+
+ bool setMute(bool bMute);
+ bool isMute() const;
+
+ bool setVolumeDB(sal_Int16 nDB);
+ sal_Int16 getVolumeDB() const;
+
+ bool setZoom(css::media::ZoomLevel eZoom);
+ ::css::media::ZoomLevel getZoom() const;
+
+ bool setURL(const OUString& rURL,
+ const OUString& rTempURL,
+ const OUString& rReferer);
+ const OUString& getURL() const;
+
+ bool setMimeType(const OUString& rMimeType);
+ OUString getMimeType() const;
+ bool setGraphic(const Graphic& rGraphic);
+ const Graphic & getGraphic() const;
+ bool setCrop(const css::text::GraphicCrop& rCrop);
+ const css::text::GraphicCrop& getCrop() const;
+ const OUString& getTempURL() const;
+
+ const OUString& getReferer() const;
+
+private:
+
+ struct Impl;
+ std::unique_ptr<Impl> m_pImpl;
+};
+
+typedef ::avmedia::MediaItem avmedia_MediaItem;
+
+bool AVMEDIA_DLLPUBLIC EmbedMedia(
+ const ::css::uno::Reference< ::css::frame::XModel>& xModel,
+ const OUString& rSourceURL,
+ OUString & o_rEmbeddedURL,
+ ::css::uno::Reference<::css::io::XInputStream> const& xInputStream =
+ ::css::uno::Reference<::css::io::XInputStream>());
+
+bool AVMEDIA_DLLPUBLIC CreateMediaTempFile(
+ ::css::uno::Reference<::css::io::XInputStream> const& xInStream,
+ OUString& o_rTempFileURL,
+ std::u16string_view rDesiredExtension);
+
+OUString GetFilename(OUString const& rSourceURL);
+
+::css::uno::Reference< ::css::io::XStream> CreateStream(
+ const ::css::uno::Reference< ::css::embed::XStorage>& xStorage, const OUString& rFilename);
+
+struct AVMEDIA_DLLPUBLIC MediaTempFile
+{
+ OUString const m_TempFileURL;
+ MediaTempFile(OUString aURL)
+ : m_TempFileURL(std::move(aURL))
+ {}
+ ~MediaTempFile();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediaplayer.hxx b/include/avmedia/mediaplayer.hxx
new file mode 100644
index 000000000..52ecd942e
--- /dev/null
+++ b/include/avmedia/mediaplayer.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_AVMEDIA_MEDIAPLAYER_HXX
+#define INCLUDED_AVMEDIA_MEDIAPLAYER_HXX
+
+#include <sfx2/dockwin.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <avmedia/avmediadllapi.h>
+#include <memory>
+
+namespace avmedia
+{
+
+class AVMEDIA_DLLPUBLIC MediaPlayer final : public SfxChildWindow
+{
+public:
+ MediaPlayer( vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
+ virtual ~MediaPlayer() override;
+
+ SFX_DECL_CHILDWINDOW_WITHID( MediaPlayer );
+};
+
+class MediaWindow;
+
+class AVMEDIA_DLLPUBLIC MediaFloater final : public SfxDockingWindow
+{
+public:
+
+ MediaFloater( SfxBindings* pBindings, SfxChildWindow* pCW, vcl::Window* pParent );
+ virtual ~MediaFloater() override;
+ virtual void dispose() override;
+
+ void setURL( const OUString& rURL, const OUString& rReferer, bool bPlayImmediately );
+
+ void dispatchCurrentURL();
+
+private:
+
+ virtual void Resize() override;
+ virtual void ToggleFloatingMode() override;
+
+ std::unique_ptr<MediaWindow> mpMediaWindow;
+};
+
+inline MediaFloater * getMediaFloater() {
+ SfxViewFrame * cur = SfxViewFrame::Current();
+ if (cur != nullptr) {
+ SfxChildWindow * win = cur->GetChildWindow(
+ MediaPlayer::GetChildWindowId());
+ if (win != nullptr) {
+ return static_cast<MediaFloater *>(win->GetWindow());
+ }
+ }
+ return nullptr;
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediatoolbox.hxx b/include/avmedia/mediatoolbox.hxx
new file mode 100644
index 000000000..434d202ca
--- /dev/null
+++ b/include/avmedia/mediatoolbox.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_AVMEDIA_MEDIATOOLBOX_HXX
+#define INCLUDED_AVMEDIA_MEDIATOOLBOX_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include <avmedia/avmediadllapi.h>
+
+namespace avmedia
+{
+
+class MediaItem;
+
+class AVMEDIA_DLLPUBLIC MediaToolBoxControl final : public SfxToolBoxControl
+{
+ friend class MediaToolBoxControl_Impl;
+
+public:
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ MediaToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbX );
+ virtual ~MediaToolBoxControl() override;
+
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
+ virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window* pParent ) override;
+
+private:
+
+ AVMEDIA_DLLPRIVATE void implUpdateMediaControl();
+ AVMEDIA_DLLPRIVATE void implExecuteMediaControl( const MediaItem& rItem );
+};
+
+}
+
+#endif // INCLUDED_AVMEDIA_MEDIATOOLBOX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx
new file mode 100644
index 000000000..e8515d77f
--- /dev/null
+++ b/include/avmedia/mediawindow.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_AVMEDIA_MEDIAWINDOW_HXX
+#define INCLUDED_AVMEDIA_MEDIAWINDOW_HXX
+
+#include <vector>
+#include <tools/gen.hxx>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/media/XPlayerListener.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <vcl/vclptr.hxx>
+#include <avmedia/avmediadllapi.h>
+
+#define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0
+
+namespace com::sun::star::frame { class XDispatchProvider; }
+namespace com::sun::star::graphic { class XGraphic; }
+namespace com::sun::star::media {
+ class XPlayer;
+ class XPlayerNotifier;
+}
+
+namespace vcl { class Window; }
+namespace weld { class Window; }
+class KeyEvent;
+class MouseEvent;
+class CommandEvent;
+struct AcceptDropEvent;
+struct ExecuteDropEvent;
+enum class PointerStyle;
+
+namespace avmedia
+{
+ typedef ::std::vector< ::std::pair< OUString, OUString > > FilterNameVector;
+
+ class MediaItem;
+
+ namespace priv { class MediaWindowImpl; }
+
+ typedef cppu::WeakComponentImplHelper<css::media::XPlayerListener> PlayerListener_BASE;
+
+ class AVMEDIA_DLLPUBLIC PlayerListener final : public cppu::BaseMutex, public PlayerListener_BASE
+ {
+ private:
+ css::uno::Reference<css::media::XPlayerNotifier> m_xNotifier;
+ std::function<void(const css::uno::Reference<css::media::XPlayer>&)> m_aFn;
+
+ using WeakComponentImplHelperBase::disposing;
+ public:
+ PlayerListener(std::function<void(const css::uno::Reference<css::media::XPlayer>&)> fn);
+ virtual void SAL_CALL dispose() override;
+ virtual ~PlayerListener() override;
+
+ virtual void SAL_CALL preferredPlayerWindowSizeAvailable(const css::lang::EventObject& rSource) override;
+ virtual void SAL_CALL disposing(const css::lang::EventObject& rSource) override;
+
+ void startListening(const css::uno::Reference<css::media::XPlayerNotifier>& rNotifier);
+ void stopListening();
+
+ void callPlayerWindowSizeAvailable(const css::uno::Reference<css::media::XPlayer>& rPlayer) { m_aFn(rPlayer); }
+ };
+
+ class AVMEDIA_DLLPUBLIC MediaWindow
+ {
+ public:
+ MediaWindow( vcl::Window* parent, bool bInternalMediaControl );
+ virtual ~MediaWindow();
+
+ void setURL( const OUString& rURL, const OUString& rReferer );
+ const OUString& getURL() const;
+
+ bool isValid() const;
+ Size getPreferredSize() const;
+
+ vcl::Window* getWindow() const;
+
+ void setPosSize( const tools::Rectangle& rNewRect );
+
+ void setPointer( PointerStyle aPointer );
+
+ bool start();
+
+ void updateMediaItem( MediaItem& rItem ) const;
+ void executeMediaItem( const MediaItem& rItem );
+
+ void show();
+ void hide();
+ bool isVisible() const;
+
+ public:
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void KeyUp( const KeyEvent& rKEvt );
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ public:
+
+ static FilterNameVector getMediaFilters();
+ /// @param o_pbLink if not 0, this is an "insert" dialog: display link
+ /// checkbox and store its state in *o_pbLink
+ static bool executeMediaURLDialog(weld::Window* pParent, OUString& rURL, bool *const o_pbLink);
+ static void executeFormatErrorBox(weld::Window* pParent);
+ static bool isMediaURL(std::u16string_view rURL, const OUString& rReferer, bool bDeep = false,
+ rtl::Reference<PlayerListener> xPreferredPixelSizeListener = nullptr);
+
+ static css::uno::Reference< css::media::XPlayer > createPlayer( const OUString& rURL, const OUString& rReferer, const OUString* pMimeType = nullptr );
+
+ static css::uno::Reference<css::graphic::XGraphic>
+ grabFrame(const css::uno::Reference<css::media::XPlayer>& rPlayer,
+ const css::uno::Reference<css::graphic::XGraphic>& rGraphic = nullptr);
+
+ static css::uno::Reference< css::graphic::XGraphic > grabFrame(const OUString& rURL, const OUString& rReferer,
+ const OUString& sMimeType, rtl::Reference<PlayerListener> xPreferredPixelSizeListener);
+
+ static void dispatchInsertAVMedia(const css::uno::Reference<css::frame::XDispatchProvider>&,
+ const css::awt::Size& rSize, const OUString& rURL, bool bLink);
+
+ private:
+ MediaWindow(const MediaWindow&) = delete;
+ MediaWindow& operator =( const MediaWindow& ) = delete;
+
+ VclPtr<priv::MediaWindowImpl> mpImpl;
+ };
+
+}
+
+#endif // INCLUDED_AVMEDIA_MEDIAWINDOW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/DrawCommands.hxx b/include/basegfx/DrawCommands.hxx
new file mode 100644
index 000000000..14d3ad245
--- /dev/null
+++ b/include/basegfx/DrawCommands.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_BASEGFX_DRAWCOMMANDS_H
+#define INCLUDED_BASEGFX_DRAWCOMMANDS_H
+
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+namespace gfx
+{
+class DrawBase;
+
+class DrawCommand
+{
+public:
+ std::vector<std::shared_ptr<DrawBase>> maChildren;
+};
+
+enum class DrawCommandType
+{
+ Root,
+ Rectangle,
+ Path
+};
+
+enum class GradientType
+{
+ Linear
+};
+
+class GradientStop
+{
+public:
+ basegfx::BColor maColor;
+ float mfOffset;
+ float mfOpacity;
+};
+
+class GradientInfo
+{
+public:
+ GradientType meType;
+
+ std::vector<GradientStop> maGradientStops;
+
+ GradientInfo(GradientType eType)
+ : meType(eType)
+ {
+ }
+};
+
+class LinearGradientInfo : public GradientInfo
+{
+public:
+ LinearGradientInfo()
+ : GradientInfo(GradientType::Linear)
+ , x1(0.0)
+ , y1(0.0)
+ , x2(0.0)
+ , y2(0.0)
+ {
+ }
+
+ double x1;
+ double y1;
+ double x2;
+ double y2;
+
+ basegfx::B2DHomMatrix maMatrix;
+};
+
+class DrawBase : public DrawCommand
+{
+private:
+ DrawCommandType meType;
+
+public:
+ DrawBase(DrawCommandType eType)
+ : meType(eType)
+ {
+ }
+
+ DrawCommandType getType() const { return meType; }
+};
+
+class DrawRoot : public DrawBase
+{
+public:
+ basegfx::B2DRange maRectangle;
+
+ DrawRoot()
+ : DrawBase(DrawCommandType::Root)
+ {
+ }
+};
+
+class DrawRectangle : public DrawBase
+{
+public:
+ basegfx::B2DRange maRectangle;
+ double mnRx;
+ double mnRy;
+
+ double mnStrokeWidth;
+ double mnOpacity;
+ std::shared_ptr<basegfx::BColor> mpFillColor;
+ std::shared_ptr<basegfx::BColor> mpStrokeColor;
+ std::shared_ptr<GradientInfo> mpFillGradient;
+
+ DrawRectangle(basegfx::B2DRange const& rRectangle)
+ : DrawBase(DrawCommandType::Rectangle)
+ , maRectangle(rRectangle)
+ , mnRx(1.0)
+ , mnRy(1.0)
+ , mnStrokeWidth(1.0)
+ , mnOpacity(1.0)
+ {
+ }
+};
+
+class DrawPath : public DrawBase
+{
+public:
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ double mnStrokeWidth;
+ double mnOpacity;
+ std::shared_ptr<basegfx::BColor> mpFillColor;
+ std::shared_ptr<basegfx::BColor> mpStrokeColor;
+ std::shared_ptr<GradientInfo> mpFillGradient;
+
+ DrawPath(basegfx::B2DPolyPolygon aPolyPolygon)
+ : DrawBase(DrawCommandType::Path)
+ , maPolyPolygon(std::move(aPolyPolygon))
+ , mnStrokeWidth(1.0)
+ , mnOpacity(1.0)
+ {
+ }
+};
+
+} // end namespace gfx
+
+#endif // INCLUDED_BASEGFX_DRAWCOMMANDS_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/basegfxdllapi.h b/include/basegfx/basegfxdllapi.h
new file mode 100644
index 000000000..b1ef1709b
--- /dev/null
+++ b/include/basegfx/basegfxdllapi.h
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEGFX_BASEGFXDLLAPI_H
+#define INCLUDED_BASEGFX_BASEGFXDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined BASEGFX_STATICLIBRARY
+
+#define BASEGFX_DLLPUBLIC
+#define BASEGFX_DLLPRIVATE
+
+#else /*BASEGFX_STATICLIBRARY*/
+
+#if defined BASEGFX_DLLIMPLEMENTATION
+#define BASEGFX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define BASEGFX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define BASEGFX_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /*BASEGFX_STATICLIBRARY*/
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/color/bcolor.hxx b/include/basegfx/color/bcolor.hxx
new file mode 100644
index 000000000..d8788b1cf
--- /dev/null
+++ b/include/basegfx/color/bcolor.hxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <algorithm>
+#include <ostream>
+
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ /** Base Color class with three double values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3DTuple. All necessary extensions
+ which are special for colors will be added here.
+
+ @see B3DTuple
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC BColor : public B3DTuple
+ {
+ public:
+ /** Create a Color with red, green and blue components from [0.0 to 1.0]
+
+ The color is initialized to (0.0, 0.0, 0.0)
+ */
+ BColor()
+ {}
+
+ /** Create a 3D Color
+
+ @param fRed
+ @param fGreen
+ @param fBlue
+ These parameters are used to initialize the red, green and blue intensities of the color
+ */
+ BColor(double fRed, double fGreen, double fBlue)
+ : B3DTuple(fRed, fGreen, fBlue)
+ {}
+
+ /** Create a 3D Color
+
+ @param fLuminosity
+ The parameter is used to initialize the red, green and blue intensities of the color
+ */
+ explicit BColor(double fLuminosity)
+ : B3DTuple(fLuminosity, fLuminosity, fLuminosity)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3DTuple-based classes
+ */
+ BColor(const ::basegfx::B3DTuple& rTuple)
+ : B3DTuple(rTuple)
+ {}
+
+ // data access read
+ double getRed() const { return mfX; }
+ double getGreen() const { return mfY; }
+ double getBlue() const { return mfZ; }
+
+ // data access write
+ void setRed(double fNew) { mfX = fNew; }
+ void setGreen(double fNew) { mfY = fNew; }
+ void setBlue(double fNew) { mfZ = fNew; }
+
+ /** *=operator to allow usage from BColor, too
+ */
+ BColor& operator*=( const BColor& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ mfZ *= rPnt.mfZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from BColor, too
+ */
+ BColor& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3DTuple calculations
+ */
+ BColor& operator=( const ::basegfx::B3DTuple& rVec )
+ {
+ mfX = rVec.getX();
+ mfY = rVec.getY();
+ mfZ = rVec.getZ();
+ return *this;
+ }
+
+ // luminance
+ double luminance() const
+ {
+ const double fRedWeight(77.0 / 256.0); // 0.30
+ const double fGreenWeight(151.0 / 256.0); // 0.59
+ const double fBlueWeight(28.0 / 256.0); // 0.11
+
+ return (mfX * fRedWeight + mfY * fGreenWeight + mfZ * fBlueWeight);
+ }
+
+ // distances in color space
+ double getDistanceRed(const BColor& rColor) const { return (getRed() > rColor.getRed() ? getRed() - rColor.getRed() : rColor.getRed() - getRed()); }
+ double getDistanceGreen(const BColor& rColor) const { return (getGreen() > rColor.getGreen() ? getGreen() - rColor.getGreen() : rColor.getGreen() - getGreen()); }
+ double getDistanceBlue(const BColor& rColor) const { return (getBlue() > rColor.getBlue() ? getBlue() - rColor.getBlue() : rColor.getBlue() - getBlue()); }
+
+ double getDistance(const BColor& rColor) const
+ {
+ const double fDistR(getDistanceRed(rColor));
+ const double fDistG(getDistanceGreen(rColor));
+ const double fDistB(getDistanceBlue(rColor));
+
+ return sqrt(fDistR * fDistR + fDistG * fDistG + fDistB * fDistB);
+ }
+
+ double getMaximumDistance(const BColor& rColor) const
+ {
+ const double fDistR(getDistanceRed(rColor));
+ const double fDistG(getDistanceGreen(rColor));
+ const double fDistB(getDistanceBlue(rColor));
+
+ double fRetval(std::max(fDistR, fDistG));
+ return std::max(fRetval, fDistB);
+ }
+
+ // clamp color to [0.0..1.0] values in all three intensity components
+ BColor& clamp()
+ {
+ mfX = std::clamp(mfX, 0.0, 1.0);
+ mfY = std::clamp(mfY, 0.0, 1.0);
+ mfZ = std::clamp(mfZ, 0.0, 1.0);
+ return *this;
+ }
+
+ void invert()
+ {
+ mfX = 1.0 - mfX;
+ mfY = 1.0 - mfY;
+ mfZ = 1.0 - mfZ;
+ }
+
+ static const BColor& getEmptyBColor()
+ {
+ return static_cast<const BColor&>( ::basegfx::B3DTuple::getEmptyTuple() );
+ }
+
+ };
+
+ template<typename charT, typename traits>
+ std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, BColor const & color)
+ {
+ return stream
+ << '[' << color.getRed() << ", " << color.getGreen() << ", "
+ << color.getBlue() << ']';
+ }
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/color/bcolormodifier.hxx b/include/basegfx/color/bcolormodifier.hxx
new file mode 100644
index 000000000..b39849ed7
--- /dev/null
+++ b/include/basegfx/color/bcolormodifier.hxx
@@ -0,0 +1,336 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/color/bcolor.hxx>
+
+#include <osl/diagnose.h>
+
+#include <memory>
+#include <vector>
+
+namespace basegfx
+{
+ /** base class to define color modifications
+
+ The basic idea is to have instances of color modifiers where each
+ of these can be asked to get a modified version of a color. This
+ can be as easy as to return a fixed color, but may also do any
+ other computation based on the given source color and the local
+ algorithm to apply.
+
+ This base implementation defines the abstract base class. Every
+ derivation offers another color blending effect, when needed with
+ parameters for that blending defined as members.
+
+ As long as aw080 is not applied, an operator== is needed to implement
+ the operator== of the primitive based on this instances.
+
+ For the exact definitions of the color blending applied refer to the
+ implementation of the method getModifiedColor
+
+ BColorModifier is not copyable (no copy constructor, no assignment
+ operator); local values cannot be changed after construction. The
+ instances are cheap and the idea is to create them on demand. To
+ be able to reuse these as much as possible, a define for a
+ std::shared_ptr named BColorModifierSharedPtr exists below.
+ All usages should handle instances of BColorModifier encapsulated
+ into these shared pointers.
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC BColorModifier
+ {
+ private:
+ BColorModifier(const BColorModifier&) = delete;
+ BColorModifier& operator=(const BColorModifier&) = delete;
+ protected:
+ // no one is allowed to incarnate the abstract base class
+ // except derivations
+ BColorModifier() {}
+
+ public:
+ // no one should directly destroy it; all incarnations should be
+ // handled in a std::shared_ptr of type BColorModifierSharedPtr
+ virtual ~BColorModifier();
+
+ // compare operator
+ virtual bool operator==(const BColorModifier& rCompare) const = 0;
+ bool operator!=(const BColorModifier& rCompare) const
+ {
+ return !(operator==(rCompare));
+ }
+
+ // compute modified color
+ virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const = 0;
+ };
+
+ /** convert color to gray
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC BColorModifier_gray final : public BColorModifier
+ {
+ public:
+ BColorModifier_gray()
+ {
+ }
+
+ virtual ~BColorModifier_gray() override;
+
+ // compare operator
+ SAL_DLLPRIVATE virtual bool operator==(const BColorModifier& rCompare) const override;
+
+ // compute modified color
+ SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override;
+ };
+
+ /** invert color
+
+ returns a color where red green and blue are inverted using 1.0 - n
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC BColorModifier_invert final : public BColorModifier
+ {
+ public:
+ BColorModifier_invert()
+ {
+ }
+
+ virtual ~BColorModifier_invert() override;
+
+ // compare operator
+ SAL_DLLPRIVATE virtual bool operator==(const BColorModifier& rCompare) const override;
+
+ // compute modified color
+ SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override;
+ };
+
+ /** convert to alpha based on luminance
+
+ returns a color where red green and blue are first weighted and added
+ to build a luminance value which is then inverted and used for red,
+ green and blue. The weights are r * 0.2125 + g * 0.7154 + b * 0.0721.
+ This derivation is used for the svg importer and does exactly what SVG
+ defines for this needed case.
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC BColorModifier_luminance_to_alpha final : public BColorModifier
+ {
+ public:
+ BColorModifier_luminance_to_alpha()
+ {
+ }
+
+ virtual ~BColorModifier_luminance_to_alpha() override;
+
+ // compare operator
+ SAL_DLLPRIVATE virtual bool operator==(const BColorModifier& rCompare) const override;
+
+ // compute modified color
+ SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override;
+ };
+
+ /** replace color
+
+ does not use the source color at all, but always returns the
+ given color, replacing everything. Useful e.g. for unified shadow
+ creation
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC BColorModifier_replace final : public BColorModifier
+ {
+ private:
+ ::basegfx::BColor maBColor;
+
+ public:
+ BColorModifier_replace(const ::basegfx::BColor& rBColor)
+ : maBColor(rBColor)
+ {
+ }
+
+ virtual ~BColorModifier_replace() override;
+
+ // data access
+ const ::basegfx::BColor& getBColor() const { return maBColor; }
+
+ // compare operator
+ SAL_DLLPRIVATE virtual bool operator==(const BColorModifier& rCompare) const override;
+
+ // compute modified color
+ SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override;
+ };
+
+ /** interpolate color
+
+ returns an interpolated color mixed by the given value (f) in the range
+ [0.0 .. 1.0] and the given color (col) as follows:
+
+ col * (1 - f) + aSourceColor * f
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC BColorModifier_interpolate final : public BColorModifier
+ {
+ private:
+ ::basegfx::BColor maBColor;
+ double mfValue;
+
+ public:
+ BColorModifier_interpolate(const ::basegfx::BColor& rBColor, double fValue)
+ : maBColor(rBColor),
+ mfValue(fValue)
+ {
+ }
+
+ virtual ~BColorModifier_interpolate() override;
+
+ // compare operator
+ SAL_DLLPRIVATE virtual bool operator==(const BColorModifier& rCompare) const override;
+
+ // compute modified color
+ SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override;
+ };
+
+ /** convert color to black and white
+
+ returns black when the luminance of the given color is less than
+ the given threshold value in the range [0.0 .. 1.0], else white
+ */
+ class SAL_WARN_UNUSED UNLESS_MERGELIBS(BASEGFX_DLLPUBLIC) BColorModifier_black_and_white final : public BColorModifier
+ {
+ private:
+ double mfValue;
+
+ public:
+ BColorModifier_black_and_white(double fValue)
+ : mfValue(fValue)
+ {
+ }
+
+ virtual ~BColorModifier_black_and_white() override;
+
+ // compare operator
+ SAL_DLLPRIVATE virtual bool operator==(const BColorModifier& rCompare) const override;
+
+ // compute modified color
+ SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override;
+ };
+
+ /** gamma correction
+
+ Input is a gamma correction value in the range ]0.0 .. 10.0]; the
+ color values get corrected using
+
+ col(r,g,b) = clamp(pow(col(r,g,b), 1.0 / gamma), 0.0, 1.0)
+ */
+ class SAL_WARN_UNUSED UNLESS_MERGELIBS(BASEGFX_DLLPUBLIC) BColorModifier_gamma final : public BColorModifier
+ {
+ private:
+ double mfValue;
+ double mfInvValue;
+
+ bool mbUseIt : 1;
+
+ public:
+ BColorModifier_gamma(double fValue);
+
+ virtual ~BColorModifier_gamma() override;
+
+ // compare operator
+ SAL_DLLPRIVATE virtual bool operator==(const BColorModifier& rCompare) const override;
+
+ // compute modified color
+ virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override;
+ };
+
+ /** Red, Green, Blue, Luminance and Contrast correction
+
+ Input are percent values from [-1.0 .. 1-0] which correspond to -100% to 100%
+ correction of Red, Green, Blue, Luminance or Contrast. 0.0 means no change of
+ the corresponding channel. All these are combined (but can be used single) to
+ - be able to cover a bigger change range utilizing the combination
+ - allow execution by a small, common, precalculated table
+ */
+ class SAL_WARN_UNUSED UNLESS_MERGELIBS(BASEGFX_DLLPUBLIC) BColorModifier_RGBLuminanceContrast final : public BColorModifier
+ {
+ private:
+ double mfRed;
+ double mfGreen;
+ double mfBlue;
+ double mfLuminance;
+ double mfContrast;
+
+ double mfContrastOff;
+ double mfRedOff;
+ double mfGreenOff;
+ double mfBlueOff;
+
+ bool mbUseIt : 1;
+
+ public:
+ BColorModifier_RGBLuminanceContrast(double fRed, double fGreen, double fBlue, double fLuminance, double fContrast);
+
+ virtual ~BColorModifier_RGBLuminanceContrast() override;
+
+ // compare operator
+ SAL_DLLPRIVATE virtual bool operator==(const BColorModifier& rCompare) const override;
+
+ // compute modified color
+ SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override;
+ };
+
+ /// typedef to allow working with shared instances of BColorModifier
+ /// for the whole mechanism
+ typedef std::shared_ptr< BColorModifier > BColorModifierSharedPtr;
+
+ /** Class to hold a stack of BColorModifierSharedPtrs and to get the modified color with
+ applying all existing entry changes as defined in the stack. Instances of BColorModifier
+ can be pushed and popped to change the stack.
+
+ All references to BColorModifier members use shared pointers, thus instances of
+ BColorModifierStack can be copied by the default mechanisms if needed.
+ */
+ class BASEGFX_DLLPUBLIC BColorModifierStack final
+ {
+ ::std::vector< BColorModifierSharedPtr > maBColorModifiers;
+
+ public:
+ sal_uInt32 count() const
+ {
+ return maBColorModifiers.size();
+ }
+
+ const BColorModifierSharedPtr& getBColorModifier(sal_uInt32 nIndex) const
+ {
+ OSL_ENSURE(nIndex < count(), "BColorModifierStack: Access out of range (!)");
+ return maBColorModifiers[nIndex];
+ }
+
+ // get the color in its modified form by applying all existing BColorModifiers,
+ // from back to front (the newest first)
+ ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& rSource) const;
+
+ void push(const BColorModifierSharedPtr& rNew)
+ {
+ maBColorModifiers.push_back(rNew);
+ }
+
+ void pop()
+ {
+ maBColorModifiers.pop_back();
+ }
+ };
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/color/bcolortools.hxx b/include/basegfx/color/bcolortools.hxx
new file mode 100644
index 000000000..8af2b7c94
--- /dev/null
+++ b/include/basegfx/color/bcolortools.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+class BColor;
+}
+
+namespace basegfx::utils
+{
+/// Transform from RGB to HSL
+BASEGFX_DLLPUBLIC BColor rgb2hsl(const BColor& rRGBColor);
+/// Transform from HSL to RGB
+BASEGFX_DLLPUBLIC BColor hsl2rgb(const BColor& rHSLColor);
+
+/// Transform from RGB to HSV
+BASEGFX_DLLPUBLIC BColor rgb2hsv(const BColor& rRGBColor);
+/// Transform from HSV to RGB
+BASEGFX_DLLPUBLIC BColor hsv2rgb(const BColor& rHSVColor);
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/curve/b2dbeziertools.hxx b/include/basegfx/curve/b2dbeziertools.hxx
new file mode 100644
index 000000000..b9c91fac0
--- /dev/null
+++ b/include/basegfx/curve/b2dbeziertools.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+
+// predefines
+
+namespace basegfx
+{
+ class B2DCubicBezier;
+}
+
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B2DCubicBezierHelper
+ {
+ private:
+ ::std::vector< double > maLengthArray;
+ sal_uInt32 mnEdgeCount;
+
+ public:
+ explicit B2DCubicBezierHelper(const B2DCubicBezier& rBase, sal_uInt32 nDivisions = 9);
+
+ double getLength() const { if(!maLengthArray.empty()) return maLengthArray[maLengthArray.size() - 1]; else return 0.0; }
+ double distanceToRelative(double fDistance) const;
+ };
+} // end of namespace basegfx
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/curve/b2dcubicbezier.hxx b/include/basegfx/curve/b2dcubicbezier.hxx
new file mode 100644
index 000000000..4d8d9406e
--- /dev/null
+++ b/include/basegfx/curve/b2dcubicbezier.hxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DPolygon;
+}
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B2DCubicBezier
+ {
+ private:
+ B2DPoint maStartPoint;
+ B2DPoint maEndPoint;
+ B2DPoint maControlPointA;
+ B2DPoint maControlPointB;
+
+ public:
+ B2DCubicBezier();
+ B2DCubicBezier(const B2DCubicBezier& rBezier);
+ B2DCubicBezier(const B2DPoint& rStart, const B2DPoint& rControlPointA, const B2DPoint& rControlPointB, const B2DPoint& rEnd);
+
+ // assignment operator
+ B2DCubicBezier& operator=(const B2DCubicBezier& rBezier);
+
+ // compare operators
+ bool operator==(const B2DCubicBezier& rBezier) const;
+ bool operator!=(const B2DCubicBezier& rBezier) const;
+ bool equal(const B2DCubicBezier& rBezier) const;
+
+ // test if vectors are used
+ bool isBezier() const;
+
+ // test if contained bezier is trivial and reset vectors accordingly
+ void testAndSolveTrivialBezier();
+
+ /** get length of edge
+
+ This method handles beziers and simple edges. For
+ beziers, the deviation describes the maximum allowed
+ deviation from the real edge length. The default
+ allows a deviation of 1% from the correct length.
+
+ For beziers, there is no direct way to get the length,
+ thus this method may subdivide the bezier edge and may
+ not be cheap.
+
+ @param fDeviation
+ The maximal allowed deviation between correct length
+ and bezier edge length
+
+ @return
+ The length of the edge
+ */
+ double getLength(double fDeviation = 0.01) const;
+
+ // get distance between start and end point
+ SAL_DLLPRIVATE double getEdgeLength() const;
+
+ // get length of control polygon
+ SAL_DLLPRIVATE double getControlPolygonLength() const;
+
+ // data interface
+ const B2DPoint& getStartPoint() const { return maStartPoint; }
+ void setStartPoint(const B2DPoint& rValue) { maStartPoint = rValue; }
+
+ const B2DPoint& getEndPoint() const { return maEndPoint; }
+ void setEndPoint(const B2DPoint& rValue) { maEndPoint = rValue; }
+
+ const B2DPoint& getControlPointA() const { return maControlPointA; }
+ void setControlPointA(const B2DPoint& rValue) { maControlPointA = rValue; }
+
+ const B2DPoint& getControlPointB() const { return maControlPointB; }
+ void setControlPointB(const B2DPoint& rValue) { maControlPointB = rValue; }
+
+ /** get the tangent in point t
+
+ This method handles all the exceptions, e.g. when control point
+ A is equal to start point and/or control point B is equal to end
+ point
+
+ @param t
+ The bezier index in the range [0.0 .. 1.0]. It will be truncated.
+
+ @return
+ The tangent vector in point t
+ */
+ B2DVector getTangent(double t) const;
+
+ /** adaptive subdivide by angle criteria
+ no start point is added, but all necessary created edges
+ and the end point
+ #i37443# allow the criteria to get unsharp in recursions
+ */
+ SAL_DLLPRIVATE void adaptiveSubdivideByAngle(B2DPolygon& rTarget, double fAngleBound) const;
+
+ /** #i37443# adaptive subdivide by nCount subdivisions
+ no start point is added, but all necessary created edges
+ and the end point
+ */
+ SAL_DLLPRIVATE void adaptiveSubdivideByCount(B2DPolygon& rTarget, sal_uInt32 nCount) const;
+
+ /** Subdivide cubic bezier segment.
+
+ This function adaptively subdivides the bezier
+ segment into as much straight line segments as necessary,
+ such that the maximal orthogonal distance from any of the
+ segments to the true curve is less than the given error
+ value.
+ No start point is added, but all necessary created edges
+ and the end point
+
+ @param rPoly
+ Output polygon. The subdivided bezier segment is added to
+ this polygon via B2DPolygon::append().
+
+ @param rCurve
+ The cubic bezier curve to subdivide
+
+ @param fDistanceBound
+ Bound on the maximal distance of the approximation to the
+ true curve.
+ */
+ void adaptiveSubdivideByDistance(B2DPolygon& rTarget, double fDistanceBound) const;
+
+ // get point at given relative position
+ B2DPoint interpolatePoint(double t) const;
+
+ // calculate the smallest distance from given point to this cubic bezier segment
+ // and return the value. The relative position on the segment is returned in rCut.
+ SAL_DLLPRIVATE double getSmallestDistancePointToBezierSegment(const B2DPoint& rTestPoint, double& rCut) const;
+
+ // do a split at position t and fill both resulting segments
+ void split(double t, B2DCubicBezier* pBezierA, B2DCubicBezier* pBezierB) const;
+
+ // extract snippet from fStart to fEnd from this bezier
+ SAL_DLLPRIVATE B2DCubicBezier snippet(double fStart, double fEnd) const;
+
+ // get range including control points
+ B2DRange getRange() const;
+
+ /** Get the minimum extremum position t
+
+ @param rfResult
+ Will be changed and might possibly be set to a found split value, which should be in the
+ range [0.0 .. 1.0]. It will be the smallest current extremum; there may be more
+
+ @return
+ Returns true if there was at least one extremum found
+ */
+ SAL_DLLPRIVATE bool getMinimumExtremumPosition(double& rfResult) const;
+
+ /** Get all extremum pos of this segment
+
+ This method will calculate all extremum positions of the segment
+ and add them to rResults if they are in the range ]0.0 .. 1.0[
+
+ @param rResults
+ The vector of doubles where the results will be added. Evtl.
+ existing contents will be removed since an empty vector is a
+ necessary result to express that there are no extreme positions
+ anymore. Since there is an upper maximum of 4 values, it makes
+ sense to use reserve(4) at the vector as preparation.
+ */
+ SAL_DLLPRIVATE void getAllExtremumPositions(::std::vector< double >& rResults) const;
+
+ /// apply transformation given in matrix form
+ void transform(const basegfx::B2DHomMatrix& rMatrix);
+
+ /// fround content
+ SAL_DLLPRIVATE void fround();
+ };
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/matrix/b2dhommatrix.hxx b/include/basegfx/matrix/b2dhommatrix.hxx
new file mode 100644
index 000000000..d7fa5b442
--- /dev/null
+++ b/include/basegfx/matrix/b2dhommatrix.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <ostream>
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DTuple;
+ class Impl2DHomMatrix;
+
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC B2DHomMatrix
+ {
+ public:
+ typedef o3tl::cow_wrapper< Impl2DHomMatrix > ImplType;
+
+ private:
+ ImplType mpImpl;
+
+ public:
+ B2DHomMatrix();
+ B2DHomMatrix(const B2DHomMatrix& rMat);
+ B2DHomMatrix(B2DHomMatrix&& rMat);
+ ~B2DHomMatrix();
+
+ /** Convenience creator for declaration of the matrix that is commonly
+ used by web standards (SVG, CSS, HTML).
+
+ Values a,b,c,d,e,f represent the following values in the matrix:
+ [a,c,e] [a,c,e]
+ [b,d,f] or [b,d,f]
+ [0,0,1]
+
+ */
+ static B2DHomMatrix abcdef(double da, double db, double dc, double dd, double de, double df)
+ {
+ return B2DHomMatrix(da, dc, de, db, dd, df);
+ }
+
+ // Convenience accessor for value at 0,0 position in the matrix
+ double a() const { return get(0,0); }
+ // Convenience accessor for value at 1,0 position in the matrix
+ double b() const { return get(1,0); }
+ // Convenience accessor for value at 0,1 position in the matrix
+ double c() const { return get(0,1); }
+ // Convenience accessor for value at 1,1 position in the matrix
+ double d() const { return get(1,1); }
+ // Convenience accessor for value at 0,2 position in the matrix
+ double e() const { return get(0,2); }
+ // Convenience accessor for value at 1,2 position in the matrix
+ double f() const { return get(1,2); }
+
+ /** constructor to allow setting all needed values for a 3x2 matrix at once. The
+ parameter f_0x1 e.g. is the same as using set(0, 1, f)
+ */
+ B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2);
+
+ double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
+ void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
+
+ /** allow setting all needed values for a 3x2 matrix in one call. The
+ parameter f_0x1 e.g. is the same as using set(0, 1, f)
+ */
+ void set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2);
+
+ // test if last line is default to see if last line needs to be
+ // involved in calculations
+ bool isLastLineDefault() const;
+
+ // reset to a standard matrix
+ bool isIdentity() const;
+ void identity();
+
+ bool isInvertible() const;
+ bool invert();
+
+ void rotate(double fRadiant);
+
+ void translate(double fX, double fY);
+ void translate(const B2DTuple& rTuple);
+
+ void scale(double fX, double fY);
+ void scale(const B2DTuple& rTuple);
+
+ // Shearing-Matrices
+ void shearX(double fSx);
+ void shearY(double fSy);
+
+ B2DHomMatrix& operator+=(const B2DHomMatrix& rMat);
+ B2DHomMatrix& operator-=(const B2DHomMatrix& rMat);
+
+ bool operator==(const B2DHomMatrix& rMat) const;
+ bool operator!=(const B2DHomMatrix& rMat) const;
+
+ B2DHomMatrix& operator*=(double fValue);
+ B2DHomMatrix& operator/=(double fValue);
+
+ // matrix multiplication from the left to the local
+ B2DHomMatrix& operator*=(const B2DHomMatrix& rMat);
+
+ // assignment operator
+ B2DHomMatrix& operator=(const B2DHomMatrix& rMat);
+ B2DHomMatrix& operator=(B2DHomMatrix&& rMat);
+
+ // Help routine to decompose given homogen 3x3 matrix to components. A correction of
+ // the components is done to avoid inaccuracies.
+ bool decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const;
+ };
+
+ inline B2DHomMatrix operator*(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
+ {
+ B2DHomMatrix aMul(rMatB);
+ aMul *= rMatA;
+ return aMul;
+ }
+
+ template<typename charT, typename traits>
+ std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, B2DHomMatrix const & matrix)
+ {
+ return stream
+ << '[' << matrix.get(0, 0) << ' ' << matrix.get(0, 1) << ' '
+ << matrix.get(0, 2) << "; " << matrix.get(1, 0) << ' '
+ << matrix.get(1, 1) << ' ' << matrix.get(1, 2) << "; "
+ << matrix.get(2, 0) << ' ' << matrix.get(2, 1) << ' '
+ << matrix.get(2, 2) << ']';
+ }
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/matrix/b2dhommatrixtools.hxx b/include/basegfx/matrix/b2dhommatrixtools.hxx
new file mode 100644
index 000000000..9b81f33d2
--- /dev/null
+++ b/include/basegfx/matrix/b2dhommatrixtools.hxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <utility>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx { class B2DRange; }
+
+namespace basegfx::utils
+{
+ /** If the rotation angle is an approximate multiple of pi/2,
+ force fSin/fCos to -1/0/1, to maintain orthogonality (which
+ might also be advantageous for the other cases, but: for
+ multiples of pi/2, the exact values _can_ be attained. It
+ would be largely unintuitive, if a 180 degrees rotation
+ would introduce slight roundoff errors, instead of exactly
+ mirroring the coordinate system)
+ */
+ void createSinCosOrthogonal(double& o_rSin, double& rCos, double fRadiant);
+
+ /** Tooling methods for on-the-fly matrix generation e.g. for inline
+ multiplications
+ */
+ BASEGFX_DLLPUBLIC B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createShearXB2DHomMatrix(double fShearX);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createShearYB2DHomMatrix(double fShearY);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createRotateB2DHomMatrix(double fRadiant);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY);
+
+ /// inline versions for parameters as tuples
+ inline B2DHomMatrix createScaleB2DHomMatrix(const B2DTuple& rScale)
+ {
+ return createScaleB2DHomMatrix(rScale.getX(), rScale.getY());
+ }
+
+ inline B2DHomMatrix createTranslateB2DHomMatrix(const B2DTuple& rTranslate)
+ {
+ return createTranslateB2DHomMatrix(rTranslate.getX(), rTranslate.getY());
+ }
+
+ /** Tooling methods for faster completely combined matrix creation
+ when scale, shearX, rotation and translation needs to be done in
+ exactly that order. It's faster since it directly calculates
+ each matrix value based on a symbolic calculation of the three
+ matrix multiplications.
+ Inline versions for parameters as tuples added, too.
+ */
+ BASEGFX_DLLPUBLIC B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(
+ double fScaleX, double fScaleY,
+ double fShearX,
+ double fRadiant,
+ double fTranslateX, double fTranslateY);
+ inline B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(
+ const B2DTuple& rScale,
+ double fShearX,
+ double fRadiant,
+ const B2DTuple& rTranslate)
+ {
+ return createScaleShearXRotateTranslateB2DHomMatrix(
+ rScale.getX(), rScale.getY(),
+ fShearX,
+ fRadiant,
+ rTranslate.getX(), rTranslate.getY());
+ }
+
+ BASEGFX_DLLPUBLIC B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(
+ double fShearX,
+ double fRadiant,
+ double fTranslateX, double fTranslateY);
+ inline B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(
+ double fShearX,
+ double fRadiant,
+ const B2DTuple& rTranslate)
+ {
+ return createShearXRotateTranslateB2DHomMatrix(
+ fShearX,
+ fRadiant,
+ rTranslate.getX(), rTranslate.getY());
+ }
+
+ BASEGFX_DLLPUBLIC B2DHomMatrix createScaleTranslateB2DHomMatrix(
+ double fScaleX, double fScaleY,
+ double fTranslateX, double fTranslateY);
+ inline B2DHomMatrix createScaleTranslateB2DHomMatrix(
+ const B2DTuple& rScale,
+ const B2DTuple& rTranslate)
+ {
+ return createScaleTranslateB2DHomMatrix(
+ rScale.getX(), rScale.getY(),
+ rTranslate.getX(), rTranslate.getY());
+ }
+
+ /// special for the often used case of rotation around a point
+ BASEGFX_DLLPUBLIC B2DHomMatrix createRotateAroundPoint(
+ double fPointX, double fPointY,
+ double fRadiant);
+ inline B2DHomMatrix createRotateAroundPoint(
+ const B2DTuple& rPoint,
+ double fRadiant)
+ {
+ return createRotateAroundPoint(
+ rPoint.getX(), rPoint.getY(),
+ fRadiant);
+ }
+
+ /// special for creating a mapping for a Range rotated around it's center
+ /// while keeping AspectRatio unchanged and staying inside the given Range
+ /// by optimally using the available space (no overlap or outside allowed)
+ B2DHomMatrix createRotateAroundCenterKeepAspectRatioStayInsideRange(
+ const basegfx::B2DRange& rTargetRange,
+ double fRotate);
+
+ /// special for the case to map from source range to target range
+ BASEGFX_DLLPUBLIC B2DHomMatrix createSourceRangeTargetRangeTransform(
+ const B2DRange& rSourceRange,
+ const B2DRange& rTargetRange);
+
+ /// create based on given CoordinateSystem which is defined by origin and x/yaxis
+ BASEGFX_DLLPUBLIC B2DHomMatrix createCoordinateSystemTransform(
+ const B2DPoint& rOrigin,
+ const B2DVector& rX,
+ const B2DVector& rY);
+
+ /// get column vector from B2dHomMatrix, e.g. to extract coordinate system origin and x/yaxis
+ BASEGFX_DLLPUBLIC B2DTuple getColumn(const B2DHomMatrix& rMatrix, sal_uInt16 nCol);
+
+
+ class BASEGFX_DLLPUBLIC B2DHomMatrixBufferedDecompose
+ {
+ private:
+ B2DVector maScale;
+ B2DVector maTranslate;
+ double mfRotate;
+ double mfShearX;
+
+ public:
+ B2DHomMatrixBufferedDecompose(const B2DHomMatrix& rB2DHomMatrix = B2DHomMatrix())
+ : mfRotate(0.0),
+ mfShearX(0.0)
+ {
+ rB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX);
+ }
+
+ // data access
+ B2DHomMatrix getB2DHomMatrix() const
+ {
+ return createScaleShearXRotateTranslateB2DHomMatrix(
+ maScale, mfShearX, mfRotate, maTranslate);
+ }
+
+ const B2DVector& getScale() const { return maScale; }
+ const B2DVector& getTranslate() const { return maTranslate; }
+ double getRotate() const { return mfRotate; }
+ double getShearX() const { return mfShearX; }
+ };
+
+ class BASEGFX_DLLPUBLIC B2DHomMatrixBufferedOnDemandDecompose
+ {
+ private:
+ B2DHomMatrix maB2DHomMatrix;
+ B2DVector maScale;
+ B2DVector maTranslate;
+ double mfRotate;
+ double mfShearX;
+
+ bool mbDecomposed : 1;
+
+ void impCheckDecompose()
+ {
+ if(!mbDecomposed)
+ {
+ maB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX);
+ mbDecomposed = true;
+ }
+ }
+
+ public:
+ B2DHomMatrixBufferedOnDemandDecompose(B2DHomMatrix aB2DHomMatrix = B2DHomMatrix())
+ : maB2DHomMatrix(std::move(aB2DHomMatrix)),
+ mfRotate(0.0),
+ mfShearX(0.0),
+ mbDecomposed(false)
+ {
+ }
+
+ // data access
+ const B2DHomMatrix& getB2DHomMatrix() const { return maB2DHomMatrix; }
+ const B2DVector& getScale() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maScale; }
+ const B2DVector& getTranslate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maTranslate; }
+ double getRotate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfRotate; }
+ double getShearX() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfShearX; }
+ };
+} // end of namespace basegfx::utils
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/matrix/b3dhommatrix.hxx b/include/basegfx/matrix/b3dhommatrix.hxx
new file mode 100644
index 000000000..29603f88e
--- /dev/null
+++ b/include/basegfx/matrix/b3dhommatrix.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B3DTuple;
+ class Impl3DHomMatrix;
+
+ class BASEGFX_DLLPUBLIC B3DHomMatrix
+ {
+ public:
+ typedef o3tl::cow_wrapper< Impl3DHomMatrix, o3tl::ThreadSafeRefCountingPolicy > ImplType;
+
+ private:
+ ImplType mpImpl;
+
+ public:
+ B3DHomMatrix();
+ B3DHomMatrix(const B3DHomMatrix& rMat);
+ B3DHomMatrix(B3DHomMatrix&& rMat);
+ ~B3DHomMatrix();
+
+ double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
+ void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
+
+ // test if last line is default to see if last line needs to be
+ // involved in calculations
+ bool isLastLineDefault() const;
+
+ bool isIdentity() const;
+ /// Reset to the identity matrix
+ void identity();
+
+ /// Invert the matrix (if possible)
+ void invert();
+
+ /// Calc the matrix determinant
+ double determinant() const;
+
+ /// Rotation
+ void rotate(double fAngleX,double fAngleY,double fAngleZ);
+ void rotate(const B3DTuple& rRotation);
+
+ /// Translation
+ void translate(double fX, double fY, double fZ);
+ void translate(const B3DTuple& rTranslation);
+
+ /// Scaling
+ void scale(double fX, double fY, double fZ);
+ void scale(const B3DTuple& rScale);
+
+ // Shearing-Matrices
+ void shearXY(double fSx, double fSy);
+ void shearXZ(double fSx, double fSz);
+
+ // Projection matrices, used for converting between eye and
+ // clip coordinates
+ void frustum(double fLeft = -1.0, double fRight = 1.0,
+ double fBottom = -1.0, double fTop = 1.0,
+ double fNear = 0.001, double fFar = 1.0);
+
+ void ortho(double fLeft = -1.0, double fRight = 1.0,
+ double fBottom = -1.0, double fTop = 1.0,
+ double fNear = 0.0, double fFar = 1.0);
+
+ // build orientation matrix
+ void orientation(
+ const B3DPoint& rVRP = B3DPoint(0.0,0.0,1.0),
+ B3DVector aVPN = B3DVector(0.0,0.0,1.0),
+ B3DVector aVUV = B3DVector(0.0,1.0,0.0));
+
+ // addition, subtraction
+ B3DHomMatrix& operator+=(const B3DHomMatrix& rMat);
+ B3DHomMatrix& operator-=(const B3DHomMatrix& rMat);
+
+ // comparison
+ bool operator==(const B3DHomMatrix& rMat) const;
+ bool operator!=(const B3DHomMatrix& rMat) const;
+
+ // multiplication, division by constant value
+ B3DHomMatrix& operator*=(double fValue);
+ B3DHomMatrix& operator/=(double fValue);
+
+ // matrix multiplication (from the left)
+ B3DHomMatrix& operator*=(const B3DHomMatrix& rMat);
+
+ // assignment operator
+ B3DHomMatrix& operator=(const B3DHomMatrix& rMat);
+ B3DHomMatrix& operator=(B3DHomMatrix&& rMat);
+
+ // decomposition
+ void decompose(B3DTuple& rScale, B3DTuple& rTranslate, B3DTuple& rRotate, B3DTuple& rShear) const;
+ };
+
+ inline B3DHomMatrix operator*(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
+ {
+ B3DHomMatrix aMul(rMatB);
+ aMul *= rMatA;
+ return aMul;
+ }
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/matrix/b3dhommatrixtools.hxx b/include/basegfx/matrix/b3dhommatrixtools.hxx
new file mode 100644
index 000000000..6b65d2460
--- /dev/null
+++ b/include/basegfx/matrix/b3dhommatrixtools.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+namespace com::sun::star::drawing
+{
+struct HomogenMatrix;
+}
+
+namespace basegfx::utils
+{
+/* tooling methods for converting API matrices (drawing::HomogenMatrix) to
+ B3DHomMatrix. drawing::HomogenMatrix4 is not used by OOo
+ */
+BASEGFX_DLLPUBLIC B3DHomMatrix
+UnoHomogenMatrixToB3DHomMatrix(const com::sun::star::drawing::HomogenMatrix& rMatrixIn);
+
+BASEGFX_DLLPUBLIC void
+B3DHomMatrixToUnoHomogenMatrix(const B3DHomMatrix& rMatrixIn,
+ com::sun::star::drawing::HomogenMatrix& rMatrixOut);
+
+} // end of namespace basegfx::tools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx
new file mode 100644
index 000000000..14deaa059
--- /dev/null
+++ b/include/basegfx/numeric/ftools.hxx
@@ -0,0 +1,209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <rtl/math.h>
+#include <cmath>
+#include <math.h>
+#include <basegfx/basegfxdllapi.h>
+#include <limits>
+#include <algorithm>
+
+
+// fTools defines
+
+namespace basegfx
+{
+ /** Round double to nearest integer
+
+ @return the nearest integer
+ */
+ inline sal_Int32 fround( double fVal )
+ {
+ if (fVal >= std::numeric_limits<sal_Int32>::max() - .5)
+ return std::numeric_limits<sal_Int32>::max();
+ else if (fVal <= std::numeric_limits<sal_Int32>::min() + .5)
+ return std::numeric_limits<sal_Int32>::min();
+ return fVal > 0.0 ? static_cast<sal_Int32>( fVal + .5 ) : static_cast<sal_Int32>( fVal - .5 );
+ }
+
+ /** Round double to nearest integer
+
+ @return the nearest 64 bit integer
+ */
+ inline sal_Int64 fround64( double fVal )
+ {
+ return fVal > 0.0 ? static_cast<sal_Int64>( fVal + .5 ) : -static_cast<sal_Int64>( -fVal + .5 );
+ }
+
+ /** Prune a small epsilon range around zero.
+
+ Use this method e.g. for calculating scale values. There, it
+ is usually advisable not to set a scaling to 0.0, because that
+ yields singular transformation matrices.
+
+ @param fVal
+ An arbitrary, but finite and valid number
+
+ @return either fVal, or a small value slightly above (when
+ fVal>0) or below (when fVal<0) zero.
+ */
+ inline double pruneScaleValue( double fVal )
+ {
+ if(fVal < 0.0)
+ return std::min(fVal, -0.00001);
+ else
+ return std::max(fVal, 0.00001);
+ }
+
+ /** Convert value from degrees to radians
+ */
+ template <int DegMultiple = 1> constexpr double deg2rad( double v )
+ {
+ // divide first, to get exact values for v being a multiple of
+ // 90 degrees
+ return v / (90.0 * DegMultiple) * M_PI_2;
+ }
+
+ /** Convert value radians to degrees
+ */
+ template <int DegMultiple = 1> constexpr double rad2deg( double v )
+ {
+ // divide first, to get exact values for v being a multiple of
+ // pi/2
+ return v / M_PI_2 * (90.0 * DegMultiple);
+ }
+
+ /** Snap v to nearest multiple of fStep, from negative and
+ positive side.
+
+ Examples:
+
+ snapToNearestMultiple(-0.1, 0.5) = 0.0
+ snapToNearestMultiple(0.1, 0.5) = 0.0
+ snapToNearestMultiple(0.25, 0.5) = 0.0
+ snapToNearestMultiple(0.26, 0.5) = 0.5
+ */
+ BASEGFX_DLLPUBLIC double snapToNearestMultiple(double v, const double fStep);
+
+ /** Snap v to the range [0.0 .. fWidth] using modulo
+ */
+ double snapToZeroRange(double v, double fWidth);
+
+ /** Snap v to the range [fLow .. fHigh] using modulo
+ */
+ double snapToRange(double v, double fLow, double fHigh);
+
+ /** return fValue with the sign of fSignCarrier, thus evtl. changed
+ */
+ inline double copySign(double fValue, double fSignCarrier)
+ {
+#ifdef _WIN32
+ return _copysign(fValue, fSignCarrier);
+#else
+ return copysign(fValue, fSignCarrier);
+#endif
+ }
+
+ /** RotateFlyFrame3: Normalize to range defined by [0.0 ... fRange[, independent
+ if v is positive or negative.
+
+ Examples:
+
+ normalizeToRange(0.5, -1.0) = 0.0
+ normalizeToRange(0.5, 0.0) = 0.0
+ normalizeToRange(0.5, 1.0) = 0.5
+ normalizeToRange(-0.5, 1.0) = 0.5
+ normalizeToRange(-0.3, 1.0) = 0.7
+ normalizeToRange(-0.7, 1.0) = 0.3
+ normalizeToRange(3.5, 1.0) = 0.5
+ normalizeToRange(3.3, 1.0) = 0.3
+ normalizeToRange(3.7, 1.0) = 0.7
+ normalizeToRange(-3.5, 1.0) = 0.5
+ normalizeToRange(-3.3, 1.0) = 0.7
+ normalizeToRange(-3.7, 1.0) = 0.3
+ */
+ BASEGFX_DLLPUBLIC double normalizeToRange(double v, const double fRange);
+
+ namespace fTools
+ {
+ /// Get threshold value for equalZero and friends
+ inline double getSmallValue() { return 0.000000001f; }
+
+ /// Compare against small value
+ template <typename T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
+ inline bool equalZero(const T& rfVal)
+ {
+ return (fabs(rfVal) <= getSmallValue());
+ }
+
+ /// Compare against given small value
+ template <typename T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
+ inline bool equalZero(const T& rfVal, const T& rfSmallValue)
+ {
+ return (fabs(rfVal) <= rfSmallValue);
+ }
+
+ template <typename T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
+ inline bool equal(T const& rfValA, T const& rfValB)
+ {
+ // changed to approxEqual usage for better numerical correctness
+ return rtl_math_approxEqual(rfValA, rfValB);
+ }
+
+ template <typename T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
+ inline bool equal(const T& rfValA, const T& rfValB, const T& rfSmallValue)
+ {
+ return (fabs(rfValA - rfValB) <= rfSmallValue);
+ }
+
+ template <typename T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
+ inline bool less(const T& rfValA, const T& rfValB)
+ {
+ return (rfValA < rfValB && !equal(rfValA, rfValB));
+ }
+
+ template <typename T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
+ inline bool lessOrEqual(const T& rfValA, const T& rfValB)
+ {
+ return (rfValA < rfValB || equal(rfValA, rfValB));
+ }
+
+ template <typename T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
+ inline bool more(const T& rfValA, const T& rfValB)
+ {
+ return (rfValA > rfValB && !equal(rfValA, rfValB));
+ }
+
+ template <typename T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
+ inline bool moreOrEqual(const T& rfValA, const T& rfValB)
+ {
+ return (rfValA > rfValB || equal(rfValA, rfValB));
+ }
+
+ template <typename T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
+ inline bool betweenOrEqualEither(const T& rfValA, const T& rfValB, const T& rfValC)
+ {
+ return (rfValA > rfValB && rfValA < rfValC) || equal(rfValA, rfValB) || equal(rfValA, rfValC);
+ }
+ };
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/pixel/bpixel.hxx b/include/basegfx/pixel/bpixel.hxx
new file mode 100644
index 000000000..50209ec2c
--- /dev/null
+++ b/include/basegfx/pixel/bpixel.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <basegfx/color/bcolor.hxx>
+
+namespace basegfx
+{
+ class BPixel final
+ {
+ union
+ {
+ struct
+ {
+ unsigned mnR : 8; // red intensity
+ unsigned mnG : 8; // green intensity
+ unsigned mnB : 8; // blue intensity
+ unsigned mnA : 8; // opacity, 0 == full transparence
+ } maRGBA;
+
+ struct
+ {
+ unsigned mnValue : 32; // all values
+ } maCombinedRGBA;
+ } maPixelUnion;
+
+ public:
+ BPixel()
+ {
+ maPixelUnion.maCombinedRGBA.mnValue = 0;
+ }
+
+ // use explicit here to make sure everyone knows what he is doing. Values range from
+ // 0..255 integer here.
+ explicit BPixel(sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue, sal_uInt8 nAlpha)
+ {
+ maPixelUnion.maRGBA.mnR = nRed;
+ maPixelUnion.maRGBA.mnG = nGreen;
+ maPixelUnion.maRGBA.mnB = nBlue;
+ maPixelUnion.maRGBA.mnA = nAlpha;
+ }
+
+ // constructor from BColor which uses double precision color, so change it
+ // to local integer format. It will also be clamped here.
+ BPixel(const BColor& rColor, sal_uInt8 nAlpha)
+ {
+ maPixelUnion.maRGBA.mnR = sal_uInt8((rColor.getRed() * 255.0) + 0.5);
+ maPixelUnion.maRGBA.mnG = sal_uInt8((rColor.getGreen() * 255.0) + 0.5);
+ maPixelUnion.maRGBA.mnB = sal_uInt8((rColor.getBlue() * 255.0) + 0.5);
+ maPixelUnion.maRGBA.mnA = nAlpha;
+ }
+
+ // data access read
+ sal_uInt8 getRed() const { return maPixelUnion.maRGBA.mnR; }
+ sal_uInt8 getGreen() const { return maPixelUnion.maRGBA.mnG; }
+ sal_uInt8 getBlue() const { return maPixelUnion.maRGBA.mnB; }
+ sal_uInt8 getAlpha() const { return maPixelUnion.maRGBA.mnA; }
+
+ // data access write
+ void setRed(sal_uInt8 nNew) { maPixelUnion.maRGBA.mnR = nNew; }
+ void setGreen(sal_uInt8 nNew) { maPixelUnion.maRGBA.mnG = nNew; }
+ void setBlue(sal_uInt8 nNew) { maPixelUnion.maRGBA.mnB = nNew; }
+ void setAlpha(sal_uInt8 nNew) { maPixelUnion.maRGBA.mnA = nNew; }
+
+ // comparators
+ bool operator==( const BPixel& rPixel ) const
+ {
+ return (rPixel.maPixelUnion.maCombinedRGBA.mnValue == maPixelUnion.maCombinedRGBA.mnValue);
+ }
+
+ bool operator!=( const BPixel& rPixel ) const
+ {
+ return (rPixel.maPixelUnion.maCombinedRGBA.mnValue != maPixelUnion.maCombinedRGBA.mnValue);
+ }
+ };
+
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/point/b2dpoint.hxx b/include/basegfx/point/b2dpoint.hxx
new file mode 100644
index 000000000..d2f77aa49
--- /dev/null
+++ b/include/basegfx/point/b2dpoint.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <ostream>
+
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/point/b2ipoint.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+
+ /** Base Point class with two double values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2DTuple. All necessary extensions
+ which are special for points will be added here.
+
+ @see B2DTuple
+ */
+ class SAL_WARN_UNUSED B2DPoint : public ::basegfx::B2DTuple
+ {
+ public:
+ /** Create a 2D Point
+
+ The point is initialized to (0.0, 0.0)
+ */
+ B2DPoint()
+ {}
+
+ /** Create a 2D Point
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Point.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Point.
+ */
+ B2DPoint(double fX, double fY)
+ : B2DTuple(fX, fY)
+ {}
+
+ /** Create a copy of a 2D Point
+
+ @param rPoint
+ The 2D Point which will be copied.
+ */
+ explicit B2DPoint(const ::basegfx::B2IPoint& rPoint)
+ : B2DTuple(rPoint)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2DTuple-based classes
+ */
+ B2DPoint(const ::basegfx::B2DTuple& rTuple)
+ : B2DTuple(rTuple)
+ {}
+
+ /** *=operator to allow usage from B2DPoint, too
+ */
+ B2DPoint& operator*=( const B2DPoint& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2DPoint, too
+ */
+ B2DPoint& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2DTuple calculations
+ */
+ BASEGFX_DLLPUBLIC B2DPoint& operator=( const ::basegfx::B2DTuple& rPoint );
+
+ /** Transform point by given transformation matrix.
+
+ The translational components of the matrix are, in
+ contrast to B2DVector, applied.
+ */
+ BASEGFX_DLLPUBLIC B2DPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat );
+
+ static const B2DPoint& getEmptyPoint()
+ {
+ return static_cast<const B2DPoint&>( ::basegfx::B2DTuple::getEmptyTuple() );
+ }
+ };
+
+ // external operators
+
+ /** Transform B2DPoint by given transformation matrix.
+
+ Since this is a Point, translational components of the
+ matrix are used.
+ */
+ BASEGFX_DLLPUBLIC B2DPoint operator*( const B2DHomMatrix& rMat, const B2DPoint& rPoint );
+
+ template< typename charT, typename traits >
+ inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const B2DPoint& point )
+ {
+ return stream << "(" << point.getX() << "," << point.getY() << ")";
+ }
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/point/b2ipoint.hxx b/include/basegfx/point/b2ipoint.hxx
new file mode 100644
index 000000000..9357e9f0f
--- /dev/null
+++ b/include/basegfx/point/b2ipoint.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/tuple/b2ituple.hxx>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+
+ /** Base Point class with two sal_Int32 values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2ITuple. All necessary extensions
+ which are special for points will be added here.
+
+ @see B2ITuple
+ */
+ class SAL_WARN_UNUSED B2IPoint : public ::basegfx::B2ITuple
+ {
+ public:
+ /** Create a 2D Point
+
+ The point is initialized to (0, 0)
+ */
+ B2IPoint()
+ {}
+
+ /** Create a 2D Point
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Point.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Point.
+ */
+ B2IPoint(sal_Int32 nX, sal_Int32 nY)
+ : B2ITuple(nX, nY)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2ITuple-based classes
+ */
+ B2IPoint(const ::basegfx::B2ITuple& rTuple)
+ : B2ITuple(rTuple)
+ {}
+
+ /** *=operator to allow usage from B2IPoint, too
+ */
+ B2IPoint& operator*=( const B2IPoint& rPnt )
+ {
+ mnX *= rPnt.mnX;
+ mnY *= rPnt.mnY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2IPoint, too
+ */
+ B2IPoint& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2ITuple calculations
+ */
+ B2IPoint& operator=( const ::basegfx::B2ITuple& rPoint );
+
+ /** Transform point by given transformation matrix.
+
+ The translational components of the matrix are, in
+ contrast to B2DVector, applied.
+ */
+ B2IPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat );
+ };
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/point/b3dpoint.hxx b/include/basegfx/point/b3dpoint.hxx
new file mode 100644
index 000000000..e424f0a4c
--- /dev/null
+++ b/include/basegfx/point/b3dpoint.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B3DHomMatrix;
+
+ /** Base Point class with three double values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3DTuple. All necessary extensions
+ which are special for points will be added here.
+
+ @see B3DTuple
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC B3DPoint : public ::basegfx::B3DTuple
+ {
+ public:
+ /** Create a 3D Point
+
+ The point is initialized to (0.0, 0.0, 0.0)
+ */
+ B3DPoint()
+ {}
+
+ /** Create a 3D Point
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Point.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Point.
+
+ @param fZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Point.
+ */
+ B3DPoint(double fX, double fY, double fZ)
+ : B3DTuple(fX, fY, fZ)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3DTuple-based classes
+ */
+ B3DPoint(const ::basegfx::B3DTuple& rTuple)
+ : B3DTuple(rTuple)
+ {}
+
+ /** *=operator to allow usage from B3DPoint, too
+ */
+ B3DPoint& operator*=( const B3DPoint& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ mfZ *= rPnt.mfZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B3DPoint, too
+ */
+ B3DPoint& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3DTuple calculations
+ */
+ B3DPoint& operator=( const ::basegfx::B3DTuple& rVec )
+ {
+ mfX = rVec.getX();
+ mfY = rVec.getY();
+ mfZ = rVec.getZ();
+ return *this;
+ }
+
+ /** Transform point by given transformation matrix.
+
+ The translational components of the matrix are, in
+ contrast to B3DVector, applied.
+ */
+ B3DPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat );
+ };
+
+ // external operators
+
+
+ /** Transform B3DPoint by given transformation matrix.
+
+ Since this is a Point, translational components of the
+ matrix are used.
+ */
+ BASEGFX_DLLPUBLIC B3DPoint operator*( const B3DHomMatrix& rMat, const B3DPoint& rPoint );
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/WaveLine.hxx b/include/basegfx/polygon/WaveLine.hxx
new file mode 100644
index 000000000..b839c7519
--- /dev/null
+++ b/include/basegfx/polygon/WaveLine.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+
+namespace basegfx
+{
+// Creates a polygon of a wave line in the input rectangle.
+//
+// The polygon is created with points at the center of the rectangle,
+// and the quadratic control points at the upper and lower side. See
+// the diagram below.
+//
+// *----Q---------------Q------------*
+// | |
+// |P-------P-------P-------P-------P|
+// | |
+// *------------Q---------------Q----*
+//
+// P is the point
+// Q is the quadratic bezier control point
+//
+BASEGFX_DLLPUBLIC B2DPolygon createWaveLinePolygon(basegfx::B2DRectangle const& rRectangle);
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dlinegeometry.hxx b/include/basegfx/polygon/b2dlinegeometry.hxx
new file mode 100644
index 000000000..e12dd7498
--- /dev/null
+++ b/include/basegfx/polygon/b2dlinegeometry.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/polygon/b2dpolygontriangulator.hxx>
+
+namespace basegfx::utils
+{
+ /** Create line start/end geometry element, mostly arrows and things like that.
+
+ @param rCandidate
+ The polygon which needs to get that line ends and needs to have two points
+ at least.
+
+ @param rArrow
+ The line start/end geometry. It is assumed that the tip is pointing
+ upwards. Result will be rotated and scaled to fit.
+
+ @param bStart
+ describes if creation is for start or end of candidate.
+
+ @param fWidth
+ defines the size of the element, it's describing the target width in X
+ of the arrow.
+
+ @param fDockingPosition needs to be in [0.0 ..1.0] range, where 0.0 means
+ that the tip of the arrow will be aligned with the polygon start, 1.0 means
+ the bottom. The default of 0.5 describes a centered arrow.
+
+ @param pConsumedLength
+ Using this parameter it is possible to get back how much from the candidate
+ geometry is overlapped by the created element (consumed).
+
+ @param fCandidateLength
+ This should contain the length of rCandidate to allow work without
+ again calculating the length (which may be expensive with beziers). If 0.0 is
+ given, the length is calculated on demand.
+
+ @param fShift
+ When it is necessary to count with the thickness of the line, it
+ makes sense to move the start position slightly - so define the shift.
+
+ @return
+ The Line start and end polygon, correctly rotated and scaled
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createAreaGeometryForLineStartEnd(
+ const B2DPolygon& rCandidate,
+ const B2DPolyPolygon& rArrow,
+ bool bStart,
+ double fWidth,
+ double fCandidateLength, // 0.0 -> calculate self
+ double fDockingPosition, // 0->top, 1->bottom
+ double* pConsumedLength = nullptr,
+ double fShift = 0.0);
+
+ /** create filled polygon geometry for lines with a line width
+
+ This method will create bezier based, fillable polygons which
+ will resample the curve if it was extended for the given half
+ line width. It will remove extrema positions from contained
+ bezier segments and get as close as possible and defined by
+ the given parameters to the ideal result.
+
+ It will check edges for trivial bezier to avoid unnecessary
+ bezier polygons. Care is taken to produce the in-between
+ polygon points (the ones original on the source polygon) since
+ it has showed that without those, the raster converters leave
+ non-filled gaps.
+
+ @param rCandidate
+ The source polygon defining the hairline polygon path
+
+ @param fHalfLineWidth
+ The width of the line to one side
+
+ @param eJoin
+ The LineJoin if the edges meeting in a point do not have a C1
+ or C2 continuity
+
+ @param eCap
+ The kind of cap, which is added to the line.
+
+ @param fMaxAllowedAngle
+ Allows to hand over the maximum allowed angle between an edge and
+ it's control vectors. The smaller, the more subdivisions will be
+ needed to create the filled geometry. Allowed range is cropped to
+ [M_PI_2 .. 0.01 * M_PI_2].
+
+ @param fMaxPartOfEdge
+ Allows to influence from with relative length of a control vector
+ compared to its edge a split is forced. The smaller, the more
+ subdivisions will be needed to create the filled geometry. Allowed
+ range is cropped to [1.0 .. 0.01]
+
+ @param fMiterMinimumAngle
+ The minimum wanted angle between two edges when edge rounding
+ is using miter. When an edge is smaller than this (tighter)
+ the usual fallback to bevel is used. Allowed range is cropped
+ to [M_PI .. 0.01 * M_PI].
+
+ Commit 51b5b93092d6231615de470c62494c24e54828a1 needs
+ revert, we need the triangulation for X11 fat line drawing
+
+ @param pTriangles
+ If given, the method will additionally add the created geometry as
+ B2DTriangle's
+
+ @return
+ The tools::PolyPolygon containing the geometry of the extended line by
+ it's line width. Contains bezier segments and edge roundings as
+ needed and defined.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createAreaGeometry(
+ const B2DPolygon& rCandidate,
+ double fHalfLineWidth,
+ B2DLineJoin eJoin,
+ css::drawing::LineCap eCap,
+ double fMaxAllowedAngle = basegfx::deg2rad(12.5),
+ double fMaxPartOfEdge = 0.4,
+ double fMiterMinimumAngle = basegfx::deg2rad(15.0),
+ basegfx::triangulator::B2DTriangleVector* pTriangles = nullptr);
+
+} // end of namespace basegfx::utils
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygon.hxx b/include/basegfx/polygon/b2dpolygon.hxx
new file mode 100644
index 000000000..c5a862773
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygon.hxx
@@ -0,0 +1,279 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <ostream>
+#include <vector>
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+class ImplB2DPolygon;
+
+namespace basegfx
+{
+ class B2DPoint;
+ class B2DRange;
+ class B2DHomMatrix;
+ class B2DCubicBezier;
+ class SystemDependentData;
+ class SystemDependentDataManager;
+ typedef std::shared_ptr<SystemDependentData> SystemDependentData_SharedPtr;
+}
+
+namespace basegfx
+{
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC B2DPolygon
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB2DPolygon > ImplType;
+
+ private:
+ // internal data.
+ ImplType mpPolygon;
+
+ public:
+ /// diverse constructors
+ B2DPolygon();
+ B2DPolygon(const B2DPolygon& rPolygon);
+ B2DPolygon(B2DPolygon&& rPolygon);
+ B2DPolygon(const B2DPolygon& rPolygon, sal_uInt32 nIndex, sal_uInt32 nCount);
+ B2DPolygon(std::initializer_list<basegfx::B2DPoint> rPoints);
+
+ ~B2DPolygon();
+
+ /// assignment operator
+ B2DPolygon& operator=(const B2DPolygon& rPolygon);
+ B2DPolygon& operator=(B2DPolygon&& rPolygon);
+
+ /// unshare this polygon with all internally shared instances
+ void makeUnique();
+
+ /// compare operators
+ bool operator==(const B2DPolygon& rPolygon) const;
+ bool operator!=(const B2DPolygon& rPolygon) const;
+
+ /// member count
+ sal_uInt32 count() const;
+
+ /// Coordinate interface
+ basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const;
+ void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
+
+ /// Coordinate insert/append
+ void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1);
+ void append(const basegfx::B2DPoint& rPoint, sal_uInt32 nCount);
+ void append(const basegfx::B2DPoint& rPoint);
+ void reserve(sal_uInt32 nCount);
+
+ /// Basic ControlPoint interface
+ basegfx::B2DPoint getPrevControlPoint(sal_uInt32 nIndex) const;
+ basegfx::B2DPoint getNextControlPoint(sal_uInt32 nIndex) const;
+ void setPrevControlPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
+ void setNextControlPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
+ void setControlPoints(sal_uInt32 nIndex, const basegfx::B2DPoint& rPrev, const basegfx::B2DPoint& rNext);
+
+ /// ControlPoint resets
+ void resetPrevControlPoint(sal_uInt32 nIndex);
+ void resetNextControlPoint(sal_uInt32 nIndex);
+ void resetControlPoints();
+
+ /// Bezier segment append with control points. The current last polygon point is implicitly taken as start point.
+ void appendBezierSegment(const basegfx::B2DPoint& rNextControlPoint,
+ const basegfx::B2DPoint& rPrevControlPoint,
+ const basegfx::B2DPoint& rPoint);
+
+ /// This is a shortcut to append a quadratic bezier segment. The current last polygon point is implicitly taken as start point.
+ /// Note that the quadratic bezier control points will be converted to cubic bezier with 2 control points.
+ void appendQuadraticBezierSegment(const basegfx::B2DPoint& rQuadControlPoint,
+ const basegfx::B2DPoint& rPoint);
+
+ /// ControlPoint checks
+ bool areControlPointsUsed() const;
+ bool isPrevControlPointUsed(sal_uInt32 nIndex) const;
+ bool isNextControlPointUsed(sal_uInt32 nIndex) const;
+ B2VectorContinuity getContinuityInPoint(sal_uInt32 nIndex) const;
+
+ /** bezier segment access
+
+ This method also works when it is no bezier segment at all and will fill
+ the given B2DCubicBezier as needed.
+ In any case, the given B2DCubicBezier will be filled, if necessary with
+ the single start point (if no valid edge exists).
+
+ @param nIndex
+ Index of the addressed edge's start point
+
+ @param rTarget
+ The B2DCubicBezier to be filled. It's data WILL be changed.
+ */
+ void getBezierSegment(sal_uInt32 nIndex, B2DCubicBezier& rTarget) const;
+
+ /** Default adaptive subdivision access
+
+ This method will return a default adaptive subdivision of the polygon.
+ If the polygon does not contain any bezier curve segments, it will
+ just return itself.
+
+ The subdivision is created on first request and buffered, so when using
+ this subdivision You have the guarantee for fast accesses for multiple
+ usages. It is intended for tooling usage for tasks which would be hard
+ to accomplish on bezier segments (e.g. isInEpsilonRange).
+
+ The current default subdivision uses adaptiveSubdivideByCount with 9
+ subdivisions which gives 10 edges and 11 points per segment and is
+ usually pretty usable for processing purposes. There is no parameter
+ passing here ATM but it may be changed on demand. If needed, a TYPE
+ and PARAMETER (both defaulted) may be added to allow for switching
+ between the different kinds of subdivisioned and passing them one
+ parameter.
+
+ The lifetime of the buffered subdivision is based on polygon changes.
+ When changing the polygon, it will be flushed. It is buffered at the
+ refcounted implementation class, so it will survive copy by value and
+ combinations in PolyPolygons.
+
+ @return
+ The default (and buffered) subdivision of this polygon. It may
+ be this polygon itself when it has no bezier segments. It is guaranteed
+ to have no more bezier segments
+ */
+ B2DPolygon const & getDefaultAdaptiveSubdivision() const;
+
+ /** Get the B2DRange (Rectangle dimensions) of this B2DPolygon
+
+ A polygon may have up to three ranges:
+
+ (a) the range of the polygon points
+ (b) the range of the polygon points and control points
+ (c) the outer range of the subdivided bezier curve
+
+ Ranges (a) and (c) are produced by tools::getRange(); resp. this
+ getB2DRange(). tools::getRangeWithControlPoints handles case (b).
+
+ To get range (c) a simple solution would be to subdivide the polygon
+ and use getRange() on it. Since subdivision is expensive and decreases
+ the polygon quality, i added this new method. It will use a
+ methodology suggested by HDU. First, it gets the range (a).
+ Then it iterates over the bezier segments and for each it
+ first tests if the outer range of the bezier segment is already
+ contained in the result range.
+
+ The subdivision itself uses getAllExtremumPositions() to only
+ calculate extremum points and to expand the result accordingly.
+ Thus it calculates maximal four extremum points on the bezier
+ segment, no split is used at all.
+
+ @return
+ The outer range of the bezier curve/polygon
+ */
+ B2DRange const & getB2DRange() const;
+
+ /** append other 2D polygons
+
+ The default (nIndex ==0 && nCount == 0) will append
+ the whole rPoly
+
+ @param rPoly
+ The source polygon
+
+ @param nIndex
+ The index to the first point of rPoly to append
+
+ @param nCount
+ The number of points to append from rPoly, starting
+ from nIndex. If zero, as much as possible is appended
+ */
+ void append(const B2DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
+
+ /// remove points
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ /// clear all points
+ void clear();
+
+ /// closed state interface
+ bool isClosed() const;
+ void setClosed(bool bNew);
+
+ /// flip polygon direction
+ void flip();
+
+ /// test if Polygon has double points
+ bool hasDoublePoints() const;
+
+ /// remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ /// apply transformation given in matrix form
+ void transform(const basegfx::B2DHomMatrix& rMatrix);
+
+ // exclusive management op's for SystemDependentData at B2DPolygon
+ template<class T>
+ std::shared_ptr<T> getSystemDependentData() const
+ {
+ return std::static_pointer_cast<T>(getSystemDependantDataInternal(typeid(T).hash_code()));
+ }
+
+ template<class T, class... Args>
+ std::shared_ptr<T> addOrReplaceSystemDependentData(SystemDependentDataManager& manager, Args&&... args) const
+ {
+ std::shared_ptr<T> r = std::make_shared<T>(manager, std::forward<Args>(args)...);
+
+ // tdf#129845 only add to buffer if a relevant buffer time is estimated
+ if(r->calculateCombinedHoldCyclesInSeconds() > 0)
+ {
+ basegfx::SystemDependentData_SharedPtr r2(r);
+ addOrReplaceSystemDependentDataInternal(r2);
+ }
+
+ return r;
+ }
+
+ private:
+ void addOrReplaceSystemDependentDataInternal(SystemDependentData_SharedPtr& rData) const;
+ SystemDependentData_SharedPtr getSystemDependantDataInternal(size_t hash_code) const;
+ };
+
+ // typedef for a vector of B2DPolygons
+ typedef ::std::vector< B2DPolygon > B2DPolygonVector;
+
+ template< typename charT, typename traits >
+ inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const B2DPolygon& poly )
+ {
+ stream << "<" << poly.count() << ":";
+ for (sal_uInt32 i = 0; i < poly.count(); i++)
+ {
+ if (i > 0)
+ stream << "--";
+ stream << poly.getB2DPoint(i);
+ }
+ stream << ">";
+
+ return stream;
+ }
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygonclipper.hxx b/include/basegfx/polygon/b2dpolygonclipper.hxx
new file mode 100644
index 000000000..a6a2ce9d2
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygonclipper.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DRange;
+}
+
+namespace basegfx::utils
+{
+ // This method clips the given tools::PolyPolygon against a horizontal or vertical axis (parallel to X or Y axis). The axis is
+ // defined by bParallelToXAxis (true -> it's parallel to the X-Axis of the coordinate system, else to the Y-Axis) and the
+ // fValueOnOtherAxis (gives the translation to the coordinate system axis). For example, when You want to define
+ // a clip axis parallel to X.Axis and 100 above it, use bParallelToXAxis = true and fValueOnOtherAxis = 100.
+ // The value bAboveAxis defines on which side the return value will be (true -> above X, right of Y).
+ // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
+ B2DPolyPolygon clipPolyPolygonOnParallelAxis(const B2DPolyPolygon& rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke);
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnParallelAxis(const B2DPolygon& rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke);
+
+ // Clip the given tools::PolyPolygon against the given range. bInside defines if the result will contain the
+ // parts which are contained in the range or vice versa.
+ // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnRange(const B2DPolyPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke);
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnRange(const B2DPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke);
+
+ // Clip given tools::PolyPolygon against given clipping polygon.
+ // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
+ // With stroke polygons, You get all line snippets inside rCip.
+ // With filled polygons, You get all tools::PolyPolygon parts which were inside rClip.
+ // The switch bInside decides if the parts inside the clip polygon or outside shall be created.
+ // The clip polygon is always assumed closed, even when it's isClosed() is false.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPolyPolygon& rClip,
+ bool bInside, bool bStroke, size_t *pPointLimit = nullptr);
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnPolyPolygon(const B2DPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke);
+
+ // clip the given polygon against the given range. the resulting polygon will always contain
+ // the inside parts which will always be interpreted as areas. the incoming polygon is expected
+ // to be a simple triangle list. the result is also a simple triangle list.
+ BASEGFX_DLLPUBLIC B2DPolygon clipTriangleListOnRange( const B2DPolygon& rCandidate, const B2DRange& rRange );
+
+} // end of namespace basegfx::utils
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygoncutandtouch.hxx b/include/basegfx/polygon/b2dpolygoncutandtouch.hxx
new file mode 100644
index 000000000..600ad1c5c
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygoncutandtouch.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+namespace basegfx::utils
+{
+
+// look for self-intersections and self-touches (points on an edge) in given polygon and add
+// extra points there. Result will have no touches or intersections on an edge, only on points
+B2DPolygon addPointsAtCutsAndTouches(const B2DPolygon& rCandidate, size_t* pPointLimit = nullptr);
+
+// look for polypolygon-intersections and polypolygon-touches (point of poly A on an edge of poly B) in given tools::PolyPolygon and add
+// extra points there. Result will have no touches or intersections between contained polygons on an edge, only on points. For
+// convenience, the correction for self-intersections for each member polygon will be used, too.
+B2DPolyPolygon addPointsAtCutsAndTouches(const B2DPolyPolygon& rCandidate, size_t* pPointLimit = nullptr);
+
+// look for intersections of rCandidate with the edge from rStart to rEnd and add extra points there.
+// Points are only added in the range of the edge, not on the endless vector.
+B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPoint& rStart, const B2DPoint& rEnd);
+
+// look for intersections of rCandidate with the mask Polygon and add extra points there.
+// The mask polygon is assumed to be closed, even when it's not explicitly.
+B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPolyPolygon& rMask);
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx
new file mode 100644
index 000000000..8f3ef342f
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygontools.hxx
@@ -0,0 +1,529 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vector>
+#include <functional>
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontriangulator.hxx>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/FlagSequence.hpp>
+#include <basegfx/basegfxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+
+namespace basegfx { class B2DPolyPolygon; }
+
+// Definitions for the cut flags used from the findCut methods
+enum class CutFlagValue
+{
+ NONE = 0x0000,
+ LINE = 0x0001,
+ START1 = 0x0002,
+ START2 = 0x0004,
+ END1 = 0x0008,
+ END2 = 0x0010,
+ ALL = LINE|START1|START2|END1|END2,
+ DEFAULT = LINE|START2|END2,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<CutFlagValue> : is_typed_flags<CutFlagValue, 0x1f> {};
+}
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DRange;
+}
+
+namespace basegfx::utils
+{
+ // B2DPolygon tools
+
+ // open/close with point add/remove and control point corrections
+ BASEGFX_DLLPUBLIC void openWithGeometryChange(B2DPolygon& rCandidate);
+ BASEGFX_DLLPUBLIC void closeWithGeometryChange(B2DPolygon& rCandidate);
+
+ /** Check if given polygon is closed.
+
+ This is kind of a 'classic' method to support old polygon
+ definitions. Those old polygon definitions define the
+ closed state of the polygon using identical start and
+ endpoints. This method corrects this (removes double
+ start/end points) and sets the Closed()-state of the
+ polygon correctly.
+ */
+ BASEGFX_DLLPUBLIC void checkClosed(B2DPolygon& rCandidate);
+
+ // Get successor and predecessor indices. Returning the same index means there
+ // is none. Same for successor.
+ BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate);
+ BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate);
+
+ // Get orientation of Polygon
+ BASEGFX_DLLPUBLIC B2VectorOrientation getOrientation(const B2DPolygon& rCandidate);
+
+ // isInside tests for B2dPoint and other B2dPolygon. On border is not inside as long as
+ // not true is given in bWithBorder flag.
+ BASEGFX_DLLPUBLIC bool isInside(const B2DPolygon& rCandidate, const B2DPoint& rPoint, bool bWithBorder = false);
+ BASEGFX_DLLPUBLIC bool isInside(const B2DPolygon& rCandidate, const B2DPolygon& rPolygon, bool bWithBorder = false);
+
+ /** Get the range of a polygon
+
+ This method creates the outer range of the subdivided bezier curve.
+ For detailed discussion see B2DPolygon::getB2DRange()
+
+ @param rCandidate
+ The B2DPolygon possibly containing bezier segments
+
+ @return
+ The outer range of the bezier curve
+ */
+ BASEGFX_DLLPUBLIC B2DRange getRange(const B2DPolygon& rCandidate);
+
+ // get signed area of polygon
+ BASEGFX_DLLPUBLIC double getSignedArea(const B2DPolygon& rCandidate);
+
+ // get area of polygon
+ BASEGFX_DLLPUBLIC double getArea(const B2DPolygon& rCandidate);
+
+ /** get length of polygon edge from point nIndex to nIndex + 1 */
+ BASEGFX_DLLPUBLIC double getEdgeLength(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ /** get length of polygon */
+ BASEGFX_DLLPUBLIC double getLength(const B2DPolygon& rCandidate);
+
+ // get position on polygon for absolute given distance. If
+ // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
+ // using getLength(...)
+ BASEGFX_DLLPUBLIC B2DPoint getPositionAbsolute(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
+
+ // get position on polygon for relative given distance in range [0.0 .. 1.0]. If
+ // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
+ // using getLength(...)
+ BASEGFX_DLLPUBLIC B2DPoint getPositionRelative(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
+
+ // get a snippet from given polygon for absolute distances. The polygon is assumed
+ // to be opened (not closed). fFrom and fTo need to be in range [0.0 .. fLength], where
+ // fTo >= fFrom. If length is given, it is assumed the correct polygon length,
+ // if 0.0 it is calculated using getLength(...)
+ BASEGFX_DLLPUBLIC B2DPolygon getSnippetAbsolute(const B2DPolygon& rCandidate, double fFrom, double fTo, double fLength = 0.0);
+
+ // Continuity check for point with given index
+ BASEGFX_DLLPUBLIC B2VectorContinuity getContinuityInPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // Subdivide all contained curves. Use distanceBound value if given.
+ BASEGFX_DLLPUBLIC B2DPolygon adaptiveSubdivideByDistance(const B2DPolygon& rCandidate, double fDistanceBound);
+
+ // Subdivide all contained curves. Use angleBound value if given.
+ BASEGFX_DLLPUBLIC B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon& rCandidate, double fAngleBound = 0.0);
+
+ // This version works with two points and vectors to define the
+ // edges for the cut test.
+ BASEGFX_DLLPUBLIC CutFlagValue findCut(
+ const B2DPoint& rEdge1Start, const B2DVector& rEdge1Delta,
+ const B2DPoint& rEdge2Start, const B2DVector& rEdge2Delta,
+ CutFlagValue aCutFlags = CutFlagValue::DEFAULT,
+ double* pCut1 = nullptr, double* pCut2 = nullptr);
+
+ // test if point is on the given edge in range ]0.0..1.0[ without
+ // the start/end points. If so, return true and put the parameter
+ // value in pCut (if provided)
+ BASEGFX_DLLPUBLIC bool isPointOnEdge(
+ const B2DPoint& rPoint,
+ const B2DPoint& rEdgeStart,
+ const B2DVector& rEdgeDelta,
+ double* pCut = nullptr);
+
+ /** Apply given LineDashing to given polygon
+
+ This method is used to cut down line polygons to the needed
+ pieces when a dashing needs to be applied.
+ It is now capable of keeping contained bezier segments.
+ It is also capable of delivering line and non-line portions
+ depending on what target polygons You provide. This is useful
+ e.g. for dashed lines with two colors.
+ If the last and the first snippet in one of the results have
+ a common start/end ppoint, they will be merged to achieve as
+ view as needed result line snippets. This is also relevant for
+ further processing the results.
+
+ @param rCandidate
+ The polygon based on which the snippets will be created.
+
+ @param rDotDashArray
+ The line pattern given as array of length values
+
+ @param pLineTarget
+ The target for line snippets, e.g. the first entry will be
+ a line segment with length rDotDashArray[0]. The given
+ polygon will be emptied as preparation.
+
+ @param pGapTarget
+ The target for gap snippets, e.g. the first entry will be
+ a line segment with length rDotDashArray[1]. The given
+ polygon will be emptied as preparation.
+
+ @param fFullDashDotLen
+ The summed-up length of the rDotDashArray. If zero, it will
+ be calculated internally.
+
+ There is now a 2nd version that allows to provide callback
+ functions that get called when a snippet of a line/gap is
+ produced and needs to be added. This allows to use it like
+ a 'pipeline'. When using this (e.g. the 1st version uses
+ this internally to guarantee the same algorithm is used)
+ it is not needed to accumulate a potentially huge number
+ of polygons in the result-polyPolygons, but e.g. consume
+ them directly in the caller. Example is rendering a
+ dashed line but without creating the potentially huge amount
+ of polygons.
+ The 2nd version will also merge first/last line/gap snippets
+ if the input polygon is closed and the start/end-points match
+ accordingly - at the cost that this will be delivered last.
+ */
+ BASEGFX_DLLPUBLIC void applyLineDashing(
+ const B2DPolygon& rCandidate,
+ const std::vector<double>& rDotDashArray,
+ std::function<void(const basegfx::B2DPolygon& rSnippet)> aLineTargetCallback,
+ std::function<void(const basegfx::B2DPolygon& rSnippet)> aGapTargetCallback = std::function<void(const basegfx::B2DPolygon&)>(),
+ double fDotDashLength = 0.0);
+ BASEGFX_DLLPUBLIC void applyLineDashing(
+ const B2DPolygon& rCandidate,
+ const ::std::vector<double>& rDotDashArray,
+ B2DPolyPolygon* pLineTarget,
+ B2DPolyPolygon* pGapTarget = nullptr,
+ double fDotDashLength = 0.0);
+
+ // test if point is inside epsilon-range around an edge defined
+ // by the two given points. Can be used for HitTesting. The epsilon-range
+ // is defined to be the rectangle centered to the given edge, using height
+ // 2 x fDistance, and the circle around both points with radius fDistance.
+ BASEGFX_DLLPUBLIC bool isInEpsilonRange(const B2DPoint& rEdgeStart, const B2DPoint& rEdgeEnd, const B2DPoint& rTestPosition, double fDistance);
+
+ // test if point is inside epsilon-range around the given Polygon. Can be used
+ // for HitTesting. The epsilon-range is defined to be the rectangle centered
+ // to the given edge, using height 2 x fDistance, and the circle around both points
+ // with radius fDistance.
+ BASEGFX_DLLPUBLIC bool isInEpsilonRange(const B2DPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance);
+
+ /** Create a polygon from a rectangle.
+
+ @param rRect
+ The rectangle which describes the polygon size
+
+ @param fRadiusX
+ @param fRadiusY
+ Radius of the edge rounding, relative to the rectangle size. 0.0 means no
+ rounding, 1.0 will lead to an ellipse
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromRect( const B2DRectangle& rRect, double fRadiusX, double fRadiusY );
+
+ /** Create a polygon from a rectangle.
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromRect( const B2DRectangle& rRect );
+
+ /** Create the unit polygon
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon const & createUnitPolygon();
+
+ /** Create a circle polygon with given radius.
+
+ This method creates a circle approximation consisting of
+ 12 cubic bezier segments, which approximate the given
+ circle with an error of less than 0.5 percent.
+
+ @param rCenter
+ Center point of the circle
+
+ @param fRadius
+ Radius of the circle
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius );
+
+ /// create half circle centered on (0,0) from [0 .. M_PI]
+ B2DPolygon const & createHalfUnitCircle();
+
+ /** create a polygon which describes the unit circle and close it
+
+ @param nStartQuadrant
+ To be able to rebuild the old behaviour where the circles started at bottom,
+ this parameter is used. Default is 0 which is the first quadrant and the
+ polygon's start point will be the rightmost one. When using e.g. 1, the
+ first created quadrant will start at the YMax-position (with Y down on screens,
+ this is the lowest one). This is needed since when lines are dashed, toe old
+ geometry started at bottom point, else it would look different.
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon const & createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant = 0);
+
+ /** Create an ellipse polygon with given radii.
+
+ This method creates an ellipse approximation consisting of
+ 12 cubic bezier segments, which approximate the given
+ ellipse with an error of less than 0.5 percent.
+
+ @param rCenter
+ Center point of the circle
+
+ @param fRadiusX
+ Radius of the ellipse in X direction
+
+ @param fRadiusY
+ Radius of the ellipse in Y direction
+
+ @param nStartQuadrant
+ With Y down on screens, 0 = 3 o'clock, 1 = 6 o'clock, 2 = 9 o'clock, 3 = 12 o'clock
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, sal_uInt32 nStartQuadrant = 0);
+
+ /** Create a unit ellipse polygon with the given angles, from start to end
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd );
+
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromUnitEllipseSegment( double fStart, double fEnd );
+
+ /** Predicate whether a given polygon is a rectangle.
+
+ @param rPoly
+ Polygon to check
+
+ @return true, if the polygon describes a rectangle
+ (polygon is closed, and the points are either cw or ccw
+ enumerations of a rectangle's vertices). Note that
+ intermediate points and duplicate points are ignored.
+ */
+ BASEGFX_DLLPUBLIC bool isRectangle( const B2DPolygon& rPoly );
+
+ // create 3d polygon from given 2d polygon. The given fZCoordinate is used to expand the
+ // third coordinate.
+ BASEGFX_DLLPUBLIC B3DPolygon createB3DPolygonFromB2DPolygon(const B2DPolygon& rCandidate, double fZCoordinate = 0.0);
+
+ // create 2d tools::PolyPolygon from given 3d PolyPolygon. All coordinates are transformed using the given
+ // matrix and the resulting x,y is used to form the new polygon.
+ BASEGFX_DLLPUBLIC B2DPolygon createB2DPolygonFromB3DPolygon(const B3DPolygon& rCandidate, const B3DHomMatrix& rMat);
+
+ // calculate the smallest distance to given edge and return. The relative position on the edge is returned in Cut.
+ // That position is in the range [0.0 .. 1.0] and the returned distance is adapted accordingly to the start or end
+ // point of the edge
+ BASEGFX_DLLPUBLIC double getSmallestDistancePointToEdge(const B2DPoint& rPointA, const B2DPoint& rPointB, const B2DPoint& rTestPoint, double& rCut);
+
+ // for each contained edge calculate the smallest distance. Return the index to the smallest
+ // edge in rEdgeIndex. The relative position on the edge is returned in rCut.
+ // If nothing was found (e.g. empty input plygon), DBL_MAX is returned.
+ BASEGFX_DLLPUBLIC double getSmallestDistancePointToPolygon(const B2DPolygon& rCandidate, const B2DPoint& rTestPoint, sal_uInt32& rEdgeIndex, double& rCut);
+
+ // distort single point. rOriginal describes the original range, where the given points describe the distorted corresponding points.
+ BASEGFX_DLLPUBLIC B2DPoint distort(const B2DPoint& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight);
+
+ // distort polygon. rOriginal describes the original range, where the given points describe the distorted corresponding points.
+ BASEGFX_DLLPUBLIC B2DPolygon distort(const B2DPolygon& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight);
+
+ // expand all segments (which are not yet) to curve segments. This is done with setting the control
+ // vectors on the 1/3 resp. 2/3 distances on each segment.
+ BASEGFX_DLLPUBLIC B2DPolygon expandToCurve(const B2DPolygon& rCandidate);
+
+ // expand given segment to curve segment. This is done with setting the control
+ // vectors on the 1/3 resp. 2/3 distances. The return value describes if a change took place.
+ BASEGFX_DLLPUBLIC bool expandToCurveInPoint(B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // set continuity for given index. If not a curve, nothing will change. Non-curve points are not changed, too.
+ // The return value describes if a change took place.
+ BASEGFX_DLLPUBLIC bool setContinuityInPoint(B2DPolygon& rCandidate, sal_uInt32 nIndex, B2VectorContinuity eContinuity);
+
+ // test if polygon contains neutral points. A neutral point is one whose orientation is neutral
+ // e.g. positioned on the edge of its predecessor and successor
+ BASEGFX_DLLPUBLIC bool hasNeutralPoints(const B2DPolygon& rCandidate);
+
+ // remove neutral points. A neutral point is one whose orientation is neutral
+ // e.g. positioned on the edge of its predecessor and successor
+ BASEGFX_DLLPUBLIC B2DPolygon removeNeutralPoints(const B2DPolygon& rCandidate);
+
+ // tests if polygon is convex
+ BASEGFX_DLLPUBLIC bool isConvex(const B2DPolygon& rCandidate);
+
+ // calculates the orientation at edge nIndex
+ BASEGFX_DLLPUBLIC B2VectorOrientation getOrientationForIndex(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // calculates if given point is on given line, taking care of the numerical epsilon
+ BASEGFX_DLLPUBLIC bool isPointOnLine(const B2DPoint& rStart, const B2DPoint& rEnd, const B2DPoint& rCandidate, bool bWithPoints);
+
+ // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses
+ // isPointOnLine internally
+ BASEGFX_DLLPUBLIC bool isPointOnPolygon(const B2DPolygon& rCandidate, const B2DPoint& rPoint, bool bWithPoints = true);
+
+ // test if candidate is inside triangle
+ BASEGFX_DLLPUBLIC bool isPointInTriangle(const B2DPoint& rA, const B2DPoint& rB, const B2DPoint& rC, const B2DPoint& rCandidate, bool bWithBorder);
+
+ // test if candidateA and candidateB are on the same side of the given line
+ bool arePointsOnSameSideOfLine(const B2DPoint& rStart, const B2DPoint& rEnd, const B2DPoint& rCandidateA, const B2DPoint& rCandidateB, bool bWithLine);
+
+ // add triangles for given rCandidate to rTarget. For each triangle, 3 points will be added to rCandidate.
+ // All triangles will go from the start point of rCandidate to two consecutive points, building (rCandidate.count() - 2)
+ // triangles.
+ void addTriangleFan(
+ const B2DPolygon& rCandidate,
+ triangulator::B2DTriangleVector& rTarget);
+
+ // grow for polygon. Move all geometry in each point in the direction of the normal in that point
+ // with the given amount. Value may be negative.
+ BASEGFX_DLLPUBLIC B2DPolygon growInNormalDirection(const B2DPolygon& rCandidate, double fValue);
+
+ // force all sub-polygons to a point count of nSegments
+ BASEGFX_DLLPUBLIC B2DPolygon reSegmentPolygon(const B2DPolygon& rCandidate, sal_uInt32 nSegments);
+
+ // create polygon state at t from 0.0 to 1.0 between the two polygons. Both polygons must have the same
+ // organisation, e.g. same amount of points
+ BASEGFX_DLLPUBLIC B2DPolygon interpolate(const B2DPolygon& rOld1, const B2DPolygon& rOld2, double t);
+
+ // #i76891# Try to remove existing curve segments if they are simply edges
+ BASEGFX_DLLPUBLIC B2DPolygon simplifyCurveSegments(const B2DPolygon& rCandidate);
+
+ // makes the given indexed point the new polygon start point. To do that, the points in the
+ // polygon will be rotated. This is only valid for closed polygons, for non-closed ones
+ // an assertion will be triggered
+ BASEGFX_DLLPUBLIC B2DPolygon makeStartPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndexOfNewStatPoint);
+
+ /** create edges of given length along given B2DPolygon
+
+ @param rCandidate
+ The polygon to move along. Points at the given polygon are created, starting
+ at position fStart and stopping at less or equal to fEnd. The closed state is
+ preserved.
+ The polygon is subdivided if curve segments are included. That subdivision is the base
+ for the newly created points.
+ If the source is closed, the indirectly existing last edge may NOT have the
+ given length.
+ If the source is open, all edges will have the given length. You may use the last
+ point of the original when You want to add the last edge Yourself.
+
+ @param fLength
+ The length of the created edges. If less or equal zero, an empty polygon is returned.
+
+ @param fStart
+ The start distance for the first to be generated point. Use 0.0 to get the
+ original start point. Negative values are truncated to 0.0.
+
+ @param fEnd
+ The maximum distance for the last point. No more points behind this distance will be created.
+ Use 0.0 to process the whole polygon. Negative values are truncated to 0.0. It also
+ needs to be more or equal to fStart, else it is truncated to fStart.
+
+ @return
+ The newly created polygon
+ */
+ B2DPolygon createEdgesOfGivenLength(const B2DPolygon& rCandidate, double fLength, double fStart = 0.0, double fEnd = 0.0);
+
+ /** Create Waveline along given polygon
+ The implementation is based on createEdgesOfGivenLength and creates a curve
+ segment with the given dimensions for each created line segment. The polygon
+ is treated as if opened (closed state will be ignored) and only for whole
+ edges a curve segment will be created (no rest handling)
+
+ @param rCandidate
+ The polygon along which the waveline will be created
+
+ @param fWaveWidth
+ The length of a single waveline curve segment
+
+ @param fgWaveHeight
+ The height of the waveline (amplitude)
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createWaveline(const B2DPolygon& rCandidate, double fWaveWidth, double fWaveHeight);
+
+ /** snap some polygon coordinates to discrete coordinates
+
+ This method allows to snap some polygon points to discrete (integer) values
+ which equals e.g. a snap to discrete coordinates. It will snap points of
+ horizontal and vertical edges
+
+ @param rCandidate
+ The source polygon
+
+ @return
+ The modified version of the source polygon
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate);
+
+ /// get the tangent with which the given point is entered seen from the previous
+ /// polygon path data. Take into account all stuff like closed state, zero-length edges and others.
+ BASEGFX_DLLPUBLIC B2DVector getTangentEnteringPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ /// get the tangent with which the given point is left seen from the following
+ /// polygon path data. Take into account all stuff like closed state, zero-length edges and others.
+ BASEGFX_DLLPUBLIC B2DVector getTangentLeavingPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ /// converters for css::drawing::PointSequence
+ BASEGFX_DLLPUBLIC B2DPolygon UnoPointSequenceToB2DPolygon(
+ const css::drawing::PointSequence& rPointSequenceSource);
+ BASEGFX_DLLPUBLIC void B2DPolygonToUnoPointSequence(
+ const B2DPolygon& rPolygon,
+ css::drawing::PointSequence& rPointSequenceRetval);
+
+ /* converters for css::drawing::PointSequence and
+ css::drawing::FlagSequence to B2DPolygon (curved polygons)
+ */
+ B2DPolygon UnoPolygonBezierCoordsToB2DPolygon(
+ const css::drawing::PointSequence& rPointSequenceSource,
+ const css::drawing::FlagSequence& rFlagSequenceSource);
+ void B2DPolygonToUnoPolygonBezierCoords(
+ const B2DPolygon& rPolyPolygon,
+ css::drawing::PointSequence& rPointSequenceRetval,
+ css::drawing::FlagSequence& rFlagSequenceRetval);
+
+ /** Read poly-polygon from SVG.
+
+ This function imports a poly-polygon from an SVG points
+ attribute (a plain list of coordinate pairs).
+
+ @param o_rPoly
+ The output polygon. Note that svg:points can only define a
+ single polygon
+
+ @param rSvgPointsAttribute
+ A valid SVG points attribute string
+
+ @return true, if the string was successfully parsed
+ */
+ BASEGFX_DLLPUBLIC bool importFromSvgPoints( B2DPolygon& o_rPoly,
+ std::u16string_view rSvgPointsAttribute );
+
+ /** Write poly-polygon to SVG.
+
+ This function imports a non-bezier polygon to SVG points
+ (a plain list of coordinate pairs).
+
+ @param rPoly
+ The polygon to export
+
+ @param rSvgPointsAttribute
+ A valid SVG points attribute string
+
+ @return true, if the string was successfully parsed
+ */
+ BASEGFX_DLLPUBLIC OUString exportToSvgPoints( const B2DPolygon& rPoly );
+
+} // end of namespace basegfx::utils
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygontriangulator.hxx b/include/basegfx/polygon/b2dpolygontriangulator.hxx
new file mode 100644
index 000000000..1fb2c9d54
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygontriangulator.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+#include <vector>
+
+namespace basegfx { class B2DPolyPolygon; }
+
+namespace basegfx::triangulator
+{
+ // Simple B2D-based triangle. Main reason is to
+ // keep the data types separated (before a B2DPolygon
+ // was used with the convention that three points in
+ // a row define a triangle)
+ class BASEGFX_DLLPUBLIC B2DTriangle
+ {
+ // positions
+ basegfx::B2DPoint maA;
+ basegfx::B2DPoint maB;
+ basegfx::B2DPoint maC;
+
+ public:
+ B2DTriangle(
+ const basegfx::B2DPoint& rA,
+ const basegfx::B2DPoint& rB,
+ const basegfx::B2DPoint& rC)
+ : maA(rA),
+ maB(rB),
+ maC(rC)
+ {
+ }
+
+ // get positions
+ const basegfx::B2DPoint& getA() const { return maA; }
+ const basegfx::B2DPoint& getB() const { return maB; }
+ const basegfx::B2DPoint& getC() const { return maC; }
+ };
+
+ // typedef for a vector of B2DTriangle
+ typedef ::std::vector< B2DTriangle > B2DTriangleVector;
+
+ // triangulate given polygon
+ BASEGFX_DLLPUBLIC B2DTriangleVector triangulate(const ::basegfx::B2DPolygon& rCandidate);
+
+ // triangulate given PolyPolygon
+ BASEGFX_DLLPUBLIC B2DTriangleVector triangulate(const ::basegfx::B2DPolyPolygon& rCandidate);
+
+} // end of namespace basegfx::triangulator
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolypolygon.hxx b/include/basegfx/polygon/b2dpolypolygon.hxx
new file mode 100644
index 000000000..f1420edef
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolypolygon.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <ostream>
+#include <vector>
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class ImplB2DPolyPolygon;
+
+ class BASEGFX_DLLPUBLIC B2DPolyPolygon
+ {
+ private:
+ o3tl::cow_wrapper<ImplB2DPolyPolygon> mpPolyPolygon;
+
+ public:
+ B2DPolyPolygon();
+ B2DPolyPolygon(const B2DPolyPolygon& rPolyPolygon);
+ B2DPolyPolygon(B2DPolyPolygon&& rPolyPolygon);
+ explicit B2DPolyPolygon(const B2DPolygon& rPolygon);
+ ~B2DPolyPolygon();
+
+ // assignment operator
+ B2DPolyPolygon& operator=(const B2DPolyPolygon& rPolyPolygon);
+ B2DPolyPolygon& operator=(B2DPolyPolygon&& rPolyPolygon);
+
+ /// unshare this poly-polygon (and all included polygons) with all internally shared instances
+ void makeUnique();
+
+ // compare operators
+ bool operator==(const B2DPolyPolygon& rPolyPolygon) const;
+ bool operator!=(const B2DPolyPolygon& rPolyPolygon) const;
+
+ // polygon interface
+ sal_uInt32 count() const;
+
+ B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const;
+ void setB2DPolygon(sal_uInt32 nIndex, const B2DPolygon& rPolygon);
+
+ // test for curve
+ bool areControlPointsUsed() const;
+
+ // insert/append single polygon
+ void insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
+ void append(const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
+
+ /** Default adaptive subdivision access
+
+ For details refer to B2DPolygon::getDefaultAdaptiveSubdivision()
+
+ @return
+ The default subdivision of this polygon
+ */
+ B2DPolyPolygon getDefaultAdaptiveSubdivision() const;
+
+ /** Get the B2DRange (Rectangle dimensions) of this B2DPolyPolygon
+
+ For details refer to B2DPolygon::getB2DRange()
+
+ @return
+ The outer range of the bezier curve/polygon
+ */
+ B2DRange getB2DRange() const;
+
+ // insert/append multiple polygons
+ void insert(sal_uInt32 nIndex, const B2DPolyPolygon& rPolyPolygon);
+ void append(const B2DPolyPolygon& rPolyPolygon);
+
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ // reset to empty state
+ void clear();
+
+ // closed state
+ bool isClosed() const;
+ void setClosed(bool bNew);
+
+ // flip polygon direction
+ void flip();
+
+ // test if tools::PolyPolygon has double points
+ bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ // apply transformation given in matrix form to the polygon
+ void transform(const basegfx::B2DHomMatrix& rMatrix);
+
+ // polygon iterators (same iterator validity conditions as for vector)
+ const B2DPolygon* begin() const;
+ const B2DPolygon* end() const;
+ B2DPolygon* begin();
+ B2DPolygon* end();
+
+ // exclusive management op's for SystemDependentData at B2DPolygon
+ template<class T>
+ std::shared_ptr<T> getSystemDependentData() const
+ {
+ return std::static_pointer_cast<T>(getSystemDependantDataInternal(typeid(T).hash_code()));
+ }
+
+ template<class T, class... Args>
+ std::shared_ptr<T> addOrReplaceSystemDependentData(SystemDependentDataManager& manager, Args&&... args) const
+ {
+ std::shared_ptr<T> r = std::make_shared<T>(manager, std::forward<Args>(args)...);
+
+ // tdf#129845 only add to buffer if a relevant buffer time is estimated
+ if(r->calculateCombinedHoldCyclesInSeconds() > 0)
+ {
+ basegfx::SystemDependentData_SharedPtr r2(r);
+ addOrReplaceSystemDependentDataInternal(r2);
+ }
+
+ return r;
+ }
+
+ private:
+ void addOrReplaceSystemDependentDataInternal(SystemDependentData_SharedPtr& rData) const;
+ SystemDependentData_SharedPtr getSystemDependantDataInternal(size_t hash_code) const;
+ };
+
+ // typedef for a vector of B2DPolyPolygons
+ typedef ::std::vector< B2DPolyPolygon > B2DPolyPolygonVector;
+
+ template< typename charT, typename traits >
+ inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const B2DPolyPolygon& poly )
+ {
+ stream << "[" << poly.count() << ":";
+ for (sal_uInt32 i = 0; i < poly.count(); i++)
+ {
+ if (i > 0)
+ stream << ",";
+ stream << poly.getB2DPolygon(i);
+ }
+ stream << "]";
+
+ return stream;
+ }
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolypolygoncutter.hxx b/include/basegfx/polygon/b2dpolypolygoncutter.hxx
new file mode 100644
index 000000000..55dd29cf8
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolypolygoncutter.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx::utils
+{
+ /** Solve all crossovers (aka self-intersections) in a polyPolygon.
+
+ This re-layouts all contained polygons so that the result
+ will contain only non-cutting polygons. For that reason,
+ points will be added at crossover and touch points and the
+ single Polygons may be re-combined. The orientations of
+ the contained polygons in not changed but used as
+ topological information. Self crossovers of the contained
+ sub-polygons are implicitly handled, but to not lose the
+ topological information, it may be necessary to remove
+ self-intersections of the contained sub-polygons in a
+ preparing step and to explicitly correct their
+ orientations.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solveCrossovers(const B2DPolyPolygon& rCandidate,
+ size_t* pPointLimit = nullptr);
+
+ /** Solve all crossovers (aka self-intersections) in a Polygon
+
+ Same as above, but for single polygons. Result will be
+ free of self-intersections. When result contains multiple
+ polygons, it may be necessary to rearrange their
+ orientations since holes may have been created (possibly use
+ correctOrientations).
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solveCrossovers(const B2DPolygon& rCandidate);
+
+ /** Strip neutral polygons from PolyPolygon.
+
+ Neutral polygons are ones who's orientation is neutral, so
+ normally they have no volume -> just closed paths. A
+ polygon with the same positive and negative oriented
+ volume is also neutral, so this may not be wanted. It is
+ safe to call with self-intersection-free polygons, though
+ (that's where it's mostly used).
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon stripNeutralPolygons(const B2DPolyPolygon& rCandidate);
+
+ /** Remove unnecessary/non-displayed polygons.
+
+ Works only correct with self-intersection-free
+ polygons. For each polygon, the depth for the PolyPolygon
+ is calculated. The orientation is used to identify holes.
+ Start value for holes is -1, for polygons it's zero. Ech
+ time a polygon is contained in another one, it's depth is
+ increased when inside a polygon, decreased when inside a
+ hole. The result is a depth which e.g. is -1 for holes
+ outside everything, 1 for a polygon covered by another
+ polygon and zero for e.g. holes in a polygon or polygons
+ outside everything else. In the 2nd step, all polygons
+ with depth other than zero are removed. If bKeepAboveZero
+ is used, all polygons < 1 are removed. The bKeepAboveZero
+ mode is useful for clipping, e.g. just append one polygon
+ to another and use this mode -> only parts where two
+ polygons overlapped will be kept. In combination with
+ correct orientation of the input orientations and the
+ SolveCrossover calls this can be combined for logical
+ polygon operations or polygon clipping.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon stripDispensablePolygons(const B2DPolyPolygon& rCandidate, bool bKeepAboveZero = false);
+
+ /** Emulate nonzero winding rule filling.
+
+ Geometrically convert PolyPolygons which are proposed to
+ use nonzero fill rule to a representation where evenodd
+ paint will give the same result. To do this all
+ intersections and self-intersections get solved (the
+ polygons will be rearranged if needed). Then all polygons
+ which are inside another one with the same orientation get
+ deleted
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createNonzeroConform(const B2DPolyPolygon& rCandidate);
+
+ // For convenience: the four basic operations OR, XOR, AND and DIFF for
+ // two PolyPolygons. These are combinations of the above methods. To not be forced
+ // to do evtl. already done preparations twice, You have to do the operations Yourself.
+
+ // A source preparation consists of preparing it to be seen as XOR-Rule PolyPolygon,
+ // so it is freed of intersections, self-intersections and the orientations are corrected.
+ // Important is that it will define the same areas as before, but is intersection-free.
+ // As an example think about a single polygon looping in itself and having holes. To
+ // topologically correctly handle this, it is necessary to remove all intersections and
+ // to correct the orientations. The orientation of the isolated holes e.g. will be negative.
+ // Topologically it is necessary to prepare each polygon which is seen as entity. It is
+ // not sufficient just to concatenate them and prepare the result, this may be topologically
+ // different since the simple concatenation will be seen as XOR. To work correctly, You
+ // may need to OR those polygons.
+
+ /// prep for ops - solve self-intersections and intersections, remove neutral parts and check orientations.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon prepareForPolygonOperation(const B2DPolygon& rCandidate);
+ /// prep for ops - solve self-intersections and intersections, remove neutral parts and check orientations.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon prepareForPolygonOperation(const B2DPolyPolygon& rCandidate);
+
+ /// OR: Return all areas where CandidateA or CandidateB exist
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationOr(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /// XOR: Return all areas where CandidateA or CandidateB exist, but not both
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationXor(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /// AND: Return all areas where CandidateA and CandidateB exist
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationAnd(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /// DIFF: Return all areas where CandidateA is not covered by CandidateB (cut B out of A)
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationDiff(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /** merge all single PolyPolygons to a single, OR-ed PolyPolygon
+
+ @param rInput
+ The source PolyPolygons
+
+ @return A single tools::PolyPolygon containing the Or-merged result
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon mergeToSinglePolyPolygon(const B2DPolyPolygonVector& rInput);
+
+} // end of namespace basegfx::utils
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolypolygontools.hxx b/include/basegfx/polygon/b2dpolypolygontools.hxx
new file mode 100644
index 000000000..d253531f6
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolypolygontools.hxx
@@ -0,0 +1,297 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+#include <o3tl/sorted_vector.hxx>
+
+namespace com::sun::star::drawing { struct PolyPolygonBezierCoords; }
+
+namespace basegfx
+{
+ class B2DPolyPolygon;
+ class B2DRange;
+}
+
+namespace basegfx::utils
+{
+ // B2DPolyPolygon tools
+
+ // Check and evtl. correct orientations of all contained Polygons so that
+ // the orientations of contained polygons will variate to express areas and
+ // holes
+ BASEGFX_DLLPUBLIC B2DPolyPolygon correctOrientations(const B2DPolyPolygon& rCandidate);
+
+ // make sure polygon with index 0L is not a hole. This may evtl. change the
+ // sequence of polygons, but allows to use polygon with index 0L to
+ // get the correct normal for the whole polyPolygon
+ BASEGFX_DLLPUBLIC B2DPolyPolygon correctOutmostPolygon(const B2DPolyPolygon& rCandidate);
+
+ // Subdivide all contained curves. Use distanceBound value if given.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon adaptiveSubdivideByDistance(const B2DPolyPolygon& rCandidate, double fDistanceBound);
+
+ // Subdivide all contained curves. Use distanceBound value if given. Else, a convenient one
+ // is created.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon adaptiveSubdivideByAngle(const B2DPolyPolygon& rCandidate, double fAngleBound = 0.0);
+
+ // isInside test for B2dPoint. On border is not inside as long as not true is given
+ // in bWithBorder flag. It is assumed that the orientations of the given polygon are correct.
+ BASEGFX_DLLPUBLIC bool isInside(const B2DPolyPolygon& rCandidate, const B2DPoint& rPoint, bool bWithBorder = false);
+
+ /** Get the range of a polyPolygon
+
+ For detailed description look at getRange(const B2DPolygon&).
+ This method just expands by the range of every sub-Polygon.
+
+ @param rCandidate
+ The B2DPolyPolygon possibly containing bezier segments
+
+ @return
+ The outer range of the polygon
+ */
+ BASEGFX_DLLPUBLIC B2DRange getRange(const B2DPolyPolygon& rCandidate);
+
+ // get signed area of polygon
+ BASEGFX_DLLPUBLIC double getSignedArea(const B2DPolyPolygon& rCandidate);
+
+ // get area of polygon
+ BASEGFX_DLLPUBLIC double getArea(const B2DPolyPolygon& rCandidate);
+
+ /** Apply given LineDashing to given polyPolygon
+
+ For a description see applyLineDashing in b2dpolygontoos.hxx
+ */
+ BASEGFX_DLLPUBLIC void applyLineDashing(
+ const B2DPolyPolygon& rCandidate,
+ const ::std::vector<double>& rDotDashArray,
+ B2DPolyPolygon* pLineTarget,
+ double fFullDashDotLen = 0.0);
+
+ // test if point is inside epsilon-range around the given PolyPolygon. Can be used
+ // for HitTesting. The epsilon-range is defined to be the tube around the PolyPolygon
+ // with distance fDistance and rounded edges (start and end point).
+ BASEGFX_DLLPUBLIC bool isInEpsilonRange(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance);
+
+ /** Helper class to transport PointIndices to a PolyPolygon,
+ with an operator< for convenient sorting in a std::set usage
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC PointIndex
+ {
+ private:
+ sal_uInt32 mnPolygonIndex;
+ sal_uInt32 mnPointIndex;
+
+ public:
+ PointIndex(sal_uInt32 nPolygonIndex, sal_uInt32 nPointIndex)
+ : mnPolygonIndex(nPolygonIndex),
+ mnPointIndex(nPointIndex)
+ {}
+
+ sal_uInt32 getPolygonIndex() const { return mnPolygonIndex; }
+ sal_uInt32 getPointIndex() const { return mnPointIndex; }
+ bool operator<(const PointIndex& rComp) const;
+ };
+
+ /** the PointIndexSet itself; it allows to define a 'selection'of
+ points in a tools::PolyPolygon by giving the polygon and point index.
+ Adding points double makes no sense, hence the std::set
+ */
+ typedef o3tl::sorted_vector< PointIndex > PointIndexSet;
+
+ /** Read poly-polygon from SVG.
+
+ This function imports a poly-polygon from an SVG-D
+ attribute.
+
+ @param o_rPolyPoly
+ The output poly-polygon
+
+ @param rSvgDAttribute
+ A valid SVG-D attribute string
+
+ @param bHandleRelativeNextPointCompatible
+ If set to true, the old error that after a relative 'z' command
+ the current point was not reset to the first point of the current
+ polygon is kept; this is needed to read odf files.
+ If false, pure svg is used; this is needed for svg import.
+
+ @param pHelpPointIndexSet
+ If given, all points created in the target PolyPolygon
+ which are only helper points are added here using their
+ point indices; this are currently points created from
+ import of the 'a' and 'A' svg:d statements which create
+ bezier curve info as representation and maybe points
+ which are no 'real' svg:d points, but helper points. It
+ is necessary to identify these e.g. when markers need to
+ be created in the svg import
+
+ @return true, if the string was successfully parsed
+ */
+ BASEGFX_DLLPUBLIC bool importFromSvgD(
+ B2DPolyPolygon& o_rPolyPoly,
+ std::u16string_view rSvgDAttribute,
+ bool bHandleRelativeNextPointCompatible,
+ PointIndexSet* pHelpPointIndexSet);
+
+ // grow for polyPolygon. Move all geometry in each point in the direction of the normal in that point
+ // with the given amount. Value may be negative.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon growInNormalDirection(const B2DPolyPolygon& rCandidate, double fValue);
+
+ // force all sub-polygons to a point count of nSegments
+ BASEGFX_DLLPUBLIC B2DPolyPolygon reSegmentPolyPolygon(const B2DPolyPolygon& rCandidate, sal_uInt32 nSegments);
+
+ // create polygon state at t from 0.0 to 1.0 between the two polygons. Both polygons must have the same
+ // organisation, e.g. same amount of polygons
+ BASEGFX_DLLPUBLIC B2DPolyPolygon interpolate(const B2DPolyPolygon& rOld1, const B2DPolyPolygon& rOld2, double t);
+
+ // create 3d tools::PolyPolygon from given 2d PolyPolygon. The given fZCoordinate is used to expand the
+ // third coordinate.
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createB3DPolyPolygonFromB2DPolyPolygon(const B2DPolyPolygon& rCandidate, double fZCoordinate = 0.0);
+
+ // create 2d tools::PolyPolygon from given 3d PolyPolygon. All coordinates are transformed using the given
+ // matrix and the resulting x,y is used to form the new polygon.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createB2DPolyPolygonFromB3DPolyPolygon(const B3DPolyPolygon& rCandidate, const B3DHomMatrix& rMat);
+
+ // for each contained edge in each contained polygon calculate the smallest distance. Return the index to the smallest
+ // edge in rEdgeIndex and the index to the polygon in rPolygonIndex. The relative position on the edge is returned in rCut.
+ // If nothing was found (e.g. empty input plygon), DBL_MAX is returned.
+ BASEGFX_DLLPUBLIC double getSmallestDistancePointToPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPoint, sal_uInt32& rPolygonIndex, sal_uInt32& rEdgeIndex, double& rCut);
+
+ // distort PolyPolygon. rOriginal describes the original range, where the given points describe the distorted
+ // corresponding points.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon distort(const B2DPolyPolygon& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight);
+
+ // expand all segments (which are not yet) to curve segments. This is done with setting the control
+ // vectors on the 1/3 resp. 2/3 distances on each segment.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon expandToCurve(const B2DPolyPolygon& rCandidate);
+
+ /** Predicate whether a given poly-polygon is a rectangle.
+
+ @param rPoly
+ tools::PolyPolygon to check
+
+ @return true, if the poly-polygon describes a rectangle
+ (contains exactly one polygon, polygon is closed, and the
+ points are either cw or ccw enumerations of a rectangle's
+ vertices). Note that intermediate points and duplicate
+ points are ignored.
+ */
+ BASEGFX_DLLPUBLIC bool isRectangle( const B2DPolyPolygon& rPoly );
+
+ /** Export poly-polygon to SVG.
+
+ This function exports a poly-polygon into an SVG-D
+ statement. Currently, output of relative point sequences
+ is not yet supported (might cause slightly larger output)
+
+ @param rPolyPoly
+ The poly-polygon to export
+
+ @param bUseRelativeCoordinates
+ When true, all coordinate values are exported as relative
+ to the current position. This tends to save some space,
+ since fewer digits needs to be written.
+
+ @param bDetectQuadraticBeziers
+ When true, the export tries to detect cubic bezier
+ segments in the input polygon, which can be represented by
+ quadratic bezier segments. Note that the generated string
+ causes versions prior to OOo2.0 to crash.
+
+ @param bHandleRelativeNextPointCompatible
+ If set to true, the old error that after a relative 'z' command
+ the current point was not reset to the first point of the current
+ polygon is kept; this is needed to read odf files.
+ If false, pure svg is used; this is needed for svg import.
+
+ @param bOOXMLMotionPath
+ If set to true, export string format that is acceptable for
+ for animation motion path for PowerPoint: always space delimited,
+ never neglect command char, always end with E, and do not export
+ H or V.
+
+ @return the generated SVG-D statement (the XML d attribute
+ value alone, without any "<path ...>" or "d="...")
+ */
+ BASEGFX_DLLPUBLIC OUString exportToSvgD(
+ const B2DPolyPolygon& rPolyPoly,
+ bool bUseRelativeCoordinates,
+ bool bDetectQuadraticBeziers,
+ bool bHandleRelativeNextPointCompatible,
+ bool bOOXMLMotionPath = false);
+
+ // #i76891# Try to remove existing curve segments if they are simply edges
+ BASEGFX_DLLPUBLIC B2DPolyPolygon simplifyCurveSegments(const B2DPolyPolygon& rCandidate);
+
+ /** Creates polypolygon for seven-segment display number
+
+ This function takes an integer number between 0 and 9 and
+ convert it into the well-known seven-segment display
+ number (like most digital clocks show their numbers). The
+ digit will exactly fit the unit rectangle. The polypolygon
+ will be a line polygon, i.e. if you need the segment parts
+ to have width, use createAreaGeometry() on the result.
+
+ @param cNumber
+ Number from '0' to '9' as ASCII char, or '-', 'E' and '.'
+ to convert to 7 segment code
+
+ @param bLitSegments
+ When true, return a polygon containing the segments that
+ are 'lit' for the given number. Return un-lit segments
+ otherwise.
+ */
+ B2DPolyPolygon createSevenSegmentPolyPolygon(char cNumber, bool bLitSegments);
+
+ /** snap some polygon coordinates to discrete coordinates
+
+ This method allows to snap some polygon points to discrete (integer) values
+ which equals e.g. a snap to discrete coordinates. It will snap points of
+ horizontal and vertical edges
+
+ @param rCandidate
+ The source polygon
+
+ @return
+ The modified version of the source polygon
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolyPolygon& rCandidate);
+
+ /// converters for css::drawing::PointSequence
+ BASEGFX_DLLPUBLIC B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon(
+ const css::drawing::PointSequenceSequence& rPointSequenceSequenceSource);
+ BASEGFX_DLLPUBLIC void B2DPolyPolygonToUnoPointSequenceSequence(
+ const B2DPolyPolygon& rPolyPolygon,
+ css::drawing::PointSequenceSequence& rPointSequenceSequenceRetval);
+
+ /// converters for css::drawing::PolyPolygonBezierCoords (curved polygons)
+ BASEGFX_DLLPUBLIC B2DPolyPolygon UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
+ const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource);
+ BASEGFX_DLLPUBLIC void B2DPolyPolygonToUnoPolyPolygonBezierCoords(
+ const B2DPolyPolygon& rPolyPolygon,
+ css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsRetval);
+
+} // end of namespace basegfx::utils
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dtrapezoid.hxx b/include/basegfx/polygon/b2dtrapezoid.hxx
new file mode 100644
index 000000000..aeed7148e
--- /dev/null
+++ b/include/basegfx/polygon/b2dtrapezoid.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx { class B2DPolyPolygon; }
+namespace basegfx { class B2DPoint; }
+
+namespace basegfx
+{
+ // class to hold a single trapezoid
+ class UNLESS_MERGELIBS(BASEGFX_DLLPUBLIC) B2DTrapezoid
+ {
+ private:
+ // Geometry data. YValues are down-oriented, this means bottom should
+ // be bigger than top to be below it. The constructor implementation
+ // guarantees:
+
+ // - mfBottomY >= mfTopY
+ // - mfTopXRight >= mfTopXLeft
+ // - mfBottomXRight >= mfBottomXLeft
+ double mfTopXLeft;
+ double mfTopXRight;
+ double mfTopY;
+ double mfBottomXLeft;
+ double mfBottomXRight;
+ double mfBottomY;
+
+ public:
+ // constructor
+ B2DTrapezoid(
+ const double& rfTopXLeft,
+ const double& rfTopXRight,
+ const double& rfTopY,
+ const double& rfBottomXLeft,
+ const double& rfBottomXRight,
+ const double& rfBottomY);
+
+ // data read access
+ const double& getTopXLeft() const { return mfTopXLeft; }
+ const double& getTopXRight() const { return mfTopXRight; }
+ const double& getTopY() const { return mfTopY; }
+ const double& getBottomXLeft() const { return mfBottomXLeft; }
+ const double& getBottomXRight() const { return mfBottomXRight; }
+ const double& getBottomY() const { return mfBottomY; }
+
+ // convenience method to get content as Polygon
+ B2DPolygon getB2DPolygon() const;
+ };
+
+ typedef ::std::vector< B2DTrapezoid > B2DTrapezoidVector;
+
+} // end of namespace basegfx
+
+
+namespace basegfx::utils
+{
+ // convert SourcePolyPolygon to trapezoids. The trapezoids will be appended to
+ // ro_Result. ro_Result will not be cleared. If SourcePolyPolygon contains curves,
+ // it's default AdaptiveSubdivision will be used.
+ // CAUTION: Trapezoids are orientation-dependent in the sense that the upper and lower
+ // lines have to be parallel to the X-Axis, thus this subdivision is NOT simply usable
+ // for primitive decompositions. To use it, the shear and rotate parts of the
+ // involved transformations HAVE to be taken into account.
+ BASEGFX_DLLPUBLIC void trapezoidSubdivide(
+ B2DTrapezoidVector& ro_Result,
+ const B2DPolyPolygon& rSourcePolyPolygon);
+
+ // directly create trapezoids from given edge. Depending on the given geometry,
+ // none up to three trapezoids will be created
+ void createLineTrapezoidFromEdge(
+ B2DTrapezoidVector& ro_Result,
+ const B2DPoint& rPointA,
+ const B2DPoint& rPointB,
+ double fLineWidth);
+
+ // create trapezoids for all edges of the given polygon. The closed state of
+ // the polygon is taken into account. If curves are contained, the default
+ // AdaptiveSubdivision will be used.
+ void createLineTrapezoidFromB2DPolygon(
+ B2DTrapezoidVector& ro_Result,
+ const B2DPolygon& rPolygon,
+ double fLineWidth);
+} // end of namespace basegfx::utils
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolygon.hxx b/include/basegfx/polygon/b3dpolygon.hxx
new file mode 100644
index 000000000..ea9ea2fde
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolygon.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+class ImplB3DPolygon;
+
+namespace basegfx
+{
+ class B3DPoint;
+ class B3DHomMatrix;
+ class B3DVector;
+ class B2DPoint;
+ class B2DHomMatrix;
+ class BColor;
+}
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B3DPolygon
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB3DPolygon, o3tl::ThreadSafeRefCountingPolicy > ImplType;
+
+ private:
+ // internal data.
+ ImplType mpPolygon;
+
+ public:
+ B3DPolygon();
+ B3DPolygon(const B3DPolygon& rPolygon);
+ B3DPolygon(B3DPolygon&& rPolygon);
+ ~B3DPolygon();
+
+ // assignment operator
+ B3DPolygon& operator=(const B3DPolygon& rPolygon);
+ B3DPolygon& operator=(B3DPolygon&& rPolygon);
+
+ // compare operators
+ bool operator==(const B3DPolygon& rPolygon) const;
+ bool operator!=(const B3DPolygon& rPolygon) const;
+
+ // member count
+ sal_uInt32 count() const;
+
+ // Coordinate interface
+ B3DPoint const & getB3DPoint(sal_uInt32 nIndex) const;
+ void setB3DPoint(sal_uInt32 nIndex, const B3DPoint& rValue);
+
+ // Coordinate append
+ void append(const B3DPoint& rPoint, sal_uInt32 nCount = 1);
+
+ // BColor interface
+ BColor const & getBColor(sal_uInt32 nIndex) const;
+ void setBColor(sal_uInt32 nIndex, const BColor& rValue);
+ bool areBColorsUsed() const;
+ void clearBColors();
+
+ // Normals interface
+ B3DVector const & getNormal() const; // plane normal
+ B3DVector const & getNormal(sal_uInt32 nIndex) const; // normal in each point
+ void setNormal(sal_uInt32 nIndex, const B3DVector& rValue);
+ void transformNormals(const B3DHomMatrix& rMatrix);
+ bool areNormalsUsed() const;
+ void clearNormals();
+
+ // TextureCoordinate interface
+ B2DPoint const & getTextureCoordinate(sal_uInt32 nIndex) const;
+ void setTextureCoordinate(sal_uInt32 nIndex, const B2DPoint& rValue);
+ void transformTextureCoordinates(const B2DHomMatrix& rMatrix);
+ bool areTextureCoordinatesUsed() const;
+ void clearTextureCoordinates();
+
+ // append other 2D polygons
+ void append(const B3DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
+
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ // clear all points
+ void clear();
+
+ // closed state
+ bool isClosed() const;
+ void setClosed(bool bNew);
+
+ // flip polygon direction
+ void flip();
+
+ // test if Polygon has double points
+ bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ // apply transformation given in matrix form to the polygon
+ void transform(const B3DHomMatrix& rMatrix);
+ };
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolygontools.hxx b/include/basegfx/polygon/b3dpolygontools.hxx
new file mode 100644
index 000000000..2bdddbc33
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolygontools.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vector>
+#include <functional>
+
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B3DPolyPolygon;
+ class B3DPolygon;
+ class B3DRange;
+}
+
+namespace basegfx::utils
+{
+ // B3DPolygon tools
+
+ /** Check if given polygon is closed. This is kind of a
+ 'classic' method to support old polygon definitions.
+ Those old polygon definitions define the closed state
+ of the polygon using identical start and endpoints. This
+ method corrects this (removes double start/end points)
+ and sets the Closed()-state of the polygon correctly.
+ */
+ BASEGFX_DLLPUBLIC void checkClosed(B3DPolygon& rCandidate);
+
+ // Get successor and predecessor indices. Returning the same index means there
+ // is none. Same for successor.
+ BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B3DPolygon& rCandidate);
+
+ // get size of polygon. Control vectors are included in that ranges.
+ BASEGFX_DLLPUBLIC B3DRange getRange(const B3DPolygon& rCandidate);
+
+ // get length of polygon
+ BASEGFX_DLLPUBLIC double getLength(const B3DPolygon& rCandidate);
+
+ /** Apply given LineDashing to given polygon
+
+ For a description see applyLineDashing in b2dpolygontoos.hxx
+ Also 2nd version with callbacks, see comments in 2D version
+ */
+ void applyLineDashing(
+ const B3DPolygon& rCandidate,
+ const std::vector<double>& rDotDashArray,
+ std::function<void(const basegfx::B3DPolygon& rSnippet)> aLineTargetCallback,
+ double fDotDashLength = 0.0);
+ BASEGFX_DLLPUBLIC void applyLineDashing(
+ const B3DPolygon& rCandidate,
+ const ::std::vector<double>& rDotDashArray,
+ B3DPolyPolygon* pLineTarget,
+ double fDotDashLength = 0.0);
+
+ /** Create/replace normals for given 3d geometry with default normals from given center to outside.
+ rCandidate: the 3d geometry to change
+ rCenter: the center of the 3d geometry
+ */
+ B3DPolygon applyDefaultNormalsSphere( const B3DPolygon& rCandidate, const B3DPoint& rCenter);
+
+ /** invert normals for given 3d geometry.
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon invertNormals( const B3DPolygon& rCandidate);
+
+ /** Create/replace texture coordinates for given 3d geometry with parallel projected one
+ rRange: the full range of the 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ B3DPolygon applyDefaultTextureCoordinatesParallel( const B3DPolygon& rCandidate, const B3DRange& rRange, bool bChangeX, bool bChangeY);
+
+ /** Create/replace texture coordinates for given 3d geometry with spherical one
+ rCenter: the centre of the used 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ B3DPolygon applyDefaultTextureCoordinatesSphere( const B3DPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX, bool bChangeY);
+
+ // isInside tests for B3DPoint. On border is not inside as long as not true is given in bWithBorder flag.
+ BASEGFX_DLLPUBLIC bool isInside(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder);
+
+ // calculates if given point is on given line, taking care of the numerical epsilon
+ BASEGFX_DLLPUBLIC bool isPointOnLine(const B3DPoint& rStart, const B3DPoint& rEnd, const B3DPoint& rCandidate, bool bWithPoints);
+
+ // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses
+ // isPointOnLine internally
+ BASEGFX_DLLPUBLIC bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint);
+
+ // helper to get a fCut position between a plane (given with normal and a point)
+ // and a line given by start and end point
+ BASEGFX_DLLPUBLIC bool getCutBetweenLineAndPlane(const B3DVector& rPlaneNormal, const B3DPoint& rPlanePoint, const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, double& fCut);
+
+ /** snap some polygon coordinates to discrete coordinates
+
+ This method allows to snap some polygon points to discrete (integer) values
+ which equals e.g. a snap to discrete coordinates. It will snap points of
+ horizontal and vertical edges
+
+ @param rCandidate
+ The source polygon
+
+ @return
+ The modified version of the source polygon
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon snapPointsOfHorizontalOrVerticalEdges(const B3DPolygon& rCandidate);
+
+} // end of namespace basegfx::utils
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolypolygon.hxx b/include/basegfx/polygon/b3dpolypolygon.hxx
new file mode 100644
index 000000000..14a062c08
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolypolygon.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+class ImplB3DPolyPolygon;
+
+namespace basegfx
+{
+ class B3DPolygon;
+ class B3DHomMatrix;
+ class B2DHomMatrix;
+}
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B3DPolyPolygon
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB3DPolyPolygon, o3tl::ThreadSafeRefCountingPolicy > ImplType;
+
+ private:
+ ImplType mpPolyPolygon;
+
+ public:
+ B3DPolyPolygon();
+ B3DPolyPolygon(const B3DPolyPolygon& rPolyPolygon);
+ B3DPolyPolygon(B3DPolyPolygon&& rPolygon);
+ explicit B3DPolyPolygon(const B3DPolygon& rPolygon);
+ ~B3DPolyPolygon();
+
+ // assignment operator
+ B3DPolyPolygon& operator=(const B3DPolyPolygon& rPolyPolygon);
+ B3DPolyPolygon& operator=(B3DPolyPolygon&& rPolyPolygon);
+
+ // compare operators
+ bool operator==(const B3DPolyPolygon& rPolyPolygon) const;
+ bool operator!=(const B3DPolyPolygon& rPolyPolygon) const;
+
+ // polygon interface
+ sal_uInt32 count() const;
+
+ // B3DPolygon interface
+ B3DPolygon const & getB3DPolygon(sal_uInt32 nIndex) const;
+ void setB3DPolygon(sal_uInt32 nIndex, const B3DPolygon& rPolygon);
+
+ // BColor interface
+ bool areBColorsUsed() const;
+ void clearBColors();
+
+ // Normals interface
+ void transformNormals(const B3DHomMatrix& rMatrix);
+ bool areNormalsUsed() const;
+ void clearNormals();
+
+ // TextureCoordinate interface
+ void transformTextureCoordinates(const B2DHomMatrix& rMatrix);
+ bool areTextureCoordinatesUsed() const;
+ void clearTextureCoordinates();
+
+ // append single polygon
+ void append(const B3DPolygon& rPolygon, sal_uInt32 nCount = 1);
+
+ // append multiple polygons
+ void append(const B3DPolyPolygon& rPolyPolygon);
+
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ // reset to empty state
+ void clear();
+
+ // flip polygon direction
+ void flip();
+
+ // test if tools::PolyPolygon has double points
+ bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ // apply transformation given in matrix form to the polygon
+ void transform(const basegfx::B3DHomMatrix& rMatrix);
+
+ // polygon iterators (same iterator validity conditions as for vector)
+ const B3DPolygon* begin() const;
+ const B3DPolygon* end() const;
+ B3DPolygon* begin();
+ B3DPolygon* end();
+ };
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolypolygontools.hxx b/include/basegfx/polygon/b3dpolypolygontools.hxx
new file mode 100644
index 000000000..d201696dc
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolypolygontools.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace com::sun::star::drawing { struct PolyPolygonShape3D; }
+
+namespace basegfx
+{
+ class B3DPolyPolygon;
+ class B3DRange;
+}
+
+namespace basegfx::utils
+{
+ // B3DPolyPolygon tools
+
+ // get size of PolyPolygon. Control vectors are included in that ranges.
+ BASEGFX_DLLPUBLIC B3DRange getRange(const B3DPolyPolygon& rCandidate);
+
+ /** Create a unit 3D line polyPolygon which defines a cube.
+ */
+ B3DPolyPolygon const & createUnitCubePolyPolygon();
+
+ /** Create a unit 3D fill polyPolygon which defines a cube.
+ */
+ B3DPolyPolygon const & createUnitCubeFillPolyPolygon();
+
+ /** Create a 3D line polyPolygon from a B3DRange which defines a cube.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createCubePolyPolygonFromB3DRange( const B3DRange& rRange);
+
+ /** Create a 3D fill polyPolygon from a B3DRange which defines a cube.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createCubeFillPolyPolygonFromB3DRange( const B3DRange& rRange);
+
+ /** Create a unit 3D line polyPolygon which defines a sphere with the given count of hor and ver segments.
+ Result will be centered at (0.0, 0.0, 0.0) and sized [-1.0 .. 1.0] in all dimensions.
+ If nHorSeg == 0 and/or nVerSeg == 0, a default will be calculated to have a step at least each 15 degrees.
+ With VerStart, VerStop and hor range in cartesian may be specified to create a partial sphere only.
+ */
+ B3DPolyPolygon createUnitSpherePolyPolygon(
+ sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
+ double fVerStart = M_PI_2, double fVerStop = -M_PI_2,
+ double fHorStart = 0.0, double fHorStop = 2 * M_PI);
+
+ /** Create a 3D line polyPolygon from a B3DRange which defines a sphere with the given count of hor and ver segments.
+ If nHorSeg == 0 and/or nVerSeg == 0, a default will be calculated to have a step at least each 15 degrees.
+ With VerStart, VerStop and hor range in cartesian may be specified to create a partial sphere only.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createSpherePolyPolygonFromB3DRange(
+ const B3DRange& rRange,
+ sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
+ double fVerStart = M_PI_2, double fVerStop = -M_PI_2,
+ double fHorStart = 0.0, double fHorStop = 2 * M_PI);
+
+ /** same as createUnitSpherePolyPolygon, but creates filled polygons (closed and oriented)
+ There is one extra, the bool bNormals defines if normals will be set, default is false
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitSphereFillPolyPolygon(
+ sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
+ bool bNormals = false,
+ double fVerStart = M_PI_2, double fVerStop = -M_PI_2,
+ double fHorStart = 0.0, double fHorStop = 2 * M_PI);
+
+ /** same as createSpherePolyPolygonFromB3DRange, but creates filled polygons (closed and oriented)
+ There is one extra, the bool bNormals defines if normals will be set, default is false
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createSphereFillPolyPolygonFromB3DRange(
+ const B3DRange& rRange,
+ sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
+ bool bNormals = false,
+ double fVerStart = M_PI_2, double fVerStop = -M_PI_2,
+ double fHorStart = 0.0, double fHorStop = 2 * M_PI);
+
+ /** Create/replace normals for given 3d geometry with default normals from given center to outside.
+ rCandidate: the 3d geometry to change
+ rCenter: the center of the 3d geometry
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon applyDefaultNormalsSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter);
+
+ /** invert normals for given 3d geometry.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon invertNormals( const B3DPolyPolygon& rCandidate);
+
+ /** Create/replace texture coordinates for given 3d geometry with parallel projected one
+ rRange: the full range of the 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon applyDefaultTextureCoordinatesParallel( const B3DPolyPolygon& rCandidate, const B3DRange& rRange, bool bChangeX = true, bool bChangeY = true);
+
+ /** Create/replace texture coordinates for given 3d geometry with spherical one
+ rCenter: the centre of the used 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon applyDefaultTextureCoordinatesSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX = true, bool bChangeY = true);
+
+ // isInside test for B3DPoint. On border is not inside.
+ // It is assumed that the orientations of the given polygon are correct.
+ BASEGFX_DLLPUBLIC bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint);
+
+ /// converters for css::drawing::PolyPolygonShape3D
+ BASEGFX_DLLPUBLIC B3DPolyPolygon UnoPolyPolygonShape3DToB3DPolyPolygon(
+ const css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DSource);
+ BASEGFX_DLLPUBLIC void B3DPolyPolygonToUnoPolyPolygonShape3D(
+ const B3DPolyPolygon& rPolyPolygonSource,
+ css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DRetval);
+
+} // end of namespace basegfx::utils
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/Range2D.hxx b/include/basegfx/range/Range2D.hxx
new file mode 100644
index 000000000..664887529
--- /dev/null
+++ b/include/basegfx/range/Range2D.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/tuple/Tuple2D.hxx>
+
+namespace basegfx
+{
+template <typename TYPE, typename TRAITS> class Range2D
+{
+protected:
+ basegfx::BasicRange<TYPE, TRAITS> maRangeX;
+ basegfx::BasicRange<TYPE, TRAITS> maRangeY;
+
+public:
+ typedef TYPE ValueType;
+ typedef TRAITS TraitsType;
+
+ Range2D() = default;
+
+ /// Create degenerate interval consisting of a single point
+ explicit Range2D(const Tuple2D<TYPE>& rTuple)
+ : maRangeX(rTuple.getX())
+ , maRangeY(rTuple.getY())
+ {
+ }
+
+ /// Create proper interval between the two given points
+ Range2D(const Tuple2D<TYPE>& rTuple1, const Tuple2D<TYPE>& rTuple2)
+ : maRangeX(rTuple1.getX())
+ , maRangeY(rTuple1.getY())
+ {
+ expand(rTuple2);
+ }
+
+ /// Create proper interval between the two given pairs
+ Range2D(TYPE x1, TYPE y1, TYPE x2, TYPE y2)
+ : maRangeX(x1)
+ , maRangeY(y1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single point included will already return true.
+ */
+ bool isEmpty() const { return maRangeX.isEmpty() || maRangeY.isEmpty(); }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ }
+
+ bool operator==(const Range2D& rRange) const
+ {
+ return maRangeX == rRange.maRangeX && maRangeY == rRange.maRangeY;
+ }
+
+ bool operator!=(const Range2D& rRange) const
+ {
+ return maRangeX != rRange.maRangeX || maRangeY != rRange.maRangeY;
+ }
+
+ bool equal(const Range2D& rRange) const
+ {
+ return maRangeX.equal(rRange.maRangeX) && maRangeY.equal(rRange.maRangeY);
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ TYPE getMinX() const { return maRangeX.getMinimum(); }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ TYPE getMinY() const { return maRangeY.getMinimum(); }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ TYPE getMaxX() const { return maRangeX.getMaximum(); }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ TYPE getMaxY() const { return maRangeY.getMaximum(); }
+
+ /// return difference between upper and lower X value. returns 0 for empty sets.
+ TYPE getWidth() const { return maRangeX.getRange(); }
+
+ /// return difference between upper and lower Y value. returns 0 for empty sets.
+ TYPE getHeight() const { return maRangeY.getRange(); }
+
+ /// return center X value of set. returns 0 for empty sets.
+ double getCenterX() const { return maRangeX.getCenter(); }
+
+ /// return center Y value of set. returns 0 for empty sets.
+ double getCenterY() const { return maRangeY.getCenter(); }
+
+ /// yields true if given point is contained in set
+ bool isInside(const Tuple2D<TYPE>& rTuple) const
+ {
+ return maRangeX.isInside(rTuple.getX()) && maRangeY.isInside(rTuple.getY());
+ }
+
+ /// yields true if rRange is inside, or equal to set
+ bool isInside(const Range2D& rRange) const
+ {
+ return maRangeX.isInside(rRange.maRangeX) && maRangeY.isInside(rRange.maRangeY);
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const Range2D& rRange) const
+ {
+ return maRangeX.overlaps(rRange.maRangeX) && maRangeY.overlaps(rRange.maRangeY);
+ }
+
+ /// yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal
+ bool overlapsMore(const Range2D& rRange) const
+ {
+ return maRangeX.overlapsMore(rRange.maRangeX) && maRangeY.overlapsMore(rRange.maRangeY);
+ }
+
+ /// add point to the set, expanding as necessary
+ void expand(const Tuple2D<TYPE>& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ }
+
+ /// add rRange to the set, expanding as necessary
+ void expand(const Range2D& rRange)
+ {
+ maRangeX.expand(rRange.maRangeX);
+ maRangeY.expand(rRange.maRangeY);
+ }
+
+ /// calc set intersection
+ void intersect(const Range2D& rRange)
+ {
+ maRangeX.intersect(rRange.maRangeX);
+ maRangeY.intersect(rRange.maRangeY);
+ }
+
+ /// grow set by fValue on all sides
+ void grow(TYPE fValue)
+ {
+ maRangeX.grow(fValue);
+ maRangeY.grow(fValue);
+ }
+
+ /// clamp value on range
+ Tuple2D<TYPE> clamp(const Tuple2D<TYPE>& rTuple) const
+ {
+ return Tuple2D<TYPE>(maRangeX.clamp(rTuple.getX()), maRangeY.clamp(rTuple.getY()));
+ }
+};
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b1drange.hxx b/include/basegfx/range/b1drange.hxx
new file mode 100644
index 000000000..0db585558
--- /dev/null
+++ b/include/basegfx/range/b1drange.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/range/basicrange.hxx>
+
+
+namespace basegfx
+{
+
+ /** A one-dimensional interval over doubles
+
+ This is a set of real numbers, bounded by a lower and an upper
+ value. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ The set is closed, i.e. the upper and the lower bound are
+ included (if you're used to the notation - we're talking about
+ [a,b] here, compared to half-open [a,b) or open intervals
+ (a,b)).
+
+ That means, isInside(val) will return true also for values of
+ val=a or val=b.
+ */
+ class B1DRange
+ {
+ ::basegfx::BasicRange< double, DoubleTraits > maRange;
+
+ public:
+ B1DRange() {}
+
+ /// Create degenerate interval consisting of a single double number
+ explicit B1DRange(double fStartValue)
+ : maRange(fStartValue)
+ {
+ }
+
+ /// Create proper interval between the two given double values
+ B1DRange(double fStartValue1, double fStartValue2)
+ : maRange(fStartValue1)
+ {
+ expand(fStartValue2);
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single value included will already return true.
+ */
+ bool isEmpty() const
+ {
+ return maRange.isEmpty();
+ }
+
+ bool operator==( const B1DRange& rRange ) const
+ {
+ return (maRange == rRange.maRange);
+ }
+
+ bool operator!=( const B1DRange& rRange ) const
+ {
+ return (maRange != rRange.maRange);
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ double getMinimum() const
+ {
+ return maRange.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ double getMaximum() const
+ {
+ return maRange.getMaximum();
+ }
+
+ /// return difference between upper and lower value. returns 0 for empty sets.
+ double getRange() const
+ {
+ return maRange.getRange();
+ }
+
+ /// return middle of upper and lower value. returns 0 for empty sets.
+ double getCenter() const
+ {
+ return maRange.getCenter();
+ }
+
+ /// yields true if value is contained in set
+ bool isInside(double fValue) const
+ {
+ return maRange.isInside(fValue);
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const B1DRange& rRange) const
+ {
+ return maRange.overlaps(rRange.maRange);
+ }
+
+ /// yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal
+ bool overlapsMore(const B1DRange& rRange) const
+ {
+ return maRange.overlapsMore(rRange.maRange);
+ }
+
+ /// add fValue to the set, expanding as necessary
+ void expand(double fValue)
+ {
+ maRange.expand(fValue);
+ }
+
+ /// add rRange to the set, expanding as necessary
+ void expand(const B1DRange& rRange)
+ {
+ maRange.expand(rRange.maRange);
+ }
+
+ /// calc set intersection
+ void intersect(const B1DRange& rRange)
+ {
+ maRange.intersect(rRange.maRange);
+ }
+
+ /// clamp value on range
+ double clamp(double fValue) const
+ {
+ return maRange.clamp(fValue);
+ }
+ };
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2dconnectedranges.hxx b/include/basegfx/range/b2dconnectedranges.hxx
new file mode 100644
index 000000000..0dc7a4c24
--- /dev/null
+++ b/include/basegfx/range/b2dconnectedranges.hxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <osl/diagnose.h>
+#include <basegfx/range/b2drange.hxx>
+#include <list>
+#include <utility>
+#include <algorithm>
+
+
+namespace basegfx
+{
+ /** Calculate connected ranges from input ranges.
+
+ This template constructs a list of connected ranges from the
+ given input ranges. That is, the output will contain a set of
+ ranges, itself containing a number of input ranges, which will
+ be mutually non-intersecting.
+
+ Example:
+ <code>
+ -------------------
+ | -------|
+ | | ||
+ | --- | ||
+ | | | -------| --------
+ | | +--------- | | |
+ | --+ | | | |
+ | | | | --------
+ | ---------- |
+ -------------------
+ </code
+
+ Here, the outer rectangles represent the output
+ ranges. Contained are the input rectangles that comprise these
+ output ranges.
+
+ @tpl UserData
+ User data to be stored along with the range, to later identify
+ which range went into which connected component. Must be
+ assignable, default- and copy-constructible.
+ */
+ template< typename UserData > class B2DConnectedRanges
+ {
+ public:
+ /// Type of the basic entity (rect + user data)
+ typedef ::std::pair< B2DRange, UserData > ComponentType;
+ typedef ::std::list< ComponentType > ComponentListType;
+
+ /// List of (intersecting) components, plus overall bounds
+ struct ConnectedComponents
+ {
+ ComponentListType maComponentList;
+ B2DRange maTotalBounds;
+ };
+
+ typedef ::std::list< ConnectedComponents > ConnectedComponentsType;
+
+
+ /// Create the range calculator
+ B2DConnectedRanges() :
+ maDisjunctAggregatesList()
+ {
+ }
+
+ /** Add an additional range.
+
+ This method integrates a new range into the connected
+ ranges lists. The method has a worst-case time complexity
+ of O(n^2), with n denoting the number of already added
+ ranges (typically, for well-behaved input, it is O(n)
+ though).
+ */
+ void addRange( const B2DRange& rRange,
+ const UserData& rUserData )
+ {
+ // check whether fast path is possible: if new range is
+ // outside accumulated total range, can add it as a
+ // separate component right away.
+ const bool bNotOutsideEverything(
+ maTotalBounds.overlaps( rRange ) );
+
+ // update own global bounds range
+ maTotalBounds.expand( rRange );
+
+ // assemble anything intersecting with rRange into
+ // this new connected component
+ ConnectedComponents aNewConnectedComponent;
+
+ // as at least rRange will be a member of
+ // aNewConnectedComponent (will be added below), can
+ // preset the overall bounds here.
+ aNewConnectedComponent.maTotalBounds = rRange;
+
+
+ // STAGE 1: Search for intersecting maDisjunctAggregatesList entries
+
+
+ // if rRange is empty, it will intersect with no
+ // maDisjunctAggregatesList member. Thus, we can safe us
+ // the check.
+ // if rRange is outside all other rectangle, skip here,
+ // too
+ if( bNotOutsideEverything &&
+ !rRange.isEmpty() )
+ {
+ typename ConnectedComponentsType::iterator aCurrAggregate;
+ typename ConnectedComponentsType::iterator aLastAggregate;
+
+ // flag, determining whether we touched one or more of
+ // the maDisjunctAggregatesList entries. _If_ we did,
+ // we have to repeat the intersection process, because
+ // these changes might have generated new
+ // intersections.
+ bool bSomeAggregatesChanged;
+
+ // loop, until bSomeAggregatesChanged stays false
+ do
+ {
+ // only continue loop if 'intersects' branch below was hit
+ bSomeAggregatesChanged = false;
+
+ // iterate over all current members of maDisjunctAggregatesList
+ for( aCurrAggregate=maDisjunctAggregatesList.begin(),
+ aLastAggregate=maDisjunctAggregatesList.end();
+ aCurrAggregate != aLastAggregate; )
+ {
+ // first check if current component's bounds
+ // are empty. This ensures that distinct empty
+ // components are not merged into one
+ // aggregate. As a matter of fact, they have
+ // no position and size.
+
+ if( !aCurrAggregate->maTotalBounds.isEmpty() &&
+ aCurrAggregate->maTotalBounds.overlaps(
+ aNewConnectedComponent.maTotalBounds ) )
+ {
+ // union the intersecting
+ // maDisjunctAggregatesList element into
+ // aNewConnectedComponent
+
+ // calc union bounding box
+ aNewConnectedComponent.maTotalBounds.expand( aCurrAggregate->maTotalBounds );
+
+ // extract all aCurrAggregate components
+ // to aNewConnectedComponent
+ aNewConnectedComponent.maComponentList.splice(
+ aNewConnectedComponent.maComponentList.end(),
+ aCurrAggregate->maComponentList );
+
+ // remove and delete aCurrAggregate entry
+ // from list (we've gutted it's content
+ // above). list::erase() will update our
+ // iterator with the predecessor here.
+ aCurrAggregate = maDisjunctAggregatesList.erase( aCurrAggregate );
+
+ // at least one aggregate changed, need to rescan everything
+ bSomeAggregatesChanged = true;
+ }
+ else
+ {
+ ++aCurrAggregate;
+ }
+ }
+ }
+ while( bSomeAggregatesChanged );
+ }
+
+
+ // STAGE 2: Add newly generated connected component list element
+
+
+ // add new component to the end of the component list
+ aNewConnectedComponent.maComponentList.push_back(
+ ComponentType( rRange, rUserData ) );
+
+ // do some consistency checks (aka post conditions)
+ OSL_ENSURE( !aNewConnectedComponent.maComponentList.empty(),
+ "B2DConnectedRanges::addRange(): empty aggregate list" );
+ OSL_ENSURE( !aNewConnectedComponent.maTotalBounds.isEmpty() ||
+ aNewConnectedComponent.maComponentList.size() == 1,
+ "B2DConnectedRanges::addRange(): empty ranges must be solitary");
+
+ // add aNewConnectedComponent as a new entry to
+ // maDisjunctAggregatesList
+ maDisjunctAggregatesList.push_back( aNewConnectedComponent );
+ }
+
+ /** Apply a functor to each of the disjunct component
+ aggregates.
+
+ @param aFunctor
+ Functor to apply. Must provide an operator( const ConnectedComponents& ).
+
+ @return a copy of the functor, as applied to all aggregates.
+ */
+ template< typename UnaryFunctor > UnaryFunctor forEachAggregate( UnaryFunctor aFunctor ) const
+ {
+ return ::std::for_each( maDisjunctAggregatesList.begin(),
+ maDisjunctAggregatesList.end(),
+ aFunctor );
+ }
+
+ private:
+ B2DConnectedRanges(const B2DConnectedRanges&) = delete;
+ B2DConnectedRanges& operator=( const B2DConnectedRanges& ) = delete;
+
+ /** Current list of disjunct sets of connected components
+
+ Each entry corresponds to one of the top-level rectangles
+ in the drawing above.
+ */
+ ConnectedComponentsType maDisjunctAggregatesList;
+
+ /** Global bound rect over all added ranges.
+ */
+ B2DRange maTotalBounds;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2dpolyrange.hxx b/include/basegfx/range/b2dpolyrange.hxx
new file mode 100644
index 000000000..9a366956c
--- /dev/null
+++ b/include/basegfx/range/b2dpolyrange.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <o3tl/cow_wrapper.hxx>
+#include <tuple>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
+ class ImplB2DPolyRange;
+
+ /** Multiple ranges in one object.
+
+ This class combines multiple ranges in one object, providing a
+ total, enclosing range for it.
+
+ You can use this class e.g. when updating views containing
+ rectangular objects. Add each modified object to a
+ B2DMultiRange, then test each viewable object against
+ intersection with the multi range.
+
+ Similar in spirit to the poly-polygon vs. polygon relationship.
+
+ Note that comparable to polygons, a poly-range can also
+ contain 'holes' - this is encoded via polygon orientation at
+ the poly-polygon, and via explicit flags for the poly-range.
+ */
+ class BASEGFX_DLLPUBLIC B2DPolyRange
+ {
+ public:
+ typedef std::tuple<B2DRange, B2VectorOrientation> ElementType;
+
+ B2DPolyRange();
+ ~B2DPolyRange();
+
+ /** Create a multi range with exactly one containing range
+ */
+ B2DPolyRange( const B2DPolyRange& );
+ B2DPolyRange& operator=( const B2DPolyRange& );
+
+ bool operator==(const B2DPolyRange&) const;
+ bool operator!=(const B2DPolyRange&) const;
+
+ /// Number of included ranges
+ sal_uInt32 count() const;
+
+ ElementType getElement(sal_uInt32 nIndex) const;
+
+ // insert/append a single range
+ void appendElement(const B2DRange& rRange, B2VectorOrientation eOrient);
+
+ void clear();
+
+ /** Test whether given range overlaps one or more of the
+ included ranges. Does *not* use overall range, but checks
+ individually.
+ */
+ bool overlaps( const B2DRange& rRange ) const;
+
+ /** Request a poly-polygon with solved cross-overs
+ */
+ B2DPolyPolygon solveCrossovers() const;
+
+ void transform(const B2DHomMatrix& rTranslate);
+
+ private:
+ o3tl::cow_wrapper< ImplB2DPolyRange > mpImpl;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2drange.hxx b/include/basegfx/range/b2drange.hxx
new file mode 100644
index 000000000..3fce8df1a
--- /dev/null
+++ b/include/basegfx/range/b2drange.hxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <ostream>
+#include <vector>
+
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/range/Range2D.hxx>
+
+namespace basegfx
+{
+ class B2IRange;
+ class B2DHomMatrix;
+
+ /** A two-dimensional interval over doubles
+
+ This is a set of real numbers, bounded by a lower and an upper
+ pair. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ The set is closed, i.e. the upper and the lower bound are
+ included (if you're used to the notation - we're talking about
+ [a,b] here, compared to half-open [a,b) or open intervals
+ (a,b)).
+
+ That means, isInside(val) will return true also for values of
+ val=a or val=b.
+
+ @see B1DRange
+ */
+ class SAL_WARN_UNUSED B2DRange : public Range2D<double, DoubleTraits>
+ {
+ public:
+ B2DRange()
+ : Range2D()
+ {}
+
+ /// Create degenerate interval consisting of a single point
+ explicit B2DRange(const Tuple2D<ValueType>& rTuple)
+ : Range2D(rTuple)
+ {
+ }
+
+ /// Create proper interval between the two given points
+ B2DRange(const Tuple2D<ValueType>& rTuple1,
+ const Tuple2D<ValueType>& rTuple2)
+ : Range2D(rTuple1, rTuple2)
+ {
+ }
+
+ B2DRange(ValueType x1, ValueType y1, ValueType x2, ValueType y2)
+ : Range2D(x1, y1, x2, y2)
+ {}
+
+ BASEGFX_DLLPUBLIC explicit B2DRange(const B2IRange& rRange);
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ B2DPoint getMinimum() const
+ {
+ return B2DPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum()
+ );
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ B2DPoint getMaximum() const
+ {
+ return B2DPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum()
+ );
+ }
+
+ /// return difference between upper and lower point. returns (0,0) for empty sets.
+ B2DVector getRange() const
+ {
+ return B2DVector(
+ maRangeX.getRange(),
+ maRangeY.getRange()
+ );
+ }
+
+ /// return center point of set. returns (0,0) for empty sets.
+ B2DPoint getCenter() const
+ {
+ return B2DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter()
+ );
+ }
+
+ /** Transform Range by given transformation matrix. */
+ BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix& rMatrix);
+
+ /** Transform Range by given transformation matrix.
+
+ This operation transforms the Range by transforming all four possible
+ extrema points (corners) of the given range and building a new one.
+ This means that the range will grow evtl. when a shear and/or rotation
+ is part of the transformation.
+ */
+ BASEGFX_DLLPUBLIC B2DRange& operator*=( const ::basegfx::B2DHomMatrix& rMat );
+
+ /** Get a range filled with (0.0, 0.0, 1.0, 1.0) */
+ static const B2DRange& getUnitB2DRange();
+ };
+
+ /** Transform B2DRange by given transformation matrix (see operator*=())
+ */
+ B2DRange operator*( const B2DHomMatrix& rMat, const B2DRange& rB2DRange );
+
+ /** Round double to nearest integer for 2D range
+
+ @return the nearest integer for this range
+ */
+ BASEGFX_DLLPUBLIC B2IRange fround(const B2DRange& rRange);
+
+ /** Compute the set difference of the two given ranges
+
+ This method calculates the symmetric difference (aka XOR)
+ between the two given ranges, and returning the resulting
+ ranges. Thus, the result will contain all areas where one, but
+ not both ranges lie.
+
+ @param o_rResult
+ Result vector. The up to four difference ranges are returned
+ within this vector
+
+ @param rFirst
+ The first range
+
+ @param rSecond
+ The second range
+
+ @return the input vector
+ */
+ BASEGFX_DLLPUBLIC std::vector<B2DRange>& computeSetDifference(
+ std::vector<B2DRange>& o_rResult,
+ const B2DRange& rFirst,
+ const B2DRange& rSecond);
+
+ /** Write to char stream */
+ template<typename charT, typename traits>
+ inline std::basic_ostream<charT, traits>& operator<<(
+ std::basic_ostream<charT, traits>& stream, const B2DRange& range)
+ {
+ return stream << range.getWidth() << "x" << range.getHeight() << "@" << range.getMinimum();
+ }
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2drangeclipper.hxx b/include/basegfx/range/b2drangeclipper.hxx
new file mode 100644
index 000000000..6ea0a3f0e
--- /dev/null
+++ b/include/basegfx/range/b2drangeclipper.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/range/b2dpolyrange.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx::utils
+{
+ /** Extract poly-polygon w/o self-intersections from poly-range
+
+ Similar to the solveCrossovers(const B2DPolyPolygon&)
+ method, this one calculates a self-intersection-free
+ poly-polygon with the same topology, and encoding
+ inside/outsidedness via polygon orientation and layering.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solveCrossovers(const std::vector<B2DRange>& rRanges,
+ const std::vector<B2VectorOrientation>& rOrientations);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2drectangle.hxx b/include/basegfx/range/b2drectangle.hxx
new file mode 100644
index 000000000..ad8744b5d
--- /dev/null
+++ b/include/basegfx/range/b2drectangle.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/range/b2drange.hxx>
+
+namespace basegfx
+{
+// syntactic sugar: a B2DRange exactly models a Rectangle, thus,
+// for interface clarity, we provide an alias name
+
+/// Alias name for interface clarity (not everybody is aware of the identity)
+typedef B2DRange B2DRectangle;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2ibox.hxx b/include/basegfx/range/b2ibox.hxx
new file mode 100644
index 000000000..2be733b93
--- /dev/null
+++ b/include/basegfx/range/b2ibox.hxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <ostream>
+
+#include <basegfx/tuple/b2ituple.hxx>
+#include <basegfx/range/basicbox.hxx>
+
+namespace basegfx
+{
+ /** A two-dimensional interval over integers
+
+ This is most easily depicted as a set of integers, bounded by
+ a lower and an upper value - but excluding the upper
+ value. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ The set is half-open, i.e. the lower bound is included, the
+ upper bound not (if you're used to the notation - we're
+ talking about [a,b) here, compared to closed [a,b] or fully
+ open intervals (a,b)).
+
+ If you don't need a half-open interval, check B2IRange.
+
+ That means, isInside(val) will return true also for values of
+ val=a, but not for val=b.
+
+ Alternatively, consider this a rectangle, where the rightmost
+ pixel column and the bottommost pixel row are excluded - this
+ is much like polygon filling. As a result, filling a given
+ rectangle with basebmp::BitmapDevice::fillPolyPolygon(), will
+ affect exactly the same set of pixel as isInside() would
+ return true for.
+
+ @see B2IRange
+ */
+ class B2IBox
+ {
+ public:
+ typedef sal_Int32 ValueType;
+ typedef Int32Traits TraitsType;
+
+ B2IBox() {}
+
+ /// Create degenerate interval that's still empty
+ explicit B2IBox(const B2ITuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY())
+ {
+ }
+
+ /// Create proper interval between the two given points
+ B2IBox(sal_Int32 x1,
+ sal_Int32 y1,
+ sal_Int32 x2,
+ sal_Int32 y2) :
+ maRangeX(x1),
+ maRangeY(y1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ }
+
+ /// Create proper interval between the two given points
+ B2IBox(const B2ITuple& rTuple1,
+ const B2ITuple& rTuple2) :
+ maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY())
+ {
+ expand( rTuple2 );
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single value included will still return false.
+ */
+ bool isEmpty() const
+ {
+ return maRangeX.isEmpty() || maRangeY.isEmpty();
+ }
+
+ bool operator==( const B2IBox& rBox ) const
+ {
+ return (maRangeX == rBox.maRangeX
+ && maRangeY == rBox.maRangeY);
+ }
+
+ bool operator!=( const B2IBox& rBox ) const
+ {
+ return (maRangeX != rBox.maRangeX
+ || maRangeY != rBox.maRangeY);
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ /// return difference between upper and lower X value. returns 0 for empty sets.
+ sal_Int64 getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ /// return difference between upper and lower Y value. returns 0 for empty sets.
+ sal_Int64 getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ /// yields true if point is contained in set
+ bool isInside(const B2ITuple& rTuple) const
+ {
+ return (
+ maRangeX.isInside(rTuple.getX())
+ && maRangeY.isInside(rTuple.getY())
+ );
+ }
+
+ /// add point to the set, expanding as necessary
+ void expand(const B2ITuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ }
+
+ /// calc set intersection
+ void intersect(const B2IBox& rBox)
+ {
+ maRangeX.intersect(rBox.maRangeX);
+ maRangeY.intersect(rBox.maRangeY);
+ }
+
+ private:
+ BasicBox maRangeX;
+ BasicBox maRangeY;
+ };
+
+} // end of namespace basegfx
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const basegfx::B2IBox& box )
+{
+ if (box.isEmpty())
+ return stream << "EMPTY";
+ else
+ return stream << box.getWidth() << 'x' << box.getHeight()
+ << "@(" << box.getMinX() << "," << box.getMinY() << ")";
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2irange.hxx b/include/basegfx/range/b2irange.hxx
new file mode 100644
index 000000000..f1a0b0aae
--- /dev/null
+++ b/include/basegfx/range/b2irange.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <ostream>
+#include <vector>
+
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/point/b2ipoint.hxx>
+#include <basegfx/tuple/b2ituple.hxx>
+#include <basegfx/tuple/b2i64tuple.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/range/Range2D.hxx>
+
+namespace basegfx
+{
+ /** A two-dimensional interval over integers
+
+ This is a set of real numbers, bounded by a lower and an upper
+ pair. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ Probably you rather want B2IBox for integers.
+
+ The set is closed, i.e. the upper and the lower bound are
+ included (if you're used to the notation - we're talking about
+ [a,b] here, compared to half-open [a,b) or open intervals
+ (a,b)).
+
+ That means, isInside(val) will return true also for values of
+ val=a or val=b.
+
+ @see B2IBox
+ */
+ class B2IRange : public Range2D<sal_Int32, Int32Traits>
+ {
+ public:
+ B2IRange()
+ : Range2D()
+ {}
+
+ /// Create degenerate interval consisting of a single point
+ explicit B2IRange(const Tuple2D<ValueType>& rTuple)
+ : Range2D(rTuple)
+ {
+ }
+
+ /// Create proper interval between the two given points
+ B2IRange(const Tuple2D<ValueType>& rTuple1,
+ const Tuple2D<ValueType>& rTuple2)
+ : Range2D(rTuple1, rTuple2)
+ {
+ }
+
+ B2IRange(ValueType x1, ValueType y1, ValueType x2, ValueType y2)
+ : Range2D(x1, y1, x2, y2)
+ {}
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ B2IPoint getMinimum() const
+ {
+ return B2IPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum()
+ );
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ B2IPoint getMaximum() const
+ {
+ return B2IPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum()
+ );
+ }
+
+ /// return difference between upper and lower point. returns (0,0) for empty sets.
+ B2I64Tuple getRange() const
+ {
+ return B2I64Tuple(
+ maRangeX.getRange(),
+ maRangeY.getRange()
+ );
+ }
+ };
+
+ /** Compute the set difference of the two given ranges
+
+ This method calculates the symmetric difference (aka XOR)
+ between the two given ranges, and returning the resulting
+ ranges. Thus, the result will contain all areas where one, but
+ not both ranges lie.
+
+ @param o_rResult
+ Result vector. The up to four difference ranges are returned
+ within this vector
+
+ @param rFirst
+ The first range
+
+ @param rSecond
+ The second range
+
+ @return the input vector
+ */
+ BASEGFX_DLLPUBLIC std::vector<B2IRange>& computeSetDifference(
+ std::vector<B2IRange>& o_rResult,
+ const B2IRange& rFirst,
+ const B2IRange& rSecond);
+
+ /** Write to char stream */
+ template<typename charT, typename traits>
+ inline std::basic_ostream<charT, traits>& operator<<(
+ std::basic_ostream<charT, traits>& stream, const B2IRange& range)
+ {
+ if (range.isEmpty())
+ return stream << "EMPTY";
+ else
+ return stream << range.getWidth() << 'x' << range.getHeight() << "@" << range.getMinimum();
+ }
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2irectangle.hxx b/include/basegfx/range/b2irectangle.hxx
new file mode 100644
index 000000000..6356fa6cf
--- /dev/null
+++ b/include/basegfx/range/b2irectangle.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/range/b2irange.hxx>
+
+namespace basegfx
+{
+// syntactic sugar: a B2IRange exactly models a Rectangle, thus,
+// for interface clarity, we provide an alias name
+
+/// Alias name for interface clarity (not everybody is aware of the identity)
+typedef B2IRange B2IRectangle;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b3drange.hxx b/include/basegfx/range/b3drange.hxx
new file mode 100644
index 000000000..338c4f54a
--- /dev/null
+++ b/include/basegfx/range/b3drange.hxx
@@ -0,0 +1,227 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B3DHomMatrix;
+
+ class SAL_WARN_UNUSED B3DRange
+ {
+ typedef ::basegfx::BasicRange< double, DoubleTraits > MyBasicRange;
+
+ MyBasicRange maRangeX;
+ MyBasicRange maRangeY;
+ MyBasicRange maRangeZ;
+
+ public:
+ B3DRange() {}
+
+ explicit B3DRange(const B3DTuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY()),
+ maRangeZ(rTuple.getZ())
+ {
+ }
+
+ B3DRange(double x1,
+ double y1,
+ double z1,
+ double x2,
+ double y2,
+ double z2)
+ : maRangeX(x1),
+ maRangeY(y1),
+ maRangeZ(z1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ maRangeZ.expand(z2);
+ }
+
+ B3DRange(const B3DTuple& rTuple1,
+ const B3DTuple& rTuple2)
+ : maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY()),
+ maRangeZ(rTuple1.getZ())
+ {
+ expand(rTuple2);
+ }
+
+ bool isEmpty() const
+ {
+ return (
+ maRangeX.isEmpty()
+ || maRangeY.isEmpty()
+ || maRangeZ.isEmpty()
+ );
+ }
+
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ maRangeZ.reset();
+ }
+
+ bool operator==( const B3DRange& rRange ) const
+ {
+ return (maRangeX == rRange.maRangeX
+ && maRangeY == rRange.maRangeY
+ && maRangeZ == rRange.maRangeZ);
+ }
+
+ bool operator!=( const B3DRange& rRange ) const
+ {
+ return (maRangeX != rRange.maRangeX
+ || maRangeY != rRange.maRangeY
+ || maRangeZ != rRange.maRangeZ);
+ }
+
+ double getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ double getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ double getMinZ() const
+ {
+ return maRangeZ.getMinimum();
+ }
+
+ double getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ double getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ double getMaxZ() const
+ {
+ return maRangeZ.getMaximum();
+ }
+
+ double getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ double getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ double getDepth() const
+ {
+ return maRangeZ.getRange();
+ }
+
+ B3DVector getRange() const
+ {
+ return B3DVector(
+ maRangeX.getRange(),
+ maRangeY.getRange(),
+ maRangeZ.getRange()
+ );
+ }
+
+ B3DPoint getCenter() const
+ {
+ return B3DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter(),
+ maRangeZ.getCenter()
+ );
+ }
+
+ bool overlaps(const B3DRange& rRange) const
+ {
+ return (
+ maRangeX.overlaps(rRange.maRangeX)
+ && maRangeY.overlaps(rRange.maRangeY)
+ && maRangeZ.overlaps(rRange.maRangeZ)
+ );
+ }
+
+ void expand(const B3DTuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ maRangeZ.expand(rTuple.getZ());
+ }
+
+ void expand(const B3DRange& rRange)
+ {
+ maRangeX.expand(rRange.maRangeX);
+ maRangeY.expand(rRange.maRangeY);
+ maRangeZ.expand(rRange.maRangeZ);
+ }
+
+ void grow(double fValue)
+ {
+ maRangeX.grow(fValue);
+ maRangeY.grow(fValue);
+ maRangeZ.grow(fValue);
+ }
+
+ /// clamp value on range
+ B3DTuple clamp(const B3DTuple& rTuple) const
+ {
+ return B3DTuple(
+ maRangeX.clamp(rTuple.getX()),
+ maRangeY.clamp(rTuple.getY()),
+ maRangeZ.clamp(rTuple.getZ()));
+ }
+
+ BASEGFX_DLLPUBLIC void transform(const B3DHomMatrix& rMatrix);
+
+ /** Transform Range by given transformation matrix.
+
+ This operation transforms the Range by transforming all eight possible
+ extrema points (corners) of the given range and building a new one.
+ This means that the range will grow evtl. when a shear and/or rotation
+ is part of the transformation.
+ */
+ B3DRange& operator*=( const ::basegfx::B3DHomMatrix& rMat );
+
+ /** Get a range filled with (0.0, 0.0, 0.0, 1.0, 1.0, 1.0) */
+ static const B3DRange& getUnitB3DRange();
+ };
+
+ /** Transform B3DRange by given transformation matrix (see operator*=())
+ */
+ B3DRange operator*( const B3DHomMatrix& rMat, const B3DRange& rB2DRange );
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/basicbox.hxx b/include/basegfx/range/basicbox.hxx
new file mode 100644
index 000000000..123d2b1b3
--- /dev/null
+++ b/include/basegfx/range/basicbox.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/range/basicrange.hxx>
+
+
+namespace basegfx
+{
+ /** Explicitly different from BasicRange, handling the inside predicates
+ differently.
+
+ This is modelled after how polygon fill algorithms set pixel -
+ typically excluding rightmost and bottommost ones.
+ */
+ class BasicBox : public BasicRange< sal_Int32, Int32Traits >
+ {
+ typedef BasicRange< sal_Int32, Int32Traits > Base;
+ public:
+ BasicBox() {}
+
+ explicit BasicBox( sal_Int32 nValue ) :
+ Base( nValue )
+ {
+ }
+
+ bool isEmpty() const
+ {
+ return mnMinimum >= mnMaximum;
+ }
+
+ using Base::isInside;
+
+ bool isInside(sal_Int32 nValue) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return (nValue >= mnMinimum) && (nValue < mnMaximum);
+ }
+ }
+
+ using Base::overlaps;
+ };
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/basicrange.hxx b/include/basegfx/range/basicrange.hxx
new file mode 100644
index 000000000..53134cd9e
--- /dev/null
+++ b/include/basegfx/range/basicrange.hxx
@@ -0,0 +1,313 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <float.h>
+#include <basegfx/numeric/ftools.hxx>
+
+
+namespace basegfx
+{
+ template< typename T, typename Traits > class BasicRange
+ {
+ protected:
+ T mnMinimum;
+ T mnMaximum;
+
+ public:
+ typedef T ValueType;
+ typedef Traits TraitsType;
+
+ BasicRange() :
+ mnMinimum(Traits::maxVal()),
+ mnMaximum(Traits::minVal())
+ {
+ }
+
+ explicit BasicRange( T nValue ) :
+ mnMinimum(nValue),
+ mnMaximum(nValue)
+ {
+ }
+
+ void reset()
+ {
+ mnMinimum = Traits::maxVal();
+ mnMaximum = Traits::minVal();
+ }
+
+ bool isEmpty() const
+ {
+ return Traits::maxVal() == mnMinimum;
+ }
+
+ T getMinimum() const { return mnMinimum; }
+ T getMaximum() const { return mnMaximum; }
+
+ double getCenter() const
+ {
+ if(isEmpty())
+ {
+ return 0.0;
+ }
+ else
+ {
+ return ((mnMaximum + mnMinimum) / 2.0);
+ }
+ }
+
+ bool isInside(T nValue) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return (nValue >= mnMinimum) && (nValue <= mnMaximum);
+ }
+ }
+
+ bool isInside(const BasicRange& rRange) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ if(rRange.isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return (rRange.mnMinimum >= mnMinimum) && (rRange.mnMaximum <= mnMaximum);
+ }
+ }
+ }
+
+ bool overlaps(const BasicRange& rRange) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ if(rRange.isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return (rRange.mnMaximum >= mnMinimum) && (rRange.mnMinimum <= mnMaximum);
+ }
+ }
+ }
+
+ bool overlapsMore(const BasicRange& rRange) const
+ {
+ if(isEmpty() || rRange.isEmpty())
+ return false;
+ // returns true if the overlap is more than just a touching at the limits
+ return ((rRange.mnMaximum > mnMinimum) && (rRange.mnMinimum < mnMaximum));
+ }
+
+ bool operator==( const BasicRange& rRange ) const
+ {
+ return (mnMinimum == rRange.mnMinimum && mnMaximum == rRange.mnMaximum);
+ }
+
+ bool operator!=( const BasicRange& rRange ) const
+ {
+ return (mnMinimum != rRange.mnMinimum || mnMaximum != rRange.mnMaximum);
+ }
+
+ bool equal(const BasicRange& rRange) const
+ {
+ return (
+ fTools::equal(mnMinimum, rRange.mnMinimum) &&
+ fTools::equal(mnMaximum, rRange.mnMaximum));
+ }
+
+ void expand(T nValue)
+ {
+ if(isEmpty())
+ {
+ mnMinimum = mnMaximum = nValue;
+ }
+ else
+ {
+// Silence over-eager warning emitted at least by GCC 4.9.2 in certain
+// instantiations:
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
+#endif
+ if(nValue < mnMinimum)
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic pop
+#endif
+ {
+ mnMinimum = nValue;
+ }
+
+ if(nValue > mnMaximum)
+ {
+ mnMaximum = nValue;
+ }
+ }
+ }
+
+ void expand(const BasicRange& rRange)
+ {
+ if(isEmpty())
+ {
+ mnMinimum = rRange.mnMinimum;
+ mnMaximum = rRange.mnMaximum;
+ }
+ else
+ {
+ if(!rRange.isEmpty())
+ {
+ if(rRange.mnMinimum < mnMinimum)
+ {
+ mnMinimum = rRange.mnMinimum;
+ }
+
+ if(rRange.mnMaximum > mnMaximum)
+ {
+ mnMaximum = rRange.mnMaximum;
+ }
+ }
+ }
+ }
+
+ void intersect(const BasicRange& rRange)
+ {
+ // here, overlaps also tests all isEmpty() conditions already.
+ if( !overlaps( rRange ) )
+ {
+ reset();
+ }
+ else
+ {
+ if(rRange.mnMinimum > mnMinimum)
+ {
+ mnMinimum = rRange.mnMinimum;
+ }
+
+ if(rRange.mnMaximum < mnMaximum)
+ {
+ mnMaximum = rRange.mnMaximum;
+ }
+ }
+ }
+
+ void grow(T nValue)
+ {
+ if(isEmpty())
+ return;
+
+ bool bLessThanZero(nValue < 0);
+
+ if(nValue > 0 || bLessThanZero)
+ {
+ mnMinimum -= nValue;
+ mnMaximum += nValue;
+
+ if(bLessThanZero)
+ {
+ // test if range did collapse
+ if(mnMinimum > mnMaximum)
+ {
+ // if yes, collapse to center
+ mnMinimum = mnMaximum = (mnMinimum + mnMaximum) / 2;
+ }
+ }
+ }
+ }
+
+ T clamp(T nValue) const
+ {
+ if(isEmpty())
+ {
+ return nValue;
+ }
+ else
+ {
+ if(nValue < mnMinimum)
+ {
+ return mnMinimum;
+ }
+
+ if(nValue > mnMaximum)
+ {
+ return mnMaximum;
+ }
+
+ return nValue;
+ }
+ }
+
+#if defined _MSC_VER && defined(_M_ARM64)
+#pragma warning(push)
+#pragma warning(disable: 4723) /* ignore: warning for C4723 on windows arm64 build */
+#endif
+ typename Traits::DifferenceType getRange() const
+ {
+ if(isEmpty())
+ {
+ return Traits::neutral();
+ }
+ else
+ {
+ return (mnMaximum - mnMinimum);
+ }
+ }
+#if defined _MSC_VER && defined(_M_ARM64)
+#pragma warning( pop )
+#endif
+ };
+
+ // some pre-fabricated traits
+ struct DoubleTraits
+ {
+ static constexpr double minVal() { return DBL_MIN; };
+ static constexpr double maxVal() { return DBL_MAX; };
+ static constexpr double neutral() { return 0.0; };
+
+ typedef double DifferenceType;
+ };
+
+ struct Int32Traits
+ {
+ static constexpr sal_Int32 minVal() { return SAL_MIN_INT32; };
+ static constexpr sal_Int32 maxVal() { return SAL_MAX_INT32; };
+ static constexpr sal_Int32 neutral() { return 0; };
+
+ typedef sal_Int64 DifferenceType;
+ };
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/raster/bzpixelraster.hxx b/include/basegfx/raster/bzpixelraster.hxx
new file mode 100644
index 000000000..52ebc3c6e
--- /dev/null
+++ b/include/basegfx/raster/bzpixelraster.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/pixel/bpixel.hxx>
+#include <sal/types.h>
+#include <memory>
+#include <cassert>
+#include <string.h>
+
+namespace basegfx
+{
+ class BZPixelRaster
+ {
+ private:
+ BZPixelRaster(const BZPixelRaster&) = delete;
+ BZPixelRaster& operator=(const BZPixelRaster&) = delete;
+
+ sal_uInt32 mnWidth;
+ sal_uInt32 mnHeight;
+ sal_uInt32 mnCount;
+ std::unique_ptr<BPixel[]> mpContent;
+ std::unique_ptr<sal_uInt16[]> mpZBuffer;
+
+ public:
+ // constructor/destructor
+ BZPixelRaster(sal_uInt32 nWidth, sal_uInt32 nHeight)
+ : mnWidth(nWidth),
+ mnHeight(nHeight),
+ mnCount(nWidth * nHeight),
+ mpContent(new BPixel[mnCount]),
+ mpZBuffer(new sal_uInt16[mnCount])
+ {
+ memset(mpZBuffer.get(), 0, sizeof(sal_uInt16) * mnCount);
+ }
+
+ // coordinate calcs between X/Y and span
+ sal_uInt32 getIndexFromXY(sal_uInt32 nX, sal_uInt32 nY) const { return (nX + (nY * mnWidth)); }
+
+ // data access read
+ sal_uInt32 getWidth() const { return mnWidth; }
+ sal_uInt32 getHeight() const { return mnHeight; }
+
+ // data access read only
+ const BPixel& getBPixel(sal_uInt32 nIndex) const
+ {
+ assert(nIndex < mnCount && "Access out of range");
+ return mpContent[nIndex];
+ }
+
+ // data access read/write
+ BPixel& getBPixel(sal_uInt32 nIndex)
+ {
+ assert(nIndex < mnCount && "Access out of range");
+ return mpContent[nIndex];
+ }
+
+ // data access read only
+ const sal_uInt16& getZ(sal_uInt32 nIndex) const
+ {
+ assert(nIndex < mnCount && "Access out of range");
+ return mpZBuffer[nIndex];
+ }
+
+ // data access read/write
+ sal_uInt16& getZ(sal_uInt32 nIndex)
+ {
+ assert(nIndex < mnCount && "Access out of range");
+ return mpZBuffer[nIndex];
+ }
+ };
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/raster/rasterconvert3d.hxx b/include/basegfx/raster/rasterconvert3d.hxx
new file mode 100644
index 000000000..83f753e31
--- /dev/null
+++ b/include/basegfx/raster/rasterconvert3d.hxx
@@ -0,0 +1,421 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <sal/types.h>
+#include <vector>
+
+#include <osl/diagnose.h>
+
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B3DPolygon;
+ class B3DPolyPolygon;
+}
+
+// interpolators for double precision
+
+namespace basegfx
+{
+ class ip_single
+ {
+ private:
+ double mfVal;
+ double mfInc;
+
+ public:
+ ip_single()
+ : mfVal(0.0),
+ mfInc(0.0)
+ {}
+
+ ip_single(double fVal, double fInc)
+ : mfVal(fVal),
+ mfInc(fInc)
+ {}
+
+ double getVal() const { return mfVal; }
+ double getInc() const { return mfInc; }
+
+ void increment(double fStep) { mfVal += fStep * mfInc; }
+ };
+
+ class ip_double
+ {
+ private:
+ ip_single maX;
+ ip_single maY;
+
+ public:
+ ip_double()
+ {}
+
+ ip_double(double fXVal, double fXInc, double fYVal, double fYInc)
+ : maX(fXVal, fXInc),
+ maY(fYVal, fYInc)
+ {}
+
+ const ip_single& getX() const { return maX; }
+ const ip_single& getY() const { return maY; }
+
+ void increment(double fStep) { maX.increment(fStep); maY.increment(fStep); }
+ };
+
+ class ip_triple
+ {
+ private:
+ ip_single maX;
+ ip_single maY;
+ ip_single maZ;
+
+ public:
+ ip_triple()
+ {}
+
+ ip_triple(double fXVal, double fXInc, double fYVal, double fYInc, double fZVal, double fZInc)
+ : maX(fXVal, fXInc),
+ maY(fYVal, fYInc),
+ maZ(fZVal, fZInc)
+ {}
+
+ const ip_single& getX() const { return maX; }
+ const ip_single& getY() const { return maY; }
+ const ip_single& getZ() const { return maZ; }
+
+ void increment(double fStep) { maX.increment(fStep); maY.increment(fStep); maZ.increment(fStep); }
+ };
+
+ // InterpolatorProvider3D to have a common source for allocating interpolators
+ // which may then be addressed using the index to the vectors
+
+ #define SCANLINE_EMPTY_INDEX (0xffffffff)
+
+ class InterpolatorProvider3D
+ {
+ private:
+ ::std::vector< ip_triple > maColorInterpolators;
+ ::std::vector< ip_triple > maNormalInterpolators;
+ ::std::vector< ip_double > maTextureInterpolators;
+ ::std::vector< ip_triple > maInverseTextureInterpolators;
+
+ protected:
+ sal_uInt32 addColorInterpolator(const BColor& rA, const BColor& rB, double fInvYDelta)
+ {
+ double aDeltaRed(rB.getRed() - rA.getRed());
+
+ if(fTools::equalZero(aDeltaRed))
+ {
+ aDeltaRed = 0.0;
+ }
+ else
+ {
+ aDeltaRed *= fInvYDelta;
+ }
+
+ double aDeltaGreen(rB.getGreen() - rA.getGreen());
+
+ if(fTools::equalZero(aDeltaGreen))
+ {
+ aDeltaGreen = 0.0;
+ }
+ else
+ {
+ aDeltaGreen *= fInvYDelta;
+ }
+
+ double aDeltaBlue(rB.getBlue() - rA.getBlue());
+
+ if(fTools::equalZero(aDeltaBlue))
+ {
+ aDeltaBlue = 0.0;
+ }
+ else
+ {
+ aDeltaBlue *= fInvYDelta;
+ }
+
+ maColorInterpolators.push_back(
+ ip_triple(
+ rA.getRed(), aDeltaRed,
+ rA.getGreen(), aDeltaGreen,
+ rA.getBlue(), aDeltaBlue));
+
+ return (maColorInterpolators.size() - 1);
+ }
+
+ sal_uInt32 addNormalInterpolator(const B3DVector& rA, const B3DVector& rB, double fInvYDelta)
+ {
+ double aDeltaX(rB.getX() - rA.getX());
+
+ if(fTools::equalZero(aDeltaX))
+ {
+ aDeltaX = 0.0;
+ }
+ else
+ {
+ aDeltaX *= fInvYDelta;
+ }
+
+ double aDeltaY(rB.getY() - rA.getY());
+
+ if(fTools::equalZero(aDeltaY))
+ {
+ aDeltaY = 0.0;
+ }
+ else
+ {
+ aDeltaY *= fInvYDelta;
+ }
+
+ double aDeltaZ(rB.getZ() - rA.getZ());
+
+ if(fTools::equalZero(aDeltaZ))
+ {
+ aDeltaZ = 0.0;
+ }
+ else
+ {
+ aDeltaZ *= fInvYDelta;
+ }
+
+ maNormalInterpolators.push_back(
+ ip_triple(
+ rA.getX(), aDeltaX,
+ rA.getY(), aDeltaY,
+ rA.getZ(), aDeltaZ));
+
+ return (maNormalInterpolators.size() - 1);
+ }
+
+ sal_uInt32 addTextureInterpolator(const B2DPoint& rA, const B2DPoint& rB, double fInvYDelta)
+ {
+ double aDeltaX(rB.getX() - rA.getX());
+
+ if(fTools::equalZero(aDeltaX))
+ {
+ aDeltaX = 0.0;
+ }
+ else
+ {
+ aDeltaX *= fInvYDelta;
+ }
+
+ double aDeltaY(rB.getY() - rA.getY());
+
+ if(fTools::equalZero(aDeltaY))
+ {
+ aDeltaY = 0.0;
+ }
+ else
+ {
+ aDeltaY *= fInvYDelta;
+ }
+
+ maTextureInterpolators.push_back(
+ ip_double(
+ rA.getX(), aDeltaX,
+ rA.getY(), aDeltaY));
+
+ return (maTextureInterpolators.size() - 1);
+ }
+
+ sal_uInt32 addInverseTextureInterpolator(const B2DPoint& rA, const B2DPoint& rB, double fZEyeA, double fZEyeB, double fInvYDelta)
+ {
+ double fZDelta(fZEyeB - fZEyeA);
+ const double fInvZEyeA(fTools::equalZero(fZEyeA) ? fZEyeA : 1.0 / fZEyeA);
+ double fInvZEyeB(fInvZEyeA);
+
+ if(fTools::equalZero(fZDelta))
+ {
+ fZDelta = 0.0;
+ }
+ else
+ {
+ fInvZEyeB = fTools::equalZero(fZEyeB) ? fZEyeB : 1.0 / fZEyeB;
+ fZDelta = (fInvZEyeB - fInvZEyeA) * fInvYDelta;
+ }
+
+ const B2DPoint aInvA(rA * fInvZEyeA);
+ const B2DPoint aInvB(rB * fInvZEyeB);
+ const double aDeltaX((aInvB.getX() - aInvA.getX()) * fInvYDelta);
+ const double aDeltaY((aInvB.getY() - aInvA.getY()) * fInvYDelta);
+
+ maInverseTextureInterpolators.push_back(
+ ip_triple(
+ aInvA.getX(), aDeltaX,
+ aInvA.getY(), aDeltaY,
+ fInvZEyeA, fZDelta));
+
+ return (maInverseTextureInterpolators.size() - 1);
+ }
+
+ void reset()
+ {
+ maColorInterpolators.clear();
+ maNormalInterpolators.clear();
+ maTextureInterpolators.clear();
+ maInverseTextureInterpolators.clear();
+ }
+
+ public:
+ InterpolatorProvider3D() {}
+
+ ::std::vector< ip_triple >& getColorInterpolators() { return maColorInterpolators; }
+ ::std::vector< ip_triple >& getNormalInterpolators() { return maNormalInterpolators; }
+ ::std::vector< ip_double >& getTextureInterpolators() { return maTextureInterpolators; }
+ ::std::vector< ip_triple >& getInverseTextureInterpolators() { return maInverseTextureInterpolators; }
+ };
+
+ // RasterConversionLineEntry3D for Rasterconversion of 3D PolyPolygons
+
+ class RasterConversionLineEntry3D
+ {
+ private:
+ ip_single maX;
+ ip_single maZ;
+ sal_Int32 mnY;
+ sal_uInt32 mnCount;
+
+ sal_uInt32 mnColorIndex;
+ sal_uInt32 mnNormalIndex;
+ sal_uInt32 mnTextureIndex;
+ sal_uInt32 mnInverseTextureIndex;
+
+ public:
+ RasterConversionLineEntry3D(const double& rfX, const double& rfDeltaX, const double& rfZ, const double& rfDeltaZ, sal_Int32 nY, sal_uInt32 nCount)
+ : maX(rfX, rfDeltaX),
+ maZ(rfZ, rfDeltaZ),
+ mnY(nY),
+ mnCount(nCount),
+ mnColorIndex(SCANLINE_EMPTY_INDEX),
+ mnNormalIndex(SCANLINE_EMPTY_INDEX),
+ mnTextureIndex(SCANLINE_EMPTY_INDEX),
+ mnInverseTextureIndex(SCANLINE_EMPTY_INDEX)
+ {}
+
+ void setColorIndex(sal_uInt32 nIndex) { mnColorIndex = nIndex; }
+ void setNormalIndex(sal_uInt32 nIndex) { mnNormalIndex = nIndex; }
+ void setTextureIndex(sal_uInt32 nIndex) { mnTextureIndex = nIndex; }
+ void setInverseTextureIndex(sal_uInt32 nIndex) { mnInverseTextureIndex = nIndex; }
+
+ bool operator<(const RasterConversionLineEntry3D& rComp) const
+ {
+ if(mnY == rComp.mnY)
+ {
+ return maX.getVal() < rComp.maX.getVal();
+ }
+
+ return mnY < rComp.mnY;
+ }
+
+ bool decrementRasterConversionLineEntry3D(sal_uInt32 nStep)
+ {
+ if(nStep >= mnCount)
+ {
+ return false;
+ }
+ else
+ {
+ mnCount -= nStep;
+ return true;
+ }
+ }
+
+ void incrementRasterConversionLineEntry3D(sal_uInt32 nStep, InterpolatorProvider3D& rProvider)
+ {
+ const double fStep(static_cast<double>(nStep));
+ maX.increment(fStep);
+ maZ.increment(fStep);
+ mnY += nStep;
+
+ if(SCANLINE_EMPTY_INDEX != mnColorIndex)
+ {
+ rProvider.getColorInterpolators()[mnColorIndex].increment(fStep);
+ }
+
+ if(SCANLINE_EMPTY_INDEX != mnNormalIndex)
+ {
+ rProvider.getNormalInterpolators()[mnNormalIndex].increment(fStep);
+ }
+
+ if(SCANLINE_EMPTY_INDEX != mnTextureIndex)
+ {
+ rProvider.getTextureInterpolators()[mnTextureIndex].increment(fStep);
+ }
+
+ if(SCANLINE_EMPTY_INDEX != mnInverseTextureIndex)
+ {
+ rProvider.getInverseTextureInterpolators()[mnInverseTextureIndex].increment(fStep);
+ }
+ }
+
+ // data read access
+ const ip_single& getX() const { return maX; }
+ sal_Int32 getY() const { return mnY; }
+ const ip_single& getZ() const { return maZ; }
+ sal_uInt32 getColorIndex() const { return mnColorIndex; }
+ sal_uInt32 getNormalIndex() const { return mnNormalIndex; }
+ sal_uInt32 getTextureIndex() const { return mnTextureIndex; }
+ sal_uInt32 getInverseTextureIndex() const { return mnInverseTextureIndex; }
+ };
+
+ // the basic RasterConverter itself. Only one method needs to be overridden. The
+ // class itself is pure virtual
+
+ class UNLESS_MERGELIBS(BASEGFX_DLLPUBLIC) RasterConverter3D : public InterpolatorProvider3D
+ {
+ private:
+ // the line entries for an area conversion run
+ ::std::vector< RasterConversionLineEntry3D > maLineEntries;
+
+ struct lineComparator
+ {
+ bool operator()(const RasterConversionLineEntry3D* pA, const RasterConversionLineEntry3D* pB)
+ {
+ OSL_ENSURE(pA && pB, "lineComparator: empty pointer (!)");
+ return pA->getX().getVal() < pB->getX().getVal();
+ }
+ };
+
+ SAL_DLLPRIVATE void addArea(const B3DPolygon& rFill, const B3DHomMatrix* pViewToEye);
+ SAL_DLLPRIVATE void addArea(const B3DPolyPolygon& rFill, const B3DHomMatrix* pViewToEye);
+ SAL_DLLPRIVATE void addEdge(const B3DPolygon& rFill, sal_uInt32 a, sal_uInt32 b, const B3DHomMatrix* pViewToEye);
+
+ SAL_DLLPRIVATE void rasterconvertB3DArea(sal_Int32 nStartLine, sal_Int32 nStopLine);
+ SAL_DLLPRIVATE void rasterconvertB3DEdge(const B3DPolygon& rLine, sal_uInt32 nA, sal_uInt32 nB, sal_Int32 nStartLine, sal_Int32 nStopLine, sal_uInt16 nLineWidth);
+
+ virtual void processLineSpan(const RasterConversionLineEntry3D& rA, const RasterConversionLineEntry3D& rB, sal_Int32 nLine, sal_uInt32 nSpanCount) = 0;
+
+ public:
+ RasterConverter3D();
+ virtual ~RasterConverter3D();
+
+ void rasterconvertB3DPolyPolygon(const B3DPolyPolygon& rFill, const B3DHomMatrix* pViewToEye, sal_Int32 nStartLine, sal_Int32 nStopLine);
+ void rasterconvertB3DPolygon(const B3DPolygon& rLine, sal_Int32 nStartLine, sal_Int32 nStopLine, sal_uInt16 nLineWidth);
+ };
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/Tuple2D.hxx b/include/basegfx/tuple/Tuple2D.hxx
new file mode 100644
index 000000000..44d546df6
--- /dev/null
+++ b/include/basegfx/tuple/Tuple2D.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <basegfx/utils/common.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+namespace basegfx
+{
+template <typename TYPE> class Tuple2D
+{
+protected:
+ union {
+ // temporary alias mnX with mfX and mnY with mfY
+ struct
+ {
+ TYPE mnX;
+ TYPE mnY;
+ };
+ struct
+ {
+ TYPE mfX;
+ TYPE mfY;
+ };
+ };
+
+public:
+ /** Create a 2D Tuple
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Tuple.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Tuple.
+ */
+ Tuple2D(TYPE x, TYPE y)
+ : mnX(x)
+ , mnY(y)
+ {
+ }
+
+ double get(Axis2D eAxis) { return eAxis == Axis2D::X ? getX() : getY(); }
+
+ void set(Axis2D eAxis, TYPE fValue)
+ {
+ if (eAxis == Axis2D::X)
+ setX(fValue);
+ else
+ setY(fValue);
+ }
+
+ /// Get X-Coordinate of 2D Tuple
+ TYPE getX() const { return mnX; }
+
+ /// Get Y-Coordinate of 2D Tuple
+ TYPE getY() const { return mnY; }
+
+ /// Set X-Coordinate of 2D Tuple
+ void setX(TYPE fX) { mnX = fX; }
+
+ /// Set Y-Coordinate of 2D Tuple
+ void setY(TYPE fY) { mnY = fY; }
+
+ /// Adjust X-Coordinate of 2D Tuple
+ void adjustX(TYPE fX) { mnX += fX; }
+
+ /// Adjust Y-Coordinate of 2D Tuple
+ void adjustY(TYPE fY) { mnY += fY; }
+
+ // comparators with tolerance
+
+ template <typename T = TYPE, std::enable_if_t<std::is_integral_v<T>, int> = 0>
+ bool equal(const Tuple2D<TYPE>& rTup) const
+ {
+ return mfX == rTup.mfX && mfY == rTup.mfY;
+ }
+
+ template <typename T = TYPE, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
+ bool equal(const Tuple2D<TYPE>& rTup) const
+ {
+ return this == &rTup || (fTools::equal(mfX, rTup.mfX) && fTools::equal(mfY, rTup.mfY));
+ }
+
+ template <typename T = TYPE, std::enable_if_t<std::is_integral_v<T>, int> = 0>
+ bool equalZero() const
+ {
+ return mnX == 0 && mnY == 0;
+ }
+
+ template <typename T = TYPE, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
+ bool equalZero() const
+ {
+ return fTools::equalZero(mfX) && fTools::equalZero(mfY);
+ }
+
+ // operator overrides
+
+ Tuple2D& operator+=(const Tuple2D& rTup)
+ {
+ mfX += rTup.mfX;
+ mfY += rTup.mfY;
+ return *this;
+ }
+
+ Tuple2D& operator-=(const Tuple2D& rTup)
+ {
+ mfX -= rTup.mfX;
+ mfY -= rTup.mfY;
+ return *this;
+ }
+
+ Tuple2D& operator/=(const Tuple2D& rTup)
+ {
+ mfX /= rTup.mfX;
+ mfY /= rTup.mfY;
+ return *this;
+ }
+
+ Tuple2D& operator*=(const Tuple2D& rTup)
+ {
+ mfX *= rTup.mfX;
+ mfY *= rTup.mfY;
+ return *this;
+ }
+
+ Tuple2D& operator*=(TYPE t)
+ {
+ mfX *= t;
+ mfY *= t;
+ return *this;
+ }
+
+ Tuple2D& operator/=(TYPE t)
+ {
+ mfX /= t;
+ mfY /= t;
+ return *this;
+ }
+
+ bool operator==(const Tuple2D& rTup) const { return mfX == rTup.mfX && mfY == rTup.mfY; }
+
+ bool operator!=(const Tuple2D& rTup) const { return !(*this == rTup); }
+};
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/Tuple3D.hxx b/include/basegfx/tuple/Tuple3D.hxx
new file mode 100644
index 000000000..967516663
--- /dev/null
+++ b/include/basegfx/tuple/Tuple3D.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+namespace basegfx
+{
+template <typename TYPE> class Tuple3D
+{
+protected:
+ union {
+ // temporary alias mnX with mfX, mnY with mfY and mnZ with mfZ
+ struct
+ {
+ TYPE mnX;
+ TYPE mnY;
+ TYPE mnZ;
+ };
+ struct
+ {
+ TYPE mfX;
+ TYPE mfY;
+ TYPE mfZ;
+ };
+ };
+
+public:
+ /** Create a 3D Tuple
+
+ @param x
+ This parameter is used to initialize the X-coordinate
+ of the 3D Tuple.
+
+ @param y
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Tuple.
+
+ @param z
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Tuple.
+ */
+ Tuple3D(TYPE x, TYPE y, TYPE z)
+ : mnX(x)
+ , mnY(y)
+ , mnZ(z)
+ {
+ }
+
+ /// Get X-Coordinate of 3D Tuple
+ TYPE getX() const { return mnX; }
+
+ /// Get Y-Coordinate of 3D Tuple
+ TYPE getY() const { return mnY; }
+
+ /// Get Z-Coordinate of 3D Tuple
+ TYPE getZ() const { return mnZ; }
+
+ /// Set X-Coordinate of 3D Tuple
+ void setX(TYPE fX) { mnX = fX; }
+
+ /// Set Y-Coordinate of 3D Tuple
+ void setY(TYPE fY) { mnY = fY; }
+
+ /// Set Z-Coordinate of 3D Tuple
+ void setZ(TYPE fZ) { mnZ = fZ; }
+
+ // operators
+
+ Tuple3D& operator+=(const Tuple3D& rTup)
+ {
+ mfX += rTup.mfX;
+ mfY += rTup.mfY;
+ mfZ += rTup.mfZ;
+ return *this;
+ }
+
+ Tuple3D& operator-=(const Tuple3D& rTup)
+ {
+ mfX -= rTup.mfX;
+ mfY -= rTup.mfY;
+ mfZ -= rTup.mfZ;
+ return *this;
+ }
+
+ Tuple3D& operator/=(const Tuple3D& rTup)
+ {
+ mfX /= rTup.mfX;
+ mfY /= rTup.mfY;
+ mfZ /= rTup.mfZ;
+ return *this;
+ }
+
+ Tuple3D& operator*=(const Tuple3D& rTup)
+ {
+ mfX *= rTup.mfX;
+ mfY *= rTup.mfY;
+ mfZ *= rTup.mfZ;
+ return *this;
+ }
+
+ Tuple3D& operator*=(TYPE t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ Tuple3D& operator/=(TYPE t)
+ {
+ mfX /= t;
+ mfY /= t;
+ mfZ /= t;
+ return *this;
+ }
+
+ bool operator==(const Tuple3D& rTup) const
+ {
+ return mfX == rTup.mfX && mfY == rTup.mfY && mfZ == rTup.mfZ;
+ }
+
+ bool operator!=(const Tuple3D& rTup) const { return !operator==(rTup); }
+};
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b2dtuple.hxx b/include/basegfx/tuple/b2dtuple.hxx
new file mode 100644
index 000000000..c47b7b898
--- /dev/null
+++ b/include/basegfx/tuple/b2dtuple.hxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/tuple/Tuple2D.hxx>
+
+namespace basegfx
+{
+ class B2ITuple;
+
+ /** Base class for all Points/Vectors with two double values
+
+ This class provides all methods common to Point
+ and Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on two double values
+ */
+ class SAL_WARN_UNUSED B2DTuple : public Tuple2D<double>
+ {
+ public:
+
+ /** Create a 2D Tuple
+
+ The tuple is initialized to (0.0, 0.0)
+ */
+ B2DTuple()
+ : Tuple2D(0.0, 0.0)
+ {}
+
+ /** Create a 2D Tuple
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Tuple.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Tuple.
+ */
+ B2DTuple(double fX, double fY)
+ : Tuple2D(fX, fY)
+ {}
+
+ /** Create a copy of a 2D integer Tuple
+
+ @param rTup
+ The 2D Tuple which will be copied.
+ */
+ BASEGFX_DLLPUBLIC explicit B2DTuple(const B2ITuple& rTup);
+
+ // operators
+
+ B2DTuple operator-(void) const
+ {
+ return B2DTuple(-mfX, -mfY);
+ }
+
+ BASEGFX_DLLPUBLIC static const B2DTuple& getEmptyTuple();
+ };
+
+ // external operators
+
+
+ inline B2DTuple absolute(const B2DTuple& rTup)
+ {
+ B2DTuple aAbs(
+ fabs(rTup.getX()),
+ fabs(rTup.getY()));
+ return aAbs;
+ }
+
+ inline B2DTuple interpolate(const B2DTuple& rOld1, const B2DTuple& rOld2, double t)
+ {
+ if(rOld1 == rOld2)
+ {
+ return rOld1;
+ }
+ else if(0.0 >= t)
+ {
+ return rOld1;
+ }
+ else if(1.0 <= t)
+ {
+ return rOld2;
+ }
+ else
+ {
+ return B2DTuple(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY());
+ }
+ }
+
+ inline B2DTuple average(const B2DTuple& rOld1, const B2DTuple& rOld2)
+ {
+ return B2DTuple(
+ rtl_math_approxEqual(rOld1.getX(), rOld2.getX()) ? rOld1.getX() : (rOld1.getX() + rOld2.getX()) * 0.5,
+ rtl_math_approxEqual(rOld1.getY(), rOld2.getY()) ? rOld1.getY() : (rOld1.getY() + rOld2.getY()) * 0.5);
+ }
+
+ inline B2DTuple operator+(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B2DTuple operator-(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B2DTuple operator/(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ inline B2DTuple operator*(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B2DTuple operator*(const B2DTuple& rTup, double t)
+ {
+ B2DTuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B2DTuple operator*(double t, const B2DTuple& rTup)
+ {
+ B2DTuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B2DTuple operator/(const B2DTuple& rTup, double t)
+ {
+ B2DTuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ /** Round double to nearest integer for 2D tuple
+
+ @return the nearest integer for this tuple
+ */
+ BASEGFX_DLLPUBLIC B2ITuple fround(const B2DTuple& rTup);
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b2i64tuple.hxx b/include/basegfx/tuple/b2i64tuple.hxx
new file mode 100644
index 000000000..70838572f
--- /dev/null
+++ b/include/basegfx/tuple/b2i64tuple.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/tuple/Tuple2D.hxx>
+
+namespace basegfx
+{
+ /** Base class for all Points/Vectors with two sal_Int64 values
+
+ This class provides all methods common to Point
+ and Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on two sal_Int64 values
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC B2I64Tuple : public Tuple2D<sal_Int64>
+ {
+ public:
+ /** Create a 2D Tuple
+
+ The tuple is initialized to (0, 0)
+ */
+ B2I64Tuple()
+ : Tuple2D(0, 0)
+ {}
+
+ /** Create a 2D Tuple
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Tuple.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Tuple.
+ */
+ B2I64Tuple(sal_Int64 nX, sal_Int64 nY)
+ : Tuple2D(nX, nY)
+ {}
+
+ /** Create a copy of a 2D Tuple
+
+ @param rTup
+ The 2D Tuple which will be copied.
+ */
+ B2I64Tuple(const B2I64Tuple& rTup)
+ : Tuple2D(rTup.mnX, rTup.mnY)
+ {}
+
+ // operators
+
+ B2I64Tuple operator-(void) const
+ {
+ return B2I64Tuple(-mnX, -mnY);
+ }
+
+ B2I64Tuple& operator=( const B2I64Tuple& rTup )
+ {
+ mnX = rTup.mnX;
+ mnY = rTup.mnY;
+ return *this;
+ }
+ };
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b2ituple.hxx b/include/basegfx/tuple/b2ituple.hxx
new file mode 100644
index 000000000..e3f195596
--- /dev/null
+++ b/include/basegfx/tuple/b2ituple.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/tuple/Tuple2D.hxx>
+
+namespace basegfx
+{
+ /** Base class for all Points/Vectors with two sal_Int32 values
+
+ This class provides all methods common to Point
+ and Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on two sal_Int32 values
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC B2ITuple : public Tuple2D<sal_Int32>
+ {
+ public:
+ /** Create a 2D Tuple
+
+ The tuple is initialized to (0, 0)
+ */
+ B2ITuple()
+ : Tuple2D(0, 0)
+ {}
+
+ /** Create a 2D Tuple
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Tuple.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Tuple.
+ */
+ B2ITuple(sal_Int32 nX, sal_Int32 nY)
+ : Tuple2D(nX, nY)
+ {}
+
+ // operators
+
+ B2ITuple operator-(void) const
+ {
+ return B2ITuple(-mnX, -mnY);
+ }
+ };
+
+ // external operators
+
+
+ inline B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB)
+ {
+ B2ITuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB)
+ {
+ B2ITuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup)
+ {
+ B2ITuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b3dtuple.hxx b/include/basegfx/tuple/b3dtuple.hxx
new file mode 100644
index 000000000..7ac6a774b
--- /dev/null
+++ b/include/basegfx/tuple/b3dtuple.hxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/tuple/Tuple3D.hxx>
+
+namespace basegfx
+{
+ class B3ITuple;
+
+ /** Base class for all Points/Vectors with three double values
+
+ This class provides all methods common to Point
+ and Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on three double values
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC B3DTuple : public Tuple3D<double>
+ {
+ public:
+ /** Create a 3D Tuple
+
+ The tuple is initialized to (0.0, 0.0, 0.0)
+ */
+ B3DTuple()
+ : Tuple3D(0.0, 0.0, 0.0)
+ {}
+
+ /** Create a 3D Tuple
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Tuple.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Tuple.
+
+ @param fZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Tuple.
+ */
+ B3DTuple(double fX, double fY, double fZ)
+ : Tuple3D(fX, fY, fZ)
+ {}
+
+ /// Array-access to 3D Tuple
+ const double& operator[] (int nPos) const
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both double members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mfX; if(1 == nPos) return mfY; return mfZ;
+ return *((&mfX) + nPos);
+ }
+
+ /// Array-access to 3D Tuple
+ double& operator[] (int nPos)
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both double members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mfX; if(1 == nPos) return mfY; return mfZ;
+ return *((&mfX) + nPos);
+ }
+
+ // comparators with tolerance
+
+
+ bool equalZero() const
+ {
+ return (this == &getEmptyTuple() ||
+ (::basegfx::fTools::equalZero(mfX)
+ && ::basegfx::fTools::equalZero(mfY)
+ && ::basegfx::fTools::equalZero(mfZ)));
+ }
+
+ bool equal(const B3DTuple& rTup) const
+ {
+ return (
+ this == &rTup ||
+ (::basegfx::fTools::equal(mfX, rTup.mfX) &&
+ ::basegfx::fTools::equal(mfY, rTup.mfY) &&
+ ::basegfx::fTools::equal(mfZ, rTup.mfZ)));
+ }
+
+ // operators
+
+ B3DTuple operator-(void) const
+ {
+ return B3DTuple(-mfX, -mfY, -mfZ);
+ }
+
+ bool operator==(const B3DTuple& rTup) const
+ {
+ return mfX == rTup.mfX && mfY == rTup.mfY && mfZ == rTup.mfZ;
+ }
+
+ bool operator!=(const B3DTuple& rTup) const { return !operator==(rTup); }
+
+ void correctValues(const double fCompareValue = 0.0)
+ {
+ if(0.0 == fCompareValue)
+ {
+ if(::basegfx::fTools::equalZero(mfX))
+ {
+ mfX = 0.0;
+ }
+
+ if(::basegfx::fTools::equalZero(mfY))
+ {
+ mfY = 0.0;
+ }
+
+ if(::basegfx::fTools::equalZero(mfZ))
+ {
+ mfZ = 0.0;
+ }
+ }
+ else
+ {
+ if(::basegfx::fTools::equal(mfX, fCompareValue))
+ {
+ mfX = fCompareValue;
+ }
+
+ if(::basegfx::fTools::equal(mfY, fCompareValue))
+ {
+ mfY = fCompareValue;
+ }
+
+ if(::basegfx::fTools::equal(mfZ, fCompareValue))
+ {
+ mfZ = fCompareValue;
+ }
+ }
+ }
+
+ static const B3DTuple& getEmptyTuple();
+ };
+
+ // external operators
+
+
+ inline B3DTuple interpolate(const B3DTuple& rOld1, const B3DTuple& rOld2, double t)
+ {
+ if(rOld1 == rOld2)
+ {
+ return rOld1;
+ }
+ else if(0.0 >= t)
+ {
+ return rOld1;
+ }
+ else if(1.0 <= t)
+ {
+ return rOld2;
+ }
+ else
+ {
+ return B3DTuple(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(),
+ ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ());
+ }
+ }
+
+ inline B3DTuple average(const B3DTuple& rOld1, const B3DTuple& rOld2)
+ {
+ return B3DTuple(
+ rtl_math_approxEqual(rOld1.getX(), rOld2.getX()) ? rOld1.getX() : (rOld1.getX() + rOld2.getX()) * 0.5,
+ rtl_math_approxEqual(rOld1.getY(), rOld2.getY()) ? rOld1.getY() : (rOld1.getY() + rOld2.getY()) * 0.5,
+ rtl_math_approxEqual(rOld1.getZ(), rOld2.getZ()) ? rOld1.getZ() : (rOld1.getZ() + rOld2.getZ()) * 0.5);
+ }
+
+ inline B3DTuple operator+(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B3DTuple operator-(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B3DTuple operator*(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B3DTuple operator*(const B3DTuple& rTup, double t)
+ {
+ B3DTuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3DTuple operator/(const B3DTuple& rTup, double t)
+ {
+ B3DTuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ /** Round double to nearest integer for 3D tuple
+
+ @return the nearest integer for this tuple
+ */
+ BASEGFX_DLLPUBLIC B3ITuple fround(const B3DTuple& rTup);
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b3ituple.hxx b/include/basegfx/tuple/b3ituple.hxx
new file mode 100644
index 000000000..72c9fa814
--- /dev/null
+++ b/include/basegfx/tuple/b3ituple.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/tuple/Tuple3D.hxx>
+
+namespace basegfx
+{
+ /** Base class for all Points/Vectors with three sal_Int32 values
+
+ This class provides all methods common to Point
+ and Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on three sal_Int32 values
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC B3ITuple : public Tuple3D<sal_Int32>
+ {
+ public:
+ /** Create a 3D Tuple
+
+ The tuple is initialized to (0, 0, 0)
+ */
+ B3ITuple()
+ : Tuple3D(0, 0, 0)
+ {}
+
+ /** Create a 3D Tuple
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Tuple.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Tuple.
+
+ @param nZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Tuple.
+ */
+ B3ITuple(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ)
+ : Tuple3D(nX, nY, nZ)
+ {}
+
+ /// Array-access to 3D Tuple
+ const sal_Int32& operator[] (int nPos) const
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both sal_Int32 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ;
+ return *((&mnX) + nPos);
+ }
+
+ /// Array-access to 3D Tuple
+ sal_Int32& operator[] (int nPos)
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both sal_Int32 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ;
+ return *((&mnX) + nPos);
+ }
+
+ // operators
+
+ B3ITuple operator-(void) const
+ {
+ return B3ITuple(-mnX, -mnY, -mnZ);
+ }
+ };
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/b2dclipstate.hxx b/include/basegfx/utils/b2dclipstate.hxx
new file mode 100644
index 000000000..f4d9d9e7d
--- /dev/null
+++ b/include/basegfx/utils/b2dclipstate.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
+}
+
+namespace basegfx::utils
+{
+ class ImplB2DClipState;
+
+ /** This class provides an optimized, symbolic clip state for graphical output
+
+ Having a current 'clip' state is a common attribute of
+ almost all graphic output APIs, most of which internally
+ represent it via a list of rectangular bands. In contrast,
+ this implementation purely uses symbolic clips, but in a
+ quite efficient manner, deferring actual evaluation until
+ a clip representation is requested, and using faster code
+ paths for common special cases (like all-rectangle clips)
+ */
+ class BASEGFX_DLLPUBLIC B2DClipState
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB2DClipState > ImplType;
+
+ private:
+ ImplType mpImpl;
+
+ public:
+ /// Init clip, in 'cleared' state - everything is visible
+ B2DClipState();
+ ~B2DClipState();
+ B2DClipState( const B2DClipState& );
+ B2DClipState( B2DClipState&& );
+ explicit B2DClipState( const B2DPolyPolygon& );
+ B2DClipState& operator=( const B2DClipState& );
+ B2DClipState& operator=( B2DClipState&& );
+
+ /// Set clip to 'null' - nothing is visible
+ void makeNull();
+
+ /// returns true when clip is 'cleared' - everything is visible
+ bool isCleared() const;
+
+ bool operator==(const B2DClipState&) const;
+ bool operator!=(const B2DClipState&) const;
+
+ void unionRange(const B2DRange& );
+ void unionPolyPolygon(const B2DPolyPolygon& );
+
+ void intersectRange(const B2DRange& );
+ void intersectPolyPolygon(const B2DPolyPolygon& );
+
+ void subtractRange(const B2DRange& );
+ void subtractPolyPolygon(const B2DPolyPolygon& );
+
+ void xorRange(const B2DRange& );
+ void xorPolyPolygon(const B2DPolyPolygon& );
+
+ void transform(const B2DHomMatrix& );
+
+ B2DPolyPolygon const & getClipPoly() const;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/canvastools.hxx b/include/basegfx/utils/canvastools.hxx
new file mode 100644
index 000000000..9b2f44dd3
--- /dev/null
+++ b/include/basegfx/utils/canvastools.hxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace com::sun::star::geometry
+{
+ struct AffineMatrix2D;
+ struct AffineMatrix3D;
+ struct RealPoint2D;
+ struct RealSize2D;
+ struct RealRectangle2D;
+ struct RealRectangle3D;
+ struct IntegerSize2D;
+ struct IntegerRectangle2D;
+ struct RealBezierSegment2D;
+}
+
+namespace com::sun::star::rendering
+{
+ class XGraphicDevice;
+ class XPolyPolygon2D;
+}
+
+namespace com::sun::star::awt
+{
+ struct Rectangle;
+}
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B3DHomMatrix;
+ class B2DVector;
+ class B2DPoint;
+ class B2DRange;
+ class B3DRange;
+ class B2IVector;
+ class B2IRange;
+ class B2DPolygon;
+ class B2DPolyPolygon;
+}
+
+namespace basegfx::unotools
+{
+ // Polygon conversions
+
+
+ BASEGFX_DLLPUBLIC css::uno::Reference< css::rendering::XPolyPolygon2D >
+ xPolyPolygonFromB2DPolygon( const css::uno::Reference< css::rendering::XGraphicDevice >& xGraphicDevice,
+ const ::basegfx::B2DPolygon& rPoly );
+
+ BASEGFX_DLLPUBLIC css::uno::Reference< css::rendering::XPolyPolygon2D >
+ xPolyPolygonFromB2DPolyPolygon( const css::uno::Reference< css::rendering::XGraphicDevice >& xGraphicDevice,
+ const ::basegfx::B2DPolyPolygon& rPolyPoly );
+
+
+ css::uno::Sequence<
+ css::uno::Sequence< css::geometry::RealBezierSegment2D > >
+ bezierSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly );
+
+ css::uno::Sequence<
+ css::uno::Sequence< css::geometry::RealPoint2D > >
+ pointSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly );
+
+ ::basegfx::B2DPolygon polygonFromPoint2DSequence(
+ const css::uno::Sequence< css::geometry::RealPoint2D >& rPoints );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon polyPolygonFromPoint2DSequenceSequence(
+ const css::uno::Sequence< css::uno::Sequence< css::geometry::RealPoint2D > >& rPoints );
+
+ ::basegfx::B2DPolygon polygonFromBezier2DSequence(
+ const css::uno::Sequence< css::geometry::RealBezierSegment2D >& rPoints );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon polyPolygonFromBezier2DSequenceSequence(
+ const css::uno::Sequence< css::uno::Sequence< css::geometry::RealBezierSegment2D > >& rPoints );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon b2DPolyPolygonFromXPolyPolygon2D(
+ const css::uno::Reference< css::rendering::XPolyPolygon2D >& rPoly );
+
+ // Matrix conversions
+
+
+ BASEGFX_DLLPUBLIC css::geometry::AffineMatrix2D&
+ affineMatrixFromHomMatrix( css::geometry::AffineMatrix2D& matrix,
+ const ::basegfx::B2DHomMatrix& transform);
+
+ css::geometry::AffineMatrix3D& affineMatrixFromHomMatrix3D(
+ css::geometry::AffineMatrix3D& matrix,
+ const ::basegfx::B3DHomMatrix& transform);
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& transform,
+ const css::geometry::AffineMatrix2D& matrix );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix homMatrixFromAffineMatrix3D( const css::geometry::AffineMatrix3D& matrix );
+
+ // Geometry conversions
+
+
+ BASEGFX_DLLPUBLIC css::geometry::RealSize2D size2DFromB2DSize( const ::basegfx::B2DVector& );
+ BASEGFX_DLLPUBLIC css::geometry::RealPoint2D point2DFromB2DPoint( const ::basegfx::B2DPoint& );
+ BASEGFX_DLLPUBLIC css::geometry::RealRectangle2D rectangle2DFromB2DRectangle( const ::basegfx::B2DRange& );
+ BASEGFX_DLLPUBLIC css::geometry::RealRectangle3D rectangle3DFromB3DRectangle( const ::basegfx::B3DRange& );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPoint b2DPointFromRealPoint2D( const css::geometry::RealPoint2D& );
+ BASEGFX_DLLPUBLIC ::basegfx::B2DRange b2DRectangleFromRealRectangle2D( const css::geometry::RealRectangle2D& );
+ ::basegfx::B3DRange b3DRectangleFromRealRectangle3D( const css::geometry::RealRectangle3D& );
+
+ BASEGFX_DLLPUBLIC css::geometry::IntegerSize2D integerSize2DFromB2ISize( const ::basegfx::B2IVector& );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2IVector b2ISizeFromIntegerSize2D( const css::geometry::IntegerSize2D& );
+ BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2IRectangleFromIntegerRectangle2D( const css::geometry::IntegerRectangle2D& );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2IRectangleFromAwtRectangle( const css::awt::Rectangle& );
+
+ // Geometry comparisons
+
+
+ /** Return smalltest integer range, which completely contains
+ given floating point range.
+
+ @param rRange
+ Input range. Values must be within the representable
+ bounds of sal_Int32
+
+ @return the closest integer range, which completely
+ contains rRange.
+ */
+ BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange& rRange );
+
+ /** Return smalltest B2DRange with integer values, which
+ completely contains given floating point range.
+
+ @param rRange
+ Input range.
+
+ @return the closest B2DRange with integer coordinates,
+ which completely contains rRange.
+ */
+ BASEGFX_DLLPUBLIC ::basegfx::B2DRange b2DSurroundingIntegerRangeFromB2DRange( const ::basegfx::B2DRange& rRange );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/common.hxx b/include/basegfx/utils/common.hxx
new file mode 100644
index 000000000..1c11a8bf2
--- /dev/null
+++ b/include/basegfx/utils/common.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+namespace basegfx
+{
+// The axis or dimension in a 2D coordinate system
+enum class Axis2D
+{
+ X,
+ Y
+};
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/gradienttools.hxx b/include/basegfx/utils/gradienttools.hxx
new file mode 100644
index 000000000..03892122b
--- /dev/null
+++ b/include/basegfx/utils/gradienttools.hxx
@@ -0,0 +1,399 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <utility>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx { class B2DRange; }
+
+namespace basegfx
+{
+ /** Gradient definition as used in ODF 1.2
+
+ This struct collects all data necessary for rendering ODF
+ 1.2-compatible gradients. Use the createXXXODFGradientInfo()
+ methods below for initializing from ODF attributes.
+ */
+ class UNLESS_MERGELIBS(BASEGFX_DLLPUBLIC) ODFGradientInfo
+ {
+ private:
+ /** transformation mapping from [0,1]^2 texture coordinate
+ space to [0,1]^2 shape coordinate space
+ */
+ B2DHomMatrix maTextureTransform;
+
+ /** transformation mapping from [0,1]^2 shape coordinate space
+ to [0,1]^2 texture coordinate space. This is the
+ transformation commonly used to create gradients from a
+ scanline rasterizer (put shape u/v coordinates into it, get
+ texture s/t coordinates out of it)
+ */
+ B2DHomMatrix maBackTextureTransform;
+
+ /** Aspect ratio of the gradient. Only used in drawinglayer
+ for generating nested gradient polygons currently. Already
+ catered for in the transformations above.
+ */
+ double mfAspectRatio;
+
+ /** Requested gradient steps to render. See the
+ implementations of the getXXXGradientAlpha() methods below,
+ the semantic differs slightly for the different gradient
+ types.
+ */
+ sal_uInt32 mnSteps;
+
+ public:
+ ODFGradientInfo()
+ : mfAspectRatio(1.0),
+ mnSteps(0)
+ {
+ }
+
+ ODFGradientInfo(
+ B2DHomMatrix aTextureTransform,
+ double fAspectRatio,
+ sal_uInt32 nSteps)
+ : maTextureTransform(std::move(aTextureTransform)),
+ mfAspectRatio(fAspectRatio),
+ mnSteps(nSteps)
+ {
+ }
+
+ ODFGradientInfo(const ODFGradientInfo& rODFGradientInfo)
+ : maTextureTransform(rODFGradientInfo.getTextureTransform()),
+ maBackTextureTransform(rODFGradientInfo.maBackTextureTransform),
+ mfAspectRatio(rODFGradientInfo.getAspectRatio()),
+ mnSteps(rODFGradientInfo.getSteps())
+ {
+ }
+
+ ODFGradientInfo& operator=(const ODFGradientInfo& rODFGradientInfo)
+ {
+ maTextureTransform = rODFGradientInfo.getTextureTransform();
+ maBackTextureTransform = rODFGradientInfo.maBackTextureTransform;
+ mfAspectRatio = rODFGradientInfo.getAspectRatio();
+ mnSteps = rODFGradientInfo.getSteps();
+
+ return *this;
+ }
+
+ // compare operator
+ bool operator==(const ODFGradientInfo& rGeoTexSvx) const;
+
+ const B2DHomMatrix& getTextureTransform() const { return maTextureTransform; }
+ const B2DHomMatrix& getBackTextureTransform() const;
+ double getAspectRatio() const { return mfAspectRatio; }
+ sal_uInt32 getSteps() const { return mnSteps; }
+
+ void setTextureTransform(const B2DHomMatrix& rNew)
+ {
+ maTextureTransform = rNew;
+ maBackTextureTransform.identity();
+ }
+ };
+
+ namespace utils
+ {
+ /** Create matrix for ODF's linear gradient definition
+
+ Note that odf linear gradients are varying in y direction.
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo createLinearODFGradientInfo(
+ const B2DRange& rTargetArea,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+
+ /** Calculate linear gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped. Assumes gradient color varies along the y axis.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ BASEGFX_DLLPUBLIC double getLinearGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo);
+
+ /** Create matrix for ODF's axial gradient definition
+
+ Note that odf axial gradients are varying in y
+ direction. Note further that you can map the axial
+ gradient to a linear gradient (in case you want or need to
+ avoid an extra gradient renderer), by using
+ createLinearODFGradientInfo() instead, shifting the
+ resulting texture transformation by 0.5 to the top and
+ appending the same stop colors again, but mirrored.
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo createAxialODFGradientInfo(
+ const B2DRange& rTargetArea,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+
+ /** Calculate axial gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped. Assumes gradient color varies along the y axis.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ BASEGFX_DLLPUBLIC double getAxialGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo);
+
+ /** Create matrix for ODF's radial gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo createRadialODFGradientInfo(
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder);
+
+
+ /** Calculate radial gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ BASEGFX_DLLPUBLIC double getRadialGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo);
+
+ /** Create matrix for ODF's elliptical gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo createEllipticalODFGradientInfo(
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+
+ /** Calculate elliptical gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ BASEGFX_DLLPUBLIC double getEllipticalGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo);
+
+ /** Create matrix for ODF's square gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo createSquareODFGradientInfo(
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+
+ /** Calculate square gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ BASEGFX_DLLPUBLIC double getSquareGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo);
+
+ /** Create matrix for ODF's rectangular gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo createRectangularODFGradientInfo(
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+
+ /** Calculate rectangular gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ BASEGFX_DLLPUBLIC double getRectangularGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/keystoplerp.hxx b/include/basegfx/utils/keystoplerp.hxx
new file mode 100644
index 000000000..f8a821e7a
--- /dev/null
+++ b/include/basegfx/utils/keystoplerp.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+namespace com::sun::star::uno {
+ template<typename T> class Sequence;
+}
+
+namespace basegfx::utils
+{
+ /** Lerp in a vector of key stops
+
+ This class holds a key stop vector and provides the
+ functionality to lerp inside it. Useful e.g. for
+ multi-stop gradients, or the SMIL key time activity.
+
+ For those, given a global [0,1] lerp alpha, one need to
+ find the suitable bucket index from key stop vector, and
+ then calculate the relative alpha between the two buckets
+ found.
+ */
+ class BASEGFX_DLLPUBLIC KeyStopLerp
+ {
+ public:
+ typedef std::pair<std::ptrdiff_t,double> ResultType;
+
+ /** Create lerper with given vector of stops
+
+ @param rKeyStops
+
+ Vector of stops, must contain at least two elements
+ (though preferably more, otherwise you probably don't
+ need key stop lerping in the first place). All
+ elements must be of monotonically increasing value.
+ */
+ explicit KeyStopLerp( std::vector<double>&& rKeyStops );
+
+ /** Create lerper with given sequence of stops
+
+ @param rKeyStops
+
+ Sequence of stops, must contain at least two elements
+ (though preferably more, otherwise you probably don't
+ need key stop lerping in the first place). All
+ elements must be of monotonically increasing value.
+ */
+ explicit KeyStopLerp( const css::uno::Sequence<double>& rKeyStops );
+
+ /** Find two nearest bucket index & interpolate
+
+ @param fAlpha
+ Find bucket index i, with keyStops[i] < fAlpha <=
+ keyStops[i+1]. Return new alpha value in [0,1),
+ proportional to fAlpha's position between keyStops[i]
+ and keyStops[i+1]
+ */
+ ResultType lerp(double fAlpha) const;
+
+ private:
+ std::vector<double> maKeyStops;
+ mutable std::ptrdiff_t mnLastIndex;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/lerp.hxx b/include/basegfx/utils/lerp.hxx
new file mode 100644
index 000000000..e02b3b0fa
--- /dev/null
+++ b/include/basegfx/utils/lerp.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+namespace basegfx::utils
+{
+ /** Generic linear interpolator
+
+ @tpl ValueType
+ Must have operator+ and operator* defined, and should
+ have value semantics.
+
+ @param t
+ As usual, t must be in the [0,1] range
+ */
+ template< typename ValueType > ValueType lerp( const ValueType& rFrom,
+ const ValueType& rTo,
+ double t )
+ {
+ // This is only to suppress a double->int warning. All other
+ // types should be okay here.
+ return static_cast<ValueType>( (1.0-t)*rFrom + t*rTo );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/rectcliptools.hxx b/include/basegfx/utils/rectcliptools.hxx
new file mode 100644
index 000000000..af6be75bf
--- /dev/null
+++ b/include/basegfx/utils/rectcliptools.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <basegfx/range/b2ibox.hxx>
+
+
+namespace basegfx::utils
+{
+ namespace RectClipFlags
+ {
+ const sal_uInt32 LEFT = sal_Int32(0x01);
+ const sal_uInt32 RIGHT = sal_Int32(0x02);
+ const sal_uInt32 TOP = sal_Int32(0x04);
+ const sal_uInt32 BOTTOM = sal_Int32(0x08);
+ }
+
+ /** Calc clip mask for Cohen-Sutherland rectangle clip
+
+ This function returns a clip mask used for the
+ Cohen-Sutherland rectangle clip method, where one or more
+ of the lower four bits are set, if the given point is
+ outside one or more of the four half planes defining the
+ rectangle (see RectClipFlags for possible values)
+ */
+ template< class Point, class Rect > inline
+ sal_uInt32 getCohenSutherlandClipFlags( const Point& rP,
+ const Rect& rR )
+ {
+ // maxY | minY | maxX | minX
+ sal_uInt32 clip;
+ clip = (rP.getX() < rR.getMinX()) << 0;
+ clip |= (rP.getX() > rR.getMaxX()) << 1;
+ clip |= (rP.getY() < rR.getMinY()) << 2;
+ clip |= (rP.getY() > rR.getMaxY()) << 3;
+ return clip;
+ }
+
+ /// Cohen-Sutherland mask calculation - overload for boxes.
+ template< class Point > inline
+ sal_uInt32 getCohenSutherlandClipFlags( const Point& rP,
+ const B2IBox& rB )
+ {
+ // maxY | minY | maxX | minX
+ sal_uInt32 clip;
+ clip = (rP.getX() < rB.getMinX()) << 0;
+ clip |= (rP.getX() >= rB.getMaxX()) << 1;
+ clip |= (rP.getY() < rB.getMinY()) << 2;
+ clip |= (rP.getY() >= rB.getMaxY()) << 3;
+ return clip;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/systemdependentdata.hxx b/include/basegfx/utils/systemdependentdata.hxx
new file mode 100644
index 000000000..6778fa967
--- /dev/null
+++ b/include/basegfx/utils/systemdependentdata.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+#include <memory>
+#include <map>
+
+namespace basegfx
+{
+ class SystemDependentData;
+ typedef std::shared_ptr<SystemDependentData> SystemDependentData_SharedPtr;
+ typedef std::weak_ptr<SystemDependentData> SystemDependentData_WeakPtr;
+
+ class BASEGFX_DLLPUBLIC SystemDependentDataManager
+ {
+ private:
+ // noncopyable
+ SystemDependentDataManager(const SystemDependentDataManager&) = delete;
+ SystemDependentDataManager& operator=(const SystemDependentDataManager&) = delete;
+
+ public:
+ SystemDependentDataManager();
+ virtual ~SystemDependentDataManager();
+
+ // call from (and with) SystemDependentData objects when start/end/touch
+ // usage is needed
+ virtual void startUsage(basegfx::SystemDependentData_SharedPtr& rData) = 0;
+ virtual void endUsage(basegfx::SystemDependentData_SharedPtr& rData) = 0;
+ virtual void touchUsage(basegfx::SystemDependentData_SharedPtr& rData) = 0;
+
+ // flush all buffered data (e.g. cleanup/shutdown)
+ virtual void flushAll() = 0;
+ };
+
+ class BASEGFX_DLLPUBLIC SystemDependentData
+ {
+ private:
+ // noncopyable
+ SystemDependentData(const SystemDependentData&) = delete;
+ SystemDependentData& operator=(const SystemDependentData&) = delete;
+
+ // reference to a SystemDependentDataManager, probably
+ // a single, globally used one, but not necessarily
+ SystemDependentDataManager& mrSystemDependentDataManager;
+
+ // Buffered CalculatedCycles, result of estimations using
+ // getHoldCyclesInSeconds and estimateUsageInBytes, executed
+ // using getHoldCyclesInSeconds. StartValue is 0 to detect
+ // not-yet-calculated state
+ sal_uInt32 mnCalculatedCycles;
+
+ public:
+ SystemDependentData(
+ SystemDependentDataManager& rSystemDependentDataManager);
+
+ // CAUTION! It is VERY important to keep this base class
+ // virtual, else typeid(class).hash_code() from derived classes
+ // will NOT work what is ESSENTIAL for the SystemDependentData
+ // mechanism to work properly. So DO NOT REMOVE virtual here, please.
+ virtual ~SystemDependentData();
+
+ // allow access to call startUsage/endUsage/touchUsage
+ // using getSystemDependentDataManager()
+ SystemDependentDataManager& getSystemDependentDataManager() { return mrSystemDependentDataManager; }
+
+ // Calculate HoldCyclesInSeconds based on using
+ // getHoldCyclesInSeconds and estimateUsageInBytes, the
+ // result is created once on-demand and buffered in
+ // mnCalculatedCycles
+ sal_uInt32 calculateCombinedHoldCyclesInSeconds() const;
+
+ // Size estimation of the entry in bytes - does not have to
+ // be used, but should be. Default returns zero what
+ // means there is no size estimation available. Override to
+ // offer useful data if you want to have better caching.
+ virtual sal_Int64 estimateUsageInBytes() const;
+ };
+
+ class BASEGFX_DLLPUBLIC SystemDependentDataHolder
+ {
+ private:
+ // Possibility to hold System-Dependent B2DPolygon-Representations
+ std::map< size_t, SystemDependentData_WeakPtr > maSystemDependentReferences;
+
+ // noncopyable
+ SystemDependentDataHolder(const SystemDependentDataHolder&) = delete;
+ SystemDependentDataHolder& operator=(const SystemDependentDataHolder&) = delete;
+
+ public:
+ SystemDependentDataHolder();
+ virtual ~SystemDependentDataHolder();
+
+ void addOrReplaceSystemDependentData(SystemDependentData_SharedPtr& rData);
+ SystemDependentData_SharedPtr getSystemDependentData(size_t hash_code) const;
+ };
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/tools.hxx b/include/basegfx/utils/tools.hxx
new file mode 100644
index 000000000..f8fc61999
--- /dev/null
+++ b/include/basegfx/utils/tools.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DPoint;
+ class B2DRange;
+ class B2DPolyPolygon;
+}
+
+namespace basegfx::utils
+{
+ /** Expand given parallelogram, such that it extends beyond
+ bound rect in a given direction.
+
+ This method is useful when e.g. generating one-dimensional
+ gradients, such as linear or axial gradients: those
+ gradients vary only in one direction, the other has
+ constant color. Most of the time, those gradients extends
+ infinitely in the direction with the constant color, but
+ practically, one always has a limiting bound rect into
+ which the gradient is painted. The method at hand now
+ extends a given parallelogram (e.g. the transformed
+ bounding box of a gradient) virtually into infinity to the
+ top and to the bottom (i.e. normal to the line io_rLeftTop
+ io_rRightTop), such that the given rectangle is guaranteed
+ to be covered in that direction.
+
+ @attention There might be some peculiarities with this
+ method, that might limit its usage to the described
+ gradients. One of them is the fact that when determining
+ how far the parallelogram has to be extended to the top or
+ the bottom, the upper and lower border are assumed to be
+ infinite lines.
+
+ @param io_rLeftTop
+ Left, top edge of the parallelogramm. Note that this need
+ not be the left, top edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param io_rLeftBottom
+ Left, bottom edge of the parallelogramm. Note that this need
+ not be the left, bottom edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param io_rRightTop
+ Right, top edge of the parallelogramm. Note that this need
+ not be the right, top edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param io_rRightBottom
+ Right, bottom edge of the parallelogramm. Note that this need
+ not be the right, bottom edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param rFitTarget
+ The rectangle to fit the parallelogram into.
+ */
+ BASEGFX_DLLPUBLIC void infiniteLineFromParallelogram( ::basegfx::B2DPoint& io_rLeftTop,
+ ::basegfx::B2DPoint& io_rLeftBottom,
+ ::basegfx::B2DPoint& io_rRightTop,
+ ::basegfx::B2DPoint& io_rRightBottom,
+ const ::basegfx::B2DRange& rFitTarget );
+
+ /** Creates polypolygon with the given number as seven-segment
+ digits
+
+ @param fVal
+ Value to convert
+
+ @param nTotalDigits
+ Total number of digits to display. If less is needed for
+ given number, fill space with blanks.
+
+ @param nDecPlaces
+ Decimal places to show. When 0, display as integer. When
+ negative, fill given number of before-the-decimal point
+ with zero.
+
+ @param bLitSegments
+ When true, return a polygon containing the segments that
+ are 'lit' for the given number. Return un-lit segments
+ otherwise.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon number2PolyPolygon(double fVal,
+ sal_Int32 nTotalDigits,
+ sal_Int32 nDecPlaces,
+ bool bLitSegments=true);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/unopolypolygon.hxx b/include/basegfx/utils/unopolypolygon.hxx
new file mode 100644
index 000000000..48788b074
--- /dev/null
+++ b/include/basegfx/utils/unopolypolygon.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <comphelper/compbase.hxx>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/FillRule.hpp>
+#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
+#include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+#include <o3tl/safeint.hxx>
+
+namespace basegfx::unotools
+{
+ typedef comphelper::WeakComponentImplHelper<
+ css::rendering::XLinePolyPolygon2D,
+ css::rendering::XBezierPolyPolygon2D,
+ css::lang::XServiceInfo > UnoPolyPolygonBase;
+
+ class BASEGFX_DLLPUBLIC UnoPolyPolygon
+ : public UnoPolyPolygonBase
+ {
+ public:
+ explicit UnoPolyPolygon( B2DPolyPolygon );
+
+ // XPolyPolygon2D
+ SAL_DLLPRIVATE virtual void SAL_CALL addPolyPolygon( const css::geometry::RealPoint2D& position, const css::uno::Reference< css::rendering::XPolyPolygon2D >& polyPolygon ) override;
+ SAL_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getNumberOfPolygons( ) override;
+ SAL_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getNumberOfPolygonPoints( ::sal_Int32 polygon ) override;
+ SAL_DLLPRIVATE virtual css::rendering::FillRule SAL_CALL getFillRule( ) override;
+ SAL_DLLPRIVATE virtual void SAL_CALL setFillRule( css::rendering::FillRule fillRule ) override;
+ SAL_DLLPRIVATE virtual sal_Bool SAL_CALL isClosed( ::sal_Int32 index ) override;
+ SAL_DLLPRIVATE virtual void SAL_CALL setClosed( ::sal_Int32 index, sal_Bool closedState ) override;
+
+ // XLinePolyPolygon2D
+ SAL_DLLPRIVATE virtual css::uno::Sequence< css::uno::Sequence< css::geometry::RealPoint2D > > SAL_CALL getPoints( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) override;
+ SAL_DLLPRIVATE virtual void SAL_CALL setPoints( const css::uno::Sequence< css::uno::Sequence< css::geometry::RealPoint2D > >& points, ::sal_Int32 nPolygonIndex ) override;
+ SAL_DLLPRIVATE virtual css::geometry::RealPoint2D SAL_CALL getPoint( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) override;
+ SAL_DLLPRIVATE virtual void SAL_CALL setPoint( const css::geometry::RealPoint2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) override;
+
+ // XBezierPolyPolygon2D
+ SAL_DLLPRIVATE virtual css::uno::Sequence< css::uno::Sequence< css::geometry::RealBezierSegment2D > > SAL_CALL getBezierSegments( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) override;
+ SAL_DLLPRIVATE virtual void SAL_CALL setBezierSegments( const css::uno::Sequence< css::uno::Sequence< css::geometry::RealBezierSegment2D > >& points, ::sal_Int32 nPolygonIndex ) override;
+ SAL_DLLPRIVATE virtual css::geometry::RealBezierSegment2D SAL_CALL getBezierSegment( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) override;
+ SAL_DLLPRIVATE virtual void SAL_CALL setBezierSegment( const css::geometry::RealBezierSegment2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) override;
+
+ // XServiceInfo
+ SAL_DLLPRIVATE virtual OUString SAL_CALL getImplementationName() override;
+ SAL_DLLPRIVATE virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ SAL_DLLPRIVATE virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ SAL_DLLPRIVATE B2DPolyPolygon getPolyPolygon() const;
+
+ protected:
+ /// Check whether index is a valid polygon index
+ void checkIndex( sal_Int32 nIndex ) const // throw (css::lang::IndexOutOfBoundsException);
+ {
+ if( nIndex < 0 || o3tl::make_unsigned(nIndex) >= maPolyPoly.count() )
+ throw css::lang::IndexOutOfBoundsException();
+ }
+
+ SAL_DLLPRIVATE B2DPolyPolygon getSubsetPolyPolygon( sal_Int32 nPolygonIndex,
+ sal_Int32 nNumberOfPolygons,
+ sal_Int32 nPointIndex,
+ sal_Int32 nNumberOfPoints ) const;
+
+ /// Get cow copy of internal polygon. not thread-safe outside this object.
+ const B2DPolyPolygon& getPolyPolygonUnsafe() const
+ {
+ return maPolyPoly;
+ }
+
+ /// Called whenever internal polypolygon gets modified
+ virtual void modifying() const {}
+
+ private:
+ UnoPolyPolygon(const UnoPolyPolygon&) = delete;
+ UnoPolyPolygon& operator=(const UnoPolyPolygon&) = delete;
+
+ B2DPolyPolygon maPolyPoly;
+ css::rendering::FillRule meFillRule;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/zoomtools.hxx b/include/basegfx/utils/zoomtools.hxx
new file mode 100644
index 000000000..242c10e6d
--- /dev/null
+++ b/include/basegfx/utils/zoomtools.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <basegfx/basegfxdllapi.h>
+#include <tools/long.hxx>
+
+namespace basegfx::zoomtools
+{
+/** This namespace provides functions for optimized geometric zooming
+*/
+BASEGFX_DLLPUBLIC tools::Long zoomOut(tools::Long nCurrent);
+BASEGFX_DLLPUBLIC tools::Long zoomIn(tools::Long nCurrent);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2dsize.hxx b/include/basegfx/vector/b2dsize.hxx
new file mode 100644
index 000000000..117912699
--- /dev/null
+++ b/include/basegfx/vector/b2dsize.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/vector/b2dvector.hxx>
+
+namespace basegfx
+{
+// syntactic sugar: a B2DVector exactly models a Size object,
+// thus, for interface clarity, we provide an alias name
+
+/// Alias name for interface clarity (not everybody is aware of the identity)
+typedef B2DVector B2DSize;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2dvector.hxx b/include/basegfx/vector/b2dvector.hxx
new file mode 100644
index 000000000..17a9c60b0
--- /dev/null
+++ b/include/basegfx/vector/b2dvector.hxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/vector/b2ivector.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+
+ /** Base Point class with two double values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2DTuple. All necessary extensions
+ which are special for 2D Vectors are added here.
+
+ @see B2DTuple
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC B2DVector : public ::basegfx::B2DTuple
+ {
+ public:
+ /** Create a 2D Vector
+
+ The vector is initialized to (0.0, 0.0)
+ */
+ B2DVector()
+ {}
+
+ /** Create a 2D Vector
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Vector.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Vector.
+ */
+ B2DVector(double fX, double fY)
+ : B2DTuple(fX, fY)
+ {}
+
+ /** Create a copy of a 2D Vector
+
+ @param rVec
+ The 2D Vector which will be copied.
+ */
+ explicit B2DVector(const ::basegfx::B2IVector& rVec)
+ : B2DTuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2DTuple-based classes
+ */
+ B2DVector(const ::basegfx::B2DTuple& rTuple)
+ : B2DTuple(rTuple)
+ {}
+
+ /** *=operator to allow usage from B2DVector, too
+ */
+ B2DVector& operator*=( const B2DVector& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2DVector, too
+ */
+ B2DVector& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2DTuple calculations
+ */
+ B2DVector& operator=( const ::basegfx::B2DTuple& rVec );
+
+ /** Calculate the length of this 2D Vector
+
+ @return The Length of the 2D Vector
+ */
+ double getLength() const;
+
+ /** Set the length of this 2D Vector
+
+ @param fLen
+ The to be achieved length of the 2D Vector
+ */
+ B2DVector& setLength(double fLen);
+
+ /** Normalize this 2D Vector
+
+ The length of the 2D Vector is set to 1.0
+ */
+ B2DVector& normalize();
+
+ /** Calculate the Scalar with another 2D Vector
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The Scalar value of the two involved 2D Vectors
+ */
+ double scalar( const B2DVector& rVec ) const { return((mfX * rVec.mfX) + (mfY * rVec.mfY)); }
+
+ /** Calculate the length of the cross product with another 2D Vector
+
+ In 2D, returning an actual vector does not make much
+ sense here. The magnitude, although, can be readily
+ used for tasks such as angle calculations, since for
+ the returned value, the following equation holds:
+ retVal = getLength(this)*getLength(rVec)*sin(theta),
+ with theta being the angle between the two vectors.
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The length of the cross product of the two involved 2D Vectors
+ */
+ double cross( const B2DVector& rVec ) const { return(mfX * rVec.getY() - mfY * rVec.getX()); }
+
+ /** Calculate the Angle with another 2D Vector
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The Angle value of the two involved 2D Vectors ranging from -pi to +pi
+ */
+ double angle( const B2DVector& rVec ) const;
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B2DVector& operator*=( const B2DHomMatrix& rMat );
+
+ static const B2DVector& getEmptyVector();
+ };
+
+ // external operators
+
+
+ /** Calculate the orientation to another 2D Vector
+
+ @param rVecA
+ The first 2D Vector
+
+ @param rVecB
+ The second 2D Vector
+
+ @return
+ The mathematical Orientation of the two involved 2D Vectors
+ */
+ BASEGFX_DLLPUBLIC B2VectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB );
+
+ /** Calculate a perpendicular 2D Vector to the given one
+
+ @param rVec
+ The source 2D Vector
+
+ @attention This only works if the given 2D Vector is normalized.
+
+ @return
+ A 2D Vector perpendicular to the one given in parameter rVec
+ */
+ BASEGFX_DLLPUBLIC B2DVector getPerpendicular( const B2DVector& rNormalizedVec );
+
+ /** Calculate a perpendicular 2D Vector to the given one,
+ normalize the given one as preparation
+
+ @param rVec
+ The source 2D Vector
+
+ @return
+ A normalized 2D Vector perpendicular to the one given in parameter rVec
+ */
+ BASEGFX_DLLPUBLIC B2DVector getNormalizedPerpendicular( const B2DVector& rVec );
+
+ /** Test two vectors which need not to be normalized for parallelism
+
+ @param rVecA
+ The first 2D Vector
+
+ @param rVecB
+ The second 2D Vector
+
+ @return
+ bool if the two values are parallel. Also true if
+ one of the vectors is empty.
+ */
+ BASEGFX_DLLPUBLIC bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB );
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ BASEGFX_DLLPUBLIC B2DVector operator*( const B2DHomMatrix& rMat, const B2DVector& rVec );
+
+ /** Test continuity between given vectors.
+
+ The two given vectors are assumed to describe control points on a
+ common point. Calculate if there is a continuity between them.
+ */
+ BASEGFX_DLLPUBLIC B2VectorContinuity getContinuity( const B2DVector& rBackVector, const B2DVector& rForwardVector );
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2enums.hxx b/include/basegfx/vector/b2enums.hxx
new file mode 100644
index 000000000..803902370
--- /dev/null
+++ b/include/basegfx/vector/b2enums.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+namespace basegfx
+{
+ /** Descriptor for the mathematical orientations of two 2D Vectors
+ */
+ enum class B2VectorOrientation
+ {
+ /// mathematically positive oriented
+ Positive = 0,
+
+ /// mathematically negative oriented
+ Negative,
+
+ /// mathematically neutral, thus parallel
+ Neutral
+ };
+
+ /** Descriptor for the mathematical continuity of two 2D Vectors
+ */
+ enum class B2VectorContinuity
+ {
+ /// none
+ NONE = 0,
+
+ /// mathematically negative oriented
+ C1,
+
+ /// mathematically neutral, thus parallel
+ C2
+ };
+
+ /** Descriptor for possible line joins between two line segments
+ */
+ enum class B2DLineJoin
+ {
+ NONE = 0, // no rounding
+ // removed unused Middle join type
+ Bevel = 2, // join edges with line
+ Miter = 3, // extend till cut
+ Round = 4 // create arc
+ };
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2isize.hxx b/include/basegfx/vector/b2isize.hxx
new file mode 100644
index 000000000..926910b48
--- /dev/null
+++ b/include/basegfx/vector/b2isize.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/vector/b2ivector.hxx>
+
+namespace basegfx
+{
+// syntactic sugar: a B2IVector exactly models a Size object,
+// thus, for interface clarity, we provide an alias name
+
+/// Alias name for interface clarity (not everybody is aware of the identity)
+typedef B2IVector B2ISize;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2ivector.hxx b/include/basegfx/vector/b2ivector.hxx
new file mode 100644
index 000000000..b542fe880
--- /dev/null
+++ b/include/basegfx/vector/b2ivector.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <ostream>
+
+#include <basegfx/tuple/b2ituple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+
+ /** Base Point class with two sal_Int32 values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2ITuple. All necessary extensions
+ which are special for 2D Vectors are added here.
+
+ @see B2ITuple
+ */
+ class BASEGFX_DLLPUBLIC B2IVector : public ::basegfx::B2ITuple
+ {
+ public:
+ /** Create a 2D Vector
+
+ The vector is initialized to (0, 0)
+ */
+ B2IVector()
+ {}
+
+ /** Create a 2D Vector
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Vector.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Vector.
+ */
+ B2IVector(sal_Int32 nX, sal_Int32 nY)
+ : B2ITuple(nX, nY)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2ITuple-based classes
+ */
+ B2IVector(const ::basegfx::B2ITuple& rTuple)
+ : B2ITuple(rTuple)
+ {}
+
+ /** *=operator to allow usage from B2IVector, too
+ */
+ B2IVector& operator*=( const B2IVector& rPnt )
+ {
+ mnX *= rPnt.mnX;
+ mnY *= rPnt.mnY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2IVector, too
+ */
+ B2IVector& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2ITuple calculations
+ */
+ B2IVector& operator=( const ::basegfx::B2ITuple& rVec );
+
+ /** Set the length of this 2D Vector
+
+ @param fLen
+ The to be achieved length of the 2D Vector
+ */
+ B2IVector& setLength(double fLen);
+
+ /** Calculate the Scalar with another 2D Vector
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The Scalar value of the two involved 2D Vectors
+ */
+ double scalar( const B2IVector& rVec ) const { return((mnX * rVec.mnX) + (mnY * rVec.mnY)); }
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B2IVector& operator*=( const B2DHomMatrix& rMat );
+ };
+
+ // external operators
+
+ template< typename charT, typename traits >
+ inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const basegfx::B2IVector& vector )
+ {
+ return stream << "(" << vector.getX() << "," << vector.getY() << ")";
+ }
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b3dvector.hxx b/include/basegfx/vector/b3dvector.hxx
new file mode 100644
index 000000000..399bba3ed
--- /dev/null
+++ b/include/basegfx/vector/b3dvector.hxx
@@ -0,0 +1,258 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B3DHomMatrix;
+
+ /** Base Point class with three double values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3DTuple. All necessary extensions
+ which are special for 3D Vectors are added here.
+
+ @see B3DTuple
+ */
+ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC B3DVector : public ::basegfx::B3DTuple
+ {
+ public:
+ /** Create a 3D Vector
+
+ The vector is initialized to (0.0, 0.0, 0.0)
+ */
+ B3DVector()
+ {}
+
+ /** Create a 3D Vector
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Vector.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Vector.
+
+ @param fZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Vector.
+ */
+ B3DVector(double fX, double fY, double fZ)
+ : B3DTuple(fX, fY, fZ)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3DTuple-based classes
+ */
+ B3DVector(const ::basegfx::B3DTuple& rTuple)
+ : B3DTuple(rTuple)
+ {}
+
+ /** *=operator to allow usage from B3DVector, too
+ */
+ B3DVector& operator*=( const B3DVector& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ mfZ *= rPnt.mfZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B3DVector, too
+ */
+ B3DVector& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3DTuple calculations
+ */
+ B3DVector& operator=( const ::basegfx::B3DTuple& rVec )
+ {
+ mfX = rVec.getX();
+ mfY = rVec.getY();
+ mfZ = rVec.getZ();
+ return *this;
+ }
+
+ /** Calculate the length of this 3D Vector
+
+ @return The Length of the 3D Vector
+ */
+ double getLength() const
+ {
+ double fLen(scalar(*this));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the XZ-Plane for this 3D Vector
+
+ @return The XZ-Plane Length of the 3D Vector
+ */
+ double getXZLength() const
+ {
+ double fLen((mfX * mfX) + (mfZ * mfZ)); // #i73040#
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the YZ-Plane for this 3D Vector
+
+ @return The YZ-Plane Length of the 3D Vector
+ */
+ double getYZLength() const
+ {
+ double fLen((mfY * mfY) + (mfZ * mfZ));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Set the length of this 3D Vector
+
+ @param fLen
+ The to be achieved length of the 3D Vector
+ */
+ B3DVector& setLength(double fLen)
+ {
+ double fLenNow(scalar(*this));
+
+ if(!::basegfx::fTools::equalZero(fLenNow))
+ {
+ const double fOne(1.0);
+
+ if(!::basegfx::fTools::equal(fOne, fLenNow))
+ {
+ fLen /= sqrt(fLenNow);
+ }
+
+ mfX *= fLen;
+ mfY *= fLen;
+ mfZ *= fLen;
+ }
+
+ return *this;
+ }
+
+ /** Normalize this 3D Vector
+
+ The length of the 3D Vector is set to 1.0
+ */
+ B3DVector& normalize();
+
+ /** get a 3D Vector which is perpendicular to this and a given 3D Vector
+
+ @attention This only works if this and the given 3D Vector are
+ both normalized.
+
+ @param rNormalizedVec
+ A normalized 3D Vector.
+
+ @return
+ A 3D Vector perpendicular to this and the given one
+ */
+ B3DVector getPerpendicular(const B3DVector& rNormalizedVec) const;
+
+ /** Calculate the Scalar product
+
+ This method calculates the Scalar product between this
+ and the given 3D Vector.
+
+ @param rVec
+ A second 3D Vector.
+
+ @return
+ The Scalar Product of two 3D Vectors
+ */
+ double scalar(const B3DVector& rVec) const
+ {
+ return ((mfX * rVec.mfX) + (mfY * rVec.mfY) + (mfZ * rVec.mfZ));
+ }
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B3DVector& operator*=( const B3DHomMatrix& rMat );
+
+ static const B3DVector& getEmptyVector()
+ {
+ return static_cast<const B3DVector&>( ::basegfx::B3DTuple::getEmptyTuple() );
+ }
+ };
+
+ // external operators
+
+
+ /** Test two vectors which need not to be normalized for parallelism
+
+ @param rVecA
+ The first 3D Vector
+
+ @param rVecB
+ The second 3D Vector
+
+ @return
+ bool if the two values are parallel. Also true if
+ one of the vectors is empty.
+ */
+ BASEGFX_DLLPUBLIC bool areParallel( const B3DVector& rVecA, const B3DVector& rVecB );
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ BASEGFX_DLLPUBLIC B3DVector operator*( const B3DHomMatrix& rMat, const B3DVector& rVec );
+
+ /** Calculate the Cross Product of two 3D Vectors
+
+ @param rVecA
+ A first 3D Vector.
+
+ @param rVecB
+ A second 3D Vector.
+
+ @return
+ The Cross Product of both 3D Vectors
+ */
+ inline B3DVector cross(const B3DVector& rVecA, const B3DVector& rVecB)
+ {
+ B3DVector aVec(
+ rVecA.getY() * rVecB.getZ() - rVecA.getZ() * rVecB.getY(),
+ rVecA.getZ() * rVecB.getX() - rVecA.getX() * rVecB.getZ(),
+ rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX());
+ return aVec;
+ }
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basicdllapi.h b/include/basic/basicdllapi.h
new file mode 100644
index 000000000..90b1f7861
--- /dev/null
+++ b/include/basic/basicdllapi.h
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_BASIC_BASICDLLAPI_H
+#define INCLUDED_BASIC_BASICDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(BASIC_DLLIMPLEMENTATION)
+#define BASIC_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define BASIC_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define BASIC_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_BASIC_BASICDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basicmanagerrepository.hxx b/include/basic/basicmanagerrepository.hxx
new file mode 100644
index 000000000..e9e906685
--- /dev/null
+++ b/include/basic/basicmanagerrepository.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_BASICMANAGERREPOSITORY_HXX
+#define INCLUDED_BASIC_BASICMANAGERREPOSITORY_HXX
+
+#include <basic/basicdllapi.h>
+
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+class BasicManager;
+
+
+namespace basic
+{
+
+
+ //= BasicManagerRepository
+
+ /** specifies a callback for instances which are interested in BasicManagers
+ created by the BasicManagerRepository.
+ */
+ class BASIC_DLLPUBLIC SAL_NO_VTABLE BasicManagerCreationListener
+ {
+ public:
+ /** is called when a BasicManager has been created
+
+ @param _rxForDocument
+ denotes the document for which the BasicManager has been created. If this is <NULL/>,
+ then the BasicManager is the application-wide BasicManager.
+
+ @param _pBasicManager
+ denotes the BasicManager which has been created. The listener might for instance
+ decide to add global variables to it, or otherwise initialize it.
+ */
+ virtual void onBasicManagerCreated(
+ const css::uno::Reference< css::frame::XModel >& _rxForDocument,
+ BasicManager& _rBasicManager
+ ) = 0;
+
+ protected:
+ ~BasicManagerCreationListener() {}
+ };
+
+
+ //= BasicManagerRepository
+
+ class BASIC_DLLPUBLIC BasicManagerRepository
+ {
+ public:
+ /** returns the BasicManager belonging to the given document
+
+ If the BasicManager does not yet exist, it is created. In this case, if the application's
+ BasicManager does not yet exist, it is also created. This is necessary since
+ the application's BasicManager acts as parent for all document's BasicManagers.
+
+ If you're interested in this case - the implicit creation of the application's BasicManager -,
+ then you need to register as BasicManagerCreationListener.
+
+ @param _rxDocumentModel
+ denotes the document model whose BasicManager is to be retrieved. Must not be <NULL/>.
+ The document should support the XDocumentPropertiesSupplier
+ interface, for retrieving
+ its title, which is needed in some error conditions.
+ Also it <em>must</em> support the XStorageBasedDocument interface, since we
+ must be able to retrieve the document's storage. If this interface is <em>not</em>
+ supported, creating a new BasicManager will certainly fail.
+
+ @return
+ the BasicManager for this model.
+
+ @attention
+ The returned BasicManager instances is owned by the repository. In particular,
+ you are not allowed to delete it. Instead, the given model is observed: As soon
+ as it's closed, the associated BasicManager is deleted.
+ */
+ static BasicManager* getDocumentBasicManager(
+ const css::uno::Reference< css::frame::XModel >& _rxDocumentModel
+ );
+
+ /** returns the application-wide BasicManager
+
+ @attention
+ If the BasicManager is newly created, then it is still owned by the repository.
+ In particular, you are not allowed to delete it. Instead, call resetApplicationBasicManager
+ to release the BasicManager.
+ */
+ static BasicManager* getApplicationBasicManager();
+
+ /** resets the application-wide BasicManager to <NULL/>
+ */
+ static void resetApplicationBasicManager();
+
+ /** registers a BasicManagerCreationListener instance which is notified whenever
+ the repository creates a BasicManager instance.
+
+ Note that this listener is <em>not</em> called when somebody else
+ creates BasicManager instances.
+
+ If the same listener is registered multiple times, it is also notified
+ multiple times, and needs to be revoked once for each registration.
+ */
+ static void registerCreationListener(
+ BasicManagerCreationListener& _rListener
+ );
+
+ /** revokes a BasicManagerCreationListener instance which has previously
+ been registered to be notified about created BasicManager instances.
+ */
+ static void revokeCreationListener(
+ BasicManagerCreationListener& _rListener
+ );
+ };
+
+
+} // namespace basic
+
+
+#endif // INCLUDED_BASIC_BASICMANAGERREPOSITORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx
new file mode 100644
index 000000000..166b62489
--- /dev/null
+++ b/include/basic/basmgr.hxx
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_BASIC_BASMGR_HXX
+#define INCLUDED_BASIC_BASMGR_HXX
+
+#include <utility>
+#include <vcl/errcode.hxx>
+#include <svl/SfxBroadcaster.hxx>
+#include <basic/sbstar.hxx>
+#include <basic/basicdllapi.h>
+#include <memory>
+#include <string_view>
+#include <vector>
+
+namespace com::sun::star::script { class XLibraryContainer; }
+namespace com::sun::star::script { class XPersistentLibraryContainer; }
+namespace com::sun::star::script { class XStarBasicAccess; }
+
+class BasicManager;
+
+// Basic XML Import/Export
+BASIC_DLLPUBLIC css::uno::Reference< css::script::XStarBasicAccess >
+ getStarBasicAccess( BasicManager* pMgr );
+
+class SotStorage;
+
+enum class BasicErrorReason
+{
+ OPENLIBSTORAGE = 0x0002,
+ OPENMGRSTREAM = 0x0004,
+ OPENLIBSTREAM = 0x0008,
+ LIBNOTFOUND = 0x0010,
+ STORAGENOTFOUND = 0x0020,
+ BASICLOADERROR = 0x0040,
+ STDLIB = 0x0100
+};
+
+class BasicError
+{
+private:
+ ErrCode nErrorId;
+ BasicErrorReason nReason;
+
+public:
+ BasicError( const BasicError& rErr );
+ BasicError( ErrCode nId, BasicErrorReason nR );
+
+ ErrCode const & GetErrorId() const { return nErrorId; }
+};
+
+class BasicLibInfo;
+
+namespace basic { class ImplRepository; }
+
+// Library password handling for 5.0 documents
+class BASIC_DLLPUBLIC OldBasicPassword
+{
+public:
+ virtual void setLibraryPassword( const OUString& rLibraryName, const OUString& rPassword ) = 0;
+
+protected:
+ ~OldBasicPassword() {}
+};
+
+struct LibraryContainerInfo
+{
+ css::uno::Reference< css::script::XPersistentLibraryContainer > mxScriptCont;
+ css::uno::Reference< css::script::XPersistentLibraryContainer > mxDialogCont;
+ OldBasicPassword* mpOldBasicPassword;
+
+ LibraryContainerInfo()
+ :mpOldBasicPassword( nullptr )
+ {
+ }
+
+ LibraryContainerInfo
+ (
+ css::uno::Reference< css::script::XPersistentLibraryContainer > xScriptCont,
+ css::uno::Reference< css::script::XPersistentLibraryContainer > xDialogCont,
+ OldBasicPassword* pOldBasicPassword
+ )
+ : mxScriptCont(std::move( xScriptCont ))
+ , mxDialogCont(std::move( xDialogCont ))
+ , mpOldBasicPassword( pOldBasicPassword )
+ {}
+};
+
+#define LIB_NOTFOUND 0xFFFF
+
+class UNLESS_MERGELIBS(BASIC_DLLPUBLIC) BasicManager final : public SfxBroadcaster
+{
+ friend class LibraryContainer_Impl;
+ friend class StarBasicAccess_Impl;
+ friend class BasMgrContainerListenerImpl;
+ friend class ::basic::ImplRepository;
+
+private:
+ std::vector<BasicError> aErrors;
+
+ OUString aName;
+ OUString maStorageName;
+ bool mbDocMgr;
+
+ LibraryContainerInfo maContainerInfo;
+ std::vector<std::unique_ptr<BasicLibInfo>> maLibs;
+ OUString aBasicLibPath;
+
+ bool ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage );
+ void ImpCreateStdLib( StarBASIC* pParentFromStdLib );
+ void ImpMgrNotLoaded( const OUString& rStorageName );
+ BasicLibInfo* CreateLibInfo();
+ void LoadBasicManager( SotStorage& rStorage, std::u16string_view rBaseURL );
+ void LoadOldBasicManager( SotStorage& rStorage );
+ bool ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const;
+ static bool ImplEncryptStream( SvStream& rStream );
+ BasicLibInfo* FindLibInfo( StarBASIC const * pBasic );
+ static void CheckModules( StarBASIC* pBasic, bool bReference );
+
+public:
+ BasicManager( SotStorage& rStorage, std::u16string_view rBaseURL, StarBASIC* pParentFromStdLib = nullptr, OUString const * pLibPath = nullptr, bool bDocMgr = false );
+ BasicManager( StarBASIC* pStdLib, OUString const * pLibPath = nullptr, bool bDocMgr = false );
+
+ virtual ~BasicManager() override;
+
+ void SetStorageName( const OUString& rName ) { maStorageName = rName; }
+ const OUString& GetStorageName() const { return maStorageName; }
+ void SetName( const OUString& rName ) { aName = rName; }
+ const OUString& GetName() const { return aName; }
+
+
+ IF_MERGELIBS(BASIC_DLLPUBLIC) sal_uInt16 GetLibCount() const;
+ IF_MERGELIBS(BASIC_DLLPUBLIC) StarBASIC* GetLib( sal_uInt16 nLib ) const;
+ IF_MERGELIBS(BASIC_DLLPUBLIC) StarBASIC* GetLib( std::u16string_view rName ) const;
+ sal_uInt16 GetLibId( std::u16string_view rName ) const;
+
+ OUString GetLibName( sal_uInt16 nLib );
+
+ /** announces the library containers which belong to this BasicManager
+
+ The method will automatically add two global constants, BasicLibraries and DialogLibraries,
+ to the BasicManager.
+ */
+ void SetLibraryContainerInfo( const LibraryContainerInfo& rInfo );
+
+ const css::uno::Reference< css::script::XPersistentLibraryContainer >&
+ GetDialogLibraryContainer() const;
+ const css::uno::Reference< css::script::XPersistentLibraryContainer >&
+ GetScriptLibraryContainer() const;
+
+ bool LoadLib( sal_uInt16 nLib );
+ IF_MERGELIBS(BASIC_DLLPUBLIC)
+ bool RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage );
+
+ // Modify-Flag will be reset only during save.
+ bool IsBasicModified() const;
+
+ std::vector<BasicError>& GetErrors() { return aErrors;}
+
+ /** sets a global constant in the basic library, referring to some UNO object, to a new value.
+
+ If a constant with this name already existed before, its value is changed, and the old constant is
+ returned in pOldValue. If it does not yet exist, it is newly created, and inserted into the basic library.
+ */
+ IF_MERGELIBS(BASIC_DLLPUBLIC)
+ void SetGlobalUNOConstant( const OUString& rName, const css::uno::Any& _rValue, css::uno::Any* pOldValue = nullptr );
+
+ /** retrieves a global constant in the basic library, referring to some UNO object, returns true if a value is found ( value is in aOut ) false otherwise. */
+ IF_MERGELIBS(BASIC_DLLPUBLIC)
+ bool GetGlobalUNOConstant( const OUString& rName, css::uno::Any& aOut );
+ /** determines whether there are password-protected modules whose size exceeds the
+ legacy module size
+ @param _out_rModuleNames
+ takes the names of modules whose size exceeds the legacy limit
+ */
+ bool LegacyPsswdBinaryLimitExceeded( std::vector< OUString >& _out_rModuleNames );
+ bool HasExeCode( std::u16string_view );
+ /// determines whether the Basic Manager has a given macro, given by fully qualified name
+ IF_MERGELIBS(BASIC_DLLPUBLIC)
+ bool HasMacro( OUString const& i_fullyQualifiedName ) const;
+ /// executes a given macro
+ ErrCode ExecuteMacro( OUString const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue );
+ /// executes a given macro
+ ErrCode ExecuteMacro( OUString const& i_fullyQualifiedName, std::u16string_view i_commaSeparatedArgs, SbxValue* i_retValue );
+
+private:
+ BASIC_DLLPRIVATE bool IsReference( sal_uInt16 nLib );
+
+ BASIC_DLLPRIVATE StarBASIC* GetStdLib() const;
+ BASIC_DLLPRIVATE StarBASIC* AddLib( SotStorage& rStorage, const OUString& rLibName, bool bReference );
+ BASIC_DLLPRIVATE void RemoveLib( sal_uInt16 nLib );
+ BASIC_DLLPRIVATE bool HasLib( std::u16string_view rName ) const;
+
+ BASIC_DLLPRIVATE StarBASIC* CreateLibForLibContainer( const OUString& rLibName,
+ const css::uno::Reference< css::script::XLibraryContainer >& xScriptCont );
+ // For XML import/export:
+ BASIC_DLLPRIVATE StarBASIC* CreateLib( const OUString& rLibName );
+ BASIC_DLLPRIVATE StarBASIC* CreateLib( const OUString& rLibName, const OUString& Password,
+ const OUString& LinkTargetURL );
+ BasicManager& operator=(BasicManager const &) = delete; //MSVC2015 workaround
+ BasicManager( BasicManager const&) = delete; //MSVC2015 workaround
+};
+
+#endif // INCLUDED_BASIC_BASMGR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basrdll.hxx b/include/basic/basrdll.hxx
new file mode 100644
index 000000000..2748bf3fd
--- /dev/null
+++ b/include/basic/basrdll.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_BASRDLL_HXX
+#define INCLUDED_BASIC_BASRDLL_HXX
+
+#include <basic/basicdllapi.h>
+#include <tools/ref.hxx>
+
+class BASIC_DLLPUBLIC BasicDLL
+{
+private:
+ tools::SvRef<SvRefBase> m_xImpl;
+
+public:
+ BasicDLL();
+ ~BasicDLL();
+
+ static void BasicBreak();
+
+ static void EnableBreak(bool bEnable);
+ static void SetDebugMode(bool bDebugMode);
+};
+
+#endif // INCLUDED_BASIC_BASRDLL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/codecompletecache.hxx b/include/basic/codecompletecache.hxx
new file mode 100644
index 000000000..2c6c0873f
--- /dev/null
+++ b/include/basic/codecompletecache.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_CODECOMPLETECACHE_HXX
+#define INCLUDED_BASIC_CODECOMPLETECACHE_HXX
+
+#include <config_options.h>
+#include <basic/basicdllapi.h>
+#include <rtl/ustring.hxx>
+#include <unordered_map>
+
+typedef std::unordered_map< OUString, OUString > CodeCompleteVarTypes;
+/* variable name, type */
+typedef std::unordered_map< OUString, CodeCompleteVarTypes > CodeCompleteVarScopes;
+/* procedure, CodeCompleteVarTypes */
+
+class BASIC_DLLPUBLIC CodeCompleteOptions
+{
+/*
+ * class to store basic code completion
+ * options
+ * */
+private:
+ bool bIsCodeCompleteOn;
+ bool bIsProcedureAutoCompleteOn;
+ bool bIsAutoCloseQuotesOn;
+ bool bIsAutoCloseParenthesisOn;
+ bool bIsAutoCorrectOn;
+ bool bExtendedTypeDeclarationOn;
+
+public:
+ CodeCompleteOptions();
+
+ static bool IsCodeCompleteOn();
+ static void SetCodeCompleteOn( bool b );
+
+ static bool IsExtendedTypeDeclaration();
+ static void SetExtendedTypeDeclaration( bool b );
+
+ static bool IsProcedureAutoCompleteOn();
+ static void SetProcedureAutoCompleteOn( bool b );
+
+ static bool IsAutoCloseQuotesOn();
+ static void SetAutoCloseQuotesOn( bool b );
+
+ static bool IsAutoCloseParenthesisOn();
+ static void SetAutoCloseParenthesisOn( bool b );
+
+ static bool IsAutoCorrectOn();
+ static void SetAutoCorrectOn( bool b );
+};
+
+class UNLESS_MERGELIBS(BASIC_DLLPUBLIC) CodeCompleteDataCache final
+{
+/*
+ * cache to store data for
+ * code completion
+ * */
+private:
+ CodeCompleteVarScopes aVarScopes;
+ CodeCompleteVarTypes aGlobalVars;
+
+public:
+ CodeCompleteDataCache(){}
+
+ friend BASIC_DLLPUBLIC std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache);
+
+ void InsertGlobalVar( const OUString& sVarName, const OUString& sVarType );
+ void InsertLocalVar( const OUString& sProcName, const OUString& sVarName, const OUString& sVarType );
+ OUString GetVarType( std::u16string_view sVarName ) const;
+ OUString GetCorrectCaseVarName( std::u16string_view sVarName, std::u16string_view sActProcName ) const;
+ void Clear();
+};
+
+#endif // INCLUDED_BASIC_CODECOMPLETECACHE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/modsizeexceeded.hxx b/include/basic/modsizeexceeded.hxx
new file mode 100644
index 000000000..8910be30b
--- /dev/null
+++ b/include/basic/modsizeexceeded.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_MODSIZEEXCEEDED_HXX
+#define INCLUDED_BASIC_MODSIZEEXCEEDED_HXX
+
+#include <config_options.h>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <basic/basicdllapi.h>
+#include <vector>
+
+namespace com::sun::star::task { class XInteractionContinuation; }
+
+#if defined(_MSC_VER) && !defined(__clang__)
+// MSVC automatically applies dllexport to template instantiations if they are a base class
+// of a dllexport class, and this template instantiation is a case of that. If we don't
+// dllimport here, MSVC will complain about duplicate symbols in a mergelibs build.
+template class __declspec(dllimport) cppu::WeakImplHelper< css::task::XInteractionRequest >;
+#endif
+
+class UNLESS_MERGELIBS(BASIC_DLLPUBLIC) ModuleSizeExceeded final : public cppu::WeakImplHelper< css::task::XInteractionRequest >
+{
+// C++ interface
+public:
+ ModuleSizeExceeded( const std::vector<OUString>& sModules );
+
+ bool isAbort() const;
+ bool isApprove() const;
+
+// UNO interface
+public:
+ virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL getContinuations() override { return m_lContinuations; }
+ css::uno::Any SAL_CALL getRequest() override
+ {
+ return m_aRequest;
+ }
+
+// member
+private:
+ css::uno::Any m_aRequest;
+ css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > m_lContinuations;
+ css::uno::Reference< css::task::XInteractionContinuation > m_xAbort;
+ css::uno::Reference< css::task::XInteractionContinuation> m_xApprove;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbdef.hxx b/include/basic/sbdef.hxx
new file mode 100644
index 000000000..d864ed8de
--- /dev/null
+++ b/include/basic/sbdef.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_SBDEF_HXX
+#define INCLUDED_BASIC_SBDEF_HXX
+
+#include <basic/sbxdef.hxx>
+#include <rtl/ustring.hxx>
+#include <basic/basicdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <unotools/resmgr.hxx>
+
+class ErrCode;
+
+// Returns type name for Basic type, array flag is ignored
+// implementation: basic/source/runtime/methods.cxx
+BASIC_DLLPUBLIC OUString getBasicTypeName( SbxDataType eType );
+
+// Returns type name for Basic objects, especially
+// important for SbUnoObj instances
+// implementation: basic/source/classes/sbunoobj.cxx
+class SbxObject;
+BASIC_DLLPUBLIC OUString getBasicObjectTypeName( SbxObject* pObj );
+
+// Allows Basic IDE to set watch mode to suppress errors
+// implementation: basic/source/runtime/runtime.cxx
+BASIC_DLLPUBLIC void setBasicWatchMode( bool bOn );
+
+// Debug Flags:
+enum class BasicDebugFlags {
+ NONE = 0x0000,
+ Break = 0x0001, // Break-Callback
+ StepInto = 0x0002, // Single Step-Callback
+ StepOver = 0x0004, // Additional flag Step Over
+ Continue = 0x0008, // Do not change flags
+ StepOut = 0x0010, // Leave Sub
+};
+namespace o3tl {
+ template<> struct typed_flags<BasicDebugFlags> : is_typed_flags<BasicDebugFlags, 0x001f> {};
+}
+
+#define SBXID_BASIC 0x6273 // sb: StarBASIC
+#define SBXID_BASICMOD 0x6d62 // bm: StarBASIC Module
+#define SBXID_BASICPROP 0x7262 // pr: StarBASIC Property
+#define SBXID_BASICMETHOD 0x6d65 // me: StarBASIC Method
+#define SBXID_JSCRIPTMOD 0x6a62 // jm: JavaScript Module
+#define SBXID_JSCRIPTMETH 0x6a64 // jm: JavaScript Module
+
+enum class PropertyMode
+{
+ NONE,
+ Get,
+ Let,
+ Set
+};
+
+BASIC_DLLPUBLIC extern std::pair<TranslateId, ErrCode> const RID_BASIC_START[];
+BASIC_DLLPUBLIC std::locale BasResLocale();
+OUString BasResId(TranslateId pId);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sberrors.hxx b/include/basic/sberrors.hxx
new file mode 100644
index 000000000..5976df8b9
--- /dev/null
+++ b/include/basic/sberrors.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_SBERRORS_HXX
+#define INCLUDED_BASIC_SBERRORS_HXX
+
+#include <vcl/errcode.hxx>
+
+#define ERRCODE_BASIC_SYNTAX ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 1) // unspecified syntax error
+#define ERRCODE_BASIC_BAD_ARGUMENT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::NotSupported, 2) // Invalid procedure call
+#define ERRCODE_BASIC_MATH_OVERFLOW ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 3) // overflow
+#define ERRCODE_BASIC_OUT_OF_RANGE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 4) // Invalid array index / Subscript out of range
+#define ERRCODE_BASIC_ZERODIV ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 5) // Division by zero
+#define ERRCODE_BASIC_CONVERSION ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 6) // wrong data type
+#define ERRCODE_BASIC_BAD_PARAMETER ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 7) // invalid Parameter
+#define ERRCODE_BASIC_PROC_UNDEFINED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 8) // Sub or Function not defined
+#define ERRCODE_BASIC_INTERNAL_ERROR ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Unknown, 9) // generic object error
+#define ERRCODE_BASIC_NO_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 10) // Object variable not set
+#define ERRCODE_BASIC_CANNOT_LOAD ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Create, 11) // Can't load module
+#define ERRCODE_BASIC_BAD_INDEX ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 12) // Invalid object index
+#define ERRCODE_BASIC_NO_ACTIVE_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 13) // No active view or document
+#define ERRCODE_BASIC_BAD_PROP_VALUE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 14) // Bad property value
+#define ERRCODE_BASIC_PROP_READONLY ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Read, 15) // Property is read only
+#define ERRCODE_BASIC_PROP_WRITEONLY ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Write, 16) // Property is write only
+#define ERRCODE_BASIC_INVALID_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 17) // Invalid object reference
+#define ERRCODE_BASIC_NO_METHOD ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 18) // Property or Method unknown
+#define ERRCODE_BASIC_INVALID_USAGE_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 19) // Invalid object usage
+#define ERRCODE_BASIC_NO_OLE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 20) // Class does not support OLE
+#define ERRCODE_BASIC_BAD_METHOD ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 21) // Method not supported
+#define ERRCODE_BASIC_OLE_ERROR ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 22) // OLE Automation Error
+#define ERRCODE_BASIC_BAD_ACTION ErrCode( ErrCodeArea::Sbx, ErrCodeClass::NotSupported, 23) // Object doesn't support this action
+#define ERRCODE_BASIC_NO_NAMED_ARGS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 24) // Object doesn't support named args
+#define ERRCODE_BASIC_BAD_LOCALE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::NotSupported, 25) // Object doesn't support current locale setting
+#define ERRCODE_BASIC_NAMED_NOT_FOUND ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 26) // Named argument not found
+#define ERRCODE_BASIC_NOT_OPTIONAL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 27) // Argument not optional
+#define ERRCODE_BASIC_WRONG_ARGS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 28) // Invalid number of arguments
+#define ERRCODE_BASIC_NOT_A_COLL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 29) // Object not a collection
+
+#define ERRCODE_BASIC_NO_GOSUB ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 30 ) // Return without Gosub
+#define ERRCODE_BASIC_REDO_FROM_START ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 31 ) // Redo form start (SB internal)
+#define ERRCODE_BASIC_NO_MEMORY ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 32 ) // Out of memory
+#define ERRCODE_BASIC_ALREADY_DIM ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 33 ) // Array already dimensioned
+#define ERRCODE_BASIC_DUPLICATE_DEF ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 34 ) // Duplicate definition
+#define ERRCODE_BASIC_VAR_UNDEFINED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 35 ) // Variable undefined (SB)
+#define ERRCODE_BASIC_USER_ABORT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 36 ) // User interrupt occurred
+#define ERRCODE_BASIC_BAD_RESUME ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 37 ) // Resume without error
+#define ERRCODE_BASIC_STACK_OVERFLOW ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 38 ) // Out of stack space
+#define ERRCODE_BASIC_BAD_DLL_LOAD ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 39 ) // Error in loading DLL
+#define ERRCODE_BASIC_BAD_DLL_CALL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 40 ) // Bad DLL calling convention
+#define ERRCODE_BASIC_BAD_CHANNEL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 41 ) // Bad file name or number
+#define ERRCODE_BASIC_FILE_NOT_FOUND ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 42 ) // File not found
+#define ERRCODE_BASIC_BAD_FILE_MODE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 43 ) // Bad file mode
+#define ERRCODE_BASIC_FILE_ALREADY_OPEN ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 44 ) // File already open
+#define ERRCODE_BASIC_IO_ERROR ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 45 ) // Device I/O error
+#define ERRCODE_BASIC_FILE_EXISTS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 46 ) // File already exists
+#define ERRCODE_BASIC_BAD_RECORD_LENGTH ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 47 ) // bad record length
+#define ERRCODE_BASIC_DISK_FULL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 48 ) // disk full
+#define ERRCODE_BASIC_READ_PAST_EOF ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 49 ) // Input past end of file
+#define ERRCODE_BASIC_BAD_RECORD_NUMBER ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 50 ) // Bad record number
+#define ERRCODE_BASIC_TOO_MANY_FILES ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 51 ) // Too many files
+#define ERRCODE_BASIC_NO_DEVICE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 52 ) // Device not available
+#define ERRCODE_BASIC_ACCESS_DENIED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 53 ) // Permission denied
+#define ERRCODE_BASIC_NOT_READY ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 54 ) // Disk not ready
+#define ERRCODE_BASIC_NOT_IMPLEMENTED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 55 ) // Feature not implemented
+#define ERRCODE_BASIC_DIFFERENT_DRIVE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 56 ) // No rename with different drive
+#define ERRCODE_BASIC_ACCESS_ERROR ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 57 ) // Path/File access error
+#define ERRCODE_BASIC_PATH_NOT_FOUND ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 58 ) // Path not found
+#define ERRCODE_BASIC_BAD_PATTERN ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 59 ) // Invalid pattern string
+#define ERRCODE_BASIC_IS_NULL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 60 ) // Invalid use of Null
+
+#define ERRCODE_BASIC_DDE_ERROR ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 61 )
+#define ERRCODE_BASIC_DDE_WAITINGACK ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 62 )
+#define ERRCODE_BASIC_DDE_OUTOFCHANNELS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 63 )
+#define ERRCODE_BASIC_DDE_NO_RESPONSE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 64 )
+#define ERRCODE_BASIC_DDE_MULT_RESPONSES ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 65 )
+#define ERRCODE_BASIC_DDE_CHANNEL_LOCKED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 66 )
+#define ERRCODE_BASIC_DDE_NOTPROCESSED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 67 )
+#define ERRCODE_BASIC_DDE_TIMEOUT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 68 )
+#define ERRCODE_BASIC_DDE_USER_INTERRUPT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 69 )
+#define ERRCODE_BASIC_DDE_BUSY ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 70 )
+#define ERRCODE_BASIC_DDE_NO_DATA ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 71 )
+#define ERRCODE_BASIC_DDE_WRONG_DATA_FORMAT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 72 )
+#define ERRCODE_BASIC_DDE_PARTNER_QUIT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 73 )
+#define ERRCODE_BASIC_DDE_CONV_CLOSED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 74 )
+#define ERRCODE_BASIC_DDE_NO_CHANNEL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 75 )
+#define ERRCODE_BASIC_DDE_INVALID_LINK ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 76 )
+#define ERRCODE_BASIC_DDE_QUEUE_OVERFLOW ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 77 )
+#define ERRCODE_BASIC_DDE_LINK_ALREADY_EST ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 78 )
+#define ERRCODE_BASIC_DDE_LINK_INV_TOPIC ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 79 )
+#define ERRCODE_BASIC_DDE_DLL_NOT_FOUND ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 80 )
+
+#define ERRCODE_BASIC_NEEDS_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 81 ) // Object required
+#define ERRCODE_BASIC_BAD_ORDINAL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 82 ) // Invalid ordinal
+#define ERRCODE_BASIC_DLLPROC_NOT_FOUND ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 83 ) // Specified DLL function not found
+#define ERRCODE_BASIC_BAD_CLIPBD_FORMAT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 84 ) // Invalid clipboard format
+
+#define ERRCODE_BASIC_PROPERTY_NOT_FOUND ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 85 ) // Class not have property
+#define ERRCODE_BASIC_METHOD_NOT_FOUND ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 86 ) // Class does not have method
+#define ERRCODE_BASIC_ARG_MISSING ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 87 ) // Missing required argument
+#define ERRCODE_BASIC_BAD_NUMBER_OF_ARGS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 88 ) // Bad number of arguments
+#define ERRCODE_BASIC_METHOD_FAILED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 89 ) // Method failed
+#define ERRCODE_BASIC_SETPROP_FAILED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 90 ) // Unable to set property
+#define ERRCODE_BASIC_GETPROP_FAILED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 91 ) // Unable to get property
+
+// Compiler Errors (do not occur at runtime)
+// These IDs can shift at any time
+
+#define ERRCODE_BASIC_UNEXPECTED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 92 ) // Unexpected symbol: xx
+#define ERRCODE_BASIC_EXPECTED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 93 ) // Expected: xx
+#define ERRCODE_BASIC_SYMBOL_EXPECTED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 94 ) // Symbol expected
+#define ERRCODE_BASIC_VAR_EXPECTED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 95 ) // Variable expected
+#define ERRCODE_BASIC_LABEL_EXPECTED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 96 ) // Label expected
+#define ERRCODE_BASIC_LVALUE_EXPECTED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 97 ) // Lvalue expected
+#define ERRCODE_BASIC_VAR_DEFINED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 98 ) // Variable xxx already defined
+#define ERRCODE_BASIC_PROC_DEFINED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 99 ) // Procedure xx already defined
+#define ERRCODE_BASIC_LABEL_DEFINED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 100 ) // Label xxx already defined
+#define ERRCODE_BASIC_UNDEF_VAR ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 101 ) // Variable xx undefined
+#define ERRCODE_BASIC_UNDEF_ARRAY ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 102 ) // Array or function xx undefined
+#define ERRCODE_BASIC_UNDEF_PROC ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 103 ) // Procedure xxx undefined
+#define ERRCODE_BASIC_UNDEF_LABEL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 104 ) // Label xxx undefined
+#define ERRCODE_BASIC_UNDEF_TYPE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 105 ) // Unknown user defined type xxx
+#define ERRCODE_BASIC_BAD_EXIT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 106 ) // Exit XXX expected
+#define ERRCODE_BASIC_BAD_BLOCK ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 107 ) // Unterminated statement block: missing XX
+#define ERRCODE_BASIC_BAD_BRACKETS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 108 ) // Parentheses do not match
+#define ERRCODE_BASIC_BAD_DECLARATION ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 109 ) // Symbol xx defined differently
+#define ERRCODE_BASIC_BAD_PARAMETERS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 110 ) // Parameters do not match
+#define ERRCODE_BASIC_BAD_CHAR_IN_NUMBER ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 111 ) // Bad character in number
+#define ERRCODE_BASIC_MUST_HAVE_DIMS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 112 ) // Array needs dimensioning
+#define ERRCODE_BASIC_NO_IF ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 113 ) // Else/Endif without If
+#define ERRCODE_BASIC_NOT_IN_SUBR ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 114 ) // xxx not allowed within a sub
+#define ERRCODE_BASIC_NOT_IN_MAIN ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 115 ) // xxx not allowed outside a sub
+#define ERRCODE_BASIC_WRONG_DIMS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 116 ) // Dimensions do not match
+#define ERRCODE_BASIC_BAD_OPTION ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 117 ) // Unknown option: xxx
+#define ERRCODE_BASIC_CONSTANT_REDECLARED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 118 ) // Constant xx redeclared
+#define ERRCODE_BASIC_PROG_TOO_LARGE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 119 ) // Program is too large
+#define ERRCODE_BASIC_NO_STRINGS_ARRAYS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 120 )
+#define ERRCODE_BASIC_EXCEPTION ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 121 )
+
+#define ERRCODE_BASMGR_STDLIBOPEN ErrCode( ErrCodeArea::Sbx, 122)
+#define ERRCODE_BASMGR_STDLIBSAVE ErrCode( ErrCodeArea::Sbx, 123)
+#define ERRCODE_BASMGR_LIBLOAD ErrCode( ErrCodeArea::Sbx, 124)
+#define ERRCODE_BASMGR_LIBCREATE ErrCode( ErrCodeArea::Sbx, 125)
+#define ERRCODE_BASMGR_LIBSAVE ErrCode( ErrCodeArea::Sbx, 126)
+#define ERRCODE_BASMGR_LIBDEL ErrCode( ErrCodeArea::Sbx, 127)
+#define ERRCODE_BASMGR_MGROPEN ErrCode( ErrCodeArea::Sbx, 128)
+#define ERRCODE_BASMGR_MGRSAVE ErrCode( ErrCodeArea::Sbx, 129)
+#define ERRCODE_BASMGR_REMOVELIB ErrCode( ErrCodeArea::Sbx, 130)
+#define ERRCODE_BASMGR_UNLOADLIB ErrCode( ErrCodeArea::Sbx, 131)
+
+#define ERRCODE_BASIC_COMPAT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 132 )
+#define ERRCODE_BASIC_ARRAY_FIX ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 133 ) // This array is fixed
+#define ERRCODE_BASIC_STRING_OVERFLOW ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 134 ) // Out of string space
+#define ERRCODE_BASIC_EXPR_TOO_COMPLEX ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 135 ) // Expression too complex
+#define ERRCODE_BASIC_OPER_NOT_PERFORM ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 136 ) // Can't perform requested operation
+#define ERRCODE_BASIC_TOO_MANY_DLL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 137 ) // Too many dll application clients
+#define ERRCODE_BASIC_LOOP_NOT_INIT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 138 ) // For loop not initialized
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbmeth.hxx b/include/basic/sbmeth.hxx
new file mode 100644
index 000000000..fefd84aed
--- /dev/null
+++ b/include/basic/sbmeth.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_SBMETH_HXX
+#define INCLUDED_BASIC_SBMETH_HXX
+
+#include <vcl/errcode.hxx>
+#include <basic/sbxmeth.hxx>
+#include <basic/sbdef.hxx>
+#include <basic/basicdllapi.h>
+
+class SbModule;
+
+class BASIC_DLLPUBLIC SbMethod : public SbxMethod
+{
+ friend class SbiRuntime;
+ friend class SbiFactory;
+ friend class SbModule;
+ friend class SbClassModuleObject;
+ friend class SbiCodeGen;
+ friend class SbJScriptMethod;
+ friend class SbIfaceMapperMethod;
+
+ SbxVariable* mCaller; // caller
+ SbModule* pMod;
+ BasicDebugFlags nDebugFlags;
+ sal_uInt16 nLine1, nLine2;
+ sal_uInt32 nStart;
+ bool bInvalid;
+ SbxArrayRef refStatics;
+ BASIC_DLLPRIVATE SbMethod( const OUString&, SbxDataType, SbModule* );
+ BASIC_DLLPRIVATE SbMethod( const SbMethod& );
+ virtual bool LoadData( SvStream&, sal_uInt16 ) override;
+ virtual bool StoreData( SvStream& ) const override;
+ virtual ~SbMethod() override;
+
+public:
+ SBX_DECL_PERSIST_NODATA(SBXID_BASICMETHOD,2);
+ virtual SbxInfo* GetInfo() override;
+ SbxArray* GetStatics();
+ void ClearStatics();
+ SbModule* GetModule() { return pMod; }
+ BasicDebugFlags GetDebugFlags() const { return nDebugFlags; }
+ void SetDebugFlags( BasicDebugFlags n ) { nDebugFlags = n; }
+ void GetLineRange( sal_uInt16&, sal_uInt16& );
+
+ // Interface to execute a method from the applications
+ ErrCode Call( SbxValue* pRet, SbxVariable* pCaller = nullptr );
+ virtual void Broadcast( SfxHintId nHintId ) override;
+};
+
+typedef tools::SvRef<SbMethod> SbMethodRef;
+
+class SbIfaceMapperMethod final : public SbMethod
+{
+ friend class SbiRuntime;
+
+ SbMethodRef mxImplMeth;
+
+public:
+ SbIfaceMapperMethod( const OUString& rName, SbMethod* pImplMeth )
+ : SbMethod( rName, pImplMeth->GetType(), nullptr )
+ , mxImplMeth( pImplMeth )
+ {}
+ virtual ~SbIfaceMapperMethod() override;
+ SbMethod* getImplMethod()
+ { return mxImplMeth.get(); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx
new file mode 100644
index 000000000..a71f7253a
--- /dev/null
+++ b/include/basic/sbmod.hxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_SBMOD_HXX
+#define INCLUDED_BASIC_SBMOD_HXX
+
+#include <config_options.h>
+#include <basic/sbdef.hxx>
+#include <basic/sbxobj.hxx>
+#include <basic/sbxdef.hxx>
+#include <basic/sbx.hxx>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <deque>
+#include <basic/basicdllapi.h>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::script { class XInvocation; }
+
+class SbMethod;
+class SbProperty;
+typedef std::deque< sal_uInt16 > SbiBreakpoints;
+class SbiImage;
+class SbClassModuleObject;
+class CodeCompleteDataCache;
+
+
+class ModuleInitDependencyMap;
+struct ClassModuleRunInitItem;
+struct SbClassData;
+
+class BASIC_DLLPUBLIC SbModule : public SbxObject
+{
+ friend class SbiCodeGen;
+ friend class SbMethod;
+ friend class SbiRuntime;
+ friend class StarBASIC;
+ friend class SbClassModuleObject;
+
+ std::vector< OUString > mModuleVariableNames;
+
+ BASIC_DLLPRIVATE static void implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic );
+
+ SbModule(const SbModule&) = delete;
+ SbModule& operator=(const SbModule&) = delete;
+protected:
+ css::uno::Reference< css::script::XInvocation > mxWrapper;
+ OUString aOUSource;
+ OUString aComment;
+ std::unique_ptr<SbiImage> pImage; // the Image
+ SbiBreakpoints* pBreaks; // Breakpoints
+ std::unique_ptr<SbClassData> pClassData;
+ bool mbVBACompat;
+ sal_Int32 mnType;
+ SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
+ bool bIsProxyModule;
+
+ SAL_DLLPRIVATE static void implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem );
+ SAL_DLLPRIVATE void StartDefinitions();
+ SAL_DLLPRIVATE SbMethod* GetMethod( const OUString&, SbxDataType );
+ SAL_DLLPRIVATE SbProperty* GetProperty( const OUString&, SbxDataType );
+ SAL_DLLPRIVATE void GetProcedureProperty( const OUString&, SbxDataType );
+ SAL_DLLPRIVATE void GetIfaceMapperMethod( const OUString&, SbMethod* );
+ SAL_DLLPRIVATE void EndDefinitions( bool=false );
+ SAL_DLLPRIVATE void Run( SbMethod* );
+ SAL_DLLPRIVATE void RunInit();
+ SAL_DLLPRIVATE void ClearPrivateVars();
+ SAL_DLLPRIVATE void ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic );
+ SAL_DLLPRIVATE void GlobalRunInit( bool bBasicStart ); // for all modules
+ SAL_DLLPRIVATE void GlobalRunDeInit();
+ SAL_DLLPRIVATE const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16& ) const;
+ SAL_DLLPRIVATE const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16&,
+ bool bFollowJumps, const SbiImage* pImg=nullptr ) const;
+ SAL_DLLPRIVATE virtual bool LoadData( SvStream&, sal_uInt16 ) override;
+ SAL_DLLPRIVATE virtual bool StoreData( SvStream& ) const override;
+ SAL_DLLPRIVATE virtual bool LoadCompleted() override;
+ SAL_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+ SAL_DLLPRIVATE void handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint );
+ virtual ~SbModule() override;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXID_BASICMOD,2);
+ SbModule( const OUString&, bool bCompat = false );
+ SAL_DLLPRIVATE virtual void SetParent( SbxObject* ) override;
+ SAL_DLLPRIVATE virtual void Clear() override;
+
+ SAL_DLLPRIVATE virtual SbxVariable* Find( const OUString&, SbxClassType ) override;
+
+ const OUString& GetSource32() const { return aOUSource;}
+ void SetSource32( const OUString& r );
+
+ bool Compile();
+ bool IsCompiled() const;
+ SAL_DLLPRIVATE const SbxObject* FindType( const OUString& aTypeName ) const;
+
+ SAL_DLLPRIVATE bool IsBreakable( sal_uInt16 nLine ) const;
+ SAL_DLLPRIVATE bool IsBP( sal_uInt16 nLine ) const;
+ bool SetBP( sal_uInt16 nLine );
+ bool ClearBP( sal_uInt16 nLine );
+ void ClearAllBP();
+
+ // Store only image, no source (needed for new password protection)
+ SAL_DLLPRIVATE void StoreBinaryData( SvStream& );
+ SAL_DLLPRIVATE void LoadBinaryData( SvStream& );
+ SAL_DLLPRIVATE bool ExceedsLegacyModuleSize();
+ SAL_DLLPRIVATE void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = nullptr ) const;
+ SAL_DLLPRIVATE bool HasExeCode();
+ bool IsVBACompat() const { return mbVBACompat;}
+ SAL_DLLPRIVATE void SetVBACompat( bool bCompat );
+ sal_Int32 GetModuleType() const { return mnType; }
+ void SetModuleType( sal_Int32 nType ) { mnType = nType; }
+ bool isProxyModule() const { return bIsProxyModule; }
+ SAL_DLLPRIVATE void AddVarName( const OUString& aName );
+ SAL_DLLPRIVATE void RemoveVars();
+ css::uno::Reference< css::script::XInvocation > const & GetUnoModule();
+ bool createCOMWrapperForIface( css::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject );
+ void GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache);
+ const SbxArrayRef& GetMethods() const { return pMethods;}
+ SbMethod* FindMethod( const OUString&, SbxClassType );
+ static OUString GetKeywordCase( const OUString& sKeyword );
+};
+
+typedef tools::SvRef<SbModule> SbModuleRef;
+typedef std::vector<SbModuleRef> SbModules;
+
+// Object class for instances of class modules
+class UNLESS_MERGELIBS(BASIC_DLLPUBLIC) SbClassModuleObject final : public SbModule
+{
+ SbModule* mpClassModule;
+ bool mbInitializeEventDone;
+
+public:
+ SbClassModuleObject( SbModule* pClassModule );
+ virtual ~SbClassModuleObject() override;
+
+ // Overridden to support NameAccess etc.
+ virtual SbxVariable* Find( const OUString&, SbxClassType ) override;
+
+ virtual void Notify( SfxBroadcaster&, const SfxHint& rHint ) override;
+
+ SbModule* getClassModule()
+ { return mpClassModule; }
+
+ void triggerInitializeEvent();
+ void triggerTerminateEvent();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx
new file mode 100644
index 000000000..1629ab16c
--- /dev/null
+++ b/include/basic/sbstar.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_SBSTAR_HXX
+#define INCLUDED_BASIC_SBSTAR_HXX
+
+#include <basic/sbx.hxx>
+#include <basic/sbxobj.hxx>
+#include <basic/sbmod.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/link.hxx>
+
+#include <basic/sbdef.hxx>
+#include <basic/basicdllapi.h>
+
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::script { struct ModuleInfo; }
+
+class SbMethod;
+
+class BASIC_DLLPUBLIC StarBASIC final : public SbxObject
+{
+ friend class SbiScanner;
+ friend class SbiExpression; // Access to RTL
+ friend class SbiInstance; // runtime instance
+ friend class SbiRuntime; // currently running procedure
+ friend class DocBasicItem;
+
+ SbModules pModules; // List of all modules
+ SbxObjectRef pRtl; // Runtime Library
+ SbxArrayRef xUnoListeners; // Listener handled by CreateUnoListener
+
+ // Handler-Support:
+ Link<StarBASIC*,bool> aErrorHdl; // Error handler
+ Link<StarBASIC*,BasicDebugFlags> aBreakHdl; // Breakpoint handler
+ bool bNoRtl; // if true: do not search RTL
+ bool bBreak; // if true: Break, otherwise Step
+ bool bDocBasic;
+ bool bVBAEnabled;
+ bool bQuit;
+
+ SbxObjectRef pVBAGlobals;
+
+ BASIC_DLLPRIVATE void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic );
+ bool CError( ErrCode, const OUString&, sal_Int32, sal_Int32, sal_Int32 );
+ BASIC_DLLPRIVATE bool RTError( ErrCode, const OUString& rMsg, sal_Int32, sal_Int32, sal_Int32 );
+ BASIC_DLLPRIVATE BasicDebugFlags BreakPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
+ BASIC_DLLPRIVATE BasicDebugFlags StepPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
+ virtual bool LoadData( SvStream&, sal_uInt16 ) override;
+ virtual bool StoreData( SvStream& ) const override;
+ bool ErrorHdl();
+ BasicDebugFlags BreakHdl();
+ virtual ~StarBASIC() override;
+
+public:
+
+ SBX_DECL_PERSIST_NODATA(SBXID_BASIC,1);
+
+ StarBASIC( StarBASIC* pParent = nullptr, bool bIsDocBasic = false );
+
+ // #51727 SetModified overridden so that the Modified-State is
+ // not delivered to Parent.
+ virtual void SetModified( bool ) override;
+
+ virtual void Insert( SbxVariable* ) override;
+ using SbxObject::Remove;
+ virtual void Remove( SbxVariable* ) override;
+ virtual void Clear() override;
+
+ // Compiler-Interface
+ SbModule* MakeModule( const OUString& rName, const OUString& rSrc );
+ SbModule* MakeModule( const OUString& rName, const css::script::ModuleInfo& mInfo, const OUString& rSrc );
+ static void Stop();
+ static void Error( ErrCode, const OUString& rMsg = {} );
+ static void FatalError( ErrCode );
+ static void FatalError( ErrCode, const OUString& rMsg );
+ static bool IsRunning();
+ static ErrCode GetErrBasic();
+ // #66536 make additional message accessible by RTL function Error
+ static OUString GetErrorMsg();
+ static sal_Int32 GetErl();
+
+ virtual SbxVariable* Find( const OUString&, SbxClassType ) override;
+ virtual bool Call( const OUString&, SbxArray* = nullptr ) override;
+
+ SbModules& GetModules() { return pModules; }
+ SbxObject* GetRtl() { return pRtl.get(); }
+ SbModule* FindModule( std::u16string_view );
+ // Run init code of all modules (including the inserted Doc-Basics)
+ void InitAllModules( StarBASIC const * pBasicNotToInit = nullptr );
+ void DeInitAllModules();
+ void ClearAllModuleVars();
+
+ // Calls for error and break handler
+ static sal_uInt16 GetLine();
+ static sal_uInt16 GetCol1();
+ static sal_uInt16 GetCol2();
+ static void SetErrorData( ErrCode nCode, sal_uInt16 nLine,
+ sal_uInt16 nCol1, sal_uInt16 nCol2 );
+
+ // Specific to error handler
+ static void MakeErrorText( ErrCode, std::u16string_view aMsg );
+ static const OUString& GetErrorText();
+ static ErrCode const & GetErrorCode();
+ static sal_uInt16 GetVBErrorCode( ErrCode nError );
+ static ErrCode GetSfxFromVBError( sal_uInt16 nError );
+ bool IsBreak() const { return bBreak; }
+
+ static Link<StarBASIC*,bool> const & GetGlobalErrorHdl();
+ static void SetGlobalErrorHdl( const Link<StarBASIC*,bool>& rNewHdl );
+
+ static void SetGlobalBreakHdl( const Link<StarBASIC*,BasicDebugFlags>& rNewHdl );
+
+ SbxArrayRef const & getUnoListeners();
+
+ static SbxBase* FindSBXInCurrentScope( const OUString& rName );
+ static SbMethod* GetActiveMethod( sal_uInt16 nLevel = 0 );
+ static SbModule* GetActiveModule();
+ void SetVBAEnabled( bool bEnabled );
+ bool isVBAEnabled() const;
+
+ const SbxObjectRef& getRTL() const { return pRtl; }
+ bool IsDocBasic() const { return bDocBasic; }
+ SbxVariable* VBAFind( const OUString& rName, SbxClassType t );
+ bool GetUNOConstant( const OUString& rName, css::uno::Any& aOut );
+ void QuitAndExitApplication();
+ bool IsQuitApplication() const { return bQuit; };
+
+ SbxObject* getVBAGlobals( );
+
+ static css::uno::Reference< css::frame::XModel >
+ GetModelFromBasic( SbxObject* pBasic );
+
+ static void DetachAllDocBasicItems();
+};
+
+typedef tools::SvRef<StarBASIC> StarBASICRef;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbuno.hxx b/include/basic/sbuno.hxx
new file mode 100644
index 000000000..4c53215d9
--- /dev/null
+++ b/include/basic/sbuno.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_SBUNO_HXX
+#define INCLUDED_BASIC_SBUNO_HXX
+
+#include <com/sun/star/uno/Type.hxx>
+#include <basic/sbxvar.hxx>
+#include <basic/basicdllapi.h>
+
+namespace com::sun::star::uno { class Any; }
+namespace com::sun::star::beans { struct Property; }
+
+class SbxObject;
+
+// Returns a SbxObject that wraps a Uno Interface
+// Implementation in basic/source/classes/sbunoobj.cxx
+BASIC_DLLPUBLIC SbxObjectRef GetSbUnoObject( const OUString& aName, const css::uno::Any& aUnoObj_ );
+
+// Force creation of all properties for debugging
+BASIC_DLLPUBLIC void createAllObjectProperties( SbxObject* pObj );
+BASIC_DLLPUBLIC void SetSbUnoObjectDfltPropName( SbxObject* pObj );
+
+BASIC_DLLPUBLIC css::uno::Any sbxToUnoValue( const SbxValue* pVar );
+css::uno::Any sbxToUnoValue( const SbxValue* pVar, const css::uno::Type& rType, css::beans::Property const * pUnoProperty = nullptr );
+
+BASIC_DLLPUBLIC void unoToSbxValue( SbxVariable* pVar, const css::uno::Any& aValue );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx
new file mode 100644
index 000000000..7997f53ef
--- /dev/null
+++ b/include/basic/sbx.hxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_SBX_HXX
+#define INCLUDED_BASIC_SBX_HXX
+
+#include <config_options.h>
+#include <tools/ref.hxx>
+#include <svl/hint.hxx>
+
+#include <basic/sbxdef.hxx>
+#include <basic/sbxobj.hxx>
+#include <basic/basicdllapi.h>
+
+#include <utility>
+#include <vector>
+#include <memory>
+
+class SvStream;
+
+class SfxBroadcaster;
+
+// Parameter information
+struct SbxParamInfo
+{
+ const OUString aName; // Name of the parameter
+ SbxDataType eType; // Data type
+ SbxFlagBits nFlags; // Flag-Bits
+ sal_uInt32 nUserData; // IDs etc.
+ SbxParamInfo( OUString s, SbxDataType t, SbxFlagBits n )
+ : aName(std::move( s )), eType( t ), nFlags( n ), nUserData( 0 ) {}
+};
+
+typedef std::vector<std::unique_ptr<SbxParamInfo>> SbxParams;
+
+class UNLESS_MERGELIBS(BASIC_DLLPUBLIC) SbxInfo final : public SvRefBase
+{
+ friend class SbxVariable;
+ friend class SbMethod;
+
+ OUString aComment;
+ OUString aHelpFile;
+ sal_uInt32 nHelpId;
+ SbxParams m_Params;
+
+ SbxInfo(SbxInfo const&) = delete;
+ void operator=(SbxInfo const&) = delete;
+
+ void LoadData( SvStream&, sal_uInt16 );
+ void StoreData( SvStream& ) const;
+ virtual ~SbxInfo() override;
+public:
+ SbxInfo();
+ SbxInfo( OUString , sal_uInt32 );
+
+ void AddParam( const OUString&, SbxDataType, SbxFlagBits=SbxFlagBits::Read );
+ const SbxParamInfo* GetParam( sal_uInt16 n ) const; // index starts with 1!
+ const OUString& GetComment() const { return aComment; }
+ const OUString& GetHelpFile() const { return aHelpFile; }
+ sal_uInt32 GetHelpId() const { return nHelpId; }
+
+ void SetComment( const OUString& r ) { aComment = r; }
+};
+
+class BASIC_DLLPUBLIC SbxHint final : public SfxHint
+{
+ SbxVariable* pVar;
+public:
+ SbxHint( SfxHintId n, SbxVariable* v ) : SfxHint( n ), pVar( v ) {}
+ SbxVariable* GetVar() const { return pVar; }
+};
+
+// SbxArray is an unidimensional, dynamic Array
+// The variables convert from SbxVariablen. Put()/Insert() into the
+// declared datatype, if they are not SbxVARIANT.
+
+struct SbxVarEntry;
+
+class BASIC_DLLPUBLIC SbxArray : public SbxBase
+{
+// #100883 Method to set method directly to parameter array
+ friend class SbMethod;
+ friend class SbClassModuleObject;
+ friend SbxObjectRef cloneTypeObjectImpl( const SbxObject& rTypeObj );
+ BASIC_DLLPRIVATE void PutDirect( SbxVariable* pVar, sal_uInt32 nIdx );
+
+ std::vector<SbxVarEntry> mVarEntries; // The variables
+ SbxDataType eType; // Data type of the array
+
+protected:
+ virtual ~SbxArray() override;
+ virtual bool LoadData( SvStream&, sal_uInt16 ) override;
+ virtual bool StoreData( SvStream& ) const override;
+
+public:
+ SBX_DECL_PERSIST_NODATA(SBXID_ARRAY,1);
+ SbxArray( SbxDataType=SbxVARIANT );
+ SbxArray( const SbxArray& ) = delete;
+ SbxArray& operator=( const SbxArray& );
+ virtual void Clear() override;
+ sal_uInt32 Count() const;
+ virtual SbxDataType GetType() const override;
+ SbxVariableRef& GetRef(sal_uInt32);
+ SbxVariable* Get(sal_uInt32);
+ void Put(SbxVariable*, sal_uInt32);
+ void Insert(SbxVariable*, sal_uInt32);
+ void Remove( sal_uInt32 );
+ void Remove( SbxVariable const * );
+ void Merge( SbxArray* );
+ OUString GetAlias(sal_uInt32);
+ void PutAlias(const OUString&, sal_uInt32);
+ SbxVariable* Find( const OUString&, SbxClassType );
+};
+
+// SbxDimArray is an array that can dimensioned using BASIC conventions.
+struct SbxDim { // an array-dimension:
+ sal_Int32 nLbound, nUbound; // Limitations
+ sal_Int32 nSize; // Number of elements
+};
+
+class BASIC_DLLPUBLIC SbxDimArray final : public SbxArray
+{
+ std::vector<SbxDim> m_vDimensions; // Dimension table
+ BASIC_DLLPRIVATE void AddDimImpl(sal_Int32, sal_Int32, bool bAllowSize0);
+ bool mbHasFixedSize;
+
+ sal_uInt32 Offset(const sal_Int32*);
+ sal_uInt32 Offset(SbxArray*);
+ virtual bool LoadData( SvStream&, sal_uInt16 ) override;
+ virtual bool StoreData( SvStream& ) const override;
+ virtual ~SbxDimArray() override;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXID_DIMARRAY,1);
+ SbxDimArray( SbxDataType=SbxVARIANT );
+ SbxDimArray( const SbxDimArray& ) = delete;
+ SbxDimArray& operator=( const SbxDimArray& );
+ virtual void Clear() override;
+ SbxVariable* Get( SbxArray* );
+
+ using SbxArray::GetRef;
+ using SbxArray::Get;
+ SbxVariable* Get(const sal_Int32*);
+ using SbxArray::Put;
+ void Put(SbxVariable*, const sal_Int32*);
+ sal_Int32 GetDims() const { return m_vDimensions.size(); }
+ void AddDim(sal_Int32, sal_Int32);
+ void unoAddDim(sal_Int32, sal_Int32);
+ bool GetDim(sal_Int32, sal_Int32&, sal_Int32&) const;
+ bool hasFixedSize() const { return mbHasFixedSize; };
+ void setHasFixedSize( bool bHasFixedSize ) {mbHasFixedSize = bHasFixedSize; };
+};
+
+class SbxCollection : public SbxObject
+{
+ void Initialize();
+protected:
+ virtual ~SbxCollection() override;
+ virtual bool LoadData( SvStream&, sal_uInt16 ) override;
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+ // Overridable methods (why not pure virtual?):
+ virtual void CollAdd( SbxArray* pPar );
+ void CollItem( SbxArray* pPar );
+ virtual void CollRemove( SbxArray* pPar );
+
+public:
+ SBX_DECL_PERSIST_NODATA(SBXID_COLLECTION,1);
+ SbxCollection();
+ SbxCollection( const SbxCollection& );
+ SbxCollection& operator=( const SbxCollection& );
+ virtual SbxVariable* Find( const OUString&, SbxClassType ) override;
+ virtual void Clear() override;
+};
+
+class SbxStdCollection final : public SbxCollection
+{
+ OUString aElemClass;
+ bool bAddRemoveOk;
+ virtual ~SbxStdCollection() override;
+ virtual bool LoadData( SvStream&, sal_uInt16 ) override;
+ virtual bool StoreData( SvStream& ) const override;
+ virtual void CollAdd( SbxArray* pPar ) override;
+ virtual void CollRemove( SbxArray* pPar ) override;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXID_FIXCOLLECTION,1);
+ SbxStdCollection();
+ SbxStdCollection( const SbxStdCollection& );
+ SbxStdCollection& operator=( const SbxStdCollection& );
+ virtual void Insert( SbxVariable* ) override;
+};
+
+typedef tools::SvRef<SbxArray> SbxArrayRef;
+typedef tools::SvRef<SbxInfo> SbxInfoRef;
+typedef tools::SvRef<SbxDimArray> SbxDimArrayRef;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxcore.hxx b/include/basic/sbxcore.hxx
new file mode 100644
index 000000000..e5f726e8d
--- /dev/null
+++ b/include/basic/sbxcore.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_SBXCORE_HXX
+#define INCLUDED_BASIC_SBXCORE_HXX
+
+#include <basic/basicdllapi.h>
+#include <basic/sbxdef.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/ref.hxx>
+
+class SvStream;
+class ErrCode;
+
+// The following Macro defines four (five) necessary methods within a
+// SBX object. LoadPrivateData() and StorePrivateData() must be implemented.
+// They are necessary for loading/storing the data of derived classes.
+// Load() and Store() must not be overridden.
+
+// This version of the Macros does not define Load/StorePrivateData()-methods
+#define SBX_DECL_PERSIST_NODATA( nSbxId, nVer ) \
+ virtual sal_uInt16 GetVersion() const override { return nVer; } \
+ virtual sal_uInt16 GetSbxId() const override { return nSbxId; }
+
+class SbxFactory;
+class SbxObject;
+class SbxBase;
+
+typedef tools::SvRef<SbxBase> SbxBaseRef;
+typedef tools::SvRef<SbxObject> SbxObjectRef;
+
+class BASIC_DLLPUBLIC SbxBase : virtual public SvRefBase
+{
+ virtual bool LoadData( SvStream&, sal_uInt16 ) = 0;
+ virtual bool StoreData( SvStream& ) const = 0;
+protected:
+ SbxFlagBits nFlags; // Flag-Bits
+
+ SbxBase();
+ SbxBase( const SbxBase& );
+ SbxBase& operator=( const SbxBase& );
+ virtual ~SbxBase() override;
+
+ virtual sal_uInt16 GetVersion() const = 0;
+ virtual sal_uInt16 GetSbxId() const = 0;
+
+public:
+ inline void SetFlags( SbxFlagBits n );
+ inline SbxFlagBits GetFlags() const;
+ inline void SetFlag( SbxFlagBits n );
+ inline void ResetFlag( SbxFlagBits n );
+ inline bool IsSet( SbxFlagBits n ) const;
+ inline bool IsReset( SbxFlagBits n ) const;
+ inline bool CanRead() const;
+ inline bool CanWrite() const;
+ inline bool IsModified() const;
+ inline bool IsHidden() const;
+ inline bool IsVisible() const;
+
+ virtual bool IsFixed() const;
+ virtual void SetModified( bool );
+
+ virtual SbxDataType GetType() const;
+
+ virtual void Clear() = 0;
+
+ static SbxBaseRef Load( SvStream& );
+ bool Store( SvStream& );
+ virtual bool LoadCompleted();
+
+ static ErrCode const & GetError();
+ static void SetError( ErrCode );
+ static bool IsError();
+ static void ResetError();
+
+ // Set the factory for Load/Store/Create
+ static void AddFactory( SbxFactory* );
+ static void RemoveFactory( SbxFactory const * );
+
+ static SbxBaseRef Create( sal_uInt16, sal_uInt32 );
+ static SbxObjectRef CreateObject( const OUString& );
+};
+
+inline void SbxBase::SetFlags( SbxFlagBits n )
+{ nFlags = n; }
+
+inline SbxFlagBits SbxBase::GetFlags() const
+{ return nFlags; }
+
+inline void SbxBase::SetFlag( SbxFlagBits n )
+{ nFlags |= n; }
+
+inline void SbxBase::ResetFlag( SbxFlagBits n )
+{ nFlags &= ~n; }
+
+inline bool SbxBase::IsSet( SbxFlagBits n ) const
+{ return ( nFlags & n ) != SbxFlagBits::NONE; }
+
+inline bool SbxBase::IsReset( SbxFlagBits n ) const
+{ return ( nFlags & n ) == SbxFlagBits::NONE; }
+
+inline bool SbxBase::CanRead() const
+{ return IsSet( SbxFlagBits::Read ); }
+
+inline bool SbxBase::CanWrite() const
+{ return IsSet( SbxFlagBits::Write ); }
+
+inline bool SbxBase::IsModified() const
+{ return IsSet( SbxFlagBits::Modified ); }
+
+inline bool SbxBase::IsHidden() const
+{ return IsSet( SbxFlagBits::Hidden ); }
+
+inline bool SbxBase::IsVisible() const
+{ return IsReset( SbxFlagBits::Invisible ); }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxdef.hxx b/include/basic/sbxdef.hxx
new file mode 100644
index 000000000..e85f1a209
--- /dev/null
+++ b/include/basic/sbxdef.hxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_BASIC_SBXDEF_HXX
+#define INCLUDED_BASIC_SBXDEF_HXX
+
+#include <o3tl/typed_flags_set.hxx>
+#include <sal/types.h>
+
+enum class SbxClassType { // SBX-class-IDs (order is important!)
+ DontCare = 1, // don't care (search, not 0 due to StarBASIC)
+ Array, // Array of SbxVariables
+ Value, // simple value
+ Variable, // Variable (from here there is Broadcaster)
+ Method, // Method (Function or Sub)
+ Property, // Property
+ Object // Object
+};
+
+enum SbxDataType {
+ SbxEMPTY = 0, // * Uninitialized
+ SbxNULL = 1, // * Contains no valid data
+ SbxINTEGER = 2, // * Integer (sal_Int16)
+ SbxLONG = 3, // * Long integer (sal_Int32)
+ SbxSINGLE = 4, // * Single-precision floating point number (float)
+ SbxDOUBLE = 5, // * Double-precision floating point number (double)
+ SbxCURRENCY = 6, // Currency (sal_Int64)
+ SbxDATE = 7, // * Date (double)
+ SbxSTRING = 8, // * String (StarView)
+ SbxOBJECT = 9, // * SbxBase object pointer
+ SbxERROR = 10, // * Error (sal_uInt16)
+ SbxBOOL = 11, // * Boolean (0 or -1)
+
+ SbxVARIANT = 12, // * Display for variant datatype
+ SbxDATAOBJECT = 13, // * Common data object w/o ref count
+
+ SbxCHAR = 16, // * signed char
+ SbxBYTE = 17, // * unsigned char
+ SbxUSHORT = 18, // * unsigned short (sal_uInt16)
+ SbxULONG = 19, // * unsigned long (sal_uInt32)
+
+ SbxINT = 22, // * signed machine-dependent int
+ SbxUINT = 23, // * unsigned machine-dependent int
+
+ SbxVOID = 24, // * no value (= SbxEMPTY)
+ SbxHRESULT = 25, // HRESULT
+ SbxPOINTER = 26, // generic pointer
+ SbxDIMARRAY = 27, // dimensioned array
+ SbxCARRAY = 28, // C style array
+ SbxUSERDEF = 29, // user defined
+ SbxLPSTR = 30, // * null terminated string
+
+ SbxLPWSTR = 31, // wide null terminated string
+ SbxCoreSTRING = 32, // from 1997-4-10 for GetCoreString(), only for converting<
+
+ SbxWSTRING = 33, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
+ SbxWCHAR = 34, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
+ SbxSALINT64 = 35, // for currency internal, signed 64-bit int and UNO hyper
+ SbxSALUINT64= 36, // for currency internal, unsigned 64-bit int and UNO unsigned hyper
+ SbxDECIMAL = 37, // for UNO/automation Decimal
+
+ SbxVECTOR = 0x1000, // simple counted array
+ SbxARRAY = 0x2000, // array
+ SbxBYREF = 0x4000, // access by reference
+
+ // tdf#79426, tdf#125180
+ SbxMISSING = 0x8000, // Parameter is missing
+};
+
+const sal_uInt32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000;
+const sal_uInt32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000;
+const sal_uInt32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible
+const sal_uInt32 SBX_TYPE_VAR_TO_DIM_FLAG = 0x40000;
+
+enum SbxOperator {
+ // Arithmetical:
+ SbxEXP, // this ^ var
+ SbxMUL, // this * var
+ SbxDIV, // this / var
+ SbxMOD, // this MOD var (max INT32!)
+ SbxPLUS, // this + var
+ SbxMINUS, // this - var
+ SbxNEG, // -this (var is ignored)
+ SbxIDIV, // this / var (both operands max. sal_Int32!)
+ // Boolean operators (max sal_Int32!):
+ // Boolean operators (TODO deprecate this limit: max INT32!)
+ SbxAND, // this & var
+ SbxOR, // this | var
+ SbxXOR, // this ^ var
+ SbxEQV, // ~this ^ var
+ SbxIMP, // ~this | var
+ SbxNOT, // ~this (var is ignored)
+
+ // String concatenation:
+ SbxCAT, // this & var (VBA: this + var)
+
+ // Comparisons:
+ SbxEQ, // this = var
+ SbxNE, // this <> var
+ SbxLT, // this < var
+ SbxGT, // this > var
+ SbxLE, // this <= var
+ SbxGE // this >= var
+};
+
+enum class SbxNameType { // Type of the questioned name of a variable
+ NONE, // plain name
+ CaseInsensitive, // plain name - case insensitive
+ ShortTypes, // Name%(A%,B$)
+};
+
+
+// Flag-Bits:
+enum class SbxFlagBits {
+ NONE = 0x0000,
+ Read = 0x0001, // Read permission
+ Write = 0x0002, // Write permission
+ ReadWrite = 0x0003, // Read/Write permission
+ DontStore = 0x0004, // Don't store object
+ Modified = 0x0008, // Object was changed
+ Fixed = 0x0010, // Fixed data type (SbxVariable)
+ Const = 0x0020, // Definition of const value
+ Optional = 0x0040, // Parameter is optional
+ Hidden = 0x0080, // Element is invisible
+ Invisible = 0x0100, // Element is not found by Find()
+ ExtSearch = 0x0200, // Object is searched completely
+ ExtFound = 0x0400, // Variable was found through extended search
+ GlobalSearch = 0x0800, // Global search via Parents
+ Reserved = 0x1000, // reserved
+ Private = 0x1000, // #110004, #112015, cannot conflict with SbxFlagBits::Reserved
+ NoBroadcast = 0x2000, // No broadcast on Get/Put
+ Reference = 0x4000, // Parameter is Reference (DLL-call)
+ NoModify = 0x8000, // SetModified is suppressed
+ WithEvents = 0x0080, // Same value as unused SbxFlagBits::Hidden
+ DimAsNew = 0x0800, // Same value as SbxFlagBits::GlobalSearch, cannot conflict as one
+ // is used for objects, the other for variables only
+ VarToDim = 0x2000, // Same value as SbxFlagBits::NoBroadcast, cannot conflict as
+ // used for variables without broadcaster only
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SbxFlagBits> : is_typed_flags<SbxFlagBits, 0xffff> {};
+}
+
+// List of all creators for Load/Store
+
+constexpr auto SBXCR_SBX = 0x20584253; // SBX(blank)
+
+// List of predefined SBX-IDs. New SBX-IDs must be precisely defined so that
+// they are unique within the Stream and appropriate Factory.
+
+constexpr auto SBXID_VALUE = 0x4E4E; // NN: SbxValue
+constexpr auto SBXID_VARIABLE = 0x4156; // VA: SbxVariable
+constexpr auto SBXID_ARRAY = 0x5241; // AR: SbxArray
+constexpr auto SBXID_DIMARRAY = 0x4944; // DI: SbxDimArray
+constexpr auto SBXID_OBJECT = 0x424F; // OB: SbxObject
+constexpr auto SBXID_COLLECTION = 0x4F43; // CO: SbxCollection
+constexpr auto SBXID_FIXCOLLECTION = 0x4346; // FC: SbxStdCollection
+constexpr auto SBXID_METHOD = 0x454D; // ME: SbxMethod
+constexpr auto SBXID_PROPERTY = 0x5250; // PR: SbxProperty
+
+// StarBASIC restricts the base data type to different intervals.
+// These intervals are fixed to create 'portability and independent
+// of the implementation. Only type double is greedy and takes
+// what it gets.
+
+constexpr auto SbxMAXCHAR = u'\xFFFF';
+constexpr auto SbxMINCHAR = 0;
+constexpr auto SbxMAXBYTE = 255;
+constexpr auto SbxMAXINT = 32767;
+constexpr auto SbxMININT = -32768;
+constexpr sal_uInt16 SbxMAXUINT = 65535;
+constexpr auto SbxMAXLNG = 2147483647;
+constexpr sal_Int32 SbxMINLNG = -2147483647-1;
+constexpr sal_uInt32 SbxMAXULNG = 0xffffffff;
+
+ // Currency stored as SbxSALINT64 == sal_Int64
+ // value range limits are ~(2^63 - 1)/10000
+ // fixed precision has 4 digits right of decimal pt
+constexpr auto CURRENCY_FACTOR = 10000;
+constexpr auto CURRENCY_FACTOR_SQUARE = 100000000;
+
+// TODO effective MAX/MINCURR limits:
+// true value ( 922337203685477.5807) is too precise for correct comparison to 64bit double
+constexpr auto SbxMAXCURR = 922337203685477.5807;
+constexpr auto SbxMINCURR = -922337203685477.5808;
+
+constexpr auto SbxMAXSNG = 3.402823e+38;
+constexpr auto SbxMINSNG = -3.402823e+38;
+constexpr auto SbxMAXSNG2 = 1.175494351e-38;
+constexpr auto SbxMINSNG2 = -1.175494351e-38;
+
+// Max valid offset index of a Sbx-Array (due to 64K limit)
+constexpr auto SBX_MAXINDEX = 0x3FF0;
+constexpr auto SBX_MAXINDEX32 = SbxMAXLNG;
+
+// The numeric values of sal_True and FALSE
+enum SbxBOOL { SbxFALSE = 0, SbxTRUE = -1 };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxmeth.hxx b/include/basic/sbxmeth.hxx
new file mode 100644
index 000000000..b32a40f14
--- /dev/null
+++ b/include/basic/sbxmeth.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_SBXMETH_HXX
+#define INCLUDED_BASIC_SBXMETH_HXX
+
+#include <basic/sbxvar.hxx>
+#include <basic/basicdllapi.h>
+
+class BASIC_DLLPUBLIC SbxMethod : public SbxVariable
+{
+ bool mbIsRuntimeFunction;
+ SbxDataType mbRuntimeFunctionReturnType;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXID_METHOD,1);
+ SbxMethod( const OUString& r, SbxDataType t, bool bIsRuntimeFunction=false );
+ SbxMethod( const SbxMethod& r );
+ virtual ~SbxMethod() override;
+ SbxMethod& operator=( const SbxMethod& r ) { SbxVariable::operator=( r ); return *this; }
+ virtual SbxClassType GetClass() const override;
+ bool IsRuntimeFunction() const { return mbIsRuntimeFunction; }
+ SbxDataType GetRuntimeFunctionReturnType() const{ return mbRuntimeFunctionReturnType; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxobj.hxx b/include/basic/sbxobj.hxx
new file mode 100644
index 000000000..10d4c074c
--- /dev/null
+++ b/include/basic/sbxobj.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_SBXOBJ_HXX
+#define INCLUDED_BASIC_SBXOBJ_HXX
+
+#include <svl/lstner.hxx>
+#include <basic/sbxvar.hxx>
+#include <basic/basicdllapi.h>
+
+
+class SbxProperty;
+
+class BASIC_DLLPUBLIC SbxObject : public SbxVariable, public SfxListener
+{
+ BASIC_DLLPRIVATE SbxArray* FindVar( SbxVariable const *, sal_uInt32& );
+protected:
+ SbxArrayRef pMethods; // Methods
+ SbxArrayRef pProps; // Properties
+ SbxArrayRef pObjs; // Objects
+ SbxProperty* pDfltProp; // Default-Property
+ OUString aClassName; // Classname
+ OUString aDfltPropName;
+ virtual bool LoadData( SvStream&, sal_uInt16 ) override;
+ virtual bool StoreData( SvStream& ) const override;
+ virtual ~SbxObject() override;
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXID_OBJECT,1);
+ SbxObject( const OUString& rClassname );
+ SbxObject( const SbxObject& );
+ SbxObject& operator=( const SbxObject& );
+ virtual SbxDataType GetType() const override;
+ virtual SbxClassType GetClass() const override;
+ virtual void Clear() override;
+
+ virtual bool IsClass( const OUString& ) const;
+ const OUString& GetClassName() const { return aClassName; }
+ void SetClassName( const OUString &rNew ) { aClassName = rNew; }
+ // Default-Property
+ SbxProperty* GetDfltProperty();
+ void SetDfltProperty( const OUString& r );
+ // Search for an element
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+ SbxVariable* FindQualified( const OUString&, SbxClassType );
+ // Quick-Call-Interface for Methods
+ virtual bool Call( const OUString&, SbxArray* = nullptr );
+ // Execution of DDE-Commands
+ SbxVariable* Execute( const OUString& );
+ // Manage elements
+ SbxVariable* Make( const OUString&, SbxClassType, SbxDataType, bool bIsRuntimeFunction = false );
+ virtual void Insert( SbxVariable* );
+ // AB 23.4.1997, Optimization, Insertion without check for duplicate Entries and
+ // without Broadcasts, only used in SO2/auto.cxx
+ void QuickInsert( SbxVariable* );
+ void Remove( const OUString&, SbxClassType );
+ virtual void Remove( SbxVariable* );
+
+ // Direct access on arrays
+ SbxArray* GetMethods() { return pMethods.get(); }
+ SbxArray* GetProperties() { return pProps.get(); }
+ SbxArray* GetObjects() { return pObjs.get(); }
+ // Debugging
+ void Dump( SvStream&, bool bDumpAll );
+};
+
+#endif // INCLUDED_BASIC_SBXOBJ_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
new file mode 100644
index 000000000..0c5f84b60
--- /dev/null
+++ b/include/basic/sbxvar.hxx
@@ -0,0 +1,336 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_SBXVAR_HXX
+#define INCLUDED_BASIC_SBXVAR_HXX
+
+#include <rtl/character.hxx>
+#include <rtl/ustring.hxx>
+#include <basic/sbxcore.hxx>
+#include <basic/basicdllapi.h>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <algorithm>
+#include <cstddef>
+#include <cstring>
+#include <memory>
+
+
+namespace com::sun::star::bridge::oleautomation { struct Decimal; }
+
+class SbxDecimal;
+enum class SfxHintId;
+
+struct SbxValues
+{
+ union {
+ sal_uInt8 nByte;
+ sal_uInt16 nUShort;
+ sal_Unicode nChar;
+ sal_Int16 nInteger;
+ sal_uInt32 nULong;
+ sal_Int32 nLong;
+ unsigned int nUInt;
+ int nInt;
+ sal_uInt64 uInt64;
+ sal_Int64 nInt64;
+
+ float nSingle;
+ double nDouble;
+
+ OUString* pOUString;
+ SbxDecimal* pDecimal;
+
+ SbxBase* pObj;
+
+ sal_uInt8* pByte;
+ sal_uInt16* pUShort;
+ sal_Unicode* pChar;
+ sal_Int16* pInteger;
+ sal_uInt32* pULong;
+ sal_Int32* pLong;
+ sal_uInt64* puInt64;
+ sal_Int64* pnInt64;
+
+ float* pSingle;
+ double* pDouble;
+
+ void* pData;
+ };
+ SbxDataType eType;
+
+ SbxValues(): pData( nullptr ), eType(SbxEMPTY) {}
+ SbxValues( SbxDataType e ): eType(e) {}
+ SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
+
+ void clear(SbxDataType type) {
+ // A hacky way of zeroing the union value corresponding to the given type (even though the
+ // relevant zero value need not be represented by all-zero bits, in general) without evoking
+ // GCC 8 -Wclass-memaccess or loplugin:classmemaccess, and without having to turn the
+ // anonymous union into a non-anonymous one:
+ auto const p = static_cast<void *>(this);
+ std::memset(p, 0, offsetof(SbxValues, eType));
+ eType = type;
+ }
+};
+
+class BASIC_DLLPUBLIC SbxValue : public SbxBase
+{
+ // #55226 Transport additional infos
+ BASIC_DLLPRIVATE SbxValue* TheRealValue( bool bObjInObjError ) const;
+protected:
+ SbxValues aData; // Data
+ OUString aPic; // Picture-String
+ OUString aToolString; // tool string copy
+
+ virtual void Broadcast( SfxHintId ); // Broadcast-Call
+ virtual ~SbxValue() override;
+ virtual bool LoadData( SvStream&, sal_uInt16 ) override;
+ virtual bool StoreData( SvStream& ) const override;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXID_VALUE,1);
+ SbxValue();
+ SbxValue( SbxDataType );
+ SbxValue( const SbxValue& );
+ SbxValue& operator=( const SbxValue& );
+ virtual void Clear() override;
+ virtual bool IsFixed() const override;
+
+ bool IsInteger() const { return GetType() == SbxINTEGER ; }
+ bool IsLong() const { return GetType() == SbxLONG ; }
+ bool IsDouble() const { return GetType() == SbxDOUBLE ; }
+ bool IsString() const { return GetType() == SbxSTRING ; }
+ bool IsCurrency() const { return GetType() == SbxCURRENCY ; }
+ bool IsObject() const { return GetType() == SbxOBJECT ; }
+ bool IsBool() const { return GetType() == SbxBOOL ; }
+ bool IsErr() const { return GetType() == SbxERROR ; }
+ bool IsEmpty() const { return GetType() == SbxEMPTY ; }
+ bool IsNull() const { return GetType() == SbxNULL ; }
+ bool IsNumeric() const;
+ bool IsNumericRTL() const; // #41692 Interface for Basic
+ bool ImpIsNumeric( bool bOnlyIntntl ) const; // Implementation
+
+ virtual SbxDataType GetType() const override;
+ SbxDataType GetFullType() const { return aData.eType;}
+ bool SetType( SbxDataType );
+
+ bool Get( SbxValues& ) const;
+ const SbxValues& GetValues_Impl() const { return aData; }
+ bool Put( const SbxValues& );
+
+ SbxValues * data() { return &aData; }
+
+ sal_Unicode GetChar() const { return Get(SbxCHAR).nChar; }
+ sal_Int16 GetInteger() const { return Get(SbxINTEGER).nInteger; }
+ sal_Int32 GetLong() const { return Get(SbxLONG).nLong; }
+ sal_Int64 GetInt64() const { return Get(SbxSALINT64).nInt64; }
+ sal_uInt64 GetUInt64() const { return Get(SbxSALUINT64).uInt64; }
+
+ sal_Int64 GetCurrency() const { return Get(SbxCURRENCY).nInt64; }
+ SbxDecimal* GetDecimal() const { return Get(SbxDECIMAL).pDecimal; }
+
+ float GetSingle() const { return Get(SbxSINGLE).nSingle; }
+ double GetDouble() const { return Get(SbxDOUBLE).nDouble; }
+ double GetDate() const { return Get(SbxDATE).nDouble; }
+
+ bool GetBool() const { return Get(SbxBOOL).nUShort != 0; }
+ const OUString& GetCoreString() const;
+ OUString GetOUString() const;
+
+ SbxBase* GetObject() const { return Get(SbxOBJECT).pObj; }
+ sal_uInt8 GetByte() const { return Get(SbxBYTE).nByte; }
+ sal_uInt16 GetUShort() const { return Get(SbxUSHORT).nUShort; }
+ sal_uInt32 GetULong() const { return Get(SbxULONG).nULong; }
+
+ bool PutInteger( sal_Int16 );
+ bool PutLong( sal_Int32 );
+ bool PutSingle( float );
+ bool PutDouble( double );
+ void PutDate( double );
+ bool PutBool( bool );
+ void PutErr( sal_uInt16 );
+ void PutStringExt( const OUString& ); // with extended analysis (International, "sal_True"/"sal_False")
+ bool PutInt64( sal_Int64 );
+ bool PutUInt64( sal_uInt64 );
+ bool PutString( const OUString& );
+ bool PutChar( sal_Unicode );
+ bool PutByte( sal_uInt8 );
+ bool PutUShort( sal_uInt16 );
+ bool PutULong( sal_uInt32 );
+ bool PutEmpty();
+ void PutNull();
+
+ // Special methods
+ void PutDecimal( css::bridge::oleautomation::Decimal const & rAutomationDec );
+ bool PutDecimal( SbxDecimal* pDecimal ); // This function is needed for Windows build, don't remove
+ void fillAutomationDecimal( css::bridge::oleautomation::Decimal& rAutomationDec ) const;
+ bool PutCurrency( sal_Int64 );
+ // Interface for CDbl in Basic
+ static ErrCode ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false );
+
+ bool PutObject( SbxBase* );
+
+ bool Convert( SbxDataType );
+ bool Compute( SbxOperator, const SbxValue& );
+ bool Compare( SbxOperator, const SbxValue& ) const;
+ bool Scan( const OUString&, sal_uInt16* );
+ void Format( OUString&, const OUString* = nullptr ) const;
+
+ // The following operators are defined for easier handling.
+ // TODO: Ensure error conditions (overflow, conversions)
+ // are taken into consideration in Compute and Compare
+
+ inline bool operator <=( const SbxValue& ) const;
+ inline bool operator >=( const SbxValue& ) const;
+
+ inline SbxValue& operator *=( const SbxValue& );
+ inline SbxValue& operator /=( const SbxValue& );
+ inline SbxValue& operator +=( const SbxValue& );
+ inline SbxValue& operator -=( const SbxValue& );
+
+private:
+ SbxValues Get(SbxDataType t) const;
+};
+
+inline bool SbxValue::operator<=( const SbxValue& r ) const
+{ return Compare( SbxLE, r ); }
+
+inline bool SbxValue::operator>=( const SbxValue& r ) const
+{ return Compare( SbxGE, r ); }
+
+inline SbxValue& SbxValue::operator*=( const SbxValue& r )
+{ Compute( SbxMUL, r ); return *this; }
+
+inline SbxValue& SbxValue::operator/=( const SbxValue& r )
+{ Compute( SbxDIV, r ); return *this; }
+
+inline SbxValue& SbxValue::operator+=( const SbxValue& r )
+{ Compute( SbxPLUS, r ); return *this; }
+
+inline SbxValue& SbxValue::operator-=( const SbxValue& r )
+{ Compute( SbxMINUS, r ); return *this; }
+
+class SbxArray;
+class SbxInfo;
+
+typedef tools::SvRef<SbxArray> SbxArrayRef;
+
+typedef tools::SvRef<SbxInfo> SbxInfoRef;
+
+class SfxBroadcaster;
+
+class SbxVariableImpl;
+class StarBASIC;
+
+class BASIC_DLLPUBLIC SbxVariable : public SbxValue
+{
+ friend class SbMethod;
+
+ OUString m_aDeclareClassName;
+ css::uno::Reference< css::uno::XInterface > m_xComListener;
+ StarBASIC* m_pComListenerParentBasic = nullptr;
+ std::unique_ptr<SfxBroadcaster> mpBroadcaster; // Broadcaster, if needed
+ OUString maName; // Name, if available
+ mutable OUString maNameCI; // Name, case insensitive - cached for fast comparison
+ SbxArrayRef mpPar; // Parameter-Array, if set
+ sal_uInt16 nHash = 0; // Hash-ID for search
+
+protected:
+ SbxInfoRef pInfo; // Probably called information
+ sal_uInt32 nUserData= 0; // User data for Call()
+ SbxObject* pParent = nullptr; // Currently attached object
+ virtual ~SbxVariable() override;
+ virtual bool LoadData( SvStream&, sal_uInt16 ) override;
+ virtual bool StoreData( SvStream& ) const override;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXID_VARIABLE,2);
+ SbxVariable();
+ SbxVariable( SbxDataType );
+ SbxVariable( const SbxVariable& );
+ SbxVariable& operator=( const SbxVariable& );
+
+ void Dump( SvStream&, bool bDumpAll );
+
+ void SetName( const OUString& );
+ const OUString& GetName( SbxNameType = SbxNameType::NONE ) const;
+ sal_uInt16 GetHashCode() const { return nHash; }
+ static OUString NameToCaseInsensitiveName(const OUString& rName);
+
+ virtual void SetModified( bool ) override;
+
+ sal_uInt32 GetUserData() const { return nUserData; }
+ void SetUserData( sal_uInt32 n ) { nUserData = n; }
+
+ virtual SbxDataType GetType() const override;
+ virtual SbxClassType GetClass() const;
+
+ // Parameter-Interface
+ virtual SbxInfo* GetInfo();
+ void SetInfo( SbxInfo* p );
+ void SetParameters( SbxArray* p );
+ SbxArray* GetParameters() const;
+
+ // Sfx-Broadcasting-Support:
+ // Due to data reduction and better DLL-hierarchy currently via casting
+ SfxBroadcaster& GetBroadcaster();
+ bool IsBroadcaster() const { return mpBroadcaster != nullptr; }
+ virtual void Broadcast( SfxHintId nHintId ) override;
+
+ const SbxObject* GetParent() const { return pParent; }
+ SbxObject* GetParent() { return pParent;}
+ virtual void SetParent( SbxObject* );
+
+ const OUString& GetDeclareClassName() const;
+ void SetDeclareClassName( const OUString& );
+ void SetComListener( const css::uno::Reference< css::uno::XInterface >& xComListener,
+ StarBASIC* pParentBasic );
+ void ClearComListener();
+
+ // Create a simple hashcode: the first six characters are evaluated.
+ static constexpr sal_uInt16 MakeHashCode(std::u16string_view aName)
+ {
+ sal_uInt16 n = 0;
+ const auto first6 = aName.substr(0, 6);
+ for (const auto& c : first6)
+ {
+ if (!rtl::isAscii(c))
+ continue; // Just skip it to let non-ASCII strings have some hash variance
+ n = static_cast<sal_uInt16>((n << 3) + rtl::toAsciiUpperCase(c));
+ }
+ return n;
+ }
+};
+
+typedef tools::SvRef<SbxObject> SbxObjectRef;
+typedef tools::SvRef<SbxVariable> SbxVariableRef;
+
+//tdf#59222 SbxEnsureParentVariable is a SbxVariable which keeps a reference to
+//its parent, ensuring it always exists while this SbxVariable exists
+class SbxEnsureParentVariable final : public SbxVariable
+{
+ SbxObjectRef xParent;
+public:
+ SbxEnsureParentVariable(const SbxVariable& r);
+ virtual void SetParent(SbxObject* p) override;
+};
+
+#endif // INCLUDED_BASIC_SBXVAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/vbahelper.hxx b/include/basic/vbahelper.hxx
new file mode 100644
index 000000000..8d18b66b1
--- /dev/null
+++ b/include/basic/vbahelper.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASIC_VBAHELPER_HXX
+#define INCLUDED_BASIC_VBAHELPER_HXX
+
+#include <rtl/ustring.hxx>
+#include <basic/basicdllapi.h>
+
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+namespace basic::vba {
+
+/* This header contains public helper functions for VBA used from this module
+ and from other VBA implementation modules such as vbahelper.
+ */
+
+
+/** Locks or unlocks the controllers of all documents that have the same type
+ as the specified document.
+
+ First, the global module manager (com.sun.star.frame.ModuleManager) is
+ asked for the type of the passed model, and all open documents with the
+ same type will be locked or unlocked.
+
+ @param rxModel
+ A document model determining the type of the documents to be locked or
+ unlocked.
+
+ @param bLockControllers
+ Passing true will lock all controllers, passing false will unlock them.
+ */
+BASIC_DLLPUBLIC void lockControllersOfAllDocuments(
+ const css::uno::Reference< css::frame::XModel >& rxModel,
+ bool bLockControllers );
+
+
+/** Enables or disables the container windows of all controllers of all
+ documents that have the same type as the specified document.
+
+ First, the global module manager (com.sun.star.frame.ModuleManager) is
+ asked for the type of the passed model, and the container windows of all
+ open documents with the same type will be enabled or disabled.
+
+ @param rxModel
+ A document model determining the type of the documents to be enabled or
+ disabled.
+
+ @param bEnableWindows
+ Passing true will enable all container windows of all controllers,
+ passing false will disable them.
+ */
+BASIC_DLLPUBLIC void enableContainerWindowsOfAllDocuments(
+ const css::uno::Reference< css::frame::XModel >& rxModel,
+ bool bEnableWindows );
+
+
+/** Registers the passed path as working directory for the application the
+ passed document belongs to.
+
+ @param rxModel
+ A document model determining the type of the application whose working
+ directory has been changed.
+
+ @param rPath
+ The new working directory.
+ */
+BASIC_DLLPUBLIC void registerCurrentDirectory(
+ const css::uno::Reference< css::frame::XModel >& rxModel,
+ const OUString& rPath );
+
+
+} // namespace basic::vba
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx
new file mode 100644
index 000000000..63aea6239
--- /dev/null
+++ b/include/canvas/canvastools.hxx
@@ -0,0 +1,560 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CANVASTOOLS_HXX
+#define INCLUDED_CANVAS_CANVASTOOLS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <osl/diagnose.h>
+#include <rtl/ustring.hxx>
+#include <sal/log.hxx>
+
+#include <math.h>
+#include <string.h>
+#include <vector>
+#include <limits>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DRange;
+ class B2IRange;
+ class B2IPoint;
+ class B2DPolyPolygon;
+}
+
+namespace com::sun::star::geometry
+{
+ struct RealSize2D;
+ struct IntegerSize2D;
+ struct AffineMatrix2D;
+ struct Matrix2D;
+}
+
+namespace com::sun::star::rendering
+{
+ struct RenderState;
+ struct ViewState;
+ struct IntegerBitmapLayout;
+ class XCanvas;
+ struct Texture;
+ class XIntegerBitmapColorSpace;
+}
+
+namespace com::sun::star::awt
+{
+ struct Rectangle;
+ class XWindow2;
+}
+
+namespace com::sun::star::beans {
+ struct PropertyValue;
+}
+
+class Color;
+class OutputDevice;
+
+namespace canvas
+{
+ namespace tools
+ {
+ /** Compute the next highest power of 2 of a 32-bit value
+
+ Code devised by Sean Anderson, in good ole HAKMEM
+ tradition.
+
+ @return 1 << (lg(x - 1) + 1)
+ */
+ inline sal_uInt32 nextPow2( sal_uInt32 x )
+ {
+ --x;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+
+ return ++x;
+ }
+
+ /**
+ *
+ * Count the number of 1-bits of a n-bit value
+ *
+ */
+
+ /** Round given floating point value down to next integer
+ */
+ inline sal_Int32 roundDown( const double& rVal )
+ {
+ return static_cast< sal_Int32 >( floor( rVal ) );
+ }
+
+ /** Round given floating point value up to next integer
+ */
+ inline sal_Int32 roundUp( const double& rVal )
+ {
+ return static_cast< sal_Int32 >( ceil( rVal ) );
+ }
+
+ /** Create a RealSize2D with both coordinate values set to +infinity
+ */
+ CANVASTOOLS_DLLPUBLIC css::geometry::RealSize2D createInfiniteSize2D();
+
+
+ // View- and RenderState utilities
+
+
+ CANVASTOOLS_DLLPUBLIC css::rendering::RenderState&
+ initRenderState( css::rendering::RenderState& renderState );
+
+ CANVASTOOLS_DLLPUBLIC css::rendering::ViewState&
+ initViewState( css::rendering::ViewState& viewState );
+
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ getViewStateTransform( ::basegfx::B2DHomMatrix& transform,
+ const css::rendering::ViewState& viewState );
+
+ CANVASTOOLS_DLLPUBLIC css::rendering::ViewState&
+ setViewStateTransform( css::rendering::ViewState& viewState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ getRenderStateTransform( ::basegfx::B2DHomMatrix& transform,
+ const css::rendering::RenderState& renderState );
+
+ CANVASTOOLS_DLLPUBLIC css::rendering::RenderState&
+ setRenderStateTransform( css::rendering::RenderState& renderState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC css::rendering::RenderState&
+ appendToRenderState( css::rendering::RenderState& renderState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC css::rendering::RenderState&
+ prependToRenderState( css::rendering::RenderState& renderState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ mergeViewAndRenderTransform( ::basegfx::B2DHomMatrix& transform,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState );
+
+
+ // Matrix utilities
+
+
+ CANVASTOOLS_DLLPUBLIC css::geometry::AffineMatrix2D&
+ setIdentityAffineMatrix2D( css::geometry::AffineMatrix2D& matrix );
+
+ CANVASTOOLS_DLLPUBLIC css::geometry::Matrix2D&
+ setIdentityMatrix2D( css::geometry::Matrix2D& matrix );
+
+
+ // Special utilities
+
+
+ /** Calc the bounding rectangle of a transformed rectangle.
+
+ The method applies the given transformation to the
+ specified input rectangle, and returns the bounding box of
+ the resulting output area.
+
+ @param o_Rect
+ Output rectangle
+
+ @param i_Rect
+ Input rectangle
+
+ @param i_Transformation
+ Transformation to apply to the input rectangle
+
+ @return a reference to the resulting rectangle
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DRange& calcTransformedRectBounds( ::basegfx::B2DRange& o_Rect,
+ const ::basegfx::B2DRange& i_Rect,
+ const ::basegfx::B2DHomMatrix& i_Transformation );
+
+ /** Calc a transform that maps the upper, left corner of a
+ rectangle to the origin.
+
+ The method is a specialized version of
+ calcRectToRectTransform() (Removed now), mapping the input rectangle's
+ the upper, left corner to the origin, and leaving the size
+ untouched.
+
+ @param o_transform
+ Output parameter, to receive the resulting transformation
+ matrix.
+
+ @param i_srcRect
+ Input parameter, specifies the original source
+ rectangle. The resulting transformation will exactly map
+ the source rectangle's upper, left corner to the origin.
+
+ @param i_transformation
+ The original transformation matrix. This is changed with
+ translations (if necessary), to exactly map the source
+ rectangle to the origin.
+
+ @return a reference to the resulting transformation matrix
+
+ @see calcRectToRectTransform()
+ @see calcTransformedRectBounds()
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& calcRectToOriginTransform( ::basegfx::B2DHomMatrix& o_transform,
+ const ::basegfx::B2DRange& i_srcRect,
+ const ::basegfx::B2DHomMatrix& i_transformation );
+
+ /** Check whether a given rectangle is within another
+ transformed rectangle.
+
+ This method checks for polygonal containedness, i.e. the
+ transformed rectangle is not represented as an axis-aligned
+ rectangle anymore (like calcTransformedRectBounds()), but
+ polygonal. Thus, the insideness test is based on tight
+ bounds.
+
+ @param rContainedRect
+ This rectangle is checked, whether it is fully within the
+ transformed rTransformRect.
+
+ @param rTransformRect
+ This rectangle is transformed, and then checked whether it
+ fully contains rContainedRect.
+
+ @param rTransformation
+ This transformation is applied to rTransformRect
+ */
+ CANVASTOOLS_DLLPUBLIC bool isInside( const ::basegfx::B2DRange& rContainedRect,
+ const ::basegfx::B2DRange& rTransformRect,
+ const ::basegfx::B2DHomMatrix& rTransformation );
+
+ /** Clip a scroll to the given bound rect
+
+ @param io_rSourceArea
+ Source area to scroll. The resulting clipped source area
+ is returned therein.
+
+ @param io_rDestPoint
+ Destination point of the scroll (upper, left corner of
+ rSourceArea after the scroll). The new, resulting
+ destination point is returned therein.q
+
+ @param o_ClippedAreas
+ Vector of rectangles in the <em>destination</em> area
+ coordinate system, which are clipped away from the source
+ area, and thus need extra updates (i.e. they are not
+ correctly copy from the scroll operation, since there was
+ no information about them in the source).
+
+ @param rBounds
+ Bounds to clip against.
+
+ @return false, if the resulting scroll area is empty
+ */
+ CANVASTOOLS_DLLPUBLIC bool clipScrollArea( ::basegfx::B2IRange& io_rSourceArea,
+ ::basegfx::B2IPoint& io_rDestPoint,
+ ::std::vector< ::basegfx::B2IRange >& o_ClippedAreas,
+ const ::basegfx::B2IRange& rBounds );
+
+ /** Clip a blit between two differently surfaces.
+
+ This method clips source and dest rect for a clip between
+ two differently clipped surfaces, such that the resulting
+ blit rects are fully within both clip areas.
+
+ @param io_rSourceArea
+ Source area of the blit. Returned therein is the computed
+ clipped source area.
+
+ @param io_rDestPoint
+ Dest area of the blit. Returned therein is the computed
+ clipped dest area.
+
+ @param rSourceBounds
+ Clip bounds of the source surface
+
+ @param rDestBounds
+ Clip bounds of the dest surface
+
+ @return false, if the resulting blit is empty, i.e. fully
+ clipped away.
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2IRange spritePixelAreaFromB2DRange( const ::basegfx::B2DRange& rRange );
+
+ /** Retrieve various internal properties of the actual canvas implementation.
+
+ This method retrieves a bunch of internal, implementation-
+ and platform-dependent values from the canvas
+ implementation. Among them are for example operating
+ system window handles. The actual layout and content of
+ the returned sequence is dependent on the component
+ implementation, undocumented and subject to change.
+
+ @param i_rxCanvas
+ Input parameter, the canvas representation for which the device information
+ is to be retrieved
+
+ @param o_rxParams
+ Output parameter, the sequence of Anys that hold the device parameters. Layout is as described above
+
+ @return A reference to the resulting sequence of parameters
+ */
+ CANVASTOOLS_DLLPUBLIC css::uno::Sequence< css::uno::Any >& getDeviceInfo(
+ const css::uno::Reference< css::rendering::XCanvas >& i_rxCanvas,
+ css::uno::Sequence< css::uno::Any >& o_rxParams );
+
+ /** Return a color space for a default RGBA integer format
+
+ Use this method for dead-simple bitmap implementations,
+ that map all their formats to 8888 RGBA color.
+ */
+ CANVASTOOLS_DLLPUBLIC css::uno::Reference< css::rendering::XIntegerBitmapColorSpace> const & getStdColorSpace();
+
+ /** Return a color space for a default RGB integer format
+
+ Use this method for dead-simple bitmap implementations,
+ that map all their formats to 8888 RGB color (the last byte
+ is unused).
+ */
+ CANVASTOOLS_DLLPUBLIC css::uno::Reference< css::rendering::XIntegerBitmapColorSpace> const & getStdColorSpaceWithoutAlpha();
+
+ /** Return a memory layout for a default RGBA integer format
+
+ Use this method for dead-simple bitmap implementations,
+ that map all their formats to 8888 RGBA color.
+ */
+ CANVASTOOLS_DLLPUBLIC css::rendering::IntegerBitmapLayout getStdMemoryLayout(
+ const css::geometry::IntegerSize2D& rBitmapSize );
+
+ /// Convert standard 8888 RGBA color to vcl color
+ CANVASTOOLS_DLLPUBLIC css::uno::Sequence<sal_Int8> colorToStdIntSequence( const ::Color& rColor );
+
+ // Modelled closely after boost::numeric_cast, only that we
+ // issue some trace output here and throw a RuntimeException
+
+ /** Cast numeric value into another (numeric) data type
+
+ Apart from converting the numeric value, this template
+ also checks if any overflow, underflow, or sign
+ information is lost (if yes, it throws an
+ uno::RuntimeException.
+ */
+ template< typename Target, typename Source > inline Target numeric_cast( Source arg )
+ {
+ // typedefs abbreviating respective trait classes
+ typedef ::std::numeric_limits< Source > SourceLimits;
+ typedef ::std::numeric_limits< Target > TargetLimits;
+
+#undef min
+#undef max
+
+ if( ( arg<0 && !TargetLimits::is_signed) || // losing the sign here
+ ( SourceLimits::is_signed && arg<TargetLimits::min()) || // underflow will happen
+ ( arg>TargetLimits::max() ) ) // overflow will happen
+ {
+# if OSL_DEBUG_LEVEL > 2
+ SAL_WARN("canvas", "numeric_cast detected data loss");
+#endif
+ throw css::uno::RuntimeException(
+ "numeric_cast detected data loss",
+ nullptr );
+ }
+
+ return static_cast<Target>(arg);
+ }
+
+ CANVASTOOLS_DLLPUBLIC css::awt::Rectangle getAbsoluteWindowRect(
+ const css::awt::Rectangle& rRect,
+ const css::uno::Reference< css::awt::XWindow2 >& xWin );
+
+ /** Retrieve for small bound marks around each corner of the given rectangle
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DPolyPolygon getBoundMarksPolyPolygon( const ::basegfx::B2DRange& rRange );
+
+ /** Calculate number of gradient "strips" to generate (takes
+ into account device resolution)
+
+ @param nColorSteps
+ Maximal integer difference between all color stops, needed
+ for smooth gradient color differences
+ */
+ CANVASTOOLS_DLLPUBLIC int calcGradientStepCount( ::basegfx::B2DHomMatrix& rTotalTransform,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState,
+ const css::rendering::Texture& texture,
+ int nColorSteps );
+
+ /** A very simplistic map for ASCII strings and arbitrary value
+ types.
+
+ This class internally references a constant, static array of
+ sorted MapEntries, and performs a binary search to look up
+ values for a given query string. Note that this map is static,
+ i.e. not meant to be extended at runtime.
+
+ @tpl ValueType
+ The value type this map should store, associated with an ASCII
+ string.
+ */
+ template< typename ValueType > class ValueMap
+ {
+ public:
+ struct MapEntry
+ {
+ const char* maKey;
+ ValueType maValue;
+ };
+
+ /** Create a ValueMap for the given array of MapEntries.
+
+ @param pMap
+ Pointer to a <em>static</em> array of MapEntries. Must
+ live longer than this object! Make absolutely sure that
+ the string entries passed via pMap are ASCII-only -
+ everything else might not yield correct string
+ comparisons, and thus will result in undefined behaviour.
+
+ @param nEntries
+ Number of entries for pMap
+
+ @param bCaseSensitive
+ Whether the map query should be performed case sensitive
+ or not. When bCaseSensitive is false, all MapEntry strings
+ must be lowercase!
+ */
+ ValueMap( const MapEntry* pMap,
+ ::std::size_t nEntries,
+ bool bCaseSensitive ) :
+ mpMap( pMap ),
+ mnEntries( nEntries ),
+ mbCaseSensitive( bCaseSensitive )
+ {
+#ifdef DBG_UTIL
+ // Ensure that map entries are sorted (and all lowercase, if this
+ // map is case insensitive)
+ const OString aStr( pMap->maKey );
+ if( !mbCaseSensitive &&
+ aStr != aStr.toAsciiLowerCase() )
+ {
+ SAL_WARN("canvas", "ValueMap::ValueMap(): Key is not lowercase " << pMap->maKey);
+ }
+
+ if( mnEntries <= 1 )
+ return;
+
+ for( ::std::size_t i=0; i<mnEntries-1; ++i, ++pMap )
+ {
+ if( !mapComparator(pMap[0], pMap[1]) &&
+ mapComparator(pMap[1], pMap[0]) )
+ {
+ SAL_WARN("canvas", "ValueMap::ValueMap(): Map is not sorted, keys are wrong, "
+ << pMap[0].maKey << " and " << pMap[1].maKey);
+ OSL_FAIL( "ValueMap::ValueMap(): Map is not sorted" );
+ }
+
+ const OString aStr2( pMap[1].maKey );
+ if( !mbCaseSensitive &&
+ aStr2 != aStr2.toAsciiLowerCase() )
+ {
+ SAL_WARN("canvas", "ValueMap::ValueMap(): Key is not lowercase" << pMap[1].maKey);
+ }
+ }
+#endif
+ }
+
+ /** Lookup a value for the given query string
+
+ @param rName
+ The string to lookup. If the map was created with the case
+ insensitive flag, the lookup is performed
+ case-insensitive, otherwise, case-sensitive.
+
+ @param o_rResult
+ Output parameter, which receives the value associated with
+ the query string. If no value was found, the referenced
+ object is kept unmodified.
+
+ @return true, if a matching entry was found.
+ */
+ bool lookup( const OUString& rName,
+ ValueType& o_rResult ) const
+ {
+ // rName is required to contain only ASCII characters.
+ // TODO(Q1): Enforce this at upper layers
+ OString aKey( OUStringToOString( mbCaseSensitive ? rName : rName.toAsciiLowerCase(),
+ RTL_TEXTENCODING_ASCII_US ) );
+ MapEntry aSearchKey =
+ {
+ aKey.getStr(),
+ ValueType()
+ };
+
+ const MapEntry* pEnd = mpMap+mnEntries;
+ const MapEntry* pRes = ::std::lower_bound( mpMap,
+ pEnd,
+ aSearchKey,
+ &mapComparator );
+ if( pRes != pEnd )
+ {
+ // place to _insert before_ found - is it equal to
+ // the search key?
+ if( strcmp( pRes->maKey, aSearchKey.maKey ) == 0 )
+ {
+ // yep, correct entry found
+ o_rResult = pRes->maValue;
+ return true;
+ }
+ }
+
+ // not found
+ return false;
+ }
+
+ private:
+ static bool mapComparator( const MapEntry& rLHS,
+ const MapEntry& rRHS )
+ {
+ return strcmp( rLHS.maKey,
+ rRHS.maKey ) < 0;
+ }
+
+ const MapEntry* mpMap;
+ ::std::size_t mnEntries;
+ bool mbCaseSensitive;
+ };
+
+ CANVASTOOLS_DLLPUBLIC void clipOutDev(const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState,
+ OutputDevice& rOutDev,
+ OutputDevice* p2ndOutDev=nullptr);
+
+ CANVASTOOLS_DLLPUBLIC void extractExtraFontProperties(const css::uno::Sequence<css::beans::PropertyValue>& rExtraFontProperties,
+ sal_uInt32& rEmphasisMark);
+ }
+}
+
+#endif /* INCLUDED_CANVAS_CANVASTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/canvastoolsdllapi.h b/include/canvas/canvastoolsdllapi.h
new file mode 100644
index 000000000..a3748371a
--- /dev/null
+++ b/include/canvas/canvastoolsdllapi.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CANVASTOOLSDLLAPI_H
+#define INCLUDED_CANVAS_CANVASTOOLSDLLAPI_H
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined(CANVASTOOLS_DLLIMPLEMENTATION)
+#define CANVASTOOLS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define CANVASTOOLS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define CANVASTOOLS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/elapsedtime.hxx b/include/canvas/elapsedtime.hxx
new file mode 100644
index 000000000..cf73af960
--- /dev/null
+++ b/include/canvas/elapsedtime.hxx
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ELAPSEDTIME_HXX
+#define INCLUDED_CANVAS_ELAPSEDTIME_HXX
+
+#include <canvas/canvastoolsdllapi.h>
+#include <memory>
+
+namespace canvas::tools
+{
+ /** Calculate elapsed time.
+
+ This class provides several time-measurement and
+ -management functions. In its simplest use-case, it
+ measures the time from its creation.
+ */
+ class CANVASTOOLS_DLLPUBLIC ElapsedTime
+ {
+ public:
+ /** Create a new ElapsedTime object
+
+ The moment of construction starts the time
+ measurement. That means, a subsequent getElapsedTime()
+ call will return the time difference between object
+ creation and getElapsedTime() call.
+ */
+ ElapsedTime();
+
+ /** Creates a new ElapsedTime object based on another
+ timer.
+
+ The moment of construction starts the time
+ measurement. That means, a subsequent getElapsedTime()
+ call will return the time difference between object
+ creation and getElapsedTime() call. All time values
+ are not taken from the system's time base, but from
+ the provided timer.
+ */
+ ElapsedTime( std::shared_ptr<ElapsedTime> xTimeBase );
+
+ /** Reset the time
+
+ The instance of the reset() call starts the time
+ measurement from scratch. That means, a subsequent
+ getElapsedTime() call will return the time difference
+ between reset() and getElapsedTime() call.
+ */
+ void reset();
+
+ /** Query the elapsed time
+
+ This method returns the elapsed time in seconds
+ between either the construction of this object, or the
+ last reset() call, if any (but see the time modulation
+ methods below, for means to modify the otherwise
+ continuous flow of time).
+
+ @return the elapsed time in seconds.
+ */
+ double getElapsedTime() const;
+
+ /** Pauses the running timer.
+
+ This method stops the time, as returned by this
+ object, until continueTimer() is called. During this
+ period, getElapsedTime() will always return the same
+ time value (i.e. the instant when pauseTimer() was
+ called).
+ */
+ void pauseTimer();
+
+ /** Continues the paused timer.
+
+ This method re-enables the time flow, that is, time
+ starts running again for clients calling
+ getElapsedTime(). The (subtle) difference to the
+ holdTimer/releaseTimer() methods below is, that there
+ is no perceived time 'jump' between the pauseTimer()
+ call and the continueTimer() call, i.e. the time
+ starts over with the same value it has stopped on
+ pauseTimer().
+ */
+ void continueTimer();
+
+ /** Adjusts the timer, hold and pause times.
+
+ This method modifies the time as returned by this
+ object by the specified amount. This affects the time
+ as returned by getElapsedTime(), regardless of the
+ mode (e.g. paused, or on hold).
+
+ @param fOffset
+ This value will be added to the current time, i.e. the
+ next call to getElapsedTime() (when performed
+ immediately) will be adjusted by fOffset.
+ */
+ void adjustTimer( double fOffset );
+
+ /** Holds the current time.
+
+ This call makes the timer hold the current time
+ (e.g. getElapsedTime() will return the time when
+ holdTimer() was called), while the underlying time is
+ running on. When releaseTimer() is called, the time
+ will 'jump' to the then-current, underlying time. This
+ is equivalent to pressing the "interim time" button on
+ a stop watch, which shows this stopped time, while the
+ clock keeps running internally.
+ */
+ void holdTimer();
+
+ /** Releases a held timer.
+
+ After this call, the timer again returns the running
+ time on getElapsedTime().
+ */
+ void releaseTimer();
+
+ private:
+ static double getSystemTime();
+ double getCurrentTime() const;
+ double getElapsedTimeImpl() const; // does not set m_fLastQueriedTime
+
+ const std::shared_ptr<ElapsedTime> m_pTimeBase;
+
+ /// To validate adjustTimer() calls with bLimitToLastQueriedTime=true
+ mutable double m_fLastQueriedTime;
+
+ /// Start time, from which the difference to the time base is returned
+ double m_fStartTime;
+
+ /// Instant, when last pause or hold started, relative to m_fStartTime
+ double m_fFrozenTime;
+
+ /// True, when in pause mode
+ bool m_bInPauseMode;
+
+ /// True, when in hold mode
+ bool m_bInHoldMode;
+ };
+
+}
+
+#endif /* INCLUDED_CANVAS_ELAPSEDTIME_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/codemaker.hxx b/include/codemaker/codemaker.hxx
new file mode 100644
index 000000000..cf22b8a1f
--- /dev/null
+++ b/include/codemaker/codemaker.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_CODEMAKER_HXX
+#define INCLUDED_CODEMAKER_CODEMAKER_HXX
+
+#include <sal/config.h>
+
+namespace rtl
+{
+class OString;
+class OUString;
+}
+
+namespace codemaker
+{
+rtl::OString convertString(rtl::OUString const& string);
+}
+
+#endif // INCLUDED_CODEMAKER_CODEMAKER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/commoncpp.hxx b/include/codemaker/commoncpp.hxx
new file mode 100644
index 000000000..9c55fcc6a
--- /dev/null
+++ b/include/codemaker/commoncpp.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_COMMONCPP_HXX
+#define INCLUDED_CODEMAKER_COMMONCPP_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <codemaker/unotype.hxx>
+
+namespace rtl {
+ class OString;
+ class OUString;
+}
+
+namespace codemaker::cpp {
+
+/** Stick a namespace scope to c++ type
+
+ @param type
+ Undecorated type
+
+ @param ns_alias
+ Use common namespace aliases instead of fully specified (nested)
+ namespace. currently replaces com::sun::star with css.
+ */
+rtl::OString scopedCppName(rtl::OString const & type, bool ns_alias=true);
+
+rtl::OString translateUnoToCppType(
+ codemaker::UnoType::Sort sort, std::u16string_view nucleus);
+
+enum class IdentifierTranslationMode {
+ Global,
+ NonGlobal
+};
+
+rtl::OString translateUnoToCppIdentifier(
+ rtl::OString const & identifier, std::string_view prefix,
+ IdentifierTranslationMode transmode = IdentifierTranslationMode::Global,
+ rtl::OString const * forbidden = nullptr);
+
+}
+
+#endif // INCLUDED_CODEMAKER_COMMONCPP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/commonjava.hxx b/include/codemaker/commonjava.hxx
new file mode 100644
index 000000000..daac32263
--- /dev/null
+++ b/include/codemaker/commonjava.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_COMMONJAVA_HXX
+#define INCLUDED_CODEMAKER_COMMONJAVA_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <codemaker/unotype.hxx>
+
+namespace rtl { class OString; }
+
+namespace codemaker::java {
+
+rtl::OString translateUnoToJavaType(
+ codemaker::UnoType::Sort sort, std::string_view nucleus,
+ bool referenceType);
+
+rtl::OString translateUnoToJavaIdentifier(
+ rtl::OString const & identifier, std::string_view prefix);
+
+}
+
+#endif // INCLUDED_CODEMAKER_COMMONJAVA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/exceptiontree.hxx b/include/codemaker/exceptiontree.hxx
new file mode 100644
index 000000000..4d5055f8e
--- /dev/null
+++ b/include/codemaker/exceptiontree.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_EXCEPTIONTREE_HXX
+#define INCLUDED_CODEMAKER_EXCEPTIONTREE_HXX
+
+#include <rtl/ref.hxx>
+#include <rtl/string.hxx>
+
+#include <memory>
+#include <utility>
+#include <vector>
+
+class TypeManager;
+
+namespace codemaker {
+
+/**
+ Represents a node of the hierarchy from the ExceptionTree class.
+ */
+struct ExceptionTreeNode {
+ typedef std::vector< std::unique_ptr<ExceptionTreeNode> > Children;
+
+ // Internally used by ExceptionTree:
+ ExceptionTreeNode(rtl::OString theName):
+ name(std::move(theName)), present(false) {}
+
+ // Internally used by ExceptionTree:
+ ~ExceptionTreeNode() { clearChildren(); }
+
+ // Internally used by ExceptionTree:
+ void setPresent() { present = true; clearChildren(); }
+
+ // Internally used by ExceptionTree:
+ ExceptionTreeNode * add(rtl::OString const & theName);
+
+ rtl::OString name;
+ bool present;
+ Children children;
+
+private:
+ ExceptionTreeNode(ExceptionTreeNode const &) = delete;
+ ExceptionTreeNode& operator =(ExceptionTreeNode const &) = delete;
+
+ void clearChildren();
+};
+
+/**
+ Represents the hierarchy formed by a set of UNO exception types.
+
+ The hierarchy is rooted at com.sun.star.uno.Exception. For each exception E
+ from the given set S, the hierarchy from com.sun.star.uno.Exception to the
+ first supertype E' of E which is itself a member of S is represented (i.e.,
+ subtypes that are hidden by supertypes are pruned from the hierarchy). The
+ exception com.sun.star.uno.RuntimeException and its subtypes are pruned
+ completely from the hierarchy. Each node of the hierarchy is represented by
+ an instance of ExceptionTreeNode, where `name` gives the name of the UNO
+ exception type, `present` is true iff the given exception type is a member of
+ the set S, and `children` contains all the relevant direct subtypes of the
+ given exception type, in no particular order (for nodes other than the root
+ node it holds that `children` is non-empty iff `present` is false).
+ */
+class ExceptionTree {
+public:
+ ExceptionTree(): m_root("com.sun.star.uno.Exception") {}
+
+ /**
+ Builds the exception hierarchy, by adding one exception type at a time.
+
+ This function can be called more than once for the same exception name.
+
+ @param name the name of a UNO exception type; it is an error if the given
+ name does not represent a UNO exception type
+
+ @param manager a type manager, used to resolve type names; it is an error
+ if different calls to this member function use different, incompatible
+ type managers
+ */
+ void add(
+ rtl::OString const & name,
+ rtl::Reference< TypeManager > const & manager);
+
+ /**
+ Gives access to the resultant exception hierarchy.
+
+ @return a reference to the root of the exception hierarchy, as
+ formed by all previous calls to add; it is an error if any calls to add
+ follow the first call to getRoot
+ */
+ ExceptionTreeNode const & getRoot() const { return m_root; }
+
+private:
+ ExceptionTree(ExceptionTree const &) = delete;
+ ExceptionTree& operator =(const ExceptionTree&) = delete;
+
+ ExceptionTreeNode m_root;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/generatedtypeset.hxx b/include/codemaker/generatedtypeset.hxx
new file mode 100644
index 000000000..cc2827cb9
--- /dev/null
+++ b/include/codemaker/generatedtypeset.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX
+#define INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX
+
+#include <rtl/string.hxx>
+
+#include <unordered_set>
+
+/// @HTML
+
+namespace codemaker
+{
+/**
+ A simple class to track which types have already been processed by a code
+ maker.
+
+ <p>This class is not multi-thread&ndash;safe.</p>
+ */
+class GeneratedTypeSet
+{
+public:
+ GeneratedTypeSet() {}
+
+ /**
+ Add a type to the set of generated types.
+
+ <p>If the type was already present, nothing happens.</p>
+
+ @param type a UNO type registry name
+ */
+ void add(OString const& type) { m_set.insert(type); }
+
+ /**
+ Checks whether a given type has already been generated.
+
+ @param type a UNO type registry name
+
+ @return true iff the given type has already been generated
+ */
+ bool contains(OString const& type) const { return m_set.find(type) != m_set.end(); }
+
+private:
+ GeneratedTypeSet(GeneratedTypeSet const&) = delete;
+ GeneratedTypeSet& operator=(GeneratedTypeSet const&) = delete;
+
+ std::unordered_set<OString> m_set;
+};
+}
+
+#endif // INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/global.hxx b/include/codemaker/global.hxx
new file mode 100644
index 000000000..e62e1a973
--- /dev/null
+++ b/include/codemaker/global.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_GLOBAL_HXX
+#define INCLUDED_CODEMAKER_GLOBAL_HXX
+
+#include <utility>
+#include <vector>
+#include <string_view>
+
+#include <osl/file.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/strbuf.hxx>
+
+typedef ::std::vector< ::rtl::OString > StringVector;
+
+
+// FileStream
+
+class FileStream final
+{
+public:
+ FileStream();
+ ~FileStream();
+
+ bool isValid() const;
+
+ void createTempFile(const ::rtl::OString& sPath);
+ void close();
+
+ const ::rtl::OString& getName() const { return m_name; }
+
+ bool write(void const * buffer, sal_uInt64 size);
+
+ // friend functions
+ friend FileStream &operator<<(FileStream& o, sal_uInt32 i);
+ friend FileStream &operator<<(FileStream& o, char const * s);
+ friend FileStream &operator<<(FileStream& o, ::rtl::OString const * s);
+ friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s);
+ friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer const * s);
+ friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s);
+ friend FileStream & operator <<(FileStream & out, std::u16string_view s);
+
+private:
+ oslFileHandle m_file;
+ ::rtl::OString m_name;
+};
+
+
+// Helper functions
+
+::rtl::OString getTempDir(const ::rtl::OString& sFileName);
+
+::rtl::OString createFileNameFromType(const ::rtl::OString& destination,
+ const ::rtl::OString& type,
+ const ::rtl::OString& postfix);
+
+bool fileExists(const ::rtl::OString& fileName);
+bool makeValidTypeFile(const ::rtl::OString& targetFileName,
+ const ::rtl::OString& tmpFileName,
+ bool bFileCheck);
+bool removeTypeFile(const ::rtl::OString& fileName);
+
+::rtl::OUString convertToFileUrl(const ::rtl::OString& fileName);
+
+class CannotDumpException final {
+public:
+ CannotDumpException(OUString message): message_(std::move(message)) {}
+
+ ~CannotDumpException() noexcept;
+
+ const OUString& getMessage() const { return message_; }
+
+private:
+ OUString message_;
+};
+
+#endif // INCLUDED_CODEMAKER_GLOBAL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/options.hxx b/include/codemaker/options.hxx
new file mode 100644
index 000000000..803274901
--- /dev/null
+++ b/include/codemaker/options.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_OPTIONS_HXX
+#define INCLUDED_CODEMAKER_OPTIONS_HXX
+
+#include <codemaker/global.hxx>
+#include <unordered_map>
+#include <utility>
+
+typedef std::unordered_map
+<
+ ::rtl::OString,
+ ::rtl::OString,
+ OStringHash
+> OptionMap;
+
+class IllegalArgument
+{
+public:
+ IllegalArgument(::rtl::OString msg)
+ : m_message(std::move(msg)) {}
+
+ ::rtl::OString m_message;
+};
+
+class Options
+{
+public:
+ Options();
+ virtual ~Options();
+
+ /// @throws IllegalArgument
+ virtual bool initOptions(int ac, char* av[], bool bCmdFile=false) = 0;
+
+ virtual ::rtl::OString prepareHelp() = 0;
+
+ const ::rtl::OString& getProgramName() const { return m_program;}
+ bool isValid(const ::rtl::OString& option) const;
+ /// @throws IllegalArgument
+ const OString& getOption(const ::rtl::OString& option) const;
+
+ const StringVector& getInputFiles() const { return m_inputFiles;}
+
+ const StringVector& getExtraInputFiles() const
+ { return m_extra_input_files; }
+protected:
+ ::rtl::OString m_program;
+ StringVector m_inputFiles;
+ StringVector m_extra_input_files;
+ OptionMap m_options;
+};
+
+#endif // INCLUDED_CODEMAKER_OPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/typemanager.hxx b/include/codemaker/typemanager.hxx
new file mode 100644
index 000000000..3e6f67fe4
--- /dev/null
+++ b/include/codemaker/typemanager.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_TYPEMANAGER_HXX
+#define INCLUDED_CODEMAKER_TYPEMANAGER_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+#include <vector>
+
+#include <codemaker/unotype.hxx>
+#include <rtl/ref.hxx>
+#include <rtl/string.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+namespace unoidl {
+ class Entity;
+ class Manager;
+ class MapCursor;
+ class Provider;
+}
+
+class TypeManager final : public salhelper::SimpleReferenceObject {
+public:
+ TypeManager();
+
+ void loadProvider(OUString const & uri, bool primary);
+
+ bool foundAtPrimaryProvider(OUString const & name) const;
+
+ codemaker::UnoType::Sort getSort(
+ OUString const & name, rtl::Reference< unoidl::Entity > * entity = nullptr,
+ rtl::Reference< unoidl::MapCursor > * cursor = nullptr) const;
+
+ codemaker::UnoType::Sort decompose(
+ std::u16string_view name, bool resolveTypedefs, OUString * nucleus,
+ sal_Int32 * rank, std::vector< OUString > * arguments,
+ rtl::Reference< unoidl::Entity > * entity) const;
+
+private:
+ virtual ~TypeManager() override;
+
+ rtl::Reference< unoidl::Manager > manager_;
+ std::vector< rtl::Reference< unoidl::Provider > > primaryProviders_;
+};
+
+
+inline OString u2b(std::u16string_view s) {
+ return OUStringToOString(s, RTL_TEXTENCODING_UTF8);
+}
+
+inline OUString b2u(std::string_view s) {
+ return OStringToOUString(s, RTL_TEXTENCODING_UTF8);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/unotype.hxx b/include/codemaker/unotype.hxx
new file mode 100644
index 000000000..606321873
--- /dev/null
+++ b/include/codemaker/unotype.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_UNOTYPE_HXX
+#define INCLUDED_CODEMAKER_UNOTYPE_HXX
+
+#include <sal/types.h>
+
+#include <vector>
+
+namespace rtl { class OString; }
+
+namespace codemaker::UnoType {
+ /**
+ An enumeration of all the sorts of relevant UNOIDL entities.
+ */
+ enum class Sort {
+ Void,
+ Boolean,
+ Byte,
+ Short,
+ UnsignedShort,
+ Long,
+ UnsignedLong,
+ Hyper,
+ UnsignedHyper,
+ Float,
+ Double,
+ Char,
+ String,
+ Type,
+ Any,
+ Sequence,
+ Module,
+ Enum,
+ PlainStruct,
+ PolymorphicStructTemplate,
+ InstantiatedPolymorphicStruct,
+ Exception,
+ Interface,
+ Typedef,
+ ConstantGroup,
+ SingleInterfaceBasedService,
+ AccumulationBasedService,
+ InterfaceBasedSingleton,
+ ServiceBasedSingleton
+ };
+
+ /**
+ Decomposes a UNO type name or UNO type registry name.
+
+ @param type a binary UNO type name or UNO type registry name
+
+ @param rank if non-null, returns the rank of the denoted UNO type (which
+ is zero for any given type that does not denote a UNO sequence type)
+
+ @param arguments if non-null, the type arguments are stripped from an
+ instantiated polymorphic struct type and returned via this parameter (in
+ the correct order); if null, type arguments are not stripped from
+ instantiated polymorphic struct types
+
+ @return the base part of the given type
+ */
+ rtl::OString decompose(
+ rtl::OString const & type, sal_Int32 * rank = nullptr,
+ std::vector< rtl::OString > * arguments = nullptr);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h
new file mode 100644
index 000000000..f232ccd90
--- /dev/null
+++ b/include/com/sun/star/uno/Any.h
@@ -0,0 +1,493 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_COM_SUN_STAR_UNO_ANY_H
+#define INCLUDED_COM_SUN_STAR_UNO_ANY_H
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "rtl/ustring.hxx"
+#include "uno/any2.h"
+#include "typelib/typedescription.h"
+#include "cppu/unotype.hxx"
+#include "com/sun/star/uno/TypeClass.hdl"
+#include "rtl/alloc.h"
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+class Type;
+
+/** C++ class representing an IDL any.
+ This class is used to transport any type defined in IDL. The class inherits from the
+ binary C representation of uno_Any.
+ You can insert a value by using the <<= operators.
+ No any can hold an any. You can extract values from an any by using the >>= operators which
+ return true if the any contains an assignable value (no data loss), e.g. the any contains a
+ short and you >>= it into a long variable.
+*/
+class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI Any : public uno_Any
+{
+public:
+ /// @cond INTERNAL
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new ( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete ( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new ( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete ( void *, void * )
+ {}
+ /// @endcond
+
+ /** Default constructor: Any holds no value; its type is void.
+ */
+ inline Any();
+
+ /** Templated ctor. Sets a copy of the given value.
+
+ @param value value of the Any
+ */
+ template <typename T>
+ explicit inline Any( T const & value );
+ /// Ctor support for C++ bool.
+ explicit inline Any( bool value );
+
+#if defined LIBO_INTERNAL_ONLY
+ template<typename T1, typename T2>
+ explicit inline Any(rtl::OUStringConcat<T1, T2> && value);
+ template<typename T1, typename T2>
+ explicit Any(rtl::OUStringConcat<T1, T2> const &) = delete;
+ template<typename T> explicit inline Any(rtl::OUStringNumber<T> && value);
+ template<typename T> explicit Any(rtl::OUStringNumber<T> const &) = delete;
+ template <std::size_t N> explicit inline Any(const rtl::OUStringLiteral<N>& value);
+#endif
+
+ /** Copy constructor: Sets value of the given any.
+
+ @param rAny another any
+ */
+ inline Any( const Any & rAny );
+
+ /** Constructor: Sets a copy of the given data.
+
+ @param pData_ value
+ @param rType type of value
+ */
+ inline Any( const void * pData_, const Type & rType );
+
+ /** Constructor: Sets a copy of the given data.
+
+ @param pData_ value
+ @param pTypeDescr type of value
+ */
+ inline Any( const void * pData_, typelib_TypeDescription * pTypeDescr );
+
+ /** Constructor: Sets a copy of the given data.
+
+ @param pData_ value
+ @param pType_ type of value
+ */
+ inline Any( const void * pData_, typelib_TypeDescriptionReference * pType_ );
+
+#if defined LIBO_INTERNAL_ONLY
+ Any(bool const *, Type const &) = delete;
+ Any(bool const *, typelib_TypeDescription *) = delete;
+ Any(bool const *, typelib_TypeDescriptionReference *) = delete;
+ Any(sal_Bool const *, Type const &) = delete;
+ Any(sal_Bool const *, typelib_TypeDescription *) = delete;
+ Any(sal_Bool const *, typelib_TypeDescriptionReference *) = delete;
+ Any(std::nullptr_t, Type const & type):
+ Any(static_cast<void *>(nullptr), type) {}
+ Any(std::nullptr_t, typelib_TypeDescription * type):
+ Any(static_cast<void *>(nullptr), type) {}
+ Any(std::nullptr_t, typelib_TypeDescriptionReference * type):
+ Any(static_cast<void *>(nullptr), type) {}
+#endif
+
+ /** Destructor: Destructs any content and frees memory.
+ */
+ inline ~Any();
+
+ /** Assignment operator: Sets the value of the given any.
+
+ @param rAny another any (right side)
+ @return this any
+ */
+ inline Any & SAL_CALL operator = ( const Any & rAny );
+
+#if defined LIBO_INTERNAL_ONLY
+ inline Any(Any && other) noexcept;
+ inline Any & operator =(Any && other) noexcept;
+#endif
+
+ /** Gets the type of the set value.
+
+ @return a Type object of the set value
+ */
+ const Type & SAL_CALL getValueType() const
+ { return * reinterpret_cast< const Type * >( &pType ); }
+ /** Gets the type of the set value.
+
+ @return the unacquired type description reference of the set value
+ */
+ typelib_TypeDescriptionReference * SAL_CALL getValueTypeRef() const
+ { return pType; }
+
+ /** Gets the type description of the set value. Provides ownership of the type description!
+ Call an explicit typelib_typedescription_release() to release afterwards.
+
+ @param ppTypeDescr a pointer to type description pointer
+ */
+ void SAL_CALL getValueTypeDescription( typelib_TypeDescription ** ppTypeDescr ) const
+ { ::typelib_typedescriptionreference_getDescription( ppTypeDescr, pType ); }
+
+ /** Gets the type class of the set value.
+
+ @return the type class of the set value
+ */
+ TypeClass SAL_CALL getValueTypeClass() const
+ { return static_cast<TypeClass>(pType->eTypeClass); }
+
+ /** Gets the type name of the set value.
+
+ @return the type name of the set value
+ */
+ inline ::rtl::OUString SAL_CALL getValueTypeName() const;
+
+ /** Tests if any contains a value.
+
+ @return true if any has a value, false otherwise
+ */
+ bool SAL_CALL hasValue() const
+ { return (typelib_TypeClass_VOID != pType->eTypeClass); }
+
+ /** Gets a pointer to the set value.
+
+ @return a pointer to the set value
+ */
+ const void * SAL_CALL getValue() const
+ { return pData; }
+
+ /** Provides a value of specified type, so you can easily write e.g.
+ <pre>
+ sal_Int32 myVal = myAny.get<sal_Int32>();
+ </pre>
+ Widening conversion without data loss is taken into account.
+ Throws a com::sun::star::uno::RuntimeException if the specified type
+ cannot be provided.
+
+ @return value of specified type
+ @exception com::sun::star::uno::RuntimeException
+ in case the specified type cannot be provided
+ */
+ template <typename T>
+ inline T get() const;
+
+ /** Sets a value. If the any already contains a value, that value will be destructed
+ and its memory freed.
+
+ @param pData_ pointer to value
+ @param rType type of value
+ */
+ inline void SAL_CALL setValue( const void * pData_, const Type & rType );
+ /** Sets a value. If the any already contains a value, that value will be destructed
+ and its memory freed.
+
+ @param pData_ pointer to value
+ @param pType_ type of value
+ */
+ inline void SAL_CALL setValue( const void * pData_, typelib_TypeDescriptionReference * pType_ );
+ /** Sets a value. If the any already contains a value, that value will be destructed
+ and its memory freed.
+
+ @param pData_ pointer to value
+ @param pTypeDescr type description of value
+ */
+ inline void SAL_CALL setValue( const void * pData_, typelib_TypeDescription * pTypeDescr );
+
+#if defined LIBO_INTERNAL_ONLY
+ void setValue(bool const *, Type const &) = delete;
+ void setValue(bool const *, typelib_TypeDescriptionReference *) = delete;
+ void setValue(bool const *, typelib_TypeDescription *) = delete;
+ void setValue(sal_Bool const *, Type const &) = delete;
+ void setValue(sal_Bool const *, typelib_TypeDescriptionReference *)
+ = delete;
+ void setValue(sal_Bool const *, typelib_TypeDescription *) = delete;
+ void setValue(std::nullptr_t, Type const & type)
+ { setValue(static_cast<void *>(nullptr), type); }
+ void setValue(std::nullptr_t, typelib_TypeDescriptionReference * type)
+ { setValue(static_cast<void *>(nullptr), type); }
+ void setValue(std::nullptr_t, typelib_TypeDescription * type)
+ { setValue(static_cast<void *>(nullptr), type); }
+#endif
+
+ /** Clears this any. If the any already contains a value, that value will be destructed
+ and its memory freed. After this has been called, the any does not contain a value.
+ */
+ inline void SAL_CALL clear();
+
+ /** Tests whether this any is extractable to a value of given type.
+ Widening conversion without data loss is taken into account.
+
+ @param rType destination type
+ @return true if this any is extractable to value of given type (e.g. using >>= operator)
+ */
+ inline bool SAL_CALL isExtractableTo( const Type & rType ) const;
+
+ /** Tests whether this any can provide a value of specified type.
+ Widening conversion without data loss is taken into account.
+
+ @return true if this any can provide a value of specified type
+ (e.g. using >>= operator)
+ */
+ template <typename T>
+ inline bool has() const;
+
+ /** Equality operator: compares two anys.
+ The values need not be of equal type, e.g. a short integer is compared to a long integer.
+
+ @param rAny another any (right side)
+ @return true if both any contains equal values
+ */
+ inline bool SAL_CALL operator == ( const Any & rAny ) const;
+ /** Inequality operator: compares two anys.
+ The values need not be of equal type, e.g. a short integer is compared to a long integer.
+
+ @param rAny another any (right side)
+ @return true if both any contains unequal values
+ */
+ inline bool SAL_CALL operator != ( const Any & rAny ) const;
+
+private:
+#if !defined LIBO_INTERNAL_ONLY
+ /// @cond INTERNAL
+ // Forbid use with ambiguous type (sal_Unicode, sal_uInt16):
+ explicit Any(sal_uInt16) SAL_DELETED_FUNCTION;
+ /// @endcond
+#endif
+};
+
+#if !defined LIBO_INTERNAL_ONLY
+/// @cond INTERNAL
+// Forbid use with ambiguous type (sal_Unicode, sal_uInt16):
+template<> sal_uInt16 Any::get<sal_uInt16>() const SAL_DELETED_FUNCTION;
+template<> bool Any::has<sal_uInt16>() const SAL_DELETED_FUNCTION;
+/// @endcond
+#endif
+
+#if !defined LIBO_INTERNAL_ONLY
+/** Template function to generically construct an any from a C++ value.
+
+ @deprecated Just use an Any constructor with an appropriately typed argument. (When the
+ (UNO) type recorded in the Any instance shall be different from what would
+ be deduced from the (C++) type of the argument, cast the argument to the appropriate type
+ first.)
+
+ @tparam C value type
+ @param value a value
+ @return an any
+*/
+template< class C >
+inline Any SAL_CALL makeAny( const C & value );
+
+template<> inline Any SAL_CALL makeAny(sal_uInt16 const & value);
+
+template<> Any SAL_CALL makeAny(Any const &) SAL_DELETED_FUNCTION;
+#endif
+
+/** Wrap a value in an Any, if necessary.
+
+ (A difference to the deprecated makeAny is that makeAny cannot be called on an Any, while
+ toAny just returns the given Any.)
+
+ @since LibreOffice 5.0
+*/
+template<typename T> inline Any toAny(T const & value);
+
+template<> inline Any toAny(Any const & value);
+
+#if defined LIBO_INTERNAL_ONLY
+
+/** Extract a value from an Any, if necessary.
+
+ The difference to operator >>= is that operator >>= cannot be called with an
+ Any as right-hand side (in LIBO_INTERNAL_ONLY), while fromAny just passes on
+ the given Any (and always succeeds) in the specialization for T = Any.
+
+ @tparam T any type representing a UNO type
+
+ @param any any Any value
+
+ @param value a non-null pointer, receiving the extracted value if
+ extraction succeeded (and left unmodified otherwise)
+
+ @return true iff extraction succeeded
+
+ @since LibreOffice 5.3
+*/
+template<typename T> inline bool fromAny(Any const & any, T * value);
+
+template<> inline bool fromAny(Any const & any, Any * value);
+
+#endif
+
+class BaseReference;
+
+/** Template binary <<= operator to set the value of an any.
+
+ @tparam C value type
+ @param rAny destination any (left side)
+ @param value source value (right side)
+*/
+template< class C >
+inline void SAL_CALL operator <<= ( Any & rAny, const C & value );
+
+// additionally for C++ bool:
+template<>
+inline void SAL_CALL operator <<= ( Any & rAny, bool const & value );
+
+/** Template binary >>= operator to assign a value from an any.
+ If the any does not contain a value that can be assigned without data loss, then this
+ operation will fail returning false.
+
+ @tparam C value type
+ @param rAny source any (left side)
+ @param value destination value (right side)
+ @return true if assignment was possible without data loss
+*/
+template< class C >
+inline bool SAL_CALL operator >>= ( const Any & rAny, C & value );
+
+/** Template equality operator: compares set value of left side any to right side value.
+ The values need not be of equal type, e.g. a short integer is compared to a long integer.
+ This operator can be implemented as template member function, if all supported compilers
+ can cope with template member functions.
+
+ @tparam C value type
+ @param rAny another any (left side)
+ @param value a value (right side)
+ @return true if values are equal, false otherwise
+*/
+template< class C >
+inline bool SAL_CALL operator == ( const Any & rAny, const C & value );
+/** Template inequality operator: compares set value of left side any to right side value.
+ The values need not be of equal type, e.g. a short integer is compared to a long integer.
+ This operator can be implemented as template member function, if all supported compilers
+ can cope with template member functions.
+
+ @tparam C value type
+ @param rAny another any (left side)
+ @param value a value (right side)
+ @return true if values are unequal, false otherwise
+*/
+template< class C >
+inline bool SAL_CALL operator != ( const Any & rAny, const C & value );
+
+// additional specialized >>= and == operators
+// bool
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Bool & value );
+template<>
+inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value );
+template<>
+inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value );
+template<>
+inline bool SAL_CALL operator == ( Any const & rAny, bool const & value );
+// byte
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int8 & value );
+// short
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value );
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value );
+// long
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value );
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value );
+// hyper
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value );
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value );
+// float
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, float & value );
+// double
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, double & value );
+// string
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value );
+template<>
+inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value );
+// type
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value );
+template<>
+inline bool SAL_CALL operator == ( const Any & rAny, const Type & value );
+// any
+#if !defined LIBO_INTERNAL_ONLY
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value );
+#endif
+// interface
+template<>
+inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value );
+
+}
+}
+}
+}
+
+/** Gets the meta type of IDL type any.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type any
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const ::com::sun::star::uno::Any * )
+{
+ return ::cppu::UnoType< ::com::sun::star::uno::Any >::get();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx
new file mode 100644
index 000000000..d73b2a586
--- /dev/null
+++ b/include/com/sun/star/uno/Any.hxx
@@ -0,0 +1,765 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_COM_SUN_STAR_UNO_ANY_HXX
+#define INCLUDED_COM_SUN_STAR_UNO_ANY_HXX
+
+#include "sal/config.h"
+
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <iomanip>
+#include <ostream>
+#include <utility>
+
+#include "com/sun/star/uno/Any.h"
+#include "uno/data.h"
+#include "uno/sequence2.h"
+#include "com/sun/star/uno/Type.hxx"
+#include "com/sun/star/uno/Reference.h"
+#include "com/sun/star/uno/genfunc.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "cppu/cppudllapi.h"
+#include "cppu/unotype.hxx"
+
+extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
+ uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
+ SAL_THROW_EXTERN_C();
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+
+inline Any::Any()
+{
+ ::uno_any_construct( this, NULL, NULL, cpp_acquire );
+}
+
+
+template <typename T>
+inline Any::Any( T const & value )
+{
+ ::uno_type_any_construct(
+ this, const_cast<T *>(&value),
+ ::cppu::getTypeFavourUnsigned(&value).getTypeLibType(),
+ cpp_acquire );
+}
+
+inline Any::Any( bool value )
+{
+ sal_Bool b = value;
+ ::uno_type_any_construct(
+ this, &b, cppu::UnoType<bool>::get().getTypeLibType(),
+ cpp_acquire );
+}
+
+#if defined LIBO_INTERNAL_ONLY
+template<typename T1, typename T2>
+Any::Any(rtl::OUStringConcat<T1, T2> && value):
+ Any(rtl::OUString(std::move(value)))
+{}
+template<typename T>
+Any::Any(rtl::OUStringNumber<T> && value): Any(rtl::OUString(std::move(value))) {}
+template <std::size_t N>
+Any::Any(const rtl::OUStringLiteral<N>& value): Any(rtl::OUString(value)) {}
+#endif
+
+inline Any::Any( const Any & rAny )
+{
+ ::uno_type_any_construct( this, rAny.pData, rAny.pType, cpp_acquire );
+}
+
+inline Any::Any( const void * pData_, const Type & rType )
+{
+ ::uno_type_any_construct(
+ this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
+ cpp_acquire );
+}
+
+inline Any::Any( const void * pData_, typelib_TypeDescription * pTypeDescr )
+{
+ ::uno_any_construct(
+ this, const_cast< void * >( pData_ ), pTypeDescr, cpp_acquire );
+}
+
+inline Any::Any( const void * pData_, typelib_TypeDescriptionReference * pType_ )
+{
+ ::uno_type_any_construct(
+ this, const_cast< void * >( pData_ ), pType_, cpp_acquire );
+}
+
+inline Any::~Any()
+{
+ ::uno_any_destruct(
+ this, cpp_release );
+}
+
+inline Any & Any::operator = ( const Any & rAny )
+{
+ if (this != &rAny)
+ {
+ ::uno_type_any_assign(
+ this, rAny.pData, rAny.pType,
+ cpp_acquire, cpp_release );
+ }
+ return *this;
+}
+
+#if defined LIBO_INTERNAL_ONLY
+
+Any::Any(Any && other) noexcept {
+ uno_any_construct(this, nullptr, nullptr, &cpp_acquire);
+ std::swap(other.pType, pType);
+ std::swap(other.pData, pData);
+ std::swap(other.pReserved, pReserved);
+ if (pData == &other.pReserved) {
+ pData = &pReserved;
+ }
+ // This leaves other.pData (where "other" is now VOID) dangling to somewhere (cf.
+ // CONSTRUCT_EMPTY_ANY, cppu/source/uno/prim.hxx), but what's relevant is
+ // only that it isn't a nullptr (as e.g. >>= -> uno_type_assignData ->
+ // _assignData takes a null pSource to mean "construct a default value").
+}
+
+Any & Any::operator =(Any && other) noexcept {
+ std::swap(other.pType, pType);
+ std::swap(other.pData, pData);
+ std::swap(other.pReserved, pReserved);
+ if (pData == &other.pReserved) {
+ pData = &pReserved;
+ }
+ if (other.pData == &pReserved) {
+ other.pData = &other.pReserved;
+ }
+ return *this;
+}
+
+#endif
+
+inline ::rtl::OUString Any::getValueTypeName() const
+{
+ return ::rtl::OUString( pType->pTypeName );
+}
+
+inline void Any::setValue( const void * pData_, const Type & rType )
+{
+ ::uno_type_any_assign(
+ this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
+ cpp_acquire, cpp_release );
+}
+
+inline void Any::setValue( const void * pData_, typelib_TypeDescriptionReference * pType_ )
+{
+ ::uno_type_any_assign(
+ this, const_cast< void * >( pData_ ), pType_,
+ cpp_acquire, cpp_release );
+}
+
+inline void Any::setValue( const void * pData_, typelib_TypeDescription * pTypeDescr )
+{
+ ::uno_any_assign(
+ this, const_cast< void * >( pData_ ), pTypeDescr,
+ cpp_acquire, cpp_release );
+}
+
+inline void Any::clear()
+{
+ ::uno_any_clear(
+ this, cpp_release );
+}
+
+inline bool Any::isExtractableTo( const Type & rType ) const
+{
+ return ::uno_type_isAssignableFromData(
+ rType.getTypeLibType(), pData, pType,
+ cpp_queryInterface, cpp_release );
+}
+
+
+template <typename T>
+inline bool Any::has() const
+{
+ Type const & rType = ::cppu::getTypeFavourUnsigned(static_cast< T * >(NULL));
+ return ::uno_type_isAssignableFromData(
+ rType.getTypeLibType(), pData, pType,
+ cpp_queryInterface,
+ cpp_release );
+}
+
+#if defined LIBO_INTERNAL_ONLY
+template<> bool Any::has<Any>() const = delete;
+#endif
+
+inline bool Any::operator == ( const Any & rAny ) const
+{
+ return ::uno_type_equalData(
+ pData, pType, rAny.pData, rAny.pType,
+ cpp_queryInterface, cpp_release );
+}
+
+inline bool Any::operator != ( const Any & rAny ) const
+{
+ return (! ::uno_type_equalData(
+ pData, pType, rAny.pData, rAny.pType,
+ cpp_queryInterface, cpp_release ));
+}
+
+
+#if !defined LIBO_INTERNAL_ONLY
+template< class C >
+inline Any SAL_CALL makeAny( const C & value )
+{
+ return Any(value);
+}
+
+template<> Any makeAny(sal_uInt16 const & value)
+{ return Any(&value, cppu::UnoType<cppu::UnoUnsignedShortType>::get()); }
+#endif
+
+template<typename T> Any toAny(T const & value) {
+ return Any(value);
+}
+
+template<> Any toAny(Any const & value) { return value; }
+
+#if defined LIBO_INTERNAL_ONLY
+
+template<typename T1, typename T2>
+Any toAny(rtl::OUStringConcat<T1, T2> && value)
+{ return Any(std::move(value)); }
+
+template<typename T>
+Any toAny(rtl::OUStringNumber<T> && value)
+{ return Any(std::move(value)); }
+
+template<typename T> bool fromAny(Any const & any, T * value) {
+ assert(value != nullptr);
+ return any >>= *value;
+}
+
+template<> bool fromAny(Any const & any, Any * value) {
+ assert(value != nullptr);
+ *value = any;
+ return true;
+}
+
+#endif
+
+template< class C >
+inline void SAL_CALL operator <<= ( Any & rAny, const C & value )
+{
+ const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
+ ::uno_type_any_assign(
+ &rAny, const_cast< C * >( &value ), rType.getTypeLibType(),
+ cpp_acquire, cpp_release );
+}
+
+// additionally for C++ bool:
+
+template<>
+inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
+{
+ sal_Bool b = value;
+ ::uno_type_any_assign(
+ &rAny, &b, cppu::UnoType<bool>::get().getTypeLibType(),
+ cpp_acquire, cpp_release );
+}
+
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+template< class C1, class C2 >
+inline void operator <<= ( Any & rAny, rtl::OUStringConcat< C1, C2 >&& value )
+{
+ const rtl::OUString str( std::move(value) );
+ const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
+ ::uno_type_any_assign(
+ &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
+ cpp_acquire, cpp_release );
+}
+template<typename T1, typename T2>
+void operator <<=(Any &, rtl::OUStringConcat<T1, T2> const &) = delete;
+template< class C >
+inline void operator <<= ( Any & rAny, rtl::OUStringNumber< C >&& value )
+{
+ const rtl::OUString str( std::move(value) );
+ const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
+ ::uno_type_any_assign(
+ &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
+ cpp_acquire, cpp_release );
+}
+template<typename T>
+void operator <<=(Any &, rtl::OUStringNumber<T> const &) = delete;
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+template<> void SAL_CALL operator <<=(Any &, Any const &) = delete;
+#endif
+
+template< class C >
+inline bool SAL_CALL operator >>= ( const Any & rAny, C & value )
+{
+ const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
+ return ::uno_type_assignData(
+ &value, rType.getTypeLibType(),
+ rAny.pData, rAny.pType,
+ cpp_queryInterface,
+ cpp_acquire, cpp_release );
+}
+
+// bool
+
+template<>
+inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value )
+{
+ if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
+ {
+ value = bool(* static_cast< const sal_Bool * >( rAny.pData ));
+ return true;
+ }
+ return false;
+}
+
+template<>
+inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value )
+{
+ return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
+ bool(value) == bool(* static_cast< const sal_Bool * >( rAny.pData )));
+}
+
+
+template<>
+inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
+{
+ if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
+ {
+ value = *static_cast< sal_Bool const * >( rAny.pData );
+ return true;
+ }
+ return false;
+}
+
+
+template<>
+inline bool SAL_CALL operator == ( Any const & rAny, bool const & value )
+{
+ return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
+ (value ==
+ bool(*static_cast< sal_Bool const * >( rAny.pData ))));
+}
+
+// byte
+
+template<>
+inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value )
+{
+ if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
+ {
+ value = * static_cast< const sal_Int8 * >( rAny.pData );
+ return true;
+ }
+ return false;
+}
+// short
+
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value )
+{
+ switch (rAny.pType->eTypeClass)
+ {
+ case typelib_TypeClass_BYTE:
+ value = * static_cast< const sal_Int8 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_SHORT:
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ value = * static_cast< const sal_Int16 * >( rAny.pData );
+ return true;
+ default:
+ return false;
+ }
+}
+
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value )
+{
+ switch (rAny.pType->eTypeClass)
+ {
+ case typelib_TypeClass_BYTE:
+ value = static_cast<sal_uInt16>( * static_cast< const sal_Int8 * >( rAny.pData ) );
+ return true;
+ case typelib_TypeClass_SHORT:
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ value = * static_cast< const sal_uInt16 * >( rAny.pData );
+ return true;
+ default:
+ return false;
+ }
+}
+// long
+
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value )
+{
+ switch (rAny.pType->eTypeClass)
+ {
+ case typelib_TypeClass_BYTE:
+ value = * static_cast< const sal_Int8 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_SHORT:
+ value = * static_cast< const sal_Int16 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ value = * static_cast< const sal_uInt16 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_LONG:
+ case typelib_TypeClass_UNSIGNED_LONG:
+ value = * static_cast< const sal_Int32 * >( rAny.pData );
+ return true;
+ default:
+ return false;
+ }
+}
+
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value )
+{
+ switch (rAny.pType->eTypeClass)
+ {
+ case typelib_TypeClass_BYTE:
+ value = static_cast<sal_uInt32>( * static_cast< const sal_Int8 * >( rAny.pData ) );
+ return true;
+ case typelib_TypeClass_SHORT:
+ value = static_cast<sal_uInt32>( * static_cast< const sal_Int16 * >( rAny.pData ) );
+ return true;
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ value = * static_cast< const sal_uInt16 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_LONG:
+ case typelib_TypeClass_UNSIGNED_LONG:
+ value = * static_cast< const sal_uInt32 * >( rAny.pData );
+ return true;
+ default:
+ return false;
+ }
+}
+// hyper
+
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value )
+{
+ switch (rAny.pType->eTypeClass)
+ {
+ case typelib_TypeClass_BYTE:
+ value = * static_cast< const sal_Int8 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_SHORT:
+ value = * static_cast< const sal_Int16 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ value = * static_cast< const sal_uInt16 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_LONG:
+ value = * static_cast< const sal_Int32 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_UNSIGNED_LONG:
+ value = * static_cast< const sal_uInt32 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_HYPER:
+ case typelib_TypeClass_UNSIGNED_HYPER:
+ value = * static_cast< const sal_Int64 * >( rAny.pData );
+ return true;
+ default:
+ return false;
+ }
+}
+
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value )
+{
+ switch (rAny.pType->eTypeClass)
+ {
+ case typelib_TypeClass_BYTE:
+ value = static_cast<sal_uInt64>( * static_cast< const sal_Int8 * >( rAny.pData ) );
+ return true;
+ case typelib_TypeClass_SHORT:
+ value = static_cast<sal_uInt64>( * static_cast< const sal_Int16 * >( rAny.pData ) );
+ return true;
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ value = * static_cast< const sal_uInt16 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_LONG:
+ value = static_cast<sal_uInt64>( * static_cast< const sal_Int32 * >( rAny.pData ) );
+ return true;
+ case typelib_TypeClass_UNSIGNED_LONG:
+ value = * static_cast< const sal_uInt32 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_HYPER:
+ case typelib_TypeClass_UNSIGNED_HYPER:
+ value = * static_cast< const sal_uInt64 * >( rAny.pData );
+ return true;
+ default:
+ return false;
+ }
+}
+// float
+
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, float & value )
+{
+ switch (rAny.pType->eTypeClass)
+ {
+ case typelib_TypeClass_BYTE:
+ value = * static_cast< const sal_Int8 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_SHORT:
+ value = * static_cast< const sal_Int16 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ value = * static_cast< const sal_uInt16 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_FLOAT:
+ value = * static_cast< const float * >( rAny.pData );
+ return true;
+ default:
+ return false;
+ }
+}
+// double
+
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, double & value )
+{
+ switch (rAny.pType->eTypeClass)
+ {
+ case typelib_TypeClass_BYTE:
+ value = * static_cast< const sal_Int8 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_SHORT:
+ value = * static_cast< const sal_Int16 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ value = * static_cast< const sal_uInt16 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_LONG:
+ value = * static_cast< const sal_Int32 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_UNSIGNED_LONG:
+ value = * static_cast< const sal_uInt32 * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_FLOAT:
+ value = * static_cast< const float * >( rAny.pData );
+ return true;
+ case typelib_TypeClass_DOUBLE:
+ value = * static_cast< const double * >( rAny.pData );
+ return true;
+ default:
+ return false;
+ }
+}
+// string
+
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value )
+{
+ if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
+ {
+ value = * static_cast< const ::rtl::OUString * >( rAny.pData );
+ return true;
+ }
+ return false;
+}
+
+template<>
+inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value )
+{
+ return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
+ value == * static_cast< const ::rtl::OUString * >( rAny.pData ) );
+}
+// type
+
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value )
+{
+ if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
+ {
+ value = * static_cast< const Type * >( rAny.pData );
+ return true;
+ }
+ return false;
+}
+
+template<>
+inline bool SAL_CALL operator == ( const Any & rAny, const Type & value )
+{
+ return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
+ value.equals( * static_cast< const Type * >( rAny.pData ) ));
+}
+// any
+
+#if defined LIBO_INTERNAL_ONLY
+template<> bool SAL_CALL operator >>=(Any const &, Any &) = delete;
+#else
+template<>
+inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value )
+{
+ if (&rAny != &value)
+ {
+ ::uno_type_any_assign(
+ &value, rAny.pData, rAny.pType,
+ cpp_acquire, cpp_release );
+ }
+ return true;
+}
+#endif
+// interface
+
+template<>
+inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value )
+{
+ if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
+ {
+ return static_cast< const BaseReference * >( rAny.pData )->operator == ( value );
+ }
+ return false;
+}
+
+// operator to compare to an any.
+
+template< class C >
+inline bool SAL_CALL operator == ( const Any & rAny, const C & value )
+{
+ const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
+ return ::uno_type_equalData(
+ rAny.pData, rAny.pType,
+ const_cast< C * >( &value ), rType.getTypeLibType(),
+ cpp_queryInterface, cpp_release );
+}
+// operator to compare to an any. may use specialized operators ==.
+
+template< class C >
+inline bool SAL_CALL operator != ( const Any & rAny, const C & value )
+{
+ return (! operator == ( rAny, value ));
+}
+
+template <typename T>
+T Any::get() const
+{
+ T value = T();
+ if (! (*this >>= value)) {
+ throw RuntimeException(
+ ::rtl::OUString(
+ cppu_Any_extraction_failure_msg(
+ this,
+ ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
+ SAL_NO_ACQUIRE ) );
+ }
+ return value;
+}
+
+#if defined LIBO_INTERNAL_ONLY
+template<> Any Any::get() const = delete;
+#endif
+
+/**
+ Support for Any in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO
+ macros, for example).
+
+ @since LibreOffice 4.2
+*/
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o, Any const &any) {
+ o << "<Any: (" << any.getValueTypeName() << ')';
+ switch(any.pType->eTypeClass) {
+ case typelib_TypeClass_VOID:
+ break;
+ case typelib_TypeClass_BOOLEAN:
+ o << ' ' << any.get<bool>();
+ break;
+ case typelib_TypeClass_BYTE:
+ case typelib_TypeClass_SHORT:
+ case typelib_TypeClass_LONG:
+ case typelib_TypeClass_HYPER:
+ o << ' ' << any.get<sal_Int64>();
+ break;
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ case typelib_TypeClass_UNSIGNED_LONG:
+ case typelib_TypeClass_UNSIGNED_HYPER:
+ o << ' ' << any.get<sal_uInt64>();
+ break;
+ case typelib_TypeClass_FLOAT:
+ case typelib_TypeClass_DOUBLE:
+ o << ' ' << any.get<double>();
+ break;
+ case typelib_TypeClass_CHAR: {
+ std::ios_base::fmtflags flgs = o.setf(
+ std::ios_base::hex, std::ios_base::basefield);
+ charT fill = o.fill('0');
+ o << " U+" << std::setw(4)
+ << unsigned(*static_cast<sal_Unicode const *>(any.getValue()));
+ o.setf(flgs);
+ o.fill(fill);
+ break;
+ }
+ case typelib_TypeClass_STRING:
+ o << ' ' << any.get<rtl::OUString>();
+ break;
+ case typelib_TypeClass_TYPE:
+ o << ' ' << any.get<css::uno::Type>().getTypeName();
+ break;
+ case typelib_TypeClass_SEQUENCE:
+ o << " len "
+ << ((*static_cast<uno_Sequence * const *>(any.getValue()))->
+ nElements);
+ break;
+ case typelib_TypeClass_ENUM:
+ o << ' ' << *static_cast<sal_Int32 const *>(any.getValue());
+ break;
+ case typelib_TypeClass_STRUCT:
+ case typelib_TypeClass_EXCEPTION:
+ o << ' ' << any.getValue();
+ break;
+ case typelib_TypeClass_INTERFACE:
+ o << ' ' << *static_cast<void * const *>(any.getValue());
+ break;
+ default:
+ assert(false); // this cannot happen
+ break;
+ }
+ o << '>';
+ return o;
+}
+
+}
+}
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/com/sun/star/uno/Reference.h b/include/com/sun/star/uno/Reference.h
new file mode 100644
index 000000000..85c0d929e
--- /dev/null
+++ b/include/com/sun/star/uno/Reference.h
@@ -0,0 +1,571 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_COM_SUN_STAR_UNO_REFERENCE_H
+#define INCLUDED_COM_SUN_STAR_UNO_REFERENCE_H
+
+#include "sal/config.h"
+
+#include <cassert>
+#include <cstddef>
+
+#if defined LIBO_INTERNAL_ONLY
+#include <type_traits>
+#endif
+
+#include "rtl/alloc.h"
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+class RuntimeException;
+class XInterface;
+class Type;
+class Any;
+
+/** Enum defining UNO_REF_NO_ACQUIRE for setting reference without acquiring a given interface.
+ Deprecated, please use SAL_NO_ACQUIRE.
+ @deprecated
+*/
+enum UnoReference_NoAcquire
+{
+ /** This enum value can be used for creating a reference granting a given interface,
+ i.e. transferring ownership to it.
+ */
+ UNO_REF_NO_ACQUIRE
+};
+
+/** This base class serves as a base class for all template reference classes and
+ has been introduced due to compiler problems with templated operators ==, =!.
+*/
+class BaseReference
+{
+protected:
+ /** the interface pointer
+ */
+ XInterface * _pInterface;
+
+ /** Queries given interface for type rType.
+
+ @param pInterface interface pointer
+ @param rType interface type
+ @return interface of demanded type (may be null)
+ */
+ inline static XInterface * SAL_CALL iquery( XInterface * pInterface, const Type & rType );
+ /** Queries given interface for type rType.
+ Throws a RuntimeException if the demanded interface cannot be queried.
+
+ @param pInterface interface pointer
+ @param rType interface type
+ @return interface of demanded type
+ */
+ inline static XInterface * SAL_CALL iquery_throw( XInterface * pInterface, const Type & rType );
+
+public:
+ /** Gets interface pointer. This call does not acquire the interface.
+
+ @return UNacquired interface pointer
+ */
+ XInterface * SAL_CALL get() const
+ { return _pInterface; }
+
+ /** Checks if reference is null.
+
+ @return true if reference acquires an interface, i.e. true if it is not null
+ */
+ bool SAL_CALL is() const
+ { return (NULL != _pInterface); }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** Checks if reference is null.
+
+ @return true if reference acquires an interface, i.e. true if it is not null
+ */
+ explicit operator bool() const
+ { return is(); }
+#endif
+
+ /** Equality operator: compares two interfaces
+ Checks if both references are null or refer to the same object.
+
+ @param pInterface another interface
+ @return true if both references are null or refer to the same object, false otherwise
+ */
+ inline bool SAL_CALL operator == ( XInterface * pInterface ) const;
+ /** Inequality operator: compares two interfaces
+ Checks if both references are null or refer to the same object.
+
+ @param pInterface another interface
+ @return false if both references are null or refer to the same object, true otherwise
+ */
+ inline bool SAL_CALL operator != ( XInterface * pInterface ) const;
+
+ /** Equality operator: compares two interfaces
+ Checks if both references are null or refer to the same object.
+
+ @param rRef another reference
+ @return true if both references are null or refer to the same object, false otherwise
+ */
+ inline bool SAL_CALL operator == ( const BaseReference & rRef ) const;
+ /** Inequality operator: compares two interfaces
+ Checks if both references are null or refer to the same object.
+
+ @param rRef another reference
+ @return false if both references are null or refer to the same object, true otherwise
+ */
+ inline bool SAL_CALL operator != ( const BaseReference & rRef ) const;
+
+ /** Needed by some STL containers.
+
+ @param rRef another reference
+ @return true, if this reference is less than rRef
+ */
+ inline bool SAL_CALL operator < ( const BaseReference & rRef ) const;
+};
+
+/** Enum defining UNO_QUERY for implicit interface query.
+*/
+enum UnoReference_Query
+{
+ /** This enum value can be used for implicit interface query.
+ */
+ UNO_QUERY
+};
+/** Enum defining UNO_QUERY_THROW for implicit interface query.
+ If the demanded interface is unavailable, then a RuntimeException is thrown.
+*/
+enum UnoReference_QueryThrow
+{
+ /** This enum value can be used for implicit interface query.
+ */
+ UNO_QUERY_THROW
+};
+/** Enum defining UNO_SET_THROW for throwing if attempts are made to assign a null
+ interface
+
+ @since UDK 3.2.8
+*/
+enum UnoReference_SetThrow
+{
+ UNO_SET_THROW
+};
+
+/** Template reference class for interface type derived from BaseReference.
+ A special constructor given the UNO_QUERY identifier queries interfaces
+ for reference type.
+*/
+template< class interface_type >
+class SAL_DLLPUBLIC_RTTI Reference : public BaseReference
+{
+ /** Queries given interface for type interface_type.
+
+ @param pInterface interface pointer
+ @return interface of demanded type (may be null)
+ */
+ inline static XInterface * SAL_CALL iquery( XInterface * pInterface );
+ /** Queries given interface for type interface_type.
+ Throws a RuntimeException if the demanded interface cannot be queried.
+
+ @param pInterface interface pointer
+ @return interface of demanded type
+ */
+ inline static XInterface * SAL_CALL iquery_throw( XInterface * pInterface );
+ /** Returns the given interface if it is not <NULL/>, throws a RuntimeException otherwise.
+
+ @param pInterface interface pointer
+ @return pInterface
+ */
+ inline static interface_type * SAL_CALL iset_throw( interface_type * pInterface );
+
+ /** Cast from an "interface pointer" (e.g., BaseReference::_pInterface) to a
+ pointer to this interface_type.
+
+ To work around ambiguities in the case of multiple-inheritance interface
+ types (which inherit XInterface more than once), use reinterpret_cast
+ (resp. a sequence of two static_casts, to avoid warnings about
+ reinterpret_cast used between related classes) to switch from a pointer
+ to XInterface to a pointer to this derived interface_type. In
+ principle, this is not guaranteed to work. In practice, it seems to
+ work on all supported platforms.
+ */
+ static interface_type * castFromXInterface(XInterface * p) {
+ return static_cast< interface_type * >(static_cast< void * >(p));
+ }
+
+ /** Cast from a pointer to this interface_type to an "interface pointer"
+ (e.g., BaseReference::_pInterface).
+
+ To work around ambiguities in the case of multiple-inheritance interface
+ types (which inherit XInterface more than once), use reinterpret_cast
+ (resp. a sequence of two static_casts, to avoid warnings about
+ reinterpret_cast used between related classes) to switch from a pointer
+ to this derived interface_type to a pointer to XInterface. In
+ principle, this is not guaranteed to work. In practice, it seems to
+ work on all supported platforms.
+ */
+ static XInterface * castToXInterface(interface_type * p) {
+ return static_cast< XInterface * >(static_cast< void * >(p));
+ }
+
+public:
+ /// @cond INTERNAL
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new ( ::size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete ( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new ( ::size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete ( void *, void * )
+ {}
+ /// @endcond
+
+ /** Destructor: Releases interface if set.
+ */
+ inline ~Reference() COVERITY_NOEXCEPT_FALSE;
+
+ /** Default Constructor: Sets null reference.
+ */
+ inline Reference();
+
+ /** Copy constructor: Copies interface reference.
+
+ @param rRef another reference
+ */
+ inline Reference( const Reference< interface_type > & rRef );
+
+#if defined LIBO_INTERNAL_ONLY
+ /** Move constructor
+
+ @param rRef another reference
+ */
+ inline Reference( Reference< interface_type > && rRef ) noexcept;
+
+ /** Up-casting conversion constructor: Copies interface reference.
+
+ Does not work for up-casts to ambiguous bases. For the special case of
+ up-casting to Reference< XInterface >, see the corresponding conversion
+ operator.
+
+ @param rRef another reference
+ */
+ template< class derived_type >
+ inline Reference(
+ const Reference< derived_type > & rRef,
+ std::enable_if_t<
+ std::is_base_of_v<interface_type, derived_type>
+ && !std::is_same_v<interface_type, XInterface>, void *> = nullptr);
+#endif
+
+ /** Constructor: Sets given interface pointer.
+
+ @param pInterface an interface pointer
+ */
+ inline Reference( interface_type * pInterface );
+
+ /** Constructor: Sets given interface pointer without acquiring it.
+
+ @param pInterface another reference
+ @param dummy SAL_NO_ACQUIRE to force obvious distinction to other constructors
+ */
+ inline Reference( interface_type * pInterface, __sal_NoAcquire dummy);
+ /** Constructor: Sets given interface pointer without acquiring it.
+ Deprecated, please use SAL_NO_ACQUIRE version.
+
+ @deprecated
+ @param pInterface another reference
+ @param dummy UNO_REF_NO_ACQUIRE to force obvious distinction to other constructors
+ */
+ inline SAL_DEPRECATED("use SAL_NO_ACQUIRE version") Reference( interface_type * pInterface, UnoReference_NoAcquire dummy );
+
+ /** Constructor: Queries given interface for reference interface type (interface_type).
+
+ @param rRef another reference
+ @param dummy UNO_QUERY to force obvious distinction to other constructors
+ */
+ inline Reference( const BaseReference & rRef, UnoReference_Query dummy );
+ /** Constructor: Queries given interface for reference interface type (interface_type).
+
+ @param pInterface an interface pointer
+ @param dummy UNO_QUERY to force obvious distinction to other constructors
+ */
+ inline Reference( XInterface * pInterface, UnoReference_Query dummy);
+ /** Constructor: Queries given any for reference interface type (interface_type).
+
+ @param rAny an any
+ @param dummy UNO_QUERY to force obvious distinction to other constructors
+ */
+ inline Reference( const Any & rAny, UnoReference_Query dummy);
+ /** Constructor: Queries given interface for reference interface type (interface_type).
+ Throws a RuntimeException if the demanded interface cannot be queried.
+
+ @param rRef another reference
+ @param dummy UNO_QUERY_THROW to force obvious distinction
+ to other constructors
+ */
+ inline Reference( const BaseReference & rRef, UnoReference_QueryThrow dummy );
+#ifdef LIBO_INTERNAL_ONLY
+ /**
+ Prevent code from calling the QUERY_THROW constructor, when they meant to use the SET_THROW constructor.
+ */
+ Reference( const Reference< interface_type > & rRef, UnoReference_QueryThrow dummy ) = delete;
+#endif
+ /** Constructor: Queries given interface for reference interface type (interface_type).
+ Throws a RuntimeException if the demanded interface cannot be queried.
+
+ @param pInterface an interface pointer
+ @param dummy UNO_QUERY_THROW to force obvious distinction
+ to other constructors
+ */
+ inline Reference( XInterface * pInterface, UnoReference_QueryThrow dummy );
+ /** Constructor: Queries given any for reference interface type (interface_type).
+ Throws a RuntimeException if the demanded interface cannot be queried.
+
+ @param rAny an any
+ @param dummy UNO_QUERY_THROW to force obvious distinction
+ to other constructors
+ */
+ inline Reference( const Any & rAny, UnoReference_QueryThrow dummy );
+ /** Constructor: assigns from the given interface of the same type. Throws a RuntimeException
+ if the source interface is NULL.
+
+ @param rRef another interface reference of the same type
+ @param dummy UNO_SET_THROW to distinguish from default copy constructor
+
+ @since UDK 3.2.8
+ */
+ inline Reference( const Reference< interface_type > & rRef, UnoReference_SetThrow dummy );
+ /** Constructor: assigns from the given interface of the same type. Throws a RuntimeException
+ if the source interface is NULL.
+
+ @param pInterface an interface pointer
+ @param dummy UNO_SET_THROW to distinguish from default assignment constructor
+
+ @since UDK 3.2.8
+ */
+ inline Reference( interface_type * pInterface, UnoReference_SetThrow dummy );
+
+ /** Cast operator to Reference< XInterface >: Reference objects are binary compatible and
+ any interface must be derived from com.sun.star.uno.XInterface.
+ This a useful direct cast possibility.
+ */
+ SAL_CALL operator const Reference< XInterface > & () const
+ { return * reinterpret_cast< const Reference< XInterface > * >( this ); }
+
+ /** Dereference operator: Used to call interface methods.
+
+ @return UNacquired interface pointer
+ */
+ interface_type * SAL_CALL operator -> () const {
+ assert(_pInterface != NULL);
+ return castFromXInterface(_pInterface);
+ }
+
+ /** Indirection operator.
+
+ @since LibreOffice 6.3
+ @return UNacquired interface reference
+ */
+ interface_type & SAL_CALL operator * () const {
+ assert(_pInterface != NULL);
+ return *castFromXInterface(_pInterface);
+ }
+
+ /** Gets interface pointer. This call does not acquire the interface.
+
+ @return UNacquired interface pointer
+ */
+ interface_type * SAL_CALL get() const
+ { return castFromXInterface(_pInterface); }
+
+ /** Clears reference, i.e. releases interface. Reference is null after clear() call.
+ */
+ inline void SAL_CALL clear();
+
+ /** Sets the given interface. An interface already set will be released.
+
+ @param rRef another reference
+ @return true, if non-null interface was set
+ */
+ inline bool SAL_CALL set( const Reference< interface_type > & rRef );
+ /** Sets the given interface. An interface already set will be released.
+
+ @param pInterface another interface
+ @return true, if non-null interface was set
+ */
+ inline bool SAL_CALL set( interface_type * pInterface );
+
+ /** Sets interface pointer without acquiring it. An interface already set will be released.
+
+ @param pInterface an interface pointer
+ @param dummy SAL_NO_ACQUIRE to force obvious distinction to set methods
+ @return true, if non-null interface was set
+ */
+ inline bool SAL_CALL set( interface_type * pInterface, __sal_NoAcquire dummy);
+ /** Sets interface pointer without acquiring it. An interface already set will be released.
+ Deprecated, please use SAL_NO_ACQUIRE version.
+
+ @deprecated
+ @param pInterface an interface pointer
+ @param dummy UNO_REF_NO_ACQUIRE to force obvious distinction to set methods
+ @return true, if non-null interface was set
+ */
+ inline SAL_DEPRECATED("use SAL_NO_ACQUIRE version") bool SAL_CALL set( interface_type * pInterface, UnoReference_NoAcquire dummy);
+
+ /** Queries given interface for reference interface type (interface_type) and sets it.
+ An interface already set will be released.
+
+ @param pInterface an interface pointer
+ @param dummy UNO_QUERY to force obvious distinction to set methods
+ @return true, if non-null interface was set
+ */
+ inline bool SAL_CALL set( XInterface * pInterface, UnoReference_Query dummy );
+ /** Queries given interface for reference interface type (interface_type) and sets it.
+ An interface already set will be released.
+
+ @param rRef another reference
+ @param dummy UNO_QUERY to force obvious distinction to set methods
+ @return true, if non-null interface was set
+ */
+ inline bool SAL_CALL set( const BaseReference & rRef, UnoReference_Query dummy);
+
+ /** Queries given any for reference interface type (interface_type)
+ and sets it. An interface already set will be released.
+
+ @param rAny
+ an Any containing an interface
+ @param dummy
+ UNO_QUERY to force obvious distinction
+ to set methods
+ @return
+ true, if non-null interface was set
+ */
+ inline bool set( Any const & rAny, UnoReference_Query dummy );
+
+ /** Queries given interface for reference interface type (interface_type) and sets it.
+ An interface already set will be released.
+ Throws a RuntimeException if the demanded interface cannot be set.
+
+ @param pInterface an interface pointer
+ @param dummy UNO_QUERY_THROW to force obvious distinction
+ to set methods
+ */
+ inline void SAL_CALL set( XInterface * pInterface, UnoReference_QueryThrow dummy );
+ /** Queries given interface for reference interface type (interface_type) and sets it.
+ An interface already set will be released.
+ Throws a RuntimeException if the demanded interface cannot be set.
+
+ @param rRef another reference
+ @param dummy UNO_QUERY_THROW to force obvious distinction
+ to set methods
+ */
+ inline void SAL_CALL set( const BaseReference & rRef, UnoReference_QueryThrow dummy );
+#ifdef LIBO_INTERNAL_ONLY
+ /**
+ Prevent code from calling the QUERY_THROW version, when they meant to use the SET_THROW version.
+ */
+ void set( const Reference< interface_type > & rRef, UnoReference_QueryThrow dummy ) = delete;
+#endif
+
+ /** Queries given any for reference interface type (interface_type) and
+ sets it. An interface already set will be released.
+ Throws a RuntimeException if the demanded interface cannot be set.
+
+ @param rAny
+ an Any containing an interface
+ @param dummy
+ UNO_QUERY_THROW to force obvious distinction to set methods
+ */
+ inline void set( Any const & rAny, UnoReference_QueryThrow dummy);
+ /** sets the given interface
+ An interface already set will be released.
+ Throws a RuntimeException if the source interface is @b NULL.
+
+ @param pInterface an interface pointer
+ @param dummy UNO_SET_THROW to force obvious distinction to other set methods
+
+ @since UDK 3.2.8
+ */
+ inline void SAL_CALL set( interface_type * pInterface, UnoReference_SetThrow dummy);
+ /** sets the given interface
+ An interface already set will be released.
+ Throws a RuntimeException if the source interface is @b NULL.
+
+ @param rRef an interface reference
+ @param dummy UNO_SET_THROW to force obvious distinction to other set methods
+
+ @since UDK 3.2.8
+ */
+ inline void SAL_CALL set( const Reference< interface_type > & rRef, UnoReference_SetThrow dummy);
+
+
+ /** Assignment operator: Acquires given interface pointer and sets reference.
+ An interface already set will be released.
+
+ @param pInterface an interface pointer
+ @return this reference
+ */
+ inline Reference< interface_type > & SAL_CALL operator = ( interface_type * pInterface );
+ /** Assignment operator: Acquires given interface reference and sets reference.
+ An interface already set will be released.
+
+ @param rRef an interface reference
+ @return this reference
+ */
+ inline Reference< interface_type > & SAL_CALL operator = ( const Reference< interface_type > & rRef );
+#if defined LIBO_INTERNAL_ONLY
+ /** Assignment move operator: Acquires given interface reference and sets reference.
+ An interface already set will be released.
+
+ @param rRef an interface reference
+ @return this reference
+ */
+ inline Reference< interface_type > & operator = ( Reference< interface_type > && rRef ) noexcept;
+#endif
+ /** Queries given interface reference for type interface_type.
+
+ @param rRef interface reference
+ @return interface reference of demanded type (may be null)
+ */
+ SAL_WARN_UNUSED_RESULT inline static Reference< interface_type > SAL_CALL query( const BaseReference & rRef );
+ /** Queries given interface for type interface_type.
+
+ @param pInterface interface pointer
+ @return interface reference of demanded type (may be null)
+ */
+ SAL_WARN_UNUSED_RESULT inline static Reference< interface_type > SAL_CALL query( XInterface * pInterface );
+};
+
+}
+}
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/com/sun/star/uno/Reference.hxx b/include/com/sun/star/uno/Reference.hxx
new file mode 100644
index 000000000..7632c5504
--- /dev/null
+++ b/include/com/sun/star/uno/Reference.hxx
@@ -0,0 +1,481 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_COM_SUN_STAR_UNO_REFERENCE_HXX
+#define INCLUDED_COM_SUN_STAR_UNO_REFERENCE_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+#include <ostream>
+
+#include "com/sun/star/uno/Reference.h"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "com/sun/star/uno/Any.hxx"
+#include "cppu/cppudllapi.h"
+
+extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_unsatisfied_iquery_msg(
+ typelib_TypeDescriptionReference * pType )
+ SAL_THROW_EXTERN_C();
+extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_unsatisfied_iset_msg(
+ typelib_TypeDescriptionReference * pType )
+ SAL_THROW_EXTERN_C();
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+
+inline XInterface * BaseReference::iquery(
+ XInterface * pInterface, const Type & rType )
+{
+ if (pInterface)
+ {
+ Any aRet( pInterface->queryInterface( rType ) );
+ if (typelib_TypeClass_INTERFACE == aRet.pType->eTypeClass)
+ {
+ XInterface * pRet = static_cast< XInterface * >( aRet.pReserved );
+ aRet.pReserved = NULL;
+ return pRet;
+ }
+ }
+ return NULL;
+}
+
+template< class interface_type >
+inline XInterface * Reference< interface_type >::iquery(
+ XInterface * pInterface )
+{
+ return BaseReference::iquery(pInterface, interface_type::static_type());
+}
+
+inline XInterface * BaseReference::iquery_throw(
+ XInterface * pInterface, const Type & rType )
+{
+ XInterface * pQueried = iquery( pInterface, rType );
+ if (pQueried)
+ return pQueried;
+ throw RuntimeException(
+ ::rtl::OUString( cppu_unsatisfied_iquery_msg( rType.getTypeLibType() ), SAL_NO_ACQUIRE ),
+ Reference< XInterface >( pInterface ) );
+}
+
+template< class interface_type >
+inline XInterface * Reference< interface_type >::iquery_throw(
+ XInterface * pInterface )
+{
+ return BaseReference::iquery_throw(
+ pInterface, interface_type::static_type());
+}
+
+template< class interface_type >
+inline interface_type * Reference< interface_type >::iset_throw(
+ interface_type * pInterface )
+{
+ if (pInterface)
+ {
+ castToXInterface(pInterface)->acquire();
+ return pInterface;
+ }
+ throw RuntimeException(
+ ::rtl::OUString( cppu_unsatisfied_iset_msg( interface_type::static_type().getTypeLibType() ), SAL_NO_ACQUIRE ),
+ NULL );
+}
+
+template< class interface_type >
+inline Reference< interface_type >::~Reference() COVERITY_NOEXCEPT_FALSE
+{
+ if (_pInterface)
+ _pInterface->release();
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference()
+{
+ _pInterface = NULL;
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( const Reference< interface_type > & rRef )
+{
+ _pInterface = rRef._pInterface;
+ if (_pInterface)
+ _pInterface->acquire();
+}
+
+#if defined LIBO_INTERNAL_ONLY
+template< class interface_type >
+inline Reference< interface_type >::Reference( Reference< interface_type > && rRef ) noexcept
+{
+ _pInterface = rRef._pInterface;
+ rRef._pInterface = nullptr;
+}
+
+template< class interface_type > template< class derived_type >
+inline Reference< interface_type >::Reference(
+ const Reference< derived_type > & rRef,
+ std::enable_if_t<
+ std::is_base_of_v<interface_type, derived_type>
+ && !std::is_same_v<interface_type, XInterface>, void *>)
+{
+ interface_type * p = rRef.get();
+ _pInterface = castToXInterface(p);
+ if (_pInterface)
+ _pInterface->acquire();
+}
+#endif
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( interface_type * pInterface )
+{
+ _pInterface = castToXInterface(pInterface);
+ if (_pInterface)
+ _pInterface->acquire();
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( interface_type * pInterface, __sal_NoAcquire )
+{
+ _pInterface = castToXInterface(pInterface);
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( interface_type * pInterface, UnoReference_NoAcquire )
+{
+ _pInterface = castToXInterface(pInterface);
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( const BaseReference & rRef, UnoReference_Query )
+{
+ _pInterface = iquery( rRef.get() );
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( XInterface * pInterface, UnoReference_Query )
+{
+ _pInterface = iquery( pInterface );
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_Query )
+{
+ _pInterface = (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass
+ ? iquery( static_cast< XInterface * >( rAny.pReserved ) ) : NULL);
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( const BaseReference & rRef, UnoReference_QueryThrow )
+{
+ _pInterface = iquery_throw( rRef.get() );
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( XInterface * pInterface, UnoReference_QueryThrow )
+{
+ _pInterface = iquery_throw( pInterface );
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_QueryThrow )
+{
+ _pInterface = iquery_throw( typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass
+ ? static_cast< XInterface * >( rAny.pReserved ) : NULL );
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( const Reference< interface_type > & rRef, UnoReference_SetThrow )
+{
+ _pInterface = castToXInterface( iset_throw( rRef.get() ) );
+}
+
+template< class interface_type >
+inline Reference< interface_type >::Reference( interface_type * pInterface, UnoReference_SetThrow )
+{
+ _pInterface = castToXInterface( iset_throw( pInterface ) );
+}
+
+
+template< class interface_type >
+inline void Reference< interface_type >::clear()
+{
+ if (_pInterface)
+ {
+ XInterface * const pOld = _pInterface;
+ _pInterface = NULL;
+ pOld->release();
+ }
+}
+
+template< class interface_type >
+inline bool Reference< interface_type >::set(
+ interface_type * pInterface )
+{
+ if (pInterface)
+ castToXInterface(pInterface)->acquire();
+ XInterface * const pOld = _pInterface;
+ _pInterface = castToXInterface(pInterface);
+ if (pOld)
+ pOld->release();
+ return (NULL != pInterface);
+}
+
+template< class interface_type >
+inline bool Reference< interface_type >::set(
+ interface_type * pInterface, __sal_NoAcquire )
+{
+ XInterface * const pOld = _pInterface;
+ _pInterface = castToXInterface(pInterface);
+ if (pOld)
+ pOld->release();
+ return (NULL != pInterface);
+}
+
+template< class interface_type >
+inline bool Reference< interface_type >::set(
+ interface_type * pInterface, UnoReference_NoAcquire )
+{
+ return set( pInterface, SAL_NO_ACQUIRE );
+}
+
+
+template< class interface_type >
+inline bool Reference< interface_type >::set(
+ const Reference< interface_type > & rRef )
+{
+ return set( castFromXInterface( rRef._pInterface ) );
+}
+
+template< class interface_type >
+inline bool Reference< interface_type >::set(
+ XInterface * pInterface, UnoReference_Query )
+{
+ return set( castFromXInterface(iquery( pInterface )), SAL_NO_ACQUIRE );
+}
+
+template< class interface_type >
+inline bool Reference< interface_type >::set(
+ const BaseReference & rRef, UnoReference_Query )
+{
+ return set( castFromXInterface(iquery( rRef.get() )), SAL_NO_ACQUIRE );
+}
+
+
+template< class interface_type >
+inline bool Reference< interface_type >::set(
+ Any const & rAny, UnoReference_Query )
+{
+ return set(
+ castFromXInterface(
+ iquery(
+ rAny.pType->eTypeClass == typelib_TypeClass_INTERFACE
+ ? static_cast< XInterface * >( rAny.pReserved ) : NULL )),
+ SAL_NO_ACQUIRE );
+}
+
+
+template< class interface_type >
+inline void Reference< interface_type >::set(
+ XInterface * pInterface, UnoReference_QueryThrow )
+{
+ set( castFromXInterface(iquery_throw( pInterface )), SAL_NO_ACQUIRE );
+}
+
+template< class interface_type >
+inline void Reference< interface_type >::set(
+ const BaseReference & rRef, UnoReference_QueryThrow )
+{
+ set( castFromXInterface(iquery_throw( rRef.get() )), SAL_NO_ACQUIRE );
+}
+
+
+template< class interface_type >
+inline void Reference< interface_type >::set(
+ Any const & rAny, UnoReference_QueryThrow )
+{
+ set( castFromXInterface(
+ iquery_throw(
+ rAny.pType->eTypeClass == typelib_TypeClass_INTERFACE
+ ? static_cast< XInterface * >( rAny.pReserved ) : NULL )),
+ SAL_NO_ACQUIRE );
+}
+
+template< class interface_type >
+inline void Reference< interface_type >::set(
+ interface_type * pInterface, UnoReference_SetThrow )
+{
+ set( iset_throw( pInterface ), SAL_NO_ACQUIRE );
+}
+
+template< class interface_type >
+inline void Reference< interface_type >::set(
+ const Reference< interface_type > & rRef, UnoReference_SetThrow )
+{
+ set( rRef.get(), UNO_SET_THROW );
+}
+
+
+template< class interface_type >
+inline Reference< interface_type > & Reference< interface_type >::operator = (
+ interface_type * pInterface )
+{
+ set( pInterface );
+ return *this;
+}
+
+template< class interface_type >
+inline Reference< interface_type > & Reference< interface_type >::operator = (
+ const Reference< interface_type > & rRef )
+{
+ set( castFromXInterface( rRef._pInterface ) );
+ return *this;
+}
+
+#if defined LIBO_INTERNAL_ONLY
+template< class interface_type >
+inline Reference< interface_type > & Reference< interface_type >::operator = (
+ Reference< interface_type > && rRef ) noexcept
+{
+ if (_pInterface)
+ _pInterface->release();
+ _pInterface = rRef._pInterface;
+ rRef._pInterface = nullptr;
+ return *this;
+}
+#endif
+
+template< class interface_type >
+inline Reference< interface_type > Reference< interface_type >::query(
+ const BaseReference & rRef )
+{
+ return Reference< interface_type >(
+ castFromXInterface(iquery( rRef.get() )), SAL_NO_ACQUIRE );
+}
+
+template< class interface_type >
+inline Reference< interface_type > Reference< interface_type >::query(
+ XInterface * pInterface )
+{
+ return Reference< interface_type >(
+ castFromXInterface(iquery( pInterface )), SAL_NO_ACQUIRE );
+}
+
+
+inline bool BaseReference::operator == ( XInterface * pInterface ) const
+{
+ if (_pInterface == pInterface)
+ return true;
+ try
+ {
+ // only the query to XInterface must return the same pointer if they belong to same objects
+ Reference< XInterface > x1( _pInterface, UNO_QUERY );
+ Reference< XInterface > x2( pInterface, UNO_QUERY );
+ return (x1._pInterface == x2._pInterface);
+ }
+ catch (RuntimeException &)
+ {
+ return false;
+ }
+}
+
+
+inline bool BaseReference::operator < (
+ const BaseReference & rRef ) const
+{
+ if (_pInterface == rRef._pInterface)
+ return false;
+ try
+ {
+ // only the query to XInterface must return the same pointer:
+ Reference< XInterface > x1( _pInterface, UNO_QUERY );
+ Reference< XInterface > x2( rRef, UNO_QUERY );
+ return (x1._pInterface < x2._pInterface);
+ }
+ catch (RuntimeException &)
+ {
+ return false;
+ }
+}
+
+
+inline bool BaseReference::operator != ( XInterface * pInterface ) const
+{
+ return (! operator == ( pInterface ));
+}
+
+inline bool BaseReference::operator == ( const BaseReference & rRef ) const
+{
+ return operator == ( rRef._pInterface );
+}
+
+inline bool BaseReference::operator != ( const BaseReference & rRef ) const
+{
+ return (! operator == ( rRef._pInterface ));
+}
+
+#if defined LIBO_INTERNAL_ONLY
+/**
+ Support for BaseReference in std::ostream (and thus in CPPUNIT_ASSERT or
+ SAL_INFO macros, for example).
+
+ @since LibreOffice 5.4
+*/
+template<typename charT, typename traits> std::basic_ostream<charT, traits> &
+operator <<(
+ std::basic_ostream<charT, traits> & stream, BaseReference const & ref)
+{ return stream << ref.get(); }
+#endif
+
+}
+}
+}
+}
+
+#if defined LIBO_INTERNAL_ONLY
+namespace std
+{
+
+/**
+ Make css::uno::Reference hashable by default for use in STL containers.
+
+ @since LibreOffice 6.3
+*/
+template<typename T>
+struct hash<::css::uno::Reference<T>>
+{
+ std::size_t operator()(::css::uno::Reference<T> const & s) const
+ { return size_t(s.get()); }
+};
+
+}
+
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/com/sun/star/uno/Sequence.h b/include/com/sun/star/uno/Sequence.h
new file mode 100644
index 000000000..1b9f6a2aa
--- /dev/null
+++ b/include/com/sun/star/uno/Sequence.h
@@ -0,0 +1,361 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_COM_SUN_STAR_UNO_SEQUENCE_H
+#define INCLUDED_COM_SUN_STAR_UNO_SEQUENCE_H
+
+#include "typelib/typedescription.h"
+#include "uno/sequence2.h"
+#include "com/sun/star/uno/Type.h"
+#include "rtl/alloc.h"
+
+#include <new>
+
+#if defined LIBO_INTERNAL_ONLY
+#include <cassert>
+#include <initializer_list>
+#endif
+
+namespace rtl
+{
+class ByteSequence;
+}
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+/** Template C++ class representing an IDL sequence. Template argument is the
+ sequence element type. C++ Sequences are reference counted and shared,
+ so the sequence keeps a handle to its data. To keep value semantics,
+ copies are only generated if the sequence is to be modified (new handle).
+
+ @tparam E element type of sequence
+*/
+template< class E >
+class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI Sequence
+{
+ /** sequence handle
+ */
+ uno_Sequence * _pSequence;
+
+public:
+ /// @cond INTERNAL
+
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new ( ::size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete ( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new ( ::size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete ( void *, void * )
+ {}
+
+ /** Static pointer to typelib type of sequence.
+ Don't use directly, call getCppuType().
+ */
+ static typelib_TypeDescriptionReference * s_pType;
+
+ /// @endcond
+
+ /** typedefs the element type of the sequence
+ */
+ typedef E ElementType;
+
+ /** Default constructor: Creates an empty sequence.
+ */
+ inline Sequence();
+
+ /** Copy constructor: Creates a copy of given sequence.
+
+ @param rSeq another sequence of same type
+ */
+ inline Sequence( const Sequence & rSeq );
+
+ /** Constructor: Takes over ownership of given sequence.
+
+ @param pSequence a sequence
+ @param dummy SAL_NO_ACQUIRE to force obvious distinction to other
+ constructors
+ */
+ inline Sequence( uno_Sequence * pSequence, __sal_NoAcquire dummy );
+
+ /** Constructor: Creates a copy of given elements.
+
+ @param pElements an array of elements
+ @param len length of array
+ */
+ inline Sequence( const E * pElements, sal_Int32 len );
+
+ /** Constructor: Creates a default constructed sequence of given length.
+
+ @param len initial sequence length
+ */
+ inline explicit Sequence( sal_Int32 len );
+
+#if defined LIBO_INTERNAL_ONLY
+ /** Create a sequence with the given elements.
+
+ @param init an initializer_list
+
+ @since LibreOffice 5.0
+ */
+ inline Sequence(std::initializer_list<E> init);
+#endif
+
+ /** Destructor: Releases sequence handle. Last handle will destruct
+ elements and free memory.
+ */
+ inline ~Sequence();
+
+ /** Assignment operator: Acquires given sequence handle and releases
+ previously set handle.
+
+ @param rSeq another sequence of same type
+ @return this sequence
+ */
+ inline Sequence & SAL_CALL operator = ( const Sequence & rSeq );
+
+#if defined LIBO_INTERNAL_ONLY
+ inline Sequence & operator =(Sequence && other);
+#endif
+
+ /** Gets length of the sequence.
+
+ @return length of sequence
+ */
+ sal_Int32 SAL_CALL getLength() const
+ { return _pSequence->nElements; }
+
+ /** Tests whether the sequence has elements, i.e. elements count is
+ greater than zero.
+
+ @return true, if elements count is greater than zero
+ */
+ bool SAL_CALL hasElements() const
+ { return (_pSequence->nElements > 0); }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** This function allows to use Sequence in cases where std::size is needed, and the like.
+
+ @since LibreOffice 6.4
+ */
+ sal_uInt32 size() const
+ { assert(getLength() >= 0); return static_cast<sal_uInt32>(getLength()); }
+#endif
+
+ /** Gets a pointer to elements array for reading.
+ If the sequence has a length of 0, then the returned pointer is
+ undefined.
+
+ @return pointer to elements array
+ */
+ const E * SAL_CALL getConstArray() const
+ { return reinterpret_cast< const E * >( _pSequence->elements ); }
+
+ /** Gets a pointer to elements array for reading and writing.
+ In general if the sequence has a handle acquired by other sequences
+ (reference count > 1), then a new sequence is created copy constructing
+ all elements to keep value semantics!
+ If the sequence has a length of 0, then the returned pointer is
+ undefined.
+
+ @return pointer to elements array
+ */
+ inline E * SAL_CALL getArray();
+
+#if !defined LIBO_INTERNAL_ONLY
+ /** This function allows to use Sequence in standard algorithms, like std::find
+ and others.
+
+ @since LibreOffice 4.2
+ */
+ inline E * begin();
+#endif
+
+ /** This function allows to use Sequence in standard algorithms, like std::find
+ and others.
+
+ @since LibreOffice 4.2
+ */
+ inline E const * begin() const;
+
+#if !defined LIBO_INTERNAL_ONLY
+ /** This function allows to use Sequence in standard algorithms, like std::find
+ and others.
+
+ @since LibreOffice 4.2
+ */
+ inline E * end();
+#endif
+
+ /** This function allows to use Sequence in standard algorithms, like std::find
+ and others.
+
+ @since LibreOffice 4.2
+ */
+ inline E const * end() const;
+
+// Non-const operator[] is not available in internal code. Consider explicit use
+// of getArray(), out of tight loops if possible to avoid unneeded COW overhead.
+#if !defined LIBO_INTERNAL_ONLY
+ /** Non-const index operator: Obtains a reference to element indexed at
+ given position.
+ The implementation does not check for array bounds!
+ In general if the sequence has a handle acquired by other sequences
+ (reference count > 1), then a new sequence is created copy constructing
+ all elements to keep value semantics!
+
+ @param nIndex index
+ @return non-const C++ reference to element
+ */
+ inline E & SAL_CALL operator [] ( sal_Int32 nIndex );
+#endif
+
+ /** Const index operator: Obtains a reference to element indexed at
+ given position. The implementation does not check for array bounds!
+
+ @param nIndex index
+ @return const C++ reference to element
+ */
+ inline const E & SAL_CALL operator [] ( sal_Int32 nIndex ) const;
+
+ /** Equality operator: Compares two sequences.
+
+ @param rSeq another sequence of same type (right side)
+ @return true if both sequences are equal, false otherwise
+ */
+ inline bool SAL_CALL operator == ( const Sequence & rSeq ) const;
+
+ /** Inequality operator: Compares two sequences.
+
+ @param rSeq another sequence of same type (right side)
+ @return false if both sequences are equal, true otherwise
+ */
+ inline bool SAL_CALL operator != ( const Sequence & rSeq ) const;
+
+ /** Reallocates sequence to new length.
+ If the new length is smaller than the former, then upper elements will
+ be destructed (and their memory freed). If the new length is greater
+ than the former, then upper (new) elements are default constructed.
+ If the sequence has a handle acquired by other sequences
+ (reference count > 1), then the remaining elements are copy constructed
+ to a new sequence handle to keep value semantics!
+
+ @param nSize new size of sequence
+ */
+ inline void SAL_CALL realloc( sal_Int32 nSize );
+
+ /** Provides UNacquired sequence handle.
+
+ @return UNacquired sequence handle
+ */
+ uno_Sequence * SAL_CALL get() const
+ { return _pSequence; }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** Swaps sequences efficiently exchanging their underlying representations.
+
+ @param other another sequence of same type
+
+ @since LibreOffice 7.3
+ */
+ inline void swap(Sequence& other);
+#endif
+};
+
+// Find uses of illegal Sequence<bool> (instead of Sequence<sal_Bool>) during
+// compilation:
+template<> class Sequence<bool> {
+ Sequence(Sequence<bool> const &) SAL_DELETED_FUNCTION;
+};
+
+/** Creates a UNO byte sequence from a SAL byte sequence.
+
+ @param rByteSequence a byte sequence
+ @return a UNO byte sequence
+*/
+inline ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL toUnoSequence(
+ const ::rtl::ByteSequence & rByteSequence );
+
+}
+}
+}
+}
+
+/** Gets the meta type of IDL sequence.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @tparam E element type of sequence
+ @return type of IDL sequence
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+template< class E > SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type &
+SAL_CALL getCppuType( const ::com::sun::star::uno::Sequence< E > * );
+
+/** Gets the meta type of IDL sequence.
+ This function has been introduced, because one cannot get the (templated)
+ cppu type out of C++ array types.
+
+ @attention
+ the given element type must be the same as the template argument type!
+ @tparam E element type of sequence
+ @param rElementType element type of sequence
+ @return type of IDL sequence
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+template< class E > SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type &
+SAL_CALL getCppuSequenceType( const ::com::sun::star::uno::Type & rElementType );
+
+/** Gets the meta type of IDL sequence< char >.
+ This function has been introduced due to ambiguities with unsigned short.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL sequence< char >
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type &
+SAL_CALL getCharSequenceCppuType();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/com/sun/star/uno/Sequence.hxx b/include/com/sun/star/uno/Sequence.hxx
new file mode 100644
index 000000000..34d5def3b
--- /dev/null
+++ b/include/com/sun/star/uno/Sequence.hxx
@@ -0,0 +1,406 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_COM_SUN_STAR_UNO_SEQUENCE_HXX
+#define INCLUDED_COM_SUN_STAR_UNO_SEQUENCE_HXX
+
+#include "sal/config.h"
+
+#include <cassert>
+#include <cstddef>
+#if defined LIBO_INTERNAL_ONLY
+# include <type_traits>
+# include <ostream>
+# include <utility>
+#endif
+
+#include "osl/interlck.h"
+#include "com/sun/star/uno/Sequence.h"
+#include "typelib/typedescription.h"
+#include "uno/data.h"
+#include "com/sun/star/uno/genfunc.hxx"
+#include "cppu/unotype.hxx"
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+/// @cond INTERNAL
+template< class E >
+typelib_TypeDescriptionReference * Sequence< E >::s_pType = NULL;
+/// @endcond
+
+template< class E >
+inline Sequence< E >::Sequence()
+{
+ const Type & rType = ::cppu::getTypeFavourUnsigned( this );
+ ::uno_type_sequence_construct(
+ &_pSequence, rType.getTypeLibType(),
+ NULL, 0, cpp_acquire );
+ // no bad_alloc, because empty sequence is statically allocated in cppu
+}
+
+template< class E >
+inline Sequence< E >::Sequence( const Sequence & rSeq )
+{
+ osl_atomic_increment( &rSeq._pSequence->nRefCount );
+ _pSequence = rSeq._pSequence;
+}
+
+template< class E >
+inline Sequence< E >::Sequence(
+ uno_Sequence * pSequence, __sal_NoAcquire )
+ : _pSequence( pSequence )
+{
+}
+
+template< class E >
+inline Sequence< E >::Sequence( const E * pElements, sal_Int32 len )
+{
+ const Type & rType = ::cppu::getTypeFavourUnsigned( this );
+
+ bool success =
+ ::uno_type_sequence_construct(
+ &_pSequence, rType.getTypeLibType(),
+ const_cast< E * >( pElements ), len, cpp_acquire );
+ if (! success)
+ throw ::std::bad_alloc();
+}
+
+template< class E >
+inline Sequence< E >::Sequence( sal_Int32 len )
+{
+ const Type & rType = ::cppu::getTypeFavourUnsigned( this );
+ bool success =
+ ::uno_type_sequence_construct(
+ &_pSequence, rType.getTypeLibType(),
+ NULL, len, cpp_acquire );
+ if (! success)
+ throw ::std::bad_alloc();
+}
+
+#if defined LIBO_INTERNAL_ONLY
+template<typename E> Sequence<E>::Sequence(std::initializer_list<E> init) {
+ if (!uno_type_sequence_construct(
+ &_pSequence, cppu::getTypeFavourUnsigned(this).getTypeLibType(),
+ const_cast<E *>(init.begin()), init.size(), cpp_acquire))
+ {
+ throw std::bad_alloc();
+ }
+}
+#endif
+
+template< class E >
+inline Sequence< E >::~Sequence()
+{
+ if (osl_atomic_decrement( &_pSequence->nRefCount ) == 0)
+ {
+ const Type & rType = ::cppu::getTypeFavourUnsigned( this );
+ uno_type_sequence_destroy(
+ _pSequence, rType.getTypeLibType(), cpp_release );
+ }
+}
+
+template< class E >
+inline Sequence< E > & Sequence< E >::operator = ( const Sequence & rSeq )
+{
+ const Type & rType = ::cppu::getTypeFavourUnsigned( this );
+ ::uno_type_sequence_assign(
+ &_pSequence, rSeq._pSequence, rType.getTypeLibType(), cpp_release );
+ return *this;
+}
+
+#if defined LIBO_INTERNAL_ONLY
+template<typename E> Sequence<E> & Sequence<E>::operator =(Sequence && other) {
+ std::swap(_pSequence, other._pSequence);
+ return *this;
+}
+#endif
+
+template< class E >
+inline bool Sequence< E >::operator == ( const Sequence & rSeq ) const
+{
+ if (_pSequence == rSeq._pSequence)
+ return true;
+ if (_pSequence->nElements != rSeq._pSequence->nElements)
+ return false;
+ const Type & rType = ::cppu::getTypeFavourUnsigned( this );
+ return ::uno_type_equalData(
+ const_cast< Sequence * >( this ), rType.getTypeLibType(),
+ const_cast< Sequence * >( &rSeq ), rType.getTypeLibType(),
+ cpp_queryInterface,
+ cpp_release );
+}
+
+template< class E >
+inline bool Sequence< E >::operator != ( const Sequence & rSeq ) const
+{
+ return (! operator == ( rSeq ));
+}
+
+template< class E >
+inline E * Sequence< E >::getArray()
+{
+ const Type & rType = ::cppu::getTypeFavourUnsigned( this );
+ bool success =
+ ::uno_type_sequence_reference2One(
+ &_pSequence, rType.getTypeLibType(),
+ cpp_acquire, cpp_release );
+ if (! success)
+ throw ::std::bad_alloc();
+ return reinterpret_cast< E * >( _pSequence->elements );
+}
+
+#if !defined LIBO_INTERNAL_ONLY
+template<class E> E * Sequence<E>::begin() { return getArray(); }
+#endif
+
+template<class E> E const * Sequence<E>::begin() const
+{ return getConstArray(); }
+
+#if !defined LIBO_INTERNAL_ONLY
+template<class E> E * Sequence<E>::end() { return begin() + getLength(); }
+#endif
+
+template<class E> E const * Sequence<E>::end() const
+{ return begin() + getLength(); }
+
+#if !defined LIBO_INTERNAL_ONLY
+template< class E >
+inline E & Sequence< E >::operator [] ( sal_Int32 nIndex )
+{
+ // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
+ assert(nIndex >= 0 && static_cast<sal_uInt32>(nIndex) < static_cast<sal_uInt32>(getLength()));
+ return getArray()[ nIndex ];
+}
+#endif
+
+template< class E >
+inline const E & Sequence< E >::operator [] ( sal_Int32 nIndex ) const
+{
+ // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
+ assert(nIndex >= 0 && static_cast<sal_uInt32>(nIndex) < static_cast<sal_uInt32>(getLength()));
+ return reinterpret_cast< const E * >( _pSequence->elements )[ nIndex ];
+}
+
+template< class E >
+inline void Sequence< E >::realloc( sal_Int32 nSize )
+{
+ const Type & rType = ::cppu::getTypeFavourUnsigned( this );
+ bool success =
+ ::uno_type_sequence_realloc(
+ &_pSequence, rType.getTypeLibType(), nSize,
+ cpp_acquire, cpp_release );
+ if (!success)
+ throw ::std::bad_alloc();
+}
+
+#if defined LIBO_INTERNAL_ONLY
+template <class E> inline void Sequence<E>::swap(Sequence& other)
+{
+ std::swap(_pSequence, other._pSequence);
+}
+#endif
+
+inline ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL toUnoSequence(
+ const ::rtl::ByteSequence & rByteSequence )
+{
+ return * reinterpret_cast< const ::com::sun::star::uno::Sequence< sal_Int8 > * >( &rByteSequence );
+}
+
+#if defined LIBO_INTERNAL_ONLY
+
+/// @cond INTERNAL
+
+namespace uno_detail {
+
+template< typename value_t, typename charT, typename traits >
+void sequence_output_elems( std::basic_ostream<charT, traits> &os, const value_t *pAry, sal_Int32 nLen, std::true_type )
+{
+ // for integral types, use hex notation
+ auto const flags = os.setf(std::ios_base::hex);
+ for(sal_Int32 i=0; i<nLen-1; ++i)
+ os << "0x" << *pAry++ << ", ";
+ if( nLen > 1 )
+ os << "0x" << *pAry++;
+ os.setf(flags);
+}
+
+template< typename value_t, typename charT, typename traits >
+void sequence_output_elems( std::basic_ostream<charT, traits> &os, const value_t *pAry, sal_Int32 nLen, std::false_type )
+{
+ // every other type: rely on their own ostream operator<<
+ for(sal_Int32 i=0; i<nLen-1; ++i)
+ os << *pAry++ << ", ";
+ if( nLen > 1 )
+ os << *pAry++;
+}
+
+template< typename value_t, typename charT, typename traits >
+void sequence_output_bytes( std::basic_ostream<charT, traits> &os, const value_t *pAry, sal_Int32 nLen )
+{
+ // special case bytes - ostream operator<< outputs those as char
+ // values, but we need raw ints here
+ auto const flags = os.setf(std::ios_base::hex);
+ for(sal_Int32 i=0; i<nLen-1; ++i)
+ os << "0x" << (0xFF & +*pAry++) << ", ";
+ if( nLen > 1 )
+ os << "0x" << (0xFF & +*pAry++);
+ os.setf(flags);
+}
+
+}
+
+/**
+ Support for Sequence in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO
+ macros, for example).
+
+ @since LibreOffice 6.1
+*/
+template< typename value_t, typename charT, typename traits >
+inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &os, css::uno::Sequence<value_t> const& v)
+{
+ const value_t *pAry = v.getConstArray();
+ sal_Int32 nLen = v.getLength();
+ if constexpr (std::is_same<sal_Int8, value_t>::value) {
+ uno_detail::sequence_output_bytes(os, pAry, nLen);
+ } else {
+ uno_detail::sequence_output_elems(os, pAry, nLen, std::is_integral<value_t>());
+ }
+ return os;
+}
+
+template <class E> inline auto asNonConstRange(css::uno::Sequence<E>& s)
+{
+ // Two iterators [begin, end] representing the non-const range of the Sequence.
+ // It only calls Sequence::getArray once, to avoid the second COW overhead when
+ // Sequence::begin() and Sequence::end() are called in pairs.
+ // Inheriting from pair allows to use std::tie to unpack the two iterators.
+ struct SequenceRange : public std::pair<E*, E*>
+ {
+ SequenceRange(E* ptr, sal_Int32 len) : std::pair<E*, E*>(ptr, ptr + len) {}
+ // These allow to pass it as range-expression to range-based for loops
+ E* begin() { return std::pair<E*, E*>::first; }
+ E* end() { return std::pair<E*, E*>::second; }
+ E& operator[](sal_Int32 i) { assert(i >= 0 && i < end() - begin()); return begin()[i]; }
+ };
+ return SequenceRange(s.getLength() ? s.getArray() : nullptr, s.getLength());
+};
+
+/// @endcond
+
+#endif
+
+}
+}
+}
+}
+
+namespace cppu {
+
+template< typename T > inline ::com::sun::star::uno::Type const &
+getTypeFavourUnsigned(
+ SAL_UNUSED_PARAMETER ::com::sun::star::uno::Sequence< T > const *)
+{
+ if (::com::sun::star::uno::Sequence< T >::s_pType == NULL) {
+ ::typelib_static_sequence_type_init(
+ &::com::sun::star::uno::Sequence< T >::s_pType,
+ (::cppu::getTypeFavourUnsigned(
+ static_cast<
+ typename ::com::sun::star::uno::Sequence< T >::ElementType * >(
+ NULL)).
+ getTypeLibType()));
+ }
+ return detail::getTypeFromTypeDescriptionReference(
+ &::com::sun::star::uno::Sequence< T >::s_pType);
+}
+
+template< typename T > inline ::com::sun::star::uno::Type const &
+getTypeFavourChar(
+ SAL_UNUSED_PARAMETER ::com::sun::star::uno::Sequence< T > const *)
+{
+ //TODO On certain platforms with weak memory models, the following code can
+ // result in some threads observing that td points to garbage:
+ static typelib_TypeDescriptionReference * td = NULL;
+ if (td == NULL) {
+ ::typelib_static_sequence_type_init(
+ &td,
+ (::cppu::getTypeFavourChar(
+ static_cast<
+ typename ::com::sun::star::uno::Sequence< T >::ElementType * >(
+ NULL)).
+ getTypeLibType()));
+ }
+ return detail::getTypeFromTypeDescriptionReference(&td);
+}
+
+}
+
+// generic sequence template
+template< class E >
+inline const ::com::sun::star::uno::Type &
+SAL_CALL getCppuType(
+ SAL_UNUSED_PARAMETER const ::com::sun::star::uno::Sequence< E > * )
+{
+ return ::cppu::getTypeFavourUnsigned(
+ static_cast< ::com::sun::star::uno::Sequence< E > * >(0));
+}
+
+// generic sequence template for given element type (e.g. C++ arrays)
+template< class E >
+inline const ::com::sun::star::uno::Type &
+SAL_CALL getCppuSequenceType( const ::com::sun::star::uno::Type & rElementType )
+{
+ if (! ::com::sun::star::uno::Sequence< E >::s_pType)
+ {
+ ::typelib_static_sequence_type_init(
+ & ::com::sun::star::uno::Sequence< E >::s_pType,
+ rElementType.getTypeLibType() );
+ }
+ return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
+ & ::com::sun::star::uno::Sequence< E >::s_pType );
+}
+
+// char sequence
+inline const ::com::sun::star::uno::Type &
+SAL_CALL getCharSequenceCppuType()
+{
+ static typelib_TypeDescriptionReference * s_pType_com_sun_star_uno_Sequence_Char = NULL;
+ if (! s_pType_com_sun_star_uno_Sequence_Char)
+ {
+ const ::com::sun::star::uno::Type & rElementType = cppu::UnoType<cppu::UnoCharType>::get();
+ ::typelib_static_sequence_type_init(
+ & s_pType_com_sun_star_uno_Sequence_Char,
+ rElementType.getTypeLibType() );
+ }
+ return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
+ & s_pType_com_sun_star_uno_Sequence_Char );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/com/sun/star/uno/Type.h b/include/com/sun/star/uno/Type.h
new file mode 100644
index 000000000..5dc1b41e0
--- /dev/null
+++ b/include/com/sun/star/uno/Type.h
@@ -0,0 +1,502 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_COM_SUN_STAR_UNO_TYPE_H
+#define INCLUDED_COM_SUN_STAR_UNO_TYPE_H
+
+#include "typelib/typedescription.h"
+#include "com/sun/star/uno/TypeClass.hdl"
+#include "rtl/ustring.hxx"
+#include "rtl/alloc.h"
+
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+/** Enum defining UNO_TYPE_NO_ACQUIRE for type description reference transfer.
+*/
+enum UnoType_NoAcquire
+{
+ /** This enum value can be used for creating a Type object granting a given type description
+ reference, i.e. transferring ownership to it.
+ */
+ UNO_TYPE_NO_ACQUIRE
+};
+
+/** C++ class representing an IDL meta type. This class is used to represent a type,
+ i.e. a type name and its type class.
+ Internally the type holds a C type description reference of the runtime.
+ You can obtain a full type description of a type by calling member function getDescription().
+
+ @see typelib_TypeDescriptionReference
+*/
+class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI Type
+{
+ /** the C typelib reference pointer
+ */
+ typelib_TypeDescriptionReference * _pType;
+
+public:
+ /// @cond INTERNAL
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new ( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete ( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new ( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete ( void *, void * )
+ {}
+ /// @endcond
+
+ /** Default Constructor: Type is set to void.
+ */
+ inline Type();
+
+ /** Constructor: Type is constructed by given name and type class.
+
+ @param eTypeClass type class of type
+ @param rTypeName name of type
+ */
+ inline Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName );
+
+ /** Constructor: Type is constructed by given name and type class.
+
+ @param eTypeClass type class of type
+ @param pTypeName name of type
+ */
+ inline Type( TypeClass eTypeClass, const char * pTypeName );
+
+ /** Constructor: Type is (copy) constructed by given C type description reference.
+
+ @param pType C type description reference
+ */
+ inline Type( typelib_TypeDescriptionReference * pType );
+
+ /** Constructor: Type is (copy) constructed by given C type description reference
+ without acquiring it.
+
+ @param pType C type description reference
+ @param dummy UNO_TYPE_NO_ACQUIRE to force obvious distinction to other constructors
+ */
+ inline Type( typelib_TypeDescriptionReference * pType, UnoType_NoAcquire dummy );
+ /** Constructor: Type is (copy) constructed by given C type description reference
+ without acquiring it.
+
+ @param pType C type description reference
+ @param dummy SAL_NO_ACQUIRE to force obvious distinction to other constructors
+ */
+ inline Type( typelib_TypeDescriptionReference * pType, __sal_NoAcquire dummy );
+
+ /** Copy constructor: Type is copy constructed by given type.
+
+ @param rType another type
+ */
+ inline Type( const Type & rType );
+
+ /** Destructor: Releases acquired C type description reference.
+ */
+ ~Type()
+ { ::typelib_typedescriptionreference_release( _pType ); }
+
+ /** Assignment operator: Acquires right side type and releases previously set type.
+
+ @param rType another type (right side)
+ @return this type
+ */
+ inline Type & SAL_CALL operator = ( const Type & rType );
+
+#if defined LIBO_INTERNAL_ONLY
+ inline Type & SAL_CALL operator = ( Type && );
+#endif
+
+ /** Gets the type class of set type.
+
+ @return type class of set type
+ */
+ TypeClass SAL_CALL getTypeClass() const
+ { return static_cast<TypeClass>(_pType->eTypeClass); }
+
+ /** Gets the name of the set type.
+
+ @return name of the set type
+ */
+ inline ::rtl::OUString SAL_CALL getTypeName() const;
+
+ /** Obtains a full type description of set type.
+
+ @param ppDescr [inout] type description
+ */
+ void SAL_CALL getDescription( typelib_TypeDescription ** ppDescr ) const
+ { ::typelib_typedescriptionreference_getDescription( ppDescr, _pType ); }
+
+ /** Gets the C typelib type description reference pointer. Does not acquire the reference!
+
+ @return UNacquired type description reference
+ */
+ typelib_TypeDescriptionReference * SAL_CALL getTypeLibType() const
+ { return _pType; }
+
+ /** Tests if values of this reflected type can be assigned by values of given type.
+ This includes widening conversion (e.g., long assignable from short), as long as there
+ is no data loss.
+
+ @param rType another type
+ @return true if values of this type can be assigned from values of given type,
+ false otherwise
+ */
+ bool SAL_CALL isAssignableFrom( const Type & rType ) const
+ { return ::typelib_typedescriptionreference_isAssignableFrom( _pType, rType._pType ); }
+
+ /** Compares two types.
+
+ @param rType another type
+ @return true if both types refer the same type, false otherwise
+ */
+ bool SAL_CALL equals( const Type & rType ) const
+ { return ::typelib_typedescriptionreference_equals( _pType, rType._pType ); }
+ /** Equality operator: Compares two types.
+
+ @param rType another type
+ @return true if both types refer the same type, false otherwise
+ */
+ bool SAL_CALL operator == ( const Type & rType ) const
+ { return ::typelib_typedescriptionreference_equals( _pType, rType._pType ); }
+ /** Inequality operator: Compares two types.
+
+ @param rType another type
+ @return false if both types refer the same type, true otherwise
+ */
+ bool SAL_CALL operator != ( const Type & rType ) const
+ { return (! ::typelib_typedescriptionreference_equals( _pType, rType._pType )); }
+};
+
+/** Helper class to specify a type pointer for idl arrays.
+*/
+template< class T >
+class Array
+{
+public:
+ static typelib_TypeDescriptionReference * s_pType;
+};
+
+}
+}
+}
+}
+
+/** Gets the meta type of IDL type "type".
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type "type"
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::com::sun::star::uno::Type * );
+
+/** Gets the meta type of IDL type void.
+ @return type of IDL type void
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuVoidType();
+/** Gets the meta type of IDL type void.
+
+ @return type of IDL type void
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getVoidCppuType();
+
+/** Gets the meta type of IDL type boolean.
+
+ @return type of IDL type boolean
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuBooleanType();
+/** Gets the meta type of IDL type boolean.
+
+ @return type of IDL type boolean
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getBooleanCppuType();
+/** Gets the meta type of IDL type boolean.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type boolean
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Bool * );
+/** Gets the meta type of IDL type boolean.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type boolean
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType(
+ bool const * );
+
+/** Gets the meta type of IDL type char.
+
+ @return type of IDL type char
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCharCppuType();
+/** Gets the meta type of IDL type char.
+
+ @return type of IDL type char
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuCharType();
+
+/** Gets the meta type of IDL type byte.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type byte
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int8 * );
+
+/** Gets the meta type of IDL type string.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type string
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::rtl::OUString * );
+
+/** Gets the meta type of IDL type short.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type short
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int16 * );
+
+/** Gets the meta type of IDL type unsigned short.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type unsigned short
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt16 * );
+
+/** Gets the meta type of IDL type long.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type long
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int32 * );
+
+/** Gets the meta type of IDL type unsigned long.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type unsigned long
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt32 * );
+
+/** Gets the meta type of IDL type hyper.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type hyper
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int64 * );
+
+/** Gets the meta type of IDL type unsigned hyper.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type unsigned hyper
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt64 * );
+
+/** Gets the meta type of IDL type float.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type float
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const float * );
+
+/** Gets the meta type of IDL type double.
+
+ There are cases (involving templates) where uses of getCppuType are known to
+ not compile. Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
+
+ The dummy parameter is just a typed pointer for function signature.
+
+ @return type of IDL type double
+
+ @deprecated
+ Use cppu::UnoType instead.
+*/
+SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const double * );
+
+/** Gets the meta type of an IDL type.
+
+ The difference between this function template (with a type parameter) and
+ the overloaded getCppuType function with a single (dummy) parameter of a
+ specific type is that this function template may not work for the UNO type
+ "unsigned short" (sal_uInt16 in C++), while the overloaded one-parameter
+ function may not work for the UNO type "char" (sal_Unicode in C++, which may
+ have the same underlying C++ type as sal_uInt16 on certain platforms).
+
+ @return type of the given IDL type
+
+ @deprecated
+ Use cppu::UnoType instead (or the internal-only cppu::getTypeFavourChar).
+ Also note that getCppuType< com::sun::star::uno::Sequence< sal_Unicode > >()
+ does not work as expected.
+
+ @since UDK 3.2.0
+*/
+template< typename T > SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL
+getCppuType();
+
+/** Gets the meta type of IDL type char.
+
+ @return type of IDL type char
+
+ @deprecated
+ Use cppu::UnoType instead (or the internal-only cppu::getTypeFavourChar).
+ Also note that getCppuType< com::sun::star::uno::Sequence< sal_Unicode > >()
+ does not work as expected.
+
+ @since UDK 3.2.0
+*/
+template<> SAL_DEPRECATED("use cppu::UnoType")
+inline const ::com::sun::star::uno::Type & SAL_CALL
+getCppuType< sal_Unicode >();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/com/sun/star/uno/Type.hxx b/include/com/sun/star/uno/Type.hxx
new file mode 100644
index 000000000..f62d0a17b
--- /dev/null
+++ b/include/com/sun/star/uno/Type.hxx
@@ -0,0 +1,231 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_COM_SUN_STAR_UNO_TYPE_HXX
+#define INCLUDED_COM_SUN_STAR_UNO_TYPE_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+#include <ostream>
+
+#include "com/sun/star/uno/Type.h"
+#include "cppu/unotype.hxx"
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+
+inline Type::Type()
+{
+ _pType = reinterpret_cast< const ::com::sun::star::uno::Type * >(
+ ::typelib_static_type_getByTypeClass( typelib_TypeClass_VOID ) )->getTypeLibType();
+ ::typelib_typedescriptionreference_acquire( _pType );
+}
+
+inline Type::Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName )
+ : _pType( NULL )
+{
+ ::typelib_typedescriptionreference_new( &_pType, static_cast<typelib_TypeClass>(eTypeClass), rTypeName.pData );
+}
+
+inline Type::Type( TypeClass eTypeClass, const char * pTypeName )
+ : _pType( NULL )
+{
+ ::typelib_typedescriptionreference_newByAsciiName( &_pType, static_cast<typelib_TypeClass>(eTypeClass), pTypeName );
+}
+
+inline Type::Type( typelib_TypeDescriptionReference * pType )
+ : _pType( pType )
+{
+ ::typelib_typedescriptionreference_acquire( _pType );
+}
+
+inline Type::Type( typelib_TypeDescriptionReference * pType, UnoType_NoAcquire )
+ : _pType( pType )
+{
+}
+
+inline Type::Type( typelib_TypeDescriptionReference * pType, __sal_NoAcquire )
+ : _pType( pType )
+{
+}
+
+inline Type::Type( const Type & rType )
+ : _pType( rType._pType )
+{
+ ::typelib_typedescriptionreference_acquire( _pType );
+}
+
+inline ::rtl::OUString Type::getTypeName() const
+{
+ return ::rtl::OUString( _pType->pTypeName );
+}
+
+inline Type & Type::operator = ( const Type & rType )
+{
+ ::typelib_typedescriptionreference_assign( &_pType, rType._pType );
+ return *this;
+}
+
+#if defined LIBO_INTERNAL_ONLY
+inline Type & Type::operator = ( Type && rType )
+{
+ std::swap(_pType, rType._pType);
+ return *this;
+}
+#endif
+
+
+template< class T >
+typelib_TypeDescriptionReference * Array< T >::s_pType = NULL;
+
+#if defined LIBO_INTERNAL_ONLY
+/**
+ Support for Type in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO
+ macros, for example).
+
+ @since LibreOffice 5.4
+*/
+template<typename charT, typename traits> std::basic_ostream<charT, traits> &
+operator <<(std::basic_ostream<charT, traits> & stream, Type const & type)
+{ return stream << type.getTypeName(); }
+#endif
+
+}
+}
+}
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const ::com::sun::star::uno::Type * )
+{
+ return ::cppu::UnoType< ::com::sun::star::uno::Type >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuVoidType()
+{
+ return ::cppu::UnoType<void>::get();
+}
+inline const ::com::sun::star::uno::Type & SAL_CALL getVoidCppuType()
+{
+ return ::cppu::UnoType<void>::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuBooleanType()
+{
+ return ::cppu::UnoType< bool >::get();
+}
+inline const ::com::sun::star::uno::Type & SAL_CALL getBooleanCppuType()
+{
+ return ::cppu::UnoType< bool >::get();
+}
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Bool * )
+{
+ return ::cppu::UnoType< bool >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType(
+ SAL_UNUSED_PARAMETER bool const * )
+{
+ return ::cppu::UnoType< bool >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCharCppuType()
+{
+ return ::cppu::UnoType< ::cppu::UnoCharType >::get();
+}
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuCharType()
+{
+ return ::cppu::UnoType< ::cppu::UnoCharType >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int8 * )
+{
+ return ::cppu::UnoType< ::sal_Int8 >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const ::rtl::OUString * )
+{
+ return ::cppu::UnoType< ::rtl::OUString >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int16 * )
+{
+ return ::cppu::UnoType< ::sal_Int16 >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt16 * )
+{
+ return ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int32 * )
+{
+ return ::cppu::UnoType< ::sal_Int32 >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt32 * )
+{
+ return ::cppu::UnoType< ::sal_uInt32 >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int64 * )
+{
+ return ::cppu::UnoType< ::sal_Int64 >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt64 * )
+{
+ return ::cppu::UnoType< ::sal_uInt64 >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const float * )
+{
+ return ::cppu::UnoType< float >::get();
+}
+
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const double * )
+{
+ return ::cppu::UnoType< double >::get();
+}
+
+template< typename T >
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType()
+{
+ return ::cppu::UnoType< T >::get();
+}
+
+template<>
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType< sal_Unicode >()
+{
+ return ::cppu::UnoType< ::cppu::UnoCharType >::get();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/com/sun/star/uno/genfunc.h b/include/com/sun/star/uno/genfunc.h
new file mode 100644
index 000000000..4ec0ec203
--- /dev/null
+++ b/include/com/sun/star/uno/genfunc.h
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_COM_SUN_STAR_UNO_GENFUNC_H
+#define INCLUDED_COM_SUN_STAR_UNO_GENFUNC_H
+
+#include "sal/types.h"
+
+typedef struct _typelib_TypeDescriptionReference typelib_TypeDescriptionReference;
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+/** Function to acquire a C++ interface.
+
+ @param pCppI C++ interface pointer
+*/
+inline void SAL_CALL cpp_acquire(void* pCppI);
+/** Function to release a C++ interface.
+
+ @param pCppI C++ interface pointer
+*/
+inline void SAL_CALL cpp_release(void* pCppI);
+/** Function to query for a C++ interface.
+
+ @param pCppI C++ interface pointer
+ @param pType demanded interface type
+ @return acquired C++ interface pointer or null
+*/
+inline void* SAL_CALL cpp_queryInterface(void* pCppI, typelib_TypeDescriptionReference* pType);
+}
+}
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/com/sun/star/uno/genfunc.hxx b/include/com/sun/star/uno/genfunc.hxx
new file mode 100644
index 000000000..ad1b8bc7e
--- /dev/null
+++ b/include/com/sun/star/uno/genfunc.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_COM_SUN_STAR_UNO_GENFUNC_HXX
+#define INCLUDED_COM_SUN_STAR_UNO_GENFUNC_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "com/sun/star/uno/genfunc.h"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/XInterface.hpp"
+
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+
+inline void SAL_CALL cpp_acquire( void * pCppI )
+{
+ static_cast< XInterface * >( pCppI )->acquire();
+}
+
+inline void SAL_CALL cpp_release( void * pCppI )
+{
+ static_cast< XInterface * >( pCppI )->release();
+}
+
+inline void * SAL_CALL cpp_queryInterface( void * pCppI, typelib_TypeDescriptionReference * pType )
+{
+ if (pCppI)
+ {
+ try
+ {
+ Any aRet( static_cast< XInterface * >( pCppI )->queryInterface(
+ * reinterpret_cast< const Type * >( &pType ) ) );
+ if (typelib_TypeClass_INTERFACE == aRet.pType->eTypeClass)
+ {
+ XInterface * pRet = static_cast< XInterface * >( aRet.pReserved );
+ aRet.pReserved = NULL;
+ return pRet;
+ }
+ }
+ catch (RuntimeException &)
+ {
+ }
+ }
+ return NULL;
+}
+
+}
+}
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/AccessibleImplementationHelper.hxx b/include/comphelper/AccessibleImplementationHelper.hxx
new file mode 100644
index 000000000..b6c8d9ab0
--- /dev/null
+++ b/include/comphelper/AccessibleImplementationHelper.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::awt
+{
+struct KeyStroke;
+}
+namespace com::sun::star::uno
+{
+template <class E> class Sequence;
+}
+
+namespace comphelper
+{
+/**
+ * Helper function used for converting keybinding to string.
+ *
+ * @param keySet the key stroke sequence.
+ */
+COMPHELPER_DLLPUBLIC OUString
+GetkeyBindingStrByXkeyBinding(const css::uno::Sequence<css::awt::KeyStroke>& keySet);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/comphelper/ChainablePropertySet.hxx b/include/comphelper/ChainablePropertySet.hxx
new file mode 100644
index 000000000..fb4fbd744
--- /dev/null
+++ b/include/comphelper/ChainablePropertySet.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_CHAINABLEPROPERTYSET_HXX
+#define INCLUDED_COMPHELPER_CHAINABLEPROPERTYSET_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <comphelper/comphelperdllapi.h>
+#include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
+
+namespace comphelper { class SolarMutex; }
+namespace comphelper { struct PropertyInfo; }
+
+namespace comphelper
+{
+ class ChainablePropertySetInfo;
+}
+
+/*
+ * A ChainablePropertySet has the following features:
+ *
+ * 1. It implements both the PropertySet and MultiPropertySet interfaces.
+ * 2. It can be 'included' in a MasterPropertySet to seamlessly appear as if
+ * if it's properties were in the master.
+ *
+ * To be used as a base class for PropertySets, the subclass must implement
+ * the 6 protected pure virtual functions. If a mutex is passed to the
+ * constructor, this is locked before any call to _getSingleValue or
+ * _setSingleValue and released after all processing has completed
+ * (including _postSetValues or _postGetValues )
+ *
+ * Any MasterPropertySet implementations that can include an
+ * implementation of a given ChainablePropertySet must be
+ * declared as a 'friend' in the implementation of the ChainablePropertySet.
+ *
+ */
+
+namespace comphelper
+{
+ typedef cppu::WeakImplHelper
+ <
+ css::beans::XPropertySet,
+ css::beans::XMultiPropertySet,
+ css::lang::XServiceInfo
+ >
+ ChainablePropertySetBase;
+ class COMPHELPER_DLLPUBLIC ChainablePropertySet : public ChainablePropertySetBase,
+ public css::beans::XPropertyState
+ {
+ friend class MasterPropertySet;
+ protected:
+ SolarMutex* const mpMutex;
+ rtl::Reference < ChainablePropertySetInfo > mxInfo;
+
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void _preSetValues () = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void _setSingleValue(const comphelper::PropertyInfo & rInfo, const css::uno::Any &rValue) = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void _postSetValues () = 0;
+
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void _preGetValues () = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, css::uno::Any & rValue ) = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ virtual void _postGetValues () = 0;
+
+ public:
+ ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, SolarMutex* pMutex )
+ noexcept;
+ virtual ~ChainablePropertySet()
+ noexcept override;
+
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override
+ { return ChainablePropertySetBase::queryInterface( aType ); }
+ void SAL_CALL acquire( ) noexcept override
+ { ChainablePropertySetBase::acquire( ); }
+ void SAL_CALL release( ) noexcept override
+ { ChainablePropertySetBase::release( ); }
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
+ virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+ virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+ virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+
+ // XPropertyState
+ virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
+ virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
+ virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/ChainablePropertySetInfo.hxx b/include/comphelper/ChainablePropertySetInfo.hxx
new file mode 100644
index 000000000..5ece0701c
--- /dev/null
+++ b/include/comphelper/ChainablePropertySetInfo.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_CHAINABLEPROPERTYSETINFO_HXX
+#define INCLUDED_COMPHELPER_CHAINABLEPROPERTYSETINFO_HXX
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <comphelper/PropertyInfoHash.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+/*
+ * A ChainablePropertySetInfo is usually initialised with a pointer to the first element
+ * of a null-terminated static table of PropertyInfo structs. This is placed in a hash_map
+ * for fast access
+ *
+ */
+namespace comphelper
+{
+ // workaround for incremental linking bugs in MSVC2015
+ class SAL_DLLPUBLIC_TEMPLATE ChainablePropertySetInfo_Base : public cppu::WeakImplHelper< css::beans::XPropertySetInfo > {};
+
+ class COMPHELPER_DLLPUBLIC ChainablePropertySetInfo final : public ChainablePropertySetInfo_Base
+ {
+ public:
+ ChainablePropertySetInfo( PropertyInfo const * pMap );
+
+ void remove( const OUString& aName );
+
+ private:
+ virtual ~ChainablePropertySetInfo()
+ noexcept override;
+
+ // XPropertySetInfo
+ virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override;
+ virtual css::beans::Property SAL_CALL getPropertyByName( const OUString& aName ) override;
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) override;
+
+ PropertyInfoHash maMap;
+ css::uno::Sequence < css::beans::Property > maProperties;
+
+ friend class ChainablePropertySet;
+ friend class MasterPropertySet;
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/DirectoryHelper.hxx b/include/comphelper/DirectoryHelper.hxx
new file mode 100644
index 000000000..321e9f960
--- /dev/null
+++ b/include/comphelper/DirectoryHelper.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustring.hxx>
+#include <set>
+#include <string_view>
+
+namespace comphelper
+{
+class COMPHELPER_DLLPUBLIC DirectoryHelper
+{
+public:
+ static std::u16string_view splitAtLastToken(std::u16string_view rSrc, sal_Unicode aToken,
+ OUString& rRight);
+ static bool fileExists(const OUString& rBaseURL);
+ static bool dirExists(const OUString& rDirURL);
+
+ // all rDirs and rFiles strings are already URI encoded, so safe for concat
+ static void scanDirsAndFiles(const OUString& rDirURL, std::set<OUString>& rDirs,
+ std::set<std::pair<OUString, OUString>>& rFiles);
+ static bool deleteDirRecursively(const OUString& rDirURL);
+ static bool moveDirContent(const OUString& rSourceDirURL, std::u16string_view rTargetDirURL,
+ const std::set<OUString>& rExcludeList);
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/IdPropArrayHelper.hxx b/include/comphelper/IdPropArrayHelper.hxx
new file mode 100644
index 000000000..8b70db849
--- /dev/null
+++ b/include/comphelper/IdPropArrayHelper.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <mutex>
+#include <cppuhelper/propshlp.hxx>
+#include <cassert>
+#include <unordered_map>
+
+namespace comphelper
+{
+
+ typedef std::unordered_map< sal_Int32, ::cppu::IPropertyArrayHelper* > OIdPropertyArrayMap;
+ template <class TYPE>
+ class OIdPropertyArrayUsageHelper
+ {
+ public:
+ OIdPropertyArrayUsageHelper();
+ virtual ~OIdPropertyArrayUsageHelper()
+ {
+ std::unique_lock aGuard(theMutex());
+ assert(s_nRefCount > 0 && "OIdPropertyArrayUsageHelper::~OIdPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !");
+ if (!--s_nRefCount)
+ {
+ // delete the element
+ for (auto const& elem : *s_pMap)
+ delete elem.second;
+ delete s_pMap;
+ s_pMap = nullptr;
+ }
+ }
+
+ /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the
+ class, which is created if necessary.
+ */
+ ::cppu::IPropertyArrayHelper* getArrayHelper(sal_Int32 nId);
+
+ protected:
+ /** used to implement the creation of the array helper which is shared amongst all instances of the class.
+ This method needs to be implemented in derived classes.
+ <BR>
+ The method gets called with Mutex acquired.
+ @return a pointer to the newly created array helper. Must not be NULL.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const = 0;
+ private:
+ static sal_Int32 s_nRefCount;
+ static OIdPropertyArrayMap* s_pMap;
+ static std::mutex& theMutex()
+ {
+ static std::mutex SINGLETON;
+ return SINGLETON;
+ }
+ };
+
+ template<class TYPE>
+ sal_Int32 OIdPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0;
+
+ template<class TYPE>
+ OIdPropertyArrayMap* OIdPropertyArrayUsageHelper< TYPE >::s_pMap = nullptr;
+
+ template <class TYPE>
+ OIdPropertyArrayUsageHelper<TYPE>::OIdPropertyArrayUsageHelper()
+ {
+ std::unique_lock aGuard(theMutex());
+ // create the map if necessary
+ if (!s_pMap)
+ s_pMap = new OIdPropertyArrayMap;
+ ++s_nRefCount;
+ }
+
+ template <class TYPE>
+ ::cppu::IPropertyArrayHelper* OIdPropertyArrayUsageHelper<TYPE>::getArrayHelper(sal_Int32 nId)
+ {
+ assert(s_nRefCount && "OIdPropertyArrayUsageHelper::getArrayHelper : suspicious call : have a refcount of 0 !");
+ std::unique_lock aGuard(theMutex());
+ // do we have the array already?
+ auto& rEntry = (*s_pMap)[nId];
+ if (!rEntry)
+ {
+ rEntry = createArrayHelper(nId);
+ assert(rEntry && "OIdPropertyArrayUsageHelper::getArrayHelper : createArrayHelper returned nonsense !");
+ }
+ return (*s_pMap)[nId];
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/MasterPropertySet.hxx b/include/comphelper/MasterPropertySet.hxx
new file mode 100644
index 000000000..acd9ce9c4
--- /dev/null
+++ b/include/comphelper/MasterPropertySet.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_MASTERPROPERTYSET_HXX
+#define INCLUDED_COMPHELPER_MASTERPROPERTYSET_HXX
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <comphelper/comphelperdllapi.h>
+#include <comphelper/ChainablePropertySet.hxx>
+#include <rtl/ref.hxx>
+#include <map>
+
+namespace comphelper { class SolarMutex; }
+namespace comphelper { struct PropertyInfo; }
+
+namespace comphelper
+{
+ class MasterPropertySetInfo;
+ class ChainablePropertySet;
+ struct SlaveData
+ {
+ rtl::Reference < ChainablePropertySet > mxSlave;
+ bool mbInit;
+
+ SlaveData ( ChainablePropertySet *pSlave);
+ bool IsInit () const { return mbInit;}
+ void SetInit ( bool bInit) { mbInit = bInit; }
+ };
+}
+
+/*
+ * A MasterPropertySet implements all of the features of a ChainablePropertySet
+ * (it is not inherited from ChainablePropertySet to prevent MasterPropertySets
+ * being chained to each other), but also allows properties implemented in
+ * other ChainablePropertySets to be included as 'native' properties in a
+ * given MasterPropertySet implementation. These are registered using the
+ * 'registerSlave' method, and require that the implementation of the
+ * ChainablePropertySet and the implementation of the ChainablePropertySetInfo
+ * both declare the implementation of the MasterPropertySet as a friend.
+ */
+namespace comphelper
+{
+ class COMPHELPER_DLLPUBLIC MasterPropertySet : public css::beans::XPropertySet,
+ public css::beans::XPropertyState,
+ public css::beans::XMultiPropertySet
+ {
+ protected:
+ SolarMutex* const mpMutex;
+ sal_uInt8 mnLastId;
+ std::map< sal_uInt8, comphelper::SlaveData* > maSlaveMap;
+ rtl::Reference< MasterPropertySetInfo > mxInfo;
+
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ virtual void _preSetValues () = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const css::uno::Any &rValue ) = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ virtual void _postSetValues () = 0;
+
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ virtual void _preGetValues () = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, css::uno::Any & rValue ) = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ virtual void _postGetValues () = 0;
+
+ public:
+ MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, SolarMutex* pMutex )
+ noexcept;
+ virtual ~MasterPropertySet()
+ noexcept;
+ void registerSlave ( ChainablePropertySet *pNewSet )
+ noexcept;
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
+ virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+ virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+ virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+
+ // XPropertyState
+ virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
+ virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
+ virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/MasterPropertySetInfo.hxx b/include/comphelper/MasterPropertySetInfo.hxx
new file mode 100644
index 000000000..0e50cc457
--- /dev/null
+++ b/include/comphelper/MasterPropertySetInfo.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_MASTERPROPERTYSETINFO_HXX
+#define INCLUDED_COMPHELPER_MASTERPROPERTYSETINFO_HXX
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <comphelper/PropertyInfoHash.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace comphelper
+{
+ // workaround for incremental linking bugs in MSVC2015
+ class SAL_DLLPUBLIC_TEMPLATE MasterPropertySetInfo_Base : public cppu::WeakImplHelper< css::beans::XPropertySetInfo > {};
+
+ class COMPHELPER_DLLPUBLIC MasterPropertySetInfo final : public MasterPropertySetInfo_Base
+ {
+ public:
+ MasterPropertySetInfo( PropertyInfo const * pMap );
+
+ private:
+ virtual ~MasterPropertySetInfo()
+ noexcept override;
+
+ void add( PropertyInfoHash &rHash, sal_uInt8 nMapId );
+
+ // XPropertySetInfo
+ virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override;
+ virtual css::beans::Property SAL_CALL getPropertyByName( const OUString& aName ) override;
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) override;
+
+ PropertyDataHash maMap;
+ css::uno::Sequence < css::beans::Property > maProperties;
+
+ friend class MasterPropertySet;
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/PropertyInfoHash.hxx b/include/comphelper/PropertyInfoHash.hxx
new file mode 100644
index 000000000..8c584ce5a
--- /dev/null
+++ b/include/comphelper/PropertyInfoHash.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTYINFOHASH_HXX
+#define INCLUDED_COMPHELPER_PROPERTYINFOHASH_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Type.h>
+#include <unordered_map>
+
+namespace comphelper
+{
+ struct PropertyInfo
+ {
+ OUString maName;
+ css::uno::Type maType;
+ sal_Int32 mnHandle;
+ sal_Int16 mnAttributes;
+
+ PropertyInfo(OUString const & aName, sal_Int32 nHandle, css::uno::Type const & aType, sal_Int16 nAttributes)
+ : maName(aName), maType(aType), mnHandle(nHandle), mnAttributes(nAttributes) {}
+ PropertyInfo(OUString && aName, sal_Int32 nHandle, css::uno::Type const & aType, sal_Int16 nAttributes)
+ : maName(std::move(aName)), maType(aType), mnHandle(nHandle), mnAttributes(nAttributes) {}
+ };
+ struct PropertyData
+ {
+ sal_uInt8 mnMapId;
+ const PropertyInfo *mpInfo;
+ PropertyData ( sal_uInt8 nMapId, PropertyInfo const *pInfo )
+ : mnMapId ( nMapId )
+ , mpInfo ( pInfo ) {}
+ };
+}
+
+typedef std::unordered_map < OUString,
+ ::comphelper::PropertyInfo const * > PropertyInfoHash;
+typedef std::unordered_map < OUString,
+ ::comphelper::PropertyData* > PropertyDataHash;
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/SelectionMultiplex.hxx b/include/comphelper/SelectionMultiplex.hxx
new file mode 100644
index 000000000..ab980984a
--- /dev/null
+++ b/include/comphelper/SelectionMultiplex.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SELECTIONMULTIPLEX_HXX
+#define INCLUDED_COMPHELPER_SELECTIONMULTIPLEX_HXX
+
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::view { class XSelectionSupplier; }
+
+//= selection helper classes
+
+
+namespace comphelper
+{
+
+
+ //= OSelectionChangeListener
+
+ /// simple listener adapter for selections
+ class COMPHELPER_DLLPUBLIC OSelectionChangeListener
+ {
+ friend class OSelectionChangeMultiplexer;
+
+ public:
+ virtual ~OSelectionChangeListener();
+
+ /// @throws css::uno::RuntimeException
+ virtual void _selectionChanged( const css::lang::EventObject& aEvent ) = 0;
+ /// @throws css::uno::RuntimeException
+ virtual void _disposing(const css::lang::EventObject& _rSource);
+ };
+
+
+ //= OSelectionChangeMultiplexer
+
+ /// multiplexer for selection changes
+ class COMPHELPER_DLLPUBLIC OSelectionChangeMultiplexer final : public cppu::WeakImplHelper< css::view::XSelectionChangeListener>
+ {
+ friend class OSelectionChangeListener;
+ css::uno::Reference< css::view::XSelectionSupplier> m_xSet;
+ OSelectionChangeListener* m_pListener;
+ sal_Int32 m_nLockCount;
+
+ OSelectionChangeMultiplexer(const OSelectionChangeMultiplexer&) = delete;
+ OSelectionChangeMultiplexer& operator=(const OSelectionChangeMultiplexer&) = delete;
+
+ virtual ~OSelectionChangeMultiplexer() override;
+ public:
+ OSelectionChangeMultiplexer(OSelectionChangeListener* _pListener, const css::uno::Reference< css::view::XSelectionSupplier>& _rxSet);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XSelectionChangeListener
+ virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override;
+
+ /// incremental lock
+ void lock();
+ /// incremental unlock
+ void unlock();
+ /// get the lock count
+ sal_Int32 locked() const { return m_nLockCount; }
+
+ void dispose();
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_SELECTIONMULTIPLEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/SetFlagContextHelper.hxx b/include/comphelper/SetFlagContextHelper.hxx
new file mode 100644
index 000000000..b1b15eabb
--- /dev/null
+++ b/include/comphelper/SetFlagContextHelper.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_SETFLAGCONTEXTHELPER_HXX
+#define INCLUDED_COMPHELPER_SETFLAGCONTEXTHELPER_HXX
+
+#include <com/sun/star/uno/XCurrentContext.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <uno/current_context.hxx>
+#include <utility>
+
+namespace comphelper
+{
+// Used to flag some named value to be true for all code running in this context
+class SetFlagContext final : public cppu::WeakImplHelper<css::uno::XCurrentContext>
+{
+public:
+ explicit SetFlagContext(OUString sName, css::uno::Reference<css::uno::XCurrentContext> xContext)
+ : m_sName(std::move(sName))
+ , mxNextContext(std::move(xContext))
+ {
+ }
+ SetFlagContext(const SetFlagContext&) = delete;
+ SetFlagContext& operator=(const SetFlagContext&) = delete;
+
+ virtual css::uno::Any SAL_CALL getValueByName(OUString const& Name) override
+ {
+ if (Name == m_sName)
+ return css::uno::Any(true);
+ else if (mxNextContext.is())
+ return mxNextContext->getValueByName(Name);
+ else
+ return css::uno::Any();
+ }
+
+private:
+ OUString m_sName;
+ css::uno::Reference<css::uno::XCurrentContext> mxNextContext;
+};
+
+// Returns a new context that reports the named value to be true
+inline css::uno::Reference<css::uno::XCurrentContext> NewFlagContext(const OUString& sName)
+{
+ return new SetFlagContext(sName, css::uno::getCurrentContext());
+}
+
+// A specialization for preventing "Java must be enabled" interaction
+inline css::uno::Reference<css::uno::XCurrentContext> NoEnableJavaInteractionContext()
+{
+ return NewFlagContext("DontEnableJava");
+}
+
+inline bool IsContextFlagActive(const OUString& sName)
+{
+ bool bFlag = false;
+ if (const auto xContext = css::uno::getCurrentContext())
+ xContext->getValueByName(sName) >>= bFlag;
+ return bFlag;
+}
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_SETFLAGCONTEXTHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblecomponenthelper.hxx b/include/comphelper/accessiblecomponenthelper.hxx
new file mode 100644
index 000000000..963bea96b
--- /dev/null
+++ b/include/comphelper/accessiblecomponenthelper.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
+#define INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <comphelper/accessiblecontexthelper.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+
+namespace comphelper
+{
+
+
+ //= OCommonAccessibleComponent
+
+ /** base class encapsulating common functionality for the helper classes implementing
+ the XAccessibleComponent respectively XAccessibleExtendendComponent
+ */
+ class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent : public OAccessibleContextHelper
+ {
+ protected:
+ /// see the respective base class ctor for an extensive comment on this, please
+ OCommonAccessibleComponent();
+ virtual ~OCommonAccessibleComponent() override;
+
+ protected:
+ /// implements the calculation of the bounding rectangle - still waiting to be overwritten
+ ///
+ /// @throws css::uno::RuntimeException
+ virtual css::awt::Rectangle implGetBounds( ) = 0;
+
+ protected:
+ /** non-virtual versions of the methods which can be implemented using <method>implGetBounds</method>
+ note: getLocationOnScreen relies on a valid parent (XAccessibleContext::getParent()->getAccessibleContext()),
+ which itself implements XAccessibleComponent
+
+ @throws css::uno::RuntimeException
+ */
+ bool containsPoint( const css::awt::Point& aPoint );
+ /// @throws css::uno::RuntimeException
+ css::awt::Point getLocation( );
+ /// @throws css::uno::RuntimeException
+ css::awt::Point getLocationOnScreen( );
+ /// @throws css::uno::RuntimeException
+ css::awt::Size getSize( );
+ /// @throws css::uno::RuntimeException
+ css::awt::Rectangle getBounds( );
+ };
+
+
+ //= OAccessibleComponentHelper
+
+
+ struct OAccessibleComponentHelper_Base :
+ public ::cppu::ImplHelper1< css::accessibility::XAccessibleComponent >
+ {
+ protected:
+ ~OAccessibleComponentHelper_Base() {}
+ };
+
+ /** a helper class for implementing an AccessibleContext which at the same time
+ supports an XAccessibleComponent interface.
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleComponentHelper
+ :public OCommonAccessibleComponent
+ ,public OAccessibleComponentHelper_Base
+ {
+ protected:
+ OAccessibleComponentHelper();
+
+ public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleComponent - default implementations
+ virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override;
+ virtual css::awt::Point SAL_CALL getLocation( ) override;
+ virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
+ virtual css::awt::Size SAL_CALL getSize( ) override;
+ virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
+ };
+
+
+ //= OAccessibleExtendedComponentHelper
+
+
+ typedef ::cppu::ImplHelper1 < css::accessibility::XAccessibleExtendedComponent
+ > OAccessibleExtendedComponentHelper_Base;
+
+ /** a helper class for implementing an AccessibleContext which at the same time
+ supports an XAccessibleExtendedComponent interface.
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleExtendedComponentHelper
+ :public OCommonAccessibleComponent
+ ,public OAccessibleExtendedComponentHelper_Base
+ {
+ protected:
+ OAccessibleExtendedComponentHelper( );
+
+ public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleComponent - default implementations
+ virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override;
+ virtual css::awt::Point SAL_CALL getLocation( ) override;
+ virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
+ virtual css::awt::Size SAL_CALL getSize( ) override;
+ virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblecontexthelper.hxx b/include/comphelper/accessiblecontexthelper.hxx
new file mode 100644
index 000000000..dc367fbe1
--- /dev/null
+++ b/include/comphelper/accessiblecontexthelper.hxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ACCESSIBLECONTEXTHELPER_HXX
+#define INCLUDED_COMPHELPER_ACCESSIBLECONTEXTHELPER_HXX
+
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/accessibility/XAccessibleContext2.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <comphelper/solarmutex.hxx>
+
+
+namespace comphelper
+{
+
+
+ //= OAccessibleContextHelper
+
+
+ typedef ::cppu::WeakAggComponentImplHelper2 < css::accessibility::XAccessibleContext2,
+ css::accessibility::XAccessibleEventBroadcaster
+ > OAccessibleContextHelper_Base;
+
+ /** helper class for implementing an AccessibleContext
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleContextHelper
+ :public ::cppu::BaseMutex
+ ,public OAccessibleContextHelper_Base
+ {
+ friend class OContextEntryGuard;
+ private:
+ css::uno::WeakReference< css::accessibility::XAccessible > m_aCreator; // the XAccessible which created our XAccessibleContext
+ AccessibleEventNotifier::TClientId m_nClientId;
+
+ protected:
+ virtual ~OAccessibleContextHelper( ) override;
+
+ OAccessibleContextHelper( );
+
+ /** late construction
+ @param _rxAccessible
+ the Accessible object which created this context.
+ <p>If your derived implementation implements the XAccessible (and does not follow the proposed
+ separation of XAccessible from XAccessibleContext), you may pass <code>this</code> here.</p>
+
+ <p>The object is hold weak, so its life time is not affected.</p>
+
+ <p>The object is needed for performance reasons: for <method>getAccessibleIndexInParent</method>,
+ all children (which are XAccessible's theirself) of our parent have to be asked. If we know our
+ XAccessible, we can compare it with all the children, instead of asking all children for their
+ context and comparing this context with ourself.</p>
+ */
+ void lateInit( const css::uno::Reference< css::accessibility::XAccessible >& _rxAccessible );
+
+ /** retrieves the creator previously set with <method>lateInit</method>
+ */
+ css::uno::Reference< css::accessibility::XAccessible >
+ getAccessibleCreator( ) const;
+
+ public:
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
+ virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
+
+ // XAccessibleContext - still waiting to be overwritten
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override = 0;
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) override = 0;
+ virtual OUString SAL_CALL getAccessibleDescription( ) override = 0;
+ virtual OUString SAL_CALL getAccessibleName( ) override = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override = 0;
+
+ // XAccessibleContext2 - default implementation
+ virtual OUString SAL_CALL getAccessibleId( ) override;
+
+ // XAccessibleContext - default implementations
+ /** default implementation for retrieving the index of this object within the parent
+ <p>This basic implementation here returns the index <code>i</code> of the child for which
+ <code>&lt;parent&gt;.getAccessibleChild( i )</code> equals our creator.</p>
+ */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override;
+ /** default implementation for retrieving the locale
+ <p>This basic implementation returns the locale of the parent context,
+ as retrieved via getAccessibleParent()->getAccessibleContext.</p>
+ */
+ virtual css::lang::Locale SAL_CALL getLocale( ) override;
+
+ protected:
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+
+ protected:
+ // helper
+ /** notifies all AccessibleEventListeners of a certain event
+
+ @precond not to be called with our mutex locked
+ @param _nEventId
+ the id of the event. See AccessibleEventType
+ @param _rOldValue
+ the old value to be notified
+ @param _rNewValue
+ the new value to be notified
+ */
+ void NotifyAccessibleEvent(
+ const sal_Int16 _nEventId,
+ const css::uno::Any& _rOldValue,
+ const css::uno::Any& _rNewValue
+ );
+
+ // life time control
+ /// checks whether the object is alive (returns <TRUE/> then) or disposed
+ bool isAlive() const;
+ /// checks for being alive. If the object is already disposed (i.e. not alive), an exception is thrown.
+ void ensureAlive() const;
+
+ /** ensures that the object is disposed.
+ @precond
+ to be called from within the destructor of your derived class only!
+ */
+ void ensureDisposed( );
+
+ /** shortcut for retrieving the context of the parent (returned by getAccessibleParent)
+ */
+ css::uno::Reference< css::accessibility::XAccessibleContext >
+ implGetParentContext();
+
+ // access to the base class' broadcast helper/mutex
+ ::osl::Mutex& GetMutex() { return m_aMutex; }
+ };
+
+
+ //= OContextEntryGuard
+
+ /** helper class for guarding the entry into OAccessibleContextHelper methods.
+
+ <p>The class has two responsibilities:
+ <ul><li>it locks the mutex of an OAccessibleContextHelper instance, as long as the guard lives</li>
+ <li>it checks if a given OAccessibleContextHelper instance is alive, else an exception is thrown
+ our of the constructor of the guard</li>
+ </ul>
+ <br/>
+ This makes it your first choice (hopefully :) for guarding any interface method implementations of
+ you derived class.
+ </p>
+ */
+ class OContextEntryGuard : public ::osl::ClearableMutexGuard
+ {
+ public:
+ /** constructs the guard
+
+ <p>The given context (it's mutex, respectively) is locked, and an exception is thrown if the context
+ is not alive anymore. In the latter case, of course, the mutex is freed, again.</p>
+
+ @param _pContext
+ the context which shall be guarded
+ @precond <arg>_pContext</arg> != NULL
+ */
+ inline OContextEntryGuard( OAccessibleContextHelper* _pContext );
+ };
+
+
+ inline OContextEntryGuard::OContextEntryGuard( OAccessibleContextHelper* _pContext )
+ : ::osl::ClearableMutexGuard( _pContext->GetMutex() )
+ {
+ _pContext->ensureAlive();
+ }
+
+
+ //= OExternalLockGuard
+
+ class OExternalLockGuard
+ :public osl::Guard<SolarMutex>
+ ,public OContextEntryGuard
+ {
+ public:
+ inline OExternalLockGuard( OAccessibleContextHelper* _pContext );
+ };
+
+
+ inline OExternalLockGuard::OExternalLockGuard( OAccessibleContextHelper* _pContext )
+ :osl::Guard<SolarMutex>( SolarMutex::get() )
+ ,OContextEntryGuard( _pContext )
+ {
+ // Only lock the external mutex,
+ // release the ::osl::Mutex of the OAccessibleContextHelper instance.
+ // If you call into another UNO object with locked ::osl::Mutex,
+ // this may lead to dead locks.
+ clear();
+ }
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_ACCESSIBLECONTEXTHELPER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessibleeventnotifier.hxx b/include/comphelper/accessibleeventnotifier.hxx
new file mode 100644
index 000000000..75828cda6
--- /dev/null
+++ b/include/comphelper/accessibleeventnotifier.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ACCESSIBLEEVENTNOTIFIER_HXX
+#define INCLUDED_COMPHELPER_ACCESSIBLEEVENTNOTIFIER_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::uno { class XInterface; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace com::sun::star::accessibility { class XAccessibleEventListener; }
+namespace com::sun::star::accessibility { struct AccessibleEventObject; }
+
+namespace comphelper {
+
+class COMPHELPER_DLLPUBLIC AccessibleEventNotifier
+{
+public:
+ typedef sal_uInt32 TClientId;
+
+public:
+ AccessibleEventNotifier() = delete;
+ ~AccessibleEventNotifier() = delete;
+ AccessibleEventNotifier( const AccessibleEventNotifier& ) = delete;
+ AccessibleEventNotifier& operator=( const AccessibleEventNotifier& ) = delete;
+
+ /** registers a client of this class, means a broadcaster of AccessibleEvents
+
+ <p>No precaution is taken to care for disposal of this component. When the component
+ dies, it <b>must</b> call <member>revokeClient</member> or <member>revokeClientNotifyDisposing</member>
+ explicitly itself.</p>
+ */
+ static TClientId registerClient();
+
+ /** revokes a broadcaster of AccessibleEvents
+
+ <p>Note that no disposing event is fired when you use this method, the client is simply revoked.
+ You can for instance revoke a client if the last listener for it is revoked, but the client
+ itself is not disposed.<br/>
+ When the client is disposed, you should prefer <member>revokeClientNotifyDisposing</member></p>
+
+ <p>Any possibly pending events for this client are removed from the queue.</p>
+
+ @seealso revokeClientNotifyDisposing
+ */
+ static void revokeClient( const TClientId _nClient );
+
+ /** revokes a client, with additionally notifying a disposing event to all listeners registered for
+ this client
+
+ <p>Any other possibly pending events for this client are removed from the queue</p>
+
+ @param _nClient
+ the id of the client which should be revoked
+ @param _rxEventSource
+ the source to be notified together with the <member scope="com.sun.star.lang">XComponent::disposing</member>
+ call.
+ */
+ static void revokeClientNotifyDisposing(
+ const TClientId _nClient,
+ const css::uno::Reference< css::uno::XInterface >& _rxEventSource );
+
+ /** registers a listener for the given client
+
+ @param _nClient
+ the id of the client for which a listener should be registered
+ @return
+ the number of event listeners currently registered for this client
+ */
+ static sal_Int32 addEventListener(
+ const TClientId _nClient,
+ const css::uno::Reference< css::accessibility::XAccessibleEventListener >& _rxListener );
+
+ /** revokes a listener for the given client
+
+ @param _nClient
+ the id of the client for which a listener should be revoked
+ @return
+ the number of event listeners currently registered for this client
+ */
+ static sal_Int32 removeEventListener(
+ const TClientId _nClient,
+ const css::uno::Reference< css::accessibility::XAccessibleEventListener >& _rxListener );
+
+ /** adds an event, which is to be broadcasted, to the queue
+
+ @param _nClient
+ the id of the client which needs to broadcast the event
+ */
+ static void addEvent(
+ const TClientId _nClient,
+ const css::accessibility::AccessibleEventObject& _rEvent );
+
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_ACCESSIBLEEVENTNOTIFIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblekeybindinghelper.hxx b/include/comphelper/accessiblekeybindinghelper.hxx
new file mode 100644
index 000000000..fe6b03521
--- /dev/null
+++ b/include/comphelper/accessiblekeybindinghelper.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ACCESSIBLEKEYBINDINGHELPER_HXX
+#define INCLUDED_COMPHELPER_ACCESSIBLEKEYBINDINGHELPER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
+#include <comphelper/comphelperdllapi.h>
+#include <cppuhelper/implbase.hxx>
+#include <mutex>
+#include <vector>
+
+namespace comphelper
+{
+
+
+ // OAccessibleKeyBindingHelper
+
+
+ typedef ::cppu::WeakImplHelper < css::accessibility::XAccessibleKeyBinding
+ > OAccessibleKeyBindingHelper_Base;
+
+ /** a helper class for implementing an accessible keybinding
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleKeyBindingHelper final : public OAccessibleKeyBindingHelper_Base
+ {
+ private:
+ typedef ::std::vector< css::uno::Sequence< css::awt::KeyStroke > > KeyBindings;
+ KeyBindings m_aKeyBindings;
+ std::mutex m_aMutex;
+
+ virtual ~OAccessibleKeyBindingHelper() override;
+
+ public:
+ OAccessibleKeyBindingHelper();
+ OAccessibleKeyBindingHelper( const OAccessibleKeyBindingHelper& rHelper );
+
+ /// @throws css::uno::RuntimeException
+ void AddKeyBinding( const css::uno::Sequence< css::awt::KeyStroke >& rKeyBinding );
+ /// @throws css::uno::RuntimeException
+ void AddKeyBinding( const css::awt::KeyStroke& rKeyStroke );
+
+ // XAccessibleKeyBinding
+ virtual sal_Int32 SAL_CALL getAccessibleKeyBindingCount() override;
+ virtual css::uno::Sequence< css::awt::KeyStroke > SAL_CALL getAccessibleKeyBinding( sal_Int32 nIndex ) override;
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_ACCESSIBLEKEYBINDINGHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessibleselectionhelper.hxx b/include/comphelper/accessibleselectionhelper.hxx
new file mode 100644
index 000000000..3a49c1ffd
--- /dev/null
+++ b/include/comphelper/accessibleselectionhelper.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ACCESSIBLESELECTIONHELPER_HXX
+#define INCLUDED_COMPHELPER_ACCESSIBLESELECTIONHELPER_HXX
+
+#include <config_options.h>
+#include <comphelper/uno3.hxx>
+#include <comphelper/accessiblecomponenthelper.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <comphelper/comphelperdllapi.h>
+
+#define ACCESSIBLE_SELECTION_CHILD_ALL (sal_Int32(-1))
+#define ACCESSIBLE_SELECTION_CHILD_SELF ((sal_Int32)-2)
+
+
+namespace comphelper
+{
+
+
+ //= OCommonAccessibleSelection
+
+ /** base class encapsulating common functionality for the helper classes implementing
+ the XAccessibleSelection
+ */
+ class COMPHELPER_DLLPUBLIC OCommonAccessibleSelection
+ {
+ protected:
+
+ OCommonAccessibleSelection();
+
+ ~OCommonAccessibleSelection();
+
+ protected:
+
+ // access to context - still waiting to be overwritten
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ implGetAccessibleContext() = 0;
+
+ // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
+ /// @throws css::uno::RuntimeException
+ virtual bool
+ implIsSelected( sal_Int32 nAccessibleChildIndex ) = 0;
+
+ // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
+ /// @throws css::uno::RuntimeException
+ virtual void
+ implSelect( sal_Int32 nAccessibleChildIndex, bool bSelect ) = 0;
+
+ protected:
+
+ /** non-virtual versions of the methods which can be implemented using <method>implIsSelected</method> and <method>implSelect</method>
+
+ @throws css::lang::IndexOutOfBoundsException
+ @throws css::uno::RuntimeException
+ */
+ void selectAccessibleChild( sal_Int32 nChildIndex );
+ /// @throws css::lang::IndexOutOfBoundsException
+ /// @throws css::uno::RuntimeException
+ bool isAccessibleChildSelected( sal_Int32 nChildIndex );
+ /// @throws css::uno::RuntimeException
+ void clearAccessibleSelection( );
+ /// @throws css::uno::RuntimeException
+ void selectAllAccessibleChildren( );
+ /// @throws css::uno::RuntimeException
+ sal_Int32 getSelectedAccessibleChildCount( );
+ /// @throws css::lang::IndexOutOfBoundsException
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::accessibility::XAccessible > getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex );
+ /// @throws css::lang::IndexOutOfBoundsException
+ /// @throws css::uno::RuntimeException
+ void deselectAccessibleChild( sal_Int32 nSelectedChildIndex );
+ };
+
+
+ //= OAccessibleSelectionHelper
+
+
+ typedef ::cppu::ImplHelper1< css::accessibility::XAccessibleSelection > OAccessibleSelectionHelper_Base;
+
+ /** a helper class for implementing an AccessibleSelection which at the same time
+ supports an XAccessibleSelection interface.
+ */
+ class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OAccessibleSelectionHelper : public OAccessibleComponentHelper,
+ public OCommonAccessibleSelection,
+ public OAccessibleSelectionHelper_Base
+ {
+ protected:
+
+ OAccessibleSelectionHelper();
+
+ // return ourself here by default
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > implGetAccessibleContext() override;
+
+ public:
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleSelection - default implementations
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override;
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override;
+ virtual void SAL_CALL clearAccessibleSelection( ) override;
+ virtual void SAL_CALL selectAllAccessibleChildren( ) override;
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_ACCESSIBLESELECTIONHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessibletexthelper.hxx b/include/comphelper/accessibletexthelper.hxx
new file mode 100644
index 000000000..607004aee
--- /dev/null
+++ b/include/comphelper/accessibletexthelper.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ACCESSIBLETEXTHELPER_HXX
+#define INCLUDED_COMPHELPER_ACCESSIBLETEXTHELPER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/TextSegment.hpp>
+#include <comphelper/accessiblecomponenthelper.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::i18n { class XBreakIterator; }
+namespace com::sun::star::i18n { class XCharacterClassification; }
+namespace com::sun::star::i18n { struct Boundary; }
+
+namespace comphelper
+{
+
+
+ // OCommonAccessibleText
+
+ /** base class encapsulating common functionality for the helper classes implementing
+ the XAccessibleText
+ */
+ class COMPHELPER_DLLPUBLIC OCommonAccessibleText
+ {
+ private:
+ css::uno::Reference < css::i18n::XBreakIterator > m_xBreakIter;
+ css::uno::Reference < css::i18n::XCharacterClassification > m_xCharClass;
+
+ protected:
+ OCommonAccessibleText();
+ virtual ~OCommonAccessibleText();
+
+ css::uno::Reference < css::i18n::XBreakIterator > const & implGetBreakIterator();
+ css::uno::Reference < css::i18n::XCharacterClassification > const & implGetCharacterClassification();
+ static bool implIsValidBoundary( css::i18n::Boundary const & rBoundary, sal_Int32 nLength );
+ static bool implIsValidIndex( sal_Int32 nIndex, sal_Int32 nLength );
+ static bool implIsValidRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int32 nLength );
+ static sal_Unicode implGetCharacter( std::u16string_view rText, sal_Int32 nIndex );
+ static OUString implGetTextRange( std::u16string_view rText, sal_Int32 nStartIndex, sal_Int32 nEndIndex );
+ virtual OUString implGetText() = 0;
+ virtual css::lang::Locale implGetLocale() = 0;
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) = 0;
+ void implGetGlyphBoundary( const OUString& rText, css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ bool implGetWordBoundary( const OUString& rText, css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ void implGetSentenceBoundary( const OUString& rText, css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual void implGetParagraphBoundary( const OUString& rText, css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual void implGetLineBoundary( const OUString& rText, css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+
+ /** non-virtual versions of the methods
+
+ @throws css::lang::IndexOutOfBoundsException
+ @throws css::uno::RuntimeException
+ */
+ OUString getSelectedText();
+ /// @throws css::uno::RuntimeException
+ sal_Int32 getSelectionStart();
+ /// @throws css::uno::RuntimeException
+ sal_Int32 getSelectionEnd();
+ /// @throws css::lang::IndexOutOfBoundsException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::uno::RuntimeException
+ css::accessibility::TextSegment getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType );
+ /// @throws css::lang::IndexOutOfBoundsException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::uno::RuntimeException
+ css::accessibility::TextSegment getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType );
+ /// @throws css::lang::IndexOutOfBoundsException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::uno::RuntimeException
+ css::accessibility::TextSegment getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType );
+
+ public:
+
+ /** Helper method, that detects the difference between
+ two strings and returns the deleted selection and
+ the inserted selection if available.
+
+ @returns true if there are differences between the
+ two strings and false if both are equal
+
+ @see css::accessibility::AccessibleEventId
+ css::accessibility::TextSegment
+ */
+ static bool implInitTextChangedEvent(
+ std::u16string_view rOldString,
+ std::u16string_view rNewString,
+ /*out*/ css::uno::Any& rDeleted,
+ /*out*/ css::uno::Any& rInserted); // throw()
+ };
+
+
+ // OAccessibleTextHelper
+
+
+ typedef ::cppu::ImplHelper1 < css::accessibility::XAccessibleText
+ > OAccessibleTextHelper_Base;
+
+ /** a helper class for implementing an AccessibleExtendedComponent which at the same time
+ supports an XAccessibleText interface
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleTextHelper : public OAccessibleExtendedComponentHelper,
+ public OCommonAccessibleText,
+ public OAccessibleTextHelper_Base
+ {
+ protected:
+ OAccessibleTextHelper();
+
+ public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleText
+ virtual OUString SAL_CALL getSelectedText() override;
+ virtual sal_Int32 SAL_CALL getSelectionStart() override;
+ virtual sal_Int32 SAL_CALL getSelectionEnd() override;
+ virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ };
+
+
+} // namespace comphelper
+
+
+// OAccessibleTextHelper is a helper class for implementing the
+// XAccessibleText interface.
+
+// The following methods have a default implementation:
+
+// getCharacter
+// getSelectedText
+// getSelectionStart
+// getSelectionEnd
+// getTextRange
+// getTextAtIndex
+// getTextBeforeIndex
+// getTextBehindIndex
+
+// The following methods must be overridden by derived classes:
+
+// implGetText
+// implGetLocale
+// implGetSelection
+// getCaretPosition
+// setCaretPosition
+// getCharacterAttributes
+// getCharacterBounds
+// getIndexAtPoint
+// setSelection
+// copyText
+
+#endif // INCLUDED_COMPHELPER_ACCESSIBLETEXTHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblewrapper.hxx b/include/comphelper/accessiblewrapper.hxx
new file mode 100644
index 000000000..13fb29bff
--- /dev/null
+++ b/include/comphelper/accessiblewrapper.hxx
@@ -0,0 +1,401 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ACCESSIBLEWRAPPER_HXX
+#define INCLUDED_COMPHELPER_ACCESSIBLEWRAPPER_HXX
+
+#include <config_options.h>
+#include <sal/config.h>
+
+#include <map>
+
+#include <comphelper/proxyaggregation.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ref.hxx>
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace comphelper
+{
+
+
+ //= OAccessibleWrapper
+
+
+ class OAccessibleContextWrapper;
+ class OWrappedAccessibleChildrenManager;
+
+ struct OAccessibleWrapper_Base :
+ public ::cppu::ImplHelper1 < css::accessibility::XAccessible >
+ {
+ protected:
+ ~OAccessibleWrapper_Base() {}
+ };
+
+ /** a class which aggregates a proxy for an XAccessible, and wrapping the context returned by this
+ XAccessible.
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleWrapper:public OAccessibleWrapper_Base
+ ,public OComponentProxyAggregation
+
+ {
+ private:
+ css::uno::Reference< css::accessibility::XAccessible >
+ m_xParentAccessible;
+ css::uno::WeakReference< css::accessibility::XAccessibleContext >
+ m_aContext;
+
+ protected:
+ css::uno::Reference< css::accessibility::XAccessible >
+ m_xInnerAccessible;
+
+ public:
+ /** ctor
+ @param _rxContext
+ a service factory
+
+ @param _rxInnerAccessible
+ the object to wrap
+
+ @param _rxParentAccessible
+ The XAccessible which is our parent
+ */
+ OAccessibleWrapper(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxInnerAccessible,
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxParentAccessible
+ );
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+ // returns the context without creating it
+ css::uno::Reference< css::accessibility::XAccessibleContext >
+ getContextNoCreate( ) const;
+
+ protected:
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext( ) override;
+
+ const css::uno::Reference< css::accessibility::XAccessible >&
+ getParent() const { return m_xParentAccessible; }
+
+ // own overridables
+ virtual rtl::Reference<OAccessibleContextWrapper> createAccessibleContext(
+ const css::uno::Reference< css::accessibility::XAccessibleContext >& _rxInnerContext
+ );
+
+ protected:
+ virtual ~OAccessibleWrapper( ) override;
+
+ private:
+ OAccessibleWrapper( const OAccessibleWrapper& ) = delete;
+ OAccessibleWrapper& operator=( const OAccessibleWrapper& ) = delete;
+ };
+
+
+ //= OAccessibleContextWrapperHelper
+
+
+ typedef ::cppu::ImplHelper1 < css::accessibility::XAccessibleEventListener
+ > OAccessibleContextWrapperHelper_Base;
+
+ /** Helper for wrapping an XAccessibleContext by aggregating a proxy for it.
+
+ <p>This class does not have own ref counting. In addition, it does not implement
+ the XAccessibleContext interface, but provides all the methods from this interface
+ which must be implemented using the inner context (such as getAccessibleChild*).</p>
+
+ <p>Children of the aggregated XAccessibleContext are wrapped, too.</p>
+
+ <p>AccessibleEvents fired by the inner context are multiplexed, especially, any references to
+ children in such events are translated. This means that even in such events, no un-wrapped object
+ will ever leave this class - if the aggregated context notifies a child event, the child passed
+ to the event is wrapped</p>
+
+ @seealso OAccessibleContextWrapper
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleContextWrapperHelper
+ :private OComponentProxyAggregationHelper
+ ,public OAccessibleContextWrapperHelper_Base
+ {
+ protected:
+ /// the context we're wrapping (properly typed, in opposite to OComponentProxyAggregationHelper::m_xInner)
+ css::uno::Reference< css::accessibility::XAccessibleContext >
+ m_xInnerContext;
+ /// the XAccessible which created this context
+ css::uno::Reference< css::accessibility::XAccessible >
+ m_xOwningAccessible;
+ /// the XAccessible which is to be returned in getAccessibleParent
+ css::uno::Reference< css::accessibility::XAccessible >
+ m_xParentAccessible;
+
+ rtl::Reference<OWrappedAccessibleChildrenManager> m_xChildMapper; // for mapping children from our inner context to our callers
+
+ protected:
+ /** ctor
+
+ @param _rxContext
+ a service factory
+
+ @param _rxInnerAccessibleContext
+ the object to wrap
+
+ @param _rxOwningAccessible
+ The XAccessible which created this object. This is necessary because children
+ of our wrapped context need to be wrapped, too, and if they're asked for a parent,
+ they of course should return the proper parent<br/>
+ The object will be held with a hard reference
+
+ @param _rxParentAccessible
+ The XAccessible to return in the getAccessibleParent call
+ */
+ OAccessibleContextWrapperHelper(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ ::cppu::OBroadcastHelper& _rBHelper,
+ const css::uno::Reference< css::accessibility::XAccessibleContext >& _rxInnerAccessibleContext,
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxOwningAccessible,
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxParentAccessible
+ );
+
+ /// to be called from within your ctor - does the aggregation of a proxy for m_xInnerContext
+ void aggregateProxy(
+ oslInterlockedCount& _rRefCount,
+ ::cppu::OWeakObject& _rDelegator
+ );
+
+ protected:
+ // XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type& _rType ) override;
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleContext
+ /// @throws css::uno::RuntimeException
+ sal_Int32 baseGetAccessibleChildCount( );
+ /// @throws css::lang::IndexOutOfBoundsException
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::accessibility::XAccessible > baseGetAccessibleChild( sal_Int32 i );
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::accessibility::XAccessibleRelationSet > baseGetAccessibleRelationSet( );
+
+ // XAccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const css::accessibility::AccessibleEventObject& aEvent ) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XComponent/OComponentProxyAggregationHelper
+ virtual void SAL_CALL dispose() override;
+
+ // own overridables
+ /** notify an accessible event which has been translated (if necessary)
+
+ <p>Usually, you derive your class from both OAccessibleContextWrapperHelper and XAccessibleEventBroadcaster,
+ and simply call all your XAccessibleEventListener with the given event.</p>
+
+ <p>The mutex of the BroadcastHelper passed to the instance's ctor is <em>not</em> locked when calling
+ into this method</p>
+
+ @throws css::uno::RuntimeException
+ */
+ virtual void notifyTranslatedEvent( const css::accessibility::AccessibleEventObject& _rEvent ) = 0;
+
+ protected:
+ virtual ~OAccessibleContextWrapperHelper( ) override;
+
+ OAccessibleContextWrapperHelper(const OAccessibleContextWrapperHelper&) = delete;
+ OAccessibleContextWrapperHelper& operator=(const OAccessibleContextWrapperHelper&) = delete;
+ };
+
+
+ //= OAccessibleContextWrapper
+
+ typedef ::cppu::WeakComponentImplHelper< css::accessibility::XAccessibleEventBroadcaster
+ , css::accessibility::XAccessibleContext
+ > OAccessibleContextWrapper_CBase;
+
+ class COMPHELPER_DLLPUBLIC OAccessibleContextWrapper
+ :public cppu::BaseMutex
+ ,public OAccessibleContextWrapper_CBase
+ ,public OAccessibleContextWrapperHelper
+ {
+ private:
+ ::comphelper::AccessibleEventNotifier::TClientId m_nNotifierClient; // for notifying AccessibleEvents
+
+ public:
+ /** ctor
+
+ @param _rxContext
+ a service factory
+
+ @param _rxInnerAccessibleContext
+ the object to wrap
+
+ @param _rxOwningAccessible
+ The XAccessible which created this object. This is necessary because children
+ of our wrapped context need to be wrapped, too, and if they're asked for a parent,
+ they of course should return the proper parent<br/>
+ The object will be held with a hard reference
+
+ @param _rxParentAccessible
+ The XAccessible to return in the getAccessibleParent call
+ */
+ OAccessibleContextWrapper(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const css::uno::Reference< css::accessibility::XAccessibleContext >& _rxInnerAccessibleContext,
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxOwningAccessible,
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxParentAccessible
+ );
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override;
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
+ virtual OUString SAL_CALL getAccessibleDescription( ) override;
+ virtual OUString SAL_CALL getAccessibleName( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
+ virtual css::lang::Locale SAL_CALL getLocale( ) override;
+
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
+ virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
+
+ // OAccessibleContextWrapper
+ virtual void notifyTranslatedEvent( const css::accessibility::AccessibleEventObject& _rEvent ) override;
+
+ // OComponentHelper
+ using OAccessibleContextWrapperHelper::disposing;
+ virtual void SAL_CALL disposing() override;
+
+ protected:
+ virtual ~OAccessibleContextWrapper() override;
+
+ private:
+ OAccessibleContextWrapper( const OAccessibleContextWrapper& ) = delete;
+ OAccessibleContextWrapper& operator=( const OAccessibleContextWrapper& ) = delete;
+ };
+
+
+ //= OWrappedAccessibleChildrenManager
+
+
+ typedef ::std::map < css::uno::Reference< css::accessibility::XAccessible >
+ , rtl::Reference< comphelper::OAccessibleWrapper >
+ > AccessibleMap;
+ // TODO: think about if we should hold these objects weak
+
+ typedef ::cppu::WeakImplHelper< css::lang::XEventListener
+ > OWrappedAccessibleChildrenManager_Base;
+ /** manages wrapping XAccessible's to XAccessible's
+ */
+ class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OWrappedAccessibleChildrenManager final : public OWrappedAccessibleChildrenManager_Base
+ {
+ css::uno::Reference< css::uno::XComponentContext >
+ m_xContext;
+ css::uno::WeakReference< css::accessibility::XAccessible >
+ m_aOwningAccessible; // the XAccessible which belongs to the XAccessibleContext which we work for
+ AccessibleMap m_aChildrenMap; // for caching children
+ bool m_bTransientChildren; // are we prohibited to cache our children?
+
+ public:
+ /// ctor
+ OWrappedAccessibleChildrenManager(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext
+ );
+
+ /** specifies if the children are to be considered transient (i.e.: not cached)
+ <p>to be called only once per lifetime</p>
+ */
+ void setTransientChildren( bool _bSet );
+
+ /** sets the XAccessible which belongs to the XAccessibleContext which we work for
+ <p>to be called only once per lifetime</p>
+ */
+ void setOwningAccessible( const css::uno::Reference< css::accessibility::XAccessible >& _rxAcc );
+
+ /// retrieves a wrapper for the given accessible
+ css::uno::Reference< css::accessibility::XAccessible >
+ getAccessibleWrapperFor(
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxKey
+ );
+
+ /// erases the given key from the map (if it is present there)
+ void removeFromCache( const css::uno::Reference< css::accessibility::XAccessible >& _rxKey );
+
+ /// invalidates (i.e. empties) the map
+ void invalidateAll( );
+
+ /** disposes (i.e. clears) the manager
+
+ <p>Note that the XAccessibleContext's of the mapped XAccessible objects are disposed, too.</p>
+ */
+ void dispose();
+
+ /** handles a notification as got from the parent of the children we're managing
+ <p>This applies only to the notifications which have a direct impact on our map.</p>
+ */
+ void handleChildNotification( const css::accessibility::AccessibleEventObject& _rEvent );
+
+ /** translates events as got from the parent of the children we're managing
+ <p>This applies only to the notifications which deal with child objects which we manage.</p>
+ */
+ void translateAccessibleEvent(
+ const css::accessibility::AccessibleEventObject& _rEvent,
+ css::accessibility::AccessibleEventObject& _rTranslatedEvent
+ );
+
+ private:
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ void implTranslateChildEventValue( const css::uno::Any& _rInValue, css::uno::Any& _rOutValue );
+
+ virtual ~OWrappedAccessibleChildrenManager( ) override;
+
+ OWrappedAccessibleChildrenManager( const OWrappedAccessibleChildrenManager& ) = delete;
+ OWrappedAccessibleChildrenManager& operator=( const OWrappedAccessibleChildrenManager& ) = delete;
+ };
+
+
+} // namespace accessibility
+
+
+#endif // INCLUDED_COMPHELPER_ACCESSIBLEWRAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accimplaccess.hxx b/include/comphelper/accimplaccess.hxx
new file mode 100644
index 000000000..e716d4d18
--- /dev/null
+++ b/include/comphelper/accimplaccess.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ACCIMPLACCESS_HXX
+#define INCLUDED_COMPHELPER_ACCIMPLACCESS_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/comphelperdllapi.h>
+
+namespace comphelper
+{
+ //= OAccessibleImplementationAccess
+
+ typedef ::cppu::ImplHelper1 < css::lang::XUnoTunnel
+ > OAccImpl_Base;
+
+ /** This is a helper class which allows accessing several aspects of the implementation
+ of an AccessibleContext.
+
+ <p>For instance, when you want to implement a context which can be re-parented, you:
+ <ul><li>derive your class from OAccessibleImplementationAccess</li>
+ <li>use <code>setAccessibleParent( <em>component</em>, <em>new_parent</em> )</code>
+ </ul>
+ </p>
+
+ <p>Another aspect which can be controlled from the outside are states. If you have a class which
+ has only partial control over it's states, you may consider deriving from OAccessibleImplementationAccess.<br/>
+ For instance, say you have an implementation (say component A) which is <em>unable</em> to know or to
+ determine if the represented object is selected, but another component (say B) which uses A (and integrates
+ it into a tree of accessibility components) is.<br/>
+ In this case, if A is derived from OAccessibleImplementationAccess, B can manipulate this
+ foreign-controlled state flag "SELECTED" by using the static helper methods on this class.</p>
+
+ <p>Please note that the support for foreign controlled states is rather restrictive: You can't have states
+ which <em>may be</em> controlled by a foreign instances. This is implied by the fact that a derived
+ class can ask for states which are <em>set</em> only, not for the ones which are <em>reset</em> currently.
+ </p>
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleImplementationAccess : public OAccImpl_Base
+ {
+ protected:
+ OAccessibleImplementationAccess( );
+ virtual ~OAccessibleImplementationAccess( );
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& _rIdentifier ) override;
+
+ public:
+ COMPHELPER_DLLPRIVATE static const css::uno::Sequence<sal_Int8> & getUnoTunnelId();
+ };
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_ACCIMPLACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/anycompare.hxx b/include/comphelper/anycompare.hxx
new file mode 100644
index 000000000..3618106db
--- /dev/null
+++ b/include/comphelper/anycompare.hxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ANYCOMPARE_HXX
+#define INCLUDED_COMPHELPER_ANYCOMPARE_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/i18n/XCollator.hpp>
+
+#include <comphelper/extract.hxx>
+
+#include <memory>
+#include <utility>
+
+
+namespace comphelper
+{
+
+
+ //= IKeyPredicateLess
+
+ class SAL_NO_VTABLE IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( css::uno::Any const & _lhs, css::uno::Any const & _rhs ) const = 0;
+ virtual ~IKeyPredicateLess() {}
+ };
+
+
+ //= LessPredicateAdapter
+
+ struct LessPredicateAdapter
+ {
+ LessPredicateAdapter( const IKeyPredicateLess& _predicate )
+ :m_predicate( _predicate )
+ {
+ }
+
+ bool operator()( css::uno::Any const & _lhs, css::uno::Any const & _rhs ) const
+ {
+ return m_predicate.isLess( _lhs, _rhs );
+ }
+
+ private:
+ IKeyPredicateLess const & m_predicate;
+ };
+
+
+ //= ScalarPredicateLess
+
+ template< typename SCALAR >
+ class ScalarPredicateLess final : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( css::uno::Any const & _lhs, css::uno::Any const & _rhs ) const override
+ {
+ SCALAR lhs(0), rhs(0);
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw css::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+ };
+
+
+ //= StringPredicateLess
+
+ class StringPredicateLess final : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( css::uno::Any const & _lhs, css::uno::Any const & _rhs ) const override
+ {
+ OUString lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw css::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+ };
+
+
+ //= StringCollationPredicateLess
+
+ class StringCollationPredicateLess final : public IKeyPredicateLess
+ {
+ public:
+ StringCollationPredicateLess( css::uno::Reference< css::i18n::XCollator > i_collator )
+ :m_collator(std::move( i_collator ))
+ {
+ }
+
+ virtual bool isLess( css::uno::Any const & _lhs, css::uno::Any const & _rhs ) const override
+ {
+ OUString lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw css::lang::IllegalArgumentException();
+ return m_collator->compareString( lhs, rhs ) < 0;
+ }
+
+ private:
+ css::uno::Reference< css::i18n::XCollator > const m_collator;
+ };
+
+
+ //= TypePredicateLess
+
+ class TypePredicateLess final : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( css::uno::Any const & _lhs, css::uno::Any const & _rhs ) const override
+ {
+ css::uno::Type lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw css::lang::IllegalArgumentException();
+ return lhs.getTypeName() < rhs.getTypeName();
+ }
+ };
+
+
+ //= EnumPredicateLess
+
+ class EnumPredicateLess final : public IKeyPredicateLess
+ {
+ public:
+ EnumPredicateLess( css::uno::Type const & _enumType )
+ :m_enumType( _enumType )
+ {
+ }
+
+ virtual bool isLess( css::uno::Any const & _lhs, css::uno::Any const & _rhs ) const override
+ {
+ sal_Int32 lhs(0), rhs(0);
+ if ( !::cppu::enum2int( lhs, _lhs )
+ || !::cppu::enum2int( rhs, _rhs )
+ || !_lhs.getValueType().equals( m_enumType )
+ || !_rhs.getValueType().equals( m_enumType )
+ )
+ throw css::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+
+ private:
+ css::uno::Type const m_enumType;
+ };
+
+
+ //= InterfacePredicateLess
+
+ class InterfacePredicateLess final : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( css::uno::Any const & _lhs, css::uno::Any const & _rhs ) const override
+ {
+ if ( ( _lhs.getValueTypeClass() != css::uno::TypeClass_INTERFACE )
+ || ( _rhs.getValueTypeClass() != css::uno::TypeClass_INTERFACE )
+ )
+ throw css::lang::IllegalArgumentException();
+
+ css::uno::Reference< css::uno::XInterface > lhs( _lhs, css::uno::UNO_QUERY );
+ css::uno::Reference< css::uno::XInterface > rhs( _rhs, css::uno::UNO_QUERY );
+ return lhs.get() < rhs.get();
+ }
+ };
+
+
+ //= getStandardLessPredicate
+
+ /** creates a default IKeyPredicateLess instance for the given UNO type
+ @param i_type
+ the type for which a predicate instance should be created
+ @param i_collator
+ specifies a collator instance to use, or <NULL/>. If <NULL/>, strings will be compared using the <code>&lt</code>
+ operator, otherwise the collator will be used. The parameter is ignored if <arg>i_type</arg> does not specify
+ the string type.
+ @return
+ a default implementation of IKeyPredicateLess, which is able to compare values of the given type. If no
+ such default implementation is known for the given type, then <NULL/> is returned.
+ */
+ ::std::unique_ptr< IKeyPredicateLess > COMPHELPER_DLLPUBLIC
+ getStandardLessPredicate(
+ css::uno::Type const & i_type,
+ css::uno::Reference< css::i18n::XCollator > const & i_collator
+ );
+
+ /**
+ Compare two Anys.
+ */
+ bool COMPHELPER_DLLPUBLIC anyLess( css::uno::Any const & lhs, css::uno::Any const & rhs);
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_ANYCOMPARE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/anytohash.hxx b/include/comphelper/anytohash.hxx
new file mode 100644
index 000000000..0aa14f47e
--- /dev/null
+++ b/include/comphelper/anytohash.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ANYTOHASH_HXX
+#define INCLUDED_COMPHELPER_ANYTOHASH_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <optional>
+
+namespace com::sun::star::uno
+{
+class Any;
+}
+
+namespace comphelper
+{
+/** Tries to get a hash value for an ANY value.
+
+ Not all cases may be implemented, in which case no value is returned.
+
+ @param value
+ ANY value
+ @return
+ hash of given ANY value, or not available
+*/
+COMPHELPER_DLLPUBLIC std::optional<size_t> anyToHash(css::uno::Any const& value);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/anytostring.hxx b/include/comphelper/anytostring.hxx
new file mode 100644
index 000000000..6d100221e
--- /dev/null
+++ b/include/comphelper/anytostring.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ANYTOSTRING_HXX
+#define INCLUDED_COMPHELPER_ANYTOSTRING_HXX
+
+#include <rtl/ustring.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::uno
+{
+class Any;
+}
+
+namespace comphelper
+{
+/** Creates a STRING representation out of an ANY value.
+
+ @param value
+ ANY value
+ @return
+ STRING representation of given ANY value
+*/
+COMPHELPER_DLLPUBLIC OUString anyToString(css::uno::Any const& value);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/asyncnotification.hxx b/include/comphelper/asyncnotification.hxx
new file mode 100644
index 000000000..ea6b067cc
--- /dev/null
+++ b/include/comphelper/asyncnotification.hxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ASYNCNOTIFICATION_HXX
+#define INCLUDED_COMPHELPER_ASYNCNOTIFICATION_HXX
+
+#include <sal/config.h>
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ref.hxx>
+#include <sal/types.h>
+#include <salhelper/thread.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <memory>
+#include <utility>
+
+namespace comphelper
+{
+ //= AnyEvent
+
+ /** the very basic instance to hold a description of an event
+ */
+ class COMPHELPER_DLLPUBLIC AnyEvent : public salhelper::SimpleReferenceObject
+ {
+ public:
+ AnyEvent();
+
+ protected:
+ virtual ~AnyEvent() override;
+
+ private:
+ AnyEvent( AnyEvent const & ) = delete;
+ AnyEvent& operator=( AnyEvent const & ) = delete;
+ };
+
+
+ //= typedefs
+
+ typedef ::rtl::Reference< AnyEvent > AnyEventRef;
+
+
+ //= IEventProcessor
+
+ /** an event processor
+
+ @see AsyncEventNotifier
+ */
+ class SAL_NO_VTABLE IEventProcessor
+ {
+ public:
+ /** process a single event
+ */
+ virtual void processEvent( const AnyEvent& _rEvent ) = 0;
+
+ virtual void SAL_CALL acquire() noexcept = 0;
+ virtual void SAL_CALL release() noexcept = 0;
+
+ protected:
+ ~IEventProcessor() {}
+ };
+
+
+ //= AsyncEventNotifier
+
+ struct EventNotifierImpl;
+
+ /** a helper class for notifying events asynchronously
+
+ If you need to notify certain events to external components, you usually should
+ not do this while you have mutexes locked, to prevent multi-threading issues.
+
+ However, you do not always have complete control over all mutex guards on the stack.
+ If, in such a case, the listener notification is one-way, you can decide to do it
+ asynchronously.
+
+ The ->AsyncEventNotifier helps you to process such events asynchronously. Every
+ event is tied to an ->IEventProcessor which is responsible for processing it.
+
+ The AsyncEventNotifier is implemented as a thread itself, which sleeps as long as there are no
+ events in the queue. As soon as you add an event, the thread is woken up, processes the event,
+ and sleeps again.
+ */
+ class COMPHELPER_DLLPUBLIC AsyncEventNotifierBase
+ {
+ friend struct EventNotifierImpl;
+
+ protected:
+ std::unique_ptr<EventNotifierImpl> m_xImpl;
+
+ SAL_DLLPRIVATE virtual ~AsyncEventNotifierBase();
+
+ // Thread
+ SAL_DLLPRIVATE virtual void execute();
+
+ public:
+ AsyncEventNotifierBase();
+
+ /** terminates the thread
+
+ Note that this is a cooperative termination - if you call this from a thread different
+ from the notification thread itself, then it will block until the notification thread
+ finished processing the current event. If you call it from the notification thread
+ itself, it will return immediately, and the thread will be terminated as soon as
+ the current notification is finished.
+ */
+ virtual void SAL_CALL terminate();
+
+ /** adds an event to the queue, together with the instance which is responsible for
+ processing it
+
+ @param _rEvent
+ the event to add to the queue
+ @param _xProcessor
+ the processor for the event.<br/>
+ Beware of life time issues here. If your event processor dies or becomes otherwise
+ nonfunctional, you are responsible for removing all respective events from the queue.
+ You can do this by calling ->removeEventsForProcessor
+ */
+ void addEvent( const AnyEventRef& _rEvent, const ::rtl::Reference< IEventProcessor >& _xProcessor );
+
+ /** removes all events for the given event processor from the queue
+ */
+ void removeEventsForProcessor( const ::rtl::Reference< IEventProcessor >& _xProcessor );
+ };
+
+ /** This class is usable with rtl::Reference.
+ As always, the thread must be joined somewhere.
+ */
+ class COMPHELPER_DLLPUBLIC AsyncEventNotifier final
+ : public AsyncEventNotifierBase
+ , public salhelper::Thread
+ {
+
+ private:
+ SAL_DLLPRIVATE virtual ~AsyncEventNotifier() override;
+
+ SAL_DLLPRIVATE virtual void execute() override;
+
+ public:
+ /** constructs a notifier thread
+
+ @param name the thread name, see ::osl_setThreadName; must not be
+ null
+ */
+ AsyncEventNotifier(char const* name);
+
+ virtual void SAL_CALL terminate() override;
+ };
+
+ /** This is a hack (when proper joining is not possible), use of which
+ should be avoided by good design.
+ */
+ class COMPHELPER_DLLPUBLIC AsyncEventNotifierAutoJoin final
+ : public AsyncEventNotifierBase
+ , private osl::Thread
+ {
+
+ private:
+ SAL_DLLPRIVATE AsyncEventNotifierAutoJoin(char const* name);
+
+ SAL_DLLPRIVATE virtual void SAL_CALL run() override;
+ SAL_DLLPRIVATE virtual void SAL_CALL onTerminated() override;
+
+ public:
+ // only public so shared_ptr finds it
+ SAL_DLLPRIVATE virtual ~AsyncEventNotifierAutoJoin() override;
+
+ static std::shared_ptr<AsyncEventNotifierAutoJoin>
+ newAsyncEventNotifierAutoJoin(char const* name);
+
+ virtual void SAL_CALL terminate() override;
+
+ using osl::Thread::join;
+ using osl::Thread::operator new;
+ using osl::Thread::operator delete; // clang really wants this?
+
+ static void launch(std::shared_ptr<AsyncEventNotifierAutoJoin> const&);
+ };
+
+
+ //= EventHolder
+
+ /** AnyEvent derivee holding a foreign event instance
+ */
+ template < typename EVENT_OBJECT >
+ class SAL_DLLPUBLIC_RTTI EventHolder final : public AnyEvent
+ {
+ public:
+ typedef EVENT_OBJECT EventObjectType;
+
+ private:
+ EventObjectType const m_aEvent;
+
+ public:
+ EventHolder( EventObjectType _aEvent )
+ :m_aEvent(std::move( _aEvent ))
+ {
+ }
+
+ const EventObjectType& getEventObject() const { return m_aEvent; }
+ };
+
+ COMPHELPER_DLLPUBLIC void JoinAsyncEventNotifiers();
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_ASYNCNOTIFICATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/asyncquithandler.hxx b/include/comphelper/asyncquithandler.hxx
new file mode 100644
index 000000000..ce3db23a1
--- /dev/null
+++ b/include/comphelper/asyncquithandler.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ASYNCQUITHANDLER_HXX
+#define INCLUDED_COMPHELPER_ASYNCQUITHANDLER_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <tools/link.hxx>
+
+// Use: Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ) );
+
+class COMPHELPER_DLLPUBLIC AsyncQuitHandler
+{
+ AsyncQuitHandler();
+
+public:
+ AsyncQuitHandler(const AsyncQuitHandler&) = delete;
+ const AsyncQuitHandler& operator=(const AsyncQuitHandler&) = delete;
+
+ static AsyncQuitHandler& instance();
+ static void QuitApplication();
+
+ DECL_STATIC_LINK(AsyncQuitHandler, OnAsyncQuit, void*, void);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/attributelist.hxx b/include/comphelper/attributelist.hxx
new file mode 100644
index 000000000..0309ab608
--- /dev/null
+++ b/include/comphelper/attributelist.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ATTRIBUTELIST_HXX
+#define INCLUDED_COMPHELPER_ATTRIBUTELIST_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace comphelper
+{
+
+struct TagAttribute
+{
+ OUString sName;
+ OUString sType;
+ OUString sValue;
+};
+
+class COMPHELPER_DLLPUBLIC AttributeList final :
+ public ::cppu::WeakImplHelper<css::xml::sax::XAttributeList, css::util::XCloneable>
+{
+ std::vector<TagAttribute> mAttributes;
+public:
+ AttributeList();
+ AttributeList(const AttributeList &r);
+
+ virtual ~AttributeList() override;
+
+ // methods that are not contained in any interface
+ void AddAttribute(const OUString &sName , const OUString &sType , const OUString &sValue)
+ {
+ mAttributes.push_back({sName, sType, sValue});
+ }
+ void Clear()
+ {
+ mAttributes.clear();
+ }
+
+ // css::xml::sax::XAttributeList
+ virtual sal_Int16 SAL_CALL getLength() override
+ {
+ return static_cast<sal_Int16>(mAttributes.size());
+ }
+ virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) override
+ {
+ return mAttributes[i].sName;
+ }
+ virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) override
+ {
+ return mAttributes[i].sType;
+ }
+ virtual OUString SAL_CALL getTypeByName(const OUString& aName) override;
+ virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) override
+ {
+ return mAttributes[i].sValue;
+ }
+ virtual OUString SAL_CALL getValueByName(const OUString& aName) override;
+
+ // css::util::XCloneable
+ virtual css::uno::Reference< XCloneable > SAL_CALL
+ createClone() override;
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_ATTRIBUTELIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/automationinvokedzone.hxx b/include/comphelper/automationinvokedzone.hxx
new file mode 100644
index 000000000..81b0bfab6
--- /dev/null
+++ b/include/comphelper/automationinvokedzone.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_AUTOMATIONINVOKEDZONE_HXX
+#define INCLUDED_COMPHELPER_AUTOMATIONINVOKEDZONE_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+// Helpers for use when calling into LO from an Automation (OLE
+// Automation) client.
+
+namespace comphelper::Automation
+{
+// Create an object of this class at the start of a function directly invoked from an Automation
+// client.
+
+class COMPHELPER_DLLPUBLIC AutomationInvokedZone
+{
+public:
+ AutomationInvokedZone();
+
+ ~AutomationInvokedZone();
+
+ static bool isActive();
+};
+}
+
+#endif // INCLUDED_COMPHELPER_AUTOMATIONINVOKEDZONE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/backupfilehelper.hxx b/include/comphelper/backupfilehelper.hxx
new file mode 100644
index 000000000..abf8044a2
--- /dev/null
+++ b/include/comphelper/backupfilehelper.hxx
@@ -0,0 +1,216 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_BACKUPFILEHELPER_HXX
+#define INCLUDED_COMPHELPER_BACKUPFILEHELPER_HXX
+
+#include <sal/config.h>
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustring.hxx>
+#include <set>
+#include <string_view>
+#include <vector>
+
+namespace comphelper
+{
+ /** Helper class to backup/restore a single file
+ *
+ * This is a general class to manage backups/restore of the file
+ * given by the URL. The container holding the backups is created
+ * aside the original file, e.g for 'test.txt' a container
+ * called '.test.pack' will be used. If it was not yet backed-up
+ * this container file will be created at the 1st backup and deleted
+ * when the last gets removed. The container holds a stack with a
+ * maximum given number (in the constructor) of copies, these are by
+ * default compressed, but don't have to be (see tryPush).
+ *
+ * Due to being on a low system level here, no UNO API and not much
+ * other tooling can be used, as a consequence for the container a
+ * own simple format is used and e.g. the zip lib directly.
+ *
+ * You need to hand over the URL of the file to look at and
+ * a maximum number of allowed copies. That number is internally
+ * limited to an absolute max of 10 (see implementation). The number
+ * of allowed copies is limited to [1..max].
+ *
+ * Calling tryPush() will check if there is no backup yet or if
+ * there is one that the file has changed. If yes, a new copy is
+ * created on a kind of 'stack' of copies. The return value can
+ * be used to see if a backup was indeed created.
+ *
+ * Calling tryPop() will do the opposite: if a backup is available,
+ * delete the orig file and re-instantiate the backup. The backup
+ * is taken off the 'stack' of copies. The return value can be
+ * used to check if this was done.
+ *
+ * isPopPossible can be called to see if there is a backup available
+ * before calling tryPop().
+ *
+ * The 'stack' of copies works by using the same path, filename
+ * and extension, but adding a '_1' -> '_(num_of_copy)' to it.
+ */
+ class COMPHELPER_DLLPUBLIC BackupFileHelper
+ {
+ private:
+ // internal data
+ std::set< OUString > maDirs;
+ std::set< std::pair< OUString, OUString > > maFiles;
+
+ sal_uInt16 mnNumBackups;
+ sal_uInt16 mnMode;
+
+ bool mbActive;
+ bool mbExtensions;
+ bool mbCompress;
+
+ // internal flag if _exit() was called already - a hint to evtl.
+ // not create copies of potentially not well-defined data. This
+ // may be used in destructors of static instances - which unfortunately
+ // get called on WNT but not on linux. Thus I thought about encapsulating
+ // in some '#ifdefs', but it's just more safe to always do it and
+ // allows to add a SAL_WARN when one of these destructors is called
+ // after _exit()
+ static bool mbExitWasCalled;
+
+ // internal detector if SafeModeName dir exists
+ static bool mbSafeModeDirExists;
+
+ // internal upper limit (max) of allowed backups
+ static sal_uInt16 mnMaxAllowedBackups;
+
+ // path to User's configuration directory and derived strings
+ static OUString maInitialBaseURL;
+ static OUString maUserConfigBaseURL;
+ static OUString maUserConfigWorkURL;
+ static OUString maRegModName;
+ static OUString maExt;
+
+ // get path to User's configuration directory (created on-demand)
+ static const OUString& getInitialBaseURL();
+
+ // the name of the SafeMode directory for temporary processing
+ static const OUString& getSafeModeName();
+
+ public:
+ /** Constructor to handle Backups of the given file, will internally
+ * detect configuration values and URL to initial registrymodifications
+ * and thus the User configuration directory
+ */
+ BackupFileHelper();
+
+ // allow to set static global flag when app had to call _exit()
+ static void setExitWasCalled();
+ static bool getExitWasCalled();
+
+ // This call initializes the state of the UserDirectory as needed, it may
+ // initialize to SafeMode configuration or return from it by moving files
+ // in that directory
+ static void reactOnSafeMode(bool bSafeMode);
+
+ /** tries to create a new backup, if there is none yet, or if the
+ * last differs from the base file. It will then put a new version
+ * on the 'stack' of copies and evtl. delete the oldest backup.
+ * Also may cleanup older backups when NumBackups given in the
+ * constructor has changed.
+ *
+ * tryPushExtensionInfo is the specialized version for ExtensionInfo
+ */
+ void tryPush();
+ void tryPushExtensionInfo();
+
+ /** finds out if a restore is possible
+ *
+ * @return bool
+ * returns true if a restore to an older backup is possible
+ *
+ * isPopPossibleExtensionInfo is the specialized version for ExtensionInfo
+ */
+ bool isPopPossible();
+ bool isPopPossibleExtensionInfo() const;
+
+ /** tries to execute a restore. Will overwrite the base file
+ * in that case and take one version off the 'stack' of copies.
+ * Also may cleanup older backups when NumBackups given in the
+ * constructor has changed.
+ *
+ * tryPopExtensionInfo is the specialized version for ExtensionInfo
+ */
+ void tryPop();
+ void tryPopExtensionInfo();
+
+ /** tries to iterate the extensions and to disable all of them
+ */
+ static bool isTryDisableAllExtensionsPossible();
+ static void tryDisableAllExtensions();
+
+ /** Deinstall all User Extensions (installed for User only)
+ */
+ static bool isTryDeinstallUserExtensionsPossible();
+ static void tryDeinstallUserExtensions();
+
+ /** Reset shared Extensions
+ */
+ static bool isTryResetSharedExtensionsPossible();
+ static void tryResetSharedExtensions();
+
+ /** Reset bundled Extensions
+ */
+ static bool isTryResetBundledExtensionsPossible();
+ static void tryResetBundledExtensions();
+
+ /// Disables OpenGL and OpenCL
+ static void tryDisableHWAcceleration();
+
+ /** resets User-Customizations like Settings and UserInterface modifications
+ */
+ static bool isTryResetCustomizationsPossible();
+ static void tryResetCustomizations();
+
+ /** resets the whole UserProfile
+ */
+ static void tryResetUserProfile();
+
+ /** Return the profile url */
+ static const OUString& getUserProfileURL();
+
+ /** Return the url of the backed up profile (when in safe mode) */
+ static const OUString& getUserProfileWorkURL();
+
+ private:
+ // internal helper methods
+ static OUString getPackURL();
+ static const std::vector< OUString >& getCustomizationDirNames();
+ static const std::vector< OUString >& getCustomizationFileNames();
+
+ // file push helpers
+ bool tryPush_Files(const std::set< OUString >& rDirs, const std::set< std::pair< OUString, OUString > >& rFiles, std::u16string_view rSourceURL, const OUString& rTargetURL);
+ bool tryPush_file(std::u16string_view rSourceURL, std::u16string_view rTargetURL, std::u16string_view rName, std::u16string_view rExt);
+
+ // file pop possibilities helper
+ bool isPopPossible_files(const std::set< OUString >& rDirs, const std::set< std::pair< OUString, OUString > >& rFiles, std::u16string_view rSourceURL, std::u16string_view rTargetURL);
+ static bool isPopPossible_file(std::u16string_view rSourceURL, std::u16string_view rTargetURL, std::u16string_view rName, std::u16string_view rExt);
+
+ // file pop helpers
+ bool tryPop_files(const std::set< OUString >& rDirs, const std::set< std::pair< OUString, OUString > >& rFiles, std::u16string_view rSourceURL, const OUString& rTargetURL);
+ bool tryPop_file(std::u16string_view rSourceURL, std::u16string_view rTargetURL, std::u16string_view rName, std::u16string_view rExt);
+
+ // ExtensionInfo helpers
+ bool tryPush_extensionInfo(std::u16string_view rTargetURL);
+ static bool isPopPossible_extensionInfo(std::u16string_view rTargetURL);
+ bool tryPop_extensionInfo(std::u16string_view rTargetURL);
+
+ // FileDirInfo helpers
+ void fillDirFileInfo();
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/base64.hxx b/include/comphelper/base64.hxx
new file mode 100644
index 000000000..78a0bacb5
--- /dev/null
+++ b/include/comphelper/base64.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_BASE64_HXX
+#define INCLUDED_COMPHELPER_BASE64_HXX
+
+#include <sal/config.h>
+
+#include <cstddef>
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <sal/types.h>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/strbuf.hxx>
+
+namespace com::sun::star::uno
+{
+template <class E> class Sequence;
+}
+
+namespace comphelper
+{
+class COMPHELPER_DLLPUBLIC Base64
+{
+public:
+ /** encodes the given byte sequence into Base64 */
+ static void encode(OUStringBuffer& aStrBuffer, const css::uno::Sequence<sal_Int8>& aPass);
+
+ static void encode(OStringBuffer& aStrBuffer, const css::uno::Sequence<sal_Int8>& aPass);
+
+ // Decode a base 64 encoded string into a sequence of bytes. The first
+ // version can be used for attribute values only, because it does not
+ // return any chars left from conversion.
+ // For text submitted through the SAX characters call, the later method
+ // must be used!
+ static void decode(css::uno::Sequence<sal_Int8>& aPass, std::u16string_view sBuffer);
+
+ static std::size_t decodeSomeChars(css::uno::Sequence<sal_Int8>& aPass,
+ std::u16string_view sBuffer);
+};
+}
+
+#endif // INCLUDED_COMPHELPER_BASE64_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/basicio.hxx b/include/comphelper/basicio.hxx
new file mode 100644
index 000000000..62260e3da
--- /dev/null
+++ b/include/comphelper/basicio.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_BASICIO_HXX
+#define INCLUDED_COMPHELPER_BASICIO_HXX
+
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::awt { struct FontDescriptor; }
+
+namespace comphelper
+{
+
+// bool
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, bool& _rVal);
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, bool _bVal);
+void operator <<(
+ css::uno::Reference<css::io::XObjectOutputStream> const &, sal_Bool)
+ = delete;
+
+// OUString
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, OUString& _rStr);
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, const OUString& _rStr);
+
+// sal_Int16
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, sal_Int16& _rValue);
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, sal_Int16 _nValue);
+
+// sal_uInt16
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, sal_uInt16& _rValue);
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, sal_uInt16 _nValue);
+
+// sal_uInt32
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, sal_uInt32& _rValue);
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, sal_uInt32 _nValue);
+
+// sal_Int16
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, sal_Int32& _rValue);
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, sal_Int32 _nValue);
+
+// FontDescriptor
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& InStream, css::awt::FontDescriptor& rVal);
+COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& OutStream, const css::awt::FontDescriptor& rVal);
+
+// sequences
+template <class ELEMENT>
+const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, css::uno::Sequence<ELEMENT>& _rSeq)
+{
+ _rSeq.realloc(_rxInStream->readLong());
+ for (ELEMENT& rElement : asNonConstRange(_rSeq))
+ _rxInStream >> rElement;
+ return _rxInStream;
+}
+
+template <class ELEMENT>
+const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, const css::uno::Sequence<ELEMENT>& _rSeq)
+{
+ _rxOutStream->writeLong(_rSeq.getLength());
+ for (const ELEMENT& rElement : _rSeq)
+ _rxOutStream << rElement;
+ return _rxOutStream;
+}
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_BASICIO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/broadcasthelper.hxx b/include/comphelper/broadcasthelper.hxx
new file mode 100644
index 000000000..65fa6d315
--- /dev/null
+++ b/include/comphelper/broadcasthelper.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_BROADCASTHELPER_HXX
+#define INCLUDED_COMPHELPER_BROADCASTHELPER_HXX
+
+#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.h>
+
+namespace comphelper
+{
+ // OMutexAndBroadcastHelper - a class which holds a Mutex and an OBroadcastHelper;
+ // needed because when deriving from OPropertySetHelper,
+ // the OBroadcastHelper has to be initialized before
+ // the OPropertySetHelper
+
+ class OMutexAndBroadcastHelper
+ {
+ protected:
+ ::osl::Mutex m_aMutex;
+ ::cppu::OBroadcastHelper m_aBHelper;
+
+ public:
+ OMutexAndBroadcastHelper() : m_aBHelper( m_aMutex ) { }
+
+ ::osl::Mutex& GetMutex() { return m_aMutex; }
+ ::cppu::OBroadcastHelper& GetBroadcastHelper() { return m_aBHelper; }
+ const ::cppu::OBroadcastHelper& GetBroadcastHelper() const { return m_aBHelper; }
+
+ };
+}
+
+#endif // INCLUDED_COMPHELPER_BROADCASTHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/bytereader.hxx b/include/comphelper/bytereader.hxx
new file mode 100644
index 000000000..a7e899098
--- /dev/null
+++ b/include/comphelper/bytereader.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <comphelper/comphelperdllapi.h>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace comphelper
+{
+/**
+ * Interface that we can cast to, to bypass the inefficiency of using Sequence<sal_Int8>
+ * when reading via XInputStream.
+ */
+class COMPHELPER_DLLPUBLIC ByteReader
+{
+public:
+ virtual ~ByteReader();
+ virtual sal_Int32 readSomeBytes(sal_Int8* aData, sal_Int32 nBytesToRead) = 0;
+
+ static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
+};
+
+/**
+ * Interface that we can cast to, to bypass the inefficiency of using Sequence<sal_Int8>
+ * when writing via XOutputStream.
+ */
+class COMPHELPER_DLLPUBLIC ByteWriter
+{
+public:
+ virtual ~ByteWriter();
+ virtual sal_Int32 writeSomeBytes(const sal_Int8* aData, sal_Int32 nBytesToWrite) = 0;
+
+ static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
+};
+
+} // namespace utl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/comphelper/classids.hxx b/include/comphelper/classids.hxx
new file mode 100644
index 000000000..4c345b84b
--- /dev/null
+++ b/include/comphelper/classids.hxx
@@ -0,0 +1,334 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_CLASSIDS_HXX
+#define INCLUDED_COMPHELPER_CLASSIDS_HXX
+
+/*
+ * StarWriter
+ */
+
+/* 3.0 */
+
+#define SO3_SW_CLASSID_30 \
+ 0xDC5C7E40L, 0xB35C, 0x101B, 0x99, 0x61, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SW_CLASSID_40 \
+ 0x8b04e9b0, 0x420e, 0x11d0, 0xa4, 0x5e, 0x0, \
+ 0xa0, 0x24, 0x9d, 0x57, 0xb1
+
+/* 5.0 */
+
+#define SO3_SW_CLASSID_50 \
+ 0xc20cf9d1, 0x85ae, 0x11d1, 0xaa, 0xb4, 0x0, \
+ 0x60, 0x97, 0xda, 0x56, 0x1a
+
+ /* 6.0, 7, 8 */
+
+#define SO3_SW_CLASSID_60 \
+ 0x8BC6B165, 0xB1B2, 0x4EDD, 0xAA, 0x47, 0xDA, \
+ 0xE2, 0xEE, 0x68, 0x9D, 0xD6
+
+ /* ole embed 6.0, 7 */
+
+#define SO3_SW_OLE_EMBED_CLASSID_60 \
+ 0x30a2652a, 0xddf7, 0x45e7, 0xac, 0xa6, 0x3e, \
+ 0xab, 0x26, 0xfc, 0x8a, 0x4e
+
+ /* ole embed 8 */
+
+#define SO3_SW_OLE_EMBED_CLASSID_8 \
+ 0xf616b81f, 0x7bb8, 0x4f22, 0xb8, 0xa5, 0x47, \
+ 0x42, 0x8d, 0x59, 0xf8, 0xad
+
+/* current */
+
+#define SO3_SW_CLASSID SO3_SW_CLASSID_60
+
+/*
+ * StarWriter/Web
+ */
+
+/* 6.0, 7, 8 */
+
+#define SO3_SWWEB_CLASSID_60 \
+ 0xA8BBA60C, 0x7C60, 0x4550, 0x91, 0xCE, 0x39, \
+ 0xC3, 0x90, 0x3F, 0xAC, 0x5E
+
+/* current */
+
+#define SO3_SWWEB_CLASSID SO3_SWWEB_CLASSID_60
+
+/*
+ * Globaldokument
+ */
+
+/* 6.0, 7, 8 */
+
+#define SO3_SWGLOB_CLASSID_60 \
+ 0xB21A0A7C, 0xE403, 0x41FE, 0x95, 0x62, 0xBD, \
+ 0x13, 0xEA, 0x6F, 0x15, 0xA0
+
+/* current */
+
+#define SO3_SWGLOB_CLASSID SO3_SWGLOB_CLASSID_60
+
+
+/*
+ * StarCalc
+ */
+
+/* 3.0 */
+
+#define SO3_SC_CLASSID_30 \
+ 0x3F543FA0L, 0xB6A6, 0x101B, 0x99, 0x61, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SC_CLASSID_40 \
+ 0x6361d441L, 0x4235, 0x11d0, 0x89, 0xcb, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SC_CLASSID_50 \
+ 0xc6a5b861L, 0x85d6, 0x11d1, 0x89, 0xcb, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+
+#define SO3_SC_CLASSID_60 \
+ 0x47BBB4CB, 0xCE4C, 0x4E80, 0xA5, 0x91, 0x42, \
+ 0xD9, 0xAE, 0x74, 0x95, 0x0F
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SC_OLE_EMBED_CLASSID_60 \
+ 0x7b342dc4, 0x139a, 0x4a46, 0x8a, 0x93, 0xdb, \
+ 0x8, 0x27, 0xcc, 0xee, 0x9c
+
+/* ole embed 8 */
+
+#define SO3_SC_OLE_EMBED_CLASSID_8 \
+ 0x7fa8ae11, 0xb3e3, 0x4d88, 0xaa, 0xbf, 0x25, \
+ 0x55, 0x26, 0xcd, 0x1c, 0xe8
+
+/* current */
+
+#define SO3_SC_CLASSID SO3_SC_CLASSID_60
+
+/****************************************************
+* StarImpress
+****************************************************/
+
+/* 3.0 */
+
+#define SO3_SIMPRESS_CLASSID_30 \
+ 0xAF10AAE0L, 0xB36D, 0x101B, 0x99, 0x61, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SIMPRESS_CLASSID_40 \
+ 0x12d3cc0L, 0x4216, 0x11d0, 0x89, 0xcb, 0x0, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SIMPRESS_CLASSID_50 \
+ 0x565c7221L, 0x85bc, 0x11d1, 0x89, 0xd0, 0x0, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+
+#define SO3_SIMPRESS_CLASSID_60 \
+ 0x9176E48A, 0x637A, 0x4D1F, 0x80, 0x3B, 0x99, \
+ 0xD9, 0xBF, 0xAC, 0x10, 0x47
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SIMPRESS_OLE_EMBED_CLASSID_60 \
+ 0xe5a0b632, 0xdfba, 0x4549, 0x93, 0x46, 0xe4, \
+ 0x14, 0xda, 0x6, 0xe6, 0xf8
+
+/* ole embed 8 */
+
+#define SO3_SIMPRESS_OLE_EMBED_CLASSID_8 \
+ 0xee5d1ea4, 0xd445, 0x4289, 0xb2, 0xfc, 0x55, \
+ 0xfc, 0x93, 0x69, 0x39, 0x17
+
+/* current */
+
+#define SO3_SIMPRESS_CLASSID SO3_SIMPRESS_CLASSID_60
+
+/****************************************************
+* StarDraw
+****************************************************/
+
+/* 5.0 */
+
+#define SO3_SDRAW_CLASSID_50 \
+ 0x2e8905a0L, 0x85bd, 0x11d1, 0x89, 0xd0, 0x0, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+#define SO3_SDRAW_CLASSID_60 \
+ 0x4BAB8970, 0x8A3B, 0x45B3, 0x99, 0x1C, 0xCB, \
+ 0xEE, 0xAC, 0x6B, 0xD5, 0xE3
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SDRAW_OLE_EMBED_CLASSID_60 \
+ 0x41662fc2, 0xd57, 0x4aff, 0xab, 0x27, 0xad, \
+ 0x2e, 0x12, 0xe7, 0xc2, 0x73
+
+/* ole embed 8 */
+
+#define SO3_SDRAW_OLE_EMBED_CLASSID_8 \
+ 0x448bb771, 0xcfe2, 0x47c4, 0xbc, 0xdf, 0x1f, \
+ 0xbf, 0x37, 0x8e, 0x20, 0x2c
+
+/* current */
+
+#define SO3_SDRAW_CLASSID SO3_SDRAW_CLASSID_60
+
+/****************************************************
+* StarChart
+****************************************************/
+
+/* 3.0 */
+
+#define SO3_SCH_CLASSID_30 \
+ 0xFB9C99E0L, 0x2C6D, 0x101C, 0x8E, 0x2C, 0x00, \
+ 0x00, 0x1B, 0x4C, 0xC7, 0x11
+
+/* 4.0 */
+
+#define SO3_SCH_CLASSID_40 \
+ 0x2b3b7e0L, 0x4225, 0x11d0, 0x89, 0xca, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SCH_CLASSID_50 \
+ 0xbf884321L, 0x85dd, 0x11d1, 0x89, 0xd0, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+
+#define SO3_SCH_CLASSID_60 \
+ 0x12DCAE26, 0x281F, 0x416F, 0xA2, 0x34, 0xC3, \
+ 0x08, 0x61, 0x27, 0x38, 0x2E
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SCH_OLE_EMBED_CLASSID_60 \
+ 0xd415cd93, 0x35c4, 0x4c6f, 0x81, 0x9d, 0xa6, \
+ 0x64, 0xa1, 0xc8, 0x13, 0xae
+
+/* ole embed 8 */
+
+#define SO3_SCH_OLE_EMBED_CLASSID_8 \
+ 0xdd0a57f, 0xcf3b, 0x4fd2, 0xbd, 0xa4, 0x94, \
+ 0x42, 0x71, 0x9b, 0x2a, 0x73
+
+/* current */
+
+#define SO3_SCH_CLASSID SO3_SCH_CLASSID_60
+
+// Report chart
+
+#define SO3_RPTCH_CLASSID \
+ 0x80243D39, 0x6741, 0x46C5, 0x92, 0x6E, 0x06, \
+ 0x91, 0x64, 0xFF, 0x87, 0xBB
+
+/***************************************************
+* StarMath
+***************************************************/
+
+/* 3.0 */
+
+#define SO3_SM_CLASSID_30 \
+ 0xD4590460L, 0x35FD, 0x101C, 0xB1, 0x2A, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SM_CLASSID_40 \
+ 0x2b3b7e1L, 0x4225, 0x11d0, 0x89, 0xca, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SM_CLASSID_50 \
+ 0xffb5e640L, 0x85de, 0x11d1, 0x89, 0xd0, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0, 7, 8 */
+
+#define SO3_SM_CLASSID_60 \
+ 0x078B7ABA, 0x54FC, 0x457F, 0x85, 0x51, 0x61, \
+ 0x47, 0xE7, 0x76, 0xA9, 0x97
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SM_OLE_EMBED_CLASSID_60 \
+ 0xd0484de6, 0xaaee, 0x468a, 0x99, 0x1f, 0x8d, \
+ 0x4b, 0x7, 0x37, 0xb5, 0x7a
+
+/* ole embed 8 */
+
+#define SO3_SM_OLE_EMBED_CLASSID_8 \
+ 0xd2d59cd1, 0xa6a, 0x4d36, 0xae, 0x20, 0x47, \
+ 0x81, 0x70, 0x77, 0xd5, 0x7c
+
+/* current */
+
+#define SO3_SM_CLASSID SO3_SM_CLASSID_60
+
+#define SO3_OUT_CLASSID \
+ 0x970b1e82, 0xcf2d, 0x11cf, 0x89, 0xca, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+#define SO3_DUMMY_CLASSID \
+ 0x970b1fff, 0xcf2d, 0x11cf, \
+ 0x89,0xca,0x00,0x80,0x29,0xe4,0xb0,0xb1
+
+#define SO3_APPLET_CLASSID \
+ 0x970b1e81, 0xcf2d, 0x11cf, \
+ 0x89,0xca,0x00,0x80,0x29,0xe4,0xb0,0xb1
+
+#define SO3_PLUGIN_CLASSID \
+ 0x4caa7761, 0x6b8b, 0x11cf, \
+ 0x89,0xca,0x0,0x80,0x29,0xe4,0xb0,0xb1
+
+#define SO3_IFRAME_CLASSID \
+ 0x1a8a6701, 0xde58, 0x11cf, \
+ 0x89, 0xca, 0x0, 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+#define SO3_RPT_CLASSID_90 \
+ 0xd7896d52, 0xb7af, 0x4820, \
+ 0x9d, 0xfe, 0xd4, 0x04, 0xd0, 0x15, 0x96, 0x0f
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/compbase.hxx b/include/comphelper/compbase.hxx
new file mode 100644
index 000000000..38380ede2
--- /dev/null
+++ b/include/comphelper/compbase.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <comphelper/comphelperdllapi.h>
+#include <comphelper/interfacecontainer4.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <mutex>
+
+namespace comphelper
+{
+/**
+ Serves two purposes
+ (1) extracts code that doesn't need to be templated
+ (2) helps to handle the custom where we have conflicting interfaces
+ e.g. multiple UNO interfaces that extend css::lang::XComponent
+*/
+class COMPHELPER_DLLPUBLIC WeakComponentImplHelperBase : public cppu::OWeakObject,
+ public css::lang::XComponent
+{
+public:
+ virtual ~WeakComponentImplHelperBase() override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL dispose() override;
+ virtual void SAL_CALL
+ addEventListener(css::uno::Reference<css::lang::XEventListener> const& rxListener) override;
+ virtual void SAL_CALL
+ removeEventListener(css::uno::Reference<css::lang::XEventListener> const& rxListener) override;
+
+ virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const& rType) override;
+
+ /**
+ Called by dispose for subclasses to do dispose() work.
+ The mutex is held when called, and subclasses can unlock() the guard if necessary.
+ */
+ virtual void disposing(std::unique_lock<std::mutex>&);
+
+protected:
+ comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> maEventListeners;
+ mutable std::mutex m_aMutex;
+ bool m_bDisposed = false;
+};
+
+template <typename... Ifc>
+class SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper : public WeakComponentImplHelperBase,
+ public css::lang::XTypeProvider,
+ public Ifc...
+{
+public:
+ virtual void SAL_CALL acquire() noexcept final override { OWeakObject::acquire(); }
+
+ virtual void SAL_CALL release() noexcept final override { OWeakObject::release(); }
+
+ // css::lang::XComponent
+ virtual void SAL_CALL dispose() noexcept final override
+ {
+ WeakComponentImplHelperBase::dispose();
+ }
+ virtual void SAL_CALL addEventListener(
+ css::uno::Reference<css::lang::XEventListener> const& rxListener) final override
+ {
+ WeakComponentImplHelperBase::addEventListener(rxListener);
+ }
+ virtual void SAL_CALL removeEventListener(
+ css::uno::Reference<css::lang::XEventListener> const& rxListener) final override
+ {
+ WeakComponentImplHelperBase::removeEventListener(rxListener);
+ }
+
+ virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const& rType) override
+ {
+ return WeakComponentImplHelper_query(rType, class_data_get(), this);
+ }
+
+ // css::lang::XTypeProvider
+ virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override
+ {
+ static const css::uno::Sequence<css::uno::Type> aTypeList{
+ cppu::UnoType<css::uno::XWeak>::get(), cppu::UnoType<css::lang::XComponent>::get(),
+ cppu::UnoType<css::lang::XTypeProvider>::get(), cppu::UnoType<Ifc>::get()...
+ };
+ return aTypeList;
+ }
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override
+ {
+ return css::uno::Sequence<sal_Int8>();
+ }
+
+private:
+ static cppu::class_data* class_data_get()
+ {
+ return cppu::detail::ImplClassData<WeakComponentImplHelper, Ifc...>{}();
+ }
+};
+
+/** WeakComponentImplHelper
+*/
+COMPHELPER_DLLPUBLIC css::uno::Any
+WeakComponentImplHelper_query(css::uno::Type const& rType, cppu::class_data* cd,
+ WeakComponentImplHelperBase* pBase);
+
+} // namespace comphelper
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/comphelper/comphelperdllapi.h b/include/comphelper/comphelperdllapi.h
new file mode 100644
index 000000000..361326a4e
--- /dev/null
+++ b/include/comphelper/comphelperdllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_COMPHELPERDLLAPI_H
+#define INCLUDED_COMPHELPER_COMPHELPERDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(COMPHELPER_DLLIMPLEMENTATION)
+#define COMPHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define COMPHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define COMPHELPER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_COMPHELPER_COMPHELPERDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/componentbase.hxx b/include/comphelper/componentbase.hxx
new file mode 100644
index 000000000..ce6353be4
--- /dev/null
+++ b/include/comphelper/componentbase.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_COMPONENTBASE_HXX
+#define INCLUDED_COMPHELPER_COMPONENTBASE_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <cppuhelper/interfacecontainer.h>
+
+
+namespace comphelper
+{
+
+
+ //= ComponentBase
+
+ class COMPHELPER_DLLPUBLIC ComponentBase
+ {
+ protected:
+ /** creates a ComponentBase instance
+
+ The instance is not initialized. As a consequence, every ComponentMethodGuard instantiated for
+ this component will throw a css::lang::NotInitializedException,
+ until ->setInitialized() is called.
+ */
+ ComponentBase( ::cppu::OBroadcastHelper& _rBHelper )
+ :m_rBHelper( _rBHelper )
+ ,m_bInitialized( false )
+ {
+ }
+
+ struct NoInitializationNeeded { };
+
+ /** creates a ComponentBase instance
+
+ The instance is already initialized, so there's no need to call setInitialized later on. Use this
+ constructor for component implementations which do not require explicit initialization.
+ */
+ ComponentBase( ::cppu::OBroadcastHelper& _rBHelper, NoInitializationNeeded )
+ :m_rBHelper( _rBHelper )
+ ,m_bInitialized( true )
+ {
+ }
+
+ ~ComponentBase() COVERITY_NOEXCEPT_FALSE {}
+
+ /** marks the instance as initialized
+
+ Subsequent instantiations of a ComponentMethodGuard won't throw the NotInitializedException now.
+ */
+ void setInitialized() { m_bInitialized = true; }
+
+ public:
+ /// helper struct to grant access to selected public methods to the ComponentMethodGuard class
+ struct GuardAccess { friend class ComponentMethodGuard; private: GuardAccess() { } };
+
+ /// retrieves the component's mutex
+ ::osl::Mutex& getMutex( GuardAccess ) { return getMutex(); }
+ /// checks whether the component is already disposed, throws a DisposedException if so.
+ void checkDisposed( GuardAccess ) const;
+ /// checks whether the component is already initialized, throws a NotInitializedException if not.
+ void checkInitialized( GuardAccess ) const;
+
+ protected:
+ /// retrieves the component's broadcast helper
+ ::cppu::OBroadcastHelper& getBroadcastHelper() { return m_rBHelper; }
+ /// retrieves the component's mutex
+ ::osl::Mutex& getMutex() { return m_rBHelper.rMutex; }
+ /// determines whether the instance is already disposed
+ bool impl_isDisposed() const { return m_rBHelper.bDisposed; }
+
+ /// determines whether the component is already initialized
+ bool
+ impl_isInitialized_nothrow() const { return m_bInitialized; }
+
+ /** returns the context to be used when throwing exceptions
+
+ The default implementation returns <NULL/>.
+ */
+ static css::uno::Reference< css::uno::XInterface >
+ getComponent();
+
+ private:
+ ::cppu::OBroadcastHelper& m_rBHelper;
+ bool m_bInitialized;
+ };
+
+ class ComponentMethodGuard
+ {
+ public:
+ enum class MethodType
+ {
+ /// allow the method to be called only when being initialized and not being disposed
+ Default,
+ /// allow the method to be called without being initialized
+ WithoutInit
+
+ };
+
+ ComponentMethodGuard( ComponentBase& _rComponent, const MethodType _eType = MethodType::Default )
+ :m_aMutexGuard( _rComponent.getMutex( ComponentBase::GuardAccess() ) )
+ {
+ if ( _eType != MethodType::WithoutInit )
+ _rComponent.checkInitialized( ComponentBase::GuardAccess() );
+ _rComponent.checkDisposed( ComponentBase::GuardAccess() );
+ }
+
+ void clear()
+ {
+ m_aMutexGuard.clear();
+ }
+
+ private:
+ osl::ClearableMutexGuard m_aMutexGuard;
+ };
+
+
+} // namespace ComponentBase
+
+
+#endif // INCLUDED_COMPHELPER_COMPONENTBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/componentguard.hxx b/include/comphelper/componentguard.hxx
new file mode 100644
index 000000000..f3cf1bd5e
--- /dev/null
+++ b/include/comphelper/componentguard.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_COMPONENTGUARD_HXX
+#define INCLUDED_COMPHELPER_COMPONENTGUARD_HXX
+
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.h>
+
+
+namespace comphelper
+{
+
+
+ //= ComponentGuard
+
+ class ComponentGuard
+ {
+ public:
+ ComponentGuard( ::cppu::OWeakObject& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper )
+ :m_aGuard( i_broadcastHelper.rMutex )
+ {
+ if ( i_broadcastHelper.bDisposed )
+ throw css::lang::DisposedException( OUString(), &i_component );
+ }
+
+ void clear() { m_aGuard.clear(); }
+ void reset() { m_aGuard.reset(); }
+
+ private:
+ ::osl::ResettableMutexGuard m_aGuard;
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_COMPONENTGUARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/configuration.hxx b/include/comphelper/configuration.hxx
new file mode 100644
index 000000000..222b9d5af
--- /dev/null
+++ b/include/comphelper/configuration.hxx
@@ -0,0 +1,342 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_CONFIGURATION_HXX
+#define INCLUDED_COMPHELPER_CONFIGURATION_HXX
+
+#include <sal/config.h>
+
+#include <optional>
+#include <string_view>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <comphelper/comphelperdllapi.h>
+#include <comphelper/processfactory.hxx>
+#include <sal/types.h>
+#include <memory>
+
+namespace com::sun::star {
+ namespace configuration { class XReadWriteAccess; }
+ namespace container {
+ class XHierarchicalNameAccess;
+ class XHierarchicalNameReplace;
+ class XNameAccess;
+ class XNameContainer;
+ }
+ namespace uno { class XComponentContext; }
+}
+
+namespace comphelper {
+
+namespace detail { class ConfigurationWrapper; }
+
+/// A batch of configuration changes that is committed as a whole.
+///
+/// Client code needs to call commit explicitly; otherwise the changes are lost
+/// when the instance is destroyed.
+///
+/// This is the only class from this header file that client code should use
+/// directly.
+class COMPHELPER_DLLPUBLIC ConfigurationChanges {
+public:
+ static std::shared_ptr<ConfigurationChanges> create();
+
+ ~ConfigurationChanges();
+
+ void commit() const;
+
+private:
+ ConfigurationChanges(const ConfigurationChanges&) = delete;
+ ConfigurationChanges& operator=(const ConfigurationChanges&) = delete;
+
+ SAL_DLLPRIVATE ConfigurationChanges(
+ css::uno::Reference< css::uno::XComponentContext >
+ const & context);
+
+ SAL_DLLPRIVATE void setPropertyValue(
+ OUString const & path, css::uno::Any const & value)
+ const;
+
+ SAL_DLLPRIVATE css::uno::Reference<
+ css::container::XHierarchicalNameReplace >
+ getGroup(OUString const & path) const;
+
+ SAL_DLLPRIVATE
+ css::uno::Reference< css::container::XNameContainer >
+ getSet(OUString const & path) const;
+
+ css::uno::Reference<
+ css::configuration::XReadWriteAccess > access_;
+
+ friend class detail::ConfigurationWrapper;
+};
+
+namespace detail {
+
+/// @internal
+class COMPHELPER_DLLPUBLIC ConfigurationWrapper {
+public:
+ static ConfigurationWrapper const & get();
+
+ bool isReadOnly(OUString const & path) const;
+
+ css::uno::Any getPropertyValue(std::u16string_view path) const;
+
+ static void setPropertyValue(
+ std::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path, css::uno::Any const & value);
+
+ css::uno::Any getLocalizedPropertyValue(
+ std::u16string_view path) const;
+
+ static void setLocalizedPropertyValue(
+ std::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path, css::uno::Any const & value);
+
+ css::uno::Reference<
+ css::container::XHierarchicalNameAccess >
+ getGroupReadOnly(OUString const & path) const;
+
+ static css::uno::Reference<
+ css::container::XHierarchicalNameReplace >
+ getGroupReadWrite(
+ std::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path);
+
+ css::uno::Reference< css::container::XNameAccess >
+ getSetReadOnly(OUString const & path) const;
+
+ static css::uno::Reference< css::container::XNameContainer >
+ getSetReadWrite(
+ std::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path);
+
+ std::shared_ptr< ConfigurationChanges > createChanges() const;
+
+private:
+ SAL_DLLPRIVATE explicit ConfigurationWrapper();
+
+ SAL_DLLPRIVATE ~ConfigurationWrapper();
+
+ ConfigurationWrapper(const ConfigurationWrapper&) = delete;
+ ConfigurationWrapper& operator=(const ConfigurationWrapper&) = delete;
+
+ css::uno::Reference< css::uno::XComponentContext > context_;
+
+ css::uno::Reference< css::configuration::XReadWriteAccess > access_;
+ // should really be a css.configuration.ReadOnlyAccess (with added
+ // css.beans.XHierarchicalPropertySetInfo), but then
+ // configmgr::Access::asProperty() would report all properties as
+ // READONLY, so isReadOnly() would not work
+};
+
+/// @internal
+template< typename T > struct Convert {
+ static css::uno::Any toAny(T const & value)
+ { return css::uno::Any(value); }
+
+ static T fromAny(css::uno::Any const & value)
+ { return value.get< T >(); }
+
+private:
+ Convert(const Convert&) = delete;
+ Convert& operator=(const Convert&) = delete;
+
+ Convert() = delete;
+ ~Convert() = delete;
+};
+
+/// @internal
+template< typename T > struct Convert< std::optional< T > >
+{
+ static css::uno::Any toAny(std::optional< T > const & value) {
+ return value
+ ? css::uno::Any(*value)
+ : css::uno::Any();
+ }
+
+ static std::optional< T > fromAny(css::uno::Any const & value)
+ {
+ return value.hasValue()
+ ? std::optional< T >(value.get< T >()) : std::optional< T >();
+ }
+
+private:
+ Convert(const Convert&) = delete;
+ Convert& operator=(const Convert&) = delete;
+
+ Convert() = delete;
+ ~Convert() = delete;
+};
+
+}
+
+/// A type-safe wrapper around a (non-localized) configuration property.
+///
+/// Automatically generated headers for the various configuration properties
+/// derive from this template and make available its member functions to access
+/// each given configuration property.
+template< typename T, typename U > struct ConfigurationProperty
+{
+ /// Get the read-only status of the given (non-localized) configuration
+ /// property.
+ static bool isReadOnly()
+ {
+ return detail::ConfigurationWrapper::get().isReadOnly(T::path());
+ }
+
+ /// Get the value of the given (non-localized) configuration property.
+ ///
+ /// For nillable properties, U is of type std::optional<U'>.
+ static U get()
+ {
+ // Folding this into one statement causes a bogus error at least with
+ // Red Hat GCC 4.6.2-1:
+ css::uno::Any a(
+ detail::ConfigurationWrapper::get().getPropertyValue(
+ T::path()));
+ return detail::Convert< U >::fromAny(a);
+ }
+
+ /// Set the value of the given (non-localized) configuration property, via a
+ /// given changes batch.
+ ///
+ /// For nillable properties, U is of type std::optional<U'>.
+ static void set(
+ U const & value,
+ std::shared_ptr< ConfigurationChanges > const & batch)
+ {
+ comphelper::detail::ConfigurationWrapper::setPropertyValue(
+ batch, T::path(), detail::Convert< U >::toAny(value));
+ }
+
+private:
+ ConfigurationProperty(const ConfigurationProperty&) = delete;
+ ConfigurationProperty& operator=(const ConfigurationProperty&) = delete;
+
+ ConfigurationProperty() = delete;
+ ~ConfigurationProperty() = delete;
+};
+
+/// A type-safe wrapper around a localized configuration property.
+///
+/// Automatically generated headers for the various localized configuration
+/// properties derive from this template and make available its member functions
+/// to access each given localized configuration property.
+template< typename T, typename U > struct ConfigurationLocalizedProperty
+{
+ /// Get the value of the given localized configuration property, for the
+ /// locale currently set at the
+ /// com.sun.star.configuration.theDefaultProvider.
+ ///
+ /// For nillable properties, U is of type std::optional<U'>.
+ static U get()
+ {
+ // Folding this into one statement causes a bogus error at least with
+ // Red Hat GCC 4.6.2-1:
+ css::uno::Any a(
+ detail::ConfigurationWrapper::get().
+ getLocalizedPropertyValue(T::path()));
+ return detail::Convert< U >::fromAny(a);
+ }
+
+ /// Set the value of the given localized configuration property, for the
+ /// locale currently set at the
+ /// com.sun.star.configuration.theDefaultProvider, via a given changes
+ /// batch.
+ ///
+ /// For nillable properties, U is of type std::optional<U'>.
+ static void set(
+ U const & value,
+ std::shared_ptr< ConfigurationChanges > const & batch)
+ {
+ comphelper::detail::ConfigurationWrapper::setLocalizedPropertyValue(
+ batch, T::path(), detail::Convert< U >::toAny(value));
+ }
+
+private:
+ ConfigurationLocalizedProperty(const ConfigurationLocalizedProperty&) = delete;
+ ConfigurationLocalizedProperty& operator=(const ConfigurationLocalizedProperty&) = delete;
+
+ ConfigurationLocalizedProperty() = delete;
+ ~ConfigurationLocalizedProperty() = delete;
+};
+
+/// A type-safe wrapper around a configuration group.
+///
+/// Automatically generated headers for the various configuration groups derive
+/// from this template and make available its member functions to access each
+/// given configuration group.
+template< typename T > struct ConfigurationGroup {
+ /// Get read-only access to the given configuration group.
+ static css::uno::Reference<
+ css::container::XHierarchicalNameAccess >
+ get()
+ {
+ return detail::ConfigurationWrapper::get().getGroupReadOnly(
+ T::path());
+ }
+
+ /// Get read/write access to the given configuration group, storing any
+ /// modifications via the given changes batch.
+ static css::uno::Reference<
+ css::container::XHierarchicalNameReplace >
+ get(std::shared_ptr< ConfigurationChanges > const & batch)
+ {
+ return comphelper::detail::ConfigurationWrapper::getGroupReadWrite(
+ batch, T::path());
+ }
+
+private:
+ ConfigurationGroup(const ConfigurationGroup&) = delete;
+ ConfigurationGroup& operator=(const ConfigurationGroup&) = delete;
+
+ ConfigurationGroup() = delete;
+ ~ConfigurationGroup() = delete;
+};
+
+/// A type-safe wrapper around a configuration set.
+///
+/// Automatically generated headers for the various configuration sets derive
+/// from this template and make available its member functions to access each
+/// given configuration set.
+template< typename T > struct ConfigurationSet {
+ /// Get read-only access to the given configuration set.
+ static
+ css::uno::Reference< css::container::XNameAccess >
+ get()
+ {
+ return detail::ConfigurationWrapper::get().getSetReadOnly(
+ T::path());
+ }
+
+ /// Get read/write access to the given configuration set, storing any
+ /// modifications via the given changes batch.
+ static
+ css::uno::Reference< css::container::XNameContainer >
+ get(std::shared_ptr< ConfigurationChanges > const & batch)
+ {
+ return comphelper::detail::ConfigurationWrapper::getSetReadWrite(
+ batch, T::path());
+ }
+
+private:
+ ConfigurationSet(const ConfigurationSet&) = delete;
+ ConfigurationSet& operator=(const ConfigurationSet&) = delete;
+
+ ConfigurationSet() = delete;
+ ~ConfigurationSet() = delete;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/configurationhelper.hxx b/include/comphelper/configurationhelper.hxx
new file mode 100644
index 000000000..162319316
--- /dev/null
+++ b/include/comphelper/configurationhelper.hxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_CONFIGURATIONHELPER_HXX
+#define INCLUDED_COMPHELPER_CONFIGURATIONHELPER_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustring.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::uno { class XInterface; }
+
+namespace comphelper
+{
+ /** specify all possible modes, which can be used to open a configuration access.
+ *
+ * @see openConfig()
+ * @see readDirectKey()
+ * @see writeDirectKey()
+ */
+ enum class EConfigurationModes
+ {
+ /// opens configuration in read/write mode (without LAZY writing!)
+ Standard = 0,
+ /// configuration will be opened readonly
+ ReadOnly = 1,
+ /// all localized nodes will be interpreted as XInterface instead of interpreting it as atomic value nodes
+ AllLocales = 2
+ };
+
+
+}
+
+namespace o3tl
+{
+ template<> struct typed_flags<comphelper::EConfigurationModes> : is_typed_flags<comphelper::EConfigurationModes, 0x3> {};
+}
+
+namespace comphelper
+{
+
+class COMPHELPER_DLLPUBLIC ConfigurationHelper
+{
+public:
+ /** returns access to the specified configuration package.
+ *
+ * This method should be used, if e.g. more than one request to the same
+ * configuration package is needed. The configuration access can be cached
+ * outside and used inbetween.
+ *
+ * @param rxContext
+ * the uno service manager, which should be used to create the
+ * configuration access.
+ *
+ * @param sPackage
+ * the name of the configuration package.
+ * e.g. <ul>
+ * <li>org.openoffice.Office.Common</li>
+ * <li>org.openoffice.Office.Common/Menu</li>
+ * </ul>
+ *
+ * @param eMode
+ * specify the open mode for the returned configuration access.
+ * It's interpreted as a flag field and can be any useful combination
+ * of values of EConfigurationModes.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::uno::Exception if the configuration could not be opened.
+ */
+ static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& sPackage,
+ EConfigurationModes eMode );
+
+
+ /** reads the value of an existing(!) configuration key,
+ * which is searched relative to the specified configuration access.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here ... and
+ * all operations are made relative to this access point.
+ *
+ * @param xCFG
+ * the configuration root, where sRelPath should be interpreted.
+ * as relative path
+ *
+ * @param sRelPath
+ * path relative to xCFG parameter.
+ *
+ * @param sKey
+ * the configuration node, where we should read the value.
+ *
+ * @return [css.uno.Any]
+ * the value of sKey.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::container::NoSuchElementException if the specified
+ * key does not exists.
+ */
+ static css::uno::Any readRelativeKey(const css::uno::Reference< css::uno::XInterface >& xCFG ,
+ const OUString& sRelPath,
+ const OUString& sKey );
+
+
+ /** writes a new value for an existing(!) configuration key,
+ * which is searched relative to the specified configuration access.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here ... and
+ * all operations are made relative to this access point.
+ *
+ * @param xCFG
+ * the configuration root, where sRelPath should be interpreted.
+ * as relative path
+ *
+ * @param sRelPath
+ * path relative to xCFG parameter.
+ *
+ * @param sKey
+ * the configuration node, where we should write the new value.
+ *
+ * @param aValue
+ * the new value for sKey.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::container::NoSuchElementException if the specified
+ * key does not exists or css::uno::Exception if the provided configuration
+ * access does not allow writing for this key.
+ */
+ static void writeRelativeKey(const css::uno::Reference< css::uno::XInterface >& xCFG ,
+ const OUString& sRelPath,
+ const OUString& sKey ,
+ const css::uno::Any& aValue );
+
+
+ /** it checks if the specified set node exists ... or create an empty one
+ * otherwise.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here ... and
+ * all operations are made relative to this access point.
+ *
+ * Further this method must be used only with configuration set's.
+ * Atomic keys can't be "created"... they "exist every time".
+ *
+ * @param xCFG
+ * the configuration root, where sRelPathToSet should be interpreted
+ * as relative path.
+ *
+ * @param sRelPathToSet
+ * path relative to xCFG parameter.
+ *
+ * @param sSetNode
+ * the set node, which should be checked if its exists ...
+ * or which should be created with default values.
+ *
+ * @return A reference to the found (or new created) set node.
+ * Can't be NULL .. in such case an exception occurs!
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::uno::Exception if the provided configuration
+ * access does not allow writing for this set.
+ */
+ static css::uno::Reference< css::uno::XInterface > makeSureSetNodeExists(const css::uno::Reference< css::uno::XInterface >& xCFG ,
+ const OUString& sRelPathToSet,
+ const OUString& sSetNode );
+
+
+ /** commit all changes made on the specified configuration access.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here.
+ *
+ * @param xCFG
+ * the configuration root, where changes should be committed.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::uno::Exception if the provided configuration
+ * access does not allow writing for this set.
+ */
+ static void flush(const css::uno::Reference< css::uno::XInterface >& xCFG);
+
+
+ /** does the same then openConfig() & readRelativeKey() together.
+ *
+ * This method should be used for reading one key at one code place only.
+ * Because it opens the specified configuration package, reads the key and
+ * closes the configuration again.
+ *
+ * So it's not very useful to use this method for reading multiple keys at the same time.
+ * (Excepting these keys exists inside different configuration packages ...))
+ */
+ static css::uno::Any readDirectKey(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& sPackage,
+ const OUString& sRelPath,
+ const OUString& sKey ,
+ EConfigurationModes eMode );
+
+
+ /** does the same then openConfig() / writeRelativeKey() & flush() together.
+ *
+ * This method should be used for writing one key at one code place only.
+ * Because it opens the specified configuration package, writes the key, flush
+ * all changes and closes the configuration again.
+ *
+ * So it's not very useful to use this method for writing multiple keys at the same time.
+ * (Excepting these keys exists inside different configuration packages ...))
+ */
+ static void writeDirectKey(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& sPackage,
+ const OUString& sRelPath,
+ const OUString& sKey ,
+ const css::uno::Any& aValue ,
+ EConfigurationModes eMode );
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_CONFIGURATIONHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/configurationlistener.hxx b/include/comphelper/configurationlistener.hxx
new file mode 100644
index 000000000..55342514c
--- /dev/null
+++ b/include/comphelper/configurationlistener.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_CONFIGURATIONLISTENER_HXX
+#define INCLUDED_COMPHELPER_CONFIGURATIONLISTENER_HXX
+
+#include <vector>
+#include <comphelper/comphelperdllapi.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <rtl/ref.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/configurationhelper.hxx>
+
+namespace com::sun::star::beans { struct PropertyChangeEvent; }
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace comphelper {
+
+class ConfigurationListener;
+
+class COMPHELPER_DLLPUBLIC ConfigurationListenerPropertyBase {
+public:
+ OUString maName;
+ rtl::Reference<ConfigurationListener> mxListener;
+
+ virtual ~ConfigurationListenerPropertyBase() {}
+ virtual void setProperty(const css::uno::Any &aProperty) = 0;
+ void dispose() { mxListener.clear(); }
+};
+
+/// Access to this class must be protected by the SolarMutex
+template< typename uno_type > class ConfigurationListenerProperty : public ConfigurationListenerPropertyBase
+{
+ uno_type maValue;
+protected:
+ virtual void setProperty(const css::uno::Any &aProperty) override
+ {
+ aProperty >>= maValue;
+ }
+public:
+ /**
+ * Provide a mirror of the configmgr's version of this property
+ * for the lifecycle of this property. The property value tracks
+ * the same value in the configuration.
+ */
+ inline ConfigurationListenerProperty(const rtl::Reference< ConfigurationListener > &xListener,
+ const OUString &rProp );
+
+ virtual inline ~ConfigurationListenerProperty() override;
+
+ uno_type get() const { return maValue; }
+};
+
+// workaround for incremental linking bugs in MSVC2019
+class SAL_DLLPUBLIC_TEMPLATE ConfigurationListener_Base : public cppu::WeakImplHelper< css::beans::XPropertyChangeListener > {};
+class COMPHELPER_DLLPUBLIC ConfigurationListener final : public ConfigurationListener_Base
+{
+ css::uno::Reference< css::beans::XPropertySet > mxConfig;
+ std::vector< ConfigurationListenerPropertyBase * > maListeners;
+ bool mbDisposed;
+public:
+ /// Public health warning, you -must- dispose this if you use it.
+ ConfigurationListener(const OUString &rPath,
+ css::uno::Reference< css::uno::XComponentContext >
+ const & xContext = comphelper::getProcessComponentContext())
+ : mxConfig( ConfigurationHelper::openConfig( xContext, rPath, EConfigurationModes::ReadOnly ),
+ css::uno::UNO_QUERY_THROW )
+ , mbDisposed(false)
+ { }
+
+ virtual ~ConfigurationListener() override
+ {
+ dispose();
+ }
+
+ /// Listen for the specific property denoted by the listener
+ void addListener(ConfigurationListenerPropertyBase *pListener);
+
+ /// Stop listening.
+ void removeListener(ConfigurationListenerPropertyBase *pListener);
+
+ /// Release various circular references
+ void dispose();
+
+ // XPropertyChangeListener implementation
+ virtual void SAL_CALL disposing(css::lang::EventObject const &) override;
+
+ /// Notify of the property change
+ virtual void SAL_CALL propertyChange(
+ css::beans::PropertyChangeEvent const &rEvt ) override;
+
+ bool isDisposed() const { return mbDisposed; }
+};
+
+template< typename uno_type > ConfigurationListenerProperty< uno_type >::ConfigurationListenerProperty(const rtl::Reference< ConfigurationListener > &xListener, const OUString &rProp )
+ : maValue()
+{
+ maName = rProp;
+ mxListener = xListener;
+ mxListener->addListener(this);
+}
+
+template< typename uno_type > ConfigurationListenerProperty< uno_type >::~ConfigurationListenerProperty()
+{
+ if (mxListener.is())
+ mxListener->removeListener(this);
+}
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_CONFIGURATIONLISTENER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/container.hxx b/include/comphelper/container.hxx
new file mode 100644
index 000000000..84acfc5b0
--- /dev/null
+++ b/include/comphelper/container.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_CONTAINER_HXX
+#define INCLUDED_COMPHELPER_CONTAINER_HXX
+
+#include <vector>
+#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+
+namespace comphelper
+{
+
+
+//= IndexAccessIterator
+
+/** an iterator that iterates through all elements, starting from an XIndexAccess (pre-order)
+*/
+class COMPHELPER_DLLPUBLIC IndexAccessIterator
+{
+protected:
+ css::uno::Reference< css::uno::XInterface> m_xStartingPoint;
+
+ css::uno::Reference< css::uno::XInterface> m_xCurrentObject;
+ // The current object
+ ::std::vector<sal_Int32> m_arrChildIndizies;
+
+ // I'm moving through a tree, but its elements have no GetNextSibling,
+ // so I have to remember where each child is in relation to its parent.
+ // That is the path from the root node to m_xCurrentObject
+
+public:
+ IndexAccessIterator(css::uno::Reference< css::uno::XInterface> xStartingPoint);
+
+ virtual ~IndexAccessIterator();
+
+ css::uno::Reference< css::uno::XInterface> const & Next();
+
+ virtual void Invalidate() { m_xCurrentObject = nullptr; }
+
+protected:
+ virtual bool ShouldHandleElement(const css::uno::Reference< css::uno::XInterface>& /*rElement*/) { return true; }
+
+ // This can be used to exclude certain elements; elements for which
+ // this function returns sal_True will be simply skipped.
+ // If this element is returned from Next(), then one can get
+ // here get a little more information on the element.
+ // That's why this method is not const.
+ virtual bool ShouldStepInto(const css::uno::Reference< css::uno::XInterface>& /*xContainer*/) const { return true; }
+};
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_CONTAINER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/containermultiplexer.hxx b/include/comphelper/containermultiplexer.hxx
new file mode 100644
index 000000000..5b40b62ae
--- /dev/null
+++ b/include/comphelper/containermultiplexer.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_CONTAINERMULTIPLEXER_HXX
+#define INCLUDED_COMPHELPER_CONTAINERMULTIPLEXER_HXX
+
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ref.hxx>
+
+namespace osl { class Mutex; }
+namespace com::sun::star::container { class XContainer; }
+
+
+namespace comphelper
+{
+
+
+ class OContainerListenerAdapter;
+
+ //= OContainerListener
+
+ /** a non-UNO container listener
+ <p>Useful if you have a non-refcountable class which should act as container listener.<br/>
+ In this case, derive this class from OContainerListener, and create an adapter
+ OContainerListenerAdapter which multiplexes the changes.</p>
+ */
+ class COMPHELPER_DLLPUBLIC OContainerListener
+ {
+ friend class OContainerListenerAdapter;
+ protected:
+ rtl::Reference<OContainerListenerAdapter> m_xAdapter;
+ ::osl::Mutex& m_rMutex;
+
+ public:
+ OContainerListener(::osl::Mutex& _rMutex);
+ virtual ~OContainerListener();
+
+ /// @throws css::uno::RuntimeException
+ virtual void _elementInserted( const css::container::ContainerEvent& _rEvent );
+ /// @throws css::uno::RuntimeException
+ virtual void _elementRemoved( const css::container::ContainerEvent& _rEvent );
+ /// @throws css::uno::RuntimeException
+ virtual void _elementReplaced( const css::container::ContainerEvent& _rEvent );
+ /// @throws css::uno::RuntimeException
+ virtual void _disposing(const css::lang::EventObject& _rSource);
+
+ protected:
+ void setAdapter(OContainerListenerAdapter* _pAdapter);
+ };
+
+ // workaround for incremental linking bugs in MSVC2015
+ class SAL_DLLPUBLIC_TEMPLATE OContainerListenerAdapter_Base : public cppu::WeakImplHelper< css::container::XContainerListener > {};
+
+ class COMPHELPER_DLLPUBLIC OContainerListenerAdapter final : public OContainerListenerAdapter_Base
+ {
+ friend class OContainerListener;
+
+ private:
+ css::uno::Reference< css::container::XContainer >
+ m_xContainer;
+ OContainerListener* m_pListener;
+
+ virtual ~OContainerListenerAdapter() override;
+
+ public:
+ OContainerListenerAdapter(OContainerListener* _pListener,
+ const css::uno::Reference< css::container::XContainer >& _rxContainer);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override;
+ virtual void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override;
+ virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
+
+ /// dispose the object. No multiplexing anymore
+ void dispose();
+
+ };
+
+
+} // namespace dbaui
+
+
+#endif // INCLUDED_COMPHELPER_CONTAINERMULTIPLEXER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/crashzone.hxx b/include/comphelper/crashzone.hxx
new file mode 100644
index 000000000..f15f848cd
--- /dev/null
+++ b/include/comphelper/crashzone.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_CRASHZONE_H
+#define INCLUDED_COMPHELPER_CRASHZONE_H
+
+#include <sal/config.h>
+
+#include <atomic>
+#include <csignal>
+#include <type_traits>
+
+struct CrashWatchdogTimingsValues
+{
+ /// delays to take various actions in 1/4 of a second increments.
+ int mnDisableEntries;
+ int const mnAbortAfter;
+};
+
+/**
+ * A generic class for detecting if a given crash or a lock-up came from a specific
+ * area of code (such as OpenGL).
+ * Use this helper to track that.
+ * The class is a template so that there can be multiple instances of static variables.
+ */
+template <typename Dummy> class CrashZone
+{
+// gnEnterCount and gnLeaveCount are accessed both from multiple threads (cf.
+// WatchdogThread::execute; so need to be of atomic type) and from signal handlers (cf.
+// VCLExceptionSignal_impl; so need to be of lock-free atomic type). sig_atomic_t is chosen as
+// the underlying type under the assumption that it is most likely to lead to an atomic type
+// that is actually lock-free. However, gnEnterCount and gnLeaveCount are both monotonically
+// increasing, so will eventually overflow, so the underlying type better be unsigned, which
+// sig_atomic_t is not guaranteed to be:
+#if !defined ARM32 || (defined ARM32 && defined __ARM_PCS_VFP)
+ using AtomicCounter = std::atomic<std::make_unsigned_t<std::sig_atomic_t>>;
+ static_assert(AtomicCounter::is_always_lock_free);
+#else
+ using AtomicCounter = volatile std::make_unsigned_t<std::sig_atomic_t>;
+#endif
+
+ /// how many times have we entered a zone
+ static inline AtomicCounter gnEnterCount = 0;
+ /// how many times have we left a new zone
+ static inline AtomicCounter gnLeaveCount = 0;
+
+public:
+ CrashZone() { enter(); }
+ ~CrashZone() { leave(); }
+ static bool isInZone() { return gnEnterCount != gnLeaveCount; }
+ static const AtomicCounter& enterCount() { return gnEnterCount; }
+ // prefer creating instances to manually calling enter()/leave()
+ static void enter() { gnEnterCount++; }
+ static void leave() { gnLeaveCount++; }
+ // these should be implemented for each specific zone if needed
+ // static void hardDisable();
+ // static const CrashWatchdogTimingsValues& getCrashWatchdogTimingsValues();
+ // static void checkDebug(int nUnchanged, const CrashWatchdogTimingsValues& aTimingValues);
+ // static const char* name();
+};
+
+#endif // INCLUDED_COMPHELPER_CRASHZONE_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/debuggerinfo.hxx b/include/comphelper/debuggerinfo.hxx
new file mode 100644
index 000000000..8c4c0a4cb
--- /dev/null
+++ b/include/comphelper/debuggerinfo.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_DEBUGINFO_HXX
+#define INCLUDED_COMPHELPER_DEBUGINFO_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+namespace comphelper
+{
+#if defined DBG_UTIL
+/// Returns true if the process is running with a debugger attached.
+///
+/// This is useful to disable watchdogs or increase timeouts if they trigger
+/// too soon while using a debugger.
+COMPHELPER_DLLPUBLIC bool isDebuggerAttached();
+#endif
+
+// For detecting whether Valgrind is used, add valgrind to gb_Library_use_externals
+// and then in code use:
+// #if defined HAVE_VALGRIND_HEADERS
+// #include <valgrind/memcheck.h>
+// #endif
+// ...
+// #if defined HAVE_VALGRIND_HEADERS
+// if( RUNNING_ON_VALGRIND )
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_DEBUGINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/dispatchcommand.hxx b/include/comphelper/dispatchcommand.hxx
new file mode 100644
index 000000000..384536952
--- /dev/null
+++ b/include/comphelper/dispatchcommand.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_DISPATCHCOMMAND_HXX
+#define INCLUDED_COMPHELPER_DISPATCHCOMMAND_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::frame { class XDispatchResultListener; class XFrame; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+
+namespace comphelper
+{
+
+/** Dispatch the given UNO command in the active frame.
+
+ @param rCommand the command to dispatch, like ".uno:Bold".
+
+ @return true on success.
+*/
+COMPHELPER_DLLPUBLIC bool dispatchCommand(const OUString& rCommand,
+ const css::uno::Sequence<css::beans::PropertyValue>& rArguments,
+ const css::uno::Reference<css::frame::XDispatchResultListener>& rListener = css::uno::Reference<css::frame::XDispatchResultListener>());
+
+COMPHELPER_DLLPUBLIC bool dispatchCommand(const OUString& rCommand,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ const css::uno::Sequence<css::beans::PropertyValue>& rArguments,
+ const css::uno::Reference<css::frame::XDispatchResultListener>& rListener = css::uno::Reference<css::frame::XDispatchResultListener>());
+
+}
+
+#endif // INCLUDED_COMPHELPER_DISPATCHCOMMAND_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/docpasswordhelper.hxx b/include/comphelper/docpasswordhelper.hxx
new file mode 100644
index 000000000..64d7ba978
--- /dev/null
+++ b/include/comphelper/docpasswordhelper.hxx
@@ -0,0 +1,447 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_DOCPASSWORDHELPER_HXX
+#define INCLUDED_COMPHELPER_DOCPASSWORDHELPER_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <string_view>
+#include <vector>
+#include <comphelper/docpasswordrequest.hxx>
+#include <comphelper/hash.hxx>
+
+namespace com::sun::star::task { class XInteractionHandler; }
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::beans { struct NamedValue; }
+
+namespace comphelper {
+
+enum class DocPasswordVerifierResult
+{
+ OK,
+ WrongPassword,
+ Abort
+};
+
+
+/** Base class for a password verifier used by the DocPasswordHelper class
+ below.
+
+ Users have to implement the virtual functions and pass an instance of the
+ verifier to one of the password request functions.
+ */
+class COMPHELPER_DLLPUBLIC IDocPasswordVerifier
+{
+public:
+ virtual ~IDocPasswordVerifier();
+
+ /** Will be called every time a password needs to be verified.
+
+ @param rPassword
+ The password to be verified
+
+ @param o_rEncryptionData
+ Output parameter, that is filled with the EncryptionData generated
+ from the password. The data is filled only if the validation was
+ successful.
+
+ @return The result of the verification.
+ - DocPasswordVerifierResult_OK, if and only if the passed password
+ is valid and can be used to process the related document.
+ - DocPasswordVerifierResult_WRONG_PASSWORD, if the password is
+ wrong. The user may be asked again for a new password.
+ - DocPasswordVerifierResult_ABORT, if an unrecoverable error
+ occurred while password verification. The password request loop
+ will be aborted.
+ */
+ virtual DocPasswordVerifierResult verifyPassword( const OUString& rPassword, css::uno::Sequence< css::beans::NamedValue >& o_rEncryptionData ) = 0;
+
+ /** Will be called every time an encryption data needs to be verified.
+
+ @param rEncryptionData
+ The data will be validated
+
+ @return The result of the verification.
+ - DocPasswordVerifierResult_OK, if and only if the passed encryption data
+ is valid and can be used to process the related document.
+ - DocPasswordVerifierResult_WRONG_PASSWORD, if the encryption data is
+ wrong.
+ - DocPasswordVerifierResult_ABORT, if an unrecoverable error
+ occurred while data verification. The password request loop
+ will be aborted.
+ */
+ virtual DocPasswordVerifierResult verifyEncryptionData( const css::uno::Sequence< css::beans::NamedValue >& o_rEncryptionData ) = 0;
+
+};
+
+
+/** Helper that asks for a document password and checks its validity.
+ */
+class COMPHELPER_DLLPUBLIC DocPasswordHelper
+{
+public:
+
+
+ /** This helper function generates the information related
+ to "Password to modify" provided by user. The result
+ sequence contains the hash and the algorithm-related
+ info.
+
+ @param aString
+ The string for which the info should be generated
+
+ @return
+ The sequence containing the hash and the algorithm-related info
+ */
+
+ static css::uno::Sequence< css::beans::PropertyValue >
+ GenerateNewModifyPasswordInfo( std::u16string_view aPassword );
+
+ /** This helper function converts a grab-bagged password, e.g. the
+ trackChanges password which has no complete inner equivalent to
+ the inner format. The result sequence contains the hash and the
+ algorithm-related info to use e.g. in IsModifyPasswordCorrect().
+
+ @param aInfo
+ The sequence containing the hash and the algorithm-related info
+ according to the OOXML origin, used by grab-bagging.
+
+ @return
+ The sequence containing the hash and the algorithm-related info
+ in the inner format.
+ */
+
+ static css::uno::Sequence< css::beans::PropertyValue > ConvertPasswordInfo(
+ const css::uno::Sequence< css::beans::PropertyValue >& aInfo );
+
+ static css::uno::Sequence<css::beans::PropertyValue>
+ GenerateNewModifyPasswordInfoOOXML(std::u16string_view aPassword);
+
+ /** This helper function allows to check whether
+ the "Password to modify" provided by user is the correct one.
+
+ @param aString
+ The string containing the provided password
+
+ @param aInfo
+ The sequence containing the hash and the algorithm-info
+
+ @return
+ <TRUE/> if the password is correct one
+ <FALSE/> otherwise
+ */
+
+ static bool IsModifyPasswordCorrect(
+ std::u16string_view aPassword,
+ const css::uno::Sequence< css::beans::PropertyValue >& aInfo );
+
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" feature of Word.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @return
+ The hash represented by sal_uInt32
+ */
+
+ static sal_uInt32 GetWordHashAsUINT32( std::u16string_view aString );
+
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" and passwords related to
+ table protection of Excel.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @param nEnc
+ The encoding that should be used to generate the 8-bit string
+ before the hash is generated
+
+ @return
+ The hash represented by sal_uInt16
+ */
+
+ static sal_uInt16 GetXLHashAsUINT16(
+ std::u16string_view aString,
+ rtl_TextEncoding nEnc = RTL_TEXTENCODING_UTF8 );
+
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" and passwords related to
+ table protection.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @return
+ The hash represented by sequence of bytes in BigEndian form
+ */
+
+ static css::uno::Sequence< sal_Int8 > GetXLHashAsSequence(
+ std::u16string_view aString );
+
+
+ /** Convenience function to calculate a salted hash with iterations as
+ specified in https://msdn.microsoft.com/en-us/library/dd920692 for the
+ OOXML sheetProtection and fileSharing elements, or
+ https://msdn.microsoft.com/en-us/library/dd924776 and
+ https://msdn.microsoft.com/en-us/library/dd925430 for Standard and
+ Agile Encryption.
+
+ @param rPassword
+ UTF-16 encoded string without leading BOM character
+
+ @param rSaltValue
+ Base64 encoded salt that will be decoded and prepended to password
+ data.
+
+ @param nSpinCount
+ If >0 the number of repeated iterations.
+
+ @param eIterCount
+ If Hash::IterCount::APPEND, append iteration count as per
+ https://msdn.microsoft.com/en-us/library/dd920692
+ If Hash::IterCount::PREPEND, prepend iteration count as per
+ https://msdn.microsoft.com/en-us/library/dd924776 and
+ https://msdn.microsoft.com/en-us/library/dd925430
+ If Hash::IterCount::NONE, do not add the iteration count to hash
+ iterations.
+
+ @param rAlgorithmName
+ One of "SHA-512", "SHA-256", ... as listed for AlgorithmName in
+ https://msdn.microsoft.com/en-us/library/dd920692
+ or "SHA512", "SHA256", ... as listed for HashAlgorithm in
+ https://msdn.microsoft.com/en-us/library/dd925810
+ that have a valid match in comphelper::HashType. If not, an
+ empty sequence is returned. Not all algorithm names are
+ supported.
+
+ @return the raw hash value as sal_Int8 sequence.
+ */
+ static css::uno::Sequence<sal_Int8> GetOoxHashAsSequence(
+ const OUString& rPassword,
+ std::u16string_view rSaltValue,
+ sal_uInt32 nSpinCount,
+ comphelper::Hash::IterCount eIterCount,
+ std::u16string_view rAlgorithmName);
+
+
+ /** Convenience function to calculate a salted hash with iterations as
+ specified in https://msdn.microsoft.com/en-us/library/dd920692 for the
+ OOXML sheetProtection and fileSharing elements, or
+ https://msdn.microsoft.com/en-us/library/dd924776 and
+ https://msdn.microsoft.com/en-us/library/dd925430 for Standard and
+ Agile Encryption.
+
+ @param rPassword
+ UTF-16 encoded string without leading BOM character
+
+ @param rSaltValue
+ Base64 encoded salt that will be decoded and prepended to password
+ data.
+
+ @param nSpinCount
+ If >0 the number of repeated iterations.
+
+ @param eIterCount
+ If Hash::IterCount::APPEND, append iteration count as per
+ https://msdn.microsoft.com/en-us/library/dd920692
+ If Hash::IterCount::PREPEND, prepend iteration count as per
+ https://msdn.microsoft.com/en-us/library/dd924776 and
+ https://msdn.microsoft.com/en-us/library/dd925430
+ If Hash::IterCount::NONE, do not add the iteration count to hash
+ iterations.
+
+ @param rAlgorithmName
+ One of "SHA-512", "SHA-256", ... as listed for AlgorithmName in
+ https://msdn.microsoft.com/en-us/library/dd920692
+ or "SHA512", "SHA256", ... as listed for HashAlgorithm in
+ https://msdn.microsoft.com/en-us/library/dd925810
+ that have a valid match in comphelper::HashType. If not, an
+ empty sequence is returned. Not all algorithm names are
+ supported.
+
+ @return the base64 encoded string of the hash value, that can be
+ compared against a stored base64 encoded hash value.
+ */
+ static OUString GetOoxHashAsBase64(
+ const OUString& rPassword,
+ std::u16string_view rSaltValue,
+ sal_uInt32 nSpinCount,
+ comphelper::Hash::IterCount eIterCount,
+ std::u16string_view rAlgorithmName);
+
+
+ /** Convenience function to calculate a salted hash with iterations as
+ specified in https://msdn.microsoft.com/en-us/library/dd920692 for the
+ OOXML sheetProtection and fileSharing elements, or
+ https://msdn.microsoft.com/en-us/library/dd924776 and
+ https://msdn.microsoft.com/en-us/library/dd925430 for Standard and
+ Agile Encryption.
+
+ @param rPassword
+ UTF-16 encoded string without leading BOM character
+
+ @param rSaltValue
+ A raw salt that will be prepended to password data.
+
+ @param nSpinCount
+ If >0 the number of repeated iterations.
+
+ @param eIterCount
+ If Hash::IterCount::APPEND, append iteration count as per
+ https://msdn.microsoft.com/en-us/library/dd920692
+ If Hash::IterCount::PREPEND, prepend iteration count as per
+ https://msdn.microsoft.com/en-us/library/dd924776 and
+ https://msdn.microsoft.com/en-us/library/dd925430
+ If Hash::IterCount::NONE, do not add the iteration count to hash
+ iterations.
+
+ @param rAlgorithmName
+ One of "SHA-512", "SHA-256", ... as listed for AlgorithmName in
+ https://msdn.microsoft.com/en-us/library/dd920692
+ or "SHA512", "SHA256", ... as listed for HashAlgorithm in
+ https://msdn.microsoft.com/en-us/library/dd925810
+ that have a valid match in comphelper::HashType. If not, an
+ empty sequence is returned. Not all algorithm names are
+ supported.
+
+ @return the raw the hash value.
+ */
+ static std::vector<unsigned char> GetOoxHashAsVector(
+ const OUString& rPassword,
+ const std::vector<unsigned char>& rSaltValue,
+ sal_uInt32 nSpinCount,
+ comphelper::Hash::IterCount eIterCount,
+ std::u16string_view rAlgorithmName);
+
+
+ /** This helper function generates a random sequence of bytes of
+ requested length.
+ */
+
+ static css::uno::Sequence< sal_Int8 > GenerateRandomByteSequence(
+ sal_Int32 nLength );
+
+
+ /** This helper function generates a byte sequence representing the
+ key digest value used by MSCodec_Std97 codec.
+ */
+
+ static css::uno::Sequence< sal_Int8 > GenerateStd97Key(
+ std::u16string_view aPassword,
+ const css::uno::Sequence< sal_Int8 >& aDocId );
+
+
+ /** This helper function generates a byte sequence representing the
+ key digest value used by MSCodec_Std97 codec.
+ */
+
+ static css::uno::Sequence< sal_Int8 > GenerateStd97Key(
+ const sal_uInt16 pPassData[16],
+ const css::uno::Sequence< sal_Int8 >& aDocId );
+
+ /** This helper function generates a byte sequence representing the
+ key digest value used by MSCodec_Std97 codec.
+ */
+
+ static css::uno::Sequence< sal_Int8 > GenerateStd97Key(
+ const sal_uInt16 pPassData[16],
+ const sal_uInt8 pDocId[16] );
+
+
+ /** This helper function tries to request and verify a password to load a
+ protected document.
+
+ First, the list of default passwords will be tried if provided. This is
+ needed by import filters for external file formats that have to check a
+ predefined password in some cases without asking the user for a
+ password. Every password is checked using the passed password verifier.
+
+ If not successful, the passed password of a medium is tried, that has
+ been set e.g. by an API call to load a document. If existing, the
+ password is checked using the passed password verifier.
+
+ If still not successful, the passed interaction handler is used to
+ request a password from the user. This will be repeated until the
+ passed password verifier validates the entered password, or if the user
+ chooses to cancel password input.
+
+ @param rVerifier
+ The password verifier used to check every processed password.
+
+ @param rMediaPassword
+ If not empty, will be passed to the password validator before
+ requesting a password from the user. This password usually should
+ be querried from a media descriptor.
+
+ @param rxInteractHandler
+ The interaction handler that will be used to request a password
+ from the user, e.g. by showing a password input dialog.
+
+ @param rDocumentUrl
+ The URL of the related document that will be shown in the password
+ input dialog.
+
+ @param eRequestType
+ The password request type that will be passed to the
+ DocPasswordRequest object created internally. See
+ docpasswordrequest.hxx for more details.
+
+ @param pDefaultPasswords
+ If not null, contains default passwords that will be tried before a
+ password will be requested from the media descriptor or the user.
+
+ @param pbIsDefaultPassword
+ (output parameter) If not null, the type of the found password will
+ be returned. True means the password has been found in the passed
+ list of default passwords. False means the password has been taken
+ from the rMediaPassword parameter or has been entered by the user.
+
+ @return
+ If not empty, contains the password that has been validated by the
+ passed password verifier. If empty, no valid password has been
+ found, or the user has chosen to cancel password input.
+ */
+ static css::uno::Sequence< css::beans::NamedValue > requestAndVerifyDocPassword(
+ IDocPasswordVerifier& rVerifier,
+ const css::uno::Sequence< css::beans::NamedValue >& rMediaEncData,
+ const OUString& rMediaPassword,
+ const css::uno::Reference< css::task::XInteractionHandler >& rxInteractHandler,
+ const OUString& rDocumentUrl,
+ DocPasswordRequestType eRequestType,
+ const ::std::vector< OUString >* pDefaultPasswords = nullptr,
+ bool* pbIsDefaultPassword = nullptr );
+
+ static css::uno::Sequence< css::beans::NamedValue > decryptGpgSession(
+ const css::uno::Sequence< css::uno::Sequence< css::beans::NamedValue > >& rGpgProperties);
+
+private:
+ ~DocPasswordHelper();
+};
+
+
+} // namespace comphelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/docpasswordrequest.hxx b/include/comphelper/docpasswordrequest.hxx
new file mode 100644
index 000000000..a4e8704eb
--- /dev/null
+++ b/include/comphelper/docpasswordrequest.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_DOCPASSWORDREQUEST_HXX
+#define INCLUDED_COMPHELPER_DOCPASSWORDREQUEST_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <com/sun/star/task/PasswordRequestMode.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
+
+namespace com::sun::star::task { class XInteractionAbort; }
+
+namespace comphelper {
+
+class PasswordContinuation;
+
+
+/** Selects which UNO document password request type to use. */
+enum class DocPasswordRequestType
+{
+ Standard, /// Uses the standard com.sun.star.task.DocumentPasswordRequest request.
+ MS /// Uses the com.sun.star.task.DocumentMSPasswordRequest request.
+};
+
+
+class COMPHELPER_DLLPUBLIC SimplePasswordRequest final :
+ public cppu::WeakImplHelper<css::task::XInteractionRequest>
+{
+public:
+ explicit SimplePasswordRequest();
+ virtual ~SimplePasswordRequest() override;
+
+ bool isPassword() const;
+
+ OUString getPassword() const;
+
+private:
+ SimplePasswordRequest(SimplePasswordRequest const&) = delete;
+ SimplePasswordRequest& operator=(SimplePasswordRequest const&) = delete;
+
+ // XInteractionRequest
+ virtual css::uno::Any SAL_CALL getRequest() override;
+ virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL getContinuations() override;
+
+private:
+ css::uno::Any maRequest;
+ css::uno::Reference<css::task::XInteractionAbort> mxAbort;
+ rtl::Reference<PasswordContinuation> mxPassword;
+};
+
+
+/** Implements the task.XInteractionRequest interface for requesting a password
+ string for a document.
+ */
+class COMPHELPER_DLLPUBLIC DocPasswordRequest final :
+ public cppu::WeakImplHelper<css::task::XInteractionRequest>
+{
+public:
+ explicit DocPasswordRequest(
+ DocPasswordRequestType eType,
+ css::task::PasswordRequestMode eMode,
+ const OUString& rDocumentUrl,
+ bool bPasswordToModify = false );
+ virtual ~DocPasswordRequest() override;
+
+ bool isPassword() const;
+
+ OUString getPassword() const;
+
+ OUString getPasswordToModify() const;
+ bool getRecommendReadOnly() const;
+
+private:
+ DocPasswordRequest(DocPasswordRequest const&) = delete;
+ DocPasswordRequest& operator=(DocPasswordRequest const&) = delete;
+
+ // XInteractionRequest
+ virtual css::uno::Any SAL_CALL getRequest() override;
+ virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL getContinuations() override;
+
+private:
+ css::uno::Any maRequest;
+ css::uno::Reference<css::task::XInteractionAbort> mxAbort;
+ rtl::Reference<PasswordContinuation> mxPassword;
+};
+
+
+} // namespace comphelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/documentconstants.hxx b/include/comphelper/documentconstants.hxx
new file mode 100644
index 000000000..aafa84e75
--- /dev/null
+++ b/include/comphelper/documentconstants.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_DOCUMENTCONSTANTS_HXX
+#define INCLUDED_COMPHELPER_DOCUMENTCONSTANTS_HXX
+
+#include <o3tl/typed_flags_set.hxx>
+#include <rtl/ustring.hxx>
+
+// formats of SO6/7
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_WRITER_ASCII = u"application/vnd.sun.xml.writer";
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_WRITER_WEB_ASCII = u"application/vnd.sun.xml.writer.web";
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII = u"application/vnd.sun.xml.writer.global";
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_DRAW_ASCII = u"application/vnd.sun.xml.draw";
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_IMPRESS_ASCII = u"application/vnd.sun.xml.impress";
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_CALC_ASCII = u"application/vnd.sun.xml.calc";
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_CHART_ASCII = u"application/vnd.sun.xml.chart";
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_MATH_ASCII = u"application/vnd.sun.xml.math";
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_BASE_ASCII = u"application/vnd.sun.xml.base";
+
+// template formats of SO6/7
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII = u"application/vnd.sun.xml.writer.template";
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII = u"application/vnd.sun.xml.draw.template";
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII = u"application/vnd.sun.xml.impress.template";
+inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII = u"application/vnd.sun.xml.calc.template";
+
+// formats of SO8
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII = u"application/vnd.oasis.opendocument.text";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII = u"application/vnd.oasis.opendocument.text-web";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII = u"application/vnd.oasis.opendocument.text-master";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII = u"application/vnd.oasis.opendocument.graphics";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII = u"application/vnd.oasis.opendocument.presentation";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII = u"application/vnd.oasis.opendocument.spreadsheet";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII = u"application/vnd.oasis.opendocument.chart";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII = u"application/vnd.oasis.opendocument.formula";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII = u"application/vnd.oasis.opendocument.base";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII = u"application/vnd.sun.xml.report";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART_ASCII = u"application/vnd.sun.xml.report.chart";
+
+// template formats of SO8
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.text-template";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.text-master-template";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.graphics-template";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.presentation-template";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.spreadsheet-template";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.chart-template";
+inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.formula-template";
+
+
+// ODF versions
+inline constexpr OUStringLiteral ODFVER_010_TEXT = u"1.0";
+inline constexpr OUStringLiteral ODFVER_011_TEXT = u"1.1";
+inline constexpr OUStringLiteral ODFVER_012_TEXT = u"1.2";
+inline constexpr OUStringLiteral ODFVER_013_TEXT = u"1.3";
+
+// filter flags
+// TODO/LATER: The flags should be part of the UNO specification
+//
+// http://www.mail-archive.com/dev@openoffice.org/msg05047.html says:
+//
+// I can just sum up what comes into my mind, hope I don't miss one:
+//
+// Import - should be self explaining
+// Export - should be self explaining
+// Template - deprecated
+// TemplatePath - filter for a documenttemplate
+// Own - one of the OOo file formats
+// Alien - no zip container based format
+// Preferred - preferred filter for a particular type
+// 3rdPartyFilter - implemented as a UNO component
+// Default - default filter for this document type
+// Exotic - an unusual/legacy file-format, we don't normally see
+//
+// (The 3rdPartyFilter flag is here called StarONE)
+//
+enum class SfxFilterFlags
+{
+ NONE = 0,
+ IMPORT = 0x00000001,
+ EXPORT = 0x00000002,
+ TEMPLATE = 0x00000004,
+ INTERNAL = 0x00000008,
+ TEMPLATEPATH = 0x00000010,
+ OWN = 0x00000020,
+ ALIEN = 0x00000040,
+
+ DEFAULT = 0x00000100,
+ SUPPORTSSELECTION = 0x00000400,
+ NOTINFILEDLG = 0x00001000,
+
+ OPENREADONLY = 0x00010000,
+ MUSTINSTALL = 0x00020000,
+ CONSULTSERVICE = 0x00040000,
+ STARONEFILTER = 0x00080000,
+ PACKED = 0x00100000,
+ EXOTIC = 0x00200000,
+ COMBINED = 0x00800000,
+
+ ENCRYPTION = 0x01000000,
+ PASSWORDTOMODIFY = 0x02000000,
+ GPGENCRYPTION = 0x04000000,
+ PREFERED = 0x10000000,
+ STARTPRESENTATION = 0x20000000,
+ SUPPORTSSIGNING = 0x40000000,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<SfxFilterFlags> : is_typed_flags<SfxFilterFlags, 0x77bf157f> {};
+}
+
+#define SFX_FILTER_NOTINSTALLED (SfxFilterFlags::MUSTINSTALL | SfxFilterFlags::CONSULTSERVICE)
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/documentinfo.hxx b/include/comphelper/documentinfo.hxx
new file mode 100644
index 000000000..a7002120a
--- /dev/null
+++ b/include/comphelper/documentinfo.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_DOCUMENTINFO_HXX
+#define INCLUDED_COMPHELPER_DOCUMENTINFO_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+
+
+namespace comphelper {
+
+
+ //= DocumentInfo
+
+ namespace DocumentInfo
+ {
+ /** retrieves the UI title of the given document
+ */
+ COMPHELPER_DLLPUBLIC OUString getDocumentTitle( const css::uno::Reference< css::frame::XModel >& _rxDocument );
+
+ /** notify that this document contains a macro event handler
+ */
+ COMPHELPER_DLLPUBLIC void notifyMacroEventRead( const css::uno::Reference< css::frame::XModel >& _rxDocument );
+ }
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_DOCUMENTINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/doublecheckedinit.hxx b/include/comphelper/doublecheckedinit.hxx
new file mode 100644
index 000000000..200a9c88c
--- /dev/null
+++ b/include/comphelper/doublecheckedinit.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_DOUBLECHECKEDINIT_HXX
+#define INCLUDED_COMPHELPER_DOUBLECHECKEDINIT_HXX
+
+#include <osl/getglobalmutex.hxx>
+
+#include <atomic>
+// HACK: <atomic> includes <stdbool.h>, which in some Clang versions does '#define bool bool',
+// which confuses clang plugins.
+#undef bool
+#include <functional>
+
+namespace comphelper
+{
+/**
+ * Thread-safe singleton creation.
+ *
+ * It is normally sufficient to create singletons using static variables in a function.
+ * This function is only for use cases that have a more complex lifetime of the object,
+ * such as when the object may require specific cleanup or may be created more times
+ * (e.g. when there is a "singleton" per each instance of another object).
+ */
+template <typename Type, typename Function = std::function<Type*()>,
+ typename Guard = osl::MutexGuard, typename GuardCtor = osl::GetGlobalMutex>
+static inline Type* doubleCheckedInit(std::atomic<Type*>& pointer, Function function,
+ GuardCtor guardCtor = osl::GetGlobalMutex())
+{
+ Type* p = pointer.load(std::memory_order_acquire);
+ if (!p)
+ {
+ Guard guard(guardCtor());
+ p = pointer.load(std::memory_order_relaxed);
+ if (!p)
+ {
+ p = function();
+ pointer.store(p, std::memory_order_release);
+ }
+ }
+ return p;
+}
+
+} // namespace
+
+#endif // INCLUDED_COMPHELPER_DOUBLECHECKEDINIT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/embeddedobjectcontainer.hxx b/include/comphelper/embeddedobjectcontainer.hxx
new file mode 100644
index 000000000..cc040da15
--- /dev/null
+++ b/include/comphelper/embeddedobjectcontainer.hxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_EMBEDDEDOBJECTCONTAINER_HXX
+#define INCLUDED_COMPHELPER_EMBEDDEDOBJECTCONTAINER_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <comphelper/comphelperdllapi.h>
+
+#include <rtl/ustring.hxx>
+#include <memory>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::embed { class XEmbeddedObject; }
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::task { class XInteractionHandler; }
+namespace com::sun::star::uno { class XInterface; }
+
+namespace comphelper
+{
+ class EmbeddedObjectContainer;
+ /** Helper interface to give access to some common object which replace the SfxObjectShell
+ */
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI IEmbeddedHelper
+ {
+ public:
+ virtual EmbeddedObjectContainer& getEmbeddedObjectContainer() const = 0;
+ virtual css::uno::Reference < css::embed::XStorage > getStorage() const = 0;
+ virtual css::uno::Reference< css::task::XInteractionHandler > getInteractionHandler() const = 0;
+ virtual bool isEnableSetModified() const = 0;
+ virtual OUString getDocumentBaseURL() const = 0;
+
+ protected:
+ ~IEmbeddedHelper() {}
+ };
+
+struct EmbedImpl;
+class COMPHELPER_DLLPUBLIC EmbeddedObjectContainer
+{
+ std::unique_ptr<EmbedImpl> pImpl;
+
+ css::uno::Reference < css::embed::XEmbeddedObject > Get_Impl( const OUString&,
+ const css::uno::Reference < css::embed::XEmbeddedObject >& xCopy,
+ OUString const* pBaseURL);
+
+public:
+ // add an embedded object to the container storage
+ bool StoreEmbeddedObject(
+ const css::uno::Reference<css::embed::XEmbeddedObject>& xObj, OUString& rName, bool bCopy,
+ const OUString& rSrcShellID, const OUString& rDestShellID );
+
+ // add an embedded object that has been imported from the container storage - should only be called by filters!
+ void AddEmbeddedObject( const css::uno::Reference < css::embed::XEmbeddedObject >&, const OUString& );
+
+ EmbeddedObjectContainer();
+ EmbeddedObjectContainer( const css::uno::Reference < css::embed::XStorage >& );
+ EmbeddedObjectContainer( const css::uno::Reference < css::embed::XStorage >&,
+ const css::uno::Reference < css::uno::XInterface >& );
+ ~EmbeddedObjectContainer();
+
+ void SwitchPersistence( const css::uno::Reference < css::embed::XStorage >& );
+ bool CommitImageSubStorage();
+ void ReleaseImageSubStorage();
+
+ OUString CreateUniqueObjectName();
+
+ // get a list of object names that have been added so far
+ css::uno::Sequence < OUString > GetObjectNames() const;
+
+ // check for existence of objects at all
+ bool HasEmbeddedObjects() const;
+
+ // check existence of an object - either by identity or by name
+ bool HasEmbeddedObject( const OUString& );
+ bool HasEmbeddedObject( const css::uno::Reference < css::embed::XEmbeddedObject >& ) const;
+ bool HasInstantiatedEmbeddedObject( const OUString& );
+
+ // get the object name of an object - this is the persist name if the object has persistence
+ OUString GetEmbeddedObjectName( const css::uno::Reference < css::embed::XEmbeddedObject >& ) const;
+
+ // retrieve an embedded object by name that either has been added already or is available in the container storage
+ css::uno::Reference<css::embed::XEmbeddedObject> GetEmbeddedObject(const OUString&, OUString const* pBaseURL = nullptr);
+
+ // create an object from a ClassId
+ css::uno::Reference < css::embed::XEmbeddedObject >
+ CreateEmbeddedObject( const css::uno::Sequence < sal_Int8 >&, OUString&,
+ OUString const* pBaseURL = nullptr );
+
+ css::uno::Reference < css::embed::XEmbeddedObject >
+ CreateEmbeddedObject( const css::uno::Sequence < sal_Int8 >&,
+ const css::uno::Sequence < css::beans::PropertyValue >&, OUString&,
+ OUString const* pBaseURL = nullptr );
+
+ // insert an embedded object into the container - objects persistent representation will be added to the storage
+ bool InsertEmbeddedObject( const css::uno::Reference < css::embed::XEmbeddedObject >&, OUString& );
+
+ // load an embedded object from a MediaDescriptor and insert it into the container
+ // a new object will be created from the new content and returned
+ css::uno::Reference < css::embed::XEmbeddedObject >
+ InsertEmbeddedObject( const css::uno::Sequence < css::beans::PropertyValue >&, OUString& rName, OUString const* pBaseURL = nullptr);
+
+ // create an embedded link based on a MediaDescriptor and insert it into the container
+ // a new object will be created from the new content and returned
+ css::uno::Reference < css::embed::XEmbeddedObject >
+ InsertEmbeddedLink( const css::uno::Sequence < css::beans::PropertyValue >&, OUString& );
+
+ // create an object from a stream that contains its persistent representation and insert it as usual (usually called from clipboard)
+ // a new object will be created from the new content and returned
+ css::uno::Reference < css::embed::XEmbeddedObject >
+ InsertEmbeddedObject( const css::uno::Reference < css::io::XInputStream >&, OUString& );
+
+ // copy an embedded object into the storage, open the new copy and return it
+ css::uno::Reference <css::embed::XEmbeddedObject> CopyAndGetEmbeddedObject(
+ EmbeddedObjectContainer& rSrc, const css::uno::Reference <css::embed::XEmbeddedObject>& xObj, OUString& rName,
+ const OUString& rSrcShellID, const OUString& rDestShellID );
+
+ // remove an embedded object from the container and from the storage; if object can't be closed
+ // #i119941, bKeepToTempStorage: use to specify whether store the removed object to temporary storage+
+ void RemoveEmbeddedObject( const OUString& rName, bool bKeepToTempStorage = true);
+ bool RemoveEmbeddedObject( const css::uno::Reference < css::embed::XEmbeddedObject >&, bool bKeepToTempStorage = true);
+
+ // close and remove an embedded object from the container without removing it from the storage
+ void CloseEmbeddedObject( const css::uno::Reference < css::embed::XEmbeddedObject >& );
+
+ // move an embedded object to another container (keep the persistent name)
+ bool MoveEmbeddedObject( const OUString& rName, EmbeddedObjectContainer& );
+
+ // get the stored graphical representation for the object
+ css::uno::Reference < css::io::XInputStream > GetGraphicStream( const css::uno::Reference < css::embed::XEmbeddedObject >&, OUString* pMediaType=nullptr );
+
+ // get the stored graphical representation by the object name
+ css::uno::Reference < css::io::XInputStream > GetGraphicStream( const OUString& aName, OUString* pMediaType=nullptr );
+
+ // add a graphical representation for an object
+ bool InsertGraphicStream( const css::uno::Reference < css::io::XInputStream >& rStream, const OUString& rObjectName, const OUString& rMediaType );
+
+ // try to add a graphical representation for an object in optimized way ( might fail )
+ bool InsertGraphicStreamDirectly( const css::uno::Reference < css::io::XInputStream >& rStream, const OUString& rObjectName, const OUString& rMediaType );
+
+ // remove a graphical representation for an object
+ void RemoveGraphicStream( const OUString& rObjectName );
+
+ // copy the graphical representation from different container
+ bool TryToCopyGraphReplacement( EmbeddedObjectContainer& rSrc,
+ const OUString& aOrigName,
+ const OUString& aTargetName );
+
+ void CloseEmbeddedObjects();
+ bool StoreChildren(bool _bOasisFormat,bool _bObjectsOnly);
+ bool StoreAsChildren( bool _bOasisFormat
+ ,bool _bCreateEmbedded
+ ,bool _bAutoSaveEvent
+ ,const css::uno::Reference < css::embed::XStorage >& _xStorage);
+
+ static css::uno::Reference< css::io::XInputStream > GetGraphicReplacementStream(
+ sal_Int64 nViewAspect,
+ const css::uno::Reference < css::embed::XEmbeddedObject >&,
+ OUString* pMediaType );
+
+ /** call setPersistentEntry for each embedded object in the container
+ *
+ * \param _xStorage The storage where to store the objects.
+ * \param _bClearModifiedFlag If <TRUE/> then the modified flag will be set to <FALSE/> otherwise nothing happen.
+ * \return <FALSE/> if no error occurred, otherwise <TRUE/>.
+ */
+ bool SetPersistentEntries(const css::uno::Reference< css::embed::XStorage >& _xStorage,bool _bClearModifiedFlag = true);
+
+ bool getUserAllowsLinkUpdate() const;
+ void setUserAllowsLinkUpdate(bool bNew);
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/enumhelper.hxx b/include/comphelper/enumhelper.hxx
new file mode 100644
index 000000000..fb26de489
--- /dev/null
+++ b/include/comphelper/enumhelper.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ENUMHELPER_HXX
+#define INCLUDED_COMPHELPER_ENUMHELPER_HXX
+
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <comphelper/comphelperdllapi.h>
+#include <cppuhelper/implbase.hxx>
+#include <mutex>
+#include <variant>
+#include <vector>
+
+namespace com::sun::star::container { class XIndexAccess; }
+namespace com::sun::star::container { class XNameAccess; }
+
+namespace comphelper
+{
+
+/** provides a com.sun.star.container::XEnumeration access based
+ on an object implementing the com.sun.star.container::XNameAccess interface
+*/
+class COMPHELPER_DLLPUBLIC OEnumerationByName final :
+ public ::cppu::WeakImplHelper< css::container::XEnumeration ,
+ css::lang::XEventListener >
+{
+ std::variant<css::uno::Sequence< OUString >, std::vector<OUString>> m_aNames;
+ css::uno::Reference< css::container::XNameAccess > m_xAccess;
+ sal_Int32 m_nPos;
+ bool m_bListening;
+ std::mutex m_aLock;
+
+public:
+ OEnumerationByName(const css::uno::Reference< css::container::XNameAccess > _xAccess);
+ OEnumerationByName(const css::uno::Reference< css::container::XNameAccess > _xAccess,
+ std::vector<OUString> _aNames );
+ virtual ~OEnumerationByName() override;
+
+ virtual sal_Bool SAL_CALL hasMoreElements( ) override;
+ virtual css::uno::Any SAL_CALL nextElement( ) override;
+
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override;
+
+private:
+ sal_Int32 getLength() const;
+ const OUString& getElement(sal_Int32 nIndex) const;
+ COMPHELPER_DLLPRIVATE void impl_startDisposeListening();
+ COMPHELPER_DLLPRIVATE void impl_stopDisposeListening();
+};
+
+/** provides a com.sun.star.container::XEnumeration access based
+ on an object implementing the com.sun.star.container::XNameAccess interface
+*/
+class COMPHELPER_DLLPUBLIC OEnumerationByIndex final :
+ public ::cppu::WeakImplHelper< css::container::XEnumeration ,
+ css::lang::XEventListener >
+{
+ css::uno::Reference< css::container::XIndexAccess > m_xAccess;
+ sal_Int32 m_nPos;
+ bool m_bListening;
+ std::mutex m_aLock;
+
+public:
+ OEnumerationByIndex(css::uno::Reference< css::container::XIndexAccess > _xAccess);
+ virtual ~OEnumerationByIndex() override;
+
+ virtual sal_Bool SAL_CALL hasMoreElements( ) override;
+ virtual css::uno::Any SAL_CALL nextElement( ) override;
+
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override;
+
+private:
+ COMPHELPER_DLLPRIVATE void impl_startDisposeListening();
+ COMPHELPER_DLLPRIVATE void impl_stopDisposeListening();
+};
+
+// this is the way that works for ENABLE_LTO with MSVC 2013
+class SAL_DLLPUBLIC_TEMPLATE OAnyEnumeration_BASE
+ : public ::cppu::WeakImplHelper<css::container::XEnumeration> {};
+
+/** provides a com.sun.star.container::XEnumeration
+ for an outside set vector of Any's.
+
+*/
+class COMPHELPER_DLLPUBLIC OAnyEnumeration final :
+ public OAnyEnumeration_BASE
+{
+ sal_Int32 m_nPos;
+ css::uno::Sequence< css::uno::Any > m_lItems;
+ std::mutex m_aLock;
+
+public:
+ OAnyEnumeration(const css::uno::Sequence< css::uno::Any >& lItems);
+ virtual ~OAnyEnumeration() override;
+
+ virtual sal_Bool SAL_CALL hasMoreElements( ) override;
+ virtual css::uno::Any SAL_CALL nextElement( ) override;
+
+};
+
+}
+
+#endif // INCLUDED_COMPHELPER_ENUMHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/eventattachermgr.hxx b/include/comphelper/eventattachermgr.hxx
new file mode 100644
index 000000000..4a2a99909
--- /dev/null
+++ b/include/comphelper/eventattachermgr.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_EVENTATTACHERMGR_HXX
+#define INCLUDED_COMPHELPER_EVENTATTACHERMGR_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star {
+namespace uno {
+ class XComponentContext;
+}
+namespace script {
+ class XEventAttacherManager;
+}
+}
+
+
+namespace comphelper
+{
+
+/// @throws css::uno::Exception
+COMPHELPER_DLLPUBLIC css::uno::Reference< css::script::XEventAttacherManager >
+createEventAttacherManager(
+ const css::uno::Reference< css::uno::XComponentContext > & rxContext );
+
+}
+
+#endif // INCLUDED_COMPHELPER_EVENTATTACHERMGR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/evtlistenerhlp.hxx b/include/comphelper/evtlistenerhlp.hxx
new file mode 100644
index 000000000..212d94662
--- /dev/null
+++ b/include/comphelper/evtlistenerhlp.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_EVTLISTENERHLP_HXX
+#define INCLUDED_COMPHELPER_EVTLISTENERHLP_HXX
+
+#include <config_options.h>
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <cppuhelper/weakref.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+
+namespace comphelper
+{
+
+
+ //= OCommandsListener
+ // is helper class to avoid a cycle in refcount between the XEventListener
+ // and the member XComponent
+
+ class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OEventListenerHelper final : public ::cppu::WeakImplHelper< css::lang::XEventListener >
+ {
+ css::uno::WeakReference< css::lang::XEventListener> m_xListener;
+ public:
+ OEventListenerHelper(const css::uno::Reference< css::lang::XEventListener>& _rxListener);
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+ };
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_EVTLISTENERHLP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/evtmethodhelper.hxx b/include/comphelper/evtmethodhelper.hxx
new file mode 100644
index 000000000..f420b1869
--- /dev/null
+++ b/include/comphelper/evtmethodhelper.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/Sequence.h>
+#include <comphelper/comphelperdllapi.h>
+
+namespace comphelper
+{
+COMPHELPER_DLLPUBLIC css::uno::Sequence<OUString>
+getEventMethodsForType(const css::uno::Type& type);
+
+} // namespace comphelper
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/extract.hxx b/include/comphelper/extract.hxx
new file mode 100644
index 000000000..c8ab9c6e6
--- /dev/null
+++ b/include/comphelper/extract.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_EXTRACT_HXX
+#define INCLUDED_COMPHELPER_EXTRACT_HXX
+
+#include <sal/config.h>
+
+#include <cassert>
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/uno/TypeClass.hpp>
+#include <com/sun/star/uno/Type.h>
+#include <com/sun/star/uno/Any.hxx>
+
+namespace cppu
+{
+/**
+ * Sets enum from int32 value. This function does NOT check for valid enum values!
+ *
+ * @param nEnum int32 enum value
+ * @param rType enum type
+ * @return enum or empty any.
+ */
+inline css::uno::Any int2enum(sal_Int32 nEnum, const css::uno::Type& rType)
+{
+ assert(rType.getTypeClass() == css::uno::TypeClass_ENUM);
+ return css::uno::Any(&nEnum, rType);
+}
+
+/**
+ * Sets int32 from enum or int in any.
+ *
+ * @param[out] rnEnum int32 enum value
+ * @param rAny enum or int
+ * @retval true if enum or int value was set
+ * @retval false otherwise
+ */
+inline bool enum2int(sal_Int32& rnEnum, const css::uno::Any& rAny)
+{
+ if (rAny.getValueTypeClass() == css::uno::TypeClass_ENUM)
+ {
+ rnEnum = *static_cast<const sal_Int32*>(rAny.getValue());
+ return true;
+ }
+
+ return rAny >>= rnEnum;
+}
+
+/**
+ * Sets int32 from enum or int in any with additional typecheck
+ *
+ * @param[out] eRet the enum value as int. If there is no enum of the given type
+ * a css::lang::IllegalArgumentException is thrown
+ * @param rAny enum or int
+ * @throws css::lang::IllegalArgumentException
+ */
+template <typename E> inline void any2enum(E& eRet, const css::uno::Any& rAny)
+{
+ // check for typesafe enum
+ if (!(rAny >>= eRet))
+ {
+ // if not enum, maybe integer?
+ sal_Int32 nValue = 0;
+ if (!(rAny >>= nValue))
+ throw css::lang::IllegalArgumentException();
+
+ eRet = static_cast<E>(nValue);
+ }
+}
+
+/**
+ * Extracts a boolean either as a bool or an integer from
+ * an any. If there is no bool or integer inside the any
+ * a css::lang::IllegalArgumentException is thrown
+ *
+ * @throws css::lang::IllegalArgumentException
+ */
+inline bool any2bool(const css::uno::Any& rAny)
+{
+ bool b;
+ if (rAny >>= b)
+ {
+ return b;
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if (!(rAny >>= nValue))
+ throw css::lang::IllegalArgumentException();
+ return nValue != 0;
+ }
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/fileformat.h b/include/comphelper/fileformat.h
new file mode 100644
index 000000000..7eabf5829
--- /dev/null
+++ b/include/comphelper/fileformat.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_FILEFORMAT_H
+#define INCLUDED_COMPHELPER_FILEFORMAT_H
+
+/* file format versions *************************************************/
+
+#define SOFFICE_FILEFORMAT_31 3450
+#define SOFFICE_FILEFORMAT_40 3580
+#define SOFFICE_FILEFORMAT_50 5050
+#define SOFFICE_FILEFORMAT_60 6200
+#define SOFFICE_FILEFORMAT_8 6800
+#define SOFFICE_FILEFORMAT_CURRENT SOFFICE_FILEFORMAT_8
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/fileurl.hxx b/include/comphelper/fileurl.hxx
new file mode 100644
index 000000000..27ac6b576
--- /dev/null
+++ b/include/comphelper/fileurl.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_FILEURL_HXX
+#define INCLUDED_COMPHELPER_FILEURL_HXX
+
+#include <sal/config.h>
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace comphelper
+{
+// Return true iff url is an absolute URL of "file" scheme:
+COMPHELPER_DLLPUBLIC bool isFileUrl(OUString const& url);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/flagguard.hxx b/include/comphelper/flagguard.hxx
new file mode 100644
index 000000000..14eee07a8
--- /dev/null
+++ b/include/comphelper/flagguard.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_FLAGGUARD_HXX
+#define INCLUDED_COMPHELPER_FLAGGUARD_HXX
+
+#include <comphelper/scopeguard.hxx>
+#include <utility>
+
+namespace comphelper
+{
+
+ //= ValueRestorationGuard
+
+ // note: can't store the originalValue in a ValueRestorationGuard member,
+ // because it will be used from base class dtor
+ template <typename T> struct ValueRestorationGuard_Impl
+ {
+ T& rVal;
+ T const originalValue;
+ ValueRestorationGuard_Impl(T& i_valRef)
+ : rVal(i_valRef), originalValue(i_valRef) {}
+ void operator()()
+ {
+ rVal = originalValue;
+ }
+ };
+
+ template <typename T>
+ class ValueRestorationGuard : public ScopeGuard<ValueRestorationGuard_Impl<T>>
+ {
+ public:
+ template <typename T1>
+ ValueRestorationGuard(T& i_valRef, T1&& i_temporaryValue)
+ : ScopeGuard<ValueRestorationGuard_Impl<T>>(ValueRestorationGuard_Impl(i_valRef))
+ {
+ i_valRef = std::forward<T1>(i_temporaryValue);
+ }
+ };
+
+ typedef ValueRestorationGuard<bool> FlagRestorationGuard;
+
+ //= FlagGuard
+
+ // Guarantees that the flag is true within the scope of the guard, and is set to false after
+ // its destruction, regardless of initial flag value
+ class FlagGuard : public FlagRestorationGuard
+ {
+ public:
+ // Set flag to false before passing its reference to base class ctor, so that it would be
+ // reset back to false in base class dtor
+ explicit FlagGuard(bool& i_flagRef)
+ : FlagRestorationGuard((i_flagRef = false), true)
+ {
+ }
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_FLAGGUARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/genericpropertyset.hxx b/include/comphelper/genericpropertyset.hxx
new file mode 100644
index 000000000..2450ef047
--- /dev/null
+++ b/include/comphelper/genericpropertyset.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_GENERICPROPERTYSET_HXX
+#define INCLUDED_COMPHELPER_GENERICPROPERTYSET_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::beans
+{
+class XPropertySet;
+}
+namespace comphelper
+{
+class PropertySetInfo;
+}
+
+namespace comphelper
+{
+COMPHELPER_DLLPUBLIC css::uno::Reference<css::beans::XPropertySet>
+GenericPropertySet_CreateInstance(PropertySetInfo* pInfo);
+}
+
+#endif // INCLUDED_COMPHELPER_GENERICPROPERTYSET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/getexpandeduri.hxx b/include/comphelper/getexpandeduri.hxx
new file mode 100644
index 000000000..5b75c43d4
--- /dev/null
+++ b/include/comphelper/getexpandeduri.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_GETEXPANDEDURI_HXX
+#define INCLUDED_COMPHELPER_GETEXPANDEDURI_HXX
+
+#include <sal/config.h>
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::uno
+{
+class XComponentContext;
+}
+namespace com::sun::star::uno
+{
+template <typename> class Reference;
+}
+
+namespace comphelper
+{
+/**
+ A helper function to expand vnd.sun.star.expand URLs.
+
+ If the given URI is a vnd.sun.star.expand URL, it is expanded (using the
+ given component context's com.sun.star.util.theMacroExpander); otherwise it
+ is returned unchanged.
+*/
+COMPHELPER_DLLPUBLIC OUString getExpandedUri(
+ css::uno::Reference<css::uno::XComponentContext> const& context, OUString const& uri);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/graphicmimetype.hxx b/include/comphelper/graphicmimetype.hxx
new file mode 100644
index 000000000..94a3cd3cd
--- /dev/null
+++ b/include/comphelper/graphicmimetype.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_GMH_HXX
+#define INCLUDED_COMPHELPER_GMH_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustring.hxx>
+#include <vcl/salctype.hxx>
+
+#include <com/sun/star/uno/Reference.h>
+
+namespace com::sun::star::graphic
+{
+class XGraphic;
+}
+namespace com::sun::star::io
+{
+class XInputStream;
+}
+
+namespace comphelper
+{
+class COMPHELPER_DLLPUBLIC GraphicMimeTypeHelper
+{
+public:
+ static OUString GetMimeTypeForExtension(std::string_view rExt);
+ static OUString
+ GetMimeTypeForXGraphic(const css::uno::Reference<css::graphic::XGraphic>& xGraphic);
+ static OUString
+ GetMimeTypeForImageStream(const css::uno::Reference<css::io::XInputStream>& xInputStream);
+ static OUString GetMimeTypeForConvertDataFormat(ConvertDataFormat convertDataFormat);
+ static char const* GetExtensionForConvertDataFormat(ConvertDataFormat nFormat);
+};
+}
+
+#endif // INCLUDED_COMPHELPER_GMH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/guarding.hxx b/include/comphelper/guarding.hxx
new file mode 100644
index 000000000..3bbf4ac71
--- /dev/null
+++ b/include/comphelper/guarding.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_GUARDING_HXX
+#define INCLUDED_COMPHELPER_GUARDING_HXX
+
+namespace osl { class Mutex; }
+
+
+namespace comphelper
+{
+
+
+// = class MutexRelease -
+
+
+/** opposite of OGuard :)
+ (a mutex is released within the constructor and acquired within the destructor)
+ use only when you're sure the mutex is acquired !
+*/
+template <class MUTEX>
+class ORelease
+{
+ MUTEX& m_rMutex;
+
+public:
+ ORelease(MUTEX& _rMutex) : m_rMutex(_rMutex) { _rMutex.release(); }
+ ~ORelease() { m_rMutex.acquire(); }
+};
+
+typedef ORelease< ::osl::Mutex > MutexRelease;
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_GUARDING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/hash.hxx b/include/comphelper/hash.hxx
new file mode 100644
index 000000000..54ab3a251
--- /dev/null
+++ b/include/comphelper/hash.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_HASH_HXX
+#define INCLUDED_COMPHELPER_HASH_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/digest.h>
+
+#include <memory>
+#include <vector>
+
+namespace rtl {
+ class OUString;
+}
+
+namespace comphelper {
+
+enum class HashType
+{
+ MD5,
+ SHA1,
+ SHA256,
+ SHA512
+};
+
+const sal_uInt32 MD5_HASH_LENGTH = RTL_DIGEST_LENGTH_MD5;
+const sal_uInt32 SHA1_HASH_LENGTH = RTL_DIGEST_LENGTH_SHA1;
+const sal_uInt32 SHA256_HASH_LENGTH = 32;
+const sal_uInt32 SHA512_HASH_LENGTH = 64;
+
+struct HashImpl;
+
+class COMPHELPER_DLLPUBLIC Hash
+{
+private:
+ std::unique_ptr<HashImpl> mpImpl;
+
+public:
+
+ enum class IterCount
+ {
+ NONE, /// Iteration count not added to hash iterations.
+ PREPEND, /// Iteration count prepended to hash iterations.
+ APPEND /// Iteration count appended to hash iterations.
+ };
+
+ Hash(HashType eType);
+ ~Hash();
+
+ void update(const unsigned char* pInput, size_t length);
+
+ std::vector<unsigned char> finalize();
+
+ static std::vector<unsigned char> calculateHash(const unsigned char* pInput, size_t length, HashType eType);
+
+ /** Calculate hash value with salt (pSalt,nSaltLen) prepended to password
+ (pInput,nLength) and repeated iterations run if nSpinCount>0.
+
+ This implements the algorithms as specified in
+ https://msdn.microsoft.com/en-us/library/dd920692 or
+ https://msdn.microsoft.com/en-us/library/dd924776 and
+ https://msdn.microsoft.com/en-us/library/dd925430
+
+ @param pSalt
+ may be nullptr thus no salt prepended
+
+ @param nSpinCount
+ If >0, repeat nSpinCount iterations. For each iteration, the
+ previous iteration's result plus a 4 byte value (0-based,
+ little endian) containing the number of the iteration prepended
+ or appended to the hash value is the input for the next
+ iteration.
+
+ @param eIterCount
+ If IterCount::APPEND, append iteration count as per
+ https://msdn.microsoft.com/en-us/library/dd920692
+ If IterCount::PREPEND, prepend iteration count as per
+ https://msdn.microsoft.com/en-us/library/dd924776 and
+ https://msdn.microsoft.com/en-us/library/dd925430
+ If IterCount::NONE, do not add the iteration count to hash
+ iterations.
+
+ @return the raw hash value
+ */
+ static std::vector<unsigned char> calculateHash(
+ const unsigned char* pInput, size_t nLength,
+ const unsigned char* pSalt, size_t nSaltLen,
+ sal_uInt32 nSpinCount,
+ IterCount eIterCount,
+ HashType eType);
+
+ /** Convenience function to calculate a salted hash with iterations.
+
+ @param rPassword
+ UTF-16 encoded string, hashed byte-wise as unsigned char.
+
+ @param rSaltValue
+ Salt that will be prepended to password data.
+ */
+ static std::vector<unsigned char> calculateHash(
+ const rtl::OUString& rPassword,
+ const std::vector<unsigned char>& rSaltValue,
+ sal_uInt32 nSpinCount,
+ IterCount eIterCount,
+ HashType eType);
+
+ size_t getLength() const;
+};
+
+}
+
+#endif // INCLUDED_COMPHELPER_HASH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/indexedpropertyvalues.hxx b/include/comphelper/indexedpropertyvalues.hxx
new file mode 100644
index 000000000..5a5f3e8ba
--- /dev/null
+++ b/include/comphelper/indexedpropertyvalues.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <sal/config.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include <comphelper/comphelperdllapi.h>
+#include <cppuhelper/implbase.hxx>
+#include <vector>
+
+namespace comphelper
+{
+typedef std::vector<css::uno::Sequence<css::beans::PropertyValue>> IndexedPropertyValues;
+
+class COMPHELPER_DLLPUBLIC IndexedPropertyValuesContainer final
+ : public cppu::WeakImplHelper<css::container::XIndexContainer, css::lang::XServiceInfo>
+{
+public:
+ IndexedPropertyValuesContainer() noexcept;
+
+ // XIndexContainer
+ virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, const css::uno::Any& aElement) override;
+ virtual void SAL_CALL removeByIndex(sal_Int32 nIndex) override;
+
+ // XIndexReplace
+ virtual void SAL_CALL replaceByIndex(sal_Int32 nIndex, const css::uno::Any& aElement) override;
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() override;
+ virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override;
+
+ // XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType() override;
+ virtual sal_Bool SAL_CALL hasElements() override;
+
+ //XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+private:
+ IndexedPropertyValues maProperties;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/interaction.hxx b/include/comphelper/interaction.hxx
new file mode 100644
index 000000000..0f783e946
--- /dev/null
+++ b/include/comphelper/interaction.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_INTERACTION_HXX
+#define INCLUDED_COMPHELPER_INTERACTION_HXX
+
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionDisapprove.hpp>
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <comphelper/comphelperdllapi.h>
+#include <vector>
+
+
+namespace comphelper
+{
+
+
+ //= OInteraction
+
+ /** template for instantiating concrete interaction handlers<p/>
+ the template argument must be an interface derived from XInteractionContinuation
+ */
+ template <class INTERACTION>
+ class OInteraction
+ : public ::cppu::WeakImplHelper< INTERACTION >
+ {
+ public:
+ OInteraction() : m_bSelected(false) {}
+
+ /// determines whether or not this handler was selected
+ bool wasSelected() const { return m_bSelected; }
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+ private:
+ bool m_bSelected : 1; /// indicates if the select event occurred
+ };
+
+
+ template <class INTERACTION>
+ void SAL_CALL OInteraction< INTERACTION >::select( )
+ {
+ m_bSelected = true;
+ }
+
+
+ //= OInteractionApprove
+
+ typedef OInteraction< css::task::XInteractionApprove > OInteractionApprove;
+
+
+ //= OInteractionDisapprove
+
+ typedef OInteraction< css::task::XInteractionDisapprove > OInteractionDisapprove;
+
+
+ //= OInteractionAbort
+
+ typedef OInteraction< css::task::XInteractionAbort > OInteractionAbort;
+
+
+ //= OInteractionRetry
+
+ typedef OInteraction< css::task::XInteractionRetry > OInteractionRetry;
+
+
+ //= OInteractionRequest
+
+ typedef ::cppu::WeakImplHelper < css::task::XInteractionRequest
+ > OInteractionRequest_Base;
+ /** implements an interaction request (com.sun.star.task::XInteractionRequest)<p/>
+ at run time, you can freely add any interaction continuation objects
+ */
+ class COMPHELPER_DLLPUBLIC OInteractionRequest final : public OInteractionRequest_Base
+ {
+ css::uno::Any const
+ m_aRequest; /// the request we represent
+ std::vector< css::uno::Reference< css::task::XInteractionContinuation > >
+ m_aContinuations; /// all registered continuations
+
+ public:
+ OInteractionRequest(css::uno::Any aRequestDescription);
+ OInteractionRequest(css::uno::Any aRequestDescription,
+ std::vector<css::uno::Reference<css::task::XInteractionContinuation>>&& rContinuations);
+
+ /// add a new continuation
+ void addContinuation(const css::uno::Reference< css::task::XInteractionContinuation >& _rxContinuation);
+
+ // XInteractionRequest
+ virtual css::uno::Any SAL_CALL getRequest( ) override;
+ virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL getContinuations( ) override;
+ };
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_INTERACTION_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/interfacecontainer2.hxx b/include/comphelper/interfacecontainer2.hxx
new file mode 100644
index 000000000..3df7c71d4
--- /dev/null
+++ b/include/comphelper/interfacecontainer2.hxx
@@ -0,0 +1,290 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_INTERFACECONTAINER2_H
+#define INCLUDED_COMPHELPER_INTERFACECONTAINER2_H
+
+#include <sal/config.h>
+
+#include <vector>
+
+#include <com/sun/star/lang/EventObject.hpp>
+
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::uno { class XInterface; }
+namespace osl { class Mutex; }
+
+namespace comphelper
+{
+
+namespace detail {
+
+ /**
+ This is here to optimise space in the common case that there are zero or one
+ listeners.
+ */
+ union element_alias2
+ {
+ std::vector< css::uno::Reference< css::uno::XInterface > > *pAsVector;
+ css::uno::XInterface * pAsInterface;
+ element_alias2() : pAsInterface(nullptr) {}
+ };
+
+}
+
+
+class OInterfaceContainerHelper2;
+/**
+ This is the iterator of an OInterfaceContainerHelper2. Typically
+ one constructs an instance on the stack for one firing session.
+ It is not allowed to assign or copy an instance of this class.
+
+ @see OInterfaceContainerHelper2
+ */
+class COMPHELPER_DLLPUBLIC OInterfaceIteratorHelper2
+{
+public:
+ /**
+ Create an iterator over the elements of the container. The iterator
+ copies the elements of the container. A change to the container
+ during the lifetime of an iterator is allowed and does not
+ affect the iterator-instance. The iterator and the container take cares
+ themself for concurrent access, no additional guarding is necessary.
+
+ Remark: The copy is on demand. The iterator copy the elements only if the container
+ change the contents. It is not allowed to destroy the container as long
+ as an iterator exist.
+
+ @param rCont the container of the elements.
+ */
+ OInterfaceIteratorHelper2( OInterfaceContainerHelper2 & rCont );
+
+ /**
+ Releases the connection to the container.
+ */
+ ~OInterfaceIteratorHelper2();
+
+ /** Return true, if there are more elements in the iterator. */
+ bool hasMoreElements() const
+ { return nRemain != 0; }
+ /** Return the next element of the iterator. Calling this method if
+ hasMoreElements() has returned false, is an error. Cast the
+ returned pointer to the
+ */
+ css::uno::XInterface * next();
+
+ /** Removes the current element (the last one returned by next())
+ from the underlying container. Calling this method before
+ next() has been called or calling it twice with no next()
+ inbetween is an error.
+ */
+ void remove();
+
+private:
+ OInterfaceContainerHelper2 & rCont;
+ detail::element_alias2 aData;
+ sal_Int32 nRemain;
+ bool bIsList;
+
+ OInterfaceIteratorHelper2( const OInterfaceIteratorHelper2 & ) = delete;
+ OInterfaceIteratorHelper2 & operator = ( const OInterfaceIteratorHelper2 & ) = delete;
+};
+
+
+/**
+ A container of interfaces. To access the elements use an iterator.
+ This implementation is thread-safe.
+
+ This is a copy of the code at include/cppuhelper/interfacecontainer.h,
+ Except that it uses a std::vector instead of a Sequence for the mutable listener
+ list, which provides far better performance.
+
+ @see OInterfaceIteratorHelper2
+ */
+class COMPHELPER_DLLPUBLIC OInterfaceContainerHelper2
+{
+public:
+ /**
+ Create an interface container.
+
+ @param rMutex the mutex to protect multi thread access.
+ The lifetime must be longer than the lifetime
+ of this object.
+ */
+ OInterfaceContainerHelper2( ::osl::Mutex & rMutex );
+ /**
+ Release all interfaces. All iterators must be destroyed before
+ the container is destructed.
+ */
+ ~OInterfaceContainerHelper2();
+ /**
+ Return the number of Elements in the container. Only useful if you have acquired
+ the mutex.
+ */
+ sal_Int32 getLength() const;
+
+ /**
+ Return all interfaces added to this container.
+ **/
+ std::vector< css::uno::Reference< css::uno::XInterface > > getElements() const;
+
+ /** Inserts an element into the container. The position is not specified, thus it is not
+ specified in which order events are fired.
+
+ @attention
+ If you add the same interface more than once, then it will be added to the elements list
+ more than once and thus if you want to remove that interface from the list, you have to call
+ removeInterface() the same number of times.
+ In the latter case, you will also get events fired more than once (if the interface is a
+ listener interface).
+
+ @param rxIFace
+ interface to be added; it is allowed to insert null or
+ the same interface more than once
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 addInterface( const css::uno::Reference< css::uno::XInterface > & rxIFace );
+ /** Removes an element from the container. It uses interface equality to remove the interface.
+
+ @param rxIFace
+ interface to be removed
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 removeInterface( const css::uno::Reference< css::uno::XInterface > & rxIFace );
+ /** Return an interface by index */
+ css::uno::Reference< css::uno::XInterface > getInterface(sal_Int32 nIndex) const;
+ /**
+ Call disposing on all object in the container that
+ support XEventListener. Then clear the container.
+ */
+ void disposeAndClear( const css::lang::EventObject & rEvt );
+ /**
+ Clears the container without calling disposing().
+ */
+ void clear();
+
+ /** Executes a functor for each contained listener of specified type, e.g.
+ <code>forEach<awt::XPaintListener>(...</code>.
+
+ If a css::lang::DisposedException occurs which relates to
+ the called listener, then that listener is removed from the container.
+
+ @tparam ListenerT listener type
+ @tparam FuncT unary functor type, let your compiler deduce this for you
+ @param func unary functor object expecting an argument of type
+ css::uno::Reference<ListenerT>
+ */
+ template <typename ListenerT, typename FuncT>
+ inline void forEach( FuncT const& func );
+
+ /** Calls a UNO listener method for each contained listener.
+
+ The listener method must take a single argument of type EventT,
+ and return <code>void</code>.
+
+ If a css::lang::DisposedException occurs which relates to
+ the called listener, then that listener is removed from the container.
+
+ @tparam ListenerT UNO event listener type, let your compiler deduce this for you
+ @tparam EventT event type, let your compiler deduce this for you
+ @param NotificationMethod
+ Pointer to a method of a ListenerT interface.
+ @param Event
+ Event to notify to all contained listeners
+
+ Example:
+@code
+ awt::PaintEvent aEvent( static_cast< cppu::OWeakObject* >( this ), ... );
+ listeners.notifyEach( &XPaintListener::windowPaint, aEvent );
+@endcode
+ */
+ template< typename ListenerT, typename EventT >
+ inline void notifyEach( void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& ), const EventT& Event );
+
+private:
+friend class OInterfaceIteratorHelper2;
+ /**
+ bIsList == TRUE -> aData.pAsVector of type vector< XInterfaceSequence >,
+ otherwise aData.pAsInterface == of type (XEventListener *)
+ */
+ detail::element_alias2 aData;
+ ::osl::Mutex & rMutex;
+ /** TRUE -> used by an iterator. */
+ bool bInUse;
+ /** TRUE -> aData.pAsVector is of type Sequence< XInterfaceSequence >. */
+ bool bIsList;
+
+ OInterfaceContainerHelper2( const OInterfaceContainerHelper2 & ) = delete;
+ OInterfaceContainerHelper2 & operator = ( const OInterfaceContainerHelper2 & ) = delete;
+
+ /*
+ Duplicate content of the container and release the old one without destroying.
+ The mutex must be locked and the memberbInUse must be true.
+ */
+ void copyAndResetInUse();
+
+private:
+ template< typename ListenerT, typename EventT >
+ class NotifySingleListener
+ {
+ private:
+ typedef void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& );
+ NotificationMethod const m_pMethod;
+ const EventT& m_rEvent;
+ public:
+ NotifySingleListener( NotificationMethod method, const EventT& event ) : m_pMethod( method ), m_rEvent( event ) { }
+
+ void operator()( const css::uno::Reference<ListenerT>& listener ) const
+ {
+ (listener.get()->*m_pMethod)( m_rEvent );
+ }
+ };
+};
+
+template <typename ListenerT, typename FuncT>
+inline void OInterfaceContainerHelper2::forEach( FuncT const& func )
+{
+ OInterfaceIteratorHelper2 iter( *this );
+ while (iter.hasMoreElements()) {
+ css::uno::Reference<ListenerT> const xListener( iter.next(), css::uno::UNO_QUERY );
+ if (xListener.is()) {
+ try {
+ func( xListener );
+ }
+ catch (css::lang::DisposedException const& exc) {
+ if (exc.Context == xListener)
+ iter.remove();
+ }
+ }
+ }
+}
+
+template< typename ListenerT, typename EventT >
+inline void OInterfaceContainerHelper2::notifyEach( void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& ), const EventT& Event )
+{
+ forEach< ListenerT, NotifySingleListener< ListenerT, EventT > >( NotifySingleListener< ListenerT, EventT >( NotificationMethod, Event ) );
+}
+
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/interfacecontainer3.hxx b/include/comphelper/interfacecontainer3.hxx
new file mode 100644
index 000000000..4b3d44bab
--- /dev/null
+++ b/include/comphelper/interfacecontainer3.hxx
@@ -0,0 +1,379 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <o3tl/cow_wrapper.hxx>
+#include <vector>
+
+namespace com::sun::star::uno
+{
+class XInterface;
+}
+namespace osl
+{
+class Mutex;
+}
+
+namespace comphelper
+{
+template <class ListenerT> class OInterfaceContainerHelper3;
+/**
+ This is the iterator of an OInterfaceContainerHelper3. Typically
+ one constructs an instance on the stack for one firing session.
+ It is not allowed to assign or copy an instance of this class.
+
+ @tparam ListenerT UNO event listener type
+ @see OInterfaceContainerHelper3
+ */
+template <class ListenerT> class OInterfaceIteratorHelper3
+{
+public:
+ /**
+ Create an iterator over the elements of the container. The iterator
+ copies the elements of the container. A change to the container
+ during the lifetime of an iterator is allowed and does not
+ affect the iterator-instance. The iterator and the container take cares
+ themself for concurrent access, no additional guarding is necessary.
+
+ Remark: The copy is on demand. The iterator copy the elements only if the container
+ change the contents...
+
+ @param rCont the container of the elements.
+ */
+ OInterfaceIteratorHelper3(OInterfaceContainerHelper3<ListenerT>& rCont_)
+ : rCont(rCont_)
+ , maData(rCont.maData)
+ , nRemain(maData->size())
+ {
+ }
+
+ /** Return true, if there are more elements in the iterator. */
+ bool hasMoreElements() const { return nRemain != 0; }
+ /** Return the next element of the iterator. Calling this method if
+ hasMoreElements() has returned false, is an error.
+ */
+ css::uno::Reference<ListenerT> const& next();
+
+ /** Removes the current element (the last one returned by next())
+ from the underlying container. Calling this method before
+ next() has been called or calling it twice with no next()
+ in between is an error.
+ */
+ void remove();
+
+private:
+ OInterfaceContainerHelper3<ListenerT>& rCont;
+ o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>,
+ o3tl::ThreadSafeRefCountingPolicy>
+ maData;
+ sal_Int32 nRemain;
+
+ OInterfaceIteratorHelper3(const OInterfaceIteratorHelper3&) = delete;
+ OInterfaceIteratorHelper3& operator=(const OInterfaceIteratorHelper3&) = delete;
+};
+
+template <class ListenerT>
+const css::uno::Reference<ListenerT>& OInterfaceIteratorHelper3<ListenerT>::next()
+{
+ nRemain--;
+ return (*maData)[nRemain];
+}
+
+template <class ListenerT> void OInterfaceIteratorHelper3<ListenerT>::remove()
+{
+ rCont.removeInterface((*maData)[nRemain]);
+}
+
+/**
+ A container of interfaces. To access the elements use an iterator.
+ This implementation is thread-safe.
+
+ This is a copy of the code at include/comphelper/interfacecontainer2.hxx,
+ except that it is templatized on the type of the listener, which allows
+ some parts of the code to avoid doing an UNO_QUERY that can be expensive
+ in bulk.
+
+ @tparam ListenerT UNO event listener type
+ @see OInterfaceIteratorHelper
+ */
+template <class ListenerT> class OInterfaceContainerHelper3
+{
+public:
+ /**
+ Create an interface container.
+
+ @param rMutex the mutex to protect multi thread access.
+ The lifetime must be longer than the lifetime
+ of this object.
+ */
+ inline OInterfaceContainerHelper3(::osl::Mutex& rMutex_);
+
+ /**
+ Return the number of Elements in the container. Only useful if you have acquired
+ the mutex.
+ */
+ sal_Int32 getLength() const;
+
+ /**
+ Return all interfaces added to this container.
+ **/
+ std::vector<css::uno::Reference<ListenerT>> getElements() const;
+
+ /** Inserts an element into the container. The position is not specified, thus it is not
+ specified in which order events are fired.
+
+ @attention
+ If you add the same interface more than once, then it will be added to the elements list
+ more than once and thus if you want to remove that interface from the list, you have to call
+ removeInterface() the same number of times.
+ In the latter case, you will also get events fired more than once (if the interface is a
+ listener interface).
+
+ @param rxIFace
+ interface to be added; it is allowed to insert
+ the same interface more than once
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 addInterface(const css::uno::Reference<ListenerT>& rxIFace);
+ /** Removes an element from the container. It uses interface equality to remove the interface.
+
+ @param rxIFace
+ interface to be removed
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 removeInterface(const css::uno::Reference<ListenerT>& rxIFace);
+ /** Return an interface by index
+ */
+ const css::uno::Reference<ListenerT>& getInterface(sal_Int32 nIndex) const;
+ /**
+ Call disposing on all object in the container that
+ support XEventListener. Then clear the container.
+ */
+ void disposeAndClear(const css::lang::EventObject& rEvt);
+ /**
+ Clears the container without calling disposing().
+ */
+ void clear();
+
+ /** Executes a functor for each contained listener of specified type, e.g.
+ <code>forEach<awt::XPaintListener>(...</code>.
+
+ If a css::lang::DisposedException occurs which relates to
+ the called listener, then that listener is removed from the container.
+
+ @tparam FuncT unary functor type, let your compiler deduce this for you
+ @param func unary functor object expecting an argument of type
+ css::uno::Reference<ListenerT>
+ */
+ template <typename FuncT> inline void forEach(FuncT const& func);
+
+ /** Calls a UNO listener method for each contained listener.
+
+ The listener method must take a single argument of type EventT,
+ and return <code>void</code>.
+
+ If a css::lang::DisposedException occurs which relates to
+ the called listener, then that listener is removed from the container.
+
+ @tparam EventT event type, let your compiler deduce this for you
+ @param NotificationMethod
+ Pointer to a method of a ListenerT interface.
+ @param Event
+ Event to notify to all contained listeners
+
+ Example:
+@code
+ awt::PaintEvent aEvent( static_cast< cppu::OWeakObject* >( this ), ... );
+ listeners.notifyEach( &XPaintListener::windowPaint, aEvent );
+@endcode
+ */
+ template <typename EventT>
+ inline void notifyEach(void (SAL_CALL ListenerT::*NotificationMethod)(const EventT&),
+ const EventT& Event);
+
+private:
+ friend class OInterfaceIteratorHelper3<ListenerT>;
+ o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>,
+ o3tl::ThreadSafeRefCountingPolicy>
+ maData;
+ ::osl::Mutex& mrMutex;
+ OInterfaceContainerHelper3(const OInterfaceContainerHelper3&) = delete;
+ OInterfaceContainerHelper3& operator=(const OInterfaceContainerHelper3&) = delete;
+
+ static o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>,
+ o3tl::ThreadSafeRefCountingPolicy>&
+ DEFAULT()
+ {
+ static o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>,
+ o3tl::ThreadSafeRefCountingPolicy>
+ SINGLETON;
+ return SINGLETON;
+ }
+
+private:
+ template <typename EventT> class NotifySingleListener
+ {
+ private:
+ typedef void (SAL_CALL ListenerT::*NotificationMethod)(const EventT&);
+ NotificationMethod const m_pMethod;
+ const EventT& m_rEvent;
+
+ public:
+ NotifySingleListener(NotificationMethod method, const EventT& event)
+ : m_pMethod(method)
+ , m_rEvent(event)
+ {
+ }
+
+ void operator()(const css::uno::Reference<ListenerT>& listener) const
+ {
+ (listener.get()->*m_pMethod)(m_rEvent);
+ }
+ };
+};
+
+template <class T>
+inline OInterfaceContainerHelper3<T>::OInterfaceContainerHelper3(::osl::Mutex& rMutex_)
+ : maData(OInterfaceContainerHelper3<T>::DEFAULT())
+ , mrMutex(rMutex_)
+{
+}
+
+template <class T>
+template <typename FuncT>
+inline void OInterfaceContainerHelper3<T>::forEach(FuncT const& func)
+{
+ OInterfaceIteratorHelper3<T> iter(*this);
+ while (iter.hasMoreElements())
+ {
+ auto xListener = iter.next();
+ try
+ {
+ func(xListener);
+ }
+ catch (css::lang::DisposedException const& exc)
+ {
+ if (exc.Context == xListener)
+ iter.remove();
+ }
+ }
+}
+
+template <class ListenerT>
+template <typename EventT>
+inline void OInterfaceContainerHelper3<ListenerT>::notifyEach(
+ void (SAL_CALL ListenerT::*NotificationMethod)(const EventT&), const EventT& Event)
+{
+ forEach<NotifySingleListener<EventT>>(NotifySingleListener<EventT>(NotificationMethod, Event));
+}
+
+template <class ListenerT> sal_Int32 OInterfaceContainerHelper3<ListenerT>::getLength() const
+{
+ osl::MutexGuard aGuard(mrMutex);
+ return maData->size();
+}
+
+template <class ListenerT>
+std::vector<css::uno::Reference<ListenerT>>
+OInterfaceContainerHelper3<ListenerT>::getElements() const
+{
+ std::vector<css::uno::Reference<ListenerT>> rVec;
+ osl::MutexGuard aGuard(mrMutex);
+ rVec = *maData;
+ return rVec;
+}
+
+template <class ListenerT>
+sal_Int32
+OInterfaceContainerHelper3<ListenerT>::addInterface(const css::uno::Reference<ListenerT>& rListener)
+{
+ assert(rListener.is());
+ osl::MutexGuard aGuard(mrMutex);
+
+ maData->push_back(rListener);
+ return maData->size();
+}
+
+template <class ListenerT>
+sal_Int32 OInterfaceContainerHelper3<ListenerT>::removeInterface(
+ const css::uno::Reference<ListenerT>& rListener)
+{
+ assert(rListener.is());
+ osl::MutexGuard aGuard(mrMutex);
+
+ // It is not valid to compare the pointer directly, but it's faster.
+ auto it = std::find_if(maData->begin(), maData->end(),
+ [&rListener](const css::uno::Reference<css::uno::XInterface>& rItem) {
+ return rItem.get() == rListener.get();
+ });
+
+ // interface not found, use the correct compare method
+ if (it == maData->end())
+ it = std::find(maData->begin(), maData->end(), rListener);
+
+ if (it != maData->end())
+ maData->erase(it);
+
+ return maData->size();
+}
+
+template <class ListenerT>
+const css::uno::Reference<ListenerT>&
+OInterfaceContainerHelper3<ListenerT>::getInterface(sal_Int32 nIndex) const
+{
+ osl::MutexGuard aGuard(mrMutex);
+
+ return (*maData)[nIndex];
+}
+
+template <class ListenerT>
+void OInterfaceContainerHelper3<ListenerT>::disposeAndClear(const css::lang::EventObject& rEvt)
+{
+ osl::ClearableMutexGuard aGuard(mrMutex);
+ OInterfaceIteratorHelper3<ListenerT> aIt(*this);
+ maData->clear();
+ aGuard.clear();
+ while (aIt.hasMoreElements())
+ {
+ try
+ {
+ aIt.next()->disposing(rEvt);
+ }
+ catch (css::uno::RuntimeException&)
+ {
+ // be robust, if e.g. a remote bridge has disposed already.
+ // there is no way to delegate the error to the caller :o(.
+ }
+ }
+}
+
+template <class ListenerT> void OInterfaceContainerHelper3<ListenerT>::clear()
+{
+ osl::MutexGuard aGuard(mrMutex);
+ maData->clear();
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/interfacecontainer4.hxx b/include/comphelper/interfacecontainer4.hxx
new file mode 100644
index 000000000..bdd6a6b60
--- /dev/null
+++ b/include/comphelper/interfacecontainer4.hxx
@@ -0,0 +1,401 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <o3tl/cow_wrapper.hxx>
+#include <mutex>
+#include <vector>
+
+namespace com::sun::star::uno
+{
+class XInterface;
+}
+
+namespace comphelper
+{
+template <class ListenerT> class OInterfaceContainerHelper4;
+/**
+ This is the iterator of an OInterfaceContainerHelper4. Typically
+ one constructs an instance on the stack for one firing session.
+ It is not allowed to assign or copy an instance of this class.
+
+ @tparam ListenerT UNO event listener type
+ @see OInterfaceContainerHelper4
+ */
+template <class ListenerT> class OInterfaceIteratorHelper4
+{
+public:
+ /**
+ Create an iterator over the elements of the container. The iterator
+ copies the elements of the container. A change to the container
+ during the lifetime of an iterator is allowed and does not
+ affect the iterator-instance. The iterator and the container take cares
+ themself for concurrent access, no additional guarding is necessary.
+
+ Remark: The copy is on demand. The iterator copy the elements only if the container
+ change the contents...
+
+ @param rCont the container of the elements.
+ @param rGuard
+ this parameter only here to make that this container is accessed while locked
+ */
+ OInterfaceIteratorHelper4(std::unique_lock<std::mutex>& /*rGuard*/,
+ OInterfaceContainerHelper4<ListenerT>& rCont_)
+ : rCont(rCont_)
+ , maData(rCont.maData)
+ // const_cast so we don't trigger make_unique via o3tl::cow_wrapper::operator->
+ , nRemain(std::as_const(maData)->size())
+ {
+ }
+
+ /** Return true, if there are more elements in the iterator. */
+ bool hasMoreElements() const { return nRemain != 0; }
+ /** Return the next element of the iterator. Calling this method if
+ hasMoreElements() has returned false, is an error.
+ */
+ css::uno::Reference<ListenerT> const& next();
+
+ /** Removes the current element (the last one returned by next())
+ from the underlying container. Calling this method before
+ next() has been called or calling it twice with no next()
+ in between is an error.
+ @param rGuard
+ this parameter only here to make that this container is accessed while locked
+ */
+ void remove(::std::unique_lock<::std::mutex>& rGuard);
+
+private:
+ OInterfaceContainerHelper4<ListenerT>& rCont;
+ o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>,
+ o3tl::ThreadSafeRefCountingPolicy>
+ maData;
+ sal_Int32 nRemain;
+
+ OInterfaceIteratorHelper4(const OInterfaceIteratorHelper4&) = delete;
+ OInterfaceIteratorHelper4& operator=(const OInterfaceIteratorHelper4&) = delete;
+};
+
+template <class ListenerT>
+const css::uno::Reference<ListenerT>& OInterfaceIteratorHelper4<ListenerT>::next()
+{
+ nRemain--;
+ return (*std::as_const(maData))[nRemain];
+}
+
+template <class ListenerT>
+void OInterfaceIteratorHelper4<ListenerT>::remove(::std::unique_lock<::std::mutex>& rGuard)
+{
+ rCont.removeInterface(rGuard, (*std::as_const(maData))[nRemain]);
+}
+
+/**
+ A container of interfaces. To access the elements use an iterator.
+ This implementation is thread-safe.
+
+ This is a copy of the code at include/comphelper/interfacecontainer3.hxx,
+ except that it (a) uses std::mutex instead of osl::Mutex and (b) does not
+ store a reference to the mutex, but relies on the calling class to take
+ a lock around using it.
+
+ @tparam ListenerT UNO event listener type
+ @see OInterfaceIteratorHelper
+ */
+template <class ListenerT> class OInterfaceContainerHelper4
+{
+public:
+ OInterfaceContainerHelper4();
+
+ /**
+ Return the number of Elements in the container. Only useful if you have acquired
+ the mutex.
+ @param rGuard
+ this parameter only here to make that this container is accessed while locked
+ */
+ sal_Int32 getLength(std::unique_lock<std::mutex>& rGuard) const;
+
+ /**
+ Return all interfaces added to this container.
+ @param rGuard
+ this parameter only here to make that this container is accessed while locked
+ **/
+ std::vector<css::uno::Reference<ListenerT>>
+ getElements(std::unique_lock<std::mutex>& rGuard) const;
+
+ /** Inserts an element into the container. The position is not specified, thus it is not
+ specified in which order events are fired.
+
+ @attention
+ If you add the same interface more than once, then it will be added to the elements list
+ more than once and thus if you want to remove that interface from the list, you have to call
+ removeInterface() the same number of times.
+ In the latter case, you will also get events fired more than once (if the interface is a
+ listener interface).
+
+ @param rxIFace
+ interface to be added; it is allowed to insert
+ the same interface more than once
+ @param rGuard
+ this parameter only here to make that this container is accessed while locked
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 addInterface(std::unique_lock<std::mutex>& rGuard,
+ const css::uno::Reference<ListenerT>& rxIFace);
+ /** Removes an element from the container. It uses interface equality to remove the interface.
+
+ @param rxIFace
+ interface to be removed
+ @param rGuard
+ this parameter only here to make that this container is accessed while locked
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 removeInterface(std::unique_lock<std::mutex>& rGuard,
+ const css::uno::Reference<ListenerT>& rxIFace);
+ /**
+ Call disposing on all object in the container that
+ support XEventListener. Then clear the container.
+ The guard is unlock()'ed before calling the listeners.
+ */
+ void disposeAndClear(::std::unique_lock<::std::mutex>& rGuard,
+ const css::lang::EventObject& rEvt);
+ /**
+ Clears the container without calling disposing().
+ @param rGuard
+ this parameter only here to make that this container is accessed while locked
+ */
+ void clear(::std::unique_lock<::std::mutex>& rGuard);
+
+ /** Executes a functor for each contained listener of specified type, e.g.
+ <code>forEach<awt::XPaintListener>(...</code>.
+
+ If a css::lang::DisposedException occurs which relates to
+ the called listener, then that listener is removed from the container.
+
+ @tparam FuncT unary functor type, let your compiler deduce this for you
+ @param func unary functor object expecting an argument of type
+ css::uno::Reference<ListenerT>
+ @param rGuard
+ this parameter only here to make that this container is accessed while locked
+ */
+ template <typename FuncT>
+ inline void forEach(std::unique_lock<std::mutex>& rGuard, FuncT const& func);
+
+ /** Calls a UNO listener method for each contained listener.
+
+ The listener method must take a single argument of type EventT,
+ and return <code>void</code>.
+
+ If a css::lang::DisposedException occurs which relates to
+ the called listener, then that listener is removed from the container.
+
+ @tparam EventT event type, let your compiler deduce this for you
+ @param NotificationMethod
+ Pointer to a method of a ListenerT interface.
+ @param Event
+ Event to notify to all contained listeners
+ @param rGuard
+ this parameter only here to make that this container is accessed while locked
+
+ Example:
+@code
+ awt::PaintEvent aEvent( static_cast< cppu::OWeakObject* >( this ), ... );
+ listeners.notifyEach( &XPaintListener::windowPaint, aEvent );
+@endcode
+ */
+ template <typename EventT>
+ inline void notifyEach(std::unique_lock<std::mutex>& rGuard,
+ void (SAL_CALL ListenerT::*NotificationMethod)(const EventT&),
+ const EventT& Event);
+
+private:
+ friend class OInterfaceIteratorHelper4<ListenerT>;
+ o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>,
+ o3tl::ThreadSafeRefCountingPolicy>
+ maData;
+ OInterfaceContainerHelper4(const OInterfaceContainerHelper4&) = delete;
+ OInterfaceContainerHelper4& operator=(const OInterfaceContainerHelper4&) = delete;
+
+ static o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>,
+ o3tl::ThreadSafeRefCountingPolicy>&
+ DEFAULT()
+ {
+ static o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>,
+ o3tl::ThreadSafeRefCountingPolicy>
+ SINGLETON;
+ return SINGLETON;
+ }
+
+private:
+ template <typename EventT> class NotifySingleListener
+ {
+ private:
+ typedef void (SAL_CALL ListenerT::*NotificationMethod)(const EventT&);
+ NotificationMethod const m_pMethod;
+ const EventT& m_rEvent;
+
+ public:
+ NotifySingleListener(NotificationMethod method, const EventT& event)
+ : m_pMethod(method)
+ , m_rEvent(event)
+ {
+ }
+
+ void operator()(const css::uno::Reference<ListenerT>& listener) const
+ {
+ (listener.get()->*m_pMethod)(m_rEvent);
+ }
+ };
+};
+
+template <class T>
+inline OInterfaceContainerHelper4<T>::OInterfaceContainerHelper4()
+ : maData(OInterfaceContainerHelper4<T>::DEFAULT())
+{
+}
+
+template <class T>
+template <typename FuncT>
+inline void OInterfaceContainerHelper4<T>::forEach(std::unique_lock<std::mutex>& rGuard,
+ FuncT const& func)
+{
+ if (std::as_const(maData)->size() == 0)
+ {
+ return;
+ }
+ maData.make_unique(); // so we can iterate over the data without holding the lock
+ OInterfaceIteratorHelper4<T> iter(rGuard, *this);
+ rGuard.unlock();
+ while (iter.hasMoreElements())
+ {
+ auto xListener = iter.next();
+ try
+ {
+ func(xListener);
+ }
+ catch (css::lang::DisposedException const& exc)
+ {
+ if (exc.Context == xListener)
+ {
+ rGuard.lock();
+ iter.remove(rGuard);
+ rGuard.unlock();
+ }
+ }
+ }
+ rGuard.lock();
+}
+
+template <class ListenerT>
+template <typename EventT>
+inline void OInterfaceContainerHelper4<ListenerT>::notifyEach(
+ std::unique_lock<std::mutex>& rGuard,
+ void (SAL_CALL ListenerT::*NotificationMethod)(const EventT&), const EventT& Event)
+{
+ forEach<NotifySingleListener<EventT>>(rGuard,
+ NotifySingleListener<EventT>(NotificationMethod, Event));
+}
+
+template <class ListenerT>
+sal_Int32
+OInterfaceContainerHelper4<ListenerT>::getLength(std::unique_lock<std::mutex>& /*rGuard*/) const
+{
+ return maData->size();
+}
+
+template <class ListenerT>
+std::vector<css::uno::Reference<ListenerT>>
+OInterfaceContainerHelper4<ListenerT>::getElements(std::unique_lock<std::mutex>& /*rGuard*/) const
+{
+ return *maData;
+}
+
+template <class ListenerT>
+sal_Int32
+OInterfaceContainerHelper4<ListenerT>::addInterface(std::unique_lock<std::mutex>& /*rGuard*/,
+ const css::uno::Reference<ListenerT>& rListener)
+{
+ assert(rListener.is());
+ maData->push_back(rListener);
+ return maData->size();
+}
+
+template <class ListenerT>
+sal_Int32 OInterfaceContainerHelper4<ListenerT>::removeInterface(
+ std::unique_lock<std::mutex>& /*rGuard*/, const css::uno::Reference<ListenerT>& rListener)
+{
+ assert(rListener.is());
+
+ // It is not valid to compare the pointer directly, but it's faster.
+ auto it = std::find_if(maData->begin(), maData->end(),
+ [&rListener](const css::uno::Reference<css::uno::XInterface>& rItem) {
+ return rItem.get() == rListener.get();
+ });
+
+ // interface not found, use the correct compare method
+ if (it == maData->end())
+ it = std::find(maData->begin(), maData->end(), rListener);
+
+ if (it != maData->end())
+ maData->erase(it);
+
+ return maData->size();
+}
+
+template <class ListenerT>
+void OInterfaceContainerHelper4<ListenerT>::disposeAndClear(std::unique_lock<std::mutex>& rGuard,
+ const css::lang::EventObject& rEvt)
+{
+ {
+ OInterfaceIteratorHelper4<ListenerT> aIt(rGuard, *this);
+ maData
+ = DEFAULT(); // cheaper than calling maData->clear() because it doesn't allocate a new vector
+ rGuard.unlock();
+ // unlock followed by iterating is only safe because we are not going to call remove() on the iterator
+ while (aIt.hasMoreElements())
+ {
+ try
+ {
+ aIt.next()->disposing(rEvt);
+ }
+ catch (css::uno::RuntimeException&)
+ {
+ // be robust, if e.g. a remote bridge has disposed already.
+ // there is no way to delegate the error to the caller :o(.
+ }
+ }
+ }
+ // tdf#152077 need to destruct the OInterfaceIteratorHelper4 before we take the lock again
+ // because there is a vague chance that destructing it will trigger a call back into something
+ // that wants to take the lock.
+ rGuard.lock();
+}
+
+template <class ListenerT>
+void OInterfaceContainerHelper4<ListenerT>::clear(::std::unique_lock<::std::mutex>& /*rGuard*/)
+{
+ maData->clear();
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/logging.hxx b/include/comphelper/logging.hxx
new file mode 100644
index 000000000..f0a599765
--- /dev/null
+++ b/include/comphelper/logging.hxx
@@ -0,0 +1,460 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_LOGGING_HXX
+#define INCLUDED_COMPHELPER_LOGGING_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustring.hxx>
+
+#include <optional>
+#include <memory>
+
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::logging { class XLogger; }
+
+namespace comphelper
+{
+
+
+ //= string conversions, employed by the templatized log* members of
+ //= EventLogger
+
+
+ namespace log::convert
+ {
+ inline const OUString& convertLogArgToString( const OUString& _rValue )
+ {
+ return _rValue;
+ }
+
+ inline OUString convertLogArgToString( const char* _pAsciiValue )
+ {
+ return OUString::createFromAscii( _pAsciiValue );
+ }
+
+ inline OUString convertLogArgToString( double _nValue ) { return OUString::number( _nValue ); }
+ inline OUString convertLogArgToString( float _nValue ) { return OUString::number( _nValue ); }
+ inline OUString convertLogArgToString( sal_Int64 _nValue ) { return OUString::number( _nValue ); }
+ inline OUString convertLogArgToString( sal_Int32 _nValue ) { return OUString::number( _nValue ); }
+ inline OUString convertLogArgToString( sal_Int16 _nValue ) { return OUString::number( _nValue ); }
+ inline OUString convertLogArgToString( sal_Unicode _nValue ) { return OUString( _nValue ); }
+ inline OUString convertLogArgToString( bool _bValue ) { return OUString::boolean( _bValue ); }
+ void convertLogArgToString(sal_Bool) = delete;
+
+ } // namespace log::convert
+
+
+ //= EventLogger
+
+ class EventLogger_Impl;
+ typedef ::std::optional< OUString > OptionalString;
+
+ /** encapsulates a css::logging::XLogger
+
+ The class silences several (unlikely) errors which could potentially happen
+ when working with a logger. Additionally, it provides some convenience methods
+ for logging events.
+
+ You can use this class as follows
+<pre>
+ EventLogger aLogger( xContext, sLoggerName );
+ ...
+ aLogger.log( LogLevel::SEVERE, sSomeMessage );
+ aLogger.logp( LogLevel::CONFIG, "MyClass", "MyMethod", sSomeMessage, SomeParameter1, SomeParameter2, SomeParameter3 );
+</pre>
+
+ The <code>log</code> and <code>logp</code> calls support up to 6 parameters, which can be of
+ arbitrary type. For every parameter, there must exist a function <code>convertLogArgToString</code>
+ which takes an argument of the respective type, and returns a string.
+
+ After a parameter has been converted to a string using the above mentioned
+ <code>convertLogArgToString</code> function, a placeholder $1$ (resp. $2$ resp. $4$ ...)
+ in the message will be replaced with this string, and the resulting message will be logged.
+ */
+ class COMPHELPER_DLLPUBLIC EventLogger
+ {
+ protected:
+ std::shared_ptr< EventLogger_Impl > m_pImpl;
+
+ public:
+ /** creates an <code>EventLogger</code> instance working with a css.logging.XLogger
+ instance given by ASCII name.
+
+ @param _rxContext
+ the component context to create services
+
+ @param _rLoggerName
+ the ASCII name of the logger to create.
+ */
+ EventLogger(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const char* _pAsciiLoggerName
+ );
+
+ public:
+ /// determines whether an event with the given level would be logged
+ bool isLoggable( const sal_Int32 _nLogLevel ) const;
+
+
+ //- XLogger::log equivalents/wrappers
+ //- string messages
+
+ /// logs a given message, without any arguments, or source class/method names
+ void log( const sal_Int32 _nLogLevel, const OUString& rMessage ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log(_nLogLevel, nullptr, nullptr, rMessage);
+ }
+
+ const css::uno::Reference<css::logging::XLogger> & getLogger() const;
+
+ /** logs a given message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the log level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ void log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ }
+
+ /// logs a given message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ void log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ }
+
+ /// logs a given message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ void log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ }
+
+ /// logs a given message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ void log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ }
+
+ /// logs a given message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ void log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ }
+
+ /// logs a given message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ void log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ }
+
+
+ //- XLogger::log equivalents/wrappers
+ //- ASCII messages
+
+ /** logs a given message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the log level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ void log( const sal_Int32 _nLogLevel, const char* _pMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ }
+
+ /// logs a given message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ void log( const sal_Int32 _nLogLevel, const char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ }
+
+ /// logs a given message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ void log( const sal_Int32 _nLogLevel, const char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ }
+
+ /// logs a given message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ void log( const sal_Int32 _nLogLevel, const char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ }
+
+ /// logs a given message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ void log( const sal_Int32 _nLogLevel, const char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ }
+
+ /// logs a given message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ void log( const sal_Int32 _nLogLevel, const char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, nullptr, nullptr, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ }
+
+
+ //- XLogger::logp equivalents/wrappers
+ //- string messages
+
+ /** logs a given message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the logp level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ }
+
+ /// logs a given message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ }
+
+ /// logs a given message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ }
+
+ /// logs a given message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ }
+
+ /// logs a given message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ }
+
+ /// logs a given message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ }
+
+
+ //- XLogger::logp equivalents/wrappers
+ //- ASCII messages
+
+ /** logs a given ASCII message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the logp level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const char* _pAsciiMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ }
+
+ /// logs a given ASCII message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ }
+
+ /// logs a given ASCII message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ }
+
+ /// logs a given ASCII message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ }
+
+ /// logs a given ASCII message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ }
+
+ /// logs a given ASCII message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ void logp( const sal_Int32 _nLogLevel, const char* _pSourceClass, const char* _pSourceMethod, const char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ }
+
+ protected:
+ void impl_log(
+ const sal_Int32 _nLogLevel,
+ const char* _pSourceClass,
+ const char* _pSourceMethod,
+ const OUString& _rMessage,
+ const OptionalString& _rArgument1 = OptionalString(),
+ const OptionalString& _rArgument2 = OptionalString(),
+ const OptionalString& _rArgument3 = OptionalString(),
+ const OptionalString& _rArgument4 = OptionalString(),
+ const OptionalString& _rArgument5 = OptionalString(),
+ const OptionalString& _rArgument6 = OptionalString()
+ ) const;
+ };
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_LOGGING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
new file mode 100644
index 000000000..66784e8e4
--- /dev/null
+++ b/include/comphelper/lok.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_LOK_HXX
+#define INCLUDED_COMPHELPER_LOK_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustring.hxx>
+
+class LanguageTag;
+
+// Interface between the LibreOfficeKit implementation called by LibreOfficeKit clients and other
+// LibreOffice code.
+
+namespace comphelper::LibreOfficeKit
+{
+// Functions to be called only from the LibreOfficeKit implementation in desktop, not from other
+// places in LibreOffice code.
+
+COMPHELPER_DLLPUBLIC void setActive(bool bActive = true);
+
+enum class statusIndicatorCallbackType
+{
+ Start,
+ SetValue,
+ Finish
+};
+
+COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(
+ void (*callback)(void* data, statusIndicatorCallbackType type, int percent, const char* pText),
+ void* data);
+
+// Functions that can be called from arbitrary places in LibreOffice.
+
+// Check whether the code is running as invoked through LibreOfficeKit.
+COMPHELPER_DLLPUBLIC bool isActive();
+
+/// Shift the coordinates before rendering each bitmap.
+/// Used by Calc to render each tile separately.
+/// This should be unnecessary (and removed) once Calc
+/// moves to using 100MM Unit.
+COMPHELPER_DLLPUBLIC void setLocalRendering(bool bLocalRendering = true);
+COMPHELPER_DLLPUBLIC bool isLocalRendering();
+
+/// Check whether clients want a part number in an invalidation payload.
+COMPHELPER_DLLPUBLIC bool isPartInInvalidation();
+/// Set whether clients want a part number in an invalidation payload.
+COMPHELPER_DLLPUBLIC void setPartInInvalidation(bool bPartInInvalidation);
+
+/// Check if we are doing tiled painting.
+COMPHELPER_DLLPUBLIC bool isTiledPainting();
+/// Set if we are doing tiled painting.
+COMPHELPER_DLLPUBLIC void setTiledPainting(bool bTiledPainting);
+/// Check if we are painting the dialog.
+COMPHELPER_DLLPUBLIC bool isDialogPainting();
+/// Set if we are painting the dialog.
+COMPHELPER_DLLPUBLIC void setDialogPainting(bool bDialogPainting);
+/// Set the DPI scale for rendering for HiDPI displays.
+COMPHELPER_DLLPUBLIC void setDPIScale(double fDPIScale);
+/// Get the DPI scale for rendering for HiDPI displays.
+COMPHELPER_DLLPUBLIC double getDPIScale();
+/// Set if we want no annotations rendering
+COMPHELPER_DLLPUBLIC void setTiledAnnotations(bool bTiledAnnotations);
+/// Check if annotations rendering is turned off
+COMPHELPER_DLLPUBLIC bool isTiledAnnotations();
+/// Set if we want range based header data
+COMPHELPER_DLLPUBLIC void setRangeHeaders(bool bTiledAnnotations);
+/// Check if range based header data is enabled
+COMPHELPER_DLLPUBLIC bool isRangeHeaders();
+
+enum Compat : sal_uInt32
+{
+ none = 0,
+ scNoGridBackground = 1,
+ scPrintTwipsMsgs = 2,
+};
+/// Set compatibility flags
+COMPHELPER_DLLPUBLIC void setCompatFlag(Compat flag);
+/// Get compatibility flags
+COMPHELPER_DLLPUBLIC bool isCompatFlagSet(Compat flag);
+
+/// Check whether clients want viewId in visible cursor invalidation payload.
+COMPHELPER_DLLPUBLIC bool isViewIdForVisCursorInvalidation();
+/// Set whether clients want viewId in visible cursor invalidation payload.
+COMPHELPER_DLLPUBLIC void setViewIdForVisCursorInvalidation(bool bViewIdForVisCursorInvalidation);
+
+/// Update the current LOK's locale.
+COMPHELPER_DLLPUBLIC void setLocale(const LanguageTag& languageTag);
+/// Get the current LOK's locale.
+COMPHELPER_DLLPUBLIC const LanguageTag& getLocale();
+
+/// Update the current LOK's language.
+COMPHELPER_DLLPUBLIC void setLanguageTag(const LanguageTag& languageTag);
+/// Get the current LOK's language.
+COMPHELPER_DLLPUBLIC const LanguageTag& getLanguageTag();
+/// If the language name should be used for this LOK instance.
+COMPHELPER_DLLPUBLIC bool isAllowlistedLanguage(const OUString& lang);
+
+// Status indicator handling. Even if in theory there could be several status indicators active at
+// the same time, in practice there is only one at a time, so we don't handle any identification of
+// status indicator in this API.
+COMPHELPER_DLLPUBLIC void statusIndicatorStart(const OUString& sText);
+COMPHELPER_DLLPUBLIC void statusIndicatorSetValue(int percent);
+COMPHELPER_DLLPUBLIC void statusIndicatorFinish();
+
+COMPHELPER_DLLPUBLIC void setBlockedCommandList(const char* blockedCommandList);
+}
+
+#endif // INCLUDED_COMPHELPER_LOK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/make_shared_from_uno.hxx b/include/comphelper/make_shared_from_uno.hxx
new file mode 100644
index 000000000..7075e3000
--- /dev/null
+++ b/include/comphelper/make_shared_from_uno.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_MAKE_SHARED_FROM_UNO_HXX
+#define INCLUDED_COMPHELPER_MAKE_SHARED_FROM_UNO_HXX
+
+#include <memory>
+
+namespace comphelper
+{
+/// @internal
+namespace detail
+{
+/// @internal
+template <typename T> struct ReleaseFunc
+{
+ void operator()(T* p) const { p->release(); }
+};
+} // namespace detail
+
+/** Makes a std::shared_ptr from a ref-counted UNO object pointer.
+ This makes sense if the object is used via UNO (implementing some X
+ interface) and also internally using its implementation class, e.g.
+
+ <pre>
+ std::shared_ptr<MyUnoImpl> const ptr(
+ comphelper::make_shared_from_UNO( new MyUnoImpl ) );
+ ...
+ xUno->callingUno( uno::Reference<XSomeInterface>( ptr.get() ) );
+ ...
+ takeSharedPtr( ptr );
+ ...
+ </pre>
+
+ @attention The shared_ptr operates on a separate reference counter, so
+ weak pointers (std::weak_ptr) are invalidated when the last
+ shared_ptr is destroyed, although the UNO object may still be
+ alive.
+
+ @param p object pointer
+ @return shared_ptr to object
+*/
+template <typename T> inline std::shared_ptr<T> make_shared_from_UNO(T* p)
+{
+ p->acquire();
+ return std::shared_ptr<T>(p, detail::ReleaseFunc<T>());
+}
+
+} // namespace comphelper
+
+#endif // ! defined(INCLUDED_COMPHELPER_MAKE_SHARED_FROM_UNO_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/mimeconfighelper.hxx b/include/comphelper/mimeconfighelper.hxx
new file mode 100644
index 000000000..5dd99664a
--- /dev/null
+++ b/include/comphelper/mimeconfighelper.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_MIMECONFIGHELPER_HXX
+#define INCLUDED_COMPHELPER_MIMECONFIGHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <mutex>
+
+namespace com::sun::star::beans { struct NamedValue; }
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::container { class XContainerQuery; }
+namespace com::sun::star::container { class XNameAccess; }
+namespace com::sun::star::embed { struct VerbDescriptor; }
+namespace com::sun::star::lang { class XMultiServiceFactory; }
+namespace com::sun::star::uno { class XComponentContext; }
+
+enum class SfxFilterFlags;
+
+namespace comphelper {
+
+class COMPHELPER_DLLPUBLIC MimeConfigurationHelper
+{
+ std::mutex m_aMutex;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider;
+
+ css::uno::Reference< css::container::XNameAccess > m_xObjectConfig;
+ css::uno::Reference< css::container::XNameAccess > m_xVerbsConfig;
+ css::uno::Reference< css::container::XNameAccess > m_xMediaTypeConfig;
+
+ css::uno::Reference< css::container::XNameAccess > m_xFilterFactory;
+
+public:
+
+ MimeConfigurationHelper( css::uno::Reference< css::uno::XComponentContext > xContext );
+
+
+ static OUString GetStringClassIDRepresentation( const css::uno::Sequence< sal_Int8 >& aClassID );
+
+ static css::uno::Sequence< sal_Int8 > GetSequenceClassIDRepresentation( std::u16string_view aClassID );
+
+
+ css::uno::Reference< css::container::XNameAccess > GetObjConfiguration();
+ css::uno::Reference< css::container::XNameAccess > GetVerbsConfiguration();
+ css::uno::Reference< css::container::XNameAccess > GetMediaTypeConfiguration();
+
+
+ OUString GetDocServiceNameFromFilter( const OUString& aFilterName );
+
+ OUString GetDocServiceNameFromMediaType( const OUString& aMediaType );
+
+ css::uno::Sequence< css::beans::NamedValue > GetObjPropsFromConfigEntry(
+ const css::uno::Sequence< sal_Int8 >& aClassID,
+ const css::uno::Reference< css::container::XNameAccess >& xObjectProps );
+
+ bool GetVerbByShortcut( const OUString& aVerbShortcut,
+ css::embed::VerbDescriptor& aDescriptor );
+
+ OUString GetExplicitlyRegisteredObjClassID( const OUString& aMediaType );
+
+
+ // retrieving object description from configuration
+ css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByStringClassID(
+ const OUString& aStringClassID );
+
+ css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByClassID(
+ const css::uno::Sequence< sal_Int8 >& aClassID );
+
+ css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByMediaType(
+ const OUString& aMediaType );
+
+ css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByFilter(
+ const OUString& aFilterName );
+
+ css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByDocumentName(
+ std::u16string_view aDocumentName );
+
+ // retrieving object factory from configuration
+ OUString GetFactoryNameByStringClassID( const OUString& aStringClassID );
+ OUString GetFactoryNameByClassID( const css::uno::Sequence< sal_Int8 >& aClassID );
+ OUString GetFactoryNameByDocumentName( std::u16string_view aDocName );
+ OUString GetFactoryNameByMediaType( const OUString& aMediaType );
+
+ // typedetection related
+ css::uno::Reference< css::container::XNameAccess > GetFilterFactory();
+
+ OUString UpdateMediaDescriptorWithFilterName(
+ css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr,
+ bool bIgnoreType );
+ OUString UpdateMediaDescriptorWithFilterName(
+ css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr,
+ css::uno::Sequence< css::beans::NamedValue >& aObject );
+#ifdef _WIN32
+ SfxFilterFlags GetFilterFlags( const OUString& aFilterName );
+
+ bool AddFilterNameCheckOwnFile(
+ css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr );
+#endif
+
+ OUString GetDefaultFilterFromServiceName( const OUString& aServName, sal_Int32 nVersion );
+
+ OUString GetExportFilterFromImportFilter( const OUString& aImportFilterName );
+
+ static css::uno::Sequence< css::beans::PropertyValue > SearchForFilter(
+ const css::uno::Reference< css::container::XContainerQuery >& xFilterQuery,
+ const css::uno::Sequence< css::beans::NamedValue >& aSearchRequest,
+ SfxFilterFlags nMustFlags,
+ SfxFilterFlags nDontFlags );
+
+ static bool ClassIDsEqual( const css::uno::Sequence< sal_Int8 >& aClassID1,
+ const css::uno::Sequence< sal_Int8 >& aClassID2 );
+ static css::uno::Sequence< sal_Int8 > GetSequenceClassID( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
+ sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
+ sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
+private:
+ css::uno::Reference< css::container::XNameAccess >
+ GetConfigurationByPathImpl( const OUString& aPath );
+};
+
+}
+
+#endif // INCLUDED_COMPHELPER_MIMECONFIGHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/multicontainer2.hxx b/include/comphelper/multicontainer2.hxx
new file mode 100644
index 000000000..91875b668
--- /dev/null
+++ b/include/comphelper/multicontainer2.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <osl/mutex.hxx>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <comphelper/comphelperdllapi.h>
+#include <comphelper/interfacecontainer2.hxx>
+#include <memory>
+#include <vector>
+#include <utility>
+
+namespace com::sun::star::uno
+{
+class XInterface;
+}
+
+namespace comphelper
+{
+/** This is a copy of cppu::OMultiTypeInterfaceContainerHelper2 in include/cppuhelper/interfacecontainer.h,
+ except that it uses comphelper::OInterfaceContainerHelper2, which is more efficient.
+*/
+class COMPHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelper2
+{
+public:
+ /**
+ Create a container of interface containers.
+
+ @param rMutex the mutex to protect multi thread access.
+ The lifetime must be longer than the lifetime
+ of this object.
+ */
+ OMultiTypeInterfaceContainerHelper2(::osl::Mutex& rMutex);
+ /**
+ Delete all containers.
+ */
+ ~OMultiTypeInterfaceContainerHelper2();
+
+ /**
+ Return all id's under which at least one interface is added.
+ */
+ std::vector<css::uno::Type> getContainedTypes() const;
+
+ /**
+ Return the container created under this key.
+ @return the container created under this key. If the container
+ was not created, null was returned.
+ */
+ OInterfaceContainerHelper2* getContainer(const css::uno::Type& rKey) const;
+
+ /** Inserts an element into the container with the specified key.
+ The position is not specified, thus it is not specified in which order events are fired.
+
+ @attention
+ If you add the same interface more than once, then it will be added to the elements list
+ more than once and thus if you want to remove that interface from the list, you have to call
+ removeInterface() the same number of times.
+ In the latter case, you will also get events fired more than once (if the interface is a
+ listener interface).
+
+ @param rKey
+ the id of the container
+ @param r
+ interface to be added; it is allowed, to insert null or
+ the same interface more than once
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 addInterface(const css::uno::Type& rKey,
+ const css::uno::Reference<css::uno::XInterface>& r);
+
+ /** Removes an element from the container with the specified key.
+ It uses interface equality to remove the interface.
+
+ @param rKey
+ the id of the container
+ @param rxIFace
+ interface to be removed
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 removeInterface(const css::uno::Type& rKey,
+ const css::uno::Reference<css::uno::XInterface>& rxIFace);
+
+ /**
+ Call disposing on all object in the container that
+ support XEventListener. Then clear the container.
+ */
+ void disposeAndClear(const css::lang::EventObject& rEvt);
+ /**
+ Remove all elements of all containers. Does not delete the container.
+ */
+ void clear();
+
+ typedef css::uno::Type keyType;
+
+private:
+ typedef std::vector<std::pair<css::uno::Type, std::unique_ptr<OInterfaceContainerHelper2>>>
+ t_type2ptr;
+
+ t_type2ptr::iterator findType(const css::uno::Type& rKey);
+ t_type2ptr::const_iterator findType(const css::uno::Type& rKey) const;
+
+ t_type2ptr m_aMap;
+ ::osl::Mutex& rMutex;
+
+ OMultiTypeInterfaceContainerHelper2(const OMultiTypeInterfaceContainerHelper2&) = delete;
+ OMultiTypeInterfaceContainerHelper2& operator=(const OMultiTypeInterfaceContainerHelper2&)
+ = delete;
+};
+
+} // namespace comphelper
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/multiinterfacecontainer3.hxx b/include/comphelper/multiinterfacecontainer3.hxx
new file mode 100644
index 000000000..87199885e
--- /dev/null
+++ b/include/comphelper/multiinterfacecontainer3.hxx
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <com/sun/star/lang/EventObject.hpp>
+#include <comphelper/interfacecontainer3.hxx>
+#include <memory>
+#include <vector>
+
+namespace osl
+{
+class Mutex;
+}
+
+namespace comphelper
+{
+/**
+ A helper class to store interface references of different types.
+ This is a copy of the similar class at include/cppuhelper/interfacecontainer.h,
+ but now uses the improved comphelper::InterfaceContainer3.
+
+ @see OInterfaceIteratorHelper3
+ @see OInterfaceContainerHelper3
+ */
+template <class listener, class key, class equalImpl = std::equal_to<key>>
+class OMultiTypeInterfaceContainerHelperVar3
+{
+public:
+ /**
+ Create a container of interface containers.
+
+ @param rMutex the mutex to protect multi thread access.
+ The lifetime must be longer than the lifetime
+ of this object.
+ */
+ inline OMultiTypeInterfaceContainerHelperVar3(::osl::Mutex& rMutex_)
+ : rMutex(rMutex_)
+ {
+ }
+
+ /**
+ Return all id's under which at least one interface is added.
+ */
+ inline std::vector<key> getContainedTypes() const
+ {
+ ::osl::MutexGuard aGuard(rMutex);
+ std::vector<key> aInterfaceTypes;
+ aInterfaceTypes.reserve(m_aMap.size());
+ for (const auto& rPair : m_aMap)
+ // are interfaces added to this container?
+ if (rPair.second->getLength())
+ // yes, put the type in the array
+ aInterfaceTypes.push_back(rPair.first);
+ return aInterfaceTypes;
+ }
+
+ inline bool hasContainedTypes() const
+ {
+ ::osl::MutexGuard aGuard(rMutex);
+ for (const auto& rPair : m_aMap)
+ // are interfaces added to this container?
+ if (rPair.second->getLength())
+ return true;
+ return false;
+ }
+
+ /**
+ Return the container created under this key.
+ The InterfaceContainerHelper exists until the whole MultiTypeContainer is destroyed.
+ @return the container created under this key. If the container
+ was not created, null was returned.
+ */
+ inline OInterfaceContainerHelper3<listener>* getContainer(const key& rKey) const
+ {
+ ::osl::MutexGuard aGuard(rMutex);
+
+ auto iter = find(rKey);
+ if (iter != m_aMap.end())
+ return (*iter).second.get();
+ return nullptr;
+ }
+
+ /** Inserts an element into the container with the specified key.
+ The position is not specified, thus it is not specified in which order events are fired.
+
+ @attention
+ If you add the same interface more than once, then it will be added to the elements list
+ more than once and thus if you want to remove that interface from the list, you have to call
+ removeInterface() the same number of times.
+ In the latter case, you will also get events fired more than once (if the interface is a
+ listener interface).
+
+ @param rKey
+ the id of the container
+ @param r
+ interface to be added; it is allowed, to insert null or
+ the same interface more than once
+ @return
+ the new count of elements in the container
+ */
+ inline sal_Int32 addInterface(const key& rKey, const css::uno::Reference<listener>& rListener)
+ {
+ ::osl::MutexGuard aGuard(rMutex);
+ auto iter = find(rKey);
+ if (iter == m_aMap.end())
+ {
+ auto pLC = new OInterfaceContainerHelper3<listener>(rMutex);
+ m_aMap.emplace_back(rKey, pLC);
+ return pLC->addInterface(rListener);
+ }
+ else
+ return (*iter).second->addInterface(rListener);
+ }
+
+ /** Removes an element from the container with the specified key.
+ It uses interface equality to remove the interface.
+
+ @param rKey
+ the id of the container
+ @param rxIFace
+ interface to be removed
+ @return
+ the new count of elements in the container
+ */
+ inline sal_Int32 removeInterface(const key& rKey,
+ const css::uno::Reference<listener>& rListener)
+ {
+ ::osl::MutexGuard aGuard(rMutex);
+
+ // search container with id nUik
+ auto iter = find(rKey);
+ // container found?
+ if (iter != m_aMap.end())
+ return (*iter).second->removeInterface(rListener);
+
+ // no container with this id. Always return 0
+ return 0;
+ }
+
+ /**
+ Call disposing on all references in the container, that
+ support XEventListener. Then clears the container.
+ @param rEvt the event object which is passed during disposing() call
+ */
+ inline void disposeAndClear(const css::lang::EventObject& rEvt)
+ {
+ // create a copy, because do not fire event in a guarded section
+ InterfaceMap tempMap;
+ {
+ ::osl::MutexGuard aGuard(rMutex);
+ tempMap = std::move(m_aMap);
+ }
+
+ for (auto& rPair : tempMap)
+ rPair.second->disposeAndClear(rEvt);
+ }
+
+ /**
+ Remove all elements of all containers. Does not delete the container.
+ */
+ inline void clear()
+ {
+ ::osl::MutexGuard aGuard(rMutex);
+
+ for (const auto& rPair : m_aMap)
+ rPair.second->clear();
+ }
+
+ typedef key keyType;
+
+private:
+ typedef ::std::vector<std::pair<key, std::unique_ptr<OInterfaceContainerHelper3<listener>>>>
+ InterfaceMap;
+ InterfaceMap m_aMap;
+ ::osl::Mutex& rMutex;
+
+ typename InterfaceMap::const_iterator find(const key& rKey) const
+ {
+ auto iter = m_aMap.begin();
+ auto end = m_aMap.end();
+
+ while (iter != end)
+ {
+ equalImpl equal;
+ if (equal(iter->first, rKey))
+ break;
+ ++iter;
+ }
+ return iter;
+ }
+
+ OMultiTypeInterfaceContainerHelperVar3(const OMultiTypeInterfaceContainerHelperVar3&) = delete;
+ OMultiTypeInterfaceContainerHelperVar3& operator=(const OMultiTypeInterfaceContainerHelperVar3&)
+ = delete;
+};
+
+} // namespace comphelper
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/multiinterfacecontainer4.hxx b/include/comphelper/multiinterfacecontainer4.hxx
new file mode 100644
index 000000000..eeccd2092
--- /dev/null
+++ b/include/comphelper/multiinterfacecontainer4.hxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+#include <sal/config.h>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <comphelper/interfacecontainer4.hxx>
+#include <memory>
+#include <mutex>
+#include <vector>
+/** */ //for docpp
+namespace comphelper
+{
+/**
+ A helper class to store interface references of different types.
+ This is a copy of the code at include/comphelper/multiinterfacecontainer3.hxx,
+ except that it (a) uses std::mutex instead of osl::Mutex and (b) does not
+ store a reference to the mutex, but relies on the calling class to take
+ a lock around using it.
+ @see OInterfaceIteratorHelper3
+ @see OInterfaceContainerHelper3
+ */
+template <class key, class listener, class equalImpl = std::equal_to<key>>
+class OMultiTypeInterfaceContainerHelperVar4
+{
+public:
+ OMultiTypeInterfaceContainerHelperVar4() {}
+ /**
+ Return all id's under which at least one interface is added.
+ */
+ inline std::vector<key> getContainedTypes(std::unique_lock<std::mutex>& rGuard) const
+ {
+ std::vector<key> aInterfaceTypes;
+ aInterfaceTypes.reserve(m_aMap.size());
+ for (const auto& rPair : m_aMap)
+ // are interfaces added to this container?
+ if (rPair.second->getLength(rGuard))
+ // yes, put the type in the array
+ aInterfaceTypes.push_back(rPair.first);
+ return aInterfaceTypes;
+ }
+ inline bool hasContainedTypes() const
+ {
+ for (const auto& rPair : m_aMap)
+ // are interfaces added to this container?
+ if (rPair.second->getLength())
+ return true;
+ return false;
+ }
+ /**
+ Return the container created under this key.
+ The InterfaceContainerHelper exists until the whole MultiTypeContainer is destroyed.
+ @return the container created under this key. If the container
+ was not created, null was returned.
+ */
+ inline OInterfaceContainerHelper4<listener>* getContainer(const key& rKey) const
+ {
+ auto iter = find(rKey);
+ if (iter != m_aMap.end())
+ return (*iter).second.get();
+ return nullptr;
+ }
+ /** Inserts an element into the container with the specified key.
+ The position is not specified, thus it is not specified in which order events are fired.
+ @attention
+ If you add the same interface more than once, then it will be added to the elements list
+ more than once and thus if you want to remove that interface from the list, you have to call
+ removeInterface() the same number of times.
+ In the latter case, you will also get events fired more than once (if the interface is a
+ listener interface).
+ @param rKey
+ the id of the container
+ @param r
+ interface to be added; it is allowed, to insert null or
+ the same interface more than once
+ @return
+ the new count of elements in the container
+ */
+ inline sal_Int32 addInterface(::std::unique_lock<::std::mutex>& rGuard, const key& rKey,
+ const css::uno::Reference<listener>& rListener)
+ {
+ auto iter = find(rKey);
+ if (iter == m_aMap.end())
+ {
+ auto pLC = new OInterfaceContainerHelper4<listener>();
+ m_aMap.emplace_back(rKey, pLC);
+ return pLC->addInterface(rGuard, rListener);
+ }
+ else
+ return (*iter).second->addInterface(rGuard, rListener);
+ }
+ /** Removes an element from the container with the specified key.
+ It uses interface equality to remove the interface.
+ @param rKey
+ the id of the container
+ @param rxIFace
+ interface to be removed
+ @return
+ the new count of elements in the container
+ */
+ inline sal_Int32 removeInterface(::std::unique_lock<::std::mutex>& rGuard, const key& rKey,
+ const css::uno::Reference<listener>& rListener)
+ {
+ // search container with id nUik
+ auto iter = find(rKey);
+ // container found?
+ if (iter != m_aMap.end())
+ return (*iter).second->removeInterface(rGuard, rListener);
+ // no container with this id. Always return 0
+ return 0;
+ }
+ /**
+ Call disposing on all references in the container, that
+ support XEventListener. Then clears the container.
+ @param rEvt the event object which is passed during disposing() call
+ */
+ inline void disposeAndClear(std::unique_lock<std::mutex>& rGuard,
+ const css::lang::EventObject& rEvt)
+ {
+ // create a copy, because do not fire event in a guarded section
+ InterfaceMap tempMap;
+ {
+ tempMap = std::move(m_aMap);
+ }
+ rGuard.unlock();
+ for (auto& rPair : tempMap)
+ {
+ OInterfaceIteratorHelper4<listener> aIt(rGuard, *rPair.second);
+ while (aIt.hasMoreElements())
+ {
+ try
+ {
+ aIt.next()->disposing(rEvt);
+ }
+ catch (css::uno::RuntimeException&)
+ {
+ // be robust, if e.g. a remote bridge has disposed already.
+ // there is no way to delegate the error to the caller :o(.
+ }
+ }
+ }
+ }
+ /**
+ Remove all elements of all containers. Does not delete the container.
+ */
+ inline void clear()
+ {
+ for (const auto& rPair : m_aMap)
+ rPair.second->clear();
+ }
+ typedef key keyType;
+
+private:
+ typedef ::std::vector<std::pair<key, std::unique_ptr<OInterfaceContainerHelper4<listener>>>>
+ InterfaceMap;
+ InterfaceMap m_aMap;
+ typename InterfaceMap::const_iterator find(const key& rKey) const
+ {
+ auto iter = m_aMap.begin();
+ auto end = m_aMap.end();
+ while (iter != end)
+ {
+ equalImpl equal;
+ if (equal(iter->first, rKey))
+ break;
+ ++iter;
+ }
+ return iter;
+ }
+ OMultiTypeInterfaceContainerHelperVar4(const OMultiTypeInterfaceContainerHelperVar4&) = delete;
+ OMultiTypeInterfaceContainerHelperVar4& operator=(const OMultiTypeInterfaceContainerHelperVar4&)
+ = delete;
+};
+} // namespace comphelper
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/namecontainer.hxx b/include/comphelper/namecontainer.hxx
new file mode 100644
index 000000000..616b07f1a
--- /dev/null
+++ b/include/comphelper/namecontainer.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_NAMECONTAINER_HXX
+#define INCLUDED_COMPHELPER_NAMECONTAINER_HXX
+
+#include <com/sun/star/uno/Type.h>
+#include <com/sun/star/uno/Reference.h>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::container
+{
+class XNameContainer;
+}
+
+namespace comphelper
+{
+COMPHELPER_DLLPUBLIC css::uno::Reference<css::container::XNameContainer>
+NameContainer_createInstance(const css::uno::Type& aType);
+}
+
+#endif // INCLUDED_COMPHELPER_NAMECONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/namedvaluecollection.hxx b/include/comphelper/namedvaluecollection.hxx
new file mode 100644
index 000000000..b92646e40
--- /dev/null
+++ b/include/comphelper/namedvaluecollection.hxx
@@ -0,0 +1,322 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_NAMEDVALUECOLLECTION_HXX
+#define INCLUDED_COMPHELPER_NAMEDVALUECOLLECTION_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <vector>
+#include <unordered_map>
+
+namespace comphelper
+{
+
+
+ // = NamedValueCollection
+
+ /** a collection of named values, packed in various formats.
+ */
+ class COMPHELPER_DLLPUBLIC NamedValueCollection
+ {
+ std::unordered_map< OUString, css::uno::Any > maValues;
+ public:
+ NamedValueCollection() = default;
+
+ NamedValueCollection( const NamedValueCollection& _rCopySource ) = default;
+ NamedValueCollection(NamedValueCollection&& _rCopySource) noexcept = default;
+
+ NamedValueCollection& operator=( const NamedValueCollection& i_rCopySource ) = default;
+ NamedValueCollection& operator=(NamedValueCollection&& i_rCopySource) noexcept = default;
+
+ /** constructs a collection
+ @param _rElements
+ the wrapped elements of the collection. The @c Any might contain a sequence of
+ property values, a sequence of named values, or directly a property value or named value.
+ All other cases are worth an assertion in non-product builds.
+ */
+ NamedValueCollection( const css::uno::Any& _rElements );
+
+ /** constructs a collection
+ @param _rArguments
+ a sequence of Any's containing either PropertyValue's or NamedValue's.
+ */
+ NamedValueCollection( const css::uno::Sequence< css::uno::Any >& _rArguments );
+
+ /** constructs a collection
+ @param _rArguments
+ a sequence of PropertyValues's
+ */
+ NamedValueCollection( const css::uno::Sequence< css::beans::PropertyValue >& _rArguments );
+
+ /** constructs a collection
+ @param _rArguments
+ a sequence of NamedValue's
+ */
+ NamedValueCollection( const css::uno::Sequence< css::beans::NamedValue >& _rArguments );
+
+ void assign( const css::uno::Sequence< css::uno::Any >& _rArguments )
+ {
+ impl_assign( _rArguments );
+ }
+
+ void clear()
+ {
+ impl_assign( css::uno::Sequence< css::beans::NamedValue >() );
+ }
+
+ /** determines whether or not named values can be extracted from the given value
+
+ @return
+ true if and only if the given @c Any contains a @c NamedValue, a
+ @c PropertyValue, or a sequence thereof.
+ */
+ static bool canExtractFrom( css::uno::Any const & i_value );
+
+ /// returns the number of elements in the collection
+ size_t size() const;
+
+ /// determines whether the collection is empty
+ bool empty() const;
+
+ /** returns the names of all elements in the collection
+ */
+ ::std::vector< OUString >
+ getNames() const;
+
+ /** merges the content of another collection into @c this
+ @param _rAdditionalValues
+ the collection whose values are to be merged
+ @param _bOverwriteExisting
+ defines whether or not elements which are already present in @c this
+ should be overwritten (true) or preserved (false).
+ @return @c *this
+ */
+ NamedValueCollection&
+ merge(
+ const NamedValueCollection& _rAdditionalValues,
+ bool _bOverwriteExisting
+ );
+
+ /** retrieves a value with a given name from the collection, if it is present
+
+ @param _pAsciiValueName
+ the ASCII name of the value to retrieve
+
+ @param _out_rValue
+ is the output parameter taking the desired value upon successful return. If
+ a value with the given name is not present in the collection, or if a wrong-typed
+ value is present, then this parameter will not be touched.
+
+ @retval
+ true if there is a value with the given name, which could successfully
+ be extracted. In this case, @c _out_rValue will contain the requested
+ value.
+ @retval
+ false, if there is no value with the given name.
+
+ @throws IllegalArgumentException
+ in case there is a value with the given name, but it cannot legally assigned to
+ _out_rValue.
+ */
+ template < typename VALUE_TYPE >
+ bool get_ensureType( const OUString& _rValueName, VALUE_TYPE& _out_rValue ) const
+ {
+ return get_ensureType( _rValueName, &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() );
+ }
+
+ /** retrieves a value with a given name, or defaults it to a given value, if it's not present
+ in the collection
+ */
+ template < typename VALUE_TYPE >
+ VALUE_TYPE getOrDefault( const OUString& _rValueName, const VALUE_TYPE& _rDefault ) const
+ {
+ VALUE_TYPE retVal( _rDefault );
+ get_ensureType( _rValueName, retVal );
+ return retVal;
+ }
+
+ /** Retrieves a value with a given name, or defaults it to a given value, if it's not present
+ in the collection.
+ For when you only need a single value from a Sequence<PropertyValue>.
+ */
+ template < typename VALUE_TYPE >
+ static VALUE_TYPE getOrDefault( const css::uno::Sequence<css::beans::PropertyValue> & rPropSeq,
+ std::u16string_view _rValueName, const VALUE_TYPE& _rDefault )
+ {
+ VALUE_TYPE retVal( _rDefault );
+ get_ensureType( rPropSeq, _rValueName, &retVal, ::cppu::UnoType< VALUE_TYPE >::get() );
+ return retVal;
+ }
+
+ /** retrieves a (untyped) value with a given name
+
+ If the collection does not contain a value with the given name, an empty
+ Any is returned.
+ */
+ const css::uno::Any& get( const OUString& _rValueName ) const
+ {
+ return impl_get( _rValueName );
+ }
+
+ /** retrieves a (untyped) value with a given name. For when you only need a single value from a Sequence<PropertyValue>.
+
+ If the collection does not contain a value with the given name, an empty
+ Any is returned.
+ */
+ static const css::uno::Any& get( const css::uno::Sequence<css::beans::PropertyValue>& rPropSeq, std::u16string_view _rValueName );
+
+ /// determines whether a value with a given name is present in the collection
+ bool has( const OUString& _rValueName ) const
+ {
+ return impl_has( _rValueName );
+ }
+
+ /** puts a value into the collection
+
+ @return true if and only if a value was already present previously, in
+ which case it has been overwritten.
+ */
+ template < typename VALUE_TYPE >
+ bool put( const OUString& _rValueName, const VALUE_TYPE& _rValue )
+ {
+ return impl_put( _rValueName, css::uno::Any( _rValue ) );
+ }
+
+ bool put( const OUString& _rValueName, const css::uno::Any& _rValue )
+ {
+ return impl_put( _rValueName, _rValue );
+ }
+
+ /** removes the value with the given name from the collection
+
+ @return true if and only if a value with the given name existed in the collection.
+ */
+ bool remove( const OUString& _rValueName )
+ {
+ return impl_remove( _rValueName );
+ }
+
+ /** transforms the collection to a sequence of PropertyValues
+
+ @return
+ the number of elements in the sequence
+ */
+ sal_Int32 operator >>= ( css::uno::Sequence< css::beans::PropertyValue >& _out_rValues ) const;
+
+ /** transforms the collection to a sequence of NamedValues
+
+ @return
+ the number of elements in the sequence
+ */
+ sal_Int32 operator >>= ( css::uno::Sequence< css::beans::NamedValue >& _out_rValues ) const;
+
+ /** transforms the collection into a sequence of PropertyValues
+ */
+ css::uno::Sequence< css::beans::PropertyValue >
+ getPropertyValues() const
+ {
+ css::uno::Sequence< css::beans::PropertyValue > aValues;
+ *this >>= aValues;
+ return aValues;
+ }
+
+ /** returns a Sequence< Any >, containing PropertyValues
+ */
+ css::uno::Sequence< css::uno::Any >
+ getWrappedPropertyValues() const
+ {
+ return impl_wrap< css::beans::PropertyValue >();
+ }
+
+ /** returns a Sequence< Any >, containing NamedValues
+ */
+ css::uno::Sequence< css::uno::Any >
+ getWrappedNamedValues() const
+ {
+ return impl_wrap< css::beans::NamedValue >();
+ }
+
+ /** transforms the collection into a sequence of NamedValues
+ */
+ css::uno::Sequence< css::beans::NamedValue >
+ getNamedValues() const
+ {
+ css::uno::Sequence< css::beans::NamedValue > aValues;
+ *this >>= aValues;
+ return aValues;
+ }
+
+ private:
+ void impl_assign( const css::uno::Any& i_rWrappedElements );
+ void impl_assign( const css::uno::Sequence< css::uno::Any >& _rArguments );
+ void impl_assign( const css::uno::Sequence< css::beans::PropertyValue >& _rArguments );
+ void impl_assign( const css::uno::Sequence< css::beans::NamedValue >& _rArguments );
+
+ bool get_ensureType(
+ const OUString& _rValueName,
+ void* _pValueLocation,
+ const css::uno::Type& _rExpectedValueType
+ ) const;
+
+ static bool get_ensureType(
+ const css::uno::Sequence<css::beans::PropertyValue> & rPropSeq,
+ std::u16string_view _rValueName,
+ void* _pValueLocation,
+ const css::uno::Type& _rExpectedValueType
+ );
+
+ const css::uno::Any&
+ impl_get( const OUString& _rValueName ) const;
+
+ bool impl_has( const OUString& _rValueName ) const;
+
+ bool impl_put( const OUString& _rValueName, const css::uno::Any& _rValue );
+
+ bool impl_remove( const OUString& _rValueName );
+
+ template< class VALUE_TYPE >
+ css::uno::Sequence< css::uno::Any > impl_wrap() const
+ {
+ css::uno::Sequence< VALUE_TYPE > aValues;
+ *this >>= aValues;
+ css::uno::Sequence< css::uno::Any > aWrappedValues( aValues.getLength() );
+
+ css::uno::Any* pO = aWrappedValues.getArray();
+ const VALUE_TYPE* pV = aValues.getConstArray();
+ const sal_Int32 nLen = aValues.getLength();
+ for( sal_Int32 i = 0; i < nLen; ++i )
+ *(pO++) = css::uno::Any( *(pV++) );
+
+ return aWrappedValues;
+ }
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_NAMEDVALUECOLLECTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/newarray.hxx b/include/comphelper/newarray.hxx
new file mode 100644
index 000000000..d3eaccd77
--- /dev/null
+++ b/include/comphelper/newarray.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_NEWARRAY_HXX
+#define INCLUDED_COMPHELPER_NEWARRAY_HXX
+
+#include <limits>
+#include <new>
+#include <stddef.h>
+
+namespace comphelper {
+
+template<typename T> T *
+newArray_null(size_t const n) noexcept
+{
+ if ((::std::numeric_limits<size_t>::max() / sizeof(T)) <= n) {
+ return nullptr;
+ }
+ return new (::std::nothrow) T[n];
+}
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_NEWARRAY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/numberedcollection.hxx b/include/comphelper/numberedcollection.hxx
new file mode 100644
index 000000000..3dbb1f534
--- /dev/null
+++ b/include/comphelper/numberedcollection.hxx
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_NUMBEREDCOLLECTION_HXX
+#define INCLUDED_COMPHELPER_NUMBEREDCOLLECTION_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/implbase.hxx>
+
+#include <unordered_map>
+#include <mutex>
+#include <vector>
+
+namespace com::sun::star::uno { class XInterface; }
+
+namespace comphelper{
+
+/** @short defines a collection of UNO components, where every component will get its own unique number.
+
+ @descr Such number will be unique at runtime only... but it supports fragmentation.
+ Note: This collection uses weak references only to know her components.
+ So lifetime of these components must be controlled outside.
+
+ @threadsafe
+ */
+class COMPHELPER_DLLPUBLIC NumberedCollection final :
+ public ::cppu::WeakImplHelper< css::frame::XUntitledNumbers >
+{
+
+ // types, const
+ private:
+
+ struct TNumberedItem
+ {
+ css::uno::WeakReference< css::uno::XInterface > xItem;
+ ::sal_Int32 nNumber;
+ };
+
+ typedef std::unordered_map<
+ sal_IntPtr,
+ TNumberedItem > TNumberedItemHash;
+
+ typedef ::std::vector< sal_IntPtr > TDeadItemList;
+
+
+ // interface
+ public:
+
+
+ /** @short lightweight constructor.
+ */
+ NumberedCollection();
+
+
+ /** @short free all internally used resources.
+ */
+ virtual ~NumberedCollection() override;
+
+
+ /** set an outside component which uses this container and must be set
+ as source of all broadcasted messages, exceptions.
+
+ It's holded weak only so we do not need any complex dispose sessions.
+
+ Note: Passing NULL as parameter will be allowed. It will reset the internal
+ member reference only.
+
+ @param xOwner
+ the new owner of this collection.
+ */
+ void setOwner (const css::uno::Reference< css::uno::XInterface >& xOwner);
+
+
+ /** set the localized prefix to be used for untitled components.
+
+ Localization has to be done outside. This container will return
+ those value then. There are no further checks. Its up to you to define
+ a suitable string here :-)
+
+ @param sPrefix
+ the new prefix for untitled components.
+ */
+ void setUntitledPrefix(const OUString& sPrefix);
+
+
+ /** @see css.frame.XUntitledNumbers */
+ virtual ::sal_Int32 SAL_CALL leaseNumber(const css::uno::Reference< css::uno::XInterface >& xComponent) override;
+
+
+ /** @see css.frame.XUntitledNumbers */
+ virtual void SAL_CALL releaseNumber(::sal_Int32 nNumber) override;
+
+
+ /** @see css.frame.XUntitledNumbers */
+ virtual void SAL_CALL releaseNumberForComponent(const css::uno::Reference< css::uno::XInterface >& xComponent) override;
+
+
+ /** @see css.frame.XUntitledNumbers */
+ virtual OUString SAL_CALL getUntitledPrefix() override;
+
+
+ // internal
+ private:
+
+
+ /** @short tries to find a unique number not already used within this collection.
+
+ @descr It reuses the smallest number which isn't used by any component
+ of this collection. (fragmentation!) If collection is full (means there
+ is no free number) the special value INVALID_NUMBER will be returned.
+
+ @note Those method can't be called within a multithreaded environment.
+ Because such number won't be "reserved" for the call of these method
+ it can happen that two calls returns the same number (reasoned by the fact that first call
+ doesn't used the returned number already.
+
+ So the outside code has to make sure that retrieving and using of those numbers
+ will be an atomic operation.
+
+ @return a unique number or special value INVALID_NUMBER if collection is full.
+ */
+ ::sal_Int32 impl_searchFreeNumber ();
+
+ static void impl_cleanUpDeadItems ( TNumberedItemHash& lItems ,
+ const TDeadItemList& lDeadItems);
+
+
+ // member
+ private:
+
+ /// localized string to be used for untitled components
+ OUString m_sUntitledPrefix;
+
+ /// cache of all "leased numbers" and its bound components
+ TNumberedItemHash m_lComponents;
+
+ /// used as source of broadcasted messages or exceptions (can be null !)
+ css::uno::WeakReference< css::uno::XInterface > m_xOwner;
+
+ std::mutex m_aMutex;
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_NUMBEREDCOLLECTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/numbers.hxx b/include/comphelper/numbers.hxx
new file mode 100644
index 000000000..e486bac0b
--- /dev/null
+++ b/include/comphelper/numbers.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_NUMBERS_HXX
+#define INCLUDED_COMPHELPER_NUMBERS_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::util { class XNumberFormats; }
+namespace com::sun::star::util { class XNumberFormatter; }
+
+namespace comphelper
+{
+
+ /// returns the css::util::NumberFormat of the given key under the given formats
+ COMPHELPER_DLLPUBLIC sal_Int16 getNumberFormatType(const css::uno::Reference<css::util::XNumberFormats>& xFormats, sal_Int32 nKey);
+
+ /// returns the css::util::NumberFormat of the given key under the given formatter
+ COMPHELPER_DLLPUBLIC sal_Int16 getNumberFormatType(const css::uno::Reference<css::util::XNumberFormatter>& xFormatter, sal_Int32 nKey);
+
+ /// returns the decimals of the given numeric number formatunder the given formats
+ COMPHELPER_DLLPUBLIC css::uno::Any getNumberFormatDecimals(const css::uno::Reference<css::util::XNumberFormats>& xFormats, sal_Int32 nKey);
+
+ /** retrieves the value of a given property for a given format key, relating to a given formatter
+ */
+ COMPHELPER_DLLPUBLIC css::uno::Any getNumberFormatProperty(
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxFormatter,
+ sal_Int32 _nKey,
+ const OUString& _rPropertyName
+ );
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_NUMBERS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/ofopxmlhelper.hxx b/include/comphelper/ofopxmlhelper.hxx
new file mode 100644
index 000000000..fe778bf1e
--- /dev/null
+++ b/include/comphelper/ofopxmlhelper.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_OFOPXMLHELPER_HXX
+#define INCLUDED_COMPHELPER_OFOPXMLHELPER_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <com/sun/star/uno/Sequence.h>
+
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::beans { struct StringPair; }
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::io { class XOutputStream; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+
+namespace comphelper::OFOPXMLHelper {
+
+ // returns sequence of elements, where each element is described by sequence of tags,
+ // where each tag is described by StringPair ( First - name, Second - value )
+ // the first tag of each element sequence must be "Id"
+ /// @throws css::uno::Exception
+ COMPHELPER_DLLPUBLIC
+ css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > >
+ ReadRelationsInfoSequence(
+ const css::uno::Reference< css::io::XInputStream >& xInStream,
+ std::u16string_view aStreamName,
+ const css::uno::Reference< css::uno::XComponentContext >& rContext );
+
+ // returns sequence containing two entries of type sequence<StringPair>
+ // the first sequence describes "Default" elements, where each element is described
+ // by StringPair object ( First - Extension, Second - ContentType )
+ // the second sequence describes "Override" elements, where each element is described
+ // by StringPair object ( First - PartName, Second - ContentType )
+ /// @throws css::uno::Exception
+ COMPHELPER_DLLPUBLIC
+ css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > >
+ ReadContentTypeSequence(
+ const css::uno::Reference< css::io::XInputStream >& xInStream,
+ const css::uno::Reference< css::uno::XComponentContext >& rContext );
+
+ // returns the ContentType for the given name, or empty when not found.
+ // rContentTypes is a sequence containing two entries of type sequence<StringPair>
+ // the first sequence describes "Default" elements, where each element is described
+ // by StringPair object ( First - Extension, Second - ContentType )
+ // the second sequence describes "Override" elements, where each element is described
+ // by StringPair object ( First - PartName, Second - ContentType )
+ // The "Override" sequence is searched first before falling back on "Default".
+ COMPHELPER_DLLPUBLIC
+ OUString
+ GetContentTypeByName(const css::uno::Sequence<css::uno::Sequence<css::beans::StringPair>>& rContentTypes,
+ const OUString& rFilename);
+
+ // writes sequence of elements, where each element is described by sequence of tags,
+ // where each tag is described by StringPair ( First - name, Second - value )
+ // the first tag of each element sequence must be "Id"
+ /// @throws css::uno::Exception
+ COMPHELPER_DLLPUBLIC
+ void WriteRelationsInfoSequence(
+ const css::uno::Reference< css::io::XOutputStream >& xOutStream,
+ const css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > >& aSequence,
+ const css::uno::Reference< css::uno::XComponentContext >& rContext );
+
+ // writes two entries of type sequence<StringPair>
+ // the first sequence describes "Default" elements, where each element is described
+ // by StringPair object ( First - Extension, Second - ContentType )
+ // the second sequence describes "Override" elements, where each element is described
+ // by StringPair object ( First - PartName, Second - ContentType )
+ /// @throws css::uno::Exception
+ COMPHELPER_DLLPUBLIC
+ void WriteContentSequence(
+ const css::uno::Reference< css::io::XOutputStream >& xOutStream,
+ const css::uno::Sequence< css::beans::StringPair >& aDefaultsSequence,
+ const css::uno::Sequence< css::beans::StringPair >& aOverridesSequence,
+ const css::uno::Reference< css::uno::XComponentContext >& rContext );
+
+} // namespace comphelper::OFOPXMLHelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/oslfile2streamwrap.hxx b/include/comphelper/oslfile2streamwrap.hxx
new file mode 100644
index 000000000..c80c7b344
--- /dev/null
+++ b/include/comphelper/oslfile2streamwrap.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_OSLFILE2STREAMWRAP_HXX
+#define INCLUDED_COMPHELPER_OSLFILE2STREAMWRAP_HXX
+
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <mutex>
+
+namespace osl { class File; }
+
+namespace comphelper
+{
+
+// Stream to read and write data, based on File
+
+class OSLInputStreamWrapper final : public ::cppu::WeakImplHelper<css::io::XInputStream>
+{
+public:
+ COMPHELPER_DLLPUBLIC OSLInputStreamWrapper(::osl::File& _rStream);
+
+private:
+ virtual ~OSLInputStreamWrapper() override;
+
+// css::io::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) override;
+ virtual sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) override;
+ virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override;
+ virtual sal_Int32 SAL_CALL available() override;
+ virtual void SAL_CALL closeInput() override;
+
+ std::mutex m_aMutex;
+ ::osl::File* m_pFile;
+};
+
+
+// data sink for the files
+
+class OSLOutputStreamWrapper final : public ::cppu::WeakImplHelper<css::io::XOutputStream>
+{
+public:
+ COMPHELPER_DLLPUBLIC OSLOutputStreamWrapper(::osl::File& _rFile);
+
+private:
+ virtual ~OSLOutputStreamWrapper() override;
+
+// css::io::XOutputStream
+ virtual void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 >& aData) override;
+ virtual void SAL_CALL flush() override;
+ virtual void SAL_CALL closeOutput() override;
+
+ ::osl::File& rFile;
+};
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_OSLFILE2STREAMWRAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/parallelsort.hxx b/include/comphelper/parallelsort.hxx
new file mode 100644
index 000000000..94d86e0d1
--- /dev/null
+++ b/include/comphelper/parallelsort.hxx
@@ -0,0 +1,373 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_PARALLELSORT_HXX
+#define INCLUDED_COMPHELPER_PARALLELSORT_HXX
+
+#include <comphelper/threadpool.hxx>
+#include <tools/cpuid.hxx>
+
+#include <memory>
+#include <iterator>
+#include <thread>
+#include <algorithm>
+#include <cmath>
+#include <random>
+#include <functional>
+#include <iostream>
+#include <chrono>
+
+namespace comphelper
+{
+const size_t nThreadCountGlobal = std::thread::hardware_concurrency();
+const bool bHyperThreadingActive = cpuid::hasHyperThreading();
+static comphelper::ThreadPool& rTPool(comphelper::ThreadPool::getSharedOptimalPool());
+
+static thread_local std::mt19937 aGenerator{ std::random_device{}() };
+
+#define PARALLELSORT_ENABLEPZ 0
+
+namespace
+{
+class ProfileZone
+{
+public:
+#if PARALLELSORT_ENABLEPZ
+ ProfileZone(const char* pTag)
+ : maTag(pTag)
+ , maStart(std::chrono::steady_clock::now())
+ , mbFinished(false)
+ {
+ }
+
+ ~ProfileZone()
+ {
+ if (!mbFinished)
+ showTimeElapsed();
+ }
+
+ void stop()
+ {
+ showTimeElapsed();
+ mbFinished = true;
+ }
+#else
+ ProfileZone(const char* /*pTag*/)
+ : mbDummy(true)
+ {
+ }
+
+ void stop()
+ {
+ // Avoid loplugin:staticmethods, loplugin:staticaccess errors
+ (void)mbDummy;
+ }
+#endif
+
+private:
+#if PARALLELSORT_ENABLEPZ
+
+ void showTimeElapsed()
+ {
+ auto end = std::chrono::steady_clock::now();
+ size_t elapsed
+ = std::chrono::duration_cast<std::chrono::milliseconds>(end - maStart).count();
+ std::cout << maTag << " : " << elapsed << " ms" << std::endl << std::flush;
+ }
+
+ std::string maTag;
+ std::chrono::steady_clock::time_point maStart;
+ bool mbFinished;
+#else
+ bool mbDummy;
+
+#endif
+};
+
+class ParallelRunner
+{
+ class Executor final : public comphelper::ThreadTask
+ {
+ public:
+ Executor(const std::shared_ptr<comphelper::ThreadTaskTag>& rTag,
+ std::function<void()> aFunc)
+ : comphelper::ThreadTask(rTag)
+ , maFunc(std::move(aFunc))
+ {
+ }
+
+ virtual void doWork() override { maFunc(); }
+
+ private:
+ const std::function<void()> maFunc;
+ };
+
+public:
+ ParallelRunner() { maTag = comphelper::ThreadPool::createThreadTaskTag(); }
+
+ void enqueue(std::function<void()> aFunc)
+ {
+ rTPool.pushTask(std::make_unique<Executor>(maTag, aFunc));
+ }
+
+ void wait() { rTPool.waitUntilDone(maTag, false); }
+
+private:
+ std::shared_ptr<comphelper::ThreadTaskTag> maTag;
+};
+
+constexpr size_t nMaxTreeArraySize = 64;
+
+size_t lcl_round_down_pow2(size_t nNum)
+{
+ size_t nPow2;
+ for (nPow2 = 1; nPow2 <= nNum; nPow2 <<= 1)
+ ;
+ return std::min((nPow2 >> 1), nMaxTreeArraySize);
+}
+
+template <class RandItr> struct Sampler
+{
+ using ValueType = typename std::iterator_traits<RandItr>::value_type;
+
+ static void sample(RandItr aBegin, RandItr aEnd, ValueType* pSamples, size_t nSamples,
+ size_t /*nParallelism*/)
+ {
+ ProfileZone aZone("\tsample()");
+ assert(aBegin <= aEnd);
+ size_t nLen = static_cast<std::size_t>(aEnd - aBegin);
+ assert(std::mt19937::max() >= nLen);
+
+ for (size_t nIdx = 0; nIdx < nSamples; ++nIdx)
+ {
+ size_t nSel = aGenerator() % nLen--;
+ using namespace std;
+ swap(*(aBegin + nSel), *(aBegin + nLen));
+ pSamples[nIdx] = *(aBegin + nLen);
+ }
+ }
+};
+
+template <class RandItr, class Compare> class Binner
+{
+ using ValueType = typename std::iterator_traits<RandItr>::value_type;
+
+ const size_t mnTreeArraySize;
+ const size_t mnDividers;
+ constexpr static size_t mnMaxStaticSize = 1024 * 50;
+ uint8_t maLabels[mnMaxStaticSize];
+ ValueType maDividers[nMaxTreeArraySize];
+ std::unique_ptr<uint8_t[]> pLabels;
+ size_t maSepBinEnds[nMaxTreeArraySize * nMaxTreeArraySize];
+ bool mbThreaded;
+
+public:
+ size_t maBinEnds[nMaxTreeArraySize];
+
+ Binner(const ValueType* pSamples, size_t nSamples, size_t nBins, bool bThreaded)
+ : mnTreeArraySize(lcl_round_down_pow2(nBins))
+ , mnDividers(mnTreeArraySize - 1)
+ , mbThreaded(bThreaded)
+ {
+ assert((nSamples % mnTreeArraySize) == 0);
+ assert(mnTreeArraySize <= nMaxTreeArraySize);
+ std::fill(maBinEnds, maBinEnds + mnTreeArraySize, 0);
+ std::fill(maSepBinEnds, maSepBinEnds + mnTreeArraySize * mnTreeArraySize, 0);
+ fillTreeArray(1, pSamples, pSamples + nSamples);
+ }
+
+ void fillTreeArray(size_t nPos, const ValueType* pLow, const ValueType* pHigh)
+ {
+ assert(pLow <= pHigh);
+ const ValueType* pMid = pLow + (pHigh - pLow) / 2;
+ maDividers[nPos] = *pMid;
+
+ if (2 * nPos < mnDividers) // So that 2*nPos < mnTreeArraySize
+ {
+ fillTreeArray(2 * nPos, pLow, pMid);
+ fillTreeArray(2 * nPos + 1, pMid + 1, pHigh);
+ }
+ }
+
+ constexpr inline size_t findBin(const ValueType& rVal, Compare& aComp)
+ {
+ size_t nIdx = 1;
+ while (nIdx <= mnDividers)
+ nIdx = ((nIdx << 1) + aComp(maDividers[nIdx], rVal));
+ return (nIdx - mnTreeArraySize);
+ }
+
+ void label(const RandItr aBegin, const RandItr aEnd, Compare& aComp)
+ {
+ ProfileZone aZoneSetup("\tlabel():setup");
+ size_t nLen = static_cast<std::size_t>(aEnd - aBegin);
+ if (nLen > mnMaxStaticSize)
+ pLabels = std::make_unique<uint8_t[]>(nLen);
+ uint8_t* pLabelsRaw = (nLen > mnMaxStaticSize) ? pLabels.get() : maLabels;
+ aZoneSetup.stop();
+ ProfileZone aZoneFindBins("\tFindBins()");
+ if (mbThreaded)
+ {
+ ParallelRunner aPRunner;
+ const size_t nBins = mnTreeArraySize;
+ for (size_t nTIdx = 0; nTIdx < nBins; ++nTIdx)
+ {
+ aPRunner.enqueue([this, nTIdx, nBins, nLen, aBegin, pLabelsRaw, &aComp] {
+ ProfileZone aZoneIn("\t\tFindBinsThreaded()");
+ size_t nBinEndsStartIdx = nTIdx * mnTreeArraySize;
+ size_t* pBinEnds = maSepBinEnds + nBinEndsStartIdx;
+ size_t aBinEndsF[nMaxTreeArraySize] = { 0 };
+ for (size_t nIdx = nTIdx; nIdx < nLen; nIdx += nBins)
+ {
+ size_t nBinIdx = findBin(*(aBegin + nIdx), aComp);
+ pLabelsRaw[nIdx] = static_cast<uint8_t>(nBinIdx);
+ ++aBinEndsF[nBinIdx];
+ }
+
+ for (size_t nIdx = 0; nIdx < mnTreeArraySize; ++nIdx)
+ pBinEnds[nIdx] = aBinEndsF[nIdx];
+ });
+ }
+
+ aPRunner.wait();
+
+ // Populate maBinEnds from maSepBinEnds
+ for (size_t nTIdx = 0; nTIdx < mnTreeArraySize; ++nTIdx)
+ {
+ for (size_t nSepIdx = 0; nSepIdx < mnTreeArraySize; ++nSepIdx)
+ maBinEnds[nTIdx] += maSepBinEnds[nSepIdx * mnTreeArraySize + nTIdx];
+ }
+ }
+ else
+ {
+ uint8_t* pLabel = pLabelsRaw;
+ for (RandItr aItr = aBegin; aItr != aEnd; ++aItr)
+ {
+ size_t nBinIdx = findBin(*aItr, aComp);
+ *pLabel++ = nBinIdx;
+ ++maBinEnds[nBinIdx];
+ }
+ }
+
+ aZoneFindBins.stop();
+
+ size_t nSum = 0;
+ // Store each bin's starting position in maBinEnds array for now.
+ for (size_t nIdx = 0; nIdx < mnTreeArraySize; ++nIdx)
+ {
+ size_t nSize = maBinEnds[nIdx];
+ maBinEnds[nIdx] = nSum;
+ nSum += nSize;
+ }
+
+ // Now maBinEnds has end positions of each bin.
+ }
+
+ void bin(const RandItr aBegin, const RandItr aEnd, ValueType* pOut)
+ {
+ ProfileZone aZone("\tbin()");
+ const size_t nLen = static_cast<std::size_t>(aEnd - aBegin);
+ uint8_t* pLabelsRaw = (nLen > mnMaxStaticSize) ? pLabels.get() : maLabels;
+ size_t nIdx;
+ for (nIdx = 0; nIdx < nLen; ++nIdx)
+ {
+ pOut[maBinEnds[pLabelsRaw[nIdx]]++] = *(aBegin + nIdx);
+ }
+ }
+};
+
+template <class RandItr, class Compare = std::less<>>
+void s3sort(const RandItr aBegin, const RandItr aEnd, Compare aComp = Compare(),
+ bool bThreaded = true)
+{
+ static size_t nThreadCount = nThreadCountGlobal;
+
+ constexpr size_t nBaseCaseSize = 1024;
+ const std::size_t nLen = static_cast<std::size_t>(aEnd - aBegin);
+ if (nLen < nBaseCaseSize)
+ {
+ std::sort(aBegin, aEnd, aComp);
+ return;
+ }
+
+ using ValueType = typename std::iterator_traits<RandItr>::value_type;
+ auto pOut = std::make_unique<ValueType[]>(nLen);
+
+ const size_t nBins = lcl_round_down_pow2(nThreadCount);
+ const size_t nOverSamplingFactor = std::max(1.0, std::sqrt(static_cast<double>(nLen) / 64));
+ const size_t nSamples = nOverSamplingFactor * nBins;
+ auto aSamples = std::make_unique<ValueType[]>(nSamples);
+ ProfileZone aZoneSampleAnsSort("SampleAndSort");
+ // Select samples and sort them
+ Sampler<RandItr>::sample(aBegin, aEnd, aSamples.get(), nSamples, nBins);
+ std::sort(aSamples.get(), aSamples.get() + nSamples, aComp);
+ aZoneSampleAnsSort.stop();
+
+ if (!aComp(aSamples[0], aSamples[nSamples - 1]))
+ {
+ // All samples are equal, fallback to standard sort.
+ std::sort(aBegin, aEnd, aComp);
+ return;
+ }
+
+ ProfileZone aZoneBinner("Binner");
+ // Create and populate bins using pOut from input iterators.
+ Binner<RandItr, Compare> aBinner(aSamples.get(), nSamples, nBins, bThreaded);
+ aBinner.label(aBegin, aEnd, aComp);
+ aBinner.bin(aBegin, aEnd, pOut.get());
+ aZoneBinner.stop();
+
+ ProfileZone aZoneSortBins("SortBins");
+ ValueType* pOutRaw = pOut.get();
+ if (bThreaded)
+ {
+ ParallelRunner aPRunner;
+ // Sort the bins separately.
+ for (size_t nBinIdx = 0, nBinStart = 0; nBinIdx < nBins; ++nBinIdx)
+ {
+ size_t nBinEnd = aBinner.maBinEnds[nBinIdx];
+ aPRunner.enqueue([pOutRaw, nBinStart, nBinEnd, &aComp] {
+ std::sort(pOutRaw + nBinStart, pOutRaw + nBinEnd, aComp);
+ });
+
+ nBinStart = nBinEnd;
+ }
+
+ aPRunner.wait();
+ }
+ else
+ {
+ for (size_t nBinIdx = 0, nBinStart = 0; nBinIdx < nBins; ++nBinIdx)
+ {
+ auto nBinEnd = aBinner.maBinEnds[nBinIdx];
+ std::sort(pOutRaw + nBinStart, pOutRaw + nBinEnd, aComp);
+ nBinStart = nBinEnd;
+ }
+ }
+
+ aZoneSortBins.stop();
+
+ // Move the sorted array to the array specified by input iterators.
+ std::move(pOutRaw, pOutRaw + nLen, aBegin);
+}
+
+} // anonymous namespace
+
+template <class RandItr, class Compare = std::less<>>
+void parallelSort(const RandItr aBegin, const RandItr aEnd, Compare aComp = Compare())
+{
+ assert(aBegin <= aEnd);
+ s3sort(aBegin, aEnd, aComp);
+}
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_PARALLELSORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/processfactory.hxx b/include/comphelper/processfactory.hxx
new file mode 100644
index 000000000..0f74e5b13
--- /dev/null
+++ b/include/comphelper/processfactory.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROCESSFACTORY_HXX
+#define INCLUDED_COMPHELPER_PROCESSFACTORY_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::lang {
+ class XMultiServiceFactory;
+}
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace comphelper
+{
+
+/**
+ * This function set the process service factory.
+ */
+COMPHELPER_DLLPUBLIC void setProcessServiceFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMgr);
+
+/**
+ * This function gets the process service factory.
+ *
+ * If no service factory is set the function throws a RuntimeException.
+ */
+COMPHELPER_DLLPUBLIC css::uno::Reference< css::lang::XMultiServiceFactory > getProcessServiceFactory();
+
+/** Obtains a component context from a service factory.
+
+ Throws a RuntimeException if no component context can be obtained.
+
+ @param factory may be null
+ @return may be null
+ */
+COMPHELPER_DLLPUBLIC
+css::uno::Reference< css::uno::XComponentContext >
+getComponentContext(
+ css::uno::Reference< css::lang::XMultiServiceFactory >
+ const & factory);
+
+/**
+ * This function gets the process service factory's default component context.
+ *
+ * Throws a RuntimeException if no component context can be obtained.
+ */
+COMPHELPER_DLLPUBLIC
+css::uno::Reference< css::uno::XComponentContext >
+getProcessComponentContext();
+
+}
+
+#endif // INCLUDED_COMPHELPER_PROCESSFACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx
new file mode 100644
index 000000000..71f9fa30b
--- /dev/null
+++ b/include/comphelper/profilezone.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_COMPHELPER_PROFILEZONE_HXX
+#define INCLUDED_COMPHELPER_PROFILEZONE_HXX
+
+#include <sal/config.h>
+
+#include <sal/log.hxx>
+
+#include <comphelper/traceevent.hxx>
+
+// implementation of XToolkitExperimental profiling API
+
+namespace comphelper
+{
+class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent
+{
+ long long m_nCreateTime;
+ int m_nNesting;
+
+ void addRecording();
+
+ static void setNestingLevel(int nNestingLevel);
+ static int getNestingLevel();
+
+ ProfileZone(const char* sName, const OUString& sArgs)
+ : NamedEvent(sName, sArgs)
+ , m_nNesting(-1)
+ {
+ if (s_bRecording)
+ {
+ m_nCreateTime = getNow();
+
+ m_nNesting = getNestingLevel();
+ setNestingLevel(getNestingLevel() + 1);
+ }
+ else
+ m_nCreateTime = 0;
+ }
+
+public:
+ /**
+ * Starts measuring the cost of a C++ scope.
+ *
+ * Note that the char pointer is stored as such in the ProfileZone object and used in the
+ * destructor, so be sure to pass a pointer that stays valid for the duration of the object's
+ * lifetime.
+ */
+ ProfileZone(const char* sName, const std::map<OUString, OUString>& aArgs)
+ : ProfileZone(sName, createArgsString(aArgs))
+ {
+ }
+
+ ProfileZone(const char* sName)
+ : ProfileZone(sName, OUString())
+ {
+ }
+
+ ~ProfileZone()
+ {
+ if (m_nCreateTime > 0)
+ {
+ setNestingLevel(getNestingLevel() - 1);
+
+ if (m_nNesting != getNestingLevel())
+ {
+ SAL_WARN("comphelper.traceevent", "Incorrect ProfileZone nesting for " << m_sName);
+ }
+ else
+ {
+ if (s_bRecording)
+ addRecording();
+ }
+ }
+ }
+
+ ProfileZone(const ProfileZone&) = delete;
+ void operator=(const ProfileZone&) = delete;
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_PROFILEZONE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propagg.hxx b/include/comphelper/propagg.hxx
new file mode 100644
index 000000000..949251892
--- /dev/null
+++ b/include/comphelper/propagg.hxx
@@ -0,0 +1,325 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPAGG_HXX
+#define INCLUDED_COMPHELPER_PROPAGG_HXX
+
+#include <config_options.h>
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
+#include <com/sun/star/beans/XVetoableChangeListener.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <comphelper/propstate.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+#include <cstddef>
+#include <map>
+#include <memory>
+#include <vector>
+
+
+//= property helper classes
+
+
+namespace comphelper
+{
+
+
+//= OPropertyAccessor
+//= internal helper class for OPropertyArrayAggregationHelper
+
+namespace internal
+{
+ struct OPropertyAccessor
+ {
+ sal_Int32 nOriginalHandle;
+ std::size_t nPos;
+ bool bAggregate;
+
+ OPropertyAccessor(sal_Int32 _nOriginalHandle, std::size_t _nPos, bool _bAggregate)
+ :nOriginalHandle(_nOriginalHandle) ,nPos(_nPos) ,bAggregate(_bAggregate) { }
+
+ bool operator==(const OPropertyAccessor& rOb) const { return nPos == rOb.nPos; }
+ bool operator <(const OPropertyAccessor& rOb) const { return nPos < rOb.nPos; }
+ };
+}
+
+
+/**
+ * used as callback for an OPropertyArrayAggregationHelper
+ */
+class IPropertyInfoService
+{
+public:
+ /** get the preferred handle for the given property
+ @param _rName the property name
+ @return the handle the property should be referred by, or -1 if there are no
+ preferences for the given property
+ */
+ virtual sal_Int32 getPreferredPropertyId(const OUString& _rName) = 0;
+
+protected:
+ ~IPropertyInfoService() {}
+};
+
+/**
+ * used for implementing a cppu::IPropertyArrayHelper for classes
+ * aggregating property sets
+ */
+
+#define DEFAULT_AGGREGATE_PROPERTY_ID 10000
+
+class COMPHELPER_DLLPUBLIC OPropertyArrayAggregationHelper final : public ::cppu::IPropertyArrayHelper
+{
+ friend class OPropertySetAggregationHelper;
+
+ std::vector<css::beans::Property> m_aProperties;
+ std::map< sal_Int32, internal::OPropertyAccessor > m_aPropertyAccessors;
+
+public:
+ /** construct the object.
+ @param _rProperties the properties of the object doing the aggregation. These properties
+ are used without any checks, so the caller has to ensure that the names and
+ handles are valid.
+ @param _rAggProperties the properties of the aggregate, usually got via a call to getProperties on the
+ XPropertySetInfo of the aggregate.
+ The names of the properties are used without any checks, so the caller has to ensure
+ that there are no doubles.
+ The handles are stored for later quick access, but the outside-handles the
+ aggregate properties get depend from the following two parameters.
+ @param _pInfoService
+ If not NULL, the object pointed to is used to calc handles which should be used
+ for referring the aggregate's properties from outside.
+ If one of the properties returned from the info service conflict with other handles
+ already present (e.g. through _rProperties), the property is handled as if -1 was returned.
+ If NULL (or, for a special property, a call to getPreferredPropertyId returns -1),
+ the aggregate property(ies) get a new handle which they can be referred by from outside.
+ @param _nFirstAggregateId
+ if the object is about to create new handles for the aggregate properties, it uses
+ id's ascending from this given id.
+ No checks are made if the handle range determined by _nFirstAggregateId conflicts with other
+ handles within _rProperties.
+ */
+ OPropertyArrayAggregationHelper(const css::uno::Sequence< css::beans::Property>& _rProperties,
+ const css::uno::Sequence< css::beans::Property>& _rAggProperties,
+ IPropertyInfoService* _pInfoService = nullptr,
+ sal_Int32 _nFirstAggregateId = DEFAULT_AGGREGATE_PROPERTY_ID);
+
+
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Bool SAL_CALL fillPropertyMembersByHandle( OUString* _pPropName, sal_Int16* _pAttributes,
+ sal_Int32 _nHandle) override ;
+
+ /// inherited from IPropertyArrayHelper
+ virtual css::uno::Sequence< css::beans::Property> SAL_CALL getProperties() override;
+ /// inherited from IPropertyArrayHelper
+ virtual css::beans::Property SAL_CALL getPropertyByName(const OUString& _rPropertyName) override;
+
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& _rPropertyName) override ;
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Int32 SAL_CALL getHandleByName(const OUString & _rPropertyName) override;
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Int32 SAL_CALL fillHandles( /*out*/sal_Int32* _pHandles, const css::uno::Sequence< OUString >& _rPropNames ) override;
+
+ /** returns information about a property of the aggregate.
+ @param _pPropName points to a string to receive the property name. No name is returned if this is NULL.
+ @param _pOriginalHandle points to a sal_Int32 to receive the original property handle. No original handle is returned
+ if this is NULL.
+ @param _nHandle the handle of the property as got by, for instance, fillHandles
+
+ @return sal_True, if _nHandle marks an aggregate property, otherwise sal_False
+ */
+ bool fillAggregatePropertyInfoByHandle(OUString* _pPropName, sal_Int32* _pOriginalHandle,
+ sal_Int32 _nHandle) const;
+
+ /** returns information about a property given by handle
+ */
+ bool getPropertyByHandle( sal_Int32 _nHandle, css::beans::Property& _rProperty ) const;
+
+
+ enum class PropertyOrigin
+ {
+ Aggregate,
+ Delegator,
+ Unknown
+ };
+ /** prefer this one over the XPropertySetInfo of the aggregate!
+
+ <p>The reason is that OPropertyArrayAggregationHelper is the only instance which really knows
+ which properties of the aggregate are to be exposed. <br/>
+
+ For instance, some derivee of OPropertySetAggregationHelper may decide to create an
+ OPropertyArrayAggregationHelper which contains only a subset of the aggregate properties. This way,
+ some of the aggregate properties may be hidden to the public.<br/>
+
+ When using the XPropertySetInfo of the aggregate set to determine the existence of a property, then this
+ would return false positives.</p>
+ */
+ PropertyOrigin classifyProperty( const OUString& _rName );
+
+private:
+ const css::beans::Property* findPropertyByName(const OUString& _rName) const;
+};
+
+
+namespace internal
+{
+ class PropertyForwarder;
+}
+
+/**
+ * helper class for implementing the property-set-related interfaces
+ * for an object doin' aggregation
+ * supports at least XPropertySet and XMultiPropertySet
+ *
+ */
+class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OPropertySetAggregationHelper :public OPropertyStateHelper
+ ,public css::beans::XPropertiesChangeListener
+ ,public css::beans::XVetoableChangeListener
+{
+ friend class internal::PropertyForwarder;
+
+protected:
+ css::uno::Reference< css::beans::XPropertyState> m_xAggregateState;
+ css::uno::Reference< css::beans::XPropertySet> m_xAggregateSet;
+ css::uno::Reference< css::beans::XMultiPropertySet> m_xAggregateMultiSet;
+ css::uno::Reference< css::beans::XFastPropertySet> m_xAggregateFastSet;
+
+ std::unique_ptr<internal::PropertyForwarder> m_pForwarder;
+ bool m_bListening : 1;
+
+public:
+ OPropertySetAggregationHelper( ::cppu::OBroadcastHelper& rBHelper );
+
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& aType) override;
+
+// XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+// XFastPropertySet
+ virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const css::uno::Any& aValue) override;
+ virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) override;
+
+// XPropertySet
+ virtual void SAL_CALL addPropertyChangeListener(const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
+ virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener) override;
+
+// XPropertiesChangeListener
+ virtual void SAL_CALL propertiesChange(const css::uno::Sequence< css::beans::PropertyChangeEvent >& evt) override;
+
+// XVetoableChangeListener
+ virtual void SAL_CALL vetoableChange(const css::beans::PropertyChangeEvent& aEvent) override;
+
+// XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString >& PropertyNames, const css::uno::Sequence< css::uno::Any >& Values) override;
+ virtual void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener) override;
+
+// XPropertyState
+ virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString& PropertyName) override;
+ virtual void SAL_CALL setPropertyToDefault(const OUString& PropertyName) override;
+ virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString& aPropertyName) override;
+
+// OPropertySetHelper
+ /** still waiting to be overwritten ...
+ you <B>must<B/> use an OPropertyArrayAggregationHelper here, as the implementation strongly relies on this.
+ */
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override = 0;
+
+ /** only implemented for "forwarded" properties, every other property must be handled
+ in the derivee, and will assert if passed herein
+ */
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& _rConvertedValue, css::uno::Any& _rOldValue, sal_Int32 _nHandle, const css::uno::Any& _rValue ) override;
+
+ /** only implemented for "forwarded" properties, every other property must be handled
+ in the derivee, and will assert if passed herein
+ */
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const css::uno::Any& _rValue ) override;
+
+protected:
+ virtual ~OPropertySetAggregationHelper() override;
+
+ virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue, sal_Int32 nHandle) const override;
+ void disposing();
+
+ sal_Int32 getOriginalHandle( sal_Int32 _nHandle ) const;
+ OUString getPropertyName( sal_Int32 _nHandle ) const;
+
+ /** declares the property with the given (public) handle as one to be forwarded to the aggregate
+
+ Sometimes, you might want to <em>overwrite</em> properties at the aggregate. That is,
+ though the aggregate implements this property, and still is to hold the property value,
+ you want to do additional handling upon setting the property, but then forward the value
+ to the aggregate.
+
+ Use this method to declare such properties.
+
+ When a "forwarded property" is set from outside, the class first calls
+ <member>forwardingPropertyValue</member> for any preprocessing, then forwards the property
+ value to the aggregate, and then calls <member>forwardedPropertyValue</member>.
+
+ When you declare a property as "forwarded", the class takes care for some multi-threading
+ issues, for instance, it won't fire any property change notifications which result from
+ forwarding a property value, unless it's safe to do so (i.e. unless our mutex is
+ released).
+
+ @see forwardingPropertyValue
+ @see forwardedPropertyValue
+ */
+ void declareForwardedProperty( sal_Int32 _nHandle );
+
+ /** checks whether we're actually forwarding a property value to our aggregate
+
+ @see declareForwardedProperty
+ @see forwardingPropertyValue
+ @see forwardedPropertyValue
+ */
+ bool isCurrentlyForwardingProperty( sal_Int32 _nHandle ) const;
+
+ /** called immediately before a property value which is overwritten in this instance
+ is forwarded to the aggregate
+
+ @see declareForwardedProperty
+ @see forwardedPropertyValue
+ */
+ virtual void forwardingPropertyValue( sal_Int32 _nHandle );
+
+ /** called immediately after a property value which is overwritten in this instance
+ has been forwarded to the aggregate
+
+ @see declareForwardedProperty
+ @see forwardingPropertyValue
+ */
+ virtual void forwardedPropertyValue( sal_Int32 _nHandle );
+
+ /// must be called before aggregation, if aggregation is used
+ ///
+ /// @throws css::lang::IllegalArgumentException
+ void setAggregation(const css::uno::Reference< css::uno::XInterface >&);
+ void startListening();
+};
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_PROPAGG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/proparrhlp.hxx b/include/comphelper/proparrhlp.hxx
new file mode 100644
index 000000000..5db95972f
--- /dev/null
+++ b/include/comphelper/proparrhlp.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPARRHLP_HXX
+#define INCLUDED_COMPHELPER_PROPARRHLP_HXX
+
+#include <comphelper/propagg.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <mutex>
+#include <osl/diagnose.h>
+
+namespace comphelper
+{
+
+template <class TYPE>
+class OPropertyArrayUsageHelper
+{
+protected:
+ static sal_Int32 s_nRefCount;
+ static ::cppu::IPropertyArrayHelper* s_pProps;
+ static std::mutex& theMutex()
+ {
+ static std::mutex SINGLETON;
+ return SINGLETON;
+ }
+public:
+ OPropertyArrayUsageHelper();
+ virtual ~OPropertyArrayUsageHelper();
+
+ /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the
+ class, which is created if necessary.
+ */
+ ::cppu::IPropertyArrayHelper* getArrayHelper();
+
+protected:
+ /** used to implement the creation of the array helper which is shared amongst all instances of the class.
+ This method needs to be implemented in derived classes.
+ <BR>
+ The method gets called with Mutex acquired.
+ @return a pointer to the newly created array helper. Must not be NULL.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const = 0;
+};
+
+/** an OPropertyArrayUsageHelper which will create an OPropertyArrayAggregationHelper
+*/
+template <class TYPE>
+class OAggregationArrayUsageHelper: public OPropertyArrayUsageHelper<TYPE>
+{
+protected:
+ /** overwrite this in your derived class. initialize the two sequences with your and your aggregate's
+ properties.
+ <BR>
+ The method gets called with Mutex acquired.
+ @param _rProps out parameter to be filled with the property descriptions of your own class
+ @param _rAggregateProps out parameter to be filled with the properties of your aggregate.
+ */
+ virtual void fillProperties(
+ css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps,
+ css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
+ ) const = 0;
+
+ /** creates an OPropertyArrayAggregationHelper filled with properties for which's initialization
+ fillProperties is called. getInfoService and getFirstAggregateId may be overwritten to determine
+ the additional parameters of the OPropertyArrayAggregationHelper.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+};
+
+template<class TYPE>
+sal_Int32 OPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0;
+
+template<class TYPE>
+::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper< TYPE >::s_pProps = nullptr;
+
+template <class TYPE>
+OPropertyArrayUsageHelper<TYPE>::OPropertyArrayUsageHelper()
+{
+ std::unique_lock aGuard(theMutex());
+ ++s_nRefCount;
+}
+
+template <class TYPE>
+OPropertyArrayUsageHelper<TYPE>::~OPropertyArrayUsageHelper()
+{
+ std::unique_lock aGuard(theMutex());
+ OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !");
+ if (!--s_nRefCount)
+ {
+ delete s_pProps;
+ s_pProps = nullptr;
+ }
+}
+
+template <class TYPE>
+::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper<TYPE>::getArrayHelper()
+{
+ OSL_ENSURE(s_nRefCount, "OPropertyArrayUsageHelper::getArrayHelper : suspicious call : have a refcount of 0 !");
+ if (!s_pProps)
+ {
+ std::unique_lock aGuard(theMutex());
+ if (!s_pProps)
+ {
+ s_pProps = createArrayHelper();
+ OSL_ENSURE(s_pProps, "OPropertyArrayUsageHelper::getArrayHelper : createArrayHelper returned nonsense !");
+ }
+ }
+ return s_pProps;
+}
+
+template <class TYPE> inline
+::cppu::IPropertyArrayHelper* OAggregationArrayUsageHelper<TYPE>::createArrayHelper() const
+{
+ css::uno::Sequence< css::beans::Property > aProps;
+ css::uno::Sequence< css::beans::Property > aAggregateProps;
+ fillProperties(aProps, aAggregateProps);
+ OSL_ENSURE(aProps.hasElements(), "OAggregationArrayUsageHelper::createArrayHelper : fillProperties returned nonsense !");
+ return new OPropertyArrayAggregationHelper(aProps, aAggregateProps, nullptr, DEFAULT_AGGREGATE_PROPERTY_ID);
+}
+
+}
+
+#endif // INCLUDED_COMPHELPER_PROPARRHLP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/property.hxx b/include/comphelper/property.hxx
new file mode 100644
index 000000000..b9787f130
--- /dev/null
+++ b/include/comphelper/property.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTY_HXX
+#define INCLUDED_COMPHELPER_PROPERTY_HXX
+
+#include <cppuhelper/proptypehlp.hxx>
+#include <comphelper/extract.hxx>
+#include <com/sun/star/beans/Property.hpp>
+#include <type_traits>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::beans { class XPropertySet; }
+
+namespace comphelper
+{
+
+ // comparing two property instances
+ struct PropertyCompareByName
+ {
+ bool operator() (const css::beans::Property& x, const css::beans::Property& y) const
+ {
+ return x.Name.compareTo(y.Name) < 0;
+ }
+ };
+
+/// remove the property with the given name from the given sequence
+COMPHELPER_DLLPUBLIC void RemoveProperty(css::uno::Sequence<css::beans::Property>& seqProps, const OUString& _rPropName);
+
+/** within the given property sequence, modify attributes of a special property
+ @param _rProps the sequence of properties to search in
+ @param _sPropName the name of the property which's attributes should be modified
+ @param _nAddAttrib the attributes which should be added
+ @param _nRemoveAttrib the attributes which should be removed
+*/
+COMPHELPER_DLLPUBLIC void ModifyPropertyAttributes(css::uno::Sequence<css::beans::Property>& _rProps, const OUString& _sPropName, sal_Int16 _nAddAttrib, sal_Int16 _nRemoveAttrib);
+
+/** check if the given set has the given property.
+*/
+COMPHELPER_DLLPUBLIC bool hasProperty(const OUString& _rName, const css::uno::Reference<css::beans::XPropertySet>& _rxSet);
+
+/** copy properties between property sets, in compliance with the property
+ attributes of the target object
+*/
+COMPHELPER_DLLPUBLIC void copyProperties(const css::uno::Reference<css::beans::XPropertySet>& _rxSource,
+ const css::uno::Reference<css::beans::XPropertySet>& _rxDest);
+
+/** helper for implementing ::cppu::OPropertySetHelper::convertFastPropertyValue
+ @param _rConvertedValue the conversion result (if successful)
+ @param _rOldValue the old value of the property, calculated from _rCurrentValue
+ @param _rValueToSet the new value which is about to be set
+ @param _rCurrentValue the current value of the property
+ @return sal_True, if the value could be converted and has changed
+ sal_False, if the value could be converted and has not changed
+ @exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument)
+*/
+template <typename T>
+bool tryPropertyValue(css::uno::Any& /*out*/_rConvertedValue, css::uno::Any& /*out*/_rOldValue, const css::uno::Any& _rValueToSet, const T& _rCurrentValue)
+{
+ bool bModified(false);
+ T aNewValue = T();
+ ::cppu::convertPropertyValue(aNewValue, _rValueToSet);
+ if (aNewValue != _rCurrentValue)
+ {
+ _rConvertedValue <<= aNewValue;
+ _rOldValue <<= _rCurrentValue;
+ bModified = true;
+ }
+ return bModified;
+}
+
+/** helper for implementing ::cppu::OPropertySetHelper::convertFastPropertyValue for enum values
+ @param _rConvertedValue the conversion result (if successful)
+ @param _rOldValue the old value of the property, calculated from _rCurrentValue
+ @param _rValueToSet the new value which is about to be set
+ @param _rCurrentValue the current value of the property
+ @return sal_True, if the value could be converted and has changed
+ sal_False, if the value could be converted and has not changed
+ @exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument)
+*/
+template <class ENUMTYPE>
+typename std::enable_if<std::is_enum<ENUMTYPE>::value, bool>::type
+tryPropertyValueEnum(css::uno::Any& /*out*/_rConvertedValue, css::uno::Any& /*out*/_rOldValue, const css::uno::Any& _rValueToSet, const ENUMTYPE& _rCurrentValue)
+{
+ bool bModified(false);
+ ENUMTYPE aNewValue;
+ ::cppu::any2enum(aNewValue, _rValueToSet);
+ // will throw an exception if not convertible
+
+ if (aNewValue != _rCurrentValue)
+ {
+ _rConvertedValue <<= aNewValue;
+ _rOldValue <<= _rCurrentValue;
+ bModified = true;
+ }
+ return bModified;
+}
+
+/** helper for implementing ::cppu::OPropertySetHelper::convertFastPropertyValue
+ @param _rConvertedValue the conversion result (if successful)
+ @param _rOldValue the old value of the property, calculated from _rCurrentValue
+ @param _rValueToSet the new value which is about to be set
+ @param _rCurrentValue the current value of the property
+ @param _rExpectedType the type which the property should have (if not void)
+ @return sal_True, if the value could be converted and has changed
+ sal_False, if the value could be converted and has not changed
+ @exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument)
+*/
+COMPHELPER_DLLPUBLIC bool tryPropertyValue(css::uno::Any& _rConvertedValue, css::uno::Any& _rOldValue, const css::uno::Any& _rValueToSet, const css::uno::Any& _rCurrentValue, const css::uno::Type& _rExpectedType);
+
+}
+
+#endif // INCLUDED_COMPHELPER_PROPERTY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertybag.hxx b/include/comphelper/propertybag.hxx
new file mode 100644
index 000000000..3cf9de9ff
--- /dev/null
+++ b/include/comphelper/propertybag.hxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTYBAG_HXX
+#define INCLUDED_COMPHELPER_PROPERTYBAG_HXX
+
+#include <config_options.h>
+#include <com/sun/star/uno/Any.h>
+#include <comphelper/comphelperdllapi.h>
+#include <comphelper/propertycontainerhelper.hxx>
+
+#include <map>
+
+
+namespace comphelper
+{
+
+
+ //= PropertyBag
+
+ /** provides a bag of properties associated with their values
+
+ This class can, for instance, be used for components which need to implement
+ the com.sun.star.beans.PropertyBag service.
+ */
+ class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) PropertyBag final : protected OPropertyContainerHelper
+ {
+ std::map< sal_Int32, css::uno::Any > aDefaults;
+ bool m_bAllowEmptyPropertyName;
+ public:
+ PropertyBag();
+ virtual ~PropertyBag();
+
+ /** allow adding property with empty string as name
+ (by default, such names are rejected with IllegalActionException).
+ @param i_isAllowed
+ iff true, empty property name will be allowed
+ */
+ void setAllowEmptyPropertyName(bool i_isAllowed);
+
+ /** adds a property to the bag
+
+ The type of the property is determined from its initial value (<code>_rInitialValue</code>).
+
+ @param _rName
+ the name of the new property. Must not be empty unless
+ explicitly allowed with setAllowEmptyPropertyName.
+ @param _nHandle
+ the handle of the new property
+ @param _nAttributes
+ the attributes of the property
+ @param _rInitialValue
+ the initial value of the property. Must not be <NULL/>, to allow
+ determining the property type.
+
+ @throws css::beans::IllegalTypeException
+ if the initial value is <NULL/>
+ @throws css::beans::PropertyExistException
+ if the name or the handle are already used
+ @throws css::beans::IllegalArgumentException
+ if the name is empty
+ */
+ void addProperty(
+ const OUString& _rName,
+ sal_Int32 _nHandle,
+ sal_Int32 _nAttributes,
+ const css::uno::Any& _rInitialValue
+ );
+
+ /** adds a property to the bag
+
+ The initial value of the property is <NULL/>.
+
+ @param _rName
+ the name of the new property. Must not be empty unless
+ explicitly allowed with setAllowEmptyPropertyName.
+ @param _rType
+ the type of the new property
+ @param _nHandle
+ the handle of the new property
+ @param _nAttributes
+ the attributes of the property
+
+ @throws css::beans::IllegalTypeException
+ if the initial value is <NULL/>
+ @throws css::beans::PropertyExistException
+ if the name or the handle are already used
+ @throws css::beans::IllegalArgumentException
+ if the name is empty
+ */
+ void addVoidProperty(
+ const OUString& _rName,
+ const css::uno::Type& _rType,
+ sal_Int32 _nHandle,
+ sal_Int32 _nAttributes
+ );
+
+ /** removes a property from the bag
+ @param _rName
+ the name of the to-be-removed property.
+ @throws UnknownPropertyException
+ if the bag does not contain a property with the given name
+ @throws NotRemoveableException
+ if the property with the given name is not removable, as indicated
+ by the property attributes used in a previous <code>addProperty</code>
+ call.
+ */
+ void removeProperty(
+ const OUString& _rName
+ );
+
+ /** describes all properties in the bag
+ @param _out_rProps
+ takes, upon return, the descriptions of all properties in the bag
+ */
+ void describeProperties(
+ css::uno::Sequence< css::beans::Property >& _out_rProps
+ ) const
+ {
+ OPropertyContainerHelper::describeProperties( _out_rProps );
+ }
+
+ /** retrieves the value of a property given by handle
+ @param _nHandle
+ the handle of the property whose value is to be retrieved
+ @param _out_rValue
+ output parameter taking the property value
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ */
+ void getFastPropertyValue(
+ sal_Int32 _nHandle,
+ css::uno::Any& _out_rValue
+ ) const;
+
+ /** converts a to-be-set value of a property (given by handle) so that it can
+ be used in subsequent calls to setFastPropertyValue
+ @param _nHandle
+ the handle of the property
+ @param _rNewValue
+ the new value, which should be converted
+ @param _out_rConvertedValue
+ output parameter taking the converted value
+ @param _out_rCurrentValue
+ output parameter taking the current value of the
+ property
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ @throws IllegalArgumentException
+ if the given value cannot be lossless converted into a value
+ for the given property.
+ */
+ bool convertFastPropertyValue(
+ sal_Int32 _nHandle,
+ const css::uno::Any& _rNewValue,
+ css::uno::Any& _out_rConvertedValue,
+ css::uno::Any& _out_rCurrentValue
+ ) const;
+
+ /** sets a new value for a property given by handle
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ */
+ void setFastPropertyValue(
+ sal_Int32 _nHandle,
+ const css::uno::Any& _rValue
+ );
+
+ /** returns the default value for a property given by handle
+
+ The default value of a property is its initial value, as passed
+ to ->addProperty.
+
+ @param _nHandle
+ handle of the property whose default value is to be obtained
+ @param _out_rValue
+ the default value
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ */
+ void getPropertyDefaultByHandle(
+ sal_Int32 _nHandle,
+ css::uno::Any& _out_rValue
+ ) const;
+
+ /** determines whether a property with a given name is part of the bag
+ */
+ bool hasPropertyByName( const OUString& _rName ) const
+ {
+ return isRegisteredProperty( _rName );
+ }
+
+ /** determines whether a property with a given handle is part of the bag
+ */
+ bool hasPropertyByHandle( sal_Int32 _nHandle ) const
+ {
+ return isRegisteredProperty( _nHandle );
+ }
+ protected:
+ using OPropertyContainerHelper::convertFastPropertyValue;
+ using OPropertyContainerHelper::getFastPropertyValue;
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_PROPERTYBAG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertycontainer.hxx b/include/comphelper/propertycontainer.hxx
new file mode 100644
index 000000000..2c64b2cdf
--- /dev/null
+++ b/include/comphelper/propertycontainer.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTYCONTAINER_HXX
+#define INCLUDED_COMPHELPER_PROPERTYCONTAINER_HXX
+
+#include <comphelper/propertycontainerhelper.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+
+namespace com::sun::star::uno { class Any; }
+namespace com::sun::star::uno { class Type; }
+
+namespace comphelper
+{
+
+
+/** an OPropertySetHelper implementation which is just a simple container for properties represented
+ by class members, usually in a derived class.
+ <BR>
+ A restriction of this class is that no value conversions are made on a setPropertyValue call. Though
+ the base class supports this with the convertFastPropertyValue method, the OPropertyContainer accepts only
+ values which already have the correct type, it's unable to convert, for instance, a long to a short.
+*/
+class COMPHELPER_DLLPUBLIC OPropertyContainer
+ :public cppu::OPropertySetHelper
+ ,public OPropertyContainerHelper
+{
+public:
+ // this dtor is needed otherwise we can get a wrong delete operator
+ virtual ~OPropertyContainer();
+
+protected:
+ OPropertyContainer(::cppu::OBroadcastHelper& _rBHelper);
+
+ /// for scripting : the types of the interfaces supported by this class
+ ///
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< css::uno::Type > getBaseTypes();
+
+// OPropertySetHelper overridables
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ css::uno::Any & rConvertedValue,
+ css::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue ) override;
+
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue
+ ) override;
+
+ using OPropertySetHelper::getFastPropertyValue;
+ virtual void SAL_CALL getFastPropertyValue(
+ css::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const override;
+
+ // disambiguate a base class method (XFastPropertySet)
+ using OPropertySetHelper::setFastPropertyValue;
+};
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_PROPERTYCONTAINER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertycontainerhelper.hxx b/include/comphelper/propertycontainerhelper.hxx
new file mode 100644
index 000000000..73a0ce513
--- /dev/null
+++ b/include/comphelper/propertycontainerhelper.hxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTYCONTAINERHELPER_HXX
+#define INCLUDED_COMPHELPER_PROPERTYCONTAINERHELPER_HXX
+
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/beans/Property.hpp>
+#include <cstddef>
+#include <limits>
+#include <vector>
+#include <comphelper/comphelperdllapi.h>
+
+
+namespace comphelper
+{
+
+
+// infos about one single property
+struct COMPHELPER_DLLPUBLIC PropertyDescription
+{
+ // the possibilities where a property holding object may be located
+ enum class LocationType
+ {
+ DerivedClassRealType, // within the derived class, it's a "real" (non-Any) type
+ DerivedClassAnyType, // within the derived class, it's a com.sun.star.uno::Any
+ HoldMyself // within m_aHoldProperties
+ };
+ // the location of an object holding a property value :
+ union LocationAccess
+ {
+ void* pDerivedClassMember; // a pointer to a member of an object of a derived class
+ std::size_t nOwnClassVectorIndex; // an index within m_aHoldProperties
+ };
+
+ css::beans::Property aProperty;
+ LocationType eLocated; // where is the object containing the value located ?
+ LocationAccess aLocation; // access to the property value
+
+ PropertyDescription()
+ :aProperty( OUString(), -1, css::uno::Type(), 0 )
+ ,eLocated( LocationType::HoldMyself )
+ {
+ aLocation.nOwnClassVectorIndex = std::numeric_limits<std::size_t>::max();
+ }
+};
+
+
+//= OPropertyContainerHelper
+
+/** helper class for managing property values, and implementing most of the X*Property* interfaces
+
+ The property values are usually held in derived classes, but can also be given to the
+ responsibility of this class here.
+
+ For more information, see http://wiki.openoffice.org/wiki/Development/Cpp/Helper/PropertyContainerHelper.
+*/
+class COMPHELPER_DLLPUBLIC OPropertyContainerHelper
+{
+ typedef ::std::vector< css::uno::Any > PropertyContainer;
+ PropertyContainer m_aHoldProperties;
+ // the properties which are hold by this class' instance, not the derived one's
+
+private:
+ typedef ::std::vector< PropertyDescription > Properties;
+ typedef Properties::iterator PropertiesIterator;
+ typedef Properties::const_iterator ConstPropertiesIterator;
+ Properties m_aProperties;
+
+protected:
+ OPropertyContainerHelper();
+ ~OPropertyContainerHelper();
+
+ /** register a property. The property is represented through a member of the derived class which calls
+ this method.
+ @param _rName the name of the property
+ @param _nHandle the handle of the property
+ @param _nAttributes the attributes of the property
+ @param _pPointerToMember the pointer to the member representing the property
+ within the derived class.
+ @param _rMemberType the cppu type of the property represented by the object
+ to which _pPointerToMember points.
+ */
+ void registerProperty(const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
+ void* _pPointerToMember, const css::uno::Type& _rMemberType);
+
+
+ /** register a property. The property is represented through a css::uno::Any member of the
+ derived class which calls this method.
+ @param _rName the name of the property
+ @param _nHandle the handle of the property
+ @param _nAttributes the attributes of the property
+ @param _pPointerToMember the pointer to the member representing the property
+ within the derived class, which has to be a css::uno::Any.
+ @param _rExpectedType the expected type of the property. NOT the type of the object to which
+ _pPointerToMember points (this is always an Any).
+ */
+ void registerMayBeVoidProperty(const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
+ css::uno::Any* _pPointerToMember, const css::uno::Type& _rExpectedType);
+
+ /** register a property. The repository will create an own object holding this property, so there is no
+ need to declare an extra member in your derived class
+ @param _rName the name of the property
+ @param _nHandle the handle of the property
+ @param _nAttributes the attributes of the property
+ @param _rType the type of the property
+ @param _pInitialValue the initial value of the property. May be void if _nAttributes includes
+ the css::beans::PropertyAttribute::MAYBEVOID flag.
+ Else it must contain a value compatible with the type described by _rType.
+ */
+ void registerPropertyNoMember(const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
+ const css::uno::Type& _rType, css::uno::Any const & _pInitialValue);
+
+ /** revokes a previously registered property
+ @throw css::beans::UnknownPropertyException
+ if no property with the given handle is registered
+ */
+ void revokeProperty( sal_Int32 _nHandle );
+
+
+ /// checks whether a property with the given handle has been registered
+ bool isRegisteredProperty( sal_Int32 _nHandle ) const;
+
+ /// checks whether a property with the given name has been registered
+ bool isRegisteredProperty( const OUString& _rName ) const;
+
+
+ // helper for implementing OPropertySetHelper overridables
+ bool convertFastPropertyValue(
+ css::uno::Any & rConvertedValue,
+ css::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue
+ );
+
+ void setFastPropertyValue(
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue
+ );
+
+ void getFastPropertyValue(
+ css::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const;
+
+// helper
+ /** appends the descriptions of all properties which were registered 'til that moment to the given sequence,
+ keeping the array sorted (by name)
+ @precond
+ the given sequence is already sorted by name
+ @param _rProps
+ initial property sequence which is to be extended
+ */
+ void describeProperties(css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps) const;
+
+ /** retrieves the description for a registered property
+ @throw css::beans::UnknownPropertyException
+ if no property with the given name is registered
+ */
+ const css::beans::Property&
+ getProperty( const OUString& _rName ) const;
+
+private:
+ /// insertion of _rProp into m_aProperties, keeping the sort order
+ COMPHELPER_DLLPRIVATE void implPushBackProperty(const PropertyDescription& _rProp);
+
+ /// search the PropertyDescription for the given handle (within m_aProperties)
+ COMPHELPER_DLLPRIVATE PropertiesIterator searchHandle(sal_Int32 _nHandle);
+
+private:
+ OPropertyContainerHelper( const OPropertyContainerHelper& ) = delete;
+ OPropertyContainerHelper& operator=( const OPropertyContainerHelper& ) = delete;
+};
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_PROPERTYCONTAINERHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertysequence.hxx b/include/comphelper/propertysequence.hxx
new file mode 100644
index 000000000..e788f56f4
--- /dev/null
+++ b/include/comphelper/propertysequence.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
+#define INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
+
+#include <utility>
+#include <algorithm>
+#include <initializer_list>
+#include <vector>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <comphelper/comphelperdllapi.h>
+
+namespace comphelper
+{
+ /// Init list for property sequences.
+ inline css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(
+ ::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
+ {
+ css::uno::Sequence< css::beans::PropertyValue> vResult{static_cast<sal_Int32>(vInit.size())};
+ std::transform(vInit.begin(), vInit.end(), vResult.getArray(),
+ [](const std::pair<OUString, css::uno::Any>& rInit) {
+ return css::beans::PropertyValue(rInit.first, -1, rInit.second,
+ css::beans::PropertyState_DIRECT_VALUE);
+ });
+ return vResult;
+ }
+
+ /// Init list for property sequences that wrap the PropertyValues in Anys.
+ ///
+ /// This is particularly useful for creation of sequences that are later
+ /// unwrapped using comphelper::SequenceAsHashMap.
+ inline css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(
+ ::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
+ {
+ css::uno::Sequence<css::uno::Any> vResult{static_cast<sal_Int32>(vInit.size())};
+ std::transform(vInit.begin(), vInit.end(), vResult.getArray(),
+ [](const std::pair<OUString, css::uno::Any>& rInit) {
+ return css::uno::Any(
+ css::beans::PropertyValue(rInit.first, -1, rInit.second,
+ css::beans::PropertyState_DIRECT_VALUE));
+ });
+ return vResult;
+ }
+
+ COMPHELPER_DLLPUBLIC std::vector<css::beans::PropertyValue> JsonToPropertyValues(const OString& rJson);
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertysethelper.hxx b/include/comphelper/propertysethelper.hxx
new file mode 100644
index 000000000..a4746a02f
--- /dev/null
+++ b/include/comphelper/propertysethelper.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTYSETHELPER_HXX
+#define INCLUDED_COMPHELPER_PROPERTYSETHELPER_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ref.hxx>
+
+namespace comphelper
+{
+class PropertySetInfo;
+struct PropertyMapEntry;
+
+class COMPHELPER_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet,
+ public css::beans::XPropertyState,
+ public css::beans::XMultiPropertySet
+{
+private:
+ rtl::Reference<PropertySetInfo> mxInfo;
+
+protected:
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const css::uno::Any* pValues ) = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, css::uno::Any* pValue ) = 0;
+
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ virtual void _getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, css::beans::PropertyState* pStates );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ virtual void _setPropertyToDefault( const comphelper::PropertyMapEntry* pEntry );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Any _getPropertyDefault( const comphelper::PropertyMapEntry* pEntry );
+
+public:
+ PropertySetHelper( rtl::Reference<comphelper::PropertySetInfo> xInfo ) noexcept;
+ virtual ~PropertySetHelper() noexcept;
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+
+ // XMultiPropertySet
+// virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
+ virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+ virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+ virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+
+ // XPropertyState
+ virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
+ virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
+ virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
+};
+
+}
+
+#endif // _UTL_PROPERTYSETHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertysetinfo.hxx b/include/comphelper/propertysetinfo.hxx
new file mode 100644
index 000000000..ee26d8698
--- /dev/null
+++ b/include/comphelper/propertysetinfo.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTYSETINFO_HXX
+#define INCLUDED_COMPHELPER_PROPERTYSETINFO_HXX
+
+#include <sal/config.h>
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <o3tl/span.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <unordered_map>
+#include <utility>
+
+enum class PropertyMoreFlags : sal_uInt8 {
+ NONE = 0x00,
+ METRIC_ITEM = 0x01,
+};
+namespace o3tl {
+ template<> struct typed_flags<PropertyMoreFlags> : is_typed_flags<PropertyMoreFlags, 0x1> {};
+}
+
+namespace comphelper
+{
+
+struct PropertyMapEntry
+{
+ OUString maName;
+ css::uno::Type maType;
+ sal_Int32 mnHandle;
+ /// flag bitmap, @see css::beans::PropertyAttribute
+ sal_Int16 mnAttributes;
+ sal_uInt8 mnMemberId;
+ PropertyMoreFlags mnMoreFlags;
+
+ PropertyMapEntry(OUString _aName, sal_Int32 _nHandle, css::uno::Type const & _rType,
+ sal_Int16 _nAttributes, sal_uInt8 _nMemberId, PropertyMoreFlags _nMoreFlags = PropertyMoreFlags::NONE)
+ : maName(std::move( _aName ))
+ , maType( _rType )
+ , mnHandle( _nHandle )
+ , mnAttributes( _nAttributes )
+ , mnMemberId( _nMemberId )
+ , mnMoreFlags( _nMoreFlags )
+ {
+ assert(mnAttributes <= 0x1ff );
+ assert( (_nMemberId & 0x40) == 0 );
+ // Verify that if METRIC_ITEM is set, we are one of the types supported by
+ // SvxUnoConvertToMM.
+ assert(!(_nMoreFlags & PropertyMoreFlags::METRIC_ITEM) ||
+ ( (maType.getTypeClass() == css::uno::TypeClass_BYTE)
+ || (maType.getTypeClass() == css::uno::TypeClass_SHORT)
+ || (maType.getTypeClass() == css::uno::TypeClass_UNSIGNED_SHORT)
+ || (maType.getTypeClass() == css::uno::TypeClass_LONG)
+ || (maType.getTypeClass() == css::uno::TypeClass_UNSIGNED_LONG)
+ ) );
+ }
+ PropertyMapEntry() = default;
+};
+
+typedef std::unordered_map<OUString, PropertyMapEntry const *> PropertyMap;
+
+// don't export to avoid duplicate WeakImplHelper definitions with MSVC
+class SAL_DLLPUBLIC_TEMPLATE PropertySetInfo_BASE
+ : public ::cppu::WeakImplHelper< css::beans::XPropertySetInfo >
+{};
+
+/** this class implements a XPropertySetInfo that is initialized with arrays of PropertyMapEntry.
+ It is used by the class PropertySetHelper.
+*/
+class COMPHELPER_DLLPUBLIC PropertySetInfo final
+ : public PropertySetInfo_BASE
+{
+public:
+ PropertySetInfo() noexcept;
+ PropertySetInfo( o3tl::span<const PropertyMapEntry> pMap ) noexcept;
+ virtual ~PropertySetInfo() noexcept override;
+
+ /** returns a stl map with all PropertyMapEntry pointer.<p>
+ The key is the property name.
+ */
+ const PropertyMap& getPropertyMap() const noexcept { return maPropertyMap; }
+
+ /** adds an array of PropertyMapEntry to this instance.<p>
+ The end is marked with a PropertyMapEntry where mpName equals NULL</p>
+ */
+ void add( o3tl::span<PropertyMapEntry const> pMap ) noexcept;
+
+ /** removes an already added PropertyMapEntry which string in mpName equals to aName */
+ void remove( const OUString& aName ) noexcept;
+
+ virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override;
+ virtual css::beans::Property SAL_CALL getPropertyByName( const OUString& aName ) override;
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) override;
+
+private:
+ PropertyMap maPropertyMap;
+ /// Cache the value we return in getProperties because it is expensive to construct
+ css::uno::Sequence< css::beans::Property > maProperties;
+};
+
+}
+
+#endif // _UTL_PROPERTSETINFO_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertystatecontainer.hxx b/include/comphelper/propertystatecontainer.hxx
new file mode 100644
index 000000000..966e2cb99
--- /dev/null
+++ b/include/comphelper/propertystatecontainer.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTYSTATECONTAINER_HXX
+#define INCLUDED_COMPHELPER_PROPERTYSTATECONTAINER_HXX
+
+#include <comphelper/propertycontainer.hxx>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+
+namespace comphelper
+{
+
+
+ //= OPropertyStateContainer
+
+ typedef ::cppu::ImplHelper1 < css::beans::XPropertyState
+ > OPropertyStateContainer_TBase;
+
+ /** helper implementation for components which have properties with a default
+
+ <p>This class is not intended for direct use, you need to derive from it.</p>
+
+ @see com.sun.star.beans.XPropertyState
+ */
+ class COMPHELPER_DLLPUBLIC OPropertyStateContainer
+ :public OPropertyContainer
+ ,public OPropertyStateContainer_TBase
+ {
+ protected:
+ /** ctor
+ @param _rBHelper
+ help to be used for broadcasting events
+ */
+ OPropertyStateContainer( ::cppu::OBroadcastHelper& _rBHelper );
+
+
+ // XPropertyState
+ virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
+ virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
+ virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
+
+
+ // own overridables
+ // these are the impl-methods for the XPropertyState members - they are implemented already by this class,
+ // but you may want to override them for whatever reasons (for instance, if your derived class
+ // supports the AMBIGUOUS state for properties)
+
+ /** get the PropertyState of the property denoted by the given handle
+
+ <p>Already implemented by this base class, no need to override</p>
+ @precond <arg>_nHandle</arg> is a valid property handle
+ */
+ css::beans::PropertyState getPropertyStateByHandle( sal_Int32 _nHandle ) const;
+
+ /** set the property denoted by the given handle to its default value
+
+ <p>Already implemented by this base class, no need to override</p>
+ @precond <arg>_nHandle</arg> is a valid property handle
+ */
+ void setPropertyToDefaultByHandle( sal_Int32 _nHandle );
+
+ /** get the default value for the property denoted by the given handle
+
+ @precond
+ <arg>_nHandle</arg> is a valid property handle
+ */
+ virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, css::uno::Any& _rDefault ) const = 0;
+
+ protected:
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& _rType ) override;
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ protected:
+ /** returns the handle for the given name
+
+ @throw UnknownPropertyException if the given name is not a registered property
+ */
+ sal_Int32 getHandleForName( const OUString& _rPropertyName );
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_PROPERTYSTATECONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertyvalue.hxx b/include/comphelper/propertyvalue.hxx
new file mode 100644
index 000000000..de7179110
--- /dev/null
+++ b/include/comphelper/propertyvalue.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTYVALUE_HXX
+#define INCLUDED_COMPHELPER_PROPERTYVALUE_HXX
+
+#include <sal/config.h>
+
+#include <type_traits>
+#include <utility>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+namespace comphelper
+{
+/**
+ * Creates a beans::PropertyValue easily, i.e. you can write:
+ *
+ * function(comphelper::makePropertyValue("Foo", nBar));
+ *
+ * instead of writing 3 extra lines to set the name and value of the beans::PropertyValue.
+ */
+template <typename T, std::enable_if_t<!std::is_arithmetic_v<std::remove_reference_t<T>>, int> = 0>
+css::beans::PropertyValue makePropertyValue(const OUString& rName, T&& rValue)
+{
+ return { rName, 0, css::uno::toAny(std::forward<T>(rValue)),
+ css::beans::PropertyState_DIRECT_VALUE };
+}
+// Allows to pass e.g. bit fields
+template <typename T, std::enable_if_t<std::is_arithmetic_v<T>, int> = 0>
+css::beans::PropertyValue makePropertyValue(const OUString& rName, T aValue)
+{
+ return makePropertyValue(rName, css::uno::toAny(aValue));
+}
+}
+
+#endif // INCLUDED_COMPHELPER_PROPERTYVALUE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propmultiplex.hxx b/include/comphelper/propmultiplex.hxx
new file mode 100644
index 000000000..41d456d43
--- /dev/null
+++ b/include/comphelper/propmultiplex.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPMULTIPLEX_HXX
+#define INCLUDED_COMPHELPER_PROPMULTIPLEX_HXX
+
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ref.hxx>
+#include <vector>
+
+namespace com::sun::star::beans { class XPropertySet; }
+
+//= property helper classes
+
+
+namespace comphelper
+{
+
+
+ class OPropertyChangeMultiplexer;
+
+
+ //= OPropertyChangeListener
+
+ /// simple listener adapter for property sets
+ class COMPHELPER_DLLPUBLIC OPropertyChangeListener
+ {
+ friend class OPropertyChangeMultiplexer;
+
+ rtl::Reference<OPropertyChangeMultiplexer> m_xAdapter;
+ ::osl::Mutex& m_rMutex;
+
+ public:
+ OPropertyChangeListener(::osl::Mutex& _rMutex)
+ : m_rMutex(_rMutex) { }
+ virtual ~OPropertyChangeListener();
+
+ /// @throws css::uno::RuntimeException
+ virtual void _propertyChanged(const css::beans::PropertyChangeEvent& _rEvent) = 0;
+ /// @throws css::uno::RuntimeException
+ virtual void _disposing(const css::lang::EventObject& _rSource);
+
+ protected:
+ /** If the derivee also owns the mutex which we know as reference, then call this within your
+ derivee's dtor.
+ */
+ void disposeAdapter();
+
+ // pseudo-private. Making it private now could break compatibility
+ void setAdapter( OPropertyChangeMultiplexer* _pAdapter );
+ };
+
+
+ //= OPropertyChangeMultiplexer
+
+ /// multiplexer for property changes
+ // workaround for incremental linking bugs in MSVC2019
+ class SAL_DLLPUBLIC_TEMPLATE OPropertyChangeMultiplexer_Base : public cppu::WeakImplHelper< css::beans::XPropertyChangeListener > {};
+ class COMPHELPER_DLLPUBLIC OPropertyChangeMultiplexer final : public OPropertyChangeMultiplexer_Base
+ {
+ friend class OPropertyChangeListener;
+ std::vector< OUString > m_aProperties;
+ css::uno::Reference< css::beans::XPropertySet> m_xSet;
+ OPropertyChangeListener* m_pListener;
+ sal_Int32 m_nLockCount;
+ bool m_bListening : 1;
+ bool const m_bAutoSetRelease : 1;
+
+
+ virtual ~OPropertyChangeMultiplexer() override;
+ public:
+ OPropertyChangeMultiplexer(OPropertyChangeListener* _pListener, const css::uno::Reference< css::beans::XPropertySet>& _rxSet, bool _bAutoReleaseSet = true);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& evt ) override;
+
+ /// incremental lock
+ void lock();
+ /// incremental unlock
+ void unlock();
+ /// get the lock count
+ sal_Int32 locked() const { return m_nLockCount; }
+
+ void addProperty(const OUString& aPropertyName);
+ void dispose();
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_PROPMULTIPLEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propstate.hxx b/include/comphelper/propstate.hxx
new file mode 100644
index 000000000..7729aaa9b
--- /dev/null
+++ b/include/comphelper/propstate.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPSTATE_HXX
+#define INCLUDED_COMPHELPER_PROPSTATE_HXX
+
+#include <config_options.h>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/uno/Sequence.h>
+
+
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/weak.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <comphelper/comphelperdllapi.h>
+
+
+//= property helper classes
+
+
+namespace comphelper
+{
+
+
+ //= OPropertyStateHelper
+
+ /// helper class for implementing property states
+ class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OPropertyStateHelper :public ::cppu::OPropertySetHelper2
+ ,public css::beans::XPropertyState
+ {
+ public:
+ OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp):OPropertySetHelper2(rBHlp) { }
+ OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp,
+ ::cppu::IEventNotificationHook *i_pFireEvents);
+
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& aType) override;
+
+ // XPropertyState
+ virtual css::beans::PropertyState SAL_CALL
+ getPropertyState(const OUString& PropertyName) override;
+ virtual css::uno::Sequence< css::beans::PropertyState> SAL_CALL
+ getPropertyStates(const css::uno::Sequence< OUString >& aPropertyName) override;
+ virtual void SAL_CALL
+ setPropertyToDefault(const OUString& PropertyName) override;
+ virtual css::uno::Any SAL_CALL
+ getPropertyDefault(const OUString& aPropertyName) override;
+
+ // access via handle
+ virtual css::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle);
+ virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle);
+ virtual css::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const;
+
+ protected:
+ virtual ~OPropertyStateHelper() override;
+
+ void firePropertyChange(sal_Int32 nHandle, const css::uno::Any& aNewValue, const css::uno::Any& aOldValue);
+
+ static css::uno::Sequence<css::uno::Type> getTypes();
+ };
+
+
+ //= OPropertyStateHelper
+
+ class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OStatefulPropertySet :public ::cppu::OWeakObject
+ ,public css::lang::XTypeProvider
+ ,public OMutexAndBroadcastHelper // order matters: before OPropertyStateHelper/OPropertySetHelper
+ ,public OPropertyStateHelper
+ {
+ protected:
+ OStatefulPropertySet();
+ virtual ~OStatefulPropertySet() override;
+
+ protected:
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_PROPSTATE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/proxyaggregation.hxx b/include/comphelper/proxyaggregation.hxx
new file mode 100644
index 000000000..48444355c
--- /dev/null
+++ b/include/comphelper/proxyaggregation.hxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROXYAGGREGATION_HXX
+#define INCLUDED_COMPHELPER_PROXYAGGREGATION_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <cppuhelper/basemutex.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/compbase_ex.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::uno {
+ class XComponentContext;
+}
+namespace com::sun::star::uno { class XAggregation; }
+namespace com::sun::star::lang { class XComponent; }
+
+/* class hierarchy herein:
+
+ +-------------------+ helper class for aggregating the proxy to another object
+ | OProxyAggregation | - not ref counted
+ +-------------------+ - no UNO implementation, i.e. not derived from XInterface
+ ^ (neither direct nor indirect)
+ |
+ |
+ +----------------------------------+ helper class for aggregating a proxy to an XComponent
+ | OComponentProxyAggregationHelper | - life time coupling: if the inner component (the "aggregate")
+ +----------------------------------+ is disposed, the outer (the delegator) is disposed, too, and
+ ^ vice versa
+ | - UNO based, implementing XEventListener
+ |
+ +----------------------------+ component aggregating another XComponent
+ | OComponentProxyAggregation | - life time coupling as above
+ +----------------------------+ - ref-counted
+ - implements an XComponent itself
+
+ If you need to
+
+ - wrap a foreign object which is a XComponent
+ => use OComponentProxyAggregation
+ - call componentAggregateProxyFor in your ctor
+ - call implEnsureDisposeInDtor in your dtor
+
+ - wrap a foreign object which is a XComponent, but already have ref-counting mechanisms
+ inherited from somewhere else
+ => use OComponentProxyAggregationHelper
+ - override dispose - don't forget to call the base class' dispose!
+ - call componentAggregateProxyFor in your ctor
+
+ - wrap a foreign object which is no XComponent
+ => use OProxyAggregation
+ - call baseAggregateProxyFor in your ctor
+*/
+
+
+namespace comphelper
+{
+
+
+ //= OProxyAggregation
+
+ /** helper class for aggregating a proxy for a foreign object
+ */
+ class OProxyAggregation
+ {
+ private:
+ css::uno::Reference< css::uno::XAggregation > m_xProxyAggregate;
+ css::uno::Reference< css::lang::XTypeProvider > m_xProxyTypeAccess;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ protected:
+ const css::uno::Reference< css::uno::XComponentContext >& getComponentContext() const
+ {
+ return m_xContext;
+ }
+
+ protected:
+ OProxyAggregation( const css::uno::Reference< css::uno::XComponentContext >& _rxContext );
+ ~OProxyAggregation();
+
+ /// to be called from within your ctor
+ void baseAggregateProxyFor(
+ const css::uno::Reference< css::uno::XInterface >& _rxComponent,
+ oslInterlockedCount& _rRefCount,
+ ::cppu::OWeakObject& _rDelegator
+ );
+
+ // XInterface and XTypeProvider
+ /// @throws css::uno::RuntimeException
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType );
+ /// @throws css::uno::RuntimeException
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( );
+
+ private:
+ OProxyAggregation( const OProxyAggregation& ) = delete;
+ OProxyAggregation& operator=( const OProxyAggregation& ) = delete;
+ };
+
+
+ //= OComponentProxyAggregationHelper
+
+ /** a helper class for aggregating a proxy to an XComponent
+
+ <p>The object couples the life time of itself and the component: if one of the both
+ dies (in a sense of being disposed), the other one dies, too.</p>
+
+ <p>The class itself does not implement XComponent so you need to forward any XComponent::dispose
+ calls which your derived class gets to the dispose method of this class.</p>
+ */
+
+ class OComponentProxyAggregationHelper :public ::cppu::ImplHelper1 < css::lang::XEventListener
+ >
+ ,private OProxyAggregation
+ {
+ private:
+ typedef ::cppu::ImplHelper1 < css::lang::XEventListener
+ > BASE; // prevents some MSVC problems
+
+ protected:
+ css::uno::Reference< css::lang::XComponent >
+ m_xInner;
+ ::cppu::OBroadcastHelper& m_rBHelper;
+
+ protected:
+ // OProxyAggregation
+ using OProxyAggregation::getComponentContext;
+
+ // XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type& _rType ) override;
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ protected:
+ OComponentProxyAggregationHelper(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ ::cppu::OBroadcastHelper& _rBHelper
+ );
+ virtual ~OComponentProxyAggregationHelper( );
+
+ /// to be called from within your ctor
+ void componentAggregateProxyFor(
+ const css::uno::Reference< css::lang::XComponent >& _rxComponent,
+ oslInterlockedCount& _rRefCount,
+ ::cppu::OWeakObject& _rDelegator
+ );
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XComponent
+ /// @throws css::uno::RuntimeException
+ virtual void SAL_CALL dispose() = 0;
+
+ private:
+ OComponentProxyAggregationHelper( const OComponentProxyAggregationHelper& ) = delete;
+ OComponentProxyAggregationHelper& operator=( const OComponentProxyAggregationHelper& ) = delete;
+ };
+
+
+ //= OComponentProxyAggregation
+
+ class COMPHELPER_DLLPUBLIC OComponentProxyAggregation : public cppu::BaseMutex
+ ,public cppu::WeakComponentImplHelperBase
+ ,public OComponentProxyAggregationHelper
+ {
+ protected:
+ OComponentProxyAggregation(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const css::uno::Reference< css::lang::XComponent >& _rxComponent
+ );
+
+ virtual ~OComponentProxyAggregation() override;
+
+ // XInterface
+ DECLARE_XINTERFACE()
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& _rSource ) override;
+
+ // XComponent/OComponentProxyAggregationHelper
+ virtual void SAL_CALL dispose() override;
+
+ private:
+ OComponentProxyAggregation( const OComponentProxyAggregation& ) = delete;
+ OComponentProxyAggregation& operator=( const OComponentProxyAggregation& ) = delete;
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_PROXYAGGREGATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/random.hxx b/include/comphelper/random.hxx
new file mode 100644
index 000000000..345d57c71
--- /dev/null
+++ b/include/comphelper/random.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_RANDOM_HXX
+#define INCLUDED_COMPHELPER_RANDOM_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+namespace comphelper::rng
+{
+// These functions obey the SAL_RAND_REPEATABLE environment
+// variable: If it is set, use a fixed seed.
+
+// note that uniform_int_distribution is inclusive of b, i.e. [a,b] while
+// uniform_real_distribution is exclusive of b, i.e. [a,b), std::nextafter may be your friend there
+
+/// uniform distribution in [a,b)
+COMPHELPER_DLLPUBLIC double uniform_real_distribution(double a = 0.0, double b = 1.0);
+
+/// uniform distribution in [a,b]
+COMPHELPER_DLLPUBLIC int uniform_int_distribution(int a, int b);
+
+/// uniform distribution in [a,b]
+COMPHELPER_DLLPUBLIC unsigned int uniform_uint_distribution(unsigned int a, unsigned int b);
+
+/// uniform distribution in [a,b]
+COMPHELPER_DLLPUBLIC size_t uniform_size_distribution(size_t a, size_t b);
+
+} // namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/refcountedmutex.hxx b/include/comphelper/refcountedmutex.hxx
new file mode 100644
index 000000000..fcda72097
--- /dev/null
+++ b/include/comphelper/refcountedmutex.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_REFCOUNTEDMUTEX_HXX
+#define INCLUDED_COMPHELPER_REFCOUNTEDMUTEX_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <osl/mutex.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+namespace comphelper
+{
+class COMPHELPER_DLLPUBLIC RefCountedMutex final : public salhelper::SimpleReferenceObject
+{
+ osl::Mutex m_aMutex;
+
+public:
+ ~RefCountedMutex() override;
+
+ ::osl::Mutex& GetMutex() { return m_aMutex; }
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_REFCOUNTEDMUTEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/scopeguard.hxx b/include/comphelper/scopeguard.hxx
new file mode 100644
index 000000000..95832c505
--- /dev/null
+++ b/include/comphelper/scopeguard.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SCOPEGUARD_HXX
+#define INCLUDED_COMPHELPER_SCOPEGUARD_HXX
+
+#include <sal/config.h>
+
+#include <utility>
+
+#include <o3tl/deleter.hxx>
+
+// For some reason, Android buildbot issues -Werror like this:
+// In file included from
+// /home/android/lo/master-android-arm/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx:50:
+// /home/android/lo/master-android-arm/include/comphelper/scopeguard.hxx:36:14:
+// error: function 'comphelper::<deduction guide for ScopeGuard><(lambda at
+// /home/android/lo/master-android-arm/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx:146:34)>'
+// has internal linkage but is not defined [-Werror,-Wundefined-internal]
+// explicit ScopeGuard( Func && func ) : m_func( std::move(func) ) {}
+// ^
+// /home/android/lo/master-android-arm/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx:146:28:
+// note: used here
+// comphelper::ScopeGuard guard([&]() {
+// ^
+#ifdef ANDROID
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wundefined-internal"
+#endif
+#endif
+
+
+namespace comphelper {
+
+/** ScopeGuard to ease writing exception-safe code.
+ */
+template <class Func> class ScopeGuard
+{
+public:
+ /** @param func function object to be executed in dtor
+ */
+ explicit ScopeGuard( Func && func ) : m_func( std::move(func) ) {}
+
+ ~ScopeGuard()
+ {
+ if (m_bDismissed)
+ return;
+ suppress_fun_call_w_exception(m_func());
+ }
+
+ /** Dismisses the scope guard, i.e. the function won't
+ be executed.
+ */
+ void dismiss() { m_bDismissed = true; }
+
+private:
+ // noncopyable until we have good reasons...
+ ScopeGuard(const ScopeGuard&) = delete;
+ ScopeGuard& operator=(const ScopeGuard&) = delete;
+
+ Func m_func;
+ bool m_bDismissed = false;
+};
+
+} // namespace comphelper
+
+#ifdef ANDROID
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
+#endif
+
+#endif // ! defined(INCLUDED_COMPHELPER_SCOPEGUARD_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/seekableinput.hxx b/include/comphelper/seekableinput.hxx
new file mode 100644
index 000000000..0c2092f7b
--- /dev/null
+++ b/include/comphelper/seekableinput.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_SEEKABLEINPUT_HXX
+#define INCLUDED_COMPHELPER_SEEKABLEINPUT_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <mutex>
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace comphelper
+{
+
+class SAL_DLLPUBLIC_TEMPLATE OSeekableInputWrapper_BASE
+ : public ::cppu::WeakImplHelper< css::io::XInputStream,
+ css::io::XSeekable >
+{};
+
+class COMPHELPER_DLLPUBLIC OSeekableInputWrapper final
+ : public OSeekableInputWrapper_BASE
+{
+ std::mutex m_aMutex;
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ css::uno::Reference< css::io::XInputStream > m_xOriginalStream;
+
+ css::uno::Reference< css::io::XInputStream > m_xCopyInput;
+ css::uno::Reference< css::io::XSeekable > m_xCopySeek;
+
+private:
+ COMPHELPER_DLLPRIVATE void PrepareCopy_Impl();
+
+public:
+ OSeekableInputWrapper(
+ css::uno::Reference< css::io::XInputStream > xInStream,
+ css::uno::Reference< css::uno::XComponentContext > xContext );
+
+ virtual ~OSeekableInputWrapper() override;
+
+ static css::uno::Reference< css::io::XInputStream > CheckSeekableCanWrap(
+ const css::uno::Reference< css::io::XInputStream >& xInStream,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+
+// XInputStream
+ virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) override;
+ virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) override;
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
+ virtual sal_Int32 SAL_CALL available() override;
+ virtual void SAL_CALL closeInput() override;
+
+// XSeekable
+ virtual void SAL_CALL seek( sal_Int64 location ) override;
+ virtual sal_Int64 SAL_CALL getPosition() override;
+ virtual sal_Int64 SAL_CALL getLength() override;
+
+};
+
+} // namespace comphelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/seqstream.hxx b/include/comphelper/seqstream.hxx
new file mode 100644
index 000000000..c2ba39134
--- /dev/null
+++ b/include/comphelper/seqstream.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_SEQSTREAM_HXX
+#define INCLUDED_COMPHELPER_SEQSTREAM_HXX
+
+#include <config_options.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <comphelper/bytereader.hxx>
+#include <mutex>
+
+namespace comphelper
+{
+
+
+// SequenceInputStream
+// stream for reading data from a sequence of bytes
+
+
+class COMPHELPER_DLLPUBLIC SequenceInputStream final
+ : public ::cppu::WeakImplHelper< css::io::XInputStream, css::io::XSeekable, css::lang::XUnoTunnel >,
+ public comphelper::ByteReader
+{
+ std::mutex m_aMutex;
+ css::uno::Sequence<sal_Int8> const m_aData;
+ sal_Int32 m_nPos;
+
+public:
+ SequenceInputStream(css::uno::Sequence<sal_Int8> const & rData);
+
+// css::io::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence<sal_Int8>& aData, sal_Int32 nBytesToRead ) override;
+
+ virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence<sal_Int8>& aData, sal_Int32 nMaxBytesToRead ) override;
+
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
+
+ virtual sal_Int32 SAL_CALL available( ) override;
+
+ virtual void SAL_CALL closeInput( ) override;
+
+ virtual void SAL_CALL seek( sal_Int64 location ) override;
+ virtual sal_Int64 SAL_CALL getPosition( ) override;
+ virtual sal_Int64 SAL_CALL getLength( ) override;
+
+// css::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+
+// comphelper::ByteReader
+ virtual sal_Int32 readSomeBytes( sal_Int8* pData, sal_Int32 nBytesToRead ) override;
+
+private:
+ sal_Int32 avail();
+};
+
+// don't export to avoid duplicate WeakImplHelper definitions with MSVC
+class SAL_DLLPUBLIC_TEMPLATE OSequenceOutputStream_Base
+ : public ::cppu::WeakImplHelper< css::io::XOutputStream >
+{};
+
+class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OSequenceOutputStream final : public OSequenceOutputStream_Base
+{
+private:
+ css::uno::Sequence< sal_Int8 >& m_rSequence;
+ double m_nResizeFactor;
+ sal_Int32 const m_nMinimumResize;
+ sal_Int32 m_nSize;
+ // the size of the virtual stream. This is not the size of the sequence, but the number of bytes written
+ // into the stream at a given moment.
+
+ bool m_bConnected;
+ // closeOutput has been called ?
+
+ std::mutex m_aMutex;
+
+ void finalizeOutput();
+ virtual ~OSequenceOutputStream() override { if (m_bConnected) finalizeOutput(); }
+
+public:
+ /** constructs the object. Everything written into the stream through the XOutputStream methods will be forwarded
+ to the sequence, reallocating it if necessary. Writing will start at offset 0 within the sequence.
+ @param _rSeq a reference to the sequence which will be used for output.
+ The caller is responsible for taking care of the lifetime of the stream
+ object and the sequence. If you're in doubt about this, use <code>closeOutput</code>
+ before destroying the sequence
+ @param _nResizeFactor the factor which is used for resizing the sequence when necessary. In every
+ resize step, the new sequence size will be calculated by multiplying the current
+ size with this factor, rounded off to the next multiple of 4.
+ @param _nMinimumResize the minimal number of bytes which is additionally allocated on resizing
+ @see closeOutput
+ */
+ OSequenceOutputStream(
+ css::uno::Sequence< sal_Int8 >& _rSeq,
+ double _nResizeFactor = 1.3,
+ sal_Int32 _nMinimumResize = 128
+ );
+
+ /// same as XOutputStream::writeBytes (as expected :)
+ virtual void SAL_CALL writeBytes( const css::uno::Sequence< sal_Int8 >& aData ) override;
+ /// this is a dummy in this implementation, no buffering is used
+ virtual void SAL_CALL flush( ) override;
+ /** closes the output stream. In the case of this class, this means that the sequence used for writing is
+ resized to the really used size and not used any further, every subsequent call to one of the XOutputStream
+ methods will throw a <code>NotConnectedException</code>.
+ */
+ virtual void SAL_CALL closeOutput( ) override;
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_SEQSTREAM_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx
new file mode 100644
index 000000000..bc67559df
--- /dev/null
+++ b/include/comphelper/sequence.hxx
@@ -0,0 +1,322 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SEQUENCE_HXX
+#define INCLUDED_COMPHELPER_SEQUENCE_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <osl/diagnose.h>
+
+#include <algorithm>
+#include <vector>
+
+namespace comphelper
+{
+ /** Search the given value within the given sequence, return the position of the first occurrence.
+ Returns -1 if nothing found.
+ */
+ template <class T1, class T2>
+ inline sal_Int32 findValue(const css::uno::Sequence<T1>& _rList, const T2& _rValue)
+ {
+ // at which position do I find the value?
+ for (sal_Int32 i = 0; i < _rList.getLength(); ++i)
+ {
+ if (_rList[i] == _rValue)
+ return i;
+ }
+
+ return -1;
+ }
+
+ /// concat several sequences
+ template <class T, class... Ss>
+ inline css::uno::Sequence<T> concatSequences(const css::uno::Sequence<T>& rS1, const Ss&... rSn)
+ {
+ // unary fold to disallow empty parameter pack: at least have one sequence in rSn
+ css::uno::Sequence<T> aReturn(std::size(rS1) + (... + std::size(rSn)));
+ T* pReturn = std::copy(std::begin(rS1), std::end(rS1), aReturn.getArray());
+ (..., (pReturn = std::copy(std::begin(rSn), std::end(rSn), pReturn)));
+ return aReturn;
+ }
+
+ /// concat additional elements from right sequence to left sequence
+ ///
+ /// be aware that this takes time O(|left| * |right|)
+ template<typename T> inline css::uno::Sequence<T> combineSequences(
+ css::uno::Sequence<T> const & left, css::uno::Sequence<T> const & right)
+ {
+ sal_Int32 n1 = left.getLength();
+ css::uno::Sequence<T> ret(n1 + right.getLength());
+ //TODO: check for overflow
+ auto pRet = ret.getArray();
+ std::copy_n(left.getConstArray(), n1, pRet);
+ sal_Int32 n2 = n1;
+ for (sal_Int32 i = 0; i != right.getLength(); ++i) {
+ bool found = false;
+ for (sal_Int32 j = 0; j != n1; ++j) {
+ if (right[i] == left[j]) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ pRet[n2++] = right[i];
+ }
+ }
+ ret.realloc(n2);
+ return ret;
+ }
+
+ /// remove a specified element from a sequences
+ template<class T>
+ inline void removeElementAt(css::uno::Sequence<T>& _rSeq, sal_Int32 _nPos)
+ {
+ sal_Int32 nLength = _rSeq.getLength();
+
+ OSL_ENSURE(0 <= _nPos && _nPos < nLength, "invalid index");
+
+ T* pPos = _rSeq.getArray() + _nPos;
+ std::move(pPos + 1, pPos + nLength - _nPos, pPos);
+
+ _rSeq.realloc(nLength-1);
+ }
+
+ /** Copy from a plain C/C++ array into a Sequence.
+
+ @tpl SrcType
+ Array element type. Must be assignable to DstType
+
+ @tpl DstType
+ Sequence element type. Must be assignable from SrcType
+
+ @param i_pArray
+ Valid pointer to at least num elements of type SrcType
+
+ @param nNum
+ Number of array elements to copy
+
+ @return the resulting Sequence
+
+ @attention when copying from e.g. a double array to a
+ Sequence<int>, no proper rounding will be performed, but the
+ values will be truncated. There's currently no measure to
+ prevent or detect precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ inline css::uno::Sequence< DstType > arrayToSequence( const SrcType* i_pArray, sal_Int32 nNum )
+ {
+ if constexpr (std::is_same_v< DstType, SrcType >)
+ {
+ return css::uno::Sequence< DstType >( i_pArray, nNum );
+ }
+ else
+ {
+ css::uno::Sequence< DstType > result( nNum );
+ ::std::copy( i_pArray, i_pArray+nNum, result.getArray() );
+ return result;
+ }
+ }
+
+
+ /** Copy from a Sequence into a plain C/C++ array
+
+ @tpl SrcType
+ Sequence element type. Must be assignable to DstType
+
+ @tpl DstType
+ Array element type. Must be assignable from SrcType
+
+ @param io_pArray
+ Valid pointer to at least i_Sequence.getLength() elements of
+ type DstType
+
+ @param i_Sequence
+ Reference to a Sequence of SrcType elements
+
+ @return a pointer to the array
+
+ @attention when copying from e.g. a Sequence<double> to an int
+ array, no proper rounding will be performed, but the values
+ will be truncated. There's currently no measure to prevent or
+ detect precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ inline DstType* sequenceToArray( DstType* io_pArray, const css::uno::Sequence< SrcType >& i_Sequence )
+ {
+ ::std::copy( i_Sequence.begin(), i_Sequence.end(), io_pArray );
+ return io_pArray;
+ }
+
+
+ /** Copy from a container into a Sequence
+
+ @tpl SrcType
+ Container type. This type must fulfill the STL container
+ concept, in particular, the size(), begin() and end() methods
+ must be available and have the usual semantics.
+
+ @tpl DstType
+ Sequence element type. Must be assignable from SrcType's
+ elements
+
+ @param i_Container
+ Reference to the input contain with elements of type SrcType
+
+ @return the generated Sequence
+
+ @attention this function always performs a copy. Furthermore,
+ when copying from e.g. a vector<double> to a Sequence<int>, no
+ proper rounding will be performed, but the values will be
+ truncated. There's currently no measure to prevent or detect
+ precision loss, overflow or truncation.
+ */
+ template < typename DstElementType, typename SrcType >
+ inline css::uno::Sequence< DstElementType > containerToSequence( const SrcType& i_Container )
+ {
+ using ::std::size, ::std::begin, ::std::end;
+ css::uno::Sequence< DstElementType > result( size(i_Container) );
+ ::std::copy( begin(i_Container), end(i_Container), result.getArray() );
+ return result;
+ }
+
+ // this one does better type deduction, but does not allow us to copy into a different element type
+ template < typename SrcType >
+ inline css::uno::Sequence< typename SrcType::value_type > containerToSequence( const SrcType& i_Container )
+ {
+ return containerToSequence<typename SrcType::value_type, SrcType>(i_Container);
+ }
+
+ // handle arrays
+ template<typename ElementType, std::size_t SrcSize>
+ inline css::uno::Sequence< ElementType > containerToSequence( ElementType const (&i_Array)[ SrcSize ] )
+ {
+ return css::uno::Sequence< ElementType >( i_Array, SrcSize );
+ }
+
+ template <typename T>
+ inline css::uno::Sequence<T> containerToSequence(
+ ::std::vector<T> const& v )
+ {
+ return css::uno::Sequence<T>(
+ v.data(), static_cast<sal_Int32>(v.size()) );
+ }
+
+
+ /** Copy from a Sequence into a container
+
+ @tpl SrcType
+ Sequence element type. Must be assignable to SrcType's
+ elements
+
+ @tpl DstType
+ Container type. This type must have a constructor taking a pair
+ of iterators defining a range to copy from
+
+ @param i_Sequence
+ Reference to a Sequence of SrcType elements
+
+ @return the generated container. C++17 copy elision rules apply
+
+ @attention this function always performs a copy. Furthermore,
+ when copying from e.g. a Sequence<double> to a vector<int>, no
+ proper rounding will be performed, but the values will be
+ truncated. There's currently no measure to prevent or detect
+ precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ inline DstType sequenceToContainer( const css::uno::Sequence< SrcType >& i_Sequence )
+ {
+ return DstType(i_Sequence.begin(), i_Sequence.end());
+ }
+
+ // this one does better type deduction, but does not allow us to copy into a different element type
+ template < typename DstType >
+ inline DstType sequenceToContainer( const css::uno::Sequence< typename DstType::value_type >& i_Sequence )
+ {
+ return DstType(i_Sequence.begin(), i_Sequence.end());
+ }
+
+ /** Copy from a Sequence into an existing container
+
+ This potentially saves a needless extra copy operation over
+ the whole container, as it passes the target object by
+ reference.
+
+ @tpl SrcType
+ Sequence element type. Must be assignable to SrcType's
+ elements
+
+ @tpl DstType
+ Container type. This type must fulfill the STL container and
+ sequence concepts, in particular, the begin(), end() and
+ resize(int) methods must be available and have the usual
+ semantics.
+
+ @param o_Output
+ Reference to the target container
+
+ @param i_Sequence
+ Reference to a Sequence of SrcType elements
+
+ @return a non-const reference to the given container
+
+ @attention this function always performs a copy. Furthermore,
+ when copying from e.g. a Sequence<double> to a vector<int>, no
+ proper rounding will be performed, but the values will be
+ truncated. There's currently no measure to prevent or detect
+ precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ inline DstType& sequenceToContainer( DstType& o_Output, const css::uno::Sequence< SrcType >& i_Sequence )
+ {
+ o_Output.resize( i_Sequence.getLength() );
+ ::std::copy( i_Sequence.begin(), i_Sequence.end(), o_Output.begin() );
+ return o_Output;
+ }
+
+ /** Copy (keys or values) from an associate container into a Sequence
+
+ @tpl M map container type eg. std::map/std::unordered_map
+
+ @return the generated Sequence
+ */
+ template < typename M >
+ inline css::uno::Sequence< typename M::key_type > mapKeysToSequence( M const& map )
+ {
+ css::uno::Sequence< typename M::key_type > ret( static_cast<sal_Int32>(map.size()) );
+ std::transform(map.begin(), map.end(), ret.getArray(),
+ [](const auto& i) { return i.first; });
+ return ret;
+ }
+
+ template < typename M >
+ inline css::uno::Sequence< typename M::mapped_type > mapValuesToSequence( M const& map )
+ {
+ css::uno::Sequence< typename M::mapped_type > ret( static_cast<sal_Int32>(map.size()) );
+ std::transform(map.begin(), map.end(), ret.getArray(),
+ [](const auto& i) { return i.second; });
+ return ret;
+ }
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_SEQUENCE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/sequenceashashmap.hxx b/include/comphelper/sequenceashashmap.hxx
new file mode 100644
index 000000000..59ab4c298
--- /dev/null
+++ b/include/comphelper/sequenceashashmap.hxx
@@ -0,0 +1,426 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SEQUENCEASHASHMAP_HXX
+#define INCLUDED_COMPHELPER_SEQUENCEASHASHMAP_HXX
+
+#include <unordered_map>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::beans { struct NamedValue; }
+namespace com::sun::star::beans { struct PropertyValue; }
+
+namespace comphelper{
+
+
+/** @short Implements a stl hash map on top of some
+ specialized sequence from type PropertyValue
+ or NamedValue.
+
+ @descr That provides the possibility to modify
+ such name sequences very easy ...
+ */
+
+/** Cache the hash code since calculating it for every comparison adds up */
+struct OUStringAndHashCode
+{
+ OUString maString;
+ sal_Int32 mnHashCode;
+
+ OUStringAndHashCode(OUString s) : maString(s), mnHashCode(maString.hashCode()) {}
+};
+struct OUStringAndHashCodeEqual
+{
+ bool operator()(const OUStringAndHashCode & lhs, const OUStringAndHashCode & rhs) const
+ {
+ return lhs.mnHashCode == rhs.mnHashCode && lhs.maString == rhs.maString;
+ }
+};
+struct OUStringAndHashCodeHash
+{
+ size_t operator()(const OUStringAndHashCode & i) const
+ {
+ return i.mnHashCode;
+ }
+};
+using SequenceAsHashMapBase = std::unordered_map<OUStringAndHashCode, css::uno::Any, OUStringAndHashCodeHash, OUStringAndHashCodeEqual>;
+
+class SAL_WARN_UNUSED COMPHELPER_DLLPUBLIC SequenceAsHashMap
+{
+
+ public:
+
+
+ /** @short creates an empty hash map.
+ */
+ SequenceAsHashMap();
+
+
+ /** @see operator<<(const css::uno::Any&)
+ */
+ SequenceAsHashMap(const css::uno::Any& aSource);
+
+
+ /** @see operator<<(const css::uno::Sequence< css::uno::Any >&)
+ */
+ SequenceAsHashMap(const css::uno::Sequence< css::uno::Any >& lSource);
+
+
+ /** @see operator<<(const css::uno::Sequence< css::beans::PropertyValue >&)
+ */
+ SequenceAsHashMap(const css::uno::Sequence< css::beans::PropertyValue >& lSource);
+
+
+ /** @see operator<<(const css::uno::Sequence< css::beans::NamedValue >&)
+ */
+ SequenceAsHashMap(const css::uno::Sequence< css::beans::NamedValue >& lSource);
+
+
+ /** @short fill this map from the given
+ Any, which of course must contain
+ a suitable sequence of element types
+ "css.beans.PropertyValue" or "css.beans.NamedValue".
+
+ @attention If the given Any is an empty one
+ (if it's set to VOID), no exception
+ is thrown. In such case this instance will
+ be created as an empty one too!
+
+ @param aSource
+ contains the new items for this map.
+
+ @throw A css::lang::IllegalArgumentException
+ is thrown, if the given Any does not contain a suitable sequence ...
+ but not if it's a VOID Any!
+ */
+ void operator<<(const css::uno::Any& aSource);
+
+
+ /** @short fill this map from the given
+ sequence, where every Any must contain
+ an item from type "css.beans.PropertyValue"
+ "css.beans.NamedValue".
+
+ @param lSource
+ contains the new items for this map.
+
+ @throw A css::lang::IllegalArgumentException
+ is thrown, if the given Any sequence
+ uses wrong types for its items. VOID Any will be ignored!
+ */
+ void operator<<(const css::uno::Sequence< css::uno::Any >& lSource);
+
+
+ /** @short fill this map from the given
+ PropertyValue sequence.
+
+ @param lSource
+ contains the new items for this map.
+ */
+ void operator<<(const css::uno::Sequence< css::beans::PropertyValue >& lSource);
+
+
+ /** @short fill this map from the given
+ NamedValue sequence.
+
+ @param lSource
+ contains the new items for this map.
+ */
+ void operator<<(const css::uno::Sequence< css::beans::NamedValue >& lSource);
+
+
+ /** @short converts this map instance to an
+ PropertyValue sequence.
+
+ @param lDestination
+ target sequence for converting.
+ */
+ void operator>>(css::uno::Sequence< css::beans::PropertyValue >& lDestination) const;
+
+
+ /** @short converts this map instance to an
+ NamedValue sequence.
+
+ @param lDestination
+ target sequence for converting.
+ */
+ void operator>>(css::uno::Sequence< css::beans::NamedValue >& lDestination) const;
+
+
+ /** @short return this map instance as an
+ Any, which can be
+ used in const environments only.
+
+ @descr It's made const to prevent using of the
+ return value directly as an in/out parameter!
+ usage: myMethod(stlDequeAdapter.getAsAnyList());
+
+ @param bAsPropertyValue
+ switch between using of PropertyValue or NamedValue as
+ value type.
+
+ @return A const Any, which
+ contains all items of this map.
+ */
+ css::uno::Any getAsConstAny(bool bAsPropertyValue) const;
+
+
+ /** @short return this map instance to as a
+ NamedValue sequence, which can be
+ used in const environments only.
+
+ @descr It's made const to prevent using of the
+ return value directly as an in/out parameter!
+ usage: myMethod(stlDequeAdapter.getAsNamedValueList());
+
+ @return A const sequence of type NamedValue, which
+ contains all items of this map.
+ */
+ css::uno::Sequence< css::beans::NamedValue > getAsConstNamedValueList() const;
+
+
+ /** @short return this map instance to as a
+ PropertyValue sequence, which can be
+ used in const environments only.
+
+ @descr It's made const to prevent using of the
+ return value directly as an in/out parameter!
+ usage: myMethod(stlDequeAdapter.getAsPropertyValueList());
+
+ @return A const sequence of type PropertyValue, which
+ contains all items of this map.
+ */
+ css::uno::Sequence< css::beans::PropertyValue > getAsConstPropertyValueList() const;
+
+
+ /** @short check if the specified item exists
+ and return its (unpacked!) value or it returns the
+ specified default value otherwise.
+
+ @descr If a value should be extracted only in case
+ the requested property exists really (without creating
+ of new items as it the index operator of a
+ hash map does!) this method can be used.
+
+ @param sKey
+ key name of the item.
+
+ @param aDefault
+ the default value, which is returned
+ if the specified item could not
+ be found.
+
+ @return The (unpacked!) value of the specified property or
+ the given default value otherwise.
+
+ @attention "unpacked" means the Any content of every iterator->second!
+ */
+ template< class TValueType >
+ TValueType getUnpackedValueOrDefault(const OUString& sKey ,
+ const TValueType& aDefault) const
+ {
+ auto pIt = m_aMap.find(sKey);
+ if (pIt == m_aMap.end())
+ return aDefault;
+
+ TValueType aValue = TValueType();
+ if (!(pIt->second >>= aValue))
+ return aDefault;
+
+ return aValue;
+ }
+
+ /** @short check if the specified item exists
+ and return its value or it returns
+ an empty css::uno::Any.
+
+ @descr If a value should be extracted only in case
+ the requested property exists really (without creating
+ of new items as the index operator of a
+ hash map does!) this method can be used.
+
+ @param sKey
+ key name of the item.
+
+ @return The value of the specified property or
+ an empty css::uno::Any.
+ */
+ css::uno::Any getValue(const OUString& sKey) const
+ {
+ auto pIt = m_aMap.find(sKey);
+ if (pIt == m_aMap.end())
+ return css::uno::Any();
+
+ return pIt->second;
+ }
+
+
+ /** @short creates a new item with the specified
+ name and value only in case such item name
+ does not already exist.
+
+ @descr To check if the property already exists only
+ its name is used for compare. Its value isn't
+ checked!
+
+ @param sKey
+ key name of the property.
+
+ @param aValue
+ the new (unpacked!) value.
+ Note: This value will be transformed to an Any
+ internally, because only Any values can be
+ part of a PropertyValue or NamedValue structure.
+
+ @return TRUE if this property was added as new item;
+ FALSE if it already exists.
+ */
+ template< class TValueType >
+ bool createItemIfMissing(const OUString& sKey ,
+ const TValueType& aValue)
+ {
+ if (m_aMap.find(sKey) == m_aMap.end())
+ {
+ (*this)[sKey] = css::uno::toAny(aValue);
+ return true;
+ }
+
+ return false;
+ }
+
+
+ /** @short check if all items of given map
+ exists in these called map also.
+
+ @descr Every item of the given map must exists
+ with same name and value inside these map.
+ But these map can contain additional items
+ which are not part of the search-map.
+
+ @param rCheck
+ the map containing all items for checking.
+
+ @return
+ TRUE if all items of Rcheck could be found
+ in these map; FALSE otherwise.
+ */
+ bool match(const SequenceAsHashMap& rCheck) const;
+
+
+ /** @short merge all values from the given map into
+ this one.
+
+ @descr Existing items will be overwritten ...
+ missing items will be created new ...
+ but non specified items will stay alive !
+
+ @param rSource
+ the map containing all items for the update.
+ */
+ void update(const SequenceAsHashMap& rSource);
+
+ css::uno::Any& operator[](const OUString& rKey)
+ {
+ return m_aMap[rKey];
+ }
+
+ css::uno::Any& operator[](const OUStringAndHashCode& rKey)
+ {
+ return m_aMap[rKey];
+ }
+
+ using iterator = SequenceAsHashMapBase::iterator;
+ using const_iterator = SequenceAsHashMapBase::const_iterator;
+
+ void clear()
+ {
+ m_aMap.clear();
+ }
+
+ size_t size() const
+ {
+ return m_aMap.size();
+ }
+
+ bool empty() const
+ {
+ return m_aMap.empty();
+ }
+
+ iterator begin()
+ {
+ return m_aMap.begin();
+ }
+
+ const_iterator begin() const
+ {
+ return m_aMap.begin();
+ }
+
+ iterator end()
+ {
+ return m_aMap.end();
+ }
+
+ const_iterator end() const
+ {
+ return m_aMap.end();
+ }
+
+ iterator find(const OUString& rKey)
+ {
+ return m_aMap.find(rKey);
+ }
+
+ const_iterator find(const OUString& rKey) const
+ {
+ return m_aMap.find(rKey);
+ }
+
+ iterator find(const OUStringAndHashCode& rKey)
+ {
+ return m_aMap.find(rKey);
+ }
+
+ const_iterator find(const OUStringAndHashCode& rKey) const
+ {
+ return m_aMap.find(rKey);
+ }
+
+ iterator erase(iterator it)
+ {
+ return m_aMap.erase(it);
+ }
+
+ size_t erase(const OUString& rKey)
+ {
+ return m_aMap.erase(rKey);
+ }
+
+private:
+ SequenceAsHashMapBase m_aMap;
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_SEQUENCEASHASHMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/servicedecl.hxx b/include/comphelper/servicedecl.hxx
new file mode 100644
index 000000000..57da446e6
--- /dev/null
+++ b/include/comphelper/servicedecl.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_SERVICEDECL_HXX
+#define INCLUDED_COMPHELPER_SERVICEDECL_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <functional>
+#include <initializer_list>
+
+namespace comphelper::service_decl {
+
+class ServiceDecl;
+
+namespace detail {
+typedef ::std::function<
+ css::uno::Reference<css::uno::XInterface> /* return */
+ (ServiceDecl const&,
+ css::uno::Sequence<css::uno::Any> const&,
+ css::uno::Reference<css::uno::XComponentContext> const&)> CreateFuncF;
+}
+
+/** Class to declare a service implementation. There is no need to implement
+ lang::XServiceInfo nor lang::XInitialization anymore.
+ The declaration can be done in various ways, the (simplest) form is
+
+ <pre>
+ class MyClass : public cppu::WeakImplHelper<XInterface1, XInterface2> {
+ public:
+ MyClass( uno::Reference<uno::XComponentContext> const& xContext )
+ [...]
+ };
+ [...]
+ namespace sdecl = comphelper::service_decl;
+ sdecl::ServiceDecl const myDecl(
+ sdecl::class_<MyClass>(),
+ "my.unique.implementation.name",
+ "MyServiceSpec1;MyServiceSpec2" );
+ </pre>
+
+ If the service demands initialization by arguments, the implementation
+ class has to define a constructor taking both arguments and component
+ context:
+
+ <pre>
+ class MyClass : public cppu::WeakImplHelper<XInterface1, XInterface2> {
+ public:
+ MyClass( uno::Sequence<uno::Any> const& args,
+ uno::Reference<uno:XComponentContext> const& xContext )
+ [...]
+ };
+ [...]
+ namespace sdecl = comphelper::service_decl;
+ sdecl::ServiceDecl const myDecl(
+ sdecl::class_<MyClass, sdecl::with_args<true> >(),
+ "my.unique.implementation.name",
+ "MyServiceSpec1;MyServiceSpec2" );
+ </pre>
+
+ Additionally, there is the possibility to process some code after creation,
+ e.g. to add the newly created object as a listener or perform aggregation
+ (C++-UNO only):
+
+ <pre>
+ uno::Reference<uno::XInterface> somePostProcCode( MyClass * p );
+ [...]
+ namespace sdecl = comphelper::service_decl;
+ sdecl::ServiceDecl const myDecl(
+ sdecl::class_<MyClass, ... >(&somePostProcCode),
+ "my.unique.implementation.name",
+ "MyServiceSpec1;MyServiceSpec2" );
+ </pre>
+
+ In the latter case, somePostProcCode gets the yet unacquired "raw" pointer.
+*/
+class COMPHELPER_DLLPUBLIC ServiceDecl
+{
+public:
+ /** Ctor for multiple supported service names.
+
+ @param implClass implementation class description
+ @param pImplName implementation name
+ @param pSupportedServiceNames supported service names
+ @param cDelim delimiter for supported service names
+ */
+ ServiceDecl( const ServiceDecl& ) = delete;
+ ServiceDecl& operator=( const ServiceDecl& ) = delete;
+ template <typename ImplClassT>
+ ServiceDecl( ImplClassT const& implClass,
+ char const* pImplName,
+ char const* pSupportedServiceNames )
+ : m_createFunc(implClass.m_createFunc),
+ m_pImplName(pImplName),
+ m_pServiceNames(pSupportedServiceNames) {}
+
+ /// @internal gets called by component_getFactoryHelper()
+ void * getFactory( char const* pImplName ) const;
+
+ /// @return supported service names
+ css::uno::Sequence< OUString> getSupportedServiceNames() const;
+
+ /// @return whether name is in set of supported service names
+ bool supportsService( std::u16string_view name ) const;
+
+ /// @return implementation name
+ OUString getImplementationName() const;
+
+private:
+ class Factory;
+ friend class Factory;
+
+ detail::CreateFuncF const m_createFunc;
+ char const* const m_pImplName;
+ char const* const m_pServiceNames;
+};
+
+/** To specify whether the implementation class expects arguments
+ (uno::Sequence<uno::Any>).
+*/
+template <bool> struct with_args;
+
+/// @internal
+namespace detail {
+
+} // namespace detail
+
+
+COMPHELPER_DLLPUBLIC
+void* component_getFactoryHelper( const char* pImplName,
+ std::initializer_list<ServiceDecl const *> args );
+
+} // namespace comphelper::service_decl
+
+
+#endif // ! defined( INCLUDED_COMPHELPER_SERVICEDECL_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/servicehelper.hxx b/include/comphelper/servicehelper.hxx
new file mode 100644
index 000000000..c225494cc
--- /dev/null
+++ b/include/comphelper/servicehelper.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SERVICEHELPER_HXX
+#define INCLUDED_COMPHELPER_SERVICEHELPER_HXX
+
+#include <rtl/uuid.h>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace comphelper {
+
+ // Class incapsulating UIDs used as e.g. tunnel IDs for css::lang::XUnoTunnel,
+ // or implementation IDs for css::lang::XTypeProvider
+ class UnoIdInit
+ {
+ private:
+ css::uno::Sequence< sal_Int8 > m_aSeq;
+ public:
+ UnoIdInit() : m_aSeq(16)
+ {
+ rtl_createUuid(reinterpret_cast<sal_uInt8*>(m_aSeq.getArray()), nullptr, true);
+ }
+ const css::uno::Sequence< sal_Int8 >& getSeq() const { return m_aSeq; }
+ };
+
+ inline sal_Int64 getSomething_cast(void* p)
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(p));
+ }
+
+ template<class T> inline T* getSomething_cast(sal_Int64 n)
+ {
+ return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
+ }
+
+ template <class T> T* getFromUnoTunnel(const css::uno::Reference<css::lang::XUnoTunnel>& xUT)
+ {
+ if (!xUT.is())
+ return nullptr;
+
+ return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
+ }
+
+ // Takes an interface
+ template <class T> T* getFromUnoTunnel(const css::uno::Reference<css::uno::XInterface>& xIface)
+ {
+ return getFromUnoTunnel<T>(
+ css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
+ }
+
+ // Takes an Any
+ template <class T> T* getFromUnoTunnel(const css::uno::Any& rAny)
+ {
+ // For unclear reason, using a Reference ctor taking an Any
+ // gives different results compared to use of operator >>=.
+ css::uno::Reference<css::lang::XUnoTunnel> xUnoTunnel;
+ rAny >>= xUnoTunnel;
+ return getFromUnoTunnel<T>(xUnoTunnel);
+ }
+
+ template <typename T>
+ inline bool isUnoTunnelId(const css::uno::Sequence< sal_Int8 >& rId)
+ {
+ return rId.getLength() == 16
+ && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
+ }
+
+ template <class Base> struct FallbackToGetSomethingOf
+ {
+ static sal_Int64 get(const css::uno::Sequence<sal_Int8>& rId, Base* p)
+ {
+ return p->Base::getSomething(rId);
+ }
+ };
+
+ template <> struct FallbackToGetSomethingOf<void>
+ {
+ static sal_Int64 get(const css::uno::Sequence<sal_Int8>&, void*) { return 0; }
+ };
+
+ template <class T, class Base = void>
+ sal_Int64 getSomethingImpl(const css::uno::Sequence<sal_Int8>& rId, T* pThis,
+ FallbackToGetSomethingOf<Base> = {})
+ {
+ if (isUnoTunnelId<T>(rId))
+ return getSomething_cast(pThis);
+
+ return FallbackToGetSomethingOf<Base>::get(rId, pThis);
+ }
+
+}
+
+/** the UNO3_GETIMPLEMENTATION_* macros implement a static helper function
+ that gives access to your implementation for a given interface reference,
+ if possible.
+
+ Example:
+ MyClass* pClass = comphelper::getFromUnoTunnel<MyClass>( xRef );
+
+ Usage:
+ Put a UNO3_GETIMPLEMENTATION_DECL( classname ) inside your class
+ definition and UNO3_GETIMPLEMENTATION_IMPL( classname ) inside
+ your cxx file. Your class must inherit css::lang::XUnoTunnel
+ and export it with queryInterface. Implementation of XUnoTunnel is
+ done by this macro.
+*/
+#define UNO3_GETIMPLEMENTATION_DECL( classname ) \
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept; \
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+
+#define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
+const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
+{ \
+ static const comphelper::UnoIdInit aId; \
+ return aId.getSeq(); \
+}
+
+#define UNO3_GETIMPLEMENTATION_IMPL( classname )\
+UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
+sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
+{ \
+ return comphelper::getSomethingImpl(rId, this); \
+}
+
+#define UNO3_GETIMPLEMENTATION2_IMPL( classname, baseclass )\
+UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
+sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
+{ \
+ return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
+}
+
+
+#endif // INCLUDED_COMPHELPER_SERVICEHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/sharedmutex.hxx b/include/comphelper/sharedmutex.hxx
new file mode 100644
index 000000000..a92c7ccb3
--- /dev/null
+++ b/include/comphelper/sharedmutex.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SHAREDMUTEX_HXX
+#define INCLUDED_COMPHELPER_SHAREDMUTEX_HXX
+
+#include <comphelper/comphelperdllapi.h>
+#include <memory>
+
+namespace osl { class Mutex; }
+
+namespace comphelper
+{
+
+
+ //= SharedMutex
+
+ class COMPHELPER_DLLPUBLIC SharedMutex
+ {
+ public:
+ SharedMutex();
+
+ operator ::osl::Mutex& () { return *m_pMutexImpl; }
+
+ private:
+ std::shared_ptr< ::osl::Mutex > m_pMutexImpl;
+ };
+
+
+ //= SharedMutexBase
+
+ /** sometimes, it's necessary to have an initialized ::osl::Mutex to pass
+ to some ctor call of your base class. In this case, you can't hold the
+ SharedMutex as member, but you need to move it into another base class,
+ which is initialized before the mutex-requiring class is.
+ */
+ class COMPHELPER_DLLPUBLIC SharedMutexBase
+ {
+ protected:
+ SharedMutexBase()
+ {
+ }
+ ~SharedMutexBase()
+ {
+ }
+
+ protected:
+ ::osl::Mutex& getMutex() const { return m_aMutex; }
+ SharedMutex& getSharedMutex() const { return m_aMutex; }
+
+ private:
+ mutable SharedMutex m_aMutex;
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_SHAREDMUTEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/simplefileaccessinteraction.hxx b/include/comphelper/simplefileaccessinteraction.hxx
new file mode 100644
index 000000000..e9295d4d7
--- /dev/null
+++ b/include/comphelper/simplefileaccessinteraction.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_SIMPLEFILEACCESSINTERACTION_HXX
+#define INCLUDED_COMPHELPER_SIMPLEFILEACCESSINTERACTION_HXX
+
+#include <sal/config.h>
+#include <ucbhelper/interceptedinteraction.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::task { class XInteractionHandler; }
+namespace com::sun::star::task { class XInteractionRequest; }
+
+namespace comphelper {
+/** An interaction handler wrapper for simple file access.
+
+ This wrapper is to be used together with XSimpleFileAccess when
+ you want to avoid the error messages displayed when accessing a file (the messages activated
+ by ucphelper::cancelCommandExecution).
+
+ This wrapper is especially useful when you need to access a Web/DAV connection
+ enabling https certificate validation and optionally enabling the authentication
+ dialog that may be needed in these operations.
+
+ @param xHandler
+ Used handler, always needed.
+ It will be used for Certificate Validation dialog or authentication dialog.
+ The authentication is used in Web/DAV access when the server requests credentials to be accessed.
+*/
+class COMPHELPER_DLLPUBLIC SimpleFileAccessInteraction final : public ::ucbhelper::InterceptedInteraction
+{
+
+public:
+ SimpleFileAccessInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler);
+ virtual ~SimpleFileAccessInteraction() override;
+
+private:
+
+ virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
+ const css::uno::Reference< css::task::XInteractionRequest >& xRequest) override;
+
+};
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/solarmutex.hxx b/include/comphelper/solarmutex.hxx
new file mode 100644
index 000000000..4094e08ee
--- /dev/null
+++ b/include/comphelper/solarmutex.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SOLARMUTEX_HXX
+#define INCLUDED_COMPHELPER_SOLARMUTEX_HXX
+
+#include <sal/config.h>
+
+#include <assert.h>
+#include <atomic>
+
+#include <osl/thread.h>
+#include <osl/mutex.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace comphelper {
+
+
+/**
+ * SolarMutex, needed for VCL's Application::GetSolarMutex().
+ *
+ * The SolarMutex is the one big recursive code lock used
+ * to protect the vast majority of the LibreOffice code-base,
+ * in particular anything that is graphical and the cores of
+ * the applications.
+ *
+ * Treat this as a singleton, as its constructor sets a global
+ * pointing at itself.
+ */
+class COMPHELPER_DLLPUBLIC SolarMutex {
+public:
+ typedef void (*BeforeReleaseHandler) ();
+
+ SolarMutex();
+ virtual ~SolarMutex();
+
+ void SetBeforeReleaseHandler( const BeforeReleaseHandler& rLink )
+ { m_aBeforeReleaseHandler = rLink; }
+
+ void acquire( sal_uInt32 nLockCount = 1 );
+ sal_uInt32 release( bool bUnlockAll = false );
+
+ virtual bool tryToAcquire();
+
+ // returns true, if the mutex is owned by the current thread
+ virtual bool IsCurrentThread() const;
+
+ /// Help components to get the SolarMutex easily.
+ static SolarMutex *get();
+
+protected:
+ virtual sal_uInt32 doRelease( bool bUnlockAll );
+ virtual void doAcquire( sal_uInt32 nLockCount );
+
+ osl::Mutex m_aMutex;
+ sal_uInt32 m_nCount;
+
+private:
+ std::atomic<oslThreadIdentifier> m_nThreadId;
+
+ SolarMutex(const SolarMutex&) = delete;
+ SolarMutex& operator=(const SolarMutex&) = delete;
+
+ BeforeReleaseHandler m_aBeforeReleaseHandler;
+};
+
+inline void SolarMutex::acquire( sal_uInt32 nLockCount )
+{
+ assert( nLockCount > 0 );
+ doAcquire( nLockCount );
+}
+
+inline sal_uInt32 SolarMutex::release( bool bUnlockAll )
+{
+ return doRelease( bUnlockAll );
+}
+
+}
+
+#endif // INCLUDED_COMPHELPER_SOLARMUTEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/stillreadwriteinteraction.hxx b/include/comphelper/stillreadwriteinteraction.hxx
new file mode 100644
index 000000000..fb03a7ad1
--- /dev/null
+++ b/include/comphelper/stillreadwriteinteraction.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_STILLREADWRITEINTERACTION_HXX
+#define INCLUDED_COMPHELPER_STILLREADWRITEINTERACTION_HXX
+
+#include <config_options.h>
+#include <ucbhelper/interceptedinteraction.hxx>
+
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::task { class XInteractionHandler; }
+namespace com::sun::star::task { class XInteractionRequest; }
+
+
+namespace comphelper{
+class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) StillReadWriteInteraction final : public ::ucbhelper::InterceptedInteraction
+{
+private:
+ static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0;
+ static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1;
+ static const sal_Int32 HANDLE_AUTHENTICATIONREQUESTEXCEPTION = 2;
+ static const sal_Int32 HANDLE_CERTIFICATEVALIDATIONREQUESTEXCEPTION = 3;
+
+ bool m_bUsed;
+ bool m_bHandledByMySelf;
+
+public:
+ StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler,
+ css::uno::Reference< css::task::XInteractionHandler > xAuxiliaryHandler);
+
+ void resetInterceptions();
+ void resetErrorStates();
+ bool wasWriteError() const { return (m_bUsed && m_bHandledByMySelf);}
+
+private:
+ css::uno::Reference< css::task::XInteractionHandler > m_xAuxiliaryHandler;
+
+ virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
+ const css::uno::Reference< css::task::XInteractionRequest >& xRequest) override;
+
+};
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/stl_types.hxx b/include/comphelper/stl_types.hxx
new file mode 100644
index 000000000..6b21dd77d
--- /dev/null
+++ b/include/comphelper/stl_types.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_STL_TYPES_HXX
+#define INCLUDED_COMPHELPER_STL_TYPES_HXX
+
+#include <sal/config.h>
+
+#include <algorithm>
+#include <memory>
+#include <string_view>
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <o3tl/string_view.hxx>
+
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+namespace comphelper
+{
+
+// comparison functors
+
+struct UStringMixLess
+{
+ bool m_bCaseSensitive;
+public:
+ UStringMixLess(bool bCaseSensitive = true):m_bCaseSensitive(bCaseSensitive){}
+ bool operator() (std::u16string_view x, std::u16string_view y) const
+ {
+ if (m_bCaseSensitive)
+ return x < y;
+ else
+ return o3tl::compareToIgnoreAsciiCase(x, y) < 0;
+ }
+
+ bool isCaseSensitive() const {return m_bCaseSensitive;}
+};
+
+class UStringMixEqual
+{
+ bool const m_bCaseSensitive;
+
+public:
+ UStringMixEqual(bool bCaseSensitive = true):m_bCaseSensitive(bCaseSensitive){}
+ bool operator() (std::u16string_view lhs, std::u16string_view rhs) const
+ {
+ return m_bCaseSensitive ? lhs == rhs : o3tl::equalsIgnoreAsciiCase( lhs, rhs );
+ }
+ bool isCaseSensitive() const {return m_bCaseSensitive;}
+};
+
+/// by-value less functor for std::set<std::unique_ptr<T>>
+template<class T> struct UniquePtrValueLess
+{
+ bool operator()(std::unique_ptr<T> const& lhs,
+ std::unique_ptr<T> const& rhs) const
+ {
+ assert(lhs.get());
+ assert(rhs.get());
+ return (*lhs) < (*rhs);
+ }
+ // The following are so we can search in std::set without allocating a temporary entry on the heap
+ typedef bool is_transparent;
+ bool operator()(T const& lhs,
+ std::unique_ptr<T> const& rhs) const
+ {
+ assert(rhs.get());
+ return lhs < (*rhs);
+ }
+ bool operator()(std::unique_ptr<T> const& lhs,
+ T const& rhs) const
+ {
+ assert(lhs.get());
+ return (*lhs) < rhs;
+ }
+};
+
+/// by-value implementation of std::foo<std::unique_ptr<T>>::operator==
+template<template<typename, typename...> class C, typename T, typename... Etc>
+bool ContainerUniquePtrEquals(
+ C<std::unique_ptr<T>, Etc...> const& lhs,
+ C<std::unique_ptr<T>, Etc...> const& rhs)
+{
+ return lhs.size() == rhs.size()
+ && std::equal(lhs.begin(), lhs.end(), rhs.begin(),
+ [](const auto& p1, const auto& p2) { return *p1 == *p2; });
+};
+
+
+template <class Tp, class Arg>
+class mem_fun1_t
+{
+ typedef void (Tp::*_fun_type)(Arg);
+public:
+ explicit mem_fun1_t(_fun_type pf) : M_f(pf) {}
+ void operator()(Tp* p, Arg x) const { (p->*M_f)(x); }
+private:
+ _fun_type const M_f;
+};
+
+template <class Tp, class Arg>
+inline mem_fun1_t<Tp,Arg> mem_fun(void (Tp::*f)(Arg))
+{
+ return mem_fun1_t<Tp,Arg>(f);
+}
+
+/** output iterator that appends OUStrings into an OUStringBuffer.
+ */
+class OUStringBufferAppender
+{
+public:
+ typedef OUStringBufferAppender Self;
+ typedef ::std::output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void reference;
+ typedef void pointer;
+ typedef size_t difference_type;
+
+ OUStringBufferAppender(OUStringBuffer & i_rBuffer)
+ : m_rBuffer(&i_rBuffer) { }
+ Self & operator=(std::u16string_view i_rStr)
+ {
+ m_rBuffer->append( i_rStr );
+ return *this;
+ }
+ Self & operator*() { return *this; } // so operator= works
+ Self & operator++() { return *this; }
+
+private:
+ OUStringBuffer * m_rBuffer;
+};
+
+/** algorithm similar to std::copy, but inserts a separator between elements.
+ */
+template< typename ForwardIter, typename OutputIter, typename T >
+OutputIter intersperse(
+ ForwardIter start, ForwardIter end, OutputIter out, T const & separator)
+{
+ if (start != end) {
+ *out = *start;
+ ++start;
+ ++out;
+ }
+
+ while (start != end) {
+ *out = separator;
+ ++out;
+ *out = *start;
+ ++start;
+ ++out;
+ }
+
+ return out;
+}
+
+}
+
+#endif // INCLUDED_COMPHELPER_STL_TYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/storagehelper.hxx b/include/comphelper/storagehelper.hxx
new file mode 100644
index 000000000..c6c47c1a5
--- /dev/null
+++ b/include/comphelper/storagehelper.hxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_STORAGEHELPER_HXX
+#define INCLUDED_COMPHELPER_STORAGEHELPER_HXX
+
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <comphelper/comphelperdllapi.h>
+#include <memory>
+#include <string_view>
+
+inline constexpr OUStringLiteral PACKAGE_STORAGE_FORMAT_STRING = u"PackageFormat";
+inline constexpr OUStringLiteral ZIP_STORAGE_FORMAT_STRING = u"ZipFormat";
+inline constexpr OUStringLiteral OFOPXML_STORAGE_FORMAT_STRING = u"OFOPXMLFormat";
+
+inline constexpr OUStringLiteral PACKAGE_ENCRYPTIONDATA_SHA256UTF8 = u"PackageSHA256UTF8EncryptionKey";
+inline constexpr OUStringLiteral PACKAGE_ENCRYPTIONDATA_SHA1UTF8 = u"PackageSHA1UTF8EncryptionKey";
+inline constexpr OUStringLiteral PACKAGE_ENCRYPTIONDATA_SHA1MS1252 = u"PackageSHA1MS1252EncryptionKey";
+inline constexpr OUStringLiteral PACKAGE_ENCRYPTIONDATA_SHA1CORRECT = u"PackageSHA1CorrectEncryptionKey";
+
+namespace com::sun::star {
+ namespace beans { struct NamedValue; }
+ namespace embed { class XStorage; }
+ namespace io {
+ class XInputStream;
+ class XOutputStream;
+ class XStream;
+ }
+ namespace lang { class XSingleServiceFactory; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace comphelper {
+
+// Unfortunately - the impl.s of XStorage like to invalidate all
+// their sub streams and storages when you release references, so
+// it is necessary to keep references to all storages down the
+// path - this is 'beautiful' (TM). So we need this ugly hack:
+class COMPHELPER_DLLPUBLIC LifecycleProxy
+{
+private:
+ class Impl;
+public:
+ std::unique_ptr<Impl> m_xBadness;
+ LifecycleProxy();
+ ~LifecycleProxy();
+ // commit the storages: necessary for writes to streams to take effect!
+ void commitStorages();
+};
+
+class COMPHELPER_DLLPUBLIC OStorageHelper
+{
+public:
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::lang::XSingleServiceFactory >
+ GetStorageFactory(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ = css::uno::Reference< css::uno::XComponentContext >() );
+
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::lang::XSingleServiceFactory >
+ GetFileSystemStorageFactory(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ = css::uno::Reference< css::uno::XComponentContext >() );
+
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::embed::XStorage >
+ GetTemporaryStorage(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ = css::uno::Reference< css::uno::XComponentContext >() );
+
+ /// this one will only return Storage
+ ///
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::embed::XStorage >
+ GetStorageFromURL(
+ const OUString& aURL,
+ sal_Int32 nStorageMode,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ = css::uno::Reference< css::uno::XComponentContext >() );
+
+ /// this one will return either Storage or FileSystemStorage
+ ///
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::embed::XStorage >
+ GetStorageFromURL2(
+ const OUString& aURL,
+ sal_Int32 nStorageMode,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ = css::uno::Reference< css::uno::XComponentContext >() );
+
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::embed::XStorage >
+ GetStorageFromInputStream(
+ const css::uno::Reference < css::io::XInputStream >& xStream,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ = css::uno::Reference< css::uno::XComponentContext >() );
+
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::embed::XStorage >
+ GetStorageFromStream(
+ const css::uno::Reference < css::io::XStream >& xStream,
+ sal_Int32 nStorageMode = css::embed::ElementModes::READWRITE,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ = css::uno::Reference< css::uno::XComponentContext >() );
+
+ /// @throws css::uno::Exception
+ static void CopyInputToOutput(
+ const css::uno::Reference< css::io::XInputStream >& xInput,
+ const css::uno::Reference< css::io::XOutputStream >& xOutput );
+
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::io::XInputStream >
+ GetInputStreamFromURL(
+ const OUString& aURL,
+ const css::uno::Reference< css::uno::XComponentContext >& context );
+
+ /// @throws css::uno::Exception
+ static void SetCommonStorageEncryptionData(
+ const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const css::uno::Sequence< css::beans::NamedValue >& aEncryptionData );
+
+ // the following method supports only storages of OOo formats
+ /// @throws css::uno::Exception
+ static sal_Int32 GetXStorageFormat(
+ const css::uno::Reference< css::embed::XStorage >& xStorage );
+
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::embed::XStorage >
+ GetStorageOfFormatFromURL(
+ const OUString& aFormat,
+ const OUString& aURL,
+ sal_Int32 nStorageMode,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ = css::uno::Reference< css::uno::XComponentContext >() );
+
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::embed::XStorage >
+ GetStorageOfFormatFromInputStream(
+ const OUString& aFormat,
+ const css::uno::Reference < css::io::XInputStream >& xStream,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ = css::uno::Reference< css::uno::XComponentContext >(),
+ bool bRepairStorage = false );
+
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::embed::XStorage >
+ GetStorageOfFormatFromStream(
+ const OUString& aFormat,
+ const css::uno::Reference < css::io::XStream >& xStream,
+ sal_Int32 nStorageMode = css::embed::ElementModes::READWRITE,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ = css::uno::Reference< css::uno::XComponentContext >(),
+ bool bRepairStorage = false );
+
+ static css::uno::Sequence< css::beans::NamedValue >
+ CreatePackageEncryptionData(
+ std::u16string_view aPassword );
+
+ static css::uno::Sequence< css::beans::NamedValue >
+ CreateGpgPackageEncryptionData();
+
+ static bool IsValidZipEntryFileName( std::u16string_view aName, bool bSlashAllowed );
+ static bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, bool bSlashAllowed );
+
+ static bool PathHasSegment( std::u16string_view aPath, std::u16string_view aSegment );
+
+ // Methods to allow easy use of hierarchical names inside storages
+
+ static css::uno::Reference< css::embed::XStorage > GetStorageAtPath(
+ const css::uno::Reference< css::embed::XStorage > &xStorage,
+ std::u16string_view aPath, sal_uInt32 nOpenMode, LifecycleProxy const &rNastiness );
+ static css::uno::Reference< css::io::XStream > GetStreamAtPath(
+ const css::uno::Reference< css::embed::XStorage > &xStorage,
+ std::u16string_view aPath, sal_uInt32 nOpenMode, LifecycleProxy const &rNastiness );
+ static css::uno::Reference< css::io::XStream > GetStreamAtPackageURL(
+ const css::uno::Reference< css::embed::XStorage > &xStorage,
+ const OUString& rURL, sal_uInt32 const nOpenMode,
+ LifecycleProxy const & rNastiness );
+
+ static OUString
+ GetODFVersionFromStorage(const css::uno::Reference<css::embed::XStorage>& xStorage);
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/streamsection.hxx b/include/comphelper/streamsection.hxx
new file mode 100644
index 000000000..fa1fe8ac9
--- /dev/null
+++ b/include/comphelper/streamsection.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_STREAMSECTION_HXX
+#define INCLUDED_COMPHELPER_STREAMSECTION_HXX
+
+#include <config_options.h>
+#include <com/sun/star/uno/Reference.h>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::io
+{
+class XDataInputStream;
+}
+namespace com::sun::star::io
+{
+class XDataOutputStream;
+}
+namespace com::sun::star::io
+{
+class XMarkableStream;
+}
+
+namespace comphelper
+{
+/** implements handling for compatibly reading/writing data from/into an input/output stream.
+ data written in a block secured by this class should be readable by older versions which
+ use the same mechanism.
+*/
+
+class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OStreamSection
+{
+ css::uno::Reference<css::io::XMarkableStream> m_xMarkStream;
+ css::uno::Reference<css::io::XDataInputStream> m_xInStream;
+ css::uno::Reference<css::io::XDataOutputStream> m_xOutStream;
+
+ sal_Int32 m_nBlockStart;
+ sal_Int32 m_nBlockLen;
+
+public:
+ /** starts reading of a "skippable" section of data within the given input stream<BR>
+ @param _rxInput the stream to read from. Must support the
+ css::io::XMarkableStream interface
+ */
+ OStreamSection(const css::uno::Reference<css::io::XDataInputStream>& _rxInput);
+
+ /** starts writing of a "skippable" section of data into the given output stream
+ @param _rxOutput the stream the stream to write to. Must support the
+ css::io::XMarkableStream interface
+ */
+ OStreamSection(const css::uno::Reference<css::io::XDataOutputStream>& _rxOutput);
+
+ /** dtor. <BR>If constructed for writing, the section "opened" by this object will be "closed".<BR>
+ If constructed for reading, any remaining bytes 'til the end of the section will be skipped.
+ */
+ ~OStreamSection();
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_STREAMSECTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx
new file mode 100644
index 000000000..a722e2cc4
--- /dev/null
+++ b/include/comphelper/string.hxx
@@ -0,0 +1,386 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <algorithm>
+#include <vector>
+#include <comphelper/comphelperdllapi.h>
+#include <sal/types.h>
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <com/sun/star/lang/Locale.hpp>
+
+namespace com::sun::star::i18n { class XBreakIterator; }
+namespace com::sun::star::i18n { class XCollator; }
+namespace com::sun::star::uno { class XComponentContext; }
+
+// OUString helper functions that are not widespread or mature enough to
+// go into the stable URE API:
+namespace comphelper::string {
+
+/** Removes all occurrences of a character from within the source string
+
+ @param rIn The input OUStringBuffer
+ @param c The character to be removed
+
+ @return The resulting OUStringBuffer
+ */
+inline OUStringBuffer& remove(OUStringBuffer &rIn,
+ sal_Unicode c)
+{
+ sal_Int32 index = 0;
+ while (true)
+ {
+ if (index >= rIn.getLength())
+ break;
+ index = rIn.indexOf(c, index);
+ if (index == -1)
+ break;
+ rIn.remove(index, 1);
+ }
+ return rIn;
+}
+
+/** Strips occurrences of a character from the start of the source string
+
+ @param rIn The input OString
+ @param c The character to be stripped from the start
+
+ @return The resulting OString
+ */
+COMPHELPER_DLLPUBLIC OString stripStart(const OString& rIn,
+ char c);
+COMPHELPER_DLLPUBLIC std::string_view stripStart(std::string_view rIn,
+ char c);
+
+/** Strips occurrences of a character from the start of the source string
+
+ @param rIn The input OUString
+ @param c The character to be stripped from the start
+
+ @return The resulting OUString
+ */
+COMPHELPER_DLLPUBLIC OUString stripStart(const OUString& rIn,
+ sal_Unicode c);
+COMPHELPER_DLLPUBLIC std::u16string_view stripStart(std::u16string_view rIn,
+ sal_Unicode c);
+
+/** Strips occurrences of a character from the end of the source string
+
+ @param rIn The input OString
+ @param c The character to be stripped from the end
+
+ @return The resulting OString
+ */
+COMPHELPER_DLLPUBLIC OString stripEnd(const OString& rIn,
+ char c);
+COMPHELPER_DLLPUBLIC std::string_view stripEnd(std::string_view rIn,
+ char c);
+
+/** Strips occurrences of a character from the end of the source string
+
+ @param rIn The input OUString
+ @param c The character to be stripped from the end
+
+ @return The resulting OUString
+ */
+COMPHELPER_DLLPUBLIC OUString stripEnd(const OUString& rIn,
+ sal_Unicode c);
+COMPHELPER_DLLPUBLIC std::u16string_view stripEnd(std::u16string_view rIn,
+ sal_Unicode c);
+
+/** Strips occurrences of a character from the start and end of the source string
+
+ @param rIn The input OString
+ @param c The character to be stripped from the start and end
+
+ @return The resulting OString
+ */
+COMPHELPER_DLLPUBLIC OString strip(const OString& rIn,
+ char c);
+COMPHELPER_DLLPUBLIC std::string_view strip(std::string_view rIn,
+ char c);
+
+/** Strips occurrences of a character from the start and end of the source string
+
+ @param rIn The input OUString
+ @param c The character to be stripped from the start and end
+
+ @return The resulting OUString
+ */
+COMPHELPER_DLLPUBLIC OUString strip(const OUString& rIn,
+ sal_Unicode c);
+COMPHELPER_DLLPUBLIC std::u16string_view strip(std::u16string_view rIn,
+ sal_Unicode c);
+
+/** Returns number of tokens in an OUString
+
+ @param rIn the input OString
+ @param cTok the character which separate the tokens.
+ @return the number of tokens
+*/
+COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(std::string_view rIn, char cTok);
+
+/** Returns number of tokens in an OUString
+
+ @param rIn the input OUString
+ @param cTok the character which separate the tokens.
+ @return the number of tokens
+*/
+COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(std::u16string_view rIn, sal_Unicode cTok);
+
+/** Reverse an OUString's UTF-16 code units.
+
+ @param rIn the input OUString
+ @return the reversed input
+*/
+COMPHELPER_DLLPUBLIC OUString reverseString(std::u16string_view rStr);
+
+/** Reverse an OString
+
+ @param rIn the input OString
+ @return the reversed input
+*/
+COMPHELPER_DLLPUBLIC OString reverseString(std::string_view rStr);
+
+/** Reverse an OUString's Unicode code points.
+*/
+COMPHELPER_DLLPUBLIC OUString reverseCodePoints(OUString const & str);
+
+namespace detail
+{
+ template<typename B> B& truncateToLength(B& rBuffer, sal_Int32 nLen)
+ {
+ if (nLen < rBuffer.getLength())
+ rBuffer.setLength(nLen);
+ return rBuffer;
+ }
+}
+
+/** Truncate a buffer to a given length.
+
+ If the StringBuffer has more characters than nLength it will be truncated
+ on the right to nLength characters.
+
+ Has no effect if the StringBuffer is <= nLength
+
+ @param rBuf StringBuffer to operate on
+ @param nLength Length to truncate the buffer to
+
+ @return rBuf;
+ */
+inline OUStringBuffer& truncateToLength(
+ OUStringBuffer& rBuffer, sal_Int32 nLength)
+{
+ return detail::truncateToLength(rBuffer, nLength);
+}
+
+namespace detail
+{
+ template<typename B, typename U> B& padToLength(B& rBuffer, sal_Int32 nLen, U cFill)
+ {
+ const sal_Int32 nPadLen = nLen - rBuffer.getLength();
+ if (nPadLen > 0)
+ std::fill_n(rBuffer.appendUninitialized(nPadLen), nPadLen, cFill);
+ return rBuffer;
+ }
+}
+
+/** Pad a buffer to a given length using a given char.
+
+ If the StringBuffer has less characters than nLength it will be expanded on
+ the right to nLength characters, with the expansion filled using cFill.
+
+ Has no effect if the StringBuffer is >= nLength
+
+ @param rBuf StringBuffer to operate on
+ @param nLength Length to pad the buffer to
+ @param cFill character to fill expansion with
+
+ @return rBuf;
+ */
+inline OStringBuffer& padToLength(
+ OStringBuffer& rBuffer, sal_Int32 nLength,
+ char cFill = '\0')
+{
+ return detail::padToLength(rBuffer, nLength, cFill);
+}
+
+inline OUStringBuffer& padToLength(
+ OUStringBuffer& rBuffer, sal_Int32 nLength,
+ sal_Unicode cFill = '\0')
+{
+ return detail::padToLength(rBuffer, nLength, cFill);
+}
+
+/** Similar to OUString::replaceAt, but for an OUStringBuffer.
+
+ Replace n = count characters
+ from position index in this string with newStr.
+ */
+COMPHELPER_DLLPUBLIC void replaceAt(OUStringBuffer& rIn, sal_Int32 index, sal_Int32 count, std::u16string_view newStr );
+
+/** Replace a token in a string
+ @param rIn OUString in which the token is to be replaced
+ @param nToken which nToken to replace
+ @param cTok token delimiter
+ @param rNewToken replacement token
+
+ @return original string with token nToken replaced by rNewToken
+ */
+COMPHELPER_DLLPUBLIC OUString setToken(const OUString& rIn, sal_Int32 nToken, sal_Unicode cTok,
+ std::u16string_view rNewToken);
+
+/** Find any of a list of code units in the string.
+ @param rIn OUString to search
+ @param pChars 0-terminated array of sal_Unicode code units to search for
+ @param nPos start position
+
+ @return position of first occurrence of any of the elements of pChars
+ or -1 if none of the code units occur in the string
+ */
+COMPHELPER_DLLPUBLIC sal_Int32 indexOfAny(std::u16string_view rIn,
+ sal_Unicode const*const pChars, sal_Int32 const nPos);
+
+/** Remove any of a list of code units in the string.
+ @param rIn OUString to search
+ @param pChars 0-terminated array of sal_Unicode code units to search for
+
+ @return OUString that has all of the pChars code units removed
+ */
+COMPHELPER_DLLPUBLIC OUString removeAny(std::u16string_view rIn,
+ sal_Unicode const*const pChars);
+
+/** Convert a sequence of strings to a single comma separated string.
+
+ Note that no escaping of commas or anything fancy is done.
+
+ @param i_rSeq A list of strings to be concatenated.
+
+ @return A single string containing the concatenation of the given
+ list, interspersed with the string ", ".
+ */
+COMPHELPER_DLLPUBLIC OUString convertCommaSeparated(
+ css::uno::Sequence< OUString > const & i_rSeq);
+
+/// Return a string which is the concatenation of the strings in the sequence.
+COMPHELPER_DLLPUBLIC OString join(std::string_view rSeparator, const std::vector<OString>& rSequence);
+
+/** Convert a decimal string to a number.
+
+ The string must be base-10, no sign but can contain any
+ codepoint listed in the "Number, Decimal Digit" Unicode
+ category.
+
+ No verification is made about the validity of the string,
+ passing string not containing decimal digit code points
+ gives unspecified results
+
+ If your string is guaranteed to contain only ASCII digit
+ use OUString::toInt32 instead.
+
+ @param str The string to convert containing only decimal
+ digit codepoints.
+
+ @return The value of the string as an int32.
+ */
+COMPHELPER_DLLPUBLIC sal_uInt32 decimalStringToNumber(
+ OUString const & str );
+
+COMPHELPER_DLLPUBLIC std::vector<OUString>
+ split(std::u16string_view rString, const sal_Unicode cSeparator);
+
+/** Convert a single comma separated string to a sequence of strings.
+
+ Note that no escaping of commas or anything fancy is done.
+
+ @param i_rString A string containing comma-separated words.
+
+ @return A sequence of strings resulting from splitting the given
+ string at ',' tokens and stripping whitespace.
+ */
+COMPHELPER_DLLPUBLIC css::uno::Sequence< OUString >
+ convertCommaSeparated( std::u16string_view i_rString );
+
+/**
+ Compares two strings using natural order.
+
+ For non digit characters, the comparison use the same algorithm as
+ rtl_str_compare. When a number is encountered during the comparison,
+ natural order is used. Thus, Heading 10 will be considered as greater
+ than Heading 2. Numerical comparison is done using decimal representation.
+
+ Beware that "MyString 001" and "MyString 1" will be considered as equal
+ since leading 0 are meaningless.
+
+ @param str the object to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+*/
+COMPHELPER_DLLPUBLIC sal_Int32 compareNatural( const OUString &rLHS, const OUString &rRHS,
+ const css::uno::Reference< css::i18n::XCollator > &rCollator,
+ const css::uno::Reference< css::i18n::XBreakIterator > &rBI,
+ const css::lang::Locale &rLocale );
+
+class COMPHELPER_DLLPUBLIC NaturalStringSorter
+{
+private:
+ css::lang::Locale const m_aLocale;
+ css::uno::Reference< css::i18n::XCollator > m_xCollator;
+ css::uno::Reference< css::i18n::XBreakIterator > m_xBI;
+public:
+ NaturalStringSorter(
+ const css::uno::Reference< css::uno::XComponentContext > &rContext,
+ css::lang::Locale aLocale);
+ sal_Int32 compare(const OUString &rLHS, const OUString &rRHS) const
+ {
+ return compareNatural(rLHS, rRHS, m_xCollator, m_xBI, m_aLocale);
+ }
+ const css::lang::Locale& getLocale() const { return m_aLocale; }
+};
+
+/** Determine if an OString contains solely ASCII numeric digits
+
+ @param rString An OString
+
+ @return false if string contains any characters outside
+ the ASCII '0'-'9' range
+ true otherwise, including for empty string
+ */
+COMPHELPER_DLLPUBLIC bool isdigitAsciiString(std::string_view rString);
+
+/** Determine if an OUString contains solely ASCII numeric digits
+
+ @param rString An OUString
+
+ @return false if string contains any characters outside
+ the ASCII '0'-'9' range
+ true otherwise, including for empty string
+ */
+COMPHELPER_DLLPUBLIC bool isdigitAsciiString(std::u16string_view rString);
+
+} // namespace comphelper::string
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/synchronousdispatch.hxx b/include/comphelper/synchronousdispatch.hxx
new file mode 100644
index 000000000..8503b2a43
--- /dev/null
+++ b/include/comphelper/synchronousdispatch.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SYNCHRONOUSDISPATCH_HXX
+#define INCLUDED_COMPHELPER_SYNCHRONOUSDISPATCH_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/uno/Reference.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star {
+ namespace uno {
+ class XInterface; }
+ namespace lang {
+ class XComponent; }
+}
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+
+namespace comphelper
+{
+
+
+ //= SynchronousDispatch
+
+ /** a helper class for working with the dispatch interface replacing
+ loadComponentFromURL
+ */
+ class SynchronousDispatch
+ {
+ public:
+ static COMPHELPER_DLLPUBLIC css::uno::Reference< css::lang::XComponent > dispatch(
+ const css::uno::Reference< css::uno::XInterface > &xStartPoint,
+ const OUString &sURL,
+ const OUString &sTarget,
+ const css::uno::Sequence< css::beans::PropertyValue > &lArguments );
+ };
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_SYNCHRONOUSDISPATCH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/syntaxhighlight.hxx b/include/comphelper/syntaxhighlight.hxx
new file mode 100644
index 000000000..c8bc100d3
--- /dev/null
+++ b/include/comphelper/syntaxhighlight.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_SYNTAXHIGHLIGHT_HXX
+#define INCLUDED_COMPHELPER_SYNTAXHIGHLIGHT_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <vector>
+#include <memory>
+
+enum class TokenType
+{
+ Unknown,
+ Identifier,
+ Whitespace,
+ Number,
+ String,
+ EOL,
+ Comment,
+ Error,
+ Operator,
+ Keywords,
+ Parameter,
+ LAST = Parameter
+};
+
+struct HighlightPortion {
+ sal_Int32 nBegin;
+ sal_Int32 nEnd;
+ TokenType tokenType;
+
+ HighlightPortion(
+ sal_Int32 theBegin, sal_Int32 theEnd, TokenType theTokenType):
+ nBegin(theBegin), nEnd(theEnd), tokenType(theTokenType)
+ {}
+};
+
+// Language mode of the Highlighter (possibly to be refined later with keyword
+// lists, C comment flags)
+enum class HighlighterLanguage
+{
+ Basic,
+ SQL
+};
+
+class COMPHELPER_DLLPUBLIC SyntaxHighlighter
+{
+ class Tokenizer;
+
+ std::unique_ptr<Tokenizer> m_tokenizer;
+
+ SyntaxHighlighter(const SyntaxHighlighter&) = delete;
+ SyntaxHighlighter& operator=(const SyntaxHighlighter&) = delete;
+public:
+ SyntaxHighlighter(HighlighterLanguage language);
+ ~SyntaxHighlighter();
+
+ void getHighlightPortions( std::u16string_view rLine,
+ std::vector<HighlightPortion>& pPortions ) const;
+
+ HighlighterLanguage GetLanguage() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/threadpool.hxx b/include/comphelper/threadpool.hxx
new file mode 100644
index 000000000..84f9dc928
--- /dev/null
+++ b/include/comphelper/threadpool.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_THREADPOOL_HXX
+#define INCLUDED_COMPHELPER_THREADPOOL_HXX
+
+#include <sal/config.h>
+#include <rtl/ref.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <mutex>
+#include <condition_variable>
+#include <cstddef>
+#include <vector>
+#include <memory>
+
+namespace comphelper
+{
+class ThreadTaskTag;
+
+class COMPHELPER_DLLPUBLIC ThreadTask
+{
+friend class ThreadPool;
+friend struct std::default_delete<ThreadTask>;
+ std::shared_ptr<ThreadTaskTag> mpTag;
+
+ /// execute this task
+ void exec();
+protected:
+ /// override to get your task performed by the pool
+ virtual void doWork() = 0;
+ /// once pushed ThreadTasks are destroyed by the pool
+ virtual ~ThreadTask() {}
+public:
+ ThreadTask(std::shared_ptr<ThreadTaskTag> pTag);
+};
+
+/// A very basic thread-safe thread pool implementation
+class COMPHELPER_DLLPUBLIC ThreadPool final
+{
+public:
+ /// returns a pointer to a shared pool with optimal thread
+ /// count for the CPU
+ static ThreadPool& getSharedOptimalPool();
+
+ static std::shared_ptr<ThreadTaskTag> createThreadTaskTag();
+
+ static bool isTaskTagDone(const std::shared_ptr<ThreadTaskTag>&);
+
+ /// returns a configurable max-concurrency
+ /// limit to avoid spawning an unnecessarily
+ /// large number of threads on high-core boxes.
+ /// MAX_CONCURRENCY env. var. controls the cap.
+ static std::size_t getPreferredConcurrency();
+
+ ThreadPool( std::size_t nWorkers );
+ ~ThreadPool();
+
+ /// push a new task onto the work queue
+ void pushTask( std::unique_ptr<ThreadTask> pTask);
+
+ /** Wait until all queued tasks associated with the tag are completed
+ @param bJoin - if set call joinThreadsIfIdle() at the end
+ */
+ void waitUntilDone(const std::shared_ptr<ThreadTaskTag>&, bool bJoin = true);
+
+ /// join all threads if there are no tasks presently.
+ void joinThreadsIfIdle();
+
+ /// return true if there are no queued or worked-on tasks
+ bool isIdle() const { return maTasks.empty() && mnBusyWorkers == 0; };
+
+ /// return the number of live worker threads
+ sal_Int32 getWorkerCount() const { return mnMaxWorkers; }
+
+ /// wait until all work is completed, then join all threads
+ void shutdown();
+
+private:
+ ThreadPool(const ThreadPool&) = delete;
+ ThreadPool& operator=(const ThreadPool&) = delete;
+
+ class ThreadWorker;
+ friend class ThreadWorker;
+
+ /** Pop a work task
+ @param bWait - if set wait until task present or termination
+ @return a new task to perform, or NULL if list empty or terminated
+ */
+ std::unique_ptr<ThreadTask> popWorkLocked( std::unique_lock< std::mutex > & rGuard, bool bWait );
+ void shutdownLocked(std::unique_lock<std::mutex>&);
+ void incBusyWorker();
+ void decBusyWorker();
+
+ /// signalled when all in-progress tasks are complete
+ std::mutex maMutex;
+ std::condition_variable maTasksChanged;
+ bool mbTerminate;
+ std::size_t const mnMaxWorkers;
+ std::size_t mnBusyWorkers;
+ std::vector< std::unique_ptr<ThreadTask> > maTasks;
+ std::vector< rtl::Reference< ThreadWorker > > maWorkers;
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_THREADPOOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/traceevent.hxx b/include/comphelper/traceevent.hxx
new file mode 100644
index 000000000..a0fe9cae1
--- /dev/null
+++ b/include/comphelper/traceevent.hxx
@@ -0,0 +1,222 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_COMPHELPER_TRACEEVENT_HXX
+#define INCLUDED_COMPHELPER_TRACEEVENT_HXX
+
+#include <sal/config.h>
+
+#include <atomic>
+#include <map>
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include <osl/process.h>
+#include <osl/thread.h>
+#include <osl/time.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+
+// implementation of XToolkitExperimental profiling API
+
+namespace comphelper
+{
+class COMPHELPER_DLLPUBLIC TraceEvent
+{
+private:
+ static int getPid()
+ {
+ oslProcessInfo aProcessInfo;
+ aProcessInfo.Size = sizeof(oslProcessInfo);
+ if (osl_getProcessInfo(nullptr, osl_Process_IDENTIFIER, &aProcessInfo)
+ == osl_Process_E_None)
+ return aProcessInfo.Ident;
+ return -1;
+ }
+
+ static std::size_t s_nBufferSize;
+ static void (*s_pBufferFullCallback)();
+
+protected:
+ static std::atomic<bool> s_bRecording; // true during recording
+
+ static void addRecording(const OUString& sObject);
+
+ static long long getNow()
+ {
+ TimeValue systemTime;
+ osl_getSystemTime(&systemTime);
+ return static_cast<long long>(systemTime.Seconds) * 1000000 + systemTime.Nanosec / 1000;
+ }
+
+ static OUString createArgsString(const std::map<OUString, OUString>& args)
+ {
+ if (args.size() == 0)
+ return "";
+
+ OUStringBuffer sResult;
+ sResult.append(",\"args\":{");
+ bool first = true;
+ for (auto& i : args)
+ {
+ if (!first)
+ sResult.append(',');
+ sResult.append('"');
+ sResult.append(i.first);
+ sResult.append("\":\"");
+ sResult.append(i.second);
+ sResult.append('"');
+ first = false;
+ }
+ sResult.append('}');
+
+ return sResult.makeStringAndClear();
+ }
+
+ const int m_nPid;
+ const OUString m_sArgs;
+
+ TraceEvent(OUString sArgs)
+ : m_nPid(s_bRecording ? getPid() : 1)
+ , m_sArgs(std::move(sArgs))
+ {
+ }
+
+ TraceEvent(const std::map<OUString, OUString>& aArgs)
+ : TraceEvent(createArgsString(aArgs))
+ {
+ }
+
+public:
+ static void addInstantEvent(const char* sName, const std::map<OUString, OUString>& args
+ = std::map<OUString, OUString>());
+
+ static void startRecording();
+ static void stopRecording();
+ static void setBufferSizeAndCallback(std::size_t bufferSize, void (*bufferFullCallback)());
+
+ static std::vector<OUString> getEventVectorAndClear();
+
+ static css::uno::Sequence<OUString> getRecordingAndClear();
+};
+
+class COMPHELPER_DLLPUBLIC NamedEvent : public TraceEvent
+{
+protected:
+ const char* m_sName;
+
+ NamedEvent(const char* sName, const OUString& sArgs)
+ : TraceEvent(sArgs)
+ , m_sName(sName ? sName : "(null)")
+ {
+ }
+
+ NamedEvent(const char* sName, const std::map<OUString, OUString>& aArgs)
+ : TraceEvent(aArgs)
+ , m_sName(sName ? sName : "(null)")
+ {
+ }
+};
+
+// An AsyncEvent generates an 'S' (start) event when constructed and a 'F' (finish) event when it
+// is destructed.
+
+// The Trace Event specification claims that these event types are deprecated and replaces by
+// nestable 'b' (begin) and 'e' (end) events, but Chrome does not seem to support those.
+
+// To generate a pair of 'S' and 'F' events, create an AsyncEvent object using the AsyncEvent(const
+// char* sName) constructor when you want the 'S' event to be generated, and destroy it when you
+// want the corresponding 'F' event to be generated.
+
+class COMPHELPER_DLLPUBLIC AsyncEvent : public NamedEvent,
+ public std::enable_shared_from_this<AsyncEvent>
+{
+ static int s_nIdCounter;
+ int m_nId;
+ bool m_bBeginRecorded;
+
+ AsyncEvent(const char* sName, int nId, const std::map<OUString, OUString>& args)
+ : NamedEvent(sName, args)
+ , m_nId(nId)
+ , m_bBeginRecorded(false)
+ {
+ if (!s_bRecording)
+ return;
+
+ long long nNow = getNow();
+
+ // Generate a "Start" (type S) event
+ TraceEvent::addRecording("{"
+ "\"name\":\""
+ + OUString(m_sName, strlen(m_sName), RTL_TEXTENCODING_UTF8)
+ + "\","
+ "\"ph\":\"S\""
+ ","
+ "\"id\":"
+ + OUString::number(m_nId) + m_sArgs
+ + ","
+ "\"ts\":"
+ + OUString::number(nNow)
+ + ","
+ "\"pid\":"
+ + OUString::number(m_nPid)
+ + ","
+ "\"tid\":"
+ + OUString::number(osl_getThreadIdentifier(nullptr)) + "},");
+ m_bBeginRecorded = true;
+ }
+
+ void generateEnd()
+ {
+ if (!m_bBeginRecorded)
+ return;
+
+ m_bBeginRecorded = false;
+
+ long long nNow = getNow();
+ // Generate a "Finish" (type F) event
+ TraceEvent::addRecording("{"
+ "\"name\":\""
+ + OUString(m_sName, strlen(m_sName), RTL_TEXTENCODING_UTF8)
+ + "\","
+ "\"ph\":\"F\""
+ ","
+ "\"id\":"
+ + OUString::number(m_nId) + m_sArgs
+ + ","
+ "\"ts\":"
+ + OUString::number(nNow)
+ + ","
+ "\"pid\":"
+ + OUString::number(m_nPid)
+ + ","
+ "\"tid\":"
+ + OUString::number(osl_getThreadIdentifier(nullptr)) + "},");
+ }
+
+public:
+ AsyncEvent(const char* sName,
+ const std::map<OUString, OUString>& args = std::map<OUString, OUString>())
+ : AsyncEvent(sName, s_nIdCounter++, args)
+ {
+ }
+
+ ~AsyncEvent() { generateEnd(); }
+
+ void finish() { generateEnd(); }
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_TRACEEVENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/types.hxx b/include/comphelper/types.hxx
new file mode 100644
index 000000000..203bbbe02
--- /dev/null
+++ b/include/comphelper/types.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_TYPES_HXX
+#define INCLUDED_COMPHELPER_TYPES_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <comphelper/comphelperdllapi.h>
+
+namespace com::sun::star::awt {
+ struct FontDescriptor;
+}
+
+namespace com::sun::star::uno { class Any; }
+namespace com::sun::star::uno { class XInterface; }
+
+
+namespace comphelper
+{
+ /// returns sal_True if objects of the types given are "compatible"
+ COMPHELPER_DLLPUBLIC bool isAssignableFrom(const css::uno::Type& _rAssignable, const css::uno::Type& _rFrom);
+
+ /** ask the given object for an XComponent interface and dispose on it
+ */
+ template <class TYPE>
+ void disposeComponent(css::uno::Reference<TYPE>& _rxComp)
+ {
+ css::uno::Reference<css::lang::XComponent> xComp(_rxComp, css::uno::UNO_QUERY);
+ if (xComp.is())
+ {
+ xComp->dispose();
+ _rxComp = nullptr;
+ }
+ }
+
+
+ /** get a css::awt::FontDescriptor that is fully initialized with
+ the XXX_DONTKNOW enum values (which isn't the case if you instantiate it
+ via the default constructor)
+ */
+ COMPHELPER_DLLPUBLIC css::awt::FontDescriptor getDefaultFont();
+
+ /** examine a sequence for the com.sun.star.uno::Type of its elements.
+ */
+ COMPHELPER_DLLPUBLIC css::uno::Type getSequenceElementType(const css::uno::Type& _rSequenceType);
+
+
+//= replacement of the former UsrAny.getXXX methods
+
+ // may be used if you need the return value just as temporary, else it's may be too inefficient...
+
+ // no, we don't use templates here. This would lead to a lot of implicit uses of the conversion methods,
+ // which would be difficult to trace...
+
+ COMPHELPER_DLLPUBLIC sal_Int64 getINT64(const css::uno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC sal_Int32 getINT32(const css::uno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC sal_Int16 getINT16(const css::uno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC double getDouble(const css::uno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC float getFloat(const css::uno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC OUString getString(const css::uno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC bool getBOOL(const css::uno::Any& _rAny);
+
+ /// @throws css::lang::IllegalArgumentException
+ COMPHELPER_DLLPUBLIC sal_Int32 getEnumAsINT32(const css::uno::Any& _rAny);
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_TYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/unique_disposing_ptr.hxx b/include/comphelper/unique_disposing_ptr.hxx
new file mode 100644
index 000000000..5994799fc
--- /dev/null
+++ b/include/comphelper/unique_disposing_ptr.hxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_UNIQUE_DISPOSING_PTR_HXX
+#define INCLUDED_COMPHELPER_UNIQUE_DISPOSING_PTR_HXX
+
+#include <memory>
+#include <cppuhelper/implbase.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <o3tl/deleter.hxx>
+#include <utility>
+#include <vcl/svapp.hxx>
+
+namespace comphelper
+{
+//Similar to std::unique_ptr, except additionally releases the ptr on XComponent::disposing and/or XTerminateListener::notifyTermination if supported
+template<class T> class unique_disposing_ptr
+{
+private:
+ std::unique_ptr<T, o3tl::default_delete<T>> m_xItem;
+ css::uno::Reference< css::frame::XTerminateListener> m_xTerminateListener;
+
+ unique_disposing_ptr(const unique_disposing_ptr&) = delete;
+ unique_disposing_ptr& operator=(const unique_disposing_ptr&) = delete;
+public:
+ unique_disposing_ptr( const css::uno::Reference< css::lang::XComponent > &rComponent, T * p = nullptr, bool bComponent = false)
+ : m_xItem(p)
+ {
+ m_xTerminateListener = new TerminateListener(rComponent, *this, bComponent);
+ }
+
+ virtual void reset(T * p = nullptr)
+ {
+ m_xItem.reset(p);
+ }
+
+ T & operator*() const
+ {
+ return *m_xItem;
+ }
+
+ T * get() const
+ {
+ return m_xItem.get();
+ }
+
+ T * operator->() const
+ {
+ return m_xItem.get();
+ }
+
+ operator bool () const
+ {
+ return static_cast< bool >(m_xItem);
+ }
+
+ virtual ~unique_disposing_ptr() COVERITY_NOEXCEPT_FALSE
+ {
+ reset();
+ }
+private:
+ class TerminateListener final : public ::cppu::WeakImplHelper< css::frame::XTerminateListener,
+ css::lang::XServiceInfo>
+ {
+ private:
+ css::uno::Reference< css::lang::XComponent > m_xComponent;
+ unique_disposing_ptr<T>& m_rItem;
+ bool const mbComponentDLL;
+ public:
+ TerminateListener(css::uno::Reference< css::lang::XComponent > xComponent,
+ unique_disposing_ptr<T>& rItem, bool bComponentDLL) :
+ m_xComponent(std::move(xComponent)),
+ m_rItem(rItem),
+ mbComponentDLL(bComponentDLL)
+ {
+ if (m_xComponent.is())
+ {
+ css::uno::Reference< css::frame::XDesktop> xDesktop(m_xComponent, css::uno::UNO_QUERY);
+ if (xDesktop.is())
+ xDesktop->addTerminateListener(this);
+ else
+ m_xComponent->addEventListener(this);
+ }
+ }
+
+ virtual ~TerminateListener() override
+ {
+ if ( m_xComponent.is() )
+ {
+ css::uno::Reference< css::frame::XDesktop> xDesktop(m_xComponent, css::uno::UNO_QUERY);
+ if (xDesktop.is())
+ xDesktop->removeTerminateListener(this);
+ else
+ m_xComponent->removeEventListener(this);
+ }
+ }
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& rEvt ) override
+ {
+ bool shutDown = (rEvt.Source == m_xComponent);
+
+ if (shutDown && m_xComponent.is())
+ {
+ css::uno::Reference< css::frame::XDesktop> xDesktop(m_xComponent, css::uno::UNO_QUERY);
+ if (xDesktop.is())
+ xDesktop->removeTerminateListener(this);
+ else
+ m_xComponent->removeEventListener(this);
+ m_xComponent.clear();
+ }
+
+ if (shutDown)
+ m_rItem.reset();
+ }
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const css::lang::EventObject& ) override
+ {
+ }
+
+ virtual void SAL_CALL notifyTermination( const css::lang::EventObject& rEvt ) override
+ {
+ disposing(rEvt);
+ }
+
+ virtual OUString SAL_CALL getImplementationName() override
+ {
+ if (mbComponentDLL)
+ return "com.sun.star.comp.ComponentDLLListener";
+ else
+ return "com.sun.star.comp.DisposingTerminateListener";
+ }
+
+ virtual sal_Bool SAL_CALL supportsService(const OUString& /*rName*/) override
+ {
+ return false;
+ }
+
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
+ {
+ return css::uno::Sequence<OUString>();
+ }
+ };
+};
+
+//Something like an OutputDevice requires the SolarMutex to be taken before use
+//for threadsafety. The user can ensure this, except in the case of its dtor
+//being called from reset due to a terminate on the XComponent being called
+//from an arbitrary thread
+template<class T> class unique_disposing_solar_mutex_reset_ptr
+ : public unique_disposing_ptr<T>
+{
+public:
+ unique_disposing_solar_mutex_reset_ptr( const css::uno::Reference< css::lang::XComponent > &rComponent, T * p = nullptr, bool bComponent = false)
+ : unique_disposing_ptr<T>(rComponent, p, bComponent)
+ {
+ }
+
+ virtual void reset(T * p = nullptr) override
+ {
+ SolarMutexGuard aGuard;
+ unique_disposing_ptr<T>::reset(p);
+ }
+
+ virtual ~unique_disposing_solar_mutex_reset_ptr() override
+ {
+ if (unique_disposing_ptr<T>::get() && comphelper::SolarMutex::get())
+ reset();
+ }
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/uno3.hxx b/include/comphelper/uno3.hxx
new file mode 100644
index 000000000..517398fd7
--- /dev/null
+++ b/include/comphelper/uno3.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_UNO3_HXX
+#define INCLUDED_COMPHELPER_UNO3_HXX
+
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <comphelper/sequence.hxx>
+
+
+namespace comphelper
+{
+ /** used for declaring UNO3-Defaults, i.e. acquire/release
+ */
+ #define DECLARE_UNO3_DEFAULTS(classname, baseclass) \
+ virtual void SAL_CALL acquire() noexcept override { baseclass::acquire(); } \
+ virtual void SAL_CALL release() noexcept override { baseclass::release(); }
+
+ /** used for declaring UNO3-Defaults, i.e. acquire/release if you want to forward all queryInterfaces to the base class,
+ (e.g. if you override queryAggregation)
+ */
+ #define DECLARE_UNO3_AGG_DEFAULTS(classname, baseclass) \
+ virtual void SAL_CALL acquire() noexcept override { baseclass::acquire(); } \
+ virtual void SAL_CALL release() noexcept override { baseclass::release(); } \
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override \
+ { return baseclass::queryInterface(_rType); }
+
+ /** Use this macro to forward XComponent methods to base class
+
+ When using the ::cppu::WeakComponentImplHelper base classes to
+ implement a UNO interface, a problem occurs when the interface
+ itself already derives from XComponent (like e.g. awt::XWindow
+ or awt::XControl): ::cppu::WeakComponentImplHelper is then
+ still abstract. Using this macro in the most derived class
+ definition provides overrides for the XComponent methods,
+ forwarding them to the given baseclass.
+
+ @param classname
+ Name of the class this macro is issued within
+
+ @param baseclass
+ Name of the baseclass that should have the XInterface methods
+ forwarded to - that's usually the WeakComponentImplHelperN base
+
+ @param implhelper
+ Name of the baseclass that should have the XComponent methods
+ forwarded to - in the case of the WeakComponentImplHelper,
+ that would be ::cppu::WeakComponentImplHelperBase
+ */
+ #define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper) \
+ virtual void SAL_CALL acquire() noexcept override { baseclass::acquire(); } \
+ virtual void SAL_CALL release() noexcept override { baseclass::release(); } \
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override \
+ { return baseclass::queryInterface(_rType); } \
+ virtual void SAL_CALL dispose() override \
+ { \
+ implhelper::dispose(); \
+ } \
+ virtual void SAL_CALL addEventListener( \
+ css::uno::Reference< css::lang::XEventListener > const & xListener ) override \
+ { \
+ implhelper::addEventListener(xListener); \
+ } \
+ virtual void SAL_CALL removeEventListener( \
+ css::uno::Reference< css::lang::XEventListener > const & xListener ) override \
+ { \
+ implhelper::removeEventListener(xListener); \
+ }
+
+ //= deriving from multiple XInterface-derived classes
+
+ //= forwarding/merging XInterface functionality
+
+ #define DECLARE_XINTERFACE( ) \
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; \
+ virtual void SAL_CALL acquire() noexcept override; \
+ virtual void SAL_CALL release() noexcept override;
+
+ #define IMPLEMENT_FORWARD_REFCOUNT( classname, refcountbase ) \
+ void SAL_CALL classname::acquire() noexcept { refcountbase::acquire(); } \
+ void SAL_CALL classname::release() noexcept { refcountbase::release(); }
+
+ #define IMPLEMENT_FORWARD_XINTERFACE2( classname, refcountbase, baseclass2 ) \
+ IMPLEMENT_FORWARD_REFCOUNT( classname, refcountbase ) \
+ css::uno::Any SAL_CALL classname::queryInterface( const css::uno::Type& _rType ) \
+ { \
+ css::uno::Any aReturn = refcountbase::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ aReturn = baseclass2::queryInterface( _rType ); \
+ return aReturn; \
+ }
+
+ #define IMPLEMENT_FORWARD_XINTERFACE3( classname, refcountbase, baseclass2, baseclass3 ) \
+ IMPLEMENT_FORWARD_REFCOUNT( classname, refcountbase ) \
+ css::uno::Any SAL_CALL classname::queryInterface( const css::uno::Type& _rType ) \
+ { \
+ css::uno::Any aReturn = refcountbase::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ { \
+ aReturn = baseclass2::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ aReturn = baseclass3::queryInterface( _rType ); \
+ } \
+ return aReturn; \
+ }
+
+
+ //= forwarding/merging XTypeProvider functionality
+
+ #define DECLARE_XTYPEPROVIDER( ) \
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; \
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ #define IMPLEMENT_GET_IMPLEMENTATION_ID( classname ) \
+ css::uno::Sequence< sal_Int8 > SAL_CALL classname::getImplementationId( ) \
+ { \
+ return css::uno::Sequence<sal_Int8>(); \
+ }
+
+ #define IMPLEMENT_FORWARD_XTYPEPROVIDER2( classname, baseclass1, baseclass2 ) \
+ css::uno::Sequence< css::uno::Type > SAL_CALL classname::getTypes( ) \
+ { \
+ return ::comphelper::concatSequences( \
+ baseclass1::getTypes(), \
+ baseclass2::getTypes() \
+ ); \
+ } \
+ \
+ IMPLEMENT_GET_IMPLEMENTATION_ID( classname )
+
+ /** ask for an iface of an aggregated object
+ usage:<br/>
+ Reference<XFoo> xFoo;<br/>
+ if (query_aggregation(xAggregatedObject, xFoo))<br/>
+ ...
+ */
+ template <class iface>
+ bool query_aggregation(const css::uno::Reference< css::uno::XAggregation >& _rxAggregate, css::uno::Reference<iface>& _rxOut)
+ {
+ _rxOut.clear();
+ if (_rxAggregate.is())
+ {
+ _rxAggregate->queryAggregation(cppu::UnoType<iface>::get())
+ >>= _rxOut;
+ }
+ return _rxOut.is();
+ }
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_UNO3_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/unwrapargs.hxx b/include/comphelper/unwrapargs.hxx
new file mode 100644
index 000000000..76eb8b838
--- /dev/null
+++ b/include/comphelper/unwrapargs.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_UNWRAPARGS_HXX
+#define INCLUDED_COMPHELPER_UNWRAPARGS_HXX
+
+#include <sal/config.h>
+
+#include <optional>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <cppu/unotype.hxx>
+
+namespace comphelper {
+
+/// @internal
+namespace detail {
+ inline void unwrapArgsError(
+ const OUString& str, sal_Int32 nArg,
+ const css::uno::Reference< css::uno::XInterface >& xErrorContext =
+ css::uno::Reference< css::uno::XInterface >() )
+ {
+ throw css::lang::IllegalArgumentException(
+ str, xErrorContext, static_cast< sal_Int16 >( nArg ) );
+ }
+
+ template< typename T, typename... Args >
+ inline void unwrapArgsError( const OUString& str, sal_Int32 nArg, T&, Args&... args )
+ {
+ return unwrapArgsError( str, nArg, args... );
+ }
+
+ inline void unwrapArgs(
+ const css::uno::Sequence< css::uno::Any >&,
+ sal_Int32,
+ const css::uno::Reference< css::uno::XInterface >& )
+ {
+ return;
+ }
+
+ inline void unwrapArgs(
+ const css::uno::Sequence< css::uno::Any >&,
+ sal_Int32 )
+ {
+ return;
+ }
+
+ template< typename T, typename... Args >
+ inline void unwrapArgs(
+ const css::uno::Sequence< css::uno::Any >& seq,
+ sal_Int32 nArg, ::std::optional< T >& v, Args&... args );
+
+ template< typename T, typename... Args >
+ inline void unwrapArgs(
+ const css::uno::Sequence< css::uno::Any >& seq,
+ sal_Int32 nArg, T& v, Args&... args )
+ {
+ if( seq.getLength() <= nArg )
+ {
+ return unwrapArgsError( OUString( "No such argument available!"),
+ nArg, args... );
+ }
+ if( !fromAny( seq[nArg], &v ) )
+ {
+ OUString msg =
+ "Cannot extract ANY { " +
+ seq[nArg].getValueType().getTypeName() +
+ " } to " +
+ ::cppu::UnoType<T>::get().getTypeName() +
+ "!";
+ return unwrapArgsError( msg, nArg, args... );
+ }
+ return unwrapArgs( seq, ++nArg, args... );
+ }
+
+ template< typename T, typename... Args >
+ inline void unwrapArgs(
+ const css::uno::Sequence< css::uno::Any >& seq,
+ sal_Int32 nArg, ::std::optional< T >& v, Args&... args )
+ {
+ if( nArg < seq.getLength() )
+ {
+ T t;
+ unwrapArgs( seq, nArg, t, args... );
+ v = t;
+ } else {
+ unwrapArgs( seq, ++nArg, args... );
+ }
+ }
+}
+
+template< typename... Args >
+inline void unwrapArgs(
+ const css::uno::Sequence< css::uno::Any >& seq,
+ Args&... args )
+{
+ return detail::unwrapArgs( seq, 0, args... );
+}
+
+} // namespace comphelper
+
+#endif // ! defined( INCLUDED_COMPHELPER_UNWRAPARGS_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/weak.hxx b/include/comphelper/weak.hxx
new file mode 100644
index 000000000..28a23445d
--- /dev/null
+++ b/include/comphelper/weak.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_WEAK_HXX
+#define INCLUDED_COMPHELPER_WEAK_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <cppuhelper/weak.hxx>
+
+namespace comphelper
+{
+/** Base class to implement a UNO object supporting types and weak references, i.e. the object can be held
+ weakly (by a css::uno::WeakReference).
+ This implementation copes with reference counting. Upon last release(), the virtual dtor
+ is called.
+
+ In addition to the features from cppu::OWeakObject, derivations from this class can
+ also used as a base class for ::cppu::ImplInheritanceHelper?
+*/
+class COMPHELPER_DLLPUBLIC OWeakTypeObject : public ::cppu::OWeakObject, public css::lang::XTypeProvider
+{
+public:
+ OWeakTypeObject();
+ virtual ~OWeakTypeObject() override;
+
+ OWeakTypeObject(OWeakTypeObject const &) = default;
+ OWeakTypeObject(OWeakTypeObject &&) = default;
+ OWeakTypeObject & operator =(OWeakTypeObject const &) = default;
+ OWeakTypeObject & operator =(OWeakTypeObject &&) = default;
+
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { ::cppu::OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { ::cppu::OWeakObject::release(); }
+
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+};
+
+}
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/weakbag.hxx b/include/comphelper/weakbag.hxx
new file mode 100644
index 000000000..c52defab2
--- /dev/null
+++ b/include/comphelper/weakbag.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_WEAKBAG_HXX
+#define INCLUDED_COMPHELPER_WEAKBAG_HXX
+
+#include <sal/config.h>
+
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <cppuhelper/weakref.hxx>
+#include <osl/diagnose.h>
+
+namespace comphelper {
+
+/**
+ A bag of UNO weak references.
+*/
+template< typename T > class WeakBag {
+public:
+ /**
+ Add a new weak reference.
+
+ The implementation keeps the amount of memory consumed linear in the
+ number of living references added, not linear in the number of total
+ references added.
+
+ @param e
+ a non-null reference.
+ */
+ void add(css::uno::Reference< T > const & e) {
+ OSL_ASSERT(e.is());
+ for (auto i = m_list.begin(); i != m_list.end();) {
+ if (css::uno::Reference< T >(*i).is()) {
+ ++i;
+ } else {
+ i = m_list.erase(i);
+ }
+ }
+ m_list.push_back(css::uno::WeakReference< T >(e));
+ }
+
+ /**
+ Remove a living reference.
+
+ @return
+ a living reference, or null if there are none.
+ */
+ css::uno::Reference< T > remove() {
+ while (!m_list.empty()) {
+ css::uno::Reference< T > r(m_list.back());
+ m_list.pop_back();
+ if (r.is()) {
+ return r;
+ }
+ }
+ return css::uno::Reference< T >();
+ }
+
+private:
+ std::vector< css::uno::WeakReference< T > > m_list;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/weakeventlistener.hxx b/include/comphelper/weakeventlistener.hxx
new file mode 100644
index 000000000..d64f302d8
--- /dev/null
+++ b/include/comphelper/weakeventlistener.hxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_WEAKEVENTLISTENER_HXX
+#define INCLUDED_COMPHELPER_WEAKEVENTLISTENER_HXX
+
+#include <config_options.h>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <comphelper/comphelperdllapi.h>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <utility>
+
+namespace com::sun::star::uno { class XWeak; }
+
+namespace comphelper
+{
+
+
+ //= OWeakListenerAdapterBase
+
+ /** (the base for) an adapter which allows to add as listener to a foreign component, without
+ being held hard.
+
+ <p>The idea is that this adapter is added as listener to a foreign component, which usually
+ holds it's listener hard. The adapter itself knows the real listener as weak reference,
+ thus not affecting its life time.</p>
+ */
+ class OWeakListenerAdapterBase : public cppu::BaseMutex
+ {
+ private:
+ css::uno::WeakReference< css::uno::XInterface >
+ m_aListener;
+ css::uno::Reference< css::uno::XInterface >
+ m_xBroadcaster;
+
+ protected:
+ css::uno::Reference< css::uno::XInterface >
+ getListener( ) const
+ {
+ return m_aListener.get();
+ }
+
+ const css::uno::Reference< css::uno::XInterface >&
+ getBroadcaster( ) const
+ {
+ return m_xBroadcaster;
+ }
+
+ void resetListener( )
+ {
+ m_aListener.clear();
+ }
+
+
+ protected:
+ OWeakListenerAdapterBase(
+ const css::uno::Reference< css::uno::XWeak >& _rxListener,
+ css::uno::Reference< css::uno::XInterface > _xBroadcaster
+ )
+ :m_aListener ( _rxListener )
+ ,m_xBroadcaster (std::move( _xBroadcaster ))
+ {
+ }
+
+ protected:
+ virtual ~OWeakListenerAdapterBase();
+ };
+
+
+ //= OWeakListenerAdapter
+
+ template< class BROADCASTER, class LISTENER >
+ /** yet another base for weak listener adapters, this time with some type safety
+
+ <p>Note that derived classes need to overwrite all virtual methods of their interface
+ except XEventListener::disposing, and forward it to their master listener.</p>
+
+ <p>Additionally, derived classes need to add themself as listener to the broadcaster,
+ as this can't be done in a generic way</p>
+ */
+ class OWeakListenerAdapter
+ :public ::cppu::WeakComponentImplHelper< LISTENER >
+ ,public OWeakListenerAdapterBase
+ {
+ protected:
+ /** ctor
+ <p>Note that derived classes still need to add themself as listener to the broadcaster,
+ as this can't be done in a generic way</p>
+ */
+ OWeakListenerAdapter(
+ const css::uno::Reference< css::uno::XWeak >& _rxListener,
+ const css::uno::Reference< BROADCASTER >& _rxBroadcaster
+ );
+
+ protected:
+ css::uno::Reference< LISTENER > getListener( ) const
+ {
+ return css::uno::Reference< LISTENER >( OWeakListenerAdapterBase::getListener(), css::uno::UNO_QUERY );
+ }
+
+ // XEventListener overridables
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ protected:
+ // OComponentHelper overridables
+ // to be overridden, again - the derived class should revoke the listener from the broadcaster
+ virtual void SAL_CALL disposing( ) override = 0;
+ };
+
+
+ //= OWeakEventListenerAdapter
+
+ typedef OWeakListenerAdapter < css::lang::XComponent
+ , css::lang::XEventListener
+ > OWeakEventListenerAdapter_Base;
+ /** the most simple listener adapter: for XEventListeners at XComponents
+ */
+ class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OWeakEventListenerAdapter final : public OWeakEventListenerAdapter_Base
+ {
+ public:
+ OWeakEventListenerAdapter(
+ css::uno::Reference< css::uno::XWeak > const & _rxListener,
+ css::uno::Reference< css::lang::XComponent > const & _rxBroadcaster
+ );
+
+ // nothing to do except an own ctor - the forwarding of the "disposing" is already done
+ // in the base class
+
+ private:
+ using OWeakEventListenerAdapter_Base::disposing;
+ virtual void SAL_CALL disposing( ) override;
+ };
+
+
+ //= OWeakListenerAdapter
+
+
+ template< class BROADCASTER, class LISTENER >
+ OWeakListenerAdapter< BROADCASTER, LISTENER >::OWeakListenerAdapter(
+ const css::uno::Reference< css::uno::XWeak >& _rxListener,
+ const css::uno::Reference< BROADCASTER >& _rxBroadcaster
+ )
+ : ::cppu::WeakComponentImplHelper< LISTENER >( m_aMutex )
+ , OWeakListenerAdapterBase( _rxListener, _rxBroadcaster )
+ {
+ }
+
+
+ template< class BROADCASTER, class LISTENER >
+ void SAL_CALL OWeakListenerAdapter< BROADCASTER, LISTENER >::disposing( const css::lang::EventObject& _rSource )
+ {
+ css::uno::Reference< LISTENER > xListener( getListener() );
+ if ( xListener.is() )
+ xListener->disposing( _rSource );
+ }
+
+
+} // namespace comphelper
+
+
+#endif // INCLUDED_COMPHELPER_WEAKEVENTLISTENER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/windowsStart.hxx b/include/comphelper/windowsStart.hxx
new file mode 100644
index 000000000..a727733d9
--- /dev/null
+++ b/include/comphelper/windowsStart.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef INCLUDED_COMPHELPER_WINSTART_HXX
+#define INCLUDED_COMPHELPER_WINSTART_HXX
+
+#ifdef _WIN32
+#if !defined WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#endif
+
+/**
+ * Launch a child process with the specified arguments.
+ * @note argv[0] is ignored
+ */
+BOOL
+WinLaunchChild(const wchar_t *exePath, int argc,
+ wchar_t **argv, HANDLE userToken = nullptr,
+ HANDLE *hProcess = nullptr);
+
+wchar_t* MakeCommandLine(int argc, wchar_t **argv);
+
+#endif
diff --git a/include/comphelper/windowsdebugoutput.hxx b/include/comphelper/windowsdebugoutput.hxx
new file mode 100644
index 000000000..0315933c7
--- /dev/null
+++ b/include/comphelper/windowsdebugoutput.hxx
@@ -0,0 +1,796 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/* Debug output operators for Windows-specific types. For use in SAL_INFO(), SAL_WARN(), and
+ * friends. The exact format of the generated output is not guaranteed to be stable or contain
+ * complete information.
+ */
+
+#ifndef INCLUDED_COMPHELPER_WINDOWSDEBUGOUTPUT_HXX
+#define INCLUDED_COMPHELPER_WINDOWSDEBUGOUTPUT_HXX
+
+#include <codecvt>
+#include <iomanip>
+#include <ostream>
+#include <string>
+#include <vector>
+
+#ifdef LIBO_INTERNAL_ONLY
+#include <prewin.h>
+#include <postwin.h>
+#else
+#include <windows.h>
+#endif
+#include <initguid.h>
+
+namespace
+{
+DEFINE_GUID(IID_IdentityUnmarshal, 0x0000001B, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x46);
+}
+
+template <typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream,
+ const IID& rIid)
+{
+ LPOLESTR pRiid;
+ if (StringFromIID(rIid, &pRiid) != S_OK)
+ return stream << "?";
+
+ stream << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(
+ std::wstring(pRiid));
+
+ DWORD nSize;
+ if (RegGetValueW(HKEY_CLASSES_ROOT, std::wstring(L"CLSID\\").append(pRiid).data(), nullptr,
+ RRF_RT_REG_SZ, nullptr, nullptr, &nSize)
+ == ERROR_SUCCESS)
+ {
+ std::vector<wchar_t> sValue(nSize / 2);
+ if (RegGetValueW(HKEY_CLASSES_ROOT, std::wstring(L"CLSID\\").append(pRiid).data(), nullptr,
+ RRF_RT_REG_SZ, nullptr, sValue.data(), &nSize)
+ == ERROR_SUCCESS)
+ {
+ stream << "=\""
+ << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(
+ std::wstring(sValue.data()))
+ << "\"";
+ }
+ }
+ else if (RegGetValueW(HKEY_CLASSES_ROOT, std::wstring(L"Interface\\").append(pRiid).data(),
+ nullptr, RRF_RT_REG_SZ, nullptr, nullptr, &nSize)
+ == ERROR_SUCCESS)
+ {
+ std::vector<wchar_t> sValue(nSize / 2);
+ if (RegGetValueW(HKEY_CLASSES_ROOT, std::wstring(L"Interface\\").append(pRiid).data(),
+ nullptr, RRF_RT_REG_SZ, nullptr, sValue.data(), &nSize)
+ == ERROR_SUCCESS)
+ {
+ stream << "=\""
+ << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(
+ std::wstring(sValue.data()))
+ << "\"";
+ }
+ }
+ else
+ {
+ // Special case well-known interfaces that pop up a lot, but which don't have their name in
+ // the Registry.
+
+ if (IsEqualIID(rIid, IID_IMarshal))
+ stream << "=\"IMarshal\"";
+ else if (IsEqualIID(rIid, IID_IMarshal2))
+ stream << "=\"IMarshal2\"";
+ else if (IsEqualIID(rIid, IID_INoMarshal))
+ stream << "=\"INoMarshal\"";
+ else if (IsEqualIID(rIid, IID_IdentityUnmarshal))
+ stream << "=\"IdentityUnmarshal\"";
+ else if (IsEqualIID(rIid, IID_IFastRundown))
+ stream << "=\"IFastRundown\"";
+ else if (IsEqualIID(rIid, IID_IStdMarshalInfo))
+ stream << "=\"IStdMarshalInfo\"";
+ else if (IsEqualIID(rIid, IID_IAgileObject))
+ stream << "=\"IAgileObject\"";
+ else if (IsEqualIID(rIid, IID_IExternalConnection))
+ stream << "=\"IExternalConnection\"";
+ else if (IsEqualIID(rIid, IID_ICallFactory))
+ stream << "=\"ICallFactory\"";
+ }
+
+ CoTaskMemFree(pRiid);
+ return stream;
+}
+
+template <typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream,
+ const VARIANT& rVariant)
+{
+ if (rVariant.vt & VT_VECTOR)
+ stream << "VECTOR:";
+ if (rVariant.vt & VT_ARRAY)
+ stream << "ARRAY:";
+ if (rVariant.vt & VT_BYREF)
+ stream << "BYREF:";
+
+ switch (rVariant.vt & ~(VT_VECTOR | VT_ARRAY | VT_BYREF))
+ {
+ case VT_EMPTY:
+ stream << "EMPTY";
+ break;
+ case VT_NULL:
+ stream << "NULL";
+ break;
+ case VT_I2:
+ stream << "I2";
+ break;
+ case VT_I4:
+ stream << "I4";
+ break;
+ case VT_R4:
+ stream << "R4";
+ break;
+ case VT_R8:
+ stream << "R8";
+ break;
+ case VT_CY:
+ stream << "CY";
+ break;
+ case VT_DATE:
+ stream << "DATE";
+ break;
+ case VT_BSTR:
+ stream << "BSTR";
+ break;
+ case VT_DISPATCH:
+ stream << "DISPATCH";
+ break;
+ case VT_ERROR:
+ stream << "ERROR";
+ break;
+ case VT_BOOL:
+ stream << "BOOL";
+ break;
+ case VT_VARIANT:
+ stream << "VARIANT";
+ break;
+ case VT_UNKNOWN:
+ stream << "UNKNOWN";
+ break;
+ case VT_DECIMAL:
+ stream << "DECIMAL";
+ break;
+ case VT_I1:
+ stream << "I1";
+ break;
+ case VT_UI1:
+ stream << "UI1";
+ break;
+ case VT_UI2:
+ stream << "UI2";
+ break;
+ case VT_UI4:
+ stream << "UI4";
+ break;
+ case VT_I8:
+ stream << "I8";
+ break;
+ case VT_UI8:
+ stream << "UI8";
+ break;
+ case VT_INT:
+ stream << "INT";
+ break;
+ case VT_UINT:
+ stream << "UINT";
+ break;
+ case VT_VOID:
+ stream << "VOID";
+ break;
+ case VT_HRESULT:
+ stream << "HRESULT";
+ break;
+ case VT_PTR:
+ stream << "PTR";
+ break;
+ case VT_SAFEARRAY:
+ stream << "SAFEARRAY";
+ break;
+ case VT_CARRAY:
+ stream << "CARRAY";
+ break;
+ case VT_USERDEFINED:
+ stream << "USERDEFINED";
+ break;
+ case VT_LPSTR:
+ stream << "LPSTR";
+ break;
+ case VT_LPWSTR:
+ stream << "LPWSTR";
+ break;
+ case VT_RECORD:
+ stream << "RECORD";
+ break;
+ case VT_INT_PTR:
+ stream << "INT_PTR";
+ break;
+ case VT_UINT_PTR:
+ stream << "UINT_PTR";
+ break;
+ case VT_FILETIME:
+ stream << "FILETIME";
+ break;
+ case VT_BLOB:
+ stream << "BLOB";
+ break;
+ case VT_STREAM:
+ stream << "STREAM";
+ break;
+ case VT_STORAGE:
+ stream << "STORAGE";
+ break;
+ case VT_STREAMED_OBJECT:
+ stream << "STREAMED_OBJECT";
+ break;
+ case VT_STORED_OBJECT:
+ stream << "STORED_OBJECT";
+ break;
+ case VT_BLOB_OBJECT:
+ stream << "BLOB_OBJECT";
+ break;
+ case VT_CF:
+ stream << "CF";
+ break;
+ case VT_CLSID:
+ stream << "CLSID";
+ break;
+ case VT_VERSIONED_STREAM:
+ stream << "VERSIONED_STREAM";
+ break;
+ case VT_BSTR_BLOB:
+ stream << "BSTR_BLOB";
+ break;
+ default:
+ stream << rVariant.vt;
+ break;
+ }
+ if (rVariant.vt == VT_EMPTY || rVariant.vt == VT_NULL || rVariant.vt == VT_VOID)
+ return stream;
+ stream << ":";
+
+ std::ios_base::fmtflags flags;
+ std::streamsize width;
+ charT fill;
+
+ if (rVariant.vt & VT_BYREF)
+ {
+ stream << rVariant.byref << ":";
+ if (rVariant.byref == nullptr)
+ return stream;
+ if ((rVariant.vt & VT_TYPEMASK) == VT_VOID || (rVariant.vt & VT_TYPEMASK) == VT_USERDEFINED)
+ return stream;
+ stream << ":";
+ switch (rVariant.vt & VT_TYPEMASK)
+ {
+ case VT_I2:
+ stream << *static_cast<short*>(rVariant.byref);
+ break;
+ case VT_I4:
+ stream << *static_cast<int*>(rVariant.byref);
+ break;
+ case VT_R4:
+ stream << *static_cast<float*>(rVariant.byref);
+ break;
+ case VT_R8:
+ stream << *static_cast<double*>(rVariant.byref);
+ break;
+ case VT_CY:
+ stream << static_cast<CY*>(rVariant.byref)->int64;
+ break;
+ case VT_DATE:
+ stream << *static_cast<double*>(rVariant.byref);
+ break; // FIXME
+ case VT_BSTR:
+ stream << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(
+ *static_cast<OLECHAR**>(rVariant.byref));
+ break;
+ case VT_DISPATCH:
+ stream << rVariant.byref;
+ break;
+ case VT_ERROR:
+ case VT_HRESULT:
+ flags = stream.flags();
+ stream << std::hex << *static_cast<int*>(rVariant.byref);
+ stream.setf(flags);
+ break;
+ case VT_BOOL:
+ stream << (*static_cast<VARIANT_BOOL*>(rVariant.byref) ? "YES" : "NO");
+ break;
+ case VT_VARIANT:
+ stream << *static_cast<VARIANT*>(rVariant.byref);
+ break;
+ case VT_UNKNOWN:
+ stream << *static_cast<IUnknown**>(rVariant.byref);
+ break;
+ case VT_DECIMAL:
+ flags = stream.flags();
+ width = stream.width();
+ fill = stream.fill();
+ stream << std::hex << std::setw(8) << std::setfill('0')
+ << static_cast<DECIMAL*>(rVariant.byref)->Hi32;
+ stream << std::setw(16) << static_cast<DECIMAL*>(rVariant.byref)->Lo64;
+ stream.setf(flags);
+ stream << std::setw(width) << std::setfill(fill);
+ break;
+ case VT_I1:
+ stream << static_cast<int>(*static_cast<char*>(rVariant.byref));
+ break;
+ case VT_UI1:
+ stream << static_cast<unsigned int>(*static_cast<unsigned char*>(rVariant.byref));
+ break;
+ case VT_UI2:
+ stream << *static_cast<unsigned short*>(rVariant.byref);
+ break;
+ case VT_UI4:
+ stream << *static_cast<unsigned int*>(rVariant.byref);
+ break;
+ case VT_I8:
+ stream << *static_cast<long long*>(rVariant.byref);
+ break;
+ case VT_UI8:
+ stream << *static_cast<unsigned long long*>(rVariant.byref);
+ break;
+ case VT_INT:
+ stream << *static_cast<int*>(rVariant.byref);
+ break;
+ case VT_UINT:
+ stream << *static_cast<unsigned int*>(rVariant.byref);
+ break;
+ case VT_INT_PTR:
+ stream << *static_cast<intptr_t*>(rVariant.byref);
+ break;
+ case VT_UINT_PTR:
+ stream << *static_cast<uintptr_t*>(rVariant.byref);
+ break;
+ case VT_PTR:
+ case VT_CARRAY:
+ stream << *static_cast<void**>(rVariant.byref);
+ break;
+ case VT_SAFEARRAY:
+ break; // FIXME
+ case VT_LPSTR:
+ stream << *static_cast<char**>(rVariant.byref);
+ break;
+ case VT_LPWSTR:
+ stream << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(
+ std::wstring(*static_cast<wchar_t**>(rVariant.byref)));
+ break;
+ case VT_FILETIME:
+ break; // FIXME
+ case VT_BLOB:
+ break; // FIXME
+ case VT_STREAM:
+ break; // FIXME
+ case VT_STORAGE:
+ break; // FIXME
+ case VT_STREAMED_OBJECT:
+ break; // FIXME
+ case VT_STORED_OBJECT:
+ break; // FIXME
+ case VT_BLOB_OBJECT:
+ break; // FIXME
+ case VT_CF:
+ break; // FIXME
+ case VT_CLSID:
+ stream << *static_cast<IID*>(rVariant.byref);
+ break;
+ case VT_VERSIONED_STREAM:
+ break; // FIXME
+ case VT_BSTR_BLOB:
+ break; // FIXME
+ default:
+ stream << "?(" << (rVariant.vt & VT_TYPEMASK) << ")";
+ break;
+ }
+ return stream;
+ }
+
+ switch (rVariant.vt & VT_TYPEMASK)
+ {
+ case VT_I2:
+ stream << rVariant.iVal;
+ break;
+ case VT_I4:
+ stream << rVariant.lVal;
+ break;
+ case VT_R4:
+ stream << rVariant.fltVal;
+ break;
+ case VT_R8:
+ stream << rVariant.dblVal;
+ break;
+ case VT_CY:
+ stream << rVariant.cyVal.int64;
+ break;
+ case VT_DATE:
+ stream << static_cast<double>(rVariant.date);
+ break; // FIXME
+ case VT_BSTR:
+ if (rVariant.bstrVal == nullptr)
+ stream << "(null)";
+ else
+ stream << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(
+ rVariant.bstrVal);
+ break;
+ case VT_DISPATCH:
+ stream << rVariant.pdispVal;
+ break;
+ case VT_ERROR:
+ case VT_HRESULT:
+ flags = stream.flags();
+ stream << std::hex << rVariant.lVal;
+ stream.setf(flags);
+ break;
+ case VT_BOOL:
+ stream << (rVariant.boolVal ? "YES" : "NO");
+ break;
+ case VT_UNKNOWN:
+ stream << rVariant.punkVal;
+ break;
+ case VT_DECIMAL:
+ flags = stream.flags();
+ width = stream.width();
+ fill = stream.fill();
+ stream << std::hex << std::setw(8) << std::setfill('0') << rVariant.decVal.Hi32;
+ stream << std::setw(16) << rVariant.decVal.Lo64;
+ stream.setf(flags);
+ stream << std::setw(width) << std::setfill(fill);
+ break;
+ case VT_I1:
+ stream << static_cast<int>(rVariant.bVal);
+ break;
+ case VT_UI1:
+ stream << static_cast<unsigned int>(rVariant.bVal);
+ break;
+ case VT_UI2:
+ stream << static_cast<unsigned short>(rVariant.iVal);
+ break;
+ case VT_UI4:
+ stream << static_cast<unsigned int>(rVariant.lVal);
+ break;
+ case VT_I8:
+ stream << rVariant.llVal;
+ break;
+ case VT_UI8:
+ stream << static_cast<unsigned long long>(rVariant.llVal);
+ break;
+ case VT_INT:
+ stream << rVariant.lVal;
+ break;
+ case VT_UINT:
+ stream << static_cast<unsigned int>(rVariant.lVal);
+ break;
+ case VT_INT_PTR:
+ stream << reinterpret_cast<intptr_t>(rVariant.plVal);
+ break;
+ case VT_UINT_PTR:
+ stream << reinterpret_cast<uintptr_t>(rVariant.plVal);
+ break;
+ case VT_PTR:
+ case VT_CARRAY:
+ stream << rVariant.byref;
+ break;
+ case VT_SAFEARRAY:
+ break; // FIXME
+ case VT_LPSTR:
+ stream << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(
+ rVariant.bstrVal);
+ break;
+ case VT_LPWSTR:
+ stream << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(
+ std::wstring(static_cast<wchar_t*>(rVariant.byref)));
+ break;
+ case VT_FILETIME:
+ break; // FIXME
+ case VT_BLOB:
+ break; // FIXME
+ case VT_STREAM:
+ break; // FIXME
+ case VT_STORAGE:
+ break; // FIXME
+ case VT_STREAMED_OBJECT:
+ break; // FIXME
+ case VT_STORED_OBJECT:
+ break; // FIXME
+ case VT_BLOB_OBJECT:
+ break; // FIXME
+ case VT_CF:
+ break; // FIXME
+ case VT_VERSIONED_STREAM:
+ break; // FIXME
+ case VT_BSTR_BLOB:
+ break; // FIXME
+ default:
+ stream << "?(" << (rVariant.vt & VT_TYPEMASK) << ")";
+ break;
+ }
+ return stream;
+}
+
+inline std::string DMPAPER_to_string(int dmpaper)
+{
+ switch (dmpaper)
+ {
+ case DMPAPER_LETTER:
+ return "LETTER";
+ case DMPAPER_LETTERSMALL:
+ return "LETTERSMALL";
+ case DMPAPER_TABLOID:
+ return "TABLOID";
+ case DMPAPER_LEDGER:
+ return "LEDGER";
+ case DMPAPER_LEGAL:
+ return "LEGAL";
+ case DMPAPER_STATEMENT:
+ return "STATEMENT";
+ case DMPAPER_EXECUTIVE:
+ return "EXECUTIVE";
+ case DMPAPER_A3:
+ return "A3";
+ case DMPAPER_A4:
+ return "A4";
+ case DMPAPER_A4SMALL:
+ return "A4SMALL";
+ case DMPAPER_A5:
+ return "A5";
+ case DMPAPER_B4:
+ return "B4";
+ case DMPAPER_B5:
+ return "B5";
+ case DMPAPER_FOLIO:
+ return "FOLIO";
+ case DMPAPER_QUARTO:
+ return "QUARTO";
+ case DMPAPER_10X14:
+ return "10X14";
+ case DMPAPER_11X17:
+ return "11X17";
+ case DMPAPER_NOTE:
+ return "NOTE";
+ case DMPAPER_ENV_9:
+ return "ENV_9";
+ case DMPAPER_ENV_10:
+ return "ENV_10";
+ case DMPAPER_ENV_11:
+ return "ENV_11";
+ case DMPAPER_ENV_12:
+ return "ENV_12";
+ case DMPAPER_ENV_14:
+ return "ENV_14";
+ case DMPAPER_CSHEET:
+ return "CSHEET";
+ case DMPAPER_DSHEET:
+ return "DSHEET";
+ case DMPAPER_ESHEET:
+ return "ESHEET";
+ case DMPAPER_ENV_DL:
+ return "ENV_DL";
+ case DMPAPER_ENV_C5:
+ return "ENV_C5";
+ case DMPAPER_ENV_C3:
+ return "ENV_C3";
+ case DMPAPER_ENV_C4:
+ return "ENV_C4";
+ case DMPAPER_ENV_C6:
+ return "ENV_C6";
+ case DMPAPER_ENV_C65:
+ return "ENV_C65";
+ case DMPAPER_ENV_B4:
+ return "ENV_B4";
+ case DMPAPER_ENV_B5:
+ return "ENV_B5";
+ case DMPAPER_ENV_B6:
+ return "ENV_B6";
+ case DMPAPER_ENV_ITALY:
+ return "ENV_ITALY";
+ case DMPAPER_ENV_MONARCH:
+ return "ENV_MONARCH";
+ case DMPAPER_ENV_PERSONAL:
+ return "ENV_PERSONAL";
+ case DMPAPER_FANFOLD_US:
+ return "FANFOLD_US";
+ case DMPAPER_FANFOLD_STD_GERMAN:
+ return "FANFOLD_STD_GERMAN";
+ case DMPAPER_FANFOLD_LGL_GERMAN:
+ return "FANFOLD_LGL_GERMAN";
+ case DMPAPER_ISO_B4:
+ return "ISO_B4";
+ case DMPAPER_JAPANESE_POSTCARD:
+ return "JAPANESE_POSTCARD";
+ case DMPAPER_9X11:
+ return "9X11";
+ case DMPAPER_10X11:
+ return "10X11";
+ case DMPAPER_15X11:
+ return "15X11";
+ case DMPAPER_ENV_INVITE:
+ return "ENV_INVITE";
+ case DMPAPER_RESERVED_48:
+ return "RESERVED_48";
+ case DMPAPER_RESERVED_49:
+ return "RESERVED_49";
+ case DMPAPER_LETTER_EXTRA:
+ return "LETTER_EXTRA";
+ case DMPAPER_LEGAL_EXTRA:
+ return "LEGAL_EXTRA";
+ case DMPAPER_TABLOID_EXTRA:
+ return "TABLOID_EXTRA";
+ case DMPAPER_A4_EXTRA:
+ return "A4_EXTRA";
+ case DMPAPER_LETTER_TRANSVERSE:
+ return "LETTER_TRANSVERSE";
+ case DMPAPER_A4_TRANSVERSE:
+ return "A4_TRANSVERSE";
+ case DMPAPER_LETTER_EXTRA_TRANSVERSE:
+ return "LETTER_EXTRA_TRANSVERSE";
+ case DMPAPER_A_PLUS:
+ return "A_PLUS";
+ case DMPAPER_B_PLUS:
+ return "B_PLUS";
+ case DMPAPER_LETTER_PLUS:
+ return "LETTER_PLUS";
+ case DMPAPER_A4_PLUS:
+ return "A4_PLUS";
+ case DMPAPER_A5_TRANSVERSE:
+ return "A5_TRANSVERSE";
+ case DMPAPER_B5_TRANSVERSE:
+ return "B5_TRANSVERSE";
+ case DMPAPER_A3_EXTRA:
+ return "A3_EXTRA";
+ case DMPAPER_A5_EXTRA:
+ return "A5_EXTRA";
+ case DMPAPER_B5_EXTRA:
+ return "B5_EXTRA";
+ case DMPAPER_A2:
+ return "A2";
+ case DMPAPER_A3_TRANSVERSE:
+ return "A3_TRANSVERSE";
+ case DMPAPER_A3_EXTRA_TRANSVERSE:
+ return "A3_EXTRA_TRANSVERSE";
+ case DMPAPER_DBL_JAPANESE_POSTCARD:
+ return "DBL_JAPANESE_POSTCARD";
+ case DMPAPER_A6:
+ return "A6";
+ case DMPAPER_JENV_KAKU2:
+ return "JENV_KAKU2";
+ case DMPAPER_JENV_KAKU3:
+ return "JENV_KAKU3";
+ case DMPAPER_JENV_CHOU3:
+ return "JENV_CHOU3";
+ case DMPAPER_JENV_CHOU4:
+ return "JENV_CHOU4";
+ case DMPAPER_LETTER_ROTATED:
+ return "LETTER_ROTATED";
+ case DMPAPER_A3_ROTATED:
+ return "A3_ROTATED";
+ case DMPAPER_A4_ROTATED:
+ return "A4_ROTATED";
+ case DMPAPER_A5_ROTATED:
+ return "A5_ROTATED";
+ case DMPAPER_B4_JIS_ROTATED:
+ return "B4_JIS_ROTATED";
+ case DMPAPER_B5_JIS_ROTATED:
+ return "B5_JIS_ROTATED";
+ case DMPAPER_JAPANESE_POSTCARD_ROTATED:
+ return "JAPANESE_POSTCARD_ROTATED";
+ case DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED:
+ return "DBL_JAPANESE_POSTCARD_ROTATED";
+ case DMPAPER_A6_ROTATED:
+ return "A6_ROTATED";
+ case DMPAPER_JENV_KAKU2_ROTATED:
+ return "JENV_KAKU2_ROTATED";
+ case DMPAPER_JENV_KAKU3_ROTATED:
+ return "JENV_KAKU3_ROTATED";
+ case DMPAPER_JENV_CHOU3_ROTATED:
+ return "JENV_CHOU3_ROTATED";
+ case DMPAPER_JENV_CHOU4_ROTATED:
+ return "JENV_CHOU4_ROTATED";
+ case DMPAPER_B6_JIS:
+ return "B6_JIS";
+ case DMPAPER_B6_JIS_ROTATED:
+ return "B6_JIS_ROTATED";
+ case DMPAPER_12X11:
+ return "12X11";
+ case DMPAPER_JENV_YOU4:
+ return "JENV_YOU4";
+ case DMPAPER_JENV_YOU4_ROTATED:
+ return "JENV_YOU4_ROTATED";
+ case DMPAPER_P16K:
+ return "P16K";
+ case DMPAPER_P32K:
+ return "P32K";
+ case DMPAPER_P32KBIG:
+ return "P32KBIG";
+ case DMPAPER_PENV_1:
+ return "PENV_1";
+ case DMPAPER_PENV_2:
+ return "PENV_2";
+ case DMPAPER_PENV_3:
+ return "PENV_3";
+ case DMPAPER_PENV_4:
+ return "PENV_4";
+ case DMPAPER_PENV_5:
+ return "PENV_5";
+ case DMPAPER_PENV_6:
+ return "PENV_6";
+ case DMPAPER_PENV_7:
+ return "PENV_7";
+ case DMPAPER_PENV_8:
+ return "PENV_8";
+ case DMPAPER_PENV_9:
+ return "PENV_9";
+ case DMPAPER_PENV_10:
+ return "PENV_10";
+ case DMPAPER_P16K_ROTATED:
+ return "P16K_ROTATED";
+ case DMPAPER_P32K_ROTATED:
+ return "P32K_ROTATED";
+ case DMPAPER_P32KBIG_ROTATED:
+ return "P32KBIG_ROTATED";
+ case DMPAPER_PENV_1_ROTATED:
+ return "PENV_1_ROTATED";
+ case DMPAPER_PENV_2_ROTATED:
+ return "PENV_2_ROTATED";
+ case DMPAPER_PENV_3_ROTATED:
+ return "PENV_3_ROTATED";
+ case DMPAPER_PENV_4_ROTATED:
+ return "PENV_4_ROTATED";
+ case DMPAPER_PENV_5_ROTATED:
+ return "PENV_5_ROTATED";
+ case DMPAPER_PENV_6_ROTATED:
+ return "PENV_6_ROTATED";
+ case DMPAPER_PENV_7_ROTATED:
+ return "PENV_7_ROTATED";
+ case DMPAPER_PENV_8_ROTATED:
+ return "PENV_8_ROTATED";
+ case DMPAPER_PENV_9_ROTATED:
+ return "PENV_9_ROTATED";
+ case DMPAPER_PENV_10_ROTATED:
+ return "PENV_10_ROTATED";
+ default:
+ return "?" + std::to_string(dmpaper);
+ }
+}
+
+inline std::string DC_PAPERSIZE_array_to_string(POINT* pPaperSizes, DWORD nCount)
+{
+ std::string result;
+
+ for (DWORD i = 0; i < nCount; i++)
+ {
+ if (i > 0)
+ result += ", ";
+
+ result += std::to_string(std::lround(pPaperSizes[i].x / 10.0)) + "x"
+ + std::to_string(std::lround(pPaperSizes[i].y / 10.0));
+
+#if 0
+ // WIP. Printer::GetPaperName() should really be inline in <i18nutil/paper.hxx> or
+ // something, so that it can be used anywhere. We can't depend on vcl in this file as we
+ // might be included in modules that precede vcl.
+ PaperInfo paperInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10);
+ paperInfo.doSloppyFit(true);
+ if (paperInfo.getPaper() != PAPER_USER)
+ result += "(" + std::string(Printer::GetPaperName(paperInfo.getPaper()).toUtf8().getStr()) + ")";
+#endif
+ }
+ return result;
+}
+
+#endif // INCLUDED_COMPHELPER_WINDOWSDEBUGOUTPUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/windowserrorstring.hxx b/include/comphelper/windowserrorstring.hxx
new file mode 100644
index 000000000..1b50f1ead
--- /dev/null
+++ b/include/comphelper/windowserrorstring.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_WINDOWSERRORSTRING_HXX
+#define INCLUDED_COMPHELPER_WINDOWSERRORSTRING_HXX
+
+#include <prewin.h>
+#include <postwin.h>
+#include <rtl/ustring.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
+
+namespace {
+
+inline OUString WindowsErrorString(DWORD nErrorCode)
+{
+ LPWSTR pMsgBuf;
+
+ if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ nullptr,
+ nErrorCode,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ reinterpret_cast<LPWSTR>(&pMsgBuf),
+ 0,
+ nullptr) == 0)
+ return OUString::number(nErrorCode, 16);
+
+ OUString result(o3tl::toU(pMsgBuf));
+ result.endsWith("\r\n", &result);
+
+ HeapFree(GetProcessHeap(), 0, pMsgBuf);
+
+ return result;
+}
+
+inline OUString WindowsErrorStringFromHRESULT(HRESULT hr)
+{
+ // See https://blogs.msdn.microsoft.com/oldnewthing/20061103-07/?p=29133
+ // Also https://social.msdn.microsoft.com/Forums/vstudio/en-US/c33d9a4a-1077-4efd-99e8-0c222743d2f8
+ // (which refers to https://msdn.microsoft.com/en-us/library/aa382475)
+ // explains why can't we just reinterpret_cast HRESULT to DWORD Win32 error:
+ // we might actually have a Win32 error code converted using HRESULT_FROM_WIN32 macro
+
+ DWORD nErrorCode = DWORD(hr);
+ if (HRESULT(hr & 0xFFFF0000) == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, 0) || hr == S_OK)
+ {
+ nErrorCode = HRESULT_CODE(hr);
+ // https://msdn.microsoft.com/en-us/library/ms679360 mentions that the codes might have
+ // high word bits set (e.g., bit 29 could be set if error comes from a 3rd-party library).
+ // So try to restore the original error code to avoid wrong error messages
+ DWORD nLastError = GetLastError();
+ if ((nLastError & 0xFFFF) == nErrorCode)
+ nErrorCode = nLastError;
+ }
+
+ return WindowsErrorString(nErrorCode);
+}
+
+} // anonymous namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/xmlsechelper.hxx b/include/comphelper/xmlsechelper.hxx
new file mode 100644
index 000000000..9a245877f
--- /dev/null
+++ b/include/comphelper/xmlsechelper.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_XMLSECHELPER_HXX
+#define INCLUDED_COMPHELPER_XMLSECHELPER_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/security/CertificateKind.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <vector>
+
+namespace comphelper::xmlsec
+{
+COMPHELPER_DLLPUBLIC OUString GetCertificateKind(const css::security::CertificateKind& rKind);
+
+COMPHELPER_DLLPUBLIC std::vector<std::pair<OUString, OUString>>
+parseDN(std::u16string_view rRawString);
+COMPHELPER_DLLPUBLIC std::pair<OUString, OUString>
+GetDNForCertDetailsView(std::u16string_view rRawString);
+COMPHELPER_DLLPUBLIC OUString GetContentPart(const OUString& _rRawString,
+ const css::security::CertificateKind& rKind);
+
+COMPHELPER_DLLPUBLIC OUString GetHexString(const css::uno::Sequence<sal_Int8>& _rSeq,
+ const char* _pSep, sal_uInt16 _nLineBreak = 0xFFFF);
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/xmltools.hxx b/include/comphelper/xmltools.hxx
new file mode 100644
index 000000000..9ef64b17d
--- /dev/null
+++ b/include/comphelper/xmltools.hxx
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_XMLTOOLS_HXX
+#define INCLUDED_COMPHELPER_XMLTOOLS_HXX
+
+#include <rtl/string.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace comphelper::xml
+{
+ COMPHELPER_DLLPUBLIC OString makeXMLChaff();
+ COMPHELPER_DLLPUBLIC OString generateGUIDString();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/BlobHelper.hxx b/include/connectivity/BlobHelper.hxx
new file mode 100644
index 000000000..95b5892dc
--- /dev/null
+++ b/include/connectivity/BlobHelper.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <com/sun/star/sdbc/XBlob.hpp>
+#include <cppuhelper/implbase.hxx>
+
+namespace connectivity
+{
+ class OOO_DLLPUBLIC_DBTOOLS BlobHelper final : public ::cppu::WeakImplHelper< css::sdbc::XBlob >
+ {
+ css::uno::Sequence< sal_Int8 > m_aValue;
+ public:
+ BlobHelper(const css::uno::Sequence< sal_Int8 >& _val);
+ private:
+ virtual ::sal_Int64 SAL_CALL length( ) override;
+ virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getBytes( ::sal_Int64 pos, ::sal_Int32 length ) override;
+ virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( ) override;
+ virtual ::sal_Int64 SAL_CALL position( const css::uno::Sequence< ::sal_Int8 >& pattern, ::sal_Int64 start ) override;
+ virtual ::sal_Int64 SAL_CALL positionOfBlob( const css::uno::Reference< css::sdbc::XBlob >& pattern, ::sal_Int64 start ) override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/CommonTools.hxx b/include/connectivity/CommonTools.hxx
new file mode 100644
index 000000000..a5279024e
--- /dev/null
+++ b/include/connectivity/CommonTools.hxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_COMMONTOOLS_HXX
+#define INCLUDED_CONNECTIVITY_COMMONTOOLS_HXX
+
+#include <sal/config.h>
+#include <config_java.h>
+
+#include <map>
+#include <string_view>
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <cppuhelper/weakref.hxx>
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+#if HAVE_FEATURE_JAVA
+namespace jvmaccess { class VirtualMachine; }
+#endif
+
+namespace connectivity
+{
+ OOO_DLLPUBLIC_DBTOOLS bool match(const sal_Unicode* pWild, const sal_Unicode* pStr, const sal_Unicode cEscape);
+ inline bool match(const OUString &rWild, const OUString &rStr, const sal_Unicode cEscape)
+ {
+ return match(rWild.getStr(), rStr.getStr(), cEscape);
+ }
+ // typedefs
+ typedef std::vector< css::uno::WeakReferenceHelper > OWeakRefArray;
+ typedef css::uno::Reference< css::sdbcx::XColumnsSupplier> OSQLTable;
+
+ typedef std::map<OUString,OSQLTable,comphelper::UStringMixLess> OSQLTables;
+
+ // class ORefVector allows reference counting on a std::vector
+ template< class VectorVal > class ORefVector : public salhelper::SimpleReferenceObject,
+ public std::vector< VectorVal >
+ {
+ protected:
+ virtual ~ORefVector() override {}
+ public:
+ typedef std::vector< VectorVal > Vector;
+
+ ORefVector() {}
+ ORefVector(size_t _st) : std::vector< VectorVal >(_st) {}
+ ORefVector(const ORefVector& rOther)
+ : salhelper::SimpleReferenceObject()
+ , std::vector< VectorVal >(rOther)
+ {}
+
+ ORefVector& operator=(const ORefVector& _rRH)
+ {
+ if ( &_rRH != this )
+ {
+ std::vector< VectorVal >::operator=(_rRH);
+ }
+ return *this;
+ }
+ };
+
+ // class ORowVector includes refcounting and initialize himself
+ // with at least one element. This first element is reserved for
+ // the bookmark
+ template< class VectorVal > class ORowVector : public ORefVector< VectorVal >
+ {
+ public:
+ ORowVector() : ORefVector< VectorVal >(1){}
+ ORowVector(size_t _st) : ORefVector< VectorVal >(_st+1)
+ {}
+ };
+
+ typedef ORefVector< css::uno::Reference< css::beans::XPropertySet> > OSQLColumns;
+
+ // search from first to last the column with the name _rVal
+ // when no such column exist last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::const_iterator find( const OSQLColumns::const_iterator& first,
+ const OSQLColumns::const_iterator& last,
+ std::u16string_view _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+
+ // search from first to last the column with the realname _rVal
+ // when no such column exist last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::const_iterator findRealName( const OSQLColumns::const_iterator& first,
+ const OSQLColumns::const_iterator& last,
+ std::u16string_view _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+
+ // the first two find methods are much faster than the one below
+ // search from first to last the column with the property _rProp equals the value _rVal
+ // when no such column exist last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::const_iterator find( OSQLColumns::const_iterator first,
+ const OSQLColumns::const_iterator& last,
+ const OUString& _rProp,
+ std::u16string_view _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+
+ /// @throws css::lang::DisposedException
+ OOO_DLLPUBLIC_DBTOOLS void checkDisposed(bool _bThrow);
+
+#if HAVE_FEATURE_JAVA
+ /** creates a java virtual machine
+ @param _rxContext
+ The ORB.
+ @return
+ The JavaVM.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::Reference< jvmaccess::VirtualMachine > getJavaVM(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+
+ /** return <TRUE/> if the java class exists, otherwise <FALSE/>.
+ @param _pJVM
+ The JavaVM.
+ @param _sClassName
+ The class name to look for.
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool existsJavaClassByName( const ::rtl::Reference< jvmaccess::VirtualMachine >& _pJVM,std::u16string_view _sClassName );
+#endif
+}
+
+#define DECLARE_SERVICE_INFO() \
+ virtual OUString SAL_CALL getImplementationName( ) override; \
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; \
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override \
+
+#define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname) \
+ OUString SAL_CALL classname::getImplementationName( ) \
+ { \
+ return implasciiname; \
+ } \
+ css::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) \
+ { \
+ css::uno::Sequence< OUString > aSupported { serviceasciiname }; \
+ return aSupported; \
+ } \
+ sal_Bool SAL_CALL classname::supportsService( const OUString& rServiceName ) \
+ { \
+ return cppu::supportsService(this, rServiceName); \
+ } \
+
+#endif // INCLUDED_CONNECTIVITY_COMMONTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/ConnectionWrapper.hxx b/include/connectivity/ConnectionWrapper.hxx
new file mode 100644
index 000000000..8eac6a7b9
--- /dev/null
+++ b/include/connectivity/ConnectionWrapper.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_CONNECTIONWRAPPER_HXX
+#define INCLUDED_CONNECTIVITY_CONNECTIONWRAPPER_HXX
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <connectivity/CommonTools.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::sdbc { class XConnection; }
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace connectivity
+{
+
+
+ //= OConnectionWrapper - wraps all methods to the real connection from the driver
+ //= but when disposed it doesn't dispose the real connection
+
+ typedef ::cppu::ImplHelper2< css::lang::XServiceInfo,
+ css::lang::XUnoTunnel
+ > OConnection_BASE;
+
+ class OOO_DLLPUBLIC_DBTOOLS OConnectionWrapper : public OConnection_BASE
+ {
+ protected:
+ css::uno::Reference< css::uno::XAggregation > m_xProxyConnection;
+ css::uno::Reference< css::sdbc::XConnection > m_xConnection;
+ css::uno::Reference< css::lang::XTypeProvider > m_xTypeProvider;
+ css::uno::Reference< css::lang::XUnoTunnel > m_xUnoTunnel;
+ css::uno::Reference< css::lang::XServiceInfo > m_xServiceInfo;
+
+ virtual ~OConnectionWrapper();
+ void setDelegation(css::uno::Reference< css::uno::XAggregation >& _rxProxyConnection,oslInterlockedCount& _rRefCount);
+ void setDelegation(const css::uno::Reference< css::sdbc::XConnection >& _xConnection
+ ,const css::uno::Reference< css::uno::XComponentContext>& _rxContext
+ ,oslInterlockedCount& _rRefCount);
+ // must be called from derived classes
+ void disposing();
+ public:
+ OConnectionWrapper( );
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& _rType ) override;
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+
+ // css::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+ /** method to create unique ids
+ @param _rURL
+ The URL.
+ @param _rInfo
+ The info property of the datasource. It will be resorted if needed.
+ @param _pBuffer
+ Here we store the digest. Must not NULL.
+ @param _rUserName
+ The user name.
+ @param _rPassword
+ The password.
+ */
+ static void createUniqueId( const OUString& _rURL
+ ,css::uno::Sequence< css::beans::PropertyValue >& _rInfo
+ ,sal_uInt8* _pBuffer
+ ,const OUString& _rUserName = OUString()
+ ,const OUString& _rPassword = OUString());
+ };
+}
+#endif // INCLUDED_CONNECTIVITY_CONNECTIONWRAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/DriversConfig.hxx b/include/connectivity/DriversConfig.hxx
new file mode 100644
index 000000000..ceb15bedd
--- /dev/null
+++ b/include/connectivity/DriversConfig.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_DRIVERSCONFIG_HXX
+#define INCLUDED_CONNECTIVITY_DRIVERSCONFIG_HXX
+
+#include <sal/config.h>
+
+#include <map>
+#include <string_view>
+
+#include <com/sun/star/uno/Sequence.h>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <salhelper/singletonref.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <unotools/confignode.hxx>
+
+namespace connectivity
+{
+ struct TInstalledDriver
+ {
+ ::comphelper::NamedValueCollection aProperties;
+ ::comphelper::NamedValueCollection aFeatures;
+ ::comphelper::NamedValueCollection aMetaData;
+ OUString sDriverFactory;
+ OUString sDriverTypeDisplayName;
+ };
+ typedef std::map<OUString, TInstalledDriver> TInstalledDrivers;
+
+ class DriversConfigImpl
+ {
+ mutable ::utl::OConfigurationTreeRoot m_aInstalled;
+ mutable TInstalledDrivers m_aDrivers;
+ public:
+ DriversConfigImpl();
+
+ const TInstalledDrivers& getInstalledDrivers(const css::uno::Reference< css::uno::XComponentContext >& _rxORB) const;
+ };
+
+ // Allows to access all driver which are located in the configuration
+
+ class OOO_DLLPUBLIC_DBTOOLS DriversConfig
+ {
+ typedef salhelper::SingletonRef<DriversConfigImpl> OSharedConfigNode;
+
+ const ::comphelper::NamedValueCollection& impl_get(std::u16string_view _sURL,sal_Int32 _nProps) const;
+ public:
+ DriversConfig(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+ ~DriversConfig();
+
+ DriversConfig( const DriversConfig& );
+ DriversConfig& operator=( const DriversConfig& );
+
+ OUString getDriverFactoryName(std::u16string_view _sUrl) const;
+ OUString getDriverTypeDisplayName(std::u16string_view _sUrl) const;
+ const ::comphelper::NamedValueCollection& getProperties(std::u16string_view _sURL) const;
+ const ::comphelper::NamedValueCollection& getFeatures(std::u16string_view _sURL) const;
+ const ::comphelper::NamedValueCollection& getMetaData(std::u16string_view _sURL) const;
+ css::uno::Sequence< OUString > getURLs() const;
+ private:
+ OSharedConfigNode m_aNode;
+ css::uno::Reference< css::uno::XComponentContext > m_xORB;
+ };
+}
+#endif // INCLUDED_CONNECTIVITY_DRIVERSCONFIG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/FValue.hxx b/include/connectivity/FValue.hxx
new file mode 100644
index 000000000..1fe2b9d5f
--- /dev/null
+++ b/include/connectivity/FValue.hxx
@@ -0,0 +1,490 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_FVALUE_HXX
+#define INCLUDED_CONNECTIVITY_FVALUE_HXX
+
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustring.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <rtl/ref.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace com::sun::star::sdb { class XColumn; }
+namespace com::sun::star::sdbc { class XRow; }
+
+namespace connectivity
+{
+ namespace detail
+ {
+ class IValueSource;
+ }
+
+ class OOO_DLLPUBLIC_DBTOOLS ORowSetValue
+ {
+ union
+ {
+ bool m_bBool;
+
+ sal_Int8 m_nInt8;
+ sal_uInt8 m_uInt8;
+
+ sal_Int16 m_nInt16;
+ sal_uInt16 m_uInt16;
+
+ sal_Int32 m_nInt32;
+ sal_uInt32 m_uInt32;
+
+ sal_Int64 m_nInt64;
+ sal_uInt64 m_uInt64;
+
+ float m_nFloat;
+ double m_nDouble;
+
+ rtl_uString* m_pString;
+
+ void* m_pValue; // date/time/timestamp/sequence
+ } m_aValue;
+
+ sal_Int32 m_eTypeKind; // the database type
+ bool m_bNull : 1; // value is null
+ bool m_bBound : 1; // is bound
+ bool m_bModified : 1; // value was changed
+ bool m_bSigned : 1; // value is signed
+
+ void free() noexcept;
+
+ public:
+ ORowSetValue()
+ :m_eTypeKind(css::sdbc::DataType::VARCHAR)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ }
+
+ ORowSetValue(const ORowSetValue& _rRH)
+ :m_eTypeKind(css::sdbc::DataType::VARCHAR)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(ORowSetValue&& _rRH) noexcept
+ :m_eTypeKind(css::sdbc::DataType::VARCHAR)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(std::move(_rRH));
+ }
+
+ ORowSetValue(const OUString& _rRH)
+ :m_eTypeKind(css::sdbc::DataType::VARCHAR)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const double& _rRH)
+ :m_eTypeKind(css::sdbc::DataType::DOUBLE)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(float _rRH)
+ :m_eTypeKind(css::sdbc::DataType::FLOAT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(sal_Int8 _rRH)
+ :m_eTypeKind(css::sdbc::DataType::TINYINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(sal_Int16 _rRH)
+ :m_eTypeKind(css::sdbc::DataType::SMALLINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+ ORowSetValue(sal_uInt16 _rRH)
+ :m_eTypeKind(css::sdbc::DataType::SMALLINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(false)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+ ORowSetValue(sal_Int32 _rRH)
+ :m_eTypeKind(css::sdbc::DataType::INTEGER)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+ ORowSetValue(sal_uInt32 _rRH)
+ :m_eTypeKind(css::sdbc::DataType::INTEGER)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(false)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+ ORowSetValue(sal_Int64 _rRH)
+ :m_eTypeKind(css::sdbc::DataType::BIGINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+ ORowSetValue(sal_uInt64 _rRH)
+ :m_eTypeKind(css::sdbc::DataType::BIGINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(false)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(bool _rRH)
+ :m_eTypeKind(css::sdbc::DataType::BIT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+ ORowSetValue(sal_Bool) = delete; // aka sal_uInt8
+
+ ORowSetValue(const css::util::Date& _rRH)
+ :m_eTypeKind(css::sdbc::DataType::DATE)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const css::util::Time& _rRH)
+ :m_eTypeKind(css::sdbc::DataType::TIME)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const css::util::DateTime& _rRH)
+ :m_eTypeKind(css::sdbc::DataType::TIMESTAMP)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const css::uno::Sequence<sal_Int8>& _rRH)
+ :m_eTypeKind(css::sdbc::DataType::LONGVARBINARY)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = nullptr;
+ operator=(_rRH);
+ }
+
+ // Avoid accidental uses of ORowSetValue(bool const &):
+ template<typename T> ORowSetValue(T const *) = delete;
+
+ ~ORowSetValue()
+ {
+ free();
+ }
+
+ ORowSetValue& operator=(const ORowSetValue& _rRH);
+ ORowSetValue& operator=(ORowSetValue&& _rRH) noexcept;
+
+ // simple types
+ ORowSetValue& operator=(bool _rRH);
+ void operator =(sal_Bool) = delete; // aka sal_uInt8
+
+ ORowSetValue& operator=(sal_Int8 _rRH);
+
+ ORowSetValue& operator=(sal_Int16 _rRH);
+ ORowSetValue& operator=(sal_uInt16 _rRH);
+
+ ORowSetValue& operator=(sal_Int32 _rRH);
+ ORowSetValue& operator=(sal_uInt32 _rRH);
+
+ ORowSetValue& operator=(sal_Int64 _rRH);
+ ORowSetValue& operator=(sal_uInt64 _rRH);
+
+ ORowSetValue& operator=(double _rRH);
+ ORowSetValue& operator=(float _rRH);
+
+ // ADT's
+ ORowSetValue& operator=(const css::util::Date& _rRH);
+ ORowSetValue& operator=(const css::util::Time& _rRH);
+ ORowSetValue& operator=(const css::util::DateTime& _rRH);
+
+ ORowSetValue& operator=(const OUString& _rRH);
+ // the type isn't set it will be set to VARCHAR if the type is different change it
+ ORowSetValue& operator=(const css::uno::Sequence<sal_Int8>& _rRH);
+ // with the possibility to save an any for bookmarks
+ ORowSetValue& operator=(const css::uno::Any& _rAny);
+
+ bool operator==(const ORowSetValue& _rRH) const;
+ bool operator!=(const ORowSetValue& _rRH) const
+ {
+ return !( *this == _rRH );
+ }
+
+ bool isNull() const
+ {
+ return m_bNull;
+ }
+ void setNull()
+ {
+ free();
+ m_bNull = true;
+ m_aValue.m_pString = nullptr;
+ }
+
+ bool isBound() const { return m_bBound; }
+ void setBound(bool _bBound) { m_bBound = _bBound; }
+
+ bool isModified() const { return m_bModified; }
+ void setModified(bool _bMod) { m_bModified = _bMod; }
+
+ bool isSigned() const { return m_bSigned; }
+ void setSigned(bool _bSig);
+
+ sal_Int32 getTypeKind() const { return m_eTypeKind; }
+ void setTypeKind(sal_Int32 _eType);
+
+ bool getBool() const;
+
+ sal_Int8 getInt8() const;
+ sal_uInt8 getUInt8() const;
+
+ sal_Int16 getInt16() const;
+ sal_uInt16 getUInt16() const;
+
+ sal_Int32 getInt32() const;
+ sal_uInt32 getUInt32() const;
+
+ sal_Int64 getLong() const;
+ sal_uInt64 getULong() const;
+
+ double getDouble() const;
+ float getFloat() const;
+
+ OUString getString() const; // makes an automatic conversion if type isn't a string
+ css::util::Date getDate() const;
+ css::util::Time getTime() const;
+ css::util::DateTime getDateTime() const;
+ css::uno::Sequence<sal_Int8> getSequence() const;
+ // only use for anys
+ const css::uno::Any& getAny() const { return *static_cast<css::uno::Any*>(m_aValue.m_pValue); }
+ css::uno::Any makeAny() const;
+
+ /**
+ fetches a single value out of the row
+ @param _nPos the current column position
+ @param _nType the type of the current column
+ @param _xRow the row where to fetch the data from
+ */
+ void fill(sal_Int32 _nPos,
+ sal_Int32 _nType,
+ const css::uno::Reference< css::sdbc::XRow>& _xRow);
+
+ /**
+ fetches a single value out of the row
+ @param _nPos the current column position
+ @param _nType the type of the current column
+ @param _bNullable if true then it will be checked if the result could be NULL, otherwise not.
+ @param _xRow the row where to fetch the data from
+ */
+ void fill(sal_Int32 _nPos,
+ sal_Int32 _nType,
+ bool _bNullable,
+ const css::uno::Reference< css::sdbc::XRow>& _xRow);
+
+ void fill(const css::uno::Any& _rValue);
+
+ void fill( const sal_Int32 _nType,
+ const css::uno::Reference< css::sdb::XColumn >& _rxColumn );
+
+ private:
+ void impl_fill( const sal_Int32 _nType, bool _bNullable, const detail::IValueSource& _rValueSource );
+ };
+
+ /// ORowSetValueDecorator decorates an ORowSetValue so the value is "refcounted"
+ class OOO_DLLPUBLIC_DBTOOLS ORowSetValueDecorator final : public ::salhelper::SimpleReferenceObject
+ {
+ ORowSetValue m_aValue; // my own value
+ public:
+ ORowSetValueDecorator(){m_aValue.setBound(true);}
+ ORowSetValueDecorator(const ORowSetValue& _aValue) : m_aValue(_aValue){m_aValue.setBound(true);}
+ ORowSetValueDecorator& operator=(const ORowSetValue& _aValue);
+
+ operator const ORowSetValue&() const { return m_aValue; }
+ bool operator ==( const ORowSetValue & _rRH ) { return m_aValue == _rRH; }
+ const ORowSetValue& getValue() const { return m_aValue; }
+ ORowSetValue& get() { return m_aValue; }
+ void setValue(const ORowSetValue& _aValue) { m_aValue = _aValue; }
+ void setNull() { m_aValue.setNull(); }
+ void setBound(bool _bBound ) { m_aValue.setBound(_bBound);}
+ bool isBound( ) const { return m_aValue.isBound();}
+ void setTypeKind(sal_Int32 _nType) { m_aValue.setTypeKind(_nType); }
+ void setModified(bool _bModified) { m_aValue.setModified(_bModified); }
+
+ };
+ typedef ::rtl::Reference<ORowSetValueDecorator> ORowSetValueDecoratorRef;
+
+
+ /// TSetBound is a functor to set the bound value with e.q. for_each call
+ struct OOO_DLLPUBLIC_DBTOOLS TSetBound
+ {
+ bool m_bBound;
+ TSetBound(bool _bBound) : m_bBound(_bBound){}
+ void operator()(ORowSetValue& _rValue) const { _rValue.setBound(m_bBound); }
+
+ };
+
+
+ /// TSetBound is a functor to set the bound value with e.q. for_each call
+ struct OOO_DLLPUBLIC_DBTOOLS TSetRefBound
+ {
+ bool m_bBound;
+ TSetRefBound(bool _bBound) : m_bBound(_bBound){}
+ void operator()(ORowSetValueDecoratorRef const & _rValue) const { _rValue->setBound(m_bBound); }
+
+ };
+
+
+ // Vector for file based rows
+
+ template< class VectorVal > class ODeleteVector : public connectivity::ORowVector< VectorVal >
+ {
+ bool m_bDeleted;
+ public:
+ ODeleteVector() : connectivity::ORowVector< VectorVal >() ,m_bDeleted(false) {}
+ ODeleteVector(size_t _st) : connectivity::ORowVector< VectorVal >(_st) ,m_bDeleted(false) {}
+
+ bool isDeleted() const { return m_bDeleted; }
+ void setDeleted(bool _bDeleted) { m_bDeleted = _bDeleted; }
+ };
+
+ typedef ODeleteVector< ORowSetValue > OValueVector;
+
+ class OOO_DLLPUBLIC_DBTOOLS OValueRefVector : public ODeleteVector< ORowSetValueDecoratorRef >
+ {
+ public:
+ OValueRefVector(){}
+ OValueRefVector(size_t _st) : ODeleteVector< ORowSetValueDecoratorRef >(_st)
+ {
+ for (auto & elem : *this)
+ elem = new ORowSetValueDecorator;
+ }
+ };
+
+#define SQL_NO_PARAMETER (SAL_MAX_UINT32)
+ class OAssignValues final : public OValueRefVector
+ {
+ ::std::vector<sal_Int32> m_nParameterIndexes;
+ public:
+ OAssignValues(size_type n) : OValueRefVector(n),m_nParameterIndexes(n+1,SQL_NO_PARAMETER){}
+
+ void setParameterIndex(sal_Int32 _nId,sal_Int32 _nParameterIndex) { m_nParameterIndexes[_nId] = _nParameterIndex;}
+ sal_Int32 getParameterIndex(sal_Int32 _nId) const { return m_nParameterIndexes[_nId]; }
+ };
+
+ typedef ::rtl::Reference< OAssignValues > ORefAssignValues;
+
+
+ typedef ::rtl::Reference< OValueVector > OValueRow;
+ typedef ::rtl::Reference< OValueRefVector > OValueRefRow;
+}
+
+#endif // INCLUDED_CONNECTIVITY_FVALUE_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/IParseContext.hxx b/include/connectivity/IParseContext.hxx
new file mode 100644
index 000000000..51171281d
--- /dev/null
+++ b/include/connectivity/IParseContext.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_IPARSECONTEXT_HXX
+#define INCLUDED_CONNECTIVITY_IPARSECONTEXT_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+
+namespace connectivity
+{
+
+ //= IParseContext
+
+ class IParseContext
+ {
+ public:
+ enum class ErrorCode
+ {
+ General, // "Syntax error in SQL expression"
+ ValueNoLike, // "The value #1 can not be used with LIKE."
+ FieldNoLike, // "LIKE can not be used with this field."
+ InvalidCompare, // "The entered criterion can not be compared with this field."
+ InvalidIntCompare, // "The field can not be compared with a number."
+ InvalidDateCompare, // "The field can not be compared with a date."
+ InvalidRealCompare, // "The field can not be compared with a floating point number."
+ InvalidTableNosuch, // "The database does not contain a table named \"#\"."
+ // Named like this to avoid conflict with a #define in the Windows system ODBC headers.
+ InvalidTableOrQuery, // "The database does contain neither a table nor a query named \"#\"."
+ InvalidColumn, // "The column \"#1\" is unknown in the table \"#2\"."
+ InvalidTableExist, // "The database already contains a table or view with name \"#\"."
+ InvalidQueryExist // "The database already contains a query with name \"#\".";
+ };
+
+ enum class InternationalKeyCode
+ {
+ None = 0,
+ Like,
+ Not,
+ Null,
+ True,
+ False,
+ Is,
+ Between,
+ Or,
+ And,
+ Avg,
+ Count,
+ Max,
+ Min,
+ Sum,
+ Every,
+ Any,
+ Some,
+ StdDevPop,
+ StdDevSamp,
+ VarSamp,
+ VarPop,
+ Collect,
+ Fusion,
+ Intersection
+ };
+
+ public:
+ // retrieves language specific error messages
+ virtual OUString getErrorMessage(ErrorCode _eCodes) const = 0;
+
+ // retrieves language specific keyword strings (only ASCII allowed)
+ virtual OString getIntlKeywordAscii(InternationalKeyCode _eKey) const = 0;
+
+ // finds out, if we have an international keyword (only ASCII allowed)
+ virtual InternationalKeyCode getIntlKeyCode(const OString& rToken) const = 0;
+
+ /** gets a locale instance which should be used when parsing in the context specified by this instance
+ <p>if this is not overridden by derived classes, it returns the static default locale.</p>
+ */
+ virtual css::lang::Locale getPreferredLocale( ) const = 0;
+
+ protected:
+ ~IParseContext() {}
+ };
+}
+
+#endif // INCLUDED_CONNECTIVITY_IPARSECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/PColumn.hxx b/include/connectivity/PColumn.hxx
new file mode 100644
index 000000000..46ceaa1bb
--- /dev/null
+++ b/include/connectivity/PColumn.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_PCOLUMN_HXX
+#define INCLUDED_CONNECTIVITY_PCOLUMN_HXX
+
+#include <sal/config.h>
+
+#include <map>
+
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <connectivity/sdbcx/VColumn.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <rtl/ref.hxx>
+#include <comphelper/proparrhlp.hxx>
+
+namespace com::sun::star::container { class XNameAccess; }
+namespace com::sun::star::sdbc { class XDatabaseMetaData; }
+namespace com::sun::star::sdbc { class XResultSetMetaData; }
+
+namespace connectivity::parse
+ {
+ class OParseColumn;
+
+ typedef sdbcx::OColumn OParseColumn_BASE;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OParseColumn> OParseColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OParseColumn final :
+ public OParseColumn_BASE, public OParseColumn_PROP
+ {
+ OUString m_aRealName;
+ OUString m_sLabel;
+ bool m_bFunction;
+ bool m_bDbasePrecisionChanged;
+ bool m_bAggregateFunction;
+ bool m_bIsSearchable;
+
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+
+ virtual ~OParseColumn() override;
+ public:
+ OParseColumn(const css::uno::Reference< css::beans::XPropertySet>& _xColumn, bool _bCase);
+ OParseColumn(const OUString& Name,
+ const OUString& TypeName,
+ const OUString& DefaultValue,
+ const OUString& Description,
+ sal_Int32 IsNullable,
+ sal_Int32 Precision,
+ sal_Int32 Scale,
+ sal_Int32 Type,
+ bool IsAutoIncrement,
+ bool IsCurrency,
+ bool _bCase,
+ const OUString& CatalogName,
+ const OUString& SchemaName,
+ const OUString& TableName);
+
+ virtual void construct() override;
+
+ void setRealName(const OUString& _rName) { m_aRealName = _rName; }
+ void setLabel(const OUString& i_sLabel) { m_sLabel = i_sLabel; }
+ void setTableName(const OUString& _rName) { m_TableName = _rName; }
+ void setFunction(bool _bFunction) { m_bFunction = _bFunction; }
+ void setAggregateFunction(bool _bFunction) { m_bAggregateFunction = _bFunction; }
+ void setIsSearchable( bool _bIsSearchable ) { m_bIsSearchable = _bIsSearchable; }
+ const OUString& getRealName() const { return m_aRealName; }
+
+ /** creates a collection of OParseColumn, as described by a result set meta data instance.
+ */
+ static ::rtl::Reference< OSQLColumns >
+ createColumnsForResultSet(
+ const css::uno::Reference< css::sdbc::XResultSetMetaData >& _rxResMetaData,
+ const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxDBMetaData,
+ const css::uno::Reference< css::container::XNameAccess>& i_xQueryColumns
+ );
+
+ typedef std::map<OUString, int> StringMap;
+ /** creates a single OParseColumn, as described by a result set meta data instance.
+ The column names are unique.
+ */
+ static rtl::Reference<OParseColumn>
+ createColumnForResultSet(
+ const css::uno::Reference< css::sdbc::XResultSetMetaData >& _rxResMetaData,
+ const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxDBMetaData,
+ sal_Int32 _nColumnPos,
+ StringMap& _rColumns
+ );
+
+ private:
+ using OParseColumn_BASE::createArrayHelper;
+ };
+
+ class OOrderColumn;
+
+ typedef sdbcx::OColumn OOrderColumn_BASE;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OOrderColumn> OOrderColumn_PROP;
+
+ class OOrderColumn final :
+ public OOrderColumn_BASE, public OOrderColumn_PROP
+ {
+ const bool m_bAscending;
+
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+
+ virtual ~OOrderColumn() override;
+ public:
+ OOrderColumn(
+ const css::uno::Reference< css::beans::XPropertySet>& _xColumn,
+ const OUString& i_rOriginatingTableName,
+ bool _bCase,
+ bool _bAscending
+ );
+
+ OOrderColumn(
+ const css::uno::Reference< css::beans::XPropertySet>& _xColumn,
+ bool _bCase,
+ bool _bAscending
+ );
+
+ virtual void construct() override;
+
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+ private:
+ using OOrderColumn_BASE::createArrayHelper;
+ };
+
+}
+
+#endif // INCLUDED_CONNECTIVITY_PCOLUMN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TColumnsHelper.hxx b/include/connectivity/TColumnsHelper.hxx
new file mode 100644
index 000000000..c50aefb27
--- /dev/null
+++ b/include/connectivity/TColumnsHelper.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_TCOLUMNSHELPER_HXX
+#define INCLUDED_CONNECTIVITY_TCOLUMNSHELPER_HXX
+
+#include <memory>
+#include <connectivity/sdbcx/VCollection.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OColumnsHelperImpl;
+ /** contains general column handling to create default columns and default sql statements.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OColumnsHelper : public sdbcx::OCollection
+ {
+ std::unique_ptr<OColumnsHelperImpl> m_pImpl;
+ protected:
+ OTableHelper* m_pTable;
+
+ virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual void impl_refresh() override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
+ public:
+ OColumnsHelper( ::cppu::OWeakObject& _rParent
+ ,bool _bCase
+ ,::osl::Mutex& _rMutex
+ ,const ::std::vector< OUString> &_rVector
+ ,bool _bUseHardRef
+ );
+ virtual ~OColumnsHelper() override;
+
+ /** set the parent of the columns. Can also be <NULL/>.
+ @param _pTable
+ The parent.
+ */
+ void setParent(OTableHelper* _pTable) { m_pTable = _pTable;}
+ };
+}
+#endif // INCLUDED_CONNECTIVITY_TCOLUMNSHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TIndexes.hxx b/include/connectivity/TIndexes.hxx
new file mode 100644
index 000000000..4f3a09305
--- /dev/null
+++ b/include/connectivity/TIndexes.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_TINDEXES_HXX
+#define INCLUDED_CONNECTIVITY_TINDEXES_HXX
+
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <connectivity/sdbcx/VCollection.hxx>
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OIndexesHelper : public sdbcx::OCollection
+ {
+ OTableHelper* m_pTable;
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual void impl_refresh() override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override;
+ public:
+ OIndexesHelper(OTableHelper* _pTable,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector
+ );
+
+ };
+}
+
+#endif // INCLUDED_CONNECTIVITY_TINDEXES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TKeys.hxx b/include/connectivity/TKeys.hxx
new file mode 100644
index 000000000..ae226b874
--- /dev/null
+++ b/include/connectivity/TKeys.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_TKEYS_HXX
+#define INCLUDED_CONNECTIVITY_TKEYS_HXX
+
+#include <connectivity/sdbcx/VCollection.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+
+namespace connectivity
+{
+ class OTableHelper;
+ typedef sdbcx::OCollection OKeys_BASE;
+ class OOO_DLLPUBLIC_DBTOOLS OKeysHelper : public OKeys_BASE
+ {
+ OTableHelper* m_pTable;
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual void impl_refresh() override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
+
+ virtual OUString getDropForeignKey() const;
+
+ public:
+ OKeysHelper( OTableHelper* _pTable,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString>& _rVector
+ );
+
+ static void cloneDescriptorColumns(
+ const sdbcx::ObjectType& _rSourceDescriptor,
+ const sdbcx::ObjectType& _rDestDescriptor
+ );
+ };
+}
+
+#endif // INCLUDED_CONNECTIVITY_TKEYS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TTableHelper.hxx b/include/connectivity/TTableHelper.hxx
new file mode 100644
index 000000000..e987241a6
--- /dev/null
+++ b/include/connectivity/TTableHelper.hxx
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_TTABLEHELPER_HXX
+#define INCLUDED_CONNECTIVITY_TTABLEHELPER_HXX
+
+#include <memory>
+#include <sal/config.h>
+
+#include <map>
+
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <connectivity/sdbcx/VTable.hxx>
+
+namespace com::sun::star::sdbc { class XConnection; }
+namespace com::sun::star::sdb::tools { class XIndexAlteration; }
+namespace com::sun::star::sdb::tools { class XKeyAlteration; }
+namespace com::sun::star::sdb::tools { class XTableAlteration; }
+namespace com::sun::star::sdb::tools { class XTableRename; }
+namespace connectivity::sdbcx { struct KeyProperties; }
+
+namespace connectivity
+{
+ typedef sal_Int32 OrdinalPosition;
+ struct ColumnDesc
+ {
+ OUString sName;
+ OUString aField6;
+ OUString sField12; // REMARKS
+ OUString sField13;
+ sal_Int32 nField5
+ , nField7
+ , nField9
+ , nField11;
+
+ OrdinalPosition nOrdinalPosition;
+
+ ColumnDesc( const OUString& _rName
+ , sal_Int32 _nField5
+ , const OUString& _aField6
+ , sal_Int32 _nField7
+ , sal_Int32 _nField9
+ , sal_Int32 _nField11
+ , const OUString& _sField12
+ , const OUString& _sField13
+ ,OrdinalPosition _nPosition )
+ :sName( _rName )
+ ,aField6(_aField6)
+ ,sField12(_sField12)
+ ,sField13(_sField13)
+ ,nField5(_nField5)
+ ,nField7(_nField7)
+ ,nField9(_nField9)
+ ,nField11(_nField11)
+ ,nOrdinalPosition( _nPosition )
+ {
+ }
+ };
+ typedef connectivity::sdbcx::OTable OTable_TYPEDEF;
+
+ typedef std::map<OUString, std::shared_ptr<sdbcx::KeyProperties>> TKeyMap;
+
+ struct OTableHelperImpl;
+
+ class OOO_DLLPUBLIC_DBTOOLS OTableHelper : public OTable_TYPEDEF
+ {
+ ::std::unique_ptr<OTableHelperImpl> m_pImpl;
+
+ void refreshPrimaryKeys(::std::vector< OUString>& _rKeys);
+ void refreshForeignKeys(::std::vector< OUString>& _rKeys);
+
+ protected:
+ /** creates the column collection for the table
+ @param _rNames
+ The column names.
+ */
+ virtual sdbcx::OCollection* createColumns(const ::std::vector< OUString>& _rNames) = 0;
+
+ /** creates the key collection for the table
+ @param _rNames
+ The key names.
+ */
+ virtual sdbcx::OCollection* createKeys(const ::std::vector< OUString>& _rNames) = 0;
+
+ /** creates the index collection for the table
+ @param _rNames
+ The index names.
+ */
+ virtual sdbcx::OCollection* createIndexes(const ::std::vector< OUString>& _rNames) = 0;
+
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing() override;
+
+ /** The default returns "RENAME TABLE " or "RENAME VIEW " depending on the type.
+ *
+ * \return The start of the rename statement.
+ */
+ virtual OUString getRenameStart() const;
+
+ virtual ~OTableHelper() override;
+
+ public:
+ virtual void refreshColumns() override;
+ virtual void refreshKeys() override;
+ virtual void refreshIndexes() override;
+
+ const ColumnDesc* getColumnDescription(const OUString& _sName) const;
+
+ public:
+ OTableHelper( sdbcx::OCollection* _pTables,
+ const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+ bool _bCase);
+ OTableHelper( sdbcx::OCollection* _pTables,
+ const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+ bool _bCase,
+ const OUString& Name,
+ const OUString& Type,
+ const OUString& Description = OUString(),
+ const OUString& SchemaName = OUString(),
+ const OUString& CatalogName = OUString()
+ );
+
+ virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() const override;
+ css::uno::Reference< css::sdbc::XConnection> const & getConnection() const;
+
+ // XRename
+ virtual void SAL_CALL rename( const OUString& newName ) override;
+
+ // XAlterTable
+ virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ // XNamed
+ virtual OUString SAL_CALL getName() override;
+
+ // To retrieve the table name only without the schema
+ const OUString & getTableName();
+
+ // helper method to get key properties
+ std::shared_ptr<sdbcx::KeyProperties> getKeyProperties(const OUString& _sName) const;
+ void addKey(const OUString& _sName,const std::shared_ptr<sdbcx::KeyProperties>& _aKeyProperties);
+
+ virtual OUString getTypeCreatePattern() const;
+
+ css::uno::Reference< css::sdb::tools::XTableRename> const & getRenameService() const;
+ css::uno::Reference< css::sdb::tools::XTableAlteration> const & getAlterService() const;
+ css::uno::Reference< css::sdb::tools::XKeyAlteration> const & getKeyService() const;
+ css::uno::Reference< css::sdb::tools::XIndexAlteration> const & getIndexService() const;
+ };
+}
+#endif // INCLUDED_CONNECTIVITY_TTABLEHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/conncleanup.hxx b/include/connectivity/conncleanup.hxx
new file mode 100644
index 000000000..d243e3842
--- /dev/null
+++ b/include/connectivity/conncleanup.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_CONNCLEANUP_HXX
+#define INCLUDED_CONNECTIVITY_CONNCLEANUP_HXX
+
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/sdbc/XRowSetListener.hpp>
+#include <connectivity/dbtoolsdllapi.hxx>
+
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::sdbc { class XRowSet; }
+namespace com::sun::star::sdbc { class XConnection; }
+
+namespace dbtools
+{
+
+
+ //= OAutoConnectionDisposer
+
+ typedef ::cppu::WeakImplHelper < css::beans::XPropertyChangeListener,
+ css::sdbc::XRowSetListener
+ > OAutoConnectionDisposer_Base;
+
+ class OOO_DLLPUBLIC_DBTOOLS OAutoConnectionDisposer final : public OAutoConnectionDisposer_Base
+ {
+ css::uno::Reference< css::sdbc::XConnection >
+ m_xOriginalConnection;
+ css::uno::Reference< css::sdbc::XRowSet > m_xRowSet; // needed to add as listener
+ bool m_bRSListening : 1; // true when we're listening on rowset
+ bool m_bPropertyListening : 1; // true when we're listening for property changes
+
+ public:
+ /** constructs an object
+ <p>The connection given will be set on the rowset (as ActiveConnection), and the object adds itself as property
+ change listener for the connection. Once somebody sets a new ActiveConnection, the old one (the one given
+ here) will be disposed.</p>
+ */
+ OAutoConnectionDisposer(
+ const css::uno::Reference< css::sdbc::XRowSet >& _rxRowSet,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
+ );
+
+ private:
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& _rEvent ) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& _rSource ) override;
+
+ // XRowSetListener
+ virtual void SAL_CALL cursorMoved( const css::lang::EventObject& event ) override;
+ virtual void SAL_CALL rowChanged( const css::lang::EventObject& event ) override;
+ virtual void SAL_CALL rowSetChanged( const css::lang::EventObject& event ) override;
+
+ void clearConnection();
+
+ void startRowSetListening();
+ void stopRowSetListening();
+ bool isRowSetListening() const { return m_bRSListening; }
+
+ void startPropertyListening( const css::uno::Reference< css::beans::XPropertySet >& _rxProps );
+ void stopPropertyListening( const css::uno::Reference< css::beans::XPropertySet >& _rxEventSource );
+ };
+
+
+} // namespace dbtools
+
+
+#endif // INCLUDED_CONNECTIVITY_CONNCLEANUP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbcharset.hxx b/include/connectivity/dbcharset.hxx
new file mode 100644
index 000000000..3ee993243
--- /dev/null
+++ b/include/connectivity/dbcharset.hxx
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_DBCHARSET_HXX
+#define INCLUDED_CONNECTIVITY_DBCHARSET_HXX
+
+#include <sal/config.h>
+
+#include <set>
+
+#include <rtl/textenc.h>
+#include <rtl/tencinfo.h>
+#include <rtl/ustring.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+
+
+namespace dbtools
+{
+
+
+ //= OCharsetMap
+
+ /** is a class which translates between different charset representations.
+
+ <p>The set of recognized charsets is very limited: only the ones which are database relevant are
+ implemented at the moment</p>
+
+ <p>Possible representations are:
+ <ul>
+ <li><b>IANA names.</b>
+ Have a look at <A href="http://www.iana.org/assignments/character-sets">this document</A> for
+ more details</li>
+ <li><b>rtl_TextEncoding</b></li>
+ </ul>
+ </p>
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OCharsetMap
+ {
+ protected:
+ typedef std::set<rtl_TextEncoding> TextEncBag;
+
+ TextEncBag m_aEncodings;
+
+ public:
+ class CharsetIterator;
+ friend class OCharsetMap::CharsetIterator;
+ typedef CharsetIterator iterator;
+ typedef CharsetIterator const_iterator;
+
+ OCharsetMap();
+ virtual ~OCharsetMap();
+
+ /** find the given text encoding in the map.
+ @return the <em>end</em> iterator if the encoding could not be found.
+ */
+ CharsetIterator find(const rtl_TextEncoding _eEncoding) const;
+ /** find the given IANA name in the map.
+ @return the <em>end</em> iterator if the IANA name could not be found.
+ */
+ CharsetIterator findIanaName(const OUString& _rIanaName) const;
+
+ /// get access to the first element of the charset collection
+ CharsetIterator begin() const;
+ /// get access to the (last + 1st) element of the charset collection
+ CharsetIterator end() const;
+
+ protected:
+ // needed because we want to call a virtual method during construction
+ void lateConstruct();
+ void ensureConstructed( ) const { if ( m_aEncodings.empty() ) const_cast< OCharsetMap* >( this )->lateConstruct(); }
+
+ virtual bool approveEncoding( const rtl_TextEncoding _eEncoding, const rtl_TextEncodingInfo& _rInfo ) const;
+ };
+
+
+ //- CharsetIteratorDerefHelper
+
+ class OOO_DLLPUBLIC_DBTOOLS CharsetIteratorDerefHelper
+ {
+ friend class OCharsetMap::CharsetIterator;
+
+ rtl_TextEncoding m_eEncoding;
+ OUString m_aIanaName;
+
+ public:
+ CharsetIteratorDerefHelper(const CharsetIteratorDerefHelper& _rSource);
+
+ rtl_TextEncoding getEncoding() const { return m_eEncoding; }
+ const OUString& getIanaName() const { return m_aIanaName; }
+
+ protected:
+ CharsetIteratorDerefHelper( const rtl_TextEncoding _eEncoding, const OUString& _rIanaName );
+
+ };
+
+
+ //- OCharsetMap::CharsetIterator
+
+ class OOO_DLLPUBLIC_DBTOOLS OCharsetMap::CharsetIterator
+ {
+ friend class OCharsetMap;
+
+ friend OOO_DLLPUBLIC_DBTOOLS bool operator==(const CharsetIterator& lhs, const CharsetIterator& rhs);
+ friend bool operator!=(const CharsetIterator& lhs, const CharsetIterator& rhs) { return !(lhs == rhs); }
+
+// friend sal_Int32 operator-(const CharsetIterator& lhs, const CharsetIterator& rhs);
+
+ const OCharsetMap* m_pContainer;
+ OCharsetMap::TextEncBag::const_iterator m_aPos;
+
+ public:
+ CharsetIteratorDerefHelper operator*() const;
+ // no -> operator
+ // this would require us to a) store CharsetIteratorDerefHelper instances ourself so that we
+ // can return a pointer or b) introduce a -> operator on the CharsetIteratorDerefHelper, too.
+
+ /// prefix increment
+ const CharsetIterator& operator++();
+
+ /// prefix decrement
+ const CharsetIterator& operator--();
+
+ protected:
+ CharsetIterator(const OCharsetMap* _pContainer, OCharsetMap::TextEncBag::const_iterator const & _aPos );
+ };
+
+
+} // namespace dbtools
+
+
+#endif // INCLUDED_CONNECTIVITY_DBCHARSET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbconversion.hxx b/include/connectivity/dbconversion.hxx
new file mode 100644
index 000000000..e9471344c
--- /dev/null
+++ b/include/connectivity/dbconversion.hxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_DBCONVERSION_HXX
+#define INCLUDED_CONNECTIVITY_DBCONVERSION_HXX
+
+#include <com/sun/star/util/Date.hpp>
+#include <connectivity/dbtoolsdllapi.hxx>
+
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+namespace com::sun::star
+{
+ namespace lang
+ {
+ struct Locale;
+ }
+ namespace sdb
+ {
+ class XColumn;
+ class XColumnUpdate;
+ }
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ class XNumberFormatsSupplier;
+ struct Time;
+ struct DateTime;
+ }
+ namespace script
+ {
+ class XTypeConverter;
+ }
+}
+
+namespace dbtools::DBTypeConversion
+{
+ OOO_DLLPUBLIC_DBTOOLS css::util::Date const & getStandardDate();
+ /// @throws css::lang::IllegalArgumentException
+ OOO_DLLPUBLIC_DBTOOLS void setValue(const css::uno::Reference< css::sdb::XColumnUpdate>& xVariant,
+ const css::uno::Reference< css::util::XNumberFormatter>& xFormatter,
+ const css::util::Date& rNullDate,
+ const OUString& rString,
+ sal_Int32 nKey,
+ sal_Int16 nFieldType,
+ sal_Int16 nKeyType);
+
+ /// @throws css::lang::IllegalArgumentException
+ OOO_DLLPUBLIC_DBTOOLS void setValue(const css::uno::Reference< css::sdb::XColumnUpdate>& xVariant,
+ const css::util::Date& rNullDate,
+ const double& rValue,
+ sal_Int16 nKeyType);
+
+ OOO_DLLPUBLIC_DBTOOLS double getValue( const css::uno::Reference< css::sdb::XColumn>& xVariant, const css::util::Date& rNullDate );
+
+ // get the columnvalue as string with a default format given by the column or a default format
+ // for the type
+ OOO_DLLPUBLIC_DBTOOLS OUString getFormattedValue(
+ const css::uno::Reference< css::beans::XPropertySet>& _xColumn,
+ const css::uno::Reference< css::util::XNumberFormatter>& xFormatter,
+ const css::lang::Locale& _rLocale,
+ const css::util::Date& rNullDate);
+
+ OOO_DLLPUBLIC_DBTOOLS OUString getFormattedValue(
+ const css::uno::Reference< css::sdb::XColumn>& _xColumn,
+ const css::uno::Reference< css::util::XNumberFormatter>& xFormatter,
+ const css::util::Date& rNullDate,
+ sal_Int32 nKey,
+ sal_Int16 nKeyType);
+
+ OOO_DLLPUBLIC_DBTOOLS css::util::Date toDate(double dVal, const css::util::Date& _rNullDate = getStandardDate());
+ OOO_DLLPUBLIC_DBTOOLS css::util::Date toDate(std::u16string_view _sSQLDate);
+ OOO_DLLPUBLIC_DBTOOLS css::util::Time toTime(double dVal, short nDigits = 9);
+ OOO_DLLPUBLIC_DBTOOLS css::util::Time toTime(std::u16string_view _sSQLDate);
+ OOO_DLLPUBLIC_DBTOOLS css::util::DateTime toDateTime(double dVal, const css::util::Date& _rNullDate = getStandardDate());
+ OOO_DLLPUBLIC_DBTOOLS css::util::DateTime toDateTime(const OUString& _sSQLDate);
+
+ OOO_DLLPUBLIC_DBTOOLS sal_Int64 getNsFromTime(const css::util::Time& rVal);
+
+ OOO_DLLPUBLIC_DBTOOLS sal_Int32 toDays(const css::util::Date& _rVal, const css::util::Date& _rNullDate = getStandardDate());
+
+ OOO_DLLPUBLIC_DBTOOLS double toDouble(const css::util::Date& rVal, const css::util::Date& _rNullDate = getStandardDate());
+ OOO_DLLPUBLIC_DBTOOLS double toDouble(const css::util::Time& rVal);
+ OOO_DLLPUBLIC_DBTOOLS double toDouble(const css::util::DateTime& rVal, const css::util::Date& _rNullDate = getStandardDate());
+
+ OOO_DLLPUBLIC_DBTOOLS css::util::Date toDate(sal_Int32 _nVal);
+ OOO_DLLPUBLIC_DBTOOLS css::util::Time toTime(sal_Int64 _nVal);
+
+ /** convert a double which is a date value relative to the standard db null date into a date value relative
+ to a given fixed date.
+ */
+ inline double toNullDate(const css::util::Date& _rNullDate, double _rVal) { return _rVal - toDays(_rNullDate); }
+
+ // return the date from the numberformatsupplier or the STANDARD_DATE (1900,1,1)
+ OOO_DLLPUBLIC_DBTOOLS css::util::Date getNULLDate(const css::uno::Reference< css::util::XNumberFormatsSupplier > &xSupplier);
+
+ // return the date in the format %04d-%02d-%02d
+ OOO_DLLPUBLIC_DBTOOLS OUString toDateString(const css::util::Date& rDate);
+ // return the time in the format %02d:%02d:%02d
+ OOO_DLLPUBLIC_DBTOOLS OUString toTimeStringS(const css::util::Time& rTime);
+ // return the time in the format %02d:%02d:%02d.%09d
+ OOO_DLLPUBLIC_DBTOOLS OUString toTimeString(const css::util::Time& rTime);
+ // return the DateTime in the format %04d-%02d-%02d %02d:%02d:%02d.%09d
+ OOO_DLLPUBLIC_DBTOOLS OUString toDateTimeString(const css::util::DateTime& _rDateTime);
+ // return the any in an sql standard format
+ OOO_DLLPUBLIC_DBTOOLS OUString toSQLString(sal_Int32 eType, const css::uno::Any& _rVal,
+ const css::uno::Reference< css::script::XTypeConverter >& _rxTypeConverter);
+
+ /** converts a Unicode string into a 8-bit string, using the given encoding
+
+ @param _rSource
+ the source string to convert
+ @param _rDest
+ the destination string
+ @param _eEncoding
+ the encoding to use for the conversion
+
+ @throws css::sdbc::SQLException
+ if the given string contains characters which are not convertible using the given encoding
+ The SQLState of the exception will be set to 22018 ("Invalid character value for cast specification")
+
+ @return
+ the length of the converted string
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Int32 convertUnicodeString(
+ const OUString& _rSource,
+ OString& _rDest,
+ rtl_TextEncoding _eEncoding
+ );
+
+ /** converts a Unicode string into a 8-bit string, using the given encoding
+
+ @param _rSource
+ the source string to convert
+
+ @param _rDest
+ the destination string
+
+ @param _nMaxLen
+ the maximum length of the destination string
+
+ @param _eEncoding
+ the encoding to use for the conversion
+
+ @throws css::sdbc::SQLException
+ if convertUnicodeString, which is called internally, throws such an exception
+
+ @throws css::sdbc::SQLException
+ if the conversion results in a string which is longer than _nMaxLen
+
+ @return
+ the length of the converted string
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Int32 convertUnicodeStringToLength(
+ const OUString& _rSource,
+ OString& _rDest,
+ sal_Int32 _nMaxLen,
+ rtl_TextEncoding _eEncoding
+ );
+
+} // namespace dbtools::DBTypeConversion
+
+#endif // INCLUDED_CONNECTIVITY_DBCONVERSION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbexception.hxx b/include/connectivity/dbexception.hxx
new file mode 100644
index 000000000..8c9dfad33
--- /dev/null
+++ b/include/connectivity/dbexception.hxx
@@ -0,0 +1,332 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_DBEXCEPTION_HXX
+#define INCLUDED_CONNECTIVITY_DBEXCEPTION_HXX
+
+#include <connectivity/standardsqlstate.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star
+{
+ namespace sdb
+ {
+ class SQLContext;
+ struct SQLErrorEvent;
+ }
+ namespace sdbc
+ {
+ class SQLWarning;
+ class SQLException;
+ }
+}
+
+namespace dbtools
+{
+
+
+//= Special exception if cancel is pressed in DBA UI
+
+enum OOoBaseErrorCode
+{
+ ParameterInteractionCancelled = 1
+};
+
+
+//= SQLExceptionInfo - encapsulating the type info of an SQLException-derived class
+
+
+class OOO_DLLPUBLIC_DBTOOLS SQLExceptionInfo final
+{
+public:
+ enum class TYPE { SQLException, SQLWarning, SQLContext, Undefined };
+
+private:
+ css::uno::Any m_aContent;
+ TYPE m_eType; // redundant (could be derived from m_aContent.getValueType())
+
+public:
+ SQLExceptionInfo();
+ SQLExceptionInfo(const css::sdbc::SQLException& _rError);
+ SQLExceptionInfo(const css::sdbc::SQLWarning& _rError);
+ SQLExceptionInfo(const css::sdb::SQLContext& _rError);
+
+ /** convenience constructor
+
+ If your error processing relies on SQLExceptions, and SQLExceptionInfos, you still may
+ need to display an error which consists of a simple message string only.
+ In those cases, you can use this constructor, which behaves as if you would have used
+ an SQLException containing exactly the given error message.
+ */
+ SQLExceptionInfo( const OUString& _rSimpleErrorMessage );
+
+ // use for events got via XSQLErrorListener::errorOccured
+ SQLExceptionInfo(const css::uno::Any& _rError);
+ // use with the Reason member of an SQLErrorEvent or with NextElement of an SQLException
+
+ /** prepends a plain error message to the chain of exceptions
+ @param _rSimpleErrorMessage
+ the error message to prepend
+ */
+ void prepend( const OUString& _rErrorMessage );
+
+ /** appends a plain message to the chain of exceptions
+ @param _eType
+ the type of exception to append. Must be SQL_EXCEPTION, SQL_WARNING, SQL_CONTEXT, for all other
+ values, the behavior is undefined.
+ @param _rErrorMessage
+ the message to append
+ @param _rSQLState
+ the SQLState of the exception to append
+ @param _nErrorCode
+ the error code of the exception to append
+ */
+ void append( TYPE _eType, const OUString& _rErrorMessage, const OUString& _rSQLState = OUString(), const sal_Int32 _nErrorCode = 0 );
+
+ /** throws (properly typed) the exception contained in the object
+ @precond
+ isValid() returns <TRUE/>
+ @throws SQLException
+ @throws RuntimeException
+ if the instance does not contain an SQLException
+ */
+ void doThrow();
+
+ SQLExceptionInfo& operator=(const css::sdbc::SQLException& _rError);
+ SQLExceptionInfo& operator=(const css::sdbc::SQLWarning& _rError);
+ SQLExceptionInfo& operator=(const css::sdb::SQLContext& _rError);
+ SQLExceptionInfo& operator=(const css::sdb::SQLErrorEvent& _rErrorEvent);
+ SQLExceptionInfo& operator=(const css::uno::Any& _rCaughtSQLException);
+
+ bool isKindOf(TYPE _eType) const;
+ // not just a simple comparison ! e.g. getType() == SQL_CONTEXT implies isKindOf(SQL_EXCEPTION) == sal_True !
+ bool isValid() const { return m_eType != TYPE::Undefined; }
+ TYPE getType() const { return m_eType; }
+
+ operator const css::sdbc::SQLException* () const;
+ operator const css::sdb::SQLContext* () const;
+
+ const css::uno::Any& get() const { return m_aContent; }
+
+ void clear()
+ {
+ m_aContent.clear();
+ m_eType = TYPE::Undefined;
+ }
+
+ // create an exception
+ static css::uno::Any createException(TYPE eType, const OUString& rErrorMessage, const OUString& rSQLState, const sal_Int32 nErrorCode);
+
+ // find the end of the exception chain
+ static css::sdbc::SQLException* getLastException(css::sdbc::SQLException* pLastException);
+
+private:
+ void implDetermineType();
+};
+
+
+//= SQLExceptionIteratorHelper - iterating through an SQLException chain
+
+
+class OOO_DLLPUBLIC_DBTOOLS SQLExceptionIteratorHelper final
+{
+ const css::sdbc::SQLException* m_pCurrent;
+ SQLExceptionInfo::TYPE m_eCurrentType;
+
+public:
+ /** constructs an iterator instance from an SQLException
+
+ @param _rChainStart
+ the start of the exception chain to iterate. Must live as long as the iterator
+ instances lives, at least.
+ */
+ SQLExceptionIteratorHelper( const css::sdbc::SQLException& _rChainStart );
+
+ /** constructs an iterator instance from an SQLExceptionInfo
+
+ @param _rErrorInfo
+ the start of the exception chain to iterate. Must live as long as the iterator
+ instances lives, at least.
+ */
+ SQLExceptionIteratorHelper( const SQLExceptionInfo& _rErrorInfo );
+
+ /** determines whether there are more elements in the exception chain
+ */
+ bool hasMoreElements() const { return ( m_pCurrent != nullptr ); }
+
+ /** retrieves the current element in the chain, or <NULL/> if the chain has been completely
+ traveled.
+
+ In opposite to the second <member>current</member>, this version allows typed access to
+ the respective SQLException.
+ */
+ void current( SQLExceptionInfo& _out_rInfo ) const;
+
+ /** proceeds to the next element in the chain
+
+ @return the current element in the chain, as <b>before</em> the chain move.
+ */
+ const css::sdbc::SQLException* next();
+
+ /** proceeds to the next element in the chain
+
+ In opposite to the second <member>current</member>, this version allows typed access to
+ the respective SQLException.
+ */
+ void next( SQLExceptionInfo& _out_rInfo );
+};
+
+
+//= StandardExceptions
+
+
+/** returns a standard error string for a given SQLState
+
+ @param _eState
+ describes the state whose description is to retrieve. Must not be SQL_ERROR_UNSPECIFIED.
+ @throws RuntimeException
+ in case of an internal error
+*/
+OOO_DLLPUBLIC_DBTOOLS OUString getStandardSQLState( StandardSQLState _eState );
+
+
+/** throws an exception with SQL state IM001, saying that a certain function is not supported
+
+ @throws css::sdbc::SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionNotSupportedSQLException(
+ const OUString& _rFunctionName,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext
+ );
+
+/// @throws css::uno::RuntimeException
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionNotSupportedRuntimeException(
+ const OUString& _rFunctionName,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext
+ );
+
+/** throws a function sequence (HY010) exception
+
+ @throws css::sdbc::SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionSequenceException(
+ const css::uno::Reference< css::uno::XInterface >& Context,
+ const css::uno::Any& Next = css::uno::Any()
+ );
+
+
+/** throw an invalid index sqlexception
+
+ @throws css::sdbc::SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwInvalidIndexException(
+ const css::uno::Reference< css::uno::XInterface >& Context,
+ const css::uno::Any& Next = css::uno::Any()
+ );
+
+
+/** throw a generic SQLException, i.e. one with an SQLState of HY000, an ErrorCode of 0 and no NextException
+
+ @throws css::sdbc::SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwGenericSQLException(
+ const OUString& _rMsg,
+ const css::uno::Reference< css::uno::XInterface >& _rxSource
+ );
+
+
+/** throw a generic SQLException, i.e. one with an SQLState of HY000, an ErrorCode of 0 and no NextException
+
+ @throws css::sdbc::SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwGenericSQLException(
+ const OUString& _rMsg,
+ const css::uno::Reference< css::uno::XInterface >& _rxSource,
+ const css::uno::Any& _rNextException
+ );
+
+
+/** throw a SQLException with SQLState HYC00 (Optional feature not implemented)
+ @param _rFeatureName
+ a description of the feature which is not implemented. It's recommended that the feature
+ name is built from the name of the interface plus its method, for instance "XParameters::updateBinaryStream"
+ @param _rxContext
+ the context of the exception
+ @throws css::sdbc::SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFeatureNotImplementedSQLException(
+ const OUString& _rFeatureName,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext,
+ const css::uno::Any& _rNextException = css::uno::Any()
+ );
+
+/** throw a RuntimeException (Optional feature not implemented)
+ @param _rFeatureName
+ a description of the feature which is not implemented. It's recommended that the feature
+ name is built from the name of the interface plus its method, for instance "XParameters::updateBinaryStream"
+ @param _rxContext
+ the context of the exception
+ @throws css::uno::RuntimeException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFeatureNotImplementedRuntimeException(
+ const OUString& _rFeatureName,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext
+ );
+
+/** throw a SQLException with SQLState 42S22 (Column Not Found)
+ @param _rColumnNameName
+ The column that couldn't be found.
+ @param _rxContext
+ the context of the exception
+ @throws css::sdbc::SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwInvalidColumnException(
+ const OUString& _rColumnName,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext
+ );
+
+
+/** @throws css::sdbc::SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwSQLException(
+ const OUString& _rMessage,
+ const OUString& _rSQLState,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext,
+ const sal_Int32 _nErrorCode
+ );
+
+
+/** @throws css::sdbc::SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwSQLException(
+ const OUString& _rMessage,
+ StandardSQLState _eSQLState,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext,
+ const sal_Int32 _nErrorCode = 0
+ );
+
+
+} // namespace dbtools
+
+
+#endif // INCLUDED_CONNECTIVITY_DBEXCEPTION_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbmetadata.hxx b/include/connectivity/dbmetadata.hxx
new file mode 100644
index 000000000..17a392dfe
--- /dev/null
+++ b/include/connectivity/dbmetadata.hxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_DBMETADATA_HXX
+#define INCLUDED_CONNECTIVITY_DBMETADATA_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <memory>
+#include <connectivity/dbtoolsdllapi.hxx>
+
+namespace com::sun::star::sdbc { class XConnection; }
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace dbtools
+{
+
+
+ //= DatabaseMetaData
+
+ struct DatabaseMetaData_Impl;
+ /** encapsulates meta data about a database/connection which cannot be obtained
+ from the usual XDatabaseMetaData result set.
+
+ Meta data perhaps isn't really the right term ... Some of the methods
+ in this class involved heuristics, some are just a convenient wrapper
+ around more complex ways to obtain the same information.
+
+ @todo
+ Once CWS dba30 is integrated, we could easily add all the meta data
+ which is part of the "Info" property of a data source.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS DatabaseMetaData
+ {
+ private:
+ ::std::unique_ptr< DatabaseMetaData_Impl > m_pImpl;
+
+ public:
+ DatabaseMetaData();
+ /** constructs a DatabaseMetaData instance
+ @param _rxConnection
+ is the connection whose meta data you're interested in.
+ Note that some of the information provided by this class can only be obtained
+ if this connection denotes an application-level connection, i.e. supports
+ the com.sun.star.sdb.Connection service.
+
+ @throws css::lang::IllegalArgumentException
+ if the given connection is not <NULL/>, but the XDatabaseMetaData provided by it
+ are <NULL/>
+ @throws css::sdbc::SQLException
+ if obtaining the meta data from the connection throws an SQLException
+ @throws css::uno::RuntimeException
+ if obtaining the meta data from the connection throws a RuntimeException
+ */
+ DatabaseMetaData(
+ const css::uno::Reference< css::sdbc::XConnection >& _connection );
+ DatabaseMetaData( const DatabaseMetaData& _copyFrom );
+ DatabaseMetaData& operator=( const DatabaseMetaData& _copyFrom );
+ DatabaseMetaData(DatabaseMetaData&& _copyFrom) noexcept;
+ DatabaseMetaData& operator=(DatabaseMetaData&& _copyFrom) noexcept;
+
+ ~DatabaseMetaData();
+
+ public:
+ /** determines whether or not the instances is based on a valid connection
+
+ As long as this method returns true<TRUE/>, you should expect all other
+ methods throwing an SQLException when called.
+ */
+ bool isConnected() const;
+
+ /** resets the instance so that it's based on a new connection
+ */
+ void reset( const css::uno::Reference< css::sdbc::XConnection >& _connection )
+ {
+ *this = DatabaseMetaData( _connection );
+ }
+
+ /// wraps XDatabaseMetaData::getIdentifierQuoteString
+ const OUString& getIdentifierQuoteString() const;
+
+ /// wraps XDatabaseMetaData::getCatalogSeparator
+ const OUString& getCatalogSeparator() const;
+
+ /** determines whether the database supports sub queries in the FROM part
+ of a SELECT clause are supported.
+ @throws css::sdbc::SQLException
+ with SQLState 08003 (connection does not exist) if the instances was
+ default-constructed and does not have a connection, yet.
+ */
+ bool supportsSubqueriesInFrom() const;
+
+ /** checks whether the database supports primary keys
+
+ Since there's no dedicated API to ask a database for this, a heuristics needs to be applied.
+ First, the <code>PrimaryKeySupport<code> settings of the data source is examined. If it is <TRUE/>
+ or <FALSE/>, then value is returned. If it is <NULL/>, then the database meta data are examined
+ for support of core SQL grammar, and the result is returned. The assumption is that a database/driver
+ which supports core SQL grammar usually also supports primary keys, and vice versa. At least, experience
+ shows this is true most of the time.
+ */
+ bool supportsPrimaryKeys() const;
+
+ /** determines whether names in the database should be restricted to SQL-92 identifiers
+
+ Effectively, this method checks the EnableSQL92Check property of the data source settings,
+ if present.
+ */
+ bool restrictIdentifiersToSQL92() const;
+
+ /** determines whether when generating SQL statements, an AS keyword should be generated
+ before a correlation name.
+
+ E.g., it determines whether <code>SELECT * FROM table AS correlation_name</code> or
+ <code>SELECT * FROM table correlation_name</code> is generated.
+ */
+ bool generateASBeforeCorrelationName() const;
+
+ /** should date time be escaped like '2001-01-01' => {D '2001-01-01' }
+ */
+ bool shouldEscapeDateTime() const;
+
+ /** should named parameters (:foo, [foo]) be replaced by unnamed parameters (?)
+ */
+ bool shouldSubstituteParameterNames() const;
+
+ /** auto increment columns should be automatically used as primary key.
+ */
+ bool isAutoIncrementPrimaryKey() const;
+
+ /** determines the syntax to use for boolean comparison predicates
+
+ @see css::sdb::BooleanComparisonMode
+ */
+ sal_Int32
+ getBooleanComparisonMode() const;
+
+ /** determines in relations are supported.
+ *
+ * \return <TRUE/> when relations are supported, otherwise <FALSE/>
+ */
+ bool supportsRelations() const;
+
+ /** determines if column alias names can be used in the order by clause.
+ *
+ * \return <TRUE/> when relations are supported, otherwise <FALSE/>
+ */
+ bool supportsColumnAliasInOrderBy() const;
+
+ /** determines whether user administration is supported for the database
+
+ User administration support is controlled by the availability of the XUsersSupplier
+ interface, and it returning a non-NULL users container.
+
+ @param _rContext
+ the component context we operate in. Might be needed to create the
+ css.sdbc.DriverManager instance.
+ */
+ bool supportsUserAdministration( const css::uno::Reference<css::uno::XComponentContext>& _rContext ) const;
+
+ /** determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed
+ */
+ bool displayEmptyTableFolders() const;
+
+ /** determines that threads are supported.
+ *
+ * \return <TRUE/> when threads are supported, otherwise <FALSE/>
+ */
+ bool supportsThreads() const;
+ };
+
+
+} // namespace dbtools
+
+
+#endif // INCLUDED_CONNECTIVITY_DBMETADATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbtools.hxx b/include/connectivity/dbtools.hxx
new file mode 100644
index 000000000..58f34f170
--- /dev/null
+++ b/include/connectivity/dbtools.hxx
@@ -0,0 +1,867 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_DBTOOLS_HXX
+#define INCLUDED_CONNECTIVITY_DBTOOLS_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <connectivity/dbexception.hxx>
+#include <comphelper/stl_types.hxx>
+#include <unotools/sharedunocomponent.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <connectivity/FValue.hxx>
+
+namespace com::sun::star {
+
+namespace sdb {
+ class XSingleSelectQueryComposer;
+}
+namespace sdbcx {
+ class XTablesSupplier;
+}
+namespace sdbc {
+ class XConnection;
+ class XDatabaseMetaData;
+ class XRowSet;
+ class XDataSource;
+ class SQLException;
+ class XParameters;
+ class XRowUpdate;
+}
+namespace beans {
+ class XPropertySet;
+}
+namespace awt {
+ class XWindow;
+}
+namespace lang {
+ struct Locale;
+}
+namespace container {
+ class XNameAccess;
+}
+namespace uno {
+ class XComponentContext;
+}
+namespace util {
+ class XNumberFormatTypes;
+ class XNumberFormatsSupplier;
+}
+namespace task {
+ class XInteractionHandler;
+}
+
+}
+
+class SvStream;
+
+namespace dbtools
+{
+ class ISQLStatementHelper;
+ typedef ::utl::SharedUNOComponent< css::sdbc::XConnection > SharedConnection;
+
+ enum class EComposeRule
+ {
+ InTableDefinitions,
+ InIndexDefinitions,
+ InDataManipulation,
+ InProcedureCalls,
+ InPrivilegeDefinitions,
+ Complete
+ };
+
+ // date conversion
+
+ // calculates the default numberformat for a given datatype and a give language
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getDefaultNumberFormat(const css::uno::Reference< css::beans::XPropertySet >& _xColumn,
+ const css::uno::Reference< css::util::XNumberFormatTypes >& _xTypes,
+ const css::lang::Locale& _rLocale);
+
+ // calculates the default numberformat for a given datatype and a give language
+ // @param _nDataType @see com.sun.star.sdbc.DataType
+ // @param _nScale can be zero
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getDefaultNumberFormat(sal_Int32 _nDataType,
+ sal_Int32 _nScale,
+ bool _bIsCurrency,
+ const css::uno::Reference< css::util::XNumberFormatTypes >& _xTypes,
+ const css::lang::Locale& _rLocale);
+
+
+ /** creates a connection which can be used for the rowset given
+
+ The function tries to obtain a connection for the row set with the following
+ steps (in this order):
+ <nl>
+ <li>If the rowset already has an ActiveConnection (means a non-<NULL/> value for this property),
+ this one is used.</li>
+ <li>If row set is part of a database form document (see ->isEmbeddedInDatabase),
+ a connection for the respective database is used.</li>
+ <li>If in the parent hierarchy of the row set, there is an object supporting
+ the XConnection interface, this one is returned.</li>
+ <li>If the DataSourceName property of the row set is not empty, a connection for this
+ data source is retrieved.</li>
+ <li>If the URL property of the row set is not empty, a connection for this URL is
+ retrieved from the driver manager.
+ </nl>
+
+ The calculated connection is set as ActiveConnection property on the rowset.
+
+ If the connection was newly created by the method, then
+ the ownership of the connection is delivered to a temporary object, which observes the
+ row set: As soon as a connection-relevant property of the row set changes, or as soon
+ as somebody else sets another ActiveConnection at the row set, the original
+ connection (the one which this function calculated) is disposed and discarded. At this
+ very moment, also the temporary observer object dies. This way, it is ensured that
+ there's no resource leak from an un-owned connection object.
+
+ @param _rxRowSet
+ the row set
+
+ @param _rxFactory
+ a service factory, which can be used to create data sources, interaction handler etc (the usual stuff)
+
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ css::uno::Reference< css::sdbc::XConnection> connectRowset(
+ const css::uno::Reference< css::sdbc::XRowSet>& _rxRowSet,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext,
+ const css::uno::Reference< css::awt::XWindow>& _rxParent
+ );
+
+ /** ensures that a row set has a valid ActiveConnection, if possible
+
+ This function does nearly the same as ->connectRowset. In fact, it is to be preferred over
+ ->connectRowset, if possible.
+
+ There are a few differences:
+ <ul><li>If a connection could be determined for the given RowSet, it is always
+ set as ActiveConnection.</li>
+ <li>Definition of the ownership of the created connection allows for more scenarios:
+ <ul><li>If the connection was not newly created, the returned ->SharedConnection
+ instance will not have the ownership, since in this case it's assumed
+ that there already is an instance which has the ownership.</li>
+ <li>If the connection was newly created, then the returned SharedConnection
+ instance will have the ownership of the XConnection.</li>
+ </ul>
+ </li>
+ </ul>
+ */
+ OOO_DLLPUBLIC_DBTOOLS SharedConnection ensureRowSetConnection(
+ const css::uno::Reference< css::sdbc::XRowSet>& _rxRowSet,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext,
+ const css::uno::Reference< css::awt::XWindow>& _rxParent
+ );
+
+ /** returns the connection the RowSet is currently working with (which is the ActiveConnection property)
+
+ @throws css::uno::RuntimeException
+ */
+ OOO_DLLPUBLIC_DBTOOLS css::uno::Reference< css::sdbc::XConnection> getConnection(const css::uno::Reference< css::sdbc::XRowSet>& _rxRowSet);
+ OOO_DLLPUBLIC_DBTOOLS css::uno::Reference< css::sdbc::XConnection> getConnection_withFeedback(
+ const OUString& _rDataSourceName,
+ const OUString& _rUser,
+ const OUString& _rPwd,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext,
+ const css::uno::Reference< css::awt::XWindow>& _rxParent);
+
+
+ /** determines whether the given component is part of a document which is an embedded database
+ document (such as a form)
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool isEmbeddedInDatabase(
+ const css::uno::Reference< css::uno::XInterface >& _rxComponent,
+ css::uno::Reference< css::sdbc::XConnection >& _rxActualConnection
+ );
+
+ /** returns the columns of the named table of the given connection
+ */
+ OOO_DLLPUBLIC_DBTOOLS css::uno::Reference< css::container::XNameAccess> getTableFields(
+ const css::uno::Reference< css::sdbc::XConnection>& _rxConn,
+ const OUString& _rName
+ );
+
+ /** returns the primary key columns of the table
+ */
+ OOO_DLLPUBLIC_DBTOOLS css::uno::Reference< css::container::XNameAccess> getPrimaryKeyColumns_throw(
+ const css::uno::Any& i_aTable
+ );
+ OOO_DLLPUBLIC_DBTOOLS css::uno::Reference< css::container::XNameAccess> getPrimaryKeyColumns_throw(
+ const css::uno::Reference< css::beans::XPropertySet >& i_xTable
+ );
+
+ /** get fields for a result set given by a "command descriptor"
+
+ <p>A command descriptor here means:
+ <ul><li>a SDB-level connection (com.sun.star.sdb::Connection</li>
+ <li>a string specifying the name of an object relative to the connection</li>
+ <li>a com.sun.star.sdb::CommandType value specifying the type
+ of the object</type></li>
+ </ul>
+ </p>
+
+ @param _rxConnection
+ the connection relative to which the to-be-examined object exists
+
+ @param _nCommandType
+ the type of the object
+
+ @param _rCommand
+ the object. This may be a table name, a query name, or an SQL statement, depending on the value
+ of <arg>_nCommandType</arg>
+
+ @param _rxCollectionOner
+ If (and only if) <arg>CommandType</arg> is CommandType.COMMAND, the fields collection which is returned
+ by this function here is a temporary object. It is kept alive by another object, which is to be
+ created temporarily, too. To ensure that the fields you get are valid as long as you need them,
+ the owner which controls their life time is transferred to this parameter upon return.<br/>
+
+ Your fields live as long as this component lives.<br/>
+
+ Additionally, you are encouraged to dispose this component as soon as you don't need the fields anymore.
+ It depends on the connection's implementation if this is necessary, but the is no guarantee, so to
+ be on the safe side with respect to resource leaks, you should dispose the component.
+
+ @param _pErrorInfo
+ If not <NULL/>, then upon return from the function the instance pointed to by this argument will
+ contain any available error information in case something went wrong.
+
+ @return
+ the container of the columns (aka fields) of the object
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ css::uno::Reference< css::container::XNameAccess >
+ getFieldsByCommandDescriptor(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ css::uno::Reference< css::lang::XComponent >& _rxKeepFieldsAlive,
+ SQLExceptionInfo* _pErrorInfo = nullptr
+ );
+
+
+ /** get fields for a result set given by a "command descriptor"
+
+ <p>A command descriptor here means:
+ <ul><li>a SDB-level connection (com.sun.star.sdb::Connection</li>
+ <li>a string specifying the name of an object relative to the connection</li>
+ <li>a com.sun.star.sdb::CommandType value specifying the type
+ of the object</type></li>
+ </ul>
+ </p>
+
+ @param _rxConnection
+ the connection relative to which the to-be-examined object exists
+
+ @param _nCommandType
+ the type of the object
+
+ @param _rCommand
+ the object. This may be a table name, a query name, or an SQL statement, depending on the value
+ of <arg>_nCommandType</arg>
+
+ @param _pErrorInfo
+ If not <NULL/>, then upon return from the function the instance pointed to by this argument will
+ contain any available error information in case something went wrong.
+
+ @return
+ an array of strings containing the names of the columns (aka fields) of the object
+ */
+ OOO_DLLPUBLIC_DBTOOLS css::uno::Sequence< OUString >
+ getFieldNamesByCommandDescriptor(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ SQLExceptionInfo* _pErrorInfo = nullptr
+ );
+
+
+ /** create a new css::sdbc::SQLContext, fill it with the given descriptions and the given source,
+ and <i>append</i> _rException (i.e. put it into the NextException member of the SQLContext).
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ css::sdbc::SQLException prependErrorInfo(
+ const css::sdbc::SQLException& _rChainedException,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext,
+ const OUString& _rAdditionalError,
+ const StandardSQLState _eSQLState = StandardSQLState::ERROR_UNSPECIFIED);
+
+ /** search the parent hierarchy for a data source.
+ */
+ OOO_DLLPUBLIC_DBTOOLS css::uno::Reference< css::sdbc::XDataSource> findDataSource(const css::uno::Reference< css::uno::XInterface >& _xParent);
+
+ /** determines the value of a boolean data source setting, given by ASCII name
+
+ @param _rxConnection
+ the connection belonging to the data source whose setting is to be retrieved
+ @param _pAsciiSettingName
+ the ASCII name of the setting
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool getBooleanDataSourceSetting(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const char* _pAsciiSettingName
+ );
+ OOO_DLLPUBLIC_DBTOOLS bool getBooleanDataSourceSetting(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const OUString& rSettingName
+ );
+
+ /** check if a specific property is enabled in the info sequence
+ @deprecated
+ Use getBooleanDataSourceSetting instead, which cares for the default of the property itself,
+ instead of spreading this knowledge through all callers.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ bool isDataSourcePropertyEnabled(const css::uno::Reference< css::uno::XInterface>& _xProp,
+ const OUString& _sProperty,
+ bool _bDefault);
+
+ /** retrieves a particular indirect data source setting
+
+ @param _rxDataSource
+ a data source component
+ @param _pAsciiSettingsName
+ the ASCII name of the setting to obtain
+ @param _rSettingsValue
+ the value of the setting, upon successful return
+
+ @return
+ <FALSE/> if the setting is not present in the <member scope="css::sdb">DataSource::Info</member>
+ member of the data source
+ <TRUE/> otherwise
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ bool getDataSourceSetting(
+ const css::uno::Reference< css::uno::XInterface >& _rxDataSource,
+ const char* _pAsciiSettingsName,
+ css::uno::Any& /* [out] */ _rSettingsValue
+ );
+ OOO_DLLPUBLIC_DBTOOLS
+ bool getDataSourceSetting(
+ const css::uno::Reference< css::uno::XInterface >& _rxDataSource,
+ const OUString& _sSettingsName,
+ css::uno::Any& /* [out] */ _rSettingsValue
+ );
+
+ OOO_DLLPUBLIC_DBTOOLS OUString getDefaultReportEngineServiceName(const css::uno::Reference< css::uno::XComponentContext>& _rxFactory);
+
+ /** quote the given name with the given quote string.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString quoteName(const OUString& _rQuote, const OUString& _rName);
+
+ /** quote the given table name (which may contain a catalog and a schema) according to the rules provided by the meta data
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString quoteTableName(const css::uno::Reference< css::sdbc::XDatabaseMetaData>& _rxMeta
+ , const OUString& _rName
+ ,EComposeRule _eComposeRule);
+
+ /** split a fully qualified table name (including catalog and schema, if applicable) into its component parts.
+ @param _rxConnMetaData meta data describing the connection where you got the table name from
+ @param _rQualifiedName fully qualified table name
+ @param _rCatalog (out parameter) upon return, contains the catalog name
+ @param _rSchema (out parameter) upon return, contains the schema name
+ @param _rName (out parameter) upon return, contains the table name
+ @param _eComposeRule where do you need the name for
+ */
+ OOO_DLLPUBLIC_DBTOOLS void qualifiedNameComponents(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxConnMetaData,
+ const OUString& _rQualifiedName, OUString& _rCatalog, OUString& _rSchema, OUString& _rName,EComposeRule _eComposeRule);
+
+ /** calculate a NumberFormatsSupplier for use with a given connection
+ @param _rxConn the connection for which the formatter is requested
+ @param _bAllowDefault if the connection (and related components, such as its parent) cannot supply
+ a formatter, we can ask the DatabaseEnvironment for a default one. This parameter
+ states if this is allowed.
+ @param _rxFactory required (only of _bAllowDefault is sal_True) for creating the DatabaseEnvironment.
+ @return the formatter all object related to the given connection should work with.
+ */
+ OOO_DLLPUBLIC_DBTOOLS css::uno::Reference< css::util::XNumberFormatsSupplier> getNumberFormats(
+ const css::uno::Reference< css::sdbc::XConnection>& _rxConn,
+ bool _bAllowDefault = false,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext = css::uno::Reference< css::uno::XComponentContext>()
+ );
+
+ /** create a css::sdb::XSingleSelectQueryComposer which represents
+ the current settings (Command/CommandType/Filter/Order) of the given rowset.
+
+ As such an instance can be obtained from a css::sdb::Connection
+ only the function searches for the connection the RowSet is using via connectRowset.
+ This implies that a connection will be set on the RowSet if needed.
+ (need to changes this sometimes ...)
+ */
+ OOO_DLLPUBLIC_DBTOOLS css::uno::Reference< css::sdb::XSingleSelectQueryComposer > getCurrentSettingsComposer(
+ const css::uno::Reference< css::beans::XPropertySet>& _rxRowSetProps,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext,
+ const css::uno::Reference< css::awt::XWindow>& _rxParent
+ );
+
+ /** transfer and translate properties between two FormComponents
+ @param _rxOld the source property set
+ @param _rxNew the destination property set
+ @param _rLocale the locale for converting number related properties
+ */
+ OOO_DLLPUBLIC_DBTOOLS void TransferFormComponentProperties(
+ const css::uno::Reference< css::beans::XPropertySet>& _rxOld,
+ const css::uno::Reference< css::beans::XPropertySet>& _rxNew,
+ const css::lang::Locale& _rLocale
+ );
+
+ /** check if the property "Privileges" supports css::sdbcx::Privilege::INSERT
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool canInsert(const css::uno::Reference< css::beans::XPropertySet>& _rxCursorSet);
+ /** check if the property "Privileges" supports css::sdbcx::Privilege::UPDATE
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool canUpdate(const css::uno::Reference< css::beans::XPropertySet>& _rxCursorSet);
+ /** check if the property "Privileges" supports css::sdbcx::Privilege::DELETE
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool canDelete(const css::uno::Reference< css::beans::XPropertySet>& _rxCursorSet);
+
+
+ /** compose a complete table name from its up to three parts, regarding to the database meta data composing rules
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableName( const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxMetaData,
+ const OUString& _rCatalog,
+ const OUString& _rSchema,
+ const OUString& _rName,
+ bool _bQuote,
+ EComposeRule _eComposeRule);
+
+ /** composes a table name for usage in a SELECT statement
+
+ This includes quoting of the table as indicated by the connection's meta data, plus respecting
+ the settings "UseCatalogInSelect" and "UseSchemaInSelect", which might be present
+ in the data source which the connection belongs to.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableNameForSelect(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const OUString& _rCatalog,
+ const OUString& _rSchema,
+ const OUString& _rName );
+
+ /** composes a table name for usage in a SELECT statement
+
+ This includes quoting of the table as indicated by the connection's meta data, plus respecting
+ the settings "UseCatalogInSelect" and "UseSchemaInSelect", which might be present
+ in the data source which the connection belongs to.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableNameForSelect(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::beans::XPropertySet>& _xTable );
+
+ /** compose the table name out of the property set which must support the properties from the service <member scope= "css::sdbcx">table</member>
+ @param _xMetaData
+ The metadata from the connection.
+ @param _xTable
+ The table.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableName(
+ const css::uno::Reference< css::sdbc::XDatabaseMetaData>& _xMetaData,
+ const css::uno::Reference< css::beans::XPropertySet>& _xTable,
+ EComposeRule _eComposeRule,
+ bool _bQuote);
+
+
+ OOO_DLLPUBLIC_DBTOOLS sal_Int32 getSearchColumnFlag( const css::uno::Reference< css::sdbc::XConnection>& _rxConn,
+ sal_Int32 _nDataType);
+ // return the datasource for the given datasource name
+ OOO_DLLPUBLIC_DBTOOLS css::uno::Reference< css::sdbc::XDataSource> getDataSource(const OUString& _rsDataSourceName,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
+
+ /** search for a name that is NOT in the NameAcces
+ @param _rxContainer
+ the NameAccess container to search in
+ @param _rBaseName
+ the base name that should be used to create the new name
+ @param _bStartWithNumber
+ When <TRUE/> the name ends with number even when the name itself doesn't occur in the collection.
+ @return
+ A name which doesn't exist in the collection.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createUniqueName(const css::uno::Reference< css::container::XNameAccess>& _rxContainer,
+ const OUString& _rBaseName,
+ bool _bStartWithNumber = true);
+
+ /** creates a unique name which is not already used in the given name array
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString createUniqueName(
+ const css::uno::Sequence< OUString >& _rNames,
+ const OUString& _rBaseName,
+ bool _bStartWithNumber
+ );
+
+ /** create a name which is a valid SQL 92 identifier name
+ @param _rName the string which should be converted
+ @param _rSpecials @see com.sun.star.sdbc.XDatabaseMetaData.getExtraNameCharacters
+
+ @see isValidSQLName
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString convertName2SQLName(const OUString& _rName, std::u16string_view _rSpecials);
+
+ /** checks whether the given name is a valid SQL name
+
+ @param _rName the string which should be converted
+ @param _rSpecials @see com.sun.star.sdbc.XDatabaseMetaData.getExtraNameCharacters
+
+ @see convertName2SQLName
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool isValidSQLName( const OUString& _rName, std::u16string_view _rSpecials );
+
+ OOO_DLLPUBLIC_DBTOOLS
+ void showError( const SQLExceptionInfo& _rInfo,
+ const css::uno::Reference< css::awt::XWindow>& _pParent,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
+
+ /** implements <method scope="com.sun.star.sdb">XRowUpdate::updateObject</method>
+ <p>The object which is to be set is analyzed, and in case it is a simlpe scalar type for which there
+ is another updateXXX method, this other method is used.</p>
+ @param _rxUpdatedObject
+ the interface to forward all updateXXX calls to (except updateObject)
+ @param _nColumnIndex
+ the column index to update
+ @param _rValue
+ the value to update
+ @return
+ <TRUE/> if the update request was successfully re-routed to one of the other updateXXX methods
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ bool implUpdateObject( const css::uno::Reference< css::sdbc::XRowUpdate >& _rxUpdatedObject,
+ const sal_Int32 _nColumnIndex,
+ const css::uno::Any& _rValue);
+
+
+ /** ask the user for parameters if the prepared statement needs some and sets them in the prepared statement
+ @param _xConnection the connection must be able to create css::sdb::SingleSelectQueryComposers
+ @param _xPreparedStmt the prepared statement where the parameters could be set when needed
+ @param _aParametersSet contains which parameters have to asked for and which already have set.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void askForParameters( const css::uno::Reference< css::sdb::XSingleSelectQueryComposer >& _xComposer,
+ const css::uno::Reference< css::sdbc::XParameters>& _xParameters,
+ const css::uno::Reference< css::sdbc::XConnection>& _xConnection,
+ const css::uno::Reference< css::task::XInteractionHandler >& _rxHandler,
+ const ::std::vector<bool, std::allocator<bool> >& _aParametersSet = ::std::vector<bool, std::allocator<bool> >());
+
+ /** call the appropriate set method for the specific sql type @see css::sdbc::DataType
+ @param _xParams the parameters where to set the value
+ @param parameterIndex the index of the parameter, 1 based
+ @param x the value to set
+ @param sqlType the corresponding sql type @see css::sdbc::DataType
+ @param scale the scale of the sql type can be 0
+ @throws css::sdbc::SQLException
+ @throws css::uno::RuntimeException
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void setObjectWithInfo( const css::uno::Reference< css::sdbc::XParameters>& _xParameters,
+ sal_Int32 parameterIndex,
+ const css::uno::Any& x,
+ sal_Int32 sqlType,
+ sal_Int32 scale=0);
+
+ /** call the appropriate set method for the specific sql type @see css::sdbc::DataType
+ @param _xParams the parameters where to set the value
+ @param parameterIndex the index of the parameter, 1 based
+ @param x the value to set
+ @param sqlType the corresponding sql type @see css::sdbc::DataType
+ @param scale the scale of the sql type can be 0
+ @throws css::sdbc::SQLException
+ @throws css::uno::RuntimeException
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void setObjectWithInfo( const css::uno::Reference< css::sdbc::XParameters>& _xParameters,
+ sal_Int32 parameterIndex,
+ const ::connectivity::ORowSetValue& x,
+ sal_Int32 sqlType,
+ sal_Int32 scale);
+
+
+ /** implements <method scope="com.sun.star.sdb">XParameters::setObject</method>
+ <p>The object which is to be set is analyzed, and in case it is a simlpe scalar type for which there
+ is another setXXX method, this other method is used.</p>
+ @param _rxParameters
+ the interface to forward all setXXX calls to (except setObject)
+ @param _nColumnIndex
+ the column index to update
+ @param _rValue
+ the value to update
+ @return
+ <TRUE/> if the update request was successfully re-routed to one of the other updateXXX methods
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ bool implSetObject( const css::uno::Reference< css::sdbc::XParameters>& _rxParameters,
+ const sal_Int32 _nColumnIndex,
+ const css::uno::Any& _rValue);
+
+ /** creates the standard sql create table statement without the key part.
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+ @param _bAddScale
+ The scale will also be added when the value is 0.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createStandardCreateStatement( const css::uno::Reference< css::beans::XPropertySet >& descriptor,
+ const css::uno::Reference< css::sdbc::XConnection>& _xConnection,
+ ISQLStatementHelper* _pHelper,
+ std::u16string_view _sCreatePattern);
+
+ /** creates the standard sql statement for the key part of a create table statement.
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createStandardKeyStatement( const css::uno::Reference< css::beans::XPropertySet >& descriptor,
+ const css::uno::Reference< css::sdbc::XConnection>& _xConnection);
+
+ /** creates the standard sql statement for the type part of a create or alter table statement.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ @param descriptor
+ The descriptor of the column.
+ @param _xConnection
+ The connection.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createStandardTypePart( const css::uno::Reference< css::beans::XPropertySet >& descriptor
+ ,const css::uno::Reference< css::sdbc::XConnection>& _xConnection
+ ,std::u16string_view _sCreatePattern = {});
+
+ /** creates the standard sql statement for the column part of a create table statement.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ @param descriptor
+ The descriptor of the column.
+ @param _xConnection
+ The connection.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createStandardColumnPart( const css::uno::Reference< css::beans::XPropertySet >& descriptor
+ ,const css::uno::Reference< css::sdbc::XConnection>& _xConnection
+ ,ISQLStatementHelper* _pHelper = nullptr
+ ,std::u16string_view _sCreatePattern = {});
+
+ /** creates a SQL CREATE TABLE statement
+
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+
+ @return
+ The CREATE TABLE statement.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createSqlCreateTableStatement( const css::uno::Reference< css::beans::XPropertySet >& descriptor
+ ,const css::uno::Reference< css::sdbc::XConnection>& _xConnection);
+
+ /** creates a SDBC column with the help of getColumns.
+ @param _xTable
+ The table.
+ @param _rName
+ The name of the column.
+ @param _bCase
+ Is the column case sensitive.
+ @param _bQueryForInfo
+ If <TRUE/> the autoincrement and currency field will be read from the meta data, otherwise the following parameters will be used instead
+ @param _bIsAutoIncrement
+ <TRUE/> if the column is an autoincrement.
+ @param _bIsCurrency
+ <TRUE/> if the column is a currency field.
+ @param _nDataType
+ The data type of the column.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ css::uno::Reference< css::beans::XPropertySet>
+ createSDBCXColumn( const css::uno::Reference< css::beans::XPropertySet>& _xTable,
+ const css::uno::Reference< css::sdbc::XConnection>& _xConnection,
+ const OUString& _rName,
+ bool _bCase,
+ bool _bQueryForInfo,
+ bool _bIsAutoIncrement,
+ bool _bIsCurrency,
+ sal_Int32 _nDataType);
+
+ /** tries to locate the corresponding DataDefinitionSupplier for the given url and connection
+ @param _rsUrl
+ The URL used to connect to the database.
+ @param _xConnection
+ The connection used to find the correct driver.
+ @param _rxContext
+ Used to create the drivermanager.
+ @return
+ The datadefinition object.
+ */
+ OOO_DLLPUBLIC_DBTOOLS css::uno::Reference< css::sdbcx::XTablesSupplier> getDataDefinitionByURLAndConnection(
+ const OUString& _rsUrl,
+ const css::uno::Reference< css::sdbc::XConnection>& _xConnection,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
+
+ /** returns the table privileges to the given parameters
+ @param _xMetaData
+ The meta data.
+ @param _sCatalog
+ contains the catalog name
+ @param _sSchema
+ contains the schema name
+ @param _sTable
+ contains the table name
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getTablePrivileges(const css::uno::Reference< css::sdbc::XDatabaseMetaData>& _xMetaData,
+ const OUString& _sCatalog,
+ const OUString& _sSchema,
+ const OUString& _sTable);
+
+ typedef ::std::pair<bool,bool> TBoolPair;
+ typedef ::std::pair< TBoolPair,sal_Int32 > ColumnInformation;
+ typedef ::std::multimap< OUString, ColumnInformation, ::comphelper::UStringMixLess> ColumnInformationMap;
+ /** collects the information about auto increment, currency and data type for the given column name.
+ The column must be quoted, * is also valid.
+ @param _xConnection
+ The connection.
+ @param _sComposedTableName
+ The quoted table name. ccc.sss.ttt
+ @param _sName
+ The name of the column, or *
+ @param _rInfo
+ The information about the column(s).
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void collectColumnInformation( const css::uno::Reference< css::sdbc::XConnection>& _xConnection,
+ std::u16string_view _sComposedTableName,
+ std::u16string_view _rName,
+ ColumnInformationMap& _rInfo);
+
+
+ /** adds a boolean comparison clause to the given SQL predicate
+
+ @param _rExpression
+ the expression which is to be compared with a boolean value
+ @param _bValue
+ the boolean value which the expression is to be compared with
+ @param _nBooleanComparisonMode
+ the boolean comparison mode to be used. Usually obtained from
+ a css.sdb.DataSource's Settings member.
+ @param _out_rSQLPredicate
+ the buffer to which the comparison predicate will be appended
+ */
+ OOO_DLLPUBLIC_DBTOOLS void getBooleanComparisonPredicate(
+ std::u16string_view _rExpression,
+ const bool _bValue,
+ const sal_Int32 _nBooleanComparisonMode,
+ OUStringBuffer& _out_rSQLPredicate
+ );
+
+ /** is this field an aggregate?
+
+ @param _xComposer
+ a query composer that knows the field by name
+ @param _xField
+ the field
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool isAggregateColumn(
+ const css::uno::Reference< css::sdb::XSingleSelectQueryComposer > &_xComposer,
+ const css::uno::Reference< css::beans::XPropertySet > &_xField
+ );
+
+ /** is this column an aggregate?
+
+ @param _xColumns collection of columns
+ look for column sName in there
+ @param _sName
+ name of the column
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool isAggregateColumn(
+ const css::uno::Reference< css::container::XNameAccess > &_xColumns,
+ const OUString &_sName
+ );
+
+ /** is this column an aggregate?
+
+ @param _xColumn
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool isAggregateColumn(
+ const css::uno::Reference< css::beans::XPropertySet > &_xColumn
+ );
+
+} // namespace dbtools
+
+namespace connectivity
+{
+namespace dbase
+{
+ enum DBFType { dBaseIII = 0x03,
+ dBaseIV = 0x04,
+ dBaseV = 0x05,
+ VisualFoxPro = 0x30,
+ VisualFoxProAuto = 0x31, // Visual FoxPro with AutoIncrement field
+ dBaseFS = 0x43,
+ dBaseFSMemo = 0xB3,
+ dBaseIIIMemo = 0x83,
+ dBaseIVMemo = 0x8B,
+ dBaseIVMemoSQL = 0x8E,
+ FoxProMemo = 0xF5
+ };
+
+ /** decode a DBase file's codepage byte to a RTL charset
+ @param _out_nCharset
+ in case of success, the decoded RTL charset is written there.
+ else, this is not written to.
+ @param nType
+ the file's type byte
+ @param nCodepage
+ the file's codepage byte
+ @return
+ true if a RTL charset was successfully decoded and written to _out_nCharset
+ false if nothing was written to _out_nCharset
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool dbfDecodeCharset(rtl_TextEncoding &_out_nCharset, sal_uInt8 nType, sal_uInt8 nCodepage);
+
+ /** decode a DBase file's codepage byte to a RTL charset
+ @param _out_nCharset
+ in case of success, the decoded RTL charset is written there.
+ else, this is not written to.
+ @param dbf_Stream
+ pointer to a SvStream encapsulating the DBase file.
+ The stream will be rewinded and read from.
+ No guarantee is made on its position afterwards. Caller must reposition it itself.
+ @return
+ true if a RTL charset was successfully decoded and written to _out_nCharset
+ false if nothing was written to _out_nCharset
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool dbfReadCharset(rtl_TextEncoding &nCharSet, SvStream* dbf_Stream);
+
+} // namespace connectivity::dbase
+} // namespace connectivity
+
+#endif // INCLUDED_CONNECTIVITY_DBTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbtoolsdllapi.hxx b/include/connectivity/dbtoolsdllapi.hxx
new file mode 100644
index 000000000..466d5ab23
--- /dev/null
+++ b/include/connectivity/dbtoolsdllapi.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_DBTOOLSDLLAPI_HXX
+#define INCLUDED_CONNECTIVITY_DBTOOLSDLLAPI_HXX
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+#if defined OOO_DLLIMPLEMENTATION_DBTOOLS
+#define OOO_DLLPUBLIC_DBTOOLS SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_DBTOOLS SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/filtermanager.hxx b/include/connectivity/filtermanager.hxx
new file mode 100644
index 000000000..b6f104aa4
--- /dev/null
+++ b/include/connectivity/filtermanager.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_FILTERMANAGER_HXX
+#define INCLUDED_CONNECTIVITY_FILTERMANAGER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <connectivity/dbtoolsdllapi.hxx>
+
+namespace com::sun::star::beans { class XPropertySet; }
+
+
+namespace dbtools
+{
+
+
+ //= FilterManager
+
+ /** manages the filter of a database component with filter properties
+
+ The idea is that the filter which a database component actually really uses is composed of several single
+ filter components (which all are conjunctive).
+
+ First, there is a component which is visible to the clients of the database component itself - if they ask
+ the database component for the Filter property, they will get this public filter.
+
+ Second, there is an implicit filter, which is (to be) created from the MasterFields and DetailFields
+ property of the database component, if the latter denote columns.<br/>
+ For instance, if there is a link-pair CustomerID->cid, where |CustomerID| is a column of the master
+ database component, and |cid| is a column of the detail database component (the database component we're responsible for), then there will
+ be an implicit filter "cid = :param_cid_link" (or something like this), which is never visible
+ to the clients of the database component, but nevertheless needs to be propagated to the aggregated RowSet.<br/>
+ Actually, this implicit filter is maintained by the FormParameterManager.
+
+ Potentially, there could be more filter components (for instance, you could imagine database component
+ controls which act as live filter, which could be implemented with a third component), but
+ at the moment there are only these two.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS FilterManager
+ {
+ public:
+ enum class FilterComponent
+ {
+ PublicFilter, // The filter which is to be published as "Filter" property of the database component.
+ LinkFilter, // The filter part which is implicitly created for a database component when connecting
+ // master and detail database components via column names.
+ PublicHaving, // the same, but should go in HAVING clause instead of WHERE clause
+ LinkHaving
+ };
+
+ private:
+ css::uno::Reference< css::beans::XPropertySet > m_xComponentAggregate;
+ OUString m_aPublicFilterComponent;
+ OUString m_aPublicHavingComponent;
+ OUString m_aLinkFilterComponent;
+ OUString m_aLinkHavingComponent;
+ bool m_bApplyPublicFilter;
+
+ public:
+ /// ctor
+ explicit FilterManager();
+
+ /// late ctor
+ void initialize(const css::uno::Reference< css::beans::XPropertySet >& _rxComponentAggregate );
+
+ /// makes the object forgetting the references to the database component
+ void dispose( );
+
+ const OUString& getFilterComponent( FilterComponent _eWhich ) const;
+ void setFilterComponent( FilterComponent _eWhich, const OUString& _rComponent );
+
+ bool isApplyPublicFilter( ) const { return m_bApplyPublicFilter; }
+ void setApplyPublicFilter( bool _bApply );
+
+ private:
+ /** retrieves a filter which is a conjunction of all single filter components
+ */
+ OUString getComposedFilter( ) const;
+ OUString getComposedHaving( ) const;
+
+ /** appends one filter component to the statement in our composer
+ */
+ static void appendFilterComponent( OUStringBuffer& io_appendTo, std::u16string_view i_component );
+
+ /// checks whether there is only one (or even no) non-empty filter component
+ bool isThereAtMostOneFilterComponent( OUString& o_singleComponent ) const;
+ bool isThereAtMostOneHavingComponent( OUString& o_singleComponent ) const;
+ };
+
+
+} // namespacefrm
+
+
+#endif // CONNECTIVITY_FORMFILTERMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/formattedcolumnvalue.hxx b/include/connectivity/formattedcolumnvalue.hxx
new file mode 100644
index 000000000..9fdf227ed
--- /dev/null
+++ b/include/connectivity/formattedcolumnvalue.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
+#define INCLUDED_CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
+
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <rtl/ustring.hxx>
+#include <memory>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::sdbc { class XRowSet; }
+namespace com::sun::star::sdb { class XColumn; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace com::sun::star::util { class XNumberFormatter; }
+
+namespace dbtools
+{
+ struct FormattedColumnValue_Data;
+
+ //= FormattedColumnValue
+
+ /** a class which helps retrieving and setting the value of a database column
+ as formatted string.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS FormattedColumnValue final
+ {
+ public:
+ /** constructs an instance
+
+ The format key for the string value exchange is taken from the given column object.
+ If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
+ Otherwise, a default format matching the column type is determined.
+
+ The locale of this fallback format is the current system locale.
+
+ The number formats supplier is determined from the given <code>RowSet</code>, by
+ examining its <code>ActiveConnection</code>.
+ */
+ FormattedColumnValue(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const css::uno::Reference< css::sdbc::XRowSet >& _rxRowSet,
+ const css::uno::Reference< css::beans::XPropertySet >& _rxColumn
+ );
+
+ /** constructs an instance
+
+ The format key for the string value exchange is taken from the given column object.
+ If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
+ Otherwise, a default format matching the column type is determined.
+
+ The locale of this fallback format is the current system locale.
+ */
+ FormattedColumnValue(
+ const css::uno::Reference< css::util::XNumberFormatter >& i_rNumberFormatter,
+ const css::uno::Reference< css::beans::XPropertySet >& i_rColumn
+ );
+
+ ~FormattedColumnValue();
+
+ // access to the details of the formatting we determined
+ sal_Int16 getKeyType() const;
+ const css::uno::Reference< css::sdb::XColumn >&
+ getColumn() const;
+
+ bool setFormattedValue( const OUString& _rFormattedStringValue ) const;
+ OUString getFormattedValue() const;
+
+ private:
+ FormattedColumnValue(const FormattedColumnValue&) = delete;
+ FormattedColumnValue& operator=(const FormattedColumnValue&) = delete;
+ std::unique_ptr< FormattedColumnValue_Data > m_pData;
+ };
+
+
+} // namespace dbtools
+
+
+#endif // INCLUDED_CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/internalnode.hxx b/include/connectivity/internalnode.hxx
new file mode 100644
index 000000000..3402f8e3a
--- /dev/null
+++ b/include/connectivity/internalnode.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <connectivity/sqlnode.hxx>
+
+namespace connectivity
+{
+
+ //= OSQLInternalNode
+
+ /** special node for avoiding memory leaks
+ */
+ class OSQLInternalNode final : public OSQLParseNode
+ {
+ public:
+ OSQLInternalNode(const char* pNewValue,
+ SQLNodeType eNodeType,
+ sal_uInt32 nNodeID = 0);
+ OSQLInternalNode(std::string_view _rNewValue,
+ SQLNodeType eNodeType,
+ sal_uInt32 nNodeID = 0);
+ OSQLInternalNode(const OUString& _rNewValue,
+ SQLNodeType eNodeType,
+ sal_uInt32 nNodeID = 0);
+
+ virtual ~OSQLInternalNode() override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/odbc.hxx b/include/connectivity/odbc.hxx
new file mode 100644
index 000000000..9f1e487eb
--- /dev/null
+++ b/include/connectivity/odbc.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#if defined(_WIN32)
+
+#include <prewin.h>
+
+// just to go with calling convention of windows
+#if SYSTEM_ODBC_HEADERS
+#if !defined WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#define SQL_API __stdcall
+#include <sqlext.h>
+#else
+#define SQL_API __stdcall
+#include <odbc/sqlext.h>
+#endif
+#undef SQL_API
+#define SQL_API __stdcall
+
+#ifndef SQL_C_BOOKMARK
+#define SQL_C_BOOKMARK SQL_C_ULONG /* BOOKMARK */
+#endif
+
+#ifndef SQL_OPT_TRACE_OFF
+#define SQL_OPT_TRACE_OFF 0UL
+#endif
+
+#define SDB_ODBC_CHAR UCHAR
+
+#include <postwin.h>
+
+#endif
+
+
+#ifdef UNX
+
+#ifndef ODBC_UNX
+#define ODBC_UNX
+#endif
+#define CALLBACK
+#define EXPORT
+#ifdef SYSTEM_ODBC_HEADERS
+#include <sqlext.h>
+#else
+#include <odbc/sqlext.h>
+#endif
+
+#define SDB_ODBC_CHAR UCHAR
+
+#endif // UNX
+
+
+#ifndef SQL_WCHAR
+#define SQL_WCHAR (-8)
+#endif
+#ifndef SQL_WVARCHAR
+#define SQL_WVARCHAR (-9)
+#endif
+#ifndef SQL_WLONGVARCHAR
+#define SQL_WLONGVARCHAR (-10)
+#endif
+#ifndef SQL_C_WCHAR
+#define SQL_C_WCHAR SQL_WCHAR
+#endif
+
+#ifndef SQL_C_TCHAR
+#ifdef UNICODE
+#define SQL_C_TCHAR SQL_C_WCHAR
+#else
+#define SQL_C_TCHAR SQL_C_CHAR
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/parameters.hxx b/include/connectivity/parameters.hxx
new file mode 100644
index 000000000..f2196af12
--- /dev/null
+++ b/include/connectivity/parameters.hxx
@@ -0,0 +1,415 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_PARAMETERS_HXX
+#define INCLUDED_CONNECTIVITY_PARAMETERS_HXX
+
+#include <map>
+#include <vector>
+
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <connectivity/paramwrapper.hxx>
+#include <unotools/sharedunocomponent.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::container { class XIndexAccess; }
+namespace com::sun::star::form { class XDatabaseParameterListener; }
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::sdbc { class XArray; }
+namespace com::sun::star::sdbc { class XBlob; }
+namespace com::sun::star::sdbc { class XClob; }
+namespace com::sun::star::sdbc { class XConnection; }
+namespace com::sun::star::sdbc { class XDatabaseMetaData; }
+namespace com::sun::star::sdbc { class XParameters; }
+namespace com::sun::star::sdbc { class XRef; }
+namespace com::sun::star::task { class XInteractionHandler; }
+namespace com::sun::star::uno { class XAggregation; }
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace dbtools
+{
+
+
+ typedef ::utl::SharedUNOComponent< css::sdb::XSingleSelectQueryComposer, ::utl::DisposableComponent >
+ SharedQueryComposer;
+
+
+ //= ParameterManager
+
+ class FilterManager;
+ class OOO_DLLPUBLIC_DBTOOLS ParameterManager
+ {
+ public:
+ /// classifies the origin of the data to fill a parameter
+ enum class ParameterClassification
+ {
+ /** parameters which are filled from the master-detail relationship, where the detail
+ name is an explicit parameter name
+ */
+ LinkedByParamName,
+ /** parameters which are filled from the master-detail relationship, where the detail
+ name is a column name, so an implicit parameter had to be generated for it
+ */
+ LinkedByColumnName,
+ /** parameters which are filled externally (i.e. by XParameters::setXXX, or by the parameter listeners)
+ */
+ FilledExternally
+ };
+ /** meta data about an inner parameter
+ */
+ private:
+ struct ParameterMetaData
+ {
+ /// the type of the parameter
+ ParameterClassification eType;
+ /// the column object for this parameter, as returned by the query composer
+ css::uno::Reference< css::beans::XPropertySet >
+ xComposerColumn;
+ /// the indices of inner parameters which need to be filled when this concrete parameter is set
+ ::std::vector< sal_Int32 > aInnerIndexes;
+
+ /// ctor with composer column
+ ParameterMetaData( const css::uno::Reference< css::beans::XPropertySet >& _rxColumn )
+ :eType ( ParameterClassification::FilledExternally )
+ ,xComposerColumn ( _rxColumn )
+ {
+ }
+ };
+
+ typedef ::std::map< OUString, ParameterMetaData > ParameterInformation;
+
+ private:
+ ::osl::Mutex& m_rMutex;
+ ::comphelper::OInterfaceContainerHelper3<css::form::XDatabaseParameterListener> m_aParameterListeners;
+
+ css::uno::Reference< css::uno::XComponentContext >
+ m_xContext;
+
+ css::uno::WeakReference< css::beans::XPropertySet >
+ m_xComponent; // the database component whose parameters we're handling
+ css::uno::Reference< css::uno::XAggregation >
+ m_xAggregatedRowSet; // the aggregated row set - necessary for unwrapped access to some interfaces
+ css::uno::Reference< css::sdbc::XParameters >
+ m_xInnerParamUpdate; // write access to the inner parameters
+ SharedQueryComposer m_xComposer; // query composer wrapping the statement which the *aggregate* is based on
+ SharedQueryComposer m_xParentComposer; // query composer wrapping the statement of our parent database component
+ css::uno::Reference< css::container::XIndexAccess >
+ m_xInnerParamColumns; // index access to the parameter columns, as got from the query composer
+
+ ::dbtools::param::ParametersContainerRef
+ m_pOuterParameters; // the container of parameters which still need to be filled in by
+ // external instances
+ sal_Int32 m_nInnerCount; // overall number of parameters as required by the database component's aggregate
+
+ ParameterInformation m_aParameterInformation;
+
+ std::vector< OUString > m_aMasterFields;
+ std::vector< OUString > m_aDetailFields;
+
+ OUString m_sIdentifierQuoteString;
+ OUString m_sSpecialCharacters;
+ css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xConnectionMetadata;
+
+ ::std::vector< bool > m_aParametersVisited;
+
+ bool m_bUpToDate;
+
+ public:
+ /** ctor
+ */
+ explicit ParameterManager(
+ ::osl::Mutex& _rMutex,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext
+ );
+
+ /// late ctor
+ void initialize(
+ const css::uno::Reference< css::beans::XPropertySet >& _rxComponent,
+ const css::uno::Reference< css::uno::XAggregation >& _rxComponentAggregate
+ );
+
+ /// makes the object forgetting the references to the database component
+ void dispose( );
+
+ /// clears the instance data
+ void clearAllParameterInformation();
+
+ /// checks whether the parameter information is up-to-date
+ bool isUpToDate() const { return m_bUpToDate; }
+
+ /** updates all parameter information represented by the instance
+ */
+ void updateParameterInfo( FilterManager& _rFilterManager );
+
+ /** fills parameter values, as extensive as possible
+
+ <p>In particular, all values which can be filled from the master-detail relationship of
+ between our database component and its parent are filled in.</p>
+
+ @param _rxCompletionHandler
+ an interaction handler which should be used to fill all parameters which
+ cannot be filled by other means. May be <NULL/>
+ @param _rClearForNotifies
+ the mutex guard to be (temporarily) cleared for notifications
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool fillParameterValues(
+ const css::uno::Reference< css::task::XInteractionHandler >& _rxCompletionHandler,
+ ::osl::ResettableMutexGuard& _rClearForNotifies
+ );
+
+ /** sets all parameter values to null (via <member>XParameters::setNull</member>)
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void setAllParametersNull();
+
+ /** resets all detail columns which are, via a parameter, linked to a master column, to
+ the value of this master column.
+
+ For instance, if the database component is bound to a statement <code>SELECT * from invoice where inv_id = :cid</code>,
+ and there is <em>one</em> master-detail link from
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void resetParameterValues();
+
+ /** adds the given listener to the list of parameter listeners
+ */
+ void addParameterListener(
+ const css::uno::Reference< css::form::XDatabaseParameterListener >& _rxListener
+ );
+
+ /** removes the given listener from the list of parameter listeners
+ */
+ void removeParameterListener(
+ const css::uno::Reference< css::form::XDatabaseParameterListener >& _rxListener
+ );
+
+ // XParameters equivalents
+ void setNull ( sal_Int32 _nIndex, sal_Int32 sqlType);
+ void setObjectNull ( sal_Int32 _nIndex, sal_Int32 sqlType, const OUString& typeName);
+ void setBoolean ( sal_Int32 _nIndex, bool x);
+ void setByte ( sal_Int32 _nIndex, sal_Int8 x);
+ void setShort ( sal_Int32 _nIndex, sal_Int16 x);
+ void setInt ( sal_Int32 _nIndex, sal_Int32 x);
+ void setLong ( sal_Int32 _nIndex, sal_Int64 x);
+ void setFloat ( sal_Int32 _nIndex, float x);
+ void setDouble ( sal_Int32 _nIndex, double x);
+ void setString ( sal_Int32 _nIndex, const OUString& x);
+ void setBytes ( sal_Int32 _nIndex, const css::uno::Sequence< sal_Int8 >& x);
+ void setDate ( sal_Int32 _nIndex, const css::util::Date& x);
+ void setTime ( sal_Int32 _nIndex, const css::util::Time& x);
+ void setTimestamp ( sal_Int32 _nIndex, const css::util::DateTime& x);
+ void setBinaryStream ( sal_Int32 _nIndex, const css::uno::Reference< css::io::XInputStream>& x, sal_Int32 length);
+ void setCharacterStream ( sal_Int32 _nIndex, const css::uno::Reference< css::io::XInputStream>& x, sal_Int32 length);
+ void setObject ( sal_Int32 _nIndex, const css::uno::Any& x);
+ void setObjectWithInfo ( sal_Int32 _nIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale);
+ void setRef ( sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XRef>& x);
+ void setBlob ( sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XBlob>& x);
+ void setClob ( sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XClob>& x);
+ void setArray ( sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XArray>& x);
+ void clearParameters();
+
+ private:
+ /// checks whether the object is already initialized, and not yet disposed
+ bool isAlive() const { return m_xComponent.get().is() && m_xInnerParamUpdate.is(); }
+
+ /** creates a filter expression from a master-detail link where the detail denotes a column name
+ */
+ OUString
+ createFilterConditionFromColumnLink(
+ const OUString& /* [in] */ _rMasterColumn,
+ const css::uno::Reference< css::beans::XPropertySet >& /* [in] */ xDetailColumn,
+ OUString& /* [out] */ _rNewParamName
+ );
+
+ /** initializes our query composer, and the collection of inner parameter columns
+
+ @param _rxComponent
+ the database component to initialize from. Must not be <NULL/>
+ @return
+ <TRUE/> if and only if the initialization was successful
+
+ @postcond
+ if and only if <TRUE/> is returned, then <member>m_xInnerParamColumns</member> contains the collection of
+ inner parameters
+ */
+ bool initializeComposerByComponent(
+ const css::uno::Reference< css::beans::XPropertySet >& _rxComponent
+ );
+
+ /** collects initial meta information about inner parameters (i.e. it initially fills
+ <member>m_aParameterInformation</member>).
+
+ @param _bSecondRun
+ if <TRUE/>, this is the second run, because we ourself previously extended the filter of
+ the RowSet
+
+ @precond
+ <member>m_xInnerParamColumns</member> is not <NULL/>
+ */
+ void collectInnerParameters( bool _bSecondRun );
+
+ /** analyzes the master-detail links for our database component, and initializes m_aMasterFields and m_aDetailFields
+
+ @param _rFilterManager
+ the filter manager of the database component
+ @param _rColumnsInLinkDetails
+ will be set to <TRUE/> if and only if there were link pairs where the detail field denoted
+ a column name of our database component
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void analyzeFieldLinks( FilterManager& _rFilterManager, bool& /* [out] */ _rColumnsInLinkDetails );
+
+ /** classifies the link pairs
+
+ @param _rxParentColumns
+ the columns of the parent database component
+
+ @param _rxColumns
+ the columns of our own database component
+
+ @param _out_rAdditionalFilterComponents
+ the additional filter components which are required for master-detail relationships where
+ the detail part denotes a column name. In such a case, an additional filter needs to be created,
+ containing a new parameter.
+
+ @param _out_rAdditionalHavingComponents
+ the additional having clause components which are required for master-detail relationships where
+ the detail part denotes a column name. In such a case, an additional filter needs to be created,
+ containing a new parameter.
+
+ @precond
+ <member>m_aMasterFields</member> and <member>m_aDetailFields</member> have the same length
+ */
+ void classifyLinks(
+ const css::uno::Reference< css::container::XNameAccess >& _rxParentColumns,
+ const css::uno::Reference< css::container::XNameAccess >& _rxColumns,
+ ::std::vector< OUString >& _out_rAdditionalFilterComponents,
+ ::std::vector< OUString >& _out_rAdditionalHavingComponents
+ );
+
+ /** finalizes our <member>m_pOuterParameters</member> so that it can be used for
+ external parameter listeners
+
+ @precond
+ <member>m_pOuterParameters</member> is <NULL/>
+ @precond
+ <member>m_xInnerParamUpdate</member> is not <NULL/>
+ */
+ void createOuterParameters();
+
+ /** fills in the parameters values which result from the master-detail relationship
+ between the database component and its parent
+
+ @param _rxParentColumns
+ the columns of the parameter database component. Must not be <NULL/>
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void fillLinkedParameters(
+ const css::uno::Reference< css::container::XNameAccess >& _rxParentColumns
+ );
+
+ /** completes all missing parameters via an interaction handler
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool completeParameters(
+ const css::uno::Reference< css::task::XInteractionHandler >& _rxCompletionHandler,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
+ );
+
+ /** asks the parameter listeners to fill in final values
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool consultParameterListeners( ::osl::ResettableMutexGuard& _rClearForNotifies );
+
+ /** mark an externally filled parameter as visited
+ */
+ void externalParameterVisited( sal_Int32 _nIndex );
+
+ private:
+ /** retrieves the columns of the parent database component
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ @return
+ <TRUE/> if and only if the columns could be successfully retrieved
+ */
+ bool getParentColumns(
+ css::uno::Reference< css::container::XNameAccess >& /* [out] */ _out_rxParentColumns,
+ bool _bFromComposer
+ );
+
+ /** retrieves the columns of our database component
+
+ @param _bFromComposer
+ if <TRUE/>, the columns are obtained from the composer, else from the living database component itself
+ @return
+ <TRUE/> if and only if the columns could be successfully retrieved
+ */
+ bool getColumns(
+ css::uno::Reference< css::container::XNameAccess >& /* [out] */ _rxColumns,
+ bool _bFromComposer
+ );
+
+ /** retrieves the active connection of the database component
+ */
+ void getConnection(
+ css::uno::Reference< css::sdbc::XConnection >& /* [out] */ _rxConnection
+ );
+
+ /** caches some info about the connection of our database component
+ */
+ void cacheConnectionInfo();
+
+ private:
+ ParameterManager( const ParameterManager& ) = delete;
+ ParameterManager& operator=( const ParameterManager& ) = delete;
+ };
+
+
+} // namespacefrm
+
+
+#endif // INCLUDED_CONNECTIVITY_PARAMETERS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/paramwrapper.hxx b/include/connectivity/paramwrapper.hxx
new file mode 100644
index 000000000..bf16e0851
--- /dev/null
+++ b/include/connectivity/paramwrapper.hxx
@@ -0,0 +1,196 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_PARAMWRAPPER_HXX
+#define INCLUDED_CONNECTIVITY_PARAMWRAPPER_HXX
+
+#include <config_options.h>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <connectivity/FValue.hxx>
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/compbase.hxx>
+
+#include <memory>
+#include <vector>
+
+namespace com::sun::star::sdbc { class XParameters; }
+namespace com::sun::star::sdb { class XSingleSelectQueryAnalyzer; }
+
+
+namespace dbtools::param
+{
+
+
+ //= ParameterWrapper
+
+ /** wraps a parameter column as got from an SQLQueryComposer, so that it has an additional
+ property "Value", which is forwarded to an XParameters interface
+ */
+ class UNLESS_MERGELIBS(OOO_DLLPUBLIC_DBTOOLS) ParameterWrapper final : public ::cppu::OWeakObject
+ ,public css::lang::XTypeProvider
+ ,public ::comphelper::OMutexAndBroadcastHelper
+ ,public ::cppu::OPropertySetHelper
+ {
+ private:
+ typedef ::cppu::OWeakObject UnoBase;
+ typedef ::cppu::OPropertySetHelper PropertyBase;
+
+ private:
+ /// the most recently set value of the parameter
+ ::connectivity::ORowSetValue m_aValue;
+ /// the positions (in our m_xValueDestination) at which the value should be set (0-based!)
+ ::std::vector< sal_Int32 > m_aIndexes;
+
+ /// the "delegator" column to which standard property requests are forwarded
+ css::uno::Reference< css::beans::XPropertySet > m_xDelegator;
+ /// the property set info for our delegator
+ css::uno::Reference< css::beans::XPropertySetInfo > m_xDelegatorPSI;
+ /// the component taking the value
+ css::uno::Reference< css::sdbc::XParameters > m_xValueDestination;
+ /// helper for implementing XPropertySetInfo
+ ::std::unique_ptr< ::cppu::OPropertyArrayHelper > m_pInfoHelper;
+
+
+ public:
+ const ::connectivity::ORowSetValue& Value() const { return m_aValue; }
+ ::connectivity::ORowSetValue& Value() { return m_aValue; }
+
+ public:
+ ParameterWrapper(
+ const css::uno::Reference< css::beans::XPropertySet >& _rxColumn
+ );
+
+ ParameterWrapper(
+ const css::uno::Reference< css::beans::XPropertySet >& _rxColumn,
+ const css::uno::Reference< css::sdbc::XParameters >& _rxAllParameters,
+ std::vector< sal_Int32 >&& _rIndexes
+ );
+
+ DECLARE_XINTERFACE()
+
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+ // OPropertySetHelper
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& rConvertedValue, css::uno::Any& rOldValue, sal_Int32 nHandle, const css::uno::Any& rValue) override;
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+ virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override;
+
+ // pseudo-XComponent
+ void dispose();
+
+ private:
+ virtual ~ParameterWrapper() override;
+
+ // disambiguations
+ using ::cppu::OPropertySetHelper::getFastPropertyValue;
+
+ OUString impl_getPseudoAggregatePropertyName( sal_Int32 _nHandle ) const;
+ };
+
+
+ //= ParameterWrapper
+
+ typedef ::std::vector< ::rtl::Reference< ParameterWrapper > > Parameters;
+
+
+ //= ParameterWrapperContainer
+
+ typedef ::cppu::WeakComponentImplHelper < css::container::XIndexAccess
+ , css::container::XEnumerationAccess
+ > ParameterWrapperContainer_Base;
+
+ /// class for the parameter event @see approveParameter
+ class OOO_DLLPUBLIC_DBTOOLS ParameterWrapperContainer final :
+ public ParameterWrapperContainer_Base
+ {
+ private:
+ ::osl::Mutex m_aMutex;
+ Parameters m_aParameters;
+
+ virtual ~ParameterWrapperContainer() override;
+
+ public:
+ /** creates an empty container
+ */
+ ParameterWrapperContainer();
+
+ /** creates a container from a SingleSelectQuerAnalyzer's parameter columns
+
+ Note that here, the simple constructor of the ParameterWrapper will be used, which does not
+ use a XParameters instance to forward values to, but only remembers the values itself.
+ */
+ ParameterWrapperContainer( const css::uno::Reference< css::sdb::XSingleSelectQueryAnalyzer >& _rxComposer );
+
+ // css::container::XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType() override;
+ virtual sal_Bool SAL_CALL hasElements() override;
+
+ // css::container::XEnumerationAccess
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override;
+
+ // css::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() override;
+ virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) override;
+
+ public:
+ const Parameters& getParameters() const { return m_aParameters; }
+
+ const ::connectivity::ORowSetValue& operator[]( size_t _index ) const { return m_aParameters[ _index ]->Value(); }
+ ::connectivity::ORowSetValue& operator[]( size_t _index ) { return m_aParameters[ _index ]->Value(); }
+
+ /** adds a ParameterWrapper to the end of the array
+ */
+ void push_back( ParameterWrapper* _pParameter )
+ {
+ m_aParameters.push_back( _pParameter );
+ }
+
+ size_t size() const { return m_aParameters.size(); }
+
+ private:
+ // XComponent
+ virtual void SAL_CALL disposing() override;
+
+ void impl_checkDisposed_throw();
+ };
+
+
+ //= ParametersContainer
+
+ typedef ::rtl::Reference< ParameterWrapperContainer > ParametersContainerRef;
+
+
+} // namespace dbtools::param
+
+
+#endif // INCLUDED_CONNECTIVITY_PARAMWRAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/predicateinput.hxx b/include/connectivity/predicateinput.hxx
new file mode 100644
index 000000000..3d9fb0a71
--- /dev/null
+++ b/include/connectivity/predicateinput.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_PREDICATEINPUT_HXX
+#define INCLUDED_CONNECTIVITY_PREDICATEINPUT_HXX
+
+#include <connectivity/sqlparse.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::i18n { class XLocaleData4; }
+namespace com::sun::star::sdbc { class XConnection; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::util { class XNumberFormatter; }
+
+
+
+namespace dbtools
+{
+
+
+ //= OPredicateInputController
+
+ /** A class which allows input of an SQL predicate for a row set column
+ into an edit field.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OPredicateInputController
+ {
+ private:
+ css::uno::Reference< css::sdbc::XConnection >
+ m_xConnection;
+ css::uno::Reference< css::util::XNumberFormatter >
+ m_xFormatter;
+ css::uno::Reference< css::i18n::XLocaleData4 >
+ m_xLocaleData;
+
+ ::connectivity::OSQLParser
+ m_aParser;
+
+ public:
+ OPredicateInputController(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const ::connectivity::IParseContext* _pParseContext = nullptr
+ );
+
+ /** transforms a "raw" predicate value (usually obtained from a user input) into a valid predicate for the given column
+ @param _rPredicateValue
+ The text to normalize.
+ @param _rxField
+ The field for which the text should be a predicate value.
+ @param _pErrorMessage
+ If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
+ points to.
+ */
+ bool normalizePredicateString(
+ OUString& _rPredicateValue,
+ const css::uno::Reference< css::beans::XPropertySet >& _rxField,
+ OUString* _pErrorMessage = nullptr
+ ) const;
+
+ /** get the value of the predicate, as a string to be used in a WHERE clause
+ @param _rPredicateValue
+ the value which has been normalized using normalizePredicateString
+ @param _rxField
+ is the field for which a predicate is to be entered
+ @see normalizePredicateString
+ */
+ OUString getPredicateValueStr(
+ const OUString& _rPredicateValue,
+ const css::uno::Reference< css::beans::XPropertySet > & _rxField
+ ) const;
+
+ OUString getPredicateValueStr(
+ const OUString& _sField
+ , const OUString& _rPredicateValue) const;
+
+ /** get the value of the predicate, either as an empty or as a string
+ @param _rPredicateValue
+ the value which has been normalized using normalizePredicateString
+ @param _rxField
+ is the field for which a predicate is to be entered
+ @see normalizePredicateString
+ */
+ css::uno::Any getPredicateValue(
+ const OUString& _rPredicateValue,
+ const css::uno::Reference< css::beans::XPropertySet > & _rxField
+ ) const;
+
+ private:
+ std::unique_ptr<::connectivity::OSQLParseNode> implPredicateTree(
+ OUString& _rErrorMessage,
+ const OUString& _rStatement,
+ const css::uno::Reference< css::beans::XPropertySet > & _rxField
+ ) const;
+
+ bool getSeparatorChars(
+ const css::lang::Locale& _rLocale,
+ sal_Unicode& _rDecSep,
+ sal_Unicode& _rThdSep
+ ) const;
+
+ css::uno::Any implParseNode(std::unique_ptr<::connectivity::OSQLParseNode> pParseNode, bool _bForStatementUse) const;
+ };
+
+
+} // namespace dbtools
+
+
+#endif // INCLUDED_CONNECTIVITY_PREDICATEINPUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/IRefreshable.hxx b/include/connectivity/sdbcx/IRefreshable.hxx
new file mode 100644
index 000000000..412ef8079
--- /dev/null
+++ b/include/connectivity/sdbcx/IRefreshable.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX
+#define INCLUDED_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX
+
+#include <connectivity/dbtoolsdllapi.hxx>
+
+namespace connectivity::sdbcx
+ {
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableGroups
+ {
+ public:
+ virtual void refreshGroups() = 0;
+
+ protected:
+ ~IRefreshableGroups() {}
+ };
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableUsers
+ {
+ public:
+ virtual void refreshUsers() = 0;
+
+ protected:
+ ~IRefreshableUsers() {}
+ };
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableColumns
+ {
+ public:
+ virtual void refreshColumns() = 0;
+
+ protected:
+ ~IRefreshableColumns() {}
+ };
+
+}
+#endif // INCLUDED_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VCollection.hxx b/include/connectivity/sdbcx/VCollection.hxx
new file mode 100644
index 000000000..0f5a0b3fb
--- /dev/null
+++ b/include/connectivity/sdbcx/VCollection.hxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SDBCX_VCOLLECTION_HXX
+#define INCLUDED_CONNECTIVITY_SDBCX_VCOLLECTION_HXX
+
+#include <config_options.h>
+#include <cppuhelper/implbase10.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XAppend.hpp>
+#include <com/sun/star/sdbcx/XDrop.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <comphelper/interfacecontainer3.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <connectivity/CommonTools.hxx>
+#include <com/sun/star/container/XContainer.hpp>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <memory>
+
+namespace com::sun::star::container { class XEnumeration; }
+
+
+namespace connectivity::sdbcx
+ {
+
+ // the class OCollection is base class for collections :-)
+ typedef ::cppu::ImplHelper10< css::container::XNameAccess,
+ css::container::XIndexAccess,
+ css::container::XEnumerationAccess,
+ css::container::XContainer,
+ css::sdbc::XColumnLocate,
+ css::util::XRefreshable,
+ css::sdbcx::XDataDescriptorFactory,
+ css::sdbcx::XAppend,
+ css::sdbcx::XDrop,
+ css::lang::XServiceInfo> OCollectionBase;
+
+ typedef css::uno::Reference< css::beans::XPropertySet > ObjectType;
+
+ class UNLESS_MERGELIBS(OOO_DLLPUBLIC_DBTOOLS) SAL_NO_VTABLE IObjectCollection
+ {
+ public:
+ virtual ~IObjectCollection();
+ virtual bool exists(const OUString& _sName ) = 0;
+ virtual bool empty() = 0;
+ virtual void swapAll() = 0;
+ virtual void swap() = 0;
+ virtual void clear() = 0;
+ virtual void reFill(const ::std::vector< OUString> &_rVector) = 0;
+ virtual void insert(const OUString& _sName, const ObjectType& _xObject) = 0;
+ virtual bool rename(const OUString& _sOldName, const OUString& _sNewName) = 0;
+ virtual sal_Int32 size() = 0;
+ virtual css::uno::Sequence< OUString > getElementNames() = 0;
+ virtual OUString getName(sal_Int32 _nIndex) = 0;
+ virtual void disposeAndErase(sal_Int32 _nIndex) = 0;
+ virtual void disposeElements() = 0;
+ virtual sal_Int32 findColumn( const OUString& columnName ) = 0;
+ virtual ObjectType getObject(sal_Int32 _nIndex) = 0;
+ virtual ObjectType getObject(const OUString& columnName) = 0;
+ virtual void setObject(sal_Int32 _nIndex,const ObjectType& _xObject) = 0;
+ virtual bool isCaseSensitive() const = 0;
+ };
+
+ // OCollection
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCollection :
+ public OCollectionBase
+ {
+ protected:
+ ::std::unique_ptr<IObjectCollection> m_pElements;
+
+ ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener> m_aContainerListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::util::XRefreshListener> m_aRefreshListeners;
+
+ protected:
+ ::cppu::OWeakObject& m_rParent; // parent of the collection
+ ::osl::Mutex& m_rMutex; // mutex of the parent
+ bool m_bUseIndexOnly; // is only TRUE when only an indexaccess is needed
+
+ // the implementing class should refresh their elements
+ /// @throws css::uno::RuntimeException
+ virtual void impl_refresh() = 0;
+
+ // will be called when an object was requested by one of the accessing methods like getByIndex
+ virtual ObjectType createObject(const OUString& _rName) = 0;
+
+ // will be called when a new object should be generated by a call of createDataDescriptor
+ // the returned object is empty will be filled outside and added to the collection
+ virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor();
+
+ /** appends an object described by a descriptor, under a given name
+ @param _rForName
+ is the name under which the object should be appended. Guaranteed to not be empty.
+ This is passed for convenience only, since it's the result of a call of
+ getNameForObject for the given descriptor
+ @param descriptor
+ describes the object to append
+ @return
+ the new object which is to be inserted into the collection. This might be the result
+ of a call of <code>createObject( _rForName )</code>, or a clone of the descriptor.
+ */
+ virtual ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor );
+
+ // called when XDrop was called
+ virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName);
+
+ /** returns the name for the object. The default implementation ask for the property NAME. If this doesn't satisfy, it has to be overridden.
+ @param _xObject The object where the name should be extracted.
+ @return The name of the object.
+ */
+ virtual OUString getNameForObject(const ObjectType& _xObject);
+
+ /** clones the given descriptor
+
+ The method calls createDescriptor to create a new, empty descriptor, and then copies all properties from
+ _descriptor to the new object, which is returned.
+
+ This method might come handy in derived classes for implementing appendObject, when the object
+ is not actually appended to any backend (e.g. for the columns collection of a descriptor object itself,
+ where there is not yet a database backend to append the column to).
+ */
+ ObjectType cloneDescriptor( const ObjectType& _descriptor );
+
+ OCollection(::cppu::OWeakObject& _rParent,
+ bool _bCase,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector,
+ bool _bUseIndexOnly = false,
+ bool _bUseHardRef = true);
+
+ /** clear the name map
+ <p>Does <em>not</em> dispose the objects hold by the collection.</p>
+ */
+ void clear_NoDispose();
+
+ /** insert a new element into the collection
+ */
+ void insertElement(const OUString& _sElementName,const ObjectType& _xElement);
+
+ /** return the object, if not existent it creates it.
+ @param _nIndex
+ The index of the object to create.
+ @return ObjectType
+ */
+ ObjectType getObject(sal_Int32 _nIndex);
+
+ public:
+ virtual ~OCollection();
+ DECLARE_SERVICE_INFO();
+
+ void reFill(const ::std::vector< OUString> &_rVector);
+ bool isCaseSensitive() const { return m_pElements->isCaseSensitive(); }
+ void renameObject(const OUString& _sOldName, const OUString& _sNewName);
+
+ // only the name is identical to ::cppu::OComponentHelper
+ virtual void disposing();
+ // dispatch the refcounting to the parent
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+
+ // css::container::XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType( ) override;
+ virtual sal_Bool SAL_CALL hasElements( ) override;
+ // css::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) override;
+ virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
+
+ // css::container::XNameAccess
+ virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
+ // XEnumerationAccess
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override;
+ // css::util::XRefreshable
+ virtual void SAL_CALL refresh( ) override;
+ virtual void SAL_CALL addRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override;
+ virtual void SAL_CALL removeRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override;
+ // XDataDescriptorFactory
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override;
+ // XAppend
+ virtual void SAL_CALL appendByDescriptor( const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ // XDrop
+ virtual void SAL_CALL dropByName( const OUString& elementName ) override;
+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) override;
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override;
+ // css::container::XContainer
+ virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
+ virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
+ private:
+ void notifyElementRemoved(const OUString& _sName);
+ void disposeElements();
+ void dropImpl(sal_Int32 _nIndex, bool _bReallyDrop = true);
+ };
+
+}
+#endif // INCLUDED_CONNECTIVITY_SDBCX_VCOLLECTION_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VColumn.hxx b/include/connectivity/sdbcx/VColumn.hxx
new file mode 100644
index 000000000..579611cdf
--- /dev/null
+++ b/include/connectivity/sdbcx/VColumn.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_SDBCX_VCOLUMN_HXX
+#define INCLUDED_CONNECTIVITY_SDBCX_VCOLUMN_HXX
+
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <connectivity/sdbcx/VDescriptor.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace connectivity::sdbcx
+ {
+ class OColumn;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OColumn> OColumn_PROP;
+
+ typedef ::cppu::WeakComponentImplHelper< css::container::XNamed,
+ css::lang::XServiceInfo> OColumnDescriptor_BASE;
+ typedef ::cppu::ImplHelper1< css::sdbcx::XDataDescriptorFactory > OColumn_BASE;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OColumn :
+ public cppu::BaseMutex,
+ public OColumn_BASE,
+ public OColumnDescriptor_BASE,
+ public OColumn_PROP,
+ public ODescriptor
+ {
+ protected:
+ OUString m_TypeName;
+ OUString m_Description;
+ OUString m_DefaultValue;
+
+ sal_Int32 m_IsNullable;
+ sal_Int32 m_Precision;
+ sal_Int32 m_Scale;
+ sal_Int32 m_Type;
+
+ bool m_IsAutoIncrement;
+ bool m_IsRowVersion;
+ bool m_IsCurrency;
+
+ OUString m_CatalogName;
+ OUString m_SchemaName;
+ OUString m_TableName;
+
+ using OColumnDescriptor_BASE::rBHelper;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+ virtual ~OColumn() override;
+ public:
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+ OColumn( bool _bCase);
+ OColumn( const OUString& Name,
+ const OUString& TypeName,
+ const OUString& DefaultValue,
+ const OUString& Description,
+ sal_Int32 IsNullable,
+ sal_Int32 Precision,
+ sal_Int32 Scale,
+ sal_Int32 Type,
+ bool IsAutoIncrement,
+ bool IsRowVersion,
+ bool IsCurrency,
+ bool _bCase,
+ const OUString& CatalogName,
+ const OUString& SchemaName,
+ const OUString& TableName);
+
+ DECLARE_SERVICE_INFO();
+ //XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ // ODescriptor
+ virtual void construct() override;
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing() override;
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ // XNamed
+ virtual OUString SAL_CALL getName( ) override;
+ virtual void SAL_CALL setName( const OUString& aName ) override;
+ // XDataDescriptorFactory
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override;
+ };
+
+}
+
+#endif // INCLUDED_CONNECTIVITY_SDBCX_VCOLUMN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VDescriptor.hxx b/include/connectivity/sdbcx/VDescriptor.hxx
new file mode 100644
index 000000000..3147a5187
--- /dev/null
+++ b/include/connectivity/sdbcx/VDescriptor.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SDBCX_VDESCRIPTOR_HXX
+#define INCLUDED_CONNECTIVITY_SDBCX_VDESCRIPTOR_HXX
+
+#include <comphelper/propertycontainer.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/stl_types.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+
+namespace connectivity::sdbcx
+ {
+
+ // = ODescriptor
+
+ typedef ::comphelper::OPropertyContainer ODescriptor_PBASE;
+ class OOO_DLLPUBLIC_DBTOOLS ODescriptor
+ :public ODescriptor_PBASE
+ ,public css::lang::XUnoTunnel
+ {
+ protected:
+ OUString m_Name;
+
+ /** helper for derived classes to implement OPropertyArrayUsageHelper::createArrayHelper
+
+ This method just calls describeProperties, and flags all properties as READONLY if and
+ only if we do *not* act as descriptor, but as final object.
+
+ @seealso isNew
+ */
+ ::cppu::IPropertyArrayHelper* doCreateArrayHelper() const;
+
+ private:
+ comphelper::UStringMixEqual m_aCase;
+ bool m_bNew;
+
+ public:
+ ODescriptor(::cppu::OBroadcastHelper& _rBHelper, bool _bCase, bool _bNew = false);
+
+ virtual ~ODescriptor() override;
+
+ bool isNew() const { return m_bNew; }
+ void setNew(bool _bNew);
+
+ bool isCaseSensitive() const { return m_aCase.isCaseSensitive(); }
+
+ virtual void construct();
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( );
+
+ // css::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ // retrieves the ODescriptor implementation of a given UNO component, and returns its ->isNew flag
+ static bool isNew( const css::uno::Reference< css::uno::XInterface >& _rxDescriptor );
+ };
+
+}
+
+#endif // INCLUDED_CONNECTIVITY_SDBCX_VDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VTable.hxx b/include/connectivity/sdbcx/VTable.hxx
new file mode 100644
index 000000000..6d575615f
--- /dev/null
+++ b/include/connectivity/sdbcx/VTable.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SDBCX_VTABLE_HXX
+#define INCLUDED_CONNECTIVITY_SDBCX_VTABLE_HXX
+
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
+#include <com/sun/star/sdbcx/XRename.hpp>
+#include <com/sun/star/sdbcx/XAlterTable.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/container/XNamed.hpp>
+#include <connectivity/sdbcx/IRefreshable.hxx>
+#include <connectivity/sdbcx/VDescriptor.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+
+namespace com::sun::star::sdbc { class XDatabaseMetaData; }
+
+namespace connectivity::sdbcx
+ {
+
+ class OTable;
+ class OCollection;
+
+ typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XColumnsSupplier,
+ css::sdbcx::XKeysSupplier,
+ css::container::XNamed,
+ css::lang::XServiceInfo> OTableDescriptor_BASE;
+
+ typedef ::cppu::ImplHelper4< css::sdbcx::XDataDescriptorFactory,
+ css::sdbcx::XIndexesSupplier,
+ css::sdbcx::XRename,
+ css::sdbcx::XAlterTable > OTable_BASE;
+
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OTable> OTable_PROP;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OTable :
+ public cppu::BaseMutex,
+ public OTable_BASE,
+ public OTableDescriptor_BASE,
+ public IRefreshableColumns,
+ public OTable_PROP,
+ public ODescriptor
+ {
+ protected:
+ OUString m_CatalogName;
+ OUString m_SchemaName;
+ OUString m_Description;
+ OUString m_Type;
+
+ // no Reference! see OCollection::acquire
+ std::unique_ptr<OCollection> m_xKeys;
+ std::unique_ptr<OCollection> m_xColumns;
+ std::unique_ptr<OCollection> m_xIndexes;
+ OCollection* m_pTables; // must hold his own container to notify him when renaming
+
+ using OTableDescriptor_BASE::rBHelper;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 _nId ) const override;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+ public:
+ OTable( OCollection* _pTables,
+ bool _bCase);
+ OTable( OCollection* _pTables,
+ bool _bCase,
+ const OUString& Name,
+ const OUString& Type,
+ const OUString& Description = OUString(),
+ const OUString& SchemaName = OUString(),
+ const OUString& CatalogName = OUString());
+
+ virtual ~OTable() override;
+
+ DECLARE_SERVICE_INFO();
+ //XInterface
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+
+ // ODescriptor
+ virtual void construct() override;
+ virtual void refreshColumns() override;
+ virtual void refreshKeys();
+ virtual void refreshIndexes();
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing() override;
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ // XColumnsSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override;
+ // XKeysSupplier
+ virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getKeys( ) override;
+ // XNamed
+ virtual OUString SAL_CALL getName() override;
+ virtual void SAL_CALL setName( const OUString& aName ) override;
+ // XDataDescriptorFactory
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor() override;
+ // XIndexesSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getIndexes( ) override;
+ // XRename
+ virtual void SAL_CALL rename( const OUString& newName ) override;
+ // XAlterTable
+ virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+
+ // helper method
+ virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() const;
+ };
+
+}
+
+#endif // INCLUDED_CONNECTIVITY_SDBCX_VTABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VView.hxx b/include/connectivity/sdbcx/VView.hxx
new file mode 100644
index 000000000..3a7714f95
--- /dev/null
+++ b/include/connectivity/sdbcx/VView.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SDBCX_VVIEW_HXX
+#define INCLUDED_CONNECTIVITY_SDBCX_VVIEW_HXX
+
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <comphelper/broadcasthelper.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <com/sun/star/container/XNamed.hpp>
+#include <connectivity/sdbcx/VDescriptor.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/implbase.hxx>
+
+namespace com::sun::star::sdbc { class XDatabaseMetaData; }
+
+namespace connectivity::sdbcx
+ {
+
+ typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo,
+ css::container::XNamed> OView_BASE;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OView :
+ public ::comphelper::OMutexAndBroadcastHelper,
+ public OView_BASE,
+ public ::comphelper::OIdPropertyArrayUsageHelper<OView>,
+ public ODescriptor
+ {
+ protected:
+ OUString m_CatalogName;
+ OUString m_SchemaName;
+ OUString m_Command;
+ sal_Int32 m_CheckOption;
+ // need for the getName method
+ css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+
+ public:
+ DECLARE_SERVICE_INFO();
+
+ OView(bool _bCase,const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _xMetaData);
+ OView( bool _bCase,
+ const OUString& _rName,
+ const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _xMetaData,
+ const OUString& _rCommand = OUString(),
+ const OUString& _rSchemaName = OUString(),
+ const OUString& _rCatalogName = OUString());
+ virtual ~OView() override;
+
+ // ODescriptor
+ virtual void construct() override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ // XNamed
+ virtual OUString SAL_CALL getName( ) override;
+ virtual void SAL_CALL setName( const OUString& ) override;
+ };
+
+}
+
+#endif // INCLUDED_CONNECTIVITY_SDBCX_VVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqlbison_exports.hxx b/include/connectivity/sqlbison_exports.hxx
new file mode 100644
index 000000000..ba0dbd9c5
--- /dev/null
+++ b/include/connectivity/sqlbison_exports.hxx
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+
+namespace connectivity { class OSQLParseNode; }
+namespace connectivity { class OSQLParser; }
+
+OUString ConvertLikeToken(const ::connectivity::OSQLParseNode* pTokenNode, const ::connectivity::OSQLParseNode* pEscapeNode, bool bInternational);
+int SQLyyparse();
+void setParser( ::connectivity::OSQLParser* );
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqlerror.hxx b/include/connectivity/sqlerror.hxx
new file mode 100644
index 000000000..252fe479e
--- /dev/null
+++ b/include/connectivity/sqlerror.hxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SQLERROR_HXX
+#define INCLUDED_CONNECTIVITY_SQLERROR_HXX
+
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <optional>
+#include <memory>
+
+namespace connectivity
+{
+
+
+ //= ErrorCondition
+
+ /** the type of error codes to be used in SQLExceptions
+
+ @see css::sdbc::SQLException::ErrorCode
+ */
+ typedef ::sal_Int32 ErrorCode;
+
+ /** error condition values as defined in css::sdb::ErrorCondition
+ */
+ typedef ::sal_Int32 ErrorCondition;
+
+
+ //= SQLError
+
+ class SQLError_Impl;
+
+ /** a class which provides helpers for working with SQLErrors
+
+ In particular, this class provides vendor-specific error codes (where
+ the vendor is OpenOffice.org Base), which can be used in OOo's various
+ database drivers, and checked in application-level code, to properly
+ recognize highly specific error conditions.
+
+ @see css::sdb::ErrorCondition
+ */
+ class OOO_DLLPUBLIC_DBTOOLS SQLError
+ {
+ public:
+ SQLError();
+ ~SQLError();
+
+ /** returns the message associated with a given error condition, after (optionally) replacing
+ a placeholder with a given string
+
+ Some error messages need to contain references to runtime-dependent data (say, the
+ name of a concrete table in the database), which in the resource file's strings are
+ represented by a placeholder, namely $1$, $2, and so on. This method allows to
+ retrieve such an error message, and replace up to 3 placeholders with their concrete
+ values.
+
+ In a non-product build, assertions will fire if the number of placeholders in the
+ message's resource string does not match the number of passed parameter values.
+
+ As specified in the css::sdb::ErrorCondition type,
+ error messages thrown by core components of OpenOffice.org Base will contain
+ a standardized prefix &quot;[OOoBase]&quot; in every message.
+
+ @see css::sdb::ErrorCondition
+ */
+ OUString getErrorMessage(
+ const ErrorCondition _eCondition
+ ) const;
+
+ /** returns the error code associated with a given error condition
+
+ @see getErrorMessage
+ @see css::sdb::ErrorCondition
+ @see css::sdbc::SQLException::ErrorCode
+ */
+ static ErrorCode
+ getErrorCode( const ErrorCondition _eCondition );
+
+ /** returns the prefix which is used for OpenOffice.org Base's error messages
+
+ As specified in the css::sdb::ErrorCondition type,
+ error messages thrown by core components of OpenOffice.org Base will
+ contain a standardized prefix in every message. <code>getBaseErrorMessagePrefix</code>
+ returns this prefix, so clients of such error messages might decide to strip this
+ prefix before presenting the message to the user, or use it to determine
+ whether a concrete error has been raised by a OpenOffice.org core component.
+ */
+ static const OUString&
+ getMessagePrefix();
+
+
+ /** throws an SQLException describing the given error condition
+
+ The thrown SQLException will contain the OOo-specific error code which derives
+ from the given error condition, and the error message associated with that condition.
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occurred. This will be filled in as
+ <member scope="css::uno">Exception::Context</member> member.
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ void raiseException(
+ const ErrorCondition _eCondition,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext,
+ const std::optional<OUString>& _rParamValue1 = std::nullopt,
+ const std::optional<OUString>& _rParamValue2 = std::nullopt,
+ const std::optional<OUString>& _rParamValue3 = std::nullopt
+ ) const;
+
+ /** throws an SQLException describing the given error condition
+
+ The thrown SQLException will contain the OOo-specific error code which derives
+ from the given error condition, and the error message associated with that condition.
+
+ Note: You should prefer the version of raiseException which takes
+ an additional Context parameter, since this allows clients of your
+ exception to examine where the error occurred.
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ void raiseException(
+ const ErrorCondition _eCondition
+ ) const;
+
+ /** raises a typed exception, that is, a UNO exception which is derived from
+ css::sdbc::SQLException
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occurred. This will be filled in as
+ <member scope="css::uno">Exception::Context</member> member.
+
+ @param _rExceptionType
+ the type of the exception to throw. This type <em>must</em> specify
+ an exception class derived from css::sdbc::SQLException.
+
+ @throws ::std::bad_cast
+ if <arg>_rExceptionType</arg> does not specify an exception class derived from
+ css::sdbc::SQLException.
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ void raiseTypedException(
+ const ErrorCondition _eCondition,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext,
+ const css::uno::Type& _rExceptionType
+ ) const;
+
+ /** retrieves an <code>SQLException</code> object which contains information about
+ the given error condition
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occurred. This will be filled in as
+ <member scope="css::uno">Exception::Context</member> member.
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ css::sdbc::SQLException
+ getSQLException(
+ const ErrorCondition _eCondition,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext,
+ const std::optional<OUString>& _rParamValue1 = std::nullopt,
+ const std::optional<OUString>& _rParamValue2 = std::nullopt,
+ const std::optional<OUString>& _rParamValue3 = std::nullopt
+ ) const;
+
+ private:
+ std::shared_ptr< SQLError_Impl > m_pImpl;
+ };
+
+
+} // namespace connectivity
+
+
+#endif // INCLUDED_CONNECTIVITY_SQLERROR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqliterator.hxx b/include/connectivity/sqliterator.hxx
new file mode 100644
index 000000000..201b31294
--- /dev/null
+++ b/include/connectivity/sqliterator.hxx
@@ -0,0 +1,341 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_SQLITERATOR_HXX
+#define INCLUDED_CONNECTIVITY_SQLITERATOR_HXX
+
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <connectivity/IParseContext.hxx>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include <connectivity/CommonTools.hxx>
+#include <rtl/ref.hxx>
+
+#include <memory>
+#include <optional>
+#include <vector>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace com::sun::star::sdbc { class XConnection; }
+namespace com::sun::star::beans { class XPropertySet; }
+
+namespace connectivity
+{
+ enum class TraversalParts
+ {
+ Parameters = 0x0001,
+ TableNames = 0x0002,
+ SelectColumns = 0x0006, // note that this includes TableNames. No SelectColumns without TableNames
+
+ // Those are not implemented currently
+ // GroupColumns = 0x0008,
+ // OrderColumns = 0x0010,
+ // SelectColumns = 0x0020,
+ // CreateColumns = 0x0040,
+
+ All = 0xFFFF
+ };
+}
+namespace o3tl
+{
+ template<> struct typed_flags<connectivity::TraversalParts> : is_typed_flags<connectivity::TraversalParts, 0xffff> {};
+}
+
+namespace connectivity
+{
+
+ class OSQLParseNode;
+ class OSQLParser;
+
+ typedef ::std::pair<const OSQLParseNode*,const OSQLParseNode* > TNodePair;
+
+ enum class OSQLStatementType {
+ Unknown,
+ Select,
+ Insert,
+ Update,
+ Delete,
+ OdbcCall,
+ CreateTable
+ };
+
+ struct OSQLParseTreeIteratorImpl;
+
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParseTreeIterator final
+ {
+ private:
+ std::optional<css::sdbc::SQLException> m_xErrors; // contains the error while iterating through the statement
+ const OSQLParseNode* m_pParseTree; // current ParseTree
+ const OSQLParser& m_rParser; // if set used for general error messages from the context
+ OSQLStatementType m_eStatementType;
+ ::rtl::Reference<OSQLColumns> m_aSelectColumns; // all columns from the Select clause
+ ::rtl::Reference<OSQLColumns> m_aParameters; // all parameters
+ ::rtl::Reference<OSQLColumns> m_aGroupColumns; // the group by columns
+ ::rtl::Reference<OSQLColumns> m_aOrderColumns; // the order by columns
+ ::rtl::Reference<OSQLColumns> m_aCreateColumns; // the columns for Create table clause
+
+ ::std::unique_ptr< OSQLParseTreeIteratorImpl > m_pImpl;
+
+ void traverseParameter(const OSQLParseNode* _pParseNode,const OSQLParseNode* _pColumnRef,const OUString& _aColumnName, OUString& _aTableRange, const OUString& _rColumnAlias);
+ // inserts a table into the map
+ void traverseOneTableName( OSQLTables& _rTables,const OSQLParseNode * pTableName, const OUString & rTableRange );
+ void traverseSearchCondition(OSQLParseNode const * pSearchCondition);
+ void traverseOnePredicate(
+ OSQLParseNode const * pColumnRef,
+ OUString& aValue,
+ OSQLParseNode const * pParameter);
+ void traverseByColumnNames(const OSQLParseNode* pSelectNode, bool _bOrder);
+ void traverseParameters(const OSQLParseNode* pSelectNode);
+
+ const OSQLParseNode* getTableNode( OSQLTables& _rTables, const OSQLParseNode* pTableRef, OUString& aTableRange );
+ void getQualified_join( OSQLTables& _rTables, const OSQLParseNode *pTableRef, OUString& aTableRange );
+ void getSelect_statement(OSQLTables& _rTables,const OSQLParseNode* pSelect);
+ // get all the column names of m_aSelectColumns and return in a vector sorted by a UStringMixLess that's constructed from
+ // isCaseSensitive()
+ std::vector<OUString> getSelectColumnNames() const;
+ // rColumnNames is expected to be sorted as returned by getSelectColumnNames
+ OUString getUniqueColumnName(const std::vector<OUString>& rColumnNames, const OUString & rColumnName) const;
+
+ /** finds the column with a given name, belonging to a given table, in a given tables collection
+ @param _rTables
+ the tables collection to look in
+ @param rColumnName
+ the column name to look for
+ @param rTableRange
+ the table alias name; if empty, look in all tables
+ @return
+ the desired column object, or <NULL/> if no such column could be found
+ */
+ static css::uno::Reference< css::beans::XPropertySet > findColumn(
+ const OSQLTables& _rTables, const OUString & rColumnName, OUString & rTableRange );
+
+ /** finds a column with a given name, belonging to a given table
+ @param rColumnName
+ the column name to look for
+ @param rTableRange
+ the table alias name; if empty, look in all tables
+ @param _bLookInSubTables
+ <TRUE/> if and only if not only our direct tables, but also our sub tables (from sub selects)
+ should be searched
+ @return
+ */
+ css::uno::Reference< css::beans::XPropertySet > findColumn(
+ const OUString & rColumnName, OUString & rTableRange, bool _bLookInSubTables );
+
+ /** finds a column with a given name among the select columns
+ @param rColumnName
+ the column name to look for
+ @return
+ */
+ css::uno::Reference< css::beans::XPropertySet > findSelectColumn(
+ std::u16string_view rColumnName );
+
+ void setSelectColumnName(const OUString& rColumnName, const OUString& rColumnAlias, const OUString& rTableRange, bool bFkt = false, sal_Int32 _nType = css::sdbc::DataType::VARCHAR, bool bAggFkt = false);
+ void appendColumns(const OUString& _rTableAlias, const OSQLTable& _rTable);
+ // Other member variables that should be available in the "set" functions
+ // can be defined in the derived class. They can be initialized
+ // in its constructor and, after the "traverse" routines have been used,
+ // they can be queried using other functions.
+
+ OSQLParseTreeIterator(const OSQLParseTreeIterator & rIter) = delete;
+
+ public:
+ OSQLParseTreeIterator(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::container::XNameAccess >& _rxTables,
+ const OSQLParser& _rParser );
+ ~OSQLParseTreeIterator();
+
+ void dispose();
+ bool isCaseSensitive() const;
+ // The parse tree to be analysed/traversed:
+ // If NULL is passed, the current parse tree will be deleted and the error status cleared.
+ void setParseTree(const OSQLParseNode * pNewParseTree);
+ const OSQLParseNode * getParseTree() const { return m_pParseTree; };
+
+ // subtrees in case of a select statement
+ const OSQLParseNode* getWhereTree() const;
+ const OSQLParseNode* getOrderTree() const;
+ const OSQLParseNode* getGroupByTree() const;
+ const OSQLParseNode* getHavingTree() const;
+
+ const OSQLParseNode* getSimpleWhereTree() const;
+ const OSQLParseNode* getSimpleOrderTree() const;
+ const OSQLParseNode* getSimpleGroupByTree() const;
+ const OSQLParseNode* getSimpleHavingTree() const;
+
+ /** returns the errors which occurred during parsing.
+
+ The returned object contains a chain (via SQLException::NextException) of SQLExceptions.
+ */
+ const css::sdbc::SQLException& getErrors() const { return *m_xErrors; }
+ bool hasErrors() const { return bool(m_xErrors); }
+
+ // statement type (already set in setParseTree):
+ OSQLStatementType getStatementType() const { return m_eStatementType; }
+
+ /** traverses the complete statement tree, and fills all our data with
+ the information obatined during traversal.
+
+ Implemented by calling the single traverse* methods in the proper
+ order (depending on the statement type).
+ */
+ void traverseAll();
+
+ // The TableRangeMap contains all tables associated with the range name found first.
+ const OSQLTables& getTables() const;
+
+ const ::rtl::Reference<OSQLColumns>& getSelectColumns() const { return m_aSelectColumns;}
+ const ::rtl::Reference<OSQLColumns>& getGroupColumns() const { return m_aGroupColumns;}
+ const ::rtl::Reference<OSQLColumns>& getOrderColumns() const { return m_aOrderColumns;}
+ const ::rtl::Reference<OSQLColumns>& getParameters() const { return m_aParameters; }
+
+ /** return the columname and the table range
+ @param _pColumnRef
+ The column ref parse node.
+ @param _rColumnName
+ The column name to be set.
+ @param _rTableRange
+ The table range to be set.
+ */
+ void getColumnRange( const OSQLParseNode* _pColumnRef,
+ OUString &_rColumnName,
+ OUString& _rTableRange) const;
+
+ /** retrieves a column's name, table range, and alias
+
+ @param _pColumnRef
+ The column_ref parse node.
+ @param _out_rColumnName
+ The column name to be set.
+ @param _out_rTableRange
+ The table range to be set.
+ @param _out_rColumnAliasIfPresent
+ If the column specified by _pColumnRef is part of the select columns, and contains a column alias there,
+ this alias is returned here.
+ */
+ void getColumnRange( const OSQLParseNode* _pColumnRef,
+ OUString& _out_rColumnName,
+ OUString& _out_rTableRange,
+ OUString& _out_rColumnAliasIfPresent
+ ) const;
+
+ /** return the alias name of a column
+ @param _pDerivedColumn
+ The parse node where SQL_ISRULE(_pDerivedColumn,derived_column) must be true
+ @return
+ The alias name of the column or an empty string.
+ */
+ static OUString getColumnAlias(const OSQLParseNode* _pDerivedColumn);
+
+ /** return the columname and the table range
+ @param _pColumnRef
+ The column ref parse node.
+ @param _xMetaData
+ The database meta data.
+ @param _rColumnName
+ The column name to be set.
+ @param _rTableRange
+ The table range to be set.
+ */
+ static void getColumnRange( const OSQLParseNode* _pColumnRef,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ OUString &_rColumnName,
+ OUString& _rTableRange);
+
+ // return true when the tableNode is a rule like catalog_name, schema_name or table_name
+ static bool isTableNode(const OSQLParseNode* _pTableNode);
+
+ // tries to find the correct type of the function
+ sal_Int32 getFunctionReturnType(const OSQLParseNode* _pNode );
+
+ // returns a lis of all joined columns
+ ::std::vector< TNodePair >& getJoinConditions() const;
+
+ private:
+
+ /** traverses the list of table names, and fills _rTables
+ */
+ bool traverseTableNames( OSQLTables& _rTables );
+
+ /// traverses columns in a SELECT statement
+ bool traverseSelectColumnNames(const OSQLParseNode* pSelectNode);
+ /// traverses columns in a CREATE TABLE statement
+ void traverseCreateColumns(const OSQLParseNode* pSelectNode);
+
+ bool traverseOrderByColumnNames(const OSQLParseNode* pSelectNode);
+ bool traverseGroupByColumnNames(const OSQLParseNode* pSelectNode);
+
+ bool traverseSelectionCriteria(const OSQLParseNode* pSelectNode);
+
+ /** constructs a new iterator, which inherits some of the settings from a parent iterator
+ */
+ OSQLParseTreeIterator(
+ const OSQLParseTreeIterator& _rParentIterator,
+ const OSQLParser& _rParser,
+ const OSQLParseNode* pRoot );
+
+ /** creates a table object and inserts it into our tables collection
+
+ only used when we're iterating through a CREATE TABLE statement
+ */
+ OSQLTable impl_createTableObject(
+ const OUString& rTableName, const OUString& rCatalogName, const OUString& rSchemaName );
+
+ /** locates a record source (a table or query) with the given name
+ */
+ OSQLTable impl_locateRecordSource(
+ const OUString& _rComposedName
+ );
+
+ /** implementation for both traverseAll and traverseSome
+ */
+ void impl_traverse( TraversalParts _nIncludeMask );
+
+ /** retrieves the parameter columns of the given query
+ */
+ void impl_getQueryParameterColumns( const OSQLTable& _rQuery );
+
+ void setOrderByColumnName(const OUString & rColumnName, OUString & rTableRange, bool bAscending);
+ void setGroupByColumnName(const OUString & rColumnName, OUString & rTableRange);
+
+ /** appends an SQLException corresponding to the given error code to our error collection
+
+ @param _eError
+ the code of the error which occurred
+ @param _pReplaceToken1
+ if not <NULL/>, the first occurrence of '#' in the error message will be replaced
+ with the given token
+ @param _pReplaceToken2
+ if not <NULL/>, and if _rReplaceToken1 is not <NULL/>, the second occurrence of '#'
+ in the error message will be replaced with _rReplaceToken2
+ */
+ void impl_appendError( IParseContext::ErrorCode _eError,
+ const OUString* _pReplaceToken1 = nullptr, const OUString* _pReplaceToken2 = nullptr );
+
+ /** appends an SQLException corresponding to the given error code to our error collection
+ */
+ void impl_appendError( const css::sdbc::SQLException& _rError );
+
+ void impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition);
+ };
+}
+
+#endif // INCLUDED_CONNECTIVITY_SQLITERATOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqlnode.hxx b/include/connectivity/sqlnode.hxx
new file mode 100644
index 000000000..3bd9327e1
--- /dev/null
+++ b/include/connectivity/sqlnode.hxx
@@ -0,0 +1,455 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_SQLNODE_HXX
+#define INCLUDED_CONNECTIVITY_SQLNODE_HXX
+
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <connectivity/dbmetadata.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <memory>
+#include <set>
+#include <string_view>
+#include <vector>
+#include <rtl/ustrbuf.hxx>
+
+namespace com::sun::star::lang { struct Locale; }
+namespace com::sun::star::sdbc { class SQLException; }
+namespace com::sun::star::sdbc { class XDatabaseMetaData; }
+
+namespace com::sun::star
+{
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ }
+ namespace container
+ {
+ class XNameAccess;
+ }
+}
+
+#define ORDER_BY_CHILD_POS 5
+#define TABLE_EXPRESSION_CHILD_COUNT 9
+
+namespace connectivity
+{
+ class OSQLParser;
+ class IParseContext;
+
+ enum class SQLNodeType { Rule, ListRule, CommaListRule,
+ Keyword, Name,
+ String, IntNum, ApproxNum,
+ Equal, Less, Great, LessEq, GreatEq, NotEqual,
+ Punctuation, AccessDate, Concat};
+
+ typedef ::std::set< OUString > QueryNameSet;
+
+ //= SQLParseNodeParameter
+
+ struct SQLParseNodeParameter
+ {
+ const css::lang::Locale& rLocale;
+ ::dbtools::DatabaseMetaData aMetaData;
+ OSQLParser* pParser;
+ std::shared_ptr< QueryNameSet > pSubQueryHistory;
+ css::uno::Reference< css::util::XNumberFormatter > xFormatter;
+ css::uno::Reference< css::beans::XPropertySet > xField;
+ OUString sPredicateTableAlias;
+ css::uno::Reference< css::container::XNameAccess > xQueries; // see bParseToSDBCLevel
+ const IParseContext& m_rContext;
+ OUString sDecSep;
+ bool bQuote : 1; /// should we quote identifiers?
+ bool bInternational : 1; /// should we internationalize keywords and placeholders?
+ bool bPredicate : 1; /// are we going to parse a mere predicate?
+ bool bParseToSDBCLevel : 1; /// should we create an SDBC-level statement (e.g. with substituted sub queries)?
+
+ SQLParseNodeParameter(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::util::XNumberFormatter >& _xFormatter,
+ const css::uno::Reference< css::beans::XPropertySet >& _xField,
+ const OUString &_sPredicateTableAlias,
+ const css::lang::Locale& _rLocale,
+ const IParseContext* _pContext,
+ bool _bIntl,
+ bool _bQuote,
+ OUString _sDecSep,
+ bool _bPredicate,
+ bool _bParseToSDBC
+ );
+ };
+
+ //= OSQLParseNode
+
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParseNode
+ {
+ friend class OSQLParser;
+
+ std::vector< std::unique_ptr<OSQLParseNode> >
+ m_aChildren;
+ OSQLParseNode* m_pParent; // pParent for reverse linkage in the tree
+ OUString m_aNodeValue; // token name, or empty in case of rules,
+ // or OUString in case of
+ // OUString, INT, etc.
+ SQLNodeType m_eNodeType; // see above
+ sal_uInt32 m_nNodeID; // Rule ID (if IsRule())
+ // or Token ID (if !IsRule())
+ // Rule IDs and Token IDs can't
+ // be distinguished by their values,
+ // IsRule has to be used for that!
+ public:
+ enum Rule
+ {
+ UNKNOWN_RULE = 0, // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID)
+ // we make sure it is 0 so that it is the default-constructor value of this enum
+ // and std::map<foo,Rule>::operator[](bar) default-inserts UNKNOWN_RULE rather than select_statement (!)
+ select_statement,
+ table_exp,
+ table_ref_commalist,
+ table_ref,
+ catalog_name,
+ schema_name,
+ table_name,
+ opt_column_commalist,
+ column_commalist,
+ column_ref_commalist,
+ column_ref,
+ opt_order_by_clause,
+ ordering_spec_commalist,
+ ordering_spec,
+ opt_asc_desc,
+ where_clause,
+ opt_where_clause,
+ search_condition,
+ comparison,
+ comparison_predicate,
+ between_predicate,
+ like_predicate,
+ opt_escape,
+ test_for_null,
+ scalar_exp_commalist,
+ scalar_exp,
+ parameter_ref,
+ parameter,
+ general_set_fct,
+ range_variable,
+ column,
+ delete_statement_positioned,
+ delete_statement_searched,
+ update_statement_positioned,
+ update_statement_searched,
+ assignment_commalist,
+ assignment,
+ values_or_query_spec,
+ insert_statement,
+ insert_atom_commalist,
+ insert_atom,
+ from_clause,
+ qualified_join,
+ cross_union,
+ select_sublist,
+ derived_column,
+ column_val,
+ set_fct_spec,
+ boolean_term,
+ boolean_primary,
+ num_value_exp,
+ join_type,
+ position_exp,
+ extract_exp,
+ length_exp,
+ char_value_fct,
+ odbc_call_spec,
+ in_predicate,
+ existence_test,
+ unique_test,
+ all_or_any_predicate,
+ named_columns_join,
+ join_condition,
+ joined_table,
+ boolean_factor,
+ sql_not,
+ manipulative_statement,
+ subquery,
+ value_exp_commalist,
+ odbc_fct_spec,
+ union_statement,
+ outer_join_type,
+ char_value_exp,
+ term,
+ value_exp_primary,
+ value_exp,
+ selection,
+ fold,
+ char_substring_fct,
+ factor,
+ base_table_def,
+ base_table_element_commalist,
+ data_type,
+ column_def,
+ table_node,
+ as_clause,
+ opt_as,
+ op_column_commalist,
+ table_primary_as_range_column,
+ datetime_primary,
+ concatenation,
+ char_factor,
+ bit_value_fct,
+ comparison_predicate_part_2,
+ parenthesized_boolean_value_expression,
+ character_string_type,
+ other_like_predicate_part_2,
+ between_predicate_part_2,
+ null_predicate_part_2,
+ cast_spec,
+ window_function,
+ rule_count // last value
+ };
+
+ // must be ascii encoding for the value
+ OSQLParseNode(const char* _pValueStr,
+ SQLNodeType _eNodeType,
+ sal_uInt32 _nNodeID = 0);
+
+ OSQLParseNode(std::string_view _rValue,
+ SQLNodeType eNewNodeType,
+ sal_uInt32 nNewNodeID=0);
+
+ OSQLParseNode(const OUString& _rValue,
+ SQLNodeType _eNodeType,
+ sal_uInt32 _nNodeID = 0);
+
+ // copies the respective ParseNode
+ OSQLParseNode(const OSQLParseNode& rParseNode);
+ OSQLParseNode& operator=(const OSQLParseNode& rParseNode);
+
+ bool operator==(OSQLParseNode const & rParseNode) const;
+
+ // destructor destructs the tree recursively
+ virtual ~OSQLParseNode();
+
+ OSQLParseNode* getParent() const {return m_pParent;};
+
+ void setParent(OSQLParseNode* pParseNode) {m_pParent = pParseNode;};
+
+ size_t count() const {return m_aChildren.size();};
+ inline OSQLParseNode* getChild(sal_uInt32 nPos) const;
+
+ void append(OSQLParseNode* pNewSubTree);
+ void insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree);
+
+ OSQLParseNode* replace(OSQLParseNode* pOldSubTree, OSQLParseNode* pNewSubTree);
+
+ OSQLParseNode* removeAt(sal_uInt32 nPos);
+
+ void replaceNodeValue(const OUString& rTableAlias,const OUString& rColumnName);
+
+ /** parses the node to a string which can be passed to a driver's connection for execution
+
+ Any particles of the parse tree which represent application-level features - such
+ as queries appearing in the FROM part - are substituted, so that the resulting statement can
+ be executed at an SDBC-level connection.
+
+ @param _out_rString
+ is an output parameter taking the resulting SQL statement
+
+ @param _rxConnection
+ the connection relative to which to parse. This must be an SDB-level connection (e.g.
+ support the XQueriesSupplier interface) for the method to be able to do all necessary
+ substitutions.
+
+ @param _rParser
+ the SQLParser used to create the node. This is needed in case we need to parse
+ sub queries which are present in the SQL statement - those sub queries need to be parsed,
+ too, to check whether they contain nested sub queries.
+
+ @param _pErrorHolder
+ takes the error which occurred while generating the statement, if any. Might be <NULL/>,
+ in this case the error is not reported back, and can only be recognized by examining the
+ return value.
+
+ @return
+ <TRUE/> if and only if the parsing was successful.<br/>
+
+ Currently, there's only one condition how this method can fail: If it contains a nested
+ query which causes a cycle. E.g., consider a statement <code>SELECT * from "foo"</code>,
+ where <code>foo</code> is a query defined as <code>SELECT * FROM "bar"</code>, where
+ <code>bar</code> is defined as <code>SELECT * FROM "foo"</code>. This statement obviously
+ cannot be parsed to an executable statement.
+
+ If this method returns <FALSE/>, you're encouraged to check and handle the error in
+ <arg>_pErrorHolder</arg>.
+ */
+ bool parseNodeToExecutableStatement( OUString& _out_rString,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ OSQLParser& _rParser,
+ css::sdbc::SQLException* _pErrorHolder ) const;
+
+ void parseNodeToStr(OUString& rString,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const IParseContext* pContext = nullptr,
+ bool _bIntl = false,
+ bool _bQuote= true) const;
+
+ // quoted and internationalised
+ void parseNodeToPredicateStr(OUString& rString,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::util::XNumberFormatter > & xFormatter,
+ const css::lang::Locale& rIntl,
+ OUString _sDec,
+ const IParseContext* pContext = nullptr ) const;
+
+ void parseNodeToPredicateStr(OUString& rString,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::util::XNumberFormatter > & xFormatter,
+ const css::uno::Reference< css::beans::XPropertySet > & _xField,
+ const OUString &_sTableAlias,
+ const css::lang::Locale& rIntl,
+ OUString strDec,
+ const IParseContext* pContext = nullptr ) const;
+
+ OSQLParseNode* getByRule(OSQLParseNode::Rule eRule) const;
+
+#if OSL_DEBUG_LEVEL > 1
+ // shows the ParseTree with tabs and linefeeds
+ void showParseTree( OUString& rString ) const;
+ void showParseTree( OUStringBuffer& _inout_rBuf, sal_uInt32 nLevel ) const;
+#endif
+
+ SQLNodeType getNodeType() const {return m_eNodeType;};
+
+ // RuleId returns the RuleID of the node's rule (only if IsRule())
+ sal_uInt32 getRuleID() const {return m_nNodeID;}
+
+ /** returns the ID of the rule represented by the node
+ If the node does not represent a rule, UNKNOWN_RULE is returned
+ */
+ Rule getKnownRuleID() const;
+
+ // returns the TokenId of the node's token (only if !isRule())
+ sal_uInt32 getTokenID() const {return m_nNodeID;}
+
+ // IsRule tests whether a node is a rule (NonTerminal)
+ // ATTENTION: rules can be leaves, for example empty lists
+ bool isRule() const
+ { return (m_eNodeType == SQLNodeType::Rule) || (m_eNodeType == SQLNodeType::ListRule)
+ || (m_eNodeType == SQLNodeType::CommaListRule);}
+
+ // IsToken tests whether a Node is a Token (Terminal but not a rule)
+ bool isToken() const {return !isRule();}
+
+ const OUString& getTokenValue() const {return m_aNodeValue;}
+
+ bool isLeaf() const {return m_aChildren.empty();}
+
+ // negate only a searchcondition, any other rule could cause a gpf
+ static void negateSearchCondition(OSQLParseNode*& pSearchCondition, bool bNegate=false);
+
+ // normalize a logic form
+ // e.q. (a or b) and (c or d) <=> a and c or a and d or b and c or b and d
+ static void disjunctiveNormalForm(OSQLParseNode*& pSearchCondition);
+
+ // Simplifies logic expressions
+ // a and a = a
+ // a or a = a
+ // a and ( a + b) = a
+ // a or a and b = a
+ static void absorptions(OSQLParseNode*& pSearchCondition);
+
+ // erase unnecessary braces
+ static void eraseBraces(OSQLParseNode*& pSearchCondition);
+
+ // makes the logic formula a little smaller
+ static void compress(OSQLParseNode*& pSearchCondition);
+ // return the catalog, schema and tablename from this node
+ // _pTableNode must be a rule of that above or a SQL_TOKEN_NAME
+ static bool getTableComponents(const OSQLParseNode* _pTableNode,
+ css::uno::Any &_rCatalog,
+ OUString &_rSchema,
+ OUString &_rTable,
+ const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _xMetaData);
+
+ // substitute all occurrences of :var or [name] into the dynamic parameter ?
+ // _pNode will be modified if parameters exists
+ static void substituteParameterNames(OSQLParseNode const * _pNode);
+
+ /** return a table range when it exists.
+ */
+ static OUString getTableRange(const OSQLParseNode* _pTableRef);
+
+ protected:
+ // ParseNodeToStr concatenates all Tokens (leaves) of the ParseNodes.
+ void parseNodeToStr(OUString& rString,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::util::XNumberFormatter > & xFormatter,
+ const css::uno::Reference< css::beans::XPropertySet > & _xField,
+ const OUString &_sPredicateTableAlias,
+ const css::lang::Locale& rIntl,
+ const IParseContext* pContext,
+ bool _bIntl,
+ bool _bQuote,
+ OUString _sDecSep,
+ bool _bPredicate) const;
+
+ private:
+ void impl_parseNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam, bool bSimple=true ) const;
+ void impl_parseLikeNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam, bool bSimple=true ) const;
+ void impl_parseTableRangeNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+
+ /** parses a table_name node into a SQL statement particle.
+ @return
+ <TRUE/> if and only if parsing was successful, <FALSE/> if default handling should
+ be applied.
+ */
+ bool impl_parseTableNameNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+
+ bool addDateValue(OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ static OUString convertDateTimeString(const SQLParseNodeParameter& rParam, const OUString& rString);
+ static OUString convertDateString(const SQLParseNodeParameter& rParam, std::u16string_view rString);
+ static OUString convertTimeString(const SQLParseNodeParameter& rParam, std::u16string_view rString);
+ void parseLeaf(OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ };
+
+ inline OSQLParseNode* OSQLParseNode::getChild(sal_uInt32 nPos) const
+ {
+ return m_aChildren[nPos].get();
+ }
+
+ // utilities to query for a specific rule, token or punctuation
+ #define SQL_ISRULE(pParseNode, eRule) ((pParseNode)->isRule() && (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::eRule))
+ #define SQL_ISRULEOR2(pParseNode, e1, e2) ((pParseNode)->isRule() && ( \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2)))
+ #define SQL_ISRULEOR3(pParseNode, e1, e2, e3) ((pParseNode)->isRule() && ( \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e3)))
+ #define SQL_ISTOKEN(pParseNode, token) ((pParseNode)->isToken() && (pParseNode)->getTokenID() == SQL_TOKEN_##token)
+ #define SQL_ISTOKENOR2(pParseNode, tok0, tok1) ((pParseNode)->isToken() && ( (pParseNode)->getTokenID() == SQL_TOKEN_##tok0 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok1 ))
+ #define SQL_ISTOKENOR3(pParseNode, tok0, tok1, tok2) ((pParseNode)->isToken() && ( (pParseNode)->getTokenID() == SQL_TOKEN_##tok0 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok1 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok2 ))
+ #define SQL_ISPUNCTUATION(pParseNode, aString) ((pParseNode)->getNodeType() == SQLNodeType::Punctuation && (pParseNode)->getTokenValue() == (aString))
+}
+
+#endif // INCLUDED_CONNECTIVITY_SQLNODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqlparse.hxx b/include/connectivity/sqlparse.hxx
new file mode 100644
index 000000000..b92ff3b1c
--- /dev/null
+++ b/include/connectivity/sqlparse.hxx
@@ -0,0 +1,230 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_SQLPARSE_HXX
+#define INCLUDED_CONNECTIVITY_SQLPARSE_HXX
+
+#include <memory>
+#include <string_view>
+
+#include <com/sun/star/uno/Reference.h>
+#include <osl/mutex.hxx>
+#include <connectivity/sqlnode.hxx>
+#include <connectivity/IParseContext.hxx>
+#include <connectivity/dbtoolsdllapi.hxx>
+#include <connectivity/sqlerror.hxx>
+#include <salhelper/singletonref.hxx>
+
+#include <map>
+
+namespace com::sun::star::i18n { class XCharacterClassification; }
+namespace com::sun::star::i18n { class XLocaleData4; }
+
+namespace com::sun::star
+{
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ }
+}
+
+namespace connectivity
+{
+ class OSQLScanner;
+
+ //= OParseContext
+
+ class OParseContext final : public IParseContext
+ {
+ public:
+ OParseContext();
+
+ virtual ~OParseContext();
+ // retrieves language specific error messages
+ virtual OUString getErrorMessage(ErrorCode _eCodes) const override;
+
+ // retrieves language specific keyword strings (only ASCII allowed)
+ virtual OString getIntlKeywordAscii(InternationalKeyCode _eKey) const override;
+
+ // finds out, if we have an international keyword (only ASCII allowed)
+ virtual InternationalKeyCode getIntlKeyCode(const OString& rToken) const override;
+
+ // determines the default international setting
+ static const css::lang::Locale& getDefaultLocale();
+
+ /** gets a locale instance which should be used when parsing in the context specified by this instance
+ <p>if this is not overridden by derived classes, it returns the static default locale.</p>
+ */
+ virtual css::lang::Locale getPreferredLocale( ) const override;
+ };
+
+ // OSQLParseNodesContainer
+ // garbage collection of nodes
+
+ class OSQLParseNodesContainer
+ {
+ ::osl::Mutex m_aMutex;
+ ::std::vector< OSQLParseNode* > m_aNodes;
+ public:
+ OSQLParseNodesContainer();
+ ~OSQLParseNodesContainer();
+
+ void push_back(OSQLParseNode* _pNode);
+ void erase(OSQLParseNode* _pNode);
+ void clear();
+ void clearAndDelete();
+ };
+
+ typedef salhelper::SingletonRef<OSQLParseNodesContainer> OSQLParseNodesGarbageCollector;
+
+ //= OSQLParser
+
+ struct OSQLParser_Data
+ {
+ css::lang::Locale aLocale;
+ ::connectivity::SQLError aErrors;
+ };
+
+ /** Parser for SQL92
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParser
+ {
+ friend class OSQLParseNode;
+ friend class OSQLInternalNode;
+ friend struct SQLParseNodeParameter;
+
+ private:
+ typedef ::std::map< sal_uInt32, OSQLParseNode::Rule > RuleIDMap;
+ // static parts for parsers
+ static sal_uInt32 s_nRuleIDs[OSQLParseNode::rule_count + 1];
+ static RuleIDMap s_aReverseRuleIDLookup;
+ static OParseContext s_aDefaultContext;
+
+ static OSQLScanner* s_pScanner;
+ static OSQLParseNodesGarbageCollector* s_pGarbageCollector;
+ static sal_Int32 s_nRefCount;
+
+ // information on the current parse action
+ const IParseContext* m_pContext;
+ std::unique_ptr<OSQLParseNode> m_pParseTree; // result from parsing
+ ::std::unique_ptr< OSQLParser_Data >
+ m_pData;
+ OUString m_sFieldName; // current field name for a predicate
+ OUString m_sErrorMessage;// current error msg
+
+ css::uno::Reference< css::beans::XPropertySet >
+ m_xField; // current field
+ css::uno::Reference< css::util::XNumberFormatter >
+ m_xFormatter; // current number formatter
+ sal_Int32 m_nFormatKey; // numberformat, which should be used
+ sal_Int32 m_nDateFormatKey;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::i18n::XCharacterClassification> m_xCharClass;
+ static css::uno::Reference< css::i18n::XLocaleData4> s_xLocaleData;
+
+ // convert a string into double trim it to scale of _nscale and then transform it back to string
+ OUString stringToDouble(const OUString& _rValue,sal_Int16 _nScale);
+ OSQLParseNode* buildDate(sal_Int32 _nType,OSQLParseNode*& pLiteral);
+ bool extractDate(OSQLParseNode const * pLiteral,double& _rfValue);
+ void killThousandSeparator(OSQLParseNode* pLiteral);
+ OSQLParseNode* convertNode(sal_Int32 nType, OSQLParseNode* pLiteral);
+ // makes a string out of a number, pLiteral will be deleted
+ OSQLParseNode* buildNode_STR_NUM(OSQLParseNode*& pLiteral);
+ OSQLParseNode* buildNode_Date(const double& fValue, sal_Int32 nType);
+
+ static ::osl::Mutex& getMutex();
+
+ public:
+ // if NULL, a default context will be used
+ // the context must live as long as the parser
+ OSQLParser(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const IParseContext* _pContext = nullptr);
+ ~OSQLParser();
+
+ // Parsing an SQLStatement
+ std::unique_ptr<OSQLParseNode> parseTree(OUString& rErrorMessage,
+ const OUString& rStatement,
+ bool bInternational = false);
+
+ // Check a Predicate
+ // set bUseRealName to false if you pass a xField that comes from where you got that field,
+ // as opposed from to from yourself.
+ std::unique_ptr<OSQLParseNode> predicateTree(OUString& rErrorMessage, const OUString& rStatement,
+ const css::uno::Reference< css::util::XNumberFormatter > & xFormatter,
+ const css::uno::Reference< css::beans::XPropertySet > & xField,
+ bool bUseRealName = true);
+
+ // Access to the context
+ const IParseContext& getContext() const {return *m_pContext;}
+
+ /// access to the SQLError instance owned by this parser
+ const SQLError& getErrorHelper() const;
+
+ // TokenIDToStr: token name belonging to a token number.
+ static OString TokenIDToStr(sal_uInt32 nTokenID, const IParseContext* pContext = nullptr);
+
+#if OSL_DEBUG_LEVEL > 0
+ // (empty string if not found)
+ static OUString RuleIDToStr(sal_uInt32 nRuleID);
+#endif
+
+ // StrToRuleID calculates the RuleID for an OUString (that is, css::sdbcx::Index in yytname)
+ // (0 if not found). The search for an ID based on a String is
+ // extremely inefficient (sequential search for OUString)!
+ static sal_uInt32 StrToRuleID(const OString & rValue);
+
+ static OSQLParseNode::Rule RuleIDToRule( sal_uInt32 _nRule );
+
+ // RuleId with enum, far more efficient
+ static sal_uInt32 RuleID(OSQLParseNode::Rule eRule);
+ // compares the _sFunctionName with all known function names and return the DataType of the return value
+ static sal_Int32 getFunctionReturnType(std::u16string_view _sFunctionName, const IParseContext* pContext);
+
+ // returns the type for a parameter in a given function name
+ static sal_Int32 getFunctionParameterType(sal_uInt32 _nTokenId,sal_uInt32 _nPos);
+
+ void error(const char *fmt);
+ static int SQLlex();
+#ifdef YYBISON
+ void setParseTree(OSQLParseNode * pNewParseTree);
+
+ // Is the parse in a special mode?
+ // Predicate check is used to check a condition for a field
+ bool inPredicateCheck() const {return m_xField.is();}
+ const OUString& getFieldName() const {return m_sFieldName;}
+
+ static void reduceLiteral(OSQLParseNode*& pLiteral, bool bAppendBlank);
+ // does not change the pLiteral argument
+ sal_Int16 buildNode(OSQLParseNode*& pAppend,OSQLParseNode* pCompare,OSQLParseNode* pLiteral,OSQLParseNode* pLiteral2);
+
+ sal_Int16 buildComparisonRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral);
+ // pCompre will be deleted if it is not used
+ sal_Int16 buildPredicateRule(OSQLParseNode*& pAppend,OSQLParseNode* const pLiteral,OSQLParseNode* pCompare,OSQLParseNode* pLiteral2 = nullptr);
+
+ sal_Int16 buildLikeRule(OSQLParseNode* pAppend, OSQLParseNode*& pLiteral, const OSQLParseNode* pEscape);
+ sal_Int16 buildStringNodes(OSQLParseNode*& pLiteral);
+#endif
+ };
+}
+
+#endif // INCLUDED_CONNECTIVITY_SQLPARSE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqlscan.hxx b/include/connectivity/sqlscan.hxx
new file mode 100644
index 000000000..fe463f506
--- /dev/null
+++ b/include/connectivity/sqlscan.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <connectivity/IParseContext.hxx>
+
+namespace connectivity
+{
+
+ //= OSQLScanner
+
+ /** Scanner for SQL92
+ */
+ class OSQLScanner
+ {
+ const IParseContext* m_pContext; // context for parse, knows all international stuff
+ OString m_sStatement; // statement to parse
+ OUString m_sErrorMessage;
+
+ sal_Int32 m_nCurrentPos; // next position to read from the statement
+ bool m_bInternational; // do we have a statement which may uses
+ sal_Int32 m_nRule; // rule to be set
+
+ public:
+ OSQLScanner();
+ ~OSQLScanner();
+
+ sal_Int32 SQLyygetc();
+ void SQLyyerror(char const *fmt);
+ IParseContext::InternationalKeyCode getInternationalTokenID(const char* sToken) const;
+
+ // setting the new information before scanning
+ void prepareScan(const OUString & rNewStatement, const IParseContext* pContext, bool bInternational);
+ const OUString& getErrorMessage() const {return m_sErrorMessage;}
+ const OString& getStatement() const { return m_sStatement; }
+
+ static sal_Int32 SQLlex();
+ // set this as scanner for flex
+ void setScanner(bool _bNull=false);
+ // rules settings
+ void SetRule(sal_Int32 nRule) {m_nRule = nRule;}
+ static sal_Int32 GetGERRule();
+ static sal_Int32 GetENGRule();
+ static sal_Int32 GetSQLRule();
+ static sal_Int32 GetDATERule();
+ static sal_Int32 GetSTRINGRule();
+ sal_Int32 GetCurrentPos() const { return m_nCurrentPos; }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/standardsqlstate.hxx b/include/connectivity/standardsqlstate.hxx
new file mode 100644
index 000000000..2569d3a02
--- /dev/null
+++ b/include/connectivity/standardsqlstate.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_STANDARDSQLSTATE_HXX
+#define INCLUDED_CONNECTIVITY_STANDARDSQLSTATE_HXX
+
+#include <sal/types.h>
+
+namespace dbtools
+{
+
+
+ /** standard SQLStates to be used with an SQLException
+
+ Extend this list whenever you need a new state ...
+
+ @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_error_codes.asp
+ */
+ enum class StandardSQLState
+ {
+ INVALID_DESCRIPTOR_INDEX, // 07009
+ INVALID_CURSOR_STATE, // 24000
+ COLUMN_NOT_FOUND, // 42S22
+ GENERAL_ERROR, // HY000
+ INVALID_SQL_DATA_TYPE, // HY004
+ FUNCTION_SEQUENCE_ERROR, // HY010
+ INVALID_CURSOR_POSITION, // HY109
+ FEATURE_NOT_IMPLEMENTED, // HYC00
+ FUNCTION_NOT_SUPPORTED, // IM001
+ CONNECTION_DOES_NOT_EXIST, // 08003
+
+ ERROR_UNSPECIFIED = SAL_MAX_ENUM // special value indicating that an SQLState is not to be specified
+ };
+
+
+} // namespace dbtools
+
+
+#endif // INCLUDED_CONNECTIVITY_STANDARDSQLSTATE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/statementcomposer.hxx b/include/connectivity/statementcomposer.hxx
new file mode 100644
index 000000000..88fa61f55
--- /dev/null
+++ b/include/connectivity/statementcomposer.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_STATEMENTCOMPOSER_HXX
+#define INCLUDED_CONNECTIVITY_STATEMENTCOMPOSER_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <memory>
+#include <connectivity/dbtoolsdllapi.hxx>
+
+namespace com::sun::star::sdbc { class XConnection; }
+namespace com::sun::star::sdb { class XSingleSelectQueryComposer; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+
+namespace dbtools
+{
+
+
+ //= StatementComposer
+
+ struct StatementComposer_Data;
+ /** a class which is able to compose queries (SELECT statements) from a command and a command type
+ */
+ class OOO_DLLPUBLIC_DBTOOLS StatementComposer
+ {
+ ::std::unique_ptr< StatementComposer_Data > m_pData;
+
+ public:
+ /** constructs an instance
+
+ @param _rxConnection
+ the connection to work with. Must not be <NULL/>.
+ */
+ StatementComposer(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const OUString& _rCommand,
+ const sal_Int32 _nCommandType,
+ const bool _bEscapeProcessing
+ );
+
+ ~StatementComposer();
+
+ /** controls whether or not the instance disposes its XSingleSelectQueryComposer upon
+ destruction
+
+ Unless you explicitly call this method with the parameter being <TRUE/>,
+ the XSingleSelectQueryComposer will be disposed when the StatementComposer
+ instance is destroyed.
+ */
+ void setDisposeComposer( bool _bDoDispose );
+
+ void setFilter( const OUString& _rFilter );
+ void setHavingClause( const OUString& _rHavingClause );
+ void setOrder( const OUString& _rOrder );
+
+ /** returns the composer which has been fed with the current settings
+
+ @throws css::sdbc::SQLException
+ if such an exception occurs while creating the composer
+ */
+ css::uno::Reference< css::sdb::XSingleSelectQueryComposer > const &
+ getComposer();
+
+ /** returns the composer statement
+
+ Effectively, this is equivalent to calling getComposer, and asking the composer
+ for its Query attribute.
+
+ @throws css::sdbc::SQLException
+ if such an exception occurs while creating the composer
+ */
+ OUString
+ getQuery();
+
+ private:
+ StatementComposer(const StatementComposer&) = delete;
+ StatementComposer& operator=(const StatementComposer&) = delete;
+ StatementComposer() = delete;
+ };
+
+
+} // namespace dbtools
+
+
+#endif // INCLUDED_CONNECTIVITY_STATEMENTCOMPOSER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/warningscontainer.hxx b/include/connectivity/warningscontainer.hxx
new file mode 100644
index 000000000..7d017057b
--- /dev/null
+++ b/include/connectivity/warningscontainer.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_WARNINGSCONTAINER_HXX
+#define INCLUDED_CONNECTIVITY_WARNINGSCONTAINER_HXX
+
+#include <connectivity/dbtoolsdllapi.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::sdbc { class SQLException; }
+namespace com::sun::star::sdbc { class SQLWarning; }
+namespace com::sun::star::sdbc { class XWarningsSupplier; }
+namespace com::sun::star::sdb { class SQLContext; }
+namespace com::sun::star::uno { class XInterface; }
+
+namespace dbtools
+{
+
+ /** helper class for implementing XWarningsSupplier, which mixes own warnings with
+ warnings obtained from an external instance
+ */
+ class OOO_DLLPUBLIC_DBTOOLS WarningsContainer
+ {
+ private:
+ css::uno::Reference< css::sdbc::XWarningsSupplier > m_xExternalWarnings;
+ css::uno::Any m_aOwnWarnings;
+
+ public:
+ WarningsContainer() {}
+ WarningsContainer( const css::uno::Reference< css::sdbc::XWarningsSupplier >& _rxExternalWarnings )
+ :m_xExternalWarnings( _rxExternalWarnings ) {}
+
+ void setExternalWarnings( const css::uno::Reference< css::sdbc::XWarningsSupplier >& _rxExternalWarnings )
+ {
+ m_xExternalWarnings = _rxExternalWarnings;
+ }
+
+ // convenience
+ /** appends an SQLWarning instance to the chain
+ @param _rWarning
+ the warning message
+ @param _pAsciiSQLState
+ the SQLState of the warning
+ @param _rxContext
+ the context of the warning
+ */
+ void appendWarning(
+ const OUString& _rWarning,
+ const char* _pAsciiSQLState,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext );
+
+ void appendWarning(const css::sdbc::SQLException& _rWarning);
+ void appendWarning(const css::sdbc::SQLWarning& _rWarning);
+ void appendWarning(const css::sdb::SQLContext& _rContext);
+
+ // XWarningsSupplier equivalents
+ css::uno::Any getWarnings( ) const;
+ void clearWarnings( );
+ };
+
+
+} // namespace dbtools
+
+
+#endif // INCLUDED_CONNECTIVITY_WARNINGSCONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/basegfxfactory.hxx b/include/cppcanvas/basegfxfactory.hxx
new file mode 100644
index 000000000..611523066
--- /dev/null
+++ b/include/cppcanvas/basegfxfactory.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_BASEGFXFACTORY_HXX
+#define INCLUDED_CPPCANVAS_BASEGFXFACTORY_HXX
+
+#include <cppcanvas/canvas.hxx>
+#include <cppcanvas/polypolygon.hxx>
+#include <cppcanvas/bitmap.hxx>
+#include <basegfx/vector/b2isize.hxx>
+
+#include <cppcanvas/cppcanvasdllapi.h>
+
+namespace basegfx
+{
+ class B2DPolygon;
+}
+
+
+/* Definition of BaseGfxFactory class */
+
+namespace cppcanvas
+{
+ /** The BaseGfxFactory creates Canvas objects for various basegfx
+ primitives, such as polygons and bitmaps (not yet
+ implemented).
+
+ Please note that the objects created for a specific Canvas can
+ only be drawn on exactly that canvas. You have to regenerate
+ them for different canvases.
+ */
+ class CPPCANVAS_DLLPUBLIC BaseGfxFactory
+ {
+ public:
+ /** Create a polygon from a ::basegfx::B2DPolygon
+
+ The created polygon initially has the same size in user
+ coordinate space as the source polygon
+ */
+ static PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolygon& rPoly );
+
+ /** Create an uninitialized bitmap with the given size
+ */
+ static BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize );
+
+ /** Create an uninitialized alpha bitmap with the given size
+ */
+ static BitmapSharedPtr createAlphaBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize );
+
+ private:
+ BaseGfxFactory() = delete;
+ BaseGfxFactory(const BaseGfxFactory&) = delete;
+ BaseGfxFactory& operator=( const BaseGfxFactory& ) = delete;
+ };
+
+}
+
+#endif // INCLUDED_CPPCANVAS_BASEGFXFACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/bitmap.hxx b/include/cppcanvas/bitmap.hxx
new file mode 100644
index 000000000..1b163b82d
--- /dev/null
+++ b/include/cppcanvas/bitmap.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_BITMAP_HXX
+#define INCLUDED_CPPCANVAS_BITMAP_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <cppcanvas/canvasgraphic.hxx>
+#include <cppcanvas/bitmapcanvas.hxx>
+#include <memory>
+
+namespace com::sun::star::rendering
+{
+ class XBitmap;
+}
+
+
+/* Definition of Bitmap interface */
+
+namespace cppcanvas
+{
+
+ /** This interface defines a Bitmap canvas object
+
+ Consider this object part of the view, and not of the model
+ data, as this bitmap can only be painted on its parent canvas
+ */
+ class Bitmap : public virtual CanvasGraphic
+ {
+ public:
+ /** Render to parent canvas, with global alpha.
+
+ This method renders the content to the parent canvas,
+ i.e. the canvas this object was constructed for.
+
+ @param nAlphaModulation
+ Global alpha value, with which each pixel alpha value gets
+ multiplied. For a normal, opaque bitmap, this will make
+ the bitmap appear transparent with the given alpha value
+ (value must be in the range [0,1]).
+ */
+ virtual void drawAlphaModulated( double nAlphaModulation ) const = 0;
+
+ virtual BitmapCanvasSharedPtr getBitmapCanvas() const = 0;
+
+ virtual css::uno::Reference< css::rendering::XBitmap > getUNOBitmap() const = 0;
+ };
+
+ typedef std::shared_ptr< ::cppcanvas::Bitmap > BitmapSharedPtr;
+}
+
+#endif // INCLUDED_CPPCANVAS_BITMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/bitmapcanvas.hxx b/include/cppcanvas/bitmapcanvas.hxx
new file mode 100644
index 000000000..9c3e7f843
--- /dev/null
+++ b/include/cppcanvas/bitmapcanvas.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_BITMAPCANVAS_HXX
+#define INCLUDED_CPPCANVAS_BITMAPCANVAS_HXX
+
+#include <basegfx/vector/b2isize.hxx>
+#include <cppcanvas/canvas.hxx>
+#include <memory>
+
+
+/* Definition of BitmapCanvas */
+
+namespace cppcanvas
+{
+ class BitmapCanvas;
+
+ // forward declaration, since cloneBitmapCanvas() also references BitmapCanvas
+ typedef std::shared_ptr< BitmapCanvas > BitmapCanvasSharedPtr;
+
+ /** BitmapCanvas interface
+ */
+ class BitmapCanvas : public virtual Canvas
+ {
+ public:
+ virtual ::basegfx::B2ISize getSize() const = 0;
+ };
+
+}
+
+#endif // INCLUDED_CPPCANVAS_BITMAPCANVAS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/canvas.hxx b/include/cppcanvas/canvas.hxx
new file mode 100644
index 000000000..97562ede2
--- /dev/null
+++ b/include/cppcanvas/canvas.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_CANVAS_HXX
+#define INCLUDED_CPPCANVAS_CANVAS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <memory>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+}
+
+namespace com::sun::star::rendering
+{
+ class XCanvas;
+ struct ViewState;
+}
+
+
+/* Definition of BitmapCanvas */
+
+namespace cppcanvas
+{
+ class PolyPolygon;
+ class Canvas;
+
+ // forward declaration, since tools::PolyPolygon also references Canvas
+ typedef std::shared_ptr< PolyPolygon > PolyPolygonSharedPtr;
+
+ // forward declaration, since cloneCanvas() also references Canvas
+ typedef std::shared_ptr< Canvas > CanvasSharedPtr;
+
+ /** Canvas interface
+ */
+ class Canvas
+ {
+ public:
+ /** Extra pixel used when canvas anti-aliases.
+
+ Enlarge the bounding box of drawing primitives by this
+ amount in both dimensions, and on both sides of the
+ bounds, to account for extra pixel touched outside the
+ actual primitive bounding box, when the canvas
+ performs anti-aliasing.
+ */
+ static constexpr auto ANTIALIASING_EXTRA_SIZE=2;
+
+ Canvas() = default;
+ Canvas(Canvas const &) = default;
+ Canvas(Canvas &&) = default;
+ Canvas & operator =(Canvas const &) = default;
+#if !(defined __GNUC__ && !defined __clang__ && __GNUC__ == 8) // bogus -Werror=virtual-move-assign
+ Canvas & operator =(Canvas &&) = default;
+#endif
+
+ virtual ~Canvas() {}
+
+ virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
+ virtual ::basegfx::B2DHomMatrix getTransformation() const = 0;
+
+ virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+ virtual void setClip() = 0;
+
+ /** Get current clip
+
+ @return NULL, if no clip is set, otherwise the current clip poly-polygon
+ */
+ virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0;
+
+ virtual CanvasSharedPtr clone() const = 0;
+ virtual void clear() const = 0;
+
+ // this should be considered private. if RTTI gets enabled
+ // someday, remove that to a separate interface
+ virtual css::uno::Reference<
+ css::rendering::XCanvas > getUNOCanvas() const = 0;
+ virtual css::rendering::ViewState getViewState() const = 0;
+ };
+
+}
+
+#endif // INCLUDED_CPPCANVAS_CANVAS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/canvasgraphic.hxx b/include/cppcanvas/canvasgraphic.hxx
new file mode 100644
index 000000000..ebee831f0
--- /dev/null
+++ b/include/cppcanvas/canvasgraphic.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_CANVASGRAPHIC_HXX
+#define INCLUDED_CPPCANVAS_CANVASGRAPHIC_HXX
+
+#include <sal/types.h>
+#include <memory>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+}
+
+
+/* Definition of CanvasGraphic interface */
+
+namespace cppcanvas
+{
+ // forward declaration, since tools::PolyPolygon also derives from CanvasGraphic
+ typedef std::shared_ptr< class PolyPolygon > PolyPolygonSharedPtr;
+
+
+ /** This interface defines basic properties of
+ objects that can be painted on a Canvas
+ */
+ class CanvasGraphic
+ {
+ public:
+
+ virtual ~CanvasGraphic() {}
+
+ /** Set object transformation matrix
+ */
+ virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
+
+ /** Set object clipping polygon
+ */
+ virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+ /** Clear object clipping polygon
+ */
+ virtual void setClip() = 0;
+
+ /** Set object composite mode
+ * @see css::rendering::CompositeOperation
+ */
+ virtual void setCompositeOp( sal_Int8 aOp ) = 0;
+
+ /** Render to parent canvas
+
+ This method renders the content to the parent canvas,
+ i.e. the canvas this object was constructed for.
+
+ @return whether the rendering finished successfully.
+ */
+ virtual bool draw() const = 0;
+
+ };
+}
+
+#endif // INCLUDED_CPPCANVAS_CANVASGRAPHIC_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/color.hxx b/include/cppcanvas/color.hxx
new file mode 100644
index 000000000..500e5953e
--- /dev/null
+++ b/include/cppcanvas/color.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_COLOR_HXX
+#define INCLUDED_CPPCANVAS_COLOR_HXX
+
+#include <sal/types.h>
+
+/* Definition of Color class */
+
+namespace cppcanvas
+{
+ /** Color in the sRGB color space, plus alpha channel
+
+ The four bytes of the sal_uInt32 are allocated as follows
+ to the color channels and alpha: 0xRRGGBBAA.
+ */
+ typedef sal_uInt32 IntSRGBA;
+
+ inline sal_uInt8 getRed( IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( (nCol&0xFF000000U) >> 24U );
+ }
+
+ inline sal_uInt8 getGreen( IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( (nCol&0x00FF0000U) >> 16U );
+ }
+
+ inline sal_uInt8 getBlue( IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( (nCol&0x0000FF00U) >> 8U );
+ }
+
+ inline sal_uInt8 getAlpha( IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( nCol&0x000000FFU );
+ }
+
+ inline IntSRGBA makeColor( sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue, sal_uInt8 nAlpha )
+ {
+ return (nRed << 24U)|(nGreen << 16U)|(nBlue << 8U)|nAlpha;
+ }
+
+ inline sal_Int32 makeColorARGB( sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ {
+ return (nAlpha << 24U)|(nRed << 16U)|(nGreen << 8U)|nBlue;
+ }
+
+}
+
+#endif // INCLUDED_CPPCANVAS_COLOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/cppcanvasdllapi.h b/include/cppcanvas/cppcanvasdllapi.h
new file mode 100644
index 000000000..90b0ba893
--- /dev/null
+++ b/include/cppcanvas/cppcanvasdllapi.h
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_CPPCANVASDLLAPI_H
+#define INCLUDED_CPPCANVAS_CPPCANVASDLLAPI_H
+
+#if defined CPPCANVAS_DLLIMPLEMENTATION
+
+#define CPPCANVAS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define CPPCANVAS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define CPPCANVAS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
diff --git a/include/cppcanvas/customsprite.hxx b/include/cppcanvas/customsprite.hxx
new file mode 100644
index 000000000..abbd0c00b
--- /dev/null
+++ b/include/cppcanvas/customsprite.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_CUSTOMSPRITE_HXX
+#define INCLUDED_CPPCANVAS_CUSTOMSPRITE_HXX
+
+#include <cppcanvas/sprite.hxx>
+#include <cppcanvas/canvas.hxx>
+#include <memory>
+
+/* Definition of CustomSprite class */
+
+namespace cppcanvas
+{
+
+ class CustomSprite : public virtual Sprite
+ {
+ public:
+
+ virtual CanvasSharedPtr getContentCanvas() const = 0;
+ };
+
+ typedef std::shared_ptr< ::cppcanvas::CustomSprite > CustomSpriteSharedPtr;
+}
+
+#endif // INCLUDED_CPPCANVAS_CUSTOMSPRITE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/polypolygon.hxx b/include/cppcanvas/polypolygon.hxx
new file mode 100644
index 000000000..917ef4daf
--- /dev/null
+++ b/include/cppcanvas/polypolygon.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_POLYPOLYGON_HXX
+#define INCLUDED_CPPCANVAS_POLYPOLYGON_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <cppcanvas/canvasgraphic.hxx>
+#include <cppcanvas/color.hxx>
+#include <memory>
+
+namespace com::sun::star::rendering
+{
+ class XPolyPolygon2D;
+}
+
+
+/* Definition of tools::PolyPolygon interface */
+
+namespace cppcanvas
+{
+
+ /** This interface defines a tools::PolyPolygon canvas object
+
+ Consider this object part of the view, and not of the model
+ data. Although the given polygon is typically copied and held
+ internally (to facilitate migration to incompatible canvases),
+ ::basegfx::B2DPolygon et al. are ref-counted copy-on-write
+ classes, i.e. memory shouldn't be wasted. On the other hand,
+ the API polygon created internally _does_ necessarily
+ duplicate the data held, but can be easily flushed away via
+ flush().
+ */
+ class PolyPolygon : public virtual CanvasGraphic
+ {
+ public:
+
+ /** Set polygon fill color
+ */
+ virtual void setRGBAFillColor( IntSRGBA ) = 0;
+ /** Set polygon line color
+ */
+ virtual void setRGBALineColor( IntSRGBA ) = 0;
+ /** Get polygon line color
+ */
+ virtual IntSRGBA getRGBALineColor() const = 0;
+
+ virtual void setStrokeWidth( const double& rStrokeWidth ) = 0;
+ virtual double getStrokeWidth() const = 0;
+
+ virtual css::uno::Reference<
+ css::rendering::XPolyPolygon2D > getUNOPolyPolygon() const = 0;
+ };
+
+ typedef std::shared_ptr< ::cppcanvas::PolyPolygon > PolyPolygonSharedPtr;
+}
+
+#endif // INCLUDED_CPPCANVAS_POLYPOLYGON_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/renderer.hxx b/include/cppcanvas/renderer.hxx
new file mode 100644
index 000000000..d71be2f09
--- /dev/null
+++ b/include/cppcanvas/renderer.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_RENDERER_HXX
+#define INCLUDED_CPPCANVAS_RENDERER_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <optional>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <cppcanvas/canvasgraphic.hxx>
+#include <cppcanvas/color.hxx>
+#include <memory>
+
+namespace basegfx
+{
+ class B2DRange;
+}
+
+/* Definition of Renderer interface */
+
+namespace cppcanvas
+{
+
+ class Renderer : public virtual CanvasGraphic
+ {
+ public:
+ /** Render subset of metafile to given canvas
+
+ This method renders the given subset of the content to the
+ associated canvas.
+
+ @param nStartIndex
+ The index of the first action to be rendered (the indices
+ correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @param nEndIndex
+ The index of the first action _not_ painted anymore,
+ i.e. the action after the last action rendered (the
+ indices correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @return whether the rendering finished successfully.
+ */
+ virtual bool drawSubset( sal_Int32 nStartIndex,
+ sal_Int32 nEndIndex ) const = 0;
+
+ /** Query bounding box of metafile subset
+
+ This method queries the actual bounding box of the given
+ subset, when rendered on the associated canvas.
+
+ @param nStartIndex
+ The index of the first action to be rendered (the indices
+ correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @param nEndIndex
+ The index of the first action _not_ painted anymore,
+ i.e. the action after the last action rendered (the
+ indices correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @return the bounding box of the specified subset
+ */
+ virtual ::basegfx::B2DRange getSubsetArea( sal_Int32 nStartIndex,
+ sal_Int32 nEndIndex ) const = 0;
+
+ /** Parameters for the Renderer
+ */
+ struct Parameters
+ {
+ /// Optionally forces the fill color attribute for all actions
+ ::std::optional< IntSRGBA > maFillColor;
+
+ /// Optionally forces the line color attribute for all actions
+ ::std::optional< IntSRGBA > maLineColor;
+
+ /// Optionally forces the text color attribute for all actions
+ ::std::optional< IntSRGBA > maTextColor;
+
+ /// Optionally forces the given fontname for all text actions
+ ::std::optional< OUString > maFontName;
+
+ /** Optionally transforms all text output actions with the
+ given matrix (in addition to the overall canvas
+ transformation).
+
+ Note that the matrix given here is applied to the unit
+ rect coordinate system, i.e. the metafile is assumed
+ to be contained in the unit rect.
+ */
+ ::std::optional< ::basegfx::B2DHomMatrix > maTextTransformation;
+
+ /// Optionally forces the given font weight for all text actions
+ ::std::optional< sal_Int8 > maFontWeight;
+
+ /// Optionally forces the given font letter form (italics etc.) for all text actions
+ ::std::optional< sal_Int8 > maFontLetterForm;
+
+ /// Optionally forces underlining for all text actions
+ ::std::optional< bool > maFontUnderline;
+ };
+ };
+
+ typedef std::shared_ptr< ::cppcanvas::Renderer > RendererSharedPtr;
+}
+
+#endif // INCLUDED_CPPCANVAS_RENDERER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/sprite.hxx b/include/cppcanvas/sprite.hxx
new file mode 100644
index 000000000..3321eb6a0
--- /dev/null
+++ b/include/cppcanvas/sprite.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_SPRITE_HXX
+#define INCLUDED_CPPCANVAS_SPRITE_HXX
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+ class B2DPoint;
+}
+
+
+/* Definition of Sprite class */
+
+namespace cppcanvas
+{
+
+ class Sprite
+ {
+ public:
+ virtual ~Sprite() {}
+
+ virtual void setAlpha( const double& rAlpha ) = 0;
+
+ /** Set the sprite position on screen
+
+ This method differs from the XSprite::move() insofar, as
+ no viewstate/renderstate transformations are applied to
+ the specified position. The given position is interpreted
+ in device coordinates (i.e. screen pixel)
+ */
+ virtual void movePixel( const ::basegfx::B2DPoint& rNewPos ) = 0;
+
+ /** Set the sprite position on screen
+
+ This method sets the sprite position in the view
+ coordinate system of the parent canvas
+ */
+ virtual void move( const ::basegfx::B2DPoint& rNewPos ) = 0;
+
+ virtual void transform( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
+
+ /** Set output clipping
+
+ This method differs from the XSprite::clip() insofar, as
+ no viewstate/renderstate transformations are applied to
+ the specified clip polygon. The given polygon is
+ interpreted in device coordinates (i.e. screen pixel)
+ */
+ virtual void setClipPixel( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+
+ /** Set output clipping
+
+ This method applies the clip poly-polygon interpreted in
+ the view coordinate system of the parent canvas.
+ */
+ virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+
+ virtual void setClip() = 0;
+
+ virtual void show() = 0;
+ virtual void hide() = 0;
+
+ /** Change the sprite priority
+
+ @param fPriority
+ New sprite priority. The higher the priority, the further
+ towards the viewer the sprite appears. That is, sprites
+ with higher priority appear before ones with lower
+ priority.
+ */
+ virtual void setPriority( double fPriority ) = 0;
+ };
+}
+
+#endif // INCLUDED_CPPCANVAS_SPRITE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/spritecanvas.hxx b/include/cppcanvas/spritecanvas.hxx
new file mode 100644
index 000000000..c4d100dbe
--- /dev/null
+++ b/include/cppcanvas/spritecanvas.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_SPRITECANVAS_HXX
+#define INCLUDED_CPPCANVAS_SPRITECANVAS_HXX
+
+#include <basegfx/vector/b2dsize.hxx>
+#include <cppcanvas/canvas.hxx>
+#include <cppcanvas/customsprite.hxx>
+#include <memory>
+
+namespace com::sun::star::rendering
+{
+ class XSpriteCanvas;
+}
+
+
+/* Definition of SpriteCanvas */
+
+namespace cppcanvas
+{
+ class SpriteCanvas;
+
+ // forward declaration, since cloneSpriteCanvas() also references SpriteCanvas
+ typedef std::shared_ptr< ::cppcanvas::SpriteCanvas > SpriteCanvasSharedPtr;
+
+ /** SpriteCanvas interface
+ */
+ class SpriteCanvas : public virtual Canvas
+ {
+ SpriteCanvas(const SpriteCanvas&) = delete;
+ SpriteCanvas& operator=( const SpriteCanvas& ) = delete;
+ public:
+ SpriteCanvas() {}
+ virtual bool updateScreen( bool bUpdateAll ) const = 0;
+
+ virtual CustomSpriteSharedPtr createCustomSprite( const ::basegfx::B2DSize& ) const = 0;
+
+ virtual css::uno::Reference<
+ css::rendering::XSpriteCanvas > getUNOSpriteCanvas() const = 0;
+ };
+
+}
+
+#endif // INCLUDED_CPPCANVAS_SPRITECANVAS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/vclfactory.hxx b/include/cppcanvas/vclfactory.hxx
new file mode 100644
index 000000000..73867626d
--- /dev/null
+++ b/include/cppcanvas/vclfactory.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPCANVAS_VCLFACTORY_HXX
+#define INCLUDED_CPPCANVAS_VCLFACTORY_HXX
+
+#include <cppcanvas/canvas.hxx>
+#include <cppcanvas/bitmapcanvas.hxx>
+#include <cppcanvas/spritecanvas.hxx>
+#include <cppcanvas/bitmap.hxx>
+#include <cppcanvas/renderer.hxx>
+
+#include <cppcanvas/cppcanvasdllapi.h>
+
+namespace vcl { class Window; }
+class BitmapEx;
+
+class GDIMetaFile;
+
+namespace com::sun::star::rendering
+{
+ class XCanvas;
+ class XBitmapCanvas;
+ class XSpriteCanvas;
+}
+
+/* Definition of VCLFactory class */
+
+namespace cppcanvas
+{
+ /** The VCLFactory creates Canvas objects for various VCL
+ OutputDevice primitives, such as windows, polygons, bitmaps
+ and metafiles.
+
+ Please note that the objects created for a specific Canvas can
+ only be drawn on exactly that canvas. You have to regenerate
+ them for different canvases.
+ */
+ class CPPCANVAS_DLLPUBLIC VCLFactory
+ {
+ public:
+ static CanvasSharedPtr createCanvas( const css::uno::Reference< css::rendering::XCanvas >& xCanvas );
+ static BitmapCanvasSharedPtr createBitmapCanvas( const css::uno::Reference< css::rendering::XBitmapCanvas >& xCanvas );
+
+ static SpriteCanvasSharedPtr createSpriteCanvas( const vcl::Window& rVCLWindow );
+ static SpriteCanvasSharedPtr createSpriteCanvas( const css::uno::Reference< css::rendering::XSpriteCanvas >& xCanvas );
+
+ /** Create a bitmap from a VCL Bitmap
+ */
+ static BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::BitmapEx& rBmpEx );
+
+ /** Create a renderer object from a Metafile
+
+ The created renderer initially draws the metafile
+ one-by-one units large, in user coordinate space
+ */
+ static RendererSharedPtr createRenderer( const CanvasSharedPtr& rCanvas,
+ const ::GDIMetaFile& rMtf,
+ const Renderer::Parameters& rParms );
+
+ private:
+ VCLFactory() = delete;
+ VCLFactory(const VCLFactory&) = delete;
+ VCLFactory& operator=( const VCLFactory& ) = delete;
+ };
+
+}
+
+#endif // INCLUDED_CPPCANVAS_VCLFACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppu/Enterable.hxx b/include/cppu/Enterable.hxx
new file mode 100644
index 000000000..b5cc789e4
--- /dev/null
+++ b/include/cppu/Enterable.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPU_ENTERABLE_HXX
+#define INCLUDED_CPPU_ENTERABLE_HXX
+
+#include "uno/Enterable.h"
+#include "rtl/ustring.hxx"
+
+namespace cppu
+{
+/** C++ wrapper for binary C Enterable
+ (http://wiki.openoffice.org/wiki/Uno/Cpp/Spec/Environment_Stack)
+
+ @see uno_Enterable
+ @since UDK 3.2.7
+*/
+class Enterable : public uno_Enterable
+{
+public:
+ /* These methods need to be implemented in a derived class.
+ */
+ virtual void v_enter() = 0;
+ virtual void v_leave() = 0;
+ virtual void v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam) = 0;
+ virtual void v_callOut_v (uno_EnvCallee * pCallee, va_list * pParam) = 0;
+ virtual bool v_isValid (rtl::OUString * pReason) = 0;
+
+ virtual ~Enterable() {}
+
+public:
+ inline explicit Enterable();
+
+ void enter() {m_enter(this);}
+ void leave() {m_leave(this);}
+
+ void callInto_v(uno_EnvCallee * pCallee, va_list * pParam) {m_callInto_v(this, pCallee, pParam);}
+ void callOut_v (uno_EnvCallee * pCallee, va_list * pParam) {m_callOut_v (this, pCallee, pParam);}
+
+ inline void callInto(uno_EnvCallee * pCallee, ...);
+ inline void callOut (uno_EnvCallee * pCallee, ...);
+
+ int isValid (rtl::OUString * pReason) {return m_isValid(this, &pReason->pData);}
+
+private:
+ Enterable(Enterable const &) SAL_DELETED_FUNCTION;
+ Enterable & operator = (Enterable const &) SAL_DELETED_FUNCTION;
+};
+
+extern "C" inline void Enterable_call_enter (void * context) { static_cast<Enterable *>(context)->v_enter(); }
+extern "C" inline void Enterable_call_leave (void * context) { static_cast<Enterable *>(context)->v_leave(); }
+extern "C" inline void Enterable_call_callInto_v(void * context, uno_EnvCallee * pCallee, va_list * pParam)
+ { static_cast<Enterable *>(context)->v_callInto_v(pCallee, pParam); }
+extern "C" inline void Enterable_call_callOut_v (void * context, uno_EnvCallee * pCallee, va_list * pParam)
+ { static_cast<Enterable *>(context)->v_callOut_v(pCallee, pParam); }
+extern "C" inline int Enterable_call_isValid (void * context, rtl_uString ** pReason)
+ {return static_cast<Enterable *>(context)->v_isValid(reinterpret_cast<rtl::OUString *>(pReason));}
+
+
+Enterable::Enterable()
+{
+ m_enter = Enterable_call_enter;
+ m_leave = Enterable_call_leave;
+ m_callInto_v = Enterable_call_callInto_v;
+ m_callOut_v = Enterable_call_callOut_v;
+ m_isValid = Enterable_call_isValid;
+}
+
+void Enterable::callInto(uno_EnvCallee * pCallee, ...)
+{
+ va_list param;
+
+ va_start(param, pCallee);
+ callInto_v(pCallee, &param);
+ va_end(param);
+}
+
+void Enterable::callOut(uno_EnvCallee * pCallee, ...)
+{
+ va_list param;
+
+ va_start(param, pCallee);
+ callOut_v(pCallee, &param);
+ va_end(param);
+}
+
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppu/EnvDcp.hxx b/include/cppu/EnvDcp.hxx
new file mode 100644
index 000000000..02eb0301d
--- /dev/null
+++ b/include/cppu/EnvDcp.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPU_ENVDCP_HXX
+#define INCLUDED_CPPU_ENVDCP_HXX
+
+#include "rtl/ustring.hxx"
+#include "uno/EnvDcp.h"
+
+namespace cppu
+{
+namespace EnvDcp
+{
+/** Get the OBI type part of an environment descriptor.
+ (http://wiki.openoffice.org/wiki/Uno/Cpp/Spec/Environment_Descriptor)
+
+ @param rEnvDcp the Environment Descriptor
+ @return the OBI type
+ @since UDK 3.2.7
+*/
+inline rtl::OUString getTypeName(rtl::OUString const& rEnvDcp)
+{
+ rtl::OUString typeName;
+
+ uno_EnvDcp_getTypeName(rEnvDcp.pData, &typeName.pData);
+
+ return typeName;
+}
+
+/** Get the purpose part of an environment descriptor.
+ (http://wiki.openoffice.org/wiki/Uno/Binary/Spec/Environment_Descriptor)
+
+ @param rEnvDcp the Environment Descriptor
+ @return the purpose
+ @since UDK 3.2.7
+*/
+inline rtl::OUString getPurpose(rtl::OUString const& rEnvDcp)
+{
+ rtl::OUString purpose;
+
+ uno_EnvDcp_getPurpose(rEnvDcp.pData, &purpose.pData);
+
+ return purpose;
+}
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppu/EnvGuards.hxx b/include/cppu/EnvGuards.hxx
new file mode 100644
index 000000000..b8a2d30a8
--- /dev/null
+++ b/include/cppu/EnvGuards.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPU_ENVGUARDS_HXX
+#define INCLUDED_CPPU_ENVGUARDS_HXX
+
+#include "uno/environment.hxx"
+
+
+namespace cppu
+{
+ /** Environment Guard
+ The provided Environment becomes entered in the constructor and left
+ in the destructor.
+ (http://wiki.openoffice.org/wiki/Uno/Cpp/Spec/Environment_Guard)
+
+ @since UDK 3.2.7
+ */
+ class EnvGuard
+ {
+ css::uno::Environment m_env;
+
+ public:
+ explicit EnvGuard(css::uno::Environment const & env)
+ {
+ if (env.is())
+ {
+ m_env = css::uno::Environment::getCurrent();
+ env.enter();
+ }
+ }
+
+ ~EnvGuard()
+ {
+ m_env.enter();
+ }
+
+ /** Checks if the associated environment is non empty.
+
+ @return 0 == empty, 1 == non empty
+ */
+ bool SAL_CALL is() const
+ {
+ return m_env.is();
+ }
+
+ /** Leaves the associated environment and clears
+ the reference.
+ */
+ void clear()
+ {
+ if (m_env.is())
+ {
+ m_env.enter();
+ m_env.clear();
+ }
+ }
+ };
+
+ /** Environment Anti-Guard
+ Any entered Environment becomes left in the constructor and re-entered
+ in the destructor.
+ (http://wiki.openoffice.org/wiki/Uno/Cpp/Spec/Environment_AntiGuard)
+
+ @since UDK 3.2.7
+ */
+ class AntiEnvGuard
+ {
+ css::uno::Environment m_env;
+
+ public:
+ explicit AntiEnvGuard()
+ : m_env(css::uno::Environment::getCurrent())
+ {
+ uno_Environment_enter(NULL);
+ }
+
+ ~AntiEnvGuard()
+ {
+ m_env.enter();
+ }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppu/Map.hxx b/include/cppu/Map.hxx
new file mode 100644
index 000000000..da3af7ec1
--- /dev/null
+++ b/include/cppu/Map.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPU_MAP_HXX
+#define INCLUDED_CPPU_MAP_HXX
+
+#include "uno/mapping.hxx"
+
+
+namespace cppu
+{
+ /** Helpers for mapping objects relative to the current environment.
+ (http://wiki.openoffice.org/wiki/Uno/Cpp/Spec/Map_Helpers)
+ */
+
+ /** Maps an object from the current to an outer Environment, returns mapped object.
+
+ @param pT the object to be mapped
+ @param outerEnv the target environment
+ @return the mapped object
+ @since UDK 3.2.7
+ */
+ template<class T> inline T * mapOut(T * pT, css::uno::Environment const & outerEnv)
+ {
+ css::uno::Mapping curr2outer(css::uno::Environment::getCurrent(), outerEnv);
+
+ return reinterpret_cast<T *>(curr2outer.mapInterface(pT, cppu::UnoType<T>::get()));
+ }
+
+
+ /** Maps an object from an outer Environment to the current, returns mapped object.
+
+ @param pT the object to be mapped
+ @param outerEnv the source environment
+ @return the mapped object
+ @since UDK 3.2.7
+ */
+ template<class T> inline T * mapIn(T * pT, css::uno::Environment const & outerEnv)
+ {
+ css::uno::Mapping outer2curr(outerEnv, css::uno::Environment::getCurrent());
+
+ return reinterpret_cast<T *>(outer2curr.mapInterface(pT, cppu::UnoType<T>::get()));
+ }
+
+
+ /** Maps an any from the current to an outer Environment, fills passed any.
+
+ @param any the any to be mapped
+ @param res the target any
+ @param outerEnv the target environment
+ @since UDK 3.2.7
+ */
+ // Problem: any gets assigned to something, acquire/releases may be called in wrong env.
+ inline void mapOutAny(css::uno::Any const & any, css::uno::Any * res, css::uno::Environment const & outerEnv)
+ {
+ css::uno::Mapping curr2outer(css::uno::Environment::getCurrent(), outerEnv);
+
+ uno_any_destruct(res, css::uno::cpp_release);
+ uno_type_any_constructAndConvert(
+ res,
+ const_cast<void *>(any.getValue()),
+ any.getValueTypeRef(),
+ curr2outer.get());
+ }
+
+
+ /** Maps an any from an outer Environment to the current, fills passed any.
+
+ @param any the any to be mapped
+ @param res the target any
+ @param outerEnv the source environment
+ @since UDK 3.2.7
+ */
+ inline void mapInAny(css::uno::Any const & any, css::uno::Any * res, css::uno::Environment const & outerEnv)
+ {
+ css::uno::Mapping outer2curr(outerEnv, css::uno::Environment::getCurrent());
+
+ uno_any_destruct(res, css::uno::cpp_release);
+ uno_type_any_constructAndConvert(
+ res,
+ const_cast<void *>(any.getValue()),
+ any.getValueTypeRef(),
+ outer2curr.get());
+ }
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppu/cppudllapi.h b/include/cppu/cppudllapi.h
new file mode 100644
index 000000000..121b6defc
--- /dev/null
+++ b/include/cppu/cppudllapi.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPU_CPPUDLLAPI_H
+#define INCLUDED_CPPU_CPPUDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(CPPU_DLLIMPLEMENTATION)
+#define CPPU_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define CPPU_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#if defined(PURPENV_DLLIMPLEMENTATION)
+#define PURPENV_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define PURPENV_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif // INCLUDED_CPPU_CPPUDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppu/helper/purpenv/Environment.hxx b/include/cppu/helper/purpenv/Environment.hxx
new file mode 100644
index 000000000..0024d34dd
--- /dev/null
+++ b/include/cppu/helper/purpenv/Environment.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPU_HELPER_PURPENV_ENVIRONMENT_HXX
+#define INCLUDED_CPPU_HELPER_PURPENV_ENVIRONMENT_HXX
+
+#include "cppu/cppudllapi.h"
+#include "uno/environment.h"
+
+namespace cppu { class Enterable; }
+
+namespace cppu { namespace helper { namespace purpenv {
+
+/** C++ helper for implementing Purpose Environments.
+ (http://wiki.openoffice.org/wiki/Uno/Cpp/Spec/Purpose_Bridge_Implementation_Helper)
+
+ @since UDK 3.2.7
+*/
+PURPENV_DLLPUBLIC void Environment_initWithEnterable(
+ uno_Environment * pEnvironment, cppu::Enterable * pEnterable);
+
+}}}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppu/helper/purpenv/Mapping.hxx b/include/cppu/helper/purpenv/Mapping.hxx
new file mode 100644
index 000000000..18acf35f4
--- /dev/null
+++ b/include/cppu/helper/purpenv/Mapping.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPU_HELPER_PURPENV_MAPPING_HXX
+#define INCLUDED_CPPU_HELPER_PURPENV_MAPPING_HXX
+
+#include "cppu/cppudllapi.h"
+#include "typelib/typedescription.h"
+#include "uno/any2.h"
+#include "uno/environment.h"
+#include "uno/mapping.h"
+
+
+namespace cppu { namespace helper { namespace purpenv {
+
+/** C++ helper for implementing Purpose Environments.
+ (http://wiki.openoffice.org/wiki/Uno/Cpp/Spec/Purpose_Bridge_Implementation_Helper)
+
+ @since UDK 3.2.7
+*/
+
+typedef void ProbeFun(
+ bool pre,
+ void * pThis,
+ void * pContext,
+ typelib_TypeDescriptionReference * pReturnTypeRef,
+ typelib_MethodParameter * pParams,
+ sal_Int32 nParams,
+ typelib_TypeDescription const * pMemberType,
+ void * pReturn,
+ void * pArgs[],
+ uno_Any ** ppException );
+
+
+PURPENV_DLLPUBLIC void createMapping(uno_Mapping ** ppMapping,
+ uno_Environment * pFrom,
+ uno_Environment * pTo,
+ ProbeFun * probeFun = NULL,
+ void * pContext = NULL
+ );
+
+}}}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppu/macros.hxx b/include/cppu/macros.hxx
new file mode 100644
index 000000000..e891e7238
--- /dev/null
+++ b/include/cppu/macros.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPU_MACROS_HXX
+#define INCLUDED_CPPU_MACROS_HXX
+
+#include "sal/types.h"
+
+/** Namespace name for compiler/ platform, e.g. gcc3, msci
+
+ @deprecated implementation detail, not to be used by client code
+*/
+#define CPPU_CURRENT_NAMESPACE CPPU_ENV
+
+/// @cond INTERNAL
+
+/** Patching the GCC 3 incompatible alignment change for Linux.
+
+ This macro is appended by cppumaker to every first member of a struct, if
+ the struct inherits from a base struct and the first member is neither
+ double nor sal_[u]Int64. (The double/sal_[u]Int64 restriction is due to a
+ bug in GCC prior to version 3.3, which would cause __alignof__ of such a
+ struct to become 8 instead of 4 if CPPU_GCC3_ALIGN were added to its first
+ member.)
+*/
+#if defined(__GNUC__)
+#define CPPU_GCC3_ALIGN( base_struct ) __attribute__ ((aligned (__alignof__ (base_struct))))
+#else
+#define CPPU_GCC3_ALIGN( base_struct )
+#endif
+
+/**
+ Exporting the symbols necessary for exception handling on GCC.
+
+ These macros are used in the headers generated by cppumaker for UNO exception
+ types, to ensure that exception handling does not fail on GCC.
+*/
+#define CPPU_GCC_DLLPUBLIC_EXPORT SAL_EXCEPTION_DLLPUBLIC_EXPORT
+#define CPPU_GCC_DLLPRIVATE SAL_EXCEPTION_DLLPRIVATE
+
+/// @endcond
+
+#endif // INCLUDED_CPPU_MACROS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppu/unotype.hxx b/include/cppu/unotype.hxx
new file mode 100644
index 000000000..e794747ba
--- /dev/null
+++ b/include/cppu/unotype.hxx
@@ -0,0 +1,412 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPU_UNOTYPE_HXX
+#define INCLUDED_CPPU_UNOTYPE_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#if defined LIBO_INTERNAL_ONLY
+#include <type_traits>
+#endif
+
+#include "sal/types.h"
+#include "typelib/typeclass.h"
+#include "typelib/typedescription.h"
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class Type;
+ class Any;
+ class Exception;
+ template< typename > class Reference;
+ template< typename > class Sequence;
+ class XInterface;
+} } } }
+namespace rtl { class OUString; }
+
+namespace cppu {
+
+template< typename > class UnoType;
+
+/**
+ A unique C++ type representing the UNO type VOID in cppu::UnoType.
+
+ This type is declared but not defined. Its only use is as a template
+ argument to cppu::UnoType.
+
+ @since UDK 3.2.2
+*/
+struct UnoVoidType;
+
+/**
+ A unique C++ type representing the UNO type UNSIGNED SHORT in cppu::UnoType.
+
+ The UNO types UNSIGNED SHORT and CHAR map to the same C++ type, so this C++
+ type is needed to unambiguously specify UNO types in cppu::UnoType.
+
+ This type is declared but not defined. Its only use is as a template
+ argument to cppu::UnoType.
+
+ @since UDK 3.2.2
+*/
+struct UnoUnsignedShortType;
+
+/**
+ A unique C++ type representing the UNO type CHAR in cppu::UnoType.
+
+ The UNO types UNSIGNED SHORT and CHAR map to the same C++ type, so this C++
+ type is needed to unambiguously specify UNO types in cppu::UnoType.
+
+ This type is declared but not defined. Its only use is as a template
+ argument to cppu::UnoType.
+
+ @since UDK 3.2.2
+*/
+struct UnoCharType;
+
+/**
+ A unique C++ type template representing the UNO sequence types in
+ cppu::UnoType.
+
+ The UNO types UNSIGNED SHORT and CHAR map to the same C++ type, so this C++
+ type is needed to unambiguously specify UNO types in cppu::UnoType.
+
+ This type is declared but not defined. Its only use is as a template
+ argument to cppu::UnoType.
+
+ @since UDK 3.2.2
+*/
+template< typename > struct UnoSequenceType;
+
+namespace detail {
+
+inline css::uno::Type const & getTypeFromTypeDescriptionReference(
+ ::typelib_TypeDescriptionReference * const * tdr)
+{
+ return *reinterpret_cast< css::uno::Type const * >(tdr);
+}
+
+inline css::uno::Type const &
+getTypeFromTypeClass(::typelib_TypeClass tc) {
+ return getTypeFromTypeDescriptionReference(
+ ::typelib_static_type_getByTypeClass(tc));
+}
+
+}
+
+}
+
+namespace cppu { namespace detail {
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::cppu::UnoVoidType const *) {
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_VOID);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER bool const *) {
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_BOOLEAN);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER sal_Bool const *) {
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_BOOLEAN);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::sal_Int8 const *) {
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_BYTE);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::sal_Int16 const *) {
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_SHORT);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(
+ SAL_UNUSED_PARAMETER ::cppu::UnoUnsignedShortType const *)
+{
+ return ::cppu::detail::getTypeFromTypeClass(
+ ::typelib_TypeClass_UNSIGNED_SHORT);
+}
+
+#if defined LIBO_INTERNAL_ONLY
+ // cf. sal/types.h sal_Unicode
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER sal_uInt16 const *) {
+ return cppu::detail::getTypeFromTypeClass(typelib_TypeClass_UNSIGNED_SHORT);
+}
+#endif
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::sal_Int32 const *) {
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_LONG);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::sal_uInt32 const *) {
+ return ::cppu::detail::getTypeFromTypeClass(
+ ::typelib_TypeClass_UNSIGNED_LONG);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::sal_Int64 const *) {
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_HYPER);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::sal_uInt64 const *) {
+ return ::cppu::detail::getTypeFromTypeClass(
+ ::typelib_TypeClass_UNSIGNED_HYPER);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER float const *) {
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_FLOAT);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER double const *) {
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_DOUBLE);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::cppu::UnoCharType const *) {
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_CHAR);
+}
+
+#if defined LIBO_INTERNAL_ONLY
+ // cf. sal/types.h sal_Unicode
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER sal_Unicode const *) {
+ return cppu::detail::getTypeFromTypeClass(typelib_TypeClass_CHAR);
+}
+#endif
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::rtl::OUString const *) {
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_STRING);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER css::uno::Type const *)
+{
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_TYPE);
+}
+
+inline css::uno::Type const &
+cppu_detail_getUnoType(SAL_UNUSED_PARAMETER css::uno::Any const *)
+{
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_ANY);
+}
+
+template< typename T > inline css::uno::Type const &
+cppu_detail_getUnoType(
+ SAL_UNUSED_PARAMETER ::cppu::UnoSequenceType< T > const *)
+{
+ //TODO: depending on memory model, the following might not work reliably
+ static typelib_TypeDescriptionReference * p = NULL;
+ if (p == NULL) {
+ ::typelib_static_sequence_type_init(
+ &p, ::cppu::UnoType< T >::get().getTypeLibType());
+ }
+ return ::cppu::detail::getTypeFromTypeDescriptionReference(&p);
+}
+
+template< typename T > inline css::uno::Type const &
+cppu_detail_getUnoType(
+ SAL_UNUSED_PARAMETER css::uno::Sequence< T > const *)
+{
+ return cppu_detail_getUnoType(
+ static_cast< ::cppu::UnoSequenceType< T > * >(NULL));
+}
+
+inline css::uno::Type const & cppu_detail_getUnoType(
+ SAL_UNUSED_PARAMETER css::uno::Exception const *)
+{
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_EXCEPTION);
+}
+
+inline css::uno::Type const & cppu_detail_getUnoType(
+ SAL_UNUSED_PARAMETER css::uno::XInterface const *)
+{
+ return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_INTERFACE);
+}
+
+template< typename T > inline css::uno::Type const &
+cppu_detail_getUnoType(
+ SAL_UNUSED_PARAMETER css::uno::Reference< T > const *)
+{
+ return ::cppu::UnoType< T >::get();
+}
+
+} }
+
+namespace cppu {
+
+/**
+ Get the css::uno::Type instance representing a certain UNO type.
+
+ For each C++ type representing a UNO type, the corresponding instantiation of
+ this template has a public static member function get(). (The template is
+ specialized for C++ templates representing polymorphic struct type templates
+ of UNO. In those cases, it does not work to instantiate UnoType with a C++
+ type that is derived from a C++ type that represents a UNO type, but does not
+ itself represent a UNO type. In all other cases, UnoType even works for such
+ C++ types that are unambiguously derived from one C++ type that represents a
+ UNO type.) In addition to those C++ types that are mappings of UNO types
+ (except for sal_uInt16 and sal_Unicode, see below), the following C++ types
+ are appropriate as template arguments: void, cppu::UnoVoidType, bool,
+ cppu::UnoUnsignedShortType, cppu::UnoCharType, cppu::UnoSequenceType with any
+ appropriate template argument (the latter three to unambiguously specify UNO
+ types, as the UNO types UNSIGNED SHORT and CHAR map to the same C++ type),
+ and css::uno::Reference with any appropriate template argument.
+
+ @since UDK 3.2.2
+*/
+template< typename T > class UnoType {
+public:
+ static css::uno::Type const & get() {
+ using namespace ::cppu::detail;
+#if defined LIBO_INTERNAL_ONLY
+ typedef typename std::remove_reference<T>::type T1;
+ // for certain uses of UnoType<decltype(x)>
+#else
+ typedef T T1;
+#endif
+ return cppu_detail_getUnoType(static_cast< T1 * >(NULL));
+ }
+
+private:
+ UnoType(UnoType &) SAL_DELETED_FUNCTION;
+ ~UnoType() SAL_DELETED_FUNCTION;
+ void operator =(UnoType &) SAL_DELETED_FUNCTION;
+};
+
+template<> css::uno::Type inline const & UnoType<void>::get() {
+ return cppu::UnoType<cppu::UnoVoidType>::get();
+}
+
+/**
+ A working replacement for getCppuType (see there).
+
+ There are three overloads of this function that together form the replacement
+ of getCppuType. The replacement has exactly the same semantics as
+ getCppuType, in that it returns correct results for the UNO type UNSIGNED
+ SHORT but not for the UNO type CHAR.
+
+ @since UDK 3.2.2
+*/
+template< typename T > inline css::uno::Type const &
+getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *) {
+ return ::cppu::UnoType< T >::get();
+}
+
+/**
+ A working replacement for getCppuType (see there).
+
+ There are three overloads of this function that together form the replacement
+ of getCppuType. The replacement has exactly the same semantics as
+ getCppuType, in that it returns correct results for the UNO type UNSIGNED
+ SHORT but not for the UNO type CHAR.
+
+ @since UDK 3.2.2
+*/
+inline css::uno::Type const &
+getTypeFavourUnsigned(SAL_UNUSED_PARAMETER ::sal_uInt16 const *) {
+ return ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get();
+}
+
+/**
+ A working replacement for getCppuType (see there).
+
+ There are three overloads of this function that together form the replacement
+ of getCppuType. The replacement has exactly the same semantics as
+ getCppuType, in that it returns correct results for the UNO type UNSIGNED
+ SHORT but not for the UNO type CHAR.
+
+ @since UDK 3.2.2
+*/
+template< typename T > inline css::uno::Type const &
+getTypeFavourUnsigned(css::uno::Sequence< T > const *);
+ // defined in com/sun/star/uno/Sequence.hxx
+
+/// @cond INTERNAL
+
+/**
+ A working replacement for getCppuType (see there).
+
+ There are three overloads of this function that together form the replacement
+ of the getCppuType template. The replacement has exactly the same semantics
+ as the getCppuType template, in that it returns correct results for the UNO
+ type CHAR but not for the UNO type UNSIGNED SHORT. Additionally, it also
+ returns the intended results for sequence types.
+
+ @since UDK 3.2.3
+*/
+template< typename T > inline css::uno::Type const &
+getTypeFavourChar(SAL_UNUSED_PARAMETER T const *) {
+ return ::cppu::UnoType< T >::get();
+}
+
+/**
+ A working replacement for getCppuType (see there).
+
+ There are three overloads of this function that together form the replacement
+ of the getCppuType template. The replacement has exactly the same semantics
+ as the getCppuType template, in that it returns correct results for the UNO
+ type CHAR but not for the UNO type UNSIGNED SHORT. Additionally, it also
+ returns the intended results for sequence types.
+
+ @since UDK 3.2.3
+*/
+inline css::uno::Type const &
+getTypeFavourChar(SAL_UNUSED_PARAMETER ::sal_Unicode const *) {
+ return ::cppu::UnoType< ::cppu::UnoCharType >::get();
+}
+
+/**
+ A working replacement for getCppuType (see there).
+
+ There are three overloads of this function that together form the replacement
+ of the getCppuType template. The replacement has exactly the same semantics
+ as the getCppuType template, in that it returns correct results for the UNO
+ type CHAR but not for the UNO type UNSIGNED SHORT. Additionally, it also
+ returns the intended results for sequence types.
+
+ @since UDK 3.2.3
+*/
+template< typename T > inline css::uno::Type const &
+getTypeFavourChar(css::uno::Sequence< T > const *);
+ // defined in com/sun/star/uno/Sequence.hxx
+
+/// @endcond
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/TODO b/include/cppuhelper/TODO
new file mode 100644
index 000000000..e00fd0df5
--- /dev/null
+++ b/include/cppuhelper/TODO
@@ -0,0 +1,3 @@
+compbase1.hxx, compbase2.hxx, ... are just there because they are part of the published API.
+In LO internals, we could just use compbase.hxx so it would allow us to make the compbase<number>.hxx deprecated
+See https://lists.freedesktop.org/archives/libreoffice/2022-January/088279.html
diff --git a/include/cppuhelper/access_control.hxx b/include/cppuhelper/access_control.hxx
new file mode 100644
index 000000000..d0c382cdf
--- /dev/null
+++ b/include/cppuhelper/access_control.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_ACCESS_CONTROL_HXX
+#define INCLUDED_CPPUHELPER_ACCESS_CONTROL_HXX
+
+#include "cppuhelper/cppuhelperdllapi.h"
+#include "com/sun/star/uno/Reference.hxx"
+
+namespace com { namespace sun { namespace star { namespace security { class XAccessController; } } } }
+namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
+
+namespace cppu
+{
+
+/** Helper class for retrieving access controller singleton from component context.
+*/
+class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC AccessControl
+{
+ css::uno::Reference< css::security::XAccessController > m_xController;
+
+public:
+ /** Ctor.
+
+ @param xContext component context to retrieve access controller singleton
+ */
+ AccessControl(
+ css::uno::Reference< css::uno::XComponentContext > const & xContext );
+ /** Ctor.
+
+ @param xController access controller
+ */
+ AccessControl(
+ css::uno::Reference< css::security::XAccessController > const & xController );
+ /** Copy ctor.
+
+ @param ac another object
+ */
+ AccessControl( ::cppu::AccessControl const & ac );
+
+ /** Clears the access controller reference being used.
+ */
+ void SAL_CALL clear()
+ { m_xController.clear(); }
+
+ /** Returns access to the access controller reference being used.
+
+ @return access controller
+ */
+ css::uno::Reference< css::security::XAccessController > const & SAL_CALL get() const
+ { return m_xController; }
+
+ /** Returns access to the access controller reference being used.
+
+ @return access controller
+ */
+ css::security::XAccessController * SAL_CALL operator -> () const
+ { return m_xController.get(); }
+
+
+ /** A com.sun.star.security.RuntimePermission is for runtime permissions.
+ A RuntimePermission contains a name (also referred to as a "target name") but no
+ actions list; you either have the named permission or you don't.
+
+ @param name name of permission
+ */
+ void SAL_CALL checkRuntimePermission(
+ ::rtl::OUString const & name );
+
+ /** A com.sun.star.io.FilePermission represents access to a file or directory.
+ A FilePermission consists of a file url and a set of actions valid for that pathname.
+
+ @param url file url
+ @param actions actions list
+ */
+ void SAL_CALL checkFilePermission(
+ ::rtl::OUString const & url,
+ ::rtl::OUString const & actions );
+
+ /** A com.sun.star.connection.SocketPermission represents access to a network via sockets.
+ A SocketPermission consists of a host specification and a set of "actions"
+ specifying ways to connect to that host.
+
+ @param host host and optional portrange
+ @param actions actions list
+ */
+ void SAL_CALL checkSocketPermission(
+ ::rtl::OUString const & host,
+ ::rtl::OUString const & actions );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/basemutex.hxx b/include/cppuhelper/basemutex.hxx
new file mode 100644
index 000000000..5bed36a6e
--- /dev/null
+++ b/include/cppuhelper/basemutex.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPUHELPER_BASEMUTEX_HXX
+#define INCLUDED_CPPUHELPER_BASEMUTEX_HXX
+
+#include "osl/mutex.hxx"
+
+namespace cppu
+{
+ /** base class for all classes who want derive from
+ cppu::WeakComponentImplHelperXX.
+
+ Implementation classes have first to derive from BaseMutex and then from
+ cppu::WeakComponentImplHelperXX to ensure that the BaseMutex is completely
+ initialized when the mutex is used to initialize the
+ cppu::WeakComponentImplHelperXX
+ */
+ class SAL_WARN_UNUSED BaseMutex
+ {
+ protected:
+ mutable ::osl::Mutex m_aMutex;
+ };
+}
+#endif // INCLUDED_CPPUHELPER_BASEMUTEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/bootstrap.hxx b/include/cppuhelper/bootstrap.hxx
new file mode 100644
index 000000000..b8cc113f5
--- /dev/null
+++ b/include/cppuhelper/bootstrap.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_BOOTSTRAP_HXX
+#define INCLUDED_CPPUHELPER_BOOTSTRAP_HXX
+
+#include "sal/config.h"
+#include "com/sun/star/uno/Reference.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "cppuhelper/cppuhelperdllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XHierarchicalNameAccess; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace cppu
+{
+
+/** Installs type description manager instance, i.e. registers a callback at cppu core.
+
+ @param xTDMgr manager instance
+ @return true, if successfully registered
+*/
+CPPUHELPER_DLLPUBLIC sal_Bool SAL_CALL installTypeDescriptionManager(
+ css::uno::Reference< css::container::XHierarchicalNameAccess > const & xTDMgr );
+
+/** Bootstraps an initial component context with service manager upon
+ information from bootstrap variables.
+
+ This function tries to find its parameters via these bootstrap variables:
+
+ - UNO_TYPES -- a space separated list of file urls of type rdbs
+ - UNO_SERVICES -- a space separated list of file urls of service rdbs
+
+ Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html
+ for further info.
+
+ @return component context
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL
+defaultBootstrap_InitialComponentContext();
+
+
+/** Bootstraps an initial component context with service manager upon
+ information from an ini file.
+
+ This function tries to find its parameters via these bootstrap variables:
+
+ - UNO_TYPES -- a space separated list of file urls of type rdbs
+ - UNO_SERVICES -- a space separated list of file urls of service rdbs
+
+ Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html
+ for further info.
+
+ @param iniFile ini filename to get bootstrap variables
+ @return component context
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL
+defaultBootstrap_InitialComponentContext(const ::rtl::OUString & iniFile);
+
+/**
+ * An exception indicating a bootstrap error.
+ *
+ * @since UDK 3.2.0
+ */
+class CPPUHELPER_DLLPUBLIC BootstrapException
+{
+public:
+ /**
+ * Constructs a BootstrapException.
+ */
+ BootstrapException();
+
+ /**
+ * Constructs a BootstrapException with the specified detail message.
+ *
+ * @param rMessage
+ * A message containing any details about the exception.
+ */
+ BootstrapException( const ::rtl::OUString & rMessage );
+
+ /**
+ * Copy constructs a BootstrapException.
+ */
+ BootstrapException( const BootstrapException & e );
+
+ /**
+ * Destructs a BootstrapException.
+ */
+ virtual ~BootstrapException();
+
+ /**
+ * Assigns a BootstrapException.
+ */
+ BootstrapException & operator=( const BootstrapException & e );
+
+ /** Gets the message.
+
+ @return
+ A reference to the message. The reference is valid for the lifetime of
+ this BootstrapException.
+ */
+ const ::rtl::OUString & getMessage() const;
+
+private:
+ ::rtl::OUString m_aMessage;
+};
+
+/**
+ * Bootstraps the component context from a UNO installation.
+ *
+ * @return a bootstrapped component context
+ * @exception BootstrapException
+ * Thrown in case bootstrap() signals an exception due to a
+ * bootstrap error.
+ *
+ * @since UDK 3.2.0
+ */
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext >
+SAL_CALL bootstrap();
+
+/// @cond INTERNAL
+/**
+ * Helper function to expand vnd.sun.star.expand URLs in contexts where no
+ * properly bootstrapped UNO is (yet) available.
+ *
+ * @param uri
+ * Some URI (but not a URI reference).
+ *
+ * @return
+ * If uri is a vnd.sun.star.expand URL, then the expansion of that URL is
+ * returned; expansion may lead to a string that is not a legal URI. Otherwise,
+ * the uri is returned unchanged.
+ *
+ * @exception css::lang::IllegalArgumentException
+ * If uri is a vnd.sun.star.expand URL that contains unknown macros.
+ *
+ * @since UDK 3.2.8
+ */
+CPPUHELPER_DLLPUBLIC ::rtl::OUString
+SAL_CALL bootstrap_expandUri(::rtl::OUString const & uri);
+/// @endcond
+
+} // end namespace cppu
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase.hxx b/include/cppuhelper/compbase.hxx
new file mode 100644
index 000000000..d647efc60
--- /dev/null
+++ b/include/cppuhelper/compbase.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPUHELPER_COMPBASE_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE_HXX
+
+#include "sal/config.h"
+
+#include "com/sun/star/lang/XTypeProvider.hpp"
+#include "com/sun/star/uno/Any.h"
+#include "com/sun/star/uno/Reference.h"
+#include "com/sun/star/uno/Sequence.h"
+#include "com/sun/star/uno/Type.h"
+#include "cppuhelper/compbase_ex.hxx"
+#include "cppuhelper/implbase.hxx"
+#include "rtl/instance.hxx"
+#include "sal/types.h"
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XEventListener;
+} } } }
+namespace osl { class Mutex; }
+
+#if defined LIBO_INTERNAL_ONLY
+
+// A replacement for WeakAggComponentImplHelper1 has deliberately been left out,
+// as the underlying aggregation mechanism is known broken in general and should
+// not be used.
+
+namespace cppu {
+
+/** Implementation helper implementing interfaces
+ css::uno::XInterface, css::lang::XTypeProvider, and
+ css::lang::XComponent.
+
+ Like WeakComponentImplHelper, but does not define
+ XComponent::add/removeEventListener. Use for classes deriving from multiple
+ UNO interfaces with competing add/removeEventListener methods, to avoid
+ warnings about hiding of overloaded virtual functions.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call.
+
+ @attention
+ The mutex reference passed to the constructor has to outlive the constructed
+ instance.
+*/
+template<typename... Ifc>
+class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper:
+ public WeakComponentImplHelperBase, public css::lang::XTypeProvider,
+ public Ifc...
+{
+ struct cd:
+ rtl::StaticAggregate<
+ class_data,
+ detail::ImplClassData<PartialWeakComponentImplHelper, Ifc...>>
+ {};
+
+public:
+ PartialWeakComponentImplHelper(osl::Mutex & mutex) SAL_NOEXCEPT:
+ WeakComponentImplHelperBase(mutex) {}
+
+ css::uno::Any SAL_CALL queryInterface(css::uno::Type const & aType) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query(aType, cd::get(), this, this); }
+
+ void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+
+ void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+
+ void SAL_CALL dispose()
+ SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+
+ css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes(cd::get()); }
+
+ css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return css::uno::Sequence<sal_Int8>(); }
+};
+
+/** Implementation helper implementing interfaces
+ css::uno::XInterface, css::lang::XTypeProvider, and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call.
+
+ @attention
+ The mutex reference passed to the constructor has to outlive the constructed
+ instance.
+*/
+template<typename... Ifc>
+class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper:
+ public PartialWeakComponentImplHelper<Ifc...>
+{
+public:
+ WeakComponentImplHelper(osl::Mutex & mutex) SAL_NOEXCEPT:
+ PartialWeakComponentImplHelper<Ifc...>(mutex) {}
+
+ void SAL_CALL addEventListener(
+ css::uno::Reference<css::lang::XEventListener> const & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+
+ void SAL_CALL removeEventListener(
+ css::uno::Reference<css::lang::XEventListener> const & aListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(aListener); }
+};
+
+}
+
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase1.hxx b/include/cppuhelper/compbase1.hxx
new file mode 100644
index 000000000..02c812920
--- /dev/null
+++ b/include/cppuhelper/compbase1.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE1_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE1_HXX
+
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper1
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakComponentImplHelper1< Ifc1 > > > {};
+ public:
+ WeakComponentImplHelper1( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper1, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper1
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, PartialWeakComponentImplHelper1< Ifc1 > > > {};
+ public:
+ PartialWeakComponentImplHelper1( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper1
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggComponentImplHelper1< Ifc1 > > > {};
+ public:
+ WeakAggComponentImplHelper1( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase10.hxx b/include/cppuhelper/compbase10.hxx
new file mode 100644
index 000000000..27682f83c
--- /dev/null
+++ b/include/cppuhelper/compbase10.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE10_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE10_HXX
+
+#include "cppuhelper/implbase10.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper10
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, WeakComponentImplHelper10<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
+ public:
+ WeakComponentImplHelper10( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper10, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper10
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, PartialWeakComponentImplHelper10<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
+ public:
+ PartialWeakComponentImplHelper10( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper10
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, WeakAggComponentImplHelper10<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
+ public:
+ WeakAggComponentImplHelper10( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase11.hxx b/include/cppuhelper/compbase11.hxx
new file mode 100644
index 000000000..9edfb3f46
--- /dev/null
+++ b/include/cppuhelper/compbase11.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE11_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE11_HXX
+
+#include "cppuhelper/implbase11.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper11
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, WeakComponentImplHelper11<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11> > > {};
+ public:
+ WeakComponentImplHelper11( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper11, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper11
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, PartialWeakComponentImplHelper11<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11> > > {};
+ public:
+ PartialWeakComponentImplHelper11( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper11
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, WeakAggComponentImplHelper11<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11> > > {};
+ public:
+ WeakAggComponentImplHelper11( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase12.hxx b/include/cppuhelper/compbase12.hxx
new file mode 100644
index 000000000..c5dd62158
--- /dev/null
+++ b/include/cppuhelper/compbase12.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE12_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE12_HXX
+
+#include "cppuhelper/implbase12.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper12
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, WeakComponentImplHelper12<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {};
+ public:
+ WeakComponentImplHelper12( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper12, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper12
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, PartialWeakComponentImplHelper12<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {};
+ public:
+ PartialWeakComponentImplHelper12( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper12
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, WeakAggComponentImplHelper12<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {};
+ public:
+ WeakAggComponentImplHelper12( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase2.hxx b/include/cppuhelper/compbase2.hxx
new file mode 100644
index 000000000..ed74588f6
--- /dev/null
+++ b/include/cppuhelper/compbase2.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE2_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE2_HXX
+
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper2
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakComponentImplHelper2<Ifc1, Ifc2> > > {};
+ public:
+ WeakComponentImplHelper2( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper2, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1, class Ifc2 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper2
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, PartialWeakComponentImplHelper2<Ifc1, Ifc2> > > {};
+ public:
+ PartialWeakComponentImplHelper2( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1, class Ifc2 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper2
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggComponentImplHelper2<Ifc1, Ifc2> > > {};
+ public:
+ WeakAggComponentImplHelper2( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase3.hxx b/include/cppuhelper/compbase3.hxx
new file mode 100644
index 000000000..10681422b
--- /dev/null
+++ b/include/cppuhelper/compbase3.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE3_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE3_HXX
+
+#include "cppuhelper/implbase3.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper3
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakComponentImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
+ public:
+ WeakComponentImplHelper3( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper3, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1, class Ifc2, class Ifc3 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper3
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, PartialWeakComponentImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
+ public:
+ PartialWeakComponentImplHelper3( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1, class Ifc2, class Ifc3 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper3
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakAggComponentImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
+ public:
+ WeakAggComponentImplHelper3( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase4.hxx b/include/cppuhelper/compbase4.hxx
new file mode 100644
index 000000000..04a8cdd88
--- /dev/null
+++ b/include/cppuhelper/compbase4.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE4_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE4_HXX
+
+#include "cppuhelper/implbase4.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper4
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakComponentImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
+ public:
+ WeakComponentImplHelper4( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper4, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper4
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, PartialWeakComponentImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
+ public:
+ PartialWeakComponentImplHelper4( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper4
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakAggComponentImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
+ public:
+ WeakAggComponentImplHelper4( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase5.hxx b/include/cppuhelper/compbase5.hxx
new file mode 100644
index 000000000..f48a2f21e
--- /dev/null
+++ b/include/cppuhelper/compbase5.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE5_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE5_HXX
+
+#include "cppuhelper/implbase5.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper5
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakComponentImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
+ public:
+ WeakComponentImplHelper5( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper5, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper5
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, PartialWeakComponentImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
+ public:
+ PartialWeakComponentImplHelper5( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper5
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakAggComponentImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
+ public:
+ WeakAggComponentImplHelper5( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase6.hxx b/include/cppuhelper/compbase6.hxx
new file mode 100644
index 000000000..971a1e4c5
--- /dev/null
+++ b/include/cppuhelper/compbase6.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE6_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE6_HXX
+
+#include "cppuhelper/implbase6.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper6
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, WeakComponentImplHelper6<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
+ public:
+ WeakComponentImplHelper6( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper6, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper6
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, PartialWeakComponentImplHelper6<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
+ public:
+ PartialWeakComponentImplHelper6( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper6
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, WeakAggComponentImplHelper6<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
+ public:
+ WeakAggComponentImplHelper6( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase7.hxx b/include/cppuhelper/compbase7.hxx
new file mode 100644
index 000000000..c6176e185
--- /dev/null
+++ b/include/cppuhelper/compbase7.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE7_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE7_HXX
+
+#include "cppuhelper/implbase7.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper7
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, WeakComponentImplHelper7<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7> > > {};
+ public:
+ WeakComponentImplHelper7( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper7, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper7
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, PartialWeakComponentImplHelper7<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7> > > {};
+ public:
+ PartialWeakComponentImplHelper7( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper7
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, WeakAggComponentImplHelper7<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7> > > {};
+ public:
+ WeakAggComponentImplHelper7( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase8.hxx b/include/cppuhelper/compbase8.hxx
new file mode 100644
index 000000000..c70e26f7f
--- /dev/null
+++ b/include/cppuhelper/compbase8.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE8_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE8_HXX
+
+#include "cppuhelper/implbase8.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper8
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakComponentImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
+ public:
+ WeakComponentImplHelper8( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper8, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper8
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, PartialWeakComponentImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
+ public:
+ PartialWeakComponentImplHelper8( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper8
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakAggComponentImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
+ public:
+ WeakAggComponentImplHelper8( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase9.hxx b/include/cppuhelper/compbase9.hxx
new file mode 100644
index 000000000..e1f28d536
--- /dev/null
+++ b/include/cppuhelper/compbase9.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE9_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE9_HXX
+
+#include "cppuhelper/implbase9.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+namespace cppu
+{
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper9
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, WeakComponentImplHelper9<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9> > > {};
+ public:
+ WeakComponentImplHelper9( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual void SAL_CALL dispose() SAL_OVERRIDE
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Same as WeakComponentImplHelper9, except doesn't implement
+ addEventListener, removeEventListener and dispose.
+
+ This requires derived classes to implement those three methods.
+ This makes it possible to implement classes which are required to
+ implement methods from multiple bases which have different
+ addEventListener/removeEventListener signatures without triggering
+ the g++ overloaded-virtual warning
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper9
+ : public WeakComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, PartialWeakComponentImplHelper9<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9> > > {};
+ public:
+ PartialWeakComponentImplHelper9( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+
+ /** Implementation helper supporting css::lang::XTypeProvider and
+ css::lang::XComponent.
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ css::uno::WeakReference. Object of this class can be
+ aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ @deprecated
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper9
+ : public WeakAggComponentImplHelperBase
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, WeakAggComponentImplHelper9<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9> > > {};
+ public:
+ WeakAggComponentImplHelper9( ::osl::Mutex & rMutex ) SAL_NOEXCEPT
+ : WeakAggComponentImplHelperBase( rMutex )
+ {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { WeakAggComponentImplHelperBase::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/compbase_ex.hxx b/include/cppuhelper/compbase_ex.hxx
new file mode 100644
index 000000000..3976c3afb
--- /dev/null
+++ b/include/cppuhelper/compbase_ex.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPBASE_EX_HXX
+#define INCLUDED_CPPUHELPER_COMPBASE_EX_HXX
+
+#include "cppuhelper/interfacecontainer.h"
+#include "com/sun/star/lang/XComponent.hpp"
+#include "cppuhelper/cppuhelperdllapi.h"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+
+/// @cond INTERNAL
+
+namespace osl { class Mutex; }
+namespace cppu { struct class_data; }
+
+namespace cppu
+{
+
+/** Implementation helper base class for components. Inherits from ::cppu::OWeakObject and
+ css::lang::XComponent.
+*/
+class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakComponentImplHelperBase
+ : public ::cppu::OWeakObject
+ , public css::lang::XComponent
+{
+protected:
+ /** broadcast helper for disposing events
+ */
+ ::cppu::OBroadcastHelper rBHelper;
+
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing();
+
+ /** This is the one and only constructor that is called from derived implementations.
+
+ @param rMutex mutex to sync upon disposing
+ */
+ WeakComponentImplHelperBase( ::osl::Mutex & rMutex );
+public:
+ /** Destructor
+ */
+ virtual ~WeakComponentImplHelperBase() SAL_OVERRIDE;
+
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete( void *, void * )
+ {}
+
+ virtual css::uno::Any SAL_CALL queryInterface(
+ css::uno::Type const & rType ) SAL_OVERRIDE;
+ virtual void SAL_CALL acquire()
+ SAL_NOEXCEPT SAL_OVERRIDE;
+ virtual void SAL_CALL release()
+ SAL_NOEXCEPT SAL_OVERRIDE;
+ virtual void SAL_CALL dispose() SAL_OVERRIDE;
+ virtual void SAL_CALL addEventListener(
+ css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
+ virtual void SAL_CALL removeEventListener(
+ css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
+};
+
+/** Implementation helper base class for components. Inherits from ::cppu::OWeakAggObject and
+ css::lang::XComponent.
+*/
+class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakAggComponentImplHelperBase
+ : public ::cppu::OWeakAggObject
+ , public css::lang::XComponent
+{
+protected:
+ ::cppu::OBroadcastHelper rBHelper;
+
+ /** Is called upon disposing the component.
+ */
+ virtual void SAL_CALL disposing();
+
+ WeakAggComponentImplHelperBase( ::osl::Mutex & rMutex );
+public:
+ virtual ~WeakAggComponentImplHelperBase() SAL_OVERRIDE;
+
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete( void *, void * )
+ {}
+
+ virtual css::uno::Any SAL_CALL queryInterface(
+ css::uno::Type const & rType ) SAL_OVERRIDE;
+ virtual css::uno::Any SAL_CALL queryAggregation(
+ css::uno::Type const & rType ) SAL_OVERRIDE;
+ virtual void SAL_CALL acquire()
+ SAL_NOEXCEPT SAL_OVERRIDE;
+ virtual void SAL_CALL release()
+ SAL_NOEXCEPT SAL_OVERRIDE;
+ virtual void SAL_CALL dispose() SAL_OVERRIDE;
+ virtual void SAL_CALL addEventListener(
+ css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
+ virtual void SAL_CALL removeEventListener(
+ css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
+};
+
+/** WeakComponentImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakComponentImplHelper_query(
+ css::uno::Type const & rType,
+ class_data * cd,
+ void * that,
+ ::cppu::WeakComponentImplHelperBase * pBase );
+/** WeakComponentImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakComponentImplHelper_getTypes(
+ class_data * cd );
+
+/** WeakAggComponentImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakAggComponentImplHelper_queryAgg(
+ css::uno::Type const & rType,
+ class_data * cd,
+ void * that,
+ ::cppu::WeakAggComponentImplHelperBase * pBase );
+/** WeakAggComponentImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakAggComponentImplHelper_getTypes(
+ class_data * cd );
+
+}
+
+/// @endcond
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/component.hxx b/include/cppuhelper/component.hxx
new file mode 100644
index 000000000..e59e1b9d4
--- /dev/null
+++ b/include/cppuhelper/component.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPONENT_HXX
+#define INCLUDED_CPPUHELPER_COMPONENT_HXX
+
+#include "cppuhelper/weakagg.hxx"
+#include "cppuhelper/interfacecontainer.h"
+
+#include "com/sun/star/lang/XComponent.hpp"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+#include "cppuhelper/cppuhelperdllapi.h"
+
+namespace osl { class Mutex; }
+
+namespace cppu
+{
+
+/** Deprecated. Helper for implementing css::lang::XComponent.
+ Upon disposing objects of this class, sub-classes receive a disposing() call. Objects of
+ this class can be held weakly, i.e. by a css::uno::WeakReference. Object of
+ this class can be aggregated, i.e. incoming queryInterface() calls are delegated.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects of this class.
+ @deprecated
+*/
+class CPPUHELPER_DLLPUBLIC OComponentHelper
+ : public ::cppu::OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public css::lang::XComponent
+{
+public:
+ /** Constructor.
+
+ @param rMutex
+ the mutex used to protect multi-threaded access;
+ lifetime must be longer than the lifetime of this object.
+ */
+ OComponentHelper( ::osl::Mutex & rMutex );
+ /** Destructor. If this object was not disposed previously, object will be disposed manually.
+ */
+ virtual ~OComponentHelper() SAL_OVERRIDE;
+
+ // XAggregation
+ virtual css::uno::Any SAL_CALL queryInterface(
+ css::uno::Type const & rType ) SAL_OVERRIDE;
+ virtual css::uno::Any SAL_CALL queryAggregation(
+ css::uno::Type const & rType ) SAL_OVERRIDE;
+ virtual void SAL_CALL acquire()
+ SAL_NOEXCEPT SAL_OVERRIDE;
+ virtual void SAL_CALL release()
+ SAL_NOEXCEPT SAL_OVERRIDE;
+
+ /** @attention
+ XTypeProvider::getImplementationId() has to be implemented separately!
+ */
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE = 0;
+ /** @attention
+ XTypeProvider::getTypes() has to be re-implemented!
+ */
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE;
+
+ // XComponent
+ virtual void SAL_CALL dispose() SAL_OVERRIDE;
+ virtual void SAL_CALL addEventListener(
+ const css::uno::Reference< css::lang::XEventListener >& aListener ) SAL_OVERRIDE;
+ virtual void SAL_CALL removeEventListener(
+ const css::uno::Reference< css::lang::XEventListener >& aListener ) SAL_OVERRIDE;
+
+protected:
+ /** Called in dispose method after the listeners were notified.
+ */
+ virtual void SAL_CALL disposing();
+
+ /// @cond INTERNAL
+ OBroadcastHelper rBHelper;
+ /// @endcond
+
+private:
+ OComponentHelper( const OComponentHelper & ) SAL_DELETED_FUNCTION;
+ OComponentHelper & operator = ( const OComponentHelper & )
+ SAL_DELETED_FUNCTION;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/component_context.hxx b/include/cppuhelper/component_context.hxx
new file mode 100644
index 000000000..787264ab5
--- /dev/null
+++ b/include/cppuhelper/component_context.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_COMPONENT_CONTEXT_HXX
+#define INCLUDED_CPPUHELPER_COMPONENT_CONTEXT_HXX
+
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Reference.hxx"
+#include "cppuhelper/cppuhelperdllapi.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
+
+namespace cppu
+{
+
+/** Context entries init struct calling createComponentContext().
+*/
+struct SAL_WARN_UNUSED ContextEntry_Init
+{
+ /** late init denotes an object that will be raised when first get() is calling for it
+
+ The context implementation expects either a css::lang::XSingleComponentFactory
+ object as value (to instantiate the object) or a string as value for raising
+ a service via the used service manager.
+ */
+ bool bLateInitService;
+ /** name of context value
+ */
+ ::rtl::OUString name;
+ /** context value
+ */
+ css::uno::Any value;
+
+ /** Default ctor.
+ */
+ ContextEntry_Init()
+ : bLateInitService( false )
+ {}
+ /** Ctor.
+
+ @param name_
+ name of entry
+ @param value_
+ value of entry
+ @param bLateInitService_
+ whether this entry is a late-init named object entry
+ (value is object factory or service string)
+ */
+ ContextEntry_Init(
+ ::rtl::OUString const & name_,
+ css::uno::Any const & value_,
+ bool bLateInitService_ = false )
+ : bLateInitService( bLateInitService_ ),
+ name( name_ ),
+ value( value_ )
+ {}
+};
+
+/** Creates a component context with the given entries.
+
+ @param pEntries array of entries
+ @param nEntries number of entries
+ @param xDelegate delegation to further context, if value was not found
+ @return new context object
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext >
+SAL_CALL createComponentContext(
+ ContextEntry_Init const * pEntries, sal_Int32 nEntries,
+ css::uno::Reference< css::uno::XComponentContext > const & xDelegate =
+ css::uno::Reference< css::uno::XComponentContext >() );
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/cppuhelperdllapi.h b/include/cppuhelper/cppuhelperdllapi.h
new file mode 100644
index 000000000..1fa74845a
--- /dev/null
+++ b/include/cppuhelper/cppuhelperdllapi.h
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPUHELPER_CPPUHELPERDLLAPI_H
+#define INCLUDED_CPPUHELPER_CPPUHELPERDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(CPPUHELPER_DLLIMPLEMENTATION)
+#define CPPUHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define CPPUHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define CPPUHELPER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_CPPUHELPER_CPPUHELPERDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/exc_hlp.hxx b/include/cppuhelper/exc_hlp.hxx
new file mode 100644
index 000000000..fa3c3d05b
--- /dev/null
+++ b/include/cppuhelper/exc_hlp.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPUHELPER_EXC_HLP_HXX
+#define INCLUDED_CPPUHELPER_EXC_HLP_HXX
+
+#include "com/sun/star/uno/Any.hxx"
+#include "cppuhelper/cppuhelperdllapi.h"
+
+namespace cppu
+{
+/** This function throws the exception given by rExc. The given value has to
+ be of typeclass EXCEPTION and must be derived from or of
+ type com.sun.star.uno.Exception.
+
+ @param rExc
+ exception to be thrown.
+*/
+CPPUHELPER_DLLPUBLIC void SAL_CALL throwException(const css::uno::Any& rExc);
+
+/** Use this function to get the dynamic type of a caught C++-UNO exception;
+ completes the above function throwing exceptions generically.
+
+ @code
+ try
+ {
+ ...
+ }
+ catch (css::uno::RuntimeException &)
+ {
+ // you ought not handle RuntimeExceptions:
+ throw;
+ }
+ catch (css::uno::Exception &)
+ {
+ css::uno::Any caught( ::cppu::getCaughtException() );
+ ...
+ }
+ @endcode
+
+ Restrictions:
+ - use only for caught C++-UNO exceptions (UNOIDL defined)
+ - only as first statement in a catch block!
+ - don't do a C++ rethrow (throw;) after you have called this function
+ - call getCaughtException() just once in your catch block!
+ (function internally uses a C++ rethrow)
+
+ @return
+ caught UNO exception
+
+ @attention Caution!
+ This function is limited to the same C++ compiler runtime library.
+ E.g. for MSVC, this means that the catch handler code (the one
+ that calls getCaughtException()) needs to use the very same
+ C++ runtime library, e.g. msvcrt.dll as cppuhelper, e.g.
+ cppuhelper3MSC.dll and the bridge library, e.g. msci_uno.dll.
+ This is the case if all of them are compiled with the same
+ compiler version.
+ Background: The msci_uno.dll gets a rethrown exception out
+ of the internal msvcrt.dll thread local storage (tls).
+ Thus you _must_ not use this function if your code needs to run
+ in newer UDK versions without being recompiled, because those
+ newer UDK (-> OOo versions) potentially use newer C++ runtime
+ libraries which most often become incompatible!
+
+ But this function ought to be usable for most OOo internal C++-UNO
+ development, because the whole OOo code base is compiled using the
+ same C++ compiler (and linking against one runtime library).
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL getCaughtException();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/factory.hxx b/include/cppuhelper/factory.hxx
new file mode 100644
index 000000000..e6a9ee2f1
--- /dev/null
+++ b/include/cppuhelper/factory.hxx
@@ -0,0 +1,278 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_FACTORY_HXX
+#define INCLUDED_CPPUHELPER_FACTORY_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "rtl/ustring.hxx"
+#include "rtl/unload.h"
+
+#include "com/sun/star/uno/Reference.h"
+#include "cppuhelper/cppuhelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } }
+namespace com { namespace sun { namespace star { namespace lang { class XSingleComponentFactory; } } } }
+namespace com { namespace sun { namespace star { namespace lang { class XSingleServiceFactory; } } } }
+namespace com { namespace sun { namespace star { namespace registry { class XRegistryKey; } } } }
+namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
+namespace com { namespace sun { namespace star { namespace uno { class XInterface; } } } }
+namespace com { namespace sun { namespace star { namespace uno { template <class E> class Sequence; } } } }
+
+#define COMPONENT_GETENV "component_getImplementationEnvironment"
+#define COMPONENT_GETENVEXT "component_getImplementationEnvironmentExt"
+#define COMPONENT_WRITEINFO "component_writeInfo"
+#define COMPONENT_GETFACTORY "component_getFactory"
+
+typedef struct _uno_Environment uno_Environment;
+
+/** Function pointer declaration.
+ Function determines the environment of the component implementation, i.e. which compiler
+ compiled it. If the environment is NOT session specific (needs no additional context),
+ then this function should return the environment type name and leave ppEnv (to 0).
+
+ @param ppEnvTypeName environment type name; string must be constant
+ @param ppEnv function returns its environment if the environment is session specific,
+ i.e. has special context
+*/
+typedef void (SAL_CALL * component_getImplementationEnvironmentFunc)(
+ const char ** ppEnvTypeName, uno_Environment ** ppEnv );
+
+/** Function pointer declaration.
+ Function determines the environment of the component implementation, i.e. the compiler.
+ If the environment is NOT session specific (needs no additional context),
+ then this function should return the environment type name and leave ppEnv (to 0).
+
+ @param ppEnvTypeName environment type name; string must be a constant
+ @param ppEnv function returns an environment if the environment is session specific,
+ i.e. has special context
+ @param pImplName
+*/
+typedef void (SAL_CALL * component_getImplementationEnvironmentExtFunc)(
+ char const ** ppEnvTypeName,
+ uno_Environment ** ppEnv,
+ char const * pImplName,
+ uno_Environment * pTargetEnv
+);
+
+/** Function pointer declaration.
+ Function retrieves a component description.
+
+ @return an XML formatted string containing a short component description
+ @deprecated
+*/
+typedef const char * (SAL_CALL * component_getDescriptionFunc)(void);
+
+/** Function pointer declaration.
+
+ @deprecated component_writeInfo should no longer be used in new components
+
+ Function writes component registry info, at least writing the supported service names.
+
+ @param pServiceManager
+ a service manager (the type is an XMultiServiceFactory that can be used
+ by the environment returned by component_getImplementationEnvironment)
+ @param pRegistryKey a registry key
+ (the type is XRegistryKey that can be used by the environment
+ returned by component_getImplementationEnvironment)
+ @return true if everything went fine
+*/
+typedef sal_Bool (SAL_CALL * component_writeInfoFunc)(
+ void * pServiceManager, void * pRegistryKey );
+
+/** Function pointer declaration.
+ Retrieves a factory to create component instances.
+
+ @param pImplName
+ desired implementation name
+ @param pServiceManager
+ a service manager (the type is XMultiServiceFactory that can be used by the environment
+ returned by component_getImplementationEnvironment)
+ @param pRegistryKey
+ a registry key (the type is XRegistryKey that can be used by the environment
+ returned by component_getImplementationEnvironment)
+ @return acquired component factory
+ (the type is lang::XSingleComponentFactory or lang::XSingleServiceFactory to be used by the
+ environment returned by component_getImplementationEnvironment)
+*/
+typedef void * (SAL_CALL * component_getFactoryFunc)(
+ const char * pImplName, void * pServiceManager, void * pRegistryKey );
+
+
+namespace cppu
+{
+
+/** Function pointer declaration.
+ Function creates component instance passing the component context to be used.
+
+ @param xContext component context to be used
+ @return component instance
+*/
+typedef css::uno::Reference< css::uno::XInterface >(
+ SAL_CALL * ComponentFactoryFunc)(
+ css::uno::Reference< css::uno::XComponentContext > const & xContext );
+
+/** Creates a single component factory supporting the XSingleComponentFactory interface.
+
+ @param fptr function pointer for instantiating the object
+ @param rImplementationName implementation name of service
+ @param rServiceNames supported services
+ @param pModCount a backwards-compatibility remainder of a removed library
+ unloading feature; always set to null
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleComponentFactory >
+SAL_CALL createSingleComponentFactory(
+ ComponentFactoryFunc fptr,
+ ::rtl::OUString const & rImplementationName,
+ css::uno::Sequence< ::rtl::OUString > const & rServiceNames,
+ rtl_ModuleCount * pModCount = NULL );
+
+/** Creates a single service factory which holds the instance created only once.
+
+ @param fptr function pointer for instantiating the object
+ @param rImplementationName implementation name of service
+ @param rServiceNames supported services
+ @param pModCount a backwards-compatibility remainder of a removed library
+ unloading feature; always set to null
+
+ @see createSingleComponentFactory
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleComponentFactory > SAL_CALL
+createOneInstanceComponentFactory(
+ ComponentFactoryFunc fptr,
+ ::rtl::OUString const & rImplementationName,
+ css::uno::Sequence< ::rtl::OUString > const & rServiceNames,
+ rtl_ModuleCount * pModCount = NULL );
+
+/** Deprecated. The type of the instantiate function used as argument of the create*Factory functions.
+
+ @see createSingleFactory
+ @see createOneInstanceFactory
+ @deprecated
+*/
+typedef css::uno::Reference< css::uno::XInterface >(SAL_CALL * ComponentInstantiation)(
+ const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager );
+
+/** Deprecated. Creates a single service factory.
+
+ @param rServiceManager the service manager used by the implementation.
+ @param rImplementationName the implementation name. An empty string is possible.
+ @param pCreateFunction the function pointer to create an object.
+ @param rServiceNames the service supported by the implementation.
+ @param pModCount a backwards-compatibility remainder of a removed library
+ unloading feature; always set to null.
+ @return a factory that support the interfaces XServiceProvider, XServiceInfo
+ XSingleServiceFactory and XComponent.
+
+ @see createOneInstanceFactory
+ @deprecated
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
+createSingleFactory(
+ const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
+ const ::rtl::OUString & rImplementationName,
+ ComponentInstantiation pCreateFunction,
+ const css::uno::Sequence< ::rtl::OUString > & rServiceNames,
+ rtl_ModuleCount * pModCount = NULL );
+
+/** Deprecated. Creates a factory wrapping another one.
+ This means the methods of the interfaces XServiceProvider, XServiceInfo and
+ XSingleServiceFactory are forwarded.
+ @attention
+ The XComponent interface is not supported!
+
+ @param rServiceManager the service manager used by the implementation.
+ @param rFactory the wrapped service factory.
+ @return a factory that support the interfaces XServiceProvider, XServiceInfo
+ XSingleServiceFactory.
+
+ @see createSingleFactory
+ @deprecated
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
+createFactoryProxy(
+ const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
+ const css::uno::Reference< css::lang::XSingleServiceFactory > & rFactory );
+
+/** Deprecated. Creates a single service factory which holds the instance created only once.
+
+ @param rServiceManager the service manager used by the implementation.
+ @param rComponentName the implementation name. An empty string is possible.
+ @param pCreateFunction the function pointer to create an object.
+ @param rServiceNames the service supported by the implementation.
+ @param pModCount a backwards-compatibility remainder of a removed library
+ unloading feature; always set to null.
+ @return a factory that support the interfaces XServiceProvider, XServiceInfo
+ XSingleServiceFactory and XComponent.
+
+ @see createSingleFactory
+ @deprecated
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
+createOneInstanceFactory(
+ const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
+ const ::rtl::OUString & rComponentName,
+ ComponentInstantiation pCreateFunction,
+ const css::uno::Sequence< ::rtl::OUString > & rServiceNames,
+ rtl_ModuleCount * pModCount = NULL );
+
+/** Deprecated. Creates a single service factory based on a registry.
+
+ @param rServiceManager the service manager used by the implementation.
+ @param rImplementationName the implementation name. An empty string is possible.
+ @param rImplementationKey the registry key of the implementation section.
+ @return a factory that support the interfaces XServiceProvider, XServiceInfo
+ XSingleServiceFactory and XComponent.
+ @deprecated
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
+createSingleRegistryFactory(
+ const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
+ const ::rtl::OUString & rImplementationName,
+ const css::uno::Reference< css::registry::XRegistryKey > & rImplementationKey );
+
+/** Deprecated. Creates a single service factory which holds the instance created only once
+ based on a registry.
+
+ @param rServiceManager the service manager used by the implementation.
+ @param rComponentName the implementation name. An empty string is possible.
+ @param rImplementationKey the registry key of the implementation section.
+ @return a factory that support the interfaces XServiceProvider, XServiceInfo
+ XSingleServiceFactory and XComponent.
+
+ @see createSingleRegistryFactory
+ @deprecated
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
+createOneInstanceRegistryFactory(
+ const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
+ const ::rtl::OUString & rComponentName,
+ const css::uno::Reference< css::registry::XRegistryKey > & rImplementationKey );
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/findsofficepath.h b/include/cppuhelper/findsofficepath.h
new file mode 100644
index 000000000..19d031f5b
--- /dev/null
+++ b/include/cppuhelper/findsofficepath.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPUHELPER_FINDSOFFICEPATH_H
+#define INCLUDED_CPPUHELPER_FINDSOFFICEPATH_H
+
+#include "sal/config.h"
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+/* Internal function to find an soffice installation.
+ Not to be called by client code.
+ Returned pointer must be released with free() */
+#if defined(_WIN32)
+wchar_t*
+#else
+char*
+#endif
+cppuhelper_detail_findSofficePath(void);
+
+#if defined __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase.hxx b/include/cppuhelper/implbase.hxx
new file mode 100644
index 000000000..f2f08650e
--- /dev/null
+++ b/include/cppuhelper/implbase.hxx
@@ -0,0 +1,186 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+#include <utility>
+
+#include "com/sun/star/lang/XTypeProvider.hpp"
+#include "com/sun/star/uno/Any.h"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/Type.h"
+#include "cppuhelper/implbase_ex.hxx"
+#include "cppuhelper/weak.hxx"
+#include "rtl/instance.hxx"
+#include "sal/types.h"
+
+#if defined LIBO_INTERNAL_ONLY
+
+// A replacement for ImplHelperN has deliberately been left out, as ImplHelperN
+// is unlikely ever be a better choice than WeakImplHelper, so all their
+// existing uses are probably confused and should use WeakImplHelper instead.
+//
+// Replacements for WeakAggImplHelperN and AggImplInheritanceHelperN have
+// deliberately been left out, as the underlying aggregation mechanism is known
+// broken in general and should not be used.
+
+namespace cppu {
+
+/// @cond INTERNAL
+
+namespace detail {
+
+template<std::size_t N> struct class_dataN {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[16];
+ type_entry m_typeEntries[N + 1];
+};
+
+template<typename Impl, typename... Ifc> struct ImplClassData {
+ class_data * operator ()() {
+ static class_dataN<sizeof... (Ifc)> s_cd = {
+ sizeof... (Ifc) + 1, false, false, {},
+ {
+ { { Ifc::static_type },
+ (reinterpret_cast<sal_IntPtr>(
+ static_cast<Ifc *>(reinterpret_cast<Impl *>(16)))
+ - 16)
+ }...,
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast<class_data *>(&s_cd);
+ }
+};
+
+}
+
+/// @endcond
+
+/** Implementation helper implementing interfaces
+ css::uno::XInterface, css::lang::XTypeProvider, and
+ css::uno::XWeak (through cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as
+ template argument(s).
+*/
+template<typename... Ifc>
+class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper:
+ public OWeakObject, public css::lang::XTypeProvider, public Ifc...
+{
+ struct cd:
+ rtl::StaticAggregate<
+ class_data, detail::ImplClassData<WeakImplHelper, Ifc...>>
+ {};
+
+protected:
+ WeakImplHelper() {}
+
+ virtual ~WeakImplHelper() override {}
+
+public:
+ WeakImplHelper(WeakImplHelper const &) = default;
+ WeakImplHelper(WeakImplHelper &&) = default;
+ WeakImplHelper & operator =(WeakImplHelper const &) = default;
+ WeakImplHelper & operator =(WeakImplHelper &&) = default;
+
+ css::uno::Any SAL_CALL queryInterface(css::uno::Type const & aType) override
+ { return WeakImplHelper_query(aType, cd::get(), this, this); }
+
+ void SAL_CALL acquire() SAL_NOEXCEPT override { OWeakObject::acquire(); }
+
+ void SAL_CALL release() SAL_NOEXCEPT override { OWeakObject::release(); }
+
+ css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override
+ { return WeakImplHelper_getTypes(cd::get()); }
+
+ css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override
+ { return css::uno::Sequence<sal_Int8>(); }
+};
+
+/** Implementation helper implementing interfaces
+ css::uno::XInterface and css::lang::XTypeProvider
+ inheriting from a BaseClass.
+
+ All acquire() and release() calls are delegated to the BaseClass. Upon
+ queryInterface(), if a demanded interface is not supported by this class
+ directly, the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in the sense that
+ css::uno::XInterface and css::lang::XTypeProvider are
+ implemented properly.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be
+ implemented as template argument(s).
+*/
+template<typename BaseClass, typename... Ifc>
+class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper:
+ public BaseClass, public Ifc...
+{
+ struct cd:
+ rtl::StaticAggregate<
+ class_data, detail::ImplClassData<ImplInheritanceHelper, Ifc...>>
+ {};
+
+protected:
+ template<typename... Arg> ImplInheritanceHelper(Arg &&... arg):
+ BaseClass(std::forward<Arg>(arg)...)
+ {}
+
+ virtual ~ImplInheritanceHelper() {}
+
+public:
+ ImplInheritanceHelper(ImplInheritanceHelper const &) = default;
+ ImplInheritanceHelper(ImplInheritanceHelper &&) = default;
+ ImplInheritanceHelper & operator =(ImplInheritanceHelper const &) = default;
+ ImplInheritanceHelper & operator =(ImplInheritanceHelper &&) = default;
+
+ css::uno::Any SAL_CALL queryInterface(css::uno::Type const & aType) override
+ {
+ css::uno::Any ret(ImplHelper_queryNoXInterface(aType, cd::get(), this));
+ return ret.hasValue() ? ret : BaseClass::queryInterface(aType);
+ }
+
+ void SAL_CALL acquire() SAL_NOEXCEPT override { BaseClass::acquire(); }
+
+ void SAL_CALL release() SAL_NOEXCEPT override { BaseClass::release(); }
+
+ css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override
+ { return ImplInhHelper_getTypes(cd::get(), BaseClass::getTypes()); }
+
+ css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override
+ { return css::uno::Sequence<sal_Int8>(); }
+};
+
+}
+
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase1.hxx b/include/cppuhelper/implbase1.hxx
new file mode 100644
index 000000000..dc82a7308
--- /dev/null
+++ b/include/cppuhelper/implbase1.hxx
@@ -0,0 +1,311 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE1_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE1_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data1
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 1 + 1 ];
+ };
+
+ template< typename Ifc1, typename Impl > struct SAL_WARN_UNUSED ImplClassData1
+ {
+ class_data* operator ()()
+ {
+ static class_data1 s_cd =
+ {
+ 1 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper1
+ : public css::lang::XTypeProvider
+ , public Ifc1
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData1 < Ifc1, ImplHelper1<Ifc1> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper1() = default;
+ ImplHelper1(ImplHelper1 const &) = default;
+ ImplHelper1(ImplHelper1 &&) = default;
+ ImplHelper1 & operator =(ImplHelper1 const &) = default;
+ ImplHelper1 & operator =(ImplHelper1 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper1() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+
+ These classes are used when you implement your UNO component.
+ WeakImplHelper1 till WeakImplHelper12 can be used when you want
+ to implement 1 till 12 interfaces in your component.
+ */
+ template< class Ifc1 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper1
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakImplHelper1< Ifc1 > > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggImplHelper1< Ifc1 > > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1
+ : public BaseClass
+ , public Ifc1
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, ImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper1(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper1(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper1(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper1(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper1() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper1
+ : public BaseClass
+ , public Ifc1
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, AggImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper1(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper1(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper1(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper1(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper1() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase10.hxx b/include/cppuhelper/implbase10.hxx
new file mode 100644
index 000000000..e3938563d
--- /dev/null
+++ b/include/cppuhelper/implbase10.hxx
@@ -0,0 +1,317 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE10_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE10_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data10
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 10 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Ifc9, typename Ifc10, typename Impl >
+ struct SAL_WARN_UNUSED ImplClassData10
+ {
+ class_data* operator ()()
+ {
+ static class_data10 s_cd =
+ {
+ 10 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc5),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc6),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc7),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc8),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc9),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc10),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper10
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, ImplHelper10<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper10() = default;
+ ImplHelper10(ImplHelper10 const &) = default;
+ ImplHelper10(ImplHelper10 &&) = default;
+ ImplHelper10 & operator =(ImplHelper10 const &) = default;
+ ImplHelper10 & operator =(ImplHelper10 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper10() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper10
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, WeakImplHelper10<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper10
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, WeakAggImplHelper10<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper10
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, ImplInheritanceHelper10<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper10(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper10(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper10(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper10(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper10(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper10(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper10() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper10
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, AggImplInheritanceHelper10<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper10(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper10(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper10(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper10(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper10(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper10(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper10() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase11.hxx b/include/cppuhelper/implbase11.hxx
new file mode 100644
index 000000000..02fad9040
--- /dev/null
+++ b/include/cppuhelper/implbase11.hxx
@@ -0,0 +1,318 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE11_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE11_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data11
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 11 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Ifc9, typename Ifc10, typename Ifc11, typename Impl >
+ struct SAL_WARN_UNUSED ImplClassData11
+ {
+ class_data* operator ()()
+ {
+ static class_data11 s_cd =
+ {
+ 11 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc5),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc6),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc7),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc8),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc9),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc10),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc11),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper11
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, ImplHelper11<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper11() = default;
+ ImplHelper11(ImplHelper11 const &) = default;
+ ImplHelper11(ImplHelper11 &&) = default;
+ ImplHelper11 & operator =(ImplHelper11 const &) = default;
+ ImplHelper11 & operator =(ImplHelper11 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper11() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper11
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, WeakImplHelper11<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper11
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, WeakAggImplHelper11<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper11
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, ImplInheritanceHelper11<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper11(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper11(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper11(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper11(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper11(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper11(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper11() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper11
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, AggImplInheritanceHelper11<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper11(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper11(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper11(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper11(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper11(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper11(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper11() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase12.hxx b/include/cppuhelper/implbase12.hxx
new file mode 100644
index 000000000..df90f2b64
--- /dev/null
+++ b/include/cppuhelper/implbase12.hxx
@@ -0,0 +1,319 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE12_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE12_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data12
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 12 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Ifc9, typename Ifc10, typename Ifc11, typename Ifc12, typename Impl >
+ struct SAL_WARN_UNUSED ImplClassData12
+ {
+ class_data* operator ()()
+ {
+ static class_data12 s_cd =
+ {
+ 12 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc5),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc6),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc7),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc8),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc9),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc10),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc11),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc12),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper12
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, ImplHelper12<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper12() = default;
+ ImplHelper12(ImplHelper12 const &) = default;
+ ImplHelper12(ImplHelper12 &&) = default;
+ ImplHelper12 & operator =(ImplHelper12 const &) = default;
+ ImplHelper12 & operator =(ImplHelper12 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper12() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper12
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, WeakImplHelper12<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper12
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, WeakAggImplHelper12<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper12
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, ImplInheritanceHelper12<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper12(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper12(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper12(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper12(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper12(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper12(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper12() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper12
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, AggImplInheritanceHelper12<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper12(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper12(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper12(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper12(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper12(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper12(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper12() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase13.hxx b/include/cppuhelper/implbase13.hxx
new file mode 100644
index 000000000..5ed124597
--- /dev/null
+++ b/include/cppuhelper/implbase13.hxx
@@ -0,0 +1,320 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE13_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE13_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data13
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 13 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Ifc9, typename Ifc10, typename Ifc11, typename Ifc12, typename Ifc13, typename Impl >
+ struct SAL_WARN_UNUSED ImplClassData13
+ {
+ class_data* operator ()()
+ {
+ static class_data13 s_cd =
+ {
+ 13 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc5),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc6),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc7),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc8),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc9),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc10),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc11),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc12),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc13),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper13
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, public Ifc13
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData13< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, ImplHelper13<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper13() = default;
+ ImplHelper13(ImplHelper13 const &) = default;
+ ImplHelper13(ImplHelper13 &&) = default;
+ ImplHelper13 & operator =(ImplHelper13 const &) = default;
+ ImplHelper13 & operator =(ImplHelper13 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper13() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper13
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, public Ifc13
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData13< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, WeakImplHelper13<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper13
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, public Ifc13
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData13< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, WeakAggImplHelper13<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper13
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, public Ifc13
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData13< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, ImplInheritanceHelper13<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper13(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper13(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper13(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper13(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper13(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper13(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper13() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper13
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, public Ifc13
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData13< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, AggImplInheritanceHelper13<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper13(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper13(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper13(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper13(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper13(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper13(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper13() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase2.hxx b/include/cppuhelper/implbase2.hxx
new file mode 100644
index 000000000..d6b326122
--- /dev/null
+++ b/include/cppuhelper/implbase2.hxx
@@ -0,0 +1,308 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE2_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE2_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data2
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 2 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Impl > struct SAL_WARN_UNUSED ImplClassData2
+ {
+ class_data* operator ()()
+ {
+ static class_data2 s_cd =
+ {
+ 2 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your base class defines method implementations, acquire(), release() and delegates incoming
+ queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper2
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplHelper2<Ifc1, Ifc2> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper2() = default;
+ ImplHelper2(ImplHelper2 const &) = default;
+ ImplHelper2(ImplHelper2 &&) = default;
+ ImplHelper2 & operator =(ImplHelper2 const &) = default;
+ ImplHelper2 & operator =(ImplHelper2 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper2() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper2
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakImplHelper2<Ifc1, Ifc2> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper2
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggImplHelper2<Ifc1, Ifc2> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper2
+ : public BaseClass
+ , public Ifc1, public Ifc2
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper2(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper2(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper2(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper2(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper2() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper2
+ : public BaseClass
+ , public Ifc1, public Ifc2
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, AggImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper2(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper2(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper2(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper2(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper2() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase3.hxx b/include/cppuhelper/implbase3.hxx
new file mode 100644
index 000000000..7c95ef596
--- /dev/null
+++ b/include/cppuhelper/implbase3.hxx
@@ -0,0 +1,310 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE3_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE3_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data3
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 3 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Ifc3, typename Impl > struct SAL_WARN_UNUSED ImplClassData3
+ {
+ class_data* operator ()()
+ {
+ static class_data3 s_cd =
+ {
+ 3 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2, class Ifc3 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper3
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper3() = default;
+ ImplHelper3(ImplHelper3 const &) = default;
+ ImplHelper3(ImplHelper3 &&) = default;
+ ImplHelper3 & operator =(ImplHelper3 const &) = default;
+ ImplHelper3 & operator =(ImplHelper3 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper3() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper3
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper3
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakAggImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+ also has to have a default ctor.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper3
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplInheritanceHelper3<BaseClass, Ifc1, Ifc2, Ifc3> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper3(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper3(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper3(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper3(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper3(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper3(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper3() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper3
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, AggImplInheritanceHelper3<BaseClass, Ifc1, Ifc2, Ifc3> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper3(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper3(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper3(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper3(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper3(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper3(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper3() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase4.hxx b/include/cppuhelper/implbase4.hxx
new file mode 100644
index 000000000..61bce6722
--- /dev/null
+++ b/include/cppuhelper/implbase4.hxx
@@ -0,0 +1,311 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE4_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE4_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data4
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 4 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Impl >
+ struct SAL_WARN_UNUSED ImplClassData4
+ {
+ class_data* operator ()()
+ {
+ static class_data4 s_cd =
+ {
+ 4 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper4
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, ImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper4() = default;
+ ImplHelper4(ImplHelper4 const &) = default;
+ ImplHelper4(ImplHelper4 &&) = default;
+ ImplHelper4 & operator =(ImplHelper4 const &) = default;
+ ImplHelper4 & operator =(ImplHelper4 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper4() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper4
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper4
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakAggImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper4
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, ImplInheritanceHelper4<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper4(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper4(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper4(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper4(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper4(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper4(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper4() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper4
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, AggImplInheritanceHelper4<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper4(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper4(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper4(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper4(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper4(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper4(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper4() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase5.hxx b/include/cppuhelper/implbase5.hxx
new file mode 100644
index 000000000..993c71a17
--- /dev/null
+++ b/include/cppuhelper/implbase5.hxx
@@ -0,0 +1,312 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE5_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE5_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data5
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 5 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Impl >
+ struct SAL_WARN_UNUSED ImplClassData5
+ {
+ class_data* operator ()()
+ {
+ static class_data5 s_cd =
+ {
+ 5 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc5),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper5
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, ImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper5() = default;
+ ImplHelper5(ImplHelper5 const &) = default;
+ ImplHelper5(ImplHelper5 &&) = default;
+ ImplHelper5 & operator =(ImplHelper5 const &) = default;
+ ImplHelper5 & operator =(ImplHelper5 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper5() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak thru ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper5
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak thru ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation thru ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper5
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakAggImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper5
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, ImplInheritanceHelper5<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper5(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper5(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper5(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper5(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper5(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper5(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper5() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper5
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, AggImplInheritanceHelper5<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper5(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper5(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper5(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper5(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper5(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper5(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper5() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase6.hxx b/include/cppuhelper/implbase6.hxx
new file mode 100644
index 000000000..8adb7549d
--- /dev/null
+++ b/include/cppuhelper/implbase6.hxx
@@ -0,0 +1,313 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE6_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE6_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data6
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 6 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Impl >
+ struct SAL_WARN_UNUSED ImplClassData6
+ {
+ class_data* operator ()()
+ {
+ static class_data6 s_cd =
+ {
+ 6 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc5),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc6),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper6
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, ImplHelper6<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper6() = default;
+ ImplHelper6(ImplHelper6 const &) = default;
+ ImplHelper6(ImplHelper6 &&) = default;
+ ImplHelper6 & operator =(ImplHelper6 const &) = default;
+ ImplHelper6 & operator =(ImplHelper6 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper6() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper6
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, WeakImplHelper6<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper6
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, WeakAggImplHelper6<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper6
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, ImplInheritanceHelper6<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper6(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper6(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper6(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper6(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper6(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper6(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper6() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper6
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, AggImplInheritanceHelper6<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper6(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper6(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper6(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper6(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper6(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper6(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper6() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase7.hxx b/include/cppuhelper/implbase7.hxx
new file mode 100644
index 000000000..305c94d4b
--- /dev/null
+++ b/include/cppuhelper/implbase7.hxx
@@ -0,0 +1,314 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE7_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE7_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data7
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 7 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Impl >
+ struct SAL_WARN_UNUSED ImplClassData7
+ {
+ class_data* operator ()()
+ {
+ static class_data7 s_cd =
+ {
+ 7 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc5),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc6),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc7),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper7
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, ImplHelper7<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper7() = default;
+ ImplHelper7(ImplHelper7 const &) = default;
+ ImplHelper7(ImplHelper7 &&) = default;
+ ImplHelper7 & operator =(ImplHelper7 const &) = default;
+ ImplHelper7 & operator =(ImplHelper7 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper7() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper7
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, WeakImplHelper7<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper7
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, WeakAggImplHelper7<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper7
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, ImplInheritanceHelper7<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper7(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper7(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper7(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper7(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper7(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper7(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper7() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper7
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, AggImplInheritanceHelper7<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper7(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper7(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper7(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper7(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper7(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper7(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper7() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase8.hxx b/include/cppuhelper/implbase8.hxx
new file mode 100644
index 000000000..a0903f1b5
--- /dev/null
+++ b/include/cppuhelper/implbase8.hxx
@@ -0,0 +1,315 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE8_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE8_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data8
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 8 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Impl >
+ struct SAL_WARN_UNUSED ImplClassData8
+ {
+ class_data* operator ()()
+ {
+ static class_data8 s_cd =
+ {
+ 8 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc5),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc6),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc7),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc8),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper8
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, ImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper8() = default;
+ ImplHelper8(ImplHelper8 const &) = default;
+ ImplHelper8(ImplHelper8 &&) = default;
+ ImplHelper8 & operator =(ImplHelper8 const &) = default;
+ ImplHelper8 & operator =(ImplHelper8 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper8() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper8
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper8
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakAggImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper8
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, ImplInheritanceHelper8<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper8(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper8(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper8(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper8(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper8(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper8(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper8() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper8
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, AggImplInheritanceHelper8<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper8(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper8(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper8(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper8(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper8(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper8(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper8() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase9.hxx b/include/cppuhelper/implbase9.hxx
new file mode 100644
index 000000000..75840ec80
--- /dev/null
+++ b/include/cppuhelper/implbase9.hxx
@@ -0,0 +1,316 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE9_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE9_HXX
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+
+namespace cppu
+{
+ /// @cond INTERNAL
+
+ struct class_data9
+ {
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[ 16 ];
+ type_entry m_typeEntries[ 9 + 1 ];
+ };
+
+ template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Ifc9, typename Impl >
+ struct SAL_WARN_UNUSED ImplClassData9
+ {
+ class_data* operator ()()
+ {
+ static class_data9 s_cd =
+ {
+ 9 +1, false, false,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc5),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc6),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc7),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc8),
+ CPPUHELPER_DETAIL_TYPEENTRY(Ifc9),
+ CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
+ }
+ };
+ return reinterpret_cast< class_data * >(&s_cd);
+ }
+ };
+
+ /// @endcond
+
+ /** Implementation helper implementing interface css::lang::XTypeProvider
+ and method XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s) including acquire()/
+ release() and delegates incoming queryInterface() calls to this base class.
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper9
+ : public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, ImplHelper9<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9> > > {};
+ public:
+#if defined LIBO_INTERNAL_ONLY
+ ImplHelper9() = default;
+ ImplHelper9(ImplHelper9 const &) = default;
+ ImplHelper9(ImplHelper9 &&) = default;
+ ImplHelper9 & operator =(ImplHelper9 const &) = default;
+ ImplHelper9 & operator =(ImplHelper9 &&) = default;
+#endif
+
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return ImplHelper_query( rType, cd::get(), this ); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+ protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~ImplHelper9() SAL_NOEXCEPT {}
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper9
+ : public OWeakObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, WeakImplHelper9<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface which supports weak mechanism to be held weakly
+ (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
+ In addition, it supports also aggregation meaning object of this class can be aggregated
+ (css::uno::XAggregation through ::cppu::OWeakAggObject).
+ If a delegator is set (this object is aggregated), then incoming queryInterface()
+ calls are delegated to the delegator object. If the delegator does not support the
+ demanded interface, it calls queryAggregation() on its aggregated objects.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as template argument(s).
+ Your sub class defines method implementations for these interface(s).
+ */
+ template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper9
+ : public OWeakAggObject
+ , public css::lang::XTypeProvider
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, WeakAggImplHelper9<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9> > > {};
+ public:
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { OWeakAggObject::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return WeakAggImplHelper_getTypes( cd::get() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
+ if a demanded interface is not supported by this class directly, the request is
+ delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface
+ and css::lang::XTypeProvider are implemented properly. The
+ BaseClass must have at least one ctor that can be called with six or
+ fewer arguments, of which none is of non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper9
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, ImplInheritanceHelper9<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9> > > {};
+ protected:
+ template< typename T1 >
+ explicit ImplInheritanceHelper9(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ ImplInheritanceHelper9(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ ImplInheritanceHelper9(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ ImplInheritanceHelper9(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ ImplInheritanceHelper9(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ ImplInheritanceHelper9(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ ImplInheritanceHelper9() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+ /** Implementation helper implementing interfaces css::lang::XTypeProvider and
+ css::uno::XInterface inheriting from a BaseClass.
+ All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
+ Upon queryAggregation(), if a demanded interface is not supported by this class directly,
+ the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that css::uno::XInterface,
+ css::uno::XAggregation and css::lang::XTypeProvider
+ are implemented properly. The BaseClass must have at least one ctor
+ that can be called with six or fewer arguments, of which none is of
+ non-const reference type.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for these interface(s).
+ */
+ template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 >
+ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper9
+ : public BaseClass
+ , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9
+ {
+ struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, AggImplInheritanceHelper9<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9> > > {};
+ protected:
+ template< typename T1 >
+ explicit AggImplInheritanceHelper9(T1 const & arg1): BaseClass(arg1) {}
+ template< typename T1, typename T2 >
+ AggImplInheritanceHelper9(T1 const & arg1, T2 const & arg2):
+ BaseClass(arg1, arg2) {}
+ template< typename T1, typename T2, typename T3 >
+ AggImplInheritanceHelper9(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3):
+ BaseClass(arg1, arg2, arg3) {}
+ template< typename T1, typename T2, typename T3, typename T4 >
+ AggImplInheritanceHelper9(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
+ BaseClass(arg1, arg2, arg3, arg4) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5 >
+ AggImplInheritanceHelper9(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5):
+ BaseClass(arg1, arg2, arg3, arg4, arg5) {}
+ template<
+ typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6 >
+ AggImplInheritanceHelper9(
+ T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
+ T5 const & arg5, T6 const & arg6):
+ BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
+ public:
+ AggImplInheritanceHelper9() {}
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
+ { return BaseClass::queryInterface( rType ); }
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
+ {
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryAggregation( rType );
+ }
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
+ { BaseClass::release(); }
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
+ { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
+ { return ImplHelper_getImplementationId( cd::get() ); }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase_ex.hxx b/include/cppuhelper/implbase_ex.hxx
new file mode 100644
index 000000000..e9e31bbdb
--- /dev/null
+++ b/include/cppuhelper/implbase_ex.hxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE_EX_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE_EX_HXX
+
+#include "com/sun/star/uno/Any.h"
+#include "com/sun/star/uno/Sequence.h"
+#include "com/sun/star/uno/Type.h"
+#include "com/sun/star/uno/genfunc.h"
+#include "cppuhelper/cppuhelperdllapi.h"
+#include "sal/types.h"
+
+namespace cppu { class OWeakAggObject; }
+namespace cppu { class OWeakObject; }
+
+
+/* If you need to define implementation helper classes that deal with more than
+ 12 interfaces, then use macros as follows, e.g. for 3 interfaces:
+
+#include <cppuhelper/implbase_ex_pre.hxx>
+#define __IFC_EX_TYPE_INIT3( class_cast ) \
+ __IFC_EX_TYPE_INIT( class_cast, 1 ), __IFC_EX_TYPE_INIT( class_cast, 2 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 3 )
+#include <cppuhelper/implbase_ex_post.hxx>
+__DEF_IMPLHELPER_EX( 3 )
+*/
+
+/// @cond INTERNAL
+
+namespace cppu
+{
+
+/** function pointer signature for getCppuType
+*/
+typedef css::uno::Type const & (SAL_CALL * fptr_getCppuType)( void * );
+
+/** single type + object offset
+*/
+struct SAL_WARN_UNUSED type_entry
+{
+ /** the type_entry is initialized with function pointer to ::getCppuType() function first,
+ but holds an unacquired typelib_TypeDescriptionReference * after initialization,
+ thus reusing the memory. Flag class_data::m_storedTypeRefs
+ */
+ union
+ {
+ fptr_getCppuType getCppuType;
+ typelib_TypeDescriptionReference * typeRef;
+ } m_type;
+ /** offset for interface pointer
+ */
+ sal_IntPtr m_offset;
+};
+
+/** in the future, this can be a constexpr template method */
+#define CPPUHELPER_DETAIL_TYPEENTRY(Ifc) \
+ { { Ifc::static_type }, \
+ reinterpret_cast<sal_IntPtr>( static_cast<Ifc *>( reinterpret_cast<Impl *>(16) )) - 16 }
+
+/** identical dummy struct for casting class_dataN to class_data
+*/
+struct SAL_WARN_UNUSED class_data
+{
+ /** number of supported types in m_typeEntries
+ */
+ sal_Int16 m_nTypes;
+
+ /** determines whether m_typeEntries is initialized and carries unacquired type refs
+ */
+ sal_Bool m_storedTypeRefs;
+
+ /** determines whether an implementation id was created in m_id
+ */
+ sal_Bool m_createdId;
+
+ /** implementation id
+ */
+ sal_Int8 m_id[ 16 ];
+
+ /** type, object offset
+ */
+ type_entry m_typeEntries[ 1 ];
+};
+
+/** ImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL ImplHelper_query(
+ css::uno::Type const & rType,
+ class_data * cd,
+ void * that );
+/** ImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL ImplHelper_queryNoXInterface(
+ css::uno::Type const & rType,
+ class_data * cd,
+ void * that );
+/** ImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type >
+SAL_CALL ImplHelper_getTypes(
+ class_data * cd );
+/** ImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type >
+SAL_CALL ImplInhHelper_getTypes(
+ class_data * cd,
+ css::uno::Sequence< css::uno::Type > const & rAddTypes );
+/** ImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Sequence< sal_Int8 >
+SAL_CALL ImplHelper_getImplementationId(
+ class_data * cd );
+
+/** WeakImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakImplHelper_query(
+ css::uno::Type const & rType,
+ class_data * cd,
+ void * that,
+ ::cppu::OWeakObject * pBase );
+/** WeakImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type >
+SAL_CALL WeakImplHelper_getTypes(
+ class_data * cd );
+
+/** WeakAggImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Any
+SAL_CALL WeakAggImplHelper_queryAgg(
+ css::uno::Type const & rType,
+ class_data * cd,
+ void * that,
+ ::cppu::OWeakAggObject * pBase );
+/** WeakAggImplHelper
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type >
+SAL_CALL WeakAggImplHelper_getTypes(
+ class_data * cd );
+
+}
+
+/// @endcond
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase_ex_post.hxx b/include/cppuhelper/implbase_ex_post.hxx
new file mode 100644
index 000000000..d1a51c9eb
--- /dev/null
+++ b/include/cppuhelper/implbase_ex_post.hxx
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE_EX_POST_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE_EX_POST_HXX
+
+/// @cond INTERNAL
+
+#define __DEF_CLASS_DATA_INIT_EX( N, class_cast ) \
+{ \
+N +1, sal_False, sal_False, \
+{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, \
+{ \
+__IFC_EX_TYPE_INIT##N( class_cast ), \
+__IFC_EX_TYPE_INIT_NAME( class_cast, css::lang::XTypeProvider ) \
+} \
+}
+
+#define __DEF_IMPLHELPER_EX( N ) \
+namespace cppu \
+{ \
+struct class_data##N \
+{ \
+ sal_Int16 m_nTypes; \
+ sal_Bool m_storedTypeRefs; \
+ sal_Bool m_storedId; \
+ sal_Int8 m_id[ 16 ]; \
+ type_entry m_typeEntries[ N + 1 ]; \
+}; \
+template< __CLASS_IFC##N > \
+class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper##N \
+ : public css::lang::XTypeProvider \
+ , __PUBLIC_IFC##N \
+{ \
+ static class_data##N s_cd; \
+public: \
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE \
+ { return ImplHelper_query( rType, (class_data *)&s_cd, this ); } \
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE \
+ { return ImplHelper_getTypes( (class_data *)&s_cd ); } \
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE \
+ { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
+}; \
+template< __CLASS_IFC##N > \
+class_data##N ImplHelper##N< __IFC##N >::s_cd = \
+__DEF_CLASS_DATA_INIT_EX( N, (ImplHelper##N< __IFC##N > *) ); \
+template< __CLASS_IFC##N > \
+class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper##N \
+ : public OWeakObject \
+ , public css::lang::XTypeProvider \
+ , __PUBLIC_IFC##N \
+{ \
+ static class_data##N s_cd; \
+public: \
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE \
+ { return WeakImplHelper_query( rType, (class_data *)&s_cd, this, static_cast<OWeakObject *>(this) ); } \
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE \
+ { OWeakObject::acquire(); } \
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE \
+ { OWeakObject::release(); } \
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE \
+ { return WeakImplHelper_getTypes( (class_data *)&s_cd ); } \
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE \
+ { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
+}; \
+template< __CLASS_IFC##N > \
+class_data##N WeakImplHelper##N< __IFC##N >::s_cd = \
+__DEF_CLASS_DATA_INIT_EX( N, (WeakImplHelper##N< __IFC##N > *) ); \
+template< __CLASS_IFC##N > \
+class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper##N \
+ : public OWeakAggObject \
+ , public css::lang::XTypeProvider \
+ , __PUBLIC_IFC##N \
+{ \
+ static class_data##N s_cd; \
+public: \
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE \
+ { return OWeakAggObject::queryInterface( rType ); } \
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE \
+ { return WeakAggImplHelper_queryAgg( rType, (class_data *)&s_cd, this, static_cast<OWeakAggObject *>(this) ); } \
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE \
+ { OWeakAggObject::acquire(); } \
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE \
+ { OWeakAggObject::release(); } \
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE \
+ { return WeakAggImplHelper_getTypes( (class_data *)&s_cd ); } \
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE \
+ { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
+}; \
+template< __CLASS_IFC##N > \
+class_data##N WeakAggImplHelper##N< __IFC##N >::s_cd = \
+__DEF_CLASS_DATA_INIT_EX( N, (WeakAggImplHelper##N< __IFC##N > *) ); \
+template< class BaseClass, __CLASS_IFC##N > \
+class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper##N \
+ : public BaseClass \
+ , __PUBLIC_IFC##N \
+{ \
+ static class_data##N s_cd; \
+public: \
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) \
+ { \
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, (class_data *)&s_cd, this ) ); \
+ if (aRet.hasValue()) \
+ return aRet; \
+ return BaseClass::queryInterface( rType ); \
+ } \
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT \
+ { BaseClass::acquire(); } \
+ virtual void SAL_CALL release() SAL_NOEXCEPT \
+ { BaseClass::release(); } \
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() \
+ { return ImplInhHelper_getTypes( (class_data *)&s_cd, BaseClass::getTypes() ); } \
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() \
+ { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
+}; \
+template< class BaseClass, __CLASS_IFC##N > \
+class_data##N ImplInheritanceHelper##N< BaseClass, __IFC##N >::s_cd = \
+__DEF_CLASS_DATA_INIT_EX( N, (ImplInheritanceHelper##N< BaseClass, __IFC##N > *) ); \
+template< class BaseClass, __CLASS_IFC##N > \
+class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper##N \
+ : public BaseClass \
+ , __PUBLIC_IFC##N \
+{ \
+ static class_data##N s_cd; \
+public: \
+ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) \
+ { return BaseClass::queryInterface( rType ); } \
+ virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) \
+ { \
+ css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, (class_data *)&s_cd, this ) ); \
+ if (aRet.hasValue()) \
+ return aRet; \
+ return BaseClass::queryAggregation( rType ); \
+ } \
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT \
+ { BaseClass::acquire(); } \
+ virtual void SAL_CALL release() SAL_NOEXCEPT \
+ { BaseClass::release(); } \
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() \
+ { return ImplInhHelper_getTypes( (class_data *)&s_cd, BaseClass::getTypes() ); } \
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() \
+ { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
+}; \
+template< class BaseClass, __CLASS_IFC##N > \
+class_data##N AggImplInheritanceHelper##N< BaseClass, __IFC##N >::s_cd = \
+__DEF_CLASS_DATA_INIT_EX( N, (AggImplInheritanceHelper##N< BaseClass, __IFC##N > *) ); \
+}
+
+/// @endcond
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implbase_ex_pre.hxx b/include/cppuhelper/implbase_ex_pre.hxx
new file mode 100644
index 000000000..f64e7f056
--- /dev/null
+++ b/include/cppuhelper/implbase_ex_pre.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLBASE_EX_PRE_HXX
+#define INCLUDED_CPPUHELPER_IMPLBASE_EX_PRE_HXX
+
+/// @cond INTERNAL
+
+#define __IFC_EX_TYPE_INIT_NAME( class_cast, ifc_name ) \
+{ { ifc_name::static_type }, ((sal_IntPtr)(ifc_name *) class_cast 16) - 16 }
+
+#define __IFC_EX_TYPE_INIT( class_cast, N ) __IFC_EX_TYPE_INIT_NAME( class_cast, Ifc##N )
+
+/// @endcond
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/implementationentry.hxx b/include/cppuhelper/implementationentry.hxx
new file mode 100644
index 000000000..b99460014
--- /dev/null
+++ b/include/cppuhelper/implementationentry.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_IMPLEMENTATIONENTRY_HXX
+#define INCLUDED_CPPUHELPER_IMPLEMENTATIONENTRY_HXX
+
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/cppuhelperdllapi.h"
+
+namespace cppu
+{
+/** One struct instance represents all data necessary for registering one service implementation.
+
+ */
+struct SAL_WARN_UNUSED ImplementationEntry
+{
+ /** Function that creates an instance of the implementation
+ */
+ ComponentFactoryFunc create;
+
+ /** Function that returns the implementation-name of the implementation
+ (same as XServiceInfo.getImplementationName() ).
+ */
+ rtl::OUString (SAL_CALL * getImplementationName)();
+
+ /** Function that returns all supported servicenames of the implementation
+ ( same as XServiceInfo.getSupportedServiceNames() ).
+ */
+ css::uno::Sequence< rtl::OUString > (SAL_CALL * getSupportedServiceNames) ();
+
+ /** Function that creates a SingleComponentFactory.
+
+ The pModCount parameter is a backwards-compatibility remainder of a
+ removed library unloading feature; always set to null.
+ */
+ css::uno::Reference< css::lang::XSingleComponentFactory >
+ (SAL_CALL * createFactory)(
+ ComponentFactoryFunc fptr,
+ ::rtl::OUString const & rImplementationName,
+ css::uno::Sequence< ::rtl::OUString > const & rServiceNames,
+ rtl_ModuleCount * pModCount );
+
+ /** Backwards-compatibility remainder of a removed library unloading
+ feature; always set to null.
+ */
+ rtl_ModuleCount * moduleCounter;
+
+ /** Must be set to 0 !
+ For future extensions.
+ */
+ sal_Int32 nFlags;
+};
+
+/** Helper function for implementation of the component_writeInfo()-function.
+
+ @deprecated component_writeInfo should no longer be used in new components
+
+ @param pServiceManager The first parameter passed to component_writeInfo()-function
+ (This is an instance of the service manager, that creates the factory).
+ @param pRegistryKey The second parameter passed to the component_writeInfo()-function.
+ This is a reference to the registry key, into which the implementation
+ data shall be written to.
+ @param entries Each element of the entries-array must contains a function pointer
+ table for registering an implementation. The end of the array
+ must be marked with a 0 entry in the create-function.
+ @return sal_True, if all implementations could be registered, otherwise sal_False.
+ */
+CPPUHELPER_DLLPUBLIC sal_Bool component_writeInfoHelper(
+ void *pServiceManager, void *pRegistryKey , const struct ImplementationEntry entries[] );
+
+/** Helper function for implementation of the component_getFactory()-function,
+ that must be implemented by every shared library component.
+
+ @param pImplName The implementation-name to be instantiated ( This is the
+ first parameter passed to the component_getFactory
+ @param pServiceManager The second parameter passed to component_getFactory()-function
+ (This is a of the service manager, that creates the factory).
+ @param pRegistryKey The third parameter passed to the component_getFactory()-function.
+ This is a reference to the registry key, where the implementation
+ data has been written to.
+ @param entries Each element of the entries-array must contains a function pointer
+ table for creating a factor of the implementation. The end of the array
+ must be marked with a 0 entry in the create-function.
+ @return 0 if the helper failed to instantiate a factory, otherwise an acquired pointer
+ to a factory.
+ */
+CPPUHELPER_DLLPUBLIC void *component_getFactoryHelper(
+ const char * pImplName,
+ void * pServiceManager,
+ void * pRegistryKey,
+ const struct ImplementationEntry entries[] );
+
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/interfacecontainer.h b/include/cppuhelper/interfacecontainer.h
new file mode 100644
index 000000000..d901b2db3
--- /dev/null
+++ b/include/cppuhelper/interfacecontainer.h
@@ -0,0 +1,614 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_INTERFACECONTAINER_H
+#define INCLUDED_CPPUHELPER_INTERFACECONTAINER_H
+
+#include "sal/config.h"
+
+#include <cstddef>
+#include <functional>
+#include <vector>
+#include <utility>
+
+#include "osl/diagnose.h"
+#include "osl/mutex.hxx"
+#include "rtl/alloc.h"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/lang/EventObject.hpp"
+
+#include "com/sun/star/lang/DisposedException.hpp"
+#include "cppuhelper/cppuhelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace uno { class XInterface; } } } }
+
+namespace cppu
+{
+
+namespace detail {
+
+ /**
+ This is here to optimise space in the common case that there are zero or one
+ listeners.
+ */
+ union element_alias
+ {
+ std::vector< css::uno::Reference< css::uno::XInterface > > *pAsVector;
+ css::uno::XInterface * pAsInterface;
+ element_alias() : pAsInterface(NULL) {}
+ };
+
+}
+
+
+class OInterfaceContainerHelper;
+/**
+ This is the iterator of an InterfaceContainerHelper. Typically
+ one constructs an instance on the stack for one firing session.
+ It is not allowed to assign or copy an instance of this class.
+
+ @see OInterfaceContainerHelper
+ */
+class CPPUHELPER_DLLPUBLIC OInterfaceIteratorHelper
+{
+public:
+ /**
+ Create an iterator over the elements of the container. The iterator
+ copies the elements of the container. A change to the container
+ during the lifetime of an iterator is allowed and does not
+ affect the iterator-instance. The iterator and the container take cares
+ themself for concurrent access, no additional guarding is necessary.
+
+ Remark: The copy is on demand. The iterator copy the elements only if the container
+ change the contents. It is not allowed to destroy the container as long
+ as an iterator exist.
+
+ @param rCont the container of the elements.
+ */
+ OInterfaceIteratorHelper( OInterfaceContainerHelper & rCont );
+
+ /**
+ Releases the connection to the container.
+ */
+ ~OInterfaceIteratorHelper();
+
+ /** Return true, if there are more elements in the iterator. */
+ bool SAL_CALL hasMoreElements() const
+ { return nRemain != 0; }
+ /** Return the next element of the iterator. Calling this method if
+ hasMoreElements() has returned false, is an error. Cast the
+ returned pointer to the
+ */
+ css::uno::XInterface * SAL_CALL next();
+
+ /** Removes the current element (the last one returned by next())
+ from the underlying container. Calling this method before
+ next() has been called or calling it twice with no next()
+ inbetween is an error.
+ */
+ void SAL_CALL remove();
+
+private:
+ OInterfaceContainerHelper & rCont;
+ sal_Bool bIsList;
+
+ detail::element_alias aData;
+
+ sal_Int32 nRemain;
+
+ OInterfaceIteratorHelper( const OInterfaceIteratorHelper & )
+ SAL_DELETED_FUNCTION;
+ OInterfaceIteratorHelper & operator = ( const OInterfaceIteratorHelper & )
+ SAL_DELETED_FUNCTION;
+};
+
+
+/**
+ A container of interfaces. To access the elements use an iterator.
+ This implementation is thread save.
+
+ @see OInterfaceIteratorHelper
+ */
+class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC OInterfaceContainerHelper
+{
+public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete( void *, void * )
+ {}
+
+ /**
+ Create an interface container.
+
+ @param rMutex the mutex to protect multi thread access.
+ The lifetime must be longer than the lifetime
+ of this object.
+ */
+ OInterfaceContainerHelper( ::osl::Mutex & rMutex );
+ /**
+ Release all interfaces. All iterators must be destroyed before
+ the container is destructed.
+ */
+ ~OInterfaceContainerHelper();
+ /**
+ Return the number of Elements in the container. Only useful if you have acquired
+ the mutex.
+ */
+ sal_Int32 SAL_CALL getLength() const;
+
+ /**
+ Return all interfaces added to this container.
+ **/
+ css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > SAL_CALL getElements() const;
+
+ /** Inserts an element into the container. The position is not specified, thus it is not
+ specified in which order events are fired.
+
+ @attention
+ If you add the same interface more than once, then it will be added to the elements list
+ more than once and thus if you want to remove that interface from the list, you have to call
+ removeInterface() the same number of times.
+ In the latter case, you will also get events fired more than once (if the interface is a
+ listener interface).
+
+ @param rxIFace
+ interface to be added; it is allowed to insert null or
+ the same interface more than once
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 SAL_CALL addInterface( const css::uno::Reference< css::uno::XInterface > & rxIFace );
+ /** Removes an element from the container. It uses interface equality to remove the interface.
+
+ @param rxIFace
+ interface to be removed
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 SAL_CALL removeInterface( const css::uno::Reference< css::uno::XInterface > & rxIFace );
+ /**
+ Call disposing on all object in the container that
+ support XEventListener. Then clear the container.
+ */
+ void SAL_CALL disposeAndClear( const css::lang::EventObject & rEvt );
+ /**
+ Clears the container without calling disposing().
+ */
+ void SAL_CALL clear();
+
+ /** Executes a functor for each contained listener of specified type, e.g.
+ <code>forEach<awt::XPaintListener>(...</code>.
+
+ If a css::lang::DisposedException occurs which relates to
+ the called listener, then that listener is removed from the container.
+
+ @tparam ListenerT listener type
+ @tparam FuncT unary functor type, let your compiler deduce this for you
+ @param func unary functor object expecting an argument of type
+ css::uno::Reference<ListenerT>
+ */
+ template <typename ListenerT, typename FuncT>
+ inline void forEach( FuncT const& func );
+
+ /** Calls a UNO listener method for each contained listener.
+
+ The listener method must take a single argument of type EventT,
+ and return <code>void</code>.
+
+ If a css::lang::DisposedException occurs which relates to
+ the called listener, then that listener is removed from the container.
+
+ @tparam ListenerT UNO event listener type, let your compiler deduce this for you
+ @tparam EventT event type, let your compiler deduce this for you
+ @param NotificationMethod
+ Pointer to a method of a ListenerT interface.
+ @param Event
+ Event to notify to all contained listeners
+
+ Example:
+@code
+ awt::PaintEvent aEvent( static_cast< cppu::OWeakObject* >( this ), ... );
+ listeners.notifyEach( &XPaintListener::windowPaint, aEvent );
+@endcode
+ */
+ template< typename ListenerT, typename EventT >
+ inline void notifyEach( void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& ), const EventT& Event );
+
+private:
+friend class OInterfaceIteratorHelper;
+ /**
+ bIsList == TRUE -> aData.pAsSequence of type Sequence< XInterfaceSequence >,
+ otherwise aData.pAsInterface == of type (XEventListener *)
+ */
+ detail::element_alias aData;
+ ::osl::Mutex & rMutex;
+ /** TRUE -> used by an iterator. */
+ sal_Bool bInUse;
+ /** TRUE -> aData.pAsSequence is of type Sequence< XInterfaceSequence >. */
+ sal_Bool bIsList;
+
+ OInterfaceContainerHelper( const OInterfaceContainerHelper & )
+ SAL_DELETED_FUNCTION;
+ OInterfaceContainerHelper & operator = ( const OInterfaceContainerHelper & )
+ SAL_DELETED_FUNCTION;
+
+ /*
+ Duplicate content of the container and release the old one without destroying.
+ The mutex must be locked and the memberbInUse must be true.
+ */
+ void copyAndResetInUse();
+
+private:
+ template< typename ListenerT, typename EventT >
+ class NotifySingleListener
+ {
+ private:
+ typedef void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& );
+ NotificationMethod m_pMethod;
+ const EventT& m_rEvent;
+ public:
+ NotifySingleListener( NotificationMethod method, const EventT& event ) : m_pMethod( method ), m_rEvent( event ) { }
+
+ void operator()( const css::uno::Reference<ListenerT>& listener ) const
+ {
+ (listener.get()->*m_pMethod)( m_rEvent );
+ }
+ };
+};
+
+template <typename ListenerT, typename FuncT>
+inline void OInterfaceContainerHelper::forEach( FuncT const& func )
+{
+ OInterfaceIteratorHelper iter( *this );
+ while (iter.hasMoreElements()) {
+ css::uno::Reference<ListenerT> const xListener( iter.next(), css::uno::UNO_QUERY );
+ if (xListener.is()) {
+ try {
+ func( xListener );
+ }
+ catch (css::lang::DisposedException const& exc) {
+ if (exc.Context == xListener)
+ iter.remove();
+ }
+ }
+ }
+}
+
+template< typename ListenerT, typename EventT >
+inline void OInterfaceContainerHelper::notifyEach( void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& ), const EventT& Event )
+{
+ forEach< ListenerT, NotifySingleListener< ListenerT, EventT > >( NotifySingleListener< ListenerT, EventT >( NotificationMethod, Event ) );
+}
+
+
+/**
+ A helper class to store interface references of different types.
+
+ @see OInterfaceIteratorHelper
+ @see OInterfaceContainerHelper
+ */
+template< class key, class hashImpl = void, class equalImpl = std::equal_to<key> >
+class OMultiTypeInterfaceContainerHelperVar
+{
+public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete( void *, void * )
+ {}
+
+ /**
+ Create a container of interface containers.
+
+ @param rMutex the mutex to protect multi thread access.
+ The lifetime must be longer than the lifetime
+ of this object.
+ */
+ inline OMultiTypeInterfaceContainerHelperVar( ::osl::Mutex & rMutex );
+ /**
+ Deletes all containers.
+ */
+ inline ~OMultiTypeInterfaceContainerHelperVar();
+
+ /**
+ Return all id's under which at least one interface is added.
+ */
+ inline css::uno::Sequence< key > SAL_CALL getContainedTypes() const;
+
+ /**
+ Return the container created under this key.
+ The InterfaceContainerHelper exists until the whole MultiTypeContainer is destroyed.
+ @return the container created under this key. If the container
+ was not created, null was returned.
+ */
+ inline OInterfaceContainerHelper * SAL_CALL getContainer( const key & ) const;
+
+ /** Inserts an element into the container with the specified key.
+ The position is not specified, thus it is not specified in which order events are fired.
+
+ @attention
+ If you add the same interface more than once, then it will be added to the elements list
+ more than once and thus if you want to remove that interface from the list, you have to call
+ removeInterface() the same number of times.
+ In the latter case, you will also get events fired more than once (if the interface is a
+ listener interface).
+
+ @param rKey
+ the id of the container
+ @param r
+ interface to be added; it is allowed, to insert null or
+ the same interface more than once
+ @return
+ the new count of elements in the container
+ */
+ inline sal_Int32 SAL_CALL addInterface(
+ const key & rKey,
+ const css::uno::Reference< css::uno::XInterface > & r );
+
+ /** Removes an element from the container with the specified key.
+ It uses interface equality to remove the interface.
+
+ @param rKey
+ the id of the container
+ @param rxIFace
+ interface to be removed
+ @return
+ the new count of elements in the container
+ */
+ inline sal_Int32 SAL_CALL removeInterface(
+ const key & rKey,
+ const css::uno::Reference< css::uno::XInterface > & rxIFace );
+
+ /**
+ Call disposing on all references in the container, that
+ support XEventListener. Then clears the container.
+ @param rEvt the event object which is passed during disposing() call
+ */
+ inline void SAL_CALL disposeAndClear( const css::lang::EventObject & rEvt );
+ /**
+ Remove all elements of all containers. Does not delete the container.
+ */
+ inline void SAL_CALL clear();
+
+ typedef key keyType;
+private:
+ typedef ::std::vector< std::pair < key , void* > > InterfaceMap;
+ InterfaceMap *m_pMap;
+ ::osl::Mutex & rMutex;
+
+ typename InterfaceMap::iterator find(const key &rKey) const
+ {
+ typename InterfaceMap::iterator iter = m_pMap->begin();
+ typename InterfaceMap::iterator end = m_pMap->end();
+
+ while( iter != end )
+ {
+ equalImpl equal;
+ if( equal( iter->first, rKey ) )
+ break;
+ ++iter;
+ }
+ return iter;
+ }
+
+ OMultiTypeInterfaceContainerHelperVar( const OMultiTypeInterfaceContainerHelperVar & ) SAL_DELETED_FUNCTION;
+ OMultiTypeInterfaceContainerHelperVar & operator = ( const OMultiTypeInterfaceContainerHelperVar & ) SAL_DELETED_FUNCTION;
+};
+
+
+
+
+/**
+ This struct contains the standard variables of a broadcaster. Helper
+ classes only know a reference to this struct instead of references
+ to the four members. The access to the members must be guarded with
+ rMutex.
+
+ The additional template parameter keyType has been added, because gcc
+ can't compile addListener( const container::keyType &key ).
+ */
+template < class container , class keyType >
+struct SAL_WARN_UNUSED OBroadcastHelperVar
+{
+ /** The shared mutex. */
+ ::osl::Mutex & rMutex;
+ /** ListenerContainer class is thread safe. */
+ container aLC;
+ /** Dispose call ready. */
+ sal_Bool bDisposed;
+ /** In dispose call. */
+ sal_Bool bInDispose;
+
+ /**
+ Initialize the structure. bDispose and bInDispose are set to false.
+ @param rMutex_ the mutex reference.
+ */
+ OBroadcastHelperVar( ::osl::Mutex & rMutex_ )
+ : rMutex( rMutex_ )
+ , aLC( rMutex_ )
+ , bDisposed( false )
+ , bInDispose( false )
+ {}
+
+ /**
+ adds a listener threadsafe.
+ **/
+ void addListener(
+ const keyType &key,
+ const css::uno::Reference < css::uno::XInterface > &r )
+ {
+ ::osl::MutexGuard guard( rMutex );
+ OSL_ENSURE( !bInDispose, "do not add listeners in the dispose call" );
+ OSL_ENSURE( !bDisposed, "object is disposed" );
+ if( ! bInDispose && ! bDisposed )
+ aLC.addInterface( key , r );
+ }
+
+ /**
+ removes a listener threadsafe
+ **/
+ void removeListener(
+ const keyType &key,
+ const css::uno::Reference < css::uno::XInterface > & r )
+ {
+ ::osl::MutexGuard guard( rMutex );
+ if( ! bInDispose && ! bDisposed )
+ aLC.removeInterface( key , r );
+ }
+
+ /**
+ Return the container created under this key.
+ @return the container created under this key. If the container
+ was not created, null was returned. This can be used to optimize
+ performance ( construction of an event object can be avoided ).
+ ***/
+ OInterfaceContainerHelper * SAL_CALL getContainer( const keyType &key ) const
+ { return aLC.getContainer( key ); }
+};
+
+/*------------------------------------------
+*
+* In general, the above templates are used with a Type as key.
+* Therefore a default declaration is given ( OMultiTypeInterfaceContainerHelper and OBroadcastHelper )
+*
+*------------------------------------------*/
+
+// helper function call class
+struct hashType_Impl
+{
+ size_t operator()(const css::uno::Type & s) const
+ { return static_cast<size_t>(s.getTypeName().hashCode()); }
+};
+
+
+/** Specialized class for key type css::uno::Type,
+ without explicit usage of STL symbols.
+*/
+class CPPUHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelper
+{
+public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete( void *, void * )
+ {}
+
+ /**
+ Create a container of interface containers.
+
+ @param rMutex the mutex to protect multi thread access.
+ The lifetime must be longer than the lifetime
+ of this object.
+ */
+ OMultiTypeInterfaceContainerHelper( ::osl::Mutex & rMutex );
+ /**
+ Delete all containers.
+ */
+ ~OMultiTypeInterfaceContainerHelper();
+
+ /**
+ Return all id's under which at least one interface is added.
+ */
+ css::uno::Sequence< css::uno::Type > SAL_CALL getContainedTypes() const;
+
+ /**
+ Return the container created under this key.
+ @return the container created under this key. If the container
+ was not created, null was returned.
+ */
+ OInterfaceContainerHelper * SAL_CALL getContainer( const css::uno::Type & rKey ) const;
+
+ /** Inserts an element into the container with the specified key.
+ The position is not specified, thus it is not specified in which order events are fired.
+
+ @attention
+ If you add the same interface more than once, then it will be added to the elements list
+ more than once and thus if you want to remove that interface from the list, you have to call
+ removeInterface() the same number of times.
+ In the latter case, you will also get events fired more than once (if the interface is a
+ listener interface).
+
+ @param rKey
+ the id of the container
+ @param r
+ interface to be added; it is allowed, to insert null or
+ the same interface more than once
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 SAL_CALL addInterface(
+ const css::uno::Type & rKey,
+ const css::uno::Reference< css::uno::XInterface > & r );
+
+ /** Removes an element from the container with the specified key.
+ It uses interface equality to remove the interface.
+
+ @param rKey
+ the id of the container
+ @param rxIFace
+ interface to be removed
+ @return
+ the new count of elements in the container
+ */
+ sal_Int32 SAL_CALL removeInterface(
+ const css::uno::Type & rKey,
+ const css::uno::Reference< css::uno::XInterface > & rxIFace );
+
+ /**
+ Call disposing on all object in the container that
+ support XEventListener. Then clear the container.
+ */
+ void SAL_CALL disposeAndClear( const css::lang::EventObject & rEvt );
+ /**
+ Remove all elements of all containers. Does not delete the container.
+ */
+ void SAL_CALL clear();
+
+ typedef css::uno::Type keyType;
+private:
+ void * m_pMap;
+ ::osl::Mutex & rMutex;
+
+ OMultiTypeInterfaceContainerHelper( const OMultiTypeInterfaceContainerHelper & ) SAL_DELETED_FUNCTION;
+ OMultiTypeInterfaceContainerHelper & operator = ( const OMultiTypeInterfaceContainerHelper & ) SAL_DELETED_FUNCTION;
+};
+
+typedef OBroadcastHelperVar< OMultiTypeInterfaceContainerHelper , OMultiTypeInterfaceContainerHelper::keyType > OBroadcastHelper;
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/interfacecontainer.hxx b/include/cppuhelper/interfacecontainer.hxx
new file mode 100644
index 000000000..a3bb65e4d
--- /dev/null
+++ b/include/cppuhelper/interfacecontainer.hxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_INTERFACECONTAINER_HXX
+#define INCLUDED_CPPUHELPER_INTERFACECONTAINER_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "cppuhelper/interfacecontainer.h"
+
+
+namespace cppu
+{
+
+template< class key , class hashImpl , class equalImpl >
+inline OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::OMultiTypeInterfaceContainerHelperVar( ::osl::Mutex & rMutex_ )
+ : rMutex( rMutex_ )
+{
+ m_pMap = new InterfaceMap;
+}
+
+
+template< class key , class hashImpl , class equalImpl >
+inline OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::~OMultiTypeInterfaceContainerHelperVar()
+{
+ typename InterfaceMap::iterator iter = m_pMap->begin();
+ typename InterfaceMap::iterator end = m_pMap->end();
+
+ while( iter != end )
+ {
+ delete static_cast<OInterfaceContainerHelper*>((*iter).second);
+ (*iter).second = NULL;
+ ++iter;
+ }
+ delete m_pMap;
+}
+
+
+template< class key , class hashImpl , class equalImpl >
+inline css::uno::Sequence< key > OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::getContainedTypes() const
+{
+ ::osl::MutexGuard aGuard( rMutex );
+ typename InterfaceMap::size_type nSize = m_pMap->size();
+ if( nSize != 0 )
+ {
+ css::uno::Sequence< key > aInterfaceTypes( nSize );
+ key * pArray = aInterfaceTypes.getArray();
+
+ typename InterfaceMap::iterator iter = m_pMap->begin();
+ typename InterfaceMap::iterator end = m_pMap->end();
+
+ sal_uInt32 i = 0;
+ while( iter != end )
+ {
+ // are interfaces added to this container?
+ if( static_cast<OInterfaceContainerHelper*>((*iter).second)->getLength() )
+ // yes, put the type in the array
+ pArray[i++] = (*iter).first;
+ ++iter;
+ }
+ if( i != nSize ) {
+ // may be empty container, reduce the sequence to the right size
+ aInterfaceTypes = css::uno::Sequence<key>( pArray, i );
+ }
+ return aInterfaceTypes;
+ }
+ return css::uno::Sequence<key>();
+}
+
+
+template< class key , class hashImpl , class equalImpl >
+OInterfaceContainerHelper * OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::getContainer(
+ const key & rKey ) const
+{
+ ::osl::MutexGuard aGuard( rMutex );
+
+ typename InterfaceMap::iterator iter = find( rKey );
+ if( iter != m_pMap->end() )
+ return static_cast<OInterfaceContainerHelper*>( (*iter).second );
+ return NULL;
+}
+
+
+template< class key , class hashImpl , class equalImpl >
+sal_Int32 OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::addInterface(
+ const key & rKey,
+ const css::uno::Reference< css::uno::XInterface > & rListener )
+{
+ ::osl::MutexGuard aGuard( rMutex );
+ typename InterfaceMap::iterator iter = find( rKey );
+ if( iter == m_pMap->end() )
+ {
+ OInterfaceContainerHelper * pLC = new OInterfaceContainerHelper( rMutex );
+ m_pMap->push_back(std::pair<key, void*>(rKey, pLC));
+ return pLC->addInterface( rListener );
+ }
+ else
+ return static_cast<OInterfaceContainerHelper*>((*iter).second)->addInterface( rListener );
+}
+
+
+template< class key , class hashImpl , class equalImpl >
+inline sal_Int32 OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::removeInterface(
+ const key & rKey,
+ const css::uno::Reference< css::uno::XInterface > & rListener )
+{
+ ::osl::MutexGuard aGuard( rMutex );
+
+ // search container with id nUik
+ typename InterfaceMap::iterator iter = find( rKey );
+ // container found?
+ if( iter != m_pMap->end() )
+ return static_cast<OInterfaceContainerHelper*>((*iter).second)->removeInterface( rListener );
+
+ // no container with this id. Always return 0
+ return 0;
+}
+
+
+template< class key , class hashImpl , class equalImpl >
+void OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::disposeAndClear(
+ const css::lang::EventObject & rEvt )
+{
+ typename InterfaceMap::size_type nSize = 0;
+ OInterfaceContainerHelper ** ppListenerContainers = NULL;
+ {
+ ::osl::MutexGuard aGuard( rMutex );
+ nSize = m_pMap->size();
+ if( nSize )
+ {
+ typedef OInterfaceContainerHelper* ppp;
+ ppListenerContainers = new ppp[nSize];
+
+ typename InterfaceMap::iterator iter = m_pMap->begin();
+ typename InterfaceMap::iterator end = m_pMap->end();
+
+ typename InterfaceMap::size_type i = 0;
+ while( iter != end )
+ {
+ ppListenerContainers[i++] = static_cast<OInterfaceContainerHelper*>((*iter).second);
+ ++iter;
+ }
+ }
+ }
+
+ // create a copy, because do not fire event in a guarded section
+ for( typename InterfaceMap::size_type i = 0; i < nSize; i++ )
+ {
+ if( ppListenerContainers[i] )
+ ppListenerContainers[i]->disposeAndClear( rEvt );
+ }
+
+ delete [] ppListenerContainers;
+}
+
+
+template< class key , class hashImpl , class equalImpl >
+void OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::clear()
+{
+ ::osl::MutexGuard aGuard( rMutex );
+ typename InterfaceMap::iterator iter = m_pMap->begin();
+ typename InterfaceMap::iterator end = m_pMap->end();
+
+ while( iter != end )
+ {
+ static_cast<OInterfaceContainerHelper*>((*iter).second)->clear();
+ ++iter;
+ }
+}
+
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/propertysetmixin.hxx b/include/cppuhelper/propertysetmixin.hxx
new file mode 100644
index 000000000..e25f3f738
--- /dev/null
+++ b/include/cppuhelper/propertysetmixin.hxx
@@ -0,0 +1,423 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
+#define INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
+
+#include "sal/config.h"
+
+#include "com/sun/star/beans/XFastPropertySet.hpp"
+#include "com/sun/star/beans/XPropertyAccess.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/uno/Reference.h"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "sal/types.h"
+#include "cppuhelper/cppuhelperdllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace beans {
+ class XPropertyChangeListener;
+ class XPropertySetInfo;
+ class XVetoableChangeListener;
+ struct PropertyValue;
+ }
+ namespace uno {
+ class Type;
+ class XComponentContext;
+ }
+} } }
+
+namespace cppu {
+
+/**
+ @short A helper base class for <code>cppu::PropertySetMixin</code>.
+
+ See the documentation of <code>cppu::PropertySetMixin</code> for
+ further details.
+
+ That <code>cppu::PropertySetMixin</code> is derived from this
+ base class should be considered an implementation detail. The functionality
+ of <code>cppu::PropertySetMixin</code> that is inherited from this base
+ class and is visible to subclasses of
+ <code>cppu::PropertySetMixin</code> should be treated by such
+ subclasses as being provided by <code>cppu::PropertySetMixin</code>
+ directly (e.g., in such subclasses, use
+ &ldquo;<code>PropertySetMixin::Implements</code>&rdquo; instead of
+ &ldquo;<code>PropertySetMixinImpl::Implements</code>&rdquo;).
+
+ @since UDK 3.2.1
+*/
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+class CPPUHELPER_DLLPUBLIC PropertySetMixinImpl:
+ public css::beans::XPropertySet,
+ public css::beans::XFastPropertySet,
+ public css::beans::XPropertyAccess
+{
+protected:
+ /**
+ @short Flags used by subclasses of
+ <code>cppu::PropertySetMixin</code> to specify what UNO interface
+ types shall be supported.
+ */
+ enum Implements {
+ /**
+ @short Flag specifying that the UNO interface type
+ <code>css::beans::XPropertySet</code> shall be supported.
+ */
+ IMPLEMENTS_PROPERTY_SET = 1,
+
+ /**
+ @short Flag specifying that the UNO interface type
+ <code>css::beans::XFastPropertySet</code> shall be
+ supported.
+ */
+ IMPLEMENTS_FAST_PROPERTY_SET = 2,
+
+ /**
+ @short Flag specifying that the UNO interface type
+ <code>css::beans::XPropertyAccess</code> shall be
+ supported.
+ */
+ IMPLEMENTS_PROPERTY_ACCESS = 4
+ };
+
+ /**
+ @short A class used by subclasses of
+ <code>cppu::PropertySetMixin</code> when implementing UNO interface
+ type attribute setter functions.
+
+ This class is not thread safe; that is, the constructor,
+ <code>notify</code>, and the destructor must be called from the same
+ thread.
+
+ See <code>cppu::PropertySetMixinImpl::prepareSet</code> for
+ further details.
+ */
+ class CPPUHELPER_DLLPUBLIC BoundListeners {
+ public:
+ /**
+ @short The constructor.
+
+ May throw <code>std::bad_alloc</code>.
+ */
+ BoundListeners();
+
+ /**
+ @short The destructor.
+
+ Does not throw.
+ */
+ ~BoundListeners();
+
+ /**
+ @short Notifies any
+ <code>css::beans::XPropertyChangeListener</code>s.
+
+ May throw <code>css::uno::RuntimeException</code>
+ and <code>std::bad_alloc</code>.
+
+ See <code>cppu::PropertySetMixinImpl::prepareSet</code>
+ for further details.
+ */
+ void notify() const;
+
+ private:
+ BoundListeners( const BoundListeners&) SAL_DELETED_FUNCTION;
+ void operator=( const BoundListeners&) SAL_DELETED_FUNCTION;
+
+ class Impl;
+ Impl * m_impl;
+
+ friend class PropertySetMixinImpl;
+ };
+
+ /**
+ @short A function used by subclasses of
+ <code>cppu::PropertySetMixin</code> when implementing UNO interface
+ type attribute setter functions.
+
+ First, this function checks whether this instance has already been
+ disposed (see <code>cppu::PropertySetMixinImpl::dispose</code>),
+ and throws a <code>css::lang::DisposedException</code> if
+ applicable. For a constrained attribute (whose setter can explicitly
+ raise <code>css::beans::PropertyVetoException</code>), this
+ function notifies any
+ <code>css::beans::XVetoableChangeListener</code>s. For a
+ bound attribute, this function modifies the passed-in
+ <code>boundListeners</code> so that it can afterwards be used to notify
+ any <code>css::beans::XPropertyChangeListener</code>s. This
+ function should be called before storing the new attribute value, and
+ <code>boundListeners->notify()</code> should be called exactly once after
+ storing the new attribute value (in case the attribute is bound;
+ otherwise, calling <code>boundListeners->notify()</code> is ignored).
+ Furthermore, <code>boundListeners->notify()</code> and this function have
+ to be called from the same thread.
+
+ May throw
+ <code>css::beans::PropertyVetoException</code>,
+ <code>css::uno::RuntimeException</code> (and
+ <code>css::lang::DisposedException</code> in particular), and
+ <code>std::bad_alloc</code>.
+
+ @param propertyName the name of the property (which is the same as the
+ name of the attribute that is going to be set)
+
+ @param oldValue the property value corresponding to the old attribute
+ value. This is only used as
+ <code>css::beans::PropertyChangeEvent::OldValue</code>, which
+ is rather useless, anyway (see &ldquo;Using the Observer Pattern&rdquo;
+ in <a href="http://tools.openoffice.org/CodingGuidelines.sxw">
+ OpenOffice.org Coding Guidelines</a>). If the attribute
+ that is going to be set is neither bound nor constrained, or if
+ <code>css::beans::PropertyChangeEvent::OldValue</code> should
+ not be set, a <code>VOID</code> <code>Any</code> can be used instead.
+
+ @param newValue the property value corresponding to the new
+ attribute value. This is only used as
+ <code>css::beans::PropertyChangeEvent::NewValue</code>, which
+ is rather useless, anyway (see &ldquo;Using the Observer Pattern&rdquo;
+ in <a href="http://tools.openoffice.org/CodingGuidelines.sxw">
+ OpenOffice.org Coding Guidelines</a>), <em>unless</em> the
+ attribute that is going to be set is constrained. If the attribute
+ that is going to be set is neither bound nor constrained, or if it is
+ only bound but
+ <code>css::beans::PropertyChangeEvent::NewValue</code> should
+ not be set, a <code>VOID</code> <code>Any</code> can be used instead.
+
+ @param boundListeners a pointer to a fresh
+ <code>cppu::PropertySetMixinImpl::BoundListeners</code> instance
+ (which has not been passed to this function before, and on which
+ <code>notify</code> has not yet been called); may only be null if the
+ attribute that is going to be set is not bound
+ */
+ void prepareSet(
+ rtl::OUString const & propertyName,
+ css::uno::Any const & oldValue,
+ css::uno::Any const & newValue,
+ BoundListeners * boundListeners);
+
+ /**
+ @short Mark this instance as being disposed.
+
+ See <code>css::lang::XComponent</code> for the general
+ concept of disposing UNO objects. On the first call to this function,
+ all registered listeners
+ (<code>css::beans::XPropertyChangeListener</code>s and
+ <code>css::beans::XVetoableChangeListener</code>s) are
+ notified of the disposing source. Any subsequent calls to this function
+ are ignored.
+
+ May throw <code>css::uno::RuntimeException</code> and
+ <code>std::bad_alloc</code>.
+ */
+ void dispose();
+
+ /**
+ @short A function used by subclasses of
+ <code>cppu::PropertySetMixin</code> when implementing
+ <code>css::uno::XInterface::queryInterface</code>.
+
+ This function checks for support of any of the UNO interface types
+ specified in the call of the <code>cppu::PropertySetMixin</code>
+ constructor. It does not check for any other UNO interface types (not
+ even for <code>css::uno::XInterface</code>), and should not
+ be used directly as the implementation of
+ <code>css::uno::XInterface::queryInterface</code> of this UNO
+ object.
+ */
+ virtual css::uno::Any SAL_CALL queryInterface(
+ css::uno::Type const & type) SAL_OVERRIDE;
+
+ // @see css::beans::XPropertySet::getPropertySetInfo
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() SAL_OVERRIDE;
+
+ // @see css::beans::XPropertySet::setPropertyValue
+ virtual void SAL_CALL setPropertyValue(
+ rtl::OUString const & propertyName,
+ css::uno::Any const & value) SAL_OVERRIDE;
+
+ // @see css::beans::XPropertySet::getPropertyValue
+ virtual css::uno::Any SAL_CALL getPropertyValue(
+ rtl::OUString const & propertyName) SAL_OVERRIDE;
+
+ /**
+ @short Adds a
+ <code>css::beans::XPropertyChangeListener</code>.
+
+ If a listener is added more than once, it will receive all
+ relevant notifications multiple times.
+
+ @see css::beans::XPropertySet::addPropertyChangeListener
+ */
+ virtual void SAL_CALL addPropertyChangeListener(
+ rtl::OUString const & propertyName,
+ css::uno::Reference<
+ css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE;
+
+ // @see css::beans::XPropertySet::removePropertyChangeListener
+ virtual void SAL_CALL removePropertyChangeListener(
+ rtl::OUString const & propertyName,
+ css::uno::Reference<
+ css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE;
+
+ /**
+ @short Adds a
+ <code>css::beans::XVetoableChangeListener</code>.
+
+ If a listener is added more than once, it will receive all
+ relevant notifications multiple times.
+
+ @see css::beans::XPropertySet::addVetoableChangeListener
+ */
+ virtual void SAL_CALL addVetoableChangeListener(
+ rtl::OUString const & propertyName,
+ css::uno::Reference<
+ css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE;
+
+ // @see css::beans::XPropertySet::removeVetoableChangeListener
+ virtual void SAL_CALL removeVetoableChangeListener(
+ rtl::OUString const & propertyName,
+ css::uno::Reference<
+ css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE;
+
+ // @see css::beans::XFastPropertySet::setFastPropertyValue
+ virtual void SAL_CALL setFastPropertyValue(
+ sal_Int32 handle, css::uno::Any const & value) SAL_OVERRIDE;
+
+ // @see css::beans::XFastPropertySet::getFastPropertyValue
+ virtual css::uno::Any SAL_CALL getFastPropertyValue(
+ sal_Int32 handle) SAL_OVERRIDE;
+
+ // @see css::beans::XPropertyAccess::getPropertyValues
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues() SAL_OVERRIDE;
+
+ // @see css::beans::XPropertyAccess::setPropertyValues
+ virtual void SAL_CALL setPropertyValues(
+ css::uno::Sequence< css::beans::PropertyValue > const & props) SAL_OVERRIDE;
+
+private:
+ PropertySetMixinImpl( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
+ void operator=( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
+
+ PropertySetMixinImpl(
+ css::uno::Reference< css::uno::XComponentContext > const & context,
+ Implements implements,
+ css::uno::Sequence< rtl::OUString > const & absentOptional,
+ css::uno::Type const & type);
+
+ class Impl;
+ Impl * m_impl;
+
+ friend class Impl;
+ template< typename T > friend class PropertySetMixin;
+
+ ~PropertySetMixinImpl();
+
+ void checkUnknown(rtl::OUString const & propertyName);
+};
+
+/**
+ @short A helper mixin to implement certain UNO interfaces related to property
+ set handling on top of the attributes of a given UNO interface type.
+
+ The UNO interface type is specified by the type parameter
+ <code>T</code> (which must correspond to a UNO interface type).
+
+ No specializations of this class template should be added by client
+ code.
+
+ @since UDK 3.2.1
+*/
+template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
+protected:
+ /**
+ @short The constructor.
+
+ May throw <code>css::uno::RuntimeException</code> and
+ <code>std::bad_alloc</code>.
+
+ @param context the component context used by this class template; must
+ not be null, and must supply the
+ <code>com.sun.star.reflection.theCoreReflection</code> and
+ <code>com.sun.star.reflection.theTypeDescriptionManager</code> singletons
+
+ @param implements a combination of zero or more flags specifying what
+ UNO interface types shall be supported
+
+ @param absentOptional a list of optional properties that are not
+ present, and should thus not be visible via
+ <code>css::beans::XPropertySet::getPropertySetInfo</code>,
+ <code>css::beans::XPropertySet::addPropertyChangeListener<!--
+ --></code>, <code>css::beans::XPropertySet::<!--
+ -->removePropertyChangeListener</code>,
+ <code>css::beans::XPropertySet::addVetoableChangeListener<!--
+ --></code>, and <code>css::beans::XPropertySet::<!--
+ -->removeVetoableChangeListener</code>. For consistency reasons, the
+ given <code>absentOptional</code> should only contain the names of
+ attributes that represent optional properties that are not present (that
+ is, the attribute getters and setters always throw a
+ <code>css::beans::UnknownPropertyException</code>), and should
+ contain each such name only once. If an optional property is not present
+ (that is, the corresponding attribute getter and setter always throw a
+ <code>css::beans::UnknownPropertyException</code>) but is not
+ contained in the given <code>absentOptional</code>, then it will be
+ visible via
+ <code>css::beans::XPropertySet::getPropertySetInfo</code> as a
+ <code>css::beans::Property</code> with a set
+ <code>css::beans::PropertyAttribute::OPTIONAL</code>. If the
+ given <code>implements</code> specifies that
+ <code>css::beans::XPropertySet</code> is not supported, then
+ the given <code>absentOptional</code> is effectively ignored and can be
+ empty.
+ */
+ PropertySetMixin(
+ css::uno::Reference< css::uno::XComponentContext > const & context,
+ Implements implements,
+ css::uno::Sequence< rtl::OUString > const & absentOptional):
+ PropertySetMixinImpl(
+ context, implements, absentOptional, T::static_type())
+ {}
+
+ /**
+ @short The destructor.
+
+ Does not throw.
+ */
+ ~PropertySetMixin() {}
+
+private:
+ PropertySetMixin( const PropertySetMixin&) SAL_DELETED_FUNCTION;
+ void operator=( const PropertySetMixin&) SAL_DELETED_FUNCTION;
+};
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic pop
+#endif
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/propshlp.hxx b/include/cppuhelper/propshlp.hxx
new file mode 100644
index 000000000..d2e73d707
--- /dev/null
+++ b/include/cppuhelper/propshlp.hxx
@@ -0,0 +1,729 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPUHELPER_PROPSHLP_HXX
+#define INCLUDED_CPPUHELPER_PROPSHLP_HXX
+
+#include "rtl/alloc.h"
+
+#include "cppuhelper/interfacecontainer.h"
+
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertySetOption.hpp"
+#include "com/sun/star/beans/XMultiPropertySet.hpp"
+#include "com/sun/star/beans/XFastPropertySet.hpp"
+
+#include "cppuhelper/cppuhelperdllapi.h"
+
+
+namespace cppu
+{
+
+
+/*************************************************************************
+*************************************************************************/
+
+
+/**
+ This interface is used by the OPropertyHelper, to access the property description.
+ */
+class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC IPropertyArrayHelper
+{
+public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete( void *, void * )
+ {}
+
+ /**
+ Following the rule, the first virtual method implies a virtual destructor.
+ */
+ virtual ~IPropertyArrayHelper();
+
+ /**
+ Return the property members Name and Attribute from the handle nHandle.
+ @param nHandle the handle of a property. If the values of the handles
+ are sorted in the same way as the names and the highest handle value
+ is getCount() -1, then it must be an indexed access to the property array.
+ @param pPropName is an out parameter filled with property name of the property with the
+ handle nHandle. May be NULL.
+ @param pAttributes is an out parameter filled with attributes of the property with the
+ handle nHandle. May be NULL.
+ @return True, if the handle exist, otherwise false.
+ */
+ virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
+ ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) = 0;
+ /**
+ Return the sequence of properties. The sequence is sorted by name.
+ */
+ virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() = 0;
+ /**
+ Return the property with the name rPropertyName.
+ @param rPropertyName the name of the property.
+ @exception UnknownPropertyException thrown if the property name is unknown.
+ */
+ virtual css::beans::Property SAL_CALL getPropertyByName(
+ const ::rtl::OUString& rPropertyName ) = 0;
+ /**
+ Return true if the property with the name rPropertyName exist, otherwise false.
+ @param rPropertyName the name of the property.
+ */
+ virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) = 0;
+ /**
+ Return the handle of the property with the name rPropertyName.
+ If the property does not exist -1 is returned.
+ @param rPropertyName the name of the property.
+ */
+ virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) = 0;
+ /**
+ Fill the array with the handles of the properties.
+ @return the handles of the names from the pHandles array. -1
+ indicates an unknown property name.
+ */
+ virtual sal_Int32 SAL_CALL fillHandles(
+ /*out*/ sal_Int32 * pHandles, const css::uno::Sequence< ::rtl::OUString > & rPropNames ) = 0;
+};
+
+/**
+ You can use this helper class to map a XPropertySet-Interface to a XFast-
+ or a XMultiPropertySet interface.
+ */
+class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC OPropertyArrayHelper : public IPropertyArrayHelper
+{
+public:
+ /**
+ Create an object which supports the common property interfaces.
+
+ @param pProps array of properties
+ The array pProps should be sorted.
+ @param nElements is the number of properties in the pProps structure.
+ @param bSorted indicates that the elements are sorted.
+ *********/
+ OPropertyArrayHelper(
+ css::beans::Property *pProps,
+ sal_Int32 nElements ,
+ sal_Bool bSorted = true );
+
+ /**
+ Create an object which supports the common property interfaces.
+ @param aProps sequence of properties which are supported by this helper.
+ The sequence aProps should be sorted.
+ @param bSorted indicates that the elements are sorted.
+ */
+ OPropertyArrayHelper(
+ const css::uno::Sequence< css::beans::Property > & aProps,
+ sal_Bool bSorted = true );
+
+ /**
+ Return the number of properties.
+ */
+ sal_Int32 SAL_CALL getCount() const;
+ /**
+ Return the property members Name and Attribute from the handle nHandle.
+ @param nHandle the handle of a property. If the values of the handles
+ are sorted in the same way as the names and the highest handle value
+ is getCount() -1, then it is only an indexed access to the property array.
+ Otherwise it is a linear search through the array.
+ @param pPropName is an out parameter filled with property name of the property with the
+ handle nHandle. May be NULL.
+ @param pAttributes is an out parameter filled with attributes of the property with the
+ handle nHandle. May be NULL.
+ @return True, if the handle exist, otherwise false.
+ */
+ virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
+ ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) SAL_OVERRIDE;
+ /**
+ Return the sequence of properties. The sequence is sorted by name.
+ */
+ virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() SAL_OVERRIDE;
+ /**
+ Return the property with the name rPropertyName.
+ @param rPropertyName the name of the property.
+ @exception UnknownPropertyException thrown if the property name is unknown.
+ */
+ virtual css::beans::Property SAL_CALL getPropertyByName(
+ const ::rtl::OUString& rPropertyName ) SAL_OVERRIDE;
+ /**
+ Return true if the property with the name rPropertyName exist, otherwise false.
+ @param rPropertyName the name of the property.
+ */
+ virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) SAL_OVERRIDE;
+ /**
+ Return the handle of the property with the name rPropertyName.
+ If the property does not exist -1 is returned.
+ @param rPropertyName the name of the property.
+ */
+ virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) SAL_OVERRIDE;
+ /**
+ Fill the array with the handles of the properties.
+ @return the handles of the names from the pHandles array. -1
+ indicates an unknown property name.
+ */
+ virtual sal_Int32 SAL_CALL fillHandles(
+ /*out*/sal_Int32 * pHandles, const css::uno::Sequence< ::rtl::OUString > & rPropNames ) SAL_OVERRIDE;
+
+protected:
+ /** reserved for future use. do not use.
+ */
+ void * m_pReserved;
+
+private:
+ void init( sal_Bool bSorted );
+
+ /** The sequence generated from the pProperties array. */
+ css::uno::Sequence< css::beans::Property > aInfos;
+
+ /**
+ True, If the values of the handles are sorted in the same way as the names
+ and the highest handle value is getCount() -1, otherwise false.
+ */
+ sal_Bool bRightOrdered;
+};
+
+
+// helper defines needed for an interface container with a 32 bit key values
+
+struct equalInt32_Impl
+{
+ bool operator()(const sal_Int32 & i1 , const sal_Int32 & i2) const
+ { return i1 == i2; }
+};
+
+struct hashInt32_Impl
+{
+ size_t operator()(const sal_Int32 & i) const
+ { return i; }
+};
+
+/** Specialized class for key type sal_Int32,
+ without explicit usage of STL symbols.
+*/
+class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelperInt32
+{
+public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete( void *, void * )
+ {}
+
+ /**
+ Create a container of interface containers.
+
+ @param rMutex the mutex to protect multi thread access.
+ The lifetime must be longer than the lifetime
+ of this object.
+ */
+ OMultiTypeInterfaceContainerHelperInt32( ::osl::Mutex & rMutex );
+ /**
+ Delete all containers.
+ */
+ ~OMultiTypeInterfaceContainerHelperInt32();
+
+ /**
+ Return all id's under which at least one interface is added.
+ */
+ css::uno::Sequence< sal_Int32 > SAL_CALL getContainedTypes() const;
+
+ /**
+ Return the container created under this key.
+ @return the container created under this key. If the container
+ was not created, null was returned.
+ */
+ OInterfaceContainerHelper * SAL_CALL getContainer( const sal_Int32 & rKey ) const;
+
+ /**
+ Insert an element in the container specified with the key. The position is not specified.
+ @param rKey the id of the container.
+ @param r the added interface. It is allowed to insert null or
+ the same pointer more than once.
+ @return the new count of elements in the container.
+ */
+ sal_Int32 SAL_CALL addInterface(
+ const sal_Int32 & rKey,
+ const css::uno::Reference< css::uno::XInterface > & r );
+
+ /**
+ Remove an element from the container specified with the key.
+ It uses the equal definition of uno objects to remove the interfaces.
+ @param rKey the id of the container.
+ @param rxIFace the removed interface.
+ @return the new count of elements in the container.
+ */
+ sal_Int32 SAL_CALL removeInterface(
+ const sal_Int32 & rKey,
+ const css::uno::Reference< css::uno::XInterface > & rxIFace );
+
+ /**
+ Call disposing on all objects in the container that
+ support XEventListener. Then clear the container.
+ */
+ void SAL_CALL disposeAndClear( const css::lang::EventObject & rEvt );
+ /**
+ Remove all elements of all containers. Does not delete the container.
+ */
+ void SAL_CALL clear();
+
+ typedef sal_Int32 keyType;
+private:
+ void * m_pMap;
+ ::osl::Mutex & rMutex;
+
+ OMultiTypeInterfaceContainerHelperInt32( const OMultiTypeInterfaceContainerHelperInt32 & ) SAL_DELETED_FUNCTION;
+ OMultiTypeInterfaceContainerHelperInt32 & operator = ( const OMultiTypeInterfaceContainerHelperInt32 & )SAL_DELETED_FUNCTION;
+};
+
+
+/** An interface to extend event notification actions.
+ */
+class IEventNotificationHook
+{
+public:
+ /**
+ Method to be called by OPropertySetHelper::fire.
+
+ @param pnHandles the id's of the properties that changed.
+ @param nCount the number of elements in the arrays pnHandles, pNewValues and pOldValues.
+ @param bVetoable true means fire to VetoableChangeListener, false means fire to
+ XPropertyChangedListener and XMultiPropertyChangedListener.
+ @param bIgnoreRuntimeExceptionsWhileFiring
+ indicates whether occurring RuntimeExceptions will be
+ ignored when firing notifications
+ (vetoableChange(), propertyChange())
+ to listeners.
+ PropertyVetoExceptions may still be thrown.
+ This flag is useful in an inter-process scenario when
+ remote bridges may break down
+ (firing DisposedExceptions).
+
+ @see OPropertySetHelper::fire
+ */
+ virtual void fireEvents(
+ sal_Int32 * pnHandles,
+ sal_Int32 nCount,
+ sal_Bool bVetoable,
+ bool bIgnoreRuntimeExceptionsWhileFiring) = 0;
+
+#if !defined _MSC_VER // public -> protected changes mangled names there
+protected:
+#elif defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+ ~IEventNotificationHook() {}
+ // avoid warnings about virtual members and non-virtual dtor
+#if defined _MSC_VER && defined __clang__
+#pragma clang diagnostic pop
+#endif
+};
+
+
+/**
+ This abstract class maps the methods of the interfaces XMultiPropertySet, XFastPropertySet
+ and XPropertySet to the methods getInfoHelper, convertFastPropertyValue,
+ setFastPropertyValue_NoBroadcast and getFastPropertyValue. You must derive from
+ this class and override the methods.
+ It provides a standard implementation of the XPropertySetInfo.
+ The XPropertiesChangeListener are inserted in the rBHelper.aLC structure.
+ The XPropertyChangeListener and XVetoableChangeListener with no names are inserted
+ in the rBHelper.aLC structure. So it is possible to advise property listeners with
+ the connection point interfaces. But only listeners that listen to all property changes.
+
+ */
+class CPPUHELPER_DLLPUBLIC OPropertySetHelper :
+ public css::beans::XMultiPropertySet,
+ public css::beans::XFastPropertySet,
+ public css::beans::XPropertySet
+{
+public:
+ /**
+ @param rBHelper this structure contains the basic members of
+ a broadcaster.
+ The lifetime must be longer than the lifetime
+ of this object. Stored in the variable rBHelper.
+ */
+ OPropertySetHelper( OBroadcastHelper & rBHelper );
+
+ /** Constructor.
+
+ @param rBHelper
+ this structure contains the basic members of
+ a broadcaster.
+ The lifetime must be longer than the lifetime
+ of this object. Stored in the variable rBHelper.
+
+ @param bIgnoreRuntimeExceptionsWhileFiring
+ indicates whether occurring RuntimeExceptions will be
+ ignored when firing notifications
+ (vetoableChange(), propertyChange())
+ to listeners.
+ PropertyVetoExceptions may still be thrown.
+ This flag is useful in an inter-process scenario when
+ remote bridges may break down
+ (firing DisposedExceptions).
+ */
+ OPropertySetHelper(
+ OBroadcastHelper & rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring );
+
+ /** Constructor.
+
+ @param rBHelper
+ this structure contains the basic members of
+ a broadcaster.
+ The lifetime must be longer than the lifetime
+ of this object. Stored in the variable rBHelper.
+
+ @param i_pFireEvents
+ additional event notifier
+
+ @param bIgnoreRuntimeExceptionsWhileFiring
+ indicates whether occurring RuntimeExceptions will be
+ ignored when firing notifications
+ (vetoableChange(), propertyChange())
+ to listeners.
+ PropertyVetoExceptions may still be thrown.
+ This flag is useful in an inter-process scenario when
+ remote bridges may break down
+ (firing DisposedExceptions).
+ */
+ OPropertySetHelper(
+ OBroadcastHelper & rBHelper,
+ IEventNotificationHook *i_pFireEvents,
+ bool bIgnoreRuntimeExceptionsWhileFiring = false);
+
+ /**
+ Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and
+ XEventListener.
+ */
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) SAL_OVERRIDE;
+
+ /** eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, XFastPropertySet, XPropertySet
+
+ @throws css::uno::RuntimeException
+ */
+ css::uno::Sequence< css::uno::Type > getTypes();
+
+ /**
+ Send a disposing notification to the listeners in the containers aBoundLC
+ and aVetoableLC.
+
+ @see OComponentHelper
+ */
+ void SAL_CALL disposing();
+
+ /**
+ Throw UnknownPropertyException or PropertyVetoException if the property with the name
+ rPropertyName does not exist or is readonly. Otherwise rPropertyName is changed to its handle
+ value and setFastPropertyValue is called.
+ */
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const css::uno::Any& aValue ) SAL_OVERRIDE;
+ /**
+ Throw UnknownPropertyException if the property with the name
+ rPropertyName does not exist.
+ */
+ virtual css::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName) SAL_OVERRIDE;
+ /** Ignored if the property is not bound. */
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener) SAL_OVERRIDE;
+
+ /** Ignored if the property is not bound. */
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const css::uno::Reference < css::beans::XPropertyChangeListener >& aListener) SAL_OVERRIDE;
+
+ /** Ignored if the property is not constrained. */
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener) SAL_OVERRIDE;
+
+ /** Ignored if the property is not constrained. */
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const css::uno::Reference< css::beans::XVetoableChangeListener > & aListener ) SAL_OVERRIDE;
+
+ /**
+ Throw UnknownPropertyException or PropertyVetoException if the property with the name
+ rPropertyName does not exist or is readonly. Otherwise the method convertFastPropertyValue
+ is called, then the vetoable listeners are notified. After this the value of the property
+ is changed with the setFastPropertyValue_NoBroadcast method and the bound listeners are
+ notified.
+ */
+ virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& rValue ) SAL_OVERRIDE;
+
+ /**
+ @exception css::beans::UnknownPropertyException
+ if the property with the handle nHandle does not exist.
+ */
+ virtual css::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle ) SAL_OVERRIDE;
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues(
+ const css::uno::Sequence< ::rtl::OUString >& PropertyNames,
+ const css::uno::Sequence< css::uno::Any >& Values ) SAL_OVERRIDE;
+
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(
+ const css::uno::Sequence< ::rtl::OUString >& PropertyNames ) SAL_OVERRIDE;
+
+ virtual void SAL_CALL addPropertiesChangeListener(
+ const css::uno::Sequence< ::rtl::OUString >& PropertyNames,
+ const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) SAL_OVERRIDE;
+
+ virtual void SAL_CALL removePropertiesChangeListener(
+ const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) SAL_OVERRIDE;
+
+ virtual void SAL_CALL firePropertiesChangeEvent(
+ const css::uno::Sequence< ::rtl::OUString >& PropertyNames,
+ const css::uno::Reference< css::beans::XPropertiesChangeListener > & Listener ) SAL_OVERRIDE;
+
+ /**
+ The property sequence is created in the call. The interface isn't used after the call.
+ */
+ static css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL
+ createPropertySetInfo( IPropertyArrayHelper & rProperties );
+protected:
+ /**
+ This method fire events to all registered property listeners.
+ @param pnHandles the id's of the properties that changed.
+ @param pNewValues the new values of the properties.
+ @param pOldValues the old values of the properties.
+ @param nCount the number of elements in the arrays pnHandles, pNewValues and pOldValues.
+ @param bVetoable true means fire to VetoableChangeListener, false means fire to
+ XPropertyChangedListener and XMultiPropertyChangedListener.
+ */
+ void SAL_CALL fire(
+ sal_Int32 * pnHandles,
+ const css::uno::Any * pNewValues,
+ const css::uno::Any * pOldValues,
+ sal_Int32 nCount,
+ sal_Bool bVetoable );
+
+ /**
+ Set multiple properties with the handles.
+ @param nSeqLen the length of the arrays pHandles and Values.
+ @param pHandles the handles of the properties. The number of elements
+ in the Values sequence is the length of the handle array. A value of -1
+ of a handle means invalid property. These are ignored.
+ @param pValues the values of the properties.
+ @param nHitCount the number of valid entries in the handle array.
+ */
+ void SAL_CALL setFastPropertyValues(
+ sal_Int32 nSeqLen,
+ sal_Int32 * pHandles,
+ const css::uno::Any * pValues,
+ sal_Int32 nHitCount );
+
+ /**
+ This abstract method must return the name to index table. This table contains all property
+ names and types of this object. The method is not implemented in this class.
+ */
+ virtual IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
+
+ /**
+ Converted the value rValue and return the result in rConvertedValue and the
+ old value in rOldValue. An IllegalArgumentException is thrown.
+ The method is not implemented in this class. After this call the vetoable
+ listeners are notified.
+
+ @param rConvertedValue the converted value. Only set if return is true.
+ @param rOldValue the old value. Only set if return is true.
+ @param nHandle the handle of the property.
+ @param rValue the value to be converted
+ @return true if the value converted.
+ @throws css::lang::IllegalArgumentException
+ @throws css::beans::UnknownPropertyException
+ @throws css::uno::RuntimeException
+ */
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ css::uno::Any & rConvertedValue,
+ css::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue ) = 0;
+
+ /** The same as setFastPropertyValue; nHandle is always valid.
+ The changes must not be broadcasted in this method.
+ The method is implemented in a derived class.
+
+ @attention
+ Although you are permitted to throw any UNO exception, only the following
+ are valid for usage:
+ -- css::beans::UnknownPropertyException
+ -- css::beans::PropertyVetoException
+ -- css::lang::IllegalArgumentException
+ -- css::lang::WrappedTargetException
+ -- css::uno::RuntimeException
+
+ @param nHandle
+ handle
+ @param rValue
+ value
+ @throws css::uno::Exception
+ */
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue ) = 0;
+ /**
+ The same as getFastPropertyValue, but return the value through rValue and nHandle
+ is always valid.
+ The method is not implemented in this class.
+ */
+ virtual void SAL_CALL getFastPropertyValue(
+ css::uno::Any& rValue,
+ sal_Int32 nHandle ) const = 0;
+
+ /** sets an dependent property's value
+
+ <p>Sometimes setting a given property needs to implicitly modify another property's value. Calling |setPropertyValue|
+ from within |setFastPropertyValue_NoBroadcast| is not an option here, as it would notify the property listeners
+ while our mutex is still locked. Setting the dependent property's value directly (e.g. by calling |setFastPropertyValue_NoBroadcast|
+ recursively) is not an option, too, since it would miss firing the property change event.</p>
+
+ <p>So, in such cases, you use |setDependentFastPropertyValue| from within |setFastPropertyValue_NoBroadcast|.
+ It will convert and actually set the property value (invoking |convertFastPropertyValue| and |setFastPropertyValue_NoBroadcast|
+ for the given handle and value), and add the property change event to the list of events to be notified
+ when the bottom-most |setFastPropertyValue_NoBroadcast| on the stack returns.</p>
+
+ <p><strong>Note</strong>: The method will <em>not</em> invoke veto listeners for the property.</p>
+
+ <p><strong>Note</strong>: It's the caller's responsibility to ensure that our mutex is locked. This is
+ canonically given when the method is invoked from within |setFastPropertyValue_NoBroadcast|, in other
+ contexts, you might need to take own measures.</p>
+ */
+ void setDependentFastPropertyValue(
+ sal_Int32 i_handle,
+ const css::uno::Any& i_value
+ );
+
+ /** The common data of a broadcaster. Use the mutex, disposing state and the listener container. */
+ OBroadcastHelper &rBHelper;
+ /**
+ Container for the XPropertyChangedListener. The listeners are inserted by handle.
+ */
+ OMultiTypeInterfaceContainerHelperInt32 aBoundLC;
+ /**
+ Container for the XPropertyVetoableListener. The listeners are inserted by handle.
+ */
+ OMultiTypeInterfaceContainerHelperInt32 aVetoableLC;
+
+ class Impl;
+
+ /** reserved for future use. finally, the future has arrived...
+ */
+ Impl * const m_pReserved;
+
+private:
+ OPropertySetHelper( const OPropertySetHelper & ) SAL_DELETED_FUNCTION;
+ OPropertySetHelper & operator = ( const OPropertySetHelper & )
+ SAL_DELETED_FUNCTION;
+
+ /** notifies the given changes in property's values, <em>plus</em> all property changes collected during recent
+ |setDependentFastPropertyValue| calls.
+ */
+ void impl_fireAll(
+ sal_Int32* i_handles,
+ const css::uno::Any * i_newValues,
+ const css::uno::Any * i_oldValues,
+ sal_Int32 i_count
+ );
+
+#if defined _MSC_VER // public -> protected changes mangled names there
+public:
+#else
+protected:
+#endif
+// Suppress warning about virtual functions but non-virtual destructor:
+#if defined _MSC_VER
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
+#endif
+ /**
+ You must call disposing before destruction.
+ */
+ ~OPropertySetHelper();
+};
+#if defined _MSC_VER
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
+#endif
+
+/**
+ OPropertySetHelper plus XPropertySetOption
+
+ @attention
+ The getTypes() inherited from OPropertysetHelper does not cover
+ XPropertySetOption.
+*/
+class CPPUHELPER_DLLPUBLIC OPropertySetHelper2 : public OPropertySetHelper,
+ public css::beans::XPropertySetOption
+{
+public:
+ /** Constructor.
+
+ See OPropertySetHelper constructors documentation
+ */
+ explicit OPropertySetHelper2(
+ OBroadcastHelper & rBHelper,
+ IEventNotificationHook *i_pFireEvents = NULL,
+ bool bIgnoreRuntimeExceptionsWhileFiring = false);
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) SAL_OVERRIDE;
+
+ // XPropertySetOption
+ virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable ) SAL_OVERRIDE;
+
+
+private:
+ OPropertySetHelper2( const OPropertySetHelper2 & ) SAL_DELETED_FUNCTION;
+ OPropertySetHelper2 & operator = ( const OPropertySetHelper2 & )
+ SAL_DELETED_FUNCTION;
+
+#if defined _MSC_VER // public -> protected changes mangled names there
+public:
+#else
+protected:
+#endif
+// Suppress warning about virtual functions but non-virtual destructor:
+ /**
+ You must call disposing before destruction.
+ */
+ virtual ~OPropertySetHelper2();
+};
+
+} // end namespace cppuhelper
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/proptypehlp.h b/include/cppuhelper/proptypehlp.h
new file mode 100644
index 000000000..348e45afb
--- /dev/null
+++ b/include/cppuhelper/proptypehlp.h
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_PROPTYPEHLP_H
+#define INCLUDED_CPPUHELPER_PROPTYPEHLP_H
+
+#include "sal/types.h"
+
+namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
+
+namespace cppu {
+
+/** Converts the value stored in an any to a concrete C++ type.
+ The function does the same as the operator >>= () at the
+ Any class, except that it throws an IllegalArgumentException in case of
+ failures (the value cannot be extracted without data loss )
+
+ @exception css::lang::IllegalArgumentException when the type could not be converted.
+ */
+template < class target >
+inline void SAL_CALL convertPropertyValue( target &value , const css::uno::Any & a);
+
+/**
+ conversion of basic types
+*/
+inline void SAL_CALL convertPropertyValue( sal_Bool & target , const css::uno::Any & source );
+inline void SAL_CALL convertPropertyValue( bool & target , const css::uno::Any & source );
+inline void SAL_CALL convertPropertyValue( sal_Int64 & target , const css::uno::Any & source );
+inline void SAL_CALL convertPropertyValue( sal_uInt64 & target, const css::uno::Any & source );
+inline void SAL_CALL convertPropertyValue( sal_Int32 & target , const css::uno::Any & source );
+inline void SAL_CALL convertPropertyValue( sal_uInt32 & target, const css::uno::Any & source );
+inline void SAL_CALL convertPropertyValue( sal_Int16 & target , const css::uno::Any & source );
+inline void SAL_CALL convertPropertyValue( sal_uInt16 & target, const css::uno::Any & source );
+inline void SAL_CALL convertPropertyValue( sal_Int8 & target , const css::uno::Any & source );
+inline void SAL_CALL convertPropertyValue( float & target , const css::uno::Any & source );
+inline void SAL_CALL convertPropertyValue( double &target , const css::uno::Any &source );
+
+} // end namespace cppu
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/proptypehlp.hxx b/include/cppuhelper/proptypehlp.hxx
new file mode 100644
index 000000000..339c3910e
--- /dev/null
+++ b/include/cppuhelper/proptypehlp.hxx
@@ -0,0 +1,286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPUHELPER_PROPTYPEHLP_HXX
+#define INCLUDED_CPPUHELPER_PROPTYPEHLP_HXX
+
+#include "cppuhelper/proptypehlp.h"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/uno/TypeClass.hpp"
+
+namespace cppu
+{
+
+template < class target >
+inline void SAL_CALL convertPropertyValue( target &value , const css::uno::Any & a)
+{
+
+ if( !( a >>= value ) ) {
+ throw css::lang::IllegalArgumentException();
+ }
+}
+
+void convertPropertyValue(bool & b, const css::uno::Any & a)
+{
+ if( a >>= b )
+ return;
+
+ switch( a.getValueType().getTypeClass() ) {
+ case css::uno::TypeClass_BYTE:
+ b = a.get<sal_Int8>() != 0;
+ break;
+ case css::uno::TypeClass_SHORT:
+ b = a.get<sal_Int16>() != 0;
+ break;
+ case css::uno::TypeClass_UNSIGNED_SHORT:
+ {
+ sal_uInt16 i16 = 0;
+ a >>= i16;
+ b = i16 != 0;
+ break;
+ }
+ case css::uno::TypeClass_LONG:
+ b = a.get<sal_Int32>() != 0;
+ break;
+ case css::uno::TypeClass_UNSIGNED_LONG:
+ b = a.get<sal_uInt32>() != 0;
+ break;
+ case css::uno::TypeClass_CHAR:
+ {
+ sal_Unicode c = *static_cast<sal_Unicode const *>(a.getValue());
+ b = c != 0;
+ break;
+ }
+ default:
+ throw css::lang::IllegalArgumentException();
+ }
+}
+
+void convertPropertyValue(sal_Bool & target, css::uno::Any const & source) {
+ bool b;
+ convertPropertyValue(b, source);
+ target = b;
+}
+
+inline void SAL_CALL convertPropertyValue( sal_Int64 & i , const css::uno::Any & a )
+{
+ if( !(a >>= i) ) {
+ switch( a.getValueType().getTypeClass() ) {
+ case css::uno::TypeClass_BOOLEAN:
+ i = static_cast<sal_Int64>(a.get<bool>());
+ break;
+ case css::uno::TypeClass_CHAR:
+ {
+ sal_Unicode c;
+ c = *static_cast<sal_Unicode const *>(a.getValue());
+ i = static_cast<sal_Int64>(c);
+ break;
+ }
+ default:
+ throw css::lang::IllegalArgumentException();
+ }
+ }
+}
+
+
+inline void SAL_CALL convertPropertyValue( sal_uInt64 & i , const css::uno::Any & a )
+{
+ if( !(a >>= i) ) {
+ switch( a.getValueType().getTypeClass() ) {
+ case css::uno::TypeClass_BOOLEAN:
+ i = static_cast<sal_uInt64>(a.get<bool>());
+ break;
+ case css::uno::TypeClass_CHAR:
+ {
+ sal_Unicode c;
+ c = *static_cast<sal_Unicode const *>(a.getValue());
+ i = static_cast<sal_uInt64>(c);
+ break;
+ }
+ default:
+ throw css::lang::IllegalArgumentException();
+ }
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( sal_Int32 & i , const css::uno::Any & a )
+{
+ if( !(a >>= i) ) {
+ switch( a.getValueType().getTypeClass() ) {
+ case css::uno::TypeClass_BOOLEAN:
+ i = static_cast<sal_Int32>(a.get<bool>());
+ break;
+ case css::uno::TypeClass_CHAR:
+ {
+ sal_Unicode c;
+ c = *static_cast<sal_Unicode const *>(a.getValue());
+ i = static_cast<sal_Int32>(c);
+ break;
+ }
+ default:
+ throw css::lang::IllegalArgumentException();
+ }
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( sal_uInt32 & i , const css::uno::Any & a )
+{
+ if( !(a >>= i) ) {
+ switch( a.getValueType().getTypeClass() ) {
+ case css::uno::TypeClass_BOOLEAN:
+ i = static_cast<sal_uInt32>(a.get<bool>());
+ break;
+ case css::uno::TypeClass_CHAR:
+ {
+ sal_Unicode c;
+ c = *static_cast<sal_Unicode const *>(a.getValue());
+ i = static_cast<sal_uInt32>(c);
+ break;
+ }
+ default:
+ throw css::lang::IllegalArgumentException();
+ }
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( sal_Int16 & i , const css::uno::Any & a )
+{
+ if( !(a >>= i) ) {
+ switch( a.getValueType().getTypeClass() ) {
+ case css::uno::TypeClass_BOOLEAN:
+ i = static_cast<sal_Int16>(a.get<bool>());
+ break;
+ case css::uno::TypeClass_CHAR:
+ {
+ sal_Unicode c;
+ c = *static_cast<sal_Unicode const *>(a.getValue());
+ i = static_cast<sal_Int16>(c);
+ break;
+ }
+ default:
+ throw css::lang::IllegalArgumentException();
+ }
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( sal_uInt16 & i , const css::uno::Any & a )
+{
+ if( !(a >>= i) ) {
+ switch( a.getValueType().getTypeClass() ) {
+ case css::uno::TypeClass_BOOLEAN:
+ i = static_cast<sal_uInt16>(a.get<bool>());
+ break;
+ case css::uno::TypeClass_CHAR:
+ {
+ sal_Unicode c;
+ c = *static_cast<sal_Unicode const *>(a.getValue());
+ i = static_cast<sal_Int16>(c);
+ break;
+ }
+ default:
+ throw css::lang::IllegalArgumentException();
+ }
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( sal_Int8 & i , const css::uno::Any & a )
+{
+ if( !(a >>= i) ) {
+ switch( a.getValueType().getTypeClass() ) {
+ case css::uno::TypeClass_BOOLEAN:
+ i = static_cast<sal_Int8>(a.get<bool>());
+ break;
+ default:
+ throw css::lang::IllegalArgumentException();
+ }
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( float &f , const css::uno::Any &a )
+{
+ if( a >>= f )
+ return;
+
+ switch( a.getValueType().getTypeClass() ) {
+ case css::uno::TypeClass_BOOLEAN:
+ f = static_cast<float>(a.get<bool>());
+ break;
+ case css::uno::TypeClass_LONG:
+ f = static_cast<float>(a.get<sal_Int32>());
+ break;
+ case css::uno::TypeClass_UNSIGNED_LONG:
+ f = static_cast<float>(a.get<sal_uInt32>());
+ break;
+ case css::uno::TypeClass_HYPER:
+ f = static_cast<float>(a.get<sal_Int64>());
+ break;
+ case css::uno::TypeClass_UNSIGNED_HYPER:
+ f = static_cast<float>(a.get<sal_uInt64>());
+ break;
+ case css::uno::TypeClass_DOUBLE:
+ f = static_cast<float>(a.get<double>());
+ break;
+ case css::uno::TypeClass_CHAR:
+ {
+ sal_Unicode c;
+ c = *static_cast<sal_Unicode const *>(a.getValue());
+ f = static_cast<float>(c);
+ break;
+ }
+ default:
+ throw css::lang::IllegalArgumentException();
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( double &d , const css::uno::Any &a )
+{
+ if( a >>= d )
+ return;
+
+ switch( a.getValueType().getTypeClass() ) {
+ case css::uno::TypeClass_BOOLEAN:
+ d = static_cast<double>(a.get<bool>());
+ break;
+ case css::uno::TypeClass_HYPER:
+ d = static_cast<double>(a.get<sal_Int64>());
+ break;
+ case css::uno::TypeClass_UNSIGNED_HYPER:
+ d = static_cast<double>(a.get<sal_uInt64>());
+ break;
+ case css::uno::TypeClass_CHAR:
+ {
+ sal_Unicode c;
+ c = *static_cast<sal_Unicode const *>(a.getValue());
+ d = static_cast<double>(c);
+ break;
+ }
+ default:
+ throw css::lang::IllegalArgumentException();
+ }
+}
+
+} // end namespace cppu
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/queryinterface.hxx b/include/cppuhelper/queryinterface.hxx
new file mode 100644
index 000000000..df9c9916c
--- /dev/null
+++ b/include/cppuhelper/queryinterface.hxx
@@ -0,0 +1,526 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPUHELPER_QUERYINTERFACE_HXX
+#define INCLUDED_CPPUHELPER_QUERYINTERFACE_HXX
+
+#include "sal/config.h"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Type.h"
+#include "sal/types.h"
+
+namespace cppu
+{
+
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else
+ return css::uno::Any();
+}
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @tparam Interface2 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @param p2 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else if (rType == Interface2::static_type())
+ return css::uno::Any( &p2, rType );
+ else
+ return css::uno::Any();
+}
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @tparam Interface2 interface type
+ @tparam Interface3 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @param p2 interface pointer
+ @param p3 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else if (rType == Interface2::static_type())
+ return css::uno::Any( &p2, rType );
+ else if (rType == Interface3::static_type())
+ return css::uno::Any( &p3, rType );
+ else
+ return css::uno::Any();
+}
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @tparam Interface2 interface type
+ @tparam Interface3 interface type
+ @tparam Interface4 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @param p2 interface pointer
+ @param p3 interface pointer
+ @param p4 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class Interface4 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else if (rType == Interface2::static_type())
+ return css::uno::Any( &p2, rType );
+ else if (rType == Interface3::static_type())
+ return css::uno::Any( &p3, rType );
+ else if (rType == Interface4::static_type())
+ return css::uno::Any( &p4, rType );
+ else
+ return css::uno::Any();
+}
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @tparam Interface2 interface type
+ @tparam Interface3 interface type
+ @tparam Interface4 interface type
+ @tparam Interface5 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @param p2 interface pointer
+ @param p3 interface pointer
+ @param p4 interface pointer
+ @param p5 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else if (rType == Interface2::static_type())
+ return css::uno::Any( &p2, rType );
+ else if (rType == Interface3::static_type())
+ return css::uno::Any( &p3, rType );
+ else if (rType == Interface4::static_type())
+ return css::uno::Any( &p4, rType );
+ else if (rType == Interface5::static_type())
+ return css::uno::Any( &p5, rType );
+ else
+ return css::uno::Any();
+}
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @tparam Interface2 interface type
+ @tparam Interface3 interface type
+ @tparam Interface4 interface type
+ @tparam Interface5 interface type
+ @tparam Interface6 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @param p2 interface pointer
+ @param p3 interface pointer
+ @param p4 interface pointer
+ @param p5 interface pointer
+ @param p6 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else if (rType == Interface2::static_type())
+ return css::uno::Any( &p2, rType );
+ else if (rType == Interface3::static_type())
+ return css::uno::Any( &p3, rType );
+ else if (rType == Interface4::static_type())
+ return css::uno::Any( &p4, rType );
+ else if (rType == Interface5::static_type())
+ return css::uno::Any( &p5, rType );
+ else if (rType == Interface6::static_type())
+ return css::uno::Any( &p6, rType );
+ else
+ return css::uno::Any();
+}
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @tparam Interface2 interface type
+ @tparam Interface3 interface type
+ @tparam Interface4 interface type
+ @tparam Interface5 interface type
+ @tparam Interface6 interface type
+ @tparam Interface7 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @param p2 interface pointer
+ @param p3 interface pointer
+ @param p4 interface pointer
+ @param p5 interface pointer
+ @param p6 interface pointer
+ @param p7 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else if (rType == Interface2::static_type())
+ return css::uno::Any( &p2, rType );
+ else if (rType == Interface3::static_type())
+ return css::uno::Any( &p3, rType );
+ else if (rType == Interface4::static_type())
+ return css::uno::Any( &p4, rType );
+ else if (rType == Interface5::static_type())
+ return css::uno::Any( &p5, rType );
+ else if (rType == Interface6::static_type())
+ return css::uno::Any( &p6, rType );
+ else if (rType == Interface7::static_type())
+ return css::uno::Any( &p7, rType );
+ else
+ return css::uno::Any();
+}
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @tparam Interface2 interface type
+ @tparam Interface3 interface type
+ @tparam Interface4 interface type
+ @tparam Interface5 interface type
+ @tparam Interface6 interface type
+ @tparam Interface7 interface type
+ @tparam Interface8 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @param p2 interface pointer
+ @param p3 interface pointer
+ @param p4 interface pointer
+ @param p5 interface pointer
+ @param p6 interface pointer
+ @param p7 interface pointer
+ @param p8 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else if (rType == Interface2::static_type())
+ return css::uno::Any( &p2, rType );
+ else if (rType == Interface3::static_type())
+ return css::uno::Any( &p3, rType );
+ else if (rType == Interface4::static_type())
+ return css::uno::Any( &p4, rType );
+ else if (rType == Interface5::static_type())
+ return css::uno::Any( &p5, rType );
+ else if (rType == Interface6::static_type())
+ return css::uno::Any( &p6, rType );
+ else if (rType == Interface7::static_type())
+ return css::uno::Any( &p7, rType );
+ else if (rType == Interface8::static_type())
+ return css::uno::Any( &p8, rType );
+ else
+ return css::uno::Any();
+}
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @tparam Interface2 interface type
+ @tparam Interface3 interface type
+ @tparam Interface4 interface type
+ @tparam Interface5 interface type
+ @tparam Interface6 interface type
+ @tparam Interface7 interface type
+ @tparam Interface8 interface type
+ @tparam Interface9 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @param p2 interface pointer
+ @param p3 interface pointer
+ @param p4 interface pointer
+ @param p5 interface pointer
+ @param p6 interface pointer
+ @param p7 interface pointer
+ @param p8 interface pointer
+ @param p9 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else if (rType == Interface2::static_type())
+ return css::uno::Any( &p2, rType );
+ else if (rType == Interface3::static_type())
+ return css::uno::Any( &p3, rType );
+ else if (rType == Interface4::static_type())
+ return css::uno::Any( &p4, rType );
+ else if (rType == Interface5::static_type())
+ return css::uno::Any( &p5, rType );
+ else if (rType == Interface6::static_type())
+ return css::uno::Any( &p6, rType );
+ else if (rType == Interface7::static_type())
+ return css::uno::Any( &p7, rType );
+ else if (rType == Interface8::static_type())
+ return css::uno::Any( &p8, rType );
+ else if (rType == Interface9::static_type())
+ return css::uno::Any( &p9, rType );
+ else
+ return css::uno::Any();
+}
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @tparam Interface2 interface type
+ @tparam Interface3 interface type
+ @tparam Interface4 interface type
+ @tparam Interface5 interface type
+ @tparam Interface6 interface type
+ @tparam Interface7 interface type
+ @tparam Interface8 interface type
+ @tparam Interface9 interface type
+ @tparam Interface10 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @param p2 interface pointer
+ @param p3 interface pointer
+ @param p4 interface pointer
+ @param p5 interface pointer
+ @param p6 interface pointer
+ @param p7 interface pointer
+ @param p8 interface pointer
+ @param p9 interface pointer
+ @param p10 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else if (rType == Interface2::static_type())
+ return css::uno::Any( &p2, rType );
+ else if (rType == Interface3::static_type())
+ return css::uno::Any( &p3, rType );
+ else if (rType == Interface4::static_type())
+ return css::uno::Any( &p4, rType );
+ else if (rType == Interface5::static_type())
+ return css::uno::Any( &p5, rType );
+ else if (rType == Interface6::static_type())
+ return css::uno::Any( &p6, rType );
+ else if (rType == Interface7::static_type())
+ return css::uno::Any( &p7, rType );
+ else if (rType == Interface8::static_type())
+ return css::uno::Any( &p8, rType );
+ else if (rType == Interface9::static_type())
+ return css::uno::Any( &p9, rType );
+ else if (rType == Interface10::static_type())
+ return css::uno::Any( &p10, rType );
+ else
+ return css::uno::Any();
+}
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @tparam Interface2 interface type
+ @tparam Interface3 interface type
+ @tparam Interface4 interface type
+ @tparam Interface5 interface type
+ @tparam Interface6 interface type
+ @tparam Interface7 interface type
+ @tparam Interface8 interface type
+ @tparam Interface9 interface type
+ @tparam Interface10 interface type
+ @tparam Interface11 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @param p2 interface pointer
+ @param p3 interface pointer
+ @param p4 interface pointer
+ @param p5 interface pointer
+ @param p6 interface pointer
+ @param p7 interface pointer
+ @param p8 interface pointer
+ @param p9 interface pointer
+ @param p10 interface pointer
+ @param p11 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
+ class Interface11 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
+ Interface11 * p11 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else if (rType == Interface2::static_type())
+ return css::uno::Any( &p2, rType );
+ else if (rType == Interface3::static_type())
+ return css::uno::Any( &p3, rType );
+ else if (rType == Interface4::static_type())
+ return css::uno::Any( &p4, rType );
+ else if (rType == Interface5::static_type())
+ return css::uno::Any( &p5, rType );
+ else if (rType == Interface6::static_type())
+ return css::uno::Any( &p6, rType );
+ else if (rType == Interface7::static_type())
+ return css::uno::Any( &p7, rType );
+ else if (rType == Interface8::static_type())
+ return css::uno::Any( &p8, rType );
+ else if (rType == Interface9::static_type())
+ return css::uno::Any( &p9, rType );
+ else if (rType == Interface10::static_type())
+ return css::uno::Any( &p10, rType );
+ else if (rType == Interface11::static_type())
+ return css::uno::Any( &p11, rType );
+ else
+ return css::uno::Any();
+}
+/** Compares demanded type to given template argument types.
+
+ @tparam Interface1 interface type
+ @tparam Interface2 interface type
+ @tparam Interface3 interface type
+ @tparam Interface4 interface type
+ @tparam Interface5 interface type
+ @tparam Interface6 interface type
+ @tparam Interface7 interface type
+ @tparam Interface8 interface type
+ @tparam Interface9 interface type
+ @tparam Interface10 interface type
+ @tparam Interface11 interface type
+ @tparam Interface12 interface type
+ @param rType demanded type
+ @param p1 interface pointer
+ @param p2 interface pointer
+ @param p3 interface pointer
+ @param p4 interface pointer
+ @param p5 interface pointer
+ @param p6 interface pointer
+ @param p7 interface pointer
+ @param p8 interface pointer
+ @param p9 interface pointer
+ @param p10 interface pointer
+ @param p11 interface pointer
+ @param p12 interface pointer
+ @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
+ class Interface11, class Interface12 >
+inline css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
+ Interface11 * p11, Interface12 * p12 )
+{
+ if (rType == Interface1::static_type())
+ return css::uno::Any( &p1, rType );
+ else if (rType == Interface2::static_type())
+ return css::uno::Any( &p2, rType );
+ else if (rType == Interface3::static_type())
+ return css::uno::Any( &p3, rType );
+ else if (rType == Interface4::static_type())
+ return css::uno::Any( &p4, rType );
+ else if (rType == Interface5::static_type())
+ return css::uno::Any( &p5, rType );
+ else if (rType == Interface6::static_type())
+ return css::uno::Any( &p6, rType );
+ else if (rType == Interface7::static_type())
+ return css::uno::Any( &p7, rType );
+ else if (rType == Interface8::static_type())
+ return css::uno::Any( &p8, rType );
+ else if (rType == Interface9::static_type())
+ return css::uno::Any( &p9, rType );
+ else if (rType == Interface10::static_type())
+ return css::uno::Any( &p10, rType );
+ else if (rType == Interface11::static_type())
+ return css::uno::Any( &p11, rType );
+ else if (rType == Interface12::static_type())
+ return css::uno::Any( &p12, rType );
+ else
+ return css::uno::Any();
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/shlib.hxx b/include/cppuhelper/shlib.hxx
new file mode 100644
index 000000000..07caef0ea
--- /dev/null
+++ b/include/cppuhelper/shlib.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_SHLIB_HXX
+#define INCLUDED_CPPUHELPER_SHLIB_HXX
+
+#include "cppuhelper/cppuhelperdllapi.h"
+#include "com/sun/star/uno/Reference.h"
+#include "rtl/ustring.hxx"
+
+namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } }
+namespace com { namespace sun { namespace star { namespace registry { class XRegistryKey; } } } }
+namespace com { namespace sun { namespace star { namespace uno { class XInterface; } } } }
+
+namespace cppu
+{
+
+/** Loads a shared library component and gets the factory out of it. You can give either a
+ fully qualified libname or single lib name. The libname need not be pre/postfixed
+ (e.g. xxx.dll).
+
+ @deprecated
+ This should never have been put into the URE interface. Do not call it from
+ client code.
+
+ @param uri URI of the library
+ @param rPath deprecated, must be empty
+ @param rImplName implementation to be retrieved from the library
+ @param xMgr service manager to be provided to the component
+ @param xKey deprecated, must be null
+ @return
+ factory instance (css::lang::XSingleComponentFactory or legacy
+ css::lang::XSingleServiceFactory)
+*/
+CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface >
+SAL_CALL loadSharedLibComponentFactory(
+ ::rtl::OUString const & uri,
+ ::rtl::OUString const & rPath,
+ ::rtl::OUString const & rImplName,
+ css::uno::Reference< css::lang::XMultiServiceFactory > const & xMgr,
+ css::uno::Reference< css::registry::XRegistryKey > const & xKey );
+
+/** Invokes component_writeInfo() function of specified component library. You can give either
+ a fully qualified libname or single lib name. The libname need not be pre/postfixed
+ (e.g. xxx.dll).
+
+ @deprecated
+ This should never have been put into the URE interface. Do not call it from
+ client code. Also, this functionality is not needed for passively
+ registered components, only for actively registered legacy ones.
+
+ @param uri URI of the library
+ @param rPath deprecated, must be empty
+ @param xMgr service manager to be provided to the component
+ @param xKey registry key to be provided to the component
+*/
+CPPUHELPER_DLLPUBLIC void
+SAL_CALL writeSharedLibComponentInfo(
+ ::rtl::OUString const & uri,
+ ::rtl::OUString const & rPath,
+ css::uno::Reference< css::lang::XMultiServiceFactory > const & xMgr,
+ css::uno::Reference< css::registry::XRegistryKey > const & xKey );
+
+} // end namespace cppu
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/supportsservice.hxx b/include/cppuhelper/supportsservice.hxx
new file mode 100644
index 000000000..8834a3181
--- /dev/null
+++ b/include/cppuhelper/supportsservice.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPUHELPER_SUPPORTSSERVICE_HXX
+#define INCLUDED_CPPUHELPER_SUPPORTSSERVICE_HXX
+
+#include "sal/config.h"
+
+#include "cppuhelper/cppuhelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XServiceInfo;
+} } } }
+namespace rtl { class OUString; }
+
+namespace cppu {
+
+/** A helper for implementations of com.sun.star.lang.XServiceInfo.
+
+ This function is supposed to be called from implementations of
+ css::lang::XServiceInfo::supportsService (and therefore, for
+ easier coding takes the caller's this pointer by pointer rather than by
+ css::uno::Reference).
+
+ @param implementation points to the service implementation whose
+ getSupportedServices method is consulted; must be non-null
+
+ @param name the service name to test
+
+ @return true iff the sequence returned by the given implementation's
+ getSupportedServices method contains the given name
+
+ @since LibreOffice 4.0
+*/
+bool CPPUHELPER_DLLPUBLIC supportsService(
+ css::lang::XServiceInfo * implementation,
+ rtl::OUString const & name);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/typeprovider.hxx b/include/cppuhelper/typeprovider.hxx
new file mode 100644
index 000000000..4c3bd99d1
--- /dev/null
+++ b/include/cppuhelper/typeprovider.hxx
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_TYPEPROVIDER_HXX
+#define INCLUDED_CPPUHELPER_TYPEPROVIDER_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "rtl/alloc.h"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "cppuhelper/cppuhelperdllapi.h"
+
+
+namespace cppu
+{
+
+/** Helper class to implement css::lang::XTypeProvider. Construct a static object
+ of this class with your UNO object's supported types.
+*/
+class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC OTypeCollection
+{
+ css::uno::Sequence< css::uno::Type > _aTypes;
+
+public:
+ /// @cond INTERNAL
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete( void *, void * )
+ {}
+ /// @endcond
+
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Type & rType2,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Type & rType2,
+ const css::uno::Type & rType3,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Type & rType2,
+ const css::uno::Type & rType3,
+ const css::uno::Type & rType4,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Type & rType2,
+ const css::uno::Type & rType3,
+ const css::uno::Type & rType4,
+ const css::uno::Type & rType5,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Type & rType2,
+ const css::uno::Type & rType3,
+ const css::uno::Type & rType4,
+ const css::uno::Type & rType5,
+ const css::uno::Type & rType6,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Type & rType2,
+ const css::uno::Type & rType3,
+ const css::uno::Type & rType4,
+ const css::uno::Type & rType5,
+ const css::uno::Type & rType6,
+ const css::uno::Type & rType7,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Type & rType2,
+ const css::uno::Type & rType3,
+ const css::uno::Type & rType4,
+ const css::uno::Type & rType5,
+ const css::uno::Type & rType6,
+ const css::uno::Type & rType7,
+ const css::uno::Type & rType8,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Type & rType2,
+ const css::uno::Type & rType3,
+ const css::uno::Type & rType4,
+ const css::uno::Type & rType5,
+ const css::uno::Type & rType6,
+ const css::uno::Type & rType7,
+ const css::uno::Type & rType8,
+ const css::uno::Type & rType9,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Type & rType2,
+ const css::uno::Type & rType3,
+ const css::uno::Type & rType4,
+ const css::uno::Type & rType5,
+ const css::uno::Type & rType6,
+ const css::uno::Type & rType7,
+ const css::uno::Type & rType8,
+ const css::uno::Type & rType9,
+ const css::uno::Type & rType10,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Type & rType2,
+ const css::uno::Type & rType3,
+ const css::uno::Type & rType4,
+ const css::uno::Type & rType5,
+ const css::uno::Type & rType6,
+ const css::uno::Type & rType7,
+ const css::uno::Type & rType8,
+ const css::uno::Type & rType9,
+ const css::uno::Type & rType10,
+ const css::uno::Type & rType11,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+ OTypeCollection(
+ const css::uno::Type & rType1,
+ const css::uno::Type & rType2,
+ const css::uno::Type & rType3,
+ const css::uno::Type & rType4,
+ const css::uno::Type & rType5,
+ const css::uno::Type & rType6,
+ const css::uno::Type & rType7,
+ const css::uno::Type & rType8,
+ const css::uno::Type & rType9,
+ const css::uno::Type & rType10,
+ const css::uno::Type & rType11,
+ const css::uno::Type & rType12,
+ const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() );
+
+ /** Called upon XTypeProvider::getTypes().
+
+ @return type collection
+ */
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
+ { return _aTypes; }
+#if defined LIBO_INTERNAL_ONLY
+ css::uno::Sequence< css::uno::Type > const & getTypes() const
+ { return _aTypes; }
+#endif
+};
+
+/** Helper class to implement IDs for XUnoTunnel. Construct a static object
+ of this class for your UNO object's implementation id.
+*/
+class SAL_DEPRECATED("Uses broken double checked locking") SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC OImplementationId
+{
+ mutable css::uno::Sequence< sal_Int8 > * _pSeq;
+ sal_Bool _bUseEthernetAddress;
+
+public:
+ /// @cond INTERNAL
+
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete( void *, void * )
+ {}
+
+ ~OImplementationId();
+
+ /// @endcond
+
+ /** Constructor.
+
+ @param bUseEthernetAddress whether an ethernet mac address should be taken into account
+ */
+ OImplementationId( bool bUseEthernetAddress = true )
+ : _pSeq( NULL )
+ , _bUseEthernetAddress( bUseEthernetAddress )
+ {}
+ /** Constructor giving implementation id.
+
+ @param rSeq implementation id
+ */
+ OImplementationId( const css::uno::Sequence< sal_Int8 > & rSeq )
+ : _pSeq( new css::uno::Sequence< sal_Int8 >( rSeq ) )
+ , _bUseEthernetAddress( false )
+ {}
+SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ OImplementationId( const OImplementationId & rId )
+ : _pSeq( new css::uno::Sequence< sal_Int8 >( rId.getImplementationId() ) )
+ , _bUseEthernetAddress( false )
+ {}
+SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ /** Get implementation id.
+
+ @return implementation id
+ */
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() const;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/unourl.hxx b/include/cppuhelper/unourl.hxx
new file mode 100644
index 000000000..45afaedad
--- /dev/null
+++ b/include/cppuhelper/unourl.hxx
@@ -0,0 +1,188 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_CPPUHELPER_UNOURL_HXX
+#define INCLUDED_CPPUHELPER_UNOURL_HXX
+
+#include "sal/config.h"
+
+#include "cppuhelper/cppuhelperdllapi.h"
+
+namespace rtl
+{
+class OUString;
+}
+
+namespace cppu
+{
+/** A descriptor as part of a UNO URL (connection descriptor or protocol
+ descriptor).
+
+ Such a descriptor can also be useful outside the context of a full UNO URL.
+ For example, some functions take a string representing a connection or
+ protocol descriptor as input, and can use this class to parse the string.
+ */
+class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC UnoUrlDescriptor
+{
+public:
+ class Impl;
+
+ /** Construct a descriptor from a string representation.
+
+ @param rDescriptor
+ The string representation of a descriptor.
+
+ @exception rtl::MalformedUriException
+ Thrown when the given string representation is invalid.
+ */
+ explicit UnoUrlDescriptor(rtl::OUString const& rDescriptor);
+
+ UnoUrlDescriptor(UnoUrlDescriptor const& rOther);
+
+ ~UnoUrlDescriptor();
+
+ UnoUrlDescriptor& operator=(UnoUrlDescriptor const& rOther);
+
+ /** Return the string representation of the descriptor.
+
+ @return
+ A reference to the string representation used to construct this
+ descriptor, without any modifications. The reference is valid for the
+ lifetime of this URL object.
+ */
+ rtl::OUString const& getDescriptor() const;
+
+ /** Return the name component of the descriptor.
+
+ @return
+ A reference to the (case insensitive) name, in lower case form. The
+ reference is valid for the lifetime of this URL object.
+ */
+ rtl::OUString const& getName() const;
+
+ /** Test whether the parameters contain a key.
+
+ @param
+ rKey A (case insensitive) key.
+
+ @return
+ True if the parameters contain a matching key/value pair.
+ */
+ bool hasParameter(rtl::OUString const& rKey) const;
+
+ /** Return the parameter value for a key.
+
+ @param
+ rKey A (case insensitive) key.
+
+ @return
+ The (case sensitive) value associated with the given key, or an empty
+ string if there is no matching key/value pair.
+ */
+ rtl::OUString getParameter(rtl::OUString const& rKey) const;
+
+private:
+ Impl* m_pImpl;
+};
+
+/** Parse UNO URLs into their components.
+
+ The ABNF for UNO URLs is as follows (see RFCs 2234, 2396, also see
+ <http://udk.openoffice.org/common/man/spec/uno-url.html>):
+
+ uno-url = "UNO:" connection ";" protocol ";" object-name
+ connection = descriptor
+ protocol = descriptor
+ descriptor = name *("," parameter)
+ name = 1*alphanum
+ parameter = key "=" value
+ key = 1*alphanum
+ value = *vchar
+ valchar = unreserved / escaped / "$" / "&" / "+" / "/" / ":" / "?" / "@"
+ object-name = 1*ochar
+ ochar = unreserved / "$" / "&" / "+" / "," / "/" / ":" / "=" / "?" / "@"
+
+ Within a descriptor, the name and the keys are case insensitive, and within
+ the parameter list all keys must be distinct.
+
+ Parameter values are encoded using UTF-8. Note that parsing of parameter
+ values as done by UnoUrl and UnoUrlDescriptor is not strict: Invalid UTF-16
+ entities in the input, as well as broken escape sequences ("%" not followed
+ by two hex digits) are copied verbatim to the output, invalid bytes in the
+ converted UTF-8 data are considered individual Unicode characters, and
+ invalid UTF-16 entities in the resulting output (e.g., a high surrogate not
+ followed by a low surrogate) are not detected.
+ */
+class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC UnoUrl
+{
+public:
+ /** Construct a UNO URL from a string representation.
+
+ @param rUrl
+ The string representation of a UNO URL.
+
+ @exception rtl::MalformedUriException
+ Thrown when the given string representation is invalid.
+ */
+ explicit UnoUrl(rtl::OUString const& rUrl);
+
+ UnoUrl(UnoUrl const& rOther);
+
+ ~UnoUrl();
+
+ UnoUrl& operator=(UnoUrl const& rOther);
+
+ /** Return the connection descriptor component of the URL.
+
+ @return
+ A reference to the connection descriptor. The reference is valid for
+ the lifetime of this URL object.
+ */
+ UnoUrlDescriptor const& getConnection() const;
+
+ /** Return the protocol descriptor component of the URL.
+
+ @return
+ A reference to the protocol descriptor. The reference is valid for the
+ lifetime of this URL object.
+ */
+ UnoUrlDescriptor const& getProtocol() const;
+
+ /** Return the object-name component of the URL.
+
+ @return
+ A reference to the (case sensitive) object-name. The reference is valid
+ for the lifetime of this URL object.
+ */
+ rtl::OUString const& getObjectName() const;
+
+private:
+ class Impl;
+
+ Impl* m_pImpl;
+};
+}
+
+#endif // INCLUDED_RTL_UNOURL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/weak.hxx b/include/cppuhelper/weak.hxx
new file mode 100644
index 000000000..b8e4e9955
--- /dev/null
+++ b/include/cppuhelper/weak.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_WEAK_HXX
+#define INCLUDED_CPPUHELPER_WEAK_HXX
+
+#include <cassert>
+#include <cstddef>
+#include "osl/interlck.h"
+#include "rtl/alloc.h"
+#include "com/sun/star/uno/XWeak.hpp"
+#include "cppuhelper/cppuhelperdllapi.h"
+
+
+namespace cppu
+{
+
+class OWeakConnectionPoint;
+
+/** Base class to implement a UNO object supporting weak references, i.e. the object can be held
+ weakly (by a css::uno::WeakReference).
+ This implementation copes with reference counting. Upon last release(), the virtual dtor
+ is called.
+
+ @derive
+ Inherit from this class and delegate acquire()/ release() calls.
+*/
+class CPPUHELPER_DLLPUBLIC OWeakObject : public css::uno::XWeak
+{
+ friend class OWeakConnectionPoint;
+
+protected:
+ /** Virtual dtor.
+
+ @attention
+ Despite the fact that a RuntimeException is allowed to be thrown, you must not throw any
+ exception upon destruction!
+ */
+ virtual ~OWeakObject() COVERITY_NOEXCEPT_FALSE;
+
+ /** disposes and resets m_pWeakConnectionPoint
+ @pre
+ m_refCount equals 0
+ */
+ void disposeWeakConnectionPoint();
+
+ /** reference count.
+
+ @attention
+ Don't modify manually! Use acquire() and release().
+ */
+ oslInterlockedCount m_refCount;
+
+ /// @cond INTERNAL
+
+ /** Container of all weak reference listeners and the connection point from the weak reference.
+ */
+ OWeakConnectionPoint * m_pWeakConnectionPoint;
+
+ /** reserved for future use. do not use.
+ */
+ void * m_pReserved;
+
+ /// @endcond
+
+public:
+ /// @cond INTERNAL
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete( void *, void * )
+ {}
+ /// @endcond
+
+ /** Default Constructor. Sets the reference count to zero.
+ */
+ OWeakObject()
+ : m_refCount( 0 )
+ , m_pWeakConnectionPoint( NULL )
+ , m_pReserved(NULL)
+ {}
+
+ /** Dummy copy constructor. Set the reference count to zero.
+ */
+ OWeakObject( const OWeakObject & )
+ : css::uno::XWeak()
+ , m_refCount( 0 )
+ , m_pWeakConnectionPoint( NULL )
+ , m_pReserved(NULL)
+ {}
+ /** Dummy assignment operator. Does not affect reference count.
+
+ @return this OWeakObject
+ */
+ OWeakObject & SAL_CALL operator = ( const OWeakObject &)
+ { return *this; }
+
+ /** Basic queryInterface() implementation supporting com::sun::star::uno::XWeak and
+ com::sun::star::uno::XInterface.
+
+ @param rType demanded type
+ @return demanded type or empty any
+ */
+ virtual css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type & rType ) SAL_OVERRIDE;
+ /** increasing m_refCount
+ */
+ virtual void SAL_CALL acquire()
+ SAL_NOEXCEPT SAL_OVERRIDE;
+ /** decreasing m_refCount
+ */
+ virtual void SAL_CALL release()
+ SAL_NOEXCEPT SAL_OVERRIDE;
+
+ /** XWeak::queryAdapter() implementation
+
+ @return a com::sun::star::uno::XAdapter reference
+ */
+ virtual css::uno::Reference< css::uno::XAdapter > SAL_CALL queryAdapter() SAL_OVERRIDE;
+
+ /** Cast operator to XInterface reference.
+
+ @return XInterface reference
+ */
+ SAL_CALL operator css::uno::Reference< css::uno::XInterface > ()
+ { return this; }
+};
+
+/// @cond INTERNAL
+/** Convenience function for constructor-based service implementations.
+
+ To be used like:
+
+ css::uno::XInterface * FOO_constructor_function(...) {
+ return cppu::acquire(new FOO(...));
+ }
+
+ @param instance
+ Newly created instance that should be acquired.
+*/
+static inline css::uno::XInterface * acquire(OWeakObject * instance)
+{
+ assert(instance != NULL);
+ instance->acquire();
+ return instance;
+}
+/// @endcond
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/weakagg.hxx b/include/cppuhelper/weakagg.hxx
new file mode 100644
index 000000000..0b770a428
--- /dev/null
+++ b/include/cppuhelper/weakagg.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_WEAKAGG_HXX
+#define INCLUDED_CPPUHELPER_WEAKAGG_HXX
+
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakref.hxx"
+#include "com/sun/star/uno/XAggregation.hpp"
+#include "cppuhelper/cppuhelperdllapi.h"
+
+
+namespace cppu
+{
+
+/** Base class to implement a UNO object supporting weak references, i.e. the object can be held
+ weakly (by a css::uno::WeakReference) and aggregation, i.e. the object can be
+ aggregated by another (delegator).
+ This implementation copes with reference counting. Upon last release(), the virtual dtor
+ is called.
+
+ @derive
+ Inherit from this class and delegate acquire()/ release() calls. Re-implement
+ XAggregation::queryInterface().
+*/
+class CPPUHELPER_DLLPUBLIC OWeakAggObject
+ : public ::cppu::OWeakObject
+ , public css::uno::XAggregation
+{
+public:
+ /** Constructor. No delegator set.
+ */
+ OWeakAggObject()
+ {}
+
+ /** If a delegator is set, then the delegators gets acquired. Otherwise call is delegated to
+ base class ::cppu::OWeakObject.
+ */
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE;
+ /** If a delegator is set, then the delegators gets released. Otherwise call is delegated to
+ base class ::cppu::OWeakObject.
+ */
+ virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE;
+ /** If a delegator is set, then the delegator is queried for the demanded interface. If the
+ delegator cannot provide the demanded interface, it calls queryAggregation() on its
+ aggregated objects.
+
+ @param rType demanded interface type
+ @return demanded type or empty any
+ @see queryAggregation.
+ */
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) SAL_OVERRIDE;
+
+ /** Set the delegator. The delegator member reference is a weak reference.
+
+ @param Delegator the object that delegate its queryInterface to this aggregate.
+ */
+ virtual void SAL_CALL setDelegator( const css::uno::Reference< css::uno::XInterface > & Delegator ) SAL_OVERRIDE;
+ /** Called by the delegator or queryInterface. Re-implement this method instead of
+ queryInterface.
+
+ @see queryInterface
+ */
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) SAL_OVERRIDE;
+
+protected:
+ /** Virtual dtor. Called when reference count is 0.
+
+ @attention
+ Despite the fact that a RuntimeException is allowed to be thrown, you must not throw any
+ exception upon destruction!
+ */
+ virtual ~OWeakAggObject() SAL_OVERRIDE;
+
+ /** weak reference to delegator.
+ */
+ css::uno::WeakReferenceHelper xDelegator;
+private:
+ OWeakAggObject( const OWeakAggObject & rObj ) SAL_DELETED_FUNCTION;
+ OWeakAggObject & operator = ( const OWeakAggObject & rObj )
+ SAL_DELETED_FUNCTION;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppuhelper/weakref.hxx b/include/cppuhelper/weakref.hxx
new file mode 100644
index 000000000..a5858b2e8
--- /dev/null
+++ b/include/cppuhelper/weakref.hxx
@@ -0,0 +1,228 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_CPPUHELPER_WEAKREF_HXX
+#define INCLUDED_CPPUHELPER_WEAKREF_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "cppuhelper/cppuhelperdllapi.h"
+
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+class OWeakRefListener;
+class XWeak;
+
+/** The WeakReferenceHelper holds a weak reference to an object.
+
+ That object must implement the css::uno::XWeak interface.
+
+ The WeakReferenceHelper itself is *not* thread safe, just as
+ Reference itself isn't, but the implementation of the listeners etc.
+ behind it *is* thread-safe, so multiple threads can have their own
+ WeakReferences to the same XWeak object.
+*/
+class CPPUHELPER_DLLPUBLIC WeakReferenceHelper
+{
+public:
+ /** Default ctor. Creates an empty weak reference.
+ */
+ WeakReferenceHelper()
+ : m_pImpl( NULL )
+ {}
+
+ /** Copy ctor. Initialize this reference with the same interface as in rWeakRef.
+
+ @param rWeakRef another weak ref
+ */
+ WeakReferenceHelper( const WeakReferenceHelper & rWeakRef );
+
+#if defined LIBO_INTERNAL_ONLY
+ WeakReferenceHelper(WeakReferenceHelper && other) noexcept : m_pImpl(other.m_pImpl)
+ { other.m_pImpl = nullptr; }
+#endif
+
+ /** Initialize this reference with the hard interface reference xInt. If the implementation
+ behind xInt does not support XWeak or xInt is null then this reference will be null.
+
+ @param xInt another hard interface reference
+ */
+ WeakReferenceHelper( const css::uno::Reference< css::uno::XInterface > & xInt );
+
+#if defined LIBO_INTERNAL_ONLY
+ /** Initialize this reference with the hard interface reference xWeak. This
+ is faster than the XInterface constructor because we can skip doing an
+ UNO_QUERY.
+
+ @param xWeak another hard interface reference
+ */
+ WeakReferenceHelper( const css::uno::Reference< css::uno::XWeak > & xWeak );
+#endif
+
+ /** Releases this reference.
+ */
+ ~WeakReferenceHelper();
+
+ /** Releases this reference and takes over rWeakRef.
+
+ @param rWeakRef another weak ref
+ */
+ WeakReferenceHelper & SAL_CALL operator = ( const WeakReferenceHelper & rWeakRef );
+
+#if defined LIBO_INTERNAL_ONLY
+ WeakReferenceHelper & operator =(WeakReferenceHelper && other);
+#endif
+
+ /** Releases this reference and takes over hard reference xInt.
+ If the implementation behind xInt does not support XWeak
+ or XInt is null, then this reference is null.
+
+ @param xInt another hard reference
+ */
+ WeakReferenceHelper & SAL_CALL operator = (
+ const css::uno::Reference< css::uno::XInterface > & xInt );
+
+#if defined LIBO_INTERNAL_ONLY
+ /** Releases this reference and takes over hard reference xWeak. This
+ is faster than the XInterface constructor because we can skip doing an
+ UNO_QUERY.
+
+ @param xWeak another hard reference
+ */
+ WeakReferenceHelper & operator = (
+ const css::uno::Reference< css::uno::XWeak > & xWeak );
+#endif
+
+ /** Returns true if both weak refs reference to the same object.
+
+ @param rObj another weak ref
+ @return true, if both weak refs reference to the same object.
+ */
+ bool SAL_CALL operator == ( const WeakReferenceHelper & rObj ) const
+ { return (get() == rObj.get()); }
+
+ /** Gets a hard reference to the object.
+
+ @return hard reference or null, if the weakly referenced interface has gone
+ */
+ css::uno::Reference< css::uno::XInterface > SAL_CALL get() const;
+
+ /** Gets a hard reference to the object.
+
+ @return hard reference or null, if the weakly referenced interface has gone
+ */
+ SAL_CALL operator Reference< XInterface > () const
+ { return get(); }
+
+ /** Releases this reference.
+
+ @since UDK 3.2.12
+ */
+ void SAL_CALL clear();
+
+protected:
+ /// @cond INTERNAL
+ OWeakRefListener * m_pImpl;
+ /// @endcond
+};
+
+/** The WeakReference<> holds a weak reference to an object.
+
+ That object must implement the css::uno::XWeak interface.
+
+ The WeakReference itself is *not* thread safe, just as
+ Reference itself isn't, but the implementation of the listeners etc.
+ behind it *is* thread-safe, so multiple threads can have their own
+ WeakReferences to the same XWeak object.
+
+ @tparam interface_type type of interface
+*/
+template< class interface_type >
+class SAL_WARN_UNUSED WeakReference : public WeakReferenceHelper
+{
+public:
+ /** Default ctor. Creates an empty weak reference.
+ */
+ WeakReference()
+ : WeakReferenceHelper()
+ {}
+
+ /** Copy ctor. Initialize this reference with a hard reference.
+
+ @param rRef another hard ref
+ */
+ WeakReference( const Reference< interface_type > & rRef )
+ : WeakReferenceHelper( rRef )
+ {}
+
+ /** Releases this reference and takes over hard reference xInt.
+ If the implementation behind xInt does not support XWeak
+ or XInt is null, then this reference is null.
+
+ @param xInt another hard reference
+
+ @since UDK 3.2.12
+ */
+ WeakReference & SAL_CALL operator = (
+ const css::uno::Reference< interface_type > & xInt )
+ { WeakReferenceHelper::operator=(xInt); return *this; }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** Releases this reference and takes over hard reference xWeak. This
+ is faster than the XInterface constructor because we can skip doing an
+ UNO_QUERY.
+
+ @param xWeak another hard reference
+ */
+ WeakReference & operator = (
+ const css::uno::Reference< css::uno::XWeak > & xWeak )
+ { WeakReferenceHelper::operator=(xWeak); return *this; }
+#endif
+
+ /** Gets a hard reference to the object.
+
+ @return hard reference or null, if the weakly referenced interface has gone
+ */
+ SAL_CALL operator Reference< interface_type > () const
+ { return Reference< interface_type >::query( get() ); }
+};
+
+}
+}
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppunittester/protectorfactory.hxx b/include/cppunittester/protectorfactory.hxx
new file mode 100644
index 000000000..6617dbb47
--- /dev/null
+++ b/include/cppunittester/protectorfactory.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CPPUNITTESTER_PROTECTORFACTORY_HXX
+#define INCLUDED_CPPUNITTESTER_PROTECTORFACTORY_HXX
+
+#include <sal/types.h>
+#include <cppunit/Protector.h>
+
+namespace cppunittester
+{
+ // The type of CppUnit::Protector factory functions that can be plugged into
+ // cppunittester:
+ extern "C" typedef CppUnit::Protector * ProtectorFactory();
+}
+
+#ifdef DISABLE_DYNLOADING
+extern "C" CppUnit::Protector *unoexceptionprotector();
+extern "C" CppUnit::Protector *unobootstrapprotector();
+extern "C" CppUnit::Protector *vclbootstrapprotector();
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cui/cuicharmap.hxx b/include/cui/cuicharmap.hxx
new file mode 100644
index 000000000..688fb570e
--- /dev/null
+++ b/include/cui/cuicharmap.hxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CUI_CUICHARMAP_HXX
+#define INCLUDED_CUI_CUICHARMAP_HXX
+
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
+#include <vcl/virdev.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svl/itemset.hxx>
+#include <svx/charmap.hxx>
+#include <svx/searchcharmap.hxx>
+#include <svx/ucsubset.hxx>
+#include <sfx2/charwin.hxx>
+#include <cui/cuidllapi.h>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <deque>
+#include <memory>
+#include <utility>
+
+using namespace ::com::sun::star;
+class SubsetMap;
+
+#define CHARMAP_MAXLEN 32
+
+namespace svx
+{
+struct SvxShowCharSetItem;
+}
+
+/// Provides the show characters or texts in a drawing area with special sizes and fonts.
+class CUI_DLLPUBLIC SvxShowText final : public weld::CustomWidgetController
+{
+private:
+ ScopedVclPtr<VirtualDevice> m_xVirDev;
+ OUString m_sText;
+ tools::Long mnY;
+ bool mbCenter;
+ vcl::Font m_aFont;
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
+ virtual void Resize() override;
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+
+public:
+ SvxShowText(const VclPtr<VirtualDevice>& rVirDev);
+
+ void SetFont(const vcl::Font& rFont);
+ vcl::Font const& GetFont() const { return m_aFont; }
+ void SetText(const OUString& rText);
+ OUString const& GetText() const { return m_sText; }
+ void SetCentered(bool bCenter) { mbCenter = bCenter; }
+
+ Size get_preferred_size() const { return GetDrawingArea()->get_preferred_size(); }
+};
+
+/** The main purpose of this dialog is to enable the use of characters
+ that are not easily accessible from the keyboard. */
+class CUI_DLLPUBLIC SvxCharacterMap final : public SfxDialogController
+{
+private:
+ void init();
+
+ ScopedVclPtr<VirtualDevice> m_xVirDev;
+ vcl::Font aFont;
+ std::unique_ptr<const SubsetMap> pSubsetMap;
+ bool isSearchMode;
+ css::uno::Reference<css::frame::XFrame> m_xFrame;
+ std::deque<OUString> maRecentCharList;
+ std::deque<OUString> maRecentCharFontList;
+ std::deque<OUString> maFavCharList;
+ std::deque<OUString> maFavCharFontList;
+
+ SvxCharView m_aRecentCharView[16];
+ SvxCharView m_aFavCharView[16];
+ SvxShowText m_aShowChar;
+
+ std::unique_ptr<weld::Button> m_xOKBtn;
+ std::unique_ptr<weld::Label> m_xFontText;
+ std::unique_ptr<weld::ComboBox> m_xFontLB;
+ std::unique_ptr<weld::Label> m_xSubsetText;
+ std::unique_ptr<weld::ComboBox> m_xSubsetLB;
+ std::unique_ptr<weld::Entry> m_xSearchText;
+ std::unique_ptr<weld::Entry> m_xHexCodeText;
+ std::unique_ptr<weld::Entry> m_xDecimalCodeText;
+ std::unique_ptr<weld::Button> m_xFavouritesBtn;
+ std::unique_ptr<weld::Label> m_xCharName;
+ std::unique_ptr<weld::Widget> m_xRecentGrid;
+ std::unique_ptr<weld::Widget> m_xFavGrid;
+ std::unique_ptr<weld::CustomWeld> m_xShowChar;
+ std::unique_ptr<weld::CustomWeld> m_xRecentCharView[16];
+ std::unique_ptr<weld::CustomWeld> m_xFavCharView[16];
+ std::unique_ptr<SvxShowCharSet> m_xShowSet;
+ std::unique_ptr<weld::CustomWeld> m_xShowSetArea;
+ std::unique_ptr<SvxSearchCharSet> m_xSearchSet;
+ std::unique_ptr<weld::CustomWeld> m_xSearchSetArea;
+
+ std::unique_ptr<SfxAllItemSet> m_xOutputSet;
+
+ enum class Radix : sal_Int16
+ {
+ decimal = 10,
+ hexadecimal = 16
+ };
+
+ DECL_DLLPRIVATE_LINK(FontSelectHdl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(SubsetSelectHdl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(CharDoubleClickHdl, SvxShowCharSet*, void);
+ DECL_DLLPRIVATE_LINK(CharSelectHdl, SvxShowCharSet*, void);
+ DECL_DLLPRIVATE_LINK(CharHighlightHdl, SvxShowCharSet*, void);
+ DECL_DLLPRIVATE_LINK(CharPreSelectHdl, SvxShowCharSet*, void);
+ DECL_DLLPRIVATE_LINK(FavClickHdl, SvxShowCharSet*, void);
+ DECL_DLLPRIVATE_LINK(SearchCharDoubleClickHdl, SvxShowCharSet*, void);
+ DECL_DLLPRIVATE_LINK(SearchCharSelectHdl, SvxShowCharSet*, void);
+ DECL_DLLPRIVATE_LINK(SearchCharHighlightHdl, SvxShowCharSet*, void);
+ DECL_DLLPRIVATE_LINK(SearchCharPreSelectHdl, SvxShowCharSet*, void);
+ DECL_DLLPRIVATE_LINK(DecimalCodeChangeHdl, weld::Entry&, void);
+ DECL_DLLPRIVATE_LINK(HexCodeChangeHdl, weld::Entry&, void);
+ DECL_DLLPRIVATE_LINK(CharClickHdl, SvxCharView*, void);
+ DECL_DLLPRIVATE_LINK(RecentClearClickHdl, SvxCharView*, void);
+ DECL_DLLPRIVATE_LINK(FavClearClickHdl, SvxCharView*, void);
+ DECL_DLLPRIVATE_LINK(RecentClearAllClickHdl, SvxCharView*, void);
+ DECL_DLLPRIVATE_LINK(FavClearAllClickHdl, SvxCharView*, void);
+ DECL_DLLPRIVATE_LINK(InsertClickHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(FavSelectHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(SearchUpdateHdl, weld::Entry&, void);
+ DECL_DLLPRIVATE_LINK(SearchFieldGetFocusHdl, weld::Widget&, void);
+
+ static void fillAllSubsets(weld::ComboBox& rListBox);
+ void selectCharByCode(Radix radix);
+
+public:
+ SvxCharacterMap(weld::Widget* pParent, const SfxItemSet* pSet,
+ css::uno::Reference<css::frame::XFrame> xFrame);
+ virtual short run() override;
+
+ void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
+
+ const SfxItemSet* GetOutputItemSet() const { return m_xOutputSet.get(); }
+
+ void DisableFontSelection();
+
+ const vcl::Font& GetCharFont() const { return aFont; }
+ void SetCharFont(const vcl::Font& rFont);
+
+ void SetChar(sal_UCS4);
+ sal_UCS4 GetChar() const;
+
+ void getRecentCharacterList(); //gets both recent char and recent char font list
+ void updateRecentCharacterList(const OUString& rChar, const OUString& rFont);
+
+ void getFavCharacterList(); //gets both Fav char and Fav char font list
+ void updateFavCharacterList(const OUString& rChar, const OUString& rFont);
+ void deleteFavCharacterFromList(std::u16string_view rChar, std::u16string_view rFont);
+ bool isFavChar(std::u16string_view sTitle, std::u16string_view rFont);
+
+ void updateRecentCharControl();
+ void insertCharToDoc(const OUString& sChar);
+
+ void updateFavCharControl();
+ void setFavButtonState(std::u16string_view sTitle, std::u16string_view rFont);
+
+ void setCharName(sal_UCS4 nDecimalValue);
+
+ void toggleSearchView(bool state);
+
+private:
+ std::pair<std::deque<OUString>::const_iterator, std::deque<OUString>::const_iterator>
+ getRecentChar(std::u16string_view sTitle, std::u16string_view rFont) const;
+
+ std::pair<std::deque<OUString>::const_iterator, std::deque<OUString>::const_iterator>
+ getFavChar(std::u16string_view sTitle, std::u16string_view rFont) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cui/cuidllapi.h b/include/cui/cuidllapi.h
new file mode 100644
index 000000000..12277c602
--- /dev/null
+++ b/include/cui/cuidllapi.h
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_CUI_CUIDLLAPI_H
+#define INCLUDED_CUI_CUIDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(CUI_DLLIMPLEMENTATION)
+#define CUI_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define CUI_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif // INCLUDED_CUI_CUIDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cui/numberingpreview.hxx b/include/cui/numberingpreview.hxx
new file mode 100644
index 000000000..8a7883522
--- /dev/null
+++ b/include/cui/numberingpreview.hxx
@@ -0,0 +1,31 @@
+#ifndef INCLUDED_CUI_NUMBERINGPREVIEW_HXX
+#define INCLUDED_CUI_NUMBERINGPREVIEW_HXX
+
+#include <cui/cuidllapi.h>
+#include <editeng/numitem.hxx>
+#include <vcl/customweld.hxx>
+
+/// Provides the preview to show how looks bullet or numbering format before the apply.
+class CUI_DLLPUBLIC SvxNumberingPreview final : public weld::CustomWidgetController
+{
+ const SvxNumRule* pActNum;
+ vcl::Font aStdFont;
+ bool bPosition;
+ sal_uInt16 nActLevel;
+
+ virtual void Paint(vcl::RenderContext& rRenderContext,
+ const ::tools::Rectangle& rRect) override;
+
+public:
+ SvxNumberingPreview();
+
+ void SetNumRule(const SvxNumRule* pNum)
+ {
+ pActNum = pNum;
+ Invalidate();
+ };
+ void SetPositionMode() { bPosition = true; }
+ void SetLevel(sal_uInt16 nSet) { nActLevel = nSet; }
+};
+
+#endif
diff --git a/include/dbaccess/AsynchronousLink.hxx b/include/dbaccess/AsynchronousLink.hxx
new file mode 100644
index 000000000..0b63cbed9
--- /dev/null
+++ b/include/dbaccess/AsynchronousLink.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <osl/mutex.hxx>
+#include <tools/link.hxx>
+
+struct ImplSVEvent;
+
+namespace dbaui
+{
+
+ // a helper for multi-threaded handling of async events
+
+ /** handles asynchronous links which may be called in multi-threaded environments
+ If you use an instance of this class as member of your own class, it will handle
+ several crucial points for you (for instance the case that somebody posts the
+ event while another thread tries to delete this event in the _destructor_ of the
+ class).
+ */
+ class OAsynchronousLink final
+ {
+ Link<void*,void> m_aHandler;
+ ::osl::Mutex m_aEventSafety;
+ ::osl::Mutex m_aDestructionSafety;
+ ImplSVEvent * m_nEventId;
+ DECL_LINK(OnAsyncCall, void*, void);
+
+ public:
+ /** constructs the object
+ @param _rHandler The link to be called asynchronously
+ */
+ OAsynchronousLink( const Link<void*,void>& _rHandler );
+ ~OAsynchronousLink();
+
+ bool IsRunning() const { return m_nEventId != nullptr; }
+
+ void Call( void* _pArgument = nullptr );
+ void CancelCall();
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/dbaccess/IController.hxx b/include/dbaccess/IController.hxx
new file mode 100644
index 000000000..c7374eb80
--- /dev/null
+++ b/include/dbaccess/IController.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DBACCESS_ICONTROLLER_HXX
+#define INCLUDED_DBACCESS_ICONTROLLER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <dbaccess/dbaccessdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace beans {
+ struct PropertyValue;
+ }
+ namespace util {
+ struct URL;
+ }
+ namespace frame {
+ class XController;
+ }
+}
+
+class NotifyEvent;
+
+namespace dbaui
+{
+ // interface for controller depended calls like commands
+ class DBACCESS_DLLPUBLIC IController
+ {
+ public:
+ /** executes the given command without checking if it is allowed
+ @param _rCommand the URL of the command
+ */
+ virtual void executeUnChecked(const css::util::URL& _rCommand, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) = 0;
+
+ /** executes the given command only when it is allowed
+ @param _rCommand
+ the URL of the command
+ */
+ virtual void executeChecked(const css::util::URL& _rCommand, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) = 0;
+
+ /** executes the given command without checking if it is allowed
+ @param _nCommandId
+ the id of the command URL
+ */
+ virtual void executeUnChecked(sal_uInt16 _nCommandId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) = 0;
+
+ /** executes the given command only when it is allowed
+ @param _nCommandId
+ the id of the command URL
+ */
+ virtual void executeChecked(sal_uInt16 _nCommandId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) = 0;
+
+
+ /** checks if the given Command is enabled
+ @param _nCommandId
+ the id of the command URL
+
+ @return
+ <TRUE/> if the command is allowed, otherwise <FALSE/>.
+ */
+ virtual bool isCommandEnabled(sal_uInt16 _nCommandId) const = 0;
+
+ /** checks if the given Command is enabled
+ @param _rCompleteCommandURL
+ the URL of the command
+
+ @return
+ <TRUE/> if the command is allowed, otherwise <FALSE/>.
+ */
+ virtual bool isCommandEnabled( const OUString& _rCompleteCommandURL ) const = 0;
+
+ /** checks if the selected data source is read only
+ @return
+ <TRUE/> if read only, otherwise <FALSE/>
+ */
+ virtual bool isDataSourceReadOnly() const = 0;
+
+ /** provides access to the model of the controller
+
+ This must be the same model as returned by XController::getModel, and might be <NULL/> when
+ the controller does not have an own model.
+
+ @throws css::uno::RuntimeException
+ */
+ virtual css::uno::Reference< css::frame::XController >
+ getXController() = 0;
+
+ /** allows interception of user input, aka mouse clicks and key events
+ */
+ virtual bool interceptUserInput( const NotifyEvent& _rEvent ) = 0;
+
+ virtual void SAL_CALL acquire( ) noexcept = 0;
+ virtual void SAL_CALL release( ) noexcept = 0;
+
+ protected:
+ ~IController() {}
+ };
+}
+#endif // INCLUDED_DBACCESS_ICONTROLLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/dbaccess/controllerframe.hxx b/include/dbaccess/controllerframe.hxx
new file mode 100644
index 000000000..97a9c249d
--- /dev/null
+++ b/include/dbaccess/controllerframe.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DBACCESS_CONTROLLERFRAME_HXX
+#define INCLUDED_DBACCESS_CONTROLLERFRAME_HXX
+
+#include <memory>
+
+#include <com/sun/star/frame/FrameAction.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star {
+ namespace frame { class XFrame; }
+}
+
+namespace dbaui
+{
+
+
+ class IController;
+
+
+ //= ControllerFrame
+
+ struct ControllerFrame_Data;
+ /** helper class to encapsulate the frame which a controller is plugged into,
+ doing some common actions on it.
+ */
+ class ControllerFrame
+ {
+ public:
+ ControllerFrame( IController& _rController );
+ ~ControllerFrame();
+
+ /// attaches a new frame
+ const css::uno::Reference< css::frame::XFrame >&
+ attachFrame(
+ const css::uno::Reference< css::frame::XFrame >& _rxFrame
+ );
+
+ // retrieves the current frame
+ const css::uno::Reference< css::frame::XFrame >&
+ getFrame() const;
+
+ /** determines whether the frame is currently active
+ */
+ bool isActive() const;
+
+ /** notifies the instance that a certain frame action happened with our frame
+ */
+ void frameAction( css::frame::FrameAction _eAction );
+
+ private:
+ ::std::unique_ptr< ControllerFrame_Data > m_pData;
+ };
+
+
+} // namespace dbaui
+
+
+#endif // INCLUDED_DBACCESS_CONTROLLERFRAME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/dbaccess/dataview.hxx b/include/dbaccess/dataview.hxx
new file mode 100644
index 000000000..1c2cacdcf
--- /dev/null
+++ b/include/dbaccess/dataview.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_DBACCESS_DATAVIEW_HXX
+#define INCLUDED_DBACCESS_DATAVIEW_HXX
+
+#include <memory>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <dbaccess/dbaccessdllapi.h>
+#include <rtl/ref.hxx>
+#include <tools/wintypes.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/window.hxx>
+
+namespace com::sun::star {
+ namespace frame { class XFrame; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace svt {
+ class AcceleratorExecute;
+}
+
+class NotifyEvent;
+namespace tools { class Rectangle; }
+
+namespace dbaui
+{
+ class IController;
+ class DBACCESS_DLLPUBLIC ODataView : public vcl::Window
+ {
+ css::uno::Reference< css::uno::XComponentContext > m_xContext; // the service factory to work with
+
+ protected:
+ rtl::Reference<IController> m_xController; // the controller where we reside in
+ ::std::unique_ptr< ::svt::AcceleratorExecute> m_pAccel;
+
+ public:
+ ODataView( vcl::Window* pParent,
+ IController& _rController,
+ const css::uno::Reference< css::uno::XComponentContext >& ,
+ WinBits nStyle = 0 );
+ virtual ~ODataView() override;
+ virtual void dispose() override;
+
+ /// late construction
+ virtual void Construct();
+ // initialize will be called when after the controller finished his initialize method
+ virtual void initialize(){}
+ // window overridables
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+
+ IController& getCommandController() const { return *m_xController; }
+
+ const css::uno::Reference< css::uno::XComponentContext >& getORB() const { return m_xContext;}
+
+ // the default implementation simply calls resizeAll( GetSizePixel() )
+ virtual void Resize() override;
+
+ void attachFrame(const css::uno::Reference< css::frame::XFrame >& _xFrame);
+ protected:
+ // window overridables
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& _rRect ) override;
+
+ /// re-arrange all controls, including the toolbox, it's separator, and the "real view"
+ virtual void resizeAll( const tools::Rectangle& _rPlayground );
+
+ // re-arrange the controls belonging to the document itself
+ virtual void resizeDocumentView( tools::Rectangle& _rPlayground );
+ };
+}
+#endif // INCLUDED_DBACCESS_DATAVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/dbaccess/dbaccessdllapi.h b/include/dbaccess/dbaccessdllapi.h
new file mode 100644
index 000000000..2f3771dce
--- /dev/null
+++ b/include/dbaccess/dbaccessdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DBACCESS_DBACCESSDLLAPI_H
+#define INCLUDED_DBACCESS_DBACCESSDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(DBACCESS_DLLIMPLEMENTATION)
+#define DBACCESS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define DBACCESS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define DBACCESS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_DBACCESS_DBACCESSDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/dbaccess/dbaundomanager.hxx b/include/dbaccess/dbaundomanager.hxx
new file mode 100644
index 000000000..364b91d6c
--- /dev/null
+++ b/include/dbaccess/dbaundomanager.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DBACCESS_DBAUNDOMANAGER_HXX
+#define INCLUDED_DBACCESS_DBAUNDOMANAGER_HXX
+
+#include <memory>
+
+#include <com/sun/star/document/XUndoManager.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <dbaccess/dbaccessdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace document { class XUndoAction; }
+ namespace document { class XUndoManagerListener; }
+ namespace uno { class XInterface; }
+}
+
+namespace cppu {
+ class OWeakObject;
+}
+
+namespace osl {
+ class Mutex;
+}
+
+class SfxUndoManager;
+
+
+namespace dbaui
+{
+
+
+ //= UndoManager
+
+ struct UndoManager_Impl;
+ typedef ::cppu::ImplHelper1< css::document::XUndoManager > UndoManager_Base;
+ class DBACCESS_DLLPUBLIC UndoManager final : public UndoManager_Base
+ {
+ public:
+ UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex );
+ virtual ~UndoManager();
+
+ SfxUndoManager& GetSfxUndoManager() const;
+
+ // XInterface
+ virtual void SAL_CALL acquire( ) noexcept override;
+ virtual void SAL_CALL release( ) noexcept override;
+
+ // XComponent equivalents
+ void disposing();
+
+ // XUndoManager
+ virtual void SAL_CALL enterUndoContext( const OUString& i_title ) override;
+ virtual void SAL_CALL enterHiddenUndoContext( ) override;
+ virtual void SAL_CALL leaveUndoContext( ) override;
+ virtual void SAL_CALL addUndoAction( const css::uno::Reference< css::document::XUndoAction >& i_action ) override;
+ virtual void SAL_CALL undo( ) override;
+ virtual void SAL_CALL redo( ) override;
+ virtual sal_Bool SAL_CALL isUndoPossible( ) override;
+ virtual sal_Bool SAL_CALL isRedoPossible( ) override;
+ virtual OUString SAL_CALL getCurrentUndoActionTitle( ) override;
+ virtual OUString SAL_CALL getCurrentRedoActionTitle( ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getAllUndoActionTitles( ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getAllRedoActionTitles( ) override;
+ virtual void SAL_CALL clear( ) override;
+ virtual void SAL_CALL clearRedo( ) override;
+ virtual void SAL_CALL reset( ) override;
+ virtual void SAL_CALL addUndoManagerListener( const css::uno::Reference< css::document::XUndoManagerListener >& i_listener ) override;
+ virtual void SAL_CALL removeUndoManagerListener( const css::uno::Reference< css::document::XUndoManagerListener >& i_listener ) override;
+
+ // XLockable (base of XUndoManager)
+ virtual void SAL_CALL lock( ) override;
+ virtual void SAL_CALL unlock( ) override;
+ virtual sal_Bool SAL_CALL isLocked( ) override;
+
+ // XChild (base of XUndoManager)
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
+ virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
+
+ private:
+ std::unique_ptr< UndoManager_Impl > m_xImpl;
+ };
+
+
+} // namespace dbaui
+
+
+#endif // INCLUDED_DBACCESS_DBAUNDOMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/dbaccess/dbsubcomponentcontroller.hxx b/include/dbaccess/dbsubcomponentcontroller.hxx
new file mode 100644
index 000000000..a1bc687ce
--- /dev/null
+++ b/include/dbaccess/dbsubcomponentcontroller.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DBACCESS_DBSUBCOMPONENTCONTROLLER_HXX
+#define INCLUDED_DBACCESS_DBSUBCOMPONENTCONTROLLER_HXX
+
+#include <memory>
+
+#include <com/sun/star/document/XScriptInvocationContext.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <dbaccess/dbaccessdllapi.h>
+#include <dbaccess/genericcontroller.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace beans { class XPropertySet; }
+ namespace beans { struct PropertyValue; }
+ namespace document { class XEmbeddedScripts; }
+ namespace frame { class XModel; }
+ namespace sdbc { class XConnection; }
+ namespace sdbc { class XDatabaseMetaData; }
+ namespace uno { class XComponentContext; }
+ namespace util { class XModifyListener; }
+ namespace util { class XNumberFormatter; }
+}
+
+namespace dbtools {
+ class DatabaseMetaData;
+ class SQLExceptionInfo;
+}
+
+namespace dbaui
+{
+ //= DBSubComponentController
+
+ typedef ::cppu::ImplInheritanceHelper< OGenericUnoController
+ , css::document::XScriptInvocationContext
+ , css::util::XModifiable
+ > DBSubComponentController_Base;
+
+ struct DBSubComponentController_Impl;
+ class DBACCESS_DLLPUBLIC DBSubComponentController : public DBSubComponentController_Base
+ {
+ private:
+ ::std::unique_ptr<DBSubComponentController_Impl> m_pImpl;
+
+ private:
+ /** forces usage of a connection which we do not own
+ <p>To be used from within XInitialization::initialize, resp. impl_initialize, only.</p>
+ */
+ void initializeConnection( const css::uno::Reference< css::sdbc::XConnection >& _rxForeignConn );
+
+ protected:
+ // OGenericUnoController - initialization
+ virtual void impl_initialize() override;
+
+ // OGenericUnoController
+ virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+
+ virtual css::uno::Reference< css::frame::XModel > getPrivateModel() const override;
+
+ bool impl_isModified() const;
+ virtual void impl_onModifyChanged();
+
+ public:
+ bool isReadOnly() const;
+ bool isEditable() const;
+ void setEditable(bool _bEditable);
+
+
+ // asking for connection-related stuff
+
+ bool isConnected() const;
+
+ css::uno::Reference< css::sdbc::XDatabaseMetaData >
+ getMetaData( ) const;
+
+
+ // access to the data source / document
+ OUString getDataSourceName() const;
+ const css::uno::Reference< css::beans::XPropertySet >&
+ getDataSource() const;
+ bool haveDataSource() const;
+
+ css::uno::Reference< css::frame::XModel >
+ getDatabaseDocument() const;
+
+ /** provides access to the SDB-level database meta data of the current connection
+ */
+ const ::dbtools::DatabaseMetaData& getSdbMetaData() const;
+
+ /** appends an error in the current environment.
+ */
+ void appendError( const OUString& _rErrorMessage );
+
+ /** clears the error state.
+ */
+ void clearError();
+
+ /** @return
+ <TRUE/> when an error was set otherwise <FALSE/>
+ */
+ bool hasError() const;
+
+ /** returns the current error
+ */
+ const ::dbtools::SQLExceptionInfo& getError() const;
+
+ /** displays the current error, or does nothing if there is no current error
+ */
+ void displayError();
+
+ /** shows an info box with the string conntection lost.
+ */
+ void connectionLostMessage() const;
+
+ /** gives access to the currently used connection
+ @return
+ the currently used connection.
+ */
+ const css::uno::Reference< css::sdbc::XConnection >&
+ getConnection() const;
+
+ /** returns the number formatter
+ */
+ css::uno::Reference< css::util::XNumberFormatter > const & getNumberFormatter() const;
+
+ // css::frame::XController
+ virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override;
+ virtual sal_Bool SAL_CALL attachModel(const css::uno::Reference< css::frame::XModel > & xModel) override;
+
+ // XScriptInvocationContext
+ virtual css::uno::Reference< css::document::XEmbeddedScripts > SAL_CALL getScriptContainer() override;
+
+ // XModifiable
+ virtual sal_Bool SAL_CALL isModified( ) override;
+ virtual void SAL_CALL setModified( sal_Bool bModified ) override;
+
+ // XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+ virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+
+ // XTitle
+ virtual OUString SAL_CALL getTitle( ) override;
+
+ protected:
+ DBSubComponentController(const css::uno::Reference< css::uno::XComponentContext>& _rxORB);
+ virtual ~DBSubComponentController() override;
+
+ void disconnect();
+ virtual void reconnect( bool _bUI );
+ bool ensureConnected() {
+ if ( !isConnected() ) reconnect( false );
+ return isConnected();
+ }
+
+ /** called when our connection is being disposed
+ <p>The default implementation does a reconnect</p>
+ */
+ virtual void losingConnection( );
+
+ protected:
+ // XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+
+ protected:
+ sal_Int32 getCurrentStartNumber() const;
+ };
+
+
+} // namespace dbaui
+
+
+#endif // INCLUDED_DBACCESS_DBSUBCOMPONENTCONTROLLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/dbaccess/genericcontroller.hxx b/include/dbaccess/genericcontroller.hxx
new file mode 100644
index 000000000..50b939791
--- /dev/null
+++ b/include/dbaccess/genericcontroller.hxx
@@ -0,0 +1,506 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DBACCESS_GENERICCONTROLLER_HXX
+#define INCLUDED_DBACCESS_GENERICCONTROLLER_HXX
+
+#include <sal/config.h>
+
+#include <deque>
+#include <map>
+#include <memory>
+#include <vector>
+
+#include <optional>
+
+#include <com/sun/star/awt/XUserInputInterception.hpp>
+#include <com/sun/star/frame/CommandGroup.hpp>
+#include <com/sun/star/frame/DispatchInformation.hpp>
+#include <com/sun/star/frame/XController2.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/frame/XTitle.hpp>
+#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <comphelper/sharedmutex.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <connectivity/dbexception.hxx>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <dbaccess/AsynchronousLink.hxx>
+#include <dbaccess/controllerframe.hxx>
+#include <dbaccess/dbaccessdllapi.h>
+#include <dbaccess/IController.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
+
+namespace com::sun::star {
+ namespace awt { class XKeyHandler; }
+ namespace awt { class XMouseClickHandler; }
+ namespace awt { class XWindow; }
+ namespace beans { struct PropertyValue; }
+ namespace frame { class XController; }
+ namespace frame { class XDispatchProvider; }
+ namespace frame { class XFrame; }
+ namespace frame { class XFrameActionListener; }
+ namespace frame { class XModel; }
+ namespace frame { class XStatusListener; }
+ namespace frame { class XTitleChangeListener; }
+ namespace frame { struct DispatchDescriptor; }
+ namespace frame { struct FrameActionEvent; }
+ namespace lang { class XEventListener; }
+ namespace sdb { class XDatabaseContext; }
+ namespace sdbc { class XConnection; }
+ namespace sdbc { class XDataSource; }
+ namespace ui { class XSidebarProvider; }
+ namespace uno { class XComponentContext; }
+ namespace util { class XURLTransformer; }
+}
+
+namespace vcl { class Window; }
+namespace weld { class Window; }
+class NotifyEvent;
+
+namespace dbaui
+{
+ class ODataView;
+
+ template< typename T >
+ inline bool SAL_CALL operator >>= (const css::uno::Any& _any, std::optional< T >& _value)
+ {
+ _value.reset(); // de-init the optional value
+
+ T directValue = T();
+ if ( _any >>= directValue )
+ _value = directValue;
+
+ return !!_value;
+ }
+
+
+ // = FeatureState
+
+ /** describes the state of a feature
+
+ In opposite to the FeatureStateEvent in css.frame, this one allows for multiple states to be specified at once.
+ With this, you can for instance specify that a toolbox item is checked, and has a certain title, at the same
+ time.
+ */
+ struct FeatureState
+ {
+ bool bEnabled;
+
+ std::optional<bool> bChecked;
+ std::optional<bool> bInvisible;
+ css::uno::Any aValue;
+ std::optional<OUString> sTitle;
+
+ FeatureState() : bEnabled(false) { }
+ };
+
+
+ // = helper
+
+
+ struct ControllerFeature : public css::frame::DispatchInformation
+ {
+ sal_uInt16 nFeatureId;
+ };
+
+
+ typedef ::std::map < OUString
+ , ControllerFeature
+ , ::std::less< OUString >
+ > SupportedFeatures;
+
+
+ class CompareFeatureById
+ {
+ const sal_Int32 m_nId;
+ public:
+ CompareFeatureById(sal_Int32 _nId) : m_nId(_nId)
+ {}
+
+ bool operator()( const SupportedFeatures::value_type& _aType ) const
+ {
+ return m_nId == _aType.second.nFeatureId;
+ }
+ };
+
+
+ struct FeatureListener
+ {
+ css::uno::Reference< css::frame::XStatusListener >
+ xListener;
+ sal_Int32 nId;
+ bool bForceBroadcast;
+ };
+
+
+ class FindFeatureListener
+ {
+ const css::uno::Reference< css::frame::XStatusListener >& m_xListener;
+ public:
+ FindFeatureListener(const css::uno::Reference< css::frame::XStatusListener >& _xListener)
+ : m_xListener(_xListener)
+ {}
+
+ bool operator()( const FeatureListener& lhs ) const
+ {
+ return lhs.xListener == m_xListener;
+ }
+ };
+
+
+ typedef ::comphelper::SharedMutexBase OGenericUnoController_MBASE;
+
+ typedef ::cppu::WeakComponentImplHelper< css::frame::XDispatch
+ , css::frame::XDispatchProviderInterceptor
+ , css::util::XModifyListener
+ , css::frame::XFrameActionListener
+ , css::lang::XInitialization
+ , css::lang::XServiceInfo
+ , css::frame::XDispatchInformationProvider
+ , css::frame::XController2
+ , css::frame::XTitle
+ , css::frame::XTitleChangeBroadcaster
+ , css::awt::XUserInputInterception
+ > OGenericUnoController_Base;
+
+ struct OGenericUnoController_Data;
+
+ class DBACCESS_DLLPUBLIC OGenericUnoController
+ :public OGenericUnoController_MBASE
+ ,public OGenericUnoController_Base
+ ,public IController
+ {
+ private:
+ SupportedFeatures m_aSupportedFeatures;
+ ::comphelper::NamedValueCollection
+ m_aInitParameters;
+
+ ::std::unique_ptr< OGenericUnoController_Data >
+ m_pData;
+ VclPtr<ODataView> m_pView; // our (VCL) "main window"
+
+#ifdef DBG_UTIL
+ bool m_bDescribingSupportedFeatures;
+#endif
+
+ protected:
+
+ // attributes
+ struct DispatchTarget
+ {
+ css::util::URL aURL;
+ css::uno::Reference< css::frame::XStatusListener > xListener;
+
+ DispatchTarget(const css::util::URL& rURL, const css::uno::Reference< css::frame::XStatusListener >& rRef) : aURL(rURL), xListener(rRef) { }
+ };
+
+ typedef std::map<sal_uInt16, FeatureState> StateCache;
+ typedef std::vector<DispatchTarget> Dispatch;
+
+ ::std::deque< FeatureListener >
+ m_aFeaturesToInvalidate;
+
+ ::osl::Mutex m_aFeatureMutex; // locked when features are append to or remove from deque
+ StateCache m_aStateCache; // save the current status of feature state
+ Dispatch m_arrStatusListener; // all our listeners where we dispatch status changes
+ OAsynchronousLink m_aAsyncInvalidateAll;
+ OAsynchronousLink m_aAsyncCloseTask; // called when a task should be closed
+
+ css::uno::Reference< css::util::XURLTransformer > m_xUrlTransformer; // needed sometimes
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ ControllerFrame m_aCurrentFrame;
+ css::uno::Reference< css::frame::XDispatchProvider > m_xSlaveDispatcher; // for intercepting dispatches
+ css::uno::Reference< css::frame::XDispatchProvider > m_xMasterDispatcher; // ditto
+ css::uno::Reference< css::sdb::XDatabaseContext > m_xDatabaseContext;
+ css::uno::Reference< css::frame::XTitle > m_xTitleHelper;
+
+ bool m_bPreview;
+ bool m_bReadOnly;
+
+ bool m_bCurrentlyModified : 1;
+ bool m_bExternalTitle : 1;
+
+
+ // attribute access
+ using OGenericUnoController_MBASE::getMutex;
+ ::cppu::OBroadcastHelper& getBroadcastHelper() { return OGenericUnoController_Base::rBHelper; }
+
+
+ // methods
+ OGenericUnoController( const css::uno::Reference< css::uno::XComponentContext >& _rM );
+ OGenericUnoController() = delete;
+ const ::comphelper::NamedValueCollection&
+ getInitParams() const { return m_aInitParameters; }
+
+ // closes the task when possible
+ void closeTask();
+
+ // if getMenu returns a non empty string than this will be dispatched at the frame
+ virtual void loadMenu(const css::uno::Reference< css::frame::XFrame >& _xFrame);
+
+ /** called when our menu has been loaded into our frame, can be used to load sub toolbars
+
+ @param _xLayoutManager
+ The layout manager.
+ */
+ virtual void onLoadedMenu(const css::uno::Reference< css::frame::XLayoutManager >& _xLayoutManager);
+
+ // all the features which should be handled by this class
+ virtual void describeSupportedFeatures();
+
+ // state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot.
+ virtual FeatureState GetState(sal_uInt16 nId) const;
+ // execute a feature
+ virtual void Execute(sal_uInt16 nId , const css::uno::Sequence< css::beans::PropertyValue>& aArgs);
+
+ /** describes a feature supported by the controller
+
+ Must not be called outside <member>describeSupportedFeatures</member>.
+
+ @param _rCommandURL
+ the URL of the feature command
+ @param _nFeatureId
+ the id of the feature. Later references to this feature usually happen by id, not by
+ URL
+ @param _nCommandGroup
+ the command group of the feature. This is important for configuring the controller UI
+ by the user, see also <type scope="css::frame">CommandGroup</type>.
+ */
+ void implDescribeSupportedFeature(
+ const OUString& _rCommandURL,
+ sal_uInt16 _nFeatureId,
+ sal_Int16 _nCommandGroup = css::frame::CommandGroup::INTERNAL
+ );
+
+ /** returns <TRUE/> if the feature is supported, otherwise <FALSE/>
+ @param _nId
+ The ID of the feature.
+ */
+ bool isFeatureSupported( sal_Int32 _nId );
+
+ // gets the URL which the given id is assigned to
+ css::util::URL getURLForId(sal_Int32 _nId) const;
+
+ /** determines whether the given feature ID denotes a user-defined feature
+
+ @see IController::registerCommandURL
+ */
+ static bool isUserDefinedFeature( const sal_uInt16 nFeatureId );
+
+ /** determines whether the given feature URL denotes a user-defined feature
+
+ @see IController::registerCommandURL
+ */
+ bool isUserDefinedFeature( const OUString& _rFeatureURL ) const;
+
+ // connect to a datasource
+ css::uno::Reference< css::sdbc::XConnection > connect(
+ const css::uno::Reference< css::sdbc::XDataSource>& _xDataSource
+ );
+
+ // connect to a datasource
+ css::uno::Reference< css::sdbc::XConnection > connect(
+ const OUString& _rsDataSourceName,
+ const OUString& _rContextInformation,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo
+ );
+
+ void startConnectionListening(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection);
+ void stopConnectionListening(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection);
+
+ /** return the container window of the top most frame
+ @return
+ The top most container window, nmay be <NULL/>.
+ */
+ css::uno::Reference< css::awt::XWindow> getTopMostContainerWindow() const;
+
+ // XInitialize will be called inside initialize
+ virtual void impl_initialize();
+
+ virtual OUString getPrivateTitle() const { return OUString(); }
+
+ css::uno::Reference< css::frame::XTitle > impl_getTitleHelper_throw(bool bCreateIfNecessary = true);
+ virtual css::uno::Reference< css::frame::XModel > getPrivateModel() const
+ {
+ return css::uno::Reference< css::frame::XModel >();
+ }
+
+ virtual void startFrameListening( const css::uno::Reference< css::frame::XFrame >& _rxFrame );
+ virtual void stopFrameListening( const css::uno::Reference< css::frame::XFrame >& _rxFrame );
+
+ void releaseNumberForComponent();
+
+ virtual ~OGenericUnoController() override;
+
+ private:
+ void fillSupportedFeatures();
+
+ void InvalidateAll_Impl();
+ void InvalidateFeature_Impl();
+
+ void ImplInvalidateFeature( sal_Int32 _nId, const css::uno::Reference< css::frame::XStatusListener >& _xListener, bool _bForceBroadcast );
+
+ void ImplBroadcastFeatureState(const OUString& _rFeature, const css::uno::Reference< css::frame::XStatusListener > & xListener, bool _bIgnoreCache);
+
+ // link methods
+ DECL_DLLPRIVATE_LINK(OnAsyncInvalidateAll, void*, void);
+ DECL_DLLPRIVATE_LINK(OnAsyncCloseTask, void*, void);
+
+ public:
+ const css::uno::Reference< css::uno::XComponentContext >& getORB() const { return m_xContext; }
+ ODataView* getView() const { return m_pView; }
+ weld::Window* getFrameWeld() const;
+ void setView( const VclPtr<ODataView>& i_rView );
+ void clearView();
+ // shows an error box if the SQLExceptionInfo is valid
+ void showError(const ::dbtools::SQLExceptionInfo& _rInfo);
+
+ // if there is a css::util::URL translation for the id
+ // ('handle') then if xListener is NULL the change will be forwarded
+ // to all listeners to the given css::util::URL
+ // if there is a toolbar slot with the given id it is updated (the new state is determined via GetState)
+ // if _bForceBroadcast is sal_True, the current feature state is broadcasted no matter if it is the same as the cached state
+ void InvalidateFeature(sal_uInt16 nId, const css::uno::Reference< css::frame::XStatusListener > & xListener = nullptr, bool _bForceBroadcast = false);
+
+ /** InvalidateAll invalidates all features currently known
+ */
+ void InvalidateAll();
+ // late construction
+ virtual bool Construct(vcl::Window* pParent);
+
+ /** get the layout manager
+ @param _xFrame
+ The frame to ask for the layout manager.
+ @return
+ The layout manager of the frame, can be <NULL/> if the frame isn't initialized.
+ */
+ static css::uno::Reference< css::frame::XLayoutManager > getLayoutManager(const css::uno::Reference< css::frame::XFrame >& _xFrame);
+
+ // IController
+ virtual void executeUnChecked(const css::util::URL& _rCommand, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+ virtual void executeChecked(const css::util::URL& _rCommand, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+ virtual void executeUnChecked(sal_uInt16 _nCommandId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+ virtual void executeChecked(sal_uInt16 _nCommandId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+ virtual bool isCommandEnabled(sal_uInt16 _nCommandId) const override;
+ virtual bool isCommandEnabled(const OUString& _rCompleteCommandURL) const override;
+ virtual bool isDataSourceReadOnly() const override;
+ virtual css::uno::Reference< css::frame::XController > getXController() override;
+ virtual bool interceptUserInput( const NotifyEvent& _rEvent ) override;
+
+ // misc
+ bool isCommandChecked(sal_uInt16 _nCommandId) const;
+
+ // css::lang::XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ // css::util::XModifyListener
+ virtual void SAL_CALL modified(const css::lang::EventObject& aEvent) override;
+
+ // XInterface
+ virtual void SAL_CALL acquire( ) noexcept override;
+ virtual void SAL_CALL release( ) noexcept override;
+
+ // css::frame::XController2
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() override;
+ virtual OUString SAL_CALL getViewControllerName() override;
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCreationArguments() override;
+
+ virtual css::uno::Reference< css::ui::XSidebarProvider > SAL_CALL getSidebar() override;
+
+
+ // css::frame::XController
+ virtual void SAL_CALL attachFrame(const css::uno::Reference< css::frame::XFrame > & xFrame) override;
+ virtual sal_Bool SAL_CALL attachModel(const css::uno::Reference< css::frame::XModel > & xModel) override;
+ virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override = 0;
+ virtual css::uno::Any SAL_CALL getViewData() override;
+ virtual void SAL_CALL restoreViewData(const css::uno::Any& Data) override;
+ virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel() override;
+ virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() override;
+
+ // css::frame::XDispatch
+ virtual void SAL_CALL dispatch(const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+ virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > & aListener, const css::util::URL& aURL) override;
+ virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > & aListener, const css::util::URL& aURL) override;
+
+ // css::frame::XDispatchProviderInterceptor
+ virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider() override;
+ virtual void SAL_CALL setSlaveDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > & _xNewProvider) override;
+ virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider() override;
+ virtual void SAL_CALL setMasterDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > & _xNewProvider) override;
+
+ // css::frame::XDispatchProvider
+ virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags) override;
+ virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor >& aDescripts) override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL dispose() override; //LLA: need solar mutex {OGenericUnoController_COMPBASE::dispose(); }
+ virtual void SAL_CALL disposing() override;
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override;
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override;
+
+ // css::frame::XFrameActionListener
+ virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) override;
+ // lang::XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override = 0;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override = 0;
+
+ // XDispatchInformationProvider
+ virtual css::uno::Sequence< ::sal_Int16 > SAL_CALL getSupportedCommandGroups() override;
+ virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( ::sal_Int16 ) override;
+
+ // XTitle
+ virtual OUString SAL_CALL getTitle( ) override;
+ virtual void SAL_CALL setTitle( const OUString& sTitle ) override;
+
+ // XTitleChangeBroadcaster
+ virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
+ virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
+
+ // XUserInputInterception
+ virtual void SAL_CALL addKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) override;
+ virtual void SAL_CALL removeKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) override;
+ virtual void SAL_CALL addMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) override;
+ virtual void SAL_CALL removeMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) override;
+ };
+}
+
+#endif // INCLUDED_DBACCESS_GENERICCONTROLLER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/default.rc b/include/default.rc
new file mode 100644
index 000000000..5474d55c4
--- /dev/null
+++ b/include/default.rc
@@ -0,0 +1,64 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include "version.hrc"
+
+
+// version information
+
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION VERSION, SUBVERSION, MICROVERSION, VERVARIANT
+ PRODUCTVERSION VERSION, SUBVERSION, MICROVERSION, VERVARIANT
+ FILEFLAGSMASK 0x3F
+ FILEFLAGS
+#if defined(DEBUG)
+ VS_FF_DEBUG |
+#endif
+#ifdef VER_PREL
+ VS_FF_PRERELEASE |
+#endif
+ 0
+ FILEOS VOS_NT_WINDOWS32
+ FILETYPE VFT_APP
+ {
+ BLOCK "StringFileInfo"
+ {
+ BLOCK "040904E4"
+ {
+ // International StringTable
+ VALUE "CompanyName", PPS(RES_APP_VENDOR) "\0"
+ VALUE "ProductName", "LibreOffice\0"
+ VALUE "ProductVersion", PPS(VER_LEVEL) "\0"
+ VALUE "FileVersion", PPS(VER_LEVEL) "\0"
+ VALUE "OriginalFilename", PPS(ORG_NAME) "\0"
+ VALUE "InternalName", PPS(INTERNAL_NAME) "\0"
+ VALUE "LegalCopyright", S_CRIGHT " LibreOffice contributors. All rights reserved.\0"
+ ADDITIONAL_VERINFO1
+ ADDITIONAL_VERINFO2
+ ADDITIONAL_VERINFO3
+ }
+ }
+
+ BLOCK "VarFileInfo"
+ {
+ VALUE "Translation", 0x0409, 1252
+ }
+ }
diff --git a/include/desktop/crashreport.hxx b/include/desktop/crashreport.hxx
new file mode 100644
index 000000000..403e31171
--- /dev/null
+++ b/include/desktop/crashreport.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_DESKTOP_CRASHREPORT_HXX
+#define INCLUDED_DESKTOP_CRASHREPORT_HXX
+
+#include <desktop/dllapi.h>
+
+#include <rtl/ustring.hxx>
+#include <osl/mutex.hxx>
+
+#include <config_features.h>
+
+// vector not sort the entries
+#include <memory>
+#include <vector>
+#include <deque>
+#include <string>
+
+namespace google_breakpad
+{
+class ExceptionHandler;
+}
+
+/**
+ * Provides access to the crash reporter service.
+ *
+ * Valid keys are:
+ * * AdapterVendorId
+ * * AdapterDeviceId
+ *
+ */
+class
+#if HAVE_FEATURE_BREAKPAD
+// MSVC 2013 has undefined symbols for inline functions if it's exported
+CRASHREPORT_DLLPUBLIC
+#endif
+/*class*/ CrashReporter
+{
+public:
+ typedef enum {AddItem, Write, Create} tAddKeyHandling;
+#if HAVE_FEATURE_BREAKPAD
+ static void addKeyValue(const OUString& rKey, const OUString& rValue, tAddKeyHandling AddKeyHandling);
+
+ static void installExceptionHandler();
+ static void removeExceptionHandler();
+
+ static void setActiveSfxObjectName(const OUString& rActiveSfxObjectName);
+ static OUString getActiveSfxObjectName();
+
+ static void logUnoCommand(const OUString& rUnoCommand);
+ static OUString getLoggedUnoCommands();
+
+ static bool crashReportInfoExists();
+
+ static bool readSendConfig(std::string& response);
+
+ static bool IsDumpEnable();
+
+private:
+ static osl::Mutex maMutex;
+ static osl::Mutex maActiveSfxObjectNameMutex;
+ static osl::Mutex maUnoLogCmdMutex;
+ static bool mbInit;
+ typedef struct _mpair
+ {
+ OUString first;
+ OUString second;
+ _mpair(const OUString& First, const OUString& Second)
+ {
+ first = First;
+ second = Second;
+ };
+ } mpair;
+
+ typedef std::vector<mpair> vmaKeyValues;
+ static vmaKeyValues maKeyValues; // used to temporarily save entries before the old info has been uploaded
+ typedef std::deque<OUString> vmaloggedUnoCommands;
+ static vmaloggedUnoCommands maloggedUnoCommands;
+ static OUString msActiveSfxObjectName;
+
+ static std::unique_ptr<google_breakpad::ExceptionHandler> mpExceptionHandler;
+
+ static std::string getIniFileName();
+ static void writeCommonInfo();
+ static void writeSystemInfo();
+ static void writeToFile(std::ios_base::openmode Openmode);
+ // when we create the ExceptionHandler we have no access to the user
+ // profile yet, so update when we have access
+ static void updateMinidumpLocation();
+
+#else
+ // Add dummy methods for the non-breakpad case. That allows us to use
+ // // the code without linking to the lib and without adding HAVE_FEATURE_BREAKPAD
+ // // everywhere we want to log something to the crash report system.
+ inline static void addKeyValue(SAL_UNUSED_PARAMETER const OUString& /*rKey*/, SAL_UNUSED_PARAMETER const OUString& /*rValue*/, SAL_UNUSED_PARAMETER tAddKeyHandling /*AddKeyHandling*/) {};
+ inline static void setActiveSfxObjectName(SAL_UNUSED_PARAMETER const OUString& /*rActiveSfxObjectName*/) {};
+ inline static OUString getActiveSfxObjectName()
+ {
+ return OUString();
+ }
+ inline static void logUnoCommand(SAL_UNUSED_PARAMETER const OUString& /*rUnoCommand*/) {};
+ inline static OUString getLoggedUnoCommands()
+ {
+ return OUString();
+ }
+#endif // HAVE_FEATURE_BREAKPAD
+};
+
+#endif // INCLUDED_DESKTOP_CRASHREPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/desktop/dllapi.h b/include/desktop/dllapi.h
new file mode 100644
index 000000000..5cf948ce0
--- /dev/null
+++ b/include/desktop/dllapi.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_DESKTOP_SOURCE_INC_DESKTOPDLLAPI_H
+#define INCLUDED_DESKTOP_SOURCE_INC_DESKTOPDLLAPI_H
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined(DESKTOP_DLLIMPLEMENTATION)
+#define DESKTOP_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define DESKTOP_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#if defined(CRASHREPORT_DLLIMPLEMENTATION)
+#define CRASHREPORT_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define CRASHREPORT_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim: set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/desktop/exithelper.h b/include/desktop/exithelper.h
new file mode 100644
index 000000000..b4f618783
--- /dev/null
+++ b/include/desktop/exithelper.h
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DESKTOP_EXITHELPER_H
+#define INCLUDED_DESKTOP_EXITHELPER_H
+
+enum EExitCodes
+{
+ /* e.g. used to force showing of the command line help */
+ EXITHELPER_NO_ERROR = 0,
+ /* a uno exception was caught during startup */
+ EXITHELPER_FATAL_ERROR = 77,
+ /* user force automatic restart after crash */
+ EXITHELPER_CRASH_WITH_RESTART = 79,
+ /* the office restarts itself */
+ EXITHELPER_NORMAL_RESTART = 81
+};
+
+#endif // INCLUDED_DESKTOP_EXITHELPER_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/desktop/minidump.hxx b/include/desktop/minidump.hxx
new file mode 100644
index 000000000..93c02f3e0
--- /dev/null
+++ b/include/desktop/minidump.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_DESKTOP_MINIDUMP_MINIDUMP_HXX
+#define INCLUDED_DESKTOP_MINIDUMP_MINIDUMP_HXX
+
+#include <string>
+
+#include <desktop/dllapi.h>
+
+namespace crashreport
+{
+// when response = nullptr only make test
+/** Read+Send, Test and send info from the Dump.ini .
+
+ @param [in] iniPath Path-file to the read/test ini-file (UTF-8 on Windows)
+ @param [in] response=nullptr in this case made the Test only
+ @param [in] response!=nullptr in this case made the Read+Send
+
+ @retval true Read+Send, Test was okay
+ @retval false Read+Send, Test is a error
+*/
+
+CRASHREPORT_DLLPUBLIC bool readConfig(const std::string& iniPath, std::string* response);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/XShapeDumper.hxx b/include/drawinglayer/XShapeDumper.hxx
new file mode 100644
index 000000000..47f5b0c26
--- /dev/null
+++ b/include/drawinglayer/XShapeDumper.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_XSHAPEDUMPER_HXX
+#define INCLUDED_DRAWINGLAYER_XSHAPEDUMPER_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::drawing { class XShape; }
+namespace com::sun::star::drawing { class XShapes; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+struct DRAWINGLAYER_DLLPUBLIC XShapeDumper
+{
+ XShapeDumper() = delete;
+ static OUString dump(const css::uno::Reference<css::drawing::XShapes>& xPageShapes, bool bDumpInteropProperties=false);
+ static OUString dump(const css::uno::Reference<css::drawing::XShape>& xPageShapes, bool bDumpInteropProperties=false);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/animation/animationtiming.hxx b/include/drawinglayer/animation/animationtiming.hxx
new file mode 100644
index 000000000..c92639b99
--- /dev/null
+++ b/include/drawinglayer/animation/animationtiming.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
+#define INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <vector>
+#include <memory>
+
+
+namespace drawinglayer::animation
+ {
+
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntry
+ {
+ private:
+ AnimationEntry(const AnimationEntry&) = delete;
+ AnimationEntry& operator=(const AnimationEntry& rCandidate) = delete;
+
+ public:
+ AnimationEntry();
+ virtual ~AnimationEntry();
+ virtual std::unique_ptr<AnimationEntry> clone() const = 0;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const = 0;
+ virtual double getDuration() const = 0;
+ virtual double getStateAtTime(double fTime) const = 0;
+ virtual double getNextEventTime(double fTime) const = 0;
+ };
+
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryFixed final : public AnimationEntry
+ {
+ double mfDuration;
+ double mfState;
+
+ public:
+ AnimationEntryFixed(double fDuration, double fState);
+ virtual ~AnimationEntryFixed() override;
+ virtual std::unique_ptr<AnimationEntry> clone() const override;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const override;
+ virtual double getDuration() const override;
+ virtual double getStateAtTime(double fTime) const override;
+ virtual double getNextEventTime(double fTime) const override;
+ };
+
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryLinear final : public AnimationEntry
+ {
+ double mfDuration;
+ double mfFrequency;
+ double mfStart;
+ double mfStop;
+
+ public:
+ AnimationEntryLinear(double fDuration, double fFrequency, double fStart, double fStop);
+ virtual ~AnimationEntryLinear() override;
+ virtual std::unique_ptr<AnimationEntry> clone() const override;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const override;
+ virtual double getDuration() const override;
+ virtual double getStateAtTime(double fTime) const override;
+ virtual double getNextEventTime(double fTime) const override;
+ };
+
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryList : public AnimationEntry
+ {
+ protected:
+ using Entries = std::vector<std::unique_ptr<AnimationEntry>>;
+
+ double mfDuration;
+ Entries maEntries;
+
+ // helpers
+ Entries::size_type impGetIndexAtTime(double fTime, double &rfAddedTime) const;
+
+ public:
+ AnimationEntryList();
+ virtual ~AnimationEntryList() override;
+ virtual std::unique_ptr<AnimationEntry> clone() const override;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const override;
+ void append(const AnimationEntry& rCandidate);
+ virtual double getDuration() const override;
+ virtual double getStateAtTime(double fTime) const override;
+ virtual double getNextEventTime(double fTime) const override;
+ };
+
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryLoop final : public AnimationEntryList
+ {
+ sal_uInt32 mnRepeat;
+
+ public:
+ AnimationEntryLoop(sal_uInt32 nRepeat);
+ virtual ~AnimationEntryLoop() override;
+ virtual std::unique_ptr<AnimationEntry> clone() const override;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const override;
+ virtual double getDuration() const override;
+ virtual double getStateAtTime(double fTime) const override;
+ virtual double getNextEventTime(double fTime) const override;
+ };
+
+
+} // end of namespace drawinglayer::animation
+
+
+#endif //INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fillgradientattribute.hxx b/include/drawinglayer/attribute/fillgradientattribute.hxx
new file mode 100644
index 000000000..50a87a685
--- /dev/null
+++ b/include/drawinglayer/attribute/fillgradientattribute.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+namespace basegfx
+{
+class BColor;
+}
+
+namespace drawinglayer::attribute
+{
+class ImpFillGradientAttribute;
+
+enum class GradientStyle
+{
+ Linear,
+ Axial,
+ Radial,
+ Elliptical,
+ Square,
+ Rect
+};
+
+class DRAWINGLAYER_DLLPUBLIC FillGradientAttribute
+{
+public:
+ typedef o3tl::cow_wrapper<ImpFillGradientAttribute> ImplType;
+
+private:
+ ImplType mpFillGradientAttribute;
+
+public:
+ /// constructors/assignmentoperator/destructor
+ FillGradientAttribute(GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY,
+ double fAngle, const basegfx::BColor& rStartColor,
+ const basegfx::BColor& rEndColor, sal_uInt16 nSteps = 0);
+ FillGradientAttribute();
+ FillGradientAttribute(const FillGradientAttribute&);
+ FillGradientAttribute(FillGradientAttribute&&);
+ FillGradientAttribute& operator=(const FillGradientAttribute&);
+ FillGradientAttribute& operator=(FillGradientAttribute&&);
+ ~FillGradientAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const FillGradientAttribute& rCandidate) const;
+
+ // data read access
+ GradientStyle getStyle() const;
+ double getBorder() const;
+ double getOffsetX() const;
+ double getOffsetY() const;
+ double getAngle() const;
+ const basegfx::BColor& getStartColor() const;
+ const basegfx::BColor& getEndColor() const;
+ sal_uInt16 getSteps() const;
+};
+
+} // end of namespace drawinglayer::attribute
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fillgraphicattribute.hxx b/include/drawinglayer/attribute/fillgraphicattribute.hxx
new file mode 100644
index 000000000..976d7bd37
--- /dev/null
+++ b/include/drawinglayer/attribute/fillgraphicattribute.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+class Graphic;
+
+namespace basegfx
+{
+class B2DRange;
+}
+
+namespace drawinglayer::attribute
+{
+class ImpFillGraphicAttribute;
+
+class DRAWINGLAYER_DLLPUBLIC FillGraphicAttribute
+{
+public:
+ typedef o3tl::cow_wrapper<ImpFillGraphicAttribute> ImplType;
+
+private:
+ ImplType mpFillGraphicAttribute;
+
+public:
+ /// constructors/assignmentoperator/destructor
+ FillGraphicAttribute(const Graphic& rGraphic, const basegfx::B2DRange& rGraphicRange,
+ bool bTiling, double fOffsetX = 0.0, double fOffsetY = 0.0);
+ FillGraphicAttribute(const FillGraphicAttribute&);
+ FillGraphicAttribute& operator=(const FillGraphicAttribute&);
+ ~FillGraphicAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const FillGraphicAttribute& rCandidate) const;
+
+ // data read access
+ const Graphic& getGraphic() const;
+ const basegfx::B2DRange& getGraphicRange() const;
+ bool getTiling() const;
+ double getOffsetX() const;
+ double getOffsetY() const;
+};
+
+} // end of namespace drawinglayer::attribute
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fillhatchattribute.hxx b/include/drawinglayer/attribute/fillhatchattribute.hxx
new file mode 100644
index 000000000..a929b5715
--- /dev/null
+++ b/include/drawinglayer/attribute/fillhatchattribute.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+namespace basegfx
+{
+class BColor;
+}
+
+namespace drawinglayer::attribute
+{
+class ImpFillHatchAttribute;
+
+enum class HatchStyle
+{
+ Single,
+ Double,
+ Triple
+};
+
+class DRAWINGLAYER_DLLPUBLIC FillHatchAttribute
+{
+public:
+ typedef o3tl::cow_wrapper<ImpFillHatchAttribute> ImplType;
+
+private:
+ ImplType mpFillHatchAttribute;
+
+public:
+ /// constructors/assignmentoperator/destructor
+ FillHatchAttribute(HatchStyle eStyle, double fDistance, double fAngle,
+ const basegfx::BColor& rColor, sal_uInt32 nMinimalDiscreteDistance,
+ bool bFillBackground);
+ FillHatchAttribute();
+ FillHatchAttribute(const FillHatchAttribute&);
+ FillHatchAttribute(FillHatchAttribute&&);
+ FillHatchAttribute& operator=(const FillHatchAttribute&);
+ FillHatchAttribute& operator=(FillHatchAttribute&&);
+ ~FillHatchAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const FillHatchAttribute& rCandidate) const;
+
+ // data read access
+ HatchStyle getStyle() const;
+ double getDistance() const;
+ double getAngle() const;
+ const basegfx::BColor& getColor() const;
+
+ // #i120230# If a minimal discrete distance is wanted (VCL used 3,
+ // this is the default for the global instance, too), set this
+ // unequal to zero. Zero means not to use it. If set bigger zero
+ // (should be at least two, one leads to a full plane filled with
+ // lines when Distance in discrete views is smaller than one) this
+ // will be used when the discrete value is less than the given one.
+ // This is used to 'emulate' old VCL behaviour which makes hatches
+ // look better by not making distances as small as needed, but
+ // keeping them on a minimal discrete value for more appealing
+ // visualisation.
+ sal_uInt32 getMinimalDiscreteDistance() const;
+
+ bool isFillBackground() const;
+};
+
+} // end of namespace drawinglayer::attribute
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fontattribute.hxx b/include/drawinglayer/attribute/fontattribute.hxx
new file mode 100644
index 000000000..1a7250170
--- /dev/null
+++ b/include/drawinglayer/attribute/fontattribute.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <rtl/ustring.hxx>
+
+namespace drawinglayer::attribute
+{
+class ImpFontAttribute;
+}
+
+namespace drawinglayer::attribute
+{
+/** FontAttribute class
+
+ This attribute class is able to hold all parameters needed/used
+ to completely define the parametrisation of a text portion.
+ */
+class DRAWINGLAYER_DLLPUBLIC FontAttribute
+{
+public:
+ typedef o3tl::cow_wrapper<ImpFontAttribute> ImplType;
+
+private:
+ ImplType mpFontAttribute;
+
+public:
+ /// TODO: pair kerning and CJK kerning
+ FontAttribute(const OUString& rFamilyName, const OUString& rStyleName, sal_uInt16 nWeight,
+ bool bSymbol = false, bool bVertical = false, bool bItalic = false,
+ bool bMonospaced = false, bool bOutline = false, bool bRTL = false,
+ bool bBiDiStrong = false);
+ FontAttribute();
+ FontAttribute(const FontAttribute&);
+ FontAttribute(FontAttribute&&);
+ FontAttribute& operator=(const FontAttribute&);
+ FontAttribute& operator=(FontAttribute&&);
+ ~FontAttribute();
+
+ // compare operator
+ bool operator==(const FontAttribute& rCandidate) const;
+
+ /// data read access
+ const OUString& getFamilyName() const;
+ const OUString& getStyleName() const;
+ sal_uInt16 getWeight() const;
+ bool getSymbol() const;
+ bool getVertical() const;
+ bool getItalic() const;
+ bool getOutline() const;
+ bool getRTL() const;
+ bool getBiDiStrong() const;
+ bool getMonospaced() const;
+};
+} // end of namespace drawinglayer::attribute
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/lineattribute.hxx b/include/drawinglayer/attribute/lineattribute.hxx
new file mode 100644
index 000000000..77828a15d
--- /dev/null
+++ b/include/drawinglayer/attribute/lineattribute.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <basegfx/numeric/ftools.hxx> // for F_PI180
+#include <basegfx/vector/b2enums.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+namespace basegfx
+{
+class BColor;
+}
+
+namespace drawinglayer::attribute
+{
+class ImpLineAttribute;
+}
+
+namespace drawinglayer::attribute
+{
+class DRAWINGLAYER_DLLPUBLIC LineAttribute
+{
+public:
+ typedef o3tl::cow_wrapper<ImpLineAttribute> ImplType;
+
+private:
+ ImplType mpLineAttribute;
+
+public:
+ /// constructors/assignmentoperator/destructor
+ explicit LineAttribute(const basegfx::BColor& rColor, double fWidth = 0.0,
+ basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLineJoin::Round,
+ css::drawing::LineCap aLineCap = css::drawing::LineCap_BUTT,
+ double fMiterMinimumAngle = basegfx::deg2rad(15.0));
+ LineAttribute();
+ LineAttribute(const LineAttribute&);
+ LineAttribute& operator=(const LineAttribute&);
+ ~LineAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const LineAttribute& rCandidate) const;
+
+ // data read access
+ const basegfx::BColor& getColor() const;
+ double getWidth() const;
+ basegfx::B2DLineJoin getLineJoin() const;
+ css::drawing::LineCap getLineCap() const;
+ double getMiterMinimumAngle() const;
+};
+} // end of namespace drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/linestartendattribute.hxx b/include/drawinglayer/attribute/linestartendattribute.hxx
new file mode 100644
index 000000000..f894a335d
--- /dev/null
+++ b/include/drawinglayer/attribute/linestartendattribute.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+namespace basegfx
+{
+class B2DPolyPolygon;
+}
+
+namespace drawinglayer::attribute
+{
+class ImpLineStartEndAttribute;
+}
+
+namespace drawinglayer::attribute
+{
+class DRAWINGLAYER_DLLPUBLIC LineStartEndAttribute
+{
+public:
+ typedef o3tl::cow_wrapper<ImpLineStartEndAttribute> ImplType;
+
+private:
+ ImplType mpLineStartEndAttribute;
+
+public:
+ /// constructors/assignmentoperator/destructor
+ LineStartEndAttribute(double fWidth, const basegfx::B2DPolyPolygon& rPolyPolygon,
+ bool bCentered);
+ LineStartEndAttribute();
+ LineStartEndAttribute(const LineStartEndAttribute&);
+ LineStartEndAttribute& operator=(const LineStartEndAttribute&);
+ ~LineStartEndAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const LineStartEndAttribute& rCandidate) const;
+
+ // data read access
+ double getWidth() const;
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const;
+ bool isCentered() const;
+ bool isActive() const;
+};
+
+} // end of namespace drawinglayer::attribute
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/materialattribute3d.hxx b/include/drawinglayer/attribute/materialattribute3d.hxx
new file mode 100644
index 000000000..07c11e302
--- /dev/null
+++ b/include/drawinglayer/attribute/materialattribute3d.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+
+// predefines
+
+namespace drawinglayer::attribute {
+ class ImpMaterialAttribute3D;
+}
+
+namespace basegfx {
+ class BColor;
+}
+
+
+namespace drawinglayer::attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC MaterialAttribute3D
+ {
+ public:
+ typedef o3tl::cow_wrapper<ImpMaterialAttribute3D, o3tl::ThreadSafeRefCountingPolicy> ImplType;
+
+ private:
+ ImplType mpMaterialAttribute3D;
+
+ public:
+ // constructors/destructor
+ MaterialAttribute3D(
+ const basegfx::BColor& rColor,
+ const basegfx::BColor& rSpecular,
+ const basegfx::BColor& rEmission,
+ sal_uInt16 nSpecularIntensity);
+ MaterialAttribute3D(const basegfx::BColor& rColor);
+ MaterialAttribute3D();
+ MaterialAttribute3D(const MaterialAttribute3D&);
+ ~MaterialAttribute3D();
+
+ // assignment operator
+ MaterialAttribute3D& operator=(const MaterialAttribute3D&);
+
+ // compare operator
+ bool operator==(const MaterialAttribute3D& rCandidate) const;
+
+ // data read access
+ const basegfx::BColor& getColor() const;
+ const basegfx::BColor& getSpecular() const;
+ const basegfx::BColor& getEmission() const;
+ sal_uInt16 getSpecularIntensity() const;
+ };
+
+} // end of namespace drawinglayer::attribute
+
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrallattribute3d.hxx b/include/drawinglayer/attribute/sdrallattribute3d.hxx
new file mode 100644
index 000000000..d0b1101aa
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrallattribute3d.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+
+// predefines
+
+
+namespace drawinglayer::attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLineFillShadowAttribute3D
+ {
+ private:
+ const SdrLineAttribute maLine;
+ const SdrFillAttribute maFill;
+ const SdrLineStartEndAttribute maLineStartEnd;
+ const SdrShadowAttribute maShadow;
+ const FillGradientAttribute maFillFloatTransGradient;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLineFillShadowAttribute3D(
+ const SdrLineAttribute& rLine,
+ const SdrFillAttribute& rFill,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const FillGradientAttribute& rFillFloatTransGradient);
+ SdrLineFillShadowAttribute3D();
+
+ // compare operator
+ bool operator==(const SdrLineFillShadowAttribute3D& rCandidate) const;
+
+ // data read access
+ const SdrLineAttribute& getLine() const { return maLine; }
+ const SdrFillAttribute& getFill() const { return maFill; }
+ const SdrShadowAttribute& getShadow() const { return maShadow; }
+ const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; }
+ };
+
+} // end of namespace drawinglayer::overlay
+
+
+#endif // INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrfillattribute.hxx b/include/drawinglayer/attribute/sdrfillattribute.hxx
new file mode 100644
index 000000000..6ba140065
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrfillattribute.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer::attribute {
+ class ImpSdrFillAttribute;
+ class FillGradientAttribute;
+ class FillHatchAttribute;
+ class SdrFillGraphicAttribute;
+}
+
+
+namespace drawinglayer::attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrFillAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrFillAttribute > ImplType;
+
+ private:
+ ImplType mpSdrFillAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrFillAttribute(
+ double fTransparence,
+ const basegfx::BColor& rColor,
+ const FillGradientAttribute& rGradient,
+ const FillHatchAttribute& rHatch,
+ const SdrFillGraphicAttribute& rFillGraphic);
+ SdrFillAttribute(bool bSlideBackgroundFill = false);
+ SdrFillAttribute(const SdrFillAttribute&);
+ SdrFillAttribute(SdrFillAttribute&&);
+ SdrFillAttribute& operator=(const SdrFillAttribute&);
+ SdrFillAttribute& operator=(SdrFillAttribute&&);
+ ~SdrFillAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // checks if the incarnation is slideBackgroundFill
+ bool isSlideBackgroundFill() const;
+
+ // compare operator
+ bool operator==(const SdrFillAttribute& rCandidate) const;
+
+ // data read access
+ double getTransparence() const;
+ const basegfx::BColor& getColor() const;
+ const FillGradientAttribute& getGradient() const;
+ const FillHatchAttribute& getHatch() const;
+ const SdrFillGraphicAttribute& getFillGraphic() const;
+ };
+
+} // end of namespace drawinglayer::attribute
+
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrfillgraphicattribute.hxx b/include/drawinglayer/attribute/sdrfillgraphicattribute.hxx
new file mode 100644
index 000000000..4a39313d1
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrfillgraphicattribute.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLGRAPHICATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLGRAPHICATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+
+// predefines
+
+class Graphic;
+
+namespace basegfx {
+ class B2DRange;
+ class B2DVector;
+}
+
+namespace drawinglayer::attribute {
+ class FillGraphicAttribute;
+ class ImpSdrFillGraphicAttribute;
+}
+
+
+namespace drawinglayer::attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrFillGraphicAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrFillGraphicAttribute > ImplType;
+
+ private:
+ ImplType mpSdrFillGraphicAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrFillGraphicAttribute(
+ const Graphic& rFillGraphic,
+ const basegfx::B2DVector& rGraphicLogicSize,
+ const basegfx::B2DVector& rSize,
+ const basegfx::B2DVector& rOffset,
+ const basegfx::B2DVector& rOffsetPosition,
+ const basegfx::B2DVector& rRectPoint,
+ bool bTiling,
+ bool bStretch,
+ bool bLogSize);
+ SdrFillGraphicAttribute();
+ SdrFillGraphicAttribute(const SdrFillGraphicAttribute&);
+ SdrFillGraphicAttribute(SdrFillGraphicAttribute&&);
+ SdrFillGraphicAttribute& operator=(const SdrFillGraphicAttribute&);
+ SdrFillGraphicAttribute& operator=(SdrFillGraphicAttribute&&);
+ ~SdrFillGraphicAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrFillGraphicAttribute& rCandidate) const;
+
+ // data read access
+ const Graphic& getFillGraphic() const;
+ const basegfx::B2DVector& getGraphicLogicSize() const;
+ const basegfx::B2DVector& getSize() const;
+ const basegfx::B2DVector& getOffset() const;
+ const basegfx::B2DVector& getOffsetPosition() const;
+ const basegfx::B2DVector& getRectPoint() const;
+ bool getTiling() const;
+
+ // FillGraphicAttribute generator
+ FillGraphicAttribute createFillGraphicAttribute(const basegfx::B2DRange& rRange) const;
+ };
+
+} // end of namespace drawinglayer::attribute
+
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLGRAPHICATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrglowattribute.hxx b/include/drawinglayer/attribute/sdrglowattribute.hxx
new file mode 100644
index 000000000..d4045bbc1
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrglowattribute.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRGLOWATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRGLOWATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <tools/color.hxx>
+
+namespace drawinglayer::attribute
+{
+class DRAWINGLAYER_DLLPUBLIC SdrGlowAttribute
+{
+private:
+ sal_Int32 m_nRadius = 0;
+ Color m_color; // Includes alpha!
+
+public:
+ SdrGlowAttribute(sal_Int32 nRadius, const Color& rColor);
+ SdrGlowAttribute();
+ SdrGlowAttribute(const SdrGlowAttribute&);
+ SdrGlowAttribute(SdrGlowAttribute&&);
+
+ bool operator==(const SdrGlowAttribute& rCandidate) const;
+
+ SdrGlowAttribute& operator=(const SdrGlowAttribute&);
+ SdrGlowAttribute& operator=(SdrGlowAttribute&&);
+
+ // data access
+ const Color& getColor() const { return m_color; }
+ sal_Int32 getRadius() const { return m_nRadius; }
+ bool isDefault() const { return m_nRadius == 0; }
+};
+
+} // end of namespace drawinglayer::attribute
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRGLOWATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlightattribute3d.hxx b/include/drawinglayer/attribute/sdrlightattribute3d.hxx
new file mode 100644
index 000000000..b3c1fcaaa
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlightattribute3d.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+
+// predefines
+
+namespace basegfx {
+ class BColor;
+ class B3DVector;
+}
+
+namespace drawinglayer::attribute {
+ class ImpSdr3DLightAttribute;
+}
+
+
+namespace drawinglayer::attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC Sdr3DLightAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdr3DLightAttribute > ImplType;
+
+ private:
+ ImplType mpSdr3DLightAttribute;
+
+ public:
+ // constructors/destructor
+ Sdr3DLightAttribute(
+ const basegfx::BColor& rColor,
+ const basegfx::B3DVector& rDirection,
+ bool bSpecular);
+ Sdr3DLightAttribute(const Sdr3DLightAttribute&);
+ ~Sdr3DLightAttribute();
+
+ // assignment operator
+ Sdr3DLightAttribute& operator=(const Sdr3DLightAttribute&);
+
+ // compare operator
+ bool operator==(const Sdr3DLightAttribute& rCandidate) const;
+
+ // data read access
+ const basegfx::BColor& getColor() const;
+ const basegfx::B3DVector& getDirection() const;
+ bool getSpecular() const;
+ };
+
+} // end of namespace drawinglayer::attribute
+
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlightingattribute3d.hxx b/include/drawinglayer/attribute/sdrlightingattribute3d.hxx
new file mode 100644
index 000000000..ae2155a54
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlightingattribute3d.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+#include <vector>
+
+
+// predefines
+
+namespace basegfx {
+ class BColor;
+ class B3DVector;
+}
+
+namespace drawinglayer::attribute {
+ class ImpSdrLightingAttribute;
+ class Sdr3DLightAttribute;
+}
+
+
+namespace drawinglayer::attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLightingAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrLightingAttribute > ImplType;
+
+ private:
+ ImplType mpSdrLightingAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLightingAttribute(
+ const basegfx::BColor& rAmbientLight,
+ std::vector< Sdr3DLightAttribute >&& rLightVector);
+ SdrLightingAttribute();
+ SdrLightingAttribute(const SdrLightingAttribute& rCandidate);
+ SdrLightingAttribute(SdrLightingAttribute&& rCandidate);
+ SdrLightingAttribute& operator=(const SdrLightingAttribute& rCandidate);
+ SdrLightingAttribute& operator=(SdrLightingAttribute&& rCandidate);
+ ~SdrLightingAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrLightingAttribute& rCandidate) const;
+
+ // data read access
+ const basegfx::BColor& getAmbientLightColor() const;
+ const ::std::vector< Sdr3DLightAttribute >& getLightVector() const;
+
+ // color model solver
+ basegfx::BColor solveColorModel(
+ const basegfx::B3DVector& rNormalInEyeCoordinates,
+ const basegfx::BColor& rColor, const basegfx::BColor& rSpecular,
+ const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const;
+ };
+
+} // end of namespace drawinglayer::attribute
+
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlineattribute.hxx b/include/drawinglayer/attribute/sdrlineattribute.hxx
new file mode 100644
index 000000000..2fa9c39f0
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlineattribute.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <basegfx/vector/b2enums.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <o3tl/cow_wrapper.hxx>
+#include <vector>
+
+
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer::attribute {
+ class ImpSdrLineAttribute;
+}
+
+
+namespace drawinglayer::attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLineAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrLineAttribute > ImplType;
+
+ private:
+ ImplType mpSdrLineAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLineAttribute(
+ basegfx::B2DLineJoin eJoin,
+ double fWidth,
+ double fTransparence,
+ const basegfx::BColor& rColor,
+ css::drawing::LineCap eCap,
+ std::vector< double >&& rDotDashArray,
+ double fFullDotDashLen);
+ SdrLineAttribute();
+ SdrLineAttribute(const SdrLineAttribute&);
+ SdrLineAttribute(SdrLineAttribute&&);
+ SdrLineAttribute& operator=(const SdrLineAttribute&);
+ SdrLineAttribute& operator=(SdrLineAttribute&&);
+ ~SdrLineAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrLineAttribute& rCandidate) const;
+
+ // data access
+ basegfx::B2DLineJoin getJoin() const;
+ double getWidth() const;
+ double getTransparence() const;
+ const basegfx::BColor& getColor() const;
+ const ::std::vector< double >& getDotDashArray() const;
+ double getFullDotDashLen() const;
+ css::drawing::LineCap getCap() const;
+ };
+
+} // end of namespace drawinglayer::attribute
+
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlinestartendattribute.hxx b/include/drawinglayer/attribute/sdrlinestartendattribute.hxx
new file mode 100644
index 000000000..afcf1fd6d
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlinestartendattribute.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+
+// predefines
+
+namespace basegfx {
+ class B2DPolyPolygon;
+}
+
+namespace drawinglayer::attribute {
+ class ImpSdrLineStartEndAttribute;
+}
+
+
+namespace drawinglayer::attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLineStartEndAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrLineStartEndAttribute > ImplType;
+
+ private:
+ ImplType mpSdrLineStartEndAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLineStartEndAttribute(
+ const basegfx::B2DPolyPolygon& rStartPolyPolygon,
+ const basegfx::B2DPolyPolygon& rEndPolyPolygon,
+ double fStartWidth,
+ double fEndWidth,
+ bool bStartActive,
+ bool bEndActive,
+ bool bStartCentered,
+ bool bEndCentered);
+ SdrLineStartEndAttribute();
+ SdrLineStartEndAttribute(const SdrLineStartEndAttribute&);
+ SdrLineStartEndAttribute(SdrLineStartEndAttribute&&);
+ SdrLineStartEndAttribute& operator=(const SdrLineStartEndAttribute&);
+ SdrLineStartEndAttribute& operator=(SdrLineStartEndAttribute&&);
+ ~SdrLineStartEndAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrLineStartEndAttribute& rCandidate) const;
+
+ // data read access
+ const basegfx::B2DPolyPolygon& getStartPolyPolygon() const;
+ const basegfx::B2DPolyPolygon& getEndPolyPolygon() const;
+ double getStartWidth() const;
+ double getEndWidth() const;
+ bool isStartActive() const;
+ bool isEndActive() const;
+ bool isStartCentered() const;
+ bool isEndCentered() const;
+ };
+
+} // end of namespace drawinglayer::attribute
+
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrobjectattribute3d.hxx b/include/drawinglayer/attribute/sdrobjectattribute3d.hxx
new file mode 100644
index 000000000..0a2889d3e
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrobjectattribute3d.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/drawing/TextureKind2.hpp>
+#include <com/sun/star/drawing/TextureMode.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+
+// predefines
+
+namespace drawinglayer::attribute {
+ class ImpSdr3DObjectAttribute;
+ class MaterialAttribute3D;
+}
+
+
+namespace drawinglayer::attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC Sdr3DObjectAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdr3DObjectAttribute > ImplType;
+
+ private:
+ ImplType mpSdr3DObjectAttribute;
+
+ public:
+ // constructors/destructor
+ Sdr3DObjectAttribute(
+ css::drawing::NormalsKind aNormalsKind,
+ css::drawing::TextureProjectionMode aTextureProjectionX,
+ css::drawing::TextureProjectionMode aTextureProjectionY,
+ css::drawing::TextureKind2 aTextureKind,
+ css::drawing::TextureMode aTextureMode,
+ const MaterialAttribute3D& rMaterial,
+ bool bNormalsInvert,
+ bool bDoubleSided,
+ bool bShadow3D,
+ bool bTextureFilter,
+ bool bReducedLineGeometry);
+ Sdr3DObjectAttribute(const Sdr3DObjectAttribute&);
+ ~Sdr3DObjectAttribute();
+
+ // assignment operator
+ Sdr3DObjectAttribute& operator=(const Sdr3DObjectAttribute&);
+
+ // compare operator
+ bool operator==(const Sdr3DObjectAttribute& rCandidate) const;
+
+ // data read access
+ css::drawing::NormalsKind getNormalsKind() const;
+ css::drawing::TextureProjectionMode getTextureProjectionX() const;
+ css::drawing::TextureProjectionMode getTextureProjectionY() const;
+ css::drawing::TextureKind2 getTextureKind() const;
+ css::drawing::TextureMode getTextureMode() const;
+ const MaterialAttribute3D& getMaterial() const;
+ bool getNormalsInvert() const;
+ bool getDoubleSided() const;
+ bool getShadow3D() const;
+ bool getTextureFilter() const;
+ bool getReducedLineGeometry() const;
+ };
+
+} // end of namespace drawinglayer::attribute
+
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrsceneattribute3d.hxx b/include/drawinglayer/attribute/sdrsceneattribute3d.hxx
new file mode 100644
index 000000000..fa48207d3
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrsceneattribute3d.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+
+// predefines
+
+namespace drawinglayer::attribute {
+ class ImpSdrSceneAttribute;
+}
+
+
+namespace drawinglayer::attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrSceneAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrSceneAttribute > ImplType;
+
+ private:
+ ImplType mpSdrSceneAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrSceneAttribute(
+ double fDistance,
+ double fShadowSlant,
+ css::drawing::ProjectionMode aProjectionMode,
+ css::drawing::ShadeMode aShadeMode,
+ bool bTwoSidedLighting);
+ SdrSceneAttribute();
+ SdrSceneAttribute(const SdrSceneAttribute&);
+ SdrSceneAttribute(SdrSceneAttribute&&);
+ SdrSceneAttribute& operator=(const SdrSceneAttribute&);
+ SdrSceneAttribute& operator=(SdrSceneAttribute&&);
+ ~SdrSceneAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrSceneAttribute& rCandidate) const;
+
+ // data read access
+ double getShadowSlant() const;
+ css::drawing::ProjectionMode getProjectionMode() const;
+ css::drawing::ShadeMode getShadeMode() const;
+ bool getTwoSidedLighting() const;
+ };
+
+} // end of namespace drawinglayer::attribute
+
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrshadowattribute.hxx b/include/drawinglayer/attribute/sdrshadowattribute.hxx
new file mode 100644
index 000000000..ffe249498
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrshadowattribute.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+
+// predefines
+
+namespace basegfx {
+ class BColor;
+ class B2DVector;
+}
+
+namespace drawinglayer::attribute {
+ class ImpSdrShadowAttribute;
+}
+
+
+namespace drawinglayer::attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrShadowAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrShadowAttribute > ImplType;
+
+ private:
+ ImplType mpSdrShadowAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrShadowAttribute(
+ const basegfx::B2DVector& rOffset,
+ const basegfx::B2DVector& rSize,
+ double fTransparence,
+ sal_Int32 nBlur,
+ const basegfx::BColor& rColor);
+ SdrShadowAttribute();
+ SdrShadowAttribute(const SdrShadowAttribute&);
+ SdrShadowAttribute(SdrShadowAttribute&&);
+ SdrShadowAttribute& operator=(const SdrShadowAttribute&);
+ SdrShadowAttribute& operator=(SdrShadowAttribute&&);
+ ~SdrShadowAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrShadowAttribute& rCandidate) const;
+
+ // data access
+ const basegfx::B2DVector& getOffset() const;
+ const basegfx::B2DVector& getSize() const;
+ double getTransparence() const;
+ sal_Int32 getBlur() const;
+ const basegfx::BColor& getColor() const;
+ };
+
+} // end of namespace drawinglayer::attribute
+
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/strokeattribute.hxx b/include/drawinglayer/attribute/strokeattribute.hxx
new file mode 100644
index 000000000..163a137cb
--- /dev/null
+++ b/include/drawinglayer/attribute/strokeattribute.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <vector>
+
+namespace drawinglayer::attribute
+{
+class ImpStrokeAttribute;
+}
+
+namespace drawinglayer::attribute
+{
+class DRAWINGLAYER_DLLPUBLIC StrokeAttribute
+{
+public:
+ typedef o3tl::cow_wrapper<ImpStrokeAttribute> ImplType;
+
+private:
+ ImplType mpStrokeAttribute;
+
+public:
+ /// constructors/assignmentoperator/destructor
+ explicit StrokeAttribute(std::vector<double>&& rDotDashArray, double fFullDotDashLen = 0.0);
+ StrokeAttribute();
+ StrokeAttribute(const StrokeAttribute&);
+ StrokeAttribute(StrokeAttribute&&);
+ StrokeAttribute& operator=(const StrokeAttribute&);
+ StrokeAttribute& operator=(StrokeAttribute&&);
+ ~StrokeAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const StrokeAttribute& rCandidate) const;
+
+ // data read access
+ const ::std::vector<double>& getDotDashArray() const;
+ double getFullDotDashLen() const;
+};
+} // end of namespace drawinglayer::attribute
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/converters.hxx b/include/drawinglayer/converters.hxx
new file mode 100644
index 000000000..1fda7a2f8
--- /dev/null
+++ b/include/drawinglayer/converters.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vcl/bitmapex.hxx>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+
+namespace drawinglayer
+{
+BitmapEx DRAWINGLAYER_DLLPUBLIC
+convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSeq,
+ const geometry::ViewInformation2D& rViewInformation2D, sal_uInt32 nDiscreteWidth,
+ sal_uInt32 nDiscreteHeight, sal_uInt32 nMaxSquarePixels);
+
+// helper to convert any Primitive2DSequence to a good quality BitmapEx,
+// using default parameters
+BitmapEx DRAWINGLAYER_DLLPUBLIC convertPrimitive2DContainerToBitmapEx(
+ drawinglayer::primitive2d::Primitive2DContainer&& rSeq, const basegfx::B2DRange& rTargetRange,
+ const sal_uInt32 nMaximumQuadraticPixels = 500000,
+ const o3tl::Length eTargetUnit = o3tl::Length::mm100,
+ const std::optional<Size>& rTargetDPI = std::nullopt);
+
+} // end of namespace drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/drawinglayerdllapi.h b/include/drawinglayer/drawinglayerdllapi.h
new file mode 100644
index 000000000..36a0d8abf
--- /dev/null
+++ b/include/drawinglayer/drawinglayerdllapi.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_DRAWINGLAYERDLLAPI_H
+#define INCLUDED_DRAWINGLAYER_DRAWINGLAYERDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(DRAWINGLAYER_DLLIMPLEMENTATION)
+#define DRAWINGLAYER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define DRAWINGLAYER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define DRAWINGLAYER_DLLPRIVATE SAL_DLLPRIVATE
+
+#if defined(DRAWINGLAYERCORE_DLLIMPLEMENTATION)
+#define DRAWINGLAYERCORE_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define DRAWINGLAYERCORE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx
new file mode 100644
index 000000000..2957b7daf
--- /dev/null
+++ b/include/drawinglayer/geometry/viewinformation2d.hxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <sal/config.h>
+#include <o3tl/cow_wrapper.hxx>
+
+// predefines
+
+namespace drawinglayer::geometry
+{
+class ImpViewInformation2D;
+}
+
+namespace basegfx
+{
+class B2DHomMatrix;
+class B2DRange;
+}
+
+namespace com::sun::star::beans
+{
+struct PropertyValue;
+}
+
+namespace com::sun::star::drawing
+{
+class XDrawPage;
+}
+
+namespace com::sun::star::uno
+{
+template <class interface_type> class Reference;
+template <typename> class Sequence;
+}
+
+namespace drawinglayer::geometry
+{
+/** ViewInformation2D class
+
+ This class holds all view-relevant information for a 2d geometry.
+ The most used data is for convenience offered directly using basegfx tooling classes.
+*/
+class DRAWINGLAYERCORE_DLLPUBLIC ViewInformation2D
+{
+public:
+ typedef o3tl::cow_wrapper<ImpViewInformation2D, o3tl::ThreadSafeRefCountingPolicy> ImplType;
+
+private:
+ /// pointer to private implementation class
+ ImplType mpViewInformation2D;
+
+public:
+ /** Constructor: Create a ViewInformation2D
+
+ @param rObjectTransformation
+ The Transformation from Object to World coordinates (normally logic coordinates).
+
+ @param rViewTransformation
+ The Transformation from World to View coordinates (normally logic coordinates
+ to discrete units, e.g. pixels).
+
+ @param rViewport
+ The visible part of the view in World coordinates. If empty (getViewport().isEmpty())
+ everything is visible. The data is in World coordinates.
+
+ @param rxDrawPage
+ The currently displayed page. This information is needed e.g. due to existing PageNumber
+ fields which need to be interpreted.
+
+ @param fViewTime
+ The time the view is defined for. Default is 0.0. This parameter is used e.g. for
+ animated objects
+
+ @param rReducedDisplayQuality
+ */
+ ViewInformation2D(const basegfx::B2DHomMatrix& rObjectTransformation,
+ const basegfx::B2DHomMatrix& rViewTransformation,
+ const basegfx::B2DRange& rViewport,
+ const css::uno::Reference<css::drawing::XDrawPage>& rxDrawPage,
+ double fViewTime, bool bReducedDisplayQuality = false);
+
+ /// default (empty) constructor
+ ViewInformation2D();
+
+ /// copy constructor
+ ViewInformation2D(const ViewInformation2D&);
+
+ ViewInformation2D(ViewInformation2D&&);
+
+ /// destructor
+ ~ViewInformation2D();
+
+ /// assignment operator
+ ViewInformation2D& operator=(const ViewInformation2D&);
+ ViewInformation2D& operator=(ViewInformation2D&&);
+
+ /// compare operators
+ bool operator==(const ViewInformation2D& rCandidate) const;
+ bool operator!=(const ViewInformation2D& rCandidate) const { return !operator==(rCandidate); }
+
+ /// data access
+ const basegfx::B2DHomMatrix& getObjectTransformation() const;
+ const basegfx::B2DHomMatrix& getViewTransformation() const;
+ /// Empty viewport means everything is visible.
+ const basegfx::B2DRange& getViewport() const;
+ double getViewTime() const;
+ const css::uno::Reference<css::drawing::XDrawPage>& getVisualizedPage() const;
+
+ /// On-demand prepared Object to View transformation and its inverse for convenience
+ const basegfx::B2DHomMatrix& getObjectToViewTransformation() const;
+ const basegfx::B2DHomMatrix& getInverseObjectToViewTransformation() const;
+
+ /// On-demand prepared Viewport in discrete units for convenience
+ /// Empty viewport means everything is visible.
+ const basegfx::B2DRange& getDiscreteViewport() const;
+
+ /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
+ is used e.g. to allow to lower display quality for OverlayPrimitives and
+ may lead to simpler decompositions in the local create2DDecomposition
+ implementations of the primitives
+ */
+ bool getReducedDisplayQuality() const;
+};
+
+DRAWINGLAYERCORE_DLLPUBLIC ViewInformation2D
+createViewInformation2D(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters);
+
+} // end of namespace drawinglayer::geometry
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/geometry/viewinformation3d.hxx b/include/drawinglayer/geometry/viewinformation3d.hxx
new file mode 100644
index 000000000..ca368a6c3
--- /dev/null
+++ b/include/drawinglayer/geometry/viewinformation3d.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX
+#define INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <sal/config.h>
+#include <o3tl/cow_wrapper.hxx>
+
+
+// predefines
+
+namespace drawinglayer::geometry {
+ class ImpViewInformation3D;
+}
+
+namespace basegfx {
+ class B3DHomMatrix;
+}
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+
+namespace drawinglayer::geometry
+ {
+ /** ViewInformation3D class
+
+ This class holds all view-relevant information for a 3d geometry. It works
+ together with UNO API definitions and supports holding a sequence of PropertyValues.
+ The most used data is for convenience offered directly using basegfx tooling classes.
+ It is an implementation to support the sequence of PropertyValues used in a
+ css::graphic::XPrimitive3D for C++ implementations working with those
+ */
+ class DRAWINGLAYER_DLLPUBLIC ViewInformation3D
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpViewInformation3D, o3tl::ThreadSafeRefCountingPolicy > ImplType;
+
+ private:
+ /// pointer to private implementation class
+ ImplType mpViewInformation3D;
+
+ public:
+ /** Constructor: Create a ViewInformation3D
+
+ @param rObjectTransformation
+ The Transformation from Object to World coordinates (normally logic coordinates).
+
+ @param rOrientation
+ A part of the 3D ViewTransformation, the World to Camera coordinates transformation
+ which holds the camera coordinate system.
+
+ @param rProjection
+ A part of the 3D ViewTransformation, the Camera to Device transformation which
+ transforms coordinates to a [0.0 .. 1.0] device range in X,Y and Z. Z may be used
+ as source for Z-Buffers. This transformation may be e.g. a parallel projection,
+ but also a perspective one and thus may use the last line of the matrix.
+
+ @param rDeviceToView
+ A part of the 3D ViewTransformation, the Device to View transformation which normally
+ translates and scales from [0.0 .. 1.0] range in X,Y and Z to discrete position and
+ size.
+
+ rOrientation, rProjection and rDeviceToView define the 3D transformation pipeline
+ and are normally used multiplied together to have a direct transformation from
+ World to View coordinates
+
+ @param fViewTime
+ The time the view is defined for. Default is 0.0. This parameter is used e.g. for
+ animated objects
+
+ @param rExtendedParameters
+ A sequence of property values which allows holding various other parameters besides
+ the obvious and needed ones above. For this constructor none of the other parameters
+ should be added as data. The constructor will parse the given parameters and if
+ data for the other parameters is given, the value in rExtendedParameters will
+ be preferred and overwrite the given parameter
+ */
+ ViewInformation3D(
+ const basegfx::B3DHomMatrix& rObjectTransformation,
+ const basegfx::B3DHomMatrix& rOrientation,
+ const basegfx::B3DHomMatrix& rProjection,
+ const basegfx::B3DHomMatrix& rDeviceToView,
+ double fViewTime,
+ const css::uno::Sequence< css::beans::PropertyValue >& rExtendedParameters);
+
+ /** Constructor: Create a ViewInformation3D
+
+ @param rViewParameters
+ A sequence of property values which allows holding any combination of local and various
+ other parameters. This constructor is fed completely with a sequence of PropertyValues
+ which will be parsed to be able to offer the most used ones in a convenient way.
+ */
+ explicit ViewInformation3D(const css::uno::Sequence< css::beans::PropertyValue >& rViewParameters);
+
+ /// default (empty) constructor
+ ViewInformation3D();
+
+ /// copy constructor
+ ViewInformation3D(const ViewInformation3D&);
+
+ ViewInformation3D(ViewInformation3D&&);
+
+ /// destructor
+ ~ViewInformation3D();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ /// assignment operator
+ ViewInformation3D& operator=(const ViewInformation3D&);
+ ViewInformation3D& operator=(ViewInformation3D&&);
+
+ /// compare operators
+ bool operator==(const ViewInformation3D& rCandidate) const;
+ bool operator!=(const ViewInformation3D& rCandidate) const { return !operator==(rCandidate); }
+
+ /// data access
+ const basegfx::B3DHomMatrix& getObjectTransformation() const;
+ const basegfx::B3DHomMatrix& getOrientation() const;
+ const basegfx::B3DHomMatrix& getProjection() const;
+ const basegfx::B3DHomMatrix& getDeviceToView() const;
+ double getViewTime() const;
+
+ /// for convenience, the linear combination of the above four transformations is offered
+ const basegfx::B3DHomMatrix& getObjectToView() const;
+
+ /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
+ not offered directly
+
+ Use this call if You only need ViewInformation which is not offered conveniently,
+ but only exists as PropertyValue. This is e.g. used to create partially updated
+ incarnations of ViewInformation3D without losing the only with PropertyValues
+ defined data. It does not contain a complete description.
+ */
+ const css::uno::Sequence< css::beans::PropertyValue >& getExtendedInformationSequence() const;
+ };
+
+} // end of namespace drawinglayer::geometry
+
+
+#endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx b/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx
new file mode 100644
index 000000000..8087a6544
--- /dev/null
+++ b/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+namespace drawinglayer::geometry
+{
+class ViewInformation2D;
+}
+
+namespace drawinglayer::primitive2d
+{
+/** BufferedDecompositionPrimitive2D class
+
+ Baseclass for all C++ implementations of css::graphic::XPrimitive2D
+ which want to buffer the decomposition result
+
+ Buffering the decomposition is the most-used buffering and is thus used my most
+ primitive implementations which support a decomposition as base class.
+
+ The buffering is done by holding the last decomposition in the local parameter
+ maBuffered2DDecomposition. The default implementation of get2DDecomposition checks
+ if maBuffered2DDecomposition is empty. If yes, it uses create2DDecomposition
+ to create the content. In all cases, maBuffered2DDecomposition is returned.
+
+ For view-dependent primitives derived from Primitive2DBufferDecomposition more needs
+ to be done when the decomposition depends on parts of the parameter ViewInformation2D.
+ This defines a standard method for processing these:
+
+ Implement a view-dependent get2DDecomposition doing the following steps:
+ (a) Locally extract needed parameters from ViewInformation2D to new, local parameters
+ (this may be a complete local copy of ViewInformation2D)
+ (b) If a buffered decomposition exists, ckeck if one of the new local parameters
+ differs from the corresponding locally remembered (as member) ones. If yes,
+ clear maBuffered2DDecomposition
+ (d) call baseclass::get2DDecomposition which will use create2DDecomposition
+ to fill maBuffered2DDecomposition if it's empty
+ (e) copy the new local parameters to the corresponding locally remembered ones
+ to identify if a new decomposition is needed at the next call
+ (f) return maBuffered2DDecomposition
+ */
+class DRAWINGLAYERCORE_DLLPUBLIC BufferedDecompositionPrimitive2D : public BasePrimitive2D
+{
+private:
+ /// a sequence used for buffering the last create2DDecomposition() result
+ Primitive2DContainer maBuffered2DDecomposition;
+
+ /// When a shadow wraps a list of primitives, this primitive wants to influence the transparency
+ /// of the shadow.
+ sal_uInt16 mnTransparenceForShadow = 0;
+
+protected:
+ /** access methods to maBuffered2DDecomposition. The usage of this methods may allow
+ later thread-safe stuff to be added if needed. Only to be used by getDecomposition()
+ implementations for buffering the last decomposition.
+ */
+ const Primitive2DContainer& getBuffered2DDecomposition() const
+ {
+ return maBuffered2DDecomposition;
+ }
+ void setBuffered2DDecomposition(Primitive2DContainer&& rNew)
+ {
+ maBuffered2DDecomposition = std::move(rNew);
+ }
+
+ /** method which is to be used to implement the local decomposition of a 2D primitive. */
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const = 0;
+
+public:
+ // constructor/destructor
+ BufferedDecompositionPrimitive2D();
+
+ /** The getDecomposition default implementation will on demand use create2DDecomposition() if
+ maBuffered2DDecomposition is empty. It will set maBuffered2DDecomposition to this obtained decomposition
+ to buffer it. If the decomposition is also ViewInformation2D-dependent, this method needs to be
+ overridden and the ViewInformation2D for the last decomposition need to be remembered, too, and
+ be used in the next call to decide if the buffered decomposition may be reused or not.
+ */
+ virtual void
+ get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+ void setTransparenceForShadow(sal_uInt16 nTransparenceForShadow)
+ {
+ mnTransparenceForShadow = nTransparenceForShadow;
+ }
+
+ sal_uInt16 getTransparenceForShadow() const { return mnTransparenceForShadow; }
+};
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/CommonTypes.hxx b/include/drawinglayer/primitive2d/CommonTypes.hxx
new file mode 100644
index 000000000..3e14b05da
--- /dev/null
+++ b/include/drawinglayer/primitive2d/CommonTypes.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/graphic/XPrimitive2D.hpp>
+#include <rtl/ref.hxx>
+
+namespace drawinglayer::primitive2d
+{
+class BasePrimitive2D;
+typedef rtl::Reference<BasePrimitive2D> Primitive2DReference;
+typedef css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>> Primitive2DSequence;
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx
new file mode 100644
index 000000000..25b0aad47
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolyPolygonColorPrimitive2D class
+
+ This primitive defines a tools::PolyPolygon filled with a single color.
+ This is one of the non-decomposable primitives, so a renderer
+ should process it.
+ */
+class DRAWINGLAYER_DLLPUBLIC PolyPolygonColorPrimitive2D final : public BasePrimitive2D
+{
+private:
+ /// the tools::PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the polygon fill color
+ basegfx::BColor maBColor;
+
+public:
+ /// constructor
+ PolyPolygonColorPrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx
new file mode 100644
index 000000000..9cdeee03f
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolyPolygonColorPrimitive2D class
+
+ This primitive defines a tools::PolyPolygon filled with a gradient. The
+ decomosition will create a MaskPrimitive2D containing a
+ FillGradientPrimitive2D.
+ */
+class DRAWINGLAYER_DLLPUBLIC PolyPolygonGradientPrimitive2D final
+ : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the tools::PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the definition range
+ basegfx::B2DRange maDefinitionRange;
+
+ /// the gradient definition
+ attribute::FillGradientAttribute maFillGradient;
+
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructors. The one without definition range will use output range as definition range
+ PolyPolygonGradientPrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::FillGradientAttribute& rFillGradient);
+ PolyPolygonGradientPrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B2DRange& rDefinitionRange,
+ const attribute::FillGradientAttribute& rFillGradient);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
+ const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolyPolygonGraphicPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolyPolygonGraphicPrimitive2D.hxx
new file mode 100644
index 000000000..82094a07c
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolyPolygonGraphicPrimitive2D.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <drawinglayer/attribute/fillgraphicattribute.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolyPolygonGraphicPrimitive2D class
+
+ This primitive defines a tools::PolyPolygon filled with bitmap data
+ (including transparence). The decomosition will create a MaskPrimitive2D
+ containing a FillGraphicPrimitive2D.
+ */
+class DRAWINGLAYER_DLLPUBLIC PolyPolygonGraphicPrimitive2D final
+ : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the tools::PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the definition range
+ basegfx::B2DRange maDefinitionRange;
+
+ /// the bitmap fill definition (may include tiling)
+ attribute::FillGraphicAttribute maFillGraphic;
+
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ PolyPolygonGraphicPrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B2DRange& rDefinitionRange,
+ const attribute::FillGraphicAttribute& rFillGraphic);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
+ const attribute::FillGraphicAttribute& getFillGraphic() const { return maFillGraphic; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolyPolygonHairlinePrimitive2D.hxx b/include/drawinglayer/primitive2d/PolyPolygonHairlinePrimitive2D.hxx
new file mode 100644
index 000000000..1cab074fa
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolyPolygonHairlinePrimitive2D.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolyPolygonHairlinePrimitive2D class
+
+ This primitive defines a multi-PolygonHairlinePrimitive2D and is
+ just for convenience. The definition is not different from the single
+ defined PolygonHairlinePrimitive2Ds.
+ */
+class DRAWINGLAYER_DLLPUBLIC PolyPolygonHairlinePrimitive2D final
+ : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the hairline geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the hairline color
+ basegfx::BColor maBColor;
+
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolyPolygonHatchPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolyPolygonHatchPrimitive2D.hxx
new file mode 100644
index 000000000..960d2e600
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolyPolygonHatchPrimitive2D.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolyPolygonHatchPrimitive2D class
+
+ This primitive defines a tools::PolyPolygon filled with a hatch. The
+ decomosition will create a MaskPrimitive2D containing a
+ FillHatchPrimitive2D.
+ */
+class DRAWINGLAYER_DLLPUBLIC PolyPolygonHatchPrimitive2D final
+ : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the tools::PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the definition range
+ basegfx::B2DRange maDefinitionRange;
+
+ /// the hatch background color (if used)
+ basegfx::BColor maBackgroundColor;
+
+ /// the hatch definition
+ attribute::FillHatchAttribute maFillHatch;
+
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructors. The one without definition range will use output range as definition range
+ PolyPolygonHatchPrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rBackgroundColor,
+ const attribute::FillHatchAttribute& rFillHatch);
+ PolyPolygonHatchPrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B2DRange& rDefinitionRange,
+ const basegfx::BColor& rBackgroundColor,
+ const attribute::FillHatchAttribute& rFillHatch);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
+ const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; }
+ const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolyPolygonMarkerPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolyPolygonMarkerPrimitive2D.hxx
new file mode 100644
index 000000000..b2dc64630
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolyPolygonMarkerPrimitive2D.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+namespace drawinglayer::primitive2d
+{
+// PolyPolygonMarkerPrimitive2D class
+
+/** PolyPolygonMarkerPrimitive2D class
+
+ This primitive defines a multi-PolygonMarkerPrimitive2D and is
+ just for convenience. The definition is not different from the single
+ defined PolygonMarkerPrimitive2Ds.
+ */
+class DRAWINGLAYER_DLLPUBLIC PolyPolygonMarkerPrimitive2D final
+ : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the marker hairline geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the two colors
+ basegfx::BColor maRGBColorA;
+ basegfx::BColor maRGBColorB;
+
+ /// the dash distance in 'pixels'
+ double mfDiscreteDashLength;
+
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ PolyPolygonMarkerPrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB, double fDiscreteDashLength);
+
+ // data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
+ const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolyPolygonSelectionPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolyPolygonSelectionPrimitive2D.hxx
new file mode 100644
index 000000000..59f1327f0
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolyPolygonSelectionPrimitive2D.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolyPolygonSelectionPrimitive2D class
+
+ This primitive defines a tools::PolyPolygon which gets filled with a defined color
+ and a defined transparence, but also gets extended ('grown') by the given
+ discrete size (thus being a view-dependent primitive)
+ */
+class DRAWINGLAYER_DLLPUBLIC PolyPolygonSelectionPrimitive2D final
+ : public DiscreteMetricDependentPrimitive2D
+{
+private:
+ /// the tools::PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the color
+ basegfx::BColor maColor;
+
+ /// the transparence [0.0 .. 1.0]
+ double mfTransparence;
+
+ /// the discrete grow size ('pixels'), only positive values allowed
+ double mfDiscreteGrow;
+
+ /// draw polygons filled when fill is set
+ bool mbFill : 1;
+
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ PolyPolygonSelectionPrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rColor, double fTransparence,
+ double fDiscreteGrow, bool bFill);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getColor() const { return maColor; }
+ double getTransparence() const { return mfTransparence; }
+ double getDiscreteGrow() const { return mfDiscreteGrow; }
+ bool getFill() const { return mbFill; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolyPolygonStrokePrimitive2D.hxx b/include/drawinglayer/primitive2d/PolyPolygonStrokePrimitive2D.hxx
new file mode 100644
index 000000000..94a58b466
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolyPolygonStrokePrimitive2D.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolyPolygonStrokePrimitive2D class
+
+ This primitive defines a multi-PolygonStrokePrimitive2D and is
+ just for convenience. The definition is not different from the single
+ defined PolygonStrokePrimitive2Ds.
+ */
+class DRAWINGLAYER_DLLPUBLIC PolyPolygonStrokePrimitive2D final
+ : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the line geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the line attributes like width, join and color
+ attribute::LineAttribute maLineAttribute;
+
+ /// the line stroking (if used)
+ attribute::StrokeAttribute maStrokeAttribute;
+
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ PolyPolygonStrokePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute);
+
+ PolyPolygonStrokePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::LineAttribute& rLineAttribute);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx b/include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx
new file mode 100644
index 000000000..d05782786
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolygonHairlinePrimitive2D class
+
+ This primitive defines a Hairline. Since hairlines are view-dependent,
+ this primitive is view-dependent, too.
+
+ This is one of the non-decomposable primitives, so a renderer
+ should process it.
+ */
+class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive2D final : public BasePrimitive2D
+{
+private:
+ /// the hairline geometry
+ basegfx::B2DPolygon maPolygon;
+
+ /// the hairline color
+ basegfx::BColor maBColor;
+
+public:
+ /// constructor
+ PolygonHairlinePrimitive2D(const basegfx::B2DPolygon& rPolygon, const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolygonMarkerPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolygonMarkerPrimitive2D.hxx
new file mode 100644
index 000000000..9bdcb5352
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolygonMarkerPrimitive2D.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolygonMarkerPrimitive2D class
+
+ This primitive defines a two-colored marker hairline which is
+ dashed with the given dash length. Since hairlines are view-dependent,
+ this primitive is view-dependent, too.
+
+ It will be decomposed to the needed PolygonHairlinePrimitive2D if
+ not handled directly by a renderer.
+ */
+class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D final
+ : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the marker hairline geometry
+ basegfx::B2DPolygon maPolygon;
+
+ /// the two colors
+ basegfx::BColor maRGBColorA;
+ basegfx::BColor maRGBColorB;
+
+ /// the dash distance in 'pixels'
+ double mfDiscreteDashLength;
+
+ /// decomposition is view-dependent, remember last InverseObjectToViewTransformation
+ basegfx::B2DHomMatrix maLastInverseObjectToViewTransformation;
+
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ PolygonMarkerPrimitive2D(const basegfx::B2DPolygon& rPolygon, const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB, double fDiscreteDashLength);
+
+ /// data read access
+ const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
+ const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
+ const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// Override standard getDecomposition to be view-dependent here
+ virtual void
+ get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolygonStrokeArrowPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolygonStrokeArrowPrimitive2D.hxx
new file mode 100644
index 000000000..2577ffdfb
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolygonStrokeArrowPrimitive2D.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx>
+#include <drawinglayer/attribute/linestartendattribute.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolygonStrokeArrowPrimitive2D class
+
+ This primitive defines a PolygonStrokePrimitive2D,
+ possibly extended by start and end definitions, which are
+ normally used for arrows.
+ */
+class DRAWINGLAYER_DLLPUBLIC PolygonStrokeArrowPrimitive2D final : public PolygonStrokePrimitive2D
+{
+private:
+ /// geometric definitions for line start and end
+ attribute::LineStartEndAttribute maStart;
+ attribute::LineStartEndAttribute maEnd;
+
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ PolygonStrokeArrowPrimitive2D(const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute,
+ const attribute::LineStartEndAttribute& rStart,
+ const attribute::LineStartEndAttribute& rEnd);
+
+ /// constructor without stroking
+ PolygonStrokeArrowPrimitive2D(const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::LineStartEndAttribute& rStart,
+ const attribute::LineStartEndAttribute& rEnd);
+
+ /// data read access
+ const attribute::LineStartEndAttribute& getStart() const { return maStart; }
+ const attribute::LineStartEndAttribute& getEnd() const { return maEnd; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx b/include/drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx
new file mode 100644
index 000000000..ab1566033
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolygonStrokePrimitive2D class
+
+ This primitive defines a line with line width, line join, line color
+ and stroke attributes. It will be decomposed dependent on the definition
+ to the needed primitives, e.g. filled PolyPolygons for fat lines.
+ */
+class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the line geometry
+ basegfx::B2DPolygon maPolygon;
+
+ /// the line attributes like width, join and color
+ attribute::LineAttribute maLineAttribute;
+
+ /// the line stroking (if used)
+ attribute::StrokeAttribute maStrokeAttribute;
+
+protected:
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ PolygonStrokePrimitive2D(const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute);
+
+ /// constructor without stroking
+ PolygonStrokePrimitive2D(const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute);
+
+ /// data read access
+ const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
+ const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolygonWavePrimitive2D.hxx b/include/drawinglayer/primitive2d/PolygonWavePrimitive2D.hxx
new file mode 100644
index 000000000..72d875a5e
--- /dev/null
+++ b/include/drawinglayer/primitive2d/PolygonWavePrimitive2D.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** PolygonWavePrimitive2D class
+
+ This primitive defines a waveline based on a PolygonStrokePrimitive2D
+ where the wave is defined by wave width and wave length.
+ */
+class PolygonWavePrimitive2D final : public PolygonStrokePrimitive2D
+{
+private:
+ /// wave definition
+ double mfWaveWidth;
+ double mfWaveHeight;
+
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ PolygonWavePrimitive2D(const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute, double fWaveWidth,
+ double fWaveHeight);
+
+ /// constructor without stroking
+ PolygonWavePrimitive2D(const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute, double fWaveWidth,
+ double fWaveHeight);
+
+ /// data read access
+ double getWaveWidth() const { return mfWaveWidth; }
+ double getWaveHeight() const { return mfWaveHeight; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
new file mode 100644
index 000000000..2368ea45c
--- /dev/null
+++ b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/CommonTypes.hxx>
+#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
+
+#include <basegfx/range/b2drange.hxx>
+#include <deque>
+
+namespace drawinglayer::geometry
+{
+class ViewInformation2D;
+}
+
+namespace drawinglayer::primitive2d
+{
+class SAL_WARN_UNUSED DRAWINGLAYERCORE_DLLPUBLIC Primitive2DContainer final
+ : public std::deque<Primitive2DReference>,
+ public Primitive2DDecompositionVisitor
+{
+public:
+ // use zero because we allocate a lot of empty containers
+ explicit Primitive2DContainer()
+ : deque(0)
+ {
+ }
+ explicit Primitive2DContainer(size_type count)
+ : deque(count)
+ {
+ }
+ virtual ~Primitive2DContainer() override;
+ Primitive2DContainer(const Primitive2DContainer& other)
+ : deque(other)
+ {
+ }
+ Primitive2DContainer(Primitive2DContainer&& other) noexcept
+ : deque(std::move(other))
+ {
+ }
+ Primitive2DContainer(std::initializer_list<Primitive2DReference> init)
+ : deque(init)
+ {
+ }
+ Primitive2DContainer(
+ const css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>>&);
+ Primitive2DContainer(const std::deque<css::uno::Reference<css::graphic::XPrimitive2D>>&);
+
+ virtual void visit(const Primitive2DReference& rSource) override { append(rSource); }
+ virtual void visit(const Primitive2DContainer& rSource) override { append(rSource); }
+ virtual void visit(Primitive2DContainer&& rSource) override { append(std::move(rSource)); }
+
+ void append(const Primitive2DReference&);
+ void append(const Primitive2DContainer& rSource);
+ void append(Primitive2DContainer&& rSource);
+ Primitive2DContainer& operator=(const Primitive2DContainer& r)
+ {
+ deque::operator=(r);
+ return *this;
+ }
+ Primitive2DContainer& operator=(Primitive2DContainer&& r) noexcept
+ {
+ deque::operator=(std::move(r));
+ return *this;
+ }
+ bool operator==(const Primitive2DContainer& rB) const;
+ bool operator!=(const Primitive2DContainer& rB) const { return !operator==(rB); }
+ basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& aViewInformation) const;
+ Primitive2DContainer maybeInvert(bool bInvert = false);
+
+ css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>> toSequence() const;
+};
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx b/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
new file mode 100644
index 000000000..559a82c66
--- /dev/null
+++ b/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/CommonTypes.hxx>
+
+namespace drawinglayer::primitive2d
+{
+class Primitive2DContainer;
+
+// Visitor class for walking a tree of Primitive2DReference
+class DRAWINGLAYERCORE_DLLPUBLIC Primitive2DDecompositionVisitor
+{
+public:
+ virtual void visit(const Primitive2DReference&) = 0;
+ virtual void visit(const Primitive2DContainer&) = 0;
+ virtual void visit(Primitive2DContainer&&) = 0;
+ virtual ~Primitive2DDecompositionVisitor() {}
+};
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/Tools.hxx b/include/drawinglayer/primitive2d/Tools.hxx
new file mode 100644
index 000000000..3eaa322d9
--- /dev/null
+++ b/include/drawinglayer/primitive2d/Tools.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/CommonTypes.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/range/b2drange.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/// get B2DRange from a given Primitive2DReference
+basegfx::B2DRange DRAWINGLAYERCORE_DLLPUBLIC getB2DRangeFromPrimitive2DReference(
+ const Primitive2DReference& rCandidate, const geometry::ViewInformation2D& aViewInformation);
+
+/** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
+ and using compare operator
+ */
+bool DRAWINGLAYERCORE_DLLPUBLIC arePrimitive2DReferencesEqual(const Primitive2DReference& rA,
+ const Primitive2DReference& rB);
+
+/** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
+ and using compare operator
+ */
+bool DRAWINGLAYERCORE_DLLPUBLIC
+arePrimitive2DReferencesEqual(const css::uno::Reference<css::graphic::XPrimitive2D>& rA,
+ const css::uno::Reference<css::graphic::XPrimitive2D>& rB);
+
+OUString DRAWINGLAYERCORE_DLLPUBLIC idToString(sal_uInt32 nId);
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/animatedprimitive2d.hxx b/include/drawinglayer/primitive2d/animatedprimitive2d.hxx
new file mode 100644
index 000000000..61ff4d33e
--- /dev/null
+++ b/include/drawinglayer/primitive2d/animatedprimitive2d.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <memory>
+
+// predefines
+namespace drawinglayer::animation
+{
+class AnimationEntry;
+}
+
+namespace basegfx
+{
+class B2DHomMatrix;
+}
+
+namespace drawinglayer::primitive2d
+{
+/** AnimatedSwitchPrimitive2D class
+
+ This is the basic class for simple, animated primitives. The basic idea
+ is to have an animation definition (AnimationEntry) who's basic
+ functionality is to return a state value for any given animation time in
+ the range of [0.0 .. 1.0]. Depending on the state, the decomposition
+ calculates an index, which of the members of the child vector is to
+ be visualized.
+
+ An example: For blinking, the Child vector should exist of two entries;
+ for values of [0.0 .. 0.5] the first, else the last entry will be used.
+ This mechanism is not limited to two entries, though.
+ */
+class DRAWINGLAYER_DLLPUBLIC AnimatedSwitchPrimitive2D : public GroupPrimitive2D
+{
+private:
+ /**
+ The animation definition which allows translation of a point in time
+ to an animation state [0.0 .. 1.0]. This member contains a cloned
+ definition and is owned by this implementation.
+ */
+ std::unique_ptr<animation::AnimationEntry> mpAnimationEntry;
+
+ /** flag if this is a text or graphic animation. Necessary since SdrViews need to differentiate
+ between both types if they are on/off
+ */
+ bool mbIsTextAnimation : 1;
+
+protected:
+ /** write access right for classes deriving from this who want to do special
+ things (e.g. optimization, buffering).
+ Caution: This is an exception from the read-only, non-modifiable paradigm
+ for primitives, so special preparations may be needed. Usually should
+ only be used for initialization (e.g. in a derived constructor)
+ */
+ void setAnimationEntry(const animation::AnimationEntry& rNew);
+
+public:
+ /// constructor
+ AnimatedSwitchPrimitive2D(const animation::AnimationEntry& rAnimationEntry,
+ Primitive2DContainer&& aChildren, bool bIsTextAnimation);
+
+ /// destructor - needed due to mpAnimationEntry
+ virtual ~AnimatedSwitchPrimitive2D() override;
+
+ /// data read access
+ const animation::AnimationEntry& getAnimationEntry() const { return *mpAnimationEntry; }
+ bool isTextAnimation() const { return mbIsTextAnimation; }
+ bool isGraphicAnimation() const { return !isTextAnimation(); }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+
+ /** Override getDecomposition() here since the decompose
+ depends on the point in time, so the default implementation is
+ not useful here, it needs to be handled locally
+ */
+ virtual void
+ get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+};
+
+/** AnimatedBlinkPrimitive2D class
+
+ Basically the same mechanism as in AnimatedSwitchPrimitive2D, but the
+ decomposition is specialized in delivering the children in the
+ range [0.0.. 0.5] and an empty sequence else
+ */
+class DRAWINGLAYER_DLLPUBLIC AnimatedBlinkPrimitive2D final : public AnimatedSwitchPrimitive2D
+{
+public:
+ /// constructor
+ AnimatedBlinkPrimitive2D(const animation::AnimationEntry& rAnimationEntry,
+ Primitive2DContainer&& aChildren);
+
+ /// create local decomposition
+ virtual void
+ get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+/** AnimatedInterpolatePrimitive2D class
+
+ Specialized on multi-step animations based on matrix transformations. The
+ Child sequence will be embedded in a matrix transformation. That transformation
+ will be linearly combined from the decomposed values and the animation value
+ to allow a smooth animation.
+ */
+class DRAWINGLAYER_DLLPUBLIC AnimatedInterpolatePrimitive2D final : public AnimatedSwitchPrimitive2D
+{
+private:
+ /// the transformations
+ std::vector<basegfx::utils::B2DHomMatrixBufferedDecompose> maMatrixStack;
+
+public:
+ /// constructor
+ AnimatedInterpolatePrimitive2D(const std::vector<basegfx::B2DHomMatrix>& rmMatrixStack,
+ const animation::AnimationEntry& rAnimationEntry,
+ Primitive2DContainer&& aChildren);
+
+ /// create local decomposition
+ virtual void
+ get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx b/include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx
new file mode 100644
index 000000000..191fde1b8
--- /dev/null
+++ b/include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+// BackgroundColorPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+/** BackgroundColorPrimitive2D class
+
+ This primitive is defined to fill the whole visible Viewport with
+ the given color (and thus decomposes to a filled polygon). This
+ makes it a view-dependent primitive by definition. It only has
+ a valid decomposition if a valid Viewport is given in the
+ ViewInformation2D at decomposition time.
+
+ It will try to buffer its last decomposition using maLastViewport
+ to detect changes in the get2DDecomposition call.
+ */
+class DRAWINGLAYER_DLLPUBLIC BackgroundColorPrimitive2D final
+ : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the fill color to use
+ basegfx::BColor maBColor;
+ double mfTransparency;
+
+ /// the last used viewInformation, used from getDecomposition for buffering
+ basegfx::B2DRange maLastViewport;
+
+ /// create local decomposition
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ explicit BackgroundColorPrimitive2D(const basegfx::BColor& rBColor, double fTransparency = 0);
+
+ /// data read access
+ const basegfx::BColor& getBColor() const { return maBColor; }
+ double getTransparency() const { return mfTransparency; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get B2Drange
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+
+ /// Override standard getDecomposition call to be view-dependent here
+ virtual void
+ get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+};
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
new file mode 100644
index 000000000..9e011bbea
--- /dev/null
+++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+#include <com/sun/star/util/XAccounting.hpp>
+#include <basegfx/range/b2drange.hxx>
+#include <com/sun/star/graphic/XPrimitive2D.hpp>
+#include <comphelper/compbase.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <rtl/ref.hxx>
+#include <deque>
+
+namespace drawinglayer::geometry
+{
+class ViewInformation2D;
+}
+
+typedef comphelper::WeakComponentImplHelper<css::graphic::XPrimitive2D, css::util::XAccounting>
+ BasePrimitive2DImplBase;
+
+namespace drawinglayer::primitive2d
+{
+/** BasePrimitive2D class
+
+ Baseclass for all C++ implementations of css::graphic::XPrimitive2D
+
+ This class is strongly virtual due to the lack of getPrimitiveID() implementation.
+ This is by purpose, this base class shall not be incarnated and be used directly as
+ a XPrimitive2D.
+
+ It is noncopyable to make clear that a primitive is a read-only
+ instance and copying or changing values is not intended. The idea is to hold all data
+ needed for visualisation of this primitive in unchangeable form.
+
+ It is derived from cppu::BaseMutex to have a Mutex at hand; in a base
+ implementation this may not be needed, but e.g. when buffering at last decomposition
+ in a local member, multiple threads may try to decompose at the same time, so locking
+ is needed to avoid race conditions seen from the UNO object implementation.
+
+ A method to get a simplified representation is provided by get2DDecomposition. The
+ default implementation returns an empty sequence. The idea is that processors
+ using this primitive and do not know it, may get the decomposition and process
+ these instead. An example is e.g. a fat line, who's decomposition may contain
+ the geometric representation of that line using filled polygon primitives. When
+ the renderer knows how to handle fat lines, he may process this primitive directly;
+ if not he can use the decomposition. With this functionality, renderers may operate by
+ knowing only a small set of primitives.
+
+ When a primitive does not implement get2DDecomposition, it is called a 'Basic Primitive' and
+ belongs to the set of primitives which a processor should be able to handle. Practice
+ will define this minimal sets of primitives. When defined and the concept is proved,
+ unique UNO APIs may be defined/implemented for these set to allow more intense work
+ with primitives using UNO.
+
+ Current Basic 2D Primitives are:
+
+ - BitmapPrimitive2D (bitmap data, evtl. with transparence)
+ - PointArrayPrimitive2D (single points)
+ - PolygonHairlinePrimitive2D (hairline curves/polygons)
+ - PolyPolygonColorPrimitive2D (colored polygons)
+
+ UPDATE: MetafilePrimitive2D (VCL Metafile) is taken off this list since
+ it is implemented with the integration of CWS aw078 into DV300m69.
+
+ All other implemented primitives have a defined decomposition and can thus be
+ decomposed down to this small set.
+
+ A renderer implementing support for this minimal set of primitives can completely
+ render primitive-based visualisations. Of course, he also has to take states into account
+ which are represented by GroupPrimitive2D derivations, see groupprimitive2d.hxx
+
+ To support getting the geometric BoundRect, getB2DRange is used. The default
+ implementation will use the get2DDecomposition result and merge a range from the
+ entries. Thus, an implementation is only necessary for the Basic Primitives, but
+ of course speedups are possible (and are used) by implementing the method at higher-level
+ primitives.
+
+ For primitive identification, getPrimitiveID is used currently in this implementations
+ to allow a fast switch/case processing. This needs a unique identifier mechanism which
+ currently uses defines (see drawinglayer_primitivetypes2d.hxx). For UNO primitive API
+ it will be needed to add a unique descriptor (Name?) later to the API.
+
+ This base implementation provides mappings from the methods from XPrimitive2D
+ (getDecomposition/getRange) to the appropriate methods in the C++ implementations
+ (get2DDecomposition/getB2DRange). The PropertyValue ViewParameters is converted to
+ the appropriate C++ implementation class ViewInformation2D.
+
+ This base class does not implement any buffering; e.g. buffering the decomposition
+ and/or the range. These may be buffered anytime since the definition is that the primitive
+ is read-only and thus unchangeable. This implies that the decomposition and/or getting
+ the range will lead to the same result as last time, under the precondition that
+ the parameter ViewInformation2D is the same as the last one. This is usually the case
+ for view-independent primitives which are defined by not using ViewInformation2D
+ in their get2DDecomposition/getB2DRange implementations.
+*/
+class DRAWINGLAYERCORE_DLLPUBLIC BasePrimitive2D : public salhelper::SimpleReferenceObject
+{
+ BasePrimitive2D(const BasePrimitive2D&) = delete;
+ BasePrimitive2D& operator=(const BasePrimitive2D&) = delete;
+
+public:
+ // constructor/destructor
+ BasePrimitive2D();
+ virtual ~BasePrimitive2D() override;
+
+ /** the ==operator is mainly needed to allow testing newly-created primitives against their last
+ incarnation which buffers/holds the made decompositions. The default implementation
+ uses getPrimitive2DID()-calls to test if it's the same ID at last.
+ Overridden implementations are then based on this implementation
+ */
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+ bool operator!=(const BasePrimitive2D& rPrimitive) const { return !operator==(rPrimitive); }
+
+ /// The default implementation will use getDecomposition results to create the range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /** provide unique ID for fast identifying of known primitive implementations in renderers. These use
+ the defines from drawinglayer_primitivetypes2d.hxx to define unique IDs.
+ */
+ virtual sal_uInt32 getPrimitive2DID() const = 0;
+
+ /// The default implementation will return an empty sequence
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const;
+
+ // Methods from XPrimitive2D
+
+ /** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It
+ will construct a ViewInformation2D from the ViewParameters for that purpose
+ */
+ Primitive2DContainer
+ getDecomposition(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters);
+
+ /** The getRange implementation for UNO API will use getRange from this implementation. It
+ will construct a ViewInformation2D from the ViewParameters for that purpose
+ */
+ css::geometry::RealRectangle2D
+ getRange(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters);
+
+ // XAccounting
+ virtual sal_Int64 estimateUsage();
+};
+
+/**
+ Rather than make all the BasePrimitive2D classes bear the cost of being an UNO
+ object, we just wrap the top level BasePrimitive2D in this class when we need
+ to pass them over UNO
+*/
+class DRAWINGLAYERCORE_DLLPUBLIC UnoPrimitive2D final : public BasePrimitive2DImplBase
+{
+ UnoPrimitive2D(const UnoPrimitive2D&) = delete;
+ UnoPrimitive2D& operator=(const UnoPrimitive2D&) = delete;
+
+public:
+ // constructor/destructor
+ UnoPrimitive2D(const rtl::Reference<BasePrimitive2D>& rPrimitive)
+ : mxPrimitive(rPrimitive)
+ {
+ }
+ virtual ~UnoPrimitive2D() override;
+
+ // Methods from XPrimitive2D
+
+ /** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It
+ will construct a ViewInformation2D from the ViewParameters for that purpose
+ */
+ virtual css::uno::Sequence<::css::uno::Reference<::css::graphic::XPrimitive2D>> SAL_CALL
+ getDecomposition(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters) override;
+
+ /** The getRange implementation for UNO API will use getRange from this implementation. It
+ will construct a ViewInformation2D from the ViewParameters for that purpose
+ */
+ virtual css::geometry::RealRectangle2D SAL_CALL
+ getRange(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters) override;
+
+ // XAccounting
+ virtual sal_Int64 SAL_CALL estimateUsage() override;
+
+ rtl::Reference<BasePrimitive2D> const& getBasePrimitive2D() const { return mxPrimitive; }
+
+private:
+ rtl::Reference<BasePrimitive2D> mxPrimitive;
+};
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx b/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
new file mode 100644
index 000000000..46c0825af
--- /dev/null
+++ b/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+namespace com::sun::star::awt
+{
+class XBitmap;
+}
+
+namespace drawinglayer::primitive2d
+{
+/** BitmapPrimitive2D class
+
+ This class is the central primitive for Bitmap-based primitives.
+ To keep it independent of Bitmap implementations, use UNO API
+ XBitmap object as wrapper due to formally used class Bitmap being
+ vcl-dependent and requiring linking against it. Use VCLUnoHelper
+ to convert awt::XBitmap <-> Bitmap
+ */
+class DRAWINGLAYER_DLLPUBLIC BitmapPrimitive2D final : public BasePrimitive2D
+{
+private:
+ /// the Bitmap-data
+ css::uno::Reference<css::awt::XBitmap> maXBitmap;
+
+ /** the object transformation from unit coordinates, defining
+ size, shear, rotate and position
+ */
+ basegfx::B2DHomMatrix maTransform;
+
+public:
+ /// constructor
+ BitmapPrimitive2D(const css::uno::Reference<css::awt::XBitmap>& rXBitmap,
+ const basegfx::B2DHomMatrix& rTransform);
+
+ /// data read access
+ const css::uno::Reference<css::awt::XBitmap>& getXBitmap() const { return maXBitmap; }
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ // XAccounting
+ virtual sal_Int64 estimateUsage() override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
new file mode 100644
index 000000000..fe4580d07
--- /dev/null
+++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+
+enum class SvxBorderLineStyle : sal_Int16;
+
+namespace drawinglayer::primitive2d
+{
+/** BorderLine class
+ Helper class holding the style definition for a single part of a full BorderLine definition.
+ Line extends are for start/end and for Left/Right, seen in vector direction. If
+ Left != Right that means the line has a diagonal start/end.
+ Think about it similar to a trapezoid, but not aligned to X-Axis and using the
+ perpendicular vector to the given one in a right-handed coordinate system.
+*/
+class DRAWINGLAYER_DLLPUBLIC BorderLine
+{
+private:
+ // line attribute containing Width, Color and others
+ drawinglayer::attribute::LineAttribute maLineAttribute;
+
+ // line extends
+ double mfStartLeft;
+ double mfStartRight;
+ double mfEndLeft;
+ double mfEndRight;
+
+ // if this is a gap, this is set to true
+ bool mbIsGap;
+
+public:
+ // Constructor for visible BorderLine segments
+ BorderLine(const drawinglayer::attribute::LineAttribute& rLineAttribute,
+ double fStartLeft = 0.0, double fStartRight = 0.0, double fEndLeft = 0.0,
+ double fEndRight = 0.0);
+
+ // Constructor for gap BorderLine segments
+ BorderLine(double fWidth);
+
+ ~BorderLine();
+
+ BorderLine(BorderLine const&) = default;
+ BorderLine(BorderLine&&) = default;
+ BorderLine& operator=(BorderLine const&) = default;
+ BorderLine& operator=(BorderLine&&) = default;
+
+ const drawinglayer::attribute::LineAttribute& getLineAttribute() const
+ {
+ return maLineAttribute;
+ }
+ double getStartLeft() const { return mfStartLeft; }
+ double getStartRight() const { return mfStartRight; }
+ double getEndLeft() const { return mfEndLeft; }
+ double getEndRight() const { return mfEndRight; }
+ bool isGap() const { return mbIsGap; }
+
+ /// compare operator
+ bool operator==(const BorderLine& rBorderLine) const;
+};
+
+/** BorderLinePrimitive2D class
+
+ This is the basic primitive to build frames around objects, e.g. tables.
+ It defines a single or double line from Start to End using the LeftWidth,
+ Distance and RightWidth definitions.
+ The LineStart/End overlap is defined in the BorderLines definitions (see
+ class BorderLine above).
+*/
+class DRAWINGLAYER_DLLPUBLIC BorderLinePrimitive2D final : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the line definition
+ basegfx::B2DPoint maStart;
+ basegfx::B2DPoint maEnd;
+
+ /// the single BorderLine style definition(s), one or three mostly used
+ std::vector<BorderLine> maBorderLines;
+
+ /// common style definitions
+ const drawinglayer::attribute::StrokeAttribute maStrokeAttribute;
+
+ /// create local decomposition
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// helper to get the full width from maBorderLines
+ double getFullWidth() const;
+
+public:
+ /// simplified constructor for BorderLine with single edge
+ BorderLinePrimitive2D(const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd,
+ std::vector<BorderLine>&& rBorderLines,
+ const drawinglayer::attribute::StrokeAttribute& rStrokeAttribute);
+
+ /// data read access
+ const basegfx::B2DPoint& getStart() const { return maStart; }
+ const basegfx::B2DPoint& getEnd() const { return maEnd; }
+ const std::vector<BorderLine>& getBorderLines() const { return maBorderLines; }
+ const drawinglayer::attribute::StrokeAttribute& getStrokeAttribute() const
+ {
+ return maStrokeAttribute;
+ }
+
+ /// helper to decide if AntiAliasing should be used
+ bool isHorizontalOrVertical(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+/// helper to try to merge two instances of BorderLinePrimitive2D. If it was possible,
+/// a merged version is in the returned Primitive2DReference. Lots of preconditions
+/// have to be met to allow that, see implementation (and maybe even expand)
+Primitive2DReference DRAWINGLAYER_DLLPUBLIC tryMergeBorderLinePrimitive2D(
+ const BorderLinePrimitive2D* pCandidateA, const BorderLinePrimitive2D* pCandidateB);
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/controlprimitive2d.hxx b/include/drawinglayer/primitive2d/controlprimitive2d.hxx
new file mode 100644
index 000000000..015151cf8
--- /dev/null
+++ b/include/drawinglayer/primitive2d/controlprimitive2d.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+namespace com::sun::star::awt
+{
+class XControl;
+}
+namespace com::sun::star::awt
+{
+class XControlModel;
+}
+
+namespace drawinglayer::primitive2d
+{
+/** ControlPrimitive2D class
+
+ Base class for ControlPrimitive handling. It decomposes to a
+ graphical representation (Bitmap data) of the control. This
+ representation is limited to a quadratic pixel maximum defined
+ in the application settings.
+ */
+class DRAWINGLAYER_DLLPUBLIC ControlPrimitive2D final : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// object's base data
+ basegfx::B2DHomMatrix maTransform;
+ css::uno::Reference<css::awt::XControlModel> mxControlModel;
+
+ /// the created and cached awt::XControl
+ css::uno::Reference<css::awt::XControl> mxXControl;
+
+ /// the last used scaling, used from getDecomposition for buffering
+ basegfx::B2DVector maLastViewScaling;
+
+ /** used from getXControl() to create a local awt::XControl which is remembered in mxXControl
+ and from thereon always used and returned by getXControl()
+ */
+ void createXControl();
+
+ /// single local decompositions, used from create2DDecomposition()
+ Primitive2DReference
+ createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ Primitive2DReference createPlaceholderDecomposition() const;
+
+ /// local decomposition
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ ControlPrimitive2D(const basegfx::B2DHomMatrix& rTransform,
+ const css::uno::Reference<css::awt::XControlModel>& rxControlModel);
+
+ /** constructor with an additional XControl as parameter to allow to hand it over at incarnation time
+ if it exists. This will avoid to create a 2nd one on demand in createXControl()
+ and thus double the XControls.
+ */
+ ControlPrimitive2D(const basegfx::B2DHomMatrix& rTransform,
+ const css::uno::Reference<css::awt::XControlModel>& rxControlModel,
+ const css::uno::Reference<css::awt::XControl>& rxXControl);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const css::uno::Reference<css::awt::XControlModel>& getControlModel() const
+ {
+ return mxControlModel;
+ }
+
+ /** mxControl access. This will on demand create the awt::XControl using createXControl()
+ if it does not exist. It may already have been created or even handed over at
+ incarnation
+ */
+ const css::uno::Reference<css::awt::XControl>& getXControl() const;
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+
+ /// Override standard getDecomposition to be view-dependent here
+ virtual void
+ get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+};
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx b/include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx
new file mode 100644
index 000000000..cbdb21ad9
--- /dev/null
+++ b/include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+
+
+// DiscreteBitmapPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** DiscreteBitmapPrimitive2D class
+
+ This class defines a view-dependent BitmapPrimitive which has a
+ logic position for the top-left position and is always to be
+ painted in 1:1 pixel resolution. It will never be sheared, rotated
+ or scaled with the view.
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteBitmapPrimitive2D final : public ObjectAndViewTransformationDependentPrimitive2D
+ {
+ private:
+ /// the RGBA Bitmap-data
+ BitmapEx maBitmapEx;
+
+ /** the top-left object position */
+ basegfx::B2DPoint maTopLeft;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ DiscreteBitmapPrimitive2D(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rTopLeft);
+
+ /// data read access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+ const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx b/include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx
new file mode 100644
index 000000000..435ab9825
--- /dev/null
+++ b/include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+
+// DiscreteShadowPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** DiscreteShadow data class
+
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteShadow
+ {
+ private:
+ /// the original shadow BitmapEx in a special form
+ BitmapEx maBitmapEx;
+
+ /// buffered extracted parts of CombinedShadow for easier usage
+ BitmapEx maTopLeft;
+ BitmapEx maTop;
+ BitmapEx maTopRight;
+ BitmapEx maRight;
+ BitmapEx maBottomRight;
+ BitmapEx maBottom;
+ BitmapEx maBottomLeft;
+ BitmapEx maLeft;
+
+ public:
+ /// constructor
+ explicit DiscreteShadow(const BitmapEx& rBitmapEx);
+
+ /// data read access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+
+ /// compare operator
+ bool operator==(const DiscreteShadow& rCompare) const
+ {
+ return getBitmapEx() == rCompare.getBitmapEx();
+ }
+
+ /// helper accesses which create on-demand needed segments
+ const BitmapEx& getTopLeft() const;
+ const BitmapEx& getTop() const;
+ const BitmapEx& getTopRight() const;
+ const BitmapEx& getRight() const;
+ const BitmapEx& getBottomRight() const;
+ const BitmapEx& getBottom() const;
+ const BitmapEx& getBottomLeft() const;
+ const BitmapEx& getLeft() const;
+ };
+
+ /** DiscreteShadowPrimitive2D class
+
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteShadowPrimitive2D final : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ // the object transformation of the rectangular object
+ basegfx::B2DHomMatrix maTransform;
+
+ // the bitmap shadow data
+ DiscreteShadow maDiscreteShadow;
+
+ /// create local decomposition
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ DiscreteShadowPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const DiscreteShadow& rDiscreteShadow);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const DiscreteShadow& getDiscreteShadow() const { return maDiscreteShadow; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
new file mode 100644
index 000000000..687efb1d8
--- /dev/null
+++ b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+
+// define ranges for other libraries
+
+#define PRIMITIVE2D_ID_RANGE_DRAWINGLAYER (0 << 16)
+#define PRIMITIVE2D_ID_RANGE_SVX (1 << 16)
+#define PRIMITIVE2D_ID_RANGE_SD (2 << 16)
+#define PRIMITIVE2D_ID_RANGE_SW (3 << 16)
+#define PRIMITIVE2D_ID_RANGE_SC (4 << 16)
+
+
+// local primitives
+
+#define PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 0)
+#define PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 1)
+#define PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 2)
+#define PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 3)
+#define PRIMITIVE2D_ID_BACKGROUNDCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 4)
+#define PRIMITIVE2D_ID_BITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 5)
+#define PRIMITIVE2D_ID_CONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 6)
+#define PRIMITIVE2D_ID_EMBEDDED3DPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 7)
+#define PRIMITIVE2D_ID_FILLGRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 8)
+#define PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 9)
+#define PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 10)
+#define PRIMITIVE2D_ID_GRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 11)
+#define PRIMITIVE2D_ID_GRIDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 12)
+#define PRIMITIVE2D_ID_GROUPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 13)
+#define PRIMITIVE2D_ID_HELPLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 14)
+#define PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 15)
+#define PRIMITIVE2D_ID_MASKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 16)
+#define PRIMITIVE2D_ID_MEDIAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 17)
+#define PRIMITIVE2D_ID_METAFILEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 18)
+#define PRIMITIVE2D_ID_MODIFIEDCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 19)
+#define PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 20)
+#define PRIMITIVE2D_ID_POLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 21)
+#define PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 22)
+#define PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 23)
+#define PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 24)
+#define PRIMITIVE2D_ID_POLYPOLYGONSTROKEARROWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 25)
+#define PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 26)
+#define PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 27)
+#define PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 28)
+#define PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 29)
+#define PRIMITIVE2D_ID_SCENEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 30)
+#define PRIMITIVE2D_ID_SHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 31)
+#define PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 32)
+#define PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 33)
+#define PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 34)
+#define PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35)
+#define PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 36)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 37)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 38)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 39)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 40)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 41)
+#define PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 42)
+#define PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 43)
+#define PRIMITIVE2D_ID_TEXTEFFECTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 44)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYBULLETPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 45)
+#define PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 46)
+#define PRIMITIVE2D_ID_EXECUTEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 47)
+#define PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48)
+#define PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49)
+#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50)
+#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51)
+#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52)
+#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53)
+#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54)
+#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55)
+#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56)
+#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57)
+#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58)
+#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59)
+#define PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60)
+#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 61)
+#define PRIMITIVE2D_ID_SVGLINEARGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 62)
+#define PRIMITIVE2D_ID_SVGRADIALGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 63)
+#define PRIMITIVE2D_ID_SVGLINEARATOMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 64)
+#define PRIMITIVE2D_ID_SVGRADIALATOMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 65)
+#define PRIMITIVE2D_ID_CROPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 66)
+#define PRIMITIVE2D_ID_PATTERNFILLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 67)
+#define PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 68)
+#define PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 69)
+#define PRIMITIVE2D_ID_PAGEHIERARCHYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 70)
+#define PRIMITIVE2D_ID_GLOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 71)
+#define PRIMITIVE2D_ID_SOFTEDGEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 72)
+// When you add a new primitive, please update the drawinglayer::primitive2d::idToString() function
+// in drawinglayer/source/primitive2d/Tools.cxx.
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
new file mode 100644
index 000000000..959b38592
--- /dev/null
+++ b/include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+
+// Embedded3DPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** Embedded3DPrimitive2D class
+
+ This is a helper primitive which allows embedding of single 3D
+ primitives to the 2D primitive logic. It will get the scene it's
+ involved and thus the 3D transformation. With this information it
+ is able to provide 2D range data for a 3D primitive.
+
+ This primitive will not be visualized and decomposes to a yellow
+ 2D rectangle to visualize that this should never be visualized
+ */
+ class DRAWINGLAYER_DLLPUBLIC Embedded3DPrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the sequence of 3d primitives
+ primitive3d::Primitive3DContainer mxChildren3D;
+
+ /// the 2D scene object transformation
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ /// the 3D transformations
+ geometry::ViewInformation3D maViewInformation3D;
+
+ /** if the embedded 3D primitives contain shadow, these parameters are needed
+ to extract the shadow which is a sequence of 2D primitives and may expand
+ the 2D range. Since every single 3D object in a scene may individually
+ have shadow or not, these values need to be provided and prepared. The shadow
+ distance itself (a 2D transformation) is part of the 3D shadow definition
+ */
+ basegfx::B3DVector maLightNormal;
+ double mfShadowSlant;
+ basegfx::B3DRange maScene3DRange;
+
+ /// the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked)
+ Primitive2DContainer maShadowPrimitives;
+
+ /// #i96669# add simple range buffering for this primitive
+ basegfx::B2DRange maB2DRange;
+
+ /** flag if given 3D geometry is already checked for shadow definitions and 2d shadows
+ are created in maShadowPrimitives
+ */
+ bool mbShadow3DChecked : 1;
+
+ /// private helpers
+ bool impGetShadow3D() const;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ Embedded3DPrimitive2D(
+ const primitive3d::Primitive3DContainer& rxChildren3D,
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ const geometry::ViewInformation3D& rViewInformation3D,
+ const basegfx::B3DVector& rLightNormal,
+ double fShadowSlant,
+ const basegfx::B3DRange& rScene3DRange);
+
+ /// data read access
+ const primitive3d::Primitive3DContainer& getChildren3D() const { return mxChildren3D; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
+ const basegfx::B3DVector& getLightNormal() const { return maLightNormal; }
+ double getShadowSlant() const { return mfShadowSlant; }
+ const basegfx::B3DRange& getScene3DRange() const { return maScene3DRange; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/epsprimitive2d.hxx b/include/drawinglayer/primitive2d/epsprimitive2d.hxx
new file mode 100644
index 000000000..7aa72b6ce
--- /dev/null
+++ b/include/drawinglayer/primitive2d/epsprimitive2d.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/gfxlink.hxx>
+#include <vcl/gdimtf.hxx>
+
+namespace drawinglayer::primitive2d
+{
+ /** EpsPrimitive2D class */
+ class EpsPrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometry definition
+ basegfx::B2DHomMatrix maEpsTransform;
+
+ /// the Eps content definition
+ GfxLink maGfxLink;
+
+ /// the replacement content definition
+ GDIMetaFile maMetaFile;
+
+ /// create local decomposition
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ EpsPrimitive2D(
+ const basegfx::B2DHomMatrix& rEpsTransform,
+ const GfxLink& rGfxLink,
+ const GDIMetaFile& rMetaFile);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getEpsTransform() const { return maEpsTransform; }
+ const GfxLink& getGfxLink() const { return maGfxLink; }
+ const GDIMetaFile& getMetaFile() const { return maMetaFile; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get B2Drange
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
new file mode 100644
index 000000000..9fe2fbcbc
--- /dev/null
+++ b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+
+// predefines
+
+namespace basegfx { class B2DPolygon; }
+namespace drawinglayer::texture { struct B2DHomMatrixAndBColor; }
+
+
+// FillGradientPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** FillGradientPrimitive2D class
+
+ This class defines a gradient filling for a rectangular area. The
+ Range is defined by the Transformation, the gradient by the FillGradientAttribute.
+
+ The decomposition will deliver the decomposed gradient, e.g. for an ellipse
+ gradient the various ellipses in various color steps will be created.
+
+ I have added functionality to create both versions of filled decompositions:
+ Those who overlap and non-overlapping ones. The overlapping version is the
+ default one since it works with and without AntiAliasing. The non-overlapping
+ version is used in the MetafilePrimitive2D decomposition when the old XOR
+ paint was recorded.
+ */
+ class DRAWINGLAYER_DLLPUBLIC FillGradientPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometrically visible area
+ basegfx::B2DRange maOutputRange;
+
+ /// the area the gradient definition is based on
+ /// in the simplest case identical to OutputRange
+ basegfx::B2DRange maDefinitionRange;
+
+ /// the gradient definition
+ attribute::FillGradientAttribute maFillGradient;
+
+ /// local helpers
+ void generateMatricesAndColors(
+ std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
+ basegfx::BColor& rOuterColor) const;
+ void createOverlappingFill(
+ Primitive2DContainer& rContainer,
+ const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
+ const basegfx::BColor& rOuterColor,
+ const basegfx::B2DPolygon& rUnitPolygon) const;
+ void createNonOverlappingFill(
+ Primitive2DContainer& rContainer,
+ const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
+ const basegfx::BColor& rOuterColor,
+ const basegfx::B2DPolygon& rUnitPolygon) const;
+
+ protected:
+ /// local helper
+ void createFill(Primitive2DContainer& rContainer, bool bOverlapping) const;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructors. The one without definition range will use output range as definition range
+ FillGradientPrimitive2D(
+ const basegfx::B2DRange& rOutputRange,
+ const attribute::FillGradientAttribute& rFillGradient);
+ FillGradientPrimitive2D(
+ const basegfx::B2DRange& rOutputRange,
+ const basegfx::B2DRange& rDefinitionRange,
+ const attribute::FillGradientAttribute& rFillGradient);
+
+ /// data read access
+ const basegfx::B2DRange& getOutputRange() const { return maOutputRange; }
+ const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
+ const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx b/include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx
new file mode 100644
index 000000000..51d49df30
--- /dev/null
+++ b/include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/attribute/fillgraphicattribute.hxx>
+
+
+// FillbitmapPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** FillGraphicPrimitive2D class
+
+ This class defines a bitmap filling for a rectangular area. The
+ Range is defined by the Transformation, the fill by the FillGraphicAttribute.
+ There, the fill consists of a Bitmap (not transparent) defining the fill data
+ and a Point/Vector pair defining the relative position/size [0.0 .. 1.0]
+ inside the area where the bitmap is positioned. A flag defines then if this
+ is tiled or not.
+
+ Renderers should handle this primitive; it has a geometrically correct
+ decomposition, but on pixel outputs the areas where the tiled pieces are
+ aligned tend to show up (one overlapping or empty pixel)
+ */
+ class DRAWINGLAYER_DLLPUBLIC FillGraphicPrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometric definition
+ basegfx::B2DHomMatrix maTransformation;
+
+ /// the fill attributes
+ attribute::FillGraphicAttribute maFillGraphic;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ FillGraphicPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransformation,
+ const attribute::FillGraphicAttribute& rFillGraphic);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+ const attribute::FillGraphicAttribute& getFillGraphic() const { return maFillGraphic; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx
new file mode 100644
index 000000000..03bc12139
--- /dev/null
+++ b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+
+// FillHatchPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** FillHatchPrimitive2D class
+
+ This class defines a hatch filling for a rectangular area. The
+ Range is defined by the Transformation, the hatch by the FillHatchAttribute.
+ If the background is to be filled, a flag in FillHatchAttribute is set and
+ the BColor defines the background color.
+
+ #i120230# This primitive is now evtl. metric dependent due to the value
+ MinimalDiscreteDistance in the FillHatchAttribute if the value is not zero.
+ This is used for a more appealing, VCL-like visualisation by not letting the
+ distances get too small between lines.
+
+ The decomposition will deliver the hatch lines.
+ */
+ class FillHatchPrimitive2D final : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ /// the geometrically visible area
+ basegfx::B2DRange maOutputRange;
+
+ /// the area the gradient definition is based on
+ /// in the simplest case identical to OutputRange
+ basegfx::B2DRange maDefinitionRange;
+
+ /// the hatch definition
+ attribute::FillHatchAttribute maFillHatch;
+
+ /// hatch background color (if used)
+ basegfx::BColor maBColor;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructors. The one without definition range will use output range as definition range
+ FillHatchPrimitive2D(
+ const basegfx::B2DRange& rOutputRange,
+ const basegfx::BColor& rBColor,
+ const attribute::FillHatchAttribute& rFillHatch);
+ FillHatchPrimitive2D(
+ const basegfx::B2DRange& rOutputRange,
+ const basegfx::B2DRange& rDefinitionRange,
+ const basegfx::BColor& rBColor,
+ const attribute::FillHatchAttribute& rFillHatch);
+
+ /// data read access
+ const basegfx::B2DRange& getOutputRange() const { return maOutputRange; }
+ const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
+ const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// Override standard getDecomposition to be view-dependent here
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/glowprimitive2d.hxx b/include/drawinglayer/primitive2d/glowprimitive2d.hxx
new file mode 100644
index 000000000..7dd65e725
--- /dev/null
+++ b/include/drawinglayer/primitive2d/glowprimitive2d.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <tools/color.hxx>
+
+namespace drawinglayer::primitive2d
+{
+class DRAWINGLAYER_DLLPUBLIC GlowPrimitive2D final : public GroupPrimitive2D
+{
+private:
+ /// the Glow color to which all geometry is to be forced; includes alpha
+ Color maGlowColor;
+
+ /// the Glow size, in logical units (100ths of mm)
+ double mfGlowRadius;
+
+public:
+ /// constructor
+ GlowPrimitive2D(const Color& rGlowColor, double fRadius, Primitive2DContainer&& rChildren);
+
+ /// data read access
+ const Color& getGlowColor() const { return maGlowColor; }
+ double getGlowRadius() const { return mfGlowRadius; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/graphicprimitive2d.hxx b/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
new file mode 100644
index 000000000..9bce4b8c0
--- /dev/null
+++ b/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/GraphicObject.hxx>
+
+namespace drawinglayer::primitive2d
+{
+/** GraphicPrimitive2D class
+
+ Primitive to hold graphics defined by GraphicObject and GraphicAttr
+ combination. This includes MetaFiles and diverse pixel-oriented graphic
+ formats. It even includes animated GIFs, Croppings and other changes
+ defined in GraphicAttr.
+
+ This makes the decomposition contain a wide variety of possibilities,
+ too. From a simple BitmapPrimitive over AnimatedSwitchPrimitive2D,
+ MetafilePrimitive2D (with and without embedding in a masking when e.g.
+ the Metafile is bigger than the geometry) and embeddings in
+ TransformPrimitive2D and MaskPrimitive2D for croppings.
+
+ The primitive geometry area is defined by Transform.
+ */
+class DRAWINGLAYER_DLLPUBLIC GraphicPrimitive2D final : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the geometric definition
+ basegfx::B2DHomMatrix maTransform;
+
+ /// the GraphicObject with all its content possibilities
+ GraphicObject maGraphicObject;
+
+ /// The GraphicAttr with all its modification possibilities
+ GraphicAttr maGraphicAttr;
+
+ /// local decomposition
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor(s)
+ GraphicPrimitive2D(const basegfx::B2DHomMatrix& rTransform, const GraphicObject& rGraphicObject,
+ const GraphicAttr& rGraphicAttr);
+ GraphicPrimitive2D(const basegfx::B2DHomMatrix& rTransform,
+ const GraphicObject& rGraphicObject);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const GraphicObject& getGraphicObject() const { return maGraphicObject; }
+ const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/gridprimitive2d.hxx b/include/drawinglayer/primitive2d/gridprimitive2d.hxx
new file mode 100644
index 000000000..3c2bf595a
--- /dev/null
+++ b/include/drawinglayer/primitive2d/gridprimitive2d.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <vcl/bitmapex.hxx>
+
+
+// GridPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** GridPrimitive2D class
+
+ This primitive is specialized to Grid visualisation. The graphic definition
+ (Transform) contains the whole grid area, but will of course be combined
+ with the visible area (Viewport) when decomposed. Also a resolution-dependent
+ point reduction is used to not create too much grid visualisation data. This
+ makes this primitive highly view-dependent and it dynamically buffers
+ the last decomposition dependent from the Viewport used.
+ */
+ class DRAWINGLAYER_DLLPUBLIC GridPrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// The geometry definition for the grid area
+ basegfx::B2DHomMatrix maTransform;
+
+ /// grid layout definitions
+ double mfWidth;
+ double mfHeight;
+ double mfSmallestViewDistance;
+ double mfSmallestSubdivisionViewDistance;
+ sal_uInt32 mnSubdivisionsX;
+ sal_uInt32 mnSubdivisionsY;
+
+ /// Grid color for single-pixel grid points
+ basegfx::BColor maBColor;
+
+ /// The Bitmap (with transparence) for grid cross points
+ BitmapEx maCrossMarker;
+
+ /** the last used object to view transformtion and the last Viewport,
+ used from getDecomposition for decide buffering
+ */
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
+ basegfx::B2DRange maLastViewport;
+
+ /// create local decomposition
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ GridPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ double fWidth,
+ double fHeight,
+ double fSmallestViewDistance,
+ double fSmallestSubdivisionViewDistance,
+ sal_uInt32 nSubdivisionsX,
+ sal_uInt32 nSubdivisionsY,
+ const basegfx::BColor& rBColor,
+ const BitmapEx& rCrossMarker);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ double getWidth() const { return mfWidth; }
+ double getHeight() const { return mfHeight; }
+ double getSmallestViewDistance() const { return mfSmallestViewDistance; }
+ double getSmallestSubdivisionViewDistance() const { return mfSmallestSubdivisionViewDistance; }
+ sal_uInt32 getSubdivisionsX() const { return mnSubdivisionsX; }
+ sal_uInt32 getSubdivisionsY() const { return mnSubdivisionsY; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+ const BitmapEx& getCrossMarker() const { return maCrossMarker; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get 2d range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+
+ /// Override standard getDecomposition to be view-dependent here
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/groupprimitive2d.hxx b/include/drawinglayer/primitive2d/groupprimitive2d.hxx
new file mode 100644
index 000000000..b34bef834
--- /dev/null
+++ b/include/drawinglayer/primitive2d/groupprimitive2d.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+
+// GroupPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** GroupPrimitive2D class
+
+ Baseclass for all grouping 2D primitives
+
+ The grouping primitive in its basic form is capable of holding
+ a child primitive content and returns it on decomposition on default.
+ It is used for two main purposes, but more may apply:
+
+ - to transport extended information, e.g. for text classification,
+ see e.g. TextHierarchy*Primitive2D implementations. Since they
+ decompose to their child content, renderers not aware/interested
+ in that extra information will just ignore these primitives
+
+ - to encapsulate common geometry, e.g. the ShadowPrimitive2D implements
+ applying a generic shadow to a child sequence by adding the needed
+ offset and color stuff in the decomposition
+
+ In most cases the decomposition is straightforward, so by default
+ this primitive will not buffer the result and is not derived from
+ BufferedDecompositionPrimitive2D, but from BasePrimitive2D.
+
+ A renderer has to take GroupPrimitive2D derivations into account which
+ are used to hold a state.
+
+ Current Basic 2D StatePrimitives are:
+
+ - TransparencePrimitive2D (objects with freely defined transparence)
+ - InvertPrimitive2D (for XOR)
+ - MaskPrimitive2D (for masking)
+ - ModifiedColorPrimitive2D (for a stack of color modifications)
+ - TransformPrimitive2D (for a transformation stack)
+ */
+ class DRAWINGLAYER_DLLPUBLIC GroupPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the children. Declared private since this shall never be changed at all after construction
+ Primitive2DContainer maChildren;
+
+ public:
+ /// constructor
+ explicit GroupPrimitive2D(Primitive2DContainer&& aChildren);
+
+ /// data read access
+ const Primitive2DContainer& getChildren() const { return maChildren; }
+
+ void getChildren(Primitive2DDecompositionVisitor& rVisitor) const { rVisitor.visit(maChildren); }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
+
+ /// local decomposition. Implementation will just return children
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+
+ // XAccounting
+ virtual sal_Int64 estimateUsage() override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/helplineprimitive2d.hxx b/include/drawinglayer/primitive2d/helplineprimitive2d.hxx
new file mode 100644
index 000000000..075715b9b
--- /dev/null
+++ b/include/drawinglayer/primitive2d/helplineprimitive2d.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+
+// HelplinePrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** HelplineStyle2D definition
+
+ The available styles of Helplines
+ */
+ enum class HelplineStyle2D
+ {
+ Point,
+ Line
+ };
+
+ /** HelplinePrimitive2D class
+
+ This primitive provides a view-dependent helpline definition. The Helpline
+ is defined by a line equation (Point and vector) and a style. When the style
+ is a line, dependent from Viewport the visible part of that Helpline is
+ constructed. For Point, a cross is constructed. This primitive is highly
+ view-dependent.
+
+ The visualisation uses the two given colors to create a dashed line with
+ the given dash length.
+ */
+ class DRAWINGLAYER_DLLPUBLIC HelplinePrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// Helpline geometry definition
+ basegfx::B2DPoint maPosition;
+ basegfx::B2DVector maDirection;
+ HelplineStyle2D meStyle;
+
+ /// Helpline style definition
+ basegfx::BColor maRGBColA;
+ basegfx::BColor maRGBColB;
+ double mfDiscreteDashLength;
+
+ /** the last used object to view transformtion and the last Viewport,
+ used from getDecomposition for decide buffering
+ */
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
+ basegfx::B2DRange maLastViewport;
+
+ /// create local decomposition
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ HelplinePrimitive2D(
+ const basegfx::B2DPoint& rPosition,
+ const basegfx::B2DVector& rDirection,
+ HelplineStyle2D eStyle,
+ const basegfx::BColor& rRGBColA,
+ const basegfx::BColor& aRGBColB,
+ double fDiscreteDashLength);
+
+ /// data read access
+ const basegfx::B2DPoint& getPosition() const { return maPosition; }
+ const basegfx::B2DVector& getDirection() const { return maDirection; }
+ HelplineStyle2D getStyle() const { return meStyle; }
+ const basegfx::BColor& getRGBColA() const { return maRGBColA; }
+ const basegfx::BColor& getRGBColB() const { return maRGBColB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+
+ /// Override standard getDecomposition to be view-dependent here
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx b/include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx
new file mode 100644
index 000000000..3a13d2ab4
--- /dev/null
+++ b/include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ // This primitive is used to represent geometry for non-visible objects,
+ // e.g. a PresObj's outline. To still be able to use primitives for HitTest
+ // functionality, the 2d decompositions will produce an as much as possible
+ // simplified line geometry encapsulated in this primitive when there is no
+ // line geometry. In a further enhanced version this may change to 'if neither
+ // filled nor lines' creation criteria. The whole primitive decomposes to nothing,
+ // so no one not knowing it will be influenced. Only helper processors for hit test
+ // (and maybe BoundRect extractors) will use it and its children subcontent.
+ class DRAWINGLAYER_DLLPUBLIC HiddenGeometryPrimitive2D final : public GroupPrimitive2D
+ {
+ public:
+ explicit HiddenGeometryPrimitive2D(Primitive2DContainer&& aChildren);
+
+ // despite returning an empty decomposition since it's no visualisation data,
+ // range calculation is intended to use hidden geometry, so
+ // the local implementation will return the children's range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// local decomposition. Implementation will return empty Primitive2DSequence
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ // provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/invertprimitive2d.hxx b/include/drawinglayer/primitive2d/invertprimitive2d.hxx
new file mode 100644
index 000000000..ccafd5156
--- /dev/null
+++ b/include/drawinglayer/primitive2d/invertprimitive2d.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** InvertPrimitive2D class
+
+ This is a helper class which encapsulates geometry that should be
+ painted XOR, e.g. old cursor visualisations. It decomposes to
+ its content, so when not supporting it, the contained geometry
+ will be visualized normally.
+ Unfortunately this is still needed, but hard to support on various
+ systems. XOR painting needs read access to the target, so modern
+ graphic systems tend to not support it anymore.
+ */
+ class DRAWINGLAYER_DLLPUBLIC InvertPrimitive2D final : public GroupPrimitive2D
+ {
+ public:
+ /// constructor
+ explicit InvertPrimitive2D(Primitive2DContainer&& aChildren);
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx
new file mode 100644
index 000000000..40f6236cf
--- /dev/null
+++ b/include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <vcl/bitmapex.hxx>
+
+
+// MarkerArrayPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** MarkerArrayPrimitive2D class
+
+ This primitive defines an array of markers. Their size is defined
+ in pixels and independent from the view transformation which makes
+ this primitive highly view-dependent. It is also transformation
+ invariant, so that the bitmap is always visualized unscaled and
+ unrotated.
+ It is used e.g. for grid position visualisation. The given Bitmap
+ (with transparence) is defined to be visible centered at each of the given
+ positions.
+ It decomposes to the needed number of BitmapPrimitive2D's, so it would
+ be efficient to handle it directly in a renderer.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MarkerArrayPrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the positions for the marker
+ std::vector< basegfx::B2DPoint > maPositions;
+
+ /// the marker definition to visualize
+ BitmapEx maMarker;
+
+ /// create local decomposition
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ MarkerArrayPrimitive2D(
+ std::vector< basegfx::B2DPoint >&& rPositions,
+ const BitmapEx& rMarker);
+
+ /// data read access
+ const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; }
+ const BitmapEx& getMarker() const { return maMarker; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/maskprimitive2d.hxx b/include/drawinglayer/primitive2d/maskprimitive2d.hxx
new file mode 100644
index 000000000..e2d8c0e65
--- /dev/null
+++ b/include/drawinglayer/primitive2d/maskprimitive2d.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** MaskPrimitive2D class
+
+ This is the central masking primitive. It's a grouping
+ primitive and contains a tools::PolyPolygon which defines the visible
+ area. Only visualisation parts of the Child primitive sequence
+ inside of the mask tools::PolyPolygon is defined to be visible.
+
+ This primitive should be handled by a renderer. If it is not handled,
+ it decomposes to its Child content, and thus the visualisation would
+ contain no clips.
+
+ The geometry range of this primitive is completely defined by the Mask
+ tools::PolyPolygon since by definition nothing outside of the mask is visible.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MaskPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ /// the mask PolyPolygon
+ basegfx::B2DPolyPolygon maMask;
+
+ public:
+ /// constructor
+ MaskPrimitive2D(
+ const basegfx::B2DPolyPolygon& rMask,
+ Primitive2DContainer&& aChildren);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getMask() const { return maMask; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/mediaprimitive2d.hxx b/include/drawinglayer/primitive2d/mediaprimitive2d.hxx
new file mode 100644
index 000000000..084b6728a
--- /dev/null
+++ b/include/drawinglayer/primitive2d/mediaprimitive2d.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <vcl/graph.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** MediaPrimitive2D class
+
+ This is a unified primitive for Media visualisation, e.g. animations
+ or sounds. It's geometry is defined by Transform. For convenience,
+ it also contains a discrete border size (aka Pixels) which will be added
+ if used. This makes it a view-dependent primitive. It also gets a filled
+ background and the decomposition will try to create a graphic representation
+ if the content (defined by the URL), e.g. a still frame for animated stuff.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MediaPrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometry definition
+ basegfx::B2DHomMatrix maTransform;
+
+ /// the content definition
+ OUString maURL;
+
+ /// style: background color
+ basegfx::BColor maBackgroundColor;
+
+ /// discrete border (in 'pixels')
+ sal_uInt32 mnDiscreteBorder;
+
+ const Graphic maSnapshot;
+
+ /// local decomposition
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ MediaPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const OUString& rURL,
+ const basegfx::BColor& rBackgroundColor,
+ sal_uInt32 nDiscreteBorder,
+ const Graphic &rSnapshot);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; }
+ sal_uInt32 getDiscreteBorder() const { return mnDiscreteBorder; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/metafileprimitive2d.hxx b/include/drawinglayer/primitive2d/metafileprimitive2d.hxx
new file mode 100644
index 000000000..c6caded90
--- /dev/null
+++ b/include/drawinglayer/primitive2d/metafileprimitive2d.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/gdimetafiletools.hxx>
+
+
+// MetafilePrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** MetafilePrimitive2D class
+
+ This is the MetaFile representing primitive. It's geometry is defined
+ by MetaFileTransform. The content (defined by MetaFile) will be scaled
+ to the geometric definition by using PrefMapMode and PrefSize of the
+ Metafile.
+
+ It has shown that this not always guarantees that all Metafile content
+ is inside the geometric definition, but this primitive defines that this
+ is the case to allow a getB2DRange implementation. If it cannot be
+ guaranteed that the Metafile is inside the geometric definition, it should
+ be embedded to a MaskPrimitive2D.
+
+ This primitive has no decomposition yet, so when not supported by a renderer,
+ it will not be visualized.
+
+ In the future, a decomposition implementation would be appreciated and would
+ have many advantages; Metafile would no longer have to be rendered by
+ sub-systems and a standard way for converting Metafiles would exist.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MetafilePrimitive2D final : public BufferedDecompositionPrimitive2D, public MetafileAccessor
+ {
+ private:
+ /// the geometry definition
+ basegfx::B2DHomMatrix maMetaFileTransform;
+
+ /// the content definition
+ GDIMetaFile maMetaFile;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+ public:
+ /// constructor
+ MetafilePrimitive2D(
+ const basegfx::B2DHomMatrix& rMetaFileTransform,
+ const GDIMetaFile& rMetaFile);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maMetaFileTransform; }
+ const GDIMetaFile& getMetaFile() const { return maMetaFile; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// from MetafileAccessor
+ virtual void accessMetafile(GDIMetaFile& rTargetMetafile) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx b/include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx
new file mode 100644
index 000000000..167ed054f
--- /dev/null
+++ b/include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** ModifiedColorPrimitive2D class
+
+ This primitive is a grouping primitive and allows to define
+ how the colors of its child content shall be modified for
+ visualisation. This can be (and is) used e.g. for generic shadow
+ visualisation by forcing all color usages of the contained
+ sub-content to the shadow color.
+
+ For the possibilities of color modifications, please refer
+ to the basegfx::BColorModifier definitions in basegfx. For
+ processing there is tooling in basegfx to build a stack of
+ BColorModifierSharedPtrs to always be able to process the correct
+ colors.
+
+ If a renderer does not handle this primitive, the content will
+ be visualized unchanged.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ModifiedColorPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ /// The ColorModifier to use
+ basegfx::BColorModifierSharedPtr maColorModifier;
+
+ public:
+ /// constructor
+ ModifiedColorPrimitive2D(
+ Primitive2DContainer&& aChildren,
+ const basegfx::BColorModifierSharedPtr& rColorModifier);
+
+ /// data read access
+ const basegfx::BColorModifierSharedPtr& getColorModifier() const { return maColorModifier; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx b/include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx
new file mode 100644
index 000000000..9df931a96
--- /dev/null
+++ b/include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <rtl/ustring.hxx>
+
+namespace drawinglayer::primitive2d
+{
+ /** ObjectInfoPrimitive2D class
+
+ Info hierarchy helper class to hold contents like Name, Title and
+ Description which are valid for the child content, e.g. created for
+ primitives based on DrawingLayer objects or SVG parts. It decomposes
+ to its content, so all direct renderers may ignore it. May e.g.
+ be used when re-creating graphical content from a sequence of primitives
+ */
+ class DRAWINGLAYER_DLLPUBLIC ObjectInfoPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ OUString maName;
+ OUString maTitle;
+ OUString maDesc;
+
+ public:
+ /// constructor
+ ObjectInfoPrimitive2D(
+ Primitive2DContainer&& aChildren,
+ const OUString& rName,
+ const OUString& rTitle,
+ const OUString& rDesc);
+
+ /// data read access
+ const OUString& getName() const { return maName; }
+ const OUString& getTitle() const { return maTitle; }
+ const OUString& getDesc() const { return maDesc; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/pagehierarchyprimitive2d.hxx b/include/drawinglayer/primitive2d/pagehierarchyprimitive2d.hxx
new file mode 100644
index 000000000..8b6a08aa7
--- /dev/null
+++ b/include/drawinglayer/primitive2d/pagehierarchyprimitive2d.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** PageHierarchyPrimitive2D class
+
+ This primitive encapsulates text lines.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PageHierarchyPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit PageHierarchyPrimitive2D(Primitive2DContainer&& aChildren);
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx b/include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx
new file mode 100644
index 000000000..6ee147557
--- /dev/null
+++ b/include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+namespace com::sun::star::drawing { class XDrawPage; }
+
+
+namespace drawinglayer::primitive2d
+{
+ /** PagePreviewPrimitive2D class
+
+ This primitive is needed to have the correct XDrawPage as ViewInformation for decomposing
+ the page contents (given as PageContent here) if these contain e.g.
+ view-dependent (in this case XDrawPage-dependent) text fields like PageNumber. If You want
+ those primitives to be visualized correctly, Your renderer needs to locally correct its
+ ViewInformation2D to reference the new XDrawPage.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PagePreviewPrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the XDrawPage visualized by this primitive. When we go forward with primitives
+ this will not only be used by the renderers to provide the correct decompose
+ graphic attribute context, but also to completely create the page's sub-content.
+ */
+ const css::uno::Reference< css::drawing::XDrawPage > mxDrawPage;
+
+ /// the PageContent
+ Primitive2DContainer maPageContent;
+
+ /// the own geometry
+ basegfx::B2DHomMatrix maTransform;
+
+ /// content width and height
+ double mfContentWidth;
+ double mfContentHeight;
+
+ /// local decomposition. Implementation will just return children
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ PagePreviewPrimitive2D(
+ const css::uno::Reference< css::drawing::XDrawPage >& rxDrawPage,
+ const basegfx::B2DHomMatrix& rTransform,
+ double fContentWidth,
+ double fContentHeight,
+ Primitive2DContainer&& rPageContent);
+
+ /// data read access
+ const css::uno::Reference< css::drawing::XDrawPage >& getXDrawPage() const { return mxDrawPage; }
+ const Primitive2DContainer& getPageContent() const { return maPageContent; }
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ double getContentWidth() const { return mfContentWidth; }
+ double getContentHeight() const { return mfContentHeight; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// own getB2DRange
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx b/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx
new file mode 100644
index 000000000..9da0e44e5
--- /dev/null
+++ b/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <vcl/bitmapex.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** PatternFillPrimitive2D class
+
+ This primitive allows filling a given tools::PolyPolygon with a pattern
+ defined by a sequence of primitives which are mapped to the unit range.
+ The pattern is defined using a reference range which defines a rectangular
+ area relative to the tools::PolyPolygon (in unit coordinates) which is virtually
+ infinitely repeated.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PatternFillPrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ const basegfx::B2DPolyPolygon maMask;
+ const Primitive2DContainer maChildren;
+ const basegfx::B2DRange maReferenceRange;
+
+ /// values holding the discrete buffer size
+ sal_uInt32 mnDiscreteWidth;
+ sal_uInt32 mnDiscreteHeight;
+
+ /// helper that is capable to calculate the needed discrete buffer size for
+ /// eventually buffered content
+ void calculateNeededDiscreteBufferSize(
+ sal_uInt32& rWidth,
+ sal_uInt32& rHeight,
+ const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// helper which creates the content - checks if clipping is needed and eventually
+ /// creates buffered content to speed up rendering
+ Primitive2DContainer createContent(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// create local decomposition
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ PatternFillPrimitive2D(
+ const basegfx::B2DPolyPolygon& rMask,
+ Primitive2DContainer&& rChildren,
+ const basegfx::B2DRange& rReferenceRange);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getMask() const { return maMask; }
+ const Primitive2DContainer& getChildren() const { return maChildren; }
+ const basegfx::B2DRange& getReferenceRange() const { return maReferenceRange; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// overload to react on evtl. buffered content
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+
+ // XAccounting
+ virtual sal_Int64 estimateUsage() override;
+
+ /// helper which creates the content - checks if clipping is needed and eventually
+ /// creates buffered content to speed up rendering
+ BitmapEx createTileImage(sal_uInt32 nWidth, sal_uInt32 nHeight) const;
+
+ /// helper that is capable to calculate the needed discrete buffer size for
+ /// eventually buffered content
+ void getTileSize(
+ sal_uInt32& rWidth,
+ sal_uInt32& rHeight,
+ const geometry::ViewInformation2D& rViewInformation) const;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx b/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx
new file mode 100644
index 000000000..a2eb5f611
--- /dev/null
+++ b/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+
+// PointArrayPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** PointArrayPrimitive2D class
+
+ This primitive defines single,discrete 'pixels' for the given
+ positions in the given color. This makes it view-dependent since
+ the logic size of a 'pixel' depends on the view transformation.
+
+ This is one of the non-decomposable primitives, so a renderer
+ should process it (Currently it is only used for grid visualisation,
+ but this may change).
+ */
+ class PointArrayPrimitive2D final : public BasePrimitive2D
+ {
+ private:
+ /// the array of positions
+ std::vector< basegfx::B2DPoint > maPositions;
+
+ /// the color to use
+ basegfx::BColor maRGBColor;
+
+ /// #i96669# add simple range buffering for this primitive
+ basegfx::B2DRange maB2DRange;
+
+ public:
+ /// constructor
+ PointArrayPrimitive2D(
+ std::vector< basegfx::B2DPoint >&& rPositions,
+ const basegfx::BColor& rRGBColor);
+
+ /// data read access
+ const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; }
+ const basegfx::BColor& getRGBColor() const { return maRGBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/primitivetools2d.hxx b/include/drawinglayer/primitive2d/primitivetools2d.hxx
new file mode 100644
index 000000000..97e4f770e
--- /dev/null
+++ b/include/drawinglayer/primitive2d/primitivetools2d.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** DiscreteMetricDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
+ regarding the size of a discrete unit. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit()
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteMetricDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used fDiscreteUnit definitions for decomposition. Since this
+ is checked and updated from get2DDecomposition() it will be current and
+ usable in create2DDecomposition()
+ */
+ double mfDiscreteUnit;
+
+ public:
+ /// constructor
+ DiscreteMetricDependentPrimitive2D()
+ : mfDiscreteUnit(0.0)
+ {
+ }
+
+ /// data read access
+ double getDiscreteUnit() const { return mfDiscreteUnit; }
+
+ /// Override standard getDecomposition to be view-dependent here
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+ };
+
+ /** ViewportDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
+ regarding the viewport. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date Viewport accessible using getViewport()
+ */
+ class DRAWINGLAYER_DLLPUBLIC ViewportDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used Viewport definition for decomposition. Since this
+ is checked and updated from get2DDecomposition() it will be current and
+ usable in create2DDecomposition()
+ */
+ basegfx::B2DRange maViewport;
+
+ public:
+ /// constructor
+ ViewportDependentPrimitive2D()
+ {
+ }
+
+ /// data read access
+ const basegfx::B2DRange& getViewport() const { return maViewport; }
+
+ /// Override standard getDecomposition to be view-dependent here
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+ };
+
+ /** ViewTransformationDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
+ regarding the complete Viewtransformation. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
+ */
+ class DRAWINGLAYER_DLLPUBLIC ViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used ViewTransformation definition for decomposition. Since this
+ is checked and updated from get2DDecomposition() it will be current and
+ usable in create2DDecomposition()
+ */
+ basegfx::B2DHomMatrix maViewTransformation;
+
+ public:
+ /// constructor
+ ViewTransformationDependentPrimitive2D()
+ {
+ }
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
+
+ /// Override standard getDecomposition to be view-dependent here
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+ };
+
+ /** ObjectAndViewTransformationDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
+ and Object-Transform dependent. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
+ and an object transformation via getObjectTransformation()
+ */
+ class DRAWINGLAYER_DLLPUBLIC ObjectAndViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used ViewTransformation and the last ObjectTransformation
+ definition for decomposition. Since this is checked and updated from
+ get2DDecomposition() it will be current and usable in create2DDecomposition()
+ */
+ basegfx::B2DHomMatrix maViewTransformation;
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ public:
+ /// constructor
+ ObjectAndViewTransformationDependentPrimitive2D()
+ {
+ }
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+
+ /// Override standard getDecomposition to be view-dependent here
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/sceneprimitive2d.hxx b/include/drawinglayer/primitive2d/sceneprimitive2d.hxx
new file mode 100644
index 000000000..3fc027fcb
--- /dev/null
+++ b/include/drawinglayer/primitive2d/sceneprimitive2d.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/bitmapex.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+
+namespace drawinglayer::primitive2d
+{
+ /** ScenePrimitive2D class
+
+ This primitive defines a 3D scene as a 2D primitive and is the anchor point
+ for a 3D visualisation. The decomposition is view-dependent and will try to
+ re-use already rendered 3D content.
+
+ The rendering is done using the default-3D renderer from basegfx which supports
+ AntiAliasing.
+
+ The 2D primitive's geometric range is defined completely by the
+ ObjectTransformation combined with evtl. 2D shadows from the 3D objects. The
+ shadows of 3D objects are 2D polygons, projected with the 3D transformation.
+
+ This is the class a renderer may process directly when he wants to implement
+ an own (e.g. system-specific) 3D renderer.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ScenePrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the 3D geometry definition
+ primitive3d::Primitive3DContainer mxChildren3D;
+
+ /// 3D scene attribute set
+ attribute::SdrSceneAttribute maSdrSceneAttribute;
+
+ /// lighting attribute set
+ attribute::SdrLightingAttribute maSdrLightingAttribute;
+
+ /// object transformation for scene for 2D definition
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ /// scene transformation set and object transformation
+ geometry::ViewInformation3D maViewInformation3D;
+
+ /// the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked)
+ Primitive2DContainer maShadowPrimitives;
+
+ /** flag if given 3D geometry is already checked for shadow definitions and 2d shadows
+ are created in maShadowPrimitives
+ */
+ bool mbShadow3DChecked : 1;
+
+ /// the last used NewDiscreteSize and NewUnitVisiblePart definitions for decomposition
+ double mfOldDiscreteSizeX;
+ double mfOldDiscreteSizeY;
+ basegfx::B2DRange maOldUnitVisiblePart;
+
+ /** the last created BitmapEx, e.g. for fast HitTest. This does not really need
+ memory since BitmapEx is internally RefCounted
+ */
+ BitmapEx maOldRenderedBitmap;
+
+ /// private helpers
+ bool impGetShadow3D() const;
+ void calculateDiscreteSizes(
+ const geometry::ViewInformation2D& rViewInformation,
+ basegfx::B2DRange& rDiscreteRange,
+ basegfx::B2DRange& rVisibleDiscreteRange,
+ basegfx::B2DRange& rUnitVisibleRange) const;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// public helpers
+ /** Geometry extractor. Shadow will be added as in create2DDecomposition, but
+ the 3D content is not converted to a bitmap visualisation but to projected 2D geometry. This
+ helper is useful e.g. for Contour extraction or HitTests.
+ */
+ Primitive2DContainer getGeometry2D() const;
+ Primitive2DContainer getShadow2D() const;
+
+ /** Fast HitTest which uses the last buffered BitmapEx from the last
+ rendered area if available. The return value describes if the check
+ could be done with the current information, so do NOT use o_rResult
+ when it returns false. o_rResult will be changed on return true and
+ then contains a definitive answer if content of this scene is hit or
+ not. On return false, it is normally necessary to use the geometric
+ HitTest (see CutFindProcessor usages). The given HitPoint
+ has to be in logic coordinates in scene's ObjectCoordinateSystem.
+ */
+ bool tryToCheckLastVisualisationDirectHit(const basegfx::B2DPoint& rLogicHitPoint, bool& o_rResult) const;
+
+ /// constructor
+ ScenePrimitive2D(
+ const primitive3d::Primitive3DContainer& rxChildren3D,
+ const attribute::SdrSceneAttribute& rSdrSceneAttribute,
+ const attribute::SdrLightingAttribute& rSdrLightingAttribute,
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ const geometry::ViewInformation3D& rViewInformation3D);
+
+ /// data read access
+ const primitive3d::Primitive3DContainer& getChildren3D() const { return mxChildren3D; }
+ const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return maSdrSceneAttribute; }
+ const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return maSdrLightingAttribute; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+
+ /// get local decomposition. Override since this decomposition is view-dependent
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx b/include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx
new file mode 100644
index 000000000..408abe952
--- /dev/null
+++ b/include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <basegfx/range/b2drange.hxx>
+#include <drawinglayer/primitive2d/CommonTypes.hxx>
+
+
+// predefines
+
+namespace basegfx {
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
+}
+
+
+namespace drawinglayer::primitive2d
+{
+ // helpers to create HitTestPrimitives Line
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ const basegfx::B2DHomMatrix& rMatrix);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ const basegfx::B2DPolyPolygon& rPolygon);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DRange& rRange);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DRange& rRange,
+ const basegfx::B2DHomMatrix& rMatrix);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DPolyPolygon& rPolygon,
+ const basegfx::B2DHomMatrix& rMatrix);
+
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/shadowprimitive2d.hxx b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
new file mode 100644
index 000000000..7df83a395
--- /dev/null
+++ b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** ShadowPrimitive2D class
+
+ This primitive defines a generic shadow geometry construction
+ for 2D objects. It decomposes to a TransformPrimitive2D embedded
+ into a ModifiedColorPrimitive2D.
+
+ It's for primitive usage convenience, so that not everyone has
+ to implement the generic shadow construction by himself.
+
+ The same geometry as sequence of primitives is used as geometry and
+ as shadow. Since these are RefCounted Uno-Api objects, no extra objects
+ are needed for the shadow itself; all the local decompositions of the
+ original geometry can be reused from the renderer for shadow visualisation.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ShadowPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ /// the shadow transformation, normally just an offset
+ basegfx::B2DHomMatrix maShadowTransform;
+
+ /// the shadow color to which all geometry is to be forced
+ basegfx::BColor maShadowColor;
+
+ /// the blur radius of the shadow
+ double mfShadowBlur;
+
+
+ public:
+ /// constructor
+ ShadowPrimitive2D(
+ const basegfx::B2DHomMatrix& rShadowTransform,
+ const basegfx::BColor& rShadowColor,
+ double fShadowBlur,
+ Primitive2DContainer&& aChildren);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; }
+ const basegfx::BColor& getShadowColor() const { return maShadowColor; }
+ double getShadowBlur() const { return mfShadowBlur; }
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// create decomposition
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/softedgeprimitive2d.hxx b/include/drawinglayer/primitive2d/softedgeprimitive2d.hxx
new file mode 100644
index 000000000..90ada61f7
--- /dev/null
+++ b/include/drawinglayer/primitive2d/softedgeprimitive2d.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+namespace drawinglayer::primitive2d
+{
+class DRAWINGLAYER_DLLPUBLIC SoftEdgePrimitive2D final : public GroupPrimitive2D
+{
+private:
+ /// Soft edge size, in logical units (100ths of mm)
+ double mfRadius;
+ mutable bool mbInMaskGeneration = false;
+
+public:
+ SoftEdgePrimitive2D(double fRadius, Primitive2DContainer&& aChildren);
+
+ double getRadius() const { return mfRadius; }
+
+ void setMaskGeneration(bool bVal = true) const { mbInMaskGeneration = bVal; }
+
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ virtual void
+ get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
new file mode 100644
index 000000000..40ad422c2
--- /dev/null
+++ b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <vcl/pdfwriter.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** StructureTagPrimitive2D class
+
+ This class is used to provide simple support for adding grouped
+ pdf writer structured element information like used in sd from
+ unomodel.cxx where a ViewObjectContactRedirector is used to add
+ such information for diverse objects.
+ This primitive encapsulates these and the VCLPdfRenderer uses it
+ to apply the needed infos directly to the pdf export in a compatible
+ way.
+ If a renderer ignores this, it just decomposes to its child
+ content.
+ */
+ class DRAWINGLAYER_DLLPUBLIC StructureTagPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ /// the PDF structure element this grouping represents
+ vcl::PDFWriter::StructElement maStructureElement;
+
+ /// flag for background object
+ bool mbBackground;
+ /// flag for image (OBJ_GRAF)
+ bool mbIsImage;
+ /// anchor structure element (Writer)
+ sal_Int32 m_nAnchorStructureElementId;
+
+ public:
+ /// constructor
+ StructureTagPrimitive2D(
+ const vcl::PDFWriter::StructElement& rStructureElement,
+ bool bBackground,
+ bool bIsImage,
+ Primitive2DContainer&& aChildren,
+ sal_Int32 nAnchorStructureElementId = -1);
+
+ /// data read access
+ const vcl::PDFWriter::StructElement& getStructureElement() const { return maStructureElement; }
+ bool isBackground() const { return mbBackground; }
+ bool isImage() const { return mbIsImage; }
+ bool isTaggedSdrObject() const;
+ sal_Int32 GetAnchorStructureElementId() const { return m_nAnchorStructureElementId; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx b/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx
new file mode 100644
index 000000000..66c68fdaf
--- /dev/null
+++ b/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx
@@ -0,0 +1,369 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vector>
+
+
+// SvgGradientEntry class
+
+namespace drawinglayer::primitive2d
+{
+ /// a single GradientStop defining a color and opacity at a distance
+ class SvgGradientEntry
+ {
+ private:
+ double mfOffset;
+ basegfx::BColor maColor;
+ double mfOpacity;
+
+ public:
+ SvgGradientEntry(double fOffset, const basegfx::BColor& rColor, double fOpacity)
+ : mfOffset(fOffset),
+ maColor(rColor),
+ mfOpacity(fOpacity)
+ {
+ }
+
+ double getOffset() const { return mfOffset; }
+ const basegfx::BColor& getColor() const { return maColor; }
+ double getOpacity() const { return mfOpacity; }
+
+ bool operator==(const SvgGradientEntry& rCompare) const
+ {
+ return (getOffset() == rCompare.getOffset()
+ && getColor() == rCompare.getColor()
+ && getOpacity() == rCompare.getOpacity());
+ }
+
+ bool operator<(const SvgGradientEntry& rCompare) const
+ {
+ return getOffset() < rCompare.getOffset();
+ }
+ };
+
+ typedef ::std::vector< SvgGradientEntry > SvgGradientEntryVector;
+
+ // SvgGradientHelper class
+
+ enum class SpreadMethod
+ {
+ Pad,
+ Reflect,
+ Repeat
+ };
+
+ /* helper for linear and radial gradient, both get derived from this
+ to share common definitions and functionality
+ **/
+ class SvgGradientHelper
+ {
+ private:
+ /// the extra gradient transform
+ basegfx::B2DHomMatrix maGradientTransform;
+
+ /// geometric definition, the geometry to be filled
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the gradient definition
+ SvgGradientEntryVector maGradientEntries;
+
+ // internal helper for case SpreadMethod::Reflect
+ SvgGradientEntryVector maMirroredGradientEntries;
+
+ /// start and/or center point
+ basegfx::B2DPoint maStart;
+
+ /// how to spread
+ SpreadMethod maSpreadMethod;
+
+ bool mbPreconditionsChecked : 1;
+ bool mbCreatesContent : 1;
+ bool mbSingleEntry : 1;
+ bool mbFullyOpaque : 1;
+
+ // true = interpret in unit coordinate system -> object aspect ratio will scale result
+ // false = interpret in object coordinate system -> object aspect ratio will not scale result
+ // (related to SVG's gradientUnits (userSpaceOnUse|objectBoundingBox)
+ bool mbUseUnitCoordinates : 1;
+
+ /// local helpers
+ const SvgGradientEntryVector& getMirroredGradientEntries() const;
+ void createMirroredGradientEntries();
+ const SvgGradientEntry& FindEntryLessOrEqual(sal_Int32& rInt, const double fFrac) const;
+ const SvgGradientEntry& FindEntryMore(sal_Int32& rInt,const double fFrac) const;
+
+ protected:
+ /// local helpers
+ void createSingleGradientEntryFill(Primitive2DContainer& rContainer) const;
+ virtual void createAtom(
+ Primitive2DContainer& rTargetColor,
+ Primitive2DContainer& rTargetOpacity,
+ const SvgGradientEntry& rFrom,
+ const SvgGradientEntry& rTo,
+ sal_Int32 nOffsetFrom,
+ sal_Int32 nOffsetTo) const = 0;
+ void createRun(
+ Primitive2DContainer& rTargetColor,
+ Primitive2DContainer& rTargetOpacity,
+ double fStart,
+ double fEnd) const;
+ virtual void checkPreconditions();
+ void createResult(
+ Primitive2DContainer& rContainer,
+ Primitive2DContainer aTargetColor,
+ Primitive2DContainer aTargetOpacity,
+ const basegfx::B2DHomMatrix& rUnitGradientToObject,
+ bool bInvert = false) const;
+ bool getCreatesContent() const { return mbCreatesContent; }
+ bool getSingleEntry() const { return mbSingleEntry; }
+ void setSingleEntry() { mbSingleEntry = true; }
+ bool getPreconditionsChecked() const { return mbPreconditionsChecked; }
+ bool getFullyOpaque() const { return mbFullyOpaque; }
+
+ public:
+ /// constructor
+ SvgGradientHelper(
+ const basegfx::B2DHomMatrix& rGradientTransform,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ SvgGradientEntryVector&& rGradientEntries,
+ const basegfx::B2DPoint& rStart,
+ bool bUseUnitCoordinates,
+ SpreadMethod aSpreadMethod);
+ virtual ~SvgGradientHelper();
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getGradientTransform() const { return maGradientTransform; }
+ const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
+ const SvgGradientEntryVector& getGradientEntries() const { return maGradientEntries; }
+ const basegfx::B2DPoint& getStart() const { return maStart; }
+ bool getUseUnitCoordinates() const { return mbUseUnitCoordinates; }
+ SpreadMethod getSpreadMethod() const { return maSpreadMethod; }
+
+ /// compare operator
+ bool operator==(const SvgGradientHelper& rSvgGradientHelper) const;
+ };
+
+ /// the basic linear gradient primitive
+ class DRAWINGLAYER_DLLPUBLIC SvgLinearGradientPrimitive2D final : public BufferedDecompositionPrimitive2D, public SvgGradientHelper
+ {
+ private:
+ /// the end point for linear gradient
+ basegfx::B2DPoint maEnd;
+
+ /// local helpers
+ virtual void createAtom(
+ Primitive2DContainer& rTargetColor,
+ Primitive2DContainer& rTargetOpacity,
+ const SvgGradientEntry& rFrom,
+ const SvgGradientEntry& rTo,
+ sal_Int32 nOffsetFrom,
+ sal_Int32 nOffsetTo) const override;
+ virtual void checkPreconditions() override;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ SvgLinearGradientPrimitive2D(
+ const basegfx::B2DHomMatrix& rGradientTransform,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ SvgGradientEntryVector&& rGradientEntries,
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ bool bUseUnitCoordinates,
+ SpreadMethod aSpreadMethod);
+ virtual ~SvgLinearGradientPrimitive2D() override;
+
+ /// data read access
+ const basegfx::B2DPoint& getEnd() const { return maEnd; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+
+ /// the basic radial gradient primitive
+ class DRAWINGLAYER_DLLPUBLIC SvgRadialGradientPrimitive2D final : public BufferedDecompositionPrimitive2D, public SvgGradientHelper
+ {
+ private:
+ /// the geometric definition
+ double mfRadius;
+
+ /// Focal only used when focal is set at all, see constructors
+ basegfx::B2DPoint maFocal;
+ basegfx::B2DVector maFocalVector;
+ double maFocalLength;
+
+ bool mbFocalSet : 1;
+
+ /// local helpers
+ virtual void createAtom(
+ Primitive2DContainer& rTargetColor,
+ Primitive2DContainer& rTargetOpacity,
+ const SvgGradientEntry& rFrom,
+ const SvgGradientEntry& rTo,
+ sal_Int32 nOffsetFrom,
+ sal_Int32 nOffsetTo) const override;
+ virtual void checkPreconditions() override;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ SvgRadialGradientPrimitive2D(
+ const basegfx::B2DHomMatrix& rGradientTransform,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ SvgGradientEntryVector&& rGradientEntries,
+ const basegfx::B2DPoint& rStart,
+ double fRadius,
+ bool bUseUnitCoordinates,
+ SpreadMethod aSpreadMethod,
+ const basegfx::B2DPoint* pFocal);
+ virtual ~SvgRadialGradientPrimitive2D() override;
+
+ /// data read access
+ double getRadius() const { return mfRadius; }
+ const basegfx::B2DPoint& getFocal() const { return maFocal; }
+ bool isFocalSet() const { return mbFocalSet; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+
+ // SvgLinearAtomPrimitive2D class
+
+ /* basic primitive for a single linear GradientRun in unit coordinates.
+ It's derived from DiscreteMetricDependentPrimitive2D to allow view-dependent
+ decompositions allowing reduced color steps
+ **/
+ class SvgLinearAtomPrimitive2D final : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ /// the geometric definition in unit coordinates
+ basegfx::BColor maColorA;
+ basegfx::BColor maColorB;
+ double mfOffsetA;
+ double mfOffsetB;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ SvgLinearAtomPrimitive2D(
+ const basegfx::BColor& aColorA, double fOffsetA,
+ const basegfx::BColor& aColorB, double fOffsetB);
+
+ /// data read access
+ const basegfx::BColor& getColorA() const { return maColorA; }
+ const basegfx::BColor& getColorB() const { return maColorB; }
+ double getOffsetA() const { return mfOffsetA; }
+ double getOffsetB() const { return mfOffsetB; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+
+ // SvgRadialAtomPrimitive2D class
+
+ /* basic primitive for a single radial GradientRun in unit coordinates.
+ It's derived from DiscreteMetricDependentPrimitive2D to allow view-dependent
+ decompositions allowing reduced color steps
+ **/
+ class SvgRadialAtomPrimitive2D final : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ /// the geometric definition in unit coordinates
+ basegfx::BColor maColorA;
+ basegfx::BColor maColorB;
+ double mfScaleA;
+ double mfScaleB;
+
+ // helper to hold translation vectors when given (for focal)
+ struct VectorPair
+ {
+ basegfx::B2DVector maTranslateA;
+ basegfx::B2DVector maTranslateB;
+
+ VectorPair(const basegfx::B2DVector& rTranslateA, const basegfx::B2DVector& rTranslateB)
+ : maTranslateA(rTranslateA),
+ maTranslateB(rTranslateB)
+ {
+ }
+ };
+
+ /// Only used when focal is set
+ std::unique_ptr<VectorPair> mpTranslate;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ SvgRadialAtomPrimitive2D(
+ const basegfx::BColor& aColorA, double fScaleA, const basegfx::B2DVector& rTranslateA,
+ const basegfx::BColor& aColorB, double fScaleB, const basegfx::B2DVector& rTranslateB);
+ SvgRadialAtomPrimitive2D(
+ const basegfx::BColor& aColorA, double fScaleA,
+ const basegfx::BColor& aColorB, double fScaleB);
+ virtual ~SvgRadialAtomPrimitive2D() override;
+
+ /// data read access
+ const basegfx::BColor& getColorA() const { return maColorA; }
+ const basegfx::BColor& getColorB() const { return maColorB; }
+ double getScaleA() const { return mfScaleA; }
+ double getScaleB() const { return mfScaleB; }
+ bool isTranslateSet() const { return (nullptr != mpTranslate); }
+ basegfx::B2DVector getTranslateA() const { if(mpTranslate) return mpTranslate->maTranslateA; return basegfx::B2DVector(); }
+ basegfx::B2DVector getTranslateB() const { if(mpTranslate) return mpTranslate->maTranslateB; return basegfx::B2DVector(); }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textbreakuphelper.hxx b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
new file mode 100644
index 000000000..d7dbeabb3
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+namespace drawinglayer::primitive2d { class TextSimplePortionPrimitive2D; }
+
+
+namespace drawinglayer::primitive2d
+{
+ enum class BreakupUnit
+ {
+ Character,
+ Word
+ };
+
+ class DRAWINGLAYER_DLLPUBLIC TextBreakupHelper
+ {
+ private:
+ const TextSimplePortionPrimitive2D& mrSource;
+ Primitive2DContainer mxResult;
+ TextLayouterDevice maTextLayouter;
+ basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose maDecTrans;
+
+ bool mbNoDXArray : 1;
+
+ /// create a portion from nIndex to nLength and append to rTempResult
+ void breakupPortion(Primitive2DContainer& rTempResult, sal_Int32 nIndex, sal_Int32 nLength, bool bWordLineMode);
+
+ /// breakup complete primitive
+ void breakup(BreakupUnit aBreakupUnit);
+
+ protected:
+ /// allow user callback to allow changes to the new TextTransformation. Default
+ /// does nothing. Retval defines if a primitive gets created, e.g. return false
+ /// to suppress creation
+ virtual bool allowChange(sal_uInt32 nCount, basegfx::B2DHomMatrix& rNewTransform, sal_uInt32 nIndex, sal_uInt32 nLength);
+
+ /// allow read access to evtl. useful local parts
+ const TextLayouterDevice& getTextLayouter() const { return maTextLayouter; }
+ const TextSimplePortionPrimitive2D& getSource() const { return mrSource; }
+
+ public:
+ TextBreakupHelper(const TextSimplePortionPrimitive2D& rSource);
+ virtual ~TextBreakupHelper();
+
+ /// get result
+ Primitive2DContainer extractResult(BreakupUnit aBreakupUnit = BreakupUnit::Character);
+ };
+
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
new file mode 100644
index 000000000..1a4d821c7
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
+
+namespace basegfx::utils {
+ class B2DHomMatrixBufferedOnDemandDecompose;
+}
+
+namespace drawinglayer::primitive2d
+{
+ /** TextDecoratedPortionPrimitive2D class
+
+ This primitive expands the TextSimplePortionPrimitive2D by common
+ decorations used in the office. It can be decomposed and will create
+ a TextSimplePortionPrimitive2D and all the contained decorations (if used)
+ as geometry.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextDecoratedPortionPrimitive2D final : public TextSimplePortionPrimitive2D
+ {
+ private:
+ /// decoration definitions
+ basegfx::BColor maOverlineColor;
+ basegfx::BColor maTextlineColor;
+ TextLine meFontOverline;
+ TextLine meFontUnderline;
+ TextStrikeout meTextStrikeout;
+ TextEmphasisMark meTextEmphasisMark;
+ TextRelief meTextRelief;
+
+ bool mbUnderlineAbove : 1;
+ bool mbWordLineMode : 1;
+ bool mbEmphasisMarkAbove : 1;
+ bool mbEmphasisMarkBelow : 1;
+ bool mbShadow : 1;
+
+ /// helper methods
+ void impCreateGeometryContent(
+ Primitive2DContainer& rTarget,
+ basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose const & rDecTrans,
+ const OUString& rText,
+ sal_Int32 nTextPosition,
+ sal_Int32 nTextLength,
+ const ::std::vector< double >& rDXArray,
+ const attribute::FontAttribute& rFontAttribute) const;
+
+ /// local decomposition.
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ TextDecoratedPortionPrimitive2D(
+ /// TextSimplePortionPrimitive2D parameters
+ const basegfx::B2DHomMatrix& rNewTransform,
+ const OUString& rText,
+ sal_Int32 nTextPosition,
+ sal_Int32 nTextLength,
+ std::vector< double >&& rDXArray,
+ const attribute::FontAttribute& rFontAttribute,
+ const css::lang::Locale& rLocale,
+ const basegfx::BColor& rFontColor,
+ const Color& rFillColor,
+
+ /// local parameters
+ const basegfx::BColor& rOverlineColor,
+ const basegfx::BColor& rTextlineColor,
+ TextLine eFontOverline = TEXT_LINE_NONE,
+ TextLine eFontUnderline = TEXT_LINE_NONE,
+ bool bUnderlineAbove = false,
+ TextStrikeout eTextStrikeout = TEXT_STRIKEOUT_NONE,
+ bool bWordLineMode = false,
+ TextEmphasisMark eTextEmphasisMark = TEXT_FONT_EMPHASIS_MARK_NONE,
+ bool bEmphasisMarkAbove = true,
+ bool bEmphasisMarkBelow = false,
+ TextRelief eTextRelief = TEXT_RELIEF_NONE,
+ bool bShadow = false);
+
+ /// data read access
+ TextLine getFontOverline() const { return meFontOverline; }
+ TextLine getFontUnderline() const { return meFontUnderline; }
+ TextStrikeout getTextStrikeout() const { return meTextStrikeout; }
+ TextEmphasisMark getTextEmphasisMark() const { return meTextEmphasisMark; }
+ TextRelief getTextRelief() const { return meTextRelief; }
+ const basegfx::BColor& getOverlineColor() const { return maOverlineColor; }
+ const basegfx::BColor& getTextlineColor() const { return maTextlineColor; }
+ bool getUnderlineAbove() const { return mbUnderlineAbove; }
+ bool getWordLineMode() const { return mbWordLineMode; }
+ bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; }
+ bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; }
+ bool getShadow() const { return mbShadow; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx b/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx
new file mode 100644
index 000000000..1017888d1
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <tools/fontenum.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** TextLine definition
+
+ This is used for both underline and overline
+ */
+ enum TextLine
+ {
+ TEXT_LINE_NONE,
+ TEXT_LINE_SINGLE,
+ TEXT_LINE_DOUBLE,
+ TEXT_LINE_DOTTED,
+ TEXT_LINE_DASH,
+ TEXT_LINE_LONGDASH,
+ TEXT_LINE_DASHDOT,
+ TEXT_LINE_DASHDOTDOT,
+ TEXT_LINE_SMALLWAVE,
+ TEXT_LINE_WAVE,
+ TEXT_LINE_DOUBLEWAVE,
+ TEXT_LINE_BOLD,
+ TEXT_LINE_BOLDDOTTED,
+ TEXT_LINE_BOLDDASH,
+ TEXT_LINE_BOLDLONGDASH,
+ TEXT_LINE_BOLDDASHDOT,
+ TEXT_LINE_BOLDDASHDOTDOT,
+ TEXT_LINE_BOLDWAVE
+ };
+
+ /** helper to convert LineStyle */
+ TextLine DRAWINGLAYER_DLLPUBLIC mapFontLineStyleToTextLine(FontLineStyle eLineStyle);
+ FontLineStyle DRAWINGLAYER_DLLPUBLIC mapTextLineToFontLineStyle(TextLine eLineStyle);
+
+ /** FontStrikeout definition */
+ enum TextStrikeout
+ {
+ TEXT_STRIKEOUT_NONE,
+ TEXT_STRIKEOUT_SINGLE,
+ TEXT_STRIKEOUT_DOUBLE,
+ TEXT_STRIKEOUT_BOLD,
+ TEXT_STRIKEOUT_SLASH,
+ TEXT_STRIKEOUT_X
+ };
+
+ /** helper to convert FontStrikeout */
+ TextStrikeout DRAWINGLAYER_DLLPUBLIC mapFontStrikeoutToTextStrikeout(::FontStrikeout eFontStrikeout);
+ ::FontStrikeout DRAWINGLAYER_DLLPUBLIC mapTextStrikeoutToFontStrikeout(TextStrikeout eFontStrikeout);
+
+ /** TextEmphasisMark definition */
+ enum TextEmphasisMark
+ {
+ TEXT_FONT_EMPHASIS_MARK_NONE,
+ TEXT_FONT_EMPHASIS_MARK_DOT,
+ TEXT_FONT_EMPHASIS_MARK_CIRCLE,
+ TEXT_FONT_EMPHASIS_MARK_DISC,
+ TEXT_FONT_EMPHASIS_MARK_ACCENT
+ };
+
+ /** TextRelief definition */
+ enum TextRelief
+ {
+ TEXT_RELIEF_NONE,
+ TEXT_RELIEF_EMBOSSED,
+ TEXT_RELIEF_ENGRAVED
+ };
+
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx b/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
new file mode 100644
index 000000000..00972a284
--- /dev/null
+++ b/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
@@ -0,0 +1,179 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <rtl/ustring.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** TextHierarchyLinePrimitive2D class
+
+ Text format hierarchy helper class. It decomposes to its
+ content, so all direct renderers may ignore it. If You need
+ to know more about line hierarchies You may react on it and
+ also need to take care that the source of data uses it.
+
+ This primitive encapsulates text lines.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyLinePrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyLinePrimitive2D(Primitive2DContainer&& aChildren);
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+
+ /** TextHierarchyBulletPrimitive2D class
+
+ This primitive encapsulates text bullets.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyBulletPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyBulletPrimitive2D(Primitive2DContainer&& aChildren);
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+
+ /** TextHierarchyParagraphPrimitive2D class
+
+ This primitive encapsulates text paragraphs.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyParagraphPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ // outline level of the encapsulated paragraph data.
+ // -1 means no level, >= 0 is the level
+ sal_Int16 mnOutlineLevel;
+
+ public:
+ /// constructor
+ explicit TextHierarchyParagraphPrimitive2D(
+ Primitive2DContainer&& aChildren,
+ sal_Int16 nOutlineLevel = -1);
+
+ /// data read access
+ sal_Int16 getOutlineLevel() const { return mnOutlineLevel; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+
+ /** TextHierarchyBlockPrimitive2D class
+
+ This primitive encapsulates text blocks.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyBlockPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyBlockPrimitive2D(Primitive2DContainer&& aChildren);
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+
+ /** FieldType definition */
+ enum FieldType
+ {
+ /** unspecified. If more info is needed for a FieldType,
+ create a new type and its handling
+ */
+ FIELD_TYPE_COMMON,
+
+ /** uses "FIELD_SEQ_BEGIN;PageField" -> special handling */
+ FIELD_TYPE_PAGE,
+
+ /** uses URL as string -> special handling */
+ FIELD_TYPE_URL
+ };
+
+ /** TextHierarchyFieldPrimitive2D class
+
+ This primitive encapsulates text fields.
+ Also: This type uses a type enum to transport the encapsulated field
+ type. Also added is a String which is type-dependent. E.g. for URL
+ fields, it contains the URL.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyFieldPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ /// field type definition
+ FieldType meType;
+
+ /// field data as name/value pairs (dependent of field type definition)
+ std::vector< std::pair< OUString, OUString>> meNameValue;
+
+ public:
+ /// constructor
+ TextHierarchyFieldPrimitive2D(
+ Primitive2DContainer&& aChildren,
+ const FieldType& rFieldType,
+ const std::vector< std::pair< OUString, OUString>>* pNameValue = nullptr);
+
+ /// data read access
+ FieldType getType() const { return meType; }
+ OUString getValue(const OUString& rName) const;
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+
+ /** TextHierarchyEditPrimitive2D class
+
+ #i97628#
+ Primitive to encapsulate text from an active text edit; some
+ renderers need to suppress this output due to painting the
+ edited text in e.g. an OutlinerEditView. It's derived from
+ GroupPrimitive2D, so the implicit decomposition will use the
+ content. To suppress, this primitive needs to be parsed by
+ the renderer without taking any action.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyEditPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyEditPrimitive2D(Primitive2DContainer&& aChildren);
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textlayoutdevice.hxx b/include/drawinglayer/primitive2d/textlayoutdevice.hxx
new file mode 100644
index 000000000..93587769c
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textlayoutdevice.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <basegfx/range/b2drange.hxx>
+#include <vector>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <vcl/svapp.hxx>
+
+// predefines
+class VirtualDevice;
+class GDIMetaFile;
+enum class DrawTextFlags;
+namespace vcl
+{
+class Font;
+}
+namespace tools
+{
+class Rectangle;
+}
+namespace drawinglayer::attribute
+{
+class FontAttribute;
+}
+namespace com::sun::star::lang
+{
+struct Locale;
+}
+
+// access to one global impTimedRefDev incarnation in namespace drawinglayer::primitive
+
+namespace drawinglayer::primitive2d
+{
+/** TextLayouterDevice class
+
+ This helper class exists to isolate all accesses to VCL
+ text formatting/handling functionality for primitive implementations.
+ When in the future FontHandling may move to an own library independent
+ from VCL, primitives will be prepared.
+ */
+class DRAWINGLAYER_DLLPUBLIC TextLayouterDevice
+{
+ /// internally used VirtualDevice
+ SolarMutexGuard maSolarGuard;
+ VirtualDevice& mrDevice;
+
+public:
+ /// constructor/destructor
+ TextLayouterDevice();
+ ~TextLayouterDevice() COVERITY_NOEXCEPT_FALSE;
+
+ /// tooling methods
+ void setFont(const vcl::Font& rFont);
+ void setFontAttribute(const attribute::FontAttribute& rFontAttribute, double fFontScaleX,
+ double fFontScaleY, const css::lang::Locale& rLocale);
+
+ double getTextHeight() const;
+ double getOverlineHeight() const;
+ double getOverlineOffset() const;
+ double getUnderlineHeight() const;
+ double getUnderlineOffset() const;
+ double getStrikeoutOffset() const;
+
+ double getTextWidth(const OUString& rText, sal_uInt32 nIndex, sal_uInt32 nLength) const;
+
+ void getTextOutlines(basegfx::B2DPolyPolygonVector&, const OUString& rText, sal_uInt32 nIndex,
+ sal_uInt32 nLength, const ::std::vector<double>& rDXArray) const;
+
+ basegfx::B2DRange getTextBoundRect(const OUString& rText, sal_uInt32 nIndex,
+ sal_uInt32 nLength) const;
+
+ double getFontAscent() const;
+ double getFontDescent() const;
+
+ void addTextRectActions(const tools::Rectangle& rRectangle, const OUString& rText,
+ DrawTextFlags nStyle, GDIMetaFile& rGDIMetaFile) const;
+
+ ::std::vector<double> getTextArray(const OUString& rText, sal_uInt32 nIndex,
+ sal_uInt32 nLength) const;
+
+ ::std::vector<double> getCaretPositions(const OUString& rText, sal_uInt32 nIndex,
+ sal_uInt32 nLength) const;
+};
+
+// helper methods for vcl font handling
+
+/** Create a VCL-Font based on the definitions in FontAttribute
+ and the given FontScaling. The FontScaling defines the FontHeight
+ (fFontScaleY) and the FontWidth (fFontScaleX). The combination of
+ both defines FontStretching, where no stretching happens at
+ fFontScaleY == fFontScaleX
+ */
+vcl::Font DRAWINGLAYER_DLLPUBLIC getVclFontFromFontAttribute(
+ const attribute::FontAttribute& rFontAttribute, double fFontScaleX, double fFontScaleY,
+ double fFontRotation, const css::lang::Locale& rLocale);
+
+/** Generate FontAttribute DataSet derived from the given VCL-Font.
+ The FontScaling with fFontScaleY, fFontScaleX relationship (see
+ above) will be set in return parameter o_rSize to allow further
+ processing
+ */
+attribute::FontAttribute DRAWINGLAYER_DLLPUBLIC getFontAttributeFromVclFont(
+ basegfx::B2DVector& o_rSize, const vcl::Font& rFont, bool bRTL, bool bBiDiStrong);
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textprimitive2d.hxx b/include/drawinglayer/primitive2d/textprimitive2d.hxx
new file mode 100644
index 000000000..1c23edafd
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textprimitive2d.hxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <drawinglayer/attribute/fontattribute.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+#include <tools/long.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <vector>
+
+namespace drawinglayer::primitive2d
+{
+/** TextSimplePortionPrimitive2D class
+
+ This is the basic primitive for representing a text portion. It contains
+ all needed information. If it is not handled by a renderer, its decomposition
+ will provide the text tools::PolyPolygon outlines as filled polygons, correctly
+ transformed.
+
+ To get better text quality, it is suggested to handle this primitive directly
+ in a renderer. In that case, e.g. hintings on the system can be supported.
+
+ @param maTextTransform
+ The text transformation contains the text start position (always baselined)
+ as translation, the FontSize as scale (where width relative to height defines
+ font scaling and width == height means no font scaling) and the font rotation
+ and shear.
+ When shear is used and a renderer does not support it, it may be better to use
+ the decomposition which will do everything correctly. Same is true for mirroring
+ which would be expressed as negative scalings.
+
+ @param rText
+ The text to be used. Only a part may be used, but a bigger part of the string
+ may be necessary for correct layouting (e.g. international)
+
+ @param aTextPosition
+ The index to the first character to use from rText
+
+ @param aTextLength
+ The number of characters to use from rText
+
+ @param rDXArray
+ The distances between the characters. This parameter may be empty, in that case
+ the renderer is responsible to do something useful. If it is given, it has to be of
+ the size aTextLength. Its values are in logical coordinates and describe the
+ distance for each character to use. This is independent from the font width which
+ is given with maTextTransform. The first value is the offset to use from the start
+ point in FontCoordinateSystem X-Direction (given by maTextTransform) to the start
+ point of the second character
+
+ @param rFontAttribute
+ The font definition
+
+ @param rLocale
+ The locale to use
+
+ @param rFontColor
+ The font color to use
+
+ @param bFilled
+
+ @param nWidthToFill
+
+ @param rTextFillColor
+ Text background color (has nothing to do with bFilled and nWidthToFill)
+
+ */
+class DRAWINGLAYER_DLLPUBLIC TextSimplePortionPrimitive2D : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// text transformation (FontCoordinateSystem)
+ basegfx::B2DHomMatrix maTextTransform;
+
+ /// The text, used from maTextPosition up to maTextPosition + maTextLength
+ OUString maText;
+
+ /// The index from where on maText is used
+ sal_Int32 mnTextPosition;
+
+ /// The length for maText usage, starting from maTextPosition
+ sal_Int32 mnTextLength;
+
+ /// The DX array in logic units
+ std::vector<double> maDXArray;
+
+ /// The font definition
+ attribute::FontAttribute maFontAttribute;
+
+ /// The Locale for the text
+ css::lang::Locale maLocale;
+
+ /// font color
+ basegfx::BColor maFontColor;
+
+ // Whether to fill a given width with the text
+ bool mbFilled;
+
+ // the width to fill
+ tools::Long mnWidthToFill;
+
+ /// The fill color of the text
+ Color maTextFillColor;
+
+ /// #i96669# internal: add simple range buffering for this primitive
+ basegfx::B2DRange maB2DRange;
+
+protected:
+ /// local decomposition.
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ TextSimplePortionPrimitive2D(const basegfx::B2DHomMatrix& rNewTransform, const OUString& rText,
+ sal_Int32 nTextPosition, sal_Int32 nTextLength,
+ std::vector<double>&& rDXArray,
+ const attribute::FontAttribute& rFontAttribute,
+ const css::lang::Locale& rLocale,
+ const basegfx::BColor& rFontColor, bool bFilled = false,
+ tools::Long nWidthToFill = 0,
+ const Color& rTextFillColor = COL_TRANSPARENT);
+
+ /** get text outlines as polygons and their according ObjectTransformation. Handles all
+ the necessary VCL outline extractions, scaling adaptations and other stuff.
+ */
+ void getTextOutlinesAndTransformation(basegfx::B2DPolyPolygonVector& rTarget,
+ basegfx::B2DHomMatrix& rTransformation) const;
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTextTransform() const { return maTextTransform; }
+ const OUString& getText() const { return maText; }
+ sal_Int32 getTextPosition() const { return mnTextPosition; }
+ sal_Int32 getTextLength() const { return mnTextLength; }
+ const ::std::vector<double>& getDXArray() const { return maDXArray; }
+ const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; }
+ const css::lang::Locale& getLocale() const { return maLocale; }
+ const basegfx::BColor& getFontColor() const { return maFontColor; }
+ const Color& getTextFillColor() const { return maTextFillColor; }
+ bool isFilled() const { return mbFilled; }
+ tools::Long getWidthToFill() const { return mnWidthToFill; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+};
+
+/// small helper to have a compare operator for Locale
+bool DRAWINGLAYER_DLLPUBLIC LocalesAreEqual(const css::lang::Locale& rA,
+ const css::lang::Locale& rB);
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/transformprimitive2d.hxx b/include/drawinglayer/primitive2d/transformprimitive2d.hxx
new file mode 100644
index 000000000..c1b620fc7
--- /dev/null
+++ b/include/drawinglayer/primitive2d/transformprimitive2d.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** TransformPrimitive2D class
+
+ This is one of the basic grouping primitives and it provides
+ embedding a sequence of primitives (a geometry) into a
+ transformation. All renderers have to handle this, usually by
+ building a current transformation stack (linear combination)
+ and applying this to all to-be-rendered geometry. If not handling
+ this, the output will be mostly wrong since this primitive is
+ widely used.
+
+ It does transform by embedding an existing geometry into a
+ transformation as Child-content. This allows re-usage of the
+ refcounted Uno-Api primitives and their existing, buffered
+ decompositions.
+
+ It could e.g. be used to show a single object geometry in 1000
+ different, transformed states without the need to create those
+ thousand primitive contents.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TransformPrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ // the transformation to apply to the child geometry
+ basegfx::B2DHomMatrix maTransformation;
+
+ public:
+ /// constructor
+ TransformPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransformation,
+ Primitive2DContainer&& rChildren);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/transparenceprimitive2d.hxx b/include/drawinglayer/primitive2d/transparenceprimitive2d.hxx
new file mode 100644
index 000000000..14658abe3
--- /dev/null
+++ b/include/drawinglayer/primitive2d/transparenceprimitive2d.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** TransparencePrimitive2D class
+
+ This is the basic primitive for applying freely defined transparence
+ to freely defined content. The basic idea is to associate a content
+ which is defined as a sequence of primitives and hold as child content
+ in the GroupPrimitive2D with a transparence channel also defined as a sequence
+ of primitives and hold in the transparence member.
+
+ The basic definition is to use the transparence content as transparence-Mask by
+ interpreting the transparence-content not as RGB, but as Luminance transparence mask
+ using the common RGB_to_luminance definition as e.g. used by VCL.
+
+ The defining geometry is the Range of the child primitive sequence,
+ this means the renderers will/shall use this geometric information for
+ rendering, not the transparent one. The transparent one should/will be clipped
+ accordingly.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TransparencePrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ /// The transparence-Mask who's RGB-Values are interpreted as Luminance
+ Primitive2DContainer maTransparence;
+
+ public:
+ /** constructor
+
+ @param rChildren
+ The content which is defined to have a transparency. The
+ range of this primitive is defined by this content
+
+ @param rTransparence
+ The definition of the Transparence-channel for this primitive. It
+ will be interpreted as mask by interpreting as gray values
+ using the common RGB_to_luminance definitions
+ */
+ TransparencePrimitive2D(
+ Primitive2DContainer&& rChildren,
+ Primitive2DContainer&& aTransparence);
+
+ /// data read access
+ const Primitive2DContainer& getTransparence() const { return maTransparence; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx b/include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx
new file mode 100644
index 000000000..b5a75f295
--- /dev/null
+++ b/include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+
+namespace drawinglayer::primitive2d
+{
+ /** UnifiedTransparencePrimitive2D class
+
+ This primitive encapsulates a child hierarchy and defines
+ that it shall be visualized with the given transparency. That
+ transparency is unique for all contained geometry, so that
+ e.g. overlapping polygons in the child geometry will not show
+ regions of combined transparency, but be all rendered with the
+ defined, single transparency.
+ */
+ class DRAWINGLAYER_DLLPUBLIC UnifiedTransparencePrimitive2D final : public GroupPrimitive2D
+ {
+ private:
+ /// the unified transparence
+ double mfTransparence;
+
+ public:
+ /// constructor
+ UnifiedTransparencePrimitive2D(
+ Primitive2DContainer&& rChildren,
+ double fTransparence);
+
+ /// data read access
+ double getTransparence() const { return mfTransparence; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// own getB2DRange implementation to include transparent geometries to BoundRect calculations
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// create decomposition
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx b/include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx
new file mode 100644
index 000000000..559e9e191
--- /dev/null
+++ b/include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+
+// WrongSpellPrimitive2D class
+
+namespace drawinglayer::primitive2d
+{
+ /** WrongSpellPrimitive2D class
+
+ This is a helper primitive to hold evtl. WrongSpell visualisations
+ in the sequence of primitives. The primitive holds this information
+ separated from the TextPortions to where it belongs to, to expand the
+ TextSimplePortionPrimitive2D more as needed.
+
+ A renderer who does not want to visualize this (if contained at all)
+ can detect and ignore this primitive. If its decomposition is used,
+ it will be visualized as red wavelines.
+
+ The geometric definition defines a line on the X-Axis (no Y-coordinates)
+ which will when transformed by Transformation, create the coordinate data.
+ */
+ class DRAWINGLAYER_DLLPUBLIC WrongSpellPrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// geometry definition
+ basegfx::B2DHomMatrix maTransformation;
+ double mfStart;
+ double mfStop;
+
+ /// color (usually red)
+ basegfx::BColor maColor;
+
+ /// create local decomposition
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ WrongSpellPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransformation,
+ double fStart,
+ double fStop,
+ const basegfx::BColor& rColor);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+ double getStart() const { return mfStart; }
+ double getStop() const { return mfStop; }
+ const basegfx::BColor& getColor() const { return maColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/Tools.hxx b/include/drawinglayer/primitive3d/Tools.hxx
new file mode 100644
index 000000000..4f0d4967e
--- /dev/null
+++ b/include/drawinglayer/primitive3d/Tools.hxx
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace drawinglayer::primitive3d
+{
+OUString DRAWINGLAYER_DLLPUBLIC idToString(sal_uInt32 nId);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/baseprimitive3d.hxx b/include/drawinglayer/primitive3d/baseprimitive3d.hxx
new file mode 100644
index 000000000..f1a4c5e4d
--- /dev/null
+++ b/include/drawinglayer/primitive3d/baseprimitive3d.hxx
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/graphic/XPrimitive3D.hpp>
+#include <basegfx/range/b3drange.hxx>
+#include <deque>
+
+
+/** defines for DeclPrimitive3DIDBlock and ImplPrimitive3DIDBlock
+ Added to be able to simply change identification stuff later, e.g. add
+ an identification string and/or ID to the interface and to the implementation
+ ATM used to declare implement getPrimitive3DID()
+ */
+
+#define DeclPrimitive3DIDBlock() \
+ virtual sal_uInt32 getPrimitive3DID() const override;
+
+#define ImplPrimitive3DIDBlock(TheClass, TheID) \
+ sal_uInt32 TheClass::getPrimitive3DID() const { return TheID; }
+
+
+// predefines
+
+namespace drawinglayer::geometry {
+ class ViewInformation3D;
+}
+
+namespace drawinglayer::primitive3d {
+ /// typedefs for basePrimitive3DImplBase, Primitive3DContainer and Primitive3DReference
+ typedef cppu::WeakComponentImplHelper< css::graphic::XPrimitive3D > BasePrimitive3DImplBase;
+ typedef css::uno::Reference< css::graphic::XPrimitive3D > Primitive3DReference;
+
+ class SAL_WARN_UNUSED DRAWINGLAYER_DLLPUBLIC Primitive3DContainer : public std::deque< Primitive3DReference >
+ {
+ public:
+ explicit Primitive3DContainer() {}
+ explicit Primitive3DContainer( size_type count ) : deque(count) {}
+ Primitive3DContainer( const Primitive3DContainer& other ) : deque(other) {}
+ Primitive3DContainer( Primitive3DContainer&& other ) noexcept : deque(std::move(other)) {}
+ Primitive3DContainer( std::initializer_list<Primitive3DReference> init ) : deque(init) {}
+ template <class Iter>
+ Primitive3DContainer(Iter first, Iter last) : deque(first, last) {}
+
+ void append(const Primitive3DContainer& rSource);
+ Primitive3DContainer& operator=(const Primitive3DContainer& r) { deque::operator=(r); return *this; }
+ Primitive3DContainer& operator=(Primitive3DContainer&& r) noexcept { deque::operator=(std::move(r)); return *this; }
+ bool operator==(const Primitive3DContainer& rB) const;
+ bool operator!=(const Primitive3DContainer& rB) const { return !operator==(rB); }
+ basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& aViewInformation) const;
+ };
+}
+
+
+// basePrimitive3D class
+
+namespace drawinglayer::primitive3d
+ {
+ /** BasePrimitive3D class
+
+ Baseclass for all C++ implementations of css::graphic::XPrimitive2D
+
+ The description/functionality is identical with the 2D case in baseprimitive2d.hxx,
+ please see there for detailed information.
+
+ Current Basic 3D Primitives are:
+
+ - PolygonHairlinePrimitive3D (for 3D hairlines)
+ - PolyPolygonMaterialPrimitive3D (for 3D filled plane polygons)
+
+ That's all for 3D!
+ */
+ class DRAWINGLAYER_DLLPUBLIC BasePrimitive3D
+ : protected cppu::BaseMutex,
+ public BasePrimitive3DImplBase
+ {
+ BasePrimitive3D(const BasePrimitive3D&) = delete;
+ BasePrimitive3D& operator=( const BasePrimitive3D& ) = delete;
+ public:
+ // constructor/destructor
+ BasePrimitive3D();
+ virtual ~BasePrimitive3D() override;
+
+ /** the ==operator is mainly needed to allow testing newly-created high level primitives against their last
+ incarnation which buffers/holds the decompositions. The default implementation
+ uses getPrimitive3DID()-calls to test if it's the same ID at last.
+ Overridden implementation are then based on this implementation.
+ */
+ virtual bool operator==( const BasePrimitive3D& rPrimitive ) const;
+ bool operator!=( const BasePrimitive3D& rPrimitive ) const { return !operator==(rPrimitive); }
+
+ /** This method is for places where using the C++ implementation directly is possible. The subprocessing
+ and range merging is more efficient when working directly on basegfx::B3DRange. The default implementation
+ will use getDecomposition results to create the range
+ */
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /** provide unique ID for fast identifying of known primitive implementations in renderers. These use
+ the defines from primitivetypes3d.hxx to define unique IDs.
+ */
+ virtual sal_uInt32 getPrimitive3DID() const = 0;
+
+ /// The default implementation returns an empty sequence
+ virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+
+ // Methods from XPrimitive3D
+
+
+ /** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It
+ will get the ViewInformation from the ViewParameters for that purpose
+ */
+ virtual css::uno::Sequence< ::css::uno::Reference< ::css::graphic::XPrimitive3D > > SAL_CALL getDecomposition( const css::uno::Sequence< css::beans::PropertyValue >& rViewParameters ) override;
+
+ /** the getRange default implementation will use getDecomposition to create the range information from merging
+ getRange results from the single local decomposition primitives.
+ */
+ virtual css::geometry::RealRectangle3D SAL_CALL getRange( const css::uno::Sequence< css::beans::PropertyValue >& rViewParameters ) override;
+ };
+
+} // end of namespace drawinglayer::primitive2d
+
+
+// BufferedDecompositionPrimitive3D class
+
+namespace drawinglayer::primitive3d
+ {
+ /** BufferedDecompositionPrimitive3D class
+
+ Baseclass for all C++ implementations of css::graphic::XPrimitive2D
+
+ The description/functionality is identical with the 2D case in baseprimitive2d.hxx,
+ please see there for detailed information
+ */
+ class DRAWINGLAYER_DLLPUBLIC BufferedDecompositionPrimitive3D
+ : public BasePrimitive3D
+ {
+ private:
+ /// a sequence used for buffering the last create3DDecomposition() result
+ Primitive3DContainer maBuffered3DDecomposition;
+
+ protected:
+ /** access methods to maBuffered3DDecomposition. The usage of this methods may allow
+ later thread-safe stuff to be added if needed. Only to be used by getDecomposition()
+ implementations for buffering the last decomposition.
+ */
+ const Primitive3DContainer& getBuffered3DDecomposition() const { return maBuffered3DDecomposition; }
+ void setBuffered3DDecomposition(const Primitive3DContainer& rNew) { maBuffered3DDecomposition = rNew; }
+
+ /** method which is to be used to implement the local decomposition of a 2D primitive. The default
+ implementation will just return an empty decomposition
+ */
+ virtual Primitive3DContainer create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ // constructor
+ BufferedDecompositionPrimitive3D();
+
+ /** The getDecomposition default implementation will on demand use create3DDecomposition() if
+ maBuffered3DDecomposition is empty. It will set maBuffered3DDecomposition to this obtained decomposition
+ to buffer it. If the decomposition is also ViewInformation-dependent, this method needs to be
+ overridden and the ViewInformation for the last decomposition needs to be remembered, too, and
+ be used in the next call to decide if the buffered decomposition may be reused or not.
+ */
+ virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+// tooling
+
+namespace drawinglayer::primitive3d
+ {
+ /// get B3DRange from a given Primitive3DReference
+ basegfx::B3DRange DRAWINGLAYER_DLLPUBLIC getB3DRangeFromPrimitive3DReference(const Primitive3DReference& rCandidate, const geometry::ViewInformation3D& aViewInformation);
+
+ /** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
+ and using compare operator
+ */
+ bool DRAWINGLAYER_DLLPUBLIC arePrimitive3DReferencesEqual(const Primitive3DReference& rA, const Primitive3DReference& rB);
+
+} // end of namespace drawinglayer::primitive3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx b/include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
new file mode 100644
index 000000000..54141823e
--- /dev/null
+++ b/include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_DRAWINGLAYER_PRIMITIVETYPES3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_DRAWINGLAYER_PRIMITIVETYPES3D_HXX
+
+
+// define ranges for other libraries
+
+#define PRIMITIVE3D_ID_RANGE_DRAWINGLAYER (0 << 16)
+
+
+// local primitives
+
+#define PRIMITIVE3D_ID_GROUPPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 0)
+#define PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 1)
+#define PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 2)
+#define PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 3)
+#define PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 4)
+#define PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 5)
+#define PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 6)
+#define PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 7)
+#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 8)
+#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9)
+#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10)
+#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11)
+#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12)
+#define PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13)
+#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14)
+#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15)
+#define PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16)
+#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17)
+#define PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18)
+
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE3D_DRAWINGLAYER_PRIMITIVETYPES3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/groupprimitive3d.hxx b/include/drawinglayer/primitive3d/groupprimitive3d.hxx
new file mode 100644
index 000000000..d77bb0db9
--- /dev/null
+++ b/include/drawinglayer/primitive3d/groupprimitive3d.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_GROUPPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_GROUPPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** GroupPrimitive3D class
+
+ Baseclass for all grouping 3D primitives
+
+ The description/functionality is identical with the 2D case in groupprimitive2d.hxx,
+ please see there for detailed information.
+
+ Current Basic 3D StatePrimitives are:
+
+ - ModifiedColorPrimitive3D (for a stack of color modifications)
+ - ShadowPrimitive3D (for 3D objects with shadow; this is a special case
+ since the shadow of a 3D primitive is a 2D primitive set)
+ - TexturePrimitive3D (with the following variations)
+ - GradientTexturePrimitive3D (for 3D gradient fill)
+ - BitmapTexturePrimitive3D (for 3D Bitmap fill)
+ - TransparenceTexturePrimitive3D (for 3D transparence)
+ - HatchTexturePrimitive3D (for 3D hatch fill)
+ - TransformPrimitive3D (for a transformation stack)
+ */
+ class DRAWINGLAYER_DLLPUBLIC GroupPrimitive3D : public BasePrimitive3D
+ {
+ private:
+ /// the children. Declared private since this shall never be changed at all after construction
+ Primitive3DContainer maChildren;
+
+ public:
+ /// constructor
+ explicit GroupPrimitive3D(const Primitive3DContainer& rChildren);
+
+ /// data read access
+ const Primitive3DContainer& getChildren() const { return maChildren; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive3D& rPrimitive ) const override;
+
+ /// local decomposition. Implementation will just return children
+ virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ /// provide unique ID
+ DeclPrimitive3DIDBlock()
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_GROUPPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx b/include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx
new file mode 100644
index 000000000..d33fba13d
--- /dev/null
+++ b/include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** ModifiedColorPrimitive3D class
+
+ This primitive is a grouping primitive and allows to define
+ how the colors of its child content shall be modified for
+ visualisation. Please see the ModifiedColorPrimitive2D
+ description for more info.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ModifiedColorPrimitive3D final : public GroupPrimitive3D
+ {
+ private:
+ /// The ColorModifier to use
+ basegfx::BColorModifierSharedPtr maColorModifier;
+
+ public:
+ /// constructor
+ ModifiedColorPrimitive3D(
+ const Primitive3DContainer& rChildren,
+ const basegfx::BColorModifierSharedPtr& rColorModifier);
+
+ /// data read access
+ const basegfx::BColorModifierSharedPtr& getColorModifier() const { return maColorModifier; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
+
+ /// provide unique ID
+ DeclPrimitive3DIDBlock()
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/polygonprimitive3d.hxx b/include/drawinglayer/primitive3d/polygonprimitive3d.hxx
new file mode 100644
index 000000000..76f4a8fe7
--- /dev/null
+++ b/include/drawinglayer/primitive3d/polygonprimitive3d.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** PolygonHairlinePrimitive3D class
+
+ This primitive defines a Hairline in 3D. Since hairlines are view-dependent,
+ this primitive is view-dependent, too.
+
+ This is one of the non-decomposable 3D primitives, so a renderer
+ should process it.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive3D : public BasePrimitive3D
+ {
+ private:
+ /// the hairline geometry
+ basegfx::B3DPolygon maPolygon;
+
+ /// the hairline color
+ basegfx::BColor maBColor;
+
+ public:
+ /// constructor
+ PolygonHairlinePrimitive3D(
+ const basegfx::B3DPolygon& rPolygon,
+ const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B3DPolygon& getB3DPolygon() const { return maPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ /// provide unique ID
+ DeclPrimitive3DIDBlock()
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** PolygonStrokePrimitive3D class
+
+ This primitive defines a 3D line with line width, line join, line color
+ and stroke attributes. It will be decomposed dependent on the definition
+ to the needed primitives, e.g. filled Tubes for fat lines.
+ */
+ class PolygonStrokePrimitive3D final : public BufferedDecompositionPrimitive3D
+ {
+ private:
+ /// the line geometry
+ basegfx::B3DPolygon maPolygon;
+
+ /// the line attributes like width, join and color
+ attribute::LineAttribute maLineAttribute;
+
+ /// the line stroking (if used)
+ attribute::StrokeAttribute maStrokeAttribute;
+
+ /// local decomposition.
+ virtual Primitive3DContainer create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ PolygonStrokePrimitive3D(
+ const basegfx::B3DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute);
+
+ /// data read access
+ const basegfx::B3DPolygon& getB3DPolygon() const { return maPolygon; }
+ const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
+
+ /// provide unique ID
+ DeclPrimitive3DIDBlock()
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx b/include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx
new file mode 100644
index 000000000..bc229840e
--- /dev/null
+++ b/include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <drawinglayer/attribute/materialattribute3d.hxx>
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** PolyPolygonMaterialPrimitive3D class
+
+ This primitive defines a planar 3D tools::PolyPolygon filled with a single color.
+ This is one of the non-decomposable primitives, so a renderer
+ should process it.
+
+ It is assumed here that the PolyPolgon is a single plane in 3D.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonMaterialPrimitive3D final : public BasePrimitive3D
+ {
+ private:
+ /// the tools::PolyPolygon geometry
+ basegfx::B3DPolyPolygon maPolyPolygon;
+
+ /// the fill parameters
+ attribute::MaterialAttribute3D maMaterial;
+
+ bool mbDoubleSided : 1;
+
+ public:
+ /// constructor
+ PolyPolygonMaterialPrimitive3D(
+ const basegfx::B3DPolyPolygon& rPolyPolygon,
+ const attribute::MaterialAttribute3D& rMaterial,
+ bool bDoubleSided);
+
+ /// data read access
+ const basegfx::B3DPolyPolygon& getB3DPolyPolygon() const { return maPolyPolygon; }
+ const attribute::MaterialAttribute3D& getMaterial() const { return maMaterial; }
+ bool getDoubleSided() const { return mbDoubleSided; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ /// provide unique ID
+ DeclPrimitive3DIDBlock()
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx
new file mode 100644
index 000000000..65a72366a
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRCUBEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRCUBEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** SdrCubePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D cube definition.
+ The cube is implicitly in unit coordinates and the given transformation
+ defines its geometry in space.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrCubePrimitive3D final : public SdrPrimitive3D
+ {
+ /// local decomposition.
+ virtual Primitive3DContainer create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ SdrCubePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute);
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ /// provide unique ID
+ DeclPrimitive3DIDBlock()
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRCUBEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx b/include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx
new file mode 100644
index 000000000..4caa0c819
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <vector>
+
+
+// predefines
+
+namespace drawinglayer::geometry {
+ class ViewInformation3D;
+}
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** SliceType3D definition */
+ enum SliceType3D
+ {
+ SLICETYPE3D_REGULAR, // normal geometry Slice3D
+ SLICETYPE3D_FRONTCAP, // front cap
+ SLICETYPE3D_BACKCAP // back cap
+ };
+
+ /// class to hold one Slice3D
+ class DRAWINGLAYER_DLLPUBLIC Slice3D final
+ {
+ basegfx::B3DPolyPolygon maPolyPolygon;
+ SliceType3D maSliceType;
+
+ public:
+ Slice3D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B3DHomMatrix& aTransform,
+ SliceType3D aSliceType = SLICETYPE3D_REGULAR)
+ : maPolyPolygon(basegfx::utils::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPolygon)),
+ maSliceType(aSliceType)
+ {
+ maPolyPolygon.transform(aTransform);
+ }
+
+ // data access
+ const basegfx::B3DPolyPolygon& getB3DPolyPolygon() const { return maPolyPolygon; }
+ SliceType3D getSliceType() const { return maSliceType; }
+ };
+
+ /// typedef for a group of Slice3Ds
+ typedef ::std::vector< Slice3D > Slice3DVector;
+
+ /// helpers for creation
+ void DRAWINGLAYER_DLLPUBLIC createLatheSlices(
+ Slice3DVector& rSliceVector,
+ const basegfx::B2DPolyPolygon& rSource,
+ double fBackScale,
+ double fDiagonal,
+ double fRotation,
+ sal_uInt32 nSteps,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+
+ void DRAWINGLAYER_DLLPUBLIC createExtrudeSlices(
+ Slice3DVector& rSliceVector,
+ const basegfx::B2DPolyPolygon& rSource,
+ double fBackScale,
+ double fDiagonal,
+ double fDepth,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+
+ /// helpers for geometry extraction
+ basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractHorizontalLinesFromSlice(const Slice3DVector& rSliceVector, bool bCloseHorLines);
+ basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractVerticalLinesFromSlice(const Slice3DVector& rSliceVector);
+
+ void DRAWINGLAYER_DLLPUBLIC extractPlanesFromSlice(
+ ::std::vector< basegfx::B3DPolyPolygon >& rFill,
+ const Slice3DVector& rSliceVector,
+ bool bCreateNormals,
+ bool bSmoothNormals,
+ bool bSmoothLids,
+ bool bClosed,
+ double fSmoothNormalsMix,
+ double fSmoothLidsMix,
+ bool bCreateTextureCoordinates,
+ const basegfx::B2DHomMatrix& rTexTransform);
+
+ void DRAWINGLAYER_DLLPUBLIC createReducedOutlines(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DHomMatrix& rObjectTransform,
+ const basegfx::B3DPolygon& rLoopA,
+ const basegfx::B3DPolygon& rLoopB,
+ basegfx::B3DPolyPolygon& rTarget);
+
+} // end of namespace drawinglayer::overlay
+
+
+#endif //_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
new file mode 100644
index 000000000..860f4f72b
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <optional>
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** SdrExtrudePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D extrude definition.
+ The given 2D tools::PolyPolygon geometry is imagined as lying on the XY-plane in 3D
+ and gets extruded in Z-Direction by Depth.
+
+ Various possibilities e.g. for creating diagonals (edge roudings in 3D)
+ and similar are given.
+
+ The decomposition will create all necessary 3D planes for visualisation.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrExtrudePrimitive3D final : public SdrPrimitive3D
+ {
+ private:
+ /// geometry helper for slices
+ basegfx::B2DPolyPolygon maCorrectedPolyPolygon;
+ Slice3DVector maSlices;
+
+ /// primitive geometry data
+ basegfx::B2DPolyPolygon maPolyPolygon;
+ double mfDepth;
+ double mfDiagonal;
+ double mfBackScale;
+
+ /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
+ std::optional<geometry::ViewInformation3D> mpLastRLGViewInformation;
+
+ bool mbSmoothNormals : 1; // Plane self
+ bool mbSmoothLids : 1; // Front/back
+ bool mbCharacterMode : 1;
+ bool mbCloseFront : 1;
+ bool mbCloseBack : 1;
+
+ /// create slices
+ void impCreateSlices();
+
+ /// get (evtl. create) slices
+ const Slice3DVector& getSlices() const;
+
+ /// local decomposition.
+ virtual Primitive3DContainer create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ SdrExtrudePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ double fDepth,
+ double fDiagonal,
+ double fBackScale,
+ bool bSmoothNormals,
+ bool bSmoothLids,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+ virtual ~SdrExtrudePrimitive3D() override;
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
+ double getDepth() const { return mfDepth; }
+ double getDiagonal() const { return mfDiagonal; }
+ double getBackScale() const { return mfBackScale; }
+ bool getSmoothNormals() const { return mbSmoothNormals; }
+ bool getSmoothLids() const { return mbSmoothLids; }
+ bool getCharacterMode() const { return mbCharacterMode; }
+ bool getCloseFront() const { return mbCloseFront; }
+ bool getCloseBack() const { return mbCloseBack; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ /// Overridden to allow for reduced line mode to decide if to buffer decomposition or not
+ virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ /// provide unique ID
+ DeclPrimitive3DIDBlock()
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
new file mode 100644
index 000000000..779d92e17
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <optional>
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** SdrLathePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D rotation definition.
+ The given 2D tools::PolyPolygon geometry is imagined as lying on the XY-plane in 3D
+ and gets rotated around the Y-Axis.
+
+ Various possibilities e.g. for creating diagonals (edge roudings in 3D)
+ and similar are given.
+
+ The decomposition will create all necessary 3D planes for visualisation.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrLathePrimitive3D final : public SdrPrimitive3D
+ {
+ private:
+ /// geometry helper for slices
+ basegfx::B2DPolyPolygon maCorrectedPolyPolygon;
+ Slice3DVector maSlices;
+
+ /// primitive geometry data
+ basegfx::B2DPolyPolygon maPolyPolygon;
+ sal_uInt32 mnHorizontalSegments;
+ sal_uInt32 mnVerticalSegments;
+ double mfDiagonal;
+ double mfBackScale;
+ double mfRotation;
+
+ /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
+ std::optional<geometry::ViewInformation3D> mpLastRLGViewInformation;
+
+ bool mbSmoothNormals : 1; // Plane self
+ bool mbSmoothLids : 1; // Front/back
+ bool mbCharacterMode : 1;
+ bool mbCloseFront : 1;
+ bool mbCloseBack : 1;
+
+ /// create slices
+ void impCreateSlices();
+
+ /// get (evtl. create) slices
+ const Slice3DVector& getSlices() const;
+
+ /// local decomposition.
+ virtual Primitive3DContainer create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ SdrLathePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ sal_uInt32 nHorizontalSegments,
+ sal_uInt32 nVerticalSegments,
+ double fDiagonal,
+ double fBackScale,
+ double fRotation,
+ bool bSmoothNormals,
+ bool bSmoothLids,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+ virtual ~SdrLathePrimitive3D() override;
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
+ sal_uInt32 getHorizontalSegments() const { return mnHorizontalSegments; }
+ sal_uInt32 getVerticalSegments() const { return mnVerticalSegments; }
+ double getDiagonal() const { return mfDiagonal; }
+ double getBackScale() const { return mfBackScale; }
+ double getRotation() const { return mfRotation; }
+ bool getSmoothNormals() const { return mbSmoothNormals; }
+ bool getSmoothLids() const { return mbSmoothLids; }
+ bool getCharacterMode() const { return mbCharacterMode; }
+ bool getCloseFront() const { return mbCloseFront; }
+ bool getCloseBack() const { return mbCloseBack; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ /// Overridden to allow for reduced line mode to decide if to buffer decomposition or not
+ virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ /// provide unique ID
+ DeclPrimitive3DIDBlock()
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx
new file mode 100644
index 000000000..922414cf6
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPOLYPOLYGONPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPOLYPOLYGONPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** SdrPolyPolygonPrimitive3D class
+
+ This 3D primitive defines a PolyPolgon in space which may have
+ Line- and FillStyles and extra 3D surface attributes. It is assumed
+ that the given 3D PolyPolgon (which may contain texture and normal
+ information) is planar in 3D.
+
+ The decomposition will include all needed 3D data for visualisation,
+ including FatLines and fill styles.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrPolyPolygonPrimitive3D final : public SdrPrimitive3D
+ {
+ private:
+ /// the planar polyPolygon evtl with normals and texture coordinates
+ basegfx::B3DPolyPolygon maPolyPolygon3D;
+
+ /// local decomposition.
+ virtual Primitive3DContainer create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ SdrPolyPolygonPrimitive3D(
+ const basegfx::B3DPolyPolygon& rPolyPolygon3D,
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute);
+
+ /// data access
+ const basegfx::B3DPolyPolygon& getPolyPolygon3D() const { return maPolyPolygon3D; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ /// provide unique ID
+ DeclPrimitive3DIDBlock()
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPOLYPOLYGONPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrprimitive3d.hxx
new file mode 100644
index 000000000..bd8991f78
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrprimitive3d.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <drawinglayer/attribute/sdrallattribute3d.hxx>
+#include <drawinglayer/primitive3d/sdrextrudelathetools3d.hxx>
+#include <drawinglayer/attribute/sdrobjectattribute3d.hxx>
+
+
+namespace drawinglayer
+{
+ /** SdrPrimitive3D class
+
+ Base class for the more complicated geometric primitives, so
+ derive from buffered primitive to allow overriding of
+ create3DDecomposition there.
+ */
+ namespace primitive3d
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrPrimitive3D : public BufferedDecompositionPrimitive3D
+ {
+ private:
+ /// object surface attributes
+ basegfx::B3DHomMatrix maTransform;
+ basegfx::B2DVector maTextureSize;
+ attribute::SdrLineFillShadowAttribute3D maSdrLFSAttribute;
+ attribute::Sdr3DObjectAttribute maSdr3DObjectAttribute;
+
+ protected:
+ /** Standard implementation for primitive3D which
+ will use maTransform as range and expand by evtl. line width / 2
+ */
+ basegfx::B3DRange getStandard3DRange() const;
+
+ /** implementation for primitive3D which
+ will use given Slice3Ds and expand by evtl. line width / 2
+ */
+ basegfx::B3DRange get3DRangeFromSlices(const Slice3DVector& rSlices) const;
+
+ public:
+ /// constructor
+ SdrPrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute);
+
+ /// data read access
+ const basegfx::B3DHomMatrix& getTransform() const { return maTransform; }
+ const basegfx::B2DVector& getTextureSize() const { return maTextureSize; }
+ const attribute::SdrLineFillShadowAttribute3D& getSdrLFSAttribute() const { return maSdrLFSAttribute; }
+ const attribute::Sdr3DObjectAttribute& getSdr3DObjectAttribute() const { return maSdr3DObjectAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx
new file mode 100644
index 000000000..af9090c3f
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRSPHEREPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRSPHEREPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** SdrSpherePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D sphere definition.
+ The sphere is implicitly in unit coordinates and the given transformation
+ defines its geometry in space.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrSpherePrimitive3D final : public SdrPrimitive3D
+ {
+ private:
+ /// additional geometry definitions
+ sal_uInt32 mnHorizontalSegments;
+ sal_uInt32 mnVerticalSegments;
+
+ /// local decomposition.
+ virtual Primitive3DContainer create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ public:
+ /// constructor
+ SdrSpherePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ sal_uInt32 nHorizontalSegments,
+ sal_uInt32 nVerticalSegments);
+
+ /// data read access
+ sal_uInt32 getHorizontalSegments() const { return mnHorizontalSegments; }
+ sal_uInt32 getVerticalSegments() const { return mnVerticalSegments; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ /// provide unique ID
+ DeclPrimitive3DIDBlock()
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRSPHEREPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/transformprimitive3d.hxx b/include/drawinglayer/primitive3d/transformprimitive3d.hxx
new file mode 100644
index 000000000..a99ea27e8
--- /dev/null
+++ b/include/drawinglayer/primitive3d/transformprimitive3d.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+
+namespace drawinglayer::primitive3d
+ {
+ /** TransformPrimitive3D class
+
+ This is one of the basic grouping 3D primitives and it provides
+ embedding a sequence of primitives (a geometry) into a
+ 3D transformation.
+
+ Please see the description for TransformPrimitive2D since these
+ primitives are pretty similar.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TransformPrimitive3D final : public GroupPrimitive3D
+ {
+ private:
+ // the 3D transformation to apply
+ basegfx::B3DHomMatrix maTransformation;
+
+ public:
+ /// constructor
+ TransformPrimitive3D(
+ const basegfx::B3DHomMatrix& rTransformation,
+ const Primitive3DContainer& rChildren);
+
+ /// data read access
+ const basegfx::B3DHomMatrix& getTransformation() const { return maTransformation; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override;
+
+ /// provide unique ID
+ DeclPrimitive3DIDBlock()
+ };
+
+} // end of namespace drawinglayer::primitive3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/baseprocessor2d.hxx b/include/drawinglayer/processor2d/baseprocessor2d.hxx
new file mode 100644
index 000000000..7ab718630
--- /dev/null
+++ b/include/drawinglayer/processor2d/baseprocessor2d.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+
+namespace drawinglayer::processor2d
+ {
+ /** BaseProcessor2D class
+
+ Base class for all C++ implementations of instances which process
+ primitives.
+
+ Instances which process primitives can be renderers, but also stuff
+ for HitTests, BoundRect calculations and/or animation processing. The
+ main usage are renderers, but they are supposed to handle any primitive
+ processing.
+
+ The base implementation is constructed with a ViewInformation2D which
+ is accessible throughout the processor implementations. The idea is
+ to construct any processor with a given ViewInformation2D. To be able
+ to handle primitives which need to change the current transformation
+ (as e.g. TransformPrimitive2D) it is allowed for the processor implementation
+ to change its local value using updateViewInformation.
+
+ The basic processing method is process(..) which gets handed over the
+ sequence of primitives to process. For convenience of the C++ implementations,
+ the default implementation of process(..) maps all accesses to primitives to
+ single calls to processBasePrimitive2D(..) where the primitive in question is
+ already casted to the C++ implementation class.
+
+ The process(..) implementation makes a complete iteration over the given
+ sequence of primitives. If the Primitive is not derived from BasePrimitive2D
+ and thus not part of the C++ implementations, it converts ViewInformation2D
+ to the corresponding API implementation (a uno::Sequence< beans::PropertyValue >)
+ and recursively calls the method process(..) at the primitive with the decomposition
+ derived from that primitive. This is the preparation to handle unknown implementations
+ of the css::graphic::XPrimitive2D interface in the future.
+
+ So, to implement a basic processor, it is necessary to override and implement the
+ processBasePrimitive2D(..) method. A minimal renderer has to support the
+ Basic Primitives (see baseprimitive2d.hxx) and the Grouping Primitives (see
+ groupprimitive2d.hxx). These are (currently):
+
+ Basic Primitives:
+
+ - BitmapPrimitive2D (bitmap data, possibly with transparency)
+ - PointArrayPrimitive2D (single points)
+ - PolygonHairlinePrimitive2D (hairline curves/polygons)
+ - PolyPolygonColorPrimitive2D (colored polygons)
+
+ Grouping Primitives:
+
+ - TransparencePrimitive2D (objects with freely defined transparence)
+ - InvertPrimitive2D (for XOR)
+ - MaskPrimitive2D (for masking)
+ - ModifiedColorPrimitive2D (for a stack of color modifications)
+ - TransformPrimitive2D (for a transformation stack)
+
+ A processor doing so is a minimal processor. Of course a processor may
+ handle any higher-level primitive (that has a decomposition implementation)
+ for more direct data access or performance reasons, too.
+
+ The main part of a processBasePrimitive2D implementation is a switch..case
+ construct, looking like the following:
+
+ void foo::processBasePrimitive2D(const BasePrimitive2D& rCandidate)
+ {
+ switch(rCandidate.getPrimitive2DID())
+ {
+ case PRIMITIVE2D_ID_??? :
+ {
+ // process PRIMITIVE2D_ID_??? here...
+
+ ...
+
+ break;
+ }
+
+ ...
+
+ default :
+ {
+ // process recursively
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ break;
+ }
+ }
+ }
+
+ The default case makes the processor work with all complex primitives
+ by recursively using their decomposition.
+
+ You can also add a case for ignoring primitives by using:
+
+ case PRIMITIVE2D_ID_...IGNORE.A.. :
+ case PRIMITIVE2D_ID_...IGNORE.B.. :
+ case PRIMITIVE2D_ID_...IGNORE.C.. :
+ {
+ // ignore these primitives by neither processing nor
+ // recursively processing their decomposition
+ break;
+ }
+
+ Another useful case is embedding the processing of a complex primitive by
+ bracketing it with some actions:
+
+ case PRIMITIVE2D_ID_SOME_TEXT :
+ {
+ // encapsulate e.g. with changing local variables, e.g.
+ // sometimes it's good to know if a basic primitive is
+ // part of a text, especially when not handling the text
+ // self but by purpose want to handle the decomposed
+ // geometries in the processor
+ startText();
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ endText();
+ break;
+ }
+
+ As an example a processor collecting the outlines of a sequence of primitives
+ only needs to handle some Basic Primitives and create outline and collect
+ outline polygons e.g. for primitives with area like BitmapPrimitive2D (a
+ rectangle) and PolyPolygonColorPrimitive2D. When also handling the Grouping
+ Primitives MaskPrimitive2D (e.g. ignoring its content, using the mask polyPolygon)
+ and TransformPrimitive2D (to have the correct local transformation), a processor
+ creating the outline can be written using just four (4) primitives. As a tipp, it can
+ be helpful to add many for the purpose not interesting higher level primitives
+ to not force their decomposition to be created and/or parsed.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BaseProcessor2D : public drawinglayer::primitive2d::Primitive2DDecompositionVisitor
+ {
+ private:
+ /// The ViewInformation2D itself. It's private to isolate accesses to it
+ geometry::ViewInformation2D maViewInformation2D;
+
+ protected:
+ /* access method to allow the implementations to change the current
+ ViewInformation2D if needed. This allows isolating these accesses
+ later if needed
+ */
+ void updateViewInformation(const geometry::ViewInformation2D& rViewInformation2D)
+ {
+ maViewInformation2D = rViewInformation2D;
+ }
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive2D-based.
+ Default implementation does nothing
+ */
+ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ void process(const primitive2d::BasePrimitive2D& rCandidate);
+
+ // Primitive2DDecompositionVisitor
+ virtual void visit(const primitive2d::Primitive2DReference&) override final;
+ virtual void visit(const primitive2d::Primitive2DContainer&) override final;
+ virtual void visit(primitive2d::Primitive2DContainer&&) override final;
+
+ public:
+ /// constructor/destructor
+ explicit BaseProcessor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~BaseProcessor2D();
+
+ /// the central processing method
+ void process(const primitive2d::Primitive2DContainer& rSource);
+
+ /// data read access
+ const geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; }
+ };
+
+} // end of namespace drawinglayer::processor2d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/contourextractor2d.hxx b/include/drawinglayer/processor2d/contourextractor2d.hxx
new file mode 100644
index 000000000..53158cc21
--- /dev/null
+++ b/include/drawinglayer/processor2d/contourextractor2d.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_CONTOUREXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_CONTOUREXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+
+namespace drawinglayer::processor2d
+ {
+ /** ContourExtractor2D class
+
+ A processor who extracts the contour of the primitives fed to it
+ in the single local PolyPolygon
+ */
+ class DRAWINGLAYER_DLLPUBLIC ContourExtractor2D final : public BaseProcessor2D
+ {
+ private:
+ /// the extracted contour
+ basegfx::B2DPolyPolygonVector maExtractedContour;
+
+ bool mbExtractFillOnly : 1;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) override;
+
+ public:
+ explicit ContourExtractor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ bool bExtractFillOnly);
+
+ virtual ~ContourExtractor2D() override;
+
+ const basegfx::B2DPolyPolygonVector& getExtractedContour() const { return maExtractedContour; }
+ };
+
+} // end of namespace drawinglayer::processor2d
+
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_CONTOUREXTRACTOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/hittestprocessor2d.hxx b/include/drawinglayer/processor2d/hittestprocessor2d.hxx
new file mode 100644
index 000000000..5638f6889
--- /dev/null
+++ b/include/drawinglayer/processor2d/hittestprocessor2d.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+
+namespace basegfx { class B2DPolygon; }
+namespace basegfx { class B2DPolyPolygon; }
+namespace drawinglayer::primitive2d { class ScenePrimitive2D; }
+
+namespace drawinglayer::processor2d
+ {
+ /** HitTestProcessor2D class
+
+ This processor implements a HitTest with the fed primitives,
+ given tolerance and extras
+ */
+ class DRAWINGLAYER_DLLPUBLIC HitTestProcessor2D final : public BaseProcessor2D
+ {
+ private:
+ /// discrete HitTest position
+ basegfx::B2DPoint maDiscreteHitPosition;
+
+ /// discrete HitTolerance
+ double mfDiscreteHitTolerance;
+
+ /// stack of HitPrimitives, taken care of during HitTest run
+ primitive2d::Primitive2DContainer maHitStack;
+
+ /// flag if HitStack shall be collected as part of the result, default is false
+ bool mbCollectHitStack : 1;
+
+ /// Boolean to flag if a hit was found. If yes, fast exit is taken
+ bool mbHit : 1;
+
+ /// flag to concentrate on text hits only
+ bool mbHitTextOnly : 1;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) override;
+ bool checkHairlineHitWithTolerance(
+ const basegfx::B2DPolygon& rPolygon,
+ double fDiscreteHitTolerance) const;
+ bool checkFillHitWithTolerance(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ double fDiscreteHitTolerance) const;
+ void check3DHit(const primitive2d::ScenePrimitive2D& rCandidate);
+
+ public:
+ HitTestProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ const basegfx::B2DPoint& rLogicHitPosition,
+ double fLogicHitTolerance,
+ bool bHitTextOnly);
+ virtual ~HitTestProcessor2D() override;
+
+ /// switch on collecting primitives for a found hit on maHitStack, default is off
+ void collectHitStack(bool bCollect) { mbCollectHitStack = bCollect; }
+
+ /// get HitStack of primitives, first is the one that created the hit, last is the
+ /// top-most
+ const primitive2d::Primitive2DContainer& getHitStack() const { return maHitStack; }
+
+ /// data read access
+ const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; }
+ double getDiscreteHitTolerance() const { return mfDiscreteHitTolerance; }
+ bool getCollectHitStack() const { return mbCollectHitStack; }
+ bool getHit() const { return mbHit; }
+ bool getHitTextOnly() const { return mbHitTextOnly; }
+ };
+
+} // end of namespace drawinglayer::processor2d
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/linegeometryextractor2d.hxx b/include/drawinglayer/processor2d/linegeometryextractor2d.hxx
new file mode 100644
index 000000000..a2a388dd1
--- /dev/null
+++ b/include/drawinglayer/processor2d/linegeometryextractor2d.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_LINEGEOMETRYEXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_LINEGEOMETRYEXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+
+namespace drawinglayer::processor2d
+ {
+ /** LineGeometryExtractor2D class
+
+ This processor can extract the line geometry from fed primitives. The
+ hairlines and the fill geometry from fat lines are separated.
+ */
+ class DRAWINGLAYER_DLLPUBLIC LineGeometryExtractor2D final : public BaseProcessor2D
+ {
+ private:
+ basegfx::B2DPolygonVector maExtractedHairlines;
+ basegfx::B2DPolyPolygonVector maExtractedLineFills;
+
+ bool mbInLineGeometry : 1;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) override;
+
+ public:
+ LineGeometryExtractor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~LineGeometryExtractor2D() override;
+
+ const basegfx::B2DPolygonVector& getExtractedHairlines() const { return maExtractedHairlines; }
+ const basegfx::B2DPolyPolygonVector& getExtractedLineFills() const { return maExtractedLineFills; }
+ };
+
+} // end of namespace drawinglayer::processor2d
+
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_LINEGEOMETRYEXTRACTOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/objectinfoextractor2d.hxx b/include/drawinglayer/processor2d/objectinfoextractor2d.hxx
new file mode 100644
index 000000000..f7dc1d146
--- /dev/null
+++ b/include/drawinglayer/processor2d/objectinfoextractor2d.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_OBJECTINFOEXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_OBJECTINFOEXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+
+namespace drawinglayer::primitive2d { class ObjectInfoPrimitive2D; }
+
+namespace drawinglayer::processor2d
+ {
+ /** ObjectInfoPrimitiveExtractor2D class
+
+ A processor to find the first incarnation of ObjectInfoPrimitive2D
+ in a given hierarchy
+ */
+ class DRAWINGLAYER_DLLPUBLIC ObjectInfoPrimitiveExtractor2D final : public BaseProcessor2D
+ {
+ private:
+ /// the target
+ const primitive2d::ObjectInfoPrimitive2D* mpFound;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) override;
+
+ public:
+ ObjectInfoPrimitiveExtractor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~ObjectInfoPrimitiveExtractor2D() override;
+
+ const primitive2d::ObjectInfoPrimitive2D* getResult() const { return mpFound; }
+ };
+
+} // end of namespace drawinglayer::processor2d
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_OBJECTINFOEXTRACTOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/processor2dtools.hxx b/include/drawinglayer/processor2d/processor2dtools.hxx
new file mode 100644
index 000000000..86ad2562e
--- /dev/null
+++ b/include/drawinglayer/processor2d/processor2dtools.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_PROCESSOR2DTOOLS_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_PROCESSOR2DTOOLS_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <memory>
+
+namespace drawinglayer::geometry { class ViewInformation2D; }
+namespace drawinglayer::processor2d { class BaseProcessor2D; }
+
+class OutputDevice;
+
+namespace drawinglayer::processor2d
+ {
+ /** create the best available pixel based BaseProcessor2D
+ (which may be system-dependent)
+
+ @param rTargetOutDev
+ The target OutputDevice
+
+ @param rViewInformation2D
+ The ViewInformation to use
+
+ @return
+ the created BaseProcessor2D (ownership change)
+ */
+ DRAWINGLAYER_DLLPUBLIC std::unique_ptr<BaseProcessor2D> createPixelProcessor2DFromOutputDevice(
+ OutputDevice& rTargetOutDev,
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D);
+
+ /** create a BaseProcessor2D dependent on some states of the
+ given OutputDevice. If metafile is recorded, the needed
+ VclMetafileProcessor2D will be created. If a pixel renderer
+ is requested, the best one is incarnated
+
+ @param rTargetOutDev
+ The target OutputDevice
+
+ @param rViewInformation2D
+ The ViewInformation to use
+
+ @return
+ the created BaseProcessor2D (ownership change)
+ */
+ DRAWINGLAYER_DLLPUBLIC std::unique_ptr<BaseProcessor2D> createProcessor2DFromOutputDevice(
+ OutputDevice& rTargetOutDev,
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D);
+
+
+} // end of namespace drawinglayer::processor2d
+
+#endif //INCLUDED_DRAWINGLAYER_PROCESSOR2D_PROCESSOR2DTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/processorfromoutputdevice.hxx b/include/drawinglayer/processor2d/processorfromoutputdevice.hxx
new file mode 100644
index 000000000..f5ba9da79
--- /dev/null
+++ b/include/drawinglayer/processor2d/processorfromoutputdevice.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_PROCESSORFROMOUTPUTDEVICE_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_PROCESSORFROMOUTPUTDEVICE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <memory>
+
+class OutputDevice;
+
+namespace drawinglayer::processor2d {
+ class BaseProcessor2D;
+}
+
+namespace drawinglayer::geometry { class ViewInformation2D; }
+
+namespace drawinglayer::processor2d
+ {
+ // create a mating VCL-Processor for given OutputDevice. This includes
+ // looking for MetaFile-recording. The returned renderer changes owner,
+ // deletion is duty of the caller
+ DRAWINGLAYER_DLLPUBLIC std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> createBaseProcessor2DFromOutputDevice(
+ OutputDevice& rTargetOutDev,
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D);
+
+} // end of namespace drawinglayer::processor2d
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_PROCESSORFROMOUTPUTDEVICE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/textaspolygonextractor2d.hxx b/include/drawinglayer/processor2d/textaspolygonextractor2d.hxx
new file mode 100644
index 000000000..42e2376f0
--- /dev/null
+++ b/include/drawinglayer/processor2d/textaspolygonextractor2d.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+#include <vector>
+
+
+namespace drawinglayer::processor2d
+ {
+ /// helper data structure for returning the result
+ struct DRAWINGLAYER_DLLPUBLIC TextAsPolygonDataNode
+ {
+ private:
+ basegfx::B2DPolyPolygon maB2DPolyPolygon;
+ basegfx::BColor maBColor;
+ bool mbIsFilled;
+
+ public:
+ TextAsPolygonDataNode(
+ const basegfx::B2DPolyPolygon& rB2DPolyPolygon,
+ const basegfx::BColor& rBColor,
+ bool bIsFilled)
+ : maB2DPolyPolygon(rB2DPolyPolygon),
+ maBColor(rBColor),
+ mbIsFilled(bIsFilled)
+ {
+ }
+
+ // data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maB2DPolyPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+ bool getIsFilled() const { return mbIsFilled; }
+ };
+
+ /// typedef for a vector of that helper data
+ typedef ::std::vector< TextAsPolygonDataNode > TextAsPolygonDataNodeVector;
+
+ /** TextAsPolygonExtractor2D class
+
+ This processor extracts text in the fed primitives to filled polygons
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextAsPolygonExtractor2D final : public BaseProcessor2D
+ {
+ private:
+ // extraction target
+ TextAsPolygonDataNodeVector maTarget;
+
+ // the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ // flag if we are in a decomposed text
+ sal_uInt32 mnInText;
+
+ // tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) override;
+
+ public:
+ explicit TextAsPolygonExtractor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~TextAsPolygonExtractor2D() override;
+
+ // data read access
+ const TextAsPolygonDataNodeVector& getTarget() const { return maTarget; }
+ };
+
+} // end of namespace drawinglayer::processor2d
+
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/baseprocessor3d.hxx b/include/drawinglayer/processor3d/baseprocessor3d.hxx
new file mode 100644
index 000000000..b70e38ee9
--- /dev/null
+++ b/include/drawinglayer/processor3d/baseprocessor3d.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+
+
+namespace drawinglayer::processor3d
+ {
+ /** BaseProcessor3D class
+
+ Baseclass for all C++ implementations of instances which process
+ primitives.
+
+ Please have a look at baseprocessor2d.hxx for more comments.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BaseProcessor3D
+ {
+ private:
+ geometry::ViewInformation3D maViewInformation3D;
+
+ protected:
+ void updateViewInformation(const geometry::ViewInformation3D& rViewInformation3D)
+ {
+ maViewInformation3D = rViewInformation3D;
+ }
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ Default implementation does nothing
+ */
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ explicit BaseProcessor3D(const geometry::ViewInformation3D& rViewInformation);
+ virtual ~BaseProcessor3D();
+
+ // the central processing method
+ void process(const primitive3d::Primitive3DContainer& rSource);
+
+ // data access
+ const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
+ };
+
+} // end of namespace drawinglayer::processor3d
+
+
+#endif //_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/cutfindprocessor3d.hxx b/include/drawinglayer/processor3d/cutfindprocessor3d.hxx
new file mode 100644
index 000000000..b237e9c68
--- /dev/null
+++ b/include/drawinglayer/processor3d/cutfindprocessor3d.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+namespace drawinglayer::processor3d
+ {
+ /** CutFindProcessor class
+
+ This processor extracts all cuts of 3D plane geometries in the fed primitives
+ with the given cut vector, based on the ViewInformation3D given.
+ */
+ class DRAWINGLAYER_DLLPUBLIC CutFindProcessor final : public BaseProcessor3D
+ {
+ private:
+ /// the start and stop point for the cut vector
+ basegfx::B3DPoint maFront;
+ basegfx::B3DPoint maBack;
+
+ /// the found cut points
+ ::std::vector< basegfx::B3DPoint > maResult;
+
+ /* #i102956# the transformation change from TransformPrimitive3D processings
+ needs to be remembered to be able to transform found cuts to the
+ basic coordinate system the processor starts with
+ */
+ basegfx::B3DHomMatrix maCombinedTransform;
+
+ bool mbAnyHit : 1;
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ */
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) override;
+
+ public:
+ CutFindProcessor(const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DPoint& rFront,
+ const basegfx::B3DPoint& rBack,
+ bool bAnyHit);
+
+ /// data read access
+ const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; }
+ };
+
+} // end of namespace drawinglayer::processor3d
+
+
+#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/tools/primitive2dxmldump.hxx b/include/drawinglayer/tools/primitive2dxmldump.hxx
new file mode 100644
index 000000000..9dc06e7b6
--- /dev/null
+++ b/include/drawinglayer/tools/primitive2dxmldump.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_TOOLS_PRIMITIVE2DXMLDUMP_HXX
+#define INCLUDED_DRAWINGLAYER_TOOLS_PRIMITIVE2DXMLDUMP_HXX
+
+#include <sal/config.h>
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <libxml/tree.h>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <test/xmldocptr.hxx>
+#include <vector>
+
+namespace tools { class XmlWriter; }
+
+namespace drawinglayer
+{
+
+class DRAWINGLAYER_DLLPUBLIC Primitive2dXmlDump final
+{
+private:
+ std::vector<bool> maFilter;
+ void decomposeAndWrite(const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence, tools::XmlWriter& rWriter);
+
+public:
+ Primitive2dXmlDump();
+ ~Primitive2dXmlDump();
+
+ /** Dumps the input primitive sequence to xml into a file or memory stream and parses the xml for testing.
+ *
+ * if rStreamName is set, then the xml content will be dumped into a file,
+ * otherwise if the rStreamName is empty, then the content will be dumped
+ * into a memory stream.
+ *
+ */
+ xmlDocUniquePtr dumpAndParse(const drawinglayer::primitive2d::Primitive2DContainer& aPrimitive2DSequence, const OUString& rStreamName = OUString());
+
+ /** Dumps the input primitive sequence to xml into a file. */
+ void dump(const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence, const OUString& rStreamName);
+
+};
+
+}
+
+#endif // INCLUDED_DRAWINGLAYER_TOOLS_PRIMITIVE2DXMLDUMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleComponentBase.hxx b/include/editeng/AccessibleComponentBase.hxx
new file mode 100644
index 000000000..80b0c2b95
--- /dev/null
+++ b/include/editeng/AccessibleComponentBase.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_ACCESSIBLECOMPONENTBASE_HXX
+#define INCLUDED_EDITENG_ACCESSIBLECOMPONENTBASE_HXX
+
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <editeng/editengdllapi.h>
+
+namespace com::sun::star::accessibility
+{
+class XAccessible;
+}
+
+namespace accessibility
+{
+/** @descr
+ This base class provides (will provide) a base implementation of the
+ XAccessibleComponent and the
+ XAccessibleExtendedComponent for all shapes. For
+ more detailed documentation about the methods refer to the interface
+ descriptions of XAccessible,
+ XAccessibleContext, <type>XInterface</type>,
+ XServiceInfo, and <type>XTypeProvider</type>.
+*/
+class EDITENG_DLLPUBLIC AccessibleComponentBase
+ : public css::accessibility::XAccessibleExtendedComponent
+{
+public:
+ //===== internal ========================================================
+ AccessibleComponentBase();
+ virtual ~AccessibleComponentBase();
+
+ //===== XAccessibleComponent ================================================
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine whether the given point lies
+ inside this object.
+ */
+ virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point& aPoint) override;
+
+ /** The default implementation returns an empty reference.
+ */
+ virtual css::uno::Reference<css::accessibility::XAccessible>
+ SAL_CALL getAccessibleAtPoint(const css::awt::Point& aPoint) override;
+
+ /** The default implementation returns an empty rectangle.
+ */
+ virtual css::awt::Rectangle SAL_CALL getBounds() override;
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine the location.
+ */
+ virtual css::awt::Point SAL_CALL getLocation() override;
+
+ /** The default implementation returns an empty position, i.e. the
+ * result of the default constructor of css::awt::Point.
+ */
+ virtual css::awt::Point SAL_CALL getLocationOnScreen() override;
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine the size.
+ */
+ virtual css::awt::Size SAL_CALL getSize() override;
+
+ /** The default implementation does nothing.
+ */
+ virtual void SAL_CALL grabFocus() override;
+
+ /** Returns black as the default foreground color.
+ */
+ virtual sal_Int32 SAL_CALL getForeground() override;
+
+ /** Returns white as the default background color.
+ */
+ virtual sal_Int32 SAL_CALL getBackground() override;
+
+ //===== XAccessibleExtendedComponent ====================================
+ virtual css::uno::Reference<css::awt::XFont> SAL_CALL getFont() override;
+ virtual OUString SAL_CALL getTitledBorderText() override;
+ virtual OUString SAL_CALL getToolTipText() override;
+
+ //===== XTypeProvider ===================================================
+
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes();
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleContextBase.hxx b/include/editeng/AccessibleContextBase.hxx
new file mode 100644
index 000000000..69ef3151c
--- /dev/null
+++ b/include/editeng/AccessibleContextBase.hxx
@@ -0,0 +1,341 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_ACCESSIBLECONTEXTBASE_HXX
+#define INCLUDED_EDITENG_ACCESSIBLECONTEXTBASE_HXX
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <editeng/editengdllapi.h>
+#include <rtl/ref.hxx>
+
+namespace com::sun::star::accessibility { class XAccessibleStateSet; }
+namespace com::sun::star::accessibility { class XAccessibleRelationSet; }
+namespace com::sun::star::accessibility { struct AccessibleEventObject; }
+namespace utl { class AccessibleStateSetHelper; }
+
+namespace accessibility {
+
+/** @descr
+ This base class provides an implementation of the
+ AccessibleContext service. Apart from the
+ <type>XXAccessible<type> and XAccessibleContextContext
+ interfaces it supports the XServiceInfo interface.
+*/
+class EDITENG_DLLPUBLIC AccessibleContextBase
+ : public cppu::BaseMutex,
+ public cppu::WeakComponentImplHelper<
+ css::accessibility::XAccessible,
+ css::accessibility::XAccessibleContext,
+ css::accessibility::XAccessibleEventBroadcaster,
+ css::lang::XServiceInfo
+ >
+{
+public:
+
+ //===== internal ========================================================
+
+ /** The origin of the accessible name or description.
+ */
+ enum StringOrigin {
+ ManuallySet,
+ FromShape,
+ AutomaticallyCreated,
+ NotSet
+ };
+
+ AccessibleContextBase (
+ css::uno::Reference< css::accessibility::XAccessible> xParent,
+ const sal_Int16 aRole);
+ virtual ~AccessibleContextBase() override;
+
+
+ /** Call all accessibility event listeners to inform them about the
+ specified event.
+ @param aEventId
+ Id of the event type.
+ @param rNewValue
+ New value of the modified attribute. Pass empty structure if
+ not applicable.
+ @param rOldValue
+ Old value of the modified attribute. Pass empty structure if
+ not applicable.
+ */
+ void CommitChange (sal_Int16 aEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue);
+
+ /** Set a new description and, provided that the new name differs from
+ the old one, broadcast an accessibility event.
+ @param rsDescription
+ The new description.
+ @param eDescriptionOrigin
+ The origin of the description. This is used to determine
+ whether the given description overrules the existing one. An
+ origin with a lower numerical value overrides one with a higher
+ value.
+ @throws css::uno::RuntimeException
+ */
+ void SetAccessibleDescription (
+ const OUString& rsDescription,
+ StringOrigin eDescriptionOrigin);
+
+ /** Set a new description and, provided that the new name differs from
+ the old one, broadcast an accessibility event.
+ @param rsName
+ The new name.
+ @param eNameOrigin
+ The origin of the name. This is used to determine whether the
+ given name overrules the existing one. An origin with a lower
+ numerical value overrides one with a higher value.
+ @throws css::uno::RuntimeException
+ */
+ void SetAccessibleName (
+ const OUString& rsName,
+ StringOrigin eNameOrigin);
+
+ /** Set the specified state (turn it on) and send events to all
+ listeners to inform them of the change.
+
+ @param aState
+ The state to turn on.
+
+ @return
+ If the specified state changed its value due to this call
+ <TRUE/> is returned, otherwise <FALSE/>.
+ */
+ virtual bool SetState (sal_Int16 aState);
+
+ /** Reset the specified state (turn it off) and send events to all
+ listeners to inform them of the change.
+
+ @param aState
+ The state to turn off.
+
+ @return
+ If the specified state changed its value due to this call
+ <TRUE/> is returned, otherwise <FALSE/>.
+ */
+ virtual bool ResetState (sal_Int16 aState);
+
+ /** Return the state of the specified state.
+
+ @param aState
+ The state for which to return its value.
+
+ @return
+ A value of <TRUE/> indicates that the state is set. A <FALSE/>
+ value indicates an unset state.
+ */
+ bool GetState (sal_Int16 aState);
+
+ /** Replace the current relation set with the specified one. Send
+ events for relations that are not in both sets.
+
+ @param rRelationSet
+ The new relation set that replaces the old one.
+
+ @throws css::uno::RuntimeException
+ */
+ void SetRelationSet (
+ const css::uno::Reference< css::accessibility::XAccessibleRelationSet>& rxRelationSet);
+
+
+ //===== XAccessible =====================================================
+
+ /// Return the XAccessibleContext.
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL
+ getAccessibleContext() override;
+
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount() override;
+
+ /// Return the specified child or throw exception.
+ virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 nIndex) override;
+
+ /// Return a reference to the parent.
+ virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
+ getAccessibleParent() override;
+
+ /// Return this objects index among the parents children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent() override;
+
+ /// Return this object's role.
+ virtual sal_Int16 SAL_CALL
+ getAccessibleRole() override;
+
+ /// Return this object's description.
+ virtual OUString SAL_CALL
+ getAccessibleDescription() override;
+
+ /// Return the object's current name.
+ virtual OUString SAL_CALL
+ getAccessibleName() override;
+
+ /// Return NULL to indicate that an empty relation set.
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet> SAL_CALL
+ getAccessibleRelationSet() override;
+
+ /// Return the set of current states.
+ virtual css::uno::Reference< css::accessibility::XAccessibleStateSet> SAL_CALL
+ getAccessibleStateSet() override;
+
+ /** Return the parents locale or throw exception if this object has no
+ parent yet/anymore.
+ */
+ virtual css::lang::Locale SAL_CALL
+ getLocale() override;
+
+ //===== XAccessibleEventBroadcaster ========================================
+
+ virtual void SAL_CALL
+ addAccessibleEventListener (
+ const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener) override;
+
+ virtual void SAL_CALL
+ removeAccessibleEventListener (
+ const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener) override;
+
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual OUString SAL_CALL
+ getImplementationName() override;
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const OUString& sServiceName) override;
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual css::uno::Sequence< OUString> SAL_CALL
+ getSupportedServiceNames() override;
+
+
+ //===== XTypeProvider ===================================================
+
+ /** Returns an implementation id.
+ */
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL
+ getImplementationId() override;
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of being disposed).
+
+ @return TRUE, if the object is disposed or in the course
+ of being disposed. Otherwise, FALSE is returned.
+ */
+ bool IsDisposed() const;
+
+protected:
+ /** The state set.
+ */
+ rtl::Reference<::utl::AccessibleStateSetHelper> mxStateSet;
+
+ /** The relation set. Relations can be set or removed by calling the
+ <member>AddRelation</member> and <member>RemoveRelation</member> methods.
+ */
+ css::uno::Reference< css::accessibility::XAccessibleRelationSet> mxRelationSet;
+
+ // This method is called from the component helper base class while disposing.
+ virtual void SAL_CALL disposing() override;
+
+ /** Create the accessible object's name. This method may be called more
+ than once for a single object.
+ @return
+ The returned string is a unique (among the accessible object's
+ siblings) name.
+ @throws css::uno::RuntimeException
+ */
+ virtual OUString CreateAccessibleName();
+
+ void FireEvent (const css::accessibility::AccessibleEventObject& aEvent);
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of being disposed). If that is the case then
+ DisposedException is thrown to inform the (indirect) caller of the
+ foul deed.
+ @throws css::lang::DisposedException
+ */
+ void ThrowIfDisposed();
+
+ /** sets the role as returned by XaccessibleContext::getAccessibleRole
+
+ <p>Caution: This is only to be used in the construction phase (means within
+ the ctor or late ctor), <em>never</em> when the object is still alive and part
+ of an Accessibility hierarchy.</p>
+ */
+ void SetAccessibleRole( sal_Int16 _nRole );
+
+private:
+ /// Reference to the parent object.
+ css::uno::Reference< css::accessibility::XAccessible> mxParent;
+
+ /** Description of this object. This is not a constant because it can
+ be set from the outside. Furthermore, it changes according to the
+ draw page's display mode.
+ */
+ OUString msDescription;
+
+ /** The origin of the description is used to determine whether new
+ descriptions given to the SetAccessibleDescription is ignored or
+ whether that replaces the old value in msDescription.
+ */
+ StringOrigin meDescriptionOrigin;
+
+ /** Name of this object. It changes according the draw page's
+ display mode.
+ */
+ OUString msName;
+
+ /** The origin of the name is used to determine whether new
+ name given to the SetAccessibleName is ignored or
+ whether that replaces the old value in msName.
+ */
+ StringOrigin meNameOrigin;
+
+ /** client id in the AccessibleEventNotifier queue
+ */
+ sal_uInt32 mnClientId;
+
+ /** This is the role of this object.
+ */
+ sal_Int16 maRole;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleEditableTextPara.hxx b/include/editeng/AccessibleEditableTextPara.hxx
new file mode 100644
index 000000000..d81cc6cd5
--- /dev/null
+++ b/include/editeng/AccessibleEditableTextPara.hxx
@@ -0,0 +1,388 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_ACCESSIBLEEDITABLETEXTPARA_HXX
+#define INCLUDED_EDITENG_ACCESSIBLEEDITABLETEXTPARA_HXX
+
+#include <config_options.h>
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/gen.hxx>
+#include <comphelper/compbase.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include <comphelper/accessibletexthelper.hxx>
+#include <editeng/AccessibleParaManager.hxx>
+#include <editeng/editdata.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvxViewForwarder;
+class MapMode;
+class SvxAccessibleTextAdapter;
+class SvxAccessibleTextEditViewAdapter;
+namespace accessibility { class AccessibleImageBullet; }
+namespace utl { class AccessibleStateSetHelper; }
+
+namespace accessibility
+{
+ typedef ::comphelper::WeakComponentImplHelper< css::accessibility::XAccessible,
+ css::accessibility::XAccessibleContext,
+ css::accessibility::XAccessibleComponent,
+ css::accessibility::XAccessibleEditableText,
+ css::accessibility::XAccessibleEventBroadcaster,
+ css::accessibility::XAccessibleTextAttributes,
+ css::accessibility::XAccessibleHypertext,
+ css::accessibility::XAccessibleMultiLineText,
+ css::lang::XServiceInfo > AccessibleTextParaInterfaceBase;
+
+ /** This class implements the actual text paragraphs for the EditEngine/Outliner UAA
+ */
+ class UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) AccessibleEditableTextPara final : public AccessibleTextParaInterfaceBase, private ::comphelper::OCommonAccessibleText
+ {
+
+ // override OCommonAccessibleText methods
+ virtual OUString implGetText() override;
+ virtual css::lang::Locale implGetLocale() override;
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override;
+ virtual void implGetParagraphBoundary( const OUString& rtext, css::i18n::Boundary& rBoundary, sal_Int32 nIndex ) override;
+ virtual void implGetLineBoundary( const OUString& rtext, css::i18n::Boundary& rBoundary, sal_Int32 nIndex ) override;
+
+ public:
+ /// Create accessible object for given parent
+ // #i27138#
+ // - add parameter <_pParaManager> (default value NULL)
+ // This has to be the instance of <AccessibleParaManager>, which
+ // created and manages this accessible paragraph.
+ AccessibleEditableTextPara ( css::uno::Reference< css::accessibility::XAccessible > xParent,
+ const AccessibleParaManager* _pParaManager = nullptr );
+
+ virtual ~AccessibleEditableTextPara () override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface (const css::uno::Type & rType) override;
+
+ // XAccessible
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override;
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override;
+ virtual sal_Int16 SAL_CALL getAccessibleRole() override;
+ /// Maximal length of text returned by getAccessibleDescription()
+ enum { MaxDescriptionLen = 40 };
+ virtual OUString SAL_CALL getAccessibleDescription() override;
+ virtual OUString SAL_CALL getAccessibleName() override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override;
+ virtual css::lang::Locale SAL_CALL getLocale() override;
+
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
+ virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
+ virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
+ virtual css::awt::Point SAL_CALL getLocation( ) override;
+ virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
+ virtual css::awt::Size SAL_CALL getSize( ) override;
+ virtual void SAL_CALL grabFocus( ) override;
+ virtual sal_Int32 SAL_CALL getForeground( ) override;
+ virtual sal_Int32 SAL_CALL getBackground( ) override;
+
+ // XAccessibleText (this comes implicitly inherited by XAccessibleEditableText AND by XAccessibleMultiLineText)
+ virtual sal_Int32 SAL_CALL getCaretPosition() override;
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override;
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override;
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override;
+ virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override;
+ virtual sal_Int32 SAL_CALL getCharacterCount() override;
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override;
+ virtual OUString SAL_CALL getSelectedText() override;
+ virtual sal_Int32 SAL_CALL getSelectionStart() override;
+ virtual sal_Int32 SAL_CALL getSelectionEnd() override;
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+ virtual OUString SAL_CALL getText() override;
+ virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+ virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
+
+ // XAccessibleEditableText
+ virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+ virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) override;
+ virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+ virtual sal_Bool SAL_CALL insertText( const OUString& sText, sal_Int32 nIndex ) override;
+ virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const OUString& sReplacement ) override;
+ virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::uno::Sequence< css::beans::PropertyValue >& aAttributeSet ) override;
+ virtual sal_Bool SAL_CALL setText( const OUString& sText ) override;
+
+ // XAccessibleTextAttributes
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getDefaultAttributes( const css::uno::Sequence< OUString >& RequestedAttributes ) override;
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const css::uno::Sequence< OUString >& RequestedAttributes ) override;
+
+ // XAccessibleHypertext
+ virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) override;
+ virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) override;
+
+ // XAccessibleMultiLineText
+ virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) override;
+ virtual css::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) override;
+ virtual css::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( ) override;
+ virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) override;
+ virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override;
+
+ /** Set the current index in the accessibility parent
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetIndexInParent( sal_Int32 nIndex );
+
+ /** Get the current index in the accessibility parent
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ sal_Int32 GetIndexInParent() const { return mnIndexInParent; }
+
+ /** Set the current paragraph number
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetParagraphIndex( sal_Int32 nIndex );
+
+ /** Query the current paragraph number (0 - nParas-1)
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ sal_Int32 GetParagraphIndex() const { return mnParagraphIndex; }
+
+ /** Set the edit engine offset
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetEEOffset( const Point& rOffset );
+
+ /** Set the EditEngine offset
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetEditSource( SvxEditSourceAdapter* pEditSource );
+
+ /** Dispose this object
+
+ Notifies and deregisters the listeners, drops all references.
+ */
+ void Dispose();
+
+ /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
+ void FireEvent(const sal_Int16 nEventId, const css::uno::Any& rNewValue = css::uno::Any(), const css::uno::Any& rOldValue = css::uno::Any() ) const;
+
+ /// Sets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
+ void SetState( const sal_Int16 nStateId );
+ /// Unsets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
+ void UnSetState( const sal_Int16 nStateId );
+
+ static tools::Rectangle LogicToPixel( const tools::Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder const & rForwarder );
+
+ SvxEditSourceAdapter& GetEditSource() const;
+
+ /** Query the SvxTextForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxAccessibleTextAdapter& GetTextForwarder() const;
+
+ /** Query the SvxViewForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxViewForwarder& GetViewForwarder() const;
+
+ /** Query whether a GetEditViewForwarder( sal_False ) will return a forwarder
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ bool HaveEditView() const;
+
+ /** Query the SvxEditViewForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxAccessibleTextEditViewAdapter& GetEditViewForwarder( bool bCreate = false ) const;
+
+ /** Send a TEXT_CHANGED event for this paragraph
+
+ This method internally caters for calculating text
+ differences, and sends the appropriate Anys in the
+ Accessibility::TEXT_CHANGED event
+ */
+ void TextChanged();
+
+ private:
+ AccessibleEditableTextPara( const AccessibleEditableTextPara& ) = delete;
+ AccessibleEditableTextPara& operator= ( const AccessibleEditableTextPara& ) = delete;
+
+ /** Calculate character range of similar attributes
+
+ @param nStartIndex
+ Therein, the start of the character range with the same attributes is returned
+
+ @param nEndIndex
+ Therein, the end (exclusively) of the character range with the same attributes is returned
+
+ @param nIndex
+ The character index at where to look for similar character attributes
+
+ @return false, if the method was not able to determine the range
+ */
+ bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nIndex );
+
+ int getNotifierClientId() const { return mnNotifierClientId; }
+
+ /// Do we have children? This is the case for image bullets
+ bool HaveChildren();
+
+ const Point& GetEEOffset() const { return maEEOffset; }
+
+ // Get text from forwarder
+ OUString GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex );
+ sal_Int32 GetTextLen() const;
+
+ /** Get the current selection of this paragraph
+
+ @return sal_False, if nothing in this paragraph is selected
+ */
+ bool GetSelection(sal_Int32& nStartPos, sal_Int32& nEndPos );
+
+ /** create selection from Accessible selection.
+
+ */
+ ESelection MakeSelection( sal_Int32 nStartEEIndex, sal_Int32 nEndEEIndex );
+ ESelection MakeSelection( sal_Int32 nEEIndex );
+ ESelection MakeCursor( sal_Int32 nEEIndex );
+
+ // check whether index value is within permitted range
+
+ /// Check whether 0<=nIndex<=n-1
+ void CheckIndex( sal_Int32 nIndex );
+ /// Check whether 0<=nIndex<=n
+ void CheckPosition( sal_Int32 nIndex );
+ /// Check whether 0<=nStart<=n and 0<=nEnd<=n
+ void CheckRange( sal_Int32 nStart, sal_Int32 nEnd );
+
+ void _correctValues( css::uno::Sequence< css::beans::PropertyValue >& rValues );
+ sal_Int32 SkipField(sal_Int32 nIndex, bool bForward);
+ // get overlapped field, extend return string. Only extend forward for now
+ void ExtendByField( css::accessibility::TextSegment& Segment );
+ OUString GetFieldTypeNameAtIndex(sal_Int32 nIndex);
+ // the paragraph index in the edit engine (guarded by solar mutex)
+ sal_Int32 mnParagraphIndex;
+
+ // our current index in the parent (guarded by solar mutex)
+ sal_Int32 mnIndexInParent;
+
+ // the current edit source (guarded by solar mutex)
+ SvxEditSourceAdapter* mpEditSource;
+
+ // the possible child (for image bullets, guarded by solar mutex)
+ typedef WeakCppRef < css::accessibility::XAccessible, AccessibleImageBullet > WeakBullet;
+ WeakBullet maImageBullet;
+
+ // the last string used for an Accessibility::TEXT_CHANGED event (guarded by solar mutex)
+ OUString maLastTextString;
+
+ // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
+ Point maEEOffset;
+
+ // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
+ rtl::Reference< ::utl::AccessibleStateSetHelper > mxStateSet;
+
+ /// The shape we're the accessible for (unguarded)
+ css::uno::Reference< css::accessibility::XAccessible > mxParent;
+
+ /// Our listeners (guarded by maMutex)
+ int mnNotifierClientId;
+private:
+ // Text paragraphs should provide FLOWS_TO and FLOWS_FROM relations (#i27138#)
+ // the paragraph manager, which created this instance - is NULL, if
+ // instance isn't created by AccessibleParaManager.
+ // Needed for method <getAccessibleRelationSet()> to retrieve predecessor
+ // paragraph and the successor paragraph.
+ const AccessibleParaManager* mpParaManager;
+ };
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleParaManager.hxx b/include/editeng/AccessibleParaManager.hxx
new file mode 100644
index 000000000..0eceac19c
--- /dev/null
+++ b/include/editeng/AccessibleParaManager.hxx
@@ -0,0 +1,272 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_ACCESSIBLEPARAMANAGER_HXX
+#define INCLUDED_EDITENG_ACCESSIBLEPARAMANAGER_HXX
+
+#include <config_options.h>
+#include <vector>
+#include <utility>
+#include <tools/gen.hxx>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <rtl/ref.hxx>
+#include <editeng/editengdllapi.h>
+
+namespace com::sun::star::accessibility { class XAccessible; }
+
+class SvxEditSourceAdapter;
+
+namespace accessibility
+{
+ class AccessibleEditableTextPara;
+
+ /** Helper class for weak object references plus implementation
+
+ This class combines a weak reference (to facilitate automatic
+ object disposal if user drops last reference) and hard
+ reference to the c++ class (for fast access and bypassing of
+ the UNO interface)
+ */
+ template < class UnoType, class CppType > class WeakCppRef
+ {
+ public:
+
+ typedef UnoType UnoInterfaceType;
+ typedef CppType InterfaceType;
+
+ WeakCppRef() : maWeakRef(), maUnsafeRef( nullptr ) {}
+
+ WeakCppRef(rtl::Reference<InterfaceType> const & rImpl):
+ maWeakRef(rImpl.get()),
+ maUnsafeRef(rImpl.get())
+ {
+ }
+
+ // get object with c++ object and hard reference (which
+ // prevents the c++ object from destruction during use)
+ rtl::Reference<InterfaceType> get() const {
+ css::uno::Reference<UnoInterfaceType> ref(maWeakRef);
+ return ref.is() ? maUnsafeRef : rtl::Reference<InterfaceType>();
+ }
+
+ // default copy constructor and assignment will do
+ // WeakCppRef( const WeakCppRef& );
+ // WeakCppRef& operator= ( const WeakCppRef& );
+
+ private:
+
+ // the interface, hold weakly
+ css::uno::WeakReference< UnoInterfaceType > maWeakRef;
+
+ // hard ref to c++ class, _only_ valid if maWeakRef.is() is true
+ InterfaceType* maUnsafeRef;
+ };
+
+
+ /** This class manages the paragraphs of an AccessibleTextHelper
+
+ To facilitate automatic deletion of paragraphs no longer used,
+ this class uses the WeakCppRef helper to hold the objects weakly.
+ */
+ class UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) AccessibleParaManager
+ {
+ public:
+ typedef WeakCppRef < css::accessibility::XAccessible, AccessibleEditableTextPara > WeakPara;
+ typedef ::std::pair< WeakPara, css::awt::Rectangle > WeakChild;
+ typedef ::std::pair< css::uno::Reference<
+ css::accessibility::XAccessible > , css::awt::Rectangle > Child;
+ typedef ::std::vector< WeakChild > VectorOfChildren;
+ typedef ::std::vector< sal_Int16 > VectorOfStates;
+
+ AccessibleParaManager();
+ ~AccessibleParaManager();
+
+ /** Sets a vector of additional accessible states.
+
+ The states are passed to every created child object
+ (text paragraph). The state values are defined in
+ css::accessibility::AccessibleStateType.
+ */
+ void SetAdditionalChildStates( VectorOfStates&& rChildStates );
+
+ /** Set the number of paragraphs
+
+ @param nNumPara
+ The total number of paragraphs the EditEngine currently
+ has (_not_ the number of currently visible children)
+ */
+ void SetNum( sal_Int32 nNumParas );
+
+ /** Get the number of paragraphs currently possible */
+ sal_Int32 GetNum() const;
+
+ // iterators
+ VectorOfChildren::iterator begin();
+ VectorOfChildren::iterator end();
+
+ /// Set focus to given child
+ void SetFocus( sal_Int32 nChild );
+
+ void FireEvent( sal_Int32 nPara,
+ const sal_Int16 nEventId ) const;
+
+ static bool IsReferencable(rtl::Reference<AccessibleEditableTextPara> const & aChild);
+ bool IsReferencable( sal_Int32 nChild ) const;
+ static void ShutdownPara( const WeakChild& rChild );
+
+ Child CreateChild( sal_Int32 nChild,
+ const css::uno::Reference< css::accessibility::XAccessible >& xFrontEnd,
+ SvxEditSourceAdapter& rEditSource,
+ sal_Int32 nParagraphIndex );
+
+ WeakChild GetChild( sal_Int32 nParagraphIndex ) const;
+ bool HasCreatedChild( sal_Int32 nParagraphIndex ) const;
+
+ // forwarder to all paragraphs
+ /// Make all children active and editable (or off)
+ void SetActive( bool bActive = true );
+ /// Set state of all children
+ void SetState( const sal_Int16 nStateId );
+ /// Unset state of all children
+ void UnSetState( const sal_Int16 nStateId );
+ /// Set offset to edit engine for all children
+ void SetEEOffset ( const Point& rOffset );
+ /// Dispose all living children
+ void Dispose ();
+
+ // forwarder to given paragraphs
+
+ /** Release the given range of paragraphs
+
+ All ranges have the meaning [start,end), similar to STL
+
+ @param nStartPara
+ Index of paragraph to start with releasing
+
+ @param nEndPara
+ Index of first paragraph to stop with releasing
+ */
+ void Release( sal_Int32 nStartPara, sal_Int32 nEndPara );
+
+ /** Fire event for the given range of paragraphs
+
+ All ranges have the meaning [start,end), similar to STL
+
+ @param nStartPara
+ Index of paragraph to start with event firing
+
+ @param nEndPara
+ Index of first paragraph to stop with event firing
+ */
+ void FireEvent( sal_Int32 nStartPara,
+ sal_Int32 nEndPara,
+ const sal_Int16 nEventId,
+ const css::uno::Any& rNewValue = css::uno::Any(),
+ const css::uno::Any& rOldValue = css::uno::Any() ) const;
+
+ /** Functor adapter for ForEach template
+
+ Adapts giving functor such that only the paragraph objects
+ are accessed and the fact that our children are held
+ weakly is hidden
+
+ The functor must provide the following method:
+ void operator() ( AccessibleEditablePara& )
+
+ */
+ template < typename Functor > class WeakChildAdapter
+ {
+ public:
+ WeakChildAdapter( Functor& rFunctor ) : mrFunctor(rFunctor) {}
+ void operator()( const WeakChild& rPara )
+ {
+ // retrieve hard reference from weak one
+ auto aHardRef( rPara.first.get() );
+
+ if( aHardRef.is() )
+ mrFunctor( *aHardRef );
+ }
+
+ private:
+ Functor& mrFunctor;
+ };
+
+ /** Adapter for unary member functions
+
+ Since STL's binder don't work with const& arguments (and
+ BOOST's neither, at least on MSVC), have to provide our
+ own adapter for unary member functions.
+
+ Create with pointer to member function of
+ AccessibleEditableTextPara and the corresponding argument.
+ */
+ template < typename Argument > class MemFunAdapter
+ {
+ public:
+ typedef void (::accessibility::AccessibleEditableTextPara::*FunctionPointer)( Argument );
+
+ MemFunAdapter( FunctionPointer aFunPtr, Argument aArg ) : maFunPtr(aFunPtr), maArg(aArg) {}
+ void operator()( const WeakChild& rPara )
+ {
+ // retrieve hard reference from weak one
+ auto aHardRef( rPara.first.get() );
+
+ if( aHardRef.is() )
+ (*aHardRef.*maFunPtr)( maArg );
+ }
+
+ private:
+ FunctionPointer maFunPtr;
+ Argument maArg;
+ };
+
+ private:
+ /// Set state on given child
+ void SetState( sal_Int32 nChild, const sal_Int16 nStateId );
+ /// Unset state on given child
+ void UnSetState( sal_Int32 nChild, const sal_Int16 nStateId );
+ /// Init child with default state (as stored in previous SetFocus and SetActive calls)
+ void InitChild( AccessibleEditableTextPara& rChild,
+ SvxEditSourceAdapter& rEditSource,
+ sal_Int32 nChild,
+ sal_Int32 nParagraphIndex ) const;
+
+ // vector the size of the paragraph number of the underlying EditEngine
+ VectorOfChildren maChildren;
+
+ /// Additional states that will be set at every created child object.
+ VectorOfStates maChildStates;
+
+ // cache EE offset for child creation
+ Point maEEOffset;
+
+ // which child currently has the focus (-1 for none)
+ sal_Int32 mnFocusedChild;
+
+ // whether children are active and editable
+ bool mbActive;
+ };
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleSelectionBase.hxx b/include/editeng/AccessibleSelectionBase.hxx
new file mode 100644
index 000000000..25746ddc5
--- /dev/null
+++ b/include/editeng/AccessibleSelectionBase.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_ACCESSIBLESELECTIONBASE_HXX
+#define INCLUDED_EDITENG_ACCESSIBLESELECTIONBASE_HXX
+
+#include <comphelper/accessibleselectionhelper.hxx>
+#include <editeng/editengdllapi.h>
+
+namespace accessibility
+{
+/** @descr
+ This base class provides a base implementation of the
+ XAccessibleSelection interface.
+ The following methods have to be implemented if this
+ class is used:
+
+ <method>implGetMutex</method>,
+ <method>implGetAccessibleContext</method>,
+ <method>implIsSelected</method>,
+ <method>implSelect</method>,
+*/
+ class EDITENG_DLLPUBLIC AccessibleSelectionBase : public ::comphelper::OCommonAccessibleSelection,
+ public css::accessibility::XAccessibleSelection
+ {
+ protected:
+
+ virtual ::osl::Mutex& implGetMutex() = 0;
+
+ public:
+
+ // XAccessibleSelection - default implementations
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override;
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override;
+ virtual void SAL_CALL clearAccessibleSelection( ) override;
+ virtual void SAL_CALL selectAllAccessibleChildren( ) override;
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
+
+ public:
+
+ AccessibleSelectionBase();
+ virtual ~AccessibleSelectionBase();
+ };
+
+}
+
+#endif // INCLUDED_EDITENG_ACCESSIBLESELECTIONBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleStaticTextBase.hxx b/include/editeng/AccessibleStaticTextBase.hxx
new file mode 100644
index 000000000..2f2095f07
--- /dev/null
+++ b/include/editeng/AccessibleStaticTextBase.hxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_ACCESSIBLESTATICTEXTBASE_HXX
+#define INCLUDED_EDITENG_ACCESSIBLESTATICTEXTBASE_HXX
+
+#include <memory>
+#include <tools/gen.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
+#include <com/sun/star/accessibility/TextSegment.hpp>
+#include <editeng/editengdllapi.h>
+
+namespace com::sun::star::accessibility { class XAccessible; }
+
+class SvxEditSource;
+
+namespace accessibility
+{
+
+ class AccessibleStaticTextBase_Impl;
+
+ typedef ::cppu::ImplHelper2<
+ css::accessibility::XAccessibleText,
+ css::accessibility::XAccessibleTextAttributes > AccessibleStaticTextBase_BASE;
+
+ /** Helper class for objects containing EditEngine/Outliner text
+
+ This class implements the XAccessibleText interface for static
+ text, somewhat similar to the children of the
+ AccessibleTextHelper class. Currently, there are no children,
+ i.e. the whole text is presented in one big chunk. This might
+ change in the future, if a need for image bullets should
+ arise. These, by convention, would be represented as children
+ of the text.
+
+ You have to implement the SvxEditSource, SvxTextForwarder,
+ SvxViewForwarder and SvxEditViewForwarder interfaces in order
+ to enable your object to cooperate with this
+ class. SvxTextForwarder encapsulates the fact that text
+ objects do not necessarily have an EditEngine at their
+ disposal, SvxViewForwarder and SvxEditViewForwarder do the
+ same for the document and the edit view. The three mentioned
+ forwarder objects are not stored by the AccessibleTextHelper,
+ but fetched every time from the SvxEditSource. So you are best
+ off making your SvxEditSource::Get*Forwarder methods cache the
+ current forwarder.
+
+ As this class is intended for static (i.e. non-changing) text
+ only, no event broadcasting is necessary. You must handle
+ visibility by yourself, the bounding boxes returned by
+ getCharacterBounds() are relative to your accessibility
+ object.
+
+ @attention All public non-UNO methods (those are the uppercase
+ ones) must not be called with any mutex hold, except when
+ calling from the main thread (with holds the solar mutex),
+ unless stated otherwise. This is because they themselves might
+ need the solar mutex in addition to the object mutex, and the
+ ordering of the locking must be: first solar mutex, then
+ object mutex. Furthermore, state change events might be fired
+ internally.
+
+ @derive Use this class as a base for objects containing static
+ edit engine text. To avoid overwriting every interface method
+ to intercept derived object defunc state, just set NULL as the
+ edit source. Every interface method will then properly throw
+ an exception.
+ */
+ class EDITENG_DLLPUBLIC AccessibleStaticTextBase : public AccessibleStaticTextBase_BASE
+ {
+
+ public:
+ /** Create accessible text object for given edit source
+
+ @param pEditSource
+ The edit source to use. Object ownership is transferred
+ from the caller to the callee. The object listens on the
+ SvxEditSource for object disposal, so no provisions have
+ to be taken if the caller destroys the data (e.g. the
+ model) contained in the given SvxEditSource.
+
+ */
+ explicit AccessibleStaticTextBase( ::std::unique_ptr< SvxEditSource > && pEditSource );
+
+ virtual ~AccessibleStaticTextBase();
+
+ private:
+ AccessibleStaticTextBase( const AccessibleStaticTextBase& ) = delete;
+ AccessibleStaticTextBase& operator= ( const AccessibleStaticTextBase& ) = delete;
+
+ public:
+
+ /** Set the current edit source
+
+ @attention You are required to have the solar mutex
+ locked, when calling this method. Thus, the method should
+ only be called from the main office thread.
+
+ The EditSource set here is required to broadcast out the
+ following hints: SfxHintId::EditSourceParasMoved,
+ SfxHintId::EditSourceSelectionChanged, SfxHintId::TextModified,
+ SfxHintId::TextParaInserted, SfxHintId::TextParaRemoved,
+ SfxHintId::TextHeightChanged,
+ SfxHintId::TextViewScrolled. Otherwise, not all state changes
+ will get noticed by the accessibility object. Further
+ more, when the corresponding core object or the model is
+ dying, either the edit source must be set to NULL or it
+ has to broadcast a SfxHintId::Dying hint.
+
+ This class does not have a dispose method, since it is not
+ a UNO component. Nevertheless, it holds C++ references to
+ several core objects, so you should issue a
+ SetEditSource(::std::unique_ptr<SvxEditSource>()) in
+ your dispose() method.
+
+ @param pEditSource
+ The new edit source to set. Object ownership is transferred
+ from the caller to the callee.
+ */
+ void SetEditSource( ::std::unique_ptr< SvxEditSource > && pEditSource );
+
+ /** Set the event source
+
+ @attention When setting a reference here, you should call
+ Dispose() when you as the owner are disposing, since until
+ then this object will hold that reference
+
+ @param rInterface
+ The interface that should be set as the source for
+ accessibility events sent by this object.
+ */
+ void SetEventSource( const css::uno::Reference< css::accessibility::XAccessible >& rInterface );
+
+ /** Set offset of EditEngine from parent
+
+ @attention You are required to have the solar mutex
+ locked, when calling this method. Thus, the method should
+ only be called from the main office thread.
+
+ If the origin of the underlying EditEngine does
+ not correspond to the upper left corner of the object
+ using this class, you have to specify the offset.
+
+ @param rPoint
+ The offset in screen coordinates (i.e. pixel)
+ */
+ void SetOffset( const Point& rPoint );
+
+ /** Drop all references and enter disposed state
+
+ This method drops all references to external objects (also
+ the event source reference set via SetEventSource()) and
+ sets the object into the disposed state (i.e. the methods
+ return default values or throw a uno::DisposedException
+ exception).
+ */
+ void Dispose();
+
+ // XAccessibleText interface implementation
+ virtual sal_Int32 SAL_CALL getCaretPosition() override;
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override;
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override;
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override;
+ virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override;
+ virtual sal_Int32 SAL_CALL getCharacterCount() override;
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override;
+ virtual OUString SAL_CALL getSelectedText() override;
+ virtual sal_Int32 SAL_CALL getSelectionStart() override;
+ virtual sal_Int32 SAL_CALL getSelectionEnd() override;
+ /// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+ virtual OUString SAL_CALL getText() override;
+ virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ /// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+ virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
+
+ // XAccessibleTextAttributes
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getDefaultAttributes( const css::uno::Sequence< OUString >& RequestedAttributes ) override;
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRunAttributes( sal_Int32 Index, const css::uno::Sequence< OUString >& RequestedAttributes ) override;
+
+ // child-related methods from XAccessibleContext
+ /// @throws css::uno::RuntimeException
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount();
+ /// @throws css::lang::IndexOutOfBoundsException
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i );
+
+ // child-related methods from XAccessibleComponent
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint );
+
+ protected:
+ tools::Rectangle GetParagraphBoundingBox() const;
+
+ private:
+
+ /// @dyn
+ const std::unique_ptr< AccessibleStaticTextBase_Impl > mpImpl;
+
+ };
+
+} // end of namespace accessibility
+
+#endif // INCLUDED_EDITENG_ACCESSIBLESTATICTEXTBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/CustomPropertyField.hxx b/include/editeng/CustomPropertyField.hxx
new file mode 100644
index 000000000..38f3119a0
--- /dev/null
+++ b/include/editeng/CustomPropertyField.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_EDITENG_CUSTOMPROPERTYFIELD_HXX
+#define INCLUDED_EDITENG_CUSTOMPROPERTYFIELD_HXX
+
+#include <editeng/editengdllapi.h>
+
+#include <editeng/flditem.hxx>
+
+#include <com/sun/star/text/textfield/Type.hpp>
+
+namespace com::sun::star::document { class XDocumentProperties; }
+
+
+namespace editeng
+{
+
+class EDITENG_DLLPUBLIC CustomPropertyField final : public SvxFieldData
+{
+private:
+ OUString msName;
+ OUString msCurrentPresentation;
+
+public:
+ explicit CustomPropertyField(OUString aName, OUString aCurrentPresentation);
+
+ virtual ~CustomPropertyField() override;
+
+ virtual sal_Int32 GetClassId() const override { return css::text::textfield::Type::DOCINFO_CUSTOM; }
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==(const SvxFieldData&) const override;
+
+ virtual MetaAction* createBeginComment() const override;
+
+ OUString GetFormatted(css::uno::Reference<css::document::XDocumentProperties> const & xDocumentProperties);
+
+ OUString const & GetName() const
+ {
+ return msName;
+ }
+
+ OUString const & GetCurrentPresentation() const
+ {
+ return msCurrentPresentation;
+ }
+};
+
+} // end editeng namespace
+
+#endif // INCLUDED_EDITENG_CUSTOMPROPERTYFIELD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/SpellPortions.hxx b/include/editeng/SpellPortions.hxx
new file mode 100644
index 000000000..75f625438
--- /dev/null
+++ b/include/editeng/SpellPortions.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_SPELLPORTIONS_HXX
+#define INCLUDED_EDITENG_SPELLPORTIONS_HXX
+
+#include <i18nlangtag/lang.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/linguistic2/SingleProofreadingError.hpp>
+#include <vector>
+
+namespace com::sun::star::linguistic2 {
+ class XSpellAlternatives;
+}
+
+namespace com::sun::star::linguistic2 { class XProofreader; }
+
+namespace svx{
+/** contains a portion of text that has the same language attributes applied
+ and belongs to the same script type.
+ */
+struct SpellPortion
+{
+ /** contains the text of the portion.
+ */
+ OUString sText;
+ /** for wrong words this reference is filled with the error information otherwise
+ it's an empty reference
+ */
+ css::uno::Reference< css::linguistic2::XSpellAlternatives> xAlternatives;
+ /** provides access to the grammar checker interface
+ */
+ css::uno::Reference< css::linguistic2::XProofreader > xGrammarChecker;
+ /** contains the proposed dialog title if the proof reading component provides one.
+ */
+ OUString sDialogTitle;
+ /** contains the grammar error information
+ */
+ css::linguistic2::SingleProofreadingError aGrammarError;
+ /** contains the language applied to the text. It has to match the script type.
+ */
+ LanguageType eLanguage;
+ /** Marks the portion as field, footnote symbol or any other special content that
+ should be protected against unintentional deletion.
+ */
+ bool bIsField;
+ /** Marks the portion hidden content that should not be touched by spell checking
+ and not be removed like redlines. The creator of the portions has to take care
+ for them.
+ */
+ bool bIsHidden;
+ /** determines whether the error type is a grammar error
+ */
+ bool bIsGrammarError;
+ /** marks portion as to-be-ignored. This is a return parameter.
+ */
+ bool bIgnoreThisError;
+
+ SpellPortion() :
+ eLanguage(LANGUAGE_DONTKNOW),
+ bIsField(false),
+ bIsHidden(false),
+ bIsGrammarError(false),
+ bIgnoreThisError(false)
+ {
+ aGrammarError.nErrorStart = aGrammarError.nErrorLength = aGrammarError.nErrorType = 0;
+ }
+};
+typedef std::vector<SpellPortion> SpellPortions;
+}//namespace svx
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/Trie.hxx b/include/editeng/Trie.hxx
new file mode 100644
index 000000000..e6ee659c3
--- /dev/null
+++ b/include/editeng/Trie.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_EDITENG_TRIE_HXX
+#define INCLUDED_EDITENG_TRIE_HXX
+
+#include <rtl/ustring.hxx>
+#include <editeng/editengdllapi.h>
+#include <memory>
+#include <vector>
+
+namespace editeng
+{
+struct TrieNode;
+
+class EDITENG_DLLPUBLIC Trie final
+{
+private:
+ std::unique_ptr<TrieNode> mRoot;
+
+public:
+ Trie();
+ ~Trie();
+
+ void insert(const OUString& sInputString) const;
+ void findSuggestions(const OUString& sWordPart, std::vector<OUString>& rSuggestionList) const;
+ size_t size() const;
+};
+}
+
+#endif // INCLUDED_EDITENG_TRIE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/UnoForbiddenCharsTable.hxx b/include/editeng/UnoForbiddenCharsTable.hxx
new file mode 100644
index 000000000..625198dad
--- /dev/null
+++ b/include/editeng/UnoForbiddenCharsTable.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOFORBIDDENCHARSTABLE_HXX
+#define INCLUDED_EDITENG_UNOFORBIDDENCHARSTABLE_HXX
+
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/linguistic2/XSupportedLocales.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <editeng/editengdllapi.h>
+#include <memory>
+
+class SvxForbiddenCharactersTable;
+
+class EDITENG_DLLPUBLIC SvxUnoForbiddenCharsTable : public cppu::WeakImplHelper<
+ css::i18n::XForbiddenCharacters,
+ css::linguistic2::XSupportedLocales>
+{
+protected:
+ /** this virtual function is called if the forbidden characters are changed */
+ virtual void onChange();
+
+ std::shared_ptr<SvxForbiddenCharactersTable> mxForbiddenChars;
+
+public:
+ SvxUnoForbiddenCharsTable(std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenChars);
+ virtual ~SvxUnoForbiddenCharsTable() override;
+
+ // XForbiddenCharacters
+ virtual css::i18n::ForbiddenCharacters SAL_CALL getForbiddenCharacters( const css::lang::Locale& rLocale ) override;
+ virtual sal_Bool SAL_CALL hasForbiddenCharacters( const css::lang::Locale& rLocale ) override;
+ virtual void SAL_CALL setForbiddenCharacters( const css::lang::Locale& rLocale, const css::i18n::ForbiddenCharacters& rForbiddenCharacters ) override;
+ virtual void SAL_CALL removeForbiddenCharacters( const css::lang::Locale& rLocale ) override;
+
+ // XSupportedLocales
+ virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getLocales( ) override;
+ virtual sal_Bool SAL_CALL hasLocale( const css::lang::Locale& aLocale ) override;
+};
+
+#endif // INCLUDED_EDITENG_UNOFORBIDDENCHARSTABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/acorrcfg.hxx b/include/editeng/acorrcfg.hxx
new file mode 100644
index 000000000..900cc2601
--- /dev/null
+++ b/include/editeng/acorrcfg.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_ACORRCFG_HXX
+#define INCLUDED_EDITENG_ACORRCFG_HXX
+
+#include <editeng/editengdllapi.h>
+#include <unotools/configitem.hxx>
+#include <memory>
+
+class SvxAutoCorrect;
+class SvxAutoCorrCfg;
+
+class SvxBaseAutoCorrCfg final : public utl::ConfigItem
+{
+private:
+ SvxAutoCorrCfg& rParent;
+ static css::uno::Sequence<OUString> GetPropertyNames();
+
+ virtual void ImplCommit() override;
+
+public:
+ SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rParent);
+ virtual ~SvxBaseAutoCorrCfg() override;
+
+ void Load(bool bInit);
+ virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames) override;
+ using ConfigItem::SetModified;
+};
+
+class SvxSwAutoCorrCfg final : public utl::ConfigItem
+{
+private:
+ SvxAutoCorrCfg& rParent;
+ static css::uno::Sequence<OUString> GetPropertyNames();
+
+ virtual void ImplCommit() override;
+
+public:
+ SvxSwAutoCorrCfg(SvxAutoCorrCfg& rParent);
+ virtual ~SvxSwAutoCorrCfg() override;
+
+ void Load(bool bInit);
+ virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames) override;
+ using ConfigItem::SetModified;
+};
+/*--------------------------------------------------------------------
+ Description: Configuration for Auto Correction
+ --------------------------------------------------------------------*/
+class EDITENG_DLLPUBLIC SvxAutoCorrCfg final
+{
+ friend class SvxBaseAutoCorrCfg;
+ friend class SvxSwAutoCorrCfg;
+
+ std::unique_ptr<SvxAutoCorrect> pAutoCorrect;
+
+ SvxBaseAutoCorrCfg aBaseConfig;
+ SvxSwAutoCorrCfg aSwConfig;
+
+ // Flags for Autotext:
+ bool bFileRel;
+ bool bNetRel;
+ // Help tip for Autotext as you type
+ bool bAutoTextTip;
+ bool bAutoTextPreview;
+ bool bAutoFmtByInput;
+ bool bSearchInAllCategories;
+
+public:
+ void SetModified()
+ {
+ aBaseConfig.SetModified();
+ aSwConfig.SetModified();
+ }
+ void Commit()
+ {
+ aBaseConfig.Commit();
+ aSwConfig.Commit();
+ }
+
+ SvxAutoCorrect* GetAutoCorrect() { return pAutoCorrect.get(); }
+ const SvxAutoCorrect* GetAutoCorrect() const { return pAutoCorrect.get(); }
+ // the pointer is transferred to the possession of the ConfigItems!
+ void SetAutoCorrect( SvxAutoCorrect* );
+
+ bool IsAutoFormatByInput() const { return bAutoFmtByInput; }
+ void SetAutoFormatByInput( bool bSet ) { bAutoFmtByInput = bSet;aSwConfig.SetModified();}
+
+ bool IsSaveRelFile() const { return bFileRel; }
+ void SetSaveRelFile( bool bSet ) { bFileRel = bSet; aSwConfig.SetModified(); }
+
+ bool IsSaveRelNet() const { return bNetRel; }
+ void SetSaveRelNet( bool bSet ) { bNetRel = bSet; aSwConfig.SetModified();}
+
+ bool IsAutoTextTip() const { return bAutoTextTip; }
+ void SetAutoTextTip(bool bSet ) { bAutoTextTip = bSet;aSwConfig.SetModified();}
+
+ bool IsSearchInAllCategories() const { return bSearchInAllCategories;}
+
+ SvxAutoCorrCfg();
+ ~SvxAutoCorrCfg();
+ static SvxAutoCorrCfg& Get();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/adjustitem.hxx b/include/editeng/adjustitem.hxx
new file mode 100644
index 000000000..e27939077
--- /dev/null
+++ b/include/editeng/adjustitem.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_ADJUSTITEM_HXX
+#define INCLUDED_EDITENG_ADJUSTITEM_HXX
+
+#include <svl/cenumitm.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxAdjustItem ---------------------------------------------------
+
+/*
+[Description]
+This item describes the row orientation.
+*/
+constexpr sal_uInt16 ADJUST_LASTBLOCK_VERSION = 0x0001;
+
+class EDITENG_DLLPUBLIC SvxAdjustItem final : public SfxEnumItemInterface
+{
+ bool bLeft : 1;
+ bool bRight : 1;
+ bool bCenter : 1;
+ bool bBlock : 1;
+
+ // only active when bBlock
+ bool bOneBlock : 1;
+ bool bLastCenter : 1;
+ bool bLastBlock : 1;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxAdjustItem( const SvxAdjust eAdjst /*= SvxAdjust::Left*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+ static OUString GetValueTextByPos( sal_uInt16 nPos );
+ virtual sal_uInt16 GetEnumValue() const override;
+ virtual void SetEnumValue( sal_uInt16 nNewVal ) override;
+ virtual SvxAdjustItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ void SetOneWord( const SvxAdjust eType )
+ {
+ bOneBlock = eType == SvxAdjust::Block;
+ }
+
+ void SetLastBlock( const SvxAdjust eType )
+ {
+ bLastBlock = eType == SvxAdjust::Block;
+ bLastCenter = eType == SvxAdjust::Center;
+ }
+
+ void SetAdjust( const SvxAdjust eType )
+ {
+ bLeft = eType == SvxAdjust::Left;
+ bRight = eType == SvxAdjust::Right;
+ bCenter = eType == SvxAdjust::Center;
+ bBlock = eType == SvxAdjust::Block;
+ }
+
+ SvxAdjust GetLastBlock() const
+ {
+ SvxAdjust eRet = SvxAdjust::Left;
+
+ if ( bLastBlock )
+ eRet = SvxAdjust::Block;
+ else if( bLastCenter )
+ eRet = SvxAdjust::Center;
+ return eRet;
+ }
+
+ SvxAdjust GetOneWord() const
+ {
+ SvxAdjust eRet = SvxAdjust::Left;
+
+ if ( bBlock && bOneBlock )
+ eRet = SvxAdjust::Block;
+ return eRet;
+ }
+
+ SvxAdjust GetAdjust() const
+ {
+ SvxAdjust eRet = SvxAdjust::Left;
+
+ if ( bRight )
+ eRet = SvxAdjust::Right;
+ else if ( bCenter )
+ eRet = SvxAdjust::Center;
+ else if ( bBlock )
+ eRet = SvxAdjust::Block;
+ return eRet;
+ }
+
+ sal_Int8 GetAsFlags() const
+ {
+ sal_Int8 nFlags = 0;
+ if ( bOneBlock )
+ nFlags |= 0x0001;
+ if ( bLastCenter )
+ nFlags |= 0x0002;
+ if ( bLastBlock )
+ nFlags |= 0x0004;
+ return nFlags;
+ }
+
+ void SetAsFlags(sal_Int8 nFlags)
+ {
+ bOneBlock = 0 != (nFlags & 0x0001);
+ bLastCenter = 0 != (nFlags & 0x0002);
+ bLastBlock = 0 != (nFlags & 0x0004);
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/autokernitem.hxx b/include/editeng/autokernitem.hxx
new file mode 100644
index 000000000..798aab04b
--- /dev/null
+++ b/include/editeng/autokernitem.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_AUTOKERNITEM_HXX
+#define INCLUDED_EDITENG_AUTOKERNITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxAutoKernItem -------------------------------------------------
+
+/*
+ [Description]
+ Attribute for Pair-Kerning.
+*/
+
+class EDITENG_DLLPUBLIC SvxAutoKernItem final : public SfxBoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxAutoKernItem( const bool bAutoKern /*= false*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxAutoKernItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/blinkitem.hxx b/include/editeng/blinkitem.hxx
new file mode 100644
index 000000000..4a4af0e62
--- /dev/null
+++ b/include/editeng/blinkitem.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_BLINKITEM_HXX
+#define INCLUDED_EDITENG_BLINKITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxBlinkItem -------------------------------------------------
+
+/*
+ [Description]
+ This item describes, whether to flash.
+*/
+
+class EDITENG_DLLPUBLIC SvxBlinkItem final : public SfxBoolItem
+{
+public:
+ SvxBlinkItem( const bool bBlink /*= false*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxBlinkItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/borderline.hxx b/include/editeng/borderline.hxx
new file mode 100644
index 000000000..6cf1c4512
--- /dev/null
+++ b/include/editeng/borderline.hxx
@@ -0,0 +1,246 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_BORDERLINE_HXX
+#define INCLUDED_EDITENG_BORDERLINE_HXX
+
+#include <com/sun/star/table/BorderLineStyle.hpp>
+
+#include <tools/color.hxx>
+#include <tools/long.hxx>
+#include <tools/mapunit.hxx>
+#include <editeng/editengdllapi.h>
+#include <svtools/borderline.hxx>
+
+class IntlWrapper;
+
+// Line width defaults in twips
+// Thin matches Excel's default values
+// See tdf#48622 for the discussion leading to these defaults.
+class SvxBorderLineWidth
+{
+public:
+ static const sal_Int16 Hairline = 1; // 0.05pt
+ static const sal_Int16 VeryThin = 10; // 0.5pt
+ static const sal_Int16 Thin = 15; // 0.75pt
+ static const sal_Int16 Medium = 30; // 1.5pt
+ static const sal_Int16 Thick = 45; // 2.25pt
+ static const sal_Int16 ExtraThick = 90; // 4.5pt
+};
+
+// Abstracts over values from css::table::BorderLineStyle
+enum class SvxBorderLineStyle : sal_Int16
+{
+ /** No border line
+ */
+ NONE = css::table::BorderLineStyle::NONE,
+
+ /** Solid border line.
+ */
+ SOLID = css::table::BorderLineStyle::SOLID,
+
+ /** Dotted border line.
+ */
+ DOTTED = css::table::BorderLineStyle::DOTTED,
+
+ /** Dashed border line.
+ */
+ DASHED = css::table::BorderLineStyle::DASHED,
+
+ /** Double border line. Widths of the lines and the gap are all equal,
+ and vary equally with the total width.
+ */
+ DOUBLE = css::table::BorderLineStyle::DOUBLE,
+
+ /** Double border line with a thin line outside and a thick line
+ inside separated by a small gap.
+ */
+ THINTHICK_SMALLGAP = css::table::BorderLineStyle::THINTHICK_SMALLGAP,
+
+ /** Double border line with a thin line outside and a thick line
+ inside separated by a medium gap.
+ */
+ THINTHICK_MEDIUMGAP = css::table::BorderLineStyle::THINTHICK_MEDIUMGAP,
+
+ /** Double border line with a thin line outside and a thick line
+ inside separated by a large gap.
+ */
+ THINTHICK_LARGEGAP = css::table::BorderLineStyle::THINTHICK_LARGEGAP,
+
+ /** Double border line with a thick line outside and a thin line
+ inside separated by a small gap.
+ */
+ THICKTHIN_SMALLGAP = css::table::BorderLineStyle::THICKTHIN_SMALLGAP,
+
+ /** Double border line with a thick line outside and a thin line
+ inside separated by a medium gap.
+ */
+ THICKTHIN_MEDIUMGAP = css::table::BorderLineStyle::THICKTHIN_MEDIUMGAP,
+
+ /** Double border line with a thick line outside and a thin line
+ inside separated by a large gap.
+ */
+ THICKTHIN_LARGEGAP = css::table::BorderLineStyle::THICKTHIN_LARGEGAP,
+
+ /** 3D embossed border line.
+ */
+ EMBOSSED = css::table::BorderLineStyle::EMBOSSED,
+
+ /** 3D engraved border line.
+ */
+ ENGRAVED = css::table::BorderLineStyle::ENGRAVED,
+
+ /** Outset border line.
+ */
+ OUTSET = css::table::BorderLineStyle::OUTSET,
+
+ /** Inset border line.
+ */
+ INSET = css::table::BorderLineStyle::INSET,
+
+ /** Finely dashed border line.
+ */
+ FINE_DASHED = css::table::BorderLineStyle::FINE_DASHED,
+
+ /** Double border line consisting of two fixed thin lines separated by a
+ variable gap.
+ */
+ DOUBLE_THIN = css::table::BorderLineStyle::DOUBLE_THIN,
+
+ /** Line consisting of a repetition of one dash and one dot. */
+ DASH_DOT = css::table::BorderLineStyle::DASH_DOT,
+
+ /** Line consisting of a repetition of one dash and 2 dots. */
+ DASH_DOT_DOT = css::table::BorderLineStyle::DASH_DOT_DOT,
+
+ /** Maximum valid border line style value.
+ */
+ BORDER_LINE_STYLE_MAX = css::table::BorderLineStyle::BORDER_LINE_STYLE_MAX,
+};
+
+namespace editeng
+{
+
+// convert border style between Word formats and LO
+SvxBorderLineStyle EDITENG_DLLPUBLIC ConvertBorderStyleFromWord(int);
+/// convert border width in twips between Word formats and LO
+double EDITENG_DLLPUBLIC ConvertBorderWidthToWord(SvxBorderLineStyle, double);
+double EDITENG_DLLPUBLIC ConvertBorderWidthFromWord(SvxBorderLineStyle,
+ double, int);
+
+class EDITENG_DLLPUBLIC SvxBorderLine final
+{
+ tools::Long m_nWidth;
+ tools::Long m_nMult;
+ tools::Long m_nDiv;
+ Color (*m_pColorOutFn)(Color);
+ Color (*m_pColorInFn)(Color);
+ Color (*m_pColorGapFn)(Color);
+ BorderWidthImpl m_aWidthImpl;
+ Color aColor;
+ SvxBorderLineStyle m_nStyle;
+ bool m_bMirrorWidths;
+ bool m_bUseLeftTop;
+
+public:
+ SvxBorderLine( const Color *pCol = nullptr,
+ tools::Long nWidth = 0,
+ SvxBorderLineStyle nStyle = SvxBorderLineStyle::SOLID,
+ Color (*pColorOutFn)( Color ) = &darkColor,
+ Color (*pColorInFn)( Color ) = &darkColor );
+
+ const Color& GetColor() const { return aColor; }
+ Color GetColorOut( bool bLeftOrTop = true ) const;
+ Color GetColorIn( bool bLeftOrTop = true ) const;
+ bool HasGapColor() const { return m_pColorGapFn != nullptr; }
+ Color GetColorGap() const;
+
+ void SetWidth( tools::Long nWidth );
+ /** Guess the style and width from the three lines widths values.
+
+ When the value of nStyle is SvxBorderLine::DOUBLE, the style set will be guessed
+ using the three values to match the best possible style among the following:
+ - SvxBorderLine::DOUBLE
+ - SvxBorderLine::THINTHICK_SMALLGAP
+ - SvxBorderLine::THINTHICK_MEDIUMGAP
+ - SvxBorderLine::THINTHICK_LARGEGAP
+ - SvxBorderLine::THICKTHIN_SMALLGAP
+ - SvxBorderLine::THICKTHIN_MEDIUMGAP
+ - SvxBorderLine::THICKTHIN_LARGEGAP
+
+ If no styles matches the width, then the width is set to 0.
+
+ There is one known case that could fit several styles: \a nIn = \a nDist = 0.75 pt,
+ \a nOut = 1.5 pt. This case fits SvxBorderLine::THINTHICK_SMALLGAP and
+ SvxBorderLine::THINTHICK_MEDIUMGAP with a 1.5 pt width and
+ SvxBorderLine::THINTHICK_LARGEGAP with a 0.75 pt width. The same case happens
+ also for thick-thin styles.
+
+ \param nStyle the border style used to guess the width.
+ \param nIn the width of the inner line in 1th pt
+ \param nOut the width of the outer line in 1th pt
+ \param nDist the width of the gap between the lines in 1th pt
+ */
+ void GuessLinesWidths( SvxBorderLineStyle nStyle, sal_uInt16 nOut, sal_uInt16 nIn = 0, sal_uInt16 nDist = 0 );
+
+ // TODO Hacky method to mirror lines in only a few cases
+ void SetMirrorWidths() { m_bMirrorWidths = true; }
+ tools::Long GetWidth( ) const { return m_nWidth; }
+ sal_uInt16 GetOutWidth() const;
+ sal_uInt16 GetInWidth() const;
+ sal_uInt16 GetDistance() const;
+
+ SvxBorderLineStyle GetBorderLineStyle() const { return m_nStyle; }
+
+ void SetColor( const Color &rColor ) { aColor = rColor; }
+ void SetBorderLineStyle( SvxBorderLineStyle nNew );
+ void ScaleMetrics( tools::Long nMult, tools::Long nDiv );
+
+ bool operator==( const SvxBorderLine &rCmp ) const;
+
+ OUString GetValueString( MapUnit eSrcUnit, MapUnit eDestUnit,
+ const IntlWrapper* pIntl,
+ bool bMetricStr = false ) const;
+
+ bool HasPriority( const SvxBorderLine& rOtherLine ) const;
+
+ bool isEmpty() const {
+ return m_aWidthImpl.IsEmpty()
+ || m_nStyle == SvxBorderLineStyle::NONE
+ || m_nWidth == 0;
+ }
+ bool isDouble() const { return m_aWidthImpl.IsDouble(); }
+ sal_uInt16 GetScaledWidth() const { return GetOutWidth() + GetInWidth() + GetDistance(); }
+
+ static Color darkColor( Color aMain );
+ static Color lightColor( Color aMain );
+
+ static Color threeDLightColor( Color aMain );
+ static Color threeDMediumColor( Color aMain );
+ static Color threeDDarkColor( Color aMain );
+
+ static BorderWidthImpl getWidthImpl( SvxBorderLineStyle nStyle );
+};
+
+EDITENG_DLLPUBLIC bool operator!=( const SvxBorderLine& rLeft, const SvxBorderLine& rRight );
+
+} // namespace editeng
+
+#endif
+
diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx
new file mode 100644
index 000000000..786821c02
--- /dev/null
+++ b/include/editeng/boxitem.hxx
@@ -0,0 +1,271 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_BOXITEM_HXX
+#define INCLUDED_EDITENG_BOXITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <o3tl/typed_flags_set.hxx>
+#include <memory>
+
+
+namespace editeng { class SvxBorderLine; }
+
+// class SvxBoxItem ------------------------------------------------------
+
+/* [Description]
+
+ This item describes a border attribute
+ (all four edges and the inward distance)
+*/
+enum class SvxBoxItemLine
+{
+ TOP, BOTTOM, LEFT, RIGHT, LAST = RIGHT
+};
+
+/**
+This version causes SvxBoxItem to store the 4 cell spacing distances separately
+when serializing to stream.
+*/
+constexpr sal_uInt16 BOX_4DISTS_VERSION = 1;
+/**
+This version causes SvxBoxItem to store the styles for its border lines when
+serializing to stream.
+*/
+constexpr sal_uInt16 BOX_BORDER_STYLE_VERSION = 2;
+
+class EDITENG_DLLPUBLIC SvxBoxItem final : public SfxPoolItem
+{
+ std::unique_ptr<editeng::SvxBorderLine>
+ pTop,
+ pBottom,
+ pLeft,
+ pRight;
+ sal_Int16 nTopDist,
+ nBottomDist,
+ nLeftDist,
+ nRightDist;
+ bool bRemoveAdjCellBorder;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxBoxItem( const sal_uInt16 nId );
+ SvxBoxItem( const SvxBoxItem &rCpy );
+ virtual ~SvxBoxItem() override;
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxBoxItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
+ virtual bool HasMetrics() const override;
+
+ const editeng::SvxBorderLine* GetTop() const { return pTop.get(); }
+ const editeng::SvxBorderLine* GetBottom() const { return pBottom.get(); }
+ const editeng::SvxBorderLine* GetLeft() const { return pLeft.get(); }
+ const editeng::SvxBorderLine* GetRight() const { return pRight.get(); }
+
+ const editeng::SvxBorderLine* GetLine( SvxBoxItemLine nLine ) const;
+
+ //The Pointers are being copied!
+ void SetLine( const editeng::SvxBorderLine* pNew, SvxBoxItemLine nLine );
+
+ sal_Int16 GetDistance( SvxBoxItemLine nLine, bool bAllowNegative = false ) const;
+ sal_uInt16 GetSmallestDistance() const;
+
+ bool IsRemoveAdjacentCellBorder() const { return bRemoveAdjCellBorder; }
+
+ void SetDistance( sal_Int16 nNew, SvxBoxItemLine nLine );
+ inline void SetAllDistances( sal_Int16 nNew );
+
+ void SetRemoveAdjacentCellBorder( bool bSet ) { bRemoveAdjCellBorder = bSet; }
+
+ // Line width plus Space plus inward distance
+ // bEvenIfNoLine = TRUE -> Also return distance, when no Line is set
+ sal_uInt16 CalcLineWidth( SvxBoxItemLine nLine ) const;
+ sal_Int16 CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine = false, bool bAllowNegative = false ) const;
+ bool HasBorder( bool bTreatPaddingAsBorder ) const;
+ static css::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, bool bConvert );
+ static bool LineToSvxLine(const css::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, bool bConvert);
+ static bool LineToSvxLine(const css::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, bool bConvert);
+
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+inline void SvxBoxItem::SetAllDistances(sal_Int16 const nNew)
+{
+ nTopDist = nBottomDist = nLeftDist = nRightDist = nNew;
+}
+
+// class SvxBoxInfoItem --------------------------------------------------
+
+/* [Description]
+
+ Another item for the border. This item has only limited functionality.
+ On one hand, the general Dialog is told by the item which options it
+ should offer. On the other hand, this attribute may be used to
+ transported the borderline for the inner horizontal and vertical lines.
+*/
+
+enum class SvxBoxInfoItemLine
+{
+ HORI, VERT, LAST = VERT
+};
+
+enum class SvxBoxInfoItemValidFlags
+{
+ NONE = 0x00,
+ TOP = 0x01,
+ BOTTOM = 0x02,
+ LEFT = 0x04,
+ RIGHT = 0x08,
+ HORI = 0x10,
+ VERT = 0x20,
+ DISTANCE = 0x40,
+ DISABLE = 0x80,
+ ALL = 0xff
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvxBoxInfoItemValidFlags> : is_typed_flags<SvxBoxInfoItemValidFlags, 0xff> {};
+}
+
+class EDITENG_DLLPUBLIC SvxBoxInfoItem final : public SfxPoolItem
+{
+ std::unique_ptr<editeng::SvxBorderLine> pHori; //inner horizontal Line
+ std::unique_ptr<editeng::SvxBorderLine> pVert; //inner vertical Line
+
+ bool mbEnableHor; /// true = Enable inner horizontal line.
+ bool mbEnableVer; /// true = Enable inner vertical line.
+
+ /*
+ Currently only for StarWriter: distance inward from SvxBoxItem. If the
+ distance is requested, then the field for the distance from the dialog be
+ activated. nDefDist is regarded as a default value. If any line is
+ turned on or will be turned on it must this distance be set to default.
+ bMinDist indicates whether the user can go below this value or not.
+ With NDIST is the current distance from the app transported back and
+ forth to the dialogue.
+ */
+
+ bool bDist :1; // TRUE, Unlock Distance.
+ bool bMinDist :1; // TRUE, Going below minimum Distance is prohibited
+
+ SvxBoxInfoItemValidFlags nValidFlags;
+ sal_uInt16 nDefDist; // The default or minimum distance.
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxBoxInfoItem( const sal_uInt16 nId );
+ SvxBoxInfoItem( const SvxBoxInfoItem &rCpy );
+ virtual ~SvxBoxInfoItem() override;
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual SvxBoxInfoItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
+ virtual bool HasMetrics() const override;
+
+ const editeng::SvxBorderLine* GetHori() const { return pHori.get(); }
+ const editeng::SvxBorderLine* GetVert() const { return pVert.get(); }
+
+ //The Pointers are being copied!
+ void SetLine( const editeng::SvxBorderLine* pNew, SvxBoxInfoItemLine nLine );
+
+ bool IsTable() const { return mbEnableHor && mbEnableVer; }
+ void SetTable( bool bNew ) { mbEnableHor = mbEnableVer = bNew; }
+
+ bool IsHorEnabled() const { return mbEnableHor; }
+ void EnableHor( bool bEnable ) { mbEnableHor = bEnable; }
+ bool IsVerEnabled() const { return mbEnableVer; }
+ void EnableVer( bool bEnable ) { mbEnableVer = bEnable; }
+
+ bool IsDist() const { return bDist; }
+ void SetDist( bool bNew ) { bDist = bNew; }
+ bool IsMinDist() const { return bMinDist; }
+ void SetMinDist( bool bNew ) { bMinDist = bNew; }
+ sal_uInt16 GetDefDist() const { return nDefDist; }
+ void SetDefDist( sal_uInt16 nNew ) { nDefDist = nNew; }
+
+ bool IsValid( SvxBoxInfoItemValidFlags nValid ) const
+ { return bool( nValidFlags & nValid ); }
+ void SetValid( SvxBoxInfoItemValidFlags nValid, bool bValid = true )
+ {
+ if (bValid)
+ nValidFlags |= nValid;
+ else
+ nValidFlags &= ~nValid;
+ }
+ void ResetFlags();
+
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+namespace editeng
+{
+
+void EDITENG_DLLPUBLIC BorderDistanceFromWord(bool bFromEdge, sal_Int32& nMargin,
+ sal_Int32& nBorderDistance, sal_Int32 nBorderWidth);
+
+struct EDITENG_DLLPUBLIC WordPageMargins final
+{
+ sal_uInt16 nLeft = 0;
+ sal_uInt16 nRight = 0;
+ sal_uInt16 nTop = 0;
+ sal_uInt16 nBottom = 0;
+};
+
+struct EDITENG_DLLPUBLIC WordBorderDistances final
+{
+ bool bFromEdge = false;
+ sal_uInt16 nLeft = 0;
+ sal_uInt16 nRight = 0;
+ sal_uInt16 nTop = 0;
+ sal_uInt16 nBottom = 0;
+};
+
+// Heuristics to decide if we need to use "from edge" offset of borders. All sizes in twips
+void EDITENG_DLLPUBLIC BorderDistancesToWord(const SvxBoxItem& rBox, const WordPageMargins& rMargins,
+ WordBorderDistances& rDistances);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx
new file mode 100644
index 000000000..850ff7d10
--- /dev/null
+++ b/include/editeng/brushitem.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_BRUSHITEM_HXX
+#define INCLUDED_EDITENG_BRUSHITEM_HXX
+
+#include <tools/color.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+#include <memory>
+
+// class SvxBrushItem ----------------------------------------------------
+
+class Graphic;
+class GraphicObject;
+
+constexpr sal_uInt16 BRUSH_GRAPHIC_VERSION = 0x0001;
+
+enum SvxGraphicPosition
+{
+ GPOS_NONE,
+ GPOS_LT, GPOS_MT, GPOS_RT,
+ GPOS_LM, GPOS_MM, GPOS_RM,
+ GPOS_LB, GPOS_MB, GPOS_RB,
+ GPOS_AREA, GPOS_TILED
+};
+
+class EDITENG_DLLPUBLIC SvxBrushItem final : public SfxPoolItem
+{
+ Color aColor;
+ Color aFilterColor;
+ sal_Int32 nShadingValue;
+ mutable std::unique_ptr<GraphicObject> xGraphicObject;
+ sal_Int8 nGraphicTransparency; //contains a percentage value which is
+ //copied to the GraphicObject when necessary
+ OUString maStrLink;
+ OUString maStrFilter;
+ SvxGraphicPosition eGraphicPos;
+ mutable bool bLoadAgain;
+
+ void ApplyGraphicTransparency_Impl();
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxBrushItem( sal_uInt16 nWhich );
+ SvxBrushItem( const Color& rColor, sal_uInt16 nWhich );
+
+ SvxBrushItem( const Graphic& rGraphic,
+ SvxGraphicPosition ePos, sal_uInt16 nWhich );
+ SvxBrushItem( const GraphicObject& rGraphicObj,
+ SvxGraphicPosition ePos, sal_uInt16 nWhich );
+ SvxBrushItem( OUString rLink, OUString aFilter,
+ SvxGraphicPosition ePos, sal_uInt16 nWhich );
+ SvxBrushItem( const SvxBrushItem& );
+ SvxBrushItem(SvxBrushItem&&);
+
+ virtual ~SvxBrushItem() override;
+
+public:
+ // check if it's used
+ bool isUsed() const;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual SvxBrushItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ const Color& GetColor() const { return aColor; }
+ Color& GetColor() { return aColor; }
+ void SetColor( const Color& rCol) { aColor = rCol; }
+
+ const Color& GetFiltColor() const { return aFilterColor; }
+ Color& GetFiltColor() { return aFilterColor; }
+ void SetFiltColor( const Color& rCol) { aFilterColor = rCol; }
+
+ SvxGraphicPosition GetGraphicPos() const { return eGraphicPos; }
+
+ sal_Int32 GetShadingValue() const { return nShadingValue; }
+ const Graphic* GetGraphic(OUString const & referer = OUString()/*TODO*/) const;
+ const GraphicObject* GetGraphicObject(OUString const & referer = OUString()/*TODO*/) const;
+ const OUString& GetGraphicLink() const { return maStrLink; }
+ const OUString& GetGraphicFilter() const { return maStrFilter; }
+
+ // get graphic transparency in percent
+ sal_Int8 getGraphicTransparency() const { return nGraphicTransparency; }
+ void setGraphicTransparency(sal_Int8 nNew);
+
+ void SetGraphicPos( SvxGraphicPosition eNew );
+ void SetGraphic( const Graphic& rNew );
+ void SetGraphicObject( const GraphicObject& rNewObj );
+ void SetGraphicLink( const OUString& rNew );
+ void SetGraphicFilter( const OUString& rNew );
+
+ static sal_Int8 TransparencyToPercent(sal_Int32 nTrans);
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif // INCLUDED_EDITENG_BRUSHITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/bulletitem.hxx b/include/editeng/bulletitem.hxx
new file mode 100644
index 000000000..4e736b776
--- /dev/null
+++ b/include/editeng/bulletitem.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_BULLETITEM_HXX
+#define INCLUDED_EDITENG_BULLETITEM_HXX
+
+#include <memory>
+#include <editeng/editengdllapi.h>
+#include <svl/poolitem.hxx>
+#include <vcl/GraphicObject.hxx>
+#include <vcl/font.hxx>
+
+
+/**
+ * these must match the values in css::style::NumberingType
+ */
+enum class SvxBulletStyle
+{
+ ABC_BIG = 0,
+ ABC_SMALL = 1,
+ ROMAN_BIG = 2,
+ ROMAN_SMALL = 3,
+ N123 = 4,
+ NONE = 5,
+ BULLET = 6,
+ BMP = 128
+};
+
+// class SvxBulletItem ---------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxBulletItem final : public SfxPoolItem
+{
+ vcl::Font aFont;
+ std::unique_ptr<GraphicObject>
+ pGraphicObject;
+ OUString aPrevText;
+ OUString aFollowText;
+ sal_uInt16 nStart;
+ SvxBulletStyle nStyle;
+ tools::Long nWidth;
+ sal_uInt16 nScale;
+ sal_Unicode cSymbol;
+
+public:
+ explicit SvxBulletItem( sal_uInt16 nWhich );
+ SvxBulletItem( const SvxBulletItem& );
+ virtual ~SvxBulletItem() override;
+
+ virtual SvxBulletItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ OUString GetFullText() const;
+
+ tools::Long GetWidth() const { return nWidth; }
+ const vcl::Font& GetFont() const { return aFont; }
+
+ const GraphicObject& GetGraphicObject() const;
+ void SetGraphicObject( const GraphicObject& rGraphicObject );
+
+ void SetSymbol( sal_Unicode c) { cSymbol = c; }
+
+ void SetStart( sal_uInt16 nNew ) { nStart = nNew; }
+ void SetWidth( tools::Long nNew ) { nWidth = nNew; }
+ void SetStyle( SvxBulletStyle nNew ) { nStyle = nNew; }
+ void SetFont( const vcl::Font& rNew) { aFont = rNew; }
+ void SetScale( sal_uInt16 nNew ) { nScale = nNew; }
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ void CopyValidProperties( const SvxBulletItem& rCopyFrom );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charhiddenitem.hxx b/include/editeng/charhiddenitem.hxx
new file mode 100644
index 000000000..ed72e08dc
--- /dev/null
+++ b/include/editeng/charhiddenitem.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_CHARHIDDENITEM_HXX
+#define INCLUDED_EDITENG_CHARHIDDENITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCharHiddenItem -------------------------------------------------
+/* [Description]
+
+ This item marks text as hidden
+*/
+
+class EDITENG_DLLPUBLIC SvxCharHiddenItem final : public SfxBoolItem
+{
+public:
+ SvxCharHiddenItem( const bool bHidden /*= false*/, const sal_uInt16 nId );
+
+ virtual SvxCharHiddenItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charreliefitem.hxx b/include/editeng/charreliefitem.hxx
new file mode 100644
index 000000000..78b57fa7d
--- /dev/null
+++ b/include/editeng/charreliefitem.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_CHARRELIEFITEM_HXX
+#define INCLUDED_EDITENG_CHARRELIEFITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <vcl/fntstyle.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCharRotateItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines a character relief and has currently the values
+ emboss, relief.
+*/
+
+class EDITENG_DLLPUBLIC SvxCharReliefItem final : public SfxEnumItem<FontRelief>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxCharReliefItem( FontRelief eValue /*= FontRelief::NONE*/,
+ const sal_uInt16 nId );
+
+ virtual SvxCharReliefItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ static OUString GetValueTextByPos( sal_uInt16 nPos );
+ virtual sal_uInt16 GetValueCount() const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charrotateitem.hxx b/include/editeng/charrotateitem.hxx
new file mode 100644
index 000000000..49fb3f345
--- /dev/null
+++ b/include/editeng/charrotateitem.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_CHARROTATEITEM_HXX
+#define INCLUDED_EDITENG_CHARROTATEITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <tools/degree.hxx>
+#include <editeng/editengdllapi.h>
+
+ // class SvxTextRotateItem ----------------------------------------------
+
+ /* [Description]
+
+ This item defines a text rotation value. Currently
+ text can only be rotated 90,0 and 270,0 degrees.
+
+ */
+
+class EDITENG_DLLPUBLIC SvxTextRotateItem : public SfxUInt16Item
+{
+public:
+ SvxTextRotateItem(Degree10 nValue, const sal_uInt16 nId);
+
+ virtual SvxTextRotateItem* Clone(SfxItemPool *pPool = nullptr) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper&) const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
+ virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
+
+ Degree10 GetValue() const { return Degree10(SfxUInt16Item::GetValue()); }
+ void SetValue(Degree10 val) { SfxUInt16Item::SetValue(val.get()); }
+
+ // our currently only degree values
+ void SetTopToBottom() { SetValue(2700_deg10); }
+ void SetBottomToTop() { SetValue(900_deg10); }
+ bool IsTopToBottom() const { return 2700_deg10 == GetValue(); }
+ bool IsBottomToTop() const { return 900_deg10 == GetValue(); }
+ bool IsVertical() const { return IsTopToBottom() || IsBottomToTop(); }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+
+// class SvxCharRotateItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines a character rotation value (0,1 degree). Currently
+ character can only be rotated 90,0 and 270,0 degrees.
+ The flag FitToLine defines only a UI-Information -
+ if true it must also create a SvxCharScaleItem.
+
+*/
+
+class EDITENG_DLLPUBLIC SvxCharRotateItem final : public SvxTextRotateItem
+{
+ bool bFitToLine;
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxCharRotateItem( Degree10 nValue /*= 0*/,
+ bool bFitIntoLine /*= false*/,
+ const sal_uInt16 nId );
+
+ virtual SvxCharRotateItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ bool IsFitToLine() const { return bFitToLine; }
+ void SetFitToLine( bool b ) { bFitToLine = b; }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charscaleitem.hxx b/include/editeng/charscaleitem.hxx
new file mode 100644
index 000000000..fff4fa8ef
--- /dev/null
+++ b/include/editeng/charscaleitem.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_CHARSCALEITEM_HXX
+#define INCLUDED_EDITENG_CHARSCALEITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCharScaleItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines a character scaling factor as percent value.
+ A value of 100 is identical to 100% and means normal width
+ A value of 50 is identical to 50% and means 1/2 width.
+
+*/
+
+class EDITENG_DLLPUBLIC SvxCharScaleWidthItem final : public SfxUInt16Item
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxCharScaleWidthItem( sal_uInt16 nValue /*= 100*/,
+ const sal_uInt16 nId );
+
+ virtual SvxCharScaleWidthItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/cmapitem.hxx b/include/editeng/cmapitem.hxx
new file mode 100644
index 000000000..d0b4bff25
--- /dev/null
+++ b/include/editeng/cmapitem.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_CMAPITEM_HXX
+#define INCLUDED_EDITENG_CMAPITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCaseMapItem --------------------------------------------------
+
+/* [Description]
+
+ This item describe the font type (uppercase, small caps ,...).
+*/
+
+class EDITENG_DLLPUBLIC SvxCaseMapItem final : public SfxEnumItem<SvxCaseMap>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxCaseMapItem( const SvxCaseMap eMap /*= SvxCaseMap::NotMapped*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxCaseMapItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ static OUString GetValueTextByPos( sal_uInt16 nPos );
+ virtual sal_uInt16 GetValueCount() const override;
+
+ // enum cast
+ SvxCaseMap GetCaseMap() const { return GetValue(); }
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx
new file mode 100644
index 000000000..cbd52844b
--- /dev/null
+++ b/include/editeng/colritem.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_COLRITEM_HXX
+#define INCLUDED_EDITENG_COLRITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <tools/color.hxx>
+#include <editeng/editengdllapi.h>
+
+#define VERSION_USEAUTOCOLOR 1
+
+/// Represents theme metadata for a (tools) Color.
+class EDITENG_DLLPUBLIC SvxThemeColor
+{
+ sal_Int16 maThemeIndex;
+ /// Luminance Modulation: 100th percentage, defaults to 100%.
+ sal_Int16 mnLumMod;
+ /// Luminance Offset: 100th percentage, defaults to 0%.
+ sal_Int16 mnLumOff;
+
+public:
+ explicit SvxThemeColor();
+ bool operator==(const SvxThemeColor& rThemeColor) const;
+
+ sal_Int16 GetThemeIndex() const
+ {
+ return maThemeIndex;
+ }
+
+ void SetThemeIndex(sal_Int16 nIndex)
+ {
+ maThemeIndex = nIndex;
+ }
+
+ void SetLumMod(sal_Int16 nLumMod) { mnLumMod = nLumMod; }
+
+ sal_Int16 GetLumMod() const { return mnLumMod; }
+
+ void SetLumOff(sal_Int16 nLumOff) { mnLumOff = nLumOff; }
+
+ sal_Int16 GetLumOff() const { return mnLumOff; }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+};
+
+/** SvxColorItem item describes a color.
+*/
+class EDITENG_DLLPUBLIC SvxColorItem final : public SfxPoolItem
+{
+private:
+ Color mColor;
+ SvxThemeColor maThemeColor;
+ sal_Int16 maTintShade;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxColorItem(const sal_uInt16 nId);
+ SvxColorItem(const Color& aColor, const sal_uInt16 nId);
+ virtual ~SvxColorItem() override;
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==(const SfxPoolItem& rPoolItem) const override;
+ virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
+ virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres,
+ MapUnit eCoreMetric, MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& rIntlWrapper) const override;
+
+ virtual SvxColorItem* Clone(SfxItemPool* pPool = nullptr) const override;
+ SvxColorItem(SvxColorItem const &) = default; // SfxPoolItem copy function dichotomy
+
+ const Color& GetValue() const
+ {
+ return mColor;
+ }
+ void SetValue(const Color& rNewColor);
+
+ sal_Int16 GetTintOrShade() const
+ {
+ return maTintShade;
+ }
+
+ void SetTintOrShade(sal_Int16 nTintOrShade)
+ {
+ maTintShade = nTintOrShade;
+ }
+
+ SvxThemeColor& GetThemeColor() { return maThemeColor; }
+
+ const SvxThemeColor& GetThemeColor() const { return maThemeColor; }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/contouritem.hxx b/include/editeng/contouritem.hxx
new file mode 100644
index 000000000..9c67384fc
--- /dev/null
+++ b/include/editeng/contouritem.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_CONTOURITEM_HXX
+#define INCLUDED_EDITENG_CONTOURITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxContourItem --------------------------------------------------
+
+/* [Description]
+ This item describes, if contour is employed.
+*/
+
+class EDITENG_DLLPUBLIC SvxContourItem final : public SfxBoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxContourItem( const bool bContoured /*= false*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxContourItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/crossedoutitem.hxx b/include/editeng/crossedoutitem.hxx
new file mode 100644
index 000000000..5d8b18fe2
--- /dev/null
+++ b/include/editeng/crossedoutitem.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_CROSSEDOUTITEM_HXX
+#define INCLUDED_EDITENG_CROSSEDOUTITEM_HXX
+
+#include <tools/fontenum.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCrossedOutItem -----------------------------------------------
+
+/* [Description]
+ This item describes, whether and how it is striked out.
+*/
+
+class EDITENG_DLLPUBLIC SvxCrossedOutItem final : public SfxEnumItem<FontStrikeout>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxCrossedOutItem( const FontStrikeout eSt /*= STRIKEOUT_NONE*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxCrossedOutItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ static OUString GetValueTextByPos( sal_uInt16 nPos );
+ virtual sal_uInt16 GetValueCount() const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ using SfxEnumItem::SetValue;
+
+ virtual bool HasBoolValue() const override;
+ virtual bool GetBoolValue() const override;
+ virtual void SetBoolValue( bool bVal ) override;
+
+ SvxCrossedOutItem(SvxCrossedOutItem const &) = default; // SfxPoolItem copy function dichotomy
+
+ // enum cast
+ FontStrikeout GetStrikeout() const
+ { return GetValue(); }
+};
+
+#endif // INCLUDED_EDITENG_CROSSEDOUTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx
new file mode 100644
index 000000000..1762fd86e
--- /dev/null
+++ b/include/editeng/editdata.hxx
@@ -0,0 +1,359 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+// MyEDITDATA, wegen exportiertem EditData
+#ifndef INCLUDED_EDITENG_EDITDATA_HXX
+#define INCLUDED_EDITENG_EDITDATA_HXX
+
+#include <rtl/ustring.hxx>
+#include <editeng/editengdllapi.h>
+#include <i18nlangtag/lang.h>
+#include <memory>
+#include <ostream>
+
+class SfxPoolItem;
+template<typename T> class SvParser;
+class SvxFieldItem;
+enum class HtmlTokenId : sal_Int16;
+
+enum class EETextFormat { Text = 0x20, Rtf, Html = 0x32, Xml };
+enum class EEHorizontalTextDirection { Default, L2R, R2L };
+enum class EESelectionMode { Std, Hidden };
+ // EESelectionMode::Hidden can be used to completely hide the selection. This is useful e.g. when you want show the selection
+ // only as long as your window (which the edit view works on) has the focus
+enum class EESpellState { Ok, NoSpeller, ErrorFound };
+enum class EEAnchorMode {
+ TopLeft, TopHCenter, TopRight,
+ VCenterLeft, VCenterHCenter, VCenterRight,
+ BottomLeft, BottomHCenter, BottomRight };
+
+enum class EERemoveParaAttribsMode { RemoveAll, RemoveCharItems, RemoveNone };
+
+#define EE_PARA_NOT_FOUND SAL_MAX_INT32
+#define EE_PARA_APPEND SAL_MAX_INT32
+#define EE_PARA_ALL SAL_MAX_INT32
+#define EE_PARA_MAX_COUNT SAL_MAX_INT32
+
+#define EE_INDEX_NOT_FOUND SAL_MAX_INT32
+#define EE_TEXTPOS_ALL SAL_MAX_INT32
+#define EE_TEXTPOS_MAX_COUNT SAL_MAX_INT32
+
+EDITENG_DLLPUBLIC extern const size_t EE_APPEND;
+
+// Error messages for Read / Write Method
+#define EE_READWRITE_WRONGFORMAT ErrCode(ErrCodeArea::Svx, 1)
+
+#define EDITUNDO_REMOVECHARS 100
+#define EDITUNDO_CONNECTPARAS 101
+#define EDITUNDO_MOVEPARAGRAPHS 103
+#define EDITUNDO_INSERTFEATURE 104
+#define EDITUNDO_SPLITPARA 105
+#define EDITUNDO_INSERTCHARS 106
+#define EDITUNDO_DELCONTENT 107
+#define EDITUNDO_DELETE 108
+#define EDITUNDO_CUT 109
+#define EDITUNDO_PASTE 110
+#define EDITUNDO_INSERT 111
+#define EDITUNDO_MOVEPARAS 113
+#define EDITUNDO_PARAATTRIBS 114
+#define EDITUNDO_ATTRIBS 115
+#define EDITUNDO_DRAGANDDROP 116
+#define EDITUNDO_READ 117
+#define EDITUNDO_STYLESHEET 118
+#define EDITUNDO_REPLACEALL 119
+#define EDITUNDO_RESETATTRIBS 121
+#define EDITUNDO_INDENTBLOCK 122
+#define EDITUNDO_UNINDENTBLOCK 123
+#define EDITUNDO_MARKSELECTION 124
+#define EDITUNDO_TRANSLITERATE 125
+
+#define EDITUNDO_USER 200
+
+struct EPosition
+{
+ sal_Int32 nPara;
+ sal_Int32 nIndex;
+
+ EPosition()
+ : nPara( EE_PARA_NOT_FOUND )
+ , nIndex( EE_INDEX_NOT_FOUND )
+ { }
+
+ EPosition( sal_Int32 nPara_, sal_Int32 nPos_ )
+ : nPara( nPara_ )
+ , nIndex( nPos_ )
+ { }
+};
+
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, EPosition const& pos)
+{
+ return stream << "EPosition(" << pos.nPara << ',' << pos.nIndex << ")";
+}
+
+struct ESelection
+{
+ sal_Int32 nStartPara;
+ sal_Int32 nStartPos;
+ sal_Int32 nEndPara;
+ sal_Int32 nEndPos;
+
+ ESelection() : nStartPara( 0 ), nStartPos( 0 ), nEndPara( 0 ), nEndPos( 0 ) {}
+
+ ESelection( sal_Int32 nStPara, sal_Int32 nStPos,
+ sal_Int32 nEPara, sal_Int32 nEPos )
+ : nStartPara( nStPara )
+ , nStartPos( nStPos )
+ , nEndPara( nEPara )
+ , nEndPos( nEPos )
+ { }
+
+ ESelection( sal_Int32 nPara, sal_Int32 nPos )
+ : nStartPara( nPara )
+ , nStartPos( nPos )
+ , nEndPara( nPara )
+ , nEndPos( nPos )
+ { }
+
+ void Adjust();
+ bool operator==( const ESelection& rS ) const;
+ bool operator!=( const ESelection& rS ) const { return !operator==(rS); }
+ bool operator<( const ESelection& rS ) const;
+ bool operator>( const ESelection& rS ) const;
+ bool IsZero() const;
+ bool HasRange() const;
+};
+
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, ESelection const& sel)
+{
+ return stream << "ESelection(" << sel.nStartPara << ',' << sel.nStartPos << "," << sel.nEndPara << "," << sel.nEndPos << ")";
+}
+
+inline bool ESelection::HasRange() const
+{
+ return ( nStartPara != nEndPara ) || ( nStartPos != nEndPos );
+}
+
+inline bool ESelection::IsZero() const
+{
+ return ( ( nStartPara == 0 ) && ( nStartPos == 0 ) &&
+ ( nEndPara == 0 ) && ( nEndPos == 0 ) );
+}
+
+inline bool ESelection::operator==( const ESelection& rS ) const
+{
+ return ( ( nStartPara == rS.nStartPara ) && ( nStartPos == rS.nStartPos ) &&
+ ( nEndPara == rS.nEndPara ) && ( nEndPos == rS.nEndPos ) );
+}
+
+inline bool ESelection::operator<( const ESelection& rS ) const
+{
+ // The selection must be adjusted.
+ // => Only check if end of 'this' < Start of rS
+ return ( nEndPara < rS.nStartPara ) ||
+ ( ( nEndPara == rS.nStartPara ) && ( nEndPos < rS.nStartPos ) && !operator==( rS ) );
+}
+
+inline bool ESelection::operator>( const ESelection& rS ) const
+{
+ // The selection must be adjusted.
+ // => Only check if end of 'this' < Start of rS
+ return ( nStartPara > rS.nEndPara ) ||
+ ( ( nStartPara == rS.nEndPara ) && ( nStartPos > rS.nEndPos ) && !operator==( rS ) );
+}
+
+inline void ESelection::Adjust()
+{
+ bool bSwap = false;
+ if ( nStartPara > nEndPara )
+ bSwap = true;
+ else if ( ( nStartPara == nEndPara ) && ( nStartPos > nEndPos ) )
+ bSwap = true;
+
+ if ( bSwap )
+ {
+ sal_Int32 nSPar = nStartPara; sal_Int32 nSPos = nStartPos;
+ nStartPara = nEndPara; nStartPos = nEndPos;
+ nEndPara = nSPar; nEndPos = nSPos;
+ }
+}
+
+struct EDITENG_DLLPUBLIC EFieldInfo
+{
+ std::unique_ptr<SvxFieldItem> pFieldItem;
+ OUString aCurrentText;
+ EPosition aPosition;
+
+ EFieldInfo();
+ EFieldInfo( const SvxFieldItem& rFieldItem, sal_Int32 nPara, sal_Int32 nPos );
+ ~EFieldInfo();
+
+ EFieldInfo( const EFieldInfo& );
+ EFieldInfo& operator= ( const EFieldInfo& );
+};
+
+enum class RtfImportState {
+ Start, End, // only pParser, nPara, nIndex
+ NextToken, UnknownAttr, // nToken+nTokenValue
+ SetAttr, // pAttrs
+ InsertText, // aText
+ InsertPara, // -
+ };
+enum class HtmlImportState {
+ Start, End, // only pParser, nPara, nIndex
+ NextToken, // nToken
+ SetAttr, // pAttrs
+ InsertText, // aText
+ InsertPara, InsertField // -
+ };
+
+struct HtmlImportInfo
+{
+ SvParser<HtmlTokenId>* pParser;
+ ESelection aSelection;
+ HtmlImportState eState;
+
+ HtmlTokenId nToken;
+
+ OUString aText;
+
+ HtmlImportInfo( HtmlImportState eState, SvParser<HtmlTokenId>* pPrsrs, const ESelection& rSel );
+ ~HtmlImportInfo();
+};
+
+struct RtfImportInfo
+{
+ SvParser<int>* pParser;
+ ESelection aSelection;
+ RtfImportState eState;
+
+ int nToken;
+ short nTokenValue;
+
+ RtfImportInfo( RtfImportState eState, SvParser<int>* pPrsrs, const ESelection& rSel );
+};
+
+struct ParagraphInfos
+{
+ ParagraphInfos()
+ : nFirstLineHeight( 0 )
+ , nFirstLineTextHeight ( 0 )
+ , nFirstLineMaxAscent( 0 )
+ , bValid( false )
+ {}
+
+ sal_uInt16 nFirstLineHeight;
+ sal_uInt16 nFirstLineTextHeight;
+ sal_uInt16 nFirstLineMaxAscent;
+
+ bool bValid; // A query during formatting is not valid!
+};
+
+struct EECharAttrib
+{
+ const SfxPoolItem* pAttr;
+
+ sal_Int32 nStart;
+ sal_Int32 nEnd;
+ EECharAttrib(sal_Int32 nSt, sal_Int32 nE, const SfxPoolItem* pA = nullptr)
+ : pAttr(pA)
+ , nStart(nSt)
+ , nEnd(nE)
+ {
+ }
+};
+
+struct MoveParagraphsInfo
+{
+ sal_Int32 nStartPara;
+ sal_Int32 nEndPara;
+ sal_Int32 nDestPara;
+
+ MoveParagraphsInfo( sal_Int32 nS, sal_Int32 nE, sal_Int32 nD )
+ { nStartPara = nS; nEndPara = nE; nDestPara = nD; }
+};
+
+struct PasteOrDropInfos
+{
+ sal_Int32 nStartPara;
+ sal_Int32 nEndPara;
+
+ PasteOrDropInfos() : nStartPara(-1), nEndPara(-1) {}
+};
+
+enum EENotifyType
+{
+ /// EditEngine text was modified
+ EE_NOTIFY_TEXTMODIFIED,
+
+ /// A paragraph was inserted into the EditEngine
+ EE_NOTIFY_PARAGRAPHINSERTED,
+
+ /// A paragraph was removed from the EditEngine
+ EE_NOTIFY_PARAGRAPHREMOVED,
+
+ /// Multiple paragraphs have been removed from the EditEngine
+ EE_NOTIFY_PARAGRAPHSMOVED,
+
+ /// The height of at least one paragraph has changed
+ EE_NOTIFY_TextHeightChanged,
+
+ /// The view area of the EditEngine scrolled
+ EE_NOTIFY_TEXTVIEWSCROLLED,
+
+ /// The selection and/or the cursor position has changed
+ EE_NOTIFY_TEXTVIEWSELECTIONCHANGED,
+
+ /// The EditEngine is in a valid state again. Process pending notifications.
+ EE_NOTIFY_PROCESSNOTIFICATIONS,
+
+ EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA
+};
+
+struct EENotify
+{
+ EENotifyType eNotificationType;
+
+ sal_Int32 nParagraph; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED
+
+ sal_Int32 nParam1;
+ sal_Int32 nParam2;
+
+ EENotify( EENotifyType eType )
+ { eNotificationType = eType; nParagraph = EE_PARA_NOT_FOUND; nParam1 = 0; nParam2 = 0; }
+};
+
+namespace editeng
+{
+
+struct LanguageSpan
+{
+ LanguageType nLang = LANGUAGE_DONTKNOW;
+ sal_Int32 nStart = -1;
+ sal_Int32 nEnd = -1;
+};
+
+}
+
+#endif // INCLUDED_EDITENG_EDITDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
new file mode 100644
index 000000000..a0ce29ca2
--- /dev/null
+++ b/include/editeng/editeng.hxx
@@ -0,0 +1,655 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+// MyEDITENG, due to exported EditEng
+#ifndef INCLUDED_EDITENG_EDITENG_HXX
+#define INCLUDED_EDITENG_EDITENG_HXX
+
+#include <memory>
+#include <vector>
+
+#include <optional>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/i18n/WordType.hpp>
+#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
+
+#include <o3tl/span.hxx>
+#include <svl/typedwhich.hxx>
+#include <editeng/editdata.hxx>
+#include <editeng/editstat.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/editengdllapi.h>
+#include <i18nlangtag/lang.h>
+
+#include <tools/lineend.hxx>
+#include <tools/degree.hxx>
+#include <tools/long.hxx>
+
+#include <editeng/eedata.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <svl/languageoptions.hxx>
+#include <vcl/errcode.hxx>
+#include <functional>
+
+template <typename Arg, typename Ret> class Link;
+
+namespace com::sun::star {
+ namespace linguistic2 {
+ class XSpellChecker1;
+ class XHyphenator;
+ }
+ namespace datatransfer {
+ class XTransferable;
+ }
+ namespace lang {
+ struct Locale;
+ }
+}
+
+namespace svx {
+struct SpellPortion;
+typedef std::vector<SpellPortion> SpellPortions;
+}
+
+class SfxUndoManager;
+namespace basegfx { class B2DPolyPolygon; }
+namespace editeng {
+ struct MisspellRanges;
+}
+
+class ImpEditEngine;
+class EditView;
+class OutputDevice;
+class SvxFont;
+class SfxItemPool;
+class SfxStyleSheet;
+class SfxStyleSheetPool;
+class SvxSearchItem;
+class SvxFieldItem;
+class MapMode;
+class Color;
+namespace vcl { class Font; }
+class KeyEvent;
+class Size;
+class Point;
+namespace tools { class Rectangle; }
+class SvStream;
+namespace vcl { class Window; }
+class SvKeyValueIterator;
+class SvxForbiddenCharactersTable;
+class SvxNumberFormat;
+class SvxFieldData;
+class ContentNode;
+class ParaPortion;
+class EditSelection;
+class EditPaM;
+class EditLine;
+class InternalEditStatus;
+class EditSelectionEngine;
+class EditDoc;
+class Range;
+struct EPaM;
+class DeletedNodeInfo;
+class ParaPortionList;
+enum class CharCompressType;
+enum class TransliterationFlags;
+class LinkParamNone;
+
+/** values for:
+ SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All );
+*/
+enum class EditEngineAttribs {
+ All, /// returns all attributes even when they are not set
+ OnlyHard /// returns only attributes hard set on portions
+};
+
+/** values for:
+ SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags = 0xFF ) const;
+*/
+enum class GetAttribsFlags
+{
+ NONE = 0x00,
+ STYLESHEET = 0x01,
+ PARAATTRIBS = 0x02,
+ CHARATTRIBS = 0x04,
+ ALL = 0x07,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<GetAttribsFlags> : is_typed_flags<GetAttribsFlags, 0x07> {};
+}
+
+enum class SetAttribsMode {
+ NONE, WholeWord, Edge
+};
+
+class EDITENG_DLLPUBLIC EditEngine
+{
+ friend class EditView;
+ friend class ImpEditView;
+ friend class Outliner;
+ friend class TextChainingUtils;
+
+
+public:
+ typedef std::vector<EditView*> ViewsType;
+
+ EditSelection InsertText(
+ css::uno::Reference<css::datatransfer::XTransferable > const & rxDataObj,
+ const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial);
+
+private:
+ std::unique_ptr<ImpEditEngine> pImpEditEngine;
+
+ EditEngine( const EditEngine& ) = delete;
+ EditEngine& operator=( const EditEngine& ) = delete;
+ EDITENG_DLLPRIVATE bool PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, vcl::Window const * pFrameWin );
+
+ EDITENG_DLLPRIVATE void CursorMoved(const ContentNode* pPrevNode);
+ EDITENG_DLLPRIVATE void CheckIdleFormatter();
+ EDITENG_DLLPRIVATE bool IsIdleFormatterActive() const;
+ EDITENG_DLLPRIVATE ParaPortion* FindParaPortion(ContentNode const * pNode);
+ EDITENG_DLLPRIVATE const ParaPortion* FindParaPortion(ContentNode const * pNode) const;
+ EDITENG_DLLPRIVATE const ParaPortion* GetPrevVisPortion(const ParaPortion* pCurPortion) const;
+
+ EDITENG_DLLPRIVATE css::uno::Reference<
+ css::datatransfer::XTransferable>
+ CreateTransferable(const EditSelection& rSelection);
+
+ EDITENG_DLLPRIVATE EditPaM EndOfWord(const EditPaM& rPaM);
+
+ EDITENG_DLLPRIVATE EditPaM GetPaM(const Point& aDocPos, bool bSmart = true);
+
+ EDITENG_DLLPRIVATE EditSelection SelectWord(
+ const EditSelection& rCurSelection,
+ sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES);
+
+ EDITENG_DLLPRIVATE tools::Long GetXPos(
+ const ParaPortion* pParaPortion, const EditLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart = false) const;
+
+ EDITENG_DLLPRIVATE Range GetLineXPosStartEnd(
+ const ParaPortion* pParaPortion, const EditLine* pLine) const;
+
+ EDITENG_DLLPRIVATE InternalEditStatus& GetInternalEditStatus();
+
+ EDITENG_DLLPRIVATE void HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos);
+ EDITENG_DLLPRIVATE void HandleEndPasteOrDrop(PasteOrDropInfos& rInfos);
+ EDITENG_DLLPRIVATE bool HasText() const;
+ EDITENG_DLLPRIVATE const EditSelectionEngine& GetSelectionEngine() const;
+ EDITENG_DLLPRIVATE void SetInSelectionMode(bool b);
+
+protected:
+
+
+public:
+ EditEngine( SfxItemPool* pItemPool );
+ virtual ~EditEngine();
+
+ const SfxItemSet& GetEmptyItemSet() const;
+
+ void SetDefTab( sal_uInt16 nDefTab );
+
+ void SetRefDevice( OutputDevice* pRefDef );
+ OutputDevice* GetRefDevice() const;
+
+ void SetRefMapMode( const MapMode& rMapMode );
+ MapMode const & GetRefMapMode() const;
+
+ /// Change the update mode per bUpdate and potentially trigger FormatAndUpdate.
+ /// bRestoring is used for LOK to update cursor visibility, specifically,
+ /// when true, it means we are restoring the update mode after internally
+ /// disabling it (f.e. during SetText to set/delete default text in Impress).
+ /// @return previous value of update
+ bool SetUpdateLayout(bool bUpdate, bool bRestoring = false);
+ bool IsUpdateLayout() const;
+
+ void SetBackgroundColor( const Color& rColor );
+ Color const & GetBackgroundColor() const;
+ Color GetAutoColor() const;
+ void EnableAutoColor( bool b );
+ void ForceAutoColor( bool b );
+ bool IsForceAutoColor() const;
+
+ void InsertView(EditView* pEditView, size_t nIndex = EE_APPEND);
+ EditView* RemoveView( EditView* pEditView );
+ void RemoveView(size_t nIndex);
+ EditView* GetView(size_t nIndex = 0) const;
+ size_t GetViewCount() const;
+ bool HasView( EditView* pView ) const;
+ EditView* GetActiveView() const;
+ void SetActiveView(EditView* pView);
+
+ void SetPaperSize( const Size& rSize );
+ const Size& GetPaperSize() const;
+
+ void SetVertical( bool bVertical );
+ bool IsEffectivelyVertical() const;
+ bool IsTopToBottom() const;
+ bool GetVertical() const;
+ void SetRotation(TextRotation nRotation);
+ TextRotation GetRotation() const;
+
+ void SetTextColumns(sal_Int16 nColumns, sal_Int32 nSpacing);
+
+ void SetFixedCellHeight( bool bUseFixedCellHeight );
+
+ void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
+ EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
+
+ SvtScriptType GetScriptType( const ESelection& rSelection ) const;
+ editeng::LanguageSpan GetLanguage(const EditPaM& rPaM) const;
+ editeng::LanguageSpan GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const;
+
+ void TransliterateText( const ESelection& rSelection, TransliterationFlags nTransliterationMode );
+ EditSelection TransliterateText( const EditSelection& rSelection, TransliterationFlags nTransliterationMode );
+
+ void SetAsianCompressionMode( CharCompressType nCompression );
+
+ void SetKernAsianPunctuation( bool bEnabled );
+
+ void SetAddExtLeading( bool b );
+
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
+ void ClearPolygon();
+
+ const Size& GetMinAutoPaperSize() const;
+ void SetMinAutoPaperSize( const Size& rSz );
+
+ const Size& GetMaxAutoPaperSize() const;
+ void SetMaxAutoPaperSize( const Size& rSz );
+
+ void SetMinColumnWrapHeight(tools::Long nVal);
+
+ OUString GetText( LineEnd eEnd = LINEEND_LF ) const;
+ OUString GetText( const ESelection& rSelection ) const;
+ sal_Int32 GetTextLen() const;
+ sal_uInt32 GetTextHeight() const;
+ sal_uInt32 GetTextHeightNTP() const;
+ sal_uInt32 CalcTextWidth();
+
+ OUString GetText( sal_Int32 nParagraph ) const;
+ sal_Int32 GetTextLen( sal_Int32 nParagraph ) const;
+ sal_uInt32 GetTextHeight( sal_Int32 nParagraph ) const;
+
+ sal_Int32 GetParagraphCount() const;
+
+ sal_Int32 GetLineCount( sal_Int32 nParagraph ) const;
+ sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const;
+ void GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const;
+ sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const;
+ sal_uInt32 GetLineHeight( sal_Int32 nParagraph );
+ tools::Rectangle GetParaBounds( sal_Int32 nPara );
+ ParagraphInfos GetParagraphInfos( sal_Int32 nPara );
+ sal_Int32 FindParagraph( tools::Long nDocPosY );
+ EPosition FindDocPosition( const Point& rDocPos ) const;
+ tools::Rectangle GetCharacterBounds( const EPosition& rPos ) const;
+
+ OUString GetWord(sal_Int32 nPara, sal_Int32 nIndex);
+
+ ESelection GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const;
+
+ void Clear();
+ void SetText( const OUString& rStr );
+
+ std::unique_ptr<EditTextObject> CreateTextObject();
+ std::unique_ptr<EditTextObject> GetEmptyTextObject() const;
+ std::unique_ptr<EditTextObject> CreateTextObject( sal_Int32 nPara, sal_Int32 nParas = 1 );
+ std::unique_ptr<EditTextObject> CreateTextObject( const ESelection& rESelection );
+ void SetText( const EditTextObject& rTextObject );
+
+ void RemoveParagraph(sal_Int32 nPara);
+ void InsertParagraph(sal_Int32 nPara, const EditTextObject& rTxtObj, const bool bAppend = false);
+ void InsertParagraph(sal_Int32 nPara, const OUString& rText);
+
+ void SetText(sal_Int32 nPara, const OUString& rText);
+
+ virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet );
+ const SfxItemSet& GetParaAttribs( sal_Int32 nPara ) const;
+
+ /// Set attributes from rSet an all characters of nPara.
+ void SetCharAttribs(sal_Int32 nPara, const SfxItemSet& rSet);
+ void GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLst ) const;
+
+ SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags = GetAttribsFlags::ALL ) const;
+ SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All );
+
+ bool HasParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const;
+ const SfxPoolItem& GetParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const;
+ template<class T>
+ const T& GetParaAttrib( sal_Int32 nPara, TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T&>(GetParaAttrib(nPara, sal_uInt16(nWhich)));
+ }
+
+ vcl::Font GetStandardFont( sal_Int32 nPara );
+ SvxFont GetStandardSvxFont( sal_Int32 nPara );
+
+ void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich );
+
+ void ShowParagraph( sal_Int32 nParagraph, bool bShow );
+
+ SfxUndoManager& GetUndoManager();
+ SfxUndoManager* SetUndoManager(SfxUndoManager* pNew);
+ void UndoActionStart( sal_uInt16 nId );
+ void UndoActionStart(sal_uInt16 nId, const ESelection& rSel);
+ void UndoActionEnd();
+ bool IsInUndo() const;
+
+ void EnableUndo( bool bEnable );
+ bool IsUndoEnabled() const;
+
+ /** returns the value last used for bTryMerge while calling ImpEditEngine::InsertUndo
+ This is currently used in a bad but needed hack to get undo actions merged in the
+ OutlineView in impress. Do not use it unless you want to sell your soul too! */
+ bool HasTriedMergeOnLastAddUndo() const;
+
+ void ClearModifyFlag();
+ void SetModified();
+ bool IsModified() const;
+
+ void SetModifyHdl( const Link<LinkParamNone*,void>& rLink );
+ Link<LinkParamNone*,void> const & GetModifyHdl() const;
+
+ bool IsInSelectionMode() const;
+
+ void StripPortions();
+ void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList );
+
+ tools::Long GetFirstLineStartX( sal_Int32 nParagraph );
+ Point GetDocPosTopLeft( sal_Int32 nParagraph );
+ Point GetDocPos( const Point& rPaperPos ) const;
+ bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder );
+
+ // StartDocPos corresponds to VisArea.TopLeft().
+ void Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect );
+ void Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos );
+ void Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip );
+ void Draw( OutputDevice& rOutDev, const Point& rStartPos, Degree10 nOrientation = 0_deg10 );
+
+ ErrCode Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr );
+ void Write( SvStream& rOutput, EETextFormat );
+
+ void SetStatusEventHdl( const Link<EditStatus&,void>& rLink );
+ Link<EditStatus&,void> const & GetStatusEventHdl() const;
+
+ void SetNotifyHdl( const Link<EENotify&,void>& rLink );
+ Link<EENotify&,void> const & GetNotifyHdl() const;
+
+ void SetRtfImportHdl( const Link<RtfImportInfo&,void>& rLink );
+ const Link<RtfImportInfo&,void>& GetRtfImportHdl() const;
+
+ void SetHtmlImportHdl( const Link<HtmlImportInfo&,void>& rLink );
+ const Link<HtmlImportInfo&,void>& GetHtmlImportHdl() const;
+
+ // Do not evaluate font formatting => For Outliner
+ bool IsFlatMode() const;
+ void SetFlatMode( bool bFlat );
+
+ void SetControlWord( EEControlBits nWord );
+ EEControlBits GetControlWord() const;
+
+ void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ void QuickMarkInvalid( const ESelection& rSel );
+ void QuickFormatDoc( bool bFull = false );
+ void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ void QuickInsertLineBreak( const ESelection& rSel );
+ void QuickInsertText(const OUString& rText, const ESelection& rSel);
+ void QuickDelete( const ESelection& rSel );
+ void QuickMarkToBeRepainted( sal_Int32 nPara );
+
+ void SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY );
+ void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const;
+
+ void SetEditTextObjectPool( SfxItemPool* pPool );
+ SfxItemPool* GetEditTextObjectPool() const;
+
+ void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
+ SfxStyleSheetPool* GetStyleSheetPool();
+
+ void SetStyleSheet(const EditSelection& aSel, SfxStyleSheet* pStyle);
+ void SetStyleSheet( sal_Int32 nPara, SfxStyleSheet* pStyle );
+ const SfxStyleSheet* GetStyleSheet( sal_Int32 nPara ) const;
+ SfxStyleSheet* GetStyleSheet( sal_Int32 nPara );
+
+ void SetWordDelimiters( const OUString& rDelimiters );
+ const OUString& GetWordDelimiters() const;
+
+ void EraseVirtualDevice();
+
+ void SetSpeller( css::uno::Reference<
+ css::linguistic2::XSpellChecker1 > const &xSpeller );
+ css::uno::Reference<
+ css::linguistic2::XSpellChecker1 > const &
+ GetSpeller();
+ void SetHyphenator( css::uno::Reference<
+ css::linguistic2::XHyphenator > const & xHyph );
+
+ void GetAllMisspellRanges( std::vector<editeng::MisspellRanges>& rRanges ) const;
+ void SetAllMisspellRanges( const std::vector<editeng::MisspellRanges>& rRanges );
+
+ static void SetForbiddenCharsTable(const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars);
+
+ void SetDefaultLanguage( LanguageType eLang );
+ LanguageType GetDefaultLanguage() const;
+
+ bool HasOnlineSpellErrors() const;
+ void CompleteOnlineSpelling();
+
+ bool ShouldCreateBigTextObject() const;
+
+ // For fast Pre-Test without view:
+ EESpellState HasSpellErrors();
+ void ClearSpellErrors();
+ bool HasText( const SvxSearchItem& rSearchItem );
+
+ //spell and return a sentence
+ bool SpellSentence(EditView const & rEditView, svx::SpellPortions& rToFill );
+ // put spell position to start of current sentence
+ void PutSpellingToSentenceStart( EditView const & rEditView );
+ //applies a changed sentence
+ void ApplyChangedSentence(EditView const & rEditView, const svx::SpellPortions& rNewPortions, bool bRecheck );
+
+ // for text conversion (see also HasSpellErrors)
+ bool HasConvertibleTextPortion( LanguageType nLang );
+ virtual bool ConvertNextDocument();
+
+ bool UpdateFields();
+ bool UpdateFieldsOnly();
+ void RemoveFields( const std::function<bool ( const SvxFieldData* )>& isFieldData = [] (const SvxFieldData* ){return true;} );
+
+ sal_uInt16 GetFieldCount( sal_Int32 nPara ) const;
+ EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const;
+
+ bool IsRightToLeft( sal_Int32 nPara ) const;
+
+ css::uno::Reference< css::datatransfer::XTransferable >
+ CreateTransferable( const ESelection& rSelection ) const;
+
+ // MT: Can't create new virtual functions like for ParagraphInserted/Deleted, must be compatible in SRC638, change later...
+ void SetBeginMovingParagraphsHdl( const Link<MoveParagraphsInfo&,void>& rLink );
+ void SetEndMovingParagraphsHdl( const Link<MoveParagraphsInfo&,void>& rLink );
+ void SetBeginPasteOrDropHdl( const Link<PasteOrDropInfos&,void>& rLink );
+ void SetEndPasteOrDropHdl( const Link<PasteOrDropInfos&,void>& rLink );
+
+ virtual void PaintingFirstLine(sal_Int32 nPara, const Point& rStartPos, const Point& rOrigin, Degree10 nOrientation, OutputDevice& rOutDev);
+ virtual void ParagraphInserted( sal_Int32 nNewParagraph );
+ virtual void ParagraphDeleted( sal_Int32 nDeletedParagraph );
+ virtual void ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph );
+ virtual void ParaAttribsChanged( sal_Int32 nParagraph );
+ virtual void StyleSheetChanged( SfxStyleSheet* pStyle );
+ void ParagraphHeightChanged( sal_Int32 nPara );
+
+ virtual void DrawingText( const Point& rStartPos, const OUString& rText,
+ sal_Int32 nTextStart, sal_Int32 nTextLen,
+ o3tl::span<const sal_Int32> pDXArray, const SvxFont& rFont,
+ sal_Int32 nPara, sal_uInt8 nRightToLeft,
+ const EEngineData::WrongSpellVector* pWrongSpellVector,
+ const SvxFieldData* pFieldData,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ const css::lang::Locale* pLocale,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+
+ virtual void DrawingTab( const Point& rStartPos, tools::Long nWidth, const OUString& rChar,
+ const SvxFont& rFont, sal_Int32 nPara, sal_uInt8 nRightToLeft,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+ virtual OUString GetUndoComment( sal_uInt16 nUndoId ) const;
+ virtual bool SpellNextDocument();
+ /** @return true, when click was consumed. false otherwise. */
+ virtual bool FieldClicked( const SvxFieldItem& rField );
+ virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor );
+
+ // override this if access to bullet information needs to be provided
+ virtual const SvxNumberFormat * GetNumberFormat( sal_Int32 nPara ) const;
+
+ virtual tools::Rectangle GetBulletArea( sal_Int32 nPara );
+
+ static rtl::Reference<SfxItemPool> CreatePool();
+ static SfxItemPool& GetGlobalItemPool();
+ static bool DoesKeyChangeText( const KeyEvent& rKeyEvent );
+ static bool DoesKeyMoveCursor( const KeyEvent& rKeyEvent );
+ static bool IsSimpleCharInput( const KeyEvent& rKeyEvent );
+ static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const vcl::Font& rFont );
+ static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const SvxFont& rFont );
+ static vcl::Font CreateFontFromItemSet( const SfxItemSet& rItemSet, SvtScriptType nScriptType );
+ static SvxFont CreateSvxFontFromItemSet( const SfxItemSet& rItemSet );
+ static bool IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); }
+ static bool HasValidData( const css::uno::Reference< css::datatransfer::XTransferable >& rTransferable );
+ /** sets a link that is called at the beginning of a drag operation at an edit view */
+ void SetBeginDropHdl( const Link<EditView*,void>& rLink );
+ Link<EditView*,void> const & GetBeginDropHdl() const;
+
+ /** sets a link that is called at the end of a drag operation at an edit view */
+ void SetEndDropHdl( const Link<EditView*,void>& rLink );
+ Link<EditView*,void> const & GetEndDropHdl() const;
+
+ /// specifies if auto-correction should capitalize the first word or not (default is on)
+ void SetFirstWordCapitalization( bool bCapitalize );
+
+ /** specifies if auto-correction should replace a leading single quotation
+ mark (apostrophe) or not (default is on) */
+ void SetReplaceLeadingSingleQuotationMark( bool bReplace );
+
+ EditDoc& GetEditDoc();
+ const EditDoc& GetEditDoc() const;
+ void dumpAsXmlEditDoc(xmlTextWriterPtr pWriter) const;
+
+ ParaPortionList& GetParaPortions();
+ const ParaPortionList& GetParaPortions() const;
+
+ bool IsFormatted() const;
+ bool IsHtmlImportHandlerSet() const;
+ bool IsRtfImportHandlerSet() const;
+ bool IsImportRTFStyleSheetsSet() const;
+
+ void CallRtfImportHandler(RtfImportInfo& rInfo);
+ void CallHtmlImportHandler(HtmlImportInfo& rInfo);
+
+ void ParaAttribsToCharAttribs(ContentNode* pNode);
+
+ EditPaM CreateEditPaM(const EPaM& rEPaM);
+ EditPaM ConnectParagraphs(
+ ContentNode* pLeft, ContentNode* pRight, bool bBackward);
+
+ EditPaM InsertField(const EditSelection& rEditSelection, const SvxFieldItem& rFld);
+ EditPaM InsertText(const EditSelection& aCurEditSelection, const OUString& rStr);
+ EditSelection InsertText(const EditTextObject& rTextObject, const EditSelection& rSel);
+ EditPaM InsertParaBreak(const EditSelection& rEditSelection);
+ EditPaM InsertLineBreak(const EditSelection& rEditSelection);
+
+ EditPaM CursorLeft(
+ const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = css::i18n::CharacterIteratorMode::SKIPCELL);
+ EditPaM CursorRight(
+ const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = css::i18n::CharacterIteratorMode::SKIPCELL);
+
+ void SeekCursor(ContentNode* pNode, sal_Int32 nPos, SvxFont& rFont);
+
+ EditPaM DeleteSelection(const EditSelection& rSel);
+
+ ESelection CreateESelection(const EditSelection& rSel) const;
+ EditSelection CreateSelection(const ESelection& rSel);
+
+ const SfxItemSet& GetBaseParaAttribs(sal_Int32 nPara) const;
+ void SetParaAttribsOnly(sal_Int32 nPara, const SfxItemSet& rSet);
+ void SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, SetAttribsMode nSpecial = SetAttribsMode::NONE);
+
+ OUString GetSelected(const EditSelection& rSel) const;
+ EditPaM DeleteSelected(const EditSelection& rSel);
+
+ SvtScriptType GetScriptType(const EditSelection& rSel) const;
+
+ void RemoveParaPortion(sal_Int32 nNode);
+
+ void SetCallParaInsertedOrDeleted(bool b);
+ bool IsCallParaInsertedOrDeleted() const;
+
+ void AppendDeletedNodeInfo(DeletedNodeInfo* pInfo);
+ void UpdateSelections();
+
+ void InsertContent(ContentNode* pNode, sal_Int32 nPos);
+ EditPaM SplitContent(sal_Int32 nNode, sal_Int32 nSepPos);
+ EditPaM ConnectContents(sal_Int32 nLeftNode, bool bBackward);
+
+ void InsertFeature(const EditSelection& rEditSelection, const SfxPoolItem& rItem);
+
+ EditSelection MoveParagraphs(const Range& rParagraphs, sal_Int32 nNewPos);
+
+ void RemoveCharAttribs(sal_Int32 nPara, sal_uInt16 nWhich = 0, bool bRemoveFeatures = false);
+ void RemoveCharAttribs(const EditSelection& rSel, bool bRemoveParaAttribs, sal_uInt16 nWhich);
+ void RemoveCharAttribs(const EditSelection& rSel, EERemoveParaAttribsMode eMode, sal_uInt16 nWhich);
+
+ ViewsType& GetEditViews();
+ const ViewsType& GetEditViews() const;
+
+ void SetUndoMode(bool b);
+ void FormatAndLayout(EditView* pCurView, bool bCalledFromUndo = false);
+
+ void Undo(EditView* pView);
+ void Redo(EditView* pView);
+
+ sal_Int32 GetOverflowingParaNum() const;
+ sal_Int32 GetOverflowingLineNum() const;
+ void ClearOverflowingParaNum();
+ bool IsPageOverflow();
+
+ // tdf#132288 By default inserting an attribute beside another that is of
+ // the same type expands the original instead of inserting another. But the
+ // spell check dialog doesn't want that behaviour
+ void DisableAttributeExpanding();
+
+ // Optimization, if set, formatting will be done only for text lines that fit
+ // in given paper size and exceeding lines will be ignored.
+ void EnableSkipOutsideFormat(bool set);
+
+ void SetLOKSpecialPaperSize(const Size& rSize);
+ const Size& GetLOKSpecialPaperSize() const;
+
+#ifdef DBG_UTIL
+ static void DumpData(const EditEngine* pEE, bool bInfoBox);
+#endif
+};
+
+#endif // INCLUDED_EDITENG_EDITENG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editengdllapi.h b/include/editeng/editengdllapi.h
new file mode 100644
index 000000000..5d77e453e
--- /dev/null
+++ b/include/editeng/editengdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_EDITENGDLLAPI_H
+#define INCLUDED_EDITENG_EDITENGDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(EDITENG_DLLIMPLEMENTATION)
+#define EDITENG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define EDITENG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define EDITENG_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editerr.hxx b/include/editeng/editerr.hxx
new file mode 100644
index 000000000..e88b7b0f1
--- /dev/null
+++ b/include/editeng/editerr.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_EDITERR_HXX
+#define INCLUDED_EDITENG_EDITERR_HXX
+
+#include <vcl/errcode.hxx>
+
+#define ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS ErrCode(ErrCodeArea::Svx, 2)
+#define ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT ErrCode(ErrCodeArea::Svx, ErrCodeClass::Read, 8)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editids.hrc b/include/editeng/editids.hrc
new file mode 100644
index 000000000..a418a3f88
--- /dev/null
+++ b/include/editeng/editids.hrc
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_EDITIDS_HRC
+#define INCLUDED_EDITENG_EDITIDS_HRC
+
+#include <svl/solar.hrc>
+
+class SfxGrabBagItem;
+class SfxUInt16Item;
+class SvxBrushItem;
+class SvxFontItem;
+class SvxKerningItem;
+class SvxLanguageItem;
+class SvxLineSpacingItem;
+class SvxPageModelItem;
+class SvxPostureItem;
+class SvxTabStopItem;
+class SvxUnderlineItem;
+class SvxWeightItem;
+
+/*
+ These SID_SVX_START entries came from include/svx/svxids.hrc, avoid
+ accidentally colliding entries with include/svx/svxids.hrc and
+ include/sfx2/sfxsids.hrc. Only add new SID_SVX_START entries to
+ include/svx/svxids.hrc
+*/
+#define SID_ATTR_BRUSH TypedWhichId<SvxBrushItem>( SID_SVX_START + 1 )
+#define SID_ATTR_TABSTOP TypedWhichId<SvxTabStopItem>( SID_SVX_START + 2 )
+#define SID_ATTR_TABSTOP_DEFAULTS TypedWhichId<SfxUInt16Item>( SID_SVX_START + 3 )
+#define SID_ATTR_TABSTOP_POS TypedWhichId<SfxUInt16Item>( SID_SVX_START + 4 )
+#define SID_ATTR_TABSTOP_OFFSET TypedWhichId<SfxInt32Item>( SID_SVX_START + 5 )
+#define SID_ATTR_CHAR ( SID_SVX_START + 6 )
+#define SID_ATTR_CHAR_FONT TypedWhichId<SvxFontItem>( SID_SVX_START + 7 )
+#define SID_ATTR_CHAR_POSTURE TypedWhichId<SvxPostureItem>( SID_SVX_START + 8 )
+#define SID_ATTR_CHAR_WEIGHT TypedWhichId<SvxWeightItem>( SID_SVX_START + 9 )
+#define SID_ATTR_CHAR_SHADOWED ( SID_SVX_START + 10 )
+#define SID_ATTR_CHAR_WORDLINEMODE ( SID_SVX_START + 11 )
+#define SID_ATTR_CHAR_CONTOUR ( SID_SVX_START + 12 )
+#define SID_ATTR_CHAR_STRIKEOUT ( SID_SVX_START + 13 )
+#define SID_ATTR_CHAR_UNDERLINE TypedWhichId<SvxUnderlineItem>( SID_SVX_START + 14 )
+#define SID_ATTR_CHAR_FONTHEIGHT ( SID_SVX_START + 15 )
+ // free
+#define SID_ATTR_CHAR_COLOR ( SID_SVX_START + 17 )
+#define SID_ATTR_CHAR_KERNING TypedWhichId<SvxKerningItem>( SID_SVX_START + 18 )
+#define SID_ATTR_CHAR_CASEMAP ( SID_SVX_START + 19 )
+#define SID_ATTR_CHAR_LANGUAGE ( SID_SVX_START + 20 )
+#define SID_ATTR_CHAR_ESCAPEMENT ( SID_SVX_START + 21 )
+#define SID_ATTR_CHAR_FONTLIST ( SID_SVX_START + 22 )
+#define SID_ATTR_BORDER_OUTER ( SID_SVX_START + 24 )
+#define SID_ATTR_BORDER_SHADOW ( SID_SVX_START + 25 )
+#define SID_ATTR_PARA_ADJUST ( SID_SVX_START + 27 )
+#define SID_ATTR_PARA_ADJUST_LEFT ( SID_SVX_START + 28 )
+#define SID_ATTR_PARA_ADJUST_RIGHT ( SID_SVX_START + 29 )
+#define SID_ATTR_PARA_ADJUST_CENTER ( SID_SVX_START + 30 )
+#define SID_ATTR_PARA_ADJUST_BLOCK ( SID_SVX_START + 31 )
+#define SID_ATTR_PARA_LINESPACE TypedWhichId<SvxLineSpacingItem>( SID_SVX_START + 33 )
+#define SID_ATTR_PARA_LINESPACE_10 ( SID_SVX_START + 34 )
+#define SID_ATTR_PARA_LINESPACE_15 ( SID_SVX_START + 35 )
+#define SID_ATTR_PARA_LINESPACE_115 ( SID_SVX_START + 26 )
+#define SID_ATTR_PARA_LINESPACE_20 ( SID_SVX_START + 36 )
+#define SID_ATTR_PARA_PAGEBREAK ( SID_SVX_START + 37 )
+#define SID_ATTR_PARA_HYPHENZONE ( SID_SVX_START + 38 )
+#define SID_ATTR_PARA_SPLIT ( SID_SVX_START + 39 )
+#define SID_ATTR_PARA_ORPHANS ( SID_SVX_START + 40 )
+#define SID_ATTR_PARA_WIDOWS ( SID_SVX_START + 41 )
+#define SID_ATTR_PARA_ULSPACE ( SID_SVX_START + 42 )
+#define SID_ATTR_PARA_LRSPACE ( SID_SVX_START + 43 )
+#define SID_ATTR_PARA_LEFTSPACE ( SID_SVX_START + 44 )
+#define SID_ATTR_PARA_RIGHTSPACE ( SID_SVX_START + 45 )
+#define SID_ATTR_PARA_FIRSTLINESPACE ( SID_SVX_START + 46 )
+#define SID_ATTR_PARA_BELOWSPACE ( SID_SVX_START + 47 )
+#define SID_ATTR_LRSPACE ( SID_SVX_START + 48 )
+#define SID_ATTR_ULSPACE ( SID_SVX_START + 49 )
+#define SID_ATTR_PARA_ABOVESPACE ( SID_SVX_START + 64 )
+#define SID_ATTR_PARA_MODEL TypedWhichId<SvxPageModelItem>( SID_SVX_START + 65 )
+#define SID_ATTR_PARA_KEEP ( SID_SVX_START + 66 )
+#define SID_ATTR_CHAR_AUTOKERN ( SID_SVX_START + 67 )
+#define SID_HANGING_INDENT ( SID_SVX_START + 68 )
+#define SID_ATTR_PARA_BULLET ( SID_SVX_START + 250 )
+#define SID_ATTR_PARA_OUTLLEVEL ( SID_SVX_START + 300 )
+#define SID_FIELD ( SID_SVX_START + 363 ) // related to EE_FEATURE_FIELD
+#define SID_ATTR_PARA_REGISTER ( SID_SVX_START + 413 )
+#define SID_ATTR_PARA_PAGENUM ( SID_SVX_START + 457 )
+#define SID_ATTR_PARA_NUMRULE ( SID_SVX_START + 587 )
+#define SID_ATTR_BRUSH_CHAR ( SID_SVX_START + 591 )
+#define SID_ATTR_NUMBERING_RULE TypedWhichId<SvxNumBulletItem>( SID_SVX_START + 855 )
+#define SID_ATTR_CHAR_CHARSETCOLOR ( SID_SVX_START + 877 )
+#define SID_ATTR_CHAR_CJK_FONT ( SID_SVX_START + 887 )
+#define SID_ATTR_CHAR_CJK_FONTHEIGHT ( SID_SVX_START + 888 )
+#define SID_ATTR_CHAR_CJK_LANGUAGE TypedWhichId<SvxLanguageItem>( SID_SVX_START + 889 )
+#define SID_ATTR_CHAR_CJK_POSTURE ( SID_SVX_START + 890 )
+#define SID_ATTR_CHAR_CJK_WEIGHT ( SID_SVX_START + 891 )
+#define SID_ATTR_CHAR_CTL_FONT ( SID_SVX_START + 892 )
+#define SID_ATTR_CHAR_CTL_FONTHEIGHT ( SID_SVX_START + 893 )
+#define SID_ATTR_CHAR_CTL_LANGUAGE TypedWhichId<SvxLanguageItem>( SID_SVX_START + 894 )
+#define SID_ATTR_CHAR_CTL_POSTURE ( SID_SVX_START + 895 )
+#define SID_ATTR_CHAR_CTL_WEIGHT ( SID_SVX_START + 896 )
+#define SID_ATTR_CHAR_TWO_LINES ( SID_SVX_START + 897 )
+#define SID_ATTR_CHAR_CJK_RUBY ( SID_SVX_START + 898 )
+#define SID_ATTR_CHAR_EMPHASISMARK ( SID_SVX_START + 899 )
+#define SID_ATTR_PARA_SCRIPTSPACE ( SID_SVX_START + 901 )
+#define SID_ATTR_PARA_HANGPUNCTUATION ( SID_SVX_START + 902 )
+#define SID_ATTR_PARA_FORBIDDEN_RULES ( SID_SVX_START + 903 )
+#define SID_ATTR_CHAR_VERTICAL ( SID_SVX_START + 905 )
+#define SID_ATTR_CHAR_ROTATED ( SID_SVX_START + 910 )
+#define SID_ATTR_CHAR_SCALEWIDTH ( SID_SVX_START + 911 )
+#define SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ( SID_SVX_START + 919 )
+#define SID_ATTR_CHAR_RELIEF ( SID_SVX_START + 920 )
+#define SID_PARA_VERTALIGN ( SID_SVX_START + 925 )
+#define SID_ATTR_FRAMEDIRECTION ( SID_SVX_START + 944 )
+#define SID_ATTR_PARA_SNAPTOGRID ( SID_SVX_START + 945 )
+#define SID_ATTR_PARA_LRSPACE_VERTICAL ( SID_SVX_START + 947 )
+#define SID_ATTR_PARA_LEFT_TO_RIGHT ( SID_SVX_START + 950 )
+#define SID_ATTR_PARA_RIGHT_TO_LEFT ( SID_SVX_START + 951 )
+#define SID_ATTR_CHAR_HIDDEN ( SID_SVX_START + 989 )
+#define SID_ATTR_CHAR_LATIN_FONT ( SID_SVX_START + 994 )
+#define SID_ATTR_CHAR_LATIN_FONTHEIGHT ( SID_SVX_START + 995 )
+#define SID_ATTR_CHAR_LATIN_LANGUAGE ( SID_SVX_START + 996 )
+#define SID_ATTR_CHAR_LATIN_POSTURE ( SID_SVX_START + 997 )
+#define SID_ATTR_CHAR_LATIN_WEIGHT ( SID_SVX_START + 998 )
+#define SID_ATTR_CHAR_GRABBAG TypedWhichId<SfxGrabBagItem>( SID_SVX_START + 1142 )
+#define SID_ATTR_CHAR_BACK_COLOR ( SID_SVX_START + 1153 )
+
+// these ID didn't exist prior to the svx split, add new ids here
+#define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 )
+#define SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD ( SID_EDIT_START + 69 )
+#define SID_ATTR_ALIGN_VER_JUSTIFY_METHOD ( SID_EDIT_START + 70 )
+#define SID_ATTR_ALIGN_HOR_JUSTIFY ( SID_EDIT_START + 71 )
+#define SID_ATTR_ALIGN_VER_JUSTIFY TypedWhichId<SvxVerJustifyItem>( SID_EDIT_START + 72 )
+#define SID_ATTR_PARA_OUTLINE_LEVEL TypedWhichId<SfxUInt16Item>( SID_EDIT_START + 73 )
+#define SID_ATTR_CHAR_PREVIEW_FONT TypedWhichId<SvxFontItem>( SID_EDIT_START + 74 )
+#define SID_ATTR_CHAR_ENDPREVIEW_FONT TypedWhichId<SvxFontItem>( SID_EDIT_START + 75 )
+#define SID_ATTR_CHAR_BOX ( SID_EDIT_START + 76 )
+#define SID_ATTR_CHAR_SHADOW ( SID_EDIT_START + 77 )
+#define SID_ATTR_PARA_GRABBAG TypedWhichId<SfxGrabBagItem>( SID_EDIT_START + 78 )
+
+
+#if 95 > (SID_EDIT_END-SID_EDIT_START)
+#error Resource-Overflow in #line, #file
+#endif
+
+#endif
+
+// ******************************************************************* EOF
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx
new file mode 100644
index 000000000..5badaf8e8
--- /dev/null
+++ b/include/editeng/editobj.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_EDITOBJ_HXX
+#define INCLUDED_EDITENG_EDITOBJ_HXX
+
+#include <svl/style.hxx>
+#include <editeng/editengdllapi.h>
+#include <editeng/macros.hxx>
+#include <svl/languageoptions.hxx>
+
+#include <com/sun/star/text/textfield/Type.hpp>
+
+#include <vector>
+#include <memory>
+
+class SfxItemPool;
+class SfxItemSet;
+class SvxFieldItem;
+class SvxFieldData;
+enum class OutlinerMode;
+struct EECharAttrib;
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+
+namespace editeng {
+
+class FieldUpdater;
+struct Section;
+
+}
+
+namespace svl {
+
+class SharedString;
+class SharedStringPool;
+
+}
+
+enum class TextRotation { NONE, TOPTOBOTTOM, BOTTOMTOTOP };
+
+class EDITENG_DLLPUBLIC EditTextObject
+{
+public:
+ virtual ~EditTextObject();
+
+ /**
+ * Set paragraph strings to the shared string pool.
+ *
+ * @param rPool shared string pool.
+ */
+ virtual void NormalizeString( svl::SharedStringPool& rPool ) = 0;
+
+ virtual std::vector<svl::SharedString> GetSharedStrings() const = 0;
+
+ virtual const SfxItemPool* GetPool() const = 0;
+ virtual OutlinerMode GetUserType() const = 0; // For OutlinerMode, it can however not save in compatible format
+ virtual void SetUserType( OutlinerMode n ) = 0;
+
+ virtual bool IsEffectivelyVertical() const = 0;
+ virtual bool GetVertical() const = 0;
+ virtual bool IsTopToBottom() const = 0;
+ virtual void SetVertical( bool bVertical ) = 0;
+ virtual void SetRotation( TextRotation nRotation ) = 0;
+ virtual TextRotation GetRotation() const = 0;
+
+ virtual SvtScriptType GetScriptType() const = 0;
+
+ virtual std::unique_ptr<EditTextObject> Clone() const = 0;
+
+ virtual sal_Int32 GetParagraphCount() const = 0;
+
+ virtual OUString GetText(sal_Int32 nPara) const = 0;
+
+ virtual void ClearPortionInfo() = 0;
+
+ virtual bool HasOnlineSpellErrors() const = 0;
+
+ virtual void GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLst ) const = 0;
+
+ virtual bool RemoveCharAttribs( sal_uInt16 nWhich ) = 0;
+
+ /**
+ * Get all text sections in this content. Sections are non-overlapping
+ * segments of text split either by paragraph boundaries or format
+ * boundaries. Each section object contains all applied formats and/or a
+ * field item.
+ */
+ virtual void GetAllSections( std::vector<editeng::Section>& rAttrs ) const = 0;
+
+ virtual bool IsFieldObject() const = 0;
+ virtual const SvxFieldItem* GetField() const = 0;
+ virtual const SvxFieldData* GetFieldData(sal_Int32 nPara, size_t nPos, sal_Int32 nType) const = 0;
+ virtual bool HasField( sal_Int32 nType = css::text::textfield::Type::UNSPECIFIED ) const = 0;
+
+ virtual const SfxItemSet& GetParaAttribs(sal_Int32 nPara) const = 0;
+
+ virtual void GetStyleSheet(sal_Int32 nPara, OUString& rName, SfxStyleFamily& eFamily) const = 0;
+ virtual void SetStyleSheet(sal_Int32 nPara, const OUString& rName, const SfxStyleFamily& eFamily) = 0;
+ virtual bool ChangeStyleSheets(
+ std::u16string_view rOldName, SfxStyleFamily eOldFamily, const OUString& rNewName, SfxStyleFamily eNewFamily) = 0;
+ virtual void ChangeStyleSheetName(SfxStyleFamily eFamily, std::u16string_view rOldName, const OUString& rNewName) = 0;
+
+ virtual editeng::FieldUpdater GetFieldUpdater() = 0;
+
+ virtual bool operator==( const EditTextObject& rCompare ) const = 0;
+
+ /** Compare, ignoring SfxItemPool pointer.
+ */
+ bool Equals( const EditTextObject& rCompare ) const;
+
+ // #i102062#
+ virtual bool isWrongListEqual(const EditTextObject& rCompare) const = 0;
+
+#if DEBUG_EDIT_ENGINE
+ virtual void Dump() const = 0;
+#endif
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const = 0;
+};
+
+#endif // INCLUDED_EDITENG_EDITOBJ_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editrids.hrc b/include/editeng/editrids.hrc
new file mode 100644
index 000000000..31ac07a1d
--- /dev/null
+++ b/include/editeng/editrids.hrc
@@ -0,0 +1,318 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_INCLUDE_EDITENG_EDITRIDS_HRC
+#define INCLUDED_INCLUDE_EDITENG_EDITRIDS_HRC
+
+#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
+
+// enum SvxBreak ------------------------------------------------------------
+#define RID_SVXITEMS_BREAK_NONE NC_("RID_SVXITEMS_BREAK_NONE", "No break")
+#define RID_SVXITEMS_BREAK_COLUMN_BEFORE NC_("RID_SVXITEMS_BREAK_COLUMN_BEFORE", "Break before new column")
+#define RID_SVXITEMS_BREAK_COLUMN_AFTER NC_("RID_SVXITEMS_BREAK_COLUMN_AFTER", "Break after new column")
+#define RID_SVXITEMS_BREAK_COLUMN_BOTH NC_("RID_SVXITEMS_BREAK_COLUMN_BOTH", "Break before and after new column")
+#define RID_SVXITEMS_BREAK_PAGE_BEFORE NC_("RID_SVXITEMS_BREAK_PAGE_BEFORE", "Break before new page")
+#define RID_SVXITEMS_BREAK_PAGE_AFTER NC_("RID_SVXITEMS_BREAK_PAGE_AFTER", "Break after new page")
+#define RID_SVXITEMS_BREAK_PAGE_BOTH NC_("RID_SVXITEMS_BREAK_PAGE_BOTH", "Break before and after new page")
+
+// enum SvxShadowLocation ---------------------------------------------------
+#define RID_SVXITEMS_SHADOW_NONE NC_("RID_SVXITEMS_SHADOW_NONE", "No Shadow")
+#define RID_SVXITEMS_SHADOW_TOPLEFT NC_("RID_SVXITEMS_SHADOW_TOPLEFT", "Shadow top left")
+#define RID_SVXITEMS_SHADOW_TOPRIGHT NC_("RID_SVXITEMS_SHADOW_TOPRIGHT", "Shadow top right")
+#define RID_SVXITEMS_SHADOW_BOTTOMLEFT NC_("RID_SVXITEMS_SHADOW_BOTTOMLEFT", "Shadow bottom left")
+#define RID_SVXITEMS_SHADOW_BOTTOMRIGHT NC_("RID_SVXITEMS_SHADOW_BOTTOMRIGHT", "Shadow bottom right")
+
+// enum ColorName -----------------------------------------------------------
+#define RID_SVXITEMS_COLOR_BLACK NC_("RID_SVXITEMS_COLOR_BLACK", "Black")
+#define RID_SVXITEMS_COLOR_BLUE NC_("RID_SVXITEMS_COLOR_BLUE", "Blue")
+#define RID_SVXITEMS_COLOR_GREEN NC_("RID_SVXITEMS_COLOR_GREEN", "Green")
+#define RID_SVXITEMS_COLOR_CYAN NC_("RID_SVXITEMS_COLOR_CYAN", "Cyan")
+#define RID_SVXITEMS_COLOR_RED NC_("RID_SVXITEMS_COLOR_RED", "Red")
+#define RID_SVXITEMS_COLOR_MAGENTA NC_("RID_SVXITEMS_COLOR_MAGENTA", "Magenta")
+#define RID_SVXITEMS_COLOR_BROWN NC_("RID_SVXITEMS_COLOR_BROWN", "Brown")
+#define RID_SVXITEMS_COLOR_GRAY NC_("RID_SVXITEMS_COLOR_GRAY", "Gray")
+#define RID_SVXITEMS_COLOR_LIGHTGRAY NC_("RID_SVXITEMS_COLOR_LIGHTGRAY", "Light Gray")
+#define RID_SVXITEMS_COLOR_LIGHTBLUE NC_("RID_SVXITEMS_COLOR_LIGHTBLUE", "Light Blue")
+#define RID_SVXITEMS_COLOR_LIGHTGREEN NC_("RID_SVXITEMS_COLOR_LIGHTGREEN", "Light Green")
+#define RID_SVXITEMS_COLOR_LIGHTCYAN NC_("RID_SVXITEMS_COLOR_LIGHTCYAN", "Light Cyan")
+#define RID_SVXITEMS_COLOR_LIGHTRED NC_("RID_SVXITEMS_COLOR_LIGHTRED", "Light Red")
+#define RID_SVXITEMS_COLOR_LIGHTMAGENTA NC_("RID_SVXITEMS_COLOR_LIGHTMAGENTA", "Light Magenta")
+#define RID_SVXITEMS_COLOR_YELLOW NC_("RID_SVXITEMS_COLOR_YELLOW", "Yellow")
+#define RID_SVXITEMS_COLOR_WHITE NC_("RID_SVXITEMS_COLOR_WHITE", "White")
+
+// enum FontItalic -------------------------------------------------------
+#define RID_SVXITEMS_ITALIC_NONE NC_("RID_SVXITEMS_ITALIC_NONE", "Not Italic")
+#define RID_SVXITEMS_ITALIC_OBLIQUE NC_("RID_SVXITEMS_ITALIC_OBLIQUE", "Oblique italic")
+#define RID_SVXITEMS_ITALIC_NORMAL NC_("RID_SVXITEMS_ITALIC_NORMAL", "Italic")
+
+// enum FontWeight -------------------------------------------------------
+#define RID_SVXITEMS_WEIGHT_DONTKNOW NC_("RID_SVXITEMS_WEIGHT_DONTKNOW", "?")
+#define RID_SVXITEMS_WEIGHT_THIN NC_("RID_SVXITEMS_WEIGHT_THIN", "thin")
+#define RID_SVXITEMS_WEIGHT_ULTRALIGHT NC_("RID_SVXITEMS_WEIGHT_ULTRALIGHT", "ultra thin")
+#define RID_SVXITEMS_WEIGHT_LIGHT NC_("RID_SVXITEMS_WEIGHT_LIGHT", "light")
+#define RID_SVXITEMS_WEIGHT_SEMILIGHT NC_("RID_SVXITEMS_WEIGHT_SEMILIGHT", "semi light")
+#define RID_SVXITEMS_WEIGHT_NORMAL NC_("RID_SVXITEMS_WEIGHT_NORMAL", "normal")
+#define RID_SVXITEMS_WEIGHT_MEDIUM NC_("RID_SVXITEMS_WEIGHT_MEDIUM", "medium")
+#define RID_SVXITEMS_WEIGHT_SEMIBOLD NC_("RID_SVXITEMS_WEIGHT_SEMIBOLD", "semi bold")
+#define RID_SVXITEMS_WEIGHT_BOLD NC_("RID_SVXITEMS_WEIGHT_BOLD", "bold")
+#define RID_SVXITEMS_WEIGHT_ULTRABOLD NC_("RID_SVXITEMS_WEIGHT_ULTRABOLD", "ultra bold")
+#define RID_SVXITEMS_WEIGHT_BLACK NC_("RID_SVXITEMS_WEIGHT_BLACK", "black")
+
+// enum FontUnderline - used for underline ------------------------------
+#define RID_SVXITEMS_UL_NONE NC_("RID_SVXITEMS_UL_NONE", "No underline")
+#define RID_SVXITEMS_UL_SINGLE NC_("RID_SVXITEMS_UL_SINGLE", "Single underline")
+#define RID_SVXITEMS_UL_DOUBLE NC_("RID_SVXITEMS_UL_DOUBLE", "Double underline")
+#define RID_SVXITEMS_UL_DOTTED NC_("RID_SVXITEMS_UL_DOTTED", "Dotted underline")
+#define RID_SVXITEMS_UL_DONTKNOW NC_("RID_SVXITEMS_UL_DONTKNOW", "Underline")
+#define RID_SVXITEMS_UL_DASH NC_("RID_SVXITEMS_UL_DASH", "Underline (dashes)")
+#define RID_SVXITEMS_UL_LONGDASH NC_("RID_SVXITEMS_UL_LONGDASH", "Underline (long dashes)")
+#define RID_SVXITEMS_UL_DASHDOT NC_("RID_SVXITEMS_UL_DASHDOT", "Underline (dot dash)")
+#define RID_SVXITEMS_UL_DASHDOTDOT NC_("RID_SVXITEMS_UL_DASHDOTDOT", "Underline (dot dot dash)")
+#define RID_SVXITEMS_UL_SMALLWAVE NC_("RID_SVXITEMS_UL_SMALLWAVE", "Underline (small wave)")
+#define RID_SVXITEMS_UL_WAVE NC_("RID_SVXITEMS_UL_WAVE", "Underline (Wave)")
+#define RID_SVXITEMS_UL_DOUBLEWAVE NC_("RID_SVXITEMS_UL_DOUBLEWAVE", "Underline (Double wave)")
+#define RID_SVXITEMS_UL_BOLD NC_("RID_SVXITEMS_UL_BOLD", "Underlined (Bold)")
+#define RID_SVXITEMS_UL_BOLDDOTTED NC_("RID_SVXITEMS_UL_BOLDDOTTED", "Dotted underline (Bold)")
+#define RID_SVXITEMS_UL_BOLDDASH NC_("RID_SVXITEMS_UL_BOLDDASH", "Underline (Dash bold)")
+#define RID_SVXITEMS_UL_BOLDLONGDASH NC_("RID_SVXITEMS_UL_BOLDLONGDASH", "Underline (long dash, bold)")
+#define RID_SVXITEMS_UL_BOLDDASHDOT NC_("RID_SVXITEMS_UL_BOLDDASHDOT", "Underline (dot dash, bold)")
+#define RID_SVXITEMS_UL_BOLDDASHDOTDOT NC_("RID_SVXITEMS_UL_BOLDDASHDOTDOT", "Underline (dot dot dash, bold)")
+#define RID_SVXITEMS_UL_BOLDWAVE NC_("RID_SVXITEMS_UL_BOLDWAVE", "Underline (wave, bold)")
+
+// enum FontUnderline - used for overline -------------------------------
+#define RID_SVXITEMS_OL_NONE NC_("RID_SVXITEMS_OL_NONE", "No overline")
+#define RID_SVXITEMS_OL_SINGLE NC_("RID_SVXITEMS_OL_SINGLE", "Single overline")
+#define RID_SVXITEMS_OL_DOUBLE NC_("RID_SVXITEMS_OL_DOUBLE", "Double overline")
+#define RID_SVXITEMS_OL_DOTTED NC_("RID_SVXITEMS_OL_DOTTED", "Dotted overline")
+#define RID_SVXITEMS_OL_DONTKNOW NC_("RID_SVXITEMS_OL_DONTKNOW", "Overline")
+#define RID_SVXITEMS_OL_DASH NC_("RID_SVXITEMS_OL_DASH", "Overline (dashes)")
+#define RID_SVXITEMS_OL_LONGDASH NC_("RID_SVXITEMS_OL_LONGDASH", "Overline (long dashes)")
+#define RID_SVXITEMS_OL_DASHDOT NC_("RID_SVXITEMS_OL_DASHDOT", "Overline (dot dash)")
+#define RID_SVXITEMS_OL_DASHDOTDOT NC_("RID_SVXITEMS_OL_DASHDOTDOT", "Overline (dot dot dash)")
+#define RID_SVXITEMS_OL_SMALLWAVE NC_("RID_SVXITEMS_OL_SMALLWAVE", "Overline (small wave)")
+#define RID_SVXITEMS_OL_WAVE NC_("RID_SVXITEMS_OL_WAVE", "Overline (Wave)")
+#define RID_SVXITEMS_OL_DOUBLEWAVE NC_("RID_SVXITEMS_OL_DOUBLEWAVE", "Overline (Double wave)")
+#define RID_SVXITEMS_OL_BOLD NC_("RID_SVXITEMS_OL_BOLD", "Overlined (Bold)")
+#define RID_SVXITEMS_OL_BOLDDOTTED NC_("RID_SVXITEMS_OL_BOLDDOTTED", "Dotted overline (Bold)")
+#define RID_SVXITEMS_OL_BOLDDASH NC_("RID_SVXITEMS_OL_BOLDDASH", "Overline (Dash bold)")
+#define RID_SVXITEMS_OL_BOLDLONGDASH NC_("RID_SVXITEMS_OL_BOLDLONGDASH", "Overline (long dash, bold)")
+#define RID_SVXITEMS_OL_BOLDDASHDOT NC_("RID_SVXITEMS_OL_BOLDDASHDOT", "Overline (dot dash, bold)")
+#define RID_SVXITEMS_OL_BOLDDASHDOTDOT NC_("RID_SVXITEMS_OL_BOLDDASHDOTDOT", "Overline (dot dot dash, bold)")
+#define RID_SVXITEMS_OL_BOLDWAVE NC_("RID_SVXITEMS_OL_BOLDWAVE", "Overline (wave, bold)")
+
+// enum FontStrikeout ----------------------------------------------------
+#define RID_SVXITEMS_STRIKEOUT_NONE NC_("RID_SVXITEMS_STRIKEOUT_NONE", "No strikethrough")
+#define RID_SVXITEMS_STRIKEOUT_SINGLE NC_("RID_SVXITEMS_STRIKEOUT_SINGLE", "Single strikethrough")
+#define RID_SVXITEMS_STRIKEOUT_DOUBLE NC_("RID_SVXITEMS_STRIKEOUT_DOUBLE", "Double strikethrough")
+#define RID_SVXITEMS_STRIKEOUT_DONTKNOW NC_("RID_SVXITEMS_STRIKEOUT_DONTKNOW", "Strikethrough")
+#define RID_SVXITEMS_STRIKEOUT_BOLD NC_("RID_SVXITEMS_STRIKEOUT_BOLD", "Bold strikethrough")
+#define RID_SVXITEMS_STRIKEOUT_SLASH NC_("RID_SVXITEMS_STRIKEOUT_SLASH", "Strike through with slash")
+#define RID_SVXITEMS_STRIKEOUT_X NC_("RID_SVXITEMS_STRIKEOUT_X", "Strike through with Xes")
+
+// enum CASEMAP ----------------------------------------------------------
+#define RID_SVXITEMS_CASEMAP_NONE NC_("RID_SVXITEMS_CASEMAP_NONE", "None")
+#define RID_SVXITEMS_CASEMAP_UPPERCASE NC_("RID_SVXITEMS_CASEMAP_VERSALIEN", "Caps")
+#define RID_SVXITEMS_CASEMAP_LOWERCASE NC_("RID_SVXITEMS_CASEMAP_GEMEINE", "Lowercase")
+#define RID_SVXITEMS_CASEMAP_TITLE NC_("RID_SVXITEMS_CASEMAP_TITEL", "Title")
+#define RID_SVXITEMS_CASEMAP_SMALLCAPS NC_("RID_SVXITEMS_CASEMAP_KAPITAELCHEN", "Small caps")
+
+// enum ESCAPEMENT -------------------------------------------------------
+#define RID_SVXITEMS_ESCAPEMENT_OFF NC_("RID_SVXITEMS_ESCAPEMENT_OFF", "Normal position")
+#define RID_SVXITEMS_ESCAPEMENT_SUPER NC_("RID_SVXITEMS_ESCAPEMENT_SUPER", "Superscript ")
+#define RID_SVXITEMS_ESCAPEMENT_SUB NC_("RID_SVXITEMS_ESCAPEMENT_SUB", "Subscript ")
+#define RID_SVXITEMS_ESCAPEMENT_AUTO NC_("RID_SVXITEMS_ESCAPEMENT_AUTO", "automatic")
+
+// enum SvxAdjust -----------------------------------------------------------
+#define RID_SVXITEMS_ADJUST_LEFT NC_("RID_SVXITEMS_ADJUST_LEFT", "Align left")
+#define RID_SVXITEMS_ADJUST_RIGHT NC_("RID_SVXITEMS_ADJUST_RIGHT", "Align right")
+#define RID_SVXITEMS_ADJUST_BLOCK NC_("RID_SVXITEMS_ADJUST_BLOCK", "Justify")
+#define RID_SVXITEMS_ADJUST_CENTER NC_("RID_SVXITEMS_ADJUST_CENTER", "Centered")
+#define RID_SVXITEMS_ADJUST_BLOCKLINE NC_("RID_SVXITEMS_ADJUST_BLOCKLINE", "Justify")
+#define RID_SOLID NC_("RID_SOLID", "Single, solid")
+#define RID_DOTTED NC_("RID_DOTTED", "Single, dotted")
+#define RID_DASHED NC_("RID_DASHED", "Single, dashed")
+#define RID_DOUBLE NC_("RID_DOUBLE", "Double")
+#define RID_THINTHICK_SMALLGAP NC_("RID_THINTHICK_SMALLGAP", "Double, inside: fine, outside: thick, spacing: small")
+#define RID_THINTHICK_MEDIUMGAP NC_("RID_THINTHICK_MEDIUMGAP", "Double, inside: fine, outside: thick, spacing: medium")
+#define RID_THINTHICK_LARGEGAP NC_("RID_THINTHICK_LARGEGAP", "Double, inside: fine, outside: thick, spacing: large")
+#define RID_THICKTHIN_SMALLGAP NC_("RID_THICKTHIN_SMALLGAP", "Double, inside: thick, outside: fine, spacing: small")
+#define RID_THICKTHIN_MEDIUMGAP NC_("RID_THICKTHIN_MEDIUMGAP", "Double, inside: thick, outside: fine, spacing: medium")
+#define RID_THICKTHIN_LARGEGAP NC_("RID_THICKTHIN_LARGEGAP", "Double, inside: thick, outside: fine, spacing: large")
+#define RID_EMBOSSED NC_("RID_EMBOSSED", "3D embossed")
+#define RID_ENGRAVED NC_("RID_ENGRAVED", "3D engraved")
+#define RID_INSET NC_("RID_INSET", "Inset")
+#define RID_OUTSET NC_("RID_OUTSET", "Outset")
+#define RID_FINE_DASHED NC_("RID_FINE_DASHED", "Single, fine dashed")
+#define RID_DOUBLE_THIN NC_("RID_DOUBLE_THIN", "Double, fixed thin lines")
+#define RID_DASH_DOT NC_("RID_DASH_DOT", "Single, dash-dot")
+#define RID_DASH_DOT_DOT NC_("RID_DASH_DOT_DOT", "Single, dash-dot-dot")
+#define RID_SVXITEMS_METRIC_MM NC_("RID_SVXITEMS_METRIC_MM", "mm")
+#define RID_SVXITEMS_METRIC_CM NC_("RID_SVXITEMS_METRIC_CM", "cm")
+#define RID_SVXITEMS_METRIC_INCH NC_("RID_SVXITEMS_METRIC_INCH", "inch")
+#define RID_SVXITEMS_METRIC_POINT NC_("RID_SVXITEMS_METRIC_POINT", "pt")
+#define RID_SVXITEMS_METRIC_TWIP NC_("RID_SVXITEMS_METRIC_TWIP", "twip")
+#define RID_SVXITEMS_METRIC_PIXEL NC_("RID_SVXITEMS_METRIC_PIXEL", "pixel")
+
+// GetValueText of BoolItems
+#define RID_SVXITEMS_SHADOWED_TRUE NC_("RID_SVXITEMS_SHADOWED_TRUE", "Shadowed")
+#define RID_SVXITEMS_SHADOWED_FALSE NC_("RID_SVXITEMS_SHADOWED_FALSE", "Not Shadowed")
+#define RID_SVXITEMS_BLINK_TRUE NC_("RID_SVXITEMS_BLINK_TRUE", "Blinking")
+#define RID_SVXITEMS_BLINK_FALSE NC_("RID_SVXITEMS_BLINK_FALSE", "Not Blinking")
+#define RID_SVXITEMS_AUTOKERN_TRUE NC_("RID_SVXITEMS_AUTOKERN_TRUE", "Pair Kerning")
+#define RID_SVXITEMS_AUTOKERN_FALSE NC_("RID_SVXITEMS_AUTOKERN_FALSE", "No pair kerning")
+#define RID_SVXITEMS_WORDLINE_TRUE NC_("RID_SVXITEMS_WORDLINE_TRUE", "Individual words")
+#define RID_SVXITEMS_WORDLINE_FALSE NC_("RID_SVXITEMS_WORDLINE_FALSE", "Not Words Only")
+#define RID_SVXITEMS_CONTOUR_TRUE NC_("RID_SVXITEMS_CONTOUR_TRUE", "Outline")
+#define RID_SVXITEMS_CONTOUR_FALSE NC_("RID_SVXITEMS_CONTOUR_FALSE", "No Outline")
+#define RID_SVXITEMS_PRINT_TRUE NC_("RID_SVXITEMS_PRINT_TRUE", "Print")
+#define RID_SVXITEMS_PRINT_FALSE NC_("RID_SVXITEMS_PRINT_FALSE", "Don't print")
+#define RID_SVXITEMS_OPAQUE_TRUE NC_("RID_SVXITEMS_OPAQUE_TRUE", "Opaque")
+#define RID_SVXITEMS_OPAQUE_FALSE NC_("RID_SVXITEMS_OPAQUE_FALSE", "Not Opaque")
+#define RID_SVXITEMS_FMTKEEP_TRUE NC_("RID_SVXITEMS_FMTKEEP_TRUE", "Keep with next paragraph")
+#define RID_SVXITEMS_FMTKEEP_FALSE NC_("RID_SVXITEMS_FMTKEEP_FALSE", "Don't Keep Paragraphs Together")
+#define RID_SVXITEMS_FMTSPLIT_TRUE NC_("RID_SVXITEMS_FMTSPLIT_TRUE", "Split paragraph")
+#define RID_SVXITEMS_FMTSPLIT_FALSE NC_("RID_SVXITEMS_FMTSPLIT_FALSE", "Don't split paragraph")
+#define RID_SVXITEMS_PROT_CONTENT_TRUE NC_("RID_SVXITEMS_PROT_CONTENT_TRUE", "Contents protected")
+#define RID_SVXITEMS_PROT_CONTENT_FALSE NC_("RID_SVXITEMS_PROT_CONTENT_FALSE", "Contents not protected")
+#define RID_SVXITEMS_PROT_SIZE_TRUE NC_("RID_SVXITEMS_PROT_SIZE_TRUE", "Size protected")
+#define RID_SVXITEMS_PROT_SIZE_FALSE NC_("RID_SVXITEMS_PROT_SIZE_FALSE", "Size not protected")
+#define RID_SVXITEMS_PROT_POS_TRUE NC_("RID_SVXITEMS_PROT_POS_TRUE", "Position protected")
+#define RID_SVXITEMS_PROT_POS_FALSE NC_("RID_SVXITEMS_PROT_POS_FALSE", "Position not protected")
+#define RID_SVXITEMS_TRANSPARENT_TRUE NC_("RID_SVXITEMS_TRANSPARENT_TRUE", "Transparent")
+#define RID_SVXITEMS_TRANSPARENT_FALSE NC_("RID_SVXITEMS_TRANSPARENT_FALSE", "Not Transparent")
+#define RID_SVXITEMS_HYPHEN_TRUE NC_("RID_SVXITEMS_HYPHEN_TRUE", "Hyphenation")
+#define RID_SVXITEMS_HYPHEN_FALSE NC_("RID_SVXITEMS_HYPHEN_FALSE", "No hyphenation")
+#define RID_SVXITEMS_PAGE_END_TRUE NC_("RID_SVXITEMS_PAGE_END_TRUE", "Page End")
+#define RID_SVXITEMS_PAGE_END_FALSE NC_("RID_SVXITEMS_PAGE_END_FALSE", "No Page End")
+#define RID_SVXITEMS_SIZE_WIDTH NC_("RID_SVXITEMS_SIZE_WIDTH", "Width: ")
+#define RID_SVXITEMS_SIZE_HEIGHT NC_("RID_SVXITEMS_SIZE_HEIGHT", "Height: ")
+#define RID_SVXITEMS_LRSPACE_LEFT NC_("RID_SVXITEMS_LRSPACE_LEFT", "Indent left ")
+#define RID_SVXITEMS_LRSPACE_FLINE NC_("RID_SVXITEMS_LRSPACE_FLINE", "First Line ")
+#define RID_SVXITEMS_LRSPACE_RIGHT NC_("RID_SVXITEMS_LRSPACE_RIGHT", "Indent right ")
+#define RID_SVXITEMS_SHADOW_COMPLETE NC_("RID_SVXITEMS_SHADOW_COMPLETE", "Shadow: ")
+#define RID_SVXITEMS_BORDER_COMPLETE NC_("RID_SVXITEMS_BORDER_COMPLETE", "Borders ")
+#define RID_SVXITEMS_BORDER_NONE NC_("RID_SVXITEMS_BORDER_NONE", "No border")
+#define RID_SVXITEMS_BORDER_TOP NC_("RID_SVXITEMS_BORDER_TOP", "top ")
+#define RID_SVXITEMS_BORDER_BOTTOM NC_("RID_SVXITEMS_BORDER_BOTTOM", "bottom ")
+#define RID_SVXITEMS_BORDER_LEFT NC_("RID_SVXITEMS_BORDER_LEFT", "left ")
+#define RID_SVXITEMS_BORDER_RIGHT NC_("RID_SVXITEMS_BORDER_RIGHT", "right ")
+#define RID_SVXITEMS_BORDER_DISTANCE NC_("RID_SVXITEMS_BORDER_DISTANCE", "Spacing ")
+#define RID_SVXITEMS_ULSPACE_UPPER NC_("RID_SVXITEMS_ULSPACE_UPPER", "From top ")
+#define RID_SVXITEMS_ULSPACE_LOWER NC_("RID_SVXITEMS_ULSPACE_LOWER", "From bottom ")
+#define RID_SVXITEMS_LINESPACING_SINGLE NC_("RID_SVXITEMS_LINESPACING_SINGLE", "Single")
+#define RID_SVXITEMS_LINESPACING_115 NC_("RID_SVXITEMS_LINESPACING_115", "1.15 Lines")
+#define RID_SVXITEMS_LINESPACING_15 NC_("RID_SVXITEMS_LINESPACING_15", "1.5 Lines")
+#define RID_SVXITEMS_LINESPACING_DOUBLE NC_("RID_SVXITEMS_LINESPACING_DOUBLE", "Double")
+#define RID_SVXITEMS_LINESPACING_PROPORTIONAL NC_("RID_SVXITEMS_LINESPACING_PROPORTIONAL", "Proportional")
+#define RID_SVXITEMS_LINESPACING_MIN NC_("RID_SVXITEMS_LINESPACING_MIN", "At least")
+#define RID_SVXITEMS_LINESPACING_LEADING NC_("RID_SVXITEMS_LINESPACING_LEADING", "Leading")
+#define RID_SVXITEMS_LINESPACING_FIXED NC_("RID_SVXITEMS_LINESPACING_FIXED", "Fixed")
+// To translators: %1 == will be replaced by the number of lines
+#define RID_SVXITEMS_LINES NC_("RID_SVXITEMS_LINES", "%1 Lines")
+#define RID_SVXITEMS_WIDOWS_COMPLETE NC_("RID_SVXITEMS_WIDOWS_COMPLETE", "Widow control")
+#define RID_SVXITEMS_ORPHANS_COMPLETE NC_("RID_SVXITEMS_ORPHANS_COMPLETE", "Orphan control")
+#define RID_SVXITEMS_HYPHEN_MINLEAD NC_("RID_SVXITEMS_HYPHEN_MINLEAD", "%1 characters at end of line")
+#define RID_SVXITEMS_HYPHEN_MINTRAIL NC_("RID_SVXITEMS_HYPHEN_MINTRAIL", "%1 characters at beginning of line")
+#define RID_SVXITEMS_HYPHEN_MAX NC_("RID_SVXITEMS_HYPHEN_MAX", "%1 hyphens")
+#define RID_SVXITEMS_HYPHEN_NO_CAPS_TRUE NC_("RID_SVXITEMS_HYPHEN_NO_CAPS_TRUE", "Not hyphenated CAPS")
+#define RID_SVXITEMS_HYPHEN_LAST_WORD_TRUE NC_("RID_SVXITEMS_HYPHEN_NO_CAPS_FALSE", "Not hyphenated last word")
+#define RID_SVXITEMS_HYPHEN_MINWORDLEN NC_("RID_SVXITEMS_HYPHEN_MINWORDLEN", "%1 characters in words")
+#define RID_SVXITEMS_HYPHEN_ZONE NC_("RID_SVXITEMS_HYPHEN_ZONE", "Hyphenation zone ")
+#define RID_SVXITEMS_PAGEMODEL_COMPLETE NC_("RID_SVXITEMS_PAGEMODEL_COMPLETE", "Page Style: ")
+#define RID_SVXITEMS_KERNING_COMPLETE NC_("RID_SVXITEMS_KERNING_COMPLETE", "Kerning ")
+#define RID_SVXITEMS_KERNING_EXPANDED NC_("RID_SVXITEMS_KERNING_EXPANDED", "locked ")
+#define RID_SVXITEMS_KERNING_CONDENSED NC_("RID_SVXITEMS_KERNING_CONDENSED", "Condensed ")
+#define RID_SVXITEMS_GRAPHIC NC_("RID_SVXITEMS_GRAPHIC", "Graphic")
+#define RID_SVXITEMS_EMPHASIS_NONE_STYLE NC_("RID_SVXITEMS_EMPHASIS_NONE_STYLE", "none")
+#define RID_SVXITEMS_EMPHASIS_DOT_STYLE NC_("RID_SVXITEMS_EMPHASIS_DOT_STYLE", "Dots ")
+#define RID_SVXITEMS_EMPHASIS_CIRCLE_STYLE NC_("RID_SVXITEMS_EMPHASIS_CIRCLE_STYLE", "Circle ")
+// ??? disc == filled ring
+#define RID_SVXITEMS_EMPHASIS_DISC_STYLE NC_("RID_SVXITEMS_EMPHASIS_DISC_STYLE", "Filled circle ")
+#define RID_SVXITEMS_EMPHASIS_ACCENT_STYLE NC_("RID_SVXITEMS_EMPHASIS_ACCENT_STYLE", "Accent ")
+#define RID_SVXITEMS_EMPHASIS_ABOVE_POS NC_("RID_SVXITEMS_EMPHASIS_ABOVE_POS", "Above")
+#define RID_SVXITEMS_EMPHASIS_BELOW_POS NC_("RID_SVXITEMS_EMPHASIS_BELOW_POS", "Below")
+#define RID_SVXITEMS_TWOLINES_OFF NC_("RID_SVXITEMS_TWOLINES_OFF", "Double-lined off")
+#define RID_SVXITEMS_TWOLINES NC_("RID_SVXITEMS_TWOLINES", "Double-lined")
+#define RID_SVXITEMS_SCRPTSPC_OFF NC_("RID_SVXITEMS_SCRPTSPC_OFF", "No automatic character spacing")
+#define RID_SVXITEMS_SCRPTSPC_ON NC_("RID_SVXITEMS_SCRPTSPC_ON", "No automatic character spacing")
+#define RID_SVXITEMS_HNGPNCT_OFF NC_("RID_SVXITEMS_HNGPNCT_OFF", "No hanging punctuation at line end")
+#define RID_SVXITEMS_HNGPNCT_ON NC_("RID_SVXITEMS_HNGPNCT_ON", "Hanging punctuation at line end")
+#define RID_SVXITEMS_FORBIDDEN_RULE_OFF NC_("RID_SVXITEMS_FORBIDDEN_RULE_OFF", "Apply list of forbidden characters to beginning and end of lines")
+#define RID_SVXITEMS_FORBIDDEN_RULE_ON NC_("RID_SVXITEMS_FORBIDDEN_RULE_ON", "Don't apply list of forbidden characters to beginning and end of lines")
+#define RID_SVXITEMS_CHARROTATE_OFF NC_("RID_SVXITEMS_CHARROTATE_OFF", "No rotated characters")
+#define RID_SVXITEMS_CHARROTATE NC_("RID_SVXITEMS_CHARROTATE", "Character rotated by $(ARG1)°")
+#define RID_SVXITEMS_CHARROTATE_FITLINE NC_("RID_SVXITEMS_CHARROTATE_FITLINE", "Fit to line")
+#define RID_SVXITEMS_TEXTROTATE_OFF NC_("RID_SVXITEMS_TEXTROTATE_OFF", "Text is not rotated")
+#define RID_SVXITEMS_TEXTROTATE NC_("RID_SVXITEMS_TEXTROTATE", "Text is rotated by $(ARG1)°")
+#define RID_SVXITEMS_CHARSCALE NC_("RID_SVXITEMS_CHARSCALE", "Characters scaled $(ARG1)%")
+#define RID_SVXITEMS_CHARSCALE_OFF NC_("RID_SVXITEMS_CHARSCALE_OFF", "No scaled characters")
+#define RID_SVXITEMS_RELIEF_NONE NC_("RID_SVXITEMS_RELIEF_NONE", "No relief")
+#define RID_SVXITEMS_RELIEF_EMBOSSED NC_("RID_SVXITEMS_RELIEF_EMBOSSED", "Relief")
+#define RID_SVXITEMS_RELIEF_ENGRAVED NC_("RID_SVXITEMS_RELIEF_ENGRAVED", "Engraved")
+#define RID_SVXITEMS_PARAVERTALIGN_AUTO NC_("RID_SVXITEMS_PARAVERTALIGN_AUTO", "Automatic text alignment")
+#define RID_SVXITEMS_PARAVERTALIGN_BASELINE NC_("RID_SVXITEMS_PARAVERTALIGN_BASELINE", "Text aligned to base line")
+#define RID_SVXITEMS_PARAVERTALIGN_TOP NC_("RID_SVXITEMS_PARAVERTALIGN_TOP", "Text aligned top")
+#define RID_SVXITEMS_PARAVERTALIGN_CENTER NC_("RID_SVXITEMS_PARAVERTALIGN_CENTER", "Text aligned middle")
+#define RID_SVXITEMS_PARAVERTALIGN_BOTTOM NC_("RID_SVXITEMS_PARAVERTALIGN_BOTTOM", "Text aligned bottom")
+#define RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP NC_("RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP", "Text direction left-to-right (horizontal)")
+#define RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP NC_("RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP", "Text direction right-to-left (horizontal)")
+#define RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT NC_("RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT", "Text direction right-to-left (vertical)")
+#define RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT NC_("RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT", "Text direction left-to-right (vertical)")
+#define RID_SVXITEMS_FRMDIR_ENVIRONMENT NC_("RID_SVXITEMS_FRMDIR_ENVIRONMENT", "Use superordinate object text direction setting")
+#define RID_SVXITEMS_FRMDIR_VERT_BOT_LEFT NC_("RID_SVXITEMS_FRMDIR_VERT_BOT_LEFT", "Text direction left-to-right (vertical from bottom)")
+#define RID_SVXITEMS_PARASNAPTOGRID_ON NC_("RID_SVXITEMS_PARASNAPTOGRID_ON", "Paragraph snaps to text grid (if active)")
+#define RID_SVXITEMS_PARASNAPTOGRID_OFF NC_("RID_SVXITEMS_PARASNAPTOGRID_OFF", "Paragraph does not snap to text grid")
+#define RID_SVXITEMS_CHARHIDDEN_FALSE NC_("RID_SVXITEMS_CHARHIDDEN_FALSE", "Not hidden")
+#define RID_SVXITEMS_CHARHIDDEN_TRUE NC_("RID_SVXITEMS_CHARHIDDEN_TRUE", "Hidden")
+
+#define RID_SVXSTR_PAPERBIN NC_("RID_SVXSTR_PAPERBIN", "Paper tray")
+#define RID_SVXSTR_PAPERBIN_SETTINGS NC_("RID_SVXSTR_PAPERBIN_SETTINGS", "[From printer settings]")
+
+#define RID_EDITUNDO_DEL NC_("RID_EDITUNDO_DEL", "Delete")
+#define RID_EDITUNDO_MOVE NC_("RID_EDITUNDO_MOVE", "Move")
+#define RID_EDITUNDO_INSERT NC_("RID_EDITUNDO_INSERT", "Insert")
+#define RID_EDITUNDO_REPLACE NC_("RID_EDITUNDO_REPLACE", "Replace")
+#define RID_EDITUNDO_SETATTRIBS NC_("RID_EDITUNDO_SETATTRIBS", "Apply attributes")
+#define RID_EDITUNDO_RESETATTRIBS NC_("RID_EDITUNDO_RESETATTRIBS", "Reset attributes")
+#define RID_EDITUNDO_INDENT NC_("RID_EDITUNDO_INDENT", "Indent")
+#define RID_EDITUNDO_SETSTYLE NC_("RID_EDITUNDO_SETSTYLE", "Apply Styles")
+#define RID_EDITUNDO_TRANSLITERATE NC_("RID_EDITUNDO_TRANSLITERATE", "Change Case")
+#define RID_STR_WORD NC_("RID_STR_WORD", "Word is %x")
+#define RID_STR_PARAGRAPH NC_("RID_STR_PARAGRAPH", "Paragraph is %x")
+#define RID_SVXSTR_AUTOMATIC NC_("RID_SVXSTR_AUTOMATIC", "Automatic")
+
+#define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION NC_("RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION", "Image bullet in paragraph")
+#define RID_SVXSTR_A11Y_IMAGEBULLET_NAME NC_("RID_SVXSTR_A11Y_IMAGEBULLET_NAME", "Image bullet")
+#define RID_SVXSTR_A11Y_PARAGRAPH_DESCRIPTION NC_("RID_SVXSTR_A11Y_PARAGRAPH_DESCRIPTION", "Paragraph: $(ARG) ")
+
+#define RID_SVXSTR_QUERY_CONTINUE NC_("RID_SVXSTR_QUERY_CONTINUE", "Continue checking at beginning of document?")
+#define RID_SVXSTR_QUERY_BW_CONTINUE NC_("RID_SVXSTR_QUERY_BW_CONTINUE", "Continue checking at end of document?")
+#define RID_SVXSTR_DIC_ERR_UNKNOWN NC_("RID_SVXSTR_DIC_ERR_UNKNOWN", "Word cannot be added to dictionary\ndue to unknown reason.")
+#define RID_SVXSTR_DIC_ERR_FULL NC_("RID_SVXSTR_DIC_ERR_FULL", "The dictionary is already full.")
+#define RID_SVXSTR_DIC_ERR_READONLY NC_("RID_SVXSTR_DIC_ERR_READONLY", "The dictionary is read-only.")
+
+#define RID_OUTLUNDO_DEPTH NC_("RID_OUTLUNDO_DEPTH", "Indent")
+#define RID_OUTLUNDO_EXPAND NC_("RID_OUTLUNDO_EXPAND", "Show subpoints")
+#define RID_OUTLUNDO_COLLAPSE NC_("RID_OUTLUNDO_COLLAPSE", "Collapse")
+#define RID_OUTLUNDO_ATTR NC_("RID_OUTLUNDO_ATTR", "Apply attributes")
+#define RID_OUTLUNDO_INSERT NC_("RID_OUTLUNDO_INSERT", "Insert")
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx
new file mode 100644
index 000000000..eec50ea67
--- /dev/null
+++ b/include/editeng/editstat.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_EDITSTAT_HXX
+#define INCLUDED_EDITENG_EDITSTAT_HXX
+
+#include <rtl/ustring.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <utility>
+
+enum class EEControlBits
+{
+ NONE = 0x00000000,
+ USECHARATTRIBS = 0x00000001, // Use of hard character attributes
+ DOIDLEFORMAT = 0x00000008, // Formatting idle
+ PASTESPECIAL = 0x00000010, // Allow PasteSpecial
+ AUTOINDENTING = 0x00000020, // Automatic indenting
+ UNDOATTRIBS = 0x00000040, // Undo for Attributes...
+ ONECHARPERLINE = 0x00000080, // One character per line
+ NOCOLORS = 0x00000100, // Engine: No Color
+ OUTLINER = 0x00000200, // Special treatment Outliner/Outline mode
+ OUTLINER2 = 0x00000400, // Special treatment Outliner/Page
+ ALLOWBIGOBJS = 0x00000800, // Portion info in text object
+ ONLINESPELLING = 0x00001000, // During the edit Spelling
+ STRETCHING = 0x00002000, // Stretch mode
+ MARKNONURLFIELDS = 0x00004000, // Mark fields other than URL with color
+ MARKURLFIELDS = 0x00008000, // Mark URL fields with color
+ MARKFIELDS = (MARKNONURLFIELDS | MARKURLFIELDS),
+ RTFSTYLESHEETS = 0x00020000, // Use Stylesheets when imported
+ AUTOCORRECT = 0x00080000, // AutoCorrect
+ AUTOCOMPLETE = 0x00100000, // AutoComplete
+ AUTOPAGESIZEX = 0x00200000, // Adjust paper width to Text
+ AUTOPAGESIZEY = 0x00400000, // Adjust paper height to Text
+ AUTOPAGESIZE = (AUTOPAGESIZEX | AUTOPAGESIZEY),
+ FORMAT100 = 0x01000000, // Always format to 100%
+ ULSPACESUMMATION = 0x02000000, // MS Compat: sum SA and SB, not maximum value
+};
+namespace o3tl
+{
+ template<> struct typed_flags<EEControlBits> : is_typed_flags<EEControlBits, 0x037afff9> {};
+}
+
+enum class EVControlBits
+{
+ AUTOSCROLL = 0x0001, // Auto scrolling horizontally
+ ENABLEPASTE = 0x0004, // Enable Paste
+ SINGLELINEPASTE = 0x0008, // View: Paste in input line ...
+ OVERWRITE = 0x0010, // Overwrite mode
+ INVONEMORE = 0x0020, // Invalidate one pixel more
+ AUTOSIZEX = 0x0040, // Automatically adapt to text width
+ AUTOSIZEY = 0x0080, // Automatically adapt to Text width
+ AUTOSIZE = (AUTOSIZEX|AUTOSIZEY)
+};
+namespace o3tl
+{
+ template<> struct typed_flags<EVControlBits> : is_typed_flags<EVControlBits, 0xfd> {};
+}
+
+enum class EditStatusFlags
+{
+ NONE = 0x0000,
+ HSCROLL = 0x0001,
+ VSCROLL = 0x0002,
+ CURSOROUT = 0x0004,
+ TEXTWIDTHCHANGED = 0x0010,
+ TextHeightChanged = 0x0020,
+ WRONGWORDCHANGED = 0x0040
+};
+namespace o3tl
+{
+ template<> struct typed_flags<EditStatusFlags> : is_typed_flags<EditStatusFlags, 0x77> {};
+}
+
+inline void SetFlags( EVControlBits& rBits, EVControlBits nMask, bool bOn )
+{
+ if ( bOn )
+ rBits |= nMask;
+ else
+ rBits &= ~nMask;
+}
+
+class EditStatus
+{
+protected:
+ EditStatusFlags nStatusBits;
+ EEControlBits nControlBits;
+
+public:
+ EditStatus() { nStatusBits = EditStatusFlags::NONE; nControlBits = EEControlBits::NONE; }
+
+ void Clear() { nStatusBits = EditStatusFlags::NONE; }
+
+ EditStatusFlags GetStatusWord() const { return nStatusBits; }
+ EditStatusFlags& GetStatusWord() { return nStatusBits; }
+
+ EEControlBits& GetControlWord() { return nControlBits; }
+};
+
+enum class SpellCallbackCommand
+{
+ IGNOREWORD = 0x0001,
+ STARTSPELLDLG = 0x0002,
+ ADDTODICTIONARY = 0x0003,
+ WORDLANGUAGE = 0x0004,
+ PARALANGUAGE = 0x0005,
+ AUTOCORRECT_OPTIONS = 0x0006,
+};
+
+struct SpellCallbackInfo
+{
+ SpellCallbackCommand nCommand;
+ OUString aWord;
+
+ SpellCallbackInfo( SpellCallbackCommand nCMD, OUString _aWord )
+ : aWord(std::move( _aWord ))
+ {
+ nCommand = nCMD;
+ }
+
+ SpellCallbackInfo( SpellCallbackCommand nCMD )
+ {
+ nCommand = nCMD;
+ }
+};
+
+#endif // INCLUDED_EDITENG_EDITSTAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editund2.hxx b/include/editeng/editund2.hxx
new file mode 100644
index 000000000..3f6975a3a
--- /dev/null
+++ b/include/editeng/editund2.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_EDITUND2_HXX
+#define INCLUDED_EDITENG_EDITUND2_HXX
+
+#include <editeng/editengdllapi.h>
+#include <svl/undo.hxx>
+
+class EditEngine;
+
+class EDITENG_DLLPUBLIC EditUndoManager : public SfxUndoManager
+{
+ using SfxUndoManager::Undo;
+ using SfxUndoManager::Redo;
+ friend class ImpEditEngine;
+
+ EditEngine* mpEditEngine;
+ void SetEditEngine(EditEngine* pNew);
+
+public:
+ EditUndoManager(sal_uInt16 nMaxUndoActionCount = 20);
+
+ virtual bool Undo() override;
+ virtual bool Redo() override;
+};
+
+// EditUndo
+
+class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction
+{
+private:
+ sal_uInt16 nId;
+ ViewShellId mnViewShellId;
+ EditEngine* mpEditEngine;
+
+public:
+ EditUndo(sal_uInt16 nI, EditEngine* pEE);
+ virtual ~EditUndo() override;
+
+ EditEngine* GetEditEngine() { return mpEditEngine; }
+
+ virtual void Undo() override = 0;
+ virtual void Redo() override = 0;
+
+ virtual bool CanRepeat(SfxRepeatTarget&) const override;
+ virtual OUString GetComment() const override;
+ /// See SfxUndoAction::GetViewShellId().
+ ViewShellId GetViewShellId() const override;
+ sal_uInt16 GetId() const;
+};
+
+#endif // INCLUDED_EDITENG_EDITUND2_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
new file mode 100644
index 000000000..4f312b578
--- /dev/null
+++ b/include/editeng/editview.hxx
@@ -0,0 +1,382 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+// MyEDITVIEW, due to exported EditView
+#ifndef INCLUDED_EDITENG_EDITVIEW_HXX
+#define INCLUDED_EDITENG_EDITVIEW_HXX
+
+#include <memory>
+#include <com/sun/star/i18n/WordType.hpp>
+
+#include <i18nlangtag/lang.h>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include <vcl/errcode.hxx>
+#include <vcl/vclptr.hxx>
+#include <editeng/editstat.hxx>
+#include <editeng/flditem.hxx>
+#include <svl/languageoptions.hxx>
+#include <editeng/editdata.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <editeng/editengdllapi.h>
+
+
+class EditTextObject;
+class EditEngine;
+class ImpEditEngine;
+class ImpEditView;
+class OutlinerViewShell;
+class SvxSearchItem;
+class SvxFieldItem;
+namespace vcl { class Window; }
+namespace weld { class Widget; }
+class KeyEvent;
+class MouseEvent;
+class CommandEvent;
+class SvStream;
+class SvKeyValueIterator;
+class SfxStyleSheet;
+class SfxItemSet;
+namespace vcl { class Cursor; }
+namespace vcl { class Font; }
+class FontList;
+class InputContext;
+class OutputDevice;
+enum class TransliterationFlags;
+enum class PointerStyle;
+
+namespace com {
+namespace sun {
+namespace star {
+namespace datatransfer {
+ class XTransferable;
+ namespace clipboard {
+ class XClipboard;
+ }
+ namespace dnd {
+ class XDropTarget;
+ }
+}
+namespace linguistic2 {
+ class XSpellChecker1;
+ class XLanguageGuessing;
+}
+}}}
+
+template <typename Arg, typename Ret> class Link;
+
+enum class ScrollRangeCheck
+{
+ NoNegative = 1, // No negative VisArea when scrolling
+ PaperWidthTextSize = 2, // VisArea must be within paper width, Text Size
+};
+
+// Helper class that allows to set a callback at the EditView. When
+// set, Invalidates and repaints are suppressed at the EditView, but
+// EditViewInvalidate() will be triggered to allow the consumer to
+// react itself as needed.
+// Also Selection visualization is suppressed and EditViewSelectionChange
+// is triggered when Selection changes and needs reaction.
+class EDITENG_DLLPUBLIC EditViewCallbacks
+{
+public:
+ virtual ~EditViewCallbacks();
+
+ // call this when text visualization changed in any way. It
+ // will also update selection, so no need to call this self
+ // additionally (but will also do no harm)
+ virtual void EditViewInvalidate(const tools::Rectangle& rRect) = 0;
+
+ // call this when only selection is changed. Text change will
+ // then *not* be checked and not be reacted on. Still, when
+ // only the selection is changed, this is useful and faster
+ virtual void EditViewSelectionChange() = 0;
+
+ // return the OutputDevice that the EditView will draw to
+ virtual OutputDevice& EditViewOutputDevice() const = 0;
+
+ virtual weld::Widget* EditViewPopupParent() const
+ {
+ return nullptr;
+ }
+
+ // return the Mouse Position
+ virtual Point EditViewPointerPosPixel() const = 0;
+
+ // Triggered to update InputEngine context information
+ virtual void EditViewInputContext(const InputContext& rInputContext) = 0;
+
+ // Triggered to update InputEngine cursor position
+ virtual void EditViewCursorRect(const tools::Rectangle& rRect, int nExtTextInputWidth) = 0;
+
+ // Triggered if scroll bar state should change
+ virtual void EditViewScrollStateChange()
+ {
+ }
+
+ // Access to clipboard
+ virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const = 0;
+
+ // implemented if drag and drop support is wanted
+ virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget()
+ {
+ return nullptr;
+ }
+};
+
+class EDITENG_DLLPUBLIC EditView final
+{
+ friend class EditEngine;
+ friend class ImpEditEngine;
+ friend class EditSelFunctionSet;
+
+public:
+ typedef std::vector<VclPtr<vcl::Window>> OutWindowSet;
+
+public: // Needed for Undo
+ ImpEditView* GetImpEditView() const { return pImpEditView.get(); }
+ ImpEditEngine* GetImpEditEngine() const;
+
+private:
+ std::unique_ptr<ImpEditView>
+ pImpEditView;
+ OUString aDicNameSingle;
+
+ EditView( const EditView& ) = delete;
+ EditView& operator=( const EditView& ) = delete;
+
+public:
+ EditView( EditEngine* pEng, vcl::Window* pWindow );
+ ~EditView();
+
+ // set EditViewCallbacks for external handling of Repaints/Visualization
+ void setEditViewCallbacks(EditViewCallbacks* pEditViewCallbacks);
+ EditViewCallbacks* getEditViewCallbacks() const;
+
+ void SetEditEngine( EditEngine* pEditEngine );
+ EditEngine* GetEditEngine() const;
+
+ void SetWindow( vcl::Window* pWin );
+ vcl::Window* GetWindow() const;
+ OutputDevice& GetOutputDevice() const;
+
+ LanguageType GetInputLanguage() const;
+
+ bool HasOtherViewWindow( vcl::Window* pWin );
+ bool AddOtherViewWindow( vcl::Window* pWin );
+ bool RemoveOtherViewWindow( vcl::Window* pWin );
+
+ void Paint( const tools::Rectangle& rRect, OutputDevice* pTargetDevice = nullptr );
+ tools::Rectangle GetInvalidateRect() const;
+ void InvalidateWindow(const tools::Rectangle& rClipRect);
+ void InvalidateOtherViewWindows( const tools::Rectangle& rInvRect );
+ void Invalidate();
+ ::Pair Scroll( tools::Long nHorzScroll, tools::Long nVertScroll, ScrollRangeCheck nRangeCheck = ScrollRangeCheck::NoNegative );
+
+ void SetBroadcastLOKViewCursor(bool bSet);
+ tools::Rectangle GetEditCursor() const;
+ void ShowCursor( bool bGotoCursor = true, bool bForceVisCursor = true, bool bActivate = false );
+ void HideCursor( bool bDeactivate = false );
+
+ void SetSelectionMode( EESelectionMode eMode );
+
+ void SetReadOnly( bool bReadOnly );
+ bool IsReadOnly() const;
+
+ bool HasSelection() const;
+ ESelection GetSelection() const;
+ void SetSelection( const ESelection& rNewSel );
+ bool IsSelectionAtPoint(const Point& rPointPixel);
+ void SelectCurrentWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
+ /// Returns the rectangles of the current selection in TWIPs.
+ void GetSelectionRectangles(std::vector<tools::Rectangle>& rLogicRects) const;
+
+ bool IsInsertMode() const;
+ void SetInsertMode( bool bInsert );
+
+ OUString GetSelected() const;
+ void DeleteSelected();
+
+ SvtScriptType GetSelectedScriptType() const;
+
+ // VisArea position of the Output window.
+ // A size change also affects the VisArea
+ void SetOutputArea( const tools::Rectangle& rRect );
+ const tools::Rectangle& GetOutputArea() const;
+
+ // Document position.
+ // A size change also affects the VisArea
+ void SetVisArea( const tools::Rectangle& rRect );
+ tools::Rectangle GetVisArea() const;
+
+ PointerStyle GetPointer() const;
+
+ vcl::Cursor* GetCursor() const;
+
+ void InsertText( const OUString& rNew, bool bSelect = false , bool bLOKShowSelect = true);
+ void InsertParaBreak();
+
+ bool PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * pFrameWin = nullptr );
+
+ bool MouseButtonUp( const MouseEvent& rMouseEvent );
+ bool MouseButtonDown( const MouseEvent& rMouseEvent );
+ void ReleaseMouse();
+ bool MouseMove( const MouseEvent& rMouseEvent );
+ bool Command(const CommandEvent& rCEvt);
+
+ void Cut();
+ void Copy();
+ void Paste();
+ void PasteSpecial();
+
+ void Undo();
+ void Redo();
+
+ // especially for Oliver Specht
+ Point GetWindowPosTopLeft( sal_Int32 nParagraph );
+ void MoveParagraphs( Range aParagraphs, sal_Int32 nNewPos );
+ void MoveParagraphs( tools::Long nDiff );
+
+ const SfxItemSet& GetEmptyItemSet() const;
+ SfxItemSet GetAttribs();
+ void SetAttribs( const SfxItemSet& rSet );
+ void RemoveAttribs( bool bRemoveParaAttribs = false, sal_uInt16 nWhich = 0 );
+ void RemoveAttribs( EERemoveParaAttribsMode eMode, sal_uInt16 nWhich );
+ void RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich );
+ void RemoveAttribsKeepLanguages( bool bRemoveParaAttribs );
+
+ ErrCode Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs );
+
+ void SetBackgroundColor( const Color& rColor );
+ Color const & GetBackgroundColor() const;
+
+ /// Informs this edit view about which view shell contains it.
+ void RegisterViewShell(OutlinerViewShell* pViewShell);
+ /// Informs this edit view about which other shell listens to it.
+ void RegisterOtherShell(OutlinerViewShell* pOtherShell);
+
+ void SetControlWord( EVControlBits nWord );
+ EVControlBits GetControlWord() const;
+
+ std::unique_ptr<EditTextObject> CreateTextObject();
+ void InsertText( const EditTextObject& rTextObject );
+ void InsertText( css::uno::Reference< css::datatransfer::XTransferable > const & xDataObj, const OUString& rBaseURL, bool bUseSpecial );
+
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const;
+ css::uno::Reference<css::datatransfer::XTransferable> GetTransferable() const;
+
+ // An EditView, so that when TRUE the update will be free from flickering:
+ // @return the previous bUpdateLayout state
+ bool SetEditEngineUpdateLayout( bool bUpdate );
+ void ForceLayoutCalculation();
+
+ const SfxStyleSheet* GetStyleSheet() const;
+ SfxStyleSheet* GetStyleSheet();
+
+ void SetAnchorMode( EEAnchorMode eMode );
+ EEAnchorMode GetAnchorMode() const;
+
+ void CompleteAutoCorrect( vcl::Window const * pFrameWin = nullptr );
+
+ EESpellState StartSpeller(weld::Widget* pDialogParent, bool bMultipleDoc = false);
+ EESpellState StartThesaurus(weld::Widget* pDialogParent);
+ sal_Int32 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
+
+ // for text conversion
+ void StartTextConversion(weld::Widget* pDialogParent, LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc);
+
+ void TransliterateText( TransliterationFlags nTransliterationMode );
+
+ bool IsCursorAtWrongSpelledWord();
+ bool IsWrongSpelledWordAtPos( const Point& rPosPixel, bool bMarkIfWrong = false );
+ bool ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void>& rCallBack);
+ OUString SpellIgnoreWord();
+
+ void InsertField( const SvxFieldItem& rFld );
+ const SvxFieldItem* GetFieldUnderMousePointer() const;
+ const SvxFieldItem* GetFieldUnderMousePointer( sal_Int32& nPara, sal_Int32& nPos ) const;
+ const SvxFieldItem* GetField( const Point& rPos, sal_Int32* pnPara = nullptr, sal_Int32* pnPos = nullptr ) const;
+
+ const SvxFieldItem* GetFieldAtSelection() const;
+ /// Select and return the field at the current cursor position
+ const SvxFieldData* GetFieldAtCursor() const;
+ void SelectFieldAtCursor();
+
+ void SetInvalidateMore( sal_uInt16 nPixel );
+ sal_uInt16 GetInvalidateMore() const;
+
+ // grows or shrinks the font height for the current selection
+ void ChangeFontSize( bool bGrow, const FontList* pList );
+
+ static bool ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList );
+
+ OUString GetSurroundingText() const;
+ Selection GetSurroundingTextSelection() const;
+ bool DeleteSurroundingText(const Selection& rRange);
+
+ /** Tries to determine the language of 'rText', returning a matching known
+ locale if possible, or a fallback, or LANGUAGE_NONE if nothing found or
+ matched.
+
+ @param bIsParaText
+ If TRUE, rText is a paragraph and the language is obtained by
+ passing the text to xLangGuess.
+ IF FALSE, a language match is tried for, in order,
+ 1. the default document language (non-CTL, non-CJK, aka LATIN)
+ 2. the UI language (Tools->Options->LanguageSettings->Languages User Interface)
+ 3. the locale (Tools->Options->LanguageSettings->Languages Locale)
+ 4. en-US
+ If nothing matched, LANGUAGE_NONE is returned.
+ */
+ static LanguageType CheckLanguage(
+ const OUString &rText,
+ const css::uno::Reference< css::linguistic2::XSpellChecker1 >& xSpell,
+ const css::uno::Reference< css::linguistic2::XLanguageGuessing >& xLangGuess,
+ bool bIsParaText );
+ /// Allows adjusting the point or mark of the selection to a document coordinate.
+ void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark);
+ /// Trigger selection drawing callback in pOtherShell based on our shell's selection state.
+ void DrawSelectionXOR(OutlinerViewShell* pOtherShell);
+
+ /**
+ * This is meant for Calc(LOK), but there may be other use-cases.
+ * In Calc, all logical positions are computed by
+ * doing independent pixel-alignment for each cell's size. The *LOKSpecial* methods
+ * can be used to set/get the output-area and visible-area in real logical
+ * units. This enables EditView to send cursor/selection messages in
+ * real logical units like it is done for Writer.
+ */
+ void InitLOKSpecialPositioning(MapUnit eUnit, const tools::Rectangle& rOutputArea,
+ const Point& rVisDocStartPos);
+ void SetLOKSpecialOutputArea(const tools::Rectangle& rOutputArea);
+ const tools::Rectangle & GetLOKSpecialOutputArea() const;
+ void SetLOKSpecialVisArea(const tools::Rectangle& rVisArea);
+ tools::Rectangle GetLOKSpecialVisArea() const;
+ bool HasLOKSpecialPositioning() const;
+
+ void SuppressLOKMessages(bool bSet);
+ bool IsSuppressLOKMessages() const;
+
+ /// To inform editeng that negated x document coordinates are in use.
+ void SetNegativeX(bool bSet);
+ bool IsNegativeX() const;
+};
+
+#endif // INCLUDED_EDITENG_EDITVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/edtdlg.hxx b/include/editeng/edtdlg.hxx
new file mode 100644
index 000000000..68783dc2d
--- /dev/null
+++ b/include/editeng/edtdlg.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_EDTDLG_HXX
+#define INCLUDED_EDITENG_EDTDLG_HXX
+
+#include <rtl/ustring.hxx>
+#include <editeng/editengdllapi.h>
+#include <i18nlangtag/lang.h>
+#include <vcl/abstdlg.hxx>
+#include <editeng/hangulhanja.hxx>
+
+namespace com::sun::star::linguistic2
+{
+ class XThesaurus;
+ class XHyphenator;
+}
+
+template <typename Arg, typename Ret> class Link;
+
+class SvxSpellWrapper;
+class LinkParamNone;
+
+namespace weld { class Button; }
+namespace weld { class Toggleable; }
+
+class AbstractThesaurusDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractThesaurusDialog() override = default;
+public:
+ virtual OUString GetWord() = 0;
+};
+
+class AbstractHyphenWordDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractHyphenWordDialog() override = default;
+};
+
+class AbstractHangulHanjaConversionDialog : public VclAbstractTerminatedDialog
+{
+protected:
+ virtual ~AbstractHangulHanjaConversionDialog() override = default;
+public:
+ virtual void EnableRubySupport( bool _bVal ) = 0;
+ virtual void SetByCharacter( bool _bByCharacter ) = 0;
+ virtual void SetConversionDirectionState( bool _bTryBothDirections, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection ) = 0;
+ virtual void SetConversionFormat( editeng::HangulHanjaConversion::ConversionFormat _eType ) = 0;
+ virtual void SetOptionsChangedHdl( const Link<LinkParamNone*,void>& _rHdl ) = 0;
+ virtual void SetIgnoreHdl( const Link<weld::Button&,void>& _rHdl ) = 0;
+ virtual void SetIgnoreAllHdl( const Link<weld::Button&,void>& _rHdl ) = 0;
+ virtual void SetChangeHdl( const Link<weld::Button&,void>& _rHdl ) = 0;
+ virtual void SetChangeAllHdl( const Link<weld::Button&,void>& _rHdl ) = 0;
+ virtual void SetClickByCharacterHdl( const Link<weld::Toggleable&,void>& _rHdl ) = 0;
+ virtual void SetConversionFormatChangedHdl( const Link<weld::Toggleable&,void>& _rHdl ) = 0;
+ virtual void SetFindHdl( const Link<weld::Button&,void>& _rHdl ) = 0;
+ virtual bool GetUseBothDirections() const= 0;
+ virtual editeng::HangulHanjaConversion::ConversionDirection
+ GetDirection( editeng::HangulHanjaConversion::ConversionDirection _eDefaultDirection ) const = 0;
+ virtual void SetCurrentString(
+ const OUString& _rNewString,
+ const css::uno::Sequence< OUString >& _rSuggestions,
+ bool _bOriginatesFromDocument = true )=0;
+ virtual OUString GetCurrentString( ) const =0;
+ virtual editeng::HangulHanjaConversion::ConversionFormat
+ GetConversionFormat( ) const =0;
+ virtual void FocusSuggestion( )= 0;
+ virtual OUString GetCurrentSuggestion( ) const =0;
+};
+
+class EDITENG_DLLPUBLIC EditAbstractDialogFactory : virtual public VclAbstractDialogFactory
+{
+public:
+ virtual ~EditAbstractDialogFactory() override; // needed for export of vtable
+ static EditAbstractDialogFactory* Create();
+ virtual VclPtr<AbstractThesaurusDialog> CreateThesaurusDialog(weld::Widget*,
+ css::uno::Reference<css::linguistic2::XThesaurus> xThesaurus,
+ const OUString &rWord, LanguageType nLanguage) = 0;
+
+ virtual VclPtr<AbstractHyphenWordDialog> CreateHyphenWordDialog(weld::Widget*,
+ const OUString &rWord, LanguageType nLang,
+ css::uno::Reference< css::linguistic2::XHyphenator > &xHyphen,
+ SvxSpellWrapper* pWrapper) = 0;
+ virtual VclPtr<AbstractHangulHanjaConversionDialog> CreateHangulHanjaConversionDialog(weld::Widget* pParent) = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/eedata.hxx b/include/editeng/eedata.hxx
new file mode 100644
index 000000000..ad0ab7b13
--- /dev/null
+++ b/include/editeng/eedata.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_EEDATA_HXX
+#define INCLUDED_EDITENG_EEDATA_HXX
+
+
+// extended data definitions for EditEngine portion stripping (StripPortions()
+// support). These may be mapped to some primitive definitions from Drawinglayer
+// later.
+#include <vector>
+
+#include <sal/types.h>
+
+namespace EEngineData
+{
+ // spell checking wrong vector containing the redlining data
+ class WrongSpellClass
+ {
+ public:
+ sal_Int32 nStart;
+ sal_Int32 nEnd;
+
+ WrongSpellClass(sal_Int32 nS, sal_Int32 nE) : nStart(nS), nEnd(nE) {}
+ };
+
+ typedef std::vector< WrongSpellClass > WrongSpellVector;
+
+} // end of namespace EditEngine
+
+#endif // INCLUDED_EDITENG_EEDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/eeitem.hxx b/include/editeng/eeitem.hxx
new file mode 100644
index 000000000..f86224486
--- /dev/null
+++ b/include/editeng/eeitem.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_EEITEM_HXX
+#define INCLUDED_EDITENG_EEITEM_HXX
+
+#include <svl/solar.hrc>
+#include <svl/typedwhich.hxx>
+
+class SfxBoolItem;
+class SfxGrabBagItem;
+class SfxInt16Item;
+class SvxAdjustItem;
+class SvxAutoKernItem;
+class SvxCaseMapItem;
+class SvxCharReliefItem;
+class SvxCharScaleWidthItem;
+class SvxColorItem;
+class SvxContourItem;
+class SvxCrossedOutItem;
+class SvxEmphasisMarkItem;
+class SvxEscapementItem;
+class SvxFieldItem;
+class SvxFontHeightItem;
+class SvxFontItem;
+class SvxForbiddenRuleItem;
+class SvxFrameDirectionItem;
+class SvxHangingPunctuationItem;
+class SvxKerningItem;
+class SvxLanguageItem;
+class SvxLineSpacingItem;
+class SvxLRSpaceItem;
+class SvxOverlineItem;
+class SvxPostureItem;
+class SvXMLAttrContainerItem;
+class SvxScriptSpaceItem;
+class SvxShadowedItem;
+class SvxTabStopItem;
+class SvxULSpaceItem;
+class SvxUnderlineItem;
+class SvxWeightItem;
+class SvxWordLineModeItem;
+class SvxBulletItem;
+class SvxNumBulletItem;
+class SvxJustifyMethodItem;
+class SvxVerJustifyItem;
+class SfxVoidItem;
+
+/*
+ * NOTE: Changes in this file will probably require
+ * consistent changes in eerdll.cxx and editdoc.cxx
+ * as well.
+*/
+
+constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END + 1);
+
+// Paragraph attributes:
+constexpr sal_uInt16 EE_PARA_START (EE_ITEMS_START + 0);
+constexpr TypedWhichId<SvxFrameDirectionItem> EE_PARA_WRITINGDIR (EE_PARA_START+0);
+constexpr TypedWhichId<SvXMLAttrContainerItem> EE_PARA_XMLATTRIBS (EE_PARA_START+1);
+constexpr TypedWhichId<SvxHangingPunctuationItem> EE_PARA_HANGINGPUNCTUATION (EE_PARA_START+2);
+constexpr TypedWhichId<SvxForbiddenRuleItem> EE_PARA_FORBIDDENRULES (EE_PARA_START+3);
+constexpr TypedWhichId<SvxScriptSpaceItem> EE_PARA_ASIANCJKSPACING (EE_PARA_START+4);
+constexpr TypedWhichId<SvxNumBulletItem> EE_PARA_NUMBULLET (EE_PARA_START+5);
+constexpr TypedWhichId<SfxBoolItem> EE_PARA_HYPHENATE (EE_PARA_START+6);
+constexpr TypedWhichId<SfxBoolItem> EE_PARA_HYPHENATE_NO_CAPS (EE_PARA_START+7);
+constexpr TypedWhichId<SfxBoolItem> EE_PARA_HYPHENATE_NO_LAST_WORD (EE_PARA_START+8);
+constexpr TypedWhichId<SfxBoolItem> EE_PARA_BULLETSTATE (EE_PARA_START+9);
+constexpr TypedWhichId<SvxLRSpaceItem> EE_PARA_OUTLLRSPACE (EE_PARA_START+10);
+constexpr TypedWhichId<SfxInt16Item> EE_PARA_OUTLLEVEL (EE_PARA_START+11);
+constexpr TypedWhichId<SvxBulletItem> EE_PARA_BULLET (EE_PARA_START+12);
+constexpr TypedWhichId<SvxLRSpaceItem> EE_PARA_LRSPACE (EE_PARA_START+13);
+constexpr TypedWhichId<SvxULSpaceItem> EE_PARA_ULSPACE (EE_PARA_START+14);
+constexpr TypedWhichId<SvxLineSpacingItem> EE_PARA_SBL (EE_PARA_START+15);
+constexpr TypedWhichId<SvxAdjustItem> EE_PARA_JUST (EE_PARA_START+16);
+constexpr TypedWhichId<SvxTabStopItem> EE_PARA_TABS (EE_PARA_START+17);
+constexpr TypedWhichId<SvxJustifyMethodItem> EE_PARA_JUST_METHOD (EE_PARA_START+18);
+constexpr TypedWhichId<SvxVerJustifyItem> EE_PARA_VER_JUST (EE_PARA_START+19);
+constexpr sal_uInt16 EE_PARA_END (EE_PARA_START + 19);
+
+// Character attributes:
+constexpr sal_uInt16 EE_CHAR_START (EE_PARA_END + 1);
+constexpr TypedWhichId<SvxColorItem> EE_CHAR_COLOR (EE_CHAR_START+0);
+constexpr TypedWhichId<SvxFontItem> EE_CHAR_FONTINFO (EE_CHAR_START+1);
+constexpr TypedWhichId<SvxFontHeightItem> EE_CHAR_FONTHEIGHT (EE_CHAR_START+2);
+constexpr TypedWhichId<SvxCharScaleWidthItem> EE_CHAR_FONTWIDTH (EE_CHAR_START+3);
+constexpr TypedWhichId<SvxWeightItem> EE_CHAR_WEIGHT (EE_CHAR_START+4);
+constexpr TypedWhichId<SvxUnderlineItem> EE_CHAR_UNDERLINE (EE_CHAR_START+5);
+constexpr TypedWhichId<SvxCrossedOutItem> EE_CHAR_STRIKEOUT (EE_CHAR_START+6);
+constexpr TypedWhichId<SvxPostureItem> EE_CHAR_ITALIC (EE_CHAR_START+7);
+constexpr TypedWhichId<SvxContourItem> EE_CHAR_OUTLINE (EE_CHAR_START+8);
+constexpr TypedWhichId<SvxShadowedItem> EE_CHAR_SHADOW (EE_CHAR_START+9);
+constexpr TypedWhichId<SvxEscapementItem> EE_CHAR_ESCAPEMENT (EE_CHAR_START+10);
+constexpr TypedWhichId<SvxAutoKernItem> EE_CHAR_PAIRKERNING (EE_CHAR_START+11);
+constexpr TypedWhichId<SvxKerningItem> EE_CHAR_KERNING (EE_CHAR_START+12);
+constexpr TypedWhichId<SvxWordLineModeItem> EE_CHAR_WLM (EE_CHAR_START+13);
+constexpr TypedWhichId<SvxLanguageItem> EE_CHAR_LANGUAGE (EE_CHAR_START+14);
+constexpr TypedWhichId<SvxLanguageItem> EE_CHAR_LANGUAGE_CJK (EE_CHAR_START+15);
+constexpr TypedWhichId<SvxLanguageItem> EE_CHAR_LANGUAGE_CTL (EE_CHAR_START+16);
+constexpr TypedWhichId<SvxFontItem> EE_CHAR_FONTINFO_CJK (EE_CHAR_START+17);
+constexpr TypedWhichId<SvxFontItem> EE_CHAR_FONTINFO_CTL (EE_CHAR_START+18);
+constexpr TypedWhichId<SvxFontHeightItem> EE_CHAR_FONTHEIGHT_CJK (EE_CHAR_START+19);
+constexpr TypedWhichId<SvxFontHeightItem> EE_CHAR_FONTHEIGHT_CTL (EE_CHAR_START+20);
+constexpr TypedWhichId<SvxWeightItem> EE_CHAR_WEIGHT_CJK (EE_CHAR_START+21);
+constexpr TypedWhichId<SvxWeightItem> EE_CHAR_WEIGHT_CTL (EE_CHAR_START+22);
+constexpr TypedWhichId<SvxPostureItem> EE_CHAR_ITALIC_CJK (EE_CHAR_START+23);
+constexpr TypedWhichId<SvxPostureItem> EE_CHAR_ITALIC_CTL (EE_CHAR_START+24);
+constexpr TypedWhichId<SvxEmphasisMarkItem> EE_CHAR_EMPHASISMARK (EE_CHAR_START+25);
+constexpr TypedWhichId<SvxCharReliefItem> EE_CHAR_RELIEF (EE_CHAR_START+26);
+constexpr TypedWhichId<SfxVoidItem> EE_CHAR_RUBI_DUMMY (EE_CHAR_START+27);
+constexpr TypedWhichId<SvXMLAttrContainerItem> EE_CHAR_XMLATTRIBS (EE_CHAR_START+28);
+constexpr TypedWhichId<SvxOverlineItem> EE_CHAR_OVERLINE (EE_CHAR_START+29);
+constexpr TypedWhichId<SvxCaseMapItem> EE_CHAR_CASEMAP (EE_CHAR_START+30);
+constexpr TypedWhichId<SfxGrabBagItem> EE_CHAR_GRABBAG (EE_CHAR_START+31);
+constexpr TypedWhichId<SvxColorItem> EE_CHAR_BKGCOLOR (EE_CHAR_START+32);
+
+constexpr sal_uInt16 EE_CHAR_END (EE_CHAR_START + 32);
+
+constexpr sal_uInt16 EE_FEATURE_START (EE_CHAR_END + 1);
+constexpr sal_uInt16 EE_FEATURE_TAB (EE_FEATURE_START + 0);
+constexpr sal_uInt16 EE_FEATURE_LINEBR (EE_FEATURE_TAB + 1);
+constexpr sal_uInt16 EE_FEATURE_NOTCONV (EE_FEATURE_LINEBR + 1);
+constexpr TypedWhichId<SvxFieldItem> EE_FEATURE_FIELD (EE_FEATURE_NOTCONV + 1);
+constexpr sal_uInt16 EE_FEATURE_END (EE_FEATURE_FIELD + 0);
+
+constexpr sal_uInt16 EE_ITEMS_END (EE_FEATURE_END);
+
+constexpr sal_uInt16 EDITITEMCOUNT (EE_ITEMS_END - EE_ITEMS_START + 1);
+
+#endif // _ INCLUDED_EDITENG_EEITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/eerdll.hxx b/include/editeng/eerdll.hxx
new file mode 100644
index 000000000..b77d6a0d4
--- /dev/null
+++ b/include/editeng/eerdll.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_EERDLL_HXX
+#define INCLUDED_EDITENG_EERDLL_HXX
+
+#include <editeng/editengdllapi.h>
+#include <rtl/ustring.hxx>
+#include <unotools/resmgr.hxx>
+#include <memory>
+
+class GlobalEditData;
+namespace editeng
+{
+class SharedVclResources;
+}
+
+OUString EDITENG_DLLPUBLIC EditResId(TranslateId aId);
+
+class EditDLL
+{
+ std::unique_ptr<GlobalEditData> pGlobalData;
+ std::weak_ptr<editeng::SharedVclResources> pSharedVcl;
+
+public:
+ EditDLL();
+ ~EditDLL();
+
+ GlobalEditData* GetGlobalData() const { return pGlobalData.get(); }
+ std::shared_ptr<editeng::SharedVclResources> GetSharedVclResources();
+ static EditDLL& Get();
+};
+
+#endif // INCLUDED_EDITENG_EERDLL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/emphasismarkitem.hxx b/include/editeng/emphasismarkitem.hxx
new file mode 100644
index 000000000..f54c85735
--- /dev/null
+++ b/include/editeng/emphasismarkitem.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_EMPHASISMARKITEM_HXX
+#define INCLUDED_EDITENG_EMPHASISMARKITEM_HXX
+
+#include <tools/fontenum.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxEmphasisMarkItem ----------------------------------------------
+
+/* [Description]
+
+ This item describes the Font emphasis.
+*/
+
+class EDITENG_DLLPUBLIC SvxEmphasisMarkItem final : public SfxUInt16Item
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxEmphasisMarkItem( const FontEmphasisMark eVal /*= FontEmphasisMark::NONE*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual SvxEmphasisMarkItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ // enum cast
+ FontEmphasisMark GetEmphasisMark() const
+ { return static_cast<FontEmphasisMark>(GetValue()); }
+};
+
+#endif // INCLUDED_EDITENG_EMPHASISMARKITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/escapementitem.hxx b/include/editeng/escapementitem.hxx
new file mode 100644
index 000000000..ea8f99e35
--- /dev/null
+++ b/include/editeng/escapementitem.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_ESCAPEMENTITEM_HXX
+#define INCLUDED_EDITENG_ESCAPEMENTITEM_HXX
+
+#include <svl/cenumitm.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxEscapementItem -----------------------------------------------
+
+#define DFLT_ESC_SUPER 33 // 42% (100 - DFLT_ESC_PROP) of ascent (~80% of font height) = 33% of total font height
+#define DFLT_ESC_SUB -8 // 42% of descent (~20% of font height) = -8%. previously -33% (pre-2020), previously 8/100 (pre-2000?)
+#define DFLT_ESC_PROP 58
+#define MAX_ESC_POS 13999
+#define DFLT_ESC_AUTO_SUPER (MAX_ESC_POS+1)
+#define DFLT_ESC_AUTO_SUB -DFLT_ESC_AUTO_SUPER
+
+/* [Description]
+
+ This item describes the writing position.
+*/
+
+class EDITENG_DLLPUBLIC SvxEscapementItem final : public SfxEnumItemInterface
+{
+ short nEsc;
+ sal_uInt8 nProp;
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxEscapementItem( const sal_uInt16 nId );
+ SvxEscapementItem( const SvxEscapement eEscape,
+ const sal_uInt16 nId );
+ SvxEscapementItem( const short nEsc, const sal_uInt8 nProp,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual SvxEscapementItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ void SetEscapement( const SvxEscapement eNew )
+ {
+ if( SvxEscapement::Off == eNew )
+ {
+ nEsc = 0;
+ nProp = 100;
+ }
+ else
+ {
+ nProp = DFLT_ESC_PROP;
+ if( SvxEscapement::Superscript == eNew )
+ nEsc = DFLT_ESC_SUPER;
+ else
+ nEsc = DFLT_ESC_SUB;
+ }
+ }
+ SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
+
+ short &GetEsc() { return nEsc; }
+ short GetEsc() const { return nEsc; }
+
+ sal_uInt8 &GetProportionalHeight() { return nProp; }
+ sal_uInt8 GetProportionalHeight() const { return nProp; }
+
+ virtual sal_uInt16 GetValueCount() const override;
+ static OUString GetValueTextByPos( sal_uInt16 nPos );
+ virtual sal_uInt16 GetEnumValue() const override;
+ virtual void SetEnumValue( sal_uInt16 nNewVal ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/fhgtitem.hxx b/include/editeng/fhgtitem.hxx
new file mode 100644
index 000000000..efaad86bd
--- /dev/null
+++ b/include/editeng/fhgtitem.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_FHGTITEM_HXX
+#define INCLUDED_EDITENG_FHGTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <tools/debug.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxFontHeightItem -----------------------------------------------
+
+// Warning: twips values
+
+/* [Description]
+
+ This item describes the font height
+*/
+
+constexpr sal_uInt16 FONTHEIGHT_16_VERSION = 0x0001;
+constexpr sal_uInt16 FONTHEIGHT_UNIT_VERSION = 0x0002;
+
+class EDITENG_DLLPUBLIC SvxFontHeightItem final : public SfxPoolItem
+{
+ sal_uInt32 nHeight;
+ sal_uInt16 nProp; // default 100%
+ MapUnit ePropUnit; // Percent, Twip, ...
+
+private:
+ friend void Create_legacy_direct_set(SvxFontHeightItem& rItem, sal_uInt32 nH, sal_uInt16 nP, MapUnit eP);
+ void legacy_direct_set(sal_uInt32 nH, sal_uInt16 nP, MapUnit eP) { nHeight = nH; nProp = nP; ePropUnit = eP; }
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxFontHeightItem( const sal_uInt32 nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxFontHeightItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
+ virtual bool HasMetrics() const override;
+
+ void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100,
+ MapUnit eUnit = MapUnit::MapRelative );
+
+ void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
+ MapUnit eUnit, MapUnit eCoreUnit );
+
+ sal_uInt32 GetHeight() const { return nHeight; }
+
+ void SetProp( sal_uInt16 nNewProp, MapUnit eUnit )
+ {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nProp = nNewProp;
+ ePropUnit = eUnit;
+ }
+
+ sal_uInt16 GetProp() const { return nProp; }
+
+ MapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ...
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/fieldupdater.hxx b/include/editeng/fieldupdater.hxx
new file mode 100644
index 000000000..e15754ffd
--- /dev/null
+++ b/include/editeng/fieldupdater.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_EDITENG_FIELDUPDATER_HXX
+#define INCLUDED_EDITENG_FIELDUPDATER_HXX
+
+#include <editeng/editengdllapi.h>
+#include <memory>
+
+class EditTextObject;
+
+namespace editeng
+{
+class FieldUpdaterImpl;
+
+/**
+ * Wrapper for EditTextObject to handle updating of fields without exposing
+ * the internals of EditTextObject structure.
+ */
+class EDITENG_DLLPUBLIC FieldUpdater
+{
+ std::unique_ptr<FieldUpdaterImpl> mpImpl;
+
+public:
+ FieldUpdater(EditTextObject& rObj);
+ FieldUpdater(const FieldUpdater& r);
+ ~FieldUpdater();
+
+ /**
+ * Set a new table ID to all table fields.
+ *
+ * @param nTab new table ID
+ */
+ void updateTableFields(int nTab);
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx
new file mode 100644
index 000000000..7dec33e9e
--- /dev/null
+++ b/include/editeng/flditem.hxx
@@ -0,0 +1,438 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_FLDITEM_HXX
+#define INCLUDED_EDITENG_FLDITEM_HXX
+
+#include <i18nlangtag/lang.h>
+#include <tools/time.hxx>
+#include <tools/date.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+#include <com/sun/star/text/textfield/Type.hpp>
+
+namespace com::sun::star::text {
+ class XTextContent;
+}
+
+class SvNumberFormatter;
+class MetaAction;
+
+// class SvxFieldItem ---------------------------------------------------
+
+
+class EDITENG_DLLPUBLIC SvxFieldData
+{
+public:
+
+ static SvxFieldData* Create(const css::uno::Reference<css::text::XTextContent>& xContent);
+
+ static constexpr auto CLASS_ID = css::text::textfield::Type::UNSPECIFIED;
+ virtual sal_Int32 GetClassId() const { return CLASS_ID; }
+
+ SvxFieldData();
+ virtual ~SvxFieldData();
+
+ SvxFieldData(SvxFieldData const &) = default;
+ SvxFieldData(SvxFieldData &&) = default;
+ SvxFieldData & operator =(SvxFieldData const &) = default;
+ SvxFieldData & operator =(SvxFieldData &&) = default;
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const;
+ virtual bool operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+ static MetaAction* createEndComment();
+};
+
+/**
+ * This item stores a field (SvxFieldData). The field is controlled by or
+ * belongs to the item. The field itself is determined by a derivation from
+ * SvxFieldData (RTTI)
+ */
+class EDITENG_DLLPUBLIC SvxFieldItem final : public SfxPoolItem
+{
+ std::unique_ptr<SvxFieldData> mpField;
+public:
+ SvxFieldItem( std::unique_ptr<SvxFieldData> pField, const sal_uInt16 nId );
+ SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId );
+ SvxFieldItem( const SvxFieldItem& rItem );
+ virtual ~SvxFieldItem() override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxFieldItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ const SvxFieldData* GetField() const { return mpField.get(); }
+};
+
+
+// The following are the derivatives of SvxFieldData ...
+
+
+enum class SvxDateType { Fix, Var };
+enum class SvxDateFormat {
+ AppDefault = 0, // Set as in App
+ System, // Set as in System
+ StdSmall,
+ StdBig,
+ A, // 13.02.96
+ B, // 13.02.1996
+ C, // 13.Feb 1996
+ D, // 13.February 1996
+ E, // Tue, 13.February 1996
+ F // Tuesday, 13.February 1996
+};
+
+class EDITENG_DLLPUBLIC SvxDateField final : public SvxFieldData
+{
+ sal_Int32 nFixDate;
+ SvxDateType eType;
+ SvxDateFormat eFormat;
+
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::DATE;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+
+ SvxDateField();
+ explicit SvxDateField( const Date& rDate,
+ SvxDateType eType,
+ SvxDateFormat eFormat = SvxDateFormat::StdSmall );
+
+ sal_Int32 GetFixDate() const { return nFixDate; }
+ void SetFixDate( const Date& rDate ) { nFixDate = rDate.GetDate(); }
+
+ SvxDateType GetType() const { return eType; }
+ void SetType( SvxDateType eTp ) { eType = eTp; }
+
+ SvxDateFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxDateFormat eFmt ) { eFormat = eFmt; }
+
+ // If eLanguage==LANGUAGE_DONTKNOW the language/country
+ // used in number formatter initialization is taken.
+ OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
+ static OUString GetFormatted( Date const & rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+
+ virtual MetaAction* createBeginComment() const override;
+};
+
+
+enum class SvxURLFormat {
+ AppDefault = 0, // Set as in App
+ Url, // Represent URL
+ Repr // Constitute representation
+};
+
+class EDITENG_DLLPUBLIC SvxURLField final : public SvxFieldData
+{
+private:
+ SvxURLFormat eFormat;
+ OUString aURL; // URL-Address
+ OUString aRepresentation; // What is shown
+ OUString aTargetFrame; // In what Frame
+
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::URL;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+
+ SvxURLField();
+ SvxURLField( OUString aURL, OUString aRepres, SvxURLFormat eFmt = SvxURLFormat::Url );
+
+ const OUString& GetURL() const { return aURL; }
+ void SetURL( const OUString& rURL ) { aURL = rURL; }
+
+ const OUString& GetRepresentation() const { return aRepresentation; }
+ void SetRepresentation( const OUString& rRep ) { aRepresentation= rRep; }
+
+ const OUString& GetTargetFrame() const { return aTargetFrame; }
+ void SetTargetFrame( const OUString& rFrm ) { aTargetFrame = rFrm; }
+
+ SvxURLFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxURLFormat eFmt ) { eFormat = eFmt; }
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+
+ virtual MetaAction* createBeginComment() const override;
+};
+
+class EDITENG_DLLPUBLIC SvxPageField final: public SvxFieldData
+{
+public:
+ virtual sal_Int32 GetClassId() const override { return css::text::textfield::Type::PAGE; }
+ SvxPageField();
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+
+ virtual MetaAction* createBeginComment() const override;
+};
+
+class EDITENG_DLLPUBLIC SvxPageTitleField final: public SvxFieldData
+{
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::PAGE_NAME;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+ SvxPageTitleField();
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+
+ virtual MetaAction* createBeginComment() const override;
+};
+
+class EDITENG_DLLPUBLIC SvxPagesField final: public SvxFieldData
+{
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::PAGES;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+ SvxPagesField();
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+};
+
+class EDITENG_DLLPUBLIC SvxTimeField final: public SvxFieldData
+{
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::TIME;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+ SvxTimeField();
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+
+ virtual MetaAction* createBeginComment() const override;
+};
+
+class EDITENG_DLLPUBLIC SvxFileField final: public SvxFieldData
+{
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::DOCINFO_TITLE;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+ SvxFileField();
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+};
+
+class EDITENG_DLLPUBLIC SvxTableField final: public SvxFieldData
+{
+ int mnTab;
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::TABLE;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+ SvxTableField();
+ explicit SvxTableField(int nTab);
+
+ void SetTab(int nTab);
+ int GetTab() const { return mnTab;}
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+};
+
+
+enum class SvxTimeType {
+ Fix,
+ Var
+};
+enum class SvxTimeFormat {
+ AppDefault = 0, // Set as in App
+ System, // Set as in System
+ Standard,
+ HH24_MM, // 13:49
+ HH24_MM_SS, // 13:49:38
+ HH24_MM_SS_00, // 13:49:38.78
+ HH12_MM, // 01:49
+ HH12_MM_SS, // 01:49:38
+ HH12_MM_SS_00, // 01:49:38.78
+ HH12_MM_AMPM, // 01:49 PM
+ HH12_MM_SS_AMPM, // 01:49:38 PM
+ HH12_MM_SS_00_AMPM // 01:49:38.78 PM
+};
+
+class EDITENG_DLLPUBLIC SvxExtTimeField final : public SvxFieldData
+{
+private:
+ sal_Int64 m_nFixTime;
+ SvxTimeType eType;
+ SvxTimeFormat eFormat;
+
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::EXTENDED_TIME;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+ SvxExtTimeField();
+ explicit SvxExtTimeField( const tools::Time& rTime,
+ SvxTimeType eType,
+ SvxTimeFormat eFormat = SvxTimeFormat::Standard );
+
+ sal_Int64 GetFixTime() const { return m_nFixTime; }
+ void SetFixTime( const tools::Time& rTime ) { m_nFixTime = rTime.GetTime(); }
+
+ SvxTimeType GetType() const { return eType; }
+ void SetType( SvxTimeType eTp ) { eType = eTp; }
+
+ SvxTimeFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxTimeFormat eFmt ) { eFormat = eFmt; }
+
+ // If eLanguage==LANGUAGE_DONTKNOW the language/country
+ // used in number formatter initialization is taken.
+ OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
+ static OUString GetFormatted( tools::Time const & rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+
+ virtual MetaAction* createBeginComment() const override;
+};
+
+
+enum class SvxFileType {
+ Fix,
+ Var
+};
+enum class SvxFileFormat {
+ NameAndExt = 0, // File name with Extension
+ PathFull, // full path
+ PathOnly, // only path
+ NameOnly // only file name
+};
+
+
+class EDITENG_DLLPUBLIC SvxExtFileField final : public SvxFieldData
+{
+private:
+ OUString aFile;
+ SvxFileType eType;
+ SvxFileFormat eFormat;
+
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::EXTENDED_FILE;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+ SvxExtFileField();
+ explicit SvxExtFileField( const OUString& rString,
+ SvxFileType eType = SvxFileType::Var,
+ SvxFileFormat eFormat = SvxFileFormat::PathFull );
+
+ const OUString& GetFile() const { return aFile; }
+ void SetFile( const OUString& rString ) { aFile = rString; }
+
+ SvxFileType GetType() const { return eType; }
+ void SetType( SvxFileType eTp ) { eType = eTp; }
+
+ SvxFileFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxFileFormat eFmt ) { eFormat = eFmt; }
+
+ OUString GetFormatted() const;
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+};
+
+
+enum class SvxAuthorType {
+ Fix, Var
+};
+enum class SvxAuthorFormat {
+ FullName, // full name
+ LastName, // Only Last name
+ FirstName, // Only first name
+ ShortName // Initials
+};
+
+class EDITENG_DLLPUBLIC SvxAuthorField final : public SvxFieldData
+{
+private:
+ OUString aName;
+ OUString aFirstName;
+ OUString aShortName;
+ SvxAuthorType eType;
+ SvxAuthorFormat eFormat;
+
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::AUTHOR;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+ SvxAuthorField(
+ const OUString& rFirstName,
+ const OUString& rLastName,
+ const OUString& rShortName,
+ SvxAuthorType eType = SvxAuthorType::Var,
+ SvxAuthorFormat eFormat = SvxAuthorFormat::FullName );
+
+ SvxAuthorType GetType() const { return eType; }
+ void SetType( SvxAuthorType eTp ) { eType = eTp; }
+
+ SvxAuthorFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxAuthorFormat eFmt ) { eFormat = eFmt; }
+
+ OUString GetFormatted() const;
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+};
+
+/** this field is used as a placeholder for a header&footer in impress. The actual
+ value is stored at the page */
+class EDITENG_DLLPUBLIC SvxHeaderField final: public SvxFieldData
+{
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::PRESENTATION_HEADER;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+ SvxHeaderField();
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+};
+
+/** this field is used as a placeholder for a header&footer in impress. The actual
+ value is stored at the page */
+class EDITENG_DLLPUBLIC SvxFooterField final: public SvxFieldData
+{
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::PRESENTATION_FOOTER;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+ SvxFooterField();
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+};
+
+/** this field is used as a placeholder for a header&footer in impress. The actual
+ value is stored at the page */
+class EDITENG_DLLPUBLIC SvxDateTimeField final: public SvxFieldData
+{
+public:
+ static constexpr auto CLASS_ID = css::text::textfield::Type::PRESENTATION_DATE_TIME;
+ virtual sal_Int32 GetClassId() const override { return CLASS_ID; }
+ SvxDateTimeField();
+
+ static OUString GetFormatted( Date const & rDate, tools::Time const & rTime,
+ SvxDateFormat eDateFormat, SvxTimeFormat eTimeFormat,
+ SvNumberFormatter& rFormatter, LanguageType eLanguage );
+
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==( const SvxFieldData& ) const override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/flstitem.hxx b/include/editeng/flstitem.hxx
new file mode 100644
index 000000000..71756464e
--- /dev/null
+++ b/include/editeng/flstitem.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_FLSTITEM_HXX
+#define INCLUDED_EDITENG_FLSTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxFontListItem -------------------------------------------------
+
+class FontList;
+
+/*
+ [Description]
+
+ This item serves as a transport medium for a font list. The font list is
+ not copied and not deleted!
+*/
+
+class EDITENG_DLLPUBLIC SvxFontListItem final : public SfxPoolItem
+{
+private:
+ const FontList* pFontList;
+ css::uno::Sequence< OUString > aFontNameSeq;
+
+public:
+ SvxFontListItem( const FontList* pFontLst,
+ const sal_uInt16 nId );
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxFontListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ const FontList* GetFontList() const { return pFontList; }
+};
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/fontitem.hxx b/include/editeng/fontitem.hxx
new file mode 100644
index 000000000..deabf3101
--- /dev/null
+++ b/include/editeng/fontitem.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_FONTITEM_HXX
+#define INCLUDED_EDITENG_FONTITEM_HXX
+
+#include <editeng/editengdllapi.h>
+#include <rtl/ustring.hxx>
+#include <tools/fontenum.hxx>
+#include <svl/poolitem.hxx>
+
+/** This item describes a Font.
+*/
+class EDITENG_DLLPUBLIC SvxFontItem final : public SfxPoolItem
+{
+ OUString aFamilyName;
+ OUString aStyleName;
+ FontFamily eFamily;
+ FontPitch ePitch;
+ rtl_TextEncoding eTextEncoding;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxFontItem(const sal_uInt16 nId);
+ SvxFontItem(const FontFamily eFam, OUString aFamilyName,
+ OUString aStyleName,
+ const FontPitch eFontPitch /*= PITCH_DONTKNOW*/,
+ const rtl_TextEncoding eFontTextEncoding /*= RTL_TEXTENCODING_DONTKNOW*/,
+ const sal_uInt16 nId);
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==(const SfxPoolItem& rItem) const override;
+ bool operator<(const SfxPoolItem& rCmp) const override;
+ virtual SvxFontItem* Clone(SfxItemPool *pPool = nullptr) const override;
+ virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
+ virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres,
+ MapUnit eCoreMetric, MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper&) const override;
+
+ // Access methods:
+ void SetFamilyName(const OUString& rFamilyName)
+ {
+ aFamilyName = rFamilyName;
+ }
+ const OUString &GetFamilyName() const
+ {
+ return aFamilyName;
+ }
+
+ void SetStyleName(const OUString &rStyleName)
+ {
+ aStyleName = rStyleName;
+ }
+ const OUString &GetStyleName() const
+ {
+ return aStyleName;
+ }
+
+ void SetFamily(FontFamily _eFamily)
+ {
+ eFamily = _eFamily;
+ }
+ FontFamily GetFamily() const
+ {
+ return eFamily;
+ }
+
+ void SetPitch(FontPitch _ePitch)
+ {
+ ePitch = _ePitch;
+ }
+ FontPitch GetPitch() const
+ {
+ return ePitch;
+ }
+
+ void SetCharSet(rtl_TextEncoding _eEncoding)
+ {
+ eTextEncoding = _eEncoding;
+ }
+ rtl_TextEncoding GetCharSet() const
+ {
+ return eTextEncoding;
+ }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+EDITENG_DLLPUBLIC void GetDefaultFonts(SvxFontItem& rLatin,
+ SvxFontItem& rAsian,
+ SvxFontItem& rComplex);
+
+#endif // INCLUDED_EDITENG_FONTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/forbiddencharacterstable.hxx b/include/editeng/forbiddencharacterstable.hxx
new file mode 100644
index 000000000..f91aade4a
--- /dev/null
+++ b/include/editeng/forbiddencharacterstable.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_FORBIDDENCHARACTERSTABLE_HXX
+#define INCLUDED_EDITENG_FORBIDDENCHARACTERSTABLE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/i18n/ForbiddenCharacters.hpp>
+#include <editeng/editengdllapi.h>
+#include <i18nlangtag/lang.h>
+#include <map>
+#include <memory>
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable
+{
+public:
+ typedef std::map<LanguageType, css::i18n::ForbiddenCharacters> Map;
+private:
+ Map maMap;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ SvxForbiddenCharactersTable(css::uno::Reference< css::uno::XComponentContext > xContext);
+
+public:
+ static std::shared_ptr<SvxForbiddenCharactersTable> makeForbiddenCharactersTable(const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+
+ Map& GetMap() { return maMap; }
+ const css::i18n::ForbiddenCharacters* GetForbiddenCharacters( LanguageType nLanguage, bool bGetDefault );
+ void SetForbiddenCharacters( LanguageType nLanguage , const css::i18n::ForbiddenCharacters& );
+ void ClearForbiddenCharacters( LanguageType nLanguage );
+};
+
+#endif // INCLUDED_EDITENG_FORBIDDENCHARACTERSTABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/forbiddenruleitem.hxx b/include/editeng/forbiddenruleitem.hxx
new file mode 100644
index 000000000..93e46b433
--- /dev/null
+++ b/include/editeng/forbiddenruleitem.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_FORBIDDENRULEITEM_HXX
+#define INCLUDED_EDITENG_FORBIDDENRULEITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxForbiddenRuleItem -----------------------------------------
+
+/* [Description]
+
+ This item describe how to handle the last character of a line.
+*/
+
+class EDITENG_DLLPUBLIC SvxForbiddenRuleItem final : public SfxBoolItem
+{
+public:
+ SvxForbiddenRuleItem( bool bOn /*= false*/,
+ const sal_uInt16 nId );
+
+ virtual SvxForbiddenRuleItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/formatbreakitem.hxx b/include/editeng/formatbreakitem.hxx
new file mode 100644
index 000000000..71f331769
--- /dev/null
+++ b/include/editeng/formatbreakitem.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_FORMATBREAKITEM_HXX
+#define INCLUDED_EDITENG_FORMATBREAKITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxFormatBreakItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes a wrap-attribute
+ Automatic?, Page or column break, before or after?
+*/
+constexpr sal_uInt16 FMTBREAK_NOAUTO = 0x0001;
+
+class EDITENG_DLLPUBLIC SvxFormatBreakItem final : public SfxEnumItem<SvxBreak>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ inline SvxFormatBreakItem( const SvxBreak eBrk /*= SvxBreak::NONE*/,
+ const sal_uInt16 nWhich );
+ SvxFormatBreakItem(SvxFormatBreakItem const &) = default; // SfxPoolItem copy function dichotomy
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ static OUString GetValueTextByPos( sal_uInt16 nPos );
+
+ virtual SvxFormatBreakItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+
+ SvxBreak GetBreak() const { return GetValue(); }
+};
+
+
+inline SvxFormatBreakItem::SvxFormatBreakItem( const SvxBreak eBreak,
+ const sal_uInt16 _nWhich ) :
+ SfxEnumItem( _nWhich, eBreak )
+{}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/frmdir.hxx b/include/editeng/frmdir.hxx
new file mode 100644
index 000000000..ef5275d26
--- /dev/null
+++ b/include/editeng/frmdir.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_FRMDIR_HXX
+#define INCLUDED_EDITENG_FRMDIR_HXX
+
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <unotools/resmgr.hxx>
+
+/**
+ * Defines possible text directions in frames.
+ * A scoped enum over the constants in css::text:WritingMode2.
+ */
+enum class SvxFrameDirection
+{
+ /** used as an error return value in SW */
+ Unknown = -1,
+
+ /** Horizontal, from left to right, from top to bottom
+ (typical for western languages). */
+ Horizontal_LR_TB = css::text::WritingMode2::LR_TB,
+
+ /** Horizontal, from right to left, from top to bottom
+ (typical for arabic/hebrew languages). */
+ Horizontal_RL_TB = css::text::WritingMode2::RL_TB,
+
+ /** Vertical, from top to bottom, from right to left
+ (typical for asian languages). */
+ Vertical_RL_TB = css::text::WritingMode2::TB_RL,
+
+ /** Vertical, from top to bottom, from left to right
+ (typical for mongol language). */
+ Vertical_LR_TB = css::text::WritingMode2::TB_LR,
+
+ /** Use the value from the environment, can only be used in frames. */
+ Environment = css::text::WritingMode2::CONTEXT,
+
+ /** Vertical, from bottom to top, from left to right. */
+ Vertical_LR_BT = css::text::WritingMode2::BT_LR,
+};
+
+TranslateId getFrmDirResId(size_t nIndex);
+
+#endif // INCLUDED_EDITENG_FRMDIR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/frmdiritem.hxx b/include/editeng/frmdiritem.hxx
new file mode 100644
index 000000000..2a439aa50
--- /dev/null
+++ b/include/editeng/frmdiritem.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_FRMDIRITEM_HXX
+#define INCLUDED_EDITENG_FRMDIRITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/frmdir.hxx>
+#include <editeng/editengdllapi.h>
+
+/* This item defines a frame direction, which place the content inside
+ a frame. It exist different kind of directions which are used to the
+ layout text for Western, CJK and CTL languages.
+*/
+
+class EDITENG_DLLPUBLIC SvxFrameDirectionItem final : public SfxEnumItem<SvxFrameDirection>
+{
+public:
+ SvxFrameDirectionItem( SvxFrameDirection nValue, sal_uInt16 nWhich );
+ virtual ~SvxFrameDirectionItem() override;
+
+ SvxFrameDirectionItem(SvxFrameDirectionItem const &) = default;
+ SvxFrameDirectionItem(SvxFrameDirectionItem &&) = default;
+ SvxFrameDirectionItem & operator =(SvxFrameDirectionItem const &) = delete;
+ SvxFrameDirectionItem & operator =(SvxFrameDirectionItem &&) = delete;
+
+ virtual SvxFrameDirectionItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual sal_uInt16 GetValueCount() const override
+ {
+ return sal_uInt16(SvxFrameDirection::Vertical_LR_BT) + 1;
+ }
+
+ // SfxPoolItem copy function dichotomy
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif // INCLUDED_EDITENG_FRMDIRITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/hangulhanja.hxx b/include/editeng/hangulhanja.hxx
new file mode 100644
index 000000000..f2a5dcf99
--- /dev/null
+++ b/include/editeng/hangulhanja.hxx
@@ -0,0 +1,288 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_HANGULHANJA_HXX
+#define INCLUDED_EDITENG_HANGULHANJA_HXX
+
+#include <memory>
+#include <editeng/editengdllapi.h>
+#include <i18nlangtag/mslangid.hxx>
+
+namespace com::sun::star::lang { struct Locale; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::uno { template <class E> class Sequence; }
+namespace vcl { class Font; }
+namespace weld { class Widget; }
+
+
+namespace editeng
+{
+
+
+ class HangulHanjaConversion_Impl;
+
+
+ //= HangulHanjaConversion
+
+ /** encapsulates Hangul-Hanja conversion functionality
+
+ <p>terminology:
+ <ul><li>A <b>text <em>portion</em></b> is some (potentially large) piece of text
+ which is to be analyzed for convertible sub-strings.</li>
+ <li>A <b>text <em>unit</em></b> is a sub string in a text portion, which is
+ to be converted as a whole.</li>
+ </ul>
+ For instance, you could have two independent selections within your document, which are then
+ two text portions. A text unit would be single Hangul/Hanja words within a portion, or even
+ single Hangul syllabification when "replace by character" is enabled.
+ </p>
+ */
+ class EDITENG_DLLPUBLIC HangulHanjaConversion
+ {
+ friend class HangulHanjaConversion_Impl;
+
+ public:
+ enum ReplacementAction
+ {
+ eExchange, // simply exchange one text with another
+ eReplacementBracketed, // keep the original, and put the replacement in brackets after it
+ eOriginalBracketed, // replace the original text, but put it in brackets after the replacement
+ eReplacementAbove, // keep the original, and put the replacement text as ruby text above it
+ eOriginalAbove, // replace the original text, but put it as ruby text above it
+ eReplacementBelow, // keep the original, and put the replacement text as ruby text below it
+ eOriginalBelow // replace the original text, but put it as ruby text below it
+ };
+
+ enum ConversionType // does not specify direction...
+ {
+ eConvHangulHanja, // Korean Hangul/Hanja conversion
+ eConvSimplifiedTraditional // Chinese simplified / Chinese traditional conversion
+ };
+
+ // Note: conversion direction for eConvSimplifiedTraditional is
+ // specified by source language.
+ // This one is for Hangul/Hanja where source and target language
+ // are the same.
+ enum ConversionDirection
+ {
+ eHangulToHanja,
+ eHanjaToHangul
+ };
+
+ enum ConversionFormat
+ {
+ eSimpleConversion, // used for simplified / traditional Chinese as well
+ eHangulBracketed,
+ eHanjaBracketed,
+ eRubyHanjaAbove,
+ eRubyHanjaBelow,
+ eRubyHangulAbove,
+ eRubyHangulBelow
+ };
+
+ private:
+ ::std::unique_ptr< HangulHanjaConversion_Impl > m_pImpl;
+
+ // used to set initial values of m_pImpl object from saved ones
+ static bool m_bUseSavedValues; // defines if the following two values should be used for initialization
+ static bool m_bTryBothDirectionsSave;
+ static ConversionDirection m_ePrimaryConversionDirectionSave;
+
+ HangulHanjaConversion (const HangulHanjaConversion &) = delete;
+ HangulHanjaConversion & operator= (const HangulHanjaConversion &) = delete;
+
+ public:
+ HangulHanjaConversion(
+ weld::Widget* pUIParent,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::lang::Locale& _rSourceLocale,
+ const css::lang::Locale& _rTargetLocale,
+ const vcl::Font* _pTargetFont,
+ sal_Int32 nOptions,
+ bool _bIsInteractive
+ );
+
+ virtual ~HangulHanjaConversion() COVERITY_NOEXCEPT_FALSE;
+
+ // converts the whole document
+ void ConvertDocument();
+
+ weld::Widget* GetUIParent() const; // the parent window for any UI we raise
+ LanguageType GetSourceLanguage() const;
+ LanguageType GetTargetLanguage() const;
+ const vcl::Font* GetTargetFont() const;
+ sal_Int32 GetConversionOptions() const;
+ bool IsInteractive() const;
+
+ // chinese text conversion
+ static inline bool IsSimplified( LanguageType nLang );
+ static inline bool IsTraditional( LanguageType nLang );
+ static inline bool IsChinese( LanguageType nLang );
+
+ // used to specify that the conversion direction states from the
+ // last incarnation should be used as
+ // initial conversion direction for the next incarnation.
+ // (A hack used to transport a state information from
+ // one incarnation to the next. Used in Writers text conversion...)
+ static void SetUseSavedConversionDirectionState( bool bVal );
+ static bool IsUseSavedConversionDirectionState();
+
+ protected:
+ /** retrieves the next text portion which is to be analyzed
+
+ <p>pseudo-abstract, needs to be overridden</p>
+
+ @param _rNextPortion
+ upon return, this must contain the next text portion
+ @param _rLangOfPortion
+ upon return, this must contain the language for the found text portion.
+ (necessary for Chinese translation since there are 5 language variants
+ too look for even if the 'source' language usually is only 'simplified'
+ or 'traditional'.)
+ */
+ virtual void GetNextPortion(
+ OUString& /* [out] */ _rNextPortion,
+ LanguageType& /* [out] */ _rLangOfPortion,
+ bool /* [in] */ _bAllowImplicitChangesForNotConvertibleText ) = 0;
+
+ /** announces a new "current unit"
+
+ <p>This will be called whenever it is necessary to interactively ask the user for
+ a conversion. In such a case, a range within the current portion (see <member>GetNextPortion</member>)
+ is presented to the user for choosing a substitution. Additionally, this method is called,
+ so that derived classes can e.g. highlight this text range in a document view.</p>
+
+ <p>Note that the indexes are relative to the most recent replace action. See
+ <member>ReplaceUnit</member> for details.</p>
+
+ @param _nUnitStart
+ the start index of the unit
+
+ @param _nUnitEnd
+ the start index (exclusively!) of the unit.
+
+ @param _bAllowImplicitChangesForNotConvertibleText
+ allows implicit changes other than the text itself for the
+ text parts not being convertible.
+ Used for chinese translation to attribute all not convertible
+ text (e.g. western text, empty paragraphs, spaces, ...) to
+ the target language and target font of the conversion.
+ This is to ensure that after the conversion any new text entered
+ anywhere in the document will have the target language (of course
+ CJK Language only) and target font (CJK font only) set.
+
+ @see GetNextPortion
+ */
+ virtual void HandleNewUnit( const sal_Int32 _nUnitStart, const sal_Int32 _nUnitEnd ) = 0;
+
+ /** replaces a text unit within a text portion with a new text
+
+ <p>pseudo-abstract, needs to be overridden</p>
+
+ <p>Note an important thing about the indices: They are always relative to the <em>previous
+ call</em> of ReplaceUnit. This means when you get a call to ReplaceUnit, and replace some text
+ in your document, then you have to remember the document position immediately <em>behind</em>
+ the changed text. In a next call to ReplaceUnit, an index of <em>0</em> will denote exactly
+ this position behind the previous replacement<br/>
+ The reason is that this class here does not know anything about your document structure,
+ so after a replacement took place, it's impossible to address anything in the range from the
+ beginning of the portion up to the replaced text.<br/>
+ In the very first call to ReplaceUnit, an index of <em>0</em> denotes the very first position of
+ the current portion.</p>
+
+ <p>If the language of the text to be replaced is different from
+ the target language (as given by 'GetTargetLanguage') for example
+ when converting simplified Chinese from/to traditional Chinese
+ the language attribute of the new text has to be changed as well,
+ **and** the font is to be set to the default (document) font for
+ that language.</p>
+
+ @param _nUnitStart
+ the start index of the range to replace
+
+ @param _nUnitEnd
+ the end index (exclusively!) of the range to replace. E.g., an index
+ pair (4,5) indicates a range of length 1.
+
+ @param _rOrigText
+ the original text to be replaced (as returned by GetNextPortion).
+ Since in Chinese conversion the original text is needed as well
+ in order to only do the minimal necessary text changes and to keep
+ as much attributes as possible this is supplied here as well.
+
+ @param _rReplaceWith
+ The replacement text
+
+ @param _rOffsets
+ An sequence matching the indices (characters) of _rReplaceWith
+ to the indices of the characters in the original text they are
+ replacing.
+ This is necessary since some portions of the text may get
+ converted in portions of different length than the original.
+ The sequence will be empty if all conversions in the text are
+ of equal length. That is if always the character at index i in
+ _rOffsets is replacing the character at index i in the original
+ text for all valid index values of i.
+
+ @param _eAction
+ replacement action to take
+
+ @param pNewUnitLanguage
+ if the replacement unit is required to have a new language that
+ is specified here. If the language is to be left unchanged this
+ is the 0 pointer.
+ */
+ virtual void ReplaceUnit(
+ const sal_Int32 _nUnitStart, const sal_Int32 _nUnitEnd,
+ const OUString& _rOrigText,
+ const OUString& _rReplaceWith,
+ const css::uno::Sequence< sal_Int32 > &_rOffsets,
+ ReplacementAction _eAction,
+ LanguageType *pNewUnitLanguage
+ ) = 0;
+
+ /** specifies if rubies are supported by the document implementing
+ this class.
+
+ @return
+ <TRUE/> if rubies are supported.
+ */
+ virtual bool HasRubySupport() const = 0;
+ };
+
+ bool HangulHanjaConversion::IsSimplified( LanguageType nLang )
+ {
+ return MsLangId::isSimplifiedChinese(nLang);
+ }
+
+ bool HangulHanjaConversion::IsTraditional( LanguageType nLang )
+ {
+ return MsLangId::isTraditionalChinese(nLang);
+ }
+
+ bool HangulHanjaConversion::IsChinese( LanguageType nLang )
+ {
+ return MsLangId::isChinese(nLang);
+ }
+
+}
+
+
+#endif // INCLUDED_EDITENG_HANGULHANJA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/hngpnctitem.hxx b/include/editeng/hngpnctitem.hxx
new file mode 100644
index 000000000..c59d4db0c
--- /dev/null
+++ b/include/editeng/hngpnctitem.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_HNGPNCTITEM_HXX
+#define INCLUDED_EDITENG_HNGPNCTITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxHangingPunctuationItem -----------------------------------------
+
+/* [Description]
+
+ This item describe how to handle the last character of a line.
+*/
+
+class EDITENG_DLLPUBLIC SvxHangingPunctuationItem final : public SfxBoolItem
+{
+public:
+ SvxHangingPunctuationItem( bool bOn /*= false*/, const sal_uInt16 nId );
+
+ virtual SvxHangingPunctuationItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/hyphenzoneitem.hxx b/include/editeng/hyphenzoneitem.hxx
new file mode 100644
index 000000000..7104d2d7d
--- /dev/null
+++ b/include/editeng/hyphenzoneitem.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_HYPHENZONEITEM_HXX
+#define INCLUDED_EDITENG_HYPHENZONEITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxHyphenZoneItem -----------------------------------------------
+
+/* [Description]
+
+ This item describes a hyphenation attribute (automatic?, number of
+ characters at the end of the line and start).
+*/
+
+class EDITENG_DLLPUBLIC SvxHyphenZoneItem final : public SfxPoolItem
+{
+ bool bHyphen : 1;
+ bool bPageEnd : 1;
+ bool bNoCapsHyphenation : 1;
+ bool bNoLastWordHyphenation : 1;
+ sal_uInt8 nMinLead;
+ sal_uInt8 nMinTrail;
+ sal_uInt8 nMaxHyphens; // max. consecutive lines with hyphenation
+ sal_uInt8 nMinWordLength; // hyphenate only words with at least nMinWordLength characters
+ sal_uInt16 nTextHyphenZone; // don't force hyphenation at line end, allow this extra white space
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxHyphenZoneItem( const bool bHyph /*= false*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxHyphenZoneItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ void SetHyphen( const bool bNew ) { bHyphen = bNew; }
+ bool IsHyphen() const { return bHyphen; }
+
+ void SetPageEnd( const bool bNew ) { bPageEnd = bNew; }
+ bool IsPageEnd() const { return bPageEnd; }
+
+ void SetNoCapsHyphenation( const bool bNew ) { bNoCapsHyphenation = bNew; }
+ bool IsNoCapsHyphenation() const { return bNoCapsHyphenation; }
+ void SetNoLastWordHyphenation( const bool bNew ) { bNoLastWordHyphenation = bNew; }
+ bool IsNoLastWordHyphenation() const { return bNoLastWordHyphenation; }
+
+ sal_uInt8 &GetMinLead() { return nMinLead; }
+ sal_uInt8 GetMinLead() const { return nMinLead; }
+
+ sal_uInt8 &GetMinTrail() { return nMinTrail; }
+ sal_uInt8 GetMinTrail() const { return nMinTrail; }
+
+ sal_uInt8 &GetMaxHyphens() { return nMaxHyphens; }
+ sal_uInt8 GetMaxHyphens() const { return nMaxHyphens; }
+
+ sal_uInt8 &GetMinWordLength() { return nMinWordLength; }
+ sal_uInt8 GetMinWordLength() const { return nMinWordLength; }
+
+ sal_uInt16 &GetTextHyphenZone() { return nTextHyphenZone; }
+ sal_uInt16 GetTextHyphenZone() const { return nTextHyphenZone; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/itemtype.hxx b/include/editeng/itemtype.hxx
new file mode 100644
index 000000000..7f70a7073
--- /dev/null
+++ b/include/editeng/itemtype.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_ITEMTYPE_HXX
+#define INCLUDED_EDITENG_ITEMTYPE_HXX
+
+// forward ---------------------------------------------------------------
+#include <rtl/ustring.hxx>
+#include <tools/long.hxx>
+#include <tools/mapunit.hxx>
+#include <editeng/editengdllapi.h>
+#include <unotools/resmgr.hxx>
+
+class Color;
+class IntlWrapper;
+// static and prototypes -------------------------------------------------
+
+inline constexpr OUStringLiteral cpDelim = u", ";
+
+EDITENG_DLLPUBLIC OUString GetMetricText( tools::Long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper * pIntl );
+OUString GetColorString( const Color& rCol );
+EDITENG_DLLPUBLIC TranslateId GetMetricId(MapUnit eUnit);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/justifyitem.hxx b/include/editeng/justifyitem.hxx
new file mode 100644
index 000000000..616427f46
--- /dev/null
+++ b/include/editeng/justifyitem.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_JUSTIFYITEM_HXX
+#define INCLUDED_EDITENG_JUSTIFYITEM_HXX
+
+#include <editeng/editengdllapi.h>
+#include <editeng/svxenum.hxx>
+#include <svl/eitem.hxx>
+#include <sal/types.h>
+
+class EDITENG_DLLPUBLIC SvxHorJustifyItem final : public SfxEnumItem<SvxCellHorJustify>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxHorJustifyItem( const sal_uInt16 nId );
+
+ SvxHorJustifyItem(
+ const SvxCellHorJustify eJustify /*= SvxCellHorJustify::Standard*/,
+ const sal_uInt16 nId );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual sal_uInt16 GetValueCount() const override;
+ static OUString GetValueText( SvxCellHorJustify nVal );
+ virtual SvxHorJustifyItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ SvxHorJustifyItem(SvxHorJustifyItem const &) = default; // SfxPoolItem copy function dichotomy
+};
+
+
+class EDITENG_DLLPUBLIC SvxVerJustifyItem final : public SfxEnumItem<SvxCellVerJustify>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxVerJustifyItem( const sal_uInt16 nId );
+
+ SvxVerJustifyItem(
+ const SvxCellVerJustify eJustify,
+ const sal_uInt16 nId );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual sal_uInt16 GetValueCount() const override;
+ static OUString GetValueText( SvxCellVerJustify nVal );
+ virtual SvxVerJustifyItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ SvxVerJustifyItem(SvxVerJustifyItem const &) = default; // SfxPoolItem copy function dichotomy
+};
+
+
+class EDITENG_DLLPUBLIC SvxJustifyMethodItem final : public SfxEnumItem<SvxCellJustifyMethod>
+{
+public:
+ SvxJustifyMethodItem(
+ const SvxCellJustifyMethod eMethod,
+ const sal_uInt16 nId );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual sal_uInt16 GetValueCount() const override;
+ static OUString GetValueText( SvxCellJustifyMethod nVal );
+ virtual SvxJustifyMethodItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/keepitem.hxx b/include/editeng/keepitem.hxx
new file mode 100644
index 000000000..c108560ce
--- /dev/null
+++ b/include/editeng/keepitem.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_KEEPITEM_HXX
+#define INCLUDED_EDITENG_KEEPITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxFormatKeepItem ------------------------------------------------
+
+/* [Description]
+
+ This item describes a logical variable "keep paragraphs together?".
+*/
+
+class EDITENG_DLLPUBLIC SvxFormatKeepItem final : public SfxBoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ inline SvxFormatKeepItem( const bool bKeep /*= false*/,
+ const sal_uInt16 _nWhich );
+ SvxFormatKeepItem(SvxFormatKeepItem const &) = default; // SfxPoolItem copy function dichotomy
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxFormatKeepItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+inline SvxFormatKeepItem::SvxFormatKeepItem( const bool bKeep, const sal_uInt16 _nWhich ) :
+ SfxBoolItem( _nWhich, bKeep )
+{}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/kernitem.hxx b/include/editeng/kernitem.hxx
new file mode 100644
index 000000000..23a8c1909
--- /dev/null
+++ b/include/editeng/kernitem.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_KERNITEM_HXX
+#define INCLUDED_EDITENG_KERNITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxKerningItem --------------------------------------------------
+
+// Note: Twips value
+// Twips: 0 = no kerning
+
+/* [Description]
+
+ This item describes the kerning.
+*/
+
+class EDITENG_DLLPUBLIC SvxKerningItem final : public SfxInt16Item
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxKerningItem( const short nKern /*= 0*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxKerningItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
+ virtual bool HasMetrics() const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/langitem.hxx b/include/editeng/langitem.hxx
new file mode 100644
index 000000000..4d3852141
--- /dev/null
+++ b/include/editeng/langitem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_LANGITEM_HXX
+#define INCLUDED_EDITENG_LANGITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <i18nlangtag/lang.h>
+#include <editeng/editengdllapi.h>
+
+// class SvxLanguageItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes a Language.
+*/
+
+// MSVC hack:
+class SAL_DLLPUBLIC_RTTI SvxLanguageItem_Base: public SfxEnumItem<LanguageType> {
+protected:
+ explicit SvxLanguageItem_Base(sal_uInt16 nWhich, LanguageType nValue):
+ SfxEnumItem(nWhich, nValue)
+ {}
+};
+
+class EDITENG_DLLPUBLIC SvxLanguageItem final : public SvxLanguageItem_Base
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxLanguageItem( const LanguageType eLang /*= LANGUAGE_GERMAN*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool GetPresentation(SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper&) const override;
+
+ virtual SvxLanguageItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+
+ SvxLanguageItem(SvxLanguageItem const &) = default; // SfxPoolItem copy function dichotomy
+
+ LanguageType GetLanguage() const
+ { return GetValue(); }
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/legacyitem.hxx b/include/editeng/legacyitem.hxx
new file mode 100644
index 000000000..d92bcb59d
--- /dev/null
+++ b/include/editeng/legacyitem.hxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_LEGACYITEM_HXX
+#define INCLUDED_EDITENG_LEGACYITEM_HXX
+
+#include <config_options.h>
+#include <editeng/editengdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// // editeng
+// SvxFontItem aFont;
+// SvxFontHeightItem aHeight;
+// SvxWeightItem aWeight;
+// SvxPostureItem aPosture;
+// SvxUnderlineItem aUnderline;
+// SvxOverlineItem aOverline;
+// SvxCrossedOutItem aCrossedOut;
+// SvxContourItem aContour;
+// SvxShadowedItem aShadowed;
+// SvxColorItem aColor;
+// SvxBoxItem aBox;
+// SvxLineItem aTLBR;
+// SvxBrushItem aBackground;
+// SvxAdjustItem aAdjust;
+// SvxHorJustifyItem aHorJustify;
+// SvxVerJustifyItem aVerJustify;
+// SvxFrameDirectionItem m_aTextOrientation;
+//////////////////////////////////////////////////////////////////////////////
+
+class SvStream;
+class SvxFontItem;
+class SvxFontHeightItem;
+class SvxWeightItem;
+class SvxPostureItem;
+class SvxTextLineItem;
+class SvxCrossedOutItem;
+class SvxShadowedItem;
+class SvxColorItem;
+class SvxBoxItem;
+class SvxLineItem;
+class SvxBrushItem;
+class SvxAdjustItem;
+class SvxHorJustifyItem;
+class SvxVerJustifyItem;
+class SvxFrameDirectionItem;
+class SvxFormatBreakItem;
+class SvxFormatKeepItem;
+class SvxShadowItem;
+
+namespace legacy
+{
+ namespace SvxFont
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxFontItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxFontItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxFontHeight
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxFontHeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxFontHeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxWeight
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxWeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxWeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxPosture
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxPostureItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxPostureItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxTextLine // SvxUnderlineItem, SvxOverlineItem -> SvxTextLineItem
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxTextLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxTextLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxCrossedOut
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxCrossedOutItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxCrossedOutItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ // SvxContourItem -> SfxBoolItem
+ // SvxShadowedItem -> SfxBoolItem
+
+ namespace SvxColor
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxColorItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxColorItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxBox
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxBoxItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxBoxItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxLine
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxBrush
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxAdjust
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxAdjustItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxAdjustItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxHorJustify
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxHorJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxHorJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxVerJustify
+ {
+ sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion);
+ void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxVerJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxVerJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxFrameDirection
+ {
+ sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion);
+ void EDITENG_DLLPUBLIC Create(SvxFrameDirectionItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ EDITENG_DLLPUBLIC SvStream& Store(const SvxFrameDirectionItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxFormatBreak
+ {
+ sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion);
+ void EDITENG_DLLPUBLIC Create(SvxFormatBreakItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ EDITENG_DLLPUBLIC SvStream& Store(const SvxFormatBreakItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxFormatKeep
+ {
+ sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion);
+ void EDITENG_DLLPUBLIC Create(SvxFormatKeepItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ EDITENG_DLLPUBLIC SvStream& Store(const SvxFormatKeepItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+
+ namespace SvxShadow
+ {
+ sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion);
+ void EDITENG_DLLPUBLIC Create(SvxShadowItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ EDITENG_DLLPUBLIC SvStream& Store(const SvxShadowItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+}
+
+#endif // INCLUDED_EDITENG_LEGACYITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/lineitem.hxx b/include/editeng/lineitem.hxx
new file mode 100644
index 000000000..0e481767a
--- /dev/null
+++ b/include/editeng/lineitem.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_LINEITEM_HXX
+#define INCLUDED_EDITENG_LINEITEM_HXX
+
+#include <memory>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxLineItem -----------------------------------------------------
+
+
+/*
+[Description]
+This Item transports an editeng::SvxBorderLine.
+*/
+
+namespace editeng {
+ class SvxBorderLine;
+}
+
+class EDITENG_DLLPUBLIC SvxLineItem final : public SfxPoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxLineItem( const sal_uInt16 nId );
+ SvxLineItem( const SvxLineItem& rCpy );
+ virtual ~SvxLineItem() override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxLineItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
+ virtual bool HasMetrics() const override;
+
+ const editeng::SvxBorderLine*
+ GetLine() const { return pLine.get(); }
+ void SetLine( const editeng::SvxBorderLine *pNew );
+
+private:
+ std::unique_ptr<editeng::SvxBorderLine> pLine;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx
new file mode 100644
index 000000000..0510ee47d
--- /dev/null
+++ b/include/editeng/lrspitem.hxx
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_LRSPITEM_HXX
+#define INCLUDED_EDITENG_LRSPITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxLRSpaceItem --------------------------------------------------
+
+/* [Description]
+
+ Left/Right margin and first line indent
+
+ SvxLRSpaceItem offers two interfaces for views from the left margin and
+ first line indent. The get methods return the member, with the layout also
+ as expected: the left edge shifts to the negative first line indent to the
+ left. The SetTxt/Gettxt methods assume that the left side represents the
+ 0 coordinate for the first line indent:
+
+ UI UI LAYOUT UI/TEXT UI/TEXT (Where?)
+ SetTextLeft SetTxtFirst GetLeft GetTextLeft GetTxtFirst (What?)
+ 500 -500 0 500 -500 (How much?)
+ 500 0 500 500 0
+ 500 +500 500 500 +500
+ 700 -500 200 700 -500
+*/
+
+#define LRSPACE_TXTLEFT_VERSION (sal_uInt16(0x0002))
+#define LRSPACE_NEGATIVE_VERSION (sal_uInt16(0x0004))
+
+class EDITENG_DLLPUBLIC SvxLRSpaceItem final : public SfxPoolItem
+{
+ tools::Long nTxtLeft; // We spend a sal_uInt16
+ tools::Long nLeftMargin; // nLeft or the negative first-line indent
+ tools::Long nRightMargin; // The unproblematic right edge
+ /// The amount of extra space added to the left margin.
+ tools::Long m_nGutterMargin;
+ /// The amount of extra space added to the right margin, on mirrored pages.
+ tools::Long m_nRightGutterMargin;
+
+ sal_uInt16 nPropFirstLineOffset, nPropLeftMargin, nPropRightMargin;
+ short nFirstLineOffset; // First-line indent _always_ relative to nTxtLeft
+ bool bAutoFirst; // Automatic calculation of the first line indent
+ bool bExplicitZeroMarginValRight;
+ bool bExplicitZeroMarginValLeft;
+
+ void AdjustLeft(); // nLeftMargin and nTxtLeft are being adjusted.
+
+public:
+
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxLRSpaceItem( const sal_uInt16 nId );
+ SvxLRSpaceItem( const tools::Long nLeft, const tools::Long nRight,
+ const tools::Long nTLeft /*= 0*/, const short nOfset /*= 0*/,
+ const sal_uInt16 nId );
+ SvxLRSpaceItem(SvxLRSpaceItem const &) = default; // SfxPoolItem copy function dichotomy
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxLRSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
+ virtual bool HasMetrics() const override;
+
+ // The "layout interface":
+ inline void SetLeft ( const tools::Long nL, const sal_uInt16 nProp = 100 );
+ inline void SetRight( const tools::Long nR, const sal_uInt16 nProp = 100 );
+
+ // Query/direct setting of the absolute values
+ tools::Long GetLeft() const { return nLeftMargin; }
+ tools::Long GetRight() const { return nRightMargin;}
+ void SetLeftValue( const tools::Long nL ) { nTxtLeft = nLeftMargin = nL; }
+ void SetRightValue( const tools::Long nR ) { nRightMargin = nR; }
+ bool IsAutoFirst() const { return bAutoFirst; }
+ void SetAutoFirst( const bool bNew ) { bAutoFirst = bNew; }
+
+ bool IsExplicitZeroMarginValRight() const { return bExplicitZeroMarginValRight; }
+ bool IsExplicitZeroMarginValLeft() const { return bExplicitZeroMarginValLeft; }
+ void SetExplicitZeroMarginValRight( const bool eR ) { bExplicitZeroMarginValRight = eR; }
+ void SetExplicitZeroMarginValLeft( const bool eL ) { bExplicitZeroMarginValLeft = eL; }
+ sal_uInt16 GetPropLeft() const { return nPropLeftMargin; }
+ sal_uInt16 GetPropRight() const { return nPropRightMargin;}
+
+ // The UI/text interface:
+ inline void SetTextLeft( const tools::Long nL, const sal_uInt16 nProp = 100 );
+ tools::Long GetTextLeft() const { return nTxtLeft; }
+
+ inline void SetTextFirstLineOffset( const short nF, const sal_uInt16 nProp = 100 );
+ short GetTextFirstLineOffset() const { return nFirstLineOffset; }
+ void SetPropTextFirstLineOffset( const sal_uInt16 nProp )
+ { nPropFirstLineOffset = nProp; }
+ sal_uInt16 GetPropTextFirstLineOffset() const
+ { return nPropFirstLineOffset; }
+ void SetTextFirstLineOffsetValue( const short nValue )
+ { nFirstLineOffset = nValue; }
+ void SetGutterMargin(const tools::Long nGutterMargin) { m_nGutterMargin = nGutterMargin; }
+ tools::Long GetGutterMargin() const { return m_nGutterMargin; }
+ void SetRightGutterMargin(const tools::Long nRightGutterMargin) { m_nRightGutterMargin = nRightGutterMargin; }
+ tools::Long GetRightGutterMargin() const { return m_nRightGutterMargin; }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+inline void SvxLRSpaceItem::SetLeft( const tools::Long nL, const sal_uInt16 nProp )
+{
+ nLeftMargin = (nL * nProp) / 100;
+ nTxtLeft = nLeftMargin;
+ nPropLeftMargin = nProp;
+}
+inline void SvxLRSpaceItem::SetRight( const tools::Long nR, const sal_uInt16 nProp )
+{
+ if (0 == nR)
+ {
+ SetExplicitZeroMarginValRight(true);
+ }
+ nRightMargin = (nR * nProp) / 100;
+ nPropRightMargin = nProp;
+}
+inline void SvxLRSpaceItem::SetTextFirstLineOffset( const short nF,
+ const sal_uInt16 nProp )
+{
+ nFirstLineOffset = short((tools::Long(nF) * nProp ) / 100);
+ nPropFirstLineOffset = nProp;
+ AdjustLeft();
+}
+
+inline void SvxLRSpaceItem::SetTextLeft( const tools::Long nL, const sal_uInt16 nProp )
+{
+ if (0 == nL)
+ {
+ SetExplicitZeroMarginValLeft(true);
+ }
+ nTxtLeft = (nL * nProp) / 100;
+ nPropLeftMargin = nProp;
+ AdjustLeft();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/lspcitem.hxx b/include/editeng/lspcitem.hxx
new file mode 100644
index 000000000..e4c97cfcd
--- /dev/null
+++ b/include/editeng/lspcitem.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_LSPCITEM_HXX
+#define INCLUDED_EDITENG_LSPCITEM_HXX
+
+#include <svl/cenumitm.hxx>
+#include <tools/mapunit.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxLineSpacingItem ----------------------------------------------
+
+/* [Description]
+ This item describes the distance between the lines.
+*/
+
+#define LINE_SPACE_DEFAULT_HEIGHT 200
+class EDITENG_DLLPUBLIC SvxLineSpacingItem final : public SfxEnumItemInterface
+{
+ short nInterLineSpace;
+ sal_uInt16 nLineHeight;
+ sal_uInt16 nPropLineSpace;
+ SvxLineSpaceRule eLineSpaceRule;
+ SvxInterLineSpaceRule eInterLineSpaceRule;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ // The writer relies on a default height of 200! Actually, I would
+ // initialize all values to 0, but who can ignore the consequences in
+ // writer? => Rather have a crooked vales as the default, but the
+ // programmer sees that there's something special happening.
+
+ SvxLineSpacingItem( sal_uInt16 nLineHeight /*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxLineSpacingItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ // Methods to query and edit. InterlineSpace is added to the height.
+ short GetInterLineSpace() const { return nInterLineSpace; }
+ void SetInterLineSpace( const short nSpace )
+ {
+ nInterLineSpace = nSpace;
+ eInterLineSpaceRule = SvxInterLineSpaceRule::Fix;
+ }
+
+ // Determines the absolute or minimum row height.
+ sal_uInt16 GetLineHeight() const { return nLineHeight; }
+ void SetLineHeight( const sal_uInt16 nHeight )
+ {
+ nLineHeight = nHeight;
+ eLineSpaceRule = SvxLineSpaceRule::Min;
+ }
+
+ // To increase or decrease the row height.
+ sal_uInt16 GetPropLineSpace() const { return nPropLineSpace; }
+ void SetPropLineSpace( const sal_uInt16 nProp )
+ {
+ nPropLineSpace = nProp;
+ eInterLineSpaceRule = SvxInterLineSpaceRule::Prop;
+ }
+
+ void SetLineSpaceRule(SvxLineSpaceRule e) { eLineSpaceRule = e; }
+ SvxLineSpaceRule GetLineSpaceRule() const { return eLineSpaceRule; }
+
+ void SetInterLineSpaceRule(SvxInterLineSpaceRule e) { eInterLineSpaceRule = e; }
+ SvxInterLineSpaceRule GetInterLineSpaceRule() const { return eInterLineSpaceRule; }
+
+ virtual sal_uInt16 GetValueCount() const override;
+ virtual sal_uInt16 GetEnumValue() const override;
+ virtual void SetEnumValue( sal_uInt16 nNewVal ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/macros.hxx b/include/editeng/macros.hxx
new file mode 100644
index 000000000..3bc26db60
--- /dev/null
+++ b/include/editeng/macros.hxx
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_EDITENG_MACROS_HXX
+#define INCLUDED_EDITENG_MACROS_HXX
+
+#define DEBUG_EDIT_ENGINE 0
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/measfld.hxx b/include/editeng/measfld.hxx
new file mode 100644
index 000000000..10ed89b2f
--- /dev/null
+++ b/include/editeng/measfld.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_MEASFLD_HXX
+#define INCLUDED_EDITENG_MEASFLD_HXX
+
+#include <editeng/flditem.hxx>
+#include <editeng/editengdllapi.h>
+#include <com/sun/star/text/textfield/Type.hpp>
+
+enum class SdrMeasureFieldKind { Value, Unit, Rotate90Blanks };
+
+class EDITENG_DLLPUBLIC SdrMeasureField final : public SvxFieldData {
+ SdrMeasureFieldKind eMeasureFieldKind;
+public:
+ virtual sal_Int32 GetClassId() const override { return css::text::textfield::Type::MEASURE; }
+ SdrMeasureField(SdrMeasureFieldKind eNewKind): eMeasureFieldKind(eNewKind) {}
+ virtual ~SdrMeasureField() override;
+ virtual std::unique_ptr<SvxFieldData> Clone() const override;
+ virtual bool operator==(const SvxFieldData&) const override;
+ SdrMeasureFieldKind GetMeasureFieldKind() const { return eMeasureFieldKind; }
+
+ SdrMeasureField(SdrMeasureField const &) = default;
+ SdrMeasureField(SdrMeasureField &&) = default;
+ SdrMeasureField & operator =(SdrMeasureField const &) = default;
+ SdrMeasureField & operator =(SdrMeasureField &&) = default;
+};
+
+
+#endif // INCLUDED_EDITENG_MEASFLD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
new file mode 100644
index 000000000..9b89ebafa
--- /dev/null
+++ b/include/editeng/memberids.h
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_MEMBERIDS_H
+#define INCLUDED_EDITENG_MEMBERIDS_H
+
+#define MID_LOCATION 0x3c
+#define MID_TRANSPARENT 0x4b
+#define MID_BG_COLOR 0x22
+#define MID_FLAGS 0x2e
+#define MID_DISTANCE 0x29
+#define MID_FG_COLOR 0x2c
+#define MID_OUTER_WIDTH 0x41
+#define MID_INNER_WIDTH 0x35
+#define MID_LINESPACE 0x3b
+#define MID_LINE_STYLE 0x90
+
+//NameOrIndex
+#define MID_NAME 16
+
+// SvxPageModelItem
+#define MID_AUTO 1
+
+// SvxTabStop
+#define MID_TABSTOPS 0
+#define MID_STD_TAB 1
+
+//SvxHyphenZoneItem
+#define MID_IS_HYPHEN 0
+#define MID_HYPHEN_MIN_LEAD 1
+#define MID_HYPHEN_MIN_TRAIL 2
+#define MID_HYPHEN_MAX_HYPHENS 3
+#define MID_HYPHEN_NO_CAPS 4
+#define MID_HYPHEN_NO_LAST_WORD 5
+#define MID_HYPHEN_MIN_WORD_LENGTH 6
+#define MID_HYPHEN_ZONE 7
+
+// SvxBoxInfoItem
+#define MID_HORIZONTAL 1
+#define MID_VERTICAL 2
+#define MID_VALIDFLAGS 4
+
+//AdjustItem
+#define MID_PARA_ADJUST 0
+#define MID_LAST_LINE_ADJUST 1
+#define MID_EXPAND_SINGLE 2
+
+//SvxFontItem
+// Don't use 0 as it used for the whole struct
+#define MID_FONT_FAMILY_NAME 1
+#define MID_FONT_STYLE_NAME 2
+#define MID_FONT_FAMILY 3
+#define MID_FONT_CHAR_SET 4
+#define MID_FONT_PITCH 5
+
+// SvxCharReliefItem
+#define MID_RELIEF 0
+
+//SvxCharRotateItem
+#define MID_ROTATE 0
+#define MID_FITTOLINE 1
+
+//SvxEscapementItem
+#define MID_ESC 0
+#define MID_ESC_HEIGHT 1
+#define MID_AUTO_ESC 2
+
+//SvxFontHeightItem
+#define MID_FONTHEIGHT 1
+#define MID_FONTHEIGHT_PROP 2
+#define MID_FONTHEIGHT_DIFF 3
+
+//SvxTextLineItem
+#define MID_TEXTLINED 0
+#define MID_TL_STYLE 1
+#define MID_TL_COLOR 2
+#define MID_TL_HASCOLOR 3
+
+//SvxCrossedOutItem
+#define MID_CROSSED_OUT 0
+#define MID_CROSS_OUT 1
+
+//SvxPostureItem
+#define MID_ITALIC 0
+#define MID_POSTURE 1
+
+//SvxBoolItem
+#define MID_BOLD 0
+#define MID_WEIGHT 1
+
+//SvxLanguageItem
+#define MID_LANG_INT 0
+#define MID_LANG_LOCALE 1
+
+//SvxEmphasisMarkItem
+#define MID_EMPHASIS 0
+
+//SvxTwoLinesItem
+#define MID_TWOLINES 0
+#define MID_START_BRACKET 1
+#define MID_END_BRACKET 2
+
+//ULSpaceItem
+#define MID_UP_MARGIN 3
+#define MID_LO_MARGIN 4
+#define MID_UP_REL_MARGIN 5
+#define MID_LO_REL_MARGIN 6
+#define MID_CTX_MARGIN 7
+
+//LRSpaceItem
+#define MID_L_MARGIN 4
+#define MID_R_MARGIN 5
+#define MID_L_REL_MARGIN 6
+#define MID_R_REL_MARGIN 7
+#define MID_FIRST_LINE_INDENT 8
+#define MID_FIRST_LINE_REL_INDENT 9
+#define MID_FIRST_AUTO 10
+#define MID_TXT_LMARGIN 11
+#define MID_GUTTER_MARGIN 12
+
+//ProtectItem
+#define MID_PROTECT_CONTENT 0
+#define MID_PROTECT_SIZE 1
+#define MID_PROTECT_POSITION 2
+
+//SvxBoxItem
+#define LEFT_BORDER 1
+#define RIGHT_BORDER 2
+#define TOP_BORDER 3
+#define BOTTOM_BORDER 4
+#define BORDER_DISTANCE 5
+#define LEFT_BORDER_DISTANCE 6
+#define RIGHT_BORDER_DISTANCE 7
+#define TOP_BORDER_DISTANCE 8
+#define BOTTOM_BORDER_DISTANCE 9
+#define MID_LEFT_BORDER 10
+#define MID_RIGHT_BORDER 11
+#define MID_TOP_BORDER 12
+#define MID_BOTTOM_BORDER 13
+#define LINE_STYLE 14
+#define LINE_WIDTH 15
+
+//BrushItem
+#define MID_BACK_COLOR 0
+#define MID_GRAPHIC_POSITION 1
+#define MID_GRAPHIC 2
+#define MID_GRAPHIC_TRANSPARENT 3
+#define MID_GRAPHIC_URL 4
+#define MID_GRAPHIC_FILTER 5
+#define MID_GRAPHIC_REPEAT 6
+#define MID_GRAPHIC_TRANSPARENCY 7
+#define MID_BACK_COLOR_R_G_B 8
+#define MID_BACK_COLOR_TRANSPARENCY 9
+#define MID_SHADING_VALUE 10
+
+//SvxFormatBreakItem
+#define MID_BREAK_BEFORE 0
+#define MID_BREAK_AFTER 1
+
+// SvxHorJustifyItem
+#define MID_HORJUST_HORJUST 0
+#define MID_HORJUST_ADJUST 1
+
+// SvxShadowItem
+#define MID_SHADOW_TRANSPARENCE 1
+
+// SvxColorItem
+#define MID_COLOR_RGB 0
+#define MID_COLOR_ALPHA 1
+//#define MID_GRAPHIC_TRANSPARENT 3 // used, but already defined above
+#define MID_COLOR_THEME_INDEX 4
+#define MID_COLOR_TINT_OR_SHADE 5
+#define MID_COLOR_LUM_MOD 6
+#define MID_COLOR_LUM_OFF 7
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/misspellrange.hxx b/include/editeng/misspellrange.hxx
new file mode 100644
index 000000000..f46c25e22
--- /dev/null
+++ b/include/editeng/misspellrange.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_EDITENG_MISSPELLRANGE_HXX
+#define INCLUDED_EDITENG_MISSPELLRANGE_HXX
+
+#include <sal/types.h>
+
+#include <vector>
+
+namespace editeng
+{
+struct MisspellRange
+{
+ size_t mnStart;
+ size_t mnEnd;
+
+ MisspellRange(size_t nStart, size_t nEnd);
+};
+
+struct MisspellRanges
+{
+ sal_Int32 mnParagraph;
+ std::vector<MisspellRange> maRanges;
+
+ MisspellRanges(sal_Int32 nParagraph, std::vector<MisspellRange>&& rRanges);
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/nhypitem.hxx b/include/editeng/nhypitem.hxx
new file mode 100644
index 000000000..1078a055b
--- /dev/null
+++ b/include/editeng/nhypitem.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_NHYPITEM_HXX
+#define INCLUDED_EDITENG_NHYPITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxNoHyphenItem -------------------------------------------------
+class EDITENG_DLLPUBLIC SvxNoHyphenItem final : public SfxBoolItem
+{
+public:
+ SvxNoHyphenItem( const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxNoHyphenItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/numdef.hxx b/include/editeng/numdef.hxx
new file mode 100644
index 000000000..6039ec555
--- /dev/null
+++ b/include/editeng/numdef.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_NUMDEF_HXX
+#define INCLUDED_EDITENG_NUMDEF_HXX
+
+#define SVX_MAX_NUM 10 // max. possible numbering level
+#define SVX_DEF_BULLET (0xF000 + 149) // Character for lists
+
+#endif // INCLUDED_EDITENG_NUMDEF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
new file mode 100644
index 000000000..baa6ad320
--- /dev/null
+++ b/include/editeng/numitem.hxx
@@ -0,0 +1,359 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_NUMITEM_HXX
+#define INCLUDED_EDITENG_NUMITEM_HXX
+
+#include <rtl/ustring.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <tools/gen.hxx>
+#include <editeng/numdef.hxx>
+#include <tools/color.hxx>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <unotools/fontcvt.hxx>
+#include <editeng/editengdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <vcl/vclenum.hxx>
+#include <vcl/font.hxx>
+#include <memory>
+#include <optional>
+#include <algorithm>
+
+class SvxBrushItem;
+class Graphic;
+class SvxNodeNum;
+namespace com::sun::star::text { class XNumberingFormatter; }
+
+namespace com::sun::star::lang { struct Locale; }
+
+
+#define SVX_NO_NUM 200 // Marker for no numbering
+#define SVX_NO_NUMLEVEL 0x20
+#define SVX_NUM_REL_SIZE_MIN 25 // Lower limit for numbering relative size
+
+
+#define LINK_TOKEN 0x80 //indicate linked bitmaps - for use in dialog only
+
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+
+class EDITENG_DLLPUBLIC SvxNumberType
+{
+ static sal_Int32 nRefCount;
+ static css::uno::Reference<css::text::XNumberingFormatter> xFormatter;
+
+ SvxNumType nNumType;
+ bool bShowSymbol; // Also show Symbol ?
+
+public:
+ explicit SvxNumberType(SvxNumType nType = SVX_NUM_ARABIC);
+ SvxNumberType(const SvxNumberType& rType);
+ ~SvxNumberType();
+ SvxNumberType & operator =(SvxNumberType const &) = default;
+
+ OUString GetNumStr( sal_Int32 nNo ) const;
+ OUString GetNumStr( sal_Int32 nNo, const css::lang::Locale& rLocale ) const;
+
+ void SetNumberingType(SvxNumType nSet) {nNumType = nSet;}
+ SvxNumType GetNumberingType() const {return nNumType;}
+
+ void SetShowSymbol(bool bSet) {bShowSymbol = bSet;}
+ bool IsShowSymbol()const{return bShowSymbol;}
+
+ bool IsTextFormat() const
+ {
+ return css::style::NumberingType::NUMBER_NONE != nNumType &&
+ css::style::NumberingType::CHAR_SPECIAL != nNumType &&
+ css::style::NumberingType::BITMAP != nNumType;
+ }
+
+ void dumpAsXml(xmlTextWriterPtr w) const;
+};
+
+class EDITENG_DLLPUBLIC SvxNumberFormat : public SvxNumberType
+{
+public:
+ enum SvxNumPositionAndSpaceMode
+ {
+ LABEL_WIDTH_AND_POSITION,
+ LABEL_ALIGNMENT
+ };
+ enum LabelFollowedBy
+ {
+ LISTTAB,
+ SPACE,
+ NOTHING,
+ NEWLINE
+ };
+
+private:
+ OUString sPrefix;
+ OUString sSuffix;
+ std::optional<OUString> sListFormat; // Format string ">%1.%2<" can be used instead of prefix/suffix
+ // Right now it is optional value to distinguish empty list format
+ // and not set list format when we need to fallback to prefix/suffix.
+
+ SvxAdjust eNumAdjust;
+
+ sal_uInt8 nInclUpperLevels; // Take over numbers from the previous level.
+ sal_uInt16 nStart; // Start of counting
+
+ sal_UCS4 cBullet; // Symbol
+ sal_uInt16 nBulletRelSize; // percentage size of bullets
+ Color nBulletColor; // Bullet color
+
+ // mode indicating, if the position and spacing of the list label is
+ // determined by the former attributes (nFirstLineOffset, nAbsLSpace
+ // and nCharTextDistance) called position and spacing via label
+ // width and position (LABEL_WIDTH_AND_POSITION) or by the new attributes
+ // (meLabelFollowedBy, mnListtabPos, mnFirstLineIndent and mnIndentAt)
+ // called position and spacing via label alignment.
+ // Note 1: Attribute <eNumAdjust> is relevant for both modes.
+ // Note 2: The values of the former attributes are treated as 0, if mode
+ // LABEL_ALIGNMENT is active.
+ SvxNumPositionAndSpaceMode mePositionAndSpaceMode;
+
+ sal_Int32 nFirstLineOffset; // First line indent
+ sal_Int32 nAbsLSpace; // Distance Border<->Number
+ short nCharTextDistance; // Distance Number<->Text
+
+ // specifies what follows the list label before the text of the first line
+ // of the list item starts
+ LabelFollowedBy meLabelFollowedBy;
+ // specifies an additional list tab stop position for meLabelFollowedBy = LISTTAB
+ tools::Long mnListtabPos;
+ // specifies the first line indent
+ tools::Long mnFirstLineIndent;
+ // specifies the indent before the text, e.g. in L2R-layout the left margin
+ tools::Long mnIndentAt;
+
+ std::unique_ptr<SvxBrushItem>
+ pGraphicBrush;
+ sal_Int16 eVertOrient; // vertical alignment of a bitmap
+
+ Size aGraphicSize; // Always! in 1/100 mm
+ std::optional<vcl::Font>
+ pBulletFont; // Pointer to the bullet font
+
+ OUString sCharStyleName; // Character Style
+
+public:
+ explicit SvxNumberFormat( SvxNumType nNumberingType );
+ SvxNumberFormat(const SvxNumberFormat& rFormat);
+ SvxNumberFormat( SvStream & rStream );
+
+ virtual ~SvxNumberFormat();
+
+ void Store(SvStream &rStream, FontToSubsFontConverter pConverter);
+
+ SvxNumberFormat& operator=( const SvxNumberFormat& );
+ bool operator==( const SvxNumberFormat& ) const;
+ bool operator!=( const SvxNumberFormat& rFmt) const {return !(*this == rFmt);}
+
+ void SetNumAdjust(SvxAdjust eSet) {eNumAdjust = eSet;}
+ SvxAdjust GetNumAdjust() const {return eNumAdjust;}
+ void SetPrefix(const OUString& rSet) { sPrefix = rSet;}
+ const OUString& GetPrefix() const { return sPrefix;}
+ void SetSuffix(const OUString& rSet) { sSuffix = rSet;}
+ const OUString& GetSuffix() const { return sSuffix;}
+ // Based on prefix and suffix initialize them (for backward compatibility) and generate listformat string
+ void SetListFormat(const OUString& rPrefix, const OUString& rSuffix, int nLevel);
+ void SetListFormat(std::optional<OUString> oSet = std::nullopt);
+ bool HasListFormat() const { return sListFormat.has_value(); }
+ OUString GetListFormat(bool bIncludePrefixSuffix = true) const;
+
+ void SetCharFormatName(const OUString& rSet){ sCharStyleName = rSet; }
+ virtual OUString GetCharFormatName()const;
+
+ void SetBulletFont(const vcl::Font* pFont);
+ const std::optional<vcl::Font>& GetBulletFont() const { return pBulletFont; }
+ void SetBulletChar(sal_UCS4 cSet){cBullet = cSet;}
+ sal_UCS4 GetBulletChar()const {return cBullet;}
+ void SetBulletRelSize(sal_uInt16 nSet) {nBulletRelSize = std::max(nSet,sal_uInt16(SVX_NUM_REL_SIZE_MIN));}
+ sal_uInt16 GetBulletRelSize() const { return nBulletRelSize;}
+ void SetBulletColor(Color nSet){nBulletColor = nSet;}
+ const Color& GetBulletColor()const {return nBulletColor;}
+
+ void SetIncludeUpperLevels( sal_uInt8 nSet ) { nInclUpperLevels = nSet;}
+ sal_uInt8 GetIncludeUpperLevels()const { return nInclUpperLevels;}
+ void SetStart(sal_uInt16 nSet) {nStart = nSet;}
+ sal_uInt16 GetStart() const {return nStart;}
+
+ virtual void SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize = nullptr, const sal_Int16* pOrient = nullptr);
+ const SvxBrushItem* GetBrush() const {return pGraphicBrush.get();}
+ void SetGraphic( const OUString& rName );
+ sal_Int16 GetVertOrient() const;
+ void SetGraphicSize(const Size& rSet) {aGraphicSize = rSet;}
+ const Size& GetGraphicSize() const {return aGraphicSize;}
+
+ SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const { return mePositionAndSpaceMode;}
+ void SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode );
+
+ void SetAbsLSpace(sal_Int32 nSet) {nAbsLSpace = nSet;}
+ sal_Int32 GetAbsLSpace() const;
+ void SetFirstLineOffset(sal_Int32 nSet) { nFirstLineOffset = nSet;}
+ sal_Int32 GetFirstLineOffset() const;
+ void SetCharTextDistance(short nSet) { nCharTextDistance = nSet; }
+ short GetCharTextDistance() const;
+
+ void SetLabelFollowedBy( const LabelFollowedBy eLabelFollowedBy );
+ LabelFollowedBy GetLabelFollowedBy() const { return meLabelFollowedBy;}
+ OUString GetLabelFollowedByAsString() const;
+ void SetListtabPos( const tools::Long nListtabPos );
+ tools::Long GetListtabPos() const { return mnListtabPos;}
+ void SetFirstLineIndent( const tools::Long nFirstLineIndent );
+ tools::Long GetFirstLineIndent() const { return mnFirstLineIndent;}
+ void SetIndentAt( const tools::Long nIndentAt );
+ tools::Long GetIndentAt() const { return mnIndentAt;}
+
+ static Size GetGraphicSizeMM100(const Graphic* pGraphic);
+ static OUString CreateRomanString( sal_Int32 nNo, bool bUpper );
+};
+
+//Feature-Flags (only sal_uInt16!)
+enum class SvxNumRuleFlags : sal_uInt16
+{
+ NONE = 0x0000,
+ CONTINUOUS = 0x0001, // consecutive numbers possible?
+ CHAR_STYLE = 0x0004, // Character styles?
+ BULLET_REL_SIZE = 0x0008, // relative bullet size?
+ BULLET_COLOR = 0x0010, // Bullet color
+ NO_NUMBERS = 0x0080, // Numbering are not allowed
+ ENABLE_LINKED_BMP = 0x0100, // linked bitmaps are available
+ ENABLE_EMBEDDED_BMP = 0x0200 // embedded bitmaps are available
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvxNumRuleFlags> : is_typed_flags<SvxNumRuleFlags, 0x039d> {};
+}
+
+enum class SvxNumRuleType : sal_uInt8
+{
+ NUMBERING,
+ OUTLINE_NUMBERING,
+ PRESENTATION_NUMBERING
+};
+
+class EDITENG_DLLPUBLIC SvxNumRule final
+{
+ std::unique_ptr<SvxNumberFormat> aFmts[SVX_MAX_NUM];
+ sal_uInt16 nLevelCount; // Number of supported levels
+ SvxNumRuleFlags nFeatureFlags; // What is supported?
+ SvxNumRuleType eNumberingType; // Type of numbering
+ bool bContinuousNumbering; // sequential numbering
+ bool aFmtsSet[SVX_MAX_NUM]; // Flags indicating valid levels
+
+ static sal_Int32 nRefCount;
+public:
+ SvxNumRule( SvxNumRuleFlags nFeatures,
+ sal_uInt16 nLevels,
+ bool bCont,
+ SvxNumRuleType eType = SvxNumRuleType::NUMBERING,
+ SvxNumberFormat::SvxNumPositionAndSpaceMode
+ eDefaultNumberFormatPositionAndSpaceMode
+ = SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
+ SvxNumRule(const SvxNumRule& rCopy);
+ SvxNumRule(SvxNumRule&&) noexcept;
+ SvxNumRule(SvStream &rStream);
+ ~SvxNumRule();
+
+ bool operator==( const SvxNumRule& ) const;
+ bool operator!=( const SvxNumRule& rRule ) const {return !(*this == rRule);}
+
+ SvxNumRule& operator=( const SvxNumRule& );
+ SvxNumRule& operator=( SvxNumRule&& ) noexcept;
+
+ void Store(SvStream &rStream);
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+ const SvxNumberFormat* Get(sal_uInt16 nLevel)const;
+ const SvxNumberFormat& GetLevel(sal_uInt16 nLevel)const;
+ void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat& rFmt, bool bIsValid = true);
+ void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt);
+
+ bool IsContinuousNumbering()const
+ {return bContinuousNumbering;}
+ void SetContinuousNumbering(bool bSet)
+ {bContinuousNumbering = bSet;}
+
+ sal_uInt16 GetLevelCount() const {return nLevelCount;}
+ bool IsFeatureSupported(SvxNumRuleFlags nFeature) const
+ { return bool(nFeatureFlags & nFeature); }
+ SvxNumRuleFlags GetFeatureFlags() const {return nFeatureFlags;}
+ void SetFeatureFlag( SvxNumRuleFlags nFlag, bool bSet = true ) { if(bSet) nFeatureFlags |= nFlag; else nFeatureFlags &= ~nFlag; }
+
+ OUString MakeNumString( const SvxNodeNum& ) const;
+
+ SvxNumRuleType GetNumRuleType() const { return eNumberingType; }
+
+ void UnLinkGraphics();
+};
+
+class EDITENG_DLLPUBLIC SvxNumBulletItem final : public SfxPoolItem
+{
+ SvxNumRule maNumRule;
+public:
+ explicit SvxNumBulletItem(SvxNumRule const & rRule);
+ explicit SvxNumBulletItem(SvxNumRule && rRule);
+ SvxNumBulletItem(SvxNumRule const & rRule, sal_uInt16 nWhich );
+ SvxNumBulletItem(SvxNumRule && rRule, sal_uInt16 nWhich );
+ SvxNumBulletItem(const SvxNumBulletItem& rCopy);
+ virtual ~SvxNumBulletItem() override;
+
+ virtual SvxNumBulletItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ const SvxNumRule& GetNumRule() const { return maNumRule; }
+ SvxNumRule& GetNumRule() { return maNumRule; }
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+class SvxNodeNum
+{
+ sal_uInt16 nLevelVal[ SVX_MAX_NUM ] = {}; // Numbers of all levels
+ sal_uInt8 nMyLevel = 0; // Current Level
+
+public:
+ explicit inline SvxNodeNum() = default;
+ inline SvxNodeNum& operator=( const SvxNodeNum& rCpy );
+
+ sal_uInt8 GetLevel() const { return nMyLevel; }
+ void SetLevel( sal_uInt8 nVal ) { nMyLevel = nVal; }
+
+ const sal_uInt16* GetLevelVal() const { return nLevelVal; }
+ sal_uInt16* GetLevelVal() { return nLevelVal; }
+};
+
+inline SvxNodeNum& SvxNodeNum::operator=( const SvxNodeNum& rCpy )
+{
+ if ( &rCpy != this)
+ {
+ nMyLevel = rCpy.nMyLevel;
+
+ memcpy( nLevelVal, rCpy.nLevelVal, sizeof( nLevelVal ) );
+ }
+ return *this;
+}
+
+SvxNumRule SvxConvertNumRule( const SvxNumRule& rRule, sal_uInt16 nLevel, SvxNumRuleType eType );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/opaqitem.hxx b/include/editeng/opaqitem.hxx
new file mode 100644
index 000000000..d38747747
--- /dev/null
+++ b/include/editeng/opaqitem.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_OPAQITEM_HXX
+#define INCLUDED_EDITENG_OPAQITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxOpaqueItem ---------------------------------------------------
+
+
+/* [Description]
+
+ This item describes a logical variable "Opaque yes or no."
+*/
+
+class EDITENG_DLLPUBLIC SvxOpaqueItem final : public SfxBoolItem
+{
+public:
+ explicit SvxOpaqueItem( const sal_uInt16 nId , const bool bOpa = true );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxOpaqueItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+inline SvxOpaqueItem::SvxOpaqueItem( const sal_uInt16 nId, const bool bOpa )
+ : SfxBoolItem( nId, bOpa )
+{}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/optitems.hxx b/include/editeng/optitems.hxx
new file mode 100644
index 000000000..f4cbd2df8
--- /dev/null
+++ b/include/editeng/optitems.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_OPTITEMS_HXX
+#define INCLUDED_EDITENG_OPTITEMS_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SfxHyphenRegionItem ---------------------------------------------
+
+class EDITENG_DLLPUBLIC SfxHyphenRegionItem final : public SfxPoolItem
+{
+ sal_uInt8 nMinLead;
+ sal_uInt8 nMinTrail;
+
+public:
+
+ SfxHyphenRegionItem( const sal_uInt16 nId );
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SfxHyphenRegionItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ sal_uInt8 &GetMinLead() { return nMinLead; }
+ sal_uInt8 GetMinLead() const { return nMinLead; }
+
+ sal_uInt8 &GetMinTrail() { return nMinTrail; }
+ sal_uInt8 GetMinTrail() const { return nMinTrail; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/orphitem.hxx b/include/editeng/orphitem.hxx
new file mode 100644
index 000000000..4181e7c74
--- /dev/null
+++ b/include/editeng/orphitem.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_ORPHITEM_HXX
+#define INCLUDED_EDITENG_ORPHITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxOrphansItem --------------------------------------------------
+
+/* [Description]
+
+ This item describes the number of lines for the orphans system.
+*/
+
+class EDITENG_DLLPUBLIC SvxOrphansItem final : public SfxByteItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxOrphansItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxOrphansItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
new file mode 100644
index 000000000..ab24be0b1
--- /dev/null
+++ b/include/editeng/outliner.hxx
@@ -0,0 +1,989 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_OUTLINER_HXX
+#define INCLUDED_EDITENG_OUTLINER_HXX
+
+#include <editeng/editdata.hxx>
+#include <editeng/editstat.hxx>
+#include <editeng/overflowingtxt.hxx>
+#include <i18nlangtag/lang.h>
+#include <rtl/ustring.hxx>
+#include <svl/SfxBroadcaster.hxx>
+#include <svl/languageoptions.hxx>
+#include <svl/undo.hxx>
+#include <tools/gen.hxx>
+#include <tools/color.hxx>
+#include <utility>
+#include <vcl/outdev.hxx>
+#include <vcl/errcode.hxx>
+#include <tools/link.hxx>
+#include <editeng/editengdllapi.h>
+
+#include <vcl/GraphicObject.hxx>
+
+#include <editeng/svxfont.hxx>
+#include <editeng/eedata.hxx>
+#include <editeng/paragraphdata.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <optional>
+#include <functional>
+#include <memory>
+#include <vector>
+
+class OutlinerEditEng;
+class Outliner;
+class EditView;
+class EditUndo;
+class ParagraphList;
+class OutlinerParaObject;
+class SvStream;
+class SvxSearchItem;
+class SvxFieldItem;
+namespace vcl { class Window; }
+namespace weld { class Widget; }
+class KeyEvent;
+class MouseEvent;
+class CommandEvent;
+class MapMode;
+class SfxStyleSheetPool;
+class SfxStyleSheet;
+class SfxItemPool;
+class SfxItemSet;
+class SvxNumberFormat;
+class EditEngine;
+class SvKeyValueIterator;
+class SvxForbiddenCharactersTable;
+class OutlinerViewShell;
+enum class CharCompressType;
+enum class TransliterationFlags;
+class SvxFieldData;
+enum class PointerStyle;
+class SvxNumRule;
+enum class TextRotation;
+
+namespace com::sun::star::linguistic2 {
+ class XSpellChecker1;
+ class XHyphenator;
+}
+namespace svx{
+ struct SpellPortion;
+ typedef std::vector<SpellPortion> SpellPortions;
+}
+namespace basegfx { class B2DPolyPolygon; }
+namespace com::sun::star::lang { struct Locale; }
+
+
+
+// internal use only!
+enum class ParaFlag
+{
+ NONE = 0x0000,
+ HOLDDEPTH = 0x4000,
+ SETBULLETTEXT = 0x8000,
+ ISPAGE = 0x0100,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ParaFlag> : is_typed_flags<ParaFlag, 0xc100> {};
+}
+
+// Undo-Action-Ids
+#define OLUNDO_DEPTH EDITUNDO_USER
+// #define OLUNDO_HEIGHT EDITUNDO_USER+1
+#define OLUNDO_EXPAND EDITUNDO_USER+2
+#define OLUNDO_COLLAPSE EDITUNDO_USER+3
+// #define OLUNDO_REMOVE EDITUNDO_USER+4
+#define OLUNDO_ATTR EDITUNDO_USER+5
+#define OLUNDO_INSERT EDITUNDO_USER+6
+// #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7
+
+class Paragraph : protected ParagraphData
+{
+private:
+ friend class Outliner;
+ friend class ParagraphList;
+ friend class OutlinerView;
+ friend class OutlinerParaObject;
+ friend class OutlinerEditEng;
+ friend class OutlinerUndoCheckPara;
+ friend class OutlinerUndoChangeParaFlags;
+
+ Paragraph& operator=(const Paragraph& rPara ) = delete;
+
+ OUString aBulText;
+ Size aBulSize;
+ ParaFlag nFlags;
+ bool bVisible;
+
+ bool IsVisible() const { return bVisible; }
+ void SetText( const OUString& rText ) { aBulText = rText; aBulSize.setWidth(-1); }
+ void Invalidate() { aBulSize.setWidth(-1); }
+ void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.setWidth(-1); }
+ const OUString& GetText() const { return aBulText; }
+
+ Paragraph( sal_Int16 nDepth );
+ Paragraph( const Paragraph& ) = delete;
+ Paragraph( const ParagraphData& );
+
+ sal_Int16 GetDepth() const { return nDepth; }
+
+ sal_Int16 GetNumberingStartValue() const { return mnNumberingStartValue; }
+ void SetNumberingStartValue( sal_Int16 nNumberingStartValue );
+
+ bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; }
+ void SetParaIsNumberingRestart( bool bParaIsNumberingRestart );
+
+ void SetFlag( ParaFlag nFlag ) { nFlags |= nFlag; }
+ void RemoveFlag( ParaFlag nFlag ) { nFlags &= ~nFlag; }
+ bool HasFlag( ParaFlag nFlag ) const { return bool(nFlags & nFlag); }
+public:
+ ~Paragraph();
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+};
+
+struct ParaRange
+{
+ sal_Int32 nStartPara;
+ sal_Int32 nEndPara;
+
+ ParaRange( sal_Int32 nS, sal_Int32 nE ) : nStartPara(nS), nEndPara(nE) {}
+
+ void Adjust();
+};
+
+inline void ParaRange::Adjust()
+{
+ if ( nStartPara > nEndPara )
+ {
+ std::swap(nStartPara, nEndPara);
+ }
+}
+
+class EDITENG_DLLPUBLIC OutlinerView final
+{
+ friend class Outliner;
+
+ Outliner* pOwner;
+ std::unique_ptr<EditView> pEditView;
+
+ enum class MouseTarget {
+ Text = 0,
+ Bullet = 1,
+ Hypertext = 2, // Outside OutputArea
+ Outside = 3 // Outside OutputArea
+ };
+
+ EDITENG_DLLPRIVATE void ImplExpandOrCollaps( sal_Int32 nStartPara, sal_Int32 nEndPara, bool bExpand );
+
+ EDITENG_DLLPRIVATE sal_Int32 ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget);
+ EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph const * pParentPara );
+ EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( bool bIncludeHiddenChildren );
+
+ EDITENG_DLLPRIVATE sal_Int32 ImpInitPaste( sal_Int32& rStart );
+ EDITENG_DLLPRIVATE void ImpPasted( sal_Int32 nStart, sal_Int32 nPrevParaCount, sal_Int32 nSize);
+ EDITENG_DLLPRIVATE sal_Int32 ImpCalcSelectedPages( bool bIncludeFirstSelected );
+
+ Link<LinkParamNone*,void> aEndCutPasteLink;
+
+public:
+ OutlinerView( Outliner* pOut, vcl::Window* pWindow );
+ ~OutlinerView();
+
+ EditView& GetEditView() const { return *pEditView; }
+
+ void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll );
+
+ void Paint( const tools::Rectangle& rRect, OutputDevice* pTargetDevice = nullptr );
+ bool PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFrameWin = nullptr );
+ bool MouseButtonDown( const MouseEvent& );
+ bool MouseButtonUp( const MouseEvent& );
+ void ReleaseMouse();
+ bool MouseMove( const MouseEvent& );
+
+ void ShowCursor( bool bGotoCursor = true, bool bActivate = false );
+ void HideCursor( bool bDeactivate = false );
+
+ Outliner* GetOutliner() const { return pOwner; }
+
+ void SetWindow( vcl::Window* pWindow );
+ vcl::Window* GetWindow() const;
+
+ void SetReadOnly( bool bReadOnly );
+ bool IsReadOnly() const;
+
+ void SetOutputArea( const tools::Rectangle& rRect );
+ tools::Rectangle const & GetOutputArea() const;
+
+ tools::Rectangle GetVisArea() const;
+
+ void CreateSelectionList (std::vector<Paragraph*> &aSelList) ;
+
+ void Select( Paragraph const * pParagraph, bool bSelect = true);
+
+ OUString GetSelected() const;
+ void SelectRange( sal_Int32 nFirst, sal_Int32 nCount );
+ void SetAttribs( const SfxItemSet& );
+ void Indent( short nDiff );
+ void AdjustDepth( short nDX ); // Later replace with Indent!
+
+ void AdjustHeight( tools::Long nDY );
+
+ void Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs );
+
+ void InsertText( const OUString& rNew, bool bSelect = false );
+ void InsertText( const OutlinerParaObject& rParaObj );
+ void Expand();
+ void Collapse();
+ void ExpandAll();
+ void CollapseAll();
+
+ void SetBackgroundColor( const Color& rColor );
+ Color const & GetBackgroundColor() const;
+
+ /// Informs this edit view about which view shell contains it.
+ void RegisterViewShell(OutlinerViewShell* pViewShell);
+
+ SfxItemSet GetAttribs();
+
+ void Cut();
+ void Copy();
+ void Paste( bool bUseSpecial = false );
+ void PasteSpecial();
+
+ const SfxStyleSheet* GetStyleSheet() const;
+ SfxStyleSheet* GetStyleSheet();
+
+ void SetControlWord( EVControlBits nWord );
+ EVControlBits GetControlWord() const;
+
+ void SetAnchorMode( EEAnchorMode eMode );
+ EEAnchorMode GetAnchorMode() const;
+
+ PointerStyle GetPointer( const Point& rPosPixel );
+ bool Command(const CommandEvent& rCEvt);
+
+ void StartSpeller(weld::Widget* pDialogParent);
+ EESpellState StartThesaurus(weld::Widget* pDialogParent);
+ sal_Int32 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
+
+ // for text conversion
+ void StartTextConversion(weld::Widget* pDialogParent, LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc);
+
+ void TransliterateText( TransliterationFlags nTransliterationMode );
+
+ ESelection GetSelection() const;
+
+ SvtScriptType GetSelectedScriptType() const;
+
+ void SetVisArea( const tools::Rectangle& rRect );
+ void SetSelection( const ESelection& );
+ void GetSelectionRectangles(std::vector<tools::Rectangle>& rLogicRects) const;
+
+ void RemoveAttribs( bool bRemoveParaAttribs, bool bKeepLanguages = false );
+ void RemoveAttribsKeepLanguages( bool bRemoveParaAttribs );
+ bool HasSelection() const;
+
+ void InsertField( const SvxFieldItem& rFld );
+ const SvxFieldItem* GetFieldUnderMousePointer() const;
+ const SvxFieldItem* GetFieldAtSelection() const;
+ /// Return the field at the current cursor position or nullptr if no field found
+ const SvxFieldData* GetFieldAtCursor() const;
+ /// Select the field at the current cursor position
+ void SelectFieldAtCursor();
+
+ /** enables bullets for the selected paragraphs if the bullets/numbering of the first paragraph is off
+ or disables bullets/numbering for the selected paragraphs if the bullets/numbering of the first paragraph is on
+ */
+ void ToggleBullets();
+
+ void ToggleBulletsNumbering(
+ const bool bToggle,
+ const bool bHandleBullets,
+ const SvxNumRule* pNumRule );
+
+ /** apply bullets/numbering for paragraphs
+
+ @param boolean bHandleBullets
+ true: handle bullets
+ false: handle numbering
+
+ @param pNewNumRule
+ numbering rule which needs to be applied. can be 0.
+
+ @param boolean bAtSelection
+ true: apply bullets/numbering at selected paragraphs
+ false: apply bullets/numbering at all paragraphs
+ */
+ void ApplyBulletsNumbering(
+ const bool bHandleBullets,
+ const SvxNumRule* pNewNumRule,
+ const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule,
+ const bool bAtSelection = false );
+
+ /** switch off bullets/numbering for paragraphs
+
+ @param boolean bAtSelection
+ true: switch off bullets/numbering at selected paragraphs
+ false: switch off bullets/numbering at all paragraphs
+ */
+ void SwitchOffBulletsNumbering(
+ const bool bAtSelection = false );
+
+ /** enables numbering for the selected paragraphs that are not enabled and ignore all selected
+ paragraphs that already have numbering enabled.
+ */
+ void EnsureNumberingIsOn();
+
+ bool IsCursorAtWrongSpelledWord();
+ bool IsWrongSpelledWordAtPos( const Point& rPosPixel );
+ void ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void>& rCallBack);
+
+ void SetInvalidateMore( sal_uInt16 nPixel );
+ sal_uInt16 GetInvalidateMore() const;
+
+ OUString GetSurroundingText() const;
+ Selection GetSurroundingTextSelection() const;
+ bool DeleteSurroundingText(const Selection& rRange);
+
+ void SetEndCutPasteLinkHdl(const Link<LinkParamNone*,void> &rLink) { aEndCutPasteLink = rLink; }
+};
+
+/// Interface class to not depend on SfxViewShell in editeng.
+class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI OutlinerViewShell
+{
+public:
+ virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const = 0;
+ virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const = 0;
+ virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const = 0;
+ virtual void libreOfficeKitViewUpdatedCallback(int nType) const = 0;
+ virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const = 0;
+ virtual ViewShellId GetViewShellId() const = 0;
+ virtual ViewShellDocId GetDocId() const = 0;
+ /// Wrapper around SfxLokHelper::notifyOtherViews().
+ virtual void NotifyOtherViews(int nType, const OString& rKey, const OString& rPayload) = 0;
+ /// Wrapper around SfxLokHelper::notifyOtherView().
+ virtual void NotifyOtherView(OutlinerViewShell* pOtherShell, int nType, const OString& rKey, const OString& rPayload) = 0;
+ virtual vcl::Window* GetEditWindowForActiveOLEObj() const = 0;
+
+protected:
+ ~OutlinerViewShell() noexcept {}
+};
+
+// some thesaurus functionality to avoid code duplication in different projects...
+bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( OUString &rStatusVal, LanguageType &rLang, const EditView &rEditView );
+void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const OUString &rSynonmText );
+
+typedef ::std::vector< OutlinerView* > ViewList;
+
+class EDITENG_DLLPUBLIC DrawPortionInfo
+{
+public:
+ const Point& mrStartPos;
+ const OUString maText;
+ sal_Int32 mnTextStart;
+ sal_Int32 mnTextLen;
+ sal_Int32 mnPara;
+ const SvxFont& mrFont;
+ o3tl::span<const sal_Int32> mpDXArray;
+
+ const EEngineData::WrongSpellVector* mpWrongSpellVector;
+ const SvxFieldData* mpFieldData;
+ const css::lang::Locale* mpLocale;
+ const Color maOverlineColor;
+ const Color maTextLineColor;
+
+ sal_uInt8 mnBiDiLevel;
+
+ bool mbFilled;
+ tools::Long mnWidthToFill;
+
+ bool mbEndOfLine : 1;
+ bool mbEndOfParagraph : 1;
+ bool mbEndOfBullet : 1;
+
+ bool IsRTL() const { return mnBiDiLevel % 2 == 1; }
+
+ DrawPortionInfo(
+ const Point& rPos,
+ OUString aTxt,
+ sal_Int32 nTxtStart,
+ sal_Int32 nTxtLen,
+ const SvxFont& rFnt,
+ sal_Int32 nPar,
+ o3tl::span<const sal_Int32> pDXArr,
+ const EEngineData::WrongSpellVector* pWrongSpellVector,
+ const SvxFieldData* pFieldData,
+ const css::lang::Locale* pLocale,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor,
+ sal_uInt8 nBiDiLevel,
+ bool bFilled,
+ tools::Long nWidthToFill,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ bool bEndOfBullet)
+ : mrStartPos(rPos),
+ maText(std::move(aTxt)),
+ mnTextStart(nTxtStart),
+ mnTextLen(nTxtLen),
+ mnPara(nPar),
+ mrFont(rFnt),
+ mpDXArray(pDXArr),
+ mpWrongSpellVector(pWrongSpellVector),
+ mpFieldData(pFieldData),
+ mpLocale(pLocale),
+ maOverlineColor(rOverlineColor),
+ maTextLineColor(rTextLineColor),
+ mnBiDiLevel(nBiDiLevel),
+ mbFilled( bFilled ),
+ mnWidthToFill( nWidthToFill ),
+ mbEndOfLine(bEndOfLine),
+ mbEndOfParagraph(bEndOfParagraph),
+ mbEndOfBullet(bEndOfBullet)
+ {}
+};
+
+class EDITENG_DLLPUBLIC DrawBulletInfo
+{
+public:
+ const GraphicObject maBulletGraphicObject;
+ Point maBulletPosition;
+ Size maBulletSize;
+
+ DrawBulletInfo(
+ const GraphicObject& rBulletGraphicObject,
+ const Point& rBulletPosition,
+ const Size& rBulletSize)
+ : maBulletGraphicObject(rBulletGraphicObject),
+ maBulletPosition(rBulletPosition),
+ maBulletSize(rBulletSize)
+ {}
+};
+
+struct EDITENG_DLLPUBLIC PaintFirstLineInfo
+{
+ sal_Int32 mnPara;
+ const Point& mrStartPos;
+ VclPtr<OutputDevice> mpOutDev;
+
+ PaintFirstLineInfo( sal_Int32 nPara, const Point& rStartPos, OutputDevice* pOutDev )
+ : mnPara( nPara ), mrStartPos( rStartPos ), mpOutDev( pOutDev )
+ {}
+};
+
+class SdrPage;
+
+class EditFieldInfo
+{
+private:
+ Outliner* pOutliner;
+ const SvxFieldItem& rFldItem;
+
+ std::optional<Color> mxTxtColor;
+ std::optional<Color> mxFldColor;
+
+ OUString aRepresentation;
+
+ sal_Int32 nPara;
+ sal_Int32 nPos;
+
+ EditFieldInfo( const EditFieldInfo& ) = delete;
+
+ SdrPage* mpSdrPage;
+
+public:
+ EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, sal_Int32 nPa, sal_Int32 nPo )
+ : rFldItem( rFItem )
+ {
+ pOutliner = pOutl;
+ nPara = nPa; nPos = nPo;
+ mpSdrPage = nullptr;
+ }
+
+ Outliner* GetOutliner() const { return pOutliner; }
+
+ const SvxFieldItem& GetField() const { return rFldItem; }
+
+ std::optional<Color> const & GetTextColor() const { return mxTxtColor; }
+ void SetTextColor( std::optional<Color> xCol ) { mxTxtColor = xCol; }
+
+ std::optional<Color> const & GetFieldColor() const { return mxFldColor; }
+ void SetFieldColor( std::optional<Color> xCol ) { mxFldColor = xCol; }
+
+ sal_Int32 GetPara() const { return nPara; }
+ sal_Int32 GetPos() const { return nPos; }
+
+ const OUString& GetRepresentation() const { return aRepresentation; }
+ OUString& GetRepresentation() { return aRepresentation; }
+ void SetRepresentation( const OUString& rStr ){ aRepresentation = rStr; }
+
+ void SetSdrPage( SdrPage* pPage ) { mpSdrPage = pPage; }
+ SdrPage* GetSdrPage() const { return mpSdrPage; }
+};
+
+ struct EBulletInfo
+{
+ SvxFont aFont;
+ tools::Rectangle aBounds;
+ OUString aText;
+ sal_Int32 nParagraph;
+ sal_uInt16 nType; // see SvxNumberType
+ bool bVisible;
+
+ EBulletInfo() : nParagraph( EE_PARA_NOT_FOUND ), nType( 0 ), bVisible( false ) {}
+};
+
+enum class OutlinerMode {
+ DontKnow = 0x0000,
+ TextObject = 0x0001,
+ TitleObject = 0x0002,
+ OutlineObject = 0x0003,
+ OutlineView = 0x0004
+};
+
+class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster
+{
+public:
+ struct ParagraphHdlParam { Outliner* pOutliner; Paragraph* pPara; };
+ struct DepthChangeHdlParam { Outliner* pOutliner; Paragraph* pPara; ParaFlag nPrevFlags; };
+private:
+ friend class OutlinerView;
+ friend class OutlinerEditEng;
+ friend class OutlinerParaObject;
+ friend class OLUndoExpand;
+ friend class OutlinerUndoChangeDepth;
+ friend class OutlinerUndoCheckPara;
+ friend class OutlinerUndoChangeParaFlags;
+
+ friend class TextChainingUtils;
+
+ std::unique_ptr<OutlinerEditEng> pEditEngine;
+
+ std::unique_ptr<ParagraphList> pParaList;
+ ViewList aViewList;
+
+ sal_Int32 mnFirstSelPage;
+ Link<DrawPortionInfo*,void> aDrawPortionHdl;
+ Link<DrawBulletInfo*,void> aDrawBulletHdl;
+ Link<ParagraphHdlParam,void> aParaInsertedHdl;
+ Link<ParagraphHdlParam,void> aParaRemovingHdl;
+ Link<DepthChangeHdlParam,void> aDepthChangedHdl;
+ Link<Outliner*,void> aBeginMovingHdl;
+ Link<Outliner*,void> aEndMovingHdl;
+ Link<OutlinerView*,bool> aIndentingPagesHdl;
+ Link<OutlinerView*,bool> aRemovingPagesHdl;
+ Link<EditFieldInfo*,void> aCalcFieldValueHdl;
+ Link<PaintFirstLineInfo*,void> maPaintFirstLineHdl;
+ Link<PasteOrDropInfos*,void> maBeginPasteOrDropHdl;
+ Link<PasteOrDropInfos*,void> maEndPasteOrDropHdl;
+
+ sal_Int32 nDepthChangedHdlPrevDepth;
+ sal_Int16 nMaxDepth;
+ static constexpr sal_Int16 gnMinDepth = -1;
+
+ OutlinerMode nOutlinerMode;
+
+ bool bFirstParaIsEmpty;
+ sal_uInt8 nBlockInsCallback;
+ bool bStrippingPortions;
+ bool bPasting;
+
+ DECL_DLLPRIVATE_LINK( ParaVisibleStateChangedHdl, Paragraph&, void );
+ DECL_DLLPRIVATE_LINK( BeginMovingParagraphsHdl, MoveParagraphsInfo&, void );
+ DECL_DLLPRIVATE_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo&, void );
+ DECL_DLLPRIVATE_LINK( BeginPasteOrDropHdl, PasteOrDropInfos&, void );
+ DECL_DLLPRIVATE_LINK( EndPasteOrDropHdl, PasteOrDropInfos&, void );
+ DECL_DLLPRIVATE_LINK( EditEngineNotifyHdl, EENotify&, void );
+ void ImplCheckParagraphs( sal_Int32 nStart, sal_Int32 nEnd );
+ bool ImplHasNumberFormat( sal_Int32 nPara ) const;
+ Size ImplGetBulletSize( sal_Int32 nPara );
+ sal_uInt16 ImplGetNumbering( sal_Int32 nPara, const SvxNumberFormat* pParaFmt );
+ void ImplCalcBulletText( sal_Int32 nPara, bool bRecalcLevel, bool bRecalcChildren );
+ OUString ImplGetBulletText( sal_Int32 nPara );
+ void ImplCheckNumBulletItem( sal_Int32 nPara );
+ void ImplInitDepth( sal_Int32 nPara, sal_Int16 nDepth, bool bCreateUndo );
+ void ImplSetLevelDependentStyleSheet( sal_Int32 nPara );
+
+ void ImplBlockInsertionCallbacks( bool b );
+
+ void ImpFilterIndents( sal_Int32 nFirstPara, sal_Int32 nLastPara );
+ bool ImpConvertEdtToOut( sal_Int32 nPara );
+
+ void ImpTextPasted( sal_Int32 nStartPara, sal_Int32 nCount );
+ vcl::Font ImpCalcBulletFont( sal_Int32 nPara ) const;
+ tools::Rectangle ImpCalcBulletArea( sal_Int32 nPara, bool bAdjust, bool bReturnPaperPos );
+ bool ImpCanIndentSelectedPages( OutlinerView* pCurView );
+ bool ImpCanDeleteSelectedPages( OutlinerView* pCurView );
+ bool ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_Int32 nFirstPage, sal_Int32 nPages );
+
+ void ImplCheckDepth( sal_Int16& rnDepth ) const;
+
+protected:
+ void ParagraphInserted( sal_Int32 nParagraph );
+ void ParagraphDeleted( sal_Int32 nParagraph );
+ void ParaAttribsChanged( sal_Int32 nParagraph );
+
+ void StyleSheetChanged( SfxStyleSheet const * pStyle );
+
+ void InvalidateBullet(sal_Int32 nPara);
+ void PaintBullet(sal_Int32 nPara, const Point& rStartPos,
+ const Point& rOrigin, Degree10 nOrientation,
+ OutputDevice& rOutDev);
+
+ // used by OutlinerEditEng. Allows Outliner objects to provide
+ // bullet access to the EditEngine.
+ const SvxNumberFormat* GetNumberFormat( sal_Int32 nPara ) const;
+
+public:
+
+ Outliner( SfxItemPool* pPool, OutlinerMode nMode );
+ virtual ~Outliner() override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+ void Init( OutlinerMode nMode );
+
+ void SetVertical( bool bVertical);
+ void SetRotation(TextRotation nRotation);
+ bool IsVertical() const;
+ bool IsTopToBottom() const;
+
+ void SetTextColumns(sal_Int16 nColumns, sal_Int32 nSpacing);
+
+ void SetFixedCellHeight( bool bUseFixedCellHeight );
+
+ void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
+ EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
+
+ LanguageType GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const;
+
+ void SetAsianCompressionMode( CharCompressType nCompressionMode );
+
+ void SetKernAsianPunctuation( bool bEnabled );
+
+ void SetAddExtLeading( bool b );
+
+ size_t InsertView( OutlinerView* pView, size_t nIndex = size_t(-1) );
+ void RemoveView( OutlinerView const * pView );
+ void RemoveView( size_t nIndex );
+ OutlinerView* GetView( size_t nIndex ) const;
+ size_t GetViewCount() const;
+
+ Paragraph* Insert( const OUString& rText, sal_Int32 nAbsPos = EE_PARA_APPEND, sal_Int16 nDepth = 0 );
+ void SetText( const OutlinerParaObject& );
+ void AddText( const OutlinerParaObject&, bool bAppend = false );
+ void SetText( const OUString& rText, Paragraph* pParagraph );
+ OUString GetText( Paragraph const * pPara, sal_Int32 nParaCount=1 ) const;
+
+ void SetToEmptyText();
+
+ std::optional<OutlinerParaObject> CreateParaObject( sal_Int32 nStartPara = 0, sal_Int32 nParaCount = EE_PARA_ALL ) const;
+
+ const SfxItemSet& GetEmptyItemSet() const;
+
+ void SetRefMapMode( const MapMode& );
+ MapMode const & GetRefMapMode() const;
+
+ void SetBackgroundColor( const Color& rColor );
+ Color const & GetBackgroundColor() const;
+
+ void SetMaxDepth( sal_Int16 nDepth );
+ sal_Int16 GetMaxDepth() const { return nMaxDepth; }
+
+ /// @return previous value of bUpdateLayout state
+ bool SetUpdateLayout( bool bUpdate );
+ bool IsUpdateLayout() const;
+
+ void Clear();
+
+ void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich );
+
+ sal_Int32 GetParagraphCount() const;
+ Paragraph* GetParagraph( sal_Int32 nAbsPos ) const;
+
+ bool HasChildren( Paragraph const * pParagraph ) const;
+ sal_Int32 GetChildCount( Paragraph const * pParent ) const;
+ bool IsExpanded( Paragraph const * pPara ) const;
+ Paragraph* GetParent( Paragraph const * pParagraph ) const;
+ sal_Int32 GetAbsPos( Paragraph const * pPara ) const;
+
+ sal_Int16 GetDepth( sal_Int32 nPara ) const;
+ void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth );
+
+ void EnableUndo( bool bEnable );
+ bool IsUndoEnabled() const;
+ void UndoActionStart( sal_uInt16 nId );
+ void UndoActionEnd();
+ void InsertUndo( std::unique_ptr<EditUndo> pUndo );
+ bool IsInUndo() const;
+
+ void ClearModifyFlag();
+ bool IsModified() const;
+
+ void ParagraphInsertedHdl(Paragraph*);
+ void SetParaInsertedHdl(const Link<ParagraphHdlParam,void>& rLink){aParaInsertedHdl=rLink;}
+ const Link<ParagraphHdlParam,void>& GetParaInsertedHdl() const { return aParaInsertedHdl; }
+
+ void SetParaRemovingHdl(const Link<ParagraphHdlParam,void>& rLink){aParaRemovingHdl=rLink;}
+ const Link<ParagraphHdlParam,void>& GetParaRemovingHdl() const { return aParaRemovingHdl; }
+
+ std::optional<NonOverflowingText> GetNonOverflowingText() const;
+ std::optional<OverflowingText> GetOverflowingText() const;
+ void ClearOverflowingParaNum();
+ bool IsPageOverflow();
+
+ OutlinerParaObject GetEmptyParaObject() const;
+
+
+ void DepthChangedHdl(Paragraph*, ParaFlag nPrevFlags);
+ void SetDepthChangedHdl(const Link<DepthChangeHdlParam,void>& rLink){aDepthChangedHdl=rLink;}
+ const Link<DepthChangeHdlParam,void>& GetDepthChangedHdl() const { return aDepthChangedHdl; }
+ sal_Int16 GetPrevDepth() const { return static_cast<sal_Int16>(nDepthChangedHdlPrevDepth); }
+
+ bool RemovingPagesHdl( OutlinerView* );
+ void SetRemovingPagesHdl(const Link<OutlinerView*,bool>& rLink){aRemovingPagesHdl=rLink;}
+ bool IndentingPagesHdl( OutlinerView* );
+ void SetIndentingPagesHdl(const Link<OutlinerView*,bool>& rLink){aIndentingPagesHdl=rLink;}
+ // valid only in the two upper handlers
+ sal_Int32 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; }
+
+ void SetCalcFieldValueHdl(const Link<EditFieldInfo*,void>& rLink ) { aCalcFieldValueHdl= rLink; }
+ const Link<EditFieldInfo*,void>& GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; }
+
+ void SetDrawPortionHdl(const Link<DrawPortionInfo*,void>& rLink){aDrawPortionHdl=rLink;}
+
+ void SetDrawBulletHdl(const Link<DrawBulletInfo*,void>& rLink){aDrawBulletHdl=rLink;}
+
+ void SetPaintFirstLineHdl(const Link<PaintFirstLineInfo*,void>& rLink) { maPaintFirstLineHdl = rLink; }
+
+ void SetModifyHdl( const Link<LinkParamNone*,void>& rLink );
+ Link<LinkParamNone*,void> const & GetModifyHdl() const;
+
+ void SetNotifyHdl( const Link<EENotify&,void>& rLink );
+
+ void SetStatusEventHdl( const Link<EditStatus&, void>& rLink );
+ Link<EditStatus&, void> const & GetStatusEventHdl() const;
+
+ void Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect );
+ void Draw( OutputDevice& rOutDev, const Point& rStartPos );
+
+ const Size& GetPaperSize() const;
+ void SetPaperSize( const Size& rSize );
+
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
+ void ClearPolygon();
+
+ const Size& GetMinAutoPaperSize() const;
+ void SetMinAutoPaperSize( const Size& rSz );
+
+ const Size& GetMaxAutoPaperSize() const;
+ void SetMaxAutoPaperSize( const Size& rSz );
+
+ void SetMinColumnWrapHeight(tools::Long nVal);
+
+ void SetDefTab( sal_uInt16 nTab );
+
+ bool IsFlatMode() const;
+ void SetFlatMode( bool bFlat );
+
+ void EnableAutoColor( bool b );
+
+ void ForceAutoColor( bool b );
+ bool IsForceAutoColor() const;
+
+ EBulletInfo GetBulletInfo( sal_Int32 nPara );
+
+ void SetWordDelimiters( const OUString& rDelimiters );
+ OUString const & GetWordDelimiters() const;
+ OUString GetWord( sal_Int32 nPara, sal_Int32 nIndex );
+
+ void StripPortions();
+
+ void DrawingText( const Point& rStartPos, const OUString& rText,
+ sal_Int32 nTextStart, sal_Int32 nTextLen,
+ o3tl::span<const sal_Int32> pDXArray, const SvxFont& rFont,
+ sal_Int32 nPara, sal_uInt8 nRightToLeft,
+ const EEngineData::WrongSpellVector* pWrongSpellVector,
+ const SvxFieldData* pFieldData,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ bool bEndOfBullet,
+ const css::lang::Locale* pLocale,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+
+ void DrawingTab( const Point& rStartPos, tools::Long nWidth, const OUString& rChar,
+ const SvxFont& rFont, sal_Int32 nPara, sal_uInt8 nRightToLeft,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+
+ Size CalcTextSize();
+ Size CalcTextSizeNTP();
+
+ void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
+ SfxStyleSheetPool* GetStyleSheetPool();
+
+ bool IsInSelectionMode() const;
+
+ void SetStyleSheet( sal_Int32 nPara, SfxStyleSheet* pStyle );
+ SfxStyleSheet* GetStyleSheet( sal_Int32 nPara );
+
+ void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& );
+ SfxItemSet const & GetParaAttribs( sal_Int32 nPara ) const;
+
+ void Remove( Paragraph const * pPara, sal_Int32 nParaCount );
+ bool Expand( Paragraph const * );
+ bool Collapse( Paragraph const * );
+
+ void SetParaFlag( Paragraph* pPara, ParaFlag nFlag );
+ static bool HasParaFlag( const Paragraph* pPara, ParaFlag nFlag );
+
+
+ void SetControlWord( EEControlBits nWord );
+ EEControlBits GetControlWord() const;
+
+ const Link<Outliner*,void>& GetBeginMovingHdl() const { return aBeginMovingHdl; }
+ void SetBeginMovingHdl(const Link<Outliner*,void>& rLink) {aBeginMovingHdl=rLink;}
+ const Link<Outliner*,void>& GetEndMovingHdl() const {return aEndMovingHdl;}
+ void SetEndMovingHdl( const Link<Outliner*,void>& rLink){aEndMovingHdl=rLink;}
+
+ sal_uInt32 GetLineCount( sal_Int32 nParagraph ) const;
+ sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const;
+ sal_uInt32 GetLineHeight( sal_Int32 nParagraph );
+
+ ErrCode Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr );
+
+ SfxUndoManager& GetUndoManager();
+ SfxUndoManager* SetUndoManager(SfxUndoManager* pNew);
+
+ void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ void QuickInsertLineBreak( const ESelection& rSel );
+
+ // Only for EditEngine mode
+ void QuickInsertText( const OUString& rText, const ESelection& rSel );
+ void QuickDelete( const ESelection& rSel );
+ /// Set attributes from rSet an all characters of nPara.
+ void SetCharAttribs(sal_Int32 nPara, const SfxItemSet& rSet);
+ void RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich = 0 );
+ void QuickFormatDoc();
+
+ bool UpdateFields();
+ void RemoveFields( const std::function<bool ( const SvxFieldData* )>& isFieldData = [] (const SvxFieldData* ){return true;} );
+
+ virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor );
+
+ void SetSpeller( css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller );
+ css::uno::Reference< css::linguistic2::XSpellChecker1 > const &
+ GetSpeller();
+ void SetHyphenator( css::uno::Reference< css::linguistic2::XHyphenator > const & xHyph );
+
+ static void SetForbiddenCharsTable(const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars);
+
+ // Deprecated
+ void SetDefaultLanguage( LanguageType eLang );
+
+ void CompleteOnlineSpelling();
+
+ EESpellState HasSpellErrors();
+ bool HasText( const SvxSearchItem& rSearchItem );
+ virtual bool SpellNextDocument();
+
+ // for text conversion
+ bool HasConvertibleTextPortion( LanguageType nLang );
+ virtual bool ConvertNextDocument();
+
+ void SetEditTextObjectPool( SfxItemPool* pPool );
+ SfxItemPool* GetEditTextObjectPool() const;
+
+ void SetRefDevice( OutputDevice* pRefDev );
+ OutputDevice* GetRefDevice() const;
+
+ sal_uInt32 GetTextHeight() const;
+ tools::Rectangle GetParaBounds( sal_Int32 nParagraph ) const;
+ Point GetDocPos( const Point& rPaperPos ) const;
+ bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder );
+ bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, bool* pbBulletPos );
+
+ void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 );
+ void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const;
+ void EraseVirtualDevice();
+
+ bool ShouldCreateBigTextObject() const;
+
+ const EditEngine& GetEditEngine() const;
+
+ // this is needed for StarOffice Api
+ void SetLevelDependentStyleSheet( sal_Int32 nPara );
+
+ OutlinerMode GetOutlinerMode() const { return nOutlinerMode; }
+
+ // spell and return a sentence
+ bool SpellSentence(EditView const & rEditView, svx::SpellPortions& rToFill );
+ // put spell position to start of current sentence
+ void PutSpellingToSentenceStart( EditView const & rEditView );
+ // applies a changed sentence
+ void ApplyChangedSentence(EditView const & rEditView, const svx::SpellPortions& rNewPortions, bool bRecheck );
+
+ /** sets a link that is called at the beginning of a drag operation at an edit view */
+ void SetBeginDropHdl( const Link<EditView*,void>& rLink );
+
+ /** sets a link that is called at the end of a drag operation at an edit view */
+ void SetEndDropHdl( const Link<EditView*,void>& rLink );
+
+ /** sets a link that is called before a drop or paste operation. */
+ void SetBeginPasteOrDropHdl( const Link<PasteOrDropInfos*,void>& rLink );
+
+ /** sets a link that is called after a drop or paste operation. */
+ void SetEndPasteOrDropHdl( const Link<PasteOrDropInfos*,void>& rLink );
+
+ sal_Int16 GetNumberingStartValue( sal_Int32 nPara ) const;
+ void SetNumberingStartValue( sal_Int32 nPara, sal_Int16 nNumberingStartValue );
+
+ bool IsParaIsNumberingRestart( sal_Int32 nPara ) const;
+ void SetParaIsNumberingRestart( sal_Int32 nPara, bool bParaIsNumberingRestart );
+
+ /** determine the bullets/numbering status of the given paragraphs
+
+ @param nParaStart
+ index of paragraph at which the check starts
+
+ @param nParaEnd
+ index of paragraph at which the check ends
+
+ @returns
+ 0 : all paragraphs have bullets
+ 1 : all paragraphs have numbering
+ 2 : otherwise
+ */
+ sal_Int32 GetBulletsNumberingStatus(
+ const sal_Int32 nParaStart,
+ const sal_Int32 nParaEnd ) const;
+
+ // convenient method to determine the bullets/numbering status for all paragraphs
+ sal_Int32 GetBulletsNumberingStatus() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/outlobj.hxx b/include/editeng/outlobj.hxx
new file mode 100644
index 000000000..1703cf09c
--- /dev/null
+++ b/include/editeng/outlobj.hxx
@@ -0,0 +1,204 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <editeng/paragraphdata.hxx>
+#include <editeng/editengdllapi.h>
+#include <rtl/ustring.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/style.hxx>
+#include <o3tl/cow_wrapper.hxx>
+#include <stdexcept>
+#include <memory>
+
+class EditTextObject;
+enum class OutlinerMode;
+enum class TextRotation;
+
+/**
+ * This is the guts of OutlinerParaObject, refcounted and shared among
+ * multiple instances of OutlinerParaObject.
+ */
+struct EDITENG_DLLPUBLIC OutlinerParaObjData
+{
+ // data members
+ std::unique_ptr<EditTextObject> mpEditTextObject;
+ ParagraphDataVector maParagraphDataVector;
+ bool mbIsEditDoc;
+
+ // constructor
+ OutlinerParaObjData( std::unique_ptr<EditTextObject> pEditTextObject, ParagraphDataVector&& rParagraphDataVector, bool bIsEditDoc );
+
+ OutlinerParaObjData( const OutlinerParaObjData& r );
+
+ OutlinerParaObjData( OutlinerParaObjData&& r ) = default;
+
+ // assignment operator
+ OutlinerParaObjData& operator=(const OutlinerParaObjData& rCandidate) = delete;
+
+ // destructor
+ ~OutlinerParaObjData();
+
+ bool operator==(const OutlinerParaObjData& rCandidate) const;
+
+ // #i102062#
+ bool isWrongListEqual(const OutlinerParaObjData& rCompare) const;
+};
+
+class EDITENG_DLLPUBLIC OutlinerParaObject
+{
+friend class std::optional<OutlinerParaObject>;
+ ::o3tl::cow_wrapper< OutlinerParaObjData > mpImpl;
+
+ OutlinerParaObject(std::nullopt_t) noexcept
+ : mpImpl(std::nullopt) {}
+ OutlinerParaObject( const OutlinerParaObject& other, std::nullopt_t ) noexcept
+ : mpImpl(other.mpImpl, std::nullopt) {}
+
+public:
+ // constructors/destructor
+ OutlinerParaObject(std::unique_ptr<EditTextObject>, ParagraphDataVector&&, bool bIsEditDoc);
+ OutlinerParaObject( std::unique_ptr<EditTextObject> );
+ OutlinerParaObject( const OutlinerParaObject&);
+ OutlinerParaObject(OutlinerParaObject&&) noexcept;
+ ~OutlinerParaObject();
+
+ // assignment operator
+ OutlinerParaObject& operator=(const OutlinerParaObject& rCandidate);
+ OutlinerParaObject& operator=(OutlinerParaObject&&) noexcept;
+
+ // compare operator
+ bool operator==(const OutlinerParaObject& rCandidate) const;
+ bool operator!=(const OutlinerParaObject& rCandidate) const { return !operator==(rCandidate); }
+
+ // #i102062#
+ bool isWrongListEqual(const OutlinerParaObject& rCompare) const;
+
+ // outliner mode access
+ OutlinerMode GetOutlinerMode() const;
+ void SetOutlinerMode(OutlinerMode nNew);
+
+ // vertical access
+ bool IsEffectivelyVertical() const;
+ bool GetVertical() const;
+ bool IsTopToBottom() const;
+ void SetVertical(bool bNew);
+ void SetRotation(TextRotation nRotation);
+ TextRotation GetRotation() const;
+
+ // data read access
+ sal_Int32 Count() const;
+ sal_Int16 GetDepth(sal_Int32 nPara) const;
+ const EditTextObject& GetTextObject() const;
+ const ParagraphData& GetParagraphData(sal_Int32 nIndex) const;
+
+ // portion info support
+ void ClearPortionInfo();
+
+ // StyleSheet support
+ bool ChangeStyleSheets(std::u16string_view rOldName, SfxStyleFamily eOldFamily,
+ const OUString& rNewName, SfxStyleFamily eNewFamily);
+ void ChangeStyleSheetName(SfxStyleFamily eFamily, std::u16string_view rOldName,
+ const OUString& rNewName);
+ void SetStyleSheets(sal_uInt16 nLevel, const OUString& rNewName,
+ const SfxStyleFamily& rNewFamily);
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+};
+
+namespace std
+{
+ /** Specialise std::optional template for the case where we are wrapping a o3tl::cow_wrapper
+ type, and we can make the pointer inside the cow_wrapper act as an empty value,
+ and save ourselves some storage */
+ template<>
+ class optional<OutlinerParaObject>
+ {
+ public:
+ optional() noexcept : maParaObject(std::nullopt) {}
+ optional(std::nullopt_t) noexcept : maParaObject(std::nullopt) {}
+ optional(const optional& other) :
+ maParaObject(other.maParaObject, std::nullopt) {}
+ optional(optional&& other) noexcept :
+ maParaObject(std::move(other.maParaObject)) {}
+ optional(OutlinerParaObject&& para) noexcept :
+ maParaObject(std::move(para)) {}
+ optional(const OutlinerParaObject& para) noexcept :
+ maParaObject(para) {}
+ template< class... Args >
+ explicit optional( std::in_place_t, Args&&... args ) :
+ maParaObject(std::forward<Args>(args)...) {}
+
+ optional& operator=(optional const & other)
+ {
+ maParaObject = other.maParaObject;
+ return *this;
+ }
+ optional& operator=(optional&& other) noexcept
+ {
+ maParaObject = std::move(other.maParaObject);
+ return *this;
+ }
+ template< class... Args >
+ void emplace(Args&&... args )
+ {
+ maParaObject = OutlinerParaObject(std::forward<Args>(args)...);
+ }
+
+ bool has_value() const noexcept { return !maParaObject.mpImpl.empty(); }
+ explicit operator bool() const noexcept { return !maParaObject.mpImpl.empty(); }
+ void reset() { maParaObject.mpImpl.set_empty(); }
+
+ OutlinerParaObject& value()
+ {
+ throwIfEmpty();
+ return maParaObject;
+ }
+ OutlinerParaObject& operator*()
+ {
+ throwIfEmpty();
+ return maParaObject;
+ }
+ const OutlinerParaObject& operator*() const
+ {
+ throwIfEmpty();
+ return maParaObject;
+ }
+ OutlinerParaObject* operator->()
+ {
+ throwIfEmpty();
+ return &maParaObject;
+ }
+ const OutlinerParaObject* operator->() const
+ {
+ throwIfEmpty();
+ return &maParaObject;
+ }
+ private:
+ void throwIfEmpty() const
+ {
+ if (maParaObject.mpImpl.empty())
+ throw std::logic_error("empty std::optional<OutlinerParaObject>");
+ }
+ OutlinerParaObject maParaObject;
+ };
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx
new file mode 100644
index 000000000..5b95f2d12
--- /dev/null
+++ b/include/editeng/overflowingtxt.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_OVERFLOWINGTXT_HXX
+#define INCLUDED_EDITENG_OVERFLOWINGTXT_HXX
+
+#include <editeng/editengdllapi.h>
+#include <editeng/editdata.hxx>
+
+#include <com/sun/star/uno/Reference.h>
+#include <optional>
+
+namespace com::sun::star {
+ namespace datatransfer { class XTransferable; }
+}
+
+class OutlinerParaObject;
+class Outliner;
+
+
+/*
+ * A collection of static methods for attaching text.
+ * Strongly coupled with some of the classes in this file.
+ */
+class TextChainingUtils
+{
+public:
+ static css::uno::Reference< css::datatransfer::XTransferable> CreateTransferableFromText(Outliner const *);
+
+ static std::optional<OutlinerParaObject> JuxtaposeParaObject(
+ css::uno::Reference< css::datatransfer::XTransferable > const & xOverflowingContent,
+ Outliner *,
+ OutlinerParaObject const *);
+ static std::optional<OutlinerParaObject> DeeplyMergeParaObject(
+ css::uno::Reference< css::datatransfer::XTransferable > const & xOverflowingContent,
+ Outliner *,
+ OutlinerParaObject const *);
+};
+
+/*
+ * The classes OverflowingText and NonOverflowingText handle the
+ * actual preparation of the OutlinerParaObjects to be used in destination
+ * and source box respectively.
+*/
+
+class OverflowingText
+{
+public:
+ OverflowingText(css::uno::Reference< css::datatransfer::XTransferable > xOverflowingContent);
+
+ std::optional<OutlinerParaObject> JuxtaposeParaObject(Outliner *, OutlinerParaObject const *);
+ std::optional<OutlinerParaObject> DeeplyMergeParaObject(Outliner *, OutlinerParaObject const *);
+
+private:
+ css::uno::Reference< css::datatransfer::XTransferable > mxOverflowingContent;
+};
+
+class NonOverflowingText
+{
+public:
+ NonOverflowingText(const ESelection &aSel, bool bLastParaInterrupted);
+
+ std::optional<OutlinerParaObject> RemoveOverflowingText(Outliner *) const;
+ ESelection GetOverflowPointSel() const;
+ bool IsLastParaInterrupted() const;
+
+private:
+ ESelection maContentSel;
+ bool mbLastParaInterrupted;
+};
+
+
+/*
+ * classes OFlowChainedText and UFlowChainedText:
+ * contain and handle the state of a broken up text _after_ a flow event
+ * (respectively after Overflow and Underflow).
+ *
+ */
+class EDITENG_DLLPUBLIC OFlowChainedText
+{
+public:
+ OFlowChainedText(Outliner const *, bool );
+ ~OFlowChainedText();
+
+ std::optional<OutlinerParaObject> InsertOverflowingText(Outliner *, OutlinerParaObject const *);
+ std::optional<OutlinerParaObject> RemoveOverflowingText(Outliner *);
+
+ ESelection GetOverflowPointSel() const;
+
+ bool IsLastParaInterrupted() const;
+
+private:
+ std::optional<NonOverflowingText> mpNonOverflowingTxt;
+ std::optional<OverflowingText> mpOverflowingTxt;
+
+ bool mbIsDeepMerge;
+};
+
+// UFlowChainedText is a simpler class than OFlowChainedText: it almost only joins para-objects
+class EDITENG_DLLPUBLIC UFlowChainedText
+{
+public:
+ UFlowChainedText(Outliner const *, bool);
+ std::optional<OutlinerParaObject> CreateMergedUnderflowParaObject(Outliner *, OutlinerParaObject const *);
+
+private:
+ css::uno::Reference< css::datatransfer::XTransferable > mxUnderflowingTxt;
+
+ bool mbIsDeepMerge;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/paperinf.hxx b/include/editeng/paperinf.hxx
new file mode 100644
index 000000000..2ccc8fbf9
--- /dev/null
+++ b/include/editeng/paperinf.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_PAPERINF_HXX
+#define INCLUDED_EDITENG_PAPERINF_HXX
+
+// INCLUDE ---------------------------------------------------------------
+
+#include <rtl/ustring.hxx>
+#include <tools/mapunit.hxx>
+#include <i18nutil/paper.hxx>
+#include <tools/gen.hxx>
+#include <editeng/editengdllapi.h>
+
+// forward ---------------------------------------------------------------
+
+class Printer;
+
+// class SvxPaperInfo -----------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxPaperInfo
+{
+public:
+ static Size GetDefaultPaperSize( MapUnit eUnit = MapUnit::MapTwip );
+ static Size GetPaperSize( Paper ePaper, MapUnit eUnit = MapUnit::MapTwip );
+ static Size GetPaperSize( const Printer* pPrinter );
+ static Paper GetSvxPaper( const Size &rSize, MapUnit eUnit );
+ static tools::Long GetSloppyPaperDimension( tools::Long nSize );
+ static OUString GetName( Paper ePaper );
+};
+
+// INLINE -----------------------------------------------------------------
+
+inline Size &Swap(Size &rSize)
+{
+ const tools::Long lVal = rSize.Width();
+ rSize.setWidth( rSize.Height() );
+ rSize.setHeight( lVal );
+ return rSize;
+}
+
+inline Size &LandscapeSwap(Size &rSize)
+{
+ if ( rSize.Height() > rSize.Width() )
+ Swap( rSize );
+ return rSize;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/paragraphdata.hxx b/include/editeng/paragraphdata.hxx
new file mode 100644
index 000000000..f0e859d6f
--- /dev/null
+++ b/include/editeng/paragraphdata.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_PARAGRAPHDATA_HXX
+#define INCLUDED_EDITENG_PARAGRAPHDATA_HXX
+
+#include <vector>
+#include <sal/types.h>
+
+class ParagraphData
+{
+ friend class Paragraph;
+ friend class OutlinerParaObject;
+
+protected:
+ sal_Int16 nDepth;
+ sal_Int16 mnNumberingStartValue;
+ bool mbParaIsNumberingRestart;
+
+public:
+ ParagraphData();
+
+ bool operator==(const ParagraphData& rCandidate) const;
+
+ sal_Int16 getDepth() const { return nDepth; }
+};
+
+typedef ::std::vector< ParagraphData > ParagraphDataVector;
+
+#endif // INCLUDED_EDITENG_PARAGRAPHDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/paravertalignitem.hxx b/include/editeng/paravertalignitem.hxx
new file mode 100644
index 000000000..335b15f37
--- /dev/null
+++ b/include/editeng/paravertalignitem.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_PARAVERTALIGNITEM_HXX
+#define INCLUDED_EDITENG_PARAVERTALIGNITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxParaVertAlignItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines the character alignment in the lines of a paragraph.
+ Currently the alignment can be none (i.e. baseline), top, center or bottom.
+
+*/
+
+class EDITENG_DLLPUBLIC SvxParaVertAlignItem final : public SfxUInt16Item
+{
+public:
+ enum class Align { Automatic, Baseline, Top, Center, Bottom };
+ static SfxPoolItem* CreateDefault();
+
+ SvxParaVertAlignItem( Align nValue /*= 0*/,
+ const sal_uInt16 nId );
+
+ virtual SvxParaVertAlignItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ Align GetValue() const { return static_cast<Align>(SfxUInt16Item::GetValue()); }
+ void SetValue(Align n) { SfxUInt16Item::SetValue(static_cast<sal_uInt16>(n)); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/pbinitem.hxx b/include/editeng/pbinitem.hxx
new file mode 100644
index 000000000..d6bf7229b
--- /dev/null
+++ b/include/editeng/pbinitem.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_PBINITEM_HXX
+#define INCLUDED_EDITENG_PBINITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// define ----------------------------------------------------------------
+
+#define PAPERBIN_PRINTER_SETTINGS (sal_uInt8(0xFF))
+
+// class SvxPaperBinItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes selecting a paper tray of the printer.
+*/
+
+class EDITENG_DLLPUBLIC SvxPaperBinItem final : public SfxByteItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit inline SvxPaperBinItem( const sal_uInt16 nId ,
+ const sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxPaperBinItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+inline SvxPaperBinItem::SvxPaperBinItem( const sal_uInt16 nId, const sal_uInt8 nT )
+ : SfxByteItem( nId, nT )
+{}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/pgrditem.hxx b/include/editeng/pgrditem.hxx
new file mode 100644
index 000000000..ef8c24e66
--- /dev/null
+++ b/include/editeng/pgrditem.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_PGRDITEM_HXX
+#define INCLUDED_EDITENG_PGRDITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxParaGridItem -------------------------------------------------
+
+
+/* [Description]
+
+ Paragraph snap to grid
+*/
+
+class EDITENG_DLLPUBLIC SvxParaGridItem final : public SfxBoolItem
+{
+public:
+ SvxParaGridItem( const bool bSnapToGrid /*= true*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxParaGridItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/pmdlitem.hxx b/include/editeng/pmdlitem.hxx
new file mode 100644
index 000000000..f4bfa53c4
--- /dev/null
+++ b/include/editeng/pmdlitem.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_PMDLITEM_HXX
+#define INCLUDED_EDITENG_PMDLITEM_HXX
+
+#include <svl/stritem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxPageModelItem ------------------------------------------------
+
+/* [Description]
+
+ This item contains a name of a page template.
+*/
+
+class EDITENG_DLLPUBLIC SvxPageModelItem final : public SfxStringItem
+{
+private:
+ bool bAuto;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit inline SvxPageModelItem( sal_uInt16 nWh );
+ inline SvxPageModelItem( const OUString& rModel, bool bA /*= false*/,
+ sal_uInt16 nWh );
+
+ virtual SvxPageModelItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+};
+
+inline SvxPageModelItem::SvxPageModelItem( sal_uInt16 nWh )
+ : bAuto( false )
+{
+ SetWhich( nWh );
+}
+
+inline SvxPageModelItem::SvxPageModelItem( const OUString& rModel, bool bA,
+ sal_uInt16 nWh ) :
+ SfxStringItem( nWh, rModel ),
+ bAuto( bA )
+{}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/postitem.hxx b/include/editeng/postitem.hxx
new file mode 100644
index 000000000..93ed44b6b
--- /dev/null
+++ b/include/editeng/postitem.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_POSTITEM_HXX
+#define INCLUDED_EDITENG_POSTITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+#include <tools/fontenum.hxx>
+
+// class SvxPostureItem --------------------------------------------------
+
+/* [Description]
+
+ This item describes the font setting (Italic)
+*/
+
+class EDITENG_DLLPUBLIC SvxPostureItem final : public SfxEnumItem<FontItalic>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxPostureItem( const FontItalic ePost /*= ITALIC_NONE*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SwEnumItem
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxPostureItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ static OUString GetValueTextByPos( sal_uInt16 nPos );
+ virtual sal_uInt16 GetValueCount() const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool HasBoolValue() const override;
+ virtual bool GetBoolValue() const override;
+ virtual void SetBoolValue( bool bVal ) override;
+
+ // enum cast
+ FontItalic GetPosture() const
+ { return GetValue(); }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif // INCLUDED_EDITENG_POSTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/prntitem.hxx b/include/editeng/prntitem.hxx
new file mode 100644
index 000000000..8f0e6a8fc
--- /dev/null
+++ b/include/editeng/prntitem.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_PRNTITEM_HXX
+#define INCLUDED_EDITENG_PRNTITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxPrintItem ----------------------------------------------------
+
+
+/* [Description]
+
+ This item describes a logical variable "Print yes or no".
+*/
+
+
+class EDITENG_DLLPUBLIC SvxPrintItem final : public SfxBoolItem
+{
+public:
+ explicit SvxPrintItem( const sal_uInt16 nId , const bool bPrt = true );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxPrintItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+inline SvxPrintItem::SvxPrintItem( const sal_uInt16 nId, const bool bPrt )
+ : SfxBoolItem( nId, bPrt )
+{}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/protitem.hxx b/include/editeng/protitem.hxx
new file mode 100644
index 000000000..4f3f1c4ac
--- /dev/null
+++ b/include/editeng/protitem.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_PROTITEM_HXX
+#define INCLUDED_EDITENG_PROTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxProtectItem --------------------------------------------------
+
+
+/* [Description]
+
+ This item describes, if content, size or position should be protected.
+*/
+
+class EDITENG_DLLPUBLIC SvxProtectItem final : public SfxPoolItem
+{
+ bool bCntnt :1; // Content protected
+ bool bSize :1; // Size protected
+ bool bPos :1; // Position protected
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit inline SvxProtectItem( const sal_uInt16 nId );
+ SvxProtectItem(SvxProtectItem const &) = default; // SfxPoolItem copy function dichotomy
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+
+ virtual SvxProtectItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ bool IsContentProtected() const { return bCntnt; }
+ bool IsSizeProtected() const { return bSize; }
+ bool IsPosProtected() const { return bPos; }
+ void SetContentProtect( bool bNew ) { bCntnt = bNew; }
+ void SetSizeProtect ( bool bNew ) { bSize = bNew; }
+ void SetPosProtect ( bool bNew ) { bPos = bNew; }
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+inline SvxProtectItem::SvxProtectItem( const sal_uInt16 nId )
+ : SfxPoolItem( nId )
+{
+ bCntnt = bSize = bPos = false;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/rsiditem.hxx b/include/editeng/rsiditem.hxx
new file mode 100644
index 000000000..78ab9b8bf
--- /dev/null
+++ b/include/editeng/rsiditem.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_EDITENG_RSIDITEM_HXX
+#define INCLUDED_EDITENG_RSIDITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// SvxRsidItem
+
+
+class EDITENG_DLLPUBLIC SvxRsidItem final : public SfxUInt32Item
+{
+public:
+ SvxRsidItem( sal_uInt32 nRsid, sal_uInt16 nId ) : SfxUInt32Item( nId, nRsid ) {}
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxRsidItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif // INCLUDED_EDITENG_RSIDITEM_HXX
diff --git a/include/editeng/scriptspaceitem.hxx b/include/editeng/scriptspaceitem.hxx
new file mode 100644
index 000000000..9a4cac3de
--- /dev/null
+++ b/include/editeng/scriptspaceitem.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_SCRIPTSPACEITEM_HXX
+#define INCLUDED_EDITENG_SCRIPTSPACEITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxScriptSpaceItem ----------------------------------------------
+
+/* [Description]
+
+ This item describe the script type of the selected text and is only
+ used for the user interface.
+*/
+
+class EDITENG_DLLPUBLIC SvxScriptSpaceItem final : public SfxBoolItem
+{
+public:
+ SvxScriptSpaceItem( bool bOn /*= false*/,
+ const sal_uInt16 nId );
+
+ virtual SvxScriptSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/scripttypeitem.hxx b/include/editeng/scripttypeitem.hxx
new file mode 100644
index 000000000..bfe84f5f6
--- /dev/null
+++ b/include/editeng/scripttypeitem.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_SCRIPTTYPEITEM_HXX
+#define INCLUDED_EDITENG_SCRIPTTYPEITEM_HXX
+
+#include <svl/languageoptions.hxx>
+#include <svl/setitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class EDITENG_DLLPUBLIC SvxScriptSetItem final : public SfxSetItem
+{
+public:
+ SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool );
+
+ virtual SvxScriptSetItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ static const SfxPoolItem* GetItemOfScriptSet( const SfxItemSet& rSet,
+ sal_uInt16 nWhich );
+
+ static const SfxPoolItem* GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, SvtScriptType nScript );
+
+ const SfxPoolItem* GetItemOfScript( SvtScriptType nScript ) const;
+
+ void PutItemForScriptType( SvtScriptType nScriptType, const SfxPoolItem& rItem );
+
+ static void GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex);
+
+ void GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex) const;
+
+ static void GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin, sal_uInt16& rAsian,
+ sal_uInt16& rComplex );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/section.hxx b/include/editeng/section.hxx
new file mode 100644
index 000000000..d14189c24
--- /dev/null
+++ b/include/editeng/section.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_EDITENG_SECTION_HXX
+#define INCLUDED_EDITENG_SECTION_HXX
+
+#include <sal/types.h>
+
+#include <vector>
+
+class SfxPoolItem;
+
+namespace editeng
+{
+struct Section
+{
+ sal_Int32 mnParagraph;
+ sal_Int32 mnStart;
+ sal_Int32 mnEnd;
+
+ std::vector<const SfxPoolItem*> maAttributes;
+
+ Section(sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd);
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/shaditem.hxx b/include/editeng/shaditem.hxx
new file mode 100644
index 000000000..bed848215
--- /dev/null
+++ b/include/editeng/shaditem.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_SHADITEM_HXX
+#define INCLUDED_EDITENG_SHADITEM_HXX
+
+#include <tools/color.hxx>
+#include <tools/mapunit.hxx>
+#include <svl/cenumitm.hxx>
+
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxShadowItem ---------------------------------------------------
+
+/* [Description]
+
+ This item describes the shadow attribute (color, width and position).
+*/
+enum class SvxShadowItemSide { TOP, BOTTOM, LEFT, RIGHT };
+
+class EDITENG_DLLPUBLIC SvxShadowItem final : public SfxEnumItemInterface
+{
+ Color aShadowColor;
+ sal_uInt16 nWidth;
+ SvxShadowLocation eLocation;
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxShadowItem( const sal_uInt16 nId ,
+ const Color *pColor = nullptr, const sal_uInt16 nWidth = 100 /*5pt*/,
+ const SvxShadowLocation eLoc = SvxShadowLocation::NONE );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxShadowItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
+ virtual bool HasMetrics() const override;
+
+ const Color& GetColor() const { return aShadowColor;}
+ void SetColor( const Color &rNew ) { aShadowColor = rNew; }
+
+ sal_uInt16 GetWidth() const { return nWidth; }
+ SvxShadowLocation GetLocation() const { return eLocation; }
+
+ void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; }
+ void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; }
+
+ // Calculate width of the shadow on the page.
+ sal_uInt16 CalcShadowSpace( SvxShadowItemSide nShadow ) const;
+
+ virtual sal_uInt16 GetValueCount() const override;
+ virtual sal_uInt16 GetEnumValue() const override;
+ virtual void SetEnumValue( sal_uInt16 nNewVal ) override;
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif // INCLUDED_EDITENG_SHADITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/shdditem.hxx b/include/editeng/shdditem.hxx
new file mode 100644
index 000000000..dbe30a672
--- /dev/null
+++ b/include/editeng/shdditem.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_SHDDITEM_HXX
+#define INCLUDED_EDITENG_SHDDITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxShadowedItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes, whether and how it is shaded.
+*/
+
+class EDITENG_DLLPUBLIC SvxShadowedItem final : public SfxBoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxShadowedItem( const bool bShadowed /*= false*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxShadowedItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ SvxShadowedItem(SvxShadowedItem const &) = default; // SfxPoolItem copy function dichotomy
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/sizeitem.hxx b/include/editeng/sizeitem.hxx
new file mode 100644
index 000000000..2247c76d9
--- /dev/null
+++ b/include/editeng/sizeitem.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_SIZEITEM_HXX
+#define INCLUDED_EDITENG_SIZEITEM_HXX
+
+#include <tools/gen.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxSizeItem -----------------------------------------------------
+
+/* [Description]
+
+ This item describes a two-dimensional size.
+*/
+
+class EDITENG_DLLPUBLIC SvxSizeItem : public SfxPoolItem
+{
+
+ Size m_aSize;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxSizeItem( const sal_uInt16 nId );
+ SvxSizeItem( const sal_uInt16 nId, const Size& rSize);
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxSizeItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
+ virtual bool HasMetrics() const override;
+
+ const Size& GetSize() const { return m_aSize; }
+ void SetSize(const Size& rSize) { m_aSize = rSize; }
+
+ tools::Long GetWidth() const { return m_aSize.getWidth(); }
+ tools::Long GetHeight() const { return m_aSize.getHeight(); }
+ void SetWidth(tools::Long n) { m_aSize.setWidth(n); }
+ void SetHeight(tools::Long n) { m_aSize.setHeight(n); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/spltitem.hxx b/include/editeng/spltitem.hxx
new file mode 100644
index 000000000..553e3263f
--- /dev/null
+++ b/include/editeng/spltitem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_SPLTITEM_HXX
+#define INCLUDED_EDITENG_SPLTITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxFormatSplitItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes a logical variable "split paragraph yes or no".
+*/
+
+class EDITENG_DLLPUBLIC SvxFormatSplitItem final : public SfxBoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ virtual ~SvxFormatSplitItem() override;
+
+ inline SvxFormatSplitItem( const bool bSplit /*= true*/,
+ const sal_uInt16 nWh );
+
+ SvxFormatSplitItem(SvxFormatSplitItem const &) = default;
+ SvxFormatSplitItem(SvxFormatSplitItem &&) = default;
+ SvxFormatSplitItem & operator =(SvxFormatSplitItem const &) = delete; // due to SfxBoolItem
+ SvxFormatSplitItem & operator =(SvxFormatSplitItem &&) = delete; // due to SfxBoolItem
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxFormatSplitItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+inline SvxFormatSplitItem::SvxFormatSplitItem( const bool bSplit, const sal_uInt16 nWh ) :
+ SfxBoolItem( nWh, bSplit )
+{}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/splwrap.hxx b/include/editeng/splwrap.hxx
new file mode 100644
index 000000000..79d55d179
--- /dev/null
+++ b/include/editeng/splwrap.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_SPLWRAP_HXX
+#define INCLUDED_EDITENG_SPLWRAP_HXX
+
+#include <editeng/editengdllapi.h>
+#include <editeng/svxenum.hxx>
+#include <i18nlangtag/lang.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <vcl/weld.hxx>
+
+// forward ---------------------------------------------------------------
+
+namespace com::sun::star::linguistic2 {
+ class XDictionary;
+ class XSpellChecker1;
+ class XHyphenator;
+}
+
+// misc functions ---------------------------------------------------------------
+
+void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect( OUString &rOldText, const OUString &rNewText );
+
+/*--------------------------------------------------------------------
+ Description: The SpellWrapper
+ --------------------------------------------------------------------*/
+
+class EDITENG_DLLPUBLIC SvxSpellWrapper {
+private:
+ friend class SvxSpellCheckDialog;
+ friend class SvxHyphenWordDialog;
+ friend struct SvxHyphenWordDialog_Impl;
+
+ weld::Widget* pWin;
+ std::unique_ptr<weld::WaitObject> xWait;
+ css::uno::Reference<
+ css::uno::XInterface > xLast; // result of last spelling/hyphenation attempt
+ css::uno::Reference<
+ css::linguistic2::XHyphenator > xHyph;
+ bool bOtherCntnt : 1; // set => Check special sections initially
+ bool bReverse : 1; // Reverse spell check
+ bool bStartDone : 1; // Beginning already corrected
+ bool bEndDone : 1; // End part already corrected
+ bool bStartChk : 1; // Examine the beginning
+ bool bRevAllowed : 1; // Reverse spell check prohibited
+ bool bAllRight : 1; // Record wrong words in the dedicated
+ // dictionary and do not start the dialog.
+
+ EDITENG_DLLPRIVATE bool SpellNext(); // select next area
+ bool FindSpellError(); // Check for errors (over areas)
+
+ SvxSpellWrapper(SvxSpellWrapper const &) = delete;
+ void operator =(SvxSpellWrapper const &) = delete;
+
+public:
+ SvxSpellWrapper( weld::Widget* pWn,
+ const bool bStart, const bool bIsAllRight );
+ SvxSpellWrapper( weld::Widget* pWn,
+ css::uno::Reference< css::linguistic2::XHyphenator > const &xHyphenator,
+ const bool bStart, const bool bOther );
+
+ virtual ~SvxSpellWrapper();
+
+ static sal_Int16 CheckSpellLang(
+ css::uno::Reference< css::linguistic2::XSpellChecker1 > const & xSpell,
+ LanguageType nLang );
+ static sal_Int16 CheckHyphLang(
+ css::uno::Reference< css::linguistic2::XHyphenator >const & xHyph,
+ LanguageType nLang );
+
+ static void ShowLanguageErrors();
+
+ void SpellDocument(); // Perform Spell Checking
+ bool IsStartDone() const { return bStartDone; }
+ bool IsEndDone() const { return bEndDone; }
+ bool IsAllRight() const { return bAllRight; }
+
+protected:
+ const css::uno::Reference< css::uno::XInterface >&
+ GetLast() const { return xLast; }
+ void SetLast(const css::uno::Reference< css::uno::XInterface > &xNewLast)
+ { xLast = xNewLast; }
+ virtual bool SpellMore(); // examine further documents?
+ virtual void SpellStart( SvxSpellArea eSpell ); // Preparing the area
+ virtual void SpellContinue(); // Check Areas
+ // Result available through GetLast
+ virtual void ReplaceAll( const OUString &rNewText ); //Replace word from the replace list
+ static css::uno::Reference< css::linguistic2::XDictionary >
+ GetAllRightDic();
+ virtual void SpellEnd(); // Finish area
+ virtual void InsertHyphen( const sal_Int32 nPos ); // Insert hyphen
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
new file mode 100644
index 000000000..7483e83c1
--- /dev/null
+++ b/include/editeng/svxacorr.hxx
@@ -0,0 +1,447 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_SVXACORR_HXX
+#define INCLUDED_EDITENG_SVXACORR_HXX
+
+#include <o3tl/sorted_vector.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <o3tl/string_view.hxx>
+#include <i18nlangtag/languagetag.hxx>
+#include <tools/time.hxx>
+#include <tools/date.hxx>
+#include <editeng/swafopt.hxx>
+#include <editeng/editengdllapi.h>
+
+#include <optional>
+#include <map>
+#include <memory>
+#include <string_view>
+#include <utility>
+
+class CharClass;
+class SfxPoolItem;
+class SotStorage;
+class SvxAutoCorrect;
+class SfxObjectShell;
+namespace vcl { class Window; }
+namespace com::sun::star::embed { class XStorage; }
+namespace tools { template <typename T> class SvRef; }
+
+struct CompareSvStringsISortDtor
+{
+ bool operator()( std::u16string_view lhs, std::u16string_view rhs ) const
+ {
+ return o3tl::compareToIgnoreAsciiCase( lhs, rhs ) < 0;
+ }
+};
+
+class SvStringsISortDtor
+ : public o3tl::sorted_vector<OUString, CompareSvStringsISortDtor>
+{
+};
+
+// Auto correct flags
+enum class ACFlags : sal_uInt32 {
+ NONE = 0x00000000,
+ CapitalStartSentence = 0x00000001, // Capital letters at the beginning of a sentence
+ CapitalStartWord = 0x00000002, // not two Capital letters at the beginning of a word
+ AddNonBrkSpace = 0x00000004, // Add non breaking space before :,?!%
+ ChgOrdinalNumber = 0x00000008, // Ordinal-Number 1st, 2nd,..
+ ChgToEnEmDash = 0x00000010, // - -> Endash/Emdash
+ ChgWeightUnderl = 0x00000020, // * -> Bold, _ -> Underscore
+ SetINetAttr = 0x00000040, // Set INetAttribut
+ Autocorrect = 0x00000080, // Call AutoCorrect
+ ChgQuotes = 0x00000100, // replace double quotes
+ SaveWordCplSttLst = 0x00000200, // Save Auto correction of Capital letter at beginning of sentence.
+ SaveWordWordStartLst = 0x00000400, // Save Auto correction of TWo INitial CApitals or sMALL iNITIAL.
+ IgnoreDoubleSpace = 0x00000800, // Ignore 2 Spaces
+ ChgSglQuotes = 0x00001000, // Replace simple quotes
+ CorrectCapsLock = 0x00002000, // Correct accidental use of cAPS LOCK key
+ TransliterateRTL = 0x00004000, // Transliterate RTL text
+ ChgAngleQuotes = 0x00008000, // >>, << -> angle quotes in some languages
+
+ ChgWordLstLoad = 0x20000000, // Replacement list loaded
+ CplSttLstLoad = 0x40000000, // Exception list for Capital letters Start loaded
+ WordStartLstLoad = 0x80000000, // Exception list for Word Start loaded
+};
+namespace o3tl {
+ template<> struct typed_flags<ACFlags> : is_typed_flags<ACFlags, 0xe000ffff> {};
+}
+
+enum class ACQuotes
+{
+ NONE,
+ NonBreakingSpace,
+ CapitalizeIAm,
+ DoubleAngleQuote,
+ UseApostrophe,
+};
+
+// TODO: handle code points > U+FFFF and check users of this class
+
+// only a mapping class
+class EDITENG_DLLPUBLIC SvxAutoCorrDoc
+{
+public:
+ virtual ~SvxAutoCorrDoc();
+
+ virtual bool Delete( sal_Int32 nStt, sal_Int32 nEnd ) = 0;
+ virtual bool Insert( sal_Int32 nPos, const OUString& rTxt ) = 0;
+ virtual bool Replace( sal_Int32 nPos, const OUString& rTxt ) = 0;
+ virtual bool ReplaceRange( sal_Int32 nPos, sal_Int32 nLen, const OUString& rTxt ) = 0;
+
+ virtual void SetAttr( sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId,
+ SfxPoolItem& ) = 0;
+
+ virtual bool SetINetAttr( sal_Int32 nStt, sal_Int32 nEnd, const OUString& rURL ) = 0;
+
+ // Return the text of a previous paragraph.
+ // If no paragraph exits or just an empty one, then return an empty string.
+ // The flag indicates:
+ // TRUE: before the normal insertion position (TRUE)
+ // FALSE: in which the corrected word was inserted.
+ // (Does not to have to be the same paragraph !!!!)
+ virtual OUString const* GetPrevPara(bool bAtNormalPos) = 0;
+
+ virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
+ SvxAutoCorrect& rACorrect,
+ OUString* pPara ) = 0;
+ virtual bool TransliterateRTLWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
+ bool bApply = false ) = 0;
+
+ // Is called after the change of the signs by the functions
+ // - FnCapitalStartWord
+ // - FnCapitalStartSentence
+ // As an option, the words can then be inserted into the exception lists.
+ virtual void SaveCpltSttWord( ACFlags nFlag, sal_Int32 nPos,
+ const OUString& rExceptWord,
+ sal_Unicode cChar );
+
+ // which language at the position?
+ virtual LanguageType GetLanguage( sal_Int32 nPos ) const;
+};
+
+
+class EDITENG_DLLPUBLIC SvxAutocorrWord
+{
+ OUString sShort, sLong;
+ bool bIsTxtOnly; // Is pure ASCII - Text
+public:
+ SvxAutocorrWord( OUString aS, OUString aL, bool bFlag = true )
+ : sShort(std::move( aS )), sLong(std::move( aL )), bIsTxtOnly( bFlag )
+ {}
+
+ const OUString& GetShort() const { return sShort; }
+ const OUString& GetLong() const { return sLong; }
+ bool IsTextOnly() const { return bIsTxtOnly; }
+};
+
+class EDITENG_DLLPUBLIC SvxAutocorrWordList
+{
+ struct Impl;
+ std::unique_ptr<Impl> mpImpl;
+
+ SvxAutocorrWordList( const SvxAutocorrWordList& ) = delete;
+ const SvxAutocorrWordList& operator= ( const SvxAutocorrWordList& ) = delete;
+
+ const SvxAutocorrWord* WordMatches(const SvxAutocorrWord *pFnd,
+ const OUString &rTxt,
+ sal_Int32 &rStt,
+ sal_Int32 nEndPos) const;
+public:
+ SvxAutocorrWordList();
+ // free any objects still in the set
+ ~SvxAutocorrWordList();
+ void DeleteAndDestroyAll();
+ const SvxAutocorrWord* Insert(SvxAutocorrWord aWord) const;
+ std::optional<SvxAutocorrWord> FindAndRemove(const SvxAutocorrWord *pWord);
+ void LoadEntry(const OUString& sWrong, const OUString& sRight, bool bOnlyTxt);
+ bool empty() const;
+
+ struct CompareSvxAutocorrWordList;
+ typedef std::vector<SvxAutocorrWord> AutocorrWordSetType;
+ const AutocorrWordSetType & getSortedContent() const;
+
+ const SvxAutocorrWord* SearchWordsInList(const OUString& rTxt, sal_Int32& rStt, sal_Int32 nEndPos) const;
+};
+
+class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists
+{
+ OUString sShareAutoCorrFile, sUserAutoCorrFile;
+ // If the AutoCorr file is newer
+ Date aModifiedDate;
+ tools::Time aModifiedTime, aLastCheckTime;
+
+ std::unique_ptr<SvStringsISortDtor> pCplStt_ExcptLst;
+ std::unique_ptr<SvStringsISortDtor> pWordStart_ExcptLst;
+ std::unique_ptr<SvxAutocorrWordList> pAutocorr_List;
+ SvxAutoCorrect& rAutoCorrect;
+
+ ACFlags nFlags;
+
+ bool IsFileChanged_Imp();
+ void LoadXMLExceptList_Imp( std::unique_ptr<SvStringsISortDtor>& rpLst,
+ const OUString& sStrmName,
+ tools::SvRef<SotStorage>& rStg);
+ static void SaveExceptList_Imp( const SvStringsISortDtor& rLst,
+ const OUString& sStrmName,
+ tools::SvRef<SotStorage> const & rStg,
+ bool bConvert = false);
+
+ bool MakeBlocklist_Imp( SotStorage& rStg );
+ void RemoveStream_Imp( const OUString& rName );
+ void MakeUserStorage_Impl();
+
+public:
+ SvxAutoCorrectLanguageLists( SvxAutoCorrect& rParent,
+ OUString aShareAutoCorrectFile,
+ OUString aUserAutoCorrectFile);
+ ~SvxAutoCorrectLanguageLists();
+
+ // Load, Set, Get - the replacement list
+ SvxAutocorrWordList* LoadAutocorrWordList();
+ const SvxAutocorrWordList* GetAutocorrWordList();
+
+ // Load, Set, Get - the exception list for Capital letter at the
+ // beginning of a sentence
+ SvStringsISortDtor* LoadCplSttExceptList();
+ void SaveCplSttExceptList();
+ SvStringsISortDtor* GetCplSttExceptList();
+ bool AddToCplSttExceptList(const OUString& rNew);
+
+ // Load, Set, Get the exception list for TWo INitial CApitals or sMALL iNITIAL
+ SvStringsISortDtor* LoadWordStartExceptList();
+ void SaveWordStartExceptList();
+ SvStringsISortDtor* GetWordStartExceptList();
+ bool AddToWordStartExceptList(const OUString& rNew);
+
+ // Save word substitutions:
+ // Store these directly in the storage. The word list is updated
+ // accordingly!
+ // - pure Text
+ bool PutText( const OUString& rShort, const OUString& rLong );
+ // - Text with attribution (only the SWG - SWG format!)
+ void PutText( const OUString& rShort, SfxObjectShell& );
+ // - Make combined changes in one pass
+ bool MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries, std::vector<SvxAutocorrWord>& aDeleteEntries );
+};
+
+class EDITENG_DLLPUBLIC SvxAutoCorrect
+{
+ friend class SvxAutoCorrectLanguageLists;
+
+ OUString sShareAutoCorrFile, sUserAutoCorrFile;
+
+ SvxSwAutoFormatFlags aSwFlags; // StarWriter AutoFormat Flags
+
+ // all languages in a table
+ std::map<LanguageTag, std::unique_ptr<SvxAutoCorrectLanguageLists>> m_aLangTable;
+ std::map<LanguageTag, sal_Int64> aLastFileTable;
+ std::unique_ptr<CharClass> pCharClass;
+
+ LanguageType eCharClassLang;
+
+ ACFlags nFlags;
+ sal_Unicode cStartDQuote, cEndDQuote, cStartSQuote, cEndSQuote;
+
+
+ // private methods
+ SvxAutoCorrectLanguageLists& GetLanguageList_( LanguageType eLang );
+
+ void GetCharClass_( LanguageType eLang );
+
+protected:
+ // - Text with attribution (only the SWG - SWG format!)
+ // rShort is the stream name - encrypted!
+ virtual bool PutText( const css::uno::Reference < css::embed::XStorage >& rStg,
+ const OUString& rFileName, const OUString& rShort, SfxObjectShell&, OUString& );
+
+ // required language in the table add if possible only when the file exists
+ bool CreateLanguageFile(const LanguageTag& rLanguageTag, bool bNewFile = true);
+ // - Return the replacement text (only for SWG format, all others can be
+ // taken from the word list!)
+ // rShort is the stream name - encrypted!
+public:
+
+ sal_Unicode GetQuote( sal_Unicode cInsChar, bool bSttQuote,
+ LanguageType eLang ) const;
+ virtual bool GetLongText( const OUString& rShort, OUString& rLong );
+
+ virtual void refreshBlockList( const css::uno::Reference < css::embed::XStorage >& rStg);
+
+ SvxAutoCorrect( OUString aShareAutocorrFile,
+ OUString aUserAutocorrFile );
+ SvxAutoCorrect( const SvxAutoCorrect& );
+ virtual ~SvxAutoCorrect();
+
+ /** Execute an AutoCorrect.
+ Returns what has been executed, according to the above auto correct flags.
+ @param io_bNbspRunNext
+ Remembers if a NO-BREAK SPACE was added (eg. in "fr" language)
+ (set to <TRUE/>) at the last character input that may have to
+ be removed again depending on what character is following.
+ */
+ // FIXME: this has the horrible flaw that the rTxt must be a reference
+ // to the actual SwTxtNode/EditNode string because it inserts the character
+ // in rDoc and expects that to side-effect rTxt
+ void DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
+ sal_Int32 nPos, sal_Unicode cInsChar, bool bInsert, bool& io_bNbspRunNext,
+ vcl::Window const * pFrameWin = nullptr );
+
+ // Return for the autotext expansion the previous word,
+ // AutoCorrect - corresponding algorithm
+ OUString GetPrevAutoCorrWord(SvxAutoCorrDoc const& rDoc, const OUString& rTxt, sal_Int32 nPos);
+
+ // Returns vector candidates for AutoText name match, starting with the longest string between
+ // 3 and 9 characters long, that is a chunk of text starting with a whitespace or with a word's
+ // first character, and ending at the current cursor position or empty string if no such string
+ // exists
+ static std::vector<OUString> GetChunkForAutoText(std::u16string_view rTxt, sal_Int32 nPos);
+
+ // Search for the words in the replacement table.
+ // rText - check in this text the words of the list
+ // rStt - the detected starting position
+ // nEnd - to check position - as of this item forward
+ // rLang - Input: in which language is searched
+ // Output: in which "language list" was it found
+ const SvxAutocorrWord* SearchWordsInList( const OUString& rTxt,
+ sal_Int32& rStt, sal_Int32 nEndPos,
+ SvxAutoCorrDoc& rDoc,
+ LanguageTag& rLang );
+
+ // Query/Set the Character for the Quote substitution
+ sal_Unicode GetStartSingleQuote() const { return cStartSQuote; }
+ sal_Unicode GetEndSingleQuote() const { return cEndSQuote; }
+ sal_Unicode GetStartDoubleQuote() const { return cStartDQuote; }
+ sal_Unicode GetEndDoubleQuote() const { return cEndDQuote; }
+
+ void SetStartSingleQuote( const sal_Unicode cStart ) { cStartSQuote = cStart; }
+ void SetEndSingleQuote( const sal_Unicode cEnd ) { cEndSQuote = cEnd; }
+ void SetStartDoubleQuote( const sal_Unicode cStart ) { cStartDQuote = cStart; }
+ void SetEndDoubleQuote( const sal_Unicode cEnd ) { cEndDQuote = cEnd; }
+
+ OUString GetQuote( SvxAutoCorrDoc const & rDoc, sal_Int32 nInsPos,
+ sal_Unicode cInsChar, bool bSttQuote );
+ void InsertQuote( SvxAutoCorrDoc& rDoc, sal_Int32 nInsPos,
+ sal_Unicode cInsChar, bool bSttQuote, bool bIns,
+ LanguageType eLang, ACQuotes eType ) const;
+
+ // Query/Set the name of the AutoCorrect file
+ // the default is "autocorr.dat"
+ OUString GetAutoCorrFileName( const LanguageTag& rLanguageTag /* = LANGUAGE_SYSTEM */ ,
+ bool bNewFile = false,
+ bool bTstUserExist = false,
+ bool bUnlocalized = false ) const;
+
+ // Query/Set the current settings of AutoCorrect
+ ACFlags GetFlags() const { return nFlags; }
+ SvxSwAutoFormatFlags& GetSwFlags() { return aSwFlags;}
+ const SvxSwAutoFormatFlags& GetSwFlags() const { return aSwFlags; }
+ bool IsAutoCorrFlag( ACFlags nFlag ) const
+ { return bool(nFlags & nFlag); }
+ void SetAutoCorrFlag( ACFlags nFlag, bool bOn = true );
+
+ // Load, Set, Get - the replacement list
+ SvxAutocorrWordList* LoadAutocorrWordList( LanguageType eLang )
+ { return GetLanguageList_( eLang ).LoadAutocorrWordList(); }
+
+ // Save word substitutions:
+ // Save these directly in the storage. The word list is updated
+ // accordingly!
+ // - pure Text
+ bool PutText( const OUString& rShort, const OUString& rLong, LanguageType eLang );
+ // - Text with attribution (only in the SWG - SWG format!)
+ void PutText( const OUString& rShort, SfxObjectShell& rShell, LanguageType eLang )
+ { GetLanguageList_( eLang ).PutText(rShort, rShell ); }
+
+ void MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries,
+ std::vector<SvxAutocorrWord>& aDeleteEntries,
+ LanguageType eLang );
+
+ // Load, Set, Get - the exception list for capital letters at the
+ // beginning of a sentence
+ void SaveCplSttExceptList( LanguageType eLang );
+ SvStringsISortDtor* LoadCplSttExceptList(LanguageType eLang)
+ { return GetLanguageList_( eLang ).LoadCplSttExceptList(); }
+ const SvStringsISortDtor* GetCplSttExceptList( LanguageType eLang )
+ { return GetLanguageList_( eLang ).GetCplSttExceptList(); }
+
+ // Adds a single word. The list will be immediately written to the file!
+ bool AddCplSttException( const OUString& rNew, LanguageType eLang );
+
+ // Load, Set, Get the exception list for TWo INitial CApitals or sMALL iNITIAL
+ void SaveWordStartExceptList( LanguageType eLang );
+ SvStringsISortDtor* LoadWordStartExceptList( LanguageType eLang )
+ { return GetLanguageList_( eLang ).LoadWordStartExceptList(); }
+ const SvStringsISortDtor* GetWordStartExceptList( LanguageType eLang )
+ { return GetLanguageList_( eLang ).GetWordStartExceptList(); }
+ // Adds a single word. The list will be immediately written to the file!
+ bool AddWordStartException( const OUString& rNew, LanguageType eLang);
+
+ // Search through the Languages for the entry
+ bool FindInWordStartExceptList( LanguageType eLang, const OUString& sWord );
+ bool FindInCplSttExceptList( LanguageType eLang, const OUString& sWord,
+ bool bAbbreviation = false);
+
+ // Methods for the auto-correction
+ void FnCapitalStartWord( SvxAutoCorrDoc&, const OUString&,
+ sal_Int32 nSttPos, sal_Int32 nEndPos,
+ LanguageType eLang );
+ bool FnChgOrdinalNumber( SvxAutoCorrDoc&, const OUString&,
+ sal_Int32 nSttPos, sal_Int32 nEndPos,
+ LanguageType eLang );
+ bool FnChgToEnEmDash( SvxAutoCorrDoc&, std::u16string_view,
+ sal_Int32 nSttPos, sal_Int32 nEndPos,
+ LanguageType eLang );
+ bool FnAddNonBrkSpace( SvxAutoCorrDoc&, const OUString&,
+ sal_Int32 nEndPos,
+ LanguageType eLang, bool& io_bNbspRunNext );
+ bool FnSetINetAttr( SvxAutoCorrDoc&, const OUString&,
+ sal_Int32 nSttPos, sal_Int32 nEndPos,
+ LanguageType eLang );
+ bool FnChgWeightUnderl( SvxAutoCorrDoc&, const OUString&,
+ sal_Int32 nEndPos );
+ void FnCapitalStartSentence( SvxAutoCorrDoc&, const OUString&, bool bNormalPos,
+ sal_Int32 nSttPos, sal_Int32 nEndPos,
+ LanguageType eLang);
+ bool FnCorrectCapsLock( SvxAutoCorrDoc&, const OUString&,
+ sal_Int32 nSttPos, sal_Int32 nEndPos,
+ LanguageType eLang );
+
+ static ACFlags GetDefaultFlags();
+
+// returns sal_True for characters where the function
+// 'SvxAutoCorrect::AutoCorrect' should be called.
+// (used to avoid occasional 'collisions' with (Thai) input-sequence-checking)
+ static bool IsAutoCorrectChar( sal_Unicode cChar );
+
+ static bool NeedsHardspaceAutocorr( sal_Unicode cChar );
+
+ CharClass& GetCharClass( LanguageType eLang )
+ {
+ if( !pCharClass || eLang != eCharClassLang )
+ GetCharClass_( eLang );
+ return *pCharClass;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxenum.hxx b/include/editeng/svxenum.hxx
new file mode 100644
index 000000000..6c0216560
--- /dev/null
+++ b/include/editeng/svxenum.hxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_SVXENUM_HXX
+#define INCLUDED_EDITENG_SVXENUM_HXX
+
+#include <com/sun/star/style/NumberingType.hpp>
+
+enum class SvxCaseMap
+{
+ NotMapped,
+ Uppercase,
+ Lowercase,
+ Capitalize,
+ SmallCaps,
+ End
+};
+
+enum class SvxEscapement
+{
+ Off,
+ Superscript,
+ Subscript,
+ End
+};
+
+enum class SvxShadowLocation
+{
+ NONE,
+ TopLeft,
+ TopRight,
+ BottomLeft,
+ BottomRight,
+ End
+};
+
+enum class SvxTabAdjust
+{
+ Left,
+ Right,
+ Decimal,
+ Center,
+ Default,
+ End
+};
+
+enum class SvxLineSpaceRule
+{
+ Auto,
+ Fix,
+ Min
+};
+
+enum class SvxInterLineSpaceRule
+{
+ Off,
+ Prop,
+ Fix
+};
+
+enum class SvxAdjust
+{
+ Left,
+ Right,
+ Block,
+ Center,
+ BlockLine,
+ End,
+ LAST = End
+};
+
+enum class SvxBreak
+{
+ NONE,
+ ColumnBefore,
+ ColumnAfter,
+ ColumnBoth,
+ PageBefore,
+ PageAfter,
+ PageBoth,
+ End
+};
+
+enum class SvxCellHorJustify
+{
+ Standard,
+ Left,
+ Center,
+ Right,
+ Block,
+ Repeat
+};
+
+enum class SvxCellJustifyMethod
+{
+ Auto,
+ Distribute
+};
+
+enum class SvxCellVerJustify
+{
+ Standard,
+ Top,
+ Center,
+ Bottom,
+ Block
+};
+
+enum class SvxCellOrientation
+{
+ Standard,
+ TopBottom,
+ BottomUp,
+ Stacked
+};
+
+enum class SvxSpellArea
+{
+ Body = 0,
+ BodyEnd,
+ BodyStart,
+ Other
+};
+
+/**
+ * these must match the values in css::style::NumberingType
+ */
+enum SvxNumType : sal_Int16
+{
+ SVX_NUM_CHARS_UPPER_LETTER = css::style::NumberingType::CHARS_UPPER_LETTER, // Counts from a-z, aa - az, ba - bz, ...
+ SVX_NUM_CHARS_LOWER_LETTER = css::style::NumberingType::CHARS_LOWER_LETTER,
+ SVX_NUM_ROMAN_UPPER = css::style::NumberingType::ROMAN_UPPER,
+ SVX_NUM_ROMAN_LOWER = css::style::NumberingType::ROMAN_LOWER,
+ SVX_NUM_ARABIC = css::style::NumberingType::ARABIC,
+ SVX_NUM_NUMBER_NONE = css::style::NumberingType::NUMBER_NONE,
+ SVX_NUM_CHAR_SPECIAL = css::style::NumberingType::CHAR_SPECIAL, // Bullet
+ SVX_NUM_PAGEDESC = css::style::NumberingType::PAGE_DESCRIPTOR, // Numbering from the page template
+ SVX_NUM_BITMAP = css::style::NumberingType::BITMAP,
+ SVX_NUM_CHARS_UPPER_LETTER_N = css::style::NumberingType::CHARS_UPPER_LETTER_N, // Counts from a-z, aa-zz, aaa-zzz
+ SVX_NUM_CHARS_LOWER_LETTER_N = css::style::NumberingType::CHARS_LOWER_LETTER_N,
+ SVX_NUM_TRANSLITERATION = css::style::NumberingType::TRANSLITERATION,
+ SVX_NUM_NATIVE_NUMBERING = css::style::NumberingType::NATIVE_NUMBERING,
+ SVX_NUM_FULL_WIDTH_ARABIC = css::style::NumberingType::FULLWIDTH_ARABIC,
+ SVX_NUM_CIRCLE_NUMBER = css::style::NumberingType::CIRCLE_NUMBER,
+ SVX_NUM_NUMBER_LOWER_ZH = css::style::NumberingType::NUMBER_LOWER_ZH,
+ SVX_NUM_NUMBER_UPPER_ZH = css::style::NumberingType::NUMBER_UPPER_ZH,
+ SVX_NUM_NUMBER_UPPER_ZH_TW = css::style::NumberingType::NUMBER_UPPER_ZH_TW,
+ SVX_NUM_TIAN_GAN_ZH = css::style::NumberingType::TIAN_GAN_ZH,
+ SVX_NUM_DI_ZI_ZH = css::style::NumberingType::DI_ZI_ZH,
+ SVX_NUM_NUMBER_TRADITIONAL_JA = css::style::NumberingType::NUMBER_TRADITIONAL_JA,
+ SVX_NUM_AIU_FULLWIDTH_JA = css::style::NumberingType::AIU_FULLWIDTH_JA,
+ SVX_NUM_AIU_HALFWIDTH_JA = css::style::NumberingType::AIU_HALFWIDTH_JA,
+ SVX_NUM_IROHA_FULLWIDTH_JA = css::style::NumberingType::IROHA_FULLWIDTH_JA,
+ SVX_NUM_IROHA_HALFWIDTH_JA = css::style::NumberingType::IROHA_HALFWIDTH_JA,
+ SVX_NUM_NUMBER_UPPER_KO = css::style::NumberingType::NUMBER_UPPER_KO,
+ SVX_NUM_NUMBER_HANGUL_KO = css::style::NumberingType::NUMBER_HANGUL_KO,
+ SVX_NUM_HANGUL_JAMO_KO = css::style::NumberingType::HANGUL_JAMO_KO,
+ SVX_NUM_HANGUL_SYLLABLE_KO = css::style::NumberingType::HANGUL_SYLLABLE_KO,
+ SVX_NUM_HANGUL_CIRCLED_JAMO_KO = css::style::NumberingType::HANGUL_CIRCLED_JAMO_KO,
+ SVX_NUM_HANGUL_CIRCLED_SYLLABLE_KO = css::style::NumberingType::HANGUL_CIRCLED_SYLLABLE_KO,
+ SVX_NUM_CHARS_ARABIC = css::style::NumberingType::CHARS_ARABIC,
+ SVX_NUM_CHARS_THAI = css::style::NumberingType::CHARS_THAI,
+ SVX_NUM_CHARS_HEBREW = css::style::NumberingType::CHARS_HEBREW,
+ SVX_NUM_CHARS_NEPALI = css::style::NumberingType::CHARS_NEPALI,
+ SVX_NUM_CHARS_KHMER = css::style::NumberingType::CHARS_KHMER,
+ SVX_NUM_CHARS_LAO = css::style::NumberingType::CHARS_LAO,
+ SVX_NUM_CHARS_TIBETAN = css::style::NumberingType::CHARS_TIBETAN,
+ SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_BG = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_BG,
+ SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_BG = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_BG,
+ SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_N_BG = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_BG,
+ SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_N_BG = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_BG,
+ SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_RU = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_RU,
+ SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_RU = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_RU,
+ SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_N_RU = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_RU,
+ SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_N_RU = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_RU,
+ SVX_NUM_CHARS_PERSIAN = css::style::NumberingType::CHARS_PERSIAN,
+ SVX_NUM_CHARS_MYANMAR = css::style::NumberingType::CHARS_MYANMAR,
+ SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_SR = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_SR,
+ SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_SR = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_SR,
+ SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_N_SR = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_SR,
+ SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_N_SR = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_SR,
+ SVX_NUM_CHARS_GREEK_UPPER_LETTER = css::style::NumberingType::CHARS_GREEK_UPPER_LETTER,
+ SVX_NUM_CHARS_GREEK_LOWER_LETTER = css::style::NumberingType::CHARS_GREEK_LOWER_LETTER,
+ SVX_NUM_CHARS_ARABIC_ABJAD = css::style::NumberingType::CHARS_ARABIC_ABJAD,
+ SVX_NUM_CHARS_PERSIAN_WORD = css::style::NumberingType::CHARS_PERSIAN_WORD,
+ SVX_NUM_NUMBER_HEBREW = css::style::NumberingType::NUMBER_HEBREW,
+ SVX_NUM_NUMBER_ARABIC_INDIC = css::style::NumberingType::NUMBER_ARABIC_INDIC,
+ SVX_NUM_NUMBER_EAST_ARABIC_INDIC = css::style::NumberingType::NUMBER_EAST_ARABIC_INDIC,
+ SVX_NUM_NUMBER_INDIC_DEVANAGARI = css::style::NumberingType::NUMBER_INDIC_DEVANAGARI,
+ SVX_NUM_TEXT_NUMBER = css::style::NumberingType::TEXT_NUMBER,
+ SVX_NUM_TEXT_CARDINAL = css::style::NumberingType::TEXT_CARDINAL,
+ SVX_NUM_TEXT_ORDINAL = css::style::NumberingType::TEXT_ORDINAL,
+ SVX_NUM_SYMBOL_CHICAGO = css::style::NumberingType::SYMBOL_CHICAGO,
+ SVX_NUM_ARABIC_ZERO = css::style::NumberingType::ARABIC_ZERO,
+ SVX_NUM_ARABIC_ZERO3 = css::style::NumberingType::ARABIC_ZERO3,
+ SVX_NUM_ARABIC_ZERO4 = css::style::NumberingType::ARABIC_ZERO4,
+ SVX_NUM_ARABIC_ZERO5 = css::style::NumberingType::ARABIC_ZERO5,
+ SVX_NUM_SZEKELY_ROVAS = css::style::NumberingType::SZEKELY_ROVAS
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxfont.hxx b/include/editeng/svxfont.hxx
new file mode 100644
index 000000000..e0f92c572
--- /dev/null
+++ b/include/editeng/svxfont.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_SVXFONT_HXX
+#define INCLUDED_EDITENG_SVXFONT_HXX
+
+#include <editeng/svxenum.hxx>
+#include <o3tl/span.hxx>
+#include <tools/long.hxx>
+#include <vcl/font.hxx>
+#include <editeng/editengdllapi.h>
+#include <tools/poly.hxx>
+
+// Percentage of height of lower case small capital letters compared to upper case letters
+// See i#1526# for full explanation
+#define SMALL_CAPS_PERCENTAGE 80
+
+class SvxDoCapitals;
+class OutputDevice;
+class Printer;
+class Point;
+namespace tools { class Rectangle; }
+class Size;
+class EDITENG_DLLPUBLIC SvxFont : public vcl::Font
+{
+ SvxCaseMap eCaseMap; // Text Markup
+ short nEsc; // Degree of Superscript/Subscript
+ sal_uInt8 nPropr; // Degree of reduction of the font height
+ short nKern; // Kerning in Pt
+
+public:
+ SvxFont();
+ SvxFont( const vcl::Font &rFont );
+ SvxFont( const SvxFont &rFont );
+
+ // Methods for Superscript/Subscript
+ short GetEscapement() const { return nEsc; }
+ void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
+ // set specific values instead of automatic, and ensure valid value. Depends on nPropr being set already.
+ void SetNonAutoEscapement(short nNewEsc, const OutputDevice* pOutDev = nullptr);
+
+ sal_uInt8 GetPropr() const { return nPropr; }
+ void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
+ void SetProprRel( const sal_uInt8 nNewPropr )
+ { SetPropr( static_cast<sal_uInt8>( static_cast<tools::Long>(nNewPropr) * static_cast<tools::Long>(nPropr) / 100 ) ); }
+
+ // Kerning
+ short GetFixKerning() const { return nKern; }
+ void SetFixKerning( const short nNewKern ) { nKern = nNewKern; }
+
+ SvxCaseMap GetCaseMap() const { return eCaseMap; }
+ void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
+
+ // Is-Methods:
+ bool IsCaseMap() const { return SvxCaseMap::NotMapped != eCaseMap; }
+ bool IsCapital() const { return SvxCaseMap::SmallCaps == eCaseMap; }
+ bool IsKern() const { return 0 != nKern; }
+ bool IsEsc() const { return 0 != nEsc; }
+
+ // Consider Upper case, Lower case letters etc.
+ OUString CalcCaseMap(const OUString &rTxt) const;
+
+ // Handle upper case letters
+ void DoOnCapitals(SvxDoCapitals &rDo) const;
+
+ void SetPhysFont(OutputDevice& rOut) const;
+ vcl::Font ChgPhysFont(OutputDevice& rOut) const;
+
+ Size GetCapitalSize( const OutputDevice *pOut, const OUString &rTxt,
+ const sal_Int32 nIdx, const sal_Int32 nLen) const;
+ void DrawCapital( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
+ const sal_Int32 nIdx, const sal_Int32 nLen ) const;
+
+ Size GetPhysTxtSize( const OutputDevice *pOut, const OUString &rTxt,
+ const sal_Int32 nIdx, const sal_Int32 nLen ) const;
+
+ Size GetPhysTxtSize( const OutputDevice *pOut );
+
+ Size GetTextSize(const OutputDevice& rOut, const OUString &rTxt,
+ const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32) const;
+
+ void QuickDrawText( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
+ const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32,
+ o3tl::span<const sal_Int32> pDXArray = {} ) const;
+
+ Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
+ const sal_Int32 nIdx, const sal_Int32 nLen,
+ std::vector<sal_Int32>* pDXArray = nullptr ) const;
+
+ void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
+ const Point &rPos, const OUString &rTxt,
+ const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32 ) const;
+
+ static tools::Polygon DrawArrow( OutputDevice &rOut, const tools::Rectangle& rRect,
+ const Size& rSize, const Color& rCol, bool bLeftOrTop,
+ bool bVertical );
+
+ SvxFont& operator=( const SvxFont& rFont );
+ SvxFont& operator=( const Font& rFont );
+};
+
+#endif // INCLUDED_EDITENG_SVXFONT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
new file mode 100644
index 000000000..e5ed1949b
--- /dev/null
+++ b/include/editeng/svxrtf.hxx
@@ -0,0 +1,295 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_SVXRTF_HXX
+#define INCLUDED_EDITENG_SVXRTF_HXX
+
+#include <svl/itemset.hxx>
+#include <svtools/parrtf.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+#include <vcl/font.hxx>
+
+#include <editeng/editengdllapi.h>
+
+#include <optional>
+#include <vector>
+#include <map>
+#include <memory>
+
+struct SvxRTFStyleType;
+class SvxRTFItemStackType;
+class SvxRTFItemStackList : public std::vector<std::unique_ptr<SvxRTFItemStackType>> {};
+
+// Mapper-Classes for the various requirements on Document positions
+// Swg - NodePosition is a SwIndex, which is used internally
+// EditEngine - ULONG to list of paragraphs
+
+class EditEngine;
+class ContentNode;
+class EditNodeIdx
+{
+public:
+ EditNodeIdx(EditEngine* pEE, ContentNode* pNd);
+ sal_Int32 GetIdx() const;
+ ContentNode* GetNode() { return mpNode; }
+private:
+ EditEngine* mpEditEngine;
+ ContentNode* mpNode;
+};
+
+class EditSelection;
+class EditPosition
+{
+private:
+ EditEngine* mpEditEngine;
+ EditSelection* mpCurSel;
+
+public:
+ EditPosition(EditEngine* pIEE, EditSelection* pSel);
+
+ sal_Int32 GetNodeIdx() const;
+ sal_Int32 GetCntIdx() const;
+
+ // clone NodeIndex
+ EditNodeIdx MakeNodeIdx() const;
+};
+
+typedef std::map<short, vcl::Font> SvxRTFFontTbl;
+
+// own helper classes for the RTF Parser
+struct SvxRTFStyleType
+{
+ SfxItemSet aAttrSet; // the attributes of Style (+ derivated!)
+ OUString sName;
+ sal_uInt16 nBasedOn;
+ sal_uInt8 nOutlineNo;
+
+ SvxRTFStyleType(SfxItemPool& rPool, const WhichRangesContainer& pWhichRange);
+};
+
+typedef std::map<sal_uInt16, SvxRTFStyleType> SvxRTFStyleTbl;
+
+class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
+{
+ std::vector<Color> maColorTable;
+ SvxRTFFontTbl m_FontTable;
+ SvxRTFStyleTbl m_StyleTable;
+ std::deque< std::unique_ptr<SvxRTFItemStackType> > aAttrStack;
+ SvxRTFItemStackList m_AttrSetList;
+
+ std::map<sal_uInt16, sal_uInt16> aPlainMap;
+ std::map<sal_uInt16, sal_uInt16> aPardMap;
+ WhichRangesContainer aWhichMap;
+
+ std::optional<EditPosition> mxInsertPosition;
+ SfxItemPool* pAttrPool;
+ std::optional<Color> mxDefaultColor;
+ std::optional<vcl::Font> pDfltFont;
+ std::unique_ptr<SfxItemSet> pRTFDefaults;
+
+ int nDfltFont;
+
+ bool bNewDoc : 1; // sal_False - Reading in an existing
+ bool bNewGroup : 1; // sal_True - there was an opening parenthesis
+ bool bIsSetDfltTab : 1; // sal_True - DefTab was loaded
+ bool bChkStyleAttr : 1; // sal_True - StyleSheets are evaluated
+ bool bCalcValue : 1; // sal_True - Twip values adapt to App
+ bool bIsLeftToRightDef : 1; // sal_True - in LeftToRight char run def.
+ // sal_False - in RightToLeft char run def.
+ bool bIsInReadStyleTab : 1; // sal_True - in ReadStyleTable
+
+ SvxRTFParser(SvxRTFParser const&) = delete;
+ void operator=(SvxRTFParser const&) = delete;
+
+ void ClearColorTbl();
+ void ClearAttrStack();
+
+ SvxRTFItemStackType* GetAttrSet_(); // Create new ItemStackType:s
+ void ClearStyleAttr_( SvxRTFItemStackType& rStkType );
+
+ // Sets all the attributes that are different from the current
+ void SetAttrSet( SvxRTFItemStackType &rSet );
+ void SetDefault( int nToken, int nValue );
+
+ // Execute pard / plain
+ void RTFPardPlain( bool bPard, SfxItemSet** ppSet );
+
+ void BuildWhichTable();
+
+ enum RTF_CharTypeDef
+ {
+ NOTDEF_CHARTYPE,
+ LOW_CHARTYPE,
+ HIGH_CHARTYPE,
+ DOUBLEBYTE_CHARTYPE
+ };
+
+ // set latin/asian/complex character attributes
+ void SetScriptAttr(
+ RTF_CharTypeDef eType, SfxItemSet& rSet, SfxPoolItem& rItem );
+
+protected:
+ virtual void InsertPara() = 0;
+
+ static void DelCharAtEnd( OUStringBuffer& rStr, const sal_Unicode cDel );
+
+ // is called for each token that is recognized in CallParser
+ virtual void NextToken( int nToken ) override;
+
+ void ReadStyleTable();
+ void ReadColorTable();
+ void ReadFontTable();
+ void ReadAttr( int nToken, SfxItemSet* pSet );
+ void ReadTabAttr( int nToken, SfxItemSet& rSet );
+
+ inline SfxItemSet& GetAttrSet();
+ // no text yet inserted? (SttPos from the top stack entry!)
+ bool IsAttrSttPos();
+ void AttrGroupEnd(); // edit the current, delete from stack
+ void SetAllAttrOfStk(); // end all Attr. and set it into doc
+
+
+ virtual void InsertText() = 0;
+ virtual void MovePos( bool bForward = true ) = 0;
+ virtual void SetEndPrevPara( std::optional<EditNodeIdx>& rpNodePos,
+ sal_Int32& rCntPos )=0;
+ virtual void SetAttrInDoc( SvxRTFItemStackType &rSet );
+ // for Tokens, which are not evaluated in ReadAttr
+ virtual void UnknownAttrToken( int nToken );
+
+ // if no-one would like to have any twips
+ virtual void CalcValue();
+
+ SvxRTFParser( SfxItemPool& rAttrPool, SvStream& rIn );
+ virtual ~SvxRTFParser() override;
+
+ void SetNewDoc( bool bFlag ) { bNewDoc = bFlag; }
+ bool IsChkStyleAttr() const { return bChkStyleAttr; }
+ void SetChkStyleAttr( bool bFlag ) { bChkStyleAttr = bFlag; }
+ bool IsCalcValue() const { return bCalcValue; }
+ void SetCalcValue( bool bFlag ) { bCalcValue = bFlag; }
+
+ // Query/Set the current insert position
+ void SetInsPos( const EditPosition& rNew );
+ SvxRTFStyleTbl& GetStyleTbl() { return m_StyleTable; }
+
+public:
+
+ virtual SvParserState CallParser() override;
+
+ inline const Color& GetColor( size_t nId ) const;
+ const vcl::Font& GetFont( sal_uInt16 nId ); // Changes the default Font
+
+ virtual bool IsEndPara( EditNodeIdx* pNd, sal_Int32 nCnt ) const = 0;
+
+ // to set a different attribute pool. May only be done prior to CallParser!
+ // The maps are not generated anew!
+ void SetAttrPool( SfxItemPool* pNewPool ) { pAttrPool = pNewPool; }
+ // to set different WhichIds for a different pool.
+ void SetPardMap(sal_uInt16 wid, sal_uInt16 widTrue) { aPardMap[wid] = widTrue; }
+ // to be able to assign them from the outside as for example table cells
+ void ReadBorderAttr( int nToken, SfxItemSet& rSet, bool bTableDef=false );
+ void ReadBackgroundAttr( int nToken, SfxItemSet& rSet, bool bTableDef=false );
+
+ // for asynchronous read from the SvStream
+ virtual void Continue( int nToken ) override;
+
+ // get RTF default ItemSets. Must be used by pard/plain tokens or in
+ // reset of Style-Items
+ const SfxItemSet& GetRTFDefaults();
+};
+
+// The stack for the attributes:
+// this class may only be used by SvxRTFParser!
+class SvxRTFItemStackType
+{
+ friend class SvxRTFParser;
+
+ SfxItemSet aAttrSet;
+ std::optional<EditNodeIdx> mxStartNodeIdx;
+ std::optional<EditNodeIdx> mxEndNodeIdx;
+ sal_Int32 nSttCnt, nEndCnt;
+ SvxRTFItemStackList maChildList;
+ sal_uInt16 nStyleNo;
+
+ SvxRTFItemStackType(SvxRTFItemStackType const&) = delete;
+ void operator=(SvxRTFItemStackType const&) = delete;
+
+ SvxRTFItemStackType( SfxItemPool&, const WhichRangesContainer& pWhichRange,
+ const EditPosition& );
+
+ static std::unique_ptr<SvxRTFItemStackType> createSvxRTFItemStackType(
+ SfxItemPool&, const WhichRangesContainer& pWhichRange, const EditPosition&);
+
+ void Add(std::unique_ptr<SvxRTFItemStackType>);
+ void Compress( const SvxRTFParser& );
+ void DropChildList();
+
+public:
+ SvxRTFItemStackType(const SvxRTFItemStackType&, const EditPosition&,
+ bool bCopyAttr);
+ ~SvxRTFItemStackType();
+ //cmc, I'm very suspicious about SetStartPos, it doesn't change
+ //its children's starting position, and the implementation looks
+ //bad, consider this deprecated.
+ void SetStartPos( const EditPosition& rPos );
+
+ const EditNodeIdx& GetSttNode() const { return *mxStartNodeIdx; }
+ const EditNodeIdx& GetEndNode() const { return *mxEndNodeIdx; }
+
+ sal_Int32 GetSttCnt() const { return nSttCnt; }
+ sal_Int32 GetEndCnt() const { return nEndCnt; }
+
+ SfxItemSet& GetAttrSet() { return aAttrSet; }
+ const SfxItemSet& GetAttrSet() const { return aAttrSet; }
+
+ sal_uInt16 StyleNo() const { return nStyleNo; }
+
+ void SetRTFDefaults( const SfxItemSet& rDefaults );
+};
+
+
+// ----------- Inline Implementations --------------
+
+inline const Color& SvxRTFParser::GetColor( size_t nId ) const
+{
+ if( nId < maColorTable.size() )
+ return maColorTable[ nId ];
+ return *mxDefaultColor;
+}
+
+inline SfxItemSet& SvxRTFParser::GetAttrSet()
+{
+ SvxRTFItemStackType* pTmp;
+ if( bNewGroup || aAttrStack.empty() )
+ pTmp = GetAttrSet_();
+ else
+ {
+ pTmp = aAttrStack.back().get();
+ if ( pTmp == nullptr )
+ pTmp = GetAttrSet_();
+ }
+ return pTmp->aAttrSet;
+}
+
+
+#endif // INCLUDED_EDITENG_SVXRTF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/swafopt.hxx b/include/editeng/swafopt.hxx
new file mode 100644
index 000000000..180ba6d1b
--- /dev/null
+++ b/include/editeng/swafopt.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_SWAFOPT_HXX
+#define INCLUDED_EDITENG_SWAFOPT_HXX
+
+#include <sal/config.h>
+
+#include <editeng/editengdllapi.h>
+#include <o3tl/sorted_vector.hxx>
+#include <rtl/ustring.hxx>
+#include <utility>
+#include <vcl/font.hxx>
+#include <vcl/vclenum.hxx>
+
+class SmartTagMgr;
+
+namespace editeng {
+
+class EDITENG_DLLPUBLIC IAutoCompleteString
+{
+private:
+ OUString m_String;
+public:
+ explicit IAutoCompleteString(OUString aString) : m_String(std::move(aString)) {}
+ virtual ~IAutoCompleteString() {}
+ OUString const& GetAutoCompleteString() const { return m_String; }
+};
+
+struct CompareAutoCompleteString
+{
+ bool operator()(IAutoCompleteString *const& lhs,
+ IAutoCompleteString *const& rhs) const
+ {
+ return lhs->GetAutoCompleteString().compareToIgnoreAsciiCase(
+ rhs->GetAutoCompleteString()) < 0;
+ }
+};
+
+class SortedAutoCompleteStrings
+ : public o3tl::sorted_vector<IAutoCompleteString*, CompareAutoCompleteString>
+{
+ bool owning_;
+
+ SortedAutoCompleteStrings& operator =(SortedAutoCompleteStrings const &) = delete;
+
+ // For createNonOwningCopy only:
+ SortedAutoCompleteStrings(SortedAutoCompleteStrings const & other):
+ sorted_vector(other), owning_(false) {}
+
+public:
+ SortedAutoCompleteStrings(): owning_(true) {}
+
+ ~SortedAutoCompleteStrings() { if (owning_) DeleteAndDestroyAll(); }
+
+ SortedAutoCompleteStrings createNonOwningCopy() const { return *this; }
+};
+
+} // namespace editeng
+
+// Class of options for AutoFormat
+struct EDITENG_DLLPUBLIC SvxSwAutoFormatFlags
+{
+ vcl::Font aBulletFont;
+ vcl::Font aByInputBulletFont;
+ /// only valid inside the Dialog!!!
+ const editeng::SortedAutoCompleteStrings * m_pAutoCompleteList;
+ SmartTagMgr* pSmartTagMgr;
+
+ sal_UCS4 cBullet;
+ sal_UCS4 cByInputBullet;
+
+ sal_uInt16 nAutoCmpltWordLen, nAutoCmpltListLen;
+ sal_uInt16 nAutoCmpltExpandKey;
+
+ sal_uInt8 nRightMargin;
+
+ bool bAutoCorrect : 1;
+ bool bCapitalStartSentence : 1;
+ bool bCapitalStartWord : 1;
+
+ bool bChgUserColl : 1;
+ bool bChgEnumNum : 1;
+
+ bool bAFormatByInput : 1;
+ bool bDelEmptyNode : 1;
+ bool bSetNumRule : 1;
+
+ bool bChgOrdinalNumber : 1;
+ bool bChgToEnEmDash : 1;
+ bool bAddNonBrkSpace : 1;
+ bool bTransliterateRTL : 1;
+ bool bChgAngleQuotes : 1;
+ bool bChgWeightUnderl : 1;
+ bool bSetINetAttr : 1;
+
+ bool bSetBorder : 1;
+ bool bCreateTable : 1;
+ bool bReplaceStyles : 1;
+
+ bool bWithRedlining : 1;
+
+ bool bRightMargin : 1;
+
+ bool bAutoCompleteWords : 1;
+ bool bAutoCmpltCollectWords : 1;
+ bool bAutoCmpltEndless : 1;
+// -- under NT here starts a new long
+ bool bAutoCmpltAppendBlank : 1;
+ bool bAutoCmpltShowAsTip : 1;
+
+ bool bAFormatDelSpacesAtSttEnd : 1;
+ bool bAFormatDelSpacesBetweenLines : 1;
+ bool bAFormatByInpDelSpacesAtSttEnd : 1;
+ bool bAFormatByInpDelSpacesBetweenLines : 1;
+
+ bool bAutoCmpltKeepList : 1;
+
+ SvxSwAutoFormatFlags();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/tstpitem.hxx b/include/editeng/tstpitem.hxx
new file mode 100644
index 000000000..b5aab04bc
--- /dev/null
+++ b/include/editeng/tstpitem.hxx
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_TSTPITEM_HXX
+#define INCLUDED_EDITENG_TSTPITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+#include <o3tl/sorted_vector.hxx>
+
+// class SvxTabStop ------------------------------------------------------
+
+#define SVX_TAB_DEFCOUNT 10
+#define SVX_TAB_DEFDIST 1134 // 2cm in twips
+#define SVX_TAB_NOTFOUND USHRT_MAX
+#define cDfltDecimalChar u'\0' // Get from IntlWrapper
+#define cDfltFillChar u' '
+
+class EDITENG_DLLPUBLIC SvxTabStop
+{
+private:
+ sal_Int32 nTabPos;
+ SvxTabAdjust eAdjustment;
+ mutable sal_Unicode
+ m_cDecimal;
+ sal_Unicode cFill;
+
+ void fillDecimal() const;
+
+public:
+ SvxTabStop();
+ explicit SvxTabStop( const sal_Int32 nPos,
+ const SvxTabAdjust eAdjst = SvxTabAdjust::Left,
+ const sal_Unicode cDec = cDfltDecimalChar,
+ const sal_Unicode cFil = cDfltFillChar );
+
+ sal_Int32& GetTabPos() { return nTabPos; }
+ sal_Int32 GetTabPos() const { return nTabPos; }
+
+ SvxTabAdjust& GetAdjustment() { return eAdjustment; }
+ SvxTabAdjust GetAdjustment() const { return eAdjustment; }
+
+ sal_Unicode& GetDecimal() { fillDecimal(); return m_cDecimal; }
+ sal_Unicode GetDecimal() const { fillDecimal(); return m_cDecimal; }
+
+ sal_Unicode& GetFill() { return cFill; }
+ sal_Unicode GetFill() const { return cFill; }
+
+ bool operator==( const SvxTabStop& rTS ) const
+ {
+ return ( nTabPos == rTS.nTabPos &&
+ eAdjustment == rTS.eAdjustment &&
+ m_cDecimal == rTS.m_cDecimal &&
+ cFill == rTS.cFill );
+ }
+ bool operator!=( const SvxTabStop& rTS ) const
+ {
+ return !operator==(rTS);
+ }
+ // For the SortedArray:
+ bool operator <( const SvxTabStop& rTS ) const
+ { return nTabPos < rTS.nTabPos; }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+};
+
+// class SvxTabStopItem --------------------------------------------------
+
+typedef o3tl::sorted_vector<SvxTabStop> SvxTabStopArr;
+
+/* [Description]
+
+ This item describes a list of TabStops.
+*/
+
+class EDITENG_DLLPUBLIC SvxTabStopItem final : public SfxPoolItem
+{
+ SvxTabStopArr maTabStops;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxTabStopItem( sal_uInt16 nWhich );
+ SvxTabStopItem( const sal_uInt16 nTabs,
+ const sal_uInt16 nDist,
+ const SvxTabAdjust eAdjst /*= SvxTabAdjust::Default*/,
+ sal_uInt16 nWhich );
+
+ // Returns index of the tab or TAB_NOTFOUND
+ sal_uInt16 GetPos( const SvxTabStop& rTab ) const;
+
+ // Returns index of the tab at nPos, or TAB_NOTFOUND
+ sal_uInt16 GetPos( const sal_Int32 nPos ) const;
+
+ // unprivatized:
+ sal_uInt16 Count() const { return maTabStops.size(); }
+ bool Insert( const SvxTabStop& rTab );
+ void Insert( const SvxTabStopItem* pTabs );
+ void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 )
+ { maTabStops.erase( maTabStops.begin() + nPos, maTabStops.begin() + nPos + nLen ); }
+
+ // Assignment operator, equality operator (caution: expensive!)
+
+ // this is already included in SfxPoolItem declaration
+ //int operator!=( const SvxTabStopItem& rTSI ) const
+ // { return !( operator==( rTSI ) ); }
+
+ const SvxTabStop& operator[]( const sal_uInt16 nPos ) const
+ { return maTabStops[nPos]; }
+
+ const SvxTabStop& At( const sal_uInt16 nPos ) const
+ {
+ return maTabStops[nPos];
+ }
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxTabStopItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/twolinesitem.hxx b/include/editeng/twolinesitem.hxx
new file mode 100644
index 000000000..d39a3ac60
--- /dev/null
+++ b/include/editeng/twolinesitem.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_TWOLINESITEM_HXX
+#define INCLUDED_EDITENG_TWOLINESITEM_HXX
+
+#include <sal/types.h>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class EDITENG_DLLPUBLIC SvxTwoLinesItem final : public SfxPoolItem
+{
+ sal_Unicode cStartBracket, cEndBracket;
+ bool bOn;
+public:
+ SvxTwoLinesItem( bool bOn /*= true*/,
+ sal_Unicode nStartBracket /*= 0*/,
+ sal_Unicode nEndBracket /*= 0*/,
+ sal_uInt16 nId );
+ virtual ~SvxTwoLinesItem() override;
+
+ SvxTwoLinesItem(SvxTwoLinesItem const &) = default;
+ SvxTwoLinesItem(SvxTwoLinesItem &&) = default;
+ SvxTwoLinesItem & operator =(SvxTwoLinesItem const &) = delete; // due to SfxPoolItem
+ SvxTwoLinesItem & operator =(SvxTwoLinesItem &&) = delete; // due to SfxPoolItem
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxTwoLinesItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& rIntl ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ bool GetValue() const { return bOn; }
+
+ sal_Unicode GetStartBracket() const { return cStartBracket; }
+
+ sal_Unicode GetEndBracket() const { return cEndBracket; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/txtrange.hxx b/include/editeng/txtrange.hxx
new file mode 100644
index 000000000..c6661f687
--- /dev/null
+++ b/include/editeng/txtrange.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_TXTRANGE_HXX
+#define INCLUDED_EDITENG_TXTRANGE_HXX
+
+#include <editeng/editengdllapi.h>
+#include <tools/gen.hxx>
+#include <tools/poly.hxx>
+#include <deque>
+#include <optional>
+
+namespace basegfx {
+ class B2DPolyPolygon;
+}
+
+class EDITENG_DLLPUBLIC TextRanger
+{
+ //! The RangeCache class is used to cache the result of a single range calculation.
+ struct RangeCacheItem
+ {
+ Range range; //!< Range for which we calculated results.
+ std::deque<tools::Long> results; //!< Calculated results for the range.
+ RangeCacheItem(const Range& rng) : range(rng) {};
+ };
+ std::deque<RangeCacheItem> mRangeCache; //!< Cached range calculations.
+ tools::PolyPolygon maPolyPolygon; // Surface polygon
+ std::optional<tools::PolyPolygon> mpLinePolyPolygon; // Line polygon
+ mutable std::optional<tools::Rectangle> mxBound; // Comprehensive rectangle
+ sal_uInt16 nCacheSize; // Cache-Size
+ sal_uInt16 nRight; // Distance Contour-Text
+ sal_uInt16 nLeft; // Distance Text-Contour
+ sal_uInt16 nUpper; // Distance Contour-Text
+ sal_uInt16 nLower; // Distance Text-Contour
+ sal_uInt32 nPointCount; // Number of polygon points
+ bool bSimple : 1; // Just outside edge
+ bool bInner : 1; // TRUE: Object inline (EditEngine);
+ // FALSE: Object flow (StarWriter);
+ bool bVertical :1;// for vertical writing mode
+
+ TextRanger( const TextRanger& ) = delete;
+ const tools::Rectangle& GetBoundRect_() const;
+public:
+ TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B2DPolyPolygon* pLinePolyPolygon,
+ sal_uInt16 nCacheSize, sal_uInt16 nLeft, sal_uInt16 nRight,
+ bool bSimple, bool bInner, bool bVert = false );
+ ~TextRanger();
+ std::deque<tools::Long>* GetTextRanges( const Range& rRange );
+ sal_uInt16 GetRight() const { return nRight; }
+ sal_uInt16 GetLeft() const { return nLeft; }
+ sal_uInt16 GetUpper() const { return nUpper; }
+ sal_uInt16 GetLower() const { return nLower; }
+ sal_uInt32 GetPointCount() const { return nPointCount; }
+ bool IsSimple() const { return bSimple; }
+ bool IsInner() const { return bInner; }
+ bool IsVertical() const { return bVertical; }
+ const tools::Rectangle& GetBoundRect() const
+ { return mxBound ? const_cast< const tools::Rectangle& >(*mxBound) : GetBoundRect_(); }
+ void SetUpper( sal_uInt16 nNew ){ nUpper = nNew; }
+ void SetLower( sal_uInt16 nNew ){ nLower = nNew; }
+ void SetVertical( bool bNew );
+};
+
+#endif // _TXTRANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/udlnitem.hxx b/include/editeng/udlnitem.hxx
new file mode 100644
index 000000000..e190348bb
--- /dev/null
+++ b/include/editeng/udlnitem.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_UDLNITEM_HXX
+#define INCLUDED_EDITENG_UDLNITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <tools/color.hxx>
+#include <tools/fontenum.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxTextLineItem ------------------------------------------------
+
+/* Value container for underline and overline font effects */
+
+class EDITENG_DLLPUBLIC SvxTextLineItem : public SfxEnumItem<FontLineStyle>
+{
+ Color mColor;
+public:
+ SvxTextLineItem( const FontLineStyle eSt,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxTextLineItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ using SfxEnumItem::SetValue;
+ virtual bool HasBoolValue() const override;
+ virtual bool GetBoolValue() const override;
+ virtual void SetBoolValue( bool bVal ) override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ // enum cast
+ FontLineStyle GetLineStyle() const
+ { return GetValue(); }
+ void SetLineStyle( FontLineStyle eNew )
+ { SetValue(eNew); }
+
+ const Color& GetColor() const { return mColor; }
+ void SetColor( const Color& rCol ) { mColor = rCol; }
+};
+
+// class SvxUnderlineItem ------------------------------------------------
+
+/* Value container for underline font effects */
+
+class EDITENG_DLLPUBLIC SvxUnderlineItem final : public SvxTextLineItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxUnderlineItem( const FontLineStyle eSt,
+ const sal_uInt16 nId );
+
+ virtual SvxUnderlineItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const override;
+};
+
+// class SvxOverlineItem ------------------------------------------------
+
+/* Value container for overline font effects */
+
+class EDITENG_DLLPUBLIC SvxOverlineItem final : public SvxTextLineItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxOverlineItem( const FontLineStyle eSt,
+ const sal_uInt16 nId );
+
+ virtual SvxOverlineItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const override;
+};
+
+#endif // INCLUDED_EDITENG_UDLNITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx
new file mode 100644
index 000000000..b0131ab99
--- /dev/null
+++ b/include/editeng/ulspitem.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_ULSPITEM_HXX
+#define INCLUDED_EDITENG_ULSPITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxULSpaceItem --------------------------------------------------
+
+/* [Description]
+
+ This item describes the Upper- and Lower space of a page or paragraph.
+*/
+
+#define ULSPACE_16_VERSION (sal_uInt16(0x0001))
+
+class EDITENG_DLLPUBLIC SvxULSpaceItem final : public SfxPoolItem
+{
+ sal_uInt16 nUpper; // Upper space
+ sal_uInt16 nLower; // Lower space
+ bool bContext; // Contextual spacing?
+ sal_uInt16 nPropUpper, nPropLower; // relative or absolute (=100%)
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxULSpaceItem( const sal_uInt16 nId );
+ SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxULSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
+ virtual bool HasMetrics() const override;
+
+ inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 );
+ inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 );
+
+ void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; }
+ void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; }
+ void SetContextValue( const bool bC ) { bContext = bC; }
+ void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; }
+ void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; }
+
+ sal_uInt16 GetUpper() const { return nUpper; }
+ sal_uInt16 GetLower() const { return nLower; }
+ bool GetContext() const { return bContext; }
+ sal_uInt16 GetPropUpper() const { return nPropUpper; }
+ sal_uInt16 GetPropLower() const { return nPropLower; }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp )
+{
+ nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp;
+}
+inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp )
+{
+ nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoedhlp.hxx b/include/editeng/unoedhlp.hxx
new file mode 100644
index 000000000..5b70de35c
--- /dev/null
+++ b/include/editeng/unoedhlp.hxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOEDHLP_HXX
+#define INCLUDED_EDITENG_UNOEDHLP_HXX
+
+#include <memory>
+#include <vcl/textdata.hxx>
+#include <svl/hint.hxx>
+#include <tools/gen.hxx>
+#include <editeng/editengdllapi.h>
+
+struct EENotify;
+class EditEngine;
+
+/** Extends TextHint by two additional parameters which are necessary
+ for the SfxHintId::EditSourceParasMoved hint. TextHint's value in this
+ case denotes the destination position, the two parameters the
+ start and the end of the moved paragraph range.
+ */
+class SAL_DLLPUBLIC_RTTI SvxEditSourceHint : public TextHint
+{
+private:
+ sal_Int32 mnStart;
+ sal_Int32 mnEnd;
+
+public:
+ SvxEditSourceHint( SfxHintId nId );
+ SvxEditSourceHint( SfxHintId nId, sal_Int32 nValue, sal_Int32 nStart, sal_Int32 nEnd );
+
+ using TextHint::GetValue;
+ sal_Int32 GetStartValue() const { return mnStart;}
+ sal_Int32 GetEndValue() const { return mnEnd;}
+};
+class SvxEditSourceHintEndPara final : public SvxEditSourceHint
+{
+public:
+ SvxEditSourceHintEndPara() : SvxEditSourceHint(SfxHintId::EditSourceSelectionChanged) {}
+};
+/** Helper class for common functionality in edit sources
+ */
+class EDITENG_DLLPUBLIC SvxEditSourceHelper
+{
+public:
+
+ /** Translates EditEngine notifications into broadcastable hints
+
+ @param aNotify
+ Notification object sent by the EditEngine.
+
+ @return the translated hint
+ */
+ static ::std::unique_ptr<SfxHint> EENotification2Hint( EENotify const * aNotify );
+
+ /** Calculate attribute run for EditEngines
+
+ Please note that the range returned is half-open: [nStartIndex,nEndIndex)
+
+ @param nStartIndex
+ Herein, the start index of the range of similar attributes is returned
+
+ @param nEndIndex
+ Herein, the end index (exclusive) of the range of similar attributes is returned
+
+ @param rEE
+ The EditEngine to query for attributes
+
+ @param nPara
+ The paragraph the following index value is to be interpreted in
+
+ @param nIndex
+ The character index from which the range of similar attributed characters is requested
+ */
+ static void GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, const EditEngine& rEE, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false);
+
+ /** Convert point from edit engine to user coordinate space
+
+ As the edit engine internally keeps vertical text unrotated,
+ all internal edit engine methods return their stuff unrotated,
+ too. This method rotates and shifts given point appropriately,
+ if vertical writing is on.
+
+ @param rPoint
+ Point to transform
+
+ @param rEESize
+ Paper size of the edit engine
+
+ @param bIsVertical
+ Whether output text is vertical or not
+
+ @return the possibly transformed point
+ */
+ static Point EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical );
+
+ /** Convert point from user to edit engine coordinate space
+
+ As the edit engine internally keeps vertical text unrotated,
+ all internal edit engine methods return their stuff unrotated,
+ too. This method rotates and shifts given point appropriately,
+ if vertical writing is on.
+
+ @param rPoint
+ Point to transform
+
+ @param rEESize
+ Paper size of the edit engine
+
+ @param bIsVertical
+ Whether output text is vertical or not
+
+ @return the possibly transformed point
+ */
+ static Point UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical );
+
+ /** Convert rect from edit engine to user coordinate space
+
+ As the edit engine internally keeps vertical text unrotated,
+ all internal edit engine methods return their stuff unrotated,
+ too. This method rotates and shifts given rect appropriately,
+ if vertical writing is on.
+
+ @param rRect
+ Rectangle to transform
+
+ @param rEESize
+ Paper size of the edit engine
+
+ @param bIsVertical
+ Whether output text is vertical or not
+
+ @return the possibly transformed rect
+ */
+ static tools::Rectangle EEToUserSpace( const tools::Rectangle& rRect, const Size& rEESize, bool bIsVertical );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoedprx.hxx b/include/editeng/unoedprx.hxx
new file mode 100644
index 000000000..f1db61fe9
--- /dev/null
+++ b/include/editeng/unoedprx.hxx
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOEDPRX_HXX
+#define INCLUDED_EDITENG_UNOEDPRX_HXX
+
+#include <config_options.h>
+#include <memory>
+#include <svl/SfxBroadcaster.hxx>
+#include <editeng/unoedsrc.hxx>
+
+#include <editeng/editdata.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvxAccessibleTextAdapter final : public SvxTextForwarder
+{
+public:
+ SvxAccessibleTextAdapter();
+ virtual ~SvxAccessibleTextAdapter() override;
+
+ virtual sal_Int32 GetParagraphCount() const override;
+ virtual sal_Int32 GetTextLen( sal_Int32 nParagraph ) const override;
+ virtual OUString GetText( const ESelection& rSel ) const override;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ) const override;
+ virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const override;
+ virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) override;
+ virtual void RemoveAttribs( const ESelection& rSelection ) override;
+ virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const override;
+
+ sal_Int32 CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex );
+
+ virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const override;
+ virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const override;
+
+ virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) override;
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) override;
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) override;
+ virtual void QuickInsertLineBreak( const ESelection& rSel ) override;
+
+ virtual SfxItemPool* GetPool() const override;
+
+ virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override;
+ virtual void FieldClicked( const SvxFieldItem& rField ) override;
+
+ virtual bool IsValid() const override;
+
+ virtual LanguageType GetLanguage( sal_Int32, sal_Int32 ) const override;
+ virtual sal_Int32 GetFieldCount( sal_Int32 nPara ) const override;
+ virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const override;
+ virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const override;
+ virtual tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const override;
+ virtual tools::Rectangle GetParaBounds( sal_Int32 nPara ) const override;
+ virtual MapMode GetMapMode() const override;
+ virtual OutputDevice* GetRefDevice() const override;
+ virtual bool GetIndexAtPoint( const Point&, sal_Int32& nPara, sal_Int32& nIndex ) const override;
+ virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const override;
+ virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const override;
+ virtual sal_Int32 GetLineCount( sal_Int32 nPara ) const override;
+ virtual sal_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const override;
+ virtual void GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const override;
+ virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const override;
+
+ virtual bool Delete( const ESelection& ) override;
+ virtual bool InsertText( const OUString&, const ESelection& ) override;
+ virtual bool QuickFormatDoc( bool bFull = false ) override;
+ virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override;
+ virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override;
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr() override;
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ // (not needed for accessibility, only for new import API)
+ virtual void AppendParagraph() override;
+ virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) override;
+
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource) override;
+
+ void SetForwarder( SvxTextForwarder& );
+ bool HaveImageBullet( sal_Int32 nPara ) const;
+ bool HaveTextBullet( sal_Int32 nPara ) const;
+
+ /** Query whether all text in given selection is editable
+
+ @return sal_True if every character in the given selection can
+ be changed, and sal_False if e.g. a field or a bullet is
+ contained therein.
+ */
+ bool IsEditable( const ESelection& rSelection ) const;
+
+private:
+ SvxTextForwarder* mpTextForwarder;
+};
+
+class SvxAccessibleTextEditViewAdapter final : public SvxEditViewForwarder
+{
+public:
+
+ SvxAccessibleTextEditViewAdapter();
+ virtual ~SvxAccessibleTextEditViewAdapter() override;
+
+ // SvxViewForwarder interface
+ virtual bool IsValid() const override;
+ virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const override;
+ virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const override;
+
+ // SvxEditViewForwarder interface
+ virtual bool GetSelection( ESelection& rSelection ) const override;
+ virtual bool SetSelection( const ESelection& rSelection ) override;
+ virtual bool Copy() override;
+ virtual bool Cut() override;
+ virtual bool Paste() override;
+
+ void SetForwarder( SvxEditViewForwarder&, SvxAccessibleTextAdapter& );
+
+private:
+ SvxEditViewForwarder* mpViewForwarder;
+ SvxAccessibleTextAdapter* mpTextForwarder;
+};
+
+class UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvxEditSourceAdapter final : public SvxEditSource
+{
+public:
+ SvxEditSourceAdapter();
+ virtual ~SvxEditSourceAdapter() override;
+
+ virtual std::unique_ptr<SvxEditSource> Clone() const override;
+ virtual SvxTextForwarder* GetTextForwarder() override;
+ SvxAccessibleTextAdapter* GetTextForwarderAdapter(); // covariant return types don't work on MSVC
+ virtual SvxViewForwarder* GetViewForwarder() override;
+ virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate = false ) override;
+ SvxAccessibleTextEditViewAdapter* GetEditViewForwarderAdapter( bool bCreate ); // covariant return types don't work on MSVC
+ virtual void UpdateData() override;
+ virtual SfxBroadcaster& GetBroadcaster() const override;
+
+ void SetEditSource( ::std::unique_ptr< SvxEditSource > && pAdaptee );
+
+ bool IsValid() const { return mbEditSourceValid;}
+
+private:
+ SvxEditSourceAdapter( const SvxEditSourceAdapter& ) = delete;
+ SvxEditSourceAdapter& operator= ( const SvxEditSourceAdapter& ) = delete;
+
+ ::std::unique_ptr< SvxEditSource > mpAdaptee;
+
+ SvxAccessibleTextAdapter maTextAdapter;
+ SvxAccessibleTextEditViewAdapter maEditViewAdapter;
+
+ mutable SfxBroadcaster maDummyBroadcaster;
+
+ bool mbEditSourceValid;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoedsrc.hxx b/include/editeng/unoedsrc.hxx
new file mode 100644
index 000000000..44d8944bc
--- /dev/null
+++ b/include/editeng/unoedsrc.hxx
@@ -0,0 +1,533 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOEDSRC_HXX
+#define INCLUDED_EDITENG_UNOEDSRC_HXX
+
+#include <i18nlangtag/lang.h>
+#include <rtl/ustring.hxx>
+#include <tools/gen.hxx>
+#include <vcl/mapmod.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+#include <editeng/editeng.hxx>
+
+#include <vector>
+
+struct ESelection;
+struct EFieldInfo;
+struct EBulletInfo;
+class Color;
+class OutputDevice;
+class SfxItemSet;
+class SvxTextForwarder;
+class SvxViewForwarder;
+class SvxEditViewForwarder;
+class SvxFieldItem;
+class SfxBroadcaster;
+class SvxUnoTextRangeBase;
+
+typedef std::vector< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseVec;
+
+/** Wrapper class for unified EditEngine/Outliner access
+
+ This class wraps a textual object, which might or might not
+ contain an EditEngine/Outliner. Is used e.g. for filling an
+ EditEngine with the content of a cell, note page or page template.
+*/
+class EDITENG_DLLPUBLIC SvxEditSource
+{
+public:
+ SvxEditSource() = default;
+ SvxEditSource(SvxEditSource const &) = default;
+ SvxEditSource(SvxEditSource &&) = default;
+ SvxEditSource & operator =(SvxEditSource const &) = default;
+ SvxEditSource & operator =(SvxEditSource &&) = default;
+
+ virtual ~SvxEditSource();
+
+ /// Returns a new reference to the same object. This is a shallow copy
+ virtual std::unique_ptr<SvxEditSource> Clone() const = 0;
+
+ /** Query the text forwarder
+
+ @return the text forwarder, or NULL if the underlying object is dead
+ */
+ virtual SvxTextForwarder* GetTextForwarder() = 0;
+
+ /** Query the view forwarder
+
+ @return the view forwarder, or NULL if the underlying object
+ is dead, or if no view is available
+
+ @derive default implementation provided, overriding is optional
+ */
+ virtual SvxViewForwarder* GetViewForwarder();
+
+ /** Query the edit view forwarder
+
+ @param bCreate
+ Determines whether an EditView should be created, if there is
+ none active. If set to sal_True, and the underlying object is
+ not in EditMode, the text forwarder changes and the object is
+ set to EditMode.
+
+ @return the edit view forwarder, or NULL if the underlying
+ object is dead, or if no view is available (if bCreate is
+ sal_False, NULL is also returned if the object is not in
+ EditMode)
+
+ @derive default implementation provided, overriding is optional
+
+ @attention If this method is called with bCreate equal to
+ sal_True, all previously returned text forwarder can become
+ invalid
+ */
+ virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate = false );
+
+ /// Write back data to model
+ virtual void UpdateData() = 0;
+
+ /** Returns broadcaster the underlying edit engine's events are sent from
+
+ @derive default implementation provided, overriding is optional
+ */
+ virtual SfxBroadcaster& GetBroadcaster() const;
+
+ /** adds the given SvxUnoTextRangeBase to the text object
+ capsulated by this SvxEditSource. This allows the text
+ object to inform all created text ranges about changes
+ and also allows to re use already created instances.
+ All SvxUnoTextRangeBase must remove itself with
+ removeRange() before they are deleted. */
+ virtual void addRange( SvxUnoTextRangeBase* pNewRange );
+
+ /** removes the given SvxUnoTextRangeBase from the text
+ object capsulated by this SvxEditSource. This text range
+ will not be informed any longer of changes on the underlying
+ text and will also not re used anymore. */
+ virtual void removeRange( SvxUnoTextRangeBase* pOldRange );
+
+ /** returns a const list of all text ranges that are registered
+ for the underlying text object. */
+ virtual const SvxUnoTextRangeBaseVec& getRanges() const;
+};
+
+
+/** Contains an EditEngine or an Outliner and unifies access to them.
+
+ The EditEngine-UNO objects use this class only. To reflect changes
+ not only in the EditEngine, but also in the model data, call
+ SvxEditSource::UpdateData(). This copies back the data to the model's
+ EditTextObject/OutlinerParaObject.
+ */
+class EDITENG_DLLPUBLIC SvxTextForwarder
+{
+public:
+ virtual ~SvxTextForwarder() COVERITY_NOEXCEPT_FALSE;
+
+ virtual sal_Int32 GetParagraphCount() const = 0;
+ virtual sal_Int32 GetTextLen( sal_Int32 nParagraph ) const = 0;
+ virtual OUString GetText( const ESelection& rSel ) const = 0;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ) const = 0;
+ virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const = 0;
+ virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) = 0;
+ virtual void RemoveAttribs( const ESelection& rSelection ) = 0;
+ virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const = 0;
+
+ virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0;
+ virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const = 0;
+
+ virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) = 0;
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) = 0;
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) = 0;
+ virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0;
+
+ virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) = 0;
+ virtual void FieldClicked( const SvxFieldItem& rField ) = 0;
+
+ virtual SfxItemPool* GetPool() const = 0;
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr() = 0;
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph() = 0;
+ virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) = 0;
+
+ // XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource) = 0;
+
+ /** Query state of forwarder
+
+ @return false, if no longer valid
+ */
+ virtual bool IsValid() const = 0;
+
+ /** Query language of character at given position on the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query language in
+
+ @param nIndex[0 .. m-1]
+ Index of character to query language of
+ */
+ virtual LanguageType GetLanguage( sal_Int32 nPara, sal_Int32 nIndex ) const = 0;
+
+ /** Query number of fields in the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query field number in
+ */
+ virtual sal_Int32 GetFieldCount( sal_Int32 nPara ) const = 0;
+
+ /** Query information for given field number in the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query field info in
+
+ @param nField[0 .. m-1]
+ Index of field to query information of
+ */
+ virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const = 0;
+
+ /** Query information regarding bullets for given paragraph on the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query bullet info on
+ */
+ virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const = 0;
+
+ /** Query the bounding rectangle of the given character
+
+ @param nPara[0 .. n]
+ Index of paragraph to query the bounds in. <p>The virtual
+ character after the last character of the represented text,
+ i.e. the one at position n is a special case. Because it does
+ not represent an existing character its bounding box is
+ defined in relation to preceding characters. It should be
+ roughly equivalent to the bounding box of some character when
+ inserted at the end of the text. Its height typically being
+ the maximal height of all the characters in the text or the
+ height of the preceding character, its width being at least
+ one pixel so that the bounding box is not degenerate.<br>
+
+ @param nIndex[0 .. m-1]
+ Index of character to query the bounds of
+
+ @return rectangle in logical coordinates, relative to upper
+ left corner of text. The coordinates returned here are to be
+ interpreted in the map mode given by GetMapMode().
+ */
+ virtual tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const = 0;
+
+ /** Query the bounding rectangle of the given paragraph
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query the bounds of
+
+ @return rectangle in logical coordinates, relative to upper
+ left corner of text. The coordinates returned here are to be
+ interpreted in the map mode given by GetMapMode().
+ */
+ virtual tools::Rectangle GetParaBounds( sal_Int32 nPara ) const = 0;
+
+ /** Query the map mode of the underlying EditEngine/Outliner
+
+ @return the map mode used on the EditEngine/Outliner. The
+ values returned by GetParaBounds() and GetCharBounds() are to
+ be interpreted in this map mode, the point given to
+ GetIndexAtPoint() is interpreted in this map mode.
+ */
+ virtual MapMode GetMapMode() const = 0;
+
+ /** Query the reference output device of the underlying EditEngine/Outliner
+
+ @return the OutputDevice used from the EditEngine/Outliner to
+ format the text. It should be used when performing e.g. font
+ calculations, since this is usually a printer with fonts and
+ resolution different from the screen.
+ */
+ virtual OutputDevice* GetRefDevice() const = 0;
+
+ /** Query paragraph and character index of the character at the
+ given point. Returns sal_True on success, sal_False otherwise
+
+ @param rPoint
+ Point to query text position of. Is interpreted in logical
+ coordinates, relative to the upper left corner of the text, and
+ in the map mode given by GetMapMode()
+
+ @param rPara[0 .. n-1]
+ Index of paragraph the point is within
+
+ @param rIndex[0 .. m-1]
+ Index of character the point is over
+
+ @return true, if the point is over any text and both rPara and rIndex are valid
+
+ */
+ virtual bool GetIndexAtPoint( const Point& rPoint, sal_Int32& rPara, sal_Int32& rIndex ) const = 0;
+
+ /** Get the start and the end index of the word at the given index
+
+ An index value on a word leads from the first character of
+ that word up to and including the last space before the next
+ word. The index values returned do not contain any leading or
+ trailing white-space. If the input indices are invalid,
+ sal_False is returned.
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to start the search in
+
+ @param nIndex[0 .. m-1]
+ Index of character to query the search on
+
+ @param rStart
+ Start index (in the same paragraph)
+
+ @param rEnd
+ End index (in the same paragraph), this point to the last
+ character still contained in the query
+
+ @return true, if the result is non-empty
+ */
+ virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& rStart, sal_Int32& rEnd ) const = 0;
+
+ /** Query range of similar attributes
+
+ Please note that the range returned is half-open: [nStartIndex,nEndIndex)
+
+ @param nStartIndex
+ Herein, the start index of the range of similar attributes is returned
+
+ @param nEndIndex
+ Herein, the end index (exclusive) of the range of similar attributes is returned
+
+ @param nIndex
+ The character index from which the range of similar attributed characters is requested
+
+ @return true, if the range has been successfully determined
+ */
+ virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const = 0;
+
+ /** Query number of lines in the formatted paragraph
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query number of lines in
+
+ @return number of lines in given paragraph
+
+ */
+ virtual sal_Int32 GetLineCount( sal_Int32 nPara ) const = 0;
+
+ /** Query line length
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query line length in
+
+ @param nLine[0 .. m-1]
+ Index of line in paragraph to query line length of
+
+ */
+ virtual sal_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const = 0;
+
+ /** Query bounds of line in paragraph
+
+ @param rStart [output param; 0 .. text_len]
+ The index in the paragraph text that belongs to the chara at the start of the line
+
+ @param rEnd [output param; 0 .. text_len]
+ The index in the paragraph text that follows the last chara in the line
+
+ @param nParagraph[0 .. n-1]
+ Index of paragraph to query line length in
+
+ @param nLine[0 .. m-1]
+ Index of line in paragraph to query line length of
+
+ */
+ virtual void GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const = 0;
+
+ /** Query the line number for an index in the paragraphs text
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query line length in
+
+ @param nIndex[0 .. m-1]
+ Index of the char in the paragraph text
+
+ @returns [0 .. k-1]
+ The line number of the char in the paragraph
+ */
+ virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const = 0;
+
+ /** Delete given text range and reformat text
+
+ @param rSelection
+ The text range to be deleted
+
+ @return true if text has been successfully deleted
+ */
+ virtual bool Delete( const ESelection& rSelection ) = 0;
+
+ /** Insert/Replace given text in given range and reformat text
+
+ @param rText
+ Text to insert/replace
+
+ @param rSel
+ Selection where text should be replaced. The empty selection inserts
+
+ @return true if text has been successfully inserted
+ */
+ virtual bool InsertText( const OUString& rText, const ESelection& rSel ) = 0;
+
+ /** Updates the formatting
+
+ @see EditEngine::QuickFormatDoc() for details
+
+ @return true if text have been successfully reformatted
+ */
+ virtual bool QuickFormatDoc( bool bFull = false ) = 0;
+
+ /** Get the outline depth of given paragraph
+
+ @param nPara
+ Index of the paragraph to query the depth of
+
+ @return the outline level of the given paragraph. The range is
+ [0,n), where n is the maximal outline level.
+ */
+ virtual sal_Int16 GetDepth( sal_Int32 nPara ) const = 0;
+
+ /** Set the outline depth of given paragraph
+
+ @param nPara
+ Index of the paragraph to set the depth of
+
+ @param nNewDepth
+ The depth to set on the given paragraph. The range is
+ [0,n), where n is the maximal outline level.
+
+ @return true, if depth could be successfully set. Reasons for
+ failure are e.g. the text does not support outline level
+ (EditEngine), or the depth range is exceeded.
+ */
+ virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) = 0;
+
+ virtual sal_Int32 GetNumberingStartValue( sal_Int32 nPara );
+ virtual void SetNumberingStartValue( sal_Int32 nPara, sal_Int32 nNumberingStartValue );
+
+ virtual bool IsParaIsNumberingRestart( sal_Int32 nPara );
+ virtual void SetParaIsNumberingRestart( sal_Int32 nPara, bool bParaIsNumberingRestart );
+};
+
+/** Encapsulates the document view for the purpose of unified
+ EditEngine/Outliner access.
+
+ This one has to be different from the SvxEditViewForwarder, since
+ the latter is only valid in edit mode.
+ */
+class EDITENG_DLLPUBLIC SvxViewForwarder
+{
+public:
+ virtual ~SvxViewForwarder();
+
+ /** Query state of forwarder
+
+ @return sal_False, if no longer valid
+ */
+ virtual bool IsValid() const = 0;
+
+ /** Convert from logical, EditEngine-relative coordinates to screen coordinates
+
+ @param rPoint
+ Point in logical, EditEngine-relative coordinates.
+
+ @param rMapMode
+ The map mode to interpret the coordinates in.
+
+ @return the point in screen coordinates
+ */
+ virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const = 0;
+
+ /** Convert from screen to logical, EditEngine-relative coordinates
+
+ @param rPoint
+ Point in screen coordinates
+
+ @param rMapMode
+ The map mode to interpret the coordinates in.
+
+ @return the point in logical coordinates.
+ */
+ virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const = 0;
+
+};
+
+
+/** Encapsulates EditView and OutlinerView for the purpose of unified
+ EditEngine/Outliner access
+ */
+class SvxEditViewForwarder : public SvxViewForwarder
+{
+public:
+
+ /** Query current selection.
+
+ @param rSelection
+ Contains the current selection after method call
+
+ @return false, if there is no view or no selection (the empty selection _is_ a selection)
+
+ */
+ virtual bool GetSelection( ESelection& rSelection ) const = 0;
+
+ /** Set selection in view.
+
+ @param rSelection
+ The selection to set
+
+ @return false, if there is no view or selection is invalid
+ */
+ virtual bool SetSelection( const ESelection& rSelection ) = 0;
+
+ /** Copy current selection to clipboard.
+
+ @return false if no selection or no view (the empty selection _is_ a selection)
+ */
+ virtual bool Copy() = 0;
+
+ /** Cut current selection to clipboard.
+
+ @return false if no selection or no view (the empty selection _is_ a selection)
+ */
+ virtual bool Cut() = 0;
+
+ /** Paste clipboard into current selection.
+
+ @return false if no view or no selection (the empty selection _is_ a selection)
+ */
+ virtual bool Paste() = 0;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unofdesc.hxx b/include/editeng/unofdesc.hxx
new file mode 100644
index 000000000..fbc94b09c
--- /dev/null
+++ b/include/editeng/unofdesc.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOFDESC_HXX
+#define INCLUDED_EDITENG_UNOFDESC_HXX
+
+#include <svl/itemset.hxx>
+#include <editeng/editengdllapi.h>
+
+namespace com::sun::star::awt
+{
+struct FontDescriptor;
+}
+namespace vcl
+{
+class Font;
+}
+
+class EDITENG_DLLPUBLIC SvxUnoFontDescriptor
+{
+public:
+ static void ConvertToFont(const css::awt::FontDescriptor& rDesc, vcl::Font& rFont);
+ static void ConvertFromFont(const vcl::Font& rFont, css::awt::FontDescriptor& rDesc);
+
+ static void FillItemSet(const css::awt::FontDescriptor& rDesc, SfxItemSet& rSet);
+ static void FillFromItemSet(const SfxItemSet& rSet, css::awt::FontDescriptor& rDesc);
+
+ static void setPropertyToDefault(SfxItemSet& rSet);
+ static css::uno::Any getPropertyDefault(SfxItemPool* pPool);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unofield.hxx b/include/editeng/unofield.hxx
new file mode 100644
index 000000000..740a25a5b
--- /dev/null
+++ b/include/editeng/unofield.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOFIELD_HXX
+#define INCLUDED_EDITENG_UNOFIELD_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/component.hxx>
+#include <editeng/editengdllapi.h>
+
+#include <cppuhelper/basemutex.hxx>
+#include <memory>
+#include <string_view>
+
+namespace com::sun::star::beans { class XPropertySetInfo; }
+
+class SvxUnoFieldData_Impl;
+class SfxItemPropertySet;
+class SvxFieldData;
+
+/// @throws css::uno::Exception
+/// @throws css::uno::RuntimeException
+css::uno::Reference< css::uno::XInterface > EDITENG_DLLPUBLIC SvxUnoTextCreateTextField(
+ std::u16string_view ServiceSpecifier );
+
+class EDITENG_DLLPUBLIC SvxUnoTextField final : public cppu::BaseMutex,
+ public ::cppu::OComponentHelper,
+ public css::text::XTextField,
+ public css::beans::XPropertySet,
+ public css::lang::XServiceInfo,
+ public css::lang::XUnoTunnel
+{
+ css::uno::Reference< css::text::XTextRange > mxAnchor;
+ const SfxItemPropertySet* mpPropSet;
+ sal_Int32 mnServiceId;
+ std::unique_ptr<SvxUnoFieldData_Impl> mpImpl;
+ css::uno::Sequence< css::uno::Type > maTypeSequence;
+
+public:
+ SvxUnoTextField( sal_Int32 nServiceId ) noexcept;
+ SvxUnoTextField( css::uno::Reference< css::text::XTextRange > xAnchor, const OUString& rPresentation, const SvxFieldData* pFieldData ) noexcept;
+ virtual ~SvxUnoTextField() noexcept override;
+
+ // Internal
+ std::unique_ptr<SvxFieldData> CreateFieldData() const noexcept;
+
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept;
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+
+ // css::uno::XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+ // css::lang::XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ // XTextField
+ virtual OUString SAL_CALL getPresentation( sal_Bool bShowCommand ) override;
+
+ // XTextContent
+ virtual void SAL_CALL attach( const css::uno::Reference< css::text::XTextRange >& xTextRange ) override;
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor( ) override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL dispose() override;
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+
+ // XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unofored.hxx b/include/editeng/unofored.hxx
new file mode 100644
index 000000000..989b5c365
--- /dev/null
+++ b/include/editeng/unofored.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOFORED_HXX
+#define INCLUDED_EDITENG_UNOFORED_HXX
+
+#include <editeng/editeng.hxx>
+#include <editeng/unoedsrc.hxx>
+#include <editeng/editengdllapi.h>
+
+// SvxEditEngineForwarder - SvxTextForwarder for EditEngine
+
+class EDITENG_DLLPUBLIC SvxEditEngineForwarder final : public SvxTextForwarder
+{
+private:
+ EditEngine& rEditEngine;
+
+public:
+ SvxEditEngineForwarder( EditEngine& rEngine );
+ virtual ~SvxEditEngineForwarder() override;
+
+ virtual sal_Int32 GetParagraphCount() const override;
+ virtual sal_Int32 GetTextLen( sal_Int32 nParagraph ) const override;
+ virtual OUString GetText( const ESelection& rSel ) const override;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ) const override;
+ virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const override;
+ virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) override;
+ virtual void RemoveAttribs( const ESelection& rSelection ) override;
+ virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const override;
+
+ virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const override;
+ virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const override;
+
+ virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) override;
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) override;
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) override;
+ virtual void QuickInsertLineBreak( const ESelection& rSel ) override;
+
+ virtual SfxItemPool* GetPool() const override;
+
+ virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override;
+ virtual void FieldClicked( const SvxFieldItem& rField ) override;
+ virtual bool IsValid() const override;
+
+ virtual LanguageType GetLanguage( sal_Int32, sal_Int32 ) const override;
+ virtual sal_Int32 GetFieldCount( sal_Int32 nPara ) const override;
+ virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const override;
+ virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const override;
+ virtual tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const override;
+ virtual tools::Rectangle GetParaBounds( sal_Int32 nPara ) const override;
+ virtual MapMode GetMapMode() const override;
+ virtual OutputDevice* GetRefDevice() const override;
+ virtual bool GetIndexAtPoint( const Point&, sal_Int32& nPara, sal_Int32& nIndex ) const override;
+ virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const override;
+ virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const override;
+ virtual sal_Int32 GetLineCount( sal_Int32 nPara ) const override;
+ virtual sal_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const override;
+ virtual void GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const override;
+ virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const override;
+ virtual bool Delete( const ESelection& ) override;
+ virtual bool InsertText( const OUString&, const ESelection& ) override;
+ virtual bool QuickFormatDoc( bool bFull = false ) override;
+ virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override;
+ virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override;
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr() override;
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph() override;
+ virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) override;
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoforou.hxx b/include/editeng/unoforou.hxx
new file mode 100644
index 000000000..a4535d83b
--- /dev/null
+++ b/include/editeng/unoforou.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOFOROU_HXX
+#define INCLUDED_EDITENG_UNOFOROU_HXX
+
+#include <editeng/unoedsrc.hxx>
+#include <editeng/editengdllapi.h>
+#include <editeng/editdata.hxx>
+#include <svl/itemset.hxx>
+#include <optional>
+
+class Outliner;
+
+// SvxOutlinerForwarder - SvxTextForwarder for Outliner
+
+class EDITENG_DLLPUBLIC SvxOutlinerForwarder final : public SvxTextForwarder
+{
+private:
+ Outliner& rOutliner;
+ bool bOutlinerText;
+
+ /** this pointer may be null or point to an item set for the attribs of
+ the selection maAttribsSelection */
+ mutable std::optional<SfxItemSet> moAttribsCache;
+
+ /** if we have a cached attribute item set, this is the selection of it */
+ mutable ESelection maAttribCacheSelection;
+
+ /** this pointer may be null or point to an item set for the paragraph
+ mnParaAttribsCache */
+ mutable std::optional<SfxItemSet> moParaAttribsCache;
+
+ /** if we have a cached para attribute item set, this is the paragraph of it */
+ mutable sal_Int32 mnParaAttribsCache;
+
+public:
+ SvxOutlinerForwarder( Outliner& rOutl, bool bOutlText );
+ virtual ~SvxOutlinerForwarder() override;
+
+ virtual sal_Int32 GetParagraphCount() const override;
+ virtual sal_Int32 GetTextLen( sal_Int32 nParagraph ) const override;
+ virtual OUString GetText( const ESelection& rSel ) const override;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ) const override;
+ virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const override;
+ virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) override;
+ virtual void RemoveAttribs( const ESelection& rSelection ) override;
+ virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const override;
+
+ virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const override;
+ virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const override;
+
+ virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) override;
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) override;
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) override;
+ virtual void QuickInsertLineBreak( const ESelection& rSel ) override;
+
+ virtual SfxItemPool* GetPool() const override;
+
+ virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override;
+ virtual void FieldClicked( const SvxFieldItem& rField ) override;
+
+ virtual bool IsValid() const override;
+
+ virtual LanguageType GetLanguage( sal_Int32, sal_Int32 ) const override;
+ virtual sal_Int32 GetFieldCount( sal_Int32 nPara ) const override;
+ virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const override;
+ virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const override;
+ virtual tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const override;
+ virtual tools::Rectangle GetParaBounds( sal_Int32 nPara ) const override;
+ virtual MapMode GetMapMode() const override;
+ virtual OutputDevice* GetRefDevice() const override;
+ virtual bool GetIndexAtPoint( const Point&, sal_Int32& nPara, sal_Int32& nIndex ) const override;
+ virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const override;
+ virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const override;
+ virtual sal_Int32 GetLineCount( sal_Int32 nPara ) const override;
+ virtual sal_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const override;
+ virtual void GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nPara, sal_Int32 nLine ) const override;
+ virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const override;
+ virtual bool Delete( const ESelection& ) override;
+ virtual bool InsertText( const OUString&, const ESelection& ) override;
+ virtual bool QuickFormatDoc( bool bFull = false ) override;
+ virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override;
+ virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override;
+ virtual sal_Int32 GetNumberingStartValue( sal_Int32 nPara ) override;
+ virtual void SetNumberingStartValue( sal_Int32 nPara, sal_Int32 nNumberingStartValue ) override;
+
+ virtual bool IsParaIsNumberingRestart( sal_Int32 nPara ) override;
+ virtual void SetParaIsNumberingRestart( sal_Int32 nPara, bool bParaIsNumberingRestart ) override;
+
+ /* this method flushes internal caches for this forwarder */
+ void flushCache();
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr() override;
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph() override;
+ virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) override;
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoipset.hxx b/include/editeng/unoipset.hxx
new file mode 100644
index 000000000..5a0ac105c
--- /dev/null
+++ b/include/editeng/unoipset.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOIPSET_HXX
+#define INCLUDED_EDITENG_UNOIPSET_HXX
+
+#include <editeng/editengdllapi.h>
+#include <svl/itemprop.hxx>
+#include <vector>
+
+namespace com::sun::star::beans { class XPropertySetInfo; }
+
+class SfxItemSet;
+class SvxItemPropertySetUsrAnys;
+
+class EDITENG_DLLPUBLIC SvxItemPropertySet
+{
+ SfxItemPropertyMap m_aPropertyMap;
+ mutable css::uno::Reference<css::beans::XPropertySetInfo> m_xInfo;
+ SfxItemPool& mrItemPool;
+
+public:
+ SvxItemPropertySet( const SfxItemPropertyMapEntry *pMap, SfxItemPool& rPool );
+ ~SvxItemPropertySet();
+
+ SvxItemPropertySet& operator=( SvxItemPropertySet const & ) = delete; // MSVC2015 workaround
+ SvxItemPropertySet( SvxItemPropertySet const & ) = delete; // MSVC2015 workaround
+
+ // Methods, which work directly with the ItemSet
+ static css::uno::Any getPropertyValue( const SfxItemPropertyMapEntry* pMap, const SfxItemSet& rSet, bool bSearchInParent, bool bDontConvertNegativeValues );
+ static void setPropertyValue( const SfxItemPropertyMapEntry* pMap, const css::uno::Any& rVal, SfxItemSet& rSet, bool bDontConvertNegativeValues );
+
+ // Methods that use Any instead
+ css::uno::Any getPropertyValue( const SfxItemPropertyMapEntry* pMap, SvxItemPropertySetUsrAnys& rAnys ) const;
+ static void setPropertyValue( const SfxItemPropertyMapEntry* pMap, const css::uno::Any& rVal, SvxItemPropertySetUsrAnys& rAnys );
+
+ css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const;
+ const SfxItemPropertyMap& getPropertyMap() const { return m_aPropertyMap;}
+ const SfxItemPropertyMapEntry* getPropertyMapEntry(std::u16string_view rName) const;
+};
+
+struct SvxIDPropertyCombine
+{
+ sal_uInt16 nWID;
+ sal_uInt8 memberId;
+ css::uno::Any aAny;
+};
+
+
+class EDITENG_DLLPUBLIC SvxItemPropertySetUsrAnys
+{
+ ::std::vector< SvxIDPropertyCombine > aCombineList;
+
+public:
+ SvxItemPropertySetUsrAnys();
+ ~SvxItemPropertySetUsrAnys();
+ bool AreThereOwnUsrAnys() const { return ! aCombineList.empty(); }
+ css::uno::Any* GetUsrAnyForID(SfxItemPropertyMapEntry const & entry) const;
+ void AddUsrAnyForID(const css::uno::Any& rAny, SfxItemPropertyMapEntry const & entry);
+ void ClearAllUsrAny();
+};
+
+/** converts the given any with a metric to 100th/mm if needed */
+EDITENG_DLLPUBLIC void SvxUnoConvertToMM( const MapUnit eSourceMapUnit, css::uno::Any & rMetric ) noexcept;
+
+/** converts the given any with a metric from 100th/mm to the given metric if needed */
+EDITENG_DLLPUBLIC void SvxUnoConvertFromMM( const MapUnit eDestinationMapUnit, css::uno::Any & rMetric ) noexcept;
+
+#endif // INCLUDED_EDITENG_UNOIPSET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unolingu.hxx b/include/editeng/unolingu.hxx
new file mode 100644
index 000000000..2aec6db1a
--- /dev/null
+++ b/include/editeng/unolingu.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOLINGU_HXX
+#define INCLUDED_EDITENG_UNOLINGU_HXX
+
+#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <editeng/editengdllapi.h>
+
+namespace com::sun::star::linguistic2 { class XDictionary; }
+namespace com::sun::star::linguistic2 { class XHyphenator; }
+namespace com::sun::star::linguistic2 { class XLinguProperties; }
+namespace com::sun::star::linguistic2 { class XLinguServiceManager2; }
+namespace com::sun::star::linguistic2 { class XSearchableDictionaryList; }
+namespace com::sun::star::linguistic2 { class XSpellChecker1; }
+namespace com::sun::star::linguistic2 { class XThesaurus; }
+
+class LinguMgrExitLstnr;
+
+namespace weld { class Window; }
+namespace linguistic { enum class DictionaryError; }
+
+
+class EDITENG_DLLPUBLIC LinguMgr
+{
+ friend class LinguMgrExitLstnr;
+
+ static css::uno::Reference< css::linguistic2::XLinguServiceManager2 > xLngSvcMgr;
+ static css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpell;
+ static css::uno::Reference< css::linguistic2::XHyphenator > xHyph;
+ static css::uno::Reference< css::linguistic2::XThesaurus > xThes;
+ static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > xDicList;
+ static css::uno::Reference< css::linguistic2::XLinguProperties > xProp;
+
+ static css::uno::Reference< css::linguistic2::XDictionary > xIgnoreAll;
+ static css::uno::Reference< css::linguistic2::XDictionary > xChangeAll;
+
+ static rtl::Reference<LinguMgrExitLstnr> pExitLstnr;
+ static bool bExiting;
+
+ static css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpell();
+ static css::uno::Reference< css::linguistic2::XHyphenator > GetHyph();
+ static css::uno::Reference< css::linguistic2::XThesaurus > GetThes();
+ static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > GetDicList();
+ static css::uno::Reference< css::linguistic2::XLinguProperties > GetProp();
+ static css::uno::Reference< css::linguistic2::XDictionary > GetStandard();
+ static css::uno::Reference< css::linguistic2::XDictionary > GetIgnoreAll();
+ static css::uno::Reference< css::linguistic2::XDictionary > GetChangeAll();
+
+ LinguMgr(const LinguMgr &) = delete;
+ LinguMgr & operator = (const LinguMgr &) = delete;
+
+public:
+
+ static css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker();
+ static css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator();
+ static css::uno::Reference< css::linguistic2::XThesaurus > GetThesaurus();
+ static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > GetDictionaryList();
+ static css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguPropertySet();
+
+ static css::uno::Reference< css::linguistic2::XLinguServiceManager2 > GetLngSvcMgr();
+
+ static css::uno::Reference< css::linguistic2::XDictionary > GetStandardDic();
+ static css::uno::Reference< css::linguistic2::XDictionary > GetIgnoreAllList();
+ static css::uno::Reference< css::linguistic2::XDictionary > GetChangeAllList();
+};
+
+
+namespace com::sun::star::linguistic2 {
+ class XHyphenatedWord;
+}
+
+
+struct SvxAlternativeSpelling
+{
+ OUString aReplacement;
+ sal_Int16 nChangedPos,
+ nChangedLength;
+ bool bIsAltSpelling;
+
+ inline SvxAlternativeSpelling();
+};
+
+inline SvxAlternativeSpelling::SvxAlternativeSpelling() :
+ nChangedPos(-1), nChangedLength(-1), bIsAltSpelling(false)
+{
+}
+
+
+EDITENG_DLLPUBLIC SvxAlternativeSpelling SvxGetAltSpelling(
+ const css::uno::Reference< css::linguistic2::XHyphenatedWord > & rHyphWord );
+
+
+class EDITENG_DLLPUBLIC SvxDicListChgClamp
+{
+private:
+ css::uno::Reference<
+ css::linguistic2::XSearchableDictionaryList > xDicList;
+
+ SvxDicListChgClamp(const SvxDicListChgClamp &) = delete;
+ SvxDicListChgClamp & operator = (const SvxDicListChgClamp &) = delete;
+
+public:
+ SvxDicListChgClamp( css::uno::Reference<
+ css::linguistic2::XSearchableDictionaryList > xDicList );
+ ~SvxDicListChgClamp();
+};
+
+EDITENG_DLLPUBLIC short SvxDicError(weld::Window *pParent, linguistic::DictionaryError nError);
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unonames.hxx b/include/editeng/unonames.hxx
new file mode 100644
index 000000000..2e5b44e1a
--- /dev/null
+++ b/include/editeng/unonames.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_EDITENG_UNONAMES_HXX
+#define INCLUDED_EDITENG_UNONAMES_HXX
+
+#include <rtl/ustring.hxx>
+
+// Common across fields
+inline constexpr OUStringLiteral UNO_TC_PROP_ANCHOR = u"Anchor";
+inline constexpr OUStringLiteral UNO_TC_PROP_TEXTFIELD_TYPE = u"TextFieldType";
+inline constexpr OUStringLiteral UNO_TC_PROP_IS_FIXED = u"IsFixed";
+inline constexpr OUStringLiteral UNO_TC_PROP_CURRENT_PRESENTATION = u"CurrentPresentation";
+inline constexpr OUStringLiteral UNO_TC_PROP_NAME = u"Name";
+inline constexpr OUStringLiteral UNO_TC_PROP_IS_FIXED_LANGUAGE = u"IsFixedLanguage";
+inline constexpr OUStringLiteral UNO_TC_PROP_NUMFORMAT = u"NumberFormat";
+
+// Date & Time
+inline constexpr OUStringLiteral UNO_TC_PROP_IS_DATE = u"IsDate";
+inline constexpr OUStringLiteral UNO_TC_PROP_DATE_TIME = u"DateTime";
+
+// URL
+inline constexpr OUStringLiteral UNO_TC_PROP_URL_FORMAT = u"Format";
+inline constexpr OUStringLiteral UNO_TC_PROP_URL_REPRESENTATION = u"Representation";
+inline constexpr OUStringLiteral UNO_TC_PROP_URL_TARGET = u"TargetFrame";
+inline constexpr OUStringLiteral UNO_TC_PROP_URL = u"URL";
+
+// Table
+inline constexpr OUStringLiteral UNO_TC_PROP_TABLE_POSITION = u"TablePosition";
+
+// File
+inline constexpr OUStringLiteral UNO_TC_PROP_FILE_FORMAT = u"FileFormat";
+
+// Author
+inline constexpr OUStringLiteral UNO_TC_PROP_AUTHOR_CONTENT = u"Content";
+inline constexpr OUStringLiteral UNO_TC_PROP_AUTHOR_FORMAT = u"AuthorFormat";
+inline constexpr OUStringLiteral UNO_TC_PROP_AUTHOR_FULLNAME = u"FullName";
+
+// Measure
+inline constexpr OUStringLiteral UNO_TC_PROP_MEASURE_KIND = u"Kind";
+
+inline constexpr OUStringLiteral UNO_TR_PROP_SELECTION = u"Selection";
+
+#endif // INCLUDED_EDITENG_UNONAMES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unonrule.hxx b/include/editeng/unonrule.hxx
new file mode 100644
index 000000000..d0e89ffdc
--- /dev/null
+++ b/include/editeng/unonrule.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNONRULE_HXX
+#define INCLUDED_EDITENG_UNONRULE_HXX
+
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/ucb/XAnyCompare.hpp>
+#include <editeng/editengdllapi.h>
+#include <cppuhelper/implbase5.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <editeng/numitem.hxx>
+#include <comphelper/servicehelper.hxx>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+
+EDITENG_DLLPUBLIC css::uno::Reference< css::container::XIndexReplace > SvxCreateNumRule(const SvxNumRule& rRule);
+css::uno::Reference< css::container::XIndexReplace > SvxCreateNumRule();
+/// @throws css::lang::IllegalArgumentException
+const SvxNumRule& SvxGetNumRule( css::uno::Reference< css::container::XIndexReplace > const & xRule );
+EDITENG_DLLPUBLIC css::uno::Reference< css::ucb::XAnyCompare > SvxCreateNumRuleCompare() noexcept;
+
+class SvxUnoNumberingRules final : public ::cppu::WeakAggImplHelper5< css::container::XIndexReplace, css::ucb::XAnyCompare,
+ css::lang::XUnoTunnel, css::util::XCloneable, css::lang::XServiceInfo >
+{
+private:
+ SvxNumRule maRule;
+public:
+ SvxUnoNumberingRules(SvxNumRule aRule);
+ virtual ~SvxUnoNumberingRules() noexcept override;
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxUnoNumberingRules )
+
+ //XIndexReplace
+ virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) override;
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() override ;
+ virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
+
+ //XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType() override;
+ virtual sal_Bool SAL_CALL hasElements() override;
+
+ // XAnyCompare
+ virtual sal_Int16 SAL_CALL compare( const css::uno::Any& Any1, const css::uno::Any& Any2 ) override;
+
+ // XCloneable
+ virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+
+ // internal
+ /// @throws css::uno::RuntimeException
+ css::uno::Sequence<css::beans::PropertyValue> getNumberingRuleByIndex( sal_Int32 nIndex) const;
+ /// @throws css::uno::RuntimeException
+ /// @throws css::lang::IllegalArgumentException
+ void setNumberingRuleByIndex(const css::uno::Sequence<css::beans::PropertyValue>& rProperties, sal_Int32 nIndex);
+
+ static sal_Int16 Compare( const css::uno::Any& rAny1, const css::uno::Any& rAny2 );
+
+ const SvxNumRule& getNumRule() const { return maRule; }
+};
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
new file mode 100644
index 000000000..8569a3370
--- /dev/null
+++ b/include/editeng/unoprnms.hxx
@@ -0,0 +1,361 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <rtl/ustring.hxx>
+
+inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR = u"CharColor";
+inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR_THEME = u"CharColorTheme";
+inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR_TINT_OR_SHADE = u"CharColorTintOrShade";
+inline constexpr OUStringLiteral UNO_NAME_CHAR_HEIGHT = u"CharHeight";
+inline constexpr OUStringLiteral UNO_NAME_CHAR_POSTURE = u"CharPosture";
+inline constexpr OUStringLiteral UNO_NAME_CHAR_SHADOWED = u"CharShadowed";
+inline constexpr OUStringLiteral UNO_NAME_CHAR_UNDERLINE = u"CharUnderline";
+inline constexpr OUStringLiteral UNO_NAME_CHAR_WEIGHT = u"CharWeight";
+
+inline constexpr OUStringLiteral UNO_NAME_FILLSTYLE = u"FillStyle";
+inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR = u"FillColor";
+inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_THEME = u"FillColorTheme";
+inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_LUM_MOD = u"FillColorLumMod";
+inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_LUM_OFF = u"FillColorLumOff";
+inline constexpr OUStringLiteral UNO_NAME_FILLGRADIENT = u"FillGradient";
+inline constexpr OUStringLiteral UNO_NAME_FILLGRADIENTNAME = u"FillGradientName";
+inline constexpr OUStringLiteral UNO_NAME_FILLHATCH = u"FillHatch";
+inline constexpr OUStringLiteral UNO_NAME_FILLHATCHNAME = u"FillHatchName";
+inline constexpr OUStringLiteral UNO_NAME_FILLBITMAP = u"FillBitmap";
+inline constexpr OUStringLiteral UNO_NAME_FILLBITMAPURL = u"FillBitmapURL";
+inline constexpr OUStringLiteral UNO_NAME_FILLBITMAPNAME = u"FillBitmapName";
+inline constexpr OUStringLiteral UNO_NAME_FILLGRADIENTSTEPCOUNT = u"FillGradientStepCount";
+inline constexpr OUStringLiteral UNO_NAME_FILLBACKGROUND = u"FillBackground";
+inline constexpr OUStringLiteral UNO_NAME_FILLUSESLIDEBACKGROUND = u"FillUseSlideBackground";
+inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_2 = u"FillColor2";
+
+inline constexpr OUStringLiteral UNO_NAME_EDGEKIND = u"EdgeKind";
+inline constexpr OUStringLiteral UNO_NAME_EDGELINE1DELTA = u"EdgeLine1Delta";
+inline constexpr OUStringLiteral UNO_NAME_EDGELINE2DELTA = u"EdgeLine2Delta";
+inline constexpr OUStringLiteral UNO_NAME_EDGELINE3DELTA = u"EdgeLine3Delta";
+inline constexpr OUStringLiteral UNO_NAME_EDGENODE1HORZDIST = u"EdgeNode1HorzDist";
+inline constexpr OUStringLiteral UNO_NAME_EDGENODE1VERTDIST = u"EdgeNode1VertDist";
+inline constexpr OUStringLiteral UNO_NAME_EDGENODE2HORZDIST = u"EdgeNode2HorzDist";
+inline constexpr OUStringLiteral UNO_NAME_EDGENODE2VERTDIST = u"EdgeNode2VertDist";
+
+inline constexpr OUStringLiteral UNO_NAME_FILLBMP_OFFSET_X = u"FillBitmapOffsetX";
+inline constexpr OUStringLiteral UNO_NAME_FILLBMP_OFFSET_Y = u"FillBitmapOffsetY";
+inline constexpr OUStringLiteral UNO_NAME_FILLBMP_POSITION_OFFSET_X = u"FillBitmapPositionOffsetX";
+inline constexpr OUStringLiteral UNO_NAME_FILLBMP_POSITION_OFFSET_Y = u"FillBitmapPositionOffsetY";
+inline constexpr OUStringLiteral UNO_NAME_FILLBMP_RECTANGLE_POINT = u"FillBitmapRectanglePoint";
+inline constexpr OUStringLiteral UNO_NAME_FILLBMP_TILE = u"FillBitmapTile";
+inline constexpr OUStringLiteral UNO_NAME_FILLBMP_STRETCH = u"FillBitmapStretch";
+inline constexpr OUStringLiteral UNO_NAME_FILLBMP_LOGICAL_SIZE = u"FillBitmapLogicalSize";
+inline constexpr OUStringLiteral UNO_NAME_FILLBMP_SIZE_X = u"FillBitmapSizeX";
+inline constexpr OUStringLiteral UNO_NAME_FILLBMP_SIZE_Y = u"FillBitmapSizeY";
+inline constexpr OUStringLiteral UNO_NAME_FILL_TRANSPARENCE = u"FillTransparence";
+inline constexpr OUStringLiteral UNO_NAME_FILLTRANSPARENCEGRADIENT = u"FillTransparenceGradient";
+inline constexpr OUStringLiteral UNO_NAME_FILLTRANSPARENCEGRADIENTNAME = u"FillTransparenceGradientName";
+inline constexpr OUStringLiteral UNO_NAME_FILLBMP_MODE = u"FillBitmapMode";
+
+
+inline constexpr OUStringLiteral UNO_NAME_LINESTYLE = u"LineStyle";
+inline constexpr OUStringLiteral UNO_NAME_LINEDASH = u"LineDash";
+inline constexpr OUStringLiteral UNO_NAME_LINEWIDTH = u"LineWidth";
+inline constexpr OUStringLiteral UNO_NAME_LINECOLOR = u"LineColor";
+inline constexpr OUStringLiteral UNO_NAME_LINEJOINT = u"LineJoint";
+inline constexpr OUStringLiteral UNO_NAME_LINESTART = u"LineStart";
+inline constexpr OUStringLiteral UNO_NAME_LINEEND = u"LineEnd";
+inline constexpr OUStringLiteral UNO_NAME_LINESTARTWIDTH = u"LineStartWidth";
+inline constexpr OUStringLiteral UNO_NAME_LINEENDWIDTH = u"LineEndWidth";
+inline constexpr OUStringLiteral UNO_NAME_LINESTARTCENTER = u"LineStartCenter";
+inline constexpr OUStringLiteral UNO_NAME_LINEENDCENTER = u"LineEndCenter";
+inline constexpr OUStringLiteral UNO_NAME_LINETRANSPARENCE = u"LineTransparence";
+inline constexpr OUStringLiteral UNO_NAME_LINECAP = u"LineCap";
+
+inline constexpr OUStringLiteral UNO_NAME_SHADOW = u"Shadow";
+inline constexpr OUStringLiteral UNO_NAME_SHADOWCOLOR = u"ShadowColor";
+inline constexpr OUStringLiteral UNO_NAME_SHADOWXDIST = u"ShadowXDistance";
+inline constexpr OUStringLiteral UNO_NAME_SHADOWYDIST = u"ShadowYDistance";
+inline constexpr OUStringLiteral UNO_NAME_SHADOWSIZEX = u"ShadowSizeX";
+inline constexpr OUStringLiteral UNO_NAME_SHADOWSIZEY = u"ShadowSizeY";
+inline constexpr OUStringLiteral UNO_NAME_SHADOWTRANSPARENCE = u"ShadowTransparence";
+inline constexpr OUStringLiteral UNO_NAME_SHADOWBLUR = u"ShadowBlur";
+
+inline constexpr OUStringLiteral UNO_NAME_EDGERADIUS = u"CornerRadius";
+
+inline constexpr OUStringLiteral UNO_NAME_TEXT_MINFRAMEHEIGHT = u"TextMinimumFrameHeight";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_AUTOGROWHEIGHT = u"TextAutoGrowHeight";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_FITTOSIZE = u"TextFitToSize";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_LEFTDIST = u"TextLeftDistance";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_RIGHTDIST = u"TextRightDistance";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_UPPERDIST = u"TextUpperDistance";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_LOWERDIST = u"TextLowerDistance";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_VERTADJUST = u"TextVerticalAdjust";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_MAXFRAMEHEIGHT = u"TextMaximumFrameHeight";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_MINFRAMEWIDTH = u"TextMinimumFrameWidth";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_MAXFRAMEWIDTH = u"TextMaximumFrameWidth";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_AUTOGROWWIDTH = u"TextAutoGrowWidth";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_HORZADJUST = u"TextHorizontalAdjust";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_ANIKIND = u"TextAnimationKind";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_ANIDIRECTION = u"TextAnimationDirection";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_ANISTARTINSIDE = u"TextAnimationStartInside";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_ANISTOPINSIDE = u"TextAnimationStopInside";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_ANICOUNT = u"TextAnimationCount";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_ANIDELAY = u"TextAnimationDelay";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_ANIAMOUNT = u"TextAnimationAmount";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_CONTOURFRAME = u"TextContourFrame";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_WRITINGMODE = u"TextWritingMode";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_FONTINDEPENDENTLINESPACING = u"FontIndependentLineSpacing";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_WORDWRAP = u"TextWordWrap";
+inline constexpr OUStringLiteral UNO_NAME_TEXT_CHAINNEXTNAME = u"TextChainNextName";
+
+inline constexpr OUStringLiteral UNO_NAME_MEASUREKIND = u"MeasureKind";
+inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTHPOS = u"MeasureTextHorizontalPosition";
+inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTVPOS = u"MeasureTextVerticalPosition";
+inline constexpr OUStringLiteral UNO_NAME_MEASURELINEDIST = u"MeasureLineDistance";
+inline constexpr OUStringLiteral UNO_NAME_MEASUREHELPLINEOVERHANG = u"MeasureHelpLineOverhang";
+inline constexpr OUStringLiteral UNO_NAME_MEASUREHELPLINEDIST = u"MeasureHelpLineDistance";
+inline constexpr OUStringLiteral UNO_NAME_MEASUREHELPLINE1LEN = u"MeasureHelpLine1Length";
+inline constexpr OUStringLiteral UNO_NAME_MEASUREHELPLINE2LEN = u"MeasureHelpLine2Length";
+inline constexpr OUStringLiteral UNO_NAME_MEASUREBELOWREFEDGE = u"MeasureBelowReferenceEdge";
+inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTROTA90 = u"MeasureTextRotate90";
+inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTUPSIDEDOWN = u"MeasureTextUpsideDown";
+inline constexpr OUStringLiteral UNO_NAME_MEASUREOVERHANG = u"MeasureOverhang";
+inline constexpr OUStringLiteral UNO_NAME_MEASUREUNIT = u"MeasureUnit";
+inline constexpr OUStringLiteral UNO_NAME_MEASURESHOWUNIT = u"MeasureShowUnit";
+inline constexpr OUStringLiteral UNO_NAME_MEASUREFORMATSTRING = u"MeasureFormatString";
+inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTAUTOANGLE = u"MeasureTextAutoAngle";
+inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTAUTOANGLEVIEW = u"MeasureTextAutoAngleView";
+inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTISFIXEDANGLE = u"MeasureTextIsFixedAngle";
+inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTFIXEDANGLE = u"MeasureTextFixedAngle";
+
+inline constexpr OUStringLiteral UNO_NAME_CIRCKIND = u"CircleKind";
+inline constexpr OUStringLiteral UNO_NAME_CIRCSTARTANGLE = u"CircleStartAngle";
+inline constexpr OUStringLiteral UNO_NAME_CIRCENDANGLE = u"CircleEndAngle";
+
+inline constexpr OUStringLiteral UNO_NAME_POLYGONKIND = u"PolygonKind";
+inline constexpr OUStringLiteral UNO_NAME_POLYPOLYGON = u"PolyPolygon";
+inline constexpr OUStringLiteral UNO_NAME_POLYPOLYGONBEZIER = u"PolyPolygonBezier";
+inline constexpr OUStringLiteral UNO_NAME_POLYGON = u"Polygon";
+
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_INTEROPGRABBAG = u"InteropGrabBag";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_ZORDER = u"ZOrder";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_MOVEPROTECT = u"MoveProtect";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_SIZEPROTECT = u"SizeProtect";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_PRINTABLE = u"Printable";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_LAYERID = u"LayerID";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_LAYERNAME = u"LayerName";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_NAME = u"Name";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_ROTATEANGLE = u"RotateAngle";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_SHEARANGLE = u"ShearAngle";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_FRAMERECT = u"FrameRect";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_BOUNDRECT = u"BoundRect";
+
+// #i68101#
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_TITLE = u"Title";
+inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_DESCRIPTION = u"Description";
+
+inline constexpr OUStringLiteral UNO_NAME_HYPERLINK = u"Hyperlink";
+
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_FILLBITMAP = u"GraphicObjectFillBitmap";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_REPLACEMENT_GRAPHIC = u"ReplacementGraphic";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_GRAFSTREAMURL = u"GraphicStreamURL";
+#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:"
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_GRAPHIC = u"Graphic";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_GRAPHIC_URL = u"GraphicURL";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_IS_SIGNATURELINE = u"IsSignatureLine";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_ID = u"SignatureLineId";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_NAME = u"SignatureLineSuggestedSignerName";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_TITLE = u"SignatureLineSuggestedSignerTitle";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL = u"SignatureLineSuggestedSignerEmail";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_SIGNING_INSTRUCTIONS = u"SignatureLineSigningInstructions";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_SHOW_SIGN_DATE = u"SignatureLineShowSignDate";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_CAN_ADD_COMMENT = u"SignatureLineCanAddComment";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE = u"SignatureLineUnsignedImage";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_IS_SIGNED = u"SignatureLineIsSigned";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_QRCODE = u"BarCodeProperties";
+
+inline constexpr OUStringLiteral UNO_NAME_OLE2_METAFILE = u"MetaFile";
+inline constexpr OUStringLiteral UNO_NAME_OLE2_PERSISTNAME = u"PersistName";
+
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_PERSPECTIVE = u"D3DScenePerspective";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_DISTANCE = u"D3DSceneDistance";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_FOCAL_LENGTH = u"D3DSceneFocalLength";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING = u"D3DSceneTwoSidedLighting";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_1 = u"D3DSceneLightColor1";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_2 = u"D3DSceneLightColor2";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_3 = u"D3DSceneLightColor3";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_4 = u"D3DSceneLightColor4";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_5 = u"D3DSceneLightColor5";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_6 = u"D3DSceneLightColor6";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_7 = u"D3DSceneLightColor7";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_8 = u"D3DSceneLightColor8";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_1 = u"D3DSceneLightOn1";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_2 = u"D3DSceneLightOn2";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_3 = u"D3DSceneLightOn3";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_4 = u"D3DSceneLightOn4";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_5 = u"D3DSceneLightOn5";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_6 = u"D3DSceneLightOn6";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_7 = u"D3DSceneLightOn7";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_8 = u"D3DSceneLightOn8";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_1 = u"D3DSceneLightDirection1";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 = u"D3DSceneLightDirection2";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_3 = u"D3DSceneLightDirection3";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_4 = u"D3DSceneLightDirection4";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_5 = u"D3DSceneLightDirection5";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_6 = u"D3DSceneLightDirection6";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_7 = u"D3DSceneLightDirection7";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_8 = u"D3DSceneLightDirection8";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_AMBIENTCOLOR = u"D3DSceneAmbientColor";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_SHADOW_SLANT = u"D3DSceneShadowSlant";
+inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_SHADE_MODE = u"D3DSceneShadeMode";
+
+inline constexpr OUStringLiteral UNO_NAME_3D_DOUBLE_SIDED = u"D3DDoubleSided";
+inline constexpr OUStringLiteral UNO_NAME_3D_NORMALS_KIND = u"D3DNormalsKind";
+inline constexpr OUStringLiteral UNO_NAME_3D_NORMALS_INVERT = u"D3DNormalsInvert";
+inline constexpr OUStringLiteral UNO_NAME_3D_TEXTURE_PROJ_X = u"D3DTextureProjectionX";
+inline constexpr OUStringLiteral UNO_NAME_3D_TEXTURE_PROJ_Y = u"D3DTextureProjectionY";
+inline constexpr OUStringLiteral UNO_NAME_3D_SHADOW_3D = u"D3DShadow3D";
+inline constexpr OUStringLiteral UNO_NAME_3D_MAT_COLOR = u"D3DMaterialColor";
+inline constexpr OUStringLiteral UNO_NAME_3D_MAT_EMISSION = u"D3DMaterialEmission";
+inline constexpr OUStringLiteral UNO_NAME_3D_MAT_SPECULAR = u"D3DMaterialSpecular";
+inline constexpr OUStringLiteral UNO_NAME_3D_MAT_SPECULAR_INTENSITY = u"D3DMaterialSpecularIntensity";
+inline constexpr OUStringLiteral UNO_NAME_3D_TEXTURE_KIND = u"D3DTextureKind";
+inline constexpr OUStringLiteral UNO_NAME_3D_TEXTURE_MODE = u"D3DTextureMode";
+inline constexpr OUStringLiteral UNO_NAME_3D_TEXTURE_FILTER = u"D3DTextureFilter";
+
+// #i28528#
+// Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+inline constexpr OUStringLiteral UNO_NAME_3D_REDUCED_LINE_GEOMETRY = u"D3DReducedLineGeometry";
+
+inline constexpr OUStringLiteral UNO_NAME_3D_HORZ_SEGS = u"D3DHorizontalSegments";
+inline constexpr OUStringLiteral UNO_NAME_3D_VERT_SEGS = u"D3DVerticalSegments";
+
+inline constexpr OUStringLiteral UNO_NAME_3D_PERCENT_DIAGONAL = u"D3DPercentDiagonal";
+inline constexpr OUStringLiteral UNO_NAME_3D_BACKSCALE = u"D3DBackscale";
+inline constexpr OUStringLiteral UNO_NAME_3D_LATHE_END_ANGLE = u"D3DEndAngle";
+
+inline constexpr OUStringLiteral UNO_NAME_3D_EXTRUDE_DEPTH = u"D3DDepth";
+
+inline constexpr OUStringLiteral UNO_NAME_3D_TRANSFORM_MATRIX = u"D3DTransformMatrix";
+inline constexpr OUStringLiteral UNO_NAME_3D_CAMERA_GEOMETRY = u"D3DCameraGeometry";
+inline constexpr OUStringLiteral UNO_NAME_3D_POS = u"D3DPosition";
+inline constexpr OUStringLiteral UNO_NAME_3D_SIZE = u"D3DSize";
+inline constexpr OUStringLiteral UNO_NAME_3D_POS_IS_CENTER = u"D3DPositionIsCenter";
+inline constexpr OUStringLiteral UNO_NAME_3D_POLYPOLYGON3D = u"D3DPolyPolygon3D";
+inline constexpr OUStringLiteral UNO_NAME_3D_NORMALSPOLYGON3D = u"D3DNormalsPolygon3D";
+inline constexpr OUStringLiteral UNO_NAME_3D_TEXTUREPOLYGON3D = u"D3DTexturePolygon3D";
+inline constexpr OUStringLiteral UNO_NAME_3D_LINEONLY = u"D3DLineOnly";
+
+// New 3D properties which are possible for lathe and extrude 3d objects
+inline constexpr OUStringLiteral UNO_NAME_3D_SMOOTH_NORMALS = u"D3DSmoothNormals";
+inline constexpr OUStringLiteral UNO_NAME_3D_SMOOTH_LIDS = u"D3DSmoothLids";
+inline constexpr OUStringLiteral UNO_NAME_3D_CHARACTER_MODE = u"D3DCharacterMode";
+inline constexpr OUStringLiteral UNO_NAME_3D_CLOSE_FRONT = u"D3DCloseFront";
+inline constexpr OUStringLiteral UNO_NAME_3D_CLOSE_BACK = u"D3DCloseBack";
+
+inline constexpr OUStringLiteral UNO_NAME_NUMBERING = u"NumberingIsNumber";
+inline constexpr OUStringLiteral UNO_NAME_NUMBERING_RULES = u"NumberingRules";
+inline constexpr OUStringLiteral UNO_NAME_NUMBERING_LEVEL = u"NumberingLevel";
+
+inline constexpr OUStringLiteral UNO_NAME_NRULE_NUMBERINGTYPE = u"NumberingType";
+inline constexpr OUStringLiteral UNO_NAME_NRULE_PREFIX = u"Prefix";
+inline constexpr OUStringLiteral UNO_NAME_NRULE_SUFFIX = u"Suffix";
+#define UNO_NAME_NRULE_BULLETID "BulletId"
+inline constexpr OUStringLiteral UNO_NAME_NRULE_BULLET_COLOR = u"BulletColor";
+inline constexpr OUStringLiteral UNO_NAME_NRULE_BULLET_RELSIZE = u"BulletRelSize";
+inline constexpr OUStringLiteral UNO_NAME_NRULE_BULLET_FONT = u"BulletFont";
+inline constexpr OUStringLiteral UNO_NAME_NRULE_START_WITH = u"StartWith";
+inline constexpr OUStringLiteral UNO_NAME_NRULE_LEFT_MARGIN = u"LeftMargin";
+inline constexpr OUStringLiteral UNO_NAME_NRULE_FIRST_LINE_OFFSET = u"FirstLineOffset";
+inline constexpr OUStringLiteral UNO_NAME_NRULE_ADJUST = u"Adjust";
+
+inline constexpr OUStringLiteral UNO_NAME_EDIT_FONT_DESCRIPTOR = u"FontDescriptor";
+
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_ADJUST = u"ParaAdjust";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_BMARGIN = u"ParaBottomMargin";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_LASTLINEADJ = u"ParaLastLineAdjust";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_LMARGIN = u"ParaLeftMargin";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_LINESPACING = u"ParaLineSpacing";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_RMARGIN = u"ParaRightMargin";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_TAPSTOPS = u"ParaTabStops";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_TMARGIN = u"ParaTopMargin";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_IS_HYPHEN = u"ParaIsHyphenation";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION = u"ParaIsHangingPunctuation";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE = u"ParaIsCharacterDistance";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES = u"ParaIsForbiddenRules";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT = u"ParaFirstLineIndent";
+
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_HEIGHT = u"CharHeight";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTNAME = u"CharFontName";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTSTYLENAME = u"CharFontStyleName";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTFAMILY = u"CharFontFamily";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTCHARSET = u"CharFontCharSet";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTPITCH = u"CharFontPitch";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_POSTURE = u"CharPosture";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_WEIGHT = u"CharWeight";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_LOCALE = u"CharLocale";
+
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN = u"CharHeightAsian";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN = u"CharFontNameAsian";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN = u"CharFontStyleNameAsian";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN = u"CharFontFamilyAsian";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN = u"CharFontCharSetAsian";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN = u"CharFontPitchAsian";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_POSTURE_ASIAN = u"CharPostureAsian";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN = u"CharWeightAsian";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_LOCALE_ASIAN = u"CharLocaleAsian";
+
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX = u"CharHeightComplex";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX = u"CharFontNameComplex";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX = u"CharFontStyleNameComplex";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX = u"CharFontFamilyComplex";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX = u"CharFontCharSetComplex";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX = u"CharFontPitchComplex";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX = u"CharPostureComplex";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX = u"CharWeightComplex";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX = u"CharLocaleComplex";
+
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR = u"CharColor";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_THEME = u"CharColorTheme";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE = u"CharColorTintOrShade";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD = u"CharColorLumMod";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_LUM_OFF = u"CharColorLumOff";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_TRANSPARENCE = u"CharTransparence";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_CROSSEDOUT = u"CharCrossedOut";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_STRIKEOUT = u"CharStrikeout";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_CASEMAP = u"CharCaseMap";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_ESCAPEMENT = u"CharEscapement";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_SHADOWED = u"CharShadowed";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_UNDERLINE = u"CharUnderline";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_OVERLINE = u"CharOverline";
+
+inline constexpr OUStringLiteral UNO_NAME_BITMAP = u"Bitmap";
+
+inline constexpr OUStringLiteral UNO_NAME_LINKDISPLAYNAME = u"LinkDisplayName";
+inline constexpr OUStringLiteral UNO_NAME_LINKDISPLAYBITMAP = u"LinkDisplayBitmap";
+
+inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_LUMINANCE = u"AdjustLuminance";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_CONTRAST = u"AdjustContrast";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_RED = u"AdjustRed";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_GREEN = u"AdjustGreen";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_BLUE = u"AdjustBlue";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_GAMMA = u"Gamma";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_TRANSPARENCY = u"Transparency";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_COLOR_MODE = u"GraphicColorMode";
+inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_GRAPHICCROP = u"GraphicCrop";
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
new file mode 100644
index 000000000..3c8f95368
--- /dev/null
+++ b/include/editeng/unotext.hxx
@@ -0,0 +1,677 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOTEXT_HXX
+#define INCLUDED_EDITENG_UNOTEXT_HXX
+
+#include <memory>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/text/XTextRangeMover.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/text/XTextRangeCompare.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/text/XTextAppend.hpp>
+#include <com/sun/star/text/XTextCopy.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/TabStop.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/interfacecontainer4.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/weakagg.hxx>
+#include <osl/diagnose.hxx>
+#include <mutex>
+#include <comphelper/servicehelper.hxx>
+#include <svl/itemset.hxx>
+#include <svl/solar.hrc>
+#include <editeng/editdata.hxx>
+#include <editeng/unoedsrc.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editengdllapi.h>
+#include <editeng/memberids.h>
+
+class SvxItemPropertySet;
+struct SfxItemPropertyMapEntry;
+
+#define WID_FONTDESC OWN_ATTR_VALUE_START
+#define WID_NUMLEVEL OWN_ATTR_VALUE_START+1
+#define WID_PORTIONTYPE OWN_ATTR_VALUE_START+2
+#define WID_NUMBERINGSTARTVALUE OWN_ATTR_VALUE_START+3
+#define WID_PARAISNUMBERINGRESTART OWN_ATTR_VALUE_START+4
+
+#define SVX_UNOEDIT_NUMBERING_PROPERTY \
+ { UNO_NAME_NUMBERING_RULES, EE_PARA_NUMBULLET, cppu::UnoType<css::container::XIndexReplace>::get(), 0, 0 }, \
+ { UNO_NAME_NUMBERING, EE_PARA_BULLETSTATE,cppu::UnoType<bool>::get(), 0, 0 }
+
+#define SVX_UNOEDIT_OUTLINER_PROPERTIES \
+ SVX_UNOEDIT_NUMBERING_PROPERTY, \
+ { UNO_NAME_NUMBERING_LEVEL, WID_NUMLEVEL, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, \
+ {u"NumberingStartValue", WID_NUMBERINGSTARTVALUE, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, \
+ {u"ParaIsNumberingRestart", WID_PARAISNUMBERINGRESTART, cppu::UnoType<bool>::get(), 0, 0 }
+
+#define SVX_UNOEDIT_CHAR_PROPERTIES \
+ { UNO_NAME_EDIT_CHAR_HEIGHT, EE_CHAR_FONTHEIGHT, cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
+ { u"CharScaleWidth", EE_CHAR_FONTWIDTH, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, \
+ { UNO_NAME_EDIT_CHAR_FONTNAME, EE_CHAR_FONTINFO, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME },\
+ { UNO_NAME_EDIT_CHAR_FONTSTYLENAME,EE_CHAR_FONTINFO, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME }, \
+ { UNO_NAME_EDIT_CHAR_FONTFAMILY, EE_CHAR_FONTINFO, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY }, \
+ { UNO_NAME_EDIT_CHAR_FONTCHARSET, EE_CHAR_FONTINFO, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET }, \
+ { UNO_NAME_EDIT_CHAR_FONTPITCH, EE_CHAR_FONTINFO, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH }, \
+ { UNO_NAME_EDIT_CHAR_POSTURE, EE_CHAR_ITALIC, ::cppu::UnoType<css::awt::FontSlant>::get(),0, MID_POSTURE }, \
+ { UNO_NAME_EDIT_CHAR_WEIGHT, EE_CHAR_WEIGHT, cppu::UnoType<float>::get(), 0, MID_WEIGHT }, \
+ { UNO_NAME_EDIT_CHAR_LOCALE, EE_CHAR_LANGUAGE, ::cppu::UnoType<css::lang::Locale>::get(),0, MID_LANG_LOCALE }, \
+ { UNO_NAME_EDIT_CHAR_COLOR, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int32>::get(), 0, MID_COLOR_RGB }, \
+ { UNO_NAME_EDIT_CHAR_TRANSPARENCE,EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_ALPHA }, \
+ { UNO_NAME_EDIT_CHAR_COLOR_THEME, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_THEME_INDEX }, \
+ { UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_TINT_OR_SHADE }, \
+ { UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_MOD }, \
+ { UNO_NAME_EDIT_CHAR_COLOR_LUM_OFF, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_OFF }, \
+ { u"CharBackColor", EE_CHAR_BKGCOLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, \
+ { u"CharBackTransparent", EE_CHAR_BKGCOLOR, ::cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT }, \
+ { UNO_NAME_EDIT_CHAR_ESCAPEMENT, EE_CHAR_ESCAPEMENT, ::cppu::UnoType<sal_Int16>::get(), 0, MID_ESC }, \
+ { UNO_NAME_EDIT_CHAR_UNDERLINE, EE_CHAR_UNDERLINE, ::cppu::UnoType<sal_Int16>::get(), 0, MID_TL_STYLE }, \
+ { u"CharUnderlineColor", EE_CHAR_UNDERLINE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_TL_COLOR }, \
+ { u"CharUnderlineHasColor", EE_CHAR_UNDERLINE, cppu::UnoType<bool>::get(), 0, MID_TL_HASCOLOR } , \
+ { UNO_NAME_EDIT_CHAR_OVERLINE, EE_CHAR_OVERLINE, ::cppu::UnoType<sal_Int16>::get(), 0, MID_TL_STYLE }, \
+ { u"CharOverlineColor", EE_CHAR_OVERLINE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_TL_COLOR }, \
+ { u"CharOverlineHasColor", EE_CHAR_OVERLINE, cppu::UnoType<bool>::get(), 0, MID_TL_HASCOLOR } , \
+ { UNO_NAME_EDIT_CHAR_CROSSEDOUT, EE_CHAR_STRIKEOUT, cppu::UnoType<bool>::get(), 0, MID_CROSSED_OUT }, \
+ { UNO_NAME_EDIT_CHAR_STRIKEOUT, EE_CHAR_STRIKEOUT, ::cppu::UnoType<sal_Int16>::get(), 0, MID_CROSS_OUT}, \
+ { UNO_NAME_EDIT_CHAR_CASEMAP, EE_CHAR_CASEMAP, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, \
+ { UNO_NAME_EDIT_CHAR_SHADOWED, EE_CHAR_SHADOW, cppu::UnoType<bool>::get(), 0, 0 }, \
+ { u"CharContoured", EE_CHAR_OUTLINE, cppu::UnoType<bool>::get(), 0, 0 }, \
+ { u"CharEscapementHeight", EE_CHAR_ESCAPEMENT, cppu::UnoType<sal_Int8>::get(), 0, MID_ESC_HEIGHT },\
+ { u"CharAutoKerning", EE_CHAR_PAIRKERNING,cppu::UnoType<bool>::get(), 0, 0 } , \
+ { u"CharKerning", EE_CHAR_KERNING, ::cppu::UnoType<sal_Int16>::get() , 0, 0 }, \
+ { u"CharWordMode", EE_CHAR_WLM, cppu::UnoType<bool>::get(), 0, 0 }, \
+ { u"CharEmphasis", EE_CHAR_EMPHASISMARK, ::cppu::UnoType<sal_Int16>::get(), 0, MID_EMPHASIS},\
+ { UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN, EE_CHAR_FONTHEIGHT_CJK, cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
+ { UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN, EE_CHAR_FONTINFO_CJK, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME },\
+ { UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN, EE_CHAR_FONTINFO_CJK, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME }, \
+ { UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN, EE_CHAR_FONTINFO_CJK, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY }, \
+ { UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN, EE_CHAR_FONTINFO_CJK, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET }, \
+ { UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN, EE_CHAR_FONTINFO_CJK, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH }, \
+ { UNO_NAME_EDIT_CHAR_POSTURE_ASIAN, EE_CHAR_ITALIC_CJK, ::cppu::UnoType<css::awt::FontSlant>::get(),0, MID_POSTURE }, \
+ { UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN, EE_CHAR_WEIGHT_CJK, cppu::UnoType<float>::get(), 0, MID_WEIGHT }, \
+ { UNO_NAME_EDIT_CHAR_LOCALE_ASIAN, EE_CHAR_LANGUAGE_CJK, ::cppu::UnoType<css::lang::Locale>::get(),0, MID_LANG_LOCALE }, \
+ { UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX, EE_CHAR_FONTHEIGHT_CTL, cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
+ { UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX, EE_CHAR_FONTINFO_CTL, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME },\
+ { UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX,EE_CHAR_FONTINFO_CTL, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME }, \
+ { UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX, EE_CHAR_FONTINFO_CTL, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY }, \
+ { UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX, EE_CHAR_FONTINFO_CTL, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET }, \
+ { UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX, EE_CHAR_FONTINFO_CTL, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH }, \
+ { UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX, EE_CHAR_ITALIC_CTL, ::cppu::UnoType<css::awt::FontSlant>::get(),0, MID_POSTURE }, \
+ { UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX, EE_CHAR_WEIGHT_CTL, cppu::UnoType<float>::get(), 0, MID_WEIGHT }, \
+ { UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX, EE_CHAR_LANGUAGE_CTL, ::cppu::UnoType<css::lang::Locale>::get(),0, MID_LANG_LOCALE }, \
+ { u"CharRelief", EE_CHAR_RELIEF, ::cppu::UnoType<sal_Int16>::get(), 0, MID_RELIEF }, \
+ { u"CharInteropGrabBag", EE_CHAR_GRABBAG, cppu::UnoType<css::uno::Sequence<css::beans::PropertyValue >>::get(), 0, 0}
+
+
+#define SVX_UNOEDIT_FONT_PROPERTIES \
+ { UNO_NAME_EDIT_FONT_DESCRIPTOR, WID_FONTDESC, cppu::UnoType<css::awt::FontDescriptor>::get(), 0, MID_FONT_FAMILY_NAME }
+
+#define SVX_UNOEDIT_PARA_PROPERTIES \
+ { UNO_NAME_EDIT_PARA_ADJUST, EE_PARA_JUST, ::cppu::UnoType<sal_Int16>::get(), 0, MID_PARA_ADJUST }, \
+ { UNO_NAME_EDIT_PARA_BMARGIN, EE_PARA_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_LO_MARGIN, PropertyMoreFlags::METRIC_ITEM }, \
+ { UNO_NAME_EDIT_PARA_IS_HYPHEN, EE_PARA_HYPHENATE, ::cppu::UnoType<bool>::get(), 0, 0 }, \
+ {u"ParaHyphenationNoCaps", EE_PARA_HYPHENATE_NO_CAPS, ::cppu::UnoType<bool>::get(), 0, 0 }, \
+ {u"ParaHyphenationNoLastWord", EE_PARA_HYPHENATE_NO_LAST_WORD, ::cppu::UnoType<bool>::get(), 0, 0 }, \
+ { UNO_NAME_EDIT_PARA_LASTLINEADJ, EE_PARA_JUST, ::cppu::UnoType<sal_Int16>::get(), 0, MID_LAST_LINE_ADJUST }, \
+ { UNO_NAME_EDIT_PARA_LMARGIN, EE_PARA_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_TXT_LMARGIN, PropertyMoreFlags::METRIC_ITEM }, \
+ { UNO_NAME_EDIT_PARA_LINESPACING, EE_PARA_SBL, cppu::UnoType<css::style::LineSpacing>::get(), 0, CONVERT_TWIPS}, \
+ { UNO_NAME_EDIT_PARA_RMARGIN, EE_PARA_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_R_MARGIN, PropertyMoreFlags::METRIC_ITEM }, \
+ { UNO_NAME_EDIT_PARA_TAPSTOPS, EE_PARA_TABS, cppu::UnoType<css::uno::Sequence< css::style::TabStop >>::get(), 0, 0 }, \
+ { UNO_NAME_EDIT_PARA_TMARGIN, EE_PARA_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_UP_MARGIN, PropertyMoreFlags::METRIC_ITEM },\
+ { UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT, EE_PARA_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_FIRST_LINE_INDENT, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION,EE_PARA_HANGINGPUNCTUATION, cppu::UnoType<bool>::get(), 0 ,0 }, \
+ { UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE, EE_PARA_ASIANCJKSPACING, cppu::UnoType<bool>::get(), 0 ,0 }, \
+ { UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES, EE_PARA_FORBIDDENRULES, cppu::UnoType<bool>::get(), 0 ,0 },\
+ {u"WritingMode", EE_PARA_WRITINGDIR, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }
+
+class SvxFieldItem;
+class SvxFieldData;
+
+EDITENG_DLLPUBLIC void GetSelection( struct ESelection& rSel, SvxTextForwarder const * pForwarder ) noexcept;
+EDITENG_DLLPUBLIC void CheckSelection( struct ESelection& rSel, SvxTextForwarder const * pForwarder ) noexcept;
+
+
+// This class implements a SvxEditSource and SvxTextForwarder and does
+// nothing otherwise
+
+
+class SvxDummyTextSource final : public SvxEditSource, public SvxTextForwarder
+{
+public:
+
+ // SvxEditSource
+ virtual ~SvxDummyTextSource() override;
+ virtual std::unique_ptr<SvxEditSource> Clone() const override;
+ virtual SvxTextForwarder* GetTextForwarder() override;
+ virtual void UpdateData() override;
+
+ // SvxTextForwarder
+ virtual sal_Int32 GetParagraphCount() const override;
+ virtual sal_Int32 GetTextLen( sal_Int32 nParagraph ) const override;
+ virtual OUString GetText( const ESelection& rSel ) const override;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ) const override;
+ virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const override;
+ virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) override;
+ virtual void RemoveAttribs( const ESelection& rSelection ) override;
+ virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const override;
+
+ SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const override;
+ SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const override;
+
+ virtual SfxItemPool* GetPool() const override;
+
+ virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) override;
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) override;
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) override;
+ virtual void QuickInsertLineBreak( const ESelection& rSel ) override;
+
+ virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override;
+ virtual void FieldClicked( const SvxFieldItem& rField ) override;
+
+ virtual bool IsValid() const override;
+
+ virtual LanguageType GetLanguage( sal_Int32, sal_Int32 ) const override;
+ virtual sal_Int32 GetFieldCount( sal_Int32 nPara ) const override;
+ virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const override;
+ virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const override;
+ virtual tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const override;
+ virtual tools::Rectangle GetParaBounds( sal_Int32 nPara ) const override;
+ virtual MapMode GetMapMode() const override;
+ virtual OutputDevice* GetRefDevice() const override;
+ virtual bool GetIndexAtPoint( const Point&, sal_Int32& nPara, sal_Int32& nIndex ) const override;
+ virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const override;
+ virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const override;
+ virtual sal_Int32 GetLineCount( sal_Int32 nPara ) const override;
+ virtual sal_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const override;
+ virtual void GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const override;
+ virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const override;
+ virtual bool Delete( const ESelection& ) override;
+ virtual bool InsertText( const OUString&, const ESelection& ) override;
+ virtual bool QuickFormatDoc( bool bFull = false ) override;
+ virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override;
+ virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override;
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr() override;
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph() override;
+ virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) override;
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource) override;
+};
+
+namespace accessibility
+{
+ class AccessibleEditableTextPara;
+}
+
+
+class EDITENG_DLLPUBLIC SvxUnoTextRangeBase : public css::text::XTextRange,
+ public css::beans::XPropertySet,
+ public css::beans::XMultiPropertySet,
+ public css::beans::XMultiPropertyStates,
+ public css::beans::XPropertyState,
+ public css::lang::XServiceInfo,
+ public css::text::XTextRangeCompare,
+ public css::lang::XUnoTunnel,
+ private osl::DebugBase<SvxUnoTextRangeBase>
+
+{
+ friend class SvxUnoTextRangeEnumeration;
+ friend class ::accessibility::AccessibleEditableTextPara;
+ const SvxItemPropertySet* mpPropSet;
+
+protected:
+ std::unique_ptr<SvxEditSource> mpEditSource;
+ ESelection maSelection;
+
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ void _setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue, sal_Int32 nPara = -1 );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ css::uno::Any _getPropertyValue( const OUString& PropertyName, sal_Int32 nPara = -1 );
+
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ void _setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues, sal_Int32 nPara = -1 );
+ /// @throws css::uno::RuntimeException
+ css::uno::Sequence< css::uno::Any > _getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, sal_Int32 nPara = -1 );
+
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ css::beans::PropertyState _getPropertyState( const SfxItemPropertyMapEntry* pMap, sal_Int32 nPara = -1 );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ css::beans::PropertyState _getPropertyState( std::u16string_view PropertyName, sal_Int32 nPara = -1 );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ css::uno::Sequence< css::beans::PropertyState > _getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName, sal_Int32 nPara = -1 );
+ // returns true if property found or false if unknown property
+ static bool _getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertyMapEntry* pMap, css::beans::PropertyState& rState);
+
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ void _setPropertyToDefault( const OUString& PropertyName, sal_Int32 nPara = -1 );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ void _setPropertyToDefault( SvxTextForwarder* pForwarder, const SfxItemPropertyMapEntry* pMap, sal_Int32 nPara );
+ void SetEditSource( SvxEditSource* _pEditSource ) noexcept;
+
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ void getPropertyValue( const SfxItemPropertyMapEntry* pMap, css::uno::Any& rAny, const SfxItemSet& rSet );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::IllegalArgumentException
+ void setPropertyValue( const SfxItemPropertyMapEntry* pMap, const css::uno::Any& rValue, const ESelection& rSelection, const SfxItemSet& rOldSet, SfxItemSet& rNewSet );
+
+ SvxUnoTextRangeBase(const SvxItemPropertySet* _pSet);
+ SvxUnoTextRangeBase(const SvxEditSource* pSource, const SvxItemPropertySet* _pSet);
+ SvxUnoTextRangeBase(const SvxUnoTextRangeBase& rRange);
+ virtual ~SvxUnoTextRangeBase() noexcept;
+
+public:
+ // Internal
+ const ESelection& GetSelection() const noexcept
+ {
+ const SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
+ CheckSelection(const_cast<SvxUnoTextRangeBase*>(this)->maSelection, pForwarder);
+ return maSelection;
+ }
+ void SetSelection( const ESelection& rSelection ) noexcept;
+
+ void CollapseToStart() noexcept;
+ void CollapseToEnd() noexcept;
+ bool IsCollapsed() noexcept;
+ bool GoLeft(sal_Int32 nCount, bool Expand) noexcept;
+ bool GoRight(sal_Int32 nCount, bool Expand) noexcept;
+ void GotoStart(bool Expand) noexcept;
+ void GotoEnd(bool Expand) noexcept;
+
+ //const SfxItemPropertyMapEntry* getPropertyMapEntries() const throw() { return maPropSet.getPropertyMapEntries(); }
+ const SvxItemPropertySet* getPropertySet() const noexcept { return mpPropSet; }
+ SvxEditSource* GetEditSource() const noexcept { return mpEditSource.get(); }
+
+ static bool SetPropertyValueHelper( const SfxItemPropertyMapEntry* pMap, const css::uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection = nullptr, SvxEditSource* pEditSource = nullptr );
+ /// @throws css::uno::RuntimeException
+ static bool GetPropertyValueHelper( SfxItemSet const & rSet, const SfxItemPropertyMapEntry* pMap, css::uno::Any& aAny, const ESelection* pSelection = nullptr, SvxEditSource* pEditSource = nullptr );
+
+ void attachField( std::unique_ptr<SvxFieldData> pData ) noexcept;
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextRangeBase )
+
+ // css::text::XTextRange
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
+ virtual OUString SAL_CALL getString() override;
+ virtual void SAL_CALL setString( const OUString& aString ) override;
+
+ // css::beans::XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
+ virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+ virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+ virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+
+ // css::beans::XPropertyState
+ virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
+ virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
+ virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
+
+ // css::beans::XMultiPropertyStates
+ //virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException);
+ virtual void SAL_CALL setAllPropertiesToDefault() override;
+ virtual void SAL_CALL setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override;
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override;
+
+ // XTextRangeCompare
+ virtual ::sal_Int16 SAL_CALL compareRegionStarts( const css::uno::Reference< css::text::XTextRange >& xR1, const css::uno::Reference< css::text::XTextRange >& xR2 ) override;
+ virtual ::sal_Int16 SAL_CALL compareRegionEnds( const css::uno::Reference< css::text::XTextRange >& xR1, const css::uno::Reference< css::text::XTextRange >& xR2 ) override;
+
+ // css::lang::XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
+};
+
+
+class SvxUnoTextBase;
+class EDITENG_DLLPUBLIC SvxUnoTextRange final : public SvxUnoTextRangeBase,
+ public css::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+ friend class SvxUnoTextRangeEnumeration;
+private:
+ css::uno::Reference< css::text::XText > xParentText;
+ bool mbPortion;
+
+public:
+ SvxUnoTextRange(const SvxUnoTextBase& rParent, bool bPortion = false);
+ virtual ~SvxUnoTextRange() noexcept override;
+
+ // css::uno::XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+ // css::text::XTextRange
+ virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override;
+
+ // css::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+
+ // css::lang::XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+};
+
+class EDITENG_DLLPUBLIC SvxUnoTextBase : public SvxUnoTextRangeBase,
+ public css::text::XTextAppend,
+ public css::text::XTextCopy,
+ public css::container::XEnumerationAccess,
+ public css::text::XTextRangeMover,
+ public css::lang::XTypeProvider
+{
+ css::uno::Reference< css::text::XText > xParentText;
+
+protected:
+ SvxUnoTextBase(const SvxItemPropertySet* _pSet);
+ SvxUnoTextBase(const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, css::uno::Reference < css::text::XText > const & xParent);
+ SvxUnoTextBase(const SvxUnoTextBase& rText);
+ virtual ~SvxUnoTextBase() noexcept override;
+
+public:
+ UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextBase )
+
+ css::uno::Reference< css::text::XTextCursor > createTextCursorBySelection( const ESelection& rSel );
+
+ // css::uno::XInterface
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType );
+
+ // css::text::XSimpleText
+ virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor( ) override;
+ virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange( const css::uno::Reference< css::text::XTextRange >& aTextPosition ) override;
+ virtual void SAL_CALL insertString( const css::uno::Reference< css::text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb ) override;
+ virtual void SAL_CALL insertControlCharacter( const css::uno::Reference< css::text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb ) override;
+
+ // css::text::XText
+ virtual void SAL_CALL insertTextContent( const css::uno::Reference< css::text::XTextRange >& xRange, const css::uno::Reference< css::text::XTextContent >& xContent, sal_Bool bAbsorb ) override;
+ virtual void SAL_CALL removeTextContent( const css::uno::Reference< css::text::XTextContent >& xContent ) override;
+ virtual OUString SAL_CALL getString() override;
+ virtual void SAL_CALL setString( const OUString& aString ) override;
+
+ // css::text::XTextRange
+ virtual css::uno::Reference< css::text::XText > SAL_CALL getText( ) override;
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
+
+ // css::container::XEnumerationAccess
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override;
+
+ // css::container::XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType( ) override;
+ virtual sal_Bool SAL_CALL hasElements( ) override;
+
+ // css::text::XTextRangeMover
+ virtual void SAL_CALL moveTextRange( const css::uno::Reference< css::text::XTextRange >& xRange, sal_Int16 nParagraphs ) override;
+
+ // css::text::XParagraphAppend (new import API)
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL finishParagraph( const css::uno::Sequence< css::beans::PropertyValue >& CharacterAndParagraphProperties ) override;
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL finishParagraphInsert( const css::uno::Sequence< css::beans::PropertyValue >& CharacterAndParagraphProperties, const css::uno::Reference< css::text::XTextRange >& xInsertPosition ) override;
+
+ // css::text::XTextPortionAppend (new import API)
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL appendTextPortion( const OUString& Text, const css::uno::Sequence< css::beans::PropertyValue >& CharacterAndParagraphProperties ) override;
+
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL insertTextPortion( const OUString& Text, const css::uno::Sequence< css::beans::PropertyValue >& CharacterAndParagraphProperties, const css::uno::Reference< css::text::XTextRange>& rTextRange ) override;
+
+ // css::text::XTextCopy
+ virtual void SAL_CALL copyText( const css::uno::Reference< css::text::XTextCopy >& xSource ) override;
+
+ // css::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+ static css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( );
+
+ // css::lang::XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+};
+
+
+class EDITENG_DLLPUBLIC SvxUnoText : public SvxUnoTextBase,
+ public ::cppu::OWeakAggObject
+{
+public:
+ SvxUnoText( const SvxItemPropertySet* _pSet ) noexcept;
+ SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, css::uno::Reference < css::text::XText > const & xParent ) noexcept;
+ SvxUnoText( const SvxUnoText& rText ) noexcept;
+ virtual ~SvxUnoText() noexcept override;
+
+ // Internal
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept;
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+
+ // css::uno::XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+ // css::lang::XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+};
+
+
+class SvxUnoTextContent final : public SvxUnoTextRangeBase,
+ public css::text::XTextContent,
+ public css::container::XEnumerationAccess,
+ public css::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+ friend class SvxUnoTextContentEnumeration;
+private:
+ css::uno::Reference< css::text::XText > mxParentText;
+ sal_Int32 mnParagraph;
+ const SvxUnoTextBase& mrParentText;
+
+ // for xComponent
+ std::mutex maDisposeContainerMutex;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> maDisposeListeners;
+ bool mbDisposing;
+
+protected:
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+public:
+ SvxUnoTextContent( const SvxUnoTextBase& rText, sal_Int32 nPara ) noexcept;
+ SvxUnoTextContent( const SvxUnoTextContent& rContent ) noexcept;
+ virtual ~SvxUnoTextContent() noexcept override;
+
+ // css::uno::XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+ // css::text::XTextRange
+ virtual css::uno::Reference< css::text::XText > SAL_CALL getText( ) override;
+
+ // css::text::XTextContent -> css::lang::XComponent
+ virtual void SAL_CALL attach( const css::uno::Reference< css::text::XTextRange >& xTextRange ) override;
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor( ) override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL dispose() override;
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
+
+ // css::container::XEnumerationAccess
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override;
+
+ // css::container::XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType() override;
+ virtual sal_Bool SAL_CALL hasElements() override;
+
+ // css::beans::XPropertySet
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
+
+ // css::beans::XPropertyState
+ virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
+ virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
+
+ // css::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+
+ // css::lang::XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+};
+
+
+class SvxUnoTextContentEnumeration final : public ::cppu::WeakAggImplHelper1< css::container::XEnumeration >
+{
+private:
+ css::uno::Reference< css::text::XText > mxParentText;
+ std::unique_ptr<SvxEditSource> mpEditSource;
+ sal_Int32 mnNextParagraph;
+ std::vector< rtl::Reference<SvxUnoTextContent> > maContents;
+
+public:
+ SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText, const ESelection& rSel ) noexcept;
+ virtual ~SvxUnoTextContentEnumeration() noexcept override;
+
+ // css::container::XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements( ) override;
+ virtual css::uno::Any SAL_CALL nextElement( ) override;
+};
+
+
+class SvxUnoTextRangeEnumeration final : public ::cppu::WeakAggImplHelper1< css::container::XEnumeration >
+{
+private:
+ std::unique_ptr<SvxEditSource> mpEditSource;
+ css::uno::Reference< css::text::XText > mxParentText;
+ std::vector< rtl::Reference<SvxUnoTextRange> > maPortions;
+ sal_uInt16 mnNextPortion;
+
+public:
+ SvxUnoTextRangeEnumeration(const SvxUnoTextBase& rText, sal_Int32 nPara, const ESelection& rSel);
+ virtual ~SvxUnoTextRangeEnumeration() noexcept override;
+
+ // css::container::XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements( ) override;
+ virtual css::uno::Any SAL_CALL nextElement( ) override;
+};
+
+
+class EDITENG_DLLPUBLIC SvxUnoTextCursor : public SvxUnoTextRangeBase,
+ public css::text::XTextCursor,
+ public css::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+private:
+ css::uno::Reference< css::text::XText > mxParentText;
+
+public:
+ SvxUnoTextCursor( const SvxUnoTextBase& rText ) noexcept;
+ SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) noexcept;
+ virtual ~SvxUnoTextCursor() noexcept override;
+
+ // css::uno::XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+ // css::text::XTextRange
+ virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override;
+ virtual OUString SAL_CALL getString() override;
+ virtual void SAL_CALL setString( const OUString& aString ) override;
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
+
+ // css::text::XTextCursor -> css::text::XTextRange
+ virtual void SAL_CALL collapseToStart( ) override;
+ virtual void SAL_CALL collapseToEnd( ) override;
+ virtual sal_Bool SAL_CALL isCollapsed( ) override;
+ virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) override;
+ virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) override;
+ virtual void SAL_CALL gotoStart( sal_Bool bExpand ) override;
+ virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) override;
+ virtual void SAL_CALL gotoRange( const css::uno::Reference< css::text::XTextRange >& xRange, sal_Bool bExpand ) override;
+
+ // css::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // css::lang::XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+};
+
+EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet();
+const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap();
+const SvxItemPropertySet* ImplGetSvxTextPortionSvxPropertySet();
+const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoviwou.hxx b/include/editeng/unoviwou.hxx
new file mode 100644
index 000000000..674bec8cf
--- /dev/null
+++ b/include/editeng/unoviwou.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_UNOVIWOU_HXX
+#define INCLUDED_EDITENG_UNOVIWOU_HXX
+
+#include <editeng/unoedsrc.hxx>
+#include <editeng/editengdllapi.h>
+
+class OutlinerView;
+
+/// Specialization for Draw/Impress
+class EDITENG_DLLPUBLIC SvxDrawOutlinerViewForwarder final : public SvxEditViewForwarder
+{
+private:
+ OutlinerView& mrOutlinerView;
+ Point maTextShapeTopLeft;
+
+ EDITENG_DLLPRIVATE Point GetTextOffset() const;
+
+public:
+ explicit SvxDrawOutlinerViewForwarder( OutlinerView& rOutl );
+ SvxDrawOutlinerViewForwarder( OutlinerView& rOutl, const Point& rShapePosTopLeft );
+ virtual ~SvxDrawOutlinerViewForwarder() override;
+
+ virtual bool IsValid() const override;
+
+ virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const override;
+ virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const override;
+
+ virtual bool GetSelection( ESelection& rSelection ) const override;
+ virtual bool SetSelection( const ESelection& rSelection ) override;
+ virtual bool Copy() override;
+ virtual bool Cut() override;
+ virtual bool Paste() override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/urlfieldhelper.hxx b/include/editeng/urlfieldhelper.hxx
new file mode 100644
index 000000000..9a1d53d15
--- /dev/null
+++ b/include/editeng/urlfieldhelper.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+#include <editeng/editengdllapi.h>
+#include <editeng/outliner.hxx>
+#include <editeng/editview.hxx>
+
+class EDITENG_DLLPUBLIC URLFieldHelper
+{
+public:
+ static void RemoveURLField(EditView& pEditView);
+ static bool IsCursorAtURLField(const EditView& pEditView);
+ static bool IsCursorAtURLField(const OutlinerView* pOLV)
+ {
+ return pOLV && IsCursorAtURLField(pOLV->GetEditView());
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/editeng/wghtitem.hxx b/include/editeng/wghtitem.hxx
new file mode 100644
index 000000000..6f5f4b31c
--- /dev/null
+++ b/include/editeng/wghtitem.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_WGHTITEM_HXX
+#define INCLUDED_EDITENG_WGHTITEM_HXX
+
+#include <tools/fontenum.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxWeightItem ---------------------------------------------------
+
+/* [Description]
+
+ This item describes the font weight.
+*/
+
+class EDITENG_DLLPUBLIC SvxWeightItem final : public SfxEnumItem<FontWeight>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxWeightItem( const FontWeight eWght /*= WEIGHT_NORMAL*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxWeightItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ static OUString GetValueTextByPos( sal_uInt16 nPos );
+ virtual sal_uInt16 GetValueCount() const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool HasBoolValue() const override;
+ virtual bool GetBoolValue() const override;
+ virtual void SetBoolValue( bool bVal ) override;
+
+ // enum cast
+ FontWeight GetWeight() const { return GetValue(); }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+
+ virtual bool IsSortable() const override { return true; }
+
+ virtual bool operator<(const SfxPoolItem& rCmp) const override
+ {
+ auto const & other = static_cast<const SvxWeightItem&>(rCmp);
+ return GetValue() < other.GetValue();
+ }
+};
+
+#endif // INCLUDED_EDITENG_WGHTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/widwitem.hxx b/include/editeng/widwitem.hxx
new file mode 100644
index 000000000..5d64962d3
--- /dev/null
+++ b/include/editeng/widwitem.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_WIDWITEM_HXX
+#define INCLUDED_EDITENG_WIDWITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxWidowsItem ---------------------------------------------------
+
+/* [Description]
+
+ This item describes the number of lines for the widows control.
+*/
+
+class EDITENG_DLLPUBLIC SvxWidowsItem final : public SfxByteItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxWidowsItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxWidowsItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/writingmodeitem.hxx b/include/editeng/writingmodeitem.hxx
new file mode 100644
index 000000000..f9e116d76
--- /dev/null
+++ b/include/editeng/writingmodeitem.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_WRITINGMODEITEM_HXX
+#define INCLUDED_EDITENG_WRITINGMODEITEM_HXX
+
+#include <com/sun/star/text/WritingMode.hpp>
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxWritingModeItem ----------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxWritingModeItem final : public SfxUInt16Item
+{
+public:
+ SvxWritingModeItem( css::text::WritingMode eValue /*= css::text::WritingMode_LR_TB*/,
+ sal_uInt16 nWhich /*= SDRATTR_TEXTDIRECTION*/ );
+ virtual ~SvxWritingModeItem() override;
+
+ SvxWritingModeItem(SvxWritingModeItem const &) = default;
+ SvxWritingModeItem(SvxWritingModeItem &&) = default;
+ SvxWritingModeItem & operator =(SvxWritingModeItem const &) = delete; // due to SfxUInt16Item
+ SvxWritingModeItem & operator =(SvxWritingModeItem &&) = delete; // due to SfxUInt16Item
+
+ virtual SvxWritingModeItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ css::text::WritingMode GetValue() const { return static_cast<css::text::WritingMode>(SfxUInt16Item::GetValue()); }
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif // INCLUDED_EDITENG_WRITINGMODEITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/wrlmitem.hxx b/include/editeng/wrlmitem.hxx
new file mode 100644
index 000000000..6226d3262
--- /dev/null
+++ b/include/editeng/wrlmitem.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_EDITENG_WRLMITEM_HXX
+#define INCLUDED_EDITENG_WRLMITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxWordLineModeItem ---------------------------------------------
+
+/* [Description]
+
+ This item describes, whether underlined and strikethrough is limited
+ to word boundaries.
+*/
+
+class EDITENG_DLLPUBLIC SvxWordLineModeItem final : public SfxBoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxWordLineModeItem( const bool bWordLineMode /*= false*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SvxWordLineModeItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/xmlcnitm.hxx b/include/editeng/xmlcnitm.hxx
new file mode 100644
index 000000000..a0ee0a63f
--- /dev/null
+++ b/include/editeng/xmlcnitm.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENG_XMLCNITM_HXX
+#define INCLUDED_EDITENG_XMLCNITM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+#include <xmloff/xmlcnimp.hxx>
+
+
+class EDITENG_DLLPUBLIC SvXMLAttrContainerItem final : public SfxPoolItem
+{
+ SvXMLAttrContainerData maContainerData;
+
+public:
+
+ SvXMLAttrContainerItem( sal_uInt16 nWhich = 0 );
+ SvXMLAttrContainerItem( const SvXMLAttrContainerItem& );
+ virtual ~SvXMLAttrContainerItem() override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePresentation,
+ MapUnit eCoreMetric,
+ MapUnit ePresentationMetric,
+ OUString &rText,
+ const IntlWrapper& rIntlWrapper) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual SvXMLAttrContainerItem* Clone( SfxItemPool * = nullptr) const override
+ { return new SvXMLAttrContainerItem( *this ); }
+
+ bool AddAttr( const OUString& rLName,
+ const OUString& rValue );
+ bool AddAttr( const OUString& rPrefix,
+ const OUString& rNamespace,
+ const OUString& rLName,
+ const OUString& rValue );
+
+ sal_uInt16 GetAttrCount() const;
+ OUString GetAttrNamespace( sal_uInt16 i ) const;
+ OUString GetAttrPrefix( sal_uInt16 i ) const;
+ const OUString& GetAttrLName( sal_uInt16 i ) const;
+ const OUString& GetAttrValue( sal_uInt16 i ) const;
+
+ sal_uInt16 GetFirstNamespaceIndex() const;
+ sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const;
+ const OUString& GetNamespace( sal_uInt16 i ) const;
+ const OUString& GetPrefix( sal_uInt16 i ) const;
+};
+
+#endif // INCLUDED_EDITENG_XMLCNITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/embeddedobj/embeddedupdate.hxx b/include/embeddedobj/embeddedupdate.hxx
new file mode 100644
index 000000000..1db3f36d6
--- /dev/null
+++ b/include/embeddedobj/embeddedupdate.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <embeddedobj/embobjdllapi.h>
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace embed
+{
+/** This class is only used to tell the OCommonEmbeddedObject class
+ that the following call is an Link- / Ole-refresh.
+
+ @since LibreOffice 7.4
+ */
+class EMBOBJ_DLLPUBLIC EmbeddedUpdate
+{
+ /** By "Refresh all" is used to perform an OLE update and a link update.
+ In the case of a link update, the class OCommonEmbeddedObject is
+ informed with true that a link update will take place next
+
+ @param bIsOleUpdate
+ what kind of update, when true is OLE-Object
+ when false is Link-Object
+ */
+public:
+ virtual void SetOleState(bool bIsOleUpdate) = 0;
+
+ EmbeddedUpdate() = default;
+ virtual ~EmbeddedUpdate() = default;
+
+private:
+ EmbeddedUpdate(const EmbeddedUpdate&) = delete;
+ EmbeddedUpdate& operator=(const EmbeddedUpdate&) = delete;
+};
+};
+};
+};
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/embeddedobj/embobjdllapi.h b/include/embeddedobj/embobjdllapi.h
new file mode 100644
index 000000000..36aa54217
--- /dev/null
+++ b/include/embeddedobj/embobjdllapi.h
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/types.h>
+
+#if defined(EMBOBJ_DLLIMPLEMENTATION)
+#define EMBOBJ_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define EMBOBJ_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/filter/dllapi.h b/include/filter/dllapi.h
new file mode 100644
index 000000000..526a1f7bd
--- /dev/null
+++ b/include/filter/dllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FILTER_DLLAPI_H
+#define INCLUDED_FILTER_DLLAPI_H
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined FILTER_DLLIMPLEMENTATION
+#define FILTER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define FILTER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/classids.hxx b/include/filter/msfilter/classids.hxx
new file mode 100644
index 000000000..8394a716b
--- /dev/null
+++ b/include/filter/msfilter/classids.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX
+#define INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX
+
+#define MSO_EQUATION2_CLASSID \
+ 0x00021700L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_EQUATION3_CLASSID \
+ 0x0002ce02L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_WW8_CLASSID \
+ 0x00020906L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_EXCEL5_CLASSID \
+ 0x00020810L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_EXCEL8_CLASSID \
+ 0x00020820L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_EXCEL8_CHART_CLASSID \
+ 0x00020821L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_PPT8_CLASSID \
+ 0x64818d10L, 0x4f9b, 0x11cf, \
+ 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8
+
+#define MSO_PPT8_SLIDE_CLASSID \
+ 0x64818d11L, 0x4f9b, 0x11cf, \
+ 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8
+
+#endif // INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/countryid.hxx b/include/filter/msfilter/countryid.hxx
new file mode 100644
index 000000000..b55e1d9cf
--- /dev/null
+++ b/include/filter/msfilter/countryid.hxx
@@ -0,0 +1,307 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_FILTER_MSFILTER_COUNTRYID_HXX
+#define INCLUDED_FILTER_MSFILTER_COUNTRYID_HXX
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <i18nlangtag/lang.h>
+#include <sal/types.h>
+
+
+namespace msfilter {
+
+// Windows Country IDs ========================================================
+
+/** Represents a Windows country ID.
+
+ The country IDs used in Windows are equal to the international calling
+ code of each country, i.e. the code 353 represents Ireland (+353).
+
+ ATTENTION: These country codes are not supposed to be used anywhere in core
+ structures! They shall ONLY be used in the import/export filters for
+ Microsoft Office documents!
+ */
+typedef sal_uInt16 CountryId;
+
+const CountryId COUNTRY_DONTKNOW = 0;
+const CountryId COUNTRY_USA = 1;
+const CountryId COUNTRY_DOMINICAN_REPUBLIC = 1; // NANP
+const CountryId COUNTRY_GUAM = 1; // NANP
+const CountryId COUNTRY_JAMAICA = 1; // NANP
+const CountryId COUNTRY_PUERTO_RICO = 1; // NANP
+const CountryId COUNTRY_TRINIDAD_Y_TOBAGO = 1; // NANP
+const CountryId COUNTRY_CANADA = 2;
+const CountryId COUNTRY_RUSSIA = 7;
+const CountryId COUNTRY_KAZAKHSTAN = 7; // no own ID
+const CountryId COUNTRY_TATARSTAN = 7; // no own ID
+const CountryId COUNTRY_EGYPT = 20;
+const CountryId COUNTRY_SOUTH_AFRICA = 27;
+const CountryId COUNTRY_GREECE = 30;
+const CountryId COUNTRY_NETHERLANDS = 31;
+const CountryId COUNTRY_BELGIUM = 32;
+const CountryId COUNTRY_FRANCE = 33;
+const CountryId COUNTRY_SPAIN = 34;
+const CountryId COUNTRY_HUNGARY = 36;
+const CountryId COUNTRY_ITALY = 39;
+const CountryId COUNTRY_ROMANIA = 40;
+const CountryId COUNTRY_SWITZERLAND = 41;
+const CountryId COUNTRY_AUSTRIA = 43;
+const CountryId COUNTRY_UNITED_KINGDOM = 44;
+const CountryId COUNTRY_DENMARK = 45;
+const CountryId COUNTRY_SWEDEN = 46;
+const CountryId COUNTRY_NORWAY = 47;
+const CountryId COUNTRY_POLAND = 48;
+const CountryId COUNTRY_GERMANY = 49;
+const CountryId COUNTRY_PERU = 51;
+const CountryId COUNTRY_MEXICO = 52;
+const CountryId COUNTRY_CUBA = 53;
+const CountryId COUNTRY_ARGENTINA = 54;
+const CountryId COUNTRY_BRAZIL = 55;
+const CountryId COUNTRY_CHILE = 56;
+const CountryId COUNTRY_COLOMBIA = 57;
+const CountryId COUNTRY_VENEZUELA = 58;
+const CountryId COUNTRY_MALAYSIA = 60;
+const CountryId COUNTRY_AUSTRALIA = 61;
+const CountryId COUNTRY_INDONESIA = 62;
+const CountryId COUNTRY_PHILIPPINES = 63;
+const CountryId COUNTRY_NEW_ZEALAND = 64;
+const CountryId COUNTRY_SINGAPORE = 65;
+const CountryId COUNTRY_THAILAND = 66;
+const CountryId COUNTRY_JAPAN = 81;
+const CountryId COUNTRY_SOUTH_KOREA = 82;
+const CountryId COUNTRY_VIET_NAM = 84;
+const CountryId COUNTRY_PR_CHINA = 86;
+const CountryId COUNTRY_TIBET = 86; // no own ID
+const CountryId COUNTRY_TURKEY = 90;
+const CountryId COUNTRY_INDIA = 91;
+const CountryId COUNTRY_PAKISTAN = 92;
+const CountryId COUNTRY_AFGHANISTAN = 93;
+const CountryId COUNTRY_SRI_LANKA = 94;
+const CountryId COUNTRY_MYANMAR = 95;
+const CountryId COUNTRY_MOROCCO = 212;
+const CountryId COUNTRY_ALGERIA = 213;
+const CountryId COUNTRY_TUNISIA = 216;
+const CountryId COUNTRY_LIBYA = 218;
+const CountryId COUNTRY_GAMBIA = 220;
+const CountryId COUNTRY_SENEGAL = 221;
+const CountryId COUNTRY_MAURITANIA = 222;
+const CountryId COUNTRY_MALI = 223;
+const CountryId COUNTRY_GUINEA = 224;
+const CountryId COUNTRY_COTE_D_IVOIRE = 225;
+const CountryId COUNTRY_BURKINA_FARSO = 226;
+const CountryId COUNTRY_NIGER = 227;
+const CountryId COUNTRY_TOGO = 228;
+const CountryId COUNTRY_BENIN = 229;
+const CountryId COUNTRY_MAURITIUS = 230;
+const CountryId COUNTRY_LIBERIA = 231;
+const CountryId COUNTRY_SIERRA_LEONE = 232;
+const CountryId COUNTRY_GHANA = 233;
+const CountryId COUNTRY_NIGERIA = 234;
+const CountryId COUNTRY_CHAD = 235;
+const CountryId COUNTRY_CENTRAL_AFR_REP = 236;
+const CountryId COUNTRY_CAMEROON = 237;
+const CountryId COUNTRY_CAPE_VERDE = 238;
+const CountryId COUNTRY_SAO_TOME = 239;
+const CountryId COUNTRY_EQUATORIAL_GUINEA = 240;
+const CountryId COUNTRY_GABON = 241;
+const CountryId COUNTRY_CONGO = 242;
+const CountryId COUNTRY_ZAIRE = 243;
+const CountryId COUNTRY_ANGOLA = 244;
+const CountryId COUNTRY_GUINEA_BISSAU = 245;
+const CountryId COUNTRY_DIEGO_GARCIA = 246;
+const CountryId COUNTRY_ASCENSION_ISLAND = 247;
+const CountryId COUNTRY_SEYCHELLES = 248;
+const CountryId COUNTRY_SUDAN = 249;
+const CountryId COUNTRY_RWANDA = 250;
+const CountryId COUNTRY_ETHIOPIA = 251;
+const CountryId COUNTRY_SOMALIA = 252;
+const CountryId COUNTRY_DJIBOUTI = 253;
+const CountryId COUNTRY_KENYA = 254;
+const CountryId COUNTRY_TANZANIA = 255;
+const CountryId COUNTRY_UGANDA = 256;
+const CountryId COUNTRY_BURUNDI = 257;
+const CountryId COUNTRY_MOZAMBIQUE = 258;
+const CountryId COUNTRY_ZANZIBAR = 259;
+const CountryId COUNTRY_ZAMBIA = 260;
+const CountryId COUNTRY_MADAGASCAR = 261;
+const CountryId COUNTRY_REUNION = 262;
+const CountryId COUNTRY_ZIMBABWE = 263;
+const CountryId COUNTRY_NAMIBIA = 264;
+const CountryId COUNTRY_MALAWI = 265;
+const CountryId COUNTRY_LESOTHO = 266;
+const CountryId COUNTRY_BOTSWANA = 267;
+const CountryId COUNTRY_SWAZILAND = 268;
+const CountryId COUNTRY_COMOROS_MAYOTTE = 269;
+const CountryId COUNTRY_ST_HELENA = 290;
+const CountryId COUNTRY_ERITREA = 291;
+const CountryId COUNTRY_ARUBA = 297;
+const CountryId COUNTRY_FAEROE_ISLANDS = 298;
+const CountryId COUNTRY_GREEN_ISLAND = 299;
+const CountryId COUNTRY_GIBRALTAR = 350;
+const CountryId COUNTRY_PORTUGAL = 351;
+const CountryId COUNTRY_LUXEMBOURG = 352;
+const CountryId COUNTRY_IRELAND = 353;
+const CountryId COUNTRY_ICELAND = 354;
+const CountryId COUNTRY_ALBANIA = 355;
+const CountryId COUNTRY_MALTA = 356;
+const CountryId COUNTRY_CYPRUS = 357;
+const CountryId COUNTRY_FINLAND = 358;
+const CountryId COUNTRY_BULGARIA = 359;
+const CountryId COUNTRY_LITHUANIA = 370;
+const CountryId COUNTRY_LATVIA = 371;
+const CountryId COUNTRY_ESTONIA = 372;
+const CountryId COUNTRY_MOLDOVA = 373;
+const CountryId COUNTRY_ARMENIA = 374;
+const CountryId COUNTRY_BELARUS = 375;
+const CountryId COUNTRY_ANDORRA = 376;
+const CountryId COUNTRY_MONACO = 377;
+const CountryId COUNTRY_SAN_MARINO = 378;
+const CountryId COUNTRY_VATICAN_CITY = 379;
+const CountryId COUNTRY_UKRAINE = 380;
+const CountryId COUNTRY_SERBIA = 381;
+const CountryId COUNTRY_CROATIA = 385;
+const CountryId COUNTRY_SLOVENIA = 386;
+const CountryId COUNTRY_BOSNIA = 387;
+const CountryId COUNTRY_MACEDONIA = 389;
+const CountryId COUNTRY_CZECH = 420;
+const CountryId COUNTRY_SLOVAK = 421;
+const CountryId COUNTRY_LIECHTENSTEIN = 423;
+const CountryId COUNTRY_FALKLAND_ISLANDS = 500;
+const CountryId COUNTRY_BELIZE = 501;
+const CountryId COUNTRY_GUATEMALA = 502;
+const CountryId COUNTRY_EL_SALVADOR = 503;
+const CountryId COUNTRY_HONDURAS = 504;
+const CountryId COUNTRY_NICARAGUA = 505;
+const CountryId COUNTRY_COSTA_RICA = 506;
+const CountryId COUNTRY_PANAMA = 507;
+const CountryId COUNTRY_ST_PIERRE = 508;
+const CountryId COUNTRY_HAITI = 509;
+const CountryId COUNTRY_GUADELOUPE = 590;
+const CountryId COUNTRY_BOLIVIA = 591;
+const CountryId COUNTRY_GUYANA = 592;
+const CountryId COUNTRY_ECUADOR = 593;
+const CountryId COUNTRY_FRENCH_GUIANA = 594;
+const CountryId COUNTRY_PARAGUAY = 595;
+const CountryId COUNTRY_MARTINIQUE = 596;
+const CountryId COUNTRY_SURINAME = 597;
+const CountryId COUNTRY_URUGUAY = 598;
+const CountryId COUNTRY_NETHERL_ANTILLES = 599;
+const CountryId COUNTRY_EAST_TIMOR = 670;
+const CountryId COUNTRY_ANTARCTICA = 672;
+const CountryId COUNTRY_BRUNEI_DARUSSALAM = 673;
+const CountryId COUNTRY_NARUPU = 674;
+const CountryId COUNTRY_PAPUA_NEW_GUINEA = 675;
+const CountryId COUNTRY_TONGA = 676;
+const CountryId COUNTRY_SOLOMON_ISLANDS = 677;
+const CountryId COUNTRY_VANUATU = 678;
+const CountryId COUNTRY_FIJI = 679;
+const CountryId COUNTRY_PALAU = 680;
+const CountryId COUNTRY_WALLIS_AND_FUTUNA = 681;
+const CountryId COUNTRY_COOK_ISLANDS = 682;
+const CountryId COUNTRY_NIUE_ISLAND = 683;
+const CountryId COUNTRY_AMERICAN_SAMOA = 684;
+const CountryId COUNTRY_WESTERN_SAMOA = 685;
+const CountryId COUNTRY_KIRIBATI = 686;
+const CountryId COUNTRY_NEW_CALEDONIA = 687;
+const CountryId COUNTRY_TUVALU = 688;
+const CountryId COUNTRY_FRENCH_POLYNESIA = 689;
+const CountryId COUNTRY_TOKELAU = 690;
+const CountryId COUNTRY_MICRONESIA = 691;
+const CountryId COUNTRY_MARSHALL_ISLANDS = 692;
+const CountryId COUNTRY_NORTH_KOREA = 850;
+const CountryId COUNTRY_HONG_KONG = 852;
+const CountryId COUNTRY_MACAU = 853;
+const CountryId COUNTRY_CAMBODIA = 855;
+const CountryId COUNTRY_LAOS = 856;
+const CountryId COUNTRY_BANGLADESH = 880;
+const CountryId COUNTRY_TAIWAN = 886;
+const CountryId COUNTRY_MALDIVES = 960;
+const CountryId COUNTRY_LEBANON = 961;
+const CountryId COUNTRY_JORDAN = 962;
+const CountryId COUNTRY_SYRIA = 963;
+const CountryId COUNTRY_IRAQ = 964;
+const CountryId COUNTRY_KUWAIT = 965;
+const CountryId COUNTRY_SAUDI_ARABIA = 966;
+const CountryId COUNTRY_YEMEN = 967;
+const CountryId COUNTRY_OMAN = 968;
+const CountryId COUNTRY_PALESTINE = 970;
+const CountryId COUNTRY_UAE = 971;
+const CountryId COUNTRY_ISRAEL = 972;
+const CountryId COUNTRY_BAHRAIN = 973;
+const CountryId COUNTRY_QATAR = 974;
+const CountryId COUNTRY_BHUTAN = 975;
+const CountryId COUNTRY_MONGOLIA = 976;
+const CountryId COUNTRY_NEPAL = 977;
+const CountryId COUNTRY_IRAN = 981;
+const CountryId COUNTRY_TAJIKISTAN = 992;
+const CountryId COUNTRY_TURKMENISTAN = 993;
+const CountryId COUNTRY_AZERBAIJAN = 994;
+const CountryId COUNTRY_GEORGIA = 995;
+const CountryId COUNTRY_KYRGYZSTAN = 996;
+const CountryId COUNTRY_UZBEKISTAN = 998;
+
+// Country ID <-> Language type conversion ====================================
+
+/** Converts a language type to a Windows country ID.
+
+ The function regards the sub type of the passed language, and tries to
+ return the appropriate country, i.e. COUNTRY_IRELAND for
+ LANGUAGE_ENGLISH_EIRE.
+
+ A few countries do not have an own associated country ID. Most of these
+ countries are mapped to another related country, i.e. Kazakhstan is
+ mapped to Russia.
+
+ If no country can be found, the value COUNTRY_DONTKNOW will be returned.
+
+ @param eLanguage
+ A language type, defined in tools/lang.hxx.
+
+ @return
+ The best Windows country ID for the passed language type, or
+ COUNTRY_DONTKNOW on error.
+ */
+MSFILTER_DLLPUBLIC CountryId ConvertLanguageToCountry( LanguageType eLanguage );
+
+/** Converts a Windows country ID to a language type.
+
+ The function returns the most used language for the passed country
+ (hopefully), i.e. LANGUAGE_ENGLISH_EIRE for COUNTRY_IRELAND.
+
+ If the passed country ID is not valid, the value LANGUAGE_DONTKNOW will be
+ returned.
+
+ @param eCountry
+ A Windows country ID, defined above.
+
+ @return
+ The most used language type in the passed country, or LANGUAGE_DONTKNOW
+ on error.
+ */
+MSFILTER_DLLPUBLIC LanguageType ConvertCountryToLanguage( CountryId eCountry );
+
+
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/dffpropset.hxx b/include/filter/msfilter/dffpropset.hxx
new file mode 100644
index 000000000..6e7ca4a41
--- /dev/null
+++ b/include/filter/msfilter/dffpropset.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_FILTER_MSFILTER_DFFPROPSET_HXX
+#define INCLUDED_FILTER_MSFILTER_DFFPROPSET_HXX
+
+#include <vector>
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/solar.h>
+
+class SvStream;
+
+struct DffPropFlags
+{
+ bool bSet : 1;
+ bool bComplex : 1;
+ bool bBlip : 1;
+ bool bSoftAttr : 1;
+};
+
+struct DffPropSetEntry
+{
+ DffPropFlags aFlags;
+ sal_uInt16 nComplexIndexOrFlagsHAttr;
+ sal_uInt32 nContent;
+};
+
+class MSFILTER_DLLPUBLIC DffPropSet
+{
+ private:
+ DffPropSetEntry* mpPropSetEntries;
+ std::vector< sal_uInt32 > maOffsets;
+
+ void ReadPropSet( SvStream&, bool );
+
+ public:
+ explicit DffPropSet();
+ ~DffPropSet();
+
+ bool IsProperty( sal_uInt32 nRecType ) const { return ( mpPropSetEntries[ nRecType & 0x3ff ].aFlags.bSet ); };
+ bool IsHardAttribute( sal_uInt32 nId ) const;
+ sal_uInt32 GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault ) const;
+ /** Returns a boolean property by its real identifier. */
+ bool GetPropertyBool( sal_uInt32 nId ) const;
+ /** Returns a string property. */
+ OUString GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const;
+ bool SeekToContent( sal_uInt32 nRecType, SvStream& rSt ) const;
+ void InitializePropSet( sal_uInt16 nPropSetType ) const;
+ static sal_uLong SanitizeEndPos(SvStream &rIn, sal_uLong nEndRecPos);
+
+ friend SvStream& ReadDffPropSet( SvStream& rIn, DffPropSet& rPropSet );
+ friend SvStream& operator|=( SvStream& rIn, DffPropSet& rPropSet );
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/dffrecordheader.hxx b/include/filter/msfilter/dffrecordheader.hxx
new file mode 100644
index 000000000..acd0d2539
--- /dev/null
+++ b/include/filter/msfilter/dffrecordheader.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_DFFRECORDHEADER_HXX
+#define INCLUDED_FILTER_MSFILTER_DFFRECORDHEADER_HXX
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <svx/msdffdef.hxx>
+#include <sal/types.h>
+#include <tools/solar.h>
+#include <tools/stream.hxx>
+
+class MSFILTER_DLLPUBLIC DffRecordHeader
+{
+public:
+ sal_uInt8 nRecVer; // may be DFF_PSFLAG_CONTAINER
+ sal_uInt16 nRecInstance;
+ sal_uInt16 nImpVerInst;
+ sal_uInt16 nRecType;
+ sal_uInt32 nRecLen;
+ sal_uLong nFilePos;
+
+ DffRecordHeader() : nRecVer(0), nRecInstance(0), nImpVerInst(0),
+ nRecType(0), nRecLen(0), nFilePos(0) {}
+ bool IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; }
+ sal_uLong GetRecBegFilePos() const { return nFilePos; }
+ sal_uLong GetRecEndFilePos() const
+ { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; }
+ bool SeekToEndOfRecord(SvStream& rIn) const
+ {
+ sal_uInt64 const nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen;
+ return checkSeek(rIn, nPos);
+ }
+ bool SeekToContent(SvStream& rIn) const
+ {
+ sal_uInt64 const nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE;
+ return checkSeek(rIn, nPos);
+ }
+ bool SeekToBegOfRecord(SvStream& rIn) const
+ {
+ return checkSeek(rIn, nFilePos);
+ }
+
+ MSFILTER_DLLPUBLIC friend bool ReadDffRecordHeader(SvStream& rIn, DffRecordHeader& rRec);
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
new file mode 100644
index 000000000..ac6b4cc00
--- /dev/null
+++ b/include/filter/msfilter/escherex.hxx
@@ -0,0 +1,1221 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_ESCHEREX_HXX
+#define INCLUDED_FILTER_MSFILTER_ESCHEREX_HXX
+
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vcl/GraphicObject.hxx>
+#include <svx/svdtypes.hxx>
+#include <svx/msdffdef.hxx>
+#include <tools/gen.hxx>
+#include <tools/stream.hxx>
+#include <vcl/mapmod.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+class Color;
+
+namespace com::sun::star {
+ namespace awt { struct Rectangle; }
+ namespace beans { class XPropertySet; }
+ namespace drawing { struct EnhancedCustomShapeParameter; }
+ namespace drawing { struct Hatch; }
+}
+
+namespace tools {
+ class Polygon;
+ class PolyPolygon;
+}
+
+ /*Record Name FBT-Value Instance Contents Wrd Exl PPT Ver*/
+// In the Microsoft documentation the naming scheme is msofbt... instead of ESCHER_...
+#define ESCHER_DggContainer 0xF000u /* per-document data X X X */
+#define ESCHER_Dgg 0xF006u /* an FDGG and several FIDCLs X X X 0 */
+#define ESCHER_OPT 0xF00Bu /* count of properties the document-wide default shape properties X X X 3 */
+#define ESCHER_SplitMenuColors 0xF11Eu /* count of colors the colors in the top-level split menus X X X 0 */
+#define ESCHER_BstoreContainer 0xF001u /* count of BLIPs all images in the document (JPEGs, metafiles, etc.) X X X */
+#define ESCHER_BSE 0xF007u /* BLIP type an FBSE (one per BLIP) X X X 2 */
+#define ESCHER_BlipFirst 0xF018u /* range of fbts reserved for various kinds of BLIPs X X X */
+
+#define ESCHER_DgContainer 0xF002u /* per-sheet/page/slide data X X X */
+#define ESCHER_Dg 0xF008u /* drawing ID an FDG X X X 0 */
+#define ESCHER_SpgrContainer 0xF003u /* several SpContainers, the first of which is the group shape itself X X X */
+#define ESCHER_SpContainer 0xF004u /* a shape X X X */
+#define ESCHER_Spgr 0xF009u /* an FSPGR; only present if the shape is a group shape X X X 1 */
+#define ESCHER_Sp 0xF00Au /* shape type an FSP X X X 2 */
+//#define ESCHER_OPT 0xF00Bu /* count of properties a shape property table X X X 3 */
+#define ESCHER_ClientTextbox 0xF00Du /* host-defined the text in the textbox, in host-defined format X X X */
+#define ESCHER_ChildAnchor 0xF00Fu /* a RECT, in units relative to the parent group X X X 0 */
+#define ESCHER_ClientAnchor 0xF010u /* host-defined the location of the shape, in a host-defined format X X X */
+#define ESCHER_ClientData 0xF011u /* host-defined host-specific data X X X */
+#define ESCHER_SolverContainer 0xF005u /* count of rules the rules governing shapes X X X */
+#define ESCHER_ConnectorRule 0xF012u /* an FConnectorRule X X 1 */
+#define ESCHER_UDefProp 0xF122u
+
+enum class ShapeFlag : sal_uInt32
+{
+ NONE = 0x000,
+ Group = 0x001, /* shape is a group shape */
+ Child = 0x002, /* shape is a child shape */
+ Patriarch = 0x004, /* shape is the topmost group shape.
+ Exactly one of these per drawing. */
+ Deleted = 0x008, /* shape has been deleted */
+ OLEShape = 0x010, /* shape is an OLE object */
+ HaveMaster = 0x020, /* shape has a valid master in hspMaster property */
+ FlipH = 0x040, /* shape is flipped horizontally */
+ FlipV = 0x080, /* shape is flipped vertically */
+ Connector = 0x100, /* shape is a connector shape */
+ HaveAnchor = 0x200, /* shape has an anchor of some kind */
+ Background = 0x400, /* shape is a background shape */
+ HaveShapeProperty = 0x800 /* shape has a shape type property */
+}; /* 20 bits unused */
+namespace o3tl {
+ template<> struct typed_flags<ShapeFlag> : is_typed_flags<ShapeFlag, 0x00000FFF> {};
+}
+
+#define ESCHER_ShpInst_Min 0
+#define ESCHER_ShpInst_NotPrimitive ESCHER_ShpInst_Min
+#define ESCHER_ShpInst_Rectangle 1
+#define ESCHER_ShpInst_RoundRectangle 2
+#define ESCHER_ShpInst_Ellipse 3
+#define ESCHER_ShpInst_Arc 19
+#define ESCHER_ShpInst_Line 20
+#define ESCHER_ShpInst_StraightConnector1 32
+#define ESCHER_ShpInst_BentConnector2 33
+#define ESCHER_ShpInst_BentConnector3 34
+#define ESCHER_ShpInst_CurvedConnector3 38
+#define ESCHER_ShpInst_PictureFrame 75
+#define ESCHER_ShpInst_TextPlainText 136
+#define ESCHER_ShpInst_TextDeflateInflateDeflate 167
+#define ESCHER_ShpInst_TextSlantUp 172
+#define ESCHER_ShpInst_HostControl 201
+#define ESCHER_ShpInst_TextBox 202
+#define ESCHER_ShpInst_COUNT 203
+#define ESCHER_ShpInst_Max 0x0FFF
+#define ESCHER_ShpInst_Nil ESCHER_ShpInst_Max
+
+enum ESCHER_BlibType
+{ // GEL provided types...
+ ERROR = 0, // An error occurred during loading
+ UNKNOWN, // An unknown blip type
+ EMF, // Windows Enhanced Metafile
+ WMF, // Windows Metafile
+ PICT, // Macintosh PICT
+ PEG, // JFIF
+ PNG, // PNG
+ DIB, // Windows DIB
+ FirstClient = 32, // First client defined blip type
+ LastClient = 255 // Last client defined blip type
+};
+
+
+enum ESCHER_FillStyle
+{
+ ESCHER_FillSolid, // Fill with a solid color
+ ESCHER_FillPattern, // Fill with a pattern (bitmap)
+ ESCHER_FillTexture, // A texture (pattern with its own color map)
+ ESCHER_FillPicture, // Center a picture in the shape
+ ESCHER_FillShade, // Shade from start to end points
+ ESCHER_FillShadeCenter, // Shade from bounding rectangle to end point
+ ESCHER_FillShadeShape, // Shade from shape outline to end point
+ ESCHER_FillShadeScale,
+ ESCHER_FillShadeTitle,
+ ESCHER_FillBackground
+};
+
+enum ESCHER_wMode
+{
+ ESCHER_wColor, // only used for predefined shades
+ ESCHER_wAutomatic, // depends on object type
+ ESCHER_wGrayScale, // shades of gray only
+ ESCHER_wLightGrayScale, // shades of light gray only
+ ESCHER_wInverseGray, // dark gray mapped to light gray, etc.
+ ESCHER_wGrayOutline, // pure gray and white
+ ESCHER_wBlackTextLine, // black text and lines, all else grayscale
+ ESCHER_wHighContrast, // pure black and white mode (no grays)
+ ESCHER_wBlack, // solid black msobwWhite, // solid white
+ ESCHER_wDontShow, // object not drawn
+ ESCHER_wNumModes // number of Black and white modes
+};
+
+
+enum ESCHER_ShapePath
+{
+ ESCHER_ShapeLines, // A line of straight segments
+ ESCHER_ShapeLinesClosed, // A closed polygonal object
+ ESCHER_ShapeCurves, // A line of Bezier curve segments
+ ESCHER_ShapeCurvesClosed, // A closed shape with curved edges
+ ESCHER_ShapeComplex // pSegmentInfo must be non-empty
+};
+
+
+enum ESCHER_WrapMode
+{
+ ESCHER_WrapSquare,
+ ESCHER_WrapByPoints,
+ ESCHER_WrapNone,
+ ESCHER_WrapTopBottom,
+ ESCHER_WrapThrough
+};
+
+
+enum ESCHER_bwMode
+{
+ ESCHER_bwColor, // only used for predefined shades
+ ESCHER_bwAutomatic, // depends on object type
+ ESCHER_bwGrayScale, // shades of gray only
+ ESCHER_bwLightGrayScale, // shades of light gray only
+ ESCHER_bwInverseGray, // dark gray mapped to light gray, etc.
+ ESCHER_bwGrayOutline, // pure gray and white
+ ESCHER_bwBlackTextLine, // black text and lines, all else grayscale
+ ESCHER_bwHighContrast, // pure black and white mode (no grays)
+ ESCHER_bwBlack, // solid black
+ ESCHER_bwWhite, // solid white
+ ESCHER_bwDontShow, // object not drawn
+ ESCHER_bwNumModes // number of Black and white modes
+};
+
+
+enum ESCHER_AnchorText
+{
+ ESCHER_AnchorTop,
+ ESCHER_AnchorMiddle,
+ ESCHER_AnchorBottom,
+ ESCHER_AnchorTopCentered,
+ ESCHER_AnchorMiddleCentered,
+ ESCHER_AnchorBottomCentered,
+ ESCHER_AnchorTopBaseline,
+ ESCHER_AnchorBottomBaseline,
+ ESCHER_AnchorTopCenteredBaseline,
+ ESCHER_AnchorBottomCenteredBaseline
+};
+
+// connector style
+enum ESCHER_cxSTYLE
+{
+ ESCHER_cxstyleStraight = 0,
+ ESCHER_cxstyleBent,
+ ESCHER_cxstyleCurved,
+ ESCHER_cxstyleNone
+};
+
+// text flow
+enum ESCHER_txfl
+{
+ ESCHER_txflHorzN, // Horizontal non-@
+ ESCHER_txflTtoBA, // Top to Bottom @-font
+ ESCHER_txflBtoT, // Bottom to Top non-@
+ ESCHER_txflTtoBN, // Top to Bottom non-@
+ ESCHER_txflHorzA, // Horizontal @-font
+ ESCHER_txflVertN // Vertical, non-@
+};
+
+
+// flags for pictures
+enum ESCHER_BlipFlags
+{
+ ESCHER_BlipFlagDefault = 0,
+ ESCHER_BlipFlagComment = 0, // Blip name is a comment
+ ESCHER_BlipFlagFile, // Blip name is a file name
+ ESCHER_BlipFlagURL, // Blip name is a full URL
+ ESCHER_BlipFlagType = 3, // Mask to extract type
+ /* Or the following flags with any of the above. */
+ ESCHER_BlipFlagDoNotSave = 4,
+ ESCHER_BlipFlagLinkToFile = 8
+};
+
+// dashed line style
+enum ESCHER_LineDashing
+{
+ ESCHER_LineSolid, // Solid (continuous) pen
+ ESCHER_LineDashSys, // PS_DASH system dash style
+ ESCHER_LineDotSys, // PS_DOT system dash style
+ ESCHER_LineDashDotSys, // PS_DASHDOT system dash style
+ ESCHER_LineDashDotDotSys, // PS_DASHDOTDOT system dash style
+ ESCHER_LineDotGEL, // square dot style
+ ESCHER_LineDashGEL, // dash style
+ ESCHER_LineLongDashGEL, // long dash style
+ ESCHER_LineDashDotGEL, // dash short dash
+ ESCHER_LineLongDashDotGEL, // long dash short dash
+ ESCHER_LineLongDashDotDotGEL // long dash short dash short dash
+};
+
+// line end effect
+enum ESCHER_LineEnd
+{
+ ESCHER_LineNoEnd,
+ ESCHER_LineArrowEnd,
+ ESCHER_LineArrowStealthEnd,
+ ESCHER_LineArrowDiamondEnd,
+ ESCHER_LineArrowOvalEnd,
+ ESCHER_LineArrowOpenEnd
+};
+
+// size of arrowhead
+enum ESCHER_LineWidth
+{
+ ESCHER_LineNarrowArrow,
+ ESCHER_LineMediumWidthArrow,
+ ESCHER_LineWideArrow
+};
+
+// size of arrowhead
+enum ESCHER_LineEndLength
+{
+ ESCHER_LineShortArrow,
+ ESCHER_LineMediumLenArrow,
+ ESCHER_LineLongArrow
+};
+
+// line join style.
+enum ESCHER_LineJoin
+{
+ ESCHER_LineJoinBevel, // Join edges by a straight line
+ ESCHER_LineJoinMiter, // Extend edges until they join
+ ESCHER_LineJoinRound // Draw an arc between the two edges
+};
+
+// line cap style (applies to ends of dash segments too).
+enum ESCHER_LineCap
+{
+ ESCHER_LineEndCapRound, // Rounded ends - the default
+ ESCHER_LineEndCapSquare, // Square protrudes by half line width
+ ESCHER_LineEndCapFlat // Line ends at end point
+};
+
+enum MSOPATHTYPE
+{
+ msopathLineTo, // Draw a straight line (one point)
+ msopathCurveTo, // Draw a cubic Bezier curve (three points)
+ msopathMoveTo, // Move to a new point (one point)
+ msopathClose, // Close a sub - path (no points)
+ msopathEnd, // End a path (no points)
+ msopathEscape, // Escape code
+ msopathClientEscape, // Escape code interpreted by the client
+ msopathInvalid // Invalid - should never be found
+};
+
+// Shape Properties
+// 1pt = 12700 EMU (English Metric Units)
+// 1pt = 20 Twip = 20/1440" = 1/72"
+// 1twip=635 EMU
+// 1" = 12700*72 = 914400 EMU
+// 1" = 25.4mm
+// 1mm = 36000 EMU
+// Transform
+#define ESCHER_Prop_Rotation 4 /* Fixed Point 16.16 degrees */
+// Protection
+#define ESCHER_Prop_LockAgainstGrouping 127 /* bool Do not group this shape */
+// Text
+#define ESCHER_Prop_lTxid 128 /* LONG id for the text, value determined by the host */
+#define ESCHER_Prop_dxTextLeft 129 /* LONG margins relative to shape's inscribed */
+#define ESCHER_Prop_dyTextTop 130 /* LONG text rectangle (in EMUs) */
+#define ESCHER_Prop_dxTextRight 131 /* LONG */
+#define ESCHER_Prop_dyTextBottom 132 /* LONG */
+#define ESCHER_Prop_WrapText 133 /* MSOWRAPMODE Wrap text at shape margins */
+#define ESCHER_Prop_AnchorText 135 /* ESCHER_AnchorText How to anchor the text */
+#define ESCHER_Prop_txflTextFlow 136 /* MSOTXFL Text flow */
+#define ESCHER_Prop_hspNext 138 /* MSOHSP ID of the next shape (used by Word for linked textboxes) */
+#define ESCHER_Prop_FitTextToShape 191 /* bool Size text to fit shape size */
+// GeoText
+#define ESCHER_Prop_gtextUNICODE 192 /* WCHAR* UNICODE text string */
+#define ESCHER_Prop_gtextSize 195 /* LONG default point size */
+#define ESCHER_Prop_gtextFont 197 /* WCHAR* font family name */
+// Blip
+#define ESCHER_Prop_cropFromTop 256 /* LONG 16.16 fraction times total */
+#define ESCHER_Prop_cropFromBottom 257 /* LONG image width or height, */
+#define ESCHER_Prop_cropFromLeft 258 /* LONG as appropriate. */
+#define ESCHER_Prop_cropFromRight 259 /* LONG */
+#define ESCHER_Prop_pib 260 /* IMsoBlip* Blip to display */
+#define ESCHER_Prop_pibName 261 /* WCHAR* Blip file name */
+#define ESCHER_Prop_pibFlags 262 /* MSOBLIPFLAGS Blip flags */
+#define ESCHER_Prop_pictureContrast 264 /* LONG contrast setting */
+#define ESCHER_Prop_pictureBrightness 265 /* LONG brightness setting */
+#define ESCHER_Prop_pictureId 267 /* LONG Host-defined ID for OLE objects (usually a pointer) */
+#define ESCHER_Prop_pictureActive 319 /* bool Server is active (OLE objects only) */
+// Geometry
+#define ESCHER_Prop_geoLeft 320 /* LONG Defines the G (geometry) coordinate space. */
+#define ESCHER_Prop_geoTop 321 /* LONG */
+#define ESCHER_Prop_geoRight 322 /* LONG */
+#define ESCHER_Prop_geoBottom 323 /* LONG */
+#define ESCHER_Prop_shapePath 324 /* MSOSHAPEPATH */
+#define ESCHER_Prop_pVertices 325 /* IMsoArray An array of points, in G units. */
+#define ESCHER_Prop_pSegmentInfo 326 /* IMsoArray */
+#define ESCHER_Prop_adjustValue 327 /* LONG Adjustment values corresponding to */
+#define ESCHER_Prop_adjust2Value 328 /* LONG the positions of the adjust handles */
+#define ESCHER_Prop_fFillOK 383 /* bool OK to fill the shape through the UI or VBA? */
+// FillStyle
+#define ESCHER_Prop_fillType 384 /* ESCHER_FillStyle Type of fill */
+#define ESCHER_Prop_fillColor 385 /* MSOCLR Foreground color */
+#define ESCHER_Prop_fillOpacity 386 /* LONG Fixed 16.16 */
+#define ESCHER_Prop_fillBackColor 387 /* MSOCLR Background color */
+#define ESCHER_Prop_fillBackOpacity 388 /* LONG Shades only */
+#define ESCHER_Prop_fillBlip 390 /* IMsoBlip* Pattern/texture */
+#define ESCHER_Prop_fillAngle 395 /* LONG Fade angle - degrees in 16.16 */
+#define ESCHER_Prop_fillFocus 396 /* LONG Linear shaded fill focus percent */
+#define ESCHER_Prop_fillToLeft 397 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToTop 398 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToRight 399 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToBottom 400 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillRectRight 403 /* LONG define how large the fade is going to be. */
+#define ESCHER_Prop_fillRectBottom 404 /* LONG */
+#define ESCHER_Prop_fNoFillHitTest 447 /* bool Hit test a shape as though filled */
+// LineStyle
+#define ESCHER_Prop_lineColor 448 /* MSOCLR Color of line */
+#define ESCHER_Prop_lineOpacity 449 /* LONG Not implemented */
+#define ESCHER_Prop_lineBackColor 450 /* MSOCLR Background color */
+#define ESCHER_Prop_lineWidth 459 /* LONG A units; 1pt == 12700 EMUs */
+#define ESCHER_Prop_lineStyle 461 /* MSOLINESTYLE Draw parallel lines? */
+#define ESCHER_Prop_lineDashing 462 /* MSOLINEDASHING Can be overridden by: */
+#define ESCHER_Prop_lineStartArrowhead 464 /* MSOLINEEND Arrow at start */
+#define ESCHER_Prop_lineEndArrowhead 465 /* MSOLINEEND Arrow at end */
+#define ESCHER_Prop_lineStartArrowWidth 466 /* MSOLINEENDWIDTH Arrow at start */
+#define ESCHER_Prop_lineStartArrowLength 467 /* MSOLINEENDLENGTH Arrow at end */
+#define ESCHER_Prop_lineEndArrowWidth 468 /* MSOLINEENDWIDTH Arrow at start */
+#define ESCHER_Prop_lineEndArrowLength 469 /* MSOLINEENDLENGTH Arrow at end */
+#define ESCHER_Prop_lineJoinStyle 470 /* MSOLINEJOIN How to join lines */
+#define ESCHER_Prop_lineEndCapStyle 471 /* MSOLINECAP How to end lines */
+#define ESCHER_Prop_fNoLineDrawDash 511 /* bool Draw a dashed line if no line */
+// ShadowStyle
+#define ESCHER_Prop_shadowColor 513 /* MSOCLR Foreground color */
+#define ESCHER_Prop_shadowOpacity 516 /* LONG Fixed 16.16 */
+#define ESCHER_Prop_shadowOffsetX 517 /* LONG Offset shadow */
+#define ESCHER_Prop_shadowOffsetY 518 /* LONG Offset shadow */
+#define ESCHER_Prop_fshadowObscured 575 /* bool Excel5-style shadow */
+// 3D Object
+#define ESCHER_Prop_fc3DLightFace 703 /* bool */
+// Shape
+#define ESCHER_Prop_hspMaster 769 /* MSOHSP master shape */
+#define ESCHER_Prop_cxstyle 771 /* MSOCXSTYLE Type of connector */
+#define ESCHER_Prop_bWMode 772 /* ESCHERwMode Settings for modifications to */
+#define ESCHER_Prop_fBackground 831 /* bool If sal_True, this is the background shape. */
+// GroupShape
+#define ESCHER_Prop_wzName 896 /* WCHAR* Shape Name (present only if explicitly set) */
+#define ESCHER_Prop_wzDescription 897 /* WCHAR* alternate text */
+#define ESCHER_Prop_pihlShape 898 /* IHlink* The hyperlink in the shape. */
+#define ESCHER_Prop_dxWrapDistLeft 900 /* LONG Left wrapping distance from text (Word) */
+#define ESCHER_Prop_dyWrapDistTop 901 /* LONG Top wrapping distance from text (Word) */
+#define ESCHER_Prop_dxWrapDistRight 902 /* LONG Right wrapping distance from text (Word) */
+#define ESCHER_Prop_dyWrapDistBottom 903 /* LONG Bottom wrapping distance from text (Word) */
+#define ESCHER_Prop_tableProperties 927
+#define ESCHER_Prop_tableRowProperties 928
+#define ESCHER_Prop_fHidden 958 /* bool Do not display */
+#define ESCHER_Prop_fPrint 959 /* bool Print this shape */
+
+
+#define ESCHER_Persist_PrivateEntry 0x80000000
+#define ESCHER_Persist_Dgg 0x00010000
+#define ESCHER_Persist_Dg 0x00020000
+#define ESCHER_Persist_CurrentPosition 0x00040000
+#define ESCHER_Persist_Grouping_Snap 0x00050000
+#define ESCHER_Persist_Grouping_Logic 0x00060000
+
+const sal_uInt32 DFF_DGG_CLUSTER_SIZE = 0x00000400; /// Shape IDs per cluster in DGG atom.
+
+namespace com::sun::star {
+ namespace awt {
+ struct Gradient;
+ }
+ namespace drawing {
+ struct EnhancedCustomShapeAdjustmentValue;
+ class XShape;
+ class XShapes;
+ }
+}
+
+struct MSFILTER_DLLPUBLIC EscherConnectorListEntry
+{
+ css::uno::Reference< css::drawing::XShape > mXConnector;
+ css::awt::Point maPointA;
+ css::uno::Reference< css::drawing::XShape > mXConnectToA;
+ css::awt::Point maPointB;
+ css::uno::Reference< css::drawing::XShape > mXConnectToB;
+
+ sal_uInt32 GetConnectorRule( bool bFirst );
+
+ EscherConnectorListEntry( css::uno::Reference< css::drawing::XShape > xC,
+ const css::awt::Point& rPA,
+ css::uno::Reference< css::drawing::XShape > xSA ,
+ const css::awt::Point& rPB,
+ css::uno::Reference< css::drawing::XShape > xSB ) :
+ mXConnector (std::move( xC )),
+ maPointA ( rPA ),
+ mXConnectToA(std::move( xSA )),
+ maPointB ( rPB ),
+ mXConnectToB(std::move( xSB )) {}
+
+ static sal_uInt32 GetClosestPoint( const tools::Polygon& rPoly, const css::awt::Point& rP );
+};
+
+struct MSFILTER_DLLPUBLIC EscherExContainer
+{
+ sal_uInt32 nContPos;
+ SvStream& rStrm;
+
+ EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0 );
+ ~EscherExContainer();
+};
+
+struct MSFILTER_DLLPUBLIC EscherExAtom
+{
+ sal_uInt32 nContPos;
+ SvStream& rStrm;
+
+ EscherExAtom( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0, const sal_uInt8 nVersion = 0 );
+ ~EscherExAtom();
+};
+
+struct EscherPropertyValueHelper
+{
+ static bool GetPropertyValue(
+ css::uno::Any& rAny,
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ const OUString& rPropertyName,
+ bool bTestPropertyAvailability = false
+ );
+
+ static css::beans::PropertyState GetPropertyState(
+ const css::uno::Reference < css::beans::XPropertySet > &,
+ const OUString& rPropertyName
+ );
+};
+
+
+struct EscherPersistEntry
+{
+ sal_uInt32 mnID;
+ sal_uInt32 mnOffset;
+
+ EscherPersistEntry( sal_uInt32 nId, sal_uInt32 nOffset ) { mnID = nId; mnOffset = nOffset; };
+
+};
+
+
+class EscherBlibEntry
+{
+ friend class EscherGraphicProvider;
+ friend class EscherEx;
+
+ MapMode maPrefMapMode;
+ Size maPrefSize;
+
+ sal_uInt32 mnIdentifier[ 4 ];
+ sal_uInt32 mnPictureOffset; // offset to the graphic in PictureStreams
+ sal_uInt32 mnSize; // size of real graphic
+
+ sal_uInt32 mnRefCount; // !! reference count
+ sal_uInt32 mnSizeExtra; // !! size of preceding header
+
+ ESCHER_BlibType meBlibType;
+
+ bool mbIsEmpty;
+ bool mbIsNativeGraphicPossible;
+
+public:
+
+ EscherBlibEntry(
+ sal_uInt32 nPictureOffset,
+ const GraphicObject& rObj,
+ const OString& rId,
+ const GraphicAttr* pAttr
+ );
+
+ ~EscherBlibEntry();
+
+ void WriteBlibEntry( SvStream& rSt, bool bWritePictureOffset, sal_uInt32 nResize = 0 );
+ bool IsEmpty() const { return mbIsEmpty; };
+
+ bool operator==( const EscherBlibEntry& ) const;
+};
+
+
+enum class EscherGraphicProviderFlags {
+ NONE = 0,
+ UseInstances = 1,
+};
+namespace o3tl {
+ template<> struct typed_flags<EscherGraphicProviderFlags> : is_typed_flags<EscherGraphicProviderFlags, 0x01> {};
+}
+
+class MSFILTER_DLLPUBLIC EscherGraphicProvider
+{
+ EscherGraphicProviderFlags
+ mnFlags;
+ std::vector<std::unique_ptr<EscherBlibEntry>>
+ mvBlibEntrys;
+ OUString maBaseURI;
+
+protected:
+
+ sal_uInt32 ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry );
+
+public:
+
+ sal_uInt32 GetBlibStoreContainerSize( SvStream const * pMergePicStreamBSE = nullptr ) const;
+ void WriteBlibStoreContainer( SvStream& rStrm, SvStream* pMergePicStreamBSE = nullptr );
+ void WriteBlibStoreEntry(SvStream& rStrm, sal_uInt32 nBlipId, sal_uInt32 nResize);
+ sal_uInt32 GetBlibID(
+ SvStream& rPicOutStream,
+ GraphicObject const & pGraphicObject,
+ const css::awt::Rectangle* pVisArea = nullptr,
+ const GraphicAttr* pGrafikAttr = nullptr,
+ const bool ooxmlExport = false
+ );
+ bool HasGraphics() const { return !mvBlibEntrys.empty(); };
+
+ void SetNewBlipStreamOffset( sal_Int32 nOffset );
+
+ bool GetPrefSize( const sal_uInt32 nBlibId, Size& rSize, MapMode& rMapMode );
+
+ void SetBaseURI( const OUString& rBaseURI ) { maBaseURI = rBaseURI; };
+ const OUString& GetBaseURI() const { return maBaseURI; };
+
+ EscherGraphicProvider( EscherGraphicProviderFlags nFlags = EscherGraphicProviderFlags::NONE );
+ virtual ~EscherGraphicProvider();
+
+ EscherGraphicProvider& operator=( EscherGraphicProvider const & ) = delete; // MSVC2015 workaround
+ EscherGraphicProvider( EscherGraphicProvider const & ) = delete; // MSVC2015 workaround
+};
+
+struct EscherShapeListEntry;
+
+class MSFILTER_DLLPUBLIC EscherSolverContainer
+{
+ ::std::vector< std::unique_ptr<EscherShapeListEntry> > maShapeList;
+ ::std::vector< std::unique_ptr<EscherConnectorListEntry> > maConnectorList;
+
+public:
+
+ sal_uInt32 GetShapeId(
+ const css::uno::Reference< css::drawing::XShape > & rShape
+ ) const;
+
+ void AddShape(
+ const css::uno::Reference< css::drawing::XShape > &,
+ sal_uInt32 nId
+ );
+
+ void AddConnector(
+ const css::uno::Reference< css::drawing::XShape > &,
+ const css::awt::Point& rA,
+ css::uno::Reference< css::drawing::XShape > const &,
+ const css::awt::Point& rB,
+ css::uno::Reference< css::drawing::XShape > const & rConB
+ );
+
+ void WriteSolver( SvStream& );
+
+ EscherSolverContainer();
+ ~EscherSolverContainer();
+
+ EscherSolverContainer& operator=( EscherSolverContainer const & ) = delete; // MSVC2015 workaround
+ EscherSolverContainer( EscherSolverContainer const & ) = delete; // MSVC2015 workaround
+};
+
+
+#define ESCHER_CREATEPOLYGON_LINE 1
+#define ESCHER_CREATEPOLYGON_POLYLINE 2
+#define ESCHER_CREATEPOLYGON_POLYPOLYGON 4
+
+class SdrObjCustomShape;
+
+struct EscherPropSortStruct
+{
+ std::vector<sal_uInt8> nProp;
+ sal_uInt32 nPropValue;
+ sal_uInt16 nPropId;
+};
+
+typedef std::vector< EscherPropSortStruct > EscherProperties;
+
+class MSFILTER_DLLPUBLIC EscherPropertyContainer
+{
+ EscherGraphicProvider* pGraphicProvider;
+ SvStream* pPicOutStrm;
+ tools::Rectangle* pShapeBoundRect;
+
+ sal_uInt32 nCountCount;
+ sal_uInt32 nCountSize;
+
+ std::vector<EscherPropSortStruct>
+ pSortStruct;
+
+ bool bHasComplexData;
+
+
+ static sal_uInt32 ImplGetColor( const sal_uInt32 rColor, bool bSwap = true );
+ void ImplCreateGraphicAttributes(
+ const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
+ sal_uInt32 nBlibId,
+ bool bCreateCroppingAttributes
+ );
+ bool ImplCreateEmbeddedBmp(GraphicObject const & rGraphicObject);
+
+ SAL_DLLPRIVATE explicit EscherPropertyContainer(
+ EscherGraphicProvider * pGraphProv, SvStream * pPiOutStrm,
+ tools::Rectangle * pBoundRect);
+
+public:
+
+ EscherPropertyContainer();
+ EscherPropertyContainer(
+ EscherGraphicProvider& rGraphicProvider, // the PropertyContainer needs to know
+ SvStream* pPicOutStrm, // the GraphicProvider to be able to write
+ tools::Rectangle& rShapeBoundRect // FillBitmaps or GraphicObjects.
+ ); // under some circumstances the ShapeBoundRect
+ // is adjusted this will happen when rotated
+ // GraphicObjects are saved to PowerPoint
+ ~EscherPropertyContainer();
+
+ void AddOpt(
+ sal_uInt16 nPropID,
+ bool bBlib,
+ sal_uInt32 nSizeReduction,
+ SvMemoryStream& rStream);
+
+ void AddOpt(
+ sal_uInt16 nPropertyID,
+ const OUString& rString);
+
+ void AddOpt(
+ sal_uInt16 nPropertyID,
+ sal_uInt32 nPropValue,
+ bool bBlib = false);
+
+ void AddOpt(
+ sal_uInt16 nPropertyID,
+ bool bBlib,
+ sal_uInt32 nPropValue,
+ const std::vector<sal_uInt8>& rProp);
+
+ bool GetOpt( sal_uInt16 nPropertyID, sal_uInt32& rPropValue ) const;
+
+ bool GetOpt( sal_uInt16 nPropertyID, EscherPropSortStruct& rPropValue ) const;
+
+ const EscherProperties & GetOpts() const;
+
+ void Commit( SvStream& rSt, sal_uInt16 nVersion = 3, sal_uInt16 nRecType = ESCHER_OPT );
+
+ void CreateShapeProperties(
+ const css::uno::Reference< css::drawing::XShape > & rXShape
+ );
+ bool CreateOLEGraphicProperties(
+ const css::uno::Reference< css::drawing::XShape > & rXOleObject
+ );
+ bool CreateGraphicProperties(
+ const css::uno::Reference< css::drawing::XShape > & rXShape,
+ const GraphicObject& rGraphicObj
+ );
+ bool CreateMediaGraphicProperties(
+ const css::uno::Reference< css::drawing::XShape > & rXMediaObject
+ );
+
+ /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */
+ void CreateEmbeddedBitmapProperties(
+ css::uno::Reference<css::awt::XBitmap> const & rxBitmap,
+ css::drawing::BitmapMode eBitmapMode
+ );
+ /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */
+ void CreateEmbeddedHatchProperties(
+ const css::drawing::Hatch& rHatch,
+ const Color& rBackColor,
+ bool bFillBackground
+ );
+
+ // the GraphicProperties will only be created if a GraphicProvider and PicOutStrm is known
+ // DR: #99897# if no GraphicProvider is present, a complex ESCHER_Prop_fillBlip
+ // will be created, containing the BLIP directly (e.g. for Excel charts).
+ bool CreateGraphicProperties(
+ const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
+ const OUString& rSource,
+ const bool bCreateFillBitmap,
+ const bool bCreateCroppingAttributes = false,
+ const bool bFillBitmapModeAllowed = true,
+ const bool bOOxmlExport = false
+ );
+
+ bool CreateBlipPropertiesforOLEControl( const css::uno::Reference< css::beans::XPropertySet > & rXPropSet, const css::uno::Reference< css::drawing::XShape > & rXShape);
+
+ bool CreatePolygonProperties(
+ const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
+ sal_uInt32 nFlags,
+ bool bBezier,
+ css::awt::Rectangle& rGeoRect,
+ tools::Polygon const * pPolygon = nullptr
+ );
+
+ static sal_uInt32 GetGradientColor(
+ const css::awt::Gradient* pGradient,
+ sal_uInt32 nStartColor
+ );
+
+ void CreateGradientProperties( const css::awt::Gradient & rGradient );
+ void CreateGradientProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ bool bTransparentGradient = false
+ );
+
+ void CreateLineProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ bool bEdge
+ );
+ void CreateFillProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ bool bEdge,
+ bool bTransparentGradient = false );
+ void CreateFillProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ bool bEdge,
+ const css::uno::Reference< css::drawing::XShape > & rXShape );
+ void CreateTextProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ sal_uInt32 nText,
+ const bool bIsCustomShape = false,
+ const bool bIsTextFrame = true
+ );
+
+ bool CreateConnectorProperties(
+ const css::uno::Reference< css::drawing::XShape > & rXShape,
+ EscherSolverContainer& rSolver,
+ css::awt::Rectangle& rGeoRect,
+ sal_uInt16& rShapeType,
+ ShapeFlag& rShapeFlags
+ );
+
+ // Because shadow properties depends to the line and fillstyle, the CreateShadowProperties method should be called at last.
+ // It's active only when at least a FillStyle or LineStyle is set.
+ void CreateShadowProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &
+ );
+
+ sal_Int32 GetValueForEnhancedCustomShapeParameter( const css::drawing::EnhancedCustomShapeParameter& rParameter,
+ const std::vector< sal_Int32 >& rEquationOrder, bool bAdjustTrans = false );
+ // creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties
+ void CreateCustomShapeProperties(
+ const MSO_SPT eShapeType,
+ const css::uno::Reference< css::drawing::XShape > &
+ );
+ bool IsFontWork() const;
+
+ // helper functions which are also used by the escher import
+ static tools::PolyPolygon GetPolyPolygon(
+ const css::uno::Reference< css::drawing::XShape > & rXShape
+ );
+ static tools::PolyPolygon GetPolyPolygon( const css::uno::Any& rSource );
+ static MSO_SPT GetCustomShapeType(
+ const css::uno::Reference< css::drawing::XShape > & rXShape,
+ ShapeFlag& nMirrorFlags,
+ OUString& rShapeType,
+ bool bOOXML = false
+ );
+
+ // helper functions which are also used in ooxml export
+ static bool GetLineArrow(
+ const bool bLineStart,
+ const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
+ ESCHER_LineEnd& reLineEnd,
+ sal_Int32& rnArrowLength,
+ sal_Int32& rnArrowWidth
+ );
+
+ static bool IsDefaultObject(
+ const SdrObjCustomShape& rSdrObjCustomShape,
+ const MSO_SPT eShapeType);
+
+ static void LookForPolarHandles(
+ const MSO_SPT eShapeType,
+ sal_Int32& nAdjustmentsWhichNeedsToBeConverted
+ );
+ static bool GetAdjustmentValue( const css::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue );
+};
+
+
+class MSFILTER_DLLPUBLIC EscherPersistTable
+{
+
+public:
+ ::std::vector< std::unique_ptr<EscherPersistEntry> > maPersistTable;
+
+ bool PtIsID( sal_uInt32 nID );
+ void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs );
+ void PtDelete( sal_uInt32 nID );
+ sal_uInt32 PtGetOffsetByID( sal_uInt32 nID );
+ void PtReplace( sal_uInt32 nID, sal_uInt32 nOfs );
+ void PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs );
+
+ EscherPersistTable();
+ virtual ~EscherPersistTable();
+
+ EscherPersistTable& operator=( EscherPersistTable const & ) = delete; // MSVC2015 workaround
+ EscherPersistTable( EscherPersistTable const & ) = delete; // MSVC2015 workaround
+};
+
+
+class EscherEx;
+
+/// abstract base class for ESCHER_ClientTextbox, ESCHER_ClientData
+class MSFILTER_DLLPUBLIC EscherExClientRecord_Base
+{
+public:
+ virtual ~EscherExClientRecord_Base();
+
+ /// Application writes the record header
+ /// using rEx.AddAtom(...) followed by
+ /// record data written to rEx.GetStream()
+ virtual void WriteData( EscherEx& rEx ) const = 0;
+};
+
+
+/// abstract base class for ESCHER_ClientAnchor
+class MSFILTER_DLLPUBLIC EscherExClientAnchor_Base
+{
+public:
+ virtual ~EscherExClientAnchor_Base();
+
+ /// Application writes the record header
+ /// using rEx.AddAtom(...) followed by
+ /// record data written to rEx.GetStream()
+ virtual void WriteData( EscherEx& rEx,
+ const tools::Rectangle& rRect ) = 0;
+};
+
+class InteractionInfo
+{
+ std::unique_ptr<SvMemoryStream> mpHyperlinkRecord;
+
+public:
+ InteractionInfo( SvMemoryStream* pStream )
+ {
+ mpHyperlinkRecord.reset( pStream );
+ }
+ const std::unique_ptr< SvMemoryStream >& getHyperlinkRecord() const { return mpHyperlinkRecord; }
+};
+
+class EscherExHostAppData
+{
+private:
+ EscherExClientAnchor_Base* pClientAnchor;
+ EscherExClientRecord_Base* pClientData;
+ EscherExClientRecord_Base* pClientTextbox;
+ InteractionInfo* pInteractionInfo;
+ // ignore single shape if entire pages are written
+ bool bDontWriteShape;
+
+public:
+ EscherExHostAppData() : pClientAnchor(nullptr), pClientData(nullptr),
+ pClientTextbox(nullptr), pInteractionInfo(nullptr), bDontWriteShape(false)
+ {}
+
+ void SetInteractionInfo( InteractionInfo* p )
+ { pInteractionInfo = p; }
+ void SetClientAnchor( EscherExClientAnchor_Base* p )
+ { pClientAnchor = p; }
+ void SetClientData( EscherExClientRecord_Base* p )
+ { pClientData = p; }
+ void SetClientTextbox( EscherExClientRecord_Base* p )
+ { pClientTextbox = p; }
+ void SetDontWriteShape( bool b )
+ { bDontWriteShape = b; }
+ InteractionInfo* GetInteractionInfo() const
+ { return pInteractionInfo; }
+ EscherExClientAnchor_Base* GetClientAnchor() const
+ { return pClientAnchor; }
+ EscherExClientRecord_Base* GetClientTextbox() const
+ { return pClientTextbox; }
+
+ void WriteClientAnchor( EscherEx& rEx, const tools::Rectangle& rRect )
+ { if( pClientAnchor ) pClientAnchor->WriteData( rEx, rRect ); }
+ void WriteClientData( EscherEx& rEx )
+ { if( pClientData ) pClientData->WriteData( rEx ); }
+ void WriteClientTextbox( EscherEx& rEx )
+ { if( pClientTextbox ) pClientTextbox->WriteData( rEx ); }
+
+ bool DontWriteShape() const { return bDontWriteShape; }
+};
+
+
+/** Instance for global DFF data, shared through various instances of EscherEx. */
+class MSFILTER_DLLPUBLIC EscherExGlobal : public EscherGraphicProvider
+{
+public:
+ explicit EscherExGlobal();
+ virtual ~EscherExGlobal() override;
+
+ /** Returns a new drawing ID for a new drawing container (DGCONTAINER). */
+ sal_uInt32 GenerateDrawingId();
+ /** Creates and returns a new shape identifier, updates the internal shape
+ counters and registers the identifier in the DGG cluster table.
+ @param nDrawingId Drawing identifier has to be passed to be able to
+ generate shape identifiers for multiple drawings simultaneously. */
+ sal_uInt32 GenerateShapeId( sal_uInt32 nDrawingId, bool bIsInSpgr );
+ /** Returns the number of shapes in the current drawing, based on number of
+ calls to the GenerateShapeId() function. */
+ sal_uInt32 GetDrawingShapeCount( sal_uInt32 nDrawingId ) const;
+ /** Returns the last shape identifier generated by the GenerateShapeId()
+ function. */
+ sal_uInt32 GetLastShapeId( sal_uInt32 nDrawingId ) const;
+
+ /** Sets the flag indicating that the DGGCONTAINER exists. */
+ void SetDggContainer() { mbHasDggCont = true; }
+ /** Sets the flag indicating that the DGGCONTAINER exists. */
+ bool HasDggContainer() const { return mbHasDggCont; }
+ /** Returns the total size of the DGG atom (including header). */
+ sal_uInt32 GetDggAtomSize() const;
+ /** Writes the complete DGG atom to the passed stream (overwrites existing data!). */
+ void WriteDggAtom( SvStream& rStrm ) const;
+
+ /** Called if a picture shall be written and no picture stream is set at
+ class ImplEESdrWriter.
+
+ On first invocation, this function calls the virtual member function
+ ImplQueryPictureStream(). The return value will be cached internally
+ for subsequent calls and for the GetPictureStream() function.
+ */
+ SvStream* QueryPictureStream();
+
+ /** Returns the picture stream if existing (queried), otherwise null. */
+ SvStream* GetPictureStream() { return mpPicStrm; }
+
+private:
+ /** Derived classes may implement to create a new stream used to store the
+ picture data.
+
+ The implementation has to take care about lifetime of the returned
+ stream (it will not be destructed automatically). This function is
+ called exactly once. The return value will be cached internally for
+ repeated calls of the public QueryPictureStream() function.
+ */
+ virtual SvStream* ImplQueryPictureStream();
+
+private:
+ struct ClusterEntry
+ {
+ sal_uInt32 mnDrawingId; /// Identifier of drawing this cluster belongs to (one-based index into maDrawingInfos).
+ sal_uInt32 mnNextShapeId; /// Next free shape identifier in this cluster.
+ explicit ClusterEntry( sal_uInt32 nDrawingId ) : mnDrawingId( nDrawingId ), mnNextShapeId( 0 ) {}
+ };
+
+ struct DrawingInfo
+ {
+ sal_uInt32 mnClusterId; /// Currently used cluster (one-based index into maClusterTable).
+ sal_uInt32 mnShapeCount; /// Current number of shapes in this drawing.
+ sal_uInt32 mnLastShapeId; /// Last shape identifier generated for this drawing.
+ explicit DrawingInfo( sal_uInt32 nClusterId ) : mnClusterId( nClusterId ), mnShapeCount( 0 ), mnLastShapeId( 0 ) {}
+ };
+ typedef ::std::vector< DrawingInfo > DrawingInfoVector;
+
+ std::vector< ClusterEntry > maClusterTable; /// List with cluster IDs (used object IDs in drawings).
+ DrawingInfoVector maDrawingInfos; /// Data about all used drawings.
+ SvStream* mpPicStrm; /// Cached result of ImplQueryPictureStream().
+ bool mbHasDggCont; /// True = the DGGCONTAINER has been initialized.
+ bool mbPicStrmQueried; /// True = ImplQueryPictureStream() has been called.
+};
+
+class SdrObject;
+class SdrPage;
+class ImplEESdrWriter;
+
+class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable
+{
+ protected:
+ std::shared_ptr<EscherExGlobal> mxGlobal;
+ ::std::unique_ptr< ImplEESdrWriter > mpImplEESdrWriter;
+ SvStream* mpOutStrm;
+ bool mbOwnsStrm;
+ sal_uInt32 mnStrmStartOfs;
+ std::vector< sal_uInt32 > mOffsets;
+ std::vector< sal_uInt16 > mRecTypes;
+
+ sal_uInt32 mnCurrentDg;
+ sal_uInt32 mnCountOfs;
+
+ sal_uInt32 mnGroupLevel;
+ SdrLayerID mnHellLayerId;
+
+ bool mbEscherSpgr;
+ bool mbEscherDg;
+ bool mbOOXML;
+ OUString mEditAs;
+
+
+ bool DoSeek( sal_uInt32 nKey );
+
+public:
+ explicit EscherEx( std::shared_ptr<EscherExGlobal> xGlobal, SvStream* pOutStrm, bool bOOXML = false );
+ virtual ~EscherEx() override;
+
+ /** Creates and returns a new shape identifier, updates the internal shape
+ counters and registers the identifier in the DGG cluster table. */
+ virtual sal_uInt32 GenerateShapeId() { return mxGlobal->GenerateShapeId( mnCurrentDg, mbEscherSpgr ); }
+
+ /** Returns the graphic provider from the global object that has been
+ passed to the constructor.
+ */
+ EscherGraphicProvider& GetGraphicProvider() { return *mxGlobal; }
+
+ /** Called if a picture shall be written and no picture stream is set at
+ class ImplEESdrWriter.
+ */
+ SvStream* QueryPictureStream() { return mxGlobal->QueryPictureStream(); }
+
+ /// Inserts internal data into the EscherStream, this process
+ /// may and has to be executed only once
+ /// If pPicStreamMergeBSE is known, the BLIPs from this stream are being
+ /// merged into the MsofbtBSE Records of the EscherStream like it's
+ /// required for Excel (and maybe Word?)
+ void Flush( SvStream* pPicStreamMergeBSE = nullptr );
+
+ /** Inserts the passed number of bytes at the current position of the
+ output stream.
+
+ Inserts dummy bytes and moves all following stream data, and updates
+ all internal stream offsets stored in the PersistTable and the affected
+ container sizes, which makes this operation very expensive. (!)
+
+ @param nBytes The number of bytes to be inserted into the stream.
+
+ An atom that currently ends
+ exactly at the current stream position will not be expanded to
+ include the inserted data (used to insert e.g. a new atom after an
+ existing atom). Note that containers that end exactly at the
+ current stream position are always expanded to include the inserted
+ data.
+ */
+ void InsertAtCurrentPos( sal_uInt32 nBytes );
+
+ void InsertPersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); // It is not being checked if this key is already in the PersistantTable
+ void ReplacePersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset );
+ sal_uInt32 GetPersistOffset( sal_uInt32 nKey );
+ bool SeekToPersistOffset( sal_uInt32 nKey );
+ void InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue ); // nValue is being inserted into the Stream where it's appropriate (overwrite mode), without that the
+ // current StreamPosition changes
+ void SetEditAs( const OUString& rEditAs );
+ const OUString& GetEditAs() const { return mEditAs; }
+ SvStream& GetStream() const { return *mpOutStrm; }
+ sal_uInt64 GetStreamPos() const { return mpOutStrm->Tell(); }
+
+ // features during the creation of the following Containers:
+
+ // ESCHER_DggContainer: an EscherDgg Atom is automatically being created and managed
+ // ESCHER_DgContainer: an EscherDg Atom is automatically being created and managed
+ // ESCHER_SpgrContainer:
+ // ESCHER_SpContainer:
+
+ virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
+ virtual void CloseContainer();
+
+ void BeginAtom();
+ void EndAtom( sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
+ void AddAtom( sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
+ void AddChildAnchor( const tools::Rectangle& rRectangle );
+ void AddClientAnchor( const tools::Rectangle& rRectangle );
+
+ virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const tools::Rectangle* pBoundRect );
+ sal_uInt32 EnterGroup( const tools::Rectangle* pBoundRect = nullptr );
+ sal_uInt32 GetGroupLevel() const { return mnGroupLevel; };
+ void SetGroupSnapRect( sal_uInt32 nGroupLevel, const tools::Rectangle& rRect );
+ void SetGroupLogicRect( sal_uInt32 nGroupLevel, const tools::Rectangle& rRect );
+ virtual void LeaveGroup();
+
+ // a ESCHER_Sp is being written ( a ESCHER_DgContainer has to be opened for this purpose!)
+ virtual void AddShape( sal_uInt32 nShpInstance, ShapeFlag nFlagIds, sal_uInt32 nShapeID = 0 );
+
+ virtual void Commit( EscherPropertyContainer& rProps, const tools::Rectangle& rRect);
+
+ static sal_uInt32 GetColor( const sal_uInt32 nColor );
+ static sal_uInt32 GetColor( const Color& rColor );
+
+ // ...Sdr... implemented in eschesdo.cxx
+
+ void AddSdrPage( const SdrPage& rPage, bool ooxmlExport = false );
+ void AddUnoShapes( const css::uno::Reference< css::drawing::XShapes >& rxShapes, bool ooxmlExport = false );
+
+ /// returns the ShapeID
+ sal_uInt32 AddSdrObject( const SdrObject& rObj, bool ooxmlExport = false );
+ virtual void AddSdrObjectVMLObject( const SdrObject& /*rObj*/)
+ {
+ // Required for Exporting VML shape
+ }
+
+ /// If objects are written through AddSdrObject the
+ /// SolverContainer has to be written, and maybe some
+ /// maintenance to be done.
+ void EndSdrObjectPage();
+
+ /// Called before a shape is written, application supplies
+ /// ClientRecords. May set AppData::bDontWriteShape so the
+ /// shape is ignored.
+ virtual EscherExHostAppData* StartShape(
+ const css::uno::Reference< css::drawing::XShape >& rShape,
+ const tools::Rectangle* pChildAnchor );
+
+ /// Called after a shape is written to inform the application
+ /// of the resulted shape type and ID.
+ virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID );
+
+ /// Called before an AdditionalText EnterGroup occurs.
+ /// The current shape will be written in three parts:
+ /// a group shape, the shape itself, and an extra textbox shape.
+ /// The complete flow is:
+ /// StartShape sets HostData1.
+ /// EnterAdditionalTextGroup sets HostData2, App may modify
+ /// HostData1 and keep track of the change.
+ /// The group shape is written with HostData2.
+ /// Another StartShape with the same (!) object sets HostData3.
+ /// The current shape is written with HostData3.
+ /// EndShape is called for the current shape.
+ /// Another StartShape with the same (!) object sets HostData4.
+ /// The textbox shape is written with HostData4.
+ /// EndShape is called for the textbox shape.
+ /// EndShape is called for the group shape, this provides
+ /// the same functionality as an ordinary recursive group.
+ virtual EscherExHostAppData* EnterAdditionalTextGroup();
+
+ /// Called if an ESCHER_Prop_lTxid shall be written
+ virtual sal_uInt32 QueryTextID( const css::uno::Reference< css::drawing::XShape >&, sal_uInt32 nShapeId );
+ // add a dummy rectangle shape into the escher stream
+ sal_uInt32 AddDummyShape();
+
+ static const SdrObject* GetSdrObject( const css::uno::Reference< css::drawing::XShape >& rXShape );
+
+ void SetHellLayerId( SdrLayerID nId ) { mnHellLayerId = nId; }
+ SdrLayerID GetHellLayerId() const { return mnHellLayerId; }
+
+private:
+ EscherEx( const EscherEx& ) = delete;
+ EscherEx& operator=( const EscherEx& ) = delete;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/mscodec.hxx b/include/filter/msfilter/mscodec.hxx
new file mode 100644
index 000000000..90c39a8cc
--- /dev/null
+++ b/include/filter/msfilter/mscodec.hxx
@@ -0,0 +1,499 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_MSCODEC_HXX
+#define INCLUDED_FILTER_MSFILTER_MSCODEC_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/cipher.h>
+#include <rtl/digest.h>
+#include <sal/types.h>
+#include <comphelper/hash.hxx>
+#include <vector>
+
+namespace com::sun::star {
+ namespace beans { struct NamedValue; }
+}
+
+namespace msfilter {
+
+
+/** Encodes and decodes data from protected MSO 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_Xor95
+{
+public:
+ explicit MSCodec_Xor95(int nRotateDistance);
+ virtual ~MSCodec_Xor95();
+
+ /** Initializes the algorithm with the specified password.
+
+ @param pPassData
+ Character array containing the password. Must be zero terminated,
+ which results in a maximum length of 15 characters.
+ */
+ void InitKey( const sal_uInt8 pnPassData[ 16 ] );
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ bool InitCodec( const css::uno::Sequence< css::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ css::uno::Sequence< css::beans::NamedValue > GetEncryptionData();
+
+
+ /** Verifies the validity of the password using the passed key and hash.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nKey
+ Password key value read from the file.
+ @param nHash
+ Password hash value read from the file.
+
+ @return
+ true = Test was successful.
+ */
+ bool VerifyKey( sal_uInt16 nKey, sal_uInt16 nHash ) const;
+
+ /** Reinitializes the codec to start a new memory block.
+
+ Resets the internal key offset to 0.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+ */
+ void InitCipher();
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, std::size_t nBytes )=0;
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of Decode().
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nBytes
+ Number of bytes to be skipped (cipher "seeks" forward).
+ */
+ void Skip( std::size_t nBytes );
+
+protected:
+ sal_uInt8 mpnKey[ 16 ] = {}; /// Encryption key.
+ std::size_t mnOffset; /// Key offset.
+
+private:
+ MSCodec_Xor95( const MSCodec_Xor95& ) = delete;
+ MSCodec_Xor95& operator=( const MSCodec_Xor95& ) = delete;
+
+ sal_uInt16 mnKey; /// Base key from password.
+ sal_uInt16 mnHash; /// Hash value from password.
+ int mnRotateDistance;
+};
+
+/** Encodes and decodes data from protected MSO XLS 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_XorXLS95 final : public MSCodec_Xor95
+{
+public:
+ explicit MSCodec_XorXLS95() : MSCodec_Xor95(2) {}
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, std::size_t nBytes ) override;
+};
+
+/** Encodes and decodes data from protected MSO Word 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_XorWord95 final : public MSCodec_Xor95
+{
+public:
+ explicit MSCodec_XorWord95() : MSCodec_Xor95(7) {}
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, std::size_t nBytes ) override;
+};
+
+class MSFILTER_DLLPUBLIC MSCodec97
+{
+public:
+ MSCodec97(size_t nHashLen, OUString aEncKeyName);
+ virtual ~MSCodec97();
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ bool InitCodec(const css::uno::Sequence< css::beans::NamedValue >& aData);
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ virtual css::uno::Sequence<css::beans::NamedValue> GetEncryptionData();
+
+ /** Initializes the algorithm with the specified password and document ID.
+
+ @param pPassData
+ Wide character array containing the password. Must be zero
+ terminated, which results in a maximum length of 15 characters.
+ @param pDocId
+ Unique document identifier read from or written to the file.
+ */
+ virtual void InitKey(const sal_uInt16 pPassData[16],
+ const sal_uInt8 pDocId[16]) = 0;
+
+
+ /** Verifies the validity of the password using the passed salt data.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pSaltData
+ Salt data block read from the file.
+ @param pSaltDigest
+ Salt digest read from the file.
+
+ @return
+ true = Test was successful.
+ */
+ bool VerifyKey(const sal_uInt8* pSaltData, const sal_uInt8* pSaltDigest);
+
+ virtual void GetDigestFromSalt(const sal_uInt8* pSaltData, sal_uInt8* pDigest) = 0;
+
+ /** Rekeys the codec using the specified counter.
+
+ After reading a specific amount of data the cipher algorithm needs to
+ be rekeyed using a counter that counts the data blocks.
+
+ The block size is for example 512 Bytes for Word files and 1024 Bytes
+ for Excel files.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nCounter
+ Block counter used to rekey the cipher.
+ */
+ virtual bool InitCipher(sal_uInt32 nCounter) = 0;
+
+ /** Encodes a block of memory.
+
+ @see rtl_cipher_encode()
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used. The destination buffer must be able to take all
+ unencoded data from the source buffer (usually this means it must be
+ as long as or longer than the source buffer).
+
+ @param pData
+ Unencrypted source data block.
+ @param nDatLen
+ Size of the passed source data block.
+ @param pBuffer
+ Destination buffer for the encrypted data.
+ @param nBufLen
+ Size of the destination buffer.
+
+ @return
+ true = Encoding was successful (no error occurred).
+ */
+ bool Encode(const void* pData, std::size_t nDatLen,
+ sal_uInt8* pBuffer, std::size_t nBufLen);
+
+ /** Decodes a block of memory.
+
+ @see rtl_cipher_decode()
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used. The destination buffer must be able to take all
+ encoded data from the source buffer (usually this means it must be
+ as long as or longer than the source buffer).
+
+ @param pData
+ Encrypted source data block.
+ @param nDatLen
+ Size of the passed source data block.
+ @param pBuffer
+ Destination buffer for the decrypted data.
+ @param nBufLen
+ Size of the destination buffer.
+
+ @return
+ true = Decoding was successful (no error occurred).
+ */
+ bool Decode(const void* pData, std::size_t nDatLen,
+ sal_uInt8* pBuffer, std::size_t nBufLen);
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of Decode().
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nDatLen
+ Number of bytes to be skipped (cipher "seeks" forward).
+ */
+ bool Skip(std::size_t nDatLen);
+
+ /* allows to get the unique document id from the codec
+ */
+ void GetDocId( sal_uInt8 pDocId[16] );
+
+private:
+ MSCodec97(const MSCodec97&) = delete;
+ MSCodec97& operator=(const MSCodec97&) = delete;
+
+protected:
+ OUString m_sEncKeyName;
+ size_t m_nHashLen;
+ rtlCipher m_hCipher;
+ std::vector<sal_uInt8> m_aDocId;
+ std::vector<sal_uInt8> m_aDigestValue;
+};
+
+/** Encodes and decodes data from protected MSO 97+ documents.
+
+ This is a wrapper class around low level cryptographic functions from RTL.
+ Implementation is based on the wvDecrypt package by Caolan McNamara:
+ http://www.csn.ul.ie/~caolan/docs/wvDecrypt.html
+ */
+class MSFILTER_DLLPUBLIC MSCodec_Std97 final : public MSCodec97
+{
+public:
+ MSCodec_Std97();
+ virtual ~MSCodec_Std97() override;
+
+ /** Initializes the algorithm with the specified password and document ID.
+
+ @param pPassData
+ Wide character array containing the password. Must be zero
+ terminated, which results in a maximum length of 15 characters.
+ @param pDocId
+ Unique document identifier read from or written to the file.
+ */
+ virtual void InitKey(const sal_uInt16 pPassData[16],
+ const sal_uInt8 pDocId[16]) override;
+
+ /** Rekeys the codec using the specified counter.
+
+ After reading a specific amount of data the cipher algorithm needs to
+ be rekeyed using a counter that counts the data blocks.
+
+ The block size is for example 512 Bytes for Word files and 1024 Bytes
+ for Excel files.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nCounter
+ Block counter used to rekey the cipher.
+ */
+ virtual bool InitCipher(sal_uInt32 nCounter) override;
+
+ /** Creates an MD5 digest of salt digest. */
+ void CreateSaltDigest(
+ const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] );
+
+ /** Gets salt data and salt digest.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pSalt
+ Salt, a random number.
+ @param pSaltData
+ Salt data block generated from the salt.
+ @param pSaltDigest
+ Salt digest generated from the salt.
+ */
+ void GetEncryptKey (
+ const sal_uInt8 pSalt[16],
+ sal_uInt8 pSaltData[16],
+ sal_uInt8 pSaltDigest[16]);
+
+ virtual void GetDigestFromSalt(const sal_uInt8* pSaltData, sal_uInt8* pDigest) override;
+
+private:
+ MSCodec_Std97( const MSCodec_Std97& ) = delete;
+ MSCodec_Std97& operator=( const MSCodec_Std97& ) = delete;
+
+ rtlDigest m_hDigest;
+};
+
+class MSFILTER_DLLPUBLIC MSCodec_CryptoAPI final : public MSCodec97
+{
+private:
+ css::uno::Sequence<sal_Int8> m_aStd97Key;
+public:
+ MSCodec_CryptoAPI();
+
+ virtual void InitKey(const sal_uInt16 pPassData[16],
+ const sal_uInt8 pDocId[16]) override;
+ virtual bool InitCipher(sal_uInt32 nCounter) override;
+ virtual void GetDigestFromSalt(const sal_uInt8* pSaltData, sal_uInt8* pDigest) override;
+ virtual css::uno::Sequence<css::beans::NamedValue> GetEncryptionData() override;
+};
+
+const sal_uInt32 ENCRYPTINFO_CRYPTOAPI = 0x00000004;
+const sal_uInt32 ENCRYPTINFO_DOCPROPS = 0x00000008;
+const sal_uInt32 ENCRYPTINFO_EXTERNAL = 0x00000010;
+const sal_uInt32 ENCRYPTINFO_AES = 0x00000020;
+
+const sal_uInt32 ENCRYPT_ALGO_AES128 = 0x0000660E;
+const sal_uInt32 ENCRYPT_ALGO_AES192 = 0x0000660F;
+const sal_uInt32 ENCRYPT_ALGO_AES256 = 0x00006610;
+const sal_uInt32 ENCRYPT_ALGO_RC4 = 0x00006801;
+
+const sal_uInt32 ENCRYPT_HASH_SHA1 = 0x00008004;
+
+const sal_uInt32 ENCRYPT_KEY_SIZE_AES_128 = 0x00000080;
+const sal_uInt32 ENCRYPT_KEY_SIZE_AES_192 = 0x000000C0;
+const sal_uInt32 ENCRYPT_KEY_SIZE_AES_256 = 0x00000100;
+
+const sal_uInt32 ENCRYPT_PROVIDER_TYPE_AES = 0x00000018;
+const sal_uInt32 ENCRYPT_PROVIDER_TYPE_RC4 = 0x00000001;
+
+// version of encryption info used in MS Office 1997 (major = 1, minor = 1)
+const sal_uInt32 VERSION_INFO_1997_FORMAT = 0x00010001;
+// version of encryption info used in MS Office 2007 (major = 3, minor = 2)
+const sal_uInt32 VERSION_INFO_2007_FORMAT = 0x00020003;
+// version of encryption info used in MS Office 2007 SP2 and older (major = 4, minor = 2)
+const sal_uInt32 VERSION_INFO_2007_FORMAT_SP2 = 0x00020004;
+
+// version of encryption info - agile (major = 4, minor = 4)
+const sal_uInt32 VERSION_INFO_AGILE = 0x00040004;
+
+const sal_uInt32 AGILE_ENCRYPTION_RESERVED = 0x00000040;
+
+const sal_uInt32 SALT_LENGTH = 16;
+const sal_uInt32 ENCRYPTED_VERIFIER_LENGTH = 16;
+
+struct MSFILTER_DLLPUBLIC EncryptionStandardHeader
+{
+ sal_uInt32 flags;
+ sal_uInt32 sizeExtra; // 0
+ sal_uInt32 algId; // if flag AES && CRYPTOAPI this defaults to 128-bit AES
+ sal_uInt32 algIdHash; // 0: determine by flags - defaults to SHA-1 if not external
+ sal_uInt32 keyBits; // key size in bits: 0 (determine by flags), 128, 192, 256
+ sal_uInt32 providedType; // AES or RC4
+ sal_uInt32 reserved1; // 0
+ sal_uInt32 reserved2; // 0
+
+ EncryptionStandardHeader();
+};
+
+struct MSFILTER_DLLPUBLIC EncryptionVerifierAES
+{
+ sal_uInt32 saltSize; // must be 0x00000010
+ sal_uInt8 salt[SALT_LENGTH] = {}; // random generated salt value
+ sal_uInt8 encryptedVerifier[ENCRYPTED_VERIFIER_LENGTH] = {}; // randomly generated verifier value
+ sal_uInt32 encryptedVerifierHashSize; // actually written hash size - depends on algorithm
+ sal_uInt8 encryptedVerifierHash[comphelper::SHA256_HASH_LENGTH] = {}; // verifier value hash - itself also encrypted
+
+ EncryptionVerifierAES();
+};
+
+struct MSFILTER_DLLPUBLIC EncryptionVerifierRC4
+{
+ sal_uInt32 saltSize; // must be 0x00000010
+ sal_uInt8 salt[SALT_LENGTH] = {}; // random generated salt value
+ sal_uInt8 encryptedVerifier[ENCRYPTED_VERIFIER_LENGTH] = {}; // randomly generated verifier value
+ sal_uInt32 encryptedVerifierHashSize; // actually written hash size - depends on algorithm
+ sal_uInt8 encryptedVerifierHash[comphelper::SHA1_HASH_LENGTH] = {}; // verifier value hash - itself also encrypted
+
+ EncryptionVerifierRC4();
+};
+
+struct MSFILTER_DLLPUBLIC StandardEncryptionInfo
+{
+ EncryptionStandardHeader header;
+ EncryptionVerifierAES verifier;
+};
+
+struct MSFILTER_DLLPUBLIC RC4EncryptionInfo
+{
+ EncryptionStandardHeader header;
+ EncryptionVerifierRC4 verifier;
+};
+
+} // namespace msfilter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
new file mode 100644
index 000000000..3dfd170bc
--- /dev/null
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -0,0 +1,809 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_MSDFFIMP_HXX
+#define INCLUDED_FILTER_MSFILTER_MSDFFIMP_HXX
+
+#include <cstring>
+#include <map>
+#include <memory>
+#include <optional>
+#include <set>
+#include <utility>
+#include <vector>
+#include <unordered_map>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/stl_types.hxx>
+#include <filter/msfilter/dffpropset.hxx>
+#include <filter/msfilter/dffrecordheader.hxx>
+#include <filter/msfilter/escherex.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svx/msdffdef.hxx>
+#include <vcl/errcode.hxx>
+#include <tools/degree.hxx>
+#include <tools/gen.hxx>
+#include <tools/ref.hxx>
+#include <tools/solar.h>
+#include <tools/poly.hxx>
+#include <vcl/graph.hxx>
+
+class Color;
+class GDIMetaFile;
+class SotStorage;
+class SvStream;
+class SdrObject;
+class SdrOle2Obj;
+class SdrModel;
+class SwFlyFrameFormat;
+
+struct SvxMSDffBLIPInfos;
+struct SvxMSDffShapeInfo;
+struct SvxMSDffShapeOrder;
+
+class SvxMSDffManager;
+class SfxItemSet;
+struct DffObjData;
+class SvGlobalName;
+
+namespace com::sun::star {
+ namespace beans { class XPropertySet; }
+ namespace embed { class XEmbeddedObject; }
+ namespace embed { class XStorage; }
+}
+
+class MSFILTER_DLLPUBLIC SvxMSDffClientData
+{
+public:
+ virtual void NotifyFreeObj(SdrObject* pObj) = 0;
+ virtual ~SvxMSDffClientData() {}
+};
+
+class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet
+{
+ const SvxMSDffManager& rManager;
+ std::unique_ptr<DffPropSet> pDefaultPropSet;
+
+ void ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const;
+ void CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItemSet& rSet, DffObjData const & rObjData ) const;
+ void ApplyCustomShapeGeometryAttributes( SvStream& rIn,
+ SfxItemSet& rSet,
+ const DffObjData& rObjData ) const;
+ void ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eShapeType ) const; // #i28269#
+ void ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const;
+
+public:
+ Degree100 mnFix16Angle;
+ bool mbRotateGranientFillWithAngle;
+
+ explicit DffPropertyReader( const SvxMSDffManager& rManager );
+ ~DffPropertyReader();
+
+ DffPropertyReader& operator=( DffPropertyReader const & ) = delete; // MSVC2015 workaround
+ DffPropertyReader( DffPropertyReader const & ) = delete; // MSVC2015 workaround
+
+ static Degree100 Fix16ToAngle( sal_Int32 nAngle );
+
+#ifdef DBG_CUSTOMSHAPE
+ void ReadPropSet( SvStream& rIn, SvxMSDffClientData* pClientData, sal_uInt32 nShapeType = 0 ) const;
+#else
+ void ReadPropSet( SvStream& rIn, SvxMSDffClientData* pClientData ) const;
+#endif
+
+ void SetDefaultPropSet( SvStream& rIn, sal_uInt32 nOffDgg ) const;
+ void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const;
+ void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObjData const & rObjData ) const;
+ void ImportGradientColor( SfxItemSet& aSet, sal_uInt32 eMSO_FillType, double dTrans, double dBackTrans ) const;
+};
+
+#define COL_DEFAULT ::Color( 0xFA, 0xFB, 0xFC )
+
+typedef ::std::map< sal_Int32, SdrObject* > SvxMSDffShapeIdContainer;
+
+inline constexpr OUStringLiteral SVEXT_PERSIST_STREAM = u"\002OlePres000";
+
+/// the following will be sorted by the order of their appearance:
+typedef std::vector<std::unique_ptr<SvxMSDffShapeOrder>> SvxMSDffShapeOrders;
+
+struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoById
+{
+ bool operator()(std::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+ std::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
+};
+struct CompareSvxMSDffShapeInfoByTxBxComp
+{
+ bool operator()(std::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+ std::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
+};
+
+// the following will be sorted explicitly:
+typedef ::std::set< std::shared_ptr<SvxMSDffShapeInfo>,
+ CompareSvxMSDffShapeInfoById > SvxMSDffShapeInfos_ById;
+typedef ::std::multiset< std::shared_ptr<SvxMSDffShapeInfo>,
+ CompareSvxMSDffShapeInfoByTxBxComp> SvxMSDffShapeInfos_ByTxBxComp;
+
+#define SVXMSDFF_SETTINGS_CROP_BITMAPS 1
+#define SVXMSDFF_SETTINGS_IMPORT_PPT 2
+#define SVXMSDFF_SETTINGS_IMPORT_EXCEL 4
+
+// for the CreateSdrOLEFromStorage we need the information, how we handle
+// convert able OLE-Objects - this is stored in
+#define OLE_MATHTYPE_2_STARMATH 0x0001
+#define OLE_WINWORD_2_STARWRITER 0x0002
+#define OLE_EXCEL_2_STARCALC 0x0004
+#define OLE_POWERPOINT_2_STARIMPRESS 0x0008
+
+struct SvxMSDffConnectorRule
+{
+ sal_uInt32 nShapeA; ///< SPID of shape A
+ sal_uInt32 nShapeB; ///< SPID of shape B
+ sal_uInt32 nShapeC; ///< SPID of connector shape
+ sal_uInt32 ncptiA; ///< Connection site Index of shape A
+ sal_uInt32 ncptiB; ///< Connection site Index of shape B
+ ShapeFlag nSpFlagsA; ///< SpFlags of shape A (the original mirror flags
+ ///< must be known when solving the Solver Container)
+ ShapeFlag nSpFlagsB; ///< SpFlags of shape B
+
+ SdrObject* pAObj; ///< pPtr of object (corresponding to shape A)
+ SdrObject* pBObj; ///< pPtr of object (corresponding to shape B)
+ SdrObject* pCObj; ///< pPtr of connector object
+
+ SvxMSDffConnectorRule()
+ : nShapeA(0)
+ , nShapeB(0)
+ , nShapeC(0)
+ , ncptiA(0)
+ , ncptiB(0)
+ , nSpFlagsA( ShapeFlag::NONE )
+ , nSpFlagsB( ShapeFlag::NONE )
+ , pAObj( nullptr )
+ , pBObj( nullptr )
+ , pCObj( nullptr )
+ {};
+
+};
+
+struct MSFILTER_DLLPUBLIC SvxMSDffSolverContainer
+{
+ ::std::vector< std::unique_ptr<SvxMSDffConnectorRule> > aCList;
+
+ SvxMSDffSolverContainer();
+ ~SvxMSDffSolverContainer();
+
+ SvxMSDffSolverContainer& operator=( SvxMSDffSolverContainer const & ) = delete; // MSVC2015 workaround
+ SvxMSDffSolverContainer( SvxMSDffSolverContainer const & ) = delete; // MSVC2015 workaround
+
+ MSFILTER_DLLPUBLIC friend SvStream& ReadSvxMSDffSolverContainer( SvStream& rIn, SvxMSDffSolverContainer& rAtom );
+};
+
+struct FIDCL
+{
+ sal_uInt32 dgid; ///< DG owning the SPIDs in this cluster
+};
+
+/// provided by SvxMSDffManager for each shape in a group
+struct MSDffTxId
+{
+ sal_uInt16 nTxBxS;
+ sal_uInt16 nSequence;
+ MSDffTxId()
+ : nTxBxS( 0 ), nSequence( 0 ) {}
+ MSDffTxId( const MSDffTxId& rCopy )
+ : nTxBxS( rCopy.nTxBxS ), nSequence( rCopy.nSequence ) {}
+};
+
+struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
+{
+ static const int RELTO_DEFAULT = 2;
+
+ SdrObject* pObj;
+ std::optional<tools::Polygon>
+ pWrapPolygon;
+ std::unique_ptr<char[]>
+ pClientAnchorBuffer;
+ sal_uInt32 nClientAnchorLen;
+ std::unique_ptr<char[]>
+ pClientDataBuffer;
+ sal_uInt32 nClientDataLen;
+ sal_uInt32 nXAlign;
+ std::optional<sal_uInt32> nXRelTo;
+ sal_uInt32 nYAlign;
+ std::optional<sal_uInt32> nYRelTo;
+ sal_uInt32 nGroupShapeBooleanProperties;
+ ShapeFlag nFlags;
+ sal_Int32 nDxTextLeft; ///< distance of text box from surrounding shape
+ sal_Int32 nDyTextTop;
+ sal_Int32 nDxTextRight;
+ sal_Int32 nDyTextBottom;
+ sal_Int32 nDxWrapDistLeft;
+ sal_Int32 nDyWrapDistTop;
+ sal_Int32 nDxWrapDistRight;
+ sal_Int32 nDyWrapDistBottom;
+ sal_Int32 nCropFromTop;
+ sal_Int32 nCropFromBottom;
+ sal_Int32 nCropFromLeft;
+ sal_Int32 nCropFromRight;
+ MSDffTxId aTextId; ///< identifier for text boxes
+ sal_uLong nNextShapeId; ///< for linked text boxes
+ sal_uLong nShapeId;
+ MSO_SPT eShapeType;
+ MSO_LineStyle eLineStyle; ///< border types
+ MSO_LineDashing eLineDashing;
+ bool bDrawHell :1;
+ bool bHidden :1;
+ bool bReplaceByFly :1;
+ bool bVFlip :1;
+ bool bHFlip :1;
+ bool bAutoWidth :1;
+ int relativeHorizontalWidth; ///< in 0.1% or -1 for none
+ bool isHorizontalRule;
+
+ SvxMSDffImportRec();
+ SvxMSDffImportRec(const SvxMSDffImportRec& rCopy);
+ ~SvxMSDffImportRec();
+
+ bool operator<( const SvxMSDffImportRec& rEntry ) const
+ { return nShapeId < rEntry.nShapeId; }
+
+private:
+ SvxMSDffImportRec &operator=(const SvxMSDffImportRec&) = delete;
+};
+
+/** block of parameters for import/export for a single call of
+ ImportObjAtCurrentStreamPos() */
+class MSFILTER_DLLPUBLIC SvxMSDffImportData final : public SvxMSDffClientData
+{
+private:
+ /** list of all SvxMSDffImportRec instances of/for a group */
+ typedef std::set<std::unique_ptr<SvxMSDffImportRec>,
+ comphelper::UniquePtrValueLess<SvxMSDffImportRec>> MSDffImportRecords;
+ MSDffImportRecords m_Records; ///< Shape pointer, Shape ids and private data
+ std::map<const SdrObject*, SvxMSDffImportRec*> m_ObjToRecMap;
+public:
+ tools::Rectangle aParentRect;///< Rectangle of the surrounding groups,
+ ///< which might have been provided externally
+
+ explicit SvxMSDffImportData(const tools::Rectangle& rParentRect);
+ SvxMSDffImportData& operator=( SvxMSDffImportData const & ) = delete; // MSVC2015 workaround
+ SvxMSDffImportData( SvxMSDffImportData const & ) = delete; // MSVC2015 workaround
+ virtual ~SvxMSDffImportData() override;
+ bool empty() const { return m_Records.empty(); }
+ void insert(std::unique_ptr<SvxMSDffImportRec> pImpRec);
+ size_t size() const { return m_Records.size(); }
+ SvxMSDffImportRec* find(const SdrObject* pObj);
+ MSDffImportRecords::const_iterator begin() const { return m_Records.begin(); }
+ MSDffImportRecords::const_iterator end() const { return m_Records.end(); }
+ virtual void NotifyFreeObj(SdrObject* pObj) override;
+};
+
+struct DffObjData
+{
+ const DffRecordHeader& rSpHd;
+
+ tools::Rectangle aBoundRect;
+ tools::Rectangle aChildAnchor;
+
+ sal_uInt32 nShapeId;
+ ShapeFlag nSpFlags;
+ MSO_SPT eShapeType;
+
+ bool bShapeType : 1;
+ bool bClientAnchor : 1;
+ bool bClientData : 1;
+ bool bChildAnchor : 1;
+ bool bOpt : 1;
+ bool bOpt2 : 1;
+ bool bRotateTextWithShape : 1;
+ bool bPageAnchor;
+ int nCalledByGroup;
+
+ DffObjData( const DffRecordHeader& rObjHd,
+ const tools::Rectangle& rBoundRect,
+ int nClByGroup ) :
+ rSpHd( rObjHd ),
+ aBoundRect( rBoundRect ),
+ nShapeId( 0 ),
+ nSpFlags( ShapeFlag::NONE ),
+ eShapeType( mso_sptNil ),
+ bShapeType( false ),
+ bClientAnchor( false ),
+ bClientData( false ),
+ bChildAnchor( false ),
+ bOpt( false ),
+ bOpt2( false ),
+ bRotateTextWithShape( true ),
+ bPageAnchor( true ),
+ nCalledByGroup( nClByGroup ){}
+
+ // Clone a DffObjData _o_ by replacing its rSpHd with a shared_ptr to another one
+ DffObjData( const std::shared_ptr<DffRecordHeader>& rObjHd, const DffObjData& o) :
+ rSpHd( *rObjHd ),
+ aBoundRect( o.aBoundRect ),
+ nShapeId( o.nShapeId ),
+ nSpFlags( o.nSpFlags ),
+ eShapeType( o.eShapeType ),
+ bShapeType( o.bShapeType ),
+ bClientAnchor( o.bClientAnchor ),
+ bClientData( o.bClientData ),
+ bChildAnchor( o.bChildAnchor ),
+ bOpt( o.bOpt ),
+ bOpt2( o.bOpt2 ),
+ bRotateTextWithShape( o.bRotateTextWithShape ),
+ bPageAnchor( o.bPageAnchor ),
+ nCalledByGroup( o.nCalledByGroup ){}
+};
+
+#define DFF_RECORD_MANAGER_BUF_SIZE 64
+
+struct DffRecordList
+{
+ sal_uInt32 nCount;
+ sal_uInt32 nCurrent;
+ DffRecordList* pPrev;
+ std::unique_ptr<DffRecordList>
+ pNext;
+
+ DffRecordHeader mHd[ DFF_RECORD_MANAGER_BUF_SIZE ];
+
+ explicit DffRecordList( DffRecordList* pList );
+ ~DffRecordList();
+};
+
+enum DffSeekToContentMode
+{
+ SEEK_FROM_BEGINNING,
+ SEEK_FROM_CURRENT,
+ SEEK_FROM_CURRENT_AND_RESTART
+};
+
+class MSFILTER_DLLPUBLIC DffRecordManager : public DffRecordList
+{
+public:
+ DffRecordList* pCList;
+
+ void Clear();
+ void Consume( SvStream& rIn,
+ sal_uInt32 nStOfs = 0 );
+
+ bool SeekToContent( SvStream& rIn,
+ sal_uInt16 nRecType,
+ DffSeekToContentMode eMode = SEEK_FROM_BEGINNING );
+ DffRecordHeader* GetRecordHeader( sal_uInt16 nRecType,
+ DffSeekToContentMode eMode = SEEK_FROM_BEGINNING );
+
+ DffRecordManager();
+ explicit DffRecordManager( SvStream& rIn );
+
+ DffRecordHeader* Current();
+ DffRecordHeader* First();
+ DffRecordHeader* Next();
+ DffRecordHeader* Prev();
+ DffRecordHeader* Last();
+};
+
+/** abstract base class for Escher imports
+
+ Purpose: access to objects in Drawing File Format
+
+ Note: The method ProcessUserDefinedRecord() _has_ to be implemented in the
+ inheriting class(es) that is/are eventually used for PowerPoint, Word,
+ or Excel importing.
+
+ Status: Currently only access to BLIPs (will be extended later)
+*/
+class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader
+{
+ std::unique_ptr<SvxMSDffBLIPInfos> m_pBLIPInfos;
+ std::unique_ptr<SvxMSDffShapeInfos_ByTxBxComp> m_xShapeInfosByTxBxComp;
+ std::unique_ptr<SvxMSDffShapeInfos_ById> m_xShapeInfosById;
+ SvxMSDffShapeOrders m_aShapeOrders;
+ sal_uInt32 nOffsDgg;
+ sal_uInt16 nBLIPCount;
+ ShapeFlag nGroupShapeFlags;
+
+ void CheckTxBxStoryChain();
+ void GetFidclData(sal_uInt32 nOffsDgg);
+
+protected:
+ typedef std::map<sal_uInt32, sal_uInt64> OffsetMap;
+
+ OUString maBaseURL;
+ sal_uInt32 mnIdClusters; // while only knowing the shapeid
+ std::vector<FIDCL> maFidcls;
+ OffsetMap maDgOffsetTable; ///< array of fileoffsets
+
+ /** When importing Excel files, cell anchor computations for non-page-anchored
+ groups must be done after all nested groups have been processed; for each open
+ group, the pending data is stored here. The storage also holds a shared_ptr to
+ the DffObjData ow DffRecordHeader to avoid it going out of scope except when needed
+ */
+ std::vector< std::pair<DffObjData, std::shared_ptr<DffRecordHeader> > > maPendingGroupData;
+
+ friend class DffPropertyReader;
+
+ SvStream& rStCtrl;
+ SvStream* pStData;
+ SvStream* pStData2;
+ SdrModel* pSdrModel;
+
+ tools::Long nMapMul;
+ tools::Long nMapDiv;
+ tools::Long nMapXOfs;
+ tools::Long nMapYOfs;
+ tools::Long nEmuMul;
+ tools::Long nEmuDiv;
+ tools::Long nPntMul;
+ tools::Long nPntDiv;
+ bool bNeedMap;
+ sal_uInt32 nSvxMSDffSettings;
+ sal_uInt32 nSvxMSDffOLEConvFlags;
+
+ /** stores a reference to an imported SdrObject
+ with its shape id if it has one */
+ SvxMSDffShapeIdContainer maShapeIdContainer;
+
+ void GetCtrlData(sal_uInt32 nOffsDgg);
+ void GetDrawingGroupContainerData( SvStream& rSt,
+ sal_uInt32 nLenDgg );
+ // Add internal drawing container id as parameter to the sub methods of
+ // reading the control information about the drawing objects.
+ // The drawing container id is used to distinguish the text ids of drawing
+ // objects in different drawing containers.
+ void GetDrawingContainerData( SvStream& rSt,
+ sal_uInt32 nLenDg,
+ sal_uInt16 nDrawingContainerId );
+ bool GetShapeGroupContainerData( SvStream& rSt,
+ sal_uInt32 nLenShapeGroupCont,
+ bool bPatriarch,
+ sal_uInt16 nDrawingContainerId );
+ bool GetShapeContainerData( SvStream& rSt,
+ sal_uInt32 nLenShapeCont,
+ sal_uInt64 nPosGroup,
+ sal_uInt16 nDrawingContainerId );
+
+ SdrObject* ImportGraphic( SvStream&, SfxItemSet&, const DffObjData& );
+ // #i32596# - pass <nCalledByGroup> to method
+ // Needed in Writer's Microsoft Word import to avoid import of OLE objects
+ // inside groups. Instead a graphic object is created.
+ virtual SdrObject* ImportOLE( sal_uInt32 nOLEId,
+ const Graphic& rGraf,
+ const tools::Rectangle& rBoundRect,
+ const tools::Rectangle& rVisArea,
+ const int _nCalledByGroup ) const;
+ static css::uno::Reference < css::embed::XEmbeddedObject > CheckForConvertToSOObj(
+ sal_uInt32 nConvertFlags, SotStorage& rSrcStg,
+ const css::uno::Reference < css::embed::XStorage >& xDestStg,
+ const Graphic& rGrf,
+ const tools::Rectangle& rVisArea,
+ OUString const& rBaseURL);
+
+// the following methods need to be overridden for Excel imports
+ static void ProcessClientAnchor( SvStream& rStData,
+ sal_uInt32 nDatLen,
+ std::unique_ptr<char[]>& rpBuff,
+ sal_uInt32& rBuffLen );
+ virtual void ProcessClientAnchor2( SvStream& rStData,
+ DffRecordHeader& rHd,
+ DffObjData& );
+ static void ProcessClientData( SvStream& rStData,
+ sal_uInt32 nDatLen,
+ std::unique_ptr<char[]>& rpBuff,
+ sal_uInt32& rBuffLen );
+ virtual SdrObject* ProcessObj( SvStream& rSt,
+ DffObjData& rData,
+ SvxMSDffClientData& rClientData,
+ tools::Rectangle& rTextRect,
+ SdrObject* pObj);
+ void NotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj);
+ void FreeObj(SvxMSDffClientData& rData, SdrObject* pObj);
+
+
+ /** Object finalization, used by the Excel filter to correctly
+ compute the object anchoring after nested objects have been imported.
+ */
+ virtual SdrObject* FinalizeObj(DffObjData& rData,
+ SdrObject* pObj);
+
+ virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const;
+
+ // Fontwork objects use a new implementation of ReadObjText because the old
+ // one does not properly import multiple paragraphs.
+ static void ReadObjText( const OUString& rText, SdrObject* pObj );
+
+// the following method needs to be overridden for the import of OLE objects
+ virtual bool GetOLEStorageName( sal_uInt32 nOLEId,
+ OUString& rStorageName,
+ tools::SvRef<SotStorage>& rSrcStorage,
+ css::uno::Reference < css::embed::XStorage >& xDestStg
+ ) const;
+
+ /** Prevent that (rounded) rectangles with wrapped text will always be
+ converted into SdrRectObj( SdrObjKind::Text ).
+
+ @return true means "conversion".
+ */
+ virtual bool ShapeHasText(sal_uLong nShapeId, sal_uLong nFilePos) const;
+
+public:
+ std::unique_ptr<DffPropertyReader> pSecPropSet;
+ std::unordered_map<sal_uInt32, Graphic> aEscherBlipCache;
+
+ DffRecordManager maShapeRecords;
+ Color mnDefaultColor;
+
+ bool mbSkipImages;
+
+ Color MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const;
+ Color MSO_CLR_ToColor( sal_uInt32 nColorCode,
+ sal_uInt16 nContextProperty = DFF_Prop_lineColor ) const;
+ virtual bool SeekToShape( SvStream& rSt,
+ SvxMSDffClientData* pClientData,
+ sal_uInt32 nId ) const;
+ static bool SeekToRec( SvStream& rSt,
+ sal_uInt16 nRecId,
+ sal_uLong nMaxFilePos,
+ DffRecordHeader* pRecHd = nullptr,
+ sal_uLong nSkipCount = 0 );
+ bool SeekToRec2( sal_uInt16 nRecId1,
+ sal_uInt16 nRecId2,
+ sal_uLong nMaxFilePos ) const;
+
+ static OUString MSDFFReadZString( SvStream& rIn,
+ sal_uInt32 nMaxLen,
+ bool bUniCode);
+
+ [[nodiscard]] static bool ReadCommonRecordHeader( SvStream& rSt,
+ sal_uInt8& rVer,
+ sal_uInt16& rInst,
+ sal_uInt16& rFbt,
+ sal_uInt32& rLength);
+
+// TODO: provide proper documentation here
+ /** constructor
+
+ sets nBLIPCount
+
+ @param rStCtrl Management stream with containers, FBSE
+ objects and shapes (mandatory; stream needs
+ to be open already)
+ @param rBaseURL ???
+ @param nOffsDgg offset in rStrCtrl; beginning of the drawing
+ group container
+ @param pStData data stream in that the BLIPs are stored (if
+ NULL it is assumed that all BLIPs are also in
+ the rStCtrl; stream needs to be open already)
+ @param pSdrModel_ ??? (can be empty during Ctor call but needs
+ to be set via SetModel() later in that case!)
+ @param nApplicationScale ???
+ @param mnDefaultColor_ ???
+ @param nDefaultFontHeight_ ???
+ @param pStData2_ ???
+ @param bSkipImages skipping images for text extraction/indexing
+ */
+ SvxMSDffManager( SvStream& rStCtrl,
+ OUString aBaseURL,
+ sal_uInt32 nOffsDgg,
+ SvStream* pStData,
+ SdrModel* pSdrModel_,
+ tools::Long nApplicationScale,
+ Color mnDefaultColor_,
+ SvStream* pStData2_ = nullptr,
+ bool bSkipImages = false );
+
+ // in PPT the parameters DGGContainerOffset and PicStream are provided by an
+ // init method
+ SvxMSDffManager( SvStream& rStCtrl, OUString aBaseURL );
+ void InitSvxMSDffManager( sal_uInt32 nOffsDgg_,
+ SvStream* pStData_,
+ sal_uInt32 nSvxMSDffOLEConvFlags);
+ void SetDgContainer( SvStream& rSt );
+
+ virtual ~SvxMSDffManager();
+
+ sal_uInt32 GetSvxMSDffSettings() const { return nSvxMSDffSettings; };
+ void SetSvxMSDffSettings( sal_uInt32 nSettings ) { nSvxMSDffSettings = nSettings; };
+
+ static bool MakeContentStream( SotStorage * pStor, const GDIMetaFile & );
+ static void ReadObjText( SvStream& rStream, SdrObject* pObj );
+ static bool ConvertToOle2( SvStream& rStm,
+ sal_uInt32 nLen,
+ const GDIMetaFile*,
+ const tools::SvRef<SotStorage> & rDest );
+
+ void SetModel(SdrModel* pModel, tools::Long nApplicationScale);
+ SdrModel* GetModel() const { return pSdrModel; }
+ void Scale(sal_Int32& rVal) const;
+ void Scale(Point& rPos) const;
+ void Scale(Size& rSiz) const;
+ void ScaleEmu(sal_Int32& rVal) const;
+ sal_uInt32 ScalePt( sal_uInt32 nPt ) const;
+ sal_Int32 ScalePoint( sal_Int32 nVal ) const;
+
+// TODO: provide proper documentation here
+ /** Request for a specific BLIP.
+
+ @param[in] nIdx number of the requested BLIP (mandatory)
+ @param[out] rData already converted data (insert directly as graphics
+ into our documents)
+ @param pVisArea ???
+
+ @return true if successful, false otherwise
+ */
+ bool GetBLIP( sal_uLong nIdx, Graphic& rData, tools::Rectangle* pVisArea = nullptr );
+
+// TODO: provide proper documentation here
+ /** read a BLIP out of an already positioned stream
+
+ @param[in] rBLIPStream already positioned stream (mandatory)
+ @param[out] rData already converted data (insert directly as
+ graphics into our documents)
+ @param pVisArea ???
+
+ @return true if successful, false otherwise
+ */
+ static bool GetBLIPDirect(SvStream& rBLIPStream, Graphic& rData, tools::Rectangle* pVisArea = nullptr );
+
+ bool GetShape(sal_uLong nId, SdrObject*& rpData, SvxMSDffImportData& rData);
+
+ SdrObject* ImportObj( SvStream& rSt,
+ SvxMSDffClientData& rData,
+ tools::Rectangle& rClientRect,
+ const tools::Rectangle& rGlobalChildRect,
+ int nCalledByGroup,
+ sal_Int32* pShapeId);
+ SdrObject* ImportGroup( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ SvxMSDffClientData& rData,
+ tools::Rectangle& rClientRect,
+ const tools::Rectangle& rGlobalChildRect,
+ int nCalledByGroup,
+ sal_Int32* pShapeId );
+ SdrObject* ImportShape( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ SvxMSDffClientData& rData,
+ tools::Rectangle& rClientRect,
+ const tools::Rectangle& rGlobalChildRect,
+ int nCalledByGroup,
+ sal_Int32* pShapeId);
+
+ tools::Rectangle GetGlobalChildAnchor( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ tools::Rectangle& aClientRect );
+ void GetGroupAnchors( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ tools::Rectangle& rGroupClientAnchor,
+ tools::Rectangle& rGroupChildAnchor,
+ const tools::Rectangle& rClientRect,
+ const tools::Rectangle& rGlobalChildRect );
+
+ const SvxMSDffShapeInfos_ById* GetShapeInfos() const
+ { return m_xShapeInfosById.get(); }
+
+ const SvxMSDffShapeOrders* GetShapeOrders() const
+ { return &m_aShapeOrders; }
+
+ void StoreShapeOrder(sal_uLong nId,
+ sal_uLong nTxBx,
+ SdrObject* pObject,
+ SwFlyFrameFormat* pFly = nullptr) const;
+
+ void ExchangeInShapeOrder(SdrObject const * pOldObject,
+ sal_uLong nTxBx,
+ SdrObject* pObject) const;
+
+ void RemoveFromShapeOrder( SdrObject const * pObject ) const;
+
+ static SdrOle2Obj* CreateSdrOLEFromStorage(
+ SdrModel& rSdrModel,
+ const OUString& rStorageName,
+ tools::SvRef<SotStorage> const & rSrcStorage,
+ const css::uno::Reference < css::embed::XStorage >& xDestStg,
+ const Graphic& rGraf,
+ const tools::Rectangle& rBoundRect,
+ const tools::Rectangle& rVisArea,
+ SvStream* pDataStrrm,
+ ErrCode& rError,
+ sal_uInt32 nConvertFlags,
+ sal_Int64 nAspect,
+ OUString const& rBaseURL);
+
+ /** Create connections between shapes.
+ This method should be called after a page is imported.
+
+ @param rSolver contains necessary data that is collected during the
+ import of each shape
+ */
+ static void SolveSolver( const SvxMSDffSolverContainer& rSolver );
+
+ static bool SetPropValue(
+ const css::uno::Any& rAny,
+ const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
+ const OUString& rPropertyName
+ );
+
+ /// Determines an ODF filter name (if there is one) for aGlobName.
+ static OUString GetFilterNameFromClassID(const SvGlobalName& aGlobName);
+ /// Extracts ODF data from rSrcStg.
+ static void ExtractOwnStream(SotStorage& rSrcStg, SvMemoryStream& rMemStream);
+
+ void insertShapeId( sal_Int32 nShapeId, SdrObject* pShape );
+ void removeShapeId( SdrObject const * pShape );
+ SdrObject* getShapeForId( sal_Int32 nShapeId );
+};
+
+struct SvxMSDffShapeInfo
+{
+ sal_uInt32 nShapeId; ///< shape id, used in PLCF SPA and in mso_fbtSp (FSP)
+ sal_uInt64 nFilePos; ///< offset of the shape in control stream for
+ ///< potential later access to it
+ sal_uInt32 nTxBxComp;
+
+ bool bReplaceByFly :1; ///< shape can be replaced by a frame in Writer
+
+ explicit SvxMSDffShapeInfo(sal_uInt64 nFPos, sal_uInt32 nId=0, // sal_uLong nBIdx=0,
+ sal_uInt16 nSeqId=0, sal_uInt16 nBoxId=0):
+ nShapeId( nId ),
+ nFilePos( nFPos ),
+ nTxBxComp( (nSeqId << 16) + nBoxId )
+ {
+ bReplaceByFly = false;
+ }
+ SvxMSDffShapeInfo(const SvxMSDffShapeInfo& rInfo):
+ nShapeId( rInfo.nShapeId ),
+ nFilePos( rInfo.nFilePos ),
+ nTxBxComp( rInfo.nTxBxComp ),
+ bReplaceByFly( rInfo.bReplaceByFly )
+ {
+ }
+};
+
+
+struct SvxMSDffShapeOrder
+{
+ sal_uLong nShapeId; ///< shape id used in PLCF SPA and in mso_fbtSp (FSP)
+ sal_uLong nTxBxComp; ///< chain or box number in the Text-Box-Story (or NULL)
+ SwFlyFrameFormat* pFly; ///< format of frame that was inserted as a replacement
+ ///< for a Sdr-Text object in Writer - needed for
+ ///< chaining!
+ SdrObject* pObj; ///< pointer to the draw object (or NULL if not used)
+
+ // Approach: In the Ctor of SvxMSDffManager only the shape ids are stored in
+ // the shape order array. The Text-Box number and the object
+ // pointer are only stored if the shape is really imported.
+ explicit SvxMSDffShapeOrder( sal_uLong nId ):
+ nShapeId( nId ), nTxBxComp( 0 ), pFly( nullptr ), pObj( nullptr ){}
+
+ bool operator<( const SvxMSDffShapeOrder& rEntry ) const
+ { return (nTxBxComp < rEntry.nTxBxComp); }
+};
+
+// the following will be sorted explicitly:
+struct CompareSvxMSDffShapeTxBxSort
+{
+ bool operator()( SvxMSDffShapeOrder* const& lhs, SvxMSDffShapeOrder* const& rhs ) const { return (*lhs)<(*rhs); }
+};
+class MSFILTER_DLLPUBLIC SvxMSDffShapeTxBxSort : public std::set<SvxMSDffShapeOrder*,CompareSvxMSDffShapeTxBxSort> {};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msfilterdllapi.h b/include/filter/msfilter/msfilterdllapi.h
new file mode 100644
index 000000000..10532d165
--- /dev/null
+++ b/include/filter/msfilter/msfilterdllapi.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_MSFILTERDLLAPI_H
+#define INCLUDED_FILTER_MSFILTER_MSFILTERDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined MSFILTER_DLLIMPLEMENTATION
+#define MSFILTER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define MSFILTER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#define MSFILTER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msocximex.hxx b/include/filter/msfilter/msocximex.hxx
new file mode 100644
index 000000000..18bf41569
--- /dev/null
+++ b/include/filter/msfilter/msocximex.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_FILTER_MSFILTER_MSOCXIMEX_HXX
+#define INCLUDED_FILTER_MSFILTER_MSOCXIMEX_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+
+namespace com::sun::star {
+ namespace drawing{
+ class XDrawPage;
+ class XShape;
+ class XShapes;
+ }
+ namespace form{
+ class XFormComponent;
+ }
+ namespace lang{
+ class XMultiServiceFactory;
+ }
+ namespace container{
+ class XIndexContainer;
+ }
+ namespace awt{
+ struct Size;
+ }
+ namespace frame{
+ class XModel;
+ }
+}
+
+class MSFILTER_DLLPUBLIC SvxMSConvertOCXControls
+{
+public:
+ SvxMSConvertOCXControls( css::uno::Reference< css::frame::XModel > xModel );
+ virtual ~SvxMSConvertOCXControls();
+
+ virtual bool InsertControl(
+ const css::uno::Reference<
+ css::form::XFormComponent >& /*rFComp*/,
+ const css::awt::Size& /*rSize*/,
+ css::uno::Reference<
+ css::drawing::XShape >* /*pShape*/,
+ bool /*bFloatingCtrl*/ ) {return false;}
+
+ /*begin: Backwards compatibility with office 95 import, modify later*/
+ const css::uno::Reference< css::lang::XMultiServiceFactory > & GetServiceFactory();
+protected:
+ const css::uno::Reference< css::drawing::XShapes > & GetShapes();
+
+ const css::uno::Reference< css::container::XIndexContainer > & GetFormComps();
+
+ css::uno::Reference< css::frame::XModel > mxModel;
+
+ // cached interfaces
+ css::uno::Reference< css::drawing::XDrawPage > xDrawPage;
+ css::uno::Reference< css::drawing::XShapes > xShapes;
+ css::uno::Reference< css::lang::XMultiServiceFactory > xServiceFactory;
+
+ // the only form
+ css::uno::Reference< css::container::XIndexContainer > xFormComps;
+
+ virtual void GetDrawPage();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msoleexp.hxx b/include/filter/msfilter/msoleexp.hxx
new file mode 100644
index 000000000..77b2cc3b4
--- /dev/null
+++ b/include/filter/msfilter/msoleexp.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_FILTER_MSFILTER_MSOLEEXP_HXX
+#define INCLUDED_FILTER_MSFILTER_MSOLEEXP_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace embed { class XEmbeddedObject; }
+}
+
+namespace svt {
+ class EmbeddedObjectRef;
+}
+
+class SotStorage;
+
+// for the CreateSdrOLEFromStorage we need the information, how we handle
+// convert able OLE-Objects - this is stored in
+#define OLE_STARMATH_2_MATHTYPE 0x0001
+#define OLE_STARWRITER_2_WINWORD 0x0002
+#define OLE_STARCALC_2_EXCEL 0x0004
+#define OLE_STARIMPRESS_2_POWERPOINT 0x0008
+
+class MSFILTER_DLLPUBLIC SvxMSExportOLEObjects
+{
+ sal_uInt32 nConvertFlags;
+public:
+ SvxMSExportOLEObjects( sal_uInt32 nCnvrtFlgs ) : nConvertFlags(nCnvrtFlgs) {}
+
+ void ExportOLEObject( svt::EmbeddedObjectRef const & rObj, SotStorage& rDestStg );
+ void ExportOLEObject( const css::uno::Reference < css::embed::XEmbeddedObject>& rObj, SotStorage& rDestStg );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/mstoolbar.hxx b/include/filter/msfilter/mstoolbar.hxx
new file mode 100644
index 000000000..46966d648
--- /dev/null
+++ b/include/filter/msfilter/mstoolbar.hxx
@@ -0,0 +1,355 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_FILTER_MSFILTER_MSTOOLBAR_HXX
+#define INCLUDED_FILTER_MSFILTER_MSTOOLBAR_HXX
+
+#include <memory>
+#include <string_view>
+#include <vector>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/stream.hxx>
+#include <vcl/bitmapex.hxx>
+
+namespace com::sun::star {
+ namespace beans { struct PropertyValue; }
+ namespace container { class XIndexAccess; }
+ namespace graphic { class XGraphic; }
+ namespace ui { class XUIConfigurationManager; }
+ namespace ui { class XUIConfigurationManagerSupplier; }
+}
+
+class TBCHeader;
+
+class MSOCommandConvertor
+{
+public:
+ virtual ~MSOCommandConvertor() {}
+ virtual OUString MSOCommandToOOCommand( sal_Int16 msoCmd ) = 0;
+ virtual OUString MSOTCIDToOOCommand( sal_Int16 msoTCID ) = 0;
+};
+
+class SfxObjectShell;
+
+class MSFILTER_DLLPUBLIC CustomToolBarImportHelper
+{
+ struct iconcontrolitem
+ {
+ OUString sCommand;
+ css::uno::Reference< css::graphic::XGraphic > image;
+ };
+ std::vector< iconcontrolitem > iconcommands;
+ std::unique_ptr< MSOCommandConvertor > pMSOCmdConvertor;
+ css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
+ css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
+ SfxObjectShell& mrDocSh;
+ static void ScaleImage( css::uno::Reference< css::graphic::XGraphic >& xGraphic, tools::Long nNewSize );
+public:
+ CustomToolBarImportHelper( SfxObjectShell& rDocSh, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
+
+ void setMSOCommandMap( MSOCommandConvertor* pCnvtr ) { pMSOCmdConvertor.reset( pCnvtr ); }
+ css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
+ const css::uno::Reference< css::ui::XUIConfigurationManager >& getAppCfgManager() const { return m_xAppCfgMgr;}
+
+
+ static css::uno::Any createCommandFromMacro( std::u16string_view sCmd );
+
+ void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const OUString& sString );
+ void applyIcons();
+ OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
+ OUString MSOTCIDToOOCommand( sal_Int16 msoTCID );
+ SfxObjectShell& GetDocShell() { return mrDocSh; }
+ bool createMenu( const OUString& rName, const css::uno::Reference< css::container::XIndexAccess >& xMenuDesc );
+};
+
+class MSFILTER_DLLPUBLIC TBBase
+{
+friend class Indent;
+ static int nIndent; // num spaces to indent before printing
+protected:
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ static void indent_printf(FILE* fp, const char* format, ... );
+#endif
+ sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
+public:
+ TBBase() : nOffSet( 0 ) {}
+ virtual ~TBBase(){}
+
+ TBBase(TBBase const &) = default;
+ TBBase(TBBase &&) = default;
+ TBBase & operator =(TBBase const &) = default;
+ TBBase & operator =(TBBase &&) = default;
+
+ virtual bool Read(SvStream &rS) = 0;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
+#endif
+ sal_uInt32 GetOffset() const { return nOffSet; }
+};
+
+class Indent
+{
+public:
+ Indent( bool binit )
+ {
+ if ( binit )
+ TBBase::nIndent = 0;
+ else
+ TBBase::nIndent = TBBase::nIndent + 2;
+ }
+ ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; }
+};
+
+
+class MSFILTER_DLLPUBLIC WString final : public TBBase
+{
+ OUString sString;
+
+public:
+ WString(){};
+ bool Read(SvStream &rS) override;
+ const OUString& getString() const { return sString; }
+};
+
+class MSFILTER_DLLPUBLIC TBCExtraInfo final : public TBBase
+{
+ WString wstrHelpFile;
+ sal_Int32 idHelpContext;
+ WString wstrTag;
+ WString wstrOnAction;
+ WString wstrParam;
+ sal_Int8 tbcu;
+ sal_Int8 tbmg;
+
+ TBCExtraInfo(const TBCExtraInfo&) = delete;
+ TBCExtraInfo& operator = ( const TBCExtraInfo&) = delete;
+public:
+ TBCExtraInfo();
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+ OUString const & getOnAction() const;
+};
+
+class MSFILTER_DLLPUBLIC TBCGeneralInfo final : public TBBase
+{
+ sal_uInt8 bFlags;
+ WString customText;
+ WString descriptionText;
+ WString tooltip;
+ TBCExtraInfo extraInfo;
+
+public:
+ TBCGeneralInfo();
+ bool Read(SvStream &rS) override;
+ void ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
+ OUString const & CustomText() { return customText.getString(); }
+};
+
+class TBCBitMap final : public TBBase
+{
+friend class TBCBSpecific; // #FIXME hacky access, need to fix
+ sal_Int32 cbDIB;
+ BitmapEx mBitMap;
+public:
+ TBCBitMap();
+ virtual ~TBCBitMap() override;
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+ // #FIXME Const-ness
+ BitmapEx& getBitMap() { return mBitMap;}
+};
+
+class MSFILTER_DLLPUBLIC TBCMenuSpecific final : public TBBase
+{
+ sal_Int32 tbid;
+ std::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
+public:
+ TBCMenuSpecific();
+ bool Read(SvStream &rS) override;
+ OUString Name();
+};
+
+class TBCCDData final : public TBBase
+{
+ sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
+ std::vector< WString > wstrList; // Zero-based index array of WString structures. Number of elements MUST be equal to cwstrItems.
+ sal_Int16 cwstrMRU; // Signed integer that specifies the number of most recently used string
+ sal_Int16 iSel ; // Signed integer that specifies the zero-based index of the selected item in the wstrList field. MUST be equal to 0xFFFF (-1) or greater than or equal to 0x0000.
+ sal_Int16 cLines; // Signed integer that specifies the suggested number of lines that the toolbar control will display at any time when displaying the elements of wstrList of available items.
+ sal_Int16 dxWidth; // Signed integer that specifies the width in pixels that the interior of the dropdown has. This excludes the width of the toolbar control border and scroll bar.
+ WString wstrEdit; //Structure of type WString. Editable text for editable area of the ComboBox toolbar control.
+
+public:
+ TBCCDData();
+ virtual ~TBCCDData() override;
+ bool Read(SvStream &rS) override;
+};
+
+class TBCComboDropdownSpecific final : public TBBase
+{
+ std::shared_ptr< TBCCDData > data;
+public:
+ TBCComboDropdownSpecific( const TBCHeader& header );
+ bool Read(SvStream &rS) override;
+};
+
+class TBCBSpecific final : public TBBase
+{
+ sal_uInt8 bFlags;
+ std::shared_ptr< TBCBitMap > icon; // optional
+ std::shared_ptr< TBCBitMap > iconMask; // optional
+ std::shared_ptr< sal_uInt16 > iBtnFace; // optional
+ std::shared_ptr< WString > wstrAcc; // optional
+
+public:
+ TBCBSpecific();
+ bool Read(SvStream &rS) override;
+ // #TODO just add a getGraphic member here
+ TBCBitMap* getIcon();
+ TBCBitMap* getIconMask();
+ sal_uInt16* getBtnFace() { return iBtnFace.get(); }
+};
+
+/* TBCHeader.tct controlSpecificInfo type
+
+0x01 (Button control) TBCBSpecific
+0x10 (ExpandingGrid control) TBCBSpecific
+0x0A (Popup control) TBCMenuSpecific
+0x0C (ButtonPopup control) TBCMenuSpecific
+0x0D (SplitButtonPopup control) TBCMenuSpecific
+0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
+0x02 (Edit control) TBCComboDropdow nSpecific
+0x04 (ComboBox control) TBCComboDropdow nSpecific
+0x14 (GraphicCombo control) TBCComboDropdow nSpecific
+0x03 (DropDown control) TBCComboDropdow nSpecific
+0x06 (SplitDropDown control) TBCComboDropdow nSpecific
+0x09 (GraphicDropDown control) TBCComboDropdow nSpecific
+0x07 (OCXDropDown control) controlSpecificInfo MUST NOT exist
+0x0F (Label control) controlSpecificInfo MUST NOT exist
+0x12 (Grid control) controlSpecificInfo MUST NOT exist
+0x13 (Gauge control) controlSpecificInfo MUST NOT exist
+0x16 (ActiveX control) controlSpecificInfo MUST NOT exist
+
+*/
+class MSFILTER_DLLPUBLIC TBCHeader final : public TBBase
+{
+ sal_Int8 bSignature;
+ sal_Int8 bVersion;
+ sal_uInt8 bFlagsTCR;
+ sal_uInt8 tct;
+ sal_uInt16 tcid;
+ sal_uInt32 tbct;
+ sal_uInt8 bPriority;
+ std::shared_ptr< sal_uInt16 > width; //optional
+ std::shared_ptr< sal_uInt16 > height; //optional
+
+public:
+ TBCHeader();
+ virtual ~TBCHeader() override;
+
+ TBCHeader(TBCHeader const &) = default;
+ TBCHeader(TBCHeader &&) = default;
+ TBCHeader & operator =(TBCHeader const &) = default;
+ TBCHeader & operator =(TBCHeader &&) = default;
+
+ sal_uInt8 getTct() const { return tct; }
+ sal_uInt16 getTcID() const { return tcid; }
+ bool isVisible() const { return !( bFlagsTCR & 0x1 ); }
+ bool isBeginGroup() const { return ( bFlagsTCR & 0x2 ) != 0; }
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+ sal_uInt32 getTbct() const { return tbct; };
+};
+
+class MSFILTER_DLLPUBLIC TBCData final : public TBBase
+{
+ TBCHeader rHeader;
+ TBCGeneralInfo controlGeneralInfo;
+ std::shared_ptr< TBBase > controlSpecificInfo; // can be one of TBCBSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct
+ TBCData(const TBCData&) = delete;
+ TBCData& operator = ( const TBCData&) = delete;
+public:
+ TBCData( TBCHeader Header );
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+ void ImportToolBarControl( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup, bool bIsMenuBar );
+ TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; }
+ TBCMenuSpecific* getMenuSpecific();
+};
+
+class MSFILTER_DLLPUBLIC TB final : public TBBase
+{
+ sal_uInt8 bSignature;// Signed integer that specifies the toolbar signature number. MUST be 0x02.
+ sal_uInt8 bVersion; // Signed integer that specifies the toolbar version number. MUST be 0x01.
+ sal_Int16 cCL; // Signed integer that SHOULD specify the number of toolbar controls contained in this toolbar.
+ sal_Int32 ltbid;// Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
+ sal_uInt32 ltbtr;// Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
+ sal_uInt16 cRowsDefault;// Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
+ sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
+ WString name; //Structure of type WString that specifies the toolbar name
+public:
+ TB();
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+ sal_Int16 getcCL() const { return cCL; }
+ WString& getName(){ return name; }
+ bool IsEnabled() const;
+ bool IsMenuToolbar() const { return ( ( ltbtr & 0x2000000 ) == 0x2000000 ); }
+};
+
+class MSFILTER_DLLPUBLIC SRECT final : public TBBase
+{
+public:
+ SRECT() : left(0), top(0), right(0), bottom(0) {}
+ sal_Int16 left;
+ sal_Int16 top;
+ sal_Int16 right;
+ sal_Int16 bottom;
+ bool Read( SvStream &rS ) override { rS.ReadInt16( left ).ReadInt16( top ).ReadInt16( right ).ReadInt16( bottom ); return true; }
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* fo ) override;
+#endif
+};
+
+
+class MSFILTER_DLLPUBLIC TBVisualData final : public TBBase
+{
+ sal_Int8 tbds;
+ sal_Int8 tbv;
+ sal_Int8 tbdsDock;
+ sal_Int8 iRow;
+
+ SRECT rcDock;
+ SRECT rcFloat;
+
+public:
+ TBVisualData();
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msvbahelper.hxx b/include/filter/msfilter/msvbahelper.hxx
new file mode 100644
index 000000000..d5cb1e96f
--- /dev/null
+++ b/include/filter/msfilter/msvbahelper.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_FILTER_MSFILTER_MSVBAHELPER_HXX
+#define INCLUDED_FILTER_MSFILTER_MSVBAHELPER_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/script/vba/XVBAMacroResolver.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+ namespace uno { class XInterface; }
+}
+
+class SfxObjectShell;
+
+namespace ooo::vba {
+
+
+struct MSFILTER_DLLPUBLIC MacroResolvedInfo
+{
+ SfxObjectShell* mpDocContext;
+ OUString msResolvedMacro;
+ bool mbFound;
+
+ explicit MacroResolvedInfo( SfxObjectShell* pDocContext = nullptr ) : mpDocContext( pDocContext ), mbFound( false ) {}
+};
+
+MSFILTER_DLLPUBLIC OUString makeMacroURL( std::u16string_view sMacroName );
+MSFILTER_DLLPUBLIC OUString extractMacroName( const OUString& rMacroUrl );
+MSFILTER_DLLPUBLIC OUString getDefaultProjectName( SfxObjectShell const * pShell );
+MSFILTER_DLLPUBLIC OUString resolveVBAMacro( SfxObjectShell const * pShell, const OUString& rLibName, const OUString& rModuleName, const OUString& rMacroName );
+MSFILTER_DLLPUBLIC MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& rMacroName, bool bSearchGlobalTemplates = false );
+MSFILTER_DLLPUBLIC bool executeMacro( SfxObjectShell* pShell, const OUString& sMacroName, css::uno::Sequence< css::uno::Any >& aArgs, css::uno::Any& aRet, const css::uno::Any& aCaller );
+/// @throws css::uno::RuntimeException
+MSFILTER_DLLPUBLIC css::awt::KeyEvent parseKeyEvent( const OUString& sKey );
+/// @throws css::uno::RuntimeException
+MSFILTER_DLLPUBLIC void applyShortCutKeyBinding ( const css::uno::Reference< css::frame::XModel >& rxDoc, const css::awt::KeyEvent& rKeyEvent, const OUString& sMacro );
+
+
+typedef ::cppu::WeakImplHelper<
+ css::lang::XServiceInfo,
+ css::lang::XInitialization,
+ css::script::vba::XVBAMacroResolver > VBAMacroResolverBase;
+
+class VBAMacroResolver final : public VBAMacroResolverBase
+{
+public:
+ explicit VBAMacroResolver();
+ virtual ~VBAMacroResolver() override;
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual OUString SAL_CALL
+ getImplementationName() override;
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& rService ) override;
+
+ virtual css::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames() override;
+
+ // com.sun.star.lang.XInitialization interface ----------------------------
+
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence< css::uno::Any >& rArgs ) override;
+
+ // com.sun.star.script.vba.XVBAMacroResolver interface --------------------
+
+ virtual OUString SAL_CALL
+ resolveVBAMacroToScriptURL( const OUString& rVBAMacroName ) override;
+
+ virtual OUString SAL_CALL
+ resolveScriptURLtoVBAMacro( const OUString& rScriptURL ) override;
+
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ SfxObjectShell* mpObjShell;
+ OUString maProjectName;
+};
+
+
+} // namespace ooo::vba
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/rtfutil.hxx b/include/filter/msfilter/rtfutil.hxx
new file mode 100644
index 000000000..fd7473149
--- /dev/null
+++ b/include/filter/msfilter/rtfutil.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_RTFUTIL_HXX
+#define INCLUDED_FILTER_MSFILTER_RTFUTIL_HXX
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/textenc.h>
+#include <sal/types.h>
+#include <tools/solar.h>
+
+// RTF values are often multiplied by 2^16
+#define RTF_MULTIPLIER 65536
+
+class SvStream;
+
+namespace msfilter::rtfutil
+{
+/// Outputs a single character in hex form.
+MSFILTER_DLLPUBLIC OString OutHex(sal_uLong nHex, sal_uInt8 nLen);
+
+/// Handles correct unicode and legacy export of a single character.
+MSFILTER_DLLPUBLIC OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc,
+ bool* pSuccess, bool bUnicode = true);
+
+/**
+ * Handles correct unicode and legacy export of a string.
+ *
+ * @param rStr the string to export
+ * @param eDestEnc the legacy encoding to use
+ * @param bUnicode if unicode output is wanted as well, or just legacy
+ */
+MSFILTER_DLLPUBLIC OString OutString(const OUString& rStr, rtl_TextEncoding eDestEnc,
+ bool bUnicode = true);
+
+/**
+ * Handles correct unicode and legacy export of a string, when a
+ * '{' \upr '{' keyword ansi_text '}{\*' \ud '{' keyword Unicode_text '}}}'
+ * construct should be used.
+ *
+ * @param pToken the keyword
+ * @param rStr the text to export
+ * @param eDestEnc the legacy encoding to use
+ */
+MSFILTER_DLLPUBLIC OString OutStringUpr(const char* pToken, const OUString& rStr,
+ rtl_TextEncoding eDestEnc);
+
+/**
+ * Get the numeric value of a single character, representing a hex value.
+ *
+ * @return -1 on failure
+ */
+MSFILTER_DLLPUBLIC int AsHex(char ch);
+
+/// Writes binary data as a hex dump.
+MSFILTER_DLLPUBLIC OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize,
+ SvStream* pStream = nullptr, sal_uInt32 nLimit = 64);
+
+/**
+ * Extract OLE2 data from an \objdata hex dump.
+ */
+MSFILTER_DLLPUBLIC bool ExtractOLE2FromObjdata(const OString& rObjdata, SvStream& rOle2);
+
+/// Strips the header of a WMF file.
+MSFILTER_DLLPUBLIC bool StripMetafileHeader(const sal_uInt8*& rpGraphicAry, sal_uInt64& rSize);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
new file mode 100644
index 000000000..6fa9ffaf4
--- /dev/null
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -0,0 +1,1488 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_SVDFPPT_HXX
+#define INCLUDED_FILTER_MSFILTER_SVDFPPT_HXX
+
+#include <algorithm>
+#include <cstddef>
+#include <memory>
+#include <vector>
+
+#include <optional>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <filter/msfilter/dffrecordheader.hxx>
+#include <filter/msfilter/msdffimp.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <filter/msfilter/msocximex.hxx>
+#include <o3tl/enumarray.hxx>
+#include <rtl/ref.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svx/msdffdef.hxx>
+#include <tools/color.hxx>
+#include <tools/fontenum.hxx>
+#include <tools/gen.hxx>
+#include <tools/ref.hxx>
+#include <tools/solar.h>
+#include <vcl/graph.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+namespace com::sun::star {
+ namespace awt { struct Size; }
+ namespace drawing { class XShape; }
+ namespace form { class XFormComponent; }
+ namespace frame { class XModel; }
+}
+
+class SdrPage;
+class SdrObject;
+class SvStream;
+class SfxItemSet;
+class SdrOutliner;
+class SfxStyleSheet;
+class SotStorage;
+class SvMemoryStream;
+class SvxNumberFormat;
+class PPTTextObj;
+enum class PptSlideLayout;
+enum class PptPlaceholder : sal_uInt8;
+
+#define PPT_IMPORTFLAGS_NO_TEXT_ASSERT 1
+
+struct MSFILTER_DLLPUBLIC PptCurrentUserAtom
+{
+ sal_uInt32 nMagic;
+ sal_uInt32 nCurrentUserEdit;
+ sal_uInt16 nDocFileVersion;
+ sal_uInt8 nMajorVersion;
+ sal_uInt8 nMinorVersion;
+ OUString aCurrentUser;
+
+public:
+
+ PptCurrentUserAtom() : nMagic ( 0 ),
+ nCurrentUserEdit ( 0 ),
+ nDocFileVersion ( 0 ),
+ nMajorVersion ( 0 ),
+ nMinorVersion ( 0 ) {}
+
+ MSFILTER_DLLPUBLIC friend SvStream& ReadPptCurrentUserAtom( SvStream& rIn, PptCurrentUserAtom& rAtom );
+};
+
+struct MSFILTER_DLLPUBLIC PowerPointImportParam
+{
+ SvStream& rDocStream;
+ sal_uInt32 nImportFlags;
+ PptCurrentUserAtom aCurrentUserAtom;
+
+ PowerPointImportParam( SvStream& rDocStream );
+};
+
+struct SdHyperlinkEntry
+{
+ sal_uInt32 nIndex;
+ sal_Int32 nPrivate1;
+ sal_Int32 nPrivate2;
+ sal_Int32 nPrivate3;
+ sal_Int32 nInfo;
+ OUString aTarget;
+ OUString aSubAddress;
+
+ OUString aConvSubString;
+};
+
+// Helper class for reading the PPT InteractiveInfoAtom
+struct MSFILTER_DLLPUBLIC PptInteractiveInfoAtom
+{
+ sal_uInt32 nSoundRef;
+ sal_uInt32 nExHyperlinkId;
+ sal_uInt8 nAction;
+ sal_uInt8 nOleVerb;
+ sal_uInt8 nJump;
+ sal_uInt8 nFlags;
+ sal_uInt8 nHyperlinkType;
+
+ // unknown, because total size is 16
+ sal_uInt8 nUnknown1;
+ sal_uInt8 nUnknown2;
+ sal_uInt8 nUnknown3;
+
+public:
+
+ MSFILTER_DLLPUBLIC friend SvStream& ReadPptInteractiveInfoAtom( SvStream& rIn, PptInteractiveInfoAtom& rAtom );
+};
+
+enum PptPageKind { PPT_MASTERPAGE, PPT_SLIDEPAGE, PPT_NOTEPAGE };
+
+enum PptPageFormat
+{ PPTPF_SCREEN,
+ PPTPF_USLETTER, // 8.5x11"
+ PPTPF_A4, // 210x297mm
+ PPTPF_35MMDIA, // DIA
+ PPTPF_OVERHEAD,
+ PPTPF_CUSTOM
+};
+
+// values for PPT_PST_TextHeaderAtom's sal_uLong
+enum PPT_TextHeader
+{
+ PPTTH_TITLE,
+ PPTTH_BODY,
+ PPTTH_NOTES,
+ PPTTH_NOTUSED,
+ PPTTH_OTHER, // Text in a Shape
+ PPTTH_CENTERBODY, // Subtitle in Title-Slide
+ PPTTH_CENTERTITLE, // Title in Title-Slide
+ PPTTH_HALFBODY, // Body in two-column slide
+ PPTTH_QUARTERBODY // Body in four-body slide
+};
+
+enum class TSS_Type : unsigned {
+ PageTitle = 0,
+ Body = 1,
+ Notes = 2,
+ Unused = 3,
+ TextInShape = 4,
+ Subtitle = 5,
+ Title = 6,
+ HalfBody = 7,
+ QuarterBody = 8,
+ LAST = QuarterBody,
+ Unknown = 0xffffffff // or invalid
+};
+
+const int nMaxPPTLevels = 10;
+
+// Object IDs for StarDraw UserData
+#define PPT_OBJECTINFO_ID (1)
+
+struct MSFILTER_DLLPUBLIC PptDocumentAtom
+{
+ Size aSlidesPageSize; // page size of the slides in 576DPI
+ Size aNotesPageSize; // page size of the notes in 576DPI
+ // avoid RatioAtom for the time being
+ sal_uInt32 nNotesMasterPersist; // 0=non-existent
+ sal_uInt32 nHandoutMasterPersist; // 0=non-existent
+ sal_uInt16 n1stPageNumber; // page number of the first slide
+ PptPageFormat eSlidesPageFormat; // page format of the slides
+ bool bEmbeddedTrueType : 1; // TrueType directly within the File?
+ bool bTitlePlaceholdersOmitted : 1;
+ bool bRightToLeft : 1;
+ bool bShowComments : 1;
+
+public:
+
+ PptDocumentAtom()
+ : nNotesMasterPersist(0)
+ , nHandoutMasterPersist(0)
+ , n1stPageNumber(0)
+ , eSlidesPageFormat(PPTPF_SCREEN)
+ , bEmbeddedTrueType(false)
+ , bTitlePlaceholdersOmitted(false)
+ , bRightToLeft(false)
+ , bShowComments(false)
+ {
+ }
+
+ Size const & GetSlidesPageSize() const { return aSlidesPageSize; }
+ Size const & GetNotesPageSize() const { return aNotesPageSize; }
+
+ friend SvStream& ReadPptDocumentAtom( SvStream& rIn, PptDocumentAtom& rAtom );
+};
+
+struct PptSlideLayoutAtom
+{
+ PptSlideLayout eLayout; // 0..18
+ PptPlaceholder aPlaceholderId[ 8 ];
+
+public:
+ PptSlideLayoutAtom() { Clear(); }
+ void Clear();
+
+ // SlideLayoutAtom is read without header!
+ friend SvStream& ReadPptSlideLayoutAtom( SvStream& rIn, PptSlideLayoutAtom& rAtom );
+};
+
+struct PptSlideAtom
+{
+ PptSlideLayoutAtom aLayout;
+ sal_uInt32 nMasterId;
+ sal_uInt32 nNotesId;
+ sal_uInt16 nFlags;
+
+public:
+ PptSlideAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& ReadPptSlideAtom(SvStream& rIn, PptSlideAtom& rAtom);
+};
+
+struct PptSlidePersistAtom
+{
+ sal_uInt32 nPsrReference;
+ sal_uInt32 nFlags;
+ sal_uInt32 nNumberTexts;
+ sal_uInt32 nSlideId;
+ sal_uInt32 nReserved; // we will use nReserved temporarily to set the offset to SSSlideInfoAtom ( if possible )
+
+public:
+ PptSlidePersistAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& ReadPptSlidePersistAtom(SvStream& rIn, PptSlidePersistAtom& rAtom);
+};
+
+struct PptNotesAtom
+{
+ sal_uInt32 nSlideId;
+ sal_uInt16 nFlags;
+
+public:
+ PptNotesAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& ReadPptNotesAtom(SvStream& rIn, PptNotesAtom& rAtom);
+};
+
+struct PptColorSchemeAtom
+{
+ sal_uInt8 aData[32] = {};
+
+public:
+ PptColorSchemeAtom();
+ Color GetColor( sal_uInt16 nNum ) const;
+
+ friend SvStream& ReadPptColorSchemeAtom(SvStream& rIn, PptColorSchemeAtom& rAtom);
+};
+
+struct PptFontEntityAtom
+{
+ OUString aName;
+ sal_uInt8 lfClipPrecision;
+ sal_uInt8 lfQuality;
+
+ rtl_TextEncoding eCharSet;
+ FontFamily eFamily;
+ FontPitch ePitch;
+ bool bAvailable;
+
+ friend SvStream& ReadPptFontEntityAtom(SvStream& rIn, PptFontEntityAtom& rAtom);
+};
+
+enum class PptViewTypeEnum : sal_uInt16
+{
+ NONE = 0,
+ Slide = 1,
+ SlideMaster = 2,
+ Notes = 3,
+ Handout = 4,
+ NotesMaster = 5,
+ OutlineMaster = 6,
+ Outline = 7,
+ SlideSorter = 8,
+ VisualBasic = 9,
+ TitleMaster = 10,
+ SlideShow = 11,
+ SlideShowFullScreen = 12,
+ NotesText = 13,
+ PrintPreview = 14,
+ Thumbnails = 15,
+ MasterThumbnails = 16,
+ PodiumSlideView = 17,
+ PodiumNotesView = 18,
+};
+
+struct PptUserEditAtom
+{
+ DffRecordHeader aHd;
+ sal_Int32 nLastSlideID; // ID of last visible slide
+ sal_uInt32 nVersion; // This is major/minor/build which did the edit
+ sal_uInt32 nOffsetLastEdit; // File offset of prev PptUserEditAtom
+ sal_uInt32 nOffsetPersistDirectory; // Offset to PersistPtrs for this file version.
+ sal_uInt32 nDocumentRef;
+ sal_uInt32 nMaxPersistWritten; // total number of Persist entries up to this point
+ PptViewTypeEnum eLastViewType; // enum view type
+
+public:
+ PptUserEditAtom()
+ : nLastSlideID( 0 )
+ , nVersion( 0 )
+ , nOffsetLastEdit( 0 )
+ , nOffsetPersistDirectory( 0 )
+ , nDocumentRef( 0 )
+ , nMaxPersistWritten( 0 )
+ , eLastViewType( PptViewTypeEnum::NONE )
+ {}
+
+ friend SvStream& ReadPptUserEditAtom( SvStream& rIn, PptUserEditAtom& rAtom );
+};
+
+struct PptOEPlaceholderAtom
+{
+ sal_uInt32 nPlacementId;
+ PptPlaceholder nPlaceholderId;
+ sal_uInt8 nPlaceholderSize; // 0=Full size, 1=Half size, 2=Quarter of Slide
+
+public:
+ PptOEPlaceholderAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& ReadPptOEPlaceholderAtom( SvStream& rIn, PptOEPlaceholderAtom& rAtom );
+};
+
+struct PPTStyleSheet;
+struct HeaderFooterEntry;
+struct PptSlidePersistEntry
+{
+ PptSlidePersistEntry(const PptSlidePersistEntry&) = delete;
+ PptSlidePersistEntry& operator=( const PptSlidePersistEntry& ) = delete;
+
+ PptSlidePersistAtom aPersistAtom;
+ PptSlideAtom aSlideAtom;
+ PptNotesAtom aNotesAtom;
+ PptColorSchemeAtom aColorScheme; // each slide includes this colorscheme atom
+ std::unique_ptr<PPTStyleSheet> xStyleSheet; // stylesheet of this page (only in masterpages), since XP supports more than one masterpage
+
+ sal_uInt32 HeaderFooterOfs[ 4 ]; // containing the ofs to the placeholder (only masterpage)
+ std::unique_ptr<HeaderFooterEntry> xHeaderFooterEntry;
+ std::unique_ptr<SvxMSDffSolverContainer> xSolverContainer;
+ sal_uInt32 nSlidePersistStartOffset;// is an array to the end of the SlidePersistAtom of this page, TextHeaderAtom is following
+ sal_uInt32 nSlidePersistEndOffset;
+ sal_uInt32 nBackgroundOffset; // fileoffset
+ sal_uInt32 nDrawingDgId; // valid, if not -1
+ std::unique_ptr<sal_uInt32[]>
+ pPresentationObjects; // if valid, this is a pointer to an array that includes the offsets to the presentation objects
+ // on this masterpage for each instance (0 - 8);
+ SdrObject* pBObj;
+
+ PptPageKind ePageKind;
+
+ bool bNotesMaster : 1; // for NotesMaster
+ bool bHandoutMaster : 1; // for HandoutMaster
+ bool bStarDrawFiller : 1; // special for StarDraw
+public:
+ PptSlidePersistEntry();
+ ~PptSlidePersistEntry();
+ sal_uInt32 GetSlideId() const { return aPersistAtom.nSlideId; }
+};
+
+#define PPTSLIDEPERSIST_ENTRY_NOTFOUND 0xFFFF
+
+class MSFILTER_DLLPUBLIC PptSlidePersistList
+{
+private:
+ PptSlidePersistList(const PptSlidePersistList&) = delete;
+ PptSlidePersistList& operator=( const PptSlidePersistList& ) = delete;
+
+ typedef std::vector<std::unique_ptr<PptSlidePersistEntry>> Entries_t;
+ Entries_t mvEntries;
+
+public:
+ PptSlidePersistList();
+ ~PptSlidePersistList();
+
+ size_t size() const { return mvEntries.size(); }
+ bool is_null( size_t nIdx ) const { return mvEntries[ nIdx ] == nullptr; }
+ const PptSlidePersistEntry& operator[](size_t nIdx) const { return *mvEntries[ nIdx ]; }
+ PptSlidePersistEntry& operator[](size_t nIdx) { return *mvEntries[ nIdx ]; }
+ Entries_t::iterator begin() { return mvEntries.begin(); }
+ void insert( Entries_t::iterator it,
+ std::unique_ptr<PptSlidePersistEntry> pEntry )
+ {
+ mvEntries.insert(it, std::move(pEntry));
+ }
+ void push_back(std::unique_ptr<PptSlidePersistEntry> pEntry)
+ {
+ mvEntries.push_back(std::move(pEntry));
+ }
+
+ sal_uInt16 FindPage( sal_uInt32 nId ) const;
+};
+
+class SfxObjectShell;
+struct PPTOleEntry
+{
+ sal_uInt32 nId; // OleId
+ sal_uInt32 nRecHdOfs; // points to the record header: ExObjListHd
+ SfxObjectShell* pShell;
+ sal_uInt16 nType; // maybe PPT_PST_ExEmbed or PPT_PST_ExControl
+ sal_uInt32 nAspect; // the aspect of the OLE object
+
+ PPTOleEntry( sal_uInt32 nid, sal_uInt32 nOfs, SfxObjectShell* pSh, sal_uInt16 nT, sal_uInt32 nAsp )
+ : nId(nid)
+ , nRecHdOfs(nOfs)
+ , pShell(pSh)
+ , nType(nT)
+ , nAspect(nAsp)
+ {}
+};
+
+struct PptExOleObjAtom
+{
+ sal_uInt32 nAspect;
+ sal_uInt32 nId;
+ sal_uInt32 nPersistPtr;
+
+public:
+
+ friend SvStream& ReadPptExOleObjAtom( SvStream& rIn, PptExOleObjAtom& rAtom );
+};
+
+// SdPage derives from SdrPage, is only known inside sd, and needs to be carried
+// around as an opaque pointer here:
+struct SdPageCapsule {
+ explicit SdPageCapsule(SdrPage * thePage): page(thePage) {}
+
+ SdrPage * page;
+};
+
+class MSFILTER_DLLPUBLIC SdrEscherImport : public SvxMSDffManager
+{
+protected:
+
+ friend class PPTTextObj;
+ friend class PPTPortionObj;
+ friend struct PPTStyleTextPropReader;
+ friend class ImplSdPPTImport;
+
+ PptDocumentAtom aDocAtom;
+ DffRecordManager aDocRecManager; // contains all first level container and atoms of the document container
+
+ ::std::vector< PPTOleEntry > aOleObjectList;
+
+ std::optional<std::vector<PptFontEntityAtom>> m_xFonts;
+
+ sal_uInt32 nStreamLen;
+
+ bool ReadString( OUString& rStr ) const;
+ // only for PowerPoint filter:
+ virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const;
+
+public:
+ using SvxMSDffManager::ReadObjText;
+
+ PowerPointImportParam& rImportParam;
+
+ SdrEscherImport( PowerPointImportParam&, const OUString& rBaseURL );
+ virtual ~SdrEscherImport() override;
+ virtual bool GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) const override;
+ virtual bool SeekToShape( SvStream& rSt, SvxMSDffClientData* pClientData, sal_uInt32 nId ) const override;
+ const PptFontEntityAtom* GetFontEnityAtom( sal_uInt32 nNum ) const;
+ void RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraph );
+ virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPageCapsule pPage ) const;
+ virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, SvxMSDffClientData& rClientData, tools::Rectangle& rTextRect, SdrObject* pObj ) override;
+ virtual void ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, DffObjData& rObj ) override;
+ void ImportHeaderFooterContainer( DffRecordHeader const & rHeader, HeaderFooterEntry& rEntry );
+};
+
+
+struct MSFILTER_DLLPUBLIC PPTFieldEntry
+{
+ sal_uInt16 nPos;
+ sal_uInt16 nTextRangeEnd;
+ std::unique_ptr<SvxFieldItem> xField1;
+ std::unique_ptr<SvxFieldItem> xField2;
+ std::optional<OUString> xString;
+
+ PPTFieldEntry()
+ : nPos(0)
+ , nTextRangeEnd(0)
+ {
+ }
+
+ ~PPTFieldEntry();
+
+ void SetDateTime( sal_uInt32 nType );
+
+ // converting PPT date time format:
+ static void GetDateTime(
+ const sal_uInt32 nVal,
+ SvxDateFormat& eDateFormat,
+ SvxTimeFormat& eTimeFormat
+ );
+};
+
+struct MSFILTER_DLLPUBLIC HeaderFooterEntry
+{
+ const PptSlidePersistEntry* pMasterPersist;
+ OUString pPlaceholder[ 4 ];
+ sal_uInt32 nAtom;
+
+ sal_uInt32 IsToDisplay( sal_uInt32 nInstance );
+ sal_uInt32 NeedToImportInstance(
+ const sal_uInt32 nInstance,
+ const PptSlidePersistEntry& rSlidePersist
+ );
+
+ explicit HeaderFooterEntry( const PptSlidePersistEntry* pMaster = nullptr );
+};
+
+struct MSFILTER_DLLPUBLIC ProcessData final : public SvxMSDffClientData
+{
+ PptSlidePersistEntry& rPersistEntry;
+ SdPageCapsule pPage;
+ ::std::vector< SdrObject* > aBackgroundColoredObjects;
+ std::unique_ptr<sal_uInt32[]> pTableRowProperties;
+
+ ProcessData( PptSlidePersistEntry& rP, SdPageCapsule pP ) :
+ rPersistEntry ( rP ),
+ pPage ( pP ) {};
+
+ virtual void NotifyFreeObj(SdrObject* pObj) override;
+};
+
+
+class SdrTextObj;
+
+class MSFILTER_DLLPUBLIC SdrPowerPointImport : public SdrEscherImport
+{
+protected:
+
+ friend class PPTTextObj;
+ friend class PPTExtParaProv;
+ friend struct PPTStyleSheet;
+ friend class PPTNumberFormatCreator;
+
+ bool m_bOk;
+ PptUserEditAtom m_aUserEditAtom;
+ PptColorSchemeAtom m_aPageColors;
+ ::std::vector< SdHyperlinkEntry > m_aHyperList;
+ std::unique_ptr<sal_uInt32[]>
+ m_pPersistPtr;
+ sal_uInt32 m_nPersistPtrCnt;
+
+ const PPTStyleSheet* m_pPPTStyleSheet; // this is the current stylesheet;
+ const PPTStyleSheet* m_pDefaultSheet; // this is a sheet we are using if no masterpage can be found, but that should
+ // never happen just preventing a crash
+ std::unique_ptr<PptSlidePersistList> m_pMasterPages;
+ std::unique_ptr<PptSlidePersistList> m_pSlidePages;
+ std::unique_ptr<PptSlidePersistList> m_pNotePages;
+ sal_uInt16 m_nCurrentPageNum;
+ sal_uLong m_nDocStreamPos;
+ sal_uInt16 m_nPageColorsNum;
+ PptPageKind m_ePageColorsKind;
+ PptPageKind m_eCurrentPageKind;
+
+protected:
+ using SdrEscherImport::ReadObjText;
+
+ bool SeekToCurrentPage(DffRecordHeader* pRecHd) const;
+ bool SeekToDocument(DffRecordHeader* pRecHd) const;
+ static bool SeekToContentOfProgTag(
+ sal_Int32 nVersion,
+ SvStream& rSt,
+ const DffRecordHeader& rProgTagBinaryDataHd,
+ DffRecordHeader& rContentHd
+ );
+ virtual SdrObject* ApplyTextObj(
+ PPTTextObj* pTextObj,
+ SdrTextObj* pText,
+ SdPageCapsule pPage,
+ SfxStyleSheet*,
+ SfxStyleSheet** )
+ const;
+ virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPageCapsule pPage ) const override;
+ // #i32596# - new parameter <_nCalledByGroup>, which
+ // indicates, if the OLE object is imported inside a group object.
+ virtual SdrObject* ImportOLE(
+ sal_uInt32 nOLEId,
+ const Graphic& rGraf,
+ const tools::Rectangle& rBoundRect,
+ const tools::Rectangle& rVisArea,
+ const int _nCalledByGroup
+ ) const override;
+ std::unique_ptr<SvMemoryStream> ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const;
+ rtl::Reference<SdrPage> MakeBlankPage(bool bMaster) const;
+ bool ReadFontCollection();
+ PptSlidePersistList* GetPageList(PptPageKind ePageKind) const;
+ sal_uInt32 GetCurrentPageId();
+ sal_uInt32 GetMasterPageId(sal_uInt16 nPageNum, PptPageKind ePageKind) const;
+ sal_uInt32 GetNotesPageId(sal_uInt16 nPageNum ) const;
+ static SdrOutliner* GetDrawOutliner( SdrTextObj const * pSdrText );
+ void SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions );
+
+ void ApplyTextAnchorAttributes( PPTTextObj const & rTextObj, SfxItemSet& rSet ) const;
+ bool IsVerticalText() const;
+
+public:
+ SdrPowerPointImport( PowerPointImportParam&, const OUString& rBaseURL );
+ virtual ~SdrPowerPointImport() override;
+ sal_uInt16 GetPageCount( PptPageKind eKind = PPT_SLIDEPAGE ) const;
+ void SetPageNum( sal_uInt16 nPageNum, PptPageKind = PPT_SLIDEPAGE );
+ Size GetPageSize() const;
+ SdrObject* ImportPageBackgroundObject(
+ const SdrPage& rPage,
+ sal_uInt32& nBgFileOffset
+ );
+ bool IsNoteOrHandout( sal_uInt16 nPageNum ) const;
+ bool HasMasterPage(
+ sal_uInt16 nPageNum,
+ PptPageKind ePageKind = PPT_SLIDEPAGE
+ ) const;
+ sal_uInt16 GetMasterPageIndex(
+ sal_uInt16 nPageNum,
+ PptPageKind ePageKind = PPT_SLIDEPAGE
+ ) const;
+
+ void ImportPage( SdrPage* pPage, const PptSlidePersistEntry* pMasterPersist );
+ virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const override;
+ virtual bool SeekToShape( SvStream& rSt, SvxMSDffClientData* pClientData, sal_uInt32 nId ) const override;
+ virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const override;
+ SdrObject* CreateTable(
+ SdrObject* pGroupObject,
+ const sal_uInt32* pTableArry,
+ SvxMSDffSolverContainer* pSolverContainer,
+ std::vector<SdrObject*>& rBackgroundColoredObjects
+ );
+ virtual bool ReadFormControl( tools::SvRef<SotStorage>& rSrc1, css::uno::Reference< css::form::XFormComponent > & rFormComp ) const = 0;
+};
+
+struct PPTTextParagraphStyleAtomInterpreter
+{
+ bool bValid;
+ bool bForbiddenRules;
+ bool bHangingPunctuation;
+ bool bLatinTextWrap;
+
+ PPTTextParagraphStyleAtomInterpreter();
+
+ bool Read( SvStream& rIn, const DffRecordHeader& rRecHd );
+};
+
+struct PPTTextSpecInfo
+{
+ sal_uInt32 nCharIdx;
+ LanguageType nLanguage[ 3 ];
+ sal_uInt16 nDontKnow;
+
+ explicit PPTTextSpecInfo( sal_uInt32 nCharIdx );
+};
+
+struct PPTTextSpecInfoAtomInterpreter
+{
+ bool bValid;
+ ::std::vector< PPTTextSpecInfo > aList;
+
+ PPTTextSpecInfoAtomInterpreter();
+ ~PPTTextSpecInfoAtomInterpreter();
+
+ bool Read(
+ SvStream& rIn,
+ const DffRecordHeader& rRecHd,
+ sal_uInt16 nRecordType,
+ const PPTTextSpecInfo* pTextSpecDefault = nullptr
+ );
+
+};
+
+#define PPT_STYLESHEETENTRIES 9
+
+struct PPTExtParaLevel
+{
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt16 mnBuBlip;
+ sal_uInt16 mnHasAnm;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt32 mpfPP10Ext;
+ sal_uInt32 mnExtCharacterMask;
+ sal_uInt32 mcfPP10Ext;
+ bool mbSet;
+
+ PPTExtParaLevel();
+ friend SvStream& ReadPPTExtParaLevel( SvStream& rIn, PPTExtParaLevel& rL );
+};
+
+struct PPTExtParaSheet
+{
+ PPTExtParaLevel aExtParaLevel[nMaxPPTLevels];
+};
+
+struct PPTBuGraEntry
+{
+ sal_uInt32 nInstance;
+ Graphic aBuGra;
+
+ PPTBuGraEntry( Graphic aGraphic, sal_uInt32 nInstance );
+};
+
+class PPTExtParaProv
+{
+ ::std::vector< std::unique_ptr<PPTBuGraEntry> > aBuGraList;
+
+public:
+ bool bStyles;
+ DffRecordManager aExtendedPresRules;
+
+ o3tl::enumarray<TSS_Type, PPTExtParaSheet> aExtParaSheet;
+
+ bool GetGraphic( sal_uInt32 nInstance, Graphic& rGraphic ) const;
+
+ PPTExtParaProv(
+ SdrPowerPointImport& rManager,
+ SvStream& rSt,
+ const DffRecordHeader* pMainMasterHd
+ );
+ ~PPTExtParaProv();
+};
+
+struct PPTCharLevel
+{
+ Color mnFontColorInStyleSheet;
+ sal_uInt32 mnFontColor;
+ sal_uInt16 mnFlags;
+ sal_uInt16 mnFont;
+ sal_uInt16 mnAsianOrComplexFont;
+ sal_uInt16 mnFontHeight;
+ sal_uInt16 mnEscapement;
+};
+
+struct PPTCharSheet
+{
+ PPTCharLevel maCharLevel[nMaxPPTLevels];
+
+ explicit PPTCharSheet( TSS_Type nInstance );
+
+ void Read( SvStream& rIn, sal_uInt32 nLevel );
+};
+
+struct PPTParaLevel
+{
+ sal_uInt16 mnBuFlags;
+ sal_uInt16 mnBulletChar;
+ sal_uInt16 mnBulletFont;
+ sal_uInt16 mnBulletHeight;
+ sal_uInt32 mnBulletColor;
+
+ sal_uInt16 mnAdjust;
+ sal_uInt16 mnLineFeed;
+ sal_uInt16 mnUpperDist;
+ sal_uInt16 mnLowerDist;
+ sal_uInt16 mnTextOfs;
+ sal_uInt16 mnBulletOfs;
+ sal_uInt16 mnDefaultTab;
+ sal_uInt16 mnAsianLineBreak; // bit0: use asian rules for first and last character
+ // 1: do not wrap latin text in the middle of the word
+ // 2: allow hanging punctuation
+ sal_uInt16 mnBiDi;
+};
+
+struct PPTParaSheet
+{
+public:
+
+ PPTParaLevel maParaLevel[nMaxPPTLevels];
+
+ explicit PPTParaSheet( TSS_Type nInstance );
+
+ void Read(
+ SdrPowerPointImport const & rMan,
+ SvStream& rIn,
+ sal_uInt32 nLevel,
+ bool bFirst
+ );
+ void UpdateBulletRelSize( sal_uInt32 nLevel, sal_uInt16 nFontHeight );
+};
+
+class PPTParagraphObj;
+class PPTNumberFormatCreator
+{
+ sal_uInt32 nIsBullet;
+ sal_uInt32 nBulletChar;
+ sal_uInt32 nBulletFont;
+ sal_uInt32 nBulletHeight;
+ sal_uInt32 nBulletColor;
+ sal_uInt32 nTextOfs;
+ sal_uInt32 nBulletOfs;
+
+ void ImplGetNumberFormat(
+ SdrPowerPointImport const & rMan,
+ SvxNumberFormat& rNumberFormat
+ );
+ bool ImplGetExtNumberFormat(
+ SdrPowerPointImport const & rMan,
+ SvxNumberFormat& rNumberFormat,
+ sal_uInt32 nLevel,
+ TSS_Type nInstance,
+ TSS_Type nInstanceInSheet,
+ std::optional< sal_Int16 >& rStartNumbering,
+ sal_uInt32 nFontHeight,
+ PPTParagraphObj const * pPara
+ );
+
+protected:
+
+ PPTNumberFormatCreator( std::unique_ptr<PPTExtParaProv> );
+ ~PPTNumberFormatCreator();
+
+public:
+
+ std::unique_ptr<PPTExtParaProv> pExtParaProv;
+
+ void GetNumberFormat(
+ SdrPowerPointImport const & rMan,
+ SvxNumberFormat& rNumberFormat,
+ sal_uInt32 nLevel,
+ const PPTParaLevel& rParaLevel,
+ const PPTCharLevel& rCharLevel,
+ TSS_Type nInstance
+ );
+
+ bool GetNumberFormat(
+ SdrPowerPointImport const & rMan,
+ SvxNumberFormat& rNumberFormat,
+ PPTParagraphObj* pPara,
+ TSS_Type nInstanceInSheet,
+ std::optional< sal_Int16 >& rStartNumbering
+ );
+};
+
+class SvxNumBulletItem;
+struct PPTStyleSheet : public PPTNumberFormatCreator
+{
+ PPTTextSpecInfo maTxSI;
+ o3tl::enumarray<TSS_Type, std::unique_ptr<PPTCharSheet>> mpCharSheet;
+ o3tl::enumarray<TSS_Type, std::unique_ptr<PPTParaSheet>> mpParaSheet;
+ o3tl::enumarray<TSS_Type, std::unique_ptr<SvxNumBulletItem>> mpNumBulletItem;
+
+ PPTStyleSheet(
+ const DffRecordHeader& rSlideHd,
+ SvStream& rSt, SdrPowerPointImport&,
+ const PPTTextParagraphStyleAtomInterpreter&,
+ const PPTTextSpecInfo&
+ );
+ ~PPTStyleSheet();
+};
+
+struct ImplPPTParaPropSet final : public salhelper::SimpleReferenceObject
+{
+ sal_uInt16 mnDepth;
+ sal_uInt32 mnAttrSet;
+ sal_uInt32 mnBulletColor;
+ sal_uInt16 mpArry[ 22 ];
+
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt16 mnHasAnm;
+ sal_uInt16 mnBuBlip;
+
+ sal_uInt32 nDontKnow1;
+ sal_uInt32 nDontKnow2;
+ sal_uInt16 nDontKnow2bit06;
+
+ ImplPPTParaPropSet()
+ : mnDepth( 0 )
+ , mnAttrSet( 0 )
+ , mnBulletColor( 0 )
+ , mnExtParagraphMask( 0 )
+ , mnAnmScheme( 0 )
+ , mnHasAnm( 0 )
+ , mnBuBlip( 0 )
+ , nDontKnow1( 0 )
+ , nDontKnow2( 0 )
+ , nDontKnow2bit06( 0 )
+ { }
+};
+
+struct PPTParaPropSet
+{
+ sal_uInt32 mnOriginalTextPos;
+ rtl::Reference<ImplPPTParaPropSet> mxParaSet;
+
+ PPTParaPropSet();
+ PPTParaPropSet( PPTParaPropSet const & rParaPropSet );
+ ~PPTParaPropSet();
+
+ PPTParaPropSet& operator=( const PPTParaPropSet& rParaPropSet );
+};
+
+struct ImplPPTCharPropSet
+{
+ sal_uInt32 mnAttrSet;
+ sal_uInt16 mnFlags;
+ sal_uInt32 mnColor;
+ sal_uInt16 mnFont;
+ sal_uInt16 mnAsianOrComplexFont;
+ sal_uInt16 mnANSITypeface;
+ sal_uInt16 mnFontHeight;
+ sal_uInt16 mnEscapement;
+ sal_uInt16 mnSymbolFont;
+
+ ImplPPTCharPropSet()
+ : mnAttrSet( 0 )
+ , mnFlags( 0 )
+ , mnColor( 0 )
+ , mnFont( 0 )
+ , mnAsianOrComplexFont( 0 )
+ , mnANSITypeface( 0 )
+ , mnFontHeight( 0 )
+ , mnEscapement( 0 )
+ , mnSymbolFont( 0)
+ { }
+};
+
+struct PPTCharPropSet
+{
+ //when the bullet text has more than two color,next the text following with bullet has been set hyperlink.
+ //now,the bullet color should be set original hyperlink text's color
+ //so "mbHardHylinkOrigColor" hold the original hyperlink text's color.
+ sal_uInt32 mnHylinkOrigColor;
+ //the bullet text whether has a hyperlink.
+ bool mbIsHyperlink;
+ //the hyperlink text whether has a custom color.
+ bool mbHardHylinkOrigColor;
+
+ sal_uInt32 mnOriginalTextPos;
+ sal_uInt32 mnParagraph;
+ OUString maString;
+ std::unique_ptr<SvxFieldItem>
+ mpFieldItem;
+ LanguageType mnLanguage[ 3 ];
+
+ void SetFont( sal_uInt16 nFont );
+ void SetColor( sal_uInt32 nColor );
+
+ explicit PPTCharPropSet( sal_uInt32 nParagraph );
+ PPTCharPropSet( const PPTCharPropSet& rCharPropSet );
+ PPTCharPropSet( const PPTCharPropSet& rCharPropSet, sal_uInt32 nParagraph );
+ ~PPTCharPropSet();
+
+ PPTCharPropSet& operator=( const PPTCharPropSet& rCharPropSet );
+
+ friend class PPTTextObj;
+ friend class PPTParagraphObj;
+ friend class PPTPortionObj;
+ friend struct PPTStyleTextPropReader;
+
+private:
+ o3tl::cow_wrapper< ImplPPTCharPropSet > mpImplPPTCharPropSet;
+};
+
+struct PPTTabEntry
+{
+ sal_uInt16 nOffset;
+ sal_uInt16 nStyle;
+};
+
+struct PPTRuler final : public salhelper::SimpleReferenceObject
+{
+ sal_Int32 nFlags;
+ sal_uInt16 nDefaultTab;
+ sal_uInt16 nTextOfs[nMaxPPTLevels] = {};
+ sal_uInt16 nBulletOfs[nMaxPPTLevels] = {};
+ std::unique_ptr<PPTTabEntry[]>
+ pTab;
+ sal_uInt16 nTabCount;
+
+ PPTRuler();
+ virtual ~PPTRuler() override;
+};
+
+struct PPTTextRulerInterpreter
+{
+ rtl::Reference<PPTRuler> mxImplRuler;
+
+ PPTTextRulerInterpreter();
+ PPTTextRulerInterpreter( PPTTextRulerInterpreter const & rRuler );
+ PPTTextRulerInterpreter(
+ sal_uInt32 nFileOfs,
+ DffRecordHeader const & rHd,
+ SvStream& rIn
+ );
+ ~PPTTextRulerInterpreter();
+
+ sal_uInt16 GetTabOffsetByIndex( sal_uInt16 nIndex ) const
+ { return mxImplRuler->pTab[ nIndex ].nOffset; };
+
+ sal_uInt16 GetTabStyleByIndex( sal_uInt16 nIndex ) const
+ { return mxImplRuler->pTab[ nIndex ].nStyle; };
+
+ sal_uInt16 GetTabCount() const { return mxImplRuler->nTabCount; };
+ bool GetDefaultTab( sal_uInt16& nValue ) const;
+ bool GetTextOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
+ bool GetBulletOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
+
+ PPTTextRulerInterpreter& operator=( const PPTTextRulerInterpreter& rRuler );
+};
+
+#define PPT_SPEC_NEWLINE 0x10000
+#define PPT_SPEC_SYMBOL 0x20000
+
+struct StyleTextProp9
+{
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt16 mnBuBlip;
+ sal_uInt16 mnHasAnm;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt32 mpfPP10Ext;
+ sal_uInt32 mnExtCharacterMask;
+ sal_uInt32 mncfPP10Ext;
+ sal_uInt32 mnSpecialInfoMask;
+ sal_uInt32 mnPP10Ext;
+ sal_uInt16 mfBidi;
+
+ StyleTextProp9()
+ : mnExtParagraphMask( 0 )
+ , mnBuBlip( 0 )
+ , mnHasAnm( 0 )
+ , mnAnmScheme( 0 )
+ , mpfPP10Ext( 0 )
+ , mnExtCharacterMask( 0 )
+ , mncfPP10Ext( 0 )
+ , mnSpecialInfoMask( 0 )
+ , mnPP10Ext( 0 )
+ , mfBidi( 0 )
+ {
+ }
+ void Read( SvStream& rSt );
+};
+
+struct PPTStyleTextPropReader
+{
+ std::vector< sal_uInt32 > aSpecMarkerList; // hiword -> Flags, loword -> Position
+ std::vector<std::unique_ptr<PPTParaPropSet>> aParaPropList;
+ std::vector<std::unique_ptr<PPTCharPropSet>> aCharPropList;
+
+ PPTStyleTextPropReader(
+ SvStream& rIn,
+ const DffRecordHeader& rClientTextBoxHd,
+ PPTTextRulerInterpreter const & rInterpreter,
+ const DffRecordHeader& rExtParaHd,
+ TSS_Type nTextInstance
+ );
+ ~PPTStyleTextPropReader();
+
+ void Init(
+ SvStream& rIn,
+ const DffRecordHeader& rClientTextBoxHd,
+ PPTTextRulerInterpreter const & rInterpreter,
+ const DffRecordHeader& rExtParaHd,
+ TSS_Type nTextInstance
+ );
+ void ReadParaProps(
+ SvStream& rIn,
+ const DffRecordHeader& rTextHeader,
+ const OUString& aString,
+ PPTTextRulerInterpreter const & rRuler,
+ sal_uInt32& nCharCount,
+ bool& bTextPropAtom
+ );
+ static void ReadCharProps(
+ SvStream& rIn,
+ PPTCharPropSet& aCharPropSet,
+ const OUString& aString,
+ sal_uInt32& nCharCount,
+ sal_uInt32 nCharReadCnt,
+ bool& bTextPropAtom,
+ sal_uInt32 nExtParaPos,
+ const std::vector< StyleTextProp9 >& aStyleTextProp9,
+ sal_uInt32& nExtParaFlags,
+ sal_uInt16& nBuBlip,
+ sal_uInt16& nHasAnm,
+ sal_uInt32& nAnmScheme
+ );
+};
+
+class MSFILTER_DLLPUBLIC PPTPortionObj : public PPTCharPropSet
+{
+
+ friend class PPTParagraphObj;
+
+ const PPTStyleSheet& mrStyleSheet;
+ TSS_Type mnInstance;
+ sal_uInt32 mnDepth;
+
+public:
+
+ bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, TSS_Type nInstanceInSheet ) const;
+ SvxFieldItem* GetTextField();
+
+ PPTPortionObj( const PPTStyleSheet&, TSS_Type nInstance, sal_uInt32 nDepth );
+ PPTPortionObj(
+ const PPTCharPropSet&,
+ const PPTStyleSheet&,
+ TSS_Type nInstance,
+ sal_uInt32 nDepth
+ );
+ PPTPortionObj( const PPTPortionObj& );
+ ~PPTPortionObj();
+
+ // the following function should be removed during next full update
+ void ApplyTo(
+ SfxItemSet& rSet,
+ SdrPowerPointImport& rManager,
+ TSS_Type nInstanceInSheet
+ );
+ void ApplyTo(
+ SfxItemSet& rSet,
+ SdrPowerPointImport& rManager,
+ TSS_Type nInstanceInSheet,
+ const PPTTextObj* pTextObj
+ );
+ sal_uInt32 Count() const { return mpFieldItem ? 1 : maString.getLength(); };
+};
+
+class MSFILTER_DLLPUBLIC PPTParagraphObj
+ : public PPTParaPropSet,
+ public PPTNumberFormatCreator,
+ public PPTTextRulerInterpreter
+{
+ friend class PPTTextObj;
+ friend class PPTNumberFormatCreator;
+
+ const PPTStyleSheet& mrStyleSheet;
+ TSS_Type mnInstance;
+
+ PPTParagraphObj(PPTParagraphObj const&) = delete;
+ void operator=(PPTParagraphObj const&) = delete;
+
+public:
+ sal_uInt32 mnCurrentObject;
+ ::std::vector<std::unique_ptr<PPTPortionObj>> m_PortionList;
+
+ void UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const;
+ bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, TSS_Type nInstanceInSheet );
+
+ PPTParagraphObj(
+ const PPTStyleSheet&,
+ TSS_Type nInstance,
+ sal_uInt16 nDepth
+ );
+ PPTParagraphObj(
+ PPTStyleTextPropReader&,
+ size_t nCurParaPos,
+ size_t& rnCurCharPos,
+ const PPTStyleSheet&,
+ TSS_Type nInstance,
+ PPTTextRulerInterpreter const & rRuler
+ );
+ ~PPTParagraphObj();
+
+ sal_uInt32 GetTextSize();
+ PPTPortionObj* First();
+ PPTPortionObj* Next();
+
+ void AppendPortion( PPTPortionObj& rPortion );
+ void ApplyTo(
+ SfxItemSet& rSet,
+ std::optional< sal_Int16 >& rStartNumbering,
+ SdrPowerPointImport const & rManager,
+ TSS_Type nInstanceInSheet
+ );
+};
+
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT 1
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER 2
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT 4
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK 8
+#define PPT_TEXTOBJ_FLAGS_VERTICAL 16
+
+struct ImplPPTTextObj final : public salhelper::SimpleReferenceObject
+{
+ sal_uInt32 mnShapeId;
+ sal_uInt32 mnShapeMaster;
+ std::unique_ptr<PptOEPlaceholderAtom> mpPlaceHolderAtom;
+ TSS_Type mnInstance;
+ TSS_Type mnDestinationInstance;
+ MSO_SPT meShapeType;
+
+ sal_uInt32 mnCurrentObject;
+ sal_uInt32 mnParagraphCount;
+ std::vector<std::unique_ptr<PPTParagraphObj>>
+ maParagraphList;
+ PptSlidePersistEntry& mrPersistEntry;
+
+ sal_uInt32 mnTextFlags;
+
+ explicit ImplPPTTextObj( PptSlidePersistEntry& rPersistEntry )
+ : mnShapeId(0)
+ , mnShapeMaster(0)
+ , mnInstance(TSS_Type::PageTitle)
+ , mnDestinationInstance(TSS_Type::PageTitle)
+ , meShapeType(mso_sptMin)
+ , mnCurrentObject(0)
+ , mnParagraphCount(0)
+ , mrPersistEntry ( rPersistEntry )
+ , mnTextFlags(0) {};
+};
+
+class MSFILTER_DLLPUBLIC PPTTextObj
+{
+ rtl::Reference<ImplPPTTextObj> mxImplTextObj;
+
+public:
+ PPTTextObj(
+ SvStream& rSt,
+ SdrPowerPointImport&,
+ PptSlidePersistEntry&,
+ DffObjData const *
+ );
+ PPTTextObj( PPTTextObj const & rTextObj );
+ ~PPTTextObj();
+
+ sal_uInt32 GetCurrentIndex() const { return mxImplTextObj->mnCurrentObject; };
+ sal_uInt32 Count() const { return mxImplTextObj->mnParagraphCount; };
+ PPTParagraphObj* First();
+ PPTParagraphObj* Next();
+ MSO_SPT GetShapeType() const { return mxImplTextObj->meShapeType; };
+ TSS_Type GetInstance() const { return mxImplTextObj->mnInstance; };
+ void SetInstance( TSS_Type nInstance )
+ { mxImplTextObj->mnInstance = nInstance; }
+
+ TSS_Type GetDestinationInstance() const
+ { return mxImplTextObj->mnDestinationInstance; }
+
+ void SetDestinationInstance( TSS_Type nInstance )
+ { mxImplTextObj->mnDestinationInstance = nInstance; }
+
+ PptOEPlaceholderAtom* GetOEPlaceHolderAtom() const { return mxImplTextObj->mpPlaceHolderAtom.get(); }
+ sal_uInt32 GetTextFlags() const { return mxImplTextObj->mnTextFlags; }
+ void SetVertical( bool bVertical )
+ {
+ if ( bVertical )
+ mxImplTextObj->mnTextFlags |= PPT_TEXTOBJ_FLAGS_VERTICAL;
+ else
+ mxImplTextObj->mnTextFlags &= ~PPT_TEXTOBJ_FLAGS_VERTICAL;
+ }
+ bool GetVertical() const
+ { return ( mxImplTextObj->mnTextFlags & PPT_TEXTOBJ_FLAGS_VERTICAL ) != 0; }
+
+ const SfxItemSet* GetBackground() const;
+
+ PPTTextObj& operator=( const PPTTextObj& rTextObj );
+};
+
+class PPTConvertOCXControls final : public SvxMSConvertOCXControls
+{
+ virtual void GetDrawPage() override;
+ PptPageKind ePageKind;
+ const SdrPowerPointImport* mpPPTImporter;
+public:
+
+ PPTConvertOCXControls( const SdrPowerPointImport* pPPTImporter, const css::uno::Reference< css::frame::XModel >& rxModel, PptPageKind ePKind ) :
+ SvxMSConvertOCXControls ( rxModel ),
+ ePageKind ( ePKind ),
+ mpPPTImporter ( pPPTImporter )
+ {};
+ bool ReadOCXStream( tools::SvRef<SotStorage>& rSrc1,
+ css::uno::Reference<css::drawing::XShape > *pShapeRef );
+ virtual bool InsertControl(
+ const css::uno::Reference< css::form::XFormComponent > &rFComp,
+ const css::awt::Size& rSize,
+ css::uno::Reference< css::drawing::XShape > *pShape,
+ bool bFloatingCtrl
+ ) override;
+};
+
+// PowerPoint record types
+#define PPT_PST_Document 1000
+#define PPT_PST_DocumentAtom 1001
+#define PPT_PST_SlideAtom 1007
+#define PPT_PST_NotesAtom 1009
+#define PPT_PST_Environment 1010
+#define PPT_PST_SlidePersistAtom 1011
+#define PPT_PST_SSSlideInfoAtom 1017
+#define PPT_PST_VBAInfo 1023
+#define PPT_PST_VBAInfoAtom 1024
+#define PPT_PST_SSDocInfoAtom 1025
+#define PPT_PST_ExObjList 1033
+#define PPT_PST_PPDrawingGroup 1035
+#define PPT_PST_PPDrawing 1036
+#define PPT_PST_GridSpacing10Atom 1037
+#define PPT_PST_NamedShows 1040
+#define PPT_PST_NamedShow 1041
+#define PPT_PST_NamedShowSlides 1042
+#define PPT_PST_List 2000
+#define PPT_PST_FontCollection 2005
+#define PPT_PST_SoundCollection 2020
+#define PPT_PST_Sound 2022
+#define PPT_PST_SoundData 2023
+#define PPT_PST_ColorSchemeAtom 2032
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_ExtendedBuGraContainer 2040 // consist of 4041
+#define PPT_PST_ExtendedBuGraAtom 2041 // the instance of this atom indices the current graphic
+
+#define PPT_PST_ExObjRefAtom 3009
+#define PPT_PST_OEPlaceholderAtom 3011
+#define PPT_PST_OutlineTextRefAtom 3998
+#define PPT_PST_TextHeaderAtom 3999
+#define PPT_PST_TextCharsAtom 4000
+#define PPT_PST_StyleTextPropAtom 4001
+#define PPT_PST_TxMasterStyleAtom 4003
+#define PPT_PST_TxPFStyleAtom 4005
+#define PPT_PST_TextRulerAtom 4006
+#define PPT_PST_TextBytesAtom 4008
+#define PPT_PST_TxSIStyleAtom 4009
+#define PPT_PST_TextSpecInfoAtom 4010
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_ExtendedParagraphAtom 4012
+#define PPT_PST_ExtendedParagraphMasterAtom 4013
+#define PPT_PST_ExtendedPresRuleContainer 4014 // consist of 4012, 4015,
+#define PPT_PST_ExtendedParagraphHeaderAtom 4015 // the instance of this atom indices the current presobj
+ // the first sal_uInt32 in this atom indices the current slideId
+#define PPT_PST_TextDefaults9Atom 4016
+
+#define PPT_PST_FontEntityAtom 4023
+#define PPT_PST_CString 4026
+#define PPT_PST_ExOleObjAtom 4035
+#define PPT_PST_SrKinsoku 4040
+#define PPT_PST_ExEmbed 4044
+#define PPT_PST_ExHyperlinkAtom 4051
+#define PPT_PST_ExHyperlink 4055
+#define PPT_PST_SlideNumberMCAtom 4056
+#define PPT_PST_HeadersFooters 4057
+#define PPT_PST_HeadersFootersAtom 4058
+#define PPT_PST_TxInteractiveInfoAtom 4063
+#define PPT_PST_MasterText 4068
+#define PPT_PST_RecolorInfoAtom 4071
+#define PPT_PST_ExControl 4078
+#define PPT_PST_SlideListWithText 4080
+#define PPT_PST_AnimationInfoAtom 4081
+#define PPT_PST_InteractiveInfo 4082
+#define PPT_PST_InteractiveInfoAtom 4083
+#define PPT_PST_UserEditAtom 4085
+#define PPT_PST_CurrentUserAtom 4086
+#define PPT_PST_DateTimeMCAtom 4087
+#define PPT_PST_GenericDateMCAtom 4088
+#define PPT_PST_HeaderMCAtom 4089
+#define PPT_PST_FooterMCAtom 4090
+#define PPT_PST_ExMediaAtom 4100
+#define PPT_PST_ExVideo 4101
+#define PPT_PST_ExAviMovie 4102
+#define PPT_PST_ExMCIMovie 4103
+#define PPT_PST_AnimationInfo 4116
+#define PPT_PST_RTFDateTimeMCAtom 4117
+#define PPT_PST_ProgTags 5000
+#define PPT_PST_ProgBinaryTag 5002
+#define PPT_PST_BinaryTagData 5003
+#define PPT_PST_PersistPtrIncrementalBlock 6002
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_PresentationAdvisorFlags9Atom 6010
+#define PPT_PST_HtmlDocInfo9Atom 6011
+
+
+#define PPT_PST_HashCodeAtom 11008
+#define PPT_PST_BuildList 11010
+#define PPT_PST_Comment10 12000
+#define PPT_PST_CommentAtom10 12001
+#define PPT_PST_CommentIndex10 12004
+#define PPT_PST_SlideFlags10Atom 12010
+#define PPT_PST_SlideTime10Atom 12011
+#define PPT_PST_DocToolbarStates10Atom 14001
+
+// attributes for PptTextStyleSheet
+#define PPT_ParaAttr_BulletOn 0 //00000001
+#define PPT_ParaAttr_BuHardFont 1 //00000002
+#define PPT_ParaAttr_BuHardColor 2 //00000004
+#define PPT_ParaAttr_BuHardHeight 3 //00000008
+#define PPT_ParaAttr_BulletFont 4 //00000010
+#define PPT_ParaAttr_BulletColor 5 //00000020
+#define PPT_ParaAttr_BulletHeight 6 //00000040
+#define PPT_ParaAttr_BulletChar 7 //00000080
+#define PPT_ParaAttr_Adjust 11 //00000800 0000=Left, 0001=Center, 0002=Right, 0003=Block
+#define PPT_ParaAttr_LineFeed 12 //00001000
+#define PPT_ParaAttr_UpperDist 13 //00002000 is set to 0032 for TextFrames by default
+#define PPT_ParaAttr_LowerDist 14 //00004000
+#define PPT_ParaAttr_TextOfs 15 //00008000
+#define PPT_ParaAttr_BulletOfs 16 //00010000
+#define PPT_ParaAttr_DefaultTab 17 //00020000
+#define PPT_ParaAttr_AsianLB_1 18
+#define PPT_ParaAttr_AsianLB_2 19
+#define PPT_ParaAttr_AsianLB_3 20
+#define PPT_ParaAttr_BiDi 21 //00200000
+
+#define PPT_CharAttr_Bold 0 //00000001
+#define PPT_CharAttr_Italic 1 //00000002
+#define PPT_CharAttr_Underline 2 //00000004
+#define PPT_CharAttr_Shadow 4 //00000010
+#define PPT_CharAttr_Strikeout 8 //00000100
+#define PPT_CharAttr_Embossed 9 //00000200
+#define PPT_CharAttr_Font 16 //00010000
+#define PPT_CharAttr_AsianOrComplexFont 21 //00200000
+#define PPT_CharAttr_ANSITypeface 22 //00400000
+#define PPT_CharAttr_Symbol 23 //00800000
+#define PPT_CharAttr_FontHeight 17 //00020000
+#define PPT_CharAttr_FontColor 18 //00040000
+#define PPT_CharAttr_Escapement 19 //00080000
+
+// values for PptSlideLayoutAtom.eLayout
+enum class PptSlideLayout
+{
+ TITLESLIDE = 0, // The slide is a title slide
+ TITLEANDBODYSLIDE = 1, // Title and body slide
+ TITLEMASTERSLIDE = 2, // Title master slide
+ MASTERSLIDE = 3, // Master slide layout
+ MASTERNOTES = 4, // Master notes layout
+ NOTESTITLEBODY = 5, // Notes title/body layout
+ HANDOUTLAYOUT = 6, // Handout layout, therefore it doesn't have placeholders except header, footer, and date
+ ONLYTITLE = 7, // Only title placeholder
+ TWOCOLUMNSANDTITLE = 8, // Body of the slide has 2 columns and a title
+ TWOROWSANDTITLE = 9, // Slide's body has 2 rows and a title
+ RIGHTCOLUMN2ROWS = 10, // Body contains 2 columns, right column has 2 rows
+ LEFTCOLUMN2ROWS = 11, // Body contains 2 columns, left column has 2 rows
+ BOTTOMROW2COLUMNS = 12, // Body contains 2 rows, bottom row has 2 columns
+ TOPROW2COLUMN = 13, // Body contains 2 rows, top row has 2 columns
+ FOUROBJECTS = 14, // 4 objects
+ BIGOBJECT = 15, // Big object
+ BLANKSLIDE = 16, // Blank slide
+ TITLERIGHTBODYLEFT = 17, // Vertical title on the right, body on the left
+ TITLERIGHT2BODIESLEFT = 18 // Vertical title on the right, body on the left split into 2 rows
+};
+
+// the following table describes the placeholder id's (values from reality followed by values taken from the documentation)
+enum class PptPlaceholder : sal_uInt8
+{
+ NONE = 0, // 0 None
+ MASTERTITLE = 1, // 1 Master title
+ MASTERBODY = 2, // 2 Master body
+ MASTERCENTEREDTITLE = 3, // 3 Master centered title
+ MASTERSUBTITLE = 4, // 10 Master subtitle
+ MASTERNOTESSLIDEIMAGE = 5, // 4 Master notes slide image
+ MASTERNOTESBODYIMAGE = 6, // 5 Master notes body image
+ MASTERDATE = 7, // 6 Master date
+ MASTERSLIDENUMBER = 8, // 7 Master slide number
+ MASTERFOOTER = 9, // 8 Master footer
+ MASTERHEADER = 10, // 9 Master header
+ // 11 Generic text object
+ TITLE = 13, // 12 Title
+ BODY = 14, // 13 Body
+ NOTESBODY = 12, // 14 Notes body
+ CENTEREDTITLE = 15, // 15 Centered title
+ SUBTITLE = 16, // 16 Subtitle
+ VERTICALTEXTTITLE = 17, // 17 Vertical text title
+ VERTICALTEXTBODY = 18, // 18 Vertical text body
+ NOTESSLIDEIMAGE = 11, // 19 Notes slide image
+ OBJECT = 19, // 20 Object (no matter the size)
+ GRAPH = 20, // 21 Graph
+ TABLE = 21, // 22 Table
+ CLIPART = 22, // 23 Clip Art
+ ORGANISZATIONCHART = 23, // 24 Organization Chart
+ MEDIACLIP = 24 // 25 Media Clip
+};
+
+#endif // INCLUDED_FILTER_MSFILTER_SVDFPPT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/svxmsbas.hxx b/include/filter/msfilter/svxmsbas.hxx
new file mode 100644
index 000000000..190e289c4
--- /dev/null
+++ b/include/filter/msfilter/svxmsbas.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_SVXMSBAS_HXX
+#define INCLUDED_FILTER_MSFILTER_SVXMSBAS_HXX
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sot/storage.hxx>
+#include <vcl/errcode.hxx>
+#include <tools/ref.hxx>
+
+class SfxObjectShell;
+
+/* Construct with the root storage of the MS document, with bImportCode
+ * set the visual basic code will be imported into the stardocument when Import
+ * is called, with bCopyStorage set, the visual basic storage tree will be
+ * copied completely into staroffice, so that any future export to a msoffice
+ * format will retain the vba code, allowing a lossless roundtrip from
+ * msoffice to staroffice and back.
+ *
+ * Setting bAsComment to true in Import will import the visual basic as a
+ * starbasic comment. Which is currently necessary, as vb is not valid sb.
+ *
+ * Setting bStripped will remove the "Attribute" lines from the vb, msoffice
+ * does this itself when it shows the vb code in the vbeditor, so this is
+ * probably what the user expects to see when viewing the code
+ */
+
+class MSFILTER_DLLPUBLIC SvxImportMSVBasic
+{
+public:
+ SvxImportMSVBasic(SfxObjectShell& rDocS, SotStorage& rRoot)
+ : xRoot(&rRoot)
+ , rDocSh(rDocS)
+ {
+ }
+ // only for the export - copy or delete the saved VBA-macro-storage
+ // form the ObjectShell
+ // - returns a warning code if a modified basic exist, in all other
+ // cases return ERRCODE_NONE.
+ ErrCode SaveOrDelMSVBAStorage(bool bSaveInto, const OUString& rStorageName);
+
+ // check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
+ // If it exist, then return the WarningId for losing the information.
+ static ErrCode GetSaveWarningOfMSVBAStorage(SfxObjectShell& rDocS);
+
+ static OUString GetMSBasicStorageName();
+
+private:
+ tools::SvRef<SotStorage> xRoot;
+ SfxObjectShell& rDocSh;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/util.hxx b/include/filter/msfilter/util.hxx
new file mode 100644
index 000000000..3dd7c8884
--- /dev/null
+++ b/include/filter/msfilter/util.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_UTIL_HXX
+#define INCLUDED_FILTER_MSFILTER_UTIL_HXX
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <svx/msdffdef.hxx>
+#include <rtl/string.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/datetime.hxx>
+#include <tools/long.hxx>
+
+class Color;
+
+namespace com::sun::star {
+ namespace awt { struct Size; }
+ namespace lang { struct Locale; }
+}
+
+namespace msfilter::util {
+
+/// Returns the best-fit default 8bit encoding for a given locale
+/// i.e. useful when dealing with legacy formats which use legacy text encodings without recording
+/// what the encoding is, but you know or can guess the language
+MSFILTER_DLLPUBLIC rtl_TextEncoding getBestTextEncodingFromLocale(const css::lang::Locale &rLocale);
+
+/// Convert a color in BGR format to RGB.
+MSFILTER_DLLPUBLIC ::Color BGRToRGB(sal_uInt32 nColour);
+
+/** Convert from DTTM to Writer's DateTime
+ */
+MSFILTER_DLLPUBLIC DateTime DTTM2DateTime( tools::Long lDTTM );
+
+/** Convert DateTime to xsd::dateTime string.
+
+I guess there must be an implementation of this somewhere in LO, but I failed
+to find it, unfortunately :-(
+*/
+
+/// Given a cBullet in encoding r_ioChrSet and fontname r_ioFontName return a
+/// suitable new Bullet and change r_ioChrSet and r_ioFontName to form the
+/// best-fit replacement in terms of default available MSOffice symbol
+/// fonts.
+///
+/// Used to map from [Open|Star]Symbol to some Windows font or other.
+MSFILTER_DLLPUBLIC sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet,
+ rtl_TextEncoding& r_ioChrSet, OUString& r_ioFontName);
+
+
+/**
+ * Converts tools Color to HTML color (without leading hashmark).
+ *
+ * @param rColor color to convert
+ */
+MSFILTER_DLLPUBLIC OString ConvertColor( const Color &rColor );
+MSFILTER_DLLPUBLIC OUString ConvertColorOU( const Color &rColor );
+
+
+/** Paper size in 1/100 millimeters. */
+struct MSFILTER_DLLPUBLIC ApiPaperSize
+{
+ sal_Int32 mnWidth;
+ sal_Int32 mnHeight;
+};
+
+class MSFILTER_DLLPUBLIC PaperSizeConv
+{
+public:
+ static sal_Int32 getMSPaperSizeIndex( const css::awt::Size& rSize );
+ static const ApiPaperSize& getApiSizeForMSPaperSizeIndex( sal_Int32 nMSOPaperIndex );
+};
+
+/**
+ * Finds the quoted text in a field instruction text.
+ *
+ * Example: SEQ "Figure" \someoption -> "Figure"
+ */
+MSFILTER_DLLPUBLIC std::u16string_view findQuotedText( std::u16string_view rCommand, const char* cStartQuote, const sal_Unicode uEndQuote );
+
+class MSFILTER_DLLPUBLIC WW8ReadFieldParams
+{
+private:
+ const OUString aData;
+ sal_Int32 nFnd;
+ sal_Int32 nNext;
+ sal_Int32 nSavPtr;
+public:
+ WW8ReadFieldParams( OUString aData );
+
+ bool GoToTokenParam();
+ sal_Int32 SkipToNextToken();
+ sal_Int32 GetTokenSttPtr() const { return nFnd; }
+
+ sal_Int32 FindNextStringPiece( sal_Int32 _nStart = -1 );
+ bool GetTokenSttFromTo(sal_Int32* _pFrom, sal_Int32* _pTo, sal_Int32 _nMax);
+
+ OUString GetResult() const;
+};
+
+struct MSFILTER_DLLPUBLIC EquationResult
+{
+ OUString sResult;
+ OUString sType;
+};
+
+MSFILTER_DLLPUBLIC EquationResult ParseCombinedChars(const OUString& rStr);
+
+/// Similar to EnhancedCustomShapeTypeNames::Get(), but it also supports OOXML types and returns a drawingML string.
+MSFILTER_DLLPUBLIC OString GetOOXMLPresetGeometry( std::u16string_view rShapeType );
+
+/// Similar to EnhancedCustomShapeTypeNames::Get(), but returns an MSO_SPT (binary / VML type).
+MSFILTER_DLLPUBLIC MSO_SPT GETVMLShapeType(std::u16string_view aType);
+
+/**
+ * The following function checks if a MSO shapetype is allowed to have textboxcontent.
+ *
+ * @param nShapeType shape to check
+ */
+MSFILTER_DLLPUBLIC bool HasTextBoxContent(sal_uInt32 nShapeType);
+
+/**
+ * Convert the input color value to an ico value (0..16)
+ *
+ * @param[in] rCol input color for conversion
+ *
+ * @return ico value [0..16]
+**/
+MSFILTER_DLLPUBLIC sal_uInt8 TransColToIco( const Color& rCol );
+
+}
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/ww8fields.hxx b/include/filter/msfilter/ww8fields.hxx
new file mode 100644
index 000000000..8399fe22e
--- /dev/null
+++ b/include/filter/msfilter/ww8fields.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+namespace ww
+{
+enum eField
+{
+ eNONE = 0,
+ eUNKNOWN = 1,
+ ePOSSIBLEBOOKMARK = 2,
+ eREF = 3,
+ eXE = 4,
+ eFOOTREF = 5,
+ eSET = 6,
+ eIF = 7,
+ eINDEX = 8,
+ eTC = 9,
+ eSTYLEREF = 10,
+ eRD = 11,
+ eSEQ = 12,
+ eTOC = 13,
+ eINFO = 14,
+ eTITLE = 15,
+ eSUBJECT = 16,
+ eAUTHOR = 17,
+ eKEYWORDS = 18,
+ eCOMMENTS = 19,
+ eLASTSAVEDBY = 20,
+ eCREATEDATE = 21,
+ eSAVEDATE = 22,
+ ePRINTDATE = 23,
+ eREVNUM = 24,
+ eEDITTIME = 25,
+ eNUMPAGES = 26,
+ eNUMWORDS = 27,
+ eNUMCHARS = 28,
+ eFILENAME = 29,
+ eTEMPLATE = 30,
+ eDATE = 31,
+ eTIME = 32,
+ ePAGE = 33,
+ eEquals = 34,
+ eQUOTE = 35,
+ eMERGEINC = 36,
+ ePAGEREF = 37,
+ eASK = 38,
+ eFILLIN = 39,
+ eMERGEDATA = 40,
+ eNEXT = 41,
+ eNEXTIF = 42,
+ eSKIPIF = 43,
+ eMERGEREC = 44,
+ eDDEREF = 45,
+ eDDEAUTOREF = 46,
+ eGLOSSREF = 47,
+ ePRINT = 48,
+ eEQ = 49,
+ eGOTOBUTTON = 50,
+ eMACROBUTTON = 51,
+ eAUTONUMOUT = 52,
+ eAUTONUMLGL = 53,
+ eAUTONUM = 54,
+ eINCLUDETIFF = 55,
+ eLINK = 56,
+ eSYMBOL = 57,
+ eEMBED = 58,
+ eMERGEFIELD = 59,
+ eUSERNAME = 60,
+ eUSERINITIALS = 61,
+ eUSERADDRESS = 62,
+ eBARCODE = 63,
+ eDOCVARIABLE = 64,
+ eSECTION = 65,
+ eSECTIONPAGES = 66,
+ eINCLUDEPICTURE = 67,
+ eINCLUDETEXT = 68,
+ eFILESIZE = 69,
+ eFORMTEXT = 70,
+ eFORMCHECKBOX = 71,
+ eNOTEREF = 72,
+ eTOA = 73,
+ eTA = 74,
+ eMERGESEQ = 75,
+ eMACRO = 76,
+ ePRIVATE = 77,
+ eDATABASE = 78,
+ eAUTOTEXT = 79,
+ eCOMPARE = 80,
+ ePLUGIN = 81,
+ eSUBSCRIBER = 82,
+ eFORMDROPDOWN = 83,
+ eADVANCE = 84,
+ eDOCPROPERTY = 85,
+ eUNKNOWN2 = 86,
+ eCONTROL = 87,
+ eHYPERLINK = 88,
+ eAUTOTEXTLIST = 89,
+ eLISTNUM = 90,
+ eHTMLCONTROL = 91,
+ eBIDIOUTLINE = 92,
+ eADDRESSBLOCK = 93,
+ eGREETINGLINE = 94,
+ eSHAPE = 95,
+ // NOTE: values > 95 / 0x5F do not correspond to documented WW8 fields
+ // and thus need special handling in WW8Export::OutputField()!
+ eBIBLIOGRAPHY = 96,
+ eCITATION = 97,
+ eFORMDATE = 98,
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/ExternalReferenceHelper.hxx b/include/formula/ExternalReferenceHelper.hxx
new file mode 100644
index 000000000..364307f63
--- /dev/null
+++ b/include/formula/ExternalReferenceHelper.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_EXTERNALREFERENCEHELPER_HXX
+#define INCLUDED_FORMULA_EXTERNALREFERENCEHELPER_HXX
+
+#include <cstddef>
+
+#include <formula/formuladllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace formula
+{
+ class FORMULA_DLLPUBLIC SAL_NO_VTABLE ExternalReferenceHelper
+ {
+ public:
+ virtual OUString getCacheTableName(sal_uInt16 nFileId, size_t nTabIndex) const = 0;
+
+ protected:
+ ~ExternalReferenceHelper() {}
+ };
+
+} // formula
+
+#endif // INCLUDED_FORMULA_EXTERNALREFERENCEHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
new file mode 100644
index 000000000..08710f561
--- /dev/null
+++ b/include/formula/FormulaCompiler.hxx
@@ -0,0 +1,506 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_FORMULACOMPILER_HXX
+#define INCLUDED_FORMULA_FORMULACOMPILER_HXX
+
+#include <memory>
+#include <unordered_map>
+#include <vector>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <formula/formuladllapi.h>
+#include <formula/grammar.hxx>
+#include <formula/opcode.hxx>
+#include <formula/tokenarray.hxx>
+#include <formula/types.hxx>
+#include <formula/paramclass.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/debug.hxx>
+
+#define FORMULA_MAXJUMPCOUNT 32 /* maximum number of jumps (ocChoose) */
+#define FORMULA_MAXTOKENS 8192 /* maximum number of tokens in formula */
+#define FORMULA_MAXPARAMS 255 /* maximum number of parameters per function (byte) */
+#define FORMULA_MAXPARAMSII 8 /* maximum number of parameters for functions that have implicit intersection ranges */
+
+
+namespace com::sun::star {
+ namespace sheet {
+ struct FormulaOpCodeMapEntry;
+ struct FormulaToken;
+ }
+}
+
+class CharClass;
+enum class FormulaError : sal_uInt16;
+enum class SvNumFormatType : sal_Int16;
+
+namespace formula
+{
+
+struct FormulaArrayStack
+{
+ FormulaArrayStack* pNext;
+ FormulaTokenArray* pArr;
+ FormulaTokenRef mpLastToken;
+ sal_uInt16 nIndex;
+ bool bTemp;
+};
+
+typedef std::unordered_map< OUString, OpCode > OpCodeHashMap;
+typedef std::unordered_map< OUString, OUString > ExternalHashMap;
+
+class FORMULA_DLLPUBLIC FormulaCompiler
+{
+private:
+ FormulaCompiler(const FormulaCompiler&) = delete;
+ FormulaCompiler& operator=(const FormulaCompiler&) = delete;
+public:
+ FormulaCompiler(bool bComputeII = false, bool bMatrixFlag = false);
+ FormulaCompiler(FormulaTokenArray& _rArr, bool bComputeII = false, bool bMatrixFlag = false);
+ virtual ~FormulaCompiler();
+
+ /** Mappings from strings to OpCodes and vice versa. */
+ class FORMULA_DLLPUBLIC OpCodeMap final
+ {
+ OpCodeHashMap maHashMap; /// Hash map of symbols, OUString -> OpCode
+ std::unique_ptr<OUString[]> mpTable; /// Array of symbols, OpCode -> OUString, offset==OpCode
+ ExternalHashMap maExternalHashMap; /// Hash map of ocExternal, Filter String -> AddIn String
+ ExternalHashMap maReverseExternalHashMap; /// Hash map of ocExternal, AddIn String -> Filter String
+ FormulaGrammar::Grammar meGrammar; /// Grammar, language and reference convention
+ sal_uInt16 mnSymbols; /// Count of OpCode symbols
+ bool mbCore : 1; /// If mapping was setup by core, not filters
+ bool mbEnglish : 1; /// If English symbols and external names
+ bool mbEnglishLocale : 1; /// If English locale for numbers
+
+ OpCodeMap( const OpCodeMap& ) = delete;
+ OpCodeMap& operator=( const OpCodeMap& ) = delete;
+
+ public:
+
+ OpCodeMap(sal_uInt16 nSymbols, bool bCore, FormulaGrammar::Grammar eGrammar ) :
+ maHashMap(nSymbols),
+ mpTable( new OUString[ nSymbols ]),
+ meGrammar( eGrammar),
+ mnSymbols( nSymbols),
+ mbCore( bCore),
+ mbEnglish ( FormulaGrammar::isEnglish(eGrammar) ),
+ mbEnglishLocale ( mbEnglish )
+ {
+ }
+
+ /** Copy mappings from r into this map, effectively replacing this map.
+
+ Override known legacy bad function names with
+ correct ones if the conditions can be derived from the
+ current maps.
+ */
+ void copyFrom( const OpCodeMap& r );
+
+ /// Get the symbol String -> OpCode hash map for finds.
+ const OpCodeHashMap& getHashMap() const { return maHashMap; }
+
+ /// Get the symbol String -> AddIn String hash map for finds.
+ const ExternalHashMap& getExternalHashMap() const { return maExternalHashMap; }
+
+ /// Get the AddIn String -> symbol String hash map for finds.
+ const ExternalHashMap& getReverseExternalHashMap() const { return maReverseExternalHashMap; }
+
+ /// Get the symbol string matching an OpCode.
+ const OUString& getSymbol( const OpCode eOp ) const
+ {
+ DBG_ASSERT( sal_uInt16(eOp) < mnSymbols, "OpCodeMap::getSymbol: OpCode out of range");
+ if (sal_uInt16(eOp) < mnSymbols)
+ return mpTable[ eOp ];
+ static OUString s_sEmpty;
+ return s_sEmpty;
+ }
+
+ /// Get the first character of the symbol string matching an OpCode.
+ sal_Unicode getSymbolChar( const OpCode eOp ) const { return getSymbol(eOp)[0]; };
+
+ /// Get the grammar.
+ FormulaGrammar::Grammar getGrammar() const { return meGrammar; }
+
+ /// Get the symbol count.
+ sal_uInt16 getSymbolCount() const { return mnSymbols; }
+
+ /** Are these English symbols, as opposed to native language (which may
+ be English as well)? */
+ bool isEnglish() const { return mbEnglish; }
+
+ /** Are inline numbers parsed/formatted in en-US locale, as opposed
+ to default locale? */
+ bool isEnglishLocale() const { return mbEnglishLocale; }
+
+ /// Is it an ODF 1.1 compatibility mapping?
+ bool isPODF() const { return FormulaGrammar::isPODF( meGrammar); }
+
+ /* TODO: add isAPI() once a FormulaLanguage was added. */
+
+ /// Is it an ODFF / ODF 1.2 mapping?
+ bool isODFF() const { return FormulaGrammar::isODFF( meGrammar); }
+
+ /// Is it an OOXML mapping?
+ bool isOOXML() const { return FormulaGrammar::isOOXML( meGrammar); }
+
+ /// Does it have external symbol/name mappings?
+ bool hasExternals() const { return !maExternalHashMap.empty(); }
+
+ /// Put entry of symbol String and OpCode pair.
+ void putOpCode( const OUString & rStr, const OpCode eOp, const CharClass* pCharClass );
+
+ /// Put entry of symbol String and AddIn international String pair.
+ void putExternal( const OUString & rSymbol, const OUString & rAddIn );
+
+ /** Put entry of symbol String and AddIn international String pair,
+ not warning just info as used for AddIn collection and setting up
+ alias names. */
+ void putExternalSoftly( const OUString & rSymbol, const OUString & rAddIn );
+
+ /// Core implementation of XFormulaOpCodeMapper::getMappings()
+ css::uno::Sequence< css::sheet::FormulaToken >
+ createSequenceOfFormulaTokens(const FormulaCompiler& _rCompiler,
+ const css::uno::Sequence< OUString >& rNames ) const;
+
+ /// Core implementation of XFormulaOpCodeMapper::getAvailableMappings()
+ css::uno::Sequence< css::sheet::FormulaOpCodeMapEntry >
+ createSequenceOfAvailableMappings( const FormulaCompiler& _rCompiler,const sal_Int32 nGroup ) const;
+
+ /** The value used in createSequenceOfAvailableMappings() and thus in
+ XFormulaOpCodeMapper::getMappings() for an unknown symbol. */
+ static sal_Int32 getOpCodeUnknown() { return -1; }
+
+ private:
+
+ /** Conditionally put a mapping in copyFrom() context.
+
+ Does NOT check eOp range!
+ */
+ void putCopyOpCode( const OUString& rSymbol, OpCode eOp );
+ };
+
+public:
+ typedef std::shared_ptr< const OpCodeMap > OpCodeMapPtr;
+ typedef std::shared_ptr< OpCodeMap > NonConstOpCodeMapPtr;
+
+protected:
+ /** Get finalized OpCodeMap for formula language.
+
+ Creates/returns a singleton instance of an OpCodeMap that contains
+ external AddIn mappings if the derived class supports them. Do not call
+ at this base class as it results in a permanent mapping without AddIns
+ even for derived classes (unless it is for the implementation of the
+ temporary GetOpCodeMap()).
+
+ @param nLanguage
+ One of css::sheet::FormulaLanguage constants.
+ @return Map for nLanguage. If nLanguage is unknown, a NULL map is returned.
+ */
+ OpCodeMapPtr GetFinalOpCodeMap( const sal_Int32 nLanguage ) const;
+
+public:
+ /** Get OpCodeMap for formula language.
+
+ Returns either the finalized OpCodeMap (created by GetFinalOpCodeMap()
+ of a derived class) for nLanguage if there is such, or if not then a
+ temporary map of which its singleton is reset immediately and the
+ temporary will get destroyed by the caller's scope. A temporary map
+ created at this base class does *not* contain AddIn mappings.
+
+ @param nLanguage
+ One of css::sheet::FormulaLanguage constants.
+ @return Map for nLanguage. If nLanguage is unknown, a NULL map is returned.
+ */
+ OpCodeMapPtr GetOpCodeMap( const sal_Int32 nLanguage ) const;
+
+ /** Destroy the singleton OpCodeMap for formula language.
+
+ This unconditionally destroys the underlying singleton instance of the
+ map to be reinitialized again later on the next GetOpCodeMap() call.
+ Use if the base class FormulaCompiler::GetOpCodeMap() was called and
+ created the map (i.e. HasOpCodeMap() before returned false) and later a
+ derived class like ScCompiler shall initialize it including AddIns.
+
+ @param nLanguage
+ One of css::sheet::FormulaLanguage constants.
+ */
+ void DestroyOpCodeMap( const sal_Int32 nLanguage );
+
+ /** Whether the singleton OpCodeMap for formula language exists already.
+
+ @param nLanguage
+ One of css::sheet::FormulaLanguage constants.
+ */
+ bool HasOpCodeMap( const sal_Int32 nLanguage ) const;
+
+ /** Create an internal symbol map from API mapping.
+ @param bEnglish
+ Use English number parser / formatter instead of native.
+ */
+ static OpCodeMapPtr CreateOpCodeMap(
+ const css::uno::Sequence< const css::sheet::FormulaOpCodeMapEntry > & rMapping,
+ bool bEnglish );
+
+ /** Get current OpCodeMap in effect. */
+ const OpCodeMapPtr& GetCurrentOpCodeMap() const { return mxSymbols; }
+
+ /** Get OpCode for English symbol.
+ Used in XFunctionAccess to create token array.
+ @param rName
+ Symbol to lookup. MUST be upper case.
+ */
+ OpCode GetEnglishOpCode( const OUString& rName ) const;
+
+ FormulaError GetErrorConstant( const OUString& rName ) const;
+ void AppendErrorConstant( OUStringBuffer& rBuffer, FormulaError nError ) const;
+
+ void EnableJumpCommandReorder( bool bEnable );
+ void EnableStopOnError( bool bEnable );
+
+ static bool IsOpCodeVolatile( OpCode eOp );
+ static bool IsOpCodeJumpCommand( OpCode eOp );
+
+ static bool DeQuote( OUString& rStr );
+
+
+ static const OUString& GetNativeSymbol( OpCode eOp );
+ static sal_Unicode GetNativeSymbolChar( OpCode eOp );
+ static bool IsMatrixFunction(OpCode _eOpCode); // if a function _always_ returns a Matrix
+
+ SvNumFormatType GetNumFormatType() const { return nNumFmt; }
+ bool CompileTokenArray();
+
+ void CreateStringFromTokenArray( OUString& rFormula );
+ void CreateStringFromTokenArray( OUStringBuffer& rBuffer );
+ const FormulaToken* CreateStringFromToken( OUString& rFormula, const FormulaToken* pToken );
+ const FormulaToken* CreateStringFromToken( OUStringBuffer& rBuffer, const FormulaToken* pToken,
+ bool bAllowArrAdvance = false );
+
+ void AppendBoolean( OUStringBuffer& rBuffer, bool bVal ) const;
+ void AppendDouble( OUStringBuffer& rBuffer, double fVal ) const;
+ static void AppendString( OUStringBuffer& rBuffer, const OUString & rStr );
+
+ /** Set symbol map corresponding to one of predefined formula::FormulaGrammar::Grammar,
+ including an address reference convention. */
+ FormulaGrammar::Grammar GetGrammar() const { return meGrammar; }
+
+ /** Whether current symbol set and grammar need transformation of Table
+ structured references to A1 style references when writing / exporting
+ (creating strings).
+ */
+ bool NeedsTableRefTransformation() const;
+
+ /** If a parameter nParam (0-based) is to be forced to array for OpCode
+ eOp, i.e. classified as ParamClass::ForceArray or
+ ParamClass::ReferenceOrForceArray type. */
+ virtual formula::ParamClass GetForceArrayParameter( const FormulaToken* pToken, sal_uInt16 nParam ) const;
+
+ static void UpdateSeparatorsNative( const OUString& rSep, const OUString& rArrayColSep, const OUString& rArrayRowSep );
+ static void ResetNativeSymbols();
+ static void SetNativeSymbols( const OpCodeMapPtr& xMap );
+
+ /** Sets the implicit intersection compute flag */
+ void SetComputeIIFlag(bool bSet) { mbComputeII = bSet; }
+
+ /** Sets the matrix flag for the formula*/
+ void SetMatrixFlag(bool bSet) { mbMatrixFlag = bSet; }
+
+ /** Separators mapped when loading opcodes from the resource, values other
+ than RESOURCE_BASE may override the resource strings. Used by OpCodeList
+ implementation via loadSymbols().
+ */
+ enum class SeparatorType
+ {
+ RESOURCE_BASE,
+ SEMICOLON_BASE
+ };
+
+protected:
+ virtual OUString FindAddInFunction( const OUString& rUpperName, bool bLocalFirst ) const;
+ virtual void fillFromAddInCollectionUpperName( const NonConstOpCodeMapPtr& xMap ) const;
+ virtual void fillFromAddInMap( const NonConstOpCodeMapPtr& xMap, FormulaGrammar::Grammar _eGrammar ) const;
+ virtual void fillFromAddInCollectionEnglishName( const NonConstOpCodeMapPtr& xMap ) const;
+ virtual void fillAddInToken(::std::vector< css::sheet::FormulaOpCodeMapEntry >& _rVec, bool _bIsEnglish) const;
+
+ virtual void SetError(FormulaError nError);
+ virtual FormulaTokenRef ExtendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2 );
+ virtual bool HandleExternalReference(const FormulaToken& _aToken);
+ virtual bool HandleRange();
+ virtual bool HandleColRowName();
+ virtual bool HandleDbData();
+ virtual bool HandleTableRef();
+
+ virtual void CreateStringFromExternal( OUStringBuffer& rBuffer, const FormulaToken* pToken ) const;
+ virtual void CreateStringFromSingleRef( OUStringBuffer& rBuffer, const FormulaToken* pToken ) const;
+ virtual void CreateStringFromDoubleRef( OUStringBuffer& rBuffer, const FormulaToken* pToken ) const;
+ virtual void CreateStringFromMatrix( OUStringBuffer& rBuffer, const FormulaToken* pToken ) const;
+ virtual void CreateStringFromIndex( OUStringBuffer& rBuffer, const FormulaToken* pToken ) const;
+ virtual void LocalizeString( OUString& rName ) const; // modify rName - input: exact name
+
+ bool GetToken();
+ OpCode NextToken();
+ void PutCode( FormulaTokenRef& );
+ void Factor();
+ void RangeLine();
+ void UnionLine();
+ void IntersectionLine();
+ void UnaryLine();
+ void PostOpLine();
+ void PowLine();
+ void MulDivLine();
+ void AddSubLine();
+ void ConcatLine();
+ void CompareLine();
+ OpCode Expression();
+ void PopTokenArray();
+ void PushTokenArray( FormulaTokenArray*, bool );
+
+ bool MergeRangeReference( FormulaToken * * const pCode1, FormulaToken * const * const pCode2 );
+
+ // Returns whether the opcode has implicit intersection ranges as parameters.
+ // Called for (most) opcodes to possibly handle implicit intersection for the parameters.
+ virtual void HandleIIOpCode(FormulaToken* /*token*/,
+ FormulaToken*** /*pppToken*/, sal_uInt8 /*nNumParams*/) {}
+
+ // Called from CompileTokenArray() after RPN code generation is done.
+ virtual void PostProcessCode() {}
+
+ virtual void AnnotateOperands() {}
+
+ OUString aCorrectedFormula; // autocorrected Formula
+ OUString aCorrectedSymbol; // autocorrected Symbol
+
+ OpCodeMapPtr mxSymbols; // which symbols are used
+
+ FormulaTokenRef mpToken; // current token
+ FormulaTokenRef pCurrentFactorToken; // current factor token (of Factor() method)
+ sal_uInt16 nCurrentFactorParam; // current factor token's parameter, 1-based
+ FormulaTokenArray* pArr;
+ FormulaTokenArrayPlainIterator maArrIterator;
+ FormulaTokenRef mpLastToken; // last token
+
+ FormulaToken** pCode;
+ FormulaArrayStack* pStack;
+
+ OpCode eLastOp;
+ short nRecursion; // GetToken() recursions
+ SvNumFormatType nNumFmt; // set during CompileTokenArray()
+ sal_uInt16 pc; // program counter
+
+ FormulaGrammar::Grammar meGrammar; // The grammar used, language plus convention.
+
+ bool bAutoCorrect; // whether to apply AutoCorrection
+ bool bCorrected; // AutoCorrection was applied
+ bool glSubTotal; // if code contains one or more subtotal functions
+ bool needsRPNTokenCheck; // whether to make FormulaTokenArray check all tokens at the end
+
+ bool mbJumpCommandReorder; /// Whether or not to reorder RPN for jump commands.
+ bool mbStopOnError; /// Whether to stop compilation on first encountered error.
+
+ bool mbComputeII; // whether to attempt computing implicit intersection ranges while building the RPN array.
+ bool mbMatrixFlag; // whether the formula is a matrix formula (needed for II computation)
+
+public:
+ enum InitSymbols
+ {
+ ASK = 0,
+ INIT,
+ DESTROY
+ };
+
+private:
+ bool InitSymbolsNative( InitSymbols ) const; /// only SymbolsNative, on first document creation
+ bool InitSymbolsEnglish( InitSymbols ) const; /// only SymbolsEnglish, maybe later
+ bool InitSymbolsPODF( InitSymbols ) const; /// only SymbolsPODF, on demand
+ bool InitSymbolsAPI( InitSymbols ) const; /// only SymbolsAPI, on demand
+ bool InitSymbolsODFF( InitSymbols ) const; /// only SymbolsODFF, on demand
+ bool InitSymbolsEnglishXL( InitSymbols ) const; /// only SymbolsEnglishXL, on demand
+ bool InitSymbolsOOXML( InitSymbols ) const; /// only SymbolsOOXML, on demand
+
+ void loadSymbols(const std::pair<const char*, int>* pSymbols, FormulaGrammar::Grammar eGrammar, NonConstOpCodeMapPtr& rxMap,
+ SeparatorType eSepType = SeparatorType::SEMICOLON_BASE) const;
+
+ /** Check pCurrentFactorToken for nParam's (0-based) ForceArray types and
+ set ForceArray at rCurr if so. Set nParam+1 as 1-based
+ nCurrentFactorParam for subsequent ForceArrayOperator() calls.
+ */
+ void CheckSetForceArrayParameter( FormulaTokenRef const & rCurr, sal_uInt8 nParam );
+
+ void ForceArrayOperator( FormulaTokenRef const & rCurr );
+
+ class CurrentFactor
+ {
+ FormulaTokenRef pPrevFac;
+ sal_uInt16 nPrevParam;
+ FormulaCompiler* pCompiler;
+ CurrentFactor( const CurrentFactor& ) = delete;
+ CurrentFactor& operator=( const CurrentFactor& ) = delete;
+ public:
+ explicit CurrentFactor( FormulaCompiler* pComp )
+ : pPrevFac( pComp->pCurrentFactorToken )
+ , nPrevParam( pComp->nCurrentFactorParam )
+ , pCompiler( pComp )
+ {}
+ ~CurrentFactor()
+ {
+ pCompiler->pCurrentFactorToken = pPrevFac;
+ pCompiler->nCurrentFactorParam = nPrevParam;
+ }
+ // yes, this operator= may modify the RValue
+ void operator=( FormulaTokenRef const & r )
+ {
+ pCompiler->ForceArrayOperator( r );
+ pCompiler->pCurrentFactorToken = r;
+ pCompiler->nCurrentFactorParam = 0;
+ }
+ void operator=( FormulaToken* p )
+ {
+ FormulaTokenRef xTemp( p );
+ *this = xTemp;
+ }
+ operator FormulaTokenRef&()
+ { return pCompiler->pCurrentFactorToken; }
+ FormulaToken* operator->()
+ { return pCompiler->pCurrentFactorToken.operator->(); }
+ operator FormulaToken*()
+ { return operator->(); }
+ };
+
+
+ mutable NonConstOpCodeMapPtr mxSymbolsODFF; // ODFF symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsPODF; // ODF 1.1 symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsAPI; // XFunctionAccess API symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsNative; // native symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsEnglish; // English symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsEnglishXL; // English Excel symbols (for VBA formula parsing)
+ mutable NonConstOpCodeMapPtr mxSymbolsOOXML; // Excel OOXML symbols
+
+ static FormulaTokenArray smDummyTokenArray;
+};
+
+} // formula
+
+
+#endif // INCLUDED_FORMULA_FORMULACOMPILER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/FormulaOpCodeMapperObj.hxx b/include/formula/FormulaOpCodeMapperObj.hxx
new file mode 100644
index 000000000..7e5928a1b
--- /dev/null
+++ b/include/formula/FormulaOpCodeMapperObj.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_FORMULAOPCODEMAPPEROBJ_HXX
+#define INCLUDED_FORMULA_FORMULAOPCODEMAPPEROBJ_HXX
+
+#include <memory>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <formula/formuladllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace sheet { struct FormulaOpCodeMapEntry; }
+ namespace sheet { struct FormulaToken; }
+ namespace uno { class XComponentContext; }
+ namespace uno { class XInterface; }
+}
+
+namespace formula
+{
+
+class FormulaCompiler;
+
+class FORMULA_DLLPUBLIC FormulaOpCodeMapperObj : public cppu::WeakImplHelper<
+ css::sheet::XFormulaOpCodeMapper,
+ css::lang::XServiceInfo >
+{
+ ::std::unique_ptr<FormulaCompiler> m_pCompiler;
+
+public:
+ FormulaOpCodeMapperObj(::std::unique_ptr<FormulaCompiler> && _pCompiler);
+ virtual ~FormulaOpCodeMapperObj() override;
+
+private:
+ // XFormulaOpCodeMapper
+ // Attributes
+ virtual ::sal_Int32 SAL_CALL getOpCodeExternal() override;
+ virtual ::sal_Int32 SAL_CALL getOpCodeUnknown() override;
+ // Methods
+ virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getMappings(
+ const css::uno::Sequence< OUString >& rNames,
+ sal_Int32 nLanguage ) override;
+ virtual css::uno::Sequence< css::sheet::FormulaOpCodeMapEntry > SAL_CALL getAvailableMappings(
+ sal_Int32 nLanguage, sal_Int32 nGroups ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+};
+
+} // formula
+
+
+#endif // INCLUDED_FORMULA_FORMULAOPCODEMAPPEROBJ_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/IControlReferenceHandler.hxx b/include/formula/IControlReferenceHandler.hxx
new file mode 100644
index 000000000..e1096c47a
--- /dev/null
+++ b/include/formula/IControlReferenceHandler.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_FORMULA_ICONTROLREFERENCEHANDLER_HXX
+#define INCLUDED_FORMULA_ICONTROLREFERENCEHANDLER_HXX
+
+#include <formula/formuladllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace formula
+{
+ class RefEdit;
+ class RefButton;
+ class FORMULA_DLLPUBLIC SAL_NO_VTABLE IControlReferenceHandler
+ {
+ public:
+ virtual void ShowReference(const OUString& _sRef) = 0;
+ virtual void HideReference( bool bDoneRefMode = true ) = 0;
+ virtual void ReleaseFocus( RefEdit* pEdit ) = 0;
+ virtual void ToggleCollapsed( RefEdit* pEdit, RefButton* pButton ) = 0;
+
+ protected:
+ ~IControlReferenceHandler() {}
+ };
+} // formula
+#endif // INCLUDED_FORMULA_ICONTROLREFERENCEHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/IFunctionDescription.hxx b/include/formula/IFunctionDescription.hxx
new file mode 100644
index 000000000..28f293704
--- /dev/null
+++ b/include/formula/IFunctionDescription.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_IFUNCTIONDESCRIPTION_HXX
+#define INCLUDED_FORMULA_IFUNCTIONDESCRIPTION_HXX
+
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace sheet { struct FormulaToken; }
+ namespace sheet { class XFormulaOpCodeMapper; }
+ namespace sheet { class XFormulaParser; }
+}
+
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+namespace formula
+{
+ class IFunctionCategory;
+ class IFunctionDescription;
+ class FormEditData;
+ class FormulaTokenArray;
+ class FormulaCompiler;
+
+ class SAL_NO_VTABLE IFunctionManager
+ {
+ public:
+ enum EToken
+ {
+ eOk,
+ eClose,
+ eSep,
+ eArrayOpen,
+ eArrayClose
+ };
+ virtual sal_uInt32 getCount() const = 0;
+ virtual const IFunctionCategory* getCategory(sal_uInt32 nPos) const = 0;
+ virtual void fillLastRecentlyUsedFunctions(::std::vector< const IFunctionDescription*>& _rLastRUFunctions) const = 0;
+
+ virtual sal_Unicode getSingleToken(const EToken _eToken) const = 0;
+
+ protected:
+ ~IFunctionManager() {}
+ };
+
+ class SAL_NO_VTABLE IFunctionCategory
+ {
+ public:
+ virtual sal_uInt32 getCount() const = 0;
+ virtual const IFunctionDescription* getFunction(sal_uInt32 _nPos) const = 0;
+ virtual sal_uInt32 getNumber() const = 0;
+ virtual OUString getName() const = 0;
+
+ protected:
+ ~IFunctionCategory() {}
+ };
+
+ class SAL_NO_VTABLE IFunctionDescription
+ {
+ public:
+ virtual OUString getFunctionName() const = 0;
+ virtual const IFunctionCategory* getCategory() const = 0;
+ virtual OUString getDescription() const = 0;
+ // GetSuppressedArgCount
+ virtual sal_Int32 getSuppressedArgumentCount() const = 0;
+ // GetFormulaString
+ virtual OUString getFormula(const ::std::vector< OUString >& _aArguments) const = 0;
+ // GetVisibleArgMapping
+ virtual void fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const = 0;
+ virtual void initArgumentInfo() const = 0;
+ virtual OUString getSignature() const = 0;
+ virtual OString getHelpId() const = 0;
+ virtual bool isHidden() const = 0;
+
+ // parameter
+ virtual sal_uInt32 getParameterCount() const = 0;
+ virtual sal_uInt32 getVarArgsStart() const = 0;
+ virtual sal_uInt32 getVarArgsLimit() const = 0;
+ virtual OUString getParameterName(sal_uInt32 _nPos) const = 0;
+ virtual OUString getParameterDescription(sal_uInt32 _nPos) const = 0;
+ virtual bool isParameterOptional(sal_uInt32 _nPos) const = 0;
+
+ protected:
+ ~IFunctionDescription() {}
+ };
+
+ class SAL_NO_VTABLE IFormulaEditorHelper
+ {
+ public:
+ virtual void notifyChange() = 0;
+ virtual void fill() = 0;
+
+ virtual OUString getCurrentFormula() const = 0;
+ virtual void setCurrentFormula(const OUString& _sReplacement) = 0;
+
+ virtual void getSelection(sal_Int32& _nStart, sal_Int32& _nEnd) const = 0;
+ virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) = 0;
+
+ virtual FormEditData* getFormEditData() const = 0;
+ virtual bool calculateValue(const OUString& _sExpression, OUString& _rResult, bool bMatrixFormula) = 0;
+
+ /** Obtain a resident FormulaCompiler instance, created without
+ FormulaTokenArray and reused but being application specific derived.
+ */
+ virtual std::shared_ptr<FormulaCompiler> getCompiler() const = 0;
+
+ /** Create an application specific FormulaCompiler instance with
+ FormulaTokenArray. The FormulaTokenArray had to be created using
+ convertToTokenArray().
+ */
+ virtual std::unique_ptr<FormulaCompiler> createCompiler( FormulaTokenArray& rArray ) const = 0;
+
+ virtual void switchBack() = 0;
+
+ virtual void clear() = 0;
+ virtual void deleteFormData() = 0;
+
+ virtual IFunctionManager* getFunctionManager() = 0;
+ virtual ::std::unique_ptr<FormulaTokenArray> convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken >& _aTokenList) = 0;
+
+ virtual css::uno::Reference< css::sheet::XFormulaParser> getFormulaParser() const = 0;
+ virtual css::uno::Reference< css::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0;
+ virtual css::table::CellAddress getReferencePosition() const = 0;
+
+ virtual void setDispatcherLock( bool bLock ) = 0;
+ virtual void dispatch(bool _bOK, bool _bMatrixChecked) = 0;
+ virtual void doClose(bool _bOk) = 0;
+ virtual void insertEntryToLRUList(const IFunctionDescription* pDesc) = 0;
+ virtual void showReference(const OUString& _sFormula) = 0;
+
+ protected:
+ ~IFormulaEditorHelper() {}
+ };
+
+}
+#endif // INCLUDED_FORMULA_IFUNCTIONDESCRIPTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/compiler.hxx b/include/formula/compiler.hxx
new file mode 100644
index 000000000..fcf7326d3
--- /dev/null
+++ b/include/formula/compiler.hxx
@@ -0,0 +1,531 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_COMPILER_HXX
+#define FORMULA_COMPILER_HXX
+
+/* Central definition of OpCodes for spreadsheet functions */
+
+/*** Special commands ***/
+#define SC_OPCODE_PUSH 0 /* internal commands */
+#define SC_OPCODE_CALL 1
+#define SC_OPCODE_STOP 2
+#define SC_OPCODE_EXTERNAL 3
+#define SC_OPCODE_NAME 4
+#define SC_OPCODE_EXTERNAL_REF 5
+#define SC_OPCODE_IF 6 /* jump commands */
+#define SC_OPCODE_IF_ERROR 7
+#define SC_OPCODE_IF_NA 8
+#define SC_OPCODE_CHOOSE 9
+#define SC_OPCODE_OPEN 10 /* parentheses and separators */
+#define SC_OPCODE_CLOSE 11
+#define SC_OPCODE_SEP 12
+#define SC_OPCODE_MISSING 13 /* special OpCodes */
+#define SC_OPCODE_BAD 14
+#define SC_OPCODE_STRINGXML 15
+#define SC_OPCODE_SPACES 16
+#define SC_OPCODE_WHITESPACE 17
+#define SC_OPCODE_MAT_REF 18
+#define SC_OPCODE_DB_AREA 19 /* additional access operators */
+#define SC_OPCODE_TABLE_REF 20
+#define SC_OPCODE_MACRO 21
+#define SC_OPCODE_COL_ROW_NAME 22
+#define SC_OPCODE_COL_ROW_NAME_AUTO 23
+#define SC_OPCODE_PERCENT_SIGN 24 /* operator _follows_ value */
+#define SC_OPCODE_ARRAY_OPEN 25
+#define SC_OPCODE_ARRAY_CLOSE 26
+#define SC_OPCODE_ARRAY_ROW_SEP 27
+#define SC_OPCODE_ARRAY_COL_SEP 28 /* some convs use sep != col_sep */
+#define SC_OPCODE_TABLE_REF_OPEN 29
+#define SC_OPCODE_TABLE_REF_CLOSE 30
+#define SC_OPCODE_TABLE_REF_ITEM_ALL 31
+#define SC_OPCODE_TABLE_REF_ITEM_HEADERS 32
+#define SC_OPCODE_TABLE_REF_ITEM_DATA 33
+#define SC_OPCODE_TABLE_REF_ITEM_TOTALS 34
+#define SC_OPCODE_TABLE_REF_ITEM_THIS_ROW 35
+#define SC_OPCODE_STOP_DIV 36
+#define SC_OPCODE_SKIP 37 /* used to skip raw tokens during string compilation */
+
+/*** error constants #... ***/
+#define SC_OPCODE_START_ERRORS 40
+#define SC_OPCODE_ERROR_NULL 40
+#define SC_OPCODE_ERROR_DIVZERO 41
+#define SC_OPCODE_ERROR_VALUE 42
+#define SC_OPCODE_ERROR_REF 43
+#define SC_OPCODE_ERROR_NAME 44
+#define SC_OPCODE_ERROR_NUM 45
+#define SC_OPCODE_ERROR_NA 46
+#define SC_OPCODE_STOP_ERRORS 47
+
+/*** Binary operators ***/
+#define SC_OPCODE_START_BIN_OP 50
+#define SC_OPCODE_ADD 50
+#define SC_OPCODE_SUB 51
+#define SC_OPCODE_MUL 52
+#define SC_OPCODE_DIV 53
+#define SC_OPCODE_AMPERSAND 54
+#define SC_OPCODE_POW 55
+#define SC_OPCODE_EQUAL 56
+#define SC_OPCODE_NOT_EQUAL 57
+#define SC_OPCODE_LESS 58
+#define SC_OPCODE_GREATER 59
+#define SC_OPCODE_LESS_EQUAL 60
+#define SC_OPCODE_GREATER_EQUAL 61
+#define SC_OPCODE_AND 62
+#define SC_OPCODE_OR 63
+#define SC_OPCODE_INTERSECT 64
+#define SC_OPCODE_UNION 65
+#define SC_OPCODE_RANGE 66
+#define SC_OPCODE_STOP_BIN_OP 67
+
+/* NOTE: binary and unary operators must be in sequence for compiler! */
+
+/*** Unary operators ***/
+#define SC_OPCODE_START_UN_OP 70
+#define SC_OPCODE_NEG_SUB 70
+#define SC_OPCODE_STOP_UN_OP 71
+
+#define SC_OPCODE_START_FUNCTION 75
+
+/*** Functions without parameters ***/
+#define SC_OPCODE_START_NO_PAR 75
+#define SC_OPCODE_PI 75
+#define SC_OPCODE_RANDOM 76
+#define SC_OPCODE_TRUE 77
+#define SC_OPCODE_FALSE 78
+#define SC_OPCODE_GET_ACT_DATE 79
+#define SC_OPCODE_GET_ACT_TIME 80
+#define SC_OPCODE_NO_VALUE 81
+#define SC_OPCODE_CURRENT 82
+#define SC_OPCODE_RANDOM_NV 83
+#define SC_OPCODE_STOP_NO_PAR 84
+
+/*** Functions with one parameter ***/
+#define SC_OPCODE_START_1_PAR 90
+#define SC_OPCODE_DEG 90 /* trigonometric */
+#define SC_OPCODE_RAD 91
+#define SC_OPCODE_SIN 92
+#define SC_OPCODE_COS 93
+#define SC_OPCODE_TAN 94
+#define SC_OPCODE_COT 95
+#define SC_OPCODE_ARC_SIN 96
+#define SC_OPCODE_ARC_COS 97
+#define SC_OPCODE_ARC_TAN 98
+#define SC_OPCODE_ARC_COT 99
+#define SC_OPCODE_SIN_HYP 100
+#define SC_OPCODE_COS_HYP 101
+#define SC_OPCODE_TAN_HYP 102
+#define SC_OPCODE_COT_HYP 103
+#define SC_OPCODE_ARC_SIN_HYP 104 /* transcendent */
+#define SC_OPCODE_ARC_COS_HYP 105
+#define SC_OPCODE_ARC_TAN_HYP 106
+#define SC_OPCODE_ARC_COT_HYP 107
+#define SC_OPCODE_COSECANT 108
+#define SC_OPCODE_SECANT 109
+#define SC_OPCODE_COSECANT_HYP 110
+#define SC_OPCODE_SECANT_HYP 111
+#define SC_OPCODE_EXP 112
+#define SC_OPCODE_LN 113
+#define SC_OPCODE_SQRT 114
+#define SC_OPCODE_FACT 115
+#define SC_OPCODE_GET_YEAR 116 /* date and time */
+#define SC_OPCODE_GET_MONTH 117
+#define SC_OPCODE_GET_DAY 118
+#define SC_OPCODE_GET_HOUR 119
+#define SC_OPCODE_GET_MIN 120
+#define SC_OPCODE_GET_SEC 121
+#define SC_OPCODE_PLUS_MINUS 122 /* miscellaneous */
+#define SC_OPCODE_ABS 123
+#define SC_OPCODE_INT 124
+#define SC_OPCODE_PHI 125
+#define SC_OPCODE_GAUSS 126
+#define SC_OPCODE_IS_EMPTY 127 /* obtain type */
+#define SC_OPCODE_IS_STRING 128
+#define SC_OPCODE_IS_NON_STRING 129
+#define SC_OPCODE_IS_LOGICAL 130
+#define SC_OPCODE_TYPE 131
+#define SC_OPCODE_IS_REF 132
+#define SC_OPCODE_IS_VALUE 133
+#define SC_OPCODE_IS_FORMULA 134
+#define SC_OPCODE_IS_NV 135
+#define SC_OPCODE_IS_ERR 136
+#define SC_OPCODE_IS_ERROR 137
+#define SC_OPCODE_IS_EVEN 138
+#define SC_OPCODE_IS_ODD 139
+#define SC_OPCODE_N 140
+#define SC_OPCODE_GET_DATE_VALUE 141 /* string functions */
+#define SC_OPCODE_GET_TIME_VALUE 142
+#define SC_OPCODE_CODE 143
+#define SC_OPCODE_TRIM 144
+#define SC_OPCODE_UPPER 145
+#define SC_OPCODE_PROPER 146
+#define SC_OPCODE_LOWER 147
+#define SC_OPCODE_LEN 148
+#define SC_OPCODE_T 149 /* miscellaneous, part 21 */
+#define SC_OPCODE_VALUE 150
+#define SC_OPCODE_CLEAN 151
+#define SC_OPCODE_CHAR 152
+#define SC_OPCODE_LOG10 153
+#define SC_OPCODE_EVEN 154
+#define SC_OPCODE_ODD 155
+#define SC_OPCODE_STD_NORM_DIST 156
+#define SC_OPCODE_FISHER 157
+#define SC_OPCODE_FISHER_INV 158
+#define SC_OPCODE_S_NORM_INV 159
+#define SC_OPCODE_GAMMA_LN 160
+#define SC_OPCODE_ERROR_TYPE 161
+#define SC_OPCODE_FORMULA 163
+#define SC_OPCODE_ARABIC 164
+#define SC_OPCODE_INFO 165
+#define SC_OPCODE_BAHTTEXT 166
+#define SC_OPCODE_JIS 167
+#define SC_OPCODE_ASC 168
+#define SC_OPCODE_UNICODE 169
+#define SC_OPCODE_UNICHAR 170
+#define SC_OPCODE_GAMMA 171
+#define SC_OPCODE_GAMMA_LN_MS 172
+#define SC_OPCODE_ERF_MS 173
+#define SC_OPCODE_ERFC_MS 174
+#define SC_OPCODE_ERROR_TYPE_ODF 175
+#define SC_OPCODE_ENCODEURL 176
+#define SC_OPCODE_ISOWEEKNUM 177
+#define SC_OPCODE_NOT 178
+#define SC_OPCODE_NEG 179
+#define SC_OPCODE_STOP_1_PAR 180
+
+/*** Functions with more than one parameters ***/
+#define SC_OPCODE_START_2_PAR 201
+#define SC_OPCODE_ARC_TAN_2 201
+#define SC_OPCODE_CEIL 202
+#define SC_OPCODE_FLOOR 203
+#define SC_OPCODE_ROUND 204
+#define SC_OPCODE_ROUND_UP 205
+#define SC_OPCODE_ROUND_DOWN 206
+#define SC_OPCODE_TRUNC 207
+#define SC_OPCODE_LOG 208
+#define SC_OPCODE_POWER 209
+#define SC_OPCODE_GCD 210
+#define SC_OPCODE_LCM 211
+#define SC_OPCODE_MOD 212
+#define SC_OPCODE_SUM_PRODUCT 213
+#define SC_OPCODE_SUM_SQ 214
+#define SC_OPCODE_SUM_X2MY2 215
+#define SC_OPCODE_SUM_X2DY2 216
+#define SC_OPCODE_SUM_XMY2 217
+#define SC_OPCODE_GET_DATE 218
+#define SC_OPCODE_GET_TIME 219
+#define SC_OPCODE_GET_DIFF_DATE 220
+#define SC_OPCODE_GET_DIFF_DATE_360 221
+#define SC_OPCODE_MIN 222
+#define SC_OPCODE_MAX 223
+#define SC_OPCODE_SUM 224
+#define SC_OPCODE_PRODUCT 225
+#define SC_OPCODE_AVERAGE 226
+#define SC_OPCODE_COUNT 227
+#define SC_OPCODE_COUNT_2 228
+#define SC_OPCODE_NPV 229
+#define SC_OPCODE_IRR 230
+#define SC_OPCODE_VAR 231
+#define SC_OPCODE_VAR_P 232
+#define SC_OPCODE_ST_DEV 233
+#define SC_OPCODE_ST_DEV_P 234
+#define SC_OPCODE_B 235
+#define SC_OPCODE_NORM_DIST 236
+#define SC_OPCODE_EXP_DIST 237
+#define SC_OPCODE_BINOM_DIST 238
+#define SC_OPCODE_POISSON_DIST 239
+#define SC_OPCODE_COMBIN 240
+#define SC_OPCODE_COMBIN_A 241
+#define SC_OPCODE_PERMUT 242
+#define SC_OPCODE_PERMUTATION_A 243
+#define SC_OPCODE_PV 244
+#define SC_OPCODE_SYD 245
+#define SC_OPCODE_DDB 246
+#define SC_OPCODE_DB 247
+#define SC_OPCODE_VBD 248
+#define SC_OPCODE_PDURATION 249
+#define SC_OPCODE_SLN 250
+#define SC_OPCODE_PMT 251
+#define SC_OPCODE_COLUMNS 252
+#define SC_OPCODE_ROWS 253
+#define SC_OPCODE_COLUMN 254
+#define SC_OPCODE_ROW 255
+#define SC_OPCODE_RRI 256
+#define SC_OPCODE_FV 257
+#define SC_OPCODE_NPER 258
+#define SC_OPCODE_RATE 259
+#define SC_OPCODE_IPMT 260
+#define SC_OPCODE_PPMT 261
+#define SC_OPCODE_CUM_IPMT 262
+#define SC_OPCODE_CUM_PRINC 263
+#define SC_OPCODE_EFFECT 264
+#define SC_OPCODE_NOMINAL 265
+#define SC_OPCODE_SUB_TOTAL 266
+#define SC_OPCODE_DB_SUM 267 /* database functions */
+#define SC_OPCODE_DB_COUNT 268
+#define SC_OPCODE_DB_COUNT_2 269
+#define SC_OPCODE_DB_AVERAGE 270
+#define SC_OPCODE_DB_GET 271
+#define SC_OPCODE_DB_MAX 272
+#define SC_OPCODE_DB_MIN 273
+#define SC_OPCODE_DB_PRODUCT 274
+#define SC_OPCODE_DB_STD_DEV 275
+#define SC_OPCODE_DB_STD_DEV_P 276
+#define SC_OPCODE_DB_VAR 277
+#define SC_OPCODE_DB_VAR_P 278
+#define SC_OPCODE_INDIRECT 279 /* management functions */
+#define SC_OPCODE_ADDRESS 280
+#define SC_OPCODE_MATCH 281
+#define SC_OPCODE_COUNT_EMPTY_CELLS 282
+#define SC_OPCODE_COUNT_IF 283
+#define SC_OPCODE_SUM_IF 284
+#define SC_OPCODE_LOOKUP 285
+#define SC_OPCODE_V_LOOKUP 286
+#define SC_OPCODE_H_LOOKUP 287
+#define SC_OPCODE_MULTI_AREA 288
+#define SC_OPCODE_OFFSET 289
+#define SC_OPCODE_INDEX 290
+#define SC_OPCODE_AREAS 291
+#define SC_OPCODE_CURRENCY 292 /* string functions */
+#define SC_OPCODE_REPLACE 293
+#define SC_OPCODE_FIXED 294
+#define SC_OPCODE_FIND 295
+#define SC_OPCODE_EXACT 296
+#define SC_OPCODE_LEFT 297
+#define SC_OPCODE_RIGHT 298
+#define SC_OPCODE_SEARCH 299
+#define SC_OPCODE_MID 300
+#define SC_OPCODE_TEXT 301
+#define SC_OPCODE_SUBSTITUTE 302
+#define SC_OPCODE_REPT 303
+#define SC_OPCODE_CONCAT 304
+#define SC_OPCODE_MAT_VALUE 305 /* matrix functions */
+#define SC_OPCODE_MAT_DET 306
+#define SC_OPCODE_MAT_INV 307
+#define SC_OPCODE_MAT_MULT 308
+#define SC_OPCODE_MAT_TRANS 309
+#define SC_OPCODE_MATRIX_UNIT 310
+#define SC_OPCODE_BACK_SOLVER 311 /* BackSolver */
+#define SC_OPCODE_HYP_GEOM_DIST 312 /* statistical functions */
+#define SC_OPCODE_LOG_NORM_DIST 313
+#define SC_OPCODE_T_DIST 314
+#define SC_OPCODE_F_DIST 315
+#define SC_OPCODE_CHI_DIST 316
+#define SC_OPCODE_WEIBULL 317
+#define SC_OPCODE_NEG_BINOM_VERT 318
+#define SC_OPCODE_CRIT_BINOM 319
+#define SC_OPCODE_KURT 320
+#define SC_OPCODE_HAR_MEAN 321
+#define SC_OPCODE_GEO_MEAN 322
+#define SC_OPCODE_STANDARD 323
+#define SC_OPCODE_AVE_DEV 324
+#define SC_OPCODE_SKEW 325
+#define SC_OPCODE_DEV_SQ 326
+#define SC_OPCODE_MEDIAN 327
+#define SC_OPCODE_MODAL_VALUE 328
+#define SC_OPCODE_Z_TEST 329
+#define SC_OPCODE_T_TEST 330
+#define SC_OPCODE_RANK 331
+#define SC_OPCODE_PERCENTILE 332
+#define SC_OPCODE_PERCENT_RANK 333
+#define SC_OPCODE_LARGE 334
+#define SC_OPCODE_SMALL 335
+#define SC_OPCODE_FREQUENCY 336
+#define SC_OPCODE_QUARTILE 337
+#define SC_OPCODE_NORM_INV 338
+#define SC_OPCODE_CONFIDENCE 339
+#define SC_OPCODE_F_TEST 340
+#define SC_OPCODE_TRIM_MEAN 341
+#define SC_OPCODE_PROB 342
+#define SC_OPCODE_CORREL 343
+#define SC_OPCODE_COVAR 344
+#define SC_OPCODE_PEARSON 345
+#define SC_OPCODE_RSQ 346
+#define SC_OPCODE_STEYX 347
+#define SC_OPCODE_SLOPE 348
+#define SC_OPCODE_INTERCEPT 349
+#define SC_OPCODE_TREND 350
+#define SC_OPCODE_GROWTH 351
+#define SC_OPCODE_LINEST 352
+#define SC_OPCODE_LOGEST 353
+#define SC_OPCODE_FORECAST 354
+#define SC_OPCODE_CHI_INV 355
+#define SC_OPCODE_GAMMA_DIST 356
+#define SC_OPCODE_GAMMA_INV 357
+#define SC_OPCODE_T_INV 358
+#define SC_OPCODE_F_INV 359
+#define SC_OPCODE_CHI_TEST 360
+#define SC_OPCODE_LOG_INV 361
+#define SC_OPCODE_TABLE_OP 362
+#define SC_OPCODE_BETA_DIST 363
+#define SC_OPCODE_BETA_INV 364
+#define SC_OPCODE_WEEK 365 /* miscellaneous */
+#define SC_OPCODE_GET_DAY_OF_WEEK 366
+#define SC_OPCODE_NO_NAME 367
+#define SC_OPCODE_STYLE 368
+#define SC_OPCODE_DDE 369
+#define SC_OPCODE_BASE 370
+#define SC_OPCODE_SHEET 371
+#define SC_OPCODE_SHEETS 372
+#define SC_OPCODE_MIN_A 373
+#define SC_OPCODE_MAX_A 374
+#define SC_OPCODE_AVERAGE_A 375
+#define SC_OPCODE_ST_DEV_A 376
+#define SC_OPCODE_ST_DEV_P_A 377
+#define SC_OPCODE_VAR_A 378
+#define SC_OPCODE_VAR_P_A 379
+#define SC_OPCODE_EASTERSUNDAY 380
+#define SC_OPCODE_DECIMAL 381
+#define SC_OPCODE_CONVERT_OOO 382
+#define SC_OPCODE_ROMAN 383
+#define SC_OPCODE_MIRR 384
+#define SC_OPCODE_CELL 385
+#define SC_OPCODE_ISPMT 386
+#define SC_OPCODE_HYPERLINK 387
+// free: 388
+// free: 389
+#define SC_OPCODE_GET_PIVOT_DATA 390
+#define SC_OPCODE_EUROCONVERT 391
+#define SC_OPCODE_NUMBERVALUE 392
+#define SC_OPCODE_CHISQ_DIST 393
+#define SC_OPCODE_CHISQ_INV 394
+#define SC_OPCODE_BITAND 395
+#define SC_OPCODE_BITOR 396
+#define SC_OPCODE_BITXOR 397
+#define SC_OPCODE_BITRSHIFT 398
+#define SC_OPCODE_BITLSHIFT 399
+#define SC_OPCODE_GET_DATEDIF 400
+#define SC_OPCODE_XOR 401
+#define SC_OPCODE_AVERAGE_IF 402
+#define SC_OPCODE_SUM_IFS 403
+#define SC_OPCODE_AVERAGE_IFS 404
+#define SC_OPCODE_COUNT_IFS 405
+#define SC_OPCODE_SKEWP 406
+#define SC_OPCODE_LENB 407
+#define SC_OPCODE_RIGHTB 408
+#define SC_OPCODE_LEFTB 409
+#define SC_OPCODE_MIDB 410
+#define SC_OPCODE_FILTERXML 411
+#define SC_OPCODE_WEBSERVICE 412
+#define SC_OPCODE_COVARIANCE_S 413
+#define SC_OPCODE_COVARIANCE_P 414
+#define SC_OPCODE_ST_DEV_P_MS 415
+#define SC_OPCODE_ST_DEV_S 416
+#define SC_OPCODE_VAR_P_MS 417
+#define SC_OPCODE_VAR_S 418
+#define SC_OPCODE_BETA_DIST_MS 419
+#define SC_OPCODE_BETA_INV_MS 420
+#define SC_OPCODE_BINOM_DIST_MS 421
+#define SC_OPCODE_BINOM_INV 422
+#define SC_OPCODE_CHI_DIST_MS 423
+#define SC_OPCODE_CHI_INV_MS 424
+#define SC_OPCODE_CHI_TEST_MS 425
+#define SC_OPCODE_CHISQ_DIST_MS 426
+#define SC_OPCODE_CHISQ_INV_MS 427
+#define SC_OPCODE_CONFIDENCE_N 428
+#define SC_OPCODE_CONFIDENCE_T 429
+#define SC_OPCODE_F_DIST_LT 430
+#define SC_OPCODE_F_DIST_RT 431
+#define SC_OPCODE_F_INV_LT 432
+#define SC_OPCODE_F_INV_RT 433
+#define SC_OPCODE_F_TEST_MS 434
+#define SC_OPCODE_EXP_DIST_MS 435
+#define SC_OPCODE_HYP_GEOM_DIST_MS 436
+#define SC_OPCODE_POISSON_DIST_MS 437
+#define SC_OPCODE_WEIBULL_MS 438
+#define SC_OPCODE_GAMMA_DIST_MS 439
+#define SC_OPCODE_GAMMA_INV_MS 440
+#define SC_OPCODE_LOG_NORM_DIST_MS 441
+#define SC_OPCODE_LOG_INV_MS 442
+#define SC_OPCODE_NORM_DIST_MS 443
+#define SC_OPCODE_NORM_INV_MS 444
+#define SC_OPCODE_STD_NORM_DIST_MS 445
+#define SC_OPCODE_S_NORM_INV_MS 446
+#define SC_OPCODE_T_DIST_MS 447
+#define SC_OPCODE_T_DIST_RT 448
+#define SC_OPCODE_T_DIST_2T 449
+#define SC_OPCODE_T_INV_2T 450
+#define SC_OPCODE_T_INV_MS 451
+#define SC_OPCODE_T_TEST_MS 452
+#define SC_OPCODE_PERCENTILE_INC 453
+#define SC_OPCODE_PERCENT_RANK_INC 454
+#define SC_OPCODE_QUARTILE_INC 455
+#define SC_OPCODE_RANK_EQ 456
+#define SC_OPCODE_PERCENTILE_EXC 457
+#define SC_OPCODE_PERCENT_RANK_EXC 458
+#define SC_OPCODE_QUARTILE_EXC 459
+#define SC_OPCODE_RANK_AVG 460
+#define SC_OPCODE_MODAL_VALUE_MS 461
+#define SC_OPCODE_MODAL_VALUE_MULTI 462
+#define SC_OPCODE_NEG_BINOM_DIST_MS 463
+#define SC_OPCODE_Z_TEST_MS 464
+#define SC_OPCODE_CEIL_MS 465
+#define SC_OPCODE_CEIL_ISO 466
+#define SC_OPCODE_FLOOR_MS 467
+#define SC_OPCODE_NETWORKDAYS_MS 468
+#define SC_OPCODE_WORKDAY_MS 469
+#define SC_OPCODE_AGGREGATE 470
+#define SC_OPCODE_COLOR 471
+#define SC_OPCODE_CEIL_MATH 472
+#define SC_OPCODE_CEIL_PRECISE 473
+#define SC_OPCODE_NETWORKDAYS 474
+#define SC_OPCODE_FLOOR_MATH 475
+#define SC_OPCODE_FLOOR_PRECISE 476
+#define SC_OPCODE_RAWSUBTRACT 477
+#define SC_OPCODE_WEEKNUM_OOO 478
+#define SC_OPCODE_FORECAST_ETS_ADD 479
+#define SC_OPCODE_FORECAST_ETS_SEA 480
+#define SC_OPCODE_FORECAST_ETS_MUL 481
+#define SC_OPCODE_FORECAST_ETS_PIA 482
+#define SC_OPCODE_FORECAST_ETS_PIM 483
+#define SC_OPCODE_FORECAST_ETS_STA 484
+#define SC_OPCODE_FORECAST_ETS_STM 485
+#define SC_OPCODE_FORECAST_LIN 486
+#define SC_OPCODE_CONCAT_MS 487
+#define SC_OPCODE_TEXTJOIN_MS 488
+#define SC_OPCODE_IFS_MS 489
+#define SC_OPCODE_SWITCH_MS 490
+#define SC_OPCODE_MINIFS_MS 491
+#define SC_OPCODE_MAXIFS_MS 492
+#define SC_OPCODE_ROUNDSIG 493
+#define SC_OPCODE_REPLACEB 494
+#define SC_OPCODE_FINDB 495
+#define SC_OPCODE_SEARCHB 496
+#define SC_OPCODE_REGEX 497
+#define SC_OPCODE_FOURIER 498
+#define SC_OPCODE_RANDBETWEEN_NV 499
+#define SC_OPCODE_STOP_2_PAR 500 /* last function with two or more parameters' OpCode + 1 */
+
+#define SC_OPCODE_STOP_FUNCTION SC_OPCODE_STOP_2_PAR /* last function's OpCode + 1 */
+#define SC_OPCODE_LAST_OPCODE_ID (SC_OPCODE_STOP_FUNCTION - 1) /* last OpCode */
+
+/*** Internal ***/
+#define SC_OPCODE_INTERNAL_BEGIN 9999
+#define SC_OPCODE_TTT 9999
+#define SC_OPCODE_DEBUG_VAR 10000
+#define SC_OPCODE_INTERNAL_END 10000
+
+/*** from here on ExtraData contained ***/
+#define SC_OPCODE_DATA_TOKEN_1 10001
+
+#define SC_OPCODE_NONE 0xFFFF
+
+#endif /* FORMULA_COMPILER_HRC */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/errorcodes.hxx b/include/formula/errorcodes.hxx
new file mode 100644
index 000000000..3e929bff4
--- /dev/null
+++ b/include/formula/errorcodes.hxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_ERRORCODES_HXX
+#define INCLUDED_FORMULA_ERRORCODES_HXX
+
+#include <sal/mathconf.h>
+#include <sal/types.h>
+
+#include <cmath>
+#include <limits>
+
+// Store as 16-bits, since error values are stored in tokens and formula results,
+// and that can matter
+enum class FormulaError : sal_uInt16
+{
+ NONE = 0,
+
+ IllegalChar = 501,
+ IllegalArgument = 502,
+ IllegalFPOperation = 503, // #NUM!
+ IllegalParameter = 504,
+ Pair = 507,
+ PairExpected = 508,
+ OperatorExpected = 509,
+ VariableExpected = 510,
+ ParameterExpected = 511,
+ CodeOverflow = 512,
+ StringOverflow = 513,
+ StackOverflow = 514,
+ UnknownState = 515,
+ UnknownVariable = 516,
+ UnknownOpCode = 517,
+ UnknownStackVariable = 518,
+ NoValue = 519, // #VALUE!
+ UnknownToken = 520,
+ NoCode = 521, // #NULL!
+ CircularReference = 522,
+ NoConvergence = 523,
+ NoRef = 524, // #REF!
+ NoName = 525, // #NAME?
+// ScInterpreter internal: no numeric value but numeric queried. If this is
+// set as mnStringNoValueError no error is generated but 0 returned.
+ CellNoValue = 529,
+// Interpreter: needed AddIn not found
+ NoAddin = 530,
+// Interpreter: needed Macro not found
+ NoMacro = 531,
+// Interpreter: Division by zero
+ DivisionByZero = 532, // #DIV/0!
+// Compiler: a non-simple (str,err,val) value was put in an array
+ NestedArray = 533,
+// ScInterpreter internal: no numeric value but numeric queried. If this is
+// temporarily (!) set as mnStringNoValueError, the error is generated and can
+// be used to distinguish that condition from all other (inherited) errors. Do
+// not use for anything else! Never push or inherit the error otherwise!
+ NotNumericString = 534,
+// ScInterpreter internal: jump matrix already has a result at this position,
+// do not overwrite in case of empty code path.
+ JumpMatHasResult = 535,
+// ScInterpreter internal: (matrix) element is not a numeric value, i.e.
+// string or empty, to be distinguished from the general FormulaError::NoValue NAN and not
+// to be used as result.
+ ElementNaN = 536,
+// ScInterpreter/ScFormulaCell internal: keep dirty, retry interpreting next
+// round.
+ RetryCircular = 537,
+// If matrix could not be allocated.
+ MatrixSize = 538,
+// Bad inline array content, non-value/non-string.
+ BadArrayContent = 539,
+// Interpreter: signal result not available because updating links is not
+// allowed (yet) and tell to try hybrid string as result.
+ LinkFormulaNeedingCheck = 540,
+
+// Interpreter: NA() not available condition, not a real error
+ NotAvailable = 0x7fff
+};
+
+/** Unconditionally construct a double value of NAN where the lower bits
+ represent an interpreter error code. */
+inline double CreateDoubleError( FormulaError nErr )
+{
+ sal_math_Double smVal;
+ smVal.value = std::numeric_limits<double>::quiet_NaN();
+ smVal.nan_parts.fraction_lo = static_cast<unsigned>(nErr);
+ return smVal.value;
+}
+
+/** Recreate the error code of a coded double error, if any. */
+inline FormulaError GetDoubleErrorValue( double fVal )
+{
+ if ( std::isfinite( fVal ) )
+ return FormulaError::NONE;
+ if ( std::isinf( fVal ) )
+ return FormulaError::IllegalFPOperation; // normal INF
+ sal_uInt32 nErr = reinterpret_cast< sal_math_Double * >( &fVal)->nan_parts.fraction_lo;
+ if ( nErr & 0xffff0000 )
+ return FormulaError::NoValue; // just a normal NAN
+ if (!nErr)
+ // Another NAN, e.g. -nan(0x8000000000000) from calculating with -inf
+ return FormulaError::IllegalFPOperation;
+ // Any other error known to us as error code.
+ return static_cast<FormulaError>(nErr & 0x0000ffff);
+}
+
+/** Error values that are accepted as detailed "#ERRxxx!" constants.
+
+ Used in FormulaCompiler::GetErrorConstant() to prevent users from inventing
+ arbitrary values that already have or later might get a significant meaning.
+ */
+inline bool isPublishedFormulaError( FormulaError nErr )
+{
+ // Every value has to be handled explicitly, do not add a default case to
+ // let the compiler complain if a value is missing.
+ switch (nErr)
+ {
+ case FormulaError::NONE:
+ return false;
+
+ case FormulaError::IllegalChar:
+ case FormulaError::IllegalArgument:
+ case FormulaError::IllegalFPOperation:
+ case FormulaError::IllegalParameter:
+ case FormulaError::Pair:
+ case FormulaError::PairExpected:
+ case FormulaError::OperatorExpected:
+ case FormulaError::VariableExpected:
+ case FormulaError::ParameterExpected:
+ case FormulaError::CodeOverflow:
+ case FormulaError::StringOverflow:
+ case FormulaError::StackOverflow:
+ case FormulaError::UnknownState:
+ case FormulaError::UnknownVariable:
+ case FormulaError::UnknownOpCode:
+ case FormulaError::UnknownStackVariable:
+ case FormulaError::NoValue:
+ case FormulaError::UnknownToken:
+ case FormulaError::NoCode:
+ case FormulaError::CircularReference:
+ case FormulaError::NoConvergence:
+ case FormulaError::NoRef:
+ case FormulaError::NoName:
+ return true;
+
+ case FormulaError::CellNoValue:
+ return false;
+
+ case FormulaError::NoAddin:
+ case FormulaError::NoMacro:
+ case FormulaError::DivisionByZero:
+ case FormulaError::NestedArray:
+ case FormulaError::BadArrayContent:
+ return true;
+
+ case FormulaError::NotNumericString:
+ case FormulaError::JumpMatHasResult:
+ case FormulaError::ElementNaN:
+ case FormulaError::RetryCircular:
+ return false;
+
+ case FormulaError::MatrixSize:
+ case FormulaError::LinkFormulaNeedingCheck:
+ return true;
+
+ case FormulaError::NotAvailable:
+ return false;
+ }
+ return false;
+}
+
+#endif // INCLUDED_FORMULA_ERRORCODES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formdata.hxx b/include/formula/formdata.hxx
new file mode 100644
index 000000000..1df42c2e9
--- /dev/null
+++ b/include/formula/formdata.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_FORMDATA_HXX
+#define INCLUDED_FORMULA_FORMDATA_HXX
+
+#include <formula/formuladllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/gen.hxx>
+
+namespace formula
+{
+enum class FormulaDlgMode;
+
+class FORMULA_DLLPUBLIC FormEditData
+{
+public:
+ FormEditData();
+ virtual ~FormEditData();
+
+ virtual void SaveValues();
+
+ FormulaDlgMode GetMode() const { return nMode; }
+ sal_Int32 GetFStart() const { return nFStart; }
+ sal_uInt16 GetOffset() const { return nOffset; }
+ const OUString& GetUndoStr() const { return aUndoStr; }
+ bool GetMatrixFlag()const{ return bMatrix;}
+ const Selection& GetSelection()const { return aSelection;}
+
+ void SetMode( FormulaDlgMode nNew ) { nMode = nNew; }
+ void SetFStart( sal_Int32 nNew ) { nFStart = nNew; }
+ void SetOffset( sal_uInt16 nNew ) { nOffset = nNew; }
+ void SetUndoStr( const OUString& rNew ) { aUndoStr = rNew; }
+ void SetMatrixFlag(bool bNew) { bMatrix=bNew;}
+ void SetSelection(const Selection& aSel) { aSelection=aSel;}
+protected:
+ void Reset();
+ FormEditData( const FormEditData& );
+ FormEditData& operator=( const FormEditData& r );
+
+private:
+ FormulaDlgMode nMode;
+ sal_Int32 nFStart;
+ sal_uInt16 nOffset;
+ OUString aUndoStr;
+ bool bMatrix;
+ Selection aSelection;
+};
+
+
+} // formula
+#endif // INCLUDED_FORMULA_FORMDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formula.hxx b/include/formula/formula.hxx
new file mode 100644
index 000000000..aed0e1b0d
--- /dev/null
+++ b/include/formula/formula.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_FORMULA_HXX
+#define INCLUDED_FORMULA_FORMULA_HXX
+
+#include <memory>
+#include <utility>
+
+#include <formula/formuladllapi.h>
+#include <formula/IFunctionDescription.hxx>
+#include <o3tl/deleter.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <sfx2/basedlgs.hxx>
+#include <tools/gen.hxx>
+
+class NotifyEvent;
+class SfxBindings;
+class SfxChildWindow;
+
+namespace formula
+{
+
+#define STRUCT_END 1
+#define STRUCT_FOLDER 2
+#define STRUCT_ERROR 3
+
+enum class FormulaDlgMode { Formula, Edit };
+
+
+class FormulaDlg_Impl;
+class IControlReferenceHandler;
+class FormulaHelper;
+class RefEdit;
+class RefButton;
+class FormEditData;
+
+class FORMULA_DLLPUBLIC FormulaModalDialog
+ : public weld::GenericDialogController, public formula::IFormulaEditorHelper
+{
+ friend class FormulaDlg_Impl;
+public:
+ FormulaModalDialog(weld::Window* pParent, IFunctionManager const * _pFunctionMgr,
+ IControlReferenceHandler* _pDlg);
+ virtual ~FormulaModalDialog() override;
+
+private:
+ std::unique_ptr<FormulaDlg_Impl, o3tl::default_delete<FormulaDlg_Impl>> m_pImpl;
+
+protected:
+
+ ::std::pair<RefButton*,RefEdit*> RefInputStartBefore( RefEdit* pEdit, RefButton* pButton );
+ void RefInputStartAfter();
+ void RefInputDoneAfter();
+
+ void SetMeText(const OUString& _sText);
+ void Update();
+ void CheckMatrix(OUString& aFormula /*IN/OUT*/);
+ void Update(const OUString& _sExp);
+
+ void StoreFormEditData(FormEditData* pData);
+};
+
+class FORMULA_DLLPUBLIC FormulaDlg:
+ public SfxModelessDialogController, public IFormulaEditorHelper
+{
+ friend class FormulaDlg_Impl;
+public:
+ FormulaDlg(SfxBindings* pB, SfxChildWindow* pCW,
+ weld::Window* pParent,
+ IFunctionManager const * _pFunctionMgr,
+ IControlReferenceHandler* _pDlg);
+ virtual ~FormulaDlg() override;
+private:
+ std::unique_ptr<FormulaDlg_Impl, o3tl::default_delete<FormulaDlg_Impl>> m_pImpl;
+
+protected:
+ void disableOk();
+
+protected:
+
+ ::std::pair<RefButton*,RefEdit*> RefInputStartBefore( RefEdit* pEdit, RefButton* pButton );
+ void RefInputStartAfter();
+ void RefInputDoneAfter( bool bForced );
+
+ void SetMeText(const OUString& _sText);
+ FormulaDlgMode SetMeText(const OUString& _sText, sal_Int32 PrivStart, sal_Int32 PrivEnd, bool bMatrix, bool _bSelect, bool _bUpdate);
+ void Update();
+ bool CheckMatrix(OUString& aFormula /*IN/OUT*/);
+ OUString GetMeText() const;
+ void Update(const OUString& _sExp);
+ void DoEnter();
+ const IFunctionDescription* getCurrentFunctionDescription() const;
+ bool UpdateParaWin(Selection& _rSelection);
+ void UpdateParaWin(const Selection& _rSelection, const OUString& _sRefStr);
+ RefEdit* GetActiveEdit();
+ void SetEdSelection();
+
+ void StoreFormEditData(FormEditData* pData);
+
+ const FormulaHelper& GetFormulaHelper() const;
+};
+
+} // formula
+
+#endif // INCLUDED_FORMULA_FORMULA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formuladllapi.h b/include/formula/formuladllapi.h
new file mode 100644
index 000000000..ae408fd42
--- /dev/null
+++ b/include/formula/formuladllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_FORMULADLLAPI_H
+#define INCLUDED_FORMULA_FORMULADLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(FORMULA_DLLIMPLEMENTATION)
+#define FORMULA_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define FORMULA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define FORMULA_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_FORMULA_FORMULADLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formulahelper.hxx b/include/formula/formulahelper.hxx
new file mode 100644
index 000000000..02f757dc3
--- /dev/null
+++ b/include/formula/formulahelper.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_FORMULAHELPER_HXX
+#define INCLUDED_FORMULA_FORMULAHELPER_HXX
+
+#include <memory>
+#include <vector>
+
+#include <formula/formuladllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <unotools/syslocale.hxx>
+
+class CharClass;
+
+namespace formula
+{
+ class IFunctionDescription;
+ class IFunctionManager;
+
+ class FORMULA_DLLPUBLIC FormulaHelper
+ {
+ ::std::unique_ptr<SvtSysLocale> m_pSysLocale;
+ const CharClass* m_pCharClass;
+ const IFunctionManager* m_pFunctionManager;
+ const sal_Unicode open;
+ const sal_Unicode close;
+ const sal_Unicode sep;
+ const sal_Unicode arrayOpen;
+ const sal_Unicode arrayClose;
+ public:
+ FormulaHelper(const IFunctionManager* _pFunctionManager);
+
+ const CharClass* GetCharClass() const { return m_pCharClass; }
+
+ sal_Int32 GetCategoryCount() const;
+
+ bool GetNextFunc( const OUString& rFormula,
+ bool bBack,
+ sal_Int32& rFStart, // input and output
+ sal_Int32* pFEnd = nullptr,
+ const IFunctionDescription** ppFDesc = nullptr,
+ ::std::vector< OUString>* pArgs = nullptr ) const;
+
+ sal_Int32 GetFunctionStart( const OUString& rFormula, sal_Int32 nStart,
+ bool bBack, OUString* pFuncName = nullptr ) const;
+
+ sal_Int32 GetFunctionEnd ( const OUString& rFormula, sal_Int32 nStart ) const;
+
+ sal_Int32 GetArgStart ( const OUString& rFormula, sal_Int32 nStart,
+ sal_uInt16 nArg ) const;
+
+ void GetArgStrings ( ::std::vector< OUString >& _rArgs,
+ const OUString& rFormula,
+ sal_Int32 nFuncPos,
+ sal_uInt16 nArgs ) const;
+
+ void FillArgStrings ( const OUString& rFormula,
+ sal_Int32 nFuncPos,
+ sal_uInt16 nArgs,
+ ::std::vector< OUString >& _rArgs ) const;
+ };
+
+} // formula
+
+
+#endif // INCLUDED_FORMULA_FORMULAHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/funcutl.hxx b/include/formula/funcutl.hxx
new file mode 100644
index 000000000..a41f9c09a
--- /dev/null
+++ b/include/formula/funcutl.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_FUNCUTL_HXX
+#define INCLUDED_FORMULA_FUNCUTL_HXX
+
+#include <formula/formuladllapi.h>
+#include <rtl/ustring.hxx>
+#include <tools/link.hxx>
+#include <vcl/idle.hxx>
+#include <vcl/weld.hxx>
+
+class KeyEvent;
+struct ImplSVEvent;
+
+namespace formula {
+
+class IControlReferenceHandler;
+
+class FORMULA_DLLPUBLIC RefEdit
+{
+protected:
+ std::unique_ptr<weld::Entry> xEntry;
+
+private:
+ Idle aIdle;
+ IControlReferenceHandler* pAnyRefDlg; // parent dialog
+ weld::Label* pLabelWidget;
+ ImplSVEvent* mpFocusInEvent;
+ ImplSVEvent* mpFocusOutEvent;
+
+ Link<RefEdit&,void> maGetFocusHdl;
+ Link<RefEdit&,void> maLoseFocusHdl;
+ Link<RefEdit&,void> maModifyHdl;
+ Link<weld::Widget&,bool> maActivateHdl;
+
+ DECL_DLLPRIVATE_LINK( UpdateHdl, Timer*, void );
+
+ DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool);
+ DECL_DLLPRIVATE_LINK(GetFocusHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(LoseFocusHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(AsyncFocusInHdl, void*, void);
+ DECL_DLLPRIVATE_LINK(AsyncFocusOutHdl, void*, void);
+ DECL_DLLPRIVATE_LINK(Modify, weld::Entry&, void);
+
+ void GetFocus();
+ void LoseFocus();
+
+protected:
+ virtual bool KeyInput(const KeyEvent& rKEvt);
+
+public:
+ RefEdit(std::unique_ptr<weld::Entry> xControl);
+ weld::Entry* GetWidget() const { return xEntry.get(); }
+ virtual ~RefEdit();
+
+ void SetRefString( const OUString& rStr );
+
+ /**
+ * Flag reference valid or invalid, which in turn changes the visual
+ * appearance of the control accordingly.
+ */
+ void SetRefValid(bool bValid);
+
+ void SetText(const OUString& rStr);
+ OUString GetText() const
+ {
+ return xEntry->get_text();
+ }
+
+ void StartUpdateData();
+
+ void SetReferences( IControlReferenceHandler* pDlg, weld::Label *pLabelWidget );
+
+ void DoModify()
+ {
+ Modify(*xEntry);
+ }
+
+ void GrabFocus()
+ {
+ xEntry->grab_focus();
+ }
+
+ void SelectAll()
+ {
+ xEntry->select_region(0, -1);
+ }
+
+ void SetSelection(const Selection& rSelection)
+ {
+ xEntry->select_region(rSelection.Min(), rSelection.Max());
+ }
+
+ void SetCursorAtLast()
+ {
+ xEntry->set_position(-1);
+ }
+
+ Selection GetSelection() const
+ {
+ int nStartPos, nEndPos;
+ xEntry->get_selection_bounds(nStartPos, nEndPos);
+ return Selection(nStartPos, nEndPos);
+ }
+
+ weld::Label* GetLabelWidgetForShrinkMode()
+ {
+ return pLabelWidget;
+ }
+
+ void SaveValue()
+ {
+ xEntry->save_value();
+ }
+
+ bool IsValueChangedFromSaved() const
+ {
+ return xEntry->get_value_changed_from_saved();
+ }
+
+ void SetGetFocusHdl(const Link<RefEdit&,void>& rLink) { maGetFocusHdl = rLink; }
+ void SetLoseFocusHdl(const Link<RefEdit&,void>& rLink) { maLoseFocusHdl = rLink; }
+ void SetModifyHdl(const Link<RefEdit&,void>& rLink) { maModifyHdl = rLink; }
+ const Link<RefEdit&,void>& GetModifyHdl() const { return maModifyHdl; }
+ void SetActivateHdl(const Link<weld::Widget&,bool>& rLink) { maActivateHdl = rLink; }
+};
+
+class FORMULA_DLLPUBLIC RefButton
+{
+private:
+ std::unique_ptr<weld::Button> xButton;
+ IControlReferenceHandler* pAnyRefDlg; // parent dialog
+ RefEdit* pRefEdit; // associated Edit-Control
+ Link<RefButton&,void> maGetFocusHdl;
+ Link<RefButton&,void> maLoseFocusHdl;
+ Link<weld::Widget&,bool> maActivateHdl;
+ Link<RefButton&,void> maClickHdl;
+
+ DECL_LINK(Click, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(KeyInput, const KeyEvent&, bool);
+ DECL_DLLPRIVATE_LINK(GetFocus, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(LoseFocus, weld::Widget&, void);
+
+public:
+ RefButton(std::unique_ptr<weld::Button> xControl);
+ weld::Button* GetWidget() const { return xButton.get(); }
+ ~RefButton();
+ void SetReferences(IControlReferenceHandler* pDlg, RefEdit* pEdit);
+ void SetStartImage();
+ void SetEndImage();
+ void DoRef()
+ {
+ Click(*xButton);
+ }
+ void SetGetFocusHdl(const Link<RefButton&,void>& rLink) { maGetFocusHdl = rLink; }
+ void SetLoseFocusHdl(const Link<RefButton&,void>& rLink) { maLoseFocusHdl = rLink; }
+ void SetActivateHdl(const Link<weld::Widget&,bool>& rLink) { maActivateHdl = rLink; }
+ void SetClickHdl(const Link<RefButton&,void>& rLink) { maClickHdl = rLink; }
+};
+
+} // formula
+
+#endif // INCLUDED_FORMULA_FUNCUTL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/funcvarargs.h b/include/formula/funcvarargs.h
new file mode 100644
index 000000000..7a1f1e4e7
--- /dev/null
+++ b/include/formula/funcvarargs.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_FORMULA_FUNCVARARGS_H
+#define INCLUDED_FORMULA_FUNCVARARGS_H
+
+/** Used to indicate a variable number of parameters for the Function Wizard.
+
+ VAR_ARGS if variable number of parameters, or VAR_ARGS+number if number of
+ fixed parameters and variable arguments following.
+
+ @see formula::ParaWin
+ @see ScFuncDescCore
+
+ @NOTE: the value can't be easily changed. If changed then
+ reportdesign/source/ui/misc/FunctionHelper.cxx
+ FunctionDescription::getVarArgsStart() has to provide some backward
+ compatibility for implicit API stability.
+ The new VAR_ARGS value must be significantly greater than the old
+ PAIRED_VAR_ARGS (2*VAR_ARGS) value, in fact greater than any used number of
+ fixed parameters followed by optional paired parameters.
+
+ @NOTE: also
+ reportbuilder/java/org/libreoffice/report/pentaho/StarFunctionDescription.java
+ uses a hard coded value in StarFunctionDescription::getArguments() for
+ functionDescription.isInfiniteParameterCount() which though looks like it
+ could be easily adapted.
+ */
+#define VAR_ARGS 255
+
+/** Used to indicate a variable number of paired parameters for the Function Wizard.
+
+ PAIRED_VAR_ARGS if variable number of paired parameters, or
+ PAIRED_VAR_ARGS+number if number of fixed parameters and variable paired
+ arguments following.
+
+ @see VAR_ARGS
+ */
+#define PAIRED_VAR_ARGS (VAR_ARGS + VAR_ARGS)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/formula/grammar.hxx b/include/formula/grammar.hxx
new file mode 100644
index 000000000..677087d19
--- /dev/null
+++ b/include/formula/grammar.hxx
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_GRAMMAR_HXX
+#define INCLUDED_FORMULA_GRAMMAR_HXX
+
+#include <com/sun/star/sheet/FormulaLanguage.hpp>
+#include <formula/formuladllapi.h>
+#include <sal/types.h>
+
+namespace formula
+{
+
+/** Grammars digested by ScCompiler.
+ */
+class FORMULA_DLLPUBLIC FormulaGrammar
+{
+public:
+ enum AddressConvention{
+ CONV_UNSPECIFIED = -1, /* useful when we want method to choose, must be first */
+
+ /* elements must be sequential and changes should be reflected in ScCompiler::pCharTables */
+ CONV_OOO = 0, /* 'doc'#sheet.A1:sheet2.B2 */
+ CONV_ODF, /* ['doc'#sheet.A1:sheet2.B2] */
+ CONV_XL_A1, /* [doc]sheet:sheet2!A1:B2 */
+ CONV_XL_R1C1, /* [doc]sheet:sheet2!R1C1:R2C2 */
+ CONV_XL_OOX, /* [#]sheet:sheet2!A1:B2 */
+
+ CONV_LOTUS_A1, /* external? 3d? A1.B2 <placeholder/> */
+
+ CONV_LAST, /* for loops, must always be last */
+
+ // not a real address convention, a special case for INDIRECT function interpretation
+ // only -> try using CONV_OOO, failing that CONV_XL_A1
+ CONV_A1_XL_A1
+ };
+
+ //! CONV_UNSPECIFIED is a negative value!
+ static const int kConventionOffset = - CONV_UNSPECIFIED + 1;
+ // Room for 32k hypothetical languages plus EXTERNAL.
+ static const int kConventionShift = 16;
+ // Room for 256 reference conventions.
+ static const int kEnglishBit = (1 << (kConventionShift + 8));
+ // Mask off all non-language bits.
+ static const int kFlagMask = ~((~unsigned(0)) << kConventionShift);
+
+ /** Values encoding the formula language plus address reference convention
+ plus English parsing/formatting
+ */
+ //! When adding new values adapt isSupported() below as well.
+ enum Grammar
+ {
+ /// Used only in ScCompiler ctor and in some XML import API context.
+ GRAM_UNSPECIFIED = -1,
+ /// ODFF with default ODF A1 bracketed references.
+ GRAM_ODFF = css::sheet::FormulaLanguage::ODFF |
+ ((CONV_ODF +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODF 1.1 with default ODF A1 bracketed references.
+ GRAM_PODF = css::sheet::FormulaLanguage::ODF_11 |
+ ((CONV_ODF +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// English with default A1 reference style.
+ GRAM_ENGLISH = css::sheet::FormulaLanguage::ENGLISH |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// Native with default A1 reference style.
+ GRAM_NATIVE = css::sheet::FormulaLanguage::NATIVE |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift),
+ /// ODFF with reference style as set in UI, may be A1 or R1C1.
+ GRAM_ODFF_UI = css::sheet::FormulaLanguage::ODFF |
+ ((CONV_UNSPECIFIED +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODFF with A1 reference style, unbracketed.
+ GRAM_ODFF_A1 = css::sheet::FormulaLanguage::ODFF |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODF 1.1 with reference style as set in UI, may be A1 or R1C1.
+ GRAM_PODF_UI = css::sheet::FormulaLanguage::ODF_11 |
+ ((CONV_UNSPECIFIED +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODF 1.1 with A1 reference style, unbracketed.
+ GRAM_PODF_A1 = css::sheet::FormulaLanguage::ODF_11 |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// Native with reference style as set in UI, may be A1 or R1C1.
+ GRAM_NATIVE_UI = css::sheet::FormulaLanguage::NATIVE |
+ ((CONV_UNSPECIFIED +
+ kConventionOffset) << kConventionShift),
+ /// Native with ODF A1 bracketed references. Not very useful but supported.
+ GRAM_NATIVE_ODF = css::sheet::FormulaLanguage::NATIVE |
+ ((CONV_ODF +
+ kConventionOffset) << kConventionShift),
+ /// Native with Excel A1 reference style.
+ GRAM_NATIVE_XL_A1 = css::sheet::FormulaLanguage::NATIVE |
+ ((CONV_XL_A1 +
+ kConventionOffset) << kConventionShift),
+ /// Native with Excel R1C1 reference style.
+ GRAM_NATIVE_XL_R1C1 = css::sheet::FormulaLanguage::NATIVE |
+ ((CONV_XL_R1C1 +
+ kConventionOffset) << kConventionShift),
+ /// English with Excel A1 reference style.
+ GRAM_ENGLISH_XL_A1 = css::sheet::FormulaLanguage::XL_ENGLISH |
+ ((CONV_XL_A1 +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// English with Excel R1C1 reference style.
+ GRAM_ENGLISH_XL_R1C1 = css::sheet::FormulaLanguage::XL_ENGLISH |
+ ((CONV_XL_R1C1 +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// English with Excel OOXML reference style.
+ GRAM_ENGLISH_XL_OOX = css::sheet::FormulaLanguage::XL_ENGLISH |
+ ((CONV_XL_OOX +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// Excel OOXML with Excel OOXML reference style.
+ GRAM_OOXML = css::sheet::FormulaLanguage::OOXML |
+ ((CONV_XL_OOX +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// API English with A1 reference style, unbracketed.
+ GRAM_API = css::sheet::FormulaLanguage::API |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// Central definition of the default grammar to be used.
+ GRAM_DEFAULT = GRAM_NATIVE_UI,
+
+ /// Central definition of the default storage grammar to be used.
+ GRAM_STORAGE_DEFAULT = GRAM_ODFF,
+
+ /** OpCodeMap set by external filter and merged with reference
+ convention plus English bit on top. Plain value acts as
+ FormulaLanguage. */
+ GRAM_EXTERNAL = (1 << (kConventionShift - 1))
+ };
+
+ /// If English parsing/formatting is associated with a grammar.
+ static bool isEnglish( const Grammar eGrammar )
+ {
+ return (eGrammar & kEnglishBit) != 0;
+ }
+
+ /** Compatibility helper for old "bCompileEnglish, bCompileXML" API calls
+ to obtain the new grammar. */
+ static Grammar mapAPItoGrammar( const bool bEnglish, const bool bXML );
+
+ static bool isSupported( const Grammar eGrammar );
+
+ static sal_Int32 extractFormulaLanguage( const Grammar eGrammar )
+ {
+ return eGrammar & kFlagMask;
+ }
+
+ static AddressConvention extractRefConvention( const Grammar eGrammar )
+ {
+ return static_cast<AddressConvention>(
+ ((eGrammar & ~kEnglishBit) >> kConventionShift) -
+ kConventionOffset);
+ }
+
+ static Grammar setEnglishBit( const Grammar eGrammar, const bool bEnglish );
+
+ static Grammar mergeToGrammar( const Grammar eGrammar, const AddressConvention eConv );
+
+ /// If grammar is of ODF 1.1
+ static bool isPODF( const Grammar eGrammar )
+ {
+ return extractFormulaLanguage( eGrammar) ==
+ css::sheet::FormulaLanguage::ODF_11;
+ }
+
+ /// If grammar is of ODFF
+ static bool isODFF( const Grammar eGrammar )
+ {
+ return extractFormulaLanguage( eGrammar) ==
+ css::sheet::FormulaLanguage::ODFF;
+ }
+
+ /// If grammar is of OOXML
+ static bool isOOXML( const Grammar eGrammar )
+ {
+ return extractFormulaLanguage( eGrammar) ==
+ css::sheet::FormulaLanguage::OOXML;
+ }
+
+ /** If reference convention is OOXML.
+
+ Note this is not equivalent to isOOXML() as it does not have to be
+ FormulaLanguage::OOXML but can be Grammar::GRAM_EXTERNAL merged with
+ AddressConvention::CONV_XL_OOX, which is used by various parts of OOXML
+ import through the API FormulaParser.
+ */
+ static bool isRefConventionOOXML( const Grammar eGrammar )
+ {
+ return extractRefConvention( eGrammar) ==
+ FormulaGrammar::AddressConvention::CONV_XL_OOX;
+ }
+
+ /// If grammar has an Excel syntax, determined by address convention.
+ static bool isExcelSyntax( const Grammar eGrammar )
+ {
+ AddressConvention eConv = extractRefConvention( eGrammar );
+ switch (eConv)
+ {
+ case FormulaGrammar::AddressConvention::CONV_XL_A1:
+ case FormulaGrammar::AddressConvention::CONV_XL_R1C1:
+ case FormulaGrammar::AddressConvention::CONV_XL_OOX:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+};
+
+} // formula
+
+
+#endif // INCLUDED_FORMULA_GRAMMAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx
new file mode 100644
index 000000000..d92ae0b1d
--- /dev/null
+++ b/include/formula/opcode.hxx
@@ -0,0 +1,995 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_OPCODE_HXX
+#define INCLUDED_FORMULA_OPCODE_HXX
+
+#include <sstream>
+
+#include <formula/compiler.hxx>
+#include <sal/types.h>
+
+enum OpCode : sal_uInt16
+{
+ // Special commands
+ ocPush = SC_OPCODE_PUSH,
+ ocCall = SC_OPCODE_CALL,
+ ocStop = SC_OPCODE_STOP,
+ ocExternal = SC_OPCODE_EXTERNAL,
+ ocName = SC_OPCODE_NAME,
+ // Jump commands
+ ocIf = SC_OPCODE_IF,
+ ocIfError = SC_OPCODE_IF_ERROR,
+ ocIfNA = SC_OPCODE_IF_NA,
+ ocChoose = SC_OPCODE_CHOOSE,
+ // Parentheses and separators
+ ocOpen = SC_OPCODE_OPEN,
+ ocClose = SC_OPCODE_CLOSE,
+ ocTableRefOpen = SC_OPCODE_TABLE_REF_OPEN,
+ ocTableRefClose = SC_OPCODE_TABLE_REF_CLOSE,
+ ocSep = SC_OPCODE_SEP,
+ ocArrayOpen = SC_OPCODE_ARRAY_OPEN,
+ ocArrayClose = SC_OPCODE_ARRAY_CLOSE,
+ ocArrayRowSep = SC_OPCODE_ARRAY_ROW_SEP,
+ ocArrayColSep = SC_OPCODE_ARRAY_COL_SEP,
+ // Special OpCodes
+ ocMissing = SC_OPCODE_MISSING,
+ ocBad = SC_OPCODE_BAD,
+ ocStringXML = SC_OPCODE_STRINGXML,
+ ocSpaces = SC_OPCODE_SPACES,
+ ocWhitespace = SC_OPCODE_WHITESPACE,
+ ocMatRef = SC_OPCODE_MAT_REF,
+ ocTableRefItemAll = SC_OPCODE_TABLE_REF_ITEM_ALL,
+ ocTableRefItemHeaders = SC_OPCODE_TABLE_REF_ITEM_HEADERS,
+ ocTableRefItemData = SC_OPCODE_TABLE_REF_ITEM_DATA,
+ ocTableRefItemTotals = SC_OPCODE_TABLE_REF_ITEM_TOTALS,
+ ocTableRefItemThisRow = SC_OPCODE_TABLE_REF_ITEM_THIS_ROW,
+ ocSkip = SC_OPCODE_SKIP,
+ // Access commands
+ ocDBArea = SC_OPCODE_DB_AREA,
+ ocTableRef = SC_OPCODE_TABLE_REF,
+ ocMacro = SC_OPCODE_MACRO,
+ ocColRowName = SC_OPCODE_COL_ROW_NAME,
+ ocColRowNameAuto = SC_OPCODE_COL_ROW_NAME_AUTO,
+ // Percent operator _follows_ value
+ ocPercentSign = SC_OPCODE_PERCENT_SIGN,
+ // Error constants
+ ocErrNull = SC_OPCODE_ERROR_NULL,
+ ocErrDivZero = SC_OPCODE_ERROR_DIVZERO,
+ ocErrValue = SC_OPCODE_ERROR_VALUE,
+ ocErrRef = SC_OPCODE_ERROR_REF,
+ ocErrName = SC_OPCODE_ERROR_NAME,
+ ocErrNum = SC_OPCODE_ERROR_NUM,
+ ocErrNA = SC_OPCODE_ERROR_NA,
+ // Binary operators
+ ocAdd = SC_OPCODE_ADD,
+ ocSub = SC_OPCODE_SUB,
+ ocMul = SC_OPCODE_MUL,
+ ocDiv = SC_OPCODE_DIV,
+ ocAmpersand = SC_OPCODE_AMPERSAND,
+ ocPow = SC_OPCODE_POW,
+ ocEqual = SC_OPCODE_EQUAL,
+ ocNotEqual = SC_OPCODE_NOT_EQUAL,
+ ocLess = SC_OPCODE_LESS,
+ ocGreater = SC_OPCODE_GREATER,
+ ocLessEqual = SC_OPCODE_LESS_EQUAL,
+ ocGreaterEqual = SC_OPCODE_GREATER_EQUAL,
+ ocAnd = SC_OPCODE_AND,
+ ocOr = SC_OPCODE_OR,
+ ocXor = SC_OPCODE_XOR,
+ ocIntersect = SC_OPCODE_INTERSECT,
+ ocUnion = SC_OPCODE_UNION,
+ ocRange = SC_OPCODE_RANGE,
+ // Unary operators
+ ocNegSub = SC_OPCODE_NEG_SUB,
+ // Functions with no parameters
+ ocPi = SC_OPCODE_PI,
+ ocRandom = SC_OPCODE_RANDOM,
+ ocTrue = SC_OPCODE_TRUE,
+ ocFalse = SC_OPCODE_FALSE,
+ ocGetActDate = SC_OPCODE_GET_ACT_DATE,
+ ocGetActTime = SC_OPCODE_GET_ACT_TIME,
+ ocNotAvail = SC_OPCODE_NO_VALUE,
+ ocCurrent = SC_OPCODE_CURRENT,
+ ocRandomNV = SC_OPCODE_RANDOM_NV,
+ // Functions with one parameter
+ ocNot = SC_OPCODE_NOT,
+ ocNeg = SC_OPCODE_NEG,
+ ocDeg = SC_OPCODE_DEG,
+ ocRad = SC_OPCODE_RAD,
+ ocSin = SC_OPCODE_SIN,
+ ocCos = SC_OPCODE_COS,
+ ocTan = SC_OPCODE_TAN,
+ ocCot = SC_OPCODE_COT,
+ ocArcSin = SC_OPCODE_ARC_SIN,
+ ocArcCos = SC_OPCODE_ARC_COS,
+ ocArcTan = SC_OPCODE_ARC_TAN,
+ ocArcCot = SC_OPCODE_ARC_COT,
+ ocSinHyp = SC_OPCODE_SIN_HYP,
+ ocCosHyp = SC_OPCODE_COS_HYP,
+ ocTanHyp = SC_OPCODE_TAN_HYP,
+ ocCotHyp = SC_OPCODE_COT_HYP,
+ ocArcSinHyp = SC_OPCODE_ARC_SIN_HYP,
+ ocArcCosHyp = SC_OPCODE_ARC_COS_HYP,
+ ocArcTanHyp = SC_OPCODE_ARC_TAN_HYP,
+ ocArcCotHyp = SC_OPCODE_ARC_COT_HYP,
+ ocCosecant = SC_OPCODE_COSECANT,
+ ocSecant = SC_OPCODE_SECANT,
+ ocCosecantHyp = SC_OPCODE_COSECANT_HYP,
+ ocSecantHyp = SC_OPCODE_SECANT_HYP,
+ ocExp = SC_OPCODE_EXP,
+ ocLn = SC_OPCODE_LN,
+ ocSqrt = SC_OPCODE_SQRT,
+ ocFact = SC_OPCODE_FACT,
+ ocGetYear = SC_OPCODE_GET_YEAR,
+ ocGetMonth = SC_OPCODE_GET_MONTH,
+ ocGetDay = SC_OPCODE_GET_DAY,
+ ocGetHour = SC_OPCODE_GET_HOUR,
+ ocGetMin = SC_OPCODE_GET_MIN,
+ ocGetSec = SC_OPCODE_GET_SEC,
+ ocPlusMinus = SC_OPCODE_PLUS_MINUS,
+ ocAbs = SC_OPCODE_ABS,
+ ocInt = SC_OPCODE_INT,
+ ocPhi = SC_OPCODE_PHI,
+ ocGauss = SC_OPCODE_GAUSS,
+ ocIsEmpty = SC_OPCODE_IS_EMPTY,
+ ocIsString = SC_OPCODE_IS_STRING,
+ ocIsNonString = SC_OPCODE_IS_NON_STRING,
+ ocIsLogical = SC_OPCODE_IS_LOGICAL,
+ ocType = SC_OPCODE_TYPE,
+ ocCell = SC_OPCODE_CELL,
+ ocIsRef = SC_OPCODE_IS_REF,
+ ocIsValue = SC_OPCODE_IS_VALUE,
+ ocIsFormula = SC_OPCODE_IS_FORMULA,
+ ocIsNA = SC_OPCODE_IS_NV,
+ ocIsErr = SC_OPCODE_IS_ERR,
+ ocIsError = SC_OPCODE_IS_ERROR,
+ ocIsEven = SC_OPCODE_IS_EVEN,
+ ocIsOdd = SC_OPCODE_IS_ODD,
+ ocN = SC_OPCODE_N,
+ // String functions
+ ocGetDateValue = SC_OPCODE_GET_DATE_VALUE,
+ ocGetTimeValue = SC_OPCODE_GET_TIME_VALUE,
+ ocCode = SC_OPCODE_CODE,
+ ocTrim = SC_OPCODE_TRIM,
+ ocUpper = SC_OPCODE_UPPER,
+ ocProper = SC_OPCODE_PROPER,
+ ocLower = SC_OPCODE_LOWER,
+ ocLen = SC_OPCODE_LEN,
+ ocT = SC_OPCODE_T,
+ ocValue = SC_OPCODE_VALUE,
+ ocClean = SC_OPCODE_CLEAN,
+ ocChar = SC_OPCODE_CHAR,
+ ocLog10 = SC_OPCODE_LOG10,
+ ocEven = SC_OPCODE_EVEN,
+ ocOdd = SC_OPCODE_ODD,
+ ocStdNormDist = SC_OPCODE_STD_NORM_DIST,
+ ocStdNormDist_MS = SC_OPCODE_STD_NORM_DIST_MS,
+ ocFisher = SC_OPCODE_FISHER,
+ ocFisherInv = SC_OPCODE_FISHER_INV,
+ ocSNormInv = SC_OPCODE_S_NORM_INV,
+ ocSNormInv_MS = SC_OPCODE_S_NORM_INV_MS,
+ ocGammaLn = SC_OPCODE_GAMMA_LN,
+ ocGammaLn_MS = SC_OPCODE_GAMMA_LN_MS,
+ ocGamma = SC_OPCODE_GAMMA,
+ ocErrorType = SC_OPCODE_ERROR_TYPE,
+ ocErrorType_ODF = SC_OPCODE_ERROR_TYPE_ODF,
+ ocFormula = SC_OPCODE_FORMULA,
+ ocArabic = SC_OPCODE_ARABIC,
+ ocInfo = SC_OPCODE_INFO,
+ ocBahtText = SC_OPCODE_BAHTTEXT,
+ ocJis = SC_OPCODE_JIS,
+ ocAsc = SC_OPCODE_ASC,
+ ocUnicode = SC_OPCODE_UNICODE,
+ ocUnichar = SC_OPCODE_UNICHAR,
+ // Functions with more than one parameters
+ ocArcTan2 = SC_OPCODE_ARC_TAN_2,
+ ocCeil = SC_OPCODE_CEIL,
+ ocCeil_MS = SC_OPCODE_CEIL_MS,
+ ocCeil_Precise = SC_OPCODE_CEIL_PRECISE,
+ ocCeil_ISO = SC_OPCODE_CEIL_ISO,
+ ocCeil_Math = SC_OPCODE_CEIL_MATH,
+ ocFloor = SC_OPCODE_FLOOR,
+ ocFloor_MS = SC_OPCODE_FLOOR_MS,
+ ocFloor_Math = SC_OPCODE_FLOOR_MATH,
+ ocFloor_Precise = SC_OPCODE_FLOOR_PRECISE,
+ ocRound = SC_OPCODE_ROUND,
+ ocRoundUp = SC_OPCODE_ROUND_UP,
+ ocRoundDown = SC_OPCODE_ROUND_DOWN,
+ ocTrunc = SC_OPCODE_TRUNC,
+ ocLog = SC_OPCODE_LOG,
+ ocPower = SC_OPCODE_POWER,
+ ocGCD = SC_OPCODE_GCD,
+ ocLCM = SC_OPCODE_LCM,
+ ocMod = SC_OPCODE_MOD,
+ ocSumProduct = SC_OPCODE_SUM_PRODUCT,
+ ocSumSQ = SC_OPCODE_SUM_SQ,
+ ocSumX2MY2 = SC_OPCODE_SUM_X2MY2,
+ ocSumX2DY2 = SC_OPCODE_SUM_X2DY2,
+ ocSumXMY2 = SC_OPCODE_SUM_XMY2,
+ ocGetDate = SC_OPCODE_GET_DATE,
+ ocGetTime = SC_OPCODE_GET_TIME,
+ ocGetDiffDate = SC_OPCODE_GET_DIFF_DATE,
+ ocGetDiffDate360 = SC_OPCODE_GET_DIFF_DATE_360,
+ ocGetDateDif = SC_OPCODE_GET_DATEDIF,
+ ocMin = SC_OPCODE_MIN,
+ ocMax = SC_OPCODE_MAX,
+ ocSum = SC_OPCODE_SUM,
+ ocProduct = SC_OPCODE_PRODUCT,
+ ocAverage = SC_OPCODE_AVERAGE,
+ ocCount = SC_OPCODE_COUNT,
+ ocCount2 = SC_OPCODE_COUNT_2,
+ ocNPV = SC_OPCODE_NPV,
+ ocIRR = SC_OPCODE_IRR,
+ ocMIRR = SC_OPCODE_MIRR,
+ ocISPMT = SC_OPCODE_ISPMT,
+ ocVar = SC_OPCODE_VAR,
+ ocVarP = SC_OPCODE_VAR_P,
+ ocVarP_MS = SC_OPCODE_VAR_P_MS,
+ ocVarS = SC_OPCODE_VAR_S,
+ ocStDev = SC_OPCODE_ST_DEV,
+ ocStDevP = SC_OPCODE_ST_DEV_P,
+ ocStDevP_MS = SC_OPCODE_ST_DEV_P_MS,
+ ocStDevS = SC_OPCODE_ST_DEV_S,
+ ocB = SC_OPCODE_B,
+ ocNormDist = SC_OPCODE_NORM_DIST,
+ ocNormDist_MS = SC_OPCODE_NORM_DIST_MS,
+ ocExpDist = SC_OPCODE_EXP_DIST,
+ ocExpDist_MS = SC_OPCODE_EXP_DIST_MS,
+ ocBinomDist = SC_OPCODE_BINOM_DIST,
+ ocBinomDist_MS = SC_OPCODE_BINOM_DIST_MS,
+ ocBinomInv = SC_OPCODE_BINOM_INV,
+ ocPoissonDist = SC_OPCODE_POISSON_DIST,
+ ocPoissonDist_MS = SC_OPCODE_POISSON_DIST_MS,
+ ocCombin = SC_OPCODE_COMBIN,
+ ocCombinA = SC_OPCODE_COMBIN_A,
+ ocPermut = SC_OPCODE_PERMUT,
+ ocPermutationA = SC_OPCODE_PERMUTATION_A,
+ ocPV = SC_OPCODE_PV,
+ ocSYD = SC_OPCODE_SYD,
+ ocDDB = SC_OPCODE_DDB,
+ ocDB = SC_OPCODE_DB,
+ ocVBD = SC_OPCODE_VBD,
+ ocPDuration = SC_OPCODE_PDURATION,
+ ocSLN = SC_OPCODE_SLN,
+ ocPMT = SC_OPCODE_PMT,
+ ocColumns = SC_OPCODE_COLUMNS,
+ ocRows = SC_OPCODE_ROWS,
+ ocColumn = SC_OPCODE_COLUMN,
+ ocRow = SC_OPCODE_ROW,
+ ocRRI = SC_OPCODE_RRI,
+ ocFV = SC_OPCODE_FV,
+ ocNper = SC_OPCODE_NPER,
+ ocRate = SC_OPCODE_RATE,
+ ocIpmt = SC_OPCODE_IPMT,
+ ocPpmt = SC_OPCODE_PPMT,
+ ocCumIpmt = SC_OPCODE_CUM_IPMT,
+ ocCumPrinc = SC_OPCODE_CUM_PRINC,
+ ocEffect = SC_OPCODE_EFFECT,
+ ocNominal = SC_OPCODE_NOMINAL,
+ ocSubTotal = SC_OPCODE_SUB_TOTAL,
+ ocRawSubtract = SC_OPCODE_RAWSUBTRACT,
+ ocIfs_MS = SC_OPCODE_IFS_MS,
+ ocSwitch_MS = SC_OPCODE_SWITCH_MS,
+ ocMinIfs_MS = SC_OPCODE_MINIFS_MS,
+ ocMaxIfs_MS = SC_OPCODE_MAXIFS_MS,
+ ocRoundSig = SC_OPCODE_ROUNDSIG,
+ // Database functions
+ ocDBSum = SC_OPCODE_DB_SUM,
+ ocDBCount = SC_OPCODE_DB_COUNT,
+ ocDBCount2 = SC_OPCODE_DB_COUNT_2,
+ ocDBAverage = SC_OPCODE_DB_AVERAGE,
+ ocDBGet = SC_OPCODE_DB_GET,
+ ocDBMax = SC_OPCODE_DB_MAX,
+ ocDBMin = SC_OPCODE_DB_MIN,
+ ocDBProduct = SC_OPCODE_DB_PRODUCT,
+ ocDBStdDev = SC_OPCODE_DB_STD_DEV,
+ ocDBStdDevP = SC_OPCODE_DB_STD_DEV_P,
+ ocDBVar = SC_OPCODE_DB_VAR,
+ ocDBVarP = SC_OPCODE_DB_VAR_P,
+ // Management functions
+ ocIndirect = SC_OPCODE_INDIRECT,
+ ocAddress = SC_OPCODE_ADDRESS,
+ ocMatch = SC_OPCODE_MATCH,
+ ocCountEmptyCells = SC_OPCODE_COUNT_EMPTY_CELLS,
+ ocCountIf = SC_OPCODE_COUNT_IF,
+ ocSumIf = SC_OPCODE_SUM_IF,
+ ocAverageIf = SC_OPCODE_AVERAGE_IF,
+ ocSumIfs = SC_OPCODE_SUM_IFS,
+ ocAverageIfs = SC_OPCODE_AVERAGE_IFS,
+ ocCountIfs = SC_OPCODE_COUNT_IFS,
+ ocLookup = SC_OPCODE_LOOKUP,
+ ocVLookup = SC_OPCODE_V_LOOKUP,
+ ocHLookup = SC_OPCODE_H_LOOKUP,
+ ocMultiArea = SC_OPCODE_MULTI_AREA,
+ ocOffset = SC_OPCODE_OFFSET,
+ ocIndex = SC_OPCODE_INDEX,
+ ocAreas = SC_OPCODE_AREAS,
+ // String functions
+ ocCurrency = SC_OPCODE_CURRENCY,
+ ocReplace = SC_OPCODE_REPLACE,
+ ocFixed = SC_OPCODE_FIXED,
+ ocFind = SC_OPCODE_FIND,
+ ocExact = SC_OPCODE_EXACT,
+ ocLeft = SC_OPCODE_LEFT,
+ ocRight = SC_OPCODE_RIGHT,
+ ocSearch = SC_OPCODE_SEARCH,
+ ocMid = SC_OPCODE_MID,
+ ocText = SC_OPCODE_TEXT,
+ ocSubstitute = SC_OPCODE_SUBSTITUTE,
+ ocRept = SC_OPCODE_REPT,
+ ocConcat = SC_OPCODE_CONCAT,
+ ocConcat_MS = SC_OPCODE_CONCAT_MS,
+ ocTextJoin_MS = SC_OPCODE_TEXTJOIN_MS,
+ ocLenB = SC_OPCODE_LENB,
+ ocRightB = SC_OPCODE_RIGHTB,
+ ocLeftB = SC_OPCODE_LEFTB,
+ ocMidB = SC_OPCODE_MIDB,
+ ocReplaceB = SC_OPCODE_REPLACEB,
+ ocFindB = SC_OPCODE_FINDB,
+ ocSearchB = SC_OPCODE_SEARCHB,
+ ocNumberValue = SC_OPCODE_NUMBERVALUE,
+ ocRegex = SC_OPCODE_REGEX,
+ // Matrix functions
+ ocMatValue = SC_OPCODE_MAT_VALUE,
+ ocMatDet = SC_OPCODE_MAT_DET,
+ ocMatInv = SC_OPCODE_MAT_INV,
+ ocMatMult = SC_OPCODE_MAT_MULT,
+ ocMatTrans = SC_OPCODE_MAT_TRANS,
+ ocMatrixUnit = SC_OPCODE_MATRIX_UNIT,
+ // BackSolver
+ ocBackSolver = SC_OPCODE_BACK_SOLVER,
+ // Statistical functions
+ ocHypGeomDist = SC_OPCODE_HYP_GEOM_DIST,
+ ocHypGeomDist_MS = SC_OPCODE_HYP_GEOM_DIST_MS,
+ ocLogNormDist = SC_OPCODE_LOG_NORM_DIST,
+ ocLogNormDist_MS = SC_OPCODE_LOG_NORM_DIST_MS,
+ ocTDist = SC_OPCODE_T_DIST,
+ ocTDist_MS = SC_OPCODE_T_DIST_MS,
+ ocTDist_RT = SC_OPCODE_T_DIST_RT,
+ ocTDist_2T = SC_OPCODE_T_DIST_2T,
+ ocFDist = SC_OPCODE_F_DIST,
+ ocFDist_LT = SC_OPCODE_F_DIST_LT,
+ ocFDist_RT = SC_OPCODE_F_DIST_RT,
+ ocChiDist = SC_OPCODE_CHI_DIST,
+ ocChiDist_MS = SC_OPCODE_CHI_DIST_MS,
+ ocChiSqDist = SC_OPCODE_CHISQ_DIST,
+ ocChiSqDist_MS = SC_OPCODE_CHISQ_DIST_MS,
+ ocChiSqInv = SC_OPCODE_CHISQ_INV,
+ ocChiSqInv_MS = SC_OPCODE_CHISQ_INV_MS,
+ ocWeibull = SC_OPCODE_WEIBULL,
+ ocWeibull_MS = SC_OPCODE_WEIBULL_MS,
+ ocNegBinomVert = SC_OPCODE_NEG_BINOM_VERT,
+ ocNegBinomDist_MS = SC_OPCODE_NEG_BINOM_DIST_MS,
+ ocCritBinom = SC_OPCODE_CRIT_BINOM,
+ ocKurt = SC_OPCODE_KURT,
+ ocHarMean = SC_OPCODE_HAR_MEAN,
+ ocGeoMean = SC_OPCODE_GEO_MEAN,
+ ocStandard = SC_OPCODE_STANDARD,
+ ocAveDev = SC_OPCODE_AVE_DEV,
+ ocSkew = SC_OPCODE_SKEW,
+ ocSkewp = SC_OPCODE_SKEWP,
+ ocDevSq = SC_OPCODE_DEV_SQ,
+ ocMedian = SC_OPCODE_MEDIAN,
+ ocModalValue = SC_OPCODE_MODAL_VALUE,
+ ocModalValue_MS = SC_OPCODE_MODAL_VALUE_MS,
+ ocModalValue_Multi = SC_OPCODE_MODAL_VALUE_MULTI,
+ ocZTest = SC_OPCODE_Z_TEST,
+ ocZTest_MS = SC_OPCODE_Z_TEST_MS,
+ ocAggregate = SC_OPCODE_AGGREGATE,
+ ocTTest = SC_OPCODE_T_TEST,
+ ocTTest_MS = SC_OPCODE_T_TEST_MS,
+ ocRank = SC_OPCODE_RANK,
+ ocPercentile = SC_OPCODE_PERCENTILE,
+ ocPercentrank = SC_OPCODE_PERCENT_RANK,
+ ocPercentile_Inc = SC_OPCODE_PERCENTILE_INC,
+ ocPercentrank_Inc = SC_OPCODE_PERCENT_RANK_INC,
+ ocQuartile_Inc = SC_OPCODE_QUARTILE_INC,
+ ocRank_Eq = SC_OPCODE_RANK_EQ,
+ ocPercentile_Exc = SC_OPCODE_PERCENTILE_EXC,
+ ocPercentrank_Exc = SC_OPCODE_PERCENT_RANK_EXC,
+ ocQuartile_Exc = SC_OPCODE_QUARTILE_EXC,
+ ocRank_Avg = SC_OPCODE_RANK_AVG,
+ ocLarge = SC_OPCODE_LARGE,
+ ocSmall = SC_OPCODE_SMALL,
+ ocFrequency = SC_OPCODE_FREQUENCY,
+ ocQuartile = SC_OPCODE_QUARTILE,
+ ocNormInv = SC_OPCODE_NORM_INV,
+ ocNormInv_MS = SC_OPCODE_NORM_INV_MS,
+ ocConfidence = SC_OPCODE_CONFIDENCE,
+ ocConfidence_N = SC_OPCODE_CONFIDENCE_N,
+ ocConfidence_T = SC_OPCODE_CONFIDENCE_T,
+ ocFTest = SC_OPCODE_F_TEST,
+ ocFTest_MS = SC_OPCODE_F_TEST_MS,
+ ocTrimMean = SC_OPCODE_TRIM_MEAN,
+ ocProb = SC_OPCODE_PROB,
+ ocCorrel = SC_OPCODE_CORREL,
+ ocCovar = SC_OPCODE_COVAR,
+ ocCovarianceP = SC_OPCODE_COVARIANCE_P,
+ ocCovarianceS = SC_OPCODE_COVARIANCE_S,
+ ocPearson = SC_OPCODE_PEARSON,
+ ocRSQ = SC_OPCODE_RSQ,
+ ocSTEYX = SC_OPCODE_STEYX,
+ ocSlope = SC_OPCODE_SLOPE,
+ ocIntercept = SC_OPCODE_INTERCEPT,
+ ocTrend = SC_OPCODE_TREND,
+ ocGrowth = SC_OPCODE_GROWTH,
+ ocLinest = SC_OPCODE_LINEST,
+ ocLogest = SC_OPCODE_LOGEST,
+ ocForecast = SC_OPCODE_FORECAST,
+ ocForecast_ETS_ADD = SC_OPCODE_FORECAST_ETS_ADD,
+ ocForecast_ETS_SEA = SC_OPCODE_FORECAST_ETS_SEA,
+ ocForecast_ETS_MUL = SC_OPCODE_FORECAST_ETS_MUL,
+ ocForecast_ETS_PIA = SC_OPCODE_FORECAST_ETS_PIA,
+ ocForecast_ETS_PIM = SC_OPCODE_FORECAST_ETS_PIM,
+ ocForecast_ETS_STA = SC_OPCODE_FORECAST_ETS_STA,
+ ocForecast_ETS_STM = SC_OPCODE_FORECAST_ETS_STM,
+ ocForecast_LIN = SC_OPCODE_FORECAST_LIN,
+ ocChiInv = SC_OPCODE_CHI_INV,
+ ocChiInv_MS = SC_OPCODE_CHI_INV_MS,
+ ocGammaDist = SC_OPCODE_GAMMA_DIST,
+ ocGammaDist_MS = SC_OPCODE_GAMMA_DIST_MS,
+ ocGammaInv = SC_OPCODE_GAMMA_INV,
+ ocGammaInv_MS = SC_OPCODE_GAMMA_INV_MS,
+ ocTInv = SC_OPCODE_T_INV,
+ ocTInv_2T = SC_OPCODE_T_INV_2T,
+ ocTInv_MS = SC_OPCODE_T_INV_MS,
+ ocFInv = SC_OPCODE_F_INV,
+ ocFInv_LT = SC_OPCODE_F_INV_LT,
+ ocFInv_RT = SC_OPCODE_F_INV_RT,
+ ocChiTest = SC_OPCODE_CHI_TEST,
+ ocChiTest_MS = SC_OPCODE_CHI_TEST_MS,
+ ocLogInv = SC_OPCODE_LOG_INV,
+ ocLogInv_MS = SC_OPCODE_LOG_INV_MS,
+ ocTableOp = SC_OPCODE_TABLE_OP,
+ ocBetaDist = SC_OPCODE_BETA_DIST,
+ ocBetaInv = SC_OPCODE_BETA_INV,
+ ocBetaDist_MS = SC_OPCODE_BETA_DIST_MS,
+ ocBetaInv_MS = SC_OPCODE_BETA_INV_MS,
+ // Bit functions
+ ocBitAnd = SC_OPCODE_BITAND,
+ ocBitOr = SC_OPCODE_BITOR,
+ ocBitXor = SC_OPCODE_BITXOR,
+ ocBitRshift = SC_OPCODE_BITRSHIFT,
+ ocBitLshift = SC_OPCODE_BITLSHIFT,
+ // miscellaneous
+ ocWeek = SC_OPCODE_WEEK,
+ ocIsoWeeknum = SC_OPCODE_ISOWEEKNUM,
+ ocWeeknumOOo = SC_OPCODE_WEEKNUM_OOO,
+ ocGetDayOfWeek = SC_OPCODE_GET_DAY_OF_WEEK,
+ ocNetWorkdays = SC_OPCODE_NETWORKDAYS,
+ ocNetWorkdays_MS = SC_OPCODE_NETWORKDAYS_MS,
+ ocWorkday_MS = SC_OPCODE_WORKDAY_MS,
+ ocNoName = SC_OPCODE_NO_NAME,
+ ocStyle = SC_OPCODE_STYLE,
+ ocDde = SC_OPCODE_DDE,
+ ocBase = SC_OPCODE_BASE,
+ ocSheet = SC_OPCODE_SHEET,
+ ocSheets = SC_OPCODE_SHEETS,
+ ocMinA = SC_OPCODE_MIN_A,
+ ocMaxA = SC_OPCODE_MAX_A,
+ ocAverageA = SC_OPCODE_AVERAGE_A,
+ ocStDevA = SC_OPCODE_ST_DEV_A,
+ ocStDevPA = SC_OPCODE_ST_DEV_P_A,
+ ocVarA = SC_OPCODE_VAR_A,
+ ocVarPA = SC_OPCODE_VAR_P_A,
+ ocEasterSunday = SC_OPCODE_EASTERSUNDAY,
+ ocDecimal = SC_OPCODE_DECIMAL,
+ ocConvertOOo = SC_OPCODE_CONVERT_OOO,
+ ocRoman = SC_OPCODE_ROMAN,
+ ocHyperLink = SC_OPCODE_HYPERLINK,
+ ocGetPivotData = SC_OPCODE_GET_PIVOT_DATA,
+ ocEuroConvert = SC_OPCODE_EUROCONVERT,
+ ocFilterXML = SC_OPCODE_FILTERXML,
+ ocWebservice = SC_OPCODE_WEBSERVICE,
+ ocColor = SC_OPCODE_COLOR,
+ ocErf_MS = SC_OPCODE_ERF_MS,
+ ocErfc_MS = SC_OPCODE_ERFC_MS,
+ ocEncodeURL = SC_OPCODE_ENCODEURL,
+ ocFourier = SC_OPCODE_FOURIER,
+ ocRandbetweenNV = SC_OPCODE_RANDBETWEEN_NV,
+ // internal stuff
+ ocInternalBegin = SC_OPCODE_INTERNAL_BEGIN,
+ ocTTT = SC_OPCODE_TTT,
+ ocDebugVar = SC_OPCODE_DEBUG_VAR,
+ ocInternalEnd = SC_OPCODE_INTERNAL_END,
+ // from here on ExtraData
+ ocDataToken1 = SC_OPCODE_DATA_TOKEN_1,
+ // no OpCode
+ ocNone = SC_OPCODE_NONE
+};
+
+// Only to be used for debugging output. No guarantee of stability of the
+// return value.
+
+// Turn this into an operator<< when OpCode becomes a scoped enum
+
+inline std::string OpCodeEnumToString(OpCode eCode)
+{
+ switch (eCode)
+ {
+ case ocPush: return "Push";
+ case ocCall: return "Call";
+ case ocStop: return "Stop";
+ case ocExternal: return "External";
+ case ocName: return "Name";
+ case ocIf: return "If";
+ case ocIfError: return "IfError";
+ case ocIfNA: return "IfNA";
+ case ocChoose: return "Choose";
+ case ocOpen: return "Open";
+ case ocClose: return "Close";
+ case ocTableRefOpen: return "TableRefOpen";
+ case ocTableRefClose: return "TableRefClose";
+ case ocSep: return "Sep";
+ case ocArrayOpen: return "ArrayOpen";
+ case ocArrayClose: return "ArrayClose";
+ case ocArrayRowSep: return "ArrayRowSep";
+ case ocArrayColSep: return "ArrayColSep";
+ case ocMissing: return "Missing";
+ case ocBad: return "Bad";
+ case ocStringXML: return "StringXML";
+ case ocSpaces: return "Spaces";
+ case ocWhitespace: return "Whitespace";
+ case ocMatRef: return "MatRef";
+ case ocTableRefItemAll: return "TableRefItemAll";
+ case ocTableRefItemHeaders: return "TableRefItemHeaders";
+ case ocTableRefItemData: return "TableRefItemData";
+ case ocTableRefItemTotals: return "TableRefItemTotals";
+ case ocTableRefItemThisRow: return "TableRefItemThisRow";
+ case ocSkip: return "Skip";
+ case ocDBArea: return "DBArea";
+ case ocTableRef: return "TableRef";
+ case ocMacro: return "Macro";
+ case ocColRowName: return "ColRowName";
+ case ocColRowNameAuto: return "ColRowNameAuto";
+ case ocPercentSign: return "PercentSign";
+ case ocErrNull: return "ErrNull";
+ case ocErrDivZero: return "ErrDivZero";
+ case ocErrValue: return "ErrValue";
+ case ocErrRef: return "ErrRef";
+ case ocErrName: return "ErrName";
+ case ocErrNum: return "ErrNum";
+ case ocErrNA: return "ErrNA";
+ case ocAdd: return "Add";
+ case ocSub: return "Sub";
+ case ocMul: return "Mul";
+ case ocDiv: return "Div";
+ case ocAmpersand: return "Ampersand";
+ case ocPow: return "Pow";
+ case ocEqual: return "Equal";
+ case ocNotEqual: return "NotEqual";
+ case ocLess: return "Less";
+ case ocGreater: return "Greater";
+ case ocLessEqual: return "LessEqual";
+ case ocGreaterEqual: return "GreaterEqual";
+ case ocAnd: return "And";
+ case ocOr: return "Or";
+ case ocXor: return "Xor";
+ case ocIntersect: return "Intersect";
+ case ocUnion: return "Union";
+ case ocRange: return "Range";
+ case ocNot: return "Not";
+ case ocNeg: return "Neg";
+ case ocNegSub: return "NegSub";
+ case ocPi: return "Pi";
+ case ocRandom: return "Random";
+ case ocRandomNV: return "RandomNV";
+ case ocTrue: return "True";
+ case ocFalse: return "False";
+ case ocGetActDate: return "GetActDate";
+ case ocGetActTime: return "GetActTime";
+ case ocNotAvail: return "NotAvail";
+ case ocCurrent: return "Current";
+ case ocDeg: return "Deg";
+ case ocRad: return "Rad";
+ case ocSin: return "Sin";
+ case ocCos: return "Cos";
+ case ocTan: return "Tan";
+ case ocCot: return "Cot";
+ case ocArcSin: return "ArcSin";
+ case ocArcCos: return "ArcCos";
+ case ocArcTan: return "ArcTan";
+ case ocArcCot: return "ArcCot";
+ case ocSinHyp: return "SinHyp";
+ case ocCosHyp: return "CosHyp";
+ case ocTanHyp: return "TanHyp";
+ case ocCotHyp: return "CotHyp";
+ case ocArcSinHyp: return "ArcSinHyp";
+ case ocArcCosHyp: return "ArcCosHyp";
+ case ocArcTanHyp: return "ArcTanHyp";
+ case ocArcCotHyp: return "ArcCotHyp";
+ case ocCosecant: return "Cosecant";
+ case ocSecant: return "Secant";
+ case ocCosecantHyp: return "CosecantHyp";
+ case ocSecantHyp: return "SecantHyp";
+ case ocExp: return "Exp";
+ case ocLn: return "Ln";
+ case ocSqrt: return "Sqrt";
+ case ocFact: return "Fact";
+ case ocGetYear: return "GetYear";
+ case ocGetMonth: return "GetMonth";
+ case ocGetDay: return "GetDay";
+ case ocGetHour: return "GetHour";
+ case ocGetMin: return "GetMin";
+ case ocGetSec: return "GetSec";
+ case ocPlusMinus: return "PlusMinus";
+ case ocAbs: return "Abs";
+ case ocInt: return "Int";
+ case ocPhi: return "Phi";
+ case ocGauss: return "Gauss";
+ case ocIsEmpty: return "IsEmpty";
+ case ocIsString: return "IsString";
+ case ocIsNonString: return "IsNonString";
+ case ocIsLogical: return "IsLogical";
+ case ocType: return "Type";
+ case ocCell: return "Cell";
+ case ocIsRef: return "IsRef";
+ case ocIsValue: return "IsValue";
+ case ocIsFormula: return "IsFormula";
+ case ocIsNA: return "IsNA";
+ case ocIsErr: return "IsErr";
+ case ocIsError: return "IsError";
+ case ocIsEven: return "IsEven";
+ case ocIsOdd: return "IsOdd";
+ case ocN: return "N";
+ case ocGetDateValue: return "GetDateValue";
+ case ocGetTimeValue: return "GetTimeValue";
+ case ocCode: return "Code";
+ case ocTrim: return "Trim";
+ case ocUpper: return "Upper";
+ case ocProper: return "Proper";
+ case ocLower: return "Lower";
+ case ocLen: return "Len";
+ case ocT: return "T";
+ case ocValue: return "Value";
+ case ocClean: return "Clean";
+ case ocChar: return "Char";
+ case ocLog10: return "Log10";
+ case ocEven: return "Even";
+ case ocOdd: return "Odd";
+ case ocStdNormDist: return "StdNormDist";
+ case ocStdNormDist_MS: return "StdNormDist_MS";
+ case ocFisher: return "Fisher";
+ case ocFisherInv: return "FisherInv";
+ case ocSNormInv: return "SNormInv";
+ case ocSNormInv_MS: return "SNormInv_MS";
+ case ocGammaLn: return "GammaLn";
+ case ocGammaLn_MS: return "GammaLn_MS";
+ case ocGamma: return "Gamma";
+ case ocErrorType: return "ErrorType";
+ case ocErrorType_ODF: return "ErrorType_ODF";
+ case ocFormula: return "Formula";
+ case ocArabic: return "Arabic";
+ case ocInfo: return "Info";
+ case ocBahtText: return "BahtText";
+ case ocJis: return "Jis";
+ case ocAsc: return "Asc";
+ case ocUnicode: return "Unicode";
+ case ocUnichar: return "Unichar";
+ case ocArcTan2: return "ArcTan2";
+ case ocCeil: return "Ceil";
+ case ocCeil_MS: return "Ceil_MS";
+ case ocCeil_Precise: return "Ceil_Precise";
+ case ocCeil_ISO: return "Ceil_ISO";
+ case ocCeil_Math: return "Ceil_Math";
+ case ocFloor: return "Floor";
+ case ocFloor_MS: return "Floor_MS";
+ case ocFloor_Math: return "Floor_Math";
+ case ocFloor_Precise: return "Floor_Precise";
+ case ocRound: return "Round";
+ case ocRoundUp: return "RoundUp";
+ case ocRoundDown: return "RoundDown";
+ case ocTrunc: return "Trunc";
+ case ocLog: return "Log";
+ case ocPower: return "Power";
+ case ocGCD: return "GCD";
+ case ocLCM: return "LCM";
+ case ocMod: return "Mod";
+ case ocSumProduct: return "SumProduct";
+ case ocSumSQ: return "SumSQ";
+ case ocSumX2MY2: return "SumX2MY2";
+ case ocSumX2DY2: return "SumX2DY2";
+ case ocSumXMY2: return "SumXMY2";
+ case ocGetDate: return "GetDate";
+ case ocGetTime: return "GetTime";
+ case ocGetDiffDate: return "GetDiffDate";
+ case ocGetDiffDate360: return "GetDiffDate360";
+ case ocGetDateDif: return "GetDateDif";
+ case ocMin: return "Min";
+ case ocMax: return "Max";
+ case ocSum: return "Sum";
+ case ocProduct: return "Product";
+ case ocAverage: return "Average";
+ case ocCount: return "Count";
+ case ocCount2: return "Count2";
+ case ocNPV: return "NPV";
+ case ocIRR: return "IRR";
+ case ocMIRR: return "MIRR";
+ case ocISPMT: return "ISPMT";
+ case ocVar: return "Var";
+ case ocVarP: return "VarP";
+ case ocVarP_MS: return "VarP_MS";
+ case ocVarS: return "VarS";
+ case ocStDev: return "StDev";
+ case ocStDevP: return "StDevP";
+ case ocStDevP_MS: return "StDevP_MS";
+ case ocStDevS: return "StDevS";
+ case ocB: return "B";
+ case ocNormDist: return "NormDist";
+ case ocNormDist_MS: return "NormDist_MS";
+ case ocExpDist: return "ExpDist";
+ case ocExpDist_MS: return "ExpDist_MS";
+ case ocBinomDist: return "BinomDist";
+ case ocBinomDist_MS: return "BinomDist_MS";
+ case ocBinomInv: return "BinomInv";
+ case ocPoissonDist: return "PoissonDist";
+ case ocPoissonDist_MS: return "PoissonDist_MS";
+ case ocCombin: return "Combin";
+ case ocCombinA: return "CombinA";
+ case ocPermut: return "Permut";
+ case ocPermutationA: return "PermutationA";
+ case ocPV: return "PV";
+ case ocSYD: return "SYD";
+ case ocDDB: return "DDB";
+ case ocDB: return "DB";
+ case ocVBD: return "VBD";
+ case ocPDuration: return "PDuration";
+ case ocSLN: return "SLN";
+ case ocPMT: return "PMT";
+ case ocColumns: return "Columns";
+ case ocRows: return "Rows";
+ case ocColumn: return "Column";
+ case ocRow: return "Row";
+ case ocRRI: return "RRI";
+ case ocFV: return "FV";
+ case ocNper: return "Nper";
+ case ocRate: return "Rate";
+ case ocIpmt: return "Ipmt";
+ case ocPpmt: return "Ppmt";
+ case ocCumIpmt: return "CumIpmt";
+ case ocCumPrinc: return "CumPrinc";
+ case ocEffect: return "Effect";
+ case ocNominal: return "Nominal";
+ case ocSubTotal: return "SubTotal";
+ case ocRawSubtract: return "RawSubtract";
+ case ocIfs_MS: return "Ifs_MS";
+ case ocSwitch_MS: return "Switch_MS";
+ case ocMinIfs_MS: return "MinIfs_MS";
+ case ocMaxIfs_MS: return "MaxIfs_MS";
+ case ocRoundSig: return "RoundSig";
+ case ocDBSum: return "DBSum";
+ case ocDBCount: return "DBCount";
+ case ocDBCount2: return "DBCount2";
+ case ocDBAverage: return "DBAverage";
+ case ocDBGet: return "DBGet";
+ case ocDBMax: return "DBMax";
+ case ocDBMin: return "DBMin";
+ case ocDBProduct: return "DBProduct";
+ case ocDBStdDev: return "DBStdDev";
+ case ocDBStdDevP: return "DBStdDevP";
+ case ocDBVar: return "DBVar";
+ case ocDBVarP: return "DBVarP";
+ case ocIndirect: return "Indirect";
+ case ocAddress: return "Address";
+ case ocMatch: return "Match";
+ case ocCountEmptyCells: return "CountEmptyCells";
+ case ocCountIf: return "CountIf";
+ case ocSumIf: return "SumIf";
+ case ocAverageIf: return "AverageIf";
+ case ocSumIfs: return "SumIfs";
+ case ocAverageIfs: return "AverageIfs";
+ case ocCountIfs: return "CountIfs";
+ case ocLookup: return "Lookup";
+ case ocVLookup: return "VLookup";
+ case ocHLookup: return "HLookup";
+ case ocMultiArea: return "MultiArea";
+ case ocOffset: return "Offset";
+ case ocIndex: return "Index";
+ case ocAreas: return "Areas";
+ case ocCurrency: return "Currency";
+ case ocReplace: return "Replace";
+ case ocFixed: return "Fixed";
+ case ocFind: return "Find";
+ case ocExact: return "Exact";
+ case ocLeft: return "Left";
+ case ocRight: return "Right";
+ case ocSearch: return "Search";
+ case ocMid: return "Mid";
+ case ocText: return "Text";
+ case ocSubstitute: return "Substitute";
+ case ocRept: return "Rept";
+ case ocRegex: return "Regex";
+ case ocConcat: return "Concat";
+ case ocConcat_MS: return "Concat_MS";
+ case ocTextJoin_MS: return "TextJoin_MS";
+ case ocLenB: return "LenB";
+ case ocRightB: return "RightB";
+ case ocLeftB: return "LeftB";
+ case ocMidB: return "MidB";
+ case ocReplaceB: return "ReplaceB";
+ case ocFindB: return "FindB";
+ case ocSearchB: return "SearchB";
+ case ocNumberValue: return "NumberValue";
+ case ocMatValue: return "MatValue";
+ case ocMatDet: return "MatDet";
+ case ocMatInv: return "MatInv";
+ case ocMatMult: return "MatMult";
+ case ocMatTrans: return "MatTrans";
+ case ocMatrixUnit: return "MatrixUnit";
+ case ocBackSolver: return "BackSolver";
+ case ocHypGeomDist: return "HypGeomDist";
+ case ocHypGeomDist_MS: return "HypGeomDist_MS";
+ case ocLogNormDist: return "LogNormDist";
+ case ocLogNormDist_MS: return "LogNormDist_MS";
+ case ocTDist: return "TDist";
+ case ocTDist_MS: return "TDist_MS";
+ case ocTDist_RT: return "TDist_RT";
+ case ocTDist_2T: return "TDist_2T";
+ case ocFDist: return "FDist";
+ case ocFDist_LT: return "FDist_LT";
+ case ocFDist_RT: return "FDist_RT";
+ case ocChiDist: return "ChiDist";
+ case ocChiDist_MS: return "ChiDist_MS";
+ case ocChiSqDist: return "ChiSqDist";
+ case ocChiSqDist_MS: return "ChiSqDist_MS";
+ case ocChiSqInv: return "ChiSqInv";
+ case ocChiSqInv_MS: return "ChiSqInv_MS";
+ case ocWeibull: return "Weibull";
+ case ocWeibull_MS: return "Weibull_MS";
+ case ocNegBinomVert: return "NegBinomVert";
+ case ocNegBinomDist_MS: return "NegBinomDist_MS";
+ case ocCritBinom: return "CritBinom";
+ case ocKurt: return "Kurt";
+ case ocHarMean: return "HarMean";
+ case ocGeoMean: return "GeoMean";
+ case ocStandard: return "Standard";
+ case ocAveDev: return "AveDev";
+ case ocSkew: return "Skew";
+ case ocSkewp: return "Skewp";
+ case ocDevSq: return "DevSq";
+ case ocMedian: return "Median";
+ case ocModalValue: return "ModalValue";
+ case ocModalValue_MS: return "ModalValue_MS";
+ case ocModalValue_Multi: return "ModalValue_Multi";
+ case ocZTest: return "ZTest";
+ case ocZTest_MS: return "ZTest_MS";
+ case ocAggregate: return "Aggregate";
+ case ocTTest: return "TTest";
+ case ocTTest_MS: return "TTest_MS";
+ case ocRank: return "Rank";
+ case ocPercentile: return "Percentile";
+ case ocPercentrank: return "Percentrank";
+ case ocPercentile_Inc: return "Percentile_Inc";
+ case ocPercentrank_Inc: return "Percentrank_Inc";
+ case ocQuartile_Inc: return "Quartile_Inc";
+ case ocRank_Eq: return "Rank_Eq";
+ case ocPercentile_Exc: return "Percentile_Exc";
+ case ocPercentrank_Exc: return "Percentrank_Exc";
+ case ocQuartile_Exc: return "Quartile_Exc";
+ case ocRank_Avg: return "Rank_Avg";
+ case ocLarge: return "Large";
+ case ocSmall: return "Small";
+ case ocFrequency: return "Frequency";
+ case ocQuartile: return "Quartile";
+ case ocNormInv: return "NormInv";
+ case ocNormInv_MS: return "NormInv_MS";
+ case ocConfidence: return "Confidence";
+ case ocConfidence_N: return "Confidence_N";
+ case ocConfidence_T: return "Confidence_T";
+ case ocFTest: return "FTest";
+ case ocFTest_MS: return "FTest_MS";
+ case ocTrimMean: return "TrimMean";
+ case ocProb: return "Prob";
+ case ocCorrel: return "Correl";
+ case ocCovar: return "Covar";
+ case ocCovarianceP: return "CovarianceP";
+ case ocCovarianceS: return "CovarianceS";
+ case ocPearson: return "Pearson";
+ case ocRSQ: return "RSQ";
+ case ocSTEYX: return "STEYX";
+ case ocSlope: return "Slope";
+ case ocIntercept: return "Intercept";
+ case ocTrend: return "Trend";
+ case ocGrowth: return "Growth";
+ case ocLinest: return "Linest";
+ case ocLogest: return "Logest";
+ case ocForecast: return "Forecast";
+ case ocForecast_ETS_ADD: return "Forecast_ETS_ADD";
+ case ocForecast_ETS_SEA: return "Forecast_ETS_SEA";
+ case ocForecast_ETS_MUL: return "Forecast_ETS_MUL";
+ case ocForecast_ETS_PIA: return "Forecast_ETS_PIA";
+ case ocForecast_ETS_PIM: return "Forecast_ETS_PIM";
+ case ocForecast_ETS_STA: return "Forecast_ETS_STA";
+ case ocForecast_ETS_STM: return "Forecast_ETS_STM";
+ case ocForecast_LIN: return "Forecast_LIN";
+ case ocChiInv: return "ChiInv";
+ case ocChiInv_MS: return "ChiInv_MS";
+ case ocGammaDist: return "GammaDist";
+ case ocGammaDist_MS: return "GammaDist_MS";
+ case ocGammaInv: return "GammaInv";
+ case ocGammaInv_MS: return "GammaInv_MS";
+ case ocTInv: return "TInv";
+ case ocTInv_2T: return "TInv_2T";
+ case ocTInv_MS: return "TInv_MS";
+ case ocFInv: return "FInv";
+ case ocFInv_LT: return "FInv_LT";
+ case ocFInv_RT: return "FInv_RT";
+ case ocChiTest: return "ChiTest";
+ case ocChiTest_MS: return "ChiTest_MS";
+ case ocLogInv: return "LogInv";
+ case ocLogInv_MS: return "LogInv_MS";
+ case ocTableOp: return "TableOp";
+ case ocBetaDist: return "BetaDist";
+ case ocBetaInv: return "BetaInv";
+ case ocBetaDist_MS: return "BetaDist_MS";
+ case ocBetaInv_MS: return "BetaInv_MS";
+ case ocBitAnd: return "BitAnd";
+ case ocBitOr: return "BitOr";
+ case ocBitXor: return "BitXor";
+ case ocBitRshift: return "BitRshift";
+ case ocBitLshift: return "BitLshift";
+ case ocWeek: return "Week";
+ case ocIsoWeeknum: return "IsoWeeknum";
+ case ocWeeknumOOo: return "WeeknumOOo";
+ case ocGetDayOfWeek: return "GetDayOfWeek";
+ case ocNetWorkdays: return "NetWorkdays";
+ case ocNetWorkdays_MS: return "NetWorkdays_MS";
+ case ocWorkday_MS: return "Workday_MS";
+ case ocNoName: return "NoName";
+ case ocStyle: return "Style";
+ case ocDde: return "Dde";
+ case ocBase: return "Base";
+ case ocSheet: return "Sheet";
+ case ocSheets: return "Sheets";
+ case ocMinA: return "MinA";
+ case ocMaxA: return "MaxA";
+ case ocAverageA: return "AverageA";
+ case ocStDevA: return "StDevA";
+ case ocStDevPA: return "StDevPA";
+ case ocVarA: return "VarA";
+ case ocVarPA: return "VarPA";
+ case ocEasterSunday: return "EasterSunday";
+ case ocDecimal: return "Decimal";
+ case ocConvertOOo: return "ConvertOOo";
+ case ocRoman: return "Roman";
+ case ocHyperLink: return "HyperLink";
+ case ocGetPivotData: return "GetPivotData";
+ case ocEuroConvert: return "EuroConvert";
+ case ocFilterXML: return "FilterXML";
+ case ocWebservice: return "Webservice";
+ case ocColor: return "Color";
+ case ocErf_MS: return "Erf_MS";
+ case ocErfc_MS: return "Erfc_MS";
+ case ocEncodeURL: return "EncodeURL";
+ case ocFourier: return "Fourier";
+ case ocRandbetweenNV: return "RandbetweenNV";
+ case ocTTT: return "TTT";
+ case ocDebugVar: return "DebugVar";
+ case ocDataToken1: return "DataToken1";
+ case ocNone: return "None";
+ }
+ std::ostringstream os;
+ os << static_cast<int>(eCode);
+ return os.str();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/paramclass.hxx b/include/formula/paramclass.hxx
new file mode 100644
index 000000000..30773c35e
--- /dev/null
+++ b/include/formula/paramclass.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_FORMULA_PARAMCLASS_HXX
+#define INCLUDED_FORMULA_PARAMCLASS_HXX
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+namespace formula
+{
+ enum ParamClass : sal_uInt8
+ {
+ Unknown = 0, // MUST be zero for initialization mechanism!
+
+ /** Out of bounds, function doesn't expect that many parameters.
+ However, not necessarily returned if a module specific definition
+ for example returns type Value for an unlisted function. */
+ Bounds,
+
+ /** In array formula: single value to be passed. Results in JumpMatrix
+ being created and multiple calls to function. Functions handling a
+ formula::svDoubleRef by means of DoubleRefToPosSingleRef() or
+ PopDoubleRefOrSingleRef() or GetDouble() or GetString() should have
+ this. */
+ Value,
+
+ /** In array formula: area reference must stay reference. Otherwise
+ don't care. Functions handling a formula::svDoubleRef by means of
+ PopDoubleRefOrSingleRef() should not have this. */
+ Reference,
+
+ /** Like Reference but the function accepts also a list of references
+ (ocUnion svRefList) as one argument AND handles the special case of
+ an array of references in array mode. Then the resulting argument
+ for a parameter in JumpMatrix context may be an array of references
+ which then is to be preferred over a result matrix. This final
+ behaviour is the opposite of SuppressedReferenceOrForceArray. */
+ ReferenceOrRefArray,
+
+ /** In array formula: convert area reference to array. Function will be
+ called only once if no Value type is involved. Functions able to
+ handle a svMatrix parameter but not a formula::svDoubleRef parameter as area
+ should have this. */
+ Array,
+
+ /** Area reference must be converted to array in any case, and must
+ also be propagated to subsequent operators and functions being part
+ of a parameter of this function. */
+ ForceArray,
+
+ /** Area reference is not converted to array, but ForceArray must be
+ propagated to subsequent operators and functions being part of a
+ parameter of this function. Used with functions that treat
+ references separately from arrays, but need the forced array
+ calculation of parameters that are not references. */
+ ReferenceOrForceArray,
+
+ /** Same as ReferenceOrForceArray but suppressed / not inherited in the
+ compiler's ForceArray context to indicate that a result of
+ Reference in JumpMatrix context should use the result matrix
+ instead of the array of references. Never used as initial parameter
+ classification. */
+ SuppressedReferenceOrForceArray,
+
+ /** A function return forces the caller into array mode for this one
+ call, making it behave like it had ForceArray but not propagated to
+ any further operators in the same parameter. */
+ ForceArrayReturn
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
new file mode 100644
index 000000000..ebb08e6d7
--- /dev/null
+++ b/include/formula/token.hxx
@@ -0,0 +1,482 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_TOKEN_HXX
+#define INCLUDED_FORMULA_TOKEN_HXX
+
+#include <sal/config.h>
+
+#include <cstring>
+#include <memory>
+#include <vector>
+
+#include <formula/formuladllapi.h>
+#include <formula/opcode.hxx>
+#include <formula/types.hxx>
+#include <formula/paramclass.hxx>
+#include <osl/interlck.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svl/sharedstring.hxx>
+
+class ScJumpMatrix;
+class ScMatrix;
+struct ScComplexRefData;
+struct ScSingleRefData;
+enum class FormulaError : sal_uInt16;
+
+namespace formula
+{
+
+enum StackVar : sal_uInt8
+{
+ svByte,
+ svDouble,
+ svString,
+ svSingleRef,
+ svDoubleRef,
+ svMatrix,
+ svIndex,
+ svJump,
+ svExternal, // Byte + String
+ svFAP, // FormulaAutoPilot only, ever exported
+ svJumpMatrix,
+ svRefList, // ocUnion result
+ svEmptyCell, // Result is an empty cell, e.g. in LOOKUP()
+
+ svMatrixCell, // Result is a matrix with bells and
+ // whistles as needed for _the_ matrix
+ // formula result.
+
+ svHybridCell, // A temporary condition of a formula
+ // cell during import, having a double
+ // and/or string result and a formula
+ // string to be compiled.
+
+ svExternalSingleRef,
+ svExternalDoubleRef,
+ svExternalName,
+ svSingleVectorRef,
+ svDoubleVectorRef,
+ svError, // error token
+ svMissing, // 0 or ""
+ svSep, // separator, ocSep, ocOpen, ocClose
+ svUnknown // unknown StackType
+};
+
+// Only to be used for debugging output. No guarantee of stability of the
+// return value.
+
+// Turn this into an operator<< when StackVar becomes a scoped enum
+
+inline std::string StackVarEnumToString(StackVar const e)
+{
+ switch (e)
+ {
+ case svByte: return "Byte";
+ case svDouble: return "Double";
+ case svString: return "String";
+ case svSingleRef: return "SingleRef";
+ case svDoubleRef: return "DoubleRef";
+ case svMatrix: return "Matrix";
+ case svIndex: return "Index";
+ case svJump: return "Jump";
+ case svExternal: return "External";
+ case svFAP: return "FAP";
+ case svJumpMatrix: return "JumpMatrix";
+ case svRefList: return "RefList";
+ case svEmptyCell: return "EmptyCell";
+ case svMatrixCell: return "MatrixCell";
+ case svHybridCell: return "HybridCell";
+ case svExternalSingleRef: return "ExternalSingleRef";
+ case svExternalDoubleRef: return "ExternalDoubleRef";
+ case svExternalName: return "ExternalName";
+ case svSingleVectorRef: return "SingleVectorRef";
+ case svDoubleVectorRef: return "DoubleVectorRef";
+ case svError: return "Error";
+ case svMissing: return "Missing";
+ case svSep: return "Sep";
+ case svUnknown: return "Unknown";
+ }
+ std::ostringstream os;
+ os << static_cast<int>(e);
+ return os.str();
+}
+
+class FORMULA_DLLPUBLIC FormulaToken
+{
+ OpCode eOp;
+ const StackVar eType; // type of data
+ mutable oslInterlockedCount mnRefCnt; // reference count
+
+ FormulaToken& operator=( const FormulaToken& ) = delete;
+public:
+ FormulaToken( StackVar eTypeP,OpCode e = ocPush );
+ FormulaToken( const FormulaToken& r );
+
+ virtual ~FormulaToken();
+
+ void Delete() { delete this; }
+ void DeleteIfZeroRef() { if (mnRefCnt == 0) delete this; }
+ StackVar GetType() const { return eType; }
+ bool IsFunction() const; // pure functions, no operators
+
+ bool IsExternalRef() const;
+ bool IsRef() const;
+
+ sal_uInt8 GetParamCount() const;
+
+ void IncRef() const
+ {
+ osl_atomic_increment(&mnRefCnt);
+ }
+
+ void DecRef() const
+ {
+ if (!osl_atomic_decrement(&mnRefCnt))
+ const_cast<FormulaToken*>(this)->Delete();
+ }
+
+ oslInterlockedCount GetRef() const { return mnRefCnt; }
+ OpCode GetOpCode() const { return eOp; }
+
+ bool IsInForceArray() const;
+
+ /**
+ Dummy methods to avoid switches and casts where possible,
+ the real token classes have to override the appropriate method[s].
+ The only methods valid anytime if not overridden are:
+
+ - GetByte() since this represents the count of parameters to a function
+ which of course is 0 on non-functions. FormulaByteToken and ScExternal do
+ override it.
+
+ - GetInForceArray() since also this is only used for operators and
+ functions and is ParamClass::Unknown for other tokens.
+
+ Any other non-overridden method pops up an assertion.
+ */
+
+ virtual sal_uInt8 GetByte() const;
+ virtual void SetByte( sal_uInt8 n );
+ virtual ParamClass GetInForceArray() const;
+ virtual void SetInForceArray( ParamClass c );
+ virtual double GetDouble() const;
+ virtual double& GetDoubleAsReference();
+ virtual sal_Int16 GetDoubleType() const;
+ virtual void SetDoubleType( sal_Int16 nType );
+ virtual const svl::SharedString & GetString() const;
+ virtual void SetString( const svl::SharedString& rStr );
+ virtual sal_uInt16 GetIndex() const;
+ virtual void SetIndex( sal_uInt16 n );
+ virtual sal_Int16 GetSheet() const;
+ virtual void SetSheet( sal_Int16 n );
+ virtual sal_Unicode GetChar() const;
+ virtual short* GetJump() const;
+ virtual const OUString& GetExternal() const;
+ virtual FormulaToken* GetFAPOrigToken() const;
+ virtual FormulaError GetError() const;
+ virtual void SetError( FormulaError );
+
+ virtual const ScSingleRefData* GetSingleRef() const;
+ virtual ScSingleRefData* GetSingleRef();
+ virtual const ScComplexRefData* GetDoubleRef() const;
+ virtual ScComplexRefData* GetDoubleRef();
+ virtual const ScSingleRefData* GetSingleRef2() const;
+ virtual ScSingleRefData* GetSingleRef2();
+ virtual const ScMatrix* GetMatrix() const;
+ virtual ScMatrix* GetMatrix();
+ virtual ScJumpMatrix* GetJumpMatrix() const;
+ virtual const std::vector<ScComplexRefData>* GetRefList() const;
+ virtual std::vector<ScComplexRefData>* GetRefList();
+
+ virtual FormulaToken* Clone() const { return new FormulaToken(*this); }
+
+ virtual bool TextEqual( const formula::FormulaToken& rToken ) const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
+
+ /** This is dirty and only the compiler should use it! */
+ struct PrivateAccess { friend class FormulaCompiler; private: PrivateAccess() { } };
+ void NewOpCode( OpCode e, const PrivateAccess& ) { eOp = e; }
+};
+
+inline void intrusive_ptr_add_ref(const FormulaToken* p)
+{
+ p->IncRef();
+}
+
+inline void intrusive_ptr_release(const FormulaToken* p)
+{
+ p->DecRef();
+}
+
+class FORMULA_DLLPUBLIC FormulaSpaceToken final : public FormulaToken
+{
+private:
+ sal_uInt8 nByte;
+ sal_Unicode cChar;
+public:
+ FormulaSpaceToken( sal_uInt8 n, sal_Unicode c ) :
+ FormulaToken( svByte, ocWhitespace ),
+ nByte( n ), cChar( c ) {}
+ FormulaSpaceToken( const FormulaSpaceToken& r ) :
+ FormulaToken( r ),
+ nByte( r.nByte ), cChar( r.cChar ) {}
+
+ virtual FormulaToken* Clone() const override { return new FormulaSpaceToken(*this); }
+ virtual sal_uInt8 GetByte() const override;
+ virtual sal_Unicode GetChar() const override;
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+class FORMULA_DLLPUBLIC FormulaByteToken : public FormulaToken
+{
+private:
+ sal_uInt8 nByte;
+ ParamClass eInForceArray;
+protected:
+ FormulaByteToken( OpCode e, sal_uInt8 n, StackVar v, ParamClass c ) :
+ FormulaToken( v,e ), nByte( n ),
+ eInForceArray( c ) {}
+public:
+ FormulaByteToken( OpCode e, sal_uInt8 n, ParamClass c ) :
+ FormulaToken( svByte,e ), nByte( n ),
+ eInForceArray( c ) {}
+ FormulaByteToken( OpCode e, sal_uInt8 n ) :
+ FormulaToken( svByte,e ), nByte( n ),
+ eInForceArray( ParamClass::Unknown ) {}
+ FormulaByteToken( OpCode e ) :
+ FormulaToken( svByte,e ), nByte( 0 ),
+ eInForceArray( ParamClass::Unknown ) {}
+ FormulaByteToken( const FormulaByteToken& r ) :
+ FormulaToken( r ), nByte( r.nByte ),
+ eInForceArray( r.eInForceArray ) {}
+
+ virtual FormulaToken* Clone() const override { return new FormulaByteToken(*this); }
+ virtual sal_uInt8 GetByte() const override;
+ virtual void SetByte( sal_uInt8 n ) override;
+ virtual ParamClass GetInForceArray() const override;
+ virtual void SetInForceArray( ParamClass c ) override;
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+
+// A special token for the FormulaAutoPilot only. Keeps a reference pointer of
+// the token of which it was created for comparison.
+class FORMULA_DLLPUBLIC FormulaFAPToken final : public FormulaByteToken
+{
+private:
+ FormulaTokenRef pOrigToken;
+public:
+ FormulaFAPToken( OpCode e, sal_uInt8 n, FormulaToken* p ) :
+ FormulaByteToken( e, n, svFAP, ParamClass::Unknown ),
+ pOrigToken( p ) {}
+ FormulaFAPToken( const FormulaFAPToken& r ) :
+ FormulaByteToken( r ), pOrigToken( r.pOrigToken ) {}
+
+ virtual FormulaToken* Clone() const override { return new FormulaFAPToken(*this); }
+ virtual FormulaToken* GetFAPOrigToken() const override;
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+class FORMULA_DLLPUBLIC FormulaDoubleToken : public FormulaToken
+{
+private:
+ double fDouble;
+public:
+ FormulaDoubleToken( double f ) :
+ FormulaToken( svDouble ), fDouble( f ) {}
+ FormulaDoubleToken( const FormulaDoubleToken& r ) :
+ FormulaToken( r ), fDouble( r.fDouble ) {}
+
+ virtual FormulaToken* Clone() const override { return new FormulaDoubleToken(*this); }
+ virtual double GetDouble() const override;
+ virtual double& GetDoubleAsReference() override;
+ virtual sal_Int16 GetDoubleType() const override; ///< always returns 0 for "not typed"
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+class FORMULA_DLLPUBLIC FormulaTypedDoubleToken final : public FormulaDoubleToken
+{
+private:
+ sal_Int16 mnType; /**< Can hold, for example, a value
+ of SvNumFormatType, or by
+ contract any other
+ classification. */
+public:
+ FormulaTypedDoubleToken( double f, sal_Int16 nType ) :
+ FormulaDoubleToken( f ), mnType( nType ) {}
+ FormulaTypedDoubleToken( const FormulaTypedDoubleToken& r ) :
+ FormulaDoubleToken( r ), mnType( r.mnType ) {}
+
+ virtual FormulaToken* Clone() const override { return new FormulaTypedDoubleToken(*this); }
+ virtual sal_Int16 GetDoubleType() const override;
+ virtual void SetDoubleType( sal_Int16 nType ) override;
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaStringToken final : public FormulaToken
+{
+ svl::SharedString maString;
+public:
+ FormulaStringToken( const svl::SharedString& r );
+ FormulaStringToken( const FormulaStringToken& r );
+
+ virtual FormulaToken* Clone() const override;
+ virtual const svl::SharedString & GetString() const override;
+ virtual void SetString( const svl::SharedString& rStr ) override;
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+
+/** Identical to FormulaStringToken, but with explicit OpCode instead of implicit
+ ocPush, and an optional sal_uInt8 for ocBad tokens. */
+class FORMULA_DLLPUBLIC FormulaStringOpToken final : public FormulaByteToken
+{
+ svl::SharedString maString;
+public:
+ FormulaStringOpToken( OpCode e, const svl::SharedString& r );
+ FormulaStringOpToken( const FormulaStringOpToken& r );
+
+ virtual FormulaToken* Clone() const override;
+ virtual const svl::SharedString & GetString() const override;
+ virtual void SetString( const svl::SharedString& rStr ) override;
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+class FORMULA_DLLPUBLIC FormulaIndexToken final : public FormulaToken
+{
+private:
+ sal_uInt16 nIndex;
+ sal_Int16 mnSheet;
+public:
+ FormulaIndexToken( OpCode e, sal_uInt16 n, sal_Int16 nSheet = -1 ) :
+ FormulaToken( svIndex, e ), nIndex( n ), mnSheet( nSheet ) {}
+ FormulaIndexToken( const FormulaIndexToken& r ) :
+ FormulaToken( r ), nIndex( r.nIndex ), mnSheet( r.mnSheet ) {}
+
+ virtual FormulaToken* Clone() const override { return new FormulaIndexToken(*this); }
+ virtual sal_uInt16 GetIndex() const override;
+ virtual void SetIndex( sal_uInt16 n ) override;
+ virtual sal_Int16 GetSheet() const override;
+ virtual void SetSheet( sal_Int16 n ) override;
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaExternalToken final : public FormulaByteToken
+{
+private:
+ OUString aExternal;
+public:
+ FormulaExternalToken( OpCode e, sal_uInt8 n, const OUString& r ) :
+ FormulaByteToken( e, n, svExternal, ParamClass::Unknown ),
+ aExternal( r ) {}
+ FormulaExternalToken( OpCode e, const OUString& r ) :
+ FormulaByteToken( e, 0, svExternal, ParamClass::Unknown ),
+ aExternal( r ) {}
+ FormulaExternalToken( const FormulaExternalToken& r ) :
+ FormulaByteToken( r ), aExternal( r.aExternal ) {}
+
+ virtual FormulaToken* Clone() const override { return new FormulaExternalToken(*this); }
+ virtual const OUString& GetExternal() const override;
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaMissingToken final : public FormulaToken
+{
+public:
+ FormulaMissingToken() :
+ FormulaToken( svMissing,ocMissing ) {}
+ FormulaMissingToken( const FormulaMissingToken& r ) :
+ FormulaToken( r ) {}
+
+ virtual FormulaToken* Clone() const override { return new FormulaMissingToken(*this); }
+ virtual double GetDouble() const override;
+ virtual const svl::SharedString & GetString() const override;
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+class FORMULA_DLLPUBLIC FormulaJumpToken final : public FormulaToken
+{
+private:
+ std::unique_ptr<short[]>
+ pJump;
+ ParamClass eInForceArray;
+public:
+ FormulaJumpToken( OpCode e, short const * p ) :
+ FormulaToken( formula::svJump , e),
+ eInForceArray( ParamClass::Unknown)
+ {
+ pJump.reset( new short[ p[0] + 1 ] );
+ memcpy( pJump.get(), p, (p[0] + 1) * sizeof(short) );
+ }
+ FormulaJumpToken( const FormulaJumpToken& r ) :
+ FormulaToken( r ),
+ eInForceArray( r.eInForceArray)
+ {
+ pJump.reset( new short[ r.pJump[0] + 1 ] );
+ memcpy( pJump.get(), r.pJump.get(), (r.pJump[0] + 1) * sizeof(short) );
+ }
+ virtual ~FormulaJumpToken() override;
+ virtual short* GetJump() const override;
+ virtual bool operator==( const formula::FormulaToken& rToken ) const override;
+ virtual FormulaToken* Clone() const override { return new FormulaJumpToken(*this); }
+ virtual ParamClass GetInForceArray() const override;
+ virtual void SetInForceArray( ParamClass c ) override;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaUnknownToken final : public FormulaToken
+{
+public:
+ FormulaUnknownToken( OpCode e ) :
+ FormulaToken( svUnknown, e ) {}
+ FormulaUnknownToken( const FormulaUnknownToken& r ) :
+ FormulaToken( r ) {}
+
+ virtual FormulaToken* Clone() const override { return new FormulaUnknownToken(*this); }
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaErrorToken final : public FormulaToken
+{
+ FormulaError nError;
+public:
+ FormulaErrorToken( FormulaError nErr ) :
+ FormulaToken( svError ), nError( nErr) {}
+ FormulaErrorToken( const FormulaErrorToken& r ) :
+ FormulaToken( r ), nError( r.nError) {}
+
+ virtual FormulaToken* Clone() const override { return new FormulaErrorToken(*this); }
+ virtual FormulaError GetError() const override;
+ virtual void SetError( FormulaError nErr ) override;
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
+
+} // formula
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx
new file mode 100644
index 000000000..cbff6a3e4
--- /dev/null
+++ b/include/formula/tokenarray.hxx
@@ -0,0 +1,669 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_TOKENARRAY_HXX
+#define INCLUDED_FORMULA_TOKENARRAY_HXX
+
+#include <climits>
+#include <memory>
+#include <ostream>
+#include <type_traits>
+#include <unordered_set>
+#include <unordered_map>
+#include <vector>
+
+#include <formula/ExternalReferenceHelper.hxx>
+#include <formula/formuladllapi.h>
+#include <formula/opcode.hxx>
+#include <formula/token.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace sheet { struct FormulaToken; }
+}
+
+namespace com::sun::star::uno { template <typename > class Sequence; }
+namespace formula { class FormulaTokenArray; }
+
+namespace svl {
+
+class SharedString;
+class SharedStringPool;
+
+}
+
+// RecalcMode access only via TokenArray SetExclusiveRecalcMode...() /
+// IsRecalcMode...()
+
+// Only one of the exclusive bits can be set and one must be set,
+// handled by TokenArray SetExclusiveRecalcMode...() methods.
+// Exclusive bits are ordered by priority, AddRecalcMode() relies on that.
+enum class ScRecalcMode : sal_uInt8
+{
+ ALWAYS = 0x01, // exclusive, always
+ ONLOAD_MUST = 0x02, // exclusive, always after load
+ ONLOAD_ONCE = 0x04, // exclusive, once after load, import filter
+ ONLOAD_LENIENT = 0x08, // exclusive, lenient after load (eg. macros not always, aliens, ...)
+ NORMAL = 0x10, // exclusive
+ FORCED = 0x20, // combined, also if cell isn't visible, for macros with side effects
+ ONREFMOVE = 0x40, // combined, if reference was moved
+ EMask = ALWAYS | ONLOAD_MUST | ONLOAD_LENIENT | ONLOAD_ONCE | NORMAL // mask of exclusive bits
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ScRecalcMode> : is_typed_flags<ScRecalcMode, 0x7f> {};
+}
+
+namespace formula
+{
+
+class FORMULA_DLLPUBLIC MissingConvention
+{
+public:
+ enum Convention
+ {
+ FORMULA_MISSING_CONVENTION_PODF,
+ FORMULA_MISSING_CONVENTION_ODFF,
+ FORMULA_MISSING_CONVENTION_OOXML
+ };
+ explicit MissingConvention( Convention eConvention ) : meConvention(eConvention) {}
+ bool isPODF() const { return meConvention == FORMULA_MISSING_CONVENTION_PODF; }
+ bool isODFF() const { return meConvention == FORMULA_MISSING_CONVENTION_ODFF; }
+ bool isOOXML() const { return meConvention == FORMULA_MISSING_CONVENTION_OOXML; }
+ Convention getConvention() const { return meConvention; }
+private:
+ Convention meConvention;
+};
+
+class FORMULA_DLLPUBLIC MissingConventionODF : public MissingConvention
+{
+public:
+ explicit MissingConventionODF( bool bODFF ) :
+ MissingConvention( bODFF ?
+ MissingConvention::FORMULA_MISSING_CONVENTION_ODFF :
+ MissingConvention::FORMULA_MISSING_CONVENTION_PODF)
+ {
+ }
+ // Implementation and usage only in token.cxx
+ inline bool isRewriteNeeded( OpCode eOp ) const;
+};
+
+class FORMULA_DLLPUBLIC MissingConventionOOXML : public MissingConvention
+{
+public:
+ explicit MissingConventionOOXML() : MissingConvention( MissingConvention::FORMULA_MISSING_CONVENTION_OOXML) {}
+ // Implementation and usage only in token.cxx
+ static inline bool isRewriteNeeded( OpCode eOp );
+};
+
+typedef std::unordered_set<OpCode, std::hash<std::underlying_type<OpCode>::type> > unordered_opcode_set;
+
+class FORMULA_DLLPUBLIC FormulaTokenArrayStandardRange
+{
+private:
+ FormulaToken** mpBegin;
+ FormulaToken** mpEnd;
+
+public:
+ FormulaTokenArrayStandardRange(FormulaToken** pBegin, sal_uInt16 nSize) :
+ mpBegin(pBegin),
+ mpEnd(pBegin + nSize)
+ {
+ }
+
+ FormulaToken** begin() const
+ {
+ return mpBegin;
+ }
+
+ FormulaToken** end() const
+ {
+ return mpEnd;
+ }
+};
+
+class FORMULA_DLLPUBLIC FormulaTokenArrayReferencesIterator
+{
+private:
+ FormulaToken** maIter;
+ FormulaToken** maEnd;
+
+ void nextReference()
+ {
+ while (maIter != maEnd)
+ {
+ switch ((*maIter)->GetType())
+ {
+ case svSingleRef:
+ case svDoubleRef:
+ case svExternalSingleRef:
+ case svExternalDoubleRef:
+ return;
+ default:
+ ++maIter;
+ }
+ }
+ }
+
+ enum class Dummy { Flag };
+
+ FormulaTokenArrayReferencesIterator(const FormulaTokenArrayStandardRange& rRange, Dummy) :
+ maIter(rRange.end()),
+ maEnd(rRange.end())
+ {
+ }
+
+public:
+ FormulaTokenArrayReferencesIterator(const FormulaTokenArrayStandardRange& rRange) :
+ maIter(rRange.begin()),
+ maEnd(rRange.end())
+ {
+ nextReference();
+ }
+
+ FormulaTokenArrayReferencesIterator operator++(int)
+ {
+ FormulaTokenArrayReferencesIterator result(*this);
+ operator++();
+ return result;
+ }
+
+ FormulaTokenArrayReferencesIterator const & operator++()
+ {
+ assert(maIter != maEnd);
+ ++maIter;
+ nextReference();
+ return *this;
+ }
+
+ FormulaToken* operator*() const
+ {
+ return *maIter;
+ }
+
+ bool operator==(const FormulaTokenArrayReferencesIterator& rhs) const
+ {
+ return maIter == rhs.maIter;
+ }
+
+ bool operator!=(const FormulaTokenArrayReferencesIterator& rhs) const
+ {
+ return !operator==(rhs);
+ }
+
+ static FormulaTokenArrayReferencesIterator endOf(const FormulaTokenArrayStandardRange& rRange)
+ {
+ return FormulaTokenArrayReferencesIterator(rRange, Dummy::Flag);
+ }
+};
+
+class FORMULA_DLLPUBLIC FormulaTokenArrayReferencesRange
+{
+private:
+ const FormulaTokenArray& mrFTA;
+
+public:
+ FormulaTokenArrayReferencesRange(const FormulaTokenArray& rFTA) :
+ mrFTA(rFTA)
+ {
+ }
+
+ FormulaTokenArrayReferencesIterator begin();
+
+ FormulaTokenArrayReferencesIterator end();
+};
+
+class FORMULA_DLLPUBLIC FormulaTokenArray
+{
+protected:
+ std::unique_ptr<FormulaToken*[]> pCode; // Token code array
+ FormulaToken** pRPN; // RPN array
+ sal_uInt16 nLen; // Length of token array
+ sal_uInt16 nRPN; // Length of RPN array
+ FormulaError nError; // Error code
+ ScRecalcMode nMode; // Flags to indicate when to recalc this code
+ bool bHyperLink :1; // If HYPERLINK() occurs in the formula.
+ bool mbFromRangeName :1; // If this array originates from a named expression
+ bool mbShareable :1; // Whether or not it can be shared with adjacent cells.
+ bool mbFinalized :1; // Whether code arrays have their final used size and no more tokens can be added.
+
+protected:
+ void Assign( const FormulaTokenArray& );
+ void Assign( sal_uInt16 nCode, FormulaToken **pTokens );
+ void Move( FormulaTokenArray&& );
+
+ /// Also used by the compiler. The token MUST had been allocated with new!
+ FormulaToken* Add( FormulaToken* );
+
+public:
+ enum ReplaceMode
+ {
+ CODE_ONLY, ///< replacement only in pCode
+ CODE_AND_RPN ///< replacement in pCode and pRPN
+ };
+
+ /** Also used by the compiler. The token MUST had been allocated with new!
+ @param nOffset
+ Absolute offset in pCode of the token to be replaced.
+ @param eMode
+ If CODE_ONLY only the token in pCode at nOffset is replaced.
+ If CODE_AND_RPN the token in pCode at nOffset is replaced;
+ if the original token was also referenced in the pRPN array
+ then that reference is replaced with a reference to the new
+ token as well.
+ */
+ FormulaToken* ReplaceToken( sal_uInt16 nOffset, FormulaToken*, ReplaceMode eMode );
+
+ /** Remove a sequence of tokens from pCode array, and pRPN array if the
+ tokens are referenced there.
+
+ nLen and nRPN are adapted.
+
+ @param nOffset
+ Start offset into pCode.
+ @param nCount
+ Count of tokens to remove.
+
+ @return Count of tokens removed.
+ */
+ sal_uInt16 RemoveToken( sal_uInt16 nOffset, sal_uInt16 nCount );
+
+ FormulaTokenArray();
+ /** Assignment with incrementing references of FormulaToken entries
+ (not copied!) */
+ FormulaTokenArray( const FormulaTokenArray& );
+ FormulaTokenArray( FormulaTokenArray&& );
+ virtual ~FormulaTokenArray();
+
+ virtual void Clear();
+
+ /**
+ * The array has its final used size and no more token can be added.
+ */
+ void Finalize();
+
+ void SetFromRangeName( bool b ) { mbFromRangeName = b; }
+ bool IsFromRangeName() const { return mbFromRangeName; }
+
+ void SetShareable( bool b ) { mbShareable = b; }
+
+ /**
+ * Check if this token array is shareable between multiple adjacent
+ * formula cells. Certain tokens may not function correctly when shared.
+ *
+ * @return true if the token array is shareable, false otherwise.
+ */
+ bool IsShareable() const { return mbShareable; }
+
+ void DelRPN();
+ FormulaToken* FirstToken() const;
+
+ /// Return pCode[nIdx], or nullptr if nIdx is out of bounds
+ FormulaToken* TokenAt( sal_uInt16 nIdx) const
+ {
+ if (nIdx >= nLen)
+ return nullptr;
+ return pCode[nIdx];
+ }
+
+ /// Peek at nIdx-1 if not out of bounds, decrements nIdx if successful. Returns NULL if not.
+ FormulaToken* PeekPrev( sal_uInt16 & nIdx ) const;
+
+ /// Return the opcode at pCode[nIdx-1], ocNone if nIdx-1 is out of bounds
+ OpCode OpCodeBefore( sal_uInt16 nIdx) const
+ {
+ if (nIdx == 0 || nIdx > nLen)
+ return ocNone;
+
+ return pCode[nIdx-1]->GetOpCode();
+ }
+
+ FormulaToken* FirstRPNToken() const;
+ FormulaToken* LastRPNToken() const;
+
+ bool HasReferences() const;
+
+ bool HasExternalRef() const;
+ bool HasOpCode( OpCode ) const;
+ bool HasOpCodeRPN( OpCode ) const;
+ /// Token of type svIndex or opcode ocColRowName
+ bool HasNameOrColRowName() const;
+
+ /**
+ * Check if the token array contains any of specified opcode tokens.
+ *
+ * @param rOpCodes collection of opcodes to check against.
+ *
+ * @return true if the token array contains at least one of the specified
+ * opcode tokens, false otherwise.
+ */
+ bool HasOpCodes( const unordered_opcode_set& rOpCodes ) const;
+
+ /// Assign pRPN to point to a newly created array filled with the data from pData
+ void CreateNewRPNArrayFromData( FormulaToken** pData, sal_uInt16 nSize )
+ {
+ pRPN = new FormulaToken*[ nSize ];
+ nRPN = nSize;
+ memcpy( pRPN, pData, nSize * sizeof( FormulaToken* ) );
+ }
+
+ FormulaToken** GetArray() const { return pCode.get(); }
+
+ FormulaTokenArrayStandardRange Tokens() const
+ {
+ return FormulaTokenArrayStandardRange(pCode.get(), nLen);
+ }
+
+ FormulaToken** GetCode() const { return pRPN; }
+
+ FormulaTokenArrayStandardRange RPNTokens() const
+ {
+ return FormulaTokenArrayStandardRange(pRPN, nRPN);
+ }
+
+ FormulaTokenArrayReferencesRange References() const
+ {
+ return FormulaTokenArrayReferencesRange(*this);
+ }
+
+ sal_uInt16 GetLen() const { return nLen; }
+ sal_uInt16 GetCodeLen() const { return nRPN; }
+ FormulaError GetCodeError() const { return nError; }
+ void SetCodeError( FormulaError n ) { nError = n; }
+ void SetHyperLink( bool bVal ) { bHyperLink = bVal; }
+ bool IsHyperLink() const { return bHyperLink; }
+
+ ScRecalcMode GetRecalcMode() const { return nMode; }
+
+ void SetCombinedBitsRecalcMode( ScRecalcMode nBits )
+ { nMode |= nBits & ~ScRecalcMode::EMask; }
+ ScRecalcMode GetCombinedBitsRecalcMode() const
+ { return nMode & ~ScRecalcMode::EMask; }
+
+ /** Exclusive bits already set in nMode are zero'ed, nBits
+ may contain combined bits, but only one exclusive bit
+ may be set! */
+ void SetMaskedRecalcMode( ScRecalcMode nBits )
+ { nMode = GetCombinedBitsRecalcMode() | nBits; }
+
+ /** Bits aren't set directly but validated and handled
+ according to priority if more than one exclusive bit
+ was set. */
+ void AddRecalcMode( ScRecalcMode nBits );
+
+ void ClearRecalcMode() { nMode = ScRecalcMode::NORMAL; }
+ void SetExclusiveRecalcModeNormal()
+ { SetMaskedRecalcMode( ScRecalcMode::NORMAL ); }
+ void SetExclusiveRecalcModeAlways()
+ { SetMaskedRecalcMode( ScRecalcMode::ALWAYS ); }
+ void SetRecalcModeForced()
+ { nMode |= ScRecalcMode::FORCED; }
+ void SetRecalcModeOnRefMove()
+ { nMode |= ScRecalcMode::ONREFMOVE; }
+ bool IsRecalcModeNormal() const
+ { return bool(nMode & ScRecalcMode::NORMAL); }
+ bool IsRecalcModeAlways() const
+ { return bool(nMode & ScRecalcMode::ALWAYS); }
+ bool IsRecalcModeForced() const
+ { return bool(nMode & ScRecalcMode::FORCED); }
+ bool IsRecalcModeOnRefMove() const
+ { return bool(nMode & ScRecalcMode::ONREFMOVE); }
+ /** Whether recalculation must happen after import, for
+ example OOXML. */
+ bool IsRecalcModeMustAfterImport() const
+ { return (nMode & ScRecalcMode::EMask) <= ScRecalcMode::ONLOAD_ONCE; }
+
+ /** Get OpCode of the most outer function */
+ inline OpCode GetOuterFuncOpCode() const;
+
+ /** Operators +,-,*,/,^,&,=,<>,<,>,<=,>=
+ with DoubleRef in Formula? */
+ bool HasMatrixDoubleRefOps() const;
+
+ virtual FormulaToken* AddOpCode(OpCode e);
+
+ /** Adds the single token to array.
+ Derived classes must override it when they want to support derived classes from FormulaToken.
+ @return true when an error occurs
+ */
+ virtual bool AddFormulaToken(
+ const css::sheet::FormulaToken& rToken, svl::SharedStringPool& rSPool,
+ ExternalReferenceHelper* pExtRef );
+
+ /** fill the array with the tokens from the sequence.
+ It calls AddFormulaToken for each token in the list.
+ @param _aSequence the token to add
+ @return true when an error occurs
+ */
+ bool Fill(
+ const css::uno::Sequence<css::sheet::FormulaToken>& rSequence,
+ svl::SharedStringPool& rSPool, ExternalReferenceHelper* pExtRef );
+
+ /**
+ * Do some checking based on the individual tokens. For now, we use this
+ * only to check whether we can vectorize the token array.
+ */
+ virtual void CheckToken( const FormulaToken& t );
+
+ /**
+ * Call CheckToken() for all RPN tokens.
+ */
+ void CheckAllRPNTokens();
+
+ /** Clones the token and then adds the clone to the pCode array.
+ For just new'ed tokens use Add() instead of cloning it again.
+ Use this AddToken() when adding a token from another origin.
+ */
+ FormulaToken* AddToken( const FormulaToken& );
+
+ FormulaToken* AddString( const svl::SharedString& rStr );
+ FormulaToken* AddDouble( double fVal );
+ void AddExternal( const sal_Unicode* pStr );
+ /** Xcl import may play dirty tricks with OpCode!=ocExternal.
+ Others don't use! */
+ FormulaToken* AddExternal( const OUString& rStr, OpCode eOp = ocExternal );
+ FormulaToken* AddBad( const OUString& rStr ); /// ocBad with OUString
+ FormulaToken* AddStringXML( const OUString& rStr ); /// ocStringXML with OUString, temporary during import
+
+ virtual FormulaToken* MergeArray( );
+
+ /** Assignment with incrementing references of FormulaToken entries
+ (not copied!) */
+ FormulaTokenArray& operator=( const FormulaTokenArray& );
+ FormulaTokenArray& operator=( FormulaTokenArray&& );
+
+ /** Determines if this formula needs any changes to convert it to something
+ previous versions of OOo could consume (Plain Old Formula, pre-ODFF, or
+ also ODFF) */
+ bool NeedsPodfRewrite( const MissingConventionODF & rConv );
+
+ /** Determines if this formula needs any changes to convert it to OOXML. */
+ bool NeedsOoxmlRewrite();
+
+ /** Rewrites to Plain Old Formula or OOXML, substituting missing parameters. The
+ FormulaTokenArray* returned is new'ed. */
+ FormulaTokenArray* RewriteMissing( const MissingConvention & rConv );
+
+ /** Determines if this formula may be followed by a reference. */
+ bool MayReferenceFollow();
+
+ /** Re-intern SharedString in case the SharedStringPool differs. */
+ void ReinternStrings( svl::SharedStringPool& rPool );
+};
+
+inline OpCode FormulaTokenArray::GetOuterFuncOpCode() const
+{
+ if ( pRPN && nRPN )
+ return pRPN[nRPN-1]->GetOpCode();
+ return ocNone;
+}
+
+inline FormulaTokenArrayReferencesIterator FormulaTokenArrayReferencesRange::begin()
+{
+ return FormulaTokenArrayReferencesIterator(mrFTA.Tokens());
+}
+
+inline FormulaTokenArrayReferencesIterator FormulaTokenArrayReferencesRange::end()
+{
+ return FormulaTokenArrayReferencesIterator::endOf(mrFTA.Tokens());
+}
+
+class FORMULA_DLLPUBLIC FormulaTokenIterator
+{
+ struct Item
+ {
+ public:
+ const FormulaTokenArray* pArr;
+ short nPC;
+ short nStop;
+
+ Item(const FormulaTokenArray* arr, short pc, short stop);
+ };
+
+ std::vector<Item> maStack;
+
+public:
+ FormulaTokenIterator( const FormulaTokenArray& );
+ ~FormulaTokenIterator();
+ void Reset();
+ const FormulaToken* Next();
+ const FormulaToken* PeekNextOperator();
+ bool IsEndOfPath() const; /// if a jump or subroutine path is done
+ bool HasStacked() const { return maStack.size() > 1; }
+ short GetPC() const { return maStack.back().nPC; }
+
+ /** Jump or subroutine call.
+ Program counter values will be incremented before code is executed =>
+ positions are to be passed with -1 offset.
+ @param nStart
+ Start on code at position nStart+1 (yes, pass with offset -1)
+ @param nNext
+ After subroutine continue with instruction at position nNext+1
+ @param nStop
+ Stop before reaching code at position nStop. If not specified the
+ default is to either run the entire code, or to stop if an ocSep or
+ ocClose is encountered, which are only present in ocIf or ocChoose
+ jumps.
+ */
+ void Jump( short nStart, short nNext, short nStop = SHRT_MAX );
+ void Push( const FormulaTokenArray* );
+ void Pop();
+
+ /** Reconstruct the iterator afresh from a token array
+ */
+ void ReInit( const FormulaTokenArray& );
+
+private:
+ const FormulaToken* GetNonEndOfPathToken( short nIdx ) const;
+};
+
+// For use in SAL_INFO, SAL_WARN etc
+
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, traits> & stream, const FormulaTokenArray& point)
+{
+ stream <<
+ static_cast<const void*>(&point) <<
+ ":{nLen=" << point.GetLen() <<
+ ",nRPN=" << point.GetCodeLen() <<
+ ",pCode=" << static_cast<void*>(point.GetArray()) <<
+ ",pRPN=" << static_cast<void*>(point.GetCode()) <<
+ "}";
+
+ return stream;
+}
+
+class FORMULA_DLLPUBLIC FormulaTokenArrayPlainIterator
+{
+private:
+ const FormulaTokenArray* mpFTA;
+ sal_uInt16 mnIndex; // Current step index
+
+public:
+ FormulaTokenArrayPlainIterator( const FormulaTokenArray& rFTA ) :
+ mpFTA( &rFTA ),
+ mnIndex( 0 )
+ {
+ }
+
+ void Reset()
+ {
+ mnIndex = 0;
+ }
+
+ sal_uInt16 GetIndex() const
+ {
+ return mnIndex;
+ }
+
+ FormulaToken* First()
+ {
+ mnIndex = 0;
+ return Next();
+ }
+
+ void Jump(sal_uInt16 nIndex)
+ {
+ mnIndex = nIndex;
+ }
+
+ void StepBack()
+ {
+ assert(mnIndex > 0);
+ mnIndex--;
+ }
+
+ FormulaToken* Next();
+ FormulaToken* NextNoSpaces();
+ FormulaToken* GetNextName();
+ FormulaToken* GetNextReference();
+ FormulaToken* GetNextReferenceRPN();
+ FormulaToken* GetNextReferenceOrName();
+ FormulaToken* GetNextColRowName();
+ FormulaToken* PeekNext();
+ FormulaToken* PeekPrevNoSpaces() const; /// Only after Reset/First/Next/Last/Prev!
+ FormulaToken* PeekNextNoSpaces() const; /// Only after Reset/First/Next/Last/Prev!
+
+ FormulaToken* FirstRPN()
+ {
+ mnIndex = 0;
+ return NextRPN();
+ }
+
+ FormulaToken* NextRPN();
+
+ FormulaToken* LastRPN()
+ {
+ mnIndex = mpFTA->GetCodeLen();
+ return PrevRPN();
+ }
+
+ FormulaToken* PrevRPN();
+
+ void AfterRemoveToken( sal_uInt16 nOffset, sal_uInt16 nCount );
+};
+
+
+} // formula
+
+#endif // INCLUDED_FORMULA_TOKENARRAY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/types.hxx b/include/formula/types.hxx
new file mode 100644
index 000000000..c0c8b64c2
--- /dev/null
+++ b/include/formula/types.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_TYPES_HXX
+#define INCLUDED_FORMULA_TYPES_HXX
+
+#include <boost/intrusive_ptr.hpp>
+
+namespace formula
+{
+class FormulaToken;
+typedef ::boost::intrusive_ptr<FormulaToken> FormulaTokenRef;
+typedef ::boost::intrusive_ptr<const FormulaToken> FormulaConstTokenRef;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/vectortoken.hxx b/include/formula/vectortoken.hxx
new file mode 100644
index 000000000..046d71faf
--- /dev/null
+++ b/include/formula/vectortoken.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_FORMULA_VECTORTOKEN_HXX
+#define INCLUDED_FORMULA_VECTORTOKEN_HXX
+
+#include <cstddef>
+#include <vector>
+
+#include <formula/formuladllapi.h>
+#include <formula/token.hxx>
+#include <rtl/ustring.h>
+
+namespace formula {
+
+/**
+ * Single unit of vector reference consists of two physical arrays.
+ *
+ * <p>If the whole data array consists of only numeric values, mpStringArray
+ * will be NULL, and NaN values in the numeric array represent empty
+ * cells.</p>
+ *
+ * <p>If the whole data array consists of only string values, mpNumericArray
+ * will be NULL, and NULL values in the string array represent empty
+ * cells.</p>
+ *
+ * <p>If the data array consists of numeric and string values, then both
+ * mpNumericArray and mpStringArray will be non-NULL, and a string cell will
+ * be represented by a non-NULL pointer value in the string array. If the
+ * string value is NULL, check the corresponding value in the numeric array.
+ * If the value in the numeric array is NaN, it's an empty cell, otherwise
+ * it's a numeric cell.</p>
+ */
+struct FORMULA_DLLPUBLIC VectorRefArray
+{
+ enum InitInvalid { Invalid };
+
+ const double* mpNumericArray;
+ rtl_uString** mpStringArray;
+
+ bool mbValid;
+
+ VectorRefArray();
+ VectorRefArray( InitInvalid );
+ VectorRefArray( const double* pArray );
+ VectorRefArray( rtl_uString** pArray );
+ VectorRefArray( const double* pNumArray, rtl_uString** pStrArray );
+
+ bool isValid() const;
+};
+
+/**
+ * This token represents a single cell reference in a vectorized formula
+ * calculation context.
+ */
+class FORMULA_DLLPUBLIC SingleVectorRefToken final : public FormulaToken
+{
+ VectorRefArray maArray;
+ size_t mnArrayLength;
+
+public:
+ SingleVectorRefToken( const VectorRefArray& rArray, size_t nArrayLength );
+
+ virtual FormulaToken* Clone() const override;
+
+ const VectorRefArray& GetArray() const;
+ size_t GetArrayLength() const;
+};
+
+/**
+ * This token represents a range reference in a vectorized formula
+ * calculation context.
+ */
+class FORMULA_DLLPUBLIC DoubleVectorRefToken final : public FormulaToken
+{
+ std::vector<VectorRefArray> maArrays;
+
+ size_t mnArrayLength; /// length of all arrays which does not include trailing empty region.
+ size_t mnRefRowSize; /// original reference row size. The row size may
+ /// change as it goes down the array if either the
+ /// start or end position is fixed.
+
+ bool mbStartFixed:1; /// whether or not the start row position is absolute.
+ bool mbEndFixed:1; /// whether or not the end row position is absolute.
+
+public:
+ DoubleVectorRefToken(
+ std::vector<VectorRefArray>&& rArrays, size_t nArrayLength,
+ size_t nRefRowSize, bool bStartFixed, bool bEndFixed );
+
+ virtual FormulaToken* Clone() const override;
+
+ const std::vector<VectorRefArray>& GetArrays() const;
+ size_t GetArrayLength() const;
+ size_t GetRefRowSize() const;
+ bool IsStartFixed() const;
+ bool IsEndFixed() const;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/fpicker/fpsofficeResMgr.hxx b/include/fpicker/fpsofficeResMgr.hxx
new file mode 100644
index 000000000..a86a91509
--- /dev/null
+++ b/include/fpicker/fpsofficeResMgr.hxx
@@ -0,0 +1,15 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <unotools/resmgr.hxx>
+
+inline OUString FpsResId(TranslateId aId) { return Translate::get(aId, Translate::Create("fps")); };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/fpicker/strings.hrc b/include/fpicker/strings.hrc
new file mode 100644
index 000000000..efce3a69f
--- /dev/null
+++ b/include/fpicker/strings.hrc
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_FPICKER_FPICKER_HRC
+#define INCLUDED_FPICKER_FPICKER_HRC
+
+#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
+
+#define STR_SVT_FILEPICKER_AUTO_EXTENSION NC_("STR_SVT_FILEPICKER_AUTO_EXTENSION", "~Automatic file name extension")
+#define STR_SVT_FILEPICKER_PASSWORD NC_("STR_SVT_FILEPICKER_PASSWORD", "Save with pass~word")
+//dear loplugins, please don't remove this constant, it will be used in follow-up commits
+#define STR_SVT_FILEPICKER_GPGENCRYPT NC_("STR_SVT_FILEPICKER_GPGENCRYPT", "Encrypt with ~GPG key")
+#define STR_SVT_FILEPICKER_FILTER_OPTIONS NC_("STR_SVT_FILEPICKER_FILTER_OPTIONS", "~Edit filter settings")
+#define STR_SVT_FILEPICKER_READONLY NC_("STR_SVT_FILEPICKER_READONLY", "~Read-only")
+#define STR_SVT_FILEPICKER_INSERT_AS_LINK NC_("STR_SVT_FILEPICKER_INSERT_AS_LINK", "~Link")
+#define STR_SVT_FILEPICKER_SHOW_PREVIEW NC_("STR_SVT_FILEPICKER_SHOW_PREVIEW", "Pr~eview")
+#define STR_SVT_FILEPICKER_PLAY NC_("STR_SVT_FILEPICKER_PLAY", "~Play")
+#define STR_SVT_FILEPICKER_VERSION NC_("STR_SVT_FILEPICKER_VERSION", "~Version:")
+#define STR_SVT_FILEPICKER_TEMPLATES NC_("STR_SVT_FILEPICKER_TEMPLATES", "S~tyles:")
+#define STR_SVT_FILEPICKER_IMAGE_TEMPLATE NC_("STR_SVT_FILEPICKER_IMAGE_TEMPLATE", "Style:")
+#define STR_SVT_FILEPICKER_IMAGE_ANCHOR NC_("STR_SVT_FILEPICKER_IMAGE_ANCHOR", "A~nchor:")
+#define STR_SVT_FILEPICKER_SELECTION NC_("STR_SVT_FILEPICKER_SELECTION", "~Selection")
+#define STR_SVT_FILEPICKER_FILTER_TITLE NC_("STR_SVT_FILEPICKER_FILTER_TITLE", "File ~type:")
+#define STR_SVT_FOLDERPICKER_DEFAULT_TITLE NC_("STR_SVT_FOLDERPICKER_DEFAULT_TITLE", "Select Path")
+#define STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION NC_("STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION", "Please select a folder.")
+#define STR_SVT_ALREADYEXISTOVERWRITE NC_("STR_SVT_ALREADYEXISTOVERWRITE", "A file named \"$filename$\" already exists.\n\nDo you want to replace it?")
+#define STR_SVT_ALREADYEXISTOVERWRITE_SECONDARY NC_("STR_SVT_ALREADYEXISTOVERWRITE_SECONDARY", "The file already exists in \"$dirname$\". Replacing it will overwrite its contents.")
+#define STR_SVT_ALLFORMATS NC_("STR_SVT_ALLFORMATS", "All Formats")
+#define STR_SVT_DELETESERVICE NC_("STR_SVT_DELETESERVICE", "Are you sure you want to delete the service?\n\"$servicename$\"")
+#define STR_SVT_ROOTLABEL NC_("STR_SVT_ROOTLABEL", "Root")
+#define STR_FILTERNAME_ALL NC_("STR_FILTERNAME_ALL", "All files")
+#define STR_FILEDLG_OPEN NC_("STR_FILEDLG_OPEN", "Open")
+#define STR_FILEDLG_TYPE NC_("STR_FILEDLG_TYPE", "File ~type")
+#define STR_FILEDLG_SAVE NC_("STR_FILEDLG_SAVE", "Save")
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/ContextChangeEventMultiplexerTunnel.hxx b/include/framework/ContextChangeEventMultiplexerTunnel.hxx
new file mode 100644
index 000000000..d2ff18bbe
--- /dev/null
+++ b/include/framework/ContextChangeEventMultiplexerTunnel.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <framework/fwkdllapi.h>
+#include <functional>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::ui { class XContextChangeEventListener; }
+namespace com::sun::star::uno { class XInterface; }
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace framework {
+
+// this is pretty horrible, don't use it!
+FWK_DLLPUBLIC css::uno::Reference<css::ui::XContextChangeEventListener>
+GetFirstListenerWith(
+ css::uno::Reference<css::uno::XComponentContext> const & xComponentContext,
+ css::uno::Reference<css::uno::XInterface> const& xEventFocus,
+ std::function<bool (css::uno::Reference<css::ui::XContextChangeEventListener> const&)> const& rPredicate);
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/actiontriggerhelper.hxx b/include/framework/actiontriggerhelper.hxx
new file mode 100644
index 000000000..d0efa7a3a
--- /dev/null
+++ b/include/framework/actiontriggerhelper.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <framework/fwkdllapi.h>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::awt { class XPopupMenu; }
+namespace com::sun::star::container { class XIndexContainer; }
+
+namespace framework
+{
+ class FWK_DLLPUBLIC ActionTriggerHelper
+ {
+ public:
+ // Fills the submitted menu with the structure contained in the second
+ // parameter rActionTriggerContainer
+ // @param pNewMenu = must be a valid and empty menu
+ // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContainer"
+ static void
+ CreateMenuFromActionTriggerContainer(
+ const css::uno::Reference<css::awt::XPopupMenu>& rNewMenu,
+ const css::uno::Reference<css::container::XIndexContainer>& rActionTriggerContainer);
+
+ // Creates a "css::ui::ActionTriggerContainer" with the structure of the menu
+ // provided as a parameter. The implementation class stores the menu pointer
+ // to optimize the time of creation of a menu from an actiontrigger structure.
+ // IMPORTANT: The caller must ensure that the menu pointer is valid through the
+ // life time of the XIndexContainer object!!!
+ // @param rMenu = Must be a valid menu. Please be aware that this implementation is based on
+ // the above mentioned restriction!!!
+
+ static css::uno::Reference< css::container::XIndexContainer > CreateActionTriggerContainerFromMenu(
+ const css::uno::Reference<css::awt::XPopupMenu>& rMenu, const OUString* pMenuIdentifier );
+
+ // Fills the submitted rActionTriggerContainer with the structure of the menu
+ // provided as the second parameter
+ // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContainer"
+ // @param rMenu = must be a valid menu
+ static void
+ FillActionTriggerContainerFromMenu(
+ css::uno::Reference< css::container::XIndexContainer > const & rActionTriggerContainer,
+ const css::uno::Reference<css::awt::XPopupMenu>& rMenu);
+
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/addonsoptions.hxx b/include/framework/addonsoptions.hxx
new file mode 100644
index 000000000..0e97f7a24
--- /dev/null
+++ b/include/framework/addonsoptions.hxx
@@ -0,0 +1,264 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
+#define INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
+
+#include <config_options.h>
+#include <sal/types.h>
+#include <vcl/bitmapex.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include <framework/fwkdllapi.h>
+#include <memory>
+
+namespace osl { class Mutex; }
+
+/*-************************************************************************************************************
+ @descr The method GetAddonsMenu() returns a list of property values.
+ Use follow defines to separate values by names.
+*//*-*************************************************************************************************************/
+inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_URL = u"URL";
+inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_TITLE = u"Title";
+inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_TARGET = u"Target";
+inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_IMAGEIDENTIFIER = u"ImageIdentifier";
+inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_CONTEXT = u"Context";
+inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_SUBMENU = u"Submenu";
+
+inline constexpr OUStringLiteral ADDONSPOPUPMENU_URL_PREFIX_STR = u"private:menu/Addon";
+
+namespace framework
+{
+
+struct FWK_DLLPUBLIC MergeMenuInstruction
+{
+ OUString aMergePoint;
+ OUString aMergeCommand;
+ OUString aMergeCommandParameter;
+ OUString aMergeFallback;
+ OUString aMergeContext;
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeMenu;
+};
+typedef ::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer;
+
+struct FWK_DLLPUBLIC MergeToolbarInstruction
+{
+ OUString aMergeToolbar;
+ OUString aMergePoint;
+ OUString aMergeCommand;
+ OUString aMergeCommandParameter;
+ OUString aMergeFallback;
+ OUString aMergeContext;
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeToolbarItems;
+};
+
+typedef ::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer;
+
+struct FWK_DLLPUBLIC MergeNotebookBarInstruction
+{
+ OUString aMergeNotebookBar;
+ OUString aMergePoint;
+ OUString aMergeCommand;
+ OUString aMergeCommandParameter;
+ OUString aMergeFallback;
+ OUString aMergeContext;
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeNotebookBarItems;
+};
+
+typedef ::std::vector< MergeNotebookBarInstruction > MergeNotebookBarInstructionContainer;
+
+struct FWK_DLLPUBLIC MergeStatusbarInstruction
+{
+ OUString aMergePoint;
+ OUString aMergeCommand;
+ OUString aMergeCommandParameter;
+ OUString aMergeContext;
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeStatusbarItems;
+};
+
+typedef ::std::vector< MergeStatusbarInstruction > MergeStatusbarInstructionContainer;
+
+/*-************************************************************************************************************
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is necessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class AddonsOptions_Impl;
+
+/*-************************************************************************************************************
+ @short collect information about menu features
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNLESS_MERGELIBS(FWK_DLLPUBLIC) AddonsOptions
+{
+ public:
+ AddonsOptions();
+ ~AddonsOptions();
+
+ /*-****************************************************************************************************
+ @short returns if an addons menu is available
+ @descr Call to retrieve if an addons menu is available
+
+ @return true if there is a menu otherwise false
+ *//*-*****************************************************************************************************/
+
+ bool HasAddonsMenu() const;
+
+ /*-****************************************************************************************************
+ @short returns number of addons toolbars
+ @descr Call to retrieve the number of addons toolbars
+
+ @return number of addons toolbars
+ *//*-*****************************************************************************************************/
+ sal_Int32 GetAddonsToolBarCount() const ;
+
+ /*-****************************************************************************************************
+ @short returns number of addons notebookbar
+ @descr Call to retrieve the number of addons notebookbar
+
+ @return number of addons notebookar
+ *//*-*****************************************************************************************************/
+ sal_Int32 GetAddonsNotebookBarCount() const ;
+
+ /*-****************************************************************************************************
+ @short returns the complete addons menu
+ @descr Call it to get all entries of the addon menu.
+ We return a list of all nodes with its names and properties.
+ @return A list of menu items is returned.
+
+ @onerror We return an empty list.
+ *//*-*****************************************************************************************************/
+
+ const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsMenu() const;
+
+ /*-****************************************************************************************************
+ @short Gets the menu bar part of all addon components registered
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsMenuBarPart() const;
+
+ /*-****************************************************************************************************
+ @short Gets a toolbar part of a single addon
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsToolBarPart( sal_uInt32 nIndex ) const;
+
+ /*-****************************************************************************************************
+ @short Gets a unique toolbar resource name of a single addon
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
+
+ /*-****************************************************************************************************
+ @short Gets a NotebookBar part of a single addon
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsNotebookBarPart( sal_uInt32 nIndex ) const;
+
+ /*-****************************************************************************************************
+ @short Gets a unique NotebookBar resource name of a single addon
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ OUString GetAddonsNotebookBarResourceName( sal_uInt32 ) const;
+
+ /*-****************************************************************************************************
+ @short Retrieves all available merge instructions for the Office menu bar
+ @return The filled MergeMenuDefinitionContainer
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const MergeMenuInstructionContainer& GetMergeMenuInstructions() const;
+
+ /*-****************************************************************************************************
+ @short Retrieves all available merge instructions for a single toolbar
+ @return The filled
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+ bool GetMergeToolbarInstructions( const OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbar ) const;
+
+ /*-****************************************************************************************************
+ @short Retrieves all available merge instructions for Notebookbar
+ @return The filled
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+ bool GetMergeNotebookBarInstructions( const OUString& rNotebookBarName, MergeNotebookBarInstructionContainer& rNotebookBar ) const;
+
+ /*-****************************************************************************************************
+ @short Gets the Add-On help menu part of all addon components registered
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+ const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsHelpMenu() const;
+
+ const MergeStatusbarInstructionContainer& GetMergeStatusbarInstructions() const;
+
+ /*-****************************************************************************************************
+ @short Retrieve an image for a command URL which is defined inside the addon menu configuration
+ @descr Call it to retrieve an image for a command URL which is defined inside the addon menu configuration
+ @return An image which was defined in the configuration for the menu item. The image can be empty
+ no bitmap was defined for the request image properties.
+
+ @onerror An empty image
+ *//*-*****************************************************************************************************/
+
+ BitmapEx GetImageFromURL( const OUString& aURL, bool bBig, bool bNoScale ) const;
+ BitmapEx GetImageFromURL( const OUString& aURL, bool bBig ) const;
+
+ // private methods
+
+ /*-****************************************************************************************************
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods aren't safe!
+ We create a static mutex only for one ime and use at different times.
+ @return A reference to a static mutex member.
+ *//*-*****************************************************************************************************/
+
+ static ::osl::Mutex& GetOwnStaticMutex();
+
+ private:
+ std::shared_ptr<AddonsOptions_Impl> m_pImpl;
+};
+
+}
+
+#endif // INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/configimporter.hxx b/include/framework/configimporter.hxx
new file mode 100644
index 000000000..eca312719
--- /dev/null
+++ b/include/framework/configimporter.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FRAMEWORK_CONFIGIMPORTER_HXX
+#define INCLUDED_FRAMEWORK_CONFIGIMPORTER_HXX
+
+#include <config_options.h>
+#include <framework/fwkdllapi.h>
+#include <vector>
+
+namespace com::sun::star::container { class XIndexContainer; }
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::ui { class XUIConfigurationManager2; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+namespace framework
+{
+ class UNLESS_MERGELIBS(FWK_DLLPUBLIC) UIConfigurationImporterOOo1x
+ {
+ public:
+ static bool ImportCustomToolbars(
+ const css::uno::Reference< css::ui::XUIConfigurationManager2 >& rContainerFactory,
+ std::vector< css::uno::Reference< css::container::XIndexContainer > >& rSeqContainer,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::embed::XStorage >& rToolbarStorage );
+ };
+
+} // namespace framework
+
+#endif // INCLUDED_FRAMEWORK_CONFIGIMPORTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/desktop.hxx b/include/framework/desktop.hxx
new file mode 100644
index 000000000..3d525eb54
--- /dev/null
+++ b/include/framework/desktop.hxx
@@ -0,0 +1,455 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <memory>
+#include <vector>
+
+#include "framecontainer.hxx"
+#include "fwkdllapi.h"
+#include "transactionmanager.hxx"
+
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XDesktop2.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/frame/XTask.hpp>
+#include <com/sun/star/frame/XFramesSupplier.hpp>
+#include <com/sun/star/frame/XFrames.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XTasksSupplier.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/frame/XDispatchResultListener.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <comphelper/multicontainer2.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <rtl/ref.hxx>
+#include <unotools/cmdoptions.hxx>
+
+namespace framework{
+
+enum ELoadState
+{
+ E_NOTSET ,
+ E_SUCCESSFUL ,
+ E_FAILED ,
+ E_INTERACTION
+};
+
+/*-************************************************************************************************************
+ @short implement the topframe of frame tree
+ @descr This is the root of the frame tree. The desktop has no window, is not visible but he is the logical
+ "masternode" to build the hierarchy.
+
+ @implements XInterface
+ XTypeProvider
+ XServiceInfo
+ XDesktop
+ XComponentLoader
+ XTasksSupplier
+ XDispatchProvider
+ XFramesSupplier
+ XFrame
+ XComponent
+ XPropertySet
+ XFastPropertySet
+ XMultiPropertySet
+ XDispatchResultListener
+ XEventListener
+ XInteractionHandler
+
+ @devstatus ready to use
+ @threadsafe yes
+*//*-*************************************************************************************************************/
+typedef cppu::WeakComponentImplHelper<
+ css::lang::XServiceInfo ,
+ css::frame::XDesktop2 ,
+ css::frame::XTasksSupplier ,
+ css::frame::XDispatchResultListener , // => XEventListener
+ css::task::XInteractionHandler ,
+ css::frame::XUntitledNumbers > Desktop_BASE;
+
+class FWK_DLLPUBLIC Desktop final : private cppu::BaseMutex,
+ public Desktop_BASE,
+ public cppu::OPropertySetHelper
+{
+ // internal used types, const etcpp.
+ private:
+
+ /** used temporary to know which listener was already called or not. */
+ typedef ::std::vector< css::uno::Reference< css::frame::XTerminateListener > > TTerminateListenerList;
+
+ // public methods
+ public:
+
+ // constructor / destructor
+ Desktop( css::uno::Reference< css::uno::XComponentContext > xContext );
+ virtual ~Desktop( ) override;
+
+ void constructorInit();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+
+ virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
+
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XInterface
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& type) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+
+ /**
+ @interface XDesktop
+
+ @short try to shutdown these desktop environment.
+
+ @descr Will try to close all frames. If at least one frame could
+ not be closed successfully termination will be stopped.
+
+ Registered termination listener will be taken into account
+ also. As special feature some of our registered listener
+ are well known by its UNO implementation name. They are handled
+ different to all other listener.
+
+ Btw: Desktop.terminate() was designed in the past to be used
+ within an UI based environment. So it's allowed e.g. to
+ call XController.suspend() here. If UI isn't an option ... please
+ use XCloseable.close() at these desktop implementation.
+ ... if it will be supported in the future .-))
+
+ @seealso XTerminateListener
+ @seealso XTerminateListener2
+
+ @return true if all open frames could be closed and no listener threw
+ a veto exception; false otherwise.
+
+ @onerror False will be returned.
+ @threadsafe yes
+ */
+ virtual sal_Bool SAL_CALL terminate() override;
+
+ /**
+ @interface XDesktop
+
+ @short add a listener for termination events
+
+ @descr Additional to adding normal listener these method was implemented special.
+ Every listener will be asked for its uno implementation name.
+ Some of them are well known... and the corresponding listener won't be added
+ to the container of "normal listener". Those listener will be set as special
+ member.
+ see e.g. member m_xSfxTerminator
+
+ @seealso terminate()
+
+ @param xListener
+ the listener for registration.
+
+ @threadsafe yes
+ */
+ virtual void SAL_CALL addTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener ) override;
+
+ /**
+ @interface XDesktop
+
+ @short remove a listener from this container.
+
+ @descr Additional to removing normal listener these method was implemented special.
+ Every listener will be asked for its uno implementation name.
+ Some of them are well known... and the corresponding listener was set as special member.
+ Now those special member will be reset also.
+ see e.g. member m_xSfxTerminator
+
+ @seealso terminate()
+
+ @param xListener
+ the listener for deregistration.
+
+ @threadsafe yes
+ */
+ virtual void SAL_CALL removeTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener ) override;
+
+ virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getComponents ( ) override;
+ virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getCurrentComponent ( ) override;
+ virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getCurrentFrame ( ) override;
+
+ // XComponentLoader
+ virtual css::uno::Reference< css::lang::XComponent > SAL_CALL loadComponentFromURL ( const OUString& sURL ,
+ const OUString& sTargetFrameName ,
+ sal_Int32 nSearchFlags ,
+ const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) override;
+
+ // XTasksSupplier
+ virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTasks ( ) override;
+ virtual css::uno::Reference< css::frame::XTask > SAL_CALL getActiveTask ( ) override;
+
+ // XDispatchProvider
+ virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL ,
+ const OUString& sTargetFrameName ,
+ sal_Int32 nSearchFlags ) override;
+ virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor >& lQueries ) override;
+
+ // XDispatchProviderInterception
+ virtual void SAL_CALL registerDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) override;
+ virtual void SAL_CALL releaseDispatchProviderInterceptor ( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) override;
+
+ // XFramesSupplier
+ virtual css::uno::Reference< css::frame::XFrames > SAL_CALL getFrames ( ) override;
+ virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getActiveFrame ( ) override;
+ virtual void SAL_CALL setActiveFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ) override;
+
+ // XFrame
+ // Attention: findFrame() is implemented only! Other methods make no sense for our desktop!
+ virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame ( const OUString& sTargetFrameName ,
+ sal_Int32 nSearchFlags ) override;
+ virtual void SAL_CALL initialize ( const css::uno::Reference< css::awt::XWindow >& xWindow ) override;
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow ( ) override;
+ virtual void SAL_CALL setCreator ( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) override;
+ virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator ( ) override;
+ virtual OUString SAL_CALL getName ( ) override;
+ virtual void SAL_CALL setName ( const OUString& sName ) override;
+ virtual sal_Bool SAL_CALL isTop ( ) override;
+ virtual void SAL_CALL activate ( ) override;
+ virtual void SAL_CALL deactivate ( ) override;
+ virtual sal_Bool SAL_CALL isActive ( ) override;
+ virtual sal_Bool SAL_CALL setComponent ( const css::uno::Reference< css::awt::XWindow >& xComponentWindow ,
+ const css::uno::Reference< css::frame::XController >& xController ) override;
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow ( ) override;
+ virtual css::uno::Reference< css::frame::XController > SAL_CALL getController ( ) override;
+ virtual void SAL_CALL contextChanged ( ) override;
+ virtual void SAL_CALL addFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) override;
+ virtual void SAL_CALL removeFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) override;
+
+ // XComponent
+ virtual void SAL_CALL disposing() override;
+ virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
+ virtual void SAL_CALL removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
+
+ // XDispatchResultListener
+ virtual void SAL_CALL dispatchFinished ( const css::frame::DispatchResultEvent& aEvent ) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing ( const css::lang::EventObject& aSource ) override;
+
+ // XInteractionHandler
+ virtual void SAL_CALL handle ( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) override;
+
+ // css.frame.XUntitledNumbers
+ virtual ::sal_Int32 SAL_CALL leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent ) override;
+
+ // css.frame.XUntitledNumbers
+ virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber ) override;
+
+ // css.frame.XUntitledNumbers
+ virtual void SAL_CALL releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent ) override;
+
+ // css.frame.XUntitledNumbers
+ virtual OUString SAL_CALL getUntitledPrefix() override;
+
+ // we need this wrapped terminate()-call to terminate even the QuickStarter
+ // non-virtual and non-UNO for now
+ /// @throws css::uno::RuntimeException
+ bool terminateQuickstarterToo();
+
+ void shutdown();
+
+ private:
+ // OPropertySetHelper
+ virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue ,
+ css::uno::Any& aOldValue ,
+ sal_Int32 nHandle ,
+ const css::uno::Any& aValue ) override;
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
+ const css::uno::Any& aValue ) override;
+ using cppu::OPropertySetHelper::getFastPropertyValue;
+ virtual void SAL_CALL getFastPropertyValue ( css::uno::Any& aValue ,
+ sal_Int32 nHandle ) const override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper ( ) override;
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo ( ) override;
+
+ css::uno::Reference< css::lang::XComponent > impl_getFrameComponent ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const;
+
+ /** calls queryTermination() on every registered termination listener.
+ *
+ * Note: Only normal termination listener (registered in list m_aListenerContainer
+ * will be recognized here. Special listener like quick starter, pipe or others
+ * has to be handled explicitly !
+ *
+ * @param [out] lCalledListener
+ * every called listener will be returned here.
+ * Those list will be used to inform all called listener
+ * about cancel this termination request.
+ *
+ * @return true if no one vetoed the termination.
+ *
+ * @see impl_sendCancelTerminationEvent()
+ */
+ bool impl_sendQueryTerminationEvent(TTerminateListenerList& lCalledListener);
+
+ /** calls cancelTermination() on every termination listener
+ * where queryTermination() was called before.
+ *
+ * Note: Only normal termination listener (registered in list m_aListenerContainer
+ * will be recognized here. Special listener like quick starter, pipe or others
+ * has to be handled explicitly !
+ *
+ * @param [in] lCalledListener
+ * every listener in this list was called within its method
+ * queryTermination() before.
+ *
+ * @see impl_sendQueryTerminationEvent()
+ */
+ void impl_sendCancelTerminationEvent(const TTerminateListenerList& lCalledListener);
+
+ /** calls notifyTermination() on the clipboard listener
+ *
+ * The system clipboard may decide that it wants copies
+ * in several formats of the clipboard content requiring
+ * nearly all the services
+ *
+ */
+ void impl_sendTerminateToClipboard();
+
+ /** calls notifyTermination() on every registered termination listener.
+ *
+ * Note: Only normal termination listener (registered in list m_aListenerContainer
+ * will be recognized here. Special listener like quick starter, pipe or others
+ * has to be handled explicitly !
+ */
+ void impl_sendNotifyTerminationEvent();
+
+ /** try to close all open frames.
+ *
+ * Iterates over all child frames and try to close them.
+ * Given parameter bAllowUI enable/disable showing any UI
+ * (which mostly occur on calling XController->suspend()).
+ *
+ * This method doesn't stop if one frame could not be closed.
+ * It will ignore such frames and try all other ones.
+ * But it returns false in such case - true otherwise.
+ *
+ * @param bAllowUI
+ * enable/disable showing of UI.
+ *
+ * @return true if all frames could be closed; false otherwise.
+ */
+ bool impl_closeFrames(bool bAllowUI);
+
+ private:
+
+ mutable TransactionManager m_aTransactionManager;
+
+ /** check flag to protect against multiple terminate runs
+ */
+ bool m_bIsTerminated;
+
+ /** check flag to protect us against dispose before terminate!
+ * see dispose() for further information!
+ */
+ bool m_bIsShutdown;
+
+ /** when true, the call came from session manager
+ * the method is Desktop::terminateQuickstarterToo()
+ * this the only one place where set this to true
+ * In this case, when one frame break, not make
+ * question for other, the break of shutdown or logout
+ * can be only once.
+ * In Desktop::impl_closeFrames would be test and break
+ * the loop and reset to false
+ */
+ bool m_bSession;
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext; /// reference to factory, which has create this instance
+ FrameContainer m_aChildTaskContainer; /// array of child tasks (children of desktop are tasks; and tasks are also frames - But pure frames are not accepted!)
+ comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener
+ css::uno::Reference< css::frame::XFrames > m_xFramesHelper; /// helper for XFrames, XIndexAccess, XElementAccess and implementation of a childcontainer!
+ css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchHelper; /// helper to dispatch something for new tasks, created by "_blank"!
+ ELoadState m_eLoadState; /// hold information about state of asynchron loading of component for loadComponentFromURL()!
+ bool m_bSuspendQuickstartVeto; /// don't ask quickstart for a veto
+ std::unique_ptr<SvtCommandOptions> m_xCommandOptions; /// ref counted class to support disabling commands defined by configuration file
+ OUString m_sName;
+ OUString m_sTitle;
+ css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier;
+
+ /** special terminate listener to close pipe and block external requests
+ * during/after termination process is/was running
+ */
+ css::uno::Reference< css::frame::XTerminateListener > m_xPipeTerminator;
+
+ /** special terminate listener shown inside system tray (quick starter)
+ * Will hinder the office on shutdown ... but wish to allow closing
+ * of open documents. And because that's different to a normal terminate listener
+ * it has to be handled special .-)
+ */
+ css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher;
+
+ /** special terminate listener which loads images asynchronous for current open documents.
+ * Because internally it uses blocking system APIs... it can't be guaranteed that
+ * running jobs can be cancelled successfully if the corresponding document will be closed...
+ * it will not hinder those documents on closing. Instead it let all jobs running...
+ * but at least on terminate we have to wait for all those blocked requests.
+ * So these implementation must be a special terminate listener too .-(
+ */
+ css::uno::Reference< css::frame::XTerminateListener > m_xSWThreadManager;
+
+ /** special terminate listener shutting down the SfxApplication.
+ * Because these desktop instance closes documents and informs listener
+ * only... it does not really shutdown the whole application.
+ *
+ * Btw: that wouldn't be possible by design... because Desktop.terminate()
+ * has to return a boolean value about success... it can't really shutdown the
+ * process .-)
+ *
+ * So we uses a trick: a special listener (exactly these one here) listen for notifyTermination()
+ * and shutdown the process asynchronous. But desktop has to make this special
+ * notification as really last one ... Otherwise it can happen that asynchronous
+ * shutdown will be faster then all other code around Desktop.terminate() .-))
+ */
+ css::uno::Reference< css::frame::XTerminateListener > m_xSfxTerminator;
+
+ css::uno::Reference< css::frame::XUntitledNumbers > m_xTitleNumberGenerator;
+
+ std::vector<css::uno::Reference<css::frame::XTerminateListener>> m_xComponentDllListeners;
+
+}; // class Desktop
+
+FWK_DLLPUBLIC const rtl::Reference<Desktop> & getDesktop(
+ css::uno::Reference<css::uno::XComponentContext> const & context);
+
+} // namespace framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/dispatchhelper.hxx b/include/framework/dispatchhelper.hxx
new file mode 100644
index 000000000..399d3f0ec
--- /dev/null
+++ b/include/framework/dispatchhelper.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX
+#define INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX
+
+#include <config_options.h>
+#include <com/sun/star/frame/XDispatchHelper.hpp>
+#include <com/sun/star/frame/XDispatchResultListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+#include <cppuhelper/implbase.hxx>
+#include <framework/fwkdllapi.h>
+#include <condition_variable>
+#include <mutex>
+
+namespace com::sun::star::lang
+{
+class XMultiServiceFactory;
+}
+namespace com::sun::star::lang
+{
+class XSingleServiceFactory;
+}
+namespace com::sun::star::uno
+{
+class XComponentContext;
+}
+
+namespace framework
+{
+/**
+ @short implements an easy way for dispatches
+ @descr Dispatches are split into different parts:
+ - parsing of the URL
+ - searching for a dispatch object
+ - dispatching of the URL
+ All these steps are done inside one method call here.
+*/
+class UNLESS_MERGELIBS(FWK_DLLPUBLIC) DispatchHelper final
+ : public ::cppu::WeakImplHelper<css::lang::XServiceInfo, css::frame::XDispatchHelper,
+ css::frame::XDispatchResultListener>
+{
+ std::mutex m_mutex;
+
+ /** global uno service manager.
+ Can be used to create own needed services. */
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+
+ /** used to wait for asynchronous listener callbacks. */
+ std::condition_variable m_aBlock;
+ bool m_aBlockFlag;
+
+ css::uno::Any m_aResult;
+
+ css::uno::Reference<css::uno::XInterface> m_xBroadcaster;
+
+ // interface
+
+public:
+ // ctor/dtor
+
+ DispatchHelper(css::uno::Reference<css::uno::XComponentContext> xContext);
+ virtual ~DispatchHelper() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XDispatchHelper
+ virtual css::uno::Any SAL_CALL
+ executeDispatch(const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider,
+ const OUString& sURL, const OUString& sTargetFrameName, sal_Int32 nSearchFlags,
+ const css::uno::Sequence<css::beans::PropertyValue>& lArguments) override;
+
+ // not a public XDispatchHelper-method, need in sfx2/source/control/statcach.cxx for extensions
+ /// @throws css::uno::RuntimeException
+ const css::uno::Any&
+ executeDispatch(const css::uno::Reference<css::frame::XDispatch>& xDispatch,
+ const css::util::URL& aURL, bool SyncronFlag,
+ const css::uno::Sequence<css::beans::PropertyValue>& lArguments);
+
+ // XDispatchResultListener
+ virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& aResult) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override;
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/documentundoguard.hxx b/include/framework/documentundoguard.hxx
new file mode 100644
index 000000000..ec1a5951b
--- /dev/null
+++ b/include/framework/documentundoguard.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FRAMEWORK_DOCUMENTUNDOGUARD_HXX
+#define INCLUDED_FRAMEWORK_DOCUMENTUNDOGUARD_HXX
+
+#include <framework/fwkdllapi.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <memory>
+
+namespace com::sun::star::uno { class XInterface; }
+
+namespace framework
+{
+ //= DocumentUndoGuard
+
+ struct DocumentUndoGuard_Data;
+ /** a helper class guarding the Undo manager of a document
+
+ This class guards, within a given scope, the Undo Manager of a document (or another component supporting
+ the XUndoManagerSupplier interface). When entering the scope (i.e. when the <code>DocumentUndoGuard</code>
+ instances is constructed), the current state of the undo contexts of the undo manager is examined.
+ Upon leaving the scope (i.e. when the <code>DocumentUndoGuard</code> is destructed), the guard will execute
+ as many calls to <member scope="css::document">XUndoManager::leaveUndoContext</member> as are
+ necessary to restore the manager's initial state.
+ */
+ class FWK_DLLPUBLIC DocumentUndoGuard
+ {
+ public:
+ DocumentUndoGuard( const css::uno::Reference< css::uno::XInterface >& i_undoSupplierComponent );
+ ~DocumentUndoGuard();
+
+ private:
+ std::unique_ptr< DocumentUndoGuard_Data > m_xData;
+ };
+
+
+} // namespace framework
+
+
+#endif // INCLUDED_FRAMEWORK_DOCUMENTUNDOGUARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/framecontainer.hxx b/include/framework/framecontainer.hxx
new file mode 100644
index 000000000..1678a8670
--- /dev/null
+++ b/include/framework/framecontainer.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <vector>
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <rtl/ustring.hxx>
+
+namespace framework{
+
+typedef ::std::vector< css::uno::Reference< css::frame::XFrame > > TFrameContainer;
+
+/*-************************************************************************************************************
+ @short implement a container to hold children of frame, task or desktop
+ @descr Every object of frame, task or desktop hold reference to its children. These container is used as helper
+ to do this. Some helper-classes like OFrames or OTasksAccess use it to. They hold a pointer to an instance
+ of this class, which is a member of a frame, task or desktop! You can append and remove frames.
+ It's possible to set one of these frames as active or deactivate. You could have full index-access to
+ container-items.
+
+ @devstatus ready to use
+ @threadsafe yes
+*//*-*************************************************************************************************************/
+class FrameContainer final
+{
+
+ // member
+
+ private:
+
+ /// list to hold all frames
+ TFrameContainer m_aContainer;
+ /// one container item can be the current active frame. It's necessary for Desktop or Frame implementation.
+ css::uno::Reference< css::frame::XFrame > m_xActiveFrame;
+
+ // interface
+
+ public:
+
+ /// constructor / destructor
+ FrameContainer();
+ ~FrameContainer();
+
+ /// add/remove/mark container items
+ void append ( const css::uno::Reference< css::frame::XFrame >& xFrame );
+ void remove ( const css::uno::Reference< css::frame::XFrame >& xFrame );
+ void setActive ( const css::uno::Reference< css::frame::XFrame >& xFrame );
+ css::uno::Reference< css::frame::XFrame > getActive ( ) const;
+
+ /// checks and free memory
+ bool exist ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const;
+ void clear ( );
+
+ /// deprecated IndexAccess!
+ sal_uInt32 getCount ( ) const;
+ css::uno::Reference< css::frame::XFrame > operator[]( sal_uInt32 nIndex ) const;
+
+ /// replacement for deprecated index access
+ css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > getAllElements() const;
+
+ /// special helper for Frame::findFrame()
+ css::uno::Reference< css::frame::XFrame > searchOnAllChildrens ( const OUString& sName ) const;
+ css::uno::Reference< css::frame::XFrame > searchOnDirectChildrens( std::u16string_view sName ) const;
+
+}; // class FrameContainer
+
+} // namespace framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/framelistanalyzer.hxx b/include/framework/framelistanalyzer.hxx
new file mode 100644
index 000000000..df47f90b2
--- /dev/null
+++ b/include/framework/framelistanalyzer.hxx
@@ -0,0 +1,204 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FRAMEWORK_FRAMELISTANALYZER_HXX
+#define INCLUDED_FRAMEWORK_FRAMELISTANALYZER_HXX
+
+#include <config_options.h>
+#include <framework/fwkdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <vector>
+
+namespace com::sun::star::frame { class XFrame; }
+namespace com::sun::star::frame { class XFramesSupplier; }
+
+/** These enums can be combined as flags to enable/disable
+ special search algorithm during analyze phase.
+ see impl_analyze() for further information.
+ But note: To be usable as flags, these enums
+ must be values of range [2^n]! */
+enum class FrameAnalyzerFlags
+{
+ Model = 1,
+ Help = 2,
+ BackingComponent = 4,
+ Hidden = 8,
+ All = 15,
+ Zombie = 32768 // use it for special test scenarios only!!!
+};
+namespace o3tl {
+ template<> struct typed_flags<FrameAnalyzerFlags> : is_typed_flags<FrameAnalyzerFlags, 32768+15> {};
+}
+
+
+namespace framework{
+
+/** analyze and split the current available frame list of a given frames supplier
+ into different parts.
+
+ These analyzed information can be used e.g. to decide if it's necessary
+ to switch into the backing mode, close the current active frame only or
+ exit the whole application explicitly or implicitly.
+ */
+class UNLESS_MERGELIBS(FWK_DLLPUBLIC) FrameListAnalyzer final
+{
+
+ // types
+
+ public:
+
+ // member
+
+ public:
+
+ /** provides access to the frame container, which should be analyzed. */
+ const css::uno::Reference< css::frame::XFramesSupplier >& m_xSupplier;
+
+ /** hold the reference frame, which is used e.g. to detect other frames with the same model. */
+ const css::uno::Reference< css::frame::XFrame >& m_xReferenceFrame;
+
+ /** enable/disable some special analyzing steps.
+ see impl_analyze() for further information. */
+ FrameAnalyzerFlags m_eDetectMode;
+
+ /** contains all frames, which uses the same model like the reference frame.
+ Will be filled only if m_eDetectMode has set the flag FrameAnalyzerFlags::Model.
+ The reference frame is never part of this list! */
+ std::vector< css::uno::Reference< css::frame::XFrame > > m_lModelFrames;
+
+ /** contains all frames, which does not contain the same model like the reference frame.
+ Filling of it can't be suppressed by m_eDetectMode.
+ The reference frame is never part of this list!
+ All frames inside this list are visible ones. */
+ std::vector< css::uno::Reference< css::frame::XFrame > > m_lOtherVisibleFrames;
+
+ /** contains all frames, which does not contain the same model like the reference frame.
+ Filling of it can't be suppressed by m_eDetectMode.
+ The reference frame is never part of this list!
+ All frames inside this list are hidden ones. */
+ std::vector< css::uno::Reference< css::frame::XFrame > > m_lOtherHiddenFrames;
+
+ /** points to the help frame.
+ Will be set only, if any other frame (means different from the reference frame)
+ contains the help component. If the reference frame itself includes the help module
+ it's not set ... but another member m_bIsHelp is used to safe this information.
+ See following example code:
+
+ <listing>
+ if (m_xReferenceFrame == help)
+ {
+ m_xHelp = NULL;
+ m_bIsHelp = sal_True;
+ }
+ else
+ if (xOtherFrame == help)
+ {
+ m_xHelp = xOtherFrame;
+ m_bIsHelp = sal_False;
+ }
+ </listing>
+
+ Analyzing of the help frame ignores the visible state of any frame.
+ But note: a hidden help frame indicates a wrong state!
+ */
+ css::uno::Reference< css::frame::XFrame > m_xHelp;
+
+ /** points to the frame, which contains the backing component.
+ Will be set only, if any other frame (means different from the reference frame)
+ contains the backing component. If the reference frame itself includes the
+ backing component it's not set ... but another member m_bIsBackingComponent
+ will used to safe this information.
+ See following example code:
+
+ <listing>
+ if (m_xReferenceFrame == backing)
+ {
+ m_xBackingComponent = NULL;
+ m_bIsBackingComponent = sal_True;
+ }
+ else
+ if (xOtherFrame == backing)
+ {
+ m_xBackingComponent = xOtherFrame;
+ m_bIsBackingComponent = sal_False ;
+ }
+ </listing>
+
+ Analyzing of the help frame ignores the visible state of any frame.
+ But note: a hidden backing mode frame indicates a wrong state!
+ */
+ css::uno::Reference< css::frame::XFrame > m_xBackingComponent;
+
+ /** is set to true only, if the reference frame is a hidden one.
+ This value is undefined if m_eDetectMode doesn't have set the flag FrameAnalyzerFlags::Hidden! */
+ bool m_bReferenceIsHidden;
+
+ /** is set to true only, if the reference frame contains the help component.
+ In this case the member m_xHelp is set to NULL every time.
+ This value is undefined if m_eDetectMode doesn't have set the flag FrameAnalyzerFlags::Help! */
+ bool m_bReferenceIsHelp;
+
+ /** is set to true only, if the reference frame contains the backing component.
+ In this case the member m_xBackingComponent is set to NULL every time.
+ This value is undefined if m_eDetectMode doesn't have set the flag FrameAnalyzerFlags::BackingComponent! */
+ bool m_bReferenceIsBacking;
+
+
+ // interface
+
+ public:
+
+ /** starts analyze phase and fill all members with valid information.
+
+ @param xSupplier
+ Must be a valid reference to a frames supplier, which provides
+ access to the frame list for analyzing.
+
+ @param xReferenceFrame
+ This frame must(!) exist inside the analyzed frame list and
+ is used for some comparing functions. Further some member states
+ depends from the current state of this frame.
+
+ @param eDetectMode
+ It represent a flag field, which can enable/disable special
+ analyze steps. Note: Some member values will be undefined, if
+ an analyze step will be disabled.
+ */
+ FrameListAnalyzer( const css::uno::Reference< css::frame::XFramesSupplier >& xSupplier ,
+ const css::uno::Reference< css::frame::XFrame >& xReferenceFrame ,
+ FrameAnalyzerFlags eDetectMode );
+ ~FrameListAnalyzer();
+
+
+ // helper
+
+ private:
+
+ void impl_analyze();
+
+
+}; // class FrameListAnalyzer
+
+} // namespace framework
+
+#endif // INCLUDED_FRAMEWORK_FRAMELISTANALYZER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/fwkdllapi.h b/include/framework/fwkdllapi.h
new file mode 100644
index 000000000..dc580c1bb
--- /dev/null
+++ b/include/framework/fwkdllapi.h
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+#if defined FWK_DLLIMPLEMENTATION
+#define FWK_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define FWK_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/framework/gate.hxx b/include/framework/gate.hxx
new file mode 100644
index 000000000..ab9f81c24
--- /dev/null
+++ b/include/framework/gate.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <mutex>
+#include <osl/conditn.hxx>
+
+namespace framework{
+
+/*-************************************************************************************************************
+ @short implement a gate to block multiple threads at the same time or unblock all
+ @descr A gate can be used as a negative-condition! You can open a "door" - wait() will not block ...
+ or you can close it - wait() blocks till open() is called again.
+ Then all currently waiting threads are running immediately - but new ones are blocked!
+
+ @attention To prevent us against wrong using, the default ctor, copy ctor and the =operator are marked private!
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+class Gate
+{
+
+ // public methods
+
+ public:
+
+ /*-****************************************************************************************************
+ @short ctor
+ @descr These initialize the object right as an open gate.
+ *//*-*****************************************************************************************************/
+ Gate()
+ : m_bClosed ( false )
+ {
+ open();
+ }
+
+ /*-****************************************************************************************************
+ @short dtor
+ @descr Is user forget it - we open the gate ...
+ blocked threads can running ... but I don't know
+ if it's right - we are destroyed yet!?
+ *//*-*****************************************************************************************************/
+ ~Gate()
+ {
+ open();
+ }
+ /*-****************************************************************************************************
+ @short copy-ctor
+ @descr Forbid copy construction
+ *//*-*****************************************************************************************************/
+ Gate(const Gate&) = delete;
+ /*-****************************************************************************************************
+ @short copy-assignment
+ @descr Forbid copy assigning
+ *//*-*****************************************************************************************************/
+ Gate& operator=(const Gate&) = delete;
+
+ /*-****************************************************************************************************
+ @short open the gate
+ @descr A wait() call will not block then.
+
+ @seealso method close()
+ *//*-*****************************************************************************************************/
+ void open()
+ {
+ // We must safe access to our internal member!
+ std::unique_lock aLock( m_aAccessLock );
+ // Set condition -> wait don't block any longer -> gate is open
+ m_aPassage.set();
+ // Check if operation was successful!
+ // Check returns false if condition isn't set => m_bClosed will be true then => we must return false; opening failed
+ m_bClosed = !m_aPassage.check();
+ }
+
+ /*-****************************************************************************************************
+ @short close the gate
+ @descr A wait() call will block then.
+
+ @seealso method open()
+ *//*-*****************************************************************************************************/
+ void close()
+ {
+ // We must safe access to our internal member!
+ std::unique_lock aLock( m_aAccessLock );
+ // Reset condition -> wait blocks now -> gate is closed
+ m_aPassage.reset();
+ // Check if operation was successful!
+ // Check returns false if condition was reset => m_bClosed will be true then => we can return true; closing ok
+ m_bClosed = !m_aPassage.check();
+ }
+
+ /*-****************************************************************************************************
+ @short must be called to pass the gate
+ @descr If gate "open" => wait() will not block.
+ If gate "closed" => wait() will block till somewhere open it again.
+
+ @seealso method wait()
+ @seealso method open()
+
+ *//*-*****************************************************************************************************/
+ void wait()
+ {
+ // We must safe access to our internal member!
+ std::unique_lock aLock( m_aAccessLock );
+ // If gate not closed - caller can pass it.
+ if( m_bClosed )
+ {
+ // Then we must release used access lock -
+ // because next call will block...
+ // and if we hold the access lock nobody else can use this object without a deadlock!
+ aLock.unlock();
+ // Wait for opening gate...
+ m_aPassage.wait();
+ }
+ }
+
+ // private member
+
+ private:
+
+ std::mutex m_aAccessLock;
+ ::osl::Condition m_aPassage;
+ bool m_bClosed;
+
+}; // class Gate
+
+} // namespace framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/generictoolbarcontroller.hxx b/include/framework/generictoolbarcontroller.hxx
new file mode 100644
index 000000000..e177ea5f0
--- /dev/null
+++ b/include/framework/generictoolbarcontroller.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <framework/fwkdllapi.h>
+#include <svtools/toolboxcontroller.hxx>
+#include <vcl/vclptr.hxx>
+
+class ToolBox;
+
+namespace framework
+{
+
+class FWK_DLLPUBLIC GenericToolbarController final : public svt::ToolboxController
+{
+ public:
+ GenericToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ ToolBox* pToolBar,
+ ToolBoxItemId nID,
+ const OUString& aCommand );
+ GenericToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ weld::Toolbar& rToolBar,
+ const OUString& aCommand );
+ virtual ~GenericToolbarController() override;
+
+ // XComponent
+ virtual void SAL_CALL dispose() override;
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
+
+ DECL_DLLPRIVATE_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, void*, void );
+
+ struct ExecuteInfo
+ {
+ css::uno::Reference< css::frame::XDispatch > xDispatch;
+ css::util::URL aTargetURL;
+ css::uno::Sequence< css::beans::PropertyValue > aArgs;
+ };
+
+ private:
+ VclPtr<ToolBox> m_xToolbar;
+ ToolBoxItemId m_nID;
+ bool m_bEnumCommand : 1,
+ m_bMadeInvisible : 1;
+ OUString m_aEnumCommand;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/imutex.hxx b/include/framework/imutex.hxx
new file mode 100644
index 000000000..4b4668f8e
--- /dev/null
+++ b/include/framework/imutex.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FRAMEWORK_IMUTEX_HXX
+#define INCLUDED_FRAMEWORK_IMUTEX_HXX
+
+#include <sal/types.h>
+
+namespace framework{
+
+/// Interface to support different mutex implementations in a generic way.
+class SAL_NO_VTABLE IMutex
+{
+ public:
+ /// try to register thread
+ virtual void acquire() = 0;
+ /// unregister thread
+ virtual void release() = 0;
+
+ protected:
+ ~IMutex() {}
+};
+}
+
+#endif // INCLUDED_FRAMEWORK_IMUTEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/interaction.hxx b/include/framework/interaction.hxx
new file mode 100644
index 000000000..4700d1920
--- /dev/null
+++ b/include/framework/interaction.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FRAMEWORK_INTERACTION_HXX
+#define INCLUDED_FRAMEWORK_INTERACTION_HXX
+
+#include <config_options.h>
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <framework/fwkdllapi.h>
+
+namespace com::sun::star::task
+{
+class XInteractionContinuation;
+}
+namespace com::sun::star::task
+{
+class XInteractionRequest;
+}
+namespace com::sun::star::uno
+{
+template <class E> class Sequence;
+}
+
+namespace framework
+{
+/*-************************************************************************************************************
+ @short special request for interaction to ask user for right filter
+ @descr These helper can be used to ask user for right filter, if filter detection failed.
+ It capsulate communication with any interaction handler and supports an easy
+ access on interaction results for user of these class.
+ Use it and forget complex mechanism of interaction ...
+
+ @example RequestFilterSelect* pRequest = new RequestFilterSelect;
+ Reference< XInteractionRequest > xRequest ( pRequest );
+ xInteractionHandler->handle( xRequest );
+ if( ! pRequest.isAbort() )
+ {
+ OUString sFilter = pRequest->getFilter();
+ }
+
+ @implements XInteractionRequest
+
+ @devstatus ready to use
+ @threadsafe no (used on once position only!)
+*/ /*-*************************************************************************************************************/
+class RequestFilterSelect_Impl;
+class UNLESS_MERGELIBS(FWK_DLLPUBLIC) RequestFilterSelect
+{
+ rtl::Reference<RequestFilterSelect_Impl> mxImpl;
+
+public:
+ RequestFilterSelect(const OUString& sURL);
+ ~RequestFilterSelect();
+
+ RequestFilterSelect& operator=(RequestFilterSelect const&) = delete; // MSVC2019 workaround
+ RequestFilterSelect(RequestFilterSelect const&) = delete; // MSVC2019 workaround
+
+ bool isAbort() const;
+ OUString getFilter() const;
+ css::uno::Reference<css::task::XInteractionRequest> GetRequest() const;
+};
+
+/*-************************************************************************************************************
+ @short special request for interaction
+ @descr User must decide between a preselected and another detected filter.
+ It capsulate communication with any interaction handler and supports an easy
+ access on interaction results for user of these class.
+
+ @implements XInteractionRequest
+
+ @devstatus ready to use
+ @threadsafe no (used on once position only!)
+*/ /*-*************************************************************************************************************/
+class FWK_DLLPUBLIC InteractionRequest
+{
+public:
+ static css::uno::Reference<css::task::XInteractionRequest> CreateRequest(
+ const css::uno::Any& aRequest,
+ const css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>>&
+ lContinuations);
+};
+
+} // namespace framework
+
+#endif // #define INCLUDED_FRAMEWORK_INTERACTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/sfxhelperfunctions.hxx b/include/framework/sfxhelperfunctions.hxx
new file mode 100644
index 000000000..36de22f54
--- /dev/null
+++ b/include/framework/sfxhelperfunctions.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <framework/fwkdllapi.h>
+#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
+#include <vcl/toolboxid.hxx>
+
+namespace com::sun::star::frame { class XFrame; class XToolbarController; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace svt { class StatusbarController; }
+namespace svt { class ToolboxController; }
+
+class StatusBar;
+class ToolBox;
+namespace weld {
+ class Toolbar;
+ class Builder;
+};
+
+typedef rtl::Reference<svt::ToolboxController> ( *pfunc_setToolBoxControllerCreator)(
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ ToolBox* pToolbox,
+ ToolBoxItemId nID,
+ const OUString& aCommandURL );
+
+typedef css::uno::Reference<css::frame::XToolbarController> ( *pfunc_setWeldToolBoxControllerCreator)(
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ weld::Toolbar* pToolbar,
+ weld::Builder* pBuilder,
+ const OUString& aCommandURL );
+
+typedef rtl::Reference<svt::StatusbarController> ( *pfunc_setStatusBarControllerCreator)(
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ StatusBar* pStatusBar,
+ unsigned short nID,
+ const OUString& aCommandURL );
+
+typedef void ( *pfunc_getRefreshToolbars)(
+ css::uno::Reference< css::frame::XFrame > const & rFrame );
+
+typedef void ( *pfunc_createDockingWindow)(
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ std::u16string_view rResourceURL );
+
+typedef bool ( *pfunc_isDockingWindowVisible)(
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ std::u16string_view rResourceURL );
+
+
+namespace framework
+{
+FWK_DLLPUBLIC pfunc_setToolBoxControllerCreator SetToolBoxControllerCreator( pfunc_setToolBoxControllerCreator pSetToolBoxControllerCreator );
+FWK_DLLPUBLIC rtl::Reference<svt::ToolboxController> CreateToolBoxController(
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ ToolBox* pToolbox,
+ ToolBoxItemId nID,
+ const OUString& aCommandURL );
+
+FWK_DLLPUBLIC pfunc_setWeldToolBoxControllerCreator SetWeldToolBoxControllerCreator( pfunc_setWeldToolBoxControllerCreator pSetToolBoxControllerCreator );
+FWK_DLLPUBLIC css::uno::Reference<css::frame::XToolbarController> CreateWeldToolBoxController(
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ weld::Toolbar* pToolbar,
+ weld::Builder* pBuilder,
+ const OUString& aCommandURL );
+
+FWK_DLLPUBLIC pfunc_setStatusBarControllerCreator SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator );
+FWK_DLLPUBLIC rtl::Reference<svt::StatusbarController> CreateStatusBarController(
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ StatusBar* pStatusBar,
+ unsigned short nID,
+ const OUString& aCommandURL );
+
+FWK_DLLPUBLIC pfunc_getRefreshToolbars SetRefreshToolbars( pfunc_getRefreshToolbars pRefreshToolbarsFunc );
+FWK_DLLPUBLIC void RefreshToolbars(
+ css::uno::Reference< css::frame::XFrame > const & rFrame );
+
+FWK_DLLPUBLIC pfunc_createDockingWindow SetDockingWindowCreator( pfunc_createDockingWindow pCreateDockingWindow );
+FWK_DLLPUBLIC void CreateDockingWindow(
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ std::u16string_view rResourceURL );
+
+FWK_DLLPUBLIC pfunc_isDockingWindowVisible SetIsDockingWindowVisible( pfunc_isDockingWindowVisible pIsDockingWindowVisible );
+FWK_DLLPUBLIC bool IsDockingWindowVisible(
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ std::u16string_view rResourceURL );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/titlehelper.hxx b/include/framework/titlehelper.hxx
new file mode 100644
index 000000000..2b6e251d3
--- /dev/null
+++ b/include/framework/titlehelper.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FRAMEWORK_TITLEHELPER_HXX
+#define INCLUDED_FRAMEWORK_TITLEHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/frame/XTitle.hpp>
+#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+#include <com/sun/star/document/XDocumentEventListener.hpp>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/multicontainer2.hxx>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <framework/fwkdllapi.h>
+
+namespace com::sun::star::frame { class XController; }
+namespace com::sun::star::frame { class XFrame; }
+namespace com::sun::star::frame { class XModel3; }
+namespace com::sun::star::frame { class XUntitledNumbers; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::uno { class XInterface; }
+
+
+namespace framework{
+
+
+/** @short can be used as implementation helper of interface css.frame.XTitle
+
+ @threadsafe
+ */
+class FWK_DLLPUBLIC TitleHelper final : private ::cppu::BaseMutex
+ , public ::cppu::WeakImplHelper< css::frame::XTitle ,
+ css::frame::XTitleChangeBroadcaster,
+ css::frame::XTitleChangeListener ,
+ css::frame::XFrameActionListener ,
+ css::document::XDocumentEventListener >
+{
+
+ // interface
+ public:
+
+
+ /** set an outside component which uses this container and must be set
+ as source of all broadcasted messages, exceptions.
+
+ It's holded weak only so we do not need any complex dispose sessions.
+
+ Note: Passing NULL as parameter will be allowed. It will reset the internal
+ member reference only.
+
+ @param xOwner
+ the new owner of this collection.
+ @param xNumbers
+ provides the right string and number for an untitled component.
+ */
+ TitleHelper(css::uno::Reference< css::uno::XComponentContext > xContext,
+ const css::uno::Reference< css::uno::XInterface >& xOwner,
+ const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers);
+
+ /** @short free all internally used resources.
+ */
+ virtual ~TitleHelper() override;
+
+
+ /** @see XTitle */
+ virtual OUString SAL_CALL getTitle() override;
+
+
+ /** @see XTitle */
+ virtual void SAL_CALL setTitle(const OUString& sTitle) override;
+
+
+ /** @see XTitleChangeBroadcaster */
+ virtual void SAL_CALL addTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) override;
+
+
+ /** @see XTitleChangeBroadcaster */
+ virtual void SAL_CALL removeTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) override;
+
+
+ /** @see XTitleChangeListener */
+ virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent) override;
+
+
+ /** @see css.document.XDocumentEventListener */
+ virtual void SAL_CALL documentEventOccured(const css::document::DocumentEvent& aEvent) override;
+
+
+ /** @see css.lang.XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override;
+
+
+ /** @see css.frame.XFrameActionListener */
+ virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) override;
+
+
+ // internal
+ private:
+
+ void impl_sendTitleChangedEvent ();
+
+ void impl_updateTitle (bool init = false);
+ void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel3 >& xModel, bool init);
+ void impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController, bool init);
+ void impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame, bool init);
+
+ void impl_startListeningForModel (const css::uno::Reference< css::frame::XModel >& xModel);
+ void impl_startListeningForController (const css::uno::Reference< css::frame::XController >& xController);
+ void impl_startListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame);
+ void impl_updateListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame);
+
+ void impl_appendComponentTitle ( OUStringBuffer& sTitle ,
+ const css::uno::Reference< css::uno::XInterface >& xComponent);
+ void impl_appendProductName (OUStringBuffer& sTitle);
+ void impl_appendModuleName (OUStringBuffer& sTitle);
+ void impl_appendDebugVersion (OUStringBuffer& sTitle);
+ void impl_appendSafeMode (OUStringBuffer& sTitle);
+
+ void impl_setSubTitle (const css::uno::Reference< css::frame::XTitle >& xSubTitle);
+
+ OUString impl_convertURL2Title(std::u16string_view sURL);
+
+
+ // member
+ private:
+
+ /** points to the global uno service manager. */
+ css::uno::Reference< css::uno::XComponentContext> m_xContext;
+
+ /** reference to the outside UNO class using this helper. */
+ css::uno::WeakReference< css::uno::XInterface > m_xOwner;
+
+ /** used to know how an "Untitled X" string can be created right :-) */
+ css::uno::WeakReference< css::frame::XUntitledNumbers > m_xUntitledNumbers;
+
+ /** provides parts of our own title and we listen there for changes too. */
+ css::uno::WeakReference< css::frame::XTitle > m_xSubTitle;
+
+ /** if it's set to sal_True the member m_sTitle has not to be changed internally.
+ It was set from outside and so outside code has to make sure it will be
+ updated.
+ */
+ bool m_bExternalTitle;
+
+ /** the actual title value */
+ OUString m_sTitle;
+
+ /** knows the leased number which must be used for untitled components. */
+ ::sal_Int32 m_nLeasedNumber;
+
+ /** contains all title change listener */
+ comphelper::OMultiTypeInterfaceContainerHelper2 m_aListener;
+};
+
+} // namespace framework
+
+#endif // INCLUDED_FRAMEWORK_TITLEHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/transactionmanager.hxx b/include/framework/transactionmanager.hxx
new file mode 100644
index 000000000..fe011968c
--- /dev/null
+++ b/include/framework/transactionmanager.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <mutex>
+
+#include "gate.hxx"
+
+namespace framework{
+
+/*-************************************************************************************************************
+ @descr Describe different states of a feature of following implementation.
+ During lifetime of an object different working states occur:
+ initialization - working - closing - closed
+ If you wish to implement thread safe classes you should use this feature to protect
+ your code against calls at wrong time. e.g. you are not full initialized but somewhere
+ call an interface method (initialize phase means startup time from creating object till
+ calling specified first method e.g. XInitialization::initialize()!) then you should refuse
+ this call. The same for closing/disposing the object!
+*//*-*************************************************************************************************************/
+enum EWorkingMode
+{
+ E_INIT , // We stand in an init method -> some calls are accepted - some ones are rejected
+ E_WORK , // Object is ready for working -> all calls are accepted
+ E_BEFORECLOSE, // We stand in a close method -> some calls are accepted - some ones are rejected
+ E_CLOSE // Object is dead! -> all calls are rejected!
+};
+
+/*-************************************************************************************************************
+ @descr A transaction object should support throwing exceptions if user used it at wrong working mode.
+ e.g. We can throw a DisposedException if user try to work and our mode is E_CLOSE!
+ But sometimes he doesn't need this feature - will handle it by himself.
+ Then we must differ between some exception-modi:
+ E_HARDEXCEPTIONS We throw exceptions for all working modes different from E_WORK!
+ E_SOFTEXCEPTIONS We throw exceptions for all working modes different from E_WORK AND E_INCLOSE!
+ This mode is useful for impl-methods which should be callable from dispose() method!
+
+ e.g. void dispose()
+ {
+ m_aTransactionManager.setWorkingMode( E_BEFORECLOSE );
+ ...
+ impl_setA( 0 );
+ ...
+ m_aTransactionManager.setWorkingMode( E_CLOSE );
+ }
+
+ void impl_setA( int nA )
+ {
+ ERejectReason EReason;
+ TransactionGuard aTransactionGuard( m_aTransactionManager, E_SOFTEXCEPTIONS, eReason );
+
+ m_nA = nA;
+ }
+
+ Normally (if E_HARDEXCEPTIONS was used!) creation of guard
+ will throw an exception ... but using of E_SOFTEXCEPTIONS suppress it
+ and member "A" can be set.
+*//*-*************************************************************************************************************/
+enum EExceptionMode
+{
+ E_HARDEXCEPTIONS,
+ E_SOFTEXCEPTIONS
+};
+
+/*-************************************************************************************************************
+ @short implement a transaction manager to support non breakable interface methods
+ @descr Use it to support non breakable interface methods without using any thread
+ synchronization like e.g. mutex, rw-lock!
+ That protect your code against wrong calls at wrong time ... e.g. calls after disposing an object!
+ Use combination of EExceptionMode and ERejectReason to detect rejected requests
+ and react for it. You can enable automatically throwing of exceptions too.
+
+ @devstatus draft
+*//*-*************************************************************************************************************/
+class TransactionManager
+{
+
+ // public methods
+
+ public:
+
+ TransactionManager ( );
+ ~TransactionManager ( );
+ TransactionManager(const TransactionManager&) = delete;
+ TransactionManager& operator=(const TransactionManager&) = delete;
+ void setWorkingMode ( EWorkingMode eMode );
+ EWorkingMode getWorkingMode ( ) const;
+ /// @throws css::uno::RuntimeException
+ /// @throws css::lang::DisposedException
+ void registerTransaction ( EExceptionMode eMode );
+ /// @throws css::uno::RuntimeException
+ /// @throws css::lang::DisposedException
+ void unregisterTransaction ( );
+
+ private:
+
+ mutable std::mutex m_aAccessLock; /// regulate access on internal member of this instance
+ Gate m_aBarrier; /// used to block transactions requests during change or work mode
+ EWorkingMode m_eWorkingMode; /// current working mode of object which use this manager (used to reject calls at wrong time)
+ sal_Int32 m_nTransactionCount; /// every transaction request is registered by this counter
+
+}; // class TransactionManager
+
+} // namespace framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/undomanagerhelper.hxx b/include/framework/undomanagerhelper.hxx
new file mode 100644
index 000000000..eb9986919
--- /dev/null
+++ b/include/framework/undomanagerhelper.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FRAMEWORK_UNDOMANAGERHELPER_HXX
+#define INCLUDED_FRAMEWORK_UNDOMANAGERHELPER_HXX
+
+#include <framework/fwkdllapi.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <memory>
+
+namespace com::sun::star::document { class XUndoAction; }
+namespace com::sun::star::document { class XUndoManager; }
+namespace com::sun::star::document { class XUndoManagerListener; }
+namespace com::sun::star::util { class XModifyListener; }
+namespace framework { class IMutex; }
+
+class SfxUndoManager;
+
+
+namespace framework
+{
+
+
+ //= IMutexGuard
+
+ class SAL_NO_VTABLE IMutexGuard
+ {
+ public:
+ /** clears the lock. If the guard does not currently hold the lock, nothing happens.
+ */
+ virtual void clear() = 0;
+
+ /** returns the mutex guarded by the instance.
+
+ Even if the guard currently has not a lock on the mutex, this method must succeed.
+ */
+ virtual IMutex& getGuardedMutex() = 0;
+
+ protected:
+ ~IMutexGuard() {}
+ };
+
+
+ //= IUndoManagerImplementation
+
+ class SAL_NO_VTABLE IUndoManagerImplementation
+ {
+ public:
+ /** returns the SfxUndoManager interface to the actual Undo stack
+
+ @throws css::lang::DisposedException
+ when the instance is already disposed, and no SfxUndoManager can be provided
+
+ @throws css::lang::NotInitializedException
+ when the instance is not initialized, yet, and no SfxUndoManager can be provided
+ */
+ virtual SfxUndoManager& getImplUndoManager() = 0;
+
+ /** provides access to a UNO interface for the XUndoManager implementation. Used when throwing exceptions.
+ */
+ virtual css::uno::Reference< css::document::XUndoManager >
+ getThis() = 0;
+
+ protected:
+ ~IUndoManagerImplementation() {}
+ };
+
+
+ //= UndoManagerHelper
+
+ class UndoManagerHelper_Impl;
+ /** helper class for implementing an XUndoManager
+
+ Several of the methods of the class take an IMutexGuard instance. It is assumed that this guard has a lock on
+ its mutex at the moment the method is entered. The lock will be released before any notifications to the
+ registered XUndoManagerListeners happen.
+
+ The following locking strategy is used for this mutex:
+ <ul><li>Any notifications to the registered XUndoManagerListeners are after the guard has been cleared. i.e.
+ without the mutex being locked.</p>
+ <li>Any calls into the <code>SfxUndoManager</code> implementation is made without the mutex being locked.
+ Note that this implies that the <code>SfxUndoManager</code> implementation must be thread-safe in itself
+ (which is true for the default implementation, SfxUndoManager).</li>
+ <li>An exception to the previous item are the <member>SfxUndoManager::Undo</member> and
+ <member>SfxUndoManager::Redo</member> methods: They're called with the given external mutex being
+ locked.</li>
+ </ul>
+
+ The reason for the exception for SfxUndoManager::Undo and SfxUndoManager::Redo is that those are expected to
+ modify the actual document which the UndoManager works for. And as long as our documents are not thread-safe,
+ and as long as we do not re-fit <strong>all</strong> existing SfxUndoImplementations to <em>not</em> expect
+ the dreaded SolarMutex being locked when they're called, the above behavior is a compromise between "how it should
+ be" and "how it can realistically be".
+ */
+ class FWK_DLLPUBLIC UndoManagerHelper
+ {
+ public:
+ UndoManagerHelper( IUndoManagerImplementation& i_undoManagerImpl );
+ ~UndoManagerHelper();
+
+ // life time control
+ void disposing();
+
+ // XUndoManager equivalents
+ void enterUndoContext( const OUString& i_title, IMutexGuard& i_instanceLock );
+ void enterHiddenUndoContext( IMutexGuard& i_instanceLock );
+ void leaveUndoContext( IMutexGuard& i_instanceLock );
+ void addUndoAction( const css::uno::Reference< css::document::XUndoAction >& i_action, IMutexGuard& i_instanceLock );
+ void undo( IMutexGuard& i_instanceLock );
+ void redo( IMutexGuard& i_instanceLock );
+ bool isUndoPossible() const;
+ bool isRedoPossible() const;
+ OUString getCurrentUndoActionTitle() const;
+ OUString getCurrentRedoActionTitle() const;
+ css::uno::Sequence< OUString >
+ getAllUndoActionTitles() const;
+ css::uno::Sequence< OUString >
+ getAllRedoActionTitles() const;
+ void clear( IMutexGuard& i_instanceLock );
+ void clearRedo( IMutexGuard& i_instanceLock );
+ void reset( IMutexGuard& i_instanceLock );
+ void addUndoManagerListener( const css::uno::Reference< css::document::XUndoManagerListener >& i_listener );
+ void removeUndoManagerListener( const css::uno::Reference< css::document::XUndoManagerListener >& i_listener );
+
+ // XLockable, base of XUndoManager, equivalents
+ void lock();
+ void unlock();
+ bool isLocked();
+
+ // XModifyBroadcaster equivalents
+ void addModifyListener( const css::uno::Reference< css::util::XModifyListener >& i_listener );
+ void removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& i_listener );
+
+ private:
+ std::unique_ptr< UndoManagerHelper_Impl > m_xImpl;
+ };
+
+
+} // namespace framework
+
+
+#endif // INCLUDED_FRAMEWORK_UNDOMANAGERHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/helpcompiler/HelpIndexer.hxx b/include/helpcompiler/HelpIndexer.hxx
new file mode 100644
index 000000000..2f8e7f322
--- /dev/null
+++ b/include/helpcompiler/HelpIndexer.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_HELPCOMPILER_HELPINDEXER_HXX
+#define INCLUDED_HELPCOMPILER_HELPINDEXER_HXX
+
+#include <helpcompiler/dllapi.h>
+
+#include <rtl/ustring.hxx>
+#include <set>
+#include <string_view>
+
+// I assume that TCHAR is defined as wchar_t throughout
+
+namespace lucene
+{
+namespace document
+{
+class Document;
+}
+namespace util
+{
+class Reader;
+}
+}
+
+class L10N_DLLPUBLIC HelpIndexer {
+ private:
+ OUString d_lang;
+ OUString d_module;
+ OUString d_captionDir;
+ OUString d_contentDir;
+ OUString d_indexDir;
+ OUString d_error;
+ std::set<OUString> d_files;
+
+ public:
+
+ /**
+ * @param lang Help files language.
+ * @param module The module of the helpfiles.
+ * @param srcDir The help directory to index
+ * @param outDir The directory to write the "module".idxl directory to
+ */
+ HelpIndexer(OUString const &lang, OUString const &module,
+ std::u16string_view srcDir, std::u16string_view outDir);
+
+ /**
+ * Run the indexer.
+ * @return true if index successfully generated.
+ */
+ bool indexDocuments();
+
+ /**
+ * Get the error string (empty if no error occurred).
+ */
+ OUString const & getErrorMessage() const { return d_error;}
+
+ private:
+
+ /**
+ * Scan the caption & contents directories for help files.
+ */
+ bool scanForFiles();
+
+ /**
+ * Scan for files in the given directory.
+ */
+ bool scanForFiles(OUString const &path);
+
+ /**
+ * Fill the Document with information on the given help file.
+ */
+ void helpDocument(OUString const & fileName, lucene::document::Document *doc) const;
+
+ /**
+ * Create a reader for the given file, and create an "empty" reader in case the file doesn't exist.
+ */
+ static lucene::util::Reader *helpFileReader(OUString const & path);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/helpcompiler/HelpSearch.hxx b/include/helpcompiler/HelpSearch.hxx
new file mode 100644
index 000000000..074373c43
--- /dev/null
+++ b/include/helpcompiler/HelpSearch.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_HELPCOMPILER_HELPSEARCH_HXX
+#define INCLUDED_HELPCOMPILER_HELPSEARCH_HXX
+
+#include <helpcompiler/dllapi.h>
+
+#include <rtl/ustring.hxx>
+#include <vector>
+
+class L10N_DLLPUBLIC HelpSearch{
+ private:
+ OString d_indexDir;
+
+ public:
+
+ /**
+ * @param indexDir The directory where the index files are stored.
+ */
+ HelpSearch(OUString const &indexDir);
+
+ /**
+ * Query the index for a certain query string.
+ * @param queryStr The query.
+ * @param captionOnly Set to true to search in the caption, not the content.
+ * @param rDocuments Vector to write the paths of the found documents.
+ * @param rScores Vector to write the scores to.
+ */
+ void query(OUString const &queryStr, bool captionOnly,
+ std::vector<OUString> &rDocuments, std::vector<float> &rScores);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/helpcompiler/compilehelp.hxx b/include/helpcompiler/compilehelp.hxx
new file mode 100644
index 000000000..8944257bd
--- /dev/null
+++ b/include/helpcompiler/compilehelp.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_HELPCOMPILER_COMPILEHELP_HXX
+#define INCLUDED_HELPCOMPILER_COMPILEHELP_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <sal/types.h>
+
+#if defined(HELPLINKER_DLLIMPLEMENTATION)
+#define HELPLINKER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define HELPLINKER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define HELPLINKER_DLLPRIVATE SAL_DLLPRIVATE
+
+#include <rtl/ustring.hxx>
+
+enum class HelpProcessingErrorClass
+{
+ NONE,
+ General, // Missing files, options etc.
+ XmlParsing // Errors thrown by libxml
+};
+
+struct HelpProcessingErrorInfo
+{
+ HelpProcessingErrorClass m_eErrorClass;
+ OUString m_aErrorMsg;
+ OUString m_aXMLParsingFile;
+ sal_Int32 m_nXMLParsingLine;
+
+ HelpProcessingErrorInfo()
+ : m_eErrorClass( HelpProcessingErrorClass::NONE )
+ , m_nXMLParsingLine( -1 )
+ {}
+
+ HelpProcessingErrorInfo& operator=( const struct HelpProcessingException& e );
+};
+
+
+// Returns true in case of success, false in case of error
+HELPLINKER_DLLPUBLIC bool compileExtensionHelp
+(
+ const OUString& aOfficeHelpPath,
+ std::u16string_view aExtensionName,
+ std::u16string_view aExtensionLanguageRoot,
+ sal_Int32 nXhpFileCount, const OUString* pXhpFiles,
+ std::u16string_view aDestination,
+ HelpProcessingErrorInfo& o_rHelpProcessingErrorInfo
+);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/helpcompiler/dllapi.h b/include/helpcompiler/dllapi.h
new file mode 100644
index 000000000..e0a115d05
--- /dev/null
+++ b/include/helpcompiler/dllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_HELPCOMPILER_DLLAPI_H
+#define INCLUDED_HELPCOMPILER_DLLAPI_H
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined L10N_DLLIMPLEMENTATION
+#define L10N_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define L10N_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/applelangid.hxx b/include/i18nlangtag/applelangid.hxx
new file mode 100644
index 000000000..0733d9207
--- /dev/null
+++ b/include/i18nlangtag/applelangid.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+//as seen at http://www.microsoft.com/typography/otspec/name.htm
+
+#ifndef INCLUDED_I18NLANGTAG_APPLELANGID_H
+#define INCLUDED_I18NLANGTAG_APPLELANGID_H
+
+#include <i18nlangtag/languagetag.hxx>
+
+enum class AppleLanguageId : unsigned short
+{
+ ENGLISH =0,
+ FRENCH =1,
+ GERMAN =2,
+ ITALIAN =3,
+ DUTCH =4,
+ SWEDISH =5,
+ SPANISH =6,
+ DANISH =7,
+ PORTUGUESE =8,
+ NORWEGIAN =9,
+ HEBREW =10,
+ JAPANESE =11,
+ ARABIC =12,
+ FINNISH =13,
+ GREEK =14,
+ ICELANDIC =15,
+ MALTESE =16,
+ TURKISH =17,
+ CROATIAN =18,
+ CHINESE_TRADITIONAL =19,
+ URDU =20,
+ HINDI =21,
+ THAI =22,
+ KOREAN =23,
+ LITHUANIAN =24,
+ POLISH =25,
+ HUNGARIAN =26,
+ ESTONIAN =27,
+ LATVIAN =28,
+ SAMI =29,
+ FAROESE =30,
+ FARSI =31,
+ RUSSIAN =32,
+ CHINESE_SIMPLIFIED =33,
+ FLEMISH =34,
+ IRISH_GAELIC =35,
+ ALBANIAN =36,
+ ROMANIAN =37,
+ CZECH =38,
+ SLOVAK =39,
+ SLOVENIAN =40,
+ YIDDISH =41,
+ SERBIAN =42,
+ MACEDONIAN =43,
+ BULGARIAN =44,
+ UKRAINIAN =45,
+ BYELORUSSIAN =46,
+ UZBEK =47,
+ KAZAKH =48,
+ AZERI_CYRILLIC =49,
+ AZERI_ARABIC =50,
+ ARMENIAN =51,
+ GEORGIAN =52,
+ MOLDAVIAN =53,
+ KIRGHIZ =54,
+ TAJIKI =55,
+ TURKMEN =56,
+ MONGOLIAN_MONGOLIAN =57,
+ MONGOLIAN_CYRILLIC =58,
+ PASHTO =59,
+ KURDISH =60,
+ KASHMIRI =61,
+ SINDHI =62,
+ TIBETAN =63,
+ NEPALI =64,
+ SANSKRIT =65,
+ MARATHI =66,
+ BENGALI =67,
+ ASSAMESE =68,
+ GUJARATI =69,
+ PUNJABI =70,
+ ORIYA =71,
+ MALAYALAM =72,
+ KANNADA =73,
+ TAMIL =74,
+ TELUGU =75,
+ SINHALESE =76,
+ BURMESE =77,
+ KHMER =78,
+ LAO =79,
+ VIETNAMESE =80,
+ INDONESIAN =81,
+ TAGALONG =82,
+ MALAY_LATIN =83,
+ MALAY_ARABIC =84,
+ AMHARIC =85,
+ TIGRINYA =86,
+ GALLA =87,
+ SOMALI =88,
+ SWAHILI =89,
+ KINYARWANDA =90,
+ RUNDI =91,
+ NYANJA =92,
+ MALAGASY =93,
+ ESPERANTO =94,
+ WELSH =128,
+ BASQUE =129,
+ CATALAN =130,
+ LATIN =131,
+ QUENCHUA =132,
+ GUARANI =133,
+ AYMARA =134,
+ TATAR =135,
+ UIGHUR =136,
+ DZONGKHA =137,
+ JAVANESE_LATIN =138,
+ SUNDANESE_LATIN =139,
+ GALICIAN =140,
+ AFRIKAANS =141,
+ BRETON =142,
+ INUKTITUT =143,
+ SCOTTISH_GAELIC =144,
+ MANX_GAELIC =145,
+ IRISH_GAELIC_WITH_DOT_ABOVE =146,
+ TONGAN =147,
+ GREEK_POLYTONIC =148,
+ GREENLANDIC =149,
+ AZERI_LATIN =150,
+};
+
+/** Init LanguageTag with Apple LanguageId */
+I18NLANGTAG_DLLPUBLIC LanguageTag makeLanguageTagFromAppleLanguageId(AppleLanguageId nLanguage);
+
+
+#endif /* INCLUDED_I18NLANGTAG_APPLELANGID_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/i18nlangtagdllapi.h b/include/i18nlangtag/i18nlangtagdllapi.h
new file mode 100644
index 000000000..4222c0e95
--- /dev/null
+++ b/include/i18nlangtag/i18nlangtagdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_I18NLANGTAGDLLAPI_H
+#define INCLUDED_I18NLANGTAG_I18NLANGTAGDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(I18NLANGTAG_DLLIMPLEMENTATION)
+#define I18NLANGTAG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define I18NLANGTAG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define I18NLANGTAG_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_I18NLANGTAG_I18NLANGTAGDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/lang.h b/include/i18nlangtag/lang.h
new file mode 100644
index 000000000..0e4c6d23a
--- /dev/null
+++ b/include/i18nlangtag/lang.h
@@ -0,0 +1,803 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_LANG_H
+#define INCLUDED_I18NLANGTAG_LANG_H
+
+/**
+ These are MS LANGIDs, the lower 10 bits (mask 0x03ff, values below 0x0400
+ aren't real locale IDs) represent the primary language ID, the upper 6 bits
+ represent the sublanguage ID, which in most cases together with the primary
+ language simply designates a country. A LANGID is constructed by
+ UINT16 nLangID = ((((UINT16)(SubLangId)) << 10) | (UINT16)(PriLangId));
+
+ A user-defined primary language ID is a value in the range 0x0200 to 0x03ff.
+ All other values are reserved for Windows system use.
+
+ A user-defined sublanguage identifier is a value in the range 0x20 to 0x3f.
+ All other values are reserved for Windows system use.
+ If there is no sublanguage ID for a primary language ID, use SUBLANG_DEFAULT
+ (0x01, which shifted to the left by 10 bits results in the frequently seen
+ 0x0400). OR'ed with a 0x0200 primary results in 0x0600.
+
+ Values added as of 2006-04-18, a helper script: ../../source/isolang/lcid.awk
+ Utility to compare MS-LANGID definitions with those defined in this file.
+
+ For further information about MS-LANGIDs please see include/winnt.h of a
+ recent MSDEV version and the following web pages.
+
+
+ The once complete list, not necessarily supported by Windows:
+ List of Locale ID (LCID) Values as Assigned by Microsoft
+ http://www.microsoft.com/globaldev/reference/lcid-all.mspx
+
+ As a complete list is never complete, some more that came with WinXP SP2:
+ Windows XP/Server 2003 - List of Locale IDs, Input Locale, and Language Collection
+ http://www.microsoft.com/globaldev/reference/winxp/xp-lcid.mspx
+
+ And of course 2 lists aren't enough, so Windows Vista needs an extra one.
+ Which at least seems to include values of other versions of Windows.
+ Language Identifier Constants and Strings
+ http://msdn.microsoft.com/en-us/library/ms776294.aspx
+
+ ! Hey, yet another list, maybe this one will not move around? It seems to be
+ ! quite complete...
+ ! Language Identifier Constants and Strings (Windows)
+ ! http://msdn.microsoft.com/en-us/library/dd318693.aspx
+ !
+ ! Use THAT ^^^ as of 2013-09-17 it includes also Windows 8
+
+ ! BUT, you can download a PDF document from
+ ! http://msdn.microsoft.com/library/cc233965.aspx
+ ! that has YET MORE definitions, sigh... didn't cross-check if any are missing
+ ! from that... however, it also contains a few MS-reserved definitions that use
+ ! ISO 639-3 codes reserved for local use, such as 'qps-ploc' and 'qps-ploca'
+ ! (sic!), or strange things like 'ar-Ploc-SA' and 'ja-Ploc-JP' ('Ploc'??).
+ !
+ ! Use THAT ^^^ as the ultimate reference source (haha?) as of 2013-10-17 it
+ ! includes also Windows 8.1 (Release: Monday, July 22, 2013; well, its table
+ ! says 08/08/2013 Revision 6.0, but hey, who cares...)
+
+ For completeness, you can never have enough lists:
+ List of supported locale identifiers in Word
+ Applies to Microsoft Word 2000 and 2002
+ http://support.microsoft.com/default.aspx?scid=KB;en-us;q221435
+ */
+
+#include <sal/types.h>
+#include <o3tl/strong_int.hxx>
+#include <ostream>
+
+typedef o3tl::strong_int<sal_uInt16, struct LanguageTypeTag> LanguageType;
+inline std::ostream& operator<<(std::ostream& os, LanguageType const & lt) { os << sal_uInt16(lt); return os; }
+constexpr LanguageType primary(LanguageType lt) { return LanguageType(sal_uInt16(lt) & 0x03ff); }
+
+namespace o3tl
+{
+ // delete "sal_Int16" constructor via specialization: values > 0x7FFF are
+ // actually used, and unfortunately passed around in the API as signed
+ // "short", so use this to find all places where casts must be inserted
+ template<> template<> constexpr strong_int<unsigned short,LanguageTypeTag>::strong_int(short, std::enable_if<std::is_integral<short>::value, int>::type) = delete;
+}
+
+#define LANGUAGE_MASK_PRIMARY 0x03ff
+
+#define LANGUAGE_DONTKNOW LanguageType(0x03FF) /* yes, the mask */
+#define LANGUAGE_NONE LanguageType(0x00FF)
+#define LANGUAGE_HID_HUMAN_INTERFACE_DEVICE LanguageType(0x04FF)
+#define LANGUAGE_SYSTEM LanguageType(0x0000) /* OOo/SO definition */
+
+/* The Invariant Locale (Locale ID = 0x007f) is a locale that can be used by
+ * applications when a consistent and locale-independent result is required.
+ * The invariant locale can be used, for example, when comparing character
+ * strings using the CompareString() API and a consistent result regardless of
+ * the User Locale is expected.
+ * The settings of the Invariant Locale are similar to US-English international
+ * standards, but should not be used to display formatted data. */
+/* NOTE: this is taken from the MS documentation! Not supported by OOo/SO! */
+#define LANGUAGE_INVARIANT LanguageType(0x007F)
+
+/* Naming conventions:
+ * * ..._LSO suffix indicates a Language-Script-Only mapping, i.e. no country
+ * assignment in i18nlangtag/source/isolang/isolang.cxx.
+ * Used for backward compatibility or where MS assigned such values and they
+ * should be explicitly handled.
+ * * LANGUAGE_USER_... for our user-defined IDs.
+ * * LANGUAGE_OBSOLETE_USER_... for a user-defined ID that has been replaced by
+ * a value defined by MS.
+ */
+
+#define LANGUAGE_AFRIKAANS LanguageType(0x0436)
+#define LANGUAGE_ALBANIAN LanguageType(0x041C)
+#define LANGUAGE_ALSATIAN_FRANCE LanguageType(0x0484)
+#define LANGUAGE_AMHARIC_ETHIOPIA LanguageType(0x045E)
+#define LANGUAGE_ARABIC_ALGERIA LanguageType(0x1401)
+#define LANGUAGE_ARABIC_BAHRAIN LanguageType(0x3C01)
+#define LANGUAGE_ARABIC_EGYPT LanguageType(0x0C01)
+#define LANGUAGE_ARABIC_IRAQ LanguageType(0x0801)
+#define LANGUAGE_ARABIC_JORDAN LanguageType(0x2C01)
+#define LANGUAGE_ARABIC_KUWAIT LanguageType(0x3401)
+#define LANGUAGE_ARABIC_LEBANON LanguageType(0x3001)
+#define LANGUAGE_ARABIC_LIBYA LanguageType(0x1001)
+#define LANGUAGE_ARABIC_MOROCCO LanguageType(0x1801)
+#define LANGUAGE_ARABIC_OMAN LanguageType(0x2001)
+#define LANGUAGE_ARABIC_PRIMARY_ONLY LanguageType(0x0001) /* primary only, not a locale! */
+#define LANGUAGE_ARABIC_QATAR LanguageType(0x4001)
+#define LANGUAGE_ARABIC_SAUDI_ARABIA LanguageType(0x0401)
+#define LANGUAGE_ARABIC_SYRIA LanguageType(0x2801)
+#define LANGUAGE_ARABIC_TUNISIA LanguageType(0x1C01)
+#define LANGUAGE_ARABIC_UAE LanguageType(0x3801)
+#define LANGUAGE_ARABIC_YEMEN LanguageType(0x2401)
+#define LANGUAGE_ARMENIAN LanguageType(0x042B) /* Eastern Armenian */
+#define LANGUAGE_ASSAMESE LanguageType(0x044D)
+#define LANGUAGE_AZERI_CYRILLIC LanguageType(0x082C)
+#define LANGUAGE_AZERI_CYRILLIC_LSO LanguageType(0x742C)
+#define LANGUAGE_AZERI_LATIN LanguageType(0x042C)
+#define LANGUAGE_AZERI_LATIN_LSO LanguageType(0x782C)
+#define LANGUAGE_BASHKIR_RUSSIA LanguageType(0x046D)
+#define LANGUAGE_BASQUE LanguageType(0x042D)
+#define LANGUAGE_BELARUSIAN LanguageType(0x0423)
+#define LANGUAGE_BENGALI LanguageType(0x0445) /* in India */
+#define LANGUAGE_BENGALI_BANGLADESH LanguageType(0x0845)
+#define LANGUAGE_BOSNIAN_CYRILLIC_LSO LanguageType(0x641A)
+#define LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA LanguageType(0x201A)
+#define LANGUAGE_BOSNIAN_LATIN_LSO LanguageType(0x681A)
+#define LANGUAGE_BOSNIAN_LSO LanguageType(0x781A)
+#define LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA LanguageType(0x141A)
+#define LANGUAGE_BOSNIAN_BOSNIA_HERZEGOVINA LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA /* TODO: remove, only for langtab.src & localize.sdf compatibility */
+#define LANGUAGE_BRETON_FRANCE LanguageType(0x047E) /* obsoletes LANGUAGE_USER_BRETON 0x0629 */
+#define LANGUAGE_BULGARIAN LanguageType(0x0402)
+#define LANGUAGE_BURMESE LanguageType(0x0455)
+#define LANGUAGE_CATALAN LanguageType(0x0403)
+#define LANGUAGE_CATALAN_VALENCIAN LanguageType(0x0803) /* obsoletes LANGUAGE_USER_CATALAN_VALENCIAN 0x8003 */
+#define LANGUAGE_CHEROKEE_UNITED_STATES LanguageType(0x045C)
+#define LANGUAGE_CHEROKEE_CHEROKEE_LSO LanguageType(0x7C5C)
+#define LANGUAGE_CHINESE_HONGKONG LanguageType(0x0C04)
+#define LANGUAGE_CHINESE_LSO LanguageType(0x7804)
+#define LANGUAGE_CHINESE_MACAU LanguageType(0x1404)
+#define LANGUAGE_CHINESE_SIMPLIFIED LanguageType(0x0804)
+#define LANGUAGE_CHINESE_SINGAPORE LanguageType(0x1004)
+#define LANGUAGE_CHINESE_TRADITIONAL LanguageType(0x0404)
+#define LANGUAGE_CHINESE_SIMPLIFIED_LEGACY LanguageType(0x0004) /* MS-.NET 'zh-CHS', primary only! but maps to 'zh-CN' */
+#define LANGUAGE_CHINESE_TRADITIONAL_LSO LanguageType(0x7C04) /* MS-.NET 'zh-CHT' but maps to 'zh-Hant' */
+#define LANGUAGE_CHINESE LANGUAGE_CHINESE_SIMPLIFIED /* most code uses LANGUAGE_CHINESE */
+#define LANGUAGE_CORSICAN_FRANCE LanguageType(0x0483)
+#define LANGUAGE_CROATIAN LanguageType(0x041A)
+#define LANGUAGE_CROATIAN_BOSNIA_HERZEGOVINA LanguageType(0x101A)
+#define LANGUAGE_CZECH LanguageType(0x0405)
+#define LANGUAGE_DANISH LanguageType(0x0406)
+#define LANGUAGE_DARI_AFGHANISTAN LanguageType(0x048C) /* AKA Zoroastrian Dari */
+#define LANGUAGE_DHIVEHI LanguageType(0x0465) /* AKA Divehi */
+#define LANGUAGE_DUTCH LanguageType(0x0413)
+#define LANGUAGE_DUTCH_BELGIAN LanguageType(0x0813)
+#define LANGUAGE_EDO LanguageType(0x0466)
+#define LANGUAGE_ENGLISH LanguageType(0x0009) /* primary only, not a locale! */
+#define LANGUAGE_ENGLISH_ARAB_EMIRATES LanguageType(0x4C09)
+#define LANGUAGE_ENGLISH_AUS LanguageType(0x0C09)
+#define LANGUAGE_ENGLISH_BAHRAIN LanguageType(0x5009)
+#define LANGUAGE_ENGLISH_BELIZE LanguageType(0x2809)
+#define LANGUAGE_ENGLISH_CAN LanguageType(0x1009)
+#define LANGUAGE_ENGLISH_CARIBBEAN LanguageType(0x2409) /* MS reserved since rev.15, "en-029" */
+#define LANGUAGE_ENGLISH_EGYPT LanguageType(0x5409)
+#define LANGUAGE_ENGLISH_EIRE LanguageType(0x1809)
+#define LANGUAGE_ENGLISH_HONG_KONG_SAR LanguageType(0x3C09)
+#define LANGUAGE_ENGLISH_INDIA LanguageType(0x4009)
+#define LANGUAGE_ENGLISH_INDONESIA LanguageType(0x3809)
+#define LANGUAGE_ENGLISH_JAMAICA LanguageType(0x2009)
+#define LANGUAGE_ENGLISH_JORDAN LanguageType(0x5809)
+#define LANGUAGE_ENGLISH_KUWAIT LanguageType(0x5C09)
+#define LANGUAGE_ENGLISH_MALAYSIA LanguageType(0x4409)
+#define LANGUAGE_ENGLISH_NZ LanguageType(0x1409)
+#define LANGUAGE_ENGLISH_PHILIPPINES LanguageType(0x3409)
+#define LANGUAGE_ENGLISH_SAFRICA LanguageType(0x1C09)
+#define LANGUAGE_ENGLISH_SINGAPORE LanguageType(0x4809)
+#define LANGUAGE_ENGLISH_TRINIDAD LanguageType(0x2C09)
+#define LANGUAGE_ENGLISH_TURKEY LanguageType(0x6009)
+#define LANGUAGE_ENGLISH_UK LanguageType(0x0809)
+#define LANGUAGE_ENGLISH_US LanguageType(0x0409)
+#define LANGUAGE_ENGLISH_YEMEN LanguageType(0x6409)
+#define LANGUAGE_ENGLISH_ZIMBABWE LanguageType(0x3009)
+#define LANGUAGE_ESTONIAN LanguageType(0x0425)
+#define LANGUAGE_FAEROESE LanguageType(0x0438)
+#define LANGUAGE_FARSI LanguageType(0x0429)
+#define LANGUAGE_FILIPINO LanguageType(0x0464)
+#define LANGUAGE_FINNISH LanguageType(0x040B)
+#define LANGUAGE_FRENCH LanguageType(0x040C)
+#define LANGUAGE_FRENCH_BELGIAN LanguageType(0x080C)
+#define LANGUAGE_FRENCH_CAMEROON LanguageType(0x2C0C)
+#define LANGUAGE_FRENCH_CANADIAN LanguageType(0x0C0C)
+#define LANGUAGE_FRENCH_COTE_D_IVOIRE LanguageType(0x300C)
+
+#define LANGUAGE_FRENCH_HAITI LanguageType(0x3C0C)
+#define LANGUAGE_FRENCH_LUXEMBOURG LanguageType(0x140C)
+#define LANGUAGE_FRENCH_MALI LanguageType(0x340C)
+#define LANGUAGE_FRENCH_MONACO LanguageType(0x180C)
+#define LANGUAGE_FRENCH_MOROCCO LanguageType(0x380C)
+#define LANGUAGE_FRENCH_NORTH_AFRICA LanguageType(0xE40C) /* MS reserved, "fr-015", "015"="Northern Africa" */
+#define LANGUAGE_FRENCH_REUNION LanguageType(0x200C)
+#define LANGUAGE_FRENCH_SENEGAL LanguageType(0x280C)
+#define LANGUAGE_FRENCH_SWISS LanguageType(0x100C)
+#define LANGUAGE_FRENCH_WEST_INDIES LanguageType(0x1C0C) /* MS-LCID.pdf in between said "Neither defined nor reserved" but since rev.15 it's "fr-029" */
+#define LANGUAGE_FRENCH_ZAIRE LanguageType(0x240C)
+#define LANGUAGE_FRISIAN_NETHERLANDS LanguageType(0x0462)
+#define LANGUAGE_FULFULDE_LATIN_LSO LanguageType(0x7C67)
+#define LANGUAGE_FULFULDE_NIGERIA LanguageType(0x0467)
+#define LANGUAGE_FULFULDE_SENEGAL LanguageType(0x0867)
+#define LANGUAGE_GAELIC_IRELAND LanguageType(0x083C)
+#define LANGUAGE_GAELIC_SCOTLAND LanguageType(0x0491) /* apparently it occurred to MS that those are different languages */
+#define LANGUAGE_GAELIC_SCOTLAND_LEGACY LanguageType(0x043C)
+#define LANGUAGE_GALICIAN LanguageType(0x0456)
+#define LANGUAGE_GEORGIAN LanguageType(0x0437)
+#define LANGUAGE_GERMAN LanguageType(0x0407)
+#define LANGUAGE_GERMAN_AUSTRIAN LanguageType(0x0C07)
+#define LANGUAGE_GERMAN_LIECHTENSTEIN LanguageType(0x1407)
+#define LANGUAGE_GERMAN_LUXEMBOURG LanguageType(0x1007)
+#define LANGUAGE_GERMAN_SWISS LanguageType(0x0807)
+#define LANGUAGE_GREEK LanguageType(0x0408)
+#define LANGUAGE_GUARANI_PARAGUAY LanguageType(0x0474)
+#define LANGUAGE_GUJARATI LanguageType(0x0447)
+#define LANGUAGE_HAUSA_LATIN_LSO LanguageType(0x7C68)
+#define LANGUAGE_HAUSA_NIGERIA LanguageType(0x0468)
+#define LANGUAGE_HAWAIIAN_UNITED_STATES LanguageType(0x0475)
+#define LANGUAGE_HEBREW LanguageType(0x040D)
+#define LANGUAGE_HINDI LanguageType(0x0439)
+#define LANGUAGE_HUNGARIAN LanguageType(0x040E)
+#define LANGUAGE_IBIBIO_NIGERIA LanguageType(0x0469)
+#define LANGUAGE_ICELANDIC LanguageType(0x040F)
+#define LANGUAGE_IGBO_NIGERIA LanguageType(0x0470)
+#define LANGUAGE_INDONESIAN LanguageType(0x0421)
+#define LANGUAGE_INUKTITUT_SYLLABICS_CANADA LanguageType(0x045D)
+#define LANGUAGE_INUKTITUT_SYLLABICS_LSO LanguageType(0x785D)
+#define LANGUAGE_INUKTITUT_LATIN_CANADA LanguageType(0x085D)
+#define LANGUAGE_INUKTITUT_LATIN_LSO LanguageType(0x7C5D)
+#define LANGUAGE_ITALIAN LanguageType(0x0410)
+#define LANGUAGE_ITALIAN_SWISS LanguageType(0x0810)
+#define LANGUAGE_JAPANESE LanguageType(0x0411)
+#define LANGUAGE_KALAALLISUT_GREENLAND LanguageType(0x046F) /* obsoletes LANGUAGE_USER_KALAALLISUT 0x062A */
+#define LANGUAGE_KANNADA LanguageType(0x044B)
+#define LANGUAGE_KANURI_NIGERIA LanguageType(0x0471)
+#define LANGUAGE_KASHMIRI LanguageType(0x0460)
+#define LANGUAGE_KASHMIRI_INDIA LanguageType(0x0860)
+#define LANGUAGE_KAZAKH LanguageType(0x043F)
+#define LANGUAGE_KAZAKH_LATIN LanguageType(0x083F)
+#define LANGUAGE_KAZAKH_CYRILLIC_LSO LanguageType(0x783F)
+#define LANGUAGE_KAZAKH_LATIN_LSO LanguageType(0x7C3F)
+#define LANGUAGE_KHMER LanguageType(0x0453)
+#define LANGUAGE_KICHE_GUATEMALA LanguageType(0x0486) /* AKA K'iche', West Central Quiche */
+#define LANGUAGE_KINYARWANDA_RWANDA LanguageType(0x0487) /* obsoletes LANGUAGE_USER_KINYARWANDA 0x0621 */
+#define LANGUAGE_KIRGHIZ LanguageType(0x0440) /* AKA Kyrgyz */
+#define LANGUAGE_KONKANI LanguageType(0x0457)
+#define LANGUAGE_KOREAN LanguageType(0x0412)
+#define LANGUAGE_KOREAN_JOHAB LanguageType(0x0812) /* not mentioned in MS-LCID.pdf, oh joy */
+#define LANGUAGE_KURDISH_ARABIC_IRAQ LanguageType(0x0492) /* obsoletes LANGUAGE_USER_KURDISH_IRAQ 0x0E26 */
+#define LANGUAGE_KURDISH_ARABIC_LSO LanguageType(0x7C92)
+#define LANGUAGE_LAO LanguageType(0x0454)
+#define LANGUAGE_LATIN LanguageType(0x0476) /* obsoletes LANGUAGE_USER_LATIN 0x0610 and LANGUAGE_USER_LATIN_VATICAN 0x8076 */
+#define LANGUAGE_LATVIAN LanguageType(0x0426)
+#define LANGUAGE_LITHUANIAN LanguageType(0x0427)
+#define LANGUAGE_LITHUANIAN_CLASSIC LanguageType(0x0827) /* MS in its MS-LCID.pdf now says "Neither defined nor reserved" */
+#define LANGUAGE_LU_CHINA LanguageType(0x0490)
+#define LANGUAGE_LUXEMBOURGISH_LUXEMBOURG LanguageType(0x046E) /* obsoletes LANGUAGE_USER_LUXEMBOURGISH 0x0630 */
+#define LANGUAGE_MACEDONIAN LanguageType(0x042F)
+#define LANGUAGE_MALAGASY_PLATEAU LanguageType(0x048D) /* obsoletes LANGUAGE_OBSOLETE_USER_MALAGASY_PLATEAU */
+#define LANGUAGE_MALAYALAM LanguageType(0x044C) /* in India */
+#define LANGUAGE_MALAY_BRUNEI_DARUSSALAM LanguageType(0x083E)
+#define LANGUAGE_MALAY_MALAYSIA LanguageType(0x043E)
+#define LANGUAGE_MALTESE LanguageType(0x043A)
+#define LANGUAGE_MANIPURI LanguageType(0x0458)
+#define LANGUAGE_MAORI_NEW_ZEALAND LanguageType(0x0481) /* obsoletes LANGUAGE_USER_MAORI 0x0620 */
+#define LANGUAGE_MAPUDUNGUN_CHILE LanguageType(0x047A) /* AKA Araucanian */
+#define LANGUAGE_MARATHI LanguageType(0x044E)
+#define LANGUAGE_MOHAWK_CANADA LanguageType(0x047C)
+#define LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA LanguageType(0x0450)
+#define LANGUAGE_MONGOLIAN_CYRILLIC_LSO LanguageType(0x7850)
+#define LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA LanguageType(0x0C50)
+#define LANGUAGE_MONGOLIAN_MONGOLIAN_CHINA LanguageType(0x0850)
+#define LANGUAGE_MONGOLIAN_MONGOLIAN_LSO LanguageType(0x7C50)
+#define LANGUAGE_NEPALI LanguageType(0x0461)
+#define LANGUAGE_NEPALI_INDIA LanguageType(0x0861)
+#define LANGUAGE_NORWEGIAN LanguageType(0x0014) /* primary only, not a locale! */
+#define LANGUAGE_NORWEGIAN_BOKMAL LanguageType(0x0414)
+#define LANGUAGE_NORWEGIAN_BOKMAL_LSO LanguageType(0x7C14)
+#define LANGUAGE_NORWEGIAN_NYNORSK LanguageType(0x0814)
+#define LANGUAGE_NORWEGIAN_NYNORSK_LSO LanguageType(0x7814)
+#define LANGUAGE_OCCITAN_FRANCE LanguageType(0x0482) /* obsoletes LANGUAGE_USER_OCCITAN 0x0625 */
+#define LANGUAGE_ODIA LanguageType(0x0448)
+#define LANGUAGE_OROMO LanguageType(0x0472)
+#define LANGUAGE_PAPIAMENTU LanguageType(0x0479)
+#define LANGUAGE_PASHTO LanguageType(0x0463)
+#define LANGUAGE_POLISH LanguageType(0x0415)
+#define LANGUAGE_PORTUGUESE LanguageType(0x0816)
+#define LANGUAGE_PORTUGUESE_BRAZILIAN LanguageType(0x0416)
+#define LANGUAGE_PUNJABI LanguageType(0x0446)
+#define LANGUAGE_PUNJABI_ARABIC_LSO LanguageType(0x7C46)
+#define LANGUAGE_PUNJABI_PAKISTAN LanguageType(0x0846)
+#define LANGUAGE_QUECHUA_BOLIVIA LanguageType(0x046B)
+#define LANGUAGE_QUECHUA_COLOMBIA LanguageType(0x0493) /* different primary ID */
+#define LANGUAGE_QUECHUA_ECUADOR LanguageType(0x086B)
+#define LANGUAGE_QUECHUA_PERU LanguageType(0x0C6B)
+#define LANGUAGE_RHAETO_ROMAN LanguageType(0x0417)
+#define LANGUAGE_ROMANIAN LanguageType(0x0418)
+#define LANGUAGE_ROMANIAN_MOLDOVA LanguageType(0x0818)
+#define LANGUAGE_RUSSIAN LanguageType(0x0419)
+#define LANGUAGE_RUSSIAN_MOLDOVA LanguageType(0x0819)
+#define LANGUAGE_SAMI_NORTHERN_NORWAY LanguageType(0x043B)
+#define LANGUAGE_SAMI_LAPPISH LANGUAGE_SAMI_NORTHERN_NORWAY /* the old MS definition */
+#define LANGUAGE_SAMI_INARI LanguageType(0x243B)
+#define LANGUAGE_SAMI_INARI_LSO LanguageType(0x703B)
+#define LANGUAGE_SAMI_LULE_LSO LanguageType(0x7C3B)
+#define LANGUAGE_SAMI_LULE_NORWAY LanguageType(0x103B)
+#define LANGUAGE_SAMI_LULE_SWEDEN LanguageType(0x143B)
+#define LANGUAGE_SAMI_NORTHERN_FINLAND LanguageType(0x0C3B)
+#define LANGUAGE_SAMI_NORTHERN_SWEDEN LanguageType(0x083B)
+#define LANGUAGE_SAMI_SKOLT LanguageType(0x203B)
+#define LANGUAGE_SAMI_SKOLT_LSO LanguageType(0x743B)
+#define LANGUAGE_SAMI_SOUTHERN_LSO LanguageType(0x783B)
+#define LANGUAGE_SAMI_SOUTHERN_NORWAY LanguageType(0x183B)
+#define LANGUAGE_SAMI_SOUTHERN_SWEDEN LanguageType(0x1C3B)
+#define LANGUAGE_SANSKRIT LanguageType(0x044F)
+#define LANGUAGE_SEPEDI LanguageType(0x046C)
+#define LANGUAGE_NORTHERNSOTHO LANGUAGE_SEPEDI /* just an alias for the already existing localization */
+#define LANGUAGE_SERBIAN_CYRILLIC_LSO LanguageType(0x6C1A)
+#define LANGUAGE_SERBIAN_CYRILLIC_SAM LanguageType(0x0C1A) /* Serbia and Montenegro (former) */
+#define LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA LanguageType(0x1C1A)
+#define LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO LanguageType(0x301A)
+#define LANGUAGE_SERBIAN_CYRILLIC_SERBIA LanguageType(0x281A)
+#define LANGUAGE_SERBIAN_LATIN_LSO LanguageType(0x701A)
+#define LANGUAGE_SERBIAN_LATIN_SAM LanguageType(0x081A)
+#define LANGUAGE_SERBIAN_LATIN_BOSNIA_HERZEGOVINA LanguageType(0x181A)
+#define LANGUAGE_SERBIAN_LATIN_MONTENEGRO LanguageType(0x2C1A)
+#define LANGUAGE_SERBIAN_LATIN_NEUTRAL LanguageType(0x7C1A)
+#define LANGUAGE_SERBIAN_LATIN_SERBIA LanguageType(0x241A)
+#define LANGUAGE_SESOTHO LanguageType(0x0430) /* also called Sutu now by MS */
+#define LANGUAGE_SINDHI LanguageType(0x0459)
+#define LANGUAGE_SINDHI_ARABIC_LSO LanguageType(0x7C59)
+#define LANGUAGE_SINDHI_PAKISTAN LanguageType(0x0859)
+#define LANGUAGE_SINHALESE_SRI_LANKA LanguageType(0x045B)
+#define LANGUAGE_SLOVAK LanguageType(0x041B)
+#define LANGUAGE_SLOVENIAN LanguageType(0x0424)
+#define LANGUAGE_SOMALI LanguageType(0x0477)
+#define LANGUAGE_UPPER_SORBIAN_GERMANY LanguageType(0x042E) /* obsoletes LANGUAGE_USER_UPPER_SORBIAN 0x0623 */
+#define LANGUAGE_LOWER_SORBIAN_GERMANY LanguageType(0x082E) /* obsoletes LANGUAGE_USER_LOWER_SORBIAN 0x0624. NOTE: the primary ID is identical to Upper Sorbian, which is not quite correct because they're distinct languages */
+#define LANGUAGE_LOWER_SORBIAN_LSO LanguageType(0x7C2E)
+#define LANGUAGE_SORBIAN LANGUAGE_USER_UPPER_SORBIAN /* a strange MS definition */
+#define LANGUAGE_SPANISH_DATED LanguageType(0x040A) /* old collation, not supported, see #i94435# */
+#define LANGUAGE_SPANISH_ARGENTINA LanguageType(0x2C0A)
+#define LANGUAGE_SPANISH_BOLIVIA LanguageType(0x400A)
+#define LANGUAGE_SPANISH_CHILE LanguageType(0x340A)
+#define LANGUAGE_SPANISH_COLOMBIA LanguageType(0x240A)
+#define LANGUAGE_SPANISH_COSTARICA LanguageType(0x140A)
+#define LANGUAGE_SPANISH_CUBA LanguageType(0x5C0A)
+#define LANGUAGE_SPANISH_DOMINICAN_REPUBLIC LanguageType(0x1C0A)
+#define LANGUAGE_SPANISH_ECUADOR LanguageType(0x300A)
+#define LANGUAGE_SPANISH_EL_SALVADOR LanguageType(0x440A)
+#define LANGUAGE_SPANISH_GUATEMALA LanguageType(0x100A)
+#define LANGUAGE_SPANISH_HONDURAS LanguageType(0x480A)
+#define LANGUAGE_SPANISH_LATIN_AMERICA LanguageType(0xE40A) /* no locale possible */
+#define LANGUAGE_SPANISH_MEXICAN LanguageType(0x080A)
+#define LANGUAGE_SPANISH_MODERN LanguageType(0x0C0A)
+#define LANGUAGE_SPANISH_NICARAGUA LanguageType(0x4C0A)
+#define LANGUAGE_SPANISH_PANAMA LanguageType(0x180A)
+#define LANGUAGE_SPANISH_PARAGUAY LanguageType(0x3C0A)
+#define LANGUAGE_SPANISH_PERU LanguageType(0x280A)
+#define LANGUAGE_SPANISH_PUERTO_RICO LanguageType(0x500A)
+#define LANGUAGE_SPANISH_UNITED_STATES LanguageType(0x540A)
+#define LANGUAGE_SPANISH_URUGUAY LanguageType(0x380A)
+#define LANGUAGE_SPANISH_VENEZUELA LanguageType(0x200A)
+#define LANGUAGE_SPANISH LANGUAGE_SPANISH_MODERN /* modern collation, see #i94435# */
+#define LANGUAGE_SWAHILI LanguageType(0x0441) /* Kenya */
+#define LANGUAGE_SWEDISH LanguageType(0x041D)
+#define LANGUAGE_SWEDISH_FINLAND LanguageType(0x081D)
+#define LANGUAGE_SYRIAC LanguageType(0x045A)
+#define LANGUAGE_TAI_NUA_CHINA LanguageType(0x048F)
+#define LANGUAGE_TAJIK LanguageType(0x0428)
+#define LANGUAGE_TAJIK_LSO LanguageType(0x7C28)
+#define LANGUAGE_TAMAZIGHT_ARABIC_MOROCCO LanguageType(0x045F)
+#define LANGUAGE_TAMAZIGHT_LATIN_ALGERIA LanguageType(0x085F)
+#define LANGUAGE_TAMAZIGHT_LATIN_LSO LanguageType(0x7C5F)
+#define LANGUAGE_TAMAZIGHT_MOROCCO LanguageType(0x0C5F)
+#define LANGUAGE_TAMAZIGHT_TIFINAGH_MOROCCO LanguageType(0x105F)
+#define LANGUAGE_TAMAZIGHT_TIFINAGH_LSO LanguageType(0x785F)
+#define LANGUAGE_TAMIL LanguageType(0x0449)
+#define LANGUAGE_TAMIL_SRI_LANKA LanguageType(0x0849)
+#define LANGUAGE_TATAR LanguageType(0x0444)
+#define LANGUAGE_TELUGU LanguageType(0x044A)
+#define LANGUAGE_THAI LanguageType(0x041E)
+#define LANGUAGE_TIBETAN LanguageType(0x0451)
+#define LANGUAGE_TIBETAN_BHUTAN LanguageType(0x0851) /* was used as Dzongkha, a MS error, see #i53497# */
+#define LANGUAGE_DZONGKHA_BHUTAN LanguageType(0x0C51) /* they finally got it ... ([MS-LCID] rev. 7.0 2015-06-30) */
+#define LANGUAGE_TIGRIGNA_ERITREA LanguageType(0x0873)
+#define LANGUAGE_TIGRIGNA_ETHIOPIA LanguageType(0x0473)
+#define LANGUAGE_TSONGA LanguageType(0x0431)
+#define LANGUAGE_TSWANA LanguageType(0x0432) /* AKA Setsuana, for South Africa */
+#define LANGUAGE_TSWANA_BOTSWANA LanguageType(0x0832) /* obsoletes LANGUAGE_USER_TSWANA_BOTSWANA 0x8032 */
+#define LANGUAGE_TURKISH LanguageType(0x041F)
+#define LANGUAGE_TURKMEN LanguageType(0x0442)
+#define LANGUAGE_UIGHUR_CHINA LanguageType(0x0480)
+#define LANGUAGE_UKRAINIAN LanguageType(0x0422)
+#define LANGUAGE_URDU_INDIA LanguageType(0x0820)
+#define LANGUAGE_URDU_PAKISTAN LanguageType(0x0420)
+#define LANGUAGE_UZBEK_CYRILLIC LanguageType(0x0843)
+#define LANGUAGE_UZBEK_CYRILLIC_LSO LanguageType(0x7843)
+#define LANGUAGE_UZBEK_LATIN LanguageType(0x0443)
+#define LANGUAGE_UZBEK_LATIN_LSO LanguageType(0x7C43)
+#define LANGUAGE_VENDA LanguageType(0x0433)
+#define LANGUAGE_VIETNAMESE LanguageType(0x042A)
+#define LANGUAGE_WELSH LanguageType(0x0452)
+#define LANGUAGE_WOLOF_SENEGAL LanguageType(0x0488)
+#define LANGUAGE_XHOSA LanguageType(0x0434) /* AKA isiZhosa */
+#define LANGUAGE_YAKUT_RUSSIA LanguageType(0x0485)
+#define LANGUAGE_YI LanguageType(0x0478) /* Sichuan Yi */
+#define LANGUAGE_YIDDISH LanguageType(0x043D)
+#define LANGUAGE_YORUBA LanguageType(0x046A)
+#define LANGUAGE_YUE_CHINESE_HONGKONG LanguageType(0x048E)
+#define LANGUAGE_ZULU LanguageType(0x0435)
+
+#define LANGUAGE_qps_ploc LanguageType(0x0501) /* 'qps-ploc', qps is a reserved for local use code */
+#define LANGUAGE_qps_ploca LanguageType(0x05FE) /* 'qps-ploca', qps is a reserved for local use code */
+#define LANGUAGE_qps_plocm LanguageType(0x09FF) /* 'qps-plocm', qps is a reserved for local use code */
+
+#define LANGUAGE_ar_Ploc_SA_reserved LanguageType(0x4401) /* 'ar-Ploc-SA', 'Ploc'?? */
+#define LANGUAGE_ja_Ploc_JP_reserved LanguageType(0x0811) /* 'ja-Ploc-JP', 'Ploc'?? */
+#define LANGUAGE_pap_029_reserved LanguageType(0x0479) /* "pap-029", "029"="Caribbean" */
+#define LANGUAGE_ar_145_reserved LanguageType(0x4801) /* "ar-145", "145"="Western Asia" */
+#define LANGUAGE_es_419_reserved LanguageType(0x580A) /* MS reserved since rev.15, "es-419", "419"="Latin America and the Caribbean" */
+
+/* Seems these values were used or reserved at one point of time ... */
+#define LANGUAGE_Neither_defined_nor_reserved_0x007B LanguageType(0x007B)
+#define LANGUAGE_Neither_defined_nor_reserved_0x007D LanguageType(0x007D)
+#define LANGUAGE_Neither_defined_nor_reserved_0x0089 LanguageType(0x0089)
+#define LANGUAGE_Neither_defined_nor_reserved_0x008A LanguageType(0x008A)
+#define LANGUAGE_Neither_defined_nor_reserved_0x008B LanguageType(0x008B)
+#define LANGUAGE_Neither_defined_nor_reserved_0x008D LanguageType(0x008D)
+#define LANGUAGE_Neither_defined_nor_reserved_0x008E LanguageType(0x008E)
+#define LANGUAGE_Neither_defined_nor_reserved_0x008F LanguageType(0x008F)
+#define LANGUAGE_Neither_defined_nor_reserved_0x0090 LanguageType(0x0090)
+#define LANGUAGE_Neither_defined_nor_reserved_0x0827 LanguageType(0x0827)
+#define LANGUAGE_Neither_defined_nor_reserved_0x1C0C LanguageType(0x1C0C)
+#define LANGUAGE_Neither_defined_nor_reserved_0x2008 LanguageType(0x2008)
+
+/* MS defines these as reserved, whatever that might imply... */
+#define LANGUAGE_reserved_0xEEEE LanguageType(0xEEEE) /* primary 0x2ee, sub 0x3b */
+#define LANGUAGE_reserved_0xF2EE LanguageType(0xF2EE) /* primary 0x2ee, sub 0x3c */
+
+/*! use only for import/export of MS documents, number formatter maps it to
+ *! LANGUAGE_SYSTEM and then to effective system language */
+#define LANGUAGE_SYSTEM_DEFAULT LanguageType(0x0800)
+
+/*! use only for import/export of MS documents, number formatter maps it to
+ *! LANGUAGE_SYSTEM and then to effective system language */
+#define LANGUAGE_PROCESS_OR_USER_DEFAULT LanguageType(0x0400)
+
+/* Number format code modifier attribute for system time.
+ * Primary language 0x000, sublanguage 0x3D. */
+#define LANGUAGE_NF_SYSTEM_TIME LanguageType(0xF400)
+
+/* Number format code modifier attribute for system date.
+ * Primary language 0x000, sublanguage 0x3E. */
+#define LANGUAGE_NF_SYSTEM_DATE LanguageType(0xF800)
+
+
+/* And now the extensions we define,
+ * with primary language IDs from 0x200 to 0x3FF valid in blocks from
+ *
+ * 0x0610 to 0x07FF with sublanguage ID 0x01 (default)
+ * 0x0A00 to 0x0BFF with sublanguage ID 0x02
+ * ...
+ * 0x8200 to 0x83FF with sublanguage ID 0x20
+ * 0x8600 to 0x87FF with sublanguage ID 0x21
+ * ...
+ * 0xFA00 to 0xFBFF with sublanguage ID 0x3E
+ * 0xFE00 to 0xFFFF with sublanguage ID 0x3F
+ *
+ * Of which we define reserved blocks:
+ * All primary language IDs 0x3E0 to 0x3FE with any sublanguage ID, not to be
+ * assigned as user-defined IDs:
+ *
+ * 0x07E0 to 0x07FE with sublanguage ID 0x01, first on-the-fly block
+ * 0x0BE0 to 0x0BFE with sublanguage ID 0x02, second on-the-fly block
+ * ...
+ * 0x83E0 to 0x83FE with sublanguage ID 0x20
+ * 0x87E0 to 0x87FE with sublanguage ID 0x21
+ * ...
+ * 0xFBE0 to 0xFBFE with sublanguage ID 0x3E, last on-the-fly block
+ * 0xFFE0 to 0xFFFE with sublanguage ID 0x3F, 32 privateuse and specials
+ *
+ * This leaves room for 479 user-defined primary language IDs (instead of 512)
+ * with primary bitmask comparability, and 1922 on-the-fly IDs (instead of 0)
+ * with arbitrary assignment ((0x3E - 0x01 + 1) * (0x3FE - 0x3E0 + 1)).
+ *
+ * The primary ID 0x3FF is reserved and unassigned as it is the same as the
+ * LANGUAGE_MASK_PRIMARY and LANGUAGE_DONTKNOW value, so to not be mistaken as
+ * such.
+ *
+ * Obsolete OOo user defines now have other values assigned by MS, and
+ * different name. Mapping an obsolete value to ISO code should work provided
+ * that such a mapping exists in i18nlangtag/source/isolang/isolang.cxx, but
+ * mapping ISO back to LANGID will return the new value.
+ */
+#define LANGUAGE_OBSOLETE_USER_LATIN LanguageType(0x0610)
+#define LANGUAGE_USER_LATIN LANGUAGE_LATIN
+#define LANGUAGE_OBSOLETE_USER_LATIN_VATICAN LanguageType(0x8076) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_LATIN)) */
+#define LANGUAGE_USER_LATIN_VATICAN LANGUAGE_LATIN
+#define LANGUAGE_USER_ESPERANTO LanguageType(0x0611) /* no locale possible */
+#define LANGUAGE_USER_INTERLINGUA LanguageType(0x0612) /* no locale, but conventions */
+#define LANGUAGE_OBSOLETE_USER_MAORI LanguageType(0x0620)
+#define LANGUAGE_USER_MAORI LANGUAGE_MAORI_NEW_ZEALAND
+#define LANGUAGE_OBSOLETE_USER_KINYARWANDA LanguageType(0x0621)
+#define LANGUAGE_USER_KINYARWANDA LANGUAGE_KINYARWANDA_RWANDA
+/* was reserved for Northern Sotho but never used: 0x0622 */ /* obsoleted by LANGUAGE_SEPEDI */
+#define LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN LanguageType(0x0623)
+#define LANGUAGE_USER_UPPER_SORBIAN LANGUAGE_UPPER_SORBIAN_GERMANY
+#define LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN LanguageType(0x0624)
+#define LANGUAGE_USER_LOWER_SORBIAN LANGUAGE_LOWER_SORBIAN_GERMANY
+#define LANGUAGE_OBSOLETE_USER_OCCITAN LanguageType(0x0625)
+#define LANGUAGE_USER_OCCITAN LANGUAGE_OCCITAN_FRANCE /* reserved to languedocian */
+
+#define LANGUAGE_USER_KOREAN_NORTH LanguageType(0x8012) /* North Korean as opposed to South Korean, makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_KOREAN)) */
+#define LANGUAGE_USER_KURDISH_TURKEY LanguageType(0x0626) /* sublang 0x01, Latin script */
+#define LANGUAGE_USER_KURDISH_SYRIA LanguageType(0x0A26) /* sublang 0x02, Latin script */
+#define LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ LanguageType(0x0E26) /* sublang 0x03, Arabic script */
+#define LANGUAGE_USER_KURDISH_IRAQ LANGUAGE_KURDISH_ARABIC_IRAQ
+#define LANGUAGE_USER_KURDISH_IRAN LanguageType(0x1226) /* sublang 0x04, Arabic script */
+#define LANGUAGE_USER_KURDISH_SOUTHERN_IRAQ LanguageType(0x8092) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_KURDISH_ARABIC_LSO)) */
+#define LANGUAGE_USER_KURDISH_SOUTHERN_IRAN LanguageType(0x8492) /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_KURDISH_ARABIC_LSO)) */
+#define LANGUAGE_USER_SARDINIAN LanguageType(0x0627)
+/* was reserved for Dzongkha but turned down with #i53497#: 0x0628 */ /* obsoleted by LANGUAGE_DZONGKHA_BHUTAN */
+#define LANGUAGE_USER_DZONGKHA_MAP_LONLY LanguageType(0xF851) /* to map "dz" only, because of the MS error, and preserve CTL information, sub 0x3e */
+#define LANGUAGE_USER_SWAHILI_TANZANIA LanguageType(0x8041) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SWAHILI)) */
+#define LANGUAGE_OBSOLETE_USER_BRETON LanguageType(0x0629)
+#define LANGUAGE_USER_BRETON LANGUAGE_BRETON_FRANCE
+#define LANGUAGE_OBSOLETE_USER_KALAALLISUT LanguageType(0x062A)
+#define LANGUAGE_USER_KALAALLISUT LANGUAGE_KALAALLISUT_GREENLAND
+#define LANGUAGE_USER_SWAZI LanguageType(0x062B)
+#define LANGUAGE_USER_NDEBELE_SOUTH LanguageType(0x062C)
+#define LANGUAGE_OBSOLETE_USER_TSWANA_BOTSWANA LanguageType(0x8032) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_TSWANA)) */
+#define LANGUAGE_USER_TSWANA_BOTSWANA LANGUAGE_TSWANA_BOTSWANA
+#define LANGUAGE_USER_MOORE LanguageType(0x062D)
+#define LANGUAGE_USER_BAMBARA LanguageType(0x062E)
+#define LANGUAGE_USER_AKAN LanguageType(0x062F)
+#define LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH LanguageType(0x0630)
+#define LANGUAGE_USER_LUXEMBOURGISH LANGUAGE_LUXEMBOURGISH_LUXEMBOURG
+#define LANGUAGE_USER_FRIULIAN LanguageType(0x0631)
+#define LANGUAGE_USER_FIJIAN LanguageType(0x0632)
+#define LANGUAGE_USER_AFRIKAANS_NAMIBIA LanguageType(0x8036) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_AFRIKAANS)) */
+#define LANGUAGE_USER_ENGLISH_NAMIBIA LanguageType(0x8009) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_ENGLISH_US)) */
+#define LANGUAGE_USER_WALLOON LanguageType(0x0633)
+#define LANGUAGE_USER_COPTIC LanguageType(0x0634)
+#define LANGUAGE_USER_CHUVASH LanguageType(0x0635)
+#define LANGUAGE_USER_GASCON LanguageType(0x0636) /* Gascon France */
+#define LANGUAGE_USER_GERMAN_BELGIUM LanguageType(0x8007) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_GERMAN)) */
+#define LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN LanguageType(0x8003) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_CATALAN)) */
+#define LANGUAGE_USER_CATALAN_VALENCIAN LANGUAGE_CATALAN_VALENCIAN
+#define LANGUAGE_USER_HAUSA_GHANA LanguageType(0x8068) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_HAUSA_NIGERIA)) */
+#define LANGUAGE_USER_EWE_GHANA LanguageType(0x0637)
+#define LANGUAGE_USER_ENGLISH_GHANA LanguageType(0x8409) /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_ENGLISH_US)) */
+#define LANGUAGE_USER_TAGALOG LanguageType(0x0638)
+#define LANGUAGE_USER_LINGALA_DRCONGO LanguageType(0x0639)
+#define LANGUAGE_USER_SANGO LanguageType(0x063A)
+#define LANGUAGE_USER_GANDA LanguageType(0x063B)
+#define LANGUAGE_USER_LOW_GERMAN LanguageType(0x063C)
+#define LANGUAGE_USER_HILIGAYNON LanguageType(0x063D)
+#define LANGUAGE_USER_NYANJA LanguageType(0x063E)
+#define LANGUAGE_USER_KASHUBIAN LanguageType(0x063F)
+#define LANGUAGE_OBSOLETE_USER_SPANISH_CUBA LanguageType(0x800A) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SPANISH)) */
+#define LANGUAGE_USER_SPANISH_CUBA LANGUAGE_SPANISH_CUBA
+#define LANGUAGE_USER_TETUN LanguageType(0x0640)
+#define LANGUAGE_USER_QUECHUA_NORTH_BOLIVIA LanguageType(0x0641)
+#define LANGUAGE_USER_QUECHUA_SOUTH_BOLIVIA LanguageType(0x0642)
+#define LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_SERBIA LanguageType(0x8C1A) /* makeLangID( 0x20+0x03, getPrimaryLanguage( LANGUAGE_SERBIAN_CYRILLIC_LSO)) */
+#define LANGUAGE_USER_SERBIAN_CYRILLIC_SERBIA LANGUAGE_SERBIAN_CYRILLIC_SERBIA
+#define LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_SERBIA LanguageType(0x881A) /* makeLangID( 0x20+0x02, getPrimaryLanguage( LANGUAGE_SERBIAN_LATIN_LSO)) */
+#define LANGUAGE_USER_SERBIAN_LATIN_SERBIA LANGUAGE_SERBIAN_LATIN_SERBIA
+#define LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_MONTENEGRO LanguageType(0xCC1A) /* makeLangID( 0x20+0x13, getPrimaryLanguage( LANGUAGE_SERBIAN_CYRILLIC_LSO)) */
+#define LANGUAGE_USER_SERBIAN_CYRILLIC_MONTENEGRO LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO
+#define LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_MONTENEGRO LanguageType(0xC81A) /* makeLangID( 0x20+0x12, getPrimaryLanguage( LANGUAGE_SERBIAN_LATIN_LSO)) */
+#define LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO LANGUAGE_SERBIAN_LATIN_MONTENEGRO
+#define LANGUAGE_USER_SAMI_KILDIN_RUSSIA LanguageType(0x803B) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SAMI_NORTHERN_NORWAY)) */
+#define LANGUAGE_USER_BODO_INDIA LanguageType(0x0643)
+#define LANGUAGE_USER_DOGRI_INDIA LanguageType(0x0644)
+#define LANGUAGE_USER_MAITHILI_INDIA LanguageType(0x0645)
+#define LANGUAGE_USER_SANTALI_INDIA LanguageType(0x0646)
+#define LANGUAGE_USER_TETUN_TIMOR_LESTE LanguageType(0x0A40) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_TETUN)) */
+#define LANGUAGE_USER_TOK_PISIN LanguageType(0x0647)
+#define LANGUAGE_USER_SHUSWAP LanguageType(0x0648)
+#define LANGUAGE_USER_ARABIC_CHAD LanguageType(0x8001) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_COMOROS LanguageType(0x8401) /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_DJIBOUTI LanguageType(0x8801) /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_ERITREA LanguageType(0x8C01) /* makeLangID( 0x23, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_ISRAEL LanguageType(0x9001) /* makeLangID( 0x24, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_MAURITANIA LanguageType(0x9401) /* makeLangID( 0x25, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_PALESTINE LanguageType(0x9801) /* makeLangID( 0x26, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_SOMALIA LanguageType(0x9C01) /* makeLangID( 0x27, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_SUDAN LanguageType(0xA001) /* makeLangID( 0x28, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ANCIENT_GREEK LanguageType(0x0649)
+#define LANGUAGE_USER_ASTURIAN LanguageType(0x064A)
+#define LANGUAGE_USER_LATGALIAN LanguageType(0x064B)
+#define LANGUAGE_USER_MAORE LanguageType(0x064C)
+#define LANGUAGE_USER_BUSHI LanguageType(0x064D)
+#define LANGUAGE_USER_TAHITIAN LanguageType(0x064E)
+#define LANGUAGE_OBSOLETE_USER_MALAGASY_PLATEAU LanguageType(0x064F)
+#define LANGUAGE_USER_PAPIAMENTU_ARUBA LanguageType(0x8079) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */
+#define LANGUAGE_USER_SARDINIAN_CAMPIDANESE LanguageType(0x0650)
+#define LANGUAGE_USER_SARDINIAN_GALLURESE LanguageType(0x0651)
+#define LANGUAGE_USER_SARDINIAN_LOGUDORESE LanguageType(0x0652)
+#define LANGUAGE_USER_SARDINIAN_SASSARESE LanguageType(0x0653)
+#define LANGUAGE_USER_BAFIA LanguageType(0x0654)
+#define LANGUAGE_USER_GIKUYU LanguageType(0x0655)
+#define LANGUAGE_USER_RUSYN_UKRAINE LanguageType(0x0656)
+#define LANGUAGE_USER_RUSYN_SLOVAKIA LanguageType(0x8256) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_RUSYN_UKRAINE)) */
+#define LANGUAGE_USER_YIDDISH_US LanguageType(0x803D) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_YIDDISH)) */
+#define LANGUAGE_USER_LIMBU LanguageType(0x0657)
+#define LANGUAGE_USER_LOJBAN LanguageType(0x0658) /* no locale */
+#define LANGUAGE_OBSOLETE_USER_KABYLE LanguageType(0x0659)
+#define LANGUAGE_USER_KABYLE LANGUAGE_TAMAZIGHT_LATIN_ALGERIA
+#define LANGUAGE_USER_HAITIAN LanguageType(0x065A)
+#define LANGUAGE_USER_BEEMBE LanguageType(0x065B)
+#define LANGUAGE_USER_BEKWEL LanguageType(0x065C)
+#define LANGUAGE_USER_KITUBA LanguageType(0x065D)
+#define LANGUAGE_USER_LARI LanguageType(0x065E)
+#define LANGUAGE_USER_MBOCHI LanguageType(0x065F)
+#define LANGUAGE_USER_TEKE_IBALI LanguageType(0x0660)
+#define LANGUAGE_USER_TEKE_TYEE LanguageType(0x0661)
+#define LANGUAGE_USER_VILI LanguageType(0x0662)
+#define LANGUAGE_USER_PORTUGUESE_ANGOLA LanguageType(0x8016) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_PORTUGUESE)) */
+#define LANGUAGE_USER_MANX LanguageType(0x0663)
+#define LANGUAGE_USER_TEKE_EBOO LanguageType(0x0664)
+#define LANGUAGE_USER_ARAGONESE LanguageType(0x0665)
+#define LANGUAGE_USER_KEYID LanguageType(0x0666) /* key id pseudolanguage */
+#define LANGUAGE_USER_PALI_LATIN LanguageType(0x0667)
+#define LANGUAGE_USER_KYRGYZ_CHINA LanguageType(0x0668) /* not derived from LANGUAGE_KIRGHIZ as these may be different scripts, see http://www.omniglot.com/writing/kirghiz.htm */
+#define LANGUAGE_USER_KOMI_ZYRIAN LanguageType(0x0669)
+#define LANGUAGE_USER_KOMI_PERMYAK LanguageType(0x066A)
+#define LANGUAGE_USER_PITJANTJATJARA LanguageType(0x066B)
+#define LANGUAGE_USER_ENGLISH_MALAWI LanguageType(0x8809) /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_ERZYA LanguageType(0x066C)
+#define LANGUAGE_USER_MARI_MEADOW LanguageType(0x066D)
+#define LANGUAGE_USER_KHANTY LanguageType(0x066E)
+#define LANGUAGE_USER_LIVONIAN LanguageType(0x066F)
+#define LANGUAGE_USER_MOKSHA LanguageType(0x0670)
+#define LANGUAGE_USER_MARI_HILL LanguageType(0x0671)
+#define LANGUAGE_USER_NGANASAN LanguageType(0x0672)
+#define LANGUAGE_USER_OLONETS LanguageType(0x0673)
+#define LANGUAGE_USER_VEPS LanguageType(0x0674)
+#define LANGUAGE_USER_VORO LanguageType(0x0675)
+#define LANGUAGE_USER_NENETS LanguageType(0x0676)
+#define LANGUAGE_USER_PAPIAMENTU_CURACAO LanguageType(0x8479) /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */
+#define LANGUAGE_USER_PAPIAMENTU_BONAIRE LanguageType(0x8879) /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */
+#define LANGUAGE_USER_AKA LanguageType(0x0677)
+#define LANGUAGE_USER_AKA_CONGO LanguageType(0x8277) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_AKA)) */
+#define LANGUAGE_USER_DIBOLE LanguageType(0x0678)
+#define LANGUAGE_USER_DOONDO LanguageType(0x0679)
+#define LANGUAGE_USER_KAAMBA LanguageType(0x067A)
+#define LANGUAGE_USER_KOONGO LanguageType(0x067B)
+#define LANGUAGE_USER_KOONGO_CONGO LanguageType(0x827B) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_KOONGO)) */
+#define LANGUAGE_USER_KUNYI LanguageType(0x067C)
+#define LANGUAGE_USER_NGUNGWEL LanguageType(0x067D)
+#define LANGUAGE_USER_NJYEM LanguageType(0x067E)
+#define LANGUAGE_USER_NJYEM_CONGO LanguageType(0x827E) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_NJYEM)) */
+#define LANGUAGE_USER_PUNU LanguageType(0x067F)
+#define LANGUAGE_USER_PUNU_CONGO LanguageType(0x827F) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_PUNU)) */
+#define LANGUAGE_USER_SUUNDI LanguageType(0x0680)
+#define LANGUAGE_USER_TEKE_KUKUYA LanguageType(0x0681)
+#define LANGUAGE_USER_TSAANGI LanguageType(0x0682)
+#define LANGUAGE_USER_YAKA LanguageType(0x0683)
+#define LANGUAGE_USER_YOMBE LanguageType(0x0684)
+#define LANGUAGE_USER_YOMBE_CONGO LanguageType(0x8284) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_YOMBE)) */
+#define LANGUAGE_USER_SIDAMA LanguageType(0x0685)
+#define LANGUAGE_USER_NKO LanguageType(0x0686)
+#define LANGUAGE_USER_UDMURT LanguageType(0x0687)
+#define LANGUAGE_USER_TIBETAN_INDIA LanguageType(0x8051) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_TIBETAN)) */
+#define LANGUAGE_USER_CORNISH LanguageType(0x0688)
+#define LANGUAGE_USER_SAMI_PITE_SWEDEN LanguageType(0x843B) /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_SAMI_NORTHERN_NORWAY)) */
+#define LANGUAGE_USER_NGAEBERE LanguageType(0x0689)
+#define LANGUAGE_USER_ENGLISH_UK_OED LanguageType(0x8C09) /* makeLangID( 0x23, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_KUMYK LanguageType(0x068A)
+#define LANGUAGE_USER_NOGAI LanguageType(0x068B)
+#define LANGUAGE_USER_KARAKALPAK_LATIN LanguageType(0x068C)
+#define LANGUAGE_USER_LADIN LanguageType(0x068D)
+#define LANGUAGE_USER_TIBETAN_BHUTAN LanguageType(0x8451) /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_TIBETAN)) */
+#define LANGUAGE_USER_FRENCH_BURKINA_FASO LanguageType(0x800C) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_FRENCH)) */
+#define LANGUAGE_USER_PUINAVE LanguageType(0x068E)
+#define LANGUAGE_USER_MANINKAKAN_EASTERN_LATIN LanguageType(0x068F)
+#define LANGUAGE_USER_AVAR LanguageType(0x0690)
+#define LANGUAGE_USER_CREE_PLAINS_LATIN LanguageType(0x0691)
+#define LANGUAGE_USER_CREE_PLAINS_SYLLABICS LanguageType(0x8291) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_CREE_PLAINS_LATIN)) */
+#define LANGUAGE_USER_LENGO LanguageType(0x0692)
+#define LANGUAGE_USER_FRENCH_BENIN LanguageType(0x840C) /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_FRENCH)) */
+#define LANGUAGE_USER_FRENCH_NIGER LanguageType(0x880C) /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_FRENCH)) */
+#define LANGUAGE_USER_FRENCH_TOGO LanguageType(0x8C0C) /* makeLangID( 0x23, getPrimaryLanguage( LANGUAGE_FRENCH)) */
+#define LANGUAGE_USER_KVEN_FINNISH LanguageType(0x0693)
+#define LANGUAGE_USER_CHURCH_SLAVIC LanguageType(0x0694)
+#define LANGUAGE_USER_VENETIAN LanguageType(0x0695)
+#define LANGUAGE_USER_ENGLISH_GAMBIA LanguageType(0x9009) /* makeLangID( 0x24, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_OCCITAN_ARANESE LanguageType(0x8082) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_OCCITAN_FRANCE)) */
+#define LANGUAGE_USER_ENGLISH_UK_OXENDICT LanguageType(0x9409) /* makeLangID( 0x25, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_ARPITAN_FRANCE LanguageType(0x0696)
+#define LANGUAGE_USER_ARPITAN_ITALY LanguageType(0x0A96) /* makeLangID( 0x02, getPrimaryLanguage( LANGUAGE_USER_ARPITAN_FRANCE)) */
+#define LANGUAGE_USER_ARPITAN_SWITZERLAND LanguageType(0x0E96) /* makeLangID( 0x03, getPrimaryLanguage( LANGUAGE_USER_ARPITAN_FRANCE)) */
+#define LANGUAGE_USER_ENGLISH_BOTSWANA LanguageType(0x9809) /* makeLangID( 0x26, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_INTERLINGUE LanguageType(0x0697) /* no locale */
+#define LANGUAGE_USER_APATANI LanguageType(0x0698)
+#define LANGUAGE_USER_ENGLISH_MAURITIUS LanguageType(0x9C09) /* makeLangID( 0x27, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_FRENCH_MAURITIUS LanguageType(0x900C) /* makeLangID( 0x24, getPrimaryLanguage( LANGUAGE_FRENCH)) */
+#define LANGUAGE_USER_SILESIAN LanguageType(0x0699)
+#define LANGUAGE_USER_HUNGARIAN_ROVAS LanguageType(0x800E) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_HUNGARIAN)) */
+#define LANGUAGE_USER_MANCHU LanguageType(0x069A)
+#define LANGUAGE_USER_XIBE LanguageType(0x069B)
+#define LANGUAGE_USER_KITUBA_DRCONGO LanguageType(0x069C)
+#define LANGUAGE_USER_FON LanguageType(0x069D)
+#define LANGUAGE_USER_PLAUTDIETSCH LanguageType(0x069E)
+#define LANGUAGE_USER_ARMENIAN_RUSSIA LanguageType(0x802B) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_ARMENIAN)) */
+#define LANGUAGE_USER_ARMENIAN_IRAN LanguageType(0x842B) /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_ARMENIAN)) */
+#define LANGUAGE_USER_ARMENIAN_WESTERN LanguageType(0x069F)
+#define LANGUAGE_USER_ARMENIAN_CLASSICAL LanguageType(0x06A0)
+#define LANGUAGE_USER_MALAY_ARABIC_MALAYSIA LanguageType(0x803E) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_MALAY_MALAYSIA)) */
+#define LANGUAGE_USER_MALAY_ARABIC_BRUNEI LanguageType(0x843E) /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_MALAY_BRUNEI_DARUSSALAM)) */
+#define LANGUAGE_USER_JUHOAN LanguageType(0x06A1)
+#define LANGUAGE_USER_NARO LanguageType(0x06A2)
+#define LANGUAGE_USER_ILOKO LanguageType(0x06A3)
+#define LANGUAGE_USER_ENGLISH_ZAMBIA LanguageType(0xA009) /* makeLangID( 0x28, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_ENGLISH_SRI_LANKA LanguageType(0xA409) /* makeLangID( 0x29, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_ENGLISH_NIGERIA LanguageType(0xA809) /* makeLangID( 0x2A, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_KABARDIAN LanguageType(0x06A4)
+#define LANGUAGE_USER_GUADELOUPEAN_CREOLE_FRENCH LanguageType(0x06A5)
+#define LANGUAGE_USER_LIGURIAN LanguageType(0x06A6)
+#define LANGUAGE_USER_MINANGKABAU LanguageType(0x06A7)
+#define LANGUAGE_USER_SUNDANESE LanguageType(0x06A8)
+#define LANGUAGE_USER_YAKA_DRCONGO LanguageType(0x06A9)
+#define LANGUAGE_USER_ENGLISH_KENYA LanguageType(0xAC09) /* makeLangID( 0x2B, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_PALI_THAI LanguageType(0x0A67) /* makeLangID( 0x02, getPrimaryLanguage( LANGUAGE_USER_PALI_LATIN)) */
+#define LANGUAGE_USER_CABECAR LanguageType(0x06AA)
+#define LANGUAGE_USER_BRIBRI LanguageType(0x06AB)
+#define LANGUAGE_USER_ENGLISH_DENMARK LanguageType(0xB009) /* makeLangID( 0x2C, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_SESOTHO_LESOTHO LanguageType(0x8030) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SESOTHO)) */
+#define LANGUAGE_USER_YIDDISH_ISRAEL LanguageType(0x843D) /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_YIDDISH)) */
+#define LANGUAGE_USER_KLINGON LanguageType(0x06AC)
+#define LANGUAGE_USER_ENGLISH_ISRAEL LanguageType(0xB409) /* makeLangID( 0x2D, getPrimaryLanguage( LANGUAGE_ENGLISH_US)) */
+#define LANGUAGE_USER_INTERSLAVIC_LATIN LanguageType(0x06AD)
+#define LANGUAGE_USER_INTERSLAVIC_CYRILLIC LanguageType(0x06AE)
+#define LANGUAGE_USER_PENNSYLVANIA_DUTCH LanguageType(0x06AF)
+
+
+/* XXX Add new user defined LCIDs ^^^ there.
+ * Note that we run out of IDs with sublanguage ID 0x01 after 0x07DF ... */
+
+
+/* Primary language ID range for on-the-fly assignment. */
+#define LANGUAGE_ON_THE_FLY_START LanguageType(0x03E0)
+#define LANGUAGE_ON_THE_FLY_END LanguageType(0x03FE)
+/* Sublanguage ID range for on-the-fly assignment. */
+#define LANGUAGE_ON_THE_FLY_SUB_START LanguageType(0x01)
+#define LANGUAGE_ON_THE_FLY_SUB_END LanguageType(0x3E)
+
+/* 0xFFE0 to 0xFFFF reserved for privateuse and specials. */
+#define LANGUAGE_USER_PRIV_NONE LanguageType(0xFFEA) /* privateuse "x-none", MS ill-escaped into the wild, primary 0x3ea, sub 0x3f */
+#define LANGUAGE_USER_PRIV_JOKER LanguageType(0xFFEB) /* privateuse "*" (sic! bad! nasty!), primary 0x3eb, sub 0x3f */
+#define LANGUAGE_USER_PRIV_COMMENT LanguageType(0xFFEC) /* privateuse "x-comment", primary 0x3ec, sub 0x3f */
+#define LANGUAGE_USER_PRIV_DEFAULT LanguageType(0xFFED) /* privateuse "x-default", primary 0x3ed, sub 0x3f */
+#define LANGUAGE_USER_PRIV_NOTRANSLATE LanguageType(0xFFEE) /* privateuse "x-no-translate" (sic!), primary 0x3ee, sub 0x3f */
+#define LANGUAGE_MULTIPLE LanguageType(0xFFEF) /* multiple languages, primary 0x3ef, sub 0x3f */
+#define LANGUAGE_UNDETERMINED LanguageType(0xFFF0) /* undetermined language, primary 0x3f0, sub 0x3f */
+#define LANGUAGE_USER_SYSTEM_CONFIG LanguageType(0xFFFE) /* not a locale, to be used only in configuration context to obtain system default, primary 0x3fe, sub 0x3f */
+
+
+#endif /* INCLUDED_I18NLANGTAG_LANG_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/languagetag.hxx b/include/i18nlangtag/languagetag.hxx
new file mode 100644
index 000000000..3b5fb3d6d
--- /dev/null
+++ b/include/i18nlangtag/languagetag.hxx
@@ -0,0 +1,592 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_LANGUAGETAG_HXX
+#define INCLUDED_I18NLANGTAG_LANGUAGETAG_HXX
+
+#include <sal/config.h>
+#include <rtl/locale.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <i18nlangtag/i18nlangtagdllapi.h>
+#include <i18nlangtag/lang.h>
+
+#include <memory>
+#include <string_view>
+#include <vector>
+
+/** The ISO 639-2 code reserved for local use used to indicate that a
+ css::Locale contains a BCP 47 string in its Variant field. The
+ Locale's Language field then will contain this language code.
+
+ @see LanguageTag::getLocale()
+
+ Avoid use, only needed internally or if conversion from Locale to
+ LanguageTag is not wanted, i.e. during ODF import. To check whether a
+ LanguageTag contains a plain language/country combination or a more
+ detailed BCP 47 language tag use LanguageTag::isIsoLocale() instead.
+ */
+#define I18NLANGTAG_QLT_ASCII "qlt"
+inline constexpr OUStringLiteral I18NLANGTAG_QLT = u"qlt";
+
+
+class LanguageTagImpl;
+
+
+/** Wrapper for liblangtag BCP 47 language tags, MS-LangIDs, locales and
+ conversions in between.
+
+ Note that member variables are mutable and may change their values even in
+ const methods. Getter methods return either the original value or matching
+ converted values.
+
+ For standalone conversions if no LanguageTag instance is at hand, static
+ convertTo...() methods exist.
+ */
+class SAL_WARN_UNUSED I18NLANGTAG_DLLPUBLIC LanguageTag
+{
+ friend class LanguageTagImpl;
+
+public:
+
+ /** ScriptType for a language.
+
+ Used only in onTheFly languages as a way of marking key script behaviours
+ for the script of the language without having to store and analyse the
+ script each time. Used primarily from msLangId.
+
+ These need to correspond to the ExtraLanguages.ScriptType template
+ property in officecfg/registry/schema/org/openoffice/VCL.xcs
+ */
+ enum class ScriptType
+ {
+ UNKNOWN = 0,
+ WESTERN = 1, // Copies css::i18n::ScriptType for strong types
+ CJK = 2,
+ CTL = 3,
+ RTL = 4 // implies CTL
+ };
+
+ /** Init LanguageTag with existing BCP 47 language tag string.
+
+ @param bCanonicalize
+ If TRUE, canonicalize tag and reparse, the resulting tag string may
+ be different.
+ IF FALSE, the tag is simply stored and can be retrieved with
+ getBcp47().
+
+ Note that conversions to ISO codes, locales or LanguageType or
+ obtaining language or script will canonicalize the tag string anyway,
+ so specifying bCanonicalize=false is not a guarantee that the tag will
+ stay identical to what was passed.
+ */
+ explicit LanguageTag( const OUString & rBcp47LanguageTag, bool bCanonicalize = false );
+
+ /** Init LanguageTag with Locale. */
+ explicit LanguageTag( const css::lang::Locale & rLocale );
+
+ /** Init LanguageTag with LanguageType MS-LangID. */
+ explicit LanguageTag( LanguageType nLanguage );
+
+ /** Init LanguageTag with either BCP 47 language tag (precedence if not
+ empty), or a combination of language, script and country.
+
+ This is a convenience ctor to be used in ODF import where these are
+ distinct attributes.
+ */
+ explicit LanguageTag( const OUString& rBcp47, const OUString& rLanguage,
+ std::u16string_view rScript, const OUString& rCountry );
+
+ /** Init LanguageTag with rtl_Locale.
+
+ This is a convenience ctor.
+ */
+ explicit LanguageTag( const rtl_Locale & rLocale );
+
+ ~LanguageTag();
+
+ LanguageTag(LanguageTag const &) = default;
+ LanguageTag(LanguageTag &&) = default;
+ LanguageTag & operator =(LanguageTag const &) = default;
+ LanguageTag & operator =(LanguageTag &&) = default;
+
+ /** Obtain BCP 47 language tag.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return an empty OUString for such a tag.
+ */
+ const OUString & getBcp47( bool bResolveSystem = true ) const;
+
+ /** Obtain BCP 47 language tag, but with MS malformed exceptions.
+
+ To be used *only* in OOXML filter context.
+ For example, es-ES-u-co-trad is stored as es-ES_tradnl which is not a
+ valid BCP 47 language tag.
+ */
+ OUString getBcp47MS() const;
+
+ /** Obtain language tag as Locale.
+
+ As a convention, language tags that can not be expressed as "pure"
+ css::lang::Locale content using Language and Country fields
+ store "qlt" (ISO 639 reserved for local use) in the Language field and
+ the entire BCP 47 language tag in the Variant field. The Country field
+ contains the corresponding ISO 3166 country code _if_ there is one, or
+ otherwise is empty.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return an empty Locale for such a tag.
+ */
+ const css::lang::Locale & getLocale( bool bResolveSystem = true ) const;
+
+ /** Obtain mapping to MS-LangID.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return LANGUAGE_SYSTEM for such a tag.
+ */
+ LanguageType getLanguageType( bool bResolveSystem = true ) const;
+
+ /** Obtain ISO strings for language, script and country.
+
+ This is a convenience method for ODF export places only. Avoid use in
+ other code.
+
+ ATTENTION! May return empty strings if the language tag is not
+ expressible in valid ISO codes!
+
+ @see isIsoODF()
+
+ Always resolves an empty tag to the system locale.
+ */
+ void getIsoLanguageScriptCountry( OUString& rLanguage,
+ OUString& rScript, OUString& rCountry ) const;
+
+ /** Get ISO 639 language code, or BCP 47 language.
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getLanguage() const;
+
+ /** Get ISO 15924 script code, if not the default script according to
+ BCP 47. For default script an empty string is returned.
+
+ @see hasScript()
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getScript() const;
+
+ /** Get combined language and script code, separated by '-' if
+ non-default script, if default script only language.
+
+ @see hasScript()
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getLanguageAndScript() const;
+
+ /** Get ISO 3166 country alpha code. Empty if the BCP 47 tags denote a
+ region not expressible as 2 character country code.
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getCountry() const;
+
+ /** Get BCP 47 variant subtags, of the IANA Language Subtag Registry.
+
+ If there are multiple variant subtags they are separated by '-'.
+
+ This is NOT related to Locale.Variant!
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getVariants() const;
+
+ /** Get a GLIBC locale string.
+
+ Always resolves an empty tag to the system locale.
+
+ @param rEncoding
+ An encoding to be appended to language_country, for example
+ ".UTF-8" including the dot.
+
+ @return The resulting GLIBC locale string if it could be constructed,
+ if not an empty string is returned.
+ */
+ OUString getGlibcLocaleString( std::u16string_view rEncoding ) const;
+
+ /** If language tag has a non-default script specified.
+ */
+ bool hasScript() const;
+
+ /** If language tag is a locale that can be expressed using only ISO 639
+ language codes and ISO 3166 country codes, thus is convertible to a
+ conforming Locale struct without using extension mechanisms.
+
+ Note that an empty language tag or empty Locale::Language field or
+ LanguageType LANGUAGE_SYSTEM could be treated as a valid ISO locale in
+ some context, but here is not. If you want that ask for
+ aTag.isSystemLocale() || aTag.isIsoLocale()
+
+ Always resolves an empty tag to the system locale.
+ */
+ bool isIsoLocale() const;
+
+ /** If language tag is a locale that can be expressed using only ISO 639
+ language codes and ISO 15924 script codes and ISO 3166 country codes,
+ thus can be stored in an ODF document using only fo:language, fo:script
+ and fo:country attributes. If this is FALSE, the locale must be stored
+ as a <*:rfc-language-tag> element.
+
+ Always resolves an empty tag to the system locale.
+ */
+ bool isIsoODF() const;
+
+ /** If this is a valid BCP 47 language tag.
+
+ Always resolves an empty tag to the system locale.
+
+ @seealso static bool isValidBcp47(const OUString&)
+ */
+ bool isValidBcp47() const;
+
+ /** If this tag was constructed as an empty tag denoting the system locale.
+ */
+ bool isSystemLocale() const { return mbSystemLocale;}
+
+ /** Returns the script type for this language, UNKNOWN if not set */
+ ScriptType getScriptType() const;
+
+ /** Sets the script type for this language */
+ void setScriptType(ScriptType st);
+
+ /** Reset with existing BCP 47 language tag string. See ctor. */
+ LanguageTag & reset( const OUString & rBcp47LanguageTag );
+
+ /** Reset with Locale. */
+ LanguageTag & reset( const css::lang::Locale & rLocale );
+
+ /** Reset with LanguageType MS-LangID. */
+ LanguageTag & reset( LanguageType nLanguage );
+
+
+ /** Fall back to a known locale.
+
+ If the current tag does not represent a known (by us) locale, fall back
+ to the most likely locale possible known.
+ If the current tag is known, no change occurs.
+ */
+ LanguageTag & makeFallback();
+
+ /** Return a vector of fall-back strings.
+
+ In order:
+ full BCP 47 tag, same as getBcp47()
+ lll-Ssss-CC
+ lll-Ssss
+ lll-CC
+ lll
+
+ If the tag includes variants the order is:
+ full BCP 47 tag, same as getBcp47()
+ lll-Ssss-CC-vvvvvvvv
+ lll-Ssss-vvvvvvvv
+ lll-Ssss-CC
+ lll-Ssss
+ lll-CC-vvvvvvvv
+ lll-vvvvvvvv
+ lll-CC
+ lll
+
+ Only strings that differ from a higher order are included, for example
+ if there is no script the elements will be bcp47, lll-CC, lll; if the
+ bcp47 string is identical to lll-CC then only lll-CC, lll.
+
+ Note that lll is only ISO 639-1/2 alpha code and CC is only ISO 3166
+ alpha code. If the region can not be expressed as ISO 3166 then no -CC
+ tags are included.
+
+ @param bIncludeFullBcp47
+ If TRUE, the full BCP 47 tag is included as first element.
+ If FALSE, the full tag is not included; used if the caller
+ obtains the fallbacks only if the full tag did not lead to a
+ match, so subsequent tries need not to include it again.
+ */
+ ::std::vector< OUString > getFallbackStrings( bool bIncludeFullBcp47 ) const;
+
+
+ /** @short Search for an equal or at least for a similar locale in a list
+ of possible ones.
+
+ @descr First search for a locale that is equal to the reference
+ locale. (means: same BCP47 string)
+
+ If the reference locale could not be located, check for
+ "similar" locales, in the same order as obtained by
+ getFallbackStrings().
+
+ If no similar locale could be located, we search for a locale
+ "en-US" inside the given locale list.
+
+ If "en-US" could not be located, we search for a locale "en"
+ inside the given list.
+
+ If no "same" nor any "similar" locale could be found, we try
+ "x-default" and "x-no-translate" explicitly. Sometimes
+ variables don't use real localization. For example, in case the
+ localized value is a fix product name.
+
+ If no locale matched until then, we use any other locale that
+ exists inside the set of given ones, namely the first
+ encountered!
+
+ @param rList
+ the vector of possible locales as BCP47 strings.
+
+ @param rReference
+ the reference locale, BCP47 string.
+
+ @return An iterator that points to the found element inside the given
+ locale list. If no matching locale could be found it points to
+ the beginning of the list.
+ */
+ static ::std::vector< OUString >::const_iterator getFallback( const ::std::vector< OUString > & rList,
+ const OUString & rReference );
+
+
+ /** @short Search for an equal or for a similar locale in a list
+ of possible ones where at least the language matches.
+
+ @descr First search for a locale that is equal to the reference
+ locale.
+
+ If the reference locale could not be located, check for
+ "similar" locales, in the same order as obtained by
+ getFallbackStrings().
+
+ If no locale matches, rList.end() is returned.
+
+ @param rList
+ the vector of possible locales.
+
+ @param rReference
+ the reference locale.
+
+ @return An iterator that points to the found element inside the given
+ locale list. If no matching locale could be found it points to
+ the end of the list.
+ */
+ static ::std::vector< css::lang::Locale >::const_iterator getMatchingFallback(
+ const ::std::vector< css::lang::Locale > & rList,
+ const css::lang::Locale & rReference );
+
+
+ /** Test equality of two LanguageTag, possibly resolving system locale.
+
+ Resolve empty language tags denoting the system
+ locale to the real locale used before comparing.
+ */
+ bool equals( const LanguageTag & rLanguageTag ) const;
+
+ /** Test equality of two LanguageTag.
+
+ Does NOT resolve system, i.e. if the system locale is en-US
+ LanguageTag("")==LanguageTag("en-US") returns false! Use
+ equals(...) instead if system locales shall be resolved.
+ */
+ bool operator==( const LanguageTag & rLanguageTag ) const;
+
+ /** Test inequality of two LanguageTag.
+
+ Does NOT resolve system, i.e. if the system locale is en-US
+ LanguageTag("")!=LanguageTag("en-US") returns true! Use
+ !equals(,..) instead if system locales shall be resolved.
+ */
+ bool operator!=( const LanguageTag & rLanguageTag ) const;
+
+ /** Test this LanguageTag less than that LanguageTag.
+
+ For sorted containers. Does NOT resolve system.
+ */
+ bool operator<( const LanguageTag & rLanguageTag ) const;
+
+ /** Convert MS-LangID to Locale.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return an empty Locale for such a tag.
+ */
+ static css::lang::Locale convertToLocale( LanguageType nLangID, bool bResolveSystem = true );
+
+ /** Convert Locale to MS-LangID.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return LANGUAGE_SYSTEM for such a tag.
+ */
+ static LanguageType convertToLanguageType( const css::lang::Locale& rLocale, bool bResolveSystem = true );
+
+ /** Convert MS-LangID to BCP 47 string.
+
+ Resolve an empty language tag denoting the system
+ locale to the real locale used.
+ */
+ static OUString convertToBcp47( LanguageType nLangID );
+
+ /** Convert Locale to BCP 47 string.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return an empty OUString for such a tag.
+ */
+ static OUString convertToBcp47( const css::lang::Locale& rLocale, bool bResolveSystem = true );
+
+ /** Convert BCP 47 string to Locale, convenience method.
+
+ NOTE: exists only for consistency with the other convertTo...()
+ methods, internally uses a temporary LanguageTag instance for
+ conversion so does not save anything compared to
+ LanguageTag(rBcp47).getLocale(bResolveSystem).
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return an empty Locale for such a tag.
+ */
+ static css::lang::Locale convertToLocale( const OUString& rBcp47, bool bResolveSystem = true );
+
+ /** Convert BCP 47 string to MS-LangID, convenience method.
+
+ NOTE: exists only for consistency with the other convertTo...()
+ methods, internally uses a temporary LanguageTag instance for
+ conversion so does not save anything compared to
+ LanguageTag(rBcp47).getLanguageType(bResolveSystem).
+
+ Resolve an empty language tag denoting the system
+ locale to the real locale used.
+ */
+ static LanguageType convertToLanguageType( const OUString& rBcp47 );
+
+ /** Convert BCP 47 string to MS-LangID with fallback, convenience method.
+
+ NOTE: exists only for consistency with the other convertTo...()
+ methods, internally uses a temporary LanguageTag instance for
+ conversion so does not save anything compared to
+ LanguageTag(rBcp47).makeFallback().getLanguageType(bResolveSystem).
+
+ @see makeFallback()
+
+ Always resolves an empty tag to the system locale.
+ */
+ static LanguageType convertToLanguageTypeWithFallback( const OUString& rBcp47 );
+
+ /** Convert BCP 47 string to Locale with fallback, convenience method.
+
+ NOTE: exists only for consistency with the other convertTo...()
+ methods, internally uses a temporary LanguageTag instance for
+ conversion so does not save anything compared to
+ LanguageTag(rBcp47).makeFallback().getLocale(bResolveSystem).
+
+ @see makeFallback()
+
+ Always resolves an empty tag to the system locale.
+ */
+ static css::lang::Locale convertToLocaleWithFallback( const OUString& rBcp47 );
+
+ /** Convert Locale to MS-LangID with fallback.
+
+ Resolves an empty language tag denoting the system
+ locale to LANGUAGE_SYSTEM and does not fallback.
+ */
+ static LanguageType convertToLanguageTypeWithFallback( const css::lang::Locale& rLocale );
+
+ /** If rString represents a valid BCP 47 language tag.
+
+ Never resolves an empty tag to the system locale, in fact an empty
+ string is invalid here. Does not create an instance to be registered
+ with a conversion to Locale or LanguageType.
+
+ @param o_pCanonicalized
+ If given and rString is a valid BCP 47 language tag, the
+ canonicalized form is assigned, which may differ from the
+ original string even if that was a valid tag. If rString is not
+ a valid tag, nothing is assigned.
+
+ @param bDisallowPrivate
+ If TRUE, valid tags according to BCP 47 but reserved for
+ private use, like 'x-...', are not allowed and FALSE is
+ returned in this case.
+ */
+ static bool isValidBcp47( const OUString& rString, OUString* o_pCanonicalized,
+ bool bDisallowPrivate = false );
+
+ /** If nLang is a generated on-the-fly LangID */
+ static bool isOnTheFlyID( LanguageType nLang );
+ static ScriptType getOnTheFlyScriptType( LanguageType nLang );
+
+ /** @ATTENTION: _ONLY_ to be called by the application's configuration! */
+ static void setConfiguredSystemLanguage( LanguageType nLang );
+
+ /** @ATTENTION: _ONLY_ to be called by fuzzing setup */
+ static void disable_lt_tag_parse();
+
+ typedef std::shared_ptr< LanguageTagImpl > ImplPtr;
+
+private:
+
+ mutable css::lang::Locale maLocale;
+ mutable OUString maBcp47;
+ mutable LanguageType mnLangID;
+ mutable ImplPtr mpImpl;
+ bool mbSystemLocale : 1;
+ mutable bool mbInitializedBcp47 : 1;
+ mutable bool mbInitializedLocale : 1;
+ mutable bool mbInitializedLangID : 1;
+ bool mbIsFallback : 1;
+
+ LanguageTagImpl* getImpl();
+ LanguageTagImpl const* getImpl() const;
+ ImplPtr registerImpl() const;
+ void syncFromImpl();
+ void syncVarsFromRawImpl() const;
+ void syncVarsFromImpl() const;
+
+ void convertLocaleToLang();
+ void convertBcp47ToLocale();
+ void convertBcp47ToLang();
+ void convertLangToLocale();
+
+ void convertFromRtlLocale();
+
+ /** Canonicalize if not yet done and synchronize initialized conversions.
+
+ @return whether BCP 47 language tag string was changed.
+ */
+ bool synCanonicalize();
+
+ void resetVars();
+
+ static bool isIsoLanguage( const OUString& rLanguage );
+ static bool isIsoScript( const OUString& rScript );
+ static bool isIsoCountry( const OUString& rRegion );
+
+};
+
+#endif // INCLUDED_I18NLANGTAG_LANGUAGETAG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/languagetagicu.hxx b/include/i18nlangtag/languagetagicu.hxx
new file mode 100644
index 000000000..430c483f3
--- /dev/null
+++ b/include/i18nlangtag/languagetagicu.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_LANGUAGETAGICU_HXX
+#define INCLUDED_I18NLANGTAG_LANGUAGETAGICU_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <i18nlangtag/i18nlangtagdllapi.h>
+#include <rtl/ustring.hxx>
+#include <unicode/locid.h>
+
+class LanguageTag;
+
+
+/** Interface LanguageTag to ICU's icu::Locale
+
+ Separated from LanguageTag to not pollute the entire code base (and thus
+ makefiles) with ICU header file inclusion, only the few code actually using
+ this needs to know about ICU, which it did anyway.
+*/
+class SAL_WARN_UNUSED I18NLANGTAG_DLLPUBLIC LanguageTagIcu
+{
+public:
+
+ /** Obtain language tag as ICU icu::Locale.
+
+ If the language tag is a "pure" ISO locale (see
+ LanguageTag::getLocale()) that is directly constructed, otherwise it is
+ converted using the available ICU mechanisms.
+
+ Always resolves an empty tag to the system locale.
+ */
+ static icu::Locale getIcuLocale( const LanguageTag & rLanguageTag );
+
+ /** Obtain language tag as ICU icu::Locale, adding variant data.
+
+ From the LanguageTag only language and country are used to construct
+ the icu:Locale, the variant field is copied from rVariant.
+ The 4th arg of icu::Locale "keywords" (eg: for collation)
+
+ Always resolves an empty tag to the system locale.
+ */
+ static icu::Locale getIcuLocale( const LanguageTag & rLanguageTag, std::u16string_view rVariant, std::u16string_view rKeywords);
+
+ /** Obtain the display name for a language tag.
+
+ Gets a localized name from icu::Locale::getDisplayName(). Meant to be
+ used only with language tags that do not have a language list entry in
+ svtools/inc/langtab.hrc STR_ARR_SVT_LANGUAGE_TABLE, thus used by
+ SvtLanguageTable::GetLanguageString()
+
+ @param rLanguageTag
+ The language tag for which the name is to be displayed.
+
+ @param rDisplayLanguage
+ The language in which the name is to be displayed.
+ Usually Application::GetSettings().GetUILanguageTag().
+ */
+ static OUString getDisplayName( const LanguageTag & rLanguageTag, const LanguageTag & rDisplayLanguage );
+};
+
+#endif // INCLUDED_I18NLANGTAG_LANGUAGETAGICU_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/mslangid.hxx b/include/i18nlangtag/mslangid.hxx
new file mode 100644
index 000000000..1d2f5cc8c
--- /dev/null
+++ b/include/i18nlangtag/mslangid.hxx
@@ -0,0 +1,338 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_MSLANGID_HXX
+#define INCLUDED_I18NLANGTAG_MSLANGID_HXX
+
+#include <sal/config.h>
+
+#include <i18nlangtag/i18nlangtagdllapi.h>
+#include <i18nlangtag/lang.h>
+#include <com/sun/star/lang/Locale.hpp>
+
+#include <string_view>
+#include <utility>
+#include <vector>
+
+struct IsoLanguageCountryEntry;
+struct IsoLanguageScriptCountryEntry;
+struct Bcp47CountryEntry;
+
+/** Methods related to Microsoft language IDs. For details about MS-LANGIDs
+ please see lang.h */
+class SAL_WARN_UNUSED I18NLANGTAG_DLLPUBLIC MsLangId
+{
+public:
+
+ /// Create a LangID from a primary and a sublanguage.
+ static LanguageType makeLangID( LanguageType nSubLangId, LanguageType nPriLangId)
+ {
+ return LanguageType((sal_uInt16(nSubLangId) << 10) | sal_uInt16(nPriLangId));
+ }
+
+ /// Get the primary language of a LangID.
+ static LanguageType getPrimaryLanguage( LanguageType nLangID)
+ {
+ return LanguageType(sal_uInt16(nLangID) & LANGUAGE_MASK_PRIMARY);
+ }
+
+ /// Get the sublanguage of a LangID.
+ static LanguageType getSubLanguage( LanguageType nLangID)
+ {
+ return LanguageType((sal_uInt16(nLangID) & ~LANGUAGE_MASK_PRIMARY) >> 10);
+ }
+
+ /** Get the configured system language/locale.
+ If not set yet then getSystemLanguage().
+
+ Prefer this over getSystemLanguage() unless you exactly know why you
+ would not. */
+ static LanguageType getConfiguredSystemLanguage();
+
+ /** Get the configured system UI language/locale.
+ If not set yet then getSystemUILanguage().
+
+ Prefer this over getSystemUILanguage() unless you exactly know why you
+ would not. */
+ static LanguageType getConfiguredSystemUILanguage();
+
+
+ /** Language/locale of category LC_CTYPE (on Unix, else the system
+ language).
+ Evaluation order: LC_ALL, LC_CTYPE, LANG
+ Note this may return an unknown unsupported locale. */
+ static LanguageType getSystemLanguage();
+
+ /** Language/locale of category LC_MESSAGES (on Unix, else same as
+ getSystemLanguage()).
+ Evaluation order: LANGUAGE, LC_ALL, LC_MESSAGES, LANG
+ Note this may return an unknown unsupported locale. */
+ static LanguageType getSystemUILanguage();
+
+
+ /** @short: A proper language/locale if the nLang parameter designates some
+ special value.
+
+ @descr: NOTE: The "system" values may be overridden by the
+ application's configuration.
+
+ @returns
+ case LANGUAGE_PROCESS_OR_USER_DEFAULT : configured or system language
+ case LANGUAGE_SYSTEM_DEFAULT : configured or system language
+ case LANGUAGE_SYSTEM : configured or system language
+ case LANGUAGE_HID_HUMAN_INTERFACE_DEVICE : configured or system UI language
+ case LANGUAGE_DONTKNOW : LANGUAGE_ENGLISH_US
+ else: nLang
+
+ In case the configured language is LANGUAGE_SYSTEM, which is also
+ the initial default, the system language is obtained. In case the
+ configured or resulting system language is LANGUAGE_DONTKNOW,
+ LANGUAGE_ENGLISH_US is returned instead.
+ */
+ static LanguageType getRealLanguage( LanguageType nLang );
+
+
+ // TODO: refactor to LanguageTag? Used only in
+ // i18npool/source/localedata/localedata.cxx
+
+ /** Get fall-back Locale for Locale with handling of an empty language name
+ designating the SYSTEM language. Returns the same Locale if an exact
+ match was found.
+ */
+ static css::lang::Locale getFallbackLocale( const css::lang::Locale & rLocale );
+
+
+ // TODO: refactor to LanguageTag, used only in
+ // i18npool/source/isolang/inunx.cxx to convert Unix locale string
+
+ static LanguageType convertUnxByteStringToLanguage( std::string_view rString );
+
+
+ static LanguageType resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType );
+
+
+ /** Whether the language uses hyphenation. */
+ static bool usesHyphenation( LanguageType nLang );
+
+ /** Whether locale has a Right-To-Left orientation for text. */
+ static bool isRightToLeft( LanguageType nLang );
+
+ /** Whether locale has a Right-To-Left orientation for math. */
+ static bool isRightToLeftMath( LanguageType nLang );
+
+ /** Whether locale is a CJK locale */
+ static bool isCJK( LanguageType nLang );
+
+ /** Whether locale is a chinese locale */
+ static bool isChinese( LanguageType nLang );
+
+ /** Whether locale is a simplified chinese locale */
+ static bool isSimplifiedChinese( LanguageType nLang );
+
+ /** Whether locale is a traditional chinese locale */
+ static bool isTraditionalChinese( LanguageType nLang );
+
+ /** Whether locale is a korean locale */
+ static bool isKorean( LanguageType nLang );
+
+ /** Whether locale is a simplified chinese locale */
+ static bool isSimplifiedChinese( const css::lang::Locale & rLocale );
+
+ /** Whether locale is a traditional chinese locale */
+ static bool isTraditionalChinese( const css::lang::Locale & rLocale );
+
+ /** Whether locale is one where family name comes first, e.g. Japan, Hungary, Samoa */
+ static bool isFamilyNameFirst( LanguageType nLang );
+
+ /** Whether there are "forbidden characters at start or end of line" in
+ this locale. CJK locales.
+
+ @see offapi/com/sun/star/i18n/ForbiddenCharacters.idl
+ */
+ static bool hasForbiddenCharacters( LanguageType nLang );
+
+
+ /** Whether locale needs input sequence checking. CTL locales. */
+ static bool needsSequenceChecking( LanguageType nLang );
+
+
+ /** Get css::i18n::ScriptType of locale. */
+ static sal_Int16 getScriptType( LanguageType nLang );
+
+ /** Whether locale is "Western" but not Latin script, e.g. Cyrillic or Greek. */
+ static bool isNonLatinWestern( LanguageType nLang );
+
+
+ /** Map an obsolete user defined LANGID (see lang.h
+ LANGUAGE_OBSOLETE_USER_...) to the new value defined by MS in the
+ meantime.
+
+ Also used to map UI localizations using reserved ISO codes to something
+ "official" but not identical in order to not pollute documents with
+ invalid ISO codes.
+ */
+ static LanguageType getReplacementForObsoleteLanguage( LanguageType nLang );
+
+ /** Whether locale is legacy, i.e. country or confederation doesn't exist anymore. */
+ static bool isLegacy( LanguageType nLang );
+
+
+ /** @ATTENTION: these are _ONLY_ to be called by the application's
+ configuration! */
+ static void setConfiguredSystemUILanguage( LanguageType nLang );
+ static void setConfiguredWesternFallback( LanguageType nLang );
+ static void setConfiguredComplexFallback( LanguageType nLang );
+ static void setConfiguredAsianFallback( LanguageType nLang );
+
+
+ /** Encapsulated methods that shall only be accessed through
+ class LanguageTag.
+ */
+ class LanguageTagAccess
+ {
+ private:
+
+ friend class LanguageTag;
+
+ /** Configured system locale needs always be synchronized with
+ LanguageTag's system locale.
+ */
+ I18NLANGTAG_DLLPRIVATE static void setConfiguredSystemLanguage( LanguageType nLang );
+ };
+
+
+ struct LanguagetagMapping
+ {
+ OUString maBcp47;
+ LanguageType mnLang;
+
+ LanguagetagMapping( OUString aBcp47, LanguageType nLang ) : maBcp47(std::move(aBcp47)), mnLang(nLang) {}
+ };
+
+ /** @internal - Obtain a list of known locales (i.e. those that have a
+ defined mapping between MS-LangID and ISO codes or tags) as BCP 47
+ language tag strings.
+ */
+ static ::std::vector< LanguagetagMapping > getDefinedLanguagetags();
+
+
+ /** Encapsulated conversion methods used by LanguageTag and conversions,
+ not to be used by anything else.
+ */
+ class Conversion
+ {
+ private:
+
+ friend class LanguageTag;
+ friend class LanguageTagImpl;
+
+ friend css::lang::Locale MsLangId::getFallbackLocale(
+ const css::lang::Locale & rLocale );
+
+ friend LanguageType MsLangId::convertUnxByteStringToLanguage(
+ std::string_view rString );
+
+
+ /** Convert a Locale to a LanguageType with handling of an empty
+ language name designating LANGUAGE_SYSTEM.
+ */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertLocaleToLanguage(
+ const css::lang::Locale & rLocale );
+
+ /** Used by convertLocaleToLanguage(Locale) */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertLocaleToLanguageImpl(
+ const css::lang::Locale & rLocale );
+
+ /** Convert x-... privateuse, used by convertLocaleToLanguageImpl(Locale) */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertPrivateUseToLanguage(
+ const OUString& rPriv );
+
+ /** Used by LanguageTag::canonicalize() */
+ I18NLANGTAG_DLLPRIVATE static css::lang::Locale getOverride(
+ const css::lang::Locale & rLocale );
+
+ /** Used by convertLocaleToLanguageImpl(Locale) and LanguageTagImpl::convertLocaleToLang() */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertIsoNamesToLanguage(
+ const OUString& rLang, const OUString& rCountry, bool bSkipIsoTable );
+
+
+ /** Used by convertUnxByteStringToLanguage(OString) */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertIsoNamesToLanguage(
+ std::string_view rLang, std::string_view rCountry );
+
+
+ /** Used by lookupFallbackLocale(Locale) */
+ I18NLANGTAG_DLLPRIVATE static css::lang::Locale getLocale(
+ const IsoLanguageCountryEntry * pEntry );
+
+ /** Used by lookupFallbackLocale(Locale) */
+ I18NLANGTAG_DLLPRIVATE static css::lang::Locale getLocale(
+ const IsoLanguageScriptCountryEntry * pEntry );
+
+ /** Used by lookupFallbackLocale(Locale) */
+ I18NLANGTAG_DLLPRIVATE static css::lang::Locale getLocale(
+ const Bcp47CountryEntry * pEntry );
+
+
+ /** Convert a LanguageType to a Locale. */
+ I18NLANGTAG_DLLPRIVATE static css::lang::Locale convertLanguageToLocale(
+ LanguageType nLang );
+
+ /** Used by convertLanguageToLocale(LanguageType,bool) and
+ getLocale(IsoLanguageCountryEntry*) and
+ getLocale(IsoLanguageScriptCountryEntry)
+
+ @param bIgnoreOverride
+ If bIgnoreOverride==true, a matching entry is used even if
+ mnOverride is set, for conversion to an even outdated tag.
+ If bIgnoreOverride==false, a matching entry is skipped if
+ mnOverride is set and instead the override is followed.
+
+ @return rLocale set to mapped values, unchanged if no mapping was
+ found. E.g. pass empty Locale to obtain empty SYSTEM locale
+ for that case.
+ */
+ I18NLANGTAG_DLLPRIVATE static void convertLanguageToLocaleImpl(
+ LanguageType nLang, css::lang::Locale & rLocale, bool bIgnoreOverride );
+
+
+ I18NLANGTAG_DLLPRIVATE static css::lang::Locale lookupFallbackLocale(
+ const css::lang::Locale & rLocale );
+ };
+
+private:
+
+ static LanguageType nConfiguredSystemLanguage;
+ static LanguageType nConfiguredSystemUILanguage;
+
+ static LanguageType nConfiguredWesternFallback;
+ static LanguageType nConfiguredAsianFallback;
+ static LanguageType nConfiguredComplexFallback;
+
+ static LanguageType getPlatformSystemLanguage();
+ static LanguageType getPlatformSystemUILanguage();
+
+ // Substitute LANGUAGE_SYSTEM for LANGUAGE_SYSTEM_DEFAULT and
+ // LANGUAGE_PROCESS_OR_USER_DEFAULT, other values aren't touched.
+ I18NLANGTAG_DLLPRIVATE static inline LanguageType simplifySystemLanguages( LanguageType nLang );
+};
+
+#endif // INCLUDED_I18NLANGTAG_MSLANGID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18npool/reservedconstants.hxx b/include/i18npool/reservedconstants.hxx
new file mode 100644
index 000000000..6f707f83a
--- /dev/null
+++ b/include/i18npool/reservedconstants.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/types.h>
+
+/** Constant values shared between i18npool and, for example, the number formatter. */
+namespace i18npool
+{
+/** The number of predefined format code indices that must be defined by
+ locale data, except BOOLEAN and TEXT, exclusive.
+ This later in the build is static asserted to be equal to
+ NfIndexTableOffset::NF_INDEX_TABLE_RESERVED_START. */
+constexpr sal_Int16 nStopPredefinedFormatIndex = 51;
+
+/** The number of reserved (with defined meaning) built-in format code indices,
+ additional locale data format codes can be defined starting at this index
+ value.
+ This later in the build is static asserted to be greater or equal to
+ NfIndexTableOffset::NF_INDEX_TABLE_ENTRIES */
+constexpr sal_Int16 nFirstFreeFormatIndex = 66;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/i18nutil/calendar.hxx b/include/i18nutil/calendar.hxx
new file mode 100644
index 000000000..86a5beacd
--- /dev/null
+++ b/include/i18nutil/calendar.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+namespace i18nutil
+{
+/** This number shows month days without Jan and Feb.
+ * According to the article, it is calculated as (365-31-28)/10 = 30.6, but because
+ * of a floating point bug, it was used as 30.6001 as a workaround.
+ *
+ * "30.6001, 25 year old hack?"
+ * https://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv011.cgi?read=31650 */
+constexpr double monthDaysWithoutJanFeb = (365 - 31 - 28) / 10.0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/i18nutil/casefolding.hxx b/include/i18nutil/casefolding.hxx
new file mode 100644
index 000000000..b15a51ae8
--- /dev/null
+++ b/include/i18nutil/casefolding.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_CASEFOLDING_HXX
+#define INCLUDED_I18NUTIL_CASEFOLDING_HXX
+
+#include <sal/types.h>
+#include <i18nutil/i18nutildllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <config_options.h>
+
+namespace com::sun::star::lang { struct Locale; }
+
+enum class TransliterationFlags;
+
+enum class MappingType {
+ NONE = 0x00,
+ LowerToUpper = 0x01, // Upper to Lower mapping
+ UpperToLower = 0x02, // Lower to Upper mapping
+ ToUpper = 0x04, // to Upper mapping
+ ToLower = 0x08, // to Lower mapping
+ ToTitle = 0x10, // to Title mapping
+ SimpleFolding = 0x20, // Simple Case Folding
+ FullFolding = 0x40, // Full Case Folding
+ // for final sigma (where the case-mapping is different for the last letter of a word)
+ CasedLetterMask = LowerToUpper | UpperToLower | ToUpper | ToLower | ToTitle | SimpleFolding | FullFolding,
+ NotValue = 0x80, // Value field is an address
+};
+namespace o3tl {
+ template<> struct typed_flags<MappingType> : is_typed_flags<MappingType, 0xff> {};
+}
+
+namespace i18nutil {
+
+struct Value
+{
+ sal_uInt8 type;
+ sal_uInt16 value; // value or address, depend on the type
+};
+
+struct Mapping
+{
+ sal_uInt8 type;
+ sal_Int8 nmap;
+#define NMAPPINGMAX 3
+ sal_Unicode map[NMAPPINGMAX];
+}; // for Unconditional mapping
+
+struct MappingElement
+{
+ MappingElement()
+ : current(0)
+ {
+ element.type = element.nmap = 0;
+ }
+ Mapping element;
+ sal_Int8 current;
+};
+
+class UNLESS_MERGELIBS(I18NUTIL_DLLPUBLIC) casefolding
+{
+public:
+ /// @throws css::uno::RuntimeException
+ static Mapping getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType);
+ /// @throws css::uno::RuntimeException
+ static const Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType);
+ /// @throws css::uno::RuntimeException
+ static sal_Unicode getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e, css::lang::Locale const & aLocale, MappingType nMappingtype, TransliterationFlags moduleLoaded);
+
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/i18nutildllapi.h b/include/i18nutil/i18nutildllapi.h
new file mode 100644
index 000000000..9797e87a3
--- /dev/null
+++ b/include/i18nutil/i18nutildllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NUTIL_I18NUTILDLLAPI_H
+#define INCLUDED_I18NUTIL_I18NUTILDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(I18NUTIL_DLLIMPLEMENTATION)
+#define I18NUTIL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define I18NUTIL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define I18NUTIL_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_I18NUTIL_I18NUTILDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/oneToOneMapping.hxx b/include/i18nutil/oneToOneMapping.hxx
new file mode 100644
index 000000000..bc659b30a
--- /dev/null
+++ b/include/i18nutil/oneToOneMapping.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_ONETOONEMAPPING_HXX
+#define INCLUDED_I18NUTIL_ONETOONEMAPPING_HXX
+
+#include <i18nutil/i18nutildllapi.h>
+#include <memory>
+#include <config_options.h>
+
+namespace i18nutil {
+
+struct OneToOneMappingTable_t
+{
+ sal_Unicode first;
+ sal_Unicode second;
+};
+
+typedef sal_Int8 UnicodePairFlag;
+struct UnicodePairWithFlag
+{
+ sal_Unicode first;
+ sal_Unicode second;
+ UnicodePairFlag flag;
+};
+
+class UNLESS_MERGELIBS(I18NUTIL_DLLPUBLIC) oneToOneMapping
+{
+private:
+ oneToOneMapping(const oneToOneMapping&) = delete;
+ oneToOneMapping& operator=(const oneToOneMapping&) = delete;
+public:
+ oneToOneMapping( OneToOneMappingTable_t const *rpTable, const size_t rnSize, const size_t rnUnitSize = sizeof(OneToOneMappingTable_t) );
+ virtual ~oneToOneMapping();
+
+ // binary search
+ virtual sal_Unicode find( const sal_Unicode nKey ) const;
+
+ // translator
+ sal_Unicode operator[] ( const sal_Unicode nKey ) const { return find( nKey ); };
+
+protected:
+ OneToOneMappingTable_t const *mpTable;
+ size_t mnSize;
+};
+
+class oneToOneMappingWithFlag final : public oneToOneMapping
+{
+private:
+ oneToOneMappingWithFlag(const oneToOneMappingWithFlag&) = delete;
+ oneToOneMappingWithFlag& operator=(const oneToOneMappingWithFlag&) = delete;
+
+ friend class widthfolding;
+
+public:
+ oneToOneMappingWithFlag( UnicodePairWithFlag const *rpTableWF, const size_t rnSize, const UnicodePairFlag rnFlag );
+ virtual ~oneToOneMappingWithFlag() override;
+
+ // make index for fast search
+ void makeIndex();
+
+ // index search
+ virtual sal_Unicode find( const sal_Unicode nKey ) const override;
+private:
+ UnicodePairWithFlag const *mpTableWF;
+ UnicodePairFlag mnFlag;
+ std::unique_ptr<UnicodePairWithFlag const *[]> mpIndex[256];
+ bool mbHasIndex;
+};
+
+}
+
+#endif // _I18N_TRANSLITERATION_ONETOONEMAPPING_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/paper.hxx b/include/i18nutil/paper.hxx
new file mode 100644
index 000000000..b84d7b3af
--- /dev/null
+++ b/include/i18nutil/paper.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NUTIL_PAPER_HXX
+#define INCLUDED_I18NUTIL_PAPER_HXX
+
+#include <i18nutil/i18nutildllapi.h>
+#include <rtl/string.hxx>
+#include <tools/long.hxx>
+
+namespace com::sun::star::lang
+{
+struct Locale;
+}
+
+//!! The values of the following enumerators must correspond to the array position
+//!! of the respective paper size in the file i18nutil/source/utility/paper.cxx
+//!! Thus don't reorder the enum values here without changing the code there as well.
+
+//!! Also the RID_STR_PAPERNAMES array in vcl/inc/print.hrc and the
+//!! PaperIndex array in Printer::GetPaperName() in
+//!! vcl/source/gdi/print.cxx are parallel to this enum.
+enum Paper : unsigned
+{
+ PAPER_A0,
+ PAPER_A1,
+ PAPER_A2,
+ PAPER_A3,
+ PAPER_A4,
+ PAPER_A5,
+ PAPER_B4_ISO,
+ PAPER_B5_ISO,
+ PAPER_LETTER,
+ PAPER_LEGAL,
+ PAPER_TABLOID,
+ PAPER_USER,
+ PAPER_B6_ISO,
+ PAPER_ENV_C4,
+ PAPER_ENV_C5,
+ PAPER_ENV_C6,
+ PAPER_ENV_C65,
+ PAPER_ENV_DL,
+ PAPER_SLIDE_DIA,
+ PAPER_SCREEN_4_3,
+ PAPER_C,
+ PAPER_D,
+ PAPER_E,
+ PAPER_EXECUTIVE,
+ PAPER_FANFOLD_LEGAL_DE,
+ PAPER_ENV_MONARCH,
+ PAPER_ENV_PERSONAL,
+ PAPER_ENV_9,
+ PAPER_ENV_10,
+ PAPER_ENV_11,
+ PAPER_ENV_12,
+ PAPER_KAI16,
+ PAPER_KAI32,
+ PAPER_KAI32BIG,
+ PAPER_B4_JIS,
+ PAPER_B5_JIS,
+ PAPER_B6_JIS,
+ PAPER_LEDGER,
+ PAPER_STATEMENT,
+ PAPER_QUARTO,
+ PAPER_10x14,
+ PAPER_ENV_14,
+ PAPER_ENV_C3,
+ PAPER_ENV_ITALY,
+ PAPER_FANFOLD_US,
+ PAPER_FANFOLD_DE,
+ PAPER_POSTCARD_JP,
+ PAPER_9x11,
+ PAPER_10x11,
+ PAPER_15x11,
+ PAPER_ENV_INVITE,
+ PAPER_A_PLUS,
+ PAPER_B_PLUS,
+ PAPER_LETTER_PLUS,
+ PAPER_A4_PLUS,
+ PAPER_DOUBLEPOSTCARD_JP,
+ PAPER_A6,
+ PAPER_12x11,
+ PAPER_A7,
+ PAPER_A8,
+ PAPER_A9,
+ PAPER_A10,
+ PAPER_B0_ISO,
+ PAPER_B1_ISO,
+ PAPER_B2_ISO,
+ PAPER_B3_ISO,
+ PAPER_B7_ISO,
+ PAPER_B8_ISO,
+ PAPER_B9_ISO,
+ PAPER_B10_ISO,
+ PAPER_ENV_C2,
+ PAPER_ENV_C7,
+ PAPER_ENV_C8,
+ PAPER_ARCHA,
+ PAPER_ARCHB,
+ PAPER_ARCHC,
+ PAPER_ARCHD,
+ PAPER_ARCHE,
+ PAPER_SCREEN_16_9,
+ PAPER_SCREEN_16_10,
+ PAPER_16K_195x270,
+ PAPER_16K_197x273,
+ PAPER_WIDESCREEN, //PowerPoint Widescreen
+ PAPER_ONSCREENSHOW_4_3, //PowerPoint On-screen Show (4:3)
+ PAPER_ONSCREENSHOW_16_9, //PowerPoint On-screen Show (16:9)
+ PAPER_ONSCREENSHOW_16_10 //PowerPoint On-screen Show (16:10)
+};
+
+// defined for 'equal size' test with the implementation array
+#define NUM_PAPER_ENTRIES (PAPER_ONSCREENSHOW_16_10 - PAPER_A0 + 1)
+
+class I18NUTIL_DLLPUBLIC PaperInfo
+{
+ Paper m_eType;
+ tools::Long m_nPaperWidth; // width in 100thMM
+ tools::Long m_nPaperHeight; // height in 100thMM
+public:
+ PaperInfo(Paper eType);
+ PaperInfo(tools::Long nPaperWidth, tools::Long nPaperHeight);
+
+ Paper getPaper() const { return m_eType; }
+ tools::Long getWidth() const { return m_nPaperWidth; }
+ tools::Long getHeight() const { return m_nPaperHeight; }
+ bool sloppyEqual(const PaperInfo& rOther) const;
+ void doSloppyFit(bool bAlsoTryRotated = false);
+
+ static PaperInfo getSystemDefaultPaper();
+ static PaperInfo getDefaultPaperForLocale(const css::lang::Locale& rLocale);
+
+ static Paper fromPSName(const OString& rName);
+ static OString toPSName(Paper eType);
+
+ static tools::Long sloppyFitPageDimension(tools::Long nDimension);
+};
+
+#endif // INCLUDED_I18NUTIL_PAPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/scripttypedetector.hxx b/include/i18nutil/scripttypedetector.hxx
new file mode 100644
index 000000000..a3d4d8ed2
--- /dev/null
+++ b/include/i18nutil/scripttypedetector.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_SCRIPTTYPEDETECTOR_HXX
+#define INCLUDED_I18NUTIL_SCRIPTTYPEDETECTOR_HXX
+
+#include <i18nutil/i18nutildllapi.h>
+#include <rtl/ustring.hxx>
+
+class I18NUTIL_DLLPUBLIC ScriptTypeDetector
+{
+public:
+ static sal_Int32 beginOfScriptDirection( std::u16string_view Text, sal_Int32 nPos, sal_Int16 scriptDirection );
+ static sal_Int32 endOfScriptDirection( std::u16string_view Text, sal_Int32 nPos, sal_Int16 scriptDirection );
+ static sal_Int16 getScriptDirection( std::u16string_view Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection );
+ static sal_Int32 beginOfCTLScriptType( std::u16string_view Text, sal_Int32 nPos );
+ static sal_Int32 endOfCTLScriptType( std::u16string_view Text, sal_Int32 nPos );
+ static sal_Int16 getCTLScriptType(std::u16string_view Text, sal_Int32 nPos );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/searchopt.hxx b/include/i18nutil/searchopt.hxx
new file mode 100644
index 000000000..c215da0d2
--- /dev/null
+++ b/include/i18nutil/searchopt.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_SEARCHOPT_HXX
+#define INCLUDED_I18NUTIL_SEARCHOPT_HXX
+
+#include <sal/types.h>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/util/SearchAlgorithms.hpp>
+#include <com/sun/star/util/SearchOptions2.hpp>
+#include <i18nutil/transliteration.hxx>
+#include <utility>
+
+namespace i18nutil
+{
+
+/**
+ * This is a wrapper around com::sun::star::util::SearchOptions
+ * but using the more type-safe TransliterationFlags enum.
+ */
+struct SAL_WARN_UNUSED SearchOptions {
+ css::util::SearchAlgorithms algorithmType;
+ sal_Int32 searchFlag;
+ OUString searchString;
+ OUString replaceString;
+ css::lang::Locale Locale;
+ sal_Int32 changedChars;
+ sal_Int32 deletedChars;
+ sal_Int32 insertedChars;
+ TransliterationFlags transliterateFlags;
+
+ SearchOptions& operator=(css::util::SearchOptions const & other)
+ {
+ algorithmType = other.algorithmType;
+ searchFlag = other.searchFlag;
+ searchString = other.searchString;
+ replaceString = other.replaceString;
+ Locale = other.Locale;
+ changedChars = other.changedChars;
+ deletedChars = other.deletedChars;
+ insertedChars = other.insertedChars;
+ transliterateFlags = static_cast<TransliterationFlags>(other.transliterateFlags);
+ return *this;
+ }
+
+ SearchOptions()
+ : algorithmType(::css::util::SearchAlgorithms_ABSOLUTE)
+ , searchFlag(0)
+ , changedChars(0)
+ , deletedChars(0)
+ , insertedChars(0)
+ , transliterateFlags(TransliterationFlags::NONE)
+ {
+ }
+
+ SearchOptions(const css::util::SearchAlgorithms& algorithmType_, const sal_Int32 searchFlag_,
+ OUString searchString_, OUString replaceString_,
+ css::lang::Locale Locale_,
+ const sal_Int32 changedChars_, const sal_Int32 deletedChars_, const sal_Int32 insertedChars_,
+ const TransliterationFlags& transliterateFlags_)
+ : algorithmType(algorithmType_)
+ , searchFlag(searchFlag_)
+ , searchString(std::move(searchString_))
+ , replaceString(std::move(replaceString_))
+ , Locale(std::move(Locale_))
+ , changedChars(changedChars_)
+ , deletedChars(deletedChars_)
+ , insertedChars(insertedChars_)
+ , transliterateFlags(transliterateFlags_)
+ {
+ }
+};
+
+/**
+ * This is a wrapper around com::sun::star::util::SearchOptions and SearchOptions2,
+ * but using the more type-safe TransliterationFlags enum.
+ */
+struct SAL_WARN_UNUSED SearchOptions2 : public SearchOptions {
+
+ sal_Int16 AlgorithmType2;
+ sal_Int32 WildcardEscapeCharacter;
+
+ SearchOptions2& operator=(css::util::SearchOptions2 const & other)
+ {
+ SearchOptions::operator=(other);
+ AlgorithmType2 = other.AlgorithmType2;
+ WildcardEscapeCharacter = other.WildcardEscapeCharacter;
+ return *this;
+ }
+
+
+ css::util::SearchOptions2 toUnoSearchOptions2() const
+ {
+ return css::util::SearchOptions2(algorithmType, searchFlag,
+ searchString, replaceString,
+ Locale,
+ changedChars, deletedChars, insertedChars,
+ static_cast<sal_Int32>(transliterateFlags),
+ AlgorithmType2, WildcardEscapeCharacter);
+ }
+
+ SearchOptions2()
+ : AlgorithmType2(0)
+ , WildcardEscapeCharacter(0)
+ {}
+
+ SearchOptions2(const css::util::SearchAlgorithms& algorithmType_, const sal_Int32 searchFlag_,
+ const OUString& searchString_, const OUString& replaceString_,
+ const css::lang::Locale& Locale_,
+ const sal_Int32 changedChars_, const sal_Int32 deletedChars_, const sal_Int32 insertedChars_,
+ const TransliterationFlags& transliterateFlags_,
+ const sal_Int16 AlgorithmType2_, const sal_Int32 WildcardEscapeCharacter_)
+ : SearchOptions(algorithmType_, searchFlag_, searchString_, replaceString_, Locale_, changedChars_, deletedChars_, insertedChars_, transliterateFlags_)
+ , AlgorithmType2(AlgorithmType2_)
+ , WildcardEscapeCharacter(WildcardEscapeCharacter_)
+ {}
+};
+
+}; // namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/transliteration.hxx b/include/i18nutil/transliteration.hxx
new file mode 100644
index 000000000..7de575999
--- /dev/null
+++ b/include/i18nutil/transliteration.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_TRANSLITERATION_HXX
+#define INCLUDED_I18NUTIL_TRANSLITERATION_HXX
+
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
+#include <o3tl/typed_flags_set.hxx>
+
+/**
+ * This is a superset type of the com::sun::star::i18n::TransliterationModules and TransliterationModulesExtra,
+ * with some extra type checking
+ */
+enum class TransliterationFlags {
+ NONE = 0,
+ /// Transliterate a string from upper case to lower case
+ UPPERCASE_LOWERCASE = int(css::i18n::TransliterationModules_UPPERCASE_LOWERCASE),
+ /// Transliterate a string from lower case to upper case
+ LOWERCASE_UPPERCASE = int(css::i18n::TransliterationModules_LOWERCASE_UPPERCASE),
+ /// Transliterate a string from half width character to full width character
+ HALFWIDTH_FULLWIDTH = int(css::i18n::TransliterationModules_HALFWIDTH_FULLWIDTH),
+ /// Transliterate a string from full width character to half width character
+ FULLWIDTH_HALFWIDTH = int(css::i18n::TransliterationModules_FULLWIDTH_HALFWIDTH),
+ /// Transliterate a Japanese string from Katakana to Hiragana
+ KATAKANA_HIRAGANA = int(css::i18n::TransliterationModules_KATAKANA_HIRAGANA),
+ /// Transliterate a Japanese string from Hiragana to Katakana
+ HIRAGANA_KATAKANA = int(css::i18n::TransliterationModules_HIRAGANA_KATAKANA),
+ /// Transliterate an ASCII number string to Simplified Chinese lower case number string in spellout format
+ NumToTextLower_zh_CN = int(css::i18n::TransliterationModules_NumToTextLower_zh_CN),
+ /// Transliterate an ASCII number string to Simplified Chinese upper case number string in spellout format
+ NumToTextUpper_zh_CN = int(css::i18n::TransliterationModules_NumToTextUpper_zh_CN),
+ /// Transliterate an ASCII number string to Traditional Chinese lower case number string in spellout format
+ NumToTextLower_zh_TW = int(css::i18n::TransliterationModules_NumToTextLower_zh_TW),
+ /// Transliterate an ASCII number string to Traditional Chinese upper case number string in spellout format
+ NumToTextUpper_zh_TW = int(css::i18n::TransliterationModules_NumToTextUpper_zh_TW),
+ /// Transliterate an ASCII number string to formal Korean Hangul number string in spellout format
+ NumToTextFormalHangul_ko = int(css::i18n::TransliterationModules_NumToTextFormalHangul_ko),
+ /// Transliterate an ASCII number string to formal Korean Hanja lower case number string in spellout format
+ NumToTextFormalLower_ko = int(css::i18n::TransliterationModules_NumToTextFormalLower_ko),
+ /// Transliterate an ASCII number string to formal Korean Hanja upper case number string in spellout format
+ NumToTextFormalUpper_ko = int(css::i18n::TransliterationModules_NumToTextFormalUpper_ko),
+
+ /** The first character of the sentence is put in upper case
+ */
+ SENTENCE_CASE = int(css::i18n::TransliterationModulesExtra::SENTENCE_CASE),
+
+
+ /** The first character of the word is put in upper case.
+ * This one is part
+ */
+ TITLE_CASE = int(css::i18n::TransliterationModulesExtra::TITLE_CASE),
+
+
+ /** All characters of the word are to change their case from small letters
+ * to capital letters and vice versa.
+ */
+ TOGGLE_CASE = int(css::i18n::TransliterationModulesExtra::TOGGLE_CASE),
+
+ NON_IGNORE_MASK = int(css::i18n::TransliterationModules_NON_IGNORE_MASK),
+ IGNORE_MASK = 0x7fffff00,
+
+ /// Ignore case when comparing strings by transliteration service
+ IGNORE_CASE = int(css::i18n::TransliterationModules_IGNORE_CASE),
+ /// Ignore Hiragana and Katakana when comparing strings by transliteration service
+ IGNORE_KANA = int(css::i18n::TransliterationModules_IGNORE_KANA), // ja_JP
+ /// Ignore full width and half width character when comparing strings by transliteration service
+ IGNORE_WIDTH = int(css::i18n::TransliterationModules_IGNORE_WIDTH), // ja_JP
+ /// Ignore Japanese traditional Kanji character in Japanese fuzzy search
+ ignoreTraditionalKanji_ja_JP = int(css::i18n::TransliterationModules_IgnoreTraditionalKanji_ja_JP),
+ /// Ignore Japanese traditional Katakana and Hiragana character in Japanese fuzzy search
+ ignoreTraditionalKana_ja_JP = int(css::i18n::TransliterationModules_IgnoreTraditionalKana_ja_JP),
+ /// Ignore dash or minus sign in Japanese fuzzy search
+ ignoreMinusSign_ja_JP = int(css::i18n::TransliterationModules_IgnoreMinusSign_ja_JP),
+ /// Ignore Hiragana and Katakana iteration mark in Japanese fuzzy search
+ ignoreIterationMark_ja_JP = int(css::i18n::TransliterationModules_IgnoreIterationMark_ja_JP),
+ /// Ignore separator punctuations in Japanese fuzzy search
+ ignoreSeparator_ja_JP = int(css::i18n::TransliterationModules_IgnoreSeparator_ja_JP),
+ /// Ignore Katakana and Hiragana Zi/Zi and Zu/Zu in Japanese fuzzy search
+ ignoreZiZu_ja_JP = int(css::i18n::TransliterationModules_IgnoreZiZu_ja_JP),
+ /// Ignore Katakana and Hiragana Ba/Gua and Ha/Fa in Japanese fuzzy search
+ ignoreBaFa_ja_JP = int(css::i18n::TransliterationModules_IgnoreBaFa_ja_JP),
+ /// Ignore Katakana and Hiragana Tsui/Tea/Ti and Dyi/Ji in Japanese fuzzy search
+ ignoreTiJi_ja_JP = int(css::i18n::TransliterationModules_IgnoreTiJi_ja_JP),
+ /// Ignore Katakana and Hiragana Hyu/Fyu and Byu/Gyu in Japanese fuzzy search
+ ignoreHyuByu_ja_JP = int(css::i18n::TransliterationModules_IgnoreHyuByu_ja_JP),
+ /// Ignore Katakana and Hiragana Se/Sye and Ze/Je in Japanese fuzzy search
+ ignoreSeZe_ja_JP = int(css::i18n::TransliterationModules_IgnoreSeZe_ja_JP),
+ /// Ignore Katakana YA/A which follows the character in either I or E row in Japanese fuzzy search
+ ignoreIandEfollowedByYa_ja_JP = int(css::i18n::TransliterationModules_IgnoreIandEfollowedByYa_ja_JP),
+ /// Ignore Katakana KI/KU which follows the character in SA column in Japanese fuzzy search
+ ignoreKiKuFollowedBySa_ja_JP = int(css::i18n::TransliterationModules_IgnoreKiKuFollowedBySa_ja_JP),
+ /// Ignore Japanese normal and small sized character in Japanese fuzzy search
+ ignoreSize_ja_JP = int(css::i18n::TransliterationModules_IgnoreSize_ja_JP),
+ /// Ignore Japanese prolonged sound mark in Japanese fuzzy search
+ ignoreProlongedSoundMark_ja_JP = int(css::i18n::TransliterationModules_IgnoreProlongedSoundMark_ja_JP),
+ /// Ignore middle dot in Japanese fuzzy search
+ ignoreMiddleDot_ja_JP = int(css::i18n::TransliterationModules_IgnoreMiddleDot_ja_JP),
+ /// Ignore white space characters, include space, TAB, return, etc. in Japanese fuzzy search
+ ignoreSpace_ja_JP = int(css::i18n::TransliterationModules_IgnoreSpace_ja_JP),
+ /// transliterate Japanese small sized character to normal sized character
+ smallToLarge_ja_JP = int(css::i18n::TransliterationModules_SmallToLarge_ja_JP),
+ /// transliterate Japanese normal sized character to small sized character
+ largeToSmall_ja_JP = int(css::i18n::TransliterationModules_LargeToSmall_ja_JP),
+
+ /// Transliterate decomposing and removing diacritics, not only CTL, despite its name.
+ IGNORE_DIACRITICS_CTL = int(css::i18n::TransliterationModulesExtra::IGNORE_DIACRITICS_CTL),
+ /// Ignore Kashida mark.
+ IGNORE_KASHIDA_CTL = int(css::i18n::TransliterationModulesExtra::IGNORE_KASHIDA_CTL)
+};
+namespace o3tl {
+ template<> struct typed_flags<TransliterationFlags> : is_typed_flags<TransliterationFlags, 0x7fffffff> {};
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/unicode.hxx b/include/i18nutil/unicode.hxx
new file mode 100644
index 000000000..c14d22cec
--- /dev/null
+++ b/include/i18nutil/unicode.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_UNICODE_HXX
+#define INCLUDED_I18NUTIL_UNICODE_HXX
+
+#include <com/sun/star/i18n/UnicodeScript.hpp>
+#include <sal/types.h>
+#include <rtl/ustrbuf.hxx>
+#include <unicode/uscript.h>
+#include <i18nutil/i18nutildllapi.h>
+
+class LanguageTag;
+
+struct ScriptTypeList
+{
+ css::i18n::UnicodeScript from;
+ css::i18n::UnicodeScript to;
+ sal_Int16 value;
+};
+
+class I18NUTIL_DLLPUBLIC unicode
+{
+public:
+ static sal_Int16 getUnicodeType(const sal_Unicode ch);
+ static sal_Int16 getUnicodeScriptType(const sal_Unicode ch, const ScriptTypeList* typeList,
+ sal_Int16 unknownType = 0);
+ static sal_Unicode getUnicodeScriptStart(css::i18n::UnicodeScript type);
+ static sal_Unicode getUnicodeScriptEnd(css::i18n::UnicodeScript type);
+ static sal_uInt8 getUnicodeDirection(const sal_Unicode ch);
+ static sal_uInt32 GetMirroredChar(sal_uInt32);
+ static bool isControl(const sal_Unicode ch);
+ static bool isAlpha(const sal_Unicode ch);
+ static bool isSpace(const sal_Unicode ch);
+ static bool isWhiteSpace(const sal_Unicode ch);
+
+ /** Check for Unicode variation sequence selectors
+
+ @param nCode A Unicode code point.
+
+ @return True if code is a Unicode variation sequence selector.
+ */
+ static bool isIVSSelector(sal_uInt32 nCode)
+ {
+ return (nCode >= 0xFE00 && nCode <= 0xFE0F) // Variation Selectors block
+ || (nCode >= 0xE0100 && nCode <= 0xE01EF); // Variation Selectors Supplement block
+ }
+
+ /** Check for base characters of a CJK ideographic variation sequence (IVS)
+
+ @param nCode A Unicode code point.
+
+ @return True if code is a Unicode base character part of CJK IVS
+ */
+ static bool isCJKIVSCharacter(sal_uInt32 nCode)
+ {
+ return (nCode >= 0x4E00 && nCode <= 0x9FFF) // CJK Unified Ideographs
+ || (nCode >= 0x3400 && nCode <= 0x4DBF) // CJK Unified Ideographs Extension A
+ || (nCode >= 0x20000 && nCode <= 0x2A6DF); // CJK Unified Ideographs Extension B
+ }
+
+ //Map an ISO 15924 script code to Latin/Asian/Complex/Weak
+ static sal_Int16 getScriptClassFromUScriptCode(UScriptCode eScript);
+
+ //Return a language that can be written in a given ISO 15924 script code
+ static OString getExemplarLanguageForUScriptCode(UScriptCode eScript);
+
+ //Format a number as a percentage according to the rules of the given
+ //language, e.g. 100 -> "100%" for en-US vs "100 %" for de-DE
+ static OUString formatPercent(double dNumber, const LanguageTag& rLangTag);
+};
+
+/*
+ Toggle between a character and its Unicode Notation.
+ -implements the concept found in Microsoft Word's Alt-X
+ -accepts sequences of up to 8 hex characters and converts into the corresponding Unicode Character
+ -example: 0000A78c or 2bc
+ -accepts sequences of up to 256 characters in Unicode notation
+ -example: U+00000065u+0331u+308
+ -handles complex characters (with combining elements) and the all of the Unicode planes.
+*/
+class I18NUTIL_DLLPUBLIC ToggleUnicodeCodepoint
+{
+private:
+ OUStringBuffer maInput;
+ OUStringBuffer maUtf16;
+ OUStringBuffer maCombining;
+ bool mbAllowMoreChars = true;
+ bool mbRequiresU = false;
+ bool mbIsHexString = false;
+
+public:
+ /**
+ Build an input string of valid UTF16 units to toggle.
+ -do not call the other functions until the input process is complete
+ -build string from Right to Left. (Start from the character to the left of the cursor: move left.)
+ */
+ bool AllowMoreInput(sal_Unicode uChar);
+
+ /**
+ Validates (and potentially modifies) the input string.
+ -all non-input functions must use this function to first to validate the input string
+ -additional input may be prevented after this function is called
+ */
+ OUString StringToReplace();
+ OUString ReplacementString();
+
+ /**
+ While sInput.getLength() returns the number of utf16 units to delete,
+ this function returns the number of "characters" to delete - potentially a smaller number
+ */
+ sal_uInt32 CharsToDelete();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/widthfolding.hxx b/include/i18nutil/widthfolding.hxx
new file mode 100644
index 000000000..87b909b91
--- /dev/null
+++ b/include/i18nutil/widthfolding.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_WIDTHFOLDING_HXX
+#define INCLUDED_I18NUTIL_WIDTHFOLDING_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <i18nutil/i18nutildllapi.h>
+#include <config_options.h>
+
+namespace com::sun::star::uno { template <typename > class Sequence; }
+namespace i18nutil { class oneToOneMapping; }
+
+namespace i18nutil {
+
+#define WIDTHFOLDING_DONT_USE_COMBINED_VU 0x01
+
+class UNLESS_MERGELIBS(I18NUTIL_DLLPUBLIC) widthfolding
+{
+public:
+ static oneToOneMapping& getfull2halfTable();
+ static oneToOneMapping& gethalf2fullTable();
+
+ static oneToOneMapping& getfull2halfTableForASC();
+ static oneToOneMapping& gethalf2fullTableForJIS();
+
+ static oneToOneMapping& getfullKana2halfKanaTable();
+ static oneToOneMapping& gethalfKana2fullKanaTable();
+
+ static OUString decompose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset);
+ static sal_Unicode decompose_ja_voiced_sound_marksChar2Char (sal_Unicode inChar);
+ static OUString compose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset, sal_Int32 nFlags = 0 );
+ static sal_Unicode getCompositionChar(sal_Unicode c1, sal_Unicode c2);
+};
+
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/classpath.hxx b/include/jvmaccess/classpath.hxx
new file mode 100644
index 000000000..416b64a33
--- /dev/null
+++ b/include/jvmaccess/classpath.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_JVMACCESS_CLASSPATH_HXX
+#define INCLUDED_JVMACCESS_CLASSPATH_HXX
+
+#include <sal/config.h>
+
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
+#include <jni.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
+
+#include <jvmaccess/jvmaccessdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::uno
+{
+class XComponentContext;
+}
+
+namespace com::sun::star::uno
+{
+template <typename> class Reference;
+}
+
+namespace jvmaccess
+{
+/**
+ Helper functions for class path handling.
+ */
+namespace ClassPath
+{
+/**
+ translates a class path into a java.net.URL[] instance.
+
+ @param context
+ a component context; must not be null.
+
+ @param environment
+ a JNI environment; must not be null.
+
+ @param classPath
+ a list of zero or more internal (see the
+ com.sun.star.uri.ExternalUriReferenceTranslator service) URI references,
+ where any space characters (U+0020) are ignored (and, in particular, separate
+ adjacent URI references). Any vnd.sun.star.expand URL references in the list
+ are expanded using the com.sun.star.util.theMacroExpander singleton of the
+ given context.
+
+ @returns
+ a local reference to a java.net.URL[] instance containing the external (see
+ the com.sun.star.uri.ExternalUriReferenceTranslator service) equivalents of
+ all the URI references in the given classPath. If null, a (still pending)
+ JNI exception occurred.
+
+ @throws com::sun::star::uno::RuntimeException
+ */
+JVMACCESS_DLLPUBLIC jobjectArray
+translateToUrls(css::uno::Reference<css::uno::XComponentContext> const& context,
+ JNIEnv* environment, std::u16string_view classPath);
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/jvmaccessdllapi.h b/include/jvmaccess/jvmaccessdllapi.h
new file mode 100644
index 000000000..1c57d1484
--- /dev/null
+++ b/include/jvmaccess/jvmaccessdllapi.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_JVMACCESS_JVMACCESSDLLAPI_H
+#define INCLUDED_JVMACCESS_JVMACCESSDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined JVMACCESS_DLLIMPLEMENTATION
+#define JVMACCESS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define JVMACCESS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define JVMACCESS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/unovirtualmachine.hxx b/include/jvmaccess/unovirtualmachine.hxx
new file mode 100644
index 000000000..1b424dba9
--- /dev/null
+++ b/include/jvmaccess/unovirtualmachine.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
+#define INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
+
+#include <jvmaccess/jvmaccessdllapi.h>
+#include <sal/config.h>
+#include <salhelper/simplereferenceobject.hxx>
+#include <rtl/ref.hxx>
+
+namespace jvmaccess
+{
+class VirtualMachine;
+
+/** An encapsulating wrapper around a Java virtual machine and an appropriate
+ UNO class loader.
+ */
+class JVMACCESS_DLLPUBLIC UnoVirtualMachine final : public salhelper::SimpleReferenceObject
+{
+public:
+ /** An exception indicating failure to create a UnoVirtualMachine.
+ */
+ class JVMACCESS_DLLPUBLIC CreationException final
+ {
+ public:
+ CreationException();
+
+ CreationException(CreationException const&);
+
+ CreationException& operator=(CreationException const&);
+ };
+
+ /** Create a wrapper around a Java virtual machine and an appropriate UNO
+ class loader.
+
+ @param virtualMachine
+ A Java virtual machine wrapper. Must not be null.
+
+ @param classLoader
+ A local or global JNI reference, relative to the given virtualMachine,
+ to an appropriate UNO class loader instance. Must not be null. This
+ parameter should be of type jobject, not void *, but the exact
+ definition of jobject is different for different JDK versions, so that
+ the mangled C++ name of the constructor would depend on the JDK version
+ used at compile time.
+
+ @exception CreationException
+ Thrown in case creation fails (due to a JNI problem).
+ */
+ UnoVirtualMachine(rtl::Reference<jvmaccess::VirtualMachine> virtualMachine, void* classLoader);
+
+ /** Get the Java virtual machine wrapper.
+
+ @return
+ The Java virtual machine wrapper. Will never be null.
+ */
+ const rtl::Reference<jvmaccess::VirtualMachine>& getVirtualMachine() const;
+
+ /** Get the UNO class loader.
+
+ @return
+ A global JNI reference to the UNO class loader. (The JNI reference must
+ not be deleted by client code.) Will never be null. This should be of
+ type jobject, not void *, but the exact definition of jobject is
+ different for different JDK versions, so that the mangled C++ name of
+ the function would depend on the JDK version used at compile time.
+ */
+ void* getClassLoader() const { return m_classLoader; }
+
+private:
+ UnoVirtualMachine(UnoVirtualMachine const&) = delete;
+ UnoVirtualMachine& operator=(UnoVirtualMachine const&) = delete;
+
+ virtual ~UnoVirtualMachine() override;
+
+ rtl::Reference<jvmaccess::VirtualMachine> m_virtualMachine;
+ void* m_classLoader;
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/virtualmachine.hxx b/include/jvmaccess/virtualmachine.hxx
new file mode 100644
index 000000000..e1286e700
--- /dev/null
+++ b/include/jvmaccess/virtualmachine.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
+#define INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
+
+#include <jvmaccess/jvmaccessdllapi.h>
+#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
+#include <jni.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
+
+namespace jvmaccess
+{
+/** An encapsulating wrapper around a Java virtual machine.
+ */
+class JVMACCESS_DLLPUBLIC VirtualMachine final : public salhelper::SimpleReferenceObject
+{
+public:
+ /** A helper to attach a thread to a Java virtual machine.
+
+ @descr
+ Upon construction of a guard the current thread is attached to the
+ virtual machine, and upon destruction of the guard the thread is
+ detached again. For any one thread, multiple instances of this class
+ may be used in a stack-like fashion (care is taken to only really
+ detach the thread from the virtual machine upon destruction of the guard
+ at the bottom of the stack).
+ */
+ class JVMACCESS_DLLPUBLIC AttachGuard
+ {
+ public:
+ /** An exception indicating failure to create an AttachGuard.
+ */
+ class JVMACCESS_DLLPUBLIC CreationException final
+ {
+ public:
+ CreationException();
+
+ CreationException(CreationException const&);
+
+ CreationException& operator=(CreationException const&);
+ };
+
+ /** Attach the current thread to a virtual machine.
+
+ @param rMachine
+ The virtual machine to attach to. Must not be a null reference.
+
+ @exception CreationException
+ Thrown in case attaching fails (due to a JNI problem).
+ */
+ explicit AttachGuard(rtl::Reference<VirtualMachine> xMachine);
+
+ /** Detach the current thread from the virtual machine again.
+ */
+ ~AttachGuard();
+
+ /** Get a JNI environment pointer for the current thread.
+
+ @return
+ A valid JNI environment pointer. Will never be null.
+ */
+ JNIEnv* getEnvironment() const { return m_pEnvironment; }
+
+ private:
+ AttachGuard(AttachGuard const&) = delete;
+ AttachGuard& operator=(AttachGuard const&) = delete;
+
+ rtl::Reference<VirtualMachine> m_xMachine;
+ JNIEnv* m_pEnvironment;
+ bool m_bDetach;
+ };
+
+ /** Create a wrapper around a Java virtual machine.
+
+ @param pVm
+ A JNI pointer to virtual machine. Must not be null.
+
+ @param nVersion
+ The JNI version of the virtual machine pointed to by pVm. Must be at
+ least JNI_VERSION_1_2. This parameter should be of type jint, not int,
+ but at least on some platforms the definition of jint changed from
+ JDK 1.3 (long) to JDK 1.4 (int), so that the mangled C++ name of the
+ constructor would depend on the JDK version used at compile time.
+
+ @param bDestroy
+ Whether to destroy the virtual machine when destructing the wrapper
+ (i.e., whether the wrapper owns the virtual machine pointed to by pVm).
+
+ @param pMainThreadEnv
+ A valid JNI environment pointer for the current thread; must not be
+ null. The current thread must be "initially attached" to the virtual
+ machine while this constructor is being called (i.e., it must be the
+ thread that has called JNI_CreateJavaVM in case the virtual machine has
+ been started via the JNI Invocation API, and it must not already have
+ called DetachCurrentThread; or it must be executing native code called
+ from a "primordial" virtual machine). This environment pointer was
+ formerly used to obtain a reference to the thread's current context
+ class loader (java.lang.Thread.getCurrentClassLoader; if later a native
+ thread was attached to the virtual machine, that thread's context class
+ loader would be null, so the AttachGuard first of all set it to the
+ saved value; this feature has been removed again for performance reasons
+ and because the default context class loader is often not useful, so
+ that code relying on a context class loader has to set one explicitly,
+ anyway). This parameter is currently unused (but may be used again in
+ the future).
+ */
+ VirtualMachine(JavaVM* pVm, int nVersion, bool bDestroy, JNIEnv const* pMainThreadEnv);
+
+private:
+ VirtualMachine(VirtualMachine const&) = delete;
+ VirtualMachine& operator=(VirtualMachine const&) = delete;
+
+ virtual ~VirtualMachine() override;
+
+ JNIEnv* attachThread(bool* pAttached) const;
+
+ void detachThread() const;
+
+ JavaVM* m_pVm;
+ jint m_nVersion;
+ bool m_bDestroy;
+
+ friend class AttachGuard; // to access attachThread, detachThread
+};
+}
+
+#endif // INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
new file mode 100644
index 000000000..8f7eb8a2a
--- /dev/null
+++ b/include/jvmfwk/framework.hxx
@@ -0,0 +1,671 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/** @HTML */
+
+#ifndef INCLUDED_JVMFWK_FRAMEWORK_HXX
+#define INCLUDED_JVMFWK_FRAMEWORK_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+#include <vector>
+
+#include <jvmfwk/jvmfwkdllapi.hxx>
+#include <rtl/byteseq.hxx>
+#include <rtl/ustring.hxx>
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
+#include <jni.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
+
+/** @file
+ <p>This library can operate in two modes, application mode and direct mode.</p>
+
+
+ <h2>Application Mode</h2>
+ In application mode the Java related settings are stored in files.
+ There are currently three files which need to be accessed. They are determined
+ by bootstrap parameters:</p>
+ <dl>
+ <dt>UNO_JAVA_JFW_VENDOR_SETTINGS</dt>
+ <dd>contains vendor and version information about JREs as well as the
+ location of plugin-libraries which are responsible for providing information
+ about these JREs as well as starting the VMs.</dd>
+ <dt>UNO_JAVA_JFW_USER_DATA</dt>
+ <dd>The file contains settings for a particular user. One can use the macro
+ $SYSUSERCONFIG in the URL which expands to a directory where the user's data are
+ kept. On UNIX this would be the home directory and on Windows some sub-directory
+ of the &quot;Documents and Settings&quot; folder.The content of this file is an
+ implementation detail and may change in the future.</dd>
+ <dt>UNO_JAVA_JFW_SHARED_DATA</dt>
+ <dd>The file contains settings valid for all users. If a user changes a setting
+ then it takes precedence over the setting from UNO_JAVA_JFW_SHARED_DATA.
+ The content of this file is an implementation detail and may change in the future.</dd>
+ </dl>
+
+ <p>The values for these parameters must be file URLs and include the file name, for
+ example:<br>
+ file:///d:/MyApp/javavendors.xml<br>
+ All files are XML files and must have the extension .xml.</p>
+ <p>
+ Modifying the shared settings is currently not supported by the framework. To provide
+ Java settings for all users one can run OOo and change the settings in the
+ options dialog. These settings are made persistent in the UNO_JAVA_JFW_USER_DATA.
+ The file can then be copied into the base installation.
+ Other users will use automatically these data but can override the settings in
+ the options dialog. This mechanism may change in the future.
+ </p>
+ <p>If shared Java settings are not supported by an application then it is not
+ necessary to specify the bootstrap parameter <code>UNO_JAVA_JFW_SHARED_DATA</code>.
+ </p>
+
+ <p>Setting the class path used by a Java VM should not be necessary. The locations
+ of Jar files should be known by a class loader. If a jar file depends on another
+ jar file then it can be referenced in the manifest file of the first jar. However,
+ a user may add jars to the class path by using this API. If it becomes necessary
+ to add files to the class path which is to be used by all users then one can use
+ the bootstrap parameter UNO_JAVA_JFW_CLASSPATH_URLS. The value contains of file URLs
+ which must be separated by spaces.</p>
+
+
+ <h2>Direct Mode</h2>
+
+ <p>The direct mode is intended for a scenario where no configuration files
+ are available and a Java VM shall be run. That is,
+ the files containing the user and shared settings are not specified by the
+ bootstrap parameters UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_USER_DATA.
+ For example, tools, such as regcomp, may use this framework in a build
+ environment. Then one would want to use settings which have been specified
+ by the build environment. The framework would automatically use the
+ current settings when they change in the environment.
+ </p>
+
+ <p> Here are examples how regcomp could be invoked using bootstrap parameters:
+ </p>
+ <p>
+ regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
+ -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\libreoffice.jar&quot;
+ -register...
+ </p>
+ <p>If UNO_JAVA_JFW_VENDOR_SETTINGS is not set then a plugin library must be specified. For example:</p>
+ <p>
+ regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
+ -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\libreoffice.jar&quot;
+ -register...
+ </p>
+ <p>Additional parameters for the Java VM can be provided. For every parameter
+ a separate bootstrap parameter must be specified. The names are
+ <code>UNO_JAVA_JFW_PARAMETER_X</code>, where X is 1,2, .. n. For example:</p>
+ <p>
+ regcomp -env:UNO_JAVA_JFW_PARAMETER_1=-Xdebug
+ -env:UNO_JAVA_JFW_PARAMETER_2=-Xrunjdwp:transport=dt_socket,server=y,address=8100
+ -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
+ -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\libreoffice.jar&quot;
+ -register...</p>
+ <p>
+ Here is a complete list of the bootstrap parameter for the direct mode:
+ </p>
+ <dl>
+ <dt>UNO_JAVA_JFW_JREHOME</dt>
+ <dd>Specifies a file URL to a JRE installation.It must ALWAYS be specified
+ in direct mode</dd>
+ <dt>UNO_JAVA_JFW_ENV_JREHOME</dt>
+ <dd>Setting this parameter, for example to &quot;1&quot; or &quot;true&quot;,
+ causes the framework to use the environment variable JAVA_HOME. It is expected
+ that JAVA_HOME contains a system path rather than a file URL. This parameter
+ and UNO_JAVA_JFW_JREHOME are mutually exclusive</dd>
+ <dt>UNO_JAVA_JFW_CLASSPATH</dt>
+ <dd>Contains the class path which is to be used by the VM. Special character,
+ such as '\','{','}','$' must be preceded with '\'. See documentation about the
+ bootstrap parameter.</dd>
+ <dt>UNO_JAVA_JFW_ENV_CLASSPATH</dt>
+ <dd>Setting this parameter,for example to &quot;1&quot; or &quot;true&quot;,
+ causes the framework to use the
+ environment variable CLASSPATH. If this variable and UNO_JAVA_JFW_CLASSPATH are
+ set then the class path is composed from UNO_JAVA_JFW_CLASSPATH and the environment
+ variable CLASSPATH.</dd>
+ <dt>UNO_JAVA_JFW_PARAMETER_X</dt>
+ <dd>Specifies a parameter for the Java VM. The X is replaced by
+ non-negative natural numbers starting with 1.</dd>
+ </dl>
+
+ <p>A note about bootstrap parameters. The implementation of the bootstrap
+ parameter mechanism interprets the characters '\', '$', '{', '}' as
+ escape characters. That's why the Windows path contain double back-slashes.
+ One should also take into account that a console may have also special
+ escape characters.</p>
+
+ <h2>What mode is used</h2>
+ <p>
+ The default mode is application mode. If at least one bootstrap parameter
+ for the direct mode is provided then direct mode is used. </p>
+
+ <p>
+ All settings made by this API are done for the current user if not
+ mentioned differently.</p>
+*/
+
+/** indicates that there must be an environment set up before the Java process
+ runs.
+ <p>Therefore, when a Java is selected in OO then the office must be
+ restarted, so that the changes can take effect.</p>
+ */
+#define JFW_REQUIRE_NEEDRESTART 0x1l
+
+/** error codes which are returned by functions of this API.
+ */
+enum javaFrameworkError
+{
+ JFW_E_NONE,
+ JFW_E_ERROR,
+ JFW_E_NO_SELECT,
+ JFW_E_INVALID_SETTINGS,
+ JFW_E_NEED_RESTART,
+ JFW_E_RUNNING_JVM,
+ JFW_E_JAVA_DISABLED,
+ JFW_E_NOT_RECOGNIZED,
+ JFW_E_FAILED_VERSION,
+ JFW_E_NO_JAVA_FOUND,
+ JFW_E_VM_CREATION_FAILED,
+ JFW_E_CONFIGURATION,
+ JFW_E_DIRECT_MODE
+};
+
+/** an instance of this struct represents an installation of a Java
+ Runtime Environment (JRE).
+
+ <p>
+ Instances of this struct are created by the plug-in libraries which are used by
+ this framework (jvmfwk/vendorplugin.h).</p>
+ */
+struct JavaInfo
+{
+ /** contains the vendor.
+
+ <p>string must be the same as the one obtained from the
+ Java system property <code>java.vendor</code>.
+ </p>
+ */
+ OUString sVendor;
+ /** contains the file URL to the installation directory.
+ */
+ OUString sLocation;
+ /** contains the version of this Java distribution.
+
+ <p>The version string must adhere to the rules
+ about how a version string has to be formed. These rules may
+ be vendor-dependent. Essentially the strings must syntactically
+ equal the Java system property <code>java.version</code>.
+ </p>
+ */
+ OUString sVersion;
+ /** indicates requirements for running the java runtime.
+
+ <p>For example, it may be necessary to prepare the environment before
+ the runtime is created. That could mean, setting the
+ <code>LD_LIBRARY_PATH</code>
+ when <code>nRequirements</code> contains the flag
+ <code>JFW_REQUIRE_NEEDRESTART</code></p>
+ */
+ sal_uInt64 nRequirements;
+ /** contains data needed for the creation of the java runtime.
+
+ <p>There is no rule about the format and content of the sequence's
+ values. The plug-in libraries can put all data, necessary for
+ starting the java runtime into this sequence. </p>
+ */
+ rtl::ByteSequence arVendorData;
+};
+
+/** compares two <code>JavaInfo</code> objects for equality.
+
+ <p>Two <code>JavaInfo</code> objects are said to be equal if the contained
+ members of the first <code>JavaInfo</code> are equal to their counterparts
+ in the second <code>JavaInfo</code> object. The equality of the
+ <code>OUString</code> members is determined
+ by <code>operator ==</code>.
+ Similarly the equality of the <code>rtl::ByteSequence</code> is
+ also determined by a comparison
+ function (see <code>rtl::ByteSequence::operator ==</code>). </p>
+ <p>
+ Both argument pointers must be valid.</p>
+ @param pInfoA
+ the first argument.
+ @param pInfoB
+ the second argument which is compared with the first.
+ @return
+ true - both object represent the same JRE.</br>
+ false - the objects represent different JREs
+ */
+JVMFWK_DLLPUBLIC bool jfw_areEqualJavaInfo(JavaInfo const* pInfoA, JavaInfo const* pInfoB);
+
+/** determines if a Java Virtual Machine is already running.
+
+ <p>As long as the office and the JREs only support one
+ Virtual Machine per process the Java settings, particularly the
+ selected Java, are not effective immediately after changing when
+ a VM has already been running. That is, if a JRE A was used to start
+ a VM and then a JRE B is selected, then JRE B will only be used
+ after a restart of the office.</p>
+ <p>
+ By determining if a VM is running, the user can be presented a message,
+ that the changed setting may not be effective immediately.</p>
+
+ @return
+ true iff a VM is running.
+*/
+JVMFWK_DLLPUBLIC bool jfw_isVMRunning();
+
+/** detects a suitable JRE and configures the framework to use it.
+
+ <p>Which JREs can be used is determined by the file javavendors.xml,
+ which contains version requirements.</p>
+ <p>
+ JREs can be provided by different vendors.
+ The function obtains information about JRE installations. If none was
+ found then it also uses a list of paths, which have been registered
+ by <code>jfw_addJRELocation</code>
+ to find JREs. Found JREs are examined in the same way.</p>
+ <p>
+ A JRE installation is only selected if it meets the version requirements.
+ Information about the selected JRE are made persistent so that
+ subsequent calls to <code>jfw_getSelectedJRE</code> returns this
+ information.</p>
+ <p>
+ While determining a proper JRE this function takes into account if a
+ user requires support for assistive technology tools. If user
+ need that support they have to set up their system accordingly.</p>
+ <p>
+ If the JAVA_HOME environment variable is set, this function prefers
+ the JRE which the variable refers to over other JREs.
+ If JAVA_HOME is not set or does not refer to a suitable JRE,
+ the PATH environment variable is inspected and the respective JREs
+ are checked for their suitability next.</p>
+ <p>
+ The first <code>JavaInfo</code> object that is detected by the algorithm
+ as described above is used.</p>
+
+ @param pInfo
+ [out] a <code>JavaInfo</code> pointer, representing the selected JRE.
+ The <code>JavaInfo</code> is for informational purposes only. It is not
+ necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/>
+ <code>pInfo</code>can be NULL.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_NO_JAVA_FOUND no JRE was found that meets the requirements.</br>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode. </br>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo>* pInfo);
+
+/** provides information about all available JRE installations.
+
+ <p>The function determines dynamically what JREs are available. It uses
+ the plug-in libraries to provide lists of available <code>JavaInfo</code>
+ objects where each object represents a JRE (see vendorplugin.h,
+ getAllJavaInfos). It also uses a list of paths, which have been registered
+ by <code>jfw_addJRELocation</code>.
+ It is checked if the path still contains a valid JRE and if so the respective
+ <code>JavaInfo</code> object will be appended to the array unless there is
+ already an equal object.</p>
+
+ @param parInfo
+ [out] on returns it contains a vector of <code>JavaInfo</code> pointers.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.
+*/
+JVMFWK_DLLPUBLIC javaFrameworkError
+jfw_findAllJREs(std::vector<std::unique_ptr<JavaInfo>>* parInfo);
+
+/** determines if a path points to a Java installation.
+
+ <p>If the path belongs to a JRE installation then it returns the
+ respective <code>JavaInfo</code> object. The function uses the
+ <code>getJavaInfoByPath</code> function of the plug-ins to obtain the
+ <code>JavaInfo</code> object. Only if the JRE found at the specified location
+ meets the version requirements as specified in the javavendors.xml file a
+ <code>JavaInfo</code> object is returned.<br/>
+ <p>
+ The functions only checks if a JRE exists but does not modify any settings.
+ To make the found JRE the &quot;selected JRE&quot; one has
+ to call <code>jfw_setSelectedJRE</code>.</p>
+
+ @param pPath
+ [in] a file URL to a directory.
+ @param ppInfo
+ [out] the <code>JavaInfo</code> object which represents a JRE found at the
+ location specified by <code>pPath</code>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.</br>
+ JFW_E_NOT_RECOGNIZED neither plug-in library could detect a JRE. <br/>
+ JFW_E_FAILED_VERSION a JRE was detected but if failed the version
+ requirements as determined by the javavendors.xml
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_getJavaInfoByPath(OUString const& pPath,
+ std::unique_ptr<JavaInfo>* ppInfo);
+
+/** starts a Java Virtual Machine (JVM).
+
+ <p>The function uses the current settings to start a JVM. The actual
+ start-up code, however, is provided by the plug-in libraries. The setting
+ of the &quot;selected Java&quot; contains the information as to what vendor
+ the respective JRE comes from. In the javavendors.xml there is a mapping of
+ vendor names to the respective plug-in libraries.</p>
+ <p>
+ The function ultimately calls <code>startJavaVirtualMachine</code> from
+ the plug-in library.</p>
+ <p>
+ The <code>arOptions</code>
+ argument contains start arguments which are passed in JavaVMOption structures
+ to the VM during its creation. These
+ could be things, such as language settings, proxy settings or any other
+ properties which shall be obtainable by
+ <code>java.lang.System.getProperties</code>. One can also pass options which
+ have a certain meaning to the runtime behaviour such as -ea or -X... However,
+ one must be sure that these options can be interpreted by the VM.<br/>
+ The class path cannot be set this way. The class path is internally composed by
+ the paths to archives in a certain directory, which is preconfigured in
+ the internal data store and the respective user setting (see
+ <code>jfw_setUserClassPath</code>.</p>
+ <p>
+ If a JRE was selected at runtime which was different from the previous
+ setting and that JRE needs a prepared environment, for example an adapted
+ <code>LD_LIBRARY_PATH</code> environment variable, then the VM will not be
+ created and JFW_E_NEED_RESTART error is returned. If a VM is already running
+ then a JFW_E_RUNNING_JVM is returned.</p>
+
+ @param pInfo
+ [in] optional pointer to a specific JRE; must be caller-freed if not NULL
+ @param arOptions
+ [in] the vector containing additional start arguments.
+ @param ppVM
+ [out] the <code>JavaVM</code> pointer.
+ @param ppEnv
+ [out] the <code>JNIenv</code> pointer.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.</br>
+ JFW_E_JAVA_DISABLED the use of Java is currently disabled. <br/>
+ JFW_E_NO_SELECT there is no JRE selected yet. <br/>
+ JFW_E_RUNNING_JVM there is already a VM running.<br/>
+ JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
+ JRE has been selected afterwards. <br/>
+ JFW_E_NEED_RESTART in the current process a different JRE has been selected
+ which needs a prepared environment, which has to be done before the office
+ process. Therefore the new JRE may not be used until the office was restarted.<br/>
+ JFW_E_NEED_RESTART is also returned when Java was disabled at the beginning and
+ then the user enabled it. If then the selected JRE has the requirement
+ JFW_REQUIRE_NEEDRESTART then this error is returned. </br>
+ JFW_E_VM_CREATION_FAILED the creation of the JVM failed. The creation is performed
+ by a plug-in library and not by this API.
+ JFW_E_FAILED_VERSION the &quot;Default Mode&quot; is active. The JRE determined by
+ <code>JAVA_HOME</code>does not meet the version requirements.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_startVM(JavaInfo const* pInfo,
+ std::vector<OUString> const& arOptions,
+ JavaVM** ppVM, JNIEnv** ppEnv);
+
+/** determines the JRE that is to be used.
+
+ <p>When calling <code>jfw_startVM</code> then a VM is started from
+ the JRE that is determined by this function.<br/>
+ It is not verified if the JRE represented by the <code>JavaInfo</code>
+ argument meets the requirements as specified by the javavendors.xml file.
+ However, usually one obtains the <code>JavaInfo</code> object from the
+ functions <code>jfw_findAllJREs</code> or <code>jfw_getJavaInfoByPath</code>,
+ which do verify the JREs and pass out only <code>JavaInfo</code> objects
+ which comply with the version requirements.</p>
+ <p>
+ If <code>pInfo</code> is NULL then the meaning is that no JRE will be
+ selected. <code>jfw_startVM</code> will then return
+ <code>JFW_E_NO_SELECT</code>.</p>
+
+ @param pInfo
+ [in] pointer to <code>JavaInfo</code> structure, containing data about a
+ JRE. The caller must still free <code>pInfo</code>.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_setSelectedJRE(JavaInfo const* pInfo);
+
+/** provides information about the JRE that is to be used.
+
+ <p>If no JRE is currently selected then <code>ppInfo</code> will contain
+ NULL on return.</br>
+ If the value of the element <updated> in the javavendors.xml file was
+ changed since the time when the last Java was selected then this
+ function returns <code>JFW_E_INVALID_SETTINGS</code>. This could happen during
+ a product patch. Then new version requirements may be introduced, so that
+ the currently selected JRE may not meet these requirements anymore.
+ </p>
+ <p>In direct mode the function returns information about a JRE that was
+ set by the bootstrap parameter UNO_JAVA_JFW_JREHOME.
+ </p>
+ @param ppInfo
+ [out] on return it contains a pointer to a <code>JavaInfo</code> object
+ that represents the currently selected JRE. When <code>*ppInfo</code> is not
+ NULL then the function sets the pointer.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
+ JRE has been selected afterwards. <br/>
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_getSelectedJRE(std::unique_ptr<JavaInfo>* ppInfo);
+
+/** determines if Java can be used.
+
+ <p>If <code>bEnabled</code> is <code>false</code> then a call
+ to jfw_startVM will result in an error with the errorcode
+ <code>JFW_E_JAVA_DISABLED</code></p>
+
+ @param bEnabled
+ [in] use of Java enabled/disabled.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_setEnabled(bool bEnabled);
+
+/** provides the information if Java can be used.
+
+ <p>That is if the user enabled or disabled the use of Java.
+ </p>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_getEnabled(bool* pbEnabled);
+
+/** determines parameters which are passed to VM during its creation.
+
+ <p>The strings must be exactly as they are passed on the command line.
+ For example, one could pass<br/>
+ -Xdebug <br/>
+ -Xrunjdw:transport=dt_socket,server=y,address=8000<br/>
+ in order to enable debugging support.
+ </p>
+
+ @param arParameters
+ [in] contains the arguments.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_setVMParameters(std::vector<OUString> const& arArgs);
+
+/** obtains the currently used start parameters.
+
+ @param parParameters
+ [out] on returns contains a pointer to the array of the start arguments.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_getVMParameters(std::vector<OUString>* parParameters);
+
+/** sets the user class path.
+
+ <p>When the VM is started then it is passed the class path. The
+ class path also contains the user class path set by this function.
+ The paths contained in <code>pCP</code> must be separated with a
+ system dependent path separator.</p>
+
+ @param pCP
+ [in] the user class path.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_setUserClassPath(OUString const& pCP);
+/** provides the value of the current user class path.
+
+ <p>The function returns an empty string if no user class path is set.
+ </p>
+
+ @param ppCP
+ [out] contains the user class path on return.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_getUserClassPath(OUString* ppCP);
+
+/** saves the location of a JRE.
+
+ <p>When <code>jfw_findAllJREs</code> is called then the paths added by this
+ function are evaluated. If the location still represents a
+ JRE then a <code>JavaInfo</code> object is created which is returned along
+ with all other <code>JavaInfo</code> objects by
+ <code>jfw_findAllJREs</code>. If the location
+ cannot be recognized then the location string is ignored. </p>
+ <p>
+ A validation if <code>sLocation</code> points to a JRE is not
+ performed. To do that one has to use <code>jfw_getJavaInfoByPath</code>.
+ </p>
+ <p>
+ Adding a path that is already stored causes no error.</p>
+
+ @param sLocation
+ [in] file URL to a directory which contains a JRE.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_addJRELocation(OUString const& sLocation);
+
+/** checks if the installation of the jre still exists.
+
+ This function checks if the JRE described by pInfo still
+ exists. The check must be very quick because it is called by javaldx
+ (Linux, Solaris) at start up.
+
+ @param pInfo
+ [in] the JavaInfo object with information about the JRE.
+ @param pp_exist
+ [out] the parameter is set to either true or false. The value is
+ only valid if the function returns JFW_E_NONE.
+
+ @return
+ JFW_E_NONE the function ran successfully.</br>
+ JFW_E_ERROR an error occurred during execution.</br>
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_existJRE(const JavaInfo* pInfo, bool* exist);
+
+/** locks this API so that it cannot be used by other threads.
+
+ <p>If a different thread called this function before then the
+ current call is blocked until the other thread has called
+ <code>jfw_unlock()</code>. The function should be called if one
+ needs an exact snapshot of the current settings. Then the settings
+ are retrieved one by one without risk that the settings may be changed
+ by a different thread. Similarity if one needs to make settings which
+ should become effective at the same time then <code>jfw_lock</code>
+ should be called. That is, <code>jfw_startVM</code> which uses the
+ settings cannot be called before all settings have be made.</p>
+ <p>
+ The only functions which is not effected by <code>jfw_lock</code> is
+ <code>jfw_areEqualJavaInfo</code>.
+ */
+JVMFWK_DLLPUBLIC void jfw_lock();
+
+/** unlocks this API.
+
+ <p>This function is called after <code>jfw_lock</code>. It allows other
+ threads to use this API concurrently.</p>
+*/
+JVMFWK_DLLPUBLIC void jfw_unlock();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmfwk/jvmfwkdllapi.hxx b/include/jvmfwk/jvmfwkdllapi.hxx
new file mode 100644
index 000000000..bd59abb74
--- /dev/null
+++ b/include/jvmfwk/jvmfwkdllapi.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_JVMFWK_JVMFWKDLLAPI_HXX
+#define INCLUDED_JVMFWK_JVMFWKDLLAPI_HXX
+
+#include <sal/types.h>
+
+#if defined JVMFWK_DLLIMPLEMENTATION
+#define JVMFWK_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define JVMFWK_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/hyphdta.hxx b/include/linguistic/hyphdta.hxx
new file mode 100644
index 000000000..48030b571
--- /dev/null
+++ b/include/linguistic/hyphdta.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_LINGUISTIC_HYPHDTA_HXX
+#define INCLUDED_LINGUISTIC_HYPHDTA_HXX
+
+#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
+#include <com/sun/star/linguistic2/XPossibleHyphens.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <linguistic/lngdllapi.h>
+#include <i18nlangtag/lang.h>
+#include <config_options.h>
+
+namespace linguistic
+{
+
+class HyphenatedWord final :
+ public cppu::WeakImplHelper< css::linguistic2::XHyphenatedWord >
+{
+ OUString aWord;
+ OUString aHyphenatedWord;
+ sal_Int16 nHyphPos;
+ sal_Int16 nHyphenationPos;
+ LanguageType nLanguage;
+ bool bIsAltSpelling;
+
+ HyphenatedWord(const HyphenatedWord &) = delete;
+ HyphenatedWord & operator = (const HyphenatedWord &) = delete;
+
+public:
+ HyphenatedWord(const OUString &rWord, LanguageType nLang, sal_Int16 nHyphenationPos,
+ const OUString &rHyphenatedWord, sal_Int16 nHyphenPos );
+ virtual ~HyphenatedWord() override;
+
+ // XHyphenatedWord
+ virtual OUString SAL_CALL
+ getWord() override;
+ virtual css::lang::Locale SAL_CALL
+ getLocale() override;
+ virtual sal_Int16 SAL_CALL
+ getHyphenationPos() override;
+ virtual OUString SAL_CALL
+ getHyphenatedWord() override;
+ virtual sal_Int16 SAL_CALL
+ getHyphenPos() override;
+ virtual sal_Bool SAL_CALL
+ isAlternativeSpelling() override;
+
+ static css::uno::Reference <css::linguistic2::XHyphenatedWord> UNLESS_MERGELIBS(LNG_DLLPUBLIC) CreateHyphenatedWord(
+ const OUString &rWord, LanguageType nLang, sal_Int16 nHyphenationPos,
+ const OUString &rHyphenatedWord, sal_Int16 nHyphenPos );
+};
+
+
+class PossibleHyphens final :
+ public cppu::WeakImplHelper
+ <
+ css::linguistic2::XPossibleHyphens
+ >
+{
+ OUString aWord;
+ OUString aWordWithHyphens;
+ css::uno::Sequence< sal_Int16 > aOrigHyphenPos;
+ LanguageType nLanguage;
+
+ PossibleHyphens(const PossibleHyphens &) = delete;
+ PossibleHyphens & operator = (const PossibleHyphens &) = delete;
+
+public:
+ PossibleHyphens(OUString aWord, LanguageType nLang,
+ OUString aHyphWord,
+ const css::uno::Sequence< sal_Int16 > &rPositions);
+ virtual ~PossibleHyphens() override;
+
+ // XPossibleHyphens
+ virtual OUString SAL_CALL
+ getWord() override;
+ virtual css::lang::Locale SAL_CALL
+ getLocale() override;
+ virtual OUString SAL_CALL
+ getPossibleHyphens() override;
+ virtual css::uno::Sequence< sal_Int16 > SAL_CALL
+ getHyphenationPositions() override;
+
+ static css::uno::Reference < css::linguistic2::XPossibleHyphens > UNLESS_MERGELIBS(LNG_DLLPUBLIC) CreatePossibleHyphens
+ (const OUString &rWord, LanguageType nLang,
+ const OUString &rHyphWord,
+ const css::uno::Sequence< sal_Int16 > &rPositions);
+};
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/lngdllapi.h b/include/linguistic/lngdllapi.h
new file mode 100644
index 000000000..3944d47cf
--- /dev/null
+++ b/include/linguistic/lngdllapi.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_LINGUISTIC_LNGDLLAPI_H
+#define INCLUDED_LINGUISTIC_LNGDLLAPI_H
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined(LNG_DLLIMPLEMENTATION)
+#define LNG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define LNG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define LNG_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/lngprophelp.hxx b/include/linguistic/lngprophelp.hxx
new file mode 100644
index 000000000..18dfaa60d
--- /dev/null
+++ b/include/linguistic/lngprophelp.hxx
@@ -0,0 +1,306 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_LINGUISTIC_LNGPROPHELP_HXX
+#define INCLUDED_LINGUISTIC_LNGPROPHELP_HXX
+
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
+#include <linguistic/lngdllapi.h>
+#include <rtl/ref.hxx>
+#include <config_options.h>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::linguistic2 { struct LinguServiceEvent; }
+namespace com::sun::star::linguistic2 { class XLinguProperties; }
+
+
+namespace linguistic
+{
+
+// PropertyChgHelper
+// Base class for all XPropertyChangeListener members of the
+// various lingu services.
+
+
+// Flags for type of events allowed to be launched
+#define AE_SPELLCHECKER 1
+#define AE_HYPHENATOR 2
+
+typedef cppu::WeakImplHelper
+<
+ css::beans::XPropertyChangeListener,
+ css::linguistic2::XLinguServiceEventBroadcaster
+> PropertyChgHelperBase;
+
+class UNLESS_MERGELIBS(LNG_DLLPUBLIC) PropertyChgHelper :
+ public PropertyChgHelperBase
+{
+ std::vector< OUString > aPropNames;
+ css::uno::Reference< css::uno::XInterface > xMyEvtObj;
+ ::comphelper::OInterfaceContainerHelper3<css::linguistic2::XLinguServiceEventListener> aLngSvcEvtListeners;
+ css::uno::Reference< css::beans::XPropertySet > xPropSet;
+
+ int nEvtFlags; // flags for event types allowed to be launched
+
+ // default values
+ bool bIsIgnoreControlCharacters;
+ bool bIsUseDictionaryList;
+
+ // return values, will be set to default value or current temporary value
+ bool bResIsIgnoreControlCharacters;
+ bool bResIsUseDictionaryList;
+
+ PropertyChgHelper( const PropertyChgHelper & ) = delete;
+ PropertyChgHelper & operator = ( const PropertyChgHelper & ) = delete;
+
+protected:
+ virtual void SetDefaultValues();
+ virtual void GetCurrentValues();
+
+ std::vector< OUString > & GetPropNames() { return aPropNames; }
+ css::uno::Reference<
+ css::beans::XPropertySet > &
+ GetPropSet() { return xPropSet; }
+
+ virtual bool propertyChange_Impl( const css::beans::PropertyChangeEvent& rEvt );
+
+public:
+ PropertyChgHelper(
+ const css::uno::Reference< css::uno::XInterface > &rxSource,
+ css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet,
+ int nAllowedEvents );
+ virtual ~PropertyChgHelper() override;
+
+ virtual void SetTmpPropVals( const css::beans::PropertyValues &rPropVals );
+
+ // XEventListener
+ virtual void SAL_CALL
+ disposing( const css::lang::EventObject& rSource ) override;
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const css::beans::PropertyChangeEvent& rEvt ) override;
+
+ // XLinguServiceEventBroadcaster
+ virtual sal_Bool SAL_CALL
+ addLinguServiceEventListener(
+ const css::uno::Reference< css::linguistic2::XLinguServiceEventListener >& rxListener ) override;
+ virtual sal_Bool SAL_CALL
+ removeLinguServiceEventListener(
+ const css::uno::Reference< css::linguistic2::XLinguServiceEventListener >& rxListener ) override;
+
+ // non-UNO functions
+ void AddAsPropListener();
+ void RemoveAsPropListener();
+ void LaunchEvent( const css::linguistic2::LinguServiceEvent& rEvt );
+
+ const std::vector< OUString > &
+ GetPropNames() const { return aPropNames; }
+ const css::uno::Reference< css::beans::XPropertySet > &
+ GetPropSet() const { return xPropSet; }
+ const css::uno::Reference< css::uno::XInterface > &
+ GetEvtObj() const { return xMyEvtObj; }
+};
+
+
+class PropertyHelper_Thes final :
+ public PropertyChgHelper
+{
+ PropertyHelper_Thes( const PropertyHelper_Thes & ) = delete;
+ PropertyHelper_Thes & operator = ( const PropertyHelper_Thes & ) = delete;
+
+public:
+ PropertyHelper_Thes(
+ const css::uno::Reference< css::uno::XInterface > &rxSource,
+ css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet );
+ virtual ~PropertyHelper_Thes() override;
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const css::beans::PropertyChangeEvent& rEvt ) override;
+};
+
+class UNLESS_MERGELIBS(LNG_DLLPUBLIC) PropertyHelper_Thesaurus
+{
+ rtl::Reference< PropertyHelper_Thes > mxPropHelper;
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Thesaurus( const PropertyHelper_Thes & ) = delete;
+ PropertyHelper_Thesaurus & operator = ( const PropertyHelper_Thes & ) = delete;
+
+public:
+ PropertyHelper_Thesaurus(
+ const css::uno::Reference< css::uno::XInterface > &rxSource,
+ css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet );
+ ~PropertyHelper_Thesaurus();
+ void AddAsPropListener();
+ void RemoveAsPropListener();
+ void SetTmpPropVals( const css::beans::PropertyValues &rPropVals );
+};
+
+
+class UNLESS_MERGELIBS(LNG_DLLPUBLIC) PropertyHelper_Spell final :
+ public PropertyChgHelper
+{
+ // default values
+ bool bIsSpellUpperCase;
+ bool bIsSpellWithDigits;
+ bool bIsSpellCapitalization;
+
+ // return values, will be set to default value or current temporary value
+ bool bResIsSpellUpperCase;
+ bool bResIsSpellWithDigits;
+ bool bResIsSpellCapitalization;
+
+ PropertyHelper_Spell( const PropertyHelper_Spell & ) = delete;
+ PropertyHelper_Spell & operator = ( const PropertyHelper_Spell & ) = delete;
+
+ // PropertyChgHelper
+ virtual void SetDefaultValues() override;
+ virtual void GetCurrentValues() override;
+ virtual bool propertyChange_Impl(
+ const css::beans::PropertyChangeEvent& rEvt ) override;
+
+public:
+ PropertyHelper_Spell(
+ const css::uno::Reference< css::uno::XInterface > &rxSource,
+ css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet );
+ virtual ~PropertyHelper_Spell() override;
+
+ virtual void SetTmpPropVals( const css::beans::PropertyValues &rPropVals ) override;
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const css::beans::PropertyChangeEvent& rEvt ) override;
+
+ bool IsSpellUpperCase() const { return bResIsSpellUpperCase; }
+ bool IsSpellWithDigits() const { return bResIsSpellWithDigits; }
+ bool IsSpellCapitalization() const { return bResIsSpellCapitalization; }
+};
+
+
+class UNLESS_MERGELIBS(LNG_DLLPUBLIC) PropertyHelper_Spelling
+{
+ rtl::Reference< PropertyHelper_Spell > mxPropHelper;
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Spelling( const PropertyHelper_Spell & ) = delete;
+ PropertyHelper_Spelling & operator = ( const PropertyHelper_Spell & ) = delete;
+
+public:
+ PropertyHelper_Spelling(
+ const css::uno::Reference< css::uno::XInterface > &rxSource,
+ css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet );
+ ~PropertyHelper_Spelling();
+
+ void AddAsPropListener();
+ void RemoveAsPropListener();
+ void SetTmpPropVals( const css::beans::PropertyValues &rPropVals );
+ bool IsSpellUpperCase() const;
+ bool IsSpellWithDigits() const;
+ bool IsSpellCapitalization() const;
+ /// @throws css::uno::RuntimeException
+ bool addLinguServiceEventListener(
+ const css::uno::Reference< css::linguistic2::XLinguServiceEventListener >& rxListener );
+ /// @throws css::uno::RuntimeException
+ bool removeLinguServiceEventListener(
+ const css::uno::Reference< css::linguistic2::XLinguServiceEventListener >& rxListener );
+};
+
+
+class PropertyHelper_Hyphen final :
+ public PropertyChgHelper
+{
+ // default values
+ sal_Int16 nHyphMinLeading,
+ nHyphMinTrailing,
+ nHyphMinWordLength;
+ bool bNoHyphenateCaps;
+
+ // return values, will be set to default value or current temporary value
+ sal_Int16 nResHyphMinLeading,
+ nResHyphMinTrailing,
+ nResHyphMinWordLength;
+ bool bResNoHyphenateCaps;
+
+ PropertyHelper_Hyphen( const PropertyHelper_Hyphen & ) = delete;
+ PropertyHelper_Hyphen & operator = ( const PropertyHelper_Hyphen & ) = delete;
+
+ // PropertyChgHelper
+ virtual void SetDefaultValues() override;
+ virtual void GetCurrentValues() override;
+ virtual bool propertyChange_Impl(
+ const css::beans::PropertyChangeEvent& rEvt ) override;
+
+public:
+ PropertyHelper_Hyphen(
+ const css::uno::Reference< css::uno::XInterface > &rxSource,
+ css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet);
+ virtual ~PropertyHelper_Hyphen() override;
+
+ virtual void SetTmpPropVals( const css::beans::PropertyValues &rPropVals ) override;
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const css::beans::PropertyChangeEvent& rEvt ) override;
+
+ sal_Int16 GetMinLeading() const { return nResHyphMinLeading; }
+ sal_Int16 GetMinTrailing() const { return nResHyphMinTrailing; }
+ sal_Int16 GetMinWordLength() const { return nResHyphMinWordLength; }
+ bool IsNoHyphenateCaps() const { return bResNoHyphenateCaps; }
+};
+
+class UNLESS_MERGELIBS(LNG_DLLPUBLIC) PropertyHelper_Hyphenation
+{
+ rtl::Reference< PropertyHelper_Hyphen > mxPropHelper;
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Hyphenation( const PropertyHelper_Hyphen & ) = delete;
+ PropertyHelper_Hyphenation & operator = ( const PropertyHelper_Hyphen & ) = delete;
+
+public:
+ PropertyHelper_Hyphenation(
+ const css::uno::Reference< css::uno::XInterface > &rxSource,
+ css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet);
+ ~PropertyHelper_Hyphenation();
+
+ void AddAsPropListener();
+ void RemoveAsPropListener();
+ void SetTmpPropVals( const css::beans::PropertyValues &rPropVals );
+ sal_Int16 GetMinLeading() const;
+ sal_Int16 GetMinTrailing() const;
+ sal_Int16 GetMinWordLength() const;
+ bool IsNoHyphenateCaps() const;
+ /// @throws css::uno::RuntimeException
+ bool addLinguServiceEventListener(
+ const css::uno::Reference< css::linguistic2::XLinguServiceEventListener >& rxListener );
+ /// @throws css::uno::RuntimeException
+ bool removeLinguServiceEventListener(
+ const css::uno::Reference< css::linguistic2::XLinguServiceEventListener >& rxListener );
+};
+
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/lngprops.hxx b/include/linguistic/lngprops.hxx
new file mode 100644
index 000000000..2c3dc1d90
--- /dev/null
+++ b/include/linguistic/lngprops.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_LINGUISTIC_LNGPROPS_HXX
+#define INCLUDED_LINGUISTIC_LNGPROPS_HXX
+
+#include <rtl/ustring.hxx>
+
+// maximal number of suggestions to be returned in spelling context-menu
+// (may not include results added by looking up user dictionaries)
+inline constexpr OUStringLiteral UPN_MAX_NUMBER_OF_SUGGESTIONS = u"MaxNumberOfSuggestions";
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/misc.hxx b/include/linguistic/misc.hxx
new file mode 100644
index 000000000..02b3d44b3
--- /dev/null
+++ b/include/linguistic/misc.hxx
@@ -0,0 +1,196 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_LINGUISTIC_MISC_HXX
+#define INCLUDED_LINGUISTIC_MISC_HXX
+
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+
+#include <cppuhelper/implbase.hxx>
+#include <i18nlangtag/lang.h>
+#include <rtl/ustring.hxx>
+#include <linguistic/lngdllapi.h>
+
+#include <vector>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::frame { class XDesktop2; }
+namespace com::sun::star::linguistic2 { class XDictionary; }
+namespace com::sun::star::linguistic2 { class XDictionaryEntry; }
+namespace com::sun::star::linguistic2 { class XHyphenatedWord; }
+namespace com::sun::star::linguistic2 { class XLinguProperties; }
+namespace com::sun::star::linguistic2 { class XSearchableDictionaryList; }
+namespace osl { class Mutex; }
+
+class CharClass;
+class LocaleDataWrapper;
+
+
+inline constexpr OUStringLiteral SN_GRAMMARCHECKER = u"com.sun.star.linguistic2.Proofreader";
+inline constexpr OUStringLiteral SN_SPELLCHECKER = u"com.sun.star.linguistic2.SpellChecker";
+inline constexpr OUStringLiteral SN_HYPHENATOR = u"com.sun.star.linguistic2.Hyphenator";
+inline constexpr OUStringLiteral SN_THESAURUS = u"com.sun.star.linguistic2.Thesaurus";
+
+
+namespace linguistic
+{
+
+
+// AddEntryToDic return values
+enum class DictionaryError
+{
+ NONE, FULL, READONLY, UNKNOWN, NOT_EXISTS
+};
+
+// values assigned to capitalization types
+enum class CapType
+{
+ UNKNOWN,
+ NOCAP,
+ INITCAP,
+ ALLCAP,
+ MIXED
+};
+
+LNG_DLLPUBLIC ::osl::Mutex& GetLinguMutex();
+
+const LocaleDataWrapper & GetLocaleDataWrapper( LanguageType nLang );
+
+sal_Int32 LevDistance( std::u16string_view rTxt1, std::u16string_view rTxt2 );
+
+/** Convert Locale to LanguageType for legacy handling.
+ Linguistic specific handling of an empty locale denoting LANGUAGE_NONE.
+ Does not resolve empty locale as system locale.
+ */
+LNG_DLLPUBLIC LanguageType LinguLocaleToLanguage( const css::lang::Locale& rLocale );
+
+/** Convert LanguageType to Locale for legacy handling.
+ Linguistic specific handling of LANGUAGE_NONE resulting in an empty locale.
+ Avoid use!
+ */
+LNG_DLLPUBLIC css::lang::Locale LinguLanguageToLocale( LanguageType nLanguage );
+
+/** Checks if a LanguageType is one of the values that denote absence of
+ language or undetermined language or multiple languages, in short all
+ values used in linguistic context that do not denote a specific language.
+ */
+LNG_DLLPUBLIC bool LinguIsUnspecified( LanguageType nLanguage );
+
+/** The same as LinguIsUnspecified(LanguageType) but taking a BCP 47 language
+ tag string instead. */
+LNG_DLLPUBLIC bool LinguIsUnspecified( std::u16string_view rBcp47 );
+
+std::vector< LanguageType >
+ LocaleSeqToLangVec( css::uno::Sequence< css::lang::Locale > const &rLocaleSeq );
+css::uno::Sequence<sal_Int16>
+ LocaleSeqToLangSeq( css::uno::Sequence< css::lang::Locale > const &rLocaleSeq );
+
+// checks if file pointed to by rURL is readonly
+// and may also check return if such a file exists or not
+bool IsReadOnly( const OUString &rURL, bool *pbExist = nullptr );
+
+// checks if a file with the given URL exists
+bool FileExists( const OUString &rURL );
+
+
+OUString GetDictionaryWriteablePath();
+std::vector< OUString > GetDictionaryPaths();
+
+/// @returns a URL for a new and writable dictionary rDicName.
+/// The URL will point to the path given by 'GetDictionaryWriteablePath'
+LNG_DLLPUBLIC OUString GetWritableDictionaryURL( std::u16string_view rDicName );
+
+LNG_DLLPUBLIC sal_Int32 GetPosInWordToCheck( std::u16string_view rTxt, sal_Int32 nPos );
+
+css::uno::Reference< css::linguistic2::XHyphenatedWord >
+ RebuildHyphensAndControlChars(
+ const OUString &rOrigWord,
+ css::uno::Reference< css::linguistic2::XHyphenatedWord > const &rxHyphWord );
+
+
+LNG_DLLPUBLIC bool IsUpper( const OUString &rText, sal_Int32 nPos, sal_Int32 nLen, LanguageType nLanguage );
+
+inline bool IsUpper( const OUString &rText, LanguageType nLanguage ) { return IsUpper( rText, 0, rText.getLength(), nLanguage ); }
+LNG_DLLPUBLIC CapType capitalType(const OUString&, CharClass const *);
+
+LNG_DLLPUBLIC bool HasDigits( const OUString &rText );
+LNG_DLLPUBLIC bool IsNumeric( std::u16string_view rText );
+
+
+LNG_DLLPUBLIC css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguProperties();
+css::uno::Reference< css::linguistic2::XSearchableDictionaryList > GetDictionaryList();
+css::uno::Reference< css::linguistic2::XDictionary > GetIgnoreAllList();
+
+
+bool IsUseDicList( const css::beans::PropertyValues &rProperties,
+ const css::uno::Reference< css::beans::XPropertySet > &rxPropSet );
+
+bool IsIgnoreControlChars( const css::beans::PropertyValues &rProperties,
+ const css::uno::Reference< css::beans::XPropertySet > &rxPropSet );
+
+css::uno::Reference<
+ css::linguistic2::XDictionaryEntry >
+ SearchDicList(
+ const css::uno::Reference< css::linguistic2::XSearchableDictionaryList >& rDicList,
+ const OUString& rWord, LanguageType nLanguage,
+ bool bSearchPosDics, bool bSearchSpellEntry );
+
+LNG_DLLPUBLIC DictionaryError AddEntryToDic(
+ css::uno::Reference< css::linguistic2::XDictionary > const &rxDic,
+ const OUString &rWord, bool bIsNeg,
+ const OUString &rRplcTxt,
+ bool bStripDot = true );
+
+LNG_DLLPUBLIC bool SaveDictionaries( const css::uno::Reference< css::linguistic2::XSearchableDictionaryList > &xDicList );
+
+// AppExitLstnr:
+// virtual base class that calls it AtExit function when the application
+// (ie the Desktop) is about to terminate
+
+class AppExitListener :
+ public cppu::WeakImplHelper< css::frame::XTerminateListener >
+{
+ css::uno::Reference< css::frame::XDesktop2 > xDesktop;
+
+public:
+ AppExitListener();
+ virtual ~AppExitListener() override;
+
+ virtual void AtExit() = 0;
+
+ void Activate();
+ void Deactivate();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const css::lang::EventObject& aEvent ) override;
+ virtual void SAL_CALL notifyTermination( const css::lang::EventObject& aEvent ) override;
+};
+
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/spelldta.hxx b/include/linguistic/spelldta.hxx
new file mode 100644
index 000000000..d0057ffbd
--- /dev/null
+++ b/include/linguistic/spelldta.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_LINGUISTIC_SPELLDTA_HXX
+#define INCLUDED_LINGUISTIC_SPELLDTA_HXX
+
+#include <vector>
+#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
+#include <com/sun/star/linguistic2/XSetSpellAlternatives.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <linguistic/lngdllapi.h>
+#include <i18nlangtag/lang.h>
+#include <config_options.h>
+
+namespace com::sun::star::linguistic2 { class XSearchableDictionaryList; }
+
+
+namespace linguistic
+{
+
+std::vector< OUString >
+ MergeProposalSeqs(
+ std::vector< OUString > &rAlt1,
+ std::vector< OUString > &rAlt2 );
+
+void SeqRemoveNegEntries(
+ std::vector< OUString > &rSeq,
+ css::uno::Reference< css::linguistic2::XSearchableDictionaryList > const &rxDicList,
+ LanguageType nLanguage );
+
+void SearchSimilarText( const OUString &rText, LanguageType nLanguage,
+ css::uno::Reference< css::linguistic2::XSearchableDictionaryList > const &xDicList,
+ std::vector< OUString > & rDicListProps );
+
+
+class SpellAlternatives final
+ : public cppu::WeakImplHelper
+ <
+ css::linguistic2::XSpellAlternatives,
+ css::linguistic2::XSetSpellAlternatives
+ >
+{
+ css::uno::Sequence< OUString > aAlt; // list of alternatives, may be empty.
+ OUString aWord;
+ sal_Int16 nType; // type of failure
+ LanguageType nLanguage;
+
+public:
+ UNLESS_MERGELIBS(LNG_DLLPUBLIC) SpellAlternatives();
+ SpellAlternatives(OUString aWord, LanguageType nLang,
+ const css::uno::Sequence< OUString > &rAlternatives );
+ virtual ~SpellAlternatives() override;
+ SpellAlternatives(const SpellAlternatives&) = delete;
+ SpellAlternatives& operator=( const SpellAlternatives& ) = delete;
+
+ // XSpellAlternatives
+ virtual OUString SAL_CALL getWord( ) override;
+ virtual css::lang::Locale SAL_CALL getLocale( ) override;
+ virtual ::sal_Int16 SAL_CALL getFailureType( ) override;
+ virtual ::sal_Int16 SAL_CALL getAlternativesCount( ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getAlternatives( ) override;
+
+ // XSetSpellAlternatives
+ virtual void SAL_CALL setAlternatives( const css::uno::Sequence< OUString >& aAlternatives ) override;
+ virtual void SAL_CALL setFailureType( ::sal_Int16 nFailureType ) override;
+
+ // non-interface specific functions
+ void UNLESS_MERGELIBS(LNG_DLLPUBLIC) SetWordLanguage(const OUString &rWord, LanguageType nLang);
+ void UNLESS_MERGELIBS(LNG_DLLPUBLIC) SetFailureType(sal_Int16 nTypeP);
+ void UNLESS_MERGELIBS(LNG_DLLPUBLIC) SetAlternatives( const css::uno::Sequence< OUString > &rAlt );
+ static css::uno::Reference < css::linguistic2::XSpellAlternatives > UNLESS_MERGELIBS(LNG_DLLPUBLIC) CreateSpellAlternatives(
+ const OUString &rWord, LanguageType nLang, sal_Int16 nTypeP, const css::uno::Sequence< OUString > &rAlt );
+};
+
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/any.hxx b/include/o3tl/any.hxx
new file mode 100644
index 000000000..0acccff64
--- /dev/null
+++ b/include/o3tl/any.hxx
@@ -0,0 +1,325 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_ANY_HXX
+#define INCLUDED_O3TL_ANY_HXX
+
+#include <sal/config.h>
+
+#include <cassert>
+#include <type_traits>
+#include <utility>
+
+#include <optional>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <cppu/unotype.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+// Some functionality related to css::uno::Any that would ideally be part of
+// <com/sun/star/uno/Any.hxx>, but (for now) cannot be for some reason.
+
+namespace o3tl {
+
+namespace detail {
+
+struct Void {};
+
+template<typename T> struct Optional { using type = T const *; };
+template<> struct Optional<void> { using type = std::optional<Void const>; };
+template<> struct Optional<bool> { using type = std::optional<bool const>; };
+template<> struct Optional<sal_Int8> {
+ using type = std::optional<sal_Int8 const>;
+};
+template<> struct Optional<sal_Int16> {
+ using type = std::optional<sal_Int16 const>;
+};
+template<> struct Optional<sal_uInt16> {
+ using type = std::optional<sal_uInt16 const>;
+};
+template<> struct Optional<sal_Int32> {
+ using type = std::optional<sal_Int32 const>;
+};
+template<> struct Optional<sal_uInt32> {
+ using type = std::optional<sal_uInt32 const>;
+};
+template<> struct Optional<sal_Int64> {
+ using type = std::optional<sal_Int64 const>;
+};
+template<> struct Optional<sal_uInt64> {
+ using type = std::optional<sal_uInt64 const>;
+};
+template<> struct Optional<float> {
+ using type = std::optional<float const>;
+};
+template<> struct Optional<double> {
+ using type = std::optional<double const>;
+};
+template<typename T> struct Optional<css::uno::Reference<T>> {
+ using type = std::optional<css::uno::Reference<T> const>;
+};
+template<> struct Optional<css::uno::Reference<css::uno::XInterface>> {
+ using type = css::uno::Reference<css::uno::XInterface> const *;
+};
+
+template<typename> struct IsDerivedReference: std::false_type {};
+template<typename T> struct IsDerivedReference<css::uno::Reference<T>>:
+ std::true_type
+{};
+template<> struct IsDerivedReference<css::uno::Reference<css::uno::XInterface>>:
+ std::false_type
+{};
+
+template<typename> struct IsUnoSequenceType: std::false_type {};
+template<typename T> struct IsUnoSequenceType<cppu::UnoSequenceType<T>>:
+ std::true_type
+{};
+
+template<typename T> inline std::optional<T const> tryGetConverted(
+ css::uno::Any const & any)
+{
+ T v;
+ return (any >>= v)
+ ? std::optional<T const>(std::move(v)) : std::optional<T const>();
+}
+
+}
+
+/** Try to access the value of a specific type stored in an Any.
+
+ In trying to obtain a value, the same set of conversions as supported by
+ ">>=" are considered.
+
+ The returned object is a proxy. Proxies can be either positive or negative.
+ Each proxy can be contextually converted to bool, yielding true iff the
+ proxy is positive. For a positive proxy P representing a value of requested
+ type T, for any T other than void, the expression *P yields that value of
+ type T. (Technically, the proxy is either a plain pointer or a
+ std::optional, depending on whether a plain pointer into the given Any can
+ be returned for the specified type.)
+
+ @attention A proxy returned from this function must not outlive the
+ corresponding Any passed into this function (as it may constitute a pointer
+ into the Any's internals). That is the reason why this function is
+ restricted to lvalue arguments (i.e., to non-temporary Any objects), to
+ avoid misuses like
+ @code
+ css::uno::Any f();
+
+ if (auto p = o3tl::tryAccess<css::beans::NamedValue>(f())) {
+ return p->Name;
+ }
+ @endcode
+
+ @note Ideally this would be a public member function of css::uno::Any (at
+ least conditional on LIBO_INTERNAL_ONLY, as it requires C++11). However, as
+ std::optional (which would be needed to implement the proxies) is only
+ available since C++14, we need to use std::optional for now. But To not
+ make every entity that includes <com/sun/star/uno/Any.hxx> depend on
+ boost_headers, keep this here for now.
+
+ @tparam T the C++ representation of a UNO type that can be contained in a
+ UNO ANY (i.e., any UNO type other than ANY itself). The legacy C++
+ representations sal_Bool, cppu::UnoVoidType, cppu::UnoUnsignedShortType,
+ cppu::UnoCharType, and cppu::UnoSequenceType are not supported. Must be a
+ complete type or void.
+
+ @param any an Any value.
+
+ @return a positive proxy for the value of the specified type obtained from
+ the given Any, or a negative proxy if no such value can be obtained.
+*/
+template<typename T> inline
+typename std::enable_if<
+ !(detail::IsDerivedReference<T>::value
+ || detail::IsUnoSequenceType<T>::value
+ || std::is_base_of<css::uno::XInterface, T>::value),
+ typename detail::Optional<T>::type>::type
+tryAccess(css::uno::Any const & any) {
+ // CHAR, STRING, TYPE, sequence types, enum types, struct types, exception
+ // types, and com.sun.star.uno.XInterface interface type:
+ return cppu::UnoType<T>::get().isAssignableFrom(any.getValueType())
+ ? static_cast<T const *>(any.getValue()) : nullptr;
+}
+
+template<> inline detail::Optional<void>::type tryAccess<void>(
+ css::uno::Any const & any)
+{
+ return any.hasValue()
+ ? std::optional<detail::Void const>()
+ : std::optional<detail::Void const>(detail::Void());
+}
+
+template<> inline detail::Optional<bool>::type tryAccess<bool>(
+ css::uno::Any const & any)
+{
+ return detail::tryGetConverted<bool>(any);
+}
+
+template<> inline detail::Optional<sal_Int8>::type tryAccess<sal_Int8>(
+ css::uno::Any const & any)
+{
+ return detail::tryGetConverted<sal_Int8>(any);
+}
+
+template<> inline detail::Optional<sal_Int16>::type tryAccess<sal_Int16>(
+ css::uno::Any const & any)
+{
+ return detail::tryGetConverted<sal_Int16>(any);
+}
+
+template<> inline detail::Optional<sal_uInt16>::type tryAccess<sal_uInt16>(
+ css::uno::Any const & any)
+{
+ return detail::tryGetConverted<sal_uInt16>(any);
+}
+
+template<> inline detail::Optional<sal_Int32>::type tryAccess<sal_Int32>(
+ css::uno::Any const & any)
+{
+ return detail::tryGetConverted<sal_Int32>(any);
+}
+
+template<> inline detail::Optional<sal_uInt32>::type tryAccess<sal_uInt32>(
+ css::uno::Any const & any)
+{
+ return detail::tryGetConverted<sal_uInt32>(any);
+}
+
+template<> inline detail::Optional<sal_Int64>::type tryAccess<sal_Int64>(
+ css::uno::Any const & any)
+{
+ return detail::tryGetConverted<sal_Int64>(any);
+}
+
+template<> inline detail::Optional<sal_uInt64>::type tryAccess<sal_uInt64>(
+ css::uno::Any const & any)
+{
+ return detail::tryGetConverted<sal_uInt64>(any);
+}
+
+template<> inline detail::Optional<float>::type tryAccess<float>(
+ css::uno::Any const & any)
+{
+ return detail::tryGetConverted<float>(any);
+}
+
+template<> inline detail::Optional<double>::type tryAccess<double>(
+ css::uno::Any const & any)
+{
+ return detail::tryGetConverted<double>(any);
+}
+
+template<> detail::Optional<css::uno::Any>::type tryAccess<css::uno::Any>(
+ css::uno::Any const &) = delete;
+
+template<> detail::Optional<sal_Bool>::type tryAccess<sal_Bool>(
+ css::uno::Any const &) = delete;
+
+/*
+
+// Already prevented by std::is_base_of<css::uno::XInterface, T> requiring T to
+// be complete:
+
+template<> detail::Optional<cppu::UnoVoidType>::type
+tryAccess<cppu::UnoVoidType>(css::uno::Any const &) = delete;
+
+template<> detail::Optional<cppu::UnoUnsignedShortType>::type
+tryAccess<cppu::UnoUnsignedShortType>(css::uno::Any const &) = delete;
+
+template<> detail::Optional<cppu::UnoCharType>::type
+tryAccess<cppu::UnoCharType>(css::uno::Any const &) = delete;
+
+*/
+
+template<typename T> inline
+typename std::enable_if<
+ detail::IsDerivedReference<T>::value,
+ typename detail::Optional<T>::type>::type
+tryAccess(css::uno::Any const & any) {
+ return detail::tryGetConverted<T>(any);
+}
+
+template<typename T> typename detail::Optional<T>::type tryAccess(
+ css::uno::Any const volatile &&) = delete;
+
+/** Access the value of a specific type stored in an Any, throwing an exception
+ on failure.
+
+ @attention A proxy returned from this function must not outlive the
+ corresponding Any passed into this function (as it may constitute a pointer
+ into the Any's internals). However, unlike with tryAccess, the benefit of
+ allowing this function to operate on temporaries appears to outweigh its
+ dangers.
+
+ @note Ideally this would be a public member function of css::uno::Any. See
+ tryAccess for details.
+
+ @tparam T the C++ representation of a UNO type that can be contained in a
+ UNO ANY. See tryAccess for details.
+
+ @param any an Any value.
+
+ @return a positive proxy for the value of the specified type obtained from
+ the given Any. See tryAccess for details.
+
+ @throws css::uno::RuntimeException when a value of the requested type
+ cannot be obtained.
+*/
+template<typename T> inline typename detail::Optional<T>::type doAccess(
+ css::uno::Any const & any)
+{
+ auto opt = tryAccess<T>(any);
+ if (!opt) {
+ throw css::uno::RuntimeException(
+ OUString(
+ cppu_Any_extraction_failure_msg(
+ &any, cppu::UnoType<T>::get().getTypeLibType()),
+ SAL_NO_ACQUIRE));
+ }
+ return opt;
+}
+
+/** Access the value of a specific type stored in an Any, knowing the Any
+ contains a value of a matching type.
+
+ @attention A proxy returned from this function must not outlive the
+ corresponding Any passed into this function (as it may constitute a pointer
+ into the Any's internals). However, unlike with tryAccess, the benefit of
+ allowing this function to operate on temporaries appears to outweigh its
+ dangers.
+
+ @note Ideally this would be a public member function of css::uno::Any. See
+ tryAccess for details.
+
+ @tparam T the C++ representation of a UNO type that can be contained in a
+ UNO ANY. See tryAccess for details.
+
+ @param any an Any value.
+
+ @return a positive proxy for the value of the specified type obtained from
+ the given Any. See tryAccess for details.
+*/
+template<typename T> inline typename detail::Optional<T>::type forceAccess(
+ css::uno::Any const & any)
+{
+ auto opt = tryAccess<T>(any);
+ assert(opt);
+ return opt;
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/char16_t2wchar_t.hxx b/include/o3tl/char16_t2wchar_t.hxx
new file mode 100644
index 000000000..6ffab02e7
--- /dev/null
+++ b/include/o3tl/char16_t2wchar_t.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_CHAR16_T2WCHAR_T_HXX
+#define INCLUDED_O3TL_CHAR16_T2WCHAR_T_HXX
+
+#include <sal/config.h>
+
+namespace o3tl {
+
+#if defined _WIN32
+// Helpers for safe conversion between wchar_t and char16_t in MSVC
+
+static_assert(sizeof(char16_t) == sizeof(wchar_t),
+ "These helper functions are only applicable to implementations with 16-bit wchar_t");
+
+// While other implementations define wchar_t as 32-bit integral value, and mostly use
+// char-based UTF-8 string APIs, in MSVC wchar_t is (non-conformant) 16-bit, and Unicode
+// support is implemented by Unicode-aware WinAPI functions taking UTF-16 LE strings,
+// and also stdlib functions taking those strings.
+//
+// In LibreOffice, internal string representation is also UTF-16 with system endianness
+// (sal_Unicode that is typedef for char16_t); so it is an important implementation concept
+// to treat internal strings as directly usable by WinAPI/stdlib functions and vice versa.
+// Also, it's important to use safe conversion between unrelated underlying C++ types
+// used for MSVC and LibreOffice string storage without plain reinterpret_cast that brings
+// risks of masking errors like casting char buffers to wchar_t/char16_t.
+//
+// Use these helpers for wchar_t (WSTR, WCHAR, OLESTR etc) to char16_t (sal_Unicode) string
+// conversions instead of reinterpret-cast in Windows-specific code.
+inline wchar_t * toW(char16_t * p)
+{
+ return reinterpret_cast<wchar_t *>(p);
+}
+inline wchar_t const * toW(char16_t const * p)
+{
+ return reinterpret_cast<wchar_t const *>(p);
+}
+inline char16_t * toU(wchar_t * p)
+{
+ return reinterpret_cast<char16_t *>(p);
+}
+inline char16_t const * toU(wchar_t const * p)
+{
+ return reinterpret_cast<char16_t const *>(p);
+}
+#endif
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/cow_wrapper.hxx b/include/o3tl/cow_wrapper.hxx
new file mode 100644
index 000000000..cc823f60e
--- /dev/null
+++ b/include/o3tl/cow_wrapper.hxx
@@ -0,0 +1,387 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_COW_WRAPPER_HXX
+#define INCLUDED_O3TL_COW_WRAPPER_HXX
+
+#include <osl/interlck.h>
+
+#include <optional>
+#include <cstddef>
+
+namespace o3tl
+{
+ /** Thread-unsafe refcounting
+
+ This is the default locking policy for cow_wrapper. No
+ locking/guarding against concurrent access is performed
+ whatsoever.
+ */
+ struct UnsafeRefCountingPolicy
+ {
+ typedef std::size_t ref_count_t;
+ static void incrementCount( ref_count_t& rCount ) { ++rCount; }
+ static bool decrementCount( ref_count_t& rCount ) { return --rCount != 0; }
+ };
+
+ /** Thread-safe refcounting
+
+ Use this to have the cow_wrapper refcounting mechanisms employ
+ the thread-safe oslInterlockedCount .
+ */
+ struct ThreadSafeRefCountingPolicy
+ {
+ typedef oslInterlockedCount ref_count_t;
+ static void incrementCount( ref_count_t& rCount ) { osl_atomic_increment(&rCount); }
+ static bool decrementCount( ref_count_t& rCount )
+ {
+ return osl_atomic_decrement(&rCount) != 0;
+ }
+ };
+
+ /** Copy-on-write wrapper.
+
+ This template provides copy-on-write semantics for the wrapped
+ type: when copying, the operation is performed shallow,
+ i.e. different cow_wrapper objects share the same underlying
+ instance. Only when accessing the underlying object via
+ non-const methods, a unique copy is provided.
+
+ The type parameter <code>T</code> must satisfy the following
+ requirements: it must be default-constructible, copyable (it
+ need not be assignable), and be of non-reference type. Note
+ that, despite the fact that this template provides access to
+ the wrapped type via pointer-like methods
+ (<code>operator->()</code> and <code>operator*()</code>), it does
+ <em>not</em> work like e.g. the std smart pointer wrappers
+ (shared_ptr, unique_ptr, etc.). Internally, the cow_wrapper
+ holds a by-value instance of the wrapped object. This is to
+ avoid one additional heap allocation, and providing access via
+ <code>operator->()</code>/<code>operator*()</code> is because
+ <code>operator.()</code> cannot be overridden.
+
+ Regarding thread safety: this wrapper is <em>not</em>
+ thread-safe per se, because cow_wrapper has no way of
+ synchronizing the potentially many different cow_wrapper
+ instances, that reference a single shared value_type
+ instance. That said, when passing
+ <code>ThreadSafeRefCountingPolicy</code> as the
+ <code>MTPolicy</code> parameter, accessing a thread-safe
+ pointee through multiple cow_wrapper instances might be
+ thread-safe, if the individual pointee methods are
+ thread-safe, <em>including</em> pointee's copy
+ constructor. Any wrapped object that needs external
+ synchronisation (e.g. via an external mutex, which arbitrates
+ access to object methods, and can be held across multiple
+ object method calls) cannot easily be dealt with in a
+ thread-safe way, because, as noted, objects are shared behind
+ the client's back.
+
+ @attention if one wants to use the pimpl idiom together with
+ cow_wrapper (i.e. put an opaque type into the cow_wrapper),
+ then <em>all<em> methods in the surrounding class needs to be
+ non-inline (<em>including</em> destructor, copy constructor
+ and assignment operator).
+
+ @example
+ <pre>
+class cow_wrapper_client_impl;
+
+class cow_wrapper_client
+{
+public:
+ cow_wrapper_client();
+ cow_wrapper_client( const cow_wrapper_client& );
+ cow_wrapper_client( cow_wrapper_client&& );
+ ~cow_wrapper_client();
+
+ cow_wrapper_client& operator=( const cow_wrapper_client& );
+ cow_wrapper_client& operator=( cow_wrapper_client&& );
+
+ void modify( int nVal );
+ int queryUnmodified() const;
+
+private:
+ o3tl::cow_wrapper< cow_wrapper_client_impl > maImpl;
+};
+ </pre>
+ and the implementation file would look like this:
+ <pre>
+class cow_wrapper_client_impl
+{
+public:
+ void setValue( int nVal ) { mnValue = nVal; }
+ int getValue() const { return mnValue; }
+
+private:
+ int mnValue;
+}
+
+cow_wrapper_client::cow_wrapper_client() :
+ maImpl()
+{
+}
+cow_wrapper_client::cow_wrapper_client( const cow_wrapper_client& rSrc ) :
+ maImpl( rSrc.maImpl )
+{
+}
+cow_wrapper_client::cow_wrapper_client( cow_wrapper_client& rSrc ) :
+ maImpl( std::move( rSrc.maImpl ) )
+{
+}
+cow_wrapper_client::~cow_wrapper_client()
+{
+}
+cow_wrapper_client& cow_wrapper_client::operator=( const cow_wrapper_client& rSrc )
+{
+ maImpl = rSrc.maImpl;
+ return *this;
+}
+cow_wrapper_client& cow_wrapper_client::operator=( cow_wrapper_client&& rSrc )
+{
+ maImpl = std::move( rSrc.maImpl );
+ return *this;
+}
+void cow_wrapper_client::modify( int nVal )
+{
+ maImpl->setValue( nVal );
+}
+int cow_wrapper_client::queryUnmodified() const
+{
+ return maImpl->getValue();
+}
+ </pre>
+ */
+ template<typename T, class MTPolicy=UnsafeRefCountingPolicy> class cow_wrapper
+ {
+ /** shared value object - gets cloned before cow_wrapper hands
+ out a non-const reference to it
+ */
+ struct impl_t
+ {
+ impl_t(const impl_t&) = delete;
+ impl_t& operator=(const impl_t&) = delete;
+
+ impl_t() :
+ m_value(),
+ m_ref_count(1)
+ {
+ }
+
+ explicit impl_t( const T& v ) :
+ m_value(v),
+ m_ref_count(1)
+ {
+ }
+
+ explicit impl_t( T&& v ) :
+ m_value(std::move(v)),
+ m_ref_count(1)
+ {
+ }
+
+ T m_value;
+ typename MTPolicy::ref_count_t m_ref_count;
+ };
+
+ void release()
+ {
+ if( m_pimpl && !MTPolicy::decrementCount(m_pimpl->m_ref_count) )
+ {
+ delete m_pimpl;
+ m_pimpl = nullptr;
+ }
+ }
+
+ public:
+ typedef T value_type;
+ typedef T* pointer;
+ typedef const T* const_pointer;
+ typedef MTPolicy mt_policy;
+
+ /** Default-construct wrapped type instance
+ */
+ cow_wrapper() :
+ m_pimpl( new impl_t() )
+ {
+ }
+
+ /** Copy-construct wrapped type instance from given object
+ */
+ explicit cow_wrapper( const value_type& r ) :
+ m_pimpl( new impl_t(r) )
+ {
+ }
+
+ /** Move-construct wrapped type instance from given object
+ */
+ explicit cow_wrapper( value_type&& r ) :
+ m_pimpl( new impl_t(std::move(r)) )
+ {
+ }
+
+ /** Shallow-copy given cow_wrapper
+ */
+ explicit cow_wrapper( const cow_wrapper& rSrc ) : // nothrow
+ m_pimpl( rSrc.m_pimpl )
+ {
+ MTPolicy::incrementCount( m_pimpl->m_ref_count );
+ }
+
+ /** Move-construct and steal rSrc shared resource
+ */
+ explicit cow_wrapper( cow_wrapper&& rSrc ) noexcept :
+ m_pimpl( rSrc.m_pimpl )
+ {
+ rSrc.m_pimpl = nullptr;
+ }
+
+ // Only intended to be used by std::optional specialisations
+ explicit cow_wrapper( std::nullopt_t ) noexcept :
+ m_pimpl( nullptr )
+ {
+ }
+
+ // Only intended to be used by std::optional specialisations
+ explicit cow_wrapper( const cow_wrapper& rSrc, std::nullopt_t ) : // nothrow
+ m_pimpl( rSrc.m_pimpl )
+ {
+ if (m_pimpl)
+ MTPolicy::incrementCount( m_pimpl->m_ref_count );
+ }
+
+ ~cow_wrapper() // nothrow, if ~T does not throw
+ {
+ release();
+ }
+
+ /// now sharing rSrc cow_wrapper instance with us
+ cow_wrapper& operator=( const cow_wrapper& rSrc ) // nothrow
+ {
+ // this already guards against self-assignment
+ MTPolicy::incrementCount( rSrc.m_pimpl->m_ref_count );
+
+ release();
+ m_pimpl = rSrc.m_pimpl;
+
+ return *this;
+ }
+
+ /// stealing rSrc's resource
+ cow_wrapper& operator=(cow_wrapper&& rSrc) noexcept
+ {
+ // self-movement guts ourself, see also 17.6.4.9
+ release();
+ m_pimpl = rSrc.m_pimpl;
+
+ rSrc.m_pimpl = nullptr;
+
+ return *this;
+ }
+
+ /// unshare with any other cow_wrapper instance
+ value_type& make_unique()
+ {
+ if( m_pimpl->m_ref_count > 1 )
+ {
+ impl_t* pimpl = new impl_t(m_pimpl->m_value);
+ release();
+ m_pimpl = pimpl;
+ }
+
+ return m_pimpl->m_value;
+ }
+
+ /// true, if not shared with any other cow_wrapper instance
+ bool is_unique() const // nothrow
+ {
+ return !m_pimpl || m_pimpl->m_ref_count == 1;
+ }
+
+ /// return number of shared instances (1 for unique object)
+ typename MTPolicy::ref_count_t use_count() const // nothrow
+ {
+ return m_pimpl ? m_pimpl->m_ref_count : 0;
+ }
+
+ void swap(cow_wrapper& r) // never throws
+ {
+ std::swap(m_pimpl, r.m_pimpl);
+ }
+
+ pointer operator->() { return &make_unique(); }
+ value_type& operator*() { return make_unique(); }
+ const_pointer operator->() const { return &m_pimpl->m_value; }
+ const value_type& operator*() const { return m_pimpl->m_value; }
+
+ pointer get() { return &make_unique(); }
+ const_pointer get() const { return &m_pimpl->m_value; }
+
+ /// true, if both cow_wrapper internally share the same object
+ bool same_object( const cow_wrapper& rOther ) const
+ {
+ return rOther.m_pimpl == m_pimpl;
+ }
+
+ // Only intended to be used by std::optional specialisations
+ bool empty() const { return m_pimpl == nullptr; }
+ // Only intended to be used by std::optional specialisations
+ void set_empty()
+ {
+ if (m_pimpl)
+ {
+ release();
+ m_pimpl = nullptr;
+ }
+ }
+
+ private:
+ impl_t* m_pimpl;
+ };
+
+
+ template<class T, class P> inline bool operator==( const cow_wrapper<T,P>& a,
+ const cow_wrapper<T,P>& b )
+ {
+ return a.same_object(b) || *a == *b;
+ }
+
+ template<class T, class P> inline bool operator!=( const cow_wrapper<T,P>& a,
+ const cow_wrapper<T,P>& b )
+ {
+ return !a.same_object(b) && *a != *b;
+ }
+
+ template<class A, class B, class P> inline bool operator<( const cow_wrapper<A,P>& a,
+ const cow_wrapper<B,P>& b )
+ {
+ return *a < *b;
+ }
+
+ template<class T, class P> inline void swap( cow_wrapper<T,P>& a,
+ cow_wrapper<T,P>& b )
+ {
+ a.swap(b);
+ }
+
+}
+
+#endif /* INCLUDED_O3TL_COW_WRAPPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/cppunittraitshelper.hxx b/include/o3tl/cppunittraitshelper.hxx
new file mode 100644
index 000000000..2a6fb8836
--- /dev/null
+++ b/include/o3tl/cppunittraitshelper.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_CPPUNITTRAITSHELPER_HXX
+#define INCLUDED_O3TL_CPPUNITTRAITSHELPER_HXX
+
+#include <sal/config.h>
+
+#include <cstdint>
+#include <string>
+
+#include <cppunit/TestAssert.h>
+
+// ostream << char16_t is deleted since C++20 (but just keep outputting numeric values):
+template <> inline std::string CppUnit::assertion_traits<char16_t>::toString(char16_t const& x)
+{
+ return assertion_traits<std::uint_least16_t>::toString(std::uint_least16_t(x));
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/deleter.hxx b/include/o3tl/deleter.hxx
new file mode 100644
index 000000000..76d8d5a35
--- /dev/null
+++ b/include/o3tl/deleter.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_DELETER_HXX
+#define INCLUDED_O3TL_DELETER_HXX
+
+#include <sal/config.h>
+
+#include <cstdlib>
+
+#if defined(__COVERITY__)
+#define suppress_fun_call_w_exception(expr) \
+ do \
+ { \
+ try \
+ { \
+ expr; \
+ } \
+ catch (...) \
+ { \
+ std::terminate(); \
+ } \
+ } while (false)
+#else
+#define suppress_fun_call_w_exception(expr) \
+ do \
+ { \
+ expr; \
+ } while (false)
+#endif
+
+namespace o3tl
+{
+/** To markup std::unique_ptr that coverity warns might throw exceptions
+ which won't throw in practice, or where std::terminate is
+ an acceptable response if they do
+*/
+template <typename T> struct default_delete
+{
+ void operator()(T* p) noexcept { suppress_fun_call_w_exception(delete p); }
+};
+
+struct free_delete
+{
+ void operator()(void* p) { std::free(p); }
+};
+
+template <typename uniqueptr> void reset_preserve_ptr_during(uniqueptr& ptr)
+{
+ // HACK: for the case where the dtor of the obj held by ptr will trigger
+ // functions which expect ptr to still be set during the dtor.
+ // e.g. SdrObject::GetBroadcaster() is called during the destructor
+ // in SdrEdgeObj::Notify(). So delete first, then clear the pointer
+ delete ptr.get();
+ // coverity[leaked_storage] - not a leak, deleted on line above
+ (void)ptr.release();
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/enumarray.hxx b/include/o3tl/enumarray.hxx
new file mode 100644
index 000000000..a3c09d56b
--- /dev/null
+++ b/include/o3tl/enumarray.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_ENUMARRAY_HXX
+#define INCLUDED_O3TL_ENUMARRAY_HXX
+
+#include <iterator>
+#include <type_traits>
+#include <cassert>
+
+namespace o3tl {
+
+template<typename EA>
+class enumarray_iterator;
+template<typename EA>
+class enumarray_const_iterator;
+
+///
+/// This is a container convenience class for arrays indexed by enum values.
+///
+/// This assumes that the 'enum class' definition
+/// - starts at zero
+/// - has no holes in its sequence of values
+/// - defines a value called LAST which refers to the greatest constant.
+///
+/// \param E the 'enum class' type.
+/// \param V the value type to be stored in the array
+template<typename E, typename V>
+class enumarray final
+{
+public:
+ typedef enumarray<E, V> self_type;
+ typedef enumarray_iterator<self_type> iterator;
+ typedef enumarray_const_iterator<self_type> const_iterator;
+
+ typedef V value_type;
+ typedef E key_type;
+ typedef size_t size_type;
+
+ static const size_type max_index = static_cast<size_type>(E::LAST);
+
+ const V& operator[](E index) const
+ {
+ assert(index>=static_cast<E>(0) && index<=E::LAST);
+ return detail_values[static_cast<size_type>(index)];
+ }
+
+ V& operator[](E index)
+ {
+ assert(index>=static_cast<E>(0) && index<=E::LAST);
+ return detail_values[static_cast<size_type>(index)];
+ }
+
+ void fill(V val)
+ { for (size_type i=0; i<=max_index; ++i) detail_values[i] = val; }
+
+ static size_type size() { return max_index + 1; }
+ iterator begin() { return iterator(*this, 0); }
+ iterator end() { return iterator(*this, size()); }
+ const_iterator begin() const { return const_iterator(*this, 0); }
+ const_iterator end() const { return const_iterator(*this, size()); }
+
+ V* data() { return detail_values; }
+
+//private:
+ V detail_values[max_index + 1];
+};
+
+
+template<typename EA>
+class enumarray_iterator {
+ EA* m_buf;
+ size_t m_pos;
+public:
+ typedef enumarray_iterator<EA> self_type;
+ typedef typename EA::value_type value_type;
+ typedef typename EA::key_type key_type;
+ typedef std::bidirectional_iterator_tag iterator_category; //should be random access, but that would require define subtraction operators on the enums
+ typedef
+ typename std::make_signed<
+ typename std::underlying_type<typename EA::key_type>::type>::type
+ difference_type;
+ typedef typename EA::value_type* pointer;
+ typedef typename EA::value_type& reference;
+
+ enumarray_iterator(EA& b, size_t start_pos)
+ : m_buf(&b), m_pos(start_pos) {}
+ value_type& operator*() const { return (*m_buf)[static_cast<key_type>(m_pos)]; }
+ value_type* operator->() const { return &(operator*()); }
+ self_type& operator++() { ++m_pos; return *this; }
+ bool operator!=(self_type const & other) const { return m_buf != other.m_buf || m_pos != other.m_pos; }
+ bool operator==(self_type const & other) const { return m_buf == other.m_buf && m_pos == other.m_pos; }
+};
+
+template<typename EA>
+class enumarray_const_iterator {
+ EA const * m_buf;
+ size_t m_pos;
+public:
+ typedef enumarray_const_iterator<EA> self_type;
+ typedef typename EA::value_type const value_type;
+ typedef typename EA::key_type key_type;
+ typedef std::bidirectional_iterator_tag iterator_category; //should be random access, but that would require define subtraction operators on the enums
+ typedef
+ typename std::make_signed<
+ typename std::underlying_type<typename EA::key_type>::type>::type
+ difference_type;
+ typedef typename EA::value_type const * pointer;
+ typedef typename EA::value_type const & reference;
+
+ enumarray_const_iterator(EA const & b, size_t start_pos)
+ : m_buf(&b), m_pos(start_pos) {}
+ value_type& operator*() const { return (*m_buf)[static_cast<key_type>(m_pos)]; }
+ value_type* operator->() const { return &(operator*()); }
+ self_type& operator++() { ++m_pos; return *this; }
+ bool operator!=(self_type const & other) const { return m_buf != other.m_buf || m_pos != other.m_pos; }
+ bool operator==(self_type const & other) const { return m_buf == other.m_buf && m_pos == other.m_pos; }
+};
+
+}; // namespace o3tl
+
+#endif /* INCLUDED_O3TL_ENUMARRAY_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/enumrange.hxx b/include/o3tl/enumrange.hxx
new file mode 100644
index 000000000..60f069c9f
--- /dev/null
+++ b/include/o3tl/enumrange.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_ENUMRANGE_HXX
+#define INCLUDED_O3TL_ENUMRANGE_HXX
+
+namespace o3tl {
+
+///
+/// This is a container convenience class iterating over scoped enumerations.
+///
+/// This assumes that the 'enum class' definition
+/// - starts at zero
+/// - has no holes in its sequence of values
+/// - defines a value called LAST which refers to the greatest constant.
+///
+/// Use like this:
+/// enum class COLOR { RED, GREEN, BLUE, LAST=BLUE };
+/// for( auto e : o3tl::enumrange<Color>() )
+/// ....;
+///
+/// \param T the 'enum class' type.
+template< typename T>
+class enumrange
+{
+public:
+ class Iterator
+ {
+ public:
+ Iterator( int value ) :
+ m_value( value )
+ {
+ }
+
+ T operator*( void ) const
+ {
+ return static_cast<T>(m_value);
+ }
+
+ void operator++( void )
+ {
+ ++m_value;
+ }
+
+ bool operator!=( Iterator rhs ) const
+ {
+ return m_value != rhs.m_value;
+ }
+
+ private:
+ int m_value;
+ };
+};
+
+template< typename T >
+typename enumrange<T>::Iterator begin( enumrange<T> )
+{
+ return typename enumrange<T>::Iterator( int(0) );
+}
+
+template< typename T >
+typename enumrange<T>::Iterator end( enumrange<T> )
+{
+ return typename enumrange<T>::Iterator( static_cast<int>(T::LAST) + 1 );
+}
+
+}; // namespace o3tl
+
+#endif /* INCLUDED_O3TL_ENUMRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/float_int_conversion.hxx b/include/o3tl/float_int_conversion.hxx
new file mode 100644
index 000000000..403bed622
--- /dev/null
+++ b/include/o3tl/float_int_conversion.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_FLOAT_INT_CONVERSION_HXX
+#define INCLUDED_O3TL_FLOAT_INT_CONVERSION_HXX
+
+#include <sal/config.h>
+
+#include <cmath>
+#include <limits>
+#include <type_traits>
+
+namespace o3tl
+{
+// Return true iff `value` of floating-point type `F` converts to a value of integral type `I` no
+// smaller than `min`:
+template <typename F, typename I>
+constexpr std::enable_if_t<std::is_floating_point_v<F> && std::is_integral_v<I>, bool>
+convertsToAtLeast(F value, I min)
+{
+ // If `F(min)`, `F(min) - F(1)` are too large in magnitude for `F`'s precision, then they either
+ // fall into the same bucket, in which case we should return false if `value` represents that
+ // bucket, or they are on the boundary of two adjacent buckets, in which case we should return
+ // true if `value`represents the higher bucket containing `F(min)`:
+ return value > F(min) - F(1);
+}
+
+// Return true iff `value` of floating-point type `F` converts to a value of integral type `I` no
+// larger than `max`:
+template <typename F, typename I>
+constexpr std::enable_if_t<std::is_floating_point_v<F> && std::is_integral_v<I>, bool>
+convertsToAtMost(F value, I max)
+{
+ // If `F(max)`, `F(max) + F(1)` are too large in magnitude for `F`'s precision, then they either
+ // fall into the same bucket, in which case we should return false if `value` represents that
+ // bucket, or they are on the boundary of two adjacent buckets, in which case we should return
+ // true if `value`represents the lower bucket containing `F(max)`:
+ return value < F(max) + F(1);
+}
+
+// Casts a floating-point to an integer, avoiding overflow. Used like:
+// sal_Int64 n = o3tl::saturating_cast<sal_Int64>(f);
+template <typename I, typename F>
+constexpr std::enable_if_t<std::is_floating_point_v<F> && std::is_integral_v<I>, I>
+saturating_cast(F f)
+{
+ if constexpr (std::is_signed_v<I>)
+ if (!convertsToAtLeast(f, std::numeric_limits<I>::min()))
+ return std::numeric_limits<I>::min();
+ if (!convertsToAtMost(f, std::numeric_limits<I>::max()))
+ return std::numeric_limits<I>::max();
+ return f;
+}
+
+// Return `value` of floating-point type `F` rounded to the nearest integer away from zero (which
+// can be useful in calls to convertsToAtLeast/Most(roundAway(x), n), to reject x that are
+// smaller/larger than n because they have a fractional part):
+template <typename F> std::enable_if_t<std::is_floating_point_v<F>, F> roundAway(F value)
+{
+ return value >= 0 ? std::ceil(value) : std::floor(value);
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/functional.hxx b/include/o3tl/functional.hxx
new file mode 100644
index 000000000..9ca86924f
--- /dev/null
+++ b/include/o3tl/functional.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * Lifted and paraphrased from STLport - with additions from Fridrich
+ * Strba and Thorsten Behrens
+ */
+
+#ifndef INCLUDED_O3TL_FUNCTIONAL_HXX
+#define INCLUDED_O3TL_FUNCTIONAL_HXX
+
+namespace o3tl
+{
+/// Select first value of a pair
+template<typename P>
+struct select1st
+{
+ typedef P argument_type;
+ typedef typename P::first_type result_type;
+ const result_type& operator()( const argument_type& cp ) const {
+ return cp.first;
+ }
+};
+
+/// Select second value of a pair
+template<typename P>
+struct select2nd
+{
+ typedef P argument_type;
+ typedef typename P::second_type result_type;
+ const result_type& operator()( const argument_type& cp ) const {
+ return cp.second;
+ }
+};
+
+} // namespace o3tl
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/hash_combine.hxx b/include/o3tl/hash_combine.hxx
new file mode 100644
index 000000000..48e142622
--- /dev/null
+++ b/include/o3tl/hash_combine.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <cstddef>
+#include <functional>
+#include <type_traits>
+
+namespace o3tl
+{
+template <typename T, typename N>
+inline std::enable_if_t<(sizeof(N) == 4)> hash_combine(N& nSeed, T const* pValue, size_t nCount)
+{
+ static_assert(sizeof(nSeed) == 4);
+ for (size_t i = 0; i < nCount; ++i)
+ {
+ nSeed ^= std::hash<T>{}(*pValue) + 0x9E3779B9u + (nSeed << 6) + (nSeed >> 2);
+ ++pValue;
+ }
+}
+
+template <typename T, typename N>
+inline std::enable_if_t<(sizeof(N) == 4)> hash_combine(N& nSeed, T const& nValue)
+{
+ static_assert(sizeof(nSeed) == 4);
+ nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B9u + (nSeed << 6) + (nSeed >> 2);
+}
+
+template <typename T, typename N>
+inline std::enable_if_t<(sizeof(N) == 8)> hash_combine(N& nSeed, T const* pValue, size_t nCount)
+{
+ static_assert(sizeof(nSeed) == 8);
+ for (size_t i = 0; i < nCount; ++i)
+ {
+ nSeed ^= std::hash<T>{}(*pValue) + 0x9E3779B97F4A7C15llu + (nSeed << 12) + (nSeed >> 4);
+ ++pValue;
+ }
+}
+
+template <typename T, typename N>
+inline std::enable_if_t<(sizeof(N) == 8)> hash_combine(N& nSeed, T const& nValue)
+{
+ static_assert(sizeof(nSeed) == 8);
+ nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B97F4A7C15llu + (nSeed << 12) + (nSeed >> 4);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/intcmp.hxx b/include/o3tl/intcmp.hxx
new file mode 100644
index 000000000..1324afcda
--- /dev/null
+++ b/include/o3tl/intcmp.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <type_traits>
+#include <utility>
+
+#include <o3tl/safeint.hxx>
+
+namespace o3tl
+{
+// An approximation of the C++20 integer comparison functions
+// (<https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0586r2.html> "Safe integral
+// comparisons"):
+#if defined __cpp_lib_integer_comparison_functions
+
+using std::cmp_equal;
+using std::cmp_not_equal;
+using std::cmp_less;
+using std::cmp_greater;
+using std::cmp_less_equal;
+using std::cmp_greater_equal;
+
+#else
+
+template <typename T1, typename T2> constexpr bool cmp_equal(T1 value1, T2 value2) noexcept
+{
+ // coverity[same_on_both_sides: FALSE]
+ if constexpr (std::is_signed_v<T1> == std::is_signed_v<T2>)
+ {
+ return value1 == value2;
+ }
+ else if constexpr (std::is_signed_v<T1>)
+ {
+ return value1 >= 0 && o3tl::make_unsigned(value1) == value2;
+ }
+ else
+ {
+ return value2 >= 0 && value1 == o3tl::make_unsigned(value2);
+ }
+}
+
+template <typename T1, typename T2> constexpr bool cmp_not_equal(T1 value1, T2 value2) noexcept
+{
+ return !cmp_equal(value1, value2);
+}
+
+template <typename T1, typename T2> constexpr bool cmp_less(T1 value1, T2 value2) noexcept
+{
+ if constexpr (std::is_signed_v<T1> == std::is_signed_v<T2>)
+ {
+ return value1 < value2;
+ }
+ else if constexpr (std::is_signed_v<T1>)
+ {
+ return value1 < 0 || o3tl::make_unsigned(value1) < value2;
+ }
+ else
+ {
+ return value2 >= 0 && value1 < o3tl::make_unsigned(value2);
+ }
+}
+
+template <typename T1, typename T2> constexpr bool cmp_greater(T1 value1, T2 value2) noexcept
+{
+ return cmp_less(value2, value1);
+}
+
+template <typename T1, typename T2> constexpr bool cmp_less_equal(T1 value1, T2 value2) noexcept
+{
+ return !cmp_greater(value1, value2);
+}
+
+template <typename T1, typename T2> constexpr bool cmp_greater_equal(T1 value1, T2 value2) noexcept
+{
+ return !cmp_less(value1, value2);
+}
+
+#endif
+
+// A convenient operator syntax around the standard integer comparison functions:
+template <typename T> struct IntCmp
+{
+ explicit constexpr IntCmp(T theValue)
+ : value(theValue)
+ {
+ }
+
+ T value;
+};
+
+template <typename T1, typename T2> constexpr bool operator==(IntCmp<T1> value1, IntCmp<T2> value2)
+{
+ return o3tl::cmp_equal(value1.value, value2.value);
+}
+
+template <typename T1, typename T2> constexpr bool operator!=(IntCmp<T1> value1, IntCmp<T2> value2)
+{
+ return o3tl::cmp_not_equal(value1.value, value2.value);
+}
+
+template <typename T1, typename T2> constexpr bool operator<(IntCmp<T1> value1, IntCmp<T2> value2)
+{
+ return o3tl::cmp_less(value1.value, value2.value);
+}
+
+template <typename T1, typename T2> constexpr bool operator>(IntCmp<T1> value1, IntCmp<T2> value2)
+{
+ return o3tl::cmp_greater(value1.value, value2.value);
+}
+
+template <typename T1, typename T2> constexpr bool operator<=(IntCmp<T1> value1, IntCmp<T2> value2)
+{
+ return o3tl::cmp_less_equal(value1.value, value2.value);
+}
+
+template <typename T1, typename T2> constexpr bool operator>=(IntCmp<T1> value1, IntCmp<T2> value2)
+{
+ return o3tl::cmp_greater_equal(value1.value, value2.value);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/lazy_update.hxx b/include/o3tl/lazy_update.hxx
new file mode 100644
index 000000000..6f9325dfd
--- /dev/null
+++ b/include/o3tl/lazy_update.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_LAZY_UPDATE_HXX
+#define INCLUDED_O3TL_LAZY_UPDATE_HXX
+
+#include <utility>
+
+namespace o3tl
+{
+ /** Update output object lazily
+
+ This template collects data in input type, and updates the
+ output type with the given update functor, but only if the
+ output is requested. Useful if updating is expensive, or input
+ changes frequently, but output is only comparatively seldom
+ used.
+
+ @example
+ <pre>
+LazyUpdate<InType,OutType,decltype(F)> myValue(F);
+*myValue = newInput;
+myValue->updateInput( this, that, those );
+
+output( *myValue );
+ </pre>
+ or
+ <pre>
+output( myValue.getOutValue() );
+ </pre>
+ if the compiler does not recognize the const context.
+ */
+ template<typename In, typename Out, typename Func> class LazyUpdate {
+ public:
+ LazyUpdate(Func func): func_(std::move(func)), input_(), dirty_(true) {}
+
+ In const & getInValue() const { return input_; }
+
+ Out const & getOutValue() const { return update(); }
+
+ In & operator *() {
+ dirty_ = true;
+ return input_;
+ }
+
+ In * operator ->() {
+ dirty_ = true;
+ return &input_;
+ }
+
+ Out const & operator *() const { return update(); }
+
+ Out const * operator ->() const { return &update(); }
+
+ private:
+ Out const & update() const {
+ if (dirty_) {
+ output_ = func_(input_);
+ dirty_ = false;
+ }
+ return output_;
+ }
+
+ Func const func_;
+ In input_;
+ mutable Out output_;
+ mutable bool dirty_;
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/lru_map.hxx b/include/o3tl/lru_map.hxx
new file mode 100644
index 000000000..859617e5d
--- /dev/null
+++ b/include/o3tl/lru_map.hxx
@@ -0,0 +1,299 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_O3TL_LRU_MAP_HXX
+#define INCLUDED_O3TL_LRU_MAP_HXX
+
+#include <algorithm>
+#include <cassert>
+#include <list>
+#include <unordered_map>
+#include <cstddef>
+#include <type_traits>
+
+namespace o3tl
+{
+namespace detail
+{
+// Helper base class to keep total cost for lru_map with custom item size.
+// Custom size is specified by the ValueSize functor, the default of each
+// item counting as 1 is specified using the void type.
+template <class ValueSize> class lru_map_base
+{
+public:
+ // Returns total of ValueSize for all items.
+ size_t total_size() const { return mCurrentSize; }
+
+protected:
+ size_t mCurrentSize = 0; // sum of ValueSize for all items
+};
+
+// By default cost of each item is 1, so it doesn't need to be tracked.
+template <> class lru_map_base<void>
+{
+};
+} // namespace
+
+/** LRU map
+ *
+ * Similar to unordered_map (it actually uses it) with additionally functionality
+ * which removes the entries that have been "least recently used" when the size
+ * hits the specified capacity.
+ *
+ * It only implements the minimal methods needed and the implementation is NOT
+ * thread safe.
+ *
+ * The implementation is as simple as possible but it still uses O(1) complexity
+ * for most of the operations with a combination unordered map and linked list.
+ *
+ * It is optionally possible to specify a function for ValueSize template
+ * argument (that can be called as 'size_t func(Value)') that will return
+ * a size (cost) for an item instead of the default size of 1 for each item.
+ * The size of an item must not change for an item (if needed, re-insert
+ * the item). A newly inserted item is guaranteed to be in the container,
+ * even if its size exceeds the maximum size.
+ *
+ **/
+template <typename Key, typename Value, class KeyHash = std::hash<Key>,
+ class KeyEqual = std::equal_to<Key>, class ValueSize = void>
+class lru_map final : public detail::lru_map_base<ValueSize>
+{
+public:
+ typedef typename std::pair<Key, Value> key_value_pair_t;
+
+private:
+ typedef std::list<key_value_pair_t> list_t;
+ typedef typename list_t::iterator list_iterator_t;
+ typedef typename list_t::const_iterator list_const_iterator_t;
+
+ typedef std::unordered_map<Key, list_iterator_t, KeyHash, KeyEqual> map_t;
+ typedef typename map_t::iterator map_iterator_t;
+ typedef typename map_t::const_iterator map_const_iterator_t;
+
+ list_t mLruList;
+ map_t mLruMap;
+ size_t mMaxSize;
+
+ void addSize(const Value& value)
+ {
+ // by default total size is equal to number of items
+ if constexpr (!std::is_void_v<ValueSize>)
+ this->mCurrentSize += ValueSize()(value);
+ }
+
+ void removeSize(const Value& value)
+ {
+ // by default total size is equal to number of items
+ if constexpr (!std::is_void_v<ValueSize>)
+ {
+ size_t itemSize = ValueSize()(value);
+ assert(itemSize <= this->mCurrentSize);
+ this->mCurrentSize -= itemSize;
+ }
+ }
+
+ void removeOldestItem()
+ {
+ removeSize(mLruList.back().second);
+ // remove from map
+ mLruMap.erase(mLruList.back().first);
+ // remove from list
+ mLruList.pop_back();
+ }
+
+ void checkLRUItemInsert()
+ {
+ if constexpr (std::is_void_v<ValueSize>)
+ { // One added, so it's enough to remove one, if needed.
+ if (mLruMap.size() > mMaxSize)
+ removeOldestItem();
+ }
+ else
+ {
+ // This must leave at least one item (it's called from insert).
+ while (this->mCurrentSize > mMaxSize && mLruList.size() > 1)
+ removeOldestItem();
+ }
+ }
+
+ void checkLRUItemUpdate()
+ {
+ // Item update does not change total size by default.
+ if constexpr (!std::is_void_v<ValueSize>)
+ {
+ // This must leave at least one item (it's called from insert).
+ while (this->mCurrentSize > mMaxSize && mLruList.size() > 1)
+ removeOldestItem();
+ }
+ }
+
+ void checkLRUMaxSize()
+ {
+ if constexpr (std::is_void_v<ValueSize>)
+ {
+ while (mLruMap.size() > mMaxSize)
+ removeOldestItem();
+ }
+ else
+ {
+ while (this->mCurrentSize > mMaxSize)
+ removeOldestItem();
+ }
+ }
+
+ void clearSize()
+ {
+ if constexpr (!std::is_void_v<ValueSize>)
+ {
+#ifdef DBG_UTIL
+ for (const key_value_pair_t& item : mLruList)
+ removeSize(item.second);
+ assert(this->mCurrentSize == 0);
+#else
+ this->mCurrentSize = 0;
+#endif
+ }
+ }
+
+public:
+ typedef list_iterator_t iterator;
+ typedef list_const_iterator_t const_iterator;
+
+ lru_map(size_t nMaxSize)
+ : mMaxSize(nMaxSize)
+ {
+ assert(mMaxSize > 0);
+ }
+ ~lru_map()
+ {
+ clearSize();
+ // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we
+ // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems.
+ mLruMap.clear();
+ list_t().swap(mLruList);
+ }
+
+ void setMaxSize(size_t nMaxSize)
+ {
+ mMaxSize = nMaxSize;
+ assert(mMaxSize > 0);
+ checkLRUMaxSize();
+ }
+
+ void insert(key_value_pair_t& rPair)
+ {
+ map_iterator_t i = mLruMap.find(rPair.first);
+
+ if (i == mLruMap.end()) // doesn't exist -> add to queue and map
+ {
+ addSize(rPair.second);
+ // add to front of the list
+ mLruList.push_front(rPair);
+ // add the list position (iterator) to the map
+ auto it = mLruList.begin();
+ mLruMap[it->first] = it;
+ checkLRUItemInsert();
+ }
+ else // already exists -> replace value
+ {
+ // update total cost
+ removeSize(i->second->second);
+ addSize(rPair.second);
+ // replace value
+ i->second->second = rPair.second;
+ // bring to front of the lru list
+ mLruList.splice(mLruList.begin(), mLruList, i->second);
+ checkLRUItemUpdate();
+ }
+ }
+
+ void insert(key_value_pair_t&& rPair)
+ {
+ map_iterator_t i = mLruMap.find(rPair.first);
+
+ if (i == mLruMap.end()) // doesn't exist -> add to list and map
+ {
+ addSize(rPair.second);
+ // add to front of the list
+ mLruList.push_front(std::move(rPair));
+ // add the list position (iterator) to the map
+ auto it = mLruList.begin();
+ mLruMap[it->first] = it;
+ checkLRUItemInsert();
+ }
+ else // already exists -> replace value
+ {
+ removeSize(i->second->second);
+ addSize(rPair.second);
+ // replace value
+ i->second->second = std::move(rPair.second);
+ // push to back of the lru list
+ mLruList.splice(mLruList.begin(), mLruList, i->second);
+ checkLRUItemUpdate();
+ }
+ }
+
+ list_const_iterator_t find(const Key& key)
+ {
+ const map_iterator_t i = mLruMap.find(key);
+ if (i == mLruMap.cend()) // can't find entry for the key
+ {
+ // return empty iterator
+ return mLruList.cend();
+ }
+ else
+ {
+ // push to back of the lru list
+ mLruList.splice(mLruList.begin(), mLruList, i->second);
+ return i->second;
+ }
+ }
+
+ // reverse-iterates the list removing all items matching the predicate
+ template <class UnaryPredicate> void remove_if(UnaryPredicate pred)
+ {
+ auto it = mLruList.rbegin();
+ while (it != mLruList.rend())
+ {
+ if (pred(*it))
+ {
+ removeSize(it->second);
+ mLruMap.erase(it->first);
+ it = decltype(it){ mLruList.erase(std::next(it).base()) };
+ }
+ else
+ ++it;
+ }
+ }
+
+ list_const_iterator_t begin() const { return mLruList.cbegin(); }
+
+ list_const_iterator_t end() const { return mLruList.cend(); }
+
+ size_t size() const
+ {
+ assert(mLruMap.size() == mLruList.size());
+ return mLruMap.size();
+ }
+
+ // size_t total_size() const; - only if custom ValueSize
+
+ void clear()
+ {
+ clearSize();
+ mLruMap.clear();
+ mLruList.clear();
+ }
+};
+}
+
+#endif /* INCLUDED_O3TL_LRU_MAP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/make_shared.hxx b/include/o3tl/make_shared.hxx
new file mode 100644
index 000000000..5d4d98e42
--- /dev/null
+++ b/include/o3tl/make_shared.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_MAKE_SHARED_HXX
+#define INCLUDED_O3TL_MAKE_SHARED_HXX
+
+#include <o3tl/deleter.hxx>
+#include <memory>
+#include <type_traits>
+
+namespace o3tl
+{
+/** Allocate an array stored in a shared_ptr, calling operator delete[].
+ Note that this is only allowed for arithmetic types because shared_ptr
+ implicitly converts to sub-types.
+ */
+template <typename T> std::shared_ptr<T> make_shared_array(size_t const size)
+{
+ static_assert(std::is_arithmetic<T>::value, "only arrays of arithmetic types allowed");
+ return std::shared_ptr<T>(new T[size], std::default_delete<T[]>());
+}
+
+/** To markup std::shared_ptr that coverity warns might throw exceptions
+ which won't throw in practice, or where std::terminate is
+ an acceptable response if they do
+*/
+template <class T, class... Args> std::shared_ptr<T> make_shared(Args&&... args)
+{
+#if defined(__COVERITY__)
+ return std::shared_ptr<T>(new T(std::forward<Args>(args)...), o3tl::default_delete<T>());
+#else
+ return std::make_shared<T>(std::forward<Args>(args)...);
+#endif
+}
+
+} // namespace o3tl
+
+#endif // INCLUDED_O3TL_MAKE_SHARED_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/numeric.hxx b/include/o3tl/numeric.hxx
new file mode 100644
index 000000000..9980319a6
--- /dev/null
+++ b/include/o3tl/numeric.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_NUMERIC_HXX
+#define INCLUDED_O3TL_NUMERIC_HXX
+
+#include <stdexcept>
+
+namespace o3tl
+{
+ struct divide_by_zero final : public std::runtime_error
+ {
+ explicit divide_by_zero()
+ : std::runtime_error("divide by zero")
+ {
+ }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/runtimetooustring.hxx b/include/o3tl/runtimetooustring.hxx
new file mode 100644
index 000000000..6d6f27ac1
--- /dev/null
+++ b/include/o3tl/runtimetooustring.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_RUNTIMETOOUSTRING_HXX
+#define INCLUDED_O3TL_RUNTIMETOOUSTRING_HXX
+
+#include <sal/config.h>
+
+#include <cassert>
+#include <cstring>
+
+#include <rtl/textcvt.h>
+#include <rtl/textenc.h>
+#include <rtl/ustring.h>
+#include <rtl/ustring.hxx>
+
+namespace o3tl
+{
+/** Convert an NTBS from the C++ runtime to an OUString.
+
+ This is used to convert an NTBS as provided by std::exception::what or
+ std::type_info::name into an OUString in a "lossless" way. The conversion
+ is done using RTL_TEXTENCODING_ISO_8859_1, so each char in the input maps
+ to one Unicode character in the output.
+*/
+inline OUString runtimeToOUString(char const* runtimeString)
+{
+ OUString s;
+ bool ok = rtl_convertStringToUString(
+ &s.pData, runtimeString, std::strlen(runtimeString), RTL_TEXTENCODING_ISO_8859_1,
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
+ | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR));
+ assert(ok);
+ (void)ok;
+ return s;
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/safeCoInitUninit.hxx b/include/o3tl/safeCoInitUninit.hxx
new file mode 100644
index 000000000..0ceb4a974
--- /dev/null
+++ b/include/o3tl/safeCoInitUninit.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#if defined _WIN32
+#include <prewin.h>
+
+// for CoInitializeEx / CoUninitialize
+#include <combaseapi.h>
+
+#include <postwin.h>
+
+// for std::abort
+#include <cstdlib>
+
+namespace o3tl
+{
+// Helpers for safe calls to CoInitializeEx and CoUninitialize in MSVC
+// Indeed if a thread has been already initialized with a concurrency model
+// (in LO case COINIT_APARTMENTTHREADED or COINIT_MULTITHREADED)
+// CoInitializeEx can't succeed without calling first CoUninitialize
+// also, CoUninitialize must be called the number of times CoInitializeEx has been called
+inline HRESULT safeCoInitializeEx(DWORD dwCoInit, int& nbReinit)
+{
+ HRESULT hr;
+ while ((hr = CoInitializeEx(nullptr, dwCoInit)) == RPC_E_CHANGED_MODE)
+ {
+ // so we're in RPC_E_CHANGED_MODE case
+ // the pb was it was already initialized with a different concurrency model
+ // close this init
+ CoUninitialize();
+ // and increment counter for dtr part
+ ++nbReinit;
+
+ // and keep on the loop if there were multi initializations
+ }
+ if (FAILED(hr))
+ std::abort();
+ return hr;
+}
+
+inline void safeCoUninitializeReinit(DWORD dwCoInit, int nbReinit)
+{
+ CoUninitialize();
+ // Put back all the inits, if there were, before the use of the caller to safeCoInitializeEx
+ for (int i = 0; i < nbReinit; ++i)
+ CoInitializeEx(nullptr, dwCoInit);
+}
+}
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/safeint.hxx b/include/o3tl/safeint.hxx
new file mode 100644
index 000000000..c697a9316
--- /dev/null
+++ b/include/o3tl/safeint.hxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <algorithm>
+#include <cassert>
+#include <limits>
+#include <type_traits>
+
+#if defined(_MSC_VER)
+#include <safeint.h>
+#else
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
+#endif
+
+namespace o3tl
+{
+
+template <typename T> inline T saturating_add(T a, T b)
+{
+ if (b >= 0) {
+ if (a <= std::numeric_limits<T>::max() - b) {
+ return a + b;
+ } else {
+ return std::numeric_limits<T>::max();
+ }
+ } else {
+ if (a >= std::numeric_limits<T>::min() - b) {
+ return a + b;
+ } else {
+ return std::numeric_limits<T>::min();
+ }
+ }
+}
+
+template <typename T> inline T saturating_sub(T a, T b)
+{
+ if (b >= 0) {
+ if (a >= std::numeric_limits<T>::min() + b) {
+ return a - b;
+ } else {
+ return std::numeric_limits<T>::min();
+ }
+ } else {
+ if (a <= std::numeric_limits<T>::max() + b) {
+ return a - b;
+ } else {
+ return std::numeric_limits<T>::max();
+ }
+ }
+}
+
+template<typename T> inline
+typename std::enable_if<std::is_signed<T>::value, T>::type saturating_toggle_sign(
+ T a)
+{
+ if (a == std::numeric_limits<T>::min())
+ return std::numeric_limits<T>::max();
+ return a * -1;
+}
+
+#if defined(_MSC_VER)
+
+template<typename T> inline bool checked_multiply(T a, T b, T& result)
+{
+ return !msl::utilities::SafeMultiply(a, b, result);
+}
+
+template<typename T> inline bool checked_add(T a, T b, T& result)
+{
+ return !msl::utilities::SafeAdd(a, b, result);
+}
+
+template<typename T> inline bool checked_sub(T a, T b, T& result)
+{
+ return !msl::utilities::SafeSubtract(a, b, result);
+}
+
+#elif (defined __GNUC__ && !defined __clang__) || (__has_builtin(__builtin_mul_overflow) && !(defined ANDROID && defined __clang__) && !(defined(__clang__) && (defined(__arm__) || defined(__i386__))))
+// 32-bit clang fails with undefined reference to `__mulodi4'
+
+template<typename T> inline bool checked_multiply(T a, T b, T& result)
+{
+ return __builtin_mul_overflow(a, b, &result);
+}
+
+template<typename T> inline bool checked_add(T a, T b, T& result)
+{
+ return __builtin_add_overflow(a, b, &result);
+}
+
+template<typename T> inline bool checked_sub(T a, T b, T& result)
+{
+ return __builtin_sub_overflow(a, b, &result);
+}
+
+#else
+
+//https://www.securecoding.cert.org/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
+template<typename T> inline typename std::enable_if<std::is_signed<T>::value, bool>::type checked_multiply(T a, T b, T& result)
+{
+ if (a > 0) { /* a is positive */
+ if (b > 0) { /* a and b are positive */
+ if (a > (std::numeric_limits<T>::max() / b)) {
+ return true; /* Handle error */
+ }
+ } else { /* a positive, b nonpositive */
+ if (b < (std::numeric_limits<T>::min() / a)) {
+ return true; /* Handle error */
+ }
+ } /* a positive, b nonpositive */
+ } else { /* a is nonpositive */
+ if (b > 0) { /* a is nonpositive, b is positive */
+ if (a < (std::numeric_limits<T>::min() / b)) {
+ return true; /* Handle error */
+ }
+ } else { /* a and b are nonpositive */
+ if ( (a != 0) && (b < (std::numeric_limits<T>::max() / a))) {
+ return true; /* Handle error */
+ }
+ } /* End if a and b are nonpositive */
+ } /* End if a is nonpositive */
+
+ result = a * b;
+
+ return false;
+}
+
+//https://www.securecoding.cert.org/confluence/display/c/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap
+template<typename T> inline typename std::enable_if<std::is_unsigned<T>::value, bool>::type checked_multiply(T a, T b, T& result)
+{
+ if (b && a > std::numeric_limits<T>::max() / b) {
+ return true;/* Handle error */
+ }
+
+ result = a * b;
+
+ return false;
+}
+
+//https://www.securecoding.cert.org/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
+template<typename T> inline typename std::enable_if<std::is_signed<T>::value, bool>::type checked_add(T a, T b, T& result)
+{
+ if (((b > 0) && (a > (std::numeric_limits<T>::max() - b))) ||
+ ((b < 0) && (a < (std::numeric_limits<T>::min() - b)))) {
+ return true;
+ }
+
+ result = a + b;
+
+ return false;
+}
+
+//https://www.securecoding.cert.org/confluence/display/c/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap
+template<typename T> inline typename std::enable_if<std::is_unsigned<T>::value, bool>::type checked_add(T a, T b, T& result)
+{
+ if (std::numeric_limits<T>::max() - a < b) {
+ return true;/* Handle error */
+ }
+
+ result = a + b;
+
+ return false;
+}
+
+//https://www.securecoding.cert.org/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
+template<typename T> inline typename std::enable_if<std::is_signed<T>::value, bool>::type checked_sub(T a, T b, T& result)
+{
+ if ((b > 0 && a < std::numeric_limits<T>::min() + b) ||
+ (b < 0 && a > std::numeric_limits<T>::max() + b)) {
+ return true;
+ }
+
+ result = a - b;
+
+ return false;
+}
+
+//https://www.securecoding.cert.org/confluence/display/c/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap
+template<typename T> inline typename std::enable_if<std::is_unsigned<T>::value, bool>::type checked_sub(T a, T b, T& result)
+{
+ if (a < b) {
+ return true;
+ }
+
+ result = a - b;
+
+ return false;
+}
+
+#endif
+
+template<typename T> constexpr std::enable_if_t<std::is_signed_v<T>, std::make_unsigned_t<T>>
+make_unsigned(T value)
+{
+ assert(value >= 0);
+ return value;
+}
+
+template<typename T1, typename T2> constexpr std::enable_if_t<std::is_unsigned_v<T1>, T1>
+clamp_to_unsigned(T2 value) {
+ if constexpr (std::is_unsigned_v<T2>) {
+ // coverity[result_independent_of_operands] - suppress warning for template
+ return value <= std::numeric_limits<T1>::max() ? value : std::numeric_limits<T1>::max();
+ } else {
+ static_assert(std::is_signed_v<T2>);
+ return value < 0 ? 0 : clamp_to_unsigned<T1>(make_unsigned(value));
+ }
+}
+
+// An implicit conversion from T2 to T1, useful in places where an explicit conversion from T2 to
+// T1 is needed (e.g., in list initialization, if the implicit conversion would be narrowing) but
+// tools like -fsanitize=implicit-conversion should still be able to detect truncation:
+template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
+
+// std::min wrapped to inform coverity that the result is now deemed sanitized
+// coverity[ -taint_source ]
+template<typename T> [[nodiscard]] inline T sanitizing_min(T a, T b)
+{
+ return std::min(a, b);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/sorted_vector.hxx b/include/o3tl/sorted_vector.hxx
new file mode 100644
index 000000000..13c0b25f8
--- /dev/null
+++ b/include/o3tl/sorted_vector.hxx
@@ -0,0 +1,421 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_SORTED_VECTOR_HXX
+#define INCLUDED_O3TL_SORTED_VECTOR_HXX
+
+#include <vector>
+#include <algorithm>
+#include <cassert>
+#include <functional>
+#include <iterator>
+#include <memory>
+#include <type_traits>
+
+namespace o3tl
+{
+
+// forward declared because it's default template arg for sorted_vector
+template<class Value, class Compare>
+struct find_unique;
+
+/** Represents a sorted vector of values.
+
+ @tpl Value class of item to be stored in container
+ @tpl Compare comparison method
+ @tpl Find look up index of a Value in the array
+*/
+template<
+ typename Value,
+ typename Compare = std::less<Value>,
+ template<typename, typename> class Find = find_unique,
+ bool = std::is_copy_constructible<Value>::value >
+class sorted_vector
+{
+private:
+ typedef Find<Value, Compare> Find_t;
+ typedef typename std::vector<Value> vector_t;
+ typedef typename std::vector<Value>::iterator iterator;
+public:
+ typedef typename std::vector<Value>::const_iterator const_iterator;
+ typedef typename std::vector<Value>::const_reverse_iterator const_reverse_iterator;
+ typedef typename std::vector<Value>::difference_type difference_type;
+ typedef typename std::vector<Value>::size_type size_type;
+ typedef Value value_type;
+
+ constexpr sorted_vector( std::initializer_list<Value> init )
+ : m_vector(init)
+ {
+ std::sort(m_vector.begin(), m_vector.end(), Compare());
+ }
+ sorted_vector() = default;
+ sorted_vector(sorted_vector const&) = default;
+ sorted_vector(sorted_vector&&) = default;
+
+ sorted_vector& operator=(sorted_vector const&) = default;
+ sorted_vector& operator=(sorted_vector&&) = default;
+
+ // MODIFIERS
+
+ std::pair<const_iterator,bool> insert( Value&& x )
+ {
+ std::pair<const_iterator, bool> const ret(Find_t()(m_vector.begin(), m_vector.end(), x));
+ if (!ret.second)
+ {
+ const_iterator const it = m_vector.insert(m_vector.begin() + (ret.first - m_vector.begin()), std::move(x));
+ return std::make_pair(it, true);
+ }
+ return std::make_pair(ret.first, false);
+ }
+
+ std::pair<const_iterator,bool> insert( const Value& x )
+ {
+ std::pair<const_iterator, bool> const ret(Find_t()(m_vector.begin(), m_vector.end(), x));
+ if (!ret.second)
+ {
+ const_iterator const it = m_vector.insert(m_vector.begin() + (ret.first - m_vector.begin()), x);
+ return std::make_pair(it, true);
+ }
+ return std::make_pair(ret.first, false);
+ }
+
+ size_type erase( const Value& x )
+ {
+ std::pair<const_iterator, bool> const ret(Find_t()(m_vector.begin(), m_vector.end(), x));
+ if (ret.second)
+ {
+ m_vector.erase(m_vector.begin() + (ret.first - m_vector.begin()));
+ return 1;
+ }
+ return 0;
+ }
+
+ void erase_at(size_t index)
+ {
+ m_vector.erase(m_vector.begin() + index);
+ }
+
+ // like C++ 2011: erase with const_iterator (doesn't change sort order)
+ const_iterator erase(const_iterator const& position)
+ { // C++98 has vector::erase(iterator), so call that
+ return m_vector.erase(m_vector.begin() + (position - m_vector.begin()));
+ }
+
+ void erase(const_iterator const& first, const_iterator const& last)
+ {
+ m_vector.erase(m_vector.begin() + (first - m_vector.begin()),
+ m_vector.begin() + (last - m_vector.begin()));
+ }
+
+ /**
+ * make erase return the removed element, otherwise there is no useful way of extracting a std::unique_ptr
+ * from this.
+ */
+ Value erase_extract( size_t index )
+ {
+ Value val = std::move(m_vector[index]);
+ m_vector.erase(m_vector.begin() + index);
+ return val;
+ }
+
+ void clear()
+ {
+ m_vector.clear();
+ }
+
+ void swap(sorted_vector & other)
+ {
+ m_vector.swap(other.m_vector);
+ }
+
+ void reserve(size_type amount)
+ {
+ m_vector.reserve(amount);
+ }
+
+ // ACCESSORS
+
+ size_type size() const
+ {
+ return m_vector.size();
+ }
+
+ bool empty() const
+ {
+ return m_vector.empty();
+ }
+
+ // Only return a const iterator, so that the vector cannot be directly updated.
+ const_iterator begin() const
+ {
+ return m_vector.begin();
+ }
+
+ // Only return a const iterator, so that the vector cannot be directly updated.
+ const_iterator end() const
+ {
+ return m_vector.end();
+ }
+
+ // Only return a const iterator, so that the vector cannot be directly updated.
+ const_reverse_iterator rbegin() const
+ {
+ return m_vector.rbegin();
+ }
+
+ // Only return a const iterator, so that the vector cannot be directly updated.
+ const_reverse_iterator rend() const
+ {
+ return m_vector.rend();
+ }
+
+ const Value& front() const
+ {
+ return m_vector.front();
+ }
+
+ const Value& back() const
+ {
+ return m_vector.back();
+ }
+
+ const Value& operator[]( size_t index ) const
+ {
+ return m_vector.operator[]( index );
+ }
+
+ // OPERATIONS
+
+ const_iterator lower_bound( const Value& x ) const
+ {
+ return std::lower_bound( m_vector.begin(), m_vector.end(), x, Compare() );
+ }
+
+ const_iterator upper_bound( const Value& x ) const
+ {
+ return std::upper_bound( m_vector.begin(), m_vector.end(), x, Compare() );
+ }
+
+ /* Searches the container for an element with a value of x
+ * and returns an iterator to it if found, otherwise it returns an
+ * iterator to sorted_vector::end (the element past the end of the container).
+ *
+ * Only return a const iterator, so that the vector cannot be directly updated.
+ */
+ const_iterator find( const Value& x ) const
+ {
+ std::pair<const_iterator, bool> const ret(Find_t()(m_vector.begin(), m_vector.end(), x));
+ return (ret.second) ? ret.first : m_vector.end();
+ }
+
+ size_type count(const Value& v) const
+ {
+ return find(v) != end() ? 1 : 0;
+ }
+
+ bool operator==(const sorted_vector & other) const
+ {
+ return m_vector == other.m_vector;
+ }
+
+ bool operator!=(const sorted_vector & other) const
+ {
+ return m_vector != other.m_vector;
+ }
+
+ void insert(sorted_vector<Value,Compare,Find> const& rOther)
+ {
+ // optimization for the rather common case that we are overwriting this with the contents
+ // of another sorted vector
+ if ( empty() )
+ m_vector.insert(m_vector.begin(), rOther.m_vector.begin(), rOther.m_vector.end());
+ else
+ insert_internal( rOther.m_vector );
+ }
+
+ void insert_sorted_unique_vector(const std::vector<Value>& rOther)
+ {
+ assert( std::is_sorted(rOther.begin(), rOther.end(), Compare()));
+ assert( std::unique(rOther.begin(), rOther.end(), compare_equal) == rOther.end());
+ if ( empty() )
+ m_vector.insert(m_vector.begin(), rOther.m_vector.begin(), rOther.m_vector.end());
+ else
+ insert_internal( rOther );
+ }
+
+ void insert_sorted_unique_vector(std::vector<Value>&& rOther)
+ {
+ assert( std::is_sorted(rOther.begin(), rOther.end(), Compare()));
+ assert( std::unique(rOther.begin(), rOther.end(), compare_equal) == rOther.end());
+ if ( empty() )
+ m_vector.swap( rOther );
+ else
+ insert_internal( rOther );
+ }
+
+ /* Clear() elements in the vector, and free them one by one. */
+ void DeleteAndDestroyAll()
+ {
+ for (const_iterator it = m_vector.begin(); it != m_vector.end(); ++it)
+ {
+ delete *it;
+ }
+
+ clear();
+ }
+
+ // fdo#58793: some existing code in Writer (SwpHintsArray)
+ // routinely modifies the members of the vector in a way that
+ // violates the sort order, and then re-sorts the array.
+ // This is a kludge to enable that code to work.
+ // If you are calling this function, you are Doing It Wrong!
+ void Resort()
+ {
+ std::stable_sort(m_vector.begin(), m_vector.end(), Compare());
+ }
+
+private:
+ static bool compare_equal( const Value& v1, const Value& v2 )
+ { // Synthetize == check from < check for std::unique asserts above.
+ return !Compare()( v1, v2 ) && !Compare()( v2, v1 );
+ }
+
+ void insert_internal( const std::vector<Value>& rOther )
+ {
+ // Do a union in one pass rather than repeated insert() that could repeatedly
+ // move large amounts of data.
+ vector_t tmp;
+ tmp.reserve( m_vector.size() + rOther.size());
+ std::set_union( m_vector.begin(), m_vector.end(),
+ rOther.begin(), rOther.end(),
+ std::back_inserter( tmp ), Compare());
+ m_vector.swap( tmp );
+ }
+
+ vector_t m_vector;
+};
+
+/* Specialise the template for cases like Value = std::unique_ptr<T>, where
+ MSVC2017 needs some help
+*/
+template<
+ typename Value,
+ typename Compare,
+ template<typename, typename> class Find >
+class sorted_vector<Value,Compare,Find,false> : public sorted_vector<Value, Compare, Find, true>
+{
+public:
+ using sorted_vector<Value, Compare, Find, true>::sorted_vector;
+ typedef sorted_vector<Value, Compare, Find, true> super_sorted_vector;
+
+ sorted_vector(sorted_vector const&) = delete;
+ sorted_vector& operator=(sorted_vector const&) = delete;
+
+ sorted_vector() = default;
+ sorted_vector(sorted_vector&&) = default;
+ sorted_vector& operator=(sorted_vector&&) = default;
+
+ /**
+ * implement find for sorted_vectors containing std::unique_ptr
+ */
+ typename super_sorted_vector::const_iterator find( typename Value::element_type const * x ) const
+ {
+ Value tmp(const_cast<typename Value::element_type*>(x));
+ auto ret = super_sorted_vector::find(tmp);
+ tmp.release();
+ return ret;
+ }
+ /**
+ * implement upper_bound for sorted_vectors containing std::unique_ptr
+ */
+ typename super_sorted_vector::const_iterator upper_bound( typename Value::element_type const * x ) const
+ {
+ Value tmp(const_cast<typename Value::element_type*>(x));
+ auto ret = super_sorted_vector::upper_bound(tmp);
+ tmp.release();
+ return ret;
+ }
+ /**
+ * implement lower_bound for sorted_vectors containing std::unique_ptr
+ */
+ typename super_sorted_vector::const_iterator lower_bound( typename Value::element_type const * x ) const
+ {
+ Value tmp(const_cast<typename Value::element_type*>(x));
+ auto ret = super_sorted_vector::lower_bound(tmp);
+ tmp.release();
+ return ret;
+ }
+};
+
+
+/** Implements an ordering function over a pointer, where the comparison uses the < operator on the pointed-to types.
+ Very useful for the cases where we put pointers to objects inside a sorted_vector.
+*/
+template <class T> struct less_ptr_to
+{
+ bool operator() ( T* const& lhs, T* const& rhs ) const
+ {
+ return (*lhs) < (*rhs);
+ }
+};
+
+template <class T> struct less_uniqueptr_to
+{
+ bool operator() ( std::unique_ptr<T> const& lhs, std::unique_ptr<T> const& rhs ) const
+ {
+ return (*lhs) < (*rhs);
+ }
+};
+
+/** the elements are totally ordered by Compare,
+ for no 2 elements !Compare(a,b) && !Compare(b,a) is true
+ */
+template<class Value, class Compare>
+struct find_unique
+{
+ typedef typename sorted_vector<Value, Compare,
+ o3tl::find_unique> ::const_iterator const_iterator;
+ std::pair<const_iterator, bool> operator()(
+ const_iterator first, const_iterator last,
+ Value const& v)
+ {
+ const_iterator const it = std::lower_bound(first, last, v, Compare());
+ return std::make_pair(it, (it != last && !Compare()(v, *it)));
+ }
+};
+
+/** the elements are partially ordered by Compare,
+ 2 elements are allowed if they are not the same element (pointer equal)
+ */
+template<class Value, class Compare>
+struct find_partialorder_ptrequals
+{
+ typedef typename sorted_vector<Value, Compare,
+ o3tl::find_partialorder_ptrequals>::const_iterator const_iterator;
+ std::pair<const_iterator, bool> operator()(
+ const_iterator first, const_iterator last,
+ Value const& v)
+ {
+ std::pair<const_iterator, const_iterator> const its =
+ std::equal_range(first, last, v, Compare());
+ for (const_iterator it = its.first; it != its.second; ++it)
+ {
+ if (v == *it)
+ {
+ return std::make_pair(it, true);
+ }
+ }
+ return std::make_pair(its.first, false);
+ }
+};
+
+} // namespace o3tl
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/span.hxx b/include/o3tl/span.hxx
new file mode 100644
index 000000000..cfe4c1ffa
--- /dev/null
+++ b/include/o3tl/span.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_SPAN_HXX
+#define INCLUDED_O3TL_SPAN_HXX
+
+#include <sal/config.h>
+
+#include <config_global.h>
+
+#if HAVE_CPP_SPAN
+
+#include <span>
+
+namespace o3tl { using std::span; }
+
+#else
+
+#include <cassert>
+#include <cstddef>
+#include <iterator>
+#include <type_traits>
+#include <vector>
+
+namespace o3tl {
+
+/** A barebones approximation of C++20 <span>.
+*/
+template<typename T>
+class span {
+public:
+ using value_type = T;
+ using pointer = value_type *;
+ using const_pointer = value_type const *;
+ using reference = value_type &;
+ using const_reference = value_type const &;
+ using const_iterator = const_pointer;
+ using iterator = pointer;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+ using reverse_iterator = std::reverse_iterator<iterator>;
+ using size_type = std::size_t;
+ using difference_type = std::ptrdiff_t;
+
+ constexpr span() noexcept : data_(nullptr), size_(0) {}
+
+ template<std::size_t N>
+ constexpr span (T (&a)[N]) noexcept : data_(a), size_(N) {}
+
+ constexpr span (T *a, size_type len) noexcept
+ : data_(a), size_(len)
+ {
+ // not terribly sure about this, might need to strengthen it
+ assert(a != nullptr || len == 0);
+ }
+
+ template<typename T2>
+ constexpr span(const std::vector<T2>& vec)
+ : data_(vec.data()), size_(vec.size()) {}
+
+ /** for assigning from span<T> to span<const T> */
+ constexpr span (const span<typename std::remove_const<T>::type>& other) noexcept
+ : data_(other.data()), size_(other.size()) {}
+
+ constexpr bool empty() const noexcept { return size_ == 0; }
+
+ constexpr iterator begin() const noexcept { return data_; }
+ constexpr iterator end() const noexcept { return begin() + size(); }
+
+ reverse_iterator rbegin() const noexcept
+ { return reverse_iterator(end()); }
+ reverse_iterator rend() const noexcept
+ { return reverse_iterator(begin()); }
+
+ constexpr size_type size() const noexcept { return size_; }
+
+ constexpr reference operator [](size_type pos) const {
+ assert(pos < size());
+ return data_[pos];
+ }
+
+ constexpr pointer data() const noexcept { return data_; }
+
+private:
+ pointer data_;
+ size_type size_;
+};
+
+} // namespace o3tl
+
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/sprintf.hxx b/include/o3tl/sprintf.hxx
new file mode 100644
index 000000000..6491f4ad1
--- /dev/null
+++ b/include/o3tl/sprintf.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <cassert>
+#include <cstddef>
+#include <cstdio>
+#include <utility>
+
+#include <o3tl/safeint.hxx>
+
+namespace o3tl
+{
+// A drop-in replacement for safe uses of std::sprintf where it is statically known that the
+// provided buffer is large enough. Compared to a plain use of std::sprintf, using o3tl::sprintf
+// for one makes it explicit that the call is considerd safe and for another avoids deprecation
+// warnings on platforms like the macOS 13 SDK that mark std::sprintf as deprecated. Many simple
+// uses of std::sprintf across the code base can be replaced with alternative code using e.g.
+// OString::number. This is for the remaining formatting-rich cases for which there is no easy
+// replacement yet in our C++17 baseline. Ultimately, it should be removed again once alternatives
+// for those remaining cases, like C++20 std::format, are available.
+template <std::size_t N, typename... T>
+int sprintf(char (&s)[N], char const* format, T&&... arguments)
+{
+ auto const n = std::snprintf(s, N, format, std::forward<T>(arguments)...);
+ assert(n < 0 || o3tl::make_unsigned(n) < N);
+ (void)n;
+ return n;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/string_view.hxx b/include/o3tl/string_view.hxx
new file mode 100644
index 000000000..f6c2a4aa7
--- /dev/null
+++ b/include/o3tl/string_view.hxx
@@ -0,0 +1,487 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <cassert>
+#include <cstddef>
+#include <string>
+#include <string_view>
+
+#include <o3tl/intcmp.hxx>
+#include <rtl/ustring.h>
+#include <rtl/math.h>
+
+namespace o3tl
+{
+// Like OUString::equalsIgnoreAsciiCase, but for two std::u16string_view:
+inline bool equalsAscii(std::u16string_view s1, const char* s2)
+{
+ return rtl_ustr_ascii_compare_WithLength(s1.data(), s1.size(), s2) == 0;
+}
+
+// Like OUString::equalsAsciiL
+inline bool equalsAscii(std::u16string_view s1, std::string_view s2)
+{
+ return rtl_ustr_ascii_shortenedCompare_WithLength(s1.data(), s1.size(), s2.data(), s2.size())
+ == 0;
+}
+
+// Like OUString::equalsIgnoreAsciiCase, but for two std::u16string_view:
+inline bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
+{
+ if (s1.size() != s2.size())
+ return false;
+ if (s1.data() == s2.data())
+ return true;
+ return rtl_ustr_compareIgnoreAsciiCase_WithLength(s1.data(), s1.size(), s2.data(), s2.size())
+ == 0;
+};
+
+inline bool equalsIgnoreAsciiCase(std::string_view s1, std::string_view s2)
+{
+ if (s1.size() != s2.size())
+ return false;
+ if (s1.data() == s2.data())
+ return true;
+ return rtl_str_compareIgnoreAsciiCase_WithLength(s1.data(), s1.size(), s2.data(), s2.size())
+ == 0;
+};
+
+// Like OUString::compareToIgnoreAsciiCase, but for two std::u16string_view:
+inline int compareToIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
+{
+ return rtl_ustr_compareIgnoreAsciiCase_WithLength(s1.data(), s1.size(), s2.data(), s2.size());
+};
+
+// Like OUString::matchIgnoreAsciiCase, but for two std::u16string_view:
+inline bool matchIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2,
+ sal_Int32 fromIndex = 0)
+{
+ return rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength(
+ s1.data() + fromIndex, s1.size() - fromIndex, s2.data(), s2.size(), s2.size())
+ == 0;
+}
+
+// Similar to O[U]String::getToken, returning the first token of a std::[u16]string_view starting
+// at a given position.
+//
+// Attention: There are two sets of o3tl::getToken overloads here. This first set has an interface
+// based on std::size_t length parameters, and its semantics don't match those of
+// O[U]String::getToken exactly (buf if needed, it can be extended to return the n'th token instead
+// of just the first, and/or support an initial position of npos, to make the semantics match).
+template <typename charT, typename traits = std::char_traits<charT>>
+inline std::basic_string_view<charT, traits> getToken(std::basic_string_view<charT, traits> sv,
+ charT delimiter, std::size_t& position)
+{
+ assert(position <= sv.size());
+ auto const n = sv.find(delimiter, position);
+ std::basic_string_view<charT, traits> t;
+ if (n == std::string_view::npos)
+ {
+ t = sv.substr(position);
+ position = std::string_view::npos;
+ }
+ else
+ {
+ t = sv.substr(position, n - position);
+ position = n + 1;
+ }
+ return t;
+}
+// The following two overloads prevent overload resolution mistakes that would occur with their
+// template counterpart, when sv is of a type that is implicitly convertible to basic_string_view
+// (like OString or OUString), in which case overload resolution would erroneously choose the
+// three-argument overloads (taking sv, nToken, cTok) from the second set of
+// o3tl::getToken overloads below:
+inline std::string_view getToken(std::string_view sv, char delimiter, std::size_t& position)
+{
+ return getToken<char>(sv, delimiter, position);
+}
+inline std::u16string_view getToken(std::u16string_view sv, char16_t delimiter,
+ std::size_t& position)
+{
+ return getToken<char16_t>(sv, delimiter, position);
+}
+
+// Similar to O[U]String::getToken.
+//
+// Attention: There are two sets of o3tl::getToken overloads here. This second set has an
+// interface based on sal_Int32 length parameters, and is meant to be a drop-in replacement for
+// O[U]String::getToken.
+template <typename charT, typename traits = std::char_traits<charT>>
+inline std::basic_string_view<charT, traits> getToken(std::basic_string_view<charT, traits> pStr,
+ sal_Int32 nToken, charT cTok,
+ sal_Int32& rnIndex)
+{
+ assert(o3tl::IntCmp(rnIndex) <= o3tl::IntCmp(pStr.size()));
+
+ // Return an empty string and set rnIndex to -1 if either nToken or rnIndex is
+ // negative:
+ if (rnIndex >= 0 && nToken >= 0)
+ {
+ const charT* pOrgCharStr = pStr.data();
+ const charT* pCharStr = pOrgCharStr + rnIndex;
+ sal_Int32 nLen = pStr.size() - rnIndex;
+ sal_Int32 nTokCount = 0;
+ const charT* pCharStrStart = pCharStr;
+ while (nLen > 0)
+ {
+ if (*pCharStr == cTok)
+ {
+ nTokCount++;
+
+ if (nTokCount > nToken)
+ break;
+ if (nTokCount == nToken)
+ pCharStrStart = pCharStr + 1;
+ }
+
+ pCharStr++;
+ nLen--;
+ }
+ if (nTokCount >= nToken)
+ {
+ if (nLen > 0)
+ rnIndex = pCharStr - pOrgCharStr + 1;
+ else
+ rnIndex = -1;
+ return std::basic_string_view<charT, traits>(pCharStrStart, pCharStr - pCharStrStart);
+ }
+ }
+
+ rnIndex = -1;
+ return std::basic_string_view<charT, traits>();
+}
+// The following two overloads prevent deduction failures that would occur with their template
+// counterpart, when sv is of a type that is implicitly convertible to basic_string_view (like
+// OString or OUString):
+inline std::string_view getToken(std::string_view sv, sal_Int32 nToken, char cTok,
+ sal_Int32& rnIndex)
+{
+ return getToken<char>(sv, nToken, cTok, rnIndex);
+}
+inline std::u16string_view getToken(std::u16string_view sv, sal_Int32 nToken, char16_t cTok,
+ sal_Int32& rnIndex)
+{
+ return getToken<char16_t>(sv, nToken, cTok, rnIndex);
+}
+inline std::string_view getToken(std::string_view sv, sal_Int32 nToken, char cTok)
+{
+ sal_Int32 nIndex = 0;
+ return getToken<char>(sv, nToken, cTok, nIndex);
+}
+inline std::u16string_view getToken(std::u16string_view sv, sal_Int32 nToken, char16_t cTok)
+{
+ sal_Int32 nIndex = 0;
+ return getToken<char16_t>(sv, nToken, cTok, nIndex);
+}
+
+// Implementations of C++20 std::basic_string_view::starts_with and
+// std::basic_string_view::ends_with, until we can use those directly on all platforms:
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool starts_with(std::basic_string_view<charT, traits> sv,
+ std::basic_string_view<charT, traits> x) noexcept
+{
+#if defined __cpp_lib_starts_ends_with
+ return sv.starts_with(x);
+#else
+ return sv.substr(0, x.size()) == x;
+#endif
+}
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool starts_with(std::basic_string_view<charT, traits> sv, charT x) noexcept
+{
+#if defined __cpp_lib_starts_ends_with
+ return sv.starts_with(x);
+#else
+ return !sv.empty() && traits::eq(sv.front(), x);
+#endif
+}
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool starts_with(std::basic_string_view<charT, traits> sv, charT const* x)
+{
+#if defined __cpp_lib_starts_ends_with
+ return sv.starts_with(x);
+#else
+ return starts_with(sv, std::basic_string_view<charT, traits>(x));
+#endif
+}
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool ends_with(std::basic_string_view<charT, traits> sv,
+ std::basic_string_view<charT, traits> x) noexcept
+{
+#if defined __cpp_lib_ends_ends_with
+ return sv.ends_with(x);
+#else
+ return sv.size() >= x.size()
+ && sv.compare(sv.size() - x.size(), std::basic_string_view<charT, traits>::npos, x) == 0;
+#endif
+}
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool ends_with(std::basic_string_view<charT, traits> sv, charT x) noexcept
+{
+#if defined __cpp_lib_ends_ends_with
+ return sv.ends_with(x);
+#else
+ return !sv.empty() && traits::eq(sv.back(), x);
+#endif
+}
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool ends_with(std::basic_string_view<charT, traits> sv, charT const* x)
+{
+#if defined __cpp_lib_ends_ends_with
+ return sv.ends_with(x);
+#else
+ return ends_with(sv, std::basic_string_view<charT, traits>(x));
+#endif
+}
+// The following overloads prevent deduction failures that would occur with their template
+// counterparts, when x is of a type that is implicitly convertible to basic_string_view (like
+// OString or OUString, and we only bother to provide overloads for the char and char16_t cases, not
+// also for char32_t and wchar_t, nor for C++20 char8_t):
+constexpr bool starts_with(std::string_view sv, std::string_view x) noexcept
+{
+ return starts_with<char>(sv, x);
+}
+constexpr bool starts_with(std::u16string_view sv, std::u16string_view x) noexcept
+{
+ return starts_with<char16_t>(sv, x);
+}
+constexpr bool ends_with(std::string_view sv, std::string_view x) noexcept
+{
+ return ends_with<char>(sv, x);
+}
+constexpr bool ends_with(std::u16string_view sv, std::u16string_view x) noexcept
+{
+ return ends_with<char16_t>(sv, x);
+}
+
+// Variants of C++20 std::basic_string_view::starts_with and
+// std::basic_string_view::ends_with that have a rest out parameter, similar to our OString and
+// OUString startsWith and endsWith member functions:
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool starts_with(std::basic_string_view<charT, traits> sv,
+ std::basic_string_view<charT, traits> x,
+ std::basic_string_view<charT, traits>* rest) noexcept
+{
+ assert(rest != nullptr);
+ auto const found = starts_with(sv, x);
+ if (found)
+ {
+ *rest = sv.substr(x.length());
+ }
+ return found;
+}
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool starts_with(std::basic_string_view<charT, traits> sv, charT x,
+ std::basic_string_view<charT, traits>* rest) noexcept
+{
+ assert(rest != nullptr);
+ auto const found = starts_with(sv, x);
+ if (found)
+ {
+ *rest = sv.substr(1);
+ }
+ return found;
+}
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool starts_with(std::basic_string_view<charT, traits> sv, charT const* x,
+ std::basic_string_view<charT, traits>* rest)
+{
+ assert(rest != nullptr);
+ auto const found = starts_with(sv, x);
+ if (found)
+ {
+ *rest = sv.substr(traits::length(x));
+ }
+ return found;
+}
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool ends_with(std::basic_string_view<charT, traits> sv,
+ std::basic_string_view<charT, traits> x,
+ std::basic_string_view<charT, traits>* rest) noexcept
+{
+ assert(rest != nullptr);
+ auto const found = ends_with(sv, x);
+ if (found)
+ {
+ *rest = sv.substr(0, sv.length() - x.length());
+ }
+ return found;
+}
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool ends_with(std::basic_string_view<charT, traits> sv, charT x,
+ std::basic_string_view<charT, traits>* rest) noexcept
+{
+ assert(rest != nullptr);
+ auto const found = ends_with(sv, x);
+ if (found)
+ {
+ *rest = sv.substr(0, sv.length() - 1);
+ }
+ return found;
+}
+template <typename charT, typename traits = std::char_traits<charT>>
+constexpr bool ends_with(std::basic_string_view<charT, traits> sv, charT const* x,
+ std::basic_string_view<charT, traits>* rest)
+{
+ assert(rest != nullptr);
+ auto const found = ends_with(sv, x);
+ if (found)
+ {
+ *rest = sv.substr(0, sv.length() - traits::length(x));
+ }
+ return found;
+}
+// The following overloads prevent deduction failures that would occur with their template
+// counterparts, when x is of a type that is implicitly convertible to basic_string_view (like
+// OString or OUString, and we only bother to provide overloads for the char and char16_t cases, not
+// also for char32_t and wchar_t, nor for C++20 char8_t):
+constexpr bool starts_with(std::string_view sv, std::string_view x, std::string_view* rest) noexcept
+{
+ return starts_with<char>(sv, x, rest);
+}
+constexpr bool starts_with(std::u16string_view sv, std::u16string_view x,
+ std::u16string_view* rest) noexcept
+{
+ return starts_with<char16_t>(sv, x, rest);
+}
+constexpr bool ends_with(std::string_view sv, std::string_view x, std::string_view* rest) noexcept
+{
+ return ends_with<char>(sv, x, rest);
+}
+constexpr bool ends_with(std::u16string_view sv, std::u16string_view x,
+ std::u16string_view* rest) noexcept
+{
+ return ends_with<char16_t>(sv, x, rest);
+}
+
+namespace internal
+{
+// copy of implIsWhitespace from sal/rtl/strtmpl.hxx
+inline bool implIsWhitespace(sal_Unicode c)
+{
+ /* Space or Control character? */
+ if ((c <= 32) && c)
+ return true;
+
+ /* Only in the General Punctuation area Space or Control characters are included? */
+ if ((c < 0x2000) || (c > 0x206F))
+ return false;
+
+ if (((c >= 0x2000) && (c <= 0x200B)) || /* All Spaces */
+ (c == 0x2028) || /* LINE SEPARATOR */
+ (c == 0x2029)) /* PARAGRAPH SEPARATOR */
+ return true;
+
+ return false;
+}
+} // namespace internal
+
+// Like OUString::trim, but for std::u16string_view:
+// copy of the trimView code from sal/rtl/strtmpl.hxx
+inline std::u16string_view trim(std::u16string_view str)
+{
+ sal_Int32 nLen = str.size();
+ sal_Int32 nPreSpaces = 0;
+ sal_Int32 nPostSpaces = 0;
+ sal_Int32 nIndex = str.size() - 1;
+
+ while ((nPreSpaces < nLen) && internal::implIsWhitespace(*(str.data() + nPreSpaces)))
+ nPreSpaces++;
+
+ while ((nIndex > nPreSpaces) && internal::implIsWhitespace(*(str.data() + nIndex)))
+ {
+ nPostSpaces++;
+ nIndex--;
+ }
+
+ return std::u16string_view{ str.data() + nPreSpaces,
+ static_cast<size_t>(nLen - nPostSpaces - nPreSpaces) };
+}
+
+// Like OString::trim, but for std::string_view:
+// copy of the trimView code from sal/rtl/strtmpl.hxx
+inline std::string_view trim(std::string_view str)
+{
+ sal_Int32 nLen = str.size();
+ sal_Int32 nPreSpaces = 0;
+ sal_Int32 nPostSpaces = 0;
+ sal_Int32 nIndex = str.size() - 1;
+
+ while ((nPreSpaces < nLen) && internal::implIsWhitespace(*(str.data() + nPreSpaces)))
+ nPreSpaces++;
+
+ while ((nIndex > nPreSpaces) && internal::implIsWhitespace(*(str.data() + nIndex)))
+ {
+ nPostSpaces++;
+ nIndex--;
+ }
+
+ return std::string_view{ str.data() + nPreSpaces,
+ static_cast<size_t>(nLen - nPostSpaces - nPreSpaces) };
+}
+
+// Like OString::toInt32, but for std::string_view:
+inline sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix = 10)
+{
+ sal_Int64 n = rtl_ustr_toInt64_WithLength(str.data(), radix, str.size());
+ if (n < SAL_MIN_INT32 || n > SAL_MAX_INT32)
+ n = 0;
+ return n;
+}
+inline sal_Int32 toInt32(std::string_view str, sal_Int16 radix = 10)
+{
+ sal_Int64 n = rtl_str_toInt64_WithLength(str.data(), radix, str.size());
+ if (n < SAL_MIN_INT32 || n > SAL_MAX_INT32)
+ n = 0;
+ return n;
+}
+
+// Like OString::toUInt32, but for std::string_view:
+inline sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix = 10)
+{
+ sal_Int64 n = rtl_ustr_toInt64_WithLength(str.data(), radix, str.size());
+ if (n < 0 || n > SAL_MAX_UINT32)
+ n = 0;
+ return n;
+}
+inline sal_uInt32 toUInt32(std::string_view str, sal_Int16 radix = 10)
+{
+ sal_Int64 n = rtl_str_toInt64_WithLength(str.data(), radix, str.size());
+ if (n < 0 || n > SAL_MAX_UINT32)
+ n = 0;
+ return n;
+}
+
+// Like OString::toInt64, but for std::string_view:
+inline sal_Int64 toInt64(std::u16string_view str, sal_Int16 radix = 10)
+{
+ return rtl_ustr_toInt64_WithLength(str.data(), radix, str.size());
+}
+inline sal_Int64 toInt64(std::string_view str, sal_Int16 radix = 10)
+{
+ return rtl_str_toInt64_WithLength(str.data(), radix, str.size());
+}
+
+// Like OString::toDouble, but for std::string_view:
+inline double toDouble(std::u16string_view str)
+{
+ return rtl_math_uStringToDouble(str.data(), str.data() + str.size(), '.', 0, nullptr, nullptr);
+}
+inline double toDouble(std::string_view str)
+{
+ return rtl_math_stringToDouble(str.data(), str.data() + str.size(), '.', 0, nullptr, nullptr);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx
new file mode 100644
index 000000000..821079558
--- /dev/null
+++ b/include/o3tl/strong_int.hxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_STRONG_INT_HXX
+#define INCLUDED_O3TL_STRONG_INT_HXX
+
+#include <sal/config.h>
+#include <limits>
+#include <cassert>
+#include <type_traits>
+
+namespace o3tl
+{
+
+#if !defined __COVERITY__
+
+namespace detail {
+
+template<typename T1, typename T2> constexpr
+typename std::enable_if<
+ std::is_signed<T1>::value && std::is_signed<T2>::value, bool>::type
+isInRange(T2 value) {
+ return value >= std::numeric_limits<T1>::min()
+ && value <= std::numeric_limits<T1>::max();
+}
+
+template<typename T1, typename T2> constexpr
+typename std::enable_if<
+ std::is_signed<T1>::value && std::is_unsigned<T2>::value, bool>::type
+isInRange(T2 value) {
+ return value
+ <= static_cast<typename std::make_unsigned<T1>::type>(
+ std::numeric_limits<T1>::max());
+}
+
+template<typename T1, typename T2> constexpr
+typename std::enable_if<
+ std::is_unsigned<T1>::value && std::is_signed<T2>::value, bool>::type
+isInRange(T2 value) {
+ return value >= 0
+ && (static_cast<typename std::make_unsigned<T2>::type>(value)
+ <= std::numeric_limits<T1>::max());
+}
+
+template<typename T1, typename T2> constexpr
+typename std::enable_if<
+ std::is_unsigned<T1>::value && std::is_unsigned<T2>::value, bool>::type
+isInRange(T2 value) {
+ return value <= std::numeric_limits<T1>::max();
+}
+
+}
+
+#endif
+
+///
+/// Wrap up an integer type so that we prevent accidental conversion to other integer types.
+///
+/// e.g.
+/// typedef o3tl::strong_int<unsigned, struct MyIntTag> MyInt;
+///
+/// \param UNDERLYING_TYPE the underlying scalar type
+/// \param PHANTOM_TYPE a type tag, used to distinguish this instantiation of the template
+/// from other instantiations with the same UNDERLYING_TYPE.
+///
+template <typename UNDERLYING_TYPE, typename PHANTOM_TYPE>
+struct strong_int
+{
+public:
+ template<typename T> explicit constexpr strong_int(
+ T value,
+ typename std::enable_if<std::is_integral<T>::value, int>::type = 0):
+ m_value(value)
+ {
+#if !defined __COVERITY__
+ // catch attempts to pass in out-of-range values early
+ assert(detail::isInRange<UNDERLYING_TYPE>(value)
+ && "out of range");
+#endif
+ }
+ strong_int() : m_value(0) {}
+
+ explicit constexpr operator UNDERLYING_TYPE() const { return m_value; }
+ explicit operator bool() const { return m_value != 0; }
+ UNDERLYING_TYPE get() const { return m_value; }
+
+ bool operator<(strong_int const & other) const { return m_value < other.m_value; }
+ bool operator<=(strong_int const & other) const { return m_value <= other.m_value; }
+ bool operator>(strong_int const & other) const { return m_value > other.m_value; }
+ bool operator>=(strong_int const & other) const { return m_value >= other.m_value; }
+ bool operator==(strong_int const & other) const { return m_value == other.m_value; }
+ bool operator!=(strong_int const & other) const { return m_value != other.m_value; }
+ strong_int& operator++() { ++m_value; return *this; }
+ strong_int operator++(int) { UNDERLYING_TYPE nOldValue = m_value; ++m_value; return strong_int(nOldValue); }
+ strong_int& operator--() { --m_value; return *this; }
+ strong_int operator--(int) { UNDERLYING_TYPE nOldValue = m_value; --m_value; return strong_int(nOldValue); }
+ strong_int& operator+=(strong_int const & other) { m_value += other.m_value; return *this; }
+ strong_int& operator-=(strong_int const & other) { m_value -= other.m_value; return *this; }
+ strong_int& operator%=(strong_int const & other) { m_value %= other.m_value; return *this; }
+ strong_int& operator*=(strong_int const & other) { m_value *= other.m_value; return *this; }
+ strong_int& operator/=(strong_int const & other) { m_value /= other.m_value; return *this; }
+ [[nodiscard]]
+ strong_int operator%(strong_int const & other) const { return strong_int(m_value % other.m_value); }
+ [[nodiscard]]
+ strong_int operator-() const { return strong_int(-m_value); }
+ [[nodiscard]]
+ strong_int operator*(strong_int const & other) const { return strong_int(m_value * other.m_value); }
+ [[nodiscard]]
+ strong_int operator/(strong_int const & other) const { return strong_int(m_value / other.m_value); }
+
+ bool anyOf(strong_int v) const {
+ return *this == v;
+ }
+
+ template<typename... Args>
+ bool anyOf(strong_int first, Args... args) const {
+ return *this == first || anyOf(args...);
+ }
+
+private:
+ UNDERLYING_TYPE m_value;
+};
+
+template <typename UT, typename PT>
+strong_int<UT,PT> operator+(strong_int<UT,PT> const & lhs, strong_int<UT,PT> const & rhs)
+{
+ return strong_int<UT,PT>(lhs.get() + rhs.get());
+}
+
+template <typename UT, typename PT>
+strong_int<UT,PT> operator-(strong_int<UT,PT> const & lhs, strong_int<UT,PT> const & rhs)
+{
+ return strong_int<UT,PT>(lhs.get() - rhs.get());
+}
+
+}; // namespace o3tl
+
+#endif /* INCLUDED_O3TL_STRONG_INT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/temporary.hxx b/include/o3tl/temporary.hxx
new file mode 100644
index 000000000..50d006e26
--- /dev/null
+++ b/include/o3tl/temporary.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_TEMPORARY_HXX
+#define INCLUDED_O3TL_TEMPORARY_HXX
+
+#include <sal/config.h>
+
+namespace o3tl
+{
+// Cast an rvalue to an lvalue. Can be useful if a function parameter is a pointer/reference to T,
+// and some call site doesn't need the value beyond the call itself (e.g., in a call like
+// std::modf(x, &o3tl::temporary(double())) to obtain the fractional part of x, ignoring the
+// integral part).
+template <typename T> constexpr T& temporary(T&& x) { return static_cast<T&>(x); }
+template <typename T> constexpr T& temporary(T&) = delete;
+}
+
+#endif /* INCLUDED_O3TL_TEMPORARY_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/typed_flags_set.hxx b/include/o3tl/typed_flags_set.hxx
new file mode 100644
index 000000000..413ee9579
--- /dev/null
+++ b/include/o3tl/typed_flags_set.hxx
@@ -0,0 +1,325 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_TYPED_FLAGS_SET_HXX
+#define INCLUDED_O3TL_TYPED_FLAGS_SET_HXX
+
+#include <sal/config.h>
+
+#include <cassert>
+#include <type_traits>
+
+#include <o3tl/underlyingenumvalue.hxx>
+
+namespace o3tl {
+
+namespace detail {
+
+template<typename T> constexpr
+typename std::enable_if<std::is_signed<T>::value, bool>::type isNonNegative(
+ T value)
+{
+ return value >= 0;
+}
+
+template<typename T> constexpr
+typename std::enable_if<std::is_unsigned<T>::value, bool>::type isNonNegative(T)
+{
+ return true;
+}
+
+}
+
+template<typename T> struct typed_flags {};
+
+/// Mark a (scoped) enumeration as a set of bit flags, with accompanying
+/// operations.
+///
+/// template<>
+/// struct o3tl::typed_flags<TheE>: o3tl::is_typed_flags<TheE, TheM> {};
+///
+/// All relevant values must be non-negative. (Typically, the enumeration's
+/// underlying type will either be fixed and unsigned, or it will be unfixed---
+/// and can thus default to a signed type---and all enumerators will have non-
+/// negative values.)
+///
+/// \param E the enumeration type.
+/// \param M the all-bits-set value for the bit flags.
+template<typename E, typename std::underlying_type<E>::type M>
+struct is_typed_flags {
+ static_assert(
+ M >= 0, "is_typed_flags expects only non-negative bit values");
+
+ typedef E Self;
+
+ class Wrap {
+ public:
+ typedef is_typed_flags Unwrapped;
+
+ explicit constexpr Wrap(typename std::underlying_type<E>::type value):
+ value_(value)
+ {
+ assert(detail::isNonNegative(value));
+ assert(
+ static_cast<typename std::underlying_type<E>::type>(~0) == M
+ // avoid "operands don't affect result" warnings when M
+ // covers all bits of the underlying type
+ || (value & ~M) == 0);
+ }
+
+ constexpr operator E() const { return static_cast<E>(value_); }
+
+ explicit constexpr operator typename std::underlying_type<E>::type()
+ const
+ { return value_; }
+
+ explicit constexpr operator bool() const { return value_ != 0; }
+
+ private:
+ typename std::underlying_type<E>::type value_;
+ };
+
+ static typename std::underlying_type<E>::type const mask = M;
+};
+
+}
+
+template<typename E>
+constexpr typename o3tl::typed_flags<E>::Wrap operator ~(E rhs) {
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(rhs)));
+ return static_cast<typename o3tl::typed_flags<E>::Wrap>(
+ o3tl::typed_flags<E>::mask
+ & ~o3tl::to_underlying(rhs));
+}
+
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ~(
+ typename o3tl::typed_flags<E>::Wrap rhs)
+{
+ return static_cast<typename o3tl::typed_flags<E>::Wrap>(
+ o3tl::typed_flags<E>::mask
+ & ~o3tl::to_underlying<E>(rhs));
+}
+
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ^(
+ E lhs, E rhs)
+{
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(rhs)));
+ return static_cast<typename o3tl::typed_flags<E>::Wrap>(
+ o3tl::to_underlying(lhs)
+ ^ o3tl::to_underlying(rhs));
+}
+
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ^(
+ E lhs, typename o3tl::typed_flags<E>::Wrap rhs)
+{
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ return static_cast<typename o3tl::typed_flags<E>::Wrap>(
+ o3tl::to_underlying(lhs)
+ ^ o3tl::to_underlying<E>(rhs));
+}
+
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ^(
+ typename o3tl::typed_flags<E>::Wrap lhs, E rhs)
+{
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(rhs)));
+ return static_cast<typename o3tl::typed_flags<E>::Wrap>(
+ o3tl::to_underlying<E>(lhs)
+ ^ o3tl::to_underlying(rhs));
+}
+
+template<typename W> constexpr
+typename o3tl::typed_flags<typename W::Unwrapped::Self>::Wrap operator ^(
+ W lhs, W rhs)
+{
+ return static_cast<W>(
+ o3tl::to_underlying<typename W::Unwrapped::Self>(lhs)
+ ^ o3tl::to_underlying<typename W::Unwrapped::Self>(rhs));
+}
+
+template<typename E>
+constexpr typename o3tl::typed_flags<E>::Wrap operator &(E lhs, E rhs) {
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(rhs)));
+ return static_cast<typename o3tl::typed_flags<E>::Wrap>(
+ o3tl::to_underlying(lhs)
+ & o3tl::to_underlying(rhs));
+}
+
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator &(
+ E lhs, typename o3tl::typed_flags<E>::Wrap rhs)
+{
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ return static_cast<typename o3tl::typed_flags<E>::Wrap>(
+ o3tl::to_underlying(lhs)
+ & o3tl::to_underlying<E>(rhs));
+}
+
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator &(
+ typename o3tl::typed_flags<E>::Wrap lhs, E rhs)
+{
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(rhs)));
+ return static_cast<typename o3tl::typed_flags<E>::Wrap>(
+ o3tl::to_underlying<E>(lhs)
+ & o3tl::to_underlying(rhs));
+}
+
+template<typename W> constexpr
+typename o3tl::typed_flags<typename W::Unwrapped::Self>::Wrap operator &(
+ W lhs, W rhs)
+{
+ return static_cast<W>(
+ o3tl::to_underlying<typename W::Unwrapped::Self>(lhs)
+ & o3tl::to_underlying<typename W::Unwrapped::Self>(rhs));
+}
+
+template<typename E>
+constexpr typename o3tl::typed_flags<E>::Wrap operator |(E lhs, E rhs) {
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(rhs)));
+ return static_cast<typename o3tl::typed_flags<E>::Wrap>(
+ o3tl::to_underlying(lhs)
+ | o3tl::to_underlying(rhs));
+}
+
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator |(
+ E lhs, typename o3tl::typed_flags<E>::Wrap rhs)
+{
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ return static_cast<typename o3tl::typed_flags<E>::Wrap>(
+ o3tl::to_underlying(lhs)
+ | o3tl::to_underlying<E>(rhs));
+}
+
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator |(
+ typename o3tl::typed_flags<E>::Wrap lhs, E rhs)
+{
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(rhs)));
+ return static_cast<typename o3tl::typed_flags<E>::Wrap>(
+ o3tl::to_underlying<E>(lhs)
+ | o3tl::to_underlying(rhs));
+}
+
+template<typename W> constexpr
+typename o3tl::typed_flags<typename W::Unwrapped::Self>::Wrap operator |(
+ W lhs, W rhs)
+{
+ return static_cast<W>(
+ o3tl::to_underlying<typename W::Unwrapped::Self>(lhs)
+ | o3tl::to_underlying<typename W::Unwrapped::Self>(rhs));
+}
+
+template<typename E>
+inline typename o3tl::typed_flags<E>::Self operator &=(E & lhs, E rhs) {
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(rhs)));
+ lhs = lhs & rhs;
+ return lhs;
+}
+
+template<typename E>
+inline typename o3tl::typed_flags<E>::Self operator &=(
+ E & lhs, typename o3tl::typed_flags<E>::Wrap rhs)
+{
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ lhs = lhs & rhs;
+ return lhs;
+}
+
+template<typename E>
+inline typename o3tl::typed_flags<E>::Self operator |=(E & lhs, E rhs) {
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(rhs)));
+ lhs = lhs | rhs;
+ return lhs;
+}
+
+template<typename E>
+inline typename o3tl::typed_flags<E>::Self operator |=(
+ E & lhs, typename o3tl::typed_flags<E>::Wrap rhs)
+{
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ lhs = lhs | rhs;
+ return lhs;
+}
+
+template<typename E>
+inline typename o3tl::typed_flags<E>::Self operator ^=(E & lhs, E rhs) {
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(rhs)));
+ lhs = lhs ^ rhs;
+ return lhs;
+}
+
+template<typename E>
+inline typename o3tl::typed_flags<E>::Self operator ^=(
+ E & lhs, typename o3tl::typed_flags<E>::Wrap rhs)
+{
+ assert(
+ o3tl::detail::isNonNegative(
+ o3tl::to_underlying(lhs)));
+ lhs = lhs ^ rhs;
+ return lhs;
+}
+
+#endif /* INCLUDED_O3TL_TYPED_FLAGS_SET_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/underlyingenumvalue.hxx b/include/o3tl/underlyingenumvalue.hxx
new file mode 100644
index 000000000..a913ab385
--- /dev/null
+++ b/include/o3tl/underlyingenumvalue.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_UNDERLYINGENUMVALUE_HXX
+#define INCLUDED_O3TL_UNDERLYINGENUMVALUE_HXX
+
+#include <sal/config.h>
+
+#include <type_traits>
+
+namespace o3tl
+{
+// An implementation of C++23 std::to_underlying
+// For a value e of an enumeration type T, return the corresponding value of T's underlying type:
+template <typename T> constexpr std::underlying_type_t<T> to_underlying(T e)
+{
+ return static_cast<std::underlying_type_t<T>>(e);
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/unit_conversion.hxx b/include/o3tl/unit_conversion.hxx
new file mode 100644
index 000000000..67830f0d1
--- /dev/null
+++ b/include/o3tl/unit_conversion.hxx
@@ -0,0 +1,261 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <o3tl/safeint.hxx>
+#include <sal/macros.h>
+#include <sal/types.h>
+
+#include <array>
+#include <cassert>
+#include <numeric>
+#include <utility>
+#include <type_traits>
+
+namespace o3tl
+{
+// Length units
+enum class Length
+{
+ mm100 = 0, // 1/100th mm
+ mm10, // 1/10 mm, corresponds to MapUnit::Map10thMM
+ mm, // millimeter
+ cm, // centimeter
+ m, // meter
+ km, // kilometer
+ emu, // English Metric Unit: 1/360000 cm, 1/914400 in
+ twip, // "Twentieth of a point" aka "dxa": 1/20 pt
+ pt, // Point: 1/72 in
+ pc, // Pica: 1/6 in, corresponds to FieldUnit::PICA and MeasureUnit::PICA
+ in1000, // 1/1000 in, corresponds to MapUnit::Map1000thInch
+ in100, // 1/100 in, corresponds to MapUnit::Map100thInch
+ in10, // 1/10 in, corresponds to MapUnit::Map10thInch
+ in, // inch
+ ft, // foot
+ mi, // mile
+ master, // PPT Master Unit: 1/576 in
+ px, // "pixel" unit: 15 twip (96 ppi), corresponds to MeasureUnit::PIXEL
+ ch, // "char" unit: 210 twip (14 px), corresponds to FieldUnit::CHAR
+ line, // "line" unit: 312 twip, corresponds to FieldUnit::LINE
+ count, // <== add new units above this last entry
+ invalid = -1
+};
+
+// If other categories of units would be needed (like time), a separate scoped enum
+// should be created, respective conversion array prepared in detail namespace, and
+// respective md(NewUnit, NewUnit) overload introduced, which would allow using
+// o3tl::convert(), o3tl::convertSaturate() and o3tl::getConversionMulDiv() with the
+// new category in a type-safe way, without mixing unrelated units.
+
+namespace detail
+{
+// Common utilities
+
+// A special function to avoid compiler warning comparing signed and unsigned values
+template <typename I> constexpr bool isBetween(I n, sal_Int64 min, sal_Int64 max)
+{
+ assert(max > 0 && min < 0);
+ if constexpr (std::is_signed_v<I>)
+ return n >= min && n <= max;
+ else
+ return n <= sal_uInt64(max);
+}
+
+// Ensure correct rounding for both positive and negative integers
+template <typename I, std::enable_if_t<std::is_integral_v<I>, int> = 0>
+constexpr sal_Int64 MulDiv(I n, sal_Int64 m, sal_Int64 d)
+{
+ assert(m > 0 && d > 0);
+ assert(isBetween(n, (SAL_MIN_INT64 + d / 2) / m, (SAL_MAX_INT64 - d / 2) / m));
+ return (n >= 0 ? (n * m + d / 2) : (n * m - d / 2)) / d;
+}
+template <typename F, std::enable_if_t<std::is_floating_point_v<F>, int> = 0>
+constexpr double MulDiv(F f, sal_Int64 m, sal_Int64 d)
+{
+ assert(m > 0 && d > 0);
+ return f * (double(m) / d);
+}
+
+template <typename I, std::enable_if_t<std::is_integral_v<I>, int> = 0>
+constexpr sal_Int64 MulDiv(I n, sal_Int64 m, sal_Int64 d, bool& bOverflow, sal_Int64 nDefault)
+{
+ if (!isBetween(n, (SAL_MIN_INT64 + d / 2) / m, (SAL_MAX_INT64 - d / 2) / m))
+ {
+ bOverflow = true;
+ return nDefault;
+ }
+ bOverflow = false;
+ return MulDiv(n, m, d);
+}
+
+template <typename I, std::enable_if_t<std::is_integral_v<I>, int> = 0>
+constexpr sal_Int64 MulDivSaturate(I n, sal_Int64 m, sal_Int64 d)
+{
+ if (!isBetween(n, (SAL_MIN_INT64 + d / 2) / m, (SAL_MAX_INT64 - d / 2) / m))
+ {
+ if (m > d && !isBetween(n, SAL_MIN_INT64 / m * d + d / 2, SAL_MAX_INT64 / m * d - d / 2))
+ return n > 0 ? SAL_MAX_INT64 : SAL_MIN_INT64; // saturate
+ return (n >= 0 ? n + d / 2 : n - d / 2) / d * m; // divide before multiplication
+ }
+ return MulDiv(n, m, d);
+}
+
+template <class M, class N> constexpr std::common_type_t<M, N> asserting_gcd(M m, N n)
+{
+ auto ret = std::gcd(m, n);
+ assert(ret != 0);
+ return ret;
+}
+
+// Packs integral multiplier and divisor for conversion from one unit to another
+struct m_and_d
+{
+ sal_Int64 m; // multiplier
+ sal_Int64 d; // divisor
+ constexpr m_and_d(sal_Int64 _m, sal_Int64 _d)
+ : m(_m / asserting_gcd(_m, _d)) // make sure to use smallest quotients here because
+ , d(_d / asserting_gcd(_m, _d)) // they will be multiplied when building final table
+ {
+ assert(_m > 0 && _d > 0);
+ }
+};
+
+// Resulting static array N x N of all quotients to convert between all units. The
+// quotients are minimal to allow largest range of converted numbers without overflow.
+// Maybe o3tl::enumarray could be used here, but it's not constexpr yet.
+template <int N> constexpr auto prepareMDArray(const m_and_d (&mdBase)[N])
+{
+ std::array<std::array<sal_Int64, N>, N> a{};
+ for (int i = 0; i < N; ++i)
+ {
+ a[i][i] = 1;
+ for (int j = 0; j < i; ++j)
+ {
+ assert(mdBase[i].m < SAL_MAX_INT64 / mdBase[j].d);
+ assert(mdBase[i].d < SAL_MAX_INT64 / mdBase[j].m);
+ const sal_Int64 m = mdBase[i].m * mdBase[j].d, d = mdBase[i].d * mdBase[j].m;
+ const sal_Int64 g = asserting_gcd(m, d);
+ a[i][j] = m / g;
+ a[j][i] = d / g;
+ }
+ }
+ return a;
+}
+
+// A generic template used for fundamental arithmetic types
+template <typename U> constexpr sal_Int64 md(U i, U /*j*/) { return i; }
+
+// Length units implementation
+
+// Array of conversion quotients for mm, used to build final conversion table. Entries
+// are { multiplier, divider } to convert respective unit *to* mm. Order of elements
+// corresponds to order in o3tl::Length enum (Length::count and Length::invalid omitted).
+constexpr m_and_d mdBaseLen[] = {
+ { 1, 100 }, // mm100 => mm
+ { 1, 10 }, // mm10 => mm
+ { 1, 1 }, // mm => mm
+ { 10, 1 }, // cm => mm
+ { 1000, 1 }, // m => mm
+ { 1000000, 1 }, // km => mm
+ { 1, 36000 }, // emu => mm
+ { 254, 10 * 1440 }, // twip => mm
+ { 254, 10 * 72 }, // pt => mm
+ { 254, 10 * 6 }, // pc => mm
+ { 254, 10000 }, // in1000 => mm
+ { 254, 1000 }, // in100 => mm
+ { 254, 100 }, // in10 => mm
+ { 254, 10 }, // in => mm
+ { 254 * 12, 10 }, // ft => mm
+ { 254 * 12 * 5280, 10 }, // mi => mm
+ { 254, 10 * 576 }, // master => mm
+ { 254 * 15, 10 * 1440 }, // px => mm
+ { 254 * 210, 10 * 1440 }, // ch => mm
+ { 254 * 312, 10 * 1440 }, // line => mm
+};
+static_assert(std::size(mdBaseLen) == static_cast<int>(Length::count),
+ "mdBaseL must have an entry for each unit in o3tl::Length");
+
+// The resulting multipliers and divisors array
+constexpr auto aLengthMDArray = prepareMDArray(mdBaseLen);
+
+// an overload taking Length
+constexpr sal_Int64 md(Length i, Length j)
+{
+ const int nI = static_cast<int>(i), nJ = static_cast<int>(j);
+ assert(nI >= 0 && o3tl::make_unsigned(nI) < aLengthMDArray.size());
+ assert(nJ >= 0 && o3tl::make_unsigned(nJ) < aLengthMDArray.size());
+ return aLengthMDArray[nI][nJ];
+}
+
+// here might go overloads of md() taking other units ...
+}
+
+// Unchecked conversion. Takes a number value, multiplier and divisor
+template <typename N> constexpr auto convert(N n, sal_Int64 mul, sal_Int64 div)
+{
+ return detail::MulDiv(n, mul, div);
+}
+
+// Unchecked conversion. Takes a number value and units defined in this header
+template <typename N, typename U> constexpr auto convert(N n, U from, U to)
+{
+ return convert(n, detail::md(from, to), detail::md(to, from));
+}
+
+// Convert to twips - for convenience as we do this a lot
+template <typename N> constexpr auto toTwips(N number, Length from)
+{
+ return convert(number, from, Length::twip);
+}
+
+// Returns nDefault if intermediate multiplication overflows sal_Int64 (only for integral types).
+// On return, bOverflow indicates if overflow happened. nDefault is returned when overflow occurs.
+template <typename N, typename U>
+constexpr auto convert(N n, U from, U to, bool& bOverflow, sal_Int64 nDefault = 0)
+{
+ return detail::MulDiv(n, detail::md(from, to), detail::md(to, from), bOverflow, nDefault);
+}
+
+// Conversion with saturation (only for integral types). For too large input returns SAL_MAX_INT64.
+// When intermediate multiplication would overflow, but the end result is in sal_Int64 range, the
+// precision is decreased because of inversion of multiplication and division.
+template <typename N, typename U> constexpr auto convertSaturate(N n, U from, U to)
+{
+ return detail::MulDivSaturate(n, detail::md(from, to), detail::md(to, from));
+}
+
+// Conversion with saturation (only for integral types), optimized for return types smaller than
+// sal_Int64. In this case, it's easier to clamp input values to known bounds, than to do some
+// preprocessing to handle too large input values, just to clamp the result anyway. Use it like:
+//
+// sal_Int32 n = convertNarrowing<sal_Int32, o3tl::Length::mm100, o3tl::Length::emu>(m);
+template <typename Out, auto from, auto to, typename N,
+ std::enable_if_t<
+ std::is_integral_v<N> && std::is_integral_v<Out> && sizeof(Out) < sizeof(sal_Int64),
+ int> = 0>
+constexpr Out convertNarrowing(N n)
+{
+ constexpr sal_Int64 nMin = convertSaturate(std::numeric_limits<Out>::min(), to, from);
+ constexpr sal_Int64 nMax = convertSaturate(std::numeric_limits<Out>::max(), to, from);
+ if (static_cast<sal_Int64>(n) > nMax)
+ return std::numeric_limits<Out>::max();
+ if (static_cast<sal_Int64>(n) < nMin)
+ return std::numeric_limits<Out>::min();
+ return convert(n, from, to);
+}
+
+// Return a pair { multiplier, divisor } for a given conversion
+template <typename U> constexpr std::pair<sal_Int64, sal_Int64> getConversionMulDiv(U from, U to)
+{
+ return { detail::md(from, to), detail::md(to, from) };
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/unreachable.hxx b/include/o3tl/unreachable.hxx
new file mode 100644
index 000000000..604f7a2f7
--- /dev/null
+++ b/include/o3tl/unreachable.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_UNREACHABLE_HXX
+#define INCLUDED_O3TL_UNREACHABLE_HXX
+
+#include <sal/config.h>
+
+#include <cassert>
+#include <utility>
+
+// An approximation of C++23 std::unreachable
+// (<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0627r6.pdf> "Function to mark
+// unreachable code").
+
+#if defined __cpp_lib_unreachable
+
+#define O3TL_UNREACHABLE (::std::unreachable())
+
+#else
+
+// This fallback implementation is inspired by LLVM's LLVM_BUILTIN_UNREACHABLE
+// (llvm/include/llvm/Support/Compiler.h).
+
+#if defined _MSC_VER
+#define O3TL_UNREACHABLE_detail __assume(false)
+#else // assuming Clang or GCC with support for:
+#define O3TL_UNREACHABLE_detail __builtin_unreachable()
+#endif
+
+#define O3TL_UNREACHABLE \
+ do \
+ { \
+ assert(false); \
+ O3TL_UNREACHABLE_detail; \
+ } while (false)
+
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/unsafe_downcast.hxx b/include/o3tl/unsafe_downcast.hxx
new file mode 100644
index 000000000..b49994eff
--- /dev/null
+++ b/include/o3tl/unsafe_downcast.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_UNSAFE_DOWNCAST_HXX
+#define INCLUDED_O3TL_UNSAFE_DOWNCAST_HXX
+
+#include <cassert>
+#include <type_traits>
+
+namespace o3tl
+{
+// Do a downcast from polymorphic `BasePtr` to `DerivedPtr` when it is known that `p` is actually
+// pointing to an object of derived type (or is a nullptr). This is potentially cheaper than
+// dynamic_cast and helps to avoid Coverity warnings about unchecked dynamic_cast.
+template <typename DerivedPtr, typename BasePtr>
+std::enable_if_t<
+ (std::is_pointer_v<
+ DerivedPtr> && std::is_pointer_v<BasePtr> && std::is_base_of_v<std::remove_pointer_t<BasePtr>, std::remove_pointer_t<DerivedPtr>>),
+ DerivedPtr>
+unsafe_downcast(BasePtr p)
+{
+ assert(p == nullptr || dynamic_cast<DerivedPtr>(p) != nullptr);
+ return static_cast<DerivedPtr>(p);
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/o3tl/vector_pool.hxx b/include/o3tl/vector_pool.hxx
new file mode 100644
index 000000000..eec1a1a3c
--- /dev/null
+++ b/include/o3tl/vector_pool.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_VECTOR_POOL_HXX
+#define INCLUDED_O3TL_VECTOR_POOL_HXX
+
+#include <utility>
+#include <vector>
+
+namespace o3tl
+{
+ namespace detail
+ {
+ template<typename ValueType, class Container> class simple_pool_impl :
+ public Container
+ {
+ typedef typename Container::value_type value_type;
+ std::ptrdiff_t mnFirstFreeIndex;
+
+ public:
+ simple_pool_impl() :
+ mnFirstFreeIndex(-1)
+ {}
+
+ std::ptrdiff_t alloc()
+ {
+ return store(ValueType());
+ }
+
+ std::ptrdiff_t store(const ValueType& rCopy)
+ {
+ if( mnFirstFreeIndex != -1 )
+ {
+ std::ptrdiff_t nIdx=mnFirstFreeIndex;
+ mnFirstFreeIndex = this->at(mnFirstFreeIndex).nextFree;
+ this->at(nIdx).value = rCopy;
+ this->at(nIdx).nextFree = -1;
+
+ return nIdx;
+ }
+ else
+ {
+ this->push_back(value_type(rCopy));
+ return this->size()-1;
+ }
+ }
+
+ void free( std::ptrdiff_t nIdx )
+ {
+ this->at(nIdx).nextFree = mnFirstFreeIndex;
+ mnFirstFreeIndex = nIdx;
+ }
+
+ const ValueType& get( std::ptrdiff_t nIdx ) const
+ {
+ return this->operator[](nIdx).value;
+ }
+ ValueType& get( std::ptrdiff_t nIdx )
+ {
+ return this->operator[](nIdx).value;
+ }
+ };
+
+ template< typename ValueType > struct struct_from_value
+ {
+ struct type
+ {
+ type() :
+ value(),
+ nextFree(-1)
+ {}
+ explicit type( ValueType val ) :
+ value(std::move(val)),
+ nextFree(-1)
+ {}
+
+ ValueType value;
+ std::ptrdiff_t nextFree;
+ };
+ };
+ }
+
+ /** Simple vector-based memory pool allocator
+
+ This template can be used to provide simple pooled memory
+ allocation from a container class that adheres to the stl
+ random access container concept. Note that alloc/free works
+ with _indices_ into the container!
+
+ @example
+ <pre>
+vector_pool<type> myPool;
+int nIdx=myPool.alloc();
+myPool[nIdx] = myVal;
+ ... do stuff ...
+myPool.free(nIdx);
+ </pre>
+ */
+ template<typename ValueType> struct vector_pool :
+ public detail::simple_pool_impl<ValueType,
+ std::vector<typename detail::struct_from_value<ValueType>::type > >
+ {};
+}
+
+#endif /* INCLUDED_O3TL_VECTOR_POOL_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/vector_utils.hxx b/include/o3tl/vector_utils.hxx
new file mode 100644
index 000000000..1fe34bcaf
--- /dev/null
+++ b/include/o3tl/vector_utils.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <algorithm>
+#include <unordered_set>
+#include <vector>
+
+namespace o3tl
+{
+// removes duplicated elements in a vector
+template <typename T> void remove_duplicates(std::vector<T>& rVector)
+{
+ std::unordered_set<T> aSet;
+ auto aEnd = std::copy_if(rVector.begin(), rVector.end(), rVector.begin(),
+ [&aSet](T const& rElement) { return aSet.insert(rElement).second; });
+ rVector.erase(aEnd, rVector.end());
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/onlineupdate/mar.h b/include/onlineupdate/mar.h
new file mode 100644
index 000000000..0e21efb92
--- /dev/null
+++ b/include/onlineupdate/mar.h
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef MAR_H__
+#define MAR_H__
+
+#include "mozilla/Assertions.h"
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* We have a MAX_SIGNATURES limit so that an invalid MAR will never
+ * waste too much of either updater's or signmar's time.
+ * It is also used at various places internally and will affect memory usage.
+ * If you want to increase this value above 9 then you need to adjust parsing
+ * code in tool/mar.c.
+*/
+#define MAX_SIGNATURES 8
+#ifdef __cplusplus
+static_assert(MAX_SIGNATURES <= 9, "too many signatures");
+#else
+MOZ_STATIC_ASSERT(MAX_SIGNATURES <= 9, "too many signatures");
+#endif
+
+struct ProductInformationBlock {
+ const char *MARChannelID;
+ const char *productVersion;
+};
+
+/**
+ * The MAR item data structure.
+ */
+typedef struct MarItem_ {
+ struct MarItem_ *next; /* private field */
+ uint32_t offset; /* offset into archive */
+ uint32_t length; /* length of data in bytes */
+ uint32_t flags; /* contains file mode bits */
+ char name[1]; /* file path */
+} MarItem;
+
+#define TABLESIZE 256
+
+struct MarFile_ {
+ FILE *fp;
+ MarItem *item_table[TABLESIZE];
+};
+
+typedef struct MarFile_ MarFile;
+
+/**
+ * Signature of callback function passed to mar_enum_items.
+ * @param mar The MAR file being visited.
+ * @param item The MAR item being visited.
+ * @param data The data parameter passed by the caller of mar_enum_items.
+ * @return A non-zero value to stop enumerating.
+ */
+typedef int (* MarItemCallback)(MarFile *mar, const MarItem *item, void *data);
+
+/**
+ * Open a MAR file for reading.
+ * @param path Specifies the path to the MAR file to open. This path must
+ * be compatible with fopen.
+ * @return NULL if an error occurs.
+ */
+MarFile *mar_open(const char *path);
+
+#ifdef _WIN32
+MarFile *mar_wopen(const wchar_t *path);
+#endif
+
+/**
+ * Close a MAR file that was opened using mar_open.
+ * @param mar The MarFile object to close.
+ */
+void mar_close(MarFile *mar);
+
+/**
+ * Find an item in the MAR file by name.
+ * @param mar The MarFile object to query.
+ * @param item The name of the item to query.
+ * @return A const reference to a MAR item or NULL if not found.
+ */
+const MarItem *mar_find_item(MarFile *mar, const char *item);
+
+/**
+ * Enumerate all MAR items via callback function.
+ * @param mar The MAR file to enumerate.
+ * @param callback The function to call for each MAR item.
+ * @param data A caller specified value that is passed along to the
+ * callback function.
+ * @return 0 if the enumeration ran to completion. Otherwise, any
+ * non-zero return value from the callback is returned.
+ */
+int mar_enum_items(MarFile *mar, MarItemCallback callback, void *data);
+
+/**
+ * Read from MAR item at given offset up to bufsize bytes.
+ * @param mar The MAR file to read.
+ * @param item The MAR item to read.
+ * @param offset The byte offset relative to the start of the item.
+ * @param buf A pointer to a buffer to copy the data into.
+ * @param bufsize The length of the buffer to copy the data into.
+ * @return The number of bytes written or a negative value if an
+ * error occurs.
+ */
+int mar_read(MarFile *mar, const MarItem *item, int offset, char *buf,
+ int bufsize);
+
+/**
+ * Create a MAR file from a set of files.
+ * @param dest The path to the file to create. This path must be
+ * compatible with fopen.
+ * @param numfiles The number of files to store in the archive.
+ * @param files The list of null-terminated file paths. Each file
+ * path must be compatible with fopen.
+ * @param infoBlock The information to store in the product information block.
+ * @return A non-zero value if an error occurs.
+ */
+int mar_create(const char *dest,
+ int numfiles,
+ char **files,
+ struct ProductInformationBlock *infoBlock);
+
+/**
+ * Extract a MAR file to the current working directory.
+ * @param path The path to the MAR file to extract. This path must be
+ * compatible with fopen.
+ * @return A non-zero value if an error occurs.
+ */
+int mar_extract(const char *path);
+
+#define MAR_MAX_CERT_SIZE (16*1024) // Way larger than necessary
+
+/* Read the entire file (not a MAR file) into a newly-allocated buffer.
+ * This function does not write to stderr. Instead, the caller should
+ * write whatever error messages it sees fit. The caller must free the returned
+ * buffer using free().
+ *
+ * @param filePath The path to the file that should be read.
+ * @param maxSize The maximum valid file size.
+ * @param data On success, *data will point to a newly-allocated buffer
+ * with the file's contents in it.
+ * @param size On success, *size will be the size of the created buffer.
+ *
+ * @return 0 on success, -1 on error
+ */
+int mar_read_entire_file(const char * filePath,
+ uint32_t maxSize,
+ /*out*/ const uint8_t * *data,
+ /*out*/ uint32_t *size);
+
+/**
+ * Verifies a MAR file by verifying each signature with the corresponding
+ * certificate. That is, the first signature will be verified using the first
+ * certificate given, the second signature will be verified using the second
+ * certificate given, etc. The signature count must exactly match the number of
+ * certificates given, and all signature verifications must succeed.
+ * We do not check that the certificate was issued by any trusted authority.
+ * We assume it to be self-signed. We do not check whether the certificate
+ * is valid for this usage.
+ *
+ * @param mar The already opened MAR file.
+ * @param certData Pointer to the first element in an array of certificate
+ * file data.
+ * @param certDataSizes Pointer to the first element in an array for size of
+ * the cert data.
+ * @param certCount The number of elements in certData and certDataSizes
+ * @return 0 on success
+ * a negative number if there was an error
+ * a positive number if the signature does not verify
+ */
+int mar_verify_signatures(MarFile *mar,
+ const uint8_t * const *certData,
+ const uint32_t *certDataSizes,
+ uint32_t certCount);
+
+/**
+ * Reads the product info block from the MAR file's additional block section.
+ * The caller is responsible for freeing the fields in infoBlock
+ * if the return is successful.
+ *
+ * @param infoBlock Out parameter for where to store the result to
+ * @return 0 on success, -1 on failure
+*/
+int
+mar_read_product_info_block(MarFile *mar,
+ struct ProductInformationBlock *infoBlock);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MAR_H__ */
diff --git a/include/onlineupdate/mar_cmdline.h b/include/onlineupdate/mar_cmdline.h
new file mode 100644
index 000000000..ef6867f06
--- /dev/null
+++ b/include/onlineupdate/mar_cmdline.h
@@ -0,0 +1,110 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef MAR_CMDLINE_H__
+#define MAR_CMDLINE_H__
+
+/* We use NSPR here just to import the definition of uint32_t */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ProductInformationBlock;
+
+/**
+ * Determines MAR file information.
+ *
+ * @param path The path of the MAR file to check.
+ * @param hasSignatureBlock Optional out parameter specifying if the MAR
+ * file has a signature block or not.
+ * @param numSignatures Optional out parameter for storing the number
+ * of signatures in the MAR file.
+ * @param hasAdditionalBlocks Optional out parameter specifying if the MAR
+ * file has additional blocks or not.
+ * @param offsetAdditionalBlocks Optional out parameter for the offset to the
+ * first additional block. Value is only valid if
+ * hasAdditionalBlocks is not equal to 0.
+ * @param numAdditionalBlocks Optional out parameter for the number of
+ * additional blocks. Value is only valid if
+ * has_additional_blocks is not equal to 0.
+ * @return 0 on success and non-zero on failure.
+ */
+int get_mar_file_info(const char *path,
+ int *hasSignatureBlock,
+ uint32_t *numSignatures,
+ int *hasAdditionalBlocks,
+ uint32_t *offsetAdditionalBlocks,
+ uint32_t *numAdditionalBlocks);
+
+/**
+ * Reads the product info block from the MAR file's additional block section.
+ * The caller is responsible for freeing the fields in infoBlock
+ * if the return is successful.
+ *
+ * @param infoBlock Out parameter for where to store the result to
+ * @return 0 on success, -1 on failure
+*/
+int
+read_product_info_block(char *path,
+ struct ProductInformationBlock *infoBlock);
+
+/**
+ * Refreshes the product information block with the new information.
+ * The input MAR must not be signed or the function call will fail.
+ *
+ * @param path The path to the MAR file whose product info block
+ * should be refreshed.
+ * @param infoBlock Out parameter for where to store the result to
+ * @return 0 on success, -1 on failure
+*/
+int
+refresh_product_info_block(const char *path,
+ struct ProductInformationBlock *infoBlock);
+
+/**
+ * Writes out a copy of the MAR at src but with the signature block stripped.
+ *
+ * @param src The path of the source MAR file
+ * @param dest The path of the MAR file to write out that
+ has no signature block
+ * @return 0 on success
+ * -1 on error
+*/
+int
+strip_signature_block(const char *src, const char * dest);
+
+/**
+ * Extracts a signature from a MAR file, base64 encodes it, and writes it out
+ *
+ * @param src The path of the source MAR file
+ * @param sigIndex The index of the signature to extract
+ * @param dest The path of file to write the signature to
+ * @return 0 on success
+ * -1 on error
+*/
+int
+extract_signature(const char *src, uint32_t sigIndex, const char * dest);
+
+/**
+ * Imports a base64 encoded signature into a MAR file
+ *
+ * @param src The path of the source MAR file
+ * @param sigIndex The index of the signature to import
+ * @param base64SigFile A file which contains the signature to import
+ * @param dest The path of the destination MAR file with replaced signature
+ * @return 0 on success
+ * -1 on error
+*/
+int
+import_signature(const char *src,
+ uint32_t sigIndex,
+ const char * base64SigFile,
+ const char *dest);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MAR_CMDLINE_H__ */
diff --git a/include/onlineupdate/mar_private.h b/include/onlineupdate/mar_private.h
new file mode 100644
index 000000000..319564b74
--- /dev/null
+++ b/include/onlineupdate/mar_private.h
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef MAR_PRIVATE_H__
+#define MAR_PRIVATE_H__
+
+#include "limits.h"
+#include "mozilla/Assertions.h"
+#include <stdint.h>
+
+#define BLOCKSIZE 4096
+#define ROUND_UP(n, incr) (((n) / (incr) + 1) * (incr))
+
+#define MAR_ID "MAR1"
+#define MAR_ID_SIZE 4
+
+/* The signature block comes directly after the header block
+ which is 16 bytes */
+#define SIGNATURE_BLOCK_OFFSET 16
+
+/* Make sure the file is less than 500MB. We do this to protect against
+ invalid MAR files. */
+#define MAX_SIZE_OF_MAR_FILE ((int64_t)1824288000)
+
+/* Existing code makes assumptions that the file size is
+ smaller than LONG_MAX. */
+MOZ_STATIC_ASSERT(MAX_SIZE_OF_MAR_FILE < ((int64_t)LONG_MAX),
+ "max mar file size is too big");
+
+/* We store at most the size up to the signature block + 4
+ bytes per BLOCKSIZE bytes */
+MOZ_STATIC_ASSERT(sizeof(BLOCKSIZE) <
+ (SIGNATURE_BLOCK_OFFSET + sizeof(uint32_t)),
+ "BLOCKSIZE is too big");
+
+/* The maximum size of any signature supported by current and future
+ implementations of the signmar program. */
+#define MAX_SIGNATURE_LENGTH 2048
+
+/* Each additional block has a unique ID.
+ The product information block has an ID of 1. */
+#define PRODUCT_INFO_BLOCK_ID 1
+
+#define MAR_ITEM_SIZE(namelen) (3*sizeof(uint32_t) + (namelen) + 1)
+
+/* Product Information Block (PIB) constants */
+#define PIB_MAX_MAR_CHANNEL_ID_SIZE 63
+#define PIB_MAX_PRODUCT_VERSION_SIZE 31
+
+/* The mar program is compiled as a host bin so we don't have access to NSPR at
+ runtime. For that reason we use ntohl, htonl, and define HOST_TO_NETWORK64
+ instead of the NSPR equivalents. */
+#ifdef _WIN32
+#include <winsock2.h>
+#define ftello _ftelli64
+#define fseeko _fseeki64
+#else
+#define _FILE_OFFSET_BITS 64
+#include <netinet/in.h>
+#include <unistd.h>
+#endif
+
+#include <stdio.h>
+
+#define HOST_TO_NETWORK64(x) ( \
+ ((((uint64_t) x) & 0xFF) << 56) | \
+ ((((uint64_t) x) >> 8) & 0xFF) << 48) | \
+ (((((uint64_t) x) >> 16) & 0xFF) << 40) | \
+ (((((uint64_t) x) >> 24) & 0xFF) << 32) | \
+ (((((uint64_t) x) >> 32) & 0xFF) << 24) | \
+ (((((uint64_t) x) >> 40) & 0xFF) << 16) | \
+ (((((uint64_t) x) >> 48) & 0xFF) << 8) | \
+ (((uint64_t) x) >> 56)
+#define NETWORK_TO_HOST64 HOST_TO_NETWORK64
+
+#endif /* MAR_PRIVATE_H__ */
diff --git a/include/onlineupdate/mozilla/Assertions.h b/include/onlineupdate/mozilla/Assertions.h
new file mode 100644
index 000000000..29b4588fd
--- /dev/null
+++ b/include/onlineupdate/mozilla/Assertions.h
@@ -0,0 +1,503 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* Implementations of runtime and static assertion macros for C and C++. */
+
+#ifndef mozilla_Assertions_h
+#define mozilla_Assertions_h
+
+#if defined(MOZILLA_INTERNAL_API) && defined(__cplusplus)
+#define MOZ_DUMP_ASSERTION_STACK
+#endif
+
+#include "Attributes.h"
+#include "Compiler.h"
+#include "Likely.h"
+#include "MacroArgs.h"
+#ifdef MOZ_DUMP_ASSERTION_STACK
+#include "nsTraceRefcnt.h"
+#endif
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _WIN32
+ /*
+ * TerminateProcess and GetCurrentProcess are defined in <winbase.h>, which
+ * further depends on <windef.h>. We hardcode these few definitions manually
+ * because those headers clutter the global namespace with a significant
+ * number of undesired macros and symbols.
+ */
+# ifdef __cplusplus
+extern "C" {
+# endif
+__declspec(dllimport) int __stdcall
+TerminateProcess(void* hProcess, unsigned int uExitCode);
+__declspec(dllimport) void* __stdcall GetCurrentProcess(void);
+# ifdef __cplusplus
+}
+# endif
+#else
+# include <signal.h>
+#endif
+#ifdef ANDROID
+# include <android/log.h>
+#endif
+
+/*
+ * MOZ_STATIC_ASSERT may be used to assert a condition *at compile time* in C.
+ * In C++11, static_assert is provided by the compiler to the same effect.
+ * This can be useful when you make certain assumptions about what must hold for
+ * optimal, or even correct, behavior. For example, you might assert that the
+ * size of a struct is a multiple of the target architecture's word size:
+ *
+ * struct S { ... };
+ * // C
+ * MOZ_STATIC_ASSERT(sizeof(S) % sizeof(size_t) == 0,
+ * "S should be a multiple of word size for efficiency");
+ * // C++11
+ * static_assert(sizeof(S) % sizeof(size_t) == 0,
+ * "S should be a multiple of word size for efficiency");
+ *
+ * This macro can be used in any location where both an extern declaration and a
+ * typedef could be used.
+ */
+#ifndef __cplusplus
+ /*
+ * Some of the definitions below create an otherwise-unused typedef. This
+ * triggers compiler warnings with some versions of gcc, so mark the typedefs
+ * as permissibly-unused to disable the warnings.
+ */
+# if defined(__GNUC__)
+# define MOZ_STATIC_ASSERT_UNUSED_ATTRIBUTE __attribute__((unused))
+# else
+# define MOZ_STATIC_ASSERT_UNUSED_ATTRIBUTE /* nothing */
+# endif
+# define MOZ_STATIC_ASSERT_GLUE1(x, y) x##y
+# define MOZ_STATIC_ASSERT_GLUE(x, y) MOZ_STATIC_ASSERT_GLUE1(x, y)
+# if defined(__SUNPRO_CC)
+ /*
+ * The Sun Studio C++ compiler is buggy when declaring, inside a function,
+ * another extern'd function with an array argument whose length contains a
+ * sizeof, triggering the error message "sizeof expression not accepted as
+ * size of array parameter". This bug (6688515, not public yet) would hit
+ * defining moz_static_assert as a function, so we always define an extern
+ * array for Sun Studio.
+ *
+ * We include the line number in the symbol name in a best-effort attempt
+ * to avoid conflicts (see below).
+ */
+# define MOZ_STATIC_ASSERT(cond, reason) \
+ extern char MOZ_STATIC_ASSERT_GLUE(moz_static_assert, __LINE__)[(cond) ? 1 : -1]
+# elif defined(__COUNTER__)
+ /*
+ * If there was no preferred alternative, use a compiler-agnostic version.
+ *
+ * Note that the non-__COUNTER__ version has a bug in C++: it can't be used
+ * in both |extern "C"| and normal C++ in the same translation unit. (Alas
+ * |extern "C"| isn't allowed in a function.) The only affected compiler
+ * we really care about is gcc 4.2. For that compiler and others like it,
+ * we include the line number in the function name to do the best we can to
+ * avoid conflicts. These should be rare: a conflict would require use of
+ * MOZ_STATIC_ASSERT on the same line in separate files in the same
+ * translation unit, *and* the uses would have to be in code with
+ * different linkage, *and* the first observed use must be in C++-linkage
+ * code.
+ */
+# define MOZ_STATIC_ASSERT(cond, reason) \
+ typedef int MOZ_STATIC_ASSERT_GLUE(moz_static_assert, __COUNTER__)[(cond) ? 1 : -1] MOZ_STATIC_ASSERT_UNUSED_ATTRIBUTE
+# else
+# define MOZ_STATIC_ASSERT(cond, reason) \
+ extern void MOZ_STATIC_ASSERT_GLUE(moz_static_assert, __LINE__)(int arg[(cond) ? 1 : -1]) MOZ_STATIC_ASSERT_UNUSED_ATTRIBUTE
+# endif
+
+#define MOZ_STATIC_ASSERT_IF(cond, expr, reason) MOZ_STATIC_ASSERT(!(cond) || (expr), reason)
+#else
+#define MOZ_STATIC_ASSERT_IF(cond, expr, reason) static_assert(!(cond) || (expr), reason)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Prints |aStr| as an assertion failure (using aFilename and aLine as the
+ * location of the assertion) to the standard debug-output channel.
+ *
+ * Usually you should use MOZ_ASSERT or MOZ_CRASH instead of this method. This
+ * method is primarily for internal use in this header, and only secondarily
+ * for use in implementing release-build assertions.
+ */
+static MOZ_COLD MOZ_ALWAYS_INLINE void
+MOZ_ReportAssertionFailure(const char* aStr, const char* aFilename, int aLine)
+ MOZ_PRETEND_NORETURN_FOR_STATIC_ANALYSIS
+{
+#ifdef ANDROID
+ __android_log_print(ANDROID_LOG_FATAL, "MOZ_Assert",
+ "Assertion failure: %s, at %s:%d\n",
+ aStr, aFilename, aLine);
+#else
+ fprintf(stderr, "Assertion failure: %s, at %s:%d\n", aStr, aFilename, aLine);
+#if defined (MOZ_DUMP_ASSERTION_STACK) && !defined(MOZILLA_XPCOMRT_API)
+ nsTraceRefcnt::WalkTheStack(stderr);
+#endif
+ fflush(stderr);
+#endif
+}
+
+static MOZ_COLD MOZ_ALWAYS_INLINE void
+MOZ_ReportCrash(const char* aStr, const char* aFilename, int aLine)
+ MOZ_PRETEND_NORETURN_FOR_STATIC_ANALYSIS
+{
+#ifdef ANDROID
+ __android_log_print(ANDROID_LOG_FATAL, "MOZ_CRASH",
+ "Hit MOZ_CRASH(%s) at %s:%d\n", aStr, aFilename, aLine);
+#else
+ fprintf(stderr, "Hit MOZ_CRASH(%s) at %s:%d\n", aStr, aFilename, aLine);
+#if defined(MOZ_DUMP_ASSERTION_STACK) && !defined(MOZILLA_XPCOMRT_API)
+ nsTraceRefcnt::WalkTheStack(stderr);
+#endif
+ fflush(stderr);
+#endif
+}
+
+/**
+ * MOZ_REALLY_CRASH is used in the implementation of MOZ_CRASH(). You should
+ * call MOZ_CRASH instead.
+ */
+#if defined(_MSC_VER)
+ /*
+ * On MSVC use the __debugbreak compiler intrinsic, which produces an inline
+ * (not nested in a system function) breakpoint. This distinctively invokes
+ * Breakpad without requiring system library symbols on all stack-processing
+ * machines, as a nested breakpoint would require.
+ *
+ * We use TerminateProcess with the exit code aborting would generate
+ * because we don't want to invoke atexit handlers, destructors, library
+ * unload handlers, and so on when our process might be in a compromised
+ * state.
+ *
+ * We don't use abort() because it'd cause Windows to annoyingly pop up the
+ * process error dialog multiple times. See bug 345118 and bug 426163.
+ *
+ * We follow TerminateProcess() with a call to MOZ_NoReturn() so that the
+ * compiler doesn't hassle us to provide a return statement after a
+ * MOZ_REALLY_CRASH() call.
+ *
+ * (Technically these are Windows requirements, not MSVC requirements. But
+ * practically you need MSVC for debugging, and we only ship builds created
+ * by MSVC, so doing it this way reduces complexity.)
+ */
+
+__declspec(noreturn) __inline void MOZ_NoReturn() {}
+
+# ifdef __cplusplus
+# define MOZ_REALLY_CRASH() \
+ do { \
+ ::__debugbreak(); \
+ *((volatile int*) NULL) = __LINE__; \
+ ::TerminateProcess(::GetCurrentProcess(), 3); \
+ ::MOZ_NoReturn(); \
+ } while (0)
+# else
+# define MOZ_REALLY_CRASH() \
+ do { \
+ __debugbreak(); \
+ *((volatile int*) NULL) = __LINE__; \
+ TerminateProcess(GetCurrentProcess(), 3); \
+ MOZ_NoReturn(); \
+ } while (0)
+# endif
+#else
+# ifdef __cplusplus
+# define MOZ_REALLY_CRASH() \
+ do { \
+ *((volatile int*) NULL) = __LINE__; \
+ ::abort(); \
+ } while (0)
+# else
+# define MOZ_REALLY_CRASH() \
+ do { \
+ *((volatile int*) NULL) = __LINE__; \
+ abort(); \
+ } while (0)
+# endif
+#endif
+
+/*
+ * MOZ_CRASH([explanation-string]) crashes the program, plain and simple, in a
+ * Breakpad-compatible way, in both debug and release builds.
+ *
+ * MOZ_CRASH is a good solution for "handling" failure cases when you're
+ * unwilling or unable to handle them more cleanly -- for OOM, for likely memory
+ * corruption, and so on. It's also a good solution if you need safe behavior
+ * in release builds as well as debug builds. But if the failure is one that
+ * should be debugged and fixed, MOZ_ASSERT is generally preferable.
+ *
+ * The optional explanation-string, if provided, must be a string literal
+ * explaining why we're crashing. This argument is intended for use with
+ * MOZ_CRASH() calls whose rationale is non-obvious; don't use it if it's
+ * obvious why we're crashing.
+ *
+ * If we're a DEBUG build and we crash at a MOZ_CRASH which provides an
+ * explanation-string, we print the string to stderr. Otherwise, we don't
+ * print anything; this is because we want MOZ_CRASH to be 100% safe in release
+ * builds, and it's hard to print to stderr safely when memory might have been
+ * corrupted.
+ */
+#ifndef DEBUG
+# define MOZ_CRASH(...) MOZ_REALLY_CRASH()
+#else
+# define MOZ_CRASH(...) \
+ do { \
+ MOZ_ReportCrash("" __VA_ARGS__, __FILE__, __LINE__); \
+ MOZ_REALLY_CRASH(); \
+ } while (0)
+#endif
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+/*
+ * MOZ_ASSERT(expr [, explanation-string]) asserts that |expr| must be truthy in
+ * debug builds. If it is, execution continues. Otherwise, an error message
+ * including the expression and the explanation-string (if provided) is printed,
+ * an attempt is made to invoke any existing debugger, and execution halts.
+ * MOZ_ASSERT is fatal: no recovery is possible. Do not assert a condition
+ * which can correctly be falsy.
+ *
+ * The optional explanation-string, if provided, must be a string literal
+ * explaining the assertion. It is intended for use with assertions whose
+ * correctness or rationale is non-obvious, and for assertions where the "real"
+ * condition being tested is best described prosaically. Don't provide an
+ * explanation if it's not actually helpful.
+ *
+ * // No explanation needed: pointer arguments often must not be NULL.
+ * MOZ_ASSERT(arg);
+ *
+ * // An explanation can be helpful to explain exactly how we know an
+ * // assertion is valid.
+ * MOZ_ASSERT(state == WAITING_FOR_RESPONSE,
+ * "given that <thingA> and <thingB>, we must have...");
+ *
+ * // Or it might disambiguate multiple identical (save for their location)
+ * // assertions of the same expression.
+ * MOZ_ASSERT(getSlot(PRIMITIVE_THIS_SLOT).isUndefined(),
+ * "we already set [[PrimitiveThis]] for this Boolean object");
+ * MOZ_ASSERT(getSlot(PRIMITIVE_THIS_SLOT).isUndefined(),
+ * "we already set [[PrimitiveThis]] for this String object");
+ *
+ * MOZ_ASSERT has no effect in non-debug builds. It is designed to catch bugs
+ * *only* during debugging, not "in the field". If you want the latter, use
+ * MOZ_RELEASE_ASSERT, which applies to non-debug builds as well.
+ *
+ * MOZ_DIAGNOSTIC_ASSERT works like MOZ_RELEASE_ASSERT in Nightly/Aurora and
+ * MOZ_ASSERT in Beta/Release - use this when a condition is potentially rare
+ * enough to require real user testing to hit, but is not security-sensitive.
+ * This can cause user pain, so use it sparingly. If a MOZ_DIAGNOSTIC_ASSERT
+ * is firing, it should promptly be converted to a MOZ_ASSERT while the failure
+ * is being investigated, rather than letting users suffer.
+ */
+
+/*
+ * Implement MOZ_VALIDATE_ASSERT_CONDITION_TYPE, which is used to guard against
+ * accidentally passing something unintended in lieu of an assertion condition.
+ */
+
+#ifdef __cplusplus
+# include "TypeTraits.h"
+namespace mozilla {
+namespace detail {
+
+template<typename T>
+struct IsFunction
+{
+ static const bool value = false;
+};
+
+template<typename R, typename... A>
+struct IsFunction<R(A...)>
+{
+ static const bool value = true;
+};
+
+template<typename T>
+struct AssertionConditionType
+{
+ typedef typename RemoveReference<T>::Type ValueT;
+ static_assert(!IsArray<ValueT>::value,
+ "Expected boolean assertion condition, got an array or a "
+ "string!");
+ static_assert(!IsFunction<ValueT>::value,
+ "Expected boolean assertion condition, got a function! Did "
+ "you intend to call that function?");
+ static_assert(!IsFloatingPoint<ValueT>::value,
+ "It's often a bad idea to assert that a floating-point number "
+ "is nonzero, because such assertions tend to intermittently "
+ "fail. Shouldn't your code gracefully handle this case instead "
+ "of asserting? Anyway, if you really want to do that, write an "
+ "explicit boolean condition, like !!x or x!=0.");
+
+ static const bool isValid = true;
+};
+
+} // namespace detail
+} // namespace mozilla
+# define MOZ_VALIDATE_ASSERT_CONDITION_TYPE(x) \
+ static_assert(mozilla::detail::AssertionConditionType<decltype(x)>::isValid, \
+ "invalid assertion condition")
+#else
+# define MOZ_VALIDATE_ASSERT_CONDITION_TYPE(x)
+#endif
+
+/* First the single-argument form. */
+#define MOZ_ASSERT_HELPER1(expr) \
+ do { \
+ MOZ_VALIDATE_ASSERT_CONDITION_TYPE(expr); \
+ if (MOZ_UNLIKELY(!(expr))) { \
+ MOZ_ReportAssertionFailure(#expr, __FILE__, __LINE__); \
+ MOZ_REALLY_CRASH(); \
+ } \
+ } while (0)
+/* Now the two-argument form. */
+#define MOZ_ASSERT_HELPER2(expr, explain) \
+ do { \
+ MOZ_VALIDATE_ASSERT_CONDITION_TYPE(expr); \
+ if (MOZ_UNLIKELY(!(expr))) { \
+ MOZ_ReportAssertionFailure(#expr " (" explain ")", __FILE__, __LINE__); \
+ MOZ_REALLY_CRASH(); \
+ } \
+ } while (0)
+
+#define MOZ_RELEASE_ASSERT_GLUE(a, b) a b
+#define MOZ_RELEASE_ASSERT(...) \
+ MOZ_RELEASE_ASSERT_GLUE( \
+ MOZ_PASTE_PREFIX_AND_ARG_COUNT(MOZ_ASSERT_HELPER, __VA_ARGS__), \
+ (__VA_ARGS__))
+
+#ifdef DEBUG
+# define MOZ_ASSERT(...) MOZ_RELEASE_ASSERT(__VA_ARGS__)
+#else
+# define MOZ_ASSERT(...) do { } while (0)
+#endif /* DEBUG */
+
+#ifdef RELEASE_BUILD
+# define MOZ_DIAGNOSTIC_ASSERT MOZ_ASSERT
+#else
+# define MOZ_DIAGNOSTIC_ASSERT MOZ_RELEASE_ASSERT
+#endif
+
+/*
+ * MOZ_ASSERT_IF(cond1, cond2) is equivalent to MOZ_ASSERT(cond2) if cond1 is
+ * true.
+ *
+ * MOZ_ASSERT_IF(isPrime(num), num == 2 || isOdd(num));
+ *
+ * As with MOZ_ASSERT, MOZ_ASSERT_IF has effect only in debug builds. It is
+ * designed to catch bugs during debugging, not "in the field".
+ */
+#ifdef DEBUG
+# define MOZ_ASSERT_IF(cond, expr) \
+ do { \
+ if (cond) { \
+ MOZ_ASSERT(expr); \
+ } \
+ } while (0)
+#else
+# define MOZ_ASSERT_IF(cond, expr) do { } while (0)
+#endif
+
+/*
+ * MOZ_ASSUME_UNREACHABLE_MARKER() expands to an expression which states that
+ * it is undefined behavior for execution to reach this point. No guarantees
+ * are made about what will happen if this is reached at runtime. Most code
+ * should use MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE because it has extra
+ * asserts.
+ */
+#if defined(__clang__) || defined(__GNUC__)
+# define MOZ_ASSUME_UNREACHABLE_MARKER() __builtin_unreachable()
+#elif defined(_MSC_VER)
+# define MOZ_ASSUME_UNREACHABLE_MARKER() __assume(0)
+#else
+# ifdef __cplusplus
+# define MOZ_ASSUME_UNREACHABLE_MARKER() ::abort()
+# else
+# define MOZ_ASSUME_UNREACHABLE_MARKER() abort()
+# endif
+#endif
+
+/*
+ * MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE([reason]) tells the compiler that it
+ * can assume that the macro call cannot be reached during execution. This lets
+ * the compiler generate better-optimized code under some circumstances, at the
+ * expense of the program's behavior being undefined if control reaches the
+ * MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE.
+ *
+ * In Gecko, you probably should not use this macro outside of performance- or
+ * size-critical code, because it's unsafe. If you don't care about code size
+ * or performance, you should probably use MOZ_ASSERT or MOZ_CRASH.
+ *
+ * SpiderMonkey is a different beast, and there it's acceptable to use
+ * MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE more widely.
+ *
+ * Note that MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE is noreturn, so it's valid
+ * not to return a value following a MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE
+ * call.
+ *
+ * Example usage:
+ *
+ * enum ValueType {
+ * VALUE_STRING,
+ * VALUE_INT,
+ * VALUE_FLOAT
+ * };
+ *
+ * int ptrToInt(ValueType type, void* value) {
+ * {
+ * // We know for sure that type is either INT or FLOAT, and we want this
+ * // code to run as quickly as possible.
+ * switch (type) {
+ * case VALUE_INT:
+ * return *(int*) value;
+ * case VALUE_FLOAT:
+ * return (int) *(float*) value;
+ * default:
+ * MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("Unexpected ValueType");
+ * }
+ * }
+ */
+
+/*
+ * Unconditional assert in debug builds for (assumed) unreachable code paths
+ * that have a safe return without crashing in release builds.
+ */
+#define MOZ_ASSERT_UNREACHABLE(reason) \
+ MOZ_ASSERT(false, "MOZ_ASSERT_UNREACHABLE: " reason)
+
+#define MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE(reason) \
+ do { \
+ MOZ_ASSERT_UNREACHABLE(reason); \
+ MOZ_ASSUME_UNREACHABLE_MARKER(); \
+ } while (0)
+
+/*
+ * MOZ_ALWAYS_TRUE(expr) and MOZ_ALWAYS_FALSE(expr) always evaluate the provided
+ * expression, in debug builds and in release builds both. Then, in debug
+ * builds only, the value of the expression is asserted either true or false
+ * using MOZ_ASSERT.
+ */
+#ifdef DEBUG
+# define MOZ_ALWAYS_TRUE(expr) MOZ_ASSERT((expr))
+# define MOZ_ALWAYS_FALSE(expr) MOZ_ASSERT(!(expr))
+#else
+# define MOZ_ALWAYS_TRUE(expr) ((void)(expr))
+# define MOZ_ALWAYS_FALSE(expr) ((void)(expr))
+#endif
+
+#undef MOZ_DUMP_ASSERTION_STACK
+
+#endif /* mozilla_Assertions_h */
diff --git a/include/onlineupdate/mozilla/Attributes.h b/include/onlineupdate/mozilla/Attributes.h
new file mode 100644
index 000000000..74b77a38d
--- /dev/null
+++ b/include/onlineupdate/mozilla/Attributes.h
@@ -0,0 +1,481 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* Implementations of various class and method modifier attributes. */
+
+#ifndef mozilla_Attributes_h
+#define mozilla_Attributes_h
+
+#include "Compiler.h"
+
+/*
+ * MOZ_ALWAYS_INLINE is a macro which expands to tell the compiler that the
+ * method decorated with it must be inlined, even if the compiler thinks
+ * otherwise. This is only a (much) stronger version of the inline hint:
+ * compilers are not guaranteed to respect it (although they're much more likely
+ * to do so).
+ *
+ * The MOZ_ALWAYS_INLINE_EVEN_DEBUG macro is yet stronger. It tells the
+ * compiler to inline even in DEBUG builds. It should be used very rarely.
+ */
+#if defined(_MSC_VER)
+# define MOZ_ALWAYS_INLINE_EVEN_DEBUG __forceinline
+#elif defined(__GNUC__)
+# define MOZ_ALWAYS_INLINE_EVEN_DEBUG __attribute__((always_inline)) inline
+#else
+# define MOZ_ALWAYS_INLINE_EVEN_DEBUG inline
+#endif
+
+#if !defined(DEBUG)
+# define MOZ_ALWAYS_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG
+#elif defined(_MSC_VER) && !defined(__cplusplus)
+# define MOZ_ALWAYS_INLINE __inline
+#else
+# define MOZ_ALWAYS_INLINE inline
+#endif
+
+#if defined(_MSC_VER)
+/*
+ * g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality
+ * without warnings (functionality used by the macros below). These modes are
+ * detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or, more
+ * standardly, by checking whether __cplusplus has a C++11 or greater value.
+ * Current versions of g++ do not correctly set __cplusplus, so we check both
+ * for forward compatibility.
+ *
+ * Even though some versions of MSVC support explicit conversion operators, we
+ * don't indicate support for them here, due to
+ * http://stackoverflow.com/questions/20498142/visual-studio-2013-explicit-keyword-bug
+ */
+# define MOZ_HAVE_NEVER_INLINE __declspec(noinline)
+# define MOZ_HAVE_NORETURN __declspec(noreturn)
+# ifdef __clang__
+ /* clang-cl probably supports constexpr and explicit conversions. */
+# if __has_extension(cxx_constexpr)
+# define MOZ_HAVE_CXX11_CONSTEXPR
+# endif
+# if __has_extension(cxx_explicit_conversions)
+# define MOZ_HAVE_EXPLICIT_CONVERSION
+# endif
+# endif
+#elif defined(__clang__)
+ /*
+ * Per Clang documentation, "Note that marketing version numbers should not
+ * be used to check for language features, as different vendors use different
+ * numbering schemes. Instead, use the feature checking macros."
+ */
+# ifndef __has_extension
+# define __has_extension __has_feature /* compatibility, for older versions of clang */
+# endif
+# if __has_extension(cxx_constexpr)
+# define MOZ_HAVE_CXX11_CONSTEXPR
+# endif
+# if __has_extension(cxx_explicit_conversions)
+# define MOZ_HAVE_EXPLICIT_CONVERSION
+# endif
+# if __has_attribute(noinline)
+# define MOZ_HAVE_NEVER_INLINE __attribute__((noinline))
+# endif
+# if __has_attribute(noreturn)
+# define MOZ_HAVE_NORETURN __attribute__((noreturn))
+# endif
+#elif defined(__GNUC__)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L)
+# define MOZ_HAVE_CXX11_CONSTEXPR
+# if MOZ_GCC_VERSION_AT_LEAST(4, 8, 0)
+# define MOZ_HAVE_CXX11_CONSTEXPR_IN_TEMPLATES
+# endif
+# define MOZ_HAVE_EXPLICIT_CONVERSION
+# endif
+# define MOZ_HAVE_NEVER_INLINE __attribute__((noinline))
+# define MOZ_HAVE_NORETURN __attribute__((noreturn))
+#endif
+
+/*
+ * When built with clang analyzer (a.k.a scan-build), define MOZ_HAVE_NORETURN
+ * to mark some false positives
+ */
+#ifdef __clang_analyzer__
+# if __has_extension(attribute_analyzer_noreturn)
+# define MOZ_HAVE_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
+# endif
+#endif
+
+/*
+ * The MOZ_CONSTEXPR specifier declares that a C++11 compiler can evaluate a
+ * function at compile time. A constexpr function cannot examine any values
+ * except its arguments and can have no side effects except its return value.
+ * The MOZ_CONSTEXPR_VAR specifier tells a C++11 compiler that a variable's
+ * value may be computed at compile time. It should be preferred to just
+ * marking variables as MOZ_CONSTEXPR because if the compiler does not support
+ * constexpr it will fall back to making the variable const, and some compilers
+ * do not accept variables being marked both const and constexpr.
+ */
+#ifdef MOZ_HAVE_CXX11_CONSTEXPR
+# define MOZ_CONSTEXPR constexpr
+# define MOZ_CONSTEXPR_VAR constexpr
+# ifdef MOZ_HAVE_CXX11_CONSTEXPR_IN_TEMPLATES
+# define MOZ_CONSTEXPR_TMPL constexpr
+# else
+# define MOZ_CONSTEXPR_TMPL
+# endif
+#else
+# define MOZ_CONSTEXPR /* no support */
+# define MOZ_CONSTEXPR_VAR const
+# define MOZ_CONSTEXPR_TMPL
+#endif
+
+/*
+ * MOZ_EXPLICIT_CONVERSION is a specifier on a type conversion
+ * overloaded operator that declares that a C++11 compiler should restrict
+ * this operator to allow only explicit type conversions, disallowing
+ * implicit conversions.
+ *
+ * Example:
+ *
+ * template<typename T>
+ * class Ptr
+ * {
+ * T* mPtr;
+ * MOZ_EXPLICIT_CONVERSION operator bool() const
+ * {
+ * return mPtr != nullptr;
+ * }
+ * };
+ *
+ */
+#ifdef MOZ_HAVE_EXPLICIT_CONVERSION
+# define MOZ_EXPLICIT_CONVERSION explicit
+#else
+# define MOZ_EXPLICIT_CONVERSION /* no support */
+#endif
+
+/*
+ * MOZ_NEVER_INLINE is a macro which expands to tell the compiler that the
+ * method decorated with it must never be inlined, even if the compiler would
+ * otherwise choose to inline the method. Compilers aren't absolutely
+ * guaranteed to support this, but most do.
+ */
+#if defined(MOZ_HAVE_NEVER_INLINE)
+# define MOZ_NEVER_INLINE MOZ_HAVE_NEVER_INLINE
+#else
+# define MOZ_NEVER_INLINE /* no support */
+#endif
+
+/*
+ * MOZ_NORETURN, specified at the start of a function declaration, indicates
+ * that the given function does not return. (The function definition does not
+ * need to be annotated.)
+ *
+ * MOZ_NORETURN void abort(const char* msg);
+ *
+ * This modifier permits the compiler to optimize code assuming a call to such a
+ * function will never return. It also enables the compiler to avoid spurious
+ * warnings about not initializing variables, or about any other seemingly-dodgy
+ * operations performed after the function returns.
+ *
+ * This modifier does not affect the corresponding function's linking behavior.
+ */
+#if defined(MOZ_HAVE_NORETURN)
+# define MOZ_NORETURN MOZ_HAVE_NORETURN
+#else
+# define MOZ_NORETURN /* no support */
+#endif
+
+/**
+ * MOZ_COLD tells the compiler that a function is "cold", meaning infrequently
+ * executed. This may lead it to optimize for size more aggressively than speed,
+ * or to allocate the body of the function in a distant part of the text segment
+ * to help keep it from taking up unnecessary icache when it isn't in use.
+ *
+ * Place this attribute at the very beginning of a function definition. For
+ * example, write
+ *
+ * MOZ_COLD int foo();
+ *
+ * or
+ *
+ * MOZ_COLD int foo() { return 42; }
+ */
+#if defined(__GNUC__) || defined(__clang__)
+# define MOZ_COLD __attribute__ ((cold))
+#else
+# define MOZ_COLD
+#endif
+
+/**
+ * MOZ_NONNULL tells the compiler that some of the arguments to a function are
+ * known to be non-null. The arguments are a list of 1-based argument indexes
+ * identifying arguments which are known to be non-null.
+ *
+ * Place this attribute at the very beginning of a function definition. For
+ * example, write
+ *
+ * MOZ_NONNULL(1, 2) int foo(char *p, char *q);
+ */
+#if defined(__GNUC__) || defined(__clang__)
+# define MOZ_NONNULL(...) __attribute__ ((nonnull(__VA_ARGS__)))
+#else
+# define MOZ_NONNULL(...)
+#endif
+
+/*
+ * MOZ_PRETEND_NORETURN_FOR_STATIC_ANALYSIS, specified at the end of a function
+ * declaration, indicates that for the purposes of static analysis, this
+ * function does not return. (The function definition does not need to be
+ * annotated.)
+ *
+ * MOZ_ReportCrash(const char* s, const char* file, int ln)
+ * MOZ_PRETEND_NORETURN_FOR_STATIC_ANALYSIS
+ *
+ * Some static analyzers, like scan-build from clang, can use this information
+ * to eliminate false positives. From the upstream documentation of scan-build:
+ * "This attribute is useful for annotating assertion handlers that actually
+ * can return, but for the purpose of using the analyzer we want to pretend
+ * that such functions do not return."
+ *
+ */
+#if defined(MOZ_HAVE_ANALYZER_NORETURN)
+# define MOZ_PRETEND_NORETURN_FOR_STATIC_ANALYSIS MOZ_HAVE_ANALYZER_NORETURN
+#else
+# define MOZ_PRETEND_NORETURN_FOR_STATIC_ANALYSIS /* no support */
+#endif
+
+/*
+ * MOZ_ASAN_DENYLIST is a macro to tell AddressSanitizer (a compile-time
+ * instrumentation shipped with Clang and GCC) to not instrument the annotated
+ * function. Furthermore, it will prevent the compiler from inlining the
+ * function because inlining currently breaks the denylisting mechanism of
+ * AddressSanitizer.
+ */
+#if defined(__has_feature)
+# if __has_feature(address_sanitizer)
+# define MOZ_HAVE_ASAN_DENYLIST
+# endif
+#elif defined(__GNUC__)
+# if defined(__SANITIZE_ADDRESS__)
+# define MOZ_HAVE_ASAN_DENYLIST
+# endif
+#endif
+
+#if defined(MOZ_HAVE_ASAN_DENYLIST)
+# define MOZ_ASAN_DENYLIST MOZ_NEVER_INLINE __attribute__((no_sanitize_address))
+#else
+# define MOZ_ASAN_DENYLIST /* nothing */
+#endif
+
+/*
+ * MOZ_TSAN_DENYLIST is a macro to tell ThreadSanitizer (a compile-time
+ * instrumentation shipped with Clang) to not instrument the annotated function.
+ * Furthermore, it will prevent the compiler from inlining the function because
+ * inlining currently breaks the denylisting mechanism of ThreadSanitizer.
+ */
+#if defined(__has_feature)
+# if __has_feature(thread_sanitizer)
+# define MOZ_TSAN_DENYLIST MOZ_NEVER_INLINE __attribute__((no_sanitize_thread))
+# else
+# define MOZ_TSAN_DENYLIST /* nothing */
+# endif
+#else
+# define MOZ_TSAN_DENYLIST /* nothing */
+#endif
+
+/**
+ * MOZ_ALLOCATOR tells the compiler that the function it marks returns either a
+ * "fresh", "pointer-free" block of memory, or nullptr. "Fresh" means that the
+ * block is not pointed to by any other reachable pointer in the program.
+ * "Pointer-free" means that the block contains no pointers to any valid object
+ * in the program. It may be initialized with other (non-pointer) values.
+ *
+ * Placing this attribute on appropriate functions helps GCC analyze pointer
+ * aliasing more accurately in their callers.
+ *
+ * GCC warns if a caller ignores the value returned by a function marked with
+ * MOZ_ALLOCATOR: it is hard to imagine cases where dropping the value returned
+ * by a function that meets the criteria above would be intentional.
+ *
+ * Place this attribute after the argument list and 'this' qualifiers of a
+ * function definition. For example, write
+ *
+ * void *my_allocator(size_t) MOZ_ALLOCATOR;
+ *
+ * or
+ *
+ * void *my_allocator(size_t bytes) MOZ_ALLOCATOR { ... }
+ */
+#if defined(__GNUC__) || defined(__clang__)
+# define MOZ_ALLOCATOR __attribute__ ((malloc, warn_unused_result))
+#else
+# define MOZ_ALLOCATOR
+#endif
+
+/**
+ * MOZ_WARN_UNUSED_RESULT tells the compiler to emit a warning if a function's
+ * return value is not used by the caller.
+ *
+ * Place this attribute at the very beginning of a function definition. For
+ * example, write
+ *
+ * MOZ_WARN_UNUSED_RESULT int foo();
+ *
+ * or
+ *
+ * MOZ_WARN_UNUSED_RESULT int foo() { return 42; }
+ */
+#if defined(__GNUC__) || defined(__clang__)
+# define MOZ_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
+#else
+# define MOZ_WARN_UNUSED_RESULT
+#endif
+
+#ifdef __cplusplus
+
+/*
+ * The following macros are attributes that support the static analysis plugin
+ * included with Mozilla, and will be implemented (when such support is enabled)
+ * as C++11 attributes. Since such attributes are legal pretty much everywhere
+ * and have subtly different semantics depending on their placement, the
+ * following is a guide on where to place the attributes.
+ *
+ * Attributes that apply to a struct or class precede the name of the class:
+ * (Note that this is different from the placement of final for classes!)
+ *
+ * class MOZ_CLASS_ATTRIBUTE SomeClass {};
+ *
+ * Attributes that apply to functions follow the parentheses and const
+ * qualifiers but precede final, override and the function body:
+ *
+ * void DeclaredFunction() MOZ_FUNCTION_ATTRIBUTE;
+ * void SomeFunction() MOZ_FUNCTION_ATTRIBUTE {}
+ * void PureFunction() const MOZ_FUNCTION_ATTRIBUTE = 0;
+ * void OverriddenFunction() MOZ_FUNCTION_ATTRIBUTE override;
+ *
+ * Attributes that apply to variables or parameters follow the variable's name:
+ *
+ * int variable MOZ_VARIABLE_ATTRIBUTE;
+ *
+ * Attributes that apply to types follow the type name:
+ *
+ * typedef int MOZ_TYPE_ATTRIBUTE MagicInt;
+ * int MOZ_TYPE_ATTRIBUTE someVariable;
+ * int* MOZ_TYPE_ATTRIBUTE magicPtrInt;
+ * int MOZ_TYPE_ATTRIBUTE* ptrToMagicInt;
+ *
+ * Attributes that apply to statements precede the statement:
+ *
+ * MOZ_IF_ATTRIBUTE if (x == 0)
+ * MOZ_DO_ATTRIBUTE do { } while (0);
+ *
+ * Attributes that apply to labels precede the label:
+ *
+ * MOZ_LABEL_ATTRIBUTE target:
+ * goto target;
+ * MOZ_CASE_ATTRIBUTE case 5:
+ * MOZ_DEFAULT_ATTRIBUTE default:
+ *
+ * The static analyses that are performed by the plugin are as follows:
+ *
+ * MOZ_MUST_OVERRIDE: Applies to all C++ member functions. All immediate
+ * subclasses must provide an exact override of this method; if a subclass
+ * does not override this method, the compiler will emit an error. This
+ * attribute is not limited to virtual methods, so if it is applied to a
+ * nonvirtual method and the subclass does not provide an equivalent
+ * definition, the compiler will emit an error.
+ * MOZ_STACK_CLASS: Applies to all classes. Any class with this annotation is
+ * expected to live on the stack, so it is a compile-time error to use it, or
+ * an array of such objects, as a global or static variable, or as the type of
+ * a new expression (unless placement new is being used). If a member of
+ * another class uses this class, or if another class inherits from this
+ * class, then it is considered to be a stack class as well, although this
+ * attribute need not be provided in such cases.
+ * MOZ_NONHEAP_CLASS: Applies to all classes. Any class with this annotation is
+ * expected to live on the stack or in static storage, so it is a compile-time
+ * error to use it, or an array of such objects, as the type of a new
+ * expression (unless placement new is being used). If a member of another
+ * class uses this class, or if another class inherits from this class, then
+ * it is considered to be a non-heap class as well, although this attribute
+ * need not be provided in such cases.
+ * MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS: Applies to all classes that are
+ * intended to prevent introducing static initializers. This attribute
+ * currently makes it a compile-time error to instantiate these classes
+ * anywhere other than at the global scope, or as a static member of a class.
+ * MOZ_TRIVIAL_CTOR_DTOR: Applies to all classes that must have both a trivial
+ * constructor and a trivial destructor. Setting this attribute on a class
+ * makes it a compile-time error for that class to get a non-trivial
+ * constructor or destructor for any reason.
+ * MOZ_HEAP_ALLOCATOR: Applies to any function. This indicates that the return
+ * value is allocated on the heap, and will as a result check such allocations
+ * during MOZ_STACK_CLASS and MOZ_NONHEAP_CLASS annotation checking.
+ * MOZ_IMPLICIT: Applies to constructors. Implicit conversion constructors
+ * are disallowed by default unless they are marked as MOZ_IMPLICIT. This
+ * attribute must be used for constructors which intend to provide implicit
+ * conversions.
+ * MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT: Applies to functions. Makes it a compile
+ * time error to pass arithmetic expressions on variables to the function.
+ * MOZ_OWNING_REF: Applies to declarations of pointer types. This attribute
+ * tells the compiler that the raw pointer is a strong reference, and that
+ * property is somehow enforced by the code. This can make the compiler
+ * ignore these pointers when validating the usage of pointers otherwise.
+ * MOZ_NON_OWNING_REF: Applies to declarations of pointer types. This attribute
+ * tells the compiler that the raw pointer is a weak reference, and that
+ * property is somehow enforced by the code. This can make the compiler
+ * ignore these pointers when validating the usage of pointers otherwise.
+ * MOZ_UNSAFE_REF: Applies to declarations of pointer types. This attribute
+ * should be used for non-owning references that can be unsafe, and their
+ * safety needs to be validated through code inspection. The string argument
+ * passed to this macro documents the safety conditions.
+ * MOZ_NO_ADDREF_RELEASE_ON_RETURN: Applies to function declarations. Makes it
+ * a compile time error to call AddRef or Release on the return value of a
+ * function. This is intended to be used with operator->() of our smart
+ * pointer classes to ensure that the refcount of an object wrapped in a
+ * smart pointer is not manipulated directly.
+ */
+#ifdef MOZ_CLANG_PLUGIN
+# define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override")))
+# define MOZ_STACK_CLASS __attribute__((annotate("moz_stack_class")))
+# define MOZ_NONHEAP_CLASS __attribute__((annotate("moz_nonheap_class")))
+# define MOZ_TRIVIAL_CTOR_DTOR __attribute__((annotate("moz_trivial_ctor_dtor")))
+# ifdef DEBUG
+ /* in debug builds, these classes do have non-trivial constructors. */
+# define MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS __attribute__((annotate("moz_global_class")))
+# else
+# define MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS __attribute__((annotate("moz_global_class"))) \
+ MOZ_TRIVIAL_CTOR_DTOR
+# endif
+# define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
+# define MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT __attribute__((annotate("moz_no_arith_expr_in_arg")))
+# define MOZ_OWNING_REF __attribute__((annotate("moz_strong_ref")))
+# define MOZ_NON_OWNING_REF __attribute__((annotate("moz_weak_ref")))
+# define MOZ_UNSAFE_REF(reason) __attribute__((annotate("moz_strong_ref")))
+# define MOZ_NO_ADDREF_RELEASE_ON_RETURN __attribute__((annotate("moz_no_addref_release_on_return")))
+/*
+ * It turns out that clang doesn't like void func() __attribute__ {} without a
+ * warning, so use pragmas to disable the warning. This code won't work on GCC
+ * anyways, so the warning is safe to ignore.
+ */
+# define MOZ_HEAP_ALLOCATOR \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
+ __attribute__((annotate("moz_heap_allocator"))) \
+ _Pragma("clang diagnostic pop")
+#else
+# define MOZ_MUST_OVERRIDE /* nothing */
+# define MOZ_STACK_CLASS /* nothing */
+# define MOZ_NONHEAP_CLASS /* nothing */
+# define MOZ_TRIVIAL_CTOR_DTOR /* nothing */
+# define MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS /* nothing */
+# define MOZ_IMPLICIT /* nothing */
+# define MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT /* nothing */
+# define MOZ_HEAP_ALLOCATOR /* nothing */
+# define MOZ_OWNING_REF /* nothing */
+# define MOZ_NON_OWNING_REF /* nothing */
+# define MOZ_UNSAFE_REF(reason) /* nothing */
+# define MOZ_NO_ADDREF_RELEASE_ON_RETURN /* nothing */
+#endif /* MOZ_CLANG_PLUGIN */
+
+#endif /* __cplusplus */
+
+#endif /* mozilla_Attributes_h */
diff --git a/include/onlineupdate/mozilla/Compiler.h b/include/onlineupdate/mozilla/Compiler.h
new file mode 100644
index 000000000..6d6fcbbb1
--- /dev/null
+++ b/include/onlineupdate/mozilla/Compiler.h
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* Various compiler checks. */
+
+#ifndef mozilla_Compiler_h
+#define mozilla_Compiler_h
+
+#define MOZ_IS_GCC 0
+#define MOS_IS_MSVC 0
+
+#if !defined(__clang__) && defined(__GNUC__)
+
+# undef MOZ_IS_GCC
+# define MOZ_IS_GCC 1
+ /*
+ * This macro should simplify gcc version checking. For example, to check
+ * for gcc 4.7.1 or later, check `#if MOZ_GCC_VERSION_AT_LEAST(4, 7, 1)`.
+ */
+# define MOZ_GCC_VERSION_AT_LEAST(major, minor, patchlevel) \
+ ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) \
+ >= ((major) * 10000 + (minor) * 100 + (patchlevel)))
+# if !MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
+# error "mfbt (and Gecko) require at least gcc 4.7 to build."
+# endif
+
+#elif defined(_MSC_VER)
+
+# undef MOZ_IS_MSVC
+# define MOZ_IS_MSVC 1
+
+#endif
+
+/*
+ * The situation with standard libraries is a lot worse than with compilers,
+ * particularly as clang and gcc could end up using one of three or so standard
+ * libraries, and they may not be up-to-snuff with newer C++11 versions. To
+ * detect the library, we're going to include cstddef (which is a small header
+ * which will be transitively included by everybody else at some point) to grab
+ * the version macros and deduce macros from there.
+ */
+#ifdef __cplusplus
+# include <cstddef>
+# ifdef _STLPORT_MAJOR
+# define MOZ_USING_STLPORT 1
+# define MOZ_STLPORT_VERSION_AT_LEAST(major, minor, patch) \
+ (_STLPORT_VERSION >= ((major) << 8 | (minor) << 4 | (patch)))
+# elif defined(_LIBCPP_VERSION)
+ /*
+ * libc++, unfortunately, doesn't appear to have useful versioning macros.
+ * Hopefully, the recommendations of N3694 with respect to standard libraries
+ * will get applied instead and we won't need to worry about version numbers
+ * here.
+ */
+# define MOZ_USING_LIBCXX 1
+# elif defined(__GLIBCXX__)
+# define MOZ_USING_LIBSTDCXX 1
+ /*
+ * libstdc++ is also annoying and doesn't give us useful versioning macros
+ * for the library. If we're using gcc, then assume that libstdc++ matches
+ * the compiler version. If we're using clang, we're going to have to fake
+ * major/minor combinations by looking for newly-defined config macros.
+ */
+# if MOZ_IS_GCC
+# define MOZ_LIBSTDCXX_VERSION_AT_LEAST(major, minor, patch) \
+ MOZ_GCC_VERSION_AT_LEAST(major, minor, patch)
+# elif defined(_GLIBCXX_THROW_OR_ABORT)
+# define MOZ_LIBSTDCXX_VERSION_AT_LEAST(major, minor, patch) \
+ ((major) < 4 || ((major) == 4 && (minor) <= 8))
+# elif defined(_GLIBCXX_NOEXCEPT)
+# define MOZ_LIBSTDCXX_VERSION_AT_LEAST(major, minor, patch) \
+ ((major) < 4 || ((major) == 4 && (minor) <= 7))
+# elif defined(_GLIBCXX_USE_DEPRECATED)
+# define MOZ_LIBSTDCXX_VERSION_AT_LEAST(major, minor, patch) \
+ ((major) < 4 || ((major) == 4 && (minor) <= 6))
+# elif defined(_GLIBCXX_PSEUDO_VISIBILITY)
+# define MOZ_LIBSTDCXX_VERSION_AT_LEAST(major, minor, patch) \
+ ((major) < 4 || ((major) == 4 && (minor) <= 5))
+# elif defined(_GLIBCXX_BEGIN_EXTERN_C)
+# define MOZ_LIBSTDCXX_VERSION_AT_LEAST(major, minor, patch) \
+ ((major) < 4 || ((major) == 4 && (minor) <= 4))
+# elif defined(_GLIBCXX_VISIBILITY_ATTR)
+# define MOZ_LIBSTDCXX_VERSION_AT_LEAST(major, minor, patch) \
+ ((major) < 4 || ((major) == 4 && (minor) <= 3))
+# elif defined(_GLIBCXX_VISIBILITY)
+# define MOZ_LIBSTDCXX_VERSION_AT_LEAST(major, minor, patch) \
+ ((major) < 4 || ((major) == 4 && (minor) <= 2))
+# else
+# error "Your version of libstdc++ is unknown to us and is likely too old."
+# endif
+# endif
+
+ // Flesh out the defines for everyone else
+# ifndef MOZ_USING_STLPORT
+# define MOZ_USING_STLPORT 0
+# define MOZ_STLPORT_VERSION_AT_LEAST(major, minor, patch) 0
+# endif
+# ifndef MOZ_USING_LIBCXX
+# define MOZ_USING_LIBCXX 0
+# endif
+# ifndef MOZ_USING_LIBSTDCXX
+# define MOZ_USING_LIBSTDCXX 0
+# define MOZ_LIBSTDCXX_VERSION_AT_LEAST(major, minor, patch) 0
+# endif
+#endif /* __cplusplus */
+
+#endif /* mozilla_Compiler_h */
diff --git a/include/onlineupdate/mozilla/Likely.h b/include/onlineupdate/mozilla/Likely.h
new file mode 100644
index 000000000..5625bb226
--- /dev/null
+++ b/include/onlineupdate/mozilla/Likely.h
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/*
+ * MOZ_LIKELY and MOZ_UNLIKELY macros to hint to the compiler how a
+ * boolean predicate should be branch-predicted.
+ */
+
+#ifndef mozilla_Likely_h
+#define mozilla_Likely_h
+
+#if defined(__clang__) || defined(__GNUC__)
+#define MOZ_LIKELY(x) (__builtin_expect(!!(x), 1))
+#define MOZ_UNLIKELY(x) (__builtin_expect(!!(x), 0))
+#else
+#define MOZ_LIKELY(x) (!!(x))
+#define MOZ_UNLIKELY(x) (!!(x))
+#endif
+
+#endif /* mozilla_Likely_h */
diff --git a/include/onlineupdate/mozilla/MacroArgs.h b/include/onlineupdate/mozilla/MacroArgs.h
new file mode 100644
index 000000000..c8b733821
--- /dev/null
+++ b/include/onlineupdate/mozilla/MacroArgs.h
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/*
+ * Implements various macros meant to ease the use of variadic macros.
+ */
+
+#ifndef mozilla_MacroArgs_h
+#define mozilla_MacroArgs_h
+
+/*
+ * MOZ_PASTE_PREFIX_AND_ARG_COUNT(aPrefix, ...) counts the number of variadic
+ * arguments and prefixes it with |aPrefix|. For example:
+ *
+ * MOZ_PASTE_PREFIX_AND_ARG_COUNT(, foo, 42) expands to 2
+ * MOZ_PASTE_PREFIX_AND_ARG_COUNT(A, foo, 42, bar) expands to A3
+ *
+ * You must pass in between 1 and 50 (inclusive) variadic arguments, past
+ * |aPrefix|. It is not legal to do
+ *
+ * MOZ_PASTE_PREFIX_AND_ARG_COUNT(prefix)
+ *
+ * (that is, pass in 0 variadic arguments). To ensure that a compile-time
+ * error occurs when these constraints are violated, use the
+ * MOZ_STATIC_ASSERT_VALID_ARG_COUNT macro with the same variaidc arguments
+ * wherever this macro is used.
+ *
+ * Passing (__VA_ARGS__, <rest of arguments>) rather than simply calling
+ * MOZ_MACROARGS_ARG_COUNT_HELPER2(__VA_ARGS__, <rest of arguments>) very
+ * carefully tiptoes around a MSVC bug where it improperly expands __VA_ARGS__
+ * as a single token in argument lists. For details, see:
+ *
+ * http://connect.microsoft.com/VisualStudio/feedback/details/380090/variadic-macro-replacement
+ * http://cplusplus.co.il/2010/07/17/variadic-macro-to-count-number-of-arguments/#comment-644
+ */
+#define MOZ_PASTE_PREFIX_AND_ARG_COUNT(aPrefix, ...) \
+ MOZ_MACROARGS_ARG_COUNT_HELPER((__VA_ARGS__, \
+ aPrefix##50, aPrefix##49, aPrefix##48, aPrefix##47, aPrefix##46, \
+ aPrefix##45, aPrefix##44, aPrefix##43, aPrefix##42, aPrefix##41, \
+ aPrefix##40, aPrefix##39, aPrefix##38, aPrefix##37, aPrefix##36, \
+ aPrefix##35, aPrefix##34, aPrefix##33, aPrefix##32, aPrefix##31, \
+ aPrefix##30, aPrefix##29, aPrefix##28, aPrefix##27, aPrefix##26, \
+ aPrefix##25, aPrefix##24, aPrefix##23, aPrefix##22, aPrefix##21, \
+ aPrefix##20, aPrefix##19, aPrefix##18, aPrefix##17, aPrefix##16, \
+ aPrefix##15, aPrefix##14, aPrefix##13, aPrefix##12, aPrefix##11, \
+ aPrefix##10, aPrefix##9, aPrefix##8, aPrefix##7, aPrefix##6, \
+ aPrefix##5, aPrefix##4, aPrefix##3, aPrefix##2, aPrefix##1, aPrefix##0))
+
+#define MOZ_MACROARGS_ARG_COUNT_HELPER(aArgs) \
+ MOZ_MACROARGS_ARG_COUNT_HELPER2 aArgs
+
+#define MOZ_MACROARGS_ARG_COUNT_HELPER2( \
+ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, \
+ a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, \
+ a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, \
+ a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, \
+ a41, a42, a43, a44, a45, a46, a47, a48, a49, a50, \
+ a51, ...) a51
+
+/*
+ * MOZ_STATIC_ASSERT_VALID_ARG_COUNT ensures that a compile-time error occurs
+ * when the argument count constraints of MOZ_PASTE_PREFIX_AND_ARG_COUNT are
+ * violated. Use this macro wherever MOZ_PASTE_PREFIX_AND_ARG_COUNT is used
+ * and pass it the same variadic arguments.
+ *
+ * This macro employs a few dirty tricks to function. To detect the zero
+ * argument case, |(__VA_ARGS__)| is stringified, sizeof-ed, and compared to
+ * what it should be in the absence of arguments.
+ *
+ * Detecting too many arguments is a little trickier. With a valid argument
+ * count and a prefix of 1, MOZ_PASTE_PREFIX_AND_ARG_COUNT expands to e.g. 14.
+ * With a prefix of 0.0, it expands to e.g. 0.04. If there are too many
+ * arguments, it expands to the first argument over the limit. If this
+ * exceeding argument is a number, the assertion will fail as there is no
+ * number than can simultaneously be both > 10 and == 0. If the exceeding
+ * argument is not a number, a compile-time error should still occur due to
+ * the operations performed on it.
+ */
+#define MOZ_MACROARGS_STRINGIFY_HELPER(x) #x
+#define MOZ_STATIC_ASSERT_VALID_ARG_COUNT(...) \
+ static_assert( \
+ sizeof(MOZ_MACROARGS_STRINGIFY_HELPER((__VA_ARGS__))) != sizeof("()") && \
+ (MOZ_PASTE_PREFIX_AND_ARG_COUNT(1, __VA_ARGS__)) > 10 && \
+ (int)(MOZ_PASTE_PREFIX_AND_ARG_COUNT(0.0, __VA_ARGS__)) == 0, \
+ "MOZ_STATIC_ASSERT_VALID_ARG_COUNT requires 1 to 50 arguments") /* ; */
+
+/*
+ * MOZ_ARGS_AFTER_N expands to its arguments excluding the first |N|
+ * arguments. For example:
+ *
+ * MOZ_ARGS_AFTER_2(a, b, c, d) expands to: c, d
+ */
+#define MOZ_ARGS_AFTER_1(a1, ...) __VA_ARGS__
+#define MOZ_ARGS_AFTER_2(a1, a2, ...) __VA_ARGS__
+
+/*
+ * MOZ_ARG_N expands to its |N|th argument.
+ */
+#define MOZ_ARG_1(a1, ...) a1
+#define MOZ_ARG_2(a1, a2, ...) a2
+
+#endif /* mozilla_MacroArgs_h */
diff --git a/include/onlineupdate/mozilla/TypeTraits.h b/include/onlineupdate/mozilla/TypeTraits.h
new file mode 100644
index 000000000..7ca9d3315
--- /dev/null
+++ b/include/onlineupdate/mozilla/TypeTraits.h
@@ -0,0 +1,1116 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* Template-based metaprogramming and type-testing facilities. */
+
+#ifndef mozilla_TypeTraits_h
+#define mozilla_TypeTraits_h
+
+#include "Types.h"
+
+/*
+ * These traits are approximate copies of the traits and semantics from C++11's
+ * <type_traits> header. Don't add traits not in that header! When all
+ * platforms provide that header, we can convert all users and remove this one.
+ */
+
+#include <wchar.h>
+
+namespace mozilla {
+
+/* Forward declarations. */
+
+template<typename> struct RemoveCV;
+
+/* 20.9.3 Helper classes [meta.help] */
+
+/**
+ * Helper class used as a base for various type traits, exposed publicly
+ * because <type_traits> exposes it as well.
+ */
+template<typename T, T Value>
+struct IntegralConstant
+{
+ static const T value = Value;
+ typedef T ValueType;
+ typedef IntegralConstant<T, Value> Type;
+};
+
+/** Convenient aliases. */
+typedef IntegralConstant<bool, true> TrueType;
+typedef IntegralConstant<bool, false> FalseType;
+
+/* 20.9.4 Unary type traits [meta.unary] */
+
+/* 20.9.4.1 Primary type categories [meta.unary.cat] */
+
+namespace detail {
+
+template<typename T>
+struct IsVoidHelper : FalseType {};
+
+template<>
+struct IsVoidHelper<void> : TrueType {};
+
+} // namespace detail
+
+/**
+ * IsVoid determines whether a type is void.
+ *
+ * mozilla::IsVoid<int>::value is false;
+ * mozilla::IsVoid<void>::value is true;
+ * mozilla::IsVoid<void*>::value is false;
+ * mozilla::IsVoid<volatile void>::value is true.
+ */
+template<typename T>
+struct IsVoid : detail::IsVoidHelper<typename RemoveCV<T>::Type> {};
+
+namespace detail {
+
+template <typename T>
+struct IsIntegralHelper : FalseType {};
+
+template<> struct IsIntegralHelper<char> : TrueType {};
+template<> struct IsIntegralHelper<signed char> : TrueType {};
+template<> struct IsIntegralHelper<unsigned char> : TrueType {};
+template<> struct IsIntegralHelper<short> : TrueType {};
+template<> struct IsIntegralHelper<unsigned short> : TrueType {};
+template<> struct IsIntegralHelper<int> : TrueType {};
+template<> struct IsIntegralHelper<unsigned int> : TrueType {};
+template<> struct IsIntegralHelper<long> : TrueType {};
+template<> struct IsIntegralHelper<unsigned long> : TrueType {};
+template<> struct IsIntegralHelper<long long> : TrueType {};
+template<> struct IsIntegralHelper<unsigned long long> : TrueType {};
+template<> struct IsIntegralHelper<bool> : TrueType {};
+template<> struct IsIntegralHelper<wchar_t> : TrueType {};
+#ifdef MOZ_CHAR16_IS_NOT_WCHAR
+template<> struct IsIntegralHelper<char16_t> : TrueType {};
+#endif
+
+} /* namespace detail */
+
+/**
+ * IsIntegral determines whether a type is an integral type.
+ *
+ * mozilla::IsIntegral<int>::value is true;
+ * mozilla::IsIntegral<unsigned short>::value is true;
+ * mozilla::IsIntegral<const long>::value is true;
+ * mozilla::IsIntegral<int*>::value is false;
+ * mozilla::IsIntegral<double>::value is false;
+ *
+ * Note that the behavior of IsIntegral on char16_t and char32_t is
+ * unspecified.
+ */
+template<typename T>
+struct IsIntegral : detail::IsIntegralHelper<typename RemoveCV<T>::Type>
+{};
+
+template<typename T, typename U>
+struct IsSame;
+
+namespace detail {
+
+template<typename T>
+struct IsFloatingPointHelper
+ : IntegralConstant<bool,
+ IsSame<T, float>::value ||
+ IsSame<T, double>::value ||
+ IsSame<T, long double>::value>
+{};
+
+} // namespace detail
+
+/**
+ * IsFloatingPoint determines whether a type is a floating point type (float,
+ * double, long double).
+ *
+ * mozilla::IsFloatingPoint<int>::value is false;
+ * mozilla::IsFloatingPoint<const float>::value is true;
+ * mozilla::IsFloatingPoint<long double>::value is true;
+ * mozilla::IsFloatingPoint<double*>::value is false.
+ */
+template<typename T>
+struct IsFloatingPoint
+ : detail::IsFloatingPointHelper<typename RemoveCV<T>::Type>
+{};
+
+namespace detail {
+
+template<typename T>
+struct IsArrayHelper : FalseType {};
+
+template<typename T, decltype(sizeof(1)) N>
+struct IsArrayHelper<T[N]> : TrueType {};
+
+template<typename T>
+struct IsArrayHelper<T[]> : TrueType {};
+
+} // namespace detail
+
+/**
+ * IsArray determines whether a type is an array type, of known or unknown
+ * length.
+ *
+ * mozilla::IsArray<int>::value is false;
+ * mozilla::IsArray<int[]>::value is true;
+ * mozilla::IsArray<int[5]>::value is true.
+ */
+template<typename T>
+struct IsArray : detail::IsArrayHelper<typename RemoveCV<T>::Type>
+{};
+
+namespace detail {
+
+template<typename T>
+struct IsPointerHelper : FalseType {};
+
+template<typename T>
+struct IsPointerHelper<T*> : TrueType {};
+
+} // namespace detail
+
+/**
+ * IsPointer determines whether a type is a possibly-CV-qualified pointer type
+ * (but not a pointer-to-member type).
+ *
+ * mozilla::IsPointer<struct S*>::value is true;
+ * mozilla::IsPointer<int*>::value is true;
+ * mozilla::IsPointer<int**>::value is true;
+ * mozilla::IsPointer<const int*>::value is true;
+ * mozilla::IsPointer<int* const>::value is true;
+ * mozilla::IsPointer<int* volatile>::value is true;
+ * mozilla::IsPointer<void (*)(void)>::value is true;
+ * mozilla::IsPointer<int>::value is false;
+ * mozilla::IsPointer<struct S>::value is false.
+ * mozilla::IsPointer<int(struct S::*)>::value is false
+ */
+template<typename T>
+struct IsPointer : detail::IsPointerHelper<typename RemoveCV<T>::Type>
+{};
+
+/**
+ * IsLvalueReference determines whether a type is an lvalue reference.
+ *
+ * mozilla::IsLvalueReference<struct S*>::value is false;
+ * mozilla::IsLvalueReference<int**>::value is false;
+ * mozilla::IsLvalueReference<void (*)(void)>::value is false;
+ * mozilla::IsLvalueReference<int>::value is false;
+ * mozilla::IsLvalueReference<struct S>::value is false;
+ * mozilla::IsLvalueReference<struct S*&>::value is true;
+ * mozilla::IsLvalueReference<struct S&&>::value is false.
+ */
+template<typename T>
+struct IsLvalueReference : FalseType {};
+
+template<typename T>
+struct IsLvalueReference<T&> : TrueType {};
+
+/**
+ * IsRvalueReference determines whether a type is an rvalue reference.
+ *
+ * mozilla::IsRvalueReference<struct S*>::value is false;
+ * mozilla::IsRvalueReference<int**>::value is false;
+ * mozilla::IsRvalueReference<void (*)(void)>::value is false;
+ * mozilla::IsRvalueReference<int>::value is false;
+ * mozilla::IsRvalueReference<struct S>::value is false;
+ * mozilla::IsRvalueReference<struct S*&>::value is false;
+ * mozilla::IsRvalueReference<struct S&&>::value is true.
+ */
+template<typename T>
+struct IsRvalueReference : FalseType {};
+
+template<typename T>
+struct IsRvalueReference<T&&> : TrueType {};
+
+namespace detail {
+
+// __is_enum is a supported extension across all of our supported compilers.
+template<typename T>
+struct IsEnumHelper
+ : IntegralConstant<bool, __is_enum(T)>
+{};
+
+} // namespace detail
+
+/**
+ * IsEnum determines whether a type is an enum type.
+ *
+ * mozilla::IsEnum<enum S>::value is true;
+ * mozilla::IsEnum<enum S*>::value is false;
+ * mozilla::IsEnum<int>::value is false;
+ */
+template<typename T>
+struct IsEnum
+ : detail::IsEnumHelper<typename RemoveCV<T>::Type>
+{};
+
+namespace detail {
+
+// __is_class is a supported extension across all of our supported compilers:
+// http://llvm.org/releases/3.0/docs/ClangReleaseNotes.html
+// http://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Type-Traits.html#Type-Traits
+// http://msdn.microsoft.com/en-us/library/ms177194%28v=vs.100%29.aspx
+template<typename T>
+struct IsClassHelper
+ : IntegralConstant<bool, __is_class(T)>
+{};
+
+} // namespace detail
+
+/**
+ * IsClass determines whether a type is a class type (but not a union).
+ *
+ * struct S {};
+ * union U {};
+ * mozilla::IsClass<int>::value is false;
+ * mozilla::IsClass<const S>::value is true;
+ * mozilla::IsClass<U>::value is false;
+ */
+template<typename T>
+struct IsClass
+ : detail::IsClassHelper<typename RemoveCV<T>::Type>
+{};
+
+/* 20.9.4.2 Composite type traits [meta.unary.comp] */
+
+/**
+ * IsReference determines whether a type is an lvalue or rvalue reference.
+ *
+ * mozilla::IsReference<struct S*>::value is false;
+ * mozilla::IsReference<int**>::value is false;
+ * mozilla::IsReference<int&>::value is true;
+ * mozilla::IsReference<void (*)(void)>::value is false;
+ * mozilla::IsReference<const int&>::value is true;
+ * mozilla::IsReference<int>::value is false;
+ * mozilla::IsReference<struct S>::value is false;
+ * mozilla::IsReference<struct S&>::value is true;
+ * mozilla::IsReference<struct S*&>::value is true;
+ * mozilla::IsReference<struct S&&>::value is true.
+ */
+template<typename T>
+struct IsReference
+ : IntegralConstant<bool,
+ IsLvalueReference<T>::value || IsRvalueReference<T>::value>
+{};
+
+/**
+ * IsArithmetic determines whether a type is arithmetic. A type is arithmetic
+ * iff it is an integral type or a floating point type.
+ *
+ * mozilla::IsArithmetic<int>::value is true;
+ * mozilla::IsArithmetic<double>::value is true;
+ * mozilla::IsArithmetic<long double*>::value is false.
+ */
+template<typename T>
+struct IsArithmetic
+ : IntegralConstant<bool, IsIntegral<T>::value || IsFloatingPoint<T>::value>
+{};
+
+/* 20.9.4.3 Type properties [meta.unary.prop] */
+
+/**
+ * IsConst determines whether a type is const or not.
+ *
+ * mozilla::IsConst<int>::value is false;
+ * mozilla::IsConst<void* const>::value is true;
+ * mozilla::IsConst<const char*>::value is false.
+ */
+template<typename T>
+struct IsConst : FalseType {};
+
+template<typename T>
+struct IsConst<const T> : TrueType {};
+
+/**
+ * IsVolatile determines whether a type is volatile or not.
+ *
+ * mozilla::IsVolatile<int>::value is false;
+ * mozilla::IsVolatile<void* volatile>::value is true;
+ * mozilla::IsVolatile<volatile char*>::value is false.
+ */
+template<typename T>
+struct IsVolatile : FalseType {};
+
+template<typename T>
+struct IsVolatile<volatile T> : TrueType {};
+
+/**
+ * Traits class for identifying POD types. Until C++11 there's no automatic
+ * way to detect PODs, so for the moment this is done manually. Users may
+ * define specializations of this class that inherit from mozilla::TrueType and
+ * mozilla::FalseType (or equivalently mozilla::IntegralConstant<bool, true or
+ * false>, or conveniently from mozilla::IsPod for composite types) as needed to
+ * ensure correct IsPod behavior.
+ */
+template<typename T>
+struct IsPod : public FalseType {};
+
+template<> struct IsPod<char> : TrueType {};
+template<> struct IsPod<signed char> : TrueType {};
+template<> struct IsPod<unsigned char> : TrueType {};
+template<> struct IsPod<short> : TrueType {};
+template<> struct IsPod<unsigned short> : TrueType {};
+template<> struct IsPod<int> : TrueType {};
+template<> struct IsPod<unsigned int> : TrueType {};
+template<> struct IsPod<long> : TrueType {};
+template<> struct IsPod<unsigned long> : TrueType {};
+template<> struct IsPod<long long> : TrueType {};
+template<> struct IsPod<unsigned long long> : TrueType {};
+template<> struct IsPod<bool> : TrueType {};
+template<> struct IsPod<float> : TrueType {};
+template<> struct IsPod<double> : TrueType {};
+template<> struct IsPod<wchar_t> : TrueType {};
+#ifdef MOZ_CHAR16_IS_NOT_WCHAR
+template<> struct IsPod<char16_t> : TrueType {};
+#endif
+template<typename T> struct IsPod<T*> : TrueType {};
+
+namespace detail {
+
+// __is_empty is a supported extension across all of our supported compilers:
+// http://llvm.org/releases/3.0/docs/ClangReleaseNotes.html
+// http://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Type-Traits.html#Type-Traits
+// http://msdn.microsoft.com/en-us/library/ms177194%28v=vs.100%29.aspx
+template<typename T>
+struct IsEmptyHelper
+ : IntegralConstant<bool, IsClass<T>::value && __is_empty(T)>
+{};
+
+} // namespace detail
+
+/**
+ * IsEmpty determines whether a type is a class (but not a union) that is empty.
+ *
+ * A class is empty iff it and all its base classes have no non-static data
+ * members (except bit-fields of length 0) and no virtual member functions, and
+ * no base class is empty or a virtual base class.
+ *
+ * Intuitively, empty classes don't have any data that has to be stored in
+ * instances of those classes. (The size of the class must still be non-zero,
+ * because distinct array elements of any type must have different addresses.
+ * However, if the Empty Base Optimization is implemented by the compiler [most
+ * compilers implement it, and in certain cases C++11 requires it], the size of
+ * a class inheriting from an empty |Base| class need not be inflated by
+ * |sizeof(Base)|.) And intuitively, non-empty classes have data members and/or
+ * vtable pointers that must be stored in each instance for proper behavior.
+ *
+ * static_assert(!mozilla::IsEmpty<int>::value, "not a class => not empty");
+ * union U1 { int x; };
+ * static_assert(!mozilla::IsEmpty<U1>::value, "not a class => not empty");
+ * struct E1 {};
+ * struct E2 { int : 0 };
+ * struct E3 : E1 {};
+ * struct E4 : E2 {};
+ * static_assert(mozilla::IsEmpty<E1>::value &&
+ * mozilla::IsEmpty<E2>::value &&
+ * mozilla::IsEmpty<E3>::value &&
+ * mozilla::IsEmpty<E4>::value,
+ * "all empty");
+ * union U2 { E1 e1; };
+ * static_assert(!mozilla::IsEmpty<U2>::value, "not a class => not empty");
+ * struct NE1 { int x; };
+ * struct NE2 : virtual E1 {};
+ * struct NE3 : E2 { virtual ~NE3() {} };
+ * struct NE4 { virtual void f() {} };
+ * static_assert(!mozilla::IsEmpty<NE1>::value &&
+ * !mozilla::IsEmpty<NE2>::value &&
+ * !mozilla::IsEmpty<NE3>::value &&
+ * !mozilla::IsEmpty<NE4>::value,
+ * "all empty");
+ */
+template<typename T>
+struct IsEmpty : detail::IsEmptyHelper<typename RemoveCV<T>::Type>
+{};
+
+
+namespace detail {
+
+template<typename T,
+ bool = IsFloatingPoint<T>::value,
+ bool = IsIntegral<T>::value,
+ typename NoCV = typename RemoveCV<T>::Type>
+struct IsSignedHelper;
+
+// Floating point is signed.
+template<typename T, typename NoCV>
+struct IsSignedHelper<T, true, false, NoCV> : TrueType {};
+
+// Integral is conditionally signed.
+template<typename T, typename NoCV>
+struct IsSignedHelper<T, false, true, NoCV>
+ : IntegralConstant<bool, bool(NoCV(-1) < NoCV(1))>
+{};
+
+// Non-floating point, non-integral is not signed.
+template<typename T, typename NoCV>
+struct IsSignedHelper<T, false, false, NoCV> : FalseType {};
+
+} // namespace detail
+
+/**
+ * IsSigned determines whether a type is a signed arithmetic type. |char| is
+ * considered a signed type if it has the same representation as |signed char|.
+ *
+ * mozilla::IsSigned<int>::value is true;
+ * mozilla::IsSigned<const unsigned int>::value is false;
+ * mozilla::IsSigned<unsigned char>::value is false;
+ * mozilla::IsSigned<float>::value is true.
+ */
+template<typename T>
+struct IsSigned : detail::IsSignedHelper<T> {};
+
+namespace detail {
+
+template<typename T,
+ bool = IsFloatingPoint<T>::value,
+ bool = IsIntegral<T>::value,
+ typename NoCV = typename RemoveCV<T>::Type>
+struct IsUnsignedHelper;
+
+// Floating point is not unsigned.
+template<typename T, typename NoCV>
+struct IsUnsignedHelper<T, true, false, NoCV> : FalseType {};
+
+// Integral is conditionally unsigned.
+template<typename T, typename NoCV>
+struct IsUnsignedHelper<T, false, true, NoCV>
+ : IntegralConstant<bool,
+ (IsSame<NoCV, bool>::value || bool(NoCV(1) < NoCV(-1)))>
+{};
+
+// Non-floating point, non-integral is not unsigned.
+template<typename T, typename NoCV>
+struct IsUnsignedHelper<T, false, false, NoCV> : FalseType {};
+
+} // namespace detail
+
+/**
+ * IsUnsigned determines whether a type is an unsigned arithmetic type.
+ *
+ * mozilla::IsUnsigned<int>::value is false;
+ * mozilla::IsUnsigned<const unsigned int>::value is true;
+ * mozilla::IsUnsigned<unsigned char>::value is true;
+ * mozilla::IsUnsigned<float>::value is false.
+ */
+template<typename T>
+struct IsUnsigned : detail::IsUnsignedHelper<T> {};
+
+/* 20.9.5 Type property queries [meta.unary.prop.query] */
+
+/* 20.9.6 Relationships between types [meta.rel] */
+
+/**
+ * IsSame tests whether two types are the same type.
+ *
+ * mozilla::IsSame<int, int>::value is true;
+ * mozilla::IsSame<int*, int*>::value is true;
+ * mozilla::IsSame<int, unsigned int>::value is false;
+ * mozilla::IsSame<void, void>::value is true;
+ * mozilla::IsSame<const int, int>::value is false;
+ * mozilla::IsSame<struct S, struct S>::value is true.
+ */
+template<typename T, typename U>
+struct IsSame : FalseType {};
+
+template<typename T>
+struct IsSame<T, T> : TrueType {};
+
+namespace detail {
+
+#if defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER)
+
+template<class Base, class Derived>
+struct BaseOfTester : IntegralConstant<bool, __is_base_of(Base, Derived)> {};
+
+#else
+
+// The trickery used to implement IsBaseOf here makes it possible to use it for
+// the cases of private and multiple inheritance. This code was inspired by the
+// sample code here:
+//
+// http://stackoverflow.com/questions/2910979/how-is-base-of-works
+template<class Base, class Derived>
+struct BaseOfHelper
+{
+public:
+ operator Base*() const;
+ operator Derived*();
+};
+
+template<class Base, class Derived>
+struct BaseOfTester
+{
+private:
+ template<class T>
+ static char test(Derived*, T);
+ static int test(Base*, int);
+
+public:
+ static const bool value =
+ sizeof(test(BaseOfHelper<Base, Derived>(), int())) == sizeof(char);
+};
+
+template<class Base, class Derived>
+struct BaseOfTester<Base, const Derived>
+{
+private:
+ template<class T>
+ static char test(Derived*, T);
+ static int test(Base*, int);
+
+public:
+ static const bool value =
+ sizeof(test(BaseOfHelper<Base, Derived>(), int())) == sizeof(char);
+};
+
+template<class Base, class Derived>
+struct BaseOfTester<Base&, Derived&> : FalseType {};
+
+template<class Type>
+struct BaseOfTester<Type, Type> : TrueType {};
+
+template<class Type>
+struct BaseOfTester<Type, const Type> : TrueType {};
+
+#endif
+
+} /* namespace detail */
+
+/*
+ * IsBaseOf allows to know whether a given class is derived from another.
+ *
+ * Consider the following class definitions:
+ *
+ * class A {};
+ * class B : public A {};
+ * class C {};
+ *
+ * mozilla::IsBaseOf<A, B>::value is true;
+ * mozilla::IsBaseOf<A, C>::value is false;
+ */
+template<class Base, class Derived>
+struct IsBaseOf
+ : IntegralConstant<bool, detail::BaseOfTester<Base, Derived>::value>
+{};
+
+namespace detail {
+
+template<typename From, typename To>
+struct ConvertibleTester
+{
+private:
+ static From create();
+
+ template<typename From1, typename To1>
+ static char test(To to);
+
+ template<typename From1, typename To1>
+ static int test(...);
+
+public:
+ static const bool value =
+ sizeof(test<From, To>(create())) == sizeof(char);
+};
+
+} // namespace detail
+
+/**
+ * IsConvertible determines whether a value of type From will implicitly convert
+ * to a value of type To. For example:
+ *
+ * struct A {};
+ * struct B : public A {};
+ * struct C {};
+ *
+ * mozilla::IsConvertible<A, A>::value is true;
+ * mozilla::IsConvertible<A*, A*>::value is true;
+ * mozilla::IsConvertible<B, A>::value is true;
+ * mozilla::IsConvertible<B*, A*>::value is true;
+ * mozilla::IsConvertible<C, A>::value is false;
+ * mozilla::IsConvertible<A, C>::value is false;
+ * mozilla::IsConvertible<A*, C*>::value is false;
+ * mozilla::IsConvertible<C*, A*>::value is false.
+ *
+ * For obscure reasons, you can't use IsConvertible when the types being tested
+ * are related through private inheritance, and you'll get a compile error if
+ * you try. Just don't do it!
+ *
+ * Note - we need special handling for void, which ConvertibleTester doesn't
+ * handle. The void handling here doesn't handle const/volatile void correctly,
+ * which could be easily fixed if the need arises.
+ */
+template<typename From, typename To>
+struct IsConvertible
+ : IntegralConstant<bool, detail::ConvertibleTester<From, To>::value>
+{};
+
+template<typename B>
+struct IsConvertible<void, B>
+ : IntegralConstant<bool, IsVoid<B>::value>
+{};
+
+template<typename A>
+struct IsConvertible<A, void>
+ : IntegralConstant<bool, IsVoid<A>::value>
+{};
+
+template<>
+struct IsConvertible<void, void>
+ : TrueType
+{};
+
+/* 20.9.7 Transformations between types [meta.trans] */
+
+/* 20.9.7.1 Const-volatile modifications [meta.trans.cv] */
+
+/**
+ * RemoveConst removes top-level const qualifications on a type.
+ *
+ * mozilla::RemoveConst<int>::Type is int;
+ * mozilla::RemoveConst<const int>::Type is int;
+ * mozilla::RemoveConst<const int*>::Type is const int*;
+ * mozilla::RemoveConst<int* const>::Type is int*.
+ */
+template<typename T>
+struct RemoveConst
+{
+ typedef T Type;
+};
+
+template<typename T>
+struct RemoveConst<const T>
+{
+ typedef T Type;
+};
+
+/**
+ * RemoveVolatile removes top-level volatile qualifications on a type.
+ *
+ * mozilla::RemoveVolatile<int>::Type is int;
+ * mozilla::RemoveVolatile<volatile int>::Type is int;
+ * mozilla::RemoveVolatile<volatile int*>::Type is volatile int*;
+ * mozilla::RemoveVolatile<int* volatile>::Type is int*.
+ */
+template<typename T>
+struct RemoveVolatile
+{
+ typedef T Type;
+};
+
+template<typename T>
+struct RemoveVolatile<volatile T>
+{
+ typedef T Type;
+};
+
+/**
+ * RemoveCV removes top-level const and volatile qualifications on a type.
+ *
+ * mozilla::RemoveCV<int>::Type is int;
+ * mozilla::RemoveCV<const int>::Type is int;
+ * mozilla::RemoveCV<volatile int>::Type is int;
+ * mozilla::RemoveCV<int* const volatile>::Type is int*.
+ */
+template<typename T>
+struct RemoveCV
+{
+ typedef typename RemoveConst<typename RemoveVolatile<T>::Type>::Type Type;
+};
+
+/* 20.9.7.2 Reference modifications [meta.trans.ref] */
+
+/**
+ * Converts reference types to the underlying types.
+ *
+ * mozilla::RemoveReference<T>::Type is T;
+ * mozilla::RemoveReference<T&>::Type is T;
+ * mozilla::RemoveReference<T&&>::Type is T;
+ */
+
+template<typename T>
+struct RemoveReference
+{
+ typedef T Type;
+};
+
+template<typename T>
+struct RemoveReference<T&>
+{
+ typedef T Type;
+};
+
+template<typename T>
+struct RemoveReference<T&&>
+{
+ typedef T Type;
+};
+
+template<bool Condition, typename A, typename B>
+struct Conditional;
+
+namespace detail {
+
+enum Voidness { TIsVoid, TIsNotVoid };
+
+template<typename T, Voidness V = IsVoid<T>::value ? TIsVoid : TIsNotVoid>
+struct AddLvalueReferenceHelper;
+
+template<typename T>
+struct AddLvalueReferenceHelper<T, TIsVoid>
+{
+ typedef void Type;
+};
+
+template<typename T>
+struct AddLvalueReferenceHelper<T, TIsNotVoid>
+{
+ typedef T& Type;
+};
+
+} // namespace detail
+
+/**
+ * AddLvalueReference adds an lvalue & reference to T if one isn't already
+ * present. (Note: adding an lvalue reference to an rvalue && reference in
+ * essence replaces the && with a &&, per C+11 reference collapsing rules. For
+ * example, int&& would become int&.)
+ *
+ * The final computed type will only *not* be an lvalue reference if T is void.
+ *
+ * mozilla::AddLvalueReference<int>::Type is int&;
+ * mozilla::AddLvalueRference<volatile int&>::Type is volatile int&;
+ * mozilla::AddLvalueReference<void*>::Type is void*&;
+ * mozilla::AddLvalueReference<void>::Type is void;
+ * mozilla::AddLvalueReference<struct S&&>::Type is struct S&.
+ */
+template<typename T>
+struct AddLvalueReference
+ : detail::AddLvalueReferenceHelper<T>
+{};
+
+namespace detail {
+
+template<typename T, Voidness V = IsVoid<T>::value ? TIsVoid : TIsNotVoid>
+struct AddRvalueReferenceHelper;
+
+template<typename T>
+struct AddRvalueReferenceHelper<T, TIsVoid>
+{
+ typedef void Type;
+};
+
+template<typename T>
+struct AddRvalueReferenceHelper<T, TIsNotVoid>
+{
+ typedef T&& Type;
+};
+
+} // namespace detail
+
+/**
+ * AddRvalueReference adds an rvalue && reference to T if one isn't already
+ * present. (Note: adding an rvalue reference to an lvalue & reference in
+ * essence keeps the &, per C+11 reference collapsing rules. For example,
+ * int& would remain int&.)
+ *
+ * The final computed type will only *not* be a reference if T is void.
+ *
+ * mozilla::AddRvalueReference<int>::Type is int&&;
+ * mozilla::AddRvalueRference<volatile int&>::Type is volatile int&;
+ * mozilla::AddRvalueRference<const int&&>::Type is const int&&;
+ * mozilla::AddRvalueReference<void*>::Type is void*&&;
+ * mozilla::AddRvalueReference<void>::Type is void;
+ * mozilla::AddRvalueReference<struct S&>::Type is struct S&.
+ */
+template<typename T>
+struct AddRvalueReference
+ : detail::AddRvalueReferenceHelper<T>
+{};
+
+/* 20.2.4 Function template declval [declval] */
+
+/**
+ * DeclVal simplifies the definition of expressions which occur as unevaluated
+ * operands. It converts T to a reference type, making it possible to use in
+ * decltype expressions even if T does not have a default constructor, e.g.:
+ * decltype(DeclVal<TWithNoDefaultConstructor>().foo())
+ */
+template<typename T>
+typename AddRvalueReference<T>::Type DeclVal();
+
+/* 20.9.7.3 Sign modifications [meta.trans.sign] */
+
+template<bool B, typename T = void>
+struct EnableIf;
+
+namespace detail {
+
+template<bool MakeConst, typename T>
+struct WithC : Conditional<MakeConst, const T, T>
+{};
+
+template<bool MakeVolatile, typename T>
+struct WithV : Conditional<MakeVolatile, volatile T, T>
+{};
+
+
+template<bool MakeConst, bool MakeVolatile, typename T>
+struct WithCV : WithC<MakeConst, typename WithV<MakeVolatile, T>::Type>
+{};
+
+template<typename T>
+struct CorrespondingSigned;
+
+template<>
+struct CorrespondingSigned<char> { typedef signed char Type; };
+template<>
+struct CorrespondingSigned<unsigned char> { typedef signed char Type; };
+template<>
+struct CorrespondingSigned<unsigned short> { typedef short Type; };
+template<>
+struct CorrespondingSigned<unsigned int> { typedef int Type; };
+template<>
+struct CorrespondingSigned<unsigned long> { typedef long Type; };
+template<>
+struct CorrespondingSigned<unsigned long long> { typedef long long Type; };
+
+template<typename T,
+ typename CVRemoved = typename RemoveCV<T>::Type,
+ bool IsSignedIntegerType = IsSigned<CVRemoved>::value &&
+ !IsSame<char, CVRemoved>::value>
+struct MakeSigned;
+
+template<typename T, typename CVRemoved>
+struct MakeSigned<T, CVRemoved, true>
+{
+ typedef T Type;
+};
+
+template<typename T, typename CVRemoved>
+struct MakeSigned<T, CVRemoved, false>
+ : WithCV<IsConst<T>::value, IsVolatile<T>::value,
+ typename CorrespondingSigned<CVRemoved>::Type>
+{};
+
+} // namespace detail
+
+/**
+ * MakeSigned produces the corresponding signed integer type for a given
+ * integral type T, with the const/volatile qualifiers of T. T must be a
+ * possibly-const/volatile-qualified integral type that isn't bool.
+ *
+ * If T is already a signed integer type (not including char!), then T is
+ * produced.
+ *
+ * Otherwise, if T is an unsigned integer type, the signed variety of T, with
+ * T's const/volatile qualifiers, is produced.
+ *
+ * Otherwise, the integral type of the same size as T, with the lowest rank,
+ * with T's const/volatile qualifiers, is produced. (This basically only acts
+ * to produce signed char when T = char.)
+ *
+ * mozilla::MakeSigned<unsigned long>::Type is signed long;
+ * mozilla::MakeSigned<volatile int>::Type is volatile int;
+ * mozilla::MakeSigned<const unsigned short>::Type is const signed short;
+ * mozilla::MakeSigned<const char>::Type is const signed char;
+ * mozilla::MakeSigned<bool> is an error;
+ * mozilla::MakeSigned<void*> is an error.
+ */
+template<typename T>
+struct MakeSigned
+ : EnableIf<IsIntegral<T>::value &&
+ !IsSame<bool, typename RemoveCV<T>::Type>::value,
+ typename detail::MakeSigned<T>
+ >::Type
+{};
+
+namespace detail {
+
+template<typename T>
+struct CorrespondingUnsigned;
+
+template<>
+struct CorrespondingUnsigned<char> { typedef unsigned char Type; };
+template<>
+struct CorrespondingUnsigned<signed char> { typedef unsigned char Type; };
+template<>
+struct CorrespondingUnsigned<short> { typedef unsigned short Type; };
+template<>
+struct CorrespondingUnsigned<int> { typedef unsigned int Type; };
+template<>
+struct CorrespondingUnsigned<long> { typedef unsigned long Type; };
+template<>
+struct CorrespondingUnsigned<long long> { typedef unsigned long long Type; };
+
+
+template<typename T,
+ typename CVRemoved = typename RemoveCV<T>::Type,
+ bool IsUnsignedIntegerType = IsUnsigned<CVRemoved>::value &&
+ !IsSame<char, CVRemoved>::value>
+struct MakeUnsigned;
+
+template<typename T, typename CVRemoved>
+struct MakeUnsigned<T, CVRemoved, true>
+{
+ typedef T Type;
+};
+
+template<typename T, typename CVRemoved>
+struct MakeUnsigned<T, CVRemoved, false>
+ : WithCV<IsConst<T>::value, IsVolatile<T>::value,
+ typename CorrespondingUnsigned<CVRemoved>::Type>
+{};
+
+} // namespace detail
+
+/**
+ * MakeUnsigned produces the corresponding unsigned integer type for a given
+ * integral type T, with the const/volatile qualifiers of T. T must be a
+ * possibly-const/volatile-qualified integral type that isn't bool.
+ *
+ * If T is already an unsigned integer type (not including char!), then T is
+ * produced.
+ *
+ * Otherwise, if T is a signed integer type, the unsigned variety of T, with
+ * T's const/volatile qualifiers, is produced.
+ *
+ * Otherwise, the unsigned integral type of the same size as T, with the lowest
+ * rank, with T's const/volatile qualifiers, is produced. (This basically only
+ * acts to produce unsigned char when T = char.)
+ *
+ * mozilla::MakeUnsigned<signed long>::Type is unsigned long;
+ * mozilla::MakeUnsigned<volatile unsigned int>::Type is volatile unsigned int;
+ * mozilla::MakeUnsigned<const signed short>::Type is const unsigned short;
+ * mozilla::MakeUnsigned<const char>::Type is const unsigned char;
+ * mozilla::MakeUnsigned<bool> is an error;
+ * mozilla::MakeUnsigned<void*> is an error.
+ */
+template<typename T>
+struct MakeUnsigned
+ : EnableIf<IsIntegral<T>::value &&
+ !IsSame<bool, typename RemoveCV<T>::Type>::value,
+ typename detail::MakeUnsigned<T>
+ >::Type
+{};
+
+/* 20.9.7.4 Array modifications [meta.trans.arr] */
+
+/**
+ * RemoveExtent produces either the type of the elements of the array T, or T
+ * itself.
+ *
+ * mozilla::RemoveExtent<int>::Type is int;
+ * mozilla::RemoveExtent<const int[]>::Type is const int;
+ * mozilla::RemoveExtent<volatile int[5]>::Type is volatile int;
+ * mozilla::RemoveExtent<long[][17]>::Type is long[17].
+ */
+template<typename T>
+struct RemoveExtent
+{
+ typedef T Type;
+};
+
+template<typename T>
+struct RemoveExtent<T[]>
+{
+ typedef T Type;
+};
+
+template<typename T, decltype(sizeof(1)) N>
+struct RemoveExtent<T[N]>
+{
+ typedef T Type;
+};
+
+/* 20.9.7.5 Pointer modifications [meta.trans.ptr] */
+
+namespace detail {
+
+template<typename T, typename CVRemoved>
+struct RemovePointerHelper
+{
+ typedef T Type;
+};
+
+template<typename T, typename Pointee>
+struct RemovePointerHelper<T, Pointee*>
+{
+ typedef Pointee Type;
+};
+
+} // namespace detail
+
+/**
+ * Produces the pointed-to type if a pointer is provided, else returns the input
+ * type. Note that this does not dereference pointer-to-member pointers.
+ *
+ * struct S { bool m; void f(); };
+ * mozilla::RemovePointer<int>::Type is int;
+ * mozilla::RemovePointer<int*>::Type is int;
+ * mozilla::RemovePointer<int* const>::Type is int;
+ * mozilla::RemovePointer<int* volatile>::Type is int;
+ * mozilla::RemovePointer<const long*>::Type is const long;
+ * mozilla::RemovePointer<void* const>::Type is void;
+ * mozilla::RemovePointer<void (S::*)()>::Type is void (S::*)();
+ * mozilla::RemovePointer<void (*)()>::Type is void();
+ * mozilla::RemovePointer<bool S::*>::Type is bool S::*.
+ */
+template<typename T>
+struct RemovePointer
+ : detail::RemovePointerHelper<T, typename RemoveCV<T>::Type>
+{};
+
+/* 20.9.7.6 Other transformations [meta.trans.other] */
+
+/**
+ * EnableIf is a struct containing a typedef of T if and only if B is true.
+ *
+ * mozilla::EnableIf<true, int>::Type is int;
+ * mozilla::EnableIf<false, int>::Type is a compile-time error.
+ *
+ * Use this template to implement SFINAE-style (Substitution Failure Is not An
+ * Error) requirements. For example, you might use it to impose a restriction
+ * on a template parameter:
+ *
+ * template<typename T>
+ * class PodVector // vector optimized to store POD (memcpy-able) types
+ * {
+ * EnableIf<IsPod<T>::value, T>::Type* vector;
+ * size_t length;
+ * ...
+ * };
+ */
+template<bool B, typename T>
+struct EnableIf
+{};
+
+template<typename T>
+struct EnableIf<true, T>
+{
+ typedef T Type;
+};
+
+/**
+ * Conditional selects a class between two, depending on a given boolean value.
+ *
+ * mozilla::Conditional<true, A, B>::Type is A;
+ * mozilla::Conditional<false, A, B>::Type is B;
+ */
+template<bool Condition, typename A, typename B>
+struct Conditional
+{
+ typedef A Type;
+};
+
+template<class A, class B>
+struct Conditional<false, A, B>
+{
+ typedef B Type;
+};
+
+} /* namespace mozilla */
+
+#endif /* mozilla_TypeTraits_h */
diff --git a/include/onlineupdate/mozilla/Types.h b/include/onlineupdate/mozilla/Types.h
new file mode 100644
index 000000000..9d1e34b6d
--- /dev/null
+++ b/include/onlineupdate/mozilla/Types.h
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* mfbt foundational types and macros. */
+
+#ifndef mozilla_Types_h
+#define mozilla_Types_h
+
+/*
+ * This header must be valid C and C++, includable by code embedding either
+ * SpiderMonkey or Gecko.
+ */
+
+/* Expose all <stdint.h> types and size_t. */
+#include <stddef.h>
+#include <stdint.h>
+
+/* Implement compiler and linker macros needed for APIs. */
+
+/*
+ * MOZ_EXPORT is used to declare and define a symbol or type which is externally
+ * visible to users of the current library. It encapsulates various decorations
+ * needed to properly export the method's symbol.
+ *
+ * api.h:
+ * extern MOZ_EXPORT int MeaningOfLife(void);
+ * extern MOZ_EXPORT int LuggageCombination;
+ *
+ * api.c:
+ * int MeaningOfLife(void) { return 42; }
+ * int LuggageCombination = 12345;
+ *
+ * If you are merely sharing a method across files, just use plain |extern|.
+ * These macros are designed for use by library interfaces -- not for normal
+ * methods or data used cross-file.
+ */
+#if defined(_WIN32)
+# define MOZ_EXPORT __declspec(dllexport)
+#else /* Unix */
+# ifdef HAVE_VISIBILITY_ATTRIBUTE
+# define MOZ_EXPORT __attribute__((visibility("default")))
+# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+# define MOZ_EXPORT __global
+# else
+# define MOZ_EXPORT /* nothing */
+# endif
+#endif
+
+
+/*
+ * Whereas implementers use MOZ_EXPORT to declare and define library symbols,
+ * users use MOZ_IMPORT_API and MOZ_IMPORT_DATA to access them. Most often the
+ * implementer of the library will expose an API macro which expands to either
+ * the export or import version of the macro, depending upon the compilation
+ * mode.
+ */
+#ifdef _WIN32
+# if defined(__MWERKS__)
+# define MOZ_IMPORT_API /* nothing */
+# else
+# define MOZ_IMPORT_API __declspec(dllimport)
+# endif
+#else
+# define MOZ_IMPORT_API MOZ_EXPORT
+#endif
+
+#if defined(_WIN32) && !defined(__MWERKS__)
+# define MOZ_IMPORT_DATA __declspec(dllimport)
+#else
+# define MOZ_IMPORT_DATA MOZ_EXPORT
+#endif
+
+/*
+ * Consistent with the above comment, the MFBT_API and MFBT_DATA macros expose
+ * export mfbt declarations when building mfbt, and they expose import mfbt
+ * declarations when using mfbt.
+ */
+#if defined(IMPL_MFBT)
+# define MFBT_API MOZ_EXPORT
+# define MFBT_DATA MOZ_EXPORT
+#else
+ /*
+ * On linux mozglue is linked in the program and we link libxul.so with
+ * -z,defs. Normally that causes the linker to reject undefined references in
+ * libxul.so, but as a loophole it allows undefined references to weak
+ * symbols. We add the weak attribute to the import version of the MFBT API
+ * macros to exploit this.
+ */
+# if defined(MOZ_GLUE_IN_PROGRAM) && !defined(MOZILLA_XPCOMRT_API)
+# define MFBT_API __attribute__((weak)) MOZ_IMPORT_API
+# define MFBT_DATA __attribute__((weak)) MOZ_IMPORT_DATA
+# else
+# define MFBT_API MOZ_IMPORT_API
+# define MFBT_DATA MOZ_IMPORT_DATA
+# endif
+#endif
+
+/*
+ * C symbols in C++ code must be declared immediately within |extern "C"|
+ * blocks. However, in C code, they need not be declared specially. This
+ * difference is abstracted behind the MOZ_BEGIN_EXTERN_C and MOZ_END_EXTERN_C
+ * macros, so that the user need not know whether he is being used in C or C++
+ * code.
+ *
+ * MOZ_BEGIN_EXTERN_C
+ *
+ * extern MOZ_EXPORT int MostRandomNumber(void);
+ * ...other declarations...
+ *
+ * MOZ_END_EXTERN_C
+ *
+ * This said, it is preferable to just use |extern "C"| in C++ header files for
+ * its greater clarity.
+ */
+#ifdef __cplusplus
+# define MOZ_BEGIN_EXTERN_C extern "C" {
+# define MOZ_END_EXTERN_C }
+#else
+# define MOZ_BEGIN_EXTERN_C
+# define MOZ_END_EXTERN_C
+#endif
+
+/*
+ * GCC's typeof is available when decltype is not.
+ */
+#if defined(__GNUC__) && defined(__cplusplus) && \
+ !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
+# define decltype __typeof__
+#endif
+
+#endif /* mozilla_Types_h */
diff --git a/include/onlineupdate/mozilla/nsTraceRefcnt.h b/include/onlineupdate/mozilla/nsTraceRefcnt.h
new file mode 100644
index 000000000..c5b1de7e8
--- /dev/null
+++ b/include/onlineupdate/mozilla/nsTraceRefcnt.h
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+#ifndef nsTraceRefcnt_h___
+#define nsTraceRefcnt_h___
+
+#include <stdio.h> // for FILE
+#include "nscore.h"
+
+class nsTraceRefcnt
+{
+public:
+ static void Shutdown();
+
+ enum StatisticsType {
+ ALL_STATS,
+ NEW_STATS
+ };
+
+ static nsresult DumpStatistics(StatisticsType aType = ALL_STATS,
+ FILE* aOut = 0);
+
+ static void ResetStatistics();
+
+ static void DemangleSymbol(const char* aSymbol, char* aBuffer, int aBufLen);
+
+ static void WalkTheStack(FILE* aStream);
+
+ /**
+ * This is a variant of |WalkTheStack| that uses |CodeAddressService| to cache
+ * the results of |NS_DescribeCodeAddress|. If |WalkTheStackCached| is being
+ * called frequently, it will be a few orders of magnitude faster than
+ * |WalkTheStack|. However, the cache uses a lot of memory, which can cause
+ * OOM crashes. Therefore, this should only be used for things like refcount
+ * logging which walk the stack extremely frequently.
+ */
+ static void WalkTheStackCached(FILE* aStream);
+
+ /**
+ * Tell nsTraceRefcnt whether refcounting, allocation, and destruction
+ * activity is legal. This is used to trigger assertions for any such
+ * activity that occurs because of static constructors or destructors.
+ */
+ static void SetActivityIsLegal(bool aLegal);
+};
+
+#define NS_TRACE_REFCNT_CONTRACTID "@mozilla.org/xpcom/trace-refcnt;1"
+#define NS_TRACE_REFCNT_CID \
+{ /* e3e7511e-a395-4924-94b1-d527861cded4 */ \
+ 0xe3e7511e, \
+ 0xa395, \
+ 0x4924, \
+ {0x94, 0xb1, 0xd5, 0x27, 0x86, 0x1c, 0xde, 0xd4} \
+} \
+
+////////////////////////////////////////////////////////////////////////////////
+// And now for that utility that you've all been asking for...
+
+extern "C" void
+NS_MeanAndStdDev(double aNumberOfValues,
+ double aSumOfValues, double aSumOfSquaredValues,
+ double* aMeanResult, double* aStdDevResult);
+
+////////////////////////////////////////////////////////////////////////////////
+#endif
diff --git a/include/oox/core/binarycodec.hxx b/include/oox/core/binarycodec.hxx
new file mode 100644
index 000000000..e7bfbaaa4
--- /dev/null
+++ b/include/oox/core/binarycodec.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_BINARYCODEC_HXX
+#define INCLUDED_OOX_CORE_BINARYCODEC_HXX
+
+#include <sal/config.h>
+
+#include <oox/dllapi.h>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace beans { struct NamedValue; }
+}
+
+namespace oox { class AttributeList; }
+
+namespace oox::core::CodecHelper
+{
+ /** Returns the password hash if it is in the required 16-bit limit. */
+ OOX_DLLPUBLIC sal_uInt16 getPasswordHash( const AttributeList& rAttribs, sal_Int32 nElement );
+} // namespace oox::core::CodecHelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/contexthandler.hxx b/include/oox/core/contexthandler.hxx
new file mode 100644
index 000000000..503b36d0c
--- /dev/null
+++ b/include/oox/core/contexthandler.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_CONTEXTHANDLER_HXX
+#define INCLUDED_OOX_CORE_CONTEXTHANDLER_HXX
+
+#include <memory>
+#include <string_view>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace xml::sax { class XFastAttributeList; }
+ namespace xml::sax { class XLocator; }
+}
+
+namespace oox { class SequenceInputStream; }
+
+namespace oox::core {
+
+class XmlFilterBase;
+struct Relation;
+class Relations;
+
+class ContextHandler;
+typedef ::rtl::Reference< ContextHandler > ContextHandlerRef;
+
+struct FragmentBaseData;
+typedef std::shared_ptr< FragmentBaseData > FragmentBaseDataRef;
+
+typedef ::cppu::WeakImplHelper< css::xml::sax::XFastContextHandler > ContextHandler_BASE;
+
+class OOX_DLLPUBLIC ContextHandler : public ContextHandler_BASE
+{
+public:
+ explicit ContextHandler( const ContextHandler& rParent );
+ virtual ~ContextHandler() override;
+
+ /** Returns the filter instance. */
+ XmlFilterBase& getFilter() const;
+ /** Returns the relations of the current fragment. */
+ const Relations& getRelations() const;
+ /** Returns the full path of the current fragment. */
+ const OUString& getFragmentPath() const;
+
+ /** Returns the full fragment path for the target of the passed relation. */
+ OUString getFragmentPathFromRelation( const Relation& rRelation ) const;
+ /** Returns the full fragment path for the passed relation identifier. */
+ OUString getFragmentPathFromRelId( const OUString& rRelId ) const;
+ /** Returns the full fragment path for the first relation of the passed type. */
+ OUString getFragmentPathFromFirstType( std::u16string_view rType ) const;
+ OUString getFragmentPathFromFirstTypeFromOfficeDoc( std::u16string_view rType ) const;
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) override;
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) override;
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual void SAL_CALL characters( const OUString& aChars ) override;
+
+ // record context interface -----------------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void endRecord( sal_Int32 nRecId );
+
+protected:
+ /** Helper constructor for the FragmentHandler. */
+ explicit ContextHandler( const FragmentBaseDataRef& rxBaseData );
+
+ void implSetLocator( const css::uno::Reference< css::xml::sax::XLocator >& rxLocator );
+
+#ifdef _MSC_VER
+ ContextHandler() {} // workaround
+#endif
+
+private:
+ ContextHandler& operator=( const ContextHandler& ) = delete;
+
+private:
+ FragmentBaseDataRef mxBaseData; ///< Base data of the fragment.
+};
+
+} // namespace oox::core
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/contexthandler2.hxx b/include/oox/core/contexthandler2.hxx
new file mode 100644
index 000000000..9843a40e9
--- /dev/null
+++ b/include/oox/core/contexthandler2.hxx
@@ -0,0 +1,291 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_CONTEXTHANDLER2_HXX
+#define INCLUDED_OOX_CORE_CONTEXTHANDLER2_HXX
+
+#include <cstddef>
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/core/contexthandler.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace xml::sax { class XFastAttributeList; }
+ namespace xml::sax { class XFastContextHandler; }
+}
+
+namespace oox {
+ class AttributeList;
+ class SequenceInputStream;
+}
+
+namespace oox::core {
+
+const sal_Int32 XML_ROOT_CONTEXT = SAL_MAX_INT32;
+
+struct ElementInfo;
+
+/** Helper class that provides a context stack.
+
+ Fragment handlers and context handlers derived from this helper class will
+ track the identifiers of the visited elements in a stack. The idea is to
+ use the same instance of a fragment handler or context handler to process
+ several nested elements in an XML stream. For that, the abstract function
+ onCreateContext() has to return 'this' for the passed element.
+
+ Derived classes have to implement the createFastChildContext(),
+ startFastElement(), characters(), and endFastElement() functions from the
+ com.sun.star.xml.sax.XFastContextHandler interface by simply forwarding
+ them to the respective implCreateChildContext(), implStartElement(),
+ implCharacters(), and implEndElement() functions of this helper. This is
+ implemented already in the classes ContextHandler2 and FragmentHandler2.
+ The new abstract functions have to be implemented according to the elements
+ to be processed.
+
+ Similarly, for binary import, derived classes have to forward the
+ createRecordContext(), startRecord(), and endRecord() functions from the
+ ContextHandler class to the implCreateRecordContext(), implStartRecord(),
+ and implEndRecord() functions of this helper. Again, this is implemented
+ already in the classes ContextHandler2 and FragmentHandler2.
+ */
+class OOX_DLLPUBLIC ContextHandler2Helper
+{
+public:
+ explicit ContextHandler2Helper( bool bEnableTrimSpace, XmlFilterBase& rFilter );
+ explicit ContextHandler2Helper( const ContextHandler2Helper& rParent );
+ virtual ~ContextHandler2Helper();
+
+ // allow instances to be stored in ::rtl::Reference
+ virtual void SAL_CALL acquire() noexcept = 0;
+ virtual void SAL_CALL release() noexcept = 0;
+
+ // interface --------------------------------------------------------------
+
+ /** Will be called to create a context handler for the passed element.
+
+ Usually 'this' can be returned to improve performance by reusing the
+ same instance to process several elements. Used by OOXML import only.
+ */
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) = 0;
+
+ /** Will be called when a new element has been started.
+
+ This function is called at the context handler returned from
+ onCreateContext(), or, for root elements of an XML stream, at the
+ fragment handler itself.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onStartElement( const AttributeList& rAttribs ) = 0;
+
+ /** Will be called before a new child element starts, or if the current
+ element is about to be left.
+
+ This helper function collects all text fragments received by the
+ characters() function (such as encoded characters which are passed in
+ separate calls to the characters() function), and passes the
+ concatenated and trimmed string.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onCharacters( const OUString& rChars ) = 0;
+
+ /** Will be called when the current element is about to be left.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onEndElement() = 0;
+
+ /** Will be called to create a context handler for the passed record.
+
+ Usually 'this' can be returned to improve performance by reusing the
+ same instance to process several records. Used by BIFF import only.
+ */
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) = 0;
+
+ /** Will be called when a new record block in a binary stream has been
+ started.
+
+ The current record identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by BIFF import only.
+ */
+ virtual void onStartRecord( SequenceInputStream& rStrm ) = 0;
+
+ /** Will be called when the current record block is about to be left.
+
+ The current record identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by BIFF import only.
+ */
+ virtual void onEndRecord() = 0;
+
+ // helpers ----------------------------------------------------------------
+
+ /** Returns the identifier of the currently processed element. Ignores MCE elements in stack */
+ sal_Int32 getCurrentElement() const;
+
+ /** Returns the identifier of the currently processed element - Including MCE root elements */
+ sal_Int32 getCurrentElementWithMce() const;
+
+ /** Returns true, if nElement contains the identifier of the currently
+ processed element. */
+ bool isCurrentElement( sal_Int32 nElement ) const
+ { return getCurrentElement() == nElement; }
+
+ /** Returns true, if either nElement1 or nElement2 contain the identifier
+ of the currently processed element. */
+ bool isCurrentElement( sal_Int32 nElement1, sal_Int32 nElement2 ) const
+ { return isCurrentElement( nElement1 ) || isCurrentElement( nElement2 ); }
+
+ /** Returns the identifier of the specified parent element. */
+ sal_Int32 getParentElement( sal_Int32 nCountBack = 1 ) const;
+
+ /** Returns true, if nElement contains the identifier of the specified
+ parent element. */
+ bool isParentElement( sal_Int32 nElement, sal_Int32 nCountBack = 1 ) const
+ { return getParentElement( nCountBack ) == nElement; }
+
+ /** Returns true, if the element currently processed is the root element of
+ the context or fragment handler. */
+ bool isRootElement() const;
+
+ // implementation ---------------------------------------------------------
+
+protected:
+ /** Must be called from createFastChildContext() in derived classes. */
+ css::uno::Reference< css::xml::sax::XFastContextHandler >
+ implCreateChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Must be called from startFastElement() in derived classes. */
+ void implStartElement(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Must be called from characters() in derived classes. */
+ void implCharacters( std::u16string_view rChars );
+
+ /** Must be called from endFastElement() in derived classes. */
+ void implEndElement( sal_Int32 nElement );
+
+ /** Must be called from createRecordContext() in derived classes. */
+ ContextHandlerRef implCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+
+ /** Must be called from startRecord() in derived classes. */
+ void implStartRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+
+ /** Must be called from endRecord() in derived classes. */
+ void implEndRecord( sal_Int32 nRecId );
+
+ bool prepareMceContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ XmlFilterBase& getDocFilter() const { return mrFilter; }
+
+ enum class MCE_STATE
+ {
+ Started,
+ FoundChoice
+ };
+
+ MCE_STATE getMCEState() const { return aMceState.back(); }
+ void setMCEState( MCE_STATE aState ) { aMceState.back() = aState; }
+ void addMCEState( MCE_STATE aState ) { aMceState.push_back( aState ); }
+ void removeMCEState() { aMceState.pop_back(); }
+ bool isMCEStateEmpty() const { return aMceState.empty(); }
+
+private:
+ ContextHandler2Helper& operator=( const ContextHandler2Helper& ) = delete;
+
+ ElementInfo& pushElementInfo( sal_Int32 nElement );
+ void popElementInfo();
+ void processCollectedChars();
+
+private:
+ typedef std::vector< ElementInfo > ContextStack;
+ typedef std::shared_ptr< ContextStack > ContextStackRef;
+
+ ContextStackRef mxContextStack; ///< Stack of all processed elements.
+ size_t mnRootStackSize; ///< Stack size on construction time.
+ std::vector<MCE_STATE> aMceState;
+
+protected:
+ bool mbEnableTrimSpace; ///< True = trim whitespace in characters().
+ XmlFilterBase& mrFilter;
+};
+
+class OOX_DLLPUBLIC ContextHandler2 : public ContextHandler, public ContextHandler2Helper
+{
+public:
+ explicit ContextHandler2( ContextHandler2Helper const & rParent );
+ virtual ~ContextHandler2() override;
+
+ ContextHandler2(ContextHandler2 const &) = default;
+ ContextHandler2(ContextHandler2 &&) = default;
+ ContextHandler2 & operator =(ContextHandler2 const &) = delete; // due to ContextHandler
+ ContextHandler2 & operator =(ContextHandler2 &&) = delete; // due to ContextHandler
+
+ // resolve ambiguity from base classes
+ virtual void SAL_CALL acquire() noexcept override { ContextHandler::acquire(); }
+ virtual void SAL_CALL release() noexcept override { ContextHandler::release(); }
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs ) final override;
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs ) final override;
+
+ virtual void SAL_CALL characters( const OUString& rChars ) final override;
+
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement ) final override;
+
+ // oox.core.ContextHandler interface --------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
+ virtual void endRecord( sal_Int32 nRecId ) override;
+
+ // oox.core.ContextHandler2Helper interface -------------------------------
+
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+ virtual void onStartElement( const AttributeList& rAttribs ) override;
+ virtual void onCharacters( const OUString& rChars ) override;
+ virtual void onEndElement() override;
+
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
+ virtual void onStartRecord( SequenceInputStream& rStrm ) override;
+ virtual void onEndRecord() override;
+};
+
+} // namespace oox::core
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fastparser.hxx b/include/oox/core/fastparser.hxx
new file mode 100644
index 000000000..058bd344b
--- /dev/null
+++ b/include/oox/core/fastparser.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_FASTPARSER_HXX
+#define INCLUDED_OOX_CORE_FASTPARSER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
+#include <sal/types.h>
+#include <oox/dllapi.h>
+
+namespace com::sun::star {
+ namespace io { class XInputStream; }
+ namespace uno { class XComponentContext; }
+ namespace xml::sax { class XFastDocumentHandler; }
+ namespace xml::sax { class XFastParser; }
+ namespace xml::sax { class XFastTokenHandler; }
+ namespace xml::sax { struct InputSource; }
+}
+
+namespace oox {
+ struct NamespaceMap;
+ class StorageBase;
+}
+
+namespace sax_fastparser {
+ class FastSaxParser;
+}
+
+namespace oox::core {
+
+
+/** Wrapper for a fast SAX parser that works on automatically generated OOXML
+ token and namespace identifiers.
+ */
+class OOX_DLLPUBLIC FastParser
+{
+public:
+ /// @throws css::uno::RuntimeException
+ explicit FastParser();
+
+ FastParser(const FastParser&) = delete;
+ FastParser& operator=(const FastParser&) = delete;
+
+ ~FastParser();
+
+ /** Registers an OOXML namespace at the parser.
+ @throws css::lang::IllegalArgumentException
+ @throws css::uno::RuntimeException
+ */
+ void registerNamespace( sal_Int32 nNamespaceId );
+
+ /** Sets the passed document handler that will receive the SAX parser events.
+ @throws css::uno::RuntimeException
+ */
+ void setDocumentHandler(
+ const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& rxDocHandler );
+
+ void clearDocumentHandler();
+
+ /** Parses the passed SAX input source.
+ @param bCloseStream True = closes the stream in the input source after parsing.
+ @throws css::xml::sax::SAXException
+ @throws css::io::IOException
+ @throws css::uno::RuntimeException
+ */
+ void parseStream( const css::xml::sax::InputSource& rInputSource, bool bCloseStream = false );
+
+ /** Parses the passed input stream.
+ @param bCloseStream True = closes the passed stream after parsing.
+ @throws css::xml::sax::SAXException
+ @throws css::io::IOException
+ @throws css::uno::RuntimeException
+ */
+ void parseStream(
+ const css::uno::Reference< css::io::XInputStream >& rxInStream,
+ const OUString& rStreamName );
+
+ /** Parses a stream from the passed storage with the specified name.
+ @param bCloseStream True = closes the stream after parsing.
+ @throws css::xml::sax::SAXException
+ @throws css::io::IOException
+ @throws css::uno::RuntimeException
+ */
+ void parseStream( StorageBase& rStorage, const OUString& rStreamName );
+
+ const css::uno::Reference< css::xml::sax::XFastTokenHandler >&
+ getTokenHandler() const { return mxTokenHandler; }
+
+private:
+ css::uno::Reference<css::xml::sax::XFastTokenHandler> mxTokenHandler;
+ const NamespaceMap& mrNamespaceMap;
+ rtl::Reference<sax_fastparser::FastSaxParser> mxParser;
+};
+
+
+} // namespace oox::core
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fasttokenhandler.hxx b/include/oox/core/fasttokenhandler.hxx
new file mode 100644
index 000000000..396474b98
--- /dev/null
+++ b/include/oox/core/fasttokenhandler.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_FASTTOKENHANDLER_HXX
+#define INCLUDED_OOX_CORE_FASTTOKENHANDLER_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <sax/fastattribs.hxx>
+
+namespace oox { class TokenMap; }
+
+namespace oox::core {
+
+
+/** Wrapper implementing the com.sun.star.xml.sax.XFastTokenHandler API interface
+ that provides access to the tokens generated from the internal token name list.
+ */
+class OOX_DLLPUBLIC FastTokenHandler final :
+ public cppu::ImplInheritanceHelper< sax_fastparser::FastTokenHandlerBase, css::lang::XServiceInfo >
+{
+public:
+ explicit FastTokenHandler();
+ virtual ~FastTokenHandler() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XFastTokenHandler
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 nToken ) override;
+ virtual sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) override;
+
+ // Much faster direct C++ shortcut to the method that matters
+ virtual sal_Int32 getTokenDirect( const char *pToken, sal_Int32 nLength ) const override;
+
+private:
+ const TokenMap& mrTokenMap; ///< Reference to global token map singleton.
+};
+
+
+} // namespace oox::core
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx
new file mode 100644
index 000000000..73b8e2d8e
--- /dev/null
+++ b/include/oox/core/filterbase.hxx
@@ -0,0 +1,274 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_FILTERBASE_HXX
+#define INCLUDED_OOX_CORE_FILTERBASE_HXX
+
+#include <memory>
+
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/storagebase.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace beans { struct PropertyValue; }
+ namespace drawing { class XShape; }
+ namespace frame { class XFrame; }
+ namespace frame { class XModel; }
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XStream; }
+ namespace lang { class XComponent; }
+ namespace lang { class XMultiServiceFactory; }
+ namespace task { class XStatusIndicator; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace comphelper {
+ class SequenceAsHashMap;
+}
+namespace utl {
+ class MediaDescriptor;
+}
+
+namespace oox {
+ class GraphicHelper;
+ class ModelObjectHelper;
+}
+
+namespace oox::ole {
+ class OleObjectHelper;
+ class VbaProject;
+}
+
+namespace oox::core {
+
+enum OoxmlVersion
+{
+ ECMA_DIALECT,
+ ISOIEC_29500_2008
+};
+
+struct FilterBaseImpl;
+
+typedef ::cppu::WeakImplHelper<
+ css::lang::XServiceInfo,
+ css::lang::XInitialization,
+ css::document::XImporter,
+ css::document::XExporter,
+ css::document::XFilter >
+ FilterBase_BASE;
+
+class OOX_DLLPUBLIC FilterBase : public FilterBase_BASE, public ::cppu::BaseMutex
+{
+public:
+ /// @throws css::uno::RuntimeException
+ explicit FilterBase(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+
+ virtual ~FilterBase() override;
+
+ /** Returns true, if filter is an import filter. */
+ bool isImportFilter() const;
+ /** Returns true, if filter is an export filter. */
+ bool isExportFilter() const;
+
+ OoxmlVersion getVersion() const;
+
+ /** Derived classes implement import of the entire document. */
+ virtual bool importDocument() = 0;
+
+ /** Derived classes implement export of the entire document. */
+ virtual bool exportDocument() = 0;
+
+
+ /** Returns the component context passed in the filter constructor (always existing). */
+ const css::uno::Reference< css::uno::XComponentContext >&
+ getComponentContext() const;
+
+ /** Returns the document model (always existing). */
+ const css::uno::Reference< css::frame::XModel >&
+ getModel() const;
+
+ /** Returns the service factory provided by the document model (always existing). */
+ const css::uno::Reference< css::lang::XMultiServiceFactory >&
+ getModelFactory() const;
+
+ /** Returns the frame that will contain the document model (may be null). */
+ const css::uno::Reference< css::frame::XFrame >&
+ getTargetFrame() const;
+
+ /** Returns the status indicator (may be null). */
+ const css::uno::Reference< css::task::XStatusIndicator >&
+ getStatusIndicator() const;
+
+ /** Returns the FilterData */
+ ::comphelper::SequenceAsHashMap& getFilterData() const;
+
+ /** Returns the media descriptor. */
+ utl::MediaDescriptor& getMediaDescriptor() const;
+
+ /** Returns the URL of the imported or exported file. */
+ const OUString& getFileUrl() const;
+
+ /** Returns an absolute URL for the passed relative or absolute URL. */
+ OUString getAbsoluteUrl( const OUString& rUrl ) const;
+
+ /** Returns the base storage of the imported/exported file. */
+ StorageRef const & getStorage() const;
+
+ /** Opens and returns the specified input stream from the base storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+ */
+ css::uno::Reference< css::io::XInputStream >
+ openInputStream( const OUString& rStreamName ) const;
+
+ /** Opens and returns the specified output stream from the base storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+ */
+ css::uno::Reference< css::io::XOutputStream >
+ openOutputStream( const OUString& rStreamName ) const;
+
+ /** Commits changes to base storage (and substorages) */
+ void commitStorage() const;
+
+ // helpers ----------------------------------------------------------------
+
+ /** Returns a helper for the handling of graphics and graphic objects. */
+ GraphicHelper& getGraphicHelper() const;
+
+ /** Returns a helper with containers for various named drawing objects for
+ the imported document. */
+ ModelObjectHelper& getModelObjectHelper() const;
+
+ ModelObjectHelper& getModelObjectHelperForModel(
+ const css::uno::Reference<css::lang::XMultiServiceFactory>& xFactory) const;
+
+ /** Returns a helper for the handling of OLE objects. */
+ ::oox::ole::OleObjectHelper& getOleObjectHelper() const;
+
+ /** Returns the VBA project manager. */
+ ::oox::ole::VbaProject& getVbaProject() const;
+
+ /** Imports the raw binary data from the specified stream.
+ @return True, if the data could be imported from the stream. */
+ bool importBinaryData( StreamDataSequence & orDataSeq, const OUString& rStreamName );
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& rServiceName ) override;
+
+ virtual css::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames() override;
+
+ // com.sun.star.lang.XInitialization interface ----------------------------
+
+ /** Receives user defined arguments.
+
+ @param rArgs
+ the sequence of arguments passed to the filter. The implementation
+ expects one or two arguments. The first argument shall be the
+ com.sun.star.lang.XMultiServiceFactory interface of the global
+ service factory. The optional second argument may contain a
+ sequence of com.sun.star.beans.NamedValue objects. The different
+ filter implementations may support different arguments.
+ */
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence< css::uno::Any >& rArgs ) override;
+
+ // com.sun.star.document.XImporter interface ------------------------------
+
+ virtual void SAL_CALL setTargetDocument(
+ const css::uno::Reference< css::lang::XComponent >& rxDocument ) override;
+
+ // com.sun.star.document.XExporter interface ------------------------------
+
+ virtual void SAL_CALL setSourceDocument(
+ const css::uno::Reference< css::lang::XComponent >& rxDocument ) override;
+
+ // com.sun.star.document.XFilter interface --------------------------------
+
+ virtual sal_Bool SAL_CALL filter(
+ const css::uno::Sequence< css::beans::PropertyValue >& rMediaDescSeq ) override;
+
+ virtual void SAL_CALL cancel() override;
+
+ bool exportVBA() const;
+
+ bool isExportTemplate() const;
+
+protected:
+ virtual css::uno::Reference< css::io::XInputStream >
+ implGetInputStream( utl::MediaDescriptor& rMediaDesc ) const;
+ virtual css::uno::Reference< css::io::XStream >
+ implGetOutputStream( utl::MediaDescriptor& rMediaDesc ) const;
+
+ virtual bool implFinalizeExport( utl::MediaDescriptor& rMediaDescriptor );
+
+ css::uno::Reference< css::io::XStream > const &
+ getMainDocumentStream( ) const;
+
+private:
+ void setMediaDescriptor(
+ const css::uno::Sequence< css::beans::PropertyValue >& rMediaDescSeq );
+
+ /** Derived classes may create a specialized graphic helper, e.g. for
+ resolving palette colors. */
+ virtual GraphicHelper* implCreateGraphicHelper() const;
+
+ /** Derived classes create a VBA project manager object. */
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const = 0;
+
+ virtual StorageRef implCreateStorage(
+ const css::uno::Reference< css::io::XInputStream >& rxInStream ) const = 0;
+ virtual StorageRef implCreateStorage(
+ const css::uno::Reference< css::io::XStream >& rxOutStream ) const = 0;
+
+private:
+ std::unique_ptr< FilterBaseImpl > mxImpl;
+};
+
+} // namespace oox::core
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/filterdetect.hxx b/include/oox/core/filterdetect.hxx
new file mode 100644
index 000000000..ec0cd81a5
--- /dev/null
+++ b/include/oox/core/filterdetect.hxx
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_FILTERDETECT_HXX
+#define INCLUDED_OOX_CORE_FILTERDETECT_HXX
+
+#include <vector>
+
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace beans { struct PropertyValue; }
+ namespace io { class XInputStream; }
+ namespace uno { class XComponentContext; }
+ namespace xml::sax { class XFastAttributeList; }
+ namespace xml::sax { class XFastContextHandler; }
+ namespace xml::sax { class XLocator; }
+}
+
+namespace utl { class MediaDescriptor; }
+
+namespace oox { class AttributeList; }
+
+namespace oox::core {
+
+enum class OOXMLVariant {
+ ECMA_Transitional,
+ ISO_Transitional,
+ ISO_Strict
+};
+
+
+/** Document handler specifically designed for detecting OOXML file formats.
+
+ It takes a reference to the filter string object via its constructor, and
+ puts the name of the detected filter to it, if it successfully finds one.
+ */
+class FilterDetectDocHandler final : public ::cppu::WeakImplHelper< css::xml::sax::XFastDocumentHandler >
+{
+public:
+ explicit FilterDetectDocHandler( const css::uno::Reference< css::uno::XComponentContext >& rxContext, OUString& rFilter, const OUString& rFileName );
+ virtual ~FilterDetectDocHandler() override;
+
+ // XFastDocumentHandler
+ virtual void SAL_CALL startDocument() override;
+ virtual void SAL_CALL endDocument() override;
+ virtual void SAL_CALL processingInstruction( const OUString& rTarget, const OUString& rData ) override;
+ virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& xLocator ) override;
+
+ // XFastContextHandler
+ virtual void SAL_CALL startFastElement( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual void SAL_CALL endFastElement( sal_Int32 Element ) override;
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) override;
+ virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual css::uno::Reference< XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual void SAL_CALL characters( const OUString& aChars ) override;
+
+private:
+ void parseRelationship( const AttributeList& rAttribs );
+
+ OUString getFilterNameFromContentType( std::u16string_view rContentType, const OUString& rFileName );
+ void parseContentTypesDefault( const AttributeList& rAttribs );
+ void parseContentTypesOverride( const AttributeList& rAttribs );
+
+private:
+ typedef ::std::vector< sal_Int32 > ContextVector;
+
+ OUString& mrFilterName;
+ OUString maFileName;
+ ContextVector maContextStack;
+ OUString maTargetPath;
+ OOXMLVariant maOOXMLVariant;
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+};
+
+
+class OOX_DLLPUBLIC FilterDetect final : public ::cppu::WeakImplHelper<css::document::XExtendedFilterDetection, css::lang::XServiceInfo>
+{
+public:
+ /// @throws css::uno::RuntimeException
+ explicit FilterDetect( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ virtual ~FilterDetect() override;
+
+ /** Tries to extract an unencrypted ZIP package from the passed media
+ descriptor.
+
+ First, this function checks if the input stream provided by the media
+ descriptor property 'InputStream' contains a ZIP package. If yes, this
+ stream is returned.
+
+ Second, this function checks if the 'ComponentData' property exists and
+ contains a sequence of com.sun.star.beans.NamedValue. If yes, a named
+ value is searched with the name 'DecryptedPackage' and a value of type
+ com.sun.star.io.XStream. If the input stream provided by this XStream
+ contains a ZIP package, this input stream is returned.
+
+ Third, this function checks if the input stream of the media descriptor
+ contains an OLE package. If yes, it checks the existence of the streams
+ 'EncryptionInfo' and 'EncryptedPackage' and tries to decrypt the package
+ into a temporary file. This may include requesting a password from the
+ media descriptor property 'Password' or from the user, using the
+ interaction handler provided by the descriptor. On success, and if the
+ decrypted package is a ZIP package, the XStream of the temporary file
+ is stored in the property 'ComponentData' of the media descriptor and
+ its input stream is returned.
+ */
+ css::uno::Reference< css::io::XInputStream >
+ extractUnencryptedPackage( utl::MediaDescriptor& rMediaDesc ) const;
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // com.sun.star.document.XExtendedFilterDetection interface ---------------
+
+ /** Detects MS Office 2007 file types and supports package decryption.
+
+ The following file types are detected:
+ - MS Word 2007 XML Document (*.docx, *.docm)
+ - MS Word 2007 XML Template (*.dotx, *.dotm)
+ - MS Excel 2007 XML Document (*.xlsx, *.xlsm)
+ - MS Excel 2007 BIFF12 Document (*.xlsb)
+ - MS Excel 2007 XML Template (*.xltx, *.xltm)
+ - MS Powerpoint 2007 XML Document (*.pptx, *.pptm)
+ - MS Powerpoint 2007 XML Template (*.potx, *.potm)
+
+ If the package is encrypted, the detection tries to decrypt it into a
+ temporary file. The user may be asked for a password. The XStream
+ interface of the temporary file will be stored in the 'ComponentData'
+ property of the passed media descriptor.
+ */
+ virtual OUString SAL_CALL
+ detect( css::uno::Sequence< css::beans::PropertyValue >& rMediaDescSeq ) override;
+
+private:
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+};
+
+
+} // namespace oox::core
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fragmenthandler.hxx b/include/oox/core/fragmenthandler.hxx
new file mode 100644
index 000000000..a3263ca1f
--- /dev/null
+++ b/include/oox/core/fragmenthandler.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_FRAGMENTHANDLER_HXX
+#define INCLUDED_OOX_CORE_FRAGMENTHANDLER_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/relations.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace io { class XInputStream; }
+ namespace xml::sax { class XFastAttributeList; }
+ namespace xml::sax { class XFastContextHandler; }
+ namespace xml::sax { class XLocator; }
+}
+
+namespace oox::core {
+
+class XmlFilterBase;
+
+/** Base data of a fragment.
+
+ This data is stored in a separate struct to make it accessible in every
+ child context handler of the fragment.
+ */
+struct FragmentBaseData
+{
+ XmlFilterBase& mrFilter;
+ const OUString maFragmentPath;
+ css::uno::Reference< css::xml::sax::XLocator >
+ mxLocator;
+ RelationsRef mxRelations;
+
+ explicit FragmentBaseData(
+ XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ RelationsRef const & xRelations );
+};
+
+
+/** Describes record identifiers used to create contexts in a binary stream.
+
+ If a record is used to start a new context, usually the record identifier
+ increased by 1 is used to mark the end of this context, e.g. the Excel
+ record SHEETDATA == 0x0091 starts the <sheetData> context, and the record
+ SHEETDATA_END == 0x0092 ends this context. But some records are used to
+ start a new context, though there is no identifier to end this context,
+ e.g. the ROW or EXTROW records. These record identifiers can be marked by
+ setting the mnEndRecId member of this struct to -1.
+ */
+struct RecordInfo
+{
+ sal_Int32 mnStartRecId; ///< Record identifier for context start.
+ sal_Int32 mnEndRecId; ///< Record identifier for context end, -1 = no record.
+};
+
+
+typedef ::cppu::ImplInheritanceHelper< ContextHandler, css::xml::sax::XFastDocumentHandler > FragmentHandler_BASE;
+
+class OOX_DLLPUBLIC FragmentHandler : public FragmentHandler_BASE
+{
+public:
+ explicit FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath );
+ virtual ~FragmentHandler() override;
+
+ FragmentHandler(FragmentHandler const &) = default;
+ FragmentHandler(FragmentHandler &&) = default;
+ FragmentHandler & operator =(FragmentHandler const &) = delete; // due to ContextHandler
+ FragmentHandler & operator =(FragmentHandler &&) = delete; // due to ContextHandler
+
+ /** Returns the com.sun.star.xml.sax.XFastContextHandler interface of this context. */
+ css::uno::Reference< css::xml::sax::XFastContextHandler >
+ getFastContextHandler() { return static_cast< ContextHandler* >( this ); }
+
+ // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
+
+ virtual void SAL_CALL startDocument() override;
+ virtual void SAL_CALL endDocument() override;
+ virtual void SAL_CALL processingInstruction( const OUString& rTarget, const OUString& rData ) override;
+ virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& rxLocator ) override;
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) override;
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) override;
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
+ virtual void SAL_CALL characters( const OUString& aChars ) override;
+
+ // XML stream handling ----------------------------------------------------
+
+ /** Opens the fragment stream referred by the own fragment path. Derived
+ classes may provide specialized stream implementations. */
+ virtual css::uno::Reference< css::io::XInputStream >
+ openFragmentStream() const;
+
+ // binary records ---------------------------------------------------------
+
+ virtual const RecordInfo* getRecordInfos() const;
+
+protected:
+ explicit FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations );
+};
+
+typedef ::rtl::Reference< FragmentHandler > FragmentHandlerRef;
+
+
+} // namespace oox::core
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fragmenthandler2.hxx b/include/oox/core/fragmenthandler2.hxx
new file mode 100644
index 000000000..05b2b2d0b
--- /dev/null
+++ b/include/oox/core/fragmenthandler2.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_FRAGMENTHANDLER2_HXX
+#define INCLUDED_OOX_CORE_FRAGMENTHANDLER2_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/contexthandler2.hxx>
+#include <oox/core/fragmenthandler.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace xml::sax { class XFastAttributeList; }
+ namespace xml::sax { class XFastContextHandler; }
+}
+
+namespace oox {
+ class AttributeList;
+ class SequenceInputStream;
+}
+
+namespace oox::core {
+
+class XmlFilterBase;
+
+class OOX_DLLPUBLIC FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper
+{
+public:
+ explicit FragmentHandler2(
+ XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ bool bEnableTrimSpace = true );
+ virtual ~FragmentHandler2() override;
+
+ FragmentHandler2(FragmentHandler2 const &) = default;
+ FragmentHandler2(FragmentHandler2 &&) = default;
+ FragmentHandler2 & operator =(FragmentHandler2 const &) = delete; // due to FragmentHandler
+ FragmentHandler2 & operator =(FragmentHandler2 &&) = delete; // due to FragmentHandler
+
+ // resolve ambiguity from base classes
+ virtual void SAL_CALL acquire() noexcept override { FragmentHandler::acquire(); }
+ virtual void SAL_CALL release() noexcept override { FragmentHandler::release(); }
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs ) final override;
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs ) final override;
+
+ virtual void SAL_CALL characters( const OUString& rChars ) final override;
+
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement ) final override;
+
+ // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
+
+ virtual void SAL_CALL startDocument() override;
+
+ virtual void SAL_CALL endDocument() override;
+
+ // oox.core.ContextHandler interface --------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
+ virtual void endRecord( sal_Int32 nRecId ) override;
+
+ // oox.core.ContextHandler2Helper interface -------------------------------
+
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+ virtual void onStartElement( const AttributeList& rAttribs ) override;
+ virtual void onCharacters( const OUString& rChars ) override;
+ virtual void onEndElement() override;
+
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
+ virtual void onStartRecord( SequenceInputStream& rStrm ) override;
+ virtual void onEndRecord() override;
+
+ // oox.core.FragmentHandler2 interface ------------------------------------
+
+ virtual void initializeImport();
+ virtual void finalizeImport();
+};
+
+typedef ::rtl::Reference< FragmentHandler2 > FragmentHandler2Ref;
+
+
+} // namespace oox::core
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/recordparser.hxx b/include/oox/core/recordparser.hxx
new file mode 100644
index 000000000..d8525ac8e
--- /dev/null
+++ b/include/oox/core/recordparser.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_RECORDPARSER_HXX
+#define INCLUDED_OOX_CORE_RECORDPARSER_HXX
+
+#include <map>
+#include <memory>
+
+#include <oox/helper/binaryinputstream.hxx>
+#include <oox/core/fragmenthandler.hxx>
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox {
+namespace core {
+
+namespace prv {
+ class ContextStack;
+ class Locator;
+}
+
+
+struct RecordInputSource
+{
+ BinaryInputStreamRef mxInStream;
+ OUString maSystemId;
+};
+
+
+class RecordParser final
+{
+public:
+ RecordParser();
+ ~RecordParser();
+
+ void setFragmentHandler( const ::rtl::Reference< FragmentHandler >& rxHandler );
+
+ /// @throws css::xml::sax::SAXException
+ /// @throws css::io::IOException
+ /// @throws css::uno::RuntimeException
+ void parseStream( const RecordInputSource& rInputSource );
+
+ const RecordInputSource& getInputSource() const { return maSource; }
+
+private:
+ /** Returns a RecordInfo struct that contains the passed record identifier
+ as context start identifier. */
+ const RecordInfo* getStartRecordInfo( sal_Int32 nRecId ) const;
+ /** Returns a RecordInfo struct that contains the passed record identifier
+ as context end identifier. */
+ const RecordInfo* getEndRecordInfo( sal_Int32 nRecId ) const;
+
+private:
+ typedef ::std::map< sal_Int32, RecordInfo > RecordInfoMap;
+
+ RecordInputSource maSource;
+ ::rtl::Reference< FragmentHandler > mxHandler;
+ ::rtl::Reference< prv::Locator > mxLocator;
+ ::std::unique_ptr< prv::ContextStack > mxStack;
+ RecordInfoMap maStartMap;
+ RecordInfoMap maEndMap;
+};
+
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/relations.hxx b/include/oox/core/relations.hxx
new file mode 100644
index 000000000..166652afe
--- /dev/null
+++ b/include/oox/core/relations.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_RELATIONS_HXX
+#define INCLUDED_OOX_CORE_RELATIONS_HXX
+
+#include <cstddef>
+#include <map>
+#include <memory>
+#include <string_view>
+
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace oox::core {
+
+
+/** Expands to an OUString containing an 'officeDocument' transitional relation type created
+ from the passed literal(!) ASCII(!) character array. */
+#define CREATE_OFFICEDOC_RELATION_TYPE( ascii ) \
+ ( u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/" ascii )
+
+/** Expands to an OUString containing an 'officeDocument' strict relation type created
+ from the passed literal(!) ASCII(!) character array. */
+#define CREATE_OFFICEDOC_RELATION_TYPE_STRICT( ascii ) \
+ ( "http://purl.oclc.org/ooxml/officeDocument/relationships/" ascii )
+
+/** Expands to an OUString containing an MS Office specific relation type
+ created from the passed literal(!) ASCII(!) character array. */
+#define CREATE_MSOFFICE_RELATION_TYPE( ascii ) \
+ ( u"http://schemas.microsoft.com/office/2006/relationships/" ascii )
+
+#define CREATE_XL_CONTENT_TYPE( ascii ) \
+ ( "application/vnd.openxmlformats-officedocument.spreadsheetml." ascii "+xml" )
+
+struct Relation
+{
+ OUString maId;
+ OUString maType;
+ OUString maTarget;
+ bool mbExternal;
+
+ Relation() : mbExternal( false ) {}
+};
+
+
+class Relations;
+typedef std::shared_ptr< Relations > RelationsRef;
+
+class OOX_DLLPUBLIC Relations
+{
+public:
+ explicit Relations( const OUString& rFragmentPath );
+
+ size_t size() const { return maMap.size(); }
+ size_t count( const OUString& rId ) const { return maMap.count( rId ); }
+ ::std::map< OUString, Relation >::const_iterator begin() const
+ {
+ return maMap.begin();
+ }
+ ::std::map< OUString, Relation >::const_iterator end() const
+ {
+ return maMap.end();
+ }
+ template<class... Args>
+ void emplace(Args&&... args)
+ {
+ maMap.emplace(std::forward<Args>(args)...);
+ }
+
+ /** Returns the path of the fragment this relations collection is related to. */
+ const OUString& getFragmentPath() const { return maFragmentPath; }
+
+ /** Returns the relation with the passed relation identifier. */
+ const Relation* getRelationFromRelId( const OUString& rId ) const;
+ /** Returns the first relation with the passed type. */
+ const Relation* getRelationFromFirstType( std::u16string_view rType ) const;
+ /** Finds all relations associated with the passed type. */
+ RelationsRef getRelationsFromTypeFromOfficeDoc( std::u16string_view rType ) const;
+
+ /** Returns the external target of the relation with the passed relation identifier. */
+ OUString getExternalTargetFromRelId( const OUString& rRelId ) const;
+ /** Returns the internal target of the relation with the passed relation identifier. */
+ OUString getInternalTargetFromRelId( const OUString& rRelId ) const;
+
+ /** Returns the full fragment path for the target of the passed relation. */
+ OUString getFragmentPathFromRelation( const Relation& rRelation ) const;
+ /** Returns the full fragment path for the passed relation identifier. */
+ OUString getFragmentPathFromRelId( const OUString& rRelId ) const;
+ /** Returns the full fragment path for the first relation of the passed type. */
+ OUString getFragmentPathFromFirstType( std::u16string_view rType ) const;
+ OUString getFragmentPathFromFirstTypeFromOfficeDoc( std::u16string_view rType ) const;
+
+private:
+ ::std::map< OUString, Relation > maMap;
+ OUString maFragmentPath;
+};
+
+
+} // namespace oox::core
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/relationshandler.hxx b/include/oox/core/relationshandler.hxx
new file mode 100644
index 000000000..ec8f77e92
--- /dev/null
+++ b/include/oox/core/relationshandler.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_RELATIONSHANDLER_HXX
+#define INCLUDED_OOX_CORE_RELATIONSHANDLER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/core/fragmenthandler.hxx>
+#include <oox/core/relations.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace xml::sax { class XFastAttributeList; }
+ namespace xml::sax { class XFastContextHandler; }
+}
+
+namespace oox::core {
+
+class XmlFilterBase;
+
+class RelationsFragment final : public FragmentHandler
+{
+public:
+ explicit RelationsFragment(
+ XmlFilterBase& rFilter,
+ const RelationsRef& xRelations );
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs ) override;
+
+private:
+ RelationsRef mxRelations;
+};
+
+
+} // namespace oox::core
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx
new file mode 100644
index 000000000..35312fda5
--- /dev/null
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -0,0 +1,297 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CORE_XMLFILTERBASE_HXX
+#define INCLUDED_OOX_CORE_XMLFILTERBASE_HXX
+
+#include <memory>
+#include <string_view>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/core/filterbase.hxx>
+#include <oox/core/relations.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/storagebase.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace document { class XDocumentProperties; }
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XStream; }
+ namespace text { class XText; }
+ namespace text { class XTextCursor; }
+ namespace text { class XTextField; }
+ namespace uno { class XComponentContext; }
+ namespace xml::dom { class XDocument; }
+ namespace xml::sax { class XFastSAXSerializable; }
+}
+
+namespace oox {
+ namespace drawingml { class Theme; }
+ namespace drawingml::chart { class ChartConverter; }
+ namespace drawingml::table {
+ class TableStyleList;
+ typedef std::shared_ptr< TableStyleList > TableStyleListPtr;
+ }
+ namespace vml { class Drawing; }
+}
+
+namespace rtl { template <class reference_type> class Reference; }
+
+namespace sax_fastparser {
+ class FastSerializerHelper;
+
+ typedef std::shared_ptr< FastSerializerHelper > FSHelperPtr;
+}
+
+namespace utl { class MediaDescriptor; }
+
+namespace oox::drawingml
+{
+class Shape;
+}
+
+namespace oox::core {
+
+class FragmentHandler;
+class FastParser;
+
+struct TextField {
+ css::uno::Reference< css::text::XText > xText;
+ css::uno::Reference< css::text::XTextCursor > xTextCursor;
+ css::uno::Reference< css::text::XTextField > xTextField;
+};
+typedef std::vector< TextField > TextFieldStack;
+
+struct XmlFilterBaseImpl;
+
+using ShapePairs
+ = std::map<std::shared_ptr<drawingml::Shape>, css::uno::Reference<css::drawing::XShape>>;
+using NamedShapePairs = std::map<OUString, ShapePairs>;
+
+class OOX_DLLPUBLIC XmlFilterBase : public FilterBase
+{
+public:
+ /// @throws css::uno::RuntimeException
+ explicit XmlFilterBase(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+
+ virtual ~XmlFilterBase() override;
+
+ /** Has to be implemented by each filter, returns the current theme. */
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const = 0;
+
+ /** May be implemented by filters which handle Diagrams, default returns empty ptr */
+ virtual std::shared_ptr<::oox::drawingml::Theme> getCurrentThemePtr() const;
+
+ /** Has to be implemented by each filter to return the collection of VML shapes. */
+ virtual ::oox::vml::Drawing* getVmlDrawing() = 0;
+
+ /** Has to be implemented by each filter, returns a filter-specific chart
+ converter object, that should be global per imported document. */
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter() = 0;
+
+ /** Helper to switch chart data table - specifically for xlsx imports */
+ virtual void useInternalChartDataTable( bool /*bInternal*/ ) { }
+
+ /** Has to be implemented by each filter to return the table style list. */
+ virtual ::oox::drawingml::table::TableStyleListPtr getTableStyles() = 0;
+
+
+ OUString getFragmentPathFromFirstTypeFromOfficeDoc( std::u16string_view rPart );
+
+ /** Imports a fragment using the passed fragment handler, which contains
+ the full path to the fragment stream.
+
+ @return True, if the fragment could be imported.
+ */
+ bool importFragment( const rtl::Reference<FragmentHandler>& rxHandler );
+ bool importFragment( const rtl::Reference<FragmentHandler>& rxHandler, FastParser& rParser );
+
+ /** Imports a fragment into an xml::dom::XDocument.
+
+ @param rFragmentPath path to fragment
+
+ @return a non-empty reference to the XDocument, if the
+ fragment could be imported.
+ */
+ css::uno::Reference< css::xml::dom::XDocument> importFragment( const OUString& rFragmentPath );
+
+ /** Imports a fragment from an xml::dom::XDocument using the
+ passed fragment handler
+
+ @param rxHandler fragment handler; path to fragment is
+ ignored, input source is the rxSerializer
+
+ @param rxSerializer usually retrieved from a
+ xml::dom::XDocument, will get serialized into rxHandler
+
+ @return true, if the fragment could be imported.
+ */
+ bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler,
+ const css::uno::Reference< css::xml::sax::XFastSAXSerializable >& rxSerializer );
+
+ /** Imports the relations fragment associated with the specified fragment.
+
+ @return The relations collection of the specified fragment.
+ */
+ RelationsRef importRelations( const OUString& rFragmentPath );
+
+ /** Adds new relation.
+
+ @param rType
+ Relation type.
+
+ @param rTarget
+ Relation target.
+
+ @return Added relation Id.
+ */
+ OUString addRelation( const OUString& rType, std::u16string_view rTarget );
+
+ /** Adds new relation to part's relations.
+
+ @param rPartName
+ Part name the relations are related to. The relations will be stored in <rPartName::path>/_rels/<rPartName::name>.rels.
+
+ @param rType
+ Relation type.
+
+ @param rTarget
+ Relation target.
+
+ @return Added relation Id.
+ */
+ OUString addRelation( const css::uno::Reference< css::io::XOutputStream >& rOutputStream, const OUString& rType, std::u16string_view rTarget, bool bExternal = false );
+
+ /** Returns a stack of used textfields, used by the pptx importer to replace links to slidepages with the real page name */
+ TextFieldStack& getTextFieldStack() const;
+
+ /** Opens and returns the specified output stream from the base storage with specified media type.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+
+ @param rMediaType
+ The media type string, used in [Content_Types].xml stream in base
+ storage.
+
+ @return The opened output stream.
+ */
+ css::uno::Reference< css::io::XOutputStream >
+ openFragmentStream(
+ const OUString& rStreamName,
+ const OUString& rMediaType );
+
+ /** Opens specified output stream from the base storage with specified
+ media type and returns new fast serializer for that stream.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+
+ @param rMediaType
+ The media type string, used in [Content_Types].xml stream in base
+ storage.
+
+ @return newly created serializer helper.
+ */
+ ::sax_fastparser::FSHelperPtr
+ openFragmentStreamWithSerializer(
+ const OUString& rStreamName,
+ const OUString& rMediaType );
+
+ /** Returns new unique ID for exported document.
+
+ @return newly created ID.
+ */
+ sal_Int32 GetUniqueId() { return mnMaxDocId++; }
+
+ /** Write the document properties into into the current OPC package.
+
+ @param xProperties The document properties to export.
+ */
+ void exportDocumentProperties( const css::uno::Reference< css::document::XDocumentProperties >& xProperties, bool bSecurityOptOpenReadOnly );
+
+ /** Write the customXml entries we are preserving (xlsx and pptx only). */
+ void exportCustomFragments();
+
+ /** Read the document properties and also the customXml entries (xlsx and pptx only). */
+ void importDocumentProperties();
+
+ static void putPropertiesToDocumentGrabBag(const css::uno::Reference<css::lang::XComponent>& xDstDoc,
+ const comphelper::SequenceAsHashMap& rProperties);
+
+ static FastParser* createParser();
+
+ bool isMSO2007Document() const;
+ bool isMSODocument() const;
+
+ /// Signal that an MSO 2007-created SmartArt was found, need to warn the
+ /// user about it.
+ void setMissingExtDrawing();
+
+ void setDiagramFontHeights(NamedShapePairs* pDiagramFontHeights);
+ NamedShapePairs* getDiagramFontHeights();
+
+ void checkDocumentProperties(
+ const css::uno::Reference<css::document::XDocumentProperties>& xDocProps);
+
+ OUString getNamespaceURL(sal_Int32 nNSID) const;
+
+protected:
+ virtual css::uno::Reference< css::io::XInputStream >
+ implGetInputStream( utl::MediaDescriptor& rMediaDesc ) const override;
+
+ virtual css::uno::Reference< css::io::XStream >
+ implGetOutputStream( utl::MediaDescriptor& rMediaDesc ) const override;
+
+ virtual bool implFinalizeExport( utl::MediaDescriptor& rMediaDescriptor ) override;
+
+private:
+ virtual StorageRef implCreateStorage(
+ const css::uno::Reference< css::io::XInputStream >& rxInStream ) const override;
+ virtual StorageRef implCreateStorage(
+ const css::uno::Reference< css::io::XStream >& rxOutStream ) const override;
+
+ void importCustomFragments(css::uno::Reference<css::embed::XStorage> const & xDocumentStorage);
+
+private:
+ ::std::unique_ptr< XmlFilterBaseImpl > mxImpl;
+ sal_Int32 mnRelId;
+ sal_Int32 mnMaxDocId;
+ bool mbMSO2007;
+ bool mbMSO;
+protected:
+ bool mbMissingExtDrawing;
+};
+
+} // namespace oox::core
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/crypto/AgileEngine.hxx b/include/oox/crypto/AgileEngine.hxx
new file mode 100644
index 000000000..ece492871
--- /dev/null
+++ b/include/oox/crypto/AgileEngine.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_OOX_CRYPTO_AGILEENGINE_HXX
+#define INCLUDED_OOX_CRYPTO_AGILEENGINE_HXX
+
+#include <vector>
+
+#include <oox/dllapi.h>
+#include <oox/crypto/CryptTools.hxx>
+#include <oox/crypto/CryptoEngine.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox {
+ class BinaryXInputStream;
+ class BinaryXOutputStream;
+}
+
+namespace oox::crypto {
+
+struct OOX_DLLPUBLIC AgileEncryptionInfo
+{
+ sal_Int32 spinCount;
+ sal_Int32 saltSize;
+ sal_Int32 keyBits;
+ sal_Int32 hashSize;
+ sal_Int32 blockSize;
+
+ OUString cipherAlgorithm;
+ OUString cipherChaining;
+ OUString hashAlgorithm;
+
+ std::vector<sal_uInt8> keyDataSalt;
+
+ // Key Encryptor
+ std::vector<sal_uInt8> saltValue;
+ std::vector<sal_uInt8> encryptedVerifierHashInput;
+ std::vector<sal_uInt8> encryptedVerifierHashValue;
+ std::vector<sal_uInt8> encryptedKeyValue;
+
+ // HMAC
+ std::vector<sal_uInt8> hmacKey;
+ std::vector<sal_uInt8> hmacHash;
+ std::vector<sal_uInt8> hmacCalculatedHash;
+ std::vector<sal_uInt8> hmacEncryptedKey; // encrypted Key
+ std::vector<sal_uInt8> hmacEncryptedValue; // encrypted Hash
+};
+
+struct OOX_DLLPUBLIC AgileEncryptionParameters
+{
+ sal_Int32 spinCount;
+ sal_Int32 saltSize;
+ sal_Int32 keyBits;
+ sal_Int32 hashSize;
+ sal_Int32 blockSize;
+
+ OUString cipherAlgorithm;
+ OUString cipherChaining;
+ OUString hashAlgorithm;
+};
+
+enum class AgileEncryptionPreset
+{
+ AES_128_SHA1,
+ AES_256_SHA512,
+};
+
+class OOX_DLLPUBLIC AgileEngine final : public CryptoEngine
+{
+private:
+ AgileEncryptionInfo mInfo;
+ AgileEncryptionPreset meEncryptionPreset;
+
+ void calculateHashFinal(const OUString& rPassword, std::vector<sal_uInt8>& aHashFinal);
+
+ void calculateBlock(
+ std::vector<sal_uInt8> const & rBlock,
+ std::vector<sal_uInt8>& rHashFinal,
+ std::vector<sal_uInt8>& rInput,
+ std::vector<sal_uInt8>& rOutput);
+
+ void encryptBlock(
+ std::vector<sal_uInt8> const & rBlock,
+ std::vector<sal_uInt8>& rHashFinal,
+ std::vector<sal_uInt8>& rInput,
+ std::vector<sal_uInt8>& rOutput);
+
+ static Crypto::CryptoType cryptoType(const AgileEncryptionInfo& rInfo);
+
+public:
+ AgileEngine();
+
+ AgileEncryptionInfo& getInfo() { return mInfo;}
+
+ void setPreset(AgileEncryptionPreset ePreset)
+ {
+ meEncryptionPreset = ePreset;
+ }
+
+ // Decryption
+
+ void decryptEncryptionKey(OUString const & rPassword);
+ bool decryptAndCheckVerifierHash(OUString const & rPassword);
+
+ bool generateEncryptionKey(OUString const & rPassword) override;
+ bool readEncryptionInfo(css::uno::Reference<css::io::XInputStream> & rxInputStream) override;
+ bool decrypt(BinaryXInputStream& aInputStream,
+ BinaryXOutputStream& aOutputStream) override;
+
+ bool checkDataIntegrity() override;
+
+ bool decryptHmacKey();
+ bool decryptHmacValue();
+
+ // Encryption
+
+ void writeEncryptionInfo(BinaryXOutputStream& rStream) override;
+
+ void encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ css::uno::Reference<css::io::XOutputStream>& rxOutputStream,
+ sal_uInt32 nSize) override;
+
+ bool setupEncryption(OUString const & rPassword) override;
+
+ bool generateAndEncryptVerifierHash(OUString const & rPassword);
+
+ bool encryptHmacKey();
+ bool encryptHmacValue();
+
+ bool encryptEncryptionKey(OUString const & rPassword);
+ void setupEncryptionParameters(AgileEncryptionParameters const & rAgileEncryptionParameters);
+ bool setupEncryptionKey(OUString const & rPassword);
+};
+
+} // namespace oox::crypto
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/crypto/CryptTools.hxx b/include/oox/crypto/CryptTools.hxx
new file mode 100644
index 000000000..c8c142007
--- /dev/null
+++ b/include/oox/crypto/CryptTools.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_CRYPTO_CRYPTTOOLS_HXX
+#define INCLUDED_OOX_CRYPTO_CRYPTTOOLS_HXX
+
+#include <oox/dllapi.h>
+#include <sal/types.h>
+
+#include <vector>
+#include <memory>
+
+namespace oox::crypto {
+
+/** Rounds up the input to the nearest multiple
+ *
+ * For example:
+ * input 1, multiple 16 = 16
+ * input 16, multiple 16 = 16
+ * input 17, multiple 16 = 32
+ * input 31, multiple 16 = 32
+ */
+template<typename T>
+T roundUp(T input, T multiple)
+{
+ if (input % multiple == 0)
+ return input;
+ return ((input / multiple) * multiple) + multiple;
+}
+
+enum class CryptoHashType
+{
+ SHA1,
+ SHA256,
+ SHA512
+};
+
+struct CryptoImpl;
+
+class OOX_DLLPUBLIC Crypto
+{
+public:
+ enum CryptoType
+ {
+ UNKNOWN,
+ AES_128_ECB,
+ AES_128_CBC,
+ AES_256_CBC,
+ };
+
+protected:
+ std::unique_ptr<CryptoImpl> mpImpl;
+
+protected:
+ Crypto();
+
+public:
+ virtual ~Crypto();
+};
+
+class Decrypt final : public Crypto
+{
+public:
+ Decrypt(std::vector<sal_uInt8>& key, std::vector<sal_uInt8>& iv, CryptoType type);
+
+ sal_uInt32 update(
+ std::vector<sal_uInt8>& output,
+ std::vector<sal_uInt8>& input,
+ sal_uInt32 inputLength = 0);
+
+
+ static sal_uInt32 aes128ecb(
+ std::vector<sal_uInt8>& output,
+ std::vector<sal_uInt8>& input,
+ std::vector<sal_uInt8>& key );
+
+};
+
+class Encrypt final : public Crypto
+{
+public:
+ Encrypt(std::vector<sal_uInt8>& key, std::vector<sal_uInt8>& iv, CryptoType type);
+
+ sal_uInt32 update(
+ std::vector<sal_uInt8>& output,
+ std::vector<sal_uInt8>& input,
+ sal_uInt32 inputLength = 0);
+};
+
+class OOX_DLLPUBLIC CryptoHash final : public Crypto
+{
+ sal_Int32 mnHashSize;
+public:
+ CryptoHash(std::vector<sal_uInt8>& rKey, CryptoHashType eType);
+ bool update(std::vector<sal_uInt8>& rInput, sal_uInt32 nInputLength = 0);
+ std::vector<sal_uInt8> finalize();
+};
+
+
+} // namespace oox::crypto
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/crypto/CryptoEngine.hxx b/include/oox/crypto/CryptoEngine.hxx
new file mode 100644
index 000000000..49009ac7e
--- /dev/null
+++ b/include/oox/crypto/CryptoEngine.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_OOX_CRYPTO_CRYPTOENGINE_HXX
+#define INCLUDED_OOX_CRYPTO_CRYPTOENGINE_HXX
+
+#include <vector>
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+namespace oox {
+ class BinaryXInputStream;
+ class BinaryXOutputStream;
+}
+
+namespace oox::crypto {
+
+class CryptoEngine
+{
+protected:
+ std::vector<sal_uInt8> mKey;
+
+public:
+ CryptoEngine()
+ {}
+
+ virtual ~CryptoEngine()
+ {}
+
+ // Decryption
+ virtual bool readEncryptionInfo(css::uno::Reference<css::io::XInputStream> & rxInputStream) = 0;
+
+ virtual bool generateEncryptionKey(const OUString& rPassword) = 0;
+
+ virtual bool decrypt(
+ BinaryXInputStream& aInputStream,
+ BinaryXOutputStream& aOutputStream) = 0;
+
+ // Encryption
+ virtual void writeEncryptionInfo(BinaryXOutputStream & rStream) = 0;
+
+ virtual bool setupEncryption(const OUString& rPassword) = 0;
+
+ virtual void encrypt(const css::uno::Reference<css::io::XInputStream> & rxInputStream,
+ css::uno::Reference<css::io::XOutputStream> & rxOutputStream,
+ sal_uInt32 nSize) = 0;
+
+ virtual bool checkDataIntegrity() = 0;
+};
+
+} // namespace oox::crypto
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/crypto/DocumentDecryption.hxx b/include/oox/crypto/DocumentDecryption.hxx
new file mode 100644
index 000000000..33cab866f
--- /dev/null
+++ b/include/oox/crypto/DocumentDecryption.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_OOX_CRYPTO_DOCUMENTDECRYPTION_HXX
+#define INCLUDED_OOX_CRYPTO_DOCUMENTDECRYPTION_HXX
+
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star {
+ namespace beans { struct NamedValue; }
+ namespace io { class XInputStream; }
+ namespace io { class XStream; }
+ namespace uno { class XComponentContext; }
+ namespace packages { class XPackageEncryption; }
+}
+
+namespace oox::ole { class OleStorage; }
+
+namespace oox::crypto {
+
+class DocumentDecryption
+{
+private:
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ oox::ole::OleStorage& mrOleStorage;
+ css::uno::Sequence<css::beans::NamedValue> maStreamsSequence;
+ css::uno::Reference< css::packages::XPackageEncryption > mxPackageEncryption;
+
+public:
+ DocumentDecryption(const css::uno::Reference< css::uno::XComponentContext >& rxContext, oox::ole::OleStorage& rOleStorage);
+
+ bool decrypt(const css::uno::Reference< css::io::XStream >& xDocumentStream);
+ bool readEncryptionInfo();
+ bool generateEncryptionKey(const OUString& rPassword);
+
+ css::uno::Sequence< css::beans::NamedValue > createEncryptionData(const OUString& rPassword);
+
+};
+
+} // namespace oox::crypto
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/crypto/DocumentEncryption.hxx b/include/oox/crypto/DocumentEncryption.hxx
new file mode 100644
index 000000000..c2a3bd4ed
--- /dev/null
+++ b/include/oox/crypto/DocumentEncryption.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_OOX_CRYPTO_DOCUMENTENCRYPTION_HXX
+#define INCLUDED_OOX_CRYPTO_DOCUMENTENCRYPTION_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace com::sun::star {
+ namespace io { class XStream; }
+ namespace packages { class XPackageEncryption; }
+ namespace beans { struct NamedValue; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox::ole { class OleStorage; }
+
+namespace oox::crypto {
+
+class DocumentEncryption
+{
+private:
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ css::uno::Reference< css::io::XStream > mxDocumentStream;
+ oox::ole::OleStorage& mrOleStorage;
+
+ css::uno::Reference< css::packages::XPackageEncryption > mxPackageEncryption;
+ const css::uno::Sequence< css::beans::NamedValue >& mMediaEncData;
+
+public:
+ DocumentEncryption(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ css::uno::Reference< css::io::XStream > const & xDocumentStream,
+ oox::ole::OleStorage& rOleStorage,
+ const css::uno::Sequence< css::beans::NamedValue >& rMediaEncData);
+
+ bool encrypt();
+
+};
+
+} // namespace oox::crypto
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/crypto/Standard2007Engine.hxx b/include/oox/crypto/Standard2007Engine.hxx
new file mode 100644
index 000000000..8a7aec3e6
--- /dev/null
+++ b/include/oox/crypto/Standard2007Engine.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_OOX_CRYPTO_STANDARD2007ENGINE_HXX
+#define INCLUDED_OOX_CRYPTO_STANDARD2007ENGINE_HXX
+
+#include <oox/dllapi.h>
+#include <oox/crypto/CryptoEngine.hxx>
+#include <filter/msfilter/mscodec.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox {
+ class BinaryXInputStream;
+ class BinaryXOutputStream;
+}
+
+namespace oox::crypto {
+
+class OOX_DLLPUBLIC Standard2007Engine final : public CryptoEngine
+{
+ msfilter::StandardEncryptionInfo mInfo;
+
+ bool generateVerifier();
+ bool calculateEncryptionKey(const OUString& rPassword);
+
+public:
+ Standard2007Engine() = default;
+
+ bool readEncryptionInfo(css::uno::Reference<css::io::XInputStream> & rxInputStream) override;
+
+ virtual bool generateEncryptionKey(OUString const & rPassword) override;
+
+ virtual bool decrypt(
+ BinaryXInputStream& aInputStream,
+ BinaryXOutputStream& aOutputStream) override;
+
+ bool checkDataIntegrity() override;
+
+ void encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ css::uno::Reference<css::io::XOutputStream>& rxOutputStream,
+ sal_uInt32 nSize) override;
+
+ virtual void writeEncryptionInfo(BinaryXOutputStream& rStream) override;
+
+ virtual bool setupEncryption(OUString const & rPassword) override;
+
+};
+
+} // namespace oox::crypto
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/crypto/StrongEncryptionDataSpace.hxx b/include/oox/crypto/StrongEncryptionDataSpace.hxx
new file mode 100644
index 000000000..cd7156515
--- /dev/null
+++ b/include/oox/crypto/StrongEncryptionDataSpace.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_OOX_CRYPTO_STRONGENCRYPTINDATASPACE_HXX
+#define INCLUDED_OOX_CRYPTO_STRONGENCRYPTINDATASPACE_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/packages/XPackageEncryption.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <oox/crypto/CryptoEngine.hxx>
+
+namespace com::sun::star::uno
+{
+class XComponentContext;
+}
+
+namespace oox::crypto
+{
+class StrongEncryptionDataSpace final
+ : public cppu::WeakImplHelper<css::lang::XServiceInfo, css::packages::XPackageEncryption>
+{
+ css::uno::Reference<css::uno::XComponentContext> mxContext;
+ std::unique_ptr<CryptoEngine> mCryptoEngine;
+
+ css::uno::Reference<css::io::XInputStream>
+ getStream(const css::uno::Sequence<css::beans::NamedValue>& rStreams,
+ std::u16string_view sStreamName);
+
+public:
+ StrongEncryptionDataSpace(const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+
+ // Decryption
+
+ virtual sal_Bool SAL_CALL generateEncryptionKey(const OUString& rPassword) override;
+ virtual sal_Bool SAL_CALL
+ readEncryptionInfo(const css::uno::Sequence<css::beans::NamedValue>& aStreams) override;
+ virtual sal_Bool SAL_CALL
+ decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
+
+ virtual sal_Bool SAL_CALL checkDataIntegrity() override;
+
+ // Encryption
+
+ virtual css::uno::Sequence<css::beans::NamedValue>
+ SAL_CALL encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream) override;
+
+ virtual sal_Bool SAL_CALL
+ setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
+
+ virtual css::uno::Sequence<css::beans::NamedValue>
+ SAL_CALL createEncryptionData(const OUString& rPassword) override;
+
+ // com.sun.star.lang.XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+} // namespace oox::crypto
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dllapi.h b/include/oox/dllapi.h
new file mode 100644
index 000000000..a03fd0b21
--- /dev/null
+++ b/include/oox/dllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DLLAPI_H
+#define INCLUDED_OOX_DLLAPI_H
+
+#include <sal/types.h>
+
+#if defined OOX_DLLIMPLEMENTATION
+#define OOX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define OOX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartconverter.hxx b/include/oox/drawingml/chart/chartconverter.hxx
new file mode 100644
index 000000000..fcf3b2fee
--- /dev/null
+++ b/include/oox/drawingml/chart/chartconverter.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
+#define INCLUDED_OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star {
+ namespace awt { struct Point; }
+ namespace awt { struct Size; }
+ namespace drawing { class XShapes; }
+ namespace chart2 { class XChartDocument; }
+ namespace chart2::data { class XDataProvider; }
+ namespace chart2::data { class XDataSequence; }
+}
+
+namespace oox::core { class XmlFilterBase; }
+
+namespace oox::drawingml::chart {
+
+struct ChartSpaceModel;
+struct DataSequenceModel;
+
+
+class OOX_DLLPUBLIC ChartConverter
+{
+public:
+ explicit ChartConverter();
+ virtual ~ChartConverter();
+
+ /** Converts the passed OOXML chart model to the passed chart2 document.
+
+ @param rChartModel The filled MSOOXML chart model structure.
+
+ @param rxChartDoc The UNO chart document model to be initialized.
+
+ @param rxExternalPage If null, all embedded shapes will be inserted
+ into the internal drawing page of the chart document. If not null,
+ all embedded shapes will be inserted into this shapes collection.
+
+ @param rChartPos The position of the chart shape in its drawing page,
+ in 1/100 mm. Will be used only, if parameter rxExternalPage is not
+ null, for correct positioning of the embedded shapes in the
+ external drawing page.
+
+ @param rChartSize The size of the chart shape in 1/100 mm. Needed for
+ calculation of position and size of the chart elements (diagram,
+ titles, legend, etc.) and embedded shapes.
+ */
+ void convertFromModel(
+ ::oox::core::XmlFilterBase& rFilter,
+ ChartSpaceModel& rChartModel,
+ const css::uno::Reference< css::chart2::XChartDocument >& rxChartDoc,
+ const css::uno::Reference< css::drawing::XShapes >& rxExternalPage,
+ const css::awt::Point& rChartPos,
+ const css::awt::Size& rChartSize );
+
+ /** Creates an internal data provider. Derived classes may override this
+ function to create an external data provider. */
+ virtual void createDataProvider(
+ const css::uno::Reference< css::chart2::XChartDocument >& rxChartDoc );
+
+ /** Creates a data sequence from a formula. Dummy implementation. Derived
+ classes have to override this function to actually parse the formula. */
+ virtual css::uno::Reference<css::chart2::data::XDataSequence>
+ createDataSequence(
+ const css::uno::Reference<css::chart2::data::XDataProvider>& rxDataProvider,
+ const DataSequenceModel& rDataSeq, const OUString& rRole,
+ const OUString& aRoleQualifier );
+
+private:
+ ChartConverter( const ChartConverter& ) = delete;
+ ChartConverter& operator=( const ChartConverter& ) = delete;
+};
+
+
+} // namespace oox::drawingml::chart
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/datasourcemodel.hxx b/include/oox/drawingml/chart/datasourcemodel.hxx
new file mode 100644
index 000000000..49b8dcd90
--- /dev/null
+++ b/include/oox/drawingml/chart/datasourcemodel.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_CHART_DATASOURCEMODEL_HXX
+#define INCLUDED_OOX_DRAWINGML_CHART_DATASOURCEMODEL_HXX
+
+#include <map>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <oox/drawingml/chart/modelbase.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+enum class SvNumFormatType : sal_Int16;
+
+namespace oox::drawingml::chart {
+
+
+struct DataSequenceModel
+{
+ typedef ::std::map< sal_Int32, css::uno::Any > AnyMap;
+
+ AnyMap maData; /// Map of values, indexed by point identifier.
+ OUString maFormula; /// Formula reference, e.g. into a spreadsheet.
+ OUString maFormatCode; /// Number format for double values.
+ sal_Int32 mnPointCount; /// Number of points in this series source.
+ sal_Int32 mnLevelCount; /// Number of category levels.
+ SvNumFormatType meFormatType; /// Type of number format in maFormatCode.
+
+ explicit DataSequenceModel();
+ ~DataSequenceModel();
+};
+
+
+struct DataSourceModel
+{
+ typedef ModelRef< DataSequenceModel > DataSequenceRef;
+
+ DataSequenceRef mxDataSeq; /// The data sequence or formula link of this source.
+
+ explicit DataSourceModel();
+ ~DataSourceModel();
+};
+
+
+} // namespace oox::drawingml::chart
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/modelbase.hxx b/include/oox/drawingml/chart/modelbase.hxx
new file mode 100644
index 000000000..581713bbc
--- /dev/null
+++ b/include/oox/drawingml/chart/modelbase.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_CHART_MODELBASE_HXX
+#define INCLUDED_OOX_DRAWINGML_CHART_MODELBASE_HXX
+
+#include <memory>
+
+#include <oox/helper/refmap.hxx>
+#include <oox/helper/refvector.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+
+namespace oox::drawingml::chart {
+
+template< typename ModelType >
+class ModelRef : public std::shared_ptr< ModelType >
+{
+public:
+ ModelRef() {}
+ ModelRef( const std::shared_ptr< ModelType >& rxModel ) : std::shared_ptr< ModelType >( rxModel ) {}
+
+ bool is() const { return this->get() != nullptr; }
+
+ ModelType& create() { (*this) = std::make_shared<ModelType>(); return **this; }
+ template< typename Param1Type >
+ ModelType& create( const Param1Type& rParam1 ) { (*this) = std::make_shared<ModelType>( rParam1 ); return **this; }
+ template< typename Param1Type, typename Param2Type >
+ ModelType& create( const Param1Type& rParam1, const Param2Type& rParam2 ) { (*this) = std::make_shared<ModelType>( rParam1, rParam2 ); return **this; }
+
+ ModelType& getOrCreate() { if( !*this ) (*this) = std::make_shared<ModelType>(); return **this; }
+ template< typename Param1Type >
+ ModelType& getOrCreate( const Param1Type& rParam1 ) { if( !*this ) (*this) = std::make_shared<ModelType>( rParam1 ); return **this; }
+};
+
+template< typename ModelType >
+class ModelVector : public RefVector< ModelType >
+{
+public:
+ typedef typename RefVector< ModelType >::value_type value_type;
+ typedef typename RefVector< ModelType >::size_type size_type;
+
+ ModelType& create() { return append( std::make_shared<ModelType>() ); }
+ template< typename Param1Type >
+ ModelType& create( const Param1Type& rParam1 ) { return append( std::make_shared<ModelType>( rParam1 ) ); }
+ template< typename Param1Type, typename Param2Type >
+ ModelType& create( const Param1Type& rParam1, const Param2Type& rParam2 ) { return append( std::make_shared<ModelType>( rParam1, rParam2 ) ); }
+
+private:
+ ModelType& append( std::shared_ptr<ModelType> pModel )
+ {
+ assert(pModel);
+ auto pTmp = pModel.get();
+ this->push_back( std::move(pModel) );
+ return *pTmp;
+ }
+};
+
+template< typename KeyType, typename ModelType >
+class ModelMap : public RefMap< KeyType, ModelType >
+{
+public:
+ typedef typename RefMap< KeyType, ModelType >::key_type key_type;
+ typedef typename RefMap< KeyType, ModelType >::mapped_type mapped_type;
+ typedef typename RefMap< KeyType, ModelType >::value_type value_type;
+
+ ModelType& create( KeyType eKey ) { return insert( eKey, new ModelType ); }
+
+private:
+ ModelType& insert( KeyType eKey, ModelType* pModel ) { (*this)[ eKey ].reset( pModel ); return *pModel; }
+};
+
+struct NumberFormat
+{
+ OUString maFormatCode; /// Number format code.
+ bool mbSourceLinked; /// True = number format linked to source data.
+
+ NumberFormat();
+
+ void setAttributes( const AttributeList& rAttribs );
+};
+
+struct LayoutModel
+{
+ double mfX; /// Left position of this object.
+ double mfY; /// Top position of this object.
+ double mfW; /// Width of this object.
+ double mfH; /// Height of this object.
+ sal_Int32 mnXMode; /// Mode for left position.
+ sal_Int32 mnYMode; /// Mode for top position.
+ sal_Int32 mnWMode; /// Mode for width.
+ sal_Int32 mnHMode; /// Mode for height.
+ sal_Int32 mnTarget; /// Layout target for plot area.
+ bool mbAutoLayout; /// True = automatic positioning.
+
+ LayoutModel();
+};
+
+} // namespace oox::drawingml::chart
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/clrscheme.hxx b/include/oox/drawingml/clrscheme.hxx
new file mode 100644
index 000000000..a4f0b6534
--- /dev/null
+++ b/include/oox/drawingml/clrscheme.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_CLRSCHEME_HXX
+#define INCLUDED_OOX_DRAWINGML_CLRSCHEME_HXX
+
+#include <cstddef>
+#include <map>
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include <oox/dllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+
+namespace oox::drawingml {
+
+enum PredefinedClrSchemeId {
+ dk1 = 0,
+ lt1,
+ dk2,
+ lt2,
+ accent1,
+ accent2,
+ accent3,
+ accent4,
+ accent5,
+ accent6,
+ hlink,
+ folHlink,
+ Count
+};
+
+static std::map<PredefinedClrSchemeId, OUString> PredefinedClrNames =
+{
+ { dk1, "dk1" },
+ { lt1, "lt1" },
+ { dk2, "dk2" },
+ { lt2, "lt2" },
+ { accent1, "accent1" },
+ { accent2, "accent2" },
+ { accent3, "accent3" },
+ { accent4, "accent4" },
+ { accent5, "accent5" },
+ { accent6, "accent6" },
+ { hlink, "hlink" },
+ { folHlink, "folHlink" }
+};
+
+class ClrMap
+{
+ std::map < sal_Int32, sal_Int32 > maClrMap;
+
+public:
+
+ bool getColorMap( sal_Int32& nClrToken );
+ void setColorMap( sal_Int32 nClrToken, sal_Int32 nMappedClrToken );
+};
+
+typedef std::shared_ptr< ClrMap > ClrMapPtr;
+
+class OOX_DLLPUBLIC ClrScheme
+{
+ std::vector< std::pair<sal_Int32, ::Color> > maClrScheme;
+ OUString maName;
+
+public:
+
+ bool getColor( sal_Int32 nSchemeClrToken, ::Color& rColor ) const;
+ void setColor( sal_Int32 nSchemeClrToken, ::Color nColor );
+
+ bool getColorByIndex(size_t nIndex,
+ ::Color& rColor) const;
+
+ void SetName(const OUString& rName) { maName = rName; }
+ const OUString& GetName() const { return maName; }
+
+ void ToAny(css::uno::Any& rVal) const;
+};
+
+}
+
+#endif // INCLUDED_OOX_DRAWINGML_CLRSCHEME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
new file mode 100644
index 000000000..b28c92698
--- /dev/null
+++ b/include/oox/drawingml/color.hxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_COLOR_HXX
+#define INCLUDED_OOX_DRAWINGML_COLOR_HXX
+
+#include <vector>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <oox/helper/helper.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/color.hxx>
+
+namespace oox { class GraphicHelper; }
+
+namespace oox::drawingml {
+
+
+class OOX_DLLPUBLIC Color
+{
+public:
+ Color();
+
+ /** Returns the RGB value for the passed DrawingML color token, or nDefaultRgb on error. */
+ static ::Color getDmlPresetColor( sal_Int32 nToken, ::Color nDefaultRgb );
+ /** Returns the RGB value for the passed VML color token, or nDefaultRgb on error. */
+ static ::Color getVmlPresetColor( sal_Int32 nToken, ::Color nDefaultRgb );
+ /** Returns the RGB value for the passed VML color token, or nDefaultRgb on error. */
+ static ::Color getHighlightColor(sal_Int32 nToken, ::Color nDefaultRgb);
+
+ /** Sets the color to unused state. */
+ void setUnused();
+ /** Sets an RGB value (hexadecimal RRGGBB) from the a:srgbClr element. */
+ void setSrgbClr( sal_Int32 nRgb );
+ void setSrgbClr( ::Color nRgb );
+ /** Sets the percentual RGB values from the a:scrgbClr element. */
+ void setScrgbClr( sal_Int32 nR, sal_Int32 nG, sal_Int32 nB );
+ /** Sets the HSL values from the a:hslClr element. */
+ void setHslClr( sal_Int32 nHue, sal_Int32 nSat, sal_Int32 nLum );
+ /** Sets a predefined color from the a:prstClr element. */
+ void setPrstClr( sal_Int32 nToken );
+ /** Sets a predefined color from the w:highlight element. */
+ void setHighlight(sal_Int32 nToken);
+ /** Sets a scheme color from the a:schemeClr element. */
+ void setSchemeClr( sal_Int32 nToken );
+ /** Sets the scheme name from the a:schemeClr element for interoperability purposes */
+ void setSchemeName( const OUString& sSchemeName ) { msSchemeName = sSchemeName; }
+ /** Sets a system color from the a:sysClr element. */
+ void setSysClr( sal_Int32 nToken, sal_Int32 nLastRgb );
+ /** Sets a palette color index. */
+ void setPaletteClr( sal_Int32 nPaletteIdx );
+
+ /** Inserts the passed color transformation. */
+ void addTransformation( sal_Int32 nElement, sal_Int32 nValue = -1 );
+ /** Inserts Chart specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). */
+ void addChartTintTransformation( double fTint );
+ /** Inserts Excel specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). */
+ void addExcelTintTransformation( double fTint );
+ /** Removes all color transformations. */
+ void clearTransformations();
+ /** Removes transparence from the color. */
+ void clearTransparence();
+
+ /** Overwrites this color with the passed color, if it is used. */
+ void assignIfUsed( const Color& rColor ) { if( rColor.isUsed() ) *this = rColor; }
+
+ /** Returns true, if the color is initialized. */
+ bool isUsed() const { return meMode != COLOR_UNUSED; }
+ /** Returns true, if the color is a placeholder color in theme style lists. */
+ bool isPlaceHolder() const { return meMode == COLOR_PH; }
+ /** Returns the final RGB color value.
+ @param nPhClr Actual color for the phClr placeholder color used in theme style lists. */
+ ::Color getColor( const GraphicHelper& rGraphicHelper, ::Color nPhClr = API_RGB_TRANSPARENT ) const;
+
+ /** Returns true, if the color is transparent. */
+ bool hasTransparency() const;
+ /** Returns the transparency of the color (0 = opaque, 100 = full transparent). */
+ sal_Int16 getTransparency() const;
+
+ /** Returns the scheme name from the a:schemeClr element for interoperability purposes */
+ const OUString& getSchemeColorName() const { return msSchemeName; }
+ sal_Int16 getSchemeColorIndex() const;
+ sal_Int16 getTintOrShade() const;
+ sal_Int16 getLumMod() const;
+ sal_Int16 getLumOff() const;
+
+ /** Returns the unaltered list of transformations for interoperability purposes */
+ const css::uno::Sequence< css::beans::PropertyValue >& getTransformations() const { return maInteropTransformations;}
+
+ /** Translates between color transformation tokens and their names */
+ static OUString getColorTransformationName( sal_Int32 nElement );
+ /** Translates between color transformation token names and the corresponding token */
+ static sal_Int32 getColorTransformationToken( std::u16string_view sName );
+
+ /// Compares this color with rOther.
+ bool equals(const Color& rOther, const GraphicHelper& rGraphicHelper, ::Color nPhClr) const;
+
+private:
+ /** Internal helper for getColor(). */
+ void setResolvedRgb( ::Color nRgb ) const;
+
+ /** Converts the color components to RGB values. */
+ void toRgb() const;
+ /** Converts the color components to CRGB values (gamma corrected percentage). */
+ void toCrgb() const;
+ /** Converts the color components to HSL values. */
+ void toHsl() const;
+
+private:
+ enum ColorMode
+ {
+ COLOR_UNUSED, /// Color is not used, or undefined.
+ COLOR_RGB, /// Absolute RGB (r/g/b: 0...255).
+ COLOR_CRGB, /// Relative RGB (r/g/b: 0...100000).
+ COLOR_HSL, /// HSL (hue: 0...21600000, sat/lum: 0...100000).
+ COLOR_SCHEME, /// Color from scheme.
+ COLOR_PALETTE, /// Color from application defined palette.
+ COLOR_SYSTEM, /// Color from system palette.
+ COLOR_PH, /// Placeholder color in theme style lists.
+ COLOR_FINAL /// Finalized RGB color.
+ };
+
+ struct Transformation
+ {
+ sal_Int32 mnToken;
+ sal_Int32 mnValue;
+
+ explicit Transformation( sal_Int32 nToken, sal_Int32 nValue ) : mnToken( nToken ), mnValue( nValue ) {}
+ };
+
+ mutable ColorMode meMode; /// Current color mode.
+ mutable std::vector< Transformation >
+ maTransforms; /// Color transformations.
+ mutable sal_Int32 mnC1; /// Red, red%, hue, scheme token, palette index, system token, or final RGB.
+ mutable sal_Int32 mnC2; /// Green, green%, saturation, or system default RGB.
+ mutable sal_Int32 mnC3; /// Blue, blue%, or luminance.
+ sal_Int32 mnAlpha; /// Alpha value (color opacity).
+
+ OUString msSchemeName; /// Scheme name from the a:schemeClr element for interoperability purposes
+ css::uno::Sequence< css::beans::PropertyValue >
+ maInteropTransformations; /// Unaltered list of transformations for interoperability purposes
+};
+
+} // namespace oox::drawingml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/connectorshapecontext.hxx b/include/oox/drawingml/connectorshapecontext.hxx
new file mode 100644
index 000000000..c9819ae85
--- /dev/null
+++ b/include/oox/drawingml/connectorshapecontext.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+#define INCLUDED_OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/dllapi.h>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/drawingml/shapecontext.hxx>
+#include <sal/types.h>
+#include <vector>
+
+namespace oox { class AttributeList; }
+namespace oox::core { class ContextHandler2Helper; }
+
+namespace oox::drawingml {
+
+ struct ConnectorShapeProperties
+ {
+ bool mbStartShape;
+ OUString maDestShapeId;
+ sal_Int32 mnDestGlueId;
+ };
+
+class OOX_DLLPUBLIC ConnectorShapeContext final : public ShapeContext
+{
+ std::vector<ConnectorShapeProperties>& mrConnectorShapePropertiesList;
+ ShapePtr mpConnectorShapePtr;
+
+public:
+ ConnectorShapeContext(::oox::core::ContextHandler2Helper const& rParent,
+ const ShapePtr& pMasterShapePtr, const ShapePtr& pGroupShapePtr,
+ std::vector<ConnectorShapeProperties>& rConnectorShapePropertiesList);
+ virtual ~ConnectorShapeContext() override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+};
+
+}
+
+#endif // INCLUDED_OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/diagram/diagram.hxx b/include/oox/drawingml/diagram/diagram.hxx
new file mode 100644
index 000000000..b3e79d461
--- /dev/null
+++ b/include/oox/drawingml/diagram/diagram.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
+#define INCLUDED_OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
+
+#include <rtl/ustring.hxx>
+#include <oox/core/xmlfilterbase.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <svx/svdobj.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/xml/dom/XDocument.hpp>
+
+namespace oox::drawingml {
+
+/** load diagram data, and put resulting graphic into shape
+
+ This method loads the diagram data fragments from the given paths,
+ generate and layout the shapes, and push it as children into the
+ referenced shape.
+ */
+void loadDiagram( ShapePtr const & pShape,
+ core::XmlFilterBase& rFilter,
+ const OUString& rDataModelPath,
+ const OUString& rLayoutPath,
+ const OUString& rQStylePath,
+ const OUString& rColorStylePath,
+ const oox::core::Relations& rRelations );
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx
new file mode 100644
index 000000000..5fe86d564
--- /dev/null
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -0,0 +1,235 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_DRAWINGMLTYPES_HXX
+#define INCLUDED_OOX_DRAWINGML_DRAWINGMLTYPES_HXX
+
+#include <memory>
+#include <string_view>
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/style/TabAlign.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <o3tl/unit_conversion.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace drawing { struct Hatch; }
+ namespace xml::sax { class XFastAttributeList; }
+}
+
+namespace oox::drawingml {
+
+
+const sal_Int32 PER_PERCENT = 1000;
+const sal_Int32 MAX_PERCENT = 100 * PER_PERCENT;
+
+const sal_Int32 PER_DEGREE = 60000;
+const sal_Int32 MAX_DEGREE = 360 * PER_DEGREE;
+
+
+struct LineProperties;
+typedef std::shared_ptr< LineProperties > LinePropertiesPtr;
+
+struct FillProperties;
+typedef std::shared_ptr< FillProperties > FillPropertiesPtr;
+
+struct GraphicProperties;
+typedef std::shared_ptr< GraphicProperties > GraphicPropertiesPtr;
+
+struct Shape3DProperties;
+typedef std::shared_ptr< Shape3DProperties > Shape3DPropertiesPtr;
+
+struct TextCharacterProperties;
+typedef std::shared_ptr< TextCharacterProperties > TextCharacterPropertiesPtr;
+
+struct EffectProperties;
+typedef std::shared_ptr< EffectProperties > EffectPropertiesPtr;
+
+class TextBody;
+typedef std::shared_ptr< TextBody > TextBodyPtr;
+
+class TextListStyle;
+typedef std::shared_ptr< TextListStyle > TextListStylePtr;
+
+class Shape;
+typedef std::shared_ptr< Shape > ShapePtr;
+typedef std::weak_ptr< Shape > WeakShapePtr;
+
+class Theme;
+typedef std::shared_ptr< Theme > ThemePtr;
+
+
+namespace table {
+
+class TableProperties;
+typedef std::shared_ptr< TableProperties > TablePropertiesPtr;
+
+} // namespace table
+
+
+/** converts the attributes from a CT_TLPoint into an awt Point with 1/1000% */
+css::awt::Point GetPointPercent( const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttribs );
+
+
+/** converts the attributes from a CT_Size2D into an awt Size with 1/100th mm */
+css::awt::Size GetSize2D( const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttributes );
+
+/** converts the attributes from a CT_RelativeRect to an IntegerRectangle2D */
+css::geometry::IntegerRectangle2D GetRelativeRect( const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttributes );
+
+/** converts EMUs into 1/100th mmm */
+sal_Int32 GetCoordinate( sal_Int32 nValue );
+
+/** converts an emu string into 1/100th mmm */
+sal_Int32 GetCoordinate( std::u16string_view sValue );
+
+/** converts 1/100mm to EMU */
+sal_Int32 GetPointFromCoordinate( sal_Int32 nValue );
+
+/** converts a ST_Percentage % string into 1/1000th of % */
+sal_Int32 GetPercent( std::u16string_view sValue );
+
+/** Converts a ST_PositiveFixedPercentage to a float. 1.0 == 100% */
+double GetPositiveFixedPercentage( const OUString& sValue );
+
+/** converts the ST_TextFontSize to point */
+float GetTextSize( std::u16string_view rValue );
+
+/** converts the ST_TextSpacingPoint to 1/100mm */
+sal_Int32 GetTextSpacingPoint( std::u16string_view sValue );
+sal_Int32 GetTextSpacingPoint( const sal_Int32 nValue );
+
+/** */
+css::style::TabAlign GetTabAlign( ::sal_Int32 aToken );
+
+float GetFontHeight( sal_Int32 nHeight );
+
+sal_Int16 GetFontUnderline( sal_Int32 nToken );
+
+sal_Int16 GetFontStrikeout( sal_Int32 nToken );
+
+sal_Int16 GetCaseMap( sal_Int32 nToken );
+
+/** converts a paragraph align to a ParaAdjust */
+css::style::ParagraphAdjust GetParaAdjust( sal_Int32 nAlign );
+
+// Converts vertical adjust tokens to a TextVerticalAdjust item
+css::drawing::TextVerticalAdjust GetTextVerticalAdjust( sal_Int32 nToken );
+
+// Converts a TextVerticalAdjust item to string value appearing in ooxml
+OOX_DLLPUBLIC const char* GetTextVerticalAdjust( css::drawing::TextVerticalAdjust eAdjust );
+
+// Converts a Hatch object to an ooxml pattern.
+const char* GetHatchPattern( const css::drawing::Hatch& rHatch );
+
+
+// CT_IndexRange
+struct IndexRange {
+ sal_Int32 start;
+ sal_Int32 end;
+};
+
+/** retrieve the content of CT_IndexRange */
+IndexRange GetIndexRange( const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttributes );
+
+/**
+* nRotation is a 100th of a degree and the return value is
+* in a 60,000th of a degree
+*
+* Also rotation is in opposite directions so multiply with -1
+*/
+inline OString calcRotationValue(sal_Int32 nRotation)
+{
+ if (nRotation > 18000) // 180 degree
+ {
+ nRotation -= 36000;
+ }
+ nRotation *= -600;
+ return OString::number(nRotation);
+}
+
+/** Converts the passed 32-bit integer value from 1/100 mm to EMUs. */
+inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
+{
+ return o3tl::convert(nValue, o3tl::Length::mm100, o3tl::Length::emu);
+}
+
+/** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */
+inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
+{
+ return o3tl::convertNarrowing<sal_Int32, o3tl::Length::emu, o3tl::Length::mm100>(nValue);
+}
+
+/** Converts the passed 64-bit integer value from EMUs to Points. */
+inline float convertEmuToPoints( sal_Int64 nValue )
+{
+ return o3tl::convert<double>(nValue, o3tl::Length::emu, o3tl::Length::pt);
+}
+
+/** Converts the passed double value from points to mm. */
+inline double convertPointToMms(double fValue)
+{
+ return o3tl::convert(fValue, o3tl::Length::pt, o3tl::Length::mm);
+}
+
+/** A structure for a point with 64-bit integer components. */
+struct EmuPoint
+{
+ sal_Int64 X;
+ sal_Int64 Y;
+
+ EmuPoint() : X( 0 ), Y( 0 ) {}
+ explicit EmuPoint( sal_Int64 nX, sal_Int64 nY ) : X( nX ), Y( nY ) {}
+};
+
+
+/** A structure for a size with 64-bit integer components. */
+struct EmuSize
+{
+ sal_Int64 Width;
+ sal_Int64 Height;
+
+ EmuSize() : Width( 0 ), Height( 0 ) {}
+ explicit EmuSize( sal_Int64 nWidth, sal_Int64 nHeight ) : Width( nWidth ), Height( nHeight ) {}
+};
+
+
+/** A structure for a rectangle with 64-bit integer components. */
+struct EmuRectangle : public EmuPoint, public EmuSize
+{
+ EmuRectangle() {}
+ explicit EmuRectangle( sal_Int64 nX, sal_Int64 nY, sal_Int64 nWidth, sal_Int64 nHeight ) : EmuPoint( nX, nY ), EmuSize( nWidth, nHeight ) {}
+
+ void setPos( const EmuPoint& rPos ) { static_cast< EmuPoint& >( *this ) = rPos; }
+ void setSize( const EmuSize& rSize ) { static_cast< EmuSize& >( *this ) = rSize; }
+};
+
+
+} // namespace oox::drawingml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/graphicshapecontext.hxx b/include/oox/drawingml/graphicshapecontext.hxx
new file mode 100644
index 000000000..ffd579f00
--- /dev/null
+++ b/include/oox/drawingml/graphicshapecontext.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+#define INCLUDED_OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/dllapi.h>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/drawingml/shapecontext.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+namespace oox::core { class ContextHandler2Helper; }
+namespace oox::vml { struct OleObjectInfo; }
+
+namespace oox::drawingml {
+
+class OOX_DLLPUBLIC GraphicShapeContext : public ShapeContext
+{
+public:
+ GraphicShapeContext( ::oox::core::ContextHandler2Helper const & rParent, const ShapePtr& pMasterShapePtr, const ShapePtr& pShapePtr );
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+};
+
+
+class OOX_DLLPUBLIC GraphicalObjectFrameContext final : public ShapeContext
+{
+public:
+ GraphicalObjectFrameContext( ::oox::core::ContextHandler2Helper& rParent, const ShapePtr& pMasterShapePtr, const ShapePtr& pShapePtr, bool bEmbedShapesInChart );
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+ virtual void onEndElement() override;
+
+private:
+ bool mbEmbedShapesInChart;
+ ::oox::core::ContextHandler2Helper* mpParent;
+};
+
+
+class OleObjectGraphicDataContext final : public ShapeContext
+{
+public:
+ OleObjectGraphicDataContext( ::oox::core::ContextHandler2Helper const & rParent, const ShapePtr& pShapePtr );
+ virtual ~OleObjectGraphicDataContext() override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+ virtual void onEndElement() override;
+
+private:
+ ::oox::vml::OleObjectInfo& mrOleObjectInfo;
+};
+
+
+class DiagramGraphicDataContext final
+ : public ShapeContext
+{
+public:
+ DiagramGraphicDataContext( ::oox::core::ContextHandler2Helper const & rParent, const ShapePtr& pShapePtr );
+ virtual ~DiagramGraphicDataContext() override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+
+private:
+ OUString msDm;
+ OUString msLo;
+ OUString msQs;
+ OUString msCs;
+};
+
+
+struct ChartShapeInfo;
+
+class ChartGraphicDataContext final : public ShapeContext
+{
+public:
+ explicit ChartGraphicDataContext(
+ ::oox::core::ContextHandler2Helper const & rParent,
+ const ShapePtr& rxShape, bool bEmbedShapes );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext(
+ sal_Int32 nElement,
+ const ::oox::AttributeList& rAttribs) override;
+
+private:
+ ChartShapeInfo& mrChartShapeInfo;
+};
+
+
+}
+
+#endif // INCLUDED_OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
new file mode 100644
index 000000000..5c4f788cd
--- /dev/null
+++ b/include/oox/drawingml/shape.hxx
@@ -0,0 +1,430 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_SHAPE_HXX
+#define INCLUDED_OOX_DRAWINGML_SHAPE_HXX
+
+#include <map>
+#include <memory>
+#include <string_view>
+#include <vector>
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <oox/core/xmlfilterbase.hxx>
+#include <oox/dllapi.h>
+#include <oox/drawingml/color.hxx>
+#include <oox/drawingml/connectorshapecontext.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/helper/helper.hxx>
+#include <oox/helper/propertymap.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace basegfx { class B2DHomMatrix; }
+
+namespace com::sun::star {
+ namespace awt { struct Rectangle; }
+ namespace drawing { class XShape; }
+ namespace drawing { class XShapes; }
+ namespace uno { class Any; }
+}
+
+namespace oox::core {
+ class XmlFilterBase;
+}
+
+namespace oox::vml {
+ struct OleObjectInfo;
+}
+
+namespace svx::diagram {
+ class IDiagramHelper;
+}
+
+namespace oox::drawingml {
+
+class Theme;
+struct EffectProperties;
+struct FillProperties;
+struct GraphicProperties;
+struct LineProperties;
+struct Shape3DProperties;
+
+class CustomShapeProperties;
+typedef std::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr;
+
+typedef ::std::map< OUString, ShapePtr > ShapeIdMap;
+
+typedef std::vector<ConnectorShapeProperties> ConnectorShapePropertiesList;
+
+struct ShapeStyleRef
+{
+ Color maPhClr;
+ sal_Int32 mnThemedIdx;
+ ShapeStyleRef() : mnThemedIdx(0) {}
+};
+
+typedef ::std::map< sal_Int32, ShapeStyleRef > ShapeStyleRefMap;
+
+/** Additional information for a chart embedded in a drawing shape. */
+struct ChartShapeInfo
+{
+ OUString maFragmentPath; ///< Path to related XML stream, e.g. for charts.
+ bool mbEmbedShapes; ///< True = load chart shapes into chart, false = load into parent drawpage.
+
+ explicit ChartShapeInfo( bool bEmbedShapes ) : mbEmbedShapes( bEmbedShapes ) {}
+};
+
+/// Attributes for a linked textbox.
+struct LinkedTxbxAttr
+{
+ sal_Int32 id;
+ sal_Int32 seq;
+ LinkedTxbxAttr(): id(0),seq(0){};
+};
+
+class Diagram;
+
+class OOX_DLLPUBLIC Shape
+ : public std::enable_shared_from_this< Shape >
+{
+public:
+
+ explicit Shape( const char* pServiceType = nullptr, bool bDefaultHeight = true );
+ explicit Shape( const ShapePtr& pSourceShape );
+ Shape(Shape const &) = default;
+ virtual ~Shape();
+ Shape & operator =(Shape const &) = default;
+
+ OUString& getServiceName(){ return msServiceName; }
+ void setServiceName( const char* pServiceName );
+
+ const OUString& getDiagramDataModelID() const { return msDiagramDataModelID; }
+ void setDiagramDataModelID( const OUString& rDiagramDataModelID ) { msDiagramDataModelID = rDiagramDataModelID; }
+
+ PropertyMap& getShapeProperties(){ return maShapeProperties; }
+
+ LineProperties& getLineProperties() { return *mpLinePropertiesPtr; }
+ const LineProperties& getLineProperties() const { return *mpLinePropertiesPtr; }
+
+ FillProperties& getFillProperties() { return *mpFillPropertiesPtr; }
+ const FillProperties& getFillProperties() const { return *mpFillPropertiesPtr; }
+
+ GraphicProperties& getGraphicProperties() { return *mpGraphicPropertiesPtr; }
+ const GraphicProperties& getGraphicProperties() const { return *mpGraphicPropertiesPtr; }
+
+ CustomShapePropertiesPtr& getCustomShapeProperties(){ return mpCustomShapePropertiesPtr; }
+
+ OUString& getConnectorName() { return msConnectorName; }
+ ConnectorShapePropertiesList& getConnectorShapeProperties() { return maConnectorShapePropertiesList; }
+ void setConnectorShape(bool bConnector) { mbConnector = bConnector; }
+ bool isConnectorShape() const { return mbConnector; }
+
+ void setBookmark(bool bBookmark) { mbHasBookmark = bBookmark; }
+ bool hasBookmark() const { return mbHasBookmark; }
+
+ Shape3DProperties& get3DProperties() { return *mp3DPropertiesPtr; }
+ const Shape3DProperties& get3DProperties() const { return *mp3DPropertiesPtr; }
+
+ table::TablePropertiesPtr const & getTableProperties();
+
+ EffectProperties& getEffectProperties() const { return *mpEffectPropertiesPtr; }
+
+ void setChildPosition( css::awt::Point nPosition ){ maChPosition = nPosition; }
+ void setChildSize( css::awt::Size aSize ){ maChSize = aSize; }
+
+ void setPosition( css::awt::Point nPosition ){ maPosition = nPosition; }
+ const css::awt::Point& getPosition() const { return maPosition; }
+
+ void setSize( css::awt::Size aSize ){ maSize = aSize; }
+ const css::awt::Size& getSize() const { return maSize; }
+
+ void setRotation( sal_Int32 nRotation ) { mnRotation = nRotation; }
+ sal_Int32 getRotation() const { return mnRotation; }
+ void setDiagramRotation( sal_Int32 nRotation ) { mnDiagramRotation = nRotation; }
+ void setFlip( bool bFlipH, bool bFlipV ) { mbFlipH = bFlipH; mbFlipV = bFlipV; }
+ bool getFlipH() const { return mbFlipH; }
+ bool getFlipV() const { return mbFlipV; }
+ void addChild( const ShapePtr& rChildPtr ) { maChildren.push_back( rChildPtr ); }
+ std::vector< ShapePtr >& getChildren() { return maChildren; }
+
+ void setName( const OUString& rName ) { msName = rName; }
+ const OUString& getName( ) const { return msName; }
+ void setInternalName( const OUString& rInternalName ) { msInternalName = rInternalName; }
+ const OUString& getInternalName() const { return msInternalName; }
+ void setId( const OUString& rId ) { msId = rId; }
+ const OUString& getId() const { return msId; }
+ void setDescription( const OUString& rDescr ) { msDescription = rDescr; }
+ void setHidden( bool bHidden ) { mbHidden = bHidden; }
+ void setHiddenMasterShape( bool bHiddenMasterShape ) { mbHiddenMasterShape = bHiddenMasterShape; }
+ void setLocked( bool bLocked ) { mbLocked = bLocked; }
+ void setSubType( sal_Int32 nSubType ) { mnSubType = nSubType; }
+ sal_Int32 getSubType() const { return mnSubType; }
+ void setSubTypeIndex( sal_Int32 nSubTypeIndex ) { moSubTypeIndex = nSubTypeIndex; }
+ const OptValue< sal_Int32 >& getSubTypeIndex() const { return moSubTypeIndex; }
+
+ // setDefaults has to be called if styles are imported (OfficeXML is not storing properties having the default value)
+ void setDefaults(bool bHeight);
+
+ ::oox::vml::OleObjectInfo& setOleObjectType();
+ ChartShapeInfo& setChartType( bool bEmbedShapes );
+ void setDiagramType();
+ void setTableType();
+
+ void setTextBody(const TextBodyPtr & pTextBody);
+ const TextBodyPtr& getTextBody() const { return mpTextBody;}
+ void setMasterTextListStyle( const TextListStylePtr& pMasterTextListStyle );
+ const TextListStylePtr& getMasterTextListStyle() const { return mpMasterTextListStyle; }
+
+ ShapeStyleRefMap& getShapeStyleRefs() { return maShapeStyleRefs; }
+ const ShapeStyleRefMap& getShapeStyleRefs() const { return maShapeStyleRefs; }
+ const ShapeStyleRef* getShapeStyleRef( sal_Int32 nRefType ) const;
+ bool hasShapeStyleRefs() const { return !maShapeStyleRefs.empty(); }
+
+ // addShape is creating and inserting the corresponding XShape.
+ void addShape(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ const Theme* pTheme,
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const basegfx::B2DHomMatrix& aTransformation,
+ const FillProperties& rShapeOrParentShapeFillProps,
+ ShapeIdMap* pShapeMap = nullptr,
+ oox::drawingml::ShapePtr pParentGroupShape = nullptr);
+
+ const css::uno::Reference< css::drawing::XShape > &
+ getXShape() const { return mxShape; }
+
+ void applyShapeReference( const Shape& rReferencedShape, bool bUseText = true );
+ const ::std::vector<OUString>&
+ getExtDrawings() const { return maExtDrawings; }
+ void addExtDrawingRelId( const OUString &rRelId ) { maExtDrawings.push_back( rRelId ); }
+ // Set font color only for extdrawings.
+ void setFontRefColorForNodes(const Color& rColor) { maFontRefColorForNodes = rColor; }
+ const Color& getFontRefColorForNodes() const { return maFontRefColorForNodes; }
+ void setLockedCanvas(bool bLockedCanvas);
+ bool getLockedCanvas() const { return mbLockedCanvas;}
+ void setWPGChild(bool bWPG);
+ bool isWPGChild() const { return mbWPGChild;}
+ void setWps(bool bWps);
+ bool getWps() const { return mbWps;}
+ void setTextBox(bool bTextBox);
+ const css::uno::Sequence<css::beans::PropertyValue> &
+ getDiagramDoms() const { return maDiagramDoms; }
+ void setDiagramDoms(const css::uno::Sequence<css::beans::PropertyValue>& rDiagramDoms) { maDiagramDoms = rDiagramDoms; }
+ css::uno::Sequence< css::uno::Sequence< css::uno::Any > >resolveRelationshipsOfTypeFromOfficeDoc(
+ core::XmlFilterBase& rFilter, const OUString& sFragment, std::u16string_view sType );
+ void setLinkedTxbxAttributes(const LinkedTxbxAttr& rhs){ maLinkedTxbxAttr = rhs; };
+ void setTxbxHasLinkedTxtBox( const bool rhs){ mbHasLinkedTxbx = rhs; };
+ const LinkedTxbxAttr& getLinkedTxbxAttributes() const { return maLinkedTxbxAttr; };
+ bool isLinkedTxbx() const { return mbHasLinkedTxbx; };
+
+ void setZOrder(sal_Int32 nZOrder) { mnZOrder = nZOrder; }
+
+ sal_Int32 getZOrder() const { return mnZOrder; }
+
+ void setZOrderOff(sal_Int32 nZOrderOff) { mnZOrderOff = nZOrderOff; }
+
+ sal_Int32 getZOrderOff() const { return mnZOrderOff; }
+
+ void setDataNodeType(sal_Int32 nDataNodeType) { mnDataNodeType = nDataNodeType; }
+
+ sal_Int32 getDataNodeType() const { return mnDataNodeType; }
+
+ void setAspectRatio(double fAspectRatio) { mfAspectRatio = fAspectRatio; }
+
+ double getAspectRatio() const { return mfAspectRatio; }
+
+ void setVerticalShapesCount(sal_Int32 nVerticalShapesCount) { mnVerticalShapesCount = nVerticalShapesCount; }
+ sal_Int32 getVerticalShapesCount() const { return mnVerticalShapesCount; }
+
+ /// Changes reference semantics to value semantics for fill properties.
+ void cloneFillProperties();
+
+ void keepDiagramDrawing(::oox::core::XmlFilterBase& rFilterBase, const OUString& rFragmentPath);
+
+ // Allows preparation of a local Diagram helper && propagate an eventually
+ // existing one to the data holder object later
+ void prepareDiagramHelper(const std::shared_ptr< Diagram >& rDiagramPtr, const std::shared_ptr<::oox::drawingml::Theme>& rTheme);
+ void propagateDiagramHelper();
+
+ // for Writer it is necessary to migrate an existing helper to a new Shape
+ void migrateDiagramHelperToNewShape(const ShapePtr& pTarget);
+
+protected:
+
+ enum FrameType
+ {
+ FRAMETYPE_GENERIC, ///< Generic shape, no special type.
+ FRAMETYPE_OLEOBJECT, ///< OLE object embedded in a shape.
+ FRAMETYPE_CHART, ///< Chart embedded in a shape.
+ FRAMETYPE_DIAGRAM, ///< Complex diagram drawing shape.
+ FRAMETYPE_TABLE ///< A table embedded in a shape.
+ };
+
+ css::uno::Reference< css::drawing::XShape > const &
+ createAndInsert(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ const OUString& rServiceName,
+ const Theme* pTheme,
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ bool bClearText,
+ bool bDoNotInsertEmptyTextBody,
+ basegfx::B2DHomMatrix& aTransformation,
+ const FillProperties& rShapeOrParentShapeFillProps,
+ oox::drawingml::ShapePtr pParentGroupShape = nullptr
+ );
+
+ void addChildren(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ Shape& rMaster,
+ const Theme* pTheme,
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ ShapeIdMap* pShapeMap,
+ const basegfx::B2DHomMatrix& aTransformation );
+
+ void keepDiagramCompatibilityInfo();
+ void convertSmartArtToMetafile( ::oox::core::XmlFilterBase const& rFilterBase );
+
+ css::uno::Reference< css::drawing::XShape >
+ renderDiagramToGraphic( ::oox::core::XmlFilterBase const & rFilterBase );
+
+ OUString finalizeServiceName(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rServiceName,
+ const css::awt::Rectangle& rShapeRect );
+
+ virtual void finalizeXShape(
+ ::oox::core::XmlFilterBase& rFilter,
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes );
+
+ void putPropertyToGrabBag(
+ const OUString& sPropertyName, const css::uno::Any& aPropertyValue );
+ void putPropertyToGrabBag(
+ const css::beans::PropertyValue& pProperty );
+ void putPropertiesToGrabBag(
+ const css::uno::Sequence< css::beans::PropertyValue >& aProperties );
+
+ FillProperties getActualFillProperties(const Theme* pTheme, const FillProperties* pParentShapeFillProps) const;
+ LineProperties getActualLineProperties(const Theme* pTheme) const;
+ EffectProperties getActualEffectProperties(const Theme* pTheme) const;
+
+ std::vector< ShapePtr > maChildren; // only used for group shapes
+ css::awt::Size maChSize; // only used for group shapes
+ css::awt::Point maChPosition; // only used for group shapes
+
+ TextBodyPtr mpTextBody;
+ LinePropertiesPtr mpLinePropertiesPtr;
+ LinePropertiesPtr mpShapeRefLinePropPtr;
+ FillPropertiesPtr mpFillPropertiesPtr;
+ FillPropertiesPtr mpShapeRefFillPropPtr;
+ GraphicPropertiesPtr mpGraphicPropertiesPtr;
+ CustomShapePropertiesPtr mpCustomShapePropertiesPtr;
+ table::TablePropertiesPtr mpTablePropertiesPtr;
+ Shape3DPropertiesPtr mp3DPropertiesPtr;
+ EffectPropertiesPtr mpEffectPropertiesPtr;
+ EffectPropertiesPtr mpShapeRefEffectPropPtr;
+ PropertyMap maShapeProperties;
+ PropertyMap maDefaultShapeProperties;
+ TextListStylePtr mpMasterTextListStyle;
+ css::uno::Reference< css::drawing::XShape > mxShape;
+ ConnectorShapePropertiesList maConnectorShapePropertiesList;
+
+ OUString msConnectorName;
+ OUString msServiceName;
+ OUString msName;
+ OUString msInternalName; // used by diagram; not displayed in UI
+ OUString msId;
+ OUString msDescription;
+ sal_Int32 mnSubType; // if this type is not zero, then the shape is a placeholder
+ OptValue< sal_Int32 > moSubTypeIndex;
+
+ ShapeStyleRefMap maShapeStyleRefs;
+
+ css::awt::Size maSize;
+ css::awt::Point maPosition;
+ ::std::vector<OUString> maExtDrawings;
+ Color maFontRefColorForNodes;
+
+ FrameType meFrameType; ///< Type for graphic frame shapes.
+
+private:
+
+ typedef std::shared_ptr< ::oox::vml::OleObjectInfo > OleObjectInfoRef;
+ typedef std::shared_ptr< ChartShapeInfo > ChartShapeInfoRef;
+
+ OleObjectInfoRef mxOleObjectInfo; ///< Additional data for OLE objects.
+ ChartShapeInfoRef mxChartShapeInfo; ///< Additional data for chart shapes.
+
+ sal_Int32 mnRotation;
+ sal_Int32 mnDiagramRotation; // rotates shape prior to sizing, does not affect text rotation
+ bool mbFlipH;
+ bool mbFlipV;
+ bool mbHidden;
+ bool mbHiddenMasterShape; // master shapes can be hidden in layout slides
+ // we need separate flag because we don't want
+ // to propagate it when applying reference shape
+ bool mbLocked;
+ bool mbWPGChild; // Is this shape a child of a WPG shape?
+ bool mbLockedCanvas; ///< Is this shape part of a locked canvas?
+ bool mbWps; ///< Is this a wps shape?
+ bool mbTextBox; ///< This shape has a textbox.
+ LinkedTxbxAttr maLinkedTxbxAttr;
+ bool mbHasLinkedTxbx; // this text box has linked text box ?
+
+ css::uno::Sequence<css::beans::PropertyValue> maDiagramDoms;
+
+ /// Z-Order.
+ sal_Int32 mnZOrder = 0;
+
+ /// Z-Order offset.
+ sal_Int32 mnZOrderOff = 0;
+
+ /// Type of data node for an in-diagram shape.
+ sal_Int32 mnDataNodeType = 0;
+
+ /// Aspect ratio for an in-diagram shape.
+ double mfAspectRatio = 0;
+
+ /// Number of child shapes to be layouted vertically inside org chart in-diagram shape.
+ sal_Int32 mnVerticalShapesCount = 0;
+
+ // Is this a connector shape?
+ bool mbConnector = false;
+
+ // Is shape has bookmark?
+ bool mbHasBookmark = false;
+
+ // temporary space for DiagramHelper in preparation for collecting data
+ // Note: I tried to use a unique_ptr here, but existing constructor func does not allow that
+ svx::diagram::IDiagramHelper* mpDiagramHelper;
+
+ // association-ID to identify the Diagram ModelData
+ OUString msDiagramDataModelID;
+};
+
+}
+
+#endif // INCLUDED_OOX_DRAWINGML_SHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapecontext.hxx b/include/oox/drawingml/shapecontext.hxx
new file mode 100644
index 000000000..170f50403
--- /dev/null
+++ b/include/oox/drawingml/shapecontext.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_SHAPECONTEXT_HXX
+#define INCLUDED_OOX_DRAWINGML_SHAPECONTEXT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/contexthandler2.hxx>
+#include <oox/dllapi.h>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+
+namespace oox::drawingml {
+
+class OOX_DLLPUBLIC ShapeContext : public ::oox::core::ContextHandler2
+{
+public:
+ ShapeContext( ::oox::core::ContextHandler2Helper const & rParent, ShapePtr const & pMasterShapePtr, ShapePtr const & pShapePtr );
+ virtual ~ShapeContext() override;
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+
+ const ShapePtr& getShape() const { return mpShapePtr;}
+
+protected:
+
+ ShapePtr mpMasterShapePtr;
+ ShapePtr mpShapePtr;
+};
+
+}
+
+#endif // INCLUDED_OOX_DRAWINGML_SHAPECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapegroupcontext.hxx b/include/oox/drawingml/shapegroupcontext.hxx
new file mode 100644
index 000000000..d9dfcbfa5
--- /dev/null
+++ b/include/oox/drawingml/shapegroupcontext.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/dllapi.h>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+
+namespace oox::drawingml {
+
+class OOX_DLLPUBLIC ShapeGroupContext : public ::oox::core::FragmentHandler2
+{
+public:
+ ShapeGroupContext( ::oox::core::FragmentHandler2 const & rParent, ShapePtr const & pMasterShapePtr, ShapePtr const & pGroupShapePtr );
+ virtual ~ShapeGroupContext() override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+
+protected:
+ ShapePtr mpGroupShapePtr;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
new file mode 100644
index 000000000..7870ddee3
--- /dev/null
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+#define INCLUDED_OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <o3tl/enumarray.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/propertymap.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/color.hxx>
+
+namespace oox { class ModelObjectHelper; }
+
+namespace oox::drawingml {
+
+/** Enumeration for various properties related to drawing shape formatting.
+
+ This is an abstraction for shape formatting properties that have different
+ names in various implementations, e.g. drawing shapes vs. chart objects.
+
+ If you *insert* ids into this list, then update spnCommonPropIds, spnLinearPropIds
+ and spnFilledPropIds of oox/source/drawingml/chart/objectformatter.cxx if
+ the newly inserted enum is inside the range they cover
+ */
+enum class ShapeProperty
+{
+ LineStyle,
+ LineWidth,
+ LineColor,
+ LineTransparency,
+ LineDash, ///< Explicit line dash or name of a line dash stored in a global container.
+ LineCap,
+ LineJoint,
+ LineStart, ///< Explicit line start marker or name of a line marker stored in a global container.
+ LineStartWidth,
+ LineStartCenter,
+ LineEnd, ///< Explicit line end marker or name of a line marker stored in a global container.
+ LineEndWidth,
+ LineEndCenter,
+ FillStyle,
+ FillColor,
+ FillTransparency,
+ GradientTransparency,
+ FillGradient, ///< Explicit fill gradient or name of a fill gradient stored in a global container.
+ FillBitmap, ///< Explicit fill bitmap or name of a fill bitmap stored in a global container.
+ FillBitmapMode,
+ FillBitmapSizeX,
+ FillBitmapSizeY,
+ FillBitmapOffsetX,
+ FillBitmapOffsetY,
+ FillBitmapRectanglePoint,
+ FillHatch, ///< Explicit fill hatch or name of a fill hatch stored in a global container.
+ FillBackground,
+ FillUseSlideBackground,
+ FillBitmapName,
+ ShadowXDistance,
+ ShadowSizeX,
+ ShadowSizeY,
+ LAST = ShadowSizeY
+};
+
+typedef o3tl::enumarray<ShapeProperty, sal_Int32> ShapePropertyIds;
+
+struct OOX_DLLPUBLIC ShapePropertyInfo
+{
+ const ShapePropertyIds& mrPropertyIds;
+ bool mbNamedLineMarker; /// True = use named line marker instead of explicit line marker.
+ bool mbNamedLineDash; /// True = use named line dash instead of explicit line dash.
+ bool mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient.
+ bool mbNamedFillBitmap; /// True = use named fill bitmap instead of explicit fill bitmap.
+ bool mbNamedFillHatch; /// True = use named fill hatch instead of explicit fill hatch.
+
+ static ShapePropertyInfo DEFAULT; /// Default property info (used as default parameter of other methods).
+
+ explicit ShapePropertyInfo(const ShapePropertyIds& rnPropertyIds,
+ bool bNamedLineMarker, bool bNamedLineDash,
+ bool bNamedFillGradient, bool bNamedFillBitmap, bool bNamedFillHatch);
+
+ bool has(ShapeProperty ePropId) const
+ {
+ return mrPropertyIds[ePropId] >= 0;
+ }
+ sal_Int32 operator[](ShapeProperty ePropId) const
+ {
+ return mrPropertyIds[ePropId];
+ }
+};
+
+class OOX_DLLPUBLIC ShapePropertyMap : public PropertyMap
+{
+public:
+ explicit ShapePropertyMap(ModelObjectHelper& rModelObjHelper,
+ const ShapePropertyInfo& rShapePropInfo = ShapePropertyInfo::DEFAULT );
+
+ /** Returns true, if the specified property is supported. */
+ bool supportsProperty( ShapeProperty ePropId ) const;
+
+ /** Returns true, if named line markers are supported, and the specified
+ line marker has already been inserted into the marker table. */
+ bool hasNamedLineMarkerInTable( const OUString& rMarkerName ) const;
+
+ /** Sets the specified shape property to the passed value. */
+ bool setAnyProperty( ShapeProperty ePropId, const css::uno::Any& rValue );
+
+ /** Sets the specified shape property to the passed value. */
+ template<typename Type>
+ bool setProperty(ShapeProperty ePropId, const Type& rValue)
+ {
+ return setAnyProperty(ePropId, css::uno::Any(rValue));
+ }
+ bool setProperty(ShapeProperty ePropId, const ::Color& rValue)
+ {
+ return setAnyProperty(ePropId, css::uno::Any(rValue));
+ }
+
+ using PropertyMap::setAnyProperty;
+ using PropertyMap::setProperty;
+
+private:
+ /** Sets an explicit line marker, or creates a named line marker. */
+ bool setLineMarker( sal_Int32 nPropId, const css::uno::Any& rValue );
+ /** Sets an explicit line dash, or creates a named line dash. */
+ bool setLineDash( sal_Int32 nPropId, const css::uno::Any& rValue );
+ /** Sets an explicit fill gradient, or creates a named fill gradient. */
+ bool setFillGradient( sal_Int32 nPropId, const css::uno::Any& rValue );
+ /** Creates a named transparency gradient. */
+ bool setGradientTrans( sal_Int32 nPropId, const css::uno::Any& rValue );
+ /** Sets an explicit fill bitmap, or creates a named fill bitmap. */
+ bool setFillBitmap( sal_Int32 nPropId, const css::uno::Any& rValue );
+ /** Sets an explicit fill bitmap and pushes the name to FillBitmapName */
+ bool setFillBitmapName( const css::uno::Any& rValue );
+ /** Sets an explicit fill hatch, or creates a named fill hatch. */
+ bool setFillHatch( sal_Int32 nPropId, const css::uno::Any& rValue );
+
+ // not implemented, to prevent implicit conversion from enum to int
+ css::uno::Any& operator[]( ShapeProperty ePropId ) = delete;
+ const css::uno::Any& operator[]( ShapeProperty ePropId ) const = delete;
+
+private:
+ ModelObjectHelper& mrModelObjHelper;
+ ShapePropertyInfo maShapePropInfo;
+};
+
+
+} // namespace oox::drawingml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx
new file mode 100644
index 000000000..6222a4264
--- /dev/null
+++ b/include/oox/drawingml/theme.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_THEME_HXX
+#define INCLUDED_OOX_DRAWINGML_THEME_HXX
+
+#include <functional>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/drawingml/clrscheme.hxx>
+#include <oox/drawingml/shape.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/refmap.hxx>
+#include <oox/helper/refvector.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace drawing { class XDrawPage; }
+ namespace xml::dom { class XDocument; }
+}
+
+namespace oox::drawingml {
+
+struct EffectProperties;
+struct FillProperties;
+struct LineProperties;
+struct TextCharacterProperties;
+
+const sal_Int32 THEMED_STYLE_SUBTLE = 1;
+const sal_Int32 THEMED_STYLE_MODERATE = 2;
+const sal_Int32 THEMED_STYLE_INTENSE = 3;
+
+typedef RefVector< FillProperties > FillStyleList;
+typedef RefVector< LineProperties > LineStyleList;
+typedef RefVector< EffectProperties > EffectStyleList;
+typedef RefMap< sal_Int32, TextCharacterProperties > FontScheme;
+
+class TextFont;
+
+class OOX_DLLPUBLIC Theme
+{
+public:
+ void setStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; }
+ void setThemeName(const OUString& rThemeName) { maThemeName = rThemeName; }
+
+ ClrScheme& getClrScheme() { return maClrScheme; }
+ const ClrScheme& getClrScheme() const { return maClrScheme; }
+
+ FillStyleList& getFillStyleList() { return maFillStyleList; }
+ const FillStyleList& getFillStyleList() const { return maFillStyleList; }
+ FillStyleList& getBgFillStyleList() { return maBgFillStyleList; }
+ const FillStyleList& getBgFillStyleList() const { return maBgFillStyleList; }
+ /** Returns the fill properties of the passed one-based themed style index. */
+ const FillProperties* getFillStyle( sal_Int32 nIndex ) const;
+
+ LineStyleList& getLineStyleList() { return maLineStyleList; }
+ const LineStyleList& getLineStyleList() const { return maLineStyleList; }
+ /** Returns the line properties of the passed one-based themed style index. */
+ const LineProperties* getLineStyle( sal_Int32 nIndex ) const;
+
+ EffectStyleList& getEffectStyleList() { return maEffectStyleList; }
+ const EffectStyleList& getEffectStyleList() const { return maEffectStyleList; }
+ const EffectProperties* getEffectStyle( sal_Int32 nIndex ) const;
+
+ FontScheme& getFontScheme() { return maFontScheme; }
+ const FontScheme& getFontScheme() const { return maFontScheme; }
+ /** Returns theme font properties by scheme type (major/minor). */
+ const TextCharacterProperties* getFontStyle( sal_Int32 nSchemeType ) const;
+ /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */
+ const TextFont* resolveFont( const OUString& rName ) const;
+
+ Shape& getSpDef() { return maSpDef; }
+ const Shape& getSpDef() const { return maSpDef; }
+
+ Shape& getLnDef() { return maLnDef; }
+ const Shape& getLnDef() const { return maLnDef; }
+
+ Shape& getTxDef() { return maTxDef; }
+ const Shape& getTxDef() const { return maTxDef; }
+
+ const css::uno::Reference<css::xml::dom::XDocument>& getFragment() const { return mxFragment; }
+ void setFragment( const css::uno::Reference< css::xml::dom::XDocument>& xRef ) { mxFragment=xRef; }
+
+ void addTheme(const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage) const;
+
+private:
+ OUString maStyleName;
+ OUString maThemeName;
+ ClrScheme maClrScheme;
+ FillStyleList maFillStyleList;
+ FillStyleList maBgFillStyleList;
+ LineStyleList maLineStyleList;
+ EffectStyleList maEffectStyleList;
+ FontScheme maFontScheme;
+ Shape maSpDef;
+ Shape maLnDef;
+ Shape maTxDef;
+ css::uno::Reference< css::xml::dom::XDocument> mxFragment;
+};
+
+
+} // namespace oox::drawingml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/themefragmenthandler.hxx b/include/oox/drawingml/themefragmenthandler.hxx
new file mode 100644
index 000000000..e433c350d
--- /dev/null
+++ b/include/oox/drawingml/themefragmenthandler.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_THEMEFRAGMENTHANDLER_HXX
+#define INCLUDED_OOX_DRAWINGML_THEMEFRAGMENTHANDLER_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+namespace oox::core { class XmlFilterBase; }
+
+namespace oox::drawingml {
+
+class Theme;
+
+
+class OOX_DLLPUBLIC ThemeFragmentHandler final : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit ThemeFragmentHandler(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ Theme& rTheme );
+ virtual ~ThemeFragmentHandler() override;
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+
+private:
+ Theme& mrTheme;
+};
+
+
+} // namespace oox::drawingml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/dffdumper.hxx b/include/oox/dump/dffdumper.hxx
new file mode 100644
index 000000000..e129b0a7f
--- /dev/null
+++ b/include/oox/dump/dffdumper.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DUMP_DFFDUMPER_HXX
+#define INCLUDED_OOX_DUMP_DFFDUMPER_HXX
+
+#include <oox/dump/dumperbase.hxx>
+#include <sal/types.h>
+
+#ifdef DBG_UTIL
+
+namespace oox { class BinaryInputStream; }
+
+namespace oox::dump {
+
+
+class DffStreamObject final : public SequenceRecordObjectBase
+{
+public:
+ sal_uInt16 getVer() const { return mnInstVer & 0x000F; }
+ sal_uInt16 getInst() const { return (mnInstVer & 0xFFF0) >> 4; }
+ bool isContainer() const { return getVer() == 15; }
+
+private:
+ DffStreamObject() {}
+
+ using SequenceRecordObjectBase::construct;
+
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) override;
+ virtual void implWriteExtHeader() override;
+ virtual void implDumpRecordBody() override;
+
+ sal_uInt32 dumpDffSimpleColor( const String& rName );
+
+ void dumpDffOpt();
+ sal_uInt16 dumpDffOptPropHeader();
+
+ sal_uInt16 mnInstVer;
+ sal_Int32 mnRealSize;
+};
+
+
+} // namespace oox::dump
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/dumperbase.hxx b/include/oox/dump/dumperbase.hxx
new file mode 100644
index 000000000..10d3ed78a
--- /dev/null
+++ b/include/oox/dump/dumperbase.hxx
@@ -0,0 +1,1740 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DUMP_DUMPERBASE_HXX
+#define INCLUDED_OOX_DUMP_DUMPERBASE_HXX
+
+#include <cmath>
+#include <cstddef>
+#include <map>
+#include <memory>
+#include <set>
+#include <string_view>
+#include <utility>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <oox/helper/binaryinputstream.hxx>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/storagebase.hxx>
+#include <rtl/string.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <sal/types.h>
+
+#ifdef DBG_UTIL
+
+namespace com::sun::star {
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XTextOutputStream2; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox {
+ class TextInputStream;
+}
+
+namespace oox::core {
+ class FilterBase;
+}
+
+namespace oox::dump {
+
+
+inline constexpr OUStringLiteral OOX_DUMP_UNUSED = u"unused";
+inline constexpr OUStringLiteral OOX_DUMP_UNKNOWN = u"?unknown";
+
+#define OOX_DUMP_ERRASCII( ascii ) "?err:" ascii
+
+#define OOX_DUMP_ERR_NOMAP "no-map"
+inline constexpr OUStringLiteral OOX_DUMP_ERR_NONAME = u"no-name";
+#define OOX_DUMP_ERR_STREAM "stream-error"
+
+#define OOX_DUMP_DUMPEXT ".dump"
+
+const sal_Unicode OOX_DUMP_STRQUOTE = '\'';
+const sal_Unicode OOX_DUMP_FMLASTRQUOTE = '"';
+const sal_Unicode OOX_DUMP_ADDRABS = '$';
+const sal_Unicode OOX_DUMP_R1C1ROW = 'R';
+const sal_Unicode OOX_DUMP_R1C1COL = 'C';
+const sal_Unicode OOX_DUMP_R1C1OPEN = '[';
+const sal_Unicode OOX_DUMP_R1C1CLOSE = ']';
+const sal_Unicode OOX_DUMP_RANGESEP = ':';
+const sal_Unicode OOX_DUMP_BASECLASS = 'B';
+const sal_Unicode OOX_DUMP_FUNCSEP = ',';
+const sal_Unicode OOX_DUMP_LISTSEP = ',';
+const sal_Unicode OOX_DUMP_TABSEP = '!';
+const sal_Unicode OOX_DUMP_ARRAYSEP = ';';
+const sal_Unicode OOX_DUMP_EMPTYVALUE = '~';
+const sal_Unicode OOX_DUMP_CMDPROMPT = '?';
+const sal_Unicode OOX_DUMP_PLACEHOLDER = '\x01';
+
+typedef ::std::pair< OUString, OUString > OUStringPair;
+
+typedef ::std::vector< OUString > OUStringVector;
+typedef ::std::vector< sal_Int64 > Int64Vector;
+
+
+/** Static helper functions for system file and stream access. */
+class InputOutputHelper
+{
+public:
+ // file names -------------------------------------------------------------
+
+ static OUString convertFileNameToUrl( const OUString& rFileName );
+ static sal_Int32 getFileNamePos( std::u16string_view rFileUrl );
+ static std::u16string_view getFileNameExtension( std::u16string_view rFileUrl );
+
+ // input streams ----------------------------------------------------------
+
+ static css::uno::Reference< css::io::XInputStream >
+ openInputStream(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+ // output streams ---------------------------------------------------------
+
+ static css::uno::Reference< css::io::XOutputStream >
+ openOutputStream(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+ static css::uno::Reference< css::io::XTextOutputStream2 >
+ openTextOutputStream(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XOutputStream >& rxOutStrm,
+ rtl_TextEncoding eTextEnc );
+
+ static css::uno::Reference< css::io::XTextOutputStream2 >
+ openTextOutputStream(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& rFileName,
+ rtl_TextEncoding eTextEnc );
+};
+
+
+class BinaryInputStreamRef : public ::oox::BinaryInputStreamRef
+{
+public:
+ BinaryInputStreamRef() {}
+
+ /*implicit*/ BinaryInputStreamRef( std::shared_ptr<BinaryInputStream> const & pInStrm ) :
+ ::oox::BinaryInputStreamRef( pInStrm ) {}
+
+ /*implicit*/ BinaryInputStreamRef( const css::uno::Reference< css::io::XInputStream >& rxInStrm ) :
+ ::oox::BinaryInputStreamRef( std::make_shared<BinaryXInputStream>( rxInStrm, true ) ) {}
+
+ template< typename StreamType >
+ /*implicit*/ BinaryInputStreamRef( const std::shared_ptr< StreamType >& rxInStrm ) :
+ ::oox::BinaryInputStreamRef( rxInStrm ) {}
+};
+
+
+/** Specifiers for atomic data types. */
+enum DataType
+{
+ DATATYPE_VOID, ///< No data type.
+ DATATYPE_INT8, ///< Signed 8-bit integer.
+ DATATYPE_UINT8, ///< Unsigned 8-bit integer.
+ DATATYPE_INT16, ///< Signed 16-bit integer.
+ DATATYPE_UINT16, ///< Unsigned 16-bit integer.
+ DATATYPE_INT32, ///< Signed 32-bit integer.
+ DATATYPE_UINT32, ///< Unsigned 32-bit integer.
+ DATATYPE_INT64, ///< Signed 64-bit integer.
+ DATATYPE_UINT64, ///< Unsigned 64-bit integer.
+ DATATYPE_FLOAT, ///< Floating-point, single precision.
+ DATATYPE_DOUBLE ///< Floating-point, double precision.
+};
+
+
+/** Specifiers for the output format of values. */
+enum FormatType
+{
+ FORMATTYPE_NONE, ///< No numeric format (e.g. show name only).
+ FORMATTYPE_DEC, ///< Decimal.
+ FORMATTYPE_HEX, ///< Hexadecimal.
+ FORMATTYPE_SHORTHEX, ///< Hexadecimal, as short as possible (no leading zeros).
+ FORMATTYPE_BIN, ///< Binary.
+ FORMATTYPE_FIX, ///< Fixed-point.
+ FORMATTYPE_BOOL ///< Boolean ('true' or 'false').
+};
+
+
+/** Describes the output format of a data item.
+
+ Data items are written in the following format:
+
+ <NAME>=<VALUE>=<NAME-FROM-LIST>
+
+ NAME is the name of the data item. The name is contained in the member
+ maItemName. If the name is empty, only the value is written (without a
+ leading equality sign).
+
+ VALUE is the numeric value of the data item. Its format is dependent on the
+ output format given in the member meFmtType. If the format type is
+ FORMATTYPE_NONE, no value is written.
+
+ NAME-FROM-LIST is a symbolic name for the current value of the data item.
+ Various types of name lists produce different names for values, which can
+ be used for enumerations or names for single bits in bitfields (see class
+ NameListBase and derived classes). The name of the list is given in the
+ member maListName. If it is empty, no name is written for the value.
+ */
+struct ItemFormat
+{
+ DataType meDataType; ///< Data type of the item.
+ FormatType meFmtType; ///< Output format for the value.
+ OUString maItemName; ///< Name of the item.
+ OUString maListName; ///< Name of a name list to be used for this item.
+
+ explicit ItemFormat();
+
+ void set( DataType eDataType, FormatType eFmtType, const OUString& rItemName );
+
+ /** Initializes the struct from a vector of strings containing the item format.
+
+ The vector must contain at least 2 strings. The struct is filled from
+ the strings in the vector in the following order:
+ 1) Data type (one of: [u]int8, [u]int16, [u]int32, [u]int64, float, double).
+ 2) Format type (one of: dec, hex, shorthex, bin, fix, bool, unused, unknown).
+ 3) Item name (optional).
+ 4) Name list name (optional).
+
+ @return Iterator pointing to the first unhandled string.
+ */
+ OUStringVector::const_iterator parse( const OUStringVector& rFormatVec );
+
+ /** Initializes the struct from a string containing the item format.
+
+ The string must have the following format:
+ DATATYPE,FORMATTYPE[,ITEMNAME[,LISTNAME]]
+
+ DATATYPE is the data type of the item (see above for possible values).
+ FORMATTYPE is the format type of the item (see above for possible values).
+ ITEMNAME is the name of the item (optional).
+ LISTNAME is the name of a name list (optional).
+
+ @return List containing remaining unhandled format strings.
+ */
+ OUStringVector parse( const OUString& rFormatStr );
+};
+
+
+/** Static helper functions for formatted output to strings. */
+class StringHelper
+{
+public:
+ // append string to string ------------------------------------------------
+
+ static void appendChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount );
+ static void appendString( OUStringBuffer& rStr, const OUString& rData, sal_Int32 nWidth, sal_Unicode cFill = ' ' );
+
+ // append decimal ---------------------------------------------------------
+
+ static void appendDec( OUStringBuffer& rStr, sal_uInt8 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int8 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt16 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int16 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt32 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int32 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt64 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int64 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, double fData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+
+ // append hexadecimal -----------------------------------------------------
+
+ static void appendHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, double fData, bool bPrefix = true );
+
+ // append shortened hexadecimal -------------------------------------------
+
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, double fData, bool bPrefix = true );
+
+ // append binary ----------------------------------------------------------
+
+ static void appendBin( OUStringBuffer& rStr, sal_uInt8 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int8 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt16 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int16 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt32 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int32 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt64 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int64 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, double fData, bool bDots = true );
+
+ // append fixed-point decimal ---------------------------------------------
+
+ template< typename Type >
+ static void appendFix( OUStringBuffer& rStr, Type nData, sal_Int32 nWidth = 0 );
+
+ // append formatted value -------------------------------------------------
+
+ static void appendBool( OUStringBuffer& rStr, bool bData );
+ template< typename Type >
+ static void appendValue( OUStringBuffer& rStr, Type nData, FormatType eFmtType );
+
+ // encoded text output ----------------------------------------------------
+
+ static void appendCChar( OUStringBuffer& rStr, sal_Unicode cChar, bool bPrefix = true );
+ static void appendEncChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount, bool bPrefix = true );
+ static void appendEncString( OUStringBuffer& rStr, const OUString& rData, bool bPrefix = true );
+
+ // token list -------------------------------------------------------------
+
+ static void appendToken( OUStringBuffer& rStr, std::u16string_view rToken, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+
+ static void appendIndex( OUStringBuffer& rStr, sal_Int64 nIdx );
+
+ static std::u16string_view getToken( std::u16string_view rData, sal_Int32& rnPos, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+
+ /** Encloses the passed string with the passed characters. Uses cOpen, if cClose is NUL. */
+ static void enclose( OUStringBuffer& rStr, sal_Unicode cOpen, sal_Unicode cClose = '\0' );
+
+ // string conversion ------------------------------------------------------
+
+ static std::u16string_view trimSpaces( std::u16string_view rStr );
+ static OUString trimTrailingNul( const OUString& rStr );
+
+ static OString convertToUtf8( std::u16string_view rStr );
+ static DataType convertToDataType( std::u16string_view rStr );
+ static FormatType convertToFormatType( std::u16string_view rStr );
+
+ static bool convertFromDec( sal_Int64& ornData, std::u16string_view rData );
+ static bool convertFromHex( sal_Int64& ornData, std::u16string_view rData );
+
+ static bool convertStringToInt( sal_Int64& ornData, std::u16string_view rData );
+ static bool convertStringToDouble( double& orfData, std::u16string_view rData );
+ static bool convertStringToBool( std::u16string_view rData );
+
+ static OUStringPair convertStringToPair( const OUString& rString, sal_Unicode cSep = '=' );
+
+ // string to list conversion ----------------------------------------------
+
+ static void convertStringToStringList( OUStringVector& orVec, const OUString& rData, bool bIgnoreEmpty );
+ static void convertStringToIntList( Int64Vector& orVec, const OUString& rData, bool bIgnoreEmpty );
+};
+
+
+template< typename Type >
+void StringHelper::appendFix( OUStringBuffer& rStr, Type nData, sal_Int32 nWidth )
+{
+ appendDec( rStr, static_cast< double >( nData ) / std::pow( 2.0, 4.0 * sizeof( Type ) ), nWidth );
+}
+
+template< typename Type >
+void StringHelper::appendValue( OUStringBuffer& rStr, Type nData, FormatType eFmtType )
+{
+ switch( eFmtType )
+ {
+ case FORMATTYPE_DEC: appendDec( rStr, nData ); break;
+ case FORMATTYPE_HEX: appendHex( rStr, nData ); break;
+ case FORMATTYPE_SHORTHEX: appendShortHex( rStr, nData ); break;
+ case FORMATTYPE_BIN: appendBin( rStr, nData ); break;
+ case FORMATTYPE_FIX: appendFix( rStr, nData ); break;
+ case FORMATTYPE_BOOL: appendBool( rStr, static_cast<bool>(nData) ); break; // avoid loplugin:pointerbool warning
+ default:;
+ }
+}
+
+
+class String : public OUString
+{
+public:
+ String() {}
+ /*implicit*/ String( const OUString& rStr ) : OUString( rStr ) {}
+ /*implicit*/ String( const char* pcStr ) : OUString( OUString::createFromAscii( pcStr ? pcStr : "" ) ) {}
+ /*implicit*/ String( sal_Unicode cChar ) : OUString( cChar ) {}
+
+ bool has() const { return getLength() > 0; }
+ OUString operator()( const char* pcDefault ) const { if( has() ) return *this; return String( pcDefault ); }
+};
+
+const String EMPTY_STRING;
+
+
+/** Base class for all dumper classes.
+
+ Derived classes implement the virtual function implIsValid(). It should
+ check all members the other functions rely on. If the function
+ implIsValid() returns true, all references and pointers can be used without
+ further checking.
+
+ Overview of all classes in this header file based on this Base class:
+
+ Base
+ |
+ +----> NameListBase
+ | |
+ | +----> ConstList ------> MultiList
+ | |
+ | +----> FlagsList ------> CombiList
+ | |
+ | +----> UnitConverter
+ |
+ +----> SharedConfigData
+ |
+ +----> Config
+ |
+ +----> Output
+ |
+ +----> StorageIterator
+ |
+ +----> ObjectBase
+ |
+ +----> StorageObjectBase
+ |
+ +----> OutputObjectBase
+ | |
+ | +----> InputObjectBase
+ | |
+ | +----> BinaryStreamObject
+ | |
+ | +----> TextStreamObjectBase
+ | | |
+ | | +----> TextStreamObject
+ | | |
+ | | +----> XmlStreamObject
+ | |
+ | +----> RecordObjectBase
+ | |
+ | +----> SequenceRecordObjectBase
+ |
+ +----> DumperBase
+ */
+class Base
+{
+public:
+ virtual ~Base();
+
+ Base(Base const &) = default;
+ Base(Base &&) = default;
+ Base & operator =(Base const &) = default;
+ Base & operator =(Base &&) = default;
+
+ bool isValid() const { return implIsValid(); }
+ static bool isValid( const std::shared_ptr< Base >& rxBase ) { return rxBase && rxBase->isValid(); }
+
+protected:
+ Base() {}
+
+ virtual bool implIsValid() const = 0;
+};
+
+
+class ConfigItemBase
+{
+public:
+ virtual ~ConfigItemBase();
+ void readConfigBlock( TextInputStream& rStrm );
+
+protected:
+ ConfigItemBase() {}
+
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ virtual void implProcessConfigItemInt(
+ TextInputStream& rStrm,
+ sal_Int64 nKey,
+ const OUString& rData );
+
+ void readConfigBlockContents(
+ TextInputStream& rStrm );
+
+private:
+ enum LineType { LINETYPE_DATA, LINETYPE_END };
+
+ static LineType readConfigLine(
+ TextInputStream& rStrm,
+ OUString& orKey,
+ OUString& orData );
+
+ void processConfigItem(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+};
+
+
+class SharedConfigData;
+class Config;
+
+class NameListBase;
+typedef std::shared_ptr< NameListBase > NameListRef;
+
+/** Base class of all classes providing names for specific values (name lists).
+
+ The idea is to provide a unique interface for all different methods to
+ write specific names for any values. This can be enumerations (dedicated
+ names for a subset of values), or names for bits in bit fields. Classes
+ derived from this base class implement the specific behaviour for the
+ desired purpose.
+ */
+class NameListBase : public Base, public ConfigItemBase
+{
+public:
+ typedef ::std::map< sal_Int64, OUString > OUStringMap;
+ typedef OUStringMap::const_iterator const_iterator;
+
+public:
+ virtual ~NameListBase() override;
+
+ /** Sets a name for the specified key. */
+ void setName( sal_Int64 nKey, const String& rName );
+
+ /** Include all names of the passed list. */
+ void includeList( const NameListRef& rxList );
+
+ /** Returns true, if the map contains an entry for the passed key. */
+ template< typename Type >
+ bool hasName( Type nKey ) const
+ { return maMap.count( static_cast< sal_Int64 >( nKey ) ) != 0; }
+
+ /** Returns the name for the passed key. */
+ template< typename Type >
+ OUString getName( const Config& rCfg, Type nKey ) const
+ { return implGetName( rCfg, static_cast< sal_Int64 >( nKey ) ); }
+
+ /** Returns a display name for the passed double value. */
+ OUString getName( const Config& rCfg, double fValue ) const
+ { return implGetNameDbl( rCfg, fValue ); }
+
+ /** Returns a map iterator pointing to the first contained name. */
+ const_iterator begin() const { return maMap.begin(); }
+ /** Returns a map iterator pointing one past the last contained name. */
+ const_iterator end() const { return maMap.end(); }
+
+protected:
+ explicit NameListBase( const SharedConfigData& rCfgData ) : mrCfgData( rCfgData ) {}
+
+ virtual bool implIsValid() const override;
+
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData ) override;
+
+ virtual void implProcessConfigItemInt(
+ TextInputStream& rStrm,
+ sal_Int64 nKey,
+ const OUString& rData ) override;
+
+ /** Derived classes set the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName ) = 0;
+ /** Derived classes generate and return the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const = 0;
+ /** Derived classes generate and return the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const = 0;
+ /** Derived classes insert all names and other settings from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList ) = 0;
+
+ /** Inserts the passed name into the internal map. */
+ void insertRawName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key, or 0, if nothing found. */
+ const OUString* findRawName( sal_Int64 nKey ) const;
+
+private:
+ /** Includes name lists, given in a comma separated list of names of the lists. */
+ void include( const OUString& rListKeys );
+ /** Excludes names from the list, given in a comma separated list of their keys. */
+ void exclude( const OUString& rKeys );
+
+private:
+ OUStringMap maMap;
+ const SharedConfigData& mrCfgData;
+};
+
+
+class ConstList : public NameListBase
+{
+public:
+ explicit ConstList( const SharedConfigData& rCfgData );
+
+ /** Enables or disables automatic quotation of returned names. */
+ void setQuoteNames( bool bQuoteNames ) { mbQuoteNames = bQuoteNames; }
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData ) override;
+
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName ) override;
+ /** Returns the name for the passed key, or the default name, if key is not contained. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const override;
+ /** Returns the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const override;
+ /** Inserts all names from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList ) override;
+
+private:
+ OUString maDefName;
+ bool mbQuoteNames;
+};
+
+
+class MultiList : public ConstList
+{
+public:
+ explicit MultiList( const SharedConfigData& rCfgData );
+
+ void setNamesFromVec( sal_Int64 nStartKey, const OUStringVector& rNames );
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData ) override;
+
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName ) override;
+
+private:
+ bool mbIgnoreEmpty;
+};
+
+
+class FlagsList : public NameListBase
+{
+public:
+ explicit FlagsList( const SharedConfigData& rCfgData );
+
+ /** Returns the flags to be ignored on output. */
+ sal_Int64 getIgnoreFlags() const { return mnIgnore; }
+ /** Sets flags to be ignored on output. */
+ void setIgnoreFlags( sal_Int64 nIgnore ) { mnIgnore = nIgnore; }
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData ) override;
+
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName ) override;
+ /** Returns the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const override;
+ /** Returns the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const override;
+ /** Inserts all flags from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList ) override;
+
+private:
+ sal_Int64 mnIgnore;
+};
+
+
+class CombiList : public FlagsList
+{
+public:
+ explicit CombiList( const SharedConfigData& rCfgData );
+
+protected:
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName ) override;
+ /** Returns the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const override;
+ /** Inserts all flags from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList ) override;
+
+private:
+ struct ExtItemFormatKey
+ {
+ sal_Int64 mnKey;
+ ::std::pair< sal_Int64, sal_Int64 > maFilter;
+ explicit ExtItemFormatKey( sal_Int64 nKey ) : mnKey( nKey ), maFilter( 0, 0 ) {}
+ bool operator<( const ExtItemFormatKey& rRight ) const;
+
+ };
+ struct ExtItemFormat : public ItemFormat
+ {
+ bool mbShiftValue;
+ ExtItemFormat() : mbShiftValue( true ) {}
+ };
+ typedef ::std::map< ExtItemFormatKey, ExtItemFormat > ExtItemFormatMap;
+ ExtItemFormatMap maFmtMap;
+};
+
+
+class UnitConverter : public NameListBase
+{
+public:
+ explicit UnitConverter( const SharedConfigData& rCfgData );
+
+ void setUnitName( const String& rUnitName ) { maUnitName = rUnitName; }
+ void setFactor( double fFactor ) { mfFactor = fFactor; }
+
+protected:
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName ) override;
+ /** Returns the converted value with appended unit name. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const override;
+ /** Returns the converted value with appended unit name. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const override;
+ /** Empty implementation. */
+ virtual void implIncludeList( const NameListBase& rList ) override;
+
+private:
+ OUString maUnitName;
+ double mfFactor;
+};
+
+
+class NameListWrapper
+{
+public:
+ NameListWrapper() {}
+ /*implicit*/ NameListWrapper( const OUString& rListName ) : maName( rListName ) {}
+ /*implicit*/ NameListWrapper( const char* pcListName ) : maName( pcListName ) {}
+ /*implicit*/ NameListWrapper( const NameListRef& rxList ) : mxList( rxList ) {}
+
+ bool isEmpty() const { return !mxList && !maName.has(); }
+ const NameListRef & getNameList( const Config& rCfg ) const;
+
+private:
+ String maName;
+ mutable NameListRef mxList;
+};
+
+const NameListWrapper NO_LIST;
+
+
+class ItemFormatMap
+{
+private:
+ ::std::map< sal_Int64, ItemFormat > maMap;
+
+public:
+ ItemFormatMap() {}
+ explicit ItemFormatMap( const NameListRef& rxNameList ) { insertFormats( rxNameList ); }
+
+ ::std::map< sal_Int64, ItemFormat >::const_iterator end() const { return maMap.end(); }
+ ::std::map< sal_Int64, ItemFormat >::const_iterator find(sal_Int64 nId) const
+ {
+ return maMap.find(nId);
+ }
+
+ void insertFormats( const NameListRef& rxNameList );
+};
+
+
+class SharedConfigData : public Base, public ConfigItemBase
+{
+public:
+ explicit SharedConfigData(
+ const OUString& rFileName,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual ~SharedConfigData() override;
+
+ const css::uno::Reference< css::uno::XComponentContext >& getContext() const { return mxContext; }
+ const StorageRef& getRootStorage() const { return mxRootStrg; }
+ const OUString& getSysFileName() const { return maSysFileName; }
+
+ const OUString* getOption( const OUString& rKey ) const;
+
+ template< typename ListType >
+ std::shared_ptr< ListType > createNameList( const OUString& rListName );
+ void setNameList( const OUString& rListName, const NameListRef& rxList );
+ void eraseNameList( const OUString& rListName );
+ NameListRef getNameList( const OUString& rListName ) const;
+
+protected:
+ virtual bool implIsValid() const override;
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData ) override;
+
+private:
+ bool readConfigFile( const OUString& rFileUrl );
+ template< typename ListType >
+ void readNameList( TextInputStream& rStrm, const OUString& rListName );
+ void createShortList( const OUString& rData );
+ void createUnitConverter( const OUString& rData );
+
+private:
+ typedef ::std::set< OUString > ConfigFileSet;
+ typedef ::std::map< OUString, OUString > ConfigDataMap;
+ typedef ::std::map< OUString, NameListRef > NameListMap;
+
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ StorageRef mxRootStrg;
+ OUString maSysFileName;
+ ConfigFileSet maConfigFiles;
+ ConfigDataMap maConfigData;
+ NameListMap maNameLists;
+ OUString maConfigPath;
+ bool mbLoaded;
+};
+
+
+template< typename ListType >
+std::shared_ptr< ListType > SharedConfigData::createNameList( const OUString& rListName )
+{
+ std::shared_ptr< ListType > xList;
+ if( !rListName.isEmpty() )
+ {
+ xList = std::make_shared<ListType>( *this );
+ setNameList( rListName, xList );
+ }
+ return xList;
+}
+
+template< typename ListType >
+void SharedConfigData::readNameList( TextInputStream& rStrm, const OUString& rListName )
+{
+ NameListRef xList = createNameList< ListType >( rListName );
+ if( xList )
+ xList->readConfigBlock( rStrm );
+}
+
+
+class Config : public Base
+{
+public:
+ explicit Config(
+ const char* pcEnvVar,
+ const ::oox::core::FilterBase& rFilter );
+ explicit Config(
+ const char* pcEnvVar,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual ~Config() override;
+
+ Config(Config const &) = default;
+ Config(Config &&) = default;
+ Config & operator =(Config const &) = default;
+ Config & operator =(Config &&) = default;
+
+ const css::uno::Reference< css::uno::XComponentContext >& getContext() const { return mxCfgData->getContext(); }
+ const StorageRef& getRootStorage() const { return mxCfgData->getRootStorage(); }
+ const OUString& getSysFileName() const { return mxCfgData->getSysFileName(); }
+
+ const OUString& getStringOption( const String& rKey, const OUString& rDefault ) const;
+ bool getBoolOption( const String& rKey, bool bDefault ) const;
+ template< typename Type >
+ Type getIntOption( const String& rKey, Type nDefault ) const;
+
+ bool isDumperEnabled() const;
+ bool isImportEnabled() const;
+
+ template< typename ListType >
+ std::shared_ptr< ListType > createNameList( const String& rListName );
+ void eraseNameList( const String& rListName );
+ NameListRef getNameList( const String& rListName ) const;
+
+ /** Returns the name for the passed key from the passed name list. */
+ template< typename Type >
+ OUString getName( const NameListWrapper& rListWrp, Type nKey ) const;
+ /** Returns true, if the passed name list contains an entry for the passed key. */
+ template< typename Type >
+ bool hasName( const NameListWrapper& rListWrp, Type nKey ) const;
+
+protected:
+ Config() {}
+ void construct(
+ const char* pcEnvVar,
+ const ::oox::core::FilterBase& rFilter );
+ void construct(
+ const char* pcEnvVar,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual bool implIsValid() const override;
+ const OUString* implGetOption( const OUString& rKey ) const;
+
+private:
+ std::shared_ptr< SharedConfigData > mxCfgData;
+};
+
+typedef std::shared_ptr< Config > ConfigRef;
+
+
+template< typename Type >
+Type Config::getIntOption( const String& rKey, Type nDefault ) const
+{
+ sal_Int64 nRawData;
+ const OUString* pData = implGetOption( rKey );
+ return (pData && StringHelper::convertStringToInt( nRawData, *pData )) ?
+ static_cast< Type >( nRawData ) : nDefault;
+}
+
+template< typename ListType >
+std::shared_ptr< ListType > Config::createNameList( const String& rListName )
+{
+ return mxCfgData->createNameList< ListType >( rListName );
+}
+
+template< typename Type >
+OUString Config::getName( const NameListWrapper& rListWrp, Type nKey ) const
+{
+ NameListRef xList = rListWrp.getNameList( *this );
+ return xList ? xList->getName( *this, nKey ) : OOX_DUMP_ERR_NOMAP;
+}
+
+template< typename Type >
+bool Config::hasName( const NameListWrapper& rListWrp, Type nKey ) const
+{
+ NameListRef xList = rListWrp.getNameList( *this );
+ return xList.get() && xList->hasName( nKey );
+}
+
+
+class Output : public Base
+{
+public:
+ explicit Output(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+
+ void newLine();
+ void emptyLine( size_t nCount = 1 );
+
+ void incIndent();
+ void decIndent();
+
+ void startTable( sal_Int32 nW1 );
+ void startTable( sal_Int32 nW1, sal_Int32 nW2 );
+ void startTable( sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 );
+ void startTable( size_t nColCount, const sal_Int32* pnColWidths );
+ void tab();
+ void tab( size_t nCol );
+ void endTable();
+
+ void resetItemIndex( sal_Int64 nIdx = 0 );
+ void startItem( const String& rItemName );
+ void contItem();
+ void endItem();
+
+ void startMultiItems();
+ void endMultiItems();
+
+ void writeChar( sal_Unicode cChar, sal_Int32 nCount = 1 );
+ void writeAscii( const char* pcStr );
+ void writeString( const OUString& rStr );
+ void writeArray( const sal_uInt8* pnData, std::size_t nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ void writeBool( bool bData );
+ void writeDateTime( const css::util::DateTime& rDateTime );
+
+ template< typename Type >
+ void writeDec( Type nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' )
+ { StringHelper::appendDec( maLine, nData, nWidth, cFill ); }
+ template< typename Type >
+ void writeHex( Type nData, bool bPrefix = true )
+ { StringHelper::appendHex( maLine, nData, bPrefix ); }
+ template< typename Type >
+ void writeShortHex( Type nData, bool bPrefix = true )
+ { StringHelper::appendShortHex( maLine, nData, bPrefix ); }
+ template< typename Type >
+ void writeBin( Type nData, bool bDots = true )
+ { StringHelper::appendBin( maLine, nData, bDots ); }
+ template< typename Type >
+ void writeFix( Type nData, sal_Int32 nWidth )
+ { StringHelper::appendFix( maLine, nData, nWidth ); }
+ template< typename Type >
+ void writeValue( Type nData, FormatType eFmtType )
+ { StringHelper::appendValue( maLine, nData, eFmtType ); }
+ template< typename Type >
+ void writeName( const Config& rCfg, Type nData, const NameListWrapper& rListWrp )
+ { writeString( rCfg.getName( rListWrp, nData ) ); }
+
+
+protected:
+ virtual bool implIsValid() const override;
+
+private:
+ void writeItemName( const String& rItemName );
+
+private:
+ css::uno::Reference< css::io::XTextOutputStream2 > mxStrm;
+ OUString maIndent;
+ OUStringBuffer maLine;
+ OUString maLastItem;
+ ::std::vector< sal_Int32 >
+ maColPos;
+ size_t mnCol;
+ size_t mnItemLevel;
+ size_t mnMultiLevel;
+ sal_Int64 mnItemIdx;
+ sal_Int32 mnLastItem;
+};
+
+typedef std::shared_ptr< Output > OutputRef;
+
+
+class IndentGuard
+{
+public:
+ explicit IndentGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.incIndent(); }
+ ~IndentGuard() { mrOut.decIndent(); }
+private:
+ IndentGuard( const IndentGuard& ) = delete;
+ IndentGuard& operator=( const IndentGuard& ) = delete;
+private:
+ Output& mrOut;
+};
+
+
+class TableGuard
+{
+public:
+ explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1 ); }
+ explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1, nW2 ); }
+ explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1, nW2, nW3, nW4 ); }
+ explicit TableGuard( const OutputRef& rxOut, size_t nColCount,
+ const sal_Int32* pnColWidths ) :
+ mrOut( *rxOut ) { mrOut.startTable( nColCount, pnColWidths ); }
+ ~TableGuard() { mrOut.endTable(); }
+ void tab( size_t nCol ) { mrOut.tab( nCol ); }
+private:
+ TableGuard( const TableGuard& ) = delete;
+ TableGuard& operator=( const TableGuard& ) = delete;
+private:
+ Output& mrOut;
+};
+
+
+class ItemGuard
+{
+public:
+ explicit ItemGuard( const OutputRef& rxOut, const String& rName ) :
+ mrOut( *rxOut ) { mrOut.startItem( rName ); }
+ ~ItemGuard() { mrOut.endItem(); }
+ void cont() { mrOut.contItem(); }
+private:
+ ItemGuard( const ItemGuard& ) = delete;
+ ItemGuard& operator=( const ItemGuard& ) = delete;
+private:
+ Output& mrOut;
+};
+
+
+class MultiItemsGuard
+{
+public:
+ explicit MultiItemsGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.startMultiItems(); }
+ ~MultiItemsGuard() { mrOut.endMultiItems(); }
+private:
+ MultiItemsGuard( const MultiItemsGuard& ) = delete;
+ MultiItemsGuard& operator=( const MultiItemsGuard& ) = delete;
+private:
+ Output& mrOut;
+};
+
+
+class StorageIterator : public Base
+{
+public:
+ explicit StorageIterator( const StorageRef& rxStrg );
+ virtual ~StorageIterator() override;
+
+ StorageIterator& operator++();
+
+ OUString getName() const;
+ bool isStream() const;
+ bool isStorage() const;
+
+private:
+ virtual bool implIsValid() const override;
+
+private:
+ StorageRef mxStrg;
+ OUStringVector maNames;
+ OUStringVector::const_iterator maIt;
+};
+
+
+class ObjectBase : public Base
+{
+public:
+ virtual ~ObjectBase() override;
+
+ ObjectBase(ObjectBase const &) = default;
+ ObjectBase(ObjectBase &&) = default;
+ ObjectBase & operator =(ObjectBase const &) = default;
+ ObjectBase & operator =(ObjectBase &&) = default;
+
+ const css::uno::Reference< css::uno::XComponentContext >&
+ getContext() const { return mxConfig->getContext(); }
+
+ void dump();
+
+
+protected:
+ ObjectBase() {}
+
+ void construct( const ConfigRef& rxConfig );
+ void construct( const ObjectBase& rParent );
+
+ virtual bool implIsValid() const override;
+ virtual void implDump();
+
+
+ Config& cfg() const { return *mxConfig; }
+
+private:
+ ConfigRef mxConfig;
+};
+
+typedef std::shared_ptr< ObjectBase > ObjectRef;
+
+
+class StorageObjectBase : public ObjectBase
+{
+protected:
+ StorageObjectBase() {}
+
+protected:
+ using ObjectBase::construct;
+ void construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+ void construct( const ObjectBase& rParent );
+
+ virtual bool implIsValid() const override;
+ virtual void implDump() override;
+
+ virtual void implDumpStream(
+ const css::uno::Reference< css::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+ virtual void implDumpBaseStream(
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+ void addPreferredStream( const String& rStrmName );
+ void addPreferredStorage( const String& rStrgPath );
+
+private:
+ static OUString getSysFileName(
+ const OUString& rStrmName,
+ std::u16string_view rSysOutPath );
+
+ void extractStream(
+ StorageBase& rStrg,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+ void extractStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+ void extractItem(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rItemName,
+ std::u16string_view rSysPath,
+ bool bIsStrg, bool bIsStrm );
+
+private:
+ struct PreferredItem
+ {
+ OUString maName;
+ bool mbStorage;
+
+ explicit PreferredItem( const OUString& rName, bool bStorage ) :
+ maName( rName ), mbStorage( bStorage ) {}
+ };
+ typedef ::std::vector< PreferredItem > PreferredItemVector;
+
+ StorageRef mxStrg;
+ OUString maSysPath;
+ PreferredItemVector maPreferred;
+};
+
+
+class OutputObjectBase : public ObjectBase
+{
+public:
+ virtual ~OutputObjectBase() override;
+
+ OutputObjectBase(OutputObjectBase const &) = default;
+ OutputObjectBase(OutputObjectBase &&) = default;
+ OutputObjectBase & operator =(OutputObjectBase const &) = default;
+ OutputObjectBase & operator =(OutputObjectBase &&) = default;
+
+protected:
+ OutputObjectBase() {}
+
+ using ObjectBase::construct;
+ void construct( const ObjectBase& rParent, const OUString& rSysFileName );
+ void construct( const OutputObjectBase& rParent );
+
+ virtual bool implIsValid() const override;
+
+
+ void writeEmptyItem( const String& rName );
+ void writeInfoItem( const String& rName, const String& rData );
+ void writeCharItem( const String& rName, sal_Unicode cData );
+ void writeStringItem( const String& rName, const OUString& rData );
+ void writeArrayItem( const String& rName, const sal_uInt8* pnData, std::size_t nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ void writeDateTimeItem( const String& rName, const css::util::DateTime& rDateTime );
+ void writeGuidItem( const String& rName, const OUString& rGuid );
+
+ template< typename Type >
+ void addNameToItem( Type nData, const NameListWrapper& rListWrp );
+
+ template< typename Type >
+ void writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp );
+ template< typename Type >
+ void writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp = NO_LIST );
+
+ template< typename Type >
+ void writeValueItem( const ItemFormat& rItemFmt, Type nData );
+
+ template< typename Type >
+ void writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
+ template< typename Type >
+ void writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
+
+protected:
+ OutputRef mxOut;
+ OUString maSysFileName;
+};
+
+
+template< typename Type >
+void OutputObjectBase::addNameToItem( Type nData, const NameListWrapper& rListWrp )
+{
+ if( !rListWrp.isEmpty() )
+ {
+ mxOut->contItem();
+ mxOut->writeName( cfg(), nData, rListWrp );
+ }
+}
+
+template< typename Type >
+void OutputObjectBase::writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeName( cfg(), nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeHex( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeShortHex( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeBin( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeFix( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData );
+ aItem.cont();
+ mxOut->writeBool( nData != 0 );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp )
+{
+ if( eFmtType == FORMATTYPE_BOOL )
+ writeDecBoolItem( rName, nData, rListWrp );
+ else
+ {
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeValue( nData, eFmtType );
+ addNameToItem( nData, rListWrp );
+ }
+}
+
+template< typename Type >
+void OutputObjectBase::writeValueItem( const ItemFormat& rItemFmt, Type nData )
+{
+ OString aNameUtf8 = StringHelper::convertToUtf8( rItemFmt.maItemName );
+ writeValueItem( aNameUtf8.getStr(), nData, rItemFmt.meFmtType, rItemFmt.maListName );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData1 );
+ mxOut->writeChar( cSep );
+ mxOut->writeDec( nData2 );
+}
+
+template< typename Type >
+void OutputObjectBase::writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeHex( nData1 );
+ mxOut->writeChar( cSep );
+ mxOut->writeHex( nData2 );
+}
+
+
+class InputObjectBase : public OutputObjectBase
+{
+public:
+ virtual ~InputObjectBase() override;
+
+ InputObjectBase(InputObjectBase const &) = default;
+ InputObjectBase(InputObjectBase &&) = default;
+ InputObjectBase & operator =(InputObjectBase const &) = default;
+ InputObjectBase & operator =(InputObjectBase &&) = default;
+
+protected:
+ InputObjectBase() {}
+
+ using OutputObjectBase::construct;
+ void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+ void construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm );
+ void construct( const InputObjectBase& rParent );
+
+ virtual bool implIsValid() const override;
+
+ void skipBlock( sal_Int64 nBytes, bool bShowSize = true );
+ void dumpRawBinary( sal_Int64 nBytes, bool bShowOffset, bool bStream = false );
+
+ void dumpBinary( const String& rName, sal_Int64 nBytes, bool bShowOffset = true );
+ void dumpRemaining( sal_Int64 nBytes );
+ void dumpRemainingTo( sal_Int64 nPos );
+ void dumpRemainingStream();
+
+ void dumpArray( const String& rName, sal_Int32 nBytes, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ void dumpUnused( sal_Int32 nBytes ) { dumpArray( OUString(OOX_DUMP_UNUSED), nBytes ); }
+ void dumpUnknown( sal_Int32 nBytes ) { dumpArray( OUString(OOX_DUMP_UNKNOWN), nBytes ); }
+
+ sal_Unicode dumpUnicode( const String& rName );
+
+ OUString dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul = false );
+ OUString dumpUnicodeArray( const String& rName, sal_Int32 nLen, bool bHideTrailingNul = false );
+
+ css::util::DateTime dumpFileTime( const String& rName = EMPTY_STRING );
+ OUString dumpGuid( const String& rName = EMPTY_STRING );
+
+ void dumpItem( const ItemFormat& rItemFmt );
+
+ template< typename Type >
+ Type dumpName( const String& rName, const NameListWrapper& rListWrp );
+ template< typename Type >
+ Type dumpDec( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpHex( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpBin( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpFix( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpBool( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpValue( const ItemFormat& rItemFmt );
+
+ template< typename Type1, typename Type2 >
+ Type1 dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpValue( bool bType1, const ItemFormat& rItemFmt );
+
+ template< typename Type >
+ void dumpDecPair( const String& rName, sal_Unicode cSep = ',' );
+ template< typename Type >
+ void dumpHexPair( const String& rName, sal_Unicode cSep = ',' );
+
+protected:
+ BinaryInputStreamRef mxStrm;
+};
+
+
+template< typename Type >
+Type InputObjectBase::dumpName( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData = mxStrm->readValue<Type>();
+ writeNameItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpDec( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData = mxStrm->readValue<Type>();
+ writeDecItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpHex( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData = mxStrm->readValue<Type>();
+ writeHexItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpBin( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData = mxStrm->readValue<Type>();
+ writeBinItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpFix( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData = mxStrm->readValue<Type>();
+ writeFixItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpBool( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData = mxStrm->readValue<Type>();
+ writeDecBoolItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpValue( const ItemFormat& rItemFmt )
+{
+ Type nData = mxStrm->readValue<Type>();
+ writeValueItem( rItemFmt, nData );
+ return nData;
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpName< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpName< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpDec< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpDec< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpHex< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpHex< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpBin< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBin< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpFix< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpFix< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpBool< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBool< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpValue( bool bType1, const ItemFormat& rItemFmt )
+{
+ return bType1 ? dumpValue< Type1 >( rItemFmt ) : static_cast< Type1 >( dumpValue< Type2 >( rItemFmt ) );
+}
+
+template< typename Type >
+void InputObjectBase::dumpDecPair( const String& rName, sal_Unicode cSep )
+{
+ Type nData1, nData2;
+ *mxStrm >> nData1 >> nData2;
+ writeDecPairItem( rName, nData1, nData2, cSep );
+}
+
+template< typename Type >
+void InputObjectBase::dumpHexPair( const String& rName, sal_Unicode cSep )
+{
+ Type nData1, nData2;
+ *mxStrm >> nData1 >> nData2;
+ writeHexPairItem( rName, nData1, nData2, cSep );
+}
+
+
+class BinaryStreamObject final : public InputObjectBase
+{
+public:
+ explicit BinaryStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+private:
+ void dumpBinaryStream( bool bShowOffset = true );
+
+ virtual void implDump() override;
+};
+
+
+class TextStreamObjectBase : public InputObjectBase
+{
+protected:
+ TextStreamObjectBase() {}
+
+ using InputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc,
+ const OUString& rSysFileName );
+ void construct(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc );
+
+ virtual bool implIsValid() const override;
+ virtual void implDump() override;
+
+ virtual void implDumpText( TextInputStream& rTextStrm ) = 0;
+
+private:
+ void constructTextStrmObj( rtl_TextEncoding eTextEnc );
+
+ std::shared_ptr< TextInputStream > mxTextStrm;
+};
+
+
+class TextLineStreamObject final : public TextStreamObjectBase
+{
+public:
+ explicit TextLineStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc,
+ const OUString& rSysFileName );
+
+ explicit TextLineStreamObject(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc );
+
+private:
+ virtual void implDumpText( TextInputStream& rTextStrm ) override;
+ void implDumpLine( const OUString& rLine, sal_uInt32 nLine );
+};
+
+
+class XmlStreamObject : public TextStreamObjectBase
+{
+public:
+ explicit XmlStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDumpText( TextInputStream& rTextStrm ) override;
+};
+
+
+class RecordObjectBase : public InputObjectBase
+{
+protected:
+ RecordObjectBase() {}
+
+ using InputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxBaseStrm,
+ const OUString& rSysFileName,
+ const BinaryInputStreamRef& rxRecStrm,
+ const String& rRecNames,
+ const String& rSimpleRecs );
+
+ sal_Int64 getRecId() const { return mnRecId; }
+ sal_Int64 getRecSize() const { return mnRecSize; }
+
+ virtual bool implIsValid() const override;
+ virtual void implDump() override;
+
+ virtual bool implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
+ virtual void implWriteExtHeader();
+ virtual void implDumpRecordBody();
+
+private:
+ void constructRecObjBase(
+ const BinaryInputStreamRef& rxBaseStrm,
+ const String& rRecNames,
+ const String& rSimpleRecs );
+
+ void writeHeader();
+
+private:
+ BinaryInputStreamRef mxBaseStrm;
+ NameListWrapper maRecNames;
+ NameListWrapper maSimpleRecs;
+ sal_Int64 mnRecPos;
+ sal_Int64 mnRecId;
+ sal_Int64 mnRecSize;
+ bool mbShowRecPos;
+ bool mbBinaryOnly;
+};
+
+
+class SequenceRecordObjectBase : public RecordObjectBase
+{
+protected:
+ SequenceRecordObjectBase() : mxRecData( std::make_shared<StreamDataSequence>() ) {}
+
+ using RecordObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxBaseStrm,
+ const OUString& rSysFileName,
+ const String& rRecNames,
+ const String& rSimpleRecs );
+
+ virtual bool implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize ) override;
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
+
+private:
+ std::shared_ptr< StreamDataSequence > mxRecData;
+};
+
+
+/** Base class for a file dumper. Derived classes implement the implDump()
+ function to add functionality.
+ */
+class DumperBase : public ObjectBase
+{
+public:
+ virtual ~DumperBase() override;
+
+ bool isImportEnabled() const;
+
+protected:
+ DumperBase() {}
+
+ using ObjectBase::construct;
+ void construct( const ConfigRef& rxConfig );
+};
+
+
+} // namespace oox::dump
+
+#define OOX_DUMP_FILE( DumperClassName ) \
+do { \
+ DumperClassName aDumper( *this ); \
+ aDumper.dump(); \
+ if( !aDumper.isImportEnabled() ) \
+ return aDumper.isValid(); \
+} while( false )
+
+#else // DBG_UTIL
+
+#define OOX_DUMP_FILE( DumperClassName ) (void)0
+
+#endif // DBG_UTIL
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/oledumper.hxx b/include/oox/dump/oledumper.hxx
new file mode 100644
index 000000000..77b3ab14c
--- /dev/null
+++ b/include/oox/dump/oledumper.hxx
@@ -0,0 +1,849 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DUMP_OLEDUMPER_HXX
+#define INCLUDED_OOX_DUMP_OLEDUMPER_HXX
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dump/dumperbase.hxx>
+#include <oox/helper/binaryinputstream.hxx>
+#include <oox/helper/storagebase.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+#ifdef DBG_UTIL
+
+namespace com::sun::star {
+ namespace io { class XInputStream; }
+}
+
+namespace oox::dump {
+
+
+class OleInputObjectBase : public InputObjectBase
+{
+protected:
+ OleInputObjectBase() {}
+
+ OUString dumpAnsiString32( const String& rName );
+ OUString dumpUniString32( const String& rName );
+
+ sal_Int32 dumpStdClipboardFormat( const String& rName );
+ OUString dumpAnsiString32OrStdClip( const String& rName );
+ OUString dumpUniString32OrStdClip( const String& rName );
+
+ void writeOleColorItem( const String& rName, sal_uInt32 nColor );
+ sal_uInt32 dumpOleColor( const String& rName );
+};
+
+
+class StdFontObject : public OleInputObjectBase
+{
+public:
+ explicit StdFontObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDump() override;
+};
+
+
+class StdPicObject : public OleInputObjectBase
+{
+public:
+ explicit StdPicObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDump() override;
+};
+
+
+class OleStreamObject : public OleInputObjectBase
+{
+public:
+ explicit OleStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+};
+
+
+class OleCompObjObject : public OleStreamObject
+{
+public:
+ explicit OleCompObjObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+
+protected:
+ virtual void implDump() override;
+};
+
+
+class OlePropertyStreamObject : public InputObjectBase
+{
+public:
+ explicit OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+
+protected:
+ virtual void implDump() override;
+
+private:
+ void dumpSection( const OUString& rGuid, sal_uInt32 nStartPos );
+
+ void dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos );
+ void dumpCodePageProperty( sal_uInt32 nStartPos );
+ void dumpDictionaryProperty( sal_uInt32 nStartPos );
+
+ sal_uInt16 dumpPropertyContents( sal_Int32 nPropId );
+ void dumpPropertyValue( sal_Int32 nPropId, sal_uInt16 nBaseType );
+ void dumpPropertyVector( sal_Int32 nPropId, sal_uInt16 nBaseType );
+
+ sal_uInt16 dumpPropertyType();
+ void dumpBlob( sal_Int32 nPropId, const String& rName );
+ OUString dumpString8( const String& rName );
+ OUString dumpCharArray8( const String& rName, sal_Int32 nLen );
+ OUString dumpString16( const String& rName );
+ OUString dumpCharArray16( const String& rName, sal_Int32 nLen );
+ bool dumpTypedProperty( const String& rName, sal_uInt16 nExpectedType );
+ void dumpHlinks( sal_Int32 nSize );
+
+ bool startElement( sal_uInt32 nStartPos );
+ void writeSectionHeader( const OUString& rGuid, sal_uInt32 nStartPos );
+ void writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos );
+
+private:
+ NameListRef mxPropIds;
+ rtl_TextEncoding meTextEnc;
+ bool mbIsUnicode;
+};
+
+
+class OleStorageObject : public StorageObjectBase
+{
+public:
+ explicit OleStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+
+protected:
+ OleStorageObject() {}
+
+ using StorageObjectBase::construct;
+
+ virtual void implDumpStream(
+ const css::uno::Reference< css::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName ) override;
+};
+
+
+class ComCtlObjectBase : public OleInputObjectBase
+{
+protected:
+ explicit ComCtlObjectBase(
+ const InputObjectBase& rParent,
+ sal_uInt32 nDataId5, sal_uInt32 nDataId6, sal_uInt16 nVersion,
+ bool bCommonPart, bool bComplexPart );
+
+ virtual void implDump() override;
+ virtual void implDumpProperties() = 0;
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+
+private:
+ bool dumpComCtlHeader( sal_uInt32 nExpId, sal_uInt16 nExpMajor = SAL_MAX_UINT16, sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
+ bool dumpComCtlSize();
+ bool dumpComCtlData( sal_uInt32& ornCommonPartSize );
+ bool dumpComCtlCommon( sal_uInt32 nPartSize );
+ bool dumpComCtlComplex();
+
+protected:
+ sal_uInt32 mnDataId5;
+ sal_uInt32 mnDataId6;
+ sal_uInt16 mnVersion;
+ bool mbCommonPart;
+ bool mbComplexPart;
+};
+
+
+class ComCtlScrollBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlScrollBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties() override;
+};
+
+
+class ComCtlProgressBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlProgressBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties() override;
+};
+
+
+class ComCtlSliderObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlSliderObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties() override;
+};
+
+
+class ComCtlUpDownObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlUpDownObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties() override;
+};
+
+
+class ComCtlImageListObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlImageListObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties() override;
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos ) override;
+ virtual void implDumpCommonTrailing() override;
+};
+
+
+class ComCtlTabStripObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlTabStripObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties() override;
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos ) override;
+};
+
+
+class ComCtlTreeViewObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlTreeViewObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties() override;
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos ) override;
+
+private:
+ sal_uInt32 mnStringFlags;
+};
+
+
+class ComCtlStatusBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlStatusBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties() override;
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos ) override;
+ virtual void implDumpCommonTrailing() override;
+};
+
+
+class AxPropertyObjectBase : public OleInputObjectBase
+{
+protected:
+ AxPropertyObjectBase() {}
+
+ using OleInputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ const String& rPropNameList,
+ bool b64BitPropFlags = false );
+ void construct(
+ const InputObjectBase& rParent,
+ const String& rPropNameList,
+ bool b64BitPropFlags = false );
+
+ virtual bool implIsValid() const override;
+ virtual void implDump() override;
+
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+ bool ensureValid( bool bCondition = true );
+
+ template< typename Type >
+ void alignInput();
+
+ void setAlignAnchor();
+ bool startNextProperty();
+ OUString getPropertyName() const;
+
+ template< typename Type >
+ Type dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
+
+ bool dumpBoolProperty() { return startNextProperty(); }
+ sal_Int32 dumpHmmProperty() { return dumpDecProperty< sal_Int32 >( 0, "CONV-HMM-TO-CM" ); }
+ sal_uInt8 dumpMousePtrProperty() { return dumpDecProperty< sal_uInt8 >( 0, "OLE-MOUSEPTR" ); }
+ template< typename Type >
+ Type dumpBorderStyleProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-BORDERSTYLE" ); }
+ template< typename Type >
+ Type dumpSpecialEffectProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-SPECIALEFFECT" ); }
+ sal_uInt32 dumpEnabledProperty() { return dumpDecProperty< sal_uInt32 >( 1, "AX-ENABLED" ); }
+ sal_Int32 dumpOrientationProperty() { return dumpDecProperty< sal_Int32 >( -1, "AX-ORIENTATION" ); }
+ sal_Int32 dumpDelayProperty() { return dumpDecProperty< sal_Int32 >( 50, "AX-CONV-MS" ); }
+ sal_uInt32 dumpImagePosProperty() { return dumpHexProperty< sal_uInt32 >( 0x00070001, "AX-IMAGEPOS" ); }
+ sal_uInt8 dumpImageSizeModeProperty() { return dumpDecProperty< sal_uInt8 >( 0, "AX-IMAGESIZEMODE" ); }
+ sal_uInt8 dumpImageAlignProperty() { return dumpDecProperty< sal_uInt8 >( 2, "AX-IMAGEALIGN" ); }
+
+ sal_uInt32 dumpFlagsProperty( sal_uInt32 nDefault, const char* pcNameList = "AX-FLAGS" );
+ sal_uInt32 dumpColorProperty( sal_uInt32 nDefault );
+ sal_Unicode dumpUnicodeProperty();
+ void dumpUnknownProperty();
+
+ void dumpPosProperty();
+ void dumpSizeProperty();
+ void dumpGuidProperty( OUString* pValue = nullptr );
+ void dumpStringProperty( OUString* pValue = nullptr );
+ void dumpStringArrayProperty();
+ void dumpStreamProperty();
+
+ void dumpEmbeddedFont();
+ void dumpToPosition( sal_Int64 nPos );
+
+private:
+ void constructAxPropObj( const String& rPropNameList, bool b64BitPropFlags );
+
+ void dumpVersion();
+ OUString dumpString( const String& rName, sal_uInt32 nSize, bool bArray );
+ void dumpShortProperties();
+ void dumpLargeProperties();
+
+private:
+ struct LargeProperty
+ {
+ enum LargePropertyType { PROPTYPE_POS, PROPTYPE_SIZE, PROPTYPE_GUID, PROPTYPE_STRING, PROPTYPE_STRINGARRAY };
+
+ LargePropertyType mePropType;
+ OUString maItemName;
+ sal_uInt32 mnDataSize;
+ OUString* mpItemValue;
+ explicit LargeProperty( LargePropertyType ePropType, const String& rItemName, sal_uInt32 nDataSize, OUString* pItemValue = nullptr ) :
+ mePropType( ePropType ), maItemName( rItemName ), mnDataSize( nDataSize ), mpItemValue( pItemValue ) {}
+ };
+ typedef ::std::vector< LargeProperty > LargePropertyVector;
+
+ struct StreamProperty
+ {
+ OUString maItemName;
+ sal_uInt16 mnData;
+ explicit StreamProperty( const String& rItemName, sal_uInt16 nData ) :
+ maItemName( rItemName ), mnData( nData ) {}
+ };
+
+ LargePropertyVector maLargeProps;
+ std::vector< StreamProperty >
+ maStreamProps;
+ NameListRef mxPropNames;
+ sal_Int64 mnPropertiesStart;
+ sal_Int64 mnPropertiesEnd;
+ sal_Int64 mnPropFlags;
+ sal_Int64 mnCurrProp;
+ bool mb64BitPropFlags;
+ bool mbValid;
+};
+
+
+template< typename Type >
+void AxPropertyObjectBase::alignInput()
+{
+ mxStrm->skip( (sizeof( Type ) - ((mxStrm->tell() - mnPropertiesStart) % sizeof( Type ))) % sizeof( Type ) );
+}
+
+template< typename Type >
+Type AxPropertyObjectBase::dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp )
+{
+ if( startNextProperty() )
+ {
+ alignInput< Type >();
+ return dumpDec< Type >( getPropertyName(), rListWrp );
+ }
+ return nDefault;
+}
+
+template< typename Type >
+Type AxPropertyObjectBase::dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp )
+{
+ if( startNextProperty() )
+ {
+ alignInput< Type >();
+ return dumpHex< Type >( getPropertyName(), rListWrp );
+ }
+ return nDefault;
+}
+
+
+class AxCFontNewObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxCFontNewObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+};
+
+
+class AxColumnInfoObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxColumnInfoObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+};
+
+
+class AxCommandButtonObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxCommandButtonObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+ virtual void implDumpExtended() override;
+};
+
+
+class AxMorphControlObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxMorphControlObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+ virtual void implDumpExtended() override;
+
+private:
+ void dumpColumnInfos();
+
+private:
+ sal_uInt16 mnColInfoCount;
+ sal_uInt8 mnCtrlType;
+};
+
+
+class AxLabelObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxLabelObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+ virtual void implDumpExtended() override;
+};
+
+
+class AxImageObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxImageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+};
+
+
+class AxScrollBarObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxScrollBarObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+};
+
+
+class AxSpinButtonObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxSpinButtonObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+};
+
+
+class AxTabStripObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxTabStripObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+ virtual void implDumpExtended() override;
+
+private:
+ sal_Int32 mnTabFlagCount;
+};
+
+
+class FormControlStreamObject : public OleInputObjectBase
+{
+public:
+ explicit FormControlStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ const OUString* pProgId = nullptr );
+ explicit FormControlStreamObject(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString* pProgId = nullptr );
+
+protected:
+ virtual void implDump() override;
+
+private:
+ void constructFormCtrlStrmObj( const OUString* pProgId );
+
+private:
+ OUString maProgId;
+ bool mbReadGuid;
+};
+
+
+struct VbaFormSiteInfo
+{
+ OUString maProgId;
+ sal_Int32 mnId;
+ sal_uInt32 mnLength;
+ bool mbInStream;
+
+ VbaFormSiteInfo() : mnId( 0 ), mnLength( 0 ), mbInStream( false ) {}
+};
+
+
+struct VbaFormSharedData
+{
+ OUStringVector maClassInfoProgIds;
+ std::vector< VbaFormSiteInfo > maSiteInfos;
+};
+
+
+class VbaFormClassInfoObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormClassInfoObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties() override;
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+
+class VbaFormSiteObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormSiteObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties() override;
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+
+class VbaFormDesignExtObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormDesignExtObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+};
+
+
+class VbaFStreamObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties() override;
+ virtual void implDumpExtended() override;
+
+private:
+ void dumpClassInfos();
+ void dumpFormSites( sal_uInt32 nCount );
+ void dumpSiteData();
+ void dumpDesignExtender();
+
+private:
+ VbaFormSharedData& mrFormData;
+ sal_uInt32 mnFlags;
+};
+
+
+class VbaOStreamObject : public OleInputObjectBase
+{
+public:
+ explicit VbaOStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDump() override;
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+
+class VbaPageObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaPageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+};
+
+
+class VbaMultiPageObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaMultiPageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties() override;
+ virtual void implDumpExtended() override;
+
+private:
+ sal_Int32 mnPageCount;
+};
+
+
+class VbaXStreamObject : public InputObjectBase
+{
+public:
+ explicit VbaXStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDump() override;
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+
+class VbaContainerStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaContainerStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath );
+
+protected:
+ virtual void implDumpStream(
+ const css::uno::Reference< css::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName ) override;
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath ) override;
+
+private:
+ bool isFormStorage( const OUString& rStrgPath ) const;
+
+private:
+ VbaFormSharedData maFormData;
+};
+
+
+struct VbaSharedData
+{
+ typedef ::std::map< OUString, sal_Int32 > StreamOffsetMap;
+
+ StreamOffsetMap maStrmOffsets;
+ rtl_TextEncoding meTextEnc;
+
+ VbaSharedData();
+
+ bool isModuleStream( const OUString& rStrmName ) const;
+ sal_Int32 getStreamOffset( const OUString& rStrmName ) const;
+};
+
+
+class VbaDirStreamObject : public SequenceRecordObjectBase
+{
+public:
+ explicit VbaDirStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual bool implIsValid() const override;
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) override;
+ virtual void implDumpRecordBody() override;
+
+private:
+ OUString dumpByteString( const String& rName );
+ OUString dumpUniString( const String& rName );
+ OUString dumpByteStringWithLength( const String& rName );
+
+private:
+ VbaSharedData& mrVbaData;
+ BinaryInputStreamRef mxInStrm;
+ OUString maCurrStream;
+ sal_Int32 mnCurrOffset;
+};
+
+
+class VbaModuleStreamObject : public InputObjectBase
+{
+public:
+ explicit VbaModuleStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaSharedData& rVbaData,
+ sal_Int32 nStrmOffset );
+
+protected:
+ virtual void implDump() override;
+
+private:
+ VbaSharedData& mrVbaData;
+ sal_Int32 mnStrmOffset;
+};
+
+
+class VbaStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual void implDumpStream(
+ const css::uno::Reference< css::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName ) override;
+
+private:
+ VbaSharedData& mrVbaData;
+};
+
+
+class VbaFormStorageObject : public VbaContainerStorageObject
+{
+public:
+ explicit VbaFormStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual void implDumpStream(
+ const css::uno::Reference< css::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName ) override;
+
+private:
+ VbaSharedData& mrVbaData;
+};
+
+
+class VbaProjectStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaProjectStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+
+protected:
+ virtual void implDumpStream(
+ const css::uno::Reference< css::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName ) override;
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath ) override;
+
+private:
+ VbaSharedData maVbaData;
+};
+
+
+class ActiveXStorageObject : public VbaContainerStorageObject
+{
+public:
+ explicit ActiveXStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath );
+
+protected:
+ virtual void implDumpBaseStream(
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName ) override;
+};
+
+
+} // namespace oox::dump
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/pptxdumper.hxx b/include/oox/dump/pptxdumper.hxx
new file mode 100644
index 000000000..9e12ecd48
--- /dev/null
+++ b/include/oox/dump/pptxdumper.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DUMP_PPTXDUMPER_HXX
+#define INCLUDED_OOX_DUMP_PPTXDUMPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dump/dumperbase.hxx>
+#include <rtl/ustring.hxx>
+
+#ifdef DBG_UTIL
+
+namespace com::sun::star {
+ namespace io { class XInputStream; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox::core { class FilterBase; }
+
+namespace oox::dump::pptx {
+
+
+class RootStorageObject : public StorageObjectBase
+{
+public:
+ explicit RootStorageObject( const DumperBase& rParent );
+
+protected:
+ virtual void implDumpStream(
+ const css::uno::Reference< css::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName ) override;
+};
+
+
+class Dumper : public DumperBase
+{
+public:
+ explicit Dumper( const ::oox::core::FilterBase& rFilter );
+
+ explicit Dumper(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XInputStream >& rxInStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDump() override;
+};
+
+
+} // namespace oox::dump::pptx
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/xlsbdumper.hxx b/include/oox/dump/xlsbdumper.hxx
new file mode 100644
index 000000000..96acd2616
--- /dev/null
+++ b/include/oox/dump/xlsbdumper.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DUMP_XLSBDUMPER_HXX
+#define INCLUDED_OOX_DUMP_XLSBDUMPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dump/dumperbase.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+#ifdef DBG_UTIL
+
+namespace com::sun::star {
+ namespace io { class XInputStream; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox {
+ class BinaryInputStream;
+ class SequenceInputStream;
+}
+
+namespace oox::core { class FilterBase; }
+
+namespace oox::dump::xlsb {
+
+
+class RecordObjectBase final : public SequenceRecordObjectBase
+{
+ explicit RecordObjectBase();
+ virtual ~RecordObjectBase() override;
+
+ using SequenceRecordObjectBase::construct;
+
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) override;
+};
+
+
+class RootStorageObject : public StorageObjectBase
+{
+public:
+ explicit RootStorageObject( const DumperBase& rParent );
+
+protected:
+ virtual void implDumpStream(
+ const css::uno::Reference< css::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName ) override;
+};
+
+
+class Dumper : public DumperBase
+{
+public:
+ explicit Dumper( const ::oox::core::FilterBase& rFilter );
+
+ explicit Dumper(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XInputStream >& rxInStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDump() override;
+};
+
+
+} // namespace oox::dmp::xlsb
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/DMLPresetShapeExport.hxx b/include/oox/export/DMLPresetShapeExport.hxx
new file mode 100644
index 000000000..1f650f558
--- /dev/null
+++ b/include/oox/export/DMLPresetShapeExport.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_OOX_EXPORT_DMLPRESETSHAPEXPORT_HXX
+#define INCLUDED_OOX_EXPORT_DMLPRESETSHAPEXPORT_HXX
+
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+#include <string_view>
+
+#include <oox/export/drawingml.hxx>
+
+namespace com::sun::star::beans
+{
+struct PropertyValue;
+}
+
+namespace com::sun::star::drawing
+{
+class XShape;
+struct EnhancedCustomShapeAdjustmentValue;
+}
+
+namespace oox::core
+{
+class XmlFilterBase;
+}
+
+namespace oox::drawingml
+{
+/// Class for exporting the custom shapes to OOXML preset ones, if possible.
+/// This functionality needed for keeping the information for the office programs
+/// about the shape type, and geometry data. Before these shapes were exported
+/// with custom geometry, and they kept their geometry but has no information
+/// about the shape itself. This lead to lost textbox size/position/padding for
+/// example.
+class DMLPresetShapeExporter
+{
+private:
+ // the shape to export
+ css::uno::Reference<css::drawing::XShape> m_xShape;
+ // the DMLwriter
+ DrawingML* m_pDMLexporter;
+ // the type of the custom shape (diamond/rectangle/circle/triangle...)
+ OUString m_sPresetShapeType;
+ // True if the shape has points where its geometry can be modified
+ bool m_bHasHandleValues;
+ // The first the x the second the y coordinate, of flipping
+ std::pair<bool, bool> m_bIsFlipped;
+
+ // Custom Shape Geometry information for export:
+
+ // The adjusting values stored in this sequence:
+ css::uno::Sequence<css::drawing::EnhancedCustomShapeAdjustmentValue> m_AdjustmentValues;
+ // Shapes what have adjusting points, the range of these points
+ // and the index of the value stored in this sequence:
+ css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>> m_HandleValues;
+
+ //TODO:
+ //css::awt::Rectangle m_ViewBox;
+ //css::uno::Sequence<css::beans::PropertyValue> m_Path;
+ //css::uno::Sequence<OUString> m_Equations;
+
+public:
+ DMLPresetShapeExporter() = delete;
+ ~DMLPresetShapeExporter();
+
+ DMLPresetShapeExporter(DrawingML* pDMLExporter,
+ css::uno::Reference<css::drawing::XShape> xShape);
+
+ // Writes the preset shape to the xml
+ bool WriteShape();
+
+private:
+ struct AdjustmentPointValueBase
+ {
+ std::optional<double> nMaxVal;
+ std::optional<double> nMinVal;
+ std::optional<double> nCurrVal;
+ };
+
+ typedef AdjustmentPointValueBase RadiusAdjustmentValue;
+ typedef AdjustmentPointValueBase AngleAdjustmentValue;
+ typedef AdjustmentPointValueBase XAdjustmentValue;
+ typedef AdjustmentPointValueBase YAdjustmentValue;
+
+ // Returns true, if the shape has adjusting points
+ bool HasHandleValue() const;
+
+ // Returns true if the shape flipped.
+ bool IsXFlipped() const { return m_bIsFlipped.first; };
+ bool IsYFlipped() const { return m_bIsFlipped.second; };
+
+ // Returns with the shape type, like triangle for example
+ const OUString& GetShapeType() const;
+ // Returns with the handle points
+ const css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>>&
+ GetHandleValues() const;
+ // Returns with the adjustment values
+ const css::uno::Sequence<css::drawing::EnhancedCustomShapeAdjustmentValue>&
+ GetAdjustmentValues() const;
+ // Returns with the raw value of the given property of the shape geometry.
+ css::uno::Any GetHandleValueOfModificationPoint(sal_Int32 nPoint, std::u16string_view sType);
+ // Returns with the appropriate value of the handle point.
+ RadiusAdjustmentValue GetAdjustmentPointRadiusValue(sal_Int32 nPoint);
+ AngleAdjustmentValue GetAdjustmentPointAngleValue(sal_Int32 nPoint);
+ XAdjustmentValue GetAdjustmentPointXValue(sal_Int32 nPoint);
+ YAdjustmentValue GetAdjustmentPointYValue(sal_Int32 nPoint);
+
+ // Writes one adjustment point.
+ bool WriteAV(const OUString& sValName, const OUString& sVal);
+ // Opens/Closes the AVlist tag.
+ bool StartAVListWriting();
+ bool EndAVListWriting();
+
+ // Finds the given value in the sequence
+ static css::uno::Any FindHandleValue(css::uno::Sequence<css::beans::PropertyValue> aValues,
+ std::u16string_view sKey);
+ // Writes and converts the adjustment points from sdr to ooxml ones per shape type.
+ bool WriteShapeWithAVlist();
+
+}; // end of DMLPresetShapeExporter class
+
+} // end of namespace oox::drawingml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
new file mode 100644
index 000000000..6a40254f6
--- /dev/null
+++ b/include/oox/export/chartexport.hxx
@@ -0,0 +1,279 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
+#define INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
+
+#include <set>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <oox/dllapi.h>
+#include <oox/export/drawingml.hxx>
+#include <oox/export/shapes.hxx>
+#include <oox/export/utils.hxx>
+#include <oox/token/tokens.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <sax/fshelper.hxx>
+
+namespace com::sun::star {
+ namespace beans {
+ class XPropertySet;
+ }
+ namespace chart {
+ class XDiagram;
+ class XChartDocument;
+ }
+ namespace chart2 {
+ struct RelativePosition;
+ struct RelativeSize;
+ class XDiagram;
+ class XChartDocument;
+ class XDataSeries;
+ class XChartType;
+ namespace data
+ {
+ class XDataSequence;
+ class XLabeledDataSequence;
+ }
+ }
+ namespace drawing {
+ class XShape;
+ }
+ namespace frame {
+ class XModel;
+ }
+}
+
+namespace oox {
+namespace core {
+ class XmlFilterBase;
+}}
+
+namespace oox::drawingml {
+
+enum AxesType
+{
+ AXIS_PRIMARY_X = 1,
+ AXIS_PRIMARY_Y = 2,
+ AXIS_PRIMARY_Z = 3,
+ AXIS_SECONDARY_X = 4,
+ AXIS_SECONDARY_Y = 5
+};
+
+struct AxisIdPair{
+ AxesType nAxisType;
+ sal_Int32 nAxisId;
+ sal_Int32 nCrossAx;
+
+ AxisIdPair(AxesType nType, sal_Int32 nId, sal_Int32 nAx)
+ : nAxisType(nType)
+ , nAxisId(nId)
+ , nCrossAx(nAx)
+ {}
+};
+
+/**
+ A helper container class to collect the chart data point labels and the address
+ of the cell[range] from which the labels are sourced if that is the case. This
+ is then used to write the label texts under the extension tag <c15:datalabelsRange>.
+
+ @since LibreOffice 7.3.0
+ */
+class DataLabelsRange
+{
+public:
+
+ /// type of the internal container that stores the indexed label text.
+ typedef std::map<sal_Int32, OUString> LabelsRangeMap;
+
+ /// Returns whether the container is empty or not.
+ bool empty() const;
+ /// Returns the count of labels stored.
+ size_t count() const;
+ /// Indicates whether the container has a label with index specified by nIndex.
+ bool hasLabel(sal_Int32 nIndex) const;
+ /// Returns the address of the cell[range] from which label contents are sourced.
+ const OUString & getRange() const;
+
+ /// Sets the address of the cell[range] from which label contents are sourced.
+ void setRange(const OUString& rRange);
+ /// Adds a new indexed label text.
+ void setLabel(sal_Int32 nIndex, const OUString& rText);
+
+ LabelsRangeMap::const_iterator begin() const;
+ LabelsRangeMap::const_iterator end() const;
+
+private:
+ OUString maRange;
+ LabelsRangeMap maLabels;
+};
+
+
+class OOX_DLLPUBLIC ChartExport final : public DrawingML {
+
+public:
+ // first: data sequence for label, second: data sequence for values.
+ typedef ::std::vector< AxisIdPair > AxisVector;
+
+private:
+ sal_Int32 mnXmlNamespace;
+ sal_Int32 mnSeriesCount;
+ css::uno::Reference< css::frame::XModel > mxChartModel;
+ css::uno::Reference< css::chart::XDiagram > mxDiagram;
+ css::uno::Reference< css::chart2::XDiagram > mxNewDiagram;
+ std::shared_ptr<URLTransformer> mpURLTransformer;
+
+ // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
+ bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
+
+ //css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes;
+ css::uno::Reference< css::chart2::data::XDataSequence > mxCategoriesValues;
+
+ AxisVector maAxes;
+ bool mbHasZAxis;
+ bool mbIs3DChart;
+ bool mbStacked;
+ bool mbPercent;
+ bool mbHasDateCategories;
+
+ std::set<sal_Int32> maExportedAxis;
+
+private:
+ sal_Int32 getChartType();
+
+ css::uno::Sequence< css::uno::Sequence< rtl::OUString > > getSplitCategoriesList(const OUString& rRange);
+
+ OUString parseFormula( const OUString& rRange );
+ void InitPlotArea();
+
+ void ExportContent_();
+ void exportChartSpace( const css::uno::Reference<
+ css::chart::XChartDocument >& rChartDoc,
+ bool bIncludeTable );
+ void exportChart( const css::uno::Reference<
+ css::chart::XChartDocument >& rChartDoc );
+ void exportExternalData( const css::uno::Reference<
+ css::chart::XChartDocument >& rChartDoc );
+ void exportLegend( const css::uno::Reference<
+ css::chart::XChartDocument >& rChartDoc );
+ void exportTitle( const css::uno::Reference< css::drawing::XShape >& xShape,
+ const OUString* pSubText = nullptr );
+ void exportPlotArea( const css::uno::Reference<
+ css::chart::XChartDocument >& rChartDoc );
+ void exportAdditionalShapes( const css::uno::Reference<css::chart::XChartDocument >& rChartDoc );
+ void exportFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
+ void exportSolidFill(const css::uno::Reference<css::beans::XPropertySet>& xPropSet);
+ void exportGradientFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
+ void exportBitmapFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
+ void exportHatch(const css::uno::Reference<css::beans::XPropertySet>& xPropSet);
+ void exportDataTable( );
+
+ void exportAreaChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ void exportBarChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ void exportBubbleChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ void exportDoughnutChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ void exportLineChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ void exportPieChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ void exportRadarChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ void exportScatterChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ void exportScatterChartSeries( const css::uno::Reference< css::chart2::XChartType >& xChartType,
+ const css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries>>* pSeries);
+ void exportStockChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ void exportSurfaceChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ void exportHiLowLines();
+ void exportUpDownBars(const css::uno::Reference< css::chart2::XChartType >& xChartType );
+
+ void exportAllSeries(const css::uno::Reference<css::chart2::XChartType>& xChartType, bool& rPrimaryAxes);
+ void exportSeries(const css::uno::Reference< css::chart2::XChartType >& xChartType,
+ const css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& rSeriesSeq, bool& rPrimaryAxes);
+
+ void exportVaryColors(const css::uno::Reference<css::chart2::XChartType>& xChartType);
+ void exportCandleStickSeries(
+ const css::uno::Sequence<
+ css::uno::Reference<
+ css::chart2::XDataSeries > > & aSeriesSeq,
+ bool& rPrimaryAxes );
+ void exportSeriesText(
+ const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq );
+ void exportSeriesCategory(
+ const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_cat );
+ void exportSeriesValues(
+ const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val );
+ void exportShapeProps( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
+ void exportDataPoints(
+ const css::uno::Reference< css::beans::XPropertySet >& xSeriesProperties,
+ sal_Int32 nSeriesLength, sal_Int32 eChartType );
+ void exportDataLabels( const css::uno::Reference<css::chart2::XDataSeries>& xSeries, sal_Int32 nSeriesLength,
+ sal_Int32 eChartType, DataLabelsRange& rDLblsRange );
+ void exportGrouping( bool isBar = false );
+ void exportTrendlines( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
+ void exportMarker( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
+ void exportSmooth();
+ void exportFirstSliceAng();
+
+ void exportErrorBar(const css::uno::Reference< css::beans::XPropertySet >& xErrorBarProps,
+ bool bYError);
+
+ void exportManualLayout(const css::chart2::RelativePosition& rPos, const css::chart2::RelativeSize& rSize, const bool bIsExcludingDiagramPositioning);
+
+ void exportAxes( );
+ void exportAxis(const AxisIdPair& rAxisIdPair);
+ void _exportAxis(
+ const css::uno::Reference< css::beans::XPropertySet >& xAxisProp,
+ const css::uno::Reference< css::drawing::XShape >& xAxisTitle,
+ const css::uno::Reference< css::beans::XPropertySet >& xMajorGrid,
+ const css::uno::Reference< css::beans::XPropertySet >& xMinorGrid,
+ sal_Int32 nAxisType,
+ const char* sAxisPos,
+ const AxisIdPair& rAxisIdPair );
+ void exportAxesId(bool bPrimaryAxes, bool bCheckCombinedAxes = false);
+ void exportView3D();
+ bool isDeep3dChart();
+
+ void exportMissingValueTreatment(const css::uno::Reference<css::beans::XPropertySet>& xPropSet);
+
+ OUString getNumberFormatCode(sal_Int32 nKey) const;
+
+public:
+
+ ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, css::uno::Reference< css::frame::XModel > const & xModel,
+ ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType );
+ virtual ~ChartExport() {}
+
+ void SetURLTranslator(const std::shared_ptr<URLTransformer>& pTransformer);
+
+ const css::uno::Reference< css::frame::XModel >& getModel() const { return mxChartModel; }
+
+ void WriteChartObj( const css::uno::Reference< css::drawing::XShape >& xShape, sal_Int32 nID, sal_Int32 nChartCount );
+ void exportTextProps(const css::uno::Reference< css::beans::XPropertySet >& xPropSet);
+
+ void ExportContent();
+ void InitRangeSegmentationProperties(
+ const css::uno::Reference<
+ css::chart2::XChartDocument > & xChartDoc );
+};
+
+}
+
+#endif // INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
new file mode 100644
index 000000000..8b57523a5
--- /dev/null
+++ b/include/oox/export/drawingml.hxx
@@ -0,0 +1,382 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_EXPORT_DRAWINGML_HXX
+#define INCLUDED_OOX_EXPORT_DRAWINGML_HXX
+
+#include <map>
+#include <stack>
+#include <string_view>
+#include <unordered_map>
+#include <vector>
+
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <oox/dllapi.h>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/token/tokens.hxx>
+#include <oox/export/utils.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <sax/fshelper.hxx>
+#include <svx/msdffdef.hxx>
+#include <vcl/checksum.hxx>
+#include <vcl/graph.hxx>
+#include <tools/gen.hxx>
+#include <tools/color.hxx>
+#include <vcl/mapmod.hxx>
+#include <svx/EnhancedCustomShape2d.hxx>
+
+class Graphic;
+class SdrObjCustomShape;
+enum class SvxDateFormat;
+enum class SvxTimeFormat;
+
+namespace com::sun::star {
+namespace awt {
+ struct FontDescriptor;
+ struct Gradient;
+}
+namespace beans {
+ struct PropertyValue;
+ class XPropertySet;
+ class XPropertyState;
+}
+namespace drawing {
+ class XShape;
+ struct EnhancedCustomShapeParameterPair;
+ struct EnhancedCustomShapeParameter;
+}
+namespace graphic {
+ class XGraphic;
+}
+namespace style {
+ struct LineSpacing;
+}
+namespace text {
+ class XTextContent;
+ class XTextRange;
+ class XTextFrame;
+}
+namespace io {
+ class XOutputStream;
+}
+namespace uno {
+ class XInterface;
+}
+namespace frame {
+ class XModel;
+}
+}
+
+struct EscherConnectorListEntry;
+class OutlinerParaObject;
+namespace tools { class Rectangle; }
+
+namespace tools {
+ class PolyPolygon;
+}
+
+namespace oox {
+namespace core {
+ class XmlFilterBase;
+}
+
+namespace drawingml {
+
+class OOX_DLLPUBLIC URLTransformer
+{
+public:
+ virtual ~URLTransformer();
+
+ virtual OUString getTransformedString(const OUString& rURL) const;
+
+ virtual bool isExternalURL(const OUString& rURL) const;
+};
+
+// Our rotation is counter-clockwise and is in 100ths of a degree.
+// drawingML rotation is clockwise and is in 60000ths of a degree.
+inline sal_Int32 ExportRotateClockwisify(Degree100 input)
+{
+ return ((21600000 - input.get() * 600) % 21600000);
+}
+
+/// Interface to be implemented by the parent exporter that knows how to handle shape text.
+class OOX_DLLPUBLIC DMLTextExport
+{
+public:
+ virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
+ /// Write the contents of the textbox that is associated to this shape.
+ virtual void WriteTextBox(css::uno::Reference<css::drawing::XShape> xShape) = 0;
+ /// Get textbox which belongs to the shape.
+ virtual css::uno::Reference<css::text::XTextFrame> GetUnoTextFrame(
+ css::uno::Reference<css::drawing::XShape> xShape) = 0;
+protected:
+ DMLTextExport() {}
+ virtual ~DMLTextExport() {}
+};
+
+class OOX_DLLPUBLIC DrawingML
+{
+
+private:
+ static std::stack<sal_Int32> mnImageCounter;
+ static std::stack<sal_Int32> mnWdpImageCounter;
+ static std::stack<std::map<OUString, OUString>> maWdpCache;
+ static sal_Int32 mnDrawingMLCount;
+ static sal_Int32 mnVmlCount;
+ static std::stack<std::unordered_map<BitmapChecksum, OUString>> maExportGraphics;
+
+ /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
+ DocumentType meDocumentType;
+ /// Parent exporter, used for text callback.
+ DMLTextExport* mpTextExport;
+
+
+protected:
+ css::uno::Any mAny;
+ ::sax_fastparser::FSHelperPtr mpFS;
+ ::oox::core::XmlFilterBase* mpFB;
+ /// If set, this is the parent of the currently handled shape.
+ css::uno::Reference<css::drawing::XShape> m_xParent;
+ bool mbIsBackgroundDark;
+
+ /// True when exporting presentation placeholder shape.
+ bool mbPlaceholder;
+
+ bool GetProperty( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, const OUString& aName );
+ bool GetPropertyAndState( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
+ const css::uno::Reference< css::beans::XPropertyState >& rXPropState,
+ const OUString& aName, css::beans::PropertyState& eState );
+ OUString GetFieldValue( const css::uno::Reference< css::text::XTextRange >& rRun, bool& bIsURLField );
+ /** Gets OOXML datetime field type from LO Date format
+
+ @param eDate LO Date format
+ */
+ static OUString GetDatetimeTypeFromDate(SvxDateFormat eDate);
+ /** Gets OOXML datetime field type from LO Time format
+
+ @param eTime LO Time format
+ */
+ static OUString GetDatetimeTypeFromTime(SvxTimeFormat eTime);
+ /** Gets OOXML datetime field type from combination of LO Time and Date formats
+
+ @param eDate LO Date format
+ @param eTime LO Time format
+ */
+ static OUString GetDatetimeTypeFromDateTime(SvxDateFormat eDate, SvxTimeFormat eTime);
+
+ /// Output the media (including copying a video from vnd.sun.star.Package: to the output if necessary).
+ void WriteMediaNonVisualProperties(const css::uno::Reference<css::drawing::XShape>& xShape);
+
+ void WriteStyleProperties( sal_Int32 nTokenId, const css::uno::Sequence< css::beans::PropertyValue >& aProperties );
+
+ const char* GetComponentDir() const;
+ const char* GetRelationCompPrefix() const;
+
+ static bool EqualGradients( css::awt::Gradient aGradient1, css::awt::Gradient aGradient2 );
+ bool IsFontworkShape(const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet);
+
+ void WriteGlowEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
+ void WriteSoftEdgeEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
+ void WriteCustomGeometryPoint(const css::drawing::EnhancedCustomShapeParameterPair& rParamPair,
+ const EnhancedCustomShape2d& rCustomShape2d,
+ const bool bReplaceGeoWidth, const bool bReplaceGeoHeight);
+ bool WriteCustomGeometrySegment(
+ const sal_Int16 eCommand, const sal_Int32 nCount,
+ const css::uno::Sequence<css::drawing::EnhancedCustomShapeParameterPair>& rPairs,
+ sal_Int32& rnPairIndex, double& rfCurrentX, double& rfCurrentY, bool& rbCurrentValid,
+ const EnhancedCustomShape2d& rCustomShape2d,
+ const bool bReplaceGeoWidth, const bool bReplaceGeoHeight);
+
+public:
+ DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = nullptr )
+ : meDocumentType( eDocumentType ), mpTextExport(pTextExport), mpFS( pFS ), mpFB( pFB ), mbIsBackgroundDark( false ), mbPlaceholder(false) {}
+ void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; }
+ const ::sax_fastparser::FSHelperPtr& GetFS() const { return mpFS; }
+ ::oox::core::XmlFilterBase* GetFB() { return mpFB; }
+ DocumentType GetDocumentType() const { return meDocumentType; }
+ /// The application-specific text exporter callback, if there is one.
+ DMLTextExport* GetTextExport() { return mpTextExport; }
+
+ void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; }
+ /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship
+ OUString WriteImage( const Graphic &rGraphic , bool bRelPathToMedia = false );
+
+ void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
+ void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
+ void WriteColor( const ::Color nColor, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
+ void WriteColorTransformations( const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
+ void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT);
+ void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, bool bLineStart );
+ void WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID );
+
+ bool WriteCharColor(const css::uno::Reference<css::beans::XPropertySet>& xPropertySet);
+ bool WriteFillColor(const css::uno::Reference<css::beans::XPropertySet>& xPropertySet);
+
+ void WriteSolidFill( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
+ void WriteSolidFill( const OUString& sSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
+ void WriteSolidFill( const ::Color nColor, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
+ void WriteSolidFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
+ void WriteGradientFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
+
+ void WriteGradientFill( css::awt::Gradient rGradient, css::awt::Gradient rTransparenceGradient,
+ const css::uno::Reference<css::beans::XPropertySet>& rXPropSet = css::uno::Reference<css::beans::XPropertySet>());
+
+ void WriteGrabBagGradientFill( const css::uno::Sequence< css::beans::PropertyValue >& aGradientStops, css::awt::Gradient rGradient);
+
+ void WriteBlipOrNormalFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
+ const OUString& rURLPropName );
+ void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
+ const OUString& sURLPropName );
+ void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
+ const OUString& sURLPropName, sal_Int32 nXmlNamespace );
+
+ void WriteXGraphicBlipFill(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet,
+ css::uno::Reference<css::graphic::XGraphic> const & rxGraphic,
+ sal_Int32 nXmlNamespace, bool bWriteMode, bool bRelPathToMedia = false);
+
+ void WritePattFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
+ void WritePattFill(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
+ const css::drawing::Hatch& rHatch);
+
+ void WriteGraphicCropProperties(css::uno::Reference<css::beans::XPropertySet> const & rxPropertySet,
+ Size const & rOriginalSize, MapMode const & rMapMode);
+
+ void WriteSrcRectXGraphic(css::uno::Reference<css::beans::XPropertySet> const & rxPropertySet,
+ css::uno::Reference<css::graphic::XGraphic> const & rxGraphic);
+
+ void WriteOutline( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
+ css::uno::Reference< css::frame::XModel> const & xModel = nullptr );
+
+ void WriteXGraphicStretch(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet,
+ css::uno::Reference<css::graphic::XGraphic> const & rxGraphic);
+
+ void WriteXGraphicTile(css::uno::Reference<css::beans::XPropertySet> const& rXPropSet,
+ css::uno::Reference<css::graphic::XGraphic> const& rxGraphic);
+
+ void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float fFirstCharHeight);
+
+ OUString WriteXGraphicBlip(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet,
+ css::uno::Reference<css::graphic::XGraphic> const & rxGraphic,
+ bool bRelPathToMedia);
+
+ void WriteImageBrightnessContrastTransparence(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet);
+
+ void WriteXGraphicBlipMode(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet,
+ css::uno::Reference<css::graphic::XGraphic> const & rxGraphic);
+
+ void WriteShapeTransformation(const css::uno::Reference< css::drawing::XShape >& rXShape,
+ sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, bool bSuppressRotation = false, bool bSuppressFlipping = false, bool bFlippedBeforeRotation = false);
+ void WriteTransformation(const css::uno::Reference< css::drawing::XShape >& xShape, const tools::Rectangle& rRectangle,
+ sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, sal_Int32 nRotation = 0, bool bIsGroupShape = false);
+
+ void WriteText( const css::uno::Reference< css::uno::XInterface >& rXIface, bool bBodyPr, bool bText = true, sal_Int32 nXmlNamespace = 0, bool bWritePropertiesAsLstStyles = false);
+
+ /** Populates the lstStyle with the shape's text run and paragraph properties */
+ void WriteLstStyles(const css::uno::Reference<css::text::XTextContent>& rParagraph,
+ bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
+ const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet);
+ void WriteParagraph( const css::uno::Reference< css::text::XTextContent >& rParagraph,
+ bool& rbOverridingCharHeight, sal_Int32& rnCharHeight, const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet);
+ /** Writes paragraph properties
+
+ @returns true if any paragraph properties were written
+ */
+ bool WriteParagraphProperties(const css::uno::Reference< css::text::XTextContent >& rParagraph, const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet, float fFirstCharHeight, sal_Int32 nElement);
+ void WriteParagraphNumbering(const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight,
+ sal_Int16 nLevel );
+ void WriteParagraphTabStops(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
+ void WriteRun( const css::uno::Reference< css::text::XTextRange >& rRun,
+ bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
+ const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet);
+ void WriteRunProperties( const css::uno::Reference< css::beans::XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool bCheckDirect,
+ bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
+ sal_Int16 nScriptType = css::i18n::ScriptType::LATIN,
+ const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet = {});
+
+ void WritePresetShape( const OString& pShape , std::vector< std::pair<sal_Int32,sal_Int32>> & rAvList );
+ void WritePresetShape( const OString& pShape );
+ void WritePresetShape( const OString& pShape, MSO_SPT eShapeType, bool bPredefinedHandlesUsed, const css::beans::PropertyValue& rProp );
+ bool WriteCustomGeometry(
+ const css::uno::Reference<css::drawing::XShape>& rXShape,
+ const SdrObjCustomShape& rSdrObjCustomShape);
+ void WriteEmptyCustomGeometry();
+ void WritePolyPolygon(const css::uno::Reference<css::drawing::XShape>& rXShape,
+ const bool bClosed);
+ void WriteFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
+ void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
+ void WriteShapeEffects( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
+ void WriteShapeEffect( std::u16string_view sName, const css::uno::Sequence< css::beans::PropertyValue >& aEffectProps );
+ /** Populates scene3d tag
+ @param rXPropSet Prop set
+ @param bIsText True if the 3D effects are for a text body, false if it is for a shape
+ */
+ void Write3DEffects(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet, bool bIsText);
+ void WriteArtisticEffect( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
+ OString WriteWdpPicture( const OUString& rFileId, const css::uno::Sequence< sal_Int8 >& rPictureData );
+ void WriteDiagram(const css::uno::Reference<css::drawing::XShape>& rXShape, int nDiagramId);
+ void writeDiagramRels(const css::uno::Sequence<css::uno::Sequence<css::uno::Any>>& xRelSeq,
+ const css::uno::Reference<css::io::XOutputStream>& xOutStream,
+ std::u16string_view sGrabBagProperyName, int nDiagramId);
+ static void WriteFromTo(const css::uno::Reference<css::drawing::XShape>& rXShape, const css::awt::Size& aPageSize,
+ const sax_fastparser::FSHelperPtr& pDrawing);
+
+ static bool IsGroupShape( const css::uno::Reference< css::drawing::XShape >& rXShape );
+ sal_Int32 getBulletMarginIndentation (const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view propName);
+
+ static void ResetMlCounters();
+
+ static void PushExportGraphics();
+ static void PopExportGraphics();
+
+ static sal_Int32 getNewDrawingUniqueId() { return ++mnDrawingMLCount; }
+ static sal_Int32 getNewVMLUniqueId() { return ++mnVmlCount; }
+
+ // A Helper to decide the script type for given text in order to call WriteRunProperties.
+ static sal_Int16 GetScriptType(const OUString& rStr);
+
+ static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, css::awt::FontDescriptor& rFontDesc );
+
+ static ::Color ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
+
+ static const char* GetAlignment( css::style::ParagraphAdjust nAlignment );
+
+ sax_fastparser::FSHelperPtr CreateOutputStream (
+ const OUString& sFullStream,
+ std::u16string_view sRelativeStream,
+ const css::uno::Reference< css::io::XOutputStream >& xParentRelation,
+ const char* sContentType,
+ const char* sRelationshipType,
+ OUString* pRelationshipId );
+
+};
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
new file mode 100644
index 000000000..646d462e8
--- /dev/null
+++ b/include/oox/export/shapes.hxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_EXPORT_SHAPES_HXX
+#define INCLUDED_OOX_EXPORT_SHAPES_HXX
+
+#include <cstddef>
+#include <memory>
+#include <string_view>
+#include <unordered_map>
+
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/export/drawingml.hxx>
+#include <oox/export/utils.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <sax/fshelper.hxx>
+#include <tools/fract.hxx>
+#include <vcl/mapmod.hxx>
+
+namespace com::sun::star {
+namespace beans {
+ class XPropertySet;
+}
+namespace drawing {
+ class XShape;
+}
+
+namespace embed {
+ class XEmbeddedObject;
+}
+namespace io {
+ class XInputStream;
+}
+namespace uno {
+ class XComponentContext;
+ class XInterface;
+}
+}
+
+namespace oox::core {
+ class XmlFilterBase;
+}
+
+class Graphic;
+
+namespace oox {
+
+OOX_DLLPUBLIC css::uno::Reference<css::io::XInputStream> GetOLEObjectStream(
+ css::uno::Reference<css::uno::XComponentContext> const& xContext,
+ css::uno::Reference<css::embed::XEmbeddedObject> const& xObj,
+ std::u16string_view i_rProgID,
+ OUString & o_rMediaType,
+ OUString & o_rRelationType,
+ OUString & o_rSuffix,
+ const char *& o_rpProgID);
+
+}
+
+namespace oox::drawingml {
+
+class OOX_DLLPUBLIC ShapeExport : public DrawingML {
+
+private:
+ int m_nEmbeddedObjects;
+
+public:
+ typedef std::unordered_map< css::uno::Reference< css::drawing::XShape>, sal_Int32> ShapeHashMap;
+
+protected:
+ sal_Int32 mnShapeIdMax;
+ bool mbUserShapes; // for chart's embedded usershapes
+
+ void WriteGraphicObjectShapePart( const css::uno::Reference< css::drawing::XShape >& xShape, const Graphic *pGraphic=nullptr );
+
+ OUString GetShapeName(const css::uno::Reference< css::drawing::XShape >& xShape);
+
+private:
+ sal_Int32 mnXmlNamespace;
+ MapMode maMapModeSrc, maMapModeDest;
+ std::shared_ptr<URLTransformer> mpURLTransformer;
+
+ css::awt::Size MapSize( const css::awt::Size& ) const;
+
+ ShapeHashMap maShapeMap;
+ ShapeHashMap* mpShapeMap;
+
+public:
+
+ ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS,
+ ShapeHashMap* pShapeMap, ::oox::core::XmlFilterBase* pFB,
+ DocumentType eDocumentType = DOCUMENT_PPTX,
+ DMLTextExport* pTextExport = nullptr,
+ bool bUserShapes = false );
+ virtual ~ShapeExport() {}
+
+ void SetURLTranslator(const std::shared_ptr<URLTransformer>& pTransformer);
+
+ static bool NonEmptyText( const css::uno::Reference< css::uno::XInterface >& xIface );
+
+ ShapeExport&
+ WritePolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape, bool bClosed );
+ ShapeExport&
+ WriteClosedPolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ ShapeExport&
+ WriteConnectorShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ ShapeExport&
+ WriteCustomShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ ShapeExport&
+ WriteEllipseShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ ShapeExport&
+ WriteGraphicObjectShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ ShapeExport&
+ WriteGroupShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ ShapeExport&
+ WriteLineShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ ShapeExport&
+ WriteNonVisualDrawingProperties( const css::uno::Reference< css::drawing::XShape >& xShape, const char* sName );
+ virtual ShapeExport&
+ WriteNonVisualProperties( const css::uno::Reference< css::drawing::XShape >& xShape );
+ ShapeExport&
+ WriteOpenPolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ ShapeExport&
+ WriteRectangleShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+
+ /**
+ * Write the DrawingML for a particular shape.
+ *
+ * <p>This is the member function you want. It performs the type lookup and
+ * invokes the appropriate corresponding Write*() method for the specific
+ * type.</p>
+ *
+ * <p>To write an XShape, XShape::getShapeType() is called to determine
+ * the shape type, and the corresponding method in this table is
+ * invoked:</p>
+ *
+ * <table>
+ * <tr><th>Shape Type</th><th>Method</th></tr>
+ * <tr><td><tt>com.sun.star.drawing.ClosedBezierShape</tt></td> <td>ShapeExport::WriteClosedPolyPolygonShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.CustomShape</tt></td> <td>ShapeExport::WriteCustomShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.EllipseShape</tt></td> <td>ShapeExport::WriteEllipseShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.GraphicObjectShape</tt></td> <td>ShapeExport::WriteGraphicObjectShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.LineShape</tt></td> <td>ShapeExport::WriteLineShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.OpenBezierShape</tt></td> <td>ShapeExport::WriteOpenPolyPolygonShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.PolyPolygonShape</tt></td> <td>ShapeExport::WriteClosedPolyPolygonShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.PolyLineShape</tt></td> <td>ShapeExport::WriteOpenPolyPolygonShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.RectangleShape</tt></td> <td>ShapeExport::WriteRectangleShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.TableShape</tt></td> <td>ShapeExport::WriteTableShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.TextShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.DateTimeShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.FooterShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.HeaderShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.NotesShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.OutlinerShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.SlideNumberShape</tt></td><td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.TitleTextShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * </table>
+ *
+ * <p>If the shape type is not recognized, then
+ * <tt>ShapeExport::WriteUnknownShape</tt> is called.</p>
+ *
+ * @param xShape The shape to export as DrawingML.
+ * @return <tt>*this</tt>
+ */
+ ShapeExport& WriteShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ ShapeExport& WriteTextBox( const css::uno::Reference< css::uno::XInterface >& xIface, sal_Int32 nXmlNamespace, bool bWritePropertiesAsLstStyles = false );
+ virtual ShapeExport&
+ WriteTextShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ ShapeExport&
+ WriteTableShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ void WriteMathShape(css::uno::Reference<css::drawing::XShape> const& xShape);
+ ShapeExport&
+ WriteOLE2Shape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ virtual ShapeExport&
+ WriteUnknownShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+
+ void WriteTable( const css::uno::Reference< css::drawing::XShape >& rXShape );
+
+ void WriteTableCellProperties(const css::uno::Reference< css::beans::XPropertySet >& rXPropSet);
+
+ void WriteBorderLine(const sal_Int32 XML_line, const css::table::BorderLine2& rBorderLine);
+ void WriteTableCellBorders(const css::uno::Reference< css::beans::XPropertySet >& rXPropSet);
+
+ sal_Int32 GetNewShapeID( const css::uno::Reference< css::drawing::XShape >& rShape );
+ sal_Int32 GetNewShapeID( const css::uno::Reference< css::drawing::XShape >& rShape, ::oox::core::XmlFilterBase* pFB );
+ sal_Int32 GetShapeID( const css::uno::Reference< css::drawing::XShape >& rShape );
+ static sal_Int32 GetShapeID( const css::uno::Reference< css::drawing::XShape >& rShape, ShapeHashMap* pShapeMap );
+};
+
+}
+
+#endif // INCLUDED_OOX_EXPORT_SHAPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx
new file mode 100644
index 000000000..00fd953a0
--- /dev/null
+++ b/include/oox/export/utils.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_EXPORT_UTILS_HXX
+#define INCLUDED_OOX_EXPORT_UTILS_HXX
+
+#include <sal/config.h>
+
+#include <o3tl/unit_conversion.hxx>
+#include <rtl/string.hxx>
+#include <sal/types.h>
+
+#include <cmath>
+
+inline OString I32SHEX(sal_Int32 x)
+{
+ OString aStr = OString::number(x, 16);
+ while (aStr.getLength() < 6)
+ aStr = "0" + aStr;
+ return aStr;
+}
+
+/**
+ * @return const char* literal "true" for true value, or literal "false"
+ * for false value.
+ */
+static constexpr const char* ToPsz(bool b)
+{
+ return b ? "true" : "false";
+}
+
+/**
+ * @return literal "1" for true value, or literal "0" for false value.
+ */
+static constexpr const char* ToPsz10(bool b)
+{
+ // xlsx seems to use "1" or "0" for boolean values. I wonder it ever uses
+ // the "true" "false" variant.
+ return b ? "1" : "0";
+}
+
+static constexpr sal_Int64 PPTtoEMU( sal_Int32 nPPT )
+{
+ return o3tl::convert(nPPT, o3tl::Length::master, o3tl::Length::emu);
+}
+
+static constexpr sal_Int64 TwipsToEMU( sal_Int32 nTwips )
+{
+ return o3tl::convert(nTwips, o3tl::Length::twip, o3tl::Length::emu);
+}
+
+template <typename T>
+OString write1000thOfAPercent(T number)
+{
+ return OString::number( lround(number * 1000.0) );
+}
+
+namespace oox::drawingml {
+ enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
new file mode 100644
index 000000000..fa54f27aa
--- /dev/null
+++ b/include/oox/export/vmlexport.hxx
@@ -0,0 +1,209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_EXPORT_VMLEXPORT_HXX
+#define INCLUDED_OOX_EXPORT_VMLEXPORT_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <editeng/outlobj.hxx>
+#include <filter/msfilter/escherex.hxx>
+#include <oox/dllapi.h>
+#include <rtl/strbuf.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <sax/fshelper.hxx>
+#include <vcl/checksum.hxx>
+#include <rtl/ref.hxx>
+
+namespace com::sun::star {
+ namespace drawing {
+ class XShape;
+ }
+}
+
+namespace oox::drawingml {
+ class DrawingML;
+}
+
+
+namespace sax_fastparser {
+ class FastAttributeList;
+}
+
+class Point;
+namespace tools { class Rectangle; }
+class SdrObject;
+
+namespace oox::vml {
+
+/// Interface to be implemented by the parent exporter that knows how to handle shape text.
+class OOX_DLLPUBLIC VMLTextExport
+{
+public:
+ virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
+ virtual oox::drawingml::DrawingML& GetDrawingML() = 0;
+ /// Write the contents of the textbox that is associated to this shape in VML format.
+ virtual void WriteVMLTextBox(css::uno::Reference<css::drawing::XShape> xShape) = 0;
+protected:
+ VMLTextExport() {}
+ virtual ~VMLTextExport() {}
+};
+
+class OOX_DLLPUBLIC VMLExport : public EscherEx
+{
+ /// Fast serializer to output the data
+ ::sax_fastparser::FSHelperPtr m_pSerializer;
+
+ /// Parent exporter, used for text callback.
+ VMLTextExport* m_pTextExport;
+
+ /// Anchoring - Writer specific properties
+ sal_Int16 m_eHOri, m_eVOri, m_eHRel, m_eVRel;
+ rtl::Reference<sax_fastparser::FastAttributeList> m_pWrapAttrList;
+ bool m_bInline; // css::text::TextContentAnchorType_AS_CHARACTER
+ bool m_IsFollowingTextFlow = false;
+
+ /// The object we're exporting.
+ const SdrObject* m_pSdrObject;
+
+ /// Fill the shape attributes as they come.
+ rtl::Reference<::sax_fastparser::FastAttributeList> m_pShapeAttrList;
+
+ /// Remember the shape type.
+ sal_uInt32 m_nShapeType;
+
+ /// Remember the shape flags.
+ ShapeFlag m_nShapeFlags;
+
+ /// Remember style, the most important shape attribute ;-)
+ OStringBuffer m_ShapeStyle;
+
+ /// style for textbox
+ OStringBuffer m_TextboxStyle;
+
+ /// Remember the generated shape id.
+ OString m_sShapeId;
+
+ /// Remember which shape types we had already written.
+ std::vector<bool> m_aShapeTypeWritten;
+
+ /// It seems useless to write out an XML_ID attribute next to XML_id which defines the actual shape id
+ bool m_bSkipwzName;
+
+ /// Use '#' mark for type attribute (check Type Attribute of VML shape in OOXML documentation)
+ bool m_bUseHashMarkForType;
+
+ /** There is a shapeid generation mechanism in EscherEx, but it does not seem to work
+ * so override the existing behavior to get actually unique ids.
+ */
+ bool m_bOverrideShapeIdGeneration;
+
+ /// Prefix for overridden shape id generation (used if m_bOverrideShapeIdGeneration is true)
+ OString m_sShapeIDPrefix;
+
+ /// Counter for generating shape ids (used if m_bOverrideShapeIdGeneration is true)
+ sal_uInt64 m_nShapeIDCounter;
+
+public:
+ VMLExport( ::sax_fastparser::FSHelperPtr const & pSerializer, VMLTextExport* pTextExport = nullptr);
+ virtual ~VMLExport() override;
+
+ const ::sax_fastparser::FSHelperPtr&
+ GetFS() const { return m_pSerializer; }
+
+ void SetFS(const ::sax_fastparser::FSHelperPtr& pSerializer);
+
+ /// Export the sdr object as VML.
+ ///
+ /// Call this when you need to export the object as VML.
+ OString const & AddSdrObject( const SdrObject& rObj,
+ bool const bIsFollowingTextFlow = false,
+ sal_Int16 eHOri = -1, sal_Int16 eVOri = -1, sal_Int16 eHRel = -1,
+ sal_Int16 eVRel = -1,
+ sax_fastparser::FastAttributeList* pWrapAttrList = nullptr,
+ const bool bOOxmlExport = false );
+ OString const & AddInlineSdrObject( const SdrObject& rObj, const bool bOOxmlExport );
+ virtual void AddSdrObjectVMLObject( const SdrObject& rObj) override;
+ static bool IsWaterMarkShape(std::u16string_view rStr);
+
+ void SetSkipwzName(bool bSkipwzName) { m_bSkipwzName = bSkipwzName; }
+ void SetHashMarkForType(bool bUseHashMarkForType) { m_bUseHashMarkForType = bUseHashMarkForType; }
+ void OverrideShapeIDGen(bool bOverrideShapeIdGeneration,
+ const OString& sShapeIDPrefix = OString());
+ static OString GetVMLShapeTypeDefinition(std::string_view sShapeID, const bool bIsPictureFrame);
+
+protected:
+ /// Add an attribute to the generated <v:shape/> element.
+ ///
+ /// This should be called from within StartShape() to ensure that the
+ /// added attribute is preserved.
+ void AddShapeAttribute( sal_Int32 nAttribute, const OString& sValue );
+
+ using EscherEx::StartShape;
+ using EscherEx::EndShape;
+
+ /// Override shape ID generation when m_bOverrideShapeIdGeneration is set to true
+ virtual sal_uInt32 GenerateShapeId() override;
+
+ /// Start the shape for which we just collected the information.
+ ///
+ /// Returns the element's tag number, -1 means we wrote nothing.
+ virtual sal_Int32 StartShape();
+
+ /// End the shape.
+ ///
+ /// The parameter is just what we got from StartShape().
+ virtual void EndShape( sal_Int32 nShapeElement );
+ virtual void Commit( EscherPropertyContainer& rProps, const tools::Rectangle& rRect ) override;
+
+private:
+
+ virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 ) override;
+ virtual void CloseContainer() override;
+
+ virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const tools::Rectangle* pBoundRect ) override;
+ virtual void LeaveGroup() override;
+
+ virtual void AddShape( sal_uInt32 nShapeType, ShapeFlag nShapeFlags, sal_uInt32 nShapeId = 0 ) override;
+
+private:
+ /// Create an OString representing the id from a numerical id.
+ OString ShapeIdString( sal_uInt32 nId );
+
+ /// Add flip X and\or flip Y
+ void AddFlipXY( );
+
+ /// Add starting and ending point of a line to the m_pShapeAttrList.
+ void AddLineDimensions( const tools::Rectangle& rRectangle );
+
+ /// Add position and size to the OStringBuffer.
+ void AddRectangleDimensions( OStringBuffer& rBuffer, const tools::Rectangle& rRectangle, bool rbAbsolutePos = true );
+};
+
+
+} // namespace oox::vml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/addtosequence.hxx b/include/oox/helper/addtosequence.hxx
new file mode 100644
index 000000000..dbb271ca0
--- /dev/null
+++ b/include/oox/helper/addtosequence.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_ADDTOSEQUENCE_HXX
+#define INCLUDED_OOX_HELPER_ADDTOSEQUENCE_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <oox/dllapi.h>
+
+namespace oox
+{
+
+/** this adds an any to another any.
+ if rNewValue is empty, rOldValue is returned.
+ if rOldValue is empty, rNewValue is returned.
+ if rOldValue contains a value, a sequence with rOldValue and rNewValue is returned.
+ if rOldValue contains a sequence, a new sequence with the old sequence and rNewValue is returned.
+*/
+OOX_DLLPUBLIC css::uno::Any addToSequence( const css::uno::Any& rOldValue, const css::uno::Any& rNewValue );
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx
new file mode 100644
index 000000000..27101657f
--- /dev/null
+++ b/include/oox/helper/attributelist.hxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_ATTRIBUTELIST_HXX
+#define INCLUDED_OOX_HELPER_ATTRIBUTELIST_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <oox/helper/helper.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <oox/drawingml/color.hxx>
+
+namespace com::sun::star {
+ namespace xml::sax { class XFastAttributeList; }
+}
+
+namespace sax_fastparser {
+ class FastAttributeList;
+};
+
+namespace oox {
+
+ /* Get the color tokens from their string representatives. */
+ sal_Int32 getHighlightColorTokenFromString(std::u16string_view sColorName);
+
+/** Static helpers for conversion of strings to attribute values of various
+ different data types.
+ */
+class OOX_DLLPUBLIC AttributeConversion
+{
+public:
+ /** Returns the XML token identifier from the passed string. */
+ static sal_Int32 decodeToken( std::u16string_view rValue );
+
+ /** Returns the decoded string value. All characters in the format
+ '_xHHHH_' (H being a hexadecimal digit), will be decoded. */
+ static OUString decodeXString( const OUString& rValue );
+
+ /** Returns the 32-bit signed integer value from the passed string (decimal). */
+ static sal_Int32 decodeInteger( std::u16string_view rValue );
+
+ /** Returns the 32-bit unsigned integer value from the passed string (decimal). */
+ static sal_uInt32 decodeUnsigned( std::u16string_view rValue );
+
+ /** Returns the 64-bit signed integer value from the passed string (decimal). */
+ static sal_Int64 decodeHyper( std::u16string_view rValue );
+
+ /** Returns the 32-bit signed integer value from the passed string (hexadecimal). */
+ static sal_Int32 decodeIntegerHex( std::u16string_view rValue );
+};
+
+
+/** Provides access to attribute values of an element.
+
+ Wraps a com.sun.star.xml.sax.XFastAttributeList object. Provides
+ convenience functions that convert the string value of an attribute to
+ various other data types.
+ */
+class OOX_DLLPUBLIC AttributeList
+{
+public:
+ explicit AttributeList(
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Returns the wrapped com.sun.star.xml.sax.XFastAttributeList object. */
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >&
+ getFastAttributeList() const { return mxAttribs; }
+
+ /** Returns true, if the specified attribute is present. */
+ bool hasAttribute( sal_Int32 nAttrToken ) const;
+
+ // optional return values -------------------------------------------------
+
+ /** Returns the token identifier of the value of the specified attribute. */
+ OptValue< sal_Int32 > getToken( sal_Int32 nAttrToken ) const;
+
+ /** Returns the Color object of highlight of the text. */
+ oox::drawingml::Color getHighlightColor(sal_Int32 nAttrToken) const;
+
+ /** Returns the string value of the specified attribute. */
+ OptValue< OUString > getString( sal_Int32 nAttrToken ) const;
+
+ /** Returns the string value of the specified attribute. All characters in
+ the format '_xHHHH_' (H being a hexadecimal digit), will be decoded. */
+ OptValue< OUString > getXString( sal_Int32 nAttrToken ) const;
+
+ /** Returns the double value of the specified attribute. */
+ OptValue< double > getDouble( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (decimal). */
+ OptValue< sal_Int32 > getInteger( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit unsigned integer value of the specified attribute (decimal). */
+ OptValue< sal_uInt32 > getUnsigned( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 64-bit signed integer value of the specified attribute (decimal). */
+ OptValue< sal_Int64 > getHyper( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (hexadecimal). */
+ OptValue< sal_Int32 > getIntegerHex( sal_Int32 nAttrToken ) const;
+
+ /** Returns the boolean value of the specified attribute. */
+ OptValue< bool > getBool( sal_Int32 nAttrToken ) const;
+
+ /** Returns the date/time value of the specified attribute. */
+ OptValue< css::util::DateTime > getDateTime( sal_Int32 nAttrToken ) const;
+
+ // defaulted return values ------------------------------------------------
+
+ /** Returns the token identifier of the value of the specified attribute,
+ or the passed default identifier if the attribute is missing. */
+ sal_Int32 getToken( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ /** Returns the string value of the specified attribute, or the passed
+ default string if the attribute is missing. */
+ OUString getString( sal_Int32 nAttrToken, const OUString& rDefault ) const;
+
+ /** Returns the decoded string value of the specified attribute, or the
+ passed default string if the attribute is missing. */
+ OUString getXString( sal_Int32 nAttrToken, const OUString& rDefault ) const;
+
+ const char* getChar( sal_Int32 nAttrToken ) const;
+
+
+ /** Returns the double value of the specified attribute, or the passed
+ default value if the attribute is missing or not convertible to a double. */
+ double getDouble( sal_Int32 nAttrToken, double fDefault ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to integer. */
+ sal_Int32 getInteger( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ /** Returns the 32-bit unsigned integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to unsigned. */
+ sal_uInt32 getUnsigned( sal_Int32 nAttrToken, sal_uInt32 nDefault ) const;
+
+ /** Returns the 64-bit signed integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to integer. */
+ sal_Int64 getHyper( sal_Int32 nAttrToken, sal_Int64 nDefault ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (hexadecimal),
+ or the passed default value if the attribute is missing or not convertible. */
+ sal_Int32 getIntegerHex( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ sal_uInt32 getUnsignedHex( sal_Int32 nAttrToken, sal_uInt32 nDefault ) const;
+
+ /** Returns the boolean value of the specified attribute, or the passed
+ default value if the attribute is missing or not convertible to bool. */
+ bool getBool( sal_Int32 nAttrToken, bool bDefault ) const;
+
+ /** Returns the date/time value of the specified attribute, or the default
+ value if the attribute is missing or not convertible to a date/time value. */
+ css::util::DateTime getDateTime( sal_Int32 nAttrToken, const css::util::DateTime& rDefault ) const;
+
+ std::vector<sal_Int32> getTokenList(sal_Int32 nAttrToken) const;
+
+private:
+ css::uno::Reference< css::xml::sax::XFastAttributeList >
+ mxAttribs;
+ mutable sax_fastparser::FastAttributeList *mpAttribList;
+ sax_fastparser::FastAttributeList *getAttribList() const;
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/binaryinputstream.hxx b/include/oox/helper/binaryinputstream.hxx
new file mode 100644
index 000000000..e27b2def9
--- /dev/null
+++ b/include/oox/helper/binaryinputstream.hxx
@@ -0,0 +1,385 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_BINARYINPUTSTREAM_HXX
+#define INCLUDED_OOX_HELPER_BINARYINPUTSTREAM_HXX
+
+#include <cstddef>
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/helper.hxx>
+#include <rtl/string.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace io { class XInputStream; }
+}
+
+namespace oox {
+
+class BinaryOutputStream;
+
+
+/** Interface for binary input stream classes.
+
+ The binary data in the stream is assumed to be in little-endian format.
+ */
+class OOX_DLLPUBLIC BinaryInputStream : public virtual BinaryStreamBase
+{
+public:
+ /** Derived classes implement reading nBytes bytes to the passed sequence.
+ The sequence will be reallocated internally.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+
+ @return
+ Number of bytes really read.
+ */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement reading nBytes bytes to the (preallocated!)
+ memory buffer opMem.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+
+ @return
+ Number of bytes really read.
+ */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement seeking the stream forward by the passed
+ number of bytes. This should work for non-seekable streams too.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Reads a value from the stream and converts it to platform byte order.
+ All data types supported by the ByteOrderConverter class can be used.
+ */
+ template< typename Type >
+ [[nodiscard]]
+ Type readValue();
+
+ [[nodiscard]]
+ sal_Int8 readInt8() { return readValue<sal_Int8>(); }
+ [[nodiscard]]
+ sal_uInt8 readuInt8() { return readValue<sal_uInt8>(); }
+ [[nodiscard]]
+ sal_Int16 readInt16() { return readValue<sal_Int16>(); }
+ [[nodiscard]]
+ sal_uInt16 readuInt16() { return readValue<sal_uInt16>(); }
+ [[nodiscard]]
+ sal_Int32 readInt32() { return readValue<sal_Int32>(); }
+ [[nodiscard]]
+ sal_uInt32 readuInt32() { return readValue<sal_uInt32>(); }
+ [[nodiscard]]
+ sal_Int64 readInt64() { return readValue<sal_Int64>(); }
+ [[nodiscard]]
+ float readFloat() { return readValue<float>(); }
+ [[nodiscard]]
+ double readDouble() { return readValue<double>(); }
+ [[nodiscard]]
+ unsigned char readuChar() { return readValue<unsigned char>(); }
+
+ /** Reads a (preallocated!) C array of values from the stream.
+
+ Converts all values in the array to platform byte order. All data types
+ supported by the ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of array elements to read (NOT byte count).
+
+ @return
+ Number of array elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( Type* opnArray, sal_Int32 nElemCount );
+
+ /** Reads a vector of values from the stream.
+
+ The vector will be resized internally. Converts all values in the
+ vector to platform byte order. All data types supported by the
+ ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of elements to put into the vector (NOT byte count).
+
+ @return
+ Number of vector elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount );
+
+ /** Reads a NUL-terminated Unicode character array and returns the string.
+ */
+ OUString readNulUnicodeArray();
+
+ /** Reads a byte character array and returns the string.
+ NUL characters are replaced by question marks.
+
+ @param nChars
+ Number of characters (bytes) to read from the stream.
+ */
+ OString readCharArray( sal_Int32 nChars );
+
+ /** Reads a byte character array and returns a Unicode string.
+ NUL characters are replaced by question marks.
+
+ @param nChars
+ Number of characters (bytes) to read from the stream.
+
+ @param eTextEnc
+ The text encoding used to create the Unicode string.
+ */
+ OUString readCharArrayUC( sal_Int32 nChars, rtl_TextEncoding eTextEnc );
+
+ /** Reads a Unicode character array and returns the string.
+ NUL characters are replaced by question marks (default).
+
+ @param nChars
+ Number of 16-bit characters to read from the stream.
+ */
+ OUString readUnicodeArray( sal_Int32 nChars );
+
+ /** Reads a Unicode character array (may be compressed) and returns the
+ string.
+ NUL characters are replaced by question marks (default).
+
+ @param nChars
+ Number of 8-bit or 16-bit characters to read from the stream.
+
+ @param bCompressed
+ True = Character array is compressed (stored as 8-bit characters).
+ False = Character array is not compressed (stored as 16-bit characters).
+ */
+ OUString readCompressedUnicodeArray( sal_Int32 nChars, bool bCompressed );
+
+ /** Copies bytes from the current position to the passed output stream.
+ */
+ void copyToStream( BinaryOutputStream& rOutStrm );
+
+protected:
+ /** This dummy default c'tor will never call the c'tor of the virtual base
+ class BinaryStreamBase as this class cannot be instantiated directly. */
+ BinaryInputStream() : BinaryStreamBase( false ) {}
+
+private:
+ BinaryInputStream( BinaryInputStream const& ) = delete;
+ BinaryInputStream& operator=( BinaryInputStream const& ) = delete;
+};
+
+typedef std::shared_ptr< BinaryInputStream > BinaryInputStreamRef;
+
+
+template< typename Type >
+Type BinaryInputStream::readValue()
+{
+ Type ornValue = Type();
+ readMemory( &ornValue, static_cast< sal_Int32 >( sizeof( Type ) ), sizeof( Type ) );
+ ByteOrderConverter::convertLittleEndian( ornValue );
+ return ornValue;
+}
+
+template< typename Type >
+sal_Int32 BinaryInputStream::readArray( Type* opnArray, sal_Int32 nElemCount )
+{
+ sal_Int32 nRet = 0;
+ if( !mbEof )
+ {
+ sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type );
+ nRet = readMemory( opnArray, nReadSize, sizeof( Type ) ) / sizeof( Type );
+ ByteOrderConverter::convertLittleEndianArray( opnArray, static_cast< size_t >( nRet ) );
+ }
+ return nRet;
+}
+
+template< typename Type >
+sal_Int32 BinaryInputStream::readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount )
+{
+ orVector.resize( static_cast< size_t >( nElemCount ) );
+ return orVector.empty() ? 0 : readArray(orVector.data(), nElemCount);
+}
+
+
+/** Wraps a UNO input stream and provides convenient access functions.
+
+ The binary data in the stream is assumed to be in little-endian format.
+ */
+class OOX_DLLPUBLIC BinaryXInputStream final : public BinaryXSeekableStream, public BinaryInputStream
+{
+public:
+ /** Constructs the wrapper object for the passed input stream.
+
+ @param rxInStream
+ The com.sun.star.io.XInputStream interface of the UNO input stream
+ to be wrapped.
+
+ @param bAutoClose
+ True = automatically close the wrapped input stream on destruction
+ of this wrapper or when close() is called.
+ */
+ explicit BinaryXInputStream(
+ const css::uno::Reference< css::io::XInputStream >& rxInStrm,
+ bool bAutoClose );
+
+ virtual ~BinaryXInputStream() override;
+
+ /** Closes the input stream. Does also close the wrapped UNO input stream
+ if bAutoClose has been set to true in the constructor. */
+ virtual void close() override;
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+ /** Seeks the stream forward by the passed number of bytes. This works for
+ non-seekable streams too. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+private:
+ StreamDataSequence maBuffer; ///< Data buffer used in readMemory() function.
+ css::uno::Reference< css::io::XInputStream >
+ mxInStrm; ///< Reference to the input stream.
+ bool mbAutoClose; ///< True = automatically close stream on destruction.
+};
+
+
+/** Wraps a StreamDataSequence and provides convenient access functions.
+
+ The binary data in the stream is assumed to be in little-endian format.
+ */
+class OOX_DLLPUBLIC SequenceInputStream final : public SequenceSeekableStream, public BinaryInputStream
+{
+public:
+ /** Constructs the wrapper object for the passed data sequence.
+
+ @attention
+ The passed data sequence MUST live at least as long as this stream
+ wrapper. The data sequence MUST NOT be changed from outside as long
+ as this stream wrapper is used to read from it.
+ */
+ explicit SequenceInputStream( const StreamDataSequence& rData );
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+ /** Seeks the stream forward by the passed number of bytes. This works for
+ non-seekable streams too. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+private:
+ /** Returns the number of bytes available in the sequence for the passed byte count. */
+ sal_Int32 getMaxBytes( sal_Int32 nBytes ) const
+ { return getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mpData->getLength() - mnPos ); }
+};
+
+
+/** Wraps a BinaryInputStream and provides access to a specific part of the
+ stream data.
+
+ Provides access to the stream data block starting at the current position
+ of the stream, and with a specific length. If the wrapped stream is
+ seekable, this wrapper will treat the position of the wrapped stream at
+ construction time as position "0" (therefore the class name).
+
+ The passed input stream MUST live at least as long as this stream wrapper.
+ The stream MUST NOT be changed from outside as long as this stream wrapper
+ is used to read from it.
+ */
+class RelativeInputStream final : public BinaryInputStream
+{
+public:
+ /** Constructs the wrapper object for the passed stream.
+
+ @param nSize
+ If specified, restricts the amount of data that can be read from
+ the passed input stream.
+ */
+ explicit RelativeInputStream(
+ BinaryInputStream& rInStrm,
+ sal_Int64 nSize );
+
+ /** Returns the size of the data block in the wrapped stream offered by
+ this wrapper. */
+ virtual sal_Int64 size() const override;
+
+ /** Returns the current relative stream position. */
+ virtual sal_Int64 tell() const override;
+
+ /** Seeks the stream to the passed relative position, if the wrapped stream
+ is seekable. */
+ virtual void seek( sal_Int64 nPos ) override;
+
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close() override;
+
+ /** Reads nBytes bytes to the passed sequence. Does not read out of the
+ data block whose size has been specified on construction.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+ /** Reads nBytes bytes to the (existing) buffer opMem. Does not read out of
+ the data block whose size has been specified on construction.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+ /** Seeks the stream forward by the passed number of bytes. This works for
+ non-seekable streams too. Does not seek out of the data block. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+private:
+ /** Returns the number of bytes available in the sequence for the passed byte count. */
+ sal_Int32 getMaxBytes( sal_Int32 nBytes ) const
+ { return getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnSize - mnRelPos ); }
+
+private:
+ BinaryInputStream* mpInStrm;
+ sal_Int64 mnStartPos;
+ sal_Int64 mnRelPos;
+ sal_Int64 mnSize;
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/binaryoutputstream.hxx b/include/oox/helper/binaryoutputstream.hxx
new file mode 100644
index 000000000..c1dc8ebb0
--- /dev/null
+++ b/include/oox/helper/binaryoutputstream.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_BINARYOUTPUTSTREAM_HXX
+#define INCLUDED_OOX_HELPER_BINARYOUTPUTSTREAM_HXX
+
+#include <cstddef>
+#include <memory>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/helper.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace io { class XOutputStream; }
+}
+
+namespace oox {
+
+
+/** Interface for binary output stream classes.
+
+ The binary data in the stream is written in little-endian format.
+ */
+class BinaryOutputStream : public virtual BinaryStreamBase
+{
+public:
+ /** Derived classes implement writing the contents of the passed data
+ sequence.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement writing the contents of the (preallocated!)
+ memory buffer pMem.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ template< typename Type >
+ void writeArray( Type* opnArray, sal_Int32 nElemCount );
+
+ template< typename Type >
+ void writeArray( const Type* opnArray, sal_Int32 nElemCount );
+
+ /** Writes a value to the stream and converts it to platform byte order.
+ All data types supported by the ByteOrderConverter class can be used.
+ */
+ template< typename Type >
+ void writeValue( Type nValue );
+
+ BinaryOutputStream& WriteInt16(sal_Int16 x) { writeValue(x); return *this; }
+ BinaryOutputStream& WriteUInt16(sal_uInt16 x) { writeValue(x); return *this; }
+ BinaryOutputStream& WriteInt32(sal_Int32 x) { writeValue(x); return *this; }
+ BinaryOutputStream& WriteUInt32(sal_uInt32 x) { writeValue(x); return *this; }
+ BinaryOutputStream& WriteInt64(sal_Int64 x) { writeValue(x); return *this; }
+
+ void writeCompressedUnicodeArray( const OUString& rString, bool bCompressed );
+
+ void writeCharArrayUC( std::u16string_view rString, rtl_TextEncoding eTextEnc );
+
+ void writeUnicodeArray( const OUString& rString );
+
+protected:
+ /** This dummy default c'tor will never call the c'tor of the virtual base
+ class BinaryStreamBase as this class cannot be instantiated directly. */
+ BinaryOutputStream() : BinaryStreamBase( false ) {}
+
+private:
+ BinaryOutputStream( BinaryOutputStream const& ) = delete;
+ BinaryOutputStream& operator=( BinaryOutputStream const& ) = delete;
+};
+
+template< typename Type >
+void BinaryOutputStream::writeArray( Type* opnArray, sal_Int32 nElemCount )
+{
+ sal_Int32 nWriteSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type );
+ ByteOrderConverter::convertLittleEndianArray( opnArray, static_cast< size_t >( nElemCount ) );
+ writeMemory( opnArray, nWriteSize, sizeof( Type ) );
+}
+
+template< typename Type >
+void BinaryOutputStream::writeArray( const Type* opnArray, sal_Int32 nElemCount )
+{
+ std::unique_ptr<Type[]> xArray(new Type[nElemCount]);
+ std::uninitialized_copy(opnArray, opnArray + nElemCount, xArray.get());
+ writeArray(xArray.get(), nElemCount);
+}
+
+template< typename Type >
+void BinaryOutputStream::writeValue( Type nValue )
+{
+ ByteOrderConverter::convertLittleEndian( nValue );
+ writeMemory( &nValue, static_cast< sal_Int32 >( sizeof( Type ) ), sizeof( Type ) );
+}
+
+
+/** Wraps a UNO output stream and provides convenient access functions.
+
+ The binary data in the stream is written in little-endian format.
+ */
+class OOX_DLLPUBLIC BinaryXOutputStream final : public BinaryXSeekableStream, public BinaryOutputStream
+{
+public:
+ /** Constructs the wrapper object for the passed output stream.
+
+ @param rxOutStream
+ The com.sun.star.io.XOutputStream interface of the output stream to
+ be wrapped.
+
+ @param bAutoClose
+ True = automatically close the wrapped output stream on destruction
+ of this wrapper or when close() is called.
+ */
+ explicit BinaryXOutputStream(
+ const css::uno::Reference< css::io::XOutputStream >& rxOutStrm,
+ bool bAutoClose );
+
+ virtual ~BinaryXOutputStream() override;
+
+ /** Flushes and closes the output stream. Does also close the wrapped UNO
+ output stream if bAutoClose has been set to true in the constructor. */
+ void close() override;
+
+ /** Writes the passed data sequence. */
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ) override;
+
+ /** Write nBytes bytes from the (preallocated!) buffer pMem. */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+private:
+ StreamDataSequence maBuffer; ///< Data buffer used in writeMemory() function.
+ css::uno::Reference< css::io::XOutputStream >
+ mxOutStrm; ///< Reference to the output stream.
+ bool mbAutoClose; ///< True = automatically close stream on destruction.
+};
+
+
+/** Wraps a StreamDataSequence and provides convenient access functions.
+
+ The binary data in the stream is written in little-endian format. After
+ construction, the stream points to the beginning of the passed data
+ sequence. The data sequence is expanded automatically while writing to it.
+ */
+class SequenceOutputStream final : public BinaryOutputStream
+{
+public:
+ /** Constructs the wrapper object for the passed data sequence.
+
+ @attention
+ The passed data sequence MUST live at least as long as this stream
+ wrapper. The data sequence MUST NOT be changed from outside as long
+ as this stream wrapper is used to write to it.
+ */
+ explicit SequenceOutputStream( StreamDataSequence & rData );
+
+ /** Writes the passed data sequence. */
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ) override;
+
+ /** Write nBytes bytes from the (preallocated!) buffer pMem. */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+ /** Returns the size of the wrapped data sequence. */
+ virtual sal_Int64 size() const override;
+ /** Returns the current stream position. */
+ virtual sal_Int64 tell() const override;
+ /** Seeks the stream to the passed position. */
+ virtual void seek( sal_Int64 nPos ) override;
+ /** Releases the reference to the data sequence. */
+ virtual void close() override;
+
+private:
+ StreamDataSequence* mpData; ///< Wrapped data sequence.
+ sal_Int32 mnPos; ///< Current position in the sequence.
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/binarystreambase.hxx b/include/oox/helper/binarystreambase.hxx
new file mode 100644
index 000000000..8e93d1458
--- /dev/null
+++ b/include/oox/helper/binarystreambase.hxx
@@ -0,0 +1,179 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_BINARYSTREAMBASE_HXX
+#define INCLUDED_OOX_HELPER_BINARYSTREAMBASE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <oox/dllapi.h>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace io { class XSeekable; }
+}
+
+namespace oox {
+
+typedef css::uno::Sequence< sal_Int8 > StreamDataSequence;
+
+
+/** Base class for binary stream classes.
+ */
+class OOX_DLLPUBLIC BinaryStreamBase
+{
+public:
+ virtual ~BinaryStreamBase();
+
+ /** Implementations return the size of the stream, if possible.
+
+ This function may be implemented for some types of unseekable streams,
+ and MUST be implemented for all seekable streams.
+
+ @return
+ The size of the stream in bytes, or -1, if not implemented.
+ */
+ virtual sal_Int64 size() const = 0;
+
+ /** Implementations return the current stream position, if possible.
+
+ This function may be implemented for some types of unseekable streams,
+ and MUST be implemented for all seekable streams.
+
+ @return
+ The current position in the stream, or -1, if not implemented.
+ */
+ virtual sal_Int64 tell() const = 0;
+
+ /** Implementations seek the stream to the passed position, if
+ the stream is seekable.
+ */
+ virtual void seek( sal_Int64 nPos ) = 0;
+
+ /** Implementations close the stream.
+ */
+ virtual void close() = 0;
+
+ /** Returns true, if the implementation supports the seek() operation.
+
+ Implementations may still implement size() and tell() even if the
+ stream is not seekable.
+ */
+ bool isSeekable() const { return mbSeekable; }
+
+ /** Returns true, if the stream position is invalid (EOF). This flag turns
+ true *after* the first attempt to seek/read beyond the stream end.
+ */
+ bool isEof() const { return mbEof; }
+
+ /** Returns the size of the remaining data available in the stream, if
+ stream supports size() and tell(), otherwise -1.
+ */
+ sal_Int64 getRemaining() const;
+
+ /** Seeks the stream to the beginning, if stream is seekable.
+ */
+ void seekToStart() { seek( 0 ); }
+
+ /** Seeks the stream forward to a position that is a multiple of the passed
+ block size, if stream is seekable.
+
+ @param nBlockSize
+ The size of the data blocks the streams needs to be aligned to.
+
+ @param nAnchorPos
+ Position in the stream the data blocks are aligned to.
+ */
+ void alignToBlock( sal_Int32 nBlockSize, sal_Int64 nAnchorPos );
+
+protected:
+ explicit BinaryStreamBase( bool bSeekable ) : mbEof( false ), mbSeekable( bSeekable ) {}
+
+private:
+ BinaryStreamBase( const BinaryStreamBase& ) = delete;
+ BinaryStreamBase& operator=( const BinaryStreamBase& ) = delete;
+
+protected:
+ bool mbEof; ///< End of stream flag.
+
+private:
+ const bool mbSeekable; ///< True = implementation supports seeking.
+};
+
+
+/** Base class for binary input and output streams wrapping a UNO stream,
+ seekable via the com.sun.star.io.XSeekable interface.
+ */
+class BinaryXSeekableStream : public virtual BinaryStreamBase
+{
+public:
+ virtual ~BinaryXSeekableStream() override;
+
+ /** Returns the size of the stream, if wrapped stream is seekable, otherwise -1. */
+ virtual sal_Int64 size() const override;
+ /** Returns the current stream position, if wrapped stream is seekable, otherwise -1. */
+ virtual sal_Int64 tell() const override;
+ /** Seeks the stream to the passed position, if wrapped stream is seekable. */
+ virtual void seek( sal_Int64 nPos ) override;
+ /** Releases the reference to the UNO XSeekable interface. */
+ virtual void close() override;
+
+protected:
+ explicit BinaryXSeekableStream(
+ const css::uno::Reference< css::io::XSeekable >& rxSeekable );
+
+private:
+ css::uno::Reference< css::io::XSeekable >
+ mxSeekable; ///< Stream seeking interface.
+};
+
+
+/** Base class for binary input and output streams wrapping a
+ StreamDataSequence, which is always seekable.
+
+ The wrapped data sequence MUST live at least as long as this stream
+ wrapper. The data sequence MUST NOT be changed from outside as long as this
+ stream wrapper is used to modify it.
+ */
+class OOX_DLLPUBLIC SequenceSeekableStream : public virtual BinaryStreamBase
+{
+public:
+ /** Returns the size of the wrapped data sequence. */
+ virtual sal_Int64 size() const override;
+ /** Returns the current stream position. */
+ virtual sal_Int64 tell() const override;
+ /** Seeks the stream to the passed position. */
+ virtual void seek( sal_Int64 nPos ) override;
+ /** Releases the reference to the data sequence. */
+ virtual void close() override;
+
+protected:
+ explicit SequenceSeekableStream( const StreamDataSequence& rData );
+
+protected:
+ const StreamDataSequence* mpData; ///< Wrapped data sequence.
+ sal_Int32 mnPos; ///< Current position in the sequence.
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/containerhelper.hxx b/include/oox/helper/containerhelper.hxx
new file mode 100644
index 000000000..3b725d509
--- /dev/null
+++ b/include/oox/helper/containerhelper.hxx
@@ -0,0 +1,298 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_CONTAINERHELPER_HXX
+#define INCLUDED_OOX_HELPER_CONTAINERHELPER_HXX
+
+#include <cstddef>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace container { class XNameAccess; }
+ namespace container { class XNameContainer; }
+ namespace uno { class Any; }
+}
+
+namespace oox {
+
+
+/** A range of signed 32-bit integer values. */
+struct ValueRange
+{
+ sal_Int32 mnFirst;
+ sal_Int32 mnLast;
+
+ explicit ValueRange( sal_Int32 nValue ) : mnFirst( nValue ), mnLast( nValue ) {}
+ explicit ValueRange( sal_Int32 nFirst, sal_Int32 nLast ) : mnFirst( nFirst ), mnLast( nLast ) {}
+
+ bool operator==( const ValueRange& rRange ) const { return (mnFirst == rRange.mnFirst) && (mnLast == rRange.mnLast); }
+ bool operator!=( const ValueRange& rRange ) const { return !(*this == rRange); }
+ bool contains( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnFirst) && (rRange.mnLast <= mnLast); }
+ bool intersects( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnLast) && (rRange.mnFirst <= mnLast); }
+};
+
+
+typedef ::std::vector< ValueRange > ValueRangeVector;
+
+
+/** An ordered list of value ranges. The insertion operation will merge
+ consecutive value ranges.
+ */
+class OOX_DLLPUBLIC ValueRangeSet
+{
+public:
+ ValueRangeSet() {}
+
+ /** Inserts the passed value range into the range list. */
+ void insert( const ValueRange& rRange );
+
+ /** Returns the ordered list of all value ranges. */
+ const ValueRangeVector& getRanges() const { return maRanges; }
+
+private:
+ ValueRangeVector maRanges;
+};
+
+
+/** Template for a 2-dimensional array of objects.
+
+ This class template provides a similar interface to the ::std::vector
+ template.
+ */
+template< typename Type >
+class Matrix
+{
+public:
+ typedef ::std::vector< Type > container_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::pointer pointer;
+ typedef typename container_type::reference reference;
+ typedef typename container_type::const_reference const_reference;
+ typedef typename container_type::size_type size_type;
+ typedef typename container_type::iterator iterator;
+ typedef typename container_type::const_iterator const_iterator;
+
+ Matrix() : mnWidth( 0 ) {}
+ explicit Matrix( size_type nWidth, size_type nHeight ) { resize( nWidth, nHeight ); }
+ explicit Matrix( size_type nWidth, size_type nHeight, const_reference rData ) { resize( nWidth, nHeight, rData ); }
+
+ bool empty() const { return maData.empty(); }
+ size_type size() const { return maData.size(); }
+ size_type width() const { return mnWidth; }
+ size_type height() const { return empty() ? 0 : (size() / width()); }
+
+ void clear() { resize( 0, 0 ); }
+ void resize( size_type nWidth, size_type nHeight ) { mnWidth = nWidth; maData.resize( nWidth * nHeight ); }
+ void resize( size_type nWidth, size_type nHeight, const_reference rData ) { mnWidth = nWidth; maData.resize( nWidth * nHeight, rData ); }
+
+ iterator at( size_type nX, size_type nY ) { return maData.begin() + mnWidth * nY + nX; }
+ const_iterator at( size_type nX, size_type nY ) const { return maData.begin() + mnWidth * nY + nX; }
+
+ reference operator()( size_type nX, size_type nY ) { return *at( nX, nY ); }
+ const_reference operator()( size_type nX, size_type nY ) const { return *at( nX, nY ); }
+
+ iterator begin() { return maData.begin(); }
+ const_iterator begin() const { return maData.begin(); }
+ iterator end() { return maData.end(); }
+ const_iterator end() const { return maData.end(); }
+
+ iterator row_begin( size_type nY ) { return at( 0, nY ); }
+ const_iterator row_begin( size_type nY ) const { return at( 0, nY ); }
+ iterator row_end( size_type nY ) { return at( mnWidth, nY ); }
+ const_iterator row_end( size_type nY ) const { return at( mnWidth, nY ); }
+
+ reference row_front( size_type nY ) { return (*this)( 0, nY ); }
+ const_reference row_front( size_type nY ) const { return (*this)( 0, nY ); }
+
+private:
+ container_type maData;
+ size_type mnWidth;
+};
+
+
+/** Static helper functions for improved API container handling. */
+class OOX_DLLPUBLIC ContainerHelper
+{
+public:
+
+ /** Returns a name that is not used in the passed name container.
+
+ @param rxNameAccess com.sun.star.container.XNameAccess interface of
+ the name container.
+
+ @param rSuggestedName Suggested name for the object.
+
+ @return An unused name. Will be equal to the suggested name, if not
+ contained, otherwise a numerical index will be appended.
+ */
+ static OUString getUnusedName(
+ const css::uno::Reference< css::container::XNameAccess >& rxNameAccess,
+ const OUString& rSuggestedName,
+ sal_Unicode cSeparator );
+
+ /** Inserts an object into a name container.
+
+ @param rxNameContainer com.sun.star.container.XNameContainer interface
+ of the name container.
+
+ @param rName Exact name for the object.
+
+ @param rObject The object to be inserted.
+
+ @return True = object successfully inserted.
+ */
+ static bool insertByName(
+ const css::uno::Reference< css::container::XNameContainer >& rxNameContainer,
+ const OUString& rName,
+ const css::uno::Any& rObject );
+
+ /** Inserts an object into a name container.
+
+ The function will use an unused name to insert the object, based on the
+ suggested object name. It is possible to specify whether the existing
+ object or the new inserted object will be renamed, if the container
+ already has an object with the name suggested for the new object.
+
+ @param rxNameContainer com.sun.star.container.XNameContainer interface
+ of the name container.
+
+ @param rSuggestedName Suggested name for the object.
+
+ @param rObject The object to be inserted.
+
+ The new object
+ will be inserted with a name not yet extant in the container (this
+ is done by appending a numerical index to the suggested name).
+
+ @return The final name the object is inserted with. Will always be
+ equal to the suggested name, if parameter bRenameOldExisting is
+ true.
+ */
+ static OUString insertByUnusedName(
+ const css::uno::Reference< css::container::XNameContainer >& rxNameContainer,
+ const OUString& rSuggestedName,
+ sal_Unicode cSeparator,
+ const css::uno::Any& rObject );
+
+ // std::vector and std::map element access --------------------------------
+
+ /** Returns the pointer to an existing element of the passed vector, or a
+ null pointer, if the passed index is out of bounds. */
+ template< typename VectorType >
+ static const typename VectorType::value_type*
+ getVectorElement( const VectorType& rVector, sal_Int32 nIndex );
+
+ /** Returns the pointer to an existing element of the passed vector, or a
+ null pointer, if the passed index is out of bounds. */
+ template< typename VectorType >
+ static typename VectorType::value_type*
+ getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex );
+
+ /** Returns the reference to an existing element of the passed vector, or
+ the passed default value, if the passed index is out of bounds. */
+ template< typename VectorType >
+ static const typename VectorType::value_type&
+ getVectorElement( const VectorType& rVector, sal_Int32 nIndex, const typename VectorType::value_type& rDefault );
+
+ /** Returns the pointer to an existing element of the passed map, or a null
+ pointer, if an element with the passed key does not exist. */
+ template< typename MapType >
+ static const typename MapType::mapped_type*
+ getMapElement( const MapType& rMap, const typename MapType::key_type& rKey );
+
+ /** Returns the reference to an existing element of the passed map, or the
+ passed default value, if an element with the passed key does not exist. */
+ template< typename MapType >
+ static const typename MapType::mapped_type&
+ getMapElement( const MapType& rMap, const typename MapType::key_type& rKey, const typename MapType::mapped_type& rDefault );
+
+ /** Creates a UNO sequence of sequences from a matrix with copies of all elements.
+
+ @param rMatrix The matrix to be converted to a sequence of sequences.
+
+ @return A com.sun.star.uno.Sequence object containing
+ com.sun.star.uno.Sequence objects with copies of all objects
+ contained in the passed matrix.
+ */
+ template< typename MatrixType >
+ static css::uno::Sequence< css::uno::Sequence< typename MatrixType::value_type > >
+ matrixToSequenceSequence( const MatrixType& rMatrix );
+};
+
+
+template< typename VectorType >
+/*static*/ const typename VectorType::value_type* ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : nullptr;
+}
+
+template< typename VectorType >
+/*static*/ typename VectorType::value_type* ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : nullptr;
+}
+
+template< typename VectorType >
+/*static*/ const typename VectorType::value_type& ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex, const typename VectorType::value_type& rDefault )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault;
+}
+
+template< typename MapType >
+/*static*/ const typename MapType::mapped_type* ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey )
+{
+ typename MapType::const_iterator aIt = rMap.find( rKey );
+ return (aIt == rMap.end()) ? nullptr : &aIt->second;
+}
+
+template< typename MapType >
+/*static*/ const typename MapType::mapped_type& ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey, const typename MapType::mapped_type& rDefault )
+{
+ typename MapType::const_iterator aIt = rMap.find( rKey );
+ return (aIt == rMap.end()) ? rDefault : aIt->second;
+}
+
+template< typename MatrixType >
+/*static*/ css::uno::Sequence< css::uno::Sequence< typename MatrixType::value_type > > ContainerHelper::matrixToSequenceSequence( const MatrixType& rMatrix )
+{
+ typedef typename MatrixType::value_type ValueType;
+ css::uno::Sequence< css::uno::Sequence< ValueType > > aSeq;
+ if( !rMatrix.empty() )
+ {
+ aSeq.realloc( static_cast< sal_Int32 >( rMatrix.height() ) );
+ auto pSeq = aSeq.getArray();
+ for( size_t nRow = 0, nHeight = rMatrix.height(); nRow < nHeight; ++nRow )
+ pSeq[ static_cast< sal_Int32 >( nRow ) ] =
+ css::uno::Sequence< ValueType >( &rMatrix.row_front( nRow ), static_cast< sal_Int32 >( rMatrix.width() ) );
+ }
+ return aSeq;
+}
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/grabbagstack.hxx b/include/oox/helper/grabbagstack.hxx
new file mode 100644
index 000000000..bd03535c9
--- /dev/null
+++ b/include/oox/helper/grabbagstack.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_OOX_HELPER_GRABBAGSTACK_HXX
+#define INCLUDED_OOX_HELPER_GRABBAGSTACK_HXX
+
+#include <stack>
+#include <vector>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace uno { class Any; }
+}
+
+namespace oox {
+
+struct GrabBagStackElement
+{
+ OUString maElementName;
+ std::vector<css::beans::PropertyValue> maPropertyList;
+};
+
+/// Tool that is useful for construction of a nested Sequence/PropertyValue hierarchy
+class OOX_DLLPUBLIC GrabBagStack final
+{
+private:
+ std::stack<GrabBagStackElement> mStack;
+ GrabBagStackElement mCurrentElement;
+
+public:
+ GrabBagStack(const OUString& aElementName);
+ ~GrabBagStack();
+
+ const OUString& getCurrentName() const { return mCurrentElement.maElementName;}
+
+ css::beans::PropertyValue getRootProperty();
+
+ void appendElement(const OUString& aName, const css::uno::Any& aAny);
+ void push(const OUString& aKey);
+ void pop();
+ void addInt32(const OUString& aElementName, sal_Int32 aIntValue);
+ void addString(const OUString& aElementName, const OUString& aStringValue);
+ bool isStackEmpty() const;
+};
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx
new file mode 100644
index 000000000..eab39beff
--- /dev/null
+++ b/include/oox/helper/graphichelper.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_GRAPHICHELPER_HXX
+#define INCLUDED_OOX_HELPER_GRAPHICHELPER_HXX
+
+#include <map>
+
+#include <com/sun/star/awt/DeviceInfo.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/helper.hxx>
+#include <oox/helper/storagebase.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <com/sun/star/graphic/XGraphicProvider2.hpp>
+#include <com/sun/star/graphic/XGraphicMapper.hpp>
+#include <vcl/vclptr.hxx>
+
+struct WmfExternal;
+class OutputDevice;
+
+namespace com::sun::star {
+ namespace awt { struct Point; }
+ namespace awt { struct Size; }
+ namespace awt { class XUnitConversion; }
+ namespace io { class XInputStream; }
+ namespace frame { class XFrame; }
+ namespace graphic { class XGraphic; }
+ namespace graphic { class XGraphicObject; }
+ namespace graphic { class XGraphicProvider; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox {
+
+
+/** Provides helper functions for colors, device measurement conversion,
+ graphics, and graphic objects handling.
+ */
+class OOX_DLLPUBLIC GraphicHelper
+{
+public:
+ explicit GraphicHelper(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XFrame >& rxTargetFrame,
+ const StorageRef& rxStorage );
+ virtual ~GraphicHelper();
+
+ // Avoid implicitly defined copy constructors/assignments for the DLLPUBLIC class (they may
+ // require forward-declared classes used internally to be defined in places using GraphicHelper)
+ GraphicHelper(const GraphicHelper&) = delete;
+ GraphicHelper(GraphicHelper&&) = delete;
+ GraphicHelper& operator=(const GraphicHelper&) = delete;
+ GraphicHelper& operator=(GraphicHelper&&) = delete;
+
+ // System colors and predefined colors ------------------------------------
+
+ /** Returns a system color specified by the passed XML token identifier. */
+ ::Color getSystemColor( sal_Int32 nToken, ::Color nDefaultRgb = API_RGB_TRANSPARENT ) const;
+ /** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */
+ virtual ::Color getSchemeColor( sal_Int32 nToken ) const;
+ /** Derived classes may implement to resolve a palette index to an RGB color. */
+ virtual ::Color getPaletteColor( sal_Int32 nPaletteIdx ) const;
+
+ virtual sal_Int32 getDefaultChartAreaFillStyle() const;
+
+ /** Returns chartspace automatic default border style */
+ static sal_Int32 getDefaultChartAreaLineStyle();
+
+ /** Returns chartspace automatic default border width in Emu */
+ static sal_Int16 getDefaultChartAreaLineWidth();
+
+ // Device info and device dependent unit conversion -----------------------
+
+ /** Returns information about the output device. */
+ const css::awt::DeviceInfo& getDeviceInfo() const { return maDeviceInfo;}
+
+ /** Converts the passed value from horizontal screen pixels to 1/100 mm. */
+ sal_Int32 convertScreenPixelXToHmm( double fPixelX ) const;
+ /** Converts the passed value from vertical screen pixels to 1/100 mm. */
+ sal_Int32 convertScreenPixelYToHmm( double fPixelY ) const;
+ /** Converts the passed size from screen pixels to 1/100 mm. */
+ css::awt::Size convertScreenPixelToHmm( const css::awt::Size& rPixel ) const;
+
+ /** Converts the passed value from 1/100 mm to horizontal screen pixels. */
+ double convertHmmToScreenPixelX( sal_Int32 nHmmX ) const;
+ /** Converts the passed value from 1/100 mm to vertical screen pixels. */
+ double convertHmmToScreenPixelY( sal_Int32 nHmmY ) const;
+ /** Converts the passed point from 1/100 mm to screen pixels. */
+ css::awt::Point convertHmmToScreenPixel( const css::awt::Point& rHmm ) const;
+ /** Converts the passed size from 1/100 mm to screen pixels. */
+ css::awt::Size convertHmmToScreenPixel( const css::awt::Size& rHmm ) const;
+
+ /** Converts the passed point from 1/100 mm to AppFont units. */
+ css::awt::Point convertHmmToAppFont( const css::awt::Point& rHmm ) const;
+ /** Converts the passed size from 1/100 mm to AppFont units. */
+ css::awt::Size convertHmmToAppFont( const css::awt::Size& rHmm ) const;
+
+
+ // Graphics and graphic objects ------------------------------------------
+
+ /** Imports a graphic from the passed input stream. */
+ css::uno::Reference< css::graphic::XGraphic >
+ importGraphic(
+ const css::uno::Reference< css::io::XInputStream >& rxInStrm,
+ const WmfExternal* pExtHeader = nullptr ) const;
+
+ /** Imports a graphic from the passed binary memory block. */
+ css::uno::Reference< css::graphic::XGraphic >
+ importGraphic( const StreamDataSequence& rGraphicData ) const;
+
+ /** Imports a graphic from the storage stream with the passed path and name. */
+ css::uno::Reference< css::graphic::XGraphic >
+ importEmbeddedGraphic(
+ const OUString& rStreamName,
+ const WmfExternal* pExtHeader = nullptr ) const;
+
+ /** calculates the original size of a graphic which is necessary to be able to calculate cropping values
+ @return The original Graphic size in 100thmm */
+ css::awt::Size getOriginalSize( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic ) const;
+
+ void setGraphicMapper(css::uno::Reference<css::graphic::XGraphicMapper> const & rxGraphicMapper);
+
+ void initializeGraphicMapperIfNeeded() const;
+private:
+
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ css::uno::Reference< css::graphic::XGraphicProvider2 > mxGraphicProvider;
+ VclPtr<OutputDevice> mxDefaultOutputDevice;
+ css::awt::DeviceInfo maDeviceInfo; ///< Current output device info.
+ ::std::map< sal_Int32, ::Color > maSystemPalette; ///< Maps system colors (XML tokens) to RGB color values.
+ StorageRef mxStorage; ///< Storage containing embedded graphics.
+ double mfPixelPerHmmX; ///< Number of screen pixels per 1/100 mm in X direction.
+ double mfPixelPerHmmY; ///< Number of screen pixels per 1/100 mm in Y direction.
+ css::uno::Reference<css::graphic::XGraphicMapper> mxGraphicMapper;
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
new file mode 100644
index 000000000..63718ca0e
--- /dev/null
+++ b/include/oox/helper/helper.hxx
@@ -0,0 +1,301 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_HELPER_HXX
+#define INCLUDED_OOX_HELPER_HELPER_HXX
+
+#include <sal/config.h>
+
+#include <cstring>
+#include <limits>
+
+#include <o3tl/safeint.hxx>
+#include <osl/endian.h>
+#include <rtl/math.hxx>
+#include <sal/macros.h>
+#include <sal/types.h>
+#include <tools/color.hxx>
+
+namespace oox {
+
+// Helper macros ==============================================================
+
+namespace detail {
+
+//TODO: Temporary helper for STATIC_ARRAY_SELECT; ultimately, the latter should be replaced by a
+// proper function (template):
+template<typename T> constexpr std::make_unsigned_t<T> make_unsigned(T value) {
+ if constexpr (std::is_signed_v<T>) {
+ return o3tl::make_unsigned(value);
+ } else {
+ return value;
+ }
+}
+
+}
+
+/** Expands to the 'index'-th element of a STATIC data array, or to 'def', if
+ 'index' is out of the array limits. */
+#define STATIC_ARRAY_SELECT( array, index, def ) \
+ ((detail::make_unsigned(index) < SAL_N_ELEMENTS(array)) ? ((array)[static_cast<size_t>(index)]) : (def))
+
+// Common constants ===========================================================
+
+const sal_uInt8 WINDOWS_CHARSET_ANSI = 0;
+const sal_uInt8 WINDOWS_CHARSET_DEFAULT = 1;
+const sal_uInt8 WINDOWS_CHARSET_SYMBOL = 2;
+const sal_uInt8 WINDOWS_CHARSET_APPLE_ROMAN = 77;
+const sal_uInt8 WINDOWS_CHARSET_SHIFTJIS = 128;
+const sal_uInt8 WINDOWS_CHARSET_HANGEUL = 129;
+const sal_uInt8 WINDOWS_CHARSET_JOHAB = 130;
+const sal_uInt8 WINDOWS_CHARSET_GB2312 = 134;
+const sal_uInt8 WINDOWS_CHARSET_BIG5 = 136;
+const sal_uInt8 WINDOWS_CHARSET_GREEK = 161;
+const sal_uInt8 WINDOWS_CHARSET_TURKISH = 162;
+const sal_uInt8 WINDOWS_CHARSET_VIETNAMESE = 163;
+const sal_uInt8 WINDOWS_CHARSET_HEBREW = 177;
+const sal_uInt8 WINDOWS_CHARSET_ARABIC = 178;
+const sal_uInt8 WINDOWS_CHARSET_BALTIC = 186;
+const sal_uInt8 WINDOWS_CHARSET_RUSSIAN = 204;
+const sal_uInt8 WINDOWS_CHARSET_THAI = 222;
+const sal_uInt8 WINDOWS_CHARSET_EASTERN = 238;
+const sal_uInt8 WINDOWS_CHARSET_OEM = 255;
+
+
+const ::Color API_RGB_TRANSPARENT (ColorTransparency, 0xffffffff); ///< Transparent color for API calls.
+const sal_uInt32 UNSIGNED_RGB_TRANSPARENT = static_cast<sal_uInt32>(-1); ///< Transparent color for unsigned int32 places.
+const ::Color API_RGB_BLACK (0x000000); ///< Black color for API calls.
+const ::Color API_RGB_GRAY (0x808080); ///< Gray color for API calls.
+const ::Color API_RGB_WHITE (0xFFFFFF); ///< White color for API calls.
+
+const sal_Int16 API_LINE_SOLID = 0;
+const sal_Int16 API_LINE_DOTTED = 1;
+const sal_Int16 API_LINE_DASHED = 2;
+const sal_Int16 API_FINE_LINE_DASHED = 14;
+
+const sal_Int16 API_LINE_NONE = 0;
+const sal_Int16 API_LINE_HAIR = 2;
+const sal_Int16 API_LINE_THIN = 35;
+const sal_Int16 API_LINE_MEDIUM = 88;
+const sal_Int16 API_LINE_THICK = 141;
+
+const sal_Int16 API_ESCAPE_NONE = 0; ///< No escapement.
+const sal_Int16 API_ESCAPE_SUPERSCRIPT = 101; ///< Superscript: raise characters automatically (magic value 101).
+const sal_Int16 API_ESCAPE_SUBSCRIPT = -101; ///< Subscript: lower characters automatically (magic value -101).
+
+const sal_Int8 API_ESCAPEHEIGHT_NONE = 100; ///< Relative character height if not escaped.
+const sal_Int8 API_ESCAPEHEIGHT_DEFAULT = 58; ///< Relative character height if escaped.
+
+
+// Limitate values ------------------------------------------------------------
+
+template< typename ReturnType, typename Type >
+inline ReturnType getLimitedValue( Type nValue, Type nMin, Type nMax )
+{
+ return static_cast< ReturnType >( ::std::clamp( nValue, nMin, nMax ) );
+}
+
+template< typename ReturnType, typename Type >
+inline ReturnType getIntervalValue( Type nValue, Type nBegin, Type nEnd )
+{
+ static_assert(::std::numeric_limits< Type >::is_integer, "is integer");
+ Type nInterval = nEnd - nBegin;
+ Type nCount = (nValue < nBegin) ? -((nBegin - nValue - 1) / nInterval + 1) : ((nValue - nBegin) / nInterval);
+ return static_cast< ReturnType >( nValue - nCount * nInterval );
+}
+
+template< typename ReturnType >
+inline ReturnType getDoubleIntervalValue( double fValue, double fBegin, double fEnd )
+{
+ double fInterval = fEnd - fBegin;
+ double fCount = (fValue < fBegin) ? -(::rtl::math::approxFloor( (fBegin - fValue - 1.0) / fInterval ) + 1.0) : ::rtl::math::approxFloor( (fValue - fBegin) / fInterval );
+ return static_cast< ReturnType >( fValue - fCount * fInterval );
+}
+
+// Read from bitfields --------------------------------------------------------
+
+/** Returns true, if at least one of the bits set in nMask is set in nBitField. */
+template< typename Type >
+inline bool getFlag( Type nBitField, Type nMask )
+{
+ return (nBitField & nMask) != 0;
+}
+
+/** Returns nSet, if at least one bit of nMask is set in nBitField, otherwise nUnset. */
+template< typename ReturnType, typename Type >
+inline ReturnType getFlagValue( Type nBitField, Type nMask, ReturnType nSet, ReturnType nUnset )
+{
+ return getFlag( nBitField, nMask ) ? nSet : nUnset;
+}
+
+/** Extracts a value from a bit field.
+
+ Returns the data fragment from nBitField, that starts at bit nStartBit
+ (0-based, bit 0 is rightmost) with the width of nBitCount. The returned
+ value will be right-aligned (normalized).
+ For instance: extractValue<T>(0x4321,8,4) returns 3 (value in bits 8-11).
+ */
+template< typename ReturnType, typename Type >
+inline ReturnType extractValue( Type nBitField, sal_uInt8 nStartBit, sal_uInt8 nBitCount )
+{
+ sal_uInt64 nMask = 1; nMask <<= nBitCount; --nMask;
+ return static_cast< ReturnType >( nMask & (nBitField >> nStartBit) );
+}
+
+// Write to bitfields ---------------------------------------------------------
+
+/** Sets or clears (according to bSet) all set bits of nMask in ornBitField. */
+template< typename Type >
+inline void setFlag( Type& ornBitField, Type nMask, bool bSet = true )
+{
+ if( bSet ) ornBitField |= nMask; else ornBitField &= ~nMask;
+}
+
+
+/** Optional value, similar to ::std::optional<>, with convenience accessors.
+ */
+template< typename Type >
+class OptValue
+{
+public:
+ OptValue() : maValue(), mbHasValue( false ) {}
+ explicit OptValue( const Type& rValue ) : maValue( rValue ), mbHasValue( true ) {}
+ explicit OptValue( bool bHasValue, const Type& rValue ) : maValue( rValue ), mbHasValue( bHasValue ) {}
+
+ bool has() const { return mbHasValue; }
+ bool operator!() const { return !mbHasValue; }
+ bool differsFrom( const Type& rValue ) const { return mbHasValue && (maValue != rValue); }
+
+ const Type& get() const { return maValue; }
+ const Type& get( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; }
+
+ void set( const Type& rValue ) { maValue = rValue; mbHasValue = true; }
+ Type& use() { mbHasValue = true; return maValue; }
+
+ OptValue& operator=( const Type& rValue ) { set( rValue ); return *this; }
+ bool operator==( const OptValue& rValue ) const {
+ return ( ( !mbHasValue && rValue.mbHasValue == false ) ||
+ ( mbHasValue == rValue.mbHasValue && maValue == rValue.maValue ) );
+ }
+ void assignIfUsed( const OptValue& rValue ) { if( rValue.mbHasValue ) set( rValue.maValue ); }
+
+private:
+ Type maValue;
+ bool mbHasValue;
+};
+
+
+/** Provides platform independent functions to convert from or to little-endian
+ byte order, e.g. for reading data from or writing data to memory or a
+ binary stream.
+
+ On big-endian platforms, the byte order in the passed values is swapped,
+ this can be used for converting big-endian to and from little-endian data.
+
+ On little-endian platforms, the conversion functions are implemented empty,
+ thus compilers should completely optimize away the function call.
+ */
+class ByteOrderConverter
+{
+public:
+#ifdef OSL_BIGENDIAN
+ static void convertLittleEndian( sal_Int8& ) {} // present for usage in templates
+ static void convertLittleEndian( sal_uInt8& ) {} // present for usage in templates
+ static void convertLittleEndian( char16_t& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ static void convertLittleEndian( sal_Int16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ static void convertLittleEndian( sal_uInt16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ static void convertLittleEndian( sal_Int32& rnValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ static void convertLittleEndian( sal_uInt32& rnValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ static void convertLittleEndian( sal_Int64& rnValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ static void convertLittleEndian( sal_uInt64& rnValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ static void convertLittleEndian( float& rfValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rfValue ) ); }
+ static void convertLittleEndian( double& rfValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rfValue ) ); }
+
+ template< typename Type >
+ inline static void convertLittleEndianArray( Type* pnArray, size_t nElemCount );
+
+ static void convertLittleEndianArray( sal_Int8*, size_t ) {}
+ static void convertLittleEndianArray( sal_uInt8*, size_t ) {}
+
+#else
+ template< typename Type >
+ static void convertLittleEndian( Type& ) {}
+
+ template< typename Type >
+ static void convertLittleEndianArray( Type*, size_t ) {}
+
+#endif
+
+ /** Writes a value to memory, while converting it to little-endian.
+ @param pDstBuffer The memory buffer to write the value to.
+ @param nValue The value to be written to memory in little-endian.
+ */
+ template< typename Type >
+ inline static void writeLittleEndian( void* pDstBuffer, Type nValue );
+
+#ifdef OSL_BIGENDIAN
+private:
+ inline static void swap2( sal_uInt8* pnData );
+ inline static void swap4( sal_uInt8* pnData );
+ inline static void swap8( sal_uInt8* pnData );
+#endif
+};
+
+
+template< typename Type >
+inline void ByteOrderConverter::writeLittleEndian( void* pDstBuffer, Type nValue )
+{
+ convertLittleEndian( nValue );
+ memcpy( pDstBuffer, &nValue, sizeof( Type ) );
+}
+
+#ifdef OSL_BIGENDIAN
+template< typename Type >
+inline void ByteOrderConverter::convertLittleEndianArray( Type* pnArray, size_t nElemCount )
+{
+ for( Type* pnArrayEnd = pnArray + nElemCount; pnArray != pnArrayEnd; ++pnArray )
+ convertLittleEndian( *pnArray );
+}
+
+inline void ByteOrderConverter::swap2( sal_uInt8* pnData )
+{
+ ::std::swap( pnData[ 0 ], pnData[ 1 ] );
+}
+
+inline void ByteOrderConverter::swap4( sal_uInt8* pnData )
+{
+ ::std::swap( pnData[ 0 ], pnData[ 3 ] );
+ ::std::swap( pnData[ 1 ], pnData[ 2 ] );
+}
+
+inline void ByteOrderConverter::swap8( sal_uInt8* pnData )
+{
+ ::std::swap( pnData[ 0 ], pnData[ 7 ] );
+ ::std::swap( pnData[ 1 ], pnData[ 6 ] );
+ ::std::swap( pnData[ 2 ], pnData[ 5 ] );
+ ::std::swap( pnData[ 3 ], pnData[ 4 ] );
+}
+#endif
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/modelobjecthelper.hxx b/include/oox/helper/modelobjecthelper.hxx
new file mode 100644
index 000000000..dd6100b33
--- /dev/null
+++ b/include/oox/helper/modelobjecthelper.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_MODELOBJECTHELPER_HXX
+#define INCLUDED_OOX_HELPER_MODELOBJECTHELPER_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace awt { struct Gradient;
+ class XBitmap; }
+ namespace graphic { class XGraphic; }
+ namespace container { class XNameContainer; }
+ namespace drawing { struct LineDash; }
+ namespace drawing { struct Hatch; }
+ namespace drawing { struct PolyPolygonBezierCoords; }
+ namespace lang { class XMultiServiceFactory; }
+}
+
+namespace oox {
+
+
+/** This helper manages named objects in a container, which is created on demand.
+ */
+class OOX_DLLPUBLIC ObjectContainer
+{
+public:
+ explicit ObjectContainer(
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& rxModelFactory,
+ const OUString& rServiceName );
+ ~ObjectContainer();
+
+ /** Returns true, if the object with the passed name exists in the container. */
+ bool hasObject( const OUString& rObjName ) const;
+
+ css::uno::Any getObject( const OUString& rObjName ) const;
+
+ /** Inserts the passed object into the container, returns its final name. */
+ OUString insertObject(
+ const OUString& rObjName,
+ const css::uno::Any& rObj,
+ bool bInsertByUnusedName );
+
+private:
+ void createContainer() const;
+
+private:
+ mutable css::uno::Reference< css::lang::XMultiServiceFactory >
+ mxModelFactory; ///< Factory to create the container.
+ mutable css::uno::Reference< css::container::XNameContainer >
+ mxContainer; ///< Container for the objects.
+ OUString maServiceName; ///< Service name to create the container.
+ sal_Int32 mnIndex; ///< Index to create unique identifiers.
+};
+
+
+/** Contains tables for named drawing objects for a document model.
+
+ Contains tables for named line markers, line dashes, fill gradients, and
+ fill bitmap URLs. The class is needed to handle different document models
+ in the same filter (e.g. embedded charts) which carry their own drawing
+ object tables.
+ */
+class OOX_DLLPUBLIC ModelObjectHelper
+{
+public:
+ explicit ModelObjectHelper(
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& rxModelFactory );
+
+ /** Returns true, if the model contains a line marker with the passed name. */
+ bool hasLineMarker( const OUString& rMarkerName ) const;
+
+ /** Inserts a new named line marker, overwrites an existing line marker
+ with the same name. Returns true, if the marker could be inserted. */
+ bool insertLineMarker(
+ const OUString& rMarkerName,
+ const css::drawing::PolyPolygonBezierCoords& rMarker );
+
+ /** Inserts a new named line dash, returns the line dash name, based on an
+ internal constant name with a new unused index appended. */
+ OUString insertLineDash( const css::drawing::LineDash& rDash );
+
+ /** Inserts a new named fill gradient, returns the gradient name, based on
+ an internal constant name with a new unused index appended. */
+ OUString insertFillGradient( const css::awt::Gradient& rGradient );
+
+ OUString insertTransGrandient( const css::awt::Gradient& rGradient );
+
+ OUString insertFillHatch( const css::drawing::Hatch& rHatch );
+
+ /** Inserts a new named fill graphic, returns the bitmap name, based on
+ an internal constant name with a new unused index appended. */
+ OUString insertFillBitmapXGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic);
+
+ css::uno::Reference<css::awt::XBitmap> getFillBitmap(OUString const & rGraphicName);
+
+private:
+ ObjectContainer maMarkerContainer; ///< Contains all named line markers (line end polygons).
+ ObjectContainer maDashContainer; ///< Contains all named line dashes.
+ ObjectContainer maGradientContainer; ///< Contains all named fill gradients.
+ ObjectContainer maTransGradContainer; ///< Contains all named transparency Gradients.
+ ObjectContainer maBitmapUrlContainer; ///< Contains all named fill bitmap URLs.
+ ObjectContainer maHatchContainer; ///< Contains all named fill hatches.
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/progressbar.hxx b/include/oox/helper/progressbar.hxx
new file mode 100644
index 000000000..e1c5c0a99
--- /dev/null
+++ b/include/oox/helper/progressbar.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_PROGRESSBAR_HXX
+#define INCLUDED_OOX_HELPER_PROGRESSBAR_HXX
+
+#include <memory>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star {
+ namespace task { class XStatusIndicator; }
+}
+
+namespace oox {
+
+// Interfaces =================================================================
+
+/** Interface for progress bar classes.
+ */
+class OOX_DLLPUBLIC IProgressBar
+{
+public:
+ virtual ~IProgressBar();
+
+ /** Returns the current position of the progress bar.
+
+ @return Position of the progress bar, in the range from 0.0 (beginning
+ of the progress bar) to 1.0 (end of the progress bar) inclusive.
+ */
+ virtual double getPosition() const = 0;
+
+ /** Sets the current position of the progress bar.
+
+ @param fPosition New position of the progress bar, in the range from
+ 0.0 (beginning of the progress bar) to 1.0 (end of the progress bar)
+ inclusive.
+ */
+ virtual void setPosition( double fPosition ) = 0;
+};
+
+
+class ISegmentProgressBar;
+typedef std::shared_ptr< ISegmentProgressBar > ISegmentProgressBarRef;
+
+/** Interface for a segment in a progress bar, that is able to create sub
+ segments from itself.
+ */
+class OOX_DLLPUBLIC ISegmentProgressBar : public IProgressBar
+{
+public:
+ virtual ~ISegmentProgressBar() override;
+
+ /** Returns the length that is still free for creating sub segments. */
+ virtual double getFreeLength() const = 0;
+
+ /** Adds a new segment with the specified length. */
+ virtual ISegmentProgressBarRef createSegment( double fLength ) = 0;
+};
+
+
+/** A simple progress bar.
+ */
+class OOX_DLLPUBLIC ProgressBar final : public IProgressBar
+{
+public:
+ explicit ProgressBar(
+ const css::uno::Reference< css::task::XStatusIndicator >& rxIndicator,
+ const OUString& rText );
+
+ virtual ~ProgressBar() override;
+
+ /** Returns the current position of the progress bar. */
+ virtual double getPosition() const override;
+ /** Sets the current position of the progress bar. */
+ virtual void setPosition( double fPosition ) override;
+
+private:
+ css::uno::Reference< css::task::XStatusIndicator >
+ mxIndicator;
+ double mfPosition;
+};
+
+
+/** A progress bar containing several independent segments.
+ */
+class OOX_DLLPUBLIC SegmentProgressBar final : public ISegmentProgressBar
+{
+public:
+ explicit SegmentProgressBar(
+ const css::uno::Reference< css::task::XStatusIndicator >& rxIndicator,
+ const OUString& rText );
+
+ /** Returns the current position of the progress bar segment. */
+ virtual double getPosition() const override;
+ /** Sets the current position of the progress bar segment. */
+ virtual void setPosition( double fPosition ) override;
+
+ /** Returns the length that is still free for creating sub segments. */
+ virtual double getFreeLength() const override;
+ /** Adds a new segment with the specified length. */
+ virtual ISegmentProgressBarRef createSegment( double fLength ) override;
+
+private:
+ ProgressBar maProgress;
+ double mfFreeStart;
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/propertymap.hxx b/include/oox/helper/propertymap.hxx
new file mode 100644
index 000000000..423bb11fc
--- /dev/null
+++ b/include/oox/helper/propertymap.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_PROPERTYMAP_HXX
+#define INCLUDED_OOX_HELPER_PROPERTYMAP_HXX
+
+#include <map>
+#include <utility>
+#include <vector>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star::beans {
+ struct PropertyValue;
+ class XPropertySet;
+}
+
+namespace oox {
+
+
+typedef ::std::map< OUString, css::uno::Any > PropertyNameMap;
+
+/** A helper that maps property identifiers to property values.
+
+ The property identifiers are generated on compile time and refer to the
+ property name strings that are held by a static vector. The identifier to
+ name mapping is done internally while the properties are written to
+ property sets.
+ */
+class OOX_DLLPUBLIC PropertyMap
+{
+public:
+ PropertyMap();
+
+ /** Returns the name of the passed property identifier. */
+ static const OUString& getPropertyName( sal_Int32 nPropId );
+
+ /** Returns the property identifier of the passed name. */
+ static sal_Int32 getPropertyId( std::u16string_view sPropName );
+
+ /** Returns true, if the map contains a property with the passed identifier. */
+ bool hasProperty( sal_Int32 nPropId ) const;
+
+ /** Sets the specified property to the passed value. Does nothing, if the
+ identifier is invalid. */
+ bool setAnyProperty( sal_Int32 nPropId, const css::uno::Any& rValue );
+
+ /** Sets the specified property to the passed value. Does nothing, if the
+ identifier is invalid. */
+ template< typename Type >
+ bool setProperty( sal_Int32 nPropId, Type&& rValue )
+ {
+ if( nPropId < 0 )
+ return false;
+
+ maProperties[ nPropId ] <<= std::forward<Type>(rValue);
+ return true;
+ }
+
+ /** setAnyProperty should be used */
+ bool setProperty( sal_Int32, const css::uno::Any& ) = delete;
+
+ css::uno::Any getProperty( sal_Int32 nPropId );
+
+ void erase( sal_Int32 nPropId );
+
+ bool empty() const;
+
+ /** Inserts all properties contained in the passed property map. */
+ void assignUsed( const PropertyMap& rPropMap );
+
+ /** Inserts all properties contained in the passed property map */
+ void assignAll( const PropertyMap& rPropMap );
+
+ /** Returns a sequence of property values, filled with all contained properties. */
+ css::uno::Sequence< css::beans::PropertyValue >
+ makePropertyValueSequence() const;
+
+ /** Fills the passed sequences of names and anys with all contained properties. */
+ void fillSequences(
+ css::uno::Sequence< OUString >& rNames,
+ css::uno::Sequence< css::uno::Any >& rValues ) const;
+
+ void fillPropertyNameMap(PropertyNameMap& rMap) const;
+
+ /** Creates a property set supporting the XPropertySet interface and inserts all properties. */
+ css::uno::Reference< css::beans::XPropertySet >
+ makePropertySet() const;
+
+#if OSL_DEBUG_LEVEL > 0
+#ifdef DBG_UTIL
+ static void dump( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet);
+#endif
+ static void dumpCode( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet);
+ static void dumpData( const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
+#endif
+private:
+ const std::vector<OUString>* mpPropNames;
+
+protected:
+ std::map< sal_Int32, css::uno::Any > maProperties;
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/propertyset.hxx b/include/oox/helper/propertyset.hxx
new file mode 100644
index 000000000..676ec4ceb
--- /dev/null
+++ b/include/oox/helper/propertyset.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_PROPERTYSET_HXX
+#define INCLUDED_OOX_HELPER_PROPERTYSET_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/color.hxx>
+
+namespace com::sun::star {
+ namespace beans { class XMultiPropertySet; }
+ namespace beans { class XPropertySet; }
+ namespace beans { class XPropertySetInfo; }
+}
+
+namespace oox {
+
+class PropertyMap;
+
+
+/** A wrapper for a UNO property set.
+
+ This class provides functions to silently get and set properties (without
+ exceptions, without the need to check validity of the UNO property set).
+
+ An instance is constructed with the reference to a UNO property set or any
+ other interface (the constructor will query for the
+ com.sun.star.beans.XPropertySet interface then). The reference to the
+ property set will be kept as long as the instance of this class is alive.
+
+ The functions setProperties() tries to handle all passed values at once,
+ using the com.sun.star.beans.XMultiPropertySet interface. If the
+ implementation does not support the XMultiPropertySet interface, all
+ properties are handled separately in a loop.
+ */
+class OOX_DLLPUBLIC PropertySet
+{
+public:
+ PropertySet() {}
+
+ /** Constructs a property set wrapper with the passed UNO property set. */
+ explicit PropertySet(
+ const css::uno::Reference< css::beans::XPropertySet >& rxPropSet )
+ { set( rxPropSet ); }
+
+ /** Constructs a property set wrapper after querying the XPropertySet interface. */
+ template< typename Type >
+ explicit PropertySet( const Type& rObject ) { set( rObject ); }
+
+ /** Sets the passed UNO property set and releases the old UNO property set. */
+ void set( const css::uno::Reference< css::beans::XPropertySet >& rxPropSet );
+
+ /** Queries the passed object (interface or any) for an XPropertySet and releases the old UNO property set. */
+ template< typename Type >
+ void set( const Type& rObject )
+ { set( css::uno::Reference< css::beans::XPropertySet >( rObject, css::uno::UNO_QUERY ) ); }
+
+ /** Returns true, if the contained XPropertySet interface is valid. */
+ bool is() const { return mxPropSet.is(); }
+
+ /** Returns true, if the specified property is supported by the property set. */
+ bool hasProperty( sal_Int32 nPropId ) const;
+
+ // Get properties ---------------------------------------------------------
+
+ /** Gets the specified property from the property set.
+ @return the property value, or an empty Any, if the property is missing. */
+ css::uno::Any getAnyProperty( sal_Int32 nPropId ) const;
+
+ /** Gets the specified property from the property set.
+ @return true, if the passed variable could be filled with the property value. */
+ template< typename Type >
+ bool getProperty( Type& orValue, sal_Int32 nPropId ) const
+ { return getAnyProperty( nPropId ) >>= orValue; }
+
+ /** Gets the specified boolean property from the property set.
+ @return true = property contains true; false = property contains false or error occurred. */
+ bool getBoolProperty( sal_Int32 nPropId ) const
+ { bool bValue = false; return getProperty( bValue, nPropId ) && bValue; }
+ // Set properties ---------------------------------------------------------
+
+ /** Puts the passed any into the property set. */
+ bool setAnyProperty( sal_Int32 nPropId, const css::uno::Any& rValue );
+
+ /** Puts the passed value into the property set. */
+ template< typename Type >
+ bool setProperty( sal_Int32 nPropId, const Type& rValue )
+ { return setAnyProperty( nPropId, css::uno::Any( rValue ) ); }
+ bool setProperty( sal_Int32 nPropId, ::Color rValue )
+ { return setAnyProperty( nPropId, css::uno::Any( rValue ) ); }
+
+ /** Puts the passed properties into the property set. Tries to use the XMultiPropertySet interface.
+ @param rPropNames The property names. MUST be ordered alphabetically.
+ @param rValues The related property values. */
+ void setProperties(
+ const css::uno::Sequence< OUString >& rPropNames,
+ const css::uno::Sequence< css::uno::Any >& rValues );
+
+ /** Puts the passed property map into the property set. Tries to use the XMultiPropertySet interface.
+ @param rPropertyMap The property map. */
+ void setProperties( const PropertyMap& rPropertyMap );
+
+#ifdef DBG_UTIL
+ void dump();
+#endif
+
+
+private:
+ /** Gets the specified property from the property set.
+ @return true, if the any could be filled with the property value. */
+ bool implGetPropertyValue( css::uno::Any& orValue, const OUString& rPropName ) const;
+
+ /** Puts the passed any into the property set. */
+ bool implSetPropertyValue( const OUString& rPropName, const css::uno::Any& rValue );
+
+private:
+ css::uno::Reference< css::beans::XPropertySet >
+ mxPropSet; ///< The mandatory property set interface.
+ css::uno::Reference< css::beans::XMultiPropertySet >
+ mxMultiPropSet; ///< The optional multi property set interface.
+ css::uno::Reference< css::beans::XPropertySetInfo >
+ mxPropSetInfo; ///< Property information.
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/refmap.hxx b/include/oox/helper/refmap.hxx
new file mode 100644
index 000000000..2e63af512
--- /dev/null
+++ b/include/oox/helper/refmap.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_REFMAP_HXX
+#define INCLUDED_OOX_HELPER_REFMAP_HXX
+
+#include <algorithm>
+#include <functional>
+#include <map>
+#include <memory>
+
+namespace oox {
+
+
+/** Template for a map of ref-counted objects with additional accessor functions.
+
+ An instance of the class RefMap< Type > stores elements of the type
+ std::shared_ptr< Type >. The new accessor functions has() and get()
+ work correctly for nonexisting keys, there is no need to check the passed
+ key before.
+ */
+template< typename KeyType, typename ObjType, typename CompType = std::less< KeyType > >
+class RefMap : public std::map< KeyType, std::shared_ptr< ObjType >, CompType >
+{
+public:
+ typedef std::map< KeyType, std::shared_ptr< ObjType >, CompType > container_type;
+ typedef typename container_type::key_type key_type;
+ typedef typename container_type::mapped_type mapped_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::key_compare key_compare;
+
+public:
+ /** Returns true, if the object associated to the passed key exists.
+ Returns false, if the key exists but points to an empty reference. */
+ bool has( key_type nKey ) const
+ {
+ const mapped_type* pxRef = getRef( nKey );
+ return pxRef && pxRef->get();
+ }
+
+ /** Returns a reference to the object associated to the passed key, or an
+ empty reference on error. */
+ mapped_type get( key_type nKey ) const
+ {
+ if( const mapped_type* pxRef = getRef( nKey ) ) return *pxRef;
+ return mapped_type();
+ }
+
+ /** Calls the passed functor for every contained object, automatically
+ skips all elements that are empty references. */
+ template< typename FunctorType >
+ void forEach( const FunctorType& rFunctor ) const
+ {
+ std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType >
+ void forEachMem( FuncType pFunc ) const
+ {
+ forEach( ::std::bind( pFunc, std::placeholders::_1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEach( ::std::bind( pFunc, std::placeholders::_1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEach( ::std::bind( pFunc, std::placeholders::_1, aParam1, aParam2, aParam3 ) );
+ }
+
+
+ /** Calls the passed functor for every contained object. Passes the key as
+ first argument and the object reference as second argument to rFunctor. */
+ template< typename FunctorType >
+ void forEachWithKey( const FunctorType& rFunctor ) const
+ {
+ std::for_each( this->begin(), this->end(), ForEachFunctorWithKey< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as argument to the member function. */
+ template< typename FuncType >
+ void forEachMemWithKey( FuncType pFunc ) const
+ {
+ forEachWithKey( ::std::bind( pFunc, std::placeholders::_2, std::placeholders::_1 ) );
+ }
+
+
+private:
+ template< typename FunctorType >
+ struct ForEachFunctor
+ {
+ FunctorType maFunctor;
+ explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( *rValue.second ); }
+ };
+
+ template< typename FunctorType >
+ struct ForEachFunctorWithKey
+ {
+ FunctorType maFunctor;
+ explicit ForEachFunctorWithKey( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( rValue.first, *rValue.second ); }
+ };
+
+ const mapped_type* getRef( key_type nKey ) const
+ {
+ typename container_type::const_iterator aIt = this->find( nKey );
+ return (aIt == this->end()) ? nullptr : &aIt->second;
+ }
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/refvector.hxx b/include/oox/helper/refvector.hxx
new file mode 100644
index 000000000..018940836
--- /dev/null
+++ b/include/oox/helper/refvector.hxx
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_REFVECTOR_HXX
+#define INCLUDED_OOX_HELPER_REFVECTOR_HXX
+
+#include <algorithm>
+#include <functional>
+#include <memory>
+#include <vector>
+
+#include <sal/types.h>
+
+namespace oox {
+
+
+/** Template for a vector of ref-counted objects with additional accessor functions.
+
+ An instance of the class RefVector< Type > stores elements of the type
+ std::shared_ptr< Type >. The new accessor functions has() and get()
+ work correctly for indexes out of the current range, there is no need to
+ check the passed index before.
+ */
+template< typename ObjType >
+class RefVector : public ::std::vector< std::shared_ptr< ObjType > >
+{
+public:
+ typedef ::std::vector< std::shared_ptr< ObjType > > container_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::size_type size_type;
+
+public:
+
+ /** Returns a reference to the object with the passed index, or 0 on error. */
+ value_type get( sal_Int32 nIndex ) const
+ {
+ if( const value_type* pxRef = getRef( nIndex ) ) return *pxRef;
+ return value_type();
+ }
+
+ /** Calls the passed functor for every contained object, automatically
+ skips all elements that are empty references. */
+ template< typename FunctorType >
+ void forEach( FunctorType aFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( aFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType >
+ void forEachMem( FuncType pFunc ) const
+ {
+ forEach( ::std::bind( pFunc, std::placeholders::_1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType >
+ void forEachMem( FuncType pFunc, ParamType aParam ) const
+ {
+ forEach( ::std::bind( pFunc, std::placeholders::_1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEach( ::std::bind( pFunc, std::placeholders::_1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEach( ::std::bind( pFunc, std::placeholders::_1, aParam1, aParam2, aParam3 ) );
+ }
+
+ /** Calls the passed functor for every contained object. Passes the index as
+ first argument and the object reference as second argument to rFunctor. */
+ template< typename FunctorType >
+ void forEachWithIndex( const FunctorType& rFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctorWithIndex< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEachWithIndex( ::std::bind( pFunc, std::placeholders::_2, std::placeholders::_1, aParam1, aParam2 ) );
+ }
+
+ /** Searches for an element by using the passed functor that takes a
+ constant reference of the object type (const ObjType&). */
+ template< typename FunctorType >
+ value_type findIf( const FunctorType& rFunctor ) const
+ {
+ typename container_type::const_iterator aIt = ::std::find_if( this->begin(), this->end(), FindFunctor< FunctorType >( rFunctor ) );
+ return (aIt == this->end()) ? value_type() : *aIt;
+ }
+
+private:
+ template< typename FunctorType >
+ struct ForEachFunctor
+ {
+ FunctorType maFunctor;
+ explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( *rxValue ); }
+ };
+
+ template< typename FunctorType >
+ struct ForEachFunctorWithIndex
+ {
+ FunctorType maFunctor;
+ sal_Int32 mnIndex;
+ explicit ForEachFunctorWithIndex( const FunctorType& rFunctor ) : maFunctor( rFunctor ), mnIndex( 0 ) {}
+ void operator()( const value_type& rxValue ) {
+ if( rxValue.get() ) maFunctor( mnIndex, *rxValue );
+ ++mnIndex;
+ }
+ };
+
+ template< typename FunctorType >
+ struct FindFunctor
+ {
+ FunctorType maFunctor;
+ explicit FindFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ bool operator()( const value_type& rxValue ) { return rxValue.get() && maFunctor( *rxValue ); }
+ };
+
+ const value_type* getRef( sal_Int32 nIndex ) const
+ {
+ return ((0 <= nIndex) && (static_cast< size_type >( nIndex ) < this->size())) ?
+ &(*this)[ static_cast< size_type >( nIndex ) ] : nullptr;
+ }
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/storagebase.hxx b/include/oox/helper/storagebase.hxx
new file mode 100644
index 000000000..2722ed80b
--- /dev/null
+++ b/include/oox/helper/storagebase.hxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_STORAGEBASE_HXX
+#define INCLUDED_OOX_HELPER_STORAGEBASE_HXX
+
+#include <functional>
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/refmap.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star {
+ namespace embed { class XStorage; }
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XStream; }
+}
+
+namespace oox {
+
+
+class StorageBase;
+typedef std::shared_ptr< StorageBase > StorageRef;
+
+/** Base class for storage access implementations.
+
+ Derived classes will be used to encapsulate storage access implementations
+ for ZIP storages containing XML streams, and OLE storages containing binary
+ data streams.
+ */
+class OOX_DLLPUBLIC StorageBase
+{
+public:
+ explicit StorageBase(
+ const css::uno::Reference< css::io::XInputStream >& rxInStream,
+ bool bBaseStreamAccess );
+
+ explicit StorageBase(
+ const css::uno::Reference< css::io::XStream >& rxOutStream,
+ bool bBaseStreamAccess );
+
+ virtual ~StorageBase();
+
+ /** Returns true, if the object represents a valid storage. */
+ bool isStorage() const;
+
+ /** Returns true, if the object represents the root storage. */
+ bool isRootStorage() const;
+
+ /** Returns true, if the storage operates in read-only mode (based on an
+ input stream). */
+ bool isReadOnly() const { return mbReadOnly;}
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage. */
+ css::uno::Reference< css::embed::XStorage >
+ getXStorage() const;
+
+ /** Returns the element name of this storage. */
+ const OUString& getName() const { return maStorageName;}
+
+ /** Returns the full path of this storage. */
+ OUString getPath() const;
+
+ /** Fills the passed vector with the names of all direct elements of this
+ storage. */
+ void getElementNames( ::std::vector< OUString >& orElementNames ) const;
+
+ /** Opens and returns the specified sub storage from the storage.
+
+ @param rStorageName
+ The name of the embedded storage. The name may contain slashes to
+ open storages from embedded substorages.
+ @param bCreateMissing
+ True = create missing sub storages (for export filters). Must be
+ false for storages based on input streams.
+ */
+ StorageRef openSubStorage( const OUString& rStorageName, bool bCreateMissing );
+
+ /** Opens and returns the specified input stream from the storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the constructor, the base stream can be
+ accessed by passing an empty string as stream name.
+ */
+ css::uno::Reference< css::io::XInputStream >
+ openInputStream( const OUString& rStreamName );
+
+ /** Opens and returns the specified output stream from the storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to create and open streams in embedded substorages. If base
+ stream access has been enabled in the constructor, the base stream
+ can be accessed by passing an empty string as stream name.
+ */
+ css::uno::Reference< css::io::XOutputStream >
+ openOutputStream( const OUString& rStreamName );
+
+ /** Copies the specified element from this storage to the passed
+ destination storage.
+
+ @param rElementName
+ The name of the embedded storage or stream. The name may contain
+ slashes to specify an element in an embedded substorage. In this
+ case, the element will be copied to the same substorage in the
+ destination storage.
+ */
+ void copyToStorage( StorageBase& rDestStrg, const OUString& rElementName );
+
+ /** Copies all streams of this storage and of all substorages to the passed
+ destination. */
+ void copyStorageToStorage( StorageBase& rDestStrg );
+
+ /** Commits the changes to the storage and all substorages. */
+ void commit();
+
+protected:
+ /** Special constructor for sub storage objects. */
+ explicit StorageBase( const StorageBase& rParentStorage, const OUString& rStorageName, bool bReadOnly );
+
+private:
+ StorageBase( const StorageBase& ) = delete;
+ StorageBase& operator=( const StorageBase& ) = delete;
+
+ /** Returns true, if the object represents a valid storage. */
+ virtual bool implIsStorage() const = 0;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage. */
+ virtual css::uno::Reference< css::embed::XStorage >
+ implGetXStorage() const = 0;
+
+ /** Returns the names of all elements of this storage. */
+ virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const = 0;
+
+ /** Implementation of opening a storage element. */
+ virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreate ) = 0;
+
+ /** Implementation of opening an input stream element. */
+ virtual css::uno::Reference< css::io::XInputStream >
+ implOpenInputStream( const OUString& rElementName ) = 0;
+
+ /** Implementation of opening an output stream element. */
+ virtual css::uno::Reference< css::io::XOutputStream >
+ implOpenOutputStream( const OUString& rElementName ) = 0;
+
+ /** Commits the current storage. */
+ virtual void implCommit() const = 0;
+
+ /** Helper that opens and caches the specified direct substorage. */
+ StorageRef getSubStorage( const OUString& rElementName, bool bCreateMissing );
+
+private:
+ RefMap< OUString, StorageBase >
+ maSubStorages; ///< Map of direct sub storages.
+ css::uno::Reference< css::io::XInputStream >
+ mxInStream; ///< Cached base input stream (to keep it alive).
+ css::uno::Reference< css::io::XStream >
+ mxOutStream; ///< Cached base output stream (to keep it alive).
+ OUString maParentPath; ///< Full path of parent storage.
+ OUString maStorageName; ///< Name of this storage, if it is a substorage.
+ bool mbBaseStreamAccess; ///< True = access base streams with empty stream name.
+ bool mbReadOnly; ///< True = storage opened read-only (based on input stream).
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/textinputstream.hxx b/include/oox/helper/textinputstream.hxx
new file mode 100644
index 000000000..4a5bcdbfe
--- /dev/null
+++ b/include/oox/helper/textinputstream.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_TEXTINPUTSTREAM_HXX
+#define INCLUDED_OOX_HELPER_TEXTINPUTSTREAM_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace io { class XInputStream; }
+ namespace io { class XTextInputStream2; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox {
+
+class BinaryInputStream;
+
+
+class TextInputStream
+{
+public:
+ explicit TextInputStream(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ explicit TextInputStream(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ BinaryInputStream& rInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ ~TextInputStream();
+
+ /** Returns true, if no more text is available in the stream.
+ */
+ bool isEof() const;
+
+ /** Reads a text line from the stream.
+
+ If the last line in the stream is not terminated with line-end
+ character(s), the stream will immediately go into EOF state and return
+ the text line. Otherwise, if the last character in the stream is a
+ line-end character, the next call to this function will turn the stream
+ into EOF state and return an empty string.
+ */
+ OUString readLine();
+
+ /** Reads a text portion from the stream until the specified character is
+ found.
+
+ If the end of the stream is not terminated with the specified
+ character, the stream will immediately go into EOF state and return the
+ remaining text portion. Otherwise, if the last character in the stream
+ is the specified character (and caller specifies to read and return it,
+ see parameter bIncludeChar), the next call to this function will turn
+ the stream into EOF state and return an empty string.
+
+ @param cChar
+ The separator character to be read to.
+
+ @param bIncludeChar
+ True = if found, the specified character will be read from stream
+ and included in the returned string.
+ False = the specified character will neither be read from the
+ stream nor included in the returned string, but will be
+ returned as first character in the next call of this function
+ or readLine().
+ */
+ OUString readToChar( sal_Unicode cChar, bool bIncludeChar );
+
+
+ /** Creates a UNO text input stream object from the passed UNO input stream.
+ */
+ static css::uno::Reference< css::io::XTextInputStream2 >
+ createXTextInputStream(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+
+private:
+ void init(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ /** Adds the pending character in front of the passed string, if existing. */
+ OUString createFinalString( const OUString& rString );
+
+private:
+ css::uno::Reference< css::io::XTextInputStream2 >
+ mxTextStrm;
+ sal_Unicode mcPendingChar;
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/zipstorage.hxx b/include/oox/helper/zipstorage.hxx
new file mode 100644
index 000000000..dec4b483e
--- /dev/null
+++ b/include/oox/helper/zipstorage.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_HELPER_ZIPSTORAGE_HXX
+#define INCLUDED_OOX_HELPER_ZIPSTORAGE_HXX
+
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/helper/storagebase.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star {
+ namespace embed { class XStorage; }
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XStream; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox {
+
+
+/** Implements stream access for ZIP storages containing XML streams. */
+class ZipStorage final : public StorageBase
+{
+public:
+ explicit ZipStorage(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XInputStream >& rxInStream );
+
+ explicit ZipStorage(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XStream >& rxStream );
+
+ virtual ~ZipStorage() override;
+
+private:
+ explicit ZipStorage(
+ const ZipStorage& rParentStorage,
+ const css::uno::Reference< css::embed::XStorage >& rxStorage,
+ const OUString& rElementName );
+
+ /** Returns true, if the object represents a valid storage. */
+ virtual bool implIsStorage() const override;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage. */
+ virtual css::uno::Reference< css::embed::XStorage >
+ implGetXStorage() const override;
+
+ /** Returns the names of all elements of this storage. */
+ virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const override;
+
+ /** Opens and returns the specified sub storage from the storage. */
+ virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreateMissing ) override;
+
+ /** Opens and returns the specified input stream from the storage. */
+ virtual css::uno::Reference< css::io::XInputStream >
+ implOpenInputStream( const OUString& rElementName ) override;
+
+ /** Opens and returns the specified output stream from the storage. */
+ virtual css::uno::Reference< css::io::XOutputStream >
+ implOpenOutputStream( const OUString& rElementName ) override;
+
+ /** Commits the current storage. */
+ virtual void implCommit() const override;
+
+private:
+ css::uno::Reference< css::embed::XStorage >
+ mxStorage; ///< Storage based on input or output stream.
+};
+
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/mathml/export.hxx b/include/oox/mathml/export.hxx
new file mode 100644
index 000000000..e9589a0d1
--- /dev/null
+++ b/include/oox/mathml/export.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_OOX_MATHML_EXPORT_HXX
+#define INCLUDED_OOX_MATHML_EXPORT_HXX
+
+#include <oox/core/filterbase.hxx>
+#include <oox/dllapi.h>
+#include <oox/export/utils.hxx>
+#include <rtl/strbuf.hxx>
+#include <rtl/textenc.h>
+#include <sax/fshelper.hxx>
+
+namespace oox
+{
+
+/**
+ Interface class, StarMath will implement writeFormula*() to write out markup
+ representing the formula.
+ */
+class OOX_DLLPUBLIC FormulaExportBase
+{
+public:
+ virtual void writeFormulaOoxml(::sax_fastparser::FSHelperPtr pSerializer,
+ oox::core::OoxmlVersion version,
+ oox::drawingml::DocumentType documentType, sal_Int8 nAlign) = 0;
+ virtual void writeFormulaRtf( OStringBuffer& rBuffer, rtl_TextEncoding nEncoding ) = 0;
+ enum eFormulaAlign { INLINE, CENTER, GROUPEDCENTER, LEFT, RIGHT };
+
+protected:
+ FormulaExportBase();
+
+ ~FormulaExportBase() {}
+};
+
+} // namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/mathml/import.hxx b/include/oox/mathml/import.hxx
new file mode 100644
index 000000000..92db9a837
--- /dev/null
+++ b/include/oox/mathml/import.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_OOX_MATHML_IMPORT_HXX
+#define INCLUDED_OOX_MATHML_IMPORT_HXX
+
+#include <oox/dllapi.h>
+#include <rtl/ref.hxx>
+#include <tools/gen.hxx>
+
+namespace oox
+{
+
+namespace formulaimport
+{
+class XmlStream;
+}
+
+/**
+ Interface class, StarMath will implement readFormulaOoxml() to read OOXML
+ representing the formula and getFormulaSize() to provide the size of the resulting
+ formula.
+ */
+class OOX_DLLPUBLIC FormulaImportBase
+{
+public:
+ virtual void readFormulaOoxml( oox::formulaimport::XmlStream& stream ) = 0;
+ virtual Size getFormulaSize() const = 0;
+
+protected:
+ FormulaImportBase();
+
+ ~FormulaImportBase() {}
+};
+
+namespace core { class ContextHandler; }
+namespace drawingml { class TextParagraph; }
+
+::rtl::Reference<core::ContextHandler> CreateLazyMathBufferingContext(
+ core::ContextHandler const& rParent, drawingml::TextParagraph & rPara);
+
+} // namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/mathml/importutils.hxx b/include/oox/mathml/importutils.hxx
new file mode 100644
index 000000000..9ab79a6f0
--- /dev/null
+++ b/include/oox/mathml/importutils.hxx
@@ -0,0 +1,255 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_OOX_MATHML_IMPORTUTILS_HXX
+#define INCLUDED_OOX_MATHML_IMPORTUTILS_HXX
+
+#include <map>
+#include <string_view>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/token/tokens.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star
+{
+namespace xml::sax
+{
+class XFastAttributeList;
+}
+}
+
+namespace oox::formulaimport
+{
+// used to differentiate between tags that opening or closing
+const int TAG_OPENING = 1 << 29;
+const int TAG_CLOSING = 1 << 30;
+
+// you probably want to #define these to something shorter in the .cxx file,
+// but they must be done as macros, otherwise they wouldn't be usable for case values,
+// and macros cannot be namespaced
+#define XML_STREAM_OPENING(token) (TAG_OPENING | token)
+#define XML_STREAM_CLOSING(token) (TAG_CLOSING | token)
+
+/**
+ Class for storing a stream of xml tokens.
+
+ A part of an XML file can be parsed and stored in this stream, from which it can be read
+ as if parsed linearly. The purpose of this class is to allow simpler handling of XML
+ files, unlike the usual LO way of using callbacks, context handlers and similar needlessly
+ complicated stuff (YMMV).
+
+ The advantages of this approach is easy to read and debug code (as it is just functions
+ reading tokens one by one and calling other functions, compared to having to use callbacks
+ and temporary storage). The disadvantage is that the XML structure needs to be handled
+ manually by the code.
+
+ Note that tag identifiers are simply int values and the API does not care besides matching
+ their values to XML stream contents and requiring that the values are not as high as TAG_OPENING.
+ Be prepared for the fact that some of the functions may throw exceptions if the input
+ stream does not match the required token (TBD).
+
+ The API tries to make the common idioms as simple as possible, see the following examples.
+
+ Parse <tagone attr="value"><tagtwo>text</tagtwo></tagone> , where tagtwo is optional:
+ @code
+XmlStream::Tag tagoneTag = stream.ensureOpeningTag( tagone );
+if( attributeTag.hasAttribute( attr ))
+ ... = attributeTag.attribute( attr, defaultValueOfTheRightType );
+if( XmlStream::Tag tagtwoTag = stream.checkOpeningTag( tagtwo ))
+{
+ ... = tagtwoTag.text;
+ stream.ensureClosingTag( tagtwo );
+}
+stream.ensureClosingTag( tagone );
+ @endcode
+
+ Parse an element that may contain several sub-elements of different types in random order:
+ @code
+stream.ensureOpeningTag( element );
+while( !stream.atEnd() && stream.currentToken() != CLOSING( element ))
+ {
+ switch( stream.currentToken())
+ {
+ case OPENING( subelement1 ):
+ handleSubElement1();
+ break;
+ case OPENING( subelement2 ):
+ ... process subelement2;
+ break;
+ default:
+ stream.handleUnexpectedTag();
+ break;
+ }
+stream.ensureClosingTag( element );
+ @endcode
+
+ If there may not be a zero number of sub-elements, use a helper bool variable or use a do-while loop.
+
+ Parse an element that may contain an unknown number of sub-elements of the same type:
+ @code
+stream.ensureOpeningTag( element );
+while( !stream.atEnd() && stream.findTag( OPENING( subelement )))
+ {
+ handleSubelement();
+ }
+stream.ensureClosingTag( element );
+ @endcode
+
+ If there may not be a zero number of sub-elements, use a helper bool variable or use a do-while loop.
+
+ @since 3.5
+*/
+class OOX_DLLPUBLIC XmlStream
+{
+public:
+ XmlStream();
+ /**
+ Structure representing a list of attributes.
+ */
+ // One could theoretically use oox::AttributeList, but that complains if the passed reference is empty,
+ // which would be complicated to avoid here. Also, parsers apparently reuse the same instance of XFastAttributeList,
+ // which means using oox::AttributeList would make them all point to the one instance.
+ struct OOX_DLLPUBLIC AttributeList
+ {
+ OUString& operator[](int token);
+ OUString attribute(int token, const OUString& def) const;
+ bool attribute(int token, bool def) const;
+ sal_Unicode attribute(int token, sal_Unicode def) const;
+ // when adding more attribute() overloads, add also to XmlStream itself
+ protected:
+ std::map<int, OUString> attrs;
+ };
+ /**
+ Structure representing a tag, including its attributes and content text immediately following it.
+ */
+ struct OOX_DLLPUBLIC Tag
+ {
+ Tag(int token = XML_TOKEN_INVALID,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& attributes
+ = css::uno::Reference<css::xml::sax::XFastAttributeList>());
+ Tag(int token, const AttributeList& attribs);
+ int token; ///< tag type, or XML_TOKEN_INVALID
+ AttributeList attributes;
+ OUString text;
+ /**
+ This function returns value of the given attribute, or the passed default value if not found.
+ The type of the default value selects the return type (OUString here).
+ */
+ OUString attribute(int token, const OUString& def = OUString()) const;
+ /**
+ @overload
+ */
+ bool attribute(int token, bool def) const;
+ /**
+ @overload
+ */
+ sal_Unicode attribute(int token, sal_Unicode def) const;
+ // when adding more attribute() overloads, add also to XmlStream::AttributeList and inline below
+ /**
+ Converts to true if the tag has a valid token, false otherwise. Allows simple
+ usage in if(), for example 'if( XmlStream::Tag foo = stream.checkOpeningTag( footoken ))'.
+ */
+ operator bool() const;
+ };
+ /**
+ @return true if current position is at the end of the XML stream
+ */
+ bool atEnd() const;
+ /**
+ @return data about the current tag
+ */
+ Tag currentTag() const;
+ /**
+ @return the token for the current tag
+ */
+ int currentToken() const;
+ /**
+ Moves position to the next tag.
+ */
+ void moveToNextTag();
+ /**
+ Ensures that an opening tag with the given token is read. If the current tag does not match,
+ writes out a warning and tries to recover by skipping tags until found (or until the current element would end).
+ If found, the position in the stream is afterwards moved to the next tag.
+ @return the matching found opening tag, or empty tag if not found
+ */
+ Tag ensureOpeningTag(int token);
+ /**
+ Tries to find an opening tag with the given token. Works similarly like ensureOpeningTag(),
+ but if a matching tag is not found, the position in the stream is not altered. The primary
+ use of this function is to check for optional elements.
+ @return the matching found opening tag, or empty tag if not found
+ */
+ Tag checkOpeningTag(int token);
+ /**
+ Ensures that a closing tag with the given token is read. Like ensureOpeningTag(),
+ if not, writes out a warning and tries to recover by skipping tags until found (or until the current element would end).
+ If found, the position in the stream is afterwards moved to the next tag.
+ */
+ void ensureClosingTag(int token);
+ /**
+ Tries to find the given token, until either found (returns true) or end of current element.
+ Position in the stream is set to make the tag current (i.e. it will be the next one read).
+ */
+ bool findTag(int token);
+ /**
+ Handle the current (unexpected) tag.
+ */
+ void handleUnexpectedTag();
+
+protected:
+ Tag checkTag(int token, bool optional);
+ bool findTagInternal(int token, bool silent);
+ void skipElementInternal(int token, bool silent);
+ std::vector<Tag> tags;
+ unsigned int pos;
+};
+
+/**
+ This class is used for creating XmlStream.
+
+ Simply use this class and then pass it as XmlStream to the consumer.
+
+ @since 3.5.0
+*/
+class OOX_DLLPUBLIC XmlStreamBuilder : public XmlStream
+{
+public:
+ void appendOpeningTag(int token,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& attributes
+ = css::uno::Reference<css::xml::sax::XFastAttributeList>());
+ void appendOpeningTag(int token, const AttributeList& attribs);
+ void appendClosingTag(int token);
+ // appends the characters after the last appended token
+ void appendCharacters(std::u16string_view characters);
+};
+
+inline OUString XmlStream::Tag::attribute(int t, const OUString& def) const
+{
+ return attributes.attribute(t, def);
+}
+
+inline bool XmlStream::Tag::attribute(int t, bool def) const
+{
+ return attributes.attribute(t, def);
+}
+
+inline sal_Unicode XmlStream::Tag::attribute(int t, sal_Unicode def) const
+{
+ return attributes.attribute(t, def);
+}
+
+} // namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axbinaryreader.hxx b/include/oox/ole/axbinaryreader.hxx
new file mode 100644
index 000000000..eb185f235
--- /dev/null
+++ b/include/oox/ole/axbinaryreader.hxx
@@ -0,0 +1,251 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_AXBINARYREADER_HXX
+#define INCLUDED_OOX_OLE_AXBINARYREADER_HXX
+
+#include <cstddef>
+#include <utility>
+#include <vector>
+
+#include <oox/helper/binaryinputstream.hxx>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/refvector.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox::ole { struct AxFontData; }
+
+namespace oox::ole {
+
+
+/** A wrapper for a binary input stream that supports aligned read operations.
+
+ The implementation does not support seeking back the wrapped stream. All
+ seeking operations (tell, seekTo, align) are performed relative to the
+ position of the wrapped stream at construction time of this wrapper. It is
+ possible to construct this wrapper with an unseekable input stream without
+ losing any functionality.
+ */
+class AxAlignedInputStream final : public BinaryInputStream
+{
+public:
+ explicit AxAlignedInputStream( BinaryInputStream& rInStrm );
+
+ /** Returns the size of the data this stream represents, if the wrapped
+ stream supports the size() operation. */
+ virtual sal_Int64 size() const override;
+ /** Return the current relative stream position (relative to position of
+ the wrapped stream at construction time). */
+ virtual sal_Int64 tell() const override;
+ /** Seeks the stream to the passed relative position, if it is behind the
+ current position. */
+ virtual void seek( sal_Int64 nPos ) override;
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close() override;
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+ /** Seeks the stream forward by the passed number of bytes. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+ /** Aligns the stream to a multiple of the passed size (relative to the
+ position of the wrapped stream at construction time). */
+ void align( size_t nSize );
+
+ /** Aligns the stream according to the passed type and reads a value. */
+ template< typename Type >
+ [[nodiscard]]
+ Type readAligned() { align( sizeof( Type ) ); return readValue< Type >(); }
+ /** Aligns the stream according to the passed type and skips the size of the type. */
+ template< typename Type >
+ void skipAligned() { align( sizeof( Type ) ); skip( sizeof( Type ) ); }
+
+private:
+ BinaryInputStream* mpInStrm; ///< The wrapped input stream.
+ sal_Int64 mnStrmPos; ///< Tracks relative position in the stream.
+ sal_Int64 mnStrmSize; ///< Size of the wrapped stream data.
+};
+
+
+/** A pair of integer values as a property. */
+typedef ::std::pair< sal_Int32, sal_Int32 > AxPairData;
+
+/** An array of string values as a property. */
+typedef ::std::vector< OUString > AxArrayString;
+
+
+/** Import helper to read simple and complex ActiveX form control properties
+ from a binary input stream. */
+class AxBinaryPropertyReader
+{
+public:
+ explicit AxBinaryPropertyReader( BinaryInputStream& rInStrm, bool b64BitPropFlags = false );
+
+ /** Reads the next integer property value from the stream, if the
+ respective flag in the property mask is set. */
+ template< typename StreamType, typename DataType >
+ void readIntProperty( DataType& ornValue )
+ { if( startNextProperty() ) ornValue = maInStrm.readAligned< StreamType >(); }
+ /** Reads the next boolean property value from the stream, if the
+ respective flag in the property mask is set. */
+ void readBoolProperty( bool& orbValue, bool bReverse = false );
+ /** Reads the next pair property from the stream, if the respective flag in
+ the property mask is set. */
+ void readPairProperty( AxPairData& orPairData );
+ /** Reads the next string property from the stream, if the respective flag
+ in the property mask is set. */
+ void readStringProperty( OUString& orValue );
+ /** Reads ArrayString, an array of fmString ( compressed or uncompressed )
+ is read from the stream and inserted into rStrings */
+ void readArrayStringProperty( std::vector< OUString >& rStrings );
+ /** Reads the next GUID property from the stream, if the respective flag
+ in the property mask is set. The GUID will be enclosed in braces. */
+ void readGuidProperty( OUString& orGuid );
+ /** Reads the next font property from the stream, if the respective flag in
+ the property mask is set. */
+ void readFontProperty( AxFontData& orFontData );
+ /** Reads the next picture property from the stream, if the respective flag
+ in the property mask is set. */
+ void readPictureProperty( StreamDataSequence& orPicData );
+
+ /** Skips the next integer property value in the stream, if the respective
+ flag in the property mask is set. */
+ template< typename StreamType >
+ void skipIntProperty() { if( startNextProperty() ) maInStrm.skipAligned< StreamType >(); }
+ /** Skips the next boolean property value in the stream, if the respective
+ flag in the property mask is set. */
+ void skipBoolProperty() { (void)startNextProperty(); }
+ /** Skips the next string property in the stream, if the respective flag in
+ the property mask is set. */
+ void skipStringProperty() { readStringProperty( maDummyString ); }
+ /** Skips the next ArrayString property in the stream, if the respective flag in
+ the property mask is set. */
+ void skipArrayStringProperty() { readArrayStringProperty( maDummyArrayString ); }
+ /** Skips the next GUID property in the stream, if the respective flag in
+ the property mask is set. */
+ void skipGuidProperty() { readGuidProperty( maDummyString ); }
+ /** Skips the next picture property in the stream, if the respective flag
+ in the property mask is set. */
+ void skipPictureProperty() { readPictureProperty( maDummyPicData ); }
+ /** Has to be called for undefined properties. If the respective flag in
+ the mask is set, the property import cannot be finished successfully. */
+ void skipUndefinedProperty() { ensureValid( !startNextProperty() ); }
+
+ /** Final processing, reads contents of all complex properties. */
+ bool finalizeImport();
+
+private:
+ bool ensureValid( bool bCondition = true );
+ bool startNextProperty();
+
+private:
+ /** Base class for complex properties such as string, point, size, GUID, picture. */
+ struct ComplexProperty
+ {
+ virtual ~ComplexProperty();
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) = 0;
+ };
+
+ /** Complex property for a 32-bit value pair, e.g. point or size. */
+ struct PairProperty final : public ComplexProperty
+ {
+ AxPairData& mrPairData;
+
+ explicit PairProperty( AxPairData& rPairData ) :
+ mrPairData( rPairData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ /** Complex property for a string value. */
+ struct StringProperty final : public ComplexProperty
+ {
+ OUString& mrValue;
+ sal_uInt32 mnSize;
+
+ explicit StringProperty( OUString& rValue, sal_uInt32 nSize ) :
+ mrValue( rValue ), mnSize( nSize ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ /** Complex property for an array of strings. */
+ struct ArrayStringProperty final : public ComplexProperty
+ {
+ AxArrayString& mrArray;
+ sal_uInt32 mnSize;
+ explicit ArrayStringProperty( AxArrayString& rArray, sal_uInt32 nSize ) :
+ mrArray( rArray ), mnSize( nSize ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ /** Complex property for a GUID value. */
+ struct GuidProperty final : public ComplexProperty
+ {
+ OUString& mrGuid;
+
+ explicit GuidProperty( OUString& rGuid ) :
+ mrGuid( rGuid ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ /** Stream property for a font structure. */
+ struct FontProperty final : public ComplexProperty
+ {
+ AxFontData& mrFontData;
+
+ explicit FontProperty( AxFontData& rFontData ) :
+ mrFontData( rFontData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ /** Stream property for a picture or mouse icon. */
+ struct PictureProperty final : public ComplexProperty
+ {
+ StreamDataSequence& mrPicData;
+
+ explicit PictureProperty( StreamDataSequence& rPicData ) :
+ mrPicData( rPicData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ typedef RefVector< ComplexProperty > ComplexPropVector;
+
+private:
+ AxAlignedInputStream maInStrm; ///< The input stream to read from.
+ ComplexPropVector maLargeProps; ///< Stores info for all used large properties.
+ ComplexPropVector maStreamProps; ///< Stores info for all used stream data properties.
+ StreamDataSequence maDummyPicData; ///< Dummy picture for unsupported properties.
+ OUString maDummyString; ///< Dummy string for unsupported properties.
+ AxArrayString maDummyArrayString; ///< Dummy strings for unsupported ArrayString properties.
+ sal_Int64 mnPropFlags; ///< Flags specifying existing properties.
+ sal_Int64 mnNextProp; ///< Next property to read.
+ sal_Int64 mnPropsEnd; ///< End position of simple/large properties.
+ bool mbValid; ///< True = stream still valid.
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axbinarywriter.hxx b/include/oox/ole/axbinarywriter.hxx
new file mode 100644
index 000000000..eb370473a
--- /dev/null
+++ b/include/oox/ole/axbinarywriter.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OOX_OLE_AXBINARYWRITER_HXX
+#define INCLUDED_OOX_OLE_AXBINARYWRITER_HXX
+
+#include <cstddef>
+#include <utility>
+
+#include <oox/helper/binaryoutputstream.hxx>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/refvector.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox::ole {
+
+
+/** A wrapper for a binary output stream that supports aligned write operations.
+
+ The implementation does support seeking back the wrapped stream. All
+ seeking operations (tell, seekTo, align) are performed relative to the
+ position of the wrapped stream at construction time of this wrapper.
+ Unlike it's reader class counterpart it is NOT possible to construct this
+ wrapper with an unseekable output stream.
+ */
+class AxAlignedOutputStream final : public BinaryOutputStream
+{
+public:
+ explicit AxAlignedOutputStream( BinaryOutputStream& rOutStrm );
+
+ /** Returns the size of the data this stream represents, if the wrapped
+ stream supports the size() operation. */
+ virtual sal_Int64 size() const override;
+ /** Return the current relative stream position (relative to position of
+ the wrapped stream at construction time). */
+ virtual sal_Int64 tell() const override;
+ /** Seeks the stream to the passed relative position, if it is behind the
+ current position. */
+ virtual void seek( sal_Int64 nPos ) override;
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close() override;
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual void writeData( const StreamDataSequence& orData, size_t nAtomSize = 1 ) override;
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+ /** Aligns the stream to a multiple of the passed size (relative to the
+ position of the wrapped stream at construction time). */
+ void align( size_t nSize );
+
+ void pad( sal_Int32 nBytes );
+
+ /** Aligns the stream according to the passed type and reads a value. */
+ template< typename Type >
+ void writeAligned( Type nVal ) { align( sizeof( Type ) ); writeValue( nVal ); }
+
+private:
+ BinaryOutputStream* mpOutStrm; ///< The wrapped input stream.
+ sal_Int64 mnStrmPos; ///< Tracks relative position in the stream.
+ sal_Int64 mnStrmSize; ///< Size of the wrapped stream data.
+ sal_Int64 mnWrappedBeginPos; ///< starting pos or wrapped stream
+};
+
+/** A pair of integer values as a property. */
+typedef ::std::pair< sal_Int32, sal_Int32 > AxPairData;
+
+/** Export helper to write simple and complex ActiveX form control properties
+ to a binary input stream. */
+class AxBinaryPropertyWriter
+{
+public:
+ explicit AxBinaryPropertyWriter( BinaryOutputStream& rOutStrm, bool b64BitPropFlags = false );
+
+ /** Write an integer property value to the stream, the
+ respective flag in the property mask is set. */
+ template< typename StreamType, typename DataType >
+ void writeIntProperty( DataType ornValue )
+ { startNextProperty(); maOutStrm.writeAligned< StreamType >( ornValue ); }
+ /** Write a boolean property value to the stream, the
+ respective flag in the property mask is set. */
+ void writeBoolProperty( bool orbValue );
+ /** Write a pair property the stream, the respective flag in
+ the property mask is set. */
+ void writePairProperty( AxPairData& orPairData );
+ /** Write a string property to the stream, the respective flag
+ in the property mask is set. */
+ void writeStringProperty( OUString& orValue );
+
+ /** Skips the next property clears the respective
+ flag in the property mask. */
+ void skipProperty() { startNextProperty( true ); }
+
+ /** Final processing, write contents of all complex properties, writes record size */
+ void finalizeExport();
+
+private:
+ bool ensureValid();
+ void startNextProperty( bool bSkip = false );
+
+private:
+ /** Base class for complex properties such as string, point, size, GUID, picture. */
+ struct ComplexProperty
+ {
+ virtual ~ComplexProperty();
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm ) = 0;
+ };
+
+ /** Complex property for a 32-bit value pair, e.g. point or size. */
+ struct PairProperty final : public ComplexProperty
+ {
+ AxPairData& mrPairData;
+
+ explicit PairProperty( AxPairData& rPairData ) :
+ mrPairData( rPairData ) {}
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm ) override;
+ };
+
+ /** Complex property for a string value. */
+ struct StringProperty final : public ComplexProperty
+ {
+ OUString& mrValue;
+ sal_uInt32 mnSize;
+
+ explicit StringProperty( OUString& rValue, sal_uInt32 nSize ) :
+ mrValue( rValue ), mnSize( nSize ) {}
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm ) override;
+ };
+
+ /** Stream property for a picture or mouse icon. */
+ struct PictureProperty final : public ComplexProperty
+ {
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm ) override;
+ };
+
+ typedef RefVector< ComplexProperty > ComplexPropVector;
+
+private:
+ AxAlignedOutputStream maOutStrm; ///< The input stream to read from.
+ ComplexPropVector maLargeProps; ///< Stores info for all used large properties.
+ ComplexPropVector maStreamProps; ///< Stores info for all used stream data properties.
+ sal_Int16 mnBlockSize;
+ sal_Int64 mnPropFlagsStart; ///< pos of Prop flags
+ sal_Int64 mnPropFlags; ///< Flags specifying existing properties.
+ sal_Int64 mnNextProp; ///< Next property to read.
+ bool mbValid; ///< True = stream still valid.
+ bool mb64BitPropFlags;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axcontrol.hxx b/include/oox/ole/axcontrol.hxx
new file mode 100644
index 000000000..f4fd7b6a7
--- /dev/null
+++ b/include/oox/ole/axcontrol.hxx
@@ -0,0 +1,993 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_AXCONTROL_HXX
+#define INCLUDED_OOX_OLE_AXCONTROL_HXX
+
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/propertyset.hxx>
+#include <oox/ole/axbinaryreader.hxx>
+#include <oox/ole/axfontdata.hxx>
+#include <oox/ole/olehelper.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace awt { class XControlModel; }
+ namespace container { class XIndexContainer; }
+ namespace drawing { class XDrawPage; }
+ namespace frame { class XModel; }
+ namespace form { class XFormsSupplier; }
+ namespace lang { class XMultiServiceFactory; }
+}
+
+namespace oox {
+ class BinaryInputStream;
+ class BinaryOutputStream;
+ class GraphicHelper;
+ class PropertyMap;
+}
+
+namespace oox::ole {
+
+
+#define COMCTL_GUID_SCROLLBAR_60 "{FE38753A-44A3-11D1-B5B7-0000C09000C4}"
+#define COMCTL_GUID_PROGRESSBAR_50 "{0713E8D2-850A-101B-AFC0-4210102A8DA7}"
+#define COMCTL_GUID_PROGRESSBAR_60 "{35053A22-8589-11D1-B16A-00C0F0283628}"
+
+const sal_uInt16 COMCTL_VERSION_50 = 5;
+const sal_uInt16 COMCTL_VERSION_60 = 6;
+
+
+#define AX_GUID_COMMANDBUTTON "{D7053240-CE69-11CD-a777-00dd01143c57}"
+#define AX_GUID_LABEL "{978C9E23-D4B0-11CE-bf2d-00aa003f40d0}"
+#define AX_GUID_IMAGE "{4C599241-6926-101B-9992-00000b65c6f9}"
+#define AX_GUID_TOGGLEBUTTON "{8BD21D60-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_CHECKBOX "{8BD21D40-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_OPTIONBUTTON "{8BD21D50-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_TEXTBOX "{8BD21D10-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_LISTBOX "{8BD21D20-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_COMBOBOX "{8BD21D30-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_SPINBUTTON "{79176FB0-B7F2-11CE-97ef-00aa006d2776}"
+#define AX_GUID_SCROLLBAR "{DFD181E0-5E2F-11CE-a449-00aa004a803d}"
+#define AX_GUID_FRAME "{6E182020-F460-11CE-9bcd-00aa00608e01}"
+
+// Html control GUID(s)
+
+#define HTML_GUID_SELECT "{5512D122-5CC6-11CF-8d67-00aa00bdce1d}"
+#define HTML_GUID_TEXTBOX "{5512D124-5CC6-11CF-8d67-00aa00bdce1d}"
+
+const sal_uInt32 AX_SYSCOLOR_WINDOWBACK = 0x80000005;
+const sal_uInt32 AX_SYSCOLOR_WINDOWFRAME = 0x80000006;
+const sal_uInt32 AX_SYSCOLOR_WINDOWTEXT = 0x80000008;
+const sal_uInt32 AX_SYSCOLOR_BUTTONFACE = 0x8000000F;
+const sal_uInt32 AX_SYSCOLOR_BUTTONTEXT = 0x80000012;
+
+const sal_uInt32 AX_FLAGS_ENABLED = 0x00000002;
+const sal_uInt32 AX_FLAGS_LOCKED = 0x00000004;
+const sal_uInt32 AX_FLAGS_OPAQUE = 0x00000008;
+const sal_uInt32 AX_FLAGS_COLUMNHEADS = 0x00000400;
+const sal_uInt32 AX_FLAGS_ENTIREROWS = 0x00000800;
+const sal_uInt32 AX_FLAGS_EXISTINGENTRIES = 0x00001000;
+const sal_uInt32 AX_FLAGS_CAPTIONLEFT = 0x00002000;
+const sal_uInt32 AX_FLAGS_EDITABLE = 0x00004000;
+const sal_uInt32 AX_FLAGS_IMEMODE_MASK = 0x00078000;
+const sal_uInt32 AX_FLAGS_DRAGENABLED = 0x00080000;
+const sal_uInt32 AX_FLAGS_ENTERASNEWLINE = 0x00100000;
+const sal_uInt32 AX_FLAGS_KEEPSELECTION = 0x00200000;
+const sal_uInt32 AX_FLAGS_TABASCHARACTER = 0x00400000;
+const sal_uInt32 AX_FLAGS_WORDWRAP = 0x00800000;
+const sal_uInt32 AX_FLAGS_BORDERSSUPPRESSED = 0x02000000;
+const sal_uInt32 AX_FLAGS_SELECTLINE = 0x04000000;
+const sal_uInt32 AX_FLAGS_SINGLECHARSELECT = 0x08000000;
+const sal_uInt32 AX_FLAGS_AUTOSIZE = 0x10000000;
+const sal_uInt32 AX_FLAGS_HIDESELECTION = 0x20000000;
+const sal_uInt32 AX_FLAGS_MAXLENAUTOTAB = 0x40000000;
+const sal_uInt32 AX_FLAGS_MULTILINE = 0x80000000;
+
+const sal_Int32 AX_BORDERSTYLE_NONE = 0;
+const sal_Int32 AX_BORDERSTYLE_SINGLE = 1;
+
+const sal_Int32 AX_SPECIALEFFECT_FLAT = 0;
+const sal_Int32 AX_SPECIALEFFECT_RAISED = 1;
+const sal_Int32 AX_SPECIALEFFECT_SUNKEN = 2;
+const sal_Int32 AX_SPECIALEFFECT_ETCHED = 3;
+const sal_Int32 AX_SPECIALEFFECT_BUMPED = 6;
+
+const sal_Int32 AX_PICSIZE_CLIP = 0;
+const sal_Int32 AX_PICSIZE_STRETCH = 1;
+const sal_Int32 AX_PICSIZE_ZOOM = 3;
+
+const sal_Int32 AX_PICALIGN_TOPLEFT = 0;
+const sal_Int32 AX_PICALIGN_TOPRIGHT = 1;
+const sal_Int32 AX_PICALIGN_CENTER = 2;
+const sal_Int32 AX_PICALIGN_BOTTOMLEFT = 3;
+const sal_Int32 AX_PICALIGN_BOTTOMRIGHT = 4;
+
+const sal_Int32 AX_DISPLAYSTYLE_TEXT = 1;
+const sal_Int32 AX_DISPLAYSTYLE_LISTBOX = 2;
+const sal_Int32 AX_DISPLAYSTYLE_COMBOBOX = 3;
+const sal_Int32 AX_DISPLAYSTYLE_CHECKBOX = 4;
+const sal_Int32 AX_DISPLAYSTYLE_OPTBUTTON = 5;
+const sal_Int32 AX_DISPLAYSTYLE_TOGGLE = 6;
+const sal_Int32 AX_DISPLAYSTYLE_DROPDOWN = 7;
+
+const sal_Int32 AX_SELECTION_SINGLE = 0;
+const sal_Int32 AX_SELECTION_MULTI = 1;
+const sal_Int32 AX_SELECTION_EXTENDED = 2;
+
+const sal_Int32 AX_SHOWDROPBUTTON_NEVER = 0;
+const sal_Int32 AX_SHOWDROPBUTTON_FOCUS = 1;
+const sal_Int32 AX_SHOWDROPBUTTON_ALWAYS = 2;
+
+const sal_Int32 AX_SCROLLBAR_NONE = 0x00;
+const sal_Int32 AX_SCROLLBAR_HORIZONTAL = 0x01;
+const sal_Int32 AX_SCROLLBAR_VERTICAL = 0x02;
+
+
+/** Enumerates all UNO API control types supported by these filters. */
+enum ApiControlType
+{
+ API_CONTROL_BUTTON,
+ API_CONTROL_FIXEDTEXT,
+ API_CONTROL_IMAGE,
+ API_CONTROL_CHECKBOX,
+ API_CONTROL_RADIOBUTTON,
+ API_CONTROL_EDIT,
+ API_CONTROL_NUMERIC,
+ API_CONTROL_LISTBOX,
+ API_CONTROL_COMBOBOX,
+ API_CONTROL_SPINBUTTON,
+ API_CONTROL_SCROLLBAR,
+ API_CONTROL_TABSTRIP, //11
+ API_CONTROL_PROGRESSBAR,
+ API_CONTROL_GROUPBOX,
+ API_CONTROL_FRAME, // 14
+ API_CONTROL_PAGE, // 15
+ API_CONTROL_MULTIPAGE, // 16
+ API_CONTROL_DIALOG // 17
+};
+
+
+/** Specifies how a form control supports transparent background. */
+enum class ApiTransparencyMode
+{
+ NotSupported, ///< Control does not support transparency.
+ Void, ///< Transparency is enabled by missing fill color.
+};
+
+/** Specifies how a form control supports the DefaultState property. */
+enum ApiDefaultStateMode
+{
+ API_DEFAULTSTATE_BOOLEAN, ///< Control does not support tri-state, state is given as boolean.
+ API_DEFAULTSTATE_SHORT, ///< Control does not support tri-state, state is given as short.
+ API_DEFAULTSTATE_TRISTATE ///< Control supports tri-state, state is given as short.
+};
+
+
+/** A base class with useful helper functions for something that is able to
+ convert ActiveX and ComCtl form controls.
+ */
+class OOX_DLLPUBLIC ControlConverter final
+{
+public:
+ explicit ControlConverter(
+ const css::uno::Reference< css::frame::XModel >& rxDocModel,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+ ~ControlConverter();
+
+ // Generic conversion -----------------------------------------------------
+
+ /** Converts the passed position in 1/100 mm to UNO properties. */
+ void convertPosition(
+ PropertyMap& rPropMap,
+ const AxPairData& rPos ) const;
+
+ /** Converts the passed size in 1/100 mm to UNO properties. */
+ void convertSize(
+ PropertyMap& rPropMap,
+ const AxPairData& rSize ) const;
+
+ /** Converts the passed encoded OLE color to UNO properties. */
+ void convertColor(
+ PropertyMap& rPropMap,
+ sal_Int32 nPropId,
+ sal_uInt32 nOleColor ) const;
+
+ static void convertToMSColor(
+ PropertySet const & rPropSet,
+ sal_Int32 nPropId,
+ sal_uInt32& nOleColor,
+ sal_uInt32 nDefault = 0 );
+
+
+ /** Converts the passed StdPic picture stream to UNO properties. */
+ void convertPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData ) const;
+
+ /** Converts the control orientation to UNO properties. */
+ static void convertOrientation(
+ PropertyMap& rPropMap,
+ bool bHorizontal );
+
+ static void convertToMSOrientation(
+ PropertySet const & rPropMap,
+ bool& bHorizontal );
+
+ /** Converts the vertical alignment to UNO properties. */
+ static void convertVerticalAlign(
+ PropertyMap& rPropMap,
+ sal_Int32 nVerticalAlign );
+
+ /** Converts common scrollbar settings to UNO properties. */
+ static void convertScrollBar(
+ PropertyMap& rPropMap,
+ sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
+ sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel );
+
+ /** Converts scrollability settings to UNO properties. */
+ void convertScrollabilitySettings(
+ PropertyMap& rPropMap,
+ const AxPairData& rScrollPos, const AxPairData& rScrollArea,
+ sal_Int32 nScrollBars ) const;
+
+ /** Binds the passed control model to the passed data sources. The
+ implementation will check which source types are supported. */
+ void bindToSources(
+ const css::uno::Reference< css::awt::XControlModel >& rxCtrlModel,
+ const OUString& rCtrlSource,
+ const OUString& rRowSource,
+ sal_Int32 nRefSheet = 0 ) const;
+
+ // ActiveX (Forms 2.0) specific conversion --------------------------------
+
+ /** Converts the Forms 2.0 background formatting to UNO properties. */
+ void convertAxBackground(
+ PropertyMap& rPropMap,
+ sal_uInt32 nBackColor,
+ sal_uInt32 nFlags,
+ ApiTransparencyMode eTranspMode ) const;
+
+ /** Converts the Forms 2.0 border formatting to UNO properties. */
+ void convertAxBorder(
+ PropertyMap& rPropMap,
+ sal_uInt32 nBorderColor,
+ sal_Int32 nBorderStyle,
+ sal_Int32 nSpecialEffect ) const;
+
+ static void convertToAxBorder(
+ PropertySet const & rPropSet,
+ sal_uInt32& nBorderColor,
+ sal_Int32& nBorderStyle,
+ sal_Int32& nSpecialEffect );
+
+ /** Converts the Forms 2.0 special effect to UNO properties. */
+ static void convertAxVisualEffect(
+ PropertyMap& rPropMap,
+ sal_Int32 nSpecialEffect );
+
+ static void convertToAxVisualEffect(
+ PropertySet const & rPropSet,
+ sal_Int32& nSpecialEffect );
+
+ /** Converts the passed picture stream and Forms 2.0 position to UNO
+ properties. */
+ void convertAxPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData,
+ sal_uInt32 nPicPos ) const;
+
+ /** Converts the passed picture stream and Forms 2.0 position to UNO
+ properties. */
+ void convertAxPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData,
+ sal_Int32 nPicSizeMode ) const;
+
+ /** Converts the Forms 2.0 value for checked/unchecked/dontknow to UNO
+ properties. */
+ static void convertAxState(
+ PropertyMap& rPropMap,
+ const OUString& rValue,
+ sal_Int32 nMultiSelect,
+ ApiDefaultStateMode eDefStateMode,
+ bool bAwtModel );
+
+ static void convertToAxState(
+ PropertySet const & rPropSet,
+ OUString& rValue,
+ sal_Int32& nMultiSelect,
+ ApiDefaultStateMode eDefStateMode );
+
+ /** Converts the Forms 2.0 control orientation to UNO properties. */
+ static void convertAxOrientation(
+ PropertyMap& rPropMap,
+ const AxPairData& rSize,
+ sal_Int32 nOrientation );
+
+ static void convertToAxOrientation(
+ PropertySet const & rPropSet,
+ sal_Int32& nOrientation );
+
+private:
+ css::uno::Reference< css::frame::XModel > mxDocModel;
+ const GraphicHelper& mrGraphicHelper;
+ mutable PropertySet maAddressConverter;
+ mutable PropertySet maRangeConverter;
+ bool mbDefaultColorBgr;
+};
+
+
+/** Base class for all models of form controls. */
+class OOX_DLLPUBLIC ControlModelBase
+{
+public:
+ explicit ControlModelBase();
+ virtual ~ControlModelBase();
+
+ /** Sets this control model to AWT model mode. */
+ void setAwtModelMode() { mbAwtModel = true; }
+ /** Sets this control model to form component mode. */
+ void setFormComponentMode() { mbAwtModel = false; }
+
+ /** Returns the UNO service name used to construct the AWT control model,
+ or the control form component. */
+ OUString getServiceName() const;
+
+ /** Derived classes set specific OOXML properties at the model structure. */
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ /** Derived classes set binary data (picture, mouse icon) at the model structure. */
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
+ /** Derived classes import a form control model from the passed input stream. */
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) = 0;
+ /** Derived classes export a form control model to the passed output stream. */
+ virtual void exportBinaryModel( BinaryOutputStream& /*rOutStrm*/ ) {}
+ /** Derived classes export CompObjStream contents. */
+ virtual void exportCompObj( BinaryOutputStream& /*rOutStrm*/ ) {}
+ /** Derived classes return the UNO control type enum value. */
+ virtual ApiControlType getControlType() const = 0;
+ /** Derived classes convert all control properties. */
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ /** Derived classes convert from uno control properties to equiv. MS values. */
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+
+ /** Converts the control size to UNO properties. */
+ void convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+public: // direct access needed for legacy VML drawing controls
+ AxPairData maSize; ///< Size of the control in 1/100 mm.
+
+protected:
+ bool mbAwtModel; ///< True = AWT control model, false = form component.
+};
+
+typedef std::shared_ptr< ControlModelBase > ControlModelRef;
+
+
+/** Base class for all models of ComCtl form controls. */
+class ComCtlModelBase : public ControlModelBase
+{
+public:
+ explicit ComCtlModelBase(
+ sal_uInt32 nDataPartId5, sal_uInt32 nDataPartId6, sal_uInt16 nVersion );
+
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+
+protected:
+ virtual void importControlData( BinaryInputStream& rInStrm ) = 0;
+
+private:
+ /** Returns the data part identifier according to the model version. */
+ sal_uInt32 getDataPartId() const;
+
+ static bool readPartHeader( BinaryInputStream& rInStrm,
+ sal_uInt32 nExpPartId,
+ sal_uInt16 nExpMajor = SAL_MAX_UINT16,
+ sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
+
+ bool importSizePart( BinaryInputStream& rInStrm );
+ bool importCommonPart( BinaryInputStream& rInStrm, sal_uInt32 nPartSize );
+ bool importComplexPart( BinaryInputStream& rInStrm );
+
+protected:
+ StdFontInfo maFontData; ///< Font formatting.
+ StreamDataSequence maMouseIcon; ///< Binary picture stream for mouse icon.
+ sal_uInt32 mnFlags; ///< Common flags for ComCtl controls.
+ const sal_uInt16 mnVersion; ///< Current version of the ComCtl control model.
+
+private:
+ sal_uInt32 mnDataPartId5; ///< Identifier for version 5.0 control data.
+ sal_uInt32 mnDataPartId6; ///< Identifier for version 6.0 control data.
+ bool mbCommonPart; ///< True = the COMCTL_COMMONDATA part exists.
+ bool mbComplexPart; ///< True = the COMCTL_COMPLEXDATA part exists.
+};
+
+
+/** Model for a ComCtl scroll bar. */
+class ComCtlScrollBarModel final : public ComCtlModelBase
+{
+public:
+ explicit ComCtlScrollBarModel( sal_uInt16 nVersion );
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+
+private:
+ virtual void importControlData( BinaryInputStream& rInStrm ) override;
+
+ sal_uInt32 mnScrollBarFlags; ///< Special flags for scroll bar model.
+ sal_Int32 mnLargeChange; ///< Increment step size (thumb).
+ sal_Int32 mnSmallChange; ///< Increment step size (buttons).
+ sal_Int32 mnMin; ///< Minimum of the value range.
+ sal_Int32 mnMax; ///< Maximum of the value range.
+ sal_Int32 mnPosition; ///< Value of the spin button.
+};
+
+
+/** Model for a ComCtl progress bar. */
+class ComCtlProgressBarModel final : public ComCtlModelBase
+{
+public:
+ explicit ComCtlProgressBarModel( sal_uInt16 nVersion );
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+
+private:
+ virtual void importControlData( BinaryInputStream& rInStrm ) override;
+
+ float mfMin; ///< Minimum of the value range.
+ float mfMax; ///< Maximum of the value range.
+ sal_uInt16 mnVertical; ///< 0 = horizontal, 1 = vertical.
+ sal_uInt16 mnSmooth; ///< 0 = progress blocks, 1 = pixel resolution.
+};
+
+
+/** Base class for all models of Form 2.0 form controls. */
+class OOX_DLLPUBLIC AxControlModelBase : public ControlModelBase
+{
+public:
+ explicit AxControlModelBase();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+};
+
+
+/** Base class for Forms 2.0 controls supporting text formatting. */
+class OOX_DLLPUBLIC AxFontDataModel : public AxControlModelBase
+{
+public:
+ explicit AxFontDataModel( bool bSupportsAlign = true );
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+
+ /** Returns the font height in points. */
+ sal_Int16 getFontHeight() const { return maFontData.getHeightPoints(); }
+
+public: // direct access needed for legacy VML drawing controls
+ AxFontData maFontData; ///< The font settings.
+
+private:
+ bool mbSupportsAlign; ///< True = UNO model supports Align property.
+};
+
+
+/** Model for a Forms 2.0 command button. */
+class OOX_DLLPUBLIC AxCommandButtonModel final : public AxFontDataModel
+{
+public:
+ explicit AxCommandButtonModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+
+public: // direct access needed for legacy VML drawing controls
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ OUString maCaption; ///< Visible caption of the button.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnPicturePos; ///< Position of the picture relative to text.
+ sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
+ bool mbFocusOnClick; ///< True = take focus on click.
+};
+
+
+/** Model for a Forms 2.0 label. */
+class OOX_DLLPUBLIC AxLabelModel final : public AxFontDataModel
+{
+public:
+ explicit AxLabelModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+
+public: // direct access needed for legacy VML drawing controls
+ OUString maCaption; ///< Visible caption of the button.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
+};
+
+
+/** Model for a Forms 2.0 image. */
+class OOX_DLLPUBLIC AxImageModel final : public AxControlModelBase
+{
+public:
+ explicit AxImageModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+
+private:
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnPicSizeMode; ///< Clip, stretch, zoom.
+ sal_Int32 mnPicAlign; ///< Anchor position of the picture.
+ bool mbPicTiling; ///< True = picture is repeated.
+};
+
+class OOX_DLLPUBLIC AxTabStripModel final : public AxFontDataModel
+{
+public:
+ explicit AxTabStripModel();
+
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+
+public:
+ sal_uInt32 mnListIndex;
+ sal_uInt32 mnTabStyle;
+ sal_uInt32 mnTabData;
+ sal_uInt32 mnVariousPropertyBits;
+ std::vector< OUString > maItems; // captions for each tab
+ std::vector< OUString > maTabNames; // names for each tab
+};
+
+
+/** Base class for a Forms 2.0 morph data control. */
+class OOX_DLLPUBLIC AxMorphDataModelBase : public AxFontDataModel
+{
+public:
+ explicit AxMorphDataModelBase();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+
+public: // direct access needed for legacy VML drawing controls
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ OUString maCaption; ///< Visible caption of the button.
+ OUString maValue; ///< Current value of the control.
+ OUString maGroupName; ///< Group name for option buttons.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnPicturePos; ///< Position of the picture relative to text.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnDisplayStyle; ///< Type of the morph control.
+ sal_Int32 mnMultiSelect; ///< Selection mode.
+ sal_Int32 mnScrollBars; ///< Horizontal/vertical scroll bar.
+ sal_Int32 mnMatchEntry; ///< Auto completion mode.
+ sal_Int32 mnShowDropButton; ///< When to show the dropdown button.
+ sal_Int32 mnMaxLength; ///< Maximum character count.
+ sal_Int32 mnPasswordChar; ///< Password character in edit fields.
+ sal_Int32 mnListRows; ///< Number of rows in dropdown box.
+ sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
+};
+
+
+/** Model for a Forms 2.0 toggle button. */
+class OOX_DLLPUBLIC AxToggleButtonModel final : public AxMorphDataModelBase
+{
+public:
+ explicit AxToggleButtonModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 check box. */
+class OOX_DLLPUBLIC AxCheckBoxModel final : public AxMorphDataModelBase
+{
+public:
+ explicit AxCheckBoxModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 option button. */
+class OOX_DLLPUBLIC AxOptionButtonModel final : public AxMorphDataModelBase
+{
+public:
+ explicit AxOptionButtonModel();
+
+ /** Returns the group name used to goup several option buttons together. */
+ const OUString& getGroupName() const { return maGroupName; }
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 text box. */
+class OOX_DLLPUBLIC AxTextBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxTextBoxModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a numeric field (legacy drawing controls only). */
+class OOX_DLLPUBLIC AxNumericFieldModel final : public AxMorphDataModelBase
+{
+public:
+ explicit AxNumericFieldModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 list box. */
+class OOX_DLLPUBLIC AxListBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxListBoxModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 combo box. */
+class OOX_DLLPUBLIC AxComboBoxModel final : public AxMorphDataModelBase
+{
+public:
+ explicit AxComboBoxModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 spin button. */
+class OOX_DLLPUBLIC AxSpinButtonModel final : public AxControlModelBase
+{
+public:
+ explicit AxSpinButtonModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+
+public: // direct access needed for legacy VML drawing controls
+ sal_uInt32 mnArrowColor; ///< Button arrow color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_Int32 mnOrientation; ///< Orientation of the buttons.
+ sal_Int32 mnMin; ///< Minimum of the value range.
+ sal_Int32 mnMax; ///< Maximum of the value range.
+ sal_Int32 mnPosition; ///< Value of the spin button.
+ sal_Int32 mnSmallChange; ///< Increment step size.
+ sal_Int32 mnDelay; ///< Repeat delay in milliseconds.
+};
+
+
+/** Model for a Forms 2.0 scroll bar. */
+class OOX_DLLPUBLIC AxScrollBarModel final : public AxControlModelBase
+{
+public:
+ explicit AxScrollBarModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+
+public: // direct access needed for legacy VML drawing controls
+ sal_uInt32 mnArrowColor; ///< Button arrow color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_Int32 mnOrientation; ///< Orientation of the buttons.
+ sal_Int32 mnPropThumb; ///< Proportional thumb size.
+ sal_Int32 mnMin; ///< Minimum of the value range.
+ sal_Int32 mnMax; ///< Maximum of the value range.
+ sal_Int32 mnPosition; ///< Value of the spin button.
+ sal_Int32 mnSmallChange; ///< Increment step size (buttons).
+ sal_Int32 mnLargeChange; ///< Increment step size (thumb).
+ sal_Int32 mnDelay; ///< Repeat delay in milliseconds.
+};
+
+
+typedef ::std::vector< OUString > AxClassTable;
+
+/** Base class for ActiveX container controls. */
+class OOX_DLLPUBLIC AxContainerModelBase : public AxFontDataModel
+{
+public:
+ explicit AxContainerModelBase( bool bFontSupport = false );
+
+ /** Allows to set single properties specified by XML token identifier. */
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ /** Reads the leading structure in the 'f' stream containing the model for
+ this control. */
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ /** Converts font settings if supported. */
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+
+ /** Reads the class table structure for embedded controls following the own
+ model from the 'f' stream. */
+ bool importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable );
+
+public: // direct access needed for legacy VML drawing controls
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ OUString maCaption; ///< Visible caption of the form.
+ AxPairData maLogicalSize; ///< Logical form size (scroll area).
+ AxPairData maScrollPos; ///< Scroll position.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnScrollBars; ///< Horizontal/vertical scroll bar.
+ sal_Int32 mnCycleType; ///< Cycle in all forms or in this form.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnPicAlign; ///< Anchor position of the picture.
+ sal_Int32 mnPicSizeMode; ///< Clip, stretch, zoom.
+ bool mbPicTiling; ///< True = picture is repeated.
+ bool mbFontSupport; ///< True = control supports the font property.
+};
+
+
+/** Model for a Forms 2.0 frame control. */
+class OOX_DLLPUBLIC AxFrameModel final : public AxContainerModelBase
+{
+public:
+ explicit AxFrameModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+};
+
+class OOX_DLLPUBLIC AxPageModel final : public AxContainerModelBase
+{
+public:
+ explicit AxPageModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+};
+
+class OOX_DLLPUBLIC AxMultiPageModel final : public AxContainerModelBase
+{
+public:
+ explicit AxMultiPageModel();
+
+ virtual ApiControlType getControlType() const override;
+ void importPageAndMultiPageProperties( BinaryInputStream& rInStrm, sal_Int32 nPages );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ std::vector<sal_uInt32> mnIDs;
+ sal_uInt32 mnActiveTab;
+ sal_uInt32 mnTabStyle;
+};
+
+
+/** Model for a Forms 2.0 user form. */
+class OOX_DLLPUBLIC AxUserFormModel final : public AxContainerModelBase
+{
+public:
+ explicit AxUserFormModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+};
+
+class HtmlSelectModel final : public AxListBoxModel
+{
+ css::uno::Sequence< OUString > msListData;
+ css::uno::Sequence< sal_Int16 > msIndices;
+public:
+ HtmlSelectModel();
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+};
+
+class HtmlTextBoxModel final : public AxTextBoxModel
+{
+public:
+ explicit HtmlTextBoxModel();
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+};
+
+
+/** A form control embedded in a document draw page. Contains a specific model
+ structure according to the type of the control. */
+class OOX_DLLPUBLIC EmbeddedControl
+{
+public:
+ explicit EmbeddedControl( const OUString& rName );
+
+ /** Creates and returns the internal control model of the specified type. */
+ template< typename ModelType >
+ inline ModelType& createModel();
+
+ /** Creates and returns the internal control model of the specified type. */
+ template< typename ModelType, typename ParamType >
+ inline ModelType& createModel( const ParamType& rParam );
+
+ /** Creates and returns the internal control model according to the passed
+ MS class identifier. */
+ ControlModelBase* createModelFromGuid( std::u16string_view rClassId );
+
+ /** Returns true, if the internal control model exists. */
+ bool hasModel() const { return bool(mxModel); }
+ /** Returns read-only access to the internal control model. */
+ const ControlModelBase* getModel() const { return mxModel.get(); }
+ /** Returns read/write access to the internal control model. */
+ ControlModelBase* getModel() { return mxModel.get(); }
+
+ /** Returns the UNO service name needed to construct the control model. */
+ OUString getServiceName() const;
+
+ /** Converts all control properties and inserts them into the passed model. */
+ bool convertProperties(
+ const css::uno::Reference< css::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv ) const;
+
+ void convertFromProperties(
+ const css::uno::Reference< css::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv );
+
+private:
+ ControlModelRef mxModel; ///< Control model containing the properties.
+ OUString maName; ///< Name of the control.
+};
+
+
+template< typename ModelType >
+inline ModelType& EmbeddedControl::createModel()
+{
+ auto xModel = std::make_shared<ModelType>();
+ mxModel = xModel;
+ xModel->setFormComponentMode();
+ return *xModel;
+}
+
+template< typename ModelType, typename ParamType >
+inline ModelType& EmbeddedControl::createModel( const ParamType& rParam )
+{
+ auto xModel = std::make_shared<ModelType>( rParam );
+ mxModel = xModel;
+ xModel->setFormComponentMode();
+ return *xModel;
+}
+
+
+/** A wrapper for a control form embedded directly in a draw page. */
+class EmbeddedForm
+{
+public:
+ explicit EmbeddedForm(
+ const css::uno::Reference< css::frame::XModel >& rxDocModel,
+ const css::uno::Reference< css::drawing::XDrawPage >& rxDrawPage,
+ const GraphicHelper& rGraphicHelper );
+
+ /** Converts the passed control and inserts the control model into the form.
+ @return The API control model, if conversion was successful. */
+ css::uno::Reference< css::awt::XControlModel >
+ convertAndInsert( const EmbeddedControl& rControl, sal_Int32& rnCtrlIndex );
+
+ /** Returns the XIndexContainer interface of the UNO control form, if existing. */
+ const css::uno::Reference< css::container::XIndexContainer >&
+ getXForm() const { return mxFormIC; }
+
+private:
+ /** Creates the form that will hold the form controls. */
+ css::uno::Reference< css::container::XIndexContainer > const &
+ createXForm();
+
+private:
+ ControlConverter maControlConv;
+ css::uno::Reference< css::lang::XMultiServiceFactory > mxModelFactory;
+ css::uno::Reference< css::form::XFormsSupplier > mxFormsSupp;
+ css::uno::Reference< css::container::XIndexContainer > mxFormIC;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axcontrolfragment.hxx b/include/oox/ole/axcontrolfragment.hxx
new file mode 100644
index 000000000..e6b87b416
--- /dev/null
+++ b/include/oox/ole/axcontrolfragment.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_AXCONTROLFRAGMENT_HXX
+#define INCLUDED_OOX_OLE_AXCONTROLFRAGMENT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/contexthandler2.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+namespace oox::core { class XmlFilterBase; }
+
+namespace oox::ole {
+
+class ControlModelBase;
+class EmbeddedControl;
+
+
+/** Context handler for ActiveX form control model properties. */
+class AxControlPropertyContext final : public ::oox::core::ContextHandler2
+{
+public:
+ explicit AxControlPropertyContext(
+ ::oox::core::FragmentHandler2 const & rFragment,
+ ControlModelBase& rModel );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+
+private:
+ ControlModelBase& mrModel;
+ sal_Int32 mnPropId; ///< Identifier of currently processed property.
+};
+
+
+/** Fragment handler for an embedded ActiveX form control fragment. */
+class AxControlFragment final : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit AxControlFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ EmbeddedControl& rControl );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+
+private:
+ EmbeddedControl& mrControl;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axfontdata.hxx b/include/oox/ole/axfontdata.hxx
new file mode 100644
index 000000000..df3503247
--- /dev/null
+++ b/include/oox/ole/axfontdata.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_AXFONTDATA_HXX
+#define INCLUDED_OOX_OLE_AXFONTDATA_HXX
+
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace oox {
+ class BinaryInputStream;
+ class BinaryOutputStream;
+}
+
+enum class AxFontFlags {
+ NONE = 0x00000000,
+ Bold = 0x00000001,
+ Italic = 0x00000002,
+ Underline = 0x00000004,
+ Strikeout = 0x00000008,
+ Disabled = 0x00002000,
+ AutoColor = 0x40000000,
+};
+namespace o3tl {
+ template<> struct typed_flags<AxFontFlags> : is_typed_flags<AxFontFlags, 0x4000200f> {};
+}
+
+namespace oox::ole {
+
+enum class AxHorizontalAlign {
+ Left = 1, Right = 2, Center = 3
+};
+
+/** All entries of a font property. */
+struct OOX_DLLPUBLIC AxFontData
+{
+ OUString maFontName; ///< Name of the used font.
+ AxFontFlags mnFontEffects; ///< Font effect flags.
+ sal_Int32 mnFontHeight; ///< Height of the font (not really twips, see code).
+ sal_Int32 mnFontCharSet; ///< Windows character set of the font.
+ AxHorizontalAlign mnHorAlign; ///< Horizontal text alignment.
+ bool mbDblUnderline; ///< True = double underline style (legacy VML drawing controls only).
+
+ explicit AxFontData();
+
+ /** Converts the internal representation of the font height to points. */
+ sal_Int16 getHeightPoints() const;
+ /** Converts the passed font height from points to the internal representation. */
+ void setHeightPoints( sal_Int16 nPoints );
+
+ /** Reads the font data settings from the passed input stream. */
+ bool importBinaryModel( BinaryInputStream& rInStrm );
+
+ void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ /** Reads the font data settings from the passed input stream that contains
+ an OLE StdFont structure. */
+ bool importStdFont( BinaryInputStream& rInStrm );
+ /** Reads the font data settings from the passed input stream depending on
+ the GUID preceding the actual font data. */
+ bool importGuidAndFont( BinaryInputStream& rInStrm );
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/olehelper.hxx b/include/oox/ole/olehelper.hxx
new file mode 100644
index 000000000..e01e60257
--- /dev/null
+++ b/include/oox/ole/olehelper.hxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_OLEHELPER_HXX
+#define INCLUDED_OOX_OLE_OLEHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <filter/msfilter/msocximex.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/graphichelper.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/ref.hxx>
+#include <memory>
+
+namespace com::sun::star {
+ namespace awt { class XControlModel; }
+ namespace awt { struct Size; }
+ namespace form { class XFormComponent; }
+ namespace frame { class XModel; }
+ namespace io { class XOutputStream; }
+ namespace uno { class XComponentContext; }
+}
+
+class SotStorage;
+class SotStorageStream;
+class SvGlobalName;
+
+namespace oox {
+ class BinaryInputStream;
+ class BinaryOutputStream;
+}
+
+namespace oox::ole {
+ class ControlModelBase;
+ class EmbeddedControl;
+
+
+#define OLE_GUID_STDFONT "{0BE35203-8F91-11CE-9DE3-00AA004BB851}"
+#define OLE_GUID_STDPIC "{0BE35204-8F91-11CE-9DE3-00AA004BB851}"
+
+
+const sal_uInt16 OLE_STDFONT_NORMAL = 400;
+const sal_uInt16 OLE_STDFONT_BOLD = 700;
+
+const sal_uInt8 OLE_STDFONT_ITALIC = 0x02;
+const sal_uInt8 OLE_STDFONT_UNDERLINE = 0x04;
+const sal_uInt8 OLE_STDFONT_STRIKE = 0x08;
+
+/** Stores data about a StdFont font structure. */
+struct StdFontInfo
+{
+ OUString maName; ///< Font name.
+ sal_uInt32 mnHeight; ///< Font height (1/10,000 points).
+ sal_uInt16 mnWeight; ///< Font weight (normal/bold).
+ sal_uInt16 mnCharSet; ///< Font charset.
+ sal_uInt8 mnFlags; ///< Font flags.
+
+ explicit StdFontInfo();
+ explicit StdFontInfo(
+ const OUString& rName,
+ sal_uInt32 nHeight );
+};
+
+
+/** Stores data about a StdHlink hyperlink. */
+struct StdHlinkInfo
+{
+ OUString maTarget;
+ OUString maLocation;
+ OUString maDisplay;
+};
+
+
+/** Static helper functions for OLE import/export. */
+namespace OleHelper
+{
+ /** Returns the UNO RGB color from the passed encoded OLE color.
+
+ @param bDefaultColorBgr
+ True = OLE default color type is treated as BGR color.
+ False = OLE default color type is treated as palette color.
+ */
+ OOX_DLLPUBLIC ::Color decodeOleColor(
+ const GraphicHelper& rGraphicHelper,
+ sal_uInt32 nOleColor,
+ bool bDefaultColorBgr );
+
+ /** Returns the OLE color from the passed UNO RGB color.
+ */
+ OOX_DLLPUBLIC sal_uInt32 encodeOleColor( sal_Int32 nRgbColor );
+ inline sal_uInt32 encodeOleColor( Color nRgbColor ) { return encodeOleColor(sal_Int32(nRgbColor)); }
+
+ /** Imports a GUID from the passed binary stream and returns its string
+ representation (in uppercase characters).
+ */
+ OOX_DLLPUBLIC OUString importGuid( BinaryInputStream& rInStrm );
+ OOX_DLLPUBLIC void exportGuid( BinaryOutputStream& rOutStrm, const SvGlobalName& rId );
+
+ /** Imports an OLE StdFont font structure from the current position of the
+ passed binary stream.
+ */
+ OOX_DLLPUBLIC bool importStdFont(
+ StdFontInfo& orFontInfo,
+ BinaryInputStream& rInStrm,
+ bool bWithGuid );
+
+ /** Imports an OLE StdPic picture from the current position of the passed
+ binary stream.
+ */
+ OOX_DLLPUBLIC bool importStdPic(
+ StreamDataSequence& orGraphicData,
+ BinaryInputStream& rInStrm );
+}
+
+class OOX_DLLPUBLIC OleFormCtrlExportHelper final
+{
+ std::unique_ptr<::oox::ole::EmbeddedControl> mpControl;
+ ::oox::ole::ControlModelBase* mpModel;
+ ::oox::GraphicHelper maGrfHelper;
+ css::uno::Reference< css::frame::XModel > mxDocModel;
+ css::uno::Reference< css::awt::XControlModel > mxControlModel;
+
+ OUString maName;
+ OUString maTypeName;
+ OUString maFullName;
+ OUString maGUID;
+public:
+ OleFormCtrlExportHelper( const css::uno::Reference< css::uno::XComponentContext >& rxCtx, const css::uno::Reference< css::frame::XModel >& xDocModel, const css::uno::Reference< css::awt::XControlModel >& xModel );
+ ~OleFormCtrlExportHelper();
+
+ std::u16string_view getGUID() const
+ {
+ std::u16string_view sResult;
+ if ( maGUID.getLength() > 2 )
+ sResult = maGUID.subView(1, maGUID.getLength() - 2 );
+ return sResult;
+ }
+ const OUString& getFullName() const { return maFullName; }
+ const OUString& getTypeName() const { return maTypeName; }
+ const OUString& getName() const { return maName; }
+ bool isValid() const { return mpModel != nullptr; }
+ void exportName( const css::uno::Reference< css::io::XOutputStream >& rxOut );
+ void exportCompObj( const css::uno::Reference< css::io::XOutputStream >& rxOut );
+ void exportControl( const css::uno::Reference< css::io::XOutputStream >& rxOut, const css::awt::Size& rSize, bool bAutoClose = false );
+};
+
+// ideally it would be great to get rid of SvxMSConvertOCXControls
+// however msfilter/source/msfilter/svdfppt.cxx still uses
+// SvxMSConvertOCXControls as a base class, unfortunately oox depends on
+// msfilter. Probably the solution would be to move the svdfppt.cxx
+// implementation into the sd module itself.
+class OOX_DLLPUBLIC MSConvertOCXControls : public SvxMSConvertOCXControls
+{
+protected:
+ css::uno::Reference< css::uno::XComponentContext > mxCtx;
+ ::oox::GraphicHelper maGrfHelper;
+
+ bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
+ css::uno::Reference< css::form::XFormComponent > & rxFormComp,
+ std::u16string_view rGuidString );
+ bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
+ css::uno::Reference< css::form::XFormComponent > & rxFormComp,
+ const OUString& rGuidString,
+ sal_Int32 nSize );
+public:
+ MSConvertOCXControls( const css::uno::Reference< css::frame::XModel >& rxModel );
+ virtual ~MSConvertOCXControls() override;
+ bool ReadOCXStorage( tools::SvRef<SotStorage> const & rSrc1, css::uno::Reference< css::form::XFormComponent > & rxFormComp );
+ bool ReadOCXCtlsStream(tools::SvRef<SotStorageStream> const & rSrc1, css::uno::Reference< css::form::XFormComponent > & rxFormComp,
+ sal_Int32 nPos, sal_Int32 nSize );
+ static bool WriteOCXStream( const css::uno::Reference< css::frame::XModel >& rxModel, tools::SvRef<SotStorage> const &rSrc1, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size& rSize,OUString &rName);
+ static bool WriteOCXExcelKludgeStream( const css::uno::Reference< css::frame::XModel >& rxModel, const css::uno::Reference< css::io::XOutputStream >& xOutStrm, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size& rSize,OUString &rName);
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/oleobjecthelper.hxx b/include/oox/ole/oleobjecthelper.hxx
new file mode 100644
index 000000000..5b792f204
--- /dev/null
+++ b/include/oox/ole/oleobjecthelper.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_OLEOBJECTHELPER_HXX
+#define INCLUDED_OOX_OLE_OLEOBJECTHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/binarystreambase.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace awt { struct Size; }
+ namespace document { class XEmbeddedObjectResolver; }
+ namespace frame { class XModel; }
+ namespace lang { class XMultiServiceFactory; }
+}
+
+namespace oox { class PropertyMap; }
+
+namespace oox::ole {
+
+
+/** Contains generic information about an OLE object. */
+struct OleObjectInfo
+{
+ StreamDataSequence maEmbeddedData; ///< Data of an embedded OLE object.
+ OUString maTargetLink; ///< Path to external data for linked OLE object.
+ OUString maProgId;
+ bool mbLinked; ///< True = linked OLE object, false = embedded OLE object.
+ bool mbShowAsIcon; ///< True = show as icon, false = show contents.
+ bool mbAutoUpdate;
+ bool mbHasPicture; ///<Ole object requires a picture element according to spec.>
+
+ explicit OleObjectInfo();
+};
+
+
+/** Helper for OLE object handling. */
+class OleObjectHelper
+{
+public:
+ explicit OleObjectHelper(
+ const css::uno::Reference<css::lang::XMultiServiceFactory>& rxModelFactory,
+ const css::uno::Reference<css::frame::XModel>& xModel);
+ ~OleObjectHelper();
+
+ bool importOleObject(
+ PropertyMap& rPropMap,
+ const OleObjectInfo& rOleObject,
+ const css::awt::Size& rObjSize );
+
+private:
+ css::uno::Reference<css::frame::XModel> m_xModel;
+ css::uno::Reference< css::document::XEmbeddedObjectResolver > mxResolver;
+ sal_Int32 mnObjectId;
+};
+
+
+OOX_DLLPUBLIC void SaveInteropProperties(
+ css::uno::Reference<css::frame::XModel> const& xModel,
+ OUString const& rObjectName, OUString const* pOldObjectName,
+ OUString const& rProgId);
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/olestorage.hxx b/include/oox/ole/olestorage.hxx
new file mode 100644
index 000000000..b7ac512f1
--- /dev/null
+++ b/include/oox/ole/olestorage.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_OLESTORAGE_HXX
+#define INCLUDED_OOX_OLE_OLESTORAGE_HXX
+
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/storagebase.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star {
+ namespace container { class XNameContainer; }
+ namespace embed { class XStorage; }
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XStream; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox::ole {
+
+
+/** Implements stream access for binary OLE storages. */
+class OOX_DLLPUBLIC OleStorage final : public StorageBase
+{
+public:
+ explicit OleStorage(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XInputStream >& rxInStream,
+ bool bBaseStreamAccess );
+
+ explicit OleStorage(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XStream >& rxOutStream,
+ bool bBaseStreamAccess );
+
+ virtual ~OleStorage() override;
+
+private:
+ explicit OleStorage(
+ const OleStorage& rParentStorage,
+ const css::uno::Reference< css::container::XNameContainer >& rxStorage,
+ const OUString& rElementName,
+ bool bReadOnly );
+ explicit OleStorage(
+ const OleStorage& rParentStorage,
+ const css::uno::Reference< css::io::XStream >& rxOutStream,
+ const OUString& rElementName );
+
+ /** Initializes the API storage object for input. */
+ void initStorage( const css::uno::Reference< css::io::XInputStream >& rxInStream );
+ /** Initializes the API storage object for input/output. */
+ void initStorage( const css::uno::Reference< css::io::XStream >& rxOutStream );
+
+ /** Returns true, if the object represents a valid storage. */
+ virtual bool implIsStorage() const override;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage.
+
+ @attention
+ This function is not implemented for binary OLE storages.
+ */
+ virtual css::uno::Reference< css::embed::XStorage >
+ implGetXStorage() const override;
+
+ /** Returns the names of all elements of this storage. */
+ virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const override;
+
+ /** Opens and returns the specified sub storage from the storage. */
+ virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreateMissing ) override;
+
+ /** Opens and returns the specified input stream from the storage. */
+ virtual css::uno::Reference< css::io::XInputStream >
+ implOpenInputStream( const OUString& rElementName ) override;
+
+ /** Opens and returns the specified output stream from the storage. */
+ virtual css::uno::Reference< css::io::XOutputStream >
+ implOpenOutputStream( const OUString& rElementName ) override;
+
+ /** Commits the current storage. */
+ virtual void implCommit() const override;
+
+private:
+ css::uno::Reference< css::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ css::uno::Reference< css::container::XNameContainer >
+ mxStorage; ///< Access to elements of this sub storage.
+ const OleStorage* mpParentStorage; ///< Parent OLE storage that contains this storage.
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbacontrol.hxx b/include/oox/ole/vbacontrol.hxx
new file mode 100644
index 000000000..c0afd6ae7
--- /dev/null
+++ b/include/oox/ole/vbacontrol.hxx
@@ -0,0 +1,214 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBACONTROL_HXX
+#define INCLUDED_OOX_OLE_VBACONTROL_HXX
+
+#include <memory>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/helper/refvector.hxx>
+#include <oox/ole/axbinaryreader.hxx>
+#include <oox/ole/axcontrol.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace awt { class XControlModel; }
+ namespace container { class XNameContainer; }
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox {
+ class BinaryInputStream;
+ class GraphicHelper;
+ class PropertyMap;
+ class StorageBase;
+}
+
+namespace oox::ole {
+
+
+/** Common properties for all controls that are part of a VBA user form or of
+ another container control in a VBA user form. */
+class VbaSiteModel final
+{
+public:
+ explicit VbaSiteModel();
+ ~VbaSiteModel();
+
+ /** Allows to set single properties specified by XML token identifier. */
+ void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ /** Imports the site model data from the passed input stream. */
+ bool importBinaryModel( BinaryInputStream& rInStrm );
+ /** Moves the control relative to its current position by the passed distance. */
+ void moveRelative( const AxPairData& rDistance );
+
+ /** Returns the programmatical name of the control. */
+ const OUString& getName() const { return maName; }
+ /** Returns the position of the control in its parent. */
+ const AxPairData& getPosition() const { return maPos; }
+ /** Returns the unique identifier of this control. */
+ sal_Int32 getId() const { return mnId; }
+ /** Returns true, if this control is a container control. */
+ bool isContainer() const;
+ /** Returns the length of the stream data for stream based controls. */
+ sal_uInt32 getStreamLength() const;
+ /** Returns the name of the substorage for the container control data. */
+ OUString getSubStorageName() const;
+ /** Returns the tab index of the control. */
+ sal_Int16 getTabIndex() const { return mnTabIndex; }
+
+ /** Tries to create the control model according to the site model. */
+ ControlModelRef createControlModel( const AxClassTable& rClassTable ) const;
+ /** Converts all form site properties. */
+ void convertProperties(
+ PropertyMap& rPropMap,
+ const ControlConverter& rConv,
+ ApiControlType eCtrlType,
+ sal_Int32 nCtrlIndex ) const;
+ const OUString& getControlSource() const { return maControlSource; }
+ const OUString& getRowSource() const { return maRowSource; }
+private:
+ OUString maName; ///< Name of the control.
+ OUString maTag; ///< User defined tag.
+ OUString maToolTip; ///< Tool tip for the control.
+ OUString maControlSource; ///< Linked cell for the control value in a spreadsheet.
+ OUString maRowSource; ///< Source data for the control in a spreadsheet.
+
+ AxPairData maPos; ///< Position in parent container.
+ sal_Int32 mnId; ///< Control identifier.
+ sal_Int32 mnHelpContextId; ///< Help context identifier.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnStreamLen; ///< Size of control stream data.
+ sal_Int16 mnTabIndex; ///< Tab order index.
+ sal_uInt16 mnClassIdOrCache; ///< Class name identifier or GUID cache index.
+ sal_uInt16 mnGroupId; ///< Group identifier for grouped controls.
+};
+
+typedef std::shared_ptr< VbaSiteModel > VbaSiteModelRef;
+
+
+/** A control that is embedded in a VBA user form or in another container
+ control in a VBA user form.
+
+ The control may be a 'simple' control with its data stored in the 'o'
+ stream, or it may be a container control with its data stored in an own
+ substorage.
+ */
+class VbaFormControl
+{
+public:
+ explicit VbaFormControl();
+ virtual ~VbaFormControl();
+
+ /** Imports the model from the passed stream or storage, depending on the
+ control's type. Imports all embedded controls, if this is a container. */
+ void importModelOrStorage(
+ BinaryInputStream& rInStrm,
+ StorageBase& rStrg,
+ const AxClassTable& rClassTable );
+
+ /** Returns the programmatical name of the control. */
+ OUString getControlName() const;
+
+ /** Creates the UNO control model, inserts it into the passed container,
+ and converts all control properties. */
+ void createAndConvert(
+ sal_Int32 nCtrlIndex,
+ const css::uno::Reference< css::container::XNameContainer >& rxParentNC,
+ const ControlConverter& rConv ) const;
+
+protected:
+ /** Creates and imports the control model containing properties of the control. */
+ void importControlModel( BinaryInputStream& rInStrm, const AxClassTable& rClassTable );
+ /** Creates and imports the control model, and imports all embedded
+ controls from the passed substorage. */
+ void importStorage( StorageBase& rStrg, const AxClassTable& rClassTable );
+
+ /** Converts all control properties, and inserts and converts embedded controls. */
+ bool convertProperties(
+ const css::uno::Reference< css::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv,
+ sal_Int32 nCtrlIndex ) const;
+
+private:
+ typedef RefVector< VbaFormControl > VbaFormControlVector;
+ typedef VbaFormControlVector::value_type VbaFormControlRef;
+
+ /** Creates the control model according to the current site model. */
+ void createControlModel( const AxClassTable& rClassTable );
+ /** Imports the site model data containing common properties of the control. */
+ bool importSiteModel( BinaryInputStream& rInStrm );
+
+ /** Imports the site models of all embedded controls from the 'f' stream. */
+ void importEmbeddedSiteModels( BinaryInputStream& rInStrm );
+ /* Final processing of all embedded controls after import. */
+ void finalizeEmbeddedControls();
+
+ /** Moves the control relative to its current position by the passed distance. */
+ void moveRelative( const AxPairData& rDistance );
+ /** Moves all embedded controls from their relative position in this
+ control to an absolute position in the parent of this control. */
+ void moveEmbeddedToAbsoluteParent();
+
+ /** Functor for comparing controls by their tab index. */
+ static bool compareByTabIndex( const VbaFormControlRef& rxLeft, const VbaFormControlRef& rxRight );
+
+protected:
+ VbaSiteModelRef mxSiteModel; ///< Common control properties.
+ ControlModelRef mxCtrlModel; ///< Specific control properties.
+
+private:
+ VbaFormControlVector maControls; ///< All embedded form controls.
+ AxClassTable maClassTable; ///< Class identifiers for exotic embedded controls.
+};
+
+
+class VbaUserForm final : public VbaFormControl
+{
+public:
+ explicit VbaUserForm(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XModel >& rxDocModel,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr );
+
+ /** Imports the form and its embedded controls, and inserts the form with
+ all its controls into the passed dialog library. */
+ void importForm(
+ const css::uno::Reference< css::container::XNameContainer >& rxDialogLib,
+ StorageBase& rVbaFormStrg,
+ const OUString& rModuleName,
+ rtl_TextEncoding eTextEnc );
+
+private:
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ css::uno::Reference< css::frame::XModel > mxDocModel;
+ ControlConverter maConverter;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbaexport.hxx b/include/oox/ole/vbaexport.hxx
new file mode 100644
index 000000000..04d9f7512
--- /dev/null
+++ b/include/oox/ole/vbaexport.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBAEXPORT_HXX
+#define INCLUDED_OOX_OLE_VBAEXPORT_HXX
+
+#include <cstddef>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+class SotStorage;
+class SvStream;
+class SvMemoryStream;
+
+namespace com::sun::star {
+ namespace container { class XNameContainer; }
+ namespace frame { class XModel; }
+ namespace script { class XLibraryContainer; }
+}
+
+class OOX_DLLPUBLIC VbaExport
+{
+public:
+ VbaExport(css::uno::Reference<css::frame::XModel> const & xModel);
+
+ void exportVBA(SotStorage* pRootStorage);
+
+ bool containsVBAProject();
+
+private:
+
+ css::uno::Reference<css::container::XNameContainer>
+ getBasicLibrary() const;
+
+ css::uno::Reference<css::script::XLibraryContainer>
+ getLibraryContainer() const;
+
+ OUString getProjectName() const;
+ rtl_TextEncoding getVBATextEncoding() const;
+
+ css::uno::Reference<css::frame::XModel> mxModel;
+};
+
+class VBACompressionChunk
+{
+public:
+
+ VBACompressionChunk(SvStream& rCompressedStream, const sal_uInt8* pData, std::size_t nChunkSize);
+
+ void write();
+
+private:
+ SvStream& mrCompressedStream;
+ const sal_uInt8* mpUncompressedData;
+ sal_uInt8* mpCompressedChunkStream;
+
+ // same as DecompressedChunkEnd in the spec
+ std::size_t mnChunkSize;
+
+ // CompressedCurrent according to the spec
+ sal_uInt64 mnCompressedCurrent;
+
+ // CompressedEnd according to the spec
+ sal_uInt64 mnCompressedEnd;
+
+ // DecompressedCurrent according to the spec
+ sal_uInt64 mnDecompressedCurrent;
+
+ // DecompressedEnd according to the spec
+ sal_uInt64 mnDecompressedEnd;
+
+ static void PackCompressedChunkSize(size_t nSize, sal_uInt16& rHeader);
+
+ static void PackCompressedChunkFlag(bool bCompressed, sal_uInt16& rHeader);
+
+ static void PackCompressedChunkSignature(sal_uInt16& rHeader);
+
+ void compressTokenSequence();
+
+ void compressToken(size_t index, sal_uInt8& nFlagByte);
+
+ static void SetFlagBit(size_t index, bool bVal, sal_uInt8& rFlag);
+
+ sal_uInt16 CopyToken(size_t nLength, size_t nOffset);
+
+ void match(size_t& rLength, size_t& rOffset);
+
+ void CopyTokenHelp(sal_uInt16& rLengthMask, sal_uInt16& rOffsetMask,
+ sal_uInt16& rBitCount, sal_uInt16& rMaximumLength);
+
+ void writeRawChunk();
+
+ sal_uInt16 handleHeader(bool bCompressed);
+};
+
+class OOX_DLLPUBLIC VBACompression
+{
+public:
+ VBACompression(SvStream& rCompressedStream,
+ SvMemoryStream& rUncompressedStream);
+
+ void write();
+
+private:
+ SvStream& mrCompressedStream;
+ SvMemoryStream& mrUncompressedStream;
+};
+
+class OOX_DLLPUBLIC VBAEncryption
+{
+public:
+ VBAEncryption(const sal_uInt8* pData,
+ const sal_uInt16 nLength,
+ SvStream& rEncryptedData,
+ sal_uInt8 nProjKey,
+ rtl_TextEncoding eTextEncoding);
+
+ void write();
+
+ static sal_uInt8 calculateProjKey(const OUString& rString);
+
+private:
+ const sal_uInt8* mpData; // an array of bytes to be obfuscated
+ const sal_uInt16 mnLength; // the length of Data
+ SvStream& mrEncryptedData; // Encrypted Data Structure
+ sal_uInt8 mnUnencryptedByte1; // the last unencrypted byte read or written
+ sal_uInt8 mnEncryptedByte1; // the last encrypted byte read or written
+ sal_uInt8 mnEncryptedByte2; // the next-to-last encrypted byte read or written
+ sal_Unicode mnProjKey; // a project-specific encryption key
+ sal_uInt8 mnIgnoredLength; // the length in bytes of IgnoredEnc
+
+ sal_uInt8 mnSeed; // the seed value
+ sal_uInt8 mnVersionEnc; // the version encoding
+ rtl_TextEncoding meTextEncoding; // the VBA text encoding on export
+
+ void writeSeed();
+ void writeVersionEnc();
+ void writeProjKeyEnc();
+ void writeIgnoredEnc();
+ void writeDataLengthEnc();
+ void writeDataEnc();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbahelper.hxx b/include/oox/ole/vbahelper.hxx
new file mode 100644
index 000000000..248d09810
--- /dev/null
+++ b/include/oox/ole/vbahelper.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBAHELPER_HXX
+#define INCLUDED_OOX_OLE_VBAHELPER_HXX
+
+#include <oox/helper/binarystreambase.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class BinaryInputStream; }
+
+namespace oox::ole {
+
+// Directory stream record identifiers ========================================
+
+const sal_uInt16 VBA_ID_MODULECOOKIE = 0x002C;
+const sal_uInt16 VBA_ID_MODULEDOCSTRING = 0x001C;
+const sal_uInt16 VBA_ID_MODULEDOCSTRINGUNICODE = 0x0048;
+const sal_uInt16 VBA_ID_MODULEEND = 0x002B;
+const sal_uInt16 VBA_ID_MODULEHELPCONTEXT = 0x001E;
+const sal_uInt16 VBA_ID_MODULENAME = 0x0019;
+const sal_uInt16 VBA_ID_MODULENAMEUNICODE = 0x0047;
+const sal_uInt16 VBA_ID_MODULEOFFSET = 0x0031;
+const sal_uInt16 VBA_ID_MODULEPRIVATE = 0x0028;
+const sal_uInt16 VBA_ID_MODULEREADONLY = 0x0025;
+const sal_uInt16 VBA_ID_MODULESTREAMNAME = 0x001A;
+const sal_uInt16 VBA_ID_MODULESTREAMNAMEUNICODE = 0x0032;
+const sal_uInt16 VBA_ID_MODULETYPEDOCUMENT = 0x0022;
+const sal_uInt16 VBA_ID_MODULETYPEPROCEDURAL = 0x0021;
+const sal_uInt16 VBA_ID_PROJECTCODEPAGE = 0x0003;
+const sal_uInt16 VBA_ID_PROJECTEND = 0x0010;
+const sal_uInt16 VBA_ID_PROJECTMODULES = 0x000F;
+const sal_uInt16 VBA_ID_PROJECTNAME = 0x0004;
+const sal_uInt16 VBA_ID_PROJECTVERSION = 0x0009;
+
+
+/** Static helper functions for the VBA filters. */
+namespace VbaHelper
+{
+ /** Reads the next record from the VBA directory stream 'dir'.
+
+ @param rnRecId (out parameter) The record identifier of the new record.
+ @param rRecData (out parameter) The contents of the new record.
+ @param rInStrm The 'dir' stream.
+
+ @return True = next record successfully read. False on any error, or
+ if the stream is EOF.
+ */
+ bool readDirRecord(
+ sal_uInt16& rnRecId,
+ StreamDataSequence& rRecData,
+ BinaryInputStream& rInStrm );
+
+ /** Extracts a key/value pair from a string separated by an equality sign.
+
+ @param rKey (out parameter) The key before the separator.
+ @param rValue (out parameter) The value following the separator.
+ @param rCodeLine The source key/value pair.
+
+ @return True = Equality sign separator found, and the returned key and
+ value are not empty. False otherwise.
+ */
+ bool extractKeyValue(
+ OUString& rKey,
+ OUString& rValue,
+ std::u16string_view rKeyValue );
+}
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbainputstream.hxx b/include/oox/ole/vbainputstream.hxx
new file mode 100644
index 000000000..4f2f78d81
--- /dev/null
+++ b/include/oox/ole/vbainputstream.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBAINPUTSTREAM_HXX
+#define INCLUDED_OOX_OLE_VBAINPUTSTREAM_HXX
+
+#include <cstddef>
+#include <vector>
+
+#include <oox/helper/binaryinputstream.hxx>
+#include <oox/helper/binarystreambase.hxx>
+#include <sal/types.h>
+
+namespace oox::ole {
+
+
+/** A non-seekable input stream that implements run-length decompression. */
+class VbaInputStream final : public BinaryInputStream
+{
+public:
+ explicit VbaInputStream( BinaryInputStream& rInStrm );
+
+ /** Returns -1, stream size is not determinable. */
+ virtual sal_Int64 size() const override;
+ /** Returns -1, stream position is not tracked. */
+ virtual sal_Int64 tell() const override;
+ /** Does nothing, stream is not seekable. */
+ virtual void seek( sal_Int64 nPos ) override;
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close() override;
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+ /** Seeks the stream forward by the passed number of bytes. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+private:
+ /** If no data left in chunk buffer, reads the next chunk from stream. */
+ bool updateChunk();
+
+private:
+ typedef ::std::vector< sal_uInt8 > ChunkBuffer;
+
+ BinaryInputStream* mpInStrm;
+ ChunkBuffer maChunk;
+ size_t mnChunkPos;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbamodule.hxx b/include/oox/ole/vbamodule.hxx
new file mode 100644
index 000000000..573552766
--- /dev/null
+++ b/include/oox/ole/vbamodule.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBAMODULE_HXX
+#define INCLUDED_OOX_OLE_VBAMODULE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vector>
+
+namespace com::sun::star {
+ namespace container { class XNameAccess; }
+ namespace container { class XNameContainer; }
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox {
+ class BinaryInputStream;
+ class StorageBase;
+}
+
+namespace oox::ole {
+
+/** Stores, which key shortcut maps to which VBA macro method. */
+struct VbaMacroKeyAndMethodBinding
+{
+ // This describes a key combination in "raw" VBA Macro form, that
+ // still needs translated to a key event that can be used in
+ // LibreOffice.
+ OUString msApiKey;
+ // The name of the macro method
+ OUString msMethodName;
+};
+
+class VbaModule
+{
+public:
+ explicit VbaModule(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XModel >& rxDocModel,
+ const OUString& rName,
+ rtl_TextEncoding eTextEnc,
+ bool bExecutable );
+
+ /** Returns the module type (com.sun.star.script.ModuleType constant). */
+ sal_Int32 getType() const { return mnType; }
+ /** Sets the passed module type. */
+ void setType( sal_Int32 nType ) { mnType = nType; }
+
+ /** Returns the name of the module. */
+ const OUString& getName() const { return maName; }
+ /** Returns the stream name of the module. */
+ const OUString& getStreamName() const { return maStreamName; }
+
+ /** Imports all records for this module until the MODULEEND record. */
+ void importDirRecords( BinaryInputStream& rDirStrm );
+
+ /** Imports the VBA source code into the passed Basic library. */
+ void createAndImportModule(
+ StorageBase& rVbaStrg,
+ const css::uno::Reference< css::container::XNameContainer >& rxBasicLib,
+ const css::uno::Reference< css::container::XNameAccess >& rxDocObjectNA );
+ /** Creates an empty Basic module in the passed Basic library. */
+ void createEmptyModule(
+ const css::uno::Reference< css::container::XNameContainer >& rxBasicLib,
+ const css::uno::Reference< css::container::XNameAccess >& rxDocObjectNA ) const;
+
+ void registerShortcutKeys();
+
+private:
+ /** Reads and returns the VBA source code from the passed storage. */
+ OUString readSourceCode( StorageBase& rVbaStrg );
+
+ /** Creates a new Basic module and inserts it into the passed Basic library. */
+ void createModule(
+ std::u16string_view rVBASourceCode,
+ const css::uno::Reference< css::container::XNameContainer >& rxBasicLib,
+ const css::uno::Reference< css::container::XNameAccess >& rxDocObjectNA ) const;
+
+private:
+ css::uno::Reference< css::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ css::uno::Reference< css::frame::XModel >
+ mxDocModel; ///< Document model used to import/export the VBA project.
+ OUString maName;
+ OUString maStreamName;
+ OUString maDocString;
+ rtl_TextEncoding meTextEnc;
+ sal_Int32 mnType;
+ sal_uInt32 mnOffset;
+ bool mbReadOnly;
+ bool mbPrivate;
+ bool mbExecutable;
+
+ /** Keys and VBA macro method bindings */
+ std::vector<VbaMacroKeyAndMethodBinding> maKeyBindings;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbaproject.hxx b/include/oox/ole/vbaproject.hxx
new file mode 100644
index 000000000..4a9b3e1a4
--- /dev/null
+++ b/include/oox/ole/vbaproject.hxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBAPROJECT_HXX
+#define INCLUDED_OOX_OLE_VBAPROJECT_HXX
+
+#include <functional>
+#include <map>
+#include <string_view>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/refmap.hxx>
+#include <oox/helper/refvector.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace container { class XNameContainer; }
+ namespace frame { class XModel; }
+ namespace script { class XLibraryContainer; }
+ namespace script::vba { class XVBAMacroResolver; }
+ namespace uno { class XComponentContext; }
+ namespace uno { class XInterface; }
+ namespace io { class XInputStream; }
+}
+
+namespace oox {
+ class GraphicHelper;
+ class StorageBase;
+}
+
+namespace oox::ole {
+
+class VbaModule;
+
+class VbaFilterConfig
+{
+public:
+ explicit VbaFilterConfig(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ std::u16string_view rConfigCompName );
+ ~VbaFilterConfig();
+
+ /** Returns true, if the VBA source code and forms should be imported. */
+ bool isImportVba() const;
+ /** Returns true, if the VBA source code should be imported executable. */
+ bool isImportVbaExecutable() const;
+ /** Returns true, if the VBA source code and forms should be exported. */
+ bool isExportVba() const;
+
+private:
+ css::uno::Reference< css::uno::XInterface >
+ mxConfigAccess;
+};
+
+
+/** Base class for objects that attach a macro to a specific action.
+
+ Purpose is to collect objects that need to attach a VBA macro to an action.
+ The VBA project will be loaded at a very late point of the document import
+ process, because it depends on an initialized core document model (e.g.
+ spreadsheet codenames). Some objects that want to attach a VBA macro to an
+ action (e.g. mouse click action for drawing shapes) are loaded long before
+ the VBA project. The drawback is that in most cases macros are specified
+ without module name, or the VBA project name is part of the macro name.
+ In the former case, all code modules have to be scanned for the macro to be
+ able to create a valid script URL.
+
+ The import code will register these requests to attach a VBA macro with an
+ instance of a class derived from this base class. The derived class will
+ store all information needed to finally attach the macro to the action,
+ once the VBA project has been imported.
+ */
+class OOX_DLLPUBLIC VbaMacroAttacherBase
+{
+public:
+ explicit VbaMacroAttacherBase( const OUString& rMacroName );
+ virtual ~VbaMacroAttacherBase();
+
+ /** Resolves the internal macro name to the related macro URL, and attaches
+ the macro to the object. */
+ void resolveAndAttachMacro(
+ const css::uno::Reference< css::script::vba::XVBAMacroResolver >& rxResolver );
+
+private:
+ /** Called after the VBA project has been imported. Derived classes will
+ attach the passed script to the object represented by this instance. */
+ virtual void attachMacro( const OUString& rScriptUrl ) = 0;
+
+private:
+ OUString maMacroName;
+};
+
+typedef std::shared_ptr< VbaMacroAttacherBase > VbaMacroAttacherRef;
+
+
+class OOX_DLLPUBLIC VbaProject : public VbaFilterConfig
+{
+public:
+ explicit VbaProject(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XModel >& rxDocModel,
+ std::u16string_view rConfigCompName );
+ virtual ~VbaProject();
+
+ /** Imports the entire VBA project from the passed storage.
+
+ @param rVbaPrjStrg The root storage of the entire VBA project.
+ */
+ void importVbaProject(
+ StorageBase& rVbaPrjStrg,
+ const GraphicHelper& rGraphicHelper );
+
+ bool importVbaProject(
+ StorageBase& rVbaPrjStrg );
+
+ /// Imports VBA data for a VBA project, e.g. word/vbaData.xml.
+ void importVbaData(const css::uno::Reference<css::io::XInputStream>& xInputStream);
+
+ /** Reads vba module related information from the project streams */
+ void readVbaModules( StorageBase& rVbaPrjStrg );
+ /** Imports (and creates) vba modules and user forms from the vba project records previously read.
+ Note: ( expects that readVbaModules was already called ) */
+ void importModulesAndForms( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper );
+ /** Registers a macro attacher object. For details, see description of the
+ VbaMacroAttacherBase class. */
+ void registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher );
+
+ /** Attaches VBA macros to objects registered via registerMacroAttacher(). */
+ void attachMacros();
+
+ void setOleOverridesSink( css::uno::Reference< css::container::XNameContainer > const & rxOleOverridesSink ){ mxOleOverridesSink = rxOleOverridesSink; }
+
+protected:
+ /** Registers a dummy module that will be created when the VBA project is
+ imported. */
+ void addDummyModule( const OUString& rName, sal_Int32 nType );
+
+ /** Called when the import process of the VBA project has been started. */
+ virtual void prepareImport();
+
+private:
+ VbaProject( const VbaProject& ) = delete;
+ VbaProject& operator=( const VbaProject& ) = delete;
+
+ /** Returns the Basic or dialog library container. */
+ css::uno::Reference< css::script::XLibraryContainer >
+ getLibraryContainer( sal_Int32 nPropId );
+ /** Opens a Basic or dialog library, creates missing if not found. */
+ css::uno::Reference< css::container::XNameContainer >
+ openLibrary( sal_Int32 nPropId );
+ /** Creates and returns the Basic library of the document used for import. */
+ css::uno::Reference< css::container::XNameContainer > const &
+ createBasicLibrary();
+ /** Creates and returns the dialog library of the document used for import. */
+ css::uno::Reference< css::container::XNameContainer > const &
+ createDialogLibrary();
+
+ /** Imports the VBA code modules and forms. */
+ void importVba(
+ StorageBase& rVbaPrjStrg,
+ const GraphicHelper& rGraphicHelper );
+
+ /** Copies the entire VBA project storage to the passed document model. */
+ void copyStorage( StorageBase& rVbaPrjStrg );
+
+private:
+ typedef RefVector< VbaMacroAttacherBase > MacroAttacherVector;
+ typedef ::std::map< OUString, sal_Int32 > DummyModuleMap;
+
+ css::uno::Reference< css::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ css::uno::Reference< css::frame::XModel >
+ mxDocModel; ///< Document model used to import/export the VBA project.
+ css::uno::Reference< css::container::XNameContainer >
+ mxBasicLib; ///< The Basic library of the document used for import.
+ css::uno::Reference< css::container::XNameContainer >
+ mxDialogLib; ///< The dialog library of the document used for import.
+ MacroAttacherVector maMacroAttachers; ///< Objects that want to attach a VBA macro to an action.
+ DummyModuleMap maDummyModules; ///< Additional empty modules created on import.
+ OUString maPrjName; ///< Name of the VBA project.
+ css::uno::Reference< css::container::XNameContainer >
+ mxOleOverridesSink;
+ typedef RefMap< OUString, VbaModule > VbaModuleMap;
+ VbaModuleMap maModules;
+ VbaModuleMap maModulesByStrm;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/animationspersist.hxx b/include/oox/ppt/animationspersist.hxx
new file mode 100644
index 000000000..8c8bb766d
--- /dev/null
+++ b/include/oox/ppt/animationspersist.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_OOX_PPT_ANIMATIONSPERSIST_HXX
+#define INCLUDED_OOX_PPT_ANIMATIONSPERSIST_HXX
+
+#include <array>
+#include <vector>
+#include <memory>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/ppt/slidepersist.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox::ppt {
+
+ enum {
+ NP_TO = 0,
+ NP_FROM, NP_BY, NP_USERDATA, NP_ATTRIBUTENAME,
+ NP_ACCELERATION, NP_AUTOREVERSE, NP_DECELERATE, NP_DURATION, NP_FILL,
+ NP_REPEATCOUNT, NP_REPEATDURATION, NP_RESTART,
+ NP_DIRECTION, NP_COLORINTERPOLATION, NP_CALCMODE, NP_TRANSFORMTYPE,
+ NP_PATH,
+ NP_ENDSYNC, NP_ITERATETYPE, NP_ITERATEINTERVAL,
+ NP_SUBITEM, NP_TARGET, NP_COMMAND, NP_PARAMETER,
+ NP_VALUES, NP_FORMULA, NP_KEYTIMES, NP_DISPLAY,
+ NP_HIDEDURINGSHOW,
+ NP_ISNARRATION,
+ NP_SIZE_
+ };
+
+ typedef std::array< css::uno::Any, NP_SIZE_ > NodePropertyMap;
+
+
+ /** data for CT_TLShapeTargetElement */
+ struct ShapeTargetElement
+ {
+ ShapeTargetElement()
+ : mnType(0)
+ , mnRangeType(0)
+ {
+ maRange.start = maRange.end = 0;
+ }
+ void convert( css::uno::Any & aAny, sal_Int16 & rSubType ) const;
+
+ sal_Int32 mnType;
+ sal_Int32 mnRangeType;
+ drawingml::IndexRange maRange;
+ OUString msSubShapeId;
+ };
+
+
+ /** data for CT_TLTimeTargetElement */
+ struct AnimTargetElement
+ {
+ AnimTargetElement()
+ : mnType( 0 )
+ {}
+ /** convert to a set of properties */
+ css::uno::Any convert(const SlidePersistPtr & pSlide, sal_Int16 & nSubType) const;
+
+ sal_Int32 mnType;
+ OUString msValue;
+ ShapeTargetElement maShapeTarget;
+ };
+
+ typedef std::shared_ptr< AnimTargetElement > AnimTargetElementPtr;
+
+ struct AnimationCondition;
+
+ typedef std::vector< AnimationCondition > AnimationConditionList;
+
+ /** data for CT_TLTimeCondition */
+ struct AnimationCondition
+ {
+ AnimationCondition()
+ : mnType( 0 )
+ {}
+
+ css::uno::Any convert(const SlidePersistPtr & pSlide) const;
+ static css::uno::Any convertList(const SlidePersistPtr & pSlide, const AnimationConditionList & l);
+
+ AnimTargetElementPtr & getTarget()
+ { if(!mpTarget) mpTarget = std::make_shared<AnimTargetElement>(); return mpTarget; }
+ css::uno::Any maValue;
+ sal_Int32 mnType;
+ private:
+ AnimTargetElementPtr mpTarget;
+ };
+
+
+ struct TimeAnimationValue
+ {
+ OUString msFormula;
+ OUString msTime;
+ css::uno::Any maValue;
+ };
+
+ typedef ::std::vector< TimeAnimationValue > TimeAnimationValueList;
+
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/backgroundproperties.hxx b/include/oox/ppt/backgroundproperties.hxx
new file mode 100644
index 000000000..35a209b30
--- /dev/null
+++ b/include/oox/ppt/backgroundproperties.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_BACKGROUNDPROPERTIES_HXX
+#define INCLUDED_OOX_PPT_BACKGROUNDPROPERTIES_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+namespace oox::drawingml { struct FillProperties; }
+
+namespace oox::ppt {
+
+
+class BackgroundPropertiesContext final : public ::oox::core::FragmentHandler2
+{
+public:
+ BackgroundPropertiesContext( ::oox::core::FragmentHandler2 const & rParent, ::oox::drawingml::FillProperties& rFillProperties );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override;
+
+private:
+ ::oox::drawingml::FillProperties& mrFillProperties;
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_BACKGROUNDPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/comments.hxx b/include/oox/ppt/comments.hxx
new file mode 100644
index 000000000..10cad1270
--- /dev/null
+++ b/include/oox/ppt/comments.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+#ifndef INCLUDED_OOX_PPT_COMMENTS_HXX
+#define INCLUDED_OOX_PPT_COMMENTS_HXX
+
+#include <vector>
+
+#include <com/sun/star/util/DateTime.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox::ppt {
+
+struct CommentAuthor
+{
+ OUString clrIdx;
+ OUString id;
+ OUString initials;
+ OUString lastIdx;
+ OUString name;
+};
+
+class CommentAuthorList
+{
+ private:
+ std::vector<CommentAuthor> cmAuthorLst;
+
+ public:
+ void setValues(const CommentAuthorList& list);
+
+ void addAuthor(const CommentAuthor& _author)
+ {
+ cmAuthorLst.push_back(_author);
+ }
+
+ friend class Comment;
+};
+
+class Comment
+{
+ private:
+ OUString authorId;
+ OUString dt;
+ OUString idx;
+ OUString x;
+ OUString y;
+ OUString text;
+ css::util::DateTime aDateTime;
+
+ void setDateTime (const OUString& datetime);
+
+ public:
+ void setAuthorId(const OUString& _aId)
+ {
+ authorId = _aId;
+ }
+ void setdt(const OUString& _dt)
+ {
+ dt=_dt;
+ setDateTime(_dt);
+ }
+ void setidx(const OUString& _idx)
+ {
+ idx=_idx;
+ }
+ void setPoint(const OUString& _x, const OUString& _y)
+ {
+ x=_x;
+ y=_y;
+ }
+ void setText(const OUString& _text)
+ {
+ text = _text;
+ }
+ const OUString& get_text() const
+ {
+ return text;
+ }
+ const css::util::DateTime& getDateTime() const
+ {
+ return aDateTime;
+ }
+ sal_Int32 getIntX() const
+ {
+ return x.toInt32();
+ }
+ sal_Int32 getIntY() const
+ {
+ return y.toInt32();
+ }
+ OUString getAuthor ( const CommentAuthorList& list );
+};
+
+class CommentList
+{
+ public:
+ std::vector<Comment> cmLst;
+ int getSize () const
+ {
+ return static_cast<int>(cmLst.size());
+ }
+ const Comment& getCommentAtIndex (int index);
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/customshowlistcontext.hxx b/include/oox/ppt/customshowlistcontext.hxx
new file mode 100644
index 000000000..d79cfc637
--- /dev/null
+++ b/include/oox/ppt/customshowlistcontext.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_CUSTOMSHOWLISTCONTEXT_HXX
+#define INCLUDED_OOX_PPT_CUSTOMSHOWLISTCONTEXT_HXX
+
+#include <vector>
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+
+namespace oox::ppt {
+
+
+ struct CustomShow
+ {
+ OUString maCustomShowName;
+ OUString mnId;
+ std::vector< OUString >maSldLst;
+ };
+
+ /** CT_ */
+ class CustomShowListContext final : public ::oox::core::FragmentHandler2
+ {
+ std::vector< CustomShow >& mrCustomShowList;
+
+ public:
+ CustomShowListContext( ::oox::core::FragmentHandler2 const & rParent,
+ std::vector< CustomShow >& rCustomShowList );
+
+ virtual ~CustomShowListContext( ) override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override;
+ };
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/headerfooter.hxx b/include/oox/ppt/headerfooter.hxx
new file mode 100644
index 000000000..e304f3c6e
--- /dev/null
+++ b/include/oox/ppt/headerfooter.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_HEADERFOOTER_HXX
+#define INCLUDED_OOX_PPT_HEADERFOOTER_HXX
+
+namespace oox::ppt {
+
+ struct HeaderFooter
+ {
+ bool mbSlideNumber;
+ bool mbHeader;
+ bool mbFooter;
+ bool mbDateTime;
+
+ HeaderFooter()
+ : mbSlideNumber( true )
+ , mbHeader( true )
+ , mbFooter( true )
+ , mbDateTime( true ) {};
+ };
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/layoutfragmenthandler.hxx b/include/oox/ppt/layoutfragmenthandler.hxx
new file mode 100644
index 000000000..41fb7a85b
--- /dev/null
+++ b/include/oox/ppt/layoutfragmenthandler.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_LAYOUTFRAGMENTHANDLER_HXX
+#define INCLUDED_OOX_PPT_LAYOUTFRAGMENTHANDLER_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/ppt/slidefragmenthandler.hxx>
+#include <oox/ppt/slidepersist.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+namespace oox::core { class XmlFilterBase; }
+
+namespace oox::ppt {
+
+class LayoutFragmentHandler final : public SlideFragmentHandler
+{
+public:
+ LayoutFragmentHandler(::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath,
+ const SlidePersistPtr& pMasterPersistPtr);
+ virtual ~LayoutFragmentHandler() override;
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override;
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_LAYOUTFRAGMENTHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptfilterhelpers.hxx b/include/oox/ppt/pptfilterhelpers.hxx
new file mode 100644
index 000000000..58547d9e7
--- /dev/null
+++ b/include/oox/ppt/pptfilterhelpers.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_PPTFILTERHELPERS_HXX
+#define INCLUDED_OOX_PPT_PPTFILTERHELPERS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+namespace com::sun::star {
+ namespace animations { class XAnimationNode; }
+}
+
+namespace oox::ppt {
+
+ // conversion of MS to OOo attributes.
+ enum class AnimationAttributeEnum
+ {
+ PPT_X, PPT_Y, PPT_W, PPT_H, PPT_C, R, XSHEAR, FILLCOLOR, FILLTYPE,
+ FILLON, STROKECOLOR, STROKEON, STYLECOLOR, STYLEROTATION, FONTWEIGHT,
+ STYLEUNDERLINE, STYLEFONTFAMILY, STYLEFONTSIZE, STYLEFONTSTYLE,
+ STYLEVISIBILITY, STYLEOPACITY, UNKNOWN
+ };
+
+ struct ImplAttributeNameConversion
+ {
+ AnimationAttributeEnum meAttribute;
+ const char* mpMSName;
+ const char* mpAPIName;
+ };
+
+ OOX_DLLPUBLIC const ImplAttributeNameConversion *getAttributeConversionList();
+
+ struct OOX_DLLPUBLIC transition
+ {
+ const char* mpName;
+ sal_Int16 mnType;
+ sal_Int16 mnSubType;
+ bool mbDirection; // true: default geometric direction
+
+ static const transition* getList();
+ static const transition* find( std::u16string_view rName );
+ };
+
+ struct OOX_DLLPUBLIC convert_subtype
+ {
+ sal_Int32 mnID;
+ const char* mpStrSubType;
+
+ static const convert_subtype* getList();
+ };
+
+ struct OOX_DLLPUBLIC preset_mapping
+ {
+ sal_Int32 mnPresetClass;
+ sal_Int32 mnPresetId;
+ const char* mpStrPresetId;
+
+ static const preset_mapping* getList();
+ };
+
+ OOX_DLLPUBLIC OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId, sal_Int32 nPresetSubType );
+
+ OOX_DLLPUBLIC void fixMainSequenceTiming( const css::uno::Reference< css::animations::XAnimationNode >& xNode );
+
+ OOX_DLLPUBLIC void fixInteractiveSequenceTiming( const css::uno::Reference< css::animations::XAnimationNode >& xNode );
+
+ /** convert attribute values of the animation target so that LibreOffice understand.
+ */
+ OOX_DLLPUBLIC bool convertAnimationValue(AnimationAttributeEnum eAttribute, css::uno::Any& rValue);
+
+ /** convert the measure string to LibreOffice format.
+ * i.e. convert occurrence of #{0,1}ppt_[xywh] to x,y, width, height.
+ */
+ OOX_DLLPUBLIC bool convertMeasure(OUString& rString);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptgraphicshapecontext.hxx b/include/oox/ppt/pptgraphicshapecontext.hxx
new file mode 100644
index 000000000..bdc1f7d77
--- /dev/null
+++ b/include/oox/ppt/pptgraphicshapecontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_PPTGRAPHICSHAPECONTEXT_HXX
+#define INCLUDED_OOX_PPT_PPTGRAPHICSHAPECONTEXT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/drawingml/graphicshapecontext.hxx>
+#include <oox/ppt/slidepersist.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+namespace oox::core { class ContextHandler2Helper; }
+
+namespace oox::ppt {
+
+class PPTGraphicShapeContext final : public ::oox::drawingml::GraphicShapeContext
+{
+ SlidePersistPtr mpSlidePersistPtr;
+
+public:
+ PPTGraphicShapeContext( ::oox::core::ContextHandler2Helper const & rParent, const SlidePersistPtr& rSlidePersistPtr, const oox::drawingml::ShapePtr& pMasterShapePtr, const oox::drawingml::ShapePtr& pShapePtr );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+};
+
+}
+
+#endif // OOX_PPT_PPTGRAPHICSHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptimport.hxx b/include/oox/ppt/pptimport.hxx
new file mode 100644
index 000000000..2d7367c4c
--- /dev/null
+++ b/include/oox/ppt/pptimport.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_PPTIMPORT_HXX
+#define INCLUDED_OOX_PPT_PPTIMPORT_HXX
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <oox/core/filterbase.hxx>
+#include <oox/core/xmlfilterbase.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/drawingml/theme.hxx>
+#include <oox/ppt/slidepersist.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace beans { struct PropertyValue; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox {
+ class GraphicHelper;
+ namespace drawingml::chart { class ChartConverter; }
+ namespace ole { class VbaProject; }
+ namespace vml { class Drawing; }
+}
+
+namespace oox::ppt {
+
+
+class PowerPointImport final : public oox::core::XmlFilterBase
+{
+public:
+ /// @throws css::uno::RuntimeException
+ PowerPointImport( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ virtual ~PowerPointImport() override;
+
+ // from FilterBase
+ virtual bool importDocument() override;
+ virtual bool exportDocument() noexcept override;
+
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const override;
+ virtual ::oox::vml::Drawing* getVmlDrawing() override;
+ virtual oox::drawingml::table::TableStyleListPtr getTableStyles() override;
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter() override;
+
+ const SlidePersistPtr& getActualSlidePersist() const { return mpActualSlidePersist; };
+ void setActualSlidePersist( SlidePersistPtr pActualSlidePersist ){ mpActualSlidePersist = pActualSlidePersist; };
+ std::map< OUString, oox::drawingml::ThemePtr >& getThemes(){ return maThemes; };
+ std::vector< SlidePersistPtr >& getDrawPages(){ return maDrawPages; };
+ std::vector< SlidePersistPtr >& getMasterPages(){ return maMasterPages; };
+ std::vector< SlidePersistPtr >& getNotesPages(){ return maNotesPages; };
+
+ virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& rDescriptor ) override;
+
+ ::Color getSchemeColor( sal_Int32 nToken ) const;
+ virtual std::shared_ptr<::oox::drawingml::Theme> getCurrentThemePtr() const override;
+
+#if OSL_DEBUG_LEVEL > 0
+ static XmlFilterBase* mpDebugFilterBase;
+#endif
+
+private:
+ virtual GraphicHelper* implCreateGraphicHelper() const override;
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const override;
+ virtual OUString SAL_CALL getImplementationName() override;
+
+private:
+ OUString maTableStyleListPath;
+ oox::drawingml::table::TableStyleListPtr mpTableStyleList;
+
+ SlidePersistPtr mpActualSlidePersist;
+ std::map< OUString, oox::drawingml::ThemePtr > maThemes;
+
+ std::vector< SlidePersistPtr > maDrawPages;
+ std::vector< SlidePersistPtr > maMasterPages;
+ std::vector< SlidePersistPtr > maNotesPages;
+
+ std::shared_ptr< ::oox::drawingml::chart::ChartConverter > mxChartConv;
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_PPTIMPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshape.hxx b/include/oox/ppt/pptshape.hxx
new file mode 100644
index 000000000..ead382b52
--- /dev/null
+++ b/include/oox/ppt/pptshape.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_PPTSHAPE_HXX
+#define INCLUDED_OOX_PPT_PPTSHAPE_HXX
+
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/drawingml/shape.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/ppt/slidepersist.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace basegfx { class B2DHomMatrix; }
+
+namespace com::sun::star {
+ namespace awt { struct Rectangle; }
+ namespace drawing { class XShapes; }
+}
+
+namespace oox {
+ namespace core { class XmlFilterBase; }
+ namespace drawingml { class Theme; }
+ template <typename Type> class OptValue;
+}
+
+namespace oox::ppt {
+
+class PPTShape final : public oox::drawingml::Shape
+{
+ OUString msModelId; // fallback dgs smartart shape reference
+ ShapeLocation meShapeLocation; // placeholdershapes (mnSubType != 0) on Master are never displayed
+ bool mbReferenced; // placeholdershapes on Layout are displayed only, if they are not referenced
+ // placeholdershapes on Slide are displayed always
+ oox::drawingml::ShapePtr mpPlaceholder;
+ /// Set if spPr tag is non empty for the shape
+ bool mbHasNoninheritedShapeProperties;
+
+ bool IsPlaceHolderCandidate(const SlidePersist& rSlidePersist) const;
+
+public:
+
+ PPTShape( const oox::ppt::ShapeLocation eShapeLocation,
+ const char* pServiceType );
+ virtual ~PPTShape() override;
+
+ using oox::drawingml::Shape::addShape;
+ // addShape is creating and inserting the corresponding XShape.
+ void addShape(
+ oox::core::XmlFilterBase& rFilterBase,
+ const SlidePersist& rPersist,
+ const oox::drawingml::Theme* pTheme,
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ basegfx::B2DHomMatrix& aTransformation,
+ ::oox::drawingml::ShapeIdMap* pShapeMap );
+
+ ShapeLocation getShapeLocation() const { return meShapeLocation; };
+ void setReferenced( bool bReferenced ){ mbReferenced = bReferenced; };
+ void setPlaceholder( oox::drawingml::ShapePtr pPlaceholder ) { mpPlaceholder = pPlaceholder; }
+ void setModelId( const OUString& rId ) { msModelId = rId; }
+
+ /// Flags shape as having a non-empty spPr tag
+ void setHasNoninheritedShapeProperties() { mbHasNoninheritedShapeProperties = true; }
+ /// Returns whether or not the shape had a non-empty spPr tag
+ bool hasNonInheritedShapeProperties() const { return mbHasNoninheritedShapeProperties; }
+
+ static oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nFirstSubType,
+ const sal_Int32 nSecondSubType, const OptValue< sal_Int32 >& oSubTypeIndex,
+ std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly = false );
+ static oox::drawingml::ShapePtr findPlaceholderByIndex( const sal_Int32 nIdx,
+ std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly = false );
+
+ static oox::drawingml::TextListStylePtr getSubTypeTextListStyle( const SlidePersist& rSlidePersist, sal_Int32 nSubType );
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_PPTSHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshapecontext.hxx b/include/oox/ppt/pptshapecontext.hxx
new file mode 100644
index 000000000..5d5277502
--- /dev/null
+++ b/include/oox/ppt/pptshapecontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_PPTSHAPECONTEXT_HXX
+#define INCLUDED_OOX_PPT_PPTSHAPECONTEXT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/drawingml/shapecontext.hxx>
+#include <oox/ppt/slidepersist.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+namespace oox::core { class ContextHandler2Helper; }
+
+namespace oox::ppt {
+
+class PPTShapeContext final : public ::oox::drawingml::ShapeContext
+{
+ SlidePersistPtr mpSlidePersistPtr;
+
+public:
+ PPTShapeContext( ::oox::core::ContextHandler2Helper const & rParent, const SlidePersistPtr& rSlidePersistPtr, const oox::drawingml::ShapePtr& pMasterShapePtr, const oox::drawingml::ShapePtr& pShapePtr );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_PPTSHAPECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshapegroupcontext.hxx b/include/oox/ppt/pptshapegroupcontext.hxx
new file mode 100644
index 000000000..89f8ca65d
--- /dev/null
+++ b/include/oox/ppt/pptshapegroupcontext.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+#define INCLUDED_OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/drawingml/shapegroupcontext.hxx>
+#include <oox/ppt/slidepersist.hxx>
+#include <sal/types.h>
+
+namespace oox {
+ class AttributeList;
+ namespace core { class ContextHandler2Helper; }
+ namespace drawingml { class Color; }
+}
+
+namespace oox::ppt {
+
+class PPTShapeGroupContext final : public ::oox::drawingml::ShapeGroupContext
+{
+ SlidePersistPtr mpSlidePersistPtr;
+ ShapeLocation meShapeLocation;
+ oox::drawingml::ShapePtr pGraphicShape;
+
+ void applyFontRefColor(const oox::drawingml::ShapePtr& pShape, const oox::drawingml::Color& rFontRefColor);
+
+public:
+ PPTShapeGroupContext(
+ ::oox::core::FragmentHandler2 const & rParent,
+ const oox::ppt::SlidePersistPtr& rSlidePersistPtr,
+ const oox::ppt::ShapeLocation eShapeLocation,
+ const oox::drawingml::ShapePtr& pMasterShapePtr,
+ const oox::drawingml::ShapePtr& pGroupShapePtr );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+
+ void importExtDrawings();
+
+protected:
+
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshapepropertiescontext.hxx b/include/oox/ppt/pptshapepropertiescontext.hxx
new file mode 100644
index 000000000..124d7545d
--- /dev/null
+++ b/include/oox/ppt/pptshapepropertiescontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_PPTSHAPEPROPERTIESCONTEXT_HXX
+#define INCLUDED_OOX_PPT_PPTSHAPEPROPERTIESCONTEXT_HXX
+
+#include <drawingml/shapepropertiescontext.hxx>
+#include <oox/core/contexthandler.hxx>
+#include <sal/types.h>
+
+namespace oox {
+ class AttributeList;
+ namespace core { class ContextHandler2Helper; }
+ namespace drawingml { class Shape; }
+}
+
+namespace oox::ppt {
+
+class PPTShapePropertiesContext final : public ::oox::drawingml::ShapePropertiesContext
+{
+public:
+ PPTShapePropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, ::oox::drawingml::Shape& rShape );
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_PPTSHAPEPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/presPropsfragmenthandler.hxx b/include/oox/ppt/presPropsfragmenthandler.hxx
new file mode 100644
index 000000000..18a2a97aa
--- /dev/null
+++ b/include/oox/ppt/presPropsfragmenthandler.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OOX_PPT_PRESPROPSFRAGMENTHANDLER_HXX
+#define INCLUDED_OOX_PPT_PRESPROPSFRAGMENTHANDLER_HXX
+
+#include <oox/core/fragmenthandler2.hxx>
+
+namespace oox
+{
+namespace core
+{
+class XmlFilterBase;
+}
+
+namespace ppt
+{
+class PresPropsFragmentHandler final : public core::FragmentHandler2
+{
+public:
+ PresPropsFragmentHandler(core::XmlFilterBase& rFilter, const OUString& rFragmentPath);
+ virtual ~PresPropsFragmentHandler() override;
+ virtual void finalizeImport() override;
+ virtual core::ContextHandlerRef onCreateContext(sal_Int32 aElementToken,
+ const AttributeList& rAttribs) override;
+
+private:
+ bool m_bLoop = false;
+ bool m_bTiming = true;
+ OUString m_sId;
+ OUString m_sSt;
+};
+} // namespace ppt
+} // namespace oox
+
+#endif // INCLUDED_OOX_PPT_PRESPROPSFRAGMENTHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx
new file mode 100644
index 000000000..a9bb5bb67
--- /dev/null
+++ b/include/oox/ppt/presentationfragmenthandler.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_PRESENTATIONFRAGMENTHANDLER_HXX
+#define INCLUDED_OOX_PPT_PRESENTATIONFRAGMENTHANDLER_HXX
+
+#include <vector>
+
+#include <com/sun/star/awt/Size.hpp>
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/ppt/customshowlistcontext.hxx>
+#include <oox/ppt/comments.hxx>
+#include <oox/ppt/slidepersist.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+namespace oox::core { class XmlFilterBase; }
+
+namespace oox::ppt {
+
+class PresentationFragmentHandler final : public ::oox::core::FragmentHandler2
+{
+public:
+ PresentationFragmentHandler(::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath);
+ virtual ~PresentationFragmentHandler() noexcept override;
+ virtual void finalizeImport() override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override;
+
+private:
+ void importSlide( const ::oox::core::FragmentHandlerRef& rSlideFragmentHandler,
+ const oox::ppt::SlidePersistPtr& rPersist );
+ void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes);
+ void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, sal_Int32 nThemeIdx);
+ void importCustomSlideShow(std::vector<CustomShow>& rCustomShowList);
+
+ std::vector< OUString > maSlideMasterVector;
+ std::vector< OUString > maSlidesVector;
+ std::vector< OUString > maNotesMasterVector;
+ ::oox::drawingml::TextListStylePtr mpTextListStyle;
+
+ css::awt::Size maSlideSize;
+ css::awt::Size maNotesSize;
+
+ std::vector< CustomShow > maCustomShowList;
+
+ CommentAuthorList maAuthorList;
+ bool mbCommentAuthorsRead; // read commentAuthors.xml only once
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_PRESENTATIONFRAGMENTHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidefragmenthandler.hxx b/include/oox/ppt/slidefragmenthandler.hxx
new file mode 100644
index 000000000..b7d1d59b3
--- /dev/null
+++ b/include/oox/ppt/slidefragmenthandler.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_SLIDEFRAGMENTHANDLER_HXX
+#define INCLUDED_OOX_PPT_SLIDEFRAGMENTHANDLER_HXX
+
+#include <vector>
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/helper/propertymap.hxx>
+#include <oox/ppt/slidepersist.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+namespace oox::core { class XmlFilterBase; }
+
+namespace oox::ppt {
+
+class SlideFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ SlideFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, const SlidePersistPtr& pPersistPtr, const ShapeLocation eShapeLocation );
+ virtual ~SlideFragmentHandler() override;
+
+ virtual void finalizeImport() override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override;
+ virtual void onCharacters( const OUString& rChars ) override;
+
+ const ::std::vector< OUString>& getCharVector() const { return maCharVector; }
+
+protected:
+ SlidePersistPtr mpSlidePersistPtr;
+ ShapeLocation meShapeLocation;
+
+private:
+ OUString maSlideName;
+ PropertyMap maSlideProperties;
+ ::std::vector< OUString> maCharVector; // handle char in OnCharacters
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_SLIDEFRAGMENTHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidemastertextstylescontext.hxx b/include/oox/ppt/slidemastertextstylescontext.hxx
new file mode 100644
index 000000000..4d051ab8e
--- /dev/null
+++ b/include/oox/ppt/slidemastertextstylescontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_SLIDEMASTERTEXTSTYLESCONTEXT_HXX
+#define INCLUDED_OOX_PPT_SLIDEMASTERTEXTSTYLESCONTEXT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/ppt/slidepersist.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+
+namespace oox::ppt {
+
+class SlideMasterTextStylesContext final : public oox::core::FragmentHandler2
+{
+public:
+ SlideMasterTextStylesContext( ::oox::core::FragmentHandler2 const & rParent, SlidePersistPtr const & pSlidePersistPtr );
+ virtual ~SlideMasterTextStylesContext() override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override;
+
+private:
+ SlidePersistPtr mpSlidePersistPtr;
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_SLIDEMASTERTEXTSTYLESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx
new file mode 100644
index 000000000..4ba48637c
--- /dev/null
+++ b/include/oox/ppt/slidepersist.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_SLIDEPERSIST_HXX
+#define INCLUDED_OOX_PPT_SLIDEPERSIST_HXX
+
+#include <vector>
+#include <map>
+#include <memory>
+
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/drawingml/clrscheme.hxx>
+#include <oox/drawingml/color.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/drawingml/shape.hxx>
+#include <oox/ppt/comments.hxx>
+#include <oox/ppt/headerfooter.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace animations { class XAnimationNode; }
+ namespace drawing { class XDrawPage; }
+}
+
+namespace oox::core { class XmlFilterBase; }
+namespace oox::vml { class Drawing; }
+
+namespace oox::ppt {
+
+enum ShapeLocation
+{
+ Master,
+ Layout,
+ Slide
+};
+
+
+class TimeNode;
+class SlidePersist;
+
+typedef std::shared_ptr< SlidePersist > SlidePersistPtr;
+
+class SlidePersist : public std::enable_shared_from_this< SlidePersist >
+{
+
+public:
+ SlidePersist( oox::core::XmlFilterBase& rFilter, bool bMaster, bool bNotes,
+ const css::uno::Reference< css::drawing::XDrawPage >&,
+ oox::drawingml::ShapePtr const & pShapesPtr, const ::oox::drawingml::TextListStylePtr & );
+ ~SlidePersist();
+
+
+ const css::uno::Reference< css::drawing::XDrawPage >& getPage() const { return mxPage; };
+
+#if OSL_DEBUG_LEVEL > 0
+ static css::uno::WeakReference< css::drawing::XDrawPage > mxDebugPage;
+#endif
+
+ void setMasterPersist( SlidePersistPtr pMasterPersistPtr ){ mpMasterPagePtr = pMasterPersistPtr; }
+ const SlidePersistPtr& getMasterPersist() const { return mpMasterPagePtr; }
+
+ void setPath( const OUString& rPath ) { maPath = rPath; }
+ const OUString& getPath() const { return maPath; }
+
+ void setLayoutPath( const OUString& rLayoutPath ) { maLayoutPath = rLayoutPath; }
+ const OUString& getLayoutPath() const { return maLayoutPath; }
+
+ void setTheme( const oox::drawingml::ThemePtr& rThemePtr ){ mpThemePtr = rThemePtr; }
+ const oox::drawingml::ThemePtr& getTheme() const { return mpThemePtr; }
+
+ void setClrMap( const oox::drawingml::ClrMapPtr pClrMapPtr ){ mpClrMapPtr = pClrMapPtr; }
+ const oox::drawingml::ClrMapPtr& getClrMap() const { return mpClrMapPtr; }
+
+ void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr& rFillPropertiesPtr ){ mpBackgroundPropertiesPtr = rFillPropertiesPtr; }
+ const oox::drawingml::FillPropertiesPtr& getBackgroundProperties() const { return mpBackgroundPropertiesPtr; }
+ oox::drawingml::Color& getBackgroundColor() { return maBackgroundColor; }
+
+ bool isMasterPage() const { return mbMaster; }
+ bool isNotesPage() const { return mbNotes; }
+
+ void setLayoutValueToken( sal_Int32 nLayoutValueToken ) { mnLayoutValueToken = nLayoutValueToken; }
+ sal_Int16 getLayoutFromValueToken() const;
+
+
+ const oox::drawingml::TextListStylePtr& getDefaultTextStyle() const { return maDefaultTextStylePtr; }
+ const oox::drawingml::TextListStylePtr& getTitleTextStyle() const { return maTitleTextStylePtr; }
+ const oox::drawingml::TextListStylePtr& getBodyTextStyle() const { return maBodyTextStylePtr; }
+ const oox::drawingml::TextListStylePtr& getNotesTextStyle() const { return maNotesTextStylePtr; }
+ const oox::drawingml::TextListStylePtr& getOtherTextStyle() const { return maOtherTextStylePtr; }
+
+ const oox::drawingml::ShapePtr& getShapes() const { return maShapesPtr; }
+ void hideShapesAsMasterShapes();
+ ::std::vector< std::shared_ptr< TimeNode > >& getTimeNodeList() { return maTimeNodeList; }
+ oox::ppt::HeaderFooter& getHeaderFooter(){ return maHeaderFooter; };
+
+ oox::vml::Drawing* getDrawing() { return mpDrawingPtr.get(); }
+
+ void createXShapes( oox::core::XmlFilterBase& rFilterBase );
+ void createBackground( const oox::core::XmlFilterBase& rFilterBase );
+ void applyTextStyles( const oox::core::XmlFilterBase& rFilterBase );
+
+ std::map< OUString, css::uno::Reference< css::animations::XAnimationNode > >& getAnimNodesMap() { return maAnimNodesMap; };
+ css::uno::Reference<css::animations::XAnimationNode> getAnimationNode(const OUString& sId) const;
+ ::oox::drawingml::ShapePtr getShape( const OUString & id ) { return maShapeMap[ id ]; }
+ ::oox::drawingml::ShapeIdMap& getShapeMap() { return maShapeMap; }
+
+ CommentList& getCommentsList() { return maCommentsList; }
+ CommentAuthorList& getCommentAuthors() { return maCommentAuthors; }
+
+ void createConnectorShapeConnection();
+
+ void addURLShapeId(const OUString& rShapeId) { maURLShapeId.push_back(rShapeId); }
+ std::vector<OUString>& getURLShapeId() { return maURLShapeId; }
+
+private:
+ OUString maPath;
+ OUString maLayoutPath;
+ std::shared_ptr< oox::vml::Drawing > mpDrawingPtr;
+ css::uno::Reference< css::drawing::XDrawPage > mxPage;
+ oox::drawingml::ThemePtr mpThemePtr; // the theme that is used
+ oox::drawingml::ClrMapPtr mpClrMapPtr; // color mapping (if any)
+ SlidePersistPtr mpMasterPagePtr;
+
+ oox::drawingml::ShapePtr maShapesPtr;
+ oox::drawingml::Color maBackgroundColor;
+ oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr;
+ ::std::vector< std::shared_ptr< TimeNode > > maTimeNodeList;
+
+ oox::ppt::HeaderFooter maHeaderFooter;
+ sal_Int32 mnLayoutValueToken;
+ bool mbMaster;
+ bool mbNotes;
+
+ oox::drawingml::TextListStylePtr maDefaultTextStylePtr;
+ oox::drawingml::TextListStylePtr maTitleTextStylePtr;
+ oox::drawingml::TextListStylePtr maBodyTextStylePtr;
+ oox::drawingml::TextListStylePtr maNotesTextStylePtr;
+ oox::drawingml::TextListStylePtr maOtherTextStylePtr;
+
+ std::map< OUString, css::uno::Reference< css::animations::XAnimationNode > > maAnimNodesMap;
+ std::map< OUString, ::oox::drawingml::ShapePtr > maShapeMap;
+
+ // slide comments
+ CommentList maCommentsList;
+ CommentAuthorList maCommentAuthors;
+
+ std::vector<OUString> maConnectorShapeId;
+ std::vector<OUString> maURLShapeId;
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_SLIDEPERSIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidetimingcontext.hxx b/include/oox/ppt/slidetimingcontext.hxx
new file mode 100644
index 000000000..7b147ab85
--- /dev/null
+++ b/include/oox/ppt/slidetimingcontext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_SLIDETIMINGCONTEXT_HXX
+#define INCLUDED_OOX_PPT_SLIDETIMINGCONTEXT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/ppt/timenode.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+
+namespace oox::ppt {
+
+class SlideTimingContext final : public ::oox::core::FragmentHandler2
+{
+public:
+ SlideTimingContext( ::oox::core::FragmentHandler2 const & rParent, TimeNodePtrList & aTimeNodeList ) noexcept;
+ virtual ~SlideTimingContext() noexcept override;
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override;
+
+private:
+ TimeNodePtrList & maTimeNodeList;
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_SLIDETIMINGCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidetransition.hxx b/include/oox/ppt/slidetransition.hxx
new file mode 100644
index 000000000..01603b9fa
--- /dev/null
+++ b/include/oox/ppt/slidetransition.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_OOX_PPT_SLIDETRANSITION_HXX
+#define INCLUDED_OOX_PPT_SLIDETRANSITION_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace animations { class XTransitionFilter; }
+}
+
+namespace oox { class PropertyMap; }
+
+namespace oox::ppt {
+
+ class SlideTransition
+ {
+ public:
+ SlideTransition();
+ explicit SlideTransition(std::u16string_view );
+
+ void setSlideProperties( PropertyMap& props );
+ void setTransitionFilterProperties( const css::uno::Reference< css::animations::XTransitionFilter > & xFilter );
+
+ /// Set one of standard values for slide transition duration
+ void setOoxTransitionSpeed( sal_Int32 nToken );
+ /// Set slide transition time directly
+ void setOoxTransitionSpeed( double fDuration );
+ void setMode( bool bMode )
+ { mbMode = bMode; }
+ void setOoxAdvanceTime( sal_Int32 nAdvanceTime )
+ { mnAdvanceTime = nAdvanceTime; }
+
+ static sal_Int16 ooxToOdpDirection( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpEightDirections( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpCornerDirections( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpBorderDirections( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpSideDirections( ::sal_Int32 nOoxType );
+ static bool ooxToOdpSideDirectionsDirectionNormal( ::sal_Int32 nOoxType );
+
+ void setOoxTransitionType( ::sal_Int32 OoxType,
+ ::sal_Int32 param1, ::sal_Int32 param2 );
+
+ void setPresetTransition(std::u16string_view sPresetTransition);
+
+ private:
+ ::sal_Int16 mnTransitionType;
+ ::sal_Int16 mnTransitionSubType;
+ bool mbTransitionDirectionNormal;
+ css::presentation::AnimationSpeed mnAnimationSpeed;
+ double mfTransitionDurationInSeconds;
+ bool mbMode; /**< https://api.libreoffice.org/docs/common/ref/com/sun/star/animations/XTransitionFilter.html Mode property */
+ ::sal_Int32 mnAdvanceTime;
+ ::sal_Int32 mnTransitionFadeColor;
+ };
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidetransitioncontext.hxx b/include/oox/ppt/slidetransitioncontext.hxx
new file mode 100644
index 000000000..f28b763c6
--- /dev/null
+++ b/include/oox/ppt/slidetransitioncontext.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_SLIDETRANSITIONCONTEXT_HXX
+#define INCLUDED_OOX_PPT_SLIDETRANSITIONCONTEXT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/ppt/slidetransition.hxx>
+#include <sal/types.h>
+
+namespace oox {
+ class AttributeList;
+ class PropertyMap;
+}
+
+namespace oox::ppt {
+
+ class SlideTransitionContext final : public ::oox::core::FragmentHandler2
+ {
+ public:
+ SlideTransitionContext( ::oox::core::FragmentHandler2 const & rParent,
+ const AttributeList& rAttributes,
+ PropertyMap & aProperties ) noexcept;
+ virtual ~SlideTransitionContext() noexcept override;
+
+ virtual void onEndElement() override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override;
+
+
+ private:
+ PropertyMap& maSlideProperties;
+ bool mbHasTransition;
+ bool mbHasTransitionDuration;
+ SlideTransition maTransition;
+ };
+
+}
+
+#endif // INCLUDED_OOX_PPT_SLIDETRANSITIONCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/soundactioncontext.hxx b/include/oox/ppt/soundactioncontext.hxx
new file mode 100644
index 000000000..4bf66a5f7
--- /dev/null
+++ b/include/oox/ppt/soundactioncontext.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_OOX_PPT_SOUNDACTIONCONTEXT_HXX
+#define INCLUDED_OOX_PPT_SOUNDACTIONCONTEXT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox {
+ class AttributeList;
+ class PropertyMap;
+}
+
+namespace oox::ppt {
+
+class SoundActionContext final : public ::oox::core::FragmentHandler2
+{
+public:
+ SoundActionContext( ::oox::core::FragmentHandler2 const & rParent, PropertyMap & aProperties ) noexcept;
+ virtual ~SoundActionContext() noexcept override;
+
+ virtual void onEndElement() override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override;
+
+private:
+ PropertyMap& maSlideProperties;
+ bool mbHasStartSound;
+ bool mbLoopSound;
+ bool mbStopSound;
+ OUString msSndName;
+};
+
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/timenode.hxx b/include/oox/ppt/timenode.hxx
new file mode 100644
index 000000000..195e4472e
--- /dev/null
+++ b/include/oox/ppt/timenode.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_OOX_PPT_TIMENODE_HXX
+#define INCLUDED_OOX_PPT_TIMENODE_HXX
+
+#include <vector>
+#include <map>
+#include <memory>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/ppt/slidetransition.hxx>
+#include <oox/ppt/slidepersist.hxx>
+#include <oox/ppt/animationspersist.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace animations { class XAnimationNode; }
+}
+
+namespace oox::core { class XmlFilterBase; }
+
+namespace oox::ppt {
+
+ class TimeNode;
+
+ typedef std::shared_ptr< TimeNode > TimeNodePtr;
+ typedef std::vector< TimeNodePtr > TimeNodePtrList;
+
+ class TimeNode final
+ {
+ public:
+ typedef ::std::map< OUString, css::uno::Any > UserDataMap;
+
+ TimeNode( sal_Int16 nNodeType );
+ ~TimeNode();
+
+ NodePropertyMap & getNodeProperties() { return maNodeProperties; }
+ UserDataMap & getUserData() { return maUserData; }
+ TimeNodePtrList & getChildren()
+ { return maChildren; }
+
+ void setId( sal_Int32 nId );
+
+ void addNode(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const css::uno::Reference< css::animations::XAnimationNode >& rxNode,
+ const SlidePersistPtr & slide);
+ // data setters
+ void setTo( const css::uno::Any & aTo );
+ void setFrom( const css::uno::Any & aFrom );
+ void setBy( const css::uno::Any & aBy );
+ void setTransitionFilter( const SlideTransition & aTransition)
+ { maTransitionFilter = aTransition; }
+
+ void setNode(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const css::uno::Reference< css::animations::XAnimationNode >& xNode,
+ const SlidePersistPtr & pSlide,
+ const css::uno::Reference< css::animations::XAnimationNode >& xParent);
+
+ AnimTargetElementPtr const & getTarget()
+ {
+ if( !mpTarget )
+ mpTarget = std::make_shared<AnimTargetElement>();
+ return mpTarget;
+ }
+
+ AnimationConditionList &getStartCondition()
+ { return maStCondList; }
+ AnimationConditionList &getEndCondition()
+ { return maEndCondList; }
+ AnimationConditionList &getNextCondition()
+ { return maNextCondList; }
+ AnimationConditionList &getPrevCondition()
+ { return maPrevCondList; }
+ AnimationCondition & getEndSyncValue()
+ { mbHasEndSyncValue = true; return maEndSyncValue; }
+ private:
+
+ static OUString getServiceName( sal_Int16 nNodeType );
+
+ static css::uno::Reference< css::animations::XAnimationNode >
+ createAndInsert(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rServiceName,
+ const css::uno::Reference< css::animations::XAnimationNode >& rxNode );
+
+ const sal_Int16 mnNodeType;
+
+ TimeNodePtrList maChildren;
+
+ OUString msId;
+ NodePropertyMap maNodeProperties;
+ UserDataMap maUserData; // a sequence to be stored as "UserData" property
+ SlideTransition maTransitionFilter;
+ AnimTargetElementPtr mpTarget;
+ bool mbHasEndSyncValue; // set to true if we try to get the endSync.
+ AnimationCondition maEndSyncValue;
+ AnimationConditionList maStCondList, maEndCondList;
+ AnimationConditionList maPrevCondList, maNextCondList;
+ };
+
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/timenodelistcontext.hxx b/include/oox/ppt/timenodelistcontext.hxx
new file mode 100644
index 000000000..82e7e67b9
--- /dev/null
+++ b/include/oox/ppt/timenodelistcontext.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_PPT_TIMENODELISTCONTEXT_HXX
+#define INCLUDED_OOX_PPT_TIMENODELISTCONTEXT_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/ppt/timenode.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace xml::sax { class XFastAttributeList; }
+}
+
+namespace oox { class AttributeList; }
+
+namespace oox::ppt {
+
+
+ class TimeNodeContext : public ::oox::core::FragmentHandler2
+ {
+ public:
+ virtual ~TimeNodeContext() noexcept override;
+
+ static rtl::Reference<TimeNodeContext> makeContext( ::oox::core::FragmentHandler2 const & rParent, sal_Int32 aElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode );
+
+ protected:
+ TimeNodeContext( ::oox::core::FragmentHandler2 const & rParent, sal_Int32 aElement, const TimeNodePtr & pNode ) noexcept;
+
+ sal_Int32 mnElement;
+ TimeNodePtr mpNode;
+ };
+
+
+/** FastParser context for XML_tnLst, XML_subTnLst and XML_childTnLst */
+class TimeNodeListContext final : public ::oox::core::FragmentHandler2
+{
+public:
+ TimeNodeListContext( ::oox::core::FragmentHandler2 const & rParent, TimeNodePtrList & aList ) noexcept;
+
+ virtual ~TimeNodeListContext() noexcept override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override;
+
+
+private:
+ TimeNodePtrList & maList;
+};
+
+}
+
+#endif // INCLUDED_OOX_PPT_TIMENODELISTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/shape/ShapeContextHandler.hxx b/include/oox/shape/ShapeContextHandler.hxx
new file mode 100644
index 000000000..2e108d8cd
--- /dev/null
+++ b/include/oox/shape/ShapeContextHandler.hxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <memory>
+#include <stack>
+#include <cppuhelper/implbase.hxx>
+#include <oox/drawingml/graphicshapecontext.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/core/xmlfilterbase.hxx>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/graphic/XGraphicMapper.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+namespace oox::shape {
+
+class ShapeFilterBase;
+
+class ShapeFragmentHandler final : public core::FragmentHandler2
+{
+public:
+ typedef rtl::Reference<ShapeFragmentHandler> Pointer_t;
+
+ explicit ShapeFragmentHandler(core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath )
+ : FragmentHandler2(rFilter, rFragmentPath)
+ {
+ }
+};
+
+class OOX_DLLPUBLIC ShapeContextHandler final :
+ public ::cppu::WeakImplHelper< css::xml::sax::XFastContextHandler >
+{
+public:
+ explicit ShapeContextHandler(const rtl::Reference<ShapeFilterBase>& xFilterBase);
+
+ virtual ~ShapeContextHandler() override;
+
+ // css::xml::sax::XFastContextHandler:
+ virtual void SAL_CALL startFastElement
+ (::sal_Int32 Element,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+
+ virtual void SAL_CALL startUnknownElement
+ (const OUString & Namespace,
+ const OUString & Name,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+
+ virtual void SAL_CALL endFastElement(::sal_Int32 Element) override;
+
+ virtual void SAL_CALL endUnknownElement
+ (const OUString & Namespace,
+ const OUString & Name) override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext
+ (::sal_Int32 Element,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
+ createUnknownChildContext
+ (const OUString & Namespace,
+ const OUString & Name,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+
+ virtual void SAL_CALL characters(const OUString & aChars) override;
+
+ css::uno::Reference< css::drawing::XShape > getShape();
+
+ void setDrawPage(const css::uno::Reference< css::drawing::XDrawPage > & the_value);
+
+ void setModel(const css::uno::Reference< css::frame::XModel > & the_value);
+
+ void setRelationFragmentPath(const OUString & the_value);
+
+ sal_Int32 getStartToken() const;
+ void popStartToken();
+ void pushStartToken( sal_Int32 _starttoken );
+
+ void setPosition(const css::awt::Point& rPosition);
+
+ const bool& getFullWPGSupport() { return m_bFullWPGSUpport; }
+ void setFullWPGSupport(bool bUse) { m_bFullWPGSUpport = bUse; }
+
+ bool isWordProcessingGroupShape() const { return mxWpgContext ? true : false; }
+
+ void setDocumentProperties(const css::uno::Reference<css::document::XDocumentProperties>& xDocProps);
+ void setMediaDescriptor(const css::uno::Sequence<css::beans::PropertyValue>& rMediaDescriptor);
+
+ void setGraphicMapper(css::uno::Reference<css::graphic::XGraphicMapper> const & rGraphicMapper);
+
+ void setTheme(const oox::drawingml::ThemePtr& pTheme) { mpThemePtr = pTheme; }
+ const oox::drawingml::ThemePtr& getTheme() const { return mpThemePtr; }
+
+private:
+ ShapeContextHandler(ShapeContextHandler const &) = delete;
+ void operator =(ShapeContextHandler const &) = delete;
+
+ // Special stack which always has at least one element.
+ // In case of group shapes with embedded content it will have more element than one.
+ std::stack<sal_uInt32> mnStartTokenStack;
+
+ css::awt::Point maPosition;
+ bool m_bFullWPGSUpport; // Is this DrawingML shape supposed to be processed as WPG?
+
+ drawingml::ShapePtr mpShape;
+ std::shared_ptr< vml::Drawing > mpDrawing;
+
+ typedef rtl::Reference<drawingml::GraphicShapeContext>
+ GraphicShapeContextPtr;
+ css::uno::Reference<XFastContextHandler> mxDrawingFragmentHandler;
+ css::uno::Reference<XFastContextHandler> mxGraphicShapeContext;
+ css::uno::Reference<XFastContextHandler> mxDiagramShapeContext;
+ css::uno::Reference<XFastContextHandler> mxLockedCanvasContext;
+ css::uno::Reference<XFastContextHandler> mxWpsContext;
+ css::uno::Reference<css::drawing::XShape> mxSavedShape;
+ css::uno::Reference<XFastContextHandler> mxWpgContext;
+ css::uno::Reference<XFastContextHandler> mxChartShapeContext;
+ css::uno::Reference<css::document::XDocumentProperties> mxDocumentProperties;
+ css::uno::Sequence<css::beans::PropertyValue> maMediaDescriptor;
+
+ ::rtl::Reference< ShapeFilterBase > mxShapeFilterBase;
+ drawingml::ThemePtr mpThemePtr;
+ css::uno::Reference<css::drawing::XDrawPage> mxDrawPage;
+ OUString msRelationFragmentPath;
+
+ css::uno::Reference<XFastContextHandler> const & getGraphicShapeContext(::sal_Int32 Element);
+ css::uno::Reference<XFastContextHandler> const & getChartShapeContext(::sal_Int32 Element);
+ css::uno::Reference<XFastContextHandler> const & getDrawingShapeContext();
+ css::uno::Reference<XFastContextHandler> const & getDiagramShapeContext();
+ css::uno::Reference<XFastContextHandler> const & getLockedCanvasContext(sal_Int32 nElement);
+ css::uno::Reference<XFastContextHandler> const & getWpsContext(sal_Int32 nStartElement, sal_Int32 nElement);
+ css::uno::Reference<XFastContextHandler> const & getWpgContext(sal_Int32 nElement);
+ css::uno::Reference<XFastContextHandler> getContextHandler(sal_Int32 nElement = 0);
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/shape/ShapeFilterBase.hxx b/include/oox/shape/ShapeFilterBase.hxx
new file mode 100644
index 000000000..477060fa6
--- /dev/null
+++ b/include/oox/shape/ShapeFilterBase.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_SHAPE_SHAPEFILTERBASE_HXX
+#define INCLUDED_OOX_SHAPE_SHAPEFILTERBASE_HXX
+
+#include <memory>
+#include <oox/dllapi.h>
+#include <oox/vml/vmldrawing.hxx>
+#include <oox/core/xmlfilterbase.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <com/sun/star/graphic/XGraphicMapper.hpp>
+#include <rtl/ref.hxx>
+#include <tools/color.hxx>
+
+namespace oox::drawingml::table {
+
+class TableStyleList;
+typedef std::shared_ptr< TableStyleList > TableStyleListPtr;
+
+}
+
+namespace oox::shape {
+
+class OOX_DLLPUBLIC ShapeFilterBase final : public core::XmlFilterBase
+{
+public:
+ typedef rtl::Reference<ShapeFilterBase> Pointer_t;
+
+ /// @throws css::uno::RuntimeException
+ explicit ShapeFilterBase(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+
+ virtual ~ShapeFilterBase() override;
+
+ /** Has to be implemented by each filter, returns the current theme. */
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const override;
+
+ /** May be implemented by filters which handle Diagrams, default returns empty ptr */
+ virtual std::shared_ptr<::oox::drawingml::Theme> getCurrentThemePtr() const override;
+
+ void setCurrentTheme(const ::oox::drawingml::ThemePtr& pTheme);
+
+ /** Has to be implemented by each filter to return the collection of VML shapes. */
+ virtual ::oox::vml::Drawing* getVmlDrawing() override;
+
+ /** Has to be implemented by each filter to return TableStyles. */
+ virtual ::oox::drawingml::table::TableStyleListPtr getTableStyles() override;
+
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter() override;
+
+ virtual bool importDocument() override { return true; }
+ virtual bool exportDocument() override { return true; }
+
+ ::Color getSchemeColor( sal_Int32 nToken ) const;
+
+ void setGraphicMapper(css::uno::Reference<css::graphic::XGraphicMapper> const & rxGraphicMapper)
+ {
+ mxGraphicMapper = rxGraphicMapper;
+ }
+
+private:
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const override;
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual GraphicHelper* implCreateGraphicHelper() const override;
+
+ std::shared_ptr< ::oox::drawingml::chart::ChartConverter > mxChartConv;
+ ::oox::drawingml::ThemePtr mpTheme;
+ css::uno::Reference<css::graphic::XGraphicMapper> mxGraphicMapper;
+};
+
+} // namespace oox::shape
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/token/namespacemap.hxx b/include/oox/token/namespacemap.hxx
new file mode 100644
index 000000000..c02a39ba7
--- /dev/null
+++ b/include/oox/token/namespacemap.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_TOKEN_NAMESPACEMAP_HXX
+#define INCLUDED_OOX_TOKEN_NAMESPACEMAP_HXX
+
+#include <map>
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox
+{
+/** A map that contains all XML namespace URLs used in the filters. */
+struct NamespaceMap
+{
+ std::map<sal_Int32, OUString> maTransitionalNamespaceMap;
+ std::map<sal_Int32, OUString> maStrictNamespaceMap;
+
+ NamespaceMap();
+
+ typedef std::map<sal_Int32, OUString>::iterator iterator;
+ typedef std::map<sal_Int32, OUString>::const_iterator const_iterator;
+};
+
+/** Thread-safe singleton of a map of all supported XML namespace URLs. */
+NamespaceMap& StaticNamespaceMap();
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/token/propertynames.hxx b/include/oox/token/propertynames.hxx
new file mode 100644
index 000000000..91e07cbdd
--- /dev/null
+++ b/include/oox/token/propertynames.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <vector>
+
+#include <rtl/ustring.hxx>
+
+namespace oox
+{
+/** A vector that contains all predefined property names used in the filters. */
+/** Thread-safe singleton of a vector of all supported property names. */
+const std::vector<OUString>& GetPropertyNameVector();
+
+} // namespace oox
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/token/relationship.hxx b/include/oox/token/relationship.hxx
new file mode 100644
index 000000000..3c3a4336f
--- /dev/null
+++ b/include/oox/token/relationship.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OOX_TOKEN_RELATIONSHIP_HXX
+#define INCLUDED_OOX_TOKEN_RELATIONSHIP_HXX
+
+#include <oox/dllapi.h>
+
+#include <rtl/ustring.hxx>
+
+namespace oox
+{
+enum class Relationship
+{
+ ACTIVEXCONTROLBINARY,
+ CHART,
+ CHARTUSERSHAPES,
+ COMMENTS,
+ COMMENTAUTHORS,
+ COMMENTSEXTENDED,
+ CONTROL,
+ CTRLPROP,
+ CUSTOMXML,
+ CUSTOMXMLPROPS,
+ DIAGRAMCOLORS,
+ DIAGRAMDATA,
+ DIAGRAMDRAWING,
+ DIAGRAMLAYOUT,
+ DIAGRAMQUICKSTYLE,
+ DRAWING,
+ ENDNOTES,
+ EXTERNALLINKPATH,
+ FONT,
+ FONTTABLE,
+ FOOTER,
+ FOOTNOTES,
+ GLOSSARYDOCUMENT,
+ HDPHOTO,
+ HEADER,
+ HYPERLINK,
+ IMAGE,
+ MEDIA,
+ NOTESMASTER,
+ NOTESSLIDE,
+ NUMBERING,
+ OFFICEDOCUMENT,
+ OLEOBJECT,
+ PACKAGE,
+ PRESPROPS,
+ SETTINGS,
+ SHAREDSTRINGS,
+ SLIDE,
+ SLIDELAYOUT,
+ SLIDEMASTER,
+ STYLES,
+ THEME,
+ VBAPROJECT,
+ VIDEO,
+ AUDIO,
+ VMLDRAWING,
+ WORDVBADATA,
+ WORKSHEET
+};
+
+OUString OOX_DLLPUBLIC getRelationship(Relationship eRelationship);
+}
+
+#endif // INCLUDED_OOX_TOKEN_RELATIONSHIP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/token/tokenmap.hxx b/include/oox/token/tokenmap.hxx
new file mode 100644
index 000000000..db71c24c2
--- /dev/null
+++ b/include/oox/token/tokenmap.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_TOKEN_TOKENMAP_HXX
+#define INCLUDED_OOX_TOKEN_TOKENMAP_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+#include <vector>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <oox/token/tokens.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/log.hxx>
+#include <sal/types.h>
+
+namespace oox {
+
+
+class TokenMap
+{
+public:
+ explicit TokenMap();
+ ~TokenMap();
+
+ /** Returns the token identifier for the passed Unicode token name. */
+ static sal_Int32 getTokenFromUnicode( std::u16string_view rUnicodeName );
+
+ /** Returns the UTF8 name of the passed token identifier as byte sequence. */
+ css::uno::Sequence< sal_Int8 > const &
+ getUtf8TokenName( sal_Int32 nToken ) const
+ {
+ SAL_WARN_IF(nToken < 0 || nToken >= XML_TOKEN_COUNT, "oox", "Wrong nToken parameter");
+ if (0 <= nToken && nToken < XML_TOKEN_COUNT)
+ return maTokenNames[ nToken ];
+ return EMPTY_BYTE_SEQ;
+ }
+
+ /** Returns the token identifier for the passed UTF8 token name. */
+ sal_Int32 getTokenFromUtf8(
+ const css::uno::Sequence< sal_Int8 >& rUtf8Name ) const
+ {
+ return getTokenFromUTF8( reinterpret_cast< const char * >(
+ rUtf8Name.getConstArray() ),
+ rUtf8Name.getLength() );
+ }
+
+ /** Returns the token identifier for a UTF8 string passed in pToken */
+ sal_Int32 getTokenFromUTF8( const char *pToken, sal_Int32 nLength ) const
+ {
+ // 50% of OOXML tokens are primarily 1 lower-case character, a-z
+ if( nLength == 1)
+ {
+ char c = pToken[0];
+ if (c >= 'a' && c <= 'z')
+ return mnAlphaTokens[ c - 'a' ];
+ }
+ return getTokenPerfectHash( pToken, nLength );
+ }
+
+private:
+ static sal_Int32 getTokenPerfectHash( const char *pToken, sal_Int32 nLength );
+ static const css::uno::Sequence< sal_Int8 > EMPTY_BYTE_SEQ;
+
+ std::vector< css::uno::Sequence< sal_Int8 > >
+ maTokenNames;
+ sal_Int32 mnAlphaTokens[26];
+};
+
+
+TokenMap& StaticTokenMap();
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmldrawing.hxx b/include/oox/vml/vmldrawing.hxx
new file mode 100644
index 000000000..a11bfef0d
--- /dev/null
+++ b/include/oox/vml/vmldrawing.hxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_VML_VMLDRAWING_HXX
+#define INCLUDED_OOX_VML_VMLDRAWING_HXX
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/ole/oleobjecthelper.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace awt { struct Rectangle; }
+ namespace drawing { class XDrawPage; }
+ namespace drawing { class XShape; }
+ namespace drawing { class XShapes; }
+}
+
+namespace oox {
+ namespace core { class XmlFilterBase; }
+ namespace ole { class EmbeddedControl; }
+ namespace ole { class EmbeddedForm; }
+ namespace vml { class ShapeContainer; }
+}
+
+namespace oox::vml {
+
+class ShapeBase;
+
+
+/** Enumerates different types of VML drawings. */
+enum DrawingType
+{
+ VMLDRAWING_WORD, ///< Word: One shape per drawing.
+ VMLDRAWING_EXCEL, ///< Excel: OLE objects are part of VML.
+ VMLDRAWING_POWERPOINT ///< PowerPoint: OLE objects are part of DrawingML.
+};
+
+
+/** Contains information about an OLE object embedded in a draw page. */
+struct OOX_DLLPUBLIC OleObjectInfo : public ::oox::ole::OleObjectInfo
+{
+ OUString maShapeId; ///< Shape identifier for shape lookup.
+ OUString maName; ///< Programmatical name of the OLE object.
+ bool mbAutoLoad;
+ const bool mbDmlShape; ///< True = DrawingML shape (PowerPoint), false = VML shape (Excel/Word).
+
+ explicit OleObjectInfo( bool bDmlShape = false );
+
+ /** Sets the string representation of the passed numeric shape identifier. */
+ void setShapeId( sal_Int32 nShapeId );
+};
+
+// =========================================/===================================
+
+/** Contains information about a form control embedded in a draw page. */
+struct OOX_DLLPUBLIC ControlInfo
+{
+ OUString maShapeId; ///< Shape identifier for shape lookup.
+ OUString maFragmentPath; ///< Path to the fragment describing the form control properties.
+ OUString maName; ///< Programmatical name of the form control.
+ bool mbTextContentShape; ///< Whether this control shape will be imported to Writer or not (has AnchorType property or not).
+
+ explicit ControlInfo();
+
+ /** Sets the string representation of the passed numeric shape identifier. */
+ void setShapeId( sal_Int32 nShapeId );
+};
+
+
+/** Represents the collection of VML shapes for a complete draw page. */
+class OOX_DLLPUBLIC Drawing
+{
+public:
+ explicit Drawing(
+ ::oox::core::XmlFilterBase& rFilter,
+ const css::uno::Reference< css::drawing::XDrawPage >& rxDrawPage,
+ DrawingType eType );
+
+ virtual ~Drawing();
+
+ /** Returns the filter object that imports/exports this VML drawing. */
+ ::oox::core::XmlFilterBase& getFilter() const { return mrFilter; }
+ /** Returns the application type containing the drawing. */
+ DrawingType getType() const { return meType; }
+ /** Returns read/write access to the container of shapes and templates. */
+ ShapeContainer& getShapes() { return *mxShapes; }
+ /** Returns read access to the container of shapes and templates. */
+ const ShapeContainer& getShapes() const { return *mxShapes; }
+ /** Returns the form object used to process ActiveX form controls. */
+ ::oox::ole::EmbeddedForm& getControlForm() const;
+
+ /** Registers a block of shape identifiers reserved by this drawing. Block
+ size is 1024, shape identifiers are one-based (block 1 => 1025-2048). */
+ void registerBlockId( sal_Int32 nBlockId );
+ /** Registers the passed embedded OLE object. The related shape will then
+ load the OLE object data from the specified fragment. */
+ void registerOleObject( const OleObjectInfo& rOleObject );
+ /** Registers the passed embedded form control. The related shape will then
+ load the control properties from the specified fragment. */
+ void registerControl( const ControlInfo& rControl );
+
+ /** Final processing after import of the fragment. */
+ void finalizeFragmentImport();
+
+ /** Creates and inserts all UNO shapes into the draw page. The virtual
+ function notifyXShapeInserted() will be called for each new shape. */
+ void convertAndInsert() const;
+
+ /** Returns the local shape index from the passed global shape identifier. */
+ sal_Int32 getLocalShapeIndex( const OUString& rShapeId ) const;
+ /** Returns the registered info structure for an OLE object, if extant. */
+ const OleObjectInfo* getOleObjectInfo( const OUString& rShapeId ) const;
+ /** Returns the registered info structure for a form control, if extant. */
+ const ControlInfo* getControlInfo( const OUString& rShapeId ) const;
+
+ /** Creates a new UNO shape object, inserts it into the passed UNO shape
+ container, and sets the shape position and size. */
+ css::uno::Reference< css::drawing::XShape >
+ createAndInsertXShape(
+ const OUString& rService,
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect ) const;
+
+ /** Creates a new UNO shape object for a form control, inserts the control
+ model into the form, and the shape into the passed UNO shape container. */
+ css::uno::Reference< css::drawing::XShape >
+ createAndInsertXControlShape(
+ const ::oox::ole::EmbeddedControl& rControl,
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect,
+ sal_Int32& rnCtrlIndex ) const;
+
+ /** Derived classes may disable conversion of specific shapes. */
+ virtual bool isShapeSupported( const ShapeBase& rShape ) const;
+
+ /** Derived classes may return additional base names for automatic shape
+ name creation. */
+ virtual OUString getShapeBaseName( const ShapeBase& rShape ) const;
+
+ /** Derived classes may calculate the shape rectangle from a non-standard
+ anchor information string. */
+ virtual bool convertClientAnchor(
+ css::awt::Rectangle& orShapeRect,
+ const OUString& rShapeAnchor ) const;
+
+ /** Derived classes create a UNO shape according to the passed shape model.
+ Called for shape models that specify being under host control. */
+ virtual css::uno::Reference< css::drawing::XShape >
+ createAndInsertClientXShape(
+ const ShapeBase& rShape,
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect ) const;
+
+ /** Derived classes may want to know that a UNO shape has been inserted.
+ Will be called from the convertAndInsert() implementation.
+ @param bGroupChild True = inserted into a group shape,
+ false = inserted directly into this drawing. */
+ virtual void notifyXShapeInserted(
+ const css::uno::Reference< css::drawing::XShape >& rxShape,
+ const css::awt::Rectangle& rShapeRect,
+ const ShapeBase& rShape, bool bGroupChild );
+
+private:
+ typedef ::std::vector< sal_Int32 > BlockIdVector;
+ typedef ::std::map< OUString, OleObjectInfo > OleObjectInfoMap;
+ typedef ::std::map< OUString, ControlInfo > ControlInfoMap;
+
+ ::oox::core::XmlFilterBase& mrFilter; ///< Filter object that imports/exports the VML drawing.
+ css::uno::Reference< css::drawing::XDrawPage >
+ mxDrawPage; ///< UNO draw page used to insert the shapes.
+ mutable std::unique_ptr<::oox::ole::EmbeddedForm> mxCtrlForm; ///< The control form used to process embedded controls.
+ mutable BlockIdVector maBlockIds; ///< Block identifiers used by this drawing.
+ std::unique_ptr<ShapeContainer> mxShapes; ///< All shapes and shape templates.
+ OleObjectInfoMap maOleObjects; ///< Info about all embedded OLE objects, mapped by shape id.
+ ControlInfoMap maControls; ///< Info about all embedded form controls, mapped by control name.
+ const DrawingType meType; ///< Application type containing the drawing.
+};
+
+
+} // namespace oox::vml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmldrawingfragment.hxx b/include/oox/vml/vmldrawingfragment.hxx
new file mode 100644
index 000000000..f7fa4d0bd
--- /dev/null
+++ b/include/oox/vml/vmldrawingfragment.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_VML_VMLDRAWINGFRAGMENT_HXX
+#define INCLUDED_OOX_VML_VMLDRAWINGFRAGMENT_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace io { class XInputStream; }
+}
+
+namespace oox { class AttributeList; }
+namespace oox::core { class XmlFilterBase; }
+
+namespace oox::vml {
+
+class Drawing;
+
+
+class OOX_DLLPUBLIC DrawingFragment : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit DrawingFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ Drawing& rDrawing );
+
+ virtual css::uno::Reference< css::io::XInputStream >
+ openFragmentStream() const override;
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+
+ virtual void finalizeImport() override;
+
+private:
+ Drawing& mrDrawing;
+};
+
+
+} // namespace oox::vml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx
new file mode 100644
index 000000000..3f7bbe60a
--- /dev/null
+++ b/include/oox/vml/vmlformatting.hxx
@@ -0,0 +1,285 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_VML_VMLFORMATTING_HXX
+#define INCLUDED_OOX_VML_VMLFORMATTING_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+#include <utility>
+#include <vector>
+
+#include <com/sun/star/drawing/PolygonFlags.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/helper.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/degree.hxx>
+
+namespace com::sun::star {
+ namespace awt { struct Point; }
+ namespace drawing { class XShape; }
+}
+
+namespace oox {
+ class GraphicHelper;
+ namespace drawingml { class Color; }
+ namespace drawingml { class ShapePropertyMap; }
+}
+
+namespace oox::vml {
+
+
+typedef ::std::pair< sal_Int32, sal_Int32 > Int32Pair;
+typedef ::std::pair< double, double > DoublePair;
+
+
+namespace ConversionHelper
+{
+ /** Returns two values contained in rValue separated by cSep.
+ */
+ OOX_DLLPUBLIC bool separatePair(
+ std::u16string_view& orValue1, std::u16string_view& orValue2,
+ std::u16string_view rValue, sal_Unicode cSep );
+
+ /** Returns the boolean value from the passed string of a VML attribute.
+ Supported values: 'f', 't', 'false', 'true'. False for anything else.
+ */
+ OOX_DLLPUBLIC bool decodeBool( std::u16string_view rValue );
+
+ /** Converts the passed VML percentage measure string to a normalized
+ floating-point value.
+
+ @param rValue The VML percentage value. This is a floating-point value
+ with optional following '%' or 'f' sign. If the sign is missing, the
+ floating point value will be returned unmodified. If the '%' sign
+ is present, the value will be divided by 100. If the 'f' sign is present,
+ the value will be divided by 65536.
+ */
+ OOX_DLLPUBLIC double decodePercent(
+ std::u16string_view rValue,
+ double fDefValue );
+
+ /** Converts the passed VML rotation value to degrees.
+ See DffPropertyReader::Fix16ToAngle(): in VML, positive rotation
+ angles are clockwise, we have them as counter-clockwise.
+ Additionally, VML type is 0..360, our is 0..36000.
+
+ @param rValue The VML rotation value. This is a floating-point value
+ with optional 'fd' suffix. If the suffix is missing, the floating
+ point value will be returned unmodified. If the 'fd' suffix is
+ present, the value will be divided by 65536.
+ */
+ OOX_DLLPUBLIC Degree100 decodeRotation( std::u16string_view rValue );
+
+ /** Converts the passed VML measure string to EMU (English Metric Units).
+
+ @param rGraphicHelper The graphic helper needed to perform pixel
+ conversion according to the current output device.
+
+ @param rValue The VML measure value. This is a floating-point value
+ with optional measure string following the value.
+
+ @param nRefValue Reference value needed for percentage measure.
+
+ @param bPixelX Set to true if the value is oriented horizontally (e.g.
+ X coordinates, widths). Set to false if the value is oriented
+ vertically (e.g. Y coordinates, heights). This is needed because
+ output devices may specify different width and height for a pixel.
+
+ @param bDefaultAsPixel Set to true if omitted measure unit means
+ pixel. Set to false if omitted measure unit means EMU.
+ */
+ OOX_DLLPUBLIC sal_Int64 decodeMeasureToEmu(
+ const GraphicHelper& rGraphicHelper,
+ std::u16string_view rValue,
+ sal_Int32 nRefValue,
+ bool bPixelX,
+ bool bDefaultAsPixel );
+
+ /** Converts the passed VML measure string to 1/100 mm.
+
+ @param rGraphicHelper See above.
+ @param rValue See above.
+ @param nRefValue See above.
+ @param bPixelX See above.
+ @param bDefaultAsPixel See above.
+ */
+ OOX_DLLPUBLIC sal_Int32 decodeMeasureToHmm(
+ const GraphicHelper& rGraphicHelper,
+ std::u16string_view rValue,
+ sal_Int32 nRefValue,
+ bool bPixelX,
+ bool bDefaultAsPixel );
+
+/** Converts the passed VML measure string to Twip.
+
+ @param rGraphicHelper See above.
+ @param rValue See above.
+ @param nRefValue See above.
+ @param bPixelX See above.
+ @param bDefaultAsPixel See above.
+ */
+OOX_DLLPUBLIC sal_Int32 decodeMeasureToTwip(const GraphicHelper& rGraphicHelper,
+ std::u16string_view rValue, sal_Int32 nRefValue,
+ bool bPixelX, bool bDefaultAsPixel);
+
+ /** Converts VML color attributes to a DrawingML color.
+
+ @param roVmlColor The VML string representation of the color. If
+ existing, this can be a 3-digit or 6-digit hexadecimal RGB value
+ with leading '#' character, a predefined color name (e.g. 'black',
+ 'red', etc.), the index into an application defined color palette
+ in brackets with leading color name (e.g. 'red [9]' or
+ 'windowColor [64]'), or a color modifier used in one-color
+ gradients (e.g. 'fill darken(128)' or 'fill lighten(0)').
+
+ @param roVmlOpacity The opacity of the color. If existing, this should
+ be a floating-point value in the range [0.0;1.0].
+
+ @param nDefaultRgb Default RGB color used if the parameter roVmlColor
+ is empty.
+
+ @param nPrimaryRgb If set to something else than API_RGB_TRANSPARENT,
+ specifies the color to be used to resolve the color modifiers used
+ in one-color gradients.
+
+ @return The resulting DrawingML color.
+ */
+ OOX_DLLPUBLIC ::oox::drawingml::Color decodeColor(
+ const GraphicHelper& rGraphicHelper,
+ const OptValue< OUString >& roVmlColor,
+ const OptValue< double >& roVmlOpacity,
+ ::Color nDefaultRgb,
+ ::Color nPrimaryRgb = API_RGB_TRANSPARENT );
+
+ /** Converts VML path string into point and flag vectors.
+
+ @param rPoints The point vector to fill with coordinates.
+
+ @param rFlags The flag vector to fill. PolygonFlags_NORMAL indicates
+ a corresponding plain shape coordinate in rPoints and
+ PolygonFlags_CONTROL indicates a bezier curve control point.
+
+ @param rPath The VML path string.
+
+ @param rGraphicHelper See above.
+ */
+ OOX_DLLPUBLIC void decodeVmlPath(
+ ::std::vector< ::std::vector< css::awt::Point > >& rPoints,
+ ::std::vector< ::std::vector< css::drawing::PolygonFlags > >& rFlags,
+ const OUString& rPath );
+}
+
+
+/** The stroke arrow model structure contains all properties for a line end arrow. */
+struct StrokeArrowModel
+{
+ OptValue< sal_Int32 > moArrowType;
+ OptValue< sal_Int32 > moArrowWidth;
+ OptValue< sal_Int32 > moArrowLength;
+
+ void assignUsed( const StrokeArrowModel& rSource );
+};
+
+
+/** The stroke model structure contains all shape border properties. */
+struct StrokeModel
+{
+ OptValue< bool > moStroked; ///< Shape border line on/off.
+ StrokeArrowModel maStartArrow; ///< Start line arrow style.
+ StrokeArrowModel maEndArrow; ///< End line arrow style.
+ OptValue< OUString > moColor; ///< Solid line color.
+ OptValue< double > moOpacity; ///< Solid line color opacity.
+ OptValue< OUString > moWeight; ///< Line width.
+ OptValue< OUString > moDashStyle; ///< Line dash (predefined or manually).
+ OptValue< sal_Int32 > moLineStyle; ///< Line style (single, double, ...).
+ OptValue< sal_Int32 > moEndCap; ///< Type of line end cap.
+ OptValue< sal_Int32 > moJoinStyle; ///< Type of line join.
+
+ void assignUsed( const StrokeModel& rSource );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ::oox::drawingml::ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper ) const;
+};
+
+
+/** The fill model structure contains all shape fill properties. */
+struct OOX_DLLPUBLIC FillModel
+{
+ OptValue< bool > moFilled; ///< Shape fill on/off.
+ OptValue< OUString > moColor; ///< Solid fill color.
+ OptValue< double > moOpacity; ///< Solid fill color opacity.
+ OptValue< OUString > moColor2; ///< End color of gradient.
+ OptValue< double > moOpacity2; ///< End color opacity of gradient.
+ OptValue< sal_Int32 > moType; ///< Fill type.
+ OptValue< sal_Int32 > moAngle; ///< Gradient rotation angle.
+ OptValue< double > moFocus; ///< Linear gradient focus of second color.
+ OptValue< DoublePair > moFocusPos; ///< Rectangular gradient focus position of second color.
+ OptValue< DoublePair > moFocusSize; ///< Rectangular gradient focus size of second color.
+ OptValue< OUString > moBitmapPath; ///< Path to fill bitmap fragment.
+ OptValue< bool > moRotate; ///< True = rotate gradient/bitmap with shape.
+
+ void assignUsed( const FillModel& rSource );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ::oox::drawingml::ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper ) const;
+};
+
+
+/** The shadow model structure contains all shape shadow properties. */
+struct OOX_DLLPUBLIC ShadowModel
+{
+ bool mbHasShadow; ///< Is a v:shadow element seen?
+ OptValue<bool> moShadowOn; ///< Is the element turned on?
+ OptValue<OUString> moColor; ///< Specifies the color of the shadow.
+ OptValue<OUString> moOffset; ///< Specifies the shadow's offset from the shape's location.
+ OptValue<double> moOpacity; ///< Specifies the opacity of the shadow.
+
+ ShadowModel();
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper) const;
+};
+
+/** The shadow model structure contains all shape textpath properties. */
+struct TextpathModel
+{
+ OptValue<OUString> moString; ///< Specifies the string of the textpath.
+ OptValue<OUString> moStyle; ///< Specifies the style of the textpath.
+ OptValue<bool> moTrim; ///< Specifies whether extra space is removed above and below the text
+
+ TextpathModel();
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const css::uno::Reference<css::drawing::XShape>& xShape,
+ const GraphicHelper& rGraphicHelper) const;
+};
+
+} // namespace oox::vml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlinputstream.hxx b/include/oox/vml/vmlinputstream.hxx
new file mode 100644
index 000000000..df074834f
--- /dev/null
+++ b/include/oox/vml/vmlinputstream.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_VML_VMLINPUTSTREAM_HXX
+#define INCLUDED_OOX_VML_VMLINPUTSTREAM_HXX
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <rtl/string.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace io { class XTextInputStream2; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox::vml {
+
+
+/** An input stream class for VML streams, implementing the UNO interface
+ com.sun.star.io.XInputStream needed by the Expat XML parsers.
+
+ This stream reads the data from the input stream passed to the constructor,
+ and parses all XML elements for features unsupported by the current Expat
+ XML parser:
+
+ 1) All elements that have the form '<![inst]>' where 'inst' is any string
+ not containing the characters '<' and '>' are stripped from the input
+ stream.
+
+ 2) Multiple occurrences of the same attribute in an element but the last
+ are removed.
+
+ 3) Line breaks represented by a single <br> element (without matching
+ </br> element) are replaced by a literal LF character.
+ */
+class InputStream final : public ::cppu::WeakImplHelper< css::io::XInputStream >
+{
+public:
+ explicit InputStream(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XInputStream >& rxInStrm );
+ virtual ~InputStream() override;
+
+ virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) override;
+ virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) override;
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
+ virtual sal_Int32 SAL_CALL available() override;
+ virtual void SAL_CALL closeInput() override;
+
+private:
+ /// @throws css::io::IOException
+ /// @throws css::uno::RuntimeException
+ void updateBuffer();
+ /// @throws css::io::IOException
+ /// @throws css::uno::RuntimeException
+ OString readToElementBegin();
+ /// @throws css::io::IOException
+ /// @throws css::uno::RuntimeException
+ OString readToElementEnd();
+
+private:
+ css::uno::Reference< css::io::XTextInputStream2 >
+ mxTextStrm;
+ css::uno::Sequence< sal_Unicode > maOpeningBracket;
+ css::uno::Sequence< sal_Unicode > maClosingBracket;
+ OString maBuffer;
+ sal_Int32 mnBufferPos;
+};
+
+
+} // namespace oox::vml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
new file mode 100644
index 000000000..7a17bda51
--- /dev/null
+++ b/include/oox/vml/vmlshape.hxx
@@ -0,0 +1,476 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_VML_VMLSHAPE_HXX
+#define INCLUDED_OOX_VML_VMLSHAPE_HXX
+
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/helper.hxx>
+#include <oox/vml/vmlformatting.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace awt { struct Rectangle; }
+ namespace drawing { class XShape; }
+ namespace drawing { class XShapes; }
+ namespace graphic { class XGraphic; }
+}
+
+namespace oox::vml {
+
+class Drawing;
+struct ShapeParentAnchor;
+class ShapeContainer;
+class TextBox;
+
+const sal_Int32 VML_CLIENTDATA_UNCHECKED = 0;
+const sal_Int32 VML_CLIENTDATA_CHECKED = 1;
+const sal_Int32 VML_CLIENTDATA_MIXED = 2;
+
+const sal_Int32 VML_CLIENTDATA_TEXT = 0;
+const sal_Int32 VML_CLIENTDATA_INTEGER = 1;
+const sal_Int32 VML_CLIENTDATA_NUMBER = 2;
+const sal_Int32 VML_CLIENTDATA_REFERENCE = 3;
+const sal_Int32 VML_CLIENTDATA_FORMULA = 4;
+
+
+/** The shape model structure contains all properties shared by all types of shapes. */
+struct ShapeTypeModel
+{
+ OUString maShapeId; ///< Unique identifier of the shape.
+ OUString maLegacyId; ///< Plaintext identifier of the shape.
+ OUString maShapeName; ///< Name of the shape, if present.
+ OptValue< sal_Int32 > moShapeType; ///< Builtin shape type identifier.
+
+ OptValue< Int32Pair > moCoordPos; ///< Top-left position of coordinate system for children scaling.
+ OptValue< Int32Pair > moCoordSize; ///< Size of coordinate system for children scaling.
+ OUString maPosition; ///< Position type of the shape.
+ OUString maZIndex; ///< ZIndex of the shape
+ OUString maLeft; ///< X position of the shape bounding box (number with unit).
+ OUString maTop; ///< Y position of the shape bounding box (number with unit).
+ OUString maWidth; ///< Width of the shape bounding box (number with unit).
+ OUString maHeight; ///< Height of the shape bounding box (number with unit).
+ OUString maMarginLeft; ///< X position of the shape bounding box to shape anchor (number with unit).
+ OUString maMarginTop; ///< Y position of the shape bounding box to shape anchor (number with unit).
+ OUString maPositionHorizontalRelative; ///< The X position is relative to this.
+ OUString maPositionVerticalRelative; ///< The Y position is relative to this.
+ OUString maPositionHorizontal; ///< The X position orientation (default: absolute).
+ OUString maPositionVertical; ///< The Y position orientation.
+ OUString maWidthPercent; ///< The width in percents of the WidthRelative
+ OUString maHeightPercent; ///< The height in percents of the HeightRelative
+ OUString maWidthRelative; ///< To what the width is relative
+ OUString maHeightRelative; ///< To what the height is relative
+ OUString maRotation; ///< Rotation of the shape, in degrees.
+ OUString maFlip; ///< Flip type of the shape (can be "x" or "y").
+ bool mbAutoHeight; ///< If true, the height value is a minimum value (mostly used for textboxes)
+ bool mbVisible; ///< Visible or Hidden
+ OUString maWrapStyle; ///< Wrapping mode for text.
+ OUString maArcsize; ///< round rectangles arc size
+ OUString maEditAs; ///< Edit As type (e.g. "canvas" etc)
+ OUString maAdjustments; ///< Shape adjustment values
+
+ StrokeModel maStrokeModel; ///< Border line formatting.
+ FillModel maFillModel; ///< Shape fill formatting.
+ ShadowModel maShadowModel; ///< Shape shadow formatting.
+ TextpathModel maTextpathModel; ///< Shape textpath formatting.
+
+ OptValue< OUString > moGraphicPath; ///< Path to a graphic for this shape.
+ OptValue< OUString > moGraphicTitle; ///< Title of the graphic.
+ OptValue< OUString > moWrapAnchorX; ///< The base object from which our horizontal positioning should be calculated.
+ OptValue< OUString > moWrapAnchorY; ///< The base object from which our vertical positioning should be calculated.
+ OptValue< OUString > moWrapType; ///< How to wrap the text around the object
+ OptValue< OUString > moWrapSide; ///< On which side to wrap the text around the object
+ OUString maVTextAnchor; ///< How the text inside the shape is anchored vertically.
+ OUString maWrapDistanceLeft; ///< Distance from the left side of the shape to the text that wraps around it.
+ OUString maWrapDistanceRight; ///< Distance from the right side of the shape to the text that wraps around it.
+ OUString maWrapDistanceTop; ///< Distance from the top of the shape to the text that wraps around it.
+ OUString maWrapDistanceBottom; ///< Distance from the bottom of the shape to the text that wraps around it.
+ OptValue<OUString> moCropBottom; ///< Specifies the how much to crop the image from the bottom up as a fraction of picture size.
+ OptValue<OUString> moCropLeft; ///< Specifies how much to crop the image from the left in as a fraction of picture size.
+ OptValue<OUString> moCropRight; ///< Specifies how much to crop the image from the right in as a fraction of picture size.
+ OptValue<OUString> moCropTop; ///< Specifies how much to crop the image from the top down as a fraction of picture size.
+ OUString maLayoutFlowAlt; ///< Specifies the alternate layout flow for text in textboxes.
+
+ /// An adjustment for the intensity of all colors, i.e. contrast, on a 0..0x10000 scale.
+ sal_Int32 mnGain = 0x10000;
+
+ /// The image brightness, on a 0..0x10000 scale.
+ sal_Int16 mnBlacklevel = 0;
+
+ explicit ShapeTypeModel();
+
+ void assignUsed( const ShapeTypeModel& rSource );
+};
+
+
+/** A shape template contains all formatting properties of shapes and can serve
+ as templates for several shapes in a drawing. */
+class SAL_DLLPUBLIC_RTTI ShapeType
+{
+public:
+ explicit ShapeType( Drawing& rDrawing );
+ virtual ~ShapeType();
+
+ /** Returns read/write access to the shape template model structure. */
+ ShapeTypeModel& getTypeModel() { return maTypeModel; }
+ /** Returns read access to the shape template model structure. */
+ const ShapeTypeModel& getTypeModel() const { return maTypeModel; }
+
+ /** Returns the shape identifier (which is unique through the containing drawing). */
+ const OUString& getShapeId() const { return maTypeModel.maShapeId; }
+ /** Returns the application defined shape type. */
+ sal_Int32 getShapeType() const;
+ /** Returns the fragment path to the embedded graphic used by this shape. */
+ OUString getGraphicPath() const;
+
+ const Drawing& getDrawing() const { return mrDrawing; }
+
+protected:
+ /** Returns the coordinate system of this shape. */
+ css::awt::Rectangle getCoordSystem() const;
+ /** Returns the absolute shape rectangle according to the passed anchor. */
+ css::awt::Rectangle getRectangle( const ShapeParentAnchor* pParentAnchor ) const;
+ /** Returns the absolute shape rectangle. */
+ virtual css::awt::Rectangle getAbsRectangle() const;
+ /** Returns the rectangle relative to the parent coordinate system. */
+ virtual css::awt::Rectangle getRelRectangle() const;
+
+protected:
+ Drawing& mrDrawing; ///< The VML drawing page that contains this shape.
+ ShapeTypeModel maTypeModel; ///< The model structure containing shape type data.
+};
+
+
+/** Excel specific shape client data (such as cell anchor). */
+struct ClientData
+{
+ OUString maAnchor; ///< Cell anchor as comma-separated string.
+ OUString maFmlaMacro; ///< Link to macro associated to the control.
+ OUString maFmlaPict; ///< Target cell range of picture links.
+ OUString maFmlaLink; ///< Link to value cell associated to the control.
+ OUString maFmlaRange; ///< Link to cell range used as data source for the control.
+ OUString maFmlaGroup; ///< Link to value cell associated to a group of option buttons.
+ sal_Int32 mnObjType; ///< Type of the shape.
+ sal_Int32 mnTextHAlign; ///< Horizontal text alignment.
+ sal_Int32 mnTextVAlign; ///< Vertical text alignment.
+ sal_Int32 mnCol; ///< Column index for spreadsheet cell note.
+ sal_Int32 mnRow; ///< Row index for spreadsheet cell note.
+ sal_Int32 mnChecked; ///< State for checkboxes and option buttons.
+ sal_Int32 mnDropStyle; ///< Drop down box style (read-only or editable).
+ sal_Int32 mnDropLines; ///< Number of lines in drop down box.
+ sal_Int32 mnVal; ///< Current value of spin buttons and scroll bars.
+ sal_Int32 mnMin; ///< Minimum value of spin buttons and scroll bars.
+ sal_Int32 mnMax; ///< Maximum value of spin buttons and scroll bars.
+ sal_Int32 mnInc; ///< Small increment of spin buttons and scroll bars.
+ sal_Int32 mnPage; ///< Large increment of spin buttons and scroll bars.
+ sal_Int32 mnSelType; ///< Listbox selection type.
+ sal_Int32 mnVTEdit; ///< Data type of the textbox.
+ bool mbPrintObject; ///< True = print the object.
+ bool mbVisible; ///< True = cell note is visible.
+ bool mbDde; ///< True = object is linked through DDE.
+ bool mbNo3D; ///< True = flat style, false = 3D style.
+ bool mbNo3D2; ///< True = flat style, false = 3D style (listboxes and dropdowns).
+ bool mbMultiLine; ///< True = textbox allows line breaks.
+ bool mbVScroll; ///< True = textbox has a vertical scrollbar.
+ bool mbSecretEdit; ///< True = textbox is a password edit field.
+
+ explicit ClientData();
+};
+
+
+struct ShapeModel
+{
+ typedef ::std::vector< css::awt::Point > PointVector;
+
+ OUString maType; ///< Shape template with default properties.
+ PointVector maPoints; ///< Points for the polyline shape.
+ std::unique_ptr<TextBox> mxTextBox; ///< Text contents and properties.
+ std::unique_ptr<ClientData> mxClientData; ///< Excel specific client data.
+ OUString maLegacyDiagramPath;///< Legacy Diagram Fragment Path
+ OUString maFrom; ///< Start point for line shape.
+ OUString maTo; ///< End point for line shape.
+ OUString maControl1; ///< Bezier control point 1
+ OUString maControl2; ///< Bezier control point 2
+ OUString maVmlPath; ///< VML path for this shape
+ bool mbIsSignatureLine; ///< Shape is a signature line
+ OUString maSignatureId; ///< ID of the signature
+ OUString maSignatureLineSuggestedSignerName;
+ OUString maSignatureLineSuggestedSignerTitle;
+ OUString maSignatureLineSuggestedSignerEmail;
+ OUString maSignatureLineSigningInstructions;
+ bool mbSignatureLineShowSignDate;
+ bool mbSignatureLineCanAddComment;
+ bool mbInGroup;
+ OUString maHyperlink; ///< The hyperlink assigned to the shape
+
+ explicit ShapeModel();
+ ~ShapeModel();
+
+ /** Creates and returns a new shape textbox structure. */
+ TextBox& createTextBox(ShapeTypeModel& rModel);
+ /** Creates and returns a new shape client data structure. */
+ ClientData& createClientData();
+};
+
+
+/** A shape object that is part of a drawing. May inherit properties from a
+ shape template. */
+class OOX_DLLPUBLIC ShapeBase : public ShapeType
+{
+public:
+ /** Returns read/write access to the shape model structure. */
+ ShapeModel& getShapeModel() { return maShapeModel; }
+ /** Returns read access to the shape model structure. */
+ const ShapeModel& getShapeModel() const { return maShapeModel; }
+
+ /** Returns read access to the shape textbox. */
+ const TextBox* getTextBox() const { return maShapeModel.mxTextBox.get(); }
+ /** Returns read access to the shape client data structure. */
+ const ClientData* getClientData() const { return maShapeModel.mxClientData.get(); }
+
+ /** Final processing after import of the drawing fragment. */
+ virtual void finalizeFragmentImport();
+
+ /** Returns the real shape name if existing, or a generated shape name. */
+ OUString getShapeName() const;
+
+ /** Returns the shape template with the passed identifier from the child shapes. */
+ virtual const ShapeType* getChildTypeById( const OUString& rShapeId ) const;
+ /** Returns the shape with the passed identifier from the child shapes. */
+ virtual const ShapeBase* getChildById( const OUString& rShapeId ) const;
+
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ css::uno::Reference< css::drawing::XShape >
+ convertAndInsert(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const ShapeParentAnchor* pParentAnchor = nullptr ) const;
+
+ /** Converts position and formatting into the passed existing XShape. */
+ void convertFormatting(
+ const css::uno::Reference< css::drawing::XShape >& rxShape ) const;
+
+ void setContainer(ShapeContainer* pContainer);
+ ShapeContainer* getContainer() const;
+
+protected:
+ explicit ShapeBase( Drawing& rDrawing );
+
+ /** Derived classes create the corresponding XShape and insert it into the passed container. */
+ virtual css::uno::Reference< css::drawing::XShape >
+ implConvertAndInsert(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect ) const = 0;
+
+ /** Always called after implConvertAndInsert for the same task.*/
+ virtual css::uno::Reference<css::drawing::XShape> finalImplConvertAndInsert(
+ const css::uno::Reference<css::drawing::XShape>& rxShape) const
+ {
+ return rxShape;
+ };
+
+ /** Calculates the final shape rectangle according to the passed anchor,
+ if present, otherwise according to the own anchor settings. */
+ css::awt::Rectangle calcShapeRectangle(
+ const ShapeParentAnchor* pParentAnchor ) const;
+
+ /** Converts common shape properties such as formatting attributes. */
+ void convertShapeProperties(
+ const css::uno::Reference< css::drawing::XShape >& rxShape ) const;
+
+protected:
+ ShapeModel maShapeModel; ///< The model structure containing shape data.
+ ShapeContainer* mpContainer = nullptr;
+};
+
+
+/** A simple shape object based on a specific UNO shape service. */
+class SimpleShape : public ShapeBase
+{
+public:
+ explicit SimpleShape( Drawing& rDrawing, const OUString& rService );
+
+ void setService( const OUString& aService ) { maService = aService; }
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual css::uno::Reference< css::drawing::XShape >
+ implConvertAndInsert(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect ) const override;
+ virtual css::uno::Reference<css::drawing::XShape> finalImplConvertAndInsert(
+ const css::uno::Reference<css::drawing::XShape>& rxShape) const override;
+ /** Used by both RectangleShape and ComplexShape. */
+ css::uno::Reference<css::drawing::XShape>createEmbeddedPictureObject(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect, OUString const & rGraphicPath ) const;
+
+ css::uno::Reference<css::drawing::XShape>createPictureObject(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect,
+ css::uno::Reference<css::graphic::XGraphic> const & rxGraphic) const;
+
+private:
+ OUString maService; ///< Name of the UNO shape service.
+};
+
+
+/** A rectangular shape object. */
+class RectangleShape final : public SimpleShape
+{
+public:
+ explicit RectangleShape( Drawing& rDrawing );
+private:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual css::uno::Reference<css::drawing::XShape>
+ implConvertAndInsert(
+ const css::uno::Reference<css::drawing::XShapes>& rxShapes,
+ const css::awt::Rectangle& rShapeRect) const override;
+};
+
+
+/** An oval shape object. */
+class EllipseShape final : public SimpleShape
+{
+public:
+ explicit EllipseShape( Drawing& rDrawing );
+};
+
+
+/** A polygon shape object. */
+class PolyLineShape final : public SimpleShape
+{
+public:
+ explicit PolyLineShape( Drawing& rDrawing );
+
+private:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual css::uno::Reference< css::drawing::XShape >
+ implConvertAndInsert(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect ) const override;
+};
+
+/** A Line shape object. */
+class LineShape final : public SimpleShape
+{
+public:
+ explicit LineShape( Drawing& rDrawing );
+ virtual css::uno::Reference< css::drawing::XShape >
+ implConvertAndInsert(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect ) const override;
+
+
+private:
+ /** Returns the absolute shape rectangle. */
+ virtual css::awt::Rectangle getAbsRectangle() const override;
+ /** Returns the rectangle relative to the parent coordinate system. */
+ virtual css::awt::Rectangle getRelRectangle() const override;
+};
+
+/** Bezier shape object that supports to, from, control1 and control2
+ attribute or path attribute specification */
+class BezierShape final : public SimpleShape
+{
+public:
+ explicit BezierShape( Drawing& rDrawing );
+
+private:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual css::uno::Reference< css::drawing::XShape >
+ implConvertAndInsert(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect ) const override;
+};
+
+
+/** A shape object with custom geometry. */
+class CustomShape : public SimpleShape
+{
+public:
+ explicit CustomShape( Drawing& rDrawing );
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual css::uno::Reference< css::drawing::XShape >
+ implConvertAndInsert(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect ) const override;
+};
+
+
+/** A complex shape object. This can be a picture shape, a custom shape, an OLE
+ object, or an ActiveX form control. */
+class ComplexShape final : public CustomShape
+{
+public:
+ explicit ComplexShape( Drawing& rDrawing );
+
+private:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual css::uno::Reference< css::drawing::XShape >
+ implConvertAndInsert(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect ) const override;
+};
+
+
+/** A group shape that extends the basic shape by a container of child shapes. */
+class GroupShape final : public ShapeBase
+{
+public:
+ explicit GroupShape( Drawing& rDrawing );
+ virtual ~GroupShape() override;
+
+ /** Returns read/write access to the container of child shapes and templates. */
+ ShapeContainer& getChildren() { return *mxChildren; }
+ /** Returns read access to the container of child shapes and templates. */
+ const ShapeContainer& getChildren() const { return *mxChildren; }
+
+ /** Final processing after import of the drawing fragment. */
+ virtual void finalizeFragmentImport() override;
+
+ /** Returns the shape template with the passed identifier from the child shapes. */
+ virtual const ShapeType* getChildTypeById( const OUString& rShapeId ) const override;
+ /** Returns the shape with the passed identifier from the child shapes. */
+ virtual const ShapeBase* getChildById( const OUString& rShapeId ) const override;
+
+private:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual css::uno::Reference< css::drawing::XShape >
+ implConvertAndInsert(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const css::awt::Rectangle& rShapeRect ) const override;
+
+private:
+ std::unique_ptr<ShapeContainer> mxChildren; ///< Shapes and templates that are part of this group.
+};
+
+
+} // namespace oox::vml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlshapecontainer.hxx b/include/oox/vml/vmlshapecontainer.hxx
new file mode 100644
index 000000000..6f50730bc
--- /dev/null
+++ b/include/oox/vml/vmlshapecontainer.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_VML_VMLSHAPECONTAINER_HXX
+#define INCLUDED_OOX_VML_VMLSHAPECONTAINER_HXX
+
+#include <cstddef>
+#include <functional>
+#include <memory>
+#include <stack>
+
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/helper/refmap.hxx>
+#include <oox/helper/refvector.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star {
+ namespace drawing { class XShapes; }
+}
+
+namespace oox::vml {
+
+class Drawing;
+class ShapeType;
+class ShapeBase;
+
+
+struct ShapeParentAnchor
+{
+ css::awt::Rectangle maShapeRect;
+ css::awt::Rectangle maCoordSys;
+};
+
+
+/** Container that holds a list of shapes and shape templates. */
+class ShapeContainer
+{
+public:
+ explicit ShapeContainer( Drawing& rDrawing );
+ ~ShapeContainer();
+
+ /** Returns the drawing this shape container is part of. */
+ Drawing& getDrawing() { return mrDrawing; }
+
+ /** Creates and returns a new shape template object. */
+ std::shared_ptr<ShapeType> createShapeType();
+ /** Creates and returns a new shape object of the specified type. */
+ template< typename ShapeT >
+ std::shared_ptr<ShapeT> createShape();
+
+ /** Final processing after import of the drawing fragment. */
+ void finalizeFragmentImport();
+
+ /** Returns true, if this container does not contain any shapes. */
+ bool empty() const { return maShapes.empty(); }
+
+ /** Returns the shape template with the passed identifier.
+ Searches in all group shapes too. */
+ const ShapeType* getShapeTypeById( const OUString& rShapeId ) const;
+ /** Returns the shape with the passed identifier.
+ Searches in all group shapes too. */
+ const ShapeBase* getShapeById( const OUString& rShapeId ) const;
+
+ /** Searches for a shape by using the passed functor that takes a constant
+ reference of a ShapeBase object. */
+ template< typename Functor >
+ const ShapeBase* findShape( const Functor& rFunctor ) const;
+
+ /**
+ (Word only) Returns the last shape in the collection, if it is after the last
+ mark from pushMark(), and removes it.
+ */
+ std::shared_ptr< ShapeBase > takeLastShape();
+ /**
+ Adds a recursion mark to the stack. It is possible that a shape contains <w:txbxContent>
+ which contains another shape, and writerfilter needs to know which shape is from the inner
+ ooxml context and which from the outer ooxml context, while it is necessary to keep
+ at least shape types across such blocks. Therefore this function marks beginning
+ of each shape xml block, and takeLastShape() returns only shapes from this block.
+ */
+ void pushMark();
+ /**
+ Removes a recursion mark.
+ */
+ void popMark();
+
+ /** Creates and inserts all UNO shapes into the passed container. */
+ void convertAndInsert(
+ const css::uno::Reference< css::drawing::XShapes >& rxShapes,
+ const ShapeParentAnchor* pParentAnchor = nullptr ) const;
+
+private:
+ typedef RefVector< ShapeType > ShapeTypeVector;
+ typedef RefVector< ShapeBase > ShapeVector;
+ typedef RefMap< OUString, ShapeType > ShapeTypeMap;
+ typedef RefMap< OUString, ShapeBase > ShapeMap;
+
+ Drawing& mrDrawing; ///< The VML drawing page that contains this shape.
+ ShapeTypeVector maTypes; ///< All shape templates.
+ ShapeVector maShapes; ///< All shape definitions.
+ ShapeTypeMap maTypesById; ///< All shape templates mapped by identifier.
+ ShapeMap maShapesById; ///< All shape definitions mapped by identifier.
+ std::stack< size_t > markStack; ///< Recursion marks from pushMark()/popMark().
+};
+
+
+template< typename ShapeT >
+std::shared_ptr<ShapeT> ShapeContainer::createShape()
+{
+ auto xShape = std::make_shared<ShapeT>( mrDrawing );
+ xShape->setContainer(this);
+ maShapes.push_back( xShape );
+ return xShape;
+}
+
+template< typename Functor >
+const ShapeBase* ShapeContainer::findShape( const Functor& rFunctor ) const
+{
+ return maShapes.findIf( rFunctor ).get();
+}
+
+
+} // namespace oox::vml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlshapecontext.hxx b/include/oox/vml/vmlshapecontext.hxx
new file mode 100644
index 000000000..ce838297c
--- /dev/null
+++ b/include/oox/vml/vmlshapecontext.hxx
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_VML_VMLSHAPECONTEXT_HXX
+#define INCLUDED_OOX_VML_VMLSHAPECONTEXT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/contexthandler2.hxx>
+#include <oox/helper/helper.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+
+namespace oox::vml {
+
+class Drawing;
+
+struct ShapeTypeModel;
+class ShapeType;
+
+struct ClientData;
+struct ShapeModel;
+class ShapeBase;
+class GroupShape;
+class RectangleShape;
+
+class ShapeContainer;
+
+
+class ShapeLayoutContext final : public ::oox::core::ContextHandler2
+{
+public:
+ explicit ShapeLayoutContext(
+ ::oox::core::ContextHandler2Helper const & rParent,
+ Drawing& rDrawing );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+
+private:
+ Drawing& mrDrawing;
+};
+
+
+class ClientDataContext final : public ::oox::core::ContextHandler2
+{
+public:
+ explicit ClientDataContext(
+ ::oox::core::ContextHandler2Helper const & rParent,
+ ClientData& rClientData,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+ virtual void onCharacters( const OUString& rChars ) override;
+ virtual void onEndElement() override;
+
+private:
+ ClientData& mrClientData;
+ OUString maElementText;
+};
+
+
+class ShapeContextBase : public ::oox::core::ContextHandler2
+{
+public:
+ static ::oox::core::ContextHandlerRef
+ createShapeContext(
+ ::oox::core::ContextHandler2Helper const & rParent,
+ ShapeContainer& rShapes,
+ sal_Int32 nElement,
+ const AttributeList& rAttribs );
+
+protected:
+ explicit ShapeContextBase( ::oox::core::ContextHandler2Helper const & rParent );
+};
+
+
+class ShapeTypeContext : public ShapeContextBase
+{
+public:
+ explicit ShapeTypeContext(
+ ::oox::core::ContextHandler2Helper const & rParent,
+ std::shared_ptr<ShapeType> const& pShapeType,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+
+private:
+ /** Processes the 'style' attribute. */
+ void setStyle( std::u16string_view rStyle );
+
+ /** Resolve a relation identifier to a fragment path. */
+ OptValue< OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const;
+
+private:
+ std::shared_ptr<ShapeType> m_pShapeType;
+ ShapeTypeModel& mrTypeModel;
+};
+
+
+class ShapeContext : public ShapeTypeContext
+{
+public:
+ explicit ShapeContext(::oox::core::ContextHandler2Helper const& rParent,
+ const std::shared_ptr<ShapeBase>& pShape, const AttributeList& rAttribs);
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+
+private:
+ /** Processes the 'points' attribute. */
+ void setPoints( std::u16string_view rPoints );
+ /** Processes the 'from' attribute. */
+ void setFrom( const OUString& rPoints );
+ /** Processes the 'to' attribute. */
+ void setTo( const OUString& rPoints );
+ /** Processes the 'control1' attribute. */
+ void setControl1( const OUString& rPoints );
+ /** Processes the 'control2' attribute. */
+ void setControl2( const OUString& rPoints );
+ /** Processes the 'path' attribute. */
+ void setVmlPath( const OUString& rPath );
+ /** Processes the 'href' attribute. */
+ void setHyperlink( const OUString& rHyperlink );
+
+private:
+ ShapeBase& mrShape;
+ ShapeModel& mrShapeModel;
+};
+
+
+class GroupShapeContext final : public ShapeContext
+{
+public:
+ explicit GroupShapeContext(::oox::core::ContextHandler2Helper const& rParent,
+ const std::shared_ptr<GroupShape>& pShape,
+ const AttributeList& rAttribs);
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+
+private:
+ ShapeContainer& mrShapes;
+};
+
+
+class RectangleShapeContext final : public ShapeContext
+{
+public:
+ explicit RectangleShapeContext(::oox::core::ContextHandler2Helper const& rParent,
+ const AttributeList& rAttribs,
+ const std::shared_ptr<RectangleShape>& pShape);
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+};
+
+class ControlShapeContext final : public ShapeContextBase
+{
+public:
+ explicit ControlShapeContext(
+ ::oox::core::ContextHandler2Helper const & rParent,
+ ShapeContainer& rShapes,
+ const AttributeList& rAttribs );
+};
+
+
+} // namespace oox::vml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmltextbox.hxx b/include/oox/vml/vmltextbox.hxx
new file mode 100644
index 000000000..fb6983315
--- /dev/null
+++ b/include/oox/vml/vmltextbox.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_VML_VMLTEXTBOX_HXX
+#define INCLUDED_OOX_VML_VMLTEXTBOX_HXX
+
+#include <cstddef>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/helper.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace drawing { class XShape; }
+}
+
+namespace oox::vml {
+
+struct ShapeTypeModel;
+
+
+/// A text paragraph in a textbox.
+struct TextParagraphModel
+{
+ OptValue<OUString> moParaAdjust; ///< Paragraph adjust (left, center, right, etc.)
+ OptValue<OUString> moParaStyleName;
+};
+
+/** Font settings for a text portion in a textbox. */
+struct OOX_DLLPUBLIC TextFontModel
+{
+ OptValue< OUString > moName; ///< Font name.
+ OptValue< OUString > moNameAsian; ///< Asian font name.
+ OptValue< OUString > moNameComplex; ///< Complex font name.
+ OptValue< OUString > moColor; ///< Font color, HTML encoded, sort of.
+ OptValue< sal_Int32 > monSize; ///< Font size in twips.
+ OptValue< sal_Int32 > monUnderline; ///< Single or double underline.
+ OptValue< sal_Int32 > monEscapement; ///< Subscript or superscript.
+ OptValue< bool > mobBold;
+ OptValue< bool > mobItalic;
+ OptValue< bool > mobStrikeout;
+ OptValue<sal_Int32> monSpacing;
+
+ explicit TextFontModel();
+};
+
+
+/** A text portion in a textbox with the same formatting for all characters. */
+struct TextPortionModel
+{
+ TextParagraphModel maParagraph;
+ TextFontModel maFont;
+ OUString maText;
+
+ explicit TextPortionModel( const TextParagraphModel& rParagraph, const TextFontModel& rFont, const OUString& rText );
+};
+
+
+/** The textbox contains all text contents and properties. */
+class OOX_DLLPUBLIC TextBox
+{
+public:
+ explicit TextBox(ShapeTypeModel& rTypeModel);
+
+ /** Appends a new text portion to the textbox. */
+ void appendPortion( const TextParagraphModel& rParagraph, const TextFontModel& rFont, const OUString& rText );
+
+ /** Returns the current number of text portions. */
+ size_t getPortionCount() const { return maPortions.size(); }
+ /** Returns the font settings of the first text portion. */
+ const TextFontModel* getFirstFont() const;
+ /** Returns the entire text of all text portions. */
+ OUString getText() const;
+ void convert(const css::uno::Reference<css::drawing::XShape>& xShape) const;
+
+ ShapeTypeModel& mrTypeModel;
+ /// Text distance from the border (inset attribute of v:textbox), valid only if set.
+ bool borderDistanceSet;
+ int borderDistanceLeft, borderDistanceTop, borderDistanceRight, borderDistanceBottom;
+ OUString maLayoutFlow;
+ OUString msNextTextbox;
+
+private:
+ typedef ::std::vector< TextPortionModel > PortionVector;
+
+ PortionVector maPortions;
+};
+
+
+} // namespace oox::vml
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmltextboxcontext.hxx b/include/oox/vml/vmltextboxcontext.hxx
new file mode 100644
index 000000000..d5c3dde86
--- /dev/null
+++ b/include/oox/vml/vmltextboxcontext.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_VML_VMLTEXTBOXCONTEXT_HXX
+#define INCLUDED_OOX_VML_VMLTEXTBOXCONTEXT_HXX
+
+#include <cstddef>
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/contexthandler2.hxx>
+#include <oox/vml/vmltextbox.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox {
+ class AttributeList;
+ class GraphicHelper;
+
+namespace vml {
+
+
+class TextPortionContext final : public ::oox::core::ContextHandler2
+{
+public:
+ explicit TextPortionContext(
+ ::oox::core::ContextHandler2Helper const & rParent,
+ TextBox& rTextBox,
+ TextParagraphModel const & rParagraph,
+ const TextFontModel& rParentFont,
+ sal_Int32 nElement,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+ virtual void onCharacters( const OUString& rChars ) override;
+ virtual void onStartElement(const AttributeList& rAttribs) override;
+ virtual void onEndElement() override;
+
+private:
+ TextBox& mrTextBox;
+ TextParagraphModel maParagraph;
+ TextFontModel maFont;
+ size_t mnInitialPortions;
+};
+
+
+class TextBoxContext final : public ::oox::core::ContextHandler2
+{
+public:
+ explicit TextBoxContext(
+ ::oox::core::ContextHandler2Helper const & rParent,
+ TextBox& rTextBox,
+ const AttributeList& rAttribs,
+ const GraphicHelper& graphicHelper );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+ virtual void onStartElement(const AttributeList& rAttribs) override;
+ virtual void onEndElement() override;
+
+private:
+ TextBox& mrTextBox;
+ TextParagraphModel maParagraph;
+};
+
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/opencl/OpenCLZone.hxx b/include/opencl/OpenCLZone.hxx
new file mode 100644
index 000000000..8247e667d
--- /dev/null
+++ b/include/opencl/OpenCLZone.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OPENCL_INC_OPENCL_ZONE_HXX
+#define INCLUDED_OPENCL_INC_OPENCL_ZONE_HXX
+
+#include <sal/config.h>
+
+#include <opencl/opencldllapi.h>
+
+#include <comphelper/crashzone.hxx>
+
+class OPENCL_DLLPUBLIC OpenCLZone : public CrashZone<OpenCLZone>
+{
+public:
+ static void hardDisable();
+};
+
+// Used during initial testing of OpenCL.
+class OPENCL_DLLPUBLIC OpenCLInitialZone : public CrashZone<OpenCLInitialZone>
+{
+};
+
+#endif // INCLUDED_OPENCL_INC_OPENCL_ZONE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/opencl/openclconfig.hxx b/include/opencl/openclconfig.hxx
new file mode 100644
index 000000000..7247b4fa6
--- /dev/null
+++ b/include/opencl/openclconfig.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OPENCL_OPENCLCONFIG_HXX
+#define INCLUDED_OPENCL_OPENCLCONFIG_HXX
+
+#include <ostream>
+#include <set>
+
+#include <opencl/opencldllapi.h>
+#include <rtl/ustring.hxx>
+
+struct OpenCLDeviceInfo;
+struct OpenCLPlatformInfo;
+
+struct OPENCL_DLLPUBLIC OpenCLConfig
+{
+ struct ImplMatcher
+ {
+ OUString maOS;
+ OUString maOSVersion;
+ OUString maPlatformVendor;
+ OUString maDevice;
+ OUString maDriverVersion;
+
+ ImplMatcher()
+ {
+ }
+
+ ImplMatcher(const OUString& rOS,
+ const OUString& rOSVersion,
+ const OUString& rPlatformVendor,
+ const OUString& rDevice,
+ const OUString& rDriverVersion)
+ : maOS(rOS),
+ maOSVersion(rOSVersion),
+ maPlatformVendor(rPlatformVendor),
+ maDevice(rDevice),
+ maDriverVersion(rDriverVersion)
+ {
+ }
+
+ bool operator==(const ImplMatcher& r) const
+ {
+ return maOS == r.maOS &&
+ maOSVersion == r.maOSVersion &&
+ maPlatformVendor == r.maPlatformVendor &&
+ maDevice == r.maDevice &&
+ maDriverVersion == r.maDriverVersion;
+ }
+ bool operator!=(const ImplMatcher& r) const
+ {
+ return !operator==(r);
+ }
+ bool operator<(const ImplMatcher& r) const
+ {
+ return (maOS < r.maOS ||
+ (maOS == r.maOS &&
+ (maOSVersion < r.maOSVersion ||
+ (maOSVersion == r.maOSVersion &&
+ (maPlatformVendor < r.maPlatformVendor ||
+ (maPlatformVendor == r.maPlatformVendor &&
+ (maDevice < r.maDevice ||
+ (maDevice == r.maDevice &&
+ (maDriverVersion < r.maDriverVersion)))))))));
+ }
+ };
+
+ bool mbUseOpenCL;
+
+ typedef std::set<ImplMatcher> ImplMatcherSet;
+
+ ImplMatcherSet maDenyList;
+ ImplMatcherSet maAllowList;
+
+ OpenCLConfig();
+
+ bool operator== (const OpenCLConfig& r) const;
+ bool operator!= (const OpenCLConfig& r) const;
+
+ static OpenCLConfig get();
+
+ void set();
+
+ bool checkImplementation(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) const;
+};
+
+OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig& rConfig);
+OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcher& rImpl);
+OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcherSet& rSet);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/opencl/opencldllapi.h b/include/opencl/opencldllapi.h
new file mode 100644
index 000000000..99bfd6cb9
--- /dev/null
+++ b/include/opencl/opencldllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OPENCL_OPENCLDLLAPI_H
+#define INCLUDED_OPENCL_OPENCLDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(OPENCL_DLLIMPLEMENTATION)
+#define OPENCL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define OPENCL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define OPENCL_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/opencl/openclwrapper.hxx b/include/opencl/openclwrapper.hxx
new file mode 100644
index 000000000..81138ced2
--- /dev/null
+++ b/include/opencl/openclwrapper.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SC_SOURCE_CORE_OPENCL_OPENCLWRAPPER_HXX
+#define INCLUDED_SC_SOURCE_CORE_OPENCL_OPENCLWRAPPER_HXX
+
+#include <vector>
+
+#include <clew/clew.h>
+
+#include <opencl/opencldllapi.h>
+#include <rtl/ustring.hxx>
+
+#define MAX_CLFILE_NUM 50
+#define OPENCL_CMDQUEUE_SIZE 1 // number of command queues per OpenCL device.
+
+#include <cstdio>
+
+struct OpenCLPlatformInfo;
+
+namespace openclwrapper
+{
+
+struct KernelEnv
+{
+ cl_context mpkContext;
+ cl_command_queue mpkCmdQueue;
+ cl_program mpkProgram;
+};
+
+struct OPENCL_DLLPUBLIC GPUEnv
+{
+ //share vb in all modules in hb library
+ cl_platform_id mpPlatformID;
+ cl_context mpContext;
+ cl_device_id mpDevID;
+ cl_command_queue mpCmdQueue[OPENCL_CMDQUEUE_SIZE];
+ bool mbCommandQueueInitialized;
+ cl_program mpArryPrograms[MAX_CLFILE_NUM]; //one program object maps one kernel source file
+ int mnIsUserCreated; // 1: created , 0:no create and needed to create by opencl wrapper
+ int mnCmdQueuePos;
+ bool mnKhrFp64Flag;
+ bool mnAmdFp64Flag;
+ bool mbNeedsTDRAvoidance;
+
+ static bool isOpenCLEnabled();
+};
+
+extern OPENCL_DLLPUBLIC GPUEnv gpuEnv;
+extern OPENCL_DLLPUBLIC sal_uInt64 kernelFailures;
+
+OPENCL_DLLPUBLIC bool canUseOpenCL();
+
+OPENCL_DLLPUBLIC bool generatBinFromKernelSource( cl_program program, const char * clFileName );
+OPENCL_DLLPUBLIC bool buildProgramFromBinary(const char* buildOption, GPUEnv* gpuEnv, const char* filename, int idx);
+OPENCL_DLLPUBLIC void setKernelEnv( KernelEnv *envInfo );
+OPENCL_DLLPUBLIC const std::vector<OpenCLPlatformInfo>& fillOpenCLInfo();
+
+/**
+ * Used to set or switch between OpenCL devices.
+ *
+ * @param pDeviceId the id of the opencl device of type cl_device_id, NULL means use software calculation
+ * @param bAutoSelect use the algorithm to select the best OpenCL device
+ * @param rOutSelectedDeviceVersionIDString returns the selected device's version string.
+ *
+ * @return returns true if there is a valid opencl device that has been set up
+ */
+OPENCL_DLLPUBLIC bool switchOpenCLDevice(const OUString* pDeviceId, bool bAutoSelect,
+ bool bForceEvaluation,
+ OUString& rOutSelectedDeviceVersionIDString);
+
+OPENCL_DLLPUBLIC void getOpenCLDeviceInfo(size_t& rDeviceId, size_t& rPlatformId);
+
+OPENCL_DLLPUBLIC void getOpenCLDeviceName(OUString& rDeviceName, OUString& rPlatformName);
+
+/**
+ * Set the current command queue position in case of multiple command queues
+ * for a given device.
+ */
+OPENCL_DLLPUBLIC void setOpenCLCmdQueuePosition( int nPos );
+
+/**
+ * Return a textual representation of an OpenCL error code.
+ * (Currently the symbolic name sans the CL_ prefix.)
+ */
+OPENCL_DLLPUBLIC const char* errorString(cl_int nError);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/opencl/platforminfo.hxx b/include/opencl/platforminfo.hxx
new file mode 100644
index 000000000..5e54c052f
--- /dev/null
+++ b/include/opencl/platforminfo.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OPENCL_PLATFORMINFO_HXX
+#define INCLUDED_OPENCL_PLATFORMINFO_HXX
+
+#include <ostream>
+#include <vector>
+
+#include <clew/clew.h>
+
+#include <opencl/opencldllapi.h>
+#include <rtl/ustring.hxx>
+
+// Struct that describs an actual instance of an OpenCL device
+
+struct OpenCLDeviceInfo
+{
+ cl_device_id device;
+ OUString maName;
+ OUString maVendor;
+ OUString maDriver;
+ size_t mnMemory;
+ size_t mnComputeUnits;
+ size_t mnFrequency;
+
+ OpenCLDeviceInfo();
+};
+
+// Struct that describs an actual instance of an OpenCL platform implementation
+
+struct OpenCLPlatformInfo
+{
+ cl_platform_id platform;
+ OUString maVendor;
+ OUString maName;
+ std::vector<OpenCLDeviceInfo> maDevices;
+
+ OpenCLPlatformInfo();
+};
+
+OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLPlatformInfo& rPlatform);
+OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLDeviceInfo& rDevice);
+
+#endif
diff --git a/include/osl/conditn.h b/include/osl/conditn.h
new file mode 100644
index 000000000..b39167a2d
--- /dev/null
+++ b/include/osl/conditn.h
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_CONDITN_H
+#define INCLUDED_OSL_CONDITN_H
+
+#include "sal/config.h"
+
+#include "osl/time.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void* oslCondition;
+
+typedef enum {
+ osl_cond_result_ok, /*<! Successful completion. */
+ osl_cond_result_error, /*<! Error occurred. @see osl_getLastSocketError() */
+ osl_cond_result_timeout, /*<! Blocking operation timed out. */
+ osl_cond_result_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslConditionResult;
+
+/** Creates a condition.
+
+ @deprecated use C++11's std::condition_variable instead
+ for a more robust and helpful condition.
+
+ The condition is in the reset-state.
+
+ @retval osl_cond_result_error Condition could not be created.
+*/
+SAL_DLLPUBLIC oslCondition SAL_CALL osl_createCondition(void);
+
+/** Free the memory used by the condition.
+
+ @param Condition the condition handle.
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_destroyCondition(oslCondition Condition);
+
+/** Sets condition to True => wait() will not block, check() returns True.
+
+ @attention @em all threads waiting on this condition are unblocked!
+
+ @param Condition handle to a created condition.
+ @retval False if system-call failed.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_setCondition(oslCondition Condition);
+
+/** Sets condition to False => wait() will block, check() returns False
+
+ @param Condition handle to a created condition.
+ @retval False if system-call failed.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition);
+
+/** Blocks if condition is not set.
+
+ @param Condition handle to a created condition.
+ @param pTimeout Timeout value or NULL for infinite waiting
+ @retval False Condition has been destroyed prematurely or system call has failed.
+*/
+SAL_DLLPUBLIC oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const TimeValue* pTimeout);
+
+/** Queries the state of the condition without blocking.
+
+ @param Condition handle to a created condition.
+
+ @retval True condition is set
+ @retval False condition is not set
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_CONDITN_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/conditn.hxx b/include/osl/conditn.hxx
new file mode 100644
index 000000000..5eb9ba431
--- /dev/null
+++ b/include/osl/conditn.hxx
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_CONDITN_HXX
+#define INCLUDED_OSL_CONDITN_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "osl/time.h"
+#include "osl/conditn.h"
+
+#if defined(MACOSX) && defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
+# if __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES == 1
+# undef check
+# endif
+#endif
+
+namespace osl
+{
+ /** Condition variable
+
+ A condition variable is essentially an object that is initially
+ cleared which a thread waits on until it is "set". It allows a
+ thread to synchronize execution by allowing other threads to wait
+ for the condition to change before that thread then continues
+ execution.
+
+ @deprecated use C++11's std::condition_variable instead
+ for a more robust and helpful condition.
+
+ @attention Warning: the Condition abstraction is inadequate for
+ any situation where there may be multiple threads setting,
+ waiting, and resetting the same condition. It can only be
+ used to synchronise interactions between two threads
+ cf. lost wakeups in http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
+ */
+ class Condition
+ {
+ public:
+ enum Result
+ {
+ result_ok = osl_cond_result_ok, /*!< Successful completion. */
+ result_error = osl_cond_result_error, /*!< Error occurred. @see osl_getLastSocketError() */
+ result_timeout = osl_cond_result_timeout /*!< Blocking operation timed out. */
+ };
+
+ /** Create a condition.
+
+ @deprecated use C++11's std::condition_variable instead
+ for a more robust and helpful condition.
+ */
+ Condition()
+ {
+ condition = osl_createCondition();
+ }
+
+ /** Release the OS-structures and free condition data-structure.
+
+ @deprecated use C++11's std::condition_variable instead
+ for a more robust and helpful condition.
+ */
+ ~Condition()
+ {
+ osl_destroyCondition(condition);
+ }
+
+ /** Release all waiting threads, check returns true.
+
+ @deprecated use C++11's std::condition_variable instead
+ for a more robust and helpful condition.
+ */
+ void set()
+ {
+ osl_setCondition(condition);
+ }
+
+ /** Reset condition to false: wait() will block, check() returns
+ false.
+
+ @deprecated use C++11's std::condition_variable instead
+ for a more robust and helpful condition.
+ */
+ void reset() {
+ osl_resetCondition(condition);
+ }
+
+ /** Blocks the calling thread until condition is set.
+
+ @param [in] pTimeout Timeout to wait before ending the condition.
+ Defaults to NULL
+
+ @retval result_ok finished successfully
+ @retval result_error error occurred
+ @retval result_timeout timed out
+
+ @deprecated use C++11's std::condition_variable instead
+ for a more robust and helpful condition.
+ */
+ Result wait(const TimeValue *pTimeout = NULL)
+ {
+ return static_cast<Result>(osl_waitCondition(condition, pTimeout));
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ Result wait(TimeValue const & timeout) { return wait(&timeout); }
+#endif
+
+ /** Checks if the condition is set without blocking.
+
+ @retval true condition is set
+ @retval false condition is not set
+
+ @deprecated use C++11's std::condition_variable instead
+ for a more robust and helpful condition.
+ */
+ bool check()
+ {
+ return osl_checkCondition(condition);
+ }
+
+
+ private:
+ oslCondition condition; /*< condition variable */
+
+ /** Copy constructor
+
+ The underlying oslCondition has no reference count.
+
+ Since the underlying oslCondition is not a reference counted
+ object, copy constructed Condition may work on an already
+ destructed oslCondition object.
+
+ @deprecated use C++11's std::condition_variable instead
+ for a more robust and helpful condition.
+ */
+ Condition(const Condition& condition) SAL_DELETED_FUNCTION;
+
+ /** This assignment operator is deleted for the same reason as
+ the copy constructor.
+
+ @deprecated use C++11's std::condition_variable instead
+ for a more robust and helpful condition.
+ */
+ Condition& operator= (const Condition&) SAL_DELETED_FUNCTION;
+ };
+}
+
+#endif // INCLUDED_OSL_CONDITN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/detail/android-bootstrap.h b/include/osl/detail/android-bootstrap.h
new file mode 100644
index 000000000..169f3efaf
--- /dev/null
+++ b/include/osl/detail/android-bootstrap.h
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OSL_DETAIL_ANDROID_BOOTSTRAP_H
+#define INCLUDED_OSL_DETAIL_ANDROID_BOOTSTRAP_H
+
+#if defined(ANDROID)
+
+#include <jni.h>
+#include <dirent.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <osl/detail/component-mapping.h>
+#include <android/asset_manager.h>
+
+typedef struct lo_apk_dir lo_apk_dir;
+
+void *lo_apkentry(const char *filename,
+ size_t *size);
+
+lo_apk_dir *lo_apk_opendir(const char *dirname);
+
+struct dirent *lo_apk_readdir(lo_apk_dir *dirp);
+
+int lo_apk_closedir(lo_apk_dir *dirp);
+
+int lo_apk_lstat(const char *path, struct stat *statp);
+
+/// "libreofficekit_" prefix, because it is exported from the .so, when we are
+/// initializing the JNI externally.
+void libreofficekit_set_javavm(JavaVM *vm);
+
+JavaVM *lo_get_javavm(void);
+
+const char *lo_get_app_data_dir(void);
+
+AAssetManager *lo_get_native_assetmgr(void);
+
+int setup_cdir(void);
+int setup_assets_tree(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANDROID
+
+#endif // ANDROID_BOOTSTRAP_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/detail/component-defines.h b/include/osl/detail/component-defines.h
new file mode 100644
index 000000000..9a31cee93
--- /dev/null
+++ b/include/osl/detail/component-defines.h
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OSL_DETAIL_COMPONENT_DEFINES_H
+#define INCLUDED_OSL_DETAIL_COMPONENT_DEFINES_H
+
+/* Experimental direct constructor calls, under construction */
+
+/* FIXME: Rather than hardcoded, this should be generated from
+ solenv/bin/native-code.py */
+
+#define LO_URE_CURRENT_ENV 1 /*TODO*/
+
+// sax/source/expatwrap/expwrap.component
+#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_xml_dot_sax_dot_FastParser 1 /*TODO*/
+#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_xml_dot_sax_dot_FastParser com_sun_star_comp_extensions_xml_sax_FastParser_get_implementation
+#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_xml_dot_sax_dot_Parser 1 /*TODO*/
+#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_xml_dot_sax_dot_Parser com_sun_star_comp_extensions_xml_sax_ParserExpat_get_implementation
+// sfx2/util/sfx.component
+#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_document_dot_DocumentProperties 1
+#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_document_dot_DocumentProperties SfxDocumentMetaData_get_implementation
+#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_frame_dot_OfficeFrameLoader 1
+#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_frame_dot_OfficeFrameLoader com_sun_star_comp_office_FrameLoader_get_implementation
+#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_frame_dot_SynchronousFrameLoader 1
+#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_frame_dot_SynchronousFrameLoader com_sun_star_comp_office_FrameLoader_get_implementation
+#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_frame_dot_DocumentTemplates 1
+#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_frame_dot_DocumentTemplates com_sun_star_comp_sfx2_DocumentTemplates_get_implementation
+#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_frame_dot_GlobalEventBroadcaster 1
+#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_frame_dot_GlobalEventBroadcaster com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation
+#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_frame_dot_theGlobalEventBroadcaster 1
+#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_frame_dot_theGlobalEventBroadcaster com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation
+// svtools/util/svt_dot_component
+#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_graphic_dot_GraphicProvider 1
+#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_graphic_dot_GraphicProvider com_sun_star_comp_graphic_GraphicProvider_get_implementation
+// svx/util/svx_dot_component
+#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_drawing_dot_CustomShapeEngine 1
+#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_drawing_dot_CustomShapeEngine com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/detail/component-mapping.h b/include/osl/detail/component-mapping.h
new file mode 100644
index 000000000..4d4264180
--- /dev/null
+++ b/include/osl/detail/component-mapping.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OSL_DETAIL_COMPONENT_MAPPING_H
+#define INCLUDED_OSL_DETAIL_COMPONENT_MAPPING_H
+
+#ifdef DISABLE_DYNLOADING
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* On iOS and perhaps Android static linking of the LO code into one
+ * executable (on Android, into one shared library) is used. In order to get
+ * the needed UNO component linked in, the "main" code for an app needs to
+ * implement the lo_get_libmap() function to map UNO component library names
+ * as produced in a build for iOS (like configmgr.uno.a or libsclo.a) to the
+ * corresponding component_getFactory functions.
+ */
+
+typedef struct {
+ const char *name;
+ void * (*component_getFactory_function)(const char *, void *, void *);
+} lib_to_factory_mapping;
+
+typedef struct {
+ const char *name;
+ void * (*constructor_function)(void *, void *);
+} lib_to_constructor_mapping;
+
+const lib_to_factory_mapping *lo_get_factory_map(void);
+const lib_to_constructor_mapping *lo_get_constructor_map(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DISABLE_DYNLOADING */
+
+#endif // INCLUDED_OSL_DETAIL_COMPONENT_MAPPING_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/detail/file.h b/include/osl/detail/file.h
new file mode 100644
index 000000000..acc308b8f
--- /dev/null
+++ b/include/osl/detail/file.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OSL_DETAIL_FILE_H
+#define INCLUDED_OSL_DETAIL_FILE_H
+
+#include "sal/config.h"
+
+/** @cond INTERNAL */
+
+/* Some additions to the osl file functions for LibreOffice internal
+ use. Needed for details in the Android support.
+ */
+
+/* More flags needed for semantics that match the open() call that
+ used to be in SvFileStream::Open(), and for temp files:
+*/
+#define osl_File_OpenFlag_Trunc 0x00000010L
+#define osl_File_OpenFlag_NoExcl 0x00000020L
+#define osl_File_OpenFlag_Private 0x00000040L
+
+/** @endcond */
+
+#endif /* INCLUDED_OSL_DETAIL_FILE_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/diagnose.h b/include/osl/diagnose.h
new file mode 100644
index 000000000..356f2945b
--- /dev/null
+++ b/include/osl/diagnose.h
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_DIAGNOSE_H
+#define INCLUDED_OSL_DIAGNOSE_H
+
+#include "sal/config.h"
+
+#include "sal/detail/log.h"
+#include "sal/types.h"
+
+/** @file
+ Provides simple diagnostic support.
+
+ @deprecated
+ The facilities provided by this header are deprecated. True assertions
+ (that detect broken program logic) should use standard assert (which aborts
+ if an assertion fails, and is controlled by the standard NDEBUG macro).
+ Logging of warnings (e.g., about malformed input) and traces (e.g., about
+ steps taken while executing some protocol) should use the facilities
+ provided by (C++ only) sal/log.hxx.
+
+ Because the assertion macros (OSL_ASSERT, OSL_ENSURE, OSL_FAIL, OSL_PRECOND,
+ and OSL_POSTCOND) have been used for true assertions as well as for logged
+ warnings, they map to SAL_WARN instead of standard assert. OSL_TRACE maps
+ to SAL_INFO.
+
+ The functions defined in this header are not intended to be used directly,
+ but through defined macros. The macros can be divided into three categories:
+ assertions, traces and other stuff .-) Their usability depends on the value
+ of OSL_DEBUG_LEVEL macro: assertions are only active if OSL_DEBUG_LEVEL is 1
+ or greater, traces if OSL_DEBUG_LEVEL is 2 or greater.
+
+ Traces:
+ OSL_TRACE(fmt, args...)
+ Prints trace message. The arguments have the same meaning as the
+ arguments of printf.
+ */
+
+#if !defined OSL_DEBUG_LEVEL
+#define OSL_DEBUG_LEVEL 0
+#endif
+
+/** @internal The macro OSL_LOG_PREFIX is intended to be an office internal macro for now
+ @deprecated superseded by (C++ only) SAL_WHERE
+*/
+#define OSL_LOG_PREFIX SAL_DETAIL_WHERE
+
+/** Prints trace message.
+
+ The arguments have the same meaning as the arguments of printf.
+*/
+#define OSL_TRACE(...) \
+ SAL_DETAIL_INFO_IF_FORMAT(OSL_DEBUG_LEVEL > 0, "legacy.osl", __VA_ARGS__)
+
+/** @defgroup assert Assertions
+
+ Assertions (cond is bool, msg is char*).
+
+ @{
+ */
+
+/** If cond is false, reports an error. */
+#define OSL_ASSERT(c) \
+ SAL_DETAIL_WARN_IF_FORMAT(!(c), "legacy.osl", "OSL_ASSERT: %s", #c)
+/** If cond is false, reports an error with message msg. */
+#define OSL_ENSURE(c, m) SAL_DETAIL_WARN_IF_FORMAT(!(c), "legacy.osl", "%s", m)
+/** Reports an error with message msg unconditionally. */
+#define OSL_FAIL(m) SAL_DETAIL_WARN_IF_FORMAT(sal_True, "legacy.osl", "%s", m)
+
+/** Evaluates the expression and if it is false, reports an error. The
+ expression is evaluated once without regard of the value of
+ OSL_DEBUG_LEVEL.
+
+ Example:
+
+ @code{.c}
+
+ void extractBool(Any const& rAny, bool& rBool)
+ {
+ OSL_VERIFY(rAny >>= rBool);
+ }
+
+ @endcode
+*/
+#define OSL_VERIFY(c) do { if (!(c)) OSL_ASSERT(0); } while (0)
+
+/** Check the precondition of functions.
+
+ Functionally equivalent to OSL_ENSURE(cond, msg).
+*/
+#define OSL_PRECOND(c, m) OSL_ENSURE(c, m)
+
+/** Check the postcondition of functions.
+
+ Functionally equivalent to OSL_ENSURE(cond, msg).
+*/
+#define OSL_POSTCOND(c, m) OSL_ENSURE(c, m)
+
+/** @} */
+
+#endif // INCLUDED_OSL_DIAGNOSE_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/diagnose.hxx b/include/osl/diagnose.hxx
new file mode 100644
index 000000000..71d49f3d8
--- /dev/null
+++ b/include/osl/diagnose.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_OSL_DIAGNOSE_HXX
+#define INCLUDED_OSL_DIAGNOSE_HXX
+
+/// @cond INTERNAL
+
+#include "sal/config.h"
+
+#include <cstddef>
+#include <typeinfo>
+#include <unordered_set>
+
+#include "osl/diagnose.h"
+#include "osl/interlck.h"
+#include "osl/mutex.hxx"
+#include "rtl/instance.hxx"
+#include "sal/log.hxx"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+namespace osl {
+namespace detail {
+
+struct ObjectRegistryData;
+
+} // namespace detail
+} // namespace osl
+
+extern "C" {
+
+SAL_DLLPUBLIC bool SAL_CALL osl_detail_ObjectRegistry_storeAddresses(
+ char const* pName )
+ SAL_THROW_EXTERN_C();
+
+SAL_DLLPUBLIC bool SAL_CALL osl_detail_ObjectRegistry_checkObjectCount(
+ ::osl::detail::ObjectRegistryData const& rData, ::std::size_t nExpected )
+ SAL_THROW_EXTERN_C();
+
+SAL_DLLPUBLIC void SAL_CALL osl_detail_ObjectRegistry_registerObject(
+ ::osl::detail::ObjectRegistryData & rData, void const* pObj )
+ SAL_THROW_EXTERN_C();
+
+SAL_DLLPUBLIC void SAL_CALL osl_detail_ObjectRegistry_revokeObject(
+ ::osl::detail::ObjectRegistryData & rData, void const* pObj )
+ SAL_THROW_EXTERN_C();
+
+// These functions presumably should not be extern "C", but changing
+// that would break binary compatibility.
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
+#endif
+
+SAL_DLLPUBLIC ::osl::Mutex & SAL_CALL osl_detail_ObjectRegistry_getMutex()
+ SAL_THROW_EXTERN_C();
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+} // extern "C"
+
+namespace osl {
+
+namespace detail {
+
+struct VoidPtrHash {
+ ::std::size_t operator()( void const* p ) const {
+ ::std::size_t const d = static_cast< ::std::size_t >(
+ reinterpret_cast< ::std::ptrdiff_t >(p) );
+ return d + (d >> 3);
+ }
+};
+
+typedef ::std::unordered_set<void const*, VoidPtrHash > VoidPointerSet;
+
+struct ObjectRegistryData {
+ ObjectRegistryData( ::std::type_info const& rTypeInfo )
+ : m_pName(rTypeInfo.name()), m_nCount(0),
+ m_bStoreAddresses(osl_detail_ObjectRegistry_storeAddresses(m_pName)) {}
+
+ char const* const m_pName;
+ oslInterlockedCount m_nCount;
+ VoidPointerSet m_addresses;
+ bool const m_bStoreAddresses;
+};
+
+template <typename T>
+class ObjectRegistry
+{
+public:
+ ObjectRegistry() : m_data( typeid(T) ) {}
+ ~ObjectRegistry() { checkObjectCount(0); }
+
+ bool checkObjectCount( ::std::size_t nExpected ) const {
+ bool const bRet = osl_detail_ObjectRegistry_checkObjectCount(
+ m_data, nExpected );
+ if (!bRet && m_data.m_bStoreAddresses) {
+ MutexGuard const guard( osl_detail_ObjectRegistry_getMutex() );
+ // following loop is for debugging purposes, iterating over map:
+ VoidPointerSet::const_iterator iPos(m_data.m_addresses.begin());
+ VoidPointerSet::const_iterator const iEnd(m_data.m_addresses.end());
+ for ( ; iPos != iEnd; ++iPos ) {
+ SAL_WARN_IF( *iPos == NULL, "sal.debug", "null pointer" );
+ }
+ }
+ return bRet;
+ }
+
+ void registerObject( void const* pObj ) {
+ osl_detail_ObjectRegistry_registerObject(m_data, pObj);
+ }
+
+ void revokeObject( void const* pObj ) {
+ osl_detail_ObjectRegistry_revokeObject(m_data, pObj);
+ }
+
+private:
+ ObjectRegistry( ObjectRegistry const& ) SAL_DELETED_FUNCTION;
+ ObjectRegistry const& operator=( ObjectRegistry const& ) SAL_DELETED_FUNCTION;
+
+ ObjectRegistryData m_data;
+};
+
+} // namespace detail
+
+/** Helper class which indicates leaking object(s) of a particular class in
+ non-pro builds; use e.g.
+
+ @code{.cpp}
+ class MyClass : private osl::DebugBase<MyClass> {...};
+ @endcode
+
+ Using the environment variable
+
+ OSL_DEBUGBASE_STORE_ADDRESSES=MyClass;YourClass;...
+
+ you can specify a ';'-separated list of strings matching to class names
+ (or "all" for all classes), for which DebugBase stores addresses to created
+ objects instead of just counting them. This enables you to iterate over
+ leaking objects in your debugger.
+
+ @tparam InheritingClassT binds the template instance to that class
+ @attention Use at own risk.
+ For now this is just public (yet unpublished) API and may change
+ in the future!
+*/
+template <typename InheritingClassT>
+class DebugBase
+{
+public:
+#if OSL_DEBUG_LEVEL <= 0
+ static bool checkObjectCount( ::std::size_t = 0 ) { return true; }
+#else // OSL_DEBUG_LEVEL > 0
+ /** @return whether the expected number of objects is alive,
+ else this function SAL_WARNs
+ */
+ static bool checkObjectCount( ::std::size_t nExpected = 0 ) {
+ return StaticObjectRegistry::get().checkObjectCount(nExpected);
+ }
+
+protected:
+ DebugBase() {
+ StaticObjectRegistry::get().registerObject( this );
+ }
+ ~DebugBase() {
+ StaticObjectRegistry::get().revokeObject( this );
+ }
+
+private:
+ struct StaticObjectRegistry
+ : ::rtl::Static<detail::ObjectRegistry<InheritingClassT>,
+ StaticObjectRegistry> {};
+#endif
+};
+
+} // namespace osl
+
+/// @endcond
+
+#endif // ! defined( INCLUDED_OSL_DIAGNOSE_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/doublecheckedlocking.h b/include/osl/doublecheckedlocking.h
new file mode 100644
index 000000000..f89ab3620
--- /dev/null
+++ b/include/osl/doublecheckedlocking.h
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_DOUBLECHECKEDLOCKING_H
+#define INCLUDED_OSL_DOUBLECHECKEDLOCKING_H
+
+#if defined __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** A platform specific macro needed to make double-checked locking work.
+
+ See
+ <http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html>
+ for a description of double-checked locking, why it is broken, and how it
+ can be fixed. On platforms where it is necessary, this macro will expand
+ to some memory barrier instruction. On many platforms, double-checked
+ locking works as it is, though, so on those platforms this macro will be
+ empty. This is a macro instead of a (C++ inline) function to allow for
+ maximum performance in both C and C++.
+
+ If possible, use the rtl_Instance template instead of explicitly spelling
+ out the double-checked locking pattern. There are few cases where you
+ will have to spell it out explicitly (e.g., the logic of a certain
+ instance of the pattern is too complex to be mapped to the template, or
+ some compiler refuses to compile a template instantiation due to internal
+ compiler errors), though, and you should always call this macro at the
+ right places then:
+
+ @code{.cpp}
+ static T * pInstance = 0;
+
+ T * p = pInstance;
+ if (!p)
+ {
+ Guard aGuard(aMutex);
+ p = pInstance;
+ if (!p)
+ {
+ p = ...;
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ pInstance = p;
+ }
+ }
+ else
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ return p;
+ @endcode
+
+ One extra advantage of this macro is that it makes it easier to find all
+ places where double-checked locking is used.
+ */
+#define OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER() /* empty */
+
+#if defined __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* INCLUDED_OSL_DOUBLECHECKEDLOCKING_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/endian.h b/include/osl/endian.h
new file mode 100644
index 000000000..fb9b514c1
--- /dev/null
+++ b/include/osl/endian.h
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_ENDIAN_H
+#define INCLUDED_OSL_ENDIAN_H
+
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Define the platform byte order as OSL_BIGENDIAN or OSL_LITENDIAN.
+ */
+
+#if defined _WIN32
+# if defined _M_ALPHA || defined _M_AMD64 || defined _M_IX86 \
+ || defined _M_MRX000 || defined _M_PPC || defined _M_ARM64
+# define OSL_LITENDIAN
+# endif
+#elif defined ANDROID || defined LINUX || defined HAIKU
+# include <endian.h>
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# define OSL_LITENDIAN
+# elif __BYTE_ORDER == __BIG_ENDIAN
+# define OSL_BIGENDIAN
+# endif
+#elif defined IOS || defined MACOSX || defined NETBSD
+# include <machine/endian.h>
+# if BYTE_ORDER == LITTLE_ENDIAN
+# define OSL_LITENDIAN
+# elif BYTE_ORDER == BIG_ENDIAN
+# define OSL_BIGENDIAN
+# endif
+#elif defined FREEBSD
+# include <sys/param.h>
+# include <machine/endian.h>
+# if defined _LITTLE_ENDIAN
+# define OSL_LITENDIAN
+# elif defined _BIG_ENDIAN
+# define OSL_BIGENDIAN
+# endif
+#elif defined AIX
+# include <sys/machine.h>
+# if BYTE_ORDER == LITTLE_ENDIAN
+# define OSL_LITENDIAN
+# elif BYTE_ORDER == BIG_ENDIAN
+# define OSL_BIGENDIAN
+# endif
+#elif defined __sun
+# include <sys/isa_defs.h>
+# if defined _LITTLE_ENDIAN
+# define OSL_LITENDIAN
+# elif defined _BIG_ENDIAN
+# define OSL_BIGENDIAN
+# endif
+#elif defined EMSCRIPTEN
+# define OSL_LITENDIAN
+#else
+# error "Target platform not specified !"
+#endif
+#if defined OSL_LITENDIAN == defined OSL_BIGENDIAN
+# error undetermined endianness
+#endif
+
+
+/** Define macros for byte order manipulation.
+ */
+#ifndef OSL_MAKEBYTE
+# define OSL_MAKEBYTE(nl, nh) ((sal_uInt8)(((nl) & 0x0F) | (((nh) & 0x0F) << 4)))
+#endif
+#ifndef OSL_LONIBBLE
+# define OSL_LONIBBLE(b) ((sal_uInt8)((b) & 0x0F))
+#endif
+#ifndef OSL_HINIBBLE
+# define OSL_HINIBBLE(b) ((sal_uInt8)(((b) >> 4) & 0x0F))
+#endif
+
+#ifndef OSL_MAKEWORD
+# define OSL_MAKEWORD(bl, bh) ((sal_uInt16)((sal_uInt16)((bl) & 0xFF) | (((sal_uInt16)(bh) & 0xFF) << 8)))
+#endif
+#ifndef OSL_LOBYTE
+# define OSL_LOBYTE(w) ((sal_uInt8)((sal_uInt16)(w) & 0xFF))
+#endif
+#ifndef OSL_HIBYTE
+# define OSL_HIBYTE(w) ((sal_uInt8)(((sal_uInt16)(w) >> 8) & 0xFF))
+#endif
+
+#ifndef OSL_MAKEDWORD
+# define OSL_MAKEDWORD(wl, wh) ((sal_uInt32)((wl) & 0xFFFF) | (((sal_uInt32)(wh) & 0xFFFF) << 16))
+#endif
+#ifndef OSL_LOWORD
+# define OSL_LOWORD(d) ((sal_uInt16)((sal_uInt32)(d) & 0xFFFF))
+#endif
+#ifndef OSL_HIWORD
+# define OSL_HIWORD(d) ((sal_uInt16)(((sal_uInt32)(d) >> 16) & 0xFFFF))
+#endif
+
+
+/** Define macros for swapping between host and network byte order.
+ */
+#ifdef OSL_BIGENDIAN
+#ifndef OSL_NETWORD
+# define OSL_NETWORD(w) (sal_uInt16)(w)
+#endif
+#ifndef OSL_NETDWORD
+# define OSL_NETDWORD(d) (sal_uInt32)(d)
+#endif
+#else /* OSL_LITENDIAN */
+#ifndef OSL_NETWORD
+# define OSL_NETWORD(w) OSL_MAKEWORD(OSL_HIBYTE(w),OSL_LOBYTE(w))
+#endif
+#ifndef OSL_NETDWORD
+# define OSL_NETDWORD(d) OSL_MAKEDWORD(OSL_NETWORD(OSL_HIWORD(d)),OSL_NETWORD(OSL_LOWORD(d)))
+#endif
+#endif /* OSL_BIGENDIAN */
+
+
+/** Define macros for swapping between byte orders.
+ */
+#ifndef OSL_SWAPWORD
+# define OSL_SWAPWORD(w) OSL_MAKEWORD(OSL_HIBYTE(w),OSL_LOBYTE(w))
+#endif
+#ifndef OSL_SWAPDWORD
+# define OSL_SWAPDWORD(d) OSL_MAKEDWORD(OSL_SWAPWORD(OSL_HIWORD(d)),OSL_SWAPWORD(OSL_LOWORD(d)))
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_ENDIAN_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/file.h b/include/osl/file.h
new file mode 100644
index 000000000..07d2beb2a
--- /dev/null
+++ b/include/osl/file.h
@@ -0,0 +1,1677 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_FILE_H
+#define INCLUDED_OSL_FILE_H
+
+#include "sal/config.h"
+
+#include "osl/time.h"
+#include "rtl/ustring.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file
+
+Main goals and usage hints
+
+The main intention of this interface is to provide a universal portable and
+high performance access to file system functionality on any operating
+system.
+
+There are a few main goals:
+
+1. The path specifications always has to be absolute. Any usage of relative
+path specifications is forbidden. Exceptions are osl_getSystemPathFromFileURL,
+osl_getFileURLFromSystemPath and osl_getAbsoluteFileURL. Most operating
+systems provide a "Current Directory" per process. This is the reason why
+relative path specifications can cause problems in multithreading
+environments.
+
+2. Proprietary notations of file paths are not supported. Every path notation
+must the file URL specification. File URLs must be encoded in UTF8 and after
+that escaped. Although the URL parameter is a unicode string, the must
+contain only ASCII characters.
+
+3. The caller cannot get any information whether a file system is case
+sensitive, case preserving or not. The operating system implementation
+itself should determine if it can map case-insensitive paths. The case
+correct notation of a filename or file path is part of the "File Info". This
+case correct name can be used as a unique key if necessary.
+
+4. Obtaining information about files or volumes is controlled by a bitmask
+which specifies which fields are of interest. Due to performance reasons it
+is not recommended to obtain information which is not needed. But if the
+operating system provides more information anyway the implementation can set
+more fields on output as were requested. It is in the responsibility of the
+caller to decide if they use this additional information or not. But they
+should do so to prevent further unnecessary calls if the information is
+already there.
+
+The input bitmask supports a flag osl_FileStatus_Mask_Validate which can be
+used to force retrieving uncached validated information. Setting this flag
+when calling osl_getFileStatus in combination with no other flag is a synonym
+for a "FileExists". This should only be done when processing a single file
+(i.e. before opening) and NEVER during enumeration of directory contents on
+any step of information processing. This would change the runtime behaviour
+from O(n) to O(n*n/2) on nearly every file system. On Windows NT reading the
+contents of a directory with 7000 entries and getting full information about
+every file only takes 0.6 seconds. Specifying the flag
+osl_FileStatus_Mask_Validate for each entry will increase the time to 180
+seconds (!!!).
+
+*/
+
+/* Error codes according to errno */
+typedef enum {
+ osl_File_E_None, /*!< on success */
+ osl_File_E_PERM, /*!< operation not permitted */
+ osl_File_E_NOENT, /*!< no such file or directory */
+ osl_File_E_SRCH, /*!< no process matches the PID */
+ osl_File_E_INTR, /*!< function call was interrupted */
+ osl_File_E_IO, /*!< I/O error occurred */
+ osl_File_E_NXIO, /*!< no such device or address */
+ osl_File_E_2BIG, /*!< argument list too long */
+ osl_File_E_NOEXEC, /*!< invalid executable file format */
+ osl_File_E_BADF, /*!< bad file descriptor */
+ osl_File_E_CHILD, /*!< there are no child processes */
+ osl_File_E_AGAIN, /*!< resource temp unavailable, try again later */
+ osl_File_E_NOMEM, /*!< no memory available */
+ osl_File_E_ACCES, /*!< file permissions do not allow operation */
+ osl_File_E_FAULT, /*!< bad address; an invalid pointer detected */
+ osl_File_E_BUSY, /*!< resource busy */
+ osl_File_E_EXIST, /*!< file exists where should only be created */
+ osl_File_E_XDEV, /*!< improper link across file systems detected */
+ osl_File_E_NODEV, /*!< wrong device type specified */
+ osl_File_E_NOTDIR, /*!< file isn't a directory where one is needed */
+ osl_File_E_ISDIR, /*!< file is a directory, invalid operation */
+ osl_File_E_INVAL, /*!< invalid argument to library function */
+ osl_File_E_NFILE, /*!< too many distinct file openings */
+ osl_File_E_MFILE, /*!< process has too many distinct files open */
+ osl_File_E_NOTTY, /*!< inappropriate I/O control operation */
+ osl_File_E_FBIG, /*!< file too large */
+ osl_File_E_NOSPC, /*!< no space left on device, write failed */
+ osl_File_E_SPIPE, /*!< invalid seek operation (such as on pipe) */
+ osl_File_E_ROFS, /*!< illegal modification to read-only filesystem */
+ osl_File_E_MLINK, /*!< too many links to file */
+ osl_File_E_PIPE, /*!< broken pipe; no process reading from other end of pipe */
+ osl_File_E_DOM, /*!< domain error (mathematical error) */
+ osl_File_E_RANGE, /*!< range error (mathematical error) */
+ osl_File_E_DEADLK, /*!< deadlock avoided */
+ osl_File_E_NAMETOOLONG, /*!< filename too long */
+ osl_File_E_NOLCK, /*!< no locks available */
+ osl_File_E_NOSYS, /*!< function not implemented */
+ osl_File_E_NOTEMPTY, /*!< directory not empty */
+ osl_File_E_LOOP, /*!< too many levels of symbolic links found during name lookup */
+ osl_File_E_ILSEQ, /*!< invalid or incomplete byte sequence of multibyte char found */
+ osl_File_E_NOLINK, /*!< link has been severed */
+ osl_File_E_MULTIHOP, /*!< remote resource is not directly available */
+ osl_File_E_USERS, /*!< file quote system is confused as there are too many users */
+ osl_File_E_OVERFLOW, /*!< value too large for defined data type */
+ osl_File_E_NOTREADY, /*!< device not ready */
+ osl_File_E_invalidError, /*!< unmapped error: always last entry in enum! */
+ osl_File_E_TIMEDOUT, /*!< socket operation timed out */
+ osl_File_E_NETWORK, /*!< unexpected network error occurred (Windows) - could be a
+ user session was deleted, or an unexpected network error
+ occurred */
+ osl_File_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslFileError;
+
+typedef void *oslDirectory;
+typedef void *oslDirectoryItem;
+
+/** Open a directory for enumerating its contents.
+
+ @param[in] pustrDirectoryURL
+ The full qualified URL of the directory.
+
+ @param[out] pDirectory
+ On success it receives a handle used for subsequent calls by osl_getNextDirectoryItem().
+ The handle has to be released by a call to osl_closeDirectory().
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOENT the specified path doesn't exist
+ @retval osl_File_E_NOTDIR the specified path is not a directory
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_MFILE too many open files used by the process
+ @retval osl_File_E_NFILE too many open files in the system
+ @retval osl_File_E_NAMETOOLONG File name too long
+ @retval osl_File_E_LOOP Too many symbolic links encountered
+
+ @see osl_getNextDirectoryItem()
+ @see osl_closeDirectory()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_openDirectory(
+ rtl_uString *pustrDirectoryURL, oslDirectory *pDirectory);
+
+/** Retrieve the next item of a previously opened directory.
+
+ Retrieves the next item of a previously opened directory.
+ All handles have an initial refcount of 1.
+
+ @param[in] Directory
+ A directory handle received from a previous call to osl_openDirectory().
+
+ @param[out] pItem
+ On success it receives a handle that can be used for subsequent calls to osl_getFileStatus().
+ The handle has to be released by a call to osl_releaseDirectoryItem().
+
+ @param[in] uHint
+ With this parameter the caller can tell the implementation that (s)he
+ is going to call this function uHint times afterwards. This enables the implementation to
+ get the information for more than one file and cache it until the next calls.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_NOENT no more entries in this directory
+ @retval osl_File_E_BADF invalid oslDirectory parameter
+ @retval osl_File_E_OVERFLOW the value too large for defined data type
+
+ @see osl_releaseDirectoryItem()
+ @see osl_acquireDirectoryItem()
+ @see osl_getDirectoryItem()
+ @see osl_getFileStatus()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getNextDirectoryItem(
+ oslDirectory Directory,
+ oslDirectoryItem *pItem,
+ sal_uInt32 uHint
+ );
+
+/** Release a directory handle.
+
+ @param[in] Directory
+ A handle received by a call to osl_openDirectory().
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_BADF invalid oslDirectory parameter
+ @retval osl_File_E_INTR the function call was interrupted
+
+ @see osl_openDirectory()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_closeDirectory(
+ oslDirectory Directory);
+
+/** Retrieve a single directory item.
+
+ Retrieves a single directory item. The returned handle has an initial refcount of 1.
+ Due to performance issues it is not recommended to use this function while
+ enumerating the contents of a directory. In this case use osl_getNextDirectoryItem() instead.
+
+ @param[in] pustrFileURL
+ An absolute file URL.
+
+ @param[out] pItem
+ On success it receives a handle which can be used for subsequent calls to osl_getFileStatus().
+ The handle has to be released by a call to osl_releaseDirectoryItem().
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_MFILE too many open files used by the process
+ @retval osl_File_E_NFILE too many open files in the system
+ @retval osl_File_E_NOENT no such file or directory
+ @retval osl_File_E_LOOP too many symbolic links encountered
+ @retval osl_File_E_NAMETOOLONG the file name is too long
+ @retval osl_File_E_NOTDIR a component of the path prefix of path is not a directory
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_MULTIHOP multihop attempted
+ @retval osl_File_E_NOLINK link has been severed
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_INTR the function call was interrupted
+
+ @see osl_releaseDirectoryItem()
+ @see osl_acquireDirectoryItem()
+ @see osl_getFileStatus()
+ @see osl_getNextDirectoryItem()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getDirectoryItem(
+ rtl_uString *pustrFileURL,
+ oslDirectoryItem *pItem
+ );
+
+/** Increase the refcount of a directory item handle.
+
+ The caller responsible for releasing the directory item handle using osl_releaseDirectoryItem().
+
+ @param[in] Item
+ A handle received by a call to osl_getDirectoryItem() or osl_getNextDirectoryItem().
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_getDirectoryItem()
+ @see osl_getNextDirectoryItem()
+ @see osl_releaseDirectoryItem()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_acquireDirectoryItem(
+ oslDirectoryItem Item );
+
+
+/** Decrease the refcount of a directory item handle.
+
+ Decreases the refcount of a directory item handle.
+ If the refcount reaches 0 the data associated with
+ this directory item handle will be released.
+
+ @param[in] Item
+ A handle received by a call to osl_getDirectoryItem() or osl_getNextDirectoryItem().
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_getDirectoryItem()
+ @see osl_getNextDirectoryItem()
+ @see osl_acquireDirectoryItem()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_releaseDirectoryItem(
+ oslDirectoryItem Item );
+
+/** Determine if two directory items point the same underlying file
+
+ The comparison is done first by URL, and then by resolving links to
+ find the target, and finally by comparing inodes on unix.
+
+ @param[in] pItemA
+ A directory handle to compare with another handle
+
+ @param[in] pItemB
+ A directory handle to compare with pItemA
+
+ @retval sal_True if the items point to an identical resource
+ @retval sal_False if the items point to a different resource, or a fatal error occurred
+
+ @see osl_getDirectoryItem()
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_identicalDirectoryItem(
+ oslDirectoryItem pItemA,
+ oslDirectoryItem pItemB );
+
+/**
+ @defgroup filetype File types
+
+ @{
+ */
+typedef enum {
+ osl_File_Type_Directory, /*< directory */
+ osl_File_Type_Volume, /*< volume (e.g. C:, A:) */
+ osl_File_Type_Regular, /*< regular file */
+ osl_File_Type_Fifo, /*< named pipe */
+ osl_File_Type_Socket, /*< socket */
+ osl_File_Type_Link, /*< file link */
+ osl_File_Type_Special, /*< special device file */
+ osl_File_Type_Unknown /*< unknown file type */
+} oslFileType;
+/** @} */
+
+/**
+ @defgroup fileattrs File attributes
+
+ @{
+ */
+#define osl_File_Attribute_ReadOnly 0x00000001
+#define osl_File_Attribute_Hidden 0x00000002
+#define osl_File_Attribute_Executable 0x00000010
+#define osl_File_Attribute_GrpWrite 0x00000020
+#define osl_File_Attribute_GrpRead 0x00000040
+#define osl_File_Attribute_GrpExe 0x00000080
+#define osl_File_Attribute_OwnWrite 0x00000100
+#define osl_File_Attribute_OwnRead 0x00000200
+#define osl_File_Attribute_OwnExe 0x00000400
+#define osl_File_Attribute_OthWrite 0x00000800
+#define osl_File_Attribute_OthRead 0x00001000
+#define osl_File_Attribute_OthExe 0x00002000
+/** @} */
+
+/**
+ @defgroup filestatus Flags specifying which fields to retrieve by osl_getFileStatus
+
+ @{
+ */
+#define osl_FileStatus_Mask_Type 0x00000001
+#define osl_FileStatus_Mask_Attributes 0x00000002
+#define osl_FileStatus_Mask_CreationTime 0x00000010
+#define osl_FileStatus_Mask_AccessTime 0x00000020
+#define osl_FileStatus_Mask_ModifyTime 0x00000040
+#define osl_FileStatus_Mask_FileSize 0x00000080
+#define osl_FileStatus_Mask_FileName 0x00000100
+#define osl_FileStatus_Mask_FileURL 0x00000200
+#define osl_FileStatus_Mask_LinkTargetURL 0x00000400
+#define osl_FileStatus_Mask_All 0x7FFFFFFF
+#define osl_FileStatus_Mask_Validate 0x80000000
+/** @} */
+
+/** Structure containing information about files and directories
+
+ @see osl_getFileStatus()
+ @see oslFileType
+*/
+typedef struct _oslFileStatus {
+/** Must be initialized with the size in bytes of the structure before passing it to any function */
+ sal_uInt32 uStructSize;
+/** Determines which members of the structure contain valid data */
+ sal_uInt32 uValidFields;
+/** The type of the file (file, directory, volume). */
+ oslFileType eType;
+/** File attributes */
+ sal_uInt64 uAttributes;
+/** First creation time in nanoseconds since 1/1/1970. Can be the last modify time depending on
+ platform or file system. */
+ TimeValue aCreationTime;
+/** Last access time in nanoseconds since 1/1/1970. Can be the last modify time depending on
+ platform or file system. */
+ TimeValue aAccessTime;
+/** Last modify time in nanoseconds since 1/1/1970. */
+ TimeValue aModifyTime;
+/** Size in bytes of the file. Zero for directories and volumes. */
+ sal_uInt64 uFileSize;
+/** Case correct name of the file. Should be set to zero before calling osl_getFileStatus
+ and released after usage. */
+ rtl_uString *ustrFileName;
+/** Full URL of the file. Should be set to zero before calling osl_getFileStatus
+ and released after usage. */
+ rtl_uString *ustrFileURL;
+/** Full URL of the target file if the file itself is a link.
+ Should be set to zero before calling osl_getFileStatus
+ and released after usage. */
+ rtl_uString *ustrLinkTargetURL;
+} oslFileStatus;
+
+/** Retrieve information about a single file or directory.
+
+ @param[in] Item
+ A handle received by a previous call to osl_getDirectoryItem() or osl_getNextDirectoryItem().
+
+ @param[in,out] pStatus
+ Points to a structure which receives the information of the file or directory
+ represented by the handle Item. The member uStructSize has to be initialized to
+ sizeof(oslFileStatus) before calling this function.
+
+ @param[in] uFieldMask
+ Specifies which fields of the structure pointed to by pStatus are of interest to the caller.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_LOOP too many symbolic links encountered
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_NOENT no such file or directory
+ @retval osl_File_E_NAMETOOLONG file name too long
+ @retval osl_File_E_BADF invalid oslDirectoryItem parameter
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_OVERFLOW value too large for defined data type
+ @retval osl_File_E_INTR function call was interrupted
+ @retval osl_File_E_NOLINK link has been severed
+ @retval osl_File_E_MULTIHOP components of path require hopping to multiple
+ remote machines and the file system does not allow it
+ @retval osl_File_E_MFILE too many open files used by the process
+ @retval osl_File_E_NFILE too many open files in the system
+ @retval osl_File_E_NOSPC no space left on device
+ @retval osl_File_E_NXIO no such device or address
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_NOSYS function not implemented
+
+ @see osl_getDirectoryItem()
+ @see osl_getNextDirectoryItem()
+ @see oslFileStatus
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileStatus(
+ oslDirectoryItem Item, oslFileStatus *pStatus, sal_uInt32 uFieldMask );
+
+typedef void *oslVolumeDeviceHandle;
+
+/** Release a volume device handle.
+
+ Releases the given oslVolumeDeviceHandle which was acquired by a call to
+ osl_getVolumeInformation() or osl_acquireVolumeDeviceHandle().
+
+ @param[in] Handle
+ An oslVolumeDeviceHandle received by a call to osl_getVolumeInformation().
+
+ @retval
+ osl_File_E_None on success
+
+ @todo
+ specify all error codes that may be returned
+
+ @see osl_acquireVolumeDeviceHandle()
+ @see osl_getVolumeInformation()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_releaseVolumeDeviceHandle(
+ oslVolumeDeviceHandle Handle );
+
+/** Acquire a volume device handle.
+
+ Acquires the given oslVolumeDeviceHandle which was acquired by a call to
+ osl_getVolumeInformation(). The caller is responsible for releasing the
+ acquired handle by calling osl_releaseVolumeDeviceHandle().
+
+ @param[in] Handle
+ An oslVolumeDeviceHandle received by a call to osl_getVolumeInformation().
+
+ @retval
+ osl_File_E_None on success
+
+ @todo
+ specify all error codes that may be returned
+
+ @see osl_getVolumeInformation()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_acquireVolumeDeviceHandle(
+ oslVolumeDeviceHandle Handle );
+
+/** Get the full qualified URL where a device is mounted to.
+
+ @param[in] Handle
+ An oslVolumeDeviceHandle received by a call to osl_getVolumeInformation().
+
+ @param[out] ppustrDirectoryURL
+ Receives the full qualified URL where the device is mounted to.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_NXIO no such device or address
+ @retval osl_File_E_NODEV no such device
+ @retval osl_File_E_NOENT no such file or directory
+ @retval osl_File_E_FAULT bad address
+ @retval osl_FilE_E_INTR function call was interrupted
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_MULTIHOP multihop attempted
+ @retval osl_File_E_NOLINK link has been severed
+ @retval osl_File_E_EOVERFLOW value too large for defined data type
+
+ @see osl_getVolumeInformation()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getVolumeDeviceMountPath(
+ oslVolumeDeviceHandle Handle, rtl_uString **ppustrDirectoryURL);
+
+/**
+ @defgroup volattrs Volume attributes
+
+ @{
+ */
+#define osl_Volume_Attribute_Removeable 0x00000001
+#define osl_Volume_Attribute_Remote 0x00000002
+#define osl_Volume_Attribute_CompactDisc 0x00000004
+#define osl_Volume_Attribute_FixedDisk 0x00000008
+#define osl_Volume_Attribute_RAMDisk 0x00000010
+#define osl_Volume_Attribute_FloppyDisk 0x00000020
+
+#define osl_Volume_Attribute_Case_Is_Preserved 0x00000040
+#define osl_Volume_Attribute_Case_Sensitive 0x00000080
+
+/** @} */
+
+/**
+ @defgroup volinfoflags Flags specifying which fields to retrieve by osl_getVolumeInfo
+
+ @{
+ */
+
+#define osl_VolumeInfo_Mask_Attributes 0x00000001
+#define osl_VolumeInfo_Mask_TotalSpace 0x00000002
+#define osl_VolumeInfo_Mask_UsedSpace 0x00000004
+#define osl_VolumeInfo_Mask_FreeSpace 0x00000008
+#define osl_VolumeInfo_Mask_MaxNameLength 0x00000010
+#define osl_VolumeInfo_Mask_MaxPathLength 0x00000020
+#define osl_VolumeInfo_Mask_FileSystemName 0x00000040
+#define osl_VolumeInfo_Mask_DeviceHandle 0x00000080
+#define osl_VolumeInfo_Mask_FileSystemCaseHandling 0x00000100
+
+/** @} */
+
+/** Structure containing information about volumes
+
+ @see osl_getVolumeInformation()
+ @see oslFileType
+*/
+
+typedef struct _oslVolumeInfo {
+/** Must be initialized with the size in bytes of the structure before
+ passing it to any function */
+ sal_uInt32 uStructSize;
+/** Determines which members of the structure contain valid data */
+ sal_uInt32 uValidFields;
+/** Attributes of the volume (remote and/or removable) */
+ sal_uInt32 uAttributes;
+/** Total available space on the volume for the current process/user */
+ sal_uInt64 uTotalSpace;
+/** Used space on the volume for the current process/user */
+ sal_uInt64 uUsedSpace;
+/** Free space on the volume for the current process/user */
+ sal_uInt64 uFreeSpace;
+/** Maximum length of file name of a single item */
+ sal_uInt32 uMaxNameLength;
+/** Maximum length of a full qualified path in system notation */
+ sal_uInt32 uMaxPathLength;
+/** Points to a string that receives the name of the file system type. String
+ should be set to zero before calling osl_getVolumeInformation and released
+ after usage. */
+ rtl_uString *ustrFileSystemName;
+/** Pointer to handle the receives underlying device. Handle should be set to
+ zero before calling osl_getVolumeInformation */
+ oslVolumeDeviceHandle *pDeviceHandle;
+} oslVolumeInfo;
+
+/** Retrieve information about a volume.
+
+ Retrieves information about a volume. A volume can either be a mount point, a network
+ resource or a drive depending on Operating System and File System. Before calling this
+ function osl_getFileStatus() should be called to determine if the type is
+ osl_file_Type_Volume.
+
+ @param[in] pustrDirectoryURL
+ Full qualified URL of the volume
+
+ @param[out] pInfo
+ On success it receives information about the volume.
+
+ @param[in] uFieldMask
+ Specifies which members of the structure should be filled
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOTDIR not a directory
+ @retval osl_File_E_NAMETOOLONG file name too long
+ @retval osl_File_E_NOENT no such file or directory
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_LOOP too many symbolic links encountered
+ @retval ols_File_E_FAULT Bad address
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_NOSYS function not implemented
+ @retval osl_File_E_MULTIHOP multihop attempted
+ @retval osl_File_E_NOLINK link has been severed
+ @retval osl_File_E_INTR function call was interrupted
+
+ @see osl_getFileStatus()
+ @see oslVolumeInfo
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getVolumeInformation(
+ rtl_uString *pustrDirectoryURL,
+ oslVolumeInfo *pInfo,
+ sal_uInt32 uFieldMask );
+
+typedef void *oslFileHandle;
+
+/* Open flags */
+
+#define osl_File_OpenFlag_Read 0x00000001
+#define osl_File_OpenFlag_Write 0x00000002
+#define osl_File_OpenFlag_Create 0x00000004
+#define osl_File_OpenFlag_NoLock 0x00000008
+/* larger bit-fields reserved for internal use cf. detail/file.h */
+
+/** Open a regular file.
+
+ Open a file. Only regular files can be opened.
+
+ @param[in] pustrFileURL
+ The full qualified URL of the file to open.
+
+ @param[out] pHandle
+ On success it receives a handle to the open file.
+
+ @param[in] uFlags
+ Specifies the open mode.
+
+ On Android, if the file path is below the /assets folder, the file
+ exists only as a hopefully uncompressed element inside the app
+ package (.apk), which has been mapped into memory as a whole by
+ the LibreOffice Android bootstrapping code. So files "opened" from
+ there aren't actually files in the OS sense.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NAMETOOLONG pathname was too long
+ @retval osl_File_E_NOENT no such file or directory
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_AGAIN a write lock could not be established
+ @retval osl_File_E_NOTDIR not a directory
+ @retval osl_File_E_NXIO no such device or address
+ @retval osl_File_E_NODEV no such device
+ @retval osl_File_E_ROFS read-only file system
+ @retval osl_File_E_TXTBSY text file busy
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_LOOP too many symbolic links encountered
+ @retval osl_File_E_NOSPC no space left on device
+ @retval osl_File_E_ISDIR is a directory
+ @retval osl_File_E_MFILE too many open files used by the process
+ @retval osl_File_E_NFILE too many open files in the system
+ @retval osl_File_E_DQUOT quota exceeded
+ @retval osl_File_E_EXIST file exists
+ @retval osl_FilE_E_INTR function call was interrupted
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_MULTIHOP multihop attempted
+ @retval osl_File_E_NOLINK link has been severed
+ @retval osl_File_E_EOVERFLOW value too large for defined data type
+
+ @see osl_closeFile()
+ @see osl_setFilePos()
+ @see osl_getFilePos()
+ @see osl_readFile()
+ @see osl_writeFile()
+ @see osl_setFileSize()
+ @see osl_getFileSize()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_openFile(
+ rtl_uString *pustrFileURL, oslFileHandle *pHandle, sal_uInt32 uFlags );
+
+#define osl_Pos_Absolut 1
+#define osl_Pos_Current 2
+#define osl_Pos_End 3
+
+/** Set the internal position pointer of an open file.
+
+ @param[in] Handle
+ Handle to a file received by a previous call to osl_openFile().
+
+ @param[in] uHow
+ How to calculate the offset - osl_Pos_Absolut means start at the
+ beginning of the file, osl_Pos_Current means offset from the current
+ seek position and osl_Pos_End means the offset will be negative and
+ the position will be calculated backwards from the end of the file by
+ the offset provided.
+
+ @param[in] uPos
+ Seek offset, depending on uHow. If uHow is osl_Pos_End then the value must be negative.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ (e.g. if uHow is osl_Pos_End then must be negative)
+ @retval osl_File_E_OVERFLOW the resulting file offset would be a
+ value which cannot be represented correctly for regular files
+
+ @see osl_openFile()
+ @see osl_getFilePos()
+*/
+SAL_WARN_UNUSED_RESULT SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFilePos(
+ oslFileHandle Handle, sal_uInt32 uHow, sal_Int64 uPos );
+
+/** Retrieve the current position of the internal pointer of an open file.
+
+ @param[in] Handle
+ Handle to a file received by a previous call to osl_openFile().
+
+ @param[out] pPos
+ On success receives the current position of the file pointer.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_OVERFLOW the resulting file offset would be a value
+ which cannot be represented correctly for regular files
+
+ @see osl_openFile()
+ @see osl_setFilePos()
+ @see osl_readFile()
+ @see osl_writeFile()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFilePos(
+ oslFileHandle Handle, sal_uInt64 *pPos );
+
+/** Set the file size of an open file.
+
+ Sets the file size of an open file. The file can be truncated or enlarged by the function.
+ The position of the file pointer is not affeced by this function.
+
+ @param[in] Handle
+ Handle to a file received by a previous call to osl_openFile().
+
+ @param[in] uSize
+ New size in bytes.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_OVERFLOW the resulting file offset would be a value
+ which cannot be represented correctly for regular files
+
+ @see osl_openFile()
+ @see osl_setFilePos()
+ @see osl_getFileStatus()
+ @see osl_getFileSize()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFileSize(
+ oslFileHandle Handle, sal_uInt64 uSize );
+
+/** Get the file size of an open file.
+
+ Gets the file size of an open file.
+ The position of the file pointer is not affeced by this function.
+
+ @param[in] Handle
+ Handle to a file received by a previous call to osl_openFile().
+
+ @param[out] pSize
+ Current size in bytes.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_OVERFLOW the resulting file offset would be a value
+ which cannot be represented correctly for regular files
+
+ @see osl_openFile()
+ @see osl_setFilePos()
+ @see osl_getFileStatus()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileSize(
+ oslFileHandle Handle, sal_uInt64 *pSize );
+
+/** Indicate that the file can be accessed randomly (i.e. there is no sequential
+ reading). Basically it means that the first byte of every page in the
+ file-mapping will be read.
+
+ @since UDK 3.2.10
+ */
+#define osl_File_MapFlag_RandomAccess ((sal_uInt32)(0x1))
+
+/** Map flag denoting that the mapped address space will be accessed by the
+ process soon (and it is advantageous for the operating system to already
+ start paging in the data).
+
+ @attention As this assumes that madvise() with the WILLREAD flag is
+ asynchronous (which is I'm afraid an incorrect assumption), Linux systems
+ will ignore this flag.
+
+ @since UDK 3.2.12
+*/
+#define osl_File_MapFlag_WillNeed ((sal_uInt32)(0x2))
+
+/** Map a shared file into memory.
+
+ Files can be mapped into memory to allow multiple processes to use
+ this memory-mapped file to share data.
+
+ On Android, if the Handle refers to a file that is actually inside
+ the app package (.apk zip archive), no new mapping is created,
+ just a pointer to the file inside the already mapped .apk is
+ returned.
+
+ @param[in] Handle Handle of the file to be mapped.
+ @param[in,out] ppAddr Memory address of the mapped file
+ @param[in] uLength Amount to map of the file from the offset
+ @param[in] uOffset Offset into the file to map
+ @param[in] uFlags osl_File_MapFlag_RandomAccess or
+ osl_File_MapFlag_WillNeed
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL invalid file handle, on Unix systems also
+ can mean that the address, length of the file or the
+ file offset are too large or not aligned on a page
+ boundary; on Linux can also mean after Linux 2.6.12
+ that the length was set to 0 (illogical).
+ @retval osl_File_E_OVERFLOW requested mapping size too large,
+ or the file offset was too large
+ @retval osl_File_E_ACCES file descriptor to non-regular file, or
+ file descriptor not open for reading, or the file
+ descriptor is not open in read/write mode
+ @retval osl_File_E_AGAIN file has been locked, or too much memory
+ has been locked
+ @retval osl_File_E_NODEV underlying filesystem of specified file
+ does not support memory mapping
+ @retval osl_File_E_TXTBSY on Linux means that writing to the mapped
+ file is denied, but the file descriptor points to a file
+ open for writing
+ @retval osl_File_E_NOMEM process's maximum number of mappings have
+ been exceeded
+
+ @since UDK 3.2.10
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_mapFile (
+ oslFileHandle Handle,
+ void** ppAddr,
+ sal_uInt64 uLength,
+ sal_uInt64 uOffset,
+ sal_uInt32 uFlags
+);
+
+
+#ifndef ANDROID
+
+/** Unmap a shared file from memory.
+
+ This function just won't work on Android in general where for
+ (uncompressed) files inside the .apk, per SDK conventions in the
+ /assets folder, osl_mapFile() returns a pointer to the file inside
+ the already by LibreOffice Android-specific bootstrapping code
+ mmapped .apk archive. We can't go and randomly munmap part of the
+ .apk archive. So this function is not present on Android.
+
+ @since UDK 3.2.10
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_unmapFile (
+ void* pAddr,
+ sal_uInt64 uLength
+);
+
+#endif
+
+/** Unmap a file segment from memory.
+
+ Like osl_unmapFile(), but takes also the oslFileHandle argument
+ passed to osl_mapFile() when creating this mapping.
+
+ On Android, for files below /assets, i.e. located inside the app
+ archive (.apk), this won't actually unmap anything; all the .apk
+ stays mapped.
+
+ @since UDK 3.6
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_unmapMappedFile (
+ oslFileHandle Handle,
+ void* pAddr,
+ sal_uInt64 uLength
+);
+
+/** Read a number of bytes from a file.
+
+ Reads a number of bytes from a file. The internal file pointer is
+ increased by the number of bytes read.
+
+ @param[in] Handle
+ Handle to a file received by a previous call to osl_openFile().
+
+ @param[out] pBuffer
+ Points to a buffer which receives data. The buffer must be large enough
+ to hold uBytesRequested bytes.
+
+ @param[in] uBytesRequested
+ Number of bytes which should be retrieved.
+
+ @param[out] pBytesRead
+ On success the number of bytes which have actually been retrieved.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_INTR function call was interrupted
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_ISDIR is a directory
+ @retval osl_File_E_BADF bad file
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_AGAIN operation would block
+ @retval osl_File_E_NOLINK link has been severed
+
+ @see osl_openFile()
+ @see osl_writeFile()
+ @see osl_readLine()
+ @see osl_setFilePos()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_readFile(
+ oslFileHandle Handle, void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64 *pBytesRead );
+
+/** Test if the end of a file is reached.
+
+ @param[in] Handle
+ Handle to a file received by a previous call to osl_openFile().
+
+ @param[out] pIsEOF
+ Points to a variable that receives the end-of-file status.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_INTR function call was interrupted
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_ISDIR is a directory
+ @retval osl_File_E_BADF bad file
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_AGAIN operation would block
+ @retval osl_File_E_NOLINK link has been severed
+
+ @see osl_openFile()
+ @see osl_readFile()
+ @see osl_readLine()
+ @see osl_setFilePos()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_isEndOfFile(
+ oslFileHandle Handle, sal_Bool *pIsEOF );
+
+/** Write a number of bytes to a file.
+
+ Writes a number of bytes to a file.
+ The internal file pointer is increased by the number of bytes read.
+
+ @param[in] Handle
+ Handle to a file received by a previous call to osl_openFile().
+
+ @param[in] pBuffer
+ Points to a buffer which contains the data.
+
+ @param[in] uBytesToWrite
+ Number of bytes which should be written.
+
+ @param[out] pBytesWritten
+ On success the number of bytes which have actually been written.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_FBIG file too large
+ @retval osl_File_E_DQUOT quota exceeded
+ @retval osl_File_E_AGAIN operation would block
+ @retval osl_File_E_BADF bad file
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_INTR function call was interrupted
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_NOLCK no record locks available
+ @retval osl_File_E_NOLINK link has been severed
+ @retval osl_File_E_NOSPC no space left on device
+ @retval osl_File_E_NXIO no such device or address
+
+ @see osl_openFile()
+ @see osl_readFile()
+ @see osl_setFilePos()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_writeFile(
+ oslFileHandle Handle, const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64 *pBytesWritten );
+
+/** Read a number of bytes from a specified offset in a file.
+
+ The current position of the internal file pointer may or may not be changed.
+
+ @param[in] Handle
+ Handle to a file received by a previous call to osl_openFile().
+
+ @param[in] uOffset
+ Offset position from start of file where read starts
+
+ @param[out] pBuffer
+ Points to a buffer which receives data. The buffer must be large enough
+ to hold uBytesRequested bytes.
+
+ @param[in] uBytesRequested
+ Number of bytes which should be retrieved.
+
+ @param[out] pBytesRead
+ On success the number of bytes which have actually been retrieved.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_INTR function call was interrupted
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_ISDIR is a directory
+ @retval osl_File_E_BADF bad file
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_AGAIN operation would block
+ @retval osl_File_E_NOLINK link has been severed
+ @since UDK 3.2.10
+ */
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_readFileAt(
+ oslFileHandle Handle,
+ sal_uInt64 uOffset,
+ void* pBuffer,
+ sal_uInt64 uBytesRequested,
+ sal_uInt64* pBytesRead
+);
+
+/** Write a number of bytes to a specified offset in a file.
+
+ The current position of the internal file pointer may or may not be changed.
+
+ @param[in] Handle
+ Handle to a file received by a previous call to osl_openFile().
+
+ @param[in] uOffset
+ Position of file to write into.
+
+ @param[in] pBuffer
+ Points to a buffer which contains the data.
+
+ @param[in] uBytesToWrite
+ Number of bytes which should be written.
+
+ @param[out] pBytesWritten
+ On success the number of bytes which have actually been written.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_FBIG file too large
+ @retval osl_File_E_DQUOT quota exceeded
+ @retval osl_File_E_AGAIN operation would block
+ @retval osl_File_E_BADF bad file
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_INTR function call was interrupted
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_NOLCK no record locks available
+ @retval osl_File_E_NOLINK link has been severed
+ @retval osl_File_E_NOSPC no space left on device
+ @retval osl_File_E_NXIO no such device or address
+ @since UDK 3.2.10
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_writeFileAt(
+ oslFileHandle Handle,
+ sal_uInt64 uOffset,
+ const void* pBuffer,
+ sal_uInt64 uBytesToWrite,
+ sal_uInt64* pBytesWritten
+);
+
+/** Read a line from a file.
+
+ Reads a line from a file. The new line delimiter is NOT returned!
+
+ @param[in] Handle
+ Handle to a file received by a previous call to osl_openFile().
+
+ @param[in,out] ppSequence
+ A pointer pointer to a sal_Sequence that will hold the line read on success.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_INTR function call was interrupted
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_ISDIR is a directory
+ @retval osl_File_E_BADF bad file
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_AGAIN operation would block
+ @retval osl_File_E_NOLINK link has been severed
+
+ @see osl_openFile()
+ @see osl_readFile()
+ @see osl_writeFile()
+ @see osl_setFilePos()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_readLine(
+ oslFileHandle Handle, sal_Sequence** ppSequence );
+
+/** Synchronize the memory representation of a file with that on the physical medium.
+
+ The function ensures that all modified data and attributes of the file associated with
+ the given file handle have been written to the physical medium.
+ In case the hard disk has a write cache enabled, the data may not really be on
+ permanent storage when osl_syncFile returns.
+
+ @param Handle
+ [in] Handle to a file received by a previous call to osl_openFile().
+
+ @retval osl_File_E_None On success
+ @retval osl_File_E_INVAL The value of the input parameter is invalid
+ @retval osl_File_E_BADF The file associated with the given file handle is not open for writing
+ @retval osl_File_E_IO An I/O error occurred
+ @retval osl_File_E_NOSPC There is no enough space on the target device
+ @retval osl_File_E_ROFS The file associated with the given file handle is located on a read only file system
+ @retval osl_File_E_TIMEDOUT A remote connection timed out. This may happen when a file is on a remote location
+
+ @see osl_openFile()
+ @see osl_writeFile()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_syncFile( oslFileHandle Handle );
+
+/** Close an open file.
+
+ @param[in] Handle
+ Handle to a file received by a previous call to osl_openFile().
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_BADF Bad file
+ @retval osl_File_E_INTR function call was interrupted
+ @retval osl_File_E_NOLINK link has been severed
+ @retval osl_File_E_NOSPC no space left on device
+ @retval osl_File_E_IO on I/O errors
+
+ @see osl_openFile()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_closeFile( oslFileHandle Handle );
+
+/** Create a directory.
+
+ @param[in] pustrDirectoryURL
+ Full qualified URL of the directory to create.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_EXIST file exists
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_NAMETOOLONG file name too long
+ @retval osl_File_E_NOENT no such file or directory
+ @retval osl_File_E_NOTDIR not a directory
+ @retval osl_File_E_ROFS read-only file system
+ @retval osl_File_E_NOSPC no space left on device
+ @retval osl_File_E_DQUOT quota exceeded
+ @retval osl_File_E_LOOP too many symbolic links encountered
+ @retval osl_File_E_FAULT bad address
+ @retval osl_FileE_IO on I/O errors
+ @retval osl_File_E_MLINK too many links
+ @retval osl_File_E_MULTIHOP multihop attempted
+ @retval osl_File_E_NOLINK link has been severed
+
+ @see osl_removeDirectory()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_createDirectory( rtl_uString* pustrDirectoryURL );
+
+/** Create a directory, passing flags.
+
+ @param url
+ File URL of the directory to create.
+
+ @param flags
+ A combination of the same osl_File_OpenFlag_*s used by osl_openFile,
+ except that osl_File_OpenFlag_Create is implied and ignored. Support for
+ the various flags can differ across operating systems.
+
+ @see osl_createDirectory()
+
+ @since LibreOffice 4.3
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_createDirectoryWithFlags(
+ rtl_uString * url, sal_uInt32 flags);
+
+/** Remove an empty directory.
+
+ @param[in] pustrDirectoryURL
+ Full qualified URL of the directory.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_PERM operation not permitted
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_NOENT no such file or directory
+ @retval osl_File_E_NOTDIR not a directory
+ @retval osl_File_E_NOTEMPTY directory not empty
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_NAMETOOLONG file name too long
+ @retval osl_File_E_BUSY device or resource busy
+ @retval osl_File_E_ROFS read-only file system
+ @retval osl_File_E_LOOP too many symbolic links encountered
+ @retval osl_File_E_EXIST file exists
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_MULTIHOP multihop attempted
+ @retval osl_File_E_NOLINK link has been severed
+
+ @see osl_createDirectory()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_removeDirectory( rtl_uString* pustrDirectoryURL );
+
+/** Function pointer representing a function that will be called by osl_createDirectoryPath
+ if a directory has been created.
+
+ To avoid unpredictable results the callee must not access the directory whose
+ creation is just notified.
+
+ @param pData
+ [in] User specified data given in osl_createDirectoryPath.
+
+ @param aDirectoryUrl
+ [in] The absolute file URL of the directory that was just created by
+ osl_createDirectoryPath.
+
+ @see osl_createDirectoryPath
+*/
+typedef void (SAL_CALL *oslDirectoryCreationCallbackFunc)(void* pData, rtl_uString* aDirectoryUrl);
+
+/** Create a directory path.
+
+ The osl_createDirectoryPath function creates a specified directory path.
+ All nonexisting sub directories will be created.
+
+ @attention PLEASE NOTE You cannot rely on getting the error code
+ osl_File_E_EXIST for existing directories. Programming against this error
+ code is in general a strong indication of a wrong usage of osl_createDirectoryPath.
+
+ @param aDirectoryUrl
+ [in] The absolute file URL of the directory path to create.
+ A relative file URL will not be accepted.
+
+ @param aDirectoryCreationCallbackFunc
+ [in] Pointer to a function that will be called synchronously
+ for each sub directory that was created. The value of this
+ parameter may be NULL, in this case notifications will not be
+ sent.
+
+ @param pData
+ [in] User specified data to be passed to the directory creation
+ callback function. The value of this parameter may be arbitrary
+ and will not be interpreted by osl_createDirectoryPath.
+
+ @retval osl_File_E_None On success
+ @retval osl_File_E_INVAL The format of the parameters was not valid
+ @retval osl_File_E_ACCES Permission denied
+ @retval osl_File_E_EXIST The final node of the specified directory path already exist
+ @retval osl_File_E_NAMETOOLONG The name of the specified directory path exceeds the maximum allowed length
+ @retval osl_File_E_NOTDIR A component of the specified directory path already exist as file in any part of the directory path
+ @retval osl_File_E_ROFS Read-only file system
+ @retval osl_File_E_NOSPC No space left on device
+ @retval osl_File_E_DQUOT Quota exceeded
+ @retval osl_File_E_FAULT Bad address
+ @retval osl_File_E_IO I/O error
+ @retval osl_File_E_LOOP Too many symbolic links encountered
+ @retval osl_File_E_NOLINK Link has been severed
+ @retval osl_File_E_invalidError An unknown error occurred
+
+ @see oslDirectoryCreationFunc
+ @see oslFileError
+ @see osl_createDirectory
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_createDirectoryPath(
+ rtl_uString* aDirectoryUrl,
+ oslDirectoryCreationCallbackFunc aDirectoryCreationCallbackFunc,
+ void* pData);
+
+/** Remove a regular file.
+
+ @param[in] pustrFileURL
+ Full qualified URL of the file to remove.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_PERM operation not permitted
+ @retval osl_File_E_NAMETOOLONG file name too long
+ @retval osl_File_E_NOENT no such file or directory
+ @retval osl_File_E_ISDIR is a directory
+ @retval osl_File_E_ROFS read-only file system
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_LOOP too many symbolic links encountered
+ @retval osl_File_E_IO on I/O errors
+ @retval osl_File_E_BUSY device or resource busy
+ @retval osl_File_E_INTR function call was interrupted
+ @retval osl_File_E_MULTIHOP multihop attempted
+ @retval osl_File_E_NOLINK link has been severed
+ @retval osl_File_E_TXTBSY text file busy
+
+ @see osl_openFile()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_removeFile(
+ rtl_uString* pustrFileURL );
+
+/** Copy a file to a new destination.
+
+ Copies a file to a new destination. Copies only files not directories.
+ No assumptions should be made about preserving attributes or file time.
+
+ @param[in] pustrSourceFileURL
+ Full qualified URL of the source file.
+
+ @param[in] pustrDestFileURL
+ Full qualified URL of the destination file. A directory is NOT a valid destination file!
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_PERM operation not permitted
+ @retval osl_File_E_NAMETOOLONG file name too long
+ @retval osl_File_E_NOENT no such file or directory
+ @retval osl_File_E_ISDIR is a directory
+ @retval osl_File_E_ROFS read-only file system
+ @retval osl_File_E_BUSY if the implementation internally requires resources that are
+ (temporarily) unavailable (added with LibreOffice 4.4)
+
+ @see osl_moveFile()
+ @see osl_removeFile()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_copyFile(
+ rtl_uString* pustrSourceFileURL, rtl_uString *pustrDestFileURL );
+
+/** Move a file or directory to a new destination or renames it.
+
+ Moves a file or directory to a new destination or renames it.
+ File time and attributes are preserved.
+
+ @param[in] pustrSourceFileURL
+ Full qualified URL of the source file.
+
+ @param[in] pustrDestFileURL
+ Full qualified URL of the destination file. An existing directory is NOT a valid destination !
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_PERM operation not permitted
+ @retval osl_File_E_NAMETOOLONG file name too long
+ @retval osl_File_E_NOENT no such file or directory
+ @retval osl_File_E_ROFS read-only file system
+ @retval osl_File_E_BUSY if the implementation internally requires resources that are
+ (temporarily) unavailable (added with LibreOffice 4.4)
+
+ @see osl_copyFile()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_moveFile(
+ rtl_uString* pustrSourceFileURL, rtl_uString *pustrDestFileURL );
+
+/** Determine a valid unused canonical name for a requested name.
+
+ Determines a valid unused canonical name for a requested name.
+ Depending on the Operating System and the File System the illegal characters are replaced by valid ones.
+ If a file or directory with the requested name already exists a new name is generated following
+ the common rules on the actual Operating System and File System.
+
+ @param[in] pustrRequestedURL
+ Requested name of a file or directory.
+
+ @param[out] ppustrValidURL
+ On success receives a name which is unused and valid on the actual Operating System and
+ File System.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_getFileStatus()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getCanonicalName(
+ rtl_uString *pustrRequestedURL, rtl_uString **ppustrValidURL);
+
+/** Convert a path relative to a given directory into an full qualified file URL.
+
+ Convert a path relative to a given directory into an full qualified file URL.
+ The function resolves symbolic links if possible and path ellipses, so on success
+ the resulting absolute path is fully resolved.
+
+ @param[in] pustrBaseDirectoryURL
+ Base directory URL to which the relative path is related to.
+
+ @param[in] pustrRelativeFileURL
+ A URL of a file or directory relative to the directory path specified by pustrBaseDirectoryURL
+ or an absolute path.
+ If pustrRelativeFileURL denotes an absolute path pustrBaseDirectoryURL will be ignored.
+
+ @param[out] ppustrAbsoluteFileURL
+ On success it receives the full qualified absolute file URL.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_NOTDIR not a directory
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_NOENT no such file or directory
+ @retval osl_File_E_NAMETOOLONG file name too long
+ @retval osl_File_E_OVERFLOW value too large for defined data type
+ @retval osl_File_E_FAULT bad address
+ @retval osl_File_E_INTR function call was interrupted
+ @retval osl_File_E_LOOP too many symbolic links encountered
+ @retval osl_File_E_MULTIHOP multihop attempted
+ @retval osl_File_E_NOLINK link has been severed
+
+ @see osl_getFileStatus()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getAbsoluteFileURL(
+ rtl_uString* pustrBaseDirectoryURL,
+ rtl_uString *pustrRelativeFileURL,
+ rtl_uString **ppustrAbsoluteFileURL );
+
+/** Convert a system dependent path into a file URL.
+
+ @param[in] pustrSystemPath
+ A System dependent path of a file or directory.
+
+ @param[out] ppustrFileURL
+ On success it receives the file URL.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_getSystemPathFromFileURL()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileURLFromSystemPath(
+ rtl_uString *pustrSystemPath, rtl_uString **ppustrFileURL);
+
+/** Search a full qualified system path or a file URL.
+
+ @param[in] pustrFileName
+ A system dependent path, a file URL, a file or relative directory.
+
+ @param[in] pustrSearchPath
+ @parblock
+ A list of system paths, in which a given file has to be searched. The Notation of a path
+ list is system dependent, e.g. on UNIX system "/usr/bin:/bin" and on Windows "C:\BIN;C:\BATCH".
+ These paths are only for the search of a file or a relative path, otherwise it will be ignored.
+ If pustrSearchPath is NULL or while using the search path the search failed, the function
+ searches for a matching file in all system directories and in the directories listed in the PATH
+ environment variable.
+
+ The value of an environment variable should be used (e.g.
+ LD_LIBRARY_PATH) if the caller is not aware of the Operating System and so doesn't know which
+ path list delimiter to use.
+ @endparblock
+
+ @param[out] ppustrFileURL
+ On success it receives the full qualified file URL.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOTDIR not a directory
+ @retval osl_File_E_NOENT no such file or directory not found
+
+ @see osl_getFileURLFromSystemPath()
+ @see osl_getSystemPathFromFileURL()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_searchFileURL(
+ rtl_uString *pustrFileName, rtl_uString *pustrSearchPath, rtl_uString **ppustrFileURL );
+
+/** Convert a file URL into a system dependent path.
+
+ @param[in] pustrFileURL
+ A File URL.
+
+ @param[out] ppustrSystemPath
+ On success it receives the system path.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_getFileURLFromSystemPath()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getSystemPathFromFileURL(
+ rtl_uString *pustrFileURL, rtl_uString **ppustrSystemPath);
+
+/** Function pointer representing the function called back from osl_abbreviateSystemPath
+
+ @param[in] ustrText
+ Text to calculate the width for
+
+ @return
+ The width of the text specified by ustrText, e.g. it can return the width in pixel
+ or the width in character count.
+
+ @see osl_abbreviateSystemPath()
+*/
+typedef sal_uInt32 (SAL_CALL *oslCalcTextWidthFunc)( rtl_uString *ustrText );
+
+/** Abbreviate a system notation path.
+
+ @param[in] ustrSystemPath
+ The full system path to abbreviate
+
+ @param[out] pustrCompacted
+ Receives the compacted system path on output
+
+ @param[in] pCalcWidth
+ Function ptr that calculates the width of a string. Can be zero.
+
+ @param[in] uMaxWidth
+ Maximum width allowed that is returned from pCalcWidth.
+ If pCalcWidth is zero the character count is assumed as width.
+
+ @retval osl_File_E_None on success
+
+ @see oslCalcTextWidthFunc
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_abbreviateSystemPath(
+ rtl_uString *ustrSystemPath,
+ rtl_uString **pustrCompacted,
+ sal_uInt32 uMaxWidth,
+ oslCalcTextWidthFunc pCalcWidth );
+
+/** Set file attributes.
+
+ @param[in] pustrFileURL
+ The full qualified file URL.
+
+ @param[in] uAttributes
+ Attributes of the file to be set.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_getFileStatus()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFileAttributes(
+ rtl_uString *pustrFileURL, sal_uInt64 uAttributes );
+
+/** Set the file time.
+
+ @param[in] pustrFileURL
+ The full qualified URL of the file.
+
+ @param[in] aCreationTime
+ Creation time of the given file.
+
+ @param[in] aLastAccessTime
+ Time of the last access of the given file.
+
+ @param[in] aLastWriteTime
+ Time of the last modifying of the given file.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOENT no such file or directory not found
+
+ @see osl_getFileStatus()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFileTime(
+ rtl_uString *pustrFileURL,
+ const TimeValue *aCreationTime,
+ const TimeValue *aLastAccessTime,
+ const TimeValue *aLastWriteTime);
+
+/** Retrieves the file URL of the system's temporary directory path
+
+ @param[out] pustrTempDirURL
+ On success receives the URL of system's temporary directory path.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_NOENT no such file or directory not found
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_getTempDirURL(
+ rtl_uString **pustrTempDirURL );
+
+/** Creates a temporary file in the directory provided by the caller or the
+ directory returned by osl_getTempDirURL.
+
+ Creates a temporary file in the directory provided by the caller or the
+ directory returned by osl_getTempDirURL.
+ Under UNIX Operating Systems the file will be created with read and write
+ access for the user exclusively.
+ If the caller requests only a handle to the open file but not the name of
+ it, the file will be automatically removed on close else the caller is
+ responsible for removing the file on success.
+
+ Description of the different pHandle, ppustrTempFileURL parameter combinations.
+ pHandle is 0 and ppustrTempDirURL is 0 - this combination is invalid
+ pHandle is not 0 and ppustrTempDirURL is 0 - a handle to the open file
+ will be returned on success and the file will be automatically removed on close.
+ pHandle is 0 and ppustrTempDirURL is not 0 - the name of the file will be returned,
+ the caller is responsible for opening, closing and removing the file.
+ pHandle is not 0 and ppustrTempDirURL is not 0 - a handle to the open file as well as
+ the file name will be returned, the caller is responsible for closing and removing
+ the file.
+
+ @param[in] pustrDirectoryURL
+ Specifies the full qualified URL where the temporary file should be created.
+ If pustrDirectoryURL is 0 the path returned by osl_getTempDirURL will be used.
+
+ @param[out] pHandle
+ On success receives a handle to the open file. If pHandle is 0 the file will
+ be closed on return, in this case ppustrTempFileURL must not be 0.
+
+ @param[out] ppustrTempFileURL
+ On success receives the full qualified URL of the temporary file.
+ If ppustrTempFileURL is 0 the file will be automatically removed on close,
+ in this case pHandle must not be 0.
+ If ppustrTempFileURL is not 0 the caller receives the name of the created
+ file and is responsible for removing the file, in this case
+ *ppustrTempFileURL must be 0 or must point to a valid rtl_uString.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameter is invalid
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_ACCES Permission denied
+ @retval osl_File_E_NOENT No such file or directory
+ @retval osl_File_E_NOTDIR Not a directory
+ @retval osl_File_E_ROFS Read-only file system
+ @retval osl_File_E_NOSPC No space left on device
+ @retval osl_File_E_DQUOT Quota exceeded
+
+ @see osl_getTempDirURL()
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_createTempFile(
+ rtl_uString* pustrDirectoryURL,
+ oslFileHandle* pHandle,
+ rtl_uString** ppustrTempFileURL);
+
+/** Move a file to a new destination or rename it, taking old file's identity (if exists).
+
+ Moves or renames a file, replacing an existing file if exist. If the old file existed,
+ moved file's metadata, e.g. creation time (on FSes which keep files' creation time) or
+ ACLs, are set to old one's (to keep the old file's identity) - currently this is only
+ implemented fully on Windows; on other platforms, this is mostly equivalent to osl_moveFile.
+
+ @param[in] pustrSourceFileURL
+ Full qualified URL of the source file.
+
+ @param[in] pustrDestFileURL
+ Full qualified URL of the destination file.
+
+ @retval osl_File_E_None on success
+ @retval osl_File_E_INVAL the format of the parameters was not valid
+ @retval osl_File_E_NOMEM not enough memory for allocating structures
+ @retval osl_File_E_ACCES permission denied
+ @retval osl_File_E_PERM operation not permitted
+ @retval osl_File_E_NAMETOOLONG file name too long
+ @retval osl_File_E_NOENT no such file
+ @retval osl_File_E_ROFS read-only file system
+ @retval osl_File_E_BUSY if the implementation internally requires resources that are
+ (temporarily) unavailable
+
+ @see osl_moveFile()
+
+ @since LibreOffice 6.2
+*/
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_replaceFile(rtl_uString* pustrSourceFileURL,
+ rtl_uString* pustrDestFileURL);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_FILE_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/file.hxx b/include/osl/file.hxx
new file mode 100644
index 000000000..fcbabe96d
--- /dev/null
+++ b/include/osl/file.hxx
@@ -0,0 +1,1951 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_FILE_HXX
+#define INCLUDED_OSL_FILE_HXX
+
+#include "sal/config.h"
+
+#include <string.h>
+
+#include <cstddef>
+
+#include "sal/log.hxx"
+#include "osl/time.h"
+#include "rtl/ustring.hxx"
+
+#include "osl/file.h"
+#include "osl/diagnose.h"
+
+namespace rtl { class ByteSequence; }
+
+namespace osl
+{
+
+
+/** Base class for all File System specific objects.
+
+ @see Directory
+ @see DirectoryItem
+ @see File
+ */
+
+class FileBase
+{
+public:
+
+ enum RC {
+ E_None = osl_File_E_None, ///< on success
+ E_PERM = osl_File_E_PERM, ///< operation not permitted
+ E_NOENT = osl_File_E_NOENT, ///< no such file or directory
+ E_SRCH = osl_File_E_SRCH, ///< no process matches the PID
+ E_INTR = osl_File_E_INTR, ///< function call was interrupted
+ E_IO = osl_File_E_IO, ///< I/O error occurred
+ E_NXIO = osl_File_E_NXIO, ///< no such device or address
+ E_2BIG = osl_File_E_2BIG, ///< argument list too long
+ E_NOEXEC = osl_File_E_NOEXEC, ///< invalid executable file format
+ E_BADF = osl_File_E_BADF, ///< bad file descriptor
+ E_CHILD = osl_File_E_CHILD, ///< there are no child processes
+ E_AGAIN = osl_File_E_AGAIN, ///< resource temp unavailable, try again later
+ E_NOMEM = osl_File_E_NOMEM, ///< no memory available
+ E_ACCES = osl_File_E_ACCES, ///< file permissions do not allow operation
+ E_FAULT = osl_File_E_FAULT, ///< bad address; an invalid pointer detected
+ E_BUSY = osl_File_E_BUSY, ///< resource busy
+ E_EXIST = osl_File_E_EXIST, ///< file exists where should only be created
+ E_XDEV = osl_File_E_XDEV, ///< improper link across file systems detected
+ E_NODEV = osl_File_E_NODEV, ///< wrong device type specified
+ E_NOTDIR = osl_File_E_NOTDIR, ///< file isn't a directory where one is needed
+ E_ISDIR = osl_File_E_ISDIR, ///< file is a directory, invalid operation
+ E_INVAL = osl_File_E_INVAL, ///< invalid argument to library function
+ E_NFILE = osl_File_E_NFILE, ///< too many distinct file openings
+ E_MFILE = osl_File_E_MFILE, ///< process has too many distinct files open
+ E_NOTTY = osl_File_E_NOTTY, ///< inappropriate I/O control operation
+ E_FBIG = osl_File_E_FBIG, ///< file too large
+ E_NOSPC = osl_File_E_NOSPC, ///< no space left on device, write failed
+ E_SPIPE = osl_File_E_SPIPE, ///< invalid seek operation (such as on pipe)
+ E_ROFS = osl_File_E_ROFS, ///< illegal modification to read-only filesystem
+ E_MLINK = osl_File_E_MLINK, ///< too many links to file
+ E_PIPE = osl_File_E_PIPE, ///< broken pipe; no process reading from other end of pipe
+ E_DOM = osl_File_E_DOM, ///< domain error (mathematical error)
+ E_RANGE = osl_File_E_RANGE, ///< range error (mathematical error)
+ E_DEADLK = osl_File_E_DEADLK, ///< deadlock avoided
+ E_NAMETOOLONG = osl_File_E_NAMETOOLONG, ///< filename too long
+ E_NOLCK = osl_File_E_NOLCK, ///< no locks available
+ E_NOSYS = osl_File_E_NOSYS, ///< function not implemented
+ E_NOTEMPTY = osl_File_E_NOTEMPTY, ///< directory not empty
+ E_LOOP = osl_File_E_LOOP, ///< too many levels of symbolic links found during name lookup
+ E_ILSEQ = osl_File_E_ILSEQ, ///< invalid or incomplete byte sequence of multibyte char found
+ E_NOLINK = osl_File_E_NOLINK, ///< link has been severed
+ E_MULTIHOP = osl_File_E_MULTIHOP, ///< remote resource is not directly available
+ E_USERS = osl_File_E_USERS, ///< file quote system is confused as there are too many users
+ E_OVERFLOW = osl_File_E_OVERFLOW, ///< value too large for defined data type
+ E_NOTREADY = osl_File_E_NOTREADY, ///< device not ready
+ E_invalidError = osl_File_E_invalidError, ///< unmapped error: always last entry in enum!
+ E_TIMEDOUT = osl_File_E_TIMEDOUT, ///< socket operation timed out
+ E_NETWORK = osl_File_E_NETWORK
+ };
+
+
+public:
+
+ /** Determine a valid unused canonical name for a requested name.
+
+ Determines a valid unused canonical name for a requested name.
+ Depending on the Operating System and the File System the illegal characters are replaced by valid ones.
+ If a file or directory with the requested name already exists a new name is generated following
+ the common rules on the actual Operating System and File System.
+
+ @param[in] ustrRequestedURL
+ Requested name of a file or directory.
+
+ @param[out] ustrValidURL
+ On success receives a name which is unused and valid on the actual Operating System and
+ File System.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+
+ @see DirectoryItem::getFileStatus()
+ */
+
+ static RC getCanonicalName( const ::rtl::OUString& ustrRequestedURL, ::rtl::OUString& ustrValidURL )
+ {
+ return static_cast< RC >( osl_getCanonicalName( ustrRequestedURL.pData, &ustrValidURL.pData ) );
+ }
+
+ /** Convert a path relative to a given directory into an full qualified file URL.
+
+ Convert a path relative to a given directory into an full qualified file URL.
+ The function resolves symbolic links if possible and path ellipses, so on success
+ the resulting absolute path is fully resolved.
+
+ @param[in] ustrBaseDirectoryURL
+ Base directory URL to which the relative path is related to.
+
+ @param[in] ustrRelativeFileURL
+ A URL of a file or directory relative to the directory path specified by ustrBaseDirectoryURL
+ or an absolute path.
+ If ustrRelativeFileURL denotes an absolute path ustrBaseDirectoryURL will be ignored.
+
+ @param[out] ustrAbsoluteFileURL
+ On success it receives the full qualified absolute file URL.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_NOTDIR not a directory
+ @retval E_ACCES permission denied
+ @retval E_NOENT no such file or directory
+ @retval E_NAMETOOLONG file name too long
+ @retval E_OVERFLOW value too large for defined data type
+ @retval E_FAULT bad address
+ @retval E_INTR function call was interrupted
+ @retval E_LOOP too many symbolic links encountered
+ @retval E_MULTIHOP multihop attempted
+ @retval E_NOLINK link has been severed
+
+ @see DirectoryItem::getFileStatus()
+ */
+
+ static RC getAbsoluteFileURL( const ::rtl::OUString& ustrBaseDirectoryURL, const ::rtl::OUString& ustrRelativeFileURL, ::rtl::OUString& ustrAbsoluteFileURL )
+ {
+ return static_cast< RC >( osl_getAbsoluteFileURL( ustrBaseDirectoryURL.pData, ustrRelativeFileURL.pData, &ustrAbsoluteFileURL.pData ) );
+ }
+
+ /** Convert a file URL into a system dependent path.
+
+ @param[in] ustrFileURL
+ A File URL.
+
+ @param[out] ustrSystemPath
+ On success it receives the system path.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+
+ @see getFileURLFromSystemPath()
+ */
+
+ static RC getSystemPathFromFileURL( const ::rtl::OUString& ustrFileURL, ::rtl::OUString& ustrSystemPath )
+ {
+ return static_cast< RC >( osl_getSystemPathFromFileURL( ustrFileURL.pData, &ustrSystemPath.pData ) );
+ }
+
+ /** Convert a system dependent path into a file URL.
+
+ @param[in] ustrSystemPath
+ A System dependent path of a file or directory.
+
+ @param[out] ustrFileURL
+ On success it receives the file URL.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+
+ @see getSystemPathFromFileURL()
+ */
+
+ static RC getFileURLFromSystemPath( const ::rtl::OUString& ustrSystemPath, ::rtl::OUString& ustrFileURL )
+ {
+ return static_cast< RC >( osl_getFileURLFromSystemPath( ustrSystemPath.pData, &ustrFileURL.pData ) );
+ }
+
+ /** Search a full qualified system path or a file URL.
+
+ @param[in] ustrFileName
+ A system dependent path, a file URL, a file or relative directory
+
+ @param[in] ustrSearchPath
+ A list of system paths, in which a given file has to be searched. The Notation of a path list is
+ system dependent, e.g. on UNIX system "/usr/bin:/bin" and on Windows "C:\BIN;C:\BATCH".
+ These paths are only for the search of a file or a relative path, otherwise it will be ignored.
+ If ustrSearchPath is NULL or while using the search path the search failed, the function searches for
+ a matching file in all system directories and in the directories listed in the PATH environment
+ variable.
+ The value of an environment variable should be used (e.g. LD_LIBRARY_PATH) if the caller is not
+ aware of the Operating System and so doesn't know which path list delimiter to use.
+
+ @param[out] ustrFileURL
+ On success it receives the full qualified file URL.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOTDIR not a directory
+ @retval E_NOENT no such file or directory not found
+
+ @see getFileURLFromSystemPath()
+ @see getSystemPathFromFileURL()
+ */
+
+ static RC searchFileURL( const ::rtl::OUString& ustrFileName, const ::rtl::OUString& ustrSearchPath, ::rtl::OUString& ustrFileURL )
+ {
+ return static_cast< RC >( osl_searchFileURL( ustrFileName.pData, ustrSearchPath.pData, &ustrFileURL.pData ) );
+ }
+
+ /** Retrieves the file URL of the system's temporary directory path.
+
+ @param[out] ustrTempDirURL
+ On success receives the URL of system's temporary directory path.
+
+ @retval E_None on success
+ @retval E_NOENT no such file or directory not found
+ */
+
+ static RC getTempDirURL( ::rtl::OUString& ustrTempDirURL )
+ {
+ return static_cast< RC >( osl_getTempDirURL( &ustrTempDirURL.pData ) );
+ }
+
+ /** Creates a temporary file in the directory provided by the caller or the
+ directory returned by getTempDirURL.
+ Under UNIX Operating Systems the file will be created with read and write
+ access for the user exclusively.
+ If the caller requests only a handle to the open file but not the name of
+ it, the file will be automatically removed on close else the caller is
+ responsible for removing the file on success.<br><br>
+
+ @param[in] pustrDirectoryURL
+ Specifies the full qualified URL where the temporary file should be created.
+ If pustrDirectoryURL is 0 the path returned by osl_getTempDirURL will be used.
+
+ @param[out] pHandle
+ On success receives a handle to the open file.
+ If pHandle is 0 the file will be closed on return, in this case
+ pustrTempFileURL must not be 0.
+
+ @param[out] pustrTempFileURL
+ On success receives the full qualified URL of the temporary file.
+ If pustrTempFileURL is 0 the file will be automatically removed
+ on close, in this case pHandle must not be 0.
+ If pustrTempFileURL is not 0 the caller receives the name of the
+ created file and is responsible for removing the file.
+
+ Description of the different pHandle, ppustrTempFileURL parameter combinations.
+ pHandle is 0 and pustrTempDirURL is 0 - this combination is invalid<br>
+ pHandle is not 0 and pustrTempDirURL is 0 - a handle to the open file
+ will be returned on success and the file will be automatically removed on close<br>
+ pHandle is 0 and pustrTempDirURL is not 0 - the name of the file will be
+ returned, the caller is responsible for opening, closing and removing the file.<br>
+ pHandle is not 0 and pustrTempDirURL is not 0 - a handle to the open file as well as
+ the file name will be returned, the caller is responsible for closing and removing
+ the file.<br>
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameter is invalid
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_ACCES Permission denied
+ @retval E_NOENT No such file or directory
+ @retval E_NOTDIR Not a directory
+ @retval E_ROFS Read-only file system
+ @retval E_NOSPC No space left on device
+ @retval E_DQUOT Quota exceeded
+
+ @see getTempDirURL()
+ */
+
+ static RC createTempFile(
+ ::rtl::OUString* pustrDirectoryURL,
+ oslFileHandle* pHandle,
+ ::rtl::OUString* pustrTempFileURL)
+ {
+ rtl_uString* pustr_dir_url = pustrDirectoryURL ? pustrDirectoryURL->pData : NULL;
+ rtl_uString** ppustr_tmp_file_url = pustrTempFileURL ? &pustrTempFileURL->pData : NULL;
+
+ return static_cast< RC >( osl_createTempFile(pustr_dir_url, pHandle, ppustr_tmp_file_url) );
+ }
+};
+
+
+/** The VolumeDevice class.
+
+ @see VolumeInfo
+*/
+
+class VolumeDevice : public FileBase
+{
+ oslVolumeDeviceHandle _aHandle;
+
+public:
+
+ /** Constructor.
+ */
+
+ VolumeDevice() : _aHandle( NULL )
+ {
+ }
+
+ /** Copy constructor.
+
+ @param rDevice
+ The other volume device.
+ */
+
+ VolumeDevice( const VolumeDevice & rDevice )
+ {
+ _aHandle = rDevice._aHandle;
+ if ( _aHandle )
+ osl_acquireVolumeDeviceHandle( _aHandle );
+ }
+
+ /** Destructor.
+ */
+
+ ~VolumeDevice()
+ {
+ if ( _aHandle )
+ osl_releaseVolumeDeviceHandle( _aHandle );
+ }
+
+ /** Assignment operator.
+
+ @param rDevice
+ The other volume device.
+ */
+
+ VolumeDevice & operator =( const VolumeDevice & rDevice )
+ {
+ oslVolumeDeviceHandle newHandle = rDevice._aHandle;
+
+ if ( newHandle )
+ osl_acquireVolumeDeviceHandle( newHandle );
+
+ if ( _aHandle )
+ osl_releaseVolumeDeviceHandle( _aHandle );
+
+ _aHandle = newHandle;
+
+ return *this;
+ }
+
+ /** Get the full qualified URL where a device is mounted to.
+
+ @return
+ The full qualified URL where the device is mounted to.
+ */
+ rtl::OUString getMountPath()
+ {
+ rtl::OUString aPath;
+ osl_getVolumeDeviceMountPath( _aHandle, &aPath.pData );
+ return aPath;
+ }
+
+ friend class VolumeInfo;
+};
+
+
+class Directory;
+
+/** The VolumeInfo class.
+
+ Neither copy nor assignment is allowed for this class.
+
+ @see Directory::getVolumeInfo
+*/
+
+
+class VolumeInfo
+{
+ oslVolumeInfo _aInfo;
+ sal_uInt32 _nMask;
+ VolumeDevice _aDevice;
+
+ /** Copy constructor.
+ */
+
+ VolumeInfo( VolumeInfo& ) SAL_DELETED_FUNCTION;
+
+ /** Assignment operator.
+ */
+
+ VolumeInfo& operator = ( VolumeInfo& ) SAL_DELETED_FUNCTION;
+
+public:
+
+ /** Constructor.
+
+ @param nMask
+ Set of flags describing the demanded information.
+ */
+ VolumeInfo( sal_uInt32 nMask )
+ : _nMask( nMask )
+ {
+ memset( &_aInfo, 0, sizeof( oslVolumeInfo ));
+ _aInfo.uStructSize = sizeof( oslVolumeInfo );
+ _aInfo.pDeviceHandle = &_aDevice._aHandle;
+ }
+
+ ~VolumeInfo()
+ {
+ if( _aInfo.ustrFileSystemName )
+ rtl_uString_release( _aInfo.ustrFileSystemName );
+ }
+
+ /** Check if specified fields are valid.
+
+ @param nMask
+ Set of flags for the fields to check.
+
+ @return true if all fields are valid else false.
+ */
+ bool isValid( sal_uInt32 nMask ) const
+ {
+ return ( nMask & _aInfo.uValidFields ) == nMask;
+ }
+
+ /** Check the remote flag.
+
+ @return
+ true if Attributes are valid and the volume is remote else false.
+ */
+ bool getRemoteFlag() const
+ {
+ return (_aInfo.uAttributes & osl_Volume_Attribute_Remote) != 0;
+ }
+
+ /** Check the removable flag.
+
+ @return
+ true if attributes are valid and the volume is removable else false.
+ */
+ bool getRemoveableFlag() const
+ {
+ return (_aInfo.uAttributes & osl_Volume_Attribute_Removeable) != 0;
+ }
+
+ /** Check the compact disc flag.
+
+ @return
+ true if attributes are valid and the volume is a CDROM else false.
+ */
+
+ bool getCompactDiscFlag() const
+ {
+ return (_aInfo.uAttributes & osl_Volume_Attribute_CompactDisc) != 0;
+ }
+
+ /** Check the floppy disc flag.
+
+ @return
+ true if attributes are valid and the volume is a floppy disk else false.
+ */
+
+ bool getFloppyDiskFlag() const
+ {
+ return (_aInfo.uAttributes & osl_Volume_Attribute_FloppyDisk) != 0;
+ }
+
+ /** Check the fixed disk flag.
+
+ @return
+ true if attributes are valid and the volume is a fixed disk else false.
+ */
+
+ bool getFixedDiskFlag() const
+ {
+ return (_aInfo.uAttributes & osl_Volume_Attribute_FixedDisk) != 0;
+ }
+
+ /** Check the RAM disk flag.
+
+ @return
+ true if attributes are valid and the volume is a RAM disk else false.
+ */
+
+ bool getRAMDiskFlag() const
+ {
+ return (_aInfo.uAttributes & osl_Volume_Attribute_RAMDisk) != 0;
+ }
+
+ /** Determine the total space of a volume device.
+
+ @return
+ The total diskspace of this volume if this information is valid,
+ 0 otherwise.
+ */
+
+ sal_uInt64 getTotalSpace() const
+ {
+ return _aInfo.uTotalSpace;
+ }
+
+ /** Determine the free space of a volume device.
+
+ @return
+ The free diskspace of this volume if this information is valid,
+ 0 otherwise.
+ */
+
+ sal_uInt64 getFreeSpace() const
+ {
+ return _aInfo.uFreeSpace;
+ }
+
+ /** Determine the used space of a volume device.
+
+ @return
+ The used diskspace of this volume if this information is valid,
+ 0 otherwise.
+ */
+
+ sal_uInt64 getUsedSpace() const
+ {
+ return _aInfo.uUsedSpace;
+ }
+
+ /** Determine the maximal length of a file name.
+
+ @return
+ The maximal length of a file name if this information is valid,
+ 0 otherwise.
+ */
+
+ sal_uInt32 getMaxNameLength() const
+ {
+ return _aInfo.uMaxNameLength;
+ }
+
+ /** Determine the maximal length of a path name.
+
+ @return
+ The maximal length of a path if this information is valid,
+ 0 otherwise.
+ */
+
+ sal_uInt32 getMaxPathLength() const
+ {
+ return _aInfo.uMaxPathLength;
+ }
+
+ /** Determine the name of the volume device's File System.
+
+ @return
+ The name of the volume's filesystem if this information is valid,
+ otherwise an empty string.
+ */
+
+ ::rtl::OUString getFileSystemName() const
+ {
+ return _aInfo.ustrFileSystemName ? ::rtl::OUString( _aInfo.ustrFileSystemName ) : ::rtl::OUString();
+ }
+
+
+ /** Get the volume device handle.
+
+ @return
+ The device handle of the volume if this information is valid,
+ otherwise returns NULL;
+ */
+
+ VolumeDevice getDeviceHandle() const
+ {
+ return _aDevice;
+ }
+
+ /** Return whether the file system is case sensitive or
+ case insensitive
+
+ @return
+ true if the file system is case sensitive false otherwise
+ */
+ bool isCaseSensitiveFileSystem() const
+ {
+ return (_aInfo.uAttributes & osl_Volume_Attribute_Case_Sensitive) != 0;
+ }
+
+ /** Return whether the file system preserves the case of
+ file and directory names or not
+
+ @return
+ true if the file system preserves the case of file and
+ directory names false otherwise
+ */
+ bool isCasePreservingFileSystem() const
+ {
+ return (_aInfo.uAttributes & osl_Volume_Attribute_Case_Is_Preserved) != 0;
+ }
+
+ friend class Directory;
+};
+
+
+class DirectoryItem;
+
+/** The FileStatus class.
+
+ @see DirectoryItem::getFileStatus
+*/
+
+class FileStatus
+{
+ oslFileStatus _aStatus;
+ sal_uInt32 _nMask;
+
+ /** Copy constructor.
+ */
+
+ FileStatus( FileStatus& ) SAL_DELETED_FUNCTION;
+
+ /** Assignment operator.
+ */
+
+ FileStatus& operator = ( FileStatus& ) SAL_DELETED_FUNCTION;
+
+public:
+
+ enum Type {
+ Directory = osl_File_Type_Directory,
+ Volume = osl_File_Type_Volume,
+ Regular = osl_File_Type_Regular,
+ Fifo = osl_File_Type_Fifo,
+ Socket = osl_File_Type_Socket,
+ Link = osl_File_Type_Link,
+ Special = osl_File_Type_Special,
+ Unknown = osl_File_Type_Unknown
+ };
+
+ /** Constructor.
+
+ @param nMask
+ Set of flags describing the demanded information.
+ */
+ FileStatus(sal_uInt32 nMask)
+ : _nMask(nMask)
+ {
+ memset(&_aStatus, 0, sizeof(_aStatus));
+ _aStatus.uStructSize = sizeof(_aStatus);
+ }
+
+ /** Destructor.
+ */
+ ~FileStatus()
+ {
+ if ( _aStatus.ustrFileURL )
+ rtl_uString_release( _aStatus.ustrFileURL );
+ if ( _aStatus.ustrLinkTargetURL )
+ rtl_uString_release( _aStatus.ustrLinkTargetURL );
+ if ( _aStatus.ustrFileName )
+ rtl_uString_release( _aStatus.ustrFileName );
+ }
+
+ /** Check if specified fields are valid.
+
+ @param nMask
+ Set of flags for the fields to check.
+
+ @return
+ true if all fields are valid else false.
+ */
+
+ bool isValid( sal_uInt32 nMask ) const
+ {
+ return ( nMask & _aStatus.uValidFields ) == nMask;
+ }
+
+ /** Get the file type.
+
+ @return
+ The file type.
+ */
+ Type getFileType() const
+ {
+ SAL_INFO_IF(
+ !isValid(osl_FileStatus_Mask_Type), "sal.osl",
+ "no FileStatus Type determined");
+ return isValid(osl_FileStatus_Mask_Type)
+ ? static_cast< Type >(_aStatus.eType) : Unknown;
+ }
+
+ /** Is it a directory?
+ This method returns True for both directories, and volumes.
+
+ @return
+ True if it's a directory, False otherwise.
+
+ @see getFileType
+ @since LibreOffice 3.6
+ */
+ bool isDirectory() const
+ {
+ return ( getFileType() == Directory || getFileType() == Volume );
+ }
+
+ /** Is it a regular file?
+
+ @return
+ True if it's a regular file, False otherwise.
+
+ @see getFileType
+ @see isFile
+ @see isLink
+ @since LibreOffice 3.6
+ */
+ bool isRegular() const
+ {
+ return ( getFileType() == Regular );
+ }
+
+ /** Is it a link?
+
+ @return
+ True if it's a link, False otherwise.
+
+ @see getFileType
+ @since LibreOffice 3.6
+ */
+ bool isLink() const
+ {
+ return ( getFileType() == Link );
+ }
+
+ /** Get the file attributes.
+
+ @return
+ The set of attribute flags of this file.
+ */
+
+ sal_uInt64 getAttributes() const
+ {
+ SAL_INFO_IF(
+ !isValid(osl_FileStatus_Mask_Attributes), "sal.osl",
+ "no FileStatus Attributes determined");
+ return _aStatus.uAttributes;
+ }
+
+ /** Get the creation time of this file.
+
+ @return
+ The creation time if this information is valid, an uninitialized
+ TimeValue otherwise.
+ */
+
+ TimeValue getCreationTime() const
+ {
+ SAL_INFO_IF(
+ !isValid(osl_FileStatus_Mask_CreationTime), "sal.osl",
+ "no FileStatus CreationTime determined");
+ return _aStatus.aCreationTime;
+ }
+
+ /** Get the file access time.
+
+ @return
+ The last access time if this information is valid, an uninitialized
+ TimeValue otherwise.
+ */
+
+ TimeValue getAccessTime() const
+ {
+ SAL_INFO_IF(
+ !isValid(osl_FileStatus_Mask_AccessTime), "sal.osl",
+ "no FileStatus AccessTime determined");
+ return _aStatus.aAccessTime;
+ }
+
+ /** Get the file modification time.
+
+ @return
+ The last modified time if this information is valid, an uninitialized
+ TimeValue otherwise.
+ */
+
+ TimeValue getModifyTime() const
+ {
+ SAL_INFO_IF(
+ !isValid(osl_FileStatus_Mask_ModifyTime), "sal.osl",
+ "no FileStatus ModifyTime determined");
+ return _aStatus.aModifyTime;
+ }
+
+ /** Get the size of the file.
+
+ @return
+ The actual file size if this information is valid, 0 otherwise.
+ */
+
+ sal_uInt64 getFileSize() const
+ {
+ SAL_INFO_IF(
+ !isValid(osl_FileStatus_Mask_FileSize), "sal.osl",
+ "no FileStatus FileSize determined");
+ return _aStatus.uFileSize;
+ }
+
+ /** Get the file name.
+
+ @return
+ The file name if this information is valid, an empty string otherwise.
+ */
+
+ ::rtl::OUString getFileName() const
+ {
+ SAL_INFO_IF(
+ !isValid(osl_FileStatus_Mask_FileName), "sal.osl",
+ "no FileStatus FileName determined");
+ return isValid(osl_FileStatus_Mask_FileName)
+ ? rtl::OUString(_aStatus.ustrFileName) : rtl::OUString();
+ }
+
+
+ /** Get the URL of the file.
+
+ @return
+ The full qualified URL of the file if this information is valid, an
+ empty string otherwise.
+ */
+
+ ::rtl::OUString getFileURL() const
+ {
+ SAL_INFO_IF(
+ !isValid(osl_FileStatus_Mask_FileURL), "sal.osl",
+ "no FileStatus FileURL determined");
+ return isValid(osl_FileStatus_Mask_FileURL)
+ ? rtl::OUString(_aStatus.ustrFileURL) : rtl::OUString();
+ }
+
+ /** Get the link target URL.
+
+ @return
+ The link target URL if this information is valid, an empty string
+ otherwise.
+ */
+
+ ::rtl::OUString getLinkTargetURL() const
+ {
+ SAL_INFO_IF(
+ !isValid(osl_FileStatus_Mask_LinkTargetURL), "sal.osl",
+ "no FileStatus LinkTargetURL determined");
+ return isValid(osl_FileStatus_Mask_LinkTargetURL)
+ ? rtl::OUString(_aStatus.ustrLinkTargetURL) : rtl::OUString();
+ }
+
+ friend class DirectoryItem;
+};
+
+
+/** The file class object provides access to file contents and attributes.
+
+ @see Directory
+ @see DirectoryItem
+ */
+
+class File: public FileBase
+{
+ oslFileHandle _pData;
+ ::rtl::OUString _aPath;
+
+ /** Copy constructor.
+ */
+
+ File( File& ) SAL_DELETED_FUNCTION;
+
+ /** Assignment operator.
+ */
+
+ File& operator = ( File& ) SAL_DELETED_FUNCTION;
+
+public:
+
+ /** Constructor.
+
+ @param[in] ustrFileURL
+ The full qualified URL of the file. Relative paths are not allowed.
+ */
+
+ File( const ::rtl::OUString& ustrFileURL ): _pData( NULL ), _aPath( ustrFileURL ) {}
+
+ /** Destructor
+ */
+
+ ~File()
+ {
+ close();
+ }
+
+ /** Obtain the URL.
+
+ @return
+ the URL with which this File instance was created.
+
+ @since LibreOffice 4.1
+ */
+ rtl::OUString getURL() const { return _aPath; }
+
+ /** Open a regular file.
+
+ Open a file. Only regular files can be opened.
+
+ @param[in] uFlags
+ Specifies the open mode.
+
+ @retval E_None on success
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NAMETOOLONG pathname was too long
+ @retval E_NOENT no such file or directory
+ @retval E_ACCES permission denied
+ @retval E_AGAIN a write lock could not be established
+ @retval E_NOTDIR not a directory
+ @retval E_NXIO no such device or address
+ @retval E_NODEV no such device
+ @retval E_ROFS read-only file system
+ @retval E_TXTBSY text file busy
+ @retval E_FAULT bad address
+ @retval E_LOOP too many symbolic links encountered
+ @retval E_NOSPC no space left on device
+ @retval E_ISDIR is a directory
+ @retval E_MFILE too many open files used by the process
+ @retval E_NFILE too many open files in the system
+ @retval E_DQUOT quota exceeded
+ @retval E_EXIST file exists
+ @retval E_INTR function call was interrupted
+ @retval E_IO on I/O errors
+ @retval E_MULTIHOP multihop attempted
+ @retval E_NOLINK link has been severed
+ @retval E_EOVERFLOW value too large for defined data type
+
+ @see close()
+ @see setPos()
+ @see getPos()
+ @see read()
+ @see write()
+ @see getSize()
+ @see setSize()
+ */
+
+ RC open( sal_uInt32 uFlags )
+ {
+ return static_cast< RC >( osl_openFile( _aPath.pData, &_pData, uFlags ) );
+ }
+
+ /** Close an open file.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_BADF Bad file
+ @retval E_INTR function call was interrupted
+ @retval E_NOLINK link has been severed
+ @retval E_NOSPC no space left on device
+ @retval E_IO on I/O errors
+
+ @see open()
+ */
+
+ RC close()
+ {
+ oslFileError Error = osl_File_E_BADF;
+
+ if( _pData )
+ {
+ Error=osl_closeFile( _pData );
+ _pData = NULL;
+ }
+
+ return static_cast< RC >( Error );
+ }
+
+ /** Set the internal position pointer of an open file.
+
+ @param[in] uHow
+ Distance to move the internal position pointer (from uPos).
+
+ @param[in] uPos
+ Absolute position from the beginning of the file.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files
+
+ @see open()
+ @see getPos()
+ */
+
+ SAL_WARN_UNUSED_RESULT RC setPos( sal_uInt32 uHow, sal_Int64 uPos )
+ {
+ return static_cast< RC >( osl_setFilePos( _pData, uHow, uPos ) );
+ }
+
+ /** Retrieve the current position of the internal pointer of an open file.
+
+ @param[out] uPos
+ On success receives the current position of the file pointer.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files
+
+ @see open()
+ @see setPos()
+ @see read()
+ @see write()
+ */
+
+ RC getPos( sal_uInt64& uPos )
+ {
+ return static_cast< RC >( osl_getFilePos( _pData, &uPos ) );
+ }
+
+ /** Test if the end of a file is reached.
+
+ @param[out] pIsEOF
+ Points to a variable that receives the end-of-file status.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_INTR function call was interrupted
+ @retval E_IO on I/O errors
+ @retval E_ISDIR is a directory
+ @retval E_BADF bad file
+ @retval E_FAULT bad address
+ @retval E_AGAIN operation would block
+ @retval E_NOLINK link has been severed
+
+ @see open()
+ @see read()
+ @see readLine()
+ @see setPos()
+ */
+
+ RC isEndOfFile( sal_Bool *pIsEOF )
+ {
+ return static_cast< RC >( osl_isEndOfFile( _pData, pIsEOF ) );
+ }
+
+ /** Set the file size of an open file.
+
+ Sets the file size of an open file. The file can be truncated or enlarged by the function.
+ The position of the file pointer is not affeced by this function.
+
+ @param[in] uSize
+ New size in bytes.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files
+
+ @see open()
+ @see setPos()
+ @see getStatus()
+ */
+
+ RC setSize( sal_uInt64 uSize )
+ {
+ return static_cast< RC >( osl_setFileSize( _pData, uSize ) );
+ }
+
+ /** Get the file size of an open file.
+
+ Gets the file size of an open file.
+ The position of the file pointer is not affeced by this function.
+
+ @param[out] rSize
+ Current size in bytes.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files
+
+ @see open()
+ @see setPos()
+ @see getSize()
+ @see setSize()
+ @see getStatus()
+ */
+
+ RC getSize( sal_uInt64 &rSize )
+ {
+ return static_cast< RC >( osl_getFileSize( _pData, &rSize ) );
+ }
+
+ /** Read a number of bytes from a file.
+
+ Reads a number of bytes from a file. The internal file pointer is
+ increased by the number of bytes read.
+
+ @param[out] pBuffer
+ Points to a buffer which receives data. The buffer must be large enough
+ to hold uBytesRequested bytes.
+
+ @param[in] uBytesRequested
+ Number of bytes which should be retrieved.
+
+ @param[out] rBytesRead
+ On success the number of bytes which have actually been retrieved.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_INTR function call was interrupted
+ @retval E_IO on I/O errors
+ @retval E_ISDIR is a directory
+ @retval E_BADF bad file
+ @retval E_FAULT bad address
+ @retval E_AGAIN operation would block
+ @retval E_NOLINK link has been severed
+
+ @see open()
+ @see write()
+ @see readLine()
+ @see setPos()
+ */
+
+ RC read( void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64& rBytesRead )
+ {
+ return static_cast< RC >( osl_readFile( _pData, pBuffer, uBytesRequested, &rBytesRead ) );
+ }
+
+ /** Write a number of bytes to a file.
+
+ Writes a number of bytes to a file.
+ The internal file pointer is increased by the number of bytes read.
+
+ @param[in] pBuffer
+ Points to a buffer which contains the data.
+
+ @param[in] uBytesToWrite
+ Number of bytes which should be written.
+
+ @param[out] rBytesWritten
+ On success the number of bytes which have actually been written.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_FBIG file too large
+ @retval E_DQUOT quota exceeded
+ @retval E_AGAIN operation would block
+ @retval E_BADF bad file
+ @retval E_FAULT bad address
+ @retval E_INTR function call was interrupted
+ @retval E_IO on I/O errors
+ @retval E_NOLCK no record locks available
+ @retval E_NOLINK link has been severed
+ @retval E_NOSPC no space left on device
+ @retval E_NXIO no such device or address
+
+ @see open()
+ @see read()
+ @see setPos()
+ */
+
+ RC write(const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64& rBytesWritten)
+ {
+ return static_cast< RC >( osl_writeFile( _pData, pBuffer, uBytesToWrite, &rBytesWritten ) );
+ }
+
+
+ /** Read a line from a file.
+
+ Reads a line from a file. The new line delimiter is NOT returned!
+
+ @param[in,out] aSeq
+ A reference to a ::rtl::ByteSequence that will hold the line read on success.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_INTR function call was interrupted
+ @retval E_IO on I/O errors
+ @retval E_ISDIR is a directory
+ @retval E_BADF bad file
+ @retval E_FAULT bad address
+ @retval E_AGAIN operation would block
+ @retval E_NOLINK link has been severed
+
+ @see open()
+ @see read()
+ @see write()
+ @see setPos()
+ */
+
+ RC readLine( ::rtl::ByteSequence& aSeq )
+ {
+ return static_cast< RC >( osl_readLine( _pData, reinterpret_cast<sal_Sequence**>(&aSeq) ) );
+ }
+
+ /** Synchronize the memory representation of a file with that on the physical medium.
+
+ The function ensures that all modified data and attributes of the file associated with
+ the given file handle have been written to the physical medium.
+ In case the hard disk has a write cache enabled, the data may not really be on
+ permanent storage when osl_syncFile returns.
+
+ @retval E_None On success
+ @retval E_INVAL The value of the input parameter is invalid
+ @retval E_BADF The file is not open for writing
+ @retval E_IO An I/O error occurred
+ @retval E_NOSPC There is no enough space on the target device
+ @retval E_ROFS The file is located on a read only file system
+ @retval E_TIMEDOUT A remote connection timed out. This may happen when a file is on a remote location
+
+ @see osl_syncFile()
+ @see open()
+ @see write()
+ */
+ RC sync() const
+ {
+ OSL_PRECOND(_pData, "File::sync(): File not open");
+ return static_cast< RC >(osl_syncFile(_pData));
+ }
+
+ /** Copy a file to a new destination.
+
+ Copies a file to a new destination. Copies only files not directories.
+ No assumptions should be made about preserving attributes or file time.
+
+ @param[in] ustrSourceFileURL
+ Full qualified URL of the source file.
+
+ @param[in] ustrDestFileURL
+ Full qualified URL of the destination file. A directory is NOT a valid destination file!
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_ACCES permission denied
+ @retval E_PERM operation not permitted
+ @retval E_NAMETOOLONG file name too long
+ @retval E_NOENT no such file or directory
+ @retval E_ISDIR is a directory
+ @retval E_ROFS read-only file system
+
+ @see move()
+ @see remove()
+ */
+
+ static RC copy( const ::rtl::OUString& ustrSourceFileURL, const ::rtl::OUString& ustrDestFileURL )
+ {
+ return static_cast< RC >( osl_copyFile( ustrSourceFileURL.pData, ustrDestFileURL.pData ) );
+ }
+
+ /** Move a file or directory to a new destination or renames it.
+
+ Moves a file or directory to a new destination or renames it.
+ File time and attributes are preserved.
+
+ @param[in] ustrSourceFileURL
+ Full qualified URL of the source file.
+
+ @param[in] ustrDestFileURL
+ Full qualified URL of the destination file. An existing directory is NOT a valid destination !
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_ACCES permission denied
+ @retval E_PERM operation not permitted
+ @retval E_NAMETOOLONG file name too long
+ @retval E_NOENT no such file or directory
+ @retval E_ROFS read-only file system
+
+ @see copy()
+ */
+
+ static RC move( const ::rtl::OUString& ustrSourceFileURL, const ::rtl::OUString& ustrDestFileURL )
+ {
+ return static_cast< RC >( osl_moveFile( ustrSourceFileURL.pData, ustrDestFileURL.pData ) );
+ }
+
+ /** Move a file to a new destination or rename it, taking old file's identity (if exists).
+
+ Moves or renames a file, replacing an existing file if exist. If the old file existed,
+ moved file's metadata, e.g. creation time (on FSes which keep files' creation time) or
+ ACLs, are set to old one's (to keep the old file's identity) - currently this is only
+ implemented fully on Windows; on other platforms, this is mostly equivalent to move().
+
+ @param[in] ustrSourceFileURL
+ Full qualified URL of the source file.
+
+ @param[in] ustrDestFileURL
+ Full qualified URL of the destination file.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_ACCES permission denied
+ @retval E_PERM operation not permitted
+ @retval E_NAMETOOLONG file name too long
+ @retval E_NOENT no such file
+ @retval E_ROFS read-only file system
+ @retval E_BUSY device or resource busy
+
+ @see move()
+
+ @since LibreOffice 6.2
+ */
+ static RC replace(const ::rtl::OUString& ustrSourceFileURL,
+ const ::rtl::OUString& ustrDestFileURL)
+ {
+ return static_cast<RC>(osl_replaceFile(ustrSourceFileURL.pData, ustrDestFileURL.pData));
+ }
+
+ /** Remove a regular file.
+
+ @param[in] ustrFileURL
+ Full qualified URL of the file to remove.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_ACCES permission denied
+ @retval E_PERM operation not permitted
+ @retval E_NAMETOOLONG file name too long
+ @retval E_NOENT no such file or directory
+ @retval E_ISDIR is a directory
+ @retval E_ROFS read-only file system
+ @retval E_FAULT bad address
+ @retval E_LOOP too many symbolic links encountered
+ @retval E_IO on I/O errors
+ @retval E_BUSY device or resource busy
+ @retval E_INTR function call was interrupted
+ @retval E_MULTIHOP multihop attempted
+ @retval E_NOLINK link has been severed
+ @retval E_TXTBSY text file busy
+
+ @see open()
+ */
+
+ static RC remove( const ::rtl::OUString& ustrFileURL )
+ {
+ return static_cast< RC >( osl_removeFile( ustrFileURL.pData ) );
+ }
+
+ /** Set file attributes.
+
+ @param[in] ustrFileURL
+ The full qualified file URL.
+
+ @param[in] uAttributes
+ Attributes of the file to be set.
+
+ @return
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+
+ @see FileStatus
+ */
+
+ static RC setAttributes( const ::rtl::OUString& ustrFileURL, sal_uInt64 uAttributes )
+ {
+ return static_cast< RC >( osl_setFileAttributes( ustrFileURL.pData, uAttributes ) );
+ }
+
+ /** Set the file time.
+
+ @param[in] ustrFileURL
+ The full qualified URL of the file.
+
+ @param[in] rCreationTime
+ Creation time of the given file.
+
+ @param[in] rLastAccessTime
+ Time of the last access of the given file.
+
+ @param[in] rLastWriteTime
+ Time of the last modifying of the given file.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOENT no such file or directory not found
+
+ @see FileStatus
+ */
+
+ static RC setTime(
+ const ::rtl::OUString& ustrFileURL,
+ const TimeValue& rCreationTime,
+ const TimeValue& rLastAccessTime,
+ const TimeValue& rLastWriteTime )
+ {
+ return static_cast< RC >( osl_setFileTime(
+ ustrFileURL.pData,
+ &rCreationTime,
+ &rLastAccessTime,
+ &rLastWriteTime ) );
+ }
+
+ friend class DirectoryItem;
+};
+
+
+/** The directory item class object provides access to file status information.
+
+ @see FileStatus
+ */
+
+class DirectoryItem: public FileBase
+{
+ oslDirectoryItem _pData;
+
+public:
+
+ /** Constructor.
+ */
+
+ DirectoryItem(): _pData( NULL )
+ {
+ }
+
+ /** Copy constructor.
+ */
+
+ DirectoryItem( const DirectoryItem& rItem ): _pData( rItem._pData)
+ {
+ if( _pData )
+ osl_acquireDirectoryItem( _pData );
+ }
+
+ /** Destructor.
+ */
+
+ ~DirectoryItem()
+ {
+ if( _pData )
+ osl_releaseDirectoryItem( _pData );
+ }
+
+ /** Assignment operator.
+ */
+
+ DirectoryItem& operator=(const DirectoryItem& rItem )
+ {
+ if (&rItem != this)
+ {
+ if( _pData )
+ osl_releaseDirectoryItem( _pData );
+
+ _pData = rItem._pData;
+
+ if( _pData )
+ osl_acquireDirectoryItem( _pData );
+ }
+ return *this;
+ }
+
+ /** Check for validity of this instance.
+
+ @return
+ true if object is valid directory item else false.
+ */
+
+ bool is()
+ {
+ return _pData != NULL;
+ }
+
+ /** Retrieve a single directory item.
+
+ Retrieves a single directory item. The returned handle has an initial refcount of 1.
+ Due to performance issues it is not recommended to use this function while
+ enumerating the contents of a directory. In this case use osl_getNextDirectoryItem() instead.
+
+ @param[in] ustrFileURL
+ An absolute file URL.
+
+ @param[out] rItem
+ On success it receives a handle which can be used for subsequent calls to osl_getFileStatus().
+ The handle has to be released by a call to osl_releaseDirectoryItem().
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_ACCES permission denied
+ @retval E_MFILE too many open files used by the process
+ @retval E_NFILE too many open files in the system
+ @retval E_NOENT no such file or directory
+ @retval E_LOOP too many symbolic links encountered
+ @retval E_NAMETOOLONG the file name is too long
+ @retval E_NOTDIR a component of the path prefix of path is not a directory
+ @retval E_IO on I/O errors
+ @retval E_MULTIHOP multihop attempted
+ @retval E_NOLINK link has been severed
+ @retval E_FAULT bad address
+ @retval E_INTR the function call was interrupted
+
+ @see FileStatus
+ @see Directory::getNextItem()
+ */
+
+ static RC get( const ::rtl::OUString& ustrFileURL, DirectoryItem& rItem )
+ {
+ if( rItem._pData)
+ {
+ osl_releaseDirectoryItem( rItem._pData );
+ rItem._pData = NULL;
+ }
+
+ return static_cast< RC >( osl_getDirectoryItem( ustrFileURL.pData, &rItem._pData ) );
+ }
+
+ /** Retrieve information about a single file or directory.
+
+ @param[in,out] rStatus
+ Reference to a class which receives the information of the file or directory
+ represented by this directory item.
+
+ @retval E_None on success
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_LOOP too many symbolic links encountered
+ @retval E_ACCES permission denied
+ @retval E_NOENT no such file or directory
+ @retval E_NAMETOOLONG file name too long
+ @retval E_BADF invalid oslDirectoryItem parameter
+ @retval E_FAULT bad address
+ @retval E_OVERFLOW value too large for defined data type
+ @retval E_INTR function call was interrupted
+ @retval E_NOLINK link has been severed
+ @retval E_MULTIHOP components of path require hopping to multiple remote machines and the file system does not allow it
+ @retval E_MFILE too many open files used by the process
+ @retval E_NFILE too many open files in the system
+ @retval E_NOSPC no space left on device
+ @retval E_NXIO no such device or address
+ @retval E_IO on I/O errors
+ @retval E_NOSYS function not implemented
+
+ @see get()
+ @see Directory::getNextItem()
+ @see FileStatus
+ */
+
+ RC getFileStatus( FileStatus& rStatus )
+ {
+ return static_cast< RC >( osl_getFileStatus( _pData, &rStatus._aStatus, rStatus._nMask ) );
+ }
+
+/** Determine if a directory item point the same underlying file
+
+ The comparison is done first by URL, and then by resolving links to
+ find the target, and finally by comparing inodes on unix.
+
+ @param[in] pOther
+ A directory handle to compare with the underlying object's item
+
+ @retval true if the items point to an identical resource<br>
+ @retval false if the items point to a different resource, or a fatal error occurred<br>
+
+ @see osl_getDirectoryItem()
+
+ @since LibreOffice 3.6
+*/
+ bool isIdenticalTo( const DirectoryItem &pOther )
+ {
+ return osl_identicalDirectoryItem( _pData, pOther._pData );
+ }
+
+ friend class Directory;
+};
+
+
+/** Base class for observers of directory creation notifications.
+
+ Clients which uses the method createDirectoryPath of the class
+ Directory may want to be informed about the directories that
+ have been created. This may be accomplished by deriving from
+ this base class and overwriting the virtual function
+ DirectoryCreated.
+
+ @see Directory::createPath
+*/
+class DirectoryCreationObserver
+{
+public:
+ virtual ~DirectoryCreationObserver() {}
+
+ /** This method will be called when a new directory has been
+ created and needs to be overwritten by derived classes.
+ You must not delete the directory that was just created
+ otherwise you will run into an endless loop.
+
+ @param aDirectoryUrl
+ [in]The absolute file URL of the directory that was just created by
+ ::osl::Directory::createPath.
+ */
+ virtual void DirectoryCreated(const rtl::OUString& aDirectoryUrl) = 0;
+};
+
+
+// This just an internal helper function for
+// private use.
+extern "C" inline void SAL_CALL onDirectoryCreated(void* pData, rtl_uString* aDirectoryUrl)
+{
+ static_cast<DirectoryCreationObserver*>(pData)->DirectoryCreated(aDirectoryUrl);
+}
+
+/** The directory class object provides an enumeration of DirectoryItems.
+
+ @see DirectoryItem
+ @see File
+ */
+
+class Directory: public FileBase
+{
+ oslDirectory _pData;
+ ::rtl::OUString _aPath;
+
+ /** Copy constructor.
+ */
+
+ Directory( Directory& ) SAL_DELETED_FUNCTION;
+
+ /** Assignment operator.
+ */
+
+ Directory& operator = ( Directory& ) SAL_DELETED_FUNCTION;
+
+public:
+
+ /** Constructor.
+
+ @param[in] strPath
+ The full qualified URL of the directory.
+ Relative URLs are not allowed.
+ */
+
+ Directory( const ::rtl::OUString& strPath ): _pData( NULL ), _aPath( strPath )
+ {
+ }
+
+ /** Destructor.
+ */
+
+ ~Directory()
+ {
+ close();
+ }
+
+ /** Obtain the URL.
+
+ @return
+ the URL with which this Directory instance was created.
+
+ @since LibreOffice 4.1
+ */
+ rtl::OUString getURL() const { return _aPath; }
+
+ /** Open a directory for enumerating its contents.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOENT the specified path doesn't exist
+ @retval E_NOTDIR the specified path is not a directory
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_ACCES permission denied
+ @retval E_MFILE too many open files used by the process
+ @retval E_NFILE too many open files in the system
+ @retval E_NAMETOOLONG File name too long
+ @retval E_LOOP Too many symbolic links encountered
+
+ @see getNextItem()
+ @see close()
+ */
+
+ RC open()
+ {
+ return static_cast< RC >( osl_openDirectory( _aPath.pData, &_pData ) );
+ }
+
+ /** Query if directory is open.
+
+ Query if directory is open and so item enumeration is valid.
+
+ @retval true if the directory is open else false.
+
+ @see open()
+ @see close()
+ */
+
+ bool isOpen() { return _pData != NULL; }
+
+ /** Close a directory.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_BADF invalid oslDirectory parameter
+ @retval E_INTR the function call was interrupted
+
+ @see open()
+ */
+
+ RC close()
+ {
+ oslFileError Error = osl_File_E_BADF;
+
+ if( _pData )
+ {
+ Error=osl_closeDirectory( _pData );
+ _pData = NULL;
+ }
+
+ return static_cast< RC >( Error );
+ }
+
+
+ /** Resets the directory item enumeration to the beginning.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOENT the specified path doesn't exist
+ @retval E_NOTDIR the specified path is not a directory
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_ACCES permission denied
+ @retval E_MFILE too many open files used by the process
+ @retval E_NFILE too many open files in the system
+ @retval E_NAMETOOLONG File name too long
+ @retval E_LOOP Too many symbolic links encountered
+
+ @see open()
+ */
+
+ RC reset()
+ {
+ close();
+ return open();
+ }
+
+ /** Retrieve the next item of a previously opened directory.
+
+ Retrieves the next item of a previously opened directory.
+
+ @param[out] rItem
+ On success a valid DirectoryItem.
+
+ @param[in] nHint
+ With this parameter the caller can tell the implementation that (s)he
+ is going to call this function uHint times afterwards. This enables the implementation to
+ get the information for more than one file and cache it until the next calls.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_NOENT no more entries in this directory
+ @retval E_BADF invalid oslDirectory parameter
+ @retval E_OVERFLOW the value too large for defined data type
+
+ @see DirectoryItem
+ */
+
+ RC getNextItem( DirectoryItem& rItem, sal_uInt32 nHint = 0 )
+ {
+ if( rItem._pData )
+ {
+ osl_releaseDirectoryItem( rItem._pData );
+ rItem._pData = NULL;
+ }
+ return static_cast<RC>(osl_getNextDirectoryItem( _pData, &rItem._pData, nHint ));
+ }
+
+
+ /** Retrieve information about a volume.
+
+ Retrieves information about a volume. A volume can either be a mount point, a network
+ resource or a drive depending on Operating System and File System.
+
+ @param[in] ustrDirectoryURL
+ Full qualified URL of the volume
+
+ @param[out] rInfo
+ On success it receives information about the volume.
+
+ @retval E_None on success
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOTDIR not a directory
+ @retval E_NAMETOOLONG file name too long
+ @retval E_NOENT no such file or directory
+ @retval E_ACCES permission denied
+ @retval E_LOOP too many symbolic links encountered
+ @retval E_FAULT Bad address
+ @retval E_IO on I/O errors
+ @retval E_NOSYS function not implemented
+ @retval E_MULTIHOP multihop attempted
+ @retval E_NOLINK link has been severed
+ @retval E_INTR function call was interrupted
+
+ @see FileStatus
+ @see VolumeInfo
+ */
+
+ static RC getVolumeInfo( const ::rtl::OUString& ustrDirectoryURL, VolumeInfo& rInfo )
+ {
+ return static_cast< RC >( osl_getVolumeInformation( ustrDirectoryURL.pData, &rInfo._aInfo, rInfo._nMask ) );
+ }
+
+ /** Create a directory.
+
+ @param[in] ustrDirectoryURL
+ Full qualified URL of the directory to create.
+
+ @param[in] flags
+ Optional flags, see osl_createDirectoryWithFlags for details. This
+ defaulted parameter is new since LibreOffice 4.3.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_EXIST file exists
+ @retval E_ACCES permission denied
+ @retval E_NAMETOOLONG file name too long
+ @retval E_NOENT no such file or directory
+ @retval E_NOTDIR not a directory
+ @retval E_ROFS read-only file system
+ @retval E_NOSPC no space left on device
+ @retval E_DQUOT quota exceeded
+ @retval E_LOOP too many symbolic links encountered
+ @retval E_FAULT bad address
+ @retval E_IO on I/O errors
+ @retval E_MLINK too many links
+ @retval E_MULTIHOP multihop attempted
+ @retval E_NOLINK link has been severed
+
+ @see remove()
+ */
+
+ static RC create(
+ const ::rtl::OUString& ustrDirectoryURL,
+ sal_uInt32 flags = osl_File_OpenFlag_Read | osl_File_OpenFlag_Write )
+ {
+ return static_cast< RC >(
+ osl_createDirectoryWithFlags( ustrDirectoryURL.pData, flags ) );
+ }
+
+ /** Remove an empty directory.
+
+ @param[in] ustrDirectoryURL
+ Full qualified URL of the directory.
+
+ @retval E_None on success
+ @retval E_INVAL the format of the parameters was not valid
+ @retval E_NOMEM not enough memory for allocating structures
+ @retval E_PERM operation not permitted
+ @retval E_ACCES permission denied
+ @retval E_NOENT no such file or directory
+ @retval E_NOTDIR not a directory
+ @retval E_NOTEMPTY directory not empty
+ @retval E_FAULT bad address
+ @retval E_NAMETOOLONG file name too long
+ @retval E_BUSY device or resource busy
+ @retval E_ROFS read-only file system
+ @retval E_LOOP too many symbolic links encountered
+ @retval E_EXIST file exists
+ @retval E_IO on I/O errors
+ @retval E_MULTIHOP multihop attempted
+ @retval E_NOLINK link has been severed
+
+ @see create()
+ */
+
+ static RC remove( const ::rtl::OUString& ustrDirectoryURL )
+ {
+ return static_cast< RC >( osl_removeDirectory( ustrDirectoryURL.pData ) );
+ }
+
+ /** Create a directory path.
+
+ The osl_createDirectoryPath function creates a specified directory path.
+ All nonexisting sub directories will be created.
+
+ @attention You cannot rely on getting the error code E_EXIST for existing
+ directories. Programming against this error code is in general a strong
+ indication of a wrong usage of osl_createDirectoryPath.
+
+ @param aDirectoryUrl
+ [in] The absolute file URL of the directory path to create.
+ A relative file URL will not be accepted.
+
+ @param aDirectoryCreationObserver
+ [in] Pointer to an instance of type DirectoryCreationObserver that will
+ be informed about the creation of a directory. The value of this
+ parameter may be NULL, in this case notifications will not be sent.
+
+ @retval E_None On success
+ @retval E_INVAL The format of the parameters was not valid
+ @retval E_ACCES Permission denied
+ @retval E_EXIST The final node of the specified directory path already exist
+ @retval E_NAMETOOLONG The name of the specified directory path exceeds the maximum allowed length
+ @retval E_NOTDIR A component of the specified directory path already exist as file in any part of the directory path
+ @retval E_ROFS Read-only file system
+ @retval E_NOSPC No space left on device
+ @retval E_DQUOT Quota exceeded
+ @retval E_FAULT Bad address
+ @retval E_IO I/O error
+ @retval E_LOOP Too many symbolic links encountered
+ @retval E_NOLINK Link has been severed
+ @retval E_invalidError An unknown error occurred
+
+ @see DirectoryCreationObserver
+ @see create
+ */
+ static RC createPath(
+ const ::rtl::OUString& aDirectoryUrl,
+ DirectoryCreationObserver* aDirectoryCreationObserver = NULL)
+ {
+ return static_cast< RC >(osl_createDirectoryPath(
+ aDirectoryUrl.pData,
+ aDirectoryCreationObserver ? onDirectoryCreated : NULL,
+ aDirectoryCreationObserver));
+ }
+};
+
+} /* namespace osl */
+
+#endif // INCLUDED_OSL_FILE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/getglobalmutex.hxx b/include/osl/getglobalmutex.hxx
new file mode 100644
index 000000000..87d68b440
--- /dev/null
+++ b/include/osl/getglobalmutex.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_GETGLOBALMUTEX_HXX
+#define INCLUDED_OSL_GETGLOBALMUTEX_HXX
+
+#include "osl/mutex.hxx"
+
+namespace osl
+{
+/** A helper functor for the rtl_Instance template.
+
+ See the rtl_Instance template for examples of how this class is used.
+ */
+class GetGlobalMutex
+{
+public:
+ ::osl::Mutex* operator()() { return ::osl::Mutex::getGlobalMutex(); }
+};
+}
+
+#endif // INCLUDED_OSL_GETGLOBALMUTEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/interlck.h b/include/osl/interlck.h
new file mode 100644
index 000000000..6264c595d
--- /dev/null
+++ b/include/osl/interlck.h
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_INTERLCK_H
+#define INCLUDED_OSL_INTERLCK_H
+
+#include "sal/config.h"
+
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#if defined(_WIN32)
+#include <intrin.h>
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+#include "config_global.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef sal_Int32 oslInterlockedCount;
+
+/** Increments the count variable addressed by pCount.
+ @param pCount Address of count variable
+ @return The adjusted value of the count variable.
+*/
+SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount);
+
+/** Decrement the count variable addressed by pCount.
+ @param pCount Address of count variable
+ @return The adjusted value of the count variable.
+*/
+SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount);
+
+
+/// @cond INTERNAL
+
+/** Increments the count variable addressed by p.
+
+ @attention This functionality should only be used internally within
+ LibreOffice.
+
+ @param p Address of count variable
+ @return The adjusted value of the count variable.
+
+ @since LibreOffice 4.0
+*/
+#if HAVE_GCC_BUILTIN_ATOMIC
+# define osl_atomic_increment(p) __sync_add_and_fetch((p), 1)
+#elif defined WNT
+# define osl_atomic_increment(p) _InterlockedIncrement(p)
+#else
+# define osl_atomic_increment(p) osl_incrementInterlockedCount((p))
+#endif
+
+
+/** Decrement the count variable addressed by p.
+
+ @attention This functionality should only be used internally within
+ LibreOffice.
+
+ @param p Address of count variable
+ @return The adjusted value of the count variable.
+
+ @since LibreOffice 4.0
+*/
+#if HAVE_GCC_BUILTIN_ATOMIC
+# define osl_atomic_decrement(p) __sync_sub_and_fetch((p), 1)
+#elif defined WNT
+# define osl_atomic_decrement(p) _InterlockedDecrement(p)
+#else
+# define osl_atomic_decrement(p) osl_decrementInterlockedCount((p))
+#endif
+
+/// @endcond
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif // INCLUDED_OSL_INTERLCK_H
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/module.h b/include/osl/module.h
new file mode 100644
index 000000000..9d80d352a
--- /dev/null
+++ b/include/osl/module.h
@@ -0,0 +1,230 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_MODULE_H
+#define INCLUDED_OSL_MODULE_H
+
+#include "sal/config.h"
+
+#include "rtl/ustring.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef SAL_DLLPREFIX
+#define SAL_MODULENAME(name) SAL_DLLPREFIX name SAL_DLLEXTENSION
+#else
+#define SAL_MODULENAME(name) name SAL_DLLEXTENSION
+#endif
+
+#if defined(_WIN32)
+#define SAL_MODULENAME_WITH_VERSION(name, version) name version SAL_DLLEXTENSION
+
+#elif defined(SAL_UNX)
+#if defined(MACOSX)
+#define SAL_MODULENAME_WITH_VERSION(name, version) SAL_DLLPREFIX name ".dylib." version
+#else
+#define SAL_MODULENAME_WITH_VERSION(name, version) SAL_DLLPREFIX name SAL_DLLEXTENSION "." version
+#endif
+
+#endif
+
+#define SAL_LOADMODULE_DEFAULT 0x00000
+#define SAL_LOADMODULE_LAZY 0x00001
+#define SAL_LOADMODULE_NOW 0x00002
+#define SAL_LOADMODULE_GLOBAL 0x00100
+
+typedef void* oslModule;
+
+/** Generic Function pointer type that will be used as symbol address.
+
+ @see osl_getFunctionSymbol.
+ @see osl_getModuleURLFromFunctionAddress.
+*/
+typedef void ( SAL_CALL *oslGenericFunction )( void );
+
+#ifndef DISABLE_DYNLOADING
+
+/** Load a shared library or module.
+
+ @param[in] strModuleName denotes the name of the module to be loaded.
+ @param[in] nRtldMode denotes the mode.
+
+ @returns NULL if the module could not be loaded, otherwise a handle to the module.
+*/
+SAL_DLLPUBLIC oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMode);
+
+/** Load a shared library or module.
+
+ @param[in] pModuleName denotes the name of the module to be loaded.
+ @param[in] nRtldMode denotes the mode.
+
+ @return NULL if the module could not be loaded, otherwise a handle to the module.
+
+ @since UDK 3.6
+*/
+SAL_DLLPUBLIC oslModule SAL_CALL osl_loadModuleAscii(const char *pModuleName, sal_Int32 nRtldMode);
+
+/** Load a module located relative to some other module.
+
+ @param[in] baseModule must point to a function that is part of the code of some loaded module;
+ must not be NULL.
+ @param[in] relativePath a relative URL; must not be NULL.
+ @param[in] mode the SAL_LOADMODULE_xxx flags.
+
+ @return a non-NULL handle to the loaded module, or NULL if an error occurred.
+
+ @since UDK 3.2.8
+*/
+SAL_DLLPUBLIC oslModule SAL_CALL osl_loadModuleRelative(
+ oslGenericFunction baseModule, rtl_uString * relativePath, sal_Int32 mode);
+
+/** Load a module located relative to some other module.
+
+ @param[in] baseModule must point to a function that is part of the code of some loaded module;
+ must not be NULL.
+ @param[in] relativePath a relative URL containing only ASCII (0x01--7F) characters;
+ must not be NULL.
+ @param[in] mode the SAL_LOADMODULE_xxx flags.
+
+ @return a non-NULL handle to the loaded module, or NULL if an error occurred.
+
+ @since LibreOffice 3.5
+*/
+SAL_DLLPUBLIC oslModule SAL_CALL osl_loadModuleRelativeAscii(
+ oslGenericFunction baseModule, char const * relativePath, sal_Int32 mode);
+ /* This function is guaranteed not to call into
+ FullTextEncodingDataSingleton in sal/textenc/textenc.cxx, so can be used
+ in its implementation without running into circles. */
+
+#endif
+
+/** Retrieve the handle of an already loaded module.
+
+ This function can be used to search for a function symbol in the process address space.
+ Do not use the returned handle as an argument to osl_unloadModule. On Unix platforms,
+ pModuleName gets ignored and the special handle RTLD_DEFAULT is returned.
+
+ @param[in] pModuleName denotes the name of the module to search for.
+ @attention Ignored on Unix.
+ @param[out] pResult a pointer to a oslModule that is updated with the
+ requested module handle on success.
+
+ @retval sal_True if the module handle could be retrieved and has been copied to *pResult.
+ @retval sal_False if the module has not been loaded yet.
+
+ @see osl_getFunctionSymbol
+ @see osl_getAsciiFunctionSymbol
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getModuleHandle(rtl_uString *pModuleName, oslModule *pResult);
+
+#ifndef DISABLE_DYNLOADING
+
+/** Release the module
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_unloadModule(oslModule Module);
+
+#endif
+
+/** lookup the specified symbol name.
+
+ @param[in] Module the handle of the Module.
+ @param[in] strSymbolName Name of the function that will be looked up.
+
+ @return address of the symbol or NULL if lookup failed.
+
+ @see osl_getFunctionSymbol
+*/
+SAL_DLLPUBLIC void* SAL_CALL osl_getSymbol( oslModule Module, rtl_uString *strSymbolName);
+
+/** Lookup the specified function symbol name.
+
+ osl_getFunctionSymbol is an alternative function for osl_getSymbol.
+ Use Function pointer as symbol address to conceal type conversion.
+
+ @param[in] Module the handle of the Module.
+ @param[in] ustrFunctionSymbolName Unicode name of the function that will be looked up.
+
+ @retval function-address on success
+ @retval NULL lookup failed or the parameter are invalid
+
+ @see osl_getSymbol
+ @see osl_getAsciiFunctionSymbol
+*/
+SAL_DLLPUBLIC oslGenericFunction SAL_CALL osl_getFunctionSymbol(
+ oslModule Module, rtl_uString *ustrFunctionSymbolName );
+
+/** Lookup the specified function symbol name.
+
+ osl_getAsciiFunctionSymbol is an alternative function for osl_getFunctionSymbol.
+ It expects the C-style function name string to contain ascii characters only.
+
+ @param Module
+ [in] a module handle as returned by osl_loadModule or osl_getModuleHandle
+
+ @param pSymbol
+ [in] Name of the function that will be looked up.
+
+ @retval function-address on success
+ @retval NULL lookup failed or the parameter are invalid
+
+ @see osl_getModuleHandle
+ @see osl_getFunctionSymbol
+*/
+SAL_DLLPUBLIC oslGenericFunction SAL_CALL osl_getAsciiFunctionSymbol(
+ oslModule Module, const char *pSymbol );
+
+/** Lookup URL of module which is mapped at the specified address.
+
+ @param[in] pv specifies an address in the process memory space.
+ @param[out] pustrURL receives the URL of the module that is mapped at pv.
+ @return sal_True on success, sal_False if no module can be found at the specified address.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getModuleURLFromAddress(
+ void *pv, rtl_uString **pustrURL );
+
+/** Lookup URL of module which is mapped at the specified function address.
+
+ osl_getModuleURLFromFunctionAddress is an alternative function for osl_getModuleURLFromAddress.
+ Use Function pointer as symbol address to conceal type conversion.
+
+ @param[in] pf function address in oslGenericFunction format.
+ @param[out] pustrFunctionURL receives the URL of the module that is mapped at pf.
+
+ @retval sal_True on success
+ @retval sal_False no module can be found at the specified function address or parameter is somewhat invalid
+
+ @see osl_getModuleURLFromAddress
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getModuleURLFromFunctionAddress(
+ oslGenericFunction pf, rtl_uString **pustrFunctionURL );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_MODULE_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/module.hxx b/include/osl/module.hxx
new file mode 100644
index 000000000..37f7e249e
--- /dev/null
+++ b/include/osl/module.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_MODULE_HXX
+#define INCLUDED_OSL_MODULE_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "rtl/ustring.hxx"
+#include "osl/module.h"
+
+namespace osl
+{
+
+class Module
+{
+ Module( const Module&) SAL_DELETED_FUNCTION;
+ Module& operator = ( const Module&) SAL_DELETED_FUNCTION;
+
+public:
+ static bool getUrlFromAddress(void * addr, ::rtl::OUString & libraryUrl) {
+ return osl_getModuleURLFromAddress(addr, &libraryUrl.pData);
+ }
+
+ /** Get module URL from the specified function address in the module.
+
+ Similar to getUrlFromAddress, but use a function address to get URL of the Module.
+ Use Function pointer as symbol address to conceal type conversion.
+
+ @param[in] addr function address in oslGenericFunction format.
+ @param[in,out] libraryUrl receives the URL of the module.
+
+ @retval true on success
+ @retval false can not get the URL from the specified function address or the parameter is invalid.
+
+ @see getUrlFromAddress
+ */
+ static bool getUrlFromAddress( oslGenericFunction addr, ::rtl::OUString & libraryUrl){
+ return osl_getModuleURLFromFunctionAddress( addr, &libraryUrl.pData );
+ }
+
+ Module(): m_Module(NULL){}
+
+#ifndef DISABLE_DYNLOADING
+
+ Module( const ::rtl::OUString& strModuleName, sal_Int32 nRtldMode = SAL_LOADMODULE_DEFAULT) : m_Module(NULL)
+ {
+ load( strModuleName, nRtldMode);
+ }
+
+#endif
+
+ ~Module()
+ {
+#ifndef DISABLE_DYNLOADING
+ osl_unloadModule(m_Module);
+#endif
+ }
+
+#ifndef DISABLE_DYNLOADING
+
+ bool SAL_CALL load( const ::rtl::OUString& strModuleName,
+ sal_Int32 nRtldMode = SAL_LOADMODULE_DEFAULT)
+ {
+ unload();
+ m_Module= osl_loadModule( strModuleName.pData, nRtldMode );
+ return is();
+ }
+
+ /// @since UDK 3.2.8
+ bool SAL_CALL loadRelative(
+ ::oslGenericFunction baseModule, ::rtl::OUString const & relativePath,
+ ::sal_Int32 mode = SAL_LOADMODULE_DEFAULT)
+ {
+ unload();
+ m_Module = osl_loadModuleRelative(baseModule, relativePath.pData, mode);
+ return is();
+ }
+
+ /// @since LibreOffice 3.5
+ bool SAL_CALL loadRelative(
+ oslGenericFunction baseModule, char const * relativePath,
+ sal_Int32 mode = SAL_LOADMODULE_DEFAULT)
+ {
+ unload();
+ m_Module = osl_loadModuleRelativeAscii(baseModule, relativePath, mode);
+ return is();
+ }
+
+ void SAL_CALL unload()
+ {
+ if (m_Module)
+ {
+ osl_unloadModule(m_Module);
+ m_Module = NULL;
+ }
+ }
+
+#endif
+
+ bool SAL_CALL is() const
+ {
+ return m_Module != NULL;
+ }
+
+ void* SAL_CALL getSymbol( const ::rtl::OUString& strSymbolName)
+ {
+ return osl_getSymbol( m_Module, strSymbolName.pData );
+ }
+
+ /** Get function address by the function name in the module.
+
+ getFunctionSymbol is an alternative function for getSymbol.
+ Use Function pointer as symbol address to conceal type conversion.
+
+ @param[in] ustrFunctionSymbolName Function name to be looked up.
+
+ @retval oslGenericFunction format function address on success
+ @retval NULL lookup failed or parameter is somewhat invalid
+
+ @see getSymbol
+ */
+ oslGenericFunction SAL_CALL getFunctionSymbol( const ::rtl::OUString& ustrFunctionSymbolName ) const
+ {
+ return osl_getFunctionSymbol( m_Module, ustrFunctionSymbolName.pData );
+ }
+
+ /// @since LibreOffice 3.5
+ oslGenericFunction SAL_CALL getFunctionSymbol(char const * name) const {
+ return osl_getAsciiFunctionSymbol(m_Module, name);
+ }
+
+ operator oslModule() const
+ {
+ return m_Module;
+ }
+
+ /** Release the module so that it will not be unloaded from the destructor.
+
+ This instance returns to the state of a default-constructed instance
+ again.
+
+ @since LibreOffice 4.3
+ */
+ void release() { m_Module = NULL; }
+
+private:
+ oslModule m_Module;
+
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/mutex.h b/include/osl/mutex.h
new file mode 100644
index 000000000..efc619d28
--- /dev/null
+++ b/include/osl/mutex.h
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_MUTEX_H
+#define INCLUDED_OSL_MUTEX_H
+
+#include "sal/config.h"
+
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct _oslMutexImpl;
+typedef struct _oslMutexImpl * oslMutex;
+
+/** Create a mutex.
+
+ @return 0 if the mutex could not be created, otherwise a handle to the mutex.
+*/
+SAL_DLLPUBLIC oslMutex SAL_CALL osl_createMutex(void);
+
+/** Release the OS-structures and free mutex data-structure.
+
+ @param Mutex the mutex-handle
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_destroyMutex(oslMutex Mutex);
+
+/** Acquire the mutex, block if already acquired by another thread.
+ @param Mutex handle to a created mutex.
+ @retval False if system-call fails.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_acquireMutex(oslMutex Mutex);
+
+/** Try to acquire the mutex without blocking.
+
+ @param Mutex handle to a created mutex.
+
+ @retval False if it could not be acquired.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_tryToAcquireMutex(oslMutex Mutex);
+
+/** Release the mutex.
+
+ @param Mutex handle to a created mutex.
+ @retval False if system-call fails.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_releaseMutex(oslMutex Mutex);
+
+/** Returns a unique and global mutex.
+
+ @return the global mutex.
+*/
+SAL_DLLPUBLIC oslMutex * SAL_CALL osl_getGlobalMutex(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_MUTEX_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/mutex.hxx b/include/osl/mutex.hxx
new file mode 100644
index 000000000..96bfd3e02
--- /dev/null
+++ b/include/osl/mutex.hxx
@@ -0,0 +1,260 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_MUTEX_HXX
+#define INCLUDED_OSL_MUTEX_HXX
+
+#include "osl/mutex.h"
+
+#include <cassert>
+
+namespace osl
+{
+ /** A mutual exclusion synchronization object
+ */
+ class SAL_WARN_UNUSED Mutex {
+
+ public:
+ /** Create a mutex.
+ @return 0 if the mutex could not be created, otherwise a handle to the mutex.
+ @see ::osl_createMutex()
+ */
+ Mutex()
+ {
+ mutex = osl_createMutex();
+ }
+
+ /** Release the OS-structures and free mutex data-structure.
+ @see ::osl_destroyMutex()
+ */
+ ~Mutex()
+ {
+ osl_destroyMutex(mutex);
+ }
+
+ /** Acquire the mutex, block if already acquired by another thread.
+ @return false if system-call fails.
+ @see ::osl_acquireMutex()
+ */
+ bool acquire()
+ {
+ return osl_acquireMutex(mutex);
+ }
+
+ /** Try to acquire the mutex without blocking.
+ @return false if it could not be acquired.
+ @see ::osl_tryToAcquireMutex()
+ */
+ bool tryToAcquire()
+ {
+ return osl_tryToAcquireMutex(mutex);
+ }
+
+ /** Release the mutex.
+ @return false if system-call fails.
+ @see ::osl_releaseMutex()
+ */
+ bool release()
+ {
+ return osl_releaseMutex(mutex);
+ }
+
+ /** Returns a global static mutex object.
+ The global and static mutex object can be used to initialize other
+ static objects in a thread safe manner.
+ @return the global mutex object
+ @see ::osl_getGlobalMutex()
+ */
+ static Mutex * getGlobalMutex()
+ {
+ return reinterpret_cast<Mutex *>(osl_getGlobalMutex());
+ }
+
+ private:
+ oslMutex mutex;
+
+ // access to the oslMutex
+ friend oslMutex* SAL_CALL ::osl_getGlobalMutex();
+
+ /** The underlying oslMutex has no reference count.
+
+ Since the underlying oslMutex is not a reference counted object, copy
+ constructed Mutex may work on an already destructed oslMutex object.
+
+ */
+ Mutex(const Mutex&) SAL_DELETED_FUNCTION;
+
+ /** This assignment operator is deleted for the same reason as
+ the copy constructor.
+ */
+ Mutex& operator= (const Mutex&) SAL_DELETED_FUNCTION;
+ };
+
+ /** Object lifetime scoped mutex object or interface lock.
+ *
+ * Acquires the template object on construction and releases it on
+ * destruction.
+ *
+ * @see MutexGuard
+ */
+ template<class T>
+ class Guard
+ {
+ Guard(const Guard&) SAL_DELETED_FUNCTION;
+ Guard& operator=(const Guard&) SAL_DELETED_FUNCTION;
+
+ protected:
+ T * pT;
+
+ public:
+ /** Acquires the object specified as parameter.
+ */
+ Guard(T * pT_) : pT(pT_)
+ {
+ assert(pT != NULL);
+ pT->acquire();
+ }
+
+ /** Acquires the object specified as parameter.
+ */
+ Guard(T & t) : pT(&t)
+ {
+ pT->acquire();
+ }
+
+ /** Releases the mutex or interface. */
+ ~Guard()
+ {
+ pT->release();
+ }
+ };
+
+ /** Object lifetime scoped mutex object or interface lock with unlock.
+ *
+ * Use this if you can't use scoped code blocks and Guard.
+ *
+ * @see ClearableMutexGuard, Guard
+ */
+ template<class T>
+ class ClearableGuard
+ {
+ ClearableGuard( const ClearableGuard& ) SAL_DELETED_FUNCTION;
+ ClearableGuard& operator=(const ClearableGuard&) SAL_DELETED_FUNCTION;
+
+ protected:
+ T * pT;
+
+ public:
+ /** Acquires the object specified as parameter.
+ */
+ ClearableGuard(T * pT_) : pT(pT_)
+ {
+ assert(pT != NULL);
+ pT->acquire();
+ }
+
+ /** Acquires the object specified as parameter.
+ */
+ ClearableGuard(T & t) : pT(&t)
+ {
+ pT->acquire();
+ }
+
+ /** Releases the mutex or interface if not already released by clear().
+ */
+ ~ClearableGuard()
+ {
+ if (pT)
+ pT->release();
+ }
+
+ /** Releases the mutex or interface.
+ */
+ void clear()
+ {
+#ifdef LIBO_INTERNAL_ONLY
+ assert(pT);
+#else
+ if (pT)
+#endif
+ {
+ pT->release();
+ pT = NULL;
+ }
+ }
+ };
+
+ /** Template for temporary releasable mutex objects and interfaces locks.
+ *
+ * Use this if you want to acquire a lock but need to temporary release
+ * it and can't use multiple scoped Guard objects.
+ *
+ * @see ResettableMutexGuard
+ */
+ template< class T >
+ class ResettableGuard : public ClearableGuard< T >
+ {
+ ResettableGuard(const ResettableGuard&) SAL_DELETED_FUNCTION;
+ ResettableGuard& operator=(const ResettableGuard&) SAL_DELETED_FUNCTION;
+
+ protected:
+ T* pResetT;
+
+ public:
+ /** Acquires the object specified as parameter.
+ */
+ ResettableGuard( T* pT_ ) :
+ ClearableGuard<T>( pT_ ),
+ pResetT( pT_ )
+ {}
+
+ /** Acquires the object specified as parameter.
+ */
+ ResettableGuard( T& rT ) :
+ ClearableGuard<T>( rT ),
+ pResetT( &rT )
+ {}
+
+ /** Re-acquires the mutex or interface.
+ */
+ void reset()
+ {
+#ifdef LIBO_INTERNAL_ONLY
+ assert(!this->pT);
+#endif
+ if (pResetT)
+ {
+ this->pT = pResetT;
+ this->pT->acquire();
+ }
+ }
+ };
+
+ typedef Guard<Mutex> MutexGuard;
+ typedef ClearableGuard<Mutex> ClearableMutexGuard;
+ typedef ResettableGuard< Mutex > ResettableMutexGuard;
+}
+
+#endif // INCLUDED_OSL_MUTEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/nlsupport.h b/include/osl/nlsupport.h
new file mode 100644
index 000000000..439c4db35
--- /dev/null
+++ b/include/osl/nlsupport.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_NLSUPPORT_H
+#define INCLUDED_OSL_NLSUPPORT_H
+
+#include "sal/config.h"
+
+#include "rtl/locale.h"
+#include "rtl/textenc.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ Determines the text encoding used by the underlying platform for the
+ specified locale.
+
+ @param pLocale
+ the locale to return the text encoding for. If this parameter is NULL,
+ the default locale of the current process is used.
+
+ @returns the rtl_TextEncoding that matches the platform specific encoding
+ description or RTL_TEXTENCODING_DONTKNOW if no mapping is available.
+*/
+
+SAL_DLLPUBLIC rtl_TextEncoding SAL_CALL osl_getTextEncodingFromLocale(
+ rtl_Locale * pLocale );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_NLSUPPORT_H
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/pipe.h b/include/osl/pipe.h
new file mode 100644
index 000000000..f8835428d
--- /dev/null
+++ b/include/osl/pipe.h
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_PIPE_H
+#define INCLUDED_OSL_PIPE_H
+
+#include "sal/config.h"
+
+#include "osl/security.h"
+#include "rtl/ustring.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ osl_Pipe_E_None, /*< no error */
+ osl_Pipe_E_NotFound, /*< Pipe could not be found */
+ osl_Pipe_E_AlreadyExists, /*< Pipe already exists */
+ osl_Pipe_E_NoProtocol, /*< Protocol not available */
+ osl_Pipe_E_NetworkReset, /*< Network dropped connection because of reset */
+ osl_Pipe_E_ConnectionAbort, /*< Software caused connection abort */
+ osl_Pipe_E_ConnectionReset, /*< Connection reset by peer */
+ osl_Pipe_E_NoBufferSpace, /*< No buffer space available */
+ osl_Pipe_E_TimedOut, /*< Connection timed out */
+ osl_Pipe_E_ConnectionRefused, /*< Connection refused */
+ osl_Pipe_E_invalidError, /*< unmapped error: always last entry in enum! */
+ osl_Pipe_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslPipeError;
+
+/** Pipe creation options.
+
+ A pipe can either be opened, or a new pipe can be created and opened.
+*/
+typedef sal_uInt32 oslPipeOptions;
+#define osl_Pipe_OPEN 0x0000 /*< open existing pipe */
+#define osl_Pipe_CREATE 0x0001 /*< create pipe and open it, fails if already exists */
+
+typedef struct oslPipeImpl * oslPipe;
+
+/** Create or open a pipe.
+
+ @param[in] strPipeName pipe name
+ @param[in] Options create or open the pipe
+ @param[in] Security pipe creator
+
+ @returns nullptr on failure, otherwise returns the pipe handle
+
+ @see osl_closePipe
+*/
+SAL_DLLPUBLIC oslPipe SAL_CALL osl_createPipe(
+ rtl_uString *strPipeName, oslPipeOptions Options, oslSecurity Security);
+
+/** Decreases the refcount of the pipe.
+
+ If the refcount drops to zero, the handle is destroyed.
+
+ @param[in] Pipe pipe handle
+
+ @see osl_acquirePipe
+ */
+SAL_DLLPUBLIC void SAL_CALL osl_releasePipe(oslPipe Pipe);
+
+/** Increases the refcount of the pipe.
+
+ @param[in] Pipe pipe handle
+
+ @see osl_releasePipe
+ */
+SAL_DLLPUBLIC void SAL_CALL osl_acquirePipe(oslPipe Pipe);
+
+/** Close the pipe.
+
+ Any read, write or accept actions stop immediately.
+
+ @param[in] Pipe pipe handle
+
+ @see osl_createPipe
+ */
+SAL_DLLPUBLIC void SAL_CALL osl_closePipe(oslPipe Pipe);
+
+
+SAL_DLLPUBLIC oslPipe SAL_CALL osl_acceptPipe(oslPipe Pipe);
+
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_sendPipe(oslPipe Pipe, const void* pBuffer, sal_Int32 BufferSize);
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_receivePipe(oslPipe Pipe, void* pBuffer, sal_Int32 BufferSize);
+
+/** Reads blocking from the pipe.
+ @return Number of read bytes. If less than BufferSize, the pipe was closed.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_readPipe( oslPipe Pipe, void *pBuffer, sal_Int32 BufferSize );
+
+/** Writes blocking onto the pipe.
+ @return Number of written bytes. If less than BufferSize, the pipe was closed.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_writePipe( oslPipe Pipe, const void *pBuffer, sal_Int32 BufferSize );
+
+SAL_DLLPUBLIC oslPipeError SAL_CALL osl_getLastPipeError(oslPipe Pipe);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_PIPE_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/pipe.hxx b/include/osl/pipe.hxx
new file mode 100644
index 000000000..cb9e2ec24
--- /dev/null
+++ b/include/osl/pipe.hxx
@@ -0,0 +1,224 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_OSL_PIPE_HXX
+#define INCLUDED_OSL_PIPE_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "osl/pipe_decl.hxx"
+
+namespace osl
+{
+
+ inline Pipe::Pipe()
+ : m_handle( NULL )
+ {}
+
+
+ inline Pipe::Pipe(const ::rtl::OUString& strName, oslPipeOptions Options )
+ : m_handle( osl_createPipe( strName.pData, Options , NULL ) )
+ {}
+
+
+ inline Pipe::Pipe(const ::rtl::OUString& strName, oslPipeOptions Options,const Security & rSecurity)
+ : m_handle( osl_createPipe( strName.pData, Options , rSecurity.getHandle() ) )
+ {}
+
+
+ inline Pipe::Pipe(const Pipe& pipe )
+ : m_handle( pipe.m_handle )
+ {
+ if( m_handle )
+ osl_acquirePipe( m_handle );
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ Pipe::Pipe(Pipe && other) noexcept : m_handle(other.m_handle) {
+ other.m_handle = nullptr;
+ }
+#endif
+
+ inline Pipe::Pipe( oslPipe pipe, __sal_NoAcquire )
+ : m_handle ( pipe )
+ {}
+
+
+ inline Pipe::Pipe(oslPipe pipe)
+ : m_handle( pipe )
+ {
+ if( m_handle )
+ osl_acquirePipe( m_handle );
+ }
+
+
+ inline Pipe::~Pipe()
+ {
+ if( m_handle )
+ osl_releasePipe( m_handle );
+ }
+
+
+ inline bool Pipe::create( const ::rtl::OUString & strName,
+ oslPipeOptions Options, const Security &rSec )
+ {
+ *this = Pipe( strName, Options, rSec );
+ return is();
+ }
+
+
+ inline bool Pipe::create( const ::rtl::OUString & strName, oslPipeOptions Options )
+ {
+ *this = Pipe( strName, Options );
+ return is();
+ }
+
+ inline Pipe& SAL_CALL Pipe::operator= (const Pipe& pipe)
+ {
+ *this = pipe.getHandle();
+ return *this;
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ Pipe & Pipe::operator =(Pipe && other) noexcept {
+ if (m_handle != nullptr) {
+ osl_releasePipe(m_handle);
+ }
+ m_handle = other.m_handle;
+ other.m_handle = nullptr;
+ return *this;
+ }
+#endif
+
+ inline Pipe & SAL_CALL Pipe::operator=( oslPipe pipe)
+ {
+ if( pipe )
+ osl_acquirePipe( pipe );
+ if( m_handle )
+ osl_releasePipe( m_handle );
+ m_handle = pipe;
+ return *this;
+ }
+
+
+ inline bool SAL_CALL Pipe::is() const
+ {
+ return m_handle != NULL;
+ }
+
+
+ inline bool SAL_CALL Pipe::operator==( const Pipe& rPipe ) const
+ {
+ return m_handle == rPipe.m_handle;
+ }
+
+
+ inline void SAL_CALL Pipe::close()
+ {
+ osl_closePipe( m_handle );
+ }
+
+
+ inline void SAL_CALL Pipe::clear()
+ {
+ if( m_handle )
+ {
+ osl_releasePipe( m_handle );
+ m_handle = NULL;
+ }
+ }
+
+
+ inline oslPipeError SAL_CALL Pipe::accept(StreamPipe& Connection)
+ {
+ Connection = StreamPipe( osl_acceptPipe( m_handle ), SAL_NO_ACQUIRE);
+ if( Connection.is() )
+ return osl_Pipe_E_None;
+ else
+ return getError();
+ }
+
+
+ inline oslPipeError SAL_CALL Pipe::getError() const
+ {
+ return osl_getLastPipeError( NULL );
+ }
+
+
+ inline oslPipe SAL_CALL Pipe::getHandle() const
+ {
+ return m_handle;
+ }
+
+
+ inline StreamPipe::StreamPipe(){}
+
+
+ inline StreamPipe::StreamPipe(oslPipe hPipe)
+ : Pipe( hPipe )
+ {
+ }
+
+
+ inline StreamPipe::StreamPipe(const ::rtl::OUString& strName, oslPipeOptions Options, const Security &rSec )
+ : Pipe( strName, Options , rSec )
+ {}
+
+
+ inline StreamPipe::StreamPipe(const ::rtl::OUString& strName, oslPipeOptions Options )
+ : Pipe( strName, Options )
+ {}
+
+ inline StreamPipe::StreamPipe( oslPipe pipe, __sal_NoAcquire noacquire )
+ : Pipe( pipe , noacquire )
+ {}
+
+
+ inline sal_Int32 SAL_CALL StreamPipe::read(void* pBuffer, sal_Int32 n) const
+ {
+ return osl_readPipe( m_handle, pBuffer, n );
+ }
+
+
+ inline sal_Int32 SAL_CALL StreamPipe::write(const void* pBuffer, sal_Int32 n) const
+ {
+ return osl_writePipe( m_handle, pBuffer , n );
+ }
+
+
+ inline sal_Int32 SAL_CALL StreamPipe::recv(void* pBuffer, sal_Int32 BytesToRead) const
+ {
+ return osl_receivePipe( m_handle, pBuffer , BytesToRead );
+ }
+
+
+ inline sal_Int32 SAL_CALL StreamPipe::send(const void* pBuffer, sal_Int32 BytesToSend) const
+ {
+ return osl_sendPipe( m_handle, pBuffer , BytesToSend );
+ }
+
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/pipe_decl.hxx b/include/osl/pipe_decl.hxx
new file mode 100644
index 000000000..cad7538c7
--- /dev/null
+++ b/include/osl/pipe_decl.hxx
@@ -0,0 +1,242 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_OSL_PIPE_DECL_HXX
+#define INCLUDED_OSL_PIPE_DECL_HXX
+
+#include "osl/pipe.h"
+#include "osl/security.hxx"
+#include "rtl/ustring.hxx"
+
+namespace osl
+{
+class StreamPipe;
+
+/** Represents a pipe.
+*/
+class Pipe
+{
+protected:
+ oslPipe m_handle;
+
+public:
+ /** Does not create a pipe. Use assignment operator to
+ make this a usable pipe.
+ */
+ inline Pipe();
+
+ /** Creates an insecure pipe that is accessible for all users.
+ @param strName
+ @param Options
+ */
+ inline Pipe(const ::rtl::OUString& strName, oslPipeOptions Options);
+
+ /** Creates a secure pipe that access depends on the umask settings.
+ @param strName
+ @param Options
+ @param rSecurity
+ */
+ inline Pipe(const ::rtl::OUString& strName, oslPipeOptions Options, const Security& rSecurity);
+
+ /** Copy constructor.
+ */
+ inline Pipe(const Pipe& pipe);
+
+#if defined LIBO_INTERNAL_ONLY
+ inline Pipe(Pipe&& other) noexcept;
+#endif
+
+ /** Constructs a Pipe reference without acquiring the handle
+ */
+ inline Pipe(oslPipe pipe, __sal_NoAcquire noacquire);
+
+ /** Creates pipe as wrapper around the underlying oslPipe.
+ @param Pipe
+ */
+ inline Pipe(oslPipe Pipe);
+
+ /** Destructor. Destroys the underlying oslPipe.
+ */
+ inline ~Pipe();
+
+ inline bool SAL_CALL is() const;
+
+ /** Creates an insecure pipe that is accessible for all users
+ with the given attributes.
+ If the pipe was already created, the old one will be discarded.
+ @param strName
+ @param Options
+ @param rSec
+ @return True if socket was successfully created.
+ */
+ inline bool create(const ::rtl::OUString& strName, oslPipeOptions Options,
+ const Security& rSec);
+
+ /** Creates a secure that access rights depend on the umask settings
+ with the given attributes.
+
+ If socket was already created, the old one will be discarded.
+ @param strName
+ @param Options
+ @return True if socket was successfully created.
+ */
+ inline bool create(const ::rtl::OUString& strName, oslPipeOptions Options = osl_Pipe_OPEN);
+
+ /** releases the underlying handle
+ */
+ inline void SAL_CALL clear();
+
+ /** Assignment operator. If pipe was already created, the old one will
+ be discarded.
+ */
+ inline Pipe& SAL_CALL operator=(const Pipe& pipe);
+
+#if defined LIBO_INTERNAL_ONLY
+ inline Pipe& operator=(Pipe&& other) noexcept;
+#endif
+
+ /** Assignment operator. If pipe was already created, the old one will
+ be discarded.
+ */
+ inline Pipe& SAL_CALL operator=(const oslPipe pipe);
+
+ /** Checks if the pipe is valid.
+ @return True if the object represents a valid pipe.
+ */
+ inline bool SAL_CALL isValid() const;
+
+ inline bool SAL_CALL operator==(const Pipe& rPipe) const;
+
+ /** Closes the pipe.
+ */
+ inline void SAL_CALL close();
+
+ /** Accept connection on an existing pipe
+ */
+ inline oslPipeError SAL_CALL accept(StreamPipe& Connection);
+
+ /** Delivers a constant describing the last error for the pipe system.
+ @return ENONE if no error occurred, invalid_PipeError if
+ an unknown (unmapped) error occurred, otherwise an enum describing the
+ error.
+ */
+ inline oslPipeError SAL_CALL getError() const;
+
+ inline oslPipe SAL_CALL getHandle() const;
+};
+
+/** A pipe to send or receive a stream of data.
+*/
+class StreamPipe : public Pipe
+{
+public:
+ /** Creates an unattached pipe. You must attach the pipe to an oslPipe
+ e.g. by using the operator=(oslPipe), before you can use the stream-
+ functionality of the object.
+ */
+ inline StreamPipe();
+
+ /** Creates pipe as wrapper around the underlying oslPipe.
+
+ @param Pipe
+ */
+ inline StreamPipe(oslPipe Pipe);
+
+ /** Creates a pipe.
+
+ @param[in] strName Pipe name
+ @param[in] Options Pipe options
+ */
+ inline StreamPipe(const ::rtl::OUString& strName, oslPipeOptions Options = osl_Pipe_OPEN);
+
+ /** Creates a pipe.
+
+ @param[in] strName Pipe name
+ @param[in] Options Pipe options
+ @param[in] rSec Security for the pipe
+ */
+ inline StreamPipe(const ::rtl::OUString& strName, oslPipeOptions Options, const Security& rSec);
+
+ /** Constructs a Pipe reference without acquiring the handle
+ */
+ inline StreamPipe(oslPipe pipe, __sal_NoAcquire noacquire);
+
+ /** Attaches the oslPipe to this object. If the object
+ already was attached to an oslPipe, the old one will
+ be closed and destroyed.
+
+ @param[in] Pipe Pipe to attach to this object
+ */
+ inline StreamPipe& SAL_CALL operator=(oslPipe Pipe);
+
+ /** Assignment operator
+ */
+ inline StreamPipe& SAL_CALL operator=(const Pipe& pipe);
+
+ /** Tries to receives BytesToRead data from the connected pipe,
+
+ @param[out] pBuffer Points to a buffer that will be filled with the received
+ data.
+ @param[in] BytesToRead The number of bytes to read. pBuffer must have at least
+ this size.
+
+ @return the number of received bytes.
+ */
+ inline sal_Int32 SAL_CALL recv(void* pBuffer, sal_Int32 BytesToRead) const;
+
+ /** Tries to sends BytesToSend data from the connected pipe.
+
+ @param[in] pBuffer Points to a buffer that contains the send-data.
+ @param[in] BytesToSend The number of bytes to send. pBuffer must have at least
+ this size.
+
+ @return the number of transferred bytes.
+ */
+ inline sal_Int32 SAL_CALL send(const void* pBuffer, sal_Int32 BytesToSend) const;
+
+ /** Retrieves n bytes from the stream and copies them into pBuffer.
+ The method avoids incomplete reads due to packet boundaries.
+
+ @param[in] pBuffer receives the read data.
+ @param[in] n the number of bytes to read. pBuffer must be large enough
+ to hold the n bytes!
+
+ @return the number of read bytes. The number will only be smaller than
+ n if an exceptional condition (e.g. connection closed) occurs.
+ */
+ inline sal_Int32 SAL_CALL read(void* pBuffer, sal_Int32 n) const;
+
+ /** Writes n bytes from pBuffer to the stream. The method avoids
+ incomplete writes due to packet boundaries.
+
+ @param[in] pBuffer contains the data to be written.
+ @param[in] n the number of bytes to write.
+
+ @return the number of written bytes. The number will only be smaller than
+ n if an exceptional condition (e.g. connection closed) occurs.
+ */
+ sal_Int32 SAL_CALL write(const void* pBuffer, sal_Int32 n) const;
+};
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/process.h b/include/osl/process.h
new file mode 100644
index 000000000..14b9c2028
--- /dev/null
+++ b/include/osl/process.h
@@ -0,0 +1,425 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_PROCESS_H
+#define INCLUDED_OSL_PROCESS_H
+
+#include "sal/config.h"
+
+#include "osl/file.h"
+#include "osl/security.h"
+#include "osl/time.h"
+#include "rtl/locale.h"
+#include "rtl/ustring.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef sal_Int32 oslProcessOption;
+#define osl_Process_WAIT 0x0001 /* wait for completion */
+#define osl_Process_SEARCHPATH 0x0002 /* search path for executable */
+#define osl_Process_DETACHED 0x0004 /* run detached */
+#define osl_Process_NORMAL 0x0000 /* run in normal window */
+#define osl_Process_HIDDEN 0x0010 /* run hidden */
+#define osl_Process_MINIMIZED 0x0020 /* run in minimized window */
+#define osl_Process_MAXIMIZED 0x0040 /* run in maximized window */
+#define osl_Process_FULLSCREEN 0x0080 /* run in fullscreen window */
+
+typedef sal_Int32 oslProcessData;
+
+/* defines for osl_getProcessInfo , can be OR'ed */
+#define osl_Process_IDENTIFIER 0x0001 /* retrieves the process identifier */
+#define osl_Process_EXITCODE 0x0002 /* retrieves exit code of the process */
+#define osl_Process_CPUTIMES 0x0004 /* retrieves used cpu time */
+#define osl_Process_HEAPUSAGE 0x0008 /* retrieves the used size of heap */
+
+typedef sal_uInt32 oslProcessIdentifier;
+typedef sal_uInt32 oslProcessExitCode;
+
+typedef enum {
+ osl_Process_E_None, /* no error */
+ osl_Process_E_NotFound, /* image not found */
+ osl_Process_E_TimedOut, /* timeout occurred */
+ osl_Process_E_NoPermission, /* permission denied */
+ osl_Process_E_Unknown, /* unknown error */
+ osl_Process_E_InvalidError, /* unmapped error */
+ osl_Process_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslProcessError;
+
+#ifdef _WIN32
+# pragma pack(push, 8)
+#endif
+
+typedef struct {
+ sal_uInt32 Size;
+ oslProcessData Fields;
+ oslProcessIdentifier Ident;
+ oslProcessExitCode Code;
+ TimeValue UserTime;
+ TimeValue SystemTime;
+ sal_uInt32 HeapUsage;
+} oslProcessInfo;
+
+#if defined( _WIN32)
+# pragma pack(pop)
+#endif
+
+/** Process handle
+
+ @see osl_executeProcess
+ @see osl_terminateProcess
+ @see osl_freeProcessHandle
+ @see osl_getProcessInfo
+ @see osl_joinProcess
+*/
+typedef void* oslProcess;
+
+/** Execute a process.
+
+ Executes the program image provided in strImageName in a new process.
+
+ @param[in] ustrImageName
+ The file URL of the executable to be started.
+ Can be NULL in this case the file URL of the executable must be the first element
+ in ustrArguments.
+
+ @param[in] ustrArguments
+ An array of argument strings. Can be NULL if strImageName is not NULL.
+ If strImageName is NULL it is expected that the first element contains
+ the file URL of the executable to start.
+
+ @param[in] nArguments
+ The number of arguments provided. If this number is 0 strArguments will be ignored.
+
+ @param[in] Options
+ A combination of int-constants to describe the mode of execution.
+
+ @param[in] Security
+ The user and his rights for which the process is started. May be NULL in which case
+ the process will be started in the context of the current user.
+
+ @param[in] ustrDirectory
+ The file URL of the working directory of the new process. If the specified directory
+ does not exist or is inaccessible the working directory of the newly created process
+ is undefined. If this parameter is NULL or the caller provides an empty string the
+ new process will have the same current working directory as the calling process.
+
+ @param[in] ustrEnvironments
+ An array of strings describing environment variables that should be merged into the
+ environment of the new process. Each string has to be in the form "variable=value".
+ This parameter can be NULL in which case the new process gets the same environment
+ as the parent process.
+
+ @param[in] nEnvironmentVars
+ The number of environment variables to set.
+
+ @param[out] pProcess
+ Pointer to a oslProcess variable, which receives the handle of the newly created process.
+ This parameter must not be NULL.
+
+ @retval osl_Process_E_None on success
+ @retval osl_Process_E_NotFound if the specified executable could not be found</dd>
+ @retval osl_Process_E_InvalidError if invalid parameters will be detected</dd>
+ @retval osl_Process_E_Unknown if arbitrary other errors occur</dd>
+
+ @see oslProcessOption
+ @see osl_executeProcess_WithRedirectedIO
+ @see osl_freeProcessHandle
+ @see osl_loginUser
+*/
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_executeProcess(
+ rtl_uString* ustrImageName,
+ rtl_uString* ustrArguments[],
+ sal_uInt32 nArguments,
+ oslProcessOption Options,
+ oslSecurity Security,
+ rtl_uString* ustrDirectory,
+ rtl_uString* ustrEnvironments[],
+ sal_uInt32 nEnvironmentVars,
+ oslProcess* pProcess);
+
+
+/** Execute a process and redirect child process standard IO.
+
+ @param[in] strImageName
+ The file URL of the executable to be started.
+ Can be NULL in this case the file URL of the executable must be the first element
+ in ustrArguments.
+
+ @param[in] ustrArguments
+ An array of argument strings. Can be NULL if strImageName is not NULL.
+ If strImageName is NULL it is expected that the first element contains
+ the file URL of the executable to start.
+
+ @param[in] nArguments
+ The number of arguments provided. If this number is 0 strArguments will be ignored.
+
+ @param[in] Options
+ A combination of int-constants to describe the mode of execution.
+
+ @param[in] Security
+ The user and his rights for which the process is started. May be NULL in which case
+ the process will be started in the context of the current user.
+
+ @param[in] ustrDirectory
+ The file URL of the working directory of the new process. If the specified directory
+ does not exist or is inaccessible the working directory of the newly created process
+ is undefined. If this parameter is NULL or the caller provides an empty string the
+ new process will have the same current working directory as the calling process.
+
+ @param[in] ustrEnvironments
+ An array of strings describing environment variables that should be merged into the
+ environment of the new process. Each string has to be in the form "variable=value".
+ This parameter can be NULL in which case the new process gets the same environment
+ as the parent process.
+
+ @param[in] nEnvironmentVars
+ The number of environment variables to set.
+
+ @param[out] pProcess
+ Pointer to a oslProcess variable, which receives the handle of the newly created process.
+ This parameter must not be NULL.
+
+ @param[out] pChildInputWrite
+ Pointer to a oslFileHandle variable that receives the handle which can be used to write
+ to the child process standard input device. The returned handle is not random accessible.
+ The handle has to be closed with osl_closeFile if no longer used. This parameter can be NULL.
+
+ @param[out] pChildOutputRead
+ Pointer to a oslFileHandle variable that receives the handle which can be used to read from
+ the child process standard output device. The returned handle is not random accessible.
+ The Handle has to be closed with osl_closeFile if no longer used. This parameter can be NULL.
+
+ @param[out] pChildErrorRead
+ Pointer to a oslFileHandle variable that receives the handle which can be used to read from
+ the child process standard error device. The returned handle is not random accessible.
+ The Handle has to be closed with osl_closeFile if no longer used. This parameter can be NULL.
+
+ @retval osl_Process_E_None on success
+ @retval osl_Process_E_NotFound if the specified executable could not be found
+ @retval osl_Process_E_InvalidError if invalid parameters will be detected
+ @retval osl_Process_E_Unknown if arbitrary other errors occur
+
+ @see oslProcessOption
+ @see osl_executeProcess
+ @see osl_freeProcessHandle
+ @see osl_loginUser
+ @see osl_closeFile
+*/
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
+ rtl_uString* strImageName,
+ rtl_uString* ustrArguments[],
+ sal_uInt32 nArguments,
+ oslProcessOption Options,
+ oslSecurity Security,
+ rtl_uString* ustrDirectory,
+ rtl_uString* ustrEnvironments[],
+ sal_uInt32 nEnvironmentVars,
+ oslProcess* pProcess,
+ oslFileHandle* pChildInputWrite,
+ oslFileHandle* pChildOutputRead,
+ oslFileHandle* pChildErrorRead);
+
+/** Terminate a process
+
+ @param[in] Process the handle of the process to be terminated
+
+ @see osl_executeProcess
+ @see osl_getProcess
+ @see osl_joinProcess
+ */
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_terminateProcess(
+ oslProcess Process);
+
+
+/** @deprecated
+
+ Retrieve the process handle of a process identifier
+
+ @param[in] Ident a process identifier
+
+ @return the process handle on success, NULL in all other cases
+ */
+SAL_DLLPUBLIC oslProcess SAL_CALL osl_getProcess(
+ oslProcessIdentifier Ident) SAL_COLD;
+
+
+/** Free the specified process-handle.
+
+ @param[in] Process
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_freeProcessHandle(
+ oslProcess Process);
+
+
+/** Wait for completion of the specified childprocess.
+ @param[in] Process
+
+ @retval ols_Process_E_None
+
+ @see osl_executeProcess
+*/
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_joinProcess(
+ oslProcess Process);
+
+/** Wait with a timeout for the completion of the specified child
+ process.
+
+ @param[in] Process A process identifier.
+ @param[in] pTimeout A timeout value or NULL for infinite waiting.
+ The unit of resolution is second.
+
+ @retval osl_Process_E_None on success
+ @retval osl_Process_E_TimedOut waiting for the child process timed out
+ @retval osl_Process_E_Unknown an error occurred or the parameter are invalid
+
+ @see osl_executeProcess
+*/
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_joinProcessWithTimeout(
+ oslProcess Process, const TimeValue* pTimeout);
+
+/** Retrieves information about a Process
+ @param[in] Process the process handle of the process
+ @param[in] Fields the information which is to be retrieved
+ this can be one or more of
+ osl_Process_IDENTIFIER
+ osl_Process_EXITCODE
+ osl_Process_CPUTIMES
+ osl_Process_HEAPUSAGE
+ @param[out] pInfo a pointer to a valid oslProcessInfo structure.
+ the Size field has to be initialized with the size
+ of the oslProcessInfo structure.
+ on success the Field member holds the (or'ed)
+ retrieved valid information fields.
+ @retval osl_Process_E_None on success
+ @retval osl_Process_E_Unknown on failure
+ */
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessInfo(
+ oslProcess Process, oslProcessData Fields, oslProcessInfo* pInfo);
+
+/** Get the filename of the executable.
+ @param[out] strFile the string that receives the executable file path.
+ @return osl_Process_E_None or does not return.
+ @see osl_executeProcess
+
+ Ideally this will return the true executable file path as a file:
+ URL, but actually in case something else happens to have been
+ passed as argv[0] to osl_setCommandArgs(), it will return that
+ either as a file URL, or as such in case it doesn't look like an
+ absolute pathname.
+*/
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getExecutableFile(
+ rtl_uString **strFile);
+
+/** @return the number of commandline arguments passed to the main-function of
+ this process
+ @see osl_getCommandArg
+*/
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_getCommandArgCount(void);
+
+/** Get the nArg-th command-line argument passed to the main-function of this process.
+ @param[in] nArg The number of the argument to return.
+ @param[out] strCommandArg The string receives the nArg-th command-line argument.
+ @return osl_Process_E_None or does not return.
+ @see osl_executeProcess
+*/
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getCommandArg(
+ sal_uInt32 nArg, rtl_uString **strCommandArg);
+
+/** Set the command-line arguments as passed to the main-function of this process.
+
+ Deprecated: This function is only for internal use. Passing the args from main will
+ only work for Unix, on Windows there's no effect, the full command line will automatically
+ be taken. This is due to Windows 9x/ME limitation that don't allow UTF-16 wmain to provide
+ a osl_setCommandArgsU( int argc, sal_Unicode **argv );
+
+ @param[in] argc The number of elements in the argv array.
+ @param[in] argv The array of command-line arguments.
+ @see osl_getExecutableFile
+ @see osl_getCommandArgCount
+ @see osl_getCommandArg
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_setCommandArgs (int argc, char **argv);
+
+/** Get the value of one environment variable.
+ @param[in] strVar denotes the name of the variable to get.
+ @param[out] strValue string that receives the value of environment variable.
+*/
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getEnvironment(
+ rtl_uString *strVar, rtl_uString **strValue);
+
+/** Set the value of one environment variable.
+ @param[in] strVar denotes the name of the variable to set.
+ @param[in] strValue string of the new value of environment variable.
+
+ @since UDK 3.2.13
+*/
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setEnvironment(
+ rtl_uString *strVar, rtl_uString *strValue);
+
+/** Unsets the value of one environment variable.
+ @param[in] strVar denotes the name of the variable to unset.
+
+ @since UDK 3.2.13
+*/
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_clearEnvironment(
+ rtl_uString *strVar);
+
+/** Get the working directory of the current process as a file URL.
+
+ The file URL is encoded as common for the OSL file API.
+ @param[out] pustrWorkingDir string that receives the working directory file URL.
+*/
+
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessWorkingDir(
+ rtl_uString **pustrWorkingDir );
+
+/** Get the locale the process is currently running in.
+
+ @param[out] ppLocale a pointer that receives the currently selected locale structure
+*/
+
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessLocale(
+ rtl_Locale ** ppLocale );
+
+/** Change the locale of the process.
+
+ @param[in] pLocale a pointer to the locale to be set
+
+ @deprecated LibreOffice itself does not use this, and client code should
+ not have good use for it either. It may eventually be removed.
+*/
+
+SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setProcessLocale(
+ rtl_Locale * pLocale );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_PROCESS_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/profile.h b/include/osl/profile.h
new file mode 100644
index 000000000..082f0e0a0
--- /dev/null
+++ b/include/osl/profile.h
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_PROFILE_H
+#define INCLUDED_OSL_PROFILE_H
+
+#include "sal/config.h"
+
+#include "rtl/ustring.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef sal_uInt32 oslProfileOption;
+
+#define osl_Profile_DEFAULT 0x0000
+#define osl_Profile_SYSTEM 0x0001 /* use system depended functionality */
+#define osl_Profile_READLOCK 0x0002 /* lock file for reading */
+#define osl_Profile_WRITELOCK 0x0004 /* lock file for writing */
+#define osl_Profile_FLUSHWRITE 0x0010 /* writing only with flush */
+
+
+typedef void* oslProfile;
+
+/** Deprecated API.
+ Open or create a configuration profile.
+ @retval 0 if the profile could not be created, otherwise a handle to the profile.
+ @deprecated
+*/
+SAL_DLLPUBLIC oslProfile SAL_CALL osl_openProfile(
+ rtl_uString *strProfileName, oslProfileOption Options) SAL_COLD;
+
+/** Deprecated API.
+ Close the opened profile an flush all data to the disk.
+ @param Profile handle to an opened profile.
+ @deprecated
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_closeProfile(
+ oslProfile Profile) SAL_COLD;
+
+/** Deprecated API.
+ @deprecated
+*/
+
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_flushProfile(
+ oslProfile Profile) SAL_COLD;
+/** Deprecated API.
+ @deprecated
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_readProfileString(
+ oslProfile Profile,
+ const char* pszSection, const char* pszEntry,
+ char* pszString, sal_uInt32 MaxLen,
+ const char* pszDefault) SAL_COLD;
+/** Deprecated API.
+ @deprecated
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_readProfileBool(
+ oslProfile Profile,
+ const char* pszSection, const char* pszEntry,
+ sal_Bool Default) SAL_COLD;
+/** Deprecated API.
+ @deprecated
+*/
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_readProfileIdent(
+ oslProfile Profile,
+ const char* pszSection, const char* pszEntry,
+ sal_uInt32 FirstId, const char* Strings[],
+ sal_uInt32 Default) SAL_COLD;
+
+/** Deprecated API.
+ @deprecated
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_writeProfileString(
+ oslProfile Profile,
+ const char* pszSection, const char* pszEntry,
+ const char* pszString) SAL_COLD;
+
+/** Deprecated API.
+ @deprecated
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_writeProfileBool(
+ oslProfile Profile,
+ const char* pszSection, const char* pszEntry,
+ sal_Bool Value) SAL_COLD;
+
+/** Deprecated API.
+ @deprecated
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_writeProfileIdent(
+ oslProfile Profile,
+ const char* pszSection, const char* pszEntry,
+ sal_uInt32 FirstId, const char* Strings[],
+ sal_uInt32 Value) SAL_COLD;
+
+/** Deprecated API.
+ Acquire the mutex, block if already acquired by another thread.
+ @retval False if section or entry could not be found.
+ @deprecated
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_removeProfileEntry(
+ oslProfile Profile,
+ const char *pszSection, const char *pszEntry) SAL_COLD;
+
+/** Deprecated API.
+ Get all entries belonging to the specified section.
+ @returns Pointer to an array of pointers.
+ @deprecated
+*/
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_getProfileSectionEntries(
+ oslProfile Profile, const char *pszSection,
+ char* pszBuffer, sal_uInt32 MaxLen) SAL_COLD;
+
+/** Deprecated API.
+ Get all section entries
+ @retval Pointer to an array of pointers.
+ @deprecated
+*/
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_getProfileSections(
+ oslProfile Profile, char* pszBuffer, sal_uInt32 MaxLen) SAL_COLD;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_PROFILE_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/profile.hxx b/include/osl/profile.hxx
new file mode 100644
index 000000000..ec75e3ce3
--- /dev/null
+++ b/include/osl/profile.hxx
@@ -0,0 +1,212 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_PROFILE_HXX
+#define INCLUDED_OSL_PROFILE_HXX
+
+#include "osl/profile.h"
+#include "rtl/ustring.hxx"
+
+#include <string.h>
+#include <exception>
+#include <list>
+
+namespace osl {
+
+ typedef oslProfileOption ProfileOption;
+
+ const int Profile_DEFAULT = osl_Profile_DEFAULT;
+ const int Profile_SYSTEM = osl_Profile_SYSTEM; /* use system depended functionality */
+ const int Profile_READLOCK = osl_Profile_READLOCK; /* lock file for reading */
+ const int Profile_WRITELOCK = osl_Profile_WRITELOCK; /* lock file for writing */
+
+ /** Deprecated API.
+ @deprecated
+ */
+ class Profile {
+ oslProfile profile;
+
+ public:
+ /** Open or create a configuration profile.
+ @retval 0 if the profile could not be created, otherwise a handle to the profile.
+ */
+ Profile(const rtl::OUString & strProfileName, oslProfileOption Options = Profile_DEFAULT )
+ {
+ profile = osl_openProfile(strProfileName.pData, Options);
+ if( ! profile )
+ throw std::exception();
+ }
+
+
+ /** Close the opened profile an flush all data to the disk.
+ */
+ ~Profile()
+ {
+ osl_closeProfile(profile);
+ }
+
+
+ bool flush()
+ {
+ return osl_flushProfile(profile);
+ }
+
+ rtl::OString readString( const rtl::OString& rSection, const rtl::OString& rEntry,
+ const rtl::OString& rDefault)
+ {
+ char aBuf[1024];
+ return osl_readProfileString( profile,
+ rSection.getStr(),
+ rEntry.getStr(),
+ aBuf,
+ sizeof( aBuf ),
+ rDefault.getStr() ) ? rtl::OString( aBuf ) : rtl::OString();
+
+ }
+
+ bool readBool( const rtl::OString& rSection, const rtl::OString& rEntry, bool bDefault )
+ {
+ return osl_readProfileBool( profile, rSection.getStr(), rEntry.getStr(), bDefault );
+ }
+
+ sal_uInt32 readIdent(const rtl::OString& rSection, const rtl::OString& rEntry,
+ sal_uInt32 nFirstId, const std::list< rtl::OString >& rStrings,
+ sal_uInt32 nDefault)
+ {
+ size_t nItems = rStrings.size();
+ const char** pStrings = new const char*[ nItems+1 ];
+ std::list< rtl::OString >::const_iterator it = rStrings.begin();
+ nItems = 0;
+ while( it != rStrings.end() )
+ {
+ pStrings[ nItems++ ] = it->getStr();
+ ++it;
+ }
+ pStrings[ nItems ] = NULL;
+ sal_uInt32 nRet = osl_readProfileIdent(profile, rSection.getStr(), rEntry.getStr(), nFirstId, pStrings, nDefault);
+ delete[] pStrings;
+ return nRet;
+ }
+
+ bool writeString(const rtl::OString& rSection, const rtl::OString& rEntry,
+ const rtl::OString& rString)
+ {
+ return osl_writeProfileString(profile, rSection.getStr(), rEntry.getStr(), rString.getStr());
+ }
+
+ bool writeBool(const rtl::OString& rSection, const rtl::OString& rEntry, bool Value)
+ {
+ return osl_writeProfileBool(profile, rSection.getStr(), rEntry.getStr(), Value);
+ }
+
+ bool writeIdent(const rtl::OString& rSection, const rtl::OString& rEntry,
+ sal_uInt32 nFirstId, const std::list< rtl::OString >& rStrings,
+ sal_uInt32 nValue)
+ {
+ size_t nItems = rStrings.size();
+ const char** pStrings = new const char*[ nItems+1 ];
+ std::list< rtl::OString >::const_iterator it = rStrings.begin();
+ nItems = 0;
+ while( it != rStrings.end() )
+ {
+ pStrings[ nItems++ ] = it->getStr();
+ ++it;
+ }
+ pStrings[ nItems ] = NULL;
+ bool bRet =
+ osl_writeProfileIdent(profile, rSection.getStr(), rEntry.getStr(), nFirstId, pStrings, nValue );
+ delete[] pStrings;
+ return bRet;
+ }
+
+ /** Remove an entry from a section.
+ @param rSection Name of the section.
+ @param rEntry Name of the entry to remove.
+ @retval False if section or entry could not be found.
+ */
+ bool removeEntry(const rtl::OString& rSection, const rtl::OString& rEntry)
+ {
+ return osl_removeProfileEntry(profile, rSection.getStr(), rEntry.getStr());
+ }
+
+ /** Get all entries belonging to the specified section.
+ @param rSection Name of the section.
+ @return Pointer to an array of pointers.
+ */
+ std::list< rtl::OString > getSectionEntries(const rtl::OString& rSection )
+ {
+ std::list< rtl::OString > aEntries;
+
+ // count buffer size necessary
+ size_t n = osl_getProfileSectionEntries( profile, rSection.getStr(), NULL, 0 );
+ if( n > 1 )
+ {
+ char* pBuf = new char[ n+1 ];
+ osl_getProfileSectionEntries( profile, rSection.getStr(), pBuf, n+1 );
+ size_t nLen;
+ for( n = 0; ; n += nLen+1 )
+ {
+ nLen = strlen( pBuf+n );
+ if (!nLen)
+ break;
+ aEntries.push_back( rtl::OString( pBuf+n ) );
+ }
+ delete[] pBuf;
+ }
+
+ return aEntries;
+ }
+
+ /** Get all section entries
+ @return Pointer to an array of pointers.
+ */
+ std::list< rtl::OString > getSections()
+ {
+ std::list< rtl::OString > aSections;
+
+ // count buffer size necessary
+ size_t n = osl_getProfileSections( profile, NULL, 0 );
+ if( n > 1 )
+ {
+ char* pBuf = new char[ n+1 ];
+ osl_getProfileSections( profile, pBuf, n+1 );
+ size_t nLen;
+ for( n = 0; ; n += nLen+1 )
+ {
+ nLen = strlen( pBuf+n );
+ if (!nLen)
+ break;
+ aSections.push_back( rtl::OString( pBuf+n ) );
+ }
+ delete[] pBuf;
+ }
+
+ return aSections;
+ }
+ };
+}
+
+#endif // INCLUDED_OSL_PROFILE_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/security.h b/include/osl/security.h
new file mode 100644
index 000000000..56674027e
--- /dev/null
+++ b/include/osl/security.h
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_SECURITY_H
+#define INCLUDED_OSL_SECURITY_H
+
+#include "sal/config.h"
+
+#include "rtl/ustring.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ osl_Security_E_None,
+ osl_Security_E_UserUnknown,
+ osl_Security_E_WrongPassword,
+ osl_Security_E_Unknown,
+ osl_Security_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSecurityError;
+
+/** Process handle
+ @see osl_loginUser
+ @see osl_freeSecurityHandle
+ @see osl_executeProcess
+*/
+typedef void* oslSecurity;
+
+/** Create a security handle for the current user.
+ @return a security handle or NULL on failure.
+ @see osl_freeSecurityHandle
+ @see osl_executeProcess
+ @see osl_executeApplication
+*/
+SAL_DLLPUBLIC oslSecurity SAL_CALL osl_getCurrentSecurity(void);
+
+/** Deprecated API
+ Create a security handle for the denoted user.
+ Try to log in the user on the local system.
+ @param[in] strUserName denotes the name of the user to log in.
+ @param[in] strPasswd the password for this user.
+ @param[out] pSecurity returns the security handle if user could be logged in.
+ @return osl_Security_E_None if user could be logged in, otherwise an error-code.
+ @see osl_freeSecurityHandle
+ @see osl_executeProcess
+ @see osl_executeApplication
+*/
+SAL_DLLPUBLIC oslSecurityError SAL_CALL osl_loginUser(
+ rtl_uString *strUserName,
+ rtl_uString *strPasswd,
+ oslSecurity *pSecurity
+ );
+
+/** Create a security handle for the denoted user.
+ Try to log in the user on the denoted file server. On success the homedir will be
+ the mapped drive on this server.
+ @param[in] strUserName denotes the name of the user to log in.
+ @param[in] strPasswd the password for this user.
+ @param[in] strFileServer denotes the file server on which the user is logged in.
+ @param[out] pSecurity returns the security handle if user could be logged in.
+ @return osl_Security_E_None if user could be logged in, otherwise an error-code.
+ @see osl_freeSecurityHandle
+ @see osl_executeProcess
+ @see osl_executeApplication
+*/
+SAL_DLLPUBLIC oslSecurityError SAL_CALL osl_loginUserOnFileServer(
+ rtl_uString *strUserName,
+ rtl_uString *strPasswd,
+ rtl_uString *strFileServer,
+ oslSecurity *pSecurity
+ );
+
+/** Query if the user who is denotes by this security has administrator rights.
+ @param[in] Security the security handle for th user.
+ @return True, if the user has administrator rights, otherwise false.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isAdministrator(
+ oslSecurity Security);
+
+/** Free the security handle, created by osl_loginUser or osl_getCurrentSecurity.
+ @param[in] Security the security handle.
+ @see osl_loginUser
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_freeSecurityHandle(
+ oslSecurity Security);
+
+/** Get the login ident for the user of this security handle.
+ @param[in] Security the security handle.
+ @param[out] strIdent the string that receives the ident on success.
+ @return True, if the security handle is valid, otherwise False.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getUserIdent(
+ oslSecurity Security, rtl_uString **strIdent);
+
+/** Get the login name for the user of this security handle.
+ @param[in] Security the security handle.
+ @param[out] strName the string that receives the user name on success.
+ @return True, if the security handle is valid, otherwise False.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getUserName(
+ oslSecurity Security, rtl_uString **strName);
+
+/** Get the login name for the user of this security handle,
+ excluding the domain name on Windows.
+ @param[in] Security the security handle.
+ @param[out] strName the string that receives the user name on success.
+ @return True, if the security handle is valid, otherwise False.
+ @since LibreOffice 5.2
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getShortUserName(
+ oslSecurity Security, rtl_uString **strName);
+
+/** Get the home directory of the user of this security handle.
+ @param[in] Security the security handle.
+ @param[out] strDirectory the string that receives the directory path on success.
+ @return True, if the security handle is valid, otherwise False.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getHomeDir(
+ oslSecurity Security, rtl_uString **strDirectory);
+
+/** Get the directory for configuration data of the user of this security handle.
+ @param[in] Security the security handle.
+ @param[out] strDirectory the string that receives the directory path on success.
+ @return True, if the security handle is valid, otherwise False.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getConfigDir(
+ oslSecurity Security, rtl_uString **strDirectory);
+
+
+/** Load Profile of the User
+ Implemented just for Windows
+ @param[in] Security previously fetch Security of the User
+ @return True if the Profile could successfully loaded, False otherwise.
+*/
+
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_loadUserProfile(
+ oslSecurity Security);
+
+
+/** Unload a User Profile
+ Implemented just for Windows
+ @param[in] Security previously fetch Security of the User
+ @return nothing is returned!
+*/
+
+SAL_DLLPUBLIC void SAL_CALL osl_unloadUserProfile(
+ oslSecurity Security);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_SECURITY_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/security.hxx b/include/osl/security.hxx
new file mode 100644
index 000000000..6c928ea5d
--- /dev/null
+++ b/include/osl/security.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_SECURITY_HXX
+#define INCLUDED_OSL_SECURITY_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "rtl/ustring.hxx"
+#include "osl/security_decl.hxx"
+
+namespace osl
+{
+
+inline Security::Security()
+{
+ m_handle = osl_getCurrentSecurity();
+}
+
+inline Security::~Security()
+{
+ osl_freeSecurityHandle(m_handle);
+}
+
+inline bool Security::logonUser(const rtl::OUString& strName,
+ const rtl::OUString& strPasswd)
+{
+ osl_freeSecurityHandle(m_handle);
+
+ m_handle = NULL;
+
+ return (osl_loginUser( strName.pData, strPasswd.pData, &m_handle)
+ == osl_Security_E_None);
+}
+
+inline bool Security::logonUser( const rtl::OUString& strName,
+ const rtl::OUString& strPasswd,
+ const rtl::OUString& strFileServer )
+{
+ osl_freeSecurityHandle(m_handle);
+
+ m_handle = NULL;
+
+ return (osl_loginUserOnFileServer(strName.pData, strPasswd.pData, strFileServer.pData, &m_handle)
+ == osl_Security_E_None);
+}
+
+inline bool Security::getUserIdent( rtl::OUString& strIdent) const
+{
+ return osl_getUserIdent( m_handle, &strIdent.pData );
+}
+
+
+inline bool Security::getUserName( rtl::OUString& strName, bool bIncludeDomain ) const
+{
+ if (bIncludeDomain)
+ return osl_getUserName( m_handle, &strName.pData );
+ return osl_getShortUserName( m_handle, &strName.pData );
+}
+
+
+inline bool Security::getHomeDir( rtl::OUString& strDirectory) const
+{
+ return osl_getHomeDir(m_handle, &strDirectory.pData );
+}
+
+
+inline bool Security::getConfigDir( rtl::OUString& strDirectory ) const
+{
+ return osl_getConfigDir( m_handle, &strDirectory.pData );
+}
+
+inline bool Security::isAdministrator() const
+{
+ return osl_isAdministrator(m_handle);
+}
+
+inline oslSecurity Security::getHandle() const
+{
+ return m_handle;
+}
+
+
+}
+
+#endif // INCLUDED_OSL_SECURITY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/security_decl.hxx b/include/osl/security_decl.hxx
new file mode 100644
index 000000000..464872b22
--- /dev/null
+++ b/include/osl/security_decl.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_SECURITY_DECL_HXX
+#define INCLUDED_OSL_SECURITY_DECL_HXX
+
+#include "rtl/ustring.hxx"
+#include "osl/security.h"
+
+namespace osl
+{
+
+/** Encapsulate security information for one user.
+ A object of this class is used to execute a process with the rights an
+ security options of a specified user.
+ @see Process::executeProcess
+*/
+class Security
+{
+protected:
+ oslSecurity m_handle;
+
+public:
+ inline Security();
+ inline ~Security();
+
+ /** get the security information for one user.
+ The underlying operating system is asked for this information.
+
+ @param[in] strName denotes the name of the user
+ @param[in] strPasswd denotes the password of this user
+
+ @retval True, if the specified user is known by the underlying operating system
+ @retval False unknown user
+ */
+ inline bool SAL_CALL logonUser(const rtl::OUString& strName,
+ const rtl::OUString& strPasswd);
+
+ /** get the security information for one user.
+
+ @verbatim
+ This method will try to login the user at the denoted file server.
+ If a network resource named \\server\username exists and this resource
+ could be connected by this user, the method will return true and getHomeDir
+ will return \\server\username.
+ @endverbatim
+
+ @param[in] strName denotes the name of the user
+ @param[in] strPasswd denotes the password of this user
+ @param[in] strFileServer denotes the file server to login to
+
+ @retval True if the specified user is known by the file server and they
+ could be connected
+ @retval False if the user is not known by the file server
+ */
+ inline bool SAL_CALL logonUser(const rtl::OUString & strName,
+ const rtl::OUString & strPasswd,
+ const rtl::OUString & strFileServer);
+
+ /** get the ident of the logged in user.
+
+ @param[out] strIdent is the OUString which returns the name
+
+ @retval True if any user is successfully logged in
+ @retval False no user logged in
+ */
+ inline bool SAL_CALL getUserIdent( rtl::OUString& strIdent) const;
+
+ /** get the name of the logged in user.
+
+ @param[out] strName is the OUString which returns the name
+ @param[in] bIncludeDomain Include the Domain name (like "ORG\username"). Affects Windows only.
+ This parameter is available since LibreOffice 5.2.
+
+ @retval True if any user is successfully logged in
+ @retval False if no user is logged in
+ */
+ inline bool SAL_CALL getUserName( rtl::OUString& strName, bool bIncludeDomain=true ) const;
+
+ /** get the home directory of the logged in user.
+ @param[out] strDirectory is the OUString which returns the directory name
+
+ @retval True if any user is successfully logged in
+ @retval False if user is not logged in
+ */
+ inline bool SAL_CALL getHomeDir( rtl::OUString& strDirectory) const;
+
+ /** get the directory for configuration data of the logged in user.
+
+ @param[out] strDirectory is the OUString which returns the directory name
+
+ @retval True if any user is successfully logged in
+ @retval False if user is not logged in
+ */
+ inline bool SAL_CALL getConfigDir( rtl::OUString & strDirectory) const;
+
+ /** Query if the user who is logged in has administrator rights.
+
+ @retval True if the user has administrator rights
+ @retval False if the user does not have admin rights
+ */
+ inline bool SAL_CALL isAdministrator() const;
+
+ /** Returns the underlying oslSecurity handle
+ */
+ inline oslSecurity getHandle() const;
+};
+
+}
+
+#endif // INCLUDED_OSL_SECURITY_DECL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/signal.h b/include/osl/signal.h
new file mode 100644
index 000000000..66eb9db5e
--- /dev/null
+++ b/include/osl/signal.h
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_SIGNAL_H
+#define INCLUDED_OSL_SIGNAL_H
+
+#include "sal/config.h"
+
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define OSL_SIGNAL_USER_RESERVED 0
+
+#define OSL_SIGNAL_USER_X11SUBSYSTEMERROR (OSL_SIGNAL_USER_RESERVED - 2)
+
+typedef void* oslSignalHandler;
+
+typedef enum
+{
+ osl_Signal_System,
+ osl_Signal_Terminate,
+ osl_Signal_AccessViolation,
+ osl_Signal_IntegerDivideByZero,
+ osl_Signal_FloatDivideByZero,
+ osl_Signal_DebugBreak,
+ osl_Signal_User,
+ osl_Signal_Alarm,
+ osl_Signal_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSignal;
+
+typedef enum
+{
+ osl_Signal_ActCallNextHdl,
+ osl_Signal_ActIgnore,
+ osl_Signal_ActAbortApp,
+ osl_Signal_ActKillApp,
+ osl_Signal_Act_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSignalAction;
+
+#ifdef _WIN32
+# pragma pack(push, 8)
+#endif
+
+typedef struct
+{
+ oslSignal Signal;
+ sal_Int32 UserSignal;
+ void* UserData;
+} oslSignalInfo;
+
+#if defined( _WIN32)
+# pragma pack(pop)
+#endif
+
+/** The function-ptr representing the signal handler-function.
+*/
+typedef oslSignalAction (SAL_CALL *oslSignalHandlerFunction)(void* pData, oslSignalInfo* pInfo);
+
+SAL_DLLPUBLIC oslSignalHandler SAL_CALL osl_addSignalHandler(
+ oslSignalHandlerFunction Handler, void* pData);
+
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_removeSignalHandler(
+ oslSignalHandler hHandler);
+
+SAL_DLLPUBLIC oslSignalAction SAL_CALL osl_raiseSignal(
+ sal_Int32 UserSignal, void* UserData);
+
+/** Enables or disables error reporting
+
+ On default error reporting is enabled after process startup.
+
+ @param[in] bEnable Enables or disables error reporting.
+
+ @retval sal_True if previous state of error reporting was enabled
+ @retval sal_False if previous state of error reporting was disabled
+*/
+
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_setErrorReporting(
+ sal_Bool bEnable );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_SIGNAL_H
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/socket.h b/include/osl/socket.h
new file mode 100644
index 000000000..7f87da312
--- /dev/null
+++ b/include/osl/socket.h
@@ -0,0 +1,862 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_SOCKET_H
+#define INCLUDED_OSL_SOCKET_H
+
+#include "rtl/ustring.h"
+#include "osl/time.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* error returns */
+#define OSL_INADDR_NONE 0xffffffff
+#define OSL_INVALID_PORT (-1)
+
+/**@{ begin section types
+*/
+
+/**
+ Opaque datatype SocketAddr.
+*/
+typedef struct oslSocketAddrImpl * oslSocketAddr;
+
+/**
+ Represents the address-family of a socket
+*/
+typedef enum {
+ osl_Socket_FamilyInet, /*!< IP (AF_INET) */
+ osl_Socket_FamilyIpx, /*!< Novell IPX/SPX (AF_IPX) */
+ osl_Socket_FamilyInvalid, /*!< always last entry in enum! */
+ osl_Socket_Family_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslAddrFamily;
+
+/**
+ represent a specific protocol within an address-family
+*/
+typedef enum {
+ osl_Socket_ProtocolIp, /*!< for all af_inet */
+ osl_Socket_ProtocolIpx, /*!< af_ipx datagram sockets (IPX) */
+ osl_Socket_ProtocolSpx, /*!< af_ipx seqpacket or stream for SPX */
+ osl_Socket_ProtocolSpxII, /*!< af_ipx seqpacket or stream for SPX II */
+ osl_Socket_ProtocolInvalid, /*!< always last entry in enum */
+ osl_Socket_Protocol_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslProtocol;
+
+/**
+ Represents the type of a socket
+*/
+typedef enum {
+ osl_Socket_TypeStream, /*!< stream socket */
+ osl_Socket_TypeDgram, /*!< datagram socket */
+ osl_Socket_TypeRaw, /*!< raw socket */
+ osl_Socket_TypeRdm, /*!< connectionless, message-oriented,
+ reliably delivered message (RDM)
+ sockets */
+ osl_Socket_TypeSeqPacket, /*!< connection-oriented and reliable
+ two-way transport of ordered byte
+ streams */
+ osl_Socket_TypeInvalid, /*!< always last entry in enum */
+ osl_Socket_Type_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketType;
+
+
+/**
+ Represents socket-options
+*/
+typedef enum {
+ osl_Socket_OptionDebug, /*!< record debugging info */
+ osl_Socket_OptionAcceptConn, /*!< listen for connection */
+ osl_Socket_OptionReuseAddr, /*!< bind to address already in use */
+ osl_Socket_OptionKeepAlive, /*!< use keep-alive */
+ osl_Socket_OptionDontRoute, /*!< do not route packet, send direct to
+ interface addresses */
+ osl_Socket_OptionBroadcast, /*!< send broadcast message */
+ osl_Socket_OptionUseLoopback, /*!< socket receives copy of everything
+ sent on the socket */
+ osl_Socket_OptionLinger, /*!< don't immediately close - "linger"
+ a while to allow for graceful
+ connection closure */
+ osl_Socket_OptionOOBinLine, /*!< out-of-band (OOB) data placed in
+ normal input queue (i.e. OOB inline) */
+ osl_Socket_OptionSndBuf, /*!< send buffer */
+ osl_Socket_OptionRcvBuf, /*!< receive buffer */
+ osl_Socket_OptionSndLowat, /*!< send "low-water" mark - amount of
+ available space in send buffer for
+ select() to return "writable" */
+ osl_Socket_OptionRcvLowat, /*!< receive "low-water" mark - amount of
+ available space in receive buffer
+ for select() to receive "readable" */
+ osl_Socket_OptionSndTimeo, /*!< send timeout */
+ osl_Socket_OptionRcvTimeo, /*!< receive timeout */
+ osl_Socket_OptionError, /*!< socket error */
+ osl_Socket_OptionType, /*!< returns socket type (e.g. datagram,
+ stream). */
+ osl_Socket_OptionTcpNoDelay, /*!< disable TCP Nagle algorithm */
+ osl_Socket_OptionInvalid, /*!< always last entry in enum */
+ osl_Socket_Option_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketOption;
+
+/**
+ Represents the different socket-option levels
+*/
+typedef enum {
+ osl_Socket_LevelSocket,
+ osl_Socket_LevelTcp,
+ osl_Socket_LevelInvalid, /*!< always last entry in enum */
+ osl_Socket_Level_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketOptionLevel;
+
+/**
+ Represents flags to be used with send/recv-calls.
+*/
+typedef enum {
+ osl_Socket_MsgNormal,
+ osl_Socket_MsgOOB,
+ osl_Socket_MsgPeek,
+ osl_Socket_MsgDontRoute,
+ osl_Socket_MsgMaxIOVLen,
+ osl_Socket_MsgInvalid, /*!< always last entry in enum */
+ osl_Socket_Msg_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketMsgFlag;
+
+/**
+ Used by shutdown to denote which end of the socket to "close".
+*/
+typedef enum {
+ osl_Socket_DirRead,
+ osl_Socket_DirWrite,
+ osl_Socket_DirReadWrite,
+ osl_Socket_DirInvalid, /*!< always last entry in enum */
+ osl_Socket_Dir_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketDirection;
+
+/** Describes the various error socket error conditions, which may
+ occur */
+typedef enum {
+ osl_Socket_E_None, /*!< no error */
+ osl_Socket_E_NotSocket, /*!< Socket operation on non-socket */
+ osl_Socket_E_DestAddrReq, /*!< Destination address required */
+ osl_Socket_E_MsgSize, /*!< Message too long */
+ osl_Socket_E_Prototype, /*!< Protocol wrong type for socket */
+ osl_Socket_E_NoProtocol, /*!< Protocol not available */
+ osl_Socket_E_ProtocolNoSupport, /*!< Protocol not supported */
+ osl_Socket_E_TypeNoSupport, /*!< Socket type not supported */
+ osl_Socket_E_OpNotSupport, /*!< Operation not supported on socket */
+ osl_Socket_E_PfNoSupport, /*!< Protocol family not supported */
+ osl_Socket_E_AfNoSupport, /*!< Address family not supported by */
+ /*!< protocol family */
+ osl_Socket_E_AddrInUse, /*!< Address already in use */
+ osl_Socket_E_AddrNotAvail, /*!< Can't assign requested address */
+ osl_Socket_E_NetDown, /*!< Network is down */
+ osl_Socket_E_NetUnreachable, /*!< Network is unreachable */
+ osl_Socket_E_NetReset, /*!< Network dropped connection because
+ of reset */
+ osl_Socket_E_ConnAborted, /*!< Software caused connection abort */
+ osl_Socket_E_ConnReset, /*!< Connection reset by peer */
+ osl_Socket_E_NoBufferSpace, /*!< No buffer space available */
+ osl_Socket_E_IsConnected, /*!< Socket is already connected */
+ osl_Socket_E_NotConnected, /*!< Socket is not connected */
+ osl_Socket_E_Shutdown, /*!< Can't send after socket shutdown */
+ osl_Socket_E_TooManyRefs, /*!< Too many references: can't splice */
+ osl_Socket_E_TimedOut, /*!< Connection timed out */
+ osl_Socket_E_ConnRefused, /*!< Connection refused */
+ osl_Socket_E_HostDown, /*!< Host is down */
+ osl_Socket_E_HostUnreachable, /*!< No route to host */
+ osl_Socket_E_WouldBlock, /*!< call would block on non-blocking socket */
+ osl_Socket_E_Already, /*!< operation already in progress */
+ osl_Socket_E_InProgress, /*!< operation now in progress */
+ osl_Socket_E_InvalidError, /*!< unmapped error: always last entry in enum */
+ osl_Socket_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketError;
+
+/** Common return codes of socket related functions.
+ */
+typedef enum {
+ osl_Socket_Ok, /*!< successful completion */
+ osl_Socket_Error, /*!< error occurred, check
+ osl_getLastSocketError() for details */
+ osl_Socket_TimedOut, /*!< blocking operation timed out */
+ osl_Socket_Interrupted, /*!< blocking operation was interrupted */
+ osl_Socket_InProgress, /*!< nonblocking operation is in progress */
+ osl_Socket_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketResult;
+
+typedef sal_uInt8 oslSocketIpxNetNumber[4];
+typedef sal_uInt8 oslSocketIpxNodeNumber[6];
+
+/**@} end section types
+*/
+
+/**@{ begin section oslSocket
+*/
+
+typedef struct oslSocketImpl * oslSocket;
+
+/** Create a socket of the specified Family and Type. The semantic of
+ the Protocol parameter depends on the given family and type.
+
+ @returns 0 if socket could not be created, otherwise you get a handle
+ to the allocated socket-datastructure.
+*/
+SAL_DLLPUBLIC oslSocket SAL_CALL osl_createSocket(
+ oslAddrFamily Family,
+ oslSocketType Type,
+ oslProtocol Protocol);
+
+/** increases the refcount of the socket handle by one
+ */
+SAL_DLLPUBLIC void SAL_CALL osl_acquireSocket(oslSocket Socket);
+
+/** decreases the refcount of the socket handle by one.
+
+ If the refcount drops to zero, the underlying socket handle
+ is destroyed and becomes invalid.
+ */
+SAL_DLLPUBLIC void SAL_CALL osl_releaseSocket(oslSocket Socket);
+
+/** Retrieves the Address of the local end of the socket.
+ Note that a socket must be bound or connected before
+ a valid address can be returned.
+
+ @returns 0 if socket-address could not be created, otherwise you get
+ the created Socket-Address.
+*/
+SAL_DLLPUBLIC oslSocketAddr SAL_CALL osl_getLocalAddrOfSocket(oslSocket Socket);
+
+/** Retrieves the Address of the remote end of the socket.
+ Note that a socket must be connected before
+ a valid address can be returned.
+ @retval 0 if socket-address could not be created, otherwise you get
+ the created Socket-Address.
+*/
+SAL_DLLPUBLIC oslSocketAddr SAL_CALL osl_getPeerAddrOfSocket(oslSocket Socket);
+
+/** Binds the given address to the socket.
+ @param[in] Socket
+ @param[in] Addr
+ @retval sal_False if the bind failed
+ @retval sal_True if bind is successful
+ @see osl_getLastSocketError()
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_bindAddrToSocket(
+ oslSocket Socket,
+ oslSocketAddr Addr);
+
+/** Connects the socket to the given address.
+
+ @param[in] Socket a bound socket.
+ @param[in] Addr the peer address.
+ @param pTimeout Timeout value or NULL for blocking.
+
+ @retval osl_Socket_Ok on successful connection,
+ @retval osl_Socket_TimedOut if operation timed out,
+ @retval osl_Socket_Interrupted if operation was interrupted
+ @retval osl_Socket_Error if the connection failed.
+*/
+SAL_DLLPUBLIC oslSocketResult SAL_CALL osl_connectSocketTo(
+ oslSocket Socket,
+ oslSocketAddr Addr,
+ const TimeValue* pTimeout);
+
+
+/** Prepares the socket to act as an acceptor of incoming connections.
+ You should call "listen" before you use "accept".
+ @param[in] Socket The socket to listen on.
+ @param[in] MaxPendingConnections denotes the length of the queue of
+ pending connections for this socket. If MaxPendingConnections is
+ -1, the systems default value will be used (Usually 5).
+ @retval sal_False if the listen failed.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_listenOnSocket(
+ oslSocket Socket,
+ sal_Int32 MaxPendingConnections);
+
+
+/** Waits for an ingoing connection on the socket.
+ This call blocks if there is no incoming connection present.
+ @param[in] Socket The socket to accept the connection on.
+ @param[in] pAddr if pAddr is != 0, the peers address is returned.
+ @retval 0 if the accept-call failed, otherwise you get a socket
+ representing the new connection.
+*/
+SAL_DLLPUBLIC oslSocket SAL_CALL osl_acceptConnectionOnSocket(
+ oslSocket Socket,
+ oslSocketAddr* pAddr);
+
+/** Tries to receive BytesToRead data from the connected socket,
+ if no error occurs. Note that incomplete recvs due to
+ packet boundaries may occur.
+
+ @param[in] Socket A connected socket to be used to listen on.
+ @param[out] pBuffer Points to a buffer that will be filled with the received
+ data.
+ @param[in] BytesToRead The number of bytes to read. pBuffer must have at least
+ this size.
+ @param[in] Flag Modifier for the call. Valid values are:
+ osl_Socket_MsgNormal
+ osl_Socket_MsgOOB
+ osl_Socket_MsgPeek
+ osl_Socket_MsgDontRoute
+ osl_Socket_MsgMaxIOVLen
+
+ @return the number of received bytes.
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_receiveSocket(
+ oslSocket Socket,
+ void* pBuffer,
+ sal_uInt32 BytesToRead,
+ oslSocketMsgFlag Flag);
+
+/** Tries to receives BufferSize data from the (usually unconnected)
+ (datagram-)socket, if no error occurs.
+
+ @param[in] Socket A bound socket to be used to listen for a datagram.
+ @param[out] SenderAddr A pointer to a created oslSocketAddr handle
+ or to a null handle. After the call, it will contain the constructed
+ oslSocketAddr of the datagrams sender. If pSenderAddr itself is 0,
+ it is ignored.
+ @param[out] pBuffer Points to a buffer that will be filled with the received
+ datagram.
+ @param[in] BufferSize The size of pBuffer.
+ @param[in] Flag Modifier for the call. Valid values are:
+ osl_Socket_MsgNormal
+ osl_Socket_MsgOOB
+ osl_Socket_MsgPeek
+ osl_Socket_MsgDontRoute
+ osl_Socket_MsgMaxIOVLen
+
+ @return the number of received bytes.
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_receiveFromSocket(
+ oslSocket Socket,
+ oslSocketAddr SenderAddr,
+ void* pBuffer,
+ sal_uInt32 BufferSize,
+ oslSocketMsgFlag Flag);
+
+/** Tries to send BytesToSend data from the connected socket,
+ if no error occurs.
+
+ @param[in] Socket A connected socket.
+ @param[in] pBuffer Points to a buffer that contains the send-data.
+ @param[in] BytesToSend The number of bytes to send. pBuffer must have at least
+ this size.
+ @param[in] Flag Modifier for the call. Valid values are:
+ @li osl_Socket_MsgNormal
+ @li osl_Socket_MsgOOB
+ @li osl_Socket_MsgPeek
+ @li osl_Socket_MsgDontRoute
+ @li osl_Socket_MsgMaxIOVLen
+
+ @return the number of transferred bytes.
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_sendSocket(
+ oslSocket Socket,
+ const void* pBuffer,
+ sal_uInt32 BytesToSend,
+ oslSocketMsgFlag Flag);
+
+/** Tries to send one datagram with BytesToSend data to the given ReceiverAddr
+ via the (implicitly unconnected) datagram-socket.
+ Since there is only sent one packet, the function sends the data always complete
+ even with incomplete packet boundaries.
+
+ @param[in] Socket A bound or unbound socket. Socket will be bound
+ after a successful call.
+
+ @param[in] ReceiverAddr An initialized oslSocketAddress that contains
+ the destination address for this send.
+
+ @param[in] pBuffer Points to a buffer that contains the send-data.
+ @param[in] BytesToSend The number of bytes to send. pBuffer must have at least
+ this size.
+ @param[in] Flag
+ @parblock
+ Modifier for the call. Valid values are:
+ @li osl_Socket_MsgNormal
+ @li osl_Socket_MsgOOB
+ @li osl_Socket_MsgPeek
+ @li osl_Socket_MsgDontRoute
+ @li osl_Socket_MsgMaxIOVLen
+ @endparblock
+
+ @return the number of transferred bytes.
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_sendToSocket(
+ oslSocket Socket,
+ oslSocketAddr ReceiverAddr,
+ const void* pBuffer,
+ sal_uInt32 BytesToSend,
+ oslSocketMsgFlag Flag);
+
+/** Checks if read operations will block.
+
+ You can specify a timeout-value in seconds/microseconds that denotes
+ how long the operation will block if the Socket is not ready.
+
+ @param Socket the Socket to perform the operation on.
+ @param pTimeout if NULL, the operation will block without a timeout.
+
+ @retval sal_True if read operations (recv, recvFrom, accept) on the Socket
+ will NOT block;
+ @retval sal_False if it would block or if an error occurred.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isReceiveReady(
+ oslSocket Socket,
+ const TimeValue* pTimeout);
+
+/** Checks if send operations will block.
+ You can specify a timeout-value in seconds/microseconds that denotes
+ how long the operation will block if the Socket is not ready.
+
+ @param Socket the Socket to perform the operation on.
+ @param pTimeout if NULL, the operation will block without a timeout. Otherwise
+ the time define by timeout value.
+
+ @retval sal_True if send operations (send, sendTo) on the Socket
+ will NOT block
+ @retval sal_False if it would block or if an error occurred.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isSendReady(
+ oslSocket Socket,
+ const TimeValue* pTimeout);
+
+/** Checks if a request for out-of-band data will block.
+ You can specify a timeout-value in seconds/microseconds that denotes
+ how long the operation will block if the Socket has no pending OOB data.
+
+ @param Socket the Socket to perform the operation on.
+ @param pTimeout if NULL, the operation will block without a timeout.
+
+ @retval sal_True if OOB-request operations (recv with appropriate flags)
+ on the Socket will NOT block
+ @retval sal_False if it would block or if an error occurred.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isExceptionPending(
+ oslSocket Socket,
+ const TimeValue* pTimeout);
+
+/** Shuts down communication on a connected socket.
+ @param[in] Socket the Socket to perform the operation on.
+ @param[in] Direction
+ @parblock
+ Direction denotes which end of the socket should be closed:
+ @li osl_Socket_DirRead - closes read operations.
+ @li osl_Socket_DirReadWrite - closes write operations.
+ @li osl_Socket_DirWrite - closes read and write operations.
+ @endparblock
+
+ @retval sal_True if the socket could be closed down.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_shutdownSocket(
+ oslSocket Socket,
+ oslSocketDirection Direction);
+
+/** Retrieves attributes associated with the socket.
+
+ @param Socket is the socket to query.
+ @param Level
+ @parblock
+ Selects the level for which an option should be queried.
+ Valid values are:
+ @li osl_sol_socket - Socket Level
+ @li osl_sol_tcp - Level of Transmission Control Protocol
+ @endparblock
+
+ @param Option
+ @parblock
+ Denotes the option to query. Valid values (depending on the Level) are:
+ @li osl_Socket_Option_Debug - (sal_Bool) Socket debug flag 1 = enabled, 0 = disabled.
+ @li osl_Socket_OptionAcceptConn
+ @li osl_Socket_OptionReuseAddr - (sal_Bool) Allows the socket to be bound to an address that is
+ already in use. 1 = multiple bound allowed, 0 = no multiple bounds allowed
+ @li osl_Socket_OptionKeepAlive (sal_Bool) Keepalive packets are sent by the underlying socket.
+ 1 = enabled, 0 = disabled
+ @li osl_Socket_OptionDontRoute - (sal_Bool) Do not route: send directly to interface.
+ 1 = do not route , 0 = routing possible
+ @li osl_Socket_OptionBroadcast - (sal_Bool) Transmission of broadcast messages are allowed on the socket.
+ 1 = transmission allowed, 0 = transmission disallowed
+ @li osl_Socket_OptionUseLoopback
+ @li osl_Socket_OptionLinger (sal_Int32) Linger on close if unsent data is present.
+ 0 = linger is off, > 0 = timeout in seconds.
+ @li osl_Socket_OptionOOBinLine
+ @li osl_Socket_OptionSndBuf (sal_Int32) Size of the send buffer in bytes. Data is sent after
+ SndTimeo or when the buffer is full. This allows faster writing to the socket.
+ @li osl_Socket_OptionRcvBuf (sal_Int32) Size of the receive buffer in bytes. Data is sent after
+ SndTimeo or when the buffer is full. This allows faster writing to the socket and larger packet sizes.
+ @li osl_Socket_OptionSndLowat
+ @li osl_Socket_OptionRcvLowat
+ @li osl_Socket_OptionSndTimeo (sal_Int32) Data is sent after this timeout. This allows gathering
+ of data to send larger packages but increases latency times.
+ @li osl_Socket_OptionRcvTimeo
+ @li osl_Socket_OptionError
+ @li osl_Socket_OptionType
+ @li osl_Socket_OptionTcpNoDelay Disables the Nagle algorithm for send coalescing. (Do not
+ collect data until a packet is full, instead send immediately. This increases network traffic
+ but might improve latency-times.)
+ 1 = disables the algorithm, 0 = keeps it enabled.
+
+ If not above mentioned otherwise, the options are only valid for level osl_Socket_LevelSocket.
+ @endparblock
+ @param pBuffer Pointer to a buffer large enough to take the desired attribute-value.
+ @param BufferLen contains the length of the Buffer.
+
+ @return -1 if an error occurred or else the size of the data copied into pBuffer.
+
+ @see osl_setSocketOption()
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_getSocketOption(
+ oslSocket Socket,
+ oslSocketOptionLevel Level,
+ oslSocketOption Option,
+ void* pBuffer,
+ sal_uInt32 BufferLen);
+
+/** Sets the sockets attributes.
+
+ @param Socket is the socket to modify.
+ @param Level
+ @parblock
+ selects the level for which an option should be changed.
+ Valid values are:
+ @li osl_sol_socket - Socket Level
+ @li osl_sol_tcp - Level of Transmission Control Protocol
+ @endparblock
+ @param Option denotes the option to modify. See osl_setSocketOption() for more
+ details.
+ @param pBuffer Pointer to a Buffer which contains the attribute-value.
+ @param BufferLen contains the length of the Buffer.
+
+ @retval True if the option could be changed.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_setSocketOption(
+ oslSocket Socket,
+ oslSocketOptionLevel Level,
+ oslSocketOption Option,
+ void* pBuffer,
+ sal_uInt32 BufferLen);
+
+/** Enables/disables non-blocking-mode of the socket.
+
+ @param Socket Change mode for this socket.
+ @param On sal_True enables non-blocking mode, sal_False disables non-blocking mode.
+
+ @retval sal_True if mode could be changed.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_enableNonBlockingMode(
+ oslSocket Socket,
+ sal_Bool On);
+
+
+/** Query state of non-blocking-mode of the socket.
+
+ @param Socket Query mode for this socket.
+
+ @retval True if non-blocking-mode is enabled.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isNonBlockingMode(oslSocket Socket);
+
+/** Queries the socket for its type.
+
+ @param[in] Socket The socket to query.
+
+ @retval osl_Socket_TypeStream
+ @retval osl_Socket_TypeDgram
+ @retval osl_Socket_TypeRaw
+ @retval osl_Socket_TypeRdm
+ @retval osl_Socket_TypeSeqPacket
+ @retval osl_invalid_SocketType if an error occurred
+*/
+SAL_DLLPUBLIC oslSocketType SAL_CALL osl_getSocketType(oslSocket Socket);
+
+/** returns a string which describes the last socket error.
+
+ @param[in] Socket The socket to query.
+ @param[out] strError The string that receives the error message.
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_getLastSocketErrorDescription(
+ oslSocket Socket,
+ rtl_uString **strError);
+
+/** Returns a constant describing the last error for the socket system.
+
+ @retval osl_Socket_E_NONE if no error occurred
+ @retval osl_invalid_SocketError if an unknown (unmapped)
+ error occurred, otherwise an enum describing the error.
+*/
+SAL_DLLPUBLIC oslSocketError SAL_CALL osl_getLastSocketError(
+ oslSocket Socket);
+
+/** Closes the socket terminating any ongoing dataflow.
+
+ @param[in] Socket The socket to close.
+ */
+SAL_DLLPUBLIC void SAL_CALL osl_closeSocket(oslSocket Socket);
+
+
+/** Retrieves n bytes from the stream and copies them into pBuffer.
+ The function avoids incomplete reads due to packet boundaries.
+
+ @param[in] Socket The socket to read from.
+ @param[out] pBuffer receives the read data.
+ @param[out] nSize the number of bytes to read. pBuffer must be large enough
+ to hold the n bytes!
+
+ @return the number of read bytes. The number will only be smaller than
+ n if an exceptional condition (e.g. connection closed) occurs.
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_readSocket(
+ oslSocket Socket,
+ void *pBuffer,
+ sal_Int32 nSize);
+
+
+/** Writes n bytes from pBuffer to the stream. The method avoids
+ incomplete writes due to packet boundaries.
+
+ @param[out] Socket The socket to write to.
+ @param[in] pBuffer contains the data to be written.
+ @param[in] nSize the number of bytes to write.
+
+ @return the number of written bytes. The number will only be smaller than
+ nSize if an exceptional condition (e.g. connection closed) occurs.
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_writeSocket(
+ oslSocket Socket,
+ const void *pBuffer,
+ sal_Int32 nSize);
+
+/**@} end section oslSocket
+*/
+/**@{ begin section oslSocketAddr
+*/
+
+/** Creates a socket-address for the given family.
+ @param Family If family == osl_Socket_FamilyInet the address is
+ set to INADDR_ANY port 0.
+ @return 0 if address could not be created.
+*/
+SAL_DLLPUBLIC oslSocketAddr SAL_CALL osl_createEmptySocketAddr(
+ oslAddrFamily Family);
+
+
+/** Creates a new SocketAddress and fills it from Addr.
+*/
+SAL_DLLPUBLIC oslSocketAddr SAL_CALL osl_copySocketAddr(
+ oslSocketAddr Addr);
+
+/** Compares the values of two SocketAddresses.
+ @retval sal_True if both addresses denote the same socket address.
+ @retval sal_False if both addresses do not denote the same socket address.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isEqualSocketAddr(
+ oslSocketAddr Addr1, oslSocketAddr Addr2);
+
+/** Uses the systems name-service interface to find an address for strHostname.
+ @param[in] strHostname The name for which you search for an address.
+ @return The desired address if one could be found, otherwise 0.
+ Don't forget to destroy the address if you don't need it any longer.
+*/
+SAL_DLLPUBLIC oslSocketAddr SAL_CALL osl_resolveHostname(
+ rtl_uString *strHostname);
+
+/** Create an internet address usable for sending broadcast datagrams.
+ To limit the broadcast to your subnet, pass your hosts IP address
+ in dotted decimal notation as first argument.
+ @see osl_sendToSocket()
+ @see oslSocketAddr
+ @param[in] strDottedAddr dotted decimal internet address, may be 0.
+ @param[in] Port port number in host byte order.
+ @retval 0 if address could not be created.
+*/
+SAL_DLLPUBLIC oslSocketAddr SAL_CALL osl_createInetBroadcastAddr(
+ rtl_uString *strDottedAddr, sal_Int32 Port);
+
+
+/** Create an internet-address, consisting of host address and port.
+ We interpret strDottedAddr as a dotted-decimal inet-addr
+ (e.g. "141.99.128.50").
+ @param[in] strDottedAddr String with dotted address.
+ @param[in] Port portnumber in host byte order.
+ @retval 0 if address could not be created.
+*/
+SAL_DLLPUBLIC oslSocketAddr SAL_CALL osl_createInetSocketAddr (
+ rtl_uString *strDottedAddr, sal_Int32 Port);
+
+
+/** Frees all resources allocated by Addr. The handle Addr must not
+ be used after the call anymore.
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_destroySocketAddr(
+ oslSocketAddr Addr);
+
+/** Looks up the port-number designated to the specified service/protocol-pair.
+ (e.g. "ftp" "tcp").
+ @retval OSL_INVALID_PORT if no appropriate entry was found, otherwise the port-number.
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_getServicePort(
+ rtl_uString *strServicename, rtl_uString *strProtocol);
+
+
+
+/** Retrieves the address-family from the Addr.
+ @return the family of the socket-address.
+ In case of an unknown family you get osl_Socket_FamilyInvalid.
+*/
+SAL_DLLPUBLIC oslAddrFamily SAL_CALL osl_getFamilyOfSocketAddr(
+ oslSocketAddr Addr);
+
+
+/** Retrieves the internet port-number of Addr.
+ @return the port-number of the address in host-byte order. If Addr
+ is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_getInetPortOfSocketAddr(
+ oslSocketAddr Addr);
+
+
+/** Sets the Port of Addr.
+ @param[in] Addr the SocketAddr to perform the operation on.
+ @param[in] Port is expected in host byte-order.
+ @retval sal_False if Addr is not an inet-addr.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_setInetPortOfSocketAddr(
+ oslSocketAddr Addr, sal_Int32 Port);
+
+
+/** Returns the hostname represented by Addr.
+ @param[in] Addr The socket address from which to extract the hostname.
+ @param[out] strHostname The hostname represented by the address. If
+ there is no hostname to be found, it returns 0.
+*/
+SAL_DLLPUBLIC oslSocketResult SAL_CALL osl_getHostnameOfSocketAddr(
+ oslSocketAddr Addr, rtl_uString **strHostname);
+
+
+/** Gets the address in dotted decimal format.
+
+ @param[in] Addr The socket address from which to extract the dotted decimal address.
+ @param[out] strDottedInetAddr Contains the dotted decimal address
+ (e.g. 141.99.20.34) represented by the address.
+
+ @retval If the address is invalid or not of type osl_Socket_FamilyInet, it returns 0.
+ @retval osl_Socket_Ok
+ @retval osl_Socket_Error
+*/
+SAL_DLLPUBLIC oslSocketResult SAL_CALL osl_getDottedInetAddrOfSocketAddr(
+ oslSocketAddr Addr, rtl_uString **strDottedInetAddr);
+
+/** Sets the addr field in the struct sockaddr with pByteSeq. pByteSeq must be in network byte order.
+ */
+SAL_DLLPUBLIC oslSocketResult SAL_CALL osl_setAddrOfSocketAddr(
+ oslSocketAddr Addr, sal_Sequence *pByteSeq );
+
+/** Returns the addr field in the struct sockaddr.
+ @param[in] Addr The socket address from which to extract the ipaddress.
+ @param[out] ppByteSeq After the call, *ppByteSeq contains the ipaddress
+ in network byte order. *ppByteSeq may be 0 in case of an invalid socket handle.
+ @retval osl_Socket_Ok
+ @retval osl_Socket_Error
+ */
+SAL_DLLPUBLIC oslSocketResult SAL_CALL osl_getAddrOfSocketAddr(
+ oslSocketAddr Addr, sal_Sequence **ppByteSeq );
+
+/*
+ Opaque datatype HostAddr.
+*/
+typedef struct oslHostAddrImpl * oslHostAddr;
+
+
+/** Create an oslHostAddr from given hostname and socket address.
+ @param[in] strHostname The hostname to be stored.
+ @param[in] Addr The socket address to be stored.
+ @return The created address or 0 upon failure.
+*/
+SAL_DLLPUBLIC oslHostAddr SAL_CALL osl_createHostAddr(
+ rtl_uString *strHostname, const oslSocketAddr Addr);
+
+
+/** Create an oslHostAddr by resolving the given strHostname.
+ Successful name resolution should result in the fully qualified
+ domain name (FQDN) and its address as hostname and socket address
+ members of the resulting oslHostAddr.
+ @param[in] strHostname The hostname to be resolved.
+ @return The resulting address or 0 upon failure.
+*/
+SAL_DLLPUBLIC oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString *strHostname);
+
+
+/** Create an oslHostAddr by reverse resolution of the given Addr.
+ Successful name resolution should result in the fully qualified
+ domain name (FQDN) and its address as hostname and socket address
+ members of the resulting oslHostAddr.
+ @param[in] Addr The socket address to be reverse resolved.
+ @return The resulting address or 0 upon failure.
+*/
+SAL_DLLPUBLIC oslHostAddr SAL_CALL osl_createHostAddrByAddr(const oslSocketAddr Addr);
+
+
+/** Create a copy of the given Addr.
+ @return The copied address or 0 upon failure.
+*/
+SAL_DLLPUBLIC oslHostAddr SAL_CALL osl_copyHostAddr(const oslHostAddr Addr);
+
+
+/** Frees all resources allocated by Addr. The handle Addr must not
+ be used after the call anymore.
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_destroyHostAddr(oslHostAddr Addr);
+
+
+/** Get the hostname member of Addr.
+ @return The hostname or 0 upon failure.
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_getHostnameOfHostAddr(const oslHostAddr Addr, rtl_uString **strHostname);
+
+
+/** Get the socket address member of Addr.
+ @return The socket address or 0 upon failure.
+*/
+SAL_DLLPUBLIC oslSocketAddr SAL_CALL osl_getSocketAddrOfHostAddr(const oslHostAddr Addr);
+
+/** Retrieve this machines hostname (NOT the FQDN)
+ @param strLocalHostname out-parameter. The string that receives the local host name.
+ @retval sal_True upon success
+ @retval sal_False
+*/
+SAL_DLLPUBLIC oslSocketResult SAL_CALL osl_getLocalHostname(rtl_uString **strLocalHostname);
+
+
+/**@} end section oslHostAddr
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_SOCKET_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/socket.hxx b/include/osl/socket.hxx
new file mode 100644
index 000000000..78d410e99
--- /dev/null
+++ b/include/osl/socket.hxx
@@ -0,0 +1,571 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_SOCKET_HXX
+#define INCLUDED_OSL_SOCKET_HXX
+
+#include "osl/socket_decl.hxx"
+
+namespace osl
+{
+
+ inline SocketAddr::SocketAddr()
+ : m_handle( osl_createEmptySocketAddr( osl_Socket_FamilyInet ) )
+ {}
+
+
+ inline SocketAddr::SocketAddr(const SocketAddr& Addr)
+ : m_handle( osl_copySocketAddr( Addr.m_handle ) )
+ {
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ SocketAddr::SocketAddr(SocketAddr && other) noexcept : m_handle(other.m_handle) {
+ other.m_handle = nullptr;
+ }
+#endif
+
+ inline SocketAddr::SocketAddr(oslSocketAddr Addr)
+ : m_handle( osl_copySocketAddr( Addr ) )
+ {
+ }
+
+
+ inline SocketAddr::SocketAddr(oslSocketAddr Addr, __osl_socket_NoCopy )
+ : m_handle( Addr )
+ {
+ }
+
+
+ inline SocketAddr::SocketAddr( const ::rtl::OUString& strAddrOrHostName, sal_Int32 nPort)
+ : m_handle( osl_createInetSocketAddr( strAddrOrHostName.pData, nPort ) )
+ {
+ if(! m_handle )
+ {
+ m_handle = osl_resolveHostname(strAddrOrHostName.pData);
+
+ // host found?
+ if(m_handle)
+ {
+ osl_setInetPortOfSocketAddr(m_handle, nPort);
+ }
+ else
+ {
+ osl_destroySocketAddr( m_handle );
+ m_handle = NULL;
+ }
+ }
+ }
+
+
+ inline SocketAddr::~SocketAddr()
+ {
+ if( m_handle )
+ osl_destroySocketAddr( m_handle );
+ }
+
+
+ inline ::rtl::OUString SocketAddr::getHostname( oslSocketResult *pResult ) const
+ {
+ ::rtl::OUString hostname;
+ oslSocketResult result = osl_getHostnameOfSocketAddr( m_handle, &(hostname.pData) );
+ if( pResult )
+ *pResult = result;
+ return hostname;
+ }
+
+
+ inline sal_Int32 SAL_CALL SocketAddr::getPort() const
+ {
+ return osl_getInetPortOfSocketAddr(m_handle);
+ }
+
+
+ inline bool SAL_CALL SocketAddr::setPort( sal_Int32 nPort )
+ {
+ return osl_setInetPortOfSocketAddr(m_handle, nPort );
+ }
+
+ inline bool SAL_CALL SocketAddr::setHostname( const ::rtl::OUString &sDottedIpOrHostname )
+ {
+ *this = SocketAddr( sDottedIpOrHostname , getPort() );
+ return is();
+ }
+
+
+ inline bool SAL_CALL SocketAddr::setAddr( const ::rtl::ByteSequence & address )
+ {
+ return osl_setAddrOfSocketAddr( m_handle, address.getHandle() )
+ == osl_Socket_Ok;
+ }
+
+ inline ::rtl::ByteSequence SAL_CALL SocketAddr::getAddr( oslSocketResult *pResult ) const
+ {
+ ::rtl::ByteSequence sequence;
+ oslSocketResult result = osl_getAddrOfSocketAddr( m_handle, reinterpret_cast<sal_Sequence **>(&sequence) );
+ if( pResult )
+ *pResult = result;
+ return sequence;
+ }
+
+
+ inline SocketAddr & SAL_CALL SocketAddr::operator= (oslSocketAddr Addr)
+ {
+ oslSocketAddr pNewAddr = osl_copySocketAddr( Addr );
+ if( m_handle )
+ osl_destroySocketAddr( m_handle );
+ m_handle = pNewAddr;
+ return *this;
+ }
+
+
+ inline SocketAddr & SAL_CALL SocketAddr::operator= (const SocketAddr& Addr)
+ {
+ *this = Addr.getHandle();
+ return *this;
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ SocketAddr & SocketAddr::operator =(SocketAddr && other) noexcept {
+ if (m_handle != nullptr) {
+ osl_destroySocketAddr(m_handle);
+ }
+ m_handle = other.m_handle;
+ other.m_handle = nullptr;
+ return *this;
+ }
+#endif
+
+ inline SocketAddr & SAL_CALL SocketAddr::assign( oslSocketAddr Addr, __osl_socket_NoCopy )
+ {
+ if( m_handle )
+ osl_destroySocketAddr( m_handle );
+ m_handle = Addr;
+ return *this;
+ }
+
+
+ inline bool SAL_CALL SocketAddr::operator== (oslSocketAddr Addr) const
+ {
+ return osl_isEqualSocketAddr( m_handle, Addr );
+ }
+
+ inline oslSocketAddr SocketAddr::getHandle() const
+ {
+ return m_handle;
+ }
+
+
+ inline bool SocketAddr::is() const
+ {
+ return m_handle != NULL;
+ }
+
+ inline ::rtl::OUString SAL_CALL SocketAddr::getLocalHostname( oslSocketResult *pResult )
+ {
+ ::rtl::OUString hostname;
+ oslSocketResult result = osl_getLocalHostname( &(hostname.pData) );
+ if(pResult )
+ *pResult = result;
+ return hostname;
+ }
+
+ inline void SAL_CALL SocketAddr::resolveHostname(
+ const ::rtl::OUString & strHostName, SocketAddr &Addr)
+ {
+ Addr = SocketAddr( osl_resolveHostname( strHostName.pData ) , SAL_NO_COPY );
+ }
+
+ inline sal_Int32 SAL_CALL SocketAddr::getServicePort(
+ const ::rtl::OUString& strServiceName,
+ const ::rtl::OUString & strProtocolName )
+ {
+ return osl_getServicePort( strServiceName.pData, strProtocolName.pData );
+ }
+
+
+ inline Socket::Socket(oslSocketType Type,
+ oslAddrFamily Family,
+ oslProtocol Protocol)
+ : m_handle( osl_createSocket(Family, Type, Protocol) )
+ {}
+
+
+ inline Socket::Socket( oslSocket socketHandle, __sal_NoAcquire )
+ : m_handle( socketHandle )
+ {}
+
+
+ inline Socket::Socket( oslSocket socketHandle )
+ : m_handle( socketHandle )
+ {
+ osl_acquireSocket( m_handle );
+ }
+
+
+ inline Socket::Socket( const Socket & socket )
+ : m_handle( socket.getHandle() )
+ {
+ osl_acquireSocket( m_handle );
+ }
+
+
+ inline Socket::~Socket()
+ {
+ osl_releaseSocket( m_handle );
+ }
+
+
+ inline Socket& Socket::operator= ( oslSocket socketHandle)
+ {
+ osl_acquireSocket( socketHandle );
+ osl_releaseSocket( m_handle );
+ m_handle = socketHandle;
+ return *this;
+ }
+
+
+ inline Socket& Socket::operator= (const Socket& sock)
+ {
+ *this = sock.getHandle();
+ return *this;
+ }
+
+
+ inline bool Socket::operator==( const Socket& rSocket ) const
+ {
+ return m_handle == rSocket.getHandle();
+ }
+
+
+ inline bool Socket::operator==( const oslSocket socketHandle ) const
+ {
+ return m_handle == socketHandle;
+ }
+
+
+ inline void Socket::shutdown( oslSocketDirection Direction )
+ {
+ osl_shutdownSocket( m_handle , Direction );
+ }
+
+
+ inline void Socket::close()
+ {
+ osl_closeSocket( m_handle );
+ }
+
+
+ inline void Socket::getLocalAddr( SocketAddr & addr) const
+ {
+ addr.assign( osl_getLocalAddrOfSocket( m_handle ) , SAL_NO_COPY );
+ }
+
+
+ inline sal_Int32 Socket::getLocalPort() const
+ {
+ SocketAddr addr( NULL );
+ getLocalAddr( addr );
+ return addr.getPort();
+ }
+
+
+ inline ::rtl::OUString Socket::getLocalHost() const
+ {
+ SocketAddr addr( NULL );
+ getLocalAddr( addr );
+ return addr.getHostname();
+ }
+
+
+ inline void Socket::getPeerAddr( SocketAddr &addr ) const
+ {
+ addr.assign( osl_getPeerAddrOfSocket( m_handle ), SAL_NO_COPY );
+ }
+
+
+ inline sal_Int32 Socket::getPeerPort() const
+ {
+ SocketAddr addr( NULL );
+ getPeerAddr( addr );
+ return addr.getPort();
+ }
+
+
+ inline ::rtl::OUString Socket::getPeerHost() const
+ {
+ SocketAddr addr( NULL );
+ getPeerAddr( addr );
+ return addr.getHostname();
+ }
+
+
+ inline bool Socket::bind(const SocketAddr& LocalInterface)
+ {
+ return osl_bindAddrToSocket( m_handle , LocalInterface.getHandle() );
+ }
+
+
+ inline bool Socket::isRecvReady(const TimeValue *pTimeout ) const
+ {
+ return osl_isReceiveReady( m_handle , pTimeout );
+ }
+
+
+ inline bool Socket::isSendReady(const TimeValue *pTimeout ) const
+ {
+ return osl_isSendReady( m_handle, pTimeout );
+ }
+
+
+ inline bool Socket::isExceptionPending(const TimeValue *pTimeout ) const
+ {
+ return osl_isExceptionPending( m_handle, pTimeout );
+ }
+
+
+ inline oslSocketType Socket::getType() const
+ {
+ return osl_getSocketType( m_handle );
+ }
+
+
+ inline sal_Int32 Socket::getOption(
+ oslSocketOption Option,
+ void* pBuffer,
+ sal_uInt32 BufferLen,
+ oslSocketOptionLevel Level) const
+ {
+ return osl_getSocketOption( m_handle, Level, Option, pBuffer , BufferLen );
+ }
+
+
+ inline bool Socket::setOption( oslSocketOption Option,
+ void* pBuffer,
+ sal_uInt32 BufferLen,
+ oslSocketOptionLevel Level ) const
+ {
+ return osl_setSocketOption( m_handle, Level, Option , pBuffer, BufferLen );
+ }
+
+
+ inline bool Socket::setOption( oslSocketOption option, sal_Int32 nValue )
+ {
+ return setOption( option, &nValue, sizeof( nValue ) );
+ }
+
+
+ inline sal_Int32 Socket::getOption( oslSocketOption option ) const
+ {
+ sal_Int32 n;
+ getOption( option, &n, sizeof( n ) );
+ return n;
+ }
+
+
+ inline bool Socket::enableNonBlockingMode( bool bNonBlockingMode)
+ {
+ return osl_enableNonBlockingMode( m_handle , bNonBlockingMode );
+ }
+
+
+ inline bool Socket::isNonBlockingMode() const
+ {
+ return osl_isNonBlockingMode( m_handle );
+ }
+
+
+ inline void SAL_CALL Socket::clearError() const
+ {
+ sal_Int32 err = 0;
+ getOption(osl_Socket_OptionError, &err, sizeof(err));
+ }
+
+
+ inline oslSocketError Socket::getError() const
+ {
+ return osl_getLastSocketError( m_handle );
+ }
+
+
+ inline ::rtl::OUString Socket::getErrorAsString( ) const
+ {
+ ::rtl::OUString error;
+ osl_getLastSocketErrorDescription( m_handle, &(error.pData) );
+ return error;
+ }
+
+
+ inline oslSocket Socket::getHandle() const
+ {
+ return m_handle;
+ }
+
+
+ inline StreamSocket::StreamSocket(oslAddrFamily Family,
+ oslProtocol Protocol,
+ oslSocketType Type )
+ : Socket( Type, Family, Protocol )
+ {}
+
+
+ inline StreamSocket::StreamSocket( oslSocket socketHandle, __sal_NoAcquire noacquire )
+ : Socket( socketHandle, noacquire )
+ {}
+
+
+ inline StreamSocket::StreamSocket( oslSocket socketHandle )
+ : Socket( socketHandle )
+ {}
+
+
+ inline sal_Int32 StreamSocket::read(void* pBuffer, sal_uInt32 n)
+ {
+ return osl_readSocket( m_handle, pBuffer, n );
+ }
+
+
+ inline sal_Int32 StreamSocket::write(const void* pBuffer, sal_uInt32 n)
+ {
+ return osl_writeSocket( m_handle, pBuffer, n );
+ }
+
+
+ inline sal_Int32 StreamSocket::recv(void* pBuffer,
+ sal_uInt32 BytesToRead,
+ oslSocketMsgFlag Flag)
+ {
+ return osl_receiveSocket( m_handle, pBuffer,BytesToRead, Flag );
+ }
+
+
+ inline sal_Int32 StreamSocket::send(const void* pBuffer,
+ sal_uInt32 BytesToSend,
+ oslSocketMsgFlag Flag)
+ {
+ return osl_sendSocket( m_handle, pBuffer, BytesToSend, Flag );
+ }
+
+
+ inline ConnectorSocket::ConnectorSocket(oslAddrFamily Family,
+ oslProtocol Protocol,
+ oslSocketType Type)
+ : StreamSocket( Family, Protocol ,Type )
+ {}
+
+
+ inline oslSocketResult ConnectorSocket::connect( const SocketAddr& TargetHost,
+ const TimeValue* pTimeout )
+ {
+ return osl_connectSocketTo( m_handle , TargetHost.getHandle(), pTimeout );
+ }
+
+
+ inline AcceptorSocket::AcceptorSocket(oslAddrFamily Family ,
+ oslProtocol Protocol ,
+ oslSocketType Type )
+ : Socket( Type, Family, Protocol )
+ {}
+
+
+ inline bool AcceptorSocket::listen(sal_Int32 MaxPendingConnections)
+ {
+ return osl_listenOnSocket( m_handle, MaxPendingConnections );
+ }
+
+
+ inline oslSocketResult AcceptorSocket::acceptConnection( StreamSocket& Connection)
+ {
+ oslSocket o = osl_acceptConnectionOnSocket( m_handle, NULL );
+ oslSocketResult status = osl_Socket_Ok;
+ if( o )
+ {
+ Connection = StreamSocket( o , SAL_NO_ACQUIRE );
+ }
+ else
+ {
+ Connection = StreamSocket();
+ status = osl_Socket_Error;
+ }
+ return status;
+ }
+
+
+ inline oslSocketResult AcceptorSocket::acceptConnection(
+ StreamSocket& Connection, SocketAddr & PeerAddr)
+ {
+ // TODO change in/OUT parameter
+ oslSocket o = osl_acceptConnectionOnSocket(
+ m_handle, reinterpret_cast<oslSocketAddr *>(&PeerAddr));
+ oslSocketResult status = osl_Socket_Ok;
+ if( o )
+ {
+ Connection = StreamSocket( o , SAL_NO_ACQUIRE );
+ }
+ else
+ {
+ Connection = StreamSocket();
+ status = osl_Socket_Error;
+ }
+ return status;
+ }
+
+
+ inline DatagramSocket::DatagramSocket(oslAddrFamily Family,
+ oslProtocol Protocol,
+ oslSocketType Type)
+ : Socket( Type, Family, Protocol )
+ {}
+
+
+ inline sal_Int32 DatagramSocket::recvFrom(void* pBuffer,
+ sal_uInt32 BufferSize,
+ SocketAddr* pSenderAddr,
+ oslSocketMsgFlag Flag )
+ {
+ sal_Int32 nByteRead;
+ if( pSenderAddr )
+ {
+ // TODO : correct the out-parameter pSenderAddr outparameter
+ nByteRead = osl_receiveFromSocket( m_handle, pSenderAddr->getHandle() , pBuffer,
+ BufferSize, Flag);
+ }
+ else
+ {
+ nByteRead = osl_receiveFromSocket( m_handle, NULL , pBuffer , BufferSize , Flag );
+ }
+ return nByteRead;
+ }
+
+
+ inline sal_Int32 DatagramSocket::sendTo( const SocketAddr& ReceiverAddr,
+ const void* pBuffer,
+ sal_uInt32 BufferSize,
+ oslSocketMsgFlag Flag )
+ {
+ return osl_sendToSocket( m_handle, ReceiverAddr.getHandle(), pBuffer, BufferSize, Flag );
+ }
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/socket_decl.hxx b/include/osl/socket_decl.hxx
new file mode 100644
index 000000000..de6442b27
--- /dev/null
+++ b/include/osl/socket_decl.hxx
@@ -0,0 +1,750 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_SOCKET_DECL_HXX
+#define INCLUDED_OSL_SOCKET_DECL_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "osl/socket.h"
+#include "rtl/ustring.hxx"
+#include "rtl/byteseq.hxx"
+
+namespace osl
+{
+ enum __osl_socket_NoCopy { SAL_NO_COPY };
+
+ /** The class should be understood as a reference to a socket address handle (struct sockaddr).
+
+ The handle is mutable.
+ */
+ class SocketAddr
+ {
+ protected:
+ oslSocketAddr m_handle;
+ public:
+
+ /** Creates socket address of unknown type.
+ */
+ inline SocketAddr();
+
+ /** Copy constructor.
+ */
+ inline SocketAddr(const SocketAddr& Addr);
+
+#if defined LIBO_INTERNAL_ONLY
+ inline SocketAddr(SocketAddr && other) noexcept;
+#endif
+
+ /** The SocketAddr takes over the responsibility of the handle (which means
+ that the handle gets destructed by the destructor of this reference)
+
+ @param Addr a handle
+ @param nocopy use SAL_NO_COPY
+ */
+ inline SocketAddr(const oslSocketAddr Addr, __osl_socket_NoCopy nocopy );
+
+ /** Copyconstructs the oslSocketAddr handle.
+
+ @param Addr a handle
+ */
+ inline SocketAddr(oslSocketAddr Addr);
+
+ /** TCP/IP-specific constructor.
+
+ @param strAddrOrHostName strAddrOrHostName hostname or dotted ip-number of the network
+ interface, the socket shall be created on.
+ @param nPort tcp-ip port number
+ */
+ inline SocketAddr(const ::rtl::OUString& strAddrOrHostName, sal_Int32 nPort);
+
+ /** destroys underlying oslSocketAddress
+ */
+ inline ~SocketAddr();
+
+ /** Checks if the SocketAddr was created successful.
+
+ @retval true if there is a valid underlying handle
+ @retval false no valid underlying handle
+ */
+ inline bool is() const;
+
+ /** Converts the address to a (human readable) domain-name.
+
+ @param[out] pResult value of 0 if you are not interested in errors,
+ otherwise *pResult contains an error code on failure
+ or osl_Socket_Ok on success
+
+ @return the hostname of this SocketAddr or an empty string on failure.
+
+ @see osl_getHostnameOfSocketAddr
+ */
+ inline ::rtl::OUString SAL_CALL getHostname(oslSocketResult *pResult = NULL) const;
+
+ /** Sets the IP address or hostname of the SocketAddress
+
+ @param[in] sDottedIpOrHostname IP address or hostname
+
+ @retval true success
+ @retval false failure
+ */
+ inline bool SAL_CALL setHostname(const ::rtl::OUString &sDottedIpOrHostname);
+
+ /** Returns the port number of the address.
+
+ @return the port in host-byte order or OSL_INVALID_PORT on errors.
+ */
+ inline sal_Int32 SAL_CALL getPort() const;
+
+ /** Sets the port number of the address.
+
+ @param[in] nPort port number
+
+ @retval true success
+ @retval false failure
+ */
+ inline bool SAL_CALL setPort(sal_Int32 nPort);
+
+ /** Sets the address of the underlying socket address struct in network byte order.
+
+ @retval true success
+ @retval false failure
+ */
+ inline bool SAL_CALL setAddr(const ::rtl::ByteSequence & address);
+
+ /** Returns the address of the underlying socket in network byte order
+ */
+ inline ::rtl::ByteSequence SAL_CALL getAddr(oslSocketResult *pResult = NULL) const;
+
+ /** assign the handle to this reference. The previous handle is released.
+ */
+ inline SocketAddr & SAL_CALL operator= (oslSocketAddr Addr);
+
+ inline SocketAddr & SAL_CALL operator= (const SocketAddr& Addr);
+
+#if defined LIBO_INTERNAL_ONLY
+ inline SocketAddr & operator =(SocketAddr && other) noexcept;
+#endif
+
+ /** Assigns the socket addr without copyconstructing it.
+ @param Addr the socket address.
+ @param nocopy use SAL_NO_COPY
+ */
+ inline SocketAddr & SAL_CALL assign( oslSocketAddr Addr, __osl_socket_NoCopy nocopy );
+
+ /** Returns true if the underlying handle is identical to the Addr handle.
+ */
+ inline bool SAL_CALL operator== (oslSocketAddr Addr) const;
+
+ /** Returns true if the underlying handle is identical to the Addr handle.
+ */
+ inline bool SAL_CALL operator== (const SocketAddr & Addr) const;
+
+ /** Returns the underlying SocketAddr handle without copyconstructing it.
+ */
+ inline oslSocketAddr SAL_CALL getHandle() const;
+
+ /** Get the hostname for the local interface.
+ @param pResult after the call *pResult contains osl_Socket_Ok on success or
+ an error on failure.
+ @return the hostname
+ */
+ static inline ::rtl::OUString SAL_CALL getLocalHostname( oslSocketResult *pResult = NULL);
+
+ /** Tries to find an address for a host.
+ @see osl_resolveHostname()
+ @return A new created socket-address or 0 if the name could not be found.
+ */
+ static inline void SAL_CALL resolveHostname(
+ const ::rtl::OUString & strHostName , SocketAddr & Addr );
+
+ /**
+ Tries to find the port associated with the given service/protocol-
+ pair (e.g. "ftp"/"tcp").
+ @return the port number in host-byte order or <code>OSL_INVALID_PORT</code>
+ if no service/protocol pair could be found.
+ */
+ static inline sal_Int32 SAL_CALL getServicePort(
+ const ::rtl::OUString& strServiceName,
+ const ::rtl::OUString & strProtocolName= ::rtl::OUString("tcp") );
+ };
+
+
+ class Socket
+ {
+ protected:
+ oslSocket m_handle;
+ protected:
+ /** Creates a socket. Note it's protected.
+ @param Type
+ @param Family
+ @param Protocol
+ */
+ inline Socket(oslSocketType Type,
+ oslAddrFamily Family = osl_Socket_FamilyInet,
+ oslProtocol Protocol = osl_Socket_ProtocolIp);
+ public:
+ inline Socket( );
+
+ inline Socket( const Socket & socket );
+
+ inline Socket( oslSocket socketHandle );
+
+ /** The instance takes over the handle's ownership without acquiring the
+ handle, but releases it within the dtor.
+ @param socketHandle the handle
+ @param noacquire use SAL_NO_ACQUIRE
+ */
+ inline Socket( oslSocket socketHandle, __sal_NoAcquire noacquire );
+
+ /** Destructor. Releases the underlying handle
+ */
+ inline ~Socket();
+
+ /** Assignment operator. If socket was already created, the old one will
+ be discarded.
+ */
+ inline Socket& SAL_CALL operator= ( oslSocket socketHandle);
+
+ /** Assignment operator. If socket was already created, the old one will
+ be discarded.
+ */
+ inline Socket& SAL_CALL operator= (const Socket& sock);
+
+ /**
+ @return <code>true</code>, when the underlying handle of both
+ Socket instances are identical, <code>false</code> otherwise.
+ */
+ inline bool SAL_CALL operator==( const Socket& rSocket ) const ;
+
+ /**
+ @return <code>true</code>, when the underlying handle of both
+ Socket instances are identical, <code>false</code> otherwise.
+ */
+ inline bool SAL_CALL operator==( const oslSocket socketHandle ) const;
+
+ /** Closes a definite or both directions of the bidirectional stream.
+
+ @param Direction
+ @see osl_shutdownSocket()
+ */
+ inline void SAL_CALL shutdown( oslSocketDirection Direction = osl_Socket_DirReadWrite );
+
+ /** Closes a socket.
+ Note that closing a socket is identical to shutdown( osl_Socket_DirReadWrite ),
+ as the operating system distinguish both cases, both functions or offered in this API.
+ @see osl_closeSocket()
+ */
+ inline void SAL_CALL close();
+
+ /** Retrieves the address of the local interface of this socket.
+ @param Addr [out] receives the address.
+ @see osl_getLocalAddrOfSocket()
+ */
+ inline void SAL_CALL getLocalAddr( SocketAddr &Addr ) const;
+
+ /** Get the local port of the socket. Usually used after bind().
+ @return the port number or OSL_INVALID_PORT on errors.
+ */
+ inline sal_Int32 SAL_CALL getLocalPort() const;
+
+ /** Get the hostname for the local interface.
+ @return the hostname or an empty string ("").
+ */
+ inline ::rtl::OUString SAL_CALL getLocalHost() const;
+
+ /** Retrieves the address of the remote host of this socket.
+ @param Addr [out] receives the address.
+ */
+ inline void SAL_CALL getPeerAddr( SocketAddr & Addr) const;
+
+ /** Get the remote port of the socket.
+ @return the port number or OSL_INVALID_PORT on errors.
+ */
+ inline sal_Int32 SAL_CALL getPeerPort() const;
+
+ /** Get the hostname for the remote interface.
+ @return the hostname or an empty string ("").
+ */
+ inline ::rtl::OUString SAL_CALL getPeerHost() const;
+
+ /** Binds the socket to the specified (local) interface.
+ @param LocalInterface Address of the Interface
+ @return True if bind was successful.
+ */
+ inline bool SAL_CALL bind(const SocketAddr& LocalInterface);
+
+ /** Checks if read operations will block.
+
+ You can specify a timeout-value in seconds/nanoseconds that denotes
+ how the operation will block if the Socket is not ready.
+ @return <code>true</code> if read operations (recv, recvFrom, accept) on the Socket
+ will NOT block; <code>false</code> if it would block or if an error occurred.
+
+ @param pTimeout if 0, the operation will block without a timeout. Otherwise
+ the specified amount of time.
+ */
+ inline bool SAL_CALL isRecvReady(const TimeValue *pTimeout = NULL) const;
+
+ /** Checks if send operations will block.
+
+ You can specify a timeout-value in seconds/nanoseconds that denotes
+ how the operation will block if the Socket is not ready.
+ @return <code>true</code> if send operations (send, sendTo) on the Socket
+ will NOT block; <code>false</code> if it would block or if an error occurred.
+
+ @param pTimeout if 0, the operation will block without a timeout. Otherwise
+ the specified amount of time.
+ */
+ inline bool SAL_CALL isSendReady(const TimeValue *pTimeout = NULL) const;
+
+
+ /** Checks if a request for out-of-band data will block.
+
+ You can specify a timeout-value in seconds/nanoseconds that denotes
+ how the operation will block if the Socket has no pending OOB data.
+
+ @return <code>true</code> if OOB-request operations (recv with appropriate flags)
+ on the Socket will NOT block; <code>false</code> if it would block or if
+ an error occurred.
+
+ @param pTimeout if 0, the operation will block without a timeout. Otherwise
+ the specified amount of time.
+ */
+ inline bool SAL_CALL isExceptionPending(const TimeValue *pTimeout = NULL) const;
+
+
+ /** Queries the socket for its type.
+
+ @retval osl_Socket_TypeStream
+ @retval osl_Socket_TypeDgram
+ @retval osl_Socket_TypeRaw
+ @retval osl_Socket_TypeRdm
+ @retval osl_Socket_TypeSeqPacket
+ @retval osl_invalid_SocketType if an error occurred
+ */
+ inline oslSocketType SAL_CALL getType() const;
+
+ /** Retrieves option-attributes associated with the socket.
+ @param Option The attribute to query.
+ Valid values (depending on the Level) are:
+ <ul>
+ <li> <code>osl_Socket_Option_Debug</code><br>
+ (sal_Bool) Socket debug flag 1 = enabled, 0 = disabled.
+
+ <li> <code>osl_Socket_OptionAcceptConn</code><br>
+ <li> <code>osl_Socket_OptionReuseAddr</code><br>
+ (sal_Bool) Allows the socket to be bound to an address that is
+ already in use.
+ 1 = multiple bound allowed, 0 = no multiple bounds allowed
+
+ <li><code>osl_Socket_OptionKeepAlive</code><br>
+ (sal_Bool) Keepalive packets are sent by the underlying socket.
+ 1 = enabled, 0 = disabled
+
+ <li><code>osl_Socket_OptionDontRoute</code><br>
+ (sal_Bool) Do not route: send directly to interface.
+ 1 = do not route , 0 = routing possible
+
+ <li><code>osl_Socket_OptionBroadcast</code><br>
+ (sal_Bool) Transmission of broadcast messages are allowed on the socket.
+ 1 = transmission allowed, 0 = transmission disallowed
+
+ <li><code>osl_Socket_OptionUseLoopback</code><br>
+
+ <li><code>osl_Socket_OptionLinger</code><br>
+ (linger) Linger on close if unsent data is present.
+ linger has two members: l_onoff, l_linger
+ l_onoff = 0 is off, l_onoff > 0 and l_linger= timeout in seconds.
+
+ <li><code>osl_Socket_OptionOOBinLine</code><br>
+
+
+ <li><code>osl_Socket_OptionSndBuf</code><br>
+ (sal_Int32) Size of the send buffer in bytes. Data is sent after
+ SndTimeo or when the buffer is full. This allows faster writing
+ to the socket.
+
+ <li><code>osl_Socket_OptionRcvBuf</code><br>
+ (sal_Int32) Size of the receive buffer in bytes. Data is sent after
+ SndTimeo or when the buffer is full. This allows faster writing
+ to the socket and larger packet sizes.
+
+ <li><code>osl_Socket_OptionSndLowat</code><br>
+
+ <li><code>osl_Socket_OptionRcvLowat</code><br>
+
+ <li><code>osl_Socket_OptionSndTimeo</code><br>
+ (sal_Int32) Data is sent after this timeout. This allows gathering
+ of data to send larger packages but increases latency times.
+
+ <li><code>osl_Socket_OptionRcvTimeo</code><br>
+
+ <li><code>osl_Socket_OptionError</code><br>
+ <li><code>osl_Socket_OptionType</code><br>
+
+ <li><code>osl_Socket_OptionTcpNoDelay</code><br>
+ Disables the Nagle algorithm for send coalescing. (Do not
+ collect data until a packet is full, instead send immediately.
+ This increases network traffic but might improve latency-times.)
+ 1 = disables the algorithm, 0 = keeps it enabled.
+ </ul>
+
+ If not above mentioned otherwise, the options are only valid for
+ level <code>osl_Socket_LevelSocket</code>.
+ @param pBuffer The Buffer will be filled with the attribute.
+
+ @param BufferLen The size of pBuffer.
+
+ @param Level The option level.
+
+ Valid values are:
+ <ul>
+ <li><code>osl_Socket_LevelSocket</code> : Socket Level
+ <li><code>osl_Socket_LevelTcp</code> : Level of Transmission Control Protocol
+ </ul>
+ @return The size of the attribute copied into pBuffer or -1 if an error
+ occurred.
+ */
+ inline sal_Int32 SAL_CALL getOption(
+ oslSocketOption Option,
+ void* pBuffer,
+ sal_uInt32 BufferLen,
+ oslSocketOptionLevel Level= osl_Socket_LevelSocket) const;
+
+ /** Sets the sockets attributes.
+
+ @param Option denotes the option to modify.
+ Valid values (depending on the Level) are:
+ <ul>
+ <li> osl_Socket_Option_Debug
+ <li> osl_Socket_OptionAcceptConn
+ <li> osl_Socket_OptionReuseAddr
+ <li> osl_Socket_OptionKeepAlive
+ <li> osl_Socket_OptionDontRoute
+ <li> osl_Socket_OptionBroadcast
+ <li> osl_Socket_OptionUseLoopback
+ <li> osl_Socket_OptionLinger
+ <li> osl_Socket_OptionOOBinLine
+ <li> osl_Socket_OptionSndBuf
+ <li> osl_Socket_OptionRcvBuf
+ <li> osl_Socket_OptionSndLowat
+ <li> osl_Socket_OptionRcvLowat
+ <li> osl_Socket_OptionSndTimeo
+ <li> osl_Socket_OptionRcvTimeo
+ <li> osl_Socket_OptionError
+ <li> osl_Socket_OptionType
+ <li> osl_Socket_OptionTcpNoDelay
+ </ul>
+
+ If not above mentioned otherwise, the options are only valid for
+ level osl_Socket_LevelSocket.
+
+ @param pBuffer Pointer to a Buffer which contains the attribute-value.
+
+ @param BufferLen contains the length of the Buffer.
+
+ @param Level selects the level for which an option should be changed.
+ Valid values are:
+ <ul>
+ <li> osl_Socket_evel_Socket : Socket Level
+ <li> osl_Socket_Level_Tcp : Level of Transmission Control Protocol
+ </ul>
+
+ @return True if the option could be changed.
+ */
+ inline bool SAL_CALL setOption( oslSocketOption Option,
+ void* pBuffer,
+ sal_uInt32 BufferLen,
+ oslSocketOptionLevel Level= osl_Socket_LevelSocket ) const;
+
+ /** Convenience function for setting sal_Bool and sal_Int32 option values.
+ @see setOption()
+ */
+ inline bool setOption( oslSocketOption option, sal_Int32 nValue );
+
+ /** Convenience function for retrieving sal_Bool and sal_Int32 option values.
+ @see setOption()
+ */
+ inline sal_Int32 getOption( oslSocketOption option ) const;
+
+ /** Enables/disables non-blocking mode of the socket.
+ @param bNonBlockingMode If <code>true</code>, blocking mode will be switched off
+ If <code>false</code>, the socket will become a blocking
+ socket (which is the default behaviour of a socket).
+ @return <code>true</code> if mode could be set.
+ */
+ inline bool SAL_CALL enableNonBlockingMode( bool bNonBlockingMode);
+
+ /** Query blocking mode of the socket.
+ @return <code>true</code> if non-blocking mode is set.
+ */
+ inline bool SAL_CALL isNonBlockingMode() const;
+
+
+ /** clears the error status
+ */
+ inline void SAL_CALL clearError() const;
+
+ /** returns a constant describing the last error for the socket system.
+
+ @return osl_Socket_E_NONE if no error occurred, invalid_SocketError if
+ an unknown (unmapped) error occurred, otherwise an enum describing the
+ error.
+ @see osl_getLastSocketError()
+ */
+ inline oslSocketError getError() const;
+
+ /** Builds a string with the last error-message for the socket.
+ */
+ inline ::rtl::OUString getErrorAsString( ) const;
+
+ /** Returns the underlying handle unacquired (The caller must acquire it to keep it).
+ */
+ inline oslSocket getHandle() const;
+ };
+
+
+ class StreamSocket : public Socket
+ {
+ public:
+ /** Creates a socket.
+ @param Family the Family of the socket (Inet by default)
+ @param Protocol the Protocon of the socket (IP by default)
+ @param Type For some protocols it might be desirable to
+ use a different type than <code>osl_Socket_TypeStream</code>
+ (like <code>osl_Socket_TypeSeqPacket</code>).
+ Therefore this parameter is not hidden.
+ */
+ inline StreamSocket(oslAddrFamily Family = osl_Socket_FamilyInet,
+ oslProtocol Protocol = osl_Socket_ProtocolIp,
+ oslSocketType Type = osl_Socket_TypeStream);
+
+ inline StreamSocket( oslSocket Socket , __sal_NoAcquire noacquire );
+
+ inline StreamSocket( oslSocket Socket );
+
+ /** Retrieves n bytes from the stream and copies them into pBuffer.
+ The method avoids incomplete reads due to packet boundaries and is thus
+ blocking.
+ @param pBuffer receives the read data. pBuffer must be large enough
+ to hold n bytes.
+ @param n the number of bytes to read.
+ @return the number of read bytes. The number will only be smaller than
+ n if an exceptional condition (e.g. connection closed) occurs.
+ */
+ inline sal_Int32 SAL_CALL read(void* pBuffer, sal_uInt32 n);
+
+ /** Writes n bytes from pBuffer to the stream. The method avoids
+ incomplete writes due to packet boundaries and is thus blocking.
+ @param pBuffer contains the data to be written.
+ @param n the number of bytes to write.
+ @return the number of written bytes. The number will only be smaller than
+ n if an exceptional condition (e.g. connection closed) occurs.
+ */
+ inline sal_Int32 SAL_CALL write(const void* pBuffer, sal_uInt32 n);
+
+
+ /** Tries to receive BytesToRead data from the connected socket,
+
+ @param[out] pBuffer Points to a buffer that will be filled with the received
+ data. pBuffer must have at least have a size of BytesToRead.
+ @param[in] BytesToRead The number of bytes to read.
+ @param[in] flags Modifier for the call. Valid values are:
+
+ <ul>
+ <li><code>osl_Socket_MsgNormal</code>
+ <li><code>osl_Socket_MsgOOB</code>
+ <li><code>osl_Socket_MsgPeek</code>
+ <li><code>osl_Socket_MsgDontRoute</code>
+ <li><code>osl_Socket_MsgMaxIOVLen</code>
+ </ul>
+ @return the number of received bytes, which may be less than BytesToRead.
+ */
+ inline sal_Int32 SAL_CALL recv(void* pBuffer,
+ sal_uInt32 BytesToRead,
+ oslSocketMsgFlag flags= osl_Socket_MsgNormal);
+
+ /** Tries to send BytesToSend data to the connected socket.
+
+ @param pBuffer [in] Points to a buffer that contains the send-data.
+ @param BytesToSend [in] The number of bytes to send. pBuffer must have at least
+ this size.
+ @param Flag [in] Modifier for the call. Valid values are:
+ <ul>
+ <li><code>osl_Socket_MsgNormal</code>
+ <li><code>osl_Socket_MsgOOB</code>
+ <li><code>osl_Socket_MsgPeek</code>
+ <li><code>osl_Socket_MsgDontRoute</code>
+ <li><code>osl_Socket_MsgMaxIOVLen</code>
+ </ul>
+
+ @return the number of transferred bytes. It may be less than BytesToSend.
+ */
+ sal_Int32 SAL_CALL send(const void* pBuffer,
+ sal_uInt32 BytesToSend,
+ oslSocketMsgFlag= osl_Socket_MsgNormal);
+ };
+
+ class ConnectorSocket : public StreamSocket
+ {
+ public:
+ /** Creates a socket that can connect to a (remote) host.
+ @param Family the Family of the socket (Inet by default)
+ @param Protocol the Protocon of the socket (IP by default)
+ @param Type For some protocols it might be desirable to
+ use a different type than sock_stream <code>osl_Socket_TypeSeqPacket</code>
+ (like <code>osl_Socket_TypeSeqPacket</code>).
+ Therefore we do not hide this parameter here.
+ */
+ ConnectorSocket(oslAddrFamily Family = osl_Socket_FamilyInet,
+ oslProtocol Protocol = osl_Socket_ProtocolIp,
+ oslSocketType Type = osl_Socket_TypeStream);
+
+
+ /** Connects the socket to a (remote) host.
+ @param TargetHost The address of the target.
+ @param pTimeout The timeout for blocking. If 0, a default system dependent timeout
+ us used.
+ @return <code> osl_Socket_Ok</code> if connected successfully,
+ <code>osl_Socket_TimedOut</code> on timeout,
+ <code>osl_Socket_Interrupted</code> if unblocked forcefully (by osl::Socket::close()),
+ <code>osl_Socket_Error</code> if connect failed.
+ */
+ oslSocketResult SAL_CALL connect(const SocketAddr& TargetHost, const TimeValue* pTimeout = NULL);
+ };
+
+ /** Allows to accept socket connections.
+ */
+ class AcceptorSocket : public Socket
+ {
+ public:
+ inline AcceptorSocket(oslAddrFamily Family = osl_Socket_FamilyInet,
+ oslProtocol Protocol = osl_Socket_ProtocolIp,
+ oslSocketType Type = osl_Socket_TypeStream);
+
+ /** Prepare a socket for the accept-call. The socket must have been
+ bound before to the local address.
+ @param MaxPendingConnections The maximum number of pending
+ connections (waiting to be accepted) on this socket. If you use
+ -1, a system default value is used.
+ @return <code>true</code> if call was successful.
+ */
+ inline bool SAL_CALL listen(sal_Int32 MaxPendingConnections= -1);
+
+ /** Accepts incoming connections on the socket. You must
+ precede this call with osl::Socket::bind() and listen().
+ @param Connection receives the incoming connection.
+ @return <code>osl_Socket_Ok</code>, if a connection has been accepted,
+ <code>osl_Socket_TimedOut</code>, if m_RecvTimeout milliseconds passed without connect,
+ <code>osl_Socket_Error</code> on errors.
+ */
+ inline oslSocketResult SAL_CALL acceptConnection( StreamSocket& Connection);
+
+ /** Accepts incoming connections on the socket. You must
+ precede this call with osl::Socket::bind() and listen().
+ @param PeerAddr receives the address of the connecting entity
+ (your communication partner).
+ @param Connection receives the incoming connection.
+ @return <code>osl_Socket_Ok</code>, if a connection has been accepted,
+ <code>osl_Socket_TimedOut</code>, if m_RecvTimeout milliseconds passed without connect,
+ <code>osl_Socket_Error</code> on errors.
+ */
+ inline oslSocketResult SAL_CALL acceptConnection( StreamSocket& Connection, SocketAddr & PeerAddr);
+ };
+
+
+ /** A connectionless socket to send and receive datagrams.
+ */
+ class DatagramSocket : public Socket
+ {
+ public:
+
+ /** Creates a datagram socket.
+ @param Family the Family of the socket (Inet by default)
+ @param Protocol the Protocon of the socket (IP by default)
+ @param Type is sock_dgram by default.
+ */
+ inline DatagramSocket(oslAddrFamily Family= osl_Socket_FamilyInet,
+ oslProtocol Protocol= osl_Socket_ProtocolIp,
+ oslSocketType Type= osl_Socket_TypeDgram);
+
+ /** Tries to receives BufferSize data from the socket, if no error occurs.
+
+ @param pSenderAddr [out] You must provide pointer to a SocketAddr.
+ It will be filled with the address of the datagrams sender.
+ If pSenderAddr is 0, it is ignored.
+ @param pBuffer [out] Points to a buffer that will be filled with the received
+ datagram.
+ @param BufferSize [in] The size of pBuffer.
+ @param Flag [in] Modifier for the call. Valid values are:
+ <ul>
+ <li><code>osl_Socket_MsgNormal</code>
+ <li><code>osl_Socket_MsgOOB</code>
+ <li><code>osl_Socket_MsgPeek</code>
+ <li><code>osl_Socket_MsgDontRoute</code>
+ <li><code>osl_Socket_MsgMaxIOVLen</code>
+ </ul>
+
+ @return the number of received bytes.
+ */
+ inline sal_Int32 SAL_CALL recvFrom(void* pBuffer,
+ sal_uInt32 BufferSize,
+ SocketAddr* pSenderAddr= NULL,
+ oslSocketMsgFlag Flag= osl_Socket_MsgNormal);
+
+ /** Tries to send one datagram with BytesToSend size to the given ReceiverAddr.
+ Since there is only send one packet, the function doesn't care about
+ packet boundaries.
+
+ @param ReceiverAddr [in] A SocketAddr that contains
+ the destination address for this send.
+
+ @param pBuffer [in] Points to a buffer that contains the send-data.
+ @param BufferSize [in] The number of bytes to send. pBuffer must have at least
+ this size.
+ @param Flag [in] Modifier for the call. Valid values are:
+
+ <ul>
+ <li><code>osl_Socket_MsgNormal</code>
+ <li><code>osl_Socket_MsgOOB</code>
+ <li><code>osl_Socket_MsgPeek</code>
+ <li><code>osl_Socket_MsgDontRoute</code>
+ <li><code>osl_Socket_MsgMaxIOVLen</code>
+ </ul>
+
+ @return the number of transferred bytes.
+ */
+ inline sal_Int32 SAL_CALL sendTo( const SocketAddr& ReceiverAddr,
+ const void* pBuffer,
+ sal_uInt32 BufferSize,
+ oslSocketMsgFlag Flag= osl_Socket_MsgNormal);
+ };
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/test/uniquepipename.hxx b/include/osl/test/uniquepipename.hxx
new file mode 100644
index 000000000..bbeedcafb
--- /dev/null
+++ b/include/osl/test/uniquepipename.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "sal/types.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include <cppunit/TestAssert.h>
+
+#include "osl/process.h"
+
+namespace osl {
+namespace test {
+
+OUString uniquePipeName(OUString const & name)
+{
+ oslProcessInfo info;
+ info.Size = sizeof info;
+
+ CPPUNIT_ASSERT_EQUAL(
+ osl_Process_E_None,
+ osl_getProcessInfo(nullptr, osl_Process_IDENTIFIER, &info));
+
+ return name + OUString::number(info.Ident);
+}
+
+} // test namespace
+} // osl namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/thread.h b/include/osl/thread.h
new file mode 100644
index 000000000..03d7cbd9d
--- /dev/null
+++ b/include/osl/thread.h
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_THREAD_H
+#define INCLUDED_OSL_THREAD_H
+
+#include "sal/config.h"
+
+#include "osl/time.h"
+#include "rtl/textenc.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ Opaque data type for threads. As with all other osl-handles
+ you can initialize and/or test it to/for 0.
+*/
+typedef void* oslThread;
+
+/** the function-ptr. representing the threads worker-function.
+*/
+typedef void (SAL_CALL *oslWorkerFunction)(void*);
+
+/** levels of thread-priority
+ Note that oslThreadPriorityUnknown might be returned
+ by getPriorityOfThread() (e.g. when it is terminated),
+ but mustn't be used with setPriority()!
+*/
+typedef enum
+{
+ osl_Thread_PriorityHighest,
+ osl_Thread_PriorityAboveNormal,
+ osl_Thread_PriorityNormal,
+ osl_Thread_PriorityBelowNormal,
+ osl_Thread_PriorityLowest,
+ osl_Thread_PriorityUnknown, /* don't use to set */
+ osl_Thread_Priority_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslThreadPriority;
+
+
+typedef sal_uInt32 oslThreadIdentifier;
+
+typedef void* oslThreadKey;
+
+/** Create the thread, using the function-ptr pWorker as
+ its main (worker) function. This function receives in
+ its void* parameter the value supplied by pThreadData.
+ Once the OS-structures are initialized,the thread starts
+ running.
+
+ @param pWorker Thread worker function
+ @param pThreadData Thread local data
+
+ @return 0 if creation failed, otherwise a handle to the thread
+*/
+SAL_DLLPUBLIC oslThread SAL_CALL osl_createThread(oslWorkerFunction pWorker, void* pThreadData);
+
+/** Create the thread, using the function-ptr pWorker as
+ its main (worker) function. This function receives in
+ its void* parameter the value supplied by pThreadData.
+ The thread will be created, but it won't start running.
+ To wake-up the thread, use resume().
+
+ @param pWorker Thread worker function
+ @param pThreadData Thread local data
+
+ @return 0 if creation failed, otherwise a handle to the thread
+*/
+SAL_DLLPUBLIC oslThread SAL_CALL osl_createSuspendedThread(oslWorkerFunction pWorker, void* pThreadData);
+
+/** Get the identifier for the specified thread or if parameter
+ Thread is NULL of the current active thread.
+
+ @param Thread Handle to thread for the thread ID
+
+ @return identifier of the thread
+*/
+SAL_DLLPUBLIC oslThreadIdentifier SAL_CALL osl_getThreadIdentifier(oslThread Thread);
+
+/** Release the thread handle.
+ If Thread is NULL, the function won't do anything.
+ Note that we do not interfere with the actual running of
+ the thread, we just free up the memory needed by the handle.
+
+ @param Thread Handle to thread to release
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_destroyThread(oslThread Thread);
+
+/** Wake-up a thread that was suspended with suspend() or
+ createSuspended(). The oslThread must be valid!
+
+ @param Thread Handle to thread to resume
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_resumeThread(oslThread Thread);
+
+/** Suspend the execution of the thread. If you want the thread
+ to continue, call resume(). The oslThread must be valid!
+
+ @param Thread Handle to thread to suspend
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_suspendThread(oslThread Thread);
+
+/** Changes the threads priority.
+ The oslThread must be valid!
+
+ @param Thread Handle to thread to which to change priority
+ @param Priority Thread priority
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_setThreadPriority(oslThread Thread, oslThreadPriority Priority);
+
+/** Retrieves the threads priority.
+ Returns oslThreadPriorityUnknown for invalid Thread-argument or
+ terminated thread. (i.e. the oslThread might be invalid.)
+
+ @param Thread Handle to thread for which the priority is retrieved
+*/
+SAL_DLLPUBLIC oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread);
+
+/** Returns True if the thread was created and has not terminated yet.
+ Note that according to this definition a "running" thread might be
+ suspended! Also returns False is Thread is NULL.
+
+ @param Thread Handle to thread
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread);
+
+/** Blocks the calling thread until Thread has terminated.
+ Returns immediately if Thread is NULL.
+
+ @param Thread Handle to thread to join
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_joinWithThread(oslThread Thread);
+
+/** Suspends the execution of the calling thread for at least the given
+ time.
+
+ @param pDelay Timeout value to wait
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_waitThread(const TimeValue* pDelay);
+
+/** The requested thread will get terminate the next time
+ scheduleThread() is called.
+
+ @param Thread Handle to thread to terminate
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_terminateThread(oslThread Thread);
+
+/** Schedules in thread to wait till after time slice of specified
+ thread. scheduleThread() should be called in the working loop
+ of the thread, so any other thread could also get the
+ processor. Returns False if the thread should terminate, so
+ the thread could free any allocated resources.
+
+ @param Thread Handle to thread to schedule in after
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread);
+
+/** Offers the rest of the threads time-slice to the OS.
+ Under POSIX you _need_ to yield(), otherwise, since the
+ threads are not preempted during execution, NO other thread
+ (even with higher priority) gets the processor. Control is
+ only given to another thread if the current thread blocks
+ or uses yield().
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_yieldThread(void);
+
+/** Attempts to set the name of the current thread.
+
+ The name of a thread is usually evaluated for debugging purposes. Not all
+ platforms support this. On Linux, a set thread name can be observed with
+ "ps -L". On Windows a thread name set while a debugger is attached can be
+ observed within the debugger.
+
+ @param name the name of the thread; must not be null; on Linux, only the
+ first 16 characters are used
+*/
+SAL_DLLPUBLIC void SAL_CALL osl_setThreadName(char const * name);
+
+/* Callback when data stored in a thread key is no longer needed */
+
+typedef void (SAL_CALL *oslThreadKeyCallbackFunction)(void *);
+
+/** Create a key to an associated thread local storage pointer. */
+SAL_DLLPUBLIC oslThreadKey SAL_CALL osl_createThreadKey(oslThreadKeyCallbackFunction pCallback);
+
+/** Destroy a key to an associated thread local storage pointer. */
+SAL_DLLPUBLIC void SAL_CALL osl_destroyThreadKey(oslThreadKey Key);
+
+/** Get to key associated thread specific data. */
+SAL_DLLPUBLIC void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key);
+
+/** Set to key associated thread specific data. */
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData);
+
+/** Get the current thread local text encoding. */
+SAL_DLLPUBLIC rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void);
+
+/** Set the thread local text encoding.
+ @return the old text encoding.
+*/
+SAL_DLLPUBLIC rtl_TextEncoding SAL_CALL osl_setThreadTextEncoding(rtl_TextEncoding Encoding);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_THREAD_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/thread.hxx b/include/osl/thread.hxx
new file mode 100644
index 000000000..dd3a4cbd3
--- /dev/null
+++ b/include/osl/thread.hxx
@@ -0,0 +1,240 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_THREAD_HXX
+#define INCLUDED_OSL_THREAD_HXX
+
+#include "sal/config.h"
+
+#include <cassert>
+#include <cstddef>
+
+#include "osl/time.h"
+#include "osl/thread.h"
+#include "rtl/alloc.h"
+
+namespace osl
+{
+/** threadFunc is the function which is executed by the threads
+ created by the osl::Thread class. The function's signature
+ matches the one of oslWorkerFunction which is declared in
+ osl/thread.h
+*/
+extern "C" inline void SAL_CALL threadFunc( void* param);
+
+/**
+ A thread abstraction.
+
+ @deprecated use ::salhelper::Thread instead. Only the static member
+ functions ::osl::Thread::getCurrentIdentifier, ::osl::Thread::wait, and
+ ::osl::Thread::yield are not deprecated.
+ */
+class Thread
+{
+ Thread( const Thread& ) SAL_DELETED_FUNCTION;
+ Thread& operator= ( const Thread& ) SAL_DELETED_FUNCTION;
+public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete( void *, void * )
+ {}
+
+ Thread(): m_hThread(NULL){}
+
+ virtual ~Thread() COVERITY_NOEXCEPT_FALSE
+ {
+ osl_destroyThread( m_hThread);
+ }
+
+ bool SAL_CALL create()
+ {
+ assert(m_hThread == NULL); // only one running thread per instance
+ m_hThread = osl_createSuspendedThread( threadFunc, static_cast<void*>(this));
+ if (m_hThread == NULL)
+ {
+ return false;
+ }
+ osl_resumeThread(m_hThread);
+ return true;
+ }
+
+ bool SAL_CALL createSuspended()
+ {
+ assert(m_hThread == NULL); // only one running thread per instance
+ if( m_hThread)
+ return false;
+ m_hThread= osl_createSuspendedThread( threadFunc,
+ static_cast<void*>(this));
+ return m_hThread != NULL;
+ }
+
+ virtual void SAL_CALL suspend()
+ {
+ if( m_hThread )
+ osl_suspendThread(m_hThread);
+ }
+
+ virtual void SAL_CALL resume()
+ {
+ if( m_hThread )
+ osl_resumeThread(m_hThread);
+ }
+
+ virtual void SAL_CALL terminate()
+ {
+ if( m_hThread )
+ osl_terminateThread(m_hThread);
+ }
+
+ virtual void SAL_CALL join()
+ {
+ osl_joinWithThread(m_hThread);
+ }
+
+ bool SAL_CALL isRunning() const
+ {
+ return osl_isThreadRunning(m_hThread);
+ }
+
+ void SAL_CALL setPriority( oslThreadPriority Priority)
+ {
+ if( m_hThread )
+ osl_setThreadPriority(m_hThread, Priority);
+ }
+
+ oslThreadPriority SAL_CALL getPriority() const
+ {
+ return m_hThread ? osl_getThreadPriority(m_hThread) : osl_Thread_PriorityUnknown;
+ }
+
+ oslThreadIdentifier SAL_CALL getIdentifier() const
+ {
+ return osl_getThreadIdentifier(m_hThread);
+ }
+
+ static oslThreadIdentifier SAL_CALL getCurrentIdentifier()
+ {
+ return osl_getThreadIdentifier(NULL);
+ }
+
+ static void SAL_CALL wait(const TimeValue& Delay)
+ {
+ osl_waitThread(&Delay);
+ }
+
+ static void SAL_CALL yield()
+ {
+ osl_yieldThread();
+ }
+
+ static void setName(char const * name) SAL_NOEXCEPT {
+ osl_setThreadName(name);
+ }
+
+ virtual bool SAL_CALL schedule()
+ {
+ return m_hThread && osl_scheduleThread(m_hThread);
+ }
+
+ SAL_CALL operator oslThread() const
+ {
+ return m_hThread;
+ }
+
+protected:
+
+ /** The thread functions calls the protected functions
+ run and onTerminated.
+ */
+ friend void SAL_CALL threadFunc( void* param);
+
+ virtual void SAL_CALL run() = 0;
+
+ virtual void SAL_CALL onTerminated()
+ {
+ }
+
+private:
+ oslThread m_hThread;
+};
+
+extern "C" inline void SAL_CALL threadFunc( void* param)
+{
+ Thread* pObj= static_cast<Thread*>(param);
+ pObj->run();
+ pObj->onTerminated();
+}
+
+class ThreadData
+{
+ ThreadData( const ThreadData& ) SAL_DELETED_FUNCTION;
+ ThreadData& operator= (const ThreadData& ) SAL_DELETED_FUNCTION;
+public:
+ /// Create a thread specific local data key
+ ThreadData( oslThreadKeyCallbackFunction pCallback= NULL )
+ {
+ m_hKey = osl_createThreadKey( pCallback );
+ }
+
+ /// Destroy a thread specific local data key
+ ~ThreadData()
+ {
+ osl_destroyThreadKey(m_hKey);
+ }
+
+ /** Set the data associated with the data key.
+ @returns True if operation was successful
+ */
+ bool SAL_CALL setData(void *pData)
+ {
+ return osl_setThreadKeyData(m_hKey, pData);
+ }
+
+ /** Get the data associated with the data key.
+ @returns The data associated with the data key or
+ NULL if no data was set
+ */
+ void* SAL_CALL getData()
+ {
+ return osl_getThreadKeyData(m_hKey);
+ }
+
+ operator oslThreadKey() const
+ {
+ return m_hKey;
+ }
+
+private:
+ oslThreadKey m_hKey;
+};
+
+} // end namespace osl
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/time.h b/include/osl/time.h
new file mode 100644
index 000000000..5c5096cad
--- /dev/null
+++ b/include/osl/time.h
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_OSL_TIME_H
+#define INCLUDED_OSL_TIME_H
+
+#include "sal/config.h"
+
+#if defined LIBO_INTERNAL_ONLY
+#if defined __cplusplus
+#include <chrono>
+#endif
+#endif
+
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef _WIN32
+# pragma pack(push, 8)
+#endif
+
+/* Time since Jan-01-1970 */
+
+#if defined LIBO_INTERNAL_ONLY && defined __cplusplus
+
+struct TimeValue {
+ TimeValue() = default;
+
+ constexpr TimeValue(sal_uInt32 seconds, sal_uInt32 nanoseconds):
+ Seconds(seconds), Nanosec(nanoseconds) {}
+
+ template<typename Rep, typename Period> constexpr
+ TimeValue(std::chrono::duration<Rep, Period> const & duration):
+ Seconds(
+ std::chrono::duration_cast<std::chrono::nanoseconds>(
+ duration).count() / 1000000000),
+ Nanosec(
+ std::chrono::duration_cast<std::chrono::nanoseconds>(
+ duration).count() % 1000000000)
+ {}
+
+ sal_uInt32 Seconds;
+ sal_uInt32 Nanosec;
+};
+
+#else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ sal_uInt32 Seconds;
+ sal_uInt32 Nanosec;
+} TimeValue;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#if defined(_WIN32)
+# pragma pack(pop)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _oslDateTime
+{
+ /** contains the nanoseconds
+ */
+ sal_uInt32 NanoSeconds;
+
+ /** contains the seconds (0-59).
+ */
+ sal_uInt16 Seconds;
+
+ /** contains the minutes (0-59).
+ */
+ sal_uInt16 Minutes;
+
+ /** contains the hour (0-23).
+ */
+ sal_uInt16 Hours;
+
+ /** is the day of month (1-31).
+ */
+ sal_uInt16 Day;
+
+ /** is the day of week (0-6 , 0 : Sunday).
+ */
+ sal_uInt16 DayOfWeek;
+
+ /** is the month of year (1-12).
+ */
+ sal_uInt16 Month;
+
+ /** is the year.
+ */
+ sal_Int16 Year;
+
+} oslDateTime;
+
+
+/** Get the current system time as TimeValue.
+ @retval false if any error occurs.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getSystemTime(
+ TimeValue* pTimeVal );
+
+
+/** Get the GMT from a TimeValue and fill a struct oslDateTime
+ @param[in] pTimeVal TimeValue
+ @param[out] pDateTime On success it receives a struct oslDateTime
+
+ @return sal_False if any error occurs else sal_True.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getDateTimeFromTimeValue(
+ const TimeValue* pTimeVal, oslDateTime* pDateTime );
+
+
+/** Get the GMT from a oslDateTime and fill a TimeValue
+ @param[in] pDateTime oslDateTime
+ @param[out] pTimeVal On success it receives a TimeValue
+
+ @return sal_False if any error occurs else sal_True.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getTimeValueFromDateTime(
+ const oslDateTime* pDateTime, TimeValue* pTimeVal );
+
+
+/** Convert GMT to local time
+ @param[in] pSystemTimeVal system time to convert
+ @param[out] pLocalTimeVal On success it receives the local time
+
+ @return sal_False if any error occurs else sal_True.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getLocalTimeFromSystemTime(
+ const TimeValue* pSystemTimeVal, TimeValue* pLocalTimeVal );
+
+
+/** Convert local time to GMT
+ @param[in] pLocalTimeVal local time to convert
+ @param[out] pSystemTimeVal On success it receives the system time
+
+ @return sal_False if any error occurs else sal_True.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getSystemTimeFromLocalTime(
+ const TimeValue* pLocalTimeVal, TimeValue* pSystemTimeVal );
+
+
+/** Get the value of the global timer
+ @return current timer value in milliseconds
+ */
+
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_getGlobalTimer(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_OSL_TIME_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/package/Deflater.hxx b/include/package/Deflater.hxx
new file mode 100644
index 000000000..3cd528bf5
--- /dev/null
+++ b/include/package/Deflater.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_PACKAGE_DEFLATER_HXX
+#define INCLUDED_PACKAGE_DEFLATER_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <package/packagedllapi.hxx>
+#include <memory>
+
+struct z_stream_s;
+
+namespace ZipUtils {
+
+class DLLPUBLIC_PACKAGE Deflater final
+{
+ typedef struct z_stream_s z_stream;
+
+ css::uno::Sequence< sal_Int8 > sInBuffer;
+ bool bFinish;
+ bool bFinished;
+ sal_Int64 nOffset, nLength;
+ std::unique_ptr<z_stream> pStream;
+
+ void init (sal_Int32 nLevel, bool bNowrap);
+ sal_Int32 doDeflateBytes (css::uno::Sequence < sal_Int8 > &rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength);
+
+public:
+ ~Deflater();
+ Deflater(sal_Int32 nSetLevel, bool bNowrap);
+ void setInputSegment( const css::uno::Sequence< sal_Int8 >& rBuffer );
+ bool needsInput() const;
+ void finish( );
+ bool finished() const { return bFinished;}
+ sal_Int32 doDeflateSegment( css::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewLength );
+ sal_Int64 getTotalIn() const;
+ sal_Int64 getTotalOut() const;
+ void reset( );
+ void end( );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/package/Inflater.hxx b/include/package/Inflater.hxx
new file mode 100644
index 000000000..d8b36e175
--- /dev/null
+++ b/include/package/Inflater.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_PACKAGE_INFLATER_HXX
+#define INCLUDED_PACKAGE_INFLATER_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <package/packagedllapi.hxx>
+#include <memory>
+
+struct z_stream_s;
+
+namespace ZipUtils {
+
+class DLLPUBLIC_PACKAGE Inflater final
+{
+ typedef struct z_stream_s z_stream;
+
+ bool bFinished, bNeedDict;
+ sal_Int32 nOffset, nLength, nLastInflateError;
+ std::unique_ptr<z_stream> pStream;
+ css::uno::Sequence < sal_Int8 > sInBuffer;
+ sal_Int32 doInflateBytes (css::uno::Sequence < sal_Int8 > &rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength);
+
+public:
+ Inflater(bool bNoWrap);
+ ~Inflater();
+ void setInput( const css::uno::Sequence< sal_Int8 >& rBuffer );
+ bool needsDictionary() const { return bNeedDict; }
+ bool finished() const { return bFinished; }
+ sal_Int32 doInflateSegment( css::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength );
+ void end( );
+
+ sal_Int32 getLastInflateError() const { return nLastInflateError; }
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/package/packagedllapi.hxx b/include/package/packagedllapi.hxx
new file mode 100644
index 000000000..3db98fe34
--- /dev/null
+++ b/include/package/packagedllapi.hxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_PACKAGE_PACKAGEDLLAPI_HXX
+#define INCLUDED_PACKAGE_PACKAGEDLLAPI_HXX
+
+#include <sal/types.h>
+
+#if defined(DLLIMPLEMENTATION_PACKAGE)
+#define DLLPUBLIC_PACKAGE SAL_DLLPUBLIC_EXPORT
+#else
+#define DLLPUBLIC_PACKAGE SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif // INCLUDED_PACKAGE_PACKAGEDLLAPI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/postmac.h b/include/postmac.h
new file mode 100644
index 000000000..bfeb88dfd
--- /dev/null
+++ b/include/postmac.h
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#undef Point
+#undef Size
+#undef TimeValue
+#undef TimeRecord
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/postwin.h b/include/postwin.h
new file mode 100644
index 000000000..6b11c5827
--- /dev/null
+++ b/include/postwin.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/* not protected, do only include once! */
+
+#undef ABSOLUTE
+#undef CompareString
+#undef CopyFile
+#undef DELETE
+#undef DocumentProperties
+#undef DrawText
+#undef FindWindow
+#undef Folder
+#undef GetCharWidth
+#undef GetClassName
+#undef GetGlyphOutline
+#undef GetKerningPairs
+#undef GetMetaFile
+#undef GetNumberFormat
+#undef GetObject
+#undef GetPrinter
+#undef GetTimeFormat
+#undef GetUserName
+#undef GradientStyle_RECT
+#undef IGNORE
+#undef IN
+#undef OPAQUE // so it doesn't conflict with enum values
+#undef OPTIONAL
+#undef OUT
+#undef PASSTHROUGH
+#undef RELATIVE
+#undef STRICT
+#undef SetPort
+#undef SetPrinter
+#undef WB_LEFT
+#undef WB_RIGHT
+#undef Yield
+#undef mciSetCommand
+
+#if !defined INCLUDED_POSTWIN_H && defined __cplusplus
+#define INCLUDED_POSTWIN_H
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/premac.h b/include/premac.h
new file mode 100644
index 000000000..5a2707d19
--- /dev/null
+++ b/include/premac.h
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#define Point MacOSPoint
+#define Size MacOSSize
+#define TimeValue MacOSTimeValue
+#define TimeRecord MacOSTimeRecord
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/prewin.h b/include/prewin.h
new file mode 100644
index 000000000..d6f227445
--- /dev/null
+++ b/include/prewin.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/* not protected, do only include once! */
+
+#if defined(_WIN32)
+
+#define Folder WIN_Folder
+#define GradientStyle_RECT WIN_GradientStyle_RECT
+
+#ifndef IN
+#define IN
+#endif
+#ifndef OUT
+#define OUT
+#endif
+
+#if !defined STRICT
+#define STRICT
+#endif
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#include <shellapi.h>
+#include <commdlg.h>
+#include <dlgs.h>
+
+#include <commctrl.h>
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/reader.hxx b/include/registry/reader.hxx
new file mode 100644
index 000000000..b804ba3ed
--- /dev/null
+++ b/include/registry/reader.hxx
@@ -0,0 +1,606 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_REGISTRY_READER_HXX
+#define INCLUDED_REGISTRY_READER_HXX
+
+#include <registry/typereg_reader.hxx>
+#include <registry/refltype.hxx>
+#include <registry/types.hxx>
+#include <registry/version.h>
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+#include <new>
+
+namespace typereg {
+
+/**
+ A type reader working on a binary blob that represents a UNOIDL type.
+
+ <p>Instances of this class are not multi-thread&ndash;safe.</p>
+
+ @since UDK 3.2.0
+ */
+class Reader {
+public:
+ /**
+ Creates a type reader.
+
+ <p>If the given binary blob is malformed, or of a version larger than
+ <code>maxVersion</code>, the created type reader is flagged as
+ invalid.</p>
+
+ @param buffer the binary blob representing the type; must point to at
+ least <code>length</code> bytes, and need only be byte-aligned
+
+ @param length the size in bytes of the binary blob representing the type
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ Reader(void const * buffer, sal_uInt32 length)
+ {
+ if (!typereg_reader_create(buffer, length, &m_handle))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Shares a type reader between two <code>Reader</code> instances.
+
+ @param other another <code>Reader</code> instance
+ */
+ Reader(Reader const & other): m_handle(other.m_handle) {
+ typereg_reader_acquire(m_handle);
+ }
+
+ /**
+ Destroys this <code>Reader</code> instance.
+
+ <p>The underlying type reader is only destroyed if this instance was its
+ last user.</p>
+ */
+ ~Reader() {
+ typereg_reader_release(m_handle);
+ }
+
+ /**
+ Replaces the underlying type reader.
+
+ @param other any <code>Reader</code> instance
+
+ @return this <code>Reader</code> instance
+ */
+ Reader & operator =(Reader const & other) {
+ Reader temp(other);
+ std::swap(m_handle, temp.m_handle);
+ return *this;
+ }
+
+ /**
+ Returns whether this type reader is valid.
+
+ @return true iff this type reader is valid
+ */
+ bool isValid() const {
+ return m_handle != nullptr;
+ }
+
+ /**
+ Returns the binary blob version of this type reader.
+
+ @return the version of the binary blob from which this type reader was
+ constructed; if this type reader is invalid,
+ <code>TYPEREG_VERSION_0</code> is returned
+ */
+ typereg_Version getVersion() const {
+ return typereg_reader_getVersion(m_handle);
+ }
+
+ /**
+ Returns the documentation of this type reader.
+
+ @return the documentation of this type reader; if this type reader is
+ invalid, an empty string is returned
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getDocumentation() const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getDocumentation(m_handle, &s);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the file name of this type reader.
+
+ @return the file name of this type reader; if this type reader is
+ invalid, an empty string is returned
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ @deprecated
+ */
+ OUString getFileName() const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getFileName(m_handle, &s);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the type class of this type reader.
+
+ <p>This function will always return the type class without the internal
+ <code>RT_TYPE_PUBLISHED</code> flag set. Use <code>isPublished</code> to
+ determine whether this type reader is published.</p>
+
+ @return the type class of this type reader; if this type reader is
+ invalid, <code>RT_TYPE_INVALID</code> is returned
+ */
+ RTTypeClass getTypeClass() const {
+ return typereg_reader_getTypeClass(m_handle);
+ }
+
+ /**
+ Returns whether this type reader is published.
+
+ @return whether this type reader is published; if this type reader is
+ invalid, <code>false</code> is returned
+ */
+ bool isPublished() const {
+ return typereg_reader_isPublished(m_handle);
+ }
+
+ /**
+ Returns the type name of this type reader.
+
+ @return the type name of this type reader; if this type reader is
+ invalid, an empty string is returned
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getTypeName() const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getTypeName(m_handle, &s);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of super types of this type reader.
+
+ @return the number of super types of this type reader; if this type
+ reader is invalid, zero is returned
+ */
+ sal_uInt16 getSuperTypeCount() const {
+ return typereg_reader_getSuperTypeCount(m_handle);
+ }
+
+ /**
+ Returns the type name of a super type of this type reader.
+
+ @param index a valid index into the range of super types of this type
+ reader
+
+ @return the type name of the given super type
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getSuperTypeName(sal_uInt16 index) const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getSuperTypeName(m_handle, &s, index);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of fields of this type reader.
+
+ @return the number of fields of this type reader; if this type reader is
+ invalid, zero is returned
+ */
+ sal_uInt16 getFieldCount() const {
+ return typereg_reader_getFieldCount(m_handle);
+ }
+
+ /**
+ Returns the documentation of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the documentation of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getFieldDocumentation(sal_uInt16 index) const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getFieldDocumentation(m_handle, &s, index);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the file name of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the file name of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ @deprecated
+ */
+ OUString getFieldFileName(sal_uInt16 index) const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getFieldFileName(m_handle, &s, index);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the flags of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the flags of the given field
+ */
+ RTFieldAccess getFieldFlags(sal_uInt16 index) const {
+ return typereg_reader_getFieldFlags(m_handle, index);
+ }
+
+ /**
+ Returns the name of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the name of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getFieldName(sal_uInt16 index) const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getFieldName(m_handle, &s, index);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the type name of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the type name of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getFieldTypeName(sal_uInt16 index) const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getFieldTypeName(m_handle, &s, index);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the value of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the value of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ RTConstValue getFieldValue(sal_uInt16 index) const {
+ RTConstValue v;
+ if (!typereg_reader_getFieldValue(
+ m_handle, index, &v.m_type, &v.m_value))
+ {
+ throw std::bad_alloc();
+ }
+ return v;
+ }
+
+ /**
+ Returns the number of methods of this type reader.
+
+ @return the number of methods of this type reader; if this type reader is
+ invalid, zero is returned
+ */
+ sal_uInt16 getMethodCount() const {
+ return typereg_reader_getMethodCount(m_handle);
+ }
+
+ /**
+ Returns the documentation of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the documentation of the given method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodDocumentation(sal_uInt16 index) const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getMethodDocumentation(m_handle, &s, index);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the flags of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the flags of the given method
+ */
+ RTMethodMode getMethodFlags(sal_uInt16 index) const {
+ return typereg_reader_getMethodFlags(m_handle, index);
+ }
+
+ /**
+ Returns the name of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the name of the given method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodName(sal_uInt16 index) const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getMethodName(m_handle, &s, index);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the return type name of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the return type name of the given method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodReturnTypeName(sal_uInt16 index) const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getMethodReturnTypeName(m_handle, &s, index);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of parameters of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the number of parameters of the given method
+ */
+ sal_uInt16 getMethodParameterCount(sal_uInt16 index) const {
+ return typereg_reader_getMethodParameterCount(m_handle, index);
+ }
+
+ /**
+ Returns the flags of a parameter of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @return the flags of the given method parameter
+ */
+ RTParamMode getMethodParameterFlags(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
+ {
+ return typereg_reader_getMethodParameterFlags(
+ m_handle, methodIndex, parameterIndex);
+ }
+
+ /**
+ Returns the name of a parameter of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @return the name of the given method parameter
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodParameterName(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
+ {
+ rtl_uString * s = nullptr;
+ typereg_reader_getMethodParameterName(
+ m_handle, &s, methodIndex, parameterIndex);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the type name of a parameter of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @return the type name of the given method parameter
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodParameterTypeName(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
+ {
+ rtl_uString * s = nullptr;
+ typereg_reader_getMethodParameterTypeName(
+ m_handle, &s, methodIndex, parameterIndex);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of exceptions of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the number of exceptions of the given method
+ */
+ sal_uInt16 getMethodExceptionCount(sal_uInt16 index) const {
+ return typereg_reader_getMethodExceptionCount(m_handle, index);
+ }
+
+ /**
+ Returns the type name of an exception of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param exceptionIndex a valid index into the range of exceptions of the
+ given method
+
+ @return the type name of the given method exception
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodExceptionTypeName(
+ sal_uInt16 methodIndex, sal_uInt16 exceptionIndex) const
+ {
+ rtl_uString * s = nullptr;
+ typereg_reader_getMethodExceptionTypeName(
+ m_handle, &s, methodIndex, exceptionIndex);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of references of this type reader.
+
+ @return the number of references of this type reader; if this type reader
+ is invalid, zero is returned
+ */
+ sal_uInt16 getReferenceCount() const {
+ return typereg_reader_getReferenceCount(m_handle);
+ }
+
+ /**
+ Returns the documentation of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the documentation of the given reference
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getReferenceDocumentation(sal_uInt16 index) const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getReferenceDocumentation(m_handle, &s, index);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the flags of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the flags of the given reference
+ */
+ RTFieldAccess getReferenceFlags(sal_uInt16 index) const {
+ return typereg_reader_getReferenceFlags(m_handle, index);
+ }
+
+ /**
+ Returns the sort of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the sort of the given reference
+ */
+ RTReferenceType getReferenceSort(sal_uInt16 index) const {
+ return typereg_reader_getReferenceSort(m_handle, index);
+ }
+
+ /**
+ Returns the type name of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the type name of the given reference
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getReferenceTypeName(sal_uInt16 index) const {
+ rtl_uString * s = nullptr;
+ typereg_reader_getReferenceTypeName(m_handle, &s, index);
+ if (s == nullptr) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+private:
+ void * m_handle;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/refltype.hxx b/include/registry/refltype.hxx
new file mode 100644
index 000000000..0ca5803cd
--- /dev/null
+++ b/include/registry/refltype.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_REGISTRY_REFLTYPE_HXX
+#define INCLUDED_REGISTRY_REFLTYPE_HXX
+
+#include <registry/types.hxx>
+#include <sal/types.h>
+
+/** specifies the type source of a binary type blob.
+
+ Currently only RT_UNO_IDL type is used.
+ */
+enum RTTypeSource
+{
+ RT_UNO_IDL,
+ RT_CORBA_IDL,
+ RT_JAVA
+};
+
+/** specifies a helper class for const values.
+
+ This class is used for easy handling of constants or enum values
+ as fields in binary type blob.
+ */
+class RTConstValue
+{
+public:
+ /// stores the type of the constant value.
+ RTValueType m_type;
+ /// stores the value of the constant.
+ RTConstValueUnion m_value;
+
+ /// Default constructor.
+ RTConstValue()
+ : m_type(RT_TYPE_NONE)
+ {
+ m_value.aDouble = 0.0;
+ }
+};
+
+/** deprecated.
+
+ An earlier version of UNO used a unique identifier for interfaces. In the
+ current version of UNO this uik was eliminated and this type is no longer used.
+ */
+struct RTUik
+{
+ sal_uInt32 m_Data1;
+ sal_uInt16 m_Data2;
+ sal_uInt16 m_Data3;
+ sal_uInt32 m_Data4;
+ sal_uInt32 m_Data5;
+};
+
+/// specifies the calling convention for type reader/writer api
+#define TYPEREG_CALLTYPE SAL_CALL
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/regdllapi.h b/include/registry/regdllapi.h
new file mode 100644
index 000000000..603eea11d
--- /dev/null
+++ b/include/registry/regdllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_REGISTRY_REGDLLAPI_H
+#define INCLUDED_REGISTRY_REGDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(REG_DLLIMPLEMENTATION)
+#define REG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define REG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif // INCLUDED_REGISTRY_REGDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/registry.hxx b/include/registry/registry.hxx
new file mode 100644
index 000000000..b98b1e936
--- /dev/null
+++ b/include/registry/registry.hxx
@@ -0,0 +1,1059 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <registry/regdllapi.h>
+#include <registry/regtype.h>
+#include <rtl/ustring.hxx>
+
+extern "C" {
+
+/** specifies a collection of function pointers which represents the complete registry C-API.
+
+ These function pointers are used by the C++ wrapper to call the C-API.
+*/
+struct Registry_Api
+{
+ void (REGISTRY_CALLTYPE *acquire) (RegHandle);
+ void (REGISTRY_CALLTYPE *release) (RegHandle);
+ sal_Bool (REGISTRY_CALLTYPE *isReadOnly) (RegHandle);
+ RegError (REGISTRY_CALLTYPE *openRootKey) (RegHandle, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *getName) (RegHandle, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *createRegistry) (rtl_uString*, RegHandle*);
+ RegError (REGISTRY_CALLTYPE *openRegistry) (rtl_uString*, RegHandle*, RegAccessMode);
+ RegError (REGISTRY_CALLTYPE *closeRegistry) (RegHandle);
+ RegError (REGISTRY_CALLTYPE *destroyRegistry) (RegHandle, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *mergeKey) (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*, sal_Bool, sal_Bool);
+ void (REGISTRY_CALLTYPE *acquireKey) (RegKeyHandle);
+ void (REGISTRY_CALLTYPE *releaseKey) (RegKeyHandle);
+ sal_Bool (REGISTRY_CALLTYPE *isKeyReadOnly) (RegKeyHandle);
+ RegError (REGISTRY_CALLTYPE *getKeyName) (RegKeyHandle, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *createKey) (RegKeyHandle, rtl_uString*, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *openKey) (RegKeyHandle, rtl_uString*, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *openSubKeys) (RegKeyHandle, rtl_uString*, RegKeyHandle**, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *closeSubKeys) (RegKeyHandle*, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *deleteKey) (RegKeyHandle, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *closeKey) (RegKeyHandle);
+ RegError (REGISTRY_CALLTYPE *setValue) (RegKeyHandle, rtl_uString*, RegValueType, RegValue, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setLongListValue) (RegKeyHandle, rtl_uString*, sal_Int32 const *, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setStringListValue) (RegKeyHandle, rtl_uString*, char**, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode**, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *getValueInfo) (RegKeyHandle, rtl_uString*, RegValueType*, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getValue) (RegKeyHandle, rtl_uString*, RegValue);
+ RegError (REGISTRY_CALLTYPE *getLongListValue) (RegKeyHandle, rtl_uString*, sal_Int32**, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getStringListValue) (RegKeyHandle, rtl_uString*, char***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *freeValueList) (RegValueType, RegValue, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *getResolvedKeyName) (RegKeyHandle, rtl_uString*, sal_Bool, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *getKeyNames) (RegKeyHandle, rtl_uString*, rtl_uString***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *freeKeyNames) (rtl_uString**, sal_uInt32);
+};
+
+/** the API initialization function.
+*/
+REG_DLLPUBLIC Registry_Api* REGISTRY_CALLTYPE initRegistry_Api();
+
+}
+
+class RegistryKey;
+
+
+/** The Registry provides the functionality to read and write information in a registry file.
+
+ The class is implemented inline and use a C-Api.
+*/
+class Registry final
+{
+public:
+ /** Default constructor.
+ */
+ inline Registry();
+
+ /// Copy constructor
+ inline Registry(const Registry& toCopy);
+
+ Registry(Registry && other) noexcept : m_pApi(other.m_pApi), m_hImpl(other.m_hImpl)
+ { other.m_hImpl = nullptr; }
+
+ /// Destructor. The Destructor close the registry if it is open.
+ inline ~Registry();
+
+ /// Assign operator
+ inline Registry& operator = (const Registry& toAssign);
+
+ Registry & operator =(Registry && other) {
+ if (m_hImpl != nullptr) {
+ m_pApi->release(m_hImpl);
+ }
+ m_hImpl = other.m_hImpl;
+ other.m_hImpl = nullptr;
+ return *this;
+ }
+
+ /// checks if the registry points to a valid registry data file.
+ inline bool isValid() const;
+
+ /** returns the access mode of the registry.
+
+ @return TRUE if the access mode is readonly else FALSE.
+ */
+ inline bool isReadOnly() const;
+
+ /** opens the root key of the registry.
+
+ @param rRootKey reference to a RegistryKey which is filled with the rootkey.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openRootKey(RegistryKey& rRootKey);
+
+ /// returns the name of the current registry data file.
+ inline OUString getName();
+
+ /** creates a new registry with the specified name and creates a root key.
+
+ @param registryName specifies the name of the new registry.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError create(const OUString& registryName);
+
+ /** opens a registry with the specified name.
+
+ If the registry already points to a valid registry, the old registry will be closed.
+ @param registryName specifies a registry name.
+ @param accessMode specifies the access mode for the registry, RegAccessMode::READONLY or RegAccessMode::READWRITE.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError open(const OUString& registryName,
+ RegAccessMode accessMode);
+
+ /// closes explicitly the current registry data file.
+ inline RegError close();
+
+ /** destroys a registry.
+
+ @param registryName specifies a registry name, if the name is an empty string the registry
+ itself will be destroyed.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError destroy(const OUString& registryName);
+
+ /** merges the registry information of the specified key with the registry
+ information of the specified file.
+
+ All existing keys will be extended and existing key values will be overwritten.
+ @param rKey references a currently open key. The key which information is merged by this
+ function is a subkey of this key
+ @param keyName specifies the name of the key which will be merged.
+ If keyName is an empty string the registry information under the key specified
+ by rKey is merged with the information from the specified file.
+ @param regFileName specifies the file containing the registry information.
+ @param bReport if TRUE the function reports warnings on stdout if a key already exists.
+ @return RegError::NO_ERROR if succeeds else an error code. If it returns an error the registry will
+ restore the state before merging.
+ */
+ inline RegError mergeKey(RegistryKey& rKey,
+ const OUString& keyName,
+ const OUString& regFileName,
+ bool bReport);
+
+ friend class RegistryKey;
+ friend class RegistryKeyArray;
+ friend class RegistryKeyNames;
+
+ /// returns the used registry Api.
+ const Registry_Api* getApi() const { return m_pApi; }
+
+private:
+ /// stores the used and initialized registry Api.
+ const Registry_Api* m_pApi;
+ /// stores the handle of the underlying registry file on which most of the functions work.
+ RegHandle m_hImpl;
+};
+
+
+/** RegistryKeyArray represents an array of open keys.
+
+ RegistryKeyArray is a helper class to work with an array of keys.
+*/
+class RegistryKeyArray
+{
+public:
+ /// Default constructor
+ inline RegistryKeyArray();
+
+ /// Destructor, all subkeys will be closed.
+ inline ~RegistryKeyArray();
+
+ /// returns the open key specified by index.
+ inline RegistryKey getElement(sal_uInt32 index);
+
+ /// returns the length of the array.
+ inline sal_uInt32 getLength() const;
+
+ friend class RegistryKey;
+
+private:
+ /** sets the data of the key array.
+
+ @param registry specifies the registry files where the keys are located.
+ @param phKeys points to an array of open keys.
+ @param length specifies the length of the array specified by phKeys.
+ */
+ inline void setKeyHandles(Registry const & registry, RegKeyHandle* phKeys, sal_uInt32 length);
+
+ /// stores the number of open subkeys, the number of elements.
+ sal_uInt32 m_length;
+ /// stores an array of open subkeys.
+ RegKeyHandle* m_phKeys;
+ /// stores the handle to the registry file where the appropriate keys are located.
+ Registry m_registry;
+};
+
+
+/** RegistryKeyNames represents an array of key names.
+
+ RegistryKeyNames is a helper class to work with an array of key names.
+*/
+class RegistryKeyNames
+{
+public:
+ /// Default constructor
+ inline RegistryKeyNames();
+
+ /// Destructor, the internal array with key names will be deleted.
+ inline ~RegistryKeyNames();
+
+ /// returns the name of the key specified by index.
+ inline OUString getElement(sal_uInt32 index);
+
+ /// returns the length of the array.
+ inline sal_uInt32 getLength() const;
+
+ friend class RegistryKey;
+
+private:
+ /** sets the data of the array.
+
+ @param registry specifies the registry files where the keys are located.
+ @param pKeyNames points to an array of key names.
+ @param length specifies the length of the array specified by pKeyNames.
+ */
+ inline void setKeyNames(Registry const & registry, rtl_uString** pKeyNames, sal_uInt32 length);
+
+ /// stores the number of key names, the number of elements.
+ sal_uInt32 m_length;
+ /// stores an array of key names.
+ rtl_uString** m_pKeyNames;
+ /// stores the handle to the registry file where the appropriate keys are located.
+ Registry m_registry;
+};
+
+
+/** RegistryValueList represents a value list of the specified type.
+
+ RegistryValueList is a helper class to work with a list value.
+*/
+template<class ValueType>
+class RegistryValueList final
+{
+public:
+ /// Default constructor
+ RegistryValueList()
+ : m_length(0)
+ , m_pValueList(nullptr)
+ , m_valueType(RegValueType::NOT_DEFINED)
+ {}
+
+ /// Destructor, the internal value list will be freed.
+ ~RegistryValueList()
+ {
+ if (m_pValueList)
+ {
+ m_registry.getApi()->freeValueList(m_valueType, m_pValueList, m_length);
+ }
+ }
+
+ /// returns the value of the list specified by index.
+ ValueType getElement(sal_uInt32 index)
+ {
+ if (m_registry.isValid() && index < m_length)
+ {
+ return m_pValueList[index];
+ } else
+ {
+ return {};
+ }
+ }
+
+ /// returns the length of the list.
+ sal_uInt32 getLength()
+ {
+ return m_length;
+ }
+
+ friend class RegistryKey;
+
+private:
+ /** sets the data of the value list.
+
+ @param registry specifies the registry files where the appropriate key is located.
+ @param valueType specifies the type of the list values.
+ @param pValueList points to a value list.
+ @param length specifies the length of the list.
+ */
+ void setValueList(const Registry& registry, RegValueType valueType,
+ ValueType* pValueList, sal_uInt32 length)
+ {
+ m_length = length;
+ m_pValueList = pValueList;
+ m_valueType = valueType;
+ m_registry = registry;
+ }
+
+ /// stores the length of the list, the number of elements.
+ sal_uInt32 m_length;
+ /// stores the value list.
+ ValueType* m_pValueList;
+ /// stores the type of the list elements
+ RegValueType m_valueType;
+ /** stores the handle to the registry file where the appropriate key to this
+ value is located.
+ */
+ Registry m_registry;
+};
+
+
+/** RegistryKey reads or writes information of the underlying key in a registry.
+
+ Class is inline and use a load on call C-Api.
+*/
+class RegistryKey
+{
+public:
+ /// Default constructor
+ inline RegistryKey();
+
+ /// Copy constructor
+ inline RegistryKey(const RegistryKey& toCopy);
+
+ /// Destructor, close the key if it references an open one.
+ inline ~RegistryKey();
+
+ /// Assign operator
+ inline RegistryKey& operator = (const RegistryKey& toAssign);
+
+ /// checks if the key points to a valid registry key.
+ inline bool isValid() const;
+
+ /** returns the access mode of the key.
+
+ @return TRUE if access mode is read only else FALSE.
+ */
+ inline bool isReadOnly() const;
+
+ /// returns the full qualified name of the key beginning with the rootkey.
+ inline OUString getName();
+
+ /** creates a new key or opens a key if the specified key already exists.
+
+ The specified keyname is relative to this key.
+ @param keyName specifies the name of the key which will be opened or created.
+ @param rNewKey references a RegistryKey which will be filled with the new or open key.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError createKey(const OUString& keyName,
+ RegistryKey& rNewKey);
+
+ /** opens the specified key.
+
+ The specified keyname is relative to this key.
+ @param keyName specifies the name of the key which will be opened.
+ @param rOpenKey references a RegistryKey which will be filled with the open key.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openKey(const OUString& keyName,
+ RegistryKey& rOpenKey);
+
+ /** opens all subkeys of the specified key.
+
+ The specified keyname is relative to this key.
+ @param keyName specifies the name of the key which subkeys will be opened.
+ @param rSubKeys reference a RegistryKeyArray which will be filled with the open subkeys.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openSubKeys(const OUString& keyName,
+ RegistryKeyArray& rSubKeys);
+
+ /** returns an array with the names of all subkeys of the specified key.
+
+ The specified keyname is relative to this key.
+ @param keyName specifies the name of the key which subkey names will be returned.
+ @param rSubKeyNames reference a RegistryKeyNames array which will be filled with the subkey names.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getKeyNames(const OUString& keyName,
+ RegistryKeyNames& rSubKeyNames);
+
+ /** deletes the specified key.
+
+ @param keyName specifies the name of the key which will be deleted.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError deleteKey(const OUString& keyName);
+
+ /// closes explicitly the current key
+ inline RegError closeKey();
+
+ /// releases the current key
+ inline void releaseKey();
+
+ /** sets a value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param valueType specifies the type of the value.
+ @param pValue points to a memory block containing the data for the value.
+ @param valueSize specifies the size of pData in bytes
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setValue(const OUString& keyName,
+ RegValueType valueType,
+ RegValue pValue,
+ sal_uInt32 valueSize);
+
+ /** sets a long list value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param pValueList points to an array of longs containing the data for the value.
+ @param len specifies the length of the list (the array referenced by pValueList).
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setLongListValue(const OUString& keyName,
+ sal_Int32 const * pValueList,
+ sal_uInt32 len);
+
+ /** sets an ascii list value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param pValueList points to an array of char* containing the data for the value.
+ @param len specifies the length of the list (the array referenced by pValueList).
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setStringListValue(const OUString& keyName,
+ char** pValueList,
+ sal_uInt32 len);
+
+ /** sets a unicode string list value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param pValueList points to an array of sal_Unicode* containing the data for the value.
+ @param len specifies the length of the list (the array referenced by pValueList).
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setUnicodeListValue(const OUString& keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len);
+
+ /** gets info about type and size of a value.
+
+ @param keyName specifies the name of the key which value info will be returned.
+ If keyName is an empty string, the value info of the key
+ specified by hKey will be returned.
+ @param pValueType returns the type of the value.
+ @param pValueSize returns the size of the value in bytes or the length of a list value.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getValueInfo(const OUString& keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize);
+
+ /** gets the value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param pValue points to an allocated memory block receiving the data of the value.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getValue(const OUString& keyName,
+ RegValue pValue);
+
+ /** gets a long list value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList references a RegistryValueList which will be filled with the long values.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getLongListValue(const OUString& keyName,
+ RegistryValueList<sal_Int32>& rValueList);
+
+ /** gets an ascii list value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList references a RegistryValueList which will be filled with the ascii values.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getStringListValue(const OUString& keyName,
+ RegistryValueList<char*>& rValueList);
+
+ /** gets a unicode value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList reference a RegistryValueList which will be filled with the unicode values.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getUnicodeListValue(const OUString& keyName,
+ RegistryValueList<sal_Unicode*>& rValueList);
+
+ /** resolves a keyname.
+
+ @param[in] keyName specifies the name of the key which will be resolved relative to this key.
+ The resolved name will be prefixed with the name of this key.
+ @param[out] rResolvedName the resolved name.
+ @return RegError::NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getResolvedKeyName(const OUString& keyName,
+ OUString& rResolvedName) const;
+
+ /// returns the name of the registry in which the key is defined.
+ inline OUString getRegistryName();
+
+ friend class Registry;
+public:
+ /// @cond INTERNAL
+
+ /** Constructor, which initialize a RegistryKey with registry and a valid key handle.
+
+ This constructor is internal only.
+ */
+ inline RegistryKey(Registry const & registry,
+ RegKeyHandle hKey);
+
+private:
+ /** sets the internal registry on which this key should work.
+ */
+ inline void setRegistry(Registry const & registry);
+
+ /// @endcond
+
+ /// stores the registry on which this key works
+ Registry m_registry;
+ /// stores the current key handle of this key
+ RegKeyHandle m_hImpl;
+};
+
+
+inline RegistryKeyArray::RegistryKeyArray()
+ : m_length(0)
+ , m_phKeys(nullptr)
+{
+}
+
+inline RegistryKeyArray::~RegistryKeyArray()
+{
+ if (m_phKeys)
+ m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
+}
+
+inline RegistryKey RegistryKeyArray::getElement(sal_uInt32 index)
+{
+ if (m_registry.isValid() && index < m_length)
+ return RegistryKey(m_registry, m_phKeys[index]);
+ else
+ return RegistryKey();
+}
+
+inline sal_uInt32 RegistryKeyArray::getLength() const
+{
+ return m_length;
+}
+
+inline void RegistryKeyArray::setKeyHandles(Registry const & registry,
+ RegKeyHandle* phKeys,
+ sal_uInt32 length)
+{
+ m_phKeys = phKeys;
+ m_length = length;
+ m_registry = registry;
+}
+
+inline RegistryKeyNames::RegistryKeyNames()
+ : m_length(0)
+ , m_pKeyNames(nullptr)
+{
+}
+
+inline RegistryKeyNames::~RegistryKeyNames()
+{
+ if (m_pKeyNames)
+ m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
+}
+
+inline OUString RegistryKeyNames::getElement(sal_uInt32 index)
+{
+
+ if (m_pKeyNames && index < m_length)
+ return m_pKeyNames[index];
+ else
+ return OUString();
+}
+
+inline sal_uInt32 RegistryKeyNames::getLength() const
+{
+ return m_length;
+}
+
+inline void RegistryKeyNames::setKeyNames(Registry const & registry,
+ rtl_uString** pKeyNames,
+ sal_uInt32 length)
+{
+ m_pKeyNames = pKeyNames;
+ m_length = length;
+ m_registry = registry;
+}
+
+inline RegistryKey::RegistryKey()
+ : m_hImpl(nullptr)
+ { }
+
+/// @cond INTERNAL
+inline RegistryKey::RegistryKey(Registry const & registry, RegKeyHandle hKey)
+ : m_registry(registry)
+ , m_hImpl(hKey)
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->acquireKey(m_hImpl);
+ }
+/// @endcond
+
+inline RegistryKey::RegistryKey(const RegistryKey& toCopy)
+ : m_registry(toCopy.m_registry)
+ , m_hImpl(toCopy.m_hImpl)
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->acquireKey(m_hImpl);
+ }
+
+/// @cond INTERNAL
+inline void RegistryKey::setRegistry(Registry const & registry)
+ {
+ m_registry = registry;
+ }
+/// @endcond
+
+inline RegistryKey::~RegistryKey()
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->releaseKey(m_hImpl);
+ }
+
+inline RegistryKey& RegistryKey::operator = (const RegistryKey& toAssign)
+{
+ m_registry = toAssign.m_registry;
+
+ if (toAssign.m_hImpl)
+ m_registry.m_pApi->acquireKey(toAssign.m_hImpl);
+ if (m_hImpl)
+ m_registry.m_pApi->releaseKey(m_hImpl);
+ m_hImpl = toAssign.m_hImpl;
+
+ return *this;
+}
+
+inline bool RegistryKey::isValid() const
+ { return (m_hImpl != nullptr); }
+
+inline bool RegistryKey::isReadOnly() const
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->isKeyReadOnly(m_hImpl);
+ else
+ return false;
+ }
+
+inline OUString RegistryKey::getName()
+ {
+ OUString sRet;
+ if (m_registry.isValid())
+ m_registry.m_pApi->getKeyName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline RegError RegistryKey::createKey(const OUString& keyName,
+ RegistryKey& rNewKey)
+ {
+ if (rNewKey.isValid()) rNewKey.closeKey();
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->createKey(m_hImpl, keyName.pData, &rNewKey.m_hImpl);
+ if (ret == RegError::NO_ERROR) rNewKey.setRegistry(m_registry);
+ return ret;
+ } else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::openKey(const OUString& keyName,
+ RegistryKey& rOpenKey)
+ {
+ if (rOpenKey.isValid()) rOpenKey.closeKey();
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->openKey(m_hImpl, keyName.pData,
+ &rOpenKey.m_hImpl);
+ if (ret == RegError::NO_ERROR) rOpenKey.setRegistry(m_registry);
+ return ret;
+ } else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::openSubKeys(const OUString& keyName,
+ RegistryKeyArray& rSubKeys)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = RegError::NO_ERROR;
+ RegKeyHandle* pSubKeys;
+ sal_uInt32 nSubKeys;
+ ret = m_registry.m_pApi->openSubKeys(m_hImpl, keyName.pData,
+ &pSubKeys, &nSubKeys);
+ if ( ret != RegError::NO_ERROR)
+ {
+ return ret;
+ } else
+ {
+ rSubKeys.setKeyHandles(m_registry, pSubKeys, nSubKeys);
+ return ret;
+ }
+ } else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getKeyNames(const OUString& keyName,
+ RegistryKeyNames& rSubKeyNames)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = RegError::NO_ERROR;
+ rtl_uString** pSubKeyNames;
+ sal_uInt32 nSubKeys;
+ ret = m_registry.m_pApi->getKeyNames(m_hImpl, keyName.pData,
+ &pSubKeyNames, &nSubKeys);
+ if ( ret != RegError::NO_ERROR)
+ {
+ return ret;
+ } else
+ {
+ rSubKeyNames.setKeyNames(m_registry, pSubKeyNames, nSubKeys);
+ return ret;
+ }
+ } else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::deleteKey(const OUString& keyName)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->deleteKey(m_hImpl, keyName.pData);
+ else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::closeKey()
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->closeKey(m_hImpl);
+ if (ret == RegError::NO_ERROR)
+ {
+ m_hImpl = nullptr;
+ m_registry = Registry();
+ }
+ return ret;
+ } else
+ return RegError::INVALID_KEY;
+ }
+
+inline void RegistryKey::releaseKey()
+{
+ if (m_registry.isValid() && (m_hImpl != nullptr))
+ {
+ m_registry.m_pApi->releaseKey(m_hImpl);
+ m_hImpl = nullptr;
+ }
+}
+
+inline RegError RegistryKey::setValue(const OUString& keyName,
+ RegValueType valueType,
+ RegValue pValue,
+ sal_uInt32 valueSize)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setValue(m_hImpl, keyName.pData, valueType,
+ pValue, valueSize);
+ else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setLongListValue(const OUString& keyName,
+ sal_Int32 const * pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setLongListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setStringListValue(const OUString& keyName,
+ char** pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setStringListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setUnicodeListValue(const OUString& keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setUnicodeListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getValueInfo(const OUString& keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getValueInfo(m_hImpl, keyName.pData, pValueType, pValueSize);
+ else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getValue(const OUString& keyName,
+ RegValue pValue)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getValue(m_hImpl, keyName.pData, pValue);
+ else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getLongListValue(const OUString& keyName,
+ RegistryValueList<sal_Int32>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = RegError::NO_ERROR;
+ sal_Int32* pValueList;
+ sal_uInt32 length;
+ ret = m_registry.m_pApi->getLongListValue(m_hImpl, keyName.pData,
+ &pValueList, &length);
+ if ( ret != RegError::NO_ERROR)
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RegValueType::LONGLIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getStringListValue(const OUString& keyName,
+ RegistryValueList<char*>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = RegError::NO_ERROR;
+ char** pValueList;
+ sal_uInt32 length;
+ ret = m_registry.m_pApi->getStringListValue(m_hImpl, keyName.pData,
+ &pValueList, &length);
+ if ( ret != RegError::NO_ERROR )
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RegValueType::STRINGLIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getUnicodeListValue(const OUString& keyName,
+ RegistryValueList<sal_Unicode*>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = RegError::NO_ERROR;
+ sal_Unicode** pValueList;
+ sal_uInt32 length;
+ ret = m_registry.m_pApi->getUnicodeListValue(m_hImpl, keyName.pData,
+ &pValueList, &length);
+ if ( ret != RegError::NO_ERROR )
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RegValueType::UNICODELIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return RegError::INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getResolvedKeyName(const OUString& keyName,
+ OUString& rResolvedName) const
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getResolvedKeyName(m_hImpl,
+ keyName.pData,
+ true,
+ &rResolvedName.pData);
+ else
+ return RegError::INVALID_KEY;
+ }
+
+inline OUString RegistryKey::getRegistryName()
+ {
+ if (m_registry.isValid())
+ {
+ return m_registry.getName();
+ } else
+ return OUString();
+ }
+
+
+inline Registry::Registry()
+ : m_pApi(initRegistry_Api())
+ , m_hImpl(nullptr)
+ { }
+
+inline Registry::Registry(const Registry& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , m_hImpl(toCopy.m_hImpl)
+ {
+ if (m_hImpl)
+ m_pApi->acquire(m_hImpl);
+ }
+
+
+inline Registry::~Registry()
+ {
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+ }
+
+inline Registry& Registry::operator = (const Registry& toAssign)
+{
+ if (toAssign.m_hImpl)
+ toAssign.m_pApi->acquire(toAssign.m_hImpl);
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+
+ m_pApi = toAssign.m_pApi;
+ m_hImpl = toAssign.m_hImpl;
+
+ return *this;
+}
+
+inline bool Registry::isValid() const
+ { return ( m_hImpl != nullptr ); }
+
+inline bool Registry::isReadOnly() const
+ { return m_pApi->isReadOnly(m_hImpl); }
+
+inline RegError Registry::openRootKey(RegistryKey& rRootKey)
+ {
+ rRootKey.setRegistry(*this);
+ return m_pApi->openRootKey(m_hImpl, &rRootKey.m_hImpl);
+ }
+
+inline OUString Registry::getName()
+ {
+ OUString sRet;
+ m_pApi->getName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline RegError Registry::create(const OUString& registryName)
+ {
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+ return m_pApi->createRegistry(registryName.pData, &m_hImpl);
+ }
+
+inline RegError Registry::open(const OUString& registryName,
+ RegAccessMode accessMode)
+ {
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+ return m_pApi->openRegistry(registryName.pData, &m_hImpl, accessMode);
+ }
+
+inline RegError Registry::close()
+ {
+ RegError ret = m_pApi->closeRegistry(m_hImpl);
+ if (ret == RegError::NO_ERROR)
+ m_hImpl = nullptr;
+ return ret;
+ }
+
+inline RegError Registry::destroy(const OUString& registryName)
+ {
+ RegError ret = m_pApi->destroyRegistry(m_hImpl, registryName.pData);
+ if ( ret == RegError::NO_ERROR && registryName.isEmpty() )
+ m_hImpl = nullptr;
+ return ret;
+ }
+
+inline RegError Registry::mergeKey(RegistryKey& rKey,
+ const OUString& keyName,
+ const OUString& regFileName,
+ bool bReport)
+ { return m_pApi->mergeKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData, false/*bWarnings*/, bReport); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/regtype.h b/include/registry/regtype.h
new file mode 100644
index 000000000..89fdcc940
--- /dev/null
+++ b/include/registry/regtype.h
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_REGISTRY_REGTYPE_H
+#define INCLUDED_REGISTRY_REGTYPE_H
+
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+
+/// defines the type of a registry handle used in the C API.
+typedef void* RegHandle;
+
+/// defines the type of a registry key handle used in the C API.
+typedef void* RegKeyHandle;
+
+/// defines the type of a registry key value handle used in the C API.
+typedef void* RegValue;
+
+/** defines the open/access mode of the registry.
+
+ Two modes are valid:
+ -READONLY allows readonly access
+ -READWRITE allows read and write access
+ */
+enum class RegAccessMode
+{
+ READONLY = 0x0001, /// This mode allows readonly access.
+ READWRITE = 0x0002 /// This mode allows read and write access.
+};
+namespace o3tl
+{
+template <> struct typed_flags<RegAccessMode> : is_typed_flags<RegAccessMode, 0x03>
+{
+};
+}
+
+/** defines the type of a key value.
+
+ A registry key can contain a value which has one of seven different types.
+ Three simple types (long, ascii and unicode string) and a list type of
+ these simple types. Furthermore a binary type which provides the possibility
+ to define own data structures and store these types in the registry. The UNO
+ core reflection data is stored as a binary blob in the type registry.
+ */
+enum class SAL_DLLPUBLIC_RTTI RegValueType
+{
+ /// The key has no value or the value type is unknown.
+ NOT_DEFINED,
+ /// The key has a value of type long
+ LONG,
+ /// The key has a value of type ascii string
+ STRING,
+ /// The key has a value of type unicode string
+ UNICODE,
+ /// The key has a value of type binary
+ BINARY,
+ /// The key has a value of type long list
+ LONGLIST,
+ /// The key has a value of type ascii string list
+ STRINGLIST,
+ /// The key has a value of type unicode string list
+ UNICODELIST
+};
+
+/// specifies the possible error codes which can occur using the registry API.
+enum class SAL_DLLPUBLIC_RTTI RegError
+{
+ /// no error.
+ NO_ERROR,
+
+ /// registry is not open.
+ REGISTRY_NOT_OPEN,
+ /// registry does not exists.
+ REGISTRY_NOT_EXISTS,
+ /// registry is open with readonly access rights.
+ REGISTRY_READONLY,
+ /// destroy a registry failed. There are may be any open keys.
+ DESTROY_REGISTRY_FAILED,
+ /** registry cannot be opened with readwrite access because the registry is already
+ open with readwrite access anywhere.
+ */
+ CANNOT_OPEN_FOR_READWRITE,
+ /** registry is in an invalid state or the registry does not point to
+ a valid registry data file.
+ */
+ INVALID_REGISTRY,
+
+ /// the key or key handle points to an invalid key or closed key.
+ KEY_NOT_OPEN,
+ /// the specified keyname points to a nonexisting key.
+ KEY_NOT_EXISTS,
+ /// the key with the specified keyname cannot be created.
+ CREATE_KEY_FAILED,
+ /// the specified key cannot be deleted. Maybe an open key handle exists to this key.
+ DELETE_KEY_FAILED,
+ /** the keyname is invalid. This error will return if the keyname
+ is NULL but should not be NULL in the context of a called function.
+ */
+ INVALID_KEYNAME,
+ /// the key is not in a valid state.
+ INVALID_KEY,
+
+ /// the key has no value
+ VALUE_NOT_EXISTS,
+ /// setting the specified value of a key failed.
+ SET_VALUE_FAILED,
+ /// deleting of the key value failed.
+ DELETE_VALUE_FAILED,
+ /// the key has an invalid value or the value type is unknown.
+ INVALID_VALUE,
+
+ /// merging a key, the value and all subkeys failed.
+ MERGE_ERROR,
+ /** conflicts exists during the merge process of a key. This could happen if
+ the value of a key already exists and the merge process will replace it.
+ */
+ MERGE_CONFLICT,
+};
+
+/// specify the calling convention for the registry API
+#define REGISTRY_CALLTYPE SAL_CALL
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/typereg_reader.hxx b/include/registry/typereg_reader.hxx
new file mode 100644
index 000000000..a0af800f0
--- /dev/null
+++ b/include/registry/typereg_reader.hxx
@@ -0,0 +1,565 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_REGISTRY_READER_H
+#define INCLUDED_REGISTRY_READER_H
+
+#include <registry/regdllapi.h>
+#include <registry/types.hxx>
+#include <registry/version.h>
+
+#include <rtl/ustring.h>
+#include <sal/types.h>
+
+/**
+ Creates a type reader working on a binary blob that represents a UNOIDL type.
+
+ <p>If a non-null handle is returned through <code>result</code>, its
+ reference count will be one. Operations on a non-null handle are not
+ multi-thread&ndash;safe.</p>
+
+ The type reader works directly on the given buffer, which must remain
+ available unmodified until the type reader is destroyed
+
+ @param buffer the binary blob representing the type; must point to at least
+ <code>length</code> bytes, and need only be byte-aligned
+
+ @param length the size in bytes of the binary blob representing the type
+
+ @param result an out-parameter obtaining a handle on the type reader; must
+ not be null; if the given binary blob is malformed, or of a version larger
+ than <code>maxVersion</code>, null is returned
+
+ @return false iff an out-of-memory condition occurred, in which case
+ <code>result</code> is left unchanged, and no type reader is created
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC bool typereg_reader_create(
+ void const * buffer, sal_uInt32 length,
+ void ** result);
+
+/**
+ Increments the reference count of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_acquire(void * handle);
+
+/**
+ Decrements the reference count of a type reader.
+
+ <p>If the reference count drops to zero, the type reader is destroyed.</p>
+
+ @param handle a handle on a type reader; may be null
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_release(void * handle);
+
+/**
+ Returns the binary blob version of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the version of the binary blob from which the type reader was
+ constructed; if <code>handle</code> is null, <code>TYPEREG_VERSION_0</code>
+ is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC typereg_Version typereg_reader_getVersion(void const * handle);
+
+/**
+ Returns the documentation of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @param result an out-parameter obtaining the documentation string; must not
+ be null; if <code>handle</code> is null, an empty string is returned; if an
+ out-of-memory condition occurs, a pointer to a null pointer is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getDocumentation(
+ void * handle, rtl_uString ** result);
+
+/**
+ Returns the file name of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @param result an out-parameter obtaining the file name string; must not be
+ null; if <code>handle</code> is null, an empty string is returned; if an
+ out-of-memory condition occurs, a pointer to a null pointer is returned
+
+ @since UDK 3.2.0
+ @deprecated
+ */
+REG_DLLPUBLIC void typereg_reader_getFileName(void * handle, rtl_uString ** result);
+
+/**
+ Returns the type class of a type reader.
+
+ <p>This function will always return the type class without the internal
+ <code>RT_TYPE_PUBLISHED</code> flag set. Use
+ <code>typereg_reader_isPublished</code> to determine whether a type reader is
+ published.</p>
+
+ @param handle a handle on a type reader; may be null
+
+ @return the type class of the type reader; if <code>handle</code> is null,
+ <code>RT_TYPE_INVALID</code> is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC RTTypeClass typereg_reader_getTypeClass(void * handle);
+
+/**
+ Returns whether a type reader is published.
+
+ @param handle a handle on a type reader; may be null
+
+ @return whether the type reader is published; if <code>handle</code> is null,
+ false is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC bool typereg_reader_isPublished(void * handle);
+
+/**
+ Returns the type name of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @param result an out-parameter obtaining the type name string; must not be
+ null; if <code>handle</code> is null, an empty string is returned; if an
+ out-of-memory condition occurs, a pointer to a null pointer is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getTypeName(void * handle, rtl_uString ** result);
+
+/**
+ Returns the number of super types of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of super types of the type reader; if <code>handle</code>
+ is null, zero is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 typereg_reader_getSuperTypeCount(void * handle);
+
+/**
+ Returns the type name of a super type of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the super type's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of super types of the given type
+ reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getSuperTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index);
+
+/**
+ Returns the number of fields of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of fields of the type reader; if <code>handle</code> is
+ null, zero is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 typereg_reader_getFieldCount(void * handle);
+
+/**
+ Returns the documentation of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's documentation string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getFieldDocumentation(
+ void * handle, rtl_uString ** result, sal_uInt16 index);
+
+/**
+ Returns the file name of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's file name string; must
+ not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ @deprecated
+ */
+REG_DLLPUBLIC void typereg_reader_getFieldFileName(
+ void * handle, rtl_uString ** result, sal_uInt16 index);
+
+/**
+ Returns the flags of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @return the flags of the given field of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC RTFieldAccess typereg_reader_getFieldFlags(
+ void * handle, sal_uInt16 index);
+
+/**
+ Returns the name of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's name string; must not be
+ null; if an out-of-memory condition occurs, a pointer to a null pointer is
+ returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getFieldName(
+ void * handle, rtl_uString ** result, sal_uInt16 index);
+
+/**
+ Returns the type name of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's type name string; must
+ not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getFieldTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index);
+
+/**
+ Returns the value of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @param type an out-parameter obtaining the field value's type; must not be
+ null
+
+ @param value an out-parameter obtaining the field value's value; must not be
+ null
+
+ @return false iff an out-of-memory condition occurred, in which case
+ <code>type</code> and <code>value</code> are left unchanged
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC bool typereg_reader_getFieldValue(
+ void * handle, sal_uInt16 index, RTValueType * type,
+ union RTConstValueUnion * value);
+
+/**
+ Returns the number of methods of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of methods of the type reader; if <code>handle</code> is
+ null, zero is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 typereg_reader_getMethodCount(void * handle);
+
+/**
+ Returns the documentation of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the methods's documentation string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getMethodDocumentation(
+ void * handle, rtl_uString ** result, sal_uInt16 index);
+
+/**
+ Returns the flags of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @return the flags of the given method of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC RTMethodMode typereg_reader_getMethodFlags(
+ void * handle, sal_uInt16 index);
+
+/**
+ Returns the name of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the methods's name string; must not
+ be null; if an out-of-memory condition occurs, a pointer to a null pointer is
+ returned
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getMethodName(
+ void * handle, rtl_uString ** result, sal_uInt16 index);
+
+/**
+ Returns the return type name of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the methods's return type name
+ string; must not be null; if an out-of-memory condition occurs, a pointer to
+ a null pointer is returned
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getMethodReturnTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index);
+
+/**
+ Returns the number of parameters of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @return the number of parameters of the given method of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 typereg_reader_getMethodParameterCount(
+ void * handle, sal_uInt16 index);
+
+/**
+ Returns the flags of a parameter of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @return the flags of the given parameter of the given method of the type
+ reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC RTParamMode typereg_reader_getMethodParameterFlags(
+ void * handle, sal_uInt16 methodIndex, sal_uInt16 parameterIndex);
+
+/**
+ Returns the name of a parameter of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the parameter's name string; must
+ not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getMethodParameterName(
+ void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
+ sal_uInt16 parameterIndex);
+
+/**
+ Returns the type name of a parameter of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the parameter's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getMethodParameterTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
+ sal_uInt16 parameterIndex);
+
+/**
+ Returns the number of exceptions of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @return the number of exceptions of the given method of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 typereg_reader_getMethodExceptionCount(
+ void * handle, sal_uInt16 index);
+
+/**
+ Returns the type name of an exception of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the exception's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param exceptionIndex a valid index into the range of exceptions of the given
+ method
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getMethodExceptionTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
+ sal_uInt16 exceptionIndex);
+
+/**
+ Returns the number of references of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of references of the type reader; if <code>handle</code>
+ is null, zero is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 typereg_reader_getReferenceCount(void * handle);
+
+/**
+ Returns the documentation of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the reference's documentation
+ string; must not be null; if an out-of-memory condition occurs, a pointer to
+ a null pointer is returned
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getReferenceDocumentation(
+ void * handle, rtl_uString ** result, sal_uInt16 index);
+
+/**
+ Returns the flags of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @return the flags of the given reference of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC RTFieldAccess typereg_reader_getReferenceFlags(
+ void * handle, sal_uInt16 index);
+
+/**
+ Returns the sort of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @return the sort of the given reference of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC RTReferenceType typereg_reader_getReferenceSort(
+ void * handle, sal_uInt16 index);
+
+/**
+ Returns the type name of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the reference's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_reader_getReferenceTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/types.hxx b/include/registry/types.hxx
new file mode 100644
index 000000000..a9763f5ea
--- /dev/null
+++ b/include/registry/types.hxx
@@ -0,0 +1,339 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_REGISTRY_TYPES_H
+#define INCLUDED_REGISTRY_TYPES_H
+
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+
+/** specifies the typeclass of a binary type blob.
+
+ The general structure of a binary type blob is always the same. It depends
+ on the typeclass which parts of the blob are filled with data or not.
+ */
+enum RTTypeClass
+{
+ /** specifies that the structure of the given blob is unknown and can't be
+ read.
+ */
+ RT_TYPE_INVALID,
+
+ /** specifies that the blob represents an interface type. An interface blob
+ can contain a base interface, attributes and methods.
+ */
+ RT_TYPE_INTERFACE,
+
+ /** specifies that the blob represents a module type. A module blob can
+ contain a base module and constant members (fields).
+ */
+ RT_TYPE_MODULE,
+
+ /** specifies that the blob represents a struct type. A struct blob can
+ contain a base struct and members (fields).
+ */
+ RT_TYPE_STRUCT,
+
+ /** specifies that the blob represents an enum type. An enum blob can
+ contain enum values which are accessible as fields.
+ */
+ RT_TYPE_ENUM,
+
+ /** specifies that the blob represents an exception type. An exception blob
+ can contain a base exception and members (fields).
+ */
+ RT_TYPE_EXCEPTION,
+
+ /** specifies that the blob represents a typedef type. A typedef blob can
+ contain a base type.
+ */
+ RT_TYPE_TYPEDEF,
+
+ /** specifies that the blob represents a service type. A service blob can
+ contain a base service, properties (fields), references to services or
+ interfaces.
+ */
+ RT_TYPE_SERVICE,
+
+ /** specifies that the blob represents a singleton type (a named object)
+ which refers exactly one existing service.
+ */
+ RT_TYPE_SINGLETON,
+
+ /// deprecated, not used.
+ RT_TYPE_OBJECT,
+
+ /** specifies that the blob represents a constants type. A constants blob
+ can contain constant types as fields.
+ */
+ RT_TYPE_CONSTANTS,
+
+ /** @deprecated
+ a union type was evaluated but currently not supported.
+ */
+ RT_TYPE_UNION,
+
+ /// @cond INTERNAL
+ /**
+ Flag for published entities.
+
+ Used in combination with RT_TYPE_INTERFACE, RT_TYPE_STRUCT, RT_TYPE_ENUM,
+ RT_TYPE_EXCEPTION, RT_TYPE_TYPEDEF, RT_TYPE_SERVICE, RT_TYPE_SINGLETON,
+ or RT_TYPE_CONSTANTS to mark an entity as published.
+
+ (The value of this enumerator is chosen so that it is unlikely that its
+ addition changes the underlying type of this enumeration for any C/C++
+ compiler.)
+
+ @since UDK 3.2.0
+ */
+ RT_TYPE_PUBLISHED = 0x4000
+ /// @endcond
+};
+
+/** specifies the type for the field access.
+
+ Fields in a type blob are used for different types. Among others they were
+ used for properties of services and these properties can have several flags.
+
+ @see RTFieldAccess::INVALID
+ @see RTFieldAccess::READONLY
+ @see RTFieldAccess::OPTIONAL
+ @see RTFieldAccess::MAYBEVOID
+ @see RTFieldAccess::BOUND
+ @see RTFieldAccess::CONSTRAINED
+ @see RTFieldAccess::TRANSIENT
+ @see RTFieldAccess::MAYBEAMBIGUOUS
+ @see RTFieldAccess::MAYBEDEFAULT
+ @see RTFieldAccess::REMOVABLE
+ @see RTFieldAccess::ATTRIBUTE
+ @see RTFieldAccess::PROPERTY
+ @see RTFieldAccess::CONST
+ @see RTFieldAccess::READWRITE
+ @see RTFieldAccess::DEFAULT
+ @see RTFieldAccess::PARAMETERIZED_TYPE
+ @see RTFieldAccess::PUBLISHED
+ */
+enum class RTFieldAccess
+{
+ NONE = 0x0000,
+ /// specifies an unknown flag
+ INVALID = 0x0000,
+ /// specifies a readonly property/attribute
+ READONLY = 0x0001,
+ /// specifies a property as optional that means that it must not be implemented.
+ OPTIONAL = 0x0002,
+ /// @see com::sun::star::beans::PropertyAttribute
+ MAYBEVOID = 0x0004,
+ /// @see com::sun::star::beans::PropertyAttribute
+ BOUND = 0x0008,
+ /// @see com::sun::star::beans::PropertyAttribute
+ CONSTRAINED = 0x0010,
+ /// @see com::sun::star::beans::PropertyAttribute
+ TRANSIENT = 0x0020,
+ /// @see com::sun::star::beans::PropertyAttribute
+ MAYBEAMBIGUOUS = 0x0040,
+ /// @see com::sun::star::beans::PropertyAttribute
+ MAYBEDEFAULT = 0x0080,
+ /// @see com::sun::star::beans::PropertyAttribute
+ REMOVABLE = 0x0100,
+ /// @see com::sun::star::beans::PropertyAttribute
+ ATTRIBUTE = 0x0200,
+ /// specifies that the field is a property
+ PROPERTY = 0x0400,
+ /// specifies that the field is a constant or enum value
+ CONST = 0x0800,
+ /// specifies that the property/attribute has read/write access
+ READWRITE = 0x1000,
+ /// only to describe a union default label
+ DEFAULT = 0x2000,
+ /**
+ Indicates that a member of a polymorphic struct type template is of a
+ parameterized type.
+
+ Only valid for fields that represent members of polymorphic struct type
+ templates.
+
+ @since UDK 3.2.0
+ */
+ PARAMETERIZED_TYPE = 0x4000,
+ /**
+ Flag for published individual constants.
+
+ Used in combination with RTFieldAccess::CONST for individual constants (which are
+ not members of constant groups).
+
+ @since UDK 3.2.0
+ */
+ PUBLISHED = 0x8000,
+
+};
+namespace o3tl
+{
+template <> struct typed_flags<RTFieldAccess> : is_typed_flags<RTFieldAccess, 0xffff>
+{
+};
+}
+
+/** specifies the type of a field value.
+
+ A field can have a value if it represents a constant or an enum value.
+ */
+enum RTValueType
+{
+ RT_TYPE_NONE,
+ RT_TYPE_BOOL,
+ RT_TYPE_BYTE,
+ RT_TYPE_INT16,
+ RT_TYPE_UINT16,
+ RT_TYPE_INT32,
+ RT_TYPE_UINT32,
+ RT_TYPE_INT64,
+ RT_TYPE_UINT64,
+ RT_TYPE_FLOAT,
+ RT_TYPE_DOUBLE,
+ RT_TYPE_STRING
+};
+
+/** specifies a variable container for field values.
+ */
+union RTConstValueUnion {
+ bool aBool;
+ sal_Int8 aByte;
+ sal_Int16 aShort;
+ sal_uInt16 aUShort;
+ sal_Int32 aLong;
+ sal_uInt32 aULong;
+ sal_Int64 aHyper;
+ sal_uInt64 aUHyper;
+ float aFloat;
+ double aDouble;
+ sal_Unicode const* aString;
+};
+
+/** specifies the mode of a method.
+
+ A method can be synchron or asynchron (oneway). The const attribute for
+ methods was removed so that the const values are deprecated.
+ */
+enum class RTMethodMode
+{
+ /// indicates an invalid mode
+ INVALID,
+
+ /// indicates the asynchronous mode of a method
+ ONEWAY,
+
+ /// @deprecated
+ ONEWAY_CONST,
+
+ /// indicated the synchronous mode of a method
+ TWOWAY,
+
+ /// @deprecated
+ TWOWAY_CONST,
+
+ /**
+ Indicates an extended attribute getter (that has a 'raises' clause) of an
+ interface type.
+
+ @since UDK 3.2.0
+ */
+ ATTRIBUTE_GET,
+
+ /**
+ Indicates an extended attribute setter (that has a 'raises' clause) of an
+ interface type.
+
+ @since UDK 3.2.0
+ */
+ ATTRIBUTE_SET
+};
+
+/** specifies the mode of a parameter.
+
+ There are three parameter modes which have impact of the handling of the
+ parameter in the UNO bridges and the UNO code generation.
+ */
+enum RTParamMode
+{
+ /// indicates an invalid parameter mode
+ RT_PARAM_INVALID = 0,
+
+ /// indicates a pure in parameter which is used by value
+ RT_PARAM_IN = 1,
+
+ /// indicates a pure out parameter which is used by reference
+ RT_PARAM_OUT = 2,
+
+ /// indicates a in and out parameter which is used also by reference
+ RT_PARAM_INOUT = 3,
+
+ /**
+ Indicates a rest parameter (currently only valid for service
+ constructors).
+
+ This value can be combined with any of RT_PARAM_IN, RT_PARAM_OUT, and
+ RT_PARAM_INOUT (however, service constructors currently only allow
+ RT_PARAM_IN, anyway).
+
+ @since UDK 3.2.0
+ */
+ RT_PARAM_REST = 4
+};
+
+/** specifies the type of a reference used in a service description.
+ */
+enum class RTReferenceType
+{
+ /// the reference type is unknown
+ INVALID,
+
+ /** the service support the interface that means an implementation of this
+ service must implement this interface.
+ */
+ SUPPORTS,
+
+ /** @deprecated
+ the service observes the interface.
+ */
+ OBSERVES,
+
+ /** the service exports the specified service that means this service
+ provides also the specified service.
+ */
+ EXPORTS,
+
+ /** @deprecated
+ the service needs the specified service that means in the context of
+ this service the specified service will be used or must be available.
+ */
+ NEEDS,
+
+ /**
+ Indicates a type parameter of a polymorphic struct type template.
+
+ @since UDK 3.2.0
+ */
+ TYPE_PARAMETER
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/version.h b/include/registry/version.h
new file mode 100644
index 000000000..b7c066d41
--- /dev/null
+++ b/include/registry/version.h
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_REGISTRY_VERSION_H
+#define INCLUDED_REGISTRY_VERSION_H
+
+#include <sal/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ The version of a binary blob that represents a UNOIDL type.
+
+ <p>All values between <code>TYPEREG_VERSION_0</code> and
+ <code>TYPEREG_MAX_VERSION</code> are valid, where currently unallocated
+ values represent future versions. Negative values are not valid.</p>
+
+ @see typereg::Reader
+ @see typereg::Writer
+
+ @since UDK 3.2.0
+ */
+enum typereg_Version {
+ /**
+ Denotes the original version of UNOIDL type blobs.
+ */
+ TYPEREG_VERSION_0,
+
+ /**
+ Denotes the updated version of UNOIDL type blobs.
+
+ <p>This version added support for multiple-inheritance interface types,
+ extended interface type attributes, single-interface&ndash;based
+ services, interface-based singletons, polymorphic struct types, and
+ published entities.</p>
+ */
+ TYPEREG_VERSION_1,
+
+ /**
+ Denotes the maximum future version of UNOIDL type blobs.
+ */
+ TYPEREG_MAX_VERSION = SAL_MAX_INT32
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/writer.h b/include/registry/writer.h
new file mode 100644
index 000000000..8f07437c5
--- /dev/null
+++ b/include/registry/writer.h
@@ -0,0 +1,262 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_REGISTRY_WRITER_H
+#define INCLUDED_REGISTRY_WRITER_H
+
+#include <registry/regdllapi.h>
+#include <registry/types.hxx>
+#include <registry/version.h>
+
+#include <rtl/ustring.h>
+#include <sal/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ Creates a type writer working on a binary blob that represents a UNOIDL type.
+
+ <p>Operations on a returned handle are not multi-thread&ndash;safe.</p>
+
+ @param version the version of the created type writer; must not be negative
+
+ @param documentation the documentation; must not be null
+
+ @param fileName the file name; must not be null (deprecated, use an empty string)
+
+ @param typeClass the type class of the created type writer
+
+ @param published whether the created type writer is published; for a type
+ class that cannot be published, this should be false
+
+ @param typeName the type name of the created type writer; must not be null
+
+ @param superTypeCount the number of super types of the created type writer
+
+ @param fieldCount the number of fields of the created type writer
+
+ @param methodCount the number of methods of the created type writer
+
+ @param referenceCount the number of references of the created type writer
+
+ @return a handle on the type writer; if an out-of-memory condition occurs,
+ null is returned, and no type writer is created
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void * typereg_writer_create(
+ typereg_Version version, rtl_uString const * documentation,
+ rtl_uString const * fileName, RTTypeClass typeClass, sal_Bool published,
+ rtl_uString const * typeName, sal_uInt16 superTypeCount,
+ sal_uInt16 fieldCount, sal_uInt16 methodCount, sal_uInt16 referenceCount)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Destroys a type writer.
+
+ @param handle a handle on a type writer obtained from a call to
+ <code>typereg_writer_create</code>; must not be null
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void typereg_writer_destroy(void * handle) SAL_THROW_EXTERN_C();
+
+/**
+ Sets the type name of a super type of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of super types of the given type
+ writer
+
+ @param typeName the super type name; must not be null
+
+ @return false iff an out-of-memory condition occurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool typereg_writer_setSuperTypeName(
+ void const * handle, sal_uInt16 index, rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a field of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of fields of the given type writer
+
+ @param documentation the documentation of the field; must not be null
+
+ @param fileName the file name of the field; must not be null (deprecated, use an empty string)
+
+ @param flags the flags of the field
+
+ @param name the name of the field; must not be null
+
+ @param typeName the type name of the field; must not be null
+
+ @param valueType the type of the value of the field
+
+ @param valueValue the value of the value of the field
+
+ @return false iff an out-of-memory condition occurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool typereg_writer_setFieldData(
+ void * handle, sal_uInt16 index, rtl_uString const * documentation,
+ rtl_uString const * fileName, RTFieldAccess flags, rtl_uString const * name,
+ rtl_uString const * typeName, RTValueType valueType,
+ RTConstValueUnion valueValue)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a method of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of methods of the given type writer
+
+ @param documentation the documentation of the method; must not be null
+
+ @param flags the flags of the method
+
+ @param name the name of the method; must not be null
+
+ @param returnTypeName the return type name of the method; must not be null
+
+ @param parameterCount the number of parameters of the method
+
+ @param exceptionCount the number of exceptions of the method
+
+ @return false iff an out-of-memory condition occurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool typereg_writer_setMethodData(
+ void * handle, sal_uInt16 index, rtl_uString const * documentation,
+ RTMethodMode flags, rtl_uString const * name,
+ rtl_uString const * returnTypeName, sal_uInt16 parameterCount,
+ sal_uInt16 exceptionCount)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a parameter of a method of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param methodIndex a valid index into the range of methods of the given type
+ writer
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @param flags the flags of the parameter
+
+ @param name the name of the parameter; must not be null
+
+ @param typeName the type name of the parameter; must not be null
+
+ @return false iff an out-of-memory condition occurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool typereg_writer_setMethodParameterData(
+ void const * handle, sal_uInt16 methodIndex, sal_uInt16 parameterIndex,
+ RTParamMode flags, rtl_uString const * name, rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets an exception type name of a method of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param methodIndex a valid index into the range of methods of the given type
+ writer
+
+ @param exceptionIndex a valid index into the range of exceptions of the given
+ method
+
+ @param typeName the exception type name; must not be null
+
+ @return false iff an out-of-memory condition occurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool typereg_writer_setMethodExceptionTypeName(
+ void const * handle, sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
+ rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a reference of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of references of the given type
+ writer
+
+ @param documentation the documentation of the reference; must not be null
+
+ @param sort the sort of the reference
+
+ @param flags the flags of the reference
+
+ @param typeName the type name of the reference; must not be null
+
+ @return false iff an out-of-memory condition occurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool typereg_writer_setReferenceData(
+ void * handle, sal_uInt16 index, rtl_uString const * documentation,
+ RTReferenceType sort, RTFieldAccess flags, rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the blob of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param size an out-parameter obtaining the size of the blob; must not be null
+
+ @return a (byte-aligned) pointer to the blob; the returned pointer and the
+ returned <code>size</code> remain valid until the next function is called on
+ the given type writer; if an out-of-memory condition occurs, null is returned
+ and <code>size</code> is not modified
+ */
+REG_DLLPUBLIC void const * typereg_writer_getBlob(void * handle, sal_uInt32 * size)
+ SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/writer.hxx b/include/registry/writer.hxx
new file mode 100644
index 000000000..4bf672461
--- /dev/null
+++ b/include/registry/writer.hxx
@@ -0,0 +1,291 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_REGISTRY_WRITER_HXX
+#define INCLUDED_REGISTRY_WRITER_HXX
+
+#include <registry/writer.h>
+#include <registry/refltype.hxx>
+#include <registry/types.hxx>
+#include <registry/version.h>
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+#include <new>
+
+namespace typereg {
+
+/**
+ A type writer working on a binary blob that represents a UNOIDL type.
+
+ <p>Instances of this class are not multi-thread&ndash;safe.</p>
+
+ @since UDK 3.2.0
+ */
+class Writer {
+public:
+ /**
+ Creates a type writer.
+
+ @param version the version of the created type writer; must not be
+ negative
+
+ @param documentation the documentation
+
+ @param fileName the file name (deprecated, use an empty string)
+
+ @param typeClass the type class of the created type writer
+
+ @param published whether the created type writer is published; for a type
+ class that cannot be published, this should be false
+
+ @param typeName the type name of the created type writer
+
+ @param superTypeCount the number of super types of the created type
+ writer
+
+ @param fieldCount the number of fields of the created type writer
+
+ @param methodCount the number of methods of the created type writer
+
+ @param referenceCount the number of references of the created type writer
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ Writer(
+ typereg_Version version, OUString const & documentation,
+ OUString const & fileName, RTTypeClass typeClass, bool published,
+ OUString const & typeName, sal_uInt16 superTypeCount,
+ sal_uInt16 fieldCount, sal_uInt16 methodCount,
+ sal_uInt16 referenceCount):
+ m_handle(
+ typereg_writer_create(
+ version, documentation.pData, fileName.pData, typeClass,
+ published, typeName.pData, superTypeCount, fieldCount,
+ methodCount, referenceCount))
+ {
+ if (m_handle == nullptr) {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Destroys this <code>Writer</code> instance.
+ */
+ ~Writer() {
+ typereg_writer_destroy(m_handle);
+ }
+
+ /**
+ Sets the type name of a super type of this type writer.
+
+ @param index a valid index into the range of super types of this type
+ writer
+
+ @param typeName the super type name
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setSuperTypeName(sal_uInt16 index, OUString const & typeName) {
+ if (!typereg_writer_setSuperTypeName(m_handle, index, typeName.pData)) {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a field of this type writer.
+
+ @param index a valid index into the range of fields of this type writer
+
+ @param documentation the documentation of the field
+
+ @param fileName the file name of the field (deprecated, use an empty string)
+
+ @param flags the flags of the field
+
+ @param name the name of the field
+
+ @param typeName the type name of the field
+
+ @param value the value of the field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setFieldData(
+ sal_uInt16 index, OUString const & documentation,
+ OUString const & fileName, RTFieldAccess flags, OUString const & name,
+ OUString const & typeName, RTConstValue const & value)
+ {
+ if (!typereg_writer_setFieldData(
+ m_handle, index, documentation.pData, fileName.pData, flags,
+ name.pData, typeName.pData, value.m_type, value.m_value))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a method of this type writer.
+
+ @param index a valid index into the range of methods of this type writer
+
+ @param documentation the documentation of the method
+
+ @param flags the flags of the method
+
+ @param name the name of the method
+
+ @param returnTypeName the return type name of the method
+
+ @param parameterCount the number of parameters of the method
+
+ @param exceptionCount the number of exceptions of the method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setMethodData(
+ sal_uInt16 index, OUString const & documentation,
+ RTMethodMode flags, OUString const & name,
+ OUString const & returnTypeName, sal_uInt16 parameterCount,
+ sal_uInt16 exceptionCount)
+ {
+ if (!typereg_writer_setMethodData(
+ m_handle, index, documentation.pData, flags, name.pData,
+ returnTypeName.pData, parameterCount, exceptionCount))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a parameter of a method of this type writer.
+
+ @param methodIndex a valid index into the range of methods of this type
+ writer
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @param flags the flags of the parameter
+
+ @param name the name of the parameter
+
+ @param typeName the type name of the parameter
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setMethodParameterData(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex,
+ RTParamMode flags, OUString const & name,
+ OUString const & typeName) const
+ {
+ if (!typereg_writer_setMethodParameterData(
+ m_handle, methodIndex, parameterIndex, flags, name.pData,
+ typeName.pData))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets an exception type name of a method of this type writer.
+
+ @param methodIndex a valid index into the range of methods of this type
+ writer
+
+ @param exceptionIndex a valid index into the range of exceptions of the
+ given method
+
+ @param typeName the exception type name
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setMethodExceptionTypeName(
+ sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
+ OUString const & typeName)
+ {
+ if (!typereg_writer_setMethodExceptionTypeName(
+ m_handle, methodIndex, exceptionIndex, typeName.pData))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a reference of this type writer.
+
+ @param index a valid index into the range of references of this type
+ writer
+
+ @param documentation the documentation of the reference
+
+ @param sort the sort of the reference
+
+ @param flags the flags of the reference
+
+ @param typeName the type name of the reference
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setReferenceData(
+ sal_uInt16 index, OUString const & documentation,
+ RTReferenceType sort, RTFieldAccess flags,
+ OUString const & typeName)
+ {
+ if (!typereg_writer_setReferenceData(
+ m_handle, index, documentation.pData, sort, flags,
+ typeName.pData))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Returns the blob of this type writer.
+
+ @param size an out-parameter obtaining the size of the blob
+
+ @return a (byte-aligned) pointer to the blob; the returned pointer and
+ the returned <code>size</code> remain valid until the next function is
+ called on this type writer
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ (in which case <code>size</code> is not modified
+ */
+ void const * getBlob(sal_uInt32 * size) {
+ void const * p = typereg_writer_getBlob(m_handle, size);
+ if (p == nullptr) {
+ throw std::bad_alloc();
+ }
+ return p;
+ }
+
+private:
+ Writer(Writer const &) = delete;
+ Writer& operator =(Writer const &) = delete;
+
+ void * m_handle;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/alloc.h b/include/rtl/alloc.h
new file mode 100644
index 000000000..79a94704c
--- /dev/null
+++ b/include/rtl/alloc.h
@@ -0,0 +1,336 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_ALLOC_H
+#define INCLUDED_RTL_ALLOC_H
+
+#include "sal/config.h"
+
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** Allocate memory.
+
+ A call to this function will return NULL upon the requested
+ memory size being either zero or larger than currently allocatable.
+
+ @param[in] Bytes memory size.
+ @return pointer to the allocated memory.
+ */
+SAL_DLLPUBLIC void * SAL_CALL rtl_allocateMemory (
+ sal_Size Bytes
+) SAL_THROW_EXTERN_C();
+
+
+/** Reallocate memory.
+
+ A call to this function with parameter 'Ptr' being NULL
+ is equivalent to a rtl_allocateMemory() call.
+ A call to this function with parameter 'Bytes' being 0
+ is equivalent to a rtl_freeMemory() call.
+
+ @see rtl_allocateMemory()
+ @see rtl_freeMemory()
+
+ @param[in] Ptr pointer to the previously allocated memory.
+ @param[in] Bytes new memory size.
+ @return pointer to the reallocated memory. May differ from Ptr.
+ */
+SAL_DLLPUBLIC void * SAL_CALL rtl_reallocateMemory (
+ void * Ptr,
+ sal_Size Bytes
+) SAL_THROW_EXTERN_C();
+
+
+/** Free memory.
+ @param[in] Ptr pointer to the previously allocated memory.
+ @return none. Memory is released. Ptr is invalid.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_freeMemory (
+ void * Ptr
+) SAL_THROW_EXTERN_C();
+
+/** Allocate and zero memory.
+
+ A call to this function will return NULL upon the requested
+ memory size being either zero or larger than currently allocatable.
+
+ @param[in] Bytes memory size.
+ @return pointer to the allocated and zero'ed memory.
+ */
+SAL_DLLPUBLIC void * SAL_CALL rtl_allocateZeroMemory (
+ sal_Size Bytes
+) SAL_THROW_EXTERN_C();
+
+/** Zero memory
+
+ Fills a block of memory with zeros in a way that is guaranteed to be secure
+
+ @param[in] Ptr pointer to the previously allocated memory.
+ @param[in] Bytes memory size.
+
+ @since LibreOffice 5.0
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_secureZeroMemory (
+ void * Ptr,
+ sal_Size Bytes
+) SAL_THROW_EXTERN_C();
+
+
+/** Zero and free memory.
+ @param[in] Ptr pointer to the previously allocated memory.
+ @param[in] Bytes memory size.
+ @return none. Memory is zero'ed with rtl_secureZeroMemory() and released.
+ Ptr is invalid.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_freeZeroMemory (
+ void * Ptr,
+ sal_Size Bytes
+) SAL_THROW_EXTERN_C();
+
+/** Allocate aligned memory.
+
+ A call to this function will return NULL upon the requested
+ memory size being either zero or larger than currently allocatable.
+
+ Memory obtained through this function must be freed with
+ rtl_freeAlignedMemory().
+
+ @param[in] Alignment alignment in bytes, must be a power of two multiple of
+ sizeof(void*).
+ @param[in] Bytes memory size.
+ @return pointer to the allocated memory.
+
+ @since LibreOffice 4.3
+ */
+SAL_DLLPUBLIC void* SAL_CALL rtl_allocateAlignedMemory (
+ sal_Size Alignment,
+ sal_Size Bytes
+) SAL_THROW_EXTERN_C();
+
+
+/** Free memory allocated with rtl_allocateAlignedMemory().
+
+ @param[in] Ptr pointer to the previously allocated memory.
+ @return none. Memory is released. Ptr is invalid.
+
+ @since LibreOffice 4.3
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_freeAlignedMemory (
+ void * Ptr
+) SAL_THROW_EXTERN_C();
+
+
+/** Opaque rtl_arena_type.
+ */
+typedef struct SAL_DLLPUBLIC_RTTI rtl_arena_st rtl_arena_type;
+
+#define RTL_ARENA_NAME_LENGTH 31
+
+
+/**
+ * @param[in] pName descriptive name; for debugging purposes.
+ * @param[in] quantum resource allocation unit / granularity; rounded up to next power of 2.
+ * @param[in] quantum_cache_max no longer used, should be 0.
+ * @param[in] source_arena passed as argument to source_alloc, source_free; usually NULL.
+ * @param[in] source_alloc function to allocate resources; usually rtl_arena_alloc.
+ * @param[in] source_free function to free resources; usually rtl_arena_free.
+ * @param[in] nFlags flags; usually 0.
+ *
+ * @return pointer to rtl_arena_type, or NULL upon failure.
+ *
+ * @see rtl_arena_destroy()
+ */
+SAL_DLLPUBLIC rtl_arena_type * SAL_CALL rtl_arena_create (
+ const char * pName,
+ sal_Size quantum,
+ sal_Size quantum_cache_max,
+ rtl_arena_type * source_arena,
+ void * (SAL_CALL * source_alloc)(rtl_arena_type *, sal_Size *),
+ void (SAL_CALL * source_free) (rtl_arena_type *, void *, sal_Size),
+ int nFlags
+) SAL_THROW_EXTERN_C();
+
+
+/**
+ * @param[in] pArena the arena to destroy.
+ * @return None
+ *
+ * @see rtl_arena_create()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_arena_destroy (
+ rtl_arena_type * pArena
+) SAL_THROW_EXTERN_C();
+
+
+/**
+ * @param[in] pArena arena from which resource is allocated.
+ * @param[in,out] pBytes size of resource to allocate.
+ *
+ * @return allocated resource, or NULL upon failure.
+ *
+ * @see rtl_arena_free()
+ */
+SAL_DLLPUBLIC void * SAL_CALL rtl_arena_alloc (
+ rtl_arena_type * pArena,
+ sal_Size * pBytes
+) SAL_THROW_EXTERN_C();
+
+
+/**
+ * @param[in] pArena arena from which resource was allocated.
+ * @param[in] pAddr resource to free.
+ * @param[in] nBytes size of resource.
+ *
+ * @return None.
+ *
+ * @see rtl_arena_alloc()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_arena_free (
+ rtl_arena_type * pArena,
+ void * pAddr,
+ sal_Size nBytes
+) SAL_THROW_EXTERN_C();
+
+
+/** Opaque rtl_cache_type.
+ */
+typedef struct rtl_cache_st rtl_cache_type;
+
+#define RTL_CACHE_NAME_LENGTH 31
+
+#define RTL_CACHE_FLAG_BULKDESTROY 1 /* obsolete */
+
+/**
+ * @param[in] pName descriptive name; for debugging purposes.
+ * @param[in] nObjSize object size.
+ * @param[in] nObjAlign object alignment; usually 0 for suitable default.
+ * @param[in] constructor object constructor callback function; returning 1 for success or 0 for failure.
+ * @param[in] destructor object destructor callback function.
+ * @param[in] reclaim reclaim callback function.
+ * @param[in] pUserArg opaque argument passed to callback functions.
+ * @param[in] pSource unused argument (should be null).
+ * @param[in] nFlags flags (unused).
+ *
+ * @return pointer to rtl_cache_type, or NULL upon failure.
+ *
+ * @see rtl_cache_destroy()
+ */
+SAL_DLLPUBLIC rtl_cache_type * SAL_CALL rtl_cache_create (
+ const char * pName,
+ sal_Size nObjSize,
+ sal_Size nObjAlign,
+ int (SAL_CALL * constructor)(void * pObj, void * pUserArg),
+ void (SAL_CALL * destructor) (void * pObj, void * pUserArg),
+ void (SAL_CALL * reclaim) (void * pUserArg),
+ void * pUserArg,
+ rtl_arena_type * pSource,
+ int nFlags
+) SAL_THROW_EXTERN_C();
+
+
+/**
+ * @param[in] pCache the cache to destroy.
+ *
+ * @return None.
+ *
+ * @see rtl_cache_create()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_cache_destroy (
+ rtl_cache_type * pCache
+) SAL_THROW_EXTERN_C();
+
+
+/**
+ * @param[in] pCache cache from which object is allocated.
+ *
+ * @return pointer to the allocated object, or NULL upon failure.
+ */
+SAL_DLLPUBLIC void * SAL_CALL rtl_cache_alloc (
+ rtl_cache_type * pCache
+) SAL_THROW_EXTERN_C();
+
+
+/**
+ * @param[in] pCache cache from which object was allocated.
+ * @param[in] pObj object to free.
+ *
+ * @return None.
+ *
+ * @see rtl_cache_alloc()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_cache_free (
+ rtl_cache_type * pCache,
+ void * pObj
+) SAL_THROW_EXTERN_C();
+
+
+#ifdef LIBO_INTERNAL_ONLY
+
+/** @cond INTERNAL */
+/** rtl_alloc_preInit
+ *
+ * This function, is called at the beginning and again
+ * at the end of LibreOfficeKit pre-initialization to enable
+ * various optimizations.
+ *
+ * Its function is to annotate a section @start = true
+ * to end (@start = false) via. two calls. Inside this
+ * section string allocators are replaced with ones which cause the
+ * strings to be staticized at the end of the section.
+ *
+ * This brings a number of constraints - in particular no
+ * string allocated outside the section should be freed
+ * inside it, practically this means starting the section
+ * as early as possible. No string allocated inside the
+ * section will be freed subsequently as they are
+ * staticized.
+ *
+ * This method is not thread-safe, nor intended for use in
+ * a threaded context, cf. previous constraints.
+ *
+ * It is almost certainly not the method that you want,
+ * use with extraordinary care referring to the
+ * implementation.
+ *
+ * @since LibreOffice 6.1
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_alloc_preInit (
+ sal_Bool start
+) SAL_THROW_EXTERN_C();
+/** @endcond */
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_RTL_ALLOC_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/bootstrap.h b/include/rtl/bootstrap.h
new file mode 100644
index 000000000..e532cd0e3
--- /dev/null
+++ b/include/rtl/bootstrap.h
@@ -0,0 +1,224 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_RTL_BOOTSTRAP_H
+#define INCLUDED_RTL_BOOTSTRAP_H
+
+#include "sal/config.h"
+
+#include "rtl/ustring.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ @file
+
+ The described concept provides a platform independent way to access
+ minimum bootstrap settings for every application by explicitly or
+ implicitly passing the values to the application.
+
+ <strong>MULTI-LEVEL STRATEGY FOR RETRIEVAL OF BOOTSTRAP VALUES:</strong>
+
+ The 1st level is tried first. On failure,
+ the next level is tried. Every query starts at the first level again, so
+ that one setting may be taken from the 3rd and one from the 1st level.
+
+ 1st level: explicitly set variables via rtl_bootstrap_set()
+
+ 2nd level: command line arguments. A `-env:SETTINGNAME=value` is given on
+ command line. This allows giving an application a certain setting, even
+ if an ini-file exists (especially useful for e.g. daemons that want to
+ start an executable with dynamical changing settings).
+
+ 3rd level: environment variables. The application tries to get the
+ setting from the environment.
+
+ 4th level: executable ini-file. Every application looks for an ini-file.
+ The filename defaults to `/absolute/path/to/executable[rc|.ini]`
+ without .bin or .exe suffix. The ini-filename can be
+ set by the special command line parameter
+ `-env:INIFILENAME=/absolute/path/to/inifile` at runtime or it may
+ be set at compile time by an API-call.
+
+ 5th level: URE_BOOTSTRAP ini-file. If the bootstrap variable URE_BOOTSTRAP
+ expands to the URL of an ini-file, that ini-file is searched.
+
+ 6th level: default. An application can have some default settings decided
+ at compile time, which allow the application to run even with no
+ deployment settings.
+
+ If neither of the above levels leads to a successful retrieval of the value
+ (no default possible), the application may fail to start.
+
+ <strong>NAMING CONVENTIONS</strong>
+
+ Naming conventions for names of bootstrap values:
+ Names may only include characters, that are allowed characters for
+ environment variables. This excludes '.', ' ', ';', ':' and any non-ascii
+ character. Names are case insensitive.
+
+ An ini-file is only allowed to have one section, which must be named
+ `[Bootstrap]` with the square brackets.
+ The section may be omitted.
+ The section name does not appear in the name of the corresponding
+ environment variable or commandline arg.
+ Values may be arbitrary unicode strings, they must be encoded in UTF8.
+
+ <em>Example:</em>
+
+ in an ini-file:
+ <code>
+ [Sectionname]
+ Name=value
+ </code>
+
+ as commandline arg:
+ <code>-env:Name=value</code>
+
+ as environment:
+ - <code>setenv Name value</code>
+ - <code>set Name=value</code>
+
+ <strong>SPECIAL VARIABLES:</strong>
+
+ - INIFILENAME<br>
+ This variable allows to set the inifilename. This makes only sense, if the filename
+ is different than the executable file name. It must be given on command line. If it is
+ given the executable ini-file is ignored.
+*/
+
+/** may be called by an application to set an ini-filename.
+
+ Must be called before rtl_bootstrap_get(). May not be called twice.
+ If it is never called, the filename is based on the name of the executable,
+ with the suffix ".ini" on Windows or "rc" on Unix.
+
+ @param pFileUri URL of the inifile with path but WITHOUT suffix (.ini or rc)
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_bootstrap_setIniFileName( rtl_uString *pFileUri );
+
+/**
+ @param pName
+ The name of the bootstrap setting to be retrieved.
+ @param[out] ppValue
+ Contains always a valid rtl_uString pointer.
+ @param pDefault
+ maybe <code>NULL</code>. If once the default is
+ returned, successive calls always return this
+ default value, even when called with different
+ defaults.
+
+ @retval sal_True when a value could be retrieved successfully.
+ When a <code>pDefault</code> value is given,
+ the function always returns <code>sal_True</code>.
+ @retval sal_False when none of the 4 methods gave a value.
+ <code>ppValue</code> then contains an empty string.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_bootstrap_get(
+ rtl_uString *pName, rtl_uString **ppValue, rtl_uString *pDefault );
+
+/** Sets a bootstrap parameter.
+
+ @param pName
+ name of bootstrap parameter
+ @param pValue
+ value of bootstrap parameter
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_bootstrap_set(
+ rtl_uString * pName, rtl_uString * pValue );
+
+
+typedef void * rtlBootstrapHandle;
+
+/**
+ Opens a bootstrap argument container.
+ @param[in] pIniName The name of the ini-file to use, if <code>NULL</code> defaults
+ to the executables name
+ @return Handle for a bootstrap argument container
+*/
+SAL_DLLPUBLIC rtlBootstrapHandle SAL_CALL rtl_bootstrap_args_open(rtl_uString * pIniName);
+
+/**
+ Closes a bootstrap argument container.
+ @param[in] handle The handle got by rtl_bootstrap_args_open()
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_bootstrap_args_close(rtlBootstrapHandle handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ @param[in] handle The handle got by rtl_bootstrap_args_open()
+ @param[in] pName The name of the variable to be retrieved
+ @param[out] ppValue The result of the retrieval. *ppValue may be null in case of failure.
+ @param[in] pDefault The default value for the retrieval, may be <code>NULL</code>
+
+ @return The status of the retrieval, <code>sal_True</code> on success.
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_bootstrap_get_from_handle(
+ rtlBootstrapHandle handle, rtl_uString *pName, rtl_uString **ppValue, rtl_uString *pDefault);
+
+
+/** Returns the name of the inifile associated with this handle.
+
+ @param[in] handle The handle got by rtl_bootstrap_args_open()
+ @param[out] ppIniName contains after the call the name of the ini-filename.
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_bootstrap_get_iniName_from_handle(
+ rtlBootstrapHandle handle, rtl_uString ** ppIniName);
+
+/** Expands a macro using bootstrap variables.
+
+ @param[in] handle The handle got by rtl_bootstrap_args_open()
+ @param[in,out] macro The macro to be expanded
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_bootstrap_expandMacros_from_handle(
+ rtlBootstrapHandle handle, rtl_uString ** macro );
+
+/** Expands a macro using default bootstrap variables.
+
+ @param[in,out] macro The macro to be expanded
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_bootstrap_expandMacros(
+ rtl_uString ** macro);
+
+/** Escapes special characters ("$" and "\").
+
+ @param value
+ an arbitrary, non-NULL value
+
+ @param[out] encoded
+ the given value with all occurrences of special characters ("$" and "\") escaped
+
+ @since UDK 3.2.9
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_bootstrap_encode(
+ rtl_uString const * value, rtl_uString ** encoded );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/bootstrap.hxx b/include/rtl/bootstrap.hxx
new file mode 100644
index 000000000..4d8db0690
--- /dev/null
+++ b/include/rtl/bootstrap.hxx
@@ -0,0 +1,231 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_RTL_BOOTSTRAP_HXX
+#define INCLUDED_RTL_BOOTSTRAP_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "rtl/ustring.hxx"
+#include "rtl/bootstrap.h"
+
+namespace rtl
+{
+ class Bootstrap
+ {
+ void * _handle;
+
+ Bootstrap( Bootstrap const & ) SAL_DELETED_FUNCTION;
+ Bootstrap & operator = ( Bootstrap const & ) SAL_DELETED_FUNCTION;
+
+ public:
+ /**
+ * @see rtl_bootstrap_setIniFileName()
+ */
+ static inline void SAL_CALL setIniFilename( const ::rtl::OUString &sFileUri );
+
+ /** Retrieves a bootstrap parameter
+ @param sName name of the bootstrap value. case insensitive.
+ @param[out] outValue On success contains the value, otherwise
+ an empty string.
+ @return false, if no value could be retrieved, otherwise true
+ @see rtl_bootstrap_get()
+ */
+ static inline bool get(
+ const ::rtl::OUString &sName,
+ ::rtl::OUString &outValue );
+
+ /** Retrieves a bootstrap parameter
+
+ @param sName name of the bootstrap value. case insensitive.
+ @param[out] outValue Contains the value associated with <code>sName</code>.
+ @param aDefault if none of the other methods retrieved a value,
+ <code>outValue</code> is assigned to <code>aDefault</code>.
+
+ @see rtl_bootstrap_get()
+ */
+ static inline void get(
+ const ::rtl::OUString &sName,
+ ::rtl::OUString &outValue,
+ const ::rtl::OUString &aDefault );
+
+ /** Sets a bootstrap parameter.
+
+ @param name
+ name of bootstrap parameter
+ @param value
+ value of bootstrap parameter
+
+ @see rtl_bootstrap_set()
+ */
+ static inline void set( ::rtl::OUString const & name, ::rtl::OUString const & value );
+
+ /** default ctor.
+ */
+ inline Bootstrap();
+
+ /** Opens a bootstrap argument container
+ @see rtl_bootstrap_args_open()
+ */
+ inline Bootstrap(const rtl::OUString & iniName);
+
+ /** Closes a bootstrap argument container
+ @see rtl_bootstrap_args_close()
+ */
+ inline ~Bootstrap();
+
+ /** Retrieves a bootstrap argument.
+
+ It is first tried to retrieve the value via the global function
+ and second via the special bootstrap container.
+ @see rtl_bootstrap_get_from_handle()
+ */
+
+ inline bool getFrom(const ::rtl::OUString &sName,
+ ::rtl::OUString &outValue) const;
+
+ /** Retrieves a bootstrap argument.
+
+ It is first tried to retrieve the value via the global function
+ and second via the special bootstrap container.
+ @see rtl_bootstrap_get_from_handle()
+ */
+ inline void getFrom(const ::rtl::OUString &sName,
+ ::rtl::OUString &outValue,
+ const ::rtl::OUString &aDefault) const;
+
+ /** Retrieves the name of the underlying ini-file.
+ @see rtl_bootstrap_get_iniName_from_handle()
+ */
+ inline void getIniName(::rtl::OUString & iniName) const;
+
+ /** Expands a macro using bootstrap variables.
+
+ @param[in,out] macro The macro to be expanded
+ */
+ void expandMacrosFrom( ::rtl::OUString & macro ) const
+ { rtl_bootstrap_expandMacros_from_handle( _handle, &macro.pData ); }
+
+ /** Expands a macro using default bootstrap variables.
+
+ @param[in,out] macro The macro to be expanded
+ */
+ static void expandMacros( ::rtl::OUString & macro )
+ { rtl_bootstrap_expandMacros( &macro.pData ); }
+
+ /** Provides the bootstrap internal handle.
+
+ @return bootstrap handle
+ */
+ rtlBootstrapHandle getHandle() const
+ { return _handle; }
+
+ /** Escapes special characters ("$" and "\").
+
+ @param value
+ an arbitrary value
+
+ @return
+ the given value, with all occurrences of special characters ("$" and
+ "\") escaped
+
+ @since UDK 3.2.9
+ */
+ static inline ::rtl::OUString encode( ::rtl::OUString const & value );
+ };
+
+
+ // IMPLEMENTATION
+
+ inline void Bootstrap::setIniFilename( const ::rtl::OUString &sFile )
+ {
+ rtl_bootstrap_setIniFileName( sFile.pData );
+ }
+
+ inline bool Bootstrap::get( const ::rtl::OUString &sName,
+ ::rtl::OUString & outValue )
+ {
+ return rtl_bootstrap_get( sName.pData , &(outValue.pData) , NULL );
+ }
+
+ inline void Bootstrap::get( const ::rtl::OUString &sName,
+ ::rtl::OUString & outValue,
+ const ::rtl::OUString & sDefault )
+ {
+ rtl_bootstrap_get( sName.pData , &(outValue.pData) , sDefault.pData );
+ }
+
+ inline void Bootstrap::set( ::rtl::OUString const & name, ::rtl::OUString const & value )
+ {
+ rtl_bootstrap_set( name.pData, value.pData );
+ }
+
+ inline Bootstrap::Bootstrap()
+ {
+ _handle = NULL;
+ }
+
+ inline Bootstrap::Bootstrap(const rtl::OUString & iniName)
+ {
+ if(!iniName.isEmpty())
+ _handle = rtl_bootstrap_args_open(iniName.pData);
+
+ else
+ _handle = NULL;
+ }
+
+ inline Bootstrap::~Bootstrap()
+ {
+ rtl_bootstrap_args_close(_handle);
+ }
+
+
+ inline bool Bootstrap::getFrom(const ::rtl::OUString &sName,
+ ::rtl::OUString &outValue) const
+ {
+ return rtl_bootstrap_get_from_handle(_handle, sName.pData, &outValue.pData, NULL);
+ }
+
+ inline void Bootstrap::getFrom(const ::rtl::OUString &sName,
+ ::rtl::OUString &outValue,
+ const ::rtl::OUString &aDefault) const
+ {
+ rtl_bootstrap_get_from_handle(_handle, sName.pData, &outValue.pData, aDefault.pData);
+ }
+
+ inline void Bootstrap::getIniName(::rtl::OUString & iniName) const
+ {
+ rtl_bootstrap_get_iniName_from_handle(_handle, &iniName.pData);
+ }
+
+ inline ::rtl::OUString Bootstrap::encode( ::rtl::OUString const & value )
+ {
+ ::rtl::OUString encoded;
+ rtl_bootstrap_encode(value.pData, &encoded.pData);
+ return encoded;
+ }
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/byteseq.h b/include/rtl/byteseq.h
new file mode 100644
index 000000000..2acb9b745
--- /dev/null
+++ b/include/rtl/byteseq.h
@@ -0,0 +1,331 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_RTL_BYTESEQ_H
+#define INCLUDED_RTL_BYTESEQ_H
+
+#include "sal/config.h"
+
+#include "rtl/alloc.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** Assures that the reference count of the given byte sequence is one. Otherwise a new copy
+ of the sequence is created with a reference count of one.
+
+ @param ppSequence sequence
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_reference2One(
+ sal_Sequence ** ppSequence )
+ SAL_THROW_EXTERN_C();
+
+/** Reallocates length of byte sequence.
+
+ @param ppSequence sequence
+ @param nSize new size of sequence
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_realloc(
+ sal_Sequence ** ppSequence, sal_Int32 nSize )
+ SAL_THROW_EXTERN_C();
+
+/** Acquires the byte sequence
+
+ @param pSequence sequence, that is to be acquired
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_acquire(
+ sal_Sequence *pSequence )
+ SAL_THROW_EXTERN_C();
+
+/** Releases the byte sequence. If the refcount drops to zero, the sequence is freed.
+
+ @param pSequence sequence, that is to be released; invalid after call
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_release(
+ sal_Sequence *pSequence )
+ SAL_THROW_EXTERN_C();
+
+/** Constructs a bytes sequence with length nLength. All bytes are set to zero.
+
+ @param ppSequence inout sequence; on entry *ppSequence may be null, otherwise it is released;
+ after the call, *ppSequence contains the newly constructed sequence
+ @param nLength length of new sequence
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_construct(
+ sal_Sequence **ppSequence , sal_Int32 nLength )
+ SAL_THROW_EXTERN_C();
+
+/** Constructs a bytes sequence with length nLength. The data is not initialized.
+
+ @param ppSequence inout sequence; on entry *ppSequence may be null, otherwise it is released;
+ after the call, *ppSequence contains the newly constructed sequence
+ @param nLength length of new sequence
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_constructNoDefault(
+ sal_Sequence **ppSequence , sal_Int32 nLength )
+ SAL_THROW_EXTERN_C();
+
+/** Constructs a byte sequence with length nLength and copies nLength bytes from pData.
+
+ @param ppSequence inout sequence; on entry *ppSequence may be null, otherwise it is released;
+ after the call, *ppSequence contains the newly constructed sequence
+ @param pData initial data
+ @param nLength length of new sequence
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_constructFromArray(
+ sal_Sequence **ppSequence, const sal_Int8 *pData , sal_Int32 nLength )
+ SAL_THROW_EXTERN_C();
+
+/** Assigns the byte sequence pSequence to *ppSequence.
+
+ @param ppSequence inout sequence; on entry *ppSequence may be null, otherwise it is released;
+ after the call, *ppSequence references pSequence
+ @param pSequence the source sequence
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_assign(
+ sal_Sequence **ppSequence , sal_Sequence *pSequence )
+ SAL_THROW_EXTERN_C();
+
+/** Compares two byte sequences.
+
+ @return true, if the data within the sequences are identical; false otherwise
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_byte_sequence_equals(
+ sal_Sequence *pSequence1 , sal_Sequence *pSequence2 )
+ SAL_THROW_EXTERN_C();
+
+/** Returns the data array pointer of the sequence.
+
+ @return read-pointer to the data array of the sequence. If rtl_byte_sequence_reference2One()
+ has been called before, the pointer may be casted to a non const pointer and
+ the sequence may be modified
+*/
+SAL_DLLPUBLIC const sal_Int8 *SAL_CALL rtl_byte_sequence_getConstArray(
+ sal_Sequence *pSequence )
+ SAL_THROW_EXTERN_C();
+
+/** Returns the length of the sequence
+
+ @param pSequence sequence handle
+ @return length of the sequence
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_byte_sequence_getLength(
+ sal_Sequence *pSequence )
+ SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+namespace rtl
+{
+
+enum __ByteSequence_NoDefault
+{
+ /** This enum value can be used to create a bytesequence with uninitialized data
+ */
+ BYTESEQ_NODEFAULT = 0xcafe
+};
+
+enum __ByteSequence_NoAcquire
+{
+ /** This enum value can be used to create a bytesequence from a C-Handle without
+ acquiring the handle.
+ */
+ BYTESEQ_NOACQUIRE =
+#if defined _MSC_VER
+ int(0xcafebabe)
+#else
+ 0xcafebabe
+#endif
+};
+
+/** C++ class representing a SAL byte sequence.
+ C++ Sequences are reference counted and shared, so the sequence keeps a handle to its data.
+ To keep value semantics, copies are only generated if the sequence is to be modified
+ (new handle).
+*/
+class SAL_WARN_UNUSED ByteSequence
+{
+ /** sequence handle
+ */
+ sal_Sequence * _pSequence;
+
+public:
+ /// @cond INTERNAL
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new ( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete ( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new ( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete ( void *, void * )
+ {}
+ /// @endcond
+
+ /** Default constructor: Creates an empty sequence.
+ */
+ inline ByteSequence();
+ /** Copy constructor: Creates a copy of given sequence.
+
+ @param rSeq another byte sequence
+ */
+ inline ByteSequence( const ByteSequence & rSeq );
+#if defined LIBO_INTERNAL_ONLY
+ inline ByteSequence( ByteSequence && rSeq ) noexcept;
+#endif
+ /** Copy constructor Creates a copy from the C-Handle.
+
+ @param pSequence another byte sequence handle
+ */
+ inline ByteSequence( sal_Sequence *pSequence );
+ /** Constructor: Creates a copy of given data bytes.
+
+ @param pElements an array of bytes
+ @param len number of bytes
+ */
+ inline ByteSequence( const sal_Int8 * pElements, sal_Int32 len );
+ /** Constructor: Creates sequence of given length and initializes all bytes to 0.
+
+ @param len initial sequence length
+ */
+ inline ByteSequence( sal_Int32 len );
+ /** Constructor: Creates sequence of given length and does NOT initialize data.
+ Use this ctor for performance optimization only.
+
+ @param len initial sequence length
+ @param nodefault dummy parameter forcing explicit BYTESEQ_NODEFAULT
+ */
+ inline ByteSequence( sal_Int32 len , enum __ByteSequence_NoDefault nodefault );
+ /** Constructor:
+ Creates a sequence from a C-Handle without acquiring the handle, thus taking
+ over ownership. Eitherway the handle is released by the destructor.
+ This ctor is useful, when working with a c-interface (it safes a pair of
+ acquire and release call and is thus a performance optimization only).
+
+ @param pSequence sequence handle to be taken over
+ @param noacquire dummy parameter forcing explicit BYTESEQ_NOACQUIRE
+ */
+ inline ByteSequence( sal_Sequence *pSequence , enum __ByteSequence_NoAcquire noacquire );
+ /** Destructor: Releases sequence handle. Last handle will free memory.
+ */
+ inline ~ByteSequence();
+
+ /** Assignment operator: Acquires given sequence handle and releases a previously set handle.
+
+ @param rSeq another byte sequence
+ @return this sequence
+ */
+ inline ByteSequence & SAL_CALL operator = ( const ByteSequence & rSeq );
+#if defined LIBO_INTERNAL_ONLY
+ inline ByteSequence & operator = ( ByteSequence && rSeq ) noexcept;
+#endif
+
+ /** Gets the length of sequence.
+
+ @return length of sequence
+ */
+ sal_Int32 SAL_CALL getLength() const
+ { return _pSequence->nElements; }
+
+ /** Gets a pointer to byte array for READING. If the sequence has a length of 0, then the
+ returned pointer is undefined.
+
+ @return pointer to byte array
+ */
+ const sal_Int8 * SAL_CALL getConstArray() const
+ { return reinterpret_cast<sal_Int8 *>(_pSequence->elements); }
+ /** Gets a pointer to elements array for READING AND WRITING. In general if the sequence
+ has a handle acquired by other sequences (reference count > 1), then a new sequence is
+ created copying all bytes to keep value semantics!
+ If the sequence has a length of 0, then the returned pointer is undefined.
+
+ @return pointer to elements array
+ */
+ inline sal_Int8 * SAL_CALL getArray();
+
+ /** Non-const index operator:
+ Obtains a reference to byte indexed at given position.
+ In general if the sequence has a handle acquired by other
+ sequences (reference count > 1), then a new sequence is created
+ copying all bytes to keep value semantics!
+
+ @attention
+ The implementation does NOT check for array bounds!
+
+ @param nIndex index
+ @return non-const C++ reference to element at index nIndex
+ */
+ inline sal_Int8 & SAL_CALL operator [] ( sal_Int32 nIndex );
+
+ /** Const index operator: Obtains a reference to byte indexed at given position.
+ The implementation does NOT check for array bounds!
+
+ @param nIndex index
+ @return const C++ reference to byte at element of index nIndex
+ */
+ const sal_Int8 & SAL_CALL operator [] ( sal_Int32 nIndex ) const
+ { return getConstArray()[ nIndex ]; }
+
+ /** Equality operator: Compares two sequences.
+
+ @param rSeq another byte sequence (right side)
+ @return true if both sequences are equal, false otherwise
+ */
+ inline bool SAL_CALL operator == ( const ByteSequence & rSeq ) const;
+ /** Unequality operator: Compares two sequences.
+
+ @param rSeq another byte sequence (right side)
+ @return false if both sequences are equal, true otherwise
+ */
+ inline bool SAL_CALL operator != ( const ByteSequence & rSeq ) const;
+
+ /** Reallocates sequence to new length. If the sequence has a handle acquired by other sequences
+ (reference count > 1), then the remaining elements are copied to a new sequence handle to
+ keep value semantics!
+
+ @param nSize new size of sequence
+ */
+ inline void SAL_CALL realloc( sal_Int32 nSize );
+
+ /** Returns the UNacquired C handle of the sequence
+
+ @return UNacquired handle of the sequence
+ */
+ sal_Sequence * SAL_CALL getHandle() const
+ { return _pSequence; }
+ /** Returns the UNacquired C handle of the sequence (for compatibility reasons)
+
+ @return UNacquired handle of the sequence
+ */
+ sal_Sequence * SAL_CALL get() const
+ { return _pSequence; }
+};
+
+}
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/byteseq.hxx b/include/rtl/byteseq.hxx
new file mode 100644
index 000000000..33118cd8b
--- /dev/null
+++ b/include/rtl/byteseq.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_RTL_BYTESEQ_HXX
+#define INCLUDED_RTL_BYTESEQ_HXX
+
+#include "rtl/byteseq.h"
+
+#include <cstddef>
+#include <new>
+
+namespace rtl
+{
+
+
+inline ByteSequence::ByteSequence()
+ : _pSequence( NULL )
+{
+ ::rtl_byte_sequence_construct( &_pSequence, 0 );
+}
+
+inline ByteSequence::ByteSequence( const ByteSequence & rSeq )
+ : _pSequence( NULL )
+{
+ ::rtl_byte_sequence_assign( &_pSequence, rSeq._pSequence );
+}
+
+#if defined LIBO_INTERNAL_ONLY
+inline ByteSequence::ByteSequence( ByteSequence && rSeq ) noexcept
+ : _pSequence(rSeq._pSequence)
+{
+ rSeq._pSequence = nullptr;
+}
+#endif
+
+inline ByteSequence::ByteSequence( sal_Sequence *pSequence)
+ : _pSequence( pSequence )
+{
+ ::rtl_byte_sequence_acquire( pSequence );
+}
+
+inline ByteSequence::ByteSequence( const sal_Int8 * pElements, sal_Int32 len )
+ : _pSequence( NULL )
+{
+ ::rtl_byte_sequence_constructFromArray( &_pSequence, pElements, len );
+ if (_pSequence == NULL)
+ throw ::std::bad_alloc();
+}
+
+inline ByteSequence::ByteSequence( sal_Int32 len, enum __ByteSequence_NoDefault )
+ : _pSequence( NULL )
+{
+ ::rtl_byte_sequence_constructNoDefault( &_pSequence, len );
+ if (_pSequence == NULL)
+ throw ::std::bad_alloc();
+}
+
+inline ByteSequence::ByteSequence( sal_Sequence *pSequence, enum __ByteSequence_NoAcquire )
+ : _pSequence( pSequence )
+{
+}
+
+inline ByteSequence::ByteSequence( sal_Int32 len )
+ : _pSequence( NULL )
+{
+ ::rtl_byte_sequence_construct( &_pSequence, len );
+ if (_pSequence == NULL)
+ throw ::std::bad_alloc();
+}
+
+inline ByteSequence::~ByteSequence()
+{
+ ::rtl_byte_sequence_release( _pSequence );
+}
+
+inline ByteSequence & ByteSequence::operator = ( const ByteSequence & rSeq )
+{
+ ::rtl_byte_sequence_assign( &_pSequence, rSeq._pSequence );
+ return *this;
+}
+
+#if defined LIBO_INTERNAL_ONLY
+inline ByteSequence & ByteSequence::operator = ( ByteSequence && rSeq ) noexcept
+{
+ ::rtl_byte_sequence_release(_pSequence);
+ _pSequence = rSeq._pSequence;
+ rSeq._pSequence = nullptr;
+ return *this;
+}
+#endif
+
+inline bool ByteSequence::operator == ( const ByteSequence & rSeq ) const
+{
+ return ::rtl_byte_sequence_equals( _pSequence, rSeq._pSequence );
+}
+
+inline sal_Int8 * ByteSequence::getArray()
+{
+ ::rtl_byte_sequence_reference2One( &_pSequence );
+ if (_pSequence == NULL)
+ throw ::std::bad_alloc();
+ return reinterpret_cast<sal_Int8 *>(_pSequence->elements);
+}
+
+inline void ByteSequence::realloc( sal_Int32 nSize )
+{
+ ::rtl_byte_sequence_realloc( &_pSequence, nSize );
+ if (_pSequence == NULL)
+ throw ::std::bad_alloc();
+}
+
+inline sal_Int8 & ByteSequence::operator [] ( sal_Int32 nIndex )
+{
+ return getArray()[ nIndex ];
+}
+
+inline bool ByteSequence::operator != ( const ByteSequence & rSeq ) const
+{
+ return (! operator == ( rSeq ));
+}
+
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/character.hxx b/include/rtl/character.hxx
new file mode 100644
index 000000000..580106353
--- /dev/null
+++ b/include/rtl/character.hxx
@@ -0,0 +1,526 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_CHARACTER_HXX
+#define INCLUDED_RTL_CHARACTER_HXX
+
+#include "sal/config.h"
+
+#include <cassert>
+#include <cstddef>
+
+#include "sal/types.h"
+
+#if defined LIBO_INTERNAL_ONLY
+#include <type_traits>
+#endif
+
+namespace rtl
+{
+/** Check for Unicode code point.
+
+ @param code An integer.
+
+ @return True if code is a Unicode code point.
+
+ @since LibreOffice 5.2
+*/
+inline SAL_CONSTEXPR bool isUnicodeCodePoint(sal_uInt32 code) { return code <= 0x10FFFF; }
+
+/** Check for ASCII character.
+
+ @param code A Unicode code point.
+
+ @return True if code is an ASCII character (0x00--0x7F).
+
+ @since LibreOffice 4.1
+ */
+inline SAL_CONSTEXPR bool isAscii(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return code <= 0x7F;
+}
+
+#if defined LIBO_INTERNAL_ONLY
+bool isAscii(char) = delete;
+bool isAscii(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32), bool>
+isAscii(T code)
+{
+ return isAscii(sal_uInt32(code));
+}
+#endif
+
+/** Check for ASCII lower case character.
+
+ @param code A Unicode code point.
+
+ @return True if code is an ASCII lower case alphabetic character (ASCII
+ 'a'--'z').
+
+ @since LibreOffice 4.1
+ */
+inline SAL_CONSTEXPR bool isAsciiLowerCase(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return code >= 'a' && code <= 'z';
+}
+
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiLowerCase(char) = delete;
+bool isAsciiLowerCase(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32), bool>
+isAsciiLowerCase(T code)
+{
+ return isAsciiLowerCase(sal_uInt32(code));
+}
+#endif
+
+/** Check for ASCII upper case character.
+
+ @param code A Unicode code point.
+
+ @return True if code is an ASCII upper case alphabetic character (ASCII
+ 'A'--'Z').
+
+ @since LibreOffice 4.1
+ */
+inline SAL_CONSTEXPR bool isAsciiUpperCase(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return code >= 'A' && code <= 'Z';
+}
+
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiUpperCase(char) = delete;
+bool isAsciiUpperCase(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32), bool>
+isAsciiUpperCase(T code)
+{
+ return isAsciiUpperCase(sal_uInt32(code));
+}
+#endif
+
+/** Check for ASCII alphabetic character.
+
+ @param code A Unicode code point.
+
+ @return True if code is an ASCII alphabetic character (ASCII 'A'--'Z' or
+ 'a'--'z').
+
+ @since LibreOffice 4.1
+ */
+inline SAL_CONSTEXPR bool isAsciiAlpha(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return isAsciiLowerCase(code) || isAsciiUpperCase(code);
+}
+
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiAlpha(char) = delete;
+bool isAsciiAlpha(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32), bool>
+isAsciiAlpha(T code)
+{
+ return isAsciiAlpha(sal_uInt32(code));
+}
+#endif
+
+/** Check for ASCII digit character.
+
+ @param code A Unicode code point.
+
+ @return True if code is an ASCII (decimal) digit character (ASCII
+ '0'--'9').
+
+ @since LibreOffice 4.1
+ */
+inline SAL_CONSTEXPR bool isAsciiDigit(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return code >= '0' && code <= '9';
+}
+
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiDigit(char) = delete;
+bool isAsciiDigit(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32), bool>
+isAsciiDigit(T code)
+{
+ return isAsciiDigit(sal_uInt32(code));
+}
+#endif
+
+/** Check for ASCII alphanumeric character.
+
+ @param code A Unicode code point.
+
+ @return True if code is an ASCII alphanumeric character (ASCII '0'--'9',
+ 'A'--'Z', or 'a'--'z').
+
+ @since LibreOffice 4.1
+ */
+inline SAL_CONSTEXPR bool isAsciiAlphanumeric(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return isAsciiDigit(code) || isAsciiAlpha(code);
+}
+
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiAlphanumeric(char) = delete;
+bool isAsciiAlphanumeric(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32), bool>
+isAsciiAlphanumeric(T code)
+{
+ return isAsciiAlphanumeric(sal_uInt32(code));
+}
+#endif
+
+/** Check for ASCII canonic hexadecimal digit character.
+
+ @param code A Unicode code point.
+
+ @return True if code is an ASCII canonic (i.e., upper case) hexadecimal
+ digit character (ASCII '0'--'9' or 'A'--'F').
+
+ @since LibreOffice 4.1
+ */
+inline SAL_CONSTEXPR bool isAsciiCanonicHexDigit(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return isAsciiDigit(code) || (code >= 'A' && code <= 'F');
+}
+
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiCanonicHexDigit(char) = delete;
+bool isAsciiCanonicHexDigit(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32), bool>
+isAsciiCanonicHexDigit(T code)
+{
+ return isAsciiCanonicHexDigit(sal_uInt32(code));
+}
+#endif
+
+/** Check for ASCII hexadecimal digit character.
+
+ @param code A Unicode code point.
+
+ @return True if code is an ASCII hexadecimal digit character (ASCII
+ '0'--'9', 'A'--'F', or 'a'--'f').
+
+ @since LibreOffice 4.1
+ */
+inline SAL_CONSTEXPR bool isAsciiHexDigit(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return isAsciiCanonicHexDigit(code) || (code >= 'a' && code <= 'f');
+}
+
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiHexDigit(char) = delete;
+bool isAsciiHexDigit(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32), bool>
+isAsciiHexDigit(T code)
+{
+ return isAsciiHexDigit(sal_uInt32(code));
+}
+#endif
+
+/** Check for ASCII octal digit character.
+
+ @param code A Unicode code point.
+
+ @return True if code is an ASCII octal digit character (ASCII '0'--'7').
+
+ @since LibreOffice 5.0
+ */
+inline SAL_CONSTEXPR bool isAsciiOctalDigit(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return code >= '0' && code <= '7';
+}
+
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiOctalDigit(char) = delete;
+bool isAsciiOctalDigit(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32), bool>
+isAsciiOctalDigit(T code)
+{
+ return isAsciiOctalDigit(sal_uInt32(code));
+}
+#endif
+
+/** Check for ASCII white space character.
+
+ @param code A Unicode code point.
+
+ @return True if code is an ASCII white space character as defined by C for
+ isspace in the "C" locale (ASCII ' ', '\\f', '\\n', '\\r', '\\t' '\\v').
+
+ @since LibreOffice 5.4
+*/
+inline SAL_CONSTEXPR bool isAsciiWhiteSpace(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return code == ' ' || code == '\f' || code == '\n' || code == '\r' || code == '\t'
+ || code == '\v';
+}
+
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiWhiteSpace(char) = delete;
+bool isAsciiWhiteSpace(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32), bool>
+isAsciiWhiteSpace(T code)
+{
+ return isAsciiWhiteSpace(sal_uInt32(code));
+}
+#endif
+
+/** Convert a character, if ASCII, to upper case.
+
+ @param code A Unicode code point.
+
+ @return code converted to ASCII upper case.
+
+ @since LibreOffice 4.2
+*/
+inline SAL_CONSTEXPR sal_uInt32 toAsciiUpperCase(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return isAsciiLowerCase(code) ? code - 32 : code;
+}
+
+#if defined LIBO_INTERNAL_ONLY
+sal_uInt32 toAsciiUpperCase(char) = delete;
+sal_uInt32 toAsciiUpperCase(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32),
+ sal_uInt32>
+toAsciiUpperCase(T code)
+{
+ return toAsciiUpperCase(sal_uInt32(code));
+}
+#endif
+
+/** Convert a character, if ASCII, to lower case.
+
+ @param code A Unicode code point.
+
+ @return code converted to ASCII lower case.
+
+ @since LibreOffice 4.2
+*/
+inline SAL_CONSTEXPR sal_uInt32 toAsciiLowerCase(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return isAsciiUpperCase(code) ? code + 32 : code;
+}
+
+#if defined LIBO_INTERNAL_ONLY
+sal_uInt32 toAsciiLowerCase(char) = delete;
+sal_uInt32 toAsciiLowerCase(signed char) = delete;
+template <typename T>
+inline constexpr std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= sizeof(sal_uInt32),
+ sal_uInt32>
+toAsciiLowerCase(T code)
+{
+ return toAsciiLowerCase(sal_uInt32(code));
+}
+#endif
+
+/** Compare two characters ignoring ASCII case.
+
+ @param code1 A Unicode code point.
+
+ @param code2 A unicode code point.
+
+ @return 0 if both code points are equal,
+ < 0 if code1 is less than code2,
+ > 0 if code1 is greater than code2.
+
+ @since LibreOffice 4.2
+ */
+inline SAL_CONSTEXPR sal_Int32 compareIgnoreAsciiCase(sal_uInt32 code1, sal_uInt32 code2)
+{
+ assert(isUnicodeCodePoint(code1));
+ assert(isUnicodeCodePoint(code2));
+ return static_cast<sal_Int32>(toAsciiLowerCase(code1))
+ - static_cast<sal_Int32>(toAsciiLowerCase(code2));
+}
+
+/// @cond INTERNAL
+namespace detail
+{
+sal_uInt32 const surrogatesHighFirst = 0xD800;
+sal_uInt32 const surrogatesHighLast = 0xDBFF;
+sal_uInt32 const surrogatesLowFirst = 0xDC00;
+sal_uInt32 const surrogatesLowLast = 0xDFFF;
+}
+/// @endcond
+
+/** Check for surrogate.
+
+ @param code A Unicode code point.
+
+ @return True if code is a surrogate code point (0xD800--0xDFFF).
+
+ @since LibreOffice 6.0
+*/
+inline SAL_CONSTEXPR bool isSurrogate(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return code >= detail::surrogatesHighFirst && code <= detail::surrogatesLowLast;
+}
+
+/** Check for high surrogate.
+
+ @param code A Unicode code point.
+
+ @return True if code is a high surrogate code point (0xD800--0xDBFF).
+
+ @since LibreOffice 5.0
+*/
+inline SAL_CONSTEXPR bool isHighSurrogate(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return code >= detail::surrogatesHighFirst && code <= detail::surrogatesHighLast;
+}
+
+/** Check for low surrogate.
+
+ @param code A Unicode code point.
+
+ @return True if code is a low surrogate code point (0xDC00--0xDFFF).
+
+ @since LibreOffice 5.0
+*/
+inline SAL_CONSTEXPR bool isLowSurrogate(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ return code >= detail::surrogatesLowFirst && code <= detail::surrogatesLowLast;
+}
+
+/** Get high surrogate half of a non-BMP Unicode code point.
+
+ @param code A non-BMP Unicode code point.
+
+ @return The UTF-16 high surrogate half for the give code point.
+
+ @since LibreOffice 5.0
+ */
+inline SAL_CONSTEXPR sal_Unicode getHighSurrogate(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ assert(code >= 0x10000);
+ return static_cast<sal_Unicode>(((code - 0x10000) >> 10) | detail::surrogatesHighFirst);
+}
+
+/** Get low surrogate half of a non-BMP Unicode code point.
+
+ @param code A non-BMP Unicode code point.
+
+ @return The UTF-16 low surrogate half for the give code point.
+
+ @since LibreOffice 5.0
+ */
+inline SAL_CONSTEXPR sal_Unicode getLowSurrogate(sal_uInt32 code)
+{
+ assert(isUnicodeCodePoint(code));
+ assert(code >= 0x10000);
+ return static_cast<sal_Unicode>(((code - 0x10000) & 0x3FF) | detail::surrogatesLowFirst);
+}
+
+/** Combine surrogates to form a code point.
+
+ @param high A high surrogate code point.
+
+ @param low A low surrogate code point.
+
+ @return The code point represented by the surrogate pair.
+
+ @since LibreOffice 5.0
+*/
+inline SAL_CONSTEXPR sal_uInt32 combineSurrogates(sal_uInt32 high, sal_uInt32 low)
+{
+ assert(isHighSurrogate(high));
+ assert(isLowSurrogate(low));
+ return ((high - detail::surrogatesHighFirst) << 10) + (low - detail::surrogatesLowFirst)
+ + 0x10000;
+}
+
+/** Split a Unicode code point into UTF-16 code units.
+
+ @param code A Unicode code point.
+
+ @param output A non-null pointer to an array with space for at least two
+ sal_Unicode UTF-16 code units.
+
+ @return The number of UTF-16 code units placed into the output (either one
+ or two).
+
+ @since LibreOffice 5.3
+*/
+inline SAL_CONSTEXPR std::size_t splitSurrogates(sal_uInt32 code, sal_Unicode* output)
+{
+ assert(isUnicodeCodePoint(code));
+ assert(output != NULL);
+ if (code < 0x10000)
+ {
+ output[0] = code;
+ return 1;
+ }
+ else
+ {
+ output[0] = getHighSurrogate(code);
+ output[1] = getLowSurrogate(code);
+ return 2;
+ }
+}
+
+/** Check for Unicode scalar value.
+
+ @param code An integer.
+
+ @return True if code is a Unicode scalar value.
+
+ @since LibreOffice 6.0
+*/
+inline SAL_CONSTEXPR bool isUnicodeScalarValue(sal_uInt32 code)
+{
+ return isUnicodeCodePoint(code) && !isSurrogate(code);
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/cipher.h b/include/rtl/cipher.h
new file mode 100644
index 000000000..ed718166c
--- /dev/null
+++ b/include/rtl/cipher.h
@@ -0,0 +1,282 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_CIPHER_H
+#define INCLUDED_RTL_CIPHER_H
+
+#include "sal/config.h"
+
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Cipher Handle opaque type.
+ */
+typedef void* rtlCipher;
+
+/** Cipher Algorithm enumeration.
+ @see rtl_cipher_create()
+ */
+enum __rtl_CipherAlgorithm
+{
+ rtl_Cipher_AlgorithmBF,
+ rtl_Cipher_AlgorithmARCFOUR,
+ rtl_Cipher_AlgorithmInvalid,
+ rtl_Cipher_Algorithm_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+/** Cipher Algorithm type.
+ */
+typedef enum __rtl_CipherAlgorithm rtlCipherAlgorithm;
+
+/** Cipher Mode enumeration.
+ @see rtl_cipher_create()
+ */
+enum __rtl_CipherMode
+{
+ rtl_Cipher_ModeECB,
+ rtl_Cipher_ModeCBC,
+ rtl_Cipher_ModeStream,
+ rtl_Cipher_ModeInvalid,
+ rtl_Cipher_Mode_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+/** Cipher Mode type.
+ */
+typedef enum __rtl_CipherMode rtlCipherMode;
+
+/** Cipher Direction enumeration.
+ @see rtl_cipher_init()
+ */
+enum __rtl_CipherDirection
+{
+ rtl_Cipher_DirectionBoth,
+ rtl_Cipher_DirectionDecode,
+ rtl_Cipher_DirectionEncode,
+ rtl_Cipher_DirectionInvalid,
+ rtl_Cipher_Direction_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+/** Cipher Direction type.
+ */
+typedef enum __rtl_CipherDirection rtlCipherDirection;
+
+
+/** Error Code enumeration.
+ */
+enum __rtl_CipherError
+{
+ rtl_Cipher_E_None,
+ rtl_Cipher_E_Argument,
+ rtl_Cipher_E_Algorithm,
+ rtl_Cipher_E_Direction,
+ rtl_Cipher_E_Mode,
+ rtl_Cipher_E_BufferSize,
+ rtl_Cipher_E_Memory,
+ rtl_Cipher_E_Unknown,
+ rtl_Cipher_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+/** Error Code type.
+ */
+typedef enum __rtl_CipherError rtlCipherError;
+
+
+/** Create a cipher handle for the given algorithm and mode.
+ @see rtlCipherAlgorithm
+ @see rtlCipherMode
+
+ @param[in] Algorithm cipher algorithm.
+ @param[in] Mode cipher mode.
+ @return Cipher handle, or 0 upon failure.
+ */
+SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_create (
+ rtlCipherAlgorithm Algorithm,
+ rtlCipherMode Mode
+) SAL_THROW_EXTERN_C();
+
+/** Inititialize a cipher for the given direction.
+ @see rtlCipherDirection
+
+ @param[in] Cipher cipher handle.
+ @param[in] Direction cipher direction.
+ @param[in] pKeyData key material buffer.
+ @param[in] nKeyLen key material length in bytes.
+ @param[in] pArgData initialization vector buffer.
+ @param[in] nArgLen initialization vector length in bytes.
+ @retval rtl_Cipher_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_init (
+ rtlCipher Cipher,
+ rtlCipherDirection Direction,
+ const sal_uInt8 *pKeyData, sal_Size nKeyLen,
+ const sal_uInt8 *pArgData, sal_Size nArgLen
+) SAL_THROW_EXTERN_C();
+
+/** Encode a buffer under a given cipher algorithm.
+ @pre Initialized for a compatible cipher direction.
+ @see rtl_cipher_init()
+
+ @param[in] Cipher cipher handle.
+ @param[in] pData plaintext buffer.
+ @param[in] nDatLen plaintext length in bytes.
+ @param[out] pBuffer ciphertext buffer.
+ @param[in] nBufLen ciphertext length in bytes.
+ @retval rtl_Cipher_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encode (
+ rtlCipher Cipher,
+ const void *pData, sal_Size nDatLen,
+ sal_uInt8 *pBuffer, sal_Size nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Decode a buffer under a given cipher algorithm.
+ @pre Initialized for a compatible cipher direction.
+ @see rtl_cipher_init()
+
+ @param[in] Cipher cipher handle.
+ @param[in] pData ciphertext buffer.
+ @param[in] nDatLen ciphertext length in bytes.
+ @param[out] pBuffer plaintext buffer.
+ @param[in] nBufLen plaintext length in bytes.
+ @retval rtl_Cipher_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decode (
+ rtlCipher Cipher,
+ const void *pData, sal_Size nDatLen,
+ sal_uInt8 *pBuffer, sal_Size nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Destroy a cipher handle.
+ @param[in] Cipher cipher handle to be destroyed.
+ @return None. Cipher handle destroyed and invalid.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroy (
+ rtlCipher Cipher
+) SAL_THROW_EXTERN_C();
+
+/** Create a Blowfish cipher handle for the given mode.
+
+ The Blowfish block cipher algorithm is specified in
+ Bruce Schneier: Applied Cryptography, 2nd edition, ch. 14.3
+
+ @see rtl_cipher_create()
+ */
+SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_createBF (
+ rtlCipherMode Mode
+) SAL_THROW_EXTERN_C();
+
+/** Inititialize a Blowfish cipher for the given direction.
+ @see rtl_cipher_init()
+ */
+SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_initBF (
+ rtlCipher Cipher,
+ rtlCipherDirection Direction,
+ const sal_uInt8 *pKeyData, sal_Size nKeyLen,
+ const sal_uInt8 *pArgData, sal_Size nArgLen
+) SAL_THROW_EXTERN_C();
+
+/** Encode a buffer under the Blowfish cipher algorithm.
+ @see rtl_cipher_encode()
+ */
+SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encodeBF (
+ rtlCipher Cipher,
+ const void *pData, sal_Size nDatLen,
+ sal_uInt8 *pBuffer, sal_Size nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Decode a buffer under the Blowfish cipher algorithm.
+ @see rtl_cipher_decode()
+ */
+SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decodeBF (
+ rtlCipher Cipher,
+ const void *pData, sal_Size nDatLen,
+ sal_uInt8 *pBuffer, sal_Size nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Destroy a Blowfish cipher handle.
+ @see rtl_cipher_destroy()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroyBF (
+ rtlCipher Cipher
+) SAL_THROW_EXTERN_C();
+
+/** Create a RC4 cipher handle for the given mode.
+
+ The RC4 symmetric stream cipher algorithm is specified in
+ Bruce Schneier: Applied Cryptography, 2nd edition, ch. 17.1
+
+ @see rtl_cipher_create()
+
+ @param[in] Mode cipher mode. Must be <code>rtl_Cipher_ModeStream</code>.
+ @return Cipher handle, or 0 upon failure.
+ */
+SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_createARCFOUR (
+ rtlCipherMode Mode
+) SAL_THROW_EXTERN_C();
+
+/** Inititialize a RC4 cipher for the given direction.
+ @see rtl_cipher_init()
+ */
+SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_initARCFOUR (
+ rtlCipher Cipher,
+ rtlCipherDirection Direction,
+ const sal_uInt8 *pKeyData, sal_Size nKeyLen,
+ const sal_uInt8 *pArgData, sal_Size nArgLen
+) SAL_THROW_EXTERN_C();
+
+/** Encode a buffer under the RC4 cipher algorithm.
+ @see rtl_cipher_encode()
+ */
+SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encodeARCFOUR (
+ rtlCipher Cipher,
+ const void *pData, sal_Size nDatLen,
+ sal_uInt8 *pBuffer, sal_Size nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Decode a buffer under the RC4 cipher algorithm.
+ @see rtl_cipher_decode()
+ */
+SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR (
+ rtlCipher Cipher,
+ const void *pData, sal_Size nDatLen,
+ sal_uInt8 *pBuffer, sal_Size nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Destroy a RC4 cipher handle.
+ @see rtl_cipher_destroy()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroyARCFOUR (
+ rtlCipher Cipher
+) SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! INCLUDED_RTL_CIPHER_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/crc.h b/include/rtl/crc.h
new file mode 100644
index 000000000..d081140f5
--- /dev/null
+++ b/include/rtl/crc.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_CRC_H
+#define INCLUDED_RTL_CRC_H
+
+#include "sal/config.h"
+
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Evaluate CRC32 over given data.
+
+ This function evaluates the CRC polynomial 0xEDB88320.
+
+ @param[in] Crc CRC32 over previous data or zero.
+ @param[in] Data data buffer.
+ @param[in] DatLen data buffer length.
+ @return new CRC32 value.
+ */
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL rtl_crc32 (
+ sal_uInt32 Crc,
+ const void *Data, sal_uInt32 DatLen
+) SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_RTL_CRC_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/digest.h b/include/rtl/digest.h
new file mode 100644
index 000000000..bb2d4f8f0
--- /dev/null
+++ b/include/rtl/digest.h
@@ -0,0 +1,644 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_DIGEST_H
+#define INCLUDED_RTL_DIGEST_H
+
+#include "sal/config.h"
+
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Digest Handle opaque type.
+ */
+typedef void* rtlDigest;
+
+
+/** Digest Algorithm enumeration.
+ @see rtl_digest_create()
+ */
+enum __rtl_DigestAlgorithm
+{
+ rtl_Digest_AlgorithmMD2,
+ rtl_Digest_AlgorithmMD5,
+ rtl_Digest_AlgorithmSHA,
+ rtl_Digest_AlgorithmSHA1,
+
+ rtl_Digest_AlgorithmHMAC_MD5,
+ rtl_Digest_AlgorithmHMAC_SHA1,
+
+ rtl_Digest_AlgorithmInvalid,
+ rtl_Digest_Algorithm_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+/** Digest Algorithm type.
+ */
+typedef enum __rtl_DigestAlgorithm rtlDigestAlgorithm;
+
+
+/** Error Code enumeration.
+ */
+enum __rtl_DigestError
+{
+ rtl_Digest_E_None,
+ rtl_Digest_E_Argument,
+ rtl_Digest_E_Algorithm,
+ rtl_Digest_E_BufferSize,
+ rtl_Digest_E_Memory,
+ rtl_Digest_E_Unknown,
+ rtl_Digest_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+/** Error Code type.
+ */
+typedef enum __rtl_DigestError rtlDigestError;
+
+
+/** Create a digest handle for the given algorithm.
+ @see rtlDigestAlgorithm
+
+ @param[in] Algorithm digest algorithm.
+ @return Digest handle, or 0 upon failure.
+ */
+SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_create (
+ rtlDigestAlgorithm Algorithm
+) SAL_THROW_EXTERN_C();
+
+
+/** Destroy a digest handle.
+ @post Digest handle destroyed and invalid.
+ @param[in] Digest digest handle to be destroyed.
+ @return None.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroy (
+ rtlDigest Digest
+) SAL_THROW_EXTERN_C();
+
+
+/** Query the algorithm of a given digest.
+ @param[in] Digest digest handle.
+ @return digest algorithm, or <code>rtl_Digest_AlgorithmInvalid</code> upon failure.
+ */
+SAL_DLLPUBLIC rtlDigestAlgorithm SAL_CALL rtl_digest_queryAlgorithm (
+ rtlDigest Digest
+) SAL_THROW_EXTERN_C();
+
+
+/** Query the length of a given digest.
+ @param[in] Digest digest handle.
+ @return digest length, or 0 upon failure.
+ */
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL rtl_digest_queryLength (
+ rtlDigest Digest
+) SAL_THROW_EXTERN_C();
+
+
+/** Initialize a digest with given data.
+ @param[in] Digest digest handle.
+ @param[in] pData data buffer.
+ @param[in] nDatLen data length.
+
+ @retval rtl_Digest_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_init (
+ rtlDigest Digest,
+ const sal_uInt8 *pData, sal_uInt32 nDatLen
+) SAL_THROW_EXTERN_C();
+
+
+/** Update a digest with given data.
+ @param[in] Digest digest handle.
+ @param[in] pData data buffer.
+ @param[in] nDatLen data length.
+
+ @retval rtl_Digest_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_update (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen
+) SAL_THROW_EXTERN_C();
+
+
+/** Finalize a digest and retrieve the digest value.
+ @pre Digest value length must not be less than digest length.
+ @post Digest initialized to accept another update sequence.
+ @see rtl_digest_queryLength()
+ @see rtl_digest_update()
+
+ @param[in] Digest digest handle.
+ @param[in] pBuffer digest value buffer.
+ @param[in] nBufLen digest value length.
+
+ @retval rtl_Digest_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_get (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+#define RTL_DIGEST_LENGTH_MD2 16
+
+/** Create a MD2 digest handle.
+
+ The MD2 digest algorithm is specified in
+ RFC 1319 (Informational)
+ The MD2 Message-Digest Algorithm
+
+ @see rtl_digest_create()
+ */
+SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createMD2 (void) SAL_THROW_EXTERN_C();
+
+
+/** Destroy a MD2 digest handle.
+ @see rtl_digest_destroy()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroyMD2 (
+ rtlDigest Digest
+) SAL_THROW_EXTERN_C();
+
+/** Update a MD2 digest with given data.
+ @see rtl_digest_update()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateMD2 (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen
+) SAL_THROW_EXTERN_C();
+
+/** Finalize a MD2 digest and retrieve the digest value.
+ @see rtl_digest_get()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getMD2 (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Evaluate a MD2 digest value from given data.
+
+ This function performs an optimized call sequence on a
+ single data buffer, avoiding digest creation and destruction.
+
+ @see rtl_digest_updateMD2()
+ @see rtl_digest_getMD2()
+
+ @param[in] pData data buffer.
+ @param[in] nDatLen data length.
+ @param[in] pBuffer digest value buffer.
+ @param[in] nBufLen digest value length.
+
+ @retval rtl_Digest_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_MD2 (
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+#define RTL_DIGEST_LENGTH_MD5 16
+
+/** Create a MD5 digest handle.
+
+ The MD5 digest algorithm is specified in
+ RFC 1321 (Informational)
+ The MD5 Message-Digest Algorithm
+
+ @see rtl_digest_create()
+ */
+SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createMD5 (void) SAL_THROW_EXTERN_C();
+
+/** Destroy a MD5 digest handle.
+ @see rtl_digest_destroy()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroyMD5 (
+ rtlDigest Digest
+) SAL_THROW_EXTERN_C();
+
+/** Update a MD5 digest with given data.
+ @see rtl_digest_update()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateMD5 (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen
+) SAL_THROW_EXTERN_C();
+
+/** Finalize a MD5 digest and retrieve the digest value.
+ @see rtl_digest_get()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getMD5 (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Retrieve the raw (not finalized) MD5 digest value.
+
+ This function is a non-standard replacement for
+ rtl_digest_getMD5() and must be used with caution.
+
+ @post Digest initialized to accept another update sequence.
+ @see rtl_digest_get()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_rawMD5 (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Evaluate a MD5 digest value from given data.
+
+ This function performs an optimized call sequence on a
+ single data buffer, avoiding digest creation and destruction.
+
+ @see rtl_digest_updateMD5()
+ @see rtl_digest_getMD5()
+
+ @param[in] pData data buffer.
+ @param[in] nDatLen data length.
+ @param[in] pBuffer digest value buffer.
+ @param[in] nBufLen digest value length.
+
+ @retval rtl_Digest_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_MD5 (
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+#define RTL_DIGEST_LENGTH_SHA 20
+
+/** Create a SHA digest handle.
+
+ The SHA digest algorithm is specified in
+ FIPS PUB 180 (Superseded by FIPS PUB 180-1)
+ Secure Hash Standard
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_create()
+ */
+SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createSHA (void) SAL_THROW_EXTERN_C();
+
+/** Destroy a SHA digest handle.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_destroy()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroySHA (
+ rtlDigest Digest
+) SAL_THROW_EXTERN_C();
+
+
+/** Update a SHA digest with given data.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_update()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateSHA (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen
+) SAL_THROW_EXTERN_C();
+
+/** Finalize a SHA digest and retrieve the digest value.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_get()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getSHA (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Evaluate a SHA digest value from given data.
+
+ This function performs an optimized call sequence on a
+ single data buffer, avoiding digest creation and destruction.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_updateSHA()
+ @see rtl_digest_getSHA()
+
+ @param[in] pData data buffer.
+ @param[in] nDatLen data length.
+ @param[in] pBuffer digest value buffer.
+ @param[in] nBufLen digest value length.
+
+ @retval rtl_Digest_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_SHA (
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+/*========================================================================
+ *
+ * rtl_digest_SHA1 interface.
+ *
+ *======================================================================*/
+#define RTL_DIGEST_LENGTH_SHA1 20
+
+/** Create a SHA1 digest handle.
+
+ The SHA1 digest algorithm is specified in
+ FIPS PUB 180-1 (Supersedes FIPS PUB 180)
+ Secure Hash Standard
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_create()
+ */
+SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createSHA1 (void) SAL_THROW_EXTERN_C();
+
+/** Destroy a SHA1 digest handle.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_destroy()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroySHA1 (
+ rtlDigest Digest
+) SAL_THROW_EXTERN_C();
+
+/** Update a SHA1 digest with given data.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_update()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateSHA1 (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen
+) SAL_THROW_EXTERN_C();
+
+/** Finalize a SHA1 digest and retrieve the digest value.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_get()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getSHA1 (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Evaluate a SHA1 digest value from given data.
+
+ This function performs an optimized call sequence on a
+ single data buffer, avoiding digest creation and destruction.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_updateSHA1()
+ @see rtl_digest_getSHA1()
+
+ @param[in] pData data buffer.
+ @param[in] nDatLen data length.
+ @param[in] pBuffer digest value buffer.
+ @param[in] nBufLen digest value length.
+
+ @retval rtl_Digest_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_SHA1 (
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+#define RTL_DIGEST_LENGTH_HMAC_MD5 RTL_DIGEST_LENGTH_MD5
+
+/** Create a HMAC_MD5 digest handle.
+
+ The HMAC_MD5 digest algorithm is specified in
+
+ RFC 2104 (Informational)
+ HMAC: Keyed-Hashing for Message Authentication
+
+ @see rtl_digest_create()
+ */
+SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createHMAC_MD5 (void) SAL_THROW_EXTERN_C();
+
+/** Destroy a HMAC_MD5 digest handle.
+ @see rtl_digest_destroy()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroyHMAC_MD5 (
+ rtlDigest Digest
+) SAL_THROW_EXTERN_C();
+
+/** Initialize a HMAC_MD5 digest.
+ @see rtl_digest_init()
+
+ @param[in] Digest digest handle.
+ @param[in] pKeyData key material buffer.
+ @param[in] nKeyLen key material length.
+
+ @retval rtl_Digest_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_initHMAC_MD5 (
+ rtlDigest Digest,
+ const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen
+) SAL_THROW_EXTERN_C();
+
+/** Update a HMAC_MD5 digest with given data.
+ @see rtl_digest_update()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateHMAC_MD5 (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen
+) SAL_THROW_EXTERN_C();
+
+/** Finalize a HMAC_MD5 digest and retrieve the digest value.
+ @see rtl_digest_get()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getHMAC_MD5 (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Evaluate a HMAC_MD5 digest value from given data.
+
+ This function performs an optimized call sequence on a
+ single data buffer, avoiding digest creation and destruction.
+
+ @see rtl_digest_initHMAC_MD5()
+ @see rtl_digest_updateHMAC_MD5()
+ @see rtl_digest_getHMAC_MD5()
+
+ @param[in] pKeyData key material buffer.
+ @param[in] nKeyLen key material length.
+ @param[in] pData data buffer.
+ @param[in] nDatLen data length.
+ @param[in] pBuffer digest value buffer.
+ @param[in] nBufLen digest value length.
+
+ @retval rtl_Digest_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_HMAC_MD5 (
+ const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen,
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+#define RTL_DIGEST_LENGTH_HMAC_SHA1 RTL_DIGEST_LENGTH_SHA1
+
+/** Create a HMAC_SHA1 digest handle.
+
+ The HMAC_SHA1 digest algorithm is specified in
+ RFC 2104 (Informational)
+ HMAC: Keyed-Hashing for Message Authentication
+ RFC 2898 (Informational)
+ PKCS #5: Password-Based Cryptography Specification Version 2.0
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_create()
+ */
+SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createHMAC_SHA1 (void) SAL_THROW_EXTERN_C();
+
+/** Destroy a HMAC_SHA1 digest handle.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_destroy()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroyHMAC_SHA1 (
+ rtlDigest Digest
+) SAL_THROW_EXTERN_C();
+
+/** Initialize a HMAC_SHA1 digest.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_init()
+
+ @param[in] Digest digest handle.
+ @param[in] pKeyData key material buffer.
+ @param[in] nKeyLen key material length.
+
+ @retval rtl_Digest_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_initHMAC_SHA1 (
+ rtlDigest Digest,
+ const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen
+) SAL_THROW_EXTERN_C();
+
+/** Update a HMAC_SHA1 digest with given data.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_update()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateHMAC_SHA1 (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen
+) SAL_THROW_EXTERN_C();
+
+/** Finalize a HMAC_SHA1 digest and retrieve the digest value.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_get()
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getHMAC_SHA1 (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Evaluate a HMAC_SHA1 digest value from given data.
+
+ This function performs an optimized call sequence on a
+ single data buffer, avoiding digest creation and destruction.
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility.
+
+ @see rtl_digest_initHMAC_SHA1()
+ @see rtl_digest_updateHMAC_SHA1()
+ @see rtl_digest_getHMAC_SHA1()
+
+ @param[in] pKeyData key material buffer.
+ @param[in] nKeyLen key material length.
+ @param[in] pData data buffer.
+ @param[in] nDatLen data length.
+ @param[in] pBuffer digest value buffer.
+ @param[in] nBufLen digest value length.
+
+ @retval rtl_Digest_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_HMAC_SHA1 (
+ const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen,
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen
+) SAL_THROW_EXTERN_C();
+
+/** Password-Based Key Derivation Function.
+
+ The PBKDF2 key derivation function is specified in
+ RFC 2898 (Informational)
+ PKCS #5: Password-Based Cryptography Specification Version 2.0
+
+ @deprecated The implementation is buggy and generates incorrect results
+ for 52 <= (len % 64) <= 55; use only for bug-compatibility
+ or if the input is guaranteed to have a good length
+ by a start-key derivation round.
+
+ @param[out] pKeyData derived key
+ @param[in] nKeyLen derived key length
+ @param[in] pPassData password
+ @param[in] nPassLen password length
+ @param[in] pSaltData salt
+ @param[in] nSaltLen salt length
+ @param[in] nCount iteration count
+
+ @retval rtl_Digest_E_None upon success.
+*/
+SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_PBKDF2 (
+ sal_uInt8 *pKeyData , sal_uInt32 nKeyLen,
+ const sal_uInt8 *pPassData, sal_uInt32 nPassLen,
+ const sal_uInt8 *pSaltData, sal_uInt32 nSaltLen,
+ sal_uInt32 nCount
+) SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_RTL_DIGEST_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/instance.hxx b/include/rtl/instance.hxx
new file mode 100644
index 000000000..0d7d8f3fc
--- /dev/null
+++ b/include/rtl/instance.hxx
@@ -0,0 +1,643 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_INSTANCE_HXX
+#define INCLUDED_RTL_INSTANCE_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "osl/doublecheckedlocking.h"
+#include "osl/getglobalmutex.hxx"
+
+namespace {
+
+/** A non-broken version of the double-checked locking pattern.
+
+ See
+ <http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html>
+ for a description of double-checked locking, why it is broken, and how it
+ can be fixed. Always use this template instead of spelling out the
+ double-checked locking pattern explicitly, and only in those rare cases
+ where that is not possible and you have to spell it out explicitly, at
+ least call OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER() at the right
+ places. That way, all platform-dependent code to make double-checked
+ locking work can be kept in one place.
+
+ Usage scenarios:
+
+ 1 Static instance (most common case)
+
+ Pattern:
+
+ T * getInstance()
+ {
+ static T * pInstance = 0;
+ if (!pInstance)
+ {
+ ::osl::MutexGuard aGuard(::osl::Mutex::getGlobalMutex());
+ if (!pInstance)
+ {
+ static T aInstance;
+ pInstance = &aInstance;
+ }
+ }
+ return pInstance;
+ }
+
+ Code:
+
+ #include <rtl/instance.hxx>
+ #include <osl/getglobalmutex.hxx>
+
+ namespace {
+ struct Init
+ {
+ T * operator()()
+ {
+ static T aInstance;
+ return &aInstance;
+ }
+ };
+ }
+
+ T * getInstance()
+ {
+ return rtl_Instance< T, Init, ::osl::MutexGuard,
+ ::osl::GetGlobalMutex >::create(
+ Init(), ::osl::GetGlobalMutex());
+ }
+
+ 2 Dynamic instance
+
+ Pattern:
+
+ T * getInstance()
+ {
+ static T * pInstance = 0;
+ if (!pInstance)
+ {
+ ::osl::MutexGuard aGuard(::osl::Mutex::getGlobalMutex());
+ if (!pInstance)
+ pInstance = new T;
+ }
+ return pInstance;
+ }
+
+ Code:
+
+ #include <rtl/instance.hxx>
+ #include <osl/getglobalmutex.hxx>
+
+ namespace {
+ struct Init
+ {
+ T * operator()()
+ {
+ return new T;
+ }
+ };
+ }
+
+ T * getInstance()
+ {
+ return rtl_Instance< T, Init, ::osl::MutexGuard,
+ ::osl::GetGlobalMutex >::create(
+ Init(), ::osl::GetGlobalMutex());
+ }
+
+ 3 Other guard/mutex
+
+ Pattern:
+
+ T * getInstance()
+ {
+ static T * pInstance = 0;
+ if (!pInstance)
+ {
+ SomeGuard aGuard(pSomeMutex);
+ if (!pInstance)
+ {
+ static T aInstance;
+ pInstance = &aInstance;
+ }
+ }
+ return pInstance;
+ }
+
+ Code:
+
+ #include <rtl/instance.hxx>
+
+ namespace {
+ struct InitInstance
+ {
+ T * operator()()
+ {
+ static T aInstance;
+ return &aInstance;
+ }
+ };
+
+ struct InitGuard
+ {
+ SomeMutex * operator()()
+ {
+ return pSomeMutex;
+ }
+ };
+ }
+
+ T * getInstance()
+ {
+ return rtl_Instance< T, InitInstance,
+ SomeGuard, InitGuard >::create(
+ InitInstance(), InitMutex());
+ }
+
+ 4 Calculate extra data
+
+ Pattern:
+
+ T * getInstance()
+ {
+ static T * pInstance = 0;
+ if (!pInstance)
+ {
+ Data aData(...);
+ ::osl::MutexGuard aGuard(::osl::Mutex::getGlobalMutex());
+ if (!pInstance)
+ {
+ static T aInstance(aData);
+ pInstance = &aInstance;
+ }
+ }
+ return pInstance;
+ }
+
+ Code:
+
+ #include <rtl/instance.hxx>
+ #include <osl/getglobalmutex.hxx>
+
+ namespace {
+ struct InitInstance
+ {
+ T * operator()()
+ {
+ static T aInstance;
+ return &aInstance;
+ }
+ }
+
+ struct InitData
+ {
+ Data const & operator()()
+ {
+ return ...;
+ }
+ }
+ }
+
+ T * getInstance()
+ {
+ return rtl_Instance< T, InitInstance,
+ ::osl::MutexGuard, ::osl::GetGlobalMutex,
+ Data, InitData >::create(
+ InitInstance(), ::osl::GetGlobalMutex(), InitData());
+ }
+
+ Some comments:
+
+ For any instantiation of rtl_Instance, at most one call to a create method
+ may occur in the program code: Each occurrence of a create method within
+ the program code is supposed to return a fresh object instance on the
+ first call, and that same object instance on subsequent calls; but
+ independent occurrences of create methods are supposed to return
+ independent object instances. Since there is a one-to-one correspondence
+ between object instances and instantiations of rtl_Instance, the
+ requirement should be clear. One measure to enforce the requirement is
+ that rtl_Instance lives in an unnamed namespace, so that instantiations of
+ rtl_Instance in different translation units will definitely be different
+ instantiations. A drawback of that measure is that the name of the class
+ needs a funny "hand coded" prefix "rtl_" instead of a proper namespace
+ prefix like "::rtl::".
+
+ A known problem with this template is when two occurrences of calls to
+ create methods with identical template arguments appear in one translation
+ unit. Those two places will share a single object instance. This can be
+ avoided by using different Init structs (see the above code samples) in
+ the two places.
+
+ There is no need to make m_pInstance volatile, in order to avoid usage of
+ stale copies of m_pInstance: At the first check, a thread will see that
+ m_pInstance contains either 0 or a valid pointer. If it contains a valid
+ pointer, it cannot be stale, and that pointer is used. If it contains 0,
+ acquiring the mutex will ensure that the second check sees a non-stale
+ value in all cases.
+
+ On some compilers, the create methods would not be inlined if they
+ contained any static variables, so m_pInstance is made a class member
+ instead (and the create methods are inlined). But on MSC, the definition
+ of the class member m_pInstance would cause compilation to fail with an
+ internal compiler error. Since MSC is able to inline methods containing
+ static variables, m_pInstance is moved into the methods there. Note that
+ this only works well because for any instantiation of rtl_Instance at most
+ one call to a create method should be present, anyway.
+ */
+template< typename Inst, typename InstCtor,
+ typename Guard, typename GuardCtor,
+ typename Data = int, typename DataCtor = int >
+class rtl_Instance
+{
+public:
+ static Inst * create(InstCtor aInstCtor, GuardCtor aGuardCtor)
+ {
+#if defined _MSC_VER
+ static Inst * m_pInstance = NULL;
+#endif // _MSC_VER
+ Inst * p = m_pInstance;
+ if (!p)
+ {
+ Guard aGuard(aGuardCtor());
+ p = m_pInstance;
+ if (!p)
+ {
+ p = aInstCtor();
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ m_pInstance = p;
+ }
+ }
+ else
+ {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ }
+ return p;
+ }
+
+ static Inst * create(InstCtor aInstCtor, GuardCtor aGuardCtor,
+ DataCtor aDataCtor)
+ {
+#if defined _MSC_VER
+ static Inst * m_pInstance = NULL;
+#endif // _MSC_VER
+ Inst * p = m_pInstance;
+ if (!p)
+ {
+ Data aData(aDataCtor());
+ Guard aGuard(aGuardCtor());
+ p = m_pInstance;
+ if (!p)
+ {
+ p = aInstCtor(aData);
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ m_pInstance = p;
+ }
+ }
+ else
+ {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ }
+ return p;
+ }
+
+ static Inst * create(InstCtor aInstCtor, GuardCtor aGuardCtor,
+ const Data &rData)
+ {
+#if defined _MSC_VER
+ static Inst * m_pInstance = 0;
+#endif // _MSC_VER
+ Inst * p = m_pInstance;
+ if (!p)
+ {
+ Guard aGuard(aGuardCtor());
+ p = m_pInstance;
+ if (!p)
+ {
+ p = aInstCtor(rData);
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ m_pInstance = p;
+ }
+ }
+ else
+ {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ }
+ return p;
+ }
+
+private:
+#if !defined _MSC_VER
+ static Inst * m_pInstance;
+#endif // _MSC_VER
+};
+
+#if !defined _MSC_VER
+template< typename Inst, typename InstCtor,
+ typename Guard, typename GuardCtor,
+ typename Data, typename DataCtor >
+Inst *
+rtl_Instance< Inst, InstCtor, Guard, GuardCtor, Data, DataCtor >::m_pInstance
+= NULL;
+#endif // _MSC_VER
+
+}
+
+namespace rtl {
+
+/** Helper base class for a late-initialized (default-constructed)
+ static variable, implementing the double-checked locking pattern correctly.
+
+ @derive
+ Derive from this class (common practice), e.g.
+ <pre>
+ struct MyStatic : public rtl::Static<MyType, MyStatic> {};
+ ...
+ MyType & rStatic = MyStatic::get();
+ ...
+ </pre>
+
+ @tparam T
+ variable's type
+ @tparam Unique
+ Implementation trick to make the inner static holder unique,
+ using the outer class
+ (the one that derives from this base class)
+*/
+#if defined LIBO_INTERNAL_ONLY
+template<typename T, typename Unique>
+class Static {
+public:
+ /** Gets the static. Mutual exclusion is implied by a functional
+ -fthreadsafe-statics
+
+ @return
+ static variable
+ */
+ static T & get() {
+ static T instance;
+ return instance;
+ }
+};
+#else
+template<typename T, typename Unique>
+class Static {
+public:
+ /** Gets the static. Mutual exclusion is performed using the
+ osl global mutex.
+
+ @return
+ static variable
+ */
+ static T & get() {
+ return *rtl_Instance<
+ T, StaticInstance,
+ ::osl::MutexGuard, ::osl::GetGlobalMutex >::create(
+ StaticInstance(), ::osl::GetGlobalMutex() );
+ }
+private:
+ struct StaticInstance {
+ T * operator () () {
+ static T instance;
+ return &instance;
+ }
+ };
+};
+#endif
+
+/** Helper base class for a late-initialized (default-constructed)
+ static variable, implementing the double-checked locking pattern correctly.
+
+ @derive
+ Derive from this class (common practice), e.g.
+ <pre>
+ struct MyStatic : public rtl::Static<MyType, MyStatic> {};
+ ...
+ MyType & rStatic = MyStatic::get();
+ ...
+ </pre>
+
+ @tparam T
+ variable's type
+ @tparam Unique
+ Implementation trick to make the inner static holder unique,
+ using the outer class
+ (the one that derives from this base class)
+*/
+#if defined LIBO_INTERNAL_ONLY
+template<typename T, typename Data, typename Unique>
+class StaticWithArg {
+public:
+ /** Gets the static. Mutual exclusion is implied by a functional
+ -fthreadsafe-statics
+
+ @return
+ static variable
+ */
+ static T & get(const Data& rData) {
+ static T instance(rData);
+ return instance;
+ }
+
+ /** Gets the static. Mutual exclusion is implied by a functional
+ -fthreadsafe-statics
+
+ @return
+ static variable
+ */
+ static T & get(Data& rData) {
+ static T instance(rData);
+ return instance;
+ }
+};
+#else
+template<typename T, typename Data, typename Unique>
+class StaticWithArg {
+public:
+ /** Gets the static. Mutual exclusion is performed using the
+ osl global mutex.
+
+ @return
+ static variable
+ */
+ static T & get(const Data& rData) {
+ return *rtl_Instance<
+ T, StaticInstanceWithArg,
+ ::osl::MutexGuard, ::osl::GetGlobalMutex,
+ Data >::create( StaticInstanceWithArg(),
+ ::osl::GetGlobalMutex(),
+ rData );
+ }
+
+ /** Gets the static. Mutual exclusion is performed using the
+ osl global mutex.
+
+ @return
+ static variable
+ */
+ static T & get(Data& rData) {
+ return *rtl_Instance<
+ T, StaticInstanceWithArg,
+ ::osl::MutexGuard, ::osl::GetGlobalMutex,
+ Data >::create( StaticInstanceWithArg(),
+ ::osl::GetGlobalMutex(),
+ rData );
+ }
+private:
+ struct StaticInstanceWithArg {
+ T * operator () (const Data& rData) {
+ static T instance(rData);
+ return &instance;
+ }
+
+ T * operator () (Data& rData) {
+ static T instance(rData);
+ return &instance;
+ }
+ };
+};
+#endif
+
+/** Helper class for a late-initialized static aggregate, e.g. an array,
+ implementing the double-checked locking pattern correctly.
+
+ @tparam T
+ aggregate's element type
+ @tparam InitAggregate
+ initializer functor class
+*/
+#if defined LIBO_INTERNAL_ONLY
+template<typename T, typename InitAggregate>
+class StaticAggregate {
+public:
+ /** Gets the static aggregate, late-initializing.
+ Mutual exclusion is implied by a functional
+ -fthreadsafe-statics
+
+ @return
+ aggregate
+ */
+ static T * get() {
+ static T *instance = InitAggregate()();
+ return instance;
+ }
+};
+#else
+template<typename T, typename InitAggregate>
+class StaticAggregate {
+public:
+ /** Gets the static aggregate, late-initializing.
+ Mutual exclusion is performed using the osl global mutex.
+
+ @return
+ aggregate
+ */
+ static T * get() {
+ return rtl_Instance<
+ T, InitAggregate,
+ ::osl::MutexGuard, ::osl::GetGlobalMutex >::create(
+ InitAggregate(), ::osl::GetGlobalMutex() );
+ }
+};
+#endif
+/** Helper base class for a late-initialized static variable,
+ implementing the double-checked locking pattern correctly.
+
+ @derive
+ Derive from this class (common practice),
+ providing an initializer functor class, e.g.
+ <pre>
+ struct MyStatic : public rtl::StaticWithInit<MyType, MyStatic> {
+ MyType operator () () {
+ ...
+ return MyType( ... );
+ }
+ };
+ ...
+ MyType & rStatic = MyStatic::get();
+ ...
+ </pre>
+
+ @tparam T
+ variable's type
+ @tparam InitData
+ initializer functor class
+ @tparam Unique
+ Implementation trick to make the inner static holder unique,
+ using the outer class
+ (the one that derives from this base class).
+ Default is InitData (common practice).
+ @tparam Data
+ Initializer functor's return type.
+ Default is T (common practice).
+*/
+#if defined LIBO_INTERNAL_ONLY
+template<typename T, typename InitData,
+ typename Unique = InitData, typename Data = T>
+class StaticWithInit {
+public:
+ /** Gets the static. Mutual exclusion is implied by a functional
+ -fthreadsafe-statics
+
+ @return
+ static variable
+ */
+ static T & get() {
+ static T instance = InitData()();
+ return instance;
+ }
+};
+#else
+template<typename T, typename InitData,
+ typename Unique = InitData, typename Data = T>
+class StaticWithInit {
+public:
+ /** Gets the static. Mutual exclusion is performed using the
+ osl global mutex.
+
+ @return
+ static variable
+ */
+ static T & get() {
+ return *rtl_Instance<
+ T, StaticInstanceWithInit,
+ ::osl::MutexGuard, ::osl::GetGlobalMutex,
+ Data, InitData >::create( StaticInstanceWithInit(),
+ ::osl::GetGlobalMutex(),
+ InitData() );
+ }
+private:
+ struct StaticInstanceWithInit {
+ T * operator () ( Data d ) {
+ static T instance(d);
+ return &instance;
+ }
+ };
+};
+#endif
+} // namespace rtl
+
+#endif // INCLUDED_RTL_INSTANCE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/locale.h b/include/rtl/locale.h
new file mode 100644
index 000000000..141ff8768
--- /dev/null
+++ b/include/rtl/locale.h
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_LOCALE_H
+#define INCLUDED_RTL_LOCALE_H
+
+#include "sal/config.h"
+
+#include "rtl/ustring.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _WIN32
+# pragma pack(push, 8)
+#endif
+
+/**
+ The implementation structure of a locale. Do not create this structure
+ direct. Only use the functions rtl_locale_register and
+ rtl_locale_setDefault. The strings Language, Country and Variant
+ are constants, so it is not necessary to acquire and release them.
+ */
+typedef struct _rtl_Locale
+{
+ /**
+ Lowercase two-letter ISO 639-1 or three-letter ISO 639-3 code.
+ */
+ rtl_uString * Language;
+ /**
+ uppercase two-letter ISO-3166 code.
+ */
+ rtl_uString * Country;
+ /**
+ Lowercase vendor and browser specific code.
+ */
+ rtl_uString * Variant;
+ /**
+ The merged hash value of the Language, Country and Variant strings.
+ */
+ sal_Int32 HashCode;
+} rtl_Locale;
+
+#if defined( _WIN32)
+#pragma pack(pop)
+#endif
+
+/**
+ Register a locale from language, country and variant.
+ @param language lowercase two-letter ISO 639-1 or three-letter ISO 639-3 code.
+ @param country uppercase two-letter ISO-3166 code. May be null.
+ @param variant vendor and browser specific code. May be null.
+ */
+SAL_DLLPUBLIC rtl_Locale * SAL_CALL rtl_locale_register(
+ const sal_Unicode * language, const sal_Unicode * country, const sal_Unicode * variant );
+
+/**
+ Common method of getting the current default Locale.
+
+ @deprecated LibreOffice itself does not use this anymore, and client code
+ should not have good use for it either. It may eventually be removed.
+ */
+SAL_DLLPUBLIC rtl_Locale * SAL_CALL rtl_locale_getDefault(void);
+
+/**
+ Sets the default.
+
+ <code>setDefault</code> does not reset the host locale.
+
+ @param language lowercase two-letter ISO 639-1 or three-letter ISO 639-3 code.
+ @param country uppercase two-letter ISO-3166 code.
+ @param variant vendor and browser specific code. See class description.
+
+ @deprecated LibreOffice itself does not use this anymore, and client code
+ should not have good use for it either. It may eventually be removed.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_locale_setDefault(
+ const sal_Unicode * language, const sal_Unicode * country, const sal_Unicode * variant );
+
+/**
+ Getter for programmatic name of field,
+ a lowercase two-letter ISO 639-1 or three-letter ISO 639-3 code.
+ @see getDisplayLanguage
+ */
+SAL_DLLPUBLIC rtl_uString * SAL_CALL rtl_locale_getLanguage( rtl_Locale * This );
+
+/**
+ Getter for programmatic name of field,
+ an uppercased two-letter ISO-3166 code.
+ @see getDisplayCountry
+ */
+SAL_DLLPUBLIC rtl_uString * SAL_CALL rtl_locale_getCountry( rtl_Locale * This );
+
+/**
+ Getter for programmatic name of field.
+ @see getDisplayVariant
+ */
+SAL_DLLPUBLIC rtl_uString * SAL_CALL rtl_locale_getVariant( rtl_Locale * This );
+
+/**
+ Returns the hash code of the locale This.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_locale_hashCode( rtl_Locale * This );
+
+/**
+ Returns true if the locals are equal, otherwise false.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_locale_equals( rtl_Locale * This, rtl_Locale * obj );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_RTL_LOCALE_H
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/malformeduriexception.hxx b/include/rtl/malformeduriexception.hxx
new file mode 100644
index 000000000..718656311
--- /dev/null
+++ b/include/rtl/malformeduriexception.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_MALFORMEDURIEXCEPTION_HXX
+#define INCLUDED_RTL_MALFORMEDURIEXCEPTION_HXX
+
+#include "rtl/ustring.hxx"
+
+namespace rtl {
+
+/** An exception indicating a malformed URI.
+
+ <P>Used when parsing (part of) a URI fails for syntactical reasons.</P>
+ */
+class SAL_EXCEPTION_DLLPUBLIC_EXPORT MalformedUriException
+{
+public:
+ /** Create a MalformedUriException.
+
+ @param rMessage
+ A message containing any details about the exception.
+ */
+ SAL_EXCEPTION_DLLPRIVATE MalformedUriException(
+ rtl::OUString const & rMessage): m_aMessage(rMessage) {}
+
+ SAL_EXCEPTION_DLLPRIVATE MalformedUriException(
+ MalformedUriException const & other): m_aMessage(other.m_aMessage) {}
+
+ SAL_EXCEPTION_DLLPRIVATE ~MalformedUriException() {}
+
+ SAL_EXCEPTION_DLLPRIVATE MalformedUriException operator =(
+ MalformedUriException const & rOther)
+ { m_aMessage = rOther.m_aMessage; return *this; }
+
+ /** Get the message.
+
+ @return
+ A reference to the message. The reference is valid for the lifetime of
+ this MalformedUriException.
+ */
+ SAL_EXCEPTION_DLLPRIVATE rtl::OUString const & getMessage() const
+ { return m_aMessage; }
+
+private:
+ rtl::OUString m_aMessage;
+};
+
+}
+
+#endif // INCLUDED_RTL_MALFORMEDURIEXCEPTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/math.h b/include/rtl/math.h
new file mode 100644
index 000000000..1938f037c
--- /dev/null
+++ b/include/rtl/math.h
@@ -0,0 +1,509 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_MATH_H
+#define INCLUDED_RTL_MATH_H
+
+#include "sal/config.h"
+
+#include "rtl/ustring.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#if defined __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** Formatting modes for rtl_math_doubleToString and rtl_math_doubleToUString
+ and rtl_math_doubleToUStringBuffer.
+ */
+enum rtl_math_StringFormat
+{
+ /** Like sprintf() %E.
+ */
+ rtl_math_StringFormat_E,
+
+ /** Like sprintf() %f.
+ */
+ rtl_math_StringFormat_F,
+
+ /** Like sprintf() %G, 'F' or 'E' format is used depending on which one is
+ more compact.
+ */
+ rtl_math_StringFormat_G,
+
+ /** Automatic, 'F' or 'E' format is used depending on the numeric value to
+ be formatted.
+ */
+ rtl_math_StringFormat_Automatic,
+
+ /** Same 'E', but with only 1 minimum digits in exponent.
+ @since LibreOffice 5.0
+ */
+ rtl_math_StringFormat_E1,
+
+ /** Same 'E', but with only 2 minimum digits in exponent.
+ @since LibreOffice 5.0
+ */
+ rtl_math_StringFormat_E2,
+
+ /** Same 'G', but with only 1 minimum digits in exponent.
+ @since LibreOffice 5.0
+ */
+ rtl_math_StringFormat_G1,
+
+ /** Same 'G', but with only 2 minimum digits in exponent.
+ @since LibreOffice 5.0
+ */
+ rtl_math_StringFormat_G2,
+
+ /** @cond INTERNAL */
+ rtl_math_StringFormat_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+ /** @endcond */
+};
+
+/** Status for rtl_math_stringToDouble and rtl_math_uStringToDouble.
+ */
+enum rtl_math_ConversionStatus
+{
+ /** Conversion was successful.
+ */
+ rtl_math_ConversionStatus_Ok,
+
+ /** Conversion caused overflow or underflow.
+ */
+ rtl_math_ConversionStatus_OutOfRange,
+
+ /** @cond INTERNAL */
+ rtl_math_ConversionStatus_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+ /** @endcond */
+};
+
+/** Rounding modes for rtl_math_round.
+ */
+enum rtl_math_RoundingMode
+{
+ /** Like HalfUp, but corrects roundoff errors, preferred.
+ */
+ rtl_math_RoundingMode_Corrected,
+
+ /** Floor of absolute value, signed return (commercial).
+ */
+ rtl_math_RoundingMode_Down,
+
+ /** Ceil of absolute value, signed return (commercial).
+ */
+ rtl_math_RoundingMode_Up,
+
+ /** Floor of signed value.
+ */
+ rtl_math_RoundingMode_Floor,
+
+ /** Ceil of signed value.
+ */
+ rtl_math_RoundingMode_Ceiling,
+
+ /** Frac <= 0.5 ? floor of abs : ceil of abs, signed return.
+ */
+ rtl_math_RoundingMode_HalfDown,
+
+ /** Frac < 0.5 ? floor of abs : ceil of abs, signed return (mathematical).
+ */
+ rtl_math_RoundingMode_HalfUp,
+
+ /** IEEE rounding mode (statistical).
+ */
+ rtl_math_RoundingMode_HalfEven,
+
+ /** @cond INTERNAL */
+ rtl_math_RoundingMode_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+ /** @endcond */
+};
+
+/** Special decimal places constants for rtl_math_doubleToString and
+ rtl_math_doubleToUString and rtl_math_doubleToUStringBuffer.
+ */
+enum rtl_math_DecimalPlaces
+{
+ /** Value to be used with rtl_math_StringFormat_Automatic.
+ */
+ rtl_math_DecimalPlaces_Max = 0x7ffffff,
+
+ /** Value to be used with rtl_math_StringFormat_G.
+ In fact the same value as rtl_math_DecimalPlaces_Max, just an alias for
+ better understanding.
+ */
+ rtl_math_DecimalPlaces_DefaultSignificance = rtl_math_DecimalPlaces_Max
+};
+
+
+/** Conversions analogous to sprintf() using internal rounding.
+
+ +/-HUGE_VAL are converted to "INF" and "-INF", NAN values are
+ converted to "NaN".
+
+ @param pResult
+ Returns the resulting byte string. Must itself not be null, and must point
+ to either null or a valid string.
+
+ @param pResultCapacity
+ If null, pResult is considered to point to immutable strings, and a new
+ string will be allocated in pResult.
+ If non-null, it points to the current capacity of pResult, which is
+ considered to point to a string buffer (pResult must not itself be null in
+ this case, and must point to a string that has room for the given capacity).
+ The string representation of the given double value is inserted into pResult
+ at position nResultOffset. If pResult's current capacity is too small, a
+ new string buffer will be allocated in pResult as necessary, and
+ pResultCapacity will contain the new capacity on return.
+
+ @param nResultOffset
+ If pResult is used as a string buffer (i.e., pResultCapacity is non-null),
+ nResultOffset specifies the insertion offset within the buffer. Ignored
+ otherwise.
+
+ @param fValue
+ The value to convert.
+
+ @param eFormat
+ The format to use, one of rtl_math_StringFormat.
+
+ @param nDecPlaces
+ The number of decimals to be generated. Effectively fValue is rounded at
+ this position, specifying nDecPlaces <= 0 accordingly rounds the value
+ before the decimal point and fills with zeros.
+ If eFormat == rtl_math_StringFormat_Automatic and nDecPlaces ==
+ rtl_math_DecimalPlaces_Max, the highest number of significant decimals
+ possible is generated.
+ If eFormat == rtl_math_StringFormat_G, nDecPlaces specifies the number of
+ significant digits instead. If nDecPlaces ==
+ rtl_math_DecimalPlaces_DefaultSignificance, the default number (currently 6
+ as implemented by most libraries) of significant digits is generated.
+ According to the ANSI C90 standard the E style will be used only if the
+ exponent resulting from the conversion is less than -4 or greater than or
+ equal to the precision. However, as opposed to the ANSI standard, trailing
+ zeros are not necessarily removed from the fractional portion of the result
+ unless bEraseTrailingDecZeros == true was specified.
+
+ @param cDecSeparator
+ The decimal separator.
+
+ @param pGroups
+ Either null (no grouping is used), or a null-terminated list of group
+ lengths. Each group length must be strictly positive. If the number of
+ digits in a conversion exceeds the specified range, the last (highest) group
+ length is repeated as needed. Values are applied from right to left, for a
+ grouping of 1,00,00,000 you'd have to specify pGroups={3,2,0}.
+
+ @param cGroupSeparator
+ The group separator. Ignored if pGroups is null.
+
+ @param bEraseTrailingDecZeros
+ Trailing zeros in decimal places are erased.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_math_doubleToString(rtl_String ** pResult,
+ sal_Int32 * pResultCapacity,
+ sal_Int32 nResultOffset, double fValue,
+ enum rtl_math_StringFormat eFormat,
+ sal_Int32 nDecPlaces,
+ char cDecSeparator,
+ sal_Int32 const * pGroups,
+ char cGroupSeparator,
+ sal_Bool bEraseTrailingDecZeros)
+ SAL_THROW_EXTERN_C();
+
+/** Conversions analogous to sprintf() using internal rounding.
+
+ +/-HUGE_VAL are converted to "INF" and "-INF", NAN values are
+ converted to "NaN".
+
+ @param pResult
+ Returns the resulting Unicode string. Must itself not be null, and must
+ point to either null or a valid string.
+
+ @param pResultCapacity
+ If null, pResult is considered to point to immutable strings, and a new
+ string will be allocated in pResult.
+ If non-null, it points to the current capacity of pResult, which is
+ considered to point to a string buffer (pResult must not itself be null in
+ this case, and must point to a string that has room for the given capacity).
+ The string representation of the given double value is inserted into pResult
+ at position nResultOffset. If pResult's current capacity is too small, a
+ new string buffer will be allocated in pResult as necessary, and
+ pResultCapacity will contain the new capacity on return.
+
+ @param nResultOffset
+ If pResult is used as a string buffer (i.e., pResultCapacity is non-null),
+ nResultOffset specifies the insertion offset within the buffer. Ignored
+ otherwise.
+
+ @param fValue
+ The value to convert.
+
+ @param eFormat
+ The format to use, one of rtl_math_StringFormat.
+
+ @param nDecPlaces
+ The number of decimals to be generated. Effectively fValue is rounded at
+ this position, specifying nDecPlaces <= 0 accordingly rounds the value
+ before the decimal point and fills with zeros.
+ If eFormat == rtl_math_StringFormat_Automatic and nDecPlaces ==
+ rtl_math_DecimalPlaces_Max, the highest number of significant decimals
+ possible is generated.
+ If eFormat == rtl_math_StringFormat_G, nDecPlaces specifies the number of
+ significant digits instead. If nDecPlaces ==
+ rtl_math_DecimalPlaces_DefaultSignificance, the default number (currently 6
+ as implemented by most libraries) of significant digits is generated.
+ According to the ANSI C90 standard the E style will be used only if the
+ exponent resulting from the conversion is less than -4 or greater than or
+ equal to the precision. However, as opposed to the ANSI standard, trailing
+ zeros are not necessarily removed from the fractional portion of the result
+ unless bEraseTrailingDecZeros == true was specified.
+
+ @param cDecSeparator
+ The decimal separator.
+
+ @param pGroups
+ Either null (no grouping is used), or a null-terminated list of group
+ lengths. Each group length must be strictly positive. If the number of
+ digits in a conversion exceeds the specified range, the last (highest) group
+ length is repeated as needed. Values are applied from right to left, for a
+ grouping of 1,00,00,000 you'd have to specify pGroups={3,2,0}.
+
+ @param cGroupSeparator
+ The group separator. Ignored if pGroups is null.
+
+ @param bEraseTrailingDecZeros
+ Trailing zeros in decimal places are erased.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_math_doubleToUString(rtl_uString ** pResult,
+ sal_Int32 * pResultCapacity,
+ sal_Int32 nResultOffset, double fValue,
+ enum rtl_math_StringFormat eFormat,
+ sal_Int32 nDecPlaces,
+ sal_Unicode cDecSeparator,
+ sal_Int32 const * pGroups,
+ sal_Unicode cGroupSeparator,
+ sal_Bool bEraseTrailingDecZeros)
+ SAL_THROW_EXTERN_C();
+
+/** Conversion analogous to strtod(), convert a string representing a
+ decimal number into a double value.
+
+ Leading tabs (0x09) and spaces (0x20) are eaten. Overflow returns
+ +/-HUGE_VAL, underflow 0. In both cases pStatus is set to
+ rtl_math_ConversionStatus_OutOfRange, otherwise to
+ rtl_math_ConversionStatus_Ok. "INF", "-INF" and "+/-1.#INF" are
+ recognized as +/-HUGE_VAL, pStatus is set to
+ rtl_math_ConversionStatus_OutOfRange. "NaN" and "+/-1.#NAN" are
+ recognized and the value is set to +/-NAN, pStatus is set to
+ rtl_math_ConversionStatus_Ok.
+
+ @param pBegin
+ Points to the start of the byte string to convert. Must not be null.
+
+ @param pEnd
+ Points one past the end of the byte string to convert. The condition
+ pEnd >= pBegin must hold.
+
+ @param cDecSeparator
+ The decimal separator.
+
+ @param cGroupSeparator
+ The group (aka thousands) separator.
+
+ @param pStatus
+ If non-null, returns the status of the conversion.
+
+ @param pParsedEnd
+ If non-null, returns one past the position of the last character parsed
+ away. Thus if [pBegin..pEnd) only contains the numerical string to be
+ parsed, *pParsedEnd == pEnd on return. If no numerical (sub-)string is
+ found, *pParsedEnd == pBegin on return, even if there was leading
+ whitespace.
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_stringToDouble(
+ char const * pBegin, char const * pEnd, char cDecSeparator,
+ char cGroupSeparator, enum rtl_math_ConversionStatus * pStatus,
+ char const ** pParsedEnd) SAL_THROW_EXTERN_C();
+
+/** Conversion analogous to strtod(), convert a string representing a
+ decimal number into a double value.
+
+ Leading tabs (U+0009) and spaces (U+0020) are eaten. Overflow returns
+ +/-HUGE_VAL, underflow 0. In both cases pStatus is set to
+ rtl_math_ConversionStatus_OutOfRange, otherwise to
+ rtl_math_ConversionStatus_Ok. "INF", "-INF" and "+/-1.#INF" are
+ recognized as +/-HUGE_VAL, pStatus is set to
+ rtl_math_ConversionStatus_OutOfRange. "NaN" and "+/-1.#NAN" are
+ recognized and the value is set to +/-NAN, pStatus is set to
+ rtl_math_ConversionStatus_Ok.
+
+ @param pBegin
+ Points to the start of the Unicode string to convert. Must not be null.
+
+ @param pEnd
+ Points one past the end of the Unicode string to convert. The condition
+ pEnd >= pBegin must hold.
+
+ @param cDecSeparator
+ The decimal separator.
+
+ @param cGroupSeparator
+ The group (aka thousands) separator.
+
+ @param pStatus
+ If non-null, returns the status of the conversion.
+
+ @param pParsedEnd
+ If non-null, returns one past the position of the last character parsed
+ away. Thus if [pBegin..pEnd) only contains the numerical string to be
+ parsed, *pParsedEnd == pEnd on return. If no numerical (sub-)string is
+ found, *pParsedEnd == pBegin on return, even if there was leading
+ whitespace.
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_uStringToDouble(
+ sal_Unicode const * pBegin, sal_Unicode const * pEnd,
+ sal_Unicode cDecSeparator, sal_Unicode cGroupSeparator,
+ enum rtl_math_ConversionStatus * pStatus, sal_Unicode const ** pParsedEnd)
+ SAL_THROW_EXTERN_C();
+
+/** Rounds a double value.
+
+ @param fValue
+ Specifies the value to be rounded.
+
+ @param nDecPlaces
+ Specifies the decimal place where rounding occurs. Must be in the range
+ -20 to +20, inclusive. Negative if rounding occurs before the decimal
+ point.
+
+ @param eMode
+ Specifies the rounding mode.
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_round(double fValue, int nDecPlaces,
+ enum rtl_math_RoundingMode eMode)
+ SAL_THROW_EXTERN_C();
+
+/** Scales fVal to a power of 10 without calling pow() or div() for nExp values
+ between -16 and +16, providing a faster method.
+
+ @param fValue
+ The value to be raised.
+
+ @param nExp
+ The exponent.
+
+ @return
+ fVal * pow(10.0, nExp)
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_pow10Exp(double fValue, int nExp) SAL_THROW_EXTERN_C();
+
+/** Rounds value to 15 significant decimal digits.
+
+ @param fValue
+ The value to be rounded.
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_approxValue(double fValue) SAL_THROW_EXTERN_C();
+
+/** Test equality of two values with an accuracy of the magnitude of the
+ given values scaled by 2^-48 (4 bits roundoff stripped).
+
+ @attention
+ approxEqual( value!=0.0, 0.0 ) _never_ yields true.
+
+ @since LibreOffice 5.3
+ */
+SAL_DLLPUBLIC bool SAL_CALL rtl_math_approxEqual(double a, double b) SAL_THROW_EXTERN_C();
+
+/** Returns more accurate e^x-1 for x near 0 than calculating directly.
+
+ expm1 is part of the C99 standard, but not provided by some compilers.
+
+ @param fValue
+ The value x in the term e^x-1.
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_expm1(double fValue) SAL_THROW_EXTERN_C();
+
+/** Returns more accurate log(1+x) for x near 0 than calculating directly.
+
+ log1p is part of the C99 standard, but not provided by some compilers.
+
+ @param fValue
+ The value x in the term log(1+x).
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_log1p(double fValue) SAL_THROW_EXTERN_C();
+
+/** Returns more accurate atanh(x) for x near 0 than calculating
+ 0.5*log((1+x)/(1-x)).
+
+ atanh is part of the C99 standard, but not provided by some compilers.
+
+ @param fValue
+ The value x in the term atanh(x).
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_atanh(double fValue) SAL_THROW_EXTERN_C();
+
+/** Returns values of the Errorfunction erf.
+
+ erf is part of the C99 standard, but not provided by some compilers.
+
+ @param fValue
+ The value x in the term erf(x).
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_erf(double fValue) SAL_THROW_EXTERN_C();
+
+/** Returns values of the complement Errorfunction erfc.
+
+ erfc is part of the C99 standard, but not provided by some compilers.
+
+ @param fValue
+ The value x in the term erfc(x).
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_erfc(double fValue) SAL_THROW_EXTERN_C();
+
+/** Returns values of the inverse hyperbolic sine.
+
+ asinh is part of the C99 standard, but not provided by some compilers.
+
+ @param fValue
+ The value x in the term asinh(x).
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_asinh(double fValue) SAL_THROW_EXTERN_C();
+
+/** Returns values of the inverse hyperbolic cosine.
+
+ acosh is part of the C99 standard, but not provided by some compilers.
+
+ @param fValue
+ The value x in the term acosh(x).
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_math_acosh(double fValue) SAL_THROW_EXTERN_C();
+
+#if defined __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* INCLUDED_RTL_MATH_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/math.hxx b/include/rtl/math.hxx
new file mode 100644
index 000000000..661ddf1d1
--- /dev/null
+++ b/include/rtl/math.hxx
@@ -0,0 +1,511 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_MATH_HXX
+#define INCLUDED_RTL_MATH_HXX
+
+#include "rtl/math.h"
+#include "rtl/strbuf.hxx"
+#include "rtl/string.hxx"
+#include "rtl/ustring.hxx"
+#include "rtl/ustrbuf.hxx"
+#include "sal/mathconf.h"
+#include "sal/types.h"
+
+#include <cstddef>
+#include <math.h>
+
+namespace rtl {
+
+namespace math {
+
+/** A wrapper around rtl_math_doubleToString.
+ */
+inline rtl::OString doubleToString(double fValue, rtl_math_StringFormat eFormat,
+ sal_Int32 nDecPlaces,
+ char cDecSeparator,
+ sal_Int32 const * pGroups,
+ char cGroupSeparator,
+ bool bEraseTrailingDecZeros = false)
+{
+ rtl::OString aResult;
+ rtl_math_doubleToString(&aResult.pData, NULL, 0, fValue, eFormat, nDecPlaces,
+ cDecSeparator, pGroups, cGroupSeparator,
+ bEraseTrailingDecZeros);
+ return aResult;
+}
+
+/** A wrapper around rtl_math_doubleToString, with no grouping.
+ */
+inline rtl::OString doubleToString(double fValue, rtl_math_StringFormat eFormat,
+ sal_Int32 nDecPlaces,
+ char cDecSeparator,
+ bool bEraseTrailingDecZeros = false)
+{
+ rtl::OString aResult;
+ rtl_math_doubleToString(&aResult.pData, NULL, 0, fValue, eFormat, nDecPlaces,
+ cDecSeparator, NULL, 0, bEraseTrailingDecZeros);
+ return aResult;
+}
+
+/** A wrapper around rtl_math_doubleToString that appends to an
+ rtl::OStringBuffer.
+
+ @since LibreOffice 5.4
+*/
+inline void doubleToStringBuffer(
+ rtl::OStringBuffer& rBuffer, double fValue, rtl_math_StringFormat eFormat,
+ sal_Int32 nDecPlaces, char cDecSeparator, sal_Int32 const * pGroups,
+ char cGroupSeparator, bool bEraseTrailingDecZeros = false)
+{
+ rtl_String ** pData;
+ sal_Int32 * pCapacity;
+ rBuffer.accessInternals(&pData, &pCapacity);
+ rtl_math_doubleToString(
+ pData, pCapacity, rBuffer.getLength(), fValue, eFormat, nDecPlaces,
+ cDecSeparator, pGroups, cGroupSeparator, bEraseTrailingDecZeros);
+}
+
+/** A wrapper around rtl_math_doubleToString that appends to an
+ rtl::OStringBuffer, with no grouping.
+
+ @since LibreOffice 5.4
+*/
+inline void doubleToStringBuffer(
+ rtl::OStringBuffer& rBuffer, double fValue, rtl_math_StringFormat eFormat,
+ sal_Int32 nDecPlaces, char cDecSeparator,
+ bool bEraseTrailingDecZeros = false)
+{
+ rtl_String ** pData;
+ sal_Int32 * pCapacity;
+ rBuffer.accessInternals(&pData, &pCapacity);
+ rtl_math_doubleToString(
+ pData, pCapacity, rBuffer.getLength(), fValue, eFormat, nDecPlaces,
+ cDecSeparator, NULL, 0, bEraseTrailingDecZeros);
+}
+
+/** A wrapper around rtl_math_doubleToUString.
+ */
+inline rtl::OUString doubleToUString(double fValue,
+ rtl_math_StringFormat eFormat,
+ sal_Int32 nDecPlaces,
+ sal_Unicode cDecSeparator,
+ sal_Int32 const * pGroups,
+ sal_Unicode cGroupSeparator,
+ bool bEraseTrailingDecZeros = false)
+{
+ rtl::OUString aResult;
+ rtl_math_doubleToUString(&aResult.pData, NULL, 0, fValue, eFormat, nDecPlaces,
+ cDecSeparator, pGroups, cGroupSeparator,
+ bEraseTrailingDecZeros);
+ return aResult;
+}
+
+/** A wrapper around rtl_math_doubleToUString, with no grouping.
+ */
+inline rtl::OUString doubleToUString(double fValue,
+ rtl_math_StringFormat eFormat,
+ sal_Int32 nDecPlaces,
+ sal_Unicode cDecSeparator,
+ bool bEraseTrailingDecZeros = false)
+{
+ rtl::OUString aResult;
+ rtl_math_doubleToUString(&aResult.pData, NULL, 0, fValue, eFormat, nDecPlaces,
+ cDecSeparator, NULL, 0, bEraseTrailingDecZeros);
+ return aResult;
+}
+
+/** A wrapper around rtl_math_doubleToUString that appends to an
+ rtl::OUStringBuffer.
+ */
+inline void doubleToUStringBuffer( rtl::OUStringBuffer& rBuffer, double fValue,
+ rtl_math_StringFormat eFormat,
+ sal_Int32 nDecPlaces,
+ sal_Unicode cDecSeparator,
+ sal_Int32 const * pGroups,
+ sal_Unicode cGroupSeparator,
+ bool bEraseTrailingDecZeros = false)
+{
+ rtl_uString ** pData;
+ sal_Int32 * pCapacity;
+ rBuffer.accessInternals( &pData, &pCapacity );
+ rtl_math_doubleToUString( pData, pCapacity, rBuffer.getLength(), fValue,
+ eFormat, nDecPlaces, cDecSeparator, pGroups,
+ cGroupSeparator, bEraseTrailingDecZeros);
+}
+
+/** A wrapper around rtl_math_doubleToUString that appends to an
+ rtl::OUStringBuffer, with no grouping.
+ */
+inline void doubleToUStringBuffer( rtl::OUStringBuffer& rBuffer, double fValue,
+ rtl_math_StringFormat eFormat,
+ sal_Int32 nDecPlaces,
+ sal_Unicode cDecSeparator,
+ bool bEraseTrailingDecZeros = false)
+{
+ rtl_uString ** pData;
+ sal_Int32 * pCapacity;
+ rBuffer.accessInternals( &pData, &pCapacity );
+ rtl_math_doubleToUString( pData, pCapacity, rBuffer.getLength(), fValue,
+ eFormat, nDecPlaces, cDecSeparator, NULL, 0,
+ bEraseTrailingDecZeros);
+}
+
+/** A wrapper around rtl_math_stringToDouble.
+ */
+#ifdef LIBO_INTERNAL_ONLY
+inline double stringToDouble(std::string_view aString,
+ char cDecSeparator, char cGroupSeparator,
+ rtl_math_ConversionStatus * pStatus = NULL,
+ sal_Int32 * pParsedEnd = NULL)
+{
+ char const * pBegin = aString.data();
+ char const * pEnd;
+ double fResult = rtl_math_stringToDouble(pBegin,
+ pBegin + aString.size(),
+ cDecSeparator, cGroupSeparator,
+ pStatus, &pEnd);
+ if (pParsedEnd != NULL)
+ *pParsedEnd = static_cast<sal_Int32>(pEnd - pBegin);
+ return fResult;
+}
+#else
+inline double stringToDouble(rtl::OString const & rString,
+ char cDecSeparator, char cGroupSeparator,
+ rtl_math_ConversionStatus * pStatus = NULL,
+ sal_Int32 * pParsedEnd = NULL)
+{
+ char const * pBegin = rString.getStr();
+ char const * pEnd;
+ double fResult = rtl_math_stringToDouble(pBegin,
+ pBegin + rString.getLength(),
+ cDecSeparator, cGroupSeparator,
+ pStatus, &pEnd);
+ if (pParsedEnd != NULL)
+ *pParsedEnd = static_cast<sal_Int32>(pEnd - pBegin);
+ return fResult;
+}
+#endif
+
+
+/** A wrapper around rtl_math_uStringToDouble.
+ */
+#ifdef LIBO_INTERNAL_ONLY
+inline double stringToDouble(std::u16string_view aString,
+ sal_Unicode cDecSeparator,
+ sal_Unicode cGroupSeparator,
+ rtl_math_ConversionStatus * pStatus = NULL,
+ sal_Int32 * pParsedEnd = NULL)
+{
+ sal_Unicode const * pBegin = aString.data();
+ sal_Unicode const * pEnd;
+ double fResult = rtl_math_uStringToDouble(pBegin,
+ pBegin + aString.size(),
+ cDecSeparator, cGroupSeparator,
+ pStatus, &pEnd);
+ if (pParsedEnd != NULL)
+ *pParsedEnd = static_cast<sal_Int32>(pEnd - pBegin);
+ return fResult;
+}
+#else
+inline double stringToDouble(rtl::OUString const & rString,
+ sal_Unicode cDecSeparator,
+ sal_Unicode cGroupSeparator,
+ rtl_math_ConversionStatus * pStatus = NULL,
+ sal_Int32 * pParsedEnd = NULL)
+{
+ sal_Unicode const * pBegin = rString.getStr();
+ sal_Unicode const * pEnd;
+ double fResult = rtl_math_uStringToDouble(pBegin,
+ pBegin + rString.getLength(),
+ cDecSeparator, cGroupSeparator,
+ pStatus, &pEnd);
+ if (pParsedEnd != NULL)
+ *pParsedEnd = static_cast<sal_Int32>(pEnd - pBegin);
+ return fResult;
+}
+#endif
+
+/** A wrapper around rtl_math_round.
+ */
+inline double round(
+ double fValue, int nDecPlaces = 0,
+ rtl_math_RoundingMode eMode = rtl_math_RoundingMode_Corrected)
+{
+ return rtl_math_round(fValue, nDecPlaces, eMode);
+}
+
+/** A wrapper around rtl_math_pow10Exp.
+ */
+inline double pow10Exp(double fValue, int nExp)
+{
+ return rtl_math_pow10Exp(fValue, nExp);
+}
+
+/** A wrapper around rtl_math_approxValue.
+ */
+inline double approxValue(double fValue)
+{
+ return rtl_math_approxValue(fValue);
+}
+
+/** A wrapper around rtl_math_expm1.
+ */
+inline double expm1(double fValue)
+{
+ return rtl_math_expm1(fValue);
+}
+
+/** A wrapper around rtl_math_log1p.
+ */
+inline double log1p(double fValue)
+{
+ return rtl_math_log1p(fValue);
+}
+
+/** A wrapper around rtl_math_atanh.
+ */
+inline double atanh(double fValue)
+{
+ return rtl_math_atanh(fValue);
+}
+
+/** A wrapper around rtl_math_erf.
+ */
+inline double erf(double fValue)
+{
+ return rtl_math_erf(fValue);
+}
+
+/** A wrapper around rtl_math_erfc.
+ */
+inline double erfc(double fValue)
+{
+ return rtl_math_erfc(fValue);
+}
+
+/** A wrapper around rtl_math_asinh.
+ */
+inline double asinh(double fValue)
+{
+ return rtl_math_asinh(fValue);
+}
+
+/** A wrapper around rtl_math_acosh.
+ */
+inline double acosh(double fValue)
+{
+ return rtl_math_acosh(fValue);
+}
+
+/** A wrapper around rtl_math_approxEqual.
+ */
+inline bool approxEqual(double a, double b)
+{
+ return rtl_math_approxEqual( a, b );
+}
+
+/** Test equality of two values with an accuracy defined by nPrec
+
+ @attention
+ approxEqual( value!=0.0, 0.0 ) _never_ yields true.
+ */
+inline bool approxEqual(double a, double b, sal_Int16 nPrec)
+{
+ if ( a == b )
+ return true;
+ double x = a - b;
+ return (x < 0.0 ? -x : x)
+ < ((a < 0.0 ? -a : a) * (1.0 / (pow(2.0, nPrec))));
+}
+
+/** Add two values.
+
+ If signs differ and the absolute values are equal according to approxEqual()
+ the method returns 0.0 instead of calculating the sum.
+
+ If you wanted to sum up multiple values it would be convenient not to call
+ approxAdd() for each value but instead remember the first value not equal to
+ 0.0, add all other values using normal + operator, and with the result and
+ the remembered value call approxAdd().
+ */
+inline double approxAdd(double a, double b)
+{
+ if ( ((a < 0.0 && b > 0.0) || (b < 0.0 && a > 0.0))
+ && approxEqual( a, -b ) )
+ return 0.0;
+ return a + b;
+}
+
+/** Subtract two values (a-b).
+
+ If signs are identical and the values are equal according to approxEqual()
+ the method returns 0.0 instead of calculating the subtraction.
+ */
+inline double approxSub(double a, double b)
+{
+ if ( ((a < 0.0 && b < 0.0) || (a > 0.0 && b > 0.0)) && approxEqual( a, b ) )
+ return 0.0;
+ return a - b;
+}
+
+/** floor() method taking approxValue() into account.
+
+ Use for expected integer values being calculated by double functions.
+ */
+inline double approxFloor(double a)
+{
+ return floor( approxValue( a ));
+}
+
+/** ceil() method taking approxValue() into account.
+
+ Use for expected integer values being calculated by double functions.
+ */
+inline double approxCeil(double a)
+{
+ return ceil( approxValue( a ));
+}
+
+/** Tests whether a value is neither INF nor NAN.
+ */
+inline bool isFinite(double d)
+{
+ return SAL_MATH_FINITE(d);
+}
+
+/** If a value represents +INF or -INF.
+
+ The sign bit may be queried with isSignBitSet().
+
+ If isFinite(d)==false and isInf(d)==false then NAN.
+ */
+inline bool isInf(double d)
+{
+ // exponent==0x7ff fraction==0
+ return !SAL_MATH_FINITE(d) &&
+ (reinterpret_cast< sal_math_Double * >(&d)->inf_parts.fraction_hi == 0)
+ && (reinterpret_cast< sal_math_Double * >(&d)->inf_parts.fraction_lo
+ == 0);
+}
+
+/** Test on any QNAN or SNAN.
+ */
+inline bool isNan(double d)
+{
+ // exponent==0x7ff fraction!=0
+ return !SAL_MATH_FINITE(d) && (
+ (reinterpret_cast< sal_math_Double * >(&d)->inf_parts.fraction_hi != 0)
+ || (reinterpret_cast< sal_math_Double * >(&d)->inf_parts.fraction_lo
+ != 0) );
+}
+
+/** If the sign bit is set.
+ */
+inline bool isSignBitSet(double d)
+{
+ return reinterpret_cast< sal_math_Double * >(&d)->inf_parts.sign != 0;
+}
+
+/** Set to +INF if bNegative==false or -INF if bNegative==true.
+ */
+inline void setInf(double * pd, bool bNegative)
+{
+ union
+ {
+ double sd;
+ sal_math_Double md;
+ };
+ md.w32_parts.msw = bNegative ? 0xFFF00000 : 0x7FF00000;
+ md.w32_parts.lsw = 0;
+ *pd = sd;
+}
+
+/** Set a QNAN.
+ */
+inline void setNan(double * pd)
+{
+ union
+ {
+ double sd;
+ sal_math_Double md;
+ };
+ md.w32_parts.msw = 0x7FFFFFFF;
+ md.w32_parts.lsw = 0xFFFFFFFF;
+ *pd = sd;
+}
+
+/** If a value is a valid argument for sin(), cos(), tan().
+
+ IEEE 754 specifies that absolute values up to 2^64 (=1.844e19) for the
+ radian must be supported by trigonometric functions. Unfortunately, at
+ least on x86 architectures, the FPU doesn't generate an error pattern for
+ values >2^64 but produces erroneous results instead and sets only the
+ "invalid operation" (IM) flag in the status word :-( Thus the application
+ has to handle it itself.
+ */
+inline bool isValidArcArg(double d)
+{
+ return fabs(d)
+ <= (static_cast< double >(static_cast< unsigned long >(0x80000000))
+ * static_cast< double >(static_cast< unsigned long >(0x80000000))
+ * 4);
+}
+
+/** Safe sin(), returns NAN if not valid.
+ */
+inline double sin(double d)
+{
+ if ( isValidArcArg( d ) )
+ return ::sin( d );
+ setNan( &d );
+ return d;
+}
+
+/** Safe cos(), returns NAN if not valid.
+ */
+inline double cos(double d)
+{
+ if ( isValidArcArg( d ) )
+ return ::cos( d );
+ setNan( &d );
+ return d;
+}
+
+/** Safe tan(), returns NAN if not valid.
+ */
+inline double tan(double d)
+{
+ if ( isValidArcArg( d ) )
+ return ::tan( d );
+ setNan( &d );
+ return d;
+}
+
+}
+
+}
+
+#endif // INCLUDED_RTL_MATH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/process.h b/include/rtl/process.h
new file mode 100644
index 000000000..0a2833863
--- /dev/null
+++ b/include/rtl/process.h
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_RTL_PROCESS_H
+#define INCLUDED_RTL_PROCESS_H
+
+#include "sal/config.h"
+
+#include "osl/process.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ gets a 16-byte fixed size identifier which is guaranteed not to change
+ during the current process.
+
+ The current implementation creates a 16-byte uuid without using
+ the ethernet address of system. Thus the
+ identifier is different from identifiers created
+ in other processes with a very probability.
+
+ @param pTargetUUID 16 byte of memory
+ @see rtl_createUuid()
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_getGlobalProcessId( sal_uInt8 *pTargetUUID );
+
+/** Get the nArg-th command-line argument passed to the main-function of this process.
+
+ This function differs from osl_getCommandArg() in filtering any bootstrap values
+ given by command args, that means that all arguments starting with "-env:" will be
+ ignored by this function.
+
+ @param[in] nArg The number of the argument to return.
+ @param[out] strCommandArg The string receives the nArg-th command-line argument.
+ @retval osl_Process_E_None or does not return.
+ @see osl_getCommandArg()
+ @see rtl_getAppCommandArgCount()
+*/
+SAL_DLLPUBLIC oslProcessError SAL_CALL rtl_getAppCommandArg(sal_uInt32 nArg, rtl_uString **strCommandArg);
+
+/** Returns the number of command line arguments at process start.
+
+ This function differs from osl_getCommandArg() in filtering any bootstrap values
+ given by command args, that means that all arguments starting with "-env:" will be
+ ignored by this function.
+
+ @return the number of commandline arguments passed to the main-function of this process.
+ @see osl_getCommandArgCount()
+ @see rtl_getAppCommandArg()
+*/
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL rtl_getAppCommandArgCount(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/random.h b/include/rtl/random.h
new file mode 100644
index 000000000..af21139de
--- /dev/null
+++ b/include/rtl/random.h
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_RANDOM_H
+#define INCLUDED_RTL_RANDOM_H
+
+#include "sal/config.h"
+
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Random Pool opaque type.
+ */
+typedef void* rtlRandomPool;
+
+
+/** Error Code enumeration.
+ */
+enum __rtl_RandomError
+{
+ rtl_Random_E_None,
+ rtl_Random_E_Argument,
+ rtl_Random_E_Memory,
+ rtl_Random_E_Unknown,
+ rtl_Random_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+/** Error Code type.
+ */
+typedef enum __rtl_RandomError rtlRandomError;
+
+
+/** Create a Random Pool.
+ @return initialized Random Pool, or NULL upon failure.
+ */
+SAL_DLLPUBLIC rtlRandomPool SAL_CALL rtl_random_createPool (void) SAL_THROW_EXTERN_C();
+
+
+/** Destroy a Random Pool.
+ @param[in] Pool a Random Pool.
+ @return none. Pool is invalid.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_random_destroyPool (
+ rtlRandomPool Pool
+) SAL_THROW_EXTERN_C();
+
+
+/** Add bytes to a Random Pool.
+ @param[in] Pool a Random Pool.
+ @param[in] Buffer a buffer containing the bytes to add.
+ @param[in] Bytes the number of bytes to read from the buffer.
+ @retval rtl_Random_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlRandomError SAL_CALL rtl_random_addBytes (
+ rtlRandomPool Pool,
+ const void *Buffer,
+ sal_Size Bytes
+) SAL_THROW_EXTERN_C();
+
+
+/** Retrieve bytes from a Random Pool.
+ @param[in] Pool a Random Pool.
+ @param[in,out] Buffer a buffer to receive the random bytes.
+ @param[in] Bytes the number of bytes to write to the buffer.
+ @retval rtl_Random_E_None upon success.
+ */
+SAL_DLLPUBLIC rtlRandomError SAL_CALL rtl_random_getBytes (
+ rtlRandomPool Pool,
+ void *Buffer,
+ sal_Size Bytes
+) SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_RTL_RANDOM_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/ref.hxx b/include/rtl/ref.hxx
new file mode 100644
index 000000000..38dfe3769
--- /dev/null
+++ b/include/rtl/ref.hxx
@@ -0,0 +1,316 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_REF_HXX
+#define INCLUDED_RTL_REF_HXX
+
+#include "sal/config.h"
+
+#include <cassert>
+#include <cstddef>
+#include <functional>
+#ifdef LIBO_INTERNAL_ONLY
+#include <type_traits>
+#include "com/sun/star/uno/Reference.h"
+#endif
+
+#include "sal/types.h"
+
+namespace rtl
+{
+
+/** Template reference class for reference type.
+*/
+template <class reference_type>
+class Reference
+{
+ /** The <b>reference_type</b> body pointer.
+ */
+ reference_type * m_pBody;
+
+
+public:
+ /** Constructor...
+ */
+ Reference()
+ : m_pBody (NULL)
+ {}
+
+
+ /** Constructor...
+ */
+ Reference (reference_type * pBody, __sal_NoAcquire)
+ : m_pBody (pBody)
+ {
+ }
+
+ /** Constructor...
+ */
+ Reference (reference_type * pBody)
+ : m_pBody (pBody)
+ {
+ if (m_pBody)
+ m_pBody->acquire();
+ }
+
+ /** Copy constructor...
+ */
+ Reference (const Reference<reference_type> & handle)
+ : m_pBody (handle.m_pBody)
+ {
+ if (m_pBody)
+ m_pBody->acquire();
+ }
+
+#ifdef LIBO_INTERNAL_ONLY
+ /** Move constructor...
+ */
+ Reference (Reference<reference_type> && handle) noexcept
+ : m_pBody (handle.m_pBody)
+ {
+ handle.m_pBody = nullptr;
+ }
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ /** Up-casting conversion constructor: Copies interface reference.
+
+ Does not work for up-casts to ambiguous bases.
+
+ @param rRef another reference
+ */
+ template< class derived_type >
+ inline Reference(
+ const Reference< derived_type > & rRef,
+ std::enable_if_t<std::is_base_of_v<reference_type, derived_type>, int> = 0 )
+ : m_pBody (rRef.get())
+ {
+ if (m_pBody)
+ m_pBody->acquire();
+ }
+
+ /** Up-casting conversion operator to convert to css::uno::Interface
+
+ Does not work for up-casts to ambiguous bases.
+ */
+ template< class super_type,
+ std::enable_if_t<std::is_base_of_v<super_type, reference_type>, int> = 0 >
+ inline operator css::uno::Reference<super_type>() const
+ {
+ return css::uno::Reference<super_type>(m_pBody);
+ }
+#endif
+
+ /** Destructor...
+ */
+ ~Reference() COVERITY_NOEXCEPT_FALSE
+ {
+ if (m_pBody)
+ m_pBody->release();
+ }
+
+ /** Set...
+ Similar to assignment.
+ */
+ Reference<reference_type> &
+ SAL_CALL set (reference_type * pBody)
+ {
+ if (pBody)
+ pBody->acquire();
+ reference_type * const pOld = m_pBody;
+ m_pBody = pBody;
+ if (pOld)
+ pOld->release();
+ return *this;
+ }
+
+ /** Assignment.
+ Unbinds this instance from its body (if bound) and
+ bind it to the body represented by the handle.
+ */
+ Reference<reference_type> &
+ SAL_CALL operator= (const Reference<reference_type> & handle)
+ {
+ return set( handle.m_pBody );
+ }
+
+#ifdef LIBO_INTERNAL_ONLY
+ /** Assignment.
+ * Unbinds this instance from its body (if bound),
+ * bind it to the body represented by the handle, and
+ * set the body represented by the handle to nullptr.
+ */
+ Reference<reference_type> &
+ operator= (Reference<reference_type> && handle)
+ {
+ // self-movement guts ourself
+ if (m_pBody)
+ m_pBody->release();
+ m_pBody = handle.m_pBody;
+ handle.m_pBody = nullptr;
+ return *this;
+ }
+#endif
+
+ /** Assignment...
+ */
+ Reference<reference_type> &
+ SAL_CALL operator= (reference_type * pBody)
+ {
+ return set( pBody );
+ }
+
+ /** Unbind the body from this handle.
+ Note that for a handle representing a large body,
+ "handle.clear().set(new body());" _might_
+ perform a little bit better than "handle.set(new body());",
+ since in the second case two large objects exist in memory
+ (the old body and the new body).
+ */
+ Reference<reference_type> & SAL_CALL clear()
+ {
+ if (m_pBody)
+ {
+ reference_type * const pOld = m_pBody;
+ m_pBody = NULL;
+ pOld->release();
+ }
+ return *this;
+ }
+
+
+ /** Get the body. Can be used instead of operator->().
+ I.e. handle->someBodyOp() and handle.get()->someBodyOp()
+ are the same.
+ */
+ reference_type * SAL_CALL get() const
+ {
+ return m_pBody;
+ }
+
+
+ /** Probably most common used: handle->someBodyOp().
+ */
+ reference_type * SAL_CALL operator->() const
+ {
+ assert(m_pBody != NULL);
+ return m_pBody;
+ }
+
+
+ /** Allows (*handle).someBodyOp().
+ */
+ reference_type & SAL_CALL operator*() const
+ {
+ assert(m_pBody != NULL);
+ return *m_pBody;
+ }
+
+
+ /** Returns True if the handle does point to a valid body.
+ */
+ bool SAL_CALL is() const
+ {
+ return (m_pBody != NULL);
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** Returns True if the handle does point to a valid body.
+ */
+ explicit operator bool() const
+ {
+ return is();
+ }
+#endif
+
+ /** Returns True if this points to pBody.
+ */
+ bool SAL_CALL operator== (const reference_type * pBody) const
+ {
+ return (m_pBody == pBody);
+ }
+
+
+ /** Returns True if handle points to the same body.
+ */
+ bool
+ SAL_CALL operator== (const Reference<reference_type> & handle) const
+ {
+ return (m_pBody == handle.m_pBody);
+ }
+
+
+ /** Needed to place References into STL collection.
+ */
+ bool
+ SAL_CALL operator!= (const Reference<reference_type> & handle) const
+ {
+ return (m_pBody != handle.m_pBody);
+ }
+
+
+ /** Needed to place References into STL collection.
+ */
+ bool
+ SAL_CALL operator< (const Reference<reference_type> & handle) const
+ {
+ return (m_pBody < handle.m_pBody);
+ }
+
+
+ /** Needed to place References into STL collection.
+ */
+ bool
+ SAL_CALL operator> (const Reference<reference_type> & handle) const
+ {
+ return (m_pBody > handle.m_pBody);
+ }
+};
+
+} // namespace rtl
+
+#if defined LIBO_INTERNAL_ONLY
+namespace std
+{
+
+/// @cond INTERNAL
+/**
+ Make rtl::Reference hashable by default for use in STL containers.
+
+ @since LibreOffice 6.3
+*/
+template<typename T>
+struct hash<::rtl::Reference<T>>
+{
+ std::size_t operator()(::rtl::Reference<T> const & s) const
+ { return std::size_t(s.get()); }
+};
+/// @endcond
+
+}
+
+#endif
+
+#endif /* ! INCLUDED_RTL_REF_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/strbuf.h b/include/rtl/strbuf.h
new file mode 100644
index 000000000..0c6eea1de
--- /dev/null
+++ b/include/rtl/strbuf.h
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_STRBUF_H
+#define INCLUDED_RTL_STRBUF_H
+
+#include "sal/config.h"
+
+#include "rtl/string.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Allocates a new <code>String</code> that contains characters from
+ the character array argument.
+
+ The <code>count</code> argument specifies
+ the length of the array. The initial capacity of the string buffer is
+ <code>16</code> plus the length of the string argument.
+
+ @param newStr out parameter, contains the new string. The reference count is 1.
+ @param value the initial value of the string.
+ @param count the length of value.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_stringbuffer_newFromStr_WithLength(
+ rtl_String ** newStr,
+ const char * value,
+ sal_Int32 count);
+
+/**
+ Allocates a new <code>String</code> that contains the same sequence of
+ characters as the string argument.
+
+ The initial capacity is the larger of:
+ <ul>
+ <li> The <code>bufferLen</code> argument.
+ <li> The <code>length</code> of the string argument.
+ </ul>
+
+ @param newStr out parameter, contains the new string. The reference count is 1.
+ @param capacity the initial len of the string buffer.
+ @param oldStr the initial value of the string.
+ @return the new capacity of the string buffer
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_stringbuffer_newFromStringBuffer(
+ rtl_String ** newStr,
+ sal_Int32 capacity,
+ rtl_String * oldStr );
+
+/**
+ Ensures that the capacity of the buffer is at least equal to the
+ specified minimum.
+
+ If the current capacity of this string buffer is less than the
+ argument, then a new internal buffer is allocated with greater
+ capacity. The new capacity is the larger of:
+ <ul>
+ <li>The <code>minimumCapacity</code> argument.
+ <li>Twice the old capacity, plus <code>2</code>.
+ </ul>
+ If the <code>minimumCapacity</code> argument is nonpositive, this
+ method takes no action and simply returns.
+
+ @param[in,out] This the String to operate on.
+ @param[in,out] capacity in: old capacity, out: new capacity.
+ @param[in] minimumCapacity the minimum desired capacity.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_stringbuffer_ensureCapacity(
+ rtl_String ** This,
+ sal_Int32* capacity,
+ sal_Int32 minimumCapacity);
+
+
+/**
+ Inserts the string representation of the <code>char</code> array
+ argument into this string buffer.
+
+ The characters of the array argument are inserted into the
+ contents of this string buffer at the position indicated by
+ <code>offset</code>. The length of this string buffer increases by
+ the length of the argument.
+
+ @param[in,out] This the String to operate on.
+ @param[in,out] capacity the capacity of the string buffer
+ @param[in] offset the offset.
+ @param[in] str a character array. Since LibreOffice 4.4, as a
+ special case, if str is null then the len added
+ characters are left uninitialized.
+ @param[in] len the number of characters to append.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_stringbuffer_insert(
+ rtl_String ** This,
+ sal_Int32 * capacity,
+ sal_Int32 offset,
+ const char * str,
+ sal_Int32 len);
+
+/**
+ Removes the characters in a substring of this sequence.
+
+ The substring begins at the specified <code>start</code> and
+ is <code>len</code> characters long.
+
+ start must be >= 0 && <= This->length
+
+ @param[in,out] This The String to operate on.
+ @param[in] start The beginning index, inclusive
+ @param[in] len The substring length
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_stringbuffer_remove(
+ rtl_String ** This,
+ sal_Int32 start,
+ sal_Int32 len );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_RTL_STRBUF_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx
new file mode 100644
index 000000000..098e8b0bb
--- /dev/null
+++ b/include/rtl/strbuf.hxx
@@ -0,0 +1,1131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#pragma once
+
+#include "sal/config.h"
+
+#include <cassert>
+#include <cstring>
+#include <limits>
+
+#include "rtl/strbuf.h"
+#include "rtl/string.hxx"
+#include "rtl/stringutils.hxx"
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+#include "rtl/stringconcat.hxx"
+#include <string_view>
+#include <type_traits>
+#endif
+
+#ifdef RTL_STRING_UNITTEST
+extern bool rtl_string_unittest_const_literal;
+extern bool rtl_string_unittest_const_literal_function;
+#endif
+
+// The unittest uses slightly different code to help check that the proper
+// calls are made. The class is put into a different namespace to make
+// sure the compiler generates a different (if generating also non-inline)
+// copy of the function and does not merge them together. The class
+// is "brought" into the proper rtl namespace by a typedef below.
+#ifdef RTL_STRING_UNITTEST
+#define rtl rtlunittest
+#endif
+
+namespace rtl
+{
+
+/// @cond INTERNAL
+#ifdef RTL_STRING_UNITTEST
+#undef rtl
+// helper macro to make functions appear more readable
+#define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
+#else
+#define RTL_STRING_CONST_FUNCTION
+#endif
+/// @endcond
+
+/** A string buffer implements a mutable sequence of characters.
+ */
+class SAL_WARN_UNUSED OStringBuffer
+{
+public:
+ /**
+ Constructs a string buffer with no characters in it and an
+ initial capacity of 16 characters.
+ */
+ OStringBuffer()
+ : pData(NULL)
+ , nCapacity( 16 )
+ {
+ rtl_string_new_WithLength( &pData, nCapacity );
+ }
+
+ /**
+ Allocates a new string buffer that contains the same sequence of
+ characters as the string buffer argument.
+
+ @param value a <code>OStringBuffer</code>.
+ */
+ OStringBuffer( const OStringBuffer & value )
+ : pData(NULL)
+ , nCapacity( value.nCapacity )
+ {
+ rtl_stringbuffer_newFromStringBuffer( &pData, value.nCapacity, value.pData );
+ }
+
+ /**
+ Constructs a string buffer with no characters in it and an
+ initial capacity specified by the <code>length</code> argument.
+
+ @param length the initial capacity.
+ */
+ explicit OStringBuffer(sal_Int32 length)
+ : pData(NULL)
+ , nCapacity( length )
+ {
+ rtl_string_new_WithLength( &pData, length );
+ }
+#if defined LIBO_INTERNAL_ONLY
+ template<typename T>
+ explicit OStringBuffer(T length, std::enable_if_t<std::is_integral_v<T>, int> = 0)
+ : OStringBuffer(static_cast<sal_Int32>(length))
+ {
+ assert(
+ length >= 0
+ && static_cast<std::make_unsigned_t<T>>(length)
+ <= static_cast<std::make_unsigned_t<sal_Int32>>(
+ std::numeric_limits<sal_Int32>::max()));
+ }
+ // avoid (obvious) bugs
+ explicit OStringBuffer(bool) = delete;
+ explicit OStringBuffer(char) = delete;
+ explicit OStringBuffer(wchar_t) = delete;
+#if defined __cpp_char8_t
+ explicit OStringBuffer(char8_t) = delete;
+#endif
+ explicit OStringBuffer(char16_t) = delete;
+ explicit OStringBuffer(char32_t) = delete;
+#endif
+
+ /**
+ Constructs a string buffer so that it represents the same
+ sequence of characters as the string argument.
+
+ The initial
+ capacity of the string buffer is <code>16</code> plus the length
+ of the string argument.
+
+ @param value the initial string value.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ OStringBuffer(std::string_view sv)
+ : pData(nullptr)
+ , nCapacity( sv.length() + 16 )
+ {
+ if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
+ throw std::bad_alloc();
+ }
+ rtl_stringbuffer_newFromStr_WithLength( &pData, sv.data(), sv.length() );
+ }
+#else
+ OStringBuffer(const OString& value)
+ : pData(NULL)
+ , nCapacity( value.getLength() + 16 )
+ {
+ rtl_stringbuffer_newFromStr_WithLength( &pData, value.getStr(), value.getLength() );
+ }
+#endif
+
+ /**
+ @overload
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ OStringBuffer( const T& value, typename libreoffice_internal::CharPtrDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy())
+ : pData(NULL)
+ {
+ sal_Int32 length = rtl_str_getLength( value );
+ nCapacity = length + 16;
+ rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
+ }
+
+ template< typename T >
+ OStringBuffer( T& value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy())
+ : pData(NULL)
+ {
+ sal_Int32 length = rtl_str_getLength( value );
+ nCapacity = length + 16;
+ rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
+ }
+
+ /**
+ Constructs a string buffer so that it represents the same
+ sequence of characters as the string literal.
+
+ If there are any embedded \0's in the string literal, the result is undefined.
+ Use the overload that explicitly accepts length.
+
+ @since LibreOffice 3.6
+
+ @param literal a string literal
+ */
+ template< typename T >
+ OStringBuffer( T& literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy())
+ : pData(NULL)
+ , nCapacity( libreoffice_internal::ConstCharArrayDetector<T>::length + 16 )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ rtl_string_newFromLiteral(
+ &pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, 16);
+#ifdef RTL_STRING_UNITTEST
+ rtl_string_unittest_const_literal = true;
+#endif
+ }
+
+ /**
+ Constructs a string buffer so that it represents the same
+ sequence of characters as the string argument.
+
+ The initial
+ capacity of the string buffer is <code>16</code> plus length
+
+ @param value a character array.
+ @param length the number of character which should be copied.
+ The character array length must be greater or
+ equal than this value.
+ */
+ OStringBuffer(const char * value, sal_Int32 length)
+ : pData(NULL)
+ , nCapacity( length + 16 )
+ {
+ rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
+ }
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /**
+ @overload
+ @internal
+ */
+ template< typename T1, typename T2 >
+ OStringBuffer( OStringConcat< T1, T2 >&& c )
+ {
+ const sal_Int32 l = c.length();
+ nCapacity = l + 16;
+ pData = rtl_string_alloc( nCapacity );
+ char* end = c.addData( pData->buffer );
+ *end = '\0';
+ pData->length = l;
+ }
+
+ /**
+ @overload
+ @internal
+ */
+ template< typename T >
+ OStringBuffer( OStringNumber< T >&& n )
+ : OStringBuffer( OString( n ))
+ {}
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ operator std::string_view() const { return {getStr(), sal_uInt32(getLength())}; }
+#endif
+
+ /** Assign to this a copy of value.
+ */
+ OStringBuffer& operator = ( const OStringBuffer& value )
+ {
+ if (this != &value)
+ {
+ rtl_stringbuffer_newFromStringBuffer(&pData,
+ value.nCapacity,
+ value.pData);
+ nCapacity = value.nCapacity;
+ }
+ return *this;
+ }
+
+ /** Assign from a string.
+
+ @since LibreOffice 5.3
+ */
+#if defined LIBO_INTERNAL_ONLY
+ OStringBuffer & operator =(std::string_view string) {
+ sal_Int32 n = string.length();
+ if (n >= nCapacity) {
+ ensureCapacity(n + 16); //TODO: check for overflow
+ }
+ std::memcpy(pData->buffer, string.data(), n);
+ pData->buffer[n] = '\0';
+ pData->length = n;
+ return *this;
+ }
+#else
+ OStringBuffer & operator =(OString const & string) {
+ sal_Int32 n = string.getLength();
+ if (n >= nCapacity) {
+ ensureCapacity(n + 16); //TODO: check for overflow
+ }
+ std::memcpy(pData->buffer, string.pData->buffer, n + 1);
+ pData->length = n;
+ return *this;
+ }
+#endif
+
+ /** Assign from a string literal.
+
+ @since LibreOffice 5.3
+ */
+ template<typename T>
+ typename
+ libreoffice_internal::ConstCharArrayDetector<T, OStringBuffer &>::Type
+ operator =(T & literal) {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ sal_Int32 const n
+ = libreoffice_internal::ConstCharArrayDetector<T>::length;
+ if (n >= nCapacity) {
+ ensureCapacity(n + 16); //TODO: check for overflow
+ }
+ std::memcpy(
+ pData->buffer,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ n + 1);
+ pData->length = n;
+ return *this;
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T1, typename T2>
+ OStringBuffer & operator =(OStringConcat<T1, T2> && concat) {
+ sal_Int32 const n = concat.length();
+ if (n >= nCapacity) {
+ ensureCapacity(n + 16); //TODO: check for overflow
+ }
+ *concat.addData(pData->buffer) = 0;
+ pData->length = n;
+ return *this;
+ }
+
+ /** @overload @internal */
+ template<typename T>
+ OStringBuffer & operator =(OStringNumber<T> && n)
+ {
+ *this = OStringBuffer( std::move ( n ));
+ return *this;
+ }
+#endif
+
+ /**
+ Release the string data.
+ */
+ ~OStringBuffer()
+ {
+ rtl_string_release( pData );
+ }
+
+ /**
+ Fill the string data in the new string and clear the buffer.
+
+ This method is more efficient than the constructor of the string. It does
+ not copy the buffer.
+
+ @return the string previously contained in the buffer.
+ */
+ SAL_WARN_UNUSED_RESULT OString makeStringAndClear()
+ {
+ OString aRet( pData );
+ rtl_string_new(&pData);
+ nCapacity = 0;
+ return aRet;
+ }
+
+ /**
+ Returns the length (character count) of this string buffer.
+
+ @return the number of characters in this string buffer.
+ */
+ sal_Int32 getLength() const
+ {
+ return pData->length;
+ }
+
+ /**
+ Checks if a string buffer is empty.
+
+ @return true if the string buffer is empty;
+ false, otherwise.
+
+ @since LibreOffice 4.1
+ */
+ bool isEmpty() const
+ {
+ return pData->length == 0;
+ }
+
+ /**
+ Returns the current capacity of the String buffer.
+
+ The capacity
+ is the amount of storage available for newly inserted
+ characters. The real buffer size is 2 bytes longer, because
+ all strings are 0 terminated.
+
+ @return the current capacity of this string buffer.
+ */
+ sal_Int32 getCapacity() const
+ {
+ return nCapacity;
+ }
+
+ /**
+ Ensures that the capacity of the buffer is at least equal to the
+ specified minimum.
+
+ The new capacity will be at least as large as the maximum of the current
+ length (so that no contents of the buffer is destroyed) and the given
+ minimumCapacity. If the given minimumCapacity is negative, nothing is
+ changed.
+
+ @param minimumCapacity the minimum desired capacity.
+ */
+ void ensureCapacity(sal_Int32 minimumCapacity)
+ {
+ rtl_stringbuffer_ensureCapacity( &pData, &nCapacity, minimumCapacity );
+ }
+
+ /**
+ Sets the length of this String buffer.
+
+ If the <code>newLength</code> argument is less than the current
+ length of the string buffer, the string buffer is truncated to
+ contain exactly the number of characters given by the
+ <code>newLength</code> argument.
+ <p>
+ If the <code>newLength</code> argument is greater than or equal
+ to the current length, sufficient null characters
+ (<code>'&#92;u0000'</code>) are appended to the string buffer so that
+ length becomes the <code>newLength</code> argument.
+ <p>
+ The <code>newLength</code> argument must be greater than or equal
+ to <code>0</code>.
+
+ @param newLength the new length of the buffer.
+ */
+ void setLength(sal_Int32 newLength)
+ {
+ assert(newLength >= 0);
+ // Avoid modifications if pData points to const empty string:
+ if( newLength != pData->length )
+ {
+ if( newLength > nCapacity )
+ rtl_stringbuffer_ensureCapacity(&pData, &nCapacity, newLength);
+ else
+ pData->buffer[newLength] = '\0';
+ pData->length = newLength;
+ }
+ }
+
+ /**
+ Returns the character at a specific index in this string buffer.
+
+ The first character of a string buffer is at index
+ <code>0</code>, the next at index <code>1</code>, and so on, for
+ array indexing.
+ <p>
+ The index argument must be greater than or equal to
+ <code>0</code>, and less than the length of this string buffer.
+
+ @param index the index of the desired character.
+ @return the character at the specified index of this string buffer.
+ */
+ SAL_DEPRECATED("use rtl::OStringBuffer::operator [] instead")
+ char charAt( sal_Int32 index )
+ {
+ assert(index >= 0 && index < pData->length);
+ return pData->buffer[ index ];
+ }
+
+ /**
+ The character at the specified index of this string buffer is set
+ to <code>ch</code>.
+
+ The index argument must be greater than or equal to
+ <code>0</code>, and less than the length of this string buffer.
+
+ @param index the index of the character to modify.
+ @param ch the new character.
+ */
+ SAL_DEPRECATED("use rtl::OStringBuffer::operator [] instead")
+ OStringBuffer & setCharAt(sal_Int32 index, char ch)
+ {
+ assert(index >= 0 && index < pData->length);
+ pData->buffer[ index ] = ch;
+ return *this;
+ }
+
+ /**
+ Return a null terminated character array.
+ */
+ const char* getStr() const SAL_RETURNS_NONNULL { return pData->buffer; }
+
+ /**
+ Access to individual characters.
+
+ @param index must be non-negative and less than length.
+
+ @return a reference to the character at the given index.
+
+ @since LibreOffice 3.5
+ */
+ char & operator [](sal_Int32 index)
+ {
+ assert(index >= 0 && index < pData->length);
+ return pData->buffer[index];
+ }
+
+ /**
+ Return an OString instance reflecting the current content
+ of this OStringBuffer.
+ */
+ OString toString() const
+ {
+ return OString(pData->buffer, pData->length);
+ }
+
+#if !defined LIBO_INTERNAL_ONLY
+ /**
+ Appends the string to this string buffer.
+
+ The characters of the <code>String</code> argument are appended, in
+ order, to the contents of this string buffer, increasing the
+ length of this string buffer by the length of the argument.
+
+ @param str a string.
+ @return this string buffer.
+ */
+ OStringBuffer & append(const OString &str)
+ {
+ return append( str.getStr(), str.getLength() );
+ }
+#endif
+
+ /**
+ Appends the string representation of the <code>char</code> array
+ argument to this string buffer.
+
+ The characters of the array argument are appended, in order, to
+ the contents of this string buffer. The length of this string
+ buffer increases by the length of the argument.
+
+ @param str the characters to be appended.
+ @return this string buffer.
+ */
+ template< typename T >
+ typename libreoffice_internal::CharPtrDetector< T, OStringBuffer& >::Type append( const T& str )
+ {
+ return append( str, rtl_str_getLength( str ) );
+ }
+
+ template< typename T >
+ typename libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer& >::Type append( T& str )
+ {
+ return append( str, rtl_str_getLength( str ) );
+ }
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer& >::Type append( T& literal )
+ {
+ RTL_STRING_CONST_FUNCTION
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return append(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+
+ /**
+ Appends the string representation of the <code>char</code> array
+ argument to this string buffer.
+
+ Characters of the character array <code>str</code> are appended,
+ in order, to the contents of this string buffer. The length of this
+ string buffer increases by the value of <code>len</code>.
+
+ @param str the characters to be appended; must be non-null, and must
+ point to at least len characters
+ @param len the number of characters to append; must be non-negative
+ @return this string buffer.
+ */
+ OStringBuffer & append( const char * str, sal_Int32 len)
+ {
+ assert( len == 0 || str != NULL ); // cannot assert that in rtl_stringbuffer_insert
+ rtl_stringbuffer_insert( &pData, &nCapacity, getLength(), str, len );
+ return *this;
+ }
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /**
+ @overload
+ @internal
+ */
+ template< typename T1, typename T2 >
+ OStringBuffer& append( OStringConcat< T1, T2 >&& c )
+ {
+ sal_Int32 l = c.length();
+ if( l == 0 )
+ return *this;
+ l += pData->length;
+ rtl_stringbuffer_ensureCapacity( &pData, &nCapacity, l );
+ char* end = c.addData( pData->buffer + pData->length );
+ *end = '\0';
+ pData->length = l;
+ return *this;
+ }
+
+ /**
+ @overload
+ @internal
+ */
+ template< typename T >
+ OStringBuffer& append( OStringNumber< T >&& c )
+ {
+ return append( c.buf, c.length );
+ }
+
+ /**
+ @overload
+ @internal
+ */
+ OStringBuffer& append( std::string_view s )
+ {
+ return append( s.data(), s.size() );
+ }
+
+#endif
+
+ /**
+ Appends the string representation of the <code>sal_Bool</code>
+ argument to the string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param b a <code>sal_Bool</code>.
+ @return this string buffer.
+ */
+ OStringBuffer & append(sal_Bool b)
+ {
+ char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
+ return append( sz, rtl_str_valueOfBoolean( sz, b ) );
+ }
+
+ /**
+ Appends the string representation of the <code>bool</code>
+ argument to the string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param b a <code>bool</code>.
+ @return this string buffer.
+
+ @since LibreOffice 4.3
+ */
+ OStringBuffer & append(bool b)
+ {
+ char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
+ return append( sz, rtl_str_valueOfBoolean( sz, b ) );
+ }
+
+ /// @cond INTERNAL
+ // Pointer can be automatically converted to bool, which is unwanted here.
+ // Explicitly delete all pointer append() overloads to prevent this
+ // (except for char* overload, which is handled elsewhere).
+ template< typename T >
+ typename libreoffice_internal::Enable< void,
+ !libreoffice_internal::CharPtrDetector< T* >::ok >::Type
+ append( T* ) SAL_DELETED_FUNCTION;
+ /// @endcond
+
+ /**
+ Appends the string representation of the <code>char</code>
+ argument to this string buffer.
+
+ The argument is appended to the contents of this string buffer.
+ The length of this string buffer increases by <code>1</code>.
+
+ @param c a <code>char</code>.
+ @return this string buffer.
+ */
+ OStringBuffer & append(char c)
+ {
+ return append( &c, 1 );
+ }
+
+ /**
+ Appends the string representation of the <code>sal_Int32</code>
+ argument to this string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param i an <code>sal_Int32</code>.
+ @param radix the radix
+ @return this string buffer.
+ */
+ OStringBuffer & append(sal_Int32 i, sal_Int16 radix = 10 )
+ {
+ char sz[RTL_STR_MAX_VALUEOFINT32];
+ return append( sz, rtl_str_valueOfInt32( sz, i, radix ) );
+ }
+
+ /**
+ Appends the string representation of the <code>long</code>
+ argument to this string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param l a <code>long</code>.
+ @param radix the radix
+ @return this string buffer.
+ */
+ OStringBuffer & append(sal_Int64 l, sal_Int16 radix = 10 )
+ {
+ char sz[RTL_STR_MAX_VALUEOFINT64];
+ return append( sz, rtl_str_valueOfInt64( sz, l, radix ) );
+ }
+
+ /**
+ Appends the string representation of the <code>float</code>
+ argument to this string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param f a <code>float</code>.
+ @return this string buffer.
+ */
+ OStringBuffer & append(float f)
+ {
+ char sz[RTL_STR_MAX_VALUEOFFLOAT];
+ return append( sz, rtl_str_valueOfFloat( sz, f ) );
+ }
+
+ /**
+ Appends the string representation of the <code>double</code>
+ argument to this string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param d a <code>double</code>.
+ @return this string buffer.
+ */
+ OStringBuffer & append(double d)
+ {
+ char sz[RTL_STR_MAX_VALUEOFDOUBLE];
+ return append( sz, rtl_str_valueOfDouble( sz, d ) );
+ }
+
+ /**
+ Unsafe way to make space for a fixed amount of characters to be appended
+ into this OStringBuffer.
+
+ A call to this function must immediately be followed by code that
+ completely fills the uninitialized block pointed to by the return value.
+
+ @param length the length of the uninitialized block of char entities;
+ must be non-negative
+
+ @return a pointer to the start of the uninitialized block; only valid
+ until this OStringBuffer's capacity changes
+
+ @since LibreOffice 4.4
+ */
+ char * appendUninitialized(sal_Int32 length) SAL_RETURNS_NONNULL {
+ sal_Int32 n = getLength();
+ rtl_stringbuffer_insert(&pData, &nCapacity, n, NULL, length);
+ return pData->buffer + n;
+ }
+
+ /**
+ Inserts the string into this string buffer.
+
+ The characters of the <code>String</code> argument are inserted, in
+ order, into this string buffer at the indicated offset. The length
+ of this string buffer is increased by the length of the argument.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param str a string.
+ @return this string buffer.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ OStringBuffer & insert(sal_Int32 offset, std::string_view str)
+ {
+ return insert( offset, str.data(), str.length() );
+ }
+#else
+ OStringBuffer & insert(sal_Int32 offset, const OString & str)
+ {
+ return insert( offset, str.getStr(), str.getLength() );
+ }
+#endif
+
+ /**
+ Inserts the string representation of the <code>char</code> array
+ argument into this string buffer.
+
+ The characters of the array argument are inserted into the
+ contents of this string buffer at the position indicated by
+ <code>offset</code>. The length of this string buffer increases by
+ the length of the argument.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param str a character array.
+ @return this string buffer.
+ */
+ template< typename T >
+ typename libreoffice_internal::CharPtrDetector< T, OStringBuffer& >::Type insert( sal_Int32 offset, const T& str )
+ {
+ return insert( offset, str, rtl_str_getLength( str ) );
+ }
+
+ template< typename T >
+ typename libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer& >::Type insert( sal_Int32 offset, T& str )
+ {
+ return insert( offset, str, rtl_str_getLength( str ) );
+ }
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer& >::Type insert( sal_Int32 offset, T& literal )
+ {
+ RTL_STRING_CONST_FUNCTION
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return insert(
+ offset,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+
+ /**
+ Inserts the string representation of the <code>char</code> array
+ argument into this string buffer.
+
+ The characters of the array argument are inserted into the
+ contents of this string buffer at the position indicated by
+ <code>offset</code>. The length of this string buffer increases by
+ the length of the argument.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param str a character array.
+ @param len the number of characters to append.
+ @return this string buffer.
+ */
+ OStringBuffer & insert( sal_Int32 offset, const char * str, sal_Int32 len)
+ {
+ assert( len == 0 || str != NULL ); // cannot assert that in rtl_stringbuffer_insert
+ rtl_stringbuffer_insert( &pData, &nCapacity, offset, str, len );
+ return *this;
+ }
+
+ /**
+ Inserts the string representation of the <code>sal_Bool</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param b a <code>sal_Bool</code>.
+ @return this string buffer.
+ */
+ OStringBuffer & insert(sal_Int32 offset, sal_Bool b)
+ {
+ char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
+ return insert( offset, sz, rtl_str_valueOfBoolean( sz, b ) );
+ }
+
+ /**
+ Inserts the string representation of the <code>bool</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>OString::boolean</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param b a <code>bool</code>.
+ @return this string buffer.
+
+ @since LibreOffice 4.3
+ */
+ OStringBuffer & insert(sal_Int32 offset, bool b)
+ {
+ char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
+ return insert( offset, sz, rtl_str_valueOfBoolean( sz, b ) );
+ }
+
+ /**
+ Inserts the string representation of the <code>char</code>
+ argument into this string buffer.
+
+ The second argument is inserted into the contents of this string
+ buffer at the position indicated by <code>offset</code>. The length
+ of this string buffer increases by one.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param c a <code>char</code>.
+ @return this string buffer.
+ */
+ OStringBuffer & insert(sal_Int32 offset, char c)
+ {
+ return insert( offset, &c, 1 );
+ }
+
+ /**
+ Inserts the string representation of the second <code>sal_Int32</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param i an <code>sal_Int32</code>.
+ @param radix the radix
+ @return this string buffer.
+ */
+ OStringBuffer & insert(sal_Int32 offset, sal_Int32 i, sal_Int16 radix = 10 )
+ {
+ char sz[RTL_STR_MAX_VALUEOFINT32];
+ return insert( offset, sz, rtl_str_valueOfInt32( sz, i, radix ) );
+ }
+
+ /**
+ Inserts the string representation of the <code>long</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param l a <code>long</code>.
+ @param radix the radix
+ @return this string buffer.
+ */
+ OStringBuffer & insert(sal_Int32 offset, sal_Int64 l, sal_Int16 radix = 10 )
+ {
+ char sz[RTL_STR_MAX_VALUEOFINT64];
+ return insert( offset, sz, rtl_str_valueOfInt64( sz, l, radix ) );
+ }
+
+ /**
+ Inserts the string representation of the <code>float</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param f a <code>float</code>.
+ @return this string buffer.
+ */
+ OStringBuffer insert(sal_Int32 offset, float f)
+ {
+ char sz[RTL_STR_MAX_VALUEOFFLOAT];
+ return insert( offset, sz, rtl_str_valueOfFloat( sz, f ) );
+ }
+
+ /**
+ Inserts the string representation of the <code>double</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param d a <code>double</code>.
+ @return this string buffer.
+ */
+ OStringBuffer & insert(sal_Int32 offset, double d)
+ {
+ char sz[RTL_STR_MAX_VALUEOFDOUBLE];
+ return insert( offset, sz, rtl_str_valueOfDouble( sz, d ) );
+ }
+
+ /**
+ Removes the characters in a substring of this sequence.
+
+ The substring begins at the specified <code>start</code> and
+ is <code>len</code> characters long.
+
+ start must be >= 0 && <= getLength() && <= end
+
+ @param start The beginning index, inclusive
+ @param len The substring length
+ @return this string buffer.
+ */
+ OStringBuffer & remove( sal_Int32 start, sal_Int32 len )
+ {
+ rtl_stringbuffer_remove( &pData, start, len );
+ return *this;
+ }
+
+ /** Allows access to the internal data of this OStringBuffer, for effective
+ manipulation.
+
+ This function should be used with care. After you have called this
+ function, you may use the returned pInternalData and pInternalCapacity
+ only as long as you make no other calls on this OStringBuffer.
+
+ @param pInternalData
+ This output parameter receives a pointer to the internal data
+ (rtl_String pointer). pInternalData itself must not be null.
+
+ @param pInternalCapacity
+ This output parameter receives a pointer to the internal capacity.
+ pInternalCapacity itself must not be null.
+
+ @since LibreOffice 5.4
+ */
+ void accessInternals(
+ rtl_String *** pInternalData, sal_Int32 ** pInternalCapacity)
+ {
+ *pInternalData = &pData;
+ *pInternalCapacity = &nCapacity;
+ }
+
+private:
+ /**
+ A pointer to the data structure which contains the data.
+ */
+ rtl_String * pData;
+
+ /**
+ The len of the pData->buffer.
+ */
+ sal_Int32 nCapacity;
+};
+
+#if defined LIBO_INTERNAL_ONLY
+template<> struct ToStringHelper<OStringBuffer> {
+ static std::size_t length(OStringBuffer const & s) { return s.getLength(); }
+
+ static char * addData(char * buffer, OStringBuffer const & s) SAL_RETURNS_NONNULL
+ { return addDataHelper(buffer, s.getStr(), s.getLength()); }
+
+ static constexpr bool allowOStringConcat = true;
+ static constexpr bool allowOUStringConcat = false;
+};
+#endif
+
+}
+
+#ifdef RTL_STRING_UNITTEST
+namespace rtl
+{
+typedef rtlunittest::OStringBuffer OStringBuffer;
+}
+#undef RTL_STRING_CONST_FUNCTION
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
+using ::rtl::OStringBuffer;
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/string.h b/include/rtl/string.h
new file mode 100644
index 000000000..f80bef02c
--- /dev/null
+++ b/include/rtl/string.h
@@ -0,0 +1,1462 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_STRING_H
+#define INCLUDED_RTL_STRING_H
+
+#include "sal/config.h"
+
+#include "osl/interlck.h"
+#include "rtl/textcvt.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ======================================================================= */
+
+/** Return the length of a string.
+
+ The length is equal to the number of 8-bit characters in the string,
+ without the terminating NUL character.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ the length of the sequence of characters represented by this string,
+ excluding the terminating NUL character.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_getLength(
+ const char * str ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting. Both strings must be
+ null-terminated.
+
+ @param first
+ the first null-terminated string to be compared.
+
+ @param second
+ the second null-terminated string which is compared with the first one.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string is
+ less than the second string, and a value greater than 0 if the first
+ string is greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_compare(
+ const char * first, const char * second ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string is
+ less than the second string, and a value greater than 0 if the first
+ string is greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_compare_WithLength(
+ const char * first, sal_Int32 firstLen, const char * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings with a maximum count of characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @param shortenedLen
+ the maximum number of characters to compare. This length can be greater
+ or smaller than the lengths of the two strings.
+
+ @return
+ 0 if both substrings are equal, a value less than 0 if the first substring
+ is less than the second substring, and a value greater than 0 if the first
+ substring is greater than the second substring.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_shortenedCompare_WithLength(
+ const char * first, sal_Int32 firstLen, const char * second, sal_Int32 secondLen, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings from back to front.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string
+ compares less than the second string, and a value greater than 0 if the
+ first string compares greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_reverseCompare_WithLength(
+ const char * first, sal_Int32 firstLen, const char * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings, ignoring the case of ASCII characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. Character
+ values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
+ and 122 (ASCII a--z). This function cannot be used for language-specific
+ sorting. Both strings must be null-terminated.
+
+ @param first
+ the first null-terminated string to be compared.
+
+ @param second
+ the second null-terminated string which is compared with the first one.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string is
+ less than the second string, and a value greater than 0 if the first
+ string is greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_compareIgnoreAsciiCase(
+ const char * first, const char * second ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings, ignoring the case of ASCII characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. Character
+ values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
+ and 122 (ASCII a--z). This function cannot be used for language-specific
+ sorting.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string is
+ less than the second string, and a value greater than 0 if the first
+ string is greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_compareIgnoreAsciiCase_WithLength(
+ const char * first, sal_Int32 firstLen, const char * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings with a maximum count of characters, ignoring the case
+ of ASCII characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. Character
+ values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
+ and 122 (ASCII a--z). This function cannot be used for language-specific
+ sorting.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @param shortenedLen
+ the maximum number of characters to compare. This length can be greater
+ or smaller than the lengths of the two strings.
+
+ @return
+ 0 if both substrings are equal, a value less than 0 if the first substring
+ is less than the second substring, and a value greater than 0 if the first
+ substring is greater than the second substring.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
+ const char * first, sal_Int32 firstLen, const char * second, sal_Int32 secondLen, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C();
+
+/** Return a hash code for a string.
+
+ It is not allowed to store the hash code persistently, because later
+ versions could return other hash codes. The string must be
+ null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ a hash code for the given string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_hashCode(
+ const char * str ) SAL_THROW_EXTERN_C();
+
+/** Return a hash code for a string.
+
+ It is not allowed to store the hash code persistently, because later
+ versions could return other hash codes.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @return
+ a hash code for the given string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_hashCode_WithLength(
+ const char * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Search for the first occurrence of a character within a string.
+
+ The string must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param ch
+ the character to be searched for.
+
+ @return
+ the index (starting at 0) of the first occurrence of the character in the
+ string, or -1 if the character does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_indexOfChar(
+ const char * str, char ch ) SAL_THROW_EXTERN_C();
+
+/** Search for the first occurrence of a character within a string.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @param ch
+ the character to be searched for.
+
+ @return
+ the index (starting at 0) of the first occurrence of the character in the
+ string, or -1 if the character does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_indexOfChar_WithLength(
+ const char * str, sal_Int32 len, char ch ) SAL_THROW_EXTERN_C();
+
+/** Search for the last occurrence of a character within a string.
+
+ The string must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param ch
+ the character to be searched for.
+
+ @return
+ the index (starting at 0) of the last occurrence of the character in the
+ string, or -1 if the character does not occur. The returned value is
+ always smaller than the string length.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_lastIndexOfChar(
+ const char * str, char ch ) SAL_THROW_EXTERN_C();
+
+/** Search for the last occurrence of a character within a string.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @param ch
+ the character to be searched for.
+
+ @return
+ the index (starting at 0) of the last occurrence of the character in the
+ string, or -1 if the character does not occur. The returned value is
+ always smaller than the string length.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_lastIndexOfChar_WithLength(
+ const char * str, sal_Int32 len, char ch ) SAL_THROW_EXTERN_C();
+
+/** Search for the first occurrence of a substring within a string.
+
+ If subStr is empty, or both str and subStr are empty, -1 is returned.
+ Both strings must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param subStr
+ the null-terminated substring to be searched for.
+
+ @return
+ the index (starting at 0) of the first character of the first occurrence
+ of the substring within the string, or -1 if the substring does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_indexOfStr(
+ const char * str, const char * subStr ) SAL_THROW_EXTERN_C();
+
+/** Search for the first occurrence of a substring within a string.
+
+ If subStr is empty, or both str and subStr are empty, -1 is returned.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @param subStr
+ the substring to be searched for. Need not be null-terminated, but must
+ be at least as long as the specified subLen.
+
+ @param subLen
+ the length of the substring.
+
+ @return
+ the index (starting at 0) of the first character of the first occurrence
+ of the substring within the string, or -1 if the substring does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_indexOfStr_WithLength(
+ const char * str, sal_Int32 len, const char * subStr, sal_Int32 subLen ) SAL_THROW_EXTERN_C();
+
+/** Search for the last occurrence of a substring within a string.
+
+ If subStr is empty, or both str and subStr are empty, -1 is returned.
+ Both strings must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param subStr
+ the null-terminated substring to be searched for.
+
+ @return
+ the index (starting at 0) of the first character of the last occurrence
+ of the substring within the string, or -1 if the substring does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_lastIndexOfStr(
+ const char * str, const char * subStr ) SAL_THROW_EXTERN_C();
+
+/** Search for the last occurrence of a substring within a string.
+
+ If subStr is empty, or both str and subStr are empty, -1 is returned.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @param subStr
+ the substring to be searched for. Need not be null-terminated, but must
+ be at least as long as the specified subLen.
+
+ @param subLen
+ the length of the substring.
+
+ @return
+ the index (starting at 0) of the first character of the first occurrence
+ of the substring within the string, or -1 if the substring does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_lastIndexOfStr_WithLength(
+ const char * str, sal_Int32 len, const char * subStr, sal_Int32 subLen ) SAL_THROW_EXTERN_C();
+
+/** Replace all occurrences of a single character within a string.
+
+ If oldChar does not occur within str, then the string is not modified.
+ The string must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param oldChar
+ the old character.
+
+ @param newChar
+ the new character.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_str_replaceChar(
+ char * str, char oldChar, char newChar ) SAL_THROW_EXTERN_C();
+
+/** Replace all occurrences of a single character within a string.
+
+ If oldChar does not occur within str, then the string is not modified.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @param oldChar
+ the old character.
+
+ @param newChar
+ the new character.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_str_replaceChar_WithLength(
+ char * str, sal_Int32 len, char oldChar, char newChar ) SAL_THROW_EXTERN_C();
+
+/** Convert all ASCII uppercase letters to lowercase within a string.
+
+ The characters with values between 65 and 90 (ASCII A--Z) are replaced
+ with values between 97 and 122 (ASCII a--z). The string must be
+ null-terminated.
+
+ @param str
+ a null-terminated string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_str_toAsciiLowerCase(
+ char * str ) SAL_THROW_EXTERN_C();
+
+/** Convert all ASCII uppercase letters to lowercase within a string.
+
+ The characters with values between 65 and 90 (ASCII A--Z) are replaced
+ with values between 97 and 122 (ASCII a--z).
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_str_toAsciiLowerCase_WithLength(
+ char * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Convert all ASCII lowercase letters to uppercase within a string.
+
+ The characters with values between 97 and 122 (ASCII a--z) are replaced
+ with values between 65 and 90 (ASCII A--Z). The string must be
+ null-terminated.
+
+ @param str
+ a null-terminated string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_str_toAsciiUpperCase(
+ char * str ) SAL_THROW_EXTERN_C();
+
+/** Convert all ASCII lowercase letters to uppercase within a string.
+
+ The characters with values between 97 and 122 (ASCII a--z) are replaced
+ with values between 65 and 90 (ASCII A--Z).
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_str_toAsciiUpperCase_WithLength(
+ char * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Remove white space from both ends of a string.
+
+ All characters with values less than or equal to 32 (the space character)
+ are considered to be white space. This function cannot be used for
+ language-specific operations. The string must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ the new length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_trim(
+ char * str ) SAL_THROW_EXTERN_C();
+
+/** Remove white space from both ends of the string.
+
+ All characters with values less than or equal to 32 (the space character)
+ are considered to be white space. This function cannot be used for
+ language-specific operations. The string must be null-terminated.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the original length of the string.
+
+ @return
+ the new length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_trim_WithLength(
+ char * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Create the string representation of a boolean.
+
+ If b is true, the buffer is filled with the string "true" and 5 is
+ returned. If b is false, the buffer is filled with the string "false" and
+ 6 is returned. This function cannot be used for language-specific
+ operations.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_STR_MAX_VALUEOFBOOLEAN define to create
+ a buffer that is big enough.
+
+ @param b
+ a boolean value.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfBoolean(
+ char * str, sal_Bool b ) SAL_THROW_EXTERN_C();
+#define RTL_STR_MAX_VALUEOFBOOLEAN 6
+
+/** Create the string representation of a character.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_STR_MAX_VALUEOFCHAR define to create a
+ buffer that is big enough.
+
+ @param ch
+ a character value.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfChar(
+ char * str, char ch ) SAL_THROW_EXTERN_C();
+#define RTL_STR_MAX_VALUEOFCHAR 2
+
+/** Create the string representation of an integer.
+
+ This function cannot be used for language-specific operations.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_STR_MAX_VALUEOFINT32 define to create a
+ buffer that is big enough.
+
+ @param i
+ an integer value.
+
+ @param radix
+ the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfInt32(
+ char * str, sal_Int32 i, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+#define RTL_STR_MIN_RADIX 2
+#define RTL_STR_MAX_RADIX 36
+#define RTL_STR_MAX_VALUEOFINT32 33
+
+/** Create the string representation of a long integer.
+
+ This function cannot be used for language-specific operations.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_STR_MAX_VALUEOFINT64 define to create a
+ buffer that is big enough.
+
+ @param l
+ a long integer value.
+
+ @param radix
+ the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfInt64(
+ char * str, sal_Int64 l, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+#define RTL_STR_MAX_VALUEOFINT64 65
+
+/** Create the string representation of an unsigned long integer.
+
+ This function cannot be used for language-specific operations.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_STR_MAX_VALUEOFUINT64 define to create a
+ buffer that is big enough.
+
+ @param l
+ a long integer value.
+
+ @param radix
+ the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfUInt64(
+ char * str, sal_uInt64 l, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+#define RTL_STR_MAX_VALUEOFUINT64 65
+
+/** Create the string representation of a float.
+
+ This function cannot be used for language-specific conversion.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_STR_MAX_VALUEOFFLOAT define to create a
+ buffer that is big enough.
+
+ @param f
+ a float value.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfFloat(
+ char * str, float f ) SAL_THROW_EXTERN_C();
+#define RTL_STR_MAX_VALUEOFFLOAT 15
+
+/** Create the string representation of a double.
+
+ This function cannot be used for language-specific conversion.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_STR_MAX_VALUEOFDOUBLE define to create
+ a buffer that is big enough.
+
+ @param d
+ a double value.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfDouble(
+ char * str, double d ) SAL_THROW_EXTERN_C();
+#define RTL_STR_MAX_VALUEOFDOUBLE 25
+
+/** Interpret a string as a boolean.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ true if the string is "1" or "true" in any ASCII case, false otherwise.
+ */
+SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_str_toBoolean(
+ const char * str ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as an integer.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param radix
+ the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the integer value represented by the string, or 0 if the string does not
+ represent an integer.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_toInt32(
+ const char * str, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as an unsigned integer.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param radix
+ the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the unsigned integer value represented by the string, or 0 if the string
+ does not represent an unsigned integer.
+
+ @since LibreOffice 4.2
+ */
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL rtl_str_toUInt32(
+ const char * str, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as a long integer.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param radix
+ the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the long integer value represented by the string, or 0 if the string does
+ not represent a long integer.
+ */
+SAL_DLLPUBLIC sal_Int64 SAL_CALL rtl_str_toInt64(
+ const char * str, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as a long integer.
+
+ This function cannot be used for language-specific conversion.
+
+ @param str
+ a string.
+
+ @param radix
+ the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX
+ (36), inclusive.
+
+ @param nStrLength
+ number of chars to process
+
+ @return
+ the long integer value represented by the string, or 0 if the string does
+ not represent a long integer.
+
+ @internal
+ @since LibreOffice 6.4
+*/
+SAL_DLLPUBLIC sal_Int64 SAL_CALL rtl_str_toInt64_WithLength(
+ const char * str, sal_Int16 radix, sal_Int32 nStrLength ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as an unsigned long integer.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param radix
+ the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the unsigned long integer value represented by the string, or 0 if the
+ string does not represent an unsigned long integer.
+
+ @since LibreOffice 4.1
+ */
+SAL_DLLPUBLIC sal_uInt64 SAL_CALL rtl_str_toUInt64(
+ const char * str, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as a float.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ the float value represented by the string, or 0.0 if the string does not
+ represent a float.
+ */
+SAL_DLLPUBLIC float SAL_CALL rtl_str_toFloat(
+ const char * str ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as a double.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ the float value represented by the string, or 0.0 if the string does not
+ represent a double.
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_str_toDouble(
+ const char * str ) SAL_THROW_EXTERN_C();
+
+/* ======================================================================= */
+
+#ifdef _WIN32
+# pragma pack(push, 8)
+#endif
+
+/** @cond INTERNAL */
+/** The implementation of a byte string.
+ */
+typedef struct _rtl_String
+{
+ oslInterlockedCount refCount; /* opaque */
+ sal_Int32 length;
+ char buffer[1];
+} rtl_String;
+/** @endcond */
+
+#if defined(_WIN32)
+#pragma pack(pop)
+#endif
+
+/* ----------------------------------------------------------------------- */
+
+/** Increment the reference count of a string.
+
+ @param str
+ a string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_acquire( rtl_String * str ) SAL_THROW_EXTERN_C();
+
+/** Decrement the reference count of a string.
+
+ If the count goes to zero than the string data is deleted.
+
+ @param str
+ a string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_release( rtl_String * str ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string containing no characters.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_new( rtl_String ** newStr ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string containing space for a given number of characters.
+
+ The reference count of the new string will be 1. The length of the string
+ will be nLen. This function does not handle out-of-memory conditions.
+
+ For failed allocation this method returns NULL.
+
+ The characters of the capacity are not cleared, and the length is set to
+ nLen, unlike the similar method of rtl_String_new_WithLength which
+ zeros out the buffer, and sets the length to 0. So should be somewhat
+ more efficient for allocating a new string.
+
+ call rtl_String_release to release the string
+ alternatively pass ownership to an OUString with
+ rtl::OUString(newStr, SAL_NO_ACQUIRE);
+
+ @param[out] nLen the number of characters. Must be >= 0.
+
+ @return pointer to the new string.
+
+ @since LibreOffice 4.1
+ */
+SAL_DLLPUBLIC rtl_String * SAL_CALL rtl_string_alloc(sal_Int32 nLen) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string containing space for a given number of characters.
+
+ If len is greater than zero, the reference count of the new string will be
+ 1. The values of all characters are set to 0 and the length of the string
+ is 0. This function does not handle out-of-memory conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param len
+ the number of characters.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_new_WithLength( rtl_String ** newStr, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string that contains a copy of another string.
+
+ If the length of value is greater than zero, the reference count of the
+ new string will be 1. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param value
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newFromString( rtl_String ** newStr, const rtl_String * value ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string that contains a copy of a character array.
+
+ If the length of value is greater than zero, the reference count of the
+ new string will be 1. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param value
+ a null-terminated character array.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newFromStr( rtl_String ** newStr, const char * value ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string that contains a copy of a character array.
+
+ If the length of value is greater than zero, the reference count of the
+ new string will be 1. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param value
+ a character array. Need not be null-terminated, but must be at least as
+ long as the specified len.
+
+ @param len
+ the length of the character array.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newFromStr_WithLength( rtl_String ** newStr, const char * value, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string that is a substring of this string.
+
+ The substring begins at the specified beginIndex and contains count
+ characters. Meaningless combinations such as negative beginIndex,
+ or beginIndex + count greater than the length of the string have
+ undefined behaviour.
+
+ @param[out] newStr the specified substring.
+ @param[in] from the String to take the substring from.
+ @param[in] beginIndex the beginning index, inclusive.
+ @param[in] count the number of characters.
+
+ @since LibreOffice 4.0
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newFromSubString(
+ rtl_String ** newStr, const rtl_String * from,
+ sal_Int32 beginIndex, sal_Int32 count ) SAL_THROW_EXTERN_C();
+
+/**
+ @internal
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newFromLiteral( rtl_String ** newStr, const char * value, sal_Int32 len, sal_Int32 allocExtra ) SAL_THROW_EXTERN_C();
+
+/** Assign a new value to a string.
+
+ First releases any value str might currently hold, then acquires
+ rightValue.
+
+ @param str
+ pointer to the string. The pointed-to data must be null or a valid
+ string.
+
+ @param rightValue
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_assign( rtl_String ** str, rtl_String * rightValue ) SAL_THROW_EXTERN_C();
+
+/** Return the length of a string.
+
+ The length is equal to the number of characters in the string.
+
+ @param str
+ a valid string.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_string_getLength( const rtl_String * str ) SAL_THROW_EXTERN_C();
+
+/** Return a pointer to the underlying character array of a string.
+
+ @param str
+ a valid string.
+
+ @return
+ a pointer to the null-terminated character array.
+ */
+SAL_DLLPUBLIC char * SAL_CALL rtl_string_getStr( rtl_String * str ) SAL_THROW_EXTERN_C();
+
+/** Create a new string that is the concatenation of two other strings.
+
+ The new string does not necessarily have a reference count of 1 (in cases
+ where one of the two other strings is empty), so it must not be modified
+ without checking the reference count. This function does not handle
+ out-of-memory conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param left
+ a valid string.
+
+ @param right
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newConcat( rtl_String ** newStr, rtl_String * left, rtl_String * right ) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing a substring of another string.
+
+ The new string results from replacing a number of characters (count),
+ starting at the specified position (index) in the original string (str),
+ with some new substring (subStr). If subStr is null, then only a number
+ of characters is deleted.
+
+ The new string does not necessarily have a reference count of 1, so it
+ must not be modified without checking the reference count. This function
+ does not handle out-of-memory conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a valid string.
+
+ @param idx
+ the index into str at which to start replacement. Must be between 0 and
+ the length of str, inclusive.
+
+ @param count
+ the number of characters to remove. Must not be negative, and the sum of
+ index and count must not exceed the length of str.
+
+ @param subStr
+ either null or a valid string to be inserted.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplaceStrAt(
+ rtl_String ** newStr, rtl_String * str, sal_Int32 idx, sal_Int32 count, rtl_String * subStr ) SAL_THROW_EXTERN_C();
+
+#ifdef LIBO_INTERNAL_ONLY
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplaceStrAt_WithLength (
+ rtl_String ** newStr, rtl_String * str, sal_Int32 idx, sal_Int32 count, char const * subStr, sal_Int32 substrLen ) SAL_THROW_EXTERN_C();
+#endif
+
+/** Create a new string by replacing all occurrences of a single character
+ within another string.
+
+ The new string results from replacing all occurrences of oldChar in str
+ with newChar.
+
+ The new string does not necessarily have a reference count of 1 (in cases
+ where oldChar does not occur in str), so it must not be modified without
+ checking the reference count. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a valid string.
+
+ @param oldChar
+ the old character.
+
+ @param newChar
+ the new character.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplace(
+ rtl_String ** newStr, rtl_String * str, char oldChar, char newChar ) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing the first occurrence of a given substring
+ with another substring.
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_String
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength bytes
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the replacing substring; must not be null and must
+ point to memory of at least \p toLength bytes
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @param[in,out] index pointer to a start index, must not be null; upon entry
+ to the function its value is the index into the original string at which to
+ start searching for the \p from substring, the value must be non-negative
+ and not greater than the original string's length; upon exit from the
+ function its value is the index into the original string at which the
+ replacement took place or -1 if no replacement took place
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplaceFirst(
+ rtl_String ** newStr, rtl_String * str, char const * from,
+ sal_Int32 fromLength, char const * to, sal_Int32 toLength,
+ sal_Int32 * index) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing all occurrences of a given substring with
+ another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_String
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength bytes
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the replacing substring; must not be null and must
+ point to memory of at least \p toLength bytes
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplaceAll(
+ rtl_String ** newStr, rtl_String * str, char const * from,
+ sal_Int32 fromLength, char const * to, sal_Int32 toLength)
+ SAL_THROW_EXTERN_C();
+
+/** Create a new string by converting all ASCII uppercase letters to lowercase
+ within another string.
+
+ The new string results from replacing all characters with values between
+ 65 and 90 (ASCII A--Z) by values between 97 and 122 (ASCII a--z).
+
+ This function cannot be used for language-specific conversion. The new
+ string does not necessarily have a reference count of 1 (in cases where
+ no characters need to be converted), so it must not be modified without
+ checking the reference count. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newToAsciiLowerCase(
+ rtl_String ** newStr, rtl_String * str ) SAL_THROW_EXTERN_C();
+
+/** Create a new string by converting all ASCII lowercase letters to uppercase
+ within another string.
+
+ The new string results from replacing all characters with values between
+ 97 and 122 (ASCII a--z) by values between 65 and 90 (ASCII A--Z).
+
+ This function cannot be used for language-specific conversion. The new
+ string does not necessarily have a reference count of 1 (in cases where
+ no characters need to be converted), so it must not be modified without
+ checking the reference count. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newToAsciiUpperCase(
+ rtl_String ** newStr, rtl_String * str ) SAL_THROW_EXTERN_C();
+
+/** Create a new string by removing white space from both ends of another
+ string.
+
+ The new string results from removing all characters with values less than
+ or equal to 32 (the space character) form both ends of str.
+
+ This function cannot be used for language-specific conversion. The new
+ string does not necessarily have a reference count of 1 (in cases where
+ no characters need to be removed), so it must not be modified without
+ checking the reference count. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newTrim(
+ rtl_String ** newStr, rtl_String * str ) SAL_THROW_EXTERN_C();
+
+/** Create a new string by extracting a single token from another string.
+
+ Starting at index, the next token is searched for. If there is no
+ such token, the result is an empty string. Otherwise, all characters from
+ the start of that token and up to, but not including the next occurrence
+ of cTok make up the resulting token. The return value is the position of
+ the next token, or -1 if no more tokens follow.
+
+ Example code could look like
+ rtl_String * pToken = NULL;
+ sal_Int32 nIndex = 0;
+ do
+ {
+ ...
+ nIndex = rtl_string_getToken(&pToken, pStr, 0, ';', nIndex);
+ ...
+ }
+ while (nIndex >= 0);
+
+ The new string does not necessarily have a reference count of 1, so it
+ must not be modified without checking the reference count. This function
+ does not handle out-of-memory conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string. If either token or index is negative, an empty token is stored in
+ newStr (and -1 is returned).
+
+ @param str
+ a valid string.
+
+ @param token
+ the number of the token to return, starting at index.
+
+ @param cTok
+ the character that separates the tokens.
+
+ @param idx
+ the position at which searching for the token starts. Must not be greater
+ than the length of str.
+
+ @return
+ the index of the next token, or -1 if no more tokens follow.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_string_getToken(
+ rtl_String ** newStr , rtl_String * str, sal_Int32 token, char cTok, sal_Int32 idx ) SAL_THROW_EXTERN_C();
+
+/* ======================================================================= */
+
+/** Supply an ASCII string literal together with its length.
+
+ This macro can be used to compute (some of) the arguments in function calls
+ like rtl::OString(RTL_CONSTASCII_STRINGPARAM("foo")) or
+ rtl::OUString::equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("foo")).
+
+ @param constAsciiStr
+ must be an expression of type "(possibly cv-qualified reference to) array of
+ (possibly cv-qualified) char." Each element of the referenced array must
+ represent an ASCII value in the range 0x00--0x7F. The last element of the
+ referenced array is not considered part of the represented ASCII string, and
+ its value should be 0x00. Depending on where this macro is used, the nature
+ of the supplied expression might be further restricted.
+*/
+// The &foo[0] trick is intentional, it makes sure the type is char* or const char*
+// (plain cast to const char* would not work with non-const char foo[]="a", which seems to be allowed).
+// This is to avoid mistaken use with functions that accept string literals
+// (i.e. const char (&)[N]) where usage of this macro otherwise could match
+// the argument and a following int argument with a default value (e.g. OString::match()).
+#define RTL_CONSTASCII_STRINGPARAM( constAsciiStr ) (&(constAsciiStr)[0]), \
+ ((sal_Int32)SAL_N_ELEMENTS(constAsciiStr)-1)
+
+/** Supply the length of an ASCII string literal.
+
+ This macro can be used to compute arguments in function calls like
+ rtl::OUString::match(other, RTL_CONSTASCII_LENGTH("prefix")).
+
+ @param constAsciiStr
+ must be an expression of type "(possibly cv-qualified reference to) array of
+ (possibly cv-qualified) char." Each element of the referenced array must
+ represent an ASCII value in the range 0x00--0x7F. The last element of the
+ referenced array is not considered part of the represented ASCII string, and
+ its value should be 0x00. Depending on where this macro is used, the nature
+ of the supplied expression might be further restricted.
+*/
+#define RTL_CONSTASCII_LENGTH( constAsciiStr ) ((sal_Int32)(SAL_N_ELEMENTS(constAsciiStr)-1))
+
+/* ======================================================================= */
+
+/* predefined constants for String-Conversion */
+#define OUSTRING_TO_OSTRING_CVTFLAGS (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |\
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |\
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |\
+ RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0)
+
+/* ----------------------------------------------------------------------- */
+
+/** Create a new byte string by converting a Unicode string, using a specific
+ text encoding.
+
+ The lengths of the byte string and the Unicode string may differ (e.g.,
+ for double-byte encodings, UTF-7, UTF-8).
+
+ If the length of the Unicode string is greater than zero, the reference
+ count of the new string will be 1.
+
+ If an out-of-memory condition occurs, newStr will point to a null pointer
+ upon return.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a Unicode character array. Need not be null-terminated, but must be at
+ least as long as the specified len.
+
+ @param len
+ the length of the Unicode character array.
+
+ @param encoding
+ the text encoding to use for conversion.
+
+ @param convertFlags
+ flags which control the conversion. Either use
+ OUSTRING_TO_OSTRING_CVTFLAGS, or see
+ <http://udk.openoffice.org/cpp/man/spec/textconversion.html> for more
+ details.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString2String(
+ rtl_String ** newStr, const sal_Unicode * str, sal_Int32 len, rtl_TextEncoding encoding, sal_uInt32 convertFlags ) SAL_THROW_EXTERN_C();
+
+/**
+ Converts a Unicode string to a byte string, signalling failure.
+
+ @param pTarget
+ An out parameter receiving the converted string. Must not be null itself, and
+ must contain either null or a pointer to a valid rtl_String; the contents are
+ not modified if conversion fails (rtl_convertUStringToString returns false).
+
+ @param pSource
+ The Unicode string. May only be null if nLength is zero.
+
+ @param nLength
+ The length of the Unicode string. Must be non-negative.
+
+ @param nEncoding
+ The text encoding to convert into. Must be an octet encoding (i.e.,
+ rtl_isOctetTextEncoding(nEncoding) must return true).
+
+ @param nFlags
+ A combination of RTL_UNICODETOTEXT_FLAGS that detail how to do the conversion
+ (see rtl_convertUnicodeToText). RTL_UNICODETOTEXT_FLAGS_FLUSH need not be
+ included, it is implicitly assumed. Typical uses are either
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR (fail if a Unicode character cannot be
+ converted to the target nEncoding) or OUSTRING_TO_OSTRING_CVTFLAGS (make a
+ best efforts conversion).
+
+ @return
+ True if the conversion succeeded, false otherwise.
+ */
+SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_convertUStringToString(
+ rtl_String ** pTarget,
+ sal_Unicode const * pSource,
+ sal_Int32 nLength,
+ rtl_TextEncoding nEncoding,
+ sal_uInt32 nFlags)
+ SAL_THROW_EXTERN_C();
+
+/** Ensure a string has enough space for a given number of characters.
+
+ If the given string is large enough and has refcount of 1, it is not altered in any way.
+ Otherwise it is replaced by a copy that has enough space for the given number of characters,
+ data from the source string is copied to the beginning of it, the content of the remaining
+ capacity undefined, the string has refcount of 1, and refcount of the original string is decreased.
+
+ @param str
+ pointer to the string. The pointed-to data must be a valid string.
+
+ @param size
+ the number of characters
+
+ @since LibreOffice 4.1
+ @internal
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string_ensureCapacity( rtl_String ** str, sal_Int32 size ) SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_RTL_STRING_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
new file mode 100644
index 000000000..0e3dad692
--- /dev/null
+++ b/include/rtl/string.hxx
@@ -0,0 +1,2314 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_STRING_HXX
+#define INCLUDED_RTL_STRING_HXX
+
+#include "sal/config.h"
+
+#include <cassert>
+#include <cstddef>
+#include <cstdlib>
+#include <limits>
+#include <new>
+#include <ostream>
+#include <utility>
+#include <string.h>
+
+#if defined LIBO_INTERNAL_ONLY
+#include <string_view>
+#include <type_traits>
+#endif
+
+#include "rtl/textenc.h"
+#include "rtl/string.h"
+#include "rtl/stringutils.hxx"
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+#include "config_global.h"
+#include "rtl/stringconcat.hxx"
+#endif
+
+#ifdef RTL_STRING_UNITTEST
+extern bool rtl_string_unittest_const_literal;
+extern bool rtl_string_unittest_const_literal_function;
+#endif
+
+// The unittest uses slightly different code to help check that the proper
+// calls are made. The class is put into a different namespace to make
+// sure the compiler generates a different (if generating also non-inline)
+// copy of the function and does not merge them together. The class
+// is "brought" into the proper rtl namespace by a typedef below.
+#ifdef RTL_STRING_UNITTEST
+#define rtl rtlunittest
+#endif
+
+namespace rtl
+{
+
+/// @cond INTERNAL
+#ifdef RTL_STRING_UNITTEST
+#undef rtl
+// helper macro to make functions appear more readable
+#define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
+#else
+#define RTL_STRING_CONST_FUNCTION
+#endif
+/// @endcond
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+/**
+A wrapper dressing a string literal as a static-refcount rtl_String.
+
+This class is not part of public API and is meant to be used only in LibreOffice code.
+@since LibreOffice 4.0
+*/
+template<std::size_t N> class SAL_WARN_UNUSED OStringLiteral {
+ static_assert(N != 0);
+ static_assert(N - 1 <= std::numeric_limits<sal_Int32>::max(), "literal too long");
+ friend class OString;
+
+public:
+#if HAVE_CPP_CONSTEVAL
+ consteval
+#else
+ constexpr
+#endif
+ OStringLiteral(char const (&literal)[N]) {
+ assertLayout();
+ assert(literal[N - 1] == '\0');
+ //TODO: Use C++20 constexpr std::copy_n (P0202R3):
+ for (std::size_t i = 0; i != N; ++i) {
+ more.buffer[i] = literal[i];
+ }
+ }
+
+#if defined __cpp_char8_t
+#if HAVE_CPP_CONSTEVAL
+ consteval
+#else
+ constexpr
+#endif
+ explicit OStringLiteral(char8_t const (&literal)[N]) {
+ assertLayout();
+ assert(literal[N - 1] == '\0');
+ //TODO: Use C++20 constexpr std::copy_n (P0202R3):
+ for (std::size_t i = 0; i != N; ++i) {
+ more.buffer[i] = literal[i];
+ }
+ }
+#endif
+
+ constexpr sal_Int32 getLength() const { return more.length; }
+
+ constexpr char const * getStr() const SAL_RETURNS_NONNULL { return more.buffer; }
+
+ constexpr operator std::string_view() const { return {more.buffer, sal_uInt32(more.length)}; }
+
+private:
+ static constexpr void assertLayout() {
+ // These static_asserts verifying the layout compatibility with rtl_String cannot be class
+ // member declarations, as offsetof requires a complete type, so defer them to here:
+ static_assert(std::is_standard_layout_v<OStringLiteral>);
+ static_assert(offsetof(OStringLiteral, str.refCount) == offsetof(OStringLiteral, more.refCount));
+ static_assert(offsetof(OStringLiteral, str.length) == offsetof(OStringLiteral, more.length));
+ static_assert(offsetof(OStringLiteral, str.buffer) == offsetof(OStringLiteral, more.buffer));
+ }
+
+ struct Data {
+ Data() = default;
+
+ oslInterlockedCount refCount = 0x40000000; // SAL_STRING_STATIC_FLAG (sal/rtl/strimp.hxx)
+ sal_Int32 length = N - 1;
+ char buffer[N] = {}; //TODO: drop initialization for C++20 (P1331R2)
+ };
+
+ union {
+ rtl_String str;
+ Data more = {};
+ };
+};
+#endif
+
+/* ======================================================================= */
+
+/**
+ This String class provide base functionality for C++ like 8-Bit
+ character array handling. The advantage of this class is, that it
+ handle all the memory management for you - and it do it
+ more efficient. If you assign a string to another string, the
+ data of both strings are shared (without any copy operation or
+ memory allocation) as long as you do not change the string. This class
+ stores also the length of the string, so that many operations are
+ faster as the C-str-functions.
+
+ This class provides only readonly string handling. So you could create
+ a string and you could only query the content from this string.
+ It provides also functionality to change the string, but this results
+ in every case in a new string instance (in the most cases with an
+ memory allocation). You don't have functionality to change the
+ content of the string. If you want to change the string content, then
+ you should use the OStringBuffer class, which provides these
+ functionalities and avoid too much memory allocation.
+
+ The design of this class is similar to the string classes in Java
+ and so more people should have fewer understanding problems when they
+ use this class.
+*/
+
+class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI OString
+{
+public:
+ /// @cond INTERNAL
+ rtl_String * pData;
+ /// @endcond
+
+ /**
+ New string containing no characters.
+ */
+ OString()
+ {
+ pData = NULL;
+ rtl_string_new( &pData );
+ }
+
+ /**
+ New string from OString.
+
+ @param str an OString.
+ */
+ OString( const OString & str )
+ {
+ pData = str.pData;
+ rtl_string_acquire( pData );
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /**
+ Move constructor.
+
+ @param str an OString.
+ @since LibreOffice 5.2
+ */
+ OString( OString && str ) noexcept
+ {
+ pData = str.pData;
+ str.pData = nullptr;
+ rtl_string_new( &str.pData );
+ }
+#endif
+
+ /**
+ New string from OString data.
+
+ @param str an OString data.
+ */
+ OString( rtl_String * str )
+ {
+ pData = str;
+ rtl_string_acquire( pData );
+ }
+
+ /** New string from OString data without acquiring it. Takeover of ownership.
+
+ The SAL_NO_ACQUIRE dummy parameter is only there to distinguish this
+ from other constructors.
+
+ @param str an OString data.
+ */
+ OString( rtl_String * str, __sal_NoAcquire )
+ {
+ pData = str;
+ }
+
+ /**
+ New string from a single character.
+
+ @param value a character.
+ */
+ explicit OString( char value )
+ : pData (NULL)
+ {
+ rtl_string_newFromStr_WithLength( &pData, &value, 1 );
+ }
+
+#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST_CONCAT
+ // Catch inadvertent conversions to the above ctor (e.g., from sal_[u]Int8, aka [un]signed
+ // char):
+ OString(int) = delete;
+#endif
+
+ /**
+ New string from a character buffer array.
+
+ Note: The argument type is always either char* or const char*. The template is
+ used only for technical reasons, as is the second argument.
+
+ @param value a NULL-terminated character array.
+ */
+ template< typename T >
+ OString( const T& value, typename libreoffice_internal::CharPtrDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy() )
+ {
+ pData = NULL;
+ rtl_string_newFromStr( &pData, value );
+ }
+
+ template< typename T >
+ OString( T& value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy() )
+ {
+ pData = NULL;
+ rtl_string_newFromStr( &pData, value );
+ }
+
+ /**
+ New string from a string literal.
+
+ If there are any embedded \0's in the string literal, the result is undefined.
+ Use the overload that explicitly accepts length.
+
+ @since LibreOffice 3.6
+
+ @param literal a string literal
+ */
+ template< typename T >
+ OString( T& literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy() )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ pData = NULL;
+ if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
+ rtl_string_new(&pData);
+ } else {
+ rtl_string_newFromLiteral(
+ &pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
+ }
+#ifdef RTL_STRING_UNITTEST
+ rtl_string_unittest_const_literal = true;
+#endif
+ }
+
+ /**
+ New string from a character buffer array.
+
+ @param value a character array.
+ @param length the number of character which should be copied.
+ The character array length must be greater or
+ equal than this value.
+ */
+ OString( const char * value, sal_Int32 length )
+ {
+ pData = NULL;
+ rtl_string_newFromStr_WithLength( &pData, value, length );
+ }
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /// @cond INTERNAL
+ /**
+ New string from an 8-Bit string literal.
+
+ @since LibreOffice 7.1
+ */
+ template<std::size_t N> constexpr OString(OStringLiteral<N> const & literal):
+ pData(const_cast<rtl_String *>(&literal.str)) {}
+ template<std::size_t N> OString(OStringLiteral<N> &&) = delete;
+ /// @endcond
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ explicit OString(std::string_view sv) {
+ if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
+ throw std::bad_alloc();
+ }
+ pData = nullptr;
+ rtl_string_newFromStr_WithLength(&pData, sv.data(), sv.size());
+ }
+#endif
+
+ /**
+ New string from a Unicode character buffer array.
+
+ @param value a Unicode character array.
+ @param length the number of character which should be converted.
+ The Unicode character array length must be
+ greater or equal than this value.
+ @param encoding the text encoding in which the Unicode character
+ sequence should be converted.
+ @param convertFlags flags which controls the conversion.
+ see RTL_UNICODETOTEXT_FLAGS_...
+
+ @exception std::bad_alloc is thrown if an out-of-memory condition occurs
+ */
+ OString( const sal_Unicode * value, sal_Int32 length,
+ rtl_TextEncoding encoding,
+ sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
+ {
+ pData = NULL;
+ rtl_uString2String( &pData, value, length, encoding, convertFlags );
+ if (pData == NULL) {
+ throw std::bad_alloc();
+ }
+ }
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /**
+ @overload
+ @internal
+ */
+ template< typename T1, typename T2 >
+ OString( OStringConcat< T1, T2 >&& c )
+ {
+ const sal_Int32 l = c.length();
+ pData = rtl_string_alloc( l );
+ if (l != 0)
+ {
+ char* end = c.addData( pData->buffer );
+ pData->length = l;
+ *end = '\0';
+ }
+ }
+
+ /**
+ @overload
+ @internal
+ */
+ template< typename T >
+ OString( OStringNumber< T >&& n )
+ : OString( n.buf, n.length )
+ {}
+#endif
+
+#ifdef LIBO_INTERNAL_ONLY
+ OString(std::nullptr_t) = delete;
+#endif
+
+ /**
+ Release the string data.
+ */
+ ~OString()
+ {
+ rtl_string_release( pData );
+ }
+
+ /**
+ Assign a new string.
+
+ @param str an OString.
+ */
+ OString & operator=( const OString & str )
+ {
+ rtl_string_assign( &pData, str.pData );
+ return *this;
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /**
+ Move assign a new string.
+
+ @param str an OString.
+ @since LibreOffice 5.2
+ */
+ OString & operator=( OString && str ) noexcept
+ {
+ rtl_string_release( pData );
+ pData = str.pData;
+ str.pData = nullptr;
+ rtl_string_new( &str.pData );
+ return *this;
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, OString& >::Type operator=( T& literal )
+ {
+ RTL_STRING_CONST_FUNCTION
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
+ rtl_string_new(&pData);
+ } else {
+ rtl_string_newFromLiteral(
+ &pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
+ }
+ return *this;
+ }
+
+ /**
+ Append a string to this string.
+
+ @param str an OString.
+ */
+ OString & operator+=( const OString & str )
+#if defined LIBO_INTERNAL_ONLY
+ &
+#endif
+ {
+ rtl_string_newConcat( &pData, pData, str.pData );
+ return *this;
+ }
+#if defined LIBO_INTERNAL_ONLY
+ void operator+=(OString const &) && = delete;
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ template<typename T> typename libreoffice_internal::CharPtrDetector<T, OString &>::Type
+ operator +=(T const & value) & { return operator +=(std::string_view(value)); }
+ template<typename T> typename libreoffice_internal::CharPtrDetector<T, OString &>::Type
+ operator +=(T const &) && = delete;
+
+ template<typename T>
+ typename libreoffice_internal::NonConstCharArrayDetector<T, OString &>::Type
+ operator +=(T & value) & { return operator +=(std::string_view(value)); }
+ template<typename T>
+ typename libreoffice_internal::NonConstCharArrayDetector<T, OString &>::Type operator +=(T &) &&
+ = delete;
+
+ template<typename T> typename libreoffice_internal::ConstCharArrayDetector<T, OString &>::Type
+ operator +=(T & literal) & {
+ assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return operator +=(
+ std::string_view(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length));
+ }
+ template<typename T> typename libreoffice_internal::ConstCharArrayDetector<T, OString &>::Type
+ operator +=(T &) && = delete;
+
+ template<std::size_t N> OString & operator +=(OStringLiteral<N> const & literal) &
+ { return operator +=(std::string_view(literal.getStr(), literal.getLength())); }
+ template<std::size_t N> void operator +=(OStringLiteral<N> const &) && = delete;
+
+ OString & operator +=(std::string_view sv) & {
+ if (sv.empty()) {
+ return *this;
+ }
+ if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max() - pData->length)) {
+ throw std::bad_alloc();
+ }
+ auto const l = pData->length + sv.size();
+ rtl_string_ensureCapacity(&pData, l);
+ *addDataHelper(pData->buffer + pData->length, sv.data(), sv.size()) = '\0';
+ pData->length = l;
+ return *this;
+ }
+ void operator +=(std::string_view) && = delete;
+#endif
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /**
+ @overload
+ @internal
+ */
+ template< typename T1, typename T2 >
+ OString& operator+=( OStringConcat< T1, T2 >&& c ) & {
+ sal_Int32 l = c.length();
+ if( l == 0 )
+ return *this;
+ l += pData->length;
+ rtl_string_ensureCapacity( &pData, l );
+ char* end = c.addData( pData->buffer + pData->length );
+ *end = '\0';
+ pData->length = l;
+ return *this;
+ }
+ template<typename T1, typename T2> void operator +=(
+ OStringConcat<T1, T2> &&) && = delete;
+
+ /**
+ @overload
+ @internal
+ */
+ template< typename T >
+ OString& operator+=( OStringNumber< T >&& n ) & {
+ return operator +=(std::string_view(n.buf, n.length));
+ }
+ template<typename T> void operator +=(
+ OStringNumber<T> &&) && = delete;
+#endif
+
+ /**
+ Clears the string, i.e, makes a zero-character string
+ @since LibreOffice 4.4
+ */
+ void clear()
+ {
+ rtl_string_new( &pData );
+ }
+
+ /**
+ Returns the length of this string.
+
+ The length is equal to the number of characters in this string.
+
+ @return the length of the sequence of characters represented by this
+ object.
+ */
+ sal_Int32 getLength() const { return pData->length; }
+
+ /**
+ Checks if a string is empty.
+
+ @return true if the string is empty;
+ false, otherwise.
+
+ @since LibreOffice 3.4
+ */
+ bool isEmpty() const
+ {
+ return pData->length == 0;
+ }
+
+ /**
+ Returns a pointer to the characters of this string.
+
+ <p>The returned pointer is guaranteed to point to a null-terminated byte
+ string. But note that this string object may contain embedded null
+ characters, which will thus also be embedded in the returned
+ null-terminated byte string.</p>
+
+ @return a pointer to a null-terminated byte string representing the
+ characters of this string object.
+ */
+ const char * getStr() const SAL_RETURNS_NONNULL { return pData->buffer; }
+
+ /**
+ Access to individual characters.
+
+ @param index must be non-negative and less than length.
+
+ @return the character at the given index.
+
+ @since LibreOffice 3.5
+ */
+ char operator [](sal_Int32 index) const {
+ // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
+ assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
+ return getStr()[index];
+ }
+
+ /**
+ Compares two strings.
+
+ The comparison is based on the numeric value of each character in
+ the strings and return a value indicating their relationship.
+ This function can't be used for language specific sorting.
+
+ @param str the object to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+ */
+ sal_Int32 compareTo( const OString & str ) const
+ {
+ return rtl_str_compare_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length );
+ }
+
+ /**
+ Compares two strings with an maximum count of characters.
+
+ The comparison is based on the numeric value of each character in
+ the strings and return a value indicating their relationship.
+ This function can't be used for language specific sorting.
+
+ @param rObj the object to be compared.
+ @param maxLength the maximum count of characters to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+ */
+ sal_Int32 compareTo( const OString & rObj, sal_Int32 maxLength ) const
+ {
+ return rtl_str_shortenedCompare_WithLength( pData->buffer, pData->length,
+ rObj.pData->buffer, rObj.pData->length, maxLength );
+ }
+
+ /**
+ Compares two strings in reverse order.
+
+ The comparison is based on the numeric value of each character in
+ the strings and return a value indicating their relationship.
+ This function can't be used for language specific sorting.
+
+ @param str the object to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+ */
+ sal_Int32 reverseCompareTo( const OString & str ) const
+ {
+ return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length );
+ }
+
+ /**
+ Perform a comparison of two strings.
+
+ The result is true if and only if second string
+ represents the same sequence of characters as the first string.
+ This function can't be used for language specific comparison.
+
+ @param str the object to be compared.
+ @return true if the strings are equal;
+ false, otherwise.
+ */
+ bool equals( const OString & str ) const
+ {
+ if ( pData->length != str.pData->length )
+ return false;
+ if ( pData == str.pData )
+ return true;
+ return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length ) == 0;
+ }
+
+ /**
+ Perform a comparison of two strings.
+
+ The result is true if and only if second string
+ represents the same sequence of characters as the first string.
+ The ASCII string must be NULL-terminated and must be greater or
+ equal as length.
+ This function can't be used for language specific comparison.
+
+
+ @param value a character array.
+ @param length the length of the character array.
+ @return true if the strings are equal;
+ false, otherwise.
+ */
+ bool equalsL( const char* value, sal_Int32 length ) const
+ {
+ if ( pData->length != length )
+ return false;
+
+ return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
+ value, length ) == 0;
+ }
+
+ /**
+ Perform an ASCII lowercase comparison of two strings.
+
+ The result is true if and only if second string
+ represents the same sequence of characters as the first string,
+ ignoring the case.
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ This function can't be used for language specific comparison.
+
+ @param str the object to be compared.
+ @return true if the strings are equal;
+ false, otherwise.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool equalsIgnoreAsciiCase( std::string_view str ) const
+ {
+ if ( sal_uInt32(pData->length) != str.size() )
+ return false;
+ if ( pData->buffer == str.data() )
+ return true;
+ return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
+ str.data(), str.size() ) == 0;
+ }
+#else
+ bool equalsIgnoreAsciiCase( const OString & str ) const
+ {
+ if ( pData->length != str.pData->length )
+ return false;
+ if ( pData == str.pData )
+ return true;
+ return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length ) == 0;
+ }
+#endif
+
+ /**
+ Perform an ASCII lowercase comparison of two strings.
+
+ The result is true if and only if second string
+ represents the same sequence of characters as the first string,
+ ignoring the case.
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and
+ 127. The ASCII string must be NULL-terminated.
+ This function can't be used for language specific comparison.
+
+ Note: The argument type is always either char* or const char*, the return type is bool.
+ The template is used only for technical reasons.
+
+ @param asciiStr the 8-Bit ASCII character string to be compared.
+ @return true if the strings are equal;
+ false, otherwise.
+ */
+ template< typename T >
+ typename libreoffice_internal::CharPtrDetector< T, bool >::Type equalsIgnoreAsciiCase( const T& asciiStr ) const
+ {
+ return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0;
+ }
+
+ template< typename T >
+ typename libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase( T& asciiStr ) const
+ {
+ return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0;
+ }
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase( T& literal ) const
+ {
+ RTL_STRING_CONST_FUNCTION
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return
+ (pData->length
+ == libreoffice_internal::ConstCharArrayDetector<T>::length)
+ && (rtl_str_compareIgnoreAsciiCase_WithLength(
+ pData->buffer, pData->length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length)
+ == 0);
+ }
+
+ /**
+ Perform an ASCII lowercase comparison of two strings.
+
+ The result is true if and only if second string
+ represents the same sequence of characters as the first string,
+ ignoring the case.
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and
+ 127. The ASCII string must be greater or equal in length as asciiStrLength.
+ This function can't be used for language specific comparison.
+
+ @param asciiStr the 8-Bit ASCII character string to be compared.
+ @param asciiStrLength the length of the ascii string
+ @return true if the strings are equal;
+ false, otherwise.
+ */
+ bool equalsIgnoreAsciiCaseL( const char * asciiStr, sal_Int32 asciiStrLength ) const
+ {
+ if ( pData->length != asciiStrLength )
+ return false;
+
+ return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
+ asciiStr, asciiStrLength ) == 0;
+ }
+
+ /**
+ Match against a substring appearing in this string.
+
+ The result is true if and only if the second string appears as a substring
+ of this string, at the given position.
+ This function can't be used for language specific comparison.
+
+ @param str the object (substring) to be compared.
+ @param fromIndex the index to start the comparison from.
+ The index must be greater or equal than 0
+ and less or equal as the string length.
+ @return true if str match with the characters in the string
+ at the given position;
+ false, otherwise.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool match( std::string_view str, sal_Int32 fromIndex = 0 ) const
+ {
+ return rtl_str_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ str.data(), str.size(), str.size() ) == 0;
+ }
+#else
+ bool match( const OString & str, sal_Int32 fromIndex = 0 ) const
+ {
+ return rtl_str_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ str.pData->buffer, str.pData->length, str.pData->length ) == 0;
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match( T& literal, sal_Int32 fromIndex = 0 ) const
+ {
+ RTL_STRING_CONST_FUNCTION
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return
+ rtl_str_shortenedCompare_WithLength(
+ pData->buffer + fromIndex, pData->length - fromIndex,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length,
+ libreoffice_internal::ConstCharArrayDetector<T>::length)
+ == 0;
+ }
+
+ /**
+ Match against a substring appearing in this string.
+
+ @param str the substring to be compared; must not be null and must point
+ to memory of at least strLength bytes
+
+ @param strLength the length of the substring; must be non-negative
+
+ @param fromIndex the index into this string to start the comparison at;
+ must be non-negative and not greater than this string's length
+
+ @return true if and only if the given str is contained as a substring of
+ this string at the given fromIndex
+
+ @since LibreOffice 3.6
+ */
+ bool matchL(
+ char const * str, sal_Int32 strLength, sal_Int32 fromIndex = 0)
+ const
+ {
+ return rtl_str_shortenedCompare_WithLength(
+ pData->buffer + fromIndex, pData->length - fromIndex,
+ str, strLength, strLength) == 0;
+ }
+
+ // This overload is left undefined, to detect calls of matchL that
+ // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
+ // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
+ // platforms):
+#if SAL_TYPES_SIZEOFLONG == 8
+ void matchL(char const *, sal_Int32, rtl_TextEncoding) const;
+#endif
+
+ /**
+ Match against a substring appearing in this string, ignoring the case of
+ ASCII letters.
+
+ The result is true if and only if the second string appears as a substring
+ of this string, at the given position.
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ This function can't be used for language specific comparison.
+
+ @param str the object (substring) to be compared.
+ @param fromIndex the index to start the comparison from.
+ The index must be greater or equal than 0
+ and less or equal as the string length.
+ @return true if str match with the characters in the string
+ at the given position;
+ false, otherwise.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool matchIgnoreAsciiCase( std::string_view str, sal_Int32 fromIndex = 0 ) const
+ {
+ return rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ str.data(), str.size(),
+ str.size() ) == 0;
+ }
+#else
+ bool matchIgnoreAsciiCase( const OString & str, sal_Int32 fromIndex = 0 ) const
+ {
+ return rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ str.pData->buffer, str.pData->length,
+ str.pData->length ) == 0;
+ }
+#endif
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase( T& literal, sal_Int32 fromIndex = 0 ) const
+ {
+ RTL_STRING_CONST_FUNCTION
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return
+ rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
+ pData->buffer+fromIndex, pData->length-fromIndex,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length,
+ libreoffice_internal::ConstCharArrayDetector<T>::length)
+ == 0;
+ }
+
+ /**
+ Check whether this string starts with a given substring.
+
+ @param str the substring to be compared
+
+ @param rest if non-null, and this function returns true, then assign a
+ copy of the remainder of this string to *rest. Available since
+ LibreOffice 4.2
+
+ @return true if and only if the given str appears as a substring at the
+ start of this string
+
+ @since LibreOffice 4.0
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool startsWith(std::string_view str, OString * rest = NULL) const {
+ bool b = match(str);
+ if (b && rest != NULL) {
+ *rest = copy(str.size());
+ }
+ return b;
+ }
+#else
+ bool startsWith(OString const & str, OString * rest = NULL) const {
+ bool b = match(str);
+ if (b && rest != NULL) {
+ *rest = copy(str.getLength());
+ }
+ return b;
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 4.0
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
+ T & literal, OString * rest = NULL) const
+ {
+ RTL_STRING_CONST_FUNCTION
+ bool b = match(literal, 0);
+ if (b && rest != NULL) {
+ *rest = copy(
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+ return b;
+ }
+
+ /**
+ Check whether this string starts with a given string, ignoring the case of
+ ASCII letters.
+
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ This function can't be used for language specific comparison.
+
+ @param str the substring to be compared
+
+ @param rest if non-null, and this function returns true, then assign a
+ copy of the remainder of this string to *rest.
+
+ @return true if and only if the given str appears as a substring at the
+ start of this string, ignoring the case of ASCII letters ("A"--"Z" and
+ "a"--"z")
+
+ @since LibreOffice 5.1
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool startsWithIgnoreAsciiCase(std::string_view str, OString * rest = NULL)
+ const
+ {
+ bool b = matchIgnoreAsciiCase(str);
+ if (b && rest != NULL) {
+ *rest = copy(str.size());
+ }
+ return b;
+ }
+#else
+ bool startsWithIgnoreAsciiCase(OString const & str, OString * rest = NULL)
+ const
+ {
+ bool b = matchIgnoreAsciiCase(str);
+ if (b && rest != NULL) {
+ *rest = copy(str.getLength());
+ }
+ return b;
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 5.1
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+ startsWithIgnoreAsciiCase(T & literal, OString * rest = NULL) const
+ {
+ RTL_STRING_CONST_FUNCTION
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ bool b = matchIgnoreAsciiCase(literal);
+ if (b && rest != NULL) {
+ *rest = copy(
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+ return b;
+ }
+
+ /**
+ Check whether this string ends with a given substring.
+
+ @param str the substring to be compared
+
+ @param rest if non-null, and this function returns true, then assign a
+ copy of the remainder of this string to *rest. Available since
+ LibreOffice 4.2
+
+ @return true if and only if the given str appears as a substring at the
+ end of this string
+
+ @since LibreOffice 3.6
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool endsWith(std::string_view str, OString * rest = NULL) const {
+ bool b = str.size() <= sal_uInt32(getLength())
+ && match(str, getLength() - str.size());
+ if (b && rest != NULL) {
+ *rest = copy(0, getLength() - str.size());
+ }
+ return b;
+ }
+#else
+ bool endsWith(OString const & str, OString * rest = NULL) const {
+ bool b = str.getLength() <= getLength()
+ && match(str, getLength() - str.getLength());
+ if (b && rest != NULL) {
+ *rest = copy(0, getLength() - str.getLength());
+ }
+ return b;
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type endsWith(
+ T & literal, OString * rest = NULL) const
+ {
+ RTL_STRING_CONST_FUNCTION
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ bool b
+ = (libreoffice_internal::ConstCharArrayDetector<T>::length
+ <= sal_uInt32(getLength()))
+ && match(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ (getLength()
+ - libreoffice_internal::ConstCharArrayDetector<T>::length));
+ if (b && rest != NULL) {
+ *rest = copy(
+ 0,
+ (getLength()
+ - libreoffice_internal::ConstCharArrayDetector<T>::length));
+ }
+ return b;
+ }
+
+ /**
+ Check whether this string ends with a given substring.
+
+ @param str the substring to be compared; must not be null and must point
+ to memory of at least strLength bytes
+
+ @param strLength the length of the substring; must be non-negative
+
+ @return true if and only if the given str appears as a substring at the
+ end of this string
+
+ @since LibreOffice 3.6
+ */
+ bool endsWithL(char const * str, sal_Int32 strLength) const {
+ return strLength <= getLength()
+ && matchL(str, strLength, getLength() - strLength);
+ }
+
+ friend bool operator == ( const OString& rStr1, const OString& rStr2 )
+ { return rStr1.equals(rStr2); }
+ friend bool operator != ( const OString& rStr1, const OString& rStr2 )
+ { return !(operator == ( rStr1, rStr2 )); }
+ friend bool operator < ( const OString& rStr1, const OString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) < 0; }
+ friend bool operator > ( const OString& rStr1, const OString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) > 0; }
+ friend bool operator <= ( const OString& rStr1, const OString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) <= 0; }
+ friend bool operator >= ( const OString& rStr1, const OString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) >= 0; }
+
+ template< typename T >
+ friend typename libreoffice_internal::CharPtrDetector< T, bool >::Type operator==( const OString& rStr1, const T& value )
+ {
+ return
+ rtl_str_compare_WithLength(
+ rStr1.getStr(), rStr1.getLength(), value, rtl_str_getLength(value))
+ == 0;
+ }
+
+ template< typename T >
+ friend typename libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator==( const OString& rStr1, T& value )
+ {
+ return
+ rtl_str_compare_WithLength(
+ rStr1.getStr(), rStr1.getLength(), value, rtl_str_getLength(value))
+ == 0;
+ }
+
+ template< typename T >
+ friend typename libreoffice_internal::CharPtrDetector< T, bool >::Type operator==( const T& value, const OString& rStr2 )
+ {
+ return
+ rtl_str_compare_WithLength(
+ value, rtl_str_getLength(value), rStr2.getStr(), rStr2.getLength())
+ == 0;
+ }
+
+ template< typename T >
+ friend typename libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator==( T& value, const OString& rStr2 )
+ {
+ return
+ rtl_str_compare_WithLength(
+ value, rtl_str_getLength(value), rStr2.getStr(), rStr2.getLength())
+ == 0;
+ }
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( const OString& rStr, T& literal )
+ {
+ RTL_STRING_CONST_FUNCTION
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return
+ (rStr.getLength()
+ == libreoffice_internal::ConstCharArrayDetector<T>::length)
+ && (rtl_str_compare_WithLength(
+ rStr.pData->buffer, rStr.pData->length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length)
+ == 0);
+ }
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( T& literal, const OString& rStr )
+ {
+ RTL_STRING_CONST_FUNCTION
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return
+ (rStr.getLength()
+ == libreoffice_internal::ConstCharArrayDetector<T>::length)
+ && (rtl_str_compare_WithLength(
+ rStr.pData->buffer, rStr.pData->length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length)
+ == 0);
+ }
+
+ template< typename T >
+ friend typename libreoffice_internal::CharPtrDetector< T, bool >::Type operator!=( const OString& rStr1, const T& value )
+ {
+ return !(operator == ( rStr1, value ));
+ }
+
+ template< typename T >
+ friend typename libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator!=( const OString& rStr1, T& value )
+ {
+ return !(operator == ( rStr1, value ));
+ }
+
+ template< typename T >
+ friend typename libreoffice_internal::CharPtrDetector< T, bool >::Type operator!=( const T& value, const OString& rStr2 )
+ {
+ return !(operator == ( value, rStr2 ));
+ }
+
+ template< typename T >
+ friend typename libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator!=( T& value, const OString& rStr2 )
+ {
+ return !(operator == ( value, rStr2 ));
+ }
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( const OString& rStr, T& literal )
+ {
+ return !( rStr == literal );
+ }
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( T& literal, const OString& rStr )
+ {
+ return !( literal == rStr );
+ }
+
+ /**
+ Returns a hashcode for this string.
+
+ @return a hash code value for this object.
+
+ @see rtl::OStringHash for convenient use of std::unordered_map
+ */
+ sal_Int32 hashCode() const
+ {
+ return rtl_str_hashCode_WithLength( pData->buffer, pData->length );
+ }
+
+ /**
+ Returns the index within this string of the first occurrence of the
+ specified character, starting the search at the specified index.
+
+ @param ch character to be located.
+ @param fromIndex the index to start the search from.
+ The index must be greater or equal than 0
+ and less or equal as the string length.
+ @return the index of the first occurrence of the character in the
+ character sequence represented by this string that is
+ greater than or equal to fromIndex, or
+ -1 if the character does not occur.
+ */
+ sal_Int32 indexOf( char ch, sal_Int32 fromIndex = 0 ) const
+ {
+ sal_Int32 ret = rtl_str_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
+ return (ret < 0 ? ret : ret+fromIndex);
+ }
+
+ /**
+ Returns the index within this string of the last occurrence of the
+ specified character, searching backward starting at the end.
+
+ @param ch character to be located.
+ @return the index of the last occurrence of the character in the
+ character sequence represented by this string, or
+ -1 if the character does not occur.
+ */
+ sal_Int32 lastIndexOf( char ch ) const
+ {
+ return rtl_str_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
+ }
+
+ /**
+ Returns the index within this string of the last occurrence of the
+ specified character, searching backward starting before the specified
+ index.
+
+ @param ch character to be located.
+ @param fromIndex the index before which to start the search.
+ @return the index of the last occurrence of the character in the
+ character sequence represented by this string that
+ is less than fromIndex, or -1
+ if the character does not occur before that point.
+ */
+ sal_Int32 lastIndexOf( char ch, sal_Int32 fromIndex ) const
+ {
+ return rtl_str_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
+ }
+
+ /**
+ Returns the index within this string of the first occurrence of the
+ specified substring, starting at the specified index.
+
+ If str doesn't include any character, always -1 is
+ returned. This is also the case, if both strings are empty.
+
+ @param str the substring to search for.
+ @param fromIndex the index to start the search from.
+ @return If the string argument occurs one or more times as a substring
+ within this string at the starting index, then the index
+ of the first character of the first such substring is
+ returned. If it does not occur as a substring starting
+ at fromIndex or beyond, -1 is returned.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 indexOf( std::string_view str, sal_Int32 fromIndex = 0 ) const
+ {
+ sal_Int32 ret = rtl_str_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ str.data(), str.size() );
+ return (ret < 0 ? ret : ret+fromIndex);
+ }
+#else
+ sal_Int32 indexOf( const OString & str, sal_Int32 fromIndex = 0 ) const
+ {
+ sal_Int32 ret = rtl_str_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ str.pData->buffer, str.pData->length );
+ return (ret < 0 ? ret : ret+fromIndex);
+ }
+#endif
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const
+ {
+ RTL_STRING_CONST_FUNCTION
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ sal_Int32 n = rtl_str_indexOfStr_WithLength(
+ pData->buffer + fromIndex, pData->length - fromIndex,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ return n < 0 ? n : n + fromIndex;
+ }
+
+ /**
+ Returns the index within this string of the first occurrence of the
+ specified substring, starting at the specified index.
+
+ If str doesn't include any character, always -1 is
+ returned. This is also the case, if both strings are empty.
+
+ @param str the substring to search for.
+ @param len the length of the substring.
+ @param fromIndex the index to start the search from.
+ @return If the string argument occurs one or more times as a substring
+ within this string at the starting index, then the index
+ of the first character of the first such substring is
+ returned. If it does not occur as a substring starting
+ at fromIndex or beyond, -1 is returned.
+
+ @since LibreOffice 3.6
+ */
+ sal_Int32 indexOfL(char const * str, sal_Int32 len, sal_Int32 fromIndex = 0)
+ const
+ {
+ sal_Int32 n = rtl_str_indexOfStr_WithLength(
+ pData->buffer + fromIndex, pData->length - fromIndex, str, len);
+ return n < 0 ? n : n + fromIndex;
+ }
+
+ // This overload is left undefined, to detect calls of indexOfL that
+ // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
+ // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
+ // platforms):
+#if SAL_TYPES_SIZEOFLONG == 8
+ void indexOfL(char const *, sal_Int32, rtl_TextEncoding) const;
+#endif
+
+ /**
+ Returns the index within this string of the last occurrence of
+ the specified substring, searching backward starting at the end.
+
+ The returned index indicates the starting index of the substring
+ in this string.
+ If str doesn't include any character, always -1 is
+ returned. This is also the case, if both strings are empty.
+
+ @param str the substring to search for.
+ @return If the string argument occurs one or more times as a substring
+ within this string, then the index of the first character of
+ the last such substring is returned. If it does not occur as
+ a substring, -1 is returned.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 lastIndexOf( std::string_view str ) const
+ {
+ return rtl_str_lastIndexOfStr_WithLength( pData->buffer, pData->length,
+ str.data(), str.size() );
+ }
+#else
+ sal_Int32 lastIndexOf( const OString & str ) const
+ {
+ return rtl_str_lastIndexOfStr_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length );
+ }
+#endif
+
+ /**
+ Returns the index within this string of the last occurrence of
+ the specified substring, searching backward starting before the specified
+ index.
+
+ The returned index indicates the starting index of the substring
+ in this string.
+ If str doesn't include any character, always -1 is
+ returned. This is also the case, if both strings are empty.
+
+ @param str the substring to search for.
+ @param fromIndex the index before which to start the search.
+ @return If the string argument occurs one or more times as a substring
+ within this string before the starting index, then the index
+ of the first character of the last such substring is
+ returned. Otherwise, -1 is returned.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 lastIndexOf( std::string_view str, sal_Int32 fromIndex ) const
+ {
+ return rtl_str_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
+ str.data(), str.size() );
+ }
+#else
+ sal_Int32 lastIndexOf( const OString & str, sal_Int32 fromIndex ) const
+ {
+ return rtl_str_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
+ str.pData->buffer, str.pData->length );
+ }
+#endif
+
+ /**
+ Returns a new string that is a substring of this string.
+
+ The substring begins at the specified beginIndex. If
+ beginIndex is negative or be greater than the length of
+ this string, behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @return the specified substring.
+ */
+ SAL_WARN_UNUSED_RESULT OString copy( sal_Int32 beginIndex ) const
+ {
+ return copy(beginIndex, getLength() - beginIndex);
+ }
+
+ /**
+ Returns a new string that is a substring of this string.
+
+ The substring begins at the specified beginIndex and contains count
+ characters. If either beginIndex or count are negative,
+ or beginIndex + count are greater than the length of this string
+ then behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @param count the number of characters.
+ @return the specified substring.
+ */
+ SAL_WARN_UNUSED_RESULT OString copy( sal_Int32 beginIndex, sal_Int32 count ) const
+ {
+ rtl_String *pNew = NULL;
+ rtl_string_newFromSubString( &pNew, pData, beginIndex, count );
+ return OString( pNew, SAL_NO_ACQUIRE );
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /**
+ Returns a std::string_view that is a view of a substring of this string.
+
+ The substring begins at the specified beginIndex. If
+ beginIndex is negative or be greater than the length of
+ this string, behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @return the specified substring.
+ */
+ SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex ) const
+ {
+ assert(beginIndex >= 0);
+ assert(beginIndex <= getLength());
+ return subView(beginIndex, getLength() - beginIndex);
+ }
+
+ /**
+ Returns a std::string_view that is a view of a substring of this string.
+
+ The substring begins at the specified beginIndex and contains count
+ characters. If either beginIndex or count are negative,
+ or beginIndex + count are greater than the length of this string
+ then behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @param count the number of characters.
+ @return the specified substring.
+ */
+ SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const
+ {
+ assert(beginIndex >= 0);
+ assert(count >= 0);
+ assert(beginIndex <= getLength());
+ assert(count <= getLength() - beginIndex);
+ return std::string_view(*this).substr(beginIndex, count);
+ }
+#endif
+
+#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /**
+ Concatenates the specified string to the end of this string.
+
+ @param str the string that is concatenated to the end
+ of this string.
+ @return a string that represents the concatenation of this string
+ followed by the string argument.
+ */
+ SAL_WARN_UNUSED_RESULT OString concat( const OString & str ) const
+ {
+ rtl_String* pNew = NULL;
+ rtl_string_newConcat( &pNew, pData, str.pData );
+ return OString( pNew, SAL_NO_ACQUIRE );
+ }
+#endif
+
+#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ friend OString operator+( const OString & str1, const OString & str2 )
+ {
+ return str1.concat( str2 );
+ }
+#endif
+
+// hide this from internal code to avoid ambiguous lookup error
+#ifndef LIBO_INTERNAL_ONLY
+ /**
+ Returns a new string resulting from replacing n = count characters
+ from position index in this string with newStr.
+
+ @param index the replacing index in str.
+ The index must be greater or equal as 0 and
+ less or equal as the length of the string.
+ @param count the count of characters that will replaced
+ The count must be greater or equal as 0 and
+ less or equal as the length of the string minus index.
+ @param newStr the new substring.
+ @return the new string.
+ */
+ SAL_WARN_UNUSED_RESULT OString replaceAt( sal_Int32 index, sal_Int32 count, const OString& newStr ) const
+ {
+ rtl_String* pNew = NULL;
+ rtl_string_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
+ return OString( pNew, SAL_NO_ACQUIRE );
+ }
+#endif
+
+#ifdef LIBO_INTERNAL_ONLY
+ SAL_WARN_UNUSED_RESULT OString replaceAt( sal_Int32 index, sal_Int32 count, std::string_view newStr ) const
+ {
+ rtl_String* pNew = NULL;
+ rtl_string_newReplaceStrAt_WithLength ( &pNew, pData, index, count, newStr.data(), newStr.size() );
+ return OString( pNew, SAL_NO_ACQUIRE );
+ }
+#endif
+
+ /**
+ Returns a new string resulting from replacing all occurrences of
+ oldChar in this string with newChar.
+
+ If the character oldChar does not occur in the character sequence
+ represented by this object, then the string is assigned with
+ str.
+
+ @param oldChar the old character.
+ @param newChar the new character.
+ @return a string derived from this string by replacing every
+ occurrence of oldChar with newChar.
+ */
+ SAL_WARN_UNUSED_RESULT OString replace( char oldChar, char newChar ) const
+ {
+ rtl_String* pNew = NULL;
+ rtl_string_newReplace( &pNew, pData, oldChar, newChar );
+ return OString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Returns a new string resulting from replacing the first occurrence of a
+ given substring with another substring.
+
+ @param from the substring to be replaced
+
+ @param to the replacing substring
+
+ @param[in,out] index pointer to a start index; if the pointer is
+ non-null: upon entry to the function, its value is the index into the this
+ string at which to start searching for the \p from substring, the value
+ must be non-negative and not greater than this string's length; upon exit
+ from the function its value is the index into this string at which the
+ replacement took place or -1 if no replacement took place; if the pointer
+ is null, searching always starts at index 0
+
+ @since LibreOffice 3.6
+ */
+ SAL_WARN_UNUSED_RESULT OString replaceFirst(
+ OString const & from, OString const & to, sal_Int32 * index = NULL) const
+ {
+ rtl_String * s = NULL;
+ sal_Int32 i = 0;
+ rtl_string_newReplaceFirst(
+ &s, pData, from.pData->buffer, from.pData->length,
+ to.pData->buffer, to.pData->length, index == NULL ? &i : index);
+ return OString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns a new string resulting from replacing all occurrences of a given
+ substring with another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param from the substring to be replaced
+
+ @param to the replacing substring
+
+ @since LibreOffice 3.6
+ */
+ SAL_WARN_UNUSED_RESULT OString replaceAll(OString const & from, OString const & to) const {
+ rtl_String * s = NULL;
+ rtl_string_newReplaceAll(
+ &s, pData, from.pData->buffer, from.pData->length,
+ to.pData->buffer, to.pData->length);
+ return OString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Converts from this string all ASCII uppercase characters (65-90)
+ to ASCII lowercase characters (97-122).
+
+ This function can't be used for language specific conversion.
+ If the string doesn't contain characters which must be converted,
+ then the new string is assigned with str.
+
+ @return the string, converted to ASCII lowercase.
+ */
+ SAL_WARN_UNUSED_RESULT OString toAsciiLowerCase() const
+ {
+ rtl_String* pNew = NULL;
+ rtl_string_newToAsciiLowerCase( &pNew, pData );
+ return OString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Converts from this string all ASCII lowercase characters (97-122)
+ to ASCII uppercase characters (65-90).
+
+ This function can't be used for language specific conversion.
+ If the string doesn't contain characters which must be converted,
+ then the new string is assigned with str.
+
+ @return the string, converted to ASCII uppercase.
+ */
+ SAL_WARN_UNUSED_RESULT OString toAsciiUpperCase() const
+ {
+ rtl_String* pNew = NULL;
+ rtl_string_newToAsciiUpperCase( &pNew, pData );
+ return OString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Returns a new string resulting from removing white space from both ends
+ of the string.
+
+ All characters that have codes less than or equal to
+ 32 (the space character) are considered to be white space.
+ If the string doesn't contain white spaces at both ends,
+ then the new string is assigned with str.
+
+ @return the string, with white space removed from the front and end.
+ */
+ SAL_WARN_UNUSED_RESULT OString trim() const
+ {
+ rtl_String* pNew = NULL;
+ rtl_string_newTrim( &pNew, pData );
+ return OString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Returns a token in the string.
+
+ Example:
+ sal_Int32 nIndex = 0;
+ do
+ {
+ ...
+ OString aToken = aStr.getToken( 0, ';', nIndex );
+ ...
+ }
+ while ( nIndex >= 0 );
+
+ @param token the number of the token to return.
+ @param cTok the character which separate the tokens.
+ @param index the position at which the token is searched in the
+ string.
+ The index must not be greater than the length of the
+ string.
+ This param is set to the position of the
+ next token or to -1, if it is the last token.
+ @return the token; if either token or index is negative, an empty token
+ is returned (and index is set to -1)
+ */
+ OString getToken( sal_Int32 token, char cTok, sal_Int32& index ) const
+ {
+ rtl_String * pNew = NULL;
+ index = rtl_string_getToken( &pNew, pData, token, cTok, index );
+ return OString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Returns a token from the string.
+
+ The same as getToken(sal_Int32, char, sal_Int32 &), but always passing
+ in 0 as the start index in the third argument.
+
+ @param count the number of the token to return, starting with 0
+ @param separator the character which separates the tokens
+
+ @return the given token, or an empty string
+
+ @since LibreOffice 3.6
+ */
+ OString getToken(sal_Int32 count, char separator) const {
+ sal_Int32 n = 0;
+ return getToken(count, separator, n);
+ }
+
+ /**
+ Returns the Boolean value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @return true, if the string is 1 or "True" in any ASCII case.
+ false in any other case.
+ */
+ bool toBoolean() const
+ {
+ return rtl_str_toBoolean( pData->buffer );
+ }
+
+ /**
+ Returns the first character from this string.
+
+ @return the first character from this string or 0, if this string
+ is empty.
+ */
+ char toChar() const
+ {
+ return pData->buffer[0];
+ }
+
+ /**
+ Returns the int32 value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @param radix the radix (between 2 and 36)
+ @return the int32 represented from this string.
+ 0 if this string represents no number or one of too large
+ magnitude.
+ */
+ sal_Int32 toInt32( sal_Int16 radix = 10 ) const
+ {
+ return rtl_str_toInt32( pData->buffer, radix );
+ }
+
+ /**
+ Returns the uint32 value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @param radix the radix (between 2 and 36)
+ @return the uint32 represented from this string.
+ 0 if this string represents no number or one of too large
+ magnitude.
+
+ @since LibreOffice 4.2
+ */
+ sal_uInt32 toUInt32( sal_Int16 radix = 10 ) const
+ {
+ return rtl_str_toUInt32( pData->buffer, radix );
+ }
+
+ /**
+ Returns the int64 value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @param radix the radix (between 2 and 36)
+ @return the int64 represented from this string.
+ 0 if this string represents no number or one of too large
+ magnitude.
+ */
+ sal_Int64 toInt64( sal_Int16 radix = 10 ) const
+ {
+ return rtl_str_toInt64( pData->buffer, radix );
+ }
+
+ /**
+ Returns the uint64 value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @param radix the radix (between 2 and 36)
+ @return the uint64 represented from this string.
+ 0 if this string represents no number or one of too large
+ magnitude.
+
+ @since LibreOffice 4.1
+ */
+ sal_uInt64 toUInt64( sal_Int16 radix = 10 ) const
+ {
+ return rtl_str_toUInt64( pData->buffer, radix );
+ }
+
+ /**
+ Returns the float value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @return the float represented from this string.
+ 0.0 if this string represents no number.
+ */
+ float toFloat() const
+ {
+ return rtl_str_toFloat( pData->buffer );
+ }
+
+ /**
+ Returns the double value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @return the double represented from this string.
+ 0.0 if this string represents no number.
+ */
+ double toDouble() const
+ {
+ return rtl_str_toDouble( pData->buffer );
+ }
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+
+ static OStringNumber< int > number( int i, sal_Int16 radix = 10 )
+ {
+ return OStringNumber< int >( i, radix );
+ }
+ static OStringNumber< long long > number( long long ll, sal_Int16 radix = 10 )
+ {
+ return OStringNumber< long long >( ll, radix );
+ }
+ static OStringNumber< unsigned long long > number( unsigned long long ll, sal_Int16 radix = 10 )
+ {
+ return OStringNumber< unsigned long long >( ll, radix );
+ }
+ static OStringNumber< unsigned long long > number( unsigned int i, sal_Int16 radix = 10 )
+ {
+ return number( static_cast< unsigned long long >( i ), radix );
+ }
+ static OStringNumber< long long > number( long i, sal_Int16 radix = 10)
+ {
+ return number( static_cast< long long >( i ), radix );
+ }
+ static OStringNumber< unsigned long long > number( unsigned long i, sal_Int16 radix = 10 )
+ {
+ return number( static_cast< unsigned long long >( i ), radix );
+ }
+ static OStringNumber< float > number( float f )
+ {
+ return OStringNumber< float >( f );
+ }
+ static OStringNumber< double > number( double d )
+ {
+ return OStringNumber< double >( d );
+ }
+#else
+ /**
+ Returns the string representation of the integer argument.
+
+ This function can't be used for language specific conversion.
+
+ @param i an integer value
+ @param radix the radix (between 2 and 36)
+ @return a string with the string representation of the argument.
+ @since LibreOffice 4.1
+ */
+ static OString number( int i, sal_Int16 radix = 10 )
+ {
+ char aBuf[RTL_STR_MAX_VALUEOFINT32];
+ return OString(aBuf, rtl_str_valueOfInt32(aBuf, i, radix));
+ }
+ /// @overload
+ /// @since LibreOffice 4.1
+ static OString number( unsigned int i, sal_Int16 radix = 10 )
+ {
+ return number( static_cast< unsigned long long >( i ), radix );
+ }
+ /// @overload
+ /// @since LibreOffice 4.1
+ static OString number( long i, sal_Int16 radix = 10 )
+ {
+ return number( static_cast< long long >( i ), radix );
+ }
+ /// @overload
+ /// @since LibreOffice 4.1
+ static OString number( unsigned long i, sal_Int16 radix = 10 )
+ {
+ return number( static_cast< unsigned long long >( i ), radix );
+ }
+ /// @overload
+ /// @since LibreOffice 4.1
+ static OString number( long long ll, sal_Int16 radix = 10 )
+ {
+ char aBuf[RTL_STR_MAX_VALUEOFINT64];
+ return OString(aBuf, rtl_str_valueOfInt64(aBuf, ll, radix));
+ }
+ /// @overload
+ /// @since LibreOffice 4.1
+ static OString number( unsigned long long ll, sal_Int16 radix = 10 )
+ {
+ char aBuf[RTL_STR_MAX_VALUEOFUINT64];
+ return OString(aBuf, rtl_str_valueOfUInt64(aBuf, ll, radix));
+ }
+
+ /**
+ Returns the string representation of the float argument.
+
+ This function can't be used for language specific conversion.
+
+ @param f a float.
+ @return a string with the decimal representation of the argument.
+ @since LibreOffice 4.1
+ */
+ static OString number( float f )
+ {
+ char aBuf[RTL_STR_MAX_VALUEOFFLOAT];
+ return OString(aBuf, rtl_str_valueOfFloat(aBuf, f));
+ }
+
+ /**
+ Returns the string representation of the double argument.
+
+ This function can't be used for language specific conversion.
+
+ @param d a double.
+ @return a string with the decimal representation of the argument.
+ @since LibreOffice 4.1
+ */
+ static OString number( double d )
+ {
+ char aBuf[RTL_STR_MAX_VALUEOFDOUBLE];
+ return OString(aBuf, rtl_str_valueOfDouble(aBuf, d));
+ }
+#endif
+
+ /**
+ Returns the string representation of the sal_Bool argument.
+
+ If the sal_Bool is true, the string "true" is returned.
+ If the sal_Bool is false, the string "false" is returned.
+ This function can't be used for language specific conversion.
+
+ @param b a sal_Bool.
+ @return a string with the string representation of the argument.
+ @deprecated use boolean()
+ */
+ SAL_DEPRECATED("use boolean()") static OString valueOf( sal_Bool b )
+ {
+ return boolean(b);
+ }
+
+ /**
+ Returns the string representation of the boolean argument.
+
+ If the argument is true, the string "true" is returned.
+ If the argument is false, the string "false" is returned.
+ This function can't be used for language specific conversion.
+
+ @param b a bool.
+ @return a string with the string representation of the argument.
+ @since LibreOffice 4.1
+ */
+ static OString boolean( bool b )
+ {
+ char aBuf[RTL_STR_MAX_VALUEOFBOOLEAN];
+ return OString(aBuf, rtl_str_valueOfBoolean(aBuf, b));
+ }
+
+ /**
+ Returns the string representation of the char argument.
+
+ @param c a character.
+ @return a string with the string representation of the argument.
+ @deprecated use operator, function or constructor taking char or sal_Unicode argument
+ */
+ SAL_DEPRECATED("convert to OString or use directly") static OString valueOf( char c )
+ {
+ return OString( &c, 1 );
+ }
+
+ /**
+ Returns the string representation of the int argument.
+
+ This function can't be used for language specific conversion.
+
+ @param i a int32.
+ @param radix the radix (between 2 and 36)
+ @return a string with the string representation of the argument.
+ @deprecated use number()
+ */
+ SAL_DEPRECATED("use number()") static OString valueOf( sal_Int32 i, sal_Int16 radix = 10 )
+ {
+ return number( i, radix );
+ }
+
+ /**
+ Returns the string representation of the long argument.
+
+ This function can't be used for language specific conversion.
+
+ @param ll a int64.
+ @param radix the radix (between 2 and 36)
+ @return a string with the string representation of the argument.
+ @deprecated use number()
+ */
+ SAL_DEPRECATED("use number()") static OString valueOf( sal_Int64 ll, sal_Int16 radix = 10 )
+ {
+ return number( ll, radix );
+ }
+
+ /**
+ Returns the string representation of the float argument.
+
+ This function can't be used for language specific conversion.
+
+ @param f a float.
+ @return a string with the string representation of the argument.
+ @deprecated use number()
+ */
+ SAL_DEPRECATED("use number()") static OString valueOf( float f )
+ {
+ return number(f);
+ }
+
+ /**
+ Returns the string representation of the double argument.
+
+ This function can't be used for language specific conversion.
+
+ @param d a double.
+ @return a string with the string representation of the argument.
+ @deprecated use number()
+ */
+ SAL_DEPRECATED("use number()") static OString valueOf( double d )
+ {
+ return number(d);
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ operator std::string_view() const { return {getStr(), sal_uInt32(getLength())}; }
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ // A wrapper for the first expression in an
+ //
+ // OString::Concat(e1) + e2 + ...
+ //
+ // concatenation chain, when neither of the first two e1, e2 is one of our rtl string-related
+ // classes (so something like
+ //
+ // OString s = "a" + (b ? std::string_view("c") : std::string_view("dd"));
+ //
+ // would not compile):
+ template<typename T> [[nodiscard]] static
+ typename std::enable_if_t<
+ ToStringHelper<T>::allowOStringConcat, OStringConcat<OStringConcatMarker, T>>
+ Concat(T const & value) { return OStringConcat<OStringConcatMarker, T>({}, value); }
+
+ // This overload is needed so that an argument of type 'char const[N]' ends up as
+ // 'OStringConcat<rtl::OStringConcatMarker, char const[N]>' rather than as
+ // 'OStringConcat<rtl::OStringConcatMarker, char[N]>':
+ template<typename T, std::size_t N> [[nodiscard]] static
+ typename std::enable_if_t<
+ ToStringHelper<T[N]>::allowOStringConcat, OStringConcat<OStringConcatMarker, T[N]>>
+ Concat(T (& value)[N]) { return OStringConcat<OStringConcatMarker, T[N]>({}, value); }
+#endif
+};
+
+#if defined LIBO_INTERNAL_ONLY
+inline bool operator ==(OString const & lhs, OStringConcatenation const & rhs)
+{ return lhs == std::string_view(rhs); }
+inline bool operator !=(OString const & lhs, OStringConcatenation const & rhs)
+{ return lhs != std::string_view(rhs); }
+inline bool operator ==(OStringConcatenation const & lhs, OString const & rhs)
+{ return std::string_view(lhs) == rhs; }
+inline bool operator !=(OStringConcatenation const & lhs, OString const & rhs)
+{ return std::string_view(lhs) != rhs; }
+#endif
+
+/* ======================================================================= */
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+
+/**
+ @internal
+*/
+template<>
+struct ToStringHelper< OString >
+ {
+ static std::size_t length( const OString& s ) { return s.getLength(); }
+ static char* addData( char* buffer, const OString& s ) { return addDataHelper( buffer, s.getStr(), s.getLength()); }
+ static const bool allowOStringConcat = true;
+ static const bool allowOUStringConcat = false;
+ };
+
+/**
+ @internal
+*/
+template<std::size_t N>
+struct ToStringHelper< OStringLiteral<N> >
+ {
+ static constexpr std::size_t length( const OStringLiteral<N>& str ) { return str.getLength(); }
+ static char* addData( char* buffer, const OStringLiteral<N>& str ) { return addDataHelper( buffer, str.getStr(), str.getLength() ); }
+ static const bool allowOStringConcat = true;
+ static const bool allowOUStringConcat = false;
+ };
+
+/**
+ @internal
+*/
+template< typename charT, typename traits, typename T1, typename T2 >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, OStringConcat< T1, T2 >&& concat)
+{
+ return stream << OString( std::move(concat) );
+}
+#endif
+
+
+/** A helper to use OStrings with hash maps.
+
+ Instances of this class are unary function objects that can be used as
+ hash function arguments to std::unordered_map and similar constructs.
+ */
+struct OStringHash
+{
+ /** Compute a hash code for a string.
+
+ @param rString
+ a string.
+
+ @return
+ a hash code for the string. This hash code should not be stored
+ persistently, as its computation may change in later revisions.
+ */
+ size_t operator()( const OString& rString ) const
+ { return static_cast<size_t>(rString.hashCode()); }
+};
+
+/** Equality functor for classic c-strings (i.e., null-terminated char* strings). */
+struct CStringEqual
+{
+ bool operator()( const char* p1, const char* p2) const
+ { return rtl_str_compare(p1, p2) == 0; }
+};
+
+/** Hashing functor for classic c-strings (i.e., null-terminated char* strings). */
+struct CStringHash
+{
+ size_t operator()(const char* p) const
+ { return rtl_str_hashCode(p); }
+};
+
+/* ======================================================================= */
+
+/**
+ Support for rtl::OString in std::ostream (and thus in
+ CPPUNIT_ASSERT or SAL_INFO macros, for example).
+
+ @since LibreOffice 4.0
+ */
+template< typename charT, typename traits > std::basic_ostream<charT, traits> &
+operator <<(
+ std::basic_ostream<charT, traits> & stream, OString const & rString)
+{
+ return stream << rString.getStr();
+ // best effort; potentially loses data due to embedded null characters
+}
+
+} /* Namespace */
+
+#ifdef RTL_STRING_UNITTEST
+namespace rtl
+{
+typedef rtlunittest::OString OString;
+}
+#undef RTL_STRING_CONST_FUNCTION
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
+using ::rtl::OString;
+using ::rtl::OStringChar;
+using ::rtl::OStringConcatenation;
+using ::rtl::OStringHash;
+using ::rtl::OStringLiteral;
+#endif
+
+/// @cond INTERNAL
+/**
+ Make OString hashable by default for use in STL containers.
+
+ @since LibreOffice 6.0
+*/
+#if defined LIBO_INTERNAL_ONLY
+namespace std {
+
+template<>
+struct hash<::rtl::OString>
+{
+ std::size_t operator()(::rtl::OString const & s) const
+ { return std::size_t(s.hashCode()); }
+};
+
+}
+
+#endif
+/// @endcond
+
+#endif // INCLUDED_RTL_STRING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/stringconcat.hxx b/include/rtl/stringconcat.hxx
new file mode 100644
index 000000000..51605d073
--- /dev/null
+++ b/include/rtl/stringconcat.hxx
@@ -0,0 +1,588 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_RTL_STRINGCONCAT_HXX
+#define INCLUDED_RTL_STRINGCONCAT_HXX
+
+// This file is only included from LIBO_INTERNAL_ONLY
+
+#include "rtl/stringutils.hxx"
+#include "rtl/string.h"
+#include "rtl/ustring.h"
+
+#include <cassert>
+#include <cstddef>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <type_traits>
+#include <utility>
+
+#include <string.h>
+
+#if defined RTL_STRING_UNITTEST_CONCAT
+extern bool rtl_string_unittest_invalid_concat;
+#endif
+
+#ifdef RTL_STRING_UNITTEST
+#define rtl rtlunittest
+#endif
+namespace rtl
+{
+#ifdef RTL_STRING_UNITTEST
+#undef rtl
+#endif
+
+/*
+Implementation of efficient string concatenation.
+
+The whole system is built around two basic template classes:
+- ToStringHelper< T > - for each T it can give the length of the resulting string representation and can write
+ this string representation to a buffer
+- O(U)StringConcat< T1, T2 > - operator+ now, instead of creating O(U)String object, returns only this helper object,
+ that keeps a reference to both operator+ operands; only when converted to O(U)String it will actually create
+ the resulting string object using ToStringHelper, creating directly the resulting object without any string
+ intermediate objects
+As all the code is inline methods, it allows for extensive optimization and will usually result in very effective code
+(even surpassing strlen/strcat and equalling handwritten), while allowing for very easy and intuitive syntax.
+*/
+
+/**
+@internal
+
+Helper class for converting a given type to a string representation.
+*/
+template< typename T >
+struct ToStringHelper
+ {
+ /// Return length of the string representation of the given object.
+ static std::size_t length( const T& );
+ /// Add 8-bit representation of the given object to the given buffer and return position right after the added data.
+ static char* addData( char* buffer, const T& ) SAL_RETURNS_NONNULL;
+ /// Add Unicode representation of the given object to the given buffer and return position right after the added data.
+ static sal_Unicode* addData( sal_Unicode* buffer, const T& ) SAL_RETURNS_NONNULL;
+ /// If true, T can be used in concatenation resulting in OString.
+ static const bool allowOStringConcat = false;
+ /// If true, T can be used in concatenation resulting in OUString.
+ static const bool allowOUStringConcat = false;
+ };
+
+inline
+char* addDataHelper( char* buffer, const char* data, std::size_t length )
+ {
+ if (length != 0) {
+ memcpy( buffer, data, length );
+ }
+ return buffer + length;
+ }
+
+inline
+sal_Unicode* addDataHelper( sal_Unicode* buffer, const sal_Unicode* data, std::size_t length )
+ {
+ if (length != 0) {
+ memcpy( buffer, data, length * sizeof( sal_Unicode ));
+ }
+ return buffer + length;
+ }
+
+inline
+sal_Unicode* addDataLiteral( sal_Unicode* buffer, const char* data, std::size_t length )
+ {
+ for( std::size_t i = 0; i != length; ++i )
+ *buffer++ = *data++;
+ return buffer;
+ }
+
+inline
+char* addDataCString( char* buffer, const char* str )
+ {
+ while( *str != '\0' )
+ *buffer++ = *str++;
+ return buffer;
+ }
+
+inline
+sal_Unicode* addDataUString( sal_Unicode* buffer, const sal_Unicode* str )
+ {
+ while( *str != '\0' )
+ *buffer++ = *str++;
+ return buffer;
+ }
+
+template<>
+struct ToStringHelper< const char* >
+ {
+ static std::size_t length( const char* str ) {
+ return str ? strlen( str ) : 0;
+ }
+ static char* addData( char* buffer, const char* str ) {
+ return str ? addDataCString( buffer, str ) : buffer;
+ }
+ static const bool allowOStringConcat = true;
+ static const bool allowOUStringConcat = false;
+ };
+
+template<>
+struct ToStringHelper< char* > : public ToStringHelper< const char* > {};
+
+template< std::size_t N >
+struct ToStringHelper< char[ N ] >
+ {
+ static std::size_t length( const char str[ N ] ) {
+ return strlen( str );
+ }
+ static char* addData( char* buffer, const char str[ N ] ) { return addDataCString( buffer, str ); }
+ static const bool allowOStringConcat = true;
+ static const bool allowOUStringConcat = false;
+ };
+
+template< std::size_t N >
+struct ToStringHelper< const char[ N ] >
+ {
+ static std::size_t length( const char str[ N ] ) { (void)str; assert( strlen( str ) == N - 1 ); return N - 1; }
+ static char* addData( char* buffer, const char str[ N ] ) { return addDataHelper( buffer, str, N - 1 ); }
+ static sal_Unicode* addData( sal_Unicode* buffer, const char str[ N ] ) { return addDataLiteral( buffer, str, N - 1 ); }
+ static const bool allowOStringConcat = true;
+ static const bool allowOUStringConcat = true;
+ };
+
+template<>
+struct ToStringHelper<OStringChar>
+ {
+ static std::size_t length(OStringChar) { return 1; }
+ static char* addData(char* buffer, OStringChar data)
+ { return addDataHelper(buffer, &data.c, 1); }
+ static bool const allowOStringConcat = true;
+ static bool const allowOUStringConcat = false;
+ };
+
+template<>
+struct ToStringHelper< const sal_Unicode* >
+ {
+ static std::size_t length( const sal_Unicode* str ) {
+ return str ? std::char_traits<char16_t>::length( str ) : 0;
+ }
+ static sal_Unicode* addData( sal_Unicode* buffer, const sal_Unicode* str ) {
+ return str ? addDataUString( buffer, str ) : buffer;
+ }
+ static const bool allowOStringConcat = false;
+ static const bool allowOUStringConcat = true;
+ };
+
+template<>
+struct ToStringHelper< sal_Unicode* > : public ToStringHelper< const sal_Unicode* > {};
+
+template<std::size_t N>
+struct ToStringHelper<sal_Unicode[ N ]>
+ {
+ static std::size_t length( const sal_Unicode str[ N ] ) {
+ return std::char_traits<char16_t>::length( str );
+ }
+ static sal_Unicode * addData(sal_Unicode * buffer, sal_Unicode const str[N])
+ { return addDataHelper(buffer, str, N - 1); }
+ static bool const allowOStringConcat = false;
+ static bool const allowOUStringConcat = true;
+ };
+
+template<std::size_t N>
+struct ToStringHelper<sal_Unicode const[N]>
+ {
+ static std::size_t length( const sal_Unicode str[ N ] ) { (void)str; assert( std::char_traits<char16_t>::length( str ) == N - 1 ); return N - 1; }
+ static sal_Unicode * addData(sal_Unicode * buffer, sal_Unicode const str[N])
+ { return addDataHelper(buffer, str, N - 1); }
+ static bool const allowOStringConcat = false;
+ static bool const allowOUStringConcat = true;
+ };
+
+template<>
+struct ToStringHelper<OUStringChar_>
+ {
+ static std::size_t length(OUStringChar_) { return 1; }
+ static sal_Unicode * addData(sal_Unicode * buffer, OUStringChar_ literal)
+ { return addDataHelper(buffer, &literal.c, 1); }
+ static bool const allowOStringConcat = false;
+ static bool const allowOUStringConcat = true;
+ };
+
+/**
+@internal
+
+Objects returned by operator+, instead of OString. These objects (possibly recursively) keep a representation of the whole
+concatenation operation.
+
+If you get a build error related to this class, you most probably need to explicitly convert the result of a string
+concatenation to OString.
+*/
+template< typename T1, typename T2 >
+struct OStringConcat
+ {
+ public:
+ OStringConcat( const T1& left_, const T2& right_ ) : left( left_ ), right( right_ ) {}
+ std::size_t length() const { return ToStringHelper< T1 >::length( left ) + ToStringHelper< T2 >::length( right ); }
+ char* addData( char* buffer ) const SAL_RETURNS_NONNULL { return ToStringHelper< T2 >::addData( ToStringHelper< T1 >::addData( buffer, left ), right ); }
+ // NOTE here could be functions that would forward to the "real" temporary OString. Note however that e.g. getStr()
+ // is not so simple, as the OString temporary must live long enough (i.e. can't be created here in a function, a wrapper
+ // temporary object containing it must be returned instead).
+ private:
+ const T1& left;
+ const T2& right;
+ };
+
+/**
+@internal
+
+Objects returned by operator+, instead of OUString. These objects (possibly recursively) keep a representation of the whole
+concatenation operation.
+
+If you get a build error related to this class, you most probably need to explicitly convert the result of a string
+concatenation to OUString.
+*/
+template< typename T1, typename T2 >
+struct OUStringConcat
+ {
+ public:
+ OUStringConcat( const T1& left_, const T2& right_ ) : left( left_ ), right( right_ ) {}
+ std::size_t length() const { return ToStringHelper< T1 >::length( left ) + ToStringHelper< T2 >::length( right ); }
+ sal_Unicode* addData( sal_Unicode* buffer ) const SAL_RETURNS_NONNULL { return ToStringHelper< T2 >::addData( ToStringHelper< T1 >::addData( buffer, left ), right ); }
+ private:
+ const T1& left;
+ const T2& right;
+ };
+
+template< typename T1, typename T2 >
+struct ToStringHelper< OStringConcat< T1, T2 > >
+ {
+ static std::size_t length( const OStringConcat< T1, T2 >& c ) { return c.length(); }
+ static char* addData( char* buffer, const OStringConcat< T1, T2 >& c ) SAL_RETURNS_NONNULL { return c.addData( buffer ); }
+ static const bool allowOStringConcat = ToStringHelper< T1 >::allowOStringConcat && ToStringHelper< T2 >::allowOStringConcat;
+ static const bool allowOUStringConcat = false;
+ };
+
+template< typename T1, typename T2 >
+struct ToStringHelper< OUStringConcat< T1, T2 > >
+ {
+ static std::size_t length( const OUStringConcat< T1, T2 >& c ) { return c.length(); }
+ static sal_Unicode* addData( sal_Unicode* buffer, const OUStringConcat< T1, T2 >& c ) SAL_RETURNS_NONNULL { return c.addData( buffer ); }
+ static const bool allowOStringConcat = false;
+ static const bool allowOUStringConcat = ToStringHelper< T1 >::allowOUStringConcat && ToStringHelper< T2 >::allowOUStringConcat;
+ };
+
+template< typename T1, typename T2 >
+[[nodiscard]]
+inline
+typename std::enable_if_t< ToStringHelper< T1 >::allowOStringConcat && ToStringHelper< T2 >::allowOStringConcat, OStringConcat< T1, T2 > > operator+( const T1& left, const T2& right )
+ {
+ return OStringConcat< T1, T2 >( left, right );
+ }
+
+// char[N] and const char[N] need to be done explicitly, otherwise the compiler likes to treat them the same way for some reason
+template< typename T, std::size_t N >
+[[nodiscard]]
+inline
+typename std::enable_if_t< ToStringHelper< T >::allowOStringConcat, OStringConcat< T, const char[ N ] > > operator+( const T& left, const char (&right)[ N ] )
+ {
+ return OStringConcat< T, const char[ N ] >( left, right );
+ }
+
+template< typename T, std::size_t N >
+[[nodiscard]]
+inline
+typename std::enable_if_t< ToStringHelper< T >::allowOStringConcat, OStringConcat< const char[ N ], T > > operator+( const char (&left)[ N ], const T& right )
+ {
+ return OStringConcat< const char[ N ], T >( left, right );
+ }
+
+template< typename T, std::size_t N >
+[[nodiscard]]
+inline
+typename std::enable_if_t< ToStringHelper< T >::allowOStringConcat, OStringConcat< T, char[ N ] > > operator+( const T& left, char (&right)[ N ] )
+ {
+ return OStringConcat< T, char[ N ] >( left, right );
+ }
+
+template< typename T, std::size_t N >
+[[nodiscard]]
+inline
+typename std::enable_if_t< ToStringHelper< T >::allowOStringConcat, OStringConcat< char[ N ], T > > operator+( char (&left)[ N ], const T& right )
+ {
+ return OStringConcat< char[ N ], T >( left, right );
+ }
+
+template< typename T1, typename T2 >
+[[nodiscard]]
+inline
+typename std::enable_if_t< ToStringHelper< T1 >::allowOUStringConcat && ToStringHelper< T2 >::allowOUStringConcat, OUStringConcat< T1, T2 > > operator+( const T1& left, const T2& right )
+ {
+ return OUStringConcat< T1, T2 >( left, right );
+ }
+
+template< typename T1, typename T2 >
+[[nodiscard]]
+inline
+typename std::enable_if_t< ToStringHelper< T1 >::allowOUStringConcat && ToStringHelper< T2 >::allowOUStringConcat && libreoffice_internal::ConstCharArrayDetector< T1, void >::ok, OUStringConcat< T1, T2 > > operator+( T1& left, const T2& right )
+ {
+ return OUStringConcat< T1, T2 >( left, right );
+ }
+
+template< typename T1, typename T2 >
+[[nodiscard]]
+inline
+typename std::enable_if_t< ToStringHelper< T1 >::allowOUStringConcat && ToStringHelper< T2 >::allowOUStringConcat && libreoffice_internal::ConstCharArrayDetector< T2, void >::ok, OUStringConcat< T1, T2 > > operator+( const T1& left, T2& right )
+ {
+ return OUStringConcat< T1, T2 >( left, right );
+ }
+
+#ifdef RTL_STRING_UNITTEST_CONCAT
+// Special overload to catch the remaining invalid combinations. The helper struct must
+// be used to make this operator+ overload a worse choice than all the existing overloads above.
+struct StringConcatInvalid
+ {
+ template< typename T >
+ StringConcatInvalid( const T& ) {}
+ };
+template< typename T >
+inline
+int operator+( const StringConcatInvalid&, const T& )
+ {
+ rtl_string_unittest_invalid_concat = true;
+ return 0; // doesn't matter
+ }
+#endif
+
+// Lightweight alternative to OString when a (temporary) object is needed to hold an OStringConcat
+// result that can then be used as a std::string_view:
+class OStringConcatenation {
+public:
+ template<typename T1, typename T2>
+ explicit OStringConcatenation(OStringConcat<T1, T2> const & c):
+ length_(c.length()),
+ buffer_(new char[length_])
+ {
+ auto const end = c.addData(buffer_.get());
+ assert(end == buffer_.get() + length_); (void)end;
+ }
+
+ operator std::string_view() const { return {buffer_.get(), length_}; }
+
+private:
+ std::size_t length_;
+ std::unique_ptr<char[]> buffer_;
+};
+
+// Lightweight alternative to OUString when a (temporary) object is needed to hold an
+// OUStringConcat result that can then be used as a std::u16string_view:
+class OUStringConcatenation {
+public:
+ template<typename T1, typename T2>
+ explicit OUStringConcatenation(OUStringConcat<T1, T2> const & c):
+ length_(c.length()),
+ buffer_(new char16_t[length_])
+ {
+ auto const end = c.addData(buffer_.get());
+ assert(end == buffer_.get() + length_); (void)end;
+ }
+
+ operator std::u16string_view() const { return {buffer_.get(), length_}; }
+
+private:
+ std::size_t length_;
+ std::unique_ptr<char16_t[]> buffer_;
+};
+
+/**
+ @internal
+
+Objects returned by OString::number(), instead of OString. These objects keep a representation of the number() operation.
+
+If you get a build error related to this class, you most probably need to explicitly convert the result of calling
+OString::number() to OString.
+*/
+template< typename T >
+struct OStringNumber;
+
+template <typename Number, std::size_t nBufSize> struct OStringNumberBase
+{
+ using number_t = Number;
+ // OString::number(value).getStr() is very common (writing xml code, ...),
+ // so implement that one also here, to avoid having to explicitly to convert
+ // to OString in all such places
+ const char * getStr() const SAL_RETURNS_NONNULL { return buf; }
+ OStringNumber<number_t>&& toAsciiUpperCase()
+ {
+ rtl_str_toAsciiUpperCase_WithLength(buf, length);
+ return std::move(*static_cast<OStringNumber<number_t>*>(this));
+ }
+ operator std::string_view() const { return std::string_view(buf, length); }
+ char buf[nBufSize];
+ sal_Int32 length;
+};
+
+template<>
+struct OStringNumber< int >
+ : public OStringNumberBase<int, RTL_STR_MAX_VALUEOFINT32>
+{
+ OStringNumber(number_t i, sal_Int16 radix) { length = rtl_str_valueOfInt32(buf, i, radix); }
+};
+
+template<>
+struct OStringNumber< long long >
+ : public OStringNumberBase<long long, RTL_STR_MAX_VALUEOFINT64>
+{
+ OStringNumber(number_t i, sal_Int16 radix) { length = rtl_str_valueOfInt64(buf, i, radix); }
+};
+
+template<>
+struct OStringNumber< unsigned long long >
+ : public OStringNumberBase<unsigned long long, RTL_STR_MAX_VALUEOFUINT64>
+{
+ OStringNumber(number_t i, sal_Int16 radix) { length = rtl_str_valueOfUInt64(buf, i, radix); }
+};
+
+template<>
+struct OStringNumber< float >
+ : public OStringNumberBase<float, RTL_STR_MAX_VALUEOFFLOAT>
+{
+ OStringNumber(number_t f) { length = rtl_str_valueOfFloat(buf, f); }
+};
+
+template<>
+struct OStringNumber< double >
+ : public OStringNumberBase<double, RTL_STR_MAX_VALUEOFDOUBLE>
+{
+ OStringNumber(number_t d) { length = rtl_str_valueOfDouble(buf, d); }
+};
+
+template< typename T >
+struct ToStringHelper< OStringNumber< T > >
+ {
+ static std::size_t length( const OStringNumber< T >& n ) { return n.length; }
+ static char* addData( char* buffer, const OStringNumber< T >& n ) SAL_RETURNS_NONNULL { return addDataHelper( buffer, n.buf, n.length ); }
+ static const bool allowOStringConcat = true;
+ static const bool allowOUStringConcat = false;
+ };
+
+
+/**
+ @internal
+
+Objects returned by OUString::number(), instead of OUString. These objects keep a representation of the number() operation.
+
+If you get a build error related to this class, you most probably need to explicitly convert the result of calling
+OUString::number() to OUString.
+*/
+template< typename T >
+struct OUStringNumber;
+
+template <typename Number, std::size_t nBufSize> struct OUStringNumberBase
+{
+ using number_t = Number;
+ OUStringNumber<number_t>&& toAsciiUpperCase()
+ {
+ rtl_ustr_toAsciiUpperCase_WithLength(buf, length);
+ return std::move(*static_cast<OUStringNumber<number_t>*>(this));
+ }
+ operator std::u16string_view() const { return std::u16string_view(buf, length); }
+ sal_Unicode buf[nBufSize];
+ sal_Int32 length;
+};
+
+template<>
+struct OUStringNumber< int >
+ : public OUStringNumberBase<int, RTL_USTR_MAX_VALUEOFINT32>
+{
+ OUStringNumber(number_t i, sal_Int16 radix) { length = rtl_ustr_valueOfInt32(buf, i, radix); }
+};
+
+template<>
+struct OUStringNumber< long long >
+ : public OUStringNumberBase<long long, RTL_USTR_MAX_VALUEOFINT64>
+{
+ OUStringNumber(number_t i, sal_Int16 radix) { length = rtl_ustr_valueOfInt64(buf, i, radix); }
+};
+
+template<>
+struct OUStringNumber< unsigned long long >
+ : public OUStringNumberBase<unsigned long long, RTL_USTR_MAX_VALUEOFUINT64>
+{
+ OUStringNumber(number_t i, sal_Int16 radix) { length = rtl_ustr_valueOfUInt64(buf, i, radix); }
+};
+
+template<>
+struct OUStringNumber< float >
+ : public OUStringNumberBase<float, RTL_USTR_MAX_VALUEOFFLOAT>
+{
+ OUStringNumber(number_t f) { length = rtl_ustr_valueOfFloat(buf, f); }
+};
+
+template<>
+struct OUStringNumber< double >
+ : public OUStringNumberBase<double, RTL_USTR_MAX_VALUEOFDOUBLE>
+{
+ OUStringNumber(number_t d) { length = rtl_ustr_valueOfDouble(buf, d); }
+};
+
+template< typename T >
+struct ToStringHelper< OUStringNumber< T > >
+ {
+ static std::size_t length( const OUStringNumber< T >& n ) { return n.length; }
+ static sal_Unicode* addData( sal_Unicode* buffer, const OUStringNumber< T >& n ) SAL_RETURNS_NONNULL { return addDataHelper( buffer, n.buf, n.length ); }
+ static const bool allowOStringConcat = false;
+ static const bool allowOUStringConcat = true;
+ };
+
+template<> struct ToStringHelper<std::string_view> {
+ static constexpr std::size_t length(std::string_view s) { return s.size(); }
+
+ static char * addData(char * buffer, std::string_view s) SAL_RETURNS_NONNULL
+ { return addDataHelper(buffer, s.data(), s.size()); }
+
+ static constexpr bool allowOStringConcat = true;
+ static constexpr bool allowOUStringConcat = false;
+};
+
+template<> struct ToStringHelper<std::u16string_view> {
+ static constexpr std::size_t length(std::u16string_view s) { return s.size(); }
+
+ static sal_Unicode * addData(sal_Unicode * buffer, std::u16string_view s) SAL_RETURNS_NONNULL
+ { return addDataHelper(buffer, s.data(), s.size()); }
+
+ static constexpr bool allowOStringConcat = false;
+ static constexpr bool allowOUStringConcat = true;
+};
+
+// An internal marker class used by OString::Concat:
+struct OStringConcatMarker {};
+
+template<> struct ToStringHelper<OStringConcatMarker> {
+ static constexpr std::size_t length(OStringConcatMarker) { return 0; }
+
+ static constexpr char * addData(char * buffer, OStringConcatMarker) SAL_RETURNS_NONNULL
+ { return buffer; }
+
+ static constexpr bool allowOStringConcat = true;
+ static constexpr bool allowOUStringConcat = false;
+};
+
+// An internal marker class used by OUString::Concat:
+struct OUStringConcatMarker {};
+
+template<> struct ToStringHelper<OUStringConcatMarker> {
+ static constexpr std::size_t length(OUStringConcatMarker) { return 0; }
+
+ static constexpr sal_Unicode * addData(sal_Unicode * buffer, OUStringConcatMarker)
+ SAL_RETURNS_NONNULL
+ { return buffer; }
+
+ static constexpr bool allowOStringConcat = false;
+ static constexpr bool allowOUStringConcat = true;
+};
+
+} // namespace
+
+#endif
diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx
new file mode 100644
index 000000000..58781973f
--- /dev/null
+++ b/include/rtl/stringutils.hxx
@@ -0,0 +1,391 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_STRINGUTILS_HXX
+#define INCLUDED_RTL_STRINGUTILS_HXX
+
+#include "sal/config.h"
+
+#include <cassert>
+#include <cstddef>
+
+#include "sal/types.h"
+
+// The unittest uses slightly different code to help check that the proper
+// calls are made. The class is put into a different namespace to make
+// sure the compiler generates a different (if generating also non-inline)
+// copy of the function and does not merge them together. The class
+// is "brought" into the proper rtl namespace by a typedef below.
+#ifdef RTL_STRING_UNITTEST
+#define rtl rtlunittest
+#endif
+
+namespace rtl
+{
+
+#ifdef RTL_STRING_UNITTEST
+#undef rtl
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+/// @cond INTERNAL
+
+// A simple wrapper around a single char. Can be useful in string concatenation contexts, like in
+//
+// OString s = ...;
+// char c = ...;
+// s += OStringChar(c);
+//
+struct SAL_WARN_UNUSED OStringChar {
+ constexpr OStringChar(char theC): c(theC) {}
+ template<typename T> OStringChar(T &&) = delete;
+ constexpr operator std::string_view() const { return {&c, 1}; }
+ char const c;
+};
+
+/** A simple wrapper around a single sal_Unicode character.
+
+ Can be useful to pass a sal_Unicode constant into an OUString-related
+ function that is optimized for UTF-16 string literal arguments. That is,
+ instead of
+
+ sal_Unicode const WILDCARD = '%';
+ ...
+ if (s[i] == WILDCARD) ...
+ ...
+ if (s.endsWith(OUString(WILDCARD))) ...
+
+ use
+
+ sal_Unicode const WILDCARD = '%';
+ ...
+ if (s[i] == WILDCARD) ...
+ ...
+ if (s.endsWith(OUStringChar(WILDCARD))) ...
+
+ to avoid creating a temporary OUString instance, and instead pick the
+ endsWith overload actually designed to take an argument of type
+ sal_Unicode const[N].
+
+ (Because of the above use case,
+ instances of OUStringChar need to be const, as those literal-optimized
+ functions take the literal argument by non-const lvalue reference, for
+ technical reasons.
+
+ For actual arrays, it is important to distinguish string literals from other char or sal_Unicode
+ arrays, which may contain junk after the first NUL character or may be non-ASCII in the case of
+ char arrays. This is not so much a concern for single char and sal_Unicode values, where NUL is
+ assumed to always be meant as an actual character.)
+
+ Can also be useful in string concatenation contexts, like in
+
+ sal_Unicode const * s = ...;
+ sal_Unicode c = ...;
+ OUString t = s + OUStringChar(c);
+
+ @since LibreOffice 5.0
+*/
+struct SAL_WARN_UNUSED OUStringChar_ {
+ constexpr OUStringChar_(sal_Unicode theC): c(theC) {}
+ constexpr OUStringChar_(char theC): c(theC) { assert(c <= 0x7F); }
+ template<typename T> OUStringChar_(T &&) = delete;
+ constexpr operator std::u16string_view() const { return {&c, 1}; }
+ sal_Unicode const c;
+};
+using OUStringChar = OUStringChar_ const;
+
+/// @endcond
+#endif
+
+namespace libreoffice_internal
+{
+/*
+These templates use SFINAE (Substitution failure is not an error) to help distinguish the various
+plain C string types: char*, const char*, char[N], const char[N], char[] and const char[].
+There are 2 cases:
+1) Only string literal (i.e. const char[N]) is wanted, not any of the others.
+ In this case it is necessary to distinguish between const char[N] and char[N], as the latter
+ would be automatically converted to the const variant, which is not wanted (not a string literal
+ with known size of the content). In this case ConstCharArrayDetector is used to ensure the function
+ is called only with const char[N] arguments. There's no other plain C string type overload.
+ (Note that OUStringChar is also covered by ConstCharArrayDetector's TypeUtf16 check, but
+ provides a pointer to a string that is not NUL-terminated, unlike the char16_t const[N] arrays
+ normally covered by that check, and which are assumed to represent NUL-terminated string
+ literals.)
+2) All plain C string types are wanted, and const char[N] needs to be handled differently.
+ In this case const char[N] would match const char* argument type (not exactly sure why, but it's
+ consistent in all of gcc, clang and msvc). Using a template with a reference to const of the type
+ avoids this problem, and CharPtrDetector ensures that the function is called only with char pointer
+ arguments. The const in the argument is necessary to handle the case when something is explicitly
+ cast to const char*. Additionally (non-const) char[N] needs to be handled, but with the reference
+ being const, it would also match const char[N], so another overload with a reference to non-const
+ and NonConstCharArrayDetector are used to ensure the function is called only with (non-const) char[N].
+Additionally, char[] and const char[] (i.e. size unknown) are rather tricky. Their usage with 'T&' would
+mean it would be 'char(&)[]', which seems to be invalid. But gcc and clang somehow manage when it is
+a template. while msvc complains about no conversion from char[] to char[1]. And the reference cannot
+be avoided, because 'const char[]' as argument type would match also 'const char[N]'
+So char[] and const char[] should always be used with their contents specified (which automatically
+turns them into char[N] or const char[N]), or char* and const char* should be used.
+*/
+struct Dummy {};
+template< typename T1, typename T2 = void >
+struct CharPtrDetector
+{
+ static const bool ok = false;
+};
+template< typename T >
+struct CharPtrDetector< const char*, T >
+{
+ typedef T Type;
+ static const bool ok = true;
+};
+template< typename T >
+struct CharPtrDetector< char*, T >
+{
+ typedef T Type;
+ static const bool ok = true;
+};
+#if defined LIBO_INTERNAL_ONLY
+template<typename T> struct CharPtrDetector<sal_Unicode *, T> { using TypeUtf16 = T; };
+template<typename T> struct CharPtrDetector<sal_Unicode const *, T> { using TypeUtf16 = T; };
+template<typename T> struct CharPtrDetector<sal_Unicode[], T> { using TypeUtf16 = T; };
+template<typename T> struct CharPtrDetector<sal_Unicode const[], T> { using TypeUtf16 = T; };
+#endif
+
+template< typename T1, typename T2 >
+struct NonConstCharArrayDetector
+{
+};
+template< typename T, int N >
+struct NonConstCharArrayDetector< char[ N ], T >
+{
+ typedef T Type;
+};
+#ifdef RTL_STRING_UNITTEST
+// never use, until all compilers handle this
+template< typename T >
+struct NonConstCharArrayDetector< char[], T >
+{
+ typedef T Type;
+};
+template< typename T >
+struct NonConstCharArrayDetector< const char[], T >
+{
+ typedef T Type;
+};
+#endif
+#if defined LIBO_INTERNAL_ONLY
+template<typename T, std::size_t N> struct NonConstCharArrayDetector<sal_Unicode[N], T> {
+ using TypeUtf16 = T;
+};
+#endif
+
+template< typename T1, typename T2 = void >
+struct ConstCharArrayDetector
+{
+ static const bool ok = false;
+};
+template< std::size_t N, typename T >
+struct ConstCharArrayDetector< const char[ N ], T >
+{
+ typedef T Type;
+ static const std::size_t length = N - 1;
+ static const bool ok = true;
+#if defined LIBO_INTERNAL_ONLY
+ constexpr
+#endif
+ static bool isValid(char const (& literal)[N]) {
+ for (std::size_t i = 0; i != N - 1; ++i) {
+ if (literal[i] == '\0') {
+ return false;
+ }
+ }
+ return literal[N - 1] == '\0';
+ }
+#if defined LIBO_INTERNAL_ONLY
+ constexpr
+#endif
+ static char const * toPointer(char const (& literal)[N]) { return literal; }
+};
+
+#if defined(__COVERITY__)
+//to silence over zealous warnings that the loop is logically dead
+//for the single char case
+template< typename T >
+struct ConstCharArrayDetector< const char[ 1 ], T >
+{
+ typedef T Type;
+ static const std::size_t length = 0;
+ static const bool ok = true;
+#if defined LIBO_INTERNAL_ONLY
+ constexpr
+#endif
+ static bool isValid(char const (& literal)[1]) {
+ return literal[0] == '\0';
+ }
+#if defined LIBO_INTERNAL_ONLY
+ constexpr
+#endif
+ static char const * toPointer(char const (& literal)[1]) { return literal; }
+};
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && defined __cpp_char8_t
+template<std::size_t N, typename T>
+struct ConstCharArrayDetector<char8_t const [N], T> {
+ using Type = T;
+ static constexpr bool const ok = true;
+ static constexpr std::size_t const length = N - 1;
+ static constexpr bool isValid(char8_t const (& literal)[N]) {
+ for (std::size_t i = 0; i != N - 1; ++i) {
+ if (literal[i] == u8'\0') {
+ return false;
+ }
+ }
+ return literal[N - 1] == u8'\0';
+ }
+ static constexpr char const * toPointer(char8_t const (& literal)[N])
+ { return reinterpret_cast<char const *>(literal); }
+};
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+template<std::size_t N, typename T>
+struct ConstCharArrayDetector<sal_Unicode const [N], T> {
+ using TypeUtf16 = T;
+ static constexpr bool const ok = true;
+ static constexpr std::size_t const length = N - 1;
+ static constexpr bool isValid(sal_Unicode const (& literal)[N]) {
+ for (std::size_t i = 0; i != N - 1; ++i) {
+ if (literal[i] == '\0') {
+ return false;
+ }
+ }
+ return literal[N - 1] == '\0';
+ }
+ static constexpr sal_Unicode const * toPointer(
+ sal_Unicode const (& literal)[N])
+ { return literal; }
+};
+
+#if defined(__COVERITY__)
+//to silence over zealous warnings that the loop is logically dead
+//for the single char case
+template<typename T>
+struct ConstCharArrayDetector<sal_Unicode const [1], T> {
+ using TypeUtf16 = T;
+ static constexpr bool const ok = true;
+ static constexpr std::size_t const length = 0;
+ static constexpr bool isValid(sal_Unicode const (& literal)[1]) {
+ return literal[0] == '\0';
+ }
+ static constexpr sal_Unicode const * toPointer(
+ sal_Unicode const (& literal)[1])
+ { return literal; }
+};
+#endif
+
+template<typename T> struct ConstCharArrayDetector<
+ OUStringChar,
+ T>
+{
+ using TypeUtf16 = T;
+ static constexpr bool const ok = true;
+ static constexpr std::size_t const length = 1;
+ static constexpr bool isValid(OUStringChar) { return true; }
+ static constexpr sal_Unicode const * toPointer(
+ OUStringChar_ const & literal)
+ { return &literal.c; }
+};
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && defined RTL_STRING_UNITTEST
+
+// this one is used to rule out only const char[N]
+template< typename T >
+struct ExceptConstCharArrayDetector
+{
+ typedef Dummy Type;
+};
+template< int N >
+struct ExceptConstCharArrayDetector< const char[ N ] >
+{
+};
+template<std::size_t N>
+struct ExceptConstCharArrayDetector<sal_Unicode const[N]> {};
+template<> struct ExceptConstCharArrayDetector<
+ OUStringChar
+ >
+{};
+
+// this one is used to rule out only const char[N]
+// (const will be brought in by 'const T&' in the function call)
+// msvc needs const char[N] here (not sure whether gcc or msvc
+// are right, it doesn't matter).
+template< typename T >
+struct ExceptCharArrayDetector
+{
+ typedef Dummy Type;
+};
+template< int N >
+struct ExceptCharArrayDetector< char[ N ] >
+{
+};
+template< int N >
+struct ExceptCharArrayDetector< const char[ N ] >
+{
+};
+template<std::size_t N> struct ExceptCharArrayDetector<sal_Unicode[N]> {};
+template<std::size_t N> struct ExceptCharArrayDetector<sal_Unicode const[N]> {};
+template<> struct ExceptCharArrayDetector<OUStringChar_> {};
+
+#endif
+
+template< typename T1, typename T2 = void >
+struct SalUnicodePtrDetector
+{
+ static const bool ok = false;
+};
+template< typename T >
+struct SalUnicodePtrDetector< const sal_Unicode*, T >
+{
+ typedef T Type;
+ static const bool ok = true;
+};
+template< typename T >
+struct SalUnicodePtrDetector< sal_Unicode*, T >
+{
+ typedef T Type;
+ static const bool ok = true;
+};
+
+// SFINAE helper class
+template< typename T, bool >
+struct Enable
+ {
+ };
+
+template< typename T >
+struct Enable< T, true >
+ {
+ typedef T Type;
+ };
+
+
+} /* Namespace */
+
+} /* Namespace */
+
+#endif // INCLUDED_RTL_STRINGUTILS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/tencinfo.h b/include/rtl/tencinfo.h
new file mode 100644
index 000000000..6154a9128
--- /dev/null
+++ b/include/rtl/tencinfo.h
@@ -0,0 +1,284 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_TENCINFO_H
+#define INCLUDED_RTL_TENCINFO_H
+
+#include "sal/config.h"
+
+#include "rtl/textenc.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// See rtl_TextEncodingInfo.Flags below for documentation on these values:
+#define RTL_TEXTENCODING_INFO_CONTEXT ((sal_uInt32)0x00000001)
+#define RTL_TEXTENCODING_INFO_ASCII ((sal_uInt32)0x00000002)
+#define RTL_TEXTENCODING_INFO_UNICODE ((sal_uInt32)0x00000004)
+#define RTL_TEXTENCODING_INFO_MULTIBYTE ((sal_uInt32)0x00000008)
+#define RTL_TEXTENCODING_INFO_R2L ((sal_uInt32)0x00000010)
+#define RTL_TEXTENCODING_INFO_7BIT ((sal_uInt32)0x00000020)
+#define RTL_TEXTENCODING_INFO_SYMBOL ((sal_uInt32)0x00000040)
+#define RTL_TEXTENCODING_INFO_MIME ((sal_uInt32)0x00000080)
+
+/** Information about a text encoding.
+ */
+typedef struct _rtl_TextEncodingInfo
+{
+ /** The size (in bytes) of this structure. Should be 12.
+ */
+ sal_uInt32 StructSize;
+
+ /** The minimum number of bytes needed to encode any character in the
+ given encoding.
+
+ Can be rather meaningless for encodings that encode global state along
+ with the characters (e.g., ISO-2022 encodings).
+ */
+ sal_uInt8 MinimumCharSize;
+
+ /** The maximum number of bytes needed to encode any character in the
+ given encoding.
+
+ Can be rather meaningless for encodings that encode global state along
+ with the characters (e.g., ISO-2022 encodings).
+ */
+ sal_uInt8 MaximumCharSize;
+
+ /** The average number of bytes needed to encode a character in the given
+ encoding.
+ */
+ sal_uInt8 AverageCharSize;
+
+ /** An unused byte, for padding.
+ */
+ sal_uInt8 Reserved;
+
+ /** Any combination of the RTL_TEXTENCODING_INFO flags.
+
+ RTL_TEXTENCODING_INFO_CONTEXT: The encoding uses some mechanism (like
+ state-changing byte sequences) to switch between different modes (e.g.,
+ to encode multiple character repertoires within the same byte ranges).
+
+ Even if an encoding does not have the CONTEXT property, interpretation
+ of certain byte values within that encoding can depend on context (e.g.,
+ a certain byte value could be either a single-byte character or a
+ subsequent byte of a multi-byte character). Likewise, the single shift
+ characters (SS2 and SS3) used by some of the EUC encodings (to denote
+ that the following bytes constitute a character from another character
+ repertoire) do not imply that encodings making use of these characters
+ have the CONTEXT property. Examples of encodings that do have the
+ CONTEXT property are the ISO-2022 encodings and UTF-7.
+
+ RTL_TEXTENCODING_INFO_ASCII: The encoding is a superset of ASCII. More
+ specifically, any appearance of a byte in the range 0x20--7F denotes the
+ corresponding ASCII character (from SPACE to DELETE); in particular,
+ such a byte cannot be part of a multi-byte character. Note that the
+ ASCII control codes 0x00--1F are not included here, as they are used for
+ special purposes in some encodings.
+
+ If an encoding has this property, it is easy to search for occurrences of
+ ASCII characters within strings of this encoding---you do not need to
+ keep track whether a byte in the range 0x20--7F really represents an
+ ASCII character or rather is part of some multi-byte character.
+
+ The guarantees when mapping between Unicode and a given encoding with
+ the ASCII property are as follows: When mapping from Unicode to the
+ given encoding, U+0020--007F map to 0x20--7F (but there can also be
+ other Unicode characters mapping into the range 0x20--7F), and when
+ mapping from the given encoding to Unicode, 0x20--7F map to U+0020--007F
+ (again, there can also be other characters mapping into the range
+ U+0020--007F). In particular, this ensures round-trip conversion for
+ the ASCII range.
+
+ In principle, the ASCII property is orthogonal to the CONTEXT property.
+ In practice, however, an encoding that has the ASCII property will most
+ likely not also have the CONTEXT property.
+
+ RTL_TEXTENCODING_INFO_UNICODE: The encoding is based on the Unicode
+ character repertoire.
+
+ RTL_TEXTENCODING_INFO_MULTIBYTE: A multi-byte encoding.
+
+ RTL_TEXTENCODING_INFO_R2L: An encoding used mainly or exclusively for
+ languages written from right to left.
+
+ RTL_TEXTENCODING_INFO_7BIT: A 7-bit instead of an 8-bit encoding.
+
+ RTL_TEXTENCODING_INFO_SYMBOL: A (generic) encoding for symbol character
+ sets.
+
+ RTL_TEXTENCODING_INFO_MIME: The encoding is registered as a MIME
+ charset.
+ */
+ sal_uInt32 Flags;
+} rtl_TextEncodingInfo;
+
+/** Determine whether a text encoding uses single octets as basic units of
+ information (and can thus be used with the conversion routines in
+ rtl/textcvt.h).
+
+ @param nEncoding
+ Any rtl_TextEncoding value.
+
+ @return
+ True if the given encoding uses single octets as basic units of
+ information, false otherwise.
+ */
+SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_isOctetTextEncoding(rtl_TextEncoding nEncoding);
+
+/** Return information about a text encoding.
+
+ @param eTextEncoding
+ Any rtl_TextEncoding value.
+
+ @param pEncInfo
+ Returns information about the given encoding. Must not be null, and the
+ StructSize member must be set correctly.
+
+ @return
+ True if information about the given encoding is available, false
+ otherwise.
+ */
+SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_getTextEncodingInfo(
+ rtl_TextEncoding eTextEncoding, rtl_TextEncodingInfo* pEncInfo );
+
+/** Map from a numeric Windows charset to a text encoding.
+
+ @param nWinCharset
+ Any numeric Windows charset.
+
+ @return
+ The corresponding rtl_TextEncoding value, or RTL_TEXTENCODING_DONTKNOW if
+ no mapping is applicable.
+ If nWinCharset is 255 (OEM_CHARSET), then return value is RTL_TEXTENCODING_IBM_850,
+ regardless of current locale.
+ */
+SAL_DLLPUBLIC rtl_TextEncoding SAL_CALL rtl_getTextEncodingFromWindowsCharset(
+ sal_uInt8 nWinCharset );
+
+/** Map from a MIME charset to a text encoding.
+
+ @param pMimeCharset
+ Any MIME charset string. Must not be null.
+
+ @return
+ The corresponding rtl_TextEncoding value, or RTL_TEXTENCODING_DONTKNOW if
+ no mapping is applicable.
+ */
+SAL_DLLPUBLIC rtl_TextEncoding SAL_CALL rtl_getTextEncodingFromMimeCharset(
+ const char* pMimeCharset );
+
+/** Map from a Unix charset to a text encoding.
+
+ @param pUnixCharset
+ Any Unix charset string. Must not be null.
+
+ @return
+ The corresponding rtl_TextEncoding value, or RTL_TEXTENCODING_DONTKNOW if
+ no mapping is applicable.
+ */
+SAL_DLLPUBLIC rtl_TextEncoding SAL_CALL rtl_getTextEncodingFromUnixCharset(
+ const char* pUnixCharset );
+
+/** Map from a text encoding to the best matching numeric Windows charset.
+
+ @param eTextEncoding
+ Any rtl_TextEncoding value.
+
+ @return
+ The best matching numeric Windows charset, or 1 if none matches.
+ */
+SAL_DLLPUBLIC sal_uInt8 SAL_CALL rtl_getBestWindowsCharsetFromTextEncoding(
+ rtl_TextEncoding eTextEncoding );
+
+/** Map from a text encoding to a corresponding MIME charset name, if
+ available (see <http://www.iana.org/assignments/character-sets>).
+
+ @param nEncoding
+ Any rtl_TextEncoding value.
+
+ @return
+ The (preferred) MIME charset name corresponding to the given encoding, or
+ NULL if none is available.
+ */
+SAL_DLLPUBLIC char const * SAL_CALL rtl_getMimeCharsetFromTextEncoding(
+ rtl_TextEncoding nEncoding );
+
+/** Map from a text encoding to the best matching MIME charset.
+
+ @param eTextEncoding
+ Any rtl_TextEncoding value.
+
+ @return
+ The best matching MIME charset string, or null if none matches.
+ */
+SAL_DLLPUBLIC const char* SAL_CALL rtl_getBestMimeCharsetFromTextEncoding(
+ rtl_TextEncoding eTextEncoding );
+
+/** Map from a text encoding to the best matching Unix charset.
+
+ @param eTextEncoding
+ Any rtl_TextEncoding value.
+
+ @return
+ The best matching Unix charset string, or null if none matches.
+ */
+SAL_DLLPUBLIC const char* SAL_CALL rtl_getBestUnixCharsetFromTextEncoding(
+ rtl_TextEncoding eTextEncoding );
+
+/** Map from a Windows code page to a text encoding.
+
+ @param nCodePage
+ Any Windows code page number.
+
+ @return
+ The corresponding rtl_TextEncoding value (which will be an octet text
+ encoding, see rtl_isOctetTextEncoding), or RTL_TEXTENCODING_DONTKNOW if no
+ mapping is applicable.
+ */
+SAL_DLLPUBLIC rtl_TextEncoding SAL_CALL
+rtl_getTextEncodingFromWindowsCodePage(sal_uInt32 nCodePage);
+
+/** Map from a text encoding to a Windows code page.
+
+ @param nEncoding
+ Any rtl_TextEncoding value.
+
+ @return
+ The corresponding Windows code page number, or 0 if no mapping is
+ applicable.
+ */
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL
+rtl_getWindowsCodePageFromTextEncoding(rtl_TextEncoding nEncoding);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_RTL_TENCINFO_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/textcvt.h b/include/rtl/textcvt.h
new file mode 100644
index 000000000..14d374c16
--- /dev/null
+++ b/include/rtl/textcvt.h
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_TEXTCVT_H
+#define INCLUDED_RTL_TEXTCVT_H
+
+#include "sal/config.h"
+
+#include "rtl/textenc.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Documentation about this file can be found at
+ <http://udk.openoffice.org/cpp/man/spec/textconversion.html>. */
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+typedef void* rtl_TextToUnicodeConverter;
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+typedef void* rtl_TextToUnicodeContext;
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+SAL_DLLPUBLIC rtl_TextToUnicodeConverter SAL_CALL rtl_createTextToUnicodeConverter( rtl_TextEncoding eTextEncoding );
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_destroyTextToUnicodeConverter( rtl_TextToUnicodeConverter hConverter );
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+SAL_DLLPUBLIC rtl_TextToUnicodeContext SAL_CALL rtl_createTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter );
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_destroyTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter, rtl_TextToUnicodeContext hContext );
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_resetTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter, rtl_TextToUnicodeContext hContext );
+
+#define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR ((sal_uInt32)0x0001)
+#define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE ((sal_uInt32)0x0002)
+#define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE ((sal_uInt32)0x0003)
+#define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT ((sal_uInt32)0x0004)
+#define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR ((sal_uInt32)0x0010)
+#define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_IGNORE ((sal_uInt32)0x0020)
+#define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT ((sal_uInt32)0x0030)
+#define RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR ((sal_uInt32)0x0100)
+#define RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE ((sal_uInt32)0x0200)
+#define RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT ((sal_uInt32)0x0300)
+#define RTL_TEXTTOUNICODE_FLAGS_FLUSH ((sal_uInt32)0x8000)
+#define RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE 0x10000
+ /* Accept any global document signatures (for example, in UTF-8, a leading
+ EF BB BF encoding the Byte Order Mark U+FEFF) */
+
+#define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MASK ((sal_uInt32)0x000F)
+#define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_MASK ((sal_uInt32)0x00F0)
+#define RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK ((sal_uInt32)0x0F00)
+
+#define RTL_TEXTTOUNICODE_INFO_ERROR ((sal_uInt32)0x0001)
+// Misspelled constant, kept for backwards compatibility:
+#define RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL ((sal_uInt32)0x0002)
+#define RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL ((sal_uInt32)0x0002)
+// Misspelled constant, kept for backwards compatibility:
+#define RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL ((sal_uInt32)0x0004)
+#define RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL ((sal_uInt32)0x0004)
+#define RTL_TEXTTOUNICODE_INFO_UNDEFINED ((sal_uInt32)0x0008)
+#define RTL_TEXTTOUNICODE_INFO_MBUNDEFINED ((sal_uInt32)0x0010)
+#define RTL_TEXTTOUNICODE_INFO_INVALID ((sal_uInt32)0x0020)
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+
+ Deviating from the linked specification, the behavior of
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR, RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR, and
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR is as follows: When RTL_TEXTTOUNICODE_FLAGS_FLUSH is not
+ set, the erroneous input bytes are consumed as required by the linked specification. But if
+ RTL_TEXTTOUNICODE_FLAGS_FLUSH is set, any of those erroneous input bytes that would have been
+ consumed by this invocation of rtl_convertTextToUnicode (i.e., which had not already been
+ captured in hContext from a previous invocation with RTL_TEXTTOUNICODE_FLAGS_FLUSH unset) are
+ not consumed.
+ */
+SAL_DLLPUBLIC sal_Size SAL_CALL rtl_convertTextToUnicode(
+ rtl_TextToUnicodeConverter hConverter,
+ rtl_TextToUnicodeContext hContext,
+ const char* pSrcBuf, sal_Size nSrcBytes,
+ sal_Unicode* pDestBuf, sal_Size nDestChars,
+ sal_uInt32 nFlags, sal_uInt32* pInfo,
+ sal_Size* pSrcCvtBytes );
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+typedef void* rtl_UnicodeToTextConverter;
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+typedef void* rtl_UnicodeToTextContext;
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+SAL_DLLPUBLIC rtl_UnicodeToTextConverter SAL_CALL rtl_createUnicodeToTextConverter( rtl_TextEncoding eTextEncoding );
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_destroyUnicodeToTextConverter( rtl_UnicodeToTextConverter hConverter );
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+SAL_DLLPUBLIC rtl_UnicodeToTextContext SAL_CALL rtl_createUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter );
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_destroyUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter, rtl_UnicodeToTextContext hContext );
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_resetUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter, rtl_UnicodeToTextContext hContext );
+
+#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR ((sal_uInt32)0x0001)
+#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE ((sal_uInt32)0x0002)
+#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_0 ((sal_uInt32)0x0003)
+#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK ((sal_uInt32)0x0004)
+#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_UNDERLINE ((sal_uInt32)0x0005)
+#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT ((sal_uInt32)0x0006)
+#define RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR ((sal_uInt32)0x0010)
+#define RTL_UNICODETOTEXT_FLAGS_INVALID_IGNORE ((sal_uInt32)0x0020)
+#define RTL_UNICODETOTEXT_FLAGS_INVALID_0 ((sal_uInt32)0x0030)
+#define RTL_UNICODETOTEXT_FLAGS_INVALID_QUESTIONMARK ((sal_uInt32)0x0040)
+#define RTL_UNICODETOTEXT_FLAGS_INVALID_UNDERLINE ((sal_uInt32)0x0050)
+#define RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT ((sal_uInt32)0x0060)
+#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE ((sal_uInt32)0x0100)
+#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR ((sal_uInt32)0x0200)
+#define RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 ((sal_uInt32)0x0400)
+#define RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE ((sal_uInt32)0x0800)
+#define RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE ((sal_uInt32)0x1000)
+#define RTL_UNICODETOTEXT_FLAGS_PRIVATE_IGNORE ((sal_uInt32)0x2000)
+#define RTL_UNICODETOTEXT_FLAGS_NOCOMPOSITE ((sal_uInt32)0x4000) ///< has no effect @deprecated
+#define RTL_UNICODETOTEXT_FLAGS_FLUSH ((sal_uInt32)0x8000)
+#define RTL_UNICODETOTEXT_FLAGS_GLOBAL_SIGNATURE 0x10000
+ /* Write any global document signatures (for example, in UTF-8, a leading
+ EF BB BF encoding the Byte Order Mark U+FEFF) */
+
+#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_MASK ((sal_uInt32)0x000F)
+#define RTL_UNICODETOTEXT_FLAGS_INVALID_MASK ((sal_uInt32)0x00F0)
+
+#define RTL_UNICODETOTEXT_INFO_ERROR ((sal_uInt32)0x0001)
+#define RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL ((sal_uInt32)0x0002)
+#define RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL ((sal_uInt32)0x0004)
+#define RTL_UNICODETOTEXT_INFO_UNDEFINED ((sal_uInt32)0x0008)
+#define RTL_UNICODETOTEXT_INFO_INVALID ((sal_uInt32)0x0010)
+
+/** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
+ */
+SAL_DLLPUBLIC sal_Size SAL_CALL rtl_convertUnicodeToText(
+ rtl_UnicodeToTextConverter hConverter,
+ rtl_UnicodeToTextContext hContext,
+ const sal_Unicode* pSrcBuf, sal_Size nSrcChars,
+ char* pDestBuf, sal_Size nDestBytes,
+ sal_uInt32 nFlags, sal_uInt32* pInfo,
+ sal_Size* pSrcCvtChars );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_RTL_TEXTCVT_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/textenc.h b/include/rtl/textenc.h
new file mode 100644
index 000000000..1a675e1be
--- /dev/null
+++ b/include/rtl/textenc.h
@@ -0,0 +1,266 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_TEXTENC_H
+#define INCLUDED_RTL_TEXTENC_H
+
+#include "sal/types.h"
+
+/** The various supported text encodings.
+
+ Possible values include a wide range of single- and multi-byte encodings
+ (ranging from RTL_TEXTENCODING_MS_1252 to RTL_TEXTENCODING_GB_18030),
+ the ISO 10646 (Unicode) specific encodings RTL_TEXTENCODING_UCS4 and
+ RTL_TEXTENCODING_UCS2 (aka RTL_TEXTENCODING_UNICODE), and
+ RTL_TEXTENCODING_DONTKNOW to indicate an unknown or missing encoding.
+ */
+typedef sal_uInt16 rtl_TextEncoding;
+
+#define RTL_TEXTENC_CAST( val ) ((rtl_TextEncoding) val)
+
+#define RTL_TEXTENCODING_DONTKNOW (RTL_TEXTENC_CAST( 0 ))
+#define RTL_TEXTENCODING_MS_1252 (RTL_TEXTENC_CAST( 1 ))
+#define RTL_TEXTENCODING_APPLE_ROMAN (RTL_TEXTENC_CAST( 2 ))
+#define RTL_TEXTENCODING_IBM_437 (RTL_TEXTENC_CAST( 3 ))
+#define RTL_TEXTENCODING_IBM_850 (RTL_TEXTENC_CAST( 4 ))
+#define RTL_TEXTENCODING_IBM_860 (RTL_TEXTENC_CAST( 5 ))
+#define RTL_TEXTENCODING_IBM_861 (RTL_TEXTENC_CAST( 6 ))
+#define RTL_TEXTENCODING_IBM_863 (RTL_TEXTENC_CAST( 7 ))
+#define RTL_TEXTENCODING_IBM_865 (RTL_TEXTENC_CAST( 8 ))
+/* Reserved: RTL_TEXTENCODING_SYSTEM (RTL_TEXTENC_CAST( 9 )) */
+#define RTL_TEXTENCODING_SYMBOL (RTL_TEXTENC_CAST( 10 ))
+#define RTL_TEXTENCODING_ASCII_US (RTL_TEXTENC_CAST( 11 ))
+#define RTL_TEXTENCODING_ISO_8859_1 (RTL_TEXTENC_CAST( 12 ))
+#define RTL_TEXTENCODING_ISO_8859_2 (RTL_TEXTENC_CAST( 13 ))
+#define RTL_TEXTENCODING_ISO_8859_3 (RTL_TEXTENC_CAST( 14 ))
+#define RTL_TEXTENCODING_ISO_8859_4 (RTL_TEXTENC_CAST( 15 ))
+#define RTL_TEXTENCODING_ISO_8859_5 (RTL_TEXTENC_CAST( 16 ))
+#define RTL_TEXTENCODING_ISO_8859_6 (RTL_TEXTENC_CAST( 17 ))
+#define RTL_TEXTENCODING_ISO_8859_7 (RTL_TEXTENC_CAST( 18 ))
+#define RTL_TEXTENCODING_ISO_8859_8 (RTL_TEXTENC_CAST( 19 ))
+#define RTL_TEXTENCODING_ISO_8859_9 (RTL_TEXTENC_CAST( 20 ))
+#define RTL_TEXTENCODING_ISO_8859_14 (RTL_TEXTENC_CAST( 21 ))
+#define RTL_TEXTENCODING_ISO_8859_15 (RTL_TEXTENC_CAST( 22 ))
+#define RTL_TEXTENCODING_IBM_737 (RTL_TEXTENC_CAST( 23 ))
+#define RTL_TEXTENCODING_IBM_775 (RTL_TEXTENC_CAST( 24 ))
+#define RTL_TEXTENCODING_IBM_852 (RTL_TEXTENC_CAST( 25 ))
+#define RTL_TEXTENCODING_IBM_855 (RTL_TEXTENC_CAST( 26 ))
+#define RTL_TEXTENCODING_IBM_857 (RTL_TEXTENC_CAST( 27 ))
+#define RTL_TEXTENCODING_IBM_862 (RTL_TEXTENC_CAST( 28 ))
+#define RTL_TEXTENCODING_IBM_864 (RTL_TEXTENC_CAST( 29 ))
+#define RTL_TEXTENCODING_IBM_866 (RTL_TEXTENC_CAST( 30 ))
+#define RTL_TEXTENCODING_IBM_869 (RTL_TEXTENC_CAST( 31 ))
+#define RTL_TEXTENCODING_MS_874 (RTL_TEXTENC_CAST( 32 ))
+#define RTL_TEXTENCODING_MS_1250 (RTL_TEXTENC_CAST( 33 ))
+#define RTL_TEXTENCODING_MS_1251 (RTL_TEXTENC_CAST( 34 ))
+#define RTL_TEXTENCODING_MS_1253 (RTL_TEXTENC_CAST( 35 ))
+#define RTL_TEXTENCODING_MS_1254 (RTL_TEXTENC_CAST( 36 ))
+#define RTL_TEXTENCODING_MS_1255 (RTL_TEXTENC_CAST( 37 ))
+#define RTL_TEXTENCODING_MS_1256 (RTL_TEXTENC_CAST( 38 ))
+#define RTL_TEXTENCODING_MS_1257 (RTL_TEXTENC_CAST( 39 ))
+#define RTL_TEXTENCODING_MS_1258 (RTL_TEXTENC_CAST( 40 ))
+#define RTL_TEXTENCODING_APPLE_ARABIC (RTL_TEXTENC_CAST( 41 ))
+#define RTL_TEXTENCODING_APPLE_CENTEURO (RTL_TEXTENC_CAST( 42 ))
+#define RTL_TEXTENCODING_APPLE_CROATIAN (RTL_TEXTENC_CAST( 43 ))
+#define RTL_TEXTENCODING_APPLE_CYRILLIC (RTL_TEXTENC_CAST( 44 ))
+#define RTL_TEXTENCODING_APPLE_DEVANAGARI (RTL_TEXTENC_CAST( 45 ))
+#define RTL_TEXTENCODING_APPLE_FARSI (RTL_TEXTENC_CAST( 46 ))
+#define RTL_TEXTENCODING_APPLE_GREEK (RTL_TEXTENC_CAST( 47 ))
+#define RTL_TEXTENCODING_APPLE_GUJARATI (RTL_TEXTENC_CAST( 48 ))
+#define RTL_TEXTENCODING_APPLE_GURMUKHI (RTL_TEXTENC_CAST( 49 ))
+#define RTL_TEXTENCODING_APPLE_HEBREW (RTL_TEXTENC_CAST( 50 ))
+#define RTL_TEXTENCODING_APPLE_ICELAND (RTL_TEXTENC_CAST( 51 ))
+#define RTL_TEXTENCODING_APPLE_ROMANIAN (RTL_TEXTENC_CAST( 52 ))
+#define RTL_TEXTENCODING_APPLE_THAI (RTL_TEXTENC_CAST( 53 ))
+#define RTL_TEXTENCODING_APPLE_TURKISH (RTL_TEXTENC_CAST( 54 ))
+#define RTL_TEXTENCODING_APPLE_UKRAINIAN (RTL_TEXTENC_CAST( 55 ))
+#define RTL_TEXTENCODING_APPLE_CHINSIMP (RTL_TEXTENC_CAST( 56 ))
+#define RTL_TEXTENCODING_APPLE_CHINTRAD (RTL_TEXTENC_CAST( 57 ))
+#define RTL_TEXTENCODING_APPLE_JAPANESE (RTL_TEXTENC_CAST( 58 ))
+#define RTL_TEXTENCODING_APPLE_KOREAN (RTL_TEXTENC_CAST( 59 ))
+#define RTL_TEXTENCODING_MS_932 (RTL_TEXTENC_CAST( 60 ))
+#define RTL_TEXTENCODING_MS_936 (RTL_TEXTENC_CAST( 61 ))
+#define RTL_TEXTENCODING_MS_949 (RTL_TEXTENC_CAST( 62 ))
+#define RTL_TEXTENCODING_MS_950 (RTL_TEXTENC_CAST( 63 ))
+#define RTL_TEXTENCODING_SHIFT_JIS (RTL_TEXTENC_CAST( 64 ))
+#define RTL_TEXTENCODING_GB_2312 (RTL_TEXTENC_CAST( 65 ))
+#define RTL_TEXTENCODING_GBT_12345 (RTL_TEXTENC_CAST( 66 ))
+#define RTL_TEXTENCODING_GBK (RTL_TEXTENC_CAST( 67 ))
+#define RTL_TEXTENCODING_BIG5 (RTL_TEXTENC_CAST( 68 ))
+#define RTL_TEXTENCODING_EUC_JP (RTL_TEXTENC_CAST( 69 ))
+#define RTL_TEXTENCODING_EUC_CN (RTL_TEXTENC_CAST( 70 ))
+#define RTL_TEXTENCODING_EUC_TW (RTL_TEXTENC_CAST( 71 ))
+#define RTL_TEXTENCODING_ISO_2022_JP (RTL_TEXTENC_CAST( 72 ))
+#define RTL_TEXTENCODING_ISO_2022_CN (RTL_TEXTENC_CAST( 73 ))
+#define RTL_TEXTENCODING_KOI8_R (RTL_TEXTENC_CAST( 74 ))
+#define RTL_TEXTENCODING_UTF7 (RTL_TEXTENC_CAST( 75 ))
+#define RTL_TEXTENCODING_UTF8 (RTL_TEXTENC_CAST( 76 ))
+#define RTL_TEXTENCODING_ISO_8859_10 (RTL_TEXTENC_CAST( 77 ))
+#define RTL_TEXTENCODING_ISO_8859_13 (RTL_TEXTENC_CAST( 78 ))
+#define RTL_TEXTENCODING_EUC_KR (RTL_TEXTENC_CAST( 79 ))
+#define RTL_TEXTENCODING_ISO_2022_KR (RTL_TEXTENC_CAST( 80 ))
+#define RTL_TEXTENCODING_JIS_X_0201 (RTL_TEXTENC_CAST( 81 ))
+#define RTL_TEXTENCODING_JIS_X_0208 (RTL_TEXTENC_CAST( 82 ))
+#define RTL_TEXTENCODING_JIS_X_0212 (RTL_TEXTENC_CAST( 83 ))
+#define RTL_TEXTENCODING_MS_1361 (RTL_TEXTENC_CAST( 84 ))
+#define RTL_TEXTENCODING_GB_18030 (RTL_TEXTENC_CAST( 85 ))
+#define RTL_TEXTENCODING_BIG5_HKSCS (RTL_TEXTENC_CAST( 86 ))
+#define RTL_TEXTENCODING_TIS_620 (RTL_TEXTENC_CAST( 87 ))
+#define RTL_TEXTENCODING_KOI8_U (RTL_TEXTENC_CAST( 88 ))
+#define RTL_TEXTENCODING_ISCII_DEVANAGARI (RTL_TEXTENC_CAST( 89 ))
+#define RTL_TEXTENCODING_JAVA_UTF8 (RTL_TEXTENC_CAST( 90 ))
+#define RTL_TEXTENCODING_ADOBE_STANDARD (RTL_TEXTENC_CAST( 91 ))
+#define RTL_TEXTENCODING_ADOBE_SYMBOL (RTL_TEXTENC_CAST( 92 ))
+#define RTL_TEXTENCODING_PT154 (RTL_TEXTENC_CAST( 93 ))
+#define RTL_TEXTENCODING_ADOBE_DINGBATS (RTL_TEXTENC_CAST( 94 ))
+/* ATTENTION! Whenever some encoding is added here, make sure to update
+ * rtl_isOctetTextEncoding in tencinfo.c.
+ */
+
+#define RTL_TEXTENCODING_USER_START (RTL_TEXTENC_CAST( 0x8000 ))
+#define RTL_TEXTENCODING_USER_END (RTL_TEXTENC_CAST( 0xEFFF ))
+
+#define RTL_TEXTENCODING_UCS4 (RTL_TEXTENC_CAST( 0xFFFE ))
+#define RTL_TEXTENCODING_UCS2 (RTL_TEXTENC_CAST( 0xFFFF ))
+#define RTL_TEXTENCODING_UNICODE RTL_TEXTENCODING_UCS2
+
+/****** Overview over the TextEncodings *****
+# Arabic (Apple Macintosh) RTL_TEXTENCODING_APPLE_ARABIC
+Arabic (DOS/OS2-864) RTL_TEXTENCODING_IBM_864
+Arabic (ISO-8859-6) RTL_TEXTENCODING_ISO_8859_6
+Arabic (Windows-1256) RTL_TEXTENCODING_MS_1256
+
+Baltic (DOS/OS2-775) RTL_TEXTENCODING_IBM_775
+Baltic (ISO-8859-4) RTL_TEXTENCODING_ISO_8859_4
+Baltic (Windows-1257) RTL_TEXTENCODING_MS_1257
+
+Central European (Apple Macintosh) RTL_TEXTENCODING_APPLE_CENTEURO
+Central European (Apple Macintosh/Croatian) RTL_TEXTENCODING_APPLE_CROATIAN
+Central European (Apple Macintosh/Romanian) RTL_TEXTENCODING_APPLE_ROMANIAN
+Central European (DOS/OS2-852) RTL_TEXTENCODING_IBM_852
+Central European (ISO-8859-2) RTL_TEXTENCODING_ISO_8859_2
+Central European (ISO-8859-10) RTL_TEXTENCODING_ISO_8859_10
+Central European (ISO-8859-13) RTL_TEXTENCODING_ISO_8859_13
+Central European (Windows-1250/WinLatin 2) RTL_TEXTENCODING_MS_1250
+
+Chinese Simplified (Apple Macintosh) RTL_TEXTENCODING_APPLE_CHINSIMP
+Chinese Simplified (EUC-CN) RTL_TEXTENCODING_EUC_CN
+Chinese Simplified (GB-2312) RTL_TEXTENCODING_GB_2312
+Chinese Simplified (GBK/GB-2312-80) RTL_TEXTENCODING_GBK
+# Chinese Simplified (ISO-2022-CN) RTL_TEXTENCODING_ISO_2022_CN
+Chinese Simplified (Windows-936) RTL_TEXTENCODING_MS_936
+# Chinese Simplified (GB-18030) RTL_TEXTENCODING_GB_18030
+
+Chinese Traditional (Apple Macintosh) RTL_TEXTENCODING_APPLE_CHINTRAD
+Chinese Traditional (BIG5) RTL_TEXTENCODING_BIG5
+# Chinese Traditional (EUC-TW) RTL_TEXTENCODING_EUC_TW
+Chinese Traditional (GBT-12345) RTL_TEXTENCODING_GBT_12345
+Chinese Traditional (Windows-950) RTL_TEXTENCODING_MS_950
+Chinese Traditional (BIG5-HKSCS) RTL_TEXTENCODING_BIG5_HKSCS
+
+Cyrillic (Apple Macintosh) RTL_TEXTENCODING_APPLE_CYRILLIC
+Cyrillic (Apple Macintosh/Ukrainian) RTL_TEXTENCODING_APPLE_UKRAINIAN
+Cyrillic (DOS/OS2-855) RTL_TEXTENCODING_IBM_855
+Cyrillic (DOS/OS2-866/Russian) RTL_TEXTENCODING_IBM_866
+Cyrillic (ISO-8859-5) RTL_TEXTENCODING_ISO_8859_5
+Cyrillic (KOI8-R) RTL_TEXTENCODING_KOI8_R
+Cyrillic (KOI8-U) RTL_TEXTENCODING_KOI8_U
+Cyrillic (Windows-1251) RTL_TEXTENCODING_MS_1251
+
+Greek (Apple Macintosh) RTL_TEXTENCODING_APPLE_GREEK
+Greek (DOS/OS2-737) RTL_TEXTENCODING_IBM_737
+Greek (DOS/OS2-869/Modern) RTL_TEXTENCODING_IBM_869
+Greek (ISO-8859-7) RTL_TEXTENCODING_ISO_8859_7
+Greek (Windows-1253) RTL_TEXTENCODING_MS_1253
+
+# Hebrew (Apple Macintosh) RTL_TEXTENCODING_APPLE_HEBREW
+Hebrew (DOS/OS2-862) RTL_TEXTENCODING_IBM_862
+Hebrew (ISO-8859-8) RTL_TEXTENCODING_ISO_8859_8
+Hebrew (Windows-1255) RTL_TEXTENCODING_MS_1255
+
+Korean (Apple Macintosh) RTL_TEXTENCODING_APPLE_KOREAN
+Korean (EUC-KR) RTL_TEXTENCODING_EUC_KR
+# Korean (ISO-2022-KR) RTL_TEXTENCODING_ISO_2022_KR
+Korean (Windows-Wansung-949) RTL_TEXTENCODING_MS_949
+Korean (Windows-Johab-1361) RTL_TEXTENCODING_MS_1361
+
+Latin 3 (ISO-8859-3) RTL_TEXTENCODING_ISO_8859_3
+
+Indian (ISCII Devanagari) RTL_TEXTENCODING_ISCII_DEVANAGARI
+
+Japanese (Apple Macintosh) RTL_TEXTENCODING_APPLE_JAPANESE
+Japanese (EUC-JP) RTL_TEXTENCODING_EUC_JP
+# Japanese (ISO-2022-JP) RTL_TEXTENCODING_ISO_2022_JP
+Japanese (Shift-JIS) RTL_TEXTENCODING_SHIFT_JIS
+Japanese (Windows-932) RTL_TEXTENCODING_MS_932
+
+Symbol RTL_TEXTENCODING_SYMBOL
+
+# Thai (Apple Macintosh) RTL_TEXTENCODING_APPLE_THAI
+Thai (Dos/Windows-874) RTL_TEXTENCODING_MS_874
+Thai (TIS 620) RTL_TEXTENCODING_TIS_620
+
+Turkish (Apple Macintosh) RTL_TEXTENCODING_APPLE_TURKISH
+Turkish (DOS/OS2-857) RTL_TEXTENCODING_IBM_857
+Turkish (ISO-8859-9) RTL_TEXTENCODING_ISO_8859_9
+Turkish (Windows-1254) RTL_TEXTENCODING_MS_1254
+
+Unicode (UTF-7) RTL_TEXTENCODING_UTF7
+Unicode (UTF-8) RTL_TEXTENCODING_UTF8
+Unicode (Java's modified UTF-8) RTL_TEXTENCODING_JAVA_UTF8
+
+Vietnamese (Windows-1258) RTL_TEXTENCODING_MS_1258
+
+Western (Apple Macintosh) RTL_TEXTENCODING_APPLE_ROMAN
+Western (Apple Macintosh/Icelandic) RTL_TEXTENCODING_APPLE_ICELAND
+Western (ASCII/US) RTL_TEXTENCODING_ASCII_US
+Western (DOS/OS2-437/US) RTL_TEXTENCODING_IBM_437
+Western (DOS/OS2-850/International) RTL_TEXTENCODING_IBM_850
+Western (DOS/OS2-860/Portuguese) RTL_TEXTENCODING_IBM_860
+Western (DOS/OS2-861/Icelandic) RTL_TEXTENCODING_IBM_861
+Western (DOS/OS2-863/Canadian-French) RTL_TEXTENCODING_IBM_863
+Western (DOS/OS2-865/Nordic) RTL_TEXTENCODING_IBM_865
+Western (ISO-8859-1) RTL_TEXTENCODING_ISO_8859_1
+Western (ISO-8859-14) RTL_TEXTENCODING_ISO_8859_14
+Western (ISO-8859-15/EURO) RTL_TEXTENCODING_ISO_8859_15
+Western (Window-1252/WinLatin 1) RTL_TEXTENCODING_MS_1252
+
+Not known and currently not supported
+# RTL_TEXTENCODING_APPLE_DEVANAGARI
+# RTL_TEXTENCODING_APPLE_FARSI
+# RTL_TEXTENCODING_APPLE_GUJARATI
+# RTL_TEXTENCODING_APPLE_GURMUKHI
+
+Only for internal implementations and not useful for user interface.
+These encodings are not used for text encodings, only used for
+font-/textoutput encodings.
+Japanese (JIS 0201) RTL_TEXTENCODING_JISX_0201
+Japanese (JIS 0208) RTL_TEXTENCODING_JISX_0208
+Japanese (JIS 0212) RTL_TEXTENCODING_JISX_0212
+
+# Currently not implemented
+*/
+
+#endif // INCLUDED_RTL_TEXTENC_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/unload.h b/include/rtl/unload.h
new file mode 100644
index 000000000..23cd2fa74
--- /dev/null
+++ b/include/rtl/unload.h
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_RTL_UNLOAD_H
+#define INCLUDED_RTL_UNLOAD_H
+
+#include "sal/config.h"
+
+#include "osl/interlck.h"
+#include "osl/time.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+/** @file
+ Backwards-compatibility remainders of a removed library unloading feature.
+*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** Backwards-compatibility remainder of a removed library unloading feature.
+
+ @deprecated Do not use.
+*/
+typedef struct SAL_DLLPUBLIC_RTTI _rtl_ModuleCount
+{
+ void ( SAL_CALL * acquire ) ( struct _rtl_ModuleCount * that );
+ void ( SAL_CALL * release ) ( struct _rtl_ModuleCount * that );
+}rtl_ModuleCount;
+
+/** Backwards-compatibility remainder of a removed library unloading feature.
+
+ @deprecated Do not use.
+*/
+#define MODULE_COUNT_INIT \
+{ {rtl_moduleCount_acquire,rtl_moduleCount_release}, rtl_moduleCount_canUnload, 0, {0, 0}}
+
+/** Backwards-compatibility remainder of a removed library unloading feature.
+
+ @deprecated Do not use.
+*/
+typedef struct _rtl_StandardModuleCount
+{
+ rtl_ModuleCount modCnt;
+ sal_Bool ( *canUnload ) ( struct _rtl_StandardModuleCount* a, TimeValue* libUnused);
+ oslInterlockedCount counter;
+ TimeValue unusedSince;
+} rtl_StandardModuleCount;
+
+/** Backwards-compatibility remainder of a removed library unloading feature.
+
+ @deprecated Do not use.
+*/
+SAL_DLLPUBLIC void rtl_moduleCount_acquire(rtl_ModuleCount * that ) SAL_COLD;
+
+/** Backwards-compatibility remainder of a removed library unloading feature.
+
+ @deprecated Do not use.
+*/
+SAL_DLLPUBLIC void rtl_moduleCount_release( rtl_ModuleCount * that ) SAL_COLD;
+
+/** Backwards-compatibility remainder of a removed library unloading feature.
+
+ @deprecated Do not use.
+*/
+SAL_DLLPUBLIC sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, TimeValue* libUnused) SAL_COLD;
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/uri.h b/include/rtl/uri.h
new file mode 100644
index 000000000..1fbd0128a
--- /dev/null
+++ b/include/rtl/uri.h
@@ -0,0 +1,357 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_URI_H
+#define INCLUDED_RTL_URI_H
+
+#include "sal/config.h"
+
+#include "rtl/textenc.h"
+#include "rtl/ustring.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#if defined __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** Various predefined URI 'char classes.'
+
+ A 'char class' defines which (ASCII) characters can be written 'as they
+ are' in a part of a Uri, and which characters have to be written using
+ escape sequences ('%' followed by two hex digits). Characters outside
+ the ASCII range are always written using escape sequences.
+
+ If there are other frequently used char classes, they can be added to
+ this enumeration; the function rtl_getUriCharClass() has to be adapted
+ then, too.
+ */
+typedef enum
+{
+ /** The empty char class.
+
+ All characters are written using escape sequences.
+ */
+ rtl_UriCharClassNone,
+
+ /** The RFC 2732 @<uric> char class.
+
+ @verbatim
+ The 'valid' characters are !$&'()*+,-./:;=?@[]_~ plus digits and
+ letters.
+
+ This differs from RFC 3986 @<fragment> in additionally allowing []
+ @endverbatim
+ */
+ rtl_UriCharClassUric,
+
+ /** The RFC 2396 @<uric_no_slash> char class.
+
+ @verbatim
+ The 'valid' characters are !$&'()*+,-.:;=?@_~ plus digits and letters.
+
+ This differs from RFC 3986 @<fragment> in additionally encoding /
+ This differs from RFC 3986 @<pchar> in additionally allowing ?
+ @endverbatim
+ */
+ rtl_UriCharClassUricNoSlash,
+
+ /** The RFC 2396 @<rel_segment> char class.
+
+ @verbatim
+ The 'valid' characters are !$&'()*+,-.;=@_~ plus digits and letters.
+
+ This is the same as RFC 3986 @<segment-nz-nc>
+ @endverbatim
+ */
+ rtl_UriCharClassRelSegment,
+
+ /** The RFC 2396 @<reg_name> char class.
+
+ @verbatim
+ The 'valid' characters are !$&'()*+,-.:;=@_~ plus digits and letters.
+
+ This differs from RFC 3986 @<reg_name> in additionally allowing @
+ @endverbatim
+ */
+ rtl_UriCharClassRegName,
+
+ /** The RFC 2396 @<userinfo> char class.
+
+ @verbatim
+ The 'valid' characters are !$&'()*+,-.:;=_~ plus digits and letters.
+
+ This is the same as RFC 3986 @<userinfo>
+ @endverbatim
+ */
+ rtl_UriCharClassUserinfo,
+
+ /** The RFC 2396 @<pchar> char class.
+
+ @verbatim
+ The 'valid' characters are !$&'()*+,-.:=@_~ plus digits and letters.
+
+ This differs from RFC 3986 @<pchar> in additionally encoding ;
+ @endverbatim
+ */
+ rtl_UriCharClassPchar,
+
+ /** The char class for the values of uno URL parameters.
+
+ @verbatim
+ The 'valid' characters are !$&'()*+-./:?@_~ plus digits and letters.
+ @endverbatim
+ */
+ rtl_UriCharClassUnoParamValue,
+
+ rtl_UriCharClass_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+}
+rtl_UriCharClass;
+
+/** The mechanism describing how escape sequences in the input of
+ rtl_uriEncode() are handled.
+ */
+typedef enum
+{
+ /** The special meaning of '%' is ignored (i.e., there are by definition
+ no escape sequences in the input).
+
+ This mechanism is useful to encode user input as part of a URI (e.g.,
+ the user-supplied password in an ftp URL---'%20abcde' is a valid
+ password, so do not assume that the '%20' is an escaped space).
+ */
+ rtl_UriEncodeIgnoreEscapes,
+
+ /** All escape sequences ('%' followed by two hex digits) are kept intact,
+ even if they represent characters that need not be escaped or if they
+ do not even map to characters in the given charset.
+
+ This mechanism is useful when passing on complete URIs more or less
+ unmodified (e.g., within an HTTP proxy): missing escape sequences are
+ added, but existing escape sequences are not touched (except that any
+ lower case hex digits are replaced by upper case hex digits).
+ */
+ rtl_UriEncodeKeepEscapes,
+
+ /** All escape sequences ('%' followed by two hex digits) are resolved in
+ a first step; only those that represent characters that need to be
+ escaped are kept intact.
+
+ This mechanism is useful to properly encode complete URIs entered by
+ the user: the URI is brought into a 'canonic form,' but care is taken
+ not to damage (valid) escape sequences the (careful) user already
+ entered as such.
+ */
+ rtl_UriEncodeCheckEscapes,
+
+ /** Like rtl_UriEncodeIgnoreEscapes, but indicating failure when converting
+ unmappable characters.
+
+ @since UDK 3.2.0
+ */
+ rtl_UriEncodeStrict,
+
+ /** Like rtl_UriEncodeKeepEscapes, but indicating failure when converting
+ unmappable characters.
+
+ @since UDK 3.2.7
+ */
+ rtl_UriEncodeStrictKeepEscapes,
+
+ rtl_UriEncode_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+}
+rtl_UriEncodeMechanism;
+
+/** The mechanism describing how rtl_uriDecode() translates (part of) a URI
+ into a Unicode string.
+ */
+typedef enum
+{
+ /** The text is returned completely unmodified.
+ */
+ rtl_UriDecodeNone,
+
+ /** The text is returned in the form of an IURI (cf.
+ draft-masinter-url-i18n-05.txt).
+
+ All escape sequences representing ASCII characters (%00--%7F) are
+ kept, all other escape sequences are interpreted as UTF-8 characters
+ and translated to Unicode, if possible.
+ */
+ rtl_UriDecodeToIuri,
+
+ /** The text is decoded.
+
+ All escape sequences representing characters from the given charset
+ are decoded and translated to Unicode, if possible.
+ */
+ rtl_UriDecodeWithCharset,
+
+ /** Like rtl_UriDecodeWithCharset, but indicating failure when converting
+ unmappable characters.
+
+ @since UDK 3.2.0
+ */
+ rtl_UriDecodeStrict,
+
+ rtl_UriDecode_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+}
+rtl_UriDecodeMechanism;
+
+/** Map a predefined rtl_UriCharClass to a form usable by rtl_uriEncode().
+
+ The function rtl_uriEncode() expects an array of 128 booleans, and this
+ function maps rtl_UriCharClass enumeration members to such arrays.
+
+ @param eCharClass
+ Any valid member of rtl_UriCharClass.
+
+ @return
+ An array of 128 booleans, to be used in calls to rtl_uriEncode().
+ */
+SAL_DLLPUBLIC sal_Bool const * SAL_CALL rtl_getUriCharClass(rtl_UriCharClass eCharClass)
+ SAL_THROW_EXTERN_C();
+
+/** Encode a text as (part of) a URI.
+
+ @param pText
+ Any Unicode string. Must not be null.
+
+ @param pCharClass
+ A char class, represented as an array of 128 booleans (true means keep the
+ corresponding ASCII character unencoded, false means encode it). Must not
+ be null, and the boolean corresponding to the percent sign (0x25) must be
+ false. (See rtl_getUriCharClass() for a function mapping from
+ rtl_UriCharClass to such arrays.)
+
+ @param eMechanism
+ The mechanism describing how escape sequences in the input text are
+ handled.
+
+ @param eCharset
+ When Unicode characters from the input text have to be written using
+ escape sequences (because they are either outside the ASCII range or do
+ not belong to the given char class), they are first translated into this
+ charset before being encoded using escape sequences.
+
+ Also, if the encode mechanism is rtl_UriEncodeCheckEscapes, all escape
+ sequences already present in the input text are interpreted as characters
+ from this charset.
+
+ @param pResult
+ Returns an encoded representation of the input text. Must itself not be
+ null, and must point to either null or a valid string.
+
+ If the encode mechanism is rtl_UriEncodeStrict, and pText cannot be
+ converted to eCharset because it contains unmappable characters (which
+ implies that pText is not empty), then an empty string is returned.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uriEncode(
+ rtl_uString * pText,
+ sal_Bool const * pCharClass,
+ rtl_UriEncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ rtl_uString ** pResult)
+ SAL_THROW_EXTERN_C();
+
+/** Decode (a part of) a URI.
+
+ @param pText
+ Any Unicode string. Must not be null. (If the input is indeed part of a
+ valid URI, this string will only contain a subset of the ASCII characters,
+ but this function also handles other Unicode characters properly.)
+
+ @param eMechanism
+ The mechanism describing how the input text is translated into a Unicode
+ string.
+
+ @param eCharset
+ When the decode mechanism is rtl_UriDecodeWithCharset, all escape
+ sequences in the input text are interpreted as characters from this
+ charset. Those characters are translated to Unicode characters in the
+ resulting output, if possible.
+
+ When the decode mechanism is rtl_UriDecodeNone or rtl_UriDecodeToIuri,
+ this parameter is ignored (and is best specified as
+ RTL_TEXTENCODING_UTF8).
+
+ @param pResult
+ Returns a decoded representation of the input text. Must itself not be
+ null, and must point to either null or a valid string.
+
+ If the decode mechanism is rtl_UriDecodeStrict, and pText cannot be
+ converted to eCharset because it contains (encodings of) unmappable
+ characters (which implies that pText is not empty), then an empty string is
+ returned.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uriDecode(
+ rtl_uString * pText,
+ rtl_UriDecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ rtl_uString ** pResult)
+ SAL_THROW_EXTERN_C();
+
+/** Convert a relative URI reference into an absolute URI.
+
+ This function uses the strict parser algorithm described in RFC 3986,
+ section 5.2.
+
+ This function signals exceptions by returning false and letting pException
+ point to a message explaining the exception.
+
+ @param pBaseUriRef
+ An absolute URI that serves as the base URI. If it has to be inspected
+ (i.e., pRelUriRef is not an absolute URI already), and it is not an absolute
+ URI (i.e., does not begin with a @<scheme ":"> part), an exception will be
+ signaled.
+
+ @param pRelUriRef
+ A URI reference that may be either absolute or relative. If it is
+ absolute, it will be returned unmodified.
+
+ @param pResult
+ Returns an absolute URI. Must itself not be null, and must point to either
+ null or a valid string. If an exception is signalled, it is left unchanged.
+
+ @param pException
+ Returns an explanatory message in case an exception is signalled. Must
+ itself not be null, and must point to either null or a valid string. If no
+ exception is signalled, it is left unchanged.
+
+ @return
+ True if no exception is signalled, otherwise false.
+ */
+SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_uriConvertRelToAbs(
+ rtl_uString * pBaseUriRef,
+ rtl_uString * pRelUriRef,
+ rtl_uString ** pResult,
+ rtl_uString ** pException)
+ SAL_THROW_EXTERN_C();
+
+#if defined __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // INCLUDED_RTL_URI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/uri.hxx b/include/rtl/uri.hxx
new file mode 100644
index 000000000..1b2601e7d
--- /dev/null
+++ b/include/rtl/uri.hxx
@@ -0,0 +1,179 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_URI_HXX
+#define INCLUDED_RTL_URI_HXX
+
+#include "rtl/malformeduriexception.hxx"
+#include "rtl/uri.h"
+#include "rtl/textenc.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+#if defined LIBO_INTERNAL_ONLY
+#include <array>
+#include <cassert>
+#include <cstddef>
+#include <string_view>
+#include "config_global.h"
+#endif
+
+namespace rtl {
+
+/** A wrapper around the C functions from <rtl/uri.h>.
+ */
+class Uri
+{
+public:
+ /** A wrapper around rtl_uriEncode() from <rtl/uri.h> (see there), using
+ an array of 128 booleans as char class.
+ */
+ static inline rtl::OUString encode(rtl::OUString const & rText,
+ sal_Bool const * pCharClass,
+ rtl_UriEncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset);
+
+ /** A wrapper around rtl_uriEncode() from <rtl/uri.h> (see there), using
+ a predefined rtl_UriCharClass enumeration member.
+ */
+ static inline rtl::OUString encode(rtl::OUString const & rText,
+ rtl_UriCharClass eCharClass,
+ rtl_UriEncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset);
+
+ /** A wrapper around rtl_uriDecode() from <rtl/uri.h> (see there).
+ */
+ static inline rtl::OUString decode(rtl::OUString const & rText,
+ rtl_UriDecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset);
+
+ /** A wrapper around rtl_uriConvertRelToAbs() from <rtl/uri.h> (see there).
+
+ @exception MalformedUriException
+ Thrown in case rtl_uriConvertRelToAbs() signals an exception due to a
+ malformed base URI.
+ */
+ static inline rtl::OUString convertRelToAbs(
+ rtl::OUString const & rBaseUriRef, rtl::OUString const & rRelUriRef);
+
+private:
+ Uri() SAL_DELETED_FUNCTION;
+
+ Uri(Uri &) SAL_DELETED_FUNCTION;
+
+ ~Uri() SAL_DELETED_FUNCTION;
+
+ void operator =(Uri) SAL_DELETED_FUNCTION;
+};
+
+inline rtl::OUString Uri::encode(rtl::OUString const & rText,
+ sal_Bool const * pCharClass,
+ rtl_UriEncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ rtl::OUString aResult;
+ rtl_uriEncode(const_cast< rtl::OUString & >(rText).pData,
+ pCharClass,
+ eMechanism,
+ eCharset,
+ &aResult.pData);
+ return aResult;
+}
+
+inline rtl::OUString Uri::encode(rtl::OUString const & rText,
+ rtl_UriCharClass eCharClass,
+ rtl_UriEncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ rtl::OUString aResult;
+ rtl_uriEncode(const_cast< rtl::OUString & >(rText).pData,
+ rtl_getUriCharClass(eCharClass),
+ eMechanism,
+ eCharset,
+ &aResult.pData);
+ return aResult;
+}
+
+inline rtl::OUString Uri::decode(rtl::OUString const & rText,
+ rtl_UriDecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ rtl::OUString aResult;
+ rtl_uriDecode(const_cast< rtl::OUString & >(rText).pData,
+ eMechanism,
+ eCharset,
+ &aResult.pData);
+ return aResult;
+}
+
+inline rtl::OUString Uri::convertRelToAbs(rtl::OUString const & rBaseUriRef,
+ rtl::OUString const & rRelUriRef)
+{
+ rtl::OUString aResult;
+ rtl::OUString aException;
+ if (!rtl_uriConvertRelToAbs(
+ const_cast< rtl::OUString & >(rBaseUriRef).pData,
+ const_cast< rtl::OUString & >(rRelUriRef).pData, &aResult.pData,
+ &aException.pData))
+ throw MalformedUriException(aException);
+ return aResult;
+}
+
+#if defined LIBO_INTERNAL_ONLY
+
+constexpr std::size_t UriCharClassSize = 128;
+
+// Create a char class (for use with rtl_uriEncode and rtl::Uri::encode), represented as a
+// compile-time std::array, from an UTF-8 string literal.
+//
+// The given `unencoded` lists each ASCII character once that shall not be encoded. (It uses an
+// UTF-8 string type to emphasize that its characters' values are always interpreted as ASCII
+// values.)
+#if HAVE_CPP_CONSTEVAL
+consteval
+#else
+constexpr
+#endif
+auto createUriCharClass(
+#if defined __cpp_lib_char8_t
+ std::u8string_view
+#else
+ std::string_view
+#endif
+ unencoded)
+{
+ std::array<sal_Bool, UriCharClassSize> a = {};
+ for (auto c: unencoded) {
+ assert(!a[c]); // would presumably indicate a typo in the `unencoded` argument
+ a[c] = true;
+ }
+ return a;
+}
+
+#endif
+
+}
+
+#endif // INCLUDED_RTL_URI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/ustrbuf.h b/include/rtl/ustrbuf.h
new file mode 100644
index 000000000..9ea590c00
--- /dev/null
+++ b/include/rtl/ustrbuf.h
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_USTRBUF_H
+#define INCLUDED_RTL_USTRBUF_H
+
+#include "sal/config.h"
+
+#include "rtl/ustring.h"
+#include "sal/saldllapi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Allocates a new <code>String</code> that contains characters from
+ the character array argument.
+
+ The <code>count</code> argument specifies
+ the length of the array. The initial capacity of the string buffer is
+ <code>16</code> plus the length of the string argument.
+
+ @param newStr out parameter, contains the new string. The reference count is 1.
+ @param value the initial value of the string.
+ @param count the length of value.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uStringbuffer_newFromStr_WithLength(
+ rtl_uString ** newStr,
+ const sal_Unicode * value,
+ sal_Int32 count );
+
+/**
+ Allocates a new <code>String</code> that contains the same sequence of
+ characters as the string argument.
+
+ The initial capacity is the larger of:
+ <ul>
+ <li> The <code>bufferLen</code> argument.
+ <li> The <code>length</code> of the string argument.
+ </ul>
+
+ @param newStr out parameter, contains the new string. The reference count is 1.
+ @param capacity the initial len of the string buffer.
+ @param oldStr the initial value of the string.
+ @return the new capacity of the string buffer
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_uStringbuffer_newFromStringBuffer(
+ rtl_uString ** newStr,
+ sal_Int32 capacity,
+ rtl_uString * oldStr );
+
+/**
+ Ensures that the capacity of the buffer is at least equal to the
+ specified minimum.
+
+ If the current capacity of this string buffer is less than the
+ argument, then a new internal buffer is allocated with greater
+ capacity. The new capacity is the larger of:
+ <ul>
+ <li>The <code>minimumCapacity</code> argument.
+ <li>Twice the old capacity, plus <code>2</code>.
+ </ul>
+ If the <code>minimumCapacity</code> argument is nonpositive, this
+ method takes no action and simply returns.
+
+ @param[in,out] This the String to operate on.
+ @param[in,out] capacity in: old capacity, out: new capacity.
+ @param[in] minimumCapacity the minimum desired capacity.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uStringbuffer_ensureCapacity(
+ rtl_uString ** This,
+ sal_Int32* capacity,
+ sal_Int32 minimumCapacity);
+
+/**
+ Inserts the string representation of the <code>str</code> array
+ argument into this string buffer.
+
+ The characters of the array argument are inserted into the
+ contents of this string buffer at the position indicated by
+ <code>offset</code>. The length of this string buffer increases by
+ the length of the argument.
+
+ @param This The string, on that the operation should take place
+ @param capacity the capacity of the string buffer
+ @param offset the offset.
+ @param str a character array. Since LibreOffice 4.4, as a special
+ case, if str is null then the len added characters are
+ left uninitialized.
+ @param len the number of characters to append.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uStringbuffer_insert(
+ /*inout*/rtl_uString ** This,
+ /*inout*/sal_Int32 * capacity,
+ sal_Int32 offset,
+ const sal_Unicode * str,
+ sal_Int32 len);
+
+/**
+ Inserts a single UTF-32 character into this string buffer.
+
+ <p>The single UTF-32 character will be represented within the string buffer
+ as either one or two UTF-16 code units.</p>
+
+ @param pThis the string buffer on which the operation is performed
+
+ @param capacity the capacity of the string buffer
+
+ @param offset the offset into this string buffer (from zero to the length
+ of this string buffer, inclusive)
+
+ @param c a well-formed UTF-32 code unit (that is, a value in the range
+ <code>0</code>&ndash;<code>0x10FFFF</code>, but excluding
+ <code>0xD800</code>&ndash;<code>0xDFFF</code>)
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uStringbuffer_insertUtf32(
+ rtl_uString ** pThis, sal_Int32 * capacity, sal_Int32 offset, sal_uInt32 c)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Inserts the 8-Bit ASCII string representation of the <code>str</code>
+ array argument into this string buffer.
+
+ Since this function is optimized
+ for performance, the ASCII character values are not converted in any way.
+ The caller has to make sure that all ASCII characters are in the allowed
+ range between 0 and 127.
+ <p>
+ The characters of the array argument are inserted into the
+ contents of this string buffer at the position indicated by
+ <code>offset</code>. The length of this string buffer increases by
+ the length of the argument.
+
+ @param This The string, on that the operation should take place
+ @param capacity the capacity of the string buffer
+ @param offset the offset.
+ @param str a character array.
+ @param len the number of characters to append.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uStringbuffer_insert_ascii(
+ /*inout*/rtl_uString ** This,
+ /*inout*/sal_Int32 * capacity,
+ sal_Int32 offset,
+ const char * str,
+ sal_Int32 len);
+
+/**
+ Removes the characters in a substring of this sequence.
+
+ The substring begins at the specified <code>start</code> and
+ is <code>len</code> characters long.
+
+ start must be >= 0 && <= This->length
+
+ @param[in,out] This The String to operate on.
+ @param[in] start The beginning index, inclusive
+ @param[in] len The substring length
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uStringbuffer_remove(
+ rtl_uString ** This,
+ sal_Int32 start,
+ sal_Int32 len );
+
+/**
+ Returns an immutable rtl_uString object, while clearing the string buffer.
+
+ This method is primarily used to allow these completed
+ string allocation events to be traced.
+
+ @param ppThis The string, on that the operation should take place
+ @param nCapacity pointer to the capacity of the string buffer
+
+ @since LibreOffice 3.6
+ */
+SAL_DLLPUBLIC rtl_uString * SAL_CALL rtl_uStringBuffer_makeStringAndClear(
+ /*inout*/ rtl_uString ** ppThis,
+ sal_Int32 *nCapacity ) SAL_RETURNS_NONNULL;
+
+/**
+ References and returns an immutable rtl_uString object, from a mutable
+ string-buffer object.
+
+ This method is primarily used to allow legacy 'String' class
+ conversions to OUString to be accurately traced.
+
+ @param pThis The string, on that the operation should take place
+
+ @since LibreOffice 3.6
+ */
+SAL_DLLPUBLIC rtl_uString * SAL_CALL rtl_uStringBuffer_refReturn( rtl_uString *pThis );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_RTL_USTRBUF_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
new file mode 100644
index 000000000..8c8cc54f8
--- /dev/null
+++ b/include/rtl/ustrbuf.hxx
@@ -0,0 +1,1796 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_USTRBUF_HXX
+#define INCLUDED_RTL_USTRBUF_HXX
+
+#include "sal/config.h"
+
+#include <cassert>
+#include <cstring>
+#include <limits>
+#include <new>
+
+#if defined LIBO_INTERNAL_ONLY
+#include <string_view>
+#include <type_traits>
+#endif
+
+#include "rtl/ustrbuf.h"
+#include "rtl/ustring.hxx"
+#include "rtl/stringutils.hxx"
+#include "sal/types.h"
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+#include "rtl/stringconcat.hxx"
+#endif
+
+#ifdef RTL_STRING_UNITTEST
+extern bool rtl_string_unittest_invalid_conversion;
+#endif
+
+// The unittest uses slightly different code to help check that the proper
+// calls are made. The class is put into a different namespace to make
+// sure the compiler generates a different (if generating also non-inline)
+// copy of the function and does not merge them together. The class
+// is "brought" into the proper rtl namespace by a typedef below.
+#ifdef RTL_STRING_UNITTEST
+#define rtl rtlunittest
+#endif
+
+namespace rtl
+{
+
+#ifdef RTL_STRING_UNITTEST
+#undef rtl
+#endif
+
+/** A string buffer implements a mutable sequence of characters.
+ */
+class SAL_WARN_UNUSED OUStringBuffer
+{
+friend class OUString;
+public:
+ /**
+ Constructs a string buffer with no characters in it and an
+ initial capacity of 16 characters.
+ */
+ OUStringBuffer()
+ : pData(NULL)
+ , nCapacity( 16 )
+ {
+ rtl_uString_new_WithLength( &pData, nCapacity );
+ }
+
+ /**
+ Allocates a new string buffer that contains the same sequence of
+ characters as the string buffer argument.
+
+ @param value a <code>OUStringBuffer</code>.
+ */
+ OUStringBuffer( const OUStringBuffer & value )
+ : pData(NULL)
+ , nCapacity( value.nCapacity )
+ {
+ rtl_uStringbuffer_newFromStringBuffer( &pData, value.nCapacity, value.pData );
+ }
+
+ /**
+ Constructs a string buffer with no characters in it and an
+ initial capacity specified by the <code>length</code> argument.
+
+ @param length the initial capacity.
+ */
+ explicit OUStringBuffer(sal_Int32 length)
+ : pData(NULL)
+ , nCapacity( length )
+ {
+ rtl_uString_new_WithLength( &pData, length );
+ }
+#if defined LIBO_INTERNAL_ONLY
+ template<typename T>
+ explicit OUStringBuffer(T length, std::enable_if_t<std::is_integral_v<T>, int> = 0)
+ : OUStringBuffer(static_cast<sal_Int32>(length))
+ {
+ assert(
+ length >= 0
+ && static_cast<std::make_unsigned_t<T>>(length)
+ <= static_cast<std::make_unsigned_t<sal_Int32>>(
+ std::numeric_limits<sal_Int32>::max()));
+ }
+ // avoid (obvious) bugs
+ explicit OUStringBuffer(bool) = delete;
+ explicit OUStringBuffer(char) = delete;
+ explicit OUStringBuffer(wchar_t) = delete;
+#if defined __cpp_char8_t
+ explicit OUStringBuffer(char8_t) = delete;
+#endif
+ explicit OUStringBuffer(char16_t) = delete;
+ explicit OUStringBuffer(char32_t) = delete;
+#endif
+
+ /**
+ Constructs a string buffer so that it represents the same
+ sequence of characters as the string argument.
+
+ The initial
+ capacity of the string buffer is <code>16</code> plus the length
+ of the string argument.
+
+ @param value the initial contents of the buffer.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ OUStringBuffer(std::u16string_view sv)
+ : pData(nullptr)
+ , nCapacity( sv.length() + 16 )
+ {
+ if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
+ throw std::bad_alloc();
+ }
+ rtl_uStringbuffer_newFromStr_WithLength( &pData, sv.data(), sv.length() );
+ }
+#else
+ OUStringBuffer(const OUString& value)
+ : pData(NULL)
+ , nCapacity( value.getLength() + 16 )
+ {
+ rtl_uStringbuffer_newFromStr_WithLength( &pData, value.getStr(), value.getLength() );
+ }
+#endif
+
+ template< typename T >
+ OUStringBuffer( T& literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy() )
+ : pData(NULL)
+ , nCapacity( libreoffice_internal::ConstCharArrayDetector<T>::length + 16 )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ rtl_uString_newFromLiteral(
+ &pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, 16);
+#ifdef RTL_STRING_UNITTEST
+ rtl_string_unittest_const_literal = true;
+#endif
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T>
+ OUStringBuffer(
+ T & literal,
+ typename libreoffice_internal::ConstCharArrayDetector<
+ T, libreoffice_internal::Dummy>::TypeUtf16
+ = libreoffice_internal::Dummy()):
+ pData(nullptr),
+ nCapacity(libreoffice_internal::ConstCharArrayDetector<T>::length + 16)
+ {
+ rtl_uStringbuffer_newFromStr_WithLength(
+ &pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && defined RTL_STRING_UNITTEST
+ /// @cond INTERNAL
+ /**
+ * Only used by unittests to detect incorrect conversions.
+ * @internal
+ */
+ template< typename T >
+ OUStringBuffer( T&, typename libreoffice_internal::ExceptConstCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
+ {
+ pData = NULL;
+ nCapacity = 10;
+ rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
+ rtl_string_unittest_invalid_conversion = true;
+ }
+ /**
+ * Only used by unittests to detect incorrect conversions.
+ * @internal
+ */
+ template< typename T >
+ OUStringBuffer( const T&, typename libreoffice_internal::ExceptCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
+ {
+ pData = NULL;
+ nCapacity = 10;
+ rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
+ rtl_string_unittest_invalid_conversion = true;
+ }
+ /// @endcond
+#endif
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /**
+ @overload
+ @internal
+ */
+ template< typename T1, typename T2 >
+ OUStringBuffer( OUStringConcat< T1, T2 >&& c )
+ {
+ const sal_Int32 l = c.length();
+ nCapacity = l + 16;
+ pData = rtl_uString_alloc( nCapacity );
+ sal_Unicode* end = c.addData( pData->buffer );
+ *end = '\0';
+ pData->length = l;
+ }
+
+ /**
+ @overload
+ @internal
+ */
+ template< typename T >
+ OUStringBuffer( OUStringNumber< T >&& n )
+ : pData(NULL)
+ , nCapacity( n.length + 16 )
+ {
+ rtl_uStringbuffer_newFromStr_WithLength( &pData, n.buf, n.length );
+ }
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ operator std::u16string_view() const { return {getStr(), sal_uInt32(getLength())}; }
+#endif
+
+ /** Assign to this a copy of value.
+ */
+ OUStringBuffer& operator = ( const OUStringBuffer& value )
+ {
+ if (this != &value)
+ {
+ rtl_uStringbuffer_newFromStringBuffer(&pData,
+ value.nCapacity,
+ value.pData);
+ nCapacity = value.nCapacity;
+ }
+ return *this;
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** Move assignment
+ * @since LibreOffice 7.3
+ */
+ OUStringBuffer& operator = ( OUStringBuffer&& value ) noexcept
+ {
+ rtl_uString_release( pData );
+ pData = value.pData;
+ nCapacity = value.nCapacity;
+ value.pData = nullptr;
+ value.nCapacity = 0;
+ rtl_uString_new( &value.pData );
+ return *this;
+ }
+#endif
+
+ /** Assign from a string.
+
+ @since LibreOffice 5.3
+ */
+#if defined LIBO_INTERNAL_ONLY
+ OUStringBuffer & operator =(std::u16string_view string) {
+ sal_Int32 n = string.length();
+ if (n >= nCapacity) {
+ ensureCapacity(n + 16); //TODO: check for overflow
+ }
+ std::memcpy(
+ pData->buffer, string.data(),
+ n * sizeof (sal_Unicode));
+ pData->buffer[n] = '\0';
+ pData->length = n;
+ return *this;
+ }
+#else
+ OUStringBuffer & operator =(OUString const & string) {
+ sal_Int32 n = string.getLength();
+ if (n >= nCapacity) {
+ ensureCapacity(n + 16); //TODO: check for overflow
+ }
+ std::memcpy(
+ pData->buffer, string.pData->buffer,
+ (n + 1) * sizeof (sal_Unicode));
+ pData->length = n;
+ return *this;
+ }
+#endif
+
+ /** Assign from a string literal.
+
+ @since LibreOffice 5.3
+ */
+ template<typename T>
+ typename
+ libreoffice_internal::ConstCharArrayDetector<T, OUStringBuffer &>::Type
+ operator =(T & literal) {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ sal_Int32 const n
+ = libreoffice_internal::ConstCharArrayDetector<T>::length;
+ if (n >= nCapacity) {
+ ensureCapacity(n + 16); //TODO: check for overflow
+ }
+ char const * from
+ = libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal);
+ sal_Unicode * to = pData->buffer;
+ for (sal_Int32 i = 0; i <= n; ++i) {
+ to[i] = from[i];
+ }
+ pData->length = n;
+ return *this;
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T>
+ typename libreoffice_internal::ConstCharArrayDetector<
+ T, OUStringBuffer &>::TypeUtf16
+ operator =(T & literal) {
+ sal_Int32 const n
+ = libreoffice_internal::ConstCharArrayDetector<T>::length;
+ if (n >= nCapacity) {
+ ensureCapacity(n + 16); //TODO: check for overflow
+ }
+ // For OUStringChar, which is covered by this template's ConstCharArrayDetector TypeUtf16
+ // check, toPointer does not return a NUL-terminated string, so we can't just memcpy n+1
+ // elements but rather need to add the terminating NUL manually:
+ std::memcpy(
+ pData->buffer,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ n * sizeof (sal_Unicode));
+ pData->buffer[n] = '\0';
+ pData->length = n;
+ return *this;
+ }
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T1, typename T2>
+ OUStringBuffer & operator =(OUStringConcat<T1, T2> && concat) {
+ sal_Int32 const n = concat.length();
+ if (n >= nCapacity) {
+ ensureCapacity(n + 16); //TODO: check for overflow
+ }
+ *concat.addData(pData->buffer) = 0;
+ pData->length = n;
+ return *this;
+ }
+
+ /** @overload @internal */
+ template<typename T>
+ OUStringBuffer & operator =(OUStringNumber<T> && n)
+ {
+ *this = OUStringBuffer( std::move( n ) );
+ return *this;
+ }
+#endif
+
+ /**
+ Release the string data.
+ */
+ ~OUStringBuffer()
+ {
+ rtl_uString_release( pData );
+ }
+
+ /**
+ Fill the string data in the new string and clear the buffer.
+
+ This method is more efficient than the constructor of the string. It does
+ not copy the buffer.
+
+ @return the string previously contained in the buffer.
+ */
+ SAL_WARN_UNUSED_RESULT OUString makeStringAndClear()
+ {
+ return OUString(
+ rtl_uStringBuffer_makeStringAndClear( &pData, &nCapacity ),
+ SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Returns the length (character count) of this string buffer.
+
+ @return the number of characters in this string buffer.
+ */
+ sal_Int32 getLength() const
+ {
+ return pData->length;
+ }
+
+ /**
+ Checks if a string buffer is empty.
+
+ @return true if the string buffer is empty;
+ false, otherwise.
+
+ @since LibreOffice 4.1
+ */
+ bool isEmpty() const
+ {
+ return pData->length == 0;
+ }
+
+ /**
+ Returns the current capacity of the String buffer.
+
+ The capacity
+ is the amount of storage available for newly inserted
+ characters. The real buffer size is 2 bytes longer, because
+ all strings are 0 terminated.
+
+ @return the current capacity of this string buffer.
+ */
+ sal_Int32 getCapacity() const
+ {
+ return nCapacity;
+ }
+
+ /**
+ Ensures that the capacity of the buffer is at least equal to the
+ specified minimum.
+
+ The new capacity will be at least as large as the maximum of the current
+ length (so that no contents of the buffer is destroyed) and the given
+ minimumCapacity. If the given minimumCapacity is negative, nothing is
+ changed.
+
+ @param minimumCapacity the minimum desired capacity.
+ */
+ void ensureCapacity(sal_Int32 minimumCapacity)
+ {
+ rtl_uStringbuffer_ensureCapacity( &pData, &nCapacity, minimumCapacity );
+ }
+
+ /**
+ Sets the length of this String buffer.
+
+ If the <code>newLength</code> argument is less than the current
+ length of the string buffer, the string buffer is truncated to
+ contain exactly the number of characters given by the
+ <code>newLength</code> argument.
+ <p>
+ If the <code>newLength</code> argument is greater than or equal
+ to the current length, sufficient null characters
+ (<code>'&#92;u0000'</code>) are appended to the string buffer so that
+ length becomes the <code>newLength</code> argument.
+ <p>
+ The <code>newLength</code> argument must be greater than or equal
+ to <code>0</code>.
+
+ @param newLength the new length of the buffer.
+ */
+ void setLength(sal_Int32 newLength)
+ {
+ assert(newLength >= 0);
+ // Avoid modifications if pData points to const empty string:
+ if( newLength != pData->length )
+ {
+ if( newLength > nCapacity )
+ rtl_uStringbuffer_ensureCapacity(&pData, &nCapacity, newLength);
+ else
+ pData->buffer[newLength] = 0;
+ pData->length = newLength;
+ }
+ }
+
+ /**
+ Returns the character at a specific index in this string buffer.
+
+ The first character of a string buffer is at index
+ <code>0</code>, the next at index <code>1</code>, and so on, for
+ array indexing.
+ <p>
+ The index argument must be greater than or equal to
+ <code>0</code>, and less than the length of this string buffer.
+
+ @param index the index of the desired character.
+ @return the character at the specified index of this string buffer.
+ */
+ SAL_DEPRECATED("use rtl::OUStringBuffer::operator [] instead")
+ sal_Unicode charAt( sal_Int32 index ) const
+ {
+ assert(index >= 0 && index < pData->length);
+ return pData->buffer[ index ];
+ }
+
+ /**
+ The character at the specified index of this string buffer is set
+ to <code>ch</code>.
+
+ The index argument must be greater than or equal to
+ <code>0</code>, and less than the length of this string buffer.
+
+ @param index the index of the character to modify.
+ @param ch the new character.
+ */
+ SAL_DEPRECATED("use rtl::OUStringBuffer::operator [] instead")
+ OUStringBuffer & setCharAt(sal_Int32 index, sal_Unicode ch)
+ {
+ assert(index >= 0 && index < pData->length);
+ pData->buffer[ index ] = ch;
+ return *this;
+ }
+
+ /**
+ Return a null terminated unicode character array.
+ */
+ const sal_Unicode* getStr() const SAL_RETURNS_NONNULL { return pData->buffer; }
+
+ /**
+ Access to individual characters.
+
+ @param index must be non-negative and less than length.
+
+ @return a reference to the character at the given index.
+
+ @since LibreOffice 3.5
+ */
+ sal_Unicode & operator [](sal_Int32 index)
+ {
+ assert(index >= 0 && index < pData->length);
+ return pData->buffer[index];
+ }
+
+ /**
+ Access to individual characters.
+
+ @param index must be non-negative and less than length.
+
+ @return a reference to the character at the given index.
+
+ @since LibreOffice 4.2
+ */
+ const sal_Unicode & operator [](sal_Int32 index) const
+ {
+ assert(index >= 0 && index < pData->length);
+ return pData->buffer[index];
+ }
+
+ /**
+ Return an OUString instance reflecting the current content
+ of this OUStringBuffer.
+ */
+ OUString toString() const
+ {
+ return OUString(pData->buffer, pData->length);
+ }
+
+ /**
+ Appends the string to this string buffer.
+
+ The characters of the <code>OUString</code> argument are appended, in
+ order, to the contents of this string buffer, increasing the
+ length of this string buffer by the length of the argument.
+
+ @param str a string.
+ @return this string buffer.
+ */
+#if !defined LIBO_INTERNAL_ONLY
+ OUStringBuffer & append(const OUString &str)
+ {
+ return append( str.getStr(), str.getLength() );
+ }
+#else
+ OUStringBuffer & append(std::u16string_view sv) {
+ if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
+ throw std::bad_alloc();
+ }
+ return append(sv.data(), sv.size());
+ }
+#endif
+
+#if !defined LIBO_INTERNAL_ONLY
+ /**
+ Appends the content of a stringbuffer to this string buffer.
+
+ The characters of the <code>OUStringBuffer</code> argument are appended, in
+ order, to the contents of this string buffer, increasing the
+ length of this string buffer by the length of the argument.
+
+ @param str a string.
+ @return this string buffer.
+
+ @since LibreOffice 4.0
+ */
+ OUStringBuffer & append(const OUStringBuffer &str)
+ {
+ if(!str.isEmpty())
+ {
+ append( str.getStr(), str.getLength() );
+ }
+ return *this;
+ }
+#endif
+
+ /**
+ Appends the string representation of the <code>char</code> array
+ argument to this string buffer.
+
+ The characters of the array argument are appended, in order, to
+ the contents of this string buffer. The length of this string
+ buffer increases by the length of the argument.
+
+ @param str the characters to be appended.
+ @return this string buffer.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ template<typename T>
+ typename libreoffice_internal::CharPtrDetector<T, OUStringBuffer &>::TypeUtf16
+ append(T const & str)
+#else
+ OUStringBuffer & append( const sal_Unicode * str )
+#endif
+ {
+ return append( str, rtl_ustr_getLength( str ) );
+ }
+
+ /**
+ Appends the string representation of the <code>char</code> array
+ argument to this string buffer.
+
+ Characters of the character array <code>str</code> are appended,
+ in order, to the contents of this string buffer. The length of this
+ string buffer increases by the value of <code>len</code>.
+
+ @param str the characters to be appended; must be non-null, and must
+ point to at least len characters
+ @param len the number of characters to append; must be non-negative
+ @return this string buffer.
+ */
+ OUStringBuffer & append( const sal_Unicode * str, sal_Int32 len)
+ {
+ assert( len == 0 || str != NULL ); // cannot assert that in rtl_uStringbuffer_insert
+ rtl_uStringbuffer_insert( &pData, &nCapacity, getLength(), str, len );
+ return *this;
+ }
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, OUStringBuffer& >::Type append( T& literal )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return appendAscii(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ template<typename T>
+ typename libreoffice_internal::NonConstCharArrayDetector<T, OUStringBuffer &>::TypeUtf16
+ append(T & value) { return append(static_cast<sal_Unicode *>(value)); }
+
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T>
+ typename libreoffice_internal::ConstCharArrayDetector<
+ T, OUStringBuffer &>::TypeUtf16
+ append(T & literal) {
+ return append(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+#endif
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /**
+ @overload
+ @internal
+ */
+ template< typename T1, typename T2 >
+ OUStringBuffer& append( OUStringConcat< T1, T2 >&& c )
+ {
+ sal_Int32 l = c.length();
+ if( l == 0 )
+ return *this;
+ l += pData->length;
+ rtl_uStringbuffer_ensureCapacity( &pData, &nCapacity, l );
+ sal_Unicode* end = c.addData( pData->buffer + pData->length );
+ *end = '\0';
+ pData->length = l;
+ return *this;
+ }
+
+ /**
+ @overload
+ @internal
+ */
+ template< typename T >
+ OUStringBuffer& append( OUStringNumber< T >&& c )
+ {
+ return append( c.buf, c.length );
+ }
+#endif
+
+ /**
+ Appends a 8-Bit ASCII character string to this string buffer.
+
+ Since this method is optimized for performance. the ASCII
+ character values are not converted in any way. The caller
+ has to make sure that all ASCII characters are in the
+ allowed range between 0 and 127. The ASCII string must be
+ NULL-terminated.
+ <p>
+ The characters of the array argument are appended, in order, to
+ the contents of this string buffer. The length of this string
+ buffer increases by the length of the argument.
+
+ @param str the 8-Bit ASCII characters to be appended.
+ @return this string buffer.
+ */
+ OUStringBuffer & appendAscii( const char * str )
+ {
+ return appendAscii( str, rtl_str_getLength( str ) );
+ }
+
+ /**
+ Appends a 8-Bit ASCII character string to this string buffer.
+
+ Since this method is optimized for performance. the ASCII
+ character values are not converted in any way. The caller
+ has to make sure that all ASCII characters are in the
+ allowed range between 0 and 127. The ASCII string must be
+ NULL-terminated.
+ <p>
+ Characters of the character array <code>str</code> are appended,
+ in order, to the contents of this string buffer. The length of this
+ string buffer increases by the value of <code>len</code>.
+
+ @param str the 8-Bit ASCII characters to be appended; must be non-null,
+ and must point to at least len characters
+ @param len the number of characters to append; must be non-negative
+ @return this string buffer.
+ */
+ OUStringBuffer & appendAscii( const char * str, sal_Int32 len)
+ {
+ rtl_uStringbuffer_insert_ascii( &pData, &nCapacity, getLength(), str, len );
+ return *this;
+ }
+
+ /**
+ Appends the string representation of the <code>bool</code>
+ argument to the string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param b a <code>bool</code>.
+ @return this string buffer.
+
+ @since LibreOffice 4.1
+ */
+ OUStringBuffer & append(bool b)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFBOOLEAN];
+ return append( sz, rtl_ustr_valueOfBoolean( sz, b ) );
+ }
+
+ /// @cond INTERNAL
+ // Pointer can be automatically converted to bool, which is unwanted here.
+ // Explicitly delete all pointer append() overloads to prevent this
+ // (except for char* and sal_Unicode* overloads, which are handled elsewhere).
+ template< typename T >
+ typename libreoffice_internal::Enable< void,
+ !libreoffice_internal::CharPtrDetector< T* >::ok && !libreoffice_internal::SalUnicodePtrDetector< T* >::ok >::Type
+ append( T* ) SAL_DELETED_FUNCTION;
+ /// @endcond
+
+ // This overload is needed because OUString has a ctor from rtl_uString*, but
+ // the bool overload above would be preferred to the conversion.
+ /**
+ @internal
+ */
+ OUStringBuffer & append(rtl_uString* str)
+ {
+ return append( OUString( str ));
+ }
+
+ /**
+ Appends the string representation of the <code>sal_Bool</code>
+ argument to the string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param b a <code>sal_Bool</code>.
+ @return this string buffer.
+ */
+ OUStringBuffer & append(sal_Bool b)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFBOOLEAN];
+ return append( sz, rtl_ustr_valueOfBoolean( sz, b ) );
+ }
+
+ /**
+ Appends the string representation of the ASCII <code>char</code>
+ argument to this string buffer.
+
+ The argument is appended to the contents of this string buffer.
+ The length of this string buffer increases by <code>1</code>.
+
+ @param c an ASCII <code>char</code>.
+ @return this string buffer.
+
+ @since LibreOffice 3.5
+ */
+ OUStringBuffer & append(char c)
+ {
+ assert(static_cast< unsigned char >(c) <= 0x7F);
+ return append(sal_Unicode(c));
+ }
+
+ /**
+ Appends the string representation of the <code>char</code>
+ argument to this string buffer.
+
+ The argument is appended to the contents of this string buffer.
+ The length of this string buffer increases by <code>1</code>.
+
+ @param c a <code>char</code>.
+ @return this string buffer.
+ */
+ OUStringBuffer & append(sal_Unicode c)
+ {
+ return append( &c, 1 );
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ void append(sal_uInt16) = delete;
+#endif
+
+ /**
+ Appends the string representation of the <code>sal_Int32</code>
+ argument to this string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param i an <code>sal_Int32</code>.
+ @param radix the radix
+ @return this string buffer.
+ */
+ OUStringBuffer & append(sal_Int32 i, sal_Int16 radix = 10 )
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFINT32];
+ return append( sz, rtl_ustr_valueOfInt32( sz, i, radix ) );
+ }
+
+ /**
+ Appends the string representation of the <code>long</code>
+ argument to this string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param l a <code>long</code>.
+ @param radix the radix
+ @return this string buffer.
+ */
+ OUStringBuffer & append(sal_Int64 l, sal_Int16 radix = 10 )
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFINT64];
+ return append( sz, rtl_ustr_valueOfInt64( sz, l, radix ) );
+ }
+
+ /**
+ Appends the string representation of the <code>float</code>
+ argument to this string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param f a <code>float</code>.
+ @return this string buffer.
+ */
+ OUStringBuffer & append(float f)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFFLOAT];
+ return append( sz, rtl_ustr_valueOfFloat( sz, f ) );
+ }
+
+ /**
+ Appends the string representation of the <code>double</code>
+ argument to this string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param d a <code>double</code>.
+ @return this string buffer.
+ */
+ OUStringBuffer & append(double d)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFDOUBLE];
+ return append( sz, rtl_ustr_valueOfDouble( sz, d ) );
+ }
+
+ /**
+ Appends a single UTF-32 character to this string buffer.
+
+ <p>The single UTF-32 character will be represented within the string
+ buffer as either one or two UTF-16 code units.</p>
+
+ @param c a well-formed UTF-32 code unit (that is, a value in the range
+ <code>0</code>&ndash;<code>0x10FFFF</code>, but excluding
+ <code>0xD800</code>&ndash;<code>0xDFFF</code>)
+
+ @return
+ this string buffer
+ */
+ OUStringBuffer & appendUtf32(sal_uInt32 c) {
+ return insertUtf32(getLength(), c);
+ }
+
+ /**
+ Unsafe way to make space for a fixed amount of characters to be appended
+ into this OUStringBuffer.
+
+ A call to this function must immediately be followed by code that
+ completely fills the uninitialized block pointed to by the return value.
+
+ @param length the length of the uninitialized block of sal_Unicode
+ entities; must be non-negative
+
+ @return a pointer to the start of the uninitialized block; only valid
+ until this OUStringBuffer's capacity changes
+
+ @since LibreOffice 4.4
+ */
+ sal_Unicode * appendUninitialized(sal_Int32 length) SAL_RETURNS_NONNULL {
+ sal_Int32 n = getLength();
+ rtl_uStringbuffer_insert(&pData, &nCapacity, n, NULL, length);
+ return pData->buffer + n;
+ }
+
+ /**
+ Inserts the string into this string buffer.
+
+ The characters of the <code>String</code> argument are inserted, in
+ order, into this string buffer at the indicated offset. The length
+ of this string buffer is increased by the length of the argument.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param str a string.
+ @return this string buffer.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ OUStringBuffer & insert(sal_Int32 offset, std::u16string_view str)
+ {
+ return insert( offset, str.data(), str.length() );
+ }
+#else
+ OUStringBuffer & insert(sal_Int32 offset, const OUString & str)
+ {
+ return insert( offset, str.getStr(), str.getLength() );
+ }
+#endif
+
+ /**
+ Inserts the string representation of the <code>char</code> array
+ argument into this string buffer.
+
+ The characters of the array argument are inserted into the
+ contents of this string buffer at the position indicated by
+ <code>offset</code>. The length of this string buffer increases by
+ the length of the argument.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param str a character array.
+ @return this string buffer.
+ */
+ OUStringBuffer & insert( sal_Int32 offset, const sal_Unicode * str )
+ {
+ return insert( offset, str, rtl_ustr_getLength( str ) );
+ }
+
+ /**
+ Inserts the string representation of the <code>char</code> array
+ argument into this string buffer.
+
+ The characters of the array argument are inserted into the
+ contents of this string buffer at the position indicated by
+ <code>offset</code>. The length of this string buffer increases by
+ the length of the argument.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param str a character array.
+ @param len the number of characters to append.
+ @return this string buffer.
+ */
+ OUStringBuffer & insert( sal_Int32 offset, const sal_Unicode * str, sal_Int32 len)
+ {
+ assert( len == 0 || str != NULL ); // cannot assert that in rtl_uStringbuffer_insert
+ rtl_uStringbuffer_insert( &pData, &nCapacity, offset, str, len );
+ return *this;
+ }
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, OUStringBuffer& >::Type insert( sal_Int32 offset, T& literal )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ rtl_uStringbuffer_insert_ascii(
+ &pData, &nCapacity, offset,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ return *this;
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T>
+ typename libreoffice_internal::ConstCharArrayDetector<
+ T, OUStringBuffer &>::TypeUtf16
+ insert(sal_Int32 offset, T & literal) {
+ return insert(
+ offset,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+#endif
+
+ /**
+ Inserts the string representation of the <code>sal_Bool</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param b a <code>sal_Bool</code>.
+ @return this string buffer.
+ */
+ OUStringBuffer & insert(sal_Int32 offset, sal_Bool b)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFBOOLEAN];
+ return insert( offset, sz, rtl_ustr_valueOfBoolean( sz, b ) );
+ }
+
+ /**
+ Inserts the string representation of the <code>bool</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>OUString::boolean</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param b a <code>bool</code>.
+ @return this string buffer.
+
+ @since LibreOffice 4.3
+ */
+ OUStringBuffer & insert(sal_Int32 offset, bool b)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFBOOLEAN];
+ return insert( offset, sz, rtl_ustr_valueOfBoolean( sz, b ) );
+ }
+
+ /**
+ Inserts the string representation of the <code>char</code>
+ argument into this string buffer.
+
+ The second argument is inserted into the contents of this string
+ buffer at the position indicated by <code>offset</code>. The length
+ of this string buffer increases by one.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param c a <code>char</code>.
+ @return this string buffer.
+
+ @since LibreOffice 3.6
+ */
+ OUStringBuffer & insert(sal_Int32 offset, char c)
+ {
+ sal_Unicode u = c;
+ return insert( offset, &u, 1 );
+ }
+
+ /**
+ Inserts the string representation of the <code>char</code>
+ argument into this string buffer.
+
+ The second argument is inserted into the contents of this string
+ buffer at the position indicated by <code>offset</code>. The length
+ of this string buffer increases by one.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param c a <code>char</code>.
+ @return this string buffer.
+ */
+ OUStringBuffer & insert(sal_Int32 offset, sal_Unicode c)
+ {
+ return insert( offset, &c, 1 );
+ }
+
+ /**
+ Inserts the string representation of the second <code>sal_Int32</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param i an <code>sal_Int32</code>.
+ @param radix the radix.
+ @return this string buffer.
+ @exception StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ OUStringBuffer & insert(sal_Int32 offset, sal_Int32 i, sal_Int16 radix = 10 )
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFINT32];
+ return insert( offset, sz, rtl_ustr_valueOfInt32( sz, i, radix ) );
+ }
+
+ /**
+ Inserts the string representation of the <code>long</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param l a <code>long</code>.
+ @param radix the radix.
+ @return this string buffer.
+ @exception StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ OUStringBuffer & insert(sal_Int32 offset, sal_Int64 l, sal_Int16 radix = 10 )
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFINT64];
+ return insert( offset, sz, rtl_ustr_valueOfInt64( sz, l, radix ) );
+ }
+
+ /**
+ Inserts the string representation of the <code>float</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param f a <code>float</code>.
+ @return this string buffer.
+ @exception StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ OUStringBuffer insert(sal_Int32 offset, float f)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFFLOAT];
+ return insert( offset, sz, rtl_ustr_valueOfFloat( sz, f ) );
+ }
+
+ /**
+ Inserts the string representation of the <code>double</code>
+ argument into this string buffer.
+
+ The second argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then inserted into this string buffer at the indicated
+ offset.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
+
+ @param offset the offset.
+ @param d a <code>double</code>.
+ @return this string buffer.
+ @exception StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ OUStringBuffer & insert(sal_Int32 offset, double d)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFDOUBLE];
+ return insert( offset, sz, rtl_ustr_valueOfDouble( sz, d ) );
+ }
+
+ /**
+ Inserts a single UTF-32 character into this string buffer.
+
+ <p>The single UTF-32 character will be represented within the string
+ buffer as either one or two UTF-16 code units.</p>
+
+ @param offset the offset into this string buffer (from zero to the length
+ of this string buffer, inclusive)
+
+ @param c a well-formed UTF-32 code unit (that is, a value in the range
+ <code>0</code>&ndash;<code>0x10FFFF</code>, but excluding
+ <code>0xD800</code>&ndash;<code>0xDFFF</code>)
+
+ @return this string buffer
+ */
+ OUStringBuffer & insertUtf32(sal_Int32 offset, sal_uInt32 c) {
+ rtl_uStringbuffer_insertUtf32(&pData, &nCapacity, offset, c);
+ return *this;
+ }
+
+ /**
+ Removes the characters in a substring of this sequence.
+
+ The substring begins at the specified <code>start</code> and
+ is <code>len</code> characters long.
+
+ start must be >= 0 && <= This->length
+
+ @param start The beginning index, inclusive
+ @param len The substring length
+ @return this string buffer.
+ */
+ OUStringBuffer & remove( sal_Int32 start, sal_Int32 len )
+ {
+ rtl_uStringbuffer_remove( &pData, start, len );
+ return *this;
+ }
+
+ /**
+ Removes the tail of a string buffer start at the indicate position
+
+ start must be >= 0 && <= This->length
+
+ @param start The beginning index, inclusive. default to 0
+ @return this string buffer.
+
+ @since LibreOffice 4.0
+ */
+ OUStringBuffer & truncate( sal_Int32 start = 0 )
+ {
+ rtl_uStringbuffer_remove( &pData, start, getLength() - start );
+ return *this;
+ }
+
+ /**
+ Replace all occurrences of
+ oldChar in this string buffer with newChar.
+
+ @since LibreOffice 4.0
+
+ @param oldChar the old character.
+ @param newChar the new character.
+ @return this string buffer
+ */
+ OUStringBuffer& replace( sal_Unicode oldChar, sal_Unicode newChar )
+ {
+ sal_Int32 index = 0;
+ while((index = indexOf(oldChar, index)) >= 0)
+ {
+ pData->buffer[ index ] = newChar;
+ }
+ return *this;
+ }
+
+ /** Allows access to the internal data of this OUStringBuffer, for effective
+ manipulation.
+
+ This method should be used with care. After you have called this
+ method, you may use the returned pInternalData or pInternalCapacity only
+ as long as you make no other method call on this OUStringBuffer.
+
+ @param pInternalData
+ This output parameter receives a pointer to the internal data
+ (rtl_uString pointer). pInternalData itself must not be null.
+
+ @param pInternalCapacity
+ This output parameter receives a pointer to the internal capacity.
+ pInternalCapacity itself must not be null.
+ */
+ void accessInternals(rtl_uString *** pInternalData,
+ sal_Int32 ** pInternalCapacity)
+ {
+ *pInternalData = &pData;
+ *pInternalCapacity = &nCapacity;
+ }
+
+
+ /**
+ Returns the index within this string of the first occurrence of the
+ specified character, starting the search at the specified index.
+
+ @since LibreOffice 4.0
+
+ @param ch character to be located.
+ @param fromIndex the index to start the search from.
+ The index must be greater or equal than 0
+ and less or equal as the string length.
+ @return the index of the first occurrence of the character in the
+ character sequence represented by this string that is
+ greater than or equal to fromIndex, or
+ -1 if the character does not occur.
+ */
+ sal_Int32 indexOf( sal_Unicode ch, sal_Int32 fromIndex = 0 ) const
+ {
+ assert( fromIndex >= 0 && fromIndex <= pData->length );
+ sal_Int32 ret = rtl_ustr_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
+ return (ret < 0 ? ret : ret+fromIndex);
+ }
+
+ /**
+ Returns the index within this string of the last occurrence of the
+ specified character, searching backward starting at the end.
+
+ @since LibreOffice 4.0
+
+ @param ch character to be located.
+ @return the index of the last occurrence of the character in the
+ character sequence represented by this string, or
+ -1 if the character does not occur.
+ */
+ sal_Int32 lastIndexOf( sal_Unicode ch ) const
+ {
+ return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
+ }
+
+ /**
+ Returns the index within this string of the last occurrence of the
+ specified character, searching backward starting before the specified
+ index.
+
+ @since LibreOffice 4.0
+
+ @param ch character to be located.
+ @param fromIndex the index before which to start the search.
+ @return the index of the last occurrence of the character in the
+ character sequence represented by this string that
+ is less than fromIndex, or -1
+ if the character does not occur before that point.
+ */
+ sal_Int32 lastIndexOf( sal_Unicode ch, sal_Int32 fromIndex ) const
+ {
+ assert( fromIndex >= 0 && fromIndex <= pData->length );
+ return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
+ }
+
+ /**
+ Returns the index within this string of the first occurrence of the
+ specified substring, starting at the specified index.
+
+ If str doesn't include any character, always -1 is
+ returned. This is also the case, if both strings are empty.
+
+ @since LibreOffice 4.0
+
+ @param str the substring to search for.
+ @param fromIndex the index to start the search from.
+ @return If the string argument occurs one or more times as a substring
+ within this string at the starting index, then the index
+ of the first character of the first such substring is
+ returned. If it does not occur as a substring starting
+ at fromIndex or beyond, -1 is returned.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 indexOf( std::u16string_view str, sal_Int32 fromIndex = 0 ) const
+ {
+ assert( fromIndex >= 0 && fromIndex <= pData->length );
+ sal_Int32 ret = rtl_ustr_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ str.data(), str.length() );
+ return (ret < 0 ? ret : ret+fromIndex);
+ }
+#else
+ sal_Int32 indexOf( const OUString & str, sal_Int32 fromIndex = 0 ) const
+ {
+ assert( fromIndex >= 0 && fromIndex <= pData->length );
+ sal_Int32 ret = rtl_ustr_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ str.pData->buffer, str.pData->length );
+ return (ret < 0 ? ret : ret+fromIndex);
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+
+ @since LibreOffice 4.0
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ sal_Int32 n = rtl_ustr_indexOfAscii_WithLength(
+ pData->buffer + fromIndex, pData->length - fromIndex,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ return n < 0 ? n : n + fromIndex;
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T>
+ typename
+ libreoffice_internal::ConstCharArrayDetector<T, sal_Int32>::TypeUtf16
+ indexOf(T & literal, sal_Int32 fromIndex = 0) const {
+ assert(fromIndex >= 0);
+ auto n = rtl_ustr_indexOfStr_WithLength(
+ pData->buffer + fromIndex, pData->length - fromIndex,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ return n < 0 ? n : n + fromIndex;
+ }
+#endif
+
+ /**
+ Returns the index within this string of the last occurrence of
+ the specified substring, searching backward starting at the end.
+
+ The returned index indicates the starting index of the substring
+ in this string.
+ If str doesn't include any character, always -1 is
+ returned. This is also the case, if both strings are empty.
+
+ @since LibreOffice 4.0
+
+ @param str the substring to search for.
+ @return If the string argument occurs one or more times as a substring
+ within this string, then the index of the first character of
+ the last such substring is returned. If it does not occur as
+ a substring, -1 is returned.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 lastIndexOf( std::u16string_view str ) const
+ {
+ return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, pData->length,
+ str.data(), str.length() );
+ }
+#else
+ sal_Int32 lastIndexOf( const OUString & str ) const
+ {
+ return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length );
+ }
+#endif
+
+ /**
+ Returns the index within this string of the last occurrence of
+ the specified substring, searching backward starting before the specified
+ index.
+
+ The returned index indicates the starting index of the substring
+ in this string.
+ If str doesn't include any character, always -1 is
+ returned. This is also the case, if both strings are empty.
+
+ @since LibreOffice 4.0
+
+ @param str the substring to search for.
+ @param fromIndex the index before which to start the search.
+ @return If the string argument occurs one or more times as a substring
+ within this string before the starting index, then the index
+ of the first character of the last such substring is
+ returned. Otherwise, -1 is returned.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 lastIndexOf( std::u16string_view str, sal_Int32 fromIndex ) const
+ {
+ assert( fromIndex >= 0 && fromIndex <= pData->length );
+ return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
+ str.data(), str.length() );
+ }
+#else
+ sal_Int32 lastIndexOf( const OUString & str, sal_Int32 fromIndex ) const
+ {
+ assert( fromIndex >= 0 && fromIndex <= pData->length );
+ return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
+ str.pData->buffer, str.pData->length );
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 4.0
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type lastIndexOf( T& literal ) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return rtl_ustr_lastIndexOfAscii_WithLength(
+ pData->buffer, pData->length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T>
+ typename
+ libreoffice_internal::ConstCharArrayDetector<T, sal_Int32>::TypeUtf16
+ lastIndexOf(T & literal) const {
+ return rtl_ustr_lastIndexOfStr_WithLength(
+ pData->buffer, pData->length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+#endif
+
+ /**
+ Strip the given character from the start of the buffer.
+
+ @since LibreOffice 4.0
+
+ @param c the character to strip
+ @return The number of characters stripped
+
+ */
+ sal_Int32 stripStart(sal_Unicode c = ' ')
+ {
+ sal_Int32 index;
+ for(index = 0; index < getLength() ; index++)
+ {
+ if(pData->buffer[ index ] != c)
+ {
+ break;
+ }
+ }
+ if(index)
+ {
+ remove(0, index);
+ }
+ return index;
+ }
+
+ /**
+ Strip the given character from the end of the buffer.
+
+ @since LibreOffice 4.0
+
+ @param c the character to strip
+ @return The number of characters stripped
+
+ */
+ sal_Int32 stripEnd(sal_Unicode c = ' ')
+ {
+ sal_Int32 result = getLength();
+ sal_Int32 index;
+ for(index = getLength(); index > 0 ; index--)
+ {
+ if(pData->buffer[ index - 1 ] != c)
+ {
+ break;
+ }
+ }
+ if(index < getLength())
+ {
+ truncate(index);
+ }
+ return result - getLength();
+ }
+ /**
+ Strip the given character from the both end of the buffer.
+
+ @since LibreOffice 4.0
+
+ @param c the character to strip
+ @return The number of characters stripped
+
+ */
+ sal_Int32 strip(sal_Unicode c = ' ')
+ {
+ return stripStart(c) + stripEnd(c);
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /**
+ Returns a std::u16string_view that is a view of a substring of this string.
+
+ The substring begins at the specified beginIndex. If
+ beginIndex is negative or be greater than the length of
+ this string, behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @return the specified substring.
+ */
+ SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex ) const
+ {
+ assert(beginIndex >= 0);
+ assert(beginIndex <= getLength());
+ return subView(beginIndex, getLength() - beginIndex);
+ }
+
+ /**
+ Returns a std::u16string_view that is a view of a substring of this string.
+
+ The substring begins at the specified beginIndex and contains count
+ characters. If either beginIndex or count are negative,
+ or beginIndex + count are greater than the length of this string
+ then behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @param count the number of characters.
+ @return the specified substring.
+ */
+ SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const
+ {
+ assert(beginIndex >= 0);
+ assert(count >= 0);
+ assert(beginIndex <= getLength());
+ assert(count <= getLength() - beginIndex);
+ return std::u16string_view(pData->buffer, sal_uInt32(pData->length)).substr(beginIndex, count);
+ }
+#endif
+
+ /**
+ Returns a new string buffer that is a substring of this string.
+
+ The substring begins at the specified beginIndex. If
+ beginIndex is negative or be greater than the length of
+ this string, behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @return the specified substring.
+ @since LibreOffice 4.1
+ */
+ OUStringBuffer copy( sal_Int32 beginIndex ) const
+ {
+ return copy( beginIndex, getLength() - beginIndex );
+ }
+
+ /**
+ Returns a new string buffer that is a substring of this string.
+
+ The substring begins at the specified beginIndex and contains count
+ characters. If either beginIndex or count are negative,
+ or beginIndex + count are greater than the length of this string
+ then behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @param count the number of characters.
+ @return the specified substring.
+ @since LibreOffice 4.1
+ */
+ OUStringBuffer copy( sal_Int32 beginIndex, sal_Int32 count ) const
+ {
+ assert(beginIndex >= 0 && beginIndex <= getLength());
+ assert(count >= 0 && count <= getLength() - beginIndex);
+ rtl_uString *pNew = NULL;
+ rtl_uStringbuffer_newFromStr_WithLength( &pNew, getStr() + beginIndex, count );
+ return OUStringBuffer( pNew, count + 16 );
+ }
+
+private:
+ OUStringBuffer( rtl_uString * value, const sal_Int32 capacity )
+ {
+ pData = value;
+ nCapacity = capacity;
+ }
+
+ /**
+ A pointer to the data structure which contains the data.
+ */
+ rtl_uString * pData;
+
+ /**
+ The len of the pData->buffer.
+ */
+ sal_Int32 nCapacity;
+};
+
+#if defined LIBO_INTERNAL_ONLY
+template<> struct ToStringHelper<OUStringBuffer> {
+ static std::size_t length(OUStringBuffer const & s) { return s.getLength(); }
+
+ static sal_Unicode * addData(sal_Unicode * buffer, OUStringBuffer const & s) SAL_RETURNS_NONNULL
+ { return addDataHelper(buffer, s.getStr(), s.getLength()); }
+
+ static constexpr bool allowOStringConcat = false;
+ static constexpr bool allowOUStringConcat = true;
+};
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ // Define this here to avoid circular includes
+ inline OUString & OUString::operator+=( const OUStringBuffer & str ) &
+ {
+ // Call operator= if this is empty, otherwise rtl_uString_newConcat will attempt to
+ // acquire() the str.pData buffer, which is part of the OUStringBuffer mutable state.
+ if (isEmpty())
+ return operator=(str.toString());
+ else
+ return internalAppend(str.pData);
+ }
+
+ inline OUString const& OUString::unacquired(const OUStringBuffer& str)
+ {
+ return unacquired(&str.pData);
+ }
+#endif
+}
+
+#ifdef RTL_STRING_UNITTEST
+namespace rtl
+{
+typedef rtlunittest::OUStringBuffer OUStringBuffer;
+}
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
+using ::rtl::OUStringBuffer;
+#endif
+
+#endif // INCLUDED_RTL_USTRBUF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/ustring.h b/include/rtl/ustring.h
new file mode 100644
index 000000000..2371d9a5e
--- /dev/null
+++ b/include/rtl/ustring.h
@@ -0,0 +1,2414 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_USTRING_H
+#define INCLUDED_RTL_USTRING_H
+
+#include "sal/config.h"
+
+#include "osl/interlck.h"
+#include "rtl/string.h"
+#include "rtl/textenc.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ======================================================================= */
+
+/** Return the length of a string.
+
+ The length is equal to the number of 16-bit Unicode characters in the
+ string, without the terminating NUL character.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ the length of the sequence of characters represented by this string,
+ excluding the terminating NUL character.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_getLength(
+ const sal_Unicode * str ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting. Both strings must be
+ null-terminated.
+
+ @param first
+ the first null-terminated string to be compared.
+
+ @param second
+ the second null-terminated string which is compared with the first one.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string is
+ less than the second string, and a value greater than 0 if the first
+ string is greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_compare(
+ const sal_Unicode * first, const sal_Unicode * second ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string is
+ less than the second string, and a value greater than 0 if the first
+ string is greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_compare_WithLength(
+ const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings with a maximum count of characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @param shortenedLen
+ the maximum number of characters to compare. This length can be greater
+ or smaller than the lengths of the two strings.
+
+ @return
+ 0 if both substrings are equal, a value less than 0 if the first substring
+ is less than the second substring, and a value greater than 0 if the first
+ substring is greater than the second substring.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_shortenedCompare_WithLength(
+ const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings from back to front.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string
+ compares less than the second string, and a value greater than 0 if the
+ first string compares greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_reverseCompare_WithLength(
+ const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings from back to front for equality.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns 'true' if, and only if, both strings are equal.
+ This function cannot be used for language-specific sorting.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified len.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified len.
+
+ @param len
+ the length of both strings.
+
+ @return
+ true if both strings are equal, false if they are not equal.
+ */
+
+SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_ustr_asciil_reverseEquals_WithLength(
+ const sal_Unicode * first, const char * second, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings, ignoring the case of ASCII characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. Character
+ values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
+ and 122 (ASCII a--z). This function cannot be used for language-specific
+ sorting. Both strings must be null-terminated.
+
+ @param first
+ the first null-terminated string to be compared.
+
+ @param second
+ the second null-terminated string which is compared with the first one.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string is
+ less than the second string, and a value greater than 0 if the first
+ string is greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_compareIgnoreAsciiCase(
+ const sal_Unicode * first, const sal_Unicode * second ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings, ignoring the case of ASCII characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. Character
+ values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
+ and 122 (ASCII a--z). This function cannot be used for language-specific
+ sorting.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string is
+ less than the second string, and a value greater than 0 if the first
+ string is greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_compareIgnoreAsciiCase_WithLength(
+ const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings with a maximum count of characters, ignoring the case
+ of ASCII characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. Character
+ values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
+ and 122 (ASCII a--z). This function cannot be used for language-specific
+ sorting.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @param shortenedLen
+ the maximum number of characters to compare. This length can be greater
+ or smaller than the lengths of the two strings.
+
+ @return
+ 0 if both substrings are equal, a value less than 0 if the first substring
+ is less than the second substring, and a value greater than 0 if the first
+ substring is greater than the second substring.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength(
+ const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting. Both strings must be
+ null-terminated.
+
+ Since this function is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range of 0 and 127, inclusive.
+
+ @param first
+ the first null-terminated string to be compared.
+
+ @param second
+ the second null-terminated ASCII string which is compared with the first
+ one.
+
+ @return
+ 0 if both substrings are equal, a value less than 0 if the first substring
+ is less than the second substring, and a value greater than 0 if the first
+ substring is greater than the second substring.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_compare(
+ const sal_Unicode * first, const char * second ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting.
+
+ Since this function is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range of 0 and 127, inclusive.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second null-terminated ASCII string which is compared with the first
+ one.
+
+ @return
+ 0 if both substrings are equal, a value less than 0 if the first substring
+ is less than the second substring, and a value greater than 0 if the first
+ substring is greater than the second substring.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_compare_WithLength(
+ const sal_Unicode * first, sal_Int32 firstLen, const char * second ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings with a maximum count of characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting.
+
+ Since this function is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range of 0 and 127, inclusive.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second null-terminated ASCII string which is compared with the first
+ one.
+
+ @param shortenedLen
+ the maximum number of characters to compare. This length can be greater
+ or smaller than the lengths of the two strings.
+
+ @return
+ 0 if both substrings are equal, a value less than 0 if the first substring
+ is less than the second substring, and a value greater than 0 if the first
+ substring is greater than the second substring.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompare_WithLength(
+ const sal_Unicode * first, sal_Int32 firstLen, const char * second, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings from back to front.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. This function
+ cannot be used for language-specific sorting.
+
+ Since this function is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range of 0 and 127, inclusive.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second ASCII string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string
+ compares less than the second string, and a value greater than 0 if the
+ first string compares greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_asciil_reverseCompare_WithLength(
+ const sal_Unicode * first, sal_Int32 firstLen, const char * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings, ignoring the case of ASCII characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. Character
+ values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
+ and 122 (ASCII a--z). This function cannot be used for language-specific
+ sorting. Both strings must be null-terminated.
+
+ Since this function is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range of 0 and 127, inclusive.
+
+ @param first
+ the first null-terminated string to be compared.
+
+ @param second
+ the second null-terminated ASCII string which is compared with the first
+ one.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string is
+ less than the second string, and a value greater than 0 if the first
+ string is greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase(
+ const sal_Unicode * first, const char * second ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings, ignoring the case of ASCII characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. Character
+ values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
+ and 122 (ASCII a--z). This function cannot be used for language-specific
+ sorting.
+
+ Since this function is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range of 0 and 127, inclusive.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second null-terminated ASCII string which is compared with the first
+ one.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string is
+ less than the second string, and a value greater than 0 if the first
+ string is greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength(
+ const sal_Unicode * first, sal_Int32 firstLen, const char * second ) SAL_THROW_EXTERN_C();
+
+/** Compare two strings, ignoring the case of ASCII characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. Character
+ values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
+ and 122 (ASCII a--z). This function cannot be used for language-specific
+ sorting.
+
+ Since this function is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range of 0 and 127, inclusive.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second string which is compared with the first one. Need not be
+ null-terminated, but must be at least as long as the specified secondLen.
+
+ @param secondLen
+ the length of the second string.
+
+ @return
+ 0 if both strings are equal, a value less than 0 if the first string is
+ less than the second string, and a value greater than 0 if the first
+ string is greater than the second string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
+ sal_Unicode const * first, sal_Int32 firstLen,
+ char const * second, sal_Int32 secondLen) SAL_THROW_EXTERN_C();
+
+/** Compare two strings with a maximum count of characters, ignoring the case
+ of ASCII characters.
+
+ The comparison is based on the numeric value of each character in the
+ strings and returns a value indicating their relationship. Character
+ values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
+ and 122 (ASCII a--z). This function cannot be used for language-specific
+ sorting.
+
+ Since this function is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range of 0 and 127, inclusive.
+
+ @param first
+ the first string to be compared. Need not be null-terminated, but must be
+ at least as long as the specified firstLen.
+
+ @param firstLen
+ the length of the first string.
+
+ @param second
+ the second null-terminated ASCII string which is compared with the first
+ one.
+
+ @param shortenedLen
+ the maximum number of characters to compare. This length can be greater
+ or smaller than the lengths of the two strings.
+
+ @return
+ 0 if both substrings are equal, a value less than 0 if the first substring
+ is less than the second substring, and a value greater than 0 if the first
+ substring is greater than the second substring.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength(
+ const sal_Unicode * first, sal_Int32 firstLen, const char * second, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C();
+
+/** Return a hash code for a string.
+
+ It is not allowed to store the hash code persistently, because later
+ versions could return other hash codes. The string must be
+ null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ a hash code for the given string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_hashCode(
+ const sal_Unicode * str ) SAL_THROW_EXTERN_C();
+
+/** Return a hash code for a string.
+
+ It is not allowed to store the hash code persistently, because later
+ versions could return other hash codes.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @return
+ a hash code for the given string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_hashCode_WithLength(
+ const sal_Unicode * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Search for the first occurrence of a character within a string.
+
+ The string must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param ch
+ the character to be searched for.
+
+ @return
+ the index (starting at 0) of the first occurrence of the character in the
+ string, or -1 if the character does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_indexOfChar(
+ const sal_Unicode * str, sal_Unicode ch ) SAL_THROW_EXTERN_C();
+
+/** Search for the first occurrence of a character within a string.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @param ch
+ the character to be searched for.
+
+ @return
+ the index (starting at 0) of the first occurrence of the character in the
+ string, or -1 if the character does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_indexOfChar_WithLength(
+ const sal_Unicode * str, sal_Int32 len, sal_Unicode ch ) SAL_THROW_EXTERN_C();
+
+/** Search for the last occurrence of a character within a string.
+
+ The string must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param ch
+ the character to be searched for.
+
+ @return
+ the index (starting at 0) of the last occurrence of the character in the
+ string, or -1 if the character does not occur. The returned value is
+ always smaller than the string length.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_lastIndexOfChar(
+ const sal_Unicode * str, sal_Unicode ch ) SAL_THROW_EXTERN_C();
+
+/** Search for the last occurrence of a character within a string.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @param ch
+ the character to be searched for.
+
+ @return
+ the index (starting at 0) of the last occurrence of the character in the
+ string, or -1 if the character does not occur. The returned value is
+ always smaller than the string length.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_lastIndexOfChar_WithLength(
+ const sal_Unicode * str, sal_Int32 len, sal_Unicode ch ) SAL_THROW_EXTERN_C();
+
+/** Search for the first occurrence of a substring within a string.
+
+ If subStr is empty, or both str and subStr are empty, -1 is returned.
+ Both strings must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param subStr
+ the null-terminated substring to be searched for.
+
+ @return
+ the index (starting at 0) of the first character of the first occurrence
+ of the substring within the string, or -1 if the substring does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_indexOfStr(
+ const sal_Unicode * str, const sal_Unicode * subStr ) SAL_THROW_EXTERN_C();
+
+/** Search for the first occurrence of a substring within a string.
+
+ If subStr is empty, or both str and subStr are empty, -1 is returned.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @param subStr
+ the substring to be searched for. Need not be null-terminated, but must
+ be at least as long as the specified subLen.
+
+ @param subLen
+ the length of the substring.
+
+ @return
+ the index (starting at 0) of the first character of the first occurrence
+ of the substring within the string, or -1 if the substring does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_indexOfStr_WithLength(
+ const sal_Unicode * str, sal_Int32 len, const sal_Unicode * subStr, sal_Int32 subLen ) SAL_THROW_EXTERN_C();
+
+/** Search for the first occurrence of an ASCII substring within a string.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string; must be non-negative.
+
+ @param subStr
+ the substring to be searched for. Need not be null-terminated, but must
+ be at least as long as the specified subLen. Must only contain characters
+ in the ASCII range 0x00--7F.
+
+ @param subLen
+ the length of the substring; must be non-negative.
+
+ @return
+ the index (starting at 0) of the first character of the first occurrence
+ of the substring within the string, or -1 if the substring does not occur.
+ If subLen is zero, -1 is returned.
+
+ @since UDK 3.2.7
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_indexOfAscii_WithLength(
+ sal_Unicode const * str, sal_Int32 len,
+ char const * subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C();
+
+/** Search for the last occurrence of a substring within a string.
+
+ If subStr is empty, or both str and subStr are empty, -1 is returned.
+ Both strings must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param subStr
+ the null-terminated substring to be searched for.
+
+ @return
+ the index (starting at 0) of the first character of the last occurrence
+ of the substring within the string, or -1 if the substring does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_lastIndexOfStr(
+ const sal_Unicode * str, const sal_Unicode * subStr ) SAL_THROW_EXTERN_C();
+
+/** Search for the last occurrence of a substring within a string.
+
+ If subStr is empty, or both str and subStr are empty, -1 is returned.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @param subStr
+ the substring to be searched for. Need not be null-terminated, but must
+ be at least as long as the specified subLen.
+
+ @param subLen
+ the length of the substring.
+
+ @return
+ the index (starting at 0) of the first character of the first occurrence
+ of the substring within the string, or -1 if the substring does not occur.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_lastIndexOfStr_WithLength(
+ const sal_Unicode * str, sal_Int32 len, const sal_Unicode * subStr, sal_Int32 subLen ) SAL_THROW_EXTERN_C();
+
+/** Search for the last occurrence of an ASCII substring within a string.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string; must be non-negative.
+
+ @param subStr
+ the substring to be searched for. Need not be null-terminated, but must
+ be at least as long as the specified subLen. Must only contain characters
+ in the ASCII range 0x00--7F.
+
+ @param subLen
+ the length of the substring; must be non-negative.
+
+ @return
+ the index (starting at 0) of the first character of the last occurrence
+ of the substring within the string, or -1 if the substring does not occur.
+ If subLen is zero, -1 is returned.
+
+ @since UDK 3.2.7
+*/
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_lastIndexOfAscii_WithLength(
+ sal_Unicode const * str, sal_Int32 len,
+ char const * subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C();
+
+/** Replace all occurrences of a single character within a string.
+
+ If oldChar does not occur within str, then the string is not modified.
+ The string must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param oldChar
+ the old character.
+
+ @param newChar
+ the new character.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_ustr_replaceChar(
+ sal_Unicode * str, sal_Unicode oldChar, sal_Unicode newChar ) SAL_THROW_EXTERN_C();
+
+/** Replace all occurrences of a single character within a string.
+
+ If oldChar does not occur within str, then the string is not modified.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+
+ @param oldChar
+ the old character.
+
+ @param newChar
+ the new character.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_ustr_replaceChar_WithLength(
+ sal_Unicode * str, sal_Int32 len, sal_Unicode oldChar, sal_Unicode newChar ) SAL_THROW_EXTERN_C();
+
+/** Convert all ASCII uppercase letters to lowercase within a string.
+
+ The characters with values between 65 and 90 (ASCII A--Z) are replaced
+ with values between 97 and 122 (ASCII a--z). The string must be
+ null-terminated.
+
+ @param str
+ a null-terminated string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_ustr_toAsciiLowerCase(
+ sal_Unicode * str ) SAL_THROW_EXTERN_C();
+
+/** Convert all ASCII uppercase letters to lowercase within a string.
+
+ The characters with values between 65 and 90 (ASCII A--Z) are replaced
+ with values between 97 and 122 (ASCII a--z).
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_ustr_toAsciiLowerCase_WithLength(
+ sal_Unicode * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Convert all ASCII lowercase letters to uppercase within a string.
+
+ The characters with values between 97 and 122 (ASCII a--z) are replaced
+ with values between 65 and 90 (ASCII A--Z). The string must be
+ null-terminated.
+
+ @param str
+ a null-terminated string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_ustr_toAsciiUpperCase(
+ sal_Unicode * str ) SAL_THROW_EXTERN_C();
+
+/** Convert all ASCII lowercase letters to uppercase within a string.
+
+ The characters with values between 97 and 122 (ASCII a--z) are replaced
+ with values between 65 and 90 (ASCII A--Z).
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the length of the string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_ustr_toAsciiUpperCase_WithLength(
+ sal_Unicode * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Remove white space from both ends of a string.
+
+ All characters with values less than or equal to 32 (the space character)
+ are considered to be white space. This function cannot be used for
+ language-specific operations. The string must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ the new length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_trim(
+ sal_Unicode * str ) SAL_THROW_EXTERN_C();
+
+/** Remove white space from both ends of the string.
+
+ All characters with values less than or equal to 32 (the space character)
+ are considered to be white space. This function cannot be used for
+ language-specific operations. The string must be null-terminated.
+
+ @param str
+ a string. Need not be null-terminated, but must be at least as long as
+ the specified len.
+
+ @param len
+ the original length of the string.
+
+ @return
+ the new length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_trim_WithLength(
+ sal_Unicode * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Create the string representation of a boolean.
+
+ If b is true, the buffer is filled with the string "true" and 5 is
+ returned. If b is false, the buffer is filled with the string "false" and
+ 6 is returned. This function cannot be used for language-specific
+ operations.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_USTR_MAX_VALUEOFBOOLEAN define to
+ create a buffer that is big enough.
+
+ @param b
+ a boolean value.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfBoolean(
+ sal_Unicode * str, sal_Bool b ) SAL_THROW_EXTERN_C();
+#define RTL_USTR_MAX_VALUEOFBOOLEAN RTL_STR_MAX_VALUEOFBOOLEAN
+
+/** Create the string representation of a character.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_USTR_MAX_VALUEOFCHAR define to create a
+ buffer that is big enough.
+
+ @param ch
+ a character value.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfChar(
+ sal_Unicode * str, sal_Unicode ch ) SAL_THROW_EXTERN_C();
+#define RTL_USTR_MAX_VALUEOFCHAR RTL_STR_MAX_VALUEOFCHAR
+
+/** Create the string representation of an integer.
+
+ This function cannot be used for language-specific operations.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_USTR_MAX_VALUEOFINT32 define to create
+ a buffer that is big enough.
+
+ @param i
+ an integer value.
+
+ @param radix
+ the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfInt32(
+ sal_Unicode * str, sal_Int32 i, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+#define RTL_USTR_MIN_RADIX RTL_STR_MIN_RADIX
+#define RTL_USTR_MAX_RADIX RTL_STR_MAX_RADIX
+#define RTL_USTR_MAX_VALUEOFINT32 RTL_STR_MAX_VALUEOFINT32
+
+/** Create the string representation of a long integer.
+
+ This function cannot be used for language-specific operations.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_USTR_MAX_VALUEOFINT64 define to create
+ a buffer that is big enough.
+
+ @param l
+ a long integer value.
+
+ @param radix
+ the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfInt64(
+ sal_Unicode * str, sal_Int64 l, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+#define RTL_USTR_MAX_VALUEOFINT64 RTL_STR_MAX_VALUEOFINT64
+
+/** Create the string representation of an unsigned long integer.
+
+ This function cannot be used for language-specific operations.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_USTR_MAX_VALUEOFUINT64 define to create
+ a buffer that is big enough.
+
+ @param l
+ a long integer value.
+
+ @param radix
+ the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfUInt64(
+ sal_Unicode * str, sal_uInt64 l, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+#define RTL_USTR_MAX_VALUEOFUINT64 RTL_STR_MAX_VALUEOFUINT64
+
+/** Create the string representation of a float.
+
+ This function cannot be used for language-specific conversion.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_USTR_MAX_VALUEOFFLOAT define to create
+ a buffer that is big enough.
+
+ @param f
+ a float value.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfFloat(
+ sal_Unicode * str, float f ) SAL_THROW_EXTERN_C();
+#define RTL_USTR_MAX_VALUEOFFLOAT RTL_STR_MAX_VALUEOFFLOAT
+
+/** Create the string representation of a double.
+
+ This function cannot be used for language-specific conversion.
+
+ @param str
+ a buffer that is big enough to hold the result and the terminating NUL
+ character. You should use the RTL_USTR_MAX_VALUEOFDOUBLE define to create
+ a buffer that is big enough.
+
+ @param d
+ a double value.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfDouble(
+ sal_Unicode * str, double d ) SAL_THROW_EXTERN_C();
+#define RTL_USTR_MAX_VALUEOFDOUBLE RTL_STR_MAX_VALUEOFDOUBLE
+
+/** Interpret a string as a boolean.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ true if the string is "1" or "true" in any ASCII case, false otherwise.
+ */
+SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_ustr_toBoolean(
+ const sal_Unicode * str ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as an integer.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param radix
+ the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the integer value represented by the string, or 0 if the string does not
+ represent an integer.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_toInt32(
+ const sal_Unicode * str, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as an unsigned integer.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param radix
+ the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the unsigned integer value represented by the string, or 0 if the string
+ does not represent an unsigned integer.
+
+ @since LibreOffice 4.2
+ */
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL rtl_ustr_toUInt32(
+ const sal_Unicode * str, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as a long integer.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param radix
+ the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the long integer value represented by the string, or 0 if the string does
+ not represent a long integer.
+ */
+SAL_DLLPUBLIC sal_Int64 SAL_CALL rtl_ustr_toInt64(
+ const sal_Unicode * str, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as a long integer.
+
+ This function cannot be used for language-specific conversion.
+
+ @param str
+ a string.
+
+ @param radix
+ the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
+ (36), inclusive.
+
+ @param nStrLength
+ number of chars to process
+
+ @return
+ the long integer value represented by the string, or 0 if the string does
+ not represent a long integer.
+
+ @internal
+ @since LibreOffice 6.4
+*/
+SAL_DLLPUBLIC sal_Int64 SAL_CALL rtl_ustr_toInt64_WithLength(
+ const sal_Unicode * str, sal_Int16 radix, sal_Int32 nStrLength ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as an unsigned long integer.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @param radix
+ the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
+ (36), inclusive.
+
+ @return
+ the unsigned long integer value represented by the string, or 0 if the
+ string does not represent an unsigned long integer.
+
+ @since LibreOffice 4.1
+ */
+SAL_DLLPUBLIC sal_uInt64 SAL_CALL rtl_ustr_toUInt64(
+ const sal_Unicode * str, sal_Int16 radix ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as a float.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ the float value represented by the string, or 0.0 if the string does not
+ represent a float.
+ */
+SAL_DLLPUBLIC float SAL_CALL rtl_ustr_toFloat(
+ const sal_Unicode * str ) SAL_THROW_EXTERN_C();
+
+/** Interpret a string as a double.
+
+ This function cannot be used for language-specific conversion. The string
+ must be null-terminated.
+
+ @param str
+ a null-terminated string.
+
+ @return
+ the float value represented by the string, or 0.0 if the string does not
+ represent a double.
+ */
+SAL_DLLPUBLIC double SAL_CALL rtl_ustr_toDouble(
+ const sal_Unicode * str ) SAL_THROW_EXTERN_C();
+
+/* ======================================================================= */
+
+#if defined(_WIN32)
+#pragma pack(push, 4)
+#endif
+
+/** @cond INTERNAL */
+/** The implementation of a Unicode string.
+*/
+typedef struct SAL_DLLPUBLIC_RTTI _rtl_uString
+{
+ oslInterlockedCount refCount; /* opaque */
+ sal_Int32 length;
+ sal_Unicode buffer[1];
+} rtl_uString;
+/** @endcond */
+
+#if defined(_WIN32)
+#pragma pack(pop)
+#endif
+
+/* ----------------------------------------------------------------------- */
+
+/** Increment the reference count of a string.
+
+ @param str
+ a string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_acquire(
+ rtl_uString * str ) SAL_THROW_EXTERN_C() SAL_HOT;
+
+/** Decrement the reference count of a string.
+
+ If the count goes to zero than the string data is deleted.
+
+ @param str
+ a string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_release(
+ rtl_uString * str ) SAL_THROW_EXTERN_C() SAL_HOT;
+
+/** Allocate a new string containing no characters.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_new(
+ rtl_uString ** newStr ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string containing space for a given number of characters.
+
+ The reference count of the new string will be 1. The length of the string
+ will be nLen. This function does not handle out-of-memory conditions.
+
+ For failed allocation this method returns NULL.
+
+ The characters of the capacity are not cleared, and the length is set to
+ nLen, unlike the similar method of rtl_uString_new_WithLength which
+ zeros out the buffer, and sets the length to 0. So should be somewhat
+ more efficient for allocating a new string.
+
+ call rtl_uString_release to release the string
+ alternatively pass ownership to an OUString with
+ rtl::OUString(newStr, SAL_NO_ACQUIRE);
+
+ @param[in] nLen the number of characters. Must be >= 0.
+
+ @return pointer to the new string.
+
+ @since LibreOffice 4.1
+ */
+SAL_DLLPUBLIC rtl_uString * SAL_CALL rtl_uString_alloc(sal_Int32 nLen) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string containing space for a given number of characters.
+
+ If len is greater than zero, the reference count of the new string will be
+ 1. The values of all characters are set to 0 and the length of the string
+ is 0. This function does not handle out-of-memory conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param nLen
+ the number of characters.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_new_WithLength(
+ rtl_uString ** newStr, sal_Int32 nLen ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string that contains a copy of another string.
+
+ If the length of value is greater than zero, the reference count of the
+ new string will be 1. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param value
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromString(
+ rtl_uString ** newStr, const rtl_uString * value ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string that contains a copy of a character array.
+
+ If the length of value is greater than zero, the reference count of the
+ new string will be 1. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param value
+ a null-terminated character array.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromStr(
+ rtl_uString ** newStr, const sal_Unicode * value ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string that contains a copy of a character array.
+
+ If the length of value is greater than zero, the reference count of the
+ new string will be 1. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param value
+ a character array. Need not be null-terminated, but must be at least as
+ long as the specified len.
+
+ @param len
+ the length of the character array.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromStr_WithLength(
+ rtl_uString ** newStr, const sal_Unicode * value, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string that is a substring of this string.
+
+ The substring begins at the specified beginIndex and contains count
+ characters. Meaningless combinations such as negative beginIndex,
+ or beginIndex + count greater than the length of the string have
+ undefined behaviour.
+
+ @param[out] newStr the specified substring.
+ @param[in] from the String to take the substring from.
+ @param[in] beginIndex the beginning index, inclusive.
+ @param[in] count the number of characters.
+ @return the specified substring.
+
+ @since LibreOffice 4.0
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromSubString(
+ rtl_uString ** newStr, const rtl_uString * from,
+ sal_Int32 beginIndex, sal_Int32 count ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string that contains a copy of a character array.
+
+ If the length of value is greater than zero, the reference count of the
+ new string will be 1. This function does not handle out-of-memory
+ conditions.
+
+ Since this function is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range of 0 and 127, inclusive.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param value
+ a null-terminated ASCII character array.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromAscii(
+ rtl_uString ** newStr, const char * value ) SAL_THROW_EXTERN_C();
+
+/**
+ @internal
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromLiteral(
+ rtl_uString ** newStr, const char * value, sal_Int32 len,
+ sal_Int32 allocExtra ) SAL_THROW_EXTERN_C();
+
+/** Allocate a new string from an array of Unicode code points.
+
+ @param newString
+ a non-null pointer to a (possibly null) rtl_uString pointer, which (if
+ non-null) will have been passed to rtl_uString_release before the function
+ returns. Upon return, points to the newly allocated string or to null if
+ there was either an out-of-memory condition or the resulting number of
+ UTF-16 code units would have been larger than SAL_MAX_INT32. The newly
+ allocated string (if any) must ultimately be passed to rtl_uString_release.
+
+ @param codePoints
+ an array of at least codePointCount code points, which each must be in the
+ range from 0 to 0x10FFFF, inclusive. May be null if codePointCount is zero.
+
+ @param codePointCount
+ the non-negative number of code points.
+
+ @since UDK 3.2.7
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromCodePoints(
+ rtl_uString ** newString, sal_uInt32 const * codePoints,
+ sal_Int32 codePointCount) SAL_THROW_EXTERN_C();
+
+/** Assign a new value to a string.
+
+ First releases any value str might currently hold, then acquires
+ rightValue.
+
+ @param str
+ pointer to the string. The pointed-to data must be null or a valid
+ string.
+
+ @param rightValue
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_assign(
+ rtl_uString ** str, rtl_uString * rightValue ) SAL_THROW_EXTERN_C();
+
+/** Return the length of a string.
+
+ The length is equal to the number of characters in the string.
+
+ @param str
+ a valid string.
+
+ @return
+ the length of the string.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_uString_getLength(
+ const rtl_uString * str ) SAL_THROW_EXTERN_C();
+
+/** Return a pointer to the underlying character array of a string.
+
+ @param str
+ a valid string.
+
+ @return
+ a pointer to the null-terminated character array.
+ */
+SAL_DLLPUBLIC sal_Unicode * SAL_CALL rtl_uString_getStr(
+ rtl_uString * str ) SAL_THROW_EXTERN_C();
+
+/** Create a new string that is the concatenation of two other strings.
+
+ The new string does not necessarily have a reference count of 1 (in cases
+ where one of the two other strings is empty), so it must not be modified
+ without checking the reference count. This function does not handle
+ out-of-memory conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param left
+ a valid string.
+
+ @param right
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newConcat(
+ rtl_uString ** newStr, rtl_uString * left, rtl_uString * right ) SAL_THROW_EXTERN_C();
+
+/** Create a new string that is the concatenation of two other strings.
+
+ The new string does not necessarily have a reference count of 1 (in cases
+ where the ASCII string is empty), so it must not be modified without
+ checking the reference count.
+
+ @param newString
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param left
+ a valid string.
+
+ @param right must not be null and must point to memory of at least
+ \p rightLength ASCII bytes
+
+ @param rightLength the length of the \p right string; must be non-negative
+
+ @since LibreOffice 5.1
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newConcatAsciiL(
+ rtl_uString ** newString, rtl_uString * left, char const * right,
+ sal_Int32 rightLength);
+
+/** Create a new string that is the concatenation of two other strings.
+
+ The new string does not necessarily have a reference count of 1 (in cases
+ where the UTF-16 string is empty), so it must not be modified without
+ checking the reference count.
+
+ @param newString pointer to the new string. The pointed-to data must be null
+ or a valid string.
+
+ @param left a valid string.
+
+ @param right must point to memory of at least \p rightLength UTF-16 code units; may be null if
+ \p rigthLength is zero
+
+ @param rightLength the length of the \p right string; must be non-negative
+
+ @since LibreOffice 5.3
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newConcatUtf16L(
+ rtl_uString ** newString, rtl_uString * left, sal_Unicode const * right,
+ sal_Int32 rightLength);
+
+/** Create a new string by replacing a substring of another string.
+
+ The new string results from replacing a number of characters (count),
+ starting at the specified position (index) in the original string (str),
+ with some new substring (subStr). If subStr is null, then only a number
+ of characters is deleted.
+
+ The new string does not necessarily have a reference count of 1, so it
+ must not be modified without checking the reference count. This function
+ does not handle out-of-memory conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a valid string.
+
+ @param idx
+ the index into str at which to start replacement. Must be between 0 and
+ the length of str, inclusive.
+
+ @param count
+ the number of characters to remove. Must not be negative, and the sum of
+ index and count must not exceed the length of str.
+
+ @param subStr
+ either null or a valid string to be inserted.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceStrAt(
+ rtl_uString ** newStr, rtl_uString * str, sal_Int32 idx, sal_Int32 count, rtl_uString * subStr ) SAL_THROW_EXTERN_C();
+
+#ifdef LIBO_INTERNAL_ONLY
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceStrAtUtf16L(
+ rtl_uString ** newStr, rtl_uString * str, sal_Int32 idx, sal_Int32 count, sal_Unicode const * subStr, sal_Int32 substrLen ) SAL_THROW_EXTERN_C();
+#endif
+
+/** Create a new string by replacing all occurrences of a single character
+ within another string.
+
+ The new string results from replacing all occurrences of oldChar in str
+ with newChar.
+
+ The new string does not necessarily have a reference count of 1 (in cases
+ where oldChar does not occur in str), so it must not be modified without
+ checking the reference count. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a valid string.
+
+ @param oldChar
+ the old character.
+
+ @param newChar
+ the new character.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplace(
+ rtl_uString ** newStr, rtl_uString * str, sal_Unicode oldChar, sal_Unicode newChar ) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing the first occurrence of a given substring
+ with another substring.
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null
+
+ @param to pointer to the replacing substring; must not be null
+
+ @param[in,out] index pointer to a start index, must not be null; upon entry
+ to the function its value is the index into the original string at which to
+ start searching for the \p from substring, the value must be non-negative
+ and not greater than the original string's length; upon exit from the
+ function its value is the index into the original string at which the
+ replacement took place or -1 if no replacement took place
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceFirst(
+ rtl_uString ** newStr, rtl_uString * str, rtl_uString const * from,
+ rtl_uString const * to, sal_Int32 * index) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing the first occurrence of a given substring
+ with another substring.
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength ASCII bytes
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the replacing substring; must not be null
+
+ @param[in,out] index pointer to a start index, must not be null; upon entry
+ to the function its value is the index into the original string at which to
+ start searching for the \p from substring, the value must be non-negative
+ and not greater than the original string's length; upon exit from the
+ function its value is the index into the original string at which the
+ replacement took place or -1 if no replacement took place
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceFirstAsciiL(
+ rtl_uString ** newStr, rtl_uString * str, char const * from,
+ sal_Int32 fromLength, rtl_uString const * to, sal_Int32 * index)
+ SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing the first occurrence of a given substring
+ with another substring.
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null
+
+ @param to pointer to the replacing substring; must not be null and must
+ point to memory of at least \p toLength ASCII bytes
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @param[in,out] index pointer to a start index, must not be null; upon entry
+ to the function its value is the index into the original string at which to
+ start searching for the \p from substring, the value must be non-negative
+ and not greater than the original string's length; upon exit from the
+ function its value is the index into the original string at which the
+ replacement took place or -1 if no replacement took place
+
+ @since LibreOffice 5.1
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceFirstToAsciiL(
+ rtl_uString ** newStr, rtl_uString * str, rtl_uString const * from,
+ char const * to, sal_Int32 toLength, sal_Int32 * index)
+ SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing the first occurrence of a given substring
+ with another substring.
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength ASCII bytes
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p toLength ASCII bytes
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @param[in,out] index pointer to a start index, must not be null; upon entry
+ to the function its value is the index into the original string at which to
+ start searching for the \p from substring, the value must be non-negative
+ and not greater than the original string's length; upon exit from the
+ function its value is the index into the original string at which the
+ replacement took place or -1 if no replacement took place
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceFirstAsciiLAsciiL(
+ rtl_uString ** newStr, rtl_uString * str, char const * from,
+ sal_Int32 fromLength, char const * to, sal_Int32 toLength,
+ sal_Int32 * index) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing the first occurrence of a given substring
+ with another substring.
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString; upon return, points to the newly
+ allocated string or to null if there was either an out-of-memory condition
+ or the resulting number of UTF-16 code units would have been larger than
+ SAL_MAX_INT32
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength ASCII bytes
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p toLength UTF-16 code units
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @param[in,out] index pointer to a start index, must not be null; upon entry
+ to the function its value is the index into the original string at which to
+ start searching for the \p from substring, the value must be non-negative
+ and not greater than the original string's length; upon exit from the
+ function its value is the index into the original string at which the
+ replacement took place (or would have taken place if \p newStr points to
+ null upon return) or -1 if no replacement took place
+
+ @since LibreOffice 5.3
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceFirstAsciiLUtf16L(
+ rtl_uString ** newStr, rtl_uString * str, char const * from,
+ sal_Int32 fromLength, sal_Unicode const * to, sal_Int32 toLength,
+ sal_Int32 * index) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing the first occurrence of a given substring
+ with another substring.
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString; upon return, points to the newly
+ allocated string or to null if there was either an out-of-memory condition
+ or the resulting number of UTF-16 code units would have been larger than
+ SAL_MAX_INT32
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength UTF-16 code units
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p toLength ASCII bytes
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @param[in,out] index pointer to a start index, must not be null; upon entry
+ to the function its value is the index into the original string at which to
+ start searching for the \p from substring, the value must be non-negative
+ and not greater than the original string's length; upon exit from the
+ function its value is the index into the original string at which the
+ replacement took place (or would have taken place if \p newStr points to
+ null upon return) or -1 if no replacement took place
+
+ @since LibreOffice 5.3
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceFirstUtf16LAsciiL(
+ rtl_uString ** newStr, rtl_uString * str, sal_Unicode const * from,
+ sal_Int32 fromLength, char const * to, sal_Int32 toLength,
+ sal_Int32 * index) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing the first occurrence of a given substring
+ with another substring.
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString; upon return, points to the newly
+ allocated string or to null if there was either an out-of-memory condition
+ or the resulting number of UTF-16 code units would have been larger than
+ SAL_MAX_INT32
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must point to memory of at least
+ \p fromLength UTF-16 code units; may be null if \p toLength is zero
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the substring to be replaced; must point to memory of at least \p toLength
+ UTF-16 code units; may be null if \p toLength is zero
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @param[in,out] index pointer to a start index, must not be null; upon entry
+ to the function its value is the index into the original string at which to
+ start searching for the \p from substring, the value must be non-negative
+ and not greater than the original string's length; upon exit from the
+ function its value is the index into the original string at which the
+ replacement took place (or would have taken place if \p newStr points to
+ null upon return) or -1 if no replacement took place
+
+ @since LibreOffice 5.3
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceFirstUtf16LUtf16L(
+ rtl_uString ** newStr, rtl_uString * str, sal_Unicode const * from,
+ sal_Int32 fromLength, sal_Unicode const * to, sal_Int32 toLength,
+ sal_Int32 * index) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing all occurrences of a given substring with
+ another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null
+
+ @param to pointer to the replacing substring; must not be null
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceAll(
+ rtl_uString ** newStr, rtl_uString * str, rtl_uString const * from,
+ rtl_uString const * to) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing all occurrences of a given substring with
+ another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null
+
+ @param to pointer to the replacing substring; must not be null
+
+ @param fromIndex the position in the string where we will begin searching
+
+ @since LibreOffice 4.0
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceAllFromIndex(
+ rtl_uString ** newStr, rtl_uString * str, rtl_uString const * from,
+ rtl_uString const * to, sal_Int32 fromIndex) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing all occurrences of a given substring with
+ another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength ASCII bytes
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the replacing substring; must not be null
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceAllAsciiL(
+ rtl_uString ** newStr, rtl_uString * str, char const * from,
+ sal_Int32 fromLength, rtl_uString const * to) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing all occurrences of a given substring with
+ another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null
+
+ @param to pointer to the replacing substring; must not be null and must
+ point to memory of at least \p toLength ASCII bytes
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @since LibreOffice 5.1
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceAllToAsciiL(
+ rtl_uString ** newStr, rtl_uString * str, rtl_uString const * from,
+ char const * to, sal_Int32 toLength) SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing all occurrences of a given substring with
+ another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength ASCII bytes
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p toLength ASCII bytes
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceAllAsciiLAsciiL(
+ rtl_uString ** newStr, rtl_uString * str, char const * from,
+ sal_Int32 fromLength, char const * to, sal_Int32 toLength)
+ SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing all occurrences of a given substring with
+ another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString; upon return, points to the newly
+ allocated string or to null if there was either an out-of-memory condition
+ or the resulting number of UTF-16 code units would have been larger than
+ SAL_MAX_INT32
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength ASCII bytes
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the substring to be replaced; must point to memory of at least \p toLength
+ UTF-16 code units; may be null if \p toLength is zero
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceAllAsciiLUtf16L(
+ rtl_uString ** newStr, rtl_uString * str, char const * from,
+ sal_Int32 fromLength, sal_Unicode const * to, sal_Int32 toLength)
+ SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing all occurrences of a given substring with
+ another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString; upon return, points to the newly
+ allocated string or to null if there was either an out-of-memory condition
+ or the resulting number of UTF-16 code units would have been larger than
+ SAL_MAX_INT32
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength UTF-16 code units
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p toLength ASCII bytes
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceAllUtf16LAsciiL(
+ rtl_uString ** newStr, rtl_uString * str, sal_Unicode const * from,
+ sal_Int32 fromLength, char const * to, sal_Int32 toLength)
+ SAL_THROW_EXTERN_C();
+
+/** Create a new string by replacing all occurrences of a given substring with
+ another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString; upon return, points to the newly
+ allocated string or to null if there was either an out-of-memory condition
+ or the resulting number of UTF-16 code units would have been larger than
+ SAL_MAX_INT32
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength UTF-16 code units
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p toLength UTF-16 code units
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @since LibreOffice 3.6
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceAllUtf16LUtf16L(
+ rtl_uString ** newStr, rtl_uString * str, sal_Unicode const * from,
+ sal_Int32 fromLength, sal_Unicode const * to, sal_Int32 toLength)
+ SAL_THROW_EXTERN_C();
+
+#if defined LIBO_INTERNAL_ONLY
+/** Create a new string by replacing all occurrences of a given substring with
+ another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param[in, out] newStr pointer to the new string; must not be null; must
+ point to null or a valid rtl_uString; upon return, points to the newly
+ allocated string or to null if there was either an out-of-memory condition
+ or the resulting number of UTF-16 code units would have been larger than
+ SAL_MAX_INT32
+
+ @param str pointer to the original string; must not be null
+
+ @param from pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p fromLength UTF-16 code units
+
+ @param fromLength the length of the \p from substring; must be non-negative
+
+ @param to pointer to the substring to be replaced; must not be null and
+ must point to memory of at least \p toLength UTF-16 code units
+
+ @param toLength the length of the \p to substring; must be non-negative
+
+ @param fromIndex the position in the string where we will begin searching
+
+ @since LibreOffice 7.1
+*/
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceAllFromIndexUtf16LUtf16L(
+ rtl_uString ** newStr, rtl_uString * str, sal_Unicode const * from,
+ sal_Int32 fromLength, sal_Unicode const * to, sal_Int32 toLength, sal_Int32 fromIndex)
+ SAL_THROW_EXTERN_C();
+#endif
+
+/** Create a new string by converting all ASCII uppercase letters to lowercase
+ within another string.
+
+ The new string results from replacing all characters with values between
+ 65 and 90 (ASCII A--Z) by values between 97 and 122 (ASCII a--z).
+
+ This function cannot be used for language-specific conversion. The new
+ string does not necessarily have a reference count of 1 (in cases where
+ no characters need to be converted), so it must not be modified without
+ checking the reference count. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newToAsciiLowerCase(
+ rtl_uString ** newStr, rtl_uString * str ) SAL_THROW_EXTERN_C();
+
+/** Create a new string by converting all ASCII lowercase letters to uppercase
+ within another string.
+
+ The new string results from replacing all characters with values between
+ 97 and 122 (ASCII a--z) by values between 65 and 90 (ASCII A--Z).
+
+ This function cannot be used for language-specific conversion. The new
+ string does not necessarily have a reference count of 1 (in cases where
+ no characters need to be converted), so it must not be modified without
+ checking the reference count. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newToAsciiUpperCase(
+ rtl_uString ** newStr, rtl_uString * str ) SAL_THROW_EXTERN_C();
+
+/** Create a new string by removing white space from both ends of another
+ string.
+
+ The new string results from removing all characters with values less than
+ or equal to 32 (the space character), and also Unicode General Punctuation
+ area Space and some Control characters, form both ends of str (see
+ implIsWhitespace).
+
+ This function cannot be used for language-specific conversion. The new
+ string does not necessarily have a reference count of 1 (in cases where
+ no characters need to be removed), so it must not be modified without
+ checking the reference count. This function does not handle out-of-memory
+ conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a valid string.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newTrim(
+ rtl_uString ** newStr, rtl_uString * str ) SAL_THROW_EXTERN_C();
+
+/** Create a new string by extracting a single token from another string.
+
+ Starting at index, the token's next token is searched for. If there is no
+ such token, the result is an empty string. Otherwise, all characters from
+ the start of that token and up to, but not including the next occurrence
+ of cTok make up the resulting token. The return value is the position of
+ the next token, or -1 if no more tokens follow.
+
+ Example code could look like
+ rtl_uString * pToken = NULL;
+ sal_Int32 nIndex = 0;
+ do
+ {
+ ...
+ nIndex = rtl_uString_getToken(&pToken, pStr, 0, ';', nIndex);
+ ...
+ }
+ while (nIndex >= 0);
+
+ The new string does not necessarily have a reference count of 1, so it
+ must not be modified without checking the reference count. This function
+ does not handle out-of-memory conditions.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string. If either token or index is negative, an empty token is stored in
+ newStr (and -1 is returned).
+
+ @param str
+ a valid string.
+
+ @param token
+ the number of the token to return, starting at index.
+
+ @param cTok
+ the character that separates the tokens.
+
+ @param idx
+ the position at which searching for the token starts. Must not be greater
+ than the length of str.
+
+ @return
+ the index of the next token, or -1 if no more tokens follow.
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_uString_getToken(
+ rtl_uString ** newStr , rtl_uString * str, sal_Int32 token, sal_Unicode cTok, sal_Int32 idx ) SAL_THROW_EXTERN_C();
+
+/* ======================================================================= */
+
+/** Supply an ASCII string literal together with its length and text encoding.
+
+ This macro can be used to compute (some of) the arguments in function calls
+ like rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foo")).
+
+ @param constAsciiStr
+ must be an expression of type "(possibly cv-qualified reference to) array of
+ (possibly cv-qualified) char." Each element of the referenced array must
+ represent an ASCII value in the range 0x00--0x7F. The last element of the
+ referenced array is not considered part of the represented ASCII string, and
+ its value should be 0x00. Depending on where this macro is used, the nature
+ of the supplied expression might be further restricted.
+*/
+// The &foo[0] trick is intentional, it makes sure the type is char* or const char*
+// (plain cast to const char* would not work with non-const char foo[]="a", which seems to be allowed).
+// This is to avoid mistaken use with functions that accept string literals
+// (i.e. const char (&)[N]) where usage of this macro otherwise could match
+// the argument and a following int argument with a default value (e.g. OUString::match()).
+#define RTL_CONSTASCII_USTRINGPARAM( constAsciiStr ) (&(constAsciiStr)[0]), \
+ ((sal_Int32)(SAL_N_ELEMENTS(constAsciiStr)-1)), RTL_TEXTENCODING_ASCII_US
+
+/* ======================================================================= */
+
+/* predefined constants for String-Conversion */
+#define OSTRING_TO_OUSTRING_CVTFLAGS (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE |\
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |\
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT)
+
+/* ----------------------------------------------------------------------- */
+
+/** Create a new Unicode string by converting a byte string, using a specific
+ text encoding.
+
+ The lengths of the byte string and the Unicode string may differ (e.g.,
+ for double-byte encodings, UTF-7, UTF-8).
+
+ If the length of the byte string is greater than zero, the reference count
+ of the new string will be 1.
+
+ If an out-of-memory condition occurs, newStr will point to a null pointer
+ upon return.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ @param str
+ a byte character array. Need not be null-terminated, but must be at
+ least as long as the specified len.
+
+ @param len
+ the length of the byte character array.
+
+ @param encoding
+ the text encoding to use for conversion.
+
+ @param convertFlags
+ flags which control the conversion. Either use
+ OSTRING_TO_OUSTRING_CVTFLAGS, or see
+ <http://udk.openoffice.org/cpp/man/spec/textconversion.html> for more
+ details.
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_string2UString(
+ rtl_uString ** newStr, const char * str, sal_Int32 len, rtl_TextEncoding encoding, sal_uInt32 convertFlags ) SAL_THROW_EXTERN_C();
+
+/* ======================================================================= */
+/* Interning methods */
+
+/** Return a canonical representation for a string.
+
+ A pool of strings, initially empty is maintained privately
+ by the string class. On invocation, if present in the pool
+ the original string will be returned. Otherwise this string,
+ or a copy thereof will be added to the pool and returned.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ If an out-of-memory condition occurs, newStr will point to a null pointer
+ upon return.
+
+ @param str
+ pointer to the string to be interned.
+
+ @since UDK 3.2.7
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_intern(
+ rtl_uString ** newStr, rtl_uString * str) SAL_THROW_EXTERN_C();
+
+/** Return a canonical representation for a string.
+
+ A pool of strings, initially empty is maintained privately
+ by the string class. On invocation, if present in the pool
+ the original string will be returned. Otherwise this string,
+ or a copy thereof will be added to the pool and returned.
+
+ @param newStr
+ pointer to the new string. The pointed-to data must be null or a valid
+ string.
+
+ If an out-of-memory condition occurs, newStr will point to a null pointer
+ upon return.
+
+ @param str
+ a byte character array. Need not be null-terminated, but must be at
+ least as long as the specified len.
+
+ @param len
+ the length of the byte character array.
+
+ @param encoding
+ the text encoding to use for conversion.
+
+ @param convertFlags
+ flags which control the conversion. Either use
+ OSTRING_TO_OUSTRING_CVTFLAGS, or see
+ <http://udk.openoffice.org/cpp/man/spec/textconversion.html> for more
+ details.
+
+ @param pInfo
+ pointer to return conversion status in, or NULL.
+
+ @since UDK 3.2.7
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_internConvert(
+ rtl_uString ** newStr,
+ const char * str,
+ sal_Int32 len,
+ rtl_TextEncoding encoding,
+ sal_uInt32 convertFlags,
+ sal_uInt32 *pInfo) SAL_THROW_EXTERN_C();
+
+/** Iterate through a string based on code points instead of UTF-16 code units.
+
+ See Chapter 3 of The Unicode Standard 5.0 (Addison--Wesley, 2006) for
+ definitions of the various terms used in this description.
+
+ The given string is interpreted as a sequence of zero or more UTF-16 code
+ units. For each index into this sequence (from zero to one less than the
+ length of the sequence, inclusive), a code point represented starting at the
+ given index is computed as follows:
+
+ - If the UTF-16 code unit addressed by the index constitutes a well-formed
+ UTF-16 code unit sequence, the computed code point is the scalar value
+ encoded by that UTF-16 code unit sequence.
+
+ - Otherwise, if the index is at least two UTF-16 code units away from the
+ end of the sequence, and the sequence of two UTF-16 code units addressed by
+ the index constitutes a well-formed UTF-16 code unit sequence, the computed
+ code point is the scalar value encoded by that UTF-16 code unit sequence.
+
+ - Otherwise, the computed code point is the UTF-16 code unit addressed by
+ the index. (This last case catches unmatched surrogates as well as indices
+ pointing into the middle of surrogate pairs.)
+
+ @param string
+ pointer to a valid string; must not be null.
+
+ @param indexUtf16
+ pointer to a UTF-16 based index into the given string; must not be null. On
+ entry, the index must be in the range from zero to the length of the string
+ (in UTF-16 code units), inclusive. Upon successful return, the index will
+ be updated to address the UTF-16 code unit that is the given
+ incrementCodePoints away from the initial index.
+
+ @param incrementCodePoints
+ the number of code points to move the given *indexUtf16. If non-negative,
+ moving is done after determining the code point at the index. If negative,
+ moving is done before determining the code point at the (then updated)
+ index. The value must be such that the resulting UTF-16 based index is in
+ the range from zero to the length of the string (in UTF-16 code units),
+ inclusive.
+
+ @return
+ the code point (an integer in the range from 0 to 0x10FFFF, inclusive) that
+ is represented within the string starting at the index computed as follows:
+ If incrementCodePoints is non-negative, the index is the initial value of
+ *indexUtf16; if incrementCodePoints is negative, the index is the updated
+ value of *indexUtf16. In either case, the computed index must be in the
+ range from zero to one less than the length of the string (in UTF-16 code
+ units), inclusive.
+
+ @since UDK 3.2.7
+*/
+SAL_DLLPUBLIC sal_uInt32 SAL_CALL rtl_uString_iterateCodePoints(
+ rtl_uString const * string, sal_Int32 * indexUtf16,
+ sal_Int32 incrementCodePoints);
+
+/** Converts a byte string to a Unicode string, signalling failure.
+
+ @param target
+ An out parameter receiving the converted string. Must not be null itself,
+ and must contain either null or a pointer to a valid rtl_uString; the
+ contents are unspecified if conversion fails (rtl_convertStringToUString
+ returns false).
+
+ @param source
+ The byte string. May only be null if length is zero.
+
+ @param length
+ The length of the byte string. Must be non-negative.
+
+ @param encoding
+ The text encoding to convert from. Must be an octet encoding (i.e.,
+ rtl_isOctetTextEncoding(encoding) must return true).
+
+ @param flags
+ A combination of RTL_TEXTTOUNICODE_FLAGS that detail how to do the
+ conversion (see rtl_convertTextToUnicode). RTL_TEXTTOUNICODE_FLAGS_FLUSH
+ need not be included, it is implicitly assumed. Typical uses are either
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR (fail if a byte or multi-byte sequence
+ cannot be converted from the source encoding) or
+ OSTRING_TO_OUSTRING_CVTFLAGS (make a best efforts conversion).
+
+ @return
+ True if the conversion succeeded, false otherwise.
+
+ @since UDK 3.2.9
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_convertStringToUString(
+ rtl_uString ** target, char const * source, sal_Int32 length,
+ rtl_TextEncoding encoding, sal_uInt32 flags) SAL_THROW_EXTERN_C();
+
+/** Ensure a string has enough space for a given number of characters.
+
+ If the given string is large enough and has refcount of 1, it is not altered in any way.
+ Otherwise it is replaced by a copy that has enough space for the given number of characters,
+ data from the source string is copied to the beginning of it, the content of the remaining
+ capacity undefined, the string has refcount of 1, and refcount of the original string is decreased.
+
+ @param str
+ pointer to the string. The pointed-to data must be a valid string.
+
+ @param size
+ the number of characters
+
+ @since LibreOffice 4.1
+ @internal
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_ensureCapacity( rtl_uString ** str, sal_Int32 size ) SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_RTL_USTRING_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
new file mode 100644
index 000000000..e6d3ed682
--- /dev/null
+++ b/include/rtl/ustring.hxx
@@ -0,0 +1,3560 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_RTL_USTRING_HXX
+#define INCLUDED_RTL_USTRING_HXX
+
+#include "sal/config.h"
+
+#include <cassert>
+#include <cstddef>
+#include <cstdlib>
+#include <limits>
+#include <new>
+#include <ostream>
+#include <utility>
+
+#if defined LIBO_INTERNAL_ONLY
+#include <string_view>
+#include <type_traits>
+#endif
+
+#include "rtl/ustring.h"
+#include "rtl/string.hxx"
+#include "rtl/stringutils.hxx"
+#include "rtl/textenc.h"
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+#include "config_global.h"
+#include "rtl/stringconcat.hxx"
+#endif
+
+#ifdef RTL_STRING_UNITTEST
+extern bool rtl_string_unittest_invalid_conversion;
+#endif
+
+// The unittest uses slightly different code to help check that the proper
+// calls are made. The class is put into a different namespace to make
+// sure the compiler generates a different (if generating also non-inline)
+// copy of the function and does not merge them together. The class
+// is "brought" into the proper rtl namespace by a typedef below.
+#ifdef RTL_STRING_UNITTEST
+#define rtl rtlunittest
+#endif
+
+namespace rtl
+{
+
+class OUStringBuffer;
+
+#ifdef RTL_STRING_UNITTEST
+#undef rtl
+#endif
+
+#if defined LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+/// @cond INTERNAL
+
+/**
+A wrapper dressing a string literal as a static-refcount rtl_uString.
+
+This class is not part of public API and is meant to be used only in LibreOffice code.
+@since LibreOffice 4.0
+*/
+template<std::size_t N> class SAL_WARN_UNUSED OUStringLiteral {
+ static_assert(N != 0);
+ static_assert(N - 1 <= std::numeric_limits<sal_Int32>::max(), "literal too long");
+ friend class OUString;
+ friend class OUStringConstExpr;
+
+public:
+#if HAVE_CPP_CONSTEVAL
+ consteval
+#else
+ constexpr
+#endif
+ OUStringLiteral(char16_t const (&literal)[N]) {
+ assertLayout();
+ assert(literal[N - 1] == '\0');
+ //TODO: Use C++20 constexpr std::copy_n (P0202R3):
+ for (std::size_t i = 0; i != N; ++i) {
+ more.buffer[i] = literal[i];
+ }
+ }
+
+ constexpr sal_Int32 getLength() const { return more.length; }
+
+ constexpr sal_Unicode const * getStr() const SAL_RETURNS_NONNULL { return more.buffer; }
+
+ constexpr operator std::u16string_view() const { return {more.buffer, sal_uInt32(more.length)}; }
+
+private:
+ static constexpr void assertLayout() {
+ // These static_asserts verifying the layout compatibility with rtl_uString cannot be class
+ // member declarations, as offsetof requires a complete type, so defer them to here:
+ static_assert(std::is_standard_layout_v<OUStringLiteral>);
+ static_assert(offsetof(OUStringLiteral, str.refCount) == offsetof(OUStringLiteral, more.refCount));
+ static_assert(offsetof(OUStringLiteral, str.length) == offsetof(OUStringLiteral, more.length));
+ static_assert(offsetof(OUStringLiteral, str.buffer) == offsetof(OUStringLiteral, more.buffer));
+ }
+
+ struct Data {
+ Data() = default;
+
+ oslInterlockedCount refCount = 0x40000000; // SAL_STRING_STATIC_FLAG (sal/rtl/strimp.hxx)
+ sal_Int32 length = N - 1;
+ sal_Unicode buffer[N] = {}; //TODO: drop initialization for C++20 (P1331R2)
+ };
+
+ union {
+ rtl_uString str;
+ Data more = {};
+ };
+};
+
+#if defined RTL_STRING_UNITTEST
+namespace libreoffice_internal {
+template<std::size_t N> struct ExceptConstCharArrayDetector<OUStringLiteral<N>> {};
+template<std::size_t N> struct ExceptCharArrayDetector<OUStringLiteral<N>> {};
+}
+#endif
+
+/**
+ This is intended to be used when declaring compile-time-constant structs or arrays
+ that can be initialised from named OUStringLiteral e.g.
+
+ constexpr OUStringLiteral AAA = u"aaa";
+ constexpr OUStringLiteral BBB = u"bbb";
+ constexpr OUStringConstExpr FOO[] { AAA, BBB };
+*/
+class OUString;
+class OUStringConstExpr
+{
+public:
+ template<std::size_t N> constexpr OUStringConstExpr(OUStringLiteral<N> const & literal):
+ pData(const_cast<rtl_uString *>(&literal.str)) {}
+
+ // prevent mis-use
+ template<std::size_t N> constexpr OUStringConstExpr(OUStringLiteral<N> && literal)
+ = delete;
+
+ // no destructor necessary because we know we are pointing at a compile-time
+ // constant OUStringLiteral, which bypasses ref-counting.
+
+ /**
+ make it easier to pass to OUStringBuffer and similar without casting/converting
+ */
+ constexpr std::u16string_view asView() const { return {pData->buffer, static_cast<sal_uInt32>(pData->length)}; }
+
+ inline operator const OUString&() const;
+
+private:
+ rtl_uString* pData;
+};
+
+/// @endcond
+#endif
+
+/* ======================================================================= */
+
+/**
+ This String class provides base functionality for C++ like Unicode
+ character array handling. The advantage of this class is that it
+ handles all the memory management for you - and it does it
+ more efficiently. If you assign a string to another string, the
+ data of both strings are shared (without any copy operation or
+ memory allocation) as long as you do not change the string. This class
+ also stores the length of the string, so that many operations are
+ faster than the C-str-functions.
+
+ This class provides only readonly string handling. So you could create
+ a string and you could only query the content from this string.
+ It provides also functionality to change the string, but this results
+ in every case in a new string instance (in the most cases with a
+ memory allocation). You don't have functionality to change the
+ content of the string. If you want to change the string content, then
+ you should use the OStringBuffer class, which provides these
+ functionalities and avoids too much memory allocation.
+
+ The design of this class is similar to the string classes in Java so
+ less people should have understanding problems when they use this class.
+*/
+
+class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI OUString
+{
+public:
+ /// @cond INTERNAL
+ rtl_uString * pData;
+ /// @endcond
+
+ /**
+ New string containing no characters.
+ */
+ OUString()
+ {
+ pData = NULL;
+ rtl_uString_new( &pData );
+ }
+
+ /**
+ New string from OUString.
+
+ @param str an OUString.
+ */
+ OUString( const OUString & str )
+ {
+ pData = str.pData;
+ rtl_uString_acquire( pData );
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /**
+ Move constructor.
+
+ @param str an OUString.
+ @since LibreOffice 5.2
+ */
+ OUString( OUString && str ) noexcept
+ {
+ pData = str.pData;
+ str.pData = nullptr;
+ rtl_uString_new( &str.pData );
+ }
+#endif
+
+ /**
+ New string from OUString data.
+
+ @param str an OUString data.
+ */
+ OUString( rtl_uString * str )
+ {
+ pData = str;
+ rtl_uString_acquire( pData );
+ }
+
+ /** New OUString from OUString data without acquiring it. Takeover of ownership.
+
+ The SAL_NO_ACQUIRE dummy parameter is only there to distinguish this
+ from other constructors.
+
+ @param str
+ OUString data
+ */
+ OUString( rtl_uString * str, __sal_NoAcquire )
+ { pData = str; }
+
+ /**
+ New string from a single Unicode character.
+
+ @param value a Unicode character.
+ */
+ explicit OUString( sal_Unicode value )
+ : pData (NULL)
+ {
+ rtl_uString_newFromStr_WithLength( &pData, &value, 1 );
+ }
+
+#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST_CONCAT
+ /// @cond INTERNAL
+ // Catch inadvertent conversions to the above ctor (but still allow
+ // construction from char literals):
+ OUString(int) = delete;
+ explicit OUString(char c):
+ OUString(sal_Unicode(static_cast<unsigned char>(c)))
+ {}
+ /// @endcond
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+
+ template<typename T> explicit OUString(
+ T const & value,
+ typename libreoffice_internal::CharPtrDetector<T, libreoffice_internal::Dummy>::TypeUtf16
+ = libreoffice_internal::Dummy()):
+ pData(nullptr)
+ { rtl_uString_newFromStr(&pData, value); }
+
+ template<typename T> explicit OUString(
+ T & value,
+ typename
+ libreoffice_internal::NonConstCharArrayDetector<T, libreoffice_internal::Dummy>::TypeUtf16
+ = libreoffice_internal::Dummy()):
+ pData(nullptr)
+ { rtl_uString_newFromStr(&pData, value); }
+
+#else
+
+ /**
+ New string from a Unicode character buffer array.
+
+ @param value a NULL-terminated Unicode character array.
+ */
+ OUString( const sal_Unicode * value )
+ {
+ pData = NULL;
+ rtl_uString_newFromStr( &pData, value );
+ }
+
+#endif
+
+ /**
+ New string from a Unicode character buffer array.
+
+ @param value a Unicode character array.
+ @param length the number of character which should be copied.
+ The character array length must be greater than
+ or equal to this value.
+ */
+ OUString( const sal_Unicode * value, sal_Int32 length )
+ {
+ pData = NULL;
+ rtl_uString_newFromStr_WithLength( &pData, value, length );
+ }
+
+ /**
+ New string from an 8-Bit string literal that is expected to contain only
+ characters in the ASCII set (i.e. first 128 characters). This constructor
+ allows an efficient and convenient way to create OUString
+ instances from ASCII literals. When creating strings from data that
+ is not pure ASCII, it needs to be converted to OUString by explicitly
+ providing the encoding to use for the conversion.
+
+ If there are any embedded \0's in the string literal, the result is undefined.
+ Use the overload that explicitly accepts length.
+
+ @param literal the 8-bit ASCII string literal
+
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ OUString( T& literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy() )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ pData = NULL;
+ if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
+ rtl_uString_new(&pData);
+ } else {
+ rtl_uString_newFromLiteral(
+ &pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
+ }
+#ifdef RTL_STRING_UNITTEST
+ rtl_string_unittest_const_literal = true;
+#endif
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T> OUString(
+ T & literal,
+ typename libreoffice_internal::ConstCharArrayDetector<
+ T, libreoffice_internal::Dummy>::TypeUtf16
+ = libreoffice_internal::Dummy()):
+ pData(nullptr)
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
+ rtl_uString_new(&pData);
+ } else {
+ rtl_uString_newFromStr_WithLength(
+ &pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+ }
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && defined RTL_STRING_UNITTEST
+ /// @cond INTERNAL
+ /**
+ * Only used by unittests to detect incorrect conversions.
+ * @internal
+ */
+ template< typename T >
+ OUString( T&, typename libreoffice_internal::ExceptConstCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
+ {
+ pData = NULL;
+ rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
+ rtl_string_unittest_invalid_conversion = true;
+ }
+ /**
+ * Only used by unittests to detect incorrect conversions.
+ * @internal
+ */
+ template< typename T >
+ OUString( const T&, typename libreoffice_internal::ExceptCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
+ {
+ pData = NULL;
+ rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
+ rtl_string_unittest_invalid_conversion = true;
+ }
+ /// @endcond
+#endif
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /// @cond INTERNAL
+ /**
+ New string from a string literal.
+
+ @since LibreOffice 5.0
+ */
+ template<std::size_t N> constexpr OUString(OUStringLiteral<N> const & literal):
+ pData(const_cast<rtl_uString *>(&literal.str)) {}
+ template<std::size_t N> OUString(OUStringLiteral<N> &&) = delete;
+ /// @endcond
+#endif
+
+ /**
+ New string from an 8-Bit character buffer array.
+
+ @param value An 8-Bit character array.
+ @param length The number of character which should be converted.
+ The 8-Bit character array length must be
+ greater than or equal to this value.
+ @param encoding The text encoding from which the 8-Bit character
+ sequence should be converted.
+ @param convertFlags Flags which control the conversion.
+ see RTL_TEXTTOUNICODE_FLAGS_...
+
+ @exception std::bad_alloc is thrown if an out-of-memory condition occurs
+ */
+ OUString( const char * value, sal_Int32 length,
+ rtl_TextEncoding encoding,
+ sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
+ {
+ pData = NULL;
+ rtl_string2UString( &pData, value, length, encoding, convertFlags );
+ if (pData == NULL) {
+ throw std::bad_alloc();
+ }
+ }
+
+ /** Create a new string from an array of Unicode code points.
+
+ @param codePoints
+ an array of at least codePointCount code points, which each must be in
+ the range from 0 to 0x10FFFF, inclusive. May be null if codePointCount
+ is zero.
+
+ @param codePointCount
+ the non-negative number of code points.
+
+ @exception std::bad_alloc
+ is thrown if either an out-of-memory condition occurs or the resulting
+ number of UTF-16 code units would have been larger than SAL_MAX_INT32.
+
+ @since UDK 3.2.7
+ */
+ explicit OUString(
+ sal_uInt32 const * codePoints, sal_Int32 codePointCount):
+ pData(NULL)
+ {
+ rtl_uString_newFromCodePoints(&pData, codePoints, codePointCount);
+ if (pData == NULL) {
+ throw std::bad_alloc();
+ }
+ }
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /**
+ @overload
+ @internal
+ */
+ template< typename T1, typename T2 >
+ OUString( OUStringConcat< T1, T2 >&& c )
+ {
+ const sal_Int32 l = c.length();
+ pData = rtl_uString_alloc( l );
+ if (l != 0)
+ {
+ sal_Unicode* end = c.addData( pData->buffer );
+ pData->length = l;
+ *end = '\0';
+ }
+ }
+
+ /**
+ @overload
+ @internal
+ */
+ template< typename T >
+ OUString( OUStringNumber< T >&& n )
+ : OUString( n.buf, n.length )
+ {}
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ explicit OUString(std::u16string_view sv) {
+ if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
+ throw std::bad_alloc();
+ }
+ pData = nullptr;
+ rtl_uString_newFromStr_WithLength(&pData, sv.data(), sv.size());
+ }
+#endif
+
+ /**
+ Release the string data.
+ */
+ ~OUString()
+ {
+ rtl_uString_release( pData );
+ }
+
+ /** Provides an OUString const & passing a storage pointer of an
+ rtl_uString * handle.
+ It is more convenient to use C++ OUString member functions when dealing
+ with rtl_uString * handles. Using this function avoids unnecessary
+ acquire()/release() calls for a temporary OUString object.
+
+ @param ppHandle
+ pointer to storage
+ @return
+ OUString const & based on given storage
+ */
+ static OUString const & unacquired( rtl_uString * const * ppHandle )
+ { return * reinterpret_cast< OUString const * >( ppHandle ); }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** Provides an OUString const & passing an OUStringBuffer const reference.
+ It is more convenient to use C++ OUString member functions when checking
+ current buffer content. Use this function instead of toString (that
+ allocates a new OUString from buffer data) when the result is used in
+ comparisons.
+
+ @param str
+ an OUStringBuffer
+ @return
+ OUString const & based on given storage
+ @since LibreOffice 7.4
+ */
+ static OUString const& unacquired(const OUStringBuffer& str);
+#endif
+
+ /**
+ Assign a new string.
+
+ @param str an OUString.
+ */
+ OUString & operator=( const OUString & str )
+ {
+ rtl_uString_assign( &pData, str.pData );
+ return *this;
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /**
+ Move assign a new string.
+
+ @param str an OUString.
+ @since LibreOffice 5.2
+ */
+ OUString & operator=( OUString && str ) noexcept
+ {
+ rtl_uString_release( pData );
+ pData = str.pData;
+ str.pData = nullptr;
+ rtl_uString_new( &str.pData );
+ return *this;
+ }
+#endif
+
+ /**
+ Assign a new string from an 8-Bit string literal that is expected to contain only
+ characters in the ASCII set (i.e. first 128 characters). This operator
+ allows an efficient and convenient way to assign OUString
+ instances from ASCII literals. When assigning strings from data that
+ is not pure ASCII, it needs to be converted to OUString by explicitly
+ providing the encoding to use for the conversion.
+
+ @param literal the 8-bit ASCII string literal
+
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, OUString& >::Type operator=( T& literal )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
+ rtl_uString_new(&pData);
+ } else {
+ rtl_uString_newFromLiteral(
+ &pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
+ }
+ return *this;
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T>
+ typename
+ libreoffice_internal::ConstCharArrayDetector<T, OUString &>::TypeUtf16
+ operator =(T & literal) {
+ if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
+ rtl_uString_new(&pData);
+ } else {
+ rtl_uString_newFromStr_WithLength(
+ &pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+ return *this;
+ }
+
+ /** @overload @since LibreOffice 5.4 */
+ template<std::size_t N> OUString & operator =(OUStringLiteral<N> const & literal) {
+ rtl_uString_release(pData);
+ pData = const_cast<rtl_uString *>(&literal.str);
+ return *this;
+ }
+ template<std::size_t N> OUString & operator =(OUStringLiteral<N> &&) = delete;
+
+ template<typename T>
+ OUString & operator =(OUStringNumber<T> && n) {
+ // n.length should never be zero, so no need to add an optimization for that case
+ rtl_uString_newFromStr_WithLength(&pData, n.buf, n.length);
+ return *this;
+ }
+
+ OUString & operator =(std::u16string_view sv) {
+ if (sv.empty()) {
+ rtl_uString_new(&pData);
+ } else {
+ rtl_uString_newFromStr_WithLength(&pData, sv.data(), sv.size());
+ }
+ return *this;
+ }
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ /**
+ Append the contents of an OUStringBuffer to this string.
+
+ @param str an OUStringBuffer.
+
+ @exception std::bad_alloc is thrown if an out-of-memory condition occurs
+ @since LibreOffice 6.2
+ */
+ inline OUString & operator+=( const OUStringBuffer & str ) &;
+#endif
+
+ /**
+ Append a string to this string.
+
+ @param str an OUString.
+
+ @exception std::bad_alloc is thrown if an out-of-memory condition occurs
+ */
+ OUString & operator+=( const OUString & str )
+#if defined LIBO_INTERNAL_ONLY
+ &
+#endif
+ {
+ return internalAppend(str.pData);
+ }
+#if defined LIBO_INTERNAL_ONLY
+ void operator+=(OUString const &) && = delete;
+#endif
+
+ /** Append an ASCII string literal to this string.
+
+ @param literal an 8-bit ASCII-only string literal
+
+ @since LibreOffice 5.1
+ */
+ template<typename T>
+ typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
+ operator +=(T & literal)
+#if defined LIBO_INTERNAL_ONLY
+ &
+#endif
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ rtl_uString_newConcatAsciiL(
+ &pData, pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ return *this;
+ }
+#if defined LIBO_INTERNAL_ONLY
+ template<typename T>
+ typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
+ operator +=(T &) && = delete;
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T>
+ typename
+ libreoffice_internal::ConstCharArrayDetector<T, OUString &>::TypeUtf16
+ operator +=(T & literal) & {
+ rtl_uString_newConcatUtf16L(
+ &pData, pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ return *this;
+ }
+ template<typename T>
+ typename
+ libreoffice_internal::ConstCharArrayDetector<T, OUString &>::TypeUtf16
+ operator +=(T &) && = delete;
+
+ /** @overload @since LibreOffice 5.4 */
+ template<std::size_t N> OUString & operator +=(OUStringLiteral<N> const & literal) & {
+ rtl_uString_newConcatUtf16L(&pData, pData, literal.getStr(), literal.getLength());
+ return *this;
+ }
+ template<std::size_t N> void operator +=(OUStringLiteral<N> const &) && = delete;
+
+ OUString & operator +=(std::u16string_view sv) & {
+ if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
+ throw std::bad_alloc();
+ }
+ rtl_uString_newConcatUtf16L(&pData, pData, sv.data(), sv.size());
+ return *this;
+ }
+ void operator +=(std::u16string_view) && = delete;
+#endif
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /**
+ @overload
+ @internal
+ */
+ template< typename T1, typename T2 >
+ OUString& operator+=( OUStringConcat< T1, T2 >&& c ) & {
+ sal_Int32 l = c.length();
+ if( l == 0 )
+ return *this;
+ l += pData->length;
+ rtl_uString_ensureCapacity( &pData, l );
+ sal_Unicode* end = c.addData( pData->buffer + pData->length );
+ *end = '\0';
+ pData->length = l;
+ return *this;
+ }
+ template<typename T1, typename T2> void operator +=(
+ OUStringConcat<T1, T2> &&) && = delete;
+
+ /**
+ @overload
+ @internal
+ */
+ template< typename T >
+ OUString& operator+=( OUStringNumber< T >&& n ) & {
+ sal_Int32 l = n.length;
+ if( l == 0 )
+ return *this;
+ l += pData->length;
+ rtl_uString_ensureCapacity( &pData, l );
+ sal_Unicode* end = addDataHelper( pData->buffer + pData->length, n.buf, n.length );
+ *end = '\0';
+ pData->length = l;
+ return *this;
+ }
+ template<typename T> void operator +=(
+ OUStringNumber<T> &&) && = delete;
+#endif
+
+ /**
+ Clears the string, i.e, makes a zero-character string
+ @since LibreOffice 4.4
+ */
+ void clear()
+ {
+ rtl_uString_new( &pData );
+ }
+
+ /**
+ Returns the length of this string.
+
+ The length is equal to the number of Unicode characters in this string.
+
+ @return the length of the sequence of characters represented by this
+ object.
+ */
+ sal_Int32 getLength() const { return pData->length; }
+
+ /**
+ Checks if a string is empty.
+
+ @return true if the string is empty;
+ false, otherwise.
+
+ @since LibreOffice 3.4
+ */
+ bool isEmpty() const
+ {
+ return pData->length == 0;
+ }
+
+ /**
+ Returns a pointer to the Unicode character buffer for this string.
+
+ It isn't necessarily NULL terminated.
+
+ @return a pointer to the Unicode characters buffer for this object.
+ */
+ const sal_Unicode * getStr() const SAL_RETURNS_NONNULL { return pData->buffer; }
+
+ /**
+ Access to individual characters.
+
+ @param index must be non-negative and less than length.
+
+ @return the character at the given index.
+
+ @since LibreOffice 3.5
+ */
+ sal_Unicode operator [](sal_Int32 index) const {
+ // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
+ assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
+ return getStr()[index];
+ }
+
+ /**
+ Compares two strings.
+
+ The comparison is based on the numeric value of each character in
+ the strings and return a value indicating their relationship.
+ This function can't be used for language specific sorting.
+
+ @param str the object to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 compareTo( std::u16string_view str ) const
+ {
+ return rtl_ustr_compare_WithLength( pData->buffer, pData->length,
+ str.data(), str.length() );
+ }
+#else
+ sal_Int32 compareTo( const OUString & str ) const
+ {
+ return rtl_ustr_compare_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length );
+ }
+#endif
+
+ /**
+ Compares two strings with a maximum count of characters.
+
+ The comparison is based on the numeric value of each character in
+ the strings and return a value indicating their relationship.
+ This function can't be used for language specific sorting.
+
+ @param str the object to be compared.
+ @param maxLength the maximum count of characters to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+
+ @since UDK 3.2.7
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 compareTo( std::u16string_view str, sal_Int32 maxLength ) const
+ {
+ return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length,
+ str.data(), str.length(), maxLength );
+ }
+#else
+ sal_Int32 compareTo( const OUString & str, sal_Int32 maxLength ) const
+ {
+ return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length, maxLength );
+ }
+#endif
+
+ /**
+ Compares two strings in reverse order.
+
+ The comparison is based on the numeric value of each character in
+ the strings and return a value indicating their relationship.
+ This function can't be used for language specific sorting.
+
+ @param str the object to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 reverseCompareTo(std::u16string_view sv) const {
+ return rtl_ustr_reverseCompare_WithLength(
+ pData->buffer, pData->length, sv.data(), sv.size());
+ }
+#else
+ sal_Int32 reverseCompareTo( const OUString & str ) const
+ {
+ return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length );
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 4.1
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type reverseCompareTo( T& literal ) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return rtl_ustr_asciil_reverseCompare_WithLength(
+ pData->buffer, pData->length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+
+ /**
+ Perform a comparison of two strings.
+
+ The result is true if and only if second string
+ represents the same sequence of characters as the first string.
+ This function can't be used for language specific comparison.
+
+ @param str the object to be compared.
+ @return true if the strings are equal;
+ false, otherwise.
+ */
+ bool equals( const OUString & str ) const
+ {
+ if ( pData->length != str.pData->length )
+ return false;
+ if ( pData == str.pData )
+ return true;
+ return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length ) == 0;
+ }
+
+ /**
+ Perform an ASCII lowercase comparison of two strings.
+
+ The result is true if and only if second string
+ represents the same sequence of characters as the first string,
+ ignoring the case.
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ This function can't be used for language specific comparison.
+
+ @param str the object to be compared.
+ @return true if the strings are equal;
+ false, otherwise.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool equalsIgnoreAsciiCase(std::u16string_view sv) const {
+ if ( sal_uInt32(pData->length) != sv.size() )
+ return false;
+ if ( pData->buffer == sv.data() )
+ return true;
+ return
+ rtl_ustr_compareIgnoreAsciiCase_WithLength(
+ pData->buffer, pData->length, sv.data(), sv.size())
+ == 0;
+ }
+#else
+ bool equalsIgnoreAsciiCase( const OUString & str ) const
+ {
+ if ( pData->length != str.pData->length )
+ return false;
+ if ( pData == str.pData )
+ return true;
+ return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length ) == 0;
+ }
+#endif
+
+ /**
+ Perform an ASCII lowercase comparison of two strings.
+
+ Compare the two strings with uppercase ASCII
+ character values between 65 and 90 (ASCII A-Z) interpreted as
+ values between 97 and 122 (ASCII a-z).
+ This function can't be used for language specific comparison.
+
+ @param str the object to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+
+ @since LibreOffice 4.0
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 compareToIgnoreAsciiCase(std::u16string_view sv) const {
+ return rtl_ustr_compareIgnoreAsciiCase_WithLength(
+ pData->buffer, pData->length, sv.data(), sv.size());
+ }
+#else
+ sal_Int32 compareToIgnoreAsciiCase( const OUString & str ) const
+ {
+ return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length );
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase( T& literal ) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return
+ (pData->length
+ == libreoffice_internal::ConstCharArrayDetector<T>::length)
+ && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength(
+ pData->buffer, pData->length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal))
+ == 0);
+ }
+
+ /**
+ Match against a substring appearing in this string.
+
+ The result is true if and only if the second string appears as a substring
+ of this string, at the given position.
+ This function can't be used for language specific comparison.
+
+ @param str the object (substring) to be compared.
+ @param fromIndex the index to start the comparison from.
+ The index must be greater than or equal to 0
+ and less or equal as the string length.
+ @return true if str match with the characters in the string
+ at the given position;
+ false, otherwise.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool match(std::u16string_view sv, sal_Int32 fromIndex = 0) const {
+ return
+ rtl_ustr_shortenedCompare_WithLength(
+ pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size(),
+ sv.size())
+ == 0;
+ }
+#else
+ bool match( const OUString & str, sal_Int32 fromIndex = 0 ) const
+ {
+ return rtl_ustr_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ str.pData->buffer, str.pData->length, str.pData->length ) == 0;
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match( T& literal, sal_Int32 fromIndex = 0 ) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return
+ rtl_ustr_ascii_shortenedCompare_WithLength(
+ pData->buffer+fromIndex, pData->length-fromIndex,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length)
+ == 0;
+ }
+
+ /**
+ Match against a substring appearing in this string, ignoring the case of
+ ASCII letters.
+
+ The result is true if and only if the second string appears as a substring
+ of this string, at the given position.
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ This function can't be used for language specific comparison.
+
+ @param str the object (substring) to be compared.
+ @param fromIndex the index to start the comparison from.
+ The index must be greater than or equal to 0
+ and less than or equal to the string length.
+ @return true if str match with the characters in the string
+ at the given position;
+ false, otherwise.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool matchIgnoreAsciiCase(std::u16string_view sv, sal_Int32 fromIndex = 0) const {
+ return
+ rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength(
+ pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size(),
+ sv.size())
+ == 0;
+ }
+#else
+ bool matchIgnoreAsciiCase( const OUString & str, sal_Int32 fromIndex = 0 ) const
+ {
+ return rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ str.pData->buffer, str.pData->length,
+ str.pData->length ) == 0;
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase( T& literal, sal_Int32 fromIndex = 0 ) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return matchIgnoreAsciiCaseAsciiL(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, fromIndex);
+ }
+
+ /**
+ Compares two strings.
+
+ The comparison is based on the numeric value of each character in
+ the strings and return a value indicating their relationship.
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and 127.
+ The ASCII string must be NULL-terminated.
+ This function can't be used for language specific sorting.
+
+ @param asciiStr the 8-Bit ASCII character string to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+ */
+ sal_Int32 compareToAscii( const char* asciiStr ) const
+ {
+ return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length, asciiStr );
+ }
+
+ /**
+ Compares two strings with a maximum count of characters.
+
+ The comparison is based on the numeric value of each character in
+ the strings and return a value indicating their relationship.
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and 127.
+ The ASCII string must be NULL-terminated.
+ This function can't be used for language specific sorting.
+
+ @deprecated This is a confusing overload with unexpectedly different
+ semantics from the one-parameter form, so it is marked as deprecated.
+ Practically all uses compare the return value against zero and can thus
+ be replaced with uses of startsWith.
+
+ @param asciiStr the 8-Bit ASCII character string to be compared.
+ @param maxLength the maximum count of characters to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+ */
+ SAL_DEPRECATED(
+ "replace s1.compareToAscii(s2, strlen(s2)) == 0 with s1.startsWith(s2)")
+ sal_Int32 compareToAscii( const char * asciiStr, sal_Int32 maxLength ) const
+ {
+ return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer, pData->length,
+ asciiStr, maxLength );
+ }
+
+ /**
+ Compares two strings in reverse order.
+
+ This could be useful, if normally both strings start with the same
+ content. The comparison is based on the numeric value of each character
+ in the strings and return a value indicating their relationship.
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and 127.
+ The ASCII string must be NULL-terminated and must be greater than
+ or equal to asciiStrLength.
+ This function can't be used for language specific sorting.
+
+ @param asciiStr the 8-Bit ASCII character string to be compared.
+ @param asciiStrLength the length of the ascii string
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+ */
+ sal_Int32 reverseCompareToAsciiL( const char * asciiStr, sal_Int32 asciiStrLength ) const
+ {
+ return rtl_ustr_asciil_reverseCompare_WithLength( pData->buffer, pData->length,
+ asciiStr, asciiStrLength );
+ }
+
+ /**
+ Perform a comparison of two strings.
+
+ The result is true if and only if second string
+ represents the same sequence of characters as the first string.
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and 127.
+ The ASCII string must be NULL-terminated.
+ This function can't be used for language specific comparison.
+
+ @param asciiStr the 8-Bit ASCII character string to be compared.
+ @return true if the strings are equal;
+ false, otherwise.
+ */
+ bool equalsAscii( const char* asciiStr ) const
+ {
+ return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length,
+ asciiStr ) == 0;
+ }
+
+ /**
+ Perform a comparison of two strings.
+
+ The result is true if and only if second string
+ represents the same sequence of characters as the first string.
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and 127.
+ The ASCII string must be NULL-terminated and must be greater than
+ or equal to asciiStrLength.
+ This function can't be used for language specific comparison.
+
+ @param asciiStr the 8-Bit ASCII character string to be compared.
+ @param asciiStrLength the length of the ascii string
+ @return true if the strings are equal;
+ false, otherwise.
+ */
+ bool equalsAsciiL( const char* asciiStr, sal_Int32 asciiStrLength ) const
+ {
+ if ( pData->length != asciiStrLength )
+ return false;
+
+ return rtl_ustr_asciil_reverseEquals_WithLength(
+ pData->buffer, asciiStr, asciiStrLength );
+ }
+
+ /**
+ Perform an ASCII lowercase comparison of two strings.
+
+ The result is true if and only if second string
+ represents the same sequence of characters as the first string,
+ ignoring the case.
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and 127.
+ The ASCII string must be NULL-terminated.
+ This function can't be used for language specific comparison.
+
+ @param asciiStr the 8-Bit ASCII character string to be compared.
+ @return true if the strings are equal;
+ false, otherwise.
+ */
+ bool equalsIgnoreAsciiCaseAscii( const char * asciiStr ) const
+ {
+ return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
+ }
+
+ /**
+ Compares two ASCII strings ignoring case
+
+ The comparison is based on the numeric value of each character in
+ the strings and return a value indicating their relationship.
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and 127.
+ The ASCII string must be NULL-terminated.
+ This function can't be used for language specific sorting.
+
+ @param asciiStr the 8-Bit ASCII character string to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+
+ @since LibreOffice 3.5
+ */
+ sal_Int32 compareToIgnoreAsciiCaseAscii( const char * asciiStr ) const
+ {
+ return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr );
+ }
+
+ /**
+ Perform an ASCII lowercase comparison of two strings.
+
+ The result is true if and only if second string
+ represents the same sequence of characters as the first string,
+ ignoring the case.
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and 127.
+ The ASCII string must be NULL-terminated and must be greater than
+ or equal to asciiStrLength.
+ This function can't be used for language specific comparison.
+
+ @param asciiStr the 8-Bit ASCII character string to be compared.
+ @param asciiStrLength the length of the ascii string
+ @return true if the strings are equal;
+ false, otherwise.
+ */
+ bool equalsIgnoreAsciiCaseAsciiL( const char * asciiStr, sal_Int32 asciiStrLength ) const
+ {
+ if ( pData->length != asciiStrLength )
+ return false;
+
+ return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
+ }
+
+ /**
+ Match against a substring appearing in this string.
+
+ The result is true if and only if the second string appears as a substring
+ of this string, at the given position.
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and 127.
+ The ASCII string must be NULL-terminated and must be greater than or
+ equal to asciiStrLength.
+ This function can't be used for language specific comparison.
+
+ @param asciiStr the object (substring) to be compared.
+ @param asciiStrLength the length of asciiStr.
+ @param fromIndex the index to start the comparison from.
+ The index must be greater than or equal to 0
+ and less than or equal to the string length.
+ @return true if str match with the characters in the string
+ at the given position;
+ false, otherwise.
+ */
+ bool matchAsciiL( const char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
+ {
+ return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ asciiStr, asciiStrLength ) == 0;
+ }
+
+ // This overload is left undefined, to detect calls of matchAsciiL that
+ // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
+ // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
+ // platforms):
+#if SAL_TYPES_SIZEOFLONG == 8
+ void matchAsciiL(char const *, sal_Int32, rtl_TextEncoding) const;
+#endif
+
+ /**
+ Match against a substring appearing in this string, ignoring the case of
+ ASCII letters.
+
+ The result is true if and only if the second string appears as a substring
+ of this string, at the given position.
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and 127.
+ The ASCII string must be NULL-terminated and must be greater than or
+ equal to asciiStrLength.
+ This function can't be used for language specific comparison.
+
+ @param asciiStr the 8-Bit ASCII character string to be compared.
+ @param asciiStrLength the length of the ascii string
+ @param fromIndex the index to start the comparison from.
+ The index must be greater than or equal to 0
+ and less than or equal to the string length.
+ @return true if str match with the characters in the string
+ at the given position;
+ false, otherwise.
+ */
+ bool matchIgnoreAsciiCaseAsciiL( const char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
+ {
+ return rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ asciiStr, asciiStrLength ) == 0;
+ }
+
+ // This overload is left undefined, to detect calls of
+ // matchIgnoreAsciiCaseAsciiL that erroneously use
+ // RTL_CONSTASCII_USTRINGPARAM instead of RTL_CONSTASCII_STRINGPARAM (but
+ // would lead to ambiguities on 32 bit platforms):
+#if SAL_TYPES_SIZEOFLONG == 8
+ void matchIgnoreAsciiCaseAsciiL(char const *, sal_Int32, rtl_TextEncoding)
+ const;
+#endif
+
+ /**
+ Check whether this string starts with a given substring.
+
+ @param str the substring to be compared
+
+ @param rest if non-null, and this function returns true, then assign a
+ copy of the remainder of this string to *rest. Available since
+ LibreOffice 4.2
+
+ @return true if and only if the given str appears as a substring at the
+ start of this string
+
+ @since LibreOffice 4.0
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool startsWith(std::u16string_view sv, OUString * rest = nullptr) const {
+ auto const b = match(sv);
+ if (b && rest != nullptr) {
+ *rest = copy(sv.size());
+ }
+ return b;
+ }
+#else
+ bool startsWith(OUString const & str, OUString * rest = NULL) const {
+ bool b = match(str);
+ if (b && rest != NULL) {
+ *rest = copy(str.getLength());
+ }
+ return b;
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 4.0
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
+ T & literal, OUString * rest = NULL) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ bool b
+ = (libreoffice_internal::ConstCharArrayDetector<T>::length
+ <= sal_uInt32(pData->length))
+ && rtl_ustr_asciil_reverseEquals_WithLength(
+ pData->buffer,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ if (b && rest != NULL) {
+ *rest = copy(
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+ return b;
+ }
+
+ /**
+ Check whether this string starts with a given string, ignoring the case of
+ ASCII letters.
+
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ This function can't be used for language specific comparison.
+
+ @param str the substring to be compared
+
+ @param rest if non-null, and this function returns true, then assign a
+ copy of the remainder of this string to *rest. Available since
+ LibreOffice 4.2
+
+ @return true if and only if the given str appears as a substring at the
+ start of this string, ignoring the case of ASCII letters ("A"--"Z" and
+ "a"--"z")
+
+ @since LibreOffice 4.0
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool startsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest = nullptr) const {
+ auto const b = matchIgnoreAsciiCase(sv);
+ if (b && rest != nullptr) {
+ *rest = copy(sv.size());
+ }
+ return b;
+ }
+#else
+ bool startsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL)
+ const
+ {
+ bool b = matchIgnoreAsciiCase(str);
+ if (b && rest != NULL) {
+ *rest = copy(str.getLength());
+ }
+ return b;
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 4.0
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+ startsWithIgnoreAsciiCase(T & literal, OUString * rest = NULL) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ bool b
+ = (libreoffice_internal::ConstCharArrayDetector<T>::length
+ <= sal_uInt32(pData->length))
+ && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
+ pData->buffer,
+ libreoffice_internal::ConstCharArrayDetector<T>::length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length)
+ == 0);
+ if (b && rest != NULL) {
+ *rest = copy(
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+ return b;
+ }
+
+ /**
+ Check whether this string ends with a given substring.
+
+ @param str the substring to be compared
+
+ @param rest if non-null, and this function returns true, then assign a
+ copy of the remainder of this string to *rest. Available since
+ LibreOffice 4.2
+
+ @return true if and only if the given str appears as a substring at the
+ end of this string
+
+ @since LibreOffice 3.6
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool endsWith(std::u16string_view sv, OUString * rest = nullptr) const {
+ auto const b = sv.size() <= sal_uInt32(pData->length)
+ && match(sv, pData->length - sv.size());
+ if (b && rest != nullptr) {
+ *rest = copy(0, (pData->length - sv.size()));
+ }
+ return b;
+ }
+#else
+ bool endsWith(OUString const & str, OUString * rest = NULL) const {
+ bool b = str.getLength() <= getLength()
+ && match(str, getLength() - str.getLength());
+ if (b && rest != NULL) {
+ *rest = copy(0, getLength() - str.getLength());
+ }
+ return b;
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+ endsWith(T & literal, OUString * rest = NULL) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ bool b
+ = (libreoffice_internal::ConstCharArrayDetector<T>::length
+ <= sal_uInt32(pData->length))
+ && rtl_ustr_asciil_reverseEquals_WithLength(
+ (pData->buffer + pData->length
+ - libreoffice_internal::ConstCharArrayDetector<T>::length),
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ if (b && rest != NULL) {
+ *rest = copy(
+ 0,
+ (getLength()
+ - libreoffice_internal::ConstCharArrayDetector<T>::length));
+ }
+ return b;
+ }
+
+ /**
+ Check whether this string ends with a given ASCII string.
+
+ @param asciiStr a sequence of at least asciiStrLength ASCII characters
+ (bytes in the range 0x00--0x7F)
+ @param asciiStrLength the length of asciiStr; must be non-negative
+ @return true if this string ends with asciiStr; otherwise, false is
+ returned
+
+ @since UDK 3.2.7
+ */
+ bool endsWithAsciiL(char const * asciiStr, sal_Int32 asciiStrLength)
+ const
+ {
+ return asciiStrLength <= pData->length
+ && rtl_ustr_asciil_reverseEquals_WithLength(
+ pData->buffer + pData->length - asciiStrLength, asciiStr,
+ asciiStrLength);
+ }
+
+ /**
+ Check whether this string ends with a given string, ignoring the case of
+ ASCII letters.
+
+ Character values between 65 and 90 (ASCII A-Z) are interpreted as
+ values between 97 and 122 (ASCII a-z).
+ This function can't be used for language specific comparison.
+
+ @param str the substring to be compared
+
+ @param rest if non-null, and this function returns true, then assign a
+ copy of the remainder of this string to *rest. Available since
+ LibreOffice 4.2
+
+ @return true if and only if the given str appears as a substring at the
+ end of this string, ignoring the case of ASCII letters ("A"--"Z" and
+ "a"--"z")
+
+ @since LibreOffice 3.6
+ */
+#if defined LIBO_INTERNAL_ONLY
+ bool endsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest = nullptr) const {
+ auto const b = sv.size() <= sal_uInt32(pData->length)
+ && matchIgnoreAsciiCase(sv, pData->length - sv.size());
+ if (b && rest != nullptr) {
+ *rest = copy(0, pData->length - sv.size());
+ }
+ return b;
+ }
+#else
+ bool endsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL) const
+ {
+ bool b = str.getLength() <= getLength()
+ && matchIgnoreAsciiCase(str, getLength() - str.getLength());
+ if (b && rest != NULL) {
+ *rest = copy(0, getLength() - str.getLength());
+ }
+ return b;
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+ endsWithIgnoreAsciiCase(T & literal, OUString * rest = NULL) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ bool b
+ = (libreoffice_internal::ConstCharArrayDetector<T>::length
+ <= sal_uInt32(pData->length))
+ && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
+ (pData->buffer + pData->length
+ - libreoffice_internal::ConstCharArrayDetector<T>::length),
+ libreoffice_internal::ConstCharArrayDetector<T>::length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length)
+ == 0);
+ if (b && rest != NULL) {
+ *rest = copy(
+ 0,
+ (getLength()
+ - libreoffice_internal::ConstCharArrayDetector<T>::length));
+ }
+ return b;
+ }
+
+ /**
+ Check whether this string ends with a given ASCII string, ignoring the
+ case of ASCII letters.
+
+ @param asciiStr a sequence of at least asciiStrLength ASCII characters
+ (bytes in the range 0x00--0x7F)
+ @param asciiStrLength the length of asciiStr; must be non-negative
+ @return true if this string ends with asciiStr, ignoring the case of ASCII
+ letters ("A"--"Z" and "a"--"z"); otherwise, false is returned
+ */
+ bool endsWithIgnoreAsciiCaseAsciiL(
+ char const * asciiStr, sal_Int32 asciiStrLength) const
+ {
+ return asciiStrLength <= pData->length
+ && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
+ pData->buffer + pData->length - asciiStrLength,
+ asciiStrLength, asciiStr, asciiStrLength)
+ == 0);
+ }
+
+ friend bool operator == ( const OUString& rStr1, const OUString& rStr2 )
+ { return rStr1.equals(rStr2); }
+
+ friend bool operator != ( const OUString& rStr1, const OUString& rStr2 )
+ { return !(operator == ( rStr1, rStr2 )); }
+
+ friend bool operator < ( const OUString& rStr1, const OUString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) < 0; }
+ friend bool operator > ( const OUString& rStr1, const OUString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) > 0; }
+ friend bool operator <= ( const OUString& rStr1, const OUString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) <= 0; }
+ friend bool operator >= ( const OUString& rStr1, const OUString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) >= 0; }
+
+#if defined LIBO_INTERNAL_ONLY
+
+ template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
+ operator ==(OUString const & s1, T const & s2) {
+ return rtl_ustr_compare_WithLength(s1.getStr(), s1.getLength(), s2, rtl_ustr_getLength(s2))
+ == 0;
+ }
+
+ template<typename T>
+ friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
+ operator ==(OUString const & s1, T & s2) {
+ return rtl_ustr_compare_WithLength(s1.getStr(), s1.getLength(), s2, rtl_ustr_getLength(s2))
+ == 0;
+ }
+
+ template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
+ operator ==(T const & s1, OUString const & s2) {
+ return rtl_ustr_compare_WithLength(s1, rtl_ustr_getLength(s1), s2.getStr(), s2.getLength())
+ == 0;
+ }
+
+ template<typename T>
+ friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
+ operator ==(T & s1, OUString const & s2) {
+ return rtl_ustr_compare_WithLength(s1, rtl_ustr_getLength(s1), s2.getStr(), s2.getLength())
+ == 0;
+ }
+
+ template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
+ operator !=(OUString const & s1, T const & s2) { return !(s1 == s2); }
+
+ template<typename T>
+ friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
+ operator !=(OUString const & s1, T & s2) { return !(s1 == s2); }
+
+ template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
+ operator !=(T const & s1, OUString const & s2) { return !(s1 == s2); }
+
+ template<typename T>
+ friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
+ operator !=(T & s1, OUString const & s2) { return !(s1 == s2); }
+
+#else
+
+ friend bool operator == ( const OUString& rStr1, const sal_Unicode * pStr2 )
+ { return rStr1.compareTo( pStr2 ) == 0; }
+ friend bool operator == ( const sal_Unicode * pStr1, const OUString& rStr2 )
+ { return OUString( pStr1 ).compareTo( rStr2 ) == 0; }
+
+ friend bool operator != ( const OUString& rStr1, const sal_Unicode * pStr2 )
+ { return !(operator == ( rStr1, pStr2 )); }
+ friend bool operator != ( const sal_Unicode * pStr1, const OUString& rStr2 )
+ { return !(operator == ( pStr1, rStr2 )); }
+
+#endif
+
+ /**
+ * Compare string to an ASCII string literal.
+ *
+ * This operator is equal to calling equalsAsciiL().
+ *
+ * @since LibreOffice 3.6
+ */
+ template< typename T >
+ friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( const OUString& rString, T& literal )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return rString.equalsAsciiL(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+ /**
+ * Compare string to an ASCII string literal.
+ *
+ * This operator is equal to calling equalsAsciiL().
+ *
+ * @since LibreOffice 3.6
+ */
+ template< typename T >
+ friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( T& literal, const OUString& rString )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return rString.equalsAsciiL(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+ /**
+ * Compare string to an ASCII string literal.
+ *
+ * This operator is equal to calling !equalsAsciiL().
+ *
+ * @since LibreOffice 3.6
+ */
+ template< typename T >
+ friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( const OUString& rString, T& literal )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return !rString.equalsAsciiL(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+ /**
+ * Compare string to an ASCII string literal.
+ *
+ * This operator is equal to calling !equalsAsciiL().
+ *
+ * @since LibreOffice 3.6
+ */
+ template< typename T >
+ friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( T& literal, const OUString& rString )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return !rString.equalsAsciiL(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
+ operator ==(OUString const & string, T & literal) {
+ return
+ rtl_ustr_reverseCompare_WithLength(
+ string.pData->buffer, string.pData->length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length)
+ == 0;
+ }
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
+ operator ==(T & literal, OUString const & string) {
+ return
+ rtl_ustr_reverseCompare_WithLength(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length,
+ string.pData->buffer, string.pData->length)
+ == 0;
+ }
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
+ operator !=(OUString const & string, T & literal) {
+ return
+ rtl_ustr_reverseCompare_WithLength(
+ string.pData->buffer, string.pData->length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length)
+ != 0;
+ }
+ /** @overload @since LibreOffice 5.3 */
+ template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
+ operator !=(T & literal, OUString const & string) {
+ return
+ rtl_ustr_reverseCompare_WithLength(
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+ literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length,
+ string.pData->buffer, string.pData->length)
+ != 0;
+ }
+#endif
+
+ /**
+ Returns a hashcode for this string.
+
+ @return a hash code value for this object.
+
+ @see rtl::OUStringHash for convenient use of std::unordered_map
+ */
+ sal_Int32 hashCode() const
+ {
+ return rtl_ustr_hashCode_WithLength( pData->buffer, pData->length );
+ }
+
+ /**
+ Returns the index within this string of the first occurrence of the
+ specified character, starting the search at the specified index.
+
+ @param ch character to be located.
+ @param fromIndex the index to start the search from.
+ The index must be greater than or equal to 0
+ and less than or equal to the string length.
+ @return the index of the first occurrence of the character in the
+ character sequence represented by this string that is
+ greater than or equal to fromIndex, or
+ -1 if the character does not occur.
+ */
+ sal_Int32 indexOf( sal_Unicode ch, sal_Int32 fromIndex = 0 ) const
+ {
+ sal_Int32 ret = rtl_ustr_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
+ return (ret < 0 ? ret : ret+fromIndex);
+ }
+
+ /**
+ Returns the index within this string of the last occurrence of the
+ specified character, searching backward starting at the end.
+
+ @param ch character to be located.
+ @return the index of the last occurrence of the character in the
+ character sequence represented by this string, or
+ -1 if the character does not occur.
+ */
+ sal_Int32 lastIndexOf( sal_Unicode ch ) const
+ {
+ return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
+ }
+
+ /**
+ Returns the index within this string of the last occurrence of the
+ specified character, searching backward starting before the specified
+ index.
+
+ @param ch character to be located.
+ @param fromIndex the index before which to start the search.
+ @return the index of the last occurrence of the character in the
+ character sequence represented by this string that
+ is less than fromIndex, or -1
+ if the character does not occur before that point.
+ */
+ sal_Int32 lastIndexOf( sal_Unicode ch, sal_Int32 fromIndex ) const
+ {
+ return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
+ }
+
+ /**
+ Returns the index within this string of the first occurrence of the
+ specified substring, starting at the specified index.
+
+ If str doesn't include any character, always -1 is
+ returned. This is also the case, if both strings are empty.
+
+ @param str the substring to search for.
+ @param fromIndex the index to start the search from.
+ @return If the string argument occurs one or more times as a substring
+ within this string at the starting index, then the index
+ of the first character of the first such substring is
+ returned. If it does not occur as a substring starting
+ at fromIndex or beyond, -1 is returned.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 indexOf(std::u16string_view sv, sal_Int32 fromIndex = 0) const {
+ auto const n = rtl_ustr_indexOfStr_WithLength(
+ pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size());
+ return n < 0 ? n : n + fromIndex;
+ }
+#else
+ sal_Int32 indexOf( const OUString & str, sal_Int32 fromIndex = 0 ) const
+ {
+ sal_Int32 ret = rtl_ustr_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
+ str.pData->buffer, str.pData->length );
+ return (ret < 0 ? ret : ret+fromIndex);
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ sal_Int32 n = rtl_ustr_indexOfAscii_WithLength(
+ pData->buffer + fromIndex, pData->length - fromIndex,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ return n < 0 ? n : n + fromIndex;
+ }
+
+ /**
+ Returns the index within this string of the first occurrence of the
+ specified ASCII substring, starting at the specified index.
+
+ @param str
+ the substring to be searched for. Need not be null-terminated, but must
+ be at least as long as the specified len. Must only contain characters
+ in the ASCII range 0x00--7F.
+
+ @param len
+ the length of the substring; must be non-negative.
+
+ @param fromIndex
+ the index to start the search from. Must be in the range from zero to
+ the length of this string, inclusive.
+
+ @return
+ the index (starting at 0) of the first character of the first occurrence
+ of the substring within this string starting at the given fromIndex, or
+ -1 if the substring does not occur. If len is zero, -1 is returned.
+
+ @since UDK 3.2.7
+ */
+ sal_Int32 indexOfAsciiL(
+ char const * str, sal_Int32 len, sal_Int32 fromIndex = 0) const
+ {
+ sal_Int32 ret = rtl_ustr_indexOfAscii_WithLength(
+ pData->buffer + fromIndex, pData->length - fromIndex, str, len);
+ return ret < 0 ? ret : ret + fromIndex;
+ }
+
+ // This overload is left undefined, to detect calls of indexOfAsciiL that
+ // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
+ // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
+ // platforms):
+#if SAL_TYPES_SIZEOFLONG == 8
+ void indexOfAsciiL(char const *, sal_Int32 len, rtl_TextEncoding) const;
+#endif
+
+ /**
+ Returns the index within this string of the last occurrence of
+ the specified substring, searching backward starting at the end.
+
+ The returned index indicates the starting index of the substring
+ in this string.
+ If str doesn't include any character, always -1 is
+ returned. This is also the case, if both strings are empty.
+
+ @param str the substring to search for.
+ @return If the string argument occurs one or more times as a substring
+ within this string, then the index of the first character of
+ the last such substring is returned. If it does not occur as
+ a substring, -1 is returned.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 lastIndexOf(std::u16string_view sv) const {
+ return rtl_ustr_lastIndexOfStr_WithLength(
+ pData->buffer, pData->length, sv.data(), sv.size());
+ }
+#else
+ sal_Int32 lastIndexOf( const OUString & str ) const
+ {
+ return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length );
+ }
+#endif
+
+ /**
+ Returns the index within this string of the last occurrence of
+ the specified substring, searching backward starting before the specified
+ index.
+
+ The returned index indicates the starting index of the substring
+ in this string.
+ If str doesn't include any character, always -1 is
+ returned. This is also the case, if both strings are empty.
+
+ @param str the substring to search for.
+ @param fromIndex the index before which to start the search.
+ @return If the string argument occurs one or more times as a substring
+ within this string before the starting index, then the index
+ of the first character of the last such substring is
+ returned. Otherwise, -1 is returned.
+ */
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 lastIndexOf(std::u16string_view sv, sal_Int32 fromIndex) const {
+ return rtl_ustr_lastIndexOfStr_WithLength(pData->buffer, fromIndex, sv.data(), sv.size());
+ }
+#else
+ sal_Int32 lastIndexOf( const OUString & str, sal_Int32 fromIndex ) const
+ {
+ return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
+ str.pData->buffer, str.pData->length );
+ }
+#endif
+
+ /**
+ @overload
+ This function accepts an ASCII string literal as its argument.
+ @since LibreOffice 3.6
+ */
+ template< typename T >
+ typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type lastIndexOf( T& literal ) const
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ return rtl_ustr_lastIndexOfAscii_WithLength(
+ pData->buffer, pData->length,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ }
+
+ /**
+ Returns the index within this string of the last occurrence of the
+ specified ASCII substring.
+
+ @param str
+ the substring to be searched for. Need not be null-terminated, but must
+ be at least as long as the specified len. Must only contain characters
+ in the ASCII range 0x00--7F.
+
+ @param len
+ the length of the substring; must be non-negative.
+
+ @return
+ the index (starting at 0) of the first character of the last occurrence
+ of the substring within this string, or -1 if the substring does not
+ occur. If len is zero, -1 is returned.
+
+ @since UDK 3.2.7
+ */
+ sal_Int32 lastIndexOfAsciiL(char const * str, sal_Int32 len) const
+ {
+ return rtl_ustr_lastIndexOfAscii_WithLength(
+ pData->buffer, pData->length, str, len);
+ }
+
+ /**
+ Returns a new string that is a substring of this string.
+
+ The substring begins at the specified beginIndex. If
+ beginIndex is negative or be greater than the length of
+ this string, behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @return the specified substring.
+ */
+ SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex ) const
+ {
+ return copy(beginIndex, getLength() - beginIndex);
+ }
+
+ /**
+ Returns a new string that is a substring of this string.
+
+ The substring begins at the specified beginIndex and contains count
+ characters. If either beginIndex or count are negative,
+ or beginIndex + count are greater than the length of this string
+ then behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @param count the number of characters.
+ @return the specified substring.
+ */
+ SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex, sal_Int32 count ) const
+ {
+ rtl_uString *pNew = NULL;
+ rtl_uString_newFromSubString( &pNew, pData, beginIndex, count );
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ /**
+ Returns a std::u16string_view that is a view of a substring of this string.
+
+ The substring begins at the specified beginIndex. If
+ beginIndex is negative or be greater than the length of
+ this string, behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @return the specified substring.
+ */
+ SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex ) const
+ {
+ assert(beginIndex >= 0);
+ assert(beginIndex <= getLength());
+ return subView(beginIndex, getLength() - beginIndex);
+ }
+
+ /**
+ Returns a std::u16string_view that is a view of a substring of this string.
+
+ The substring begins at the specified beginIndex and contains count
+ characters. If either beginIndex or count are negative,
+ or beginIndex + count are greater than the length of this string
+ then behaviour is undefined.
+
+ @param beginIndex the beginning index, inclusive.
+ @param count the number of characters.
+ @return the specified substring.
+ */
+ SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const
+ {
+ assert(beginIndex >= 0);
+ assert(count >= 0);
+ assert(beginIndex <= getLength());
+ assert(count <= getLength() - beginIndex);
+ return std::u16string_view(*this).substr(beginIndex, count);
+ }
+#endif
+
+#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ /**
+ Concatenates the specified string to the end of this string.
+
+ @param str the string that is concatenated to the end
+ of this string.
+ @return a string that represents the concatenation of this string
+ followed by the string argument.
+ */
+ SAL_WARN_UNUSED_RESULT OUString concat( const OUString & str ) const
+ {
+ rtl_uString* pNew = NULL;
+ rtl_uString_newConcat( &pNew, pData, str.pData );
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+#endif
+
+#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+ friend OUString operator+( const OUString& rStr1, const OUString& rStr2 )
+ {
+ return rStr1.concat( rStr2 );
+ }
+#endif
+
+// hide this from internal code to avoid ambiguous lookup error
+#ifndef LIBO_INTERNAL_ONLY
+ /**
+ Returns a new string resulting from replacing n = count characters
+ from position index in this string with newStr.
+
+ @param index the replacing index in str.
+ The index must be greater than or equal to 0 and
+ less than or equal to the length of the string.
+ @param count the count of characters that will be replaced
+ The count must be greater than or equal to 0 and
+ less than or equal to the length of the string minus index.
+ @param newStr the new substring.
+ @return the new string.
+ */
+ SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const OUString& newStr ) const
+ {
+ rtl_uString* pNew = NULL;
+ rtl_uString_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+#endif
+
+#ifdef LIBO_INTERNAL_ONLY
+ SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, std::u16string_view newStr ) const
+ {
+ rtl_uString* pNew = NULL;
+ rtl_uString_newReplaceStrAtUtf16L( &pNew, pData, index, count, newStr.data(), newStr.size() );
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+#endif
+
+ /**
+ Returns a new string resulting from replacing all occurrences of
+ oldChar in this string with newChar.
+
+ If the character oldChar does not occur in the character sequence
+ represented by this object, then the string is assigned with
+ str.
+
+ @param oldChar the old character.
+ @param newChar the new character.
+ @return a string derived from this string by replacing every
+ occurrence of oldChar with newChar.
+ */
+ SAL_WARN_UNUSED_RESULT OUString replace( sal_Unicode oldChar, sal_Unicode newChar ) const
+ {
+ rtl_uString* pNew = NULL;
+ rtl_uString_newReplace( &pNew, pData, oldChar, newChar );
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Returns a new string resulting from replacing the first occurrence of a
+ given substring with another substring.
+
+ @param from the substring to be replaced
+
+ @param to the replacing substring
+
+ @param[in,out] index pointer to a start index; if the pointer is
+ non-null: upon entry to the function, its value is the index into this
+ string at which to start searching for the \p from substring, the value
+ must be non-negative and not greater than this string's length; upon exiting
+ the function its value is the index into this string at which the
+ replacement took place or -1 if no replacement took place; if the pointer
+ is null, searching always starts at index 0
+
+ @since LibreOffice 3.6
+ */
+#if defined LIBO_INTERNAL_ONLY
+ [[nodiscard]] OUString replaceFirst(
+ std::u16string_view from, std::u16string_view to, sal_Int32 * index = nullptr) const
+ {
+ rtl_uString * s = nullptr;
+ sal_Int32 i = 0;
+ rtl_uString_newReplaceFirstUtf16LUtf16L(
+ &s, pData, from.data(), from.size(), to.data(), to.size(),
+ index == nullptr ? &i : index);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#else
+ SAL_WARN_UNUSED_RESULT OUString replaceFirst(
+ OUString const & from, OUString const & to, sal_Int32 * index = NULL) const
+ {
+ rtl_uString * s = NULL;
+ sal_Int32 i = 0;
+ rtl_uString_newReplaceFirst(
+ &s, pData, from.pData, to.pData, index == NULL ? &i : index);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#endif
+
+ /**
+ Returns a new string resulting from replacing the first occurrence of a
+ given substring with another substring.
+
+ @param from ASCII string literal, the substring to be replaced
+
+ @param to the replacing substring
+
+ @param[in,out] index pointer to a start index; if the pointer is
+ non-null: upon entry to the function, its value is the index into the this
+ string at which to start searching for the \p from substring, the value
+ must be non-negative and not greater than this string's length; upon exiting
+ the function its value is the index into this string at which the
+ replacement took place or -1 if no replacement took place; if the pointer
+ is null, searching always starts at index 0
+
+ @since LibreOffice 3.6
+ */
+#if defined LIBO_INTERNAL_ONLY
+ template<typename T> [[nodiscard]]
+ typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceFirst(
+ T & from, std::u16string_view to, sal_Int32 * index = nullptr) const
+ {
+ assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
+ rtl_uString * s = nullptr;
+ sal_Int32 i = 0;
+ rtl_uString_newReplaceFirstAsciiLUtf16L(
+ &s, pData, libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, to.data(), to.size(),
+ index == nullptr ? &i : index);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#else
+ template< typename T >
+ SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst( T& from, OUString const & to,
+ sal_Int32 * index = NULL) const
+ {
+ assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
+ rtl_uString * s = NULL;
+ sal_Int32 i = 0;
+ rtl_uString_newReplaceFirstAsciiL(
+ &s, pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, to.pData,
+ index == NULL ? &i : index);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#endif
+
+ /**
+ Returns a new string resulting from replacing the first occurrence of a
+ given substring with another substring.
+
+ @param from the substring to be replaced
+
+ @param to ASCII string literal, the replacing substring
+
+ @param[in,out] index pointer to a start index; if the pointer is
+ non-null: upon entry to the function, its value is the index into the this
+ string at which to start searching for the \p from substring, the value
+ must be non-negative and not greater than this string's length; upon exiting
+ the function its value is the index into this string at which the
+ replacement took place or -1 if no replacement took place; if the pointer
+ is null, searching always starts at index 0
+
+ @since LibreOffice 5.1
+ */
+#if defined LIBO_INTERNAL_ONLY
+ template<typename T> [[nodiscard]]
+ typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceFirst(
+ std::u16string_view from, T & to, sal_Int32 * index = nullptr) const
+ {
+ assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
+ rtl_uString * s = nullptr;
+ sal_Int32 i = 0;
+ rtl_uString_newReplaceFirstUtf16LAsciiL(
+ &s, pData, from.data(), from.size(),
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, index == nullptr ? &i : index);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#else
+ template< typename T >
+ SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst( OUString const & from, T& to,
+ sal_Int32 * index = NULL) const
+ {
+ assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
+ rtl_uString * s = NULL;
+ sal_Int32 i = 0;
+ rtl_uString_newReplaceFirstToAsciiL(
+ &s, pData, from.pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
+ libreoffice_internal::ConstCharArrayDetector<T>::length,
+ index == NULL ? &i : index);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#endif
+
+ /**
+ Returns a new string resulting from replacing the first occurrence of a
+ given substring with another substring.
+
+ @param from ASCII string literal, the substring to be replaced
+
+ @param to ASCII string literal, the substring to be replaced
+
+ @param[in,out] index pointer to a start index; if the pointer is
+ non-null: upon entry to the function, its value is the index into the this
+ string at which to start searching for the \p from substring, the value
+ must be non-negative and not greater than this string's length; upon exiting
+ the function its value is the index into this string at which the
+ replacement took place or -1 if no replacement took place; if the pointer
+ is null, searching always starts at index 0
+
+ @since LibreOffice 3.6
+ */
+ template< typename T1, typename T2 >
+ SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type
+ replaceFirst( T1& from, T2& to, sal_Int32 * index = NULL) const
+ {
+ assert(libreoffice_internal::ConstCharArrayDetector<T1>::isValid(from));
+ assert(libreoffice_internal::ConstCharArrayDetector<T2>::isValid(to));
+ rtl_uString * s = NULL;
+ sal_Int32 i = 0;
+ rtl_uString_newReplaceFirstAsciiLAsciiL(
+ &s, pData,
+ libreoffice_internal::ConstCharArrayDetector<T1>::toPointer(from),
+ libreoffice_internal::ConstCharArrayDetector<T1>::length,
+ libreoffice_internal::ConstCharArrayDetector<T2>::toPointer(to),
+ libreoffice_internal::ConstCharArrayDetector<T2>::length,
+ index == NULL ? &i : index);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns a new string resulting from replacing all occurrences of a given
+ substring with another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param from the substring to be replaced
+
+ @param to the replacing substring
+
+ @param fromIndex the position in the string where we will begin searching
+
+ @since LibreOffice 4.0
+ */
+#if defined LIBO_INTERNAL_ONLY
+ [[nodiscard]] OUString replaceAll(
+ std::u16string_view from, std::u16string_view to, sal_Int32 fromIndex = 0) const
+ {
+ rtl_uString * s = nullptr;
+ rtl_uString_newReplaceAllFromIndexUtf16LUtf16L(
+ &s, pData, from.data(), from.size(), to.data(), to.size(), fromIndex);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#else
+ SAL_WARN_UNUSED_RESULT OUString replaceAll(
+ OUString const & from, OUString const & to, sal_Int32 fromIndex = 0) const
+ {
+ rtl_uString * s = NULL;
+ rtl_uString_newReplaceAllFromIndex(&s, pData, from.pData, to.pData, fromIndex);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#endif
+
+ /**
+ Returns a new string resulting from replacing all occurrences of a given
+ substring with another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param from ASCII string literal, the substring to be replaced
+
+ @param to the replacing substring
+
+ @since LibreOffice 3.6
+ */
+#if defined LIBO_INTERNAL_ONLY
+ template<typename T> [[nodiscard]]
+ typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceAll(
+ T & from, std::u16string_view to) const
+ {
+ assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
+ rtl_uString * s = nullptr;
+ rtl_uString_newReplaceAllAsciiLUtf16L(
+ &s, pData, libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, to.data(), to.size());
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#else
+ template< typename T >
+ SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll( T& from, OUString const & to) const
+ {
+ assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
+ rtl_uString * s = NULL;
+ rtl_uString_newReplaceAllAsciiL(
+ &s, pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, to.pData);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#endif
+
+ /**
+ Returns a new string resulting from replacing all occurrences of a given
+ substring with another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param from the substring to be replaced
+
+ @param to ASCII string literal, the replacing substring
+
+ @since LibreOffice 5.1
+ */
+#if defined LIBO_INTERNAL_ONLY
+ template<typename T> [[nodiscard]]
+ typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceAll(
+ std::u16string_view from, T & to) const
+ {
+ assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
+ rtl_uString * s = nullptr;
+ rtl_uString_newReplaceAllUtf16LAsciiL(
+ &s, pData, from.data(), from.size(),
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#else
+ template< typename T >
+ SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll( OUString const & from, T& to) const
+ {
+ assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
+ rtl_uString * s = NULL;
+ rtl_uString_newReplaceAllToAsciiL(
+ &s, pData, from.pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+#endif
+
+ /**
+ Returns a new string resulting from replacing all occurrences of a given
+ substring with another substring.
+
+ Replacing subsequent occurrences picks up only after a given replacement.
+ That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
+
+ @param from ASCII string literal, the substring to be replaced
+
+ @param to ASCII string literal, the substring to be replaced
+
+ @since LibreOffice 3.6
+ */
+ template< typename T1, typename T2 >
+ SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type
+ replaceAll( T1& from, T2& to ) const
+ {
+ assert(libreoffice_internal::ConstCharArrayDetector<T1>::isValid(from));
+ assert(libreoffice_internal::ConstCharArrayDetector<T2>::isValid(to));
+ rtl_uString * s = NULL;
+ rtl_uString_newReplaceAllAsciiLAsciiL(
+ &s, pData,
+ libreoffice_internal::ConstCharArrayDetector<T1>::toPointer(from),
+ libreoffice_internal::ConstCharArrayDetector<T1>::length,
+ libreoffice_internal::ConstCharArrayDetector<T2>::toPointer(to),
+ libreoffice_internal::ConstCharArrayDetector<T2>::length);
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Converts from this string all ASCII uppercase characters (65-90)
+ to ASCII lowercase characters (97-122).
+
+ This function can't be used for language specific conversion.
+ If the string doesn't contain characters which must be converted,
+ then the new string is assigned with str.
+
+ @return the string, converted to ASCII lowercase.
+ */
+ SAL_WARN_UNUSED_RESULT OUString toAsciiLowerCase() const
+ {
+ rtl_uString* pNew = NULL;
+ rtl_uString_newToAsciiLowerCase( &pNew, pData );
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Converts from this string all ASCII lowercase characters (97-122)
+ to ASCII uppercase characters (65-90).
+
+ This function can't be used for language specific conversion.
+ If the string doesn't contain characters which must be converted,
+ then the new string is assigned with str.
+
+ @return the string, converted to ASCII uppercase.
+ */
+ SAL_WARN_UNUSED_RESULT OUString toAsciiUpperCase() const
+ {
+ rtl_uString* pNew = NULL;
+ rtl_uString_newToAsciiUpperCase( &pNew, pData );
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Returns a new string resulting from removing white space from both ends
+ of the string.
+
+ All characters that have codes less than or equal to
+ 32 (the space character), and Unicode General Punctuation area Space
+ and some Control characters are considered to be white space (see
+ implIsWhitespace).
+ If the string doesn't contain white spaces at both ends,
+ then the new string is assigned with str.
+
+ @return the string, with white space removed from the front and end.
+ */
+ SAL_WARN_UNUSED_RESULT OUString trim() const
+ {
+ rtl_uString* pNew = NULL;
+ rtl_uString_newTrim( &pNew, pData );
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Returns a token in the string.
+
+ Example:
+ sal_Int32 nIndex = 0;
+ do
+ {
+ ...
+ OUString aToken = aStr.getToken( 0, ';', nIndex );
+ ...
+ }
+ while ( nIndex >= 0 );
+
+ @param token the number of the token to return
+ @param cTok the character which separate the tokens.
+ @param index the position at which the token is searched in the
+ string.
+ The index must not be greater than the length of the
+ string.
+ This param is set to the position of the
+ next token or to -1, if it is the last token.
+ @return the token; if either token or index is negative, an empty token
+ is returned (and index is set to -1)
+ */
+ OUString getToken( sal_Int32 token, sal_Unicode cTok, sal_Int32& index ) const
+ {
+ rtl_uString * pNew = NULL;
+ index = rtl_uString_getToken( &pNew, pData, token, cTok, index );
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Returns a token from the string.
+
+ The same as getToken(sal_Int32, sal_Unicode, sal_Int32 &), but always
+ passing in 0 as the start index in the third argument.
+
+ @param count the number of the token to return, starting with 0
+ @param separator the character which separates the tokens
+
+ @return the given token, or an empty string
+
+ @since LibreOffice 3.6
+ */
+ OUString getToken(sal_Int32 count, sal_Unicode separator) const {
+ sal_Int32 n = 0;
+ return getToken(count, separator, n);
+ }
+
+ /**
+ Returns the Boolean value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @return true, if the string is 1 or "True" in any ASCII case.
+ false in any other case.
+ */
+ bool toBoolean() const
+ {
+ return rtl_ustr_toBoolean( pData->buffer );
+ }
+
+ /**
+ Returns the first character from this string.
+
+ @return the first character from this string or 0, if this string
+ is empty.
+ */
+ sal_Unicode toChar() const
+ {
+ return pData->buffer[0];
+ }
+
+ /**
+ Returns the int32 value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @param radix the radix (between 2 and 36)
+ @return the int32 represented from this string.
+ 0 if this string represents no number or one of too large
+ magnitude.
+ */
+ sal_Int32 toInt32( sal_Int16 radix = 10 ) const
+ {
+ return rtl_ustr_toInt32( pData->buffer, radix );
+ }
+
+ /**
+ Returns the uint32 value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @param radix the radix (between 2 and 36)
+ @return the uint32 represented from this string.
+ 0 if this string represents no number or one of too large
+ magnitude.
+
+ @since LibreOffice 4.2
+ */
+ sal_uInt32 toUInt32( sal_Int16 radix = 10 ) const
+ {
+ return rtl_ustr_toUInt32( pData->buffer, radix );
+ }
+
+ /**
+ Returns the int64 value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @param radix the radix (between 2 and 36)
+ @return the int64 represented from this string.
+ 0 if this string represents no number or one of too large
+ magnitude.
+ */
+ sal_Int64 toInt64( sal_Int16 radix = 10 ) const
+ {
+ return rtl_ustr_toInt64( pData->buffer, radix );
+ }
+
+ /**
+ Returns the uint64 value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @param radix the radix (between 2 and 36)
+ @return the uint64 represented from this string.
+ 0 if this string represents no number or one of too large
+ magnitude.
+
+ @since LibreOffice 4.1
+ */
+ sal_uInt64 toUInt64( sal_Int16 radix = 10 ) const
+ {
+ return rtl_ustr_toUInt64( pData->buffer, radix );
+ }
+
+ /**
+ Returns the float value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @return the float represented from this string.
+ 0.0 if this string represents no number.
+ */
+ float toFloat() const
+ {
+ return rtl_ustr_toFloat( pData->buffer );
+ }
+
+ /**
+ Returns the double value from this string.
+
+ This function can't be used for language specific conversion.
+
+ @return the double represented from this string.
+ 0.0 if this string represents no number.
+ */
+ double toDouble() const
+ {
+ return rtl_ustr_toDouble( pData->buffer );
+ }
+
+
+ /**
+ Return a canonical representation for a string.
+
+ A pool of strings, initially empty is maintained privately
+ by the string class. On invocation, if present in the pool
+ the original string will be returned. Otherwise this string,
+ or a copy thereof will be added to the pool and returned.
+
+ @return
+ a version of the string from the pool.
+
+ @exception std::bad_alloc is thrown if an out-of-memory condition occurs
+
+ @since UDK 3.2.7
+ */
+ OUString intern() const
+ {
+ rtl_uString * pNew = NULL;
+ rtl_uString_intern( &pNew, pData );
+ if (pNew == NULL) {
+ throw std::bad_alloc();
+ }
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Return a canonical representation for a converted string.
+
+ A pool of strings, initially empty is maintained privately
+ by the string class. On invocation, if present in the pool
+ the original string will be returned. Otherwise this string,
+ or a copy thereof will be added to the pool and returned.
+
+ @param value a 8-Bit character array.
+ @param length the number of character which should be converted.
+ The 8-Bit character array length must be
+ greater than or equal to this value.
+ @param encoding the text encoding from which the 8-Bit character
+ sequence should be converted.
+ @param convertFlags flags which controls the conversion.
+ see RTL_TEXTTOUNICODE_FLAGS_...
+ @param pInfo pointer to return conversion status or NULL.
+
+ @return
+ a version of the converted string from the pool.
+
+ @exception std::bad_alloc is thrown if an out-of-memory condition occurs
+
+ @since UDK 3.2.7
+ */
+ static OUString intern( const char * value, sal_Int32 length,
+ rtl_TextEncoding encoding,
+ sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS,
+ sal_uInt32 *pInfo = NULL )
+ {
+ rtl_uString * pNew = NULL;
+ rtl_uString_internConvert( &pNew, value, length, encoding,
+ convertFlags, pInfo );
+ if (pNew == NULL) {
+ throw std::bad_alloc();
+ }
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+
+ /**
+ Converts to an OString, signalling failure.
+
+ @param pTarget
+ An out parameter receiving the converted OString. Must not be null; the
+ contents are not modified if conversion fails (convertToOString returns
+ false).
+
+ @param nEncoding
+ The text encoding to convert into. Must be an octet encoding (i.e.,
+ rtl_isOctetTextEncoding(nEncoding) must return true).
+
+ @param nFlags
+ A combination of RTL_UNICODETOTEXT_FLAGS that detail how to do the
+ conversion (see rtl_convertUnicodeToText). RTL_UNICODETOTEXT_FLAGS_FLUSH
+ need not be included, it is implicitly assumed. Typical uses are either
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR (fail if a Unicode character cannot
+ be converted to the target nEncoding) or OUSTRING_TO_OSTRING_CVTFLAGS
+ (make a best efforts conversion).
+
+ @return
+ True if the conversion succeeded, false otherwise.
+ */
+ bool convertToString(OString * pTarget, rtl_TextEncoding nEncoding,
+ sal_uInt32 nFlags) const
+ {
+ return rtl_convertUStringToString(&pTarget->pData, pData->buffer,
+ pData->length, nEncoding, nFlags);
+ }
+
+ /** Iterate through this string based on code points instead of UTF-16 code
+ units.
+
+ See Chapter 3 of The Unicode Standard 5.0 (Addison--Wesley, 2006) for
+ definitions of the various terms used in this description.
+
+ This string is interpreted as a sequence of zero or more UTF-16 code
+ units. For each index into this sequence (from zero to one less than
+ the length of the sequence, inclusive), a code point represented
+ starting at the given index is computed as follows:
+
+ - If the UTF-16 code unit addressed by the index constitutes a
+ well-formed UTF-16 code unit sequence, the computed code point is the
+ scalar value encoded by that UTF-16 code unit sequence.
+
+ - Otherwise, if the index is at least two UTF-16 code units away from
+ the end of the sequence, and the sequence of two UTF-16 code units
+ addressed by the index constitutes a well-formed UTF-16 code unit
+ sequence, the computed code point is the scalar value encoded by that
+ UTF-16 code unit sequence.
+
+ - Otherwise, the computed code point is the UTF-16 code unit addressed
+ by the index. (This last case catches unmatched surrogates as well as
+ indices pointing into the middle of surrogate pairs.)
+
+ @param indexUtf16
+ pointer to a UTF-16 based index into this string; must not be null. On
+ entry, the index must be in the range from zero to the length of this
+ string (in UTF-16 code units), inclusive. Upon successful return, the
+ index will be updated to address the UTF-16 code unit that is the given
+ incrementCodePoints away from the initial index.
+
+ @param incrementCodePoints
+ the number of code points to move the given *indexUtf16. If
+ non-negative, moving is done after determining the code point at the
+ index. If negative, moving is done before determining the code point
+ at the (then updated) index. The value must be such that the resulting
+ UTF-16 based index is in the range from zero to the length of this
+ string (in UTF-16 code units), inclusive.
+
+ @return
+ the code point (an integer in the range from 0 to 0x10FFFF, inclusive)
+ that is represented within this string starting at the index computed as
+ follows: If incrementCodePoints is non-negative, the index is the
+ initial value of *indexUtf16; if incrementCodePoints is negative, the
+ index is the updated value of *indexUtf16. In either case, the computed
+ index must be in the range from zero to one less than the length of this
+ string (in UTF-16 code units), inclusive.
+
+ @since UDK 3.2.7
+ */
+ sal_uInt32 iterateCodePoints(
+ sal_Int32 * indexUtf16, sal_Int32 incrementCodePoints = 1) const
+ {
+ return rtl_uString_iterateCodePoints(
+ pData, indexUtf16, incrementCodePoints);
+ }
+
+ /**
+ * Convert an OString to an OUString, assuming that the OString is
+ * UTF-8-encoded.
+ *
+ * @param rSource
+ * an OString to convert
+ *
+ * @since LibreOffice 4.4
+ */
+#if defined LIBO_INTERNAL_ONLY
+ static OUString fromUtf8(std::string_view rSource)
+ {
+ OUString aTarget;
+ bool bSuccess = rtl_convertStringToUString(&aTarget.pData,
+ rSource.data(),
+ rSource.length(),
+ RTL_TEXTENCODING_UTF8,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
+ (void) bSuccess;
+ assert(bSuccess);
+ return aTarget;
+ }
+#else
+ static OUString fromUtf8(const OString& rSource)
+ {
+ OUString aTarget;
+ bool bSuccess = rtl_convertStringToUString(&aTarget.pData,
+ rSource.getStr(),
+ rSource.getLength(),
+ RTL_TEXTENCODING_UTF8,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
+ (void) bSuccess;
+ assert(bSuccess);
+ return aTarget;
+ }
+#endif
+
+ /**
+ * Convert this string to an OString, assuming that the string can be
+ * UTF-8-encoded successfully.
+ *
+ * In other words, you must not use this method on a random sequence of
+ * UTF-16 code units, but only at places where it is assumed that the
+ * content is a proper string.
+ *
+ * @since LibreOffice 4.4
+ */
+ OString toUtf8() const
+ {
+ OString aTarget;
+ bool bSuccess = rtl_convertUStringToString(&aTarget.pData,
+ getStr(),
+ getLength(),
+ RTL_TEXTENCODING_UTF8,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR|RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR);
+ (void) bSuccess;
+ assert(bSuccess);
+ return aTarget;
+ }
+
+#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+
+ static OUStringNumber< int > number( int i, sal_Int16 radix = 10 )
+ {
+ return OUStringNumber< int >( i, radix );
+ }
+ static OUStringNumber< long long > number( long long ll, sal_Int16 radix = 10 )
+ {
+ return OUStringNumber< long long >( ll, radix );
+ }
+ static OUStringNumber< unsigned long long > number( unsigned long long ll, sal_Int16 radix = 10 )
+ {
+ return OUStringNumber< unsigned long long >( ll, radix );
+ }
+ static OUStringNumber< unsigned long long > number( unsigned int i, sal_Int16 radix = 10 )
+ {
+ return number( static_cast< unsigned long long >( i ), radix );
+ }
+ static OUStringNumber< long long > number( long i, sal_Int16 radix = 10)
+ {
+ return number( static_cast< long long >( i ), radix );
+ }
+ static OUStringNumber< unsigned long long > number( unsigned long i, sal_Int16 radix = 10 )
+ {
+ return number( static_cast< unsigned long long >( i ), radix );
+ }
+ static OUStringNumber< float > number( float f )
+ {
+ return OUStringNumber< float >( f );
+ }
+ static OUStringNumber< double > number( double d )
+ {
+ return OUStringNumber< double >( d );
+ }
+#else
+ /**
+ Returns the string representation of the integer argument.
+
+ This function can't be used for language specific conversion.
+
+ @param i an integer value
+ @param radix the radix (between 2 and 36)
+ @return a string with the string representation of the argument.
+ @since LibreOffice 4.1
+ */
+ static OUString number( int i, sal_Int16 radix = 10 )
+ {
+ sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFINT32];
+ return OUString(aBuf, rtl_ustr_valueOfInt32(aBuf, i, radix));
+ }
+ /// @overload
+ /// @since LibreOffice 4.1
+ static OUString number( unsigned int i, sal_Int16 radix = 10 )
+ {
+ return number( static_cast< unsigned long long >( i ), radix );
+ }
+ /// @overload
+ /// @since LibreOffice 4.1
+ static OUString number( long i, sal_Int16 radix = 10)
+ {
+ return number( static_cast< long long >( i ), radix );
+ }
+ /// @overload
+ /// @since LibreOffice 4.1
+ static OUString number( unsigned long i, sal_Int16 radix = 10 )
+ {
+ return number( static_cast< unsigned long long >( i ), radix );
+ }
+ /// @overload
+ /// @since LibreOffice 4.1
+ static OUString number( long long ll, sal_Int16 radix = 10 )
+ {
+ sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFINT64];
+ return OUString(aBuf, rtl_ustr_valueOfInt64(aBuf, ll, radix));
+ }
+ /// @overload
+ /// @since LibreOffice 4.1
+ static OUString number( unsigned long long ll, sal_Int16 radix = 10 )
+ {
+ sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFUINT64];
+ return OUString(aBuf, rtl_ustr_valueOfUInt64(aBuf, ll, radix));
+ }
+
+ /**
+ Returns the string representation of the float argument.
+
+ This function can't be used for language specific conversion.
+
+ @param f a float.
+ @return a string with the decimal representation of the argument.
+ @since LibreOffice 4.1
+ */
+ static OUString number( float f )
+ {
+ sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFFLOAT];
+ return OUString(aBuf, rtl_ustr_valueOfFloat(aBuf, f));
+ }
+
+ /**
+ Returns the string representation of the double argument.
+
+ This function can't be used for language specific conversion.
+
+ @param d a double.
+ @return a string with the decimal representation of the argument.
+ @since LibreOffice 4.1
+ */
+ static OUString number( double d )
+ {
+ sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFDOUBLE];
+ return OUString(aBuf, rtl_ustr_valueOfDouble(aBuf, d));
+ }
+#endif
+
+ /**
+ Returns the string representation of the sal_Bool argument.
+
+ If the sal_Bool is true, the string "true" is returned.
+ If the sal_Bool is false, the string "false" is returned.
+ This function can't be used for language specific conversion.
+
+ @param b a sal_Bool.
+ @return a string with the string representation of the argument.
+ @deprecated use boolean()
+ */
+ SAL_DEPRECATED("use boolean()") static OUString valueOf( sal_Bool b )
+ {
+ return boolean(b);
+ }
+
+ /**
+ Returns the string representation of the boolean argument.
+
+ If the argument is true, the string "true" is returned.
+ If the argument is false, the string "false" is returned.
+ This function can't be used for language specific conversion.
+
+ @param b a bool.
+ @return a string with the string representation of the argument.
+ @since LibreOffice 4.1
+ */
+ static OUString boolean( bool b )
+ {
+ sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFBOOLEAN];
+ return OUString(aBuf, rtl_ustr_valueOfBoolean(aBuf, b));
+ }
+
+ /**
+ Returns the string representation of the char argument.
+
+ @param c a character.
+ @return a string with the string representation of the argument.
+ @deprecated use operator, function or constructor taking char or sal_Unicode argument
+ */
+ SAL_DEPRECATED("convert to OUString or use directly") static OUString valueOf( sal_Unicode c )
+ {
+ return OUString( &c, 1 );
+ }
+
+ /**
+ Returns the string representation of the int argument.
+
+ This function can't be used for language specific conversion.
+
+ @param i a int32.
+ @param radix the radix (between 2 and 36)
+ @return a string with the string representation of the argument.
+ @deprecated use number()
+ */
+ SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int32 i, sal_Int16 radix = 10 )
+ {
+ return number( i, radix );
+ }
+
+ /**
+ Returns the string representation of the long argument.
+
+ This function can't be used for language specific conversion.
+
+ @param ll a int64.
+ @param radix the radix (between 2 and 36)
+ @return a string with the string representation of the argument.
+ @deprecated use number()
+ */
+ SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int64 ll, sal_Int16 radix = 10 )
+ {
+ return number( ll, radix );
+ }
+
+ /**
+ Returns the string representation of the float argument.
+
+ This function can't be used for language specific conversion.
+
+ @param f a float.
+ @return a string with the string representation of the argument.
+ @deprecated use number()
+ */
+ SAL_DEPRECATED("use number()") static OUString valueOf( float f )
+ {
+ return number(f);
+ }
+
+ /**
+ Returns the string representation of the double argument.
+
+ This function can't be used for language specific conversion.
+
+ @param d a double.
+ @return a string with the string representation of the argument.
+ @deprecated use number()
+ */
+ SAL_DEPRECATED("use number()") static OUString valueOf( double d )
+ {
+ return number(d);
+ }
+
+ /**
+ Returns an OUString copied without conversion from an ASCII
+ character string.
+
+ Since this method is optimized for performance, the ASCII character
+ values are not converted in any way. The caller has to make sure that
+ all ASCII characters are in the allowed range between 0 and 127.
+ The ASCII string must be NULL-terminated.
+
+ Note that for string literals it is simpler and more efficient
+ to directly use the OUString constructor.
+
+ @param value the 8-Bit ASCII character string
+ @return a string with the string representation of the argument.
+ */
+ static OUString createFromAscii( const char * value )
+ {
+ rtl_uString* pNew = NULL;
+ rtl_uString_newFromAscii( &pNew, value );
+ return OUString( pNew, SAL_NO_ACQUIRE );
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ static OUString createFromAscii(std::string_view value) {
+ rtl_uString * p = nullptr;
+ rtl_uString_newFromLiteral(&p, value.data(), value.size(), 0); //TODO: check for overflow
+ return OUString(p, SAL_NO_ACQUIRE);
+ }
+ #endif
+
+#if defined LIBO_INTERNAL_ONLY
+ operator std::u16string_view() const { return {getStr(), sal_uInt32(getLength())}; }
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ // A wrapper for the first expression in an
+ //
+ // OUString::Concat(e1) + e2 + ...
+ //
+ // concatenation chain, when neither of the first two e1, e2 is one of our rtl string-related
+ // classes (so something like
+ //
+ // OUString s = "a" + (b ? std::u16string_view(u"c") : std::u16string_view(u"dd"));
+ //
+ // would not compile):
+ template<typename T> [[nodiscard]] static
+ typename std::enable_if_t<
+ ToStringHelper<T>::allowOUStringConcat, OUStringConcat<OUStringConcatMarker, T>>
+ Concat(T const & value) { return OUStringConcat<OUStringConcatMarker, T>({}, value); }
+
+ // This overload is needed so that an argument of type 'char const[N]' ends up as
+ // 'OUStringConcat<rtl::OUStringConcatMarker, char const[N]>' rather than as
+ // 'OUStringConcat<rtl::OUStringConcatMarker, char[N]>':
+ template<typename T, std::size_t N> [[nodiscard]] static
+ typename std::enable_if_t<
+ ToStringHelper<T[N]>::allowOUStringConcat, OUStringConcat<OUStringConcatMarker, T[N]>>
+ Concat(T (& value)[N]) { return OUStringConcat<OUStringConcatMarker, T[N]>({}, value); }
+#endif
+
+private:
+ OUString & internalAppend( rtl_uString* pOtherData )
+ {
+ rtl_uString* pNewData = NULL;
+ rtl_uString_newConcat( &pNewData, pData, pOtherData );
+ if (pNewData == NULL) {
+ throw std::bad_alloc();
+ }
+ rtl_uString_assign(&pData, pNewData);
+ rtl_uString_release(pNewData);
+ return *this;
+ }
+
+};
+
+#if defined LIBO_INTERNAL_ONLY
+// Can only define this after we define OUString
+inline OUStringConstExpr::operator const OUString &() const { return OUString::unacquired(&pData); }
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
+// Prevent the operator ==/!= overloads with 'sal_Unicode const *' parameter from
+// being selected for nonsensical code like
+//
+// if (ouIdAttr == nullptr)
+//
+void operator ==(OUString const &, std::nullptr_t) = delete;
+void operator ==(std::nullptr_t, OUString const &) = delete;
+void operator !=(OUString const &, std::nullptr_t) = delete;
+void operator !=(std::nullptr_t, OUString const &) = delete;
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
+inline bool operator ==(OUString const & lhs, OUStringConcatenation const & rhs)
+{ return lhs == std::u16string_view(rhs); }
+inline bool operator !=(OUString const & lhs, OUStringConcatenation const & rhs)
+{ return lhs != std::u16string_view(rhs); }
+inline bool operator ==(OUStringConcatenation const & lhs, OUString const & rhs)
+{ return std::u16string_view(lhs) == rhs; }
+inline bool operator !=(OUStringConcatenation const & lhs, OUString const & rhs)
+{ return std::u16string_view(lhs) != rhs; }
+#endif
+
+#if defined LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+/// @cond INTERNAL
+
+/**
+ @internal
+*/
+template<>
+struct ToStringHelper< OUString >
+ {
+ static std::size_t length( const OUString& s ) { return s.getLength(); }
+ static sal_Unicode* addData( sal_Unicode* buffer, const OUString& s ) { return addDataHelper( buffer, s.getStr(), s.getLength()); }
+ static const bool allowOStringConcat = false;
+ static const bool allowOUStringConcat = true;
+ };
+
+/**
+ @internal
+*/
+template<std::size_t N>
+struct ToStringHelper< OUStringLiteral<N> >
+ {
+ static std::size_t length( const OUStringLiteral<N>& str ) { return str.getLength(); }
+ static sal_Unicode* addData( sal_Unicode* buffer, const OUStringLiteral<N>& str ) { return addDataHelper( buffer, str.getStr(), str.getLength() ); }
+ static const bool allowOStringConcat = false;
+ static const bool allowOUStringConcat = true;
+ };
+
+/**
+ @internal
+*/
+template< typename charT, typename traits, typename T1, typename T2 >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, OUStringConcat< T1, T2 >&& concat)
+{
+ return stream << OUString( std::move(concat) );
+}
+
+
+/// @endcond
+#endif
+
+/** A helper to use OUStrings with hash maps.
+
+ Instances of this class are unary function objects that can be used as
+ hash function arguments to std::unordered_map and similar constructs.
+ */
+struct OUStringHash
+{
+ /** Compute a hash code for a string.
+
+ @param rString
+ a string.
+
+ @return
+ a hash code for the string. This hash code should not be stored
+ persistently, as its computation may change in later revisions.
+ */
+ size_t operator()(const OUString& rString) const
+ { return static_cast<size_t>(rString.hashCode()); }
+};
+
+/* ======================================================================= */
+
+/** Convert an OString to an OUString, using a specific text encoding.
+
+ The lengths of the two strings may differ (e.g., for double-byte
+ encodings, UTF-7, UTF-8).
+
+ @param rStr
+ an OString to convert.
+
+ @param encoding
+ the text encoding to use for conversion.
+
+ @param convertFlags
+ flags which control the conversion. Either use
+ OSTRING_TO_OUSTRING_CVTFLAGS, or see
+ <http://udk.openoffice.org/cpp/man/spec/textconversion.html> for more
+ details.
+ */
+#if defined LIBO_INTERNAL_ONLY
+inline OUString OStringToOUString( std::string_view rStr,
+ rtl_TextEncoding encoding,
+ sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
+{
+ return OUString( rStr.data(), rStr.length(), encoding, convertFlags );
+}
+#else
+inline OUString OStringToOUString( const OString & rStr,
+ rtl_TextEncoding encoding,
+ sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
+{
+ return OUString( rStr.getStr(), rStr.getLength(), encoding, convertFlags );
+}
+#endif
+
+/** Convert an OUString to an OString, using a specific text encoding.
+
+ The lengths of the two strings may differ (e.g., for double-byte
+ encodings, UTF-7, UTF-8).
+
+ @param rUnicode
+ an OUString to convert.
+
+ @param encoding
+ the text encoding to use for conversion.
+
+ @param convertFlags
+ flags which control the conversion. Either use
+ OUSTRING_TO_OSTRING_CVTFLAGS, or see
+ <http://udk.openoffice.org/cpp/man/spec/textconversion.html> for more
+ details.
+ */
+#if defined LIBO_INTERNAL_ONLY
+inline OString OUStringToOString( std::u16string_view rUnicode,
+ rtl_TextEncoding encoding,
+ sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
+{
+ return OString( rUnicode.data(), rUnicode.length(), encoding, convertFlags );
+}
+#else
+inline OString OUStringToOString( const OUString & rUnicode,
+ rtl_TextEncoding encoding,
+ sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
+{
+ return OString( rUnicode.getStr(), rUnicode.getLength(), encoding, convertFlags );
+}
+#endif
+
+/* ======================================================================= */
+
+/**
+ Support for rtl::OUString in std::ostream (and thus in
+ CPPUNIT_ASSERT or SAL_INFO macros, for example).
+
+ The rtl::OUString is converted to UTF-8.
+
+ @since LibreOffice 3.5.
+*/
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, OUString const & rString)
+{
+ return stream <<
+ OUStringToOString(rString, RTL_TEXTENCODING_UTF8);
+ // best effort; potentially loses data due to conversion failures
+ // (stray surrogate halves) and embedded null characters
+}
+
+} // namespace
+
+#ifdef RTL_STRING_UNITTEST
+namespace rtl
+{
+typedef rtlunittest::OUString OUString;
+}
+#endif
+
+// In internal code, allow to use classes like OUString without having to
+// explicitly refer to the rtl namespace, which is kind of superfluous given
+// that OUString itself is namespaced by its OU prefix:
+#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
+using ::rtl::OUString;
+using ::rtl::OUStringHash;
+using ::rtl::OStringToOUString;
+using ::rtl::OUStringToOString;
+using ::rtl::OUStringLiteral;
+using ::rtl::OUStringChar;
+using ::rtl::OUStringConcatenation;
+#endif
+
+/// @cond INTERNAL
+/**
+ Make OUString hashable by default for use in STL containers.
+
+ @since LibreOffice 6.0
+*/
+#if defined LIBO_INTERNAL_ONLY
+namespace std {
+
+template<>
+struct hash<::rtl::OUString>
+{
+ std::size_t operator()(::rtl::OUString const & s) const
+ { return std::size_t(s.hashCode()); }
+};
+
+}
+
+#endif
+/// @endcond
+
+#endif /* _RTL_USTRING_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rtl/uuid.h b/include/rtl/uuid.h
new file mode 100644
index 000000000..e65c5e12b
--- /dev/null
+++ b/include/rtl/uuid.h
@@ -0,0 +1,186 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_RTL_UUID_H
+#define INCLUDED_RTL_UUID_H
+
+#include "sal/config.h"
+
+#include "rtl/string.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+/**
+ @file
+ Specification (from draft-leach-uuids-guids-01.txt )
+
+ <p>
+ A UUID is an identifier that is unique across both space and time,
+ with respect to the space of all UUIDs. To be precise, the UUID
+ consists of a finite bit space. Thus, collision cannot be avoided in
+ principle. A UUID can be used for multiple purposes, from tagging objects
+ with an extremely short lifetime, to reliably identifying very persistent
+ objects across a network.
+
+ <p>
+ The generation of UUIDs does not require that a registration
+ authority be contacted for each identifier. Instead, Version 4 UUIDs are
+ generated from (pseudo unique) sequences of (pseudo) random bits.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Generates a new Version 4 (random number based) UUID (Universally Unique
+ IDentifier).
+
+ @param pTargetUUID pointer to at least 16 bytes of memory. After the call it contains
+ the newly generated uuid in network byte order.
+ @param pPredecessorUUID ignored (was used when this function returned
+ Version 1 instead of Version 4 UUIDs).
+ @param bUseEthernetAddress ignored (was used when this function returned
+ Version 1 instead of Version 4 UUIDs).
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_createUuid(
+ sal_uInt8 *pTargetUUID,
+ const sal_uInt8 *pPredecessorUUID,
+ sal_Bool bUseEthernetAddress );
+
+/** Compare two UUID's lexically
+
+ <p>
+ Note: lexical ordering is not temporal ordering!
+ <p>
+ Note: For equalnesschecking, a memcmp(pUUID1,pUUID2,16) is more efficient
+
+ @return
+ <ul>
+ <li>-1 u1 is lexically before u2
+ <li>0 u1 is equal to u2
+ <li>1 u1 is lexically after u2
+ </ul>
+
+ */
+SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_compareUuid(
+ const sal_uInt8 *pUUID1 , const sal_uInt8 *pUUID2 );
+
+/** Creates named UUIDs.
+
+ <p>
+ The version 3 UUID is meant for generating UUIDs from <em>names</em> that
+ are drawn from, and unique within, some <em>name space</em>. Some examples
+ of names (and, implicitly, name spaces) might be DNS names, URLs, ISO
+ Object IDs (OIDs), reserved words in a programming language, or X.500
+ Distinguished Names (DNs); thus, the concept of name and name space
+ should be broadly construed, and not limited to textual names.
+
+ <p>
+ The requirements for such UUIDs are as follows:
+
+ <ul>
+ <li> The UUIDs generated at different times from the same name in the
+ same namespace MUST be equal
+
+ <li> The UUIDs generated from two different names in the same namespace
+ should be different (with very high probability)
+
+ <li> The UUIDs generated from the same name in two different namespaces
+ should be different with (very high probability)
+
+ <li> If two UUIDs that were generated from names are equal, then they
+ were generated from the same name in the same namespace (with very
+ high probability).
+ </ul>
+
+ @param pTargetUUID pointer to at least 16 bytes of memory. After the call
+ it contains the newly generated uuid in network byte order.
+ @param pNameSpaceUUID The namespace uuid. Below are some predefined ones,
+ but any arbitrary uuid can be used as namespace.
+
+ @param pName the name
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_createNamedUuid(
+ sal_uInt8 *pTargetUUID,
+ const sal_uInt8 *pNameSpaceUUID,
+ const rtl_String *pName
+ );
+
+
+
+/*
+ Predefined Namespaces
+ (Use them the following way : sal_uInt8 aNsDNS[16]) = RTL_UUID_NAMESPACE_DNS;
+ */
+/** namespace DNS
+
+ <p>
+ (Use them the following way : sal_uInt8 aNsDNS[16]) = RTL_UUID_NAMESPACE_DNS;
+ <p>
+ 6ba7b810-9dad-11d1-80b4-00c04fd430c8 */
+#define RTL_UUID_NAMESPACE_DNS {\
+ 0x6b,0xa7,0xb8,0x10,\
+ 0x9d,0xad,\
+ 0x11,0xd1,\
+ 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
+ }
+
+/** namespace URL
+
+ <p>
+ 6ba7b811-9dad-11d1-80b4-00c04fd430c8 */
+#define RTL_UUID_NAMESPACE_URL { \
+ 0x6b, 0xa7, 0xb8, 0x11,\
+ 0x9d, 0xad,\
+ 0x11, 0xd1,\
+ 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
+ }
+
+/** namespace oid
+
+ <p>
+ 6ba7b812-9dad-11d1-80b4-00c04fd430c8 */
+#define RTL_UUID_NAMESPACE_OID {\
+ 0x6b, 0xa7, 0xb8, 0x12,\
+ 0x9d, 0xad,\
+ 0x11, 0xd1,\
+ 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
+ }
+
+/** namespace X500
+
+ <p>
+ 6ba7b814-9dad-11d1-80b4-00c04fd430c8 */
+#define RTL_UUID_NAMESPACE_X500 {\
+ 0x6b, 0xa7, 0xb8, 0x14,\
+ 0x9d, 0xad,\
+ 0x11, 0xd1,\
+ 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
+ }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/alloca.h b/include/sal/alloca.h
new file mode 100644
index 000000000..ce6b60cc9
--- /dev/null
+++ b/include/sal/alloca.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SAL_ALLOCA_H
+#define INCLUDED_SAL_ALLOCA_H
+
+#if defined(__sun) || defined(LINUX) || defined(AIX) || defined(ANDROID) || defined(HAIKU) \
+ || defined(MACOSX) || defined(IOS) || defined(EMSCRIPTEN)
+
+#ifndef INCLUDED_ALLOCA_H
+#include <alloca.h>
+#define INCLUDED_ALLOCA_H
+#endif
+
+#elif defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(DRAGONFLY)
+
+#ifndef INCLUDED_STDLIB_H
+#include <stdlib.h>
+#define INCLUDED_STDLIB_H
+#endif
+
+#elif defined(_WIN32)
+
+#ifndef INCLUDED_MALLOC_H
+#include <malloc.h>
+#define INCLUDED_MALLOC_H
+#endif
+
+#else
+
+#error "unknown platform: please check for alloca"
+
+#endif
+
+#endif /* INCLUDED_SAL_ALLOCA_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/backtrace.hxx b/include/sal/backtrace.hxx
new file mode 100644
index 000000000..5f44e5e01
--- /dev/null
+++ b/include/sal/backtrace.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SAL_BACKTRACE_HXX
+#define INCLUDED_SAL_BACKTRACE_HXX
+
+#include "sal/config.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+#include "rtl/ustring.hxx"
+#include <memory>
+
+/// @cond INTERNAL
+/**
+ Two stage API for recording and then later decoding stack backtraces.
+ Useful for debugging facilities where we are only interested in decoding
+ a small handful of recorded stack traces.
+
+ @param backtraceDepth value indicating the maximum backtrace depth; must be > 0
+
+ @since LibreOffice 6.0
+*/
+#if defined LIBO_INTERNAL_ONLY
+
+namespace sal
+{
+struct BacktraceState
+{
+ void** buffer;
+ int nDepth;
+ ~BacktraceState() { delete[] buffer; }
+};
+
+SAL_DLLPUBLIC std::unique_ptr<BacktraceState> backtrace_get(sal_uInt32 backtraceDepth);
+
+SAL_DLLPUBLIC OUString backtrace_to_string(BacktraceState* backtraceState);
+}
+
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/config.h b/include/sal/config.h
new file mode 100644
index 000000000..bf5958519
--- /dev/null
+++ b/include/sal/config.h
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SAL_CONFIG_H
+#define INCLUDED_SAL_CONFIG_H
+
+#if defined LIBO_INTERNAL_ONLY && defined ANDROID && defined __cplusplus
+#include <android/compatibility.hxx>
+#endif
+
+#ifdef _WIN32
+#define SAL_W32
+#define SAL_DLLEXTENSION ".dll"
+#define SAL_EXEEXTENSION ".exe"
+#define SAL_PATHSEPARATOR ';'
+#define SAL_PATHDELIMITER '\\'
+#define SAL_NEWLINE_STRING "\r\n"
+#define SAL_CONFIGFILE(name) name ".ini"
+
+#ifdef _MSC_VER
+
+#ifndef _USE_MATH_DEFINES
+#define _USE_MATH_DEFINES // needed by Visual C++ for math constants
+#endif
+
+#endif /* defined _MSC_VER */
+
+#endif /* defined _WIN32 */
+
+#if defined(__sun) || defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(AIX) \
+ || defined(OPENBSD) || defined(DRAGONFLY) || defined(ANDROID) || defined(HAIKU)
+#define SAL_UNX
+#define SAL_DLLEXTENSION ".so"
+#define SAL_EXEEXTENSION ""
+#define SAL_DLLPREFIX "lib"
+#define SAL_PATHSEPARATOR ':'
+#define SAL_PATHDELIMITER '/'
+#define SAL_NEWLINE_STRING "\n"
+#define SAL_CONFIGFILE(name) name "rc"
+#endif
+
+#ifdef MACOSX
+#define SAL_UNX
+#define SAL_DLLEXTENSION ".dylib"
+#define SAL_EXEEXTENSION ""
+#define SAL_DLLPREFIX "lib"
+#define SAL_PATHSEPARATOR ':'
+#define SAL_PATHDELIMITER '/'
+#define SAL_NEWLINE_STRING "\n"
+#define SAL_CONFIGFILE(name) name "rc"
+#endif
+
+#ifdef IOS
+#define SAL_UNX
+/* SAL_DLLEXTENSION should not really be used on iOS, as iOS apps are
+ * not allowed to load own dynamic libraries.
+ */
+#define SAL_DLLEXTENSION ".dylib"
+#define SAL_DLLPREFIX "lib"
+#define SAL_PATHSEPARATOR ':'
+#define SAL_PATHDELIMITER '/'
+#define SAL_NEWLINE_STRING "\n"
+#define SAL_CONFIGFILE(name) name "rc"
+#endif
+
+#ifdef EMSCRIPTEN
+#define SAL_UNX
+#define SAL_DLLEXTENSION ".bc"
+#define SAL_EXEEXTENSION ""
+#define SAL_DLLPREFIX "lib"
+#define SAL_PATHSEPARATOR ':'
+#define SAL_PATHDELIMITER '/'
+#define SAL_NEWLINE_STRING "\n"
+#define SAL_CONFIGFILE(name) name "rc"
+#endif
+
+/* The following spell is for Solaris and its descendants.
+ * See the "Solaris" section of
+ * <http://sourceforge.net/p/predef/wiki/OperatingSystems/>, and
+ * <http://stackoverflow.com/questions/16618604/solaris-and-preprocessor-macros>.
+ */
+#ifdef sun
+#undef sun
+#define sun sun
+#endif
+
+#if defined __clang__
+#if __has_warning("-Wpotentially-evaluated-expression")
+#pragma GCC diagnostic ignored "-Wpotentially-evaluated-expression"
+#endif
+// Before fixing occurrences of this warning, lets see whether C++20 will still change to obsolete
+// the warning (see
+// <https://github.com/llvm/llvm-project/commit/974c8b7e2fde550fd87850d50695341101c38c2d> "[c++20]
+// Add rewriting from comparison operators to <=> / =="):
+#if __has_warning("-Wambiguous-reversed-operator")
+#pragma GCC diagnostic ignored "-Wambiguous-reversed-operator"
+#endif
+#endif
+
+#endif // INCLUDED_SAL_CONFIG_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/detail/log.h b/include/sal/detail/log.h
new file mode 100644
index 000000000..f68512d16
--- /dev/null
+++ b/include/sal/detail/log.h
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SAL_DETAIL_LOG_H
+#define INCLUDED_SAL_DETAIL_LOG_H
+
+#include "sal/config.h"
+
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+/** @cond INTERNAL */
+
+/* This header makes available replacements working in both C and C++ for the
+ obsolete osl/diagnose.h functionality that in turn is used from both C and
+ C++ code and the obsolete tools/debug.hxx functionality that uses printf-style
+ formatting. Once that obsolete functionality is removed, this header can be
+ removed, too.
+
+ This header uses variadic macros in both C (where they are officially only
+ supported since C99) and C++ (where they are officially only supported since
+ C++11). It appears that all relevant compilers (esp. GCC 4.0 and MS VS 2008
+ Express) already support them in their C and C++ dialects. See also
+ <http://wiki.apache.org/stdcxx/C++0xCompilerSupport>.
+
+ Avoid the use of other sal code in this header as much as possible, so that
+ this code can be called from other sal code without causing endless
+ recursion.
+*/
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+/*
+ Clang warns about 'sal_True && sal_True' (those being integers and not booleans)
+ when it sees preprocessed source (-save-temps or using icecream)
+*/
+#if defined __cplusplus
+#define SAL_LOG_TRUE true
+#define SAL_LOG_FALSE false
+#else
+#define SAL_LOG_TRUE sal_True
+#define SAL_LOG_FALSE sal_False
+#endif
+
+enum sal_detail_LogLevel {
+ SAL_DETAIL_LOG_LEVEL_INFO, SAL_DETAIL_LOG_LEVEL_WARN,
+ SAL_DETAIL_LOG_LEVEL_DEBUG = SAL_MAX_ENUM
+};
+
+SAL_DLLPUBLIC void SAL_CALL sal_detail_logFormat(
+ enum sal_detail_LogLevel level, char const * area, char const * where,
+ char const * format, ...)
+#if defined __GNUC__
+ __attribute__((format(printf, 4, 5)))
+#endif
+ ;
+
+#if defined __cplusplus
+}
+#endif
+
+#define SAL_DETAIL_LOG_FORMAT(condition, level, area, where, ...) \
+ do { \
+ if (condition) { \
+ sal_detail_logFormat((level), (area), (where), __VA_ARGS__); \
+ } \
+ } while (SAL_LOG_FALSE)
+
+#if defined SAL_LOG_INFO
+#define SAL_DETAIL_ENABLE_LOG_INFO SAL_LOG_TRUE
+#else
+#define SAL_DETAIL_ENABLE_LOG_INFO SAL_LOG_FALSE
+#endif
+#if defined SAL_LOG_WARN
+#define SAL_DETAIL_ENABLE_LOG_WARN SAL_LOG_TRUE
+#else
+#define SAL_DETAIL_ENABLE_LOG_WARN SAL_LOG_FALSE
+#endif
+
+#define SAL_DETAIL_WHERE __FILE__ ":" SAL_STRINGIFY(__LINE__) ": "
+
+#define SAL_DETAIL_INFO_IF_FORMAT(condition, area, ...) \
+ SAL_DETAIL_LOG_FORMAT( \
+ SAL_DETAIL_ENABLE_LOG_INFO && (condition), SAL_DETAIL_LOG_LEVEL_INFO, \
+ area, SAL_DETAIL_WHERE, __VA_ARGS__)
+
+#define SAL_DETAIL_WARN_IF_FORMAT(condition, area, ...) \
+ SAL_DETAIL_LOG_FORMAT( \
+ SAL_DETAIL_ENABLE_LOG_WARN && (condition), SAL_DETAIL_LOG_LEVEL_WARN, \
+ area, SAL_DETAIL_WHERE, __VA_ARGS__)
+
+/** @endcond */
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
new file mode 100644
index 000000000..b365b20e1
--- /dev/null
+++ b/include/sal/log-areas.dox
@@ -0,0 +1,654 @@
+// NOTE: This file is also parsed by a compiler plugin. Make sure all
+// areas are marked with '@li @c'.
+
+/**
+@page sal_log_areas SAL debug areas
+
+@short List and description of areas for the SAL debug macros
+
+This is a list of areas that are used by the SAL_INFO family of macros. See
+@ref sal_log "basic log functionality" for details about this functionality.
+
+If you need a debug area in some code, first check this list and use the
+appropriate area if it exists. This list is not definite, if you need a new
+area, use it and add it to an appropriate section with an explanation.
+Generally, use the name of the relevant code module as the first area segment.
+Please keep all entries sorted.
+
+This list should give you an overview of which areas to enable when debugging
+certain functionality.
+
+@section SAL
+
+@li @c sal.bootstrap - SAL bootstrap
+@li @c sal.cppunittester
+@li @c sal.debug - SAL debugging functionality
+@li @c sal.file - file system operations
+@li @c sal.fileio - file I/O
+@li @c sal.osl - SAL OSL library
+@li @c sal.osl.condition
+@li @c sal.osl.mutex
+@li @c sal.osl.pipe
+@li @c sal.rtl - SAL RTL library
+@li @c sal.textenc - the textencoding SAL library
+
+@section basctl
+
+@li @c basctl
+@li @c basctl.basicide
+
+@section basic
+
+@li @c basic
+@li @c basic.sbx
+
+@section bridges
+
+@li @c bridges
+@li @c bridges.ios
+@li @c bridges.osx
+
+@section canvas
+
+@li @c canvas
+@li @c canvas.cairo
+@li @c canvas.directx
+@li @c canvas.null
+@li @c canvas.ogl
+@li @c canvas.vcl
+
+@section chart2
+
+@li @c chart2
+@li @c chart2.accessibility
+@li @c chart2.areachart
+@li @c chart2.main
+@li @c chart2.pie.label.bestfit
+@li @c chart2.pie.label.bestfit.inside
+@li @c chart2.template
+@li @c chart2.tools
+
+@section connectivity
+
+@li @c connectivity.ado
+@li @c connectivity.commontools
+@li @c connectivity.cpool
+@li @c connectivity.dbase
+@li @c connectivity.drivers - a bit overly general, maybe it should be removed?
+@li @c connectivity.evoab2
+@li @c connectivity.firebird
+@li @c connectivity.flat
+@li @c connectivity.hsqldb
+@li @c connectivity.jdbc
+@li @c connectivity.kab
+@li @c connectivity.macab
+@li @c connectivity.manager
+@li @c connectivity.mozab
+@li @c connectivity.mysqlc
+@li @c connectivity.odbc
+@li @c connectivity.parse
+@li @c connectivity.postgresql
+@li @c connectivity.resource
+@li @c connectivity.writer
+
+@section comphelper
+
+@li @c comphelper
+@li @c comphelper.backupfilehelper
+@li @c comphelper.container - EmbeddedObjectContainer
+@li @c comphelper.crypto
+@li @c comphelper.lok
+@li @c comphelper.traceevent
+
+@section cppu
+
+@li @c cppu
+@li @c cppu.affinebridge
+@li @c cppu.log
+@li @c cppu.purpenv
+@li @c cppu.threadpool
+@li @c cppu.typelib
+@li @c cppu.unsafebridge
+
+@section cppuhelper
+
+@li @c cppuhelper
+@li @c cppuhelper.shlib
+
+@section cpputools
+
+@li @c cpputools
+@li @c cpputools.unoexe
+
+@section cui
+
+@li @c cui.customize
+@li @c cui.customnotebookbar
+@li @c cui.dialogs
+@li @c cui.factory
+@li @c cui.options
+@li @c cui.tabpages
+
+@section drawinglayer
+
+@li @c drawinglayer
+@li @c drawinglayer.emf
+
+@section emfio
+
+@li @c emfio - EMF and VMF image file formats import module
+
+@section Calc
+
+@li @c sc
+@li @c sc.core
+@li @c sc.core.formulacell - ScFormulaCell and group
+@li @c sc.core.formulagroup
+@li @c sc.core.grouparealistener - sc::FormulaGroupAreaListener
+@li @c sc.filter - Calc filter
+@li @c sc.lok.docsize
+@li @c sc.lok.header
+@li @c sc.lok.poshelper
+@li @c sc.opencl - OpenCL-related stuff in general
+@li @c sc.opencl.source - Generated OpenCL source code
+@li @c sc.orcus
+@li @c sc.orcus.autofilter
+@li @c sc.orcus.condformat
+@li @c sc.orcus.style
+@li @c sc.orcus.table
+@li @c sc.qa
+@li @c sc.threaded
+@li @c sc.timing
+@li @c sc.ui - Calc UI
+@li @c sc.uitest - Calc UI Test part
+@li @c sc.viewdata
+
+@section desktop
+
+@li @c desktop
+@li @c desktop.app
+@li @c desktop.deployment
+@li @c desktop.lib
+@li @c desktop.migration
+@li @c desktop.offacc
+@li @c desktop.splash
+@li @c desktop.test
+@li @c desktop.updater
+
+@section Draw
+
+@li @c sd
+@li @c sd.core
+@li @c sd.eppt
+@li @c sd.filter
+@li @c sd.fwk
+@li @c sd.slideshow
+@li @c sd.sls - slidesorter
+@li @c sd.tools
+@li @c sd.transitions
+@li @c sd.ui
+@li @c sd.view
+@li @c sdremote
+@li @c sdremote.bluetooth
+@li @c sdremote.wifi
+
+@section editeng
+
+@li @c editeng
+@li @c editeng.chaining
+@li @c editeng.items
+
+@section embeddedobj
+
+@li @c embeddedobj - embedded objects
+@li @c embeddedobj.common
+@li @c embeddedobj.general
+@li @c embeddedobj.ole - OLE embedded objects
+
+@section embedserv
+@li @c embedserv - embedding server
+@li @c embedserv.ole - OLE server
+
+@section extensions
+
+@li @c extensions.abpilot
+@li @c extensions.biblio
+@li @c extensions.config
+@li @c extensions.dbpilots
+@li @c extensions.evoab
+@li @c extensions.logging
+@li @c extensions.olebridge - OLE automation bridge
+@li @c extensions.plugin
+@li @c extensions.propctrlr
+@li @c extensions.scanner
+@li @c extensions.update
+
+@section Filter
+
+@li @c filter.config
+@li @c filter.eps
+@li @c filter.hwp - Hangul word processor import
+@li @c filter.icgm
+@li @c filter.ms - escher import/export
+@li @c filter.odfflatxml
+@li @c filter.os2met
+@li @c filter.pdf
+@li @c filter.pict
+@li @c filter.psd
+@li @c filter.ras
+@li @c filter.svg
+@li @c filter.tga
+@li @c filter.tiff
+@li @c filter.xmlfa
+@li @c filter.xmlfd
+@li @c filter.xslt - xslt import/export
+
+@section oox
+
+@li @c oox
+@li @c oox.chart
+@li @c oox.cscode - see oox/source/drawingml/customshapes/README
+@li @c oox.csdata - see oox/source/drawingml/customshapes/README
+@li @c oox.drawingml - DrawingML
+@li @c oox.drawingml.gradient
+@li @c oox.ppt - pptx filter
+@li @c oox.shape
+@li @c oox.storage - ZipStorage class
+@li @c oox.vml - VML
+@li @c oox.xmlstream - XmlStream class
+
+@section forms
+
+@li @c forms.component
+@li @c forms.helper
+@li @c forms.misc
+@li @c forms.richtext
+@li @c forms.runtime
+@li @c forms.xforms
+
+@section formula
+
+@li @c formula.core
+@li @c formula.ui
+
+@section fpicker
+
+@li @c fpicker
+@li @c fpicker.aqua
+@li @c fpicker.office
+
+@section framework
+
+@li @c fwk - framework (abbreviation)
+@li @c fwk.accelerators
+@li @c fwk.autorecovery
+@li @c fwk.desktop
+@li @c fwk.dispatch
+@li @c fwk.frame
+@li @c fwk.joburl
+@li @c fwk.loadenv
+@li @c fwk.session
+@li @c fwk.session.debug
+@li @c fwk.uiconfiguration
+@li @c fwk.uielement
+
+@section i18nlangtag
+
+@li @c i18nlangtag - language tags
+
+@section i18npool
+
+@li @c i18npool - general i18npool
+
+@section i18n
+
+@li @c i18n - module independent i18n related, e.g. language tag usage
+
+@section io
+
+@li @c io.connector
+@li @c io.streams
+
+@section jvmfwk
+
+@li @c jfw
+@li @c jfw.level1
+@li @c jfw.level2
+
+@section LibreOfficeKit
+
+@li @c lok
+@li @c lok.tiledrendering
+@li @c lok.dialog
+
+@section l10ntools
+
+@li @c l10ntools
+
+@section Math
+
+@li @c starmath
+@li @c starmath.ooxml - OOXML import/export
+@li @c starmath.rtf
+@li @c starmath.wordbase
+
+@section package
+
+@li @c package
+@li @c package.xstor
+@li @c package.threadeddeflate
+
+@section sdext
+
+@li @c sdext
+@li @c sdext.minimizer
+@li @c sdext.pdfimport
+@li @c sdext.pdfimport.pdfparse
+@li @c sdext.presenter
+
+@section sfx
+
+@li @c sfx
+@li @c sfx.appl
+@li @c sfx.bastyp
+@li @c sfx.config
+@li @c sfx.control
+@li @c sfx.dialog
+@li @c sfx.doc
+@li @c sfx.notify
+@li @c sfx.sidebar
+@li @c sfx.view
+
+@section slideshow
+
+@li @c slideshow
+@li @c slideshow.eventqueue
+@li @c slideshow.opengl
+@li @c slideshow.verbose
+
+@section sot
+
+@li @c sot - COM structured storage
+
+@section svl
+
+@li @c svl
+@li @c svl.crypto
+@li @c svl.items
+@li @c svl.numbers
+
+@section svtools
+
+@li @c svtools
+@li @c svtools.config
+@li @c svtools.contnr
+@li @c svtools.control
+@li @c svtools.dialogs
+@li @c svtools.misc
+@li @c svtools.table
+@li @c svtools.uno
+
+@section svx
+
+@li @c svx
+@li @c svx.chaining
+@li @c svx.diagram - Diagram ModelData
+@li @c svx.dialog
+@li @c svx.fmcomp
+@li @c svx.form
+@li @c svx.sdr
+@li @c svx.sidebar
+@li @c svx.stbcrtls - StatusBarControl
+@li @c svx.svdraw
+@li @c svx.table
+@li @c svx.tbxcrtls - ToolboxControl
+@li @c svx.uno
+
+@section toolkit
+
+@li @c toolkit
+@li @c toolkit.controls
+@li @c toolkit.helper
+
+@section tools
+
+@li @c tools
+@li @c tools.datetime
+@li @c tools.debug
+@li @c tools.fraction
+@li @c tools.generic
+@li @c tools.memtools
+@li @c tools.rc - resource manager
+@li @c tools.stream - SvStream class
+@li @c tools.urlobj - INetURLObject class
+
+@section ucb
+
+@li @c ucb
+@li @c ucb.core
+@li @c ucb.ucp
+@li @c ucb.ucp.cmis
+@li @c ucb.ucp.ext
+@li @c ucb.ucp.file
+@li @c ucb.ucp.ftp
+@li @c ucb.ucp.gio
+@li @c ucb.ucp.webdav
+@li @c ucb.ucp.webdav.curl
+
+@section unotools
+
+@li @c unotools
+@li @c unotools.config
+@li @c unotools.i18n
+@li @c unotools.misc
+@li @c unotools.ucbhelper
+
+@section URE
+
+@li @c rtl.string - ::rtl::OString, ::rtl::OUString, and related functionality
+@li @c salhelper.thread - ::salhelper::Thread class
+
+@section sax
+
+@li @c sax.cppunit
+@li @c sax.fastparser
+
+@section stoc
+
+@li @c stoc.corerefl - CoreReflection
+@li @c stoc.java - javaloader and javavm
+
+@section VCL
+
+@li @c vcl
+@li @c vcl.a11y
+@li @c vcl.app
+@li @c vcl.builder
+@li @c vcl.control
+@li @c vcl.ct - CoreText-using code for macOS and iOS
+@li @c vcl.debugevent
+@li @c vcl.driver Graphics driver handling
+@li @c vcl.emf - EMF/EMF+ processing
+@li @c vcl.eventtesting
+@li @c vcl.filter
+@li @c vcl.filter.webp
+@li @c vcl.fonts - font-specific code
+@li @c vcl.fonts.detail
+@li @c vcl.gdi - the GDI part of VCL, devices, bitmaps, etc.
+@li @c vcl.gdi.wndproc - Windows Procedure part of VCL
+@li @c vcl.gdi.fontmetric
+@li @c vcl.gtk - Gtk+ 2/3 plugin
+@li @c vcl.gtk3
+@li @c vcl.gtkkde5
+@li @c vcl.harfbuzz - HarfBuzz text layout
+@li @c vcl.headless - bitmap-based backend
+@li @c vcl.helper
+@li @c vcl.icontest
+@li @c vcl.ios.clipboard
+@li @c vcl.kf5 - KF5
+@li @c vcl.layout - Widget layout
+@li @c vcl.lazydelete
+@li @c vcl.opengl
+@li @c vcl.opengl.qt - Qt OpenGL
+@li @c vcl.osx
+@li @c vcl.osx.clipboard
+@li @c vcl.osx.print
+@li @c vcl.pdfwriter
+@li @c vcl.print
+@li @c vcl.plugadapt - the Unix/X11 backend plugin mechanism
+@li @c vcl.qt - Qt
+@li @c vcl.quartz
+@li @c vcl.schedule - scheduler / main-loop information
+@li @c vcl.schedule.deinit
+@li @c vcl.screensaverinhibitor
+@li @c vcl.scrollbar - Scroll Bars
+@li @c vcl.se - VCL Session Manager
+@li @c vcl.se.debug
+@li @c vcl.skia - VCL Skia-based code
+@li @c vcl.skia.trace - tracing drawing in VCL Skia-based code
+@li @c vcl.sm - Session Manager Client
+@li @c vcl.sm.debug
+@li @c vcl.uitest - The UI testing framework code
+@li @c vcl.unity
+@li @c vcl.unx.dtrans
+@li @c vcl.unx.freetype
+@li @c vcl.unx.print
+@li @c vcl.virdev
+@li @c vcl.watchdog
+@li @c vcl.window
+@li @c vcl.win.dtrans
+
+@section winaccessibility
+
+@li @c iacc2 - IAccessible2 bridge debug
+
+@section Writer
+
+@li @c sw
+@li @c sw.a11y - accessibility
+@li @c sw.calc - formula calculation
+@li @c sw.core - Writer core
+@li @c sw.createcopy
+@li @c sw.doc
+@li @c sw.docappend
+@li @c sw.docx
+@li @c sw.envelp
+@li @c sw.filter
+@li @c sw.html - Writer HTML import/export
+@li @c sw.idle
+@li @c sw.layout - Writer core view: document layout
+@li @c sw.layout.debug - Writer layout dbg_lay output
+@li @c sw.mailmerge - Writer mail merge
+@li @c sw.pageframe - debug lifecycle of SwPageFrame
+@li @c sw.rtf - .rtf export filter
+@li @c sw.tiled
+@li @c sw.ui
+@li @c sw.uno - Writer UNO interfaces
+@li @c sw.vba - Writer VBA
+@li @c sw.ww8 - .doc/.docx export filter, .doc import filter (not writerfilter)
+@li @c sw.ww8.level2 - further info for sw.ww8
+@li @c sw.xml - Writer .odt import/export
+
+@section writerfilter
+
+@li @c writerfilter
+@li @c writerfilter.dmapper
+@li @c writerfilter.ooxml
+@li @c writerfilter.profile - load times of filters
+@li @c writerfilter.rtf
+
+@section writerperfect
+
+@li @c writerperfect
+
+@section xmloff
+
+@li @c xmloff
+@li @c xmloff.chart
+@li @c xmloff.core
+@li @c xmloff.draw
+@li @c xmloff.forms
+@li @c xmloff.style
+@li @c xmloff.table
+@li @c xmloff.text
+@li @c xmloff.transform
+
+@section xmlsecurity
+
+@li @c xmlsecurity.comp - xml security component
+@li @c xmlsecurity.dialogs - xml security dialogs
+@li @c xmlsecurity.helper
+@li @c xmlsecurity.ooxml - OOXML signature support
+@li @c xmlsecurity.qa
+@li @c xmlsecurity.workben
+@li @c xmlsecurity.xmlsec - xmlsec wrapper
+@li @c xmlsecurity.xmlsec.gpg - gpg xmlsec component
+
+@section xmlscript
+
+@li @c xmlscript.xmldlg
+@li @c xmlscript.xmlflat
+@li @c xmlscript.xmlhelper
+@li @c xmlscript.xmllib
+@li @c xmlscript.xmlmod
+
+@section dbaccess
+
+@li @c dbaccess
+@li @c dbaccess.core
+@li @c dbaccess.ui
+@li @c dbaccess.ui.generalpage
+
+@section avmedia
+
+@li @c avmedia
+@li @c avmedia.gstreamer
+@li @c avmedia.gtk
+@li @c avmedia.quicktime
+
+@section other
+
+@li @c accessibility
+@li @c animations
+@li @c basegfx
+@li @c binaryurp
+@li @c cli
+@li @c configmgr
+@li @c configmgr.dconf
+@li @c cppcanvas
+@li @c cppcanvas.emf
+@li @c helpcompiler
+@li @c idl
+@li @c javaunohelper
+@li @c jvmaccess
+@li @c lingucomponent
+@li @c linguistic
+@li @c lwp - lotuswordpro
+@li @c opencl
+@li @c opencl.device
+@li @c opencl.file
+@li @c registry
+@li @c reportdesign
+@li @c rsc
+@li @c sax
+@li @c scripting
+@li @c scripting.provider
+@li @c shell
+@li @c shell.jumplist
+@li @c stoc
+@li @c store
+@li @c svg
+@li @c svgio
+@li @c test
+@li @c ucbhelper
+@li @c unodevtools
+@li @c unoidl
+@li @c unoxml
+@li @c uui
+@li @c vbahelper
+@li @c wasm
+@li @c xmlhelp
+@li @c xmlreader
+
+*/
+/* vim:set ft=cpp shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/log.hxx b/include/sal/log.hxx
new file mode 100644
index 000000000..5faeec311
--- /dev/null
+++ b/include/sal/log.hxx
@@ -0,0 +1,436 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SAL_LOG_HXX
+#define INCLUDED_SAL_LOG_HXX
+
+#include "sal/config.h"
+
+#include <cstdlib>
+#include <sstream>
+#include <string>
+
+#include "sal/detail/log.h"
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+// Avoid the use of other sal code in this header as much as possible, so that
+// this code can be called from other sal code without causing endless
+// recursion.
+
+/// @cond INTERNAL
+
+enum sal_detail_LogAction
+{
+ SAL_DETAIL_LOG_ACTION_IGNORE,
+ SAL_DETAIL_LOG_ACTION_LOG,
+ SAL_DETAIL_LOG_ACTION_FATAL
+};
+
+extern "C" SAL_DLLPUBLIC void SAL_CALL sal_detail_log(
+ sal_detail_LogLevel level, char const * area, char const * where,
+ char const * message, sal_uInt32 backtraceDepth);
+
+extern "C" SAL_DLLPUBLIC void SAL_CALL sal_detail_set_log_selector(char const *logSelector);
+
+// the return value is actually "enum sal_detail_LogAction", but due to ABI
+// compatibility, it's left as the original "sal_Bool" / "unsigned char".
+extern "C" SAL_DLLPUBLIC unsigned char SAL_CALL sal_detail_log_report(
+ sal_detail_LogLevel level, char const * area);
+
+namespace sal { namespace detail {
+
+inline void log(
+ sal_detail_LogLevel level, char const * area, char const * where,
+ std::ostringstream const & stream, sal_uInt32 backtraceDepth)
+{
+ // An alternative would be to have sal_detail_log take a std::ostringstream
+ // pointer (via a C void pointer); the advantage would be smaller client
+ // code (the ".str().c_str()" part would move into the implementation of
+ // sal_detail_log) and potential for proper support of embedded null
+ // characters within the message, but the disadvantage would be dependence
+ // on the C++ ABI; as a compromise, the ".str().c_str()" part has been moved
+ // to this inline function so that it is potentially only emitted once per
+ // dynamic library:
+ sal_detail_log(level, area, where, stream.str().c_str(), backtraceDepth);
+}
+
+// Special handling of the common case where the message consists of just a
+// string literal, to produce smaller call-site code:
+
+struct StreamStart {};
+
+struct StreamString {
+ StreamString(char const * s): string(s) {}
+
+ char const * string;
+
+ typedef char Result;
+};
+
+struct StreamIgnore {
+ typedef struct { char a[2]; } Result;
+};
+
+inline StreamString operator <<(
+ SAL_UNUSED_PARAMETER StreamStart const &, char const * s)
+{
+ return StreamString(s);
+}
+
+template< typename T > inline StreamIgnore operator <<(
+ SAL_UNUSED_PARAMETER StreamStart const &, SAL_UNUSED_PARAMETER T const &)
+{
+ std::abort();
+#if defined _MSC_VER && _MSC_VER < 1700
+ return StreamIgnore();
+#endif
+}
+
+template< typename T > inline StreamIgnore operator <<(
+ SAL_UNUSED_PARAMETER StreamString const &, SAL_UNUSED_PARAMETER T const &)
+{
+ std::abort();
+#if defined _MSC_VER && _MSC_VER < 1700
+ return StreamIgnore();
+#endif
+}
+
+template< typename T > inline StreamIgnore operator <<(
+ SAL_UNUSED_PARAMETER StreamIgnore const &, SAL_UNUSED_PARAMETER T const &)
+{
+ std::abort();
+#if defined _MSC_VER && _MSC_VER < 1700
+ return StreamIgnore();
+#endif
+}
+
+template< typename T > typename T::Result getResult(T const &);
+
+inline char const * unwrapStream(StreamString const & s) { return s.string; }
+
+inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) {
+ std::abort();
+#if defined _MSC_VER && _MSC_VER < 1700
+ return 0;
+#endif
+}
+
+} }
+
+// to prevent using a local variable, which can eventually shadow,
+// resulting in compiler warnings (or even errors with -Werror)
+#define SAL_DETAIL_LOG_STREAM_PRIVATE_(level, area, where, stream) \
+ if (sizeof ::sal::detail::getResult( \
+ ::sal::detail::StreamStart() << stream) == 1) \
+ { \
+ ::sal_detail_log( \
+ (level), (area), (where), \
+ ::sal::detail::unwrapStream( \
+ ::sal::detail::StreamStart() << stream), \
+ 0); \
+ } else { \
+ ::std::ostringstream sal_detail_stream; \
+ sal_detail_stream << stream; \
+ ::sal::detail::log( \
+ (level), (area), (where), sal_detail_stream, 0); \
+ }
+
+#define SAL_DETAIL_LOG_STREAM(condition, level, area, where, stream) \
+ do { \
+ if (condition) \
+ { \
+ switch (sal_detail_log_report(level, area)) \
+ { \
+ case SAL_DETAIL_LOG_ACTION_IGNORE: break; \
+ case SAL_DETAIL_LOG_ACTION_LOG: \
+ SAL_DETAIL_LOG_STREAM_PRIVATE_(level, area, where, stream); \
+ break; \
+ case SAL_DETAIL_LOG_ACTION_FATAL: \
+ SAL_DETAIL_LOG_STREAM_PRIVATE_(level, area, where, stream); \
+ std::abort(); \
+ break; \
+ } \
+ } \
+ } while (false)
+
+/// @endcond
+
+/** A simple macro to create a "file and line number" string.
+
+ Potentially not only useful within the log framework (where it is used
+ automatically), but also when creating exception messages.
+
+ @attention For now, this functionality should only be used internally within
+ LibreOffice. It may change again in a future version.
+
+ @since LibreOffice 3.5
+*/
+#define SAL_WHERE SAL_DETAIL_WHERE
+
+/** A facility for generating temporary string messages by piping items into a
+ C++ std::ostringstream.
+
+ This can be useful for example in a call to SAL_INFO when depending on some
+ boolean condition data of incompatible types shall be streamed into the
+ message, as in:
+
+ SAL_INFO("foo", "object: " << (hasName ? obj->name : SAL_STREAM(obj)));
+
+ @attention For now, this functionality should only be used internally within
+ LibreOffice. It may change again in a future version.
+
+ @since LibreOffice 3.5
+*/
+#if defined _LIBCPP_VERSION \
+ || (defined _GLIBCXX_RELEASE \
+ && (_GLIBCXX_RELEASE >= 12 || (_GLIBCXX_RELEASE == 11 && __GLIBCXX__ > 20210428))) \
+ || (defined _MSC_VER && _MSC_VER >= 1915)
+#define SAL_STREAM(stream) \
+ (::std::ostringstream() << stream).str()
+#else
+#define SAL_STREAM(stream) \
+ (dynamic_cast< ::std::ostringstream & >(::std::ostringstream() << stream).str())
+#endif
+
+/**
+ @page sal_log Basic logging functionality.
+
+ @short Macros for logging.
+
+ SAL_INFO(char const * area, expr),
+ SAL_INFO_IF(bool condition, char const * area, expr),
+ SAL_WARN(char const * area, expr),
+ SAL_WARN_IF(bool condition, char const * area, expr), and SAL_DEBUG(expr)
+ produce an info, warning, or debug log entry with a message produced by
+ piping items into a C++ std::ostringstream. The given expr must be so that
+ the full expression "stream << expr" is valid, where stream is a variable of
+ type std::ostringstream.
+
+ SAL_INFO("foo", "string " << s << " of length " << n)
+
+ would be an example of such a call.
+
+ The composed message should be in UTF-8 and it should contain no vertical
+ formatting characters and no null characters
+
+ For the _IF variants, log output is only generated if the given condition is
+ true (in addition to the other conditions that have to be met).
+
+ The SAL_DEBUG macro is for temporary debug statements that are used while
+ working on code. It is never meant to remain in the code. It will always
+ simply output the given expression in debug builds.
+
+ For all the other macros, the given area argument must be non-null and must
+ match the regular expression
+
+ @verbatim
+ <area> ::= <segment>("."<segment>)*
+ @endverbatim
+
+ with
+
+ @verbatim
+ <segment> ::= [0-9a-z]+
+ @endverbatim
+
+ For a list of areas used see @ref sal_log_areas "SAL debug areas". Whenever
+ you use a new log area, add it to the file include/sal/log-areas.dox .
+
+ Whether these macros generate any log output is controlled in a two-stage
+ process.
+
+ First, at compile time the macros SAL_LOG_INFO and SAL_LOG_WARN,
+ respectively, control whether the INFO and WARN macros, respectively,
+ expand to actual code (in case the macro is defined, to any value) or to
+ no-ops (in case the macro is not defined).
+
+ Second, at runtime the environment variable SAL_LOG further limits which
+ macro calls actually generate log output. The environment variable SAL_LOG
+ must either be unset or must match the regular expression
+
+ @verbatim
+ <env> ::= <switch>*
+ @endverbatim
+
+ with
+
+ @verbatim
+ <switch> ::= <sense><item>
+ <sense> ::= "+"|"-"
+ <item> ::= <flag>|<level>("."<area>)?
+ <flag> ::= "TIMESTAMP"|"RELATIVETIMER"|"FATAL"
+ <level> ::= "INFO"|"WARN"
+ @endverbatim
+
+ If the environment variable is unset, the setting "+WARN" is
+ assumed instead (which results in all warnings being output but no
+ infos). If the given value does not match the regular expression,
+ "+INFO+WARN" is used instead (which in turn results in everything
+ being output).
+
+ The "+TIMESTAMP" flag causes each output line (as selected by the level
+ switch(es)) to be prefixed by a timestamp like 2016-08-18:14:04:43.
+
+ The "+RELATIVETIMER" flag causes each output line (as selected by
+ the level switch(es)) to be prefixed by a relative timestamp in
+ seconds since the first output line like 1.312.
+
+ The "+FATAL" flag will cause later matching rules to log and call
+ std::abort. This can be disabled at some later point by using the
+ "-FATAL" flag before specifying additional rules. The flag will just
+ abort on positive rules, as it doesn't seem to make sense to abort
+ on ignored output.
+
+ If both +TIMESTAMP and +RELATIVETIMER are specified, they are
+ output in that order.
+
+ Specifying a flag with a negative sense has no effect. Specifying
+ the same flag multiple times has no extra effect.
+
+ A given macro call's level (INFO or WARN) and area is matched against the
+ given switches as follows: Only those switches for which the level matches
+ the given level and for which the area is a prefix (including both empty and
+ full prefixes) of the given area are considered. Log output is generated if
+ and only if among the longest such switches (if any), there is at least one
+ that has a sense of "+". (That is, if both +INFO.foo and -INFO.foo are
+ present, +INFO.foo wins.)
+
+ If no WARN selection is specified, but an INFO selection is, the
+ INFO selection is used for WARN messages, too.
+
+ For example, if SAL_LOG is "+INFO-INFO.foo+INFO.foo.bar", then calls like
+ SAL_INFO("foo.bar", ...), SAL_INFO("foo.bar.baz", ...), or
+ SAL_INFO("other", ...) generate output, while calls like
+ SAL_INFO("foo", ...) or SAL_INFO("foo.barzzz", ...) do not.
+
+ The generated log output consists of the optional timestamp, the given level
+ ("info" or "warn"), the given area, the process ID, the thread ID, the
+ source file, and the source line number, each followed by a colon, followed
+ by a space, the given message, and a newline. The precise format of the log
+ output is subject to change. The log output is printed to stderr without
+ further text encoding conversion.
+
+ On some systems, log output can be redirected to other log sinks,
+ notably a file provided as a system path and filename via
+ environment variable SAL_LOG_FILE; or to a syslog facility if
+ LibreOffice is suitably built, by setting environment variable
+ SAL_LOG_SYSLOG.
+
+ @see @ref sal_log_areas
+
+ @attention For now, this functionality should only be used internally within
+ LibreOffice. It may change again in a future version.
+
+ @since LibreOffice 3.5
+*/
+
+/**
+ Produce log entry from stream in the given log area.
+
+ See @ref sal_log "basic logging functionality" for details.
+*/
+#define SAL_INFO(area, stream) \
+ SAL_DETAIL_LOG_STREAM( \
+ SAL_DETAIL_ENABLE_LOG_INFO, ::SAL_DETAIL_LOG_LEVEL_INFO, area, \
+ SAL_WHERE, stream)
+
+/**
+ Produce log entry from stream in the given log area if condition is true.
+
+ See @ref sal_log "basic logging functionality" for details.
+*/
+#define SAL_INFO_IF(condition, area, stream) \
+ SAL_DETAIL_LOG_STREAM( \
+ SAL_DETAIL_ENABLE_LOG_INFO && (condition), \
+ ::SAL_DETAIL_LOG_LEVEL_INFO, area, SAL_WHERE, stream)
+
+/**
+ Produce warning entry from stream in the given log area.
+
+ See @ref sal_log "basic logging functionality" for details.
+*/
+#define SAL_WARN(area, stream) \
+ SAL_DETAIL_LOG_STREAM( \
+ SAL_DETAIL_ENABLE_LOG_WARN, ::SAL_DETAIL_LOG_LEVEL_WARN, area, \
+ SAL_WHERE, stream)
+
+/**
+ Produce warning entry from stream in the given log area if condition is true.
+
+ See @ref sal_log "basic logging functionality" for details.
+*/
+#define SAL_WARN_IF(condition, area, stream) \
+ SAL_DETAIL_LOG_STREAM( \
+ SAL_DETAIL_ENABLE_LOG_WARN && (condition), \
+ ::SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, stream)
+
+/**
+ Produce temporary debugging output from stream. This macro is meant to be
+ used only while working on code and should never exist in production code.
+
+ See @ref sal_log "basic logging functionality" for details.
+*/
+#define SAL_DEBUG(stream) \
+ SAL_DETAIL_LOG_STREAM( \
+ SAL_LOG_TRUE, ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, stream)
+
+/**
+ Produce temporary debugging output from stream, if condition is true. This
+ macro is meant to be used only while working on code and should never exist
+ in production code.
+
+ See @ref sal_log "basic logging functionality" for details.
+*/
+#define SAL_DEBUG_IF(condition, stream) \
+ SAL_DETAIL_LOG_STREAM( \
+ (condition), ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, stream)
+
+/**
+ Produce temporary debugging output from stream along with a backtrace of the
+ calling location.
+
+ This macro is meant to be used only while working on code and should never
+ exist in production code.
+
+ @param stream input stream
+
+ @param backtraceDepth a sal_uInt32 value indicating the maximum backtrace
+ depth; zero means no backtrace
+
+ See @ref sal_log "basic logging functionality" for details.
+*/
+#define SAL_DEBUG_BACKTRACE(stream, backtraceDepth) \
+ do { \
+ if (sizeof ::sal::detail::getResult( \
+ ::sal::detail::StreamStart() << stream) == 1) \
+ { \
+ ::sal_detail_log( \
+ ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, \
+ ::sal::detail::unwrapStream( \
+ ::sal::detail::StreamStart() << stream), \
+ backtraceDepth); \
+ } else { \
+ ::std::ostringstream sal_detail_stream; \
+ sal_detail_stream << stream; \
+ ::sal::detail::log( \
+ ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, sal_detail_stream, \
+ backtraceDepth); \
+ } \
+ } while (false)
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/macros.h b/include/sal/macros.h
new file mode 100644
index 000000000..2705fa63f
--- /dev/null
+++ b/include/sal/macros.h
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SAL_MACROS_H
+#define INCLUDED_SAL_MACROS_H
+
+#include <stddef.h>
+
+#ifndef SAL_N_ELEMENTS
+# if defined(__cplusplus) && ( defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L )
+ /*
+ * Magic template to calculate at compile time the number of elements
+ * in an array. Enforcing that the argument must be an array and not
+ * a pointer, e.g.
+ * char *pFoo="foo";
+ * SAL_N_ELEMENTS(pFoo);
+ * fails while
+ * SAL_N_ELEMENTS("foo");
+ * or
+ * char aFoo[]="foo";
+ * SAL_N_ELEMENTS(aFoo);
+ * pass
+ *
+ * Unfortunately if arr is an array of an anonymous class then we need
+ * C++0x, i.e. see
+ * http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#757
+ */
+ template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
+# define SAL_N_ELEMENTS(arr) (sizeof(sal_n_array_size(arr)))
+# else
+# define SAL_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
+# endif
+#endif
+
+#ifndef SAL_STRINGIFY
+# define SAL_STRINGIFY_ARG(x) #x
+# define SAL_STRINGIFY(x) SAL_STRINGIFY_ARG(x)
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/main.h b/include/sal/main.h
new file mode 100644
index 000000000..7d10988c6
--- /dev/null
+++ b/include/sal/main.h
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SAL_MAIN_H
+#define INCLUDED_SAL_MAIN_H
+
+#include "sal/config.h"
+
+#include "sal/saldllapi.h"
+#include "sal/types.h"
+
+#if defined AIX
+#include <unistd.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && defined __cplusplus
+// Special token for sal_detail_initialize argc parameter, used by the soffice.bin process to tell
+// SAL that it is running as part of that process (see sal/osl/unx/soffice.hxx); argv should be null
+// in such a sal_detail_initialize call:
+namespace sal::detail { constexpr int InitializeSoffice = -1; }
+#endif
+
+SAL_DLLPUBLIC void SAL_CALL sal_detail_initialize(int argc, char ** argv);
+SAL_DLLPUBLIC void SAL_CALL sal_detail_deinitialize(void);
+
+#if !(defined IOS || defined ANDROID)
+ /* No code that uses this should be built for iOS or Android */
+
+#define SAL_MAIN_WITH_ARGS_IMPL \
+int SAL_DLLPUBLIC_EXPORT SAL_CALL main(int argc, char ** argv) \
+{ \
+ int ret; \
+ sal_detail_initialize(argc, argv); \
+ ret = sal_main_with_args(argc, argv); \
+ sal_detail_deinitialize(); \
+ return ret; \
+}
+
+#define SAL_MAIN_IMPL \
+int SAL_DLLPUBLIC_EXPORT SAL_CALL main(int argc, char ** argv) \
+{ \
+ int ret; \
+ sal_detail_initialize(argc, argv); \
+ ret = sal_main(); \
+ sal_detail_deinitialize(); \
+ return ret; \
+}
+
+#endif
+
+
+/* Definition macros for CRT entries */
+
+#ifdef _WIN32
+
+#include <stdlib.h>
+
+/* Sorry but this is necessary cause HINSTANCE is a typedef that differs (C++ causes an error) */
+
+#ifndef WINAPI
+# define WINAPI __stdcall
+#endif
+
+#if !defined(DECLARE_HANDLE)
+# ifdef STRICT
+ typedef void *HANDLE;
+# define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
+# else
+ typedef void *PVOID;
+ typedef PVOID HANDLE;
+# define DECLARE_HANDLE(name) typedef HANDLE name
+# endif
+DECLARE_HANDLE(HINSTANCE);
+#endif
+
+
+
+#define SAL_WIN_WinMain \
+int WINAPI WinMain( HINSTANCE _hinst, HINSTANCE _dummy, char* _cmdline, int _nshow ) \
+{ \
+ int argc = __argc; char ** argv = __argv; \
+ (void) _hinst; (void) _dummy; (void) _cmdline; (void) _nshow; /* unused */ \
+ return main(argc, argv); \
+}
+
+#else /* ! _WIN32 */
+
+# define SAL_WIN_WinMain
+
+#endif /* ! _WIN32 */
+
+/* Implementation macro */
+
+#define SAL_IMPLEMENT_MAIN_WITH_ARGS(_argc_, _argv_) \
+ static int SAL_CALL sal_main_with_args (int _argc_, char ** _argv_); \
+ SAL_MAIN_WITH_ARGS_IMPL \
+ SAL_WIN_WinMain \
+ static int SAL_CALL sal_main_with_args(int _argc_, char ** _argv_)
+
+#define SAL_IMPLEMENT_MAIN() \
+ static int SAL_CALL sal_main(void); \
+ SAL_MAIN_IMPL \
+ SAL_WIN_WinMain \
+ static int SAL_CALL sal_main(void)
+
+/*
+ "How to use" Examples:
+
+ #include <sal/main.h>
+
+ SAL_IMPLEMENT_MAIN()
+ {
+ DoSomething();
+
+ return 0;
+ }
+
+ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
+ {
+ DoSomethingWithArgs(argc, argv);
+
+ return 0;
+ }
+
+*/
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif // INCLUDED_SAL_MAIN_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/mathconf.h b/include/sal/mathconf.h
new file mode 100644
index 000000000..3f8e98937
--- /dev/null
+++ b/include/sal/mathconf.h
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SAL_MATHCONF_H
+#define INCLUDED_SAL_MATHCONF_H
+
+#include "osl/endian.h"
+
+#if defined __sun
+#include <ieeefp.h>
+#endif /* __sun */
+
+#if defined(__cplusplus) && ( defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L )
+#include <cmath>
+#endif
+
+#if defined(IOS)
+#if defined(__cplusplus)
+#include <cmath>
+#else
+#include <math.h>
+#endif
+#endif
+
+#if defined __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/* Generally, the C standard guarantees that at program startup, "trapping or
+ stopping (if supported) is disabled on all [floating-point] exceptions"
+ (F.7.3/1 of the August 3, 1998 draft of C99), and that during program
+ execution, "a programmer can safely assume default modes (or be unaware of
+ them)" (7.6/2, footnote 161 of the August 3, 1998 draft of C99). Reportedly,
+ on Windows there are printer drivers that switch on exceptions. To avoid
+ problems, the SAL_MATH_FPEXCEPTIONS_OFF macro can be used to explicitly
+ switch off exceptions (on Windows).
+ */
+#if defined(_WIN32)
+#define SAL_MATH_FPEXCEPTIONS_OFF() _control87( _MCW_EM, _MCW_EM )
+#else /* WNT */
+#define SAL_MATH_FPEXCEPTIONS_OFF()
+#endif /* WNT */
+
+
+/* SAL_MATH_FINITE(d): test double d on INFINITY, NaN et al. */
+#if !defined __sun && !defined ANDROID \
+ && defined(__cplusplus) \
+ && ( defined(__GXX_EXPERIMENTAL_CXX0X__) \
+ || __cplusplus >= 201103L \
+ || defined(IOS) )
+#define SAL_MATH_FINITE(d) std::isfinite(d)
+#elif defined __APPLE__ && !(defined __i386__ || defined __x86_64__)
+#define SAL_MATH_FINITE(d) isfinite(d)
+#elif defined( WNT)
+#define SAL_MATH_FINITE(d) _finite(d)
+#elif defined(ANDROID) || defined LINUX || defined UNX
+#define SAL_MATH_FINITE(d) finite(d)
+#else /* WNT, LINUX, UNX */
+#error "SAL_MATH_FINITE not defined"
+#endif /* WNT, LINUX, UNX */
+
+
+/* This needs to be fixed for non--IEEE-754 platforms: */
+#if 1 /* IEEE 754 supported */
+#if defined OSL_BIGENDIAN
+
+/* IEEE 754 double structures for BigEndian */
+union sal_math_Double
+{
+ struct
+ {
+ unsigned sign : 1;
+ unsigned exponent :11;
+ unsigned fraction_hi :20;
+ unsigned fraction_lo :32;
+ } inf_parts;
+ struct
+ {
+ unsigned sign : 1;
+ unsigned exponent :11;
+ unsigned qnan_bit : 1;
+ unsigned bits :19;
+ unsigned fraction_lo :32;
+ } nan_parts;
+ struct
+ {
+ unsigned msw :32;
+ unsigned lsw :32;
+ } w32_parts;
+ struct
+ {
+ sal_uInt64 sign : 1;
+ sal_uInt64 exponent :11;
+ sal_uInt64 fraction :52;
+ } parts;
+ sal_uInt64 intrep;
+ double value;
+};
+
+#elif defined OSL_LITENDIAN
+
+/* IEEE 754 double structures for LittleEndian */
+union sal_math_Double
+{
+ struct {
+ unsigned fraction_lo :32;
+ unsigned fraction_hi :20;
+ unsigned exponent :11;
+ unsigned sign : 1;
+ } inf_parts;
+ struct {
+ unsigned fraction_lo :32;
+ unsigned bits :19;
+ unsigned qnan_bit : 1;
+ unsigned exponent :11;
+ unsigned sign : 1;
+ } nan_parts;
+ struct
+ {
+ unsigned lsw :32;
+ unsigned msw :32;
+ } w32_parts;
+ struct
+ {
+ sal_uInt64 fraction :52;
+ sal_uInt64 exponent :11;
+ sal_uInt64 sign : 1;
+ } parts;
+ sal_uInt64 intrep;
+ double value;
+};
+
+#else /* OSL_BIGENDIAN, OSL_LITENDIAN */
+
+#error "neither OSL_BIGENDIAN nor OSL_LITENDIAN"
+
+#endif /* OSL_BIGENDIAN, OSL_LITENDIAN */
+#else /* IEEE 754 supported */
+
+#error "don't know how to handle IEEE 754"
+
+#endif /* IEEE 754 supported */
+
+
+#if defined __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* INCLUDED_SAL_MATHCONF_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/saldllapi.h b/include/sal/saldllapi.h
new file mode 100644
index 000000000..d5ec89e67
--- /dev/null
+++ b/include/sal/saldllapi.h
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SAL_SALDLLAPI_H
+#define INCLUDED_SAL_SALDLLAPI_H
+
+#include "sal/config.h"
+
+#include "sal/types.h"
+
+#if defined(SAL_DLLIMPLEMENTATION)
+#define SAL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SAL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif // INCLUDED_SAL_SALDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/types.h b/include/sal/types.h
new file mode 100644
index 000000000..7bfb256e3
--- /dev/null
+++ b/include/sal/types.h
@@ -0,0 +1,687 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SAL_TYPES_H
+#define INCLUDED_SAL_TYPES_H
+
+#include "sal/config.h"
+
+#include <stddef.h>
+
+#include "sal/macros.h"
+#include "sal/typesizes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef unsigned char sal_Bool;
+# define sal_False ((sal_Bool)0)
+# define sal_True ((sal_Bool)1)
+
+/* char is assumed to always be 1 byte long */
+typedef signed char sal_Int8;
+typedef unsigned char sal_uInt8;
+
+#if SAL_TYPES_SIZEOFSHORT == 2
+ typedef signed short sal_Int16;
+ typedef unsigned short sal_uInt16;
+#else
+ #error "Could not find 16-bit type, add support for your architecture"
+#endif
+
+#if SAL_TYPES_SIZEOFLONG == 4
+ typedef signed long sal_Int32;
+ typedef unsigned long sal_uInt32;
+ #define SAL_PRIdINT32 "ld"
+ #define SAL_PRIuUINT32 "lu"
+ #define SAL_PRIxUINT32 "lx"
+ #define SAL_PRIXUINT32 "lX"
+#elif SAL_TYPES_SIZEOFINT == 4
+ typedef signed int sal_Int32;
+ typedef unsigned int sal_uInt32;
+ #define SAL_PRIdINT32 "d"
+ #define SAL_PRIuUINT32 "u"
+ #define SAL_PRIxUINT32 "x"
+ #define SAL_PRIXUINT32 "X"
+#else
+ #error "Could not find 32-bit type, add support for your architecture"
+#endif
+
+#ifdef _MSC_VER
+ typedef __int64 sal_Int64;
+ typedef unsigned __int64 sal_uInt64;
+
+ /* The following are macros that will add the 64 bit constant suffix. */
+ #define SAL_CONST_INT64(x) x##i64
+ #define SAL_CONST_UINT64(x) x##ui64
+
+ #define SAL_PRIdINT64 "I64d"
+ #define SAL_PRIuUINT64 "I64u"
+ #define SAL_PRIxUINT64 "I64x"
+ #define SAL_PRIXUINT64 "I64X"
+#elif defined (__GNUC__)
+ #if SAL_TYPES_SIZEOFLONG == 8
+ typedef signed long int sal_Int64;
+ typedef unsigned long int sal_uInt64;
+
+
+ /* The following are macros that will add the 64 bit constant suffix. */
+ #define SAL_CONST_INT64(x) x##l
+ #define SAL_CONST_UINT64(x) x##ul
+
+ #define SAL_PRIdINT64 "ld"
+ #define SAL_PRIuUINT64 "lu"
+ #define SAL_PRIxUINT64 "lx"
+ #define SAL_PRIXUINT64 "lX"
+ #elif SAL_TYPES_SIZEOFLONGLONG == 8
+ typedef signed long long sal_Int64;
+ typedef unsigned long long sal_uInt64;
+
+ /* The following are macros that will add the 64 bit constant suffix. */
+ #define SAL_CONST_INT64(x) x##ll
+ #define SAL_CONST_UINT64(x) x##ull
+
+ #define SAL_PRIdINT64 "lld"
+ #define SAL_PRIuUINT64 "llu"
+ #define SAL_PRIxUINT64 "llx"
+ #define SAL_PRIXUINT64 "llX"
+ #else
+ #error "Could not find 64-bit type, add support for your architecture"
+ #endif
+#else
+ #error "Please define the 64-bit types for your architecture/compiler in include/sal/types.h"
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && defined __cplusplus
+ #define SAL_UNICODE_NOTEQUAL_WCHAR_T
+ typedef char16_t sal_Unicode;
+#elif defined(_WIN32)
+ typedef wchar_t sal_Unicode;
+#else
+ #define SAL_UNICODE_NOTEQUAL_WCHAR_T
+ typedef sal_uInt16 sal_Unicode;
+#endif
+
+typedef void * sal_Handle;
+
+/* sal_Size should currently be the native width of the platform */
+#if SAL_TYPES_SIZEOFPOINTER == 4
+ typedef sal_uInt32 sal_Size;
+ typedef sal_Int32 sal_sSize;
+#elif SAL_TYPES_SIZEOFPOINTER == 8
+ typedef sal_uInt64 sal_Size;
+ typedef sal_Int64 sal_sSize;
+#else
+ #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
+#endif
+
+/* sal_PtrDiff holds the result of a pointer subtraction */
+#if SAL_TYPES_SIZEOFPOINTER == 4
+ typedef sal_Int32 sal_PtrDiff;
+#elif SAL_TYPES_SIZEOFPOINTER == 8
+ typedef sal_Int64 sal_PtrDiff;
+#else
+ #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
+#endif
+
+/* printf-style conversion specification length modifiers for size_t and
+ ptrdiff_t (most platforms support C99, MSC has its own extension) */
+#if defined(_MSC_VER)
+ #define SAL_PRI_SIZET "I"
+ #define SAL_PRI_PTRDIFFT "I"
+#else
+ #define SAL_PRI_SIZET "z"
+ #define SAL_PRI_PTRDIFFT "t"
+#endif
+
+/* sal_IntPtr, sal_uIntPtr are integer types designed to hold pointers so that any valid
+ * pointer to void can be converted to this type and back to a pointer to void and the
+ * result will compare to the original pointer */
+#if SAL_TYPES_SIZEOFPOINTER == 4
+ typedef sal_Int32 sal_IntPtr;
+ typedef sal_uInt32 sal_uIntPtr;
+ #define SAL_PRIdINTPTR SAL_PRIdINT32
+ #define SAL_PRIuUINTPTR SAL_PRIuUINT32
+ #define SAL_PRIxUINTPTR SAL_PRIxUINT32
+ #define SAL_PRIXUINTPTR SAL_PRIXUINT32
+#elif SAL_TYPES_SIZEOFPOINTER == 8
+ typedef sal_Int64 sal_IntPtr;
+ typedef sal_uInt64 sal_uIntPtr;
+ #define SAL_PRIdINTPTR SAL_PRIdINT64
+ #define SAL_PRIuUINTPTR SAL_PRIuUINT64
+ #define SAL_PRIxUINTPTR SAL_PRIxUINT64
+ #define SAL_PRIXUINTPTR SAL_PRIXUINT64
+#else
+ #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
+#endif
+
+/* The following SAL_MIN_INTn defines codify the assumption that the signed
+ * sal_Int types use two's complement representation. Defining them as
+ * "-0x7F... - 1" instead of as "-0x80..." prevents warnings about applying the
+ * unary minus operator to unsigned quantities.
+ */
+#define SAL_MIN_INT8 ((sal_Int8) (-0x7F - 1))
+#define SAL_MAX_INT8 ((sal_Int8) 0x7F)
+#define SAL_MAX_UINT8 ((sal_uInt8) 0xFF)
+#define SAL_MIN_INT16 ((sal_Int16) (-0x7FFF - 1))
+#define SAL_MAX_INT16 ((sal_Int16) 0x7FFF)
+#define SAL_MAX_UINT16 ((sal_uInt16) 0xFFFF)
+#define SAL_MIN_INT32 ((sal_Int32) (-0x7FFFFFFF - 1))
+#define SAL_MAX_INT32 ((sal_Int32) 0x7FFFFFFF)
+#define SAL_MAX_UINT32 ((sal_uInt32) 0xFFFFFFFF)
+#define SAL_MIN_INT64 ((sal_Int64) (SAL_CONST_INT64(-0x7FFFFFFFFFFFFFFF) - 1))
+#define SAL_MAX_INT64 ((sal_Int64) SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF))
+#define SAL_MAX_UINT64 ((sal_uInt64) SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF))
+
+#if SAL_TYPES_SIZEOFPOINTER == 4
+#define SAL_MAX_SSIZE SAL_MAX_INT32
+#define SAL_MAX_SIZE SAL_MAX_UINT32
+#elif SAL_TYPES_SIZEOFPOINTER == 8
+#define SAL_MAX_SSIZE SAL_MAX_INT64
+#define SAL_MAX_SIZE SAL_MAX_UINT64
+#endif
+
+#define SAL_MAX_ENUM 0x7fffffff
+
+#if defined(_MSC_VER)
+# define SAL_DLLPUBLIC_EXPORT __declspec(dllexport)
+# define SAL_JNI_EXPORT __declspec(dllexport)
+# define SAL_DLLPUBLIC_IMPORT __declspec(dllimport)
+# define SAL_DLLPRIVATE
+# define SAL_DLLPUBLIC_TEMPLATE
+# define SAL_DLLPUBLIC_RTTI
+# define SAL_CALL __cdecl
+#elif defined SAL_UNX
+# if defined(__GNUC__)
+# if defined(DISABLE_DYNLOADING)
+# define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("hidden")))
+# define SAL_JNI_EXPORT __attribute__ ((visibility("default")))
+# define SAL_DLLPUBLIC_IMPORT __attribute__ ((visibility("hidden")))
+# define SAL_DLLPRIVATE __attribute__ ((visibility("hidden")))
+# define SAL_DLLPUBLIC_TEMPLATE __attribute__ ((visibility("hidden")))
+# define SAL_DLLPUBLIC_RTTI
+# else
+# define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("default")))
+# define SAL_JNI_EXPORT __attribute__ ((visibility("default")))
+# define SAL_DLLPUBLIC_IMPORT __attribute__ ((visibility("default")))
+# define SAL_DLLPRIVATE __attribute__ ((visibility("hidden")))
+# define SAL_DLLPUBLIC_TEMPLATE __attribute__ ((visibility("default")))
+# if defined __clang__
+# if __has_attribute(type_visibility)
+# define SAL_DLLPUBLIC_RTTI __attribute__ ((type_visibility("default")))
+# else
+# define SAL_DLLPUBLIC_RTTI __attribute__ ((visibility("default")))
+# endif
+# else
+# define SAL_DLLPUBLIC_RTTI
+# endif
+# endif
+# else
+# define SAL_DLLPUBLIC_EXPORT
+# define SAL_JNI_EXPORT
+# define SAL_DLLPUBLIC_IMPORT
+# define SAL_DLLPRIVATE
+# define SAL_DLLPUBLIC_TEMPLATE
+# define SAL_DLLPUBLIC_RTTI
+# endif
+# define SAL_CALL
+#else
+# error("unknown platform")
+#endif
+
+/**
+ Exporting the symbols necessary for exception handling on GCC.
+
+ These macros are used for inline declarations of exception classes, as in
+ rtl/malformeduriexception.hxx.
+*/
+#if defined(__GNUC__)
+# if defined(DISABLE_DYNLOADING)
+# define SAL_EXCEPTION_DLLPUBLIC_EXPORT __attribute__((visibility("default")))
+# else
+# define SAL_EXCEPTION_DLLPUBLIC_EXPORT SAL_DLLPUBLIC_EXPORT
+# endif
+# define SAL_EXCEPTION_DLLPRIVATE SAL_DLLPRIVATE
+#else
+# define SAL_EXCEPTION_DLLPUBLIC_EXPORT
+# define SAL_EXCEPTION_DLLPRIVATE
+#endif
+
+/** Use this as markup for functions and methods whose return value must be
+ checked.
+
+ Compilers that support a construct of this nature will emit a compile
+ time warning on unchecked return value.
+*/
+#if defined LIBO_INTERNAL_ONLY && defined __cplusplus
+#define SAL_WARN_UNUSED_RESULT [[nodiscard]]
+#elif (defined __GNUC__ \
+ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))) \
+ || defined __clang__
+# define SAL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+# define SAL_WARN_UNUSED_RESULT
+#endif
+
+/** Use this for pure virtual classes, e.g. class SAL_NO_VTABLE Foo { ...
+ This hinders the compiler from setting a generic vtable stating that
+ a pure virtual function was called and thus slightly reduces code size.
+*/
+#ifdef _MSC_VER
+# define SAL_NO_VTABLE __declspec(novtable)
+#else
+# define SAL_NO_VTABLE
+#endif
+
+#ifdef _WIN32
+# pragma pack(push, 8)
+#endif
+
+/** This is the binary specification of a SAL sequence.
+*/
+typedef struct _sal_Sequence
+{
+ /** reference count of sequence<br>
+ */
+ sal_Int32 nRefCount;
+ /** element count<br>
+ */
+ sal_Int32 nElements;
+ /** elements array<br>
+ */
+ char elements[1];
+} sal_Sequence;
+
+#define SAL_SEQUENCE_HEADER_SIZE ((sal_Size) offsetof(sal_Sequence,elements))
+
+#if defined( _WIN32)
+#pragma pack(pop)
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/** Nothrow specification for C functions.
+
+ This is a macro so it can expand to nothing in C code.
+*/
+#if defined __cplusplus
+#if __cplusplus >= 201103L
+#define SAL_THROW_EXTERN_C() noexcept
+#else
+#define SAL_THROW_EXTERN_C() throw ()
+#endif
+#else
+#define SAL_THROW_EXTERN_C()
+#endif
+
+#ifdef __cplusplus
+
+/** To markup destructors that coverity warns might throw exceptions
+ which won't throw in practice, or where std::terminate is
+ an acceptable response if they do
+*/
+#if defined(LIBO_INTERNAL_ONLY) && defined(__COVERITY__)
+# define COVERITY_NOEXCEPT_FALSE noexcept(false)
+#else
+# define COVERITY_NOEXCEPT_FALSE
+#endif
+
+enum __sal_NoAcquire
+{
+ /** definition of a no acquire enum for ctors
+ */
+ SAL_NO_ACQUIRE
+};
+
+namespace com { namespace sun { namespace star { } } }
+
+/** short-circuit extra-verbose API namespaces
+
+ @since LibreOffice 4.0
+*/
+namespace css = ::com::sun::star;
+
+/** C++11 "= delete" feature.
+
+ For LIBO_INTERNAL_ONLY, calling a deleted function will cause a compile-time
+ error, while otherwise it will only cause a link-time error as the declared
+ function is not defined.
+
+ @since LibreOffice 4.1
+*/
+#if defined LIBO_INTERNAL_ONLY
+#define SAL_DELETED_FUNCTION = delete
+#else
+#define SAL_DELETED_FUNCTION
+#endif
+
+/** C++11 "override" feature.
+
+ For LIBO_INTERNAL_ONLY, force the method to override an existing method in
+ parent, error out if the method with the correct signature does not exist.
+
+ @since LibreOffice 4.1
+*/
+#if defined LIBO_INTERNAL_ONLY
+#define SAL_OVERRIDE override
+#else
+#define SAL_OVERRIDE
+#endif
+
+/** C++11 "constexpr" feature.
+
+ For LIBO_INTERNAL_ONLY, declare that it's possible to evaluate the value
+ at compile time.
+
+ @since LibreOffice 7.2
+*/
+#if defined LIBO_INTERNAL_ONLY
+#define SAL_CONSTEXPR constexpr
+#else
+#define SAL_CONSTEXPR
+#endif
+
+/** Macro for C++11 "noexcept" vs. "throw ()" exception specification.
+
+ The latter has been removed completely from C++20.
+
+ @since LibreOffice 7.2
+ */
+#if __cplusplus >= 201103L
+#define SAL_NOEXCEPT noexcept
+#else
+#define SAL_NOEXCEPT throw ()
+#endif
+
+#endif /* __cplusplus */
+
+#ifdef __cplusplus
+
+namespace sal {
+
+/**
+ A static_cast between integral types, to avoid C++ compiler warnings.
+
+ In C++ source code, use sal::static_int_cast<T>(n) instead of
+ static_cast<T>(n) whenever a compiler warning about integral type problems
+ shall be silenced. That way, source code that needs to be modified when the
+ type of any of the expressions involved in the compiler warning is changed
+ can be found more easily.
+
+ Both template arguments T1 and T2 must be integral types.
+*/
+template< typename T1, typename T2 > inline T1 static_int_cast(T2 n) {
+ return static_cast< T1 >(n);
+}
+
+}
+
+#else /* __cplusplus */
+
+/**
+ A cast between integer types, to avoid C compiler warnings.
+
+ In C source code, use SAL_INT_CAST(type, expr) instead of ((type) (expr))
+ whenever a compiler warning about integer type problems shall be silenced.
+ That way, source code that needs to be modified when the type of any of the
+ expressions involved in the compiler warning is changed can be found more
+ easily.
+
+ The argument 'type' must be an integer type and the argument 'expr' must be
+ an integer expression. Both arguments are evaluated exactly once.
+*/
+#define SAL_INT_CAST(type, expr) ((type) (expr))
+
+#endif /* __cplusplus */
+
+/**
+ Use as follows:
+ SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);
+*/
+
+#if defined __GNUC__ || defined __clang__
+#if defined LIBO_INTERNAL_ONLY
+# define SAL_DEPRECATED(message) __attribute__((deprecated(message)))
+#else
+# define SAL_DEPRECATED(message) __attribute__((deprecated))
+#endif
+#elif defined(_MSC_VER)
+# define SAL_DEPRECATED(message) __declspec(deprecated(message))
+#else
+# define SAL_DEPRECATED(message)
+#endif
+
+/**
+ This macro is used in cppumaker-generated include files, to tag entities that
+ are marked as @deprecated in UNOIDL.
+
+ It causes deprecation warnings to be generated in external code, but for now
+ is silenced in internal code. It would need some substantial clean-up of
+ internal code to fix all warnings/errors generated by it. (Once that is
+ done, it can become a synonym for SAL_DEPRECATED under LIBO_INTERNAL_ONLY,
+ too. Completely removing the macro then would be incompatible, in case there
+ are include files still around generated with a cppumaker that emitted it.)
+ */
+#ifdef LIBO_INTERNAL_ONLY
+# define SAL_DEPRECATED_INTERNAL(message)
+#else
+# define SAL_DEPRECATED_INTERNAL(message) SAL_DEPRECATED(message)
+#endif
+
+/**
+ Use as follows:
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ \::std::auto_ptr<X> ...
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+*/
+
+#if defined LIBO_INTERNAL_ONLY && defined __GNUC__
+#define SAL_WNODEPRECATED_DECLARATIONS_PUSH \
+ _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic push)) \
+ _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic ignored "-Wdeprecated-declarations"))
+#define SAL_WNODEPRECATED_DECLARATIONS_POP \
+ _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic pop))
+#else
+# define SAL_WNODEPRECATED_DECLARATIONS_PUSH
+# define SAL_WNODEPRECATED_DECLARATIONS_POP
+#endif
+
+/**
+ Use as follows:
+
+ SAL_WNOUNREACHABLE_CODE_PUSH
+
+ function definition
+
+ SAL_WNOUNREACHABLE_CODE_POP
+
+ Useful in cases where the compiler is "too clever" like when doing
+ link-time code generation, and noticing that a called function
+ always throws, and fixing the problem cleanly so that it produces
+ no warnings in normal non-LTO compilations either is not easy.
+
+*/
+
+#ifdef _MSC_VER
+#define SAL_WNOUNREACHABLE_CODE_PUSH \
+ __pragma(warning(push)) \
+ __pragma(warning(disable:4702)) \
+ __pragma(warning(disable:4722))
+#define SAL_WNOUNREACHABLE_CODE_POP \
+ __pragma(warning(pop))
+#else
+/* Add definitions for GCC and Clang if needed */
+#define SAL_WNOUNREACHABLE_CODE_PUSH
+#define SAL_WNOUNREACHABLE_CODE_POP
+#endif
+
+/** Annotate unused but required C++ function parameters.
+
+ An unused parameter is required if the function needs to adhere to a given
+ type (e.g., if its address is assigned to a function pointer of a specific
+ type, or if it is called from template code). This annotation helps static
+ analysis tools suppress false warnings. In the case of virtual functions
+ (where unused required parameters are common, too), the annotation is not
+ required (as static analysis tools can themselves derive the information
+ whether a function is virtual).
+
+ Use the annotation in function definitions like
+
+ void f(SAL_UNUSED_PARAMETER int) {}
+
+ C does not allow unnamed parameters, anyway, so a function definition like
+ the above needs to be written there as
+
+ void f(int dummy) { (void) dummy; / * avoid warnings * / }
+
+ without a SAL_UNUSED_PARAMETER annotation.
+
+ @since LibreOffice 3.6
+ */
+#if defined __cplusplus
+#if defined __GNUC__ || defined __clang__
+#define SAL_UNUSED_PARAMETER __attribute__ ((unused))
+#else
+#define SAL_UNUSED_PARAMETER
+#endif
+#endif
+
+/**
+
+ Annotate classes where a compiler should warn if an instance is unused.
+
+ The compiler cannot warn about unused instances if they have non-trivial
+ or external constructors or destructors. Classes marked with SAL_WARN_UNUSED
+ will be warned about.
+
+ @since LibreOffice 4.0
+
+*/
+
+#if defined LIBO_INTERNAL_ONLY && (defined __GNUC__ || defined __clang__)
+#define SAL_WARN_UNUSED __attribute__((warn_unused))
+#else
+#define SAL_WARN_UNUSED
+#endif
+
+/// @cond INTERNAL
+
+#if defined __GNUC__ || defined __clang__
+// Macro to try to catch and warn on assignments inside expr.
+# define SAL_DETAIL_BOOLEAN_EXPR(expr) \
+ __extension__ ({ \
+ int sal_boolean_var_; \
+ if (expr) \
+ sal_boolean_var_ = 1; \
+ else \
+ sal_boolean_var_ = 0; \
+ sal_boolean_var_; \
+ })
+
+/** An optimization annotation: denotes that expression is likely to be true.
+
+ Use it to annotate paths that we think are likely eg.
+ if (SAL_LIKELY(ptr != nullptr))
+ // this path is the one that is ~always taken.
+
+ @since LibreOffice 5.2
+
+ Returns: the boolean value of expr (expressed as either int 1 or 0)
+ */
+# define SAL_LIKELY(expr) __builtin_expect(SAL_DETAIL_BOOLEAN_EXPR((expr)), 1)
+
+/** An optimization annotation: denotes that expression is unlikely to be true.
+
+ Use it to annotate paths that we think are likely eg.
+ if (SAL_UNLIKELY(ptr != nullptr))
+ // this path is the one that is ~never taken.
+
+ @since LibreOffice 5.2
+
+ Returns: the boolean value of expr (expressed as either int 1 or 0)
+ */
+# define SAL_UNLIKELY(expr) __builtin_expect(SAL_DETAIL_BOOLEAN_EXPR((expr)), 0)
+
+/** An optimization annotation: tells the compiler to work harder at this code
+
+ If the SAL_HOT annotation is present on a function or a label then
+ subsequent code statements may have more aggressive compiler
+ optimization and in-lining work performed on them.
+
+ In addition this code can end up in a special section, to be
+ grouped with other frequently used code.
+
+ @since LibreOffice 5.2
+ */
+# define SAL_HOT __attribute__((hot))
+
+/** An optimization annotation: tells the compiler to work less on this code
+
+ If the SAL_COLD annotation is present on a function or a label then
+ subsequent code statements are unlikely to be performed except in
+ exceptional circumstances, and optimizing for code-size rather
+ than performance is preferable.
+
+ In addition this code can end up in a special section, to be grouped
+ with (and away from) other more frequently used code, to improve
+ locality of reference.
+
+ @since LibreOffice 5.2
+ */
+# define SAL_COLD __attribute__((cold))
+#else
+# define SAL_LIKELY(expr) (expr)
+# define SAL_UNLIKELY(expr) (expr)
+# define SAL_HOT
+# define SAL_COLD
+#endif
+
+/// @endcond
+
+/// @cond INTERNAL
+/** Annotate pointer-returning functions to indicate that such a pointer
+ is never nullptr.
+
+ Note that MSVC supports this feature via it's SAL _Ret_notnull_
+ annotation, but since it's in a completely different place on
+ the function declaration, it's a little hard to support both.
+
+ @since LibreOffice 5.5
+*/
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && ((defined __GNUC__ && !defined __clang__) || (defined __clang__ && __has_attribute(returns_nonnull)))
+#define SAL_RETURNS_NONNULL __attribute__((returns_nonnull))
+#else
+#define SAL_RETURNS_NONNULL
+#endif
+/// @endcond
+
+#endif // INCLUDED_SAL_TYPES_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/typesizes.h b/include/sal/typesizes.h
new file mode 100644
index 000000000..e981818b9
--- /dev/null
+++ b/include/sal/typesizes.h
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/* DO NOT INCLUDE THIS HEADER DIRECTLY!
+ *
+ * It is only needed to make the build work. config_typesizes.h is
+ * copied to SDK as sal/typesizes.h and this is how sal/types.h includes
+ * it. This means we need to have sal/typesizes.h available for build
+ * too.
+ */
+
+#include "config_typesizes.h"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/salhelper/condition.hxx b/include/salhelper/condition.hxx
new file mode 100644
index 000000000..cb9d8206d
--- /dev/null
+++ b/include/salhelper/condition.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SALHELPER_CONDITION_HXX
+#define INCLUDED_SALHELPER_CONDITION_HXX
+
+
+#include "osl/conditn.hxx"
+#include "salhelper/salhelperdllapi.h"
+
+namespace osl { class Mutex; }
+
+namespace salhelper
+{
+
+ class SALHELPER_DLLPUBLIC Condition
+ {
+ friend class ConditionModifier;
+ friend class ConditionWaiter;
+
+ public:
+
+ Condition(osl::Mutex& aMutex);
+
+ virtual ~Condition();
+
+
+ protected:
+
+ virtual bool applies() const = 0;
+
+
+ private:
+ Condition(Condition &) SAL_DELETED_FUNCTION;
+ void operator =(Condition &) SAL_DELETED_FUNCTION;
+
+ osl::Mutex& m_aMutex;
+ osl::Condition m_aCondition;
+ };
+
+
+ class SALHELPER_DLLPUBLIC ConditionModifier
+ {
+ public:
+
+ ConditionModifier(Condition& aCond);
+
+ ~ConditionModifier();
+
+
+ private:
+ ConditionModifier(ConditionModifier &) SAL_DELETED_FUNCTION;
+ void operator =(ConditionModifier &) SAL_DELETED_FUNCTION;
+
+ Condition& m_aCond;
+ };
+
+
+ class SALHELPER_DLLPUBLIC ConditionWaiter
+ {
+ public:
+
+ ConditionWaiter(Condition& aCond);
+
+ struct SALHELPER_DLLPUBLIC timedout {
+ timedout();
+
+ timedout(timedout const &);
+
+ virtual ~timedout();
+
+ timedout & operator =(timedout const &);
+ };
+
+ /// @throws timedout
+ ConditionWaiter(Condition& aCond,sal_uInt32 milliSec);
+
+
+ ~ConditionWaiter();
+
+
+ private:
+ ConditionWaiter(ConditionWaiter &) SAL_DELETED_FUNCTION;
+ void operator =(ConditionWaiter &) SAL_DELETED_FUNCTION;
+
+ Condition& m_aCond;
+ };
+
+
+} // namespace salhelper
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/salhelper/dynload.hxx b/include/salhelper/dynload.hxx
new file mode 100644
index 000000000..b4ae693ea
--- /dev/null
+++ b/include/salhelper/dynload.hxx
@@ -0,0 +1,209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SALHELPER_DYNLOAD_HXX
+#define INCLUDED_SALHELPER_DYNLOAD_HXX
+
+#include "sal/types.h"
+#include "rtl/ustring.hxx"
+#include "osl/module.h"
+#include "salhelper/salhelperdllapi.h"
+
+namespace salhelper
+{
+
+/** The ORealDynamicLoader is an implementation helper class for the template loader ODynamicLoader.
+ */
+class SALHELPER_DLLPUBLIC ORealDynamicLoader
+{
+public:
+ /** initializes the loader, loads the library and call the initialization function.
+
+ @param ppSetToZeroInDestructor points to the loader instance which must be set to NULL
+ if the loader will be destroyed.
+ @param strModuleName specifies the library name.
+ @param strInitFunction specifies the name of the initialization function.
+ */
+ static ORealDynamicLoader* SAL_CALL newInstance(
+ ORealDynamicLoader ** ppSetToZeroInDestructor,
+ const ::rtl::OUString& strModuleName,
+ const ::rtl::OUString& strInitFunction );
+
+ /// increase the reference count.
+ sal_uInt32 SAL_CALL acquire();
+ /// decrease the reference count and delete the last instance.
+ sal_uInt32 SAL_CALL release();
+
+ /// returns a pointer to the initialized API function structure.
+ void* SAL_CALL getApi() const;
+
+protected:
+ /** Constructor.
+
+ @param ppSetToZeroInDestructor points to the loader instance which must be set to NULL
+ if the loader will be destroyed.
+ @param strModuleName specifies the library name.
+ @param strInitFunction specifies the name of the initialization function.
+ @param pApi points to a structure with the initialized API function pointers.
+ @param pModule points to the loaded library handle.
+ */
+ ORealDynamicLoader( ORealDynamicLoader ** ppSetToZeroInDestructor,
+ const ::rtl::OUString& strModuleName,
+ const ::rtl::OUString& strInitFunction,
+ void* pApi,
+ oslModule pModule );
+
+ /// Destructor, try to unload the library.
+ virtual ~ORealDynamicLoader();
+
+ /// points to the structure with the initialized API function pointers.
+ void* m_pApi;
+ /// stores the reference count.
+ sal_uInt32 m_refCount;
+ /// stores the library handle.
+ oslModule m_pModule;
+ /// stores the library name.
+ ::rtl::OUString m_strModuleName;
+ /// stores the name of the initialization function.
+ ::rtl::OUString m_strInitFunction;
+ /** stores a pointer to itself, which must be reset in the destructor to signal
+ that the loader is invalid.
+ */
+ ORealDynamicLoader ** ppSetToZeroInDestructor;
+};
+
+
+/** The ODynamicLoader provides a special load on call mechanism for dynamic libraries
+ which support a C-API.
+
+ The libraries must provide a struct with function pointers for all supported C functions.
+ The loader loads the specified library and call the specified initialization function
+ to initialize the function pointers with the real functions. Furthermore provides the
+ loader a reference counter for the library. When the last instance of the laoder will
+ be destroyed the loader will unload the library.
+
+ @deprecated
+ Do not use.
+ */
+template<class API>
+class ODynamicLoader
+{
+public:
+ /// Default constructor
+ ODynamicLoader()
+ {
+ m_pLoader = NULL;
+ }
+
+ /** Constructor, loads the library if necessary otherwise the reference count will
+ be increased.
+
+ @param strModuleName specifies the library name.
+ @param strInitFunction specifies the name of the initialization function.
+ */
+ ODynamicLoader( const ::rtl::OUString& strModuleName,
+ const ::rtl::OUString& strInitFunction )
+ {
+ if (!m_pStaticLoader)
+ {
+ m_pStaticLoader = ORealDynamicLoader::newInstance(
+ &m_pStaticLoader,
+ strModuleName,
+ strInitFunction);
+ }
+ else
+ {
+ m_pStaticLoader->acquire();
+ }
+
+ m_pLoader = m_pStaticLoader;
+ }
+
+ /// Copy constructor
+ ODynamicLoader(const ODynamicLoader<API>& toCopy)
+ {
+ m_pLoader = toCopy.m_pLoader;
+ if( m_pLoader )
+ m_pLoader->acquire();
+ }
+
+ /// Destructor, decrease the reference count and unload the library if it is the last instance.
+ ~ODynamicLoader()
+ {
+ if( m_pLoader )
+ if (m_pLoader->release()==0)
+ m_pStaticLoader = NULL;
+ }
+
+ /// Assign operator
+ ODynamicLoader<API>& SAL_CALL operator = (const ODynamicLoader<API>& toAssign)
+ {
+ if( m_pLoader != toAssign.m_pLoader )
+ {
+ if( toAssign.m_pLoader )
+ {
+ toAssign.m_pLoader->acquire();
+ }
+ if( m_pLoader )
+ {
+ m_pLoader->release();
+ }
+ m_pLoader = toAssign.m_pLoader;
+ }
+
+ return (*this);
+ }
+
+ /// returns a pointer to the initialized API function structure.
+ API* SAL_CALL getApi() const
+ {
+ return static_cast<API*>(m_pLoader->getApi());
+ }
+
+ /// cast operator, which cast to a pointer with the initialized API function structure.
+ API* SAL_CALL operator->() const
+ {
+ return static_cast<API*>(m_pLoader->getApi());
+ }
+
+ /// checks if the loader works on a loaded and initialized library.
+ bool SAL_CALL isLoaded() const
+ {
+ return (m_pLoader != NULL);
+ }
+
+protected:
+ /// stores the real loader helper instance
+ static ORealDynamicLoader* m_pStaticLoader;
+ ORealDynamicLoader* m_pLoader;
+};
+
+
+template<class API>
+ORealDynamicLoader* ODynamicLoader<API>::m_pStaticLoader = NULL;
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/salhelper/linkhelper.hxx b/include/salhelper/linkhelper.hxx
new file mode 100644
index 000000000..aa8da261a
--- /dev/null
+++ b/include/salhelper/linkhelper.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SALHELPER_LINKHELPER_HXX
+#define INCLUDED_SALHELPER_LINKHELPER_HXX
+
+#include "rtl/ustring.hxx"
+#include "osl/file.hxx"
+
+namespace salhelper
+{
+ class SAL_WARN_UNUSED LinkResolver
+ {
+ public:
+ osl::FileStatus m_aStatus;
+
+ LinkResolver(sal_uInt32 nMask)
+ : m_aStatus(nMask |
+ osl_FileStatus_Mask_FileURL |
+ osl_FileStatus_Mask_Type |
+ osl_FileStatus_Mask_LinkTargetURL)
+ {
+ }
+
+ /** Resolve a file url if it's a symbolic link, to a maximum depth of
+ * nDepth and fill in m_aStatus with the requested ctor flags
+ *
+ * @return osl::FileBase::E_None on success
+ *
+ * @see DirectoryItem::getFileStatus
+ */
+ osl::FileBase::RC fetchFileStatus(const rtl::OUString &rURL,
+ int nDepth = 128)
+ {
+ //In an ideal world this wouldn't be inline, but I want to use this
+ //in jvmfwk hence salhelper, but salhelper is .map controlled and
+ //getting all the mangled names right is a misery, moving it over
+ //to visibility markup would drop per-symbol versioning
+ osl::FileBase::RC eReturn;
+
+ osl::DirectoryItem item;
+ rtl::OUString sURL(rURL);
+ while ((eReturn = osl::DirectoryItem::get(sURL, item))
+ == osl::File::E_None)
+ {
+ if (--nDepth == 0)
+ {
+ eReturn = osl::FileBase::E_MULTIHOP;
+ break;
+ }
+ eReturn = item.getFileStatus(m_aStatus);
+ if (eReturn != osl::File::E_None)
+ break;
+ if (m_aStatus.getFileType() != osl::FileStatus::Link)
+ {
+ eReturn = osl::FileBase::E_None;
+ break;
+ }
+ sURL = m_aStatus.getLinkTargetURL();
+ }
+
+ return eReturn;
+ }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/salhelper/refobj.hxx b/include/salhelper/refobj.hxx
new file mode 100644
index 000000000..b1b308958
--- /dev/null
+++ b/include/salhelper/refobj.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SALHELPER_REFOBJ_HXX
+#define INCLUDED_SALHELPER_REFOBJ_HXX
+
+#include <cassert>
+
+#include "sal/types.h"
+#include "rtl/alloc.h"
+#include "osl/interlck.h"
+
+namespace salhelper
+{
+
+/** A base implementation for reference-counted objects.
+
+ @deprecated use salhelper::SimpleReferenceObject instead
+*/
+class ReferenceObject
+{
+ /** Representation.
+ */
+ oslInterlockedCount m_nReferenceCount;
+
+ ReferenceObject (const ReferenceObject&) SAL_DELETED_FUNCTION;
+ ReferenceObject& operator= (const ReferenceObject&) SAL_DELETED_FUNCTION;
+
+public:
+ /** Allocation.
+ */
+ static void* operator new (size_t n)
+ {
+ return ::rtl_allocateMemory (n);
+ }
+ static void operator delete (void* p)
+ {
+ ::rtl_freeMemory (p);
+ }
+ static void* operator new (size_t, void* p)
+ {
+ return p;
+ }
+ static void operator delete (void*, void*)
+ {}
+
+public:
+ /** Construction.
+ */
+ ReferenceObject() : m_nReferenceCount(0)
+ {}
+
+
+ void SAL_CALL acquire()
+ {
+ osl_atomic_increment(&m_nReferenceCount);
+ }
+
+ void SAL_CALL release()
+ {
+ if (osl_atomic_decrement(&m_nReferenceCount) == 0)
+ {
+ // Last reference released.
+ delete this;
+ }
+ }
+
+protected:
+ /** Destruction.
+ */
+ virtual ~ReferenceObject()
+ {
+ assert(m_nReferenceCount == 0);
+ }
+};
+
+
+} // namespace salhelper
+
+#endif /* ! INCLUDED_SALHELPER_REFOBJ_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/salhelper/salhelperdllapi.h b/include/salhelper/salhelperdllapi.h
new file mode 100644
index 000000000..4de2430f6
--- /dev/null
+++ b/include/salhelper/salhelperdllapi.h
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SALHELPER_SALHELPERDLLAPI_H
+#define INCLUDED_SALHELPER_SALHELPERDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(SALHELPER_DLLIMPLEMENTATION)
+#define SALHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SALHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SALHELPER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_SALHELPER_SALHELPERDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/salhelper/simplereferenceobject.hxx b/include/salhelper/simplereferenceobject.hxx
new file mode 100644
index 000000000..ac721ad3d
--- /dev/null
+++ b/include/salhelper/simplereferenceobject.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SALHELPER_SIMPLEREFERENCEOBJECT_HXX
+#define INCLUDED_SALHELPER_SIMPLEREFERENCEOBJECT_HXX
+
+#include "osl/interlck.h"
+#include "salhelper/salhelperdllapi.h"
+
+#include <cstddef>
+#include <new>
+
+namespace salhelper {
+
+/** A simple base implementation for reference-counted objects.
+
+ Classes that want to implement a reference-counting mechanism based on the
+ acquire()/release() interface should derive from this class.
+
+ The reason to have class local operators new and delete here is technical.
+ Imagine a class D derived from SimpleReferenceObject, but implemented in
+ another shared library that happens to use different global operators new
+ and delete from those used in this shared library (which, sadly, seems to
+ be possible with shared libraries). Now, without the class local
+ operators new and delete here, a code sequence like "new D" would use the
+ global operator new as found in the other shared library, while the code
+ sequence "delete this" in release() would use the global operator delete
+ as found in this shared library---and these two operators would not be
+ guaranteed to match.
+
+ There are no overloaded operators new and delete for placement new here,
+ because it is felt that the concept of placement new does not work well
+ with the concept of reference-counted objects; so it seems best to simply
+ leave those operators out.
+
+ The same problem as with operators new and delete would also be there with
+ operators new[] and delete[]. But since arrays of reference-counted
+ objects are of no use, anyway, it seems best to simply
+ define operators new[] and delete[] as deleted.
+ */
+class SALHELPER_DLLPUBLIC SimpleReferenceObject
+{
+public:
+ SimpleReferenceObject(): m_nCount(0) {}
+
+ /** @attention
+ The results are undefined if, for any individual instance of
+ SimpleReferenceObject, the total number of calls to acquire() exceeds
+ the total number of calls to release() by a platform dependent amount
+ (which, hopefully, is quite large).
+ */
+ void acquire()
+ { osl_atomic_increment(&m_nCount); }
+
+ void release()
+ { if (osl_atomic_decrement(&m_nCount) == 0) delete this; }
+
+ /** see general class documentation
+ */
+ static void * operator new(std::size_t nSize);
+
+ /** see general class documentation
+ */
+ static void * operator new(std::size_t nSize,
+ std::nothrow_t const & rNothrow);
+
+ /** see general class documentation
+ */
+ static void operator delete(void * pPtr);
+
+ /** see general class documentation
+ */
+ static void operator delete(void * pPtr, std::nothrow_t const & rNothrow);
+
+protected:
+ virtual ~SimpleReferenceObject() COVERITY_NOEXCEPT_FALSE;
+
+ oslInterlockedCount m_nCount;
+
+private:
+ /** not implemented
+ */
+ SimpleReferenceObject(SimpleReferenceObject &) SAL_DELETED_FUNCTION;
+
+ /** not implemented
+ */
+ void operator =(SimpleReferenceObject) SAL_DELETED_FUNCTION;
+
+ /** see general class documentation
+ */
+ static void * operator new[](std::size_t) SAL_DELETED_FUNCTION;
+
+ /** see general class documentation
+ */
+ static void operator delete[](void * pPtr) SAL_DELETED_FUNCTION;
+};
+
+}
+
+#endif // INCLUDED_SALHELPER_SIMPLEREFERENCEOBJECT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/salhelper/singletonref.hxx b/include/salhelper/singletonref.hxx
new file mode 100644
index 000000000..191e585c1
--- /dev/null
+++ b/include/salhelper/singletonref.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SALHELPER_SINGLETONREF_HXX
+#define INCLUDED_SALHELPER_SINGLETONREF_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "osl/mutex.hxx"
+#include "rtl/instance.hxx"
+#include "osl/diagnose.h"
+#include "osl/getglobalmutex.hxx"
+
+
+namespace salhelper{
+
+
+/** @short template for implementing singleton classes.
+
+ Such classes can be instantiated every time they
+ are needed. But the internal wrapped object will
+ be created one times only. Of course it's used
+ resources are referenced one times only too.
+ This template hold it alive till the last
+ reference is gone. Further all operations
+ on this reference are threadsafe. Only
+ calls directly to the internal object (which modify
+ its state) must be made threadsafe by the object itself
+ or from outside.
+
+ @attention To prevent the code against race conditions, it's not
+ allowed to start operations inside the ctor
+ of the internal wrapped object - especially operations
+ which needs a reference to the same singleton too.
+
+ The only chance to suppress such strange constellations
+ is a lazy-init mechanism.
+
+ <ul>
+ <li>a) The singleton class can provide a special init()
+ method, which must be called as first after creation.</li>
+ <li>b) The singleton class can call a special impl_init()
+ method implicit for every called interface method.</li>
+ </ul>
+
+ Note further that this singleton pattern can work only, if
+ all user of such singleton are located inside the same library!
+ Because static values can't be exported - e.g. from windows libraries.
+ */
+template< class SingletonClass >
+class SingletonRef
+{
+
+ // member
+
+ private:
+
+ /** @short pointer to the internal wrapped singleton. */
+ static SingletonClass* m_pInstance;
+
+ /** @short ref count, which regulate creation and removing of m_pInstance. */
+ static sal_Int32 m_nRef;
+
+
+ // interface
+
+ public:
+
+
+ /** @short standard ctor.
+
+ The internal wrapped object is created only,
+ if its ref count was 0. Otherwise this method
+ does nothing ... except increasing of the internal
+ ref count!
+ */
+ SingletonRef()
+ {
+ // GLOBAL SAFE ->
+ ::osl::MutexGuard aLock(SingletonRef::ownStaticLock());
+
+ // must be increased before(!) the check is done.
+ // Otherwise this check can fail inside the same thread ...
+ ++m_nRef;
+ if (m_nRef == 1)
+ m_pInstance = new SingletonClass();
+
+ OSL_ENSURE(m_nRef>0 && m_pInstance, "Race? Ref count of singleton >0, but instance is NULL!");
+ // <- GLOBAL SAFE
+ }
+
+
+ /** @short standard dtor.
+
+ The internal wrapped object is removed only,
+ if its ref count will be 0. Otherwise this method
+ does nothing ... except decreasing of the internal
+ ref count!
+ */
+ ~SingletonRef()
+ {
+ // GLOBAL SAFE ->
+ ::osl::MutexGuard aLock(SingletonRef::ownStaticLock());
+
+ // must be decreased before(!) the check is done.
+ // Otherwise this check can fail inside the same thread ...
+ --m_nRef;
+ if (m_nRef == 0)
+ {
+ delete m_pInstance;
+ m_pInstance = NULL;
+ }
+ // <- GLOBAL SAFE
+ }
+
+#if defined LIBO_INTERNAL_ONLY
+ SingletonRef & operator =(SingletonRef const &) = default;
+#endif
+
+ /** @short Allows rSingle->someBodyOp().
+ */
+ SingletonClass* operator->() const
+ {
+ // GLOBAL SAFE ->
+ ::osl::MutexGuard aLock(SingletonRef::ownStaticLock());
+ return m_pInstance;
+ // <- GLOBAL SAFE
+ }
+
+
+ /** @short Allows (*rSingle).someBodyOp().
+ */
+ SingletonClass& operator*() const
+ {
+ // GLOBAL SAFE ->
+ ::osl::MutexGuard aLock(SingletonRef::ownStaticLock());
+ return *m_pInstance;
+ // <- GLOBAL SAFE
+ }
+
+
+ // helper
+
+ private:
+ SingletonRef(SingletonRef &) SAL_DELETED_FUNCTION;
+
+ /** @short creates an own mutex for guarding static contents.
+
+ The global mutex the osl library is used one times
+ only to create an own static mutex, which can be used
+ next time to guard own static member operations.
+ */
+ struct SingletonLockInit
+ {
+ ::osl::Mutex* operator()()
+ {
+ static ::osl::Mutex aInstance;
+ return &aInstance;
+ }
+ };
+
+ ::osl::Mutex& ownStaticLock() const
+ {
+ return *rtl_Instance< ::osl::Mutex,
+ SingletonLockInit,
+ ::osl::MutexGuard,
+ ::osl::GetGlobalMutex >::create(SingletonLockInit(), ::osl::GetGlobalMutex());
+ }
+};
+
+template< class SingletonClass >
+SingletonClass* SingletonRef< SingletonClass >::m_pInstance = NULL;
+
+template< class SingletonClass >
+sal_Int32 SingletonRef< SingletonClass >::m_nRef = 0;
+
+} // namespace salhelper
+
+#endif // INCLUDED_SALHELPER_SINGLETONREF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/salhelper/thread.hxx b/include/salhelper/thread.hxx
new file mode 100644
index 000000000..daea7f352
--- /dev/null
+++ b/include/salhelper/thread.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SALHELPER_THREAD_HXX
+#define INCLUDED_SALHELPER_THREAD_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "osl/thread.hxx"
+#include "sal/types.h"
+#include "salhelper/salhelperdllapi.h"
+#include "salhelper/simplereferenceobject.hxx"
+
+namespace salhelper
+{
+/**
+ A safe encapsulation of ::osl::Thread.
+
+ @since LibreOffice 3.6
+*/
+class SALHELPER_DLLPUBLIC Thread : public salhelper::SimpleReferenceObject, private osl::Thread
+{
+public:
+ /**
+ @param name the thread name, see ::osl_setThreadName; must be a non-null
+ null terminated string
+ */
+ Thread(char const* name);
+
+ /**
+ Launch the thread.
+
+ This function must be called at most once.
+
+ Each call of this function should eventually be followed by a call to
+ ::osl::Thread::join before exit(3), to ensure the thread is no longer
+ relying on any infrastructure while that infrastructure is being shut
+ down in atexit handlers.
+ */
+ void launch();
+
+ using osl::Thread::getIdentifier;
+ using osl::Thread::join;
+ using osl::Thread::schedule;
+ using osl::Thread::terminate;
+
+ // While the below static member functions should arguably always be called
+ // with qualified (osl::Thread) names, compilers would still complain that
+ // they are inaccessible from within derivations of salhelper::Thread (an
+ // alternative would be to force such derivations to use global names,
+ // prefixed with ::osl::Thread):
+ using osl::Thread::getCurrentIdentifier;
+ using osl::Thread::wait;
+ using osl::Thread::yield;
+
+ static void* operator new(std::size_t size)
+ {
+ return SimpleReferenceObject::operator new(size);
+ }
+
+ static void operator delete(void* pointer) { SimpleReferenceObject::operator delete(pointer); }
+
+protected:
+ virtual ~Thread() SAL_OVERRIDE;
+
+ /**
+ The main function executed by the thread.
+
+ Any uncaught exceptions lead to std::terminate.
+ */
+ virtual void execute() = 0;
+
+private:
+ virtual void SAL_CALL run() SAL_OVERRIDE;
+
+ virtual void SAL_CALL onTerminated() SAL_OVERRIDE;
+
+ char const* name_;
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/salhelper/timer.hxx b/include/salhelper/timer.hxx
new file mode 100644
index 000000000..8c0ce5d3a
--- /dev/null
+++ b/include/salhelper/timer.hxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_SALHELPER_TIMER_HXX
+#define INCLUDED_SALHELPER_TIMER_HXX
+
+#include "salhelper/simplereferenceobject.hxx"
+#include "osl/time.h"
+#include "salhelper/salhelperdllapi.h"
+
+namespace salhelper
+{
+
+/** Helper class for easier manipulation with TimeValue.
+ *
+ * Times are seconds in UTC since 01.01.1970
+ */
+struct SAL_WARN_UNUSED TTimeValue : public TimeValue
+{
+ TTimeValue()
+ {
+ Seconds = 0;
+ Nanosec = 0;
+ }
+
+ TTimeValue( sal_uInt32 Secs, sal_uInt32 Nano )
+ {
+ Seconds = Secs;
+ Nanosec = Nano;
+
+ normalize();
+ }
+
+ TTimeValue(sal_uInt32 MilliSecs)
+ {
+ Seconds = MilliSecs / 1000;
+ Nanosec = (MilliSecs % 1000) * 1000000L;
+
+ normalize();
+ }
+
+ TTimeValue( const TimeValue& rTimeValue )
+ {
+ Seconds = rTimeValue.Seconds;
+ Nanosec = rTimeValue.Nanosec;
+
+ normalize();
+ }
+
+ void SAL_CALL normalize()
+ {
+ if ( Nanosec > 1000000000 )
+ {
+ Seconds += Nanosec / 1000000000;
+ Nanosec %= 1000000000;
+ }
+ }
+
+ void SAL_CALL addTime( const TTimeValue& Delta )
+ {
+ Seconds += Delta.Seconds;
+ Nanosec += Delta.Nanosec;
+
+ normalize();
+ }
+
+ bool SAL_CALL isEmpty() const
+ {
+ return ( ( Seconds == 0 ) && ( Nanosec == 0 ) );
+ }
+};
+
+inline bool operator<( const TTimeValue& rTimeA, const TTimeValue& rTimeB )
+{
+ if ( rTimeA.Seconds < rTimeB.Seconds )
+ return true;
+ else if ( rTimeA.Seconds > rTimeB.Seconds )
+ return false;
+ else
+ return ( rTimeA.Nanosec < rTimeB.Nanosec );
+}
+
+inline bool operator>( const TTimeValue& rTimeA, const TTimeValue& rTimeB )
+{
+ if ( rTimeA.Seconds > rTimeB.Seconds )
+ return true;
+ else if ( rTimeA.Seconds < rTimeB.Seconds )
+ return false;
+ else
+ return ( rTimeA.Nanosec > rTimeB.Nanosec );
+}
+
+inline bool operator==( const TTimeValue& rTimeA, const TTimeValue& rTimeB )
+{
+ return ( ( rTimeA.Seconds == rTimeB.Seconds ) &&
+ ( rTimeA.Nanosec == rTimeB.Nanosec ) );
+}
+
+class TimerManager;
+
+/** Interface for the Timer and handling the event
+*/
+class SALHELPER_DLLPUBLIC Timer : public salhelper::SimpleReferenceObject
+{
+public:
+
+ /** Constructor.
+ */
+ Timer();
+
+ /** Constructor.
+ */
+ Timer( const TTimeValue& Time );
+
+ /** Constructor.
+ */
+ Timer( const TTimeValue& Time, const TTimeValue& RepeatTime );
+
+ /** Start timer.
+ */
+ void SAL_CALL start();
+
+ /** Abort timer prematurely.
+ */
+ void SAL_CALL stop();
+
+ /** Returns sal_True if timer is running.
+ */
+ sal_Bool SAL_CALL isTicking() const;
+
+ /** Is the timer expired?
+ */
+ sal_Bool SAL_CALL isExpired() const;
+
+ /** Does pTimer expires before us?
+ */
+ sal_Bool SAL_CALL expiresBefore( const Timer* pTimer ) const;
+
+ /** Set the absolute time when the timer should fire.
+ */
+ void SAL_CALL setAbsoluteTime( const TTimeValue& Time );
+
+ /** Set the time to fire to 'now' + Remaining.
+ */
+ void SAL_CALL setRemainingTime( const TTimeValue& Remaining );
+
+ /** Set the time to fire to 'now' + Remaining with repeat interveal
+ * Repeat.
+ */
+ void SAL_CALL setRemainingTime( const TTimeValue& Remaining, const TTimeValue& Repeat );
+
+ /** Adds Time to the 'fire time'.
+ */
+ void SAL_CALL addTime( const TTimeValue& Time );
+
+ /** Returns the remaining time before timer expiration relative to now.
+ */
+ TTimeValue SAL_CALL getRemainingTime() const;
+
+protected:
+
+ /** Destructor.
+ */
+ virtual ~Timer() SAL_OVERRIDE;
+
+ /** What should be done when the 'timer fires'.
+ */
+ virtual void SAL_CALL onShot() = 0;
+
+protected:
+
+ /** holds (initial) expiration time of this timer.
+ */
+ TTimeValue m_aTimeOut;
+
+ /** holds the time of expiration of this timer.
+ */
+ TTimeValue m_aExpired;
+
+ /** holds the time interveal of successive expirations.
+ */
+ TTimeValue m_aRepeatDelta;
+
+ /** Pointer to the next timer (to fire).
+ */
+ Timer* m_pNext;
+
+private:
+
+ /** Copy constructor deleted.
+ */
+ Timer( const Timer& rTimer ) SAL_DELETED_FUNCTION;
+
+ /** Copy assignment operator deleted.
+ */
+ void SAL_CALL operator=( const Timer& rTimer ) SAL_DELETED_FUNCTION;
+
+ friend class TimerManager;
+};
+
+}
+
+#endif // INCLUDED_SALHELPER_TIMER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
new file mode 100644
index 000000000..57619b922
--- /dev/null
+++ b/include/sax/fastattribs.hxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SAX_FASTATTRIBS_HXX
+#define INCLUDED_SAX_FASTATTRIBS_HXX
+
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+
+#include <cppuhelper/implbase.hxx>
+#include <sax/saxdllapi.h>
+
+#include <string_view>
+#include <vector>
+
+namespace com::sun::star::xml::sax { class XFastTokenHandler; }
+namespace com::sun::star::xml { struct Attribute; }
+namespace com::sun::star::xml { struct FastAttribute; }
+
+namespace sax_fastparser
+{
+
+struct UnknownAttribute
+{
+ OUString maNamespaceURL;
+ OString maName;
+ OString maValue;
+
+ UnknownAttribute( OUString sNamespaceURL, OString aName, OString value );
+ UnknownAttribute( OString sName, OString value );
+
+ void FillAttribute( css::xml::Attribute* pAttrib ) const;
+};
+
+/// A native C++ interface to tokenisation
+class SAX_DLLPUBLIC FastTokenHandlerBase :
+ public cppu::WeakImplHelper< css::xml::sax::XFastTokenHandler >
+{
+ public:
+ virtual ~FastTokenHandlerBase();
+ virtual sal_Int32 getTokenDirect( const char *pToken, sal_Int32 nLength ) const = 0;
+
+ /**
+ * Client method to attempt the use of this interface if possible.
+ * @xTokenHandler - the token lookup interface
+ * @pStr - string buffer to lookup
+ * @nLength - optional length of chars in that buffer
+ *
+ * @return Tokenized form of pStr
+ */
+ static sal_Int32 getTokenFromChars(
+ const FastTokenHandlerBase *pTokenHandler,
+ const char *pStr, size_t nLength );
+};
+
+
+class SAX_DLLPUBLIC FastAttributeList final : public cppu::WeakImplHelper< css::xml::sax::XFastAttributeList, css::util::XCloneable >
+{
+public:
+ FastAttributeList( FastTokenHandlerBase *pTokenHandler );
+ FastAttributeList( const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList );
+ virtual ~FastAttributeList() override;
+
+ void clear();
+ void reserve( sal_Int32 nNumTokens )
+ {
+ maAttributeValues.reserve(nNumTokens+1);
+ maAttributeTokens.reserve(nNumTokens);
+ }
+ void add( const FastAttributeList& );
+ void add( const css::uno::Reference<css::xml::sax::XFastAttributeList>& );
+ void add( sal_Int32 nToken, const char* pValue );
+ void add( sal_Int32 nToken, const char* pValue, size_t nValueLength );
+ void add( sal_Int32 nToken, const OString& rValue );
+ void add( sal_Int32 nToken, std::u16string_view sValue ); // Converts to UTF-8
+ void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, const OString& rValue );
+ void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, std::u16string_view sValue );
+ // note: rQName is *namespace-prefixed*
+ void addUnknown( const OUString& rNamespaceURL, const OString& rQName, const OString& value );
+ void addUnknown( const OString& rName, const OString& value );
+ const std::vector< sal_Int32 >& getFastAttributeTokens() const { return maAttributeTokens; }
+ const char* getFastAttributeValue(size_t nIndex) const { return mpChunk + maAttributeValues[nIndex]; }
+ sal_Int32 AttributeValueLength(size_t i) const { return maAttributeValues[i + 1] - maAttributeValues[i] - 1; }
+ size_t size() const { return maAttributeValues.size(); }
+
+ // performance sensitive shortcuts to avoid allocation ...
+ bool getAsInteger( sal_Int32 nToken, sal_Int32 &rInt) const;
+ bool getAsDouble( sal_Int32 nToken, double &rDouble) const;
+ bool getAsChar( sal_Int32 nToken, const char*& rPos ) const;
+ sal_Int32 getAsIntegerByIndex( sal_Int32 nTokenIndex ) const;
+ const char* getAsCharByIndex( sal_Int32 nTokenIndex ) const;
+ OUString getValueByIndex( sal_Int32 nTokenIndex ) const;
+
+ // XFastAttributeList
+ virtual sal_Bool SAL_CALL hasAttribute( ::sal_Int32 Token ) override;
+ virtual ::sal_Int32 SAL_CALL getValueToken( ::sal_Int32 Token ) override;
+ virtual ::sal_Int32 SAL_CALL getOptionalValueToken( ::sal_Int32 Token, ::sal_Int32 Default ) override;
+ virtual OUString SAL_CALL getValue( ::sal_Int32 Token ) override;
+ virtual OUString SAL_CALL getOptionalValue( ::sal_Int32 Token ) override;
+ virtual css::uno::Sequence< css::xml::Attribute > SAL_CALL getUnknownAttributes( ) override;
+ virtual css::uno::Sequence< css::xml::FastAttribute > SAL_CALL getFastAttributes() override;
+
+ // XCloneable
+ virtual ::css::uno::Reference< ::css::util::XCloneable > SAL_CALL createClone() override;
+
+ sal_Int32 getAttributeIndex( ::sal_Int32 Token )
+ {
+ for (size_t i=0; i<maAttributeTokens.size(); ++i)
+ if (maAttributeTokens[i] == Token)
+ return i;
+ return -1;
+ }
+
+ /// Use for fast iteration and conversion of attributes
+ class FastAttributeIter {
+ const FastAttributeList &mrList;
+ size_t mnIdx;
+
+ public:
+ FastAttributeIter(const FastAttributeList &rList, size_t nIdx)
+ : mrList(rList), mnIdx(nIdx)
+ {
+ }
+
+ FastAttributeIter& operator++ ()
+ {
+ mnIdx++;
+ return *this;
+ }
+ bool operator!=( const FastAttributeIter& rhs ) const
+ {
+ return mnIdx != rhs.mnIdx;
+ }
+
+ const FastAttributeIter& operator*() const
+ {
+ return *this;
+ }
+
+ sal_Int32 getToken() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return mrList.maAttributeTokens[mnIdx];
+ }
+ bool isEmpty() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return mrList.AttributeValueLength(mnIdx) < 1;
+ }
+ sal_Int32 toInt32() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return rtl_str_toInt32(mrList.getFastAttributeValue(mnIdx), 10);
+ }
+ double toDouble() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return rtl_str_toDouble(mrList.getFastAttributeValue(mnIdx));
+ }
+ bool toBoolean() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return rtl_str_toBoolean(mrList.getFastAttributeValue(mnIdx));
+ }
+ OUString toString() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return OUString(mrList.getFastAttributeValue(mnIdx),
+ mrList.AttributeValueLength(mnIdx),
+ RTL_TEXTENCODING_UTF8);
+ }
+ const char* toCString() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return mrList.getFastAttributeValue(mnIdx);
+ }
+ sal_Int32 getLength() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return mrList.AttributeValueLength(mnIdx);
+ }
+ std::string_view toView() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return std::string_view(mrList.getFastAttributeValue(mnIdx), mrList.AttributeValueLength(mnIdx));
+ }
+ bool isString(const char *str) const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return !strcmp(str, mrList.getFastAttributeValue(mnIdx));
+ }
+ };
+ FastAttributeIter begin() const { return FastAttributeIter(*this, 0); }
+ FastAttributeIter end() const { return FastAttributeIter(*this, maAttributeTokens.size()); }
+ FastAttributeIter find( sal_Int32 nToken ) const;
+
+private:
+ char *mpChunk; ///< buffer to store all attribute values - null terminated strings
+ sal_Int32 mnChunkLength; ///< size of allocated memory for mpChunk
+ // maAttributeValues stores pointers, relative to mpChunk, for each attribute value string
+ // length of the string is maAttributeValues[n+1] - maAttributeValues[n] - 1
+ // maAttributeValues[0] == 0
+ std::vector< sal_Int32 > maAttributeValues;
+ std::vector< sal_Int32 > maAttributeTokens;
+ std::vector< UnknownAttribute > maUnknownAttributes;
+ FastTokenHandlerBase * mpTokenHandler;
+};
+
+inline FastAttributeList& castToFastAttributeList(
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
+{
+ assert( dynamic_cast <FastAttributeList *> ( xAttrList.get() ) != nullptr );
+ return *static_cast <FastAttributeList *> ( xAttrList.get() );
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/fastparser.hxx b/include/sax/fastparser.hxx
new file mode 100644
index 000000000..aebaa4056
--- /dev/null
+++ b/include/sax/fastparser.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SAX_FASTPARSER_HXX
+#define INCLUDED_SAX_FASTPARSER_HXX
+
+#include <com/sun/star/xml/sax/XFastParser.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+#include <sax/fastsaxdllapi.h>
+#include <memory>
+
+namespace com::sun::star::xml::sax {
+ class XFastDocumentHandler;
+ class XFastTokenHandler;
+}
+
+namespace sax_fastparser {
+
+
+class FastSaxParserImpl;
+
+// This class implements the external Parser interface
+class FASTSAX_DLLPUBLIC FastSaxParser final
+ : public ::cppu::WeakImplHelper<
+ css::lang::XInitialization,
+ css::xml::sax::XFastParser,
+ css::lang::XServiceInfo >
+{
+ std::unique_ptr<FastSaxParserImpl> mpImpl;
+
+public:
+ FastSaxParser();
+ virtual ~FastSaxParser() override;
+
+ // css::lang::XInitialization:
+ virtual void SAL_CALL initialize(css::uno::Sequence<css::uno::Any> const& rArguments) override;
+
+ // XFastParser
+ virtual void SAL_CALL parseStream( const css::xml::sax::InputSource& aInputSource ) override;
+ virtual void SAL_CALL setFastDocumentHandler( const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& Handler ) override;
+ virtual void SAL_CALL setTokenHandler( const css::uno::Reference< css::xml::sax::XFastTokenHandler >& Handler ) override;
+ virtual void SAL_CALL registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) override;
+ virtual OUString SAL_CALL getNamespaceURL( const OUString& rPrefix ) override;
+ virtual void SAL_CALL setErrorHandler( const css::uno::Reference< css::xml::sax::XErrorHandler >& Handler ) override;
+ virtual void SAL_CALL setEntityResolver( const css::uno::Reference< css::xml::sax::XEntityResolver >& Resolver ) override;
+ virtual void SAL_CALL setLocale( const css::lang::Locale& rLocale ) override;
+ virtual void SAL_CALL setNamespaceHandler( const css::uno::Reference< css::xml::sax::XFastNamespaceHandler >& Handler) override;
+ virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+};
+
+}
+
+#endif // _SAX_FASTPARSER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/fastsaxdllapi.h b/include/sax/fastsaxdllapi.h
new file mode 100644
index 000000000..e532dd2c5
--- /dev/null
+++ b/include/sax/fastsaxdllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SAX_FASTSAXDLLAPI_H
+#define INCLUDED_SAX_FASTSAXDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined FASTSAX_DLLIMPLEMENTATION
+#define FASTSAX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define FASTSAX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
new file mode 100644
index 000000000..79f0e1a0f
--- /dev/null
+++ b/include/sax/fshelper.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SAX_FSHELPER_HXX
+#define INCLUDED_SAX_FSHELPER_HXX
+
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
+#include <sax/saxdllapi.h>
+#include <optional>
+#include <memory>
+#include <string_view>
+#include <utility>
+
+namespace com::sun::star::io { class XOutputStream; }
+namespace sax_fastparser { class FastAttributeList; }
+
+constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element) { return (namespc << 16) | element; }
+
+namespace sax_fastparser {
+
+enum class MergeMarks { APPEND = 0, PREPEND = 1, POSTPONE = 2};
+
+class FastSaxSerializer;
+
+class SAX_DLLPUBLIC FastSerializerHelper
+{
+public:
+
+ FastSerializerHelper( const css::uno::Reference< css::io::XOutputStream >& xOutputStream, bool bWriteHeader );
+
+ ~FastSerializerHelper();
+
+ /// Start an element. After the first argument there can be a number of (attribute, value) pairs.
+ template<typename... Args>
+ void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const char* value, Args &&... args)
+ {
+ if (value)
+ pushAttributeValue(attribute, value);
+ startElement(elementTokenId, std::forward<Args>(args)...);
+ }
+ template<typename... Args>
+ void startElement(sal_Int32 elementTokenId, sal_Int32 attribute,
+ const std::optional<OString>& value, Args&&... args)
+ {
+ if (value)
+ pushAttributeValue(attribute, *value);
+ startElement(elementTokenId, std::forward<Args>(args)...);
+ }
+ template<typename... Args>
+ void startElement(sal_Int32 elementTokenId, sal_Int32 attribute,
+ const std::optional<OUString>& value, Args&&... args)
+ {
+ std::optional<OString> opt;
+ if (value)
+ opt = value->toUtf8();
+ startElement(elementTokenId, attribute, opt, std::forward<Args>(args)...);
+ }
+ void startElement(sal_Int32 elementTokenId);
+
+ /// Start an element. After the first two arguments there can be a number of (attribute, value) pairs.
+ template<typename... Args>
+ void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, Args &&... args)
+ {
+ startElement(FSNS(namespaceTokenId, elementTokenId), std::forward<Args>(args)...);
+ }
+
+ /// Create a single element. After the first argument there can be a number of (attribute, value) pairs.
+ template<typename... Args>
+ void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const char* value, Args &&... args)
+ {
+ if (value)
+ pushAttributeValue(attribute, value);
+ singleElement(elementTokenId, std::forward<Args>(args)...);
+ }
+ template<typename... Args>
+ void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute,
+ const std::optional<OString>& value, Args&&... args)
+ {
+ if (value)
+ pushAttributeValue(attribute, *value);
+ singleElement(elementTokenId, std::forward<Args>(args)...);
+ }
+ template<typename... Args>
+ void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute,
+ const std::optional<OUString>& value, Args&&... args)
+ {
+ std::optional<OString> opt;
+ if (value)
+ opt = value->toUtf8();
+ singleElement(elementTokenId, attribute, opt, std::forward<Args>(args)...);
+ }
+ void singleElement(sal_Int32 elementTokenId);
+
+ /// Create a single element. After the first two arguments there can be a number of (attribute, value) pairs.
+ template<typename... Args>
+ void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, Args &&... args)
+ {
+ singleElement(FSNS(namespaceTokenId, elementTokenId), std::forward<Args>(args)...);
+ }
+
+ void endElement(sal_Int32 elementTokenId);
+ void endElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId)
+ { endElement( FSNS( namespaceTokenId, elementTokenId ) ); }
+
+ void singleElement(sal_Int32 elementTokenId, const rtl::Reference<FastAttributeList>& xAttrList);
+ void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, rtl::Reference<FastAttributeList> const & xAttrList)
+ { singleElement(FSNS( namespaceTokenId, elementTokenId), xAttrList); }
+
+ void startElement(sal_Int32 elementTokenId, const rtl::Reference<FastAttributeList>& xAttrList);
+ void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, rtl::Reference<FastAttributeList> const & xAttrList)
+ { startElement( FSNS( namespaceTokenId, elementTokenId ), xAttrList ); }
+
+ FastSerializerHelper* write(const char* value);
+ FastSerializerHelper* write(const OString& value);
+ FastSerializerHelper* write(std::u16string_view value);
+ FastSerializerHelper* write(sal_Int32 value);
+ FastSerializerHelper* write(sal_Int64 value);
+ FastSerializerHelper* write(double value);
+
+ FastSerializerHelper* writeEscaped(const char* value);
+ FastSerializerHelper* writeEscaped(std::u16string_view value);
+
+ FastSerializerHelper* writeId(sal_Int32 tokenId);
+
+ css::uno::Reference< css::io::XOutputStream > const & getOutputStream() const;
+
+ static rtl::Reference<FastAttributeList> createAttrList();
+
+ void mark(sal_Int32 nTag,
+ const css::uno::Sequence< sal_Int32 >& rOrder =
+ css::uno::Sequence< sal_Int32 >() );
+ void mergeTopMarks(sal_Int32 nTag,
+ MergeMarks eMergeType = MergeMarks::APPEND );
+
+private:
+ void pushAttributeValue( sal_Int32 attribute, const char* value );
+ void pushAttributeValue( sal_Int32 attribute, const OString& value );
+
+ FastSaxSerializer* mpSerializer;
+};
+
+typedef std::shared_ptr< FastSerializerHelper > FSHelperPtr;
+
+// Helpers to make intention to pass optional attributes to *Element functions explicit, instead of
+// using `(condition) ? value.toUtf8().getStr() : nullptr` syntax.
+inline const char* UseIf(const char* s, bool bUse) { return bUse ? s : nullptr; }
+// OString, OUString
+template<class TString>
+std::optional<TString> UseIf(const TString& s, bool bUse)
+{
+ return bUse ? std::optional<TString>(s) : std::optional<TString>();
+}
+
+}
+
+#endif // INCLUDED_SAX_FSHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/saxdllapi.h b/include/sax/saxdllapi.h
new file mode 100644
index 000000000..9b56b94ce
--- /dev/null
+++ b/include/sax/saxdllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SAX_SAXDLLAPI_H
+#define INCLUDED_SAX_SAXDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined SAX_DLLIMPLEMENTATION
+#define SAX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SAX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
new file mode 100644
index 000000000..d797eace3
--- /dev/null
+++ b/include/sax/tools/converter.hxx
@@ -0,0 +1,313 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SAX_TOOLS_CONVERTER_HXX
+#define INCLUDED_SAX_TOOLS_CONVERTER_HXX
+
+#include <sal/config.h>
+
+#include <optional>
+#include <type_traits>
+
+#include <sax/saxdllapi.h>
+
+#include <rtl/strbuf.hxx>
+#include <sal/types.h>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/util/MeasureUnit.hpp>
+#include <tools/color.hxx>
+#include <unotools/saveopt.hxx>
+
+namespace com::sun::star {
+ namespace uno {
+ class Any;
+ }
+ namespace util {
+ struct Date;
+ struct DateTime;
+ struct Duration;
+ }
+}
+
+namespace sax {
+
+/** the Converter converts values of various types from
+ their internal representation to the textual form used in xml
+ and back.
+
+ All unit types are expressed as css::util::MeasureUnit
+*/
+
+
+class SAX_DLLPUBLIC Converter
+{
+public:
+ /** convert string to measure using optional min and max values*/
+ static bool convertMeasure( sal_Int32& rValue,
+ std::u16string_view rString,
+ sal_Int16 nTargetUnit = css::util::MeasureUnit::MM_100TH,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32 );
+
+ /** convert string to measure using optional min and max values*/
+ static bool convertMeasure( sal_Int32& rValue,
+ std::string_view rString,
+ sal_Int16 nTargetUnit = css::util::MeasureUnit::MM_100TH,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32 );
+
+ /** convert measure to string */
+ static void convertMeasure( OUStringBuffer& rBuffer,
+ sal_Int32 nMeasure,
+ sal_Int16 SourceUnit,
+ sal_Int16 nTargetUnit );
+
+ /** convert string to boolean */
+ static bool convertBool( bool& rBool,
+ std::u16string_view rString );
+
+ /** convert string to boolean */
+ static bool convertBool( bool& rBool,
+ std::string_view rString );
+
+ /** convert boolean to string */
+ static void convertBool( OUStringBuffer& rBuffer,
+ bool bValue );
+
+ /** convert string to percent */
+ static bool convertPercent( sal_Int32& rValue,
+ std::u16string_view rString );
+
+ /** convert string to percent */
+ static bool convertPercent( sal_Int32& rValue,
+ std::string_view rString );
+
+ /** convert percent to string */
+ static void convertPercent( OUStringBuffer& rBuffer,
+ sal_Int32 nValue );
+
+ /** convert string to pixel measure unit */
+ static bool convertMeasurePx( sal_Int32& rValue,
+ std::u16string_view rString );
+
+ /** convert string to pixel measure unit */
+ static bool convertMeasurePx( sal_Int32& rValue,
+ std::string_view rString );
+
+ /** convert pixel measure unit to string */
+ static void convertMeasurePx( OUStringBuffer& rBuffer,
+ sal_Int32 nValue );
+
+ /** convert string to rgb color */
+ static bool convertColor( sal_Int32& rColor,
+ std::u16string_view rValue );
+ static bool convertColor( sal_Int32& rColor,
+ std::string_view rValue );
+ static bool convertColor( ::Color& rColor,
+ std::u16string_view rValue )
+ {
+ sal_Int32 n(rColor);
+ bool b = convertColor( n, rValue );
+ if (b) rColor = Color(ColorTransparency, n);
+ return b;
+ }
+ static bool convertColor( ::Color& rColor,
+ std::string_view rValue )
+ {
+ sal_Int32 n(rColor);
+ bool b = convertColor( n, rValue );
+ if (b) rColor = Color(ColorTransparency, n);
+ return b;
+ }
+
+ /** convert color to string */
+ static void convertColor( OUStringBuffer &rBuffer,
+ sal_Int32 nColor );
+ static void convertColor( OUStringBuffer &rBuffer,
+ ::Color nColor )
+ { convertColor( rBuffer, sal_Int32(nColor) ); }
+
+ /** convert string to number with optional min and max values */
+ static bool convertNumber( sal_Int32& rValue,
+ std::u16string_view aString,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32 );
+
+ /** convert string to number with optional min and max values */
+ static bool convertNumber( sal_Int32& rValue,
+ std::string_view aString,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32 );
+
+ /** convert string to number with optional min and max values */
+ static bool convertNumber64(sal_Int64& rValue,
+ std::u16string_view aString,
+ sal_Int64 nMin = SAL_MIN_INT64,
+ sal_Int64 nMax = SAL_MAX_INT64);
+
+ /** convert string to number with optional min and max values */
+ static bool convertNumber64(sal_Int64& rValue,
+ std::string_view aString,
+ sal_Int64 nMin = SAL_MIN_INT64,
+ sal_Int64 nMax = SAL_MAX_INT64);
+
+ /** convert double number to string (using ::rtl::math) and
+ DO convert from source unit to target unit */
+ static void convertDouble( OUStringBuffer& rBuffer,
+ double fNumber,
+ bool bWriteUnits,
+ sal_Int16 nSourceUnit,
+ sal_Int16 nTargetUnit );
+
+ /** convert double number to string (using ::rtl::math) without unit conversion */
+ static void convertDouble( OUStringBuffer& rBuffer, double fNumber);
+
+ /** convert string to double number (using ::rtl::math) and DO convert from
+ source unit to target unit. */
+ static bool convertDouble( double& rValue,
+ std::u16string_view rString,
+ sal_Int16 nSourceUnit,
+ sal_Int16 nTargetUnit );
+
+ /** convert string to double number (using ::rtl::math) and DO convert from
+ source unit to target unit. */
+ static bool convertDouble( double& rValue,
+ std::string_view rString,
+ sal_Int16 nSourceUnit,
+ sal_Int16 nTargetUnit );
+
+ /** convert string to double number (using ::rtl::math) without unit conversion */
+ static bool convertDouble(double& rValue, std::u16string_view rString);
+
+ /** convert string to double number (using ::rtl::math) without unit conversion */
+ static bool convertDouble(double& rValue, std::string_view rString);
+
+ /** convert number, 10th of degrees with range [0..3600] to SVG angle */
+ static void convertAngle(OUStringBuffer& rBuffer, sal_Int16 nAngle,
+ SvtSaveOptions::ODFSaneDefaultVersion nVersion);
+
+ /** convert SVG angle to number, 10th of degrees with range [0..3600] */
+ static bool convertAngle(sal_Int16& rAngle, std::u16string_view rString,
+ bool isWrongOOo10thDegAngle);
+
+ /** convert SVG angle to number, 10th of degrees with range [0..3600] */
+ static bool convertAngle(sal_Int16& rAngle, std::string_view rString,
+ bool isWrongOOo10thDegAngle);
+
+ /** convert double to XMLSchema-2 "duration" string; negative durations allowed */
+ static void convertDuration(OUStringBuffer& rBuffer,
+ const double fTime);
+
+ /** convert util::Duration to XMLSchema-2 "duration" string */
+ static void convertDuration(OUStringBuffer& rBuffer,
+ const css::util::Duration& rDuration);
+
+ /** convert XMLSchema-2 "duration" string to double; negative durations allowed */
+ static bool convertDuration(double & rfTime,
+ std::string_view rString);
+
+ /** convert XMLSchema-2 "duration" string to util::Duration */
+ static bool convertDuration(css::util::Duration& rDuration,
+ std::u16string_view rString);
+
+ /** convert XMLSchema-2 "duration" string to util::Duration */
+ static bool convertDuration(css::util::Duration& rDuration,
+ std::string_view rString);
+
+ /** convert util::Date to XMLSchema-2 "date" string */
+ static void convertDate( OUStringBuffer& rBuffer,
+ const css::util::Date& rDate,
+ sal_Int16 const* pTimeZoneOffset);
+
+ /** convert util::DateTime to XMLSchema-2 "date" or "dateTime" string */
+ static void convertDateTime( OUStringBuffer& rBuffer,
+ const css::util::DateTime& rDateTime,
+ sal_Int16 const* pTimeZoneOffset,
+ bool bAddTimeIf0AM = false );
+
+ /** convert util::DateTime to XMLSchema-2 "time" or "dateTime" string */
+ static void convertTimeOrDateTime(OUStringBuffer& rBuffer,
+ const css::util::DateTime& rDateTime);
+
+ /** convert XMLSchema-2 "date" or "dateTime" string to util::DateTime */
+ static bool parseDateTime( css::util::DateTime& rDateTime,
+ std::u16string_view rString );
+
+ /** convert XMLSchema-2 "date" or "dateTime" string to util::DateTime */
+ static bool parseDateTime( css::util::DateTime& rDateTime,
+ std::string_view rString );
+
+ /** convert XMLSchema-2 "time" or "dateTime" string to util::DateTime */
+ static bool parseTimeOrDateTime(css::util::DateTime& rDateTime,
+ std::u16string_view rString);
+
+ /** convert XMLSchema-2 "time" or "dateTime" string to util::DateTime */
+ static bool parseTimeOrDateTime(css::util::DateTime& rDateTime,
+ std::string_view rString);
+
+ /** convert XMLSchema-2 "date" or "dateTime" string to util::DateTime or
+ util::Date */
+ static bool parseDateOrDateTime(
+ css::util::Date * pDate,
+ css::util::DateTime & rDateTime,
+ bool & rbDateTime,
+ std::optional<sal_Int16> * pTimeZoneOffset,
+ std::u16string_view rString );
+
+ /** convert XMLSchema-2 "date" or "dateTime" string to util::DateTime or
+ util::Date */
+ static bool parseDateOrDateTime(
+ css::util::Date * pDate,
+ css::util::DateTime & rDateTime,
+ bool & rbDateTime,
+ std::optional<sal_Int16> * pTimeZoneOffset,
+ std::string_view rString );
+
+ /** gets the position of the first comma after npos in the string
+ rStr. Commas inside '"' pairs are not matched */
+ static sal_Int32 indexOfComma( std::u16string_view rStr,
+ sal_Int32 nPos );
+
+ static double GetConversionFactor(OUStringBuffer& rUnit, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit);
+ static double GetConversionFactor(OStringBuffer& rUnit, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit);
+ static sal_Int16 GetUnitFromString(std::u16string_view rString, sal_Int16 nDefaultUnit);
+ static sal_Int16 GetUnitFromString(std::string_view rString, sal_Int16 nDefaultUnit);
+
+ /** convert an Any to string (typesafe) */
+ static bool convertAny(OUStringBuffer& rsValue,
+ OUStringBuffer& rsType ,
+ const css::uno::Any& rValue);
+
+ /** convert specified byte sequence to xsd:hexBinary string **/
+ static void convertBytesToHexBinary(OUStringBuffer& rBuffer, const void* pBytes,
+ sal_Int32 nBytes);
+
+ template <typename T, std::enable_if_t<std::is_arithmetic_v<T>, int> = 0>
+ static void convertNumberToHexBinary(OUStringBuffer& rBuffer, T n)
+ {
+ convertBytesToHexBinary(rBuffer, &n, sizeof(n));
+ }
+
+};
+
+}
+
+#endif // INCLUDED_SAX_TOOLS_CONVERTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/tools/documenthandleradapter.hxx b/include/sax/tools/documenthandleradapter.hxx
new file mode 100644
index 000000000..0296abfd6
--- /dev/null
+++ b/include/sax/tools/documenthandleradapter.hxx
@@ -0,0 +1,214 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SAX_TOOLS_DOCUMENTHANDLERADAPTER_HXX
+#define INCLUDED_SAX_TOOLS_DOCUMENTHANDLERADAPTER_HXX
+
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+
+namespace sax
+{
+ /**
+ * DocumentHandlerAdapter provides a base class for simple decorators to XDocumentHandlers.
+ * It forwards all method calls to a delegate. An inheriting class only needs to override the
+ * methods it actually wants to modify.
+ *
+ * See filters/source/odfflatxml/FlatXml.cxx for an example.
+ */
+ class DocumentHandlerAdapter : public css::xml::sax::XDocumentHandler
+ {
+ public:
+ // XDocumentHandler
+ virtual void SAL_CALL
+ startDocument() override
+ {
+ m_handler->startDocument();
+ }
+
+ virtual void SAL_CALL
+ endDocument() override
+ {
+ m_handler->endDocument();
+ }
+
+ virtual void SAL_CALL
+ startElement(const OUString& aName,
+ const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs) override
+ {
+ m_handler->startElement(aName, xAttribs);
+ }
+
+ virtual void SAL_CALL
+ endElement(const OUString& aName) override
+ {
+ m_handler->endElement(aName);
+ }
+
+ virtual void SAL_CALL
+ characters(const OUString& aChars) override
+ {
+ m_handler->characters(aChars);
+ }
+
+ virtual void SAL_CALL
+ ignorableWhitespace(const OUString& aWhitespaces) override
+ {
+ m_handler->ignorableWhitespace(aWhitespaces);
+ }
+ virtual void SAL_CALL
+ processingInstruction(const OUString& aTarget, const OUString& aData) override
+ {
+ m_handler->processingInstruction(aTarget, aData);
+ }
+ virtual void SAL_CALL
+ setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > & xLocator) override
+ {
+ m_handler->setDocumentLocator(xLocator);
+ }
+ DocumentHandlerAdapter() :
+ m_handler(css::uno::Reference< css::xml::sax::XDocumentHandler > (nullptr, css::uno::UNO_QUERY))
+ {
+ }
+ ;
+
+ protected:
+ void
+ setDelegate(const css::uno::Reference< css::xml::sax::XDocumentHandler >& delegate)
+ {
+ m_handler = delegate;
+ }
+ const css::uno::Reference< css::xml::sax::XDocumentHandler >&
+ getDelegate() const
+ {
+ return m_handler;
+ }
+ virtual
+ ~DocumentHandlerAdapter()
+ {
+
+ }
+
+ private:
+ css::uno::Reference< css::xml::sax::XDocumentHandler > m_handler;
+
+ };
+
+ /**
+ * ExtendedDocumentHandlerAdapter provides a base class for simple decorators to XExtendedDocumentHandlers.
+ * It forwards all method calls to a delegate. An inheriting class only needs to override the
+ * methods it actually wants to modify.
+ */
+ class ExtendedDocumentHandlerAdapter : public css::xml::sax::XExtendedDocumentHandler
+
+ {
+
+ public:
+ // XDocumentHandler
+ virtual void SAL_CALL
+ startDocument() override
+ {
+ m_handler->startDocument();
+ }
+
+ virtual void SAL_CALL
+ endDocument() override
+ {
+ m_handler->endDocument();
+ }
+
+ virtual void SAL_CALL
+ startElement(const OUString& aName,
+ const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs) override
+ {
+ m_handler->startElement(aName, xAttribs);
+ }
+
+ virtual void SAL_CALL
+ endElement(const OUString& aName) override
+ {
+ m_handler->endElement(aName);
+ }
+
+ virtual void SAL_CALL
+ characters(const OUString& aChars) override
+ {
+ m_handler->characters(aChars);
+ }
+
+ virtual void SAL_CALL
+ ignorableWhitespace(const OUString& aWhitespaces) override
+ {
+ m_handler->ignorableWhitespace(aWhitespaces);
+ }
+ virtual void SAL_CALL
+ processingInstruction(const OUString& aTarget, const OUString& aData) override
+ {
+ m_handler->processingInstruction(aTarget, aData);
+ }
+ virtual void SAL_CALL
+ setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > & xLocator) override
+ {
+ m_handler->setDocumentLocator(xLocator);
+ }
+ // XExtendedDocumentHandler
+ virtual void SAL_CALL
+ startCDATA() override
+ {
+ m_handler->startCDATA();
+ }
+ virtual void SAL_CALL
+ endCDATA() override
+ {
+ m_handler->endCDATA();
+ }
+ virtual void SAL_CALL
+ comment(const OUString& sComment) override
+ {
+ m_handler->comment(sComment);
+ }
+ virtual void SAL_CALL
+ unknown(const OUString& sString) override
+ {
+ m_handler->unknown(sString);
+ }
+ virtual void SAL_CALL
+ allowLineBreak() override
+ {
+ m_handler->allowLineBreak();
+ }
+ protected:
+ ExtendedDocumentHandlerAdapter() :
+ m_handler(css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > (nullptr, css::uno::UNO_QUERY))
+ {
+ }
+
+ void
+ setDelegate(const css::uno::Reference< css::xml::sax::XExtendedDocumentHandler >& delegate)
+ {
+ m_handler = delegate;
+ }
+ const css::uno::Reference< css::xml::sax::XExtendedDocumentHandler >&
+ getDelegate() const
+ {
+ return m_handler;
+ }
+ virtual
+ ~ExtendedDocumentHandlerAdapter()
+ {
+
+ }
+
+ private:
+ css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > m_handler;
+ };
+}
+#endif // INCLUDED_SAX_TOOLS_DOCUMENTHANDLERADAPTER_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/AccessibilityCheck.hxx b/include/sfx2/AccessibilityCheck.hxx
new file mode 100644
index 000000000..4c90ad31d
--- /dev/null
+++ b/include/sfx2/AccessibilityCheck.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <sfx2/dllapi.h>
+#include <sfx2/AccessibilityIssue.hxx>
+
+namespace sfx
+{
+class SFX2_DLLPUBLIC AccessibilityCheck
+{
+protected:
+ AccessibilityIssueCollection m_aIssueCollection;
+
+public:
+ AccessibilityCheck() = default;
+ virtual ~AccessibilityCheck();
+
+ virtual void check() = 0;
+
+ AccessibilityIssueCollection& getIssueCollection();
+};
+
+} // end sfx namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/AccessibilityIssue.hxx b/include/sfx2/AccessibilityIssue.hxx
new file mode 100644
index 000000000..4cc9a72e7
--- /dev/null
+++ b/include/sfx2/AccessibilityIssue.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <sfx2/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <memory>
+
+namespace sfx
+{
+enum class AccessibilityIssueID
+{
+ UNSPECIFIED, // TODO: remove - temporary
+ DOCUMENT_TITLE,
+ DOCUMENT_LANGUAGE,
+ STYLE_LANGUAGE,
+ NO_ALT_OLE,
+ NO_ALT_GRAPHIC,
+ NO_ALT_SHAPE,
+ TABLE_MERGE_SPLIT,
+ TEXT_FORMATTING,
+};
+
+class SFX2_DLLPUBLIC AccessibilityIssue
+{
+public:
+ AccessibilityIssue(AccessibilityIssueID eIssueID = AccessibilityIssueID::UNSPECIFIED);
+ virtual ~AccessibilityIssue();
+
+ virtual bool canGotoIssue() const = 0;
+ virtual void gotoIssue() const = 0;
+
+ AccessibilityIssueID m_eIssueID;
+ OUString m_aIssueText;
+};
+
+class SFX2_DLLPUBLIC AccessibilityIssueCollection
+{
+private:
+ std::vector<std::shared_ptr<AccessibilityIssue>> m_aIssues;
+
+public:
+ AccessibilityIssueCollection() = default;
+
+ std::vector<std::shared_ptr<AccessibilityIssue>>& getIssues();
+};
+
+} // end sfx namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/DocumentMetadataAccess.hxx b/include/sfx2/DocumentMetadataAccess.hxx
new file mode 100644
index 000000000..bcbf9f1b3
--- /dev/null
+++ b/include/sfx2/DocumentMetadataAccess.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_DOCUMENTMETADATAACCESS_HXX
+#define INCLUDED_SFX2_DOCUMENTMETADATAACCESS_HXX
+
+#include <sal/config.h>
+
+#include <sfx2/dllapi.h>
+
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+
+#include <cppuhelper/implbase.hxx>
+
+#include <memory>
+
+
+/** Implementation of the interface com.sun.star.rdf.XDocumentMetadataAccess
+
+ This is not a service only because it needs some kind of XML ID registry
+ from the document, and i do not like defining an API for that.
+ Also, the implementation does _no_ locking, so make sure access is
+ protected externally.
+ */
+
+namespace com::sun::star::embed {
+ class XStorage;
+}
+namespace com::sun::star::frame {
+ class XModel;
+}
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+class SfxObjectShell;
+
+namespace sfx2 {
+
+
+/** create a base URI for loading metadata from an ODF (sub)document.
+
+ @param i_xContext component context
+ @param i_xModel model of the document (required if no URI is provided)
+ @param i_rPkgURI the URI for the package
+ @param i_rSubDocument (optional) path of the subdocument in package
+
+ @return a base URI suitable for XDocumentMetadataAccess::loadFromStorage
+ */
+css::uno::Reference< css::rdf::XURI> SFX2_DLLPUBLIC
+createBaseURI(
+ css::uno::Reference<css::uno::XComponentContext> const & i_xContext,
+ css::uno::Reference<css::frame::XModel> const & i_xModel,
+ OUString const & i_rPkgURI,
+ std::u16string_view i_rSubDocument = std::u16string_view());
+
+
+struct DocumentMetadataAccess_Impl;
+
+class DocumentMetadataAccess final :
+ public cppu::WeakImplHelper<css::rdf::XDocumentMetadataAccess>
+{
+ DocumentMetadataAccess(const DocumentMetadataAccess&) = delete;
+ DocumentMetadataAccess& operator=( const DocumentMetadataAccess& ) = delete;
+public:
+ explicit DocumentMetadataAccess(css::uno::Reference< css::uno::XComponentContext > const & i_xContext,
+ SfxObjectShell const & i_rRegistrySupplier,
+ OUString const & i_rBaseURI);
+ // N.B.: in contrast to previous, this constructor does _not_ initialize!
+ // caller must immediately call loadFromStorage/Medium!
+ explicit DocumentMetadataAccess(css::uno::Reference< css::uno::XComponentContext > const & i_xContext,
+ SfxObjectShell const & i_rRegistrySupplier);
+ virtual ~DocumentMetadataAccess() override;
+
+ // css::rdf::XNode:
+ virtual OUString SAL_CALL getStringValue() override;
+
+ // css::rdf::XURI:
+ virtual OUString SAL_CALL getNamespace() override;
+ virtual OUString SAL_CALL getLocalName() override;
+
+ // css::rdf::XRepositorySupplier:
+ virtual css::uno::Reference<
+ css::rdf::XRepository > SAL_CALL getRDFRepository() override;
+
+ // css::rdf::XDocumentMetadataAccess:
+ virtual css::uno::Reference<
+ css::rdf::XMetadatable > SAL_CALL
+ getElementByMetadataReference(
+ const css::beans::StringPair & i_rReference) override;
+ virtual css::uno::Reference< css::rdf::XMetadatable > SAL_CALL
+ getElementByURI(const css::uno::Reference< css::rdf::XURI > & i_xURI) override;
+ virtual css::uno::Sequence< css::uno::Reference< css::rdf::XURI > > SAL_CALL getMetadataGraphsWithType(
+ const css::uno::Reference< css::rdf::XURI > & i_xType) override;
+ virtual css::uno::Reference< css::rdf::XURI> SAL_CALL
+ addMetadataFile(const OUString & i_rFileName,
+ const css::uno::Sequence< css::uno::Reference< css::rdf::XURI > > & i_rTypes) override;
+ virtual css::uno::Reference< css::rdf::XURI> SAL_CALL
+ importMetadataFile(::sal_Int16 i_Format,
+ const css::uno::Reference< css::io::XInputStream > & i_xInStream,
+ const OUString & i_rFileName,
+ const css::uno::Reference< css::rdf::XURI > & i_xBaseURI,
+ const css::uno::Sequence< css::uno::Reference< css::rdf::XURI > > & i_rTypes) override;
+ virtual void SAL_CALL removeMetadataFile(
+ const css::uno::Reference<
+ css::rdf::XURI > & i_xGraphName) override;
+ virtual void SAL_CALL addContentOrStylesFile(
+ const OUString & i_rFileName) override;
+ virtual void SAL_CALL removeContentOrStylesFile(
+ const OUString & i_rFileName) override;
+
+ virtual void SAL_CALL loadMetadataFromStorage(
+ const css::uno::Reference<
+ css::embed::XStorage > & i_xStorage,
+ const css::uno::Reference<
+ css::rdf::XURI > & i_xBaseURI,
+ const css::uno::Reference<
+ css::task::XInteractionHandler> & i_xHandler) override;
+ virtual void SAL_CALL storeMetadataToStorage(
+ const css::uno::Reference<
+ css::embed::XStorage > & i_xStorage) override;
+ virtual void SAL_CALL loadMetadataFromMedium(
+ const css::uno::Sequence<
+ css::beans::PropertyValue > & i_rMedium) override;
+ virtual void SAL_CALL storeMetadataToMedium(
+ const css::uno::Sequence<
+ css::beans::PropertyValue > & i_rMedium) override;
+
+private:
+ std::unique_ptr<DocumentMetadataAccess_Impl> m_pImpl;
+};
+
+} // namespace sfx2
+
+#endif // INCLUDED_SFX2_DOCUMENTMETADATAACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/DocumentSigner.hxx b/include/sfx2/DocumentSigner.hxx
new file mode 100644
index 000000000..8059cb9cb
--- /dev/null
+++ b/include/sfx2/DocumentSigner.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_SFX2_DOCUMENTSIGNER_HXX
+#define INCLUDED_SFX2_DOCUMENTSIGNER_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::security
+{
+class XCertificate;
+}
+namespace com::sun::star::uno
+{
+template <typename> class Reference;
+}
+
+namespace sfx2
+{
+class SFX2_DLLPUBLIC DocumentSigner
+{
+private:
+ OUString m_aUrl;
+
+public:
+ DocumentSigner(OUString const& rUrl)
+ : m_aUrl(rUrl)
+ {
+ }
+
+ bool signDocument(css::uno::Reference<css::security::XCertificate> const& rxCertificate);
+};
+
+} // namespace sfx2
+
+#endif // INCLUDED_SFX2_DOCUMENTSIGNER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/LokControlHandler.hxx b/include/sfx2/LokControlHandler.hxx
new file mode 100644
index 000000000..c422afc97
--- /dev/null
+++ b/include/sfx2/LokControlHandler.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sfx2/lokhelper.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdouno.hxx>
+#include <tools/UnitConversion.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/XGraphics.hpp>
+#include <com/sun/star/awt/XView.hpp>
+#include <toolkit/helper/vclunohelper.hxx>
+
+class LokControlHandler
+{
+public:
+ static bool postMouseEvent(const SdrPage* pPage, const SdrView* pDrawView,
+ vcl::Window const& rMainWindow, int nType, Point aPointHmm,
+ int nCount, int nButtons, int nModifier)
+ {
+ SdrObjListIter aIterator(pPage, SdrIterMode::Flat);
+ while (aIterator.IsMore())
+ {
+ SdrObject* pObject = aIterator.Next();
+ SdrUnoObj* pUnoObect = dynamic_cast<SdrUnoObj*>(pObject);
+ if (pUnoObect)
+ {
+ tools::Rectangle aControlRectHMM = pUnoObect->GetLogicRect();
+ if (aControlRectHMM.Contains(aPointHmm))
+ {
+ css::uno::Reference<css::awt::XControl> xControl
+ = pUnoObect->GetUnoControl(*pDrawView, *rMainWindow.GetOutDev());
+ if (!xControl.is())
+ return false;
+
+ css::uno::Reference<css::awt::XWindow> xControlWindow(xControl,
+ css::uno::UNO_QUERY);
+ if (!xControlWindow.is())
+ return false;
+
+ css::uno::Reference<css::awt::XWindowPeer> xWindowPeer(xControl->getPeer());
+
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindowPeer);
+ if (pWindow)
+ {
+ Point aControlRelativePositionHMM = aPointHmm - aControlRectHMM.TopLeft();
+ Point aControlRelativePosition = o3tl::convert(
+ aControlRelativePositionHMM, o3tl::Length::mm100, o3tl::Length::px);
+
+ LokMouseEventData aMouseEventData(nType, aControlRelativePosition, nCount,
+ MouseEventModifiers::SIMPLECLICK,
+ nButtons, nModifier);
+
+ SfxLokHelper::postMouseEventAsync(pWindow, aMouseEventData);
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ static void drawUnoControl(const SdrView* pDrawView, const SdrUnoObj* pUnoObect,
+ vcl::Window const& rMainWindow, VirtualDevice& rDevice,
+ tools::Rectangle const& rTileRectHMM, double scaleX, double scaleY)
+ {
+ css::uno::Reference<css::awt::XControl> xControl
+ = pUnoObect->GetUnoControl(*pDrawView, *rMainWindow.GetOutDev());
+ if (!xControl.is())
+ return;
+
+ css::uno::Reference<css::awt::XWindow> xControlWindow(xControl, css::uno::UNO_QUERY);
+ if (!xControlWindow.is())
+ return;
+
+ css::uno::Reference<css::awt::XGraphics> xGraphics(rDevice.CreateUnoGraphics());
+ if (!xGraphics.is())
+ return;
+
+ css::uno::Reference<css::awt::XView> xControlView(xControl, css::uno::UNO_QUERY);
+ if (!xControlView.is())
+ return;
+
+ tools::Rectangle aObjectRectHMM = pUnoObect->GetLogicRect();
+ Point aOffsetFromTile(aObjectRectHMM.Left() - rTileRectHMM.Left(),
+ aObjectRectHMM.Top() - rTileRectHMM.Top());
+ tools::Rectangle aRectangleHMM(aOffsetFromTile, aObjectRectHMM.GetSize());
+ tools::Rectangle aRectanglePx
+ = o3tl::convert(aRectangleHMM, o3tl::Length::mm100, o3tl::Length::px);
+
+ xControlWindow->setPosSize(0, 0, aRectanglePx.GetWidth(), aRectanglePx.GetHeight(),
+ css::awt::PosSize::POSSIZE);
+
+ xControlView->setGraphics(xGraphics);
+
+ xControlView->draw(aRectanglePx.Left() * scaleX, aRectanglePx.Top() * scaleY);
+ }
+
+ static void paintControlTile(const SdrPage* pPage, const SdrView* pDrawView,
+ vcl::Window const& rMainWindow, VirtualDevice& rDevice,
+ Size aOutputSize, tools::Rectangle const& rTileRect)
+ {
+ tools::Rectangle aTileRectHMM
+ = o3tl::convert(rTileRect, o3tl::Length::twip, o3tl::Length::mm100);
+
+ // Resizes the virtual device so to contain the entries context
+ rDevice.SetOutputSizePixel(aOutputSize);
+
+ rDevice.Push(vcl::PushFlags::MAPMODE);
+ MapMode aDeviceMapMode(rDevice.GetMapMode());
+
+ const Fraction scale = conversionFract(o3tl::Length::px, o3tl::Length::mm100);
+ Fraction scaleX = Fraction(aOutputSize.Width(), aTileRectHMM.GetWidth()) * scale;
+ Fraction scaleY = Fraction(aOutputSize.Height(), aTileRectHMM.GetHeight()) * scale;
+ aDeviceMapMode.SetScaleX(scaleX);
+ aDeviceMapMode.SetScaleY(scaleY);
+ rDevice.SetMapMode(aDeviceMapMode);
+
+ SdrObjListIter aIterator(pPage, SdrIterMode::Flat);
+
+ while (aIterator.IsMore())
+ {
+ SdrObject* pObject = aIterator.Next();
+ SdrUnoObj* pUnoObect = dynamic_cast<SdrUnoObj*>(pObject);
+ if (pUnoObect)
+ {
+ tools::Rectangle aObjectRectHMM = pUnoObect->GetLogicRect();
+
+ // Check if we intersect with the tile rectangle and we
+ // need to draw the control.
+ if (aObjectRectHMM.Overlaps(aTileRectHMM))
+ {
+ drawUnoControl(pDrawView, pUnoObect, rMainWindow, rDevice, aTileRectHMM,
+ double(scaleX), double(scaleY));
+ }
+ }
+ }
+
+ rDevice.Pop();
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/Metadatable.hxx b/include/sfx2/Metadatable.hxx
new file mode 100644
index 000000000..a84bddb89
--- /dev/null
+++ b/include/sfx2/Metadatable.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_METADATABLE_HXX
+#define INCLUDED_SFX2_METADATABLE_HXX
+
+#include <sal/config.h>
+
+#include <sfx2/dllapi.h>
+
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/rdf/XMetadatable.hpp>
+
+#include <memory>
+
+
+namespace com::sun::star {
+ namespace frame { class XModel; }
+}
+
+namespace sfx2 {
+ class IXmlIdRegistry;
+}
+
+namespace sfx2 {
+
+class XmlIdRegistry;
+class MetadatableUndo;
+
+
+// XML ID handling ---------------------------------------------------
+
+
+/// create a sfx2::XmlIdRegistryDocument or a sfx2::XmlIdRegistryClipboard
+SFX2_DLLPUBLIC ::sfx2::IXmlIdRegistry *
+createXmlIdRegistry(const bool i_DocIsClipboard);
+
+
+/** base class for core objects that may have xml:id.
+
+ <p>The interface of this class consists of 3 parts:
+ <ul><li>implementations that are used by the MetadatableMixin
+ below</li>
+ <li>hooks to be called by the sw core whenever actions that are
+ relevant to the uniqueness of xml:ids are taken (copying,
+ splitting, merging, deletion, undo, etc.)</li>
+ <li>abstract methods that are called by the implementation of the
+ previous hooks</li></ul>
+ </p>
+ */
+class SFX2_DLLPUBLIC Metadatable
+{
+public:
+ Metadatable() : m_pReg(nullptr) {}
+
+ // destructor calls RemoveMetadataReference
+ virtual ~Metadatable();
+
+ // for MetadatableMixin ----------------------------------------------
+
+ css::beans::StringPair GetMetadataReference() const;
+ void SetMetadataReference( const css::beans::StringPair & i_rReference);
+ void EnsureMetadataReference();
+
+ // hooks -------------------------------------------------------------
+
+ // called from dtor!
+ void RemoveMetadataReference();
+
+ /** register this as a copy of i_rSource */
+ void RegisterAsCopyOf(Metadatable const & i_rSource,
+ const bool i_bCopyPrecedesSource = false);
+
+ /** create an Undo Metadatable, which remembers this' reference */
+ std::shared_ptr<MetadatableUndo> CreateUndo() const;
+ std::shared_ptr<MetadatableUndo> CreateUndoForDelete();
+
+ /** restore this from Undo Metadatable */
+ void RestoreMetadata(std::shared_ptr<MetadatableUndo> const& i_pUndo);
+
+ /** merge this and i_rOther into this */
+ void JoinMetadatable(Metadatable const & i_rOther,
+ const bool i_isMergedEmpty, const bool i_isOtherEmpty);
+
+ // abstract methods --------------------------------------------------
+
+ /** get the registry from the SwDoc */
+ virtual ::sfx2::IXmlIdRegistry& GetRegistry() = 0;
+
+ /** is this in a clipboard document? */
+ virtual bool IsInClipboard() const = 0;
+
+ /** is this in undo array? */
+ virtual bool IsInUndo() const = 0;
+
+ /** which stream is this in? true: content.xml; false: styles.xml */
+ virtual bool IsInContent() const = 0;
+
+ /** create XMetadatable from this.
+ note: if IsInUndo or IsInClipboard return true,
+ MakeUnoObject <em>must not</em> be called!
+ */
+ virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() = 0;
+
+private:
+ Metadatable(const Metadatable&) = delete;
+ Metadatable& operator=(const Metadatable&) = delete;
+
+ friend class MetadatableClipboard;
+ friend class MetadatableUndo;
+
+ // note that Reg may be a XmlIdRegistryDocument or a XmlIdRegistryClipboard
+ XmlIdRegistry* m_pReg; // null => no XmlId
+};
+
+
+/** base class for UNO objects that implement XMetadatable.
+
+ <p>An instance of this base class is associated with an instance of
+ Metadatable.</p>
+ */
+class SFX2_DLLPUBLIC MetadatableMixin :
+ public cppu::WeakImplHelper<css::rdf::XMetadatable>
+{
+
+public:
+ MetadatableMixin() {};
+
+ // css::rdf::XNode:
+ virtual OUString SAL_CALL getStringValue() override;
+
+ // css::rdf::XURI:
+ virtual OUString SAL_CALL getLocalName() override;
+ virtual OUString SAL_CALL getNamespace() override;
+
+ // css::rdf::XMetadatable:
+ virtual css::beans::StringPair SAL_CALL getMetadataReference() override;
+ virtual void SAL_CALL setMetadataReference(
+ const css::beans::StringPair & i_rReference) override;
+ virtual void SAL_CALL ensureMetadataReference() override;
+
+protected:
+ /// get the core object corresponding to this UNO object.
+ virtual Metadatable * GetCoreObject() = 0;
+ /// get the XModel for the document
+ virtual css::uno::Reference< css::frame::XModel >
+ GetModel() = 0;
+
+};
+
+} // namespace sfx2
+
+#endif // INCLUDED_SFX2_METADATABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/QuerySaveDocument.hxx b/include/sfx2/QuerySaveDocument.hxx
new file mode 100644
index 000000000..2d800be80
--- /dev/null
+++ b/include/sfx2/QuerySaveDocument.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_QUERYSAVEDOCUMENT_HXX
+#define INCLUDED_SFX2_QUERYSAVEDOCUMENT_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <sfx2/dllapi.h>
+
+namespace weld
+{
+class Widget;
+}
+
+/** Opens the general query save document dialog.
+ @param _pParent
+ The parent window.
+ @_rTitle
+ The title of the document.
+*/
+SFX2_DLLPUBLIC short ExecuteQuerySaveDocument(weld::Widget* _pParent, std::u16string_view _rTitle);
+
+#endif // INCLUDED_SFX2_QUERYSAVEDOCUMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/StyleManager.hxx b/include/sfx2/StyleManager.hxx
new file mode 100644
index 000000000..1c19b981d
--- /dev/null
+++ b/include/sfx2/StyleManager.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_STYLEMANAGER_HXX
+#define INCLUDED_SFX2_STYLEMANAGER_HXX
+
+#include <sfx2/dllapi.h>
+
+#include <svl/style.hxx>
+#include <tools/long.hxx>
+
+#include <memory>
+
+class OutputDevice;
+class SfxObjectShell;
+namespace sfx2 { class StylePreviewRenderer; }
+
+namespace sfx2
+{
+
+class SFX2_DLLPUBLIC StyleManager
+{
+protected:
+ SfxObjectShell& mrShell;
+
+public:
+ StyleManager(SfxObjectShell& rShell)
+ : mrShell(rShell)
+ {}
+
+ virtual ~StyleManager()
+ {}
+
+ SfxStyleSheetBase* Search(std::u16string_view rStyleName, SfxStyleFamily eFamily);
+
+ virtual std::unique_ptr<StylePreviewRenderer> CreateStylePreviewRenderer(
+ OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle,
+ tools::Long nMaxHeight) = 0;
+};
+
+} // end namespace sfx2
+
+#endif //INCLUDED_SFX2_STYLEMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/StylePreviewRenderer.hxx b/include/sfx2/StylePreviewRenderer.hxx
new file mode 100644
index 000000000..1692182bd
--- /dev/null
+++ b/include/sfx2/StylePreviewRenderer.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_STYLEPREVIEWRENDERER_HXX
+#define INCLUDED_SFX2_STYLEPREVIEWRENDERER_HXX
+
+#include <sfx2/dllapi.h>
+#include <sfx2/objsh.hxx>
+
+class OutputDevice;
+class SfxStyleSheetBase;
+
+namespace sfx2
+{
+
+class SFX2_DLLPUBLIC StylePreviewRenderer
+{
+protected:
+ const SfxObjectShell& mrShell;
+ OutputDevice& mrOutputDev;
+ SfxStyleSheetBase* mpStyle;
+ tools::Long mnMaxHeight;
+
+public:
+ enum class RenderAlign
+ {
+ TOP, CENTER
+ };
+
+ StylePreviewRenderer(const SfxObjectShell& rShell,
+ OutputDevice& rOutputDev,
+ SfxStyleSheetBase* pStyle,
+ tools::Long nMaxHeight)
+ : mrShell(rShell)
+ , mrOutputDev(rOutputDev)
+ , mpStyle(pStyle)
+ , mnMaxHeight(nMaxHeight)
+ {}
+
+ virtual ~StylePreviewRenderer()
+ {}
+
+ virtual bool recalculate() = 0;
+ virtual bool render(const tools::Rectangle& aRectangle, RenderAlign eRenderAlign = RenderAlign::CENTER) = 0;
+};
+
+} // end namespace sfx2
+
+#endif // INCLUDED_SVX_STYLEPREVIEWRENDERER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/XmlIdRegistry.hxx b/include/sfx2/XmlIdRegistry.hxx
new file mode 100644
index 000000000..494c83020
--- /dev/null
+++ b/include/sfx2/XmlIdRegistry.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_XMLIDREGISTRY_HXX
+#define INCLUDED_SFX2_XMLIDREGISTRY_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <sfx2/dllapi.h>
+
+namespace com::sun::star::beans { struct StringPair; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+namespace com::sun::star::rdf {
+ class XMetadatable;
+}
+
+namespace sfx2 {
+
+// XML ID utilities --------------------------------------------------
+
+/** is i_rIdref a valid NCName ? */
+bool SFX2_DLLPUBLIC isValidNCName(std::u16string_view i_rIdref);
+
+bool SFX2_DLLPUBLIC isValidXmlId(std::u16string_view i_rStreamName,
+ std::u16string_view i_rIdref);
+
+// XML ID handling ---------------------------------------------------
+
+/** interface for getElementByMetadataReference;
+ for use by sfx2::DocumentMetadataAccess
+ */
+class SFX2_DLLPUBLIC IXmlIdRegistry
+{
+
+public:
+ virtual ~IXmlIdRegistry() { }
+
+ virtual css::uno::Reference< css::rdf::XMetadatable >
+ GetElementByMetadataReference(
+ const css::beans::StringPair & i_rXmlId) const = 0;
+
+};
+
+} // namespace sfx2
+
+#endif // INCLUDED_SFX2_XMLIDREGISTRY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
new file mode 100644
index 000000000..3be667198
--- /dev/null
+++ b/include/sfx2/app.hxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_APP_HXX
+#define INCLUDED_SFX2_APP_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <vcl/errcode.hxx>
+#include <svl/poolitem.hxx>
+#include <vcl/bitmapex.hxx>
+#include <tools/link.hxx>
+
+#include <sfx2/shell.hxx>
+
+namespace com::sun::star::script { class XLibraryContainer; }
+
+namespace weld { class Window; }
+
+class BasicManager;
+class DdeService;
+class SfxAppData_Impl;
+class SfxDispatcher;
+class SfxEventHint;
+class SfxItemSet;
+class SfxObjectShell;
+class SfxObjectShellLock;
+class SfxProgress;
+class SfxSlotPool;
+class SfxViewFrame;
+class StarBASIC;
+class SfxWorkWindow;
+class SfxFilterMatcher;
+class SfxModule;
+struct SfxChildWinFactory;
+struct SfxStbCtrlFactory;
+struct SfxTbxCtrlFactory;
+class SbxArray;
+class SbxValue;
+
+namespace sfx2
+{
+ namespace sidebar {
+ class Theme;
+ }
+}
+
+enum class SfxToolsModule
+{
+ Math = 0,
+ Calc = 1,
+ Draw = 2,
+ Writer = 3,
+ Basic = 4,
+ LAST = Basic
+};
+
+class SFX2_DLLPUBLIC SfxLinkItem final : public SfxPoolItem
+{
+ Link<SfxPoolItem const *, void> aLink;
+public:
+ SfxLinkItem( sal_uInt16 nWhichId, const Link<SfxPoolItem const *, void>& rValue ) : SfxPoolItem( nWhichId )
+ { aLink = rValue; }
+
+ virtual SfxLinkItem* Clone( SfxItemPool* = nullptr ) const override
+ { return new SfxLinkItem( *this ); }
+ virtual bool operator==( const SfxPoolItem& rL) const override
+ { return static_cast<const SfxLinkItem&>(rL).aLink == aLink; }
+ const Link<SfxPoolItem const *, void>&
+ GetValue() const { return aLink; }
+};
+
+// This is a singleton class. Sad that there apparently is no other
+// way than a comment like this to indicate that to the code reader.
+class SFX2_DLLPUBLIC SfxApplication final : public SfxShell
+{
+ std::unique_ptr<SfxAppData_Impl> pImpl;
+
+ DECL_DLLPRIVATE_STATIC_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, bool );
+
+ void Deinitialize();
+
+public:
+ SFX_DECL_INTERFACE(SFX_INTERFACE_SFXAPP)
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl();
+ SfxApplication();
+
+public:
+ virtual ~SfxApplication() override;
+ static SfxApplication* GetOrCreate();
+ static SfxApplication* Get();
+
+ // DDE
+#if defined(_WIN32)
+ static bool DdeExecute( const OUString& rCmd );
+#endif
+ bool InitializeDde();
+ const DdeService* GetDdeService() const;
+ DdeService* GetDdeService();
+#if defined(_WIN32)
+ void AddDdeTopic( SfxObjectShell* );
+#endif
+ void RemoveDdeTopic( SfxObjectShell const * );
+
+ // "static" methods
+ /**
+ * @param pArgs Takes ownership
+ */
+ ErrCode LoadTemplate( SfxObjectShellLock& xDoc, const OUString& rFileName, std::unique_ptr<SfxItemSet> pArgs );
+ weld::Window* GetTopWindow() const;
+
+ // members
+ SfxFilterMatcher& GetFilterMatcher();
+ SfxProgress* GetProgress() const;
+ sal_uInt16 GetFreeIndex();
+ void ReleaseIndex(sal_uInt16 i);
+
+ // Basic/Scripting
+ static bool IsXScriptURL( const OUString& rScriptURL );
+ static OUString ChooseScript(weld::Window *pParent);
+ static void MacroOrganizer(weld::Window* pParent, sal_Int16 nTabId);
+ static ErrCode CallBasic( const OUString&, BasicManager*, SbxArray *pArgs, SbxValue *pRet );
+ static ErrCode CallAppBasic( const OUString& i_macroName )
+ { return CallBasic( i_macroName, SfxApplication::GetBasicManager(), nullptr, nullptr ); }
+ static BasicManager* GetBasicManager();
+ css::script::XLibraryContainer * GetDialogContainer();
+ css::script::XLibraryContainer * GetBasicContainer();
+ static StarBASIC* GetBasic();
+ void SaveBasicAndDialogContainer() const;
+
+ // misc.
+ static void GetOptions(SfxItemSet &);
+ void SetOptions(const SfxItemSet &);
+ virtual void Invalidate(sal_uInt16 nId = 0) override;
+ void NotifyEvent(const SfxEventHint& rEvent, bool bSynchron = true );
+ bool IsDowning() const;
+ void ResetLastDir();
+
+ SAL_DLLPRIVATE SfxDispatcher* GetAppDispatcher_Impl();
+ SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl();
+
+ SAL_DLLPRIVATE void SetOptions_Impl(const SfxItemSet &);
+ SAL_DLLPRIVATE void Initialize_Impl();
+
+ SAL_DLLPRIVATE SfxAppData_Impl* Get_Impl() const { return pImpl.get(); }
+
+ // Object-Factories/global arrays
+ SAL_DLLPRIVATE void RegisterChildWindow_Impl(SfxModule*, const SfxChildWinFactory&);
+ SAL_DLLPRIVATE void RegisterStatusBarControl_Impl(SfxModule*, const SfxStbCtrlFactory&);
+ SAL_DLLPRIVATE void RegisterToolBoxControl_Impl( SfxModule*, const SfxTbxCtrlFactory&);
+ SAL_DLLPRIVATE SfxTbxCtrlFactory* GetTbxCtrlFactory(const std::type_info& rSlotType, sal_uInt16 nSlotID) const;
+ SAL_DLLPRIVATE SfxStbCtrlFactory* GetStbCtrlFactory(const std::type_info& rSlotType, sal_uInt16 nSlotID) const;
+ SAL_DLLPRIVATE SfxChildWinFactory* GetChildWinFactoryById(sal_uInt16 nId) const;
+ SAL_DLLPRIVATE std::vector<SfxViewFrame*>& GetViewFrames_Impl() const;
+ SAL_DLLPRIVATE std::vector<SfxViewShell*>& GetViewShells_Impl() const;
+ SAL_DLLPRIVATE std::vector<SfxObjectShell*>& GetObjectShells_Impl() const;
+ SAL_DLLPRIVATE void SetViewFrame_Impl(SfxViewFrame *pViewFrame);
+
+ // Slot Methods
+ // TODO/CLEANUP: still needed?
+ SAL_DLLPRIVATE void NewDocDirectExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE static void NewDocDirectState_Impl(SfxItemSet &);
+ SAL_DLLPRIVATE void NewDocExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void OpenDocExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void OpenRemoteExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void SignPDFExec_Impl(SfxRequest&);
+ SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &);
+ SAL_DLLPRIVATE static void PropExec_Impl(SfxRequest const &);
+ SAL_DLLPRIVATE static void PropState_Impl(SfxItemSet &);
+ SAL_DLLPRIVATE void OfaExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE static void OfaState_Impl(SfxItemSet &);
+
+ SAL_DLLPRIVATE void SetProgress_Impl(SfxProgress *);
+ SAL_DLLPRIVATE const OUString& GetLastDir_Impl() const;
+ SAL_DLLPRIVATE void SetLastDir_Impl( const OUString & );
+
+ SAL_DLLPRIVATE static void Registrations_Impl();
+ SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl(const SfxViewFrame *pFrame) const;
+
+ // TODO/CLEANUP: still needed? -- unclear whether this comment
+ // refers to the GetDisabledSlotList_Impl() method which was
+ // already removed, or the below methods?
+ SAL_DLLPRIVATE SfxSlotPool& GetAppSlotPool_Impl() const;
+ SAL_DLLPRIVATE static SfxModule* GetModule_Impl();
+
+ static void SetModule(SfxToolsModule nSharedLib, std::unique_ptr<SfxModule> pModule);
+ static SfxModule* GetModule(SfxToolsModule nSharedLib);
+
+ static bool loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWidth);
+
+ /** loads the application logo as used in the impress slideshow pause screen */
+ static BitmapEx GetApplicationLogo(tools::Long nWidth);
+
+ /** if true then dialog/infobar notifications like the tip of the day or
+ version change infobar should be suppressed */
+ static bool IsHeadlessOrUITest();
+
+ static bool IsTipOfTheDayDue();
+
+ /** this Theme contains Images so must be deleted before DeInitVCL */
+ sfx2::sidebar::Theme & GetSidebarTheme();
+};
+
+inline SfxApplication* SfxGetpApp()
+{
+ return SfxApplication::Get();
+}
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
new file mode 100644
index 000000000..b753569ef
--- /dev/null
+++ b/include/sfx2/basedlgs.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_BASEDLGS_HXX
+#define INCLUDED_SFX2_BASEDLGS_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <vcl/weld.hxx>
+
+class SfxTabPage;
+class SfxBindings;
+class SfxChildWindow;
+struct SfxChildWinInfo;
+class SfxItemSet;
+struct WhichRangesContainer;
+
+class SFX2_DLLPUBLIC SfxDialogController : public weld::GenericDialogController
+{
+private:
+ DECL_DLLPRIVATE_STATIC_LINK(SfxDialogController, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*);
+
+ DECL_DLLPRIVATE_LINK(FocusChangeHdl, weld::Container&, void);
+
+public:
+ SfxDialogController(weld::Widget* pParent, const OUString& rUIFile, const OString& rDialogId);
+ // dialog gets focus
+ virtual void Activate() {}
+ // dialog loses focus
+ virtual void Deactivate() {}
+
+ // when the dialog has an associated SfxChildWin, typically for Modeless interaction
+ virtual void ChildWinDispose() {} // called from the associated SfxChildWin dtor
+ virtual void Close(); // called by the SfxChildWin when the dialog is closed
+ virtual void EndDialog(int nResponse); // called by the SfxChildWin to close the dialog
+};
+
+class SfxModelessDialog_Impl;
+
+class SFX2_DLLPUBLIC SfxModelessDialogController : public SfxDialogController
+{
+ SfxBindings* m_pBindings;
+ std::unique_ptr<SfxModelessDialog_Impl> m_xImpl;
+
+ SfxModelessDialogController(SfxModelessDialogController&) = delete;
+ void operator =(SfxModelessDialogController&) = delete;
+
+ void Init(SfxBindings *pBindinx, SfxChildWindow *pCW);
+
+protected:
+ SfxModelessDialogController(SfxBindings*, SfxChildWindow* pChildWin,
+ weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID);
+
+public:
+ virtual ~SfxModelessDialogController() override;
+
+ void Initialize (SfxChildWinInfo const * pInfo);
+ bool IsClosing() const;
+ virtual void Close() override;
+ virtual void EndDialog(int nResponse) override;
+ virtual void Activate() override;
+ virtual void Deactivate() override;
+ virtual void ChildWinDispose() override;
+ virtual void FillInfo(SfxChildWinInfo&) const;
+ SfxBindings& GetBindings() const { return *m_pBindings; }
+};
+
+typedef WhichRangesContainer (*GetTabPageRanges)(); // provides international Which values
+
+class SFX2_DLLPUBLIC SfxOkDialogController : public SfxDialogController
+{
+public:
+ SfxOkDialogController(weld::Widget* pParent, const OUString& rUIXMLDescription,
+ const OString& rID)
+ : SfxDialogController(pParent, rUIXMLDescription, rID)
+ {
+ }
+
+ virtual weld::Button& GetOKButton() const = 0;
+ virtual const SfxItemSet* GetExampleSet() const = 0;
+};
+
+class SFX2_DLLPUBLIC SfxSingleTabDialogController : public SfxOkDialogController
+{
+private:
+ std::unique_ptr<SfxItemSet> m_xOutputSet;
+ const SfxItemSet* m_pInputSet;
+
+public:
+ SfxSingleTabDialogController(weld::Widget* pParent, const SfxItemSet* pOptionsSet,
+ const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"),
+ const OString& rID = OString("SingleTabDialog"));
+
+ weld::Container* get_content_area() { return m_xContainer.get(); }
+
+ virtual ~SfxSingleTabDialogController() override;
+
+ void SetTabPage(std::unique_ptr<SfxTabPage> xTabPage);
+ SfxTabPage* GetTabPage() const { return m_xSfxPage.get(); }
+
+ virtual weld::Button& GetOKButton() const override { return *m_xOKBtn; }
+ virtual const SfxItemSet* GetExampleSet() const override { return nullptr; }
+
+ const SfxItemSet* GetOutputItemSet() const { return m_xOutputSet.get(); }
+ const SfxItemSet* GetInputItemSet() const { return m_pInputSet; }
+
+protected:
+ std::unique_ptr<SfxTabPage> m_xSfxPage;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::Button> m_xOKBtn;
+ std::unique_ptr<weld::Button> m_xHelpBtn;
+
+ void CreateOutputItemSet(const SfxItemSet& rInput);
+ void SetInputSet(const SfxItemSet* pInSet) { m_pInputSet = pInSet; }
+ DECL_DLLPRIVATE_LINK(OKHdl_Impl, weld::Button&, void);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx
new file mode 100644
index 000000000..d058c939e
--- /dev/null
+++ b/include/sfx2/bindings.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_BINDINGS_HXX
+#define INCLUDED_SFX2_BINDINGS_HXX
+
+#include <sal/config.h>
+
+#include <cstddef>
+#include <memory>
+#include <optional>
+
+#include <o3tl/typed_flags_set.hxx>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <tools/link.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <svl/poolitem.hxx>
+#include <svl/SfxBroadcaster.hxx>
+#include <sfx2/shell.hxx>
+
+namespace com::sun::star::frame { class XDispatch; }
+namespace com::sun::star::frame { class XDispatchProvider; }
+namespace com::sun::star::frame { class XDispatchRecorder; }
+namespace com::sun::star::frame { class XFrame; }
+namespace com::sun::star::util { struct URL; }
+
+class SfxSlot;
+class SfxSlotServer;
+class SfxControllerItem;
+class SfxStateCache;
+class SfxItemSet;
+class SfxDispatcher;
+class SfxBindings_Impl;
+class Timer;
+class SfxWorkWindow;
+struct SfxFoundCache_Impl;
+class SfxFoundCacheArr_Impl;
+
+enum class SfxCallMode : sal_uInt16
+{
+ SLOT = 0x00, // sync/async from Slot
+ SYNCHRON = 0x01, // synchronously in the same Stackframe
+ ASYNCHRON = 0x02, // asynchronously via AppEvent
+ RECORD = 0x04, // take into account while recording
+ API = 0x08 // API call (silent)
+};
+
+namespace o3tl {
+
+template<> struct typed_flags<SfxCallMode>: is_typed_flags<SfxCallMode, 0x0F>
+{};
+
+}
+
+class SFX2_DLLPUBLIC SfxBindings final : public SfxBroadcaster
+
+/* [Description]
+
+ In each SFx application one instance of the SfxBindings-Class will
+ exists from <SfxApplication::Init()> until <SfxApplication::Exit()>.
+ This instance is automatically created and destroyed by SfxApplication.
+ However these instances will be handled by the Macro <SFX_BINDINGS>
+ or the associated <SfxViewFrame>.
+
+ The SfxBindings manages all of its Slot-Ids bound by the registered
+ controllers and keeps a cache of the <Slot-Server> respectively.
+ (it is what we call the combination of SfxShell instance and SfxSlot).
+ In the SfxBindings it is stored, if and in this case which controllers
+ that are dirty and which Slot-Server-Caches are dirty respectively.
+ It summarizes status queries (calls to the status methods specified
+ in the IDL) that are served by the same state methods, and handles
+ the simulation of <Pseudo-Slots>.
+*/
+
+{
+friend class SfxApplication;
+friend class SfxShell;
+friend class SfxBindings_Impl;
+
+ std::unique_ptr< SfxBindings_Impl> pImpl; // Data of the Bindings instance
+ SfxDispatcher* pDispatcher; // Dispatcher, to be used
+ sal_uInt16 nRegLevel; // Lock-Level while Reconfig
+
+private:
+ SAL_DLLPRIVATE const SfxPoolItem* Execute_Impl( sal_uInt16 nSlot, const SfxPoolItem **pArgs, sal_uInt16 nModi,
+ SfxCallMode nCall, const SfxPoolItem **pInternalArgs, bool bGlobalOnly=false);
+ SAL_DLLPRIVATE void SetSubBindings_Impl( SfxBindings* );
+ SAL_DLLPRIVATE void UpdateSlotServer_Impl(); // Update SlotServer
+ SAL_DLLPRIVATE std::optional<SfxItemSet> CreateSet_Impl(SfxStateCache& rCache, const SfxSlot* &pRealSlot,
+ const SfxSlotServer**, SfxFoundCacheArr_Impl&);
+ SAL_DLLPRIVATE std::size_t GetSlotPos( sal_uInt16 nId, std::size_t nStartSearchAt = 0 );
+ SAL_DLLPRIVATE void Update_Impl(SfxStateCache& rCache);
+ static SAL_DLLPRIVATE void UpdateControllers_Impl(
+ const SfxFoundCache_Impl& rFound,
+ const SfxPoolItem *pItem,
+ SfxItemState eItemState );
+ SAL_DLLPRIVATE SfxStateCache* GetStateCache( sal_uInt16 nId, std::size_t * pPos);
+ DECL_DLLPRIVATE_LINK( NextJob, Timer *, void );
+ SAL_DLLPRIVATE bool NextJob_Impl(Timer const * pTimer);
+
+public:
+ SfxBindings();
+ virtual ~SfxBindings() override;
+
+ void HidePopups( bool bHide = true );
+
+ void SetDispatcher(SfxDispatcher *pDisp);
+
+ void Update( sal_uInt16 nId ); // For example, from Menu::Activate
+ void Update();
+ SAL_DLLPRIVATE void StartUpdate_Impl(bool bComplete=false);
+ void Invalidate( sal_uInt16 nId );
+ void Invalidate( const sal_uInt16* pIds );
+ void InvalidateShell( const SfxShell &rSh, bool bDeep = false );
+ void InvalidateAll( bool bWithMsg );
+ void SetState( const SfxItemSet &rSet );
+ void SetState( const SfxPoolItem &rItem );
+ void Invalidate( sal_uInt16 nId, bool bWithItem, bool bWithMsg=false);
+ bool IsInUpdate() const;
+ void SetVisibleState( sal_uInt16 nId, bool bShow );
+
+ SfxStateCache* GetStateCache( sal_uInt16 nId);
+ SAL_DLLPRIVATE SfxStateCache* GetAnyStateCache_Impl( sal_uInt16 nId );
+ /**
+ * @param rpState the caller has to delete the pointer
+ */
+ SfxItemState QueryState( sal_uInt16 nSID, std::unique_ptr<SfxPoolItem> &rpState );
+ template<class T>
+ SfxItemState QueryState( TypedWhichId<T> nSID, std::unique_ptr<T> &rpState )
+ {
+ std::unique_ptr<SfxPoolItem> tmp;
+ auto ret = QueryState(sal_uInt16(nSID), tmp);
+ rpState.reset(static_cast<T*>(tmp.release()));
+ return ret;
+ }
+
+ void QueryControlState ( sal_uInt16 nSID, boost::property_tree::ptree& rState );
+
+ sal_uInt16 QuerySlotId( const css::util::URL& aURL );
+
+ const SfxPoolItem* ExecuteSynchron( sal_uInt16 nSlot,
+ const SfxPoolItem **pArgs = nullptr);
+ bool Execute( sal_uInt16 nSlot,
+ const SfxPoolItem **pArgs = nullptr,
+ SfxCallMode nCall = SfxCallMode::SLOT);
+
+ SAL_DLLPRIVATE void SetDispatchProvider_Impl( const css::uno::Reference< css::frame::XDispatchProvider > & rFrame );
+ void SetActiveFrame( const css::uno::Reference< css::frame::XFrame > & rFrame );
+ css::uno::Reference< css::frame::XFrame > GetActiveFrame() const;
+ // Reconfig
+ sal_uInt16 EnterRegistrations(const char *pFile = nullptr, int nLine = 0);
+ void LeaveRegistrations( const char *pFile = nullptr, int nLine = 0 );
+ void Register( SfxControllerItem& rBinding );
+ void Release( SfxControllerItem& rBinding );
+ SfxDispatcher* GetDispatcher() const
+ { return pDispatcher; }
+ const css::uno::Reference< css::frame::XDispatchRecorder >& GetRecorder() const;
+ css::uno::Reference < css::frame::XDispatch >
+ GetDispatch( const SfxSlot*, const css::util::URL& aURL, bool bMasterCommand );
+ SAL_DLLPRIVATE void ContextChanged_Impl();
+ SAL_DLLPRIVATE void Execute_Impl( SfxRequest& rReq, const SfxSlot* pSlot, SfxShell* pShell );
+ SAL_DLLPRIVATE void DeleteControllers_Impl();
+ SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() { return pDispatcher; }
+ SAL_DLLPRIVATE void ClearCache_Impl( sal_uInt16 nSlotId );
+ SAL_DLLPRIVATE void RegisterInternal_Impl( SfxControllerItem& rBinding );
+ SAL_DLLPRIVATE void Register_Impl( SfxControllerItem& rBinding, bool );
+ SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const;
+ SAL_DLLPRIVATE void SetWorkWindow_Impl( std::unique_ptr<SfxWorkWindow> );
+ SAL_DLLPRIVATE SfxBindings* GetSubBindings_Impl() const;
+ SAL_DLLPRIVATE void SetRecorder_Impl( css::uno::Reference< css::frame::XDispatchRecorder > const & );
+ SAL_DLLPRIVATE void InvalidateSlotsInMap_Impl();
+ SAL_DLLPRIVATE void AddSlotToInvalidateSlotsMap_Impl( sal_uInt16 nId );
+};
+
+#ifdef DBG_UTIL
+#define ENTERREGISTRATIONS() EnterRegistrations(__FILE__, __LINE__)
+#define LEAVEREGISTRATIONS() LeaveRegistrations(__FILE__, __LINE__)
+#define DENTERREGISTRATIONS() \
+ EnterRegistrations( OStringBuffer(__FILE__).append('(').append(reinterpret_cast<sal_Int64>(this)).append(')').getStr(), __LINE__ )
+#define DLEAVEREGISTRATIONS( ) \
+ LeaveRegistrations( OStringBuffer(__FILE__).append('(').append(reinterpret_cast<sal_Int64>(this)).append(')').getStr(), __LINE__ )
+#else
+#define ENTERREGISTRATIONS() EnterRegistrations()
+#define LEAVEREGISTRATIONS() LeaveRegistrations()
+#define DENTERREGISTRATIONS() EnterRegistrations()
+#define DLEAVEREGISTRATIONS() LeaveRegistrations()
+#endif
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/brokenpackageint.hxx b/include/sfx2/brokenpackageint.hxx
new file mode 100644
index 000000000..37c98540a
--- /dev/null
+++ b/include/sfx2/brokenpackageint.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_BROKENPACKAGEINT_HXX
+#define INCLUDED_SFX2_BROKENPACKAGEINT_HXX
+
+#include <sal/config.h>
+#include <rtl/ref.hxx>
+#include <sfx2/dllapi.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::task
+{
+class XInteractionRequest;
+}
+
+class RequestPackageReparation_Impl;
+class SFX2_DLLPUBLIC RequestPackageReparation
+{
+ rtl::Reference<RequestPackageReparation_Impl> mxImpl;
+
+public:
+ RequestPackageReparation(const OUString& aName);
+ ~RequestPackageReparation();
+ RequestPackageReparation(const RequestPackageReparation&) = delete;
+ RequestPackageReparation& operator=(const RequestPackageReparation&) = delete;
+ bool isApproved() const;
+ css::uno::Reference<css::task::XInteractionRequest> GetRequest() const;
+};
+
+class NotifyBrokenPackage_Impl;
+class SFX2_DLLPUBLIC NotifyBrokenPackage
+{
+ rtl::Reference<NotifyBrokenPackage_Impl> mxImpl;
+
+public:
+ NotifyBrokenPackage(const OUString& aName);
+ ~NotifyBrokenPackage();
+ NotifyBrokenPackage(const NotifyBrokenPackage&) = delete;
+ NotifyBrokenPackage& operator=(const NotifyBrokenPackage&) = delete;
+ css::uno::Reference<css::task::XInteractionRequest> GetRequest() const;
+};
+
+#endif // INCLUDED_SFX2_BROKENPACKAGEINT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/chalign.hxx b/include/sfx2/chalign.hxx
new file mode 100644
index 000000000..d63646ea1
--- /dev/null
+++ b/include/sfx2/chalign.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_CHALIGN_HXX
+#define INCLUDED_SFX2_CHALIGN_HXX
+
+// New order: first, navigation bar, then vertically docked child windows
+// (Explorer!), then horizontally docked child windows (Browser!),
+// then the format bar, status bar, and at the end of the toolbar.
+
+enum class SfxChildAlignment
+{
+ HIGHESTTOP, // for example Navigation bar
+ LOWESTBOTTOM,
+ FIRSTLEFT,
+ LASTRIGHT,
+ LEFT, // for example SplitWindow
+ RIGHT,
+ LASTLEFT,
+ FIRSTRIGHT,
+ TOP, // for example Hyperlink-Builder, SplitWindow
+ BOTTOM, // for example SplitWindow
+ TOOLBOXTOP, // for example Object bar
+ TOOLBOXBOTTOM,
+ LOWESTTOP, // for example Calc bar
+ HIGHESTBOTTOM, // for example Status bar
+ TOOLBOXLEFT, // for example Tool bar
+ TOOLBOXRIGHT,
+ NOALIGNMENT // all FloatingWindows
+};
+
+// Verifies that a valid alignment is used
+inline bool SfxChildAlignValid( SfxChildAlignment eAlign )
+{
+ return ( eAlign >= SfxChildAlignment::HIGHESTTOP && eAlign <= SfxChildAlignment::NOALIGNMENT );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/charwin.hxx b/include/sfx2/charwin.hxx
new file mode 100644
index 000000000..f4118d44c
--- /dev/null
+++ b/include/sfx2/charwin.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_INC_CHARWIN_HXX
+#define INCLUDED_SFX2_INC_CHARWIN_HXX
+
+#include <sfx2/dllapi.h>
+#include <vcl/customweld.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/weld.hxx>
+
+class SFX2_DLLPUBLIC SvxCharView final : public weld::CustomWidgetController
+{
+private:
+ VclPtr<VirtualDevice> mxVirDev;
+ tools::Long mnY;
+ Point maPosition;
+ vcl::Font maFont;
+ bool maHasInsert;
+ OUString m_sText;
+
+ Link<SvxCharView*, void> maMouseClickHdl;
+ Link<SvxCharView*, void> maClearClickHdl;
+ Link<SvxCharView*, void> maClearAllClickHdl;
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void Resize() override;
+ virtual bool MouseButtonDown(const MouseEvent&) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual bool KeyInput(const KeyEvent&) override;
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+public:
+ SvxCharView(const VclPtr<VirtualDevice>& rVirDev);
+
+ void SetFont( const vcl::Font& rFont );
+ vcl::Font const & GetFont() const { return maFont; }
+ void SetText( const OUString& rText );
+ OUString const & GetText() const { return m_sText; }
+ void SetHasInsert( bool bInsert );
+ void InsertCharToDoc();
+
+ void createContextMenu();
+
+ Size get_preferred_size() const { return GetDrawingArea()->get_preferred_size(); }
+
+ void setMouseClickHdl(const Link<SvxCharView*,void> &rLink);
+ void setClearClickHdl(const Link<SvxCharView*,void> &rLink);
+ void setClearAllClickHdl(const Link<SvxCharView*,void> &rLink);
+
+ void ContextMenuSelect(std::string_view rIdent);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
new file mode 100644
index 000000000..68ad6ff50
--- /dev/null
+++ b/include/sfx2/childwin.hxx
@@ -0,0 +1,235 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_CHILDWIN_HXX
+#define INCLUDED_SFX2_CHILDWIN_HXX
+
+#include <memory>
+#include <sal/config.h>
+
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <vcl/window.hxx>
+
+#include <sfx2/chalign.hxx>
+#include <sfx2/basedlgs.hxx>
+
+namespace com::sun::star::frame { class XFrame; }
+
+class SfxWorkWindow;
+class SfxModule;
+class SfxChildWindow;
+class SfxBindings;
+class SfxModelessDialogController;
+
+enum class SfxChildWindowFlags
+{
+ NONE = 0x000,
+ FORCEDOCK = 0x004, // Float forbidden
+ TASK = 0x010, // ChildWindow inside the Task
+ CANTGETFOCUS = 0x020, // ChildWindow can not get focus
+ ALWAYSAVAILABLE = 0x040, // ChildWindow is never disabled
+ NEVERHIDE = 0x080, // ChildWindow is always visible
+ NEVERCLONE = 0x100, // ChildWindow is not recreated in new view
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<SfxChildWindowFlags> : is_typed_flags<SfxChildWindowFlags, 0x1f4> {};
+}
+
+
+#define CHILDWIN_NOPOS USHRT_MAX
+
+// ChildWindow Configuration
+struct SAL_DLLPUBLIC_RTTI SfxChildWinInfo
+{
+ OUString aExtraString;
+ OUString aModule;
+ OString aWinState;
+ Point aPos;
+ Size aSize;
+ SfxChildWindowFlags nFlags;
+ bool bVisible;
+
+ SfxChildWinInfo()
+ {
+ bVisible = false;
+ nFlags = SfxChildWindowFlags::NONE;
+ }
+ bool GetExtraData_Impl( SfxChildAlignment *pAlign ) const;
+};
+
+// ChildWindow factory methods
+typedef std::unique_ptr<SfxChildWindow> (*SfxChildWinCtor)( vcl::Window *pParentWindow,
+ sal_uInt16 nId,
+ SfxBindings *pBindings,
+ SfxChildWinInfo *pInfo);
+
+struct SFX2_DLLPUBLIC SfxChildWinFactory
+{
+ SfxChildWinCtor pCtor; // Factory method
+ SfxChildWinInfo aInfo; // Configuration
+ sal_uInt16 nId; // ChildWindow-Id ( SlotId )
+ sal_uInt16 nPos; // Position in UI
+
+ SfxChildWinFactory( SfxChildWinCtor pTheCtor, sal_uInt16 nID, sal_uInt16 n );
+};
+
+struct SfxChildWindow_Impl;
+
+extern SFX2_DLLPUBLIC bool ParentIsFloatingWindow(const vcl::Window *pParent);
+
+class SFX2_DLLPUBLIC SfxChildWindow
+{
+ VclPtr<vcl::Window> pParent; // parent window ( Topwindow )
+ VclPtr<vcl::Window> pWindow; // actual contents
+ std::unique_ptr< SfxChildWindow_Impl> pImpl; // Implementation data
+ std::shared_ptr<SfxDialogController> xController; // actual contents
+ SfxChildAlignment eChildAlignment; // Current css::drawing::Alignment
+ // Another window in pWindow
+ sal_uInt16 nType; // ChildWindow-Id
+ SAL_DLLPRIVATE void ClearWorkwin();
+
+protected:
+ void SetWindow(const VclPtr<vcl::Window>& p) { pWindow = p; }
+ SfxChildWindow(vcl::Window *pParentWindow, sal_uInt16 nId);
+
+public:
+ virtual ~SfxChildWindow();
+ void Destroy();
+ vcl::Window* GetWindow() const
+ { return pWindow; }
+ void SetController(std::shared_ptr<SfxDialogController> controller) { xController = controller; }
+ void ClearController() { xController.reset(); }
+ std::shared_ptr<SfxDialogController>& GetController() { return xController; }
+ const std::shared_ptr<SfxDialogController>& GetController() const { return xController; }
+ vcl::Window* GetParent() const
+ { return pParent; }
+ SfxChildAlignment GetAlignment() const
+ { return eChildAlignment; }
+ void SetAlignment(SfxChildAlignment eAlign);
+ virtual void Hide();
+ virtual void Show( ShowFlags nFlags );
+ sal_uInt16 GetPosition() const;
+ sal_uInt16 GetType() const
+ { return nType; }
+
+ virtual SfxChildWinInfo GetInfo() const;
+ void SaveStatus(const SfxChildWinInfo& rInfo);
+
+ static void RegisterChildWindow(SfxModule*, const SfxChildWinFactory&);
+
+ static std::unique_ptr<SfxChildWindow> CreateChildWindow( sal_uInt16, vcl::Window*, SfxBindings*, SfxChildWinInfo const &);
+ void SetHideNotDelete( bool bOn );
+ bool IsHideNotDelete() const;
+ bool IsVisible() const;
+ void SetWantsFocus( bool );
+ bool WantsFocus() const;
+
+ virtual bool QueryClose();
+ const css::uno::Reference< css::frame::XFrame >& GetFrame() const;
+ void SetFrame( const css::uno::Reference< css::frame::XFrame > & );
+
+ SAL_DLLPRIVATE static void InitializeChildWinFactory_Impl(sal_uInt16, SfxChildWinInfo&);
+ void SetVisible_Impl( bool bVis );
+ SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* );
+ SAL_DLLPRIVATE void Activate_Impl();
+
+ SAL_DLLPRIVATE void SetFactory_Impl( const SfxChildWinFactory* );
+};
+
+const int nCloseResponseToJustHide = -42;
+
+#define SFX_DECL_CHILDWINDOW(Class) \
+ public : \
+ static std::unique_ptr<SfxChildWindow> CreateImpl(vcl::Window *pParent, sal_uInt16 nId, \
+ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \
+ static void RegisterChildWindow (bool bVisible=false, SfxModule *pMod=nullptr, SfxChildWindowFlags nFlags=SfxChildWindowFlags::NONE); \
+ virtual SfxChildWinInfo GetInfo() const override
+
+#define SFX_DECL_CHILDWINDOW_WITHID(Class) \
+ SFX_DECL_CHILDWINDOW(Class); \
+ static sal_uInt16 GetChildWindowId ()\
+
+#define SFX_IMPL_CHILDWINDOW(Class, MyID) \
+ SFX_IMPL_POS_CHILDWINDOW(Class, MyID, CHILDWIN_NOPOS)
+
+#define SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \
+ SFX_IMPL_POS_CHILDWINDOW_WITHID(Class, MyID, CHILDWIN_NOPOS)
+
+#define SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \
+ std::unique_ptr<SfxChildWindow> Class::CreateImpl( vcl::Window *pParent, \
+ sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \
+ { \
+ return std::make_unique<Class>(pParent, nId, pBindings, pInfo);\
+ } \
+ void Class::RegisterChildWindow (bool bVis, SfxModule *pMod, SfxChildWindowFlags nFlags) \
+ { \
+ SfxChildWinFactory aFact( \
+ Class::CreateImpl, MyID, Pos ); \
+ aFact.aInfo.nFlags |= nFlags; \
+ aFact.aInfo.bVisible = bVis; \
+ SfxChildWindow::RegisterChildWindow(pMod, aFact); \
+ }
+
+#define SFX_IMPL_POS_CHILDWINDOW_WITHID(Class, MyID, Pos) \
+ SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \
+ sal_uInt16 Class::GetChildWindowId () \
+ { return MyID; } \
+
+#define SFX_IMPL_MODELESSDIALOGCONTOLLER(Class, MyID) \
+ SFX_IMPL_CHILDWINDOW(Class, MyID) \
+ SfxChildWinInfo Class::GetInfo() const \
+ { \
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ static_cast<const SfxModelessDialogController*>(GetController().get())->FillInfo( aInfo ); \
+ return aInfo; }
+
+#define SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(Class, MyID) \
+ SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \
+ SfxChildWinInfo Class::GetInfo() const \
+ { \
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ static_cast<const SfxModelessDialogController*>(GetController().get())->FillInfo( aInfo ); \
+ return aInfo; }
+
+#define SFX_IMPL_DOCKINGWINDOW(Class, MyID) \
+ SFX_IMPL_CHILDWINDOW(Class, MyID) \
+ SfxChildWinInfo Class::GetInfo() const \
+ { \
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ static_cast<SfxDockingWindow*>(GetWindow())->FillInfo( aInfo ); \
+ return aInfo; }
+
+#define SFX_IMPL_DOCKINGWINDOW_WITHID(Class, MyID) \
+ SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \
+ SfxChildWinInfo Class::GetInfo() const \
+ { \
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ static_cast<SfxDockingWindow*>(GetWindow())->FillInfo( aInfo ); \
+ return aInfo; }
+
+bool GetPosSizeFromString( std::u16string_view rStr, Point& rPos, Size& rSize );
+
+bool GetSplitSizeFromString( std::u16string_view rStr, Size& rSize );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx
new file mode 100644
index 000000000..5a4fa6b1e
--- /dev/null
+++ b/include/sfx2/classificationhelper.hxx
@@ -0,0 +1,227 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_CLASSIFICATIONHELPER_HXX
+#define INCLUDED_SFX2_CLASSIFICATIONHELPER_HXX
+
+#include <memory>
+#include <string_view>
+#include <vector>
+
+#include <o3tl/string_view.hxx>
+#include <rtl/ustring.hxx>
+#include <sfx2/dllapi.h>
+#include <sfx2/infobar.hxx>
+
+namespace com::sun::star::beans
+{
+class XPropertyContainer;
+}
+namespace com::sun::star::document
+{
+class XDocumentProperties;
+}
+
+class SfxViewFrame;
+
+/// Return code of SfxClassificationHelper::CheckPaste().
+enum class SfxClassificationCheckPasteResult
+{
+ None = 1,
+ TargetDocNotClassified = 2,
+ DocClassificationTooLow = 3
+};
+
+/// Specifies a policy type, to be used with SetBACName(). Getters always use IntellectualProperty for now.
+enum class SfxClassificationPolicyType
+{
+ ExportControl = 1,
+ NationalSecurity = 2,
+ IntellectualProperty = 3
+};
+
+/// Shared code to handle Business Authorization Identification and Labeling Scheme (BAILS) properties.
+class SFX2_DLLPUBLIC SfxClassificationHelper
+{
+ class SAL_DLLPRIVATE Impl;
+ std::unique_ptr<Impl> m_pImpl;
+
+public:
+ /// Does the document have any BAILS properties?
+ static bool IsClassified(
+ const css::uno::Reference<css::document::XDocumentProperties>& xDocumentProperties);
+ /// Checks if pasting from xSource to xDestination would leak information.
+ static SfxClassificationCheckPasteResult
+ CheckPaste(const css::uno::Reference<css::document::XDocumentProperties>& xSource,
+ const css::uno::Reference<css::document::XDocumentProperties>& xDestination);
+ /// Wrapper around CheckPaste(): informs the user if necessary and finds out if the paste can be continued or not.
+ static bool ShowPasteInfo(SfxClassificationCheckPasteResult eResult);
+
+ SfxClassificationHelper(
+ const css::uno::Reference<css::document::XDocumentProperties>& xDocumentProperties,
+ bool bUseLocalizedPolicy = true);
+ ~SfxClassificationHelper();
+ /// Get the currently selected category for eType.
+ const OUString& GetBACName(SfxClassificationPolicyType eType) const;
+ /// Return all possible valid category names, based on the policy.
+ std::vector<OUString> GetBACNames();
+ /// Return all possible valid category identifiers, based on the policy.
+ std::vector<OUString> GetBACIdentifiers();
+ /// Get the currently selected category abbreviation for eType. Returns full name if no abbreviation defined.
+ const OUString& GetAbbreviatedBACName(const OUString& sFullName);
+ /// Get the currently selected category for the identifier.
+ OUString GetBACNameForIdentifier(std::u16string_view sIdentifier);
+ /// Return all possible valid abbreviated category names, based on the policy.
+ std::vector<OUString> GetAbbreviatedBACNames();
+ /// Setting this sets all the other properties, based on the policy.
+ void SetBACName(const OUString& rName, SfxClassificationPolicyType eType);
+ /// Returns the class with the higher priority (based on sensitivity).
+ OUString GetHigherClass(const OUString& first, const OUString& second);
+ /// If GetImpactScale() and GetImpactLevel*() will return something meaningful.
+ bool HasImpactLevel();
+ InfobarType GetImpactLevelType();
+ /// Larger value means more confidential.
+ sal_Int32 GetImpactLevel();
+ /// Comparing the GetImpactLevel() result is only meaningful when the impact scale is the same.
+ OUString GetImpactScale();
+ OUString GetDocumentWatermark();
+ /// The selected category has some content for the document header.
+ bool HasDocumentHeader();
+ /// The selected category has some content for the document footer.
+ bool HasDocumentFooter();
+ void UpdateInfobar(SfxViewFrame& rViewFrame);
+
+ std::vector<OUString> const& GetMarkings() const;
+ std::vector<OUString> const& GetIntellectualPropertyParts() const;
+ std::vector<OUString> const& GetIntellectualPropertyPartNumbers() const;
+
+ /// Does a best-effort conversion of rType to SfxClassificationPolicyType.
+ static SfxClassificationPolicyType stringToPolicyType(std::u16string_view rType);
+ /// Returns the string representation of a SfxClassificationPolicyType element.
+ static const OUString& policyTypeToString(SfxClassificationPolicyType eType);
+
+ /// Brief text located at the top of each document's pages.
+ static const OUString& PROP_DOCHEADER();
+ /// Brief text located at the bottom of each document's pages.
+ static const OUString& PROP_DOCFOOTER();
+ /// Brief text formatted as a watermark on each document's page.
+ static const OUString& PROP_DOCWATERMARK();
+ /// Get the property prefix for the IntellectualProperty policy type.
+ static const OUString& PROP_PREFIX_INTELLECTUALPROPERTY();
+
+ static SfxClassificationPolicyType getPolicyType();
+};
+
+namespace sfx
+{
+/// Specifies the origin: either defined by the BAF policy or manual via. the advanced classification dialog
+enum class ClassificationCreationOrigin
+{
+ NONE,
+ BAF_POLICY,
+ MANUAL
+};
+
+class ClassificationKeyCreator
+{
+private:
+ const SfxClassificationPolicyType m_ePolicyType;
+ const OUString m_sPolicy;
+ sal_Int32 m_nTextNumber;
+ sal_Int32 m_nIPPartNumber;
+ sal_Int32 m_nMarkingNumber;
+
+ OUString const& getPolicyKey() const { return m_sPolicy; }
+
+public:
+ ClassificationKeyCreator(SfxClassificationPolicyType ePolicyType)
+ : m_ePolicyType(ePolicyType)
+ , m_sPolicy(SfxClassificationHelper::policyTypeToString(m_ePolicyType))
+ , m_nTextNumber(1)
+ , m_nIPPartNumber(1)
+ , m_nMarkingNumber(1)
+ {
+ }
+
+ OUString makeTextKey() const { return getPolicyKey() + "Custom:Text"; }
+
+ OUString makeNumberedTextKey()
+ {
+ return makeTextKey() + ":n" + OUString::number(m_nTextNumber++);
+ }
+
+ bool isMarkingTextKey(std::u16string_view aKey) const
+ {
+ return o3tl::starts_with(aKey, makeTextKey());
+ }
+
+ OUString makeCategoryNameKey() const
+ {
+ return getPolicyKey() + "BusinessAuthorizationCategory:Name";
+ }
+
+ bool isCategoryNameKey(std::u16string_view aKey) const
+ {
+ return o3tl::starts_with(aKey, makeCategoryNameKey());
+ }
+
+ OUString makeCategoryIdentifierKey() const
+ {
+ return getPolicyKey() + "BusinessAuthorizationCategory:Identifier";
+ }
+
+ bool isCategoryIdentifierKey(std::u16string_view aKey) const
+ {
+ return o3tl::starts_with(aKey, makeCategoryIdentifierKey());
+ }
+
+ OUString makeMarkingKey() const { return getPolicyKey() + "Custom:Marking"; }
+
+ OUString makeNumberedMarkingKey()
+ {
+ return makeMarkingKey() + ":n" + OUString::number(m_nMarkingNumber++);
+ }
+
+ bool isMarkingKey(std::u16string_view aKey) const
+ {
+ return o3tl::starts_with(aKey, makeMarkingKey());
+ }
+
+ OUString makeIntellectualPropertyPartKey() const
+ {
+ return getPolicyKey() + "Custom:IntellectualPropertyPart";
+ }
+
+ OUString makeNumberedIntellectualPropertyPartKey()
+ {
+ return makeIntellectualPropertyPartKey() + ":n" + OUString::number(m_nIPPartNumber++);
+ }
+
+ bool isIntellectualPropertyPartKey(std::u16string_view aKey) const
+ {
+ return o3tl::starts_with(aKey, makeIntellectualPropertyPartKey());
+ }
+
+ OUString makeFullTextualRepresentationKey() const
+ {
+ return getPolicyKey() + "Custom:FullTexturalRepresentation";
+ }
+
+ /// Classification creation origin key
+ OUString makeCreationOriginKey() const { return getPolicyKey() + "CreationOrigin"; }
+};
+
+SFX2_DLLPUBLIC sfx::ClassificationCreationOrigin getCreationOriginProperty(
+ css::uno::Reference<css::beans::XPropertyContainer> const& rxPropertyContainer,
+ sfx::ClassificationKeyCreator const& rKeyCreator);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/ctrlitem.hxx b/include/sfx2/ctrlitem.hxx
new file mode 100644
index 000000000..03e530c78
--- /dev/null
+++ b/include/sfx2/ctrlitem.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_CTRLITEM_HXX
+#define INCLUDED_SFX2_CTRLITEM_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <svl/poolitem.hxx>
+#include <tools/debug.hxx>
+
+class SfxBindings;
+
+class SFX2_DLLPUBLIC SfxControllerItem
+{
+private:
+ SfxControllerItem* pNext; // to notify next ControllerItem
+ SfxBindings* pBindings;
+ MapUnit eFallbackCoreMetric;
+ sal_uInt16 nId;
+
+public:
+ SfxBindings & GetBindings() {
+ DBG_ASSERT(pBindings, "no Bindings");
+ return *pBindings;
+ }
+ const SfxBindings & GetBindings() const {
+ DBG_ASSERT(pBindings, "no Bindings");
+ return *pBindings;
+ }
+
+ SfxControllerItem(); // for arrays
+ SfxControllerItem( sal_uInt16 nId, SfxBindings & );
+ virtual ~SfxControllerItem();
+ virtual void dispose();
+
+ void Bind( sal_uInt16 nNewId, SfxBindings *); // Register in SfxBindings
+ void UnBind();
+ void ReBind();
+ bool IsBound() const;
+ void ClearCache();
+
+ SfxControllerItem* GetItemLink();
+ SfxControllerItem* ChangeItemLink( SfxControllerItem* pNewLink );
+
+ void SetId( sal_uInt16 nItemId );
+ sal_uInt16 GetId() const { return nId; }
+
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+ virtual void GetControlState( sal_uInt16 nSID, boost::property_tree::ptree& );
+
+ MapUnit GetCoreMetric() const;
+ // override what GetCoreMetric will return if it cannot determine the current CoreMetric
+ void SetFallbackCoreMetric(MapUnit eFallback)
+ {
+ eFallbackCoreMetric = eFallback;
+ }
+
+ static SfxItemState GetItemState( const SfxPoolItem* pState );
+
+ SAL_DLLPRIVATE void BindInternal_Impl( sal_uInt16 nNewId, SfxBindings* );
+};
+
+
+class SFX2_DLLPUBLIC SfxStatusForwarder final : public SfxControllerItem
+{
+ SfxControllerItem* pMaster;
+
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState ) override;
+
+public:
+ SfxStatusForwarder( sal_uInt16 nSlotId,
+ SfxControllerItem&rMaster );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/devtools/DevelopmentToolChildWindow.hxx b/include/sfx2/devtools/DevelopmentToolChildWindow.hxx
new file mode 100644
index 000000000..d78ac5c2e
--- /dev/null
+++ b/include/sfx2/devtools/DevelopmentToolChildWindow.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <sfx2/dllapi.h>
+#include <sfx2/childwin.hxx>
+
+/**
+ * Necessary child window for the development tools docking window
+ */
+class SAL_WARN_UNUSED SFX2_DLLPUBLIC DevelopmentToolChildWindow final : public SfxChildWindow
+{
+ SFX_DECL_CHILDWINDOW_WITHID(DevelopmentToolChildWindow);
+
+ DevelopmentToolChildWindow(vcl::Window* pParentWindow, sal_uInt16 nId, SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx b/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx
new file mode 100644
index 000000000..4da9fccd9
--- /dev/null
+++ b/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <sfx2/dllapi.h>
+#include <sfx2/dockwin.hxx>
+#include <vcl/weld.hxx>
+
+#include <sfx2/devtools/ObjectInspectorWidgets.hxx>
+#include <sfx2/devtools/DocumentModelTreeHandler.hxx>
+#include <sfx2/devtools/ObjectInspectorTreeHandler.hxx>
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
+/** Development tool main docking window
+ *
+ * Contains two sides. Left side contains the simplified DOM tree and
+ * the right side the object inspector tree.
+ */
+class SFX2_DLLPUBLIC DevelopmentToolDockingWindow final : public SfxDockingWindow
+{
+private:
+ std::unique_ptr<ObjectInspectorWidgets> mpObjectInspectorWidgets;
+ std::unique_ptr<weld::TreeView> mpDocumentModelTreeView;
+ std::unique_ptr<weld::Toolbar> mpDomToolbar;
+
+ // Reference to the root object for the current document
+ css::uno::Reference<css::uno::XInterface> mxRoot;
+ // Stores the current selected object in the document
+ css::uno::Reference<css::uno::XInterface> mxCurrentSelection;
+ css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener;
+ css::uno::Reference<css::view::XSelectionSupplier> mxSelectionSupplier;
+
+ // Handler for the DOM tree
+ DocumentModelTreeHandler maDocumentModelTreeHandler;
+ // Handler for the object inspector tree
+ ObjectInspectorTreeHandler maObjectInspectorTreeHandler;
+
+ DECL_DLLPRIVATE_LINK(DocumentModelTreeViewSelectionHandler, weld::TreeView&, void);
+ DECL_DLLPRIVATE_LINK(DomToolbarButtonClicked, const OString&, void);
+
+ void updateSelection();
+
+public:
+ DevelopmentToolDockingWindow(SfxBindings* pBindings, SfxChildWindow* pChildWindow,
+ vcl::Window* pParent);
+
+ virtual ~DevelopmentToolDockingWindow() override;
+
+ void dispose() override;
+
+ void ToggleFloatingMode() override;
+
+ // Signals that the selected object in the document changes
+ void selectionChanged(css::uno::Reference<css::uno::XInterface> const& xInterface);
+
+ // Signals to change to the current selected object in the object inspector
+ void changeToCurrentSelection();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/devtools/DocumentModelTreeHandler.hxx b/include/sfx2/devtools/DocumentModelTreeHandler.hxx
new file mode 100644
index 000000000..47294d527
--- /dev/null
+++ b/include/sfx2/devtools/DocumentModelTreeHandler.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+/** Document model tree handler
+ *
+ * Handles the DOM tree part of DevTools, which includes interaction with
+ * the DOM tree view UI elements and the DOM model.
+ */
+class DocumentModelTreeHandler
+{
+private:
+ std::unique_ptr<weld::TreeView>& mpDocumentModelTree;
+ css::uno::Reference<css::uno::XInterface> mxDocument;
+
+ // Clears all children of a tree node, where the parent is
+ // identified by the input tree iter.
+ void clearChildren(weld::TreeIter const& rParent);
+
+ // Clear all tree view nodes.
+ void clearAll();
+
+public:
+ DocumentModelTreeHandler(std::unique_ptr<weld::TreeView>& pDocumentModelTree,
+ css::uno::Reference<css::uno::XInterface> const& xDocument);
+
+ DECL_LINK(ExpandingHandler, const weld::TreeIter&, bool);
+
+ void inspectDocument();
+
+ static css::uno::Reference<css::uno::XInterface> getObjectByID(OUString const& rID);
+
+ void dispose();
+
+ // selects the input object if it exists in the DOM tree view
+ void selectObject(css::uno::Reference<css::uno::XInterface> const& xInterface);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx b/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx
new file mode 100644
index 000000000..b6fa678de
--- /dev/null
+++ b/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+#include <vcl/commandevent.hxx>
+#include <comphelper/string.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <sfx2/devtools/ObjectInspectorWidgets.hxx>
+
+#include <memory>
+#include <deque>
+
+/** Object inspector tree handler
+ *
+ * Handles the object inspector part of DevTools - mainly interaction
+ * between UI objects that consist of the object inspector.
+ *
+ */
+class ObjectInspectorTreeHandler
+{
+private:
+ std::unique_ptr<ObjectInspectorWidgets>& mpObjectInspectorWidgets;
+
+ // object stack to remember previously inspected objects so it is
+ // possible to return back to them
+ std::deque<css::uno::Any> maInspectionStack;
+
+ // just the current context
+ css::uno::Reference<css::uno::XComponentContext> mxContext;
+
+ // treeview sort and compare
+ comphelper::string::NaturalStringSorter mxSorter;
+ void setSortFunction(std::unique_ptr<weld::TreeView>& pTreeView);
+ sal_Int32 compare(std::unique_ptr<weld::TreeView>& pTreeView, const weld::TreeIter& rLeft,
+ const weld::TreeIter& rRight);
+
+ // treeview manipulation
+ static void clearObjectInspectorChildren(std::unique_ptr<weld::TreeView>& pTreeView,
+ weld::TreeIter const& rParent);
+ static void handleExpanding(std::unique_ptr<weld::TreeView>& pTreeView,
+ weld::TreeIter const& rParent);
+ static void clearAll(std::unique_ptr<weld::TreeView>& pTreeView);
+
+ void appendInterfaces(css::uno::Reference<css::uno::XInterface> const& xInterface);
+ void appendServices(css::uno::Reference<css::uno::XInterface> const& xInterface);
+ void appendProperties(css::uno::Reference<css::uno::XInterface> const& xInterface);
+ void appendMethods(css::uno::Reference<css::uno::XInterface> const& xInterface);
+
+ void inspectObject(css::uno::Reference<css::uno::XInterface> const& xInterface);
+
+ // Object stack handling
+ void clearStack();
+ void addToStack(css::uno::Any const& rAny);
+ css::uno::Any popFromStack();
+
+ void updateBackButtonState();
+
+public:
+ ObjectInspectorTreeHandler(std::unique_ptr<ObjectInspectorWidgets>& pObjectInspectorWidgets);
+
+ // callbacks when a node in the tree view is expanded
+ DECL_LINK(ExpandingHandlerInterfaces, const weld::TreeIter&, bool);
+ DECL_LINK(ExpandingHandlerServices, const weld::TreeIter&, bool);
+ DECL_LINK(ExpandingHandlerProperties, const weld::TreeIter&, bool);
+ DECL_LINK(ExpandingHandlerMethods, const weld::TreeIter&, bool);
+
+ // callback when the tree view selection changed to a different node
+ DECL_LINK(SelectionChanged, weld::TreeView&, void);
+
+ // callback when a pop-up is triggered on a tree view node
+ DECL_LINK(PopupMenuHandler, const CommandEvent&, bool);
+
+ // callback when a button is clicked on a toolbar
+ DECL_LINK(ToolbarButtonClicked, const OString&, void);
+
+ // callback when a page is entered or left on the notebook bar for
+ // different categories
+ DECL_LINK(NotebookEnterPage, const OString&, void);
+ DECL_LINK(NotebookLeavePage, const OString&, bool);
+
+ DECL_LINK(HeaderBarClick, int, void);
+
+ void introspect(css::uno::Reference<css::uno::XInterface> const& xInterface);
+
+ void dispose();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/devtools/ObjectInspectorWidgets.hxx b/include/sfx2/devtools/ObjectInspectorWidgets.hxx
new file mode 100644
index 000000000..9c719d2aa
--- /dev/null
+++ b/include/sfx2/devtools/ObjectInspectorWidgets.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+
+struct ObjectInspectorWidgets
+{
+ ObjectInspectorWidgets(const std::unique_ptr<weld::Builder>& rxBuilder)
+ : mpClassNameLabel(rxBuilder->weld_label("class_name_value_id"))
+ , mpInterfacesTreeView(rxBuilder->weld_tree_view("interfaces_treeview_id"))
+ , mpServicesTreeView(rxBuilder->weld_tree_view("services_treeview_id"))
+ , mpPropertiesTreeView(rxBuilder->weld_tree_view("properties_treeview_id"))
+ , mpMethodsTreeView(rxBuilder->weld_tree_view("methods_treeview_id"))
+ , mpToolbar(rxBuilder->weld_toolbar("object_inspector_toolbar"))
+ , mpNotebook(rxBuilder->weld_notebook("object_inspector_notebookbar"))
+ , mpTextView(rxBuilder->weld_text_view("object_inspector_text_view"))
+ , mpPaned(rxBuilder->weld_paned("object_inspector_paned"))
+ {
+ }
+
+ ~ObjectInspectorWidgets()
+ {
+ // dispose welded objects
+ mpClassNameLabel.reset();
+ mpInterfacesTreeView.reset();
+ mpServicesTreeView.reset();
+ mpPropertiesTreeView.reset();
+ mpMethodsTreeView.reset();
+ mpToolbar.reset();
+ mpNotebook.reset();
+ mpTextView.reset();
+ mpPaned.reset();
+ }
+
+ std::unique_ptr<weld::Label> mpClassNameLabel;
+ std::unique_ptr<weld::TreeView> mpInterfacesTreeView;
+ std::unique_ptr<weld::TreeView> mpServicesTreeView;
+ std::unique_ptr<weld::TreeView> mpPropertiesTreeView;
+ std::unique_ptr<weld::TreeView> mpMethodsTreeView;
+ std::unique_ptr<weld::Toolbar> mpToolbar;
+ std::unique_ptr<weld::Notebook> mpNotebook;
+ std::unique_ptr<weld::TextView> mpTextView;
+ std::unique_ptr<weld::Paned> mpPaned;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/dialoghelper.hxx b/include/sfx2/dialoghelper.hxx
new file mode 100644
index 000000000..a853d5d9d
--- /dev/null
+++ b/include/sfx2/dialoghelper.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_DIALOGHELPER_HXX
+#define INCLUDED_SFX2_DIALOGHELPER_HXX
+
+#include <sfx2/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <tools/gen.hxx>
+
+class DateTime;
+class LocaleDataWrapper;
+class OutputDevice;
+
+//when two tab pages both have the same basic layout with a preview on the
+//right, get both of their non-preview areas to request the same size so that
+//the preview appears in the same place in each one so flipping between tabs
+//isn't distracting as it jumps around
+
+Size SFX2_DLLPUBLIC getParagraphPreviewOptimalSize(const OutputDevice& rReference);
+
+Size SFX2_DLLPUBLIC getDrawPreviewOptimalSize(const OutputDevice& rReference);
+
+Size SFX2_DLLPUBLIC getPreviewStripSize(const OutputDevice& rReference);
+
+Size SFX2_DLLPUBLIC getPreviewOptionsSize(const OutputDevice& rReference);
+
+OUString SFX2_DLLPUBLIC getWidestDateTime(const LocaleDataWrapper& rWrapper, bool bWithSec);
+
+OUString SFX2_DLLPUBLIC formatDateTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper,
+ bool bWithSec);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/digitalsignatures.hxx b/include/sfx2/digitalsignatures.hxx
new file mode 100644
index 000000000..8f0e161b4
--- /dev/null
+++ b/include/sfx2/digitalsignatures.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/security/XCertificate.hpp>
+
+#include <sal/types.h>
+
+namespace sfx2
+{
+/// Extension of css::security::XDocumentDigitalSignatures for internal purposes.
+class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI DigitalSignatures
+{
+public:
+ /// Same as signDocumentWithCertificate(), but passes the xModel as well.
+ virtual bool
+ SignModelWithCertificate(const css::uno::Reference<css::frame::XModel>& xModel,
+ const css::uno::Reference<css::security::XCertificate>& xCertificate,
+ const css::uno::Reference<css::embed::XStorage>& xStorage,
+ const css::uno::Reference<css::io::XStream>& xStream)
+ = 0;
+
+protected:
+ ~DigitalSignatures() noexcept = default;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
new file mode 100644
index 000000000..fc7ebbfd4
--- /dev/null
+++ b/include/sfx2/dinfdlg.hxx
@@ -0,0 +1,579 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_DINFDLG_HXX
+#define INCLUDED_SFX2_DINFDLG_HXX
+
+#include <config_options.h>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Duration.hpp>
+#include <com/sun/star/document/CmisProperty.hpp>
+
+#include <svl/numformat.hxx>
+#include <svl/stritem.hxx>
+#include <svtools/ctrlbox.hxx>
+
+#include <vcl/idle.hxx>
+#include <vcl/weldutils.hxx>
+
+#include <sfx2/tabdlg.hxx>
+
+#include <optional>
+#include <memory>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+
+namespace com::sun::star {
+ namespace document {
+ class XDocumentProperties;
+ }
+}
+
+struct CustomProperty;
+class SvtCalendarBox;
+
+// class SfxDocumentInfoItem ---------------------------------------------
+
+class UNLESS_MERGELIBS(SFX2_DLLPUBLIC) SfxDocumentInfoItem final : public SfxStringItem
+{
+private:
+ sal_Int32 m_AutoloadDelay;
+ OUString m_AutoloadURL;
+ bool m_isAutoloadEnabled;
+ OUString m_DefaultTarget;
+ OUString m_TemplateName;
+ OUString m_Author;
+ css::util::DateTime m_CreationDate;
+ OUString m_ModifiedBy;
+ css::util::DateTime m_ModificationDate;
+ OUString m_PrintedBy;
+ css::util::DateTime m_PrintDate;
+ sal_Int16 m_EditingCycles;
+ sal_Int32 m_EditingDuration;
+ OUString m_Description;
+ OUString m_Keywords;
+ OUString m_Subject;
+ OUString m_Title;
+ bool m_bHasTemplate;
+ bool m_bDeleteUserData;
+ bool m_bUseUserData;
+ bool m_bUseThumbnailSave;
+ std::vector< std::unique_ptr<CustomProperty> > m_aCustomProperties;
+ css::uno::Sequence< css::document::CmisProperty > m_aCmisProperties;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxDocumentInfoItem();
+ SfxDocumentInfoItem( const OUString &rFileName,
+ const css::uno::Reference< css::document::XDocumentProperties> & i_xDocProps,
+ const css::uno::Sequence< css::document::CmisProperty> & i_cmisProps,
+ bool bUseUserData, bool bUseThumbnailSave );
+ SfxDocumentInfoItem( const SfxDocumentInfoItem& );
+ virtual ~SfxDocumentInfoItem() override;
+
+ /// update i_xDocProps with the data in this object
+ void UpdateDocumentInfo(
+ const css::uno::Reference< css::document::XDocumentProperties> & i_xDocProps,
+ bool i_bDoNotUpdateUserDefined = false)
+ const;
+ bool isCmisDocument() const { return m_aCmisProperties.hasElements();}
+
+ bool isAutoloadEnabled() const { return m_isAutoloadEnabled; }
+ sal_Int32 getAutoloadDelay() const { return m_AutoloadDelay; }
+ const OUString& getAutoloadURL() const { return m_AutoloadURL; }
+ const OUString& getDefaultTarget() const { return m_DefaultTarget; }
+ const OUString& getTemplateName() const { return m_TemplateName; }
+ const OUString& getAuthor() const { return m_Author; }
+
+ const css::util::DateTime&
+ getCreationDate() const { return m_CreationDate; }
+ const OUString& getModifiedBy() const { return m_ModifiedBy; }
+
+ const css::util::DateTime&
+ getModificationDate() const { return m_ModificationDate; }
+ const OUString& getPrintedBy() const { return m_PrintedBy; }
+ const css::util::DateTime&
+ getPrintDate() const { return m_PrintDate; }
+ sal_Int16 getEditingCycles() const { return m_EditingCycles; }
+ sal_Int32 getEditingDuration() const { return m_EditingDuration; }
+ const OUString& getDescription() const { return m_Description; }
+ void setDescription(const OUString& i_val) { m_Description = i_val; }
+ const OUString& getKeywords() const { return m_Keywords; }
+ void setKeywords(const OUString& i_val) { m_Keywords = i_val; }
+ const OUString& getSubject() const { return m_Subject; }
+ void setSubject(const OUString& i_val) { m_Subject = i_val; }
+ const OUString& getTitle() const { return m_Title; }
+ void setTitle(const OUString& i_val) { m_Title = i_val; }
+
+ /// reset user-specific data (author, modified-by, ...)
+ void resetUserData(const OUString & i_rAuthor);
+
+ void SetTemplate( bool b ) { m_bHasTemplate = b; }
+ bool HasTemplate() const { return m_bHasTemplate; }
+ void SetDeleteUserData( bool bSet );
+ void SetUseUserData( bool bSet );
+ void SetUseThumbnailSave( bool bSet );
+ bool IsUseUserData() const { return m_bUseUserData;}
+ bool IsUseThumbnailSave() const { return m_bUseThumbnailSave;}
+
+
+ std::vector< std::unique_ptr<CustomProperty> > GetCustomProperties() const;
+ void ClearCustomProperties();
+ void AddCustomProperty( const OUString& sName,
+ const css::uno::Any& rValue );
+
+ const css::uno::Sequence< css::document::CmisProperty >&
+ GetCmisProperties() const { return m_aCmisProperties;}
+
+ void SetCmisProperties(const css::uno::Sequence< css::document::CmisProperty >& cmisProps );
+ virtual SfxDocumentInfoItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+// class SfxDocumentPage -------------------------------------------------
+
+class SfxDocumentPage final : public SfxTabPage
+{
+private:
+ OUString m_aUnknownSize;
+ OUString m_aMultiSignedStr;
+
+ bool bEnableUseUserData : 1,
+ bHandleDelete : 1;
+
+ std::unique_ptr<weld::Image> m_xBmp;
+ std::unique_ptr<weld::Label> m_xNameED;
+ std::unique_ptr<weld::Button> m_xChangePassBtn;
+
+ std::unique_ptr<weld::Label> m_xShowTypeFT;
+ std::unique_ptr<weld::LinkButton> m_xFileValEd;
+ std::unique_ptr<weld::Label> m_xShowSizeFT;
+
+ std::unique_ptr<weld::Label> m_xCreateValFt;
+ std::unique_ptr<weld::Label> m_xChangeValFt;
+ std::unique_ptr<weld::Label> m_xSignedValFt;
+ std::unique_ptr<weld::Button> m_xSignatureBtn;
+ std::unique_ptr<weld::Label> m_xPrintValFt;
+ std::unique_ptr<weld::Label> m_xTimeLogValFt;
+ std::unique_ptr<weld::Label> m_xDocNoValFt;
+
+ std::unique_ptr<weld::CheckButton> m_xUseUserDataCB;
+ std::unique_ptr<weld::Button> m_xDeleteBtn;
+ std::unique_ptr<weld::CheckButton> m_xUseThumbnailSaveCB;
+
+ std::unique_ptr<weld::Label> m_xTemplFt;
+ std::unique_ptr<weld::Label> m_xTemplValFt;
+ std::unique_ptr<weld::CheckButton> m_xImagePreferredDpiCheckButton;
+ std::unique_ptr<weld::ComboBox> m_xImagePreferredDpiComboBox;
+
+ DECL_LINK(DeleteHdl, weld::Button&, void);
+ DECL_LINK(SignatureHdl, weld::Button&, void);
+ DECL_LINK(ChangePassHdl, weld::Button&, void);
+ DECL_LINK(ImagePreferredDPICheckBoxClicked, weld::Toggleable&, void);
+
+ void ImplUpdateSignatures();
+ void ImplCheckPasswordState();
+
+ virtual bool FillItemSet( SfxItemSet* ) override;
+ virtual void Reset( const SfxItemSet* ) override;
+
+public:
+ SfxDocumentPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
+ static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
+ virtual ~SfxDocumentPage() override;
+
+ void EnableUseUserData();
+};
+
+// class SfxDocumentDescPage ---------------------------------------------
+
+class SfxDocumentDescPage final : public SfxTabPage
+{
+private:
+ SfxDocumentInfoItem* m_pInfoItem;
+ std::unique_ptr<weld::Entry> m_xTitleEd;
+ std::unique_ptr<weld::Entry> m_xThemaEd;
+ std::unique_ptr<weld::Entry> m_xKeywordsEd;
+ std::unique_ptr<weld::TextView> m_xCommentEd;
+
+ virtual bool FillItemSet( SfxItemSet* ) override;
+ virtual void Reset( const SfxItemSet* ) override;
+
+public:
+ SfxDocumentDescPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
+ virtual ~SfxDocumentDescPage() override;
+ static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
+};
+
+// class SfxDocumentInfoDialog -------------------------------------------
+
+class SFX2_DLLPUBLIC SfxDocumentInfoDialog final : public SfxTabDialogController
+{
+ virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override;
+
+public:
+ SfxDocumentInfoDialog(weld::Window* pParent, const SfxItemSet&);
+ void AddFontTabPage();
+};
+
+// class CustomPropertiesRemoveButton ------------------------------------
+struct CustomPropertyLine;
+
+class CustomPropertiesDateField
+{
+private:
+ std::unique_ptr<SvtCalendarBox> m_xDateField;
+public:
+ ::std::optional<sal_Int16> m_TZ;
+
+ CustomPropertiesDateField(SvtCalendarBox* pDateField);
+ void set_visible(bool bVisible);
+ Date get_date() const;
+ void set_date(const Date& rDate);
+ ~CustomPropertiesDateField();
+};
+
+namespace weld
+{
+ class TimeFormatter;
+}
+
+class CustomPropertiesTimeField
+{
+public:
+ std::unique_ptr<weld::FormattedSpinButton> m_xTimeField;
+ std::unique_ptr<weld::TimeFormatter> m_xFormatter;
+ bool m_isUTC;
+
+ CustomPropertiesTimeField(std::unique_ptr<weld::FormattedSpinButton> xTimeField);
+ void set_visible(bool bVisible) { m_xTimeField->set_visible(bVisible); }
+ tools::Time get_value() const;
+ void set_value(const tools::Time& rTime);
+
+ ~CustomPropertiesTimeField();
+};
+
+class CustomPropertiesDurationField
+{
+ css::util::Duration m_aDuration;
+ std::unique_ptr<weld::Entry> m_xEntry;
+ std::unique_ptr<weld::Button> m_xEditButton;
+
+ DECL_LINK(ClickHdl, weld::Button&, void);
+public:
+ CustomPropertiesDurationField(std::unique_ptr<weld::Entry> xEntry,
+ std::unique_ptr<weld::Button> xEditButton);
+
+ void SetDuration( const css::util::Duration& rDuration );
+ const css::util::Duration& GetDuration() const { return m_aDuration; }
+
+ void set_visible(bool bVisible);
+};
+
+class CustomPropertiesYesNoButton
+{
+private:
+ std::unique_ptr<weld::Widget> m_xTopLevel;
+ std::unique_ptr<weld::RadioButton> m_xYesButton;
+ std::unique_ptr<weld::RadioButton> m_xNoButton;
+
+public:
+ CustomPropertiesYesNoButton(std::unique_ptr<weld::Widget>,
+ std::unique_ptr<weld::RadioButton> xYesButton,
+ std::unique_ptr<weld::RadioButton> xNoButton);
+ ~CustomPropertiesYesNoButton();
+
+ void CheckYes() { m_xYesButton->set_active(true); }
+ void CheckNo() { m_xNoButton->set_active(true); }
+ bool IsYesChecked() const { return m_xYesButton->get_active(); }
+ void set_visible(bool bVisible) { m_xTopLevel->set_visible(bVisible); }
+};
+
+class CustomPropertiesWindow;
+
+// struct CustomPropertyLine ---------------------------------------------
+struct CustomPropertyLine
+{
+ CustomPropertiesWindow* m_pParent;
+
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xLine;
+ std::unique_ptr<weld::ComboBox> m_xNameBox;
+ std::unique_ptr<weld::ComboBox> m_xTypeBox;
+ std::unique_ptr<weld::Entry> m_xValueEdit;
+ std::unique_ptr<weld::Widget> m_xDateTimeBox;
+ std::unique_ptr<CustomPropertiesDateField> m_xDateField;
+ std::unique_ptr<CustomPropertiesTimeField> m_xTimeField;
+ std::unique_ptr<weld::Widget> m_xDurationBox;
+ std::unique_ptr<CustomPropertiesDurationField> m_xDurationField;
+ std::unique_ptr<CustomPropertiesYesNoButton> m_xYesNoButton;
+ std::unique_ptr<weld::Button> m_xRemoveButton;
+
+ bool m_bTypeLostFocus;
+
+ CustomPropertyLine(CustomPropertiesWindow* pParent, weld::Widget* pContainer);
+ DECL_LINK(TypeHdl, weld::ComboBox&, void);
+ DECL_LINK(RemoveHdl, weld::Button&, void);
+ DECL_LINK(EditLoseFocusHdl, weld::Widget&, void);
+ DECL_LINK(BoxLoseFocusHdl, weld::Widget&, void);
+
+ void DoTypeHdl(const weld::ComboBox& rBox);
+
+ void Clear();
+ void Hide();
+};
+
+// class CustomPropertiesWindow ------------------------------------------
+
+class CustomPropertiesWindow
+{
+private:
+ sal_Int32 m_nHeight;
+ sal_Int32 m_nLineHeight;
+ sal_Int32 m_nScrollPos;
+ std::vector<std::unique_ptr<CustomProperty>> m_aCustomProperties;
+ std::vector<std::unique_ptr<CustomPropertyLine>> m_aCustomPropertiesLines;
+ CustomPropertyLine* m_pCurrentLine;
+ SvNumberFormatter m_aNumberFormatter;
+ Idle m_aEditLoseFocusIdle;
+ Idle m_aBoxLoseFocusIdle;
+ Link<void*,void> m_aRemovedHdl;
+
+ weld::Container& m_rBody;
+ weld::Label& m_rHeaderAccName;
+ weld::Label& m_rHeaderAccType;
+ weld::Label& m_rHeaderAccValue;
+
+ DECL_LINK(EditTimeoutHdl, Timer *, void);
+ DECL_LINK(BoxTimeoutHdl, Timer *, void);
+
+ bool IsLineValid( CustomPropertyLine* pLine ) const;
+ void ValidateLine( CustomPropertyLine* pLine, bool bIsFromTypeBox );
+ void CreateNewLine();
+ void StoreCustomProperties();
+ sal_uInt32 GetCurrentDataModelPosition() const { return -1 * m_nScrollPos / m_nLineHeight; }
+
+public:
+ CustomPropertiesWindow(weld::Container& rParent, weld::Label& rHeaderAccName,
+ weld::Label& rHeaderAccType, weld::Label& rHeaderAccValue);
+ ~CustomPropertiesWindow();
+
+ sal_uInt16 GetExistingLineCount() const { return m_aCustomPropertiesLines.size(); }
+ sal_uInt16 GetTotalLineCount() const { return m_aCustomProperties.size(); }
+ void SetVisibleLineCount(sal_uInt32 nCount);
+ sal_Int32 GetHeight() const { return m_nHeight; }
+ void SetHeight(int nHeight) { m_nHeight = nHeight; }
+ sal_Int32 GetLineHeight() const { return m_nLineHeight; }
+ void SetLineHeight(sal_Int32 nLineHeight) { m_nLineHeight = nLineHeight; }
+ void AddLine( const OUString& sName, css::uno::Any const & rAny );
+ bool AreAllLinesValid() const;
+ void ClearAllLines();
+ void DoScroll( sal_Int32 nNewPos );
+ void ReloadLinesContent();
+
+ css::uno::Sequence< css::beans::PropertyValue >
+ GetCustomProperties();
+ void SetCustomProperties(std::vector< std::unique_ptr<CustomProperty> >&& rProperties);
+ void SetRemovedHdl( const Link<void*,void>& rLink ) { m_aRemovedHdl = rLink; }
+
+ void BoxLoseFocus(CustomPropertyLine* pLine);
+ void EditLoseFocus(CustomPropertyLine* pLine);
+ void Remove(const CustomPropertyLine* pLine);
+};
+
+// class CustomPropertiesControl -----------------------------------------
+
+class CustomPropertiesControl
+{
+private:
+ sal_Int32 m_nThumbPos;
+
+ std::unique_ptr<weld::Widget> m_xBox;
+ std::unique_ptr<weld::Container> m_xBody;
+ std::unique_ptr<weld::ScrolledWindow> m_xVertScroll;
+ std::unique_ptr<CustomPropertiesWindow> m_xPropertiesWin;
+ std::unique_ptr<weld::Label> m_xName;
+ std::unique_ptr<weld::Label> m_xType;
+ std::unique_ptr<weld::Label> m_xValue;
+
+ DECL_LINK( ResizeHdl, const Size&, void );
+ DECL_LINK( ScrollHdl, weld::ScrolledWindow&, void );
+ DECL_LINK( RemovedHdl, void*, void );
+
+public:
+ CustomPropertiesControl();
+ ~CustomPropertiesControl();
+
+ void AddLine(css::uno::Any const & rAny);
+
+ bool AreAllLinesValid() const { return m_xPropertiesWin->AreAllLinesValid(); }
+ void ClearAllLines() { m_xPropertiesWin->ClearAllLines(); }
+
+ css::uno::Sequence<css::beans::PropertyValue>
+ GetCustomProperties() const
+ { return m_xPropertiesWin->GetCustomProperties(); }
+ void SetCustomProperties(std::vector< std::unique_ptr<CustomProperty> >&& rProperties);
+
+ void Init(weld::Builder& rParent);
+};
+
+// class SfxCustomPropertiesPage -----------------------------------------
+
+class SfxCustomPropertiesPage final : public SfxTabPage
+{
+private:
+ DECL_LINK(AddHdl, weld::Button&, void);
+
+ std::unique_ptr<CustomPropertiesControl> m_xPropertiesCtrl;
+ std::unique_ptr<weld::Button> m_xAdd;
+
+ virtual bool FillItemSet( SfxItemSet* ) override;
+ virtual void Reset( const SfxItemSet* ) override;
+ virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
+
+public:
+ SfxCustomPropertiesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
+ static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
+ virtual ~SfxCustomPropertiesPage() override;
+};
+
+struct CmisValue
+{
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Frame> m_xFrame;
+ std::unique_ptr<weld::Entry> m_xValueEdit;
+
+ CmisValue(weld::Widget* pParent, const OUString& rStr);
+};
+
+struct CmisDateTime
+{
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Frame> m_xFrame;
+ std::unique_ptr<SvtCalendarBox> m_xDateField;
+ std::unique_ptr<weld::FormattedSpinButton> m_xTimeField;
+ std::unique_ptr<weld::TimeFormatter> m_xFormatter;
+
+ CmisDateTime(weld::Widget* pParent, const css::util::DateTime& rDateTime);
+};
+
+struct CmisYesNo
+{
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Frame> m_xFrame;
+ std::unique_ptr<weld::RadioButton> m_xYesButton;
+ std::unique_ptr<weld::RadioButton> m_xNoButton;
+
+ CmisYesNo(weld::Widget* pParent, bool bValue);
+};
+
+// struct CmisPropertyLine ---------------------------------------------
+
+struct CmisPropertyLine
+{
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ OUString m_sId;
+ OUString m_sType;
+ bool m_bUpdatable;
+ bool m_bRequired;
+ bool m_bMultiValued;
+ bool m_bOpenChoice;
+ std::unique_ptr<weld::Frame> m_xFrame;
+ std::unique_ptr<weld::Label> m_xName;
+ std::unique_ptr<weld::Label> m_xType;
+ std::vector< std::unique_ptr<CmisValue> > m_aValues;
+ std::vector< std::unique_ptr<CmisDateTime> > m_aDateTimes;
+ std::vector< std::unique_ptr<CmisYesNo> > m_aYesNos;
+ CmisPropertyLine(weld::Widget* pParent);
+ ~CmisPropertyLine();
+};
+
+// class CmisPropertiesWindow ------------------------------------------
+
+class CmisPropertiesWindow
+{
+private:
+ std::unique_ptr<weld::Container> m_xBox;
+ SvNumberFormatter m_aNumberFormatter;
+ std::vector< std::unique_ptr<CmisPropertyLine> > m_aCmisPropertiesLines;
+public:
+ CmisPropertiesWindow(std::unique_ptr<weld::Container> xParent);
+ ~CmisPropertiesWindow();
+
+ void AddLine( const OUString& sId, const OUString& sName,
+ const OUString& sType, const bool bUpdatable,
+ const bool bRequired, const bool bMultiValued,
+ const bool bOpenChoice,
+ css::uno::Any& aChoices,
+ css::uno::Any const & rAny );
+ void ClearAllLines();
+
+ css::uno::Sequence< css::document::CmisProperty >
+ GetCmisProperties() const;
+};
+
+// class CmisPropertiesControl -----------------------------------------
+
+class CmisPropertiesControl
+{
+private:
+ CmisPropertiesWindow m_aPropertiesWin;
+ std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
+
+public:
+ CmisPropertiesControl(weld::Builder& rBuilder);
+
+ void AddLine( const OUString& sId, const OUString& sName,
+ const OUString& sType, const bool bUpdatable,
+ const bool bRequired, const bool bMultiValude,
+ const bool bOpenChoice,
+ css::uno::Any& aChoices,
+ css::uno::Any const & rAny );
+
+ void ClearAllLines();
+ css::uno::Sequence< css::document::CmisProperty >
+ GetCmisProperties() const
+ { return m_aPropertiesWin.GetCmisProperties(); }
+};
+
+// class SfxCmisPropertiesPage -------------------------------------------------
+
+class SfxCmisPropertiesPage final : public SfxTabPage
+{
+private:
+ std::unique_ptr<CmisPropertiesControl> m_xPropertiesCtrl;
+
+ virtual bool FillItemSet( SfxItemSet* ) override;
+ virtual void Reset( const SfxItemSet* ) override;
+ virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
+
+public:
+ SfxCmisPropertiesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
+ virtual ~SfxCmisPropertiesPage() override;
+ static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*);
+};
+
+#endif // #ifndef _ INCLUDED_SFX2_DINFDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx
new file mode 100644
index 000000000..ee445710b
--- /dev/null
+++ b/include/sfx2/dispatch.hxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_DISPATCH_HXX
+#define INCLUDED_SFX2_DISPATCH_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/toolbarids.hxx>
+#include <sal/types.h>
+
+#include <sfx2/bindings.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <o3tl/span.hxx>
+
+#include <boost/property_tree/ptree_fwd.hpp>
+#include <initializer_list>
+
+class SfxSlotServer;
+class SfxRequest;
+class SfxViewFrame;
+class SfxItemSet;
+class SfxModule;
+class Point;
+struct SfxDispatcher_Impl;
+
+namespace com::sun::star::awt { class XPopupMenu; }
+namespace vcl { class Window; }
+
+enum class SfxDispatcherPopFlags
+{
+ NONE = 0,
+ POP_UNTIL = 4,
+ POP_DELETE = 2,
+ PUSH = 1,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SfxDispatcherPopFlags> : is_typed_flags<SfxDispatcherPopFlags, 0x07> {};
+}
+
+enum class SfxSlotFilterState
+{
+ DISABLED,
+ ENABLED,
+ // enabled even if ReadOnlyDoc
+ ENABLED_READONLY,
+};
+
+
+class SFX2_DLLPUBLIC SfxDispatcher final
+{
+ std::unique_ptr<SfxDispatcher_Impl> xImp;
+
+ // Search for temporary evaluated Todos
+ SAL_DLLPRIVATE bool CheckVirtualStack( const SfxShell& rShell );
+
+friend class SfxApplication;
+friend class SfxViewFrame;
+friend class SfxBindings;
+friend class SfxStateCache;
+friend class SfxPopupMenuManager;
+friend class SfxHelp;
+
+ DECL_DLLPRIVATE_LINK( EventHdl_Impl, Timer *, void );
+ void PostMsgHandler(std::unique_ptr<SfxRequest>);
+
+ SAL_DLLPRIVATE void Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest &rReq, bool bRecord );
+ SAL_DLLPRIVATE void Update_Impl_( bool,bool,bool,SfxWorkWindow*);
+
+
+ bool FindServer_( sal_uInt16 nId, SfxSlotServer &rServer );
+ bool FillState_( const SfxSlotServer &rServer,
+ SfxItemSet &rState, const SfxSlot *pRealSlot );
+ void Execute_( SfxShell &rShell, const SfxSlot &rSlot,
+ SfxRequest &rReq,
+ SfxCallMode eCall);
+
+ void FlushImpl();
+
+public:
+ SfxDispatcher();
+ SfxDispatcher( SfxViewFrame *pFrame );
+
+ SAL_DLLPRIVATE void Construct_Impl();
+
+ ~SfxDispatcher();
+
+ const SfxPoolItem* Execute( sal_uInt16 nSlot,
+ SfxCallMode nCall = SfxCallMode::SLOT,
+ const SfxPoolItem **pArgs = nullptr,
+ sal_uInt16 nModi = 0,
+ const SfxPoolItem **pInternalArgs = nullptr);
+
+ const SfxPoolItem* Execute(sal_uInt16 nSlot,
+ SfxCallMode nCall,
+ SfxItemSet const * pArgs,
+ SfxItemSet const * pInternalArgs,
+ sal_uInt16 nModi);
+
+ const SfxPoolItem* ExecuteList(sal_uInt16 nSlot,
+ SfxCallMode nCall,
+ std::initializer_list<SfxPoolItem const*> args,
+ std::initializer_list<SfxPoolItem const*> internalargs = std::initializer_list<SfxPoolItem const*>());
+
+ const SfxPoolItem* Execute( sal_uInt16 nSlot,
+ SfxCallMode nCall,
+ const SfxItemSet &rArgs );
+
+ const SfxSlot* GetSlot( const OUString& rCommand );
+
+ bool IsActive( const SfxShell& rShell );
+ sal_uInt16 GetShellLevel( const SfxShell &rShell );
+ SfxBindings* GetBindings() const;
+
+ void Push( SfxShell& rShell );
+ void Pop( SfxShell& rShell, SfxDispatcherPopFlags nMode = SfxDispatcherPopFlags::NONE );
+
+ SfxShell* GetShell(sal_uInt16 nIdx) const;
+ SfxViewFrame* GetFrame() const;
+ SfxModule* GetModule() const;
+
+ void ExecutePopup( const OUString &rResName, vcl::Window *pWin = nullptr, const Point *pPos = nullptr );
+ static void ExecutePopup( vcl::Window *pWin = nullptr, const Point *pPosPixel = nullptr );
+
+ bool IsAppDispatcher() const;
+ bool IsFlushed() const;
+ void Flush();
+ void Lock( bool bLock );
+ bool IsLocked() const;
+ void SetSlotFilter( SfxSlotFilterState nEnable = SfxSlotFilterState::DISABLED,
+ o3tl::span<sal_uInt16 const> pSIDs = o3tl::span<sal_uInt16 const>());
+
+ void HideUI( bool bHide = true );
+ ToolbarId GetObjectBarId( sal_uInt16 nPos ) const;
+
+ SfxItemState QueryState( sal_uInt16 nSID, const SfxPoolItem* &rpState );
+ template<class T>
+ SfxItemState QueryState( TypedWhichId<T> nSID, const T* &rpState )
+ {
+ return QueryState(sal_uInt16(nSID), reinterpret_cast<SfxPoolItem const*&>(rpState));
+ }
+ SfxItemState QueryState( sal_uInt16 nSID, css::uno::Any& rAny );
+
+ void SetDisableFlags( SfxDisableFlags nFlags );
+ SfxDisableFlags GetDisableFlags() const;
+
+ SAL_DLLPRIVATE void SetMenu_Impl();
+ SAL_DLLPRIVATE void Update_Impl( bool bForce = false ); // ObjectBars etc.
+ SAL_DLLPRIVATE bool IsUpdated_Impl() const;
+ SAL_DLLPRIVATE bool GetShellAndSlot_Impl( sal_uInt16 nSlot, SfxShell **ppShell, const SfxSlot **ppSlot,
+ bool bOwnShellsOnly, bool bRealSlot );
+ SAL_DLLPRIVATE void SetReadOnly_Impl( bool bOn );
+ SAL_DLLPRIVATE bool GetReadOnly_Impl() const;
+ SAL_DLLPRIVATE SfxSlotFilterState IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) const;
+ SAL_DLLPRIVATE void SetQuietMode_Impl( bool bOn );
+ SAL_DLLPRIVATE bool IsReadOnlyShell_Impl( sal_uInt16 nShell ) const;
+ SAL_DLLPRIVATE void RemoveShell_Impl( SfxShell& rShell );
+ SAL_DLLPRIVATE void DoActivate_Impl( bool bMDI );
+ SAL_DLLPRIVATE void DoDeactivate_Impl( bool bMDI, SfxViewFrame const * pNew );
+ SAL_DLLPRIVATE void InvalidateBindings_Impl(bool);
+
+ static boost::property_tree::ptree fillPopupMenu(const css::uno::Reference<css::awt::XPopupMenu>& rMenu);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/dllapi.h b/include/sfx2/dllapi.h
new file mode 100644
index 000000000..a6877f769
--- /dev/null
+++ b/include/sfx2/dllapi.h
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_DLLAPI_H
+#define INCLUDED_SFX2_DLLAPI_H
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined SFX2_DLLIMPLEMENTATION
+#define SFX2_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SFX2_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#define SFX2_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docfac.hxx b/include/sfx2/docfac.hxx
new file mode 100644
index 000000000..884112530
--- /dev/null
+++ b/include/sfx2/docfac.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_DOCFAC_HXX
+#define INCLUDED_SFX2_DOCFAC_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+
+#include <rtl/ustring.hxx>
+#include <sfx2/shell.hxx>
+#include <memory>
+
+class SfxFilter;
+class SfxViewFactory;
+struct SfxObjectFactory_Impl;
+class SfxFilterContainer;
+class SvGlobalName;
+class SfxModule;
+
+typedef void (*SfxVoidFunc)();
+
+
+class SFX2_DLLPUBLIC SfxObjectFactory
+{
+private:
+ const OUString m_sFactoryName;
+ std::unique_ptr<SfxObjectFactory_Impl> pImpl; // Additional Data
+
+public:
+ SfxObjectFactory( const SvGlobalName &rName, const OUString& sFactoryName );
+ ~SfxObjectFactory();
+
+ const SvGlobalName& GetClassId() const;
+ OUString GetFactoryURL() const; // shortcut for "private:factory/GetShortName()"
+ const OUString& GetFactoryName() const { return m_sFactoryName; }
+ OUString GetModuleName() const;
+ SfxFilterContainer *GetFilterContainer() const;
+
+ // Views
+ void RegisterViewFactory(SfxViewFactory &rFactory);
+ sal_uInt16 GetViewFactoryCount() const;
+ SfxViewFactory& GetViewFactory(sal_uInt16 i = 0) const;
+
+ /// returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical name
+ SfxViewFactory* GetViewFactoryByViewName( std::u16string_view i_rViewName ) const;
+
+ // Filter
+ std::shared_ptr<const SfxFilter> GetTemplateFilter() const;
+ static OUString GetStandardTemplate( std::u16string_view rServiceName );
+ static void SetStandardTemplate( const OUString& rServiceName, const OUString& rTemplateName );
+ static void SetSystemTemplate( const OUString& rServiceName, const OUString& rTemplateName );
+
+ void SetDocumentServiceName( const OUString& rServiceName );
+ const OUString& GetDocumentServiceName() const;
+
+ SfxModule* GetModule() const;
+
+ SAL_DLLPRIVATE void SetModule_Impl( SfxModule* );
+ SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const SfxInterfaceId i_nViewId, const sal_uInt16 i_nFallback ) const;
+
+private:
+ SfxObjectFactory(const SfxObjectFactory&) = delete;
+ const SfxObjectFactory& operator=(const SfxObjectFactory &) = delete;
+};
+
+#define SFX_DECL_OBJECTFACTORY() \
+public: \
+ static SfxObjectFactory& Factory(); \
+ virtual SfxObjectFactory& GetFactory() const override { return Factory(); }
+
+#define SFX_IMPL_OBJECTFACTORY(ClassName,GlobName,ShortName) \
+ SfxObjectFactory& ClassName::Factory() \
+ { \
+ static SfxObjectFactory aObjectFactory(GlobName, ShortName); \
+ return aObjectFactory; \
+ }
+#endif // INCLUDED_SFX2_DOCFAC_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx
new file mode 100644
index 000000000..bc6e0cf1e
--- /dev/null
+++ b/include/sfx2/docfile.hxx
@@ -0,0 +1,309 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_DOCFILE_HXX
+#define INCLUDED_SFX2_DOCFILE_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/signaturestate.hxx>
+#include <svl/lockfilecommon.hxx>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <svl/itemset.hxx>
+#include <tools/link.hxx>
+#include <tools/stream.hxx>
+#include <mutex>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::graphic { class XGraphic; }
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::security { class XCertificate; }
+namespace com::sun::star::task { class XInteractionHandler; }
+namespace com::sun::star::ucb { class XCommandEnvironment; }
+namespace com::sun::star::ucb { class XContent; }
+namespace com::sun::star::util { struct DateTime; }
+namespace com::sun::star::util { struct RevisionTag; }
+namespace com::sun::star::frame
+{
+class XModel;
+}
+namespace ucbhelper { class Content; }
+
+class SvKeyValueIterator;
+class SfxFilter;
+class SfxMedium_Impl;
+class INetURLObject;
+class SfxFrame;
+class DateTime;
+struct ImplSVEvent;
+
+namespace weld
+{
+ class Window;
+}
+
+class SFX2_DLLPUBLIC SfxMedium final : public SvRefBase
+{
+ std::unique_ptr< SfxMedium_Impl > pImpl;
+
+ SAL_DLLPRIVATE void SetIsRemote_Impl();
+ SAL_DLLPRIVATE void CloseInStream_Impl(bool bInDestruction = false);
+ SAL_DLLPRIVATE void CloseOutStream_Impl();
+ SAL_DLLPRIVATE void CloseStreams_Impl(bool bInDestruction = false);
+
+ SAL_DLLPRIVATE void SetEncryptionDataToStorage_Impl();
+
+public:
+
+ SfxMedium();
+ SfxMedium( const OUString &rName,
+ StreamMode nOpenMode,
+ std::shared_ptr<const SfxFilter> pFilter = nullptr,
+ const std::shared_ptr<SfxItemSet>& pSet = nullptr );
+ SfxMedium( const OUString &rName,
+ const OUString &rReferer,
+ StreamMode nOpenMode,
+ std::shared_ptr<const SfxFilter> pFilter = nullptr,
+ const std::shared_ptr<SfxItemSet>& pSet = nullptr );
+ SfxMedium( const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const OUString& rBaseURL,
+ const std::shared_ptr<SfxItemSet>& pSet = nullptr );
+ SfxMedium( const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const OUString& rBaseURL,
+ const OUString& rTypeName,
+ const std::shared_ptr<SfxItemSet>& pSet = nullptr );
+ SfxMedium( const css::uno::Sequence< css::beans::PropertyValue >& aArgs );
+
+ virtual ~SfxMedium() override;
+
+ DECL_DLLPRIVATE_STATIC_LINK(SfxMedium, ShowReloadEditableDialog, void*, void);
+ bool CheckCanGetLockfile() const;
+ void SetOriginallyReadOnly(bool val);
+ void AddToCheckEditableWorkerList();
+ void SetWorkerReloadEvent(ImplSVEvent* pEvent);
+ ImplSVEvent* GetWorkerReloadEvent() const;
+ const std::shared_ptr<std::recursive_mutex>& GetCheckEditableMutex() const;
+ void CancelCheckEditableEntry(bool bRemoveEvent = true);
+
+ void UseInteractionHandler( bool );
+ css::uno::Reference< css::task::XInteractionHandler >
+ GetInteractionHandler( bool bGetAlways = false );
+
+ void setStreamToLoadFrom(
+ const css::uno::Reference<css::io::XInputStream>& xInputStream,
+ bool bIsReadOnly);
+
+ void SetLoadTargetFrame(SfxFrame* pFrame );
+ SfxFrame* GetLoadTargetFrame() const;
+
+ /**
+ * Does not take ownership of pFlt but pFlt needs to be around as long as the SfxMedium instance.
+ */
+ void SetFilter(const std::shared_ptr<const SfxFilter>& pFilter);
+ const std::shared_ptr<const SfxFilter>& GetFilter() const;
+ const OUString& GetOrigURL() const;
+
+ SfxItemSet * GetItemSet() const;
+ void SetArgs(const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
+ const css::uno::Sequence<css::beans::PropertyValue> & GetArgs() const;
+ void Close(bool bInDestruction = false);
+ void CloseAndRelease();
+ void ReOpen();
+ void CompleteReOpen();
+ const OUString& GetName() const;
+ const INetURLObject& GetURLObject() const;
+
+ void CheckFileDate( const css::util::DateTime& aInitDate );
+ [[nodiscard]] bool DocNeedsFileDateCheck() const;
+ css::util::DateTime const & GetInitFileDate( bool bIgnoreOldValue );
+
+ css::uno::Reference< css::ucb::XContent > GetContent() const;
+ const OUString& GetPhysicalName() const;
+ [[nodiscard]] bool IsRemote() const;
+ [[nodiscard]] bool IsOpen() const; // { return aStorage.Is() || pInStream; }
+ void Download( const Link<void*,void>& aLink = Link<void*,void>());
+ void SetDoneLink( const Link<void*,void>& rLink );
+
+ ErrCode GetErrorCode() const;
+ ErrCode GetError() const
+ { return GetErrorCode().IgnoreWarning(); }
+ ErrCode const & GetLastStorageCreationState() const;
+
+ void SetError(ErrCode nError);
+
+ void CloseInStream();
+ void CloseOutStream();
+
+ void CloseStorage();
+
+ StreamMode GetOpenMode() const;
+ void SetOpenMode( StreamMode nStorOpen, bool bDontClose = false );
+
+ SvStream* GetInStream();
+ SvStream* GetOutStream();
+
+ bool Commit();
+ bool IsStorage();
+
+ enum class LockFileResult
+ {
+ Failed,
+ FailedLockFile, // there was only lock file that prevented success - no syslock or IO error
+ Succeeded,
+ };
+ LockFileResult LockOrigFileOnDemand(bool bLoading, bool bNoUI, bool bTryIgnoreLockFile = false,
+ LockFileEntry* pLockData = nullptr);
+ void DisableUnlockWebDAV( bool bDisableUnlockWebDAV = true );
+ void UnlockFile( bool bReleaseLockStream );
+ /// Lets Transfer_Impl() not fsync the output file.
+ void DisableFileSync(bool bDisableFileSync);
+
+ css::uno::Reference< css::embed::XStorage > GetStorage( bool bCreateTempFile = true );
+ css::uno::Reference< css::embed::XStorage > GetOutputStorage();
+ void ResetError();
+ [[nodiscard]] bool IsExpired() const;
+ void SetName( const OUString& rName, bool bSetOrigURL = false );
+
+ const css::uno::Sequence < css::util::RevisionTag >&
+ GetVersionList( bool _bNoReload = false );
+ [[nodiscard]] bool IsReadOnly() const;
+
+ // Whether the medium had originally been opened r/o (either because it is
+ // "physically" r/o, or because it was requested to be opened r/o,
+ // independent of later changes via SetOpenMode; used to keep track of the
+ // "true" state of the medium across toggles via SID_EDITDOC (which do
+ // change SetOpenMode):
+ [[nodiscard]] bool IsOriginallyReadOnly() const;
+
+ // Whether the medium had originally been requested to be opened r/o,
+ // independent of later changes via SetOpenMode; used for SID_RELOAD:
+ [[nodiscard]] bool IsOriginallyLoadedReadOnly() const;
+
+ css::uno::Reference< css::io::XInputStream > const & GetInputStream();
+
+ void CreateTempFile( bool bReplace = true );
+ void CreateTempFileNoCopy();
+ OUString SwitchDocumentToTempFile();
+ bool SwitchDocumentToFile( const OUString& aURL );
+
+ OUString GetBaseURL( bool bForSaving=false );
+ void SetInCheckIn( bool bInCheckIn );
+ bool IsInCheckIn( ) const;
+ bool IsSkipImages( ) const;
+
+ SAL_DLLPRIVATE bool HasStorage_Impl() const;
+
+ SAL_DLLPRIVATE void StorageBackup_Impl();
+ SAL_DLLPRIVATE OUString const & GetBackup_Impl();
+
+ SAL_DLLPRIVATE css::uno::Reference< css::embed::XStorage > const & GetZipStorageToSign_Impl( bool bReadOnly = true );
+ SAL_DLLPRIVATE void CloseZipStorage_Impl();
+
+ // the storage that will be returned by the medium on GetStorage request
+ SAL_DLLPRIVATE void SetStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xNewStorage );
+
+ SAL_DLLPRIVATE void CloseAndReleaseStreams_Impl();
+ SAL_DLLPRIVATE void AddVersion_Impl( css::util::RevisionTag& rVersion );
+ SAL_DLLPRIVATE bool TransferVersionList_Impl( SfxMedium const & rMedium );
+ SAL_DLLPRIVATE void SaveVersionList_Impl();
+ SAL_DLLPRIVATE void RemoveVersion_Impl( const OUString& rVersion );
+
+ SAL_DLLPRIVATE void SetExpired_Impl( const DateTime& rDateTime );
+ SAL_DLLPRIVATE SvKeyValueIterator* GetHeaderAttributes_Impl();
+
+ SAL_DLLPRIVATE void Init_Impl();
+
+ SAL_DLLPRIVATE void GetLockingStream_Impl();
+ SAL_DLLPRIVATE void GetMedium_Impl();
+ SAL_DLLPRIVATE bool TryDirectTransfer( const OUString& aURL, SfxItemSet const & aTargetSet );
+ SAL_DLLPRIVATE void Transfer_Impl();
+ SAL_DLLPRIVATE void CreateFileStream();
+ SAL_DLLPRIVATE void SetUpdatePickList(bool);
+ SAL_DLLPRIVATE bool IsUpdatePickList() const;
+
+ SAL_DLLPRIVATE void SetLongName(const OUString &rName);
+ SAL_DLLPRIVATE const OUString & GetLongName() const;
+ SAL_DLLPRIVATE bool IsPreview_Impl() const;
+ SAL_DLLPRIVATE void ClearBackup_Impl();
+ SAL_DLLPRIVATE void SetPhysicalName_Impl(const OUString& rName);
+ SAL_DLLPRIVATE void CanDisposeStorage_Impl( bool bDisposeStorage );
+ SAL_DLLPRIVATE bool WillDisposeStorageOnClose_Impl();
+
+ SAL_DLLPRIVATE void DoBackup_Impl();
+ SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent );
+ SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent,
+ std::u16string_view aPrefix,
+ const OUString& aExtension,
+ const OUString& aDestDir );
+
+ SAL_DLLPRIVATE bool UseBackupToRestore_Impl( ::ucbhelper::Content& aOriginalContent,
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv );
+
+ SAL_DLLPRIVATE bool StorageCommit_Impl();
+
+ SAL_DLLPRIVATE void TransactedTransferForFS_Impl( const INetURLObject& aSource,
+ const INetURLObject& aDest,
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv );
+
+ SAL_DLLPRIVATE bool
+ SignContents_Impl(weld::Window* pDialogParent,
+ bool bSignScriptingContent, bool bHasValidDocumentSignature,
+ const OUString& aSignatureLineId = OUString(),
+ const css::uno::Reference<css::security::XCertificate>& xCert
+ = css::uno::Reference<css::security::XCertificate>(),
+ const css::uno::Reference<css::graphic::XGraphic>& xValidGraphic
+ = css::uno::Reference<css::graphic::XGraphic>(),
+ const css::uno::Reference<css::graphic::XGraphic>& xInvalidGraphic
+ = css::uno::Reference<css::graphic::XGraphic>(),
+ const OUString& aComment = OUString());
+
+ SAL_DLLPRIVATE bool SignDocumentContentUsingCertificate(
+ const css::uno::Reference<css::frame::XModel>& xModel, bool bHasValidDocumentSignature,
+ const css::uno::Reference<css::security::XCertificate>& xCertificate);
+
+ // the following two methods must be used and make sense only during saving currently
+ // TODO/LATER: in future the signature state should be controlled by the medium not by the document
+ // in this case the methods will be used generally, and might need to be renamed
+ SAL_DLLPRIVATE SignatureState GetCachedSignatureState_Impl() const;
+ SAL_DLLPRIVATE void SetCachedSignatureState_Impl( SignatureState nState );
+
+ void SetHasEmbeddedObjects(bool bHasEmbeddedObjects);
+
+ static css::uno::Sequence < css::util::RevisionTag > GetVersionList(
+ const css::uno::Reference< css::embed::XStorage >& xStorage );
+ static OUString CreateTempCopyWithExt( std::u16string_view aURL );
+ static bool CallApproveHandler(const css::uno::Reference< css::task::XInteractionHandler >& xHandler, const css::uno::Any& rRequest, bool bAllowAbort);
+
+ static bool SetWritableForUserOnly( const OUString& aURL );
+ static sal_uInt32 CreatePasswordToModifyHash( std::u16string_view aPasswd, bool bWriter );
+
+private:
+ enum class ShowLockResult { NoLock, Succeeded, Try };
+ ShowLockResult ShowLockedDocumentDialog(const LockFileEntry& aData,
+ bool bIsLoading, bool bOwnLock, bool bHandleSysLocked);
+ enum class MessageDlg { LockFileIgnore, LockFileCorrupt };
+ bool ShowLockFileProblemDialog(MessageDlg nWhichDlg);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx
new file mode 100644
index 000000000..fb5bb5505
--- /dev/null
+++ b/include/sfx2/docfilt.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_DOCFILT_HXX
+#define INCLUDED_SFX2_DOCFILT_HXX
+
+#include <comphelper/documentconstants.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sal/types.h>
+#include <sot/formats.hxx>
+#include <sfx2/dllapi.h>
+#include <tools/wldcrd.hxx>
+
+#include <memory>
+#include <string_view>
+
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+class SotStorage;
+
+class SFX2_DLLPUBLIC SfxFilter
+{
+ friend class SfxFilterContainer;
+
+ WildCard aWildCard;
+
+ OUString aTypeName;
+ OUString aUserData;
+ OUString aServiceName;
+ OUString aMimeType;
+ OUString maFilterName;
+ OUString aUIName;
+ OUString aDefaultTemplate;
+
+ /**
+ * Custom provider name in case the filter is provided via external
+ * libraries. Empty for conventional filter types.
+ */
+ OUString maProvider;
+
+ SfxFilterFlags nFormatType;
+ sal_Int32 nVersion;
+ SotClipboardFormatId lFormat;
+ bool mbEnabled;
+
+public:
+ SfxFilter( const OUString& rProvider, const OUString& rFilterName );
+
+ SfxFilter( const OUString &rName,
+ std::u16string_view rWildCard,
+ SfxFilterFlags nFormatType,
+ SotClipboardFormatId lFormat,
+ const OUString &rTypeName,
+ const OUString &rMimeType,
+ const OUString &rUserData,
+ const OUString& rServiceName,
+ bool bEnabled = true );
+ ~SfxFilter();
+
+ bool IsAllowedAsTemplate() const { return bool(nFormatType & SfxFilterFlags::TEMPLATE); }
+ bool IsOwnFormat() const { return bool(nFormatType & SfxFilterFlags::OWN); }
+ /// If the filter supports digital signatures.
+ bool GetSupportsSigning() const { return bool(nFormatType & SfxFilterFlags::SUPPORTSSIGNING); }
+ bool GetGpgEncryption() const { return bool(nFormatType & SfxFilterFlags::GPGENCRYPTION); }
+ bool IsOwnTemplateFormat() const { return bool(nFormatType & SfxFilterFlags::TEMPLATEPATH); }
+ /// not our built-in format
+ bool IsAlienFormat() const { return bool(nFormatType & SfxFilterFlags::ALIEN); }
+ /// an unusual/legacy file to be loading
+ bool IsExoticFormat() const { return bool(nFormatType & SfxFilterFlags::EXOTIC); }
+ bool CanImport() const { return bool(nFormatType & SfxFilterFlags::IMPORT); }
+ bool CanExport() const { return bool(nFormatType & SfxFilterFlags::EXPORT); }
+ SfxFilterFlags GetFilterFlags() const { return nFormatType; }
+ const OUString& GetFilterName() const { return maFilterName; }
+ const OUString& GetMimeType() const { return aMimeType; }
+ const OUString& GetName() const { return maFilterName; }
+ const WildCard& GetWildcard() const { return aWildCard; }
+ const OUString& GetRealTypeName() const { return aTypeName; }
+ SotClipboardFormatId GetFormat() const { return lFormat; }
+ const OUString& GetTypeName() const { return aTypeName; }
+ const OUString& GetUIName() const { return aUIName; }
+ const OUString& GetUserData() const { return aUserData; }
+ const OUString& GetDefaultTemplate() const { return aDefaultTemplate; }
+ void SetDefaultTemplate( const OUString& rStr ) { aDefaultTemplate = rStr; }
+ bool UsesStorage() const { return GetFormat() != SotClipboardFormatId::NONE; }
+ void SetUIName( const OUString& rName ) { aUIName = rName; }
+ void SetVersion( sal_Int32 nVersionP ) { nVersion = nVersionP; }
+ sal_Int32 GetVersion() const { return nVersion; }
+ OUString GetSuffixes() const;
+ OUString GetDefaultExtension() const;
+ const OUString& GetServiceName() const { return aServiceName; }
+ const OUString& GetProviderName() const { return maProvider;}
+
+ static std::shared_ptr<const SfxFilter> GetDefaultFilter( std::u16string_view rName );
+ static std::shared_ptr<const SfxFilter> GetFilterByName( const OUString& rName );
+ static std::shared_ptr<const SfxFilter> GetDefaultFilterFromFactory( const OUString& rServiceName );
+
+ static OUString GetTypeFromStorage( const SotStorage& rStg );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ static OUString GetTypeFromStorage(
+ const css::uno::Reference<css::embed::XStorage>& xStorage );
+ bool IsEnabled() const { return mbEnabled; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docinf.hxx b/include/sfx2/docinf.hxx
new file mode 100644
index 000000000..09ecfff6b
--- /dev/null
+++ b/include/sfx2/docinf.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_DOCINF_HXX
+#define INCLUDED_SFX2_DOCINF_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <vcl/errcode.hxx>
+
+
+class GDIMetaFile;
+class SotStorage;
+
+namespace com::sun::star {
+ namespace document {
+ class XDocumentProperties;
+ }
+}
+
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+
+
+namespace sfx2 {
+
+/** load document meta-data from OLE stream
+
+ @param i_xDocProps Document meta-data
+ @param i_pStorage OLE Storage
+ */
+ErrCode SFX2_DLLPUBLIC LoadOlePropertySet(
+ const css::uno::Reference< css::document::XDocumentProperties>& i_xDocProps,
+ SotStorage* i_pStorage );
+
+/** save document meta-data to OLE stream
+
+ @param i_xDocProps Document meta-data
+ @param i_pStorage OLE Storage
+ @param i_pThumb Thumbnail: preview bitmap
+ @param i_pGuid Blob: Guid blob ("_PID_GUID")
+ @param i_pHyperlinks Blob: Hyperlink blob ("_PID_HLINKS")
+ */
+bool SFX2_DLLPUBLIC SaveOlePropertySet(
+ const css::uno::Reference< css::document::XDocumentProperties>& i_xDocProps,
+ SotStorage* i_pStorage,
+ const css::uno::Sequence<sal_Int8> * i_pThumb = nullptr,
+ const css::uno::Sequence<sal_Int8> * i_pGuid = nullptr,
+ const css::uno::Sequence<sal_Int8> * i_pHyperlinks = nullptr);
+
+
+css::uno::Sequence<sal_Int8> SFX2_DLLPUBLIC convertMetaFile(
+ GDIMetaFile const * i_pThumb);
+
+} // namespace sfx2
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docinsert.hxx b/include/sfx2/docinsert.hxx
new file mode 100644
index 000000000..7c4107124
--- /dev/null
+++ b/include/sfx2/docinsert.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_DOCINSERT_HXX
+#define INCLUDED_SFX2_DOCINSERT_HXX
+
+#include <rtl/ustring.hxx>
+#include <sfx2/dllapi.h>
+#include <vcl/errcode.hxx>
+#include <tools/link.hxx>
+#include <memory>
+#include <vector>
+
+namespace sfx2 { class FileDialogHelper; }
+namespace weld { class Window; }
+class SfxItemSet;
+class SfxMedium;
+enum class FileDialogFlags;
+
+typedef ::std::vector< std::unique_ptr<SfxMedium> > SfxMediumList;
+
+namespace sfx2 {
+
+class SFX2_DLLPUBLIC DocumentInserter
+{
+private:
+ weld::Window* m_pParent;
+ OUString m_sDocFactory;
+ OUString m_sFilter;
+ Link<sfx2::FileDialogHelper*,void> m_aDialogClosedLink;
+
+ FileDialogFlags const m_nDlgFlags;
+ ErrCode m_nError;
+
+ std::unique_ptr<sfx2::FileDialogHelper>
+ m_pFileDlg;
+ std::shared_ptr<SfxItemSet> m_xItemSet;
+ std::vector<OUString> m_pURLList;
+
+ DECL_DLLPRIVATE_LINK(DialogClosedHdl, sfx2::FileDialogHelper*, void);
+
+public:
+ enum class Mode {
+ Insert,
+ InsertMulti,
+ Compare,
+ Merge
+ };
+ DocumentInserter(weld::Window* pParent, const OUString& rFactory, const Mode mode = Mode::Insert);
+ ~DocumentInserter();
+
+ void StartExecuteModal( const Link<sfx2::FileDialogHelper*,void>& _rDialogClosedLink );
+ std::unique_ptr<SfxMedium> CreateMedium(char const* pFallbackHack = nullptr);
+ SfxMediumList CreateMediumList();
+};
+
+} // namespace sfx2
+
+#endif // INCLUDED_SFX2_DOCINSERT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/dockwin.hxx b/include/sfx2/dockwin.hxx
new file mode 100644
index 000000000..886f4ae11
--- /dev/null
+++ b/include/sfx2/dockwin.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_DOCKWIN_HXX
+#define INCLUDED_SFX2_DOCKWIN_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <sal/types.h>
+#include <vcl/dockwin.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <sfx2/dllapi.h>
+#include <sfx2/childwin.hxx>
+
+namespace com::sun::star::frame { class XFrame; }
+
+class SfxDockingWindow_Impl;
+enum class SplitWindowItemFlags;
+
+void SfxDockingWindowFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rDockingWindowName );
+bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rDockingWindowName );
+
+class SFX2_DLLPUBLIC SfxDockingWindow : public ResizableDockingWindow
+{
+protected:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Box> m_xContainer;
+
+private:
+ tools::Rectangle aInnerRect;
+ tools::Rectangle aOuterRect;
+ SfxBindings* pBindings;
+ Size aFloatSize;
+ SfxChildWindow* pMgr;
+ std::unique_ptr< SfxDockingWindow_Impl > pImpl;
+
+ SfxDockingWindow(SfxDockingWindow const &) = delete;
+ SfxDockingWindow& operator =(SfxDockingWindow const &) = delete;
+
+protected:
+ SfxChildAlignment CalcAlignment(const Point& rPos, tools::Rectangle& rRect );
+ virtual Size CalcDockingSize(SfxChildAlignment);
+ virtual SfxChildAlignment
+ CheckAlignment(SfxChildAlignment,SfxChildAlignment);
+
+ virtual void Resize() override;
+ virtual bool PrepareToggleFloatingMode() override;
+ virtual void ToggleFloatingMode() override;
+ virtual void StartDocking() override;
+ virtual bool Docking( const Point& rPos, tools::Rectangle& rRect ) override;
+ virtual void EndDocking( const tools::Rectangle& rRect, bool bFloatMode ) override;
+ virtual void Resizing( Size& rSize ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual bool Close() override;
+ virtual void Move() override;
+
+ SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; }
+
+public:
+ SfxDockingWindow( SfxBindings *pBindings,
+ SfxChildWindow *pCW,
+ vcl::Window* pParent,
+ WinBits nWinBits);
+ SfxDockingWindow( SfxBindings *pBindings,
+ SfxChildWindow *pCW,
+ vcl::Window* pParent,
+ const OString& rID, const OUString& rUIXMLDescription );
+ virtual ~SfxDockingWindow() override;
+ virtual void dispose() override;
+
+ void Initialize (SfxChildWinInfo* pInfo);
+ virtual void FillInfo(SfxChildWinInfo&) const;
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+
+ void SetDockingRects(const tools::Rectangle& rOuter, const tools::Rectangle& rInner)
+ { aInnerRect = rInner; aOuterRect = rOuter; }
+ const tools::Rectangle& GetInnerRect() const { return aInnerRect; }
+ const tools::Rectangle& GetOuterRect() const { return aOuterRect; }
+ SfxBindings& GetBindings() const { return *pBindings; }
+ sal_uInt16 GetType() const { return pMgr->GetType(); }
+ SfxChildAlignment GetAlignment() const { return pMgr->GetAlignment(); }
+ void SetAlignment(SfxChildAlignment eAlign) { pMgr->SetAlignment(eAlign); }
+ const Size& GetFloatingSize() const { return aFloatSize; }
+ void SetFloatingSize(const Size& rSize) { aFloatSize=rSize; }
+
+ void SetMinOutputSizePixel( const Size& rSize );
+ const Size& GetMinOutputSizePixel() const;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ DECL_DLLPRIVATE_LINK(TimerHdl, Timer *, void);
+
+ SAL_DLLPRIVATE void Initialize_Impl();
+ SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize );
+ SAL_DLLPRIVATE void Disappear_Impl();
+ SAL_DLLPRIVATE void Reappear_Impl();
+ SAL_DLLPRIVATE bool IsAutoHide_Impl() const;
+ SAL_DLLPRIVATE void AutoShow_Impl();
+ SAL_DLLPRIVATE void ReleaseChildWindow_Impl();
+};
+
+class SfxDockingWrapper final : public SfxChildWindow
+{
+ public:
+ SfxDockingWrapper( vcl::Window* pParent ,
+ sal_uInt16 nId ,
+ SfxBindings* pBindings ,
+ SfxChildWinInfo* pInfo );
+
+ SFX_DECL_CHILDWINDOW(SfxDockingWrapper);
+};
+
+#endif // INCLUDED_SFX2_DOCKWIN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docmacromode.hxx b/include/sfx2/docmacromode.hxx
new file mode 100644
index 000000000..7ed42f6a1
--- /dev/null
+++ b/include/sfx2/docmacromode.hxx
@@ -0,0 +1,307 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_DOCMACROMODE_HXX
+#define INCLUDED_SFX2_DOCMACROMODE_HXX
+
+#include <sfx2/dllapi.h>
+#include <sfx2/signaturestate.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <memory>
+
+namespace com::sun::star::document { class XEmbeddedScripts; }
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::script { class XLibraryContainer; }
+namespace com::sun::star::task { class XInteractionHandler; }
+
+
+namespace sfx2
+{
+
+
+ //= IMacroDocumentAccess
+
+ /** provides access to several settings of a document, which are needed by ->DocumentMacroMode
+ to properly determine the current macro execution mode of this document
+ */
+ class SAL_NO_VTABLE IMacroDocumentAccess
+ {
+ public:
+ /** retrieves the current MacroExecutionMode.
+
+ Usually, this is initialized from the media descriptor used to load the document,
+ respectively the one passed into the document's XModel::attachResource call.
+
+ If no such mode was passed there, document implementations should return
+ MacroExecMode::NEVER_EXECUTE.
+
+ @see css::document::MediaDescriptor::MacroExecutionMode
+ @see css::frame::XComponentLoader::loadComponentFromURL
+ @see css::frame::XModel::attachResource
+
+ @see setCurrentMacroExecMode
+
+ @todo
+ Effectively, this is the MacroExecutionMode of the MediaDescriptor of
+ the document. Thus, this setting could be obtained from the XModel
+ directly. We should introduce a getDocumentModel method here, which
+ can be used for this and other purposes.
+ */
+ virtual sal_Int16
+ getCurrentMacroExecMode() const = 0;
+
+ /** sets the MacroExecutionMode of the document, as calculated by the DocumentMacroMode
+ class.
+
+ Effectively, the existence of this method means that the responsibility
+ to store the current macro execution mode is not with the DocumentMacroMode
+ instance, but with the document instance itself.
+
+ Usually, a document implementation will simply put the macro execution mode
+ into its media descriptor, as returned by XModel::getArgs.
+
+ @see css::document::MediaDescriptor::MacroExecutionMode
+ @see css::frame::XComponentLoader::loadComponentFromURL
+ @see css::frame::XModel::attachResource
+
+ see getCurrentMacroExecMode
+ */
+ virtual void
+ setCurrentMacroExecMode( sal_uInt16 ) = 0;
+
+ /** returns the origin of the document
+
+ This usually is the document's location, or, if the document has been
+ newly created from a template, then the location of the template. Location
+ here means the complete path of the document, including the file name.
+
+ @todo
+ This probably can also be obtained from the XModel, by calling getURL
+ or getLocation. If both are empty, then we need a UNO way to obtain
+ the URL of the underlying template document - if any. If we have this,
+ we could replace this method with a newly introduced method
+ getDocumentModel and some internal code.
+ */
+ virtual OUString
+ getDocumentLocation() const = 0;
+
+ /** checks whether the document's storage contains sub storages with macros or scripts
+
+ A default implementation of this method will simply call DocumentMacroMode::storageHasMacros
+ with the document's root storage. However, there might be document types where this
+ isn't sufficient (e.g. database documents which contain sub documents which can also
+ contain macro/script storages).
+ */
+ virtual bool
+ documentStorageHasMacros() const = 0;
+
+ /** checks whether the document's contained calls to macros or scripts after loading
+
+ */
+ virtual bool
+ macroCallsSeenWhileLoading() const = 0;
+
+ /** provides access to the XEmbeddedScripts interface of the document
+
+ Implementations are allowed to return <NULL/> here if and only if they
+ do not (yet) support embedding scripts.
+
+ @todo
+ can also be replaced with a call to the (to be introduced) getDocumentModel
+ method, and a queryInterface.
+ */
+ virtual css::uno::Reference< css::document::XEmbeddedScripts >
+ getEmbeddedDocumentScripts() const = 0;
+
+ /** returns the state of the signatures for the scripts embedded in the document
+
+ Note: On the medium run, the signature handling of a document should be outsourced
+ into a dedicated class, instead of being hard-wired into the SfxObjectShell. This
+ class could then be used outside the SfxObjectShell (e.g. in Base documents), too.
+ When this happens, this method here becomes should be replaced by a method at this
+ new class.
+
+ @seealso <sfx2/signaturestate.hxx>
+ */
+ virtual SignatureState
+ getScriptingSignatureState() = 0;
+
+ /** allows to detect whether there is a trusted scripting signature
+
+ Note: On the medium run, the signature handling of a document should be outsourced
+ into a dedicated class, instead of being hard-wired into the SfxObjectShell. This
+ class could then be used outside the SfxObjectShell (e.g. in Base documents), too.
+ When this happens, this method here should be replaced by a method at this
+ new class.
+
+ @seealso <sfx2/signaturestate.hxx>
+ */
+ virtual bool
+ hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) = 0;
+
+ protected:
+ ~IMacroDocumentAccess() {}
+ };
+
+
+ //= DocumentMacroMode
+
+ struct DocumentMacroMode_Data;
+
+ /** encapsulates handling the macro mode of a document
+
+ @see css::document::MacroExecMode
+ */
+ class SFX2_DLLPUBLIC DocumentMacroMode
+ {
+ public:
+ /** creates an instance
+
+ @param _rDocumentAccess
+ access to the document which this instance works for. Must live as long as the
+ DocumentMacroMode instance lives, at least
+ */
+ DocumentMacroMode( IMacroDocumentAccess& _rDocumentAccess );
+
+ /** allows macro execution in the document
+
+ Effectively, the macro mode is set to MacroExecMode::ALWAYS_EXECUTE_NO_WARN.
+
+ @return
+ <TRUE/>, always
+ */
+ bool allowMacroExecution();
+
+ /** disallows macro execution in the document
+
+ Effectively, the macro mode is set to MacroExecMode::NEVER_EXECUTE.
+
+ @return
+ <TRUE/>, always
+ */
+ bool disallowMacroExecution();
+
+ /** checks whether the document allows executing contained macros.
+
+ The method transforms the current macro execution mode into either
+ ALWAYS_EXECUTE_NO_WARN or NEVER_EXECUTE, depending on the current value,
+ possible configuration settings, and possible user interaction.
+
+ @param _rxInteraction
+ A handler for interactions which might become necessary.
+ This includes
+ <ul><li>Asking the user for confirmation for macro execution.</li>
+ <li>Telling the user that macro execution is disabled.</li>
+ </ul>
+
+ If the user needs to be asked for macro execution confirmation, and if
+ this parameter is <NULL/>, the most defensive assumptions will be made,
+ effectively disabling macro execution.
+
+ @param bHasValidContentSignature
+ Whether the document content is signed and the signature is valid.
+
+ @return
+ <TRUE/> if and only if macro execution in this document is allowed.
+ */
+ bool adjustMacroMode(
+ const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction,
+ bool bHasValidContentSignature = false
+ );
+
+ /** determines whether macro execution is disallowed
+
+ There's a number of reasons why macro execution could be disallowed:
+ <ul><li>Somebody called ->disallowMacroExecution</li>
+ <li>Macro execution is disabled globally, via the security options</li>
+ <li>Macro execution mode was not defined initially, and the user denied
+ executing macros for this particular document.</li>
+ </ul>
+
+ Note that if this method returns <FALSE/>, then subsequent calls of
+ ->adjustMacroMode can still return <FALSE/>.
+ That is, if the current macro execution mode for the document is not yet known
+ (and in particular <em>not</em> MacroExecMode::NEVER_EXECUTE), then ->isMacroExecutionDisallowed
+ will return <FALSE/>.
+ However, a subsequent call to ->adjustMacroMode can result in the user
+ denying macro execution, in which ->adjustMacroMode will return <FALSE/>,
+ and the next call to isMacroExecutionDisallowed will return <TRUE/>.
+ */
+ bool isMacroExecutionDisallowed() const;
+
+ /** determines whether the document actually has a macros library
+
+ Effectively, this method checks the Basic library container (as returned by
+ IMacroDocumentAccess::getEmbeddedDocumentScripts().getBasicLibraries) for
+ content.
+ */
+ bool hasMacroLibrary() const;
+
+ /** determines whether the given document storage has sub storages containing scripts
+ or macros.
+
+ Effectively, the method checks for the presence of a sub-storage name "Scripts" (where
+ BeanShell-/JavaScript-/Python-Scripts are stored, and a sub storage named "Basic" (where
+ Basic scripts are stored).
+ */
+ static bool storageHasMacros( const css::uno::Reference< css::embed::XStorage >& _rxStorage );
+
+ static bool containerHasBasicMacros( const css::uno::Reference< css::script::XLibraryContainer >& xContainer );
+ /** checks the macro execution mode while loading the document.
+
+ This must be called when the loading is effectively finished, but before any macro action
+ happened.
+
+ The method will disallow macro execution for this document if it is disabled
+ globally (SvtSecurityOptions::IsMacroDisabled). Otherwise, it will check whether
+ the document contains a macro storage or macro libraries. If so, it will
+ properly calculate the MacroExecutionMode by calling adjustMacroMode.
+
+ If the document doesn't contain macros, yet, then the macro execution for this
+ document will be allowed (again: unless disabled globally), since in this case
+ macros which later are newly created by the user should be allowed, of course.
+
+ @return
+ <TRUE/> if and only if macro execution is allowed in the document
+
+ @see isMacroExecutionDisallowed
+ @see IMacroDocumentAccess::documentStorageHasMacros
+ @see IMacroDocumentAccess::macroCallsSeenWhileLoading
+ @see hasMacroLibrary
+ @see IMacroDocumentAccess::checkForBrokenScriptingSignatures
+ */
+ bool
+ checkMacrosOnLoading(
+ const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction,
+ bool bHasValidContentSignature = false
+ );
+
+ private:
+ std::shared_ptr< DocumentMacroMode_Data > m_xData;
+ };
+
+
+} // namespace sfx2
+
+
+#endif // INCLUDED_SFX2_DOCMACROMODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docstoragemodifylistener.hxx b/include/sfx2/docstoragemodifylistener.hxx
new file mode 100644
index 000000000..8530711ca
--- /dev/null
+++ b/include/sfx2/docstoragemodifylistener.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_DOCSTORAGEMODIFYLISTENER_HXX
+#define INCLUDED_SFX2_DOCSTORAGEMODIFYLISTENER_HXX
+
+#include <sfx2/dllapi.h>
+
+#include <com/sun/star/util/XModifyListener.hpp>
+
+#include <cppuhelper/implbase.hxx>
+
+namespace comphelper { class SolarMutex; }
+
+
+namespace sfx2
+{
+
+
+ //= IModifiableDocument
+
+ /** callback for the DocumentStorageModifyListener class
+ */
+ class SAL_NO_VTABLE IModifiableDocument
+ {
+ public:
+ /// indicates the root or a sub storage of the document has been modified
+ virtual void storageIsModified() = 0;
+
+ protected:
+ ~IModifiableDocument() {}
+ };
+
+
+ //= DocumentStorageModifyListener
+
+ class SFX2_DLLPUBLIC DocumentStorageModifyListener final : public cppu::WeakImplHelper<css::util::XModifyListener>
+ {
+ IModifiableDocument* m_pDocument;
+ comphelper::SolarMutex& m_rMutex;
+
+ public:
+ DocumentStorageModifyListener( IModifiableDocument& _rDocument, comphelper::SolarMutex& _rMutex );
+
+ void dispose();
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ private:
+ virtual ~DocumentStorageModifyListener() override;
+
+ DocumentStorageModifyListener( const DocumentStorageModifyListener& ) = delete;
+ DocumentStorageModifyListener& operator=( const DocumentStorageModifyListener& ) = delete;
+ };
+
+
+} // namespace sfx2
+
+
+#endif // INCLUDED_SFX2_DOCSTORAGEMODIFYLISTENER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/doctempl.hxx b/include/sfx2/doctempl.hxx
new file mode 100644
index 000000000..029c8e8b2
--- /dev/null
+++ b/include/sfx2/doctempl.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_DOCTEMPL_HXX
+#define INCLUDED_SFX2_DOCTEMPL_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <sfx2/dllapi.h>
+#include <tools/ref.hxx>
+
+// CLASS -----------------------------------------------------------------
+
+class SfxDocTemplate_Impl;
+
+// class SfxDocumentTemplates --------------------------------------------
+
+class SFX2_DLLPUBLIC SfxDocumentTemplates
+{
+private:
+ tools::SvRef<SfxDocTemplate_Impl> pImp;
+
+ SAL_DLLPRIVATE bool CopyOrMove( sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx,
+ sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx, bool bMove );
+public:
+ SfxDocumentTemplates();
+ SfxDocumentTemplates(const SfxDocumentTemplates &);
+ ~SfxDocumentTemplates();
+
+ const SfxDocumentTemplates &operator=(const SfxDocumentTemplates &);
+
+ void ReInitFromComponent();
+
+ sal_uInt16 GetRegionCount() const;
+ OUString GetRegionName(sal_uInt16 nIdx) const; //dv!
+ OUString GetFullRegionName(sal_uInt16 nIdx) const;
+
+ sal_uInt16 GetCount(sal_uInt16 nRegion) const;
+ OUString GetName(sal_uInt16 nRegion, sal_uInt16 nIdx) const; //dv!
+ OUString GetPath(sal_uInt16 nRegion, sal_uInt16 nIdx) const;
+
+ // Allows to retrieve the target template URL from the UCB
+ OUString GetTemplateTargetURLFromComponent(std::u16string_view aGroupName,
+ std::u16string_view aTitle );
+
+ // Convert a resource string - a template name - to its localised pair
+ // if it exists in sfx2/inc/strings.hxx
+ static OUString ConvertResourceString(const OUString& rString);
+
+ bool Copy(sal_uInt16 nTargetRegion,
+ sal_uInt16 nTargetIdx,
+ sal_uInt16 nSourceRegion,
+ sal_uInt16 nSourceIdx);
+ bool Move(sal_uInt16 nTargetRegion,
+ sal_uInt16 nTargetIdx,
+ sal_uInt16 nSourceRegion,
+ sal_uInt16 nSourceIdx);
+ bool Delete(sal_uInt16 nRegion, sal_uInt16 nIdx);
+ bool InsertDir(const OUString &rText, sal_uInt16 nRegion);
+
+ bool InsertTemplate (sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath);
+
+ /** Change the name of an entry or a directory
+
+ \param rName
+ The new name to set
+ \param nRegion
+ The id of the region to rename or containing the template to rename
+ \param nIdx
+ The id of the template to rename or USHRT_MAX to rename the region.
+
+ \return
+ sal_True if the action could be performed, sal_False otherwise
+
+ */
+ bool SetName(const OUString &rName, sal_uInt16 nRegion, sal_uInt16 nIdx);
+
+ bool CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, std::u16string_view rName) const;
+ bool CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, OUString &rName);
+
+ bool GetFull(
+ std::u16string_view rRegion, std::u16string_view rName, OUString& rPath );
+ bool GetLogicNames( std::u16string_view rPath, OUString& rRegion, OUString& rName ) const;
+
+ /** updates the configuration where the document templates structure is stored.
+
+ <p>The info about the document templates (which files, which groups etc.) is stored in the
+ configuration. This means that just by copying files into OOo's template directories, this
+ change is not reflected in the SfxDocumentTemplates - 'cause the configuration is not synchronous with
+ the file system. This can be enforced with this method.</p>
+ */
+ void Update();
+};
+
+#endif // INCLUDED_SFX2_DOCTEMPL_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/event.hxx b/include/sfx2/event.hxx
new file mode 100644
index 000000000..9f7cd304a
--- /dev/null
+++ b/include/sfx2/event.hxx
@@ -0,0 +1,268 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_EVENT_HXX
+#define INCLUDED_SFX2_EVENT_HXX
+
+#include <sal/config.h>
+
+#include <ostream>
+
+#include <sfx2/dllapi.h>
+#include <svl/hint.hxx>
+#include <unotools/eventcfg.hxx>
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/frame/XController2.hpp>
+#include <com/sun/star/view/PrintableState.hpp>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+
+/**
+ these values get stored in streams in a 16-bit value
+*/
+enum class SvMacroItemId : sal_uInt16 {
+ NONE = 0,
+
+ // used by SwHTMLForm_Impl
+ HtmlOnSubmitForm,
+ HtmlOnResetForm,
+ HtmlOnGetFocus,
+ HtmlOnLoseFocus,
+ HtmlOnClick,
+ HtmlOnClickItem,
+ HtmlOnChange,
+ HtmlOnSelect,
+
+ // used by SwHTMLParser
+ OpenDoc,
+ PrepareCloseDoc,
+ ActivateDoc,
+ DeactivateDoc,
+
+ // Events for Controls etc.
+ OnMouseOver = 5100,
+ OnClick = 5101,
+ OnMouseOut = 5102,
+
+ OnImageLoadDone = 10000,
+ OnImageLoadCancel = 10001,
+ OnImageLoadError = 10002,
+
+ SwObjectSelect = 20000,
+ SwStartInsGlossary = 20001,
+ SwEndInsGlossary = 20002,
+ SwFrmKeyInputAlpha = 20004,
+ SwFrmKeyInputNoAlpha = 20005,
+ SwFrmResize = 20006,
+ SwFrmMove = 20007,
+};
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const SvMacroItemId& id )
+{
+ switch(id)
+ {
+ case SvMacroItemId::NONE: return stream << "NONE";
+ case SvMacroItemId::HtmlOnSubmitForm: return stream << "HtmlOnSubmitForm";
+ case SvMacroItemId::HtmlOnResetForm: return stream << "HtmlOnResetForm";
+ case SvMacroItemId::HtmlOnGetFocus: return stream << "HtmlOnGetFocus";
+ case SvMacroItemId::HtmlOnLoseFocus: return stream << "HtmlOnLoseFocus";
+ case SvMacroItemId::HtmlOnClick: return stream << "HtmlOnClick";
+ case SvMacroItemId::HtmlOnClickItem: return stream << "HtmlOnClickItem";
+ case SvMacroItemId::HtmlOnChange: return stream << "HtmlOnChange";
+ case SvMacroItemId::HtmlOnSelect: return stream << "HtmlOnSelect";
+ case SvMacroItemId::OpenDoc: return stream << "OpenDoc";
+ case SvMacroItemId::PrepareCloseDoc: return stream << "PrepareCloseDoc";
+ case SvMacroItemId::ActivateDoc: return stream << "ActivateDoc";
+ case SvMacroItemId::DeactivateDoc: return stream << "DeactivateDoc";
+ case SvMacroItemId::OnMouseOver: return stream << "OnMouseOver";
+ case SvMacroItemId::OnClick: return stream << "OnClick";
+ case SvMacroItemId::OnMouseOut: return stream << "OnMouseOut";
+ case SvMacroItemId::OnImageLoadDone: return stream << "OnImageLoadDone";
+ case SvMacroItemId::OnImageLoadCancel: return stream << "OnImageLoadCancel";
+ case SvMacroItemId::OnImageLoadError: return stream << "OnImageLoadError";
+ case SvMacroItemId::SwObjectSelect: return stream << "SwObjectSelect";
+ case SvMacroItemId::SwStartInsGlossary: return stream << "SwStartInsGlossary";
+ case SvMacroItemId::SwEndInsGlossary: return stream << "SwEndInsGlossary";
+ case SvMacroItemId::SwFrmKeyInputAlpha: return stream << "SwFrmKeyInputAlpha";
+ case SvMacroItemId::SwFrmKeyInputNoAlpha: return stream << "SwFrmKeyInputNoAlpha";
+ case SvMacroItemId::SwFrmResize: return stream << "SwFrmResize";
+ case SvMacroItemId::SwFrmMove: return stream << "SwFrmMove";
+ default: return stream << "unk(" << std::to_string(int(id)) << ")";
+ }
+}
+
+class SfxObjectShell;
+
+enum class SfxEventHintId {
+ NONE = 0,
+ ActivateDoc,
+ CloseDoc,
+ CloseView,
+ CreateDoc,
+ DeactivateDoc,
+ DocCreated,
+ LoadFinished,
+ ModifyChanged,
+ OpenDoc,
+ PrepareCloseDoc,
+ PrepareCloseView,
+ PrintDoc,
+ SaveAsDoc,
+ SaveAsDocDone,
+ SaveAsDocFailed,
+ SaveDoc,
+ SaveDocDone,
+ SaveDocFailed,
+ SaveToDoc,
+ SaveToDocDone,
+ SaveToDocFailed,
+ StorageChanged,
+ ViewCreated,
+ VisAreaChanged,
+ // SW events
+ SwMailMerge,
+ SwMailMergeEnd,
+ SwEventPageCount,
+ SwEventFieldMerge,
+ SwEventFieldMergeFinished,
+ SwEventLayoutFinished,
+};
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const SfxEventHintId& id )
+{
+ switch(id)
+ {
+ case SfxEventHintId::NONE: return stream << "NONE";
+ case SfxEventHintId::ActivateDoc: return stream << "ActivateDoc";
+ case SfxEventHintId::CloseDoc: return stream << "CloseDoc";
+ case SfxEventHintId::CloseView: return stream << "CloseView";
+ case SfxEventHintId::CreateDoc: return stream << "CreateDoc";
+ case SfxEventHintId::DeactivateDoc: return stream << "DeactivateDoc";
+ case SfxEventHintId::DocCreated: return stream << "DocCreated";
+ case SfxEventHintId::LoadFinished: return stream << "LoadFinished";
+ case SfxEventHintId::ModifyChanged: return stream << "ModifyChanged";
+ case SfxEventHintId::OpenDoc: return stream << "OpenDoc";
+ case SfxEventHintId::PrepareCloseDoc: return stream << "PrepareCloseDoc";
+ case SfxEventHintId::PrepareCloseView: return stream << "PrepareCloseView";
+ case SfxEventHintId::PrintDoc: return stream << "PrintDoc";
+ case SfxEventHintId::SaveAsDoc: return stream << "SaveAsDoc";
+ case SfxEventHintId::SaveAsDocDone: return stream << "SaveAsDocDone";
+ case SfxEventHintId::SaveAsDocFailed: return stream << "SaveAsDocFailed";
+ case SfxEventHintId::SaveDoc: return stream << "SaveDoc";
+ case SfxEventHintId::SaveDocDone: return stream << "SaveDocDone";
+ case SfxEventHintId::SaveDocFailed: return stream << "SaveDocFailed";
+ case SfxEventHintId::SaveToDoc: return stream << "SaveToDoc";
+ case SfxEventHintId::SaveToDocDone: return stream << "SaveToDocDone";
+ case SfxEventHintId::SaveToDocFailed: return stream << "SaveToDocFailed";
+ case SfxEventHintId::StorageChanged: return stream << "StorageChanged";
+ case SfxEventHintId::ViewCreated: return stream << "ViewCreated";
+ case SfxEventHintId::VisAreaChanged: return stream << "VisAreaChanged";
+ case SfxEventHintId::SwMailMerge: return stream << "SwMailMerge";
+ case SfxEventHintId::SwMailMergeEnd: return stream << "SwMailMergeEnd";
+ case SfxEventHintId::SwEventPageCount: return stream << "SwEventPageCount";
+ case SfxEventHintId::SwEventFieldMerge: return stream << "SwEventFieldMerge";
+ case SfxEventHintId::SwEventFieldMergeFinished: return stream << "SwEventFieldMergeFinished";
+ case SfxEventHintId::SwEventLayoutFinished: return stream << "SwEventLayoutFinished";
+ default: return stream << "unk(" << std::to_string(int(id)) << ")";
+ }
+}
+
+class SFX2_DLLPUBLIC SfxEventHint : public SfxHint
+{
+ SfxObjectShell* pObjShell;
+ OUString aEventName;
+ SfxEventHintId nEventId;
+
+public:
+ SfxEventHint( SfxEventHintId nId, const OUString& aName, SfxObjectShell *pObj )
+ : pObjShell(pObj),
+ aEventName(aName),
+ nEventId(nId)
+ {}
+
+ SfxEventHintId GetEventId() const
+ { return nEventId; }
+
+ const OUString& GetEventName() const
+ { return aEventName; }
+
+ SfxObjectShell* GetObjShell() const
+ { return pObjShell; }
+};
+
+
+class SFX2_DLLPUBLIC SfxViewEventHint : public SfxEventHint
+{
+ css::uno::Reference< css::frame::XController2 > xViewController;
+
+public:
+ SfxViewEventHint( SfxEventHintId nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController >& xController )
+ : SfxEventHint( nId, aName, pObj )
+ , xViewController( xController, css::uno::UNO_QUERY )
+ {}
+
+ SfxViewEventHint( SfxEventHintId nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController2 >& xController )
+ : SfxEventHint( nId, aName, pObj )
+ , xViewController( xController )
+ {}
+
+ const css::uno::Reference< css::frame::XController2 >& GetController() const
+ { return xViewController; }
+};
+
+class SfxPrintingHint final : public SfxViewEventHint
+{
+ css::view::PrintableState mnPrintableState;
+ css::uno::Sequence < css::beans::PropertyValue > aOpts;
+public:
+ SfxPrintingHint(
+ css::view::PrintableState nState,
+ const css::uno::Sequence < css::beans::PropertyValue >& rOpts,
+ SfxObjectShell *pObj,
+ const css::uno::Reference< css::frame::XController2 >& xController )
+ : SfxViewEventHint(
+ SfxEventHintId::PrintDoc,
+ GlobalEventConfig::GetEventName( GlobalEventId::PRINTDOC ),
+ pObj,
+ xController )
+ , mnPrintableState( nState )
+ , aOpts( rOpts )
+ {}
+
+ SfxPrintingHint( css::view::PrintableState nState )
+ : SfxViewEventHint(
+ SfxEventHintId::PrintDoc,
+ GlobalEventConfig::GetEventName( GlobalEventId::PRINTDOC ),
+ nullptr,
+ css::uno::Reference< css::frame::XController >() )
+ , mnPrintableState( nState )
+ {}
+
+ css::view::PrintableState GetWhich() const { return mnPrintableState; }
+ const css::uno::Sequence < css::beans::PropertyValue >& GetOptions() const { return aOpts; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/evntconf.hxx b/include/sfx2/evntconf.hxx
new file mode 100644
index 000000000..8720a7330
--- /dev/null
+++ b/include/sfx2/evntconf.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_EVNTCONF_HXX
+#define INCLUDED_SFX2_EVNTCONF_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <sfx2/event.hxx>
+#include <svl/poolitem.hxx>
+#include <memory>
+#include <vector>
+
+class SfxObjectShell;
+class SvxMacro;
+
+struct SFX2_DLLPUBLIC SfxEventName
+{
+ SvMacroItemId mnId;
+ OUString maEventName;
+ OUString maUIName;
+
+ SfxEventName( SvMacroItemId nId,
+ const OUString& rEventName,
+ const OUString& rUIName )
+ : mnId( nId )
+ , maEventName( rEventName )
+ , maUIName( rUIName ) {}
+};
+
+class SFX2_DLLPUBLIC SfxEventNamesList
+{
+private:
+ ::std::vector< SfxEventName > aEventNamesList;
+
+public:
+ SfxEventNamesList() {}
+ SfxEventNamesList( const SfxEventNamesList &rCpy ) { *this = rCpy; }
+ ~SfxEventNamesList();
+ SfxEventNamesList& operator=( const SfxEventNamesList &rCpy );
+
+ size_t size() const { return aEventNamesList.size(); };
+
+ SfxEventName& at( size_t Index ) { return aEventNamesList[ Index ]; }
+ SfxEventName const & at( size_t Index ) const { return aEventNamesList[ Index ]; }
+
+ void push_back( SfxEventName Item ) { aEventNamesList.push_back( std::move(Item) ); }
+};
+
+class SFX2_DLLPUBLIC SfxEventNamesItem final : public SfxPoolItem
+{
+ SfxEventNamesList aEventsList;
+
+public:
+
+ SfxEventNamesItem ( const sal_uInt16 nId ) : SfxPoolItem( nId ) {}
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+ virtual SfxEventNamesItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ const SfxEventNamesList& GetEvents() const { return aEventsList;}
+ void AddEvent( const OUString&, const OUString&, SvMacroItemId );
+};
+
+
+inline constexpr OUStringLiteral PROP_EVENT_TYPE = u"EventType";
+inline constexpr OUStringLiteral PROP_LIBRARY = u"Library";
+inline constexpr OUStringLiteral PROP_SCRIPT = u"Script";
+inline constexpr OUStringLiteral PROP_MACRO_NAME = u"MacroName";
+#define STAR_BASIC "StarBasic"
+
+class SFX2_DLLPUBLIC SfxEventConfiguration
+{
+public:
+ static void ConfigureEvent( const OUString& aName, const SvxMacro&, SfxObjectShell const * pObjSh);
+ static std::unique_ptr<SvxMacro> ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/fcontnr.hxx b/include/sfx2/fcontnr.hxx
new file mode 100644
index 000000000..026f0e1c1
--- /dev/null
+++ b/include/sfx2/fcontnr.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_FCONTNR_HXX
+#define INCLUDED_SFX2_FCONTNR_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <tools/link.hxx>
+#include <comphelper/documentconstants.hxx>
+#include <sot/formats.hxx>
+
+#include <memory>
+
+namespace com::sun::star::beans { struct NamedValue; }
+namespace com::sun::star::container { class XNameAccess; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+class ErrCode;
+class SfxFilter;
+class SfxMedium;
+class SfxFilterContainer_Impl;
+
+
+class SFX2_DLLPUBLIC SfxFilterContainer
+{
+ std::unique_ptr<SfxFilterContainer_Impl> pImpl;
+
+public:
+ SfxFilterContainer( const OUString& rName );
+ ~SfxFilterContainer();
+
+
+ OUString const & GetName() const;
+
+ std::shared_ptr<const SfxFilter> GetAnyFilter( SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ std::shared_ptr<const SfxFilter> GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ std::shared_ptr<const SfxFilter> GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ std::shared_ptr<const SfxFilter> GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+
+ SAL_DLLPRIVATE static void ReadFilters_Impl( bool bUpdate=false );
+ SAL_DLLPRIVATE static void ReadSingleFilter_Impl( const OUString& rName,
+ const css::uno::Reference< css::container::XNameAccess >& xTypeCFG,
+ const css::uno::Reference< css::container::XNameAccess >& xFilterCFG,
+ bool bUpdate );
+ SAL_DLLPRIVATE static std::shared_ptr<const SfxFilter> GetDefaultFilter_Impl( std::u16string_view );
+};
+
+class SfxFilterMatcher_Impl;
+
+class SFX2_DLLPUBLIC SfxFilterMatcher
+{
+ friend class SfxFilterMatcherIter;
+ SfxFilterMatcher_Impl &m_rImpl;
+public:
+ SfxFilterMatcher( const OUString& rFact );
+ SfxFilterMatcher();
+ ~SfxFilterMatcher();
+ SfxFilterMatcher(const SfxFilterMatcher&) = delete;
+ SfxFilterMatcher& operator=( const SfxFilterMatcher& ) = delete;
+
+ SAL_DLLPRIVATE static bool IsFilterInstalled_Impl( const std::shared_ptr<const SfxFilter>& pFilter );
+ DECL_DLLPRIVATE_LINK( MaybeFileHdl_Impl, OUString*, bool );
+
+ ErrCode GuessFilterIgnoringContent( SfxMedium const & rMedium, std::shared_ptr<const SfxFilter>& ) const;
+ ErrCode GuessFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& , SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ ErrCode GuessFilterControlDefaultUI( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>&, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ ErrCode DetectFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& ) const;
+
+ std::shared_ptr<const SfxFilter> GetFilter4Mime( const OUString& rMime, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const;
+ std::shared_ptr<const SfxFilter> GetFilter4ClipBoardId( SotClipboardFormatId nId, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ std::shared_ptr<const SfxFilter> GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ std::shared_ptr<const SfxFilter> GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ std::shared_ptr<const SfxFilter> GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ std::shared_ptr<const SfxFilter> GetFilter4UIName( std::u16string_view rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ std::shared_ptr<const SfxFilter> GetFilterForProps( const css::uno::Sequence < css::beans::NamedValue >& aSeq, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ std::shared_ptr<const SfxFilter> GetAnyFilter( SfxFilterFlags nMustg=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED ) const;
+};
+
+class SFX2_DLLPUBLIC SfxFilterMatcherIter
+
+{
+ SfxFilterFlags nOrMask;
+ SfxFilterFlags nAndMask;
+ sal_uInt16 nCurrent;
+ const SfxFilterMatcher_Impl &m_rMatch;
+
+ SAL_DLLPRIVATE std::shared_ptr<const SfxFilter> Find_Impl();
+
+public:
+ SfxFilterMatcherIter( const SfxFilterMatcher& rMatcher, SfxFilterFlags nMask = SfxFilterFlags::NONE, SfxFilterFlags nNotMask = SFX_FILTER_NOTINSTALLED );
+ SfxFilterMatcherIter(const SfxFilterMatcherIter&) = delete;
+ SfxFilterMatcherIter& operator=( const SfxFilterMatcherIter& ) = delete;
+ std::shared_ptr<const SfxFilter> First();
+ std::shared_ptr<const SfxFilter> Next();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx
new file mode 100644
index 000000000..b0b530398
--- /dev/null
+++ b/include/sfx2/filedlghelper.hxx
@@ -0,0 +1,313 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_FILEDLGHELPER_HXX
+#define INCLUDED_SFX2_FILEDLGHELPER_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <comphelper/documentconstants.hxx>
+#include <tools/link.hxx>
+#include <vcl/errcode.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <memory>
+#include <optional>
+#include <vector>
+
+namespace com::sun::star::ui::dialogs
+{
+ class XFilePicker3;
+ class XFolderPicker2;
+ struct FilePickerEvent;
+ struct DialogClosedEvent;
+}
+namespace com::sun::star::awt { class XWindow; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace weld { class Window; }
+
+class Graphic;
+class SfxFilter;
+class SfxItemSet;
+class SfxAllItemSet;
+
+enum class FileDialogFlags {
+ NONE = 0x00,
+ Insert = 0x01, // turn Open into Insert dialog
+ Export = 0x02, // turn Save into Export dialog
+ SaveACopy = 0x04, // turn Save into Save a Copy dialog
+ MultiSelection = 0x08,
+ Graphic = 0x10, // register graphic formats
+ /// Sign existing PDF.
+ SignPDF = 0x20,
+ InsertCompare = 0x40, /// Special insertion ("Compare" caption)
+ InsertMerge = 0x80, /// Special insertion ("Merge" caption)
+};
+namespace o3tl {
+ template<> struct typed_flags<FileDialogFlags> : is_typed_flags<FileDialogFlags, 0xFF> {};
+}
+
+inline constexpr OUStringLiteral FILEDIALOG_FILTER_ALL = u"*.*";
+
+namespace sfx2 {
+
+class FileDialogHelper_Impl;
+
+class SFX2_DLLPUBLIC FileDialogHelper
+{
+public:
+ // context where the FileDialogHelper is used
+ enum Context
+ {
+ UnknownContext,
+ AcceleratorConfig,
+ AutoRedact,
+ BaseDataSource,
+ BaseSaveAs,
+ BasicExportPackage,
+ BasicExportDialog,
+ BasicExportSource,
+ BasicImportDialog,
+ BasicImportSource,
+ BasicInsertLib,
+ BulletsAddImage,
+ ExtensionManager,
+ CalcDataProvider,
+ CalcDataStream,
+ CalcExport,
+ CalcSaveAs,
+ CalcXMLSource,
+ DrawExport,
+ DrawImpressInsertFile,
+ DrawImpressOpenSound,
+ DrawSaveAs,
+ ExportImage,
+ FormsAddInstance,
+ FormsInsertImage,
+ IconImport,
+ ImpressClickAction,
+ ImpressExport,
+ ImpressPhotoDialog,
+ ImpressSaveAs,
+ LinkClientOLE,
+ LinkClientFile,
+ ImageMap,
+ InsertDoc,
+ InsertImage,
+ InsertMedia,
+ InsertOLE,
+ JavaClassPath,
+ ReportInsertImage,
+ ScreenshotAnnotation,
+ SignatureLine,
+ TemplateImport,
+ WriterCreateAddressList,
+ WriterInsertDoc,
+ WriterInsertImage,
+ WriterInsertScript,
+ WriterExport,
+ WriterImportAutotext,
+ WriterInsertHyperlink,
+ WriterLoadTemplate,
+ WriterMailMerge,
+ WriterMailMergeSaveAs,
+ WriterNewHTMLGlobalDoc,
+ WriterRegisterDataSource,
+ WriterSaveAs,
+ WriterSaveHTML,
+ XMLFilterSettings
+ };
+ static OUString contextToString(Context context);
+
+private:
+ Link<FileDialogHelper*,void> m_aDialogClosedLink;
+ ErrCode m_nError;
+
+ rtl::Reference< FileDialogHelper_Impl > mpImpl;
+
+
+public:
+ FileDialogHelper(sal_Int16 nDialogType,
+ FileDialogFlags nFlags,
+ weld::Window* pPreferredParent);
+
+ FileDialogHelper(sal_Int16 nDialogType,
+ FileDialogFlags nFlags,
+ const OUString& rFactory,
+ SfxFilterFlags nMust,
+ SfxFilterFlags nDont,
+ weld::Window* pPreferredParent);
+
+ FileDialogHelper(sal_Int16 nDialogType,
+ FileDialogFlags nFlags,
+ const OUString& rFactory,
+ sal_Int16 nDialog,
+ SfxFilterFlags nMust,
+ SfxFilterFlags nDont,
+ const OUString& rStandardDir,
+ const css::uno::Sequence< OUString >& rDenyList,
+ weld::Window* pPreferredParent);
+
+ FileDialogHelper(sal_Int16 nDialogType,
+ FileDialogFlags nFlags,
+ const OUString& aFilterUIName,
+ std::u16string_view aExtName,
+ const OUString& rStandardDir,
+ const css::uno::Sequence< OUString >& rDenyList,
+ weld::Window* pPreferredParent);
+
+ virtual ~FileDialogHelper();
+
+ FileDialogHelper& operator=(const FileDialogHelper &) = delete;
+ FileDialogHelper(const FileDialogHelper &) = delete;
+
+ ErrCode Execute();
+ void StartExecuteModal( const Link<FileDialogHelper*,void>& rEndDialogHdl );
+ ErrCode const & GetError() const { return m_nError; }
+ sal_Int16 GetDialogType() const;
+ bool IsPasswordEnabled() const;
+ OUString GetRealFilter() const;
+
+ void SetTitle( const OUString& rNewTitle );
+ OUString GetPath() const;
+
+ /** @deprecated: Don't use this method to retrieve the selected files
+ There are file picker which can provide multiple selected file which belong
+ to different folders. As this method always provides the root folder for all selected
+ files this cannot work.
+ */
+ css::uno::Sequence< OUString > GetMPath() const;
+
+ /** Provides the selected files with full path information */
+ css::uno::Sequence< OUString > GetSelectedFiles() const;
+
+ void AddFilter( const OUString& rFilterName, const OUString& rExtension );
+ void SetCurrentFilter( const OUString& rFilter );
+
+ /** sets an initial display directory/file name
+
+ @deprecated
+ don't use this method. It contains a lot of magic in determining whether the
+ last segment of the given path/URL denotes a file name or a folder, and by
+ definition, it cannot succeed with this magic *all* the time - there will
+ always be scenarios where it fails.
+
+ Use SetDisplayFolder and SetFileName.
+ */
+ void SetDisplayDirectory( const OUString& rPath );
+
+ /** sets a new folder whose content is to be displayed in the file picker
+
+ @param _rURL
+ specifies the URL of the folder whose content is to be displayed.<br/>
+ If the URL doesn't denote a valid (existent and accessible) folder, the
+ request is silently dropped.
+ @throws css::uno::RuntimeException
+ if the invocation of any of the file picker or UCB methods throws a RuntimeException.
+ */
+ void SetDisplayFolder( const OUString& _rURL );
+
+ /** sets an initial file name to display
+
+ This method is usually used in "save-as" contexts, where the application should
+ suggest an initial name for the file to save.
+
+ Calling this method is nearly equivalent to calling <code>GetFilePicker().setDefaultName( _rFileName )</code>,
+ with the following differences:
+ <ul><li>The FileDialogHelper remembers the given file name, and upon execution,
+ strips its extension if the dialog is set up for "automatic file name extension".</li>
+ <li>Exceptions thrown from the <code>XFilePicker3</code> are caught and silenced.</li>
+ </ul>
+ */
+ void SetFileName( const OUString& _rFileName );
+
+ OUString GetCurrentFilter() const;
+ OUString GetDisplayDirectory() const;
+ ErrCode GetGraphic( Graphic& rGraphic ) const;
+
+ const css::uno::Reference < css::ui::dialogs::XFilePicker3 >& GetFilePicker() const;
+
+ // XFilePickerListener methods
+ void FileSelectionChanged();
+ void DirectoryChanged();
+ virtual void ControlStateChanged( const css::ui::dialogs::FilePickerEvent& aEvent );
+ void DialogSizeChanged();
+ static OUString HelpRequested( const css::ui::dialogs::FilePickerEvent& aEvent );
+
+ // XDialogClosedListener methods
+ void DialogClosed( const css::ui::dialogs::DialogClosedEvent& _rEvent );
+
+ /** sets help ids for the controls in the dialog
+ @param _pControlId
+ Pointer to a 0-terminated array of control ids. They must be recruited from the
+ CommonFilePickerElementIds and ExtendedFilePickerElementIds values.
+ @param _pHelpId
+ Pointer to an array of help ids. For each element in _pControlId, there must be
+ a corresponding element herein.
+ */
+ void SetControlHelpIds( const sal_Int16* _pControlId, const char** _pHelpId );
+ void CreateMatcher( const OUString& rName );
+
+ /** sets the context of the dialog and trigger necessary actions e.g. loading config, setting help id
+ This will also store the last used directory for this context, so that the last directory
+ gets preselected on next filepicker launch (with the same context)
+ @param _eNewContext
+ New context for the dialog.
+ */
+ void SetContext( Context _eNewContext );
+
+ DECL_DLLPRIVATE_LINK( ExecuteSystemFilePicker, void*, void );
+
+ ErrCode Execute( std::vector<OUString>& rpURLList,
+ std::optional<SfxAllItemSet>& rpSet,
+ OUString& rFilter,
+ const OUString& rDirPath );
+ ErrCode Execute( std::optional<SfxAllItemSet>& rpSet,
+ OUString& rFilter );
+};
+
+#define SFX2_IMPL_DIALOG_CONFIG 0
+#define SFX2_IMPL_DIALOG_SYSTEM 1
+#define SFX2_IMPL_DIALOG_OOO 2
+#define SFX2_IMPL_DIALOG_REMOTE 3
+
+ErrCode FileOpenDialog_Impl( weld::Window* pParent,
+ sal_Int16 nDialogType,
+ FileDialogFlags nFlags,
+ std::vector<OUString>& rpURLList,
+ OUString& rFilter,
+ std::optional<SfxAllItemSet>& rpSet,
+ const OUString* pPath,
+ sal_Int16 nDialog,
+ const OUString& rStandardDir,
+ const css::uno::Sequence< OUString >& rDenyList = css::uno::Sequence< OUString >());
+
+css::uno::Reference<css::ui::dialogs::XFolderPicker2> SFX2_DLLPUBLIC createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>& rContext, weld::Window* pPreferredParent);
+
+ErrCode RequestPassword(const std::shared_ptr<const SfxFilter>& pCurrentFilter, OUString const & aURL, SfxItemSet* pSet, const css::uno::Reference<css::awt::XWindow>& rParent);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/flatpak.hxx b/include/sfx2/flatpak.hxx
new file mode 100644
index 000000000..cf71475fb
--- /dev/null
+++ b/include/sfx2/flatpak.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_INCLUDE_SFX2_FLATPAK_HXX
+#define INCLUDED_INCLUDE_SFX2_FLATPAK_HXX
+
+#include <sal/config.h>
+
+#include <rtl/ustring.hxx>
+#include <sfx2/dllapi.h>
+
+// Functionality related to the Flatpak version of LibreOffice.
+
+namespace flatpak
+{
+bool isFlatpak();
+
+// Must only be called with SolarMutex locked:
+bool createTemporaryHtmlDirectory(OUString** url);
+
+// Must only be called with SolarMutex locked:
+SFX2_DLLPUBLIC void removeTemporaryHtmlDirectory();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
new file mode 100644
index 000000000..86b5baaa7
--- /dev/null
+++ b/include/sfx2/frame.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_FRAME_HXX
+#define INCLUDED_SFX2_FRAME_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/shell.hxx>
+#include <sal/types.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Any.hxx>
+#include <vcl/vclptr.hxx>
+#include <rtl/ustring.hxx>
+#include <svl/poolitem.hxx>
+#include <tools/ref.hxx>
+#include <memory>
+#include <vector>
+
+
+namespace com::sun::star::frame
+{
+ class XFrame;
+ class XController;
+}
+
+class SvBorder;
+class SfxWorkWindow;
+namespace vcl { class Window; }
+class SfxFrame_Impl;
+class SfxObjectShell;
+class SfxViewFrame;
+class SfxFrameDescriptor;
+namespace tools { class Rectangle; }
+class SystemWindow;
+
+typedef ::std::vector<OUString> TargetList;
+
+
+// SfxFrame is a management class for windows and their content.
+// A SfxApplication represent a hierarchy of SfxFrames, with which the actual
+// content in the derived classes is defined. The base class SfxFrame
+// implements two aspects of frames: naming and control of its lifespan.
+// Inside a frame hierarchy the parent frame always controls the lifespan of
+// its child frames, even though they usually are not even produced by the
+// parent. By calling DoCloser() on any frame in the hierarchy,
+// a part of the "framework" can be removed, where frames unsubscribe
+// from their parent frames.
+
+
+class SFX2_DLLPUBLIC SfxFrame final : public SvCompatWeakBase<SfxFrame>
+{
+ friend class SfxFrameIterator;
+ friend class SfxFrameWindow_Impl;
+
+private:
+ std::unique_ptr< SfxFrame_Impl > pImpl;
+ VclPtr<vcl::Window> pWindow;
+
+ virtual ~SfxFrame();
+
+ SAL_DLLPRIVATE SfxFrame( vcl::Window& i_rContainerWindow );
+
+public:
+ static SfxFrame* Create( const css::uno::Reference< css::frame::XFrame >& xFrame );
+ static css::uno::Reference< css::frame::XFrame >
+ CreateBlankFrame();
+ static SfxFrame* CreateHidden( SfxObjectShell const & rDoc, vcl::Window& rWindow, SfxInterfaceId nViewId );
+
+ vcl::Window& GetWindow() const { return *pWindow;}
+ void CancelTransfers();
+ bool DoClose();
+
+ void SetPresentationMode( bool bSet );
+ SystemWindow* GetSystemWindow() const;
+
+ static SfxFrame* GetFirst();
+ static SfxFrame* GetNext( SfxFrame& );
+
+ SfxObjectShell* GetCurrentDocument() const;
+ SfxViewFrame* GetCurrentViewFrame() const;
+
+ bool GetHasTitle() const;
+ static void GetDefaultTargetList( TargetList& );
+ void UpdateDescriptor( SfxObjectShell const *pDoc );
+ void Resize();
+ const css::uno::Reference< css::frame::XFrame >&
+ GetFrameInterface() const;
+ void Appear();
+ void AppearWithUpdate();
+ css::uno::Reference< css::frame::XController >
+ GetController() const;
+
+ bool IsInPlace() const;
+
+ SAL_DLLPRIVATE void DoClose_Impl();
+ SAL_DLLPRIVATE void SetFrameInterface_Impl( const css::uno::Reference< css::frame::XFrame >& rFrame );
+ SAL_DLLPRIVATE void ReleasingComponent_Impl();
+ SAL_DLLPRIVATE void GetViewData_Impl();
+ SAL_DLLPRIVATE void SetHasTitle( bool );
+ SAL_DLLPRIVATE bool PrepareClose_Impl( bool bUI );
+ SAL_DLLPRIVATE bool DocIsModified_Impl();
+ SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* );
+ bool IsClosing_Impl() const;
+ SAL_DLLPRIVATE void SetIsClosing_Impl();
+
+ // Methods for accessing the current set
+ SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const;
+
+ SAL_DLLPRIVATE bool IsAutoLoadLocked_Impl() const;
+
+ SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame );
+ SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame );
+ SAL_DLLPRIVATE void SetOwnsBindings_Impl( bool bSet );
+ SAL_DLLPRIVATE bool OwnsBindings_Impl() const;
+ SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const;
+ SAL_DLLPRIVATE void SetToolSpaceBorderPixel_Impl( const SvBorder& );
+ SAL_DLLPRIVATE tools::Rectangle GetTopOuterRectPixel_Impl() const;
+ SAL_DLLPRIVATE void CreateWorkWindow_Impl();
+ SAL_DLLPRIVATE void GrabFocusOnComponent_Impl();
+
+ SAL_DLLPRIVATE void PrepareForDoc_Impl( const SfxObjectShell& i_rDoc );
+ SAL_DLLPRIVATE void LockResize_Impl( bool bLock );
+ SAL_DLLPRIVATE void SetMenuBarOn_Impl( bool bOn );
+ SAL_DLLPRIVATE bool IsMenuBarOn_Impl() const;
+ SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const;
+ SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const;
+private:
+ SAL_DLLPRIVATE void Construct_Impl();
+};
+
+typedef SvCompatWeakRef<SfxFrame> SfxFrameWeakRef;
+
+class SFX2_DLLPUBLIC SfxFrameItem final : public SfxPoolItem
+{
+ SfxFrame* pFrame;
+ SfxFrameWeakRef wFrame;
+
+public:
+
+ SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame const *p );
+ SfxFrameItem( SfxFrame *p );
+ SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p );
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxFrameItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ SfxFrame* GetFrame() const { return wFrame; }
+};
+
+class SFX2_DLLPUBLIC SfxUnoAnyItem final : public SfxPoolItem
+{
+ css::uno::Any aValue;
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxUnoAnyItem( sal_uInt16 nWhich, const css::uno::Any& rAny );
+ const css::uno::Any& GetValue() const
+ { return aValue; }
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxUnoAnyItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+class SFX2_DLLPUBLIC SfxUnoFrameItem final : public SfxPoolItem
+{
+ css::uno::Reference< css::frame::XFrame >
+ m_xFrame;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxUnoFrameItem();
+ SfxUnoFrameItem( sal_uInt16 nWhich, const css::uno::Reference< css::frame::XFrame >& i_rFrame );
+ const css::uno::Reference< css::frame::XFrame >&
+ GetFrame() const
+ { return m_xFrame; }
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxUnoFrameItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/frmdescr.hxx b/include/sfx2/frmdescr.hxx
new file mode 100644
index 000000000..67c0c7e38
--- /dev/null
+++ b/include/sfx2/frmdescr.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_FRMDESCR_HXX
+#define INCLUDED_SFX2_FRMDESCR_HXX
+
+#include <memory>
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <tools/gen.hxx>
+#include <tools/urlobj.hxx>
+
+// The SfxFrame descriptors build a recursive structure, that covers all the
+// required data in-order to display the frame document.
+// Through a SfxFrameSetDescriptor access is given to the whole underlying
+// structure. Due to the nature of the SfxFrames document, the
+// SfxFramesSetDescriptor is not only the content of this document, but also
+// describes the view on it. The FrameSet is made up of lines, which in turn,
+// contains the actual window . A line can be horizontally or vertically
+// aligned, from which also the alignment of the FrameSet is given.
+
+
+enum class ScrollingMode
+{
+ Yes,
+ No,
+ Auto
+};
+
+#define SIZE_NOT_SET -1L
+
+class SfxItemSet;
+
+class SFX2_DLLPUBLIC SfxFrameDescriptor
+{
+ INetURLObject aURL;
+ OUString aName;
+ Size aMargin;
+ ScrollingMode eScroll;
+ bool bHasBorder;
+ bool bHasBorderSet;
+ std::unique_ptr<SfxItemSet> m_pArgs;
+
+public:
+ SfxFrameDescriptor();
+ ~SfxFrameDescriptor();
+
+ // FileName/URL
+ SfxItemSet* GetArgs();
+ const INetURLObject& GetURL() const
+ { return aURL; }
+ void SetURL( std::u16string_view rURL );
+ void SetActualURL();
+
+ // FrameName
+ const OUString& GetName() const
+ { return aName; }
+ void SetName( const OUString& rName )
+ { aName = rName; }
+
+ // Margin, Scrolling
+ const Size& GetMargin() const
+ { return aMargin; }
+ void SetMargin( const Size& rMargin )
+ { aMargin = rMargin; }
+ ScrollingMode GetScrollingMode() const
+ { return eScroll; }
+ void SetScrollingMode( ScrollingMode eMode )
+ { eScroll = eMode; }
+
+ // FrameBorder
+ bool HasFrameBorder() const
+ { return bHasBorder; }
+ bool IsFrameBorderOn() const
+ { return bHasBorder; }
+ void SetFrameBorder( bool bBorder )
+ { bHasBorder = bBorder; bHasBorderSet = true; }
+ bool IsFrameBorderSet() const
+ { return bHasBorderSet; }
+ void ResetBorder()
+ { bHasBorder = false; bHasBorderSet = false; }
+};
+
+#endif // INCLUDED_SFX2_FRMDESCR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/frmhtml.hxx b/include/sfx2/frmhtml.hxx
new file mode 100644
index 000000000..205c320fe
--- /dev/null
+++ b/include/sfx2/frmhtml.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_FRMHTML_HXX
+#define INCLUDED_SFX2_FRMHTML_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+
+#include <svtools/parhtml.hxx>
+
+class SfxFrameDescriptor;
+
+namespace SfxFrameHTMLParser
+{
+// These methods can also be used by other parsers.
+SFX2_DLLPUBLIC void ParseFrameOptions(SfxFrameDescriptor*, const HTMLOptions&, std::u16string_view);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/frmhtmlw.hxx b/include/sfx2/frmhtmlw.hxx
new file mode 100644
index 000000000..1011327c2
--- /dev/null
+++ b/include/sfx2/frmhtmlw.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_FRMHTMLW_HXX
+#define INCLUDED_SFX2_FRMHTMLW_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+class SvStream;
+
+namespace com::sun::star {
+ namespace document {
+ class XDocumentProperties;
+ }
+}
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+
+class SFX2_DLLPUBLIC SfxFrameHTMLWriter
+{
+ SAL_DLLPRIVATE static void OutMeta( SvStream& rStrm,
+ const char *pIndent, const OUString& rName,
+ const OUString& rContent, bool bHTTPEquiv,
+ OUString *pNonConvertableChars = nullptr );
+ SAL_DLLPRIVATE inline static void OutMeta( SvStream& rStrm,
+ const char *pIndent, const char *pName,
+ const OUString& rContent, bool bHTTPEquiv,
+ OUString *pNonConvertableChars = nullptr );
+
+public:
+ static void Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL,
+ const css::uno::Reference< css::document::XDocumentProperties>&,
+ const char *pIndent,
+ OUString *pNonConvertableChars = nullptr );
+
+ static void Out_FrameDescriptor(
+ SvStream&, const OUString& rBaseURL, const css::uno::Reference < css::beans::XPropertySet >& xSet,
+ OUString *pNonConvertableChars = nullptr );
+};
+
+inline void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm,
+ const char *pIndent, const char *pName,
+ const OUString& rContent, bool bHTTPEquiv,
+ OUString *pNonConvertableChars )
+{
+ OUString sTmp = OUString::createFromAscii(pName);
+ OutMeta( rStrm, pIndent, sTmp, rContent, bHTTPEquiv, pNonConvertableChars );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/groupid.hxx b/include/sfx2/groupid.hxx
new file mode 100644
index 000000000..fd31785ae
--- /dev/null
+++ b/include/sfx2/groupid.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_GROUPID_HXX
+#define INCLUDED_SFX2_GROUPID_HXX
+
+#include <sal/types.h>
+
+#include <functional>
+
+// !! If you add a new group, please change sfxbasecontroller.cxx and
+// !! com.sun.star.frame.CommandGroup accordingly!
+
+enum class SfxGroupId
+{
+ NONE = 0,
+ Intern = 32700,
+ Application,
+ Document,
+ View,
+ Edit,
+ Macro,
+ Options,
+ Math,
+ Navigator,
+ Insert,
+ Format,
+ Template,
+ Text,
+ Frame,
+ Graphic,
+ Table,
+ Enumeration,
+ Data,
+ Special,
+ Image,
+ Chart,
+ Explorer,
+ Connector,
+ Modify,
+ Drawing,
+ Controls
+};
+
+// make it hashable for storing in maps
+namespace std
+{
+template <> struct hash<SfxGroupId>
+{
+ std::size_t operator()(const SfxGroupId& k) const
+ {
+ return std::hash<sal_uInt16>()(static_cast<sal_uInt16>(k));
+ }
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/htmlmode.hxx b/include/sfx2/htmlmode.hxx
new file mode 100644
index 000000000..cd2b7d1fe
--- /dev/null
+++ b/include/sfx2/htmlmode.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_HTMLMODE_HXX
+#define INCLUDED_SFX2_HTMLMODE_HXX
+
+enum
+{
+ HTMLMODE_ON = 0x0001,
+ HTMLMODE_SOME_STYLES = 0x0020, /* mind. MS IE */
+ HTMLMODE_FULL_STYLES = 0x0040 /* == SW */
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/infobar.hxx b/include/sfx2/infobar.hxx
new file mode 100644
index 000000000..f5b948014
--- /dev/null
+++ b/include/sfx2/infobar.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_SFX2_INFOBAR_HXX
+#define INCLUDED_SFX2_INFOBAR_HXX
+
+#include <vector>
+
+#include <basegfx/color/bcolor.hxx>
+
+#include <sfx2/childwin.hxx>
+#include <sfx2/dllapi.h>
+#include <vcl/InterimItemWindow.hxx>
+
+// These must match the values in offapi/com/sun/star/frame/InfobarType.idl
+enum class InfobarType
+{
+ INFO = 0,
+ SUCCESS = 1,
+ WARNING = 2,
+ DANGER = 3
+};
+
+class InfobarData
+{
+public:
+ OUString msId;
+ OUString msPrimaryMessage;
+ OUString msSecondaryMessage;
+ InfobarType maInfobarType;
+ bool mbShowCloseButton;
+};
+
+/** SfxChildWindow for positioning the InfoBar in the view.
+ */
+class SFX2_DLLPUBLIC SfxInfoBarContainerChild final : public SfxChildWindow
+{
+private:
+ SfxBindings* m_pBindings;
+
+public:
+ SfxInfoBarContainerChild(vcl::Window* pParent, sal_uInt16 nId, SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo);
+ virtual ~SfxInfoBarContainerChild() override;
+
+ SFX_DECL_CHILDWINDOW_WITHID(SfxInfoBarContainerChild);
+
+ void Update();
+};
+
+class ExtraButton;
+
+/** Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow.
+ */
+class SFX2_DLLPUBLIC SfxInfoBarWindow final : public InterimItemWindow
+{
+private:
+ OUString m_sId;
+ InfobarType m_eType;
+ Size m_aMessageSize;
+ Size m_aOrigMessageSize;
+ bool m_bLayingOut;
+ std::unique_ptr<weld::Image> m_xImage;
+ std::unique_ptr<weld::Label> m_xPrimaryMessage;
+ std::unique_ptr<weld::TextView> m_xSecondaryMessage;
+ std::unique_ptr<weld::Container> m_xButtonBox;
+ std::unique_ptr<weld::Toolbar> m_xCloseBtn;
+ std::vector<std::unique_ptr<ExtraButton>> m_aActionBtns;
+
+ DECL_DLLPRIVATE_LINK(SizeAllocHdl, const Size&, void);
+
+ void SetForeAndBackgroundColors(InfobarType eType);
+ void SetCloseButtonImage();
+
+public:
+ SfxInfoBarWindow(vcl::Window* parent, const OUString& sId, const OUString& sPrimaryMessage,
+ const OUString& sSecondaryMessage, InfobarType InfobarType,
+ bool bShowCloseButton);
+ Size DoLayout();
+ virtual void Layout() override;
+ virtual ~SfxInfoBarWindow() override;
+ virtual void dispose() override;
+
+ const OUString& getId() const { return m_sId; }
+ void Update(const OUString& sPrimaryMessage, const OUString& sSecondaryMessage,
+ InfobarType eType);
+ basegfx::BColor m_aBackgroundColor;
+ basegfx::BColor m_aForegroundColor;
+
+ /** Add button to Infobar.
+ * Infobar takes ownership of the button so the button is
+ * destroyed when the infobar gets destroyed.
+ *
+ * The optional "pCommand" is used by extensions, via XInfobarProvider, to
+ * dispatch pCommand on click.
+ */
+ weld::Button& addButton(const OUString* pCommand = nullptr);
+
+ void SetCommandHandler(weld::Button& rBtn, const OUString& aCommand);
+
+private:
+ DECL_DLLPRIVATE_LINK(CloseHandler, const OString&, void);
+};
+
+class SfxInfoBarContainerWindow final : public vcl::Window
+{
+private:
+ SfxInfoBarContainerChild* m_pChildWin;
+ std::vector<VclPtr<SfxInfoBarWindow>> m_pInfoBars;
+ Idle m_aLayoutIdle;
+ bool m_bResizing;
+
+ DECL_LINK(DoUpdateLayout, Timer*, void);
+
+public:
+ SfxInfoBarContainerWindow(SfxInfoBarContainerChild* pChildWin);
+ virtual ~SfxInfoBarContainerWindow() override;
+ virtual void dispose() override;
+
+ VclPtr<SfxInfoBarWindow> appendInfoBar(const OUString& sId, const OUString& sPrimaryMessage,
+ const OUString& sSecondaryMessage, InfobarType ibType,
+ bool bShowCloseButton);
+ VclPtr<SfxInfoBarWindow> getInfoBar(std::u16string_view sId);
+ bool hasInfoBarWithID(std::u16string_view sId);
+ void removeInfoBar(VclPtr<SfxInfoBarWindow> const& pInfoBar);
+ static bool isInfobarEnabled(std::u16string_view sId);
+
+ void TriggerUpdateLayout();
+
+ virtual void Resize() override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/inputdlg.hxx b/include/sfx2/inputdlg.hxx
new file mode 100644
index 000000000..840844d18
--- /dev/null
+++ b/include/sfx2/inputdlg.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX
+#define INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX
+
+#include <sfx2/dllapi.h>
+#include <vcl/weld.hxx>
+
+class SFX2_DLLPUBLIC InputDialog final : public weld::GenericDialogController
+{
+private:
+ std::unique_ptr<weld::Entry> m_xEntry;
+ std::unique_ptr<weld::Label> m_xLabel;
+ std::unique_ptr<weld::Button> m_xHelp;
+ std::unique_ptr<weld::Button> m_xOk;
+ std::function<bool(OUString)> mCheckEntry;
+ DECL_DLLPRIVATE_LINK(EntryChangedHdl, weld::Entry&, void);
+
+public:
+ InputDialog(weld::Widget* pParent, const OUString& rLabelText);
+ OUString GetEntryText() const;
+ void SetEntryText(const OUString& rStr);
+ void HideHelpBtn();
+ void SetEntryMessageType(weld::EntryMessageType aType);
+ void SetTooltip(const OUString& rStr);
+ void setCheckEntry(std::function<bool(OUString)> aFunc);
+};
+
+#endif // INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/ipclient.hxx b/include/sfx2/ipclient.hxx
new file mode 100644
index 000000000..6eddf9e9f
--- /dev/null
+++ b/include/sfx2/ipclient.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_IPCLIENT_HXX
+#define INCLUDED_SFX2_IPCLIENT_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <rtl/ref.hxx>
+
+#include <tools/gen.hxx>
+
+#include <vcl/errcode.hxx>
+#include <vcl/vclptr.hxx>
+
+namespace com::sun::star::embed { class XEmbeddedObject; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace vcl { class Window; }
+
+class SfxInPlaceClient_Impl;
+class SfxViewShell;
+class SfxObjectShell;
+class Fraction;
+
+
+class SFX2_DLLPUBLIC SfxInPlaceClient
+{
+friend class SfxInPlaceClient_Impl;
+
+ rtl::Reference<SfxInPlaceClient_Impl> m_xImp;
+ SfxViewShell* m_pViewSh;
+ VclPtr<vcl::Window> m_pEditWin;
+
+ // called after the requested new object area was negotiated
+ SAL_DLLPRIVATE virtual void ObjectAreaChanged();
+
+ // an active object was resized by the user and now asks for the new space
+ SAL_DLLPRIVATE virtual void RequestNewObjectArea( tools::Rectangle& );
+
+ // notify the client that an active object has changed its VisualAreaSize
+ SAL_DLLPRIVATE virtual void ViewChanged();
+
+public:
+ SfxInPlaceClient( SfxViewShell* pViewShell, vcl::Window* pDraw, sal_Int64 nAspect );
+ virtual ~SfxInPlaceClient();
+
+ SfxInPlaceClient(const SfxInPlaceClient &) = delete;
+ SfxInPlaceClient& operator=(const SfxInPlaceClient &) = delete;
+
+ SfxViewShell* GetViewShell() const { return m_pViewSh; }
+ vcl::Window* GetEditWin() const { return m_pEditWin; }
+ const css::uno::Reference < css::embed::XEmbeddedObject >& GetObject() const;
+ void SetObject( const css::uno::Reference < css::embed::XEmbeddedObject >& rObject );
+ void SetObjectState( sal_Int32 );
+ bool IsObjectUIActive() const;
+ bool IsObjectInPlaceActive() const;
+ void DeactivateObject();
+ bool SetObjArea( const tools::Rectangle & );
+ const tools::Rectangle& GetObjArea() const;
+ tools::Rectangle GetScaledObjArea() const;
+ void SetSizeScale( const Fraction & rScaleWidth, const Fraction & rScaleHeight );
+ void SetObjAreaAndScale( const tools::Rectangle&, const Fraction&, const Fraction& );
+ const Fraction& GetScaleWidth() const;
+ const Fraction& GetScaleHeight() const;
+ void Invalidate();
+ static SfxInPlaceClient* GetClient( SfxObjectShell const * pDoc, const css::uno::Reference < css::embed::XEmbeddedObject >& xObject );
+ sal_Int64 GetAspect() const;
+ sal_Int64 GetObjectMiscStatus() const;
+ ErrCode DoVerb(sal_Int32 nVerb);
+ void VisAreaChanged();
+ void ResetObject();
+ bool IsUIActive() const;
+
+ /// To indicate that negated document X coordinates are used
+ void SetNegativeX(bool bSet);
+ bool IsNegativeX() const;
+
+ virtual void FormatChanged(); // object format was changed (used for StarMath formulas aligning)
+
+ virtual bool IsProtected() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/linkmgr.hxx b/include/sfx2/linkmgr.hxx
new file mode 100644
index 000000000..e4f58a996
--- /dev/null
+++ b/include/sfx2/linkmgr.hxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_LINKMGR_HXX
+#define INCLUDED_SFX2_LINKMGR_HXX
+
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/linksrc.hxx>
+#include <sfx2/lnkbase.hxx>
+#include <o3tl/sorted_vector.hxx>
+
+#include <string_view>
+#include <vector>
+
+class SfxObjectShell;
+class Graphic;
+
+namespace com::sun::star {
+ namespace lang {
+ class XComponent;
+ }
+}
+
+namespace weld { class Window; }
+
+namespace sfx2
+{
+ // For the link to receive information about the status of graphics that
+ // will be loaded the FileObject sends a SvData, which contains the
+ // FormatID "RegisterStatusInfoId" and a string as the data container.
+ // This contains the following enum.
+
+typedef std::vector<tools::SvRef<SvBaseLink> > SvBaseLinks;
+
+typedef o3tl::sorted_vector<SvLinkSource*> SvLinkSources;
+
+class SFX2_DLLPUBLIC LinkManager
+{
+ typedef ::std::vector< css::uno::Reference< css::lang::XComponent > >
+ CompVector;
+ CompVector maCachedComps;
+
+ SvBaseLinks aLinkTbl;
+ SvLinkSources aServerTbl;
+
+ SfxObjectShell *pPersist; // LinkMgr must be release before SfxObjectShell
+
+ bool InsertLink( SvBaseLink* pLink, SvBaseLinkObjectType nObjType, SfxLinkUpdateMode nUpdateType,
+ const OUString* pName );
+public:
+
+ enum LinkState
+ {
+ STATE_LOAD_OK,
+ STATE_LOAD_ERROR,
+ STATE_LOAD_ABORT
+ };
+
+ LinkManager( SfxObjectShell * pCacheCont );
+ ~LinkManager();
+
+ /**
+ * Insert a component loaded during link update, which needs to be closed
+ * when the update is complete.
+ *
+ * @param xComp component loaded during link update.
+ */
+ void InsertCachedComp(const css::uno::Reference< css::lang::XComponent >& xComp);
+
+ void CloseCachedComps();
+
+ SfxObjectShell* GetPersist() const { return pPersist; }
+ void SetPersist( SfxObjectShell * p ) { pPersist = p; }
+
+ void Remove( SvBaseLink const *pLink );
+ void Remove( size_t nPos, size_t nCnt = 1 );
+ bool Insert( SvBaseLink* pLink );
+
+ // the links connect to a SvLinkSource and adds to the list
+ void InsertDDELink( SvBaseLink*,
+ const OUString& rServer,
+ std::u16string_view rTopic,
+ std::u16string_view rItem );
+
+ // if everything is already set at the link!
+ void InsertDDELink( SvBaseLink* );
+
+ // Connect the links to a pseudo-object and add to the list
+ void InsertFileLink( sfx2::SvBaseLink&,
+ SvBaseLinkObjectType nFileType,
+ std::u16string_view rFileNm,
+ const OUString* pFilterNm = nullptr,
+ const OUString* pRange = nullptr );
+
+ void ReconnectDdeLink(SfxObjectShell& rServer);
+
+ /**
+ * Reconnect the server document shell to a DDE link object.
+ *
+ * @param rPath path to the server document
+ * @param rServer server document shell instance
+ * @param rLink link object of the client document
+ */
+ static void LinkServerShell(const OUString& rPath, SfxObjectShell& rServer, ::sfx2::SvBaseLink& rLink);
+
+ // Obtain the string for the dialog
+ static bool GetDisplayNames( const SvBaseLink *,
+ OUString* pType,
+ OUString* pFile = nullptr,
+ OUString* pLink = nullptr,
+ OUString* pFilter = nullptr );
+
+ static SvLinkSourceRef CreateObj( SvBaseLink const * );
+
+ void UpdateAllLinks(bool bAskUpdate,
+ bool bUpdateGrfLinks,
+ weld::Window* pParentWin);
+
+ // Call for list of links (eg for link-dialog)
+ const SvBaseLinks& GetLinks() const { return aLinkTbl; }
+
+ // ----------------- Server-side management --------------------
+
+ // Call with list of links to server
+ const SvLinkSources& GetServers() const { return aServerTbl; }
+ // Link register/delete
+ bool InsertServer( SvLinkSource* rObj );
+ void RemoveServer( SvLinkSource* rObj );
+
+ // A transfer is aborted, so cancel all download media
+ // (for the time being this is only of interest for the FileLinks!)
+ void CancelTransfers();
+
+ // To send status information from the FileObject to the Baselink,
+ // for this there exist a separate ClipBoardId. The SvData-object has
+ // got the appropriate information as a string.
+ // Is now required for FileObject in conjunction with JavaScript
+ // this needs information about Load/Abort/Error
+ static SotClipboardFormatId RegisterStatusInfoId();
+
+ // if the mimetype says graphic/bitmap/gdimetafile then get the
+ // graphic from the Any. Return says no errors
+ bool GetGraphicFromAny(const OUString& rMimeType,
+ const css::uno::Any & rValue,
+ Graphic& rGrf,
+ weld::Window* pParentWin);
+
+private:
+ LinkManager( const LinkManager& ) = delete;
+ LinkManager& operator=( const LinkManager& ) = delete;
+};
+
+// Separator in the link name for the DDE-/File-/Graphics- links
+// (only those who need to construct a SvLinkName)
+const sal_Unicode cTokenSeparator = 0xFFFF;
+
+// create a string for the SvLinkName. For:
+// - DDE the first 3 Strings, (Server, Topic, Item)
+// - File-/Graphics-LinkNames the last 3 Strings (FileName, Region, Filter)
+SFX2_DLLPUBLIC void MakeLnkName( OUString& rName,
+ const OUString* pType, // Can also be null!!
+ std::u16string_view rFile,
+ std::u16string_view rLink,
+ const OUString* pFilter = nullptr );
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/linksrc.hxx b/include/sfx2/linksrc.hxx
new file mode 100644
index 000000000..4f12d72f4
--- /dev/null
+++ b/include/sfx2/linksrc.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_LINKSRC_HXX
+#define INCLUDED_SFX2_LINKSRC_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+
+#include <tools/ref.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <memory>
+
+namespace com::sun::star::uno
+{
+ class Any;
+}
+namespace weld { class Window; }
+
+template <typename Arg, typename Ret> class Link;
+namespace com::sun::star::io { class XInputStream; }
+
+#ifndef ADVISEMODE_NODATA
+// Must be the same value as Ole2 ADVF_*
+#define ADVISEMODE_NODATA 0x01
+#define ADVISEMODE_PRIMEFIRST 0x02
+#define ADVISEMODE_ONLYONCE 0x04
+#define ADVISEMODE_DATAONSTOP 0x40
+#endif
+
+namespace sfx2
+{
+
+class SvBaseLink;
+struct SvLinkSource_Impl;
+
+class SFX2_DLLPUBLIC SvLinkSource : public SvRefBase
+{
+private:
+ std::unique_ptr<SvLinkSource_Impl> pImpl; // compatible area
+
+public:
+
+ SvLinkSource();
+ virtual ~SvLinkSource() override;
+
+ bool HasDataLinks() const;
+
+ void Closed();
+
+ sal_uInt64 GetUpdateTimeout() const;
+ void SetUpdateTimeout( sal_uInt64 nTimeMs );
+ // notify the sink, the mime type is not
+ // a selection criterion
+ void DataChanged( const OUString & rMimeType,
+ const css::uno::Any & rVal );
+ void SendDataChanged();
+ void NotifyDataChanged();
+
+ virtual bool Connect( SvBaseLink* );
+ virtual bool GetData( css::uno::Any & rData /*out param*/,
+ const OUString & rMimeType,
+ bool bSynchron = false );
+
+ // sal_True => waitinmg for data
+ virtual bool IsPending() const;
+ // sal_True => data complete loaded
+ virtual bool IsDataComplete() const;
+
+ virtual void Edit(weld::Window *, SvBaseLink *, const Link<const OUString&, void>& rEndEditHdl);
+
+
+ void AddDataAdvise( SvBaseLink *, const OUString & rMimeType,
+ sal_uInt16 nAdviceMode );
+ void RemoveAllDataAdvise( SvBaseLink const * );
+
+ void AddConnectAdvise( SvBaseLink * );
+ void RemoveConnectAdvise( SvBaseLink const * );
+
+ struct StreamToLoadFrom{
+ StreamToLoadFrom(
+ const css::uno::Reference<css::io::XInputStream>& xInputStream, bool bIsReadOnly )
+ :m_xInputStreamToLoadFrom(xInputStream),
+ m_bIsReadOnly(bIsReadOnly)
+ {
+ }
+
+ css::uno::Reference<css::io::XInputStream>
+ m_xInputStreamToLoadFrom;
+ bool m_bIsReadOnly;
+ };
+
+ StreamToLoadFrom getStreamToLoadFrom();
+ void setStreamToLoadFrom(const css::uno::Reference<css::io::XInputStream>& xInputStream, bool bIsReadOnly );
+ void clearStreamToLoadFrom();
+};
+
+typedef tools::SvRef<SvLinkSource> SvLinkSourceRef;
+
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/listview.hxx b/include/sfx2/listview.hxx
new file mode 100644
index 000000000..fbcdd0cbd
--- /dev/null
+++ b/include/sfx2/listview.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+
+enum TemplateViewMode
+{
+ eListView,
+ eThumbnailView
+};
+class SfxDocumentTemplates;
+class TemplateContainerItem;
+struct ListViewItem;
+
+class ListView
+{
+public:
+ ListView(std::unique_ptr<weld::TreeView> xTreeView);
+ ~ListView();
+
+ void AppendItem(const OUString& rId, const OUString& rTitle, const OUString& rSubtitle,
+ const OUString& rPath, bool bDefault);
+
+ void AppendRow(const OUString& rImage, const OUString& rTitle, const OUString& rSubtitle,
+ const OUString& rApplication, const OUString& rModify, const OUString& rSize,
+ const OUString& rId);
+
+ void UpdateRow(int nIndex, const OUString& rImage, const OUString& rTitle,
+ const OUString& rSubtitle, const OUString& rApplication, const OUString& rModify,
+ const OUString& rSize, const OUString& rId);
+
+ void ReloadRows();
+
+ bool UpdateRows();
+
+ void sortColumn(const int col);
+
+ void sort();
+
+ void clearListView();
+
+ void ShowListView() { mxTreeView->show(); }
+
+ void HideListView() { mxTreeView->hide(); }
+
+ void unselect_all() { mxTreeView->unselect_all(); }
+
+ void grab_focus() { mxTreeView->grab_focus(); }
+
+ void rename(const OUString& rId, const OUString& rTitle);
+
+ void refreshDefaultColumn();
+
+protected:
+ sal_uInt16 get_nId(int pos) const;
+
+ void select_id(const OUString& sId) { mxTreeView->select_id(sId); }
+
+ int get_selected_index() const { return mxTreeView->get_selected_index(); }
+
+ std::vector<int> get_selected_rows() const { return mxTreeView->get_selected_rows(); }
+
+ bool IsListViewVisible() const { return mxTreeView->is_visible(); }
+
+ OUString get_id(int pos) const { return mxTreeView->get_id(pos); }
+
+ void set_cursor(int pos) { mxTreeView->set_cursor(pos); }
+
+ int get_cursor_index() const { return mxTreeView->get_cursor_index(); }
+
+ sal_uInt16 get_cursor_nId() const { return get_nId(mxTreeView->get_cursor_index()); }
+
+ void select(int pos) { mxTreeView->select(pos); }
+
+ int get_index(sal_uInt16 nId) const { return mxTreeView->find_id(OUString::number(nId)); }
+
+ DECL_LINK(ColumnClickedHdl, const int, void);
+
+ DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
+
+protected:
+ std::unique_ptr<weld::TreeView> mxTreeView;
+ std::vector<std::unique_ptr<ListViewItem>> mListViewItems;
+ Link<weld::TreeView&, void> maSelectionChangedHdl;
+ int mnSortColumn;
+};
+
+struct ListViewItem
+{
+public:
+ OUString maId;
+ OUString maTitle;
+ OUString maSubtitle;
+ OUString maApplication;
+ OUString maPath;
+ bool mbDefault;
+
+ /** Last modify time in seconds since 1/1/1970. */
+ sal_uInt32 mnModify;
+ /** Size in bytes of the file. */
+ sal_uInt64 mnSize;
+
+ OUString maDisplayModify;
+ OUString maDisplaySize;
+ OUString maDisplayPath;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/lnkbase.hxx b/include/sfx2/lnkbase.hxx
new file mode 100644
index 000000000..cf1083197
--- /dev/null
+++ b/include/sfx2/lnkbase.hxx
@@ -0,0 +1,179 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/linksrc.hxx>
+#include <sot/formats.hxx>
+#include <tools/ref.hxx>
+#include <tools/link.hxx>
+#include <memory>
+
+namespace com::sun::star::uno
+{
+ class Any;
+}
+
+namespace com::sun::star::io { class XInputStream; }
+
+enum class SfxLinkUpdateMode {
+ NONE = 0,
+ // Ole2 compatible and persistent
+ ALWAYS = 1,
+ ONCALL = 3
+};
+
+namespace sfx2
+{
+
+struct ImplBaseLinkData;
+class LinkManager;
+class FileDialogHelper;
+
+enum class SvBaseLinkObjectType {
+ Internal = 0x00,
+ DdeExternal = 0x02,
+ ClientSo = 0x80, // a Link
+ ClientDde = 0x81,
+ ClientFile = 0x90,
+ ClientGraphic = 0x91,
+ ClientOle = 0x92 // embedded link
+};
+
+constexpr bool isClientType(SvBaseLinkObjectType t)
+{
+ return static_cast<int>(t) & static_cast<int>(SvBaseLinkObjectType::ClientSo);
+}
+constexpr bool isClientFileType(SvBaseLinkObjectType t)
+{
+ auto check = static_cast<int>(SvBaseLinkObjectType::ClientFile);
+ return (static_cast<int>(t) & check) == check;
+}
+
+class SFX2_DLLPUBLIC SvBaseLink : public SvRefBase
+{
+private:
+ friend class LinkManager;
+ friend class SvLinkSource;
+
+ Link<SvBaseLink&,void> m_aEndEditLink;
+ LinkManager* m_pLinkMgr;
+ weld::Window* m_pParentWin;
+ std::unique_ptr<FileDialogHelper>
+ m_pFileDlg;
+ SvLinkSourceRef xObj;
+ OUString aLinkName;
+ std::unique_ptr<ImplBaseLinkData> pImplData;
+ SvBaseLinkObjectType mnObjType;
+ bool bVisible : 1;
+ bool bSynchron : 1;
+ bool bWasLastEditOK : 1;
+ bool m_bIsConnect : 1;
+
+ DECL_DLLPRIVATE_LINK( EndEditHdl, const OUString&, void );
+
+ bool ExecuteEdit( const OUString& _rNewName );
+
+protected:
+ void SetObjType( SvBaseLinkObjectType );
+
+ // Set LinkSourceName without action
+ void SetName( const OUString & rLn );
+
+ bool m_bIsReadOnly;
+ css::uno::Reference<css::io::XInputStream>
+ m_xInputStreamToLoadFrom;
+
+ SvBaseLink();
+ SvBaseLink( SfxLinkUpdateMode nLinkType, SotClipboardFormatId nContentType );
+ virtual ~SvBaseLink() override;
+
+ void GetRealObject_( bool bConnect = true );
+
+ SvLinkSource* GetRealObject()
+ {
+ if( !xObj.is() )
+ GetRealObject_();
+ return xObj.get();
+ }
+
+public:
+
+ virtual void Closed();
+
+#if defined(_WIN32)
+ SvBaseLink( const OUString& rNm, SvBaseLinkObjectType nObjectType,
+ SvLinkSource* );
+#endif
+
+ SvBaseLinkObjectType GetObjType() const { return mnObjType; }
+
+ void SetObj( SvLinkSource * pObj );
+ SvLinkSource* GetObj() const { return xObj.get(); }
+
+ void SetLinkSourceName( const OUString & rName );
+ const OUString& GetLinkSourceName() const { return aLinkName;}
+
+ enum UpdateResult {
+ SUCCESS = 0,
+ ERROR_GENERAL = 1
+ };
+
+ virtual UpdateResult DataChanged(
+ const OUString & rMimeType, const css::uno::Any & rValue );
+
+ void SetUpdateMode( SfxLinkUpdateMode );
+ SfxLinkUpdateMode GetUpdateMode() const;
+ SotClipboardFormatId GetContentType() const;
+ void SetContentType( SotClipboardFormatId nType );
+
+ LinkManager* GetLinkManager();
+ const LinkManager* GetLinkManager() const;
+ void SetLinkManager( LinkManager* _pMgr );
+
+ bool Update();
+ void Disconnect();
+
+ virtual void Edit(weld::Window*, const Link<SvBaseLink&,void>& rEndEditHdl);
+
+ // should the link appear in the dialog? (to the left in the link in the...)
+ bool IsVisible() const { return bVisible; }
+ void SetVisible( bool bFlag ) { bVisible = bFlag; }
+ // should the Link be loaded synchronous or asynchronous?
+ bool IsSynchron() const { return bSynchron; }
+ void SetSynchron( bool bFlag ) { bSynchron = bFlag; }
+
+ void setStreamToLoadFrom(
+ const css::uno::Reference<css::io::XInputStream>& xInputStream,
+ bool bIsReadOnly )
+ { m_xInputStreamToLoadFrom = xInputStream;
+ m_bIsReadOnly = bIsReadOnly; }
+ // #i88291#
+ void clearStreamToLoadFrom();
+
+ bool WasLastEditOK() const { return bWasLastEditOK; }
+ FileDialogHelper & GetInsertFileDialog(const OUString& rFactory);
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/lokcallback.hxx b/include/sfx2/lokcallback.hxx
new file mode 100644
index 000000000..32b6c08f8
--- /dev/null
+++ b/include/sfx2/lokcallback.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/types.h>
+
+namespace tools
+{
+class Rectangle;
+}
+
+// An extended callback type that allows passing in also some binary data,
+// so that post-processing the messages does not require conversions
+// from and to strings.
+
+// TODO: It might possibly make sense to drop the generic type/payload function
+// and have only a dedicated function for each message type?
+
+class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI SfxLokCallbackInterface
+{
+public:
+ virtual ~SfxLokCallbackInterface() {}
+ // LibreOfficeKitCallback equivalent.
+ virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) = 0;
+ // Callback that explicitly provides view id (which is also included in the payload).
+ virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId)
+ = 0;
+ // LOK_CALLBACK_INVALIDATE_TILES
+ // nPart is either part, -1 for all-parts, or INT_MIN if
+ // comphelper::LibreOfficeKit::isPartInInvalidation() is not set
+ virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart)
+ = 0;
+ // A message of the given type should be sent, for performance purpose only a notification
+ // is given here, details about the message should be queried from SfxViewShell when necessary.
+ // This is used for messages that are generated often but only the last one is needed.
+ virtual void libreOfficeKitViewUpdatedCallback(int nType) = 0;
+ // Like libreOfficeKitViewUpdatedCallback(), but a last message is needed for each nViewId value.
+ // SfxViewShell:getLOKPayload() will be called on nSourceViewId view.
+ virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId,
+ int nSourceViewId)
+ = 0;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/lokcomponenthelpers.hxx b/include/sfx2/lokcomponenthelpers.hxx
new file mode 100644
index 000000000..6a3d96468
--- /dev/null
+++ b/include/sfx2/lokcomponenthelpers.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_LOKCHARTHELPER_HXX
+#define INCLUDED_SFX2_LOKCHARTHELPER_HXX
+
+#include <sfx2/dllapi.h>
+#include <tools/gen.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/window.hxx>
+
+namespace com::sun::star::frame { class XController; }
+namespace com::sun::star::frame { class XDispatch; }
+
+class SfxViewShell;
+class VirtualDevice;
+
+/// A class for chart editing support via LibreOfficeKit.
+class SFX2_DLLPUBLIC LokChartHelper
+{
+private:
+ SfxViewShell* mpViewShell;
+ css::uno::Reference<css::frame::XController> mxController;
+ css::uno::Reference<css::frame::XDispatch> mxDispatcher;
+ VclPtr<vcl::Window> mpWindow;
+ bool mbNegativeX;
+
+public:
+ LokChartHelper(SfxViewShell* pViewShell, bool bNegativeX = false)
+ : mpViewShell(pViewShell)
+ , mpWindow(nullptr)
+ , mbNegativeX(bNegativeX)
+ {}
+
+ css::uno::Reference<css::frame::XController>& GetXController();
+ css::uno::Reference<css::frame::XDispatch>& GetXDispatcher();
+ vcl::Window* GetWindow();
+ tools::Rectangle GetChartBoundingBox();
+ void Invalidate();
+
+ bool Hit(const Point& aPos);
+ static bool HitAny(const Point& aPos, bool bNegativeX = false);
+ void PaintTile(VirtualDevice& rRenderContext, const tools::Rectangle& rTileRect);
+ static void PaintAllChartsOnTile(VirtualDevice& rDevice,
+ int nOutputWidth, int nOutputHeight,
+ int nTilePosX, int nTilePosY,
+ tools::Long nTileWidth, tools::Long nTileHeight,
+ bool bNegativeX = false);
+ bool postMouseEvent(int nType, int nX, int nY,
+ int nCount, int nButtons, int nModifier,
+ double fScaleX = 1.0, double fScaleY = 1.0);
+ bool setTextSelection(int nType, int nX, int nY);
+ bool setGraphicSelection(int nType, int nX, int nY,
+ double fScaleX = 1.0, double fScaleY = 1.0);
+};
+
+/// A class for math editing support via LibreOfficeKit.
+class SFX2_DLLPUBLIC LokStarMathHelper
+{
+public:
+ LokStarMathHelper(SfxViewShell* pViewShell)
+ : mpViewShell(pViewShell)
+ {
+ }
+
+ vcl::Window* GetGraphicWindow();
+ vcl::Window* GetWidgetWindow();
+
+ bool postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier,
+ double fScaleX = 1.0, double fScaleY = 1.0);
+
+private:
+ css::uno::Reference<css::frame::XController>& GetXController();
+ tools::Rectangle GetBoundingBox();
+
+ SfxViewShell* mpViewShell;
+ css::uno::Reference<css::frame::XController> mxController;
+ VclPtr<vcl::Window> mpGraphicWindow;
+ VclPtr<vcl::Window> mpWidgetWindow;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
new file mode 100644
index 000000000..4ac50a19c
--- /dev/null
+++ b/include/sfx2/lokhelper.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_LOKHELPER_HXX
+#define INCLUDED_SFX2_LOKHELPER_HXX
+
+#include <vcl/IDialogRenderable.hxx>
+#include <vcl/ITiledRenderable.hxx>
+#include <vcl/event.hxx>
+#include <sfx2/dllapi.h>
+#include <sfx2/viewsh.hxx>
+#include <tools/gen.hxx>
+#include <cstddef>
+#include <rtl/string.hxx>
+#include <optional>
+#include <string_view>
+
+struct SFX2_DLLPUBLIC LokMouseEventData
+{
+ int mnType;
+ Point maPosition;
+ int mnCount;
+ MouseEventModifiers meModifiers;
+ int mnButtons;
+ int mnModifier;
+ std::optional<Point> maLogicPosition;
+
+ LokMouseEventData(int nType, Point aPosition, int nCount, MouseEventModifiers eModifiers, int nButtons, int nModifier)
+ : mnType(nType)
+ , maPosition(aPosition)
+ , mnCount(nCount)
+ , meModifiers(eModifiers)
+ , mnButtons(nButtons)
+ , mnModifier(nModifier)
+ {}
+};
+
+#include <boost/property_tree/ptree_fwd.hpp>
+
+class SFX2_DLLPUBLIC SfxLokHelper
+{
+public:
+ /// Create a new view shell from the current view frame.
+ /// This assumes a single document is ever loaded.
+ static int createView();
+ /// Create a new view shell for the given DocId, for multi-document support.
+ static int createView(int nDocId);
+ /// Destroy a view shell from the global shell list.
+ static void destroyView(int nId);
+ /// Set a view shell as current one.
+ static void setView(int nId);
+ /// Get view shell with id
+ static SfxViewShell* getViewOfId(int nId);
+ /// Get the currently active view.
+ static int getView(const SfxViewShell* pViewShell = nullptr);
+ /// Get the number of views of the current DocId.
+ static std::size_t getViewsCount(int nDocId);
+ /// Get viewIds of views of the current DocId.
+ static bool getViewIds(int nDocId, int* pArray, size_t nSize);
+ /// Set View Blocked for some uno commands
+ static void setBlockedCommandList(int nViewId, const char* blockedCommandList);
+ /// Get the document id for a view
+ static int getDocumentIdOfView(int nViewId);
+ /// Get the default language that should be used for views
+ static const LanguageTag & getDefaultLanguage();
+ /// Set language of the given view.
+ static void setViewLanguage(int nId, const OUString& rBcp47LanguageTag);
+ /// Set the default language for views.
+ static void setDefaultLanguage(const OUString& rBcp47LanguageTag);
+ /// Set the locale for the given view.
+ static void setViewLocale(int nId, const OUString& rBcp47LanguageTag);
+ /// Get the device form factor that should be used for a new view.
+ static LOKDeviceFormFactor getDeviceFormFactor();
+ /// Set the device form factor that should be used for a new view.
+ static void setDeviceFormFactor(std::u16string_view rDeviceFormFactor);
+
+ /// Iterate over any view shell, except pThisViewShell, passing it to the f function.
+ template<typename ViewShellType, typename FunctionType>
+ static void forEachOtherView(ViewShellType* pThisViewShell, FunctionType f);
+
+ /// Invoke the LOK callback of all other views showing the same document as pThisView, with a payload of rKey-rPayload.
+ static void notifyOtherViews(const SfxViewShell* pThisView, int nType, std::string_view rKey,
+ const OString& rPayload);
+ /// Invoke the LOK callback of all views except pThisView, with a JSON payload created from the given property tree.
+ static void notifyOtherViews(const SfxViewShell* pThisView, int nType,
+ const boost::property_tree::ptree& rTree);
+ /// Same as notifyOtherViews(), but works on a selected "other" view, not on all of them.
+ static void notifyOtherView(const SfxViewShell* pThisView, SfxViewShell const* pOtherView,
+ int nType, std::string_view rKey, const OString& rPayload);
+ /// Same as notifyOtherViews(), the property-tree version, but works on a selected "other" view, not on all of them.
+ static void notifyOtherView(const SfxViewShell* pThisView, SfxViewShell const* pOtherView,
+ int nType, const boost::property_tree::ptree& rTree);
+
+ /// Emits a LOK_CALLBACK_STATE_CHANGED
+ static void sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* pItem);
+ /// Emits a LOK_CALLBACK_WINDOW
+ static void notifyWindow(const SfxViewShell* pThisView,
+ vcl::LOKWindowId nWindowId,
+ std::u16string_view rAction,
+ const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>());
+ /// Emits a LOK_CALLBACK_DOCUMENT_SIZE_CHANGED - if @bInvalidateAll - first invalidates all parts
+ static void notifyDocumentSizeChanged(SfxViewShell const* pThisView, const OString& rPayload, vcl::ITiledRenderable* pDoc, bool bInvalidateAll = true);
+ /// Emits a LOK_CALLBACK_DOCUMENT_SIZE_CHANGED for all views of the same document - if @bInvalidateAll - first invalidates all parts
+ static void notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable* pDoc, bool bInvalidateAll = true);
+ /// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed.
+ static void notifyInvalidation(SfxViewShell const* pThisView, tools::Rectangle const *);
+ /// Notifies all views with the given type and payload.
+ static void notifyAllViews(int nType, const OString& rPayload);
+
+ /// Notify about the editing context change.
+ static void notifyContextChange(SfxViewShell const* pViewShell, const OUString& aApplication, const OUString& aContext);
+
+ // Notify about the given type needing an update.
+ static void notifyUpdate(SfxViewShell const* pViewShell, int nType);
+ // Notify about the given type needing a per-viewid update.
+ static void notifyUpdatePerViewId(SfxViewShell const* pViewShell, int nType);
+ /// Same as notifyUpdatePerViewId(), pTargetShell will be notified, relevant viewId in pViewShell,
+ /// pSourceView->getLOKPayload() will be called to get the data.
+ static void notifyUpdatePerViewId(SfxViewShell const* pTargetShell, SfxViewShell const* pViewShell,
+ SfxViewShell const* pSourceShell, int nType);
+ // Notify other views about the given type needing a per-viewid update.
+ static void notifyOtherViewsUpdatePerViewId(SfxViewShell const* pViewShell, int nType);
+
+ static OString makePayloadJSON(const SfxViewShell* pThisView, int nViewId, std::string_view rKey, const OString& rPayload);
+ /// Makes a LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR payload, but tweaks it according to setOptionalFeatures() if needed.
+ static OString makeVisCursorInvalidation(int nViewId, const OString& rRectangle,
+ bool bMispelledWord = false, const OString& rHyperlink = "");
+
+ /// Helper for posting async key event
+ static void postKeyEventAsync(const VclPtr<vcl::Window> &xWindow,
+ int nType, int nCharCode, int nKeyCode, int nRepeat = 0);
+
+ /// Helper for posting input event
+ static void postExtTextEventAsync(const VclPtr<vcl::Window> &xWindow,
+ int nType, const OUString &rText);
+
+ /// Helper for posting async mouse event
+ static void postMouseEventAsync(const VclPtr<vcl::Window> &xWindow, LokMouseEventData const & rLokMouseEventData);
+
+ /// A special value to signify 'infinity'.
+ /// This value is chosen such that sal_Int32 will not overflow when manipulated.
+ static const tools::Long MaxTwips = 1e9;
+
+private:
+ static int createView(SfxViewFrame* pViewFrame, ViewShellDocId docId);
+};
+
+template<typename ViewShellType, typename FunctionType>
+void SfxLokHelper::forEachOtherView(ViewShellType* pThisViewShell, FunctionType f)
+{
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ auto pOtherViewShell = dynamic_cast<ViewShellType*>(pViewShell);
+ if (pOtherViewShell != nullptr && pOtherViewShell != pThisViewShell && pOtherViewShell->GetDocId() == pThisViewShell->GetDocId())
+ {
+ f(pOtherViewShell);
+ }
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/mailmodelapi.hxx b/include/sfx2/mailmodelapi.hxx
new file mode 100644
index 000000000..47d5b4086
--- /dev/null
+++ b/include/sfx2/mailmodelapi.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_MAILMODELAPI_HXX
+#define INCLUDED_SFX2_MAILMODELAPI_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
+#include <sfx2/dllapi.h>
+#include <vector>
+#include <string_view>
+#include <memory>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::frame { class XFrame; }
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::lang { class XMultiServiceFactory; }
+namespace com::sun::star::uno { class XInterface; }
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+// class AddressList_Impl ------------------------------------------------
+typedef ::std::vector< OUString > AddressList_Impl;
+
+// class SfxMailModel_Impl -----------------------------------------------
+
+class SFX2_DLLPUBLIC SfxMailModel
+{
+protected:
+ enum SaveResult
+ {
+ SAVE_SUCCESSFUL,
+ SAVE_CANCELLED,
+ SAVE_ERROR
+ };
+ ::std::vector< OUString > maAttachedDocuments;
+ static SaveResult SaveDocumentAsFormat( const OUString& aSaveFileName,
+ const css::uno::Reference< css::uno::XInterface >& xFrameOrModel,
+ const OUString& rType,
+ OUString& rFileNamePath );
+
+private:
+ std::unique_ptr<AddressList_Impl> mpToList;
+ OUString maFromAddress;
+
+ static SaveResult ShowFilterOptionsDialog( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ const OUString& rFilterName,
+ std::u16string_view rType,
+ bool bModified,
+ sal_Int32& rNumArgs,
+ css::uno::Sequence< css::beans::PropertyValue >& rArgs );
+
+public:
+ enum SendMailResult
+ {
+ SEND_MAIL_OK,
+ SEND_MAIL_CANCELLED,
+ SEND_MAIL_ERROR
+ };
+
+ SfxMailModel();
+ ~SfxMailModel();
+
+ void AddToAddress( const OUString& rAddress );
+
+ /** attaches a document to the current attachment list, can be called more than once.
+ * at the moment there will be a dialog for export executed for every model which is going to be attached.
+ *
+ * \param xModel
+ The current model to attach
+ * \param sAttachmentTitle
+ The title which will be used as attachment title
+ * \return @see error code
+ */
+ SendMailResult AttachDocument( const css::uno::Reference< css::uno::XInterface >& xFrameOrModel,
+ const OUString& sAttachmentTitle );
+
+ SendMailResult SaveAndSend( const css::uno::Reference< css::frame::XFrame >& xFrame,
+ const OUString& rType );
+ SendMailResult Send( const css::uno::Reference< css::frame::XFrame >& xFrame );
+
+ bool IsEmpty() const;
+};
+
+bool CreateFromAddress_Impl( OUString& rFrom );
+
+#endif // INCLUDED_SFX2_MAILMODELAPI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/mieclip.hxx b/include/sfx2/mieclip.hxx
new file mode 100644
index 000000000..bc2a431b3
--- /dev/null
+++ b/include/sfx2/mieclip.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_MIECLIP_HXX
+#define INCLUDED_SFX2_MIECLIP_HXX
+
+#include <memory>
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <tools/stream.hxx>
+
+class SFX2_DLLPUBLIC MSE40HTMLClipFormatObj
+{
+ std::unique_ptr<SvStream> pStrm;
+ OUString sBaseURL;
+
+public:
+ MSE40HTMLClipFormatObj() {}
+ ~MSE40HTMLClipFormatObj();
+
+ SvStream* IsValid(SvStream&);
+};
+
+#endif // INCLUDED_SFX2_MIECLIP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/minfitem.hxx b/include/sfx2/minfitem.hxx
new file mode 100644
index 000000000..ce6f8b25a
--- /dev/null
+++ b/include/sfx2/minfitem.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <svl/poolitem.hxx>
+#include <config_features.h>
+
+#if HAVE_FEATURE_SCRIPTING
+
+class BasicManager;
+
+class SFX2_DLLPUBLIC SfxMacroInfoItem final : public SfxPoolItem
+{
+ const BasicManager* pBasicManager;
+ OUString aLibName;
+ OUString aModuleName;
+ OUString aMethodName;
+ OUString aCommentText;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxMacroInfoItem( sal_uInt16 nWhich,
+ const BasicManager* pMgr,
+ const OUString &rLibName,
+ const OUString &rModuleName,
+ const OUString &rMethodName,
+ const OUString &rComment);
+
+ virtual SfxMacroInfoItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ const OUString& GetMethod() const
+ { return aMethodName; }
+ void SetMethod( const OUString& r )
+ { aMethodName = r; }
+ const OUString& GetModule() const
+ { return aModuleName; }
+ void SetModule( const OUString& r )
+ { aModuleName = r; }
+ const OUString& GetLib() const
+ { return aLibName; }
+ void SetLib( const OUString& r )
+ { aLibName = r; }
+ const BasicManager* GetBasicManager() const
+ { return pBasicManager; }
+ OUString GetQualifiedName() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
new file mode 100644
index 000000000..099222c1a
--- /dev/null
+++ b/include/sfx2/module.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_MODULE_HXX
+#define INCLUDED_SFX2_MODULE_HXX
+
+#include <memory>
+#include <optional>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/shell.hxx>
+#include <sfx2/styfitem.hxx>
+#include <sal/types.h>
+#include <tools/fldunit.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+class SfxObjectFactory;
+class SfxModule_Impl;
+class SfxSlotPool;
+struct SfxChildWinFactory;
+struct SfxStbCtrlFactory;
+struct SfxTbxCtrlFactory;
+class SfxTabPage;
+
+namespace com::sun::star::frame {
+ class XFrame;
+}
+
+namespace weld {
+ class Container;
+ class DialogController;
+}
+
+class SFX2_DLLPUBLIC SfxModule : public SfxShell
+{
+private:
+ // Warning this cannot be turned into a unique_ptr.
+ // SfxInterface destruction in the SfxSlotPool refers again to pImpl after deletion of pImpl has commenced. See tdf#100270
+ SfxModule_Impl* pImpl;
+
+ SAL_DLLPRIVATE void Construct_Impl(const OString& rResName);
+
+public:
+ SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE)
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl() {}
+
+public:
+
+ SfxModule(const OString& rResName, std::initializer_list<SfxObjectFactory*> pFactoryList);
+ virtual ~SfxModule() override;
+
+ std::locale GetResLocale() const;
+ SfxSlotPool* GetSlotPool() const;
+
+ void RegisterToolBoxControl(const SfxTbxCtrlFactory&);
+ void RegisterChildWindow(const SfxChildWinFactory&);
+ void RegisterStatusBarControl(const SfxStbCtrlFactory&);
+
+ virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId,
+ weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rSet );
+ virtual void Invalidate(sal_uInt16 nId = 0) override;
+
+ virtual std::optional<SfxStyleFamilies> CreateStyleFamilies() { return {}; }
+
+ static SfxModule* GetActiveModule( SfxViewFrame* pFrame=nullptr );
+ static FieldUnit GetCurrentFieldUnit();
+ /** retrieves the field unit of the module belonging to the document displayed in the given frame
+
+ Effectively, this method looks up the SfxViewFrame belonging to the given XFrame, then the SfxModule belonging to
+ the document in this frame, then this module's field unit.
+
+ Failures in any of those steps are reported as assertion in non-product builds, and then FieldUnit::MM_100TH is returned.
+ */
+ static FieldUnit GetModuleFieldUnit( css::uno::Reference< css::frame::XFrame > const & i_frame );
+ FieldUnit GetFieldUnit() const;
+
+ SAL_DLLPRIVATE SfxTbxCtrlFactory* GetTbxCtrlFactory(const std::type_info& rSlotType, sal_uInt16 nSlotID) const;
+ SAL_DLLPRIVATE SfxStbCtrlFactory* GetStbCtrlFactory(const std::type_info& rSlotType, sal_uInt16 nSlotID) const;
+ SAL_DLLPRIVATE SfxChildWinFactory* GetChildWinFactoryById(sal_uInt16 nId) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/msg.hxx b/include/sfx2/msg.hxx
new file mode 100644
index 000000000..e628e572c
--- /dev/null
+++ b/include/sfx2/msg.hxx
@@ -0,0 +1,264 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_MSG_HXX
+#define INCLUDED_SFX2_MSG_HXX
+
+#include <sfx2/shell.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <svl/poolitem.hxx>
+#include <sfx2/dllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <sfx2/groupid.hxx>
+#include <functional>
+
+#include <climits>
+
+class SfxItemPool;
+
+enum class SfxSlotMode {
+ NONE = 0x0000, // default
+
+ TOGGLE = 0x0004, // inverted for Execute old value
+ AUTOUPDATE = 0x0008, // invalidated the status automatically after execute
+ ASYNCHRON = 0x0020, // via Post-Message
+
+ NORECORD = 0x0100, // no recording
+ RECORDPERITEM = 0x0200, // each item, one statement
+ RECORDPERSET = 0x0400, // The whole Set is a Statement, default
+ RECORDABSOLUTE = 0x1000000, // Recording with absolute Target
+
+ METHOD = 0x4000,
+
+ FASTCALL = 0x8000, // No test if disabled before Execute
+
+ MENUCONFIG = 0x20000, // configurable Menu
+ TOOLBOXCONFIG = 0x40000, // configurable Toolboxen
+ ACCELCONFIG = 0x80000, // configurable keys
+
+ CONTAINER = 0x100000, // Operated by the container at InPlace
+ READONLYDOC = 0x200000 // also available for read-only Documents
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<SfxSlotMode> : is_typed_flags<SfxSlotMode, 0x13ec72cL> {};
+}
+
+#define SFX_EXEC_STUB( aShellClass, aExecMethod) \
+ void SfxStub##aShellClass##aExecMethod( \
+ SfxShell *pShell, SfxRequest& rReq) \
+ { \
+ ::tools::detail::castTo<aShellClass*>(pShell)->aExecMethod( rReq ); \
+ }
+
+#define SFX_STATE_STUB( aShellClass, aStateMethod) \
+ void SfxStub##aShellClass##aStateMethod( \
+ SfxShell *pShell, SfxItemSet& rSet) \
+ { \
+ static_cast<aShellClass*>(pShell)->aStateMethod( rSet ); \
+ }
+
+#define SFX_STUB_PTR( aShellClass, aMethod ) \
+ &SfxStub##aShellClass##aMethod
+
+#define SFX_STUB_PTR_EXEC_NONE &SfxShell::EmptyExecStub
+
+#define SFX_STUB_PTR_STATE_NONE &SfxShell::EmptyStateStub
+
+
+enum class SfxSlotKind
+{
+ Standard,
+ Attribute
+};
+
+
+struct SfxTypeAttrib
+{
+ sal_uInt16 nAID;
+ const char* pName;
+};
+
+template<class T> SfxPoolItem* createSfxPoolItem()
+{
+ return T::CreateDefault();
+}
+struct SfxType
+{
+ std::function<SfxPoolItem* ()> createSfxPoolItemFunc;
+ const std::type_info* pType;
+ sal_uInt16 nAttribs;
+ SfxTypeAttrib aAttrib[1]; // variable length
+
+ const std::type_info* Type() const{return pType;}
+ std::unique_ptr<SfxPoolItem> CreateItem() const
+ { return std::unique_ptr<SfxPoolItem>(createSfxPoolItemFunc()); }
+};
+
+struct SfxType0
+{
+ std::function<SfxPoolItem* ()> createSfxPoolItemFunc;
+ const std::type_info* pType;
+ sal_uInt16 nAttribs;
+ const std::type_info* Type() const { return pType;}
+};
+#define SFX_DECL_TYPE(n) struct SfxType##n \
+ { \
+ std::function<SfxPoolItem* ()> createSfxPoolItemFunc; \
+ const std::type_info* pType; \
+ sal_uInt16 nAttribs; \
+ SfxTypeAttrib aAttrib[n]; \
+ }
+
+#define SFX_TYPE(Class) &a##Class##_Impl
+
+SFX_DECL_TYPE(1);
+SFX_DECL_TYPE(2);
+SFX_DECL_TYPE(3);
+SFX_DECL_TYPE(4);
+SFX_DECL_TYPE(5);
+SFX_DECL_TYPE(6);
+SFX_DECL_TYPE(7);
+SFX_DECL_TYPE(8);
+SFX_DECL_TYPE(10); // for SfxDocInfoItem
+SFX_DECL_TYPE(11);
+
+SFX_DECL_TYPE(13); // for SwAddPrinterItem, Sd...
+SFX_DECL_TYPE(14);
+SFX_DECL_TYPE(16); // for SwDocDisplayItem
+SFX_DECL_TYPE(17); // for SvxAddressItem
+SFX_DECL_TYPE(23); // for SvxSearchItem
+
+// all SfxTypes must be in this header
+#undef SFX_DECL_TYPE
+
+#define SFX_SLOT_ARG( aShellClass, id, GroupId, ExecMethodPtr, StateMethodPtr, Flags, ItemClass, nArg0, nArgs, Name, Prop ) \
+ { id, GroupId, Flags | Prop, \
+ USHRT_MAX, 0, \
+ ExecMethodPtr, \
+ StateMethodPtr, \
+ (const SfxType*) &a##ItemClass##_Impl, \
+ 0, \
+ &a##aShellClass##Args_Impl[nArg0], nArgs, SfxDisableFlags::NONE, Name \
+ }
+
+#define SFX_NEW_SLOT_ARG( aShellClass, id, GroupId, pNext, ExecMethodPtr, StateMethodPtr, Flags, DisableFlags, ItemClass, nArg0, nArgs, Prop, UnoName ) \
+ { id, GroupId, Flags | Prop, \
+ USHRT_MAX, 0, \
+ ExecMethodPtr, \
+ StateMethodPtr, \
+ (const SfxType*) &a##ItemClass##_Impl, \
+ pNext, \
+ &a##aShellClass##Args_Impl[nArg0], nArgs, DisableFlags, UnoName \
+ }
+
+struct SfxFormalArgument
+{
+ const SfxType* pType; // Type of the parameter (SfxPoolItem subclass)
+ const char* pName; // Name of the sParameters
+ sal_uInt16 nSlotId; // Slot-Id for identification of the Parameters
+
+ std::unique_ptr<SfxPoolItem> CreateItem() const
+ { return pType->CreateItem(); }
+};
+
+
+class SfxSlot
+{
+public:
+ sal_uInt16 nSlotId; // Unique slot-ID in Shell
+ SfxGroupId nGroupId; // for configuration region
+ SfxSlotMode nFlags; // arithmetic ordered Flags
+
+ sal_uInt16 nMasterSlotId; // Enum-Slot for example Which-Id
+ sal_uInt16 nValue; // Value, in case of Enum-Slot
+
+ SfxExecFunc fnExec; // Function to be executed
+ SfxStateFunc fnState; // Function for Status
+
+ const SfxType* pType; // SfxPoolItem-Type (Status)
+
+ const SfxSlot* pNextSlot; // with the same Status-Method
+
+ const SfxFormalArgument* pFirstArgDef; // first formal Argument-Definition
+ sal_uInt16 nArgDefCount; // Number of formal Arguments
+ SfxDisableFlags nDisableFlags; // DisableFlags that need to be
+ // present, so that the Slot
+ // can be enabled
+ const char* pUnoName; // UnoName for the Slots
+
+public:
+
+ SfxSlotKind GetKind() const;
+ sal_uInt16 GetSlotId() const;
+ SfxSlotMode GetMode() const;
+ bool IsMode( SfxSlotMode nMode ) const;
+ SfxGroupId GetGroupId() const;
+ sal_uInt16 GetWhich( const SfxItemPool &rPool ) const;
+ const SfxType* GetType() const { return pType; }
+ const char* GetUnoName() const { return pUnoName; }
+ SFX2_DLLPUBLIC OString GetCommand() const;
+ SFX2_DLLPUBLIC OUString GetCommandString() const;
+
+ sal_uInt16 GetFormalArgumentCount() const { return nArgDefCount; }
+ const SfxFormalArgument& GetFormalArgument( sal_uInt16 nNo ) const
+ { return pFirstArgDef[nNo]; }
+
+ SfxExecFunc GetExecFnc() const { return fnExec; }
+ SfxStateFunc GetStateFnc() const { return fnState; }
+
+ const SfxSlot* GetNextSlot() const { return pNextSlot; }
+};
+
+
+// returns the id of the function
+
+inline sal_uInt16 SfxSlot::GetSlotId() const
+{
+ return nSlotId;
+}
+
+// returns a bitfield with flags
+
+inline SfxSlotMode SfxSlot::GetMode() const
+{
+ return nFlags;
+}
+
+
+// determines if the specified mode is assigned
+
+inline bool SfxSlot::IsMode( SfxSlotMode nMode ) const
+{
+ return bool(nFlags & nMode);
+}
+
+
+// returns the id of the associated group
+
+inline SfxGroupId SfxSlot::GetGroupId() const
+{
+ return nGroupId;
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/msgpool.hxx b/include/sfx2/msgpool.hxx
new file mode 100644
index 000000000..7aa38904c
--- /dev/null
+++ b/include/sfx2/msgpool.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_MSGPOOL_HXX
+#define INCLUDED_SFX2_MSGPOOL_HXX
+
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sal/types.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/groupid.hxx>
+#include <vector>
+
+class SfxInterface;
+class SfxSlot;
+class SfxViewFrame;
+
+class SFX2_DLLPUBLIC SfxSlotPool
+{
+ std::vector<SfxGroupId> _vGroups;
+ SfxSlotPool* _pParentPool;
+ std::vector<SfxInterface*> _vInterfaces;
+ sal_uInt16 _nCurGroup;
+ sal_uInt16 _nCurInterface;
+ sal_uInt16 _nCurMsg;
+
+private:
+ const SfxSlot* SeekSlot( sal_uInt16 nObject );
+
+public:
+ SfxSlotPool(SfxSlotPool* pParent=nullptr);
+ ~SfxSlotPool();
+
+ void RegisterInterface( SfxInterface& rFace );
+
+ static SfxSlotPool& GetSlotPool( SfxViewFrame *pFrame=nullptr );
+
+ sal_uInt16 GetGroupCount() const;
+ OUString SeekGroup( sal_uInt16 nNo );
+ const SfxSlot* FirstSlot();
+ const SfxSlot* NextSlot();
+ const SfxSlot* GetSlot( sal_uInt16 nId ) const;
+ const SfxSlot* GetUnoSlot( const OUString& rUnoName ) const;
+ const std::type_info* GetSlotType( sal_uInt16 nSlotId ) const;
+};
+
+
+// seeks to the first func in the current group
+
+inline const SfxSlot* SfxSlotPool::FirstSlot()
+{
+ return SeekSlot(0);
+}
+
+#define SFX_SLOTPOOL() SfxSlotPool::GetSlotPool()
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/navigat.hxx b/include/sfx2/navigat.hxx
new file mode 100644
index 000000000..febdefa81
--- /dev/null
+++ b/include/sfx2/navigat.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_NAVIGAT_HXX
+#define INCLUDED_SFX2_NAVIGAT_HXX
+
+#include <sfx2/childwin.hxx>
+#include <sfx2/dockwin.hxx>
+
+class SFX2_DLLPUBLIC SfxNavigatorWrapper : public SfxChildWindow
+{
+protected:
+ void Initialize();
+public:
+ SfxNavigatorWrapper(vcl::Window* pParent, sal_uInt16 nId);
+};
+
+class SFX2_DLLPUBLIC SfxNavigator : public SfxDockingWindow
+{
+public:
+ SfxNavigator(SfxBindings* pBindings, SfxChildWindow* pChildWin,
+ vcl::Window* pParent, SfxChildWinInfo* pInfo);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/new.hxx b/include/sfx2/new.hxx
new file mode 100644
index 000000000..8cb2bd9b4
--- /dev/null
+++ b/include/sfx2/new.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_NEW_HXX
+#define INCLUDED_SFX2_NEW_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/objsh.hxx>
+
+#include <vcl/idle.hxx>
+#include <sfx2/doctempl.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace weld { class Button; }
+namespace weld { class CheckButton; }
+namespace weld { class CustomWeld; }
+namespace weld { class Expander; }
+namespace weld { class Label; }
+namespace weld { class TreeView; }
+namespace weld { class Window; }
+
+class SfxPreviewWin_Impl;
+
+enum class SfxNewFileDialogMode {
+ NONE, Preview, LoadTemplate
+};
+
+enum class SfxTemplateFlags
+{
+ NONE = 0x00,
+ LOAD_TEXT_STYLES = 0x01,
+ LOAD_FRAME_STYLES = 0x02,
+ LOAD_PAGE_STYLES = 0x04,
+ LOAD_NUM_STYLES = 0x08,
+ MERGE_STYLES = 0x10,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SfxTemplateFlags> : is_typed_flags<SfxTemplateFlags, 0x1f> {};
+}
+
+#define RET_TEMPLATE_LOAD 100
+
+class SFX2_DLLPUBLIC SfxNewFileDialog final : public SfxDialogController
+{
+private:
+ Idle m_aPrevIdle;
+ SfxNewFileDialogMode m_nFlags;
+ SfxDocumentTemplates m_aTemplates;
+ SfxObjectShellLock m_xDocShell;
+
+ std::unique_ptr<SfxPreviewWin_Impl> m_xPreviewController;
+
+ std::unique_ptr<weld::TreeView> m_xRegionLb;
+ std::unique_ptr<weld::TreeView> m_xTemplateLb;
+ std::unique_ptr<weld::CheckButton> m_xTextStyleCB;
+ std::unique_ptr<weld::CheckButton> m_xFrameStyleCB;
+ std::unique_ptr<weld::CheckButton> m_xPageStyleCB;
+ std::unique_ptr<weld::CheckButton> m_xNumStyleCB;
+ std::unique_ptr<weld::CheckButton> m_xMergeStyleCB;
+ std::unique_ptr<weld::Button> m_xLoadFilePB;
+ std::unique_ptr<weld::Expander> m_xMoreBt;
+ std::unique_ptr<weld::CustomWeld> m_xPreviewWin;
+ std::unique_ptr<weld::Label> m_xAltTitleFt;
+
+ DECL_DLLPRIVATE_LINK( Update, Timer *, void );
+
+ DECL_DLLPRIVATE_LINK(RegionSelect, weld::TreeView&, void);
+ DECL_DLLPRIVATE_LINK(TemplateSelect, weld::TreeView&, void);
+ DECL_DLLPRIVATE_LINK(DoubleClick, weld::TreeView&, bool);
+ DECL_DLLPRIVATE_LINK(Expand, weld::Expander&, void);
+ sal_uInt16 GetSelectedTemplatePos() const;
+
+public:
+ SfxNewFileDialog(weld::Window *pParent, SfxNewFileDialogMode nFlags);
+ virtual ~SfxNewFileDialog() override;
+
+ // Returns false, when '- No -' is set as Template
+ // Template names can only be obtained when IsTemplate() returns true.
+ bool IsTemplate() const;
+ OUString GetTemplateFileName() const;
+
+ // load template methods
+ SfxTemplateFlags GetTemplateFlags() const;
+ void SetTemplateFlags(SfxTemplateFlags nSet);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx
new file mode 100644
index 000000000..23dbfa612
--- /dev/null
+++ b/include/sfx2/newstyle.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_NEWSTYLE_HXX
+#define INCLUDED_SFX2_NEWSTYLE_HXX
+
+#include <comphelper/string.hxx>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <svl/style.hxx>
+#include <vcl/weld.hxx>
+
+class SFX2_DLLPUBLIC SfxNewStyleDlg final : public weld::GenericDialogController
+{
+private:
+ SfxStyleSheetBasePool& m_rPool;
+ SfxStyleFamily m_eSearchFamily;
+
+ std::unique_ptr<weld::EntryTreeView> m_xColBox;
+ std::unique_ptr<weld::Button> m_xOKBtn;
+
+ std::unique_ptr<weld::MessageDialog> m_xQueryOverwriteBox;
+
+ DECL_DLLPRIVATE_LINK(OKHdl, weld::TreeView&, bool);
+ DECL_DLLPRIVATE_LINK(OKClickHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(ModifyHdl, weld::ComboBox&, void);
+
+public:
+ SfxNewStyleDlg(weld::Widget* pParent, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFam);
+ virtual ~SfxNewStyleDlg() override;
+
+ OUString GetName() const
+ {
+ return comphelper::string::stripStart(m_xColBox->get_active_text(), ' ');
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx b/include/sfx2/notebookbar/SfxNotebookBar.hxx
new file mode 100644
index 000000000..66286b87c
--- /dev/null
+++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
+#define INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
+
+#include <sfx2/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <vcl/WeldedTabbedNotebookbar.hxx>
+#include <vcl/EnumContext.hxx>
+
+#include <map>
+#include <memory>
+#include <string_view>
+
+namespace com::sun::star::frame
+{
+class XFrame;
+}
+namespace com::sun::star::uno
+{
+template <typename> class Reference;
+}
+
+class SfxBindings;
+class SfxViewFrame;
+class SfxViewShell;
+class SystemWindow;
+class WeldedTabbedNotebookbar;
+
+namespace sfx2
+{
+/** Helpers for easier access to NotebookBar via the sfx2 infrastructure.
+*/
+class SFX2_DLLPUBLIC SfxNotebookBar
+{
+public:
+ static void CloseMethod(SfxBindings& rBindings);
+ static void CloseMethod(SystemWindow* pSysWindow);
+
+ static bool IsActive();
+
+ /// Function to be called from the sdi's ExecMethod.
+ static void ExecMethod(SfxBindings& rBindings, const OUString& rUIName);
+
+ /// Function to be called from the sdi's StateMethod.
+ static bool StateMethod(SfxBindings& rBindings, std::u16string_view rUIFile,
+ bool bReloadNotebookbar = false);
+ static bool StateMethod(SystemWindow* pSysWindow,
+ const css::uno::Reference<css::frame::XFrame>& xFrame,
+ std::u16string_view rUIFile, bool bReloadNotebookbar = false);
+
+ /// Method temporarily blocks showing of the NotebookBar
+ static void LockNotebookBar();
+ /// Method restores normal behaviour of the Notebookbar
+ static void UnlockNotebookBar();
+
+ static void RemoveListeners(SystemWindow const* pSysWindow);
+
+ /** Show menu bar in all frames of current application */
+ static void ShowMenubar(bool bShow);
+ /** Show menu bar only in current frame */
+ static void ShowMenubar(SfxViewFrame const* pViewFrame, bool bShow);
+ static void ToggleMenubar();
+ static void ReloadNotebookBar(std::u16string_view sUIPath);
+
+private:
+ static bool m_bLock;
+ static bool m_bHide;
+
+ static std::map<const SfxViewShell*, std::shared_ptr<WeldedTabbedNotebookbar>>
+ m_pNotebookBarWeldedWrapper;
+
+ static void ResetActiveToolbarModeToDefault(vcl::EnumContext::Application eApp);
+
+ DECL_DLLPRIVATE_STATIC_LINK(SfxNotebookBar, VclDisposeHdl, const SfxViewShell*, void);
+};
+
+} // namespace sfx2
+
+#endif // INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/objface.hxx b/include/sfx2/objface.hxx
new file mode 100644
index 000000000..fadf510ca
--- /dev/null
+++ b/include/sfx2/objface.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_OBJFACE_HXX
+#define INCLUDED_SFX2_OBJFACE_HXX
+
+#include <memory>
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sal/types.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/msg.hxx>
+#include <sfx2/toolbarids.hxx>
+
+struct SfxInterface_Impl;
+class SfxModule;
+
+#define SFX_OBJECTBAR_APPLICATION 0
+#define SFX_OBJECTBAR_OBJECT 1
+#define SFX_OBJECTBAR_TOOLS 2
+#define SFX_OBJECTBAR_MACRO 3
+#define SFX_OBJECTBAR_FULLSCREEN 4
+#define SFX_OBJECTBAR_RECORDING 5
+#define SFX_OBJECTBAR_COMMONTASK 6
+#define SFX_OBJECTBAR_OPTIONS 7
+#define SFX_OBJECTBAR_NAVIGATION 12
+#define SFX_OBJECTBAR_MAX 13
+
+enum class StatusBarId : sal_uInt32
+{
+ None = 0,
+ GenericStatusBar = 4,
+ WriterStatusBar = 20013,
+ MathStatusBar = 20816,
+ DrawStatusBar = 23007,
+ CalcStatusBar = 26005,
+ BasicIdeStatusBar = 30805
+};
+
+class SFX2_DLLPUBLIC SfxInterface final
+{
+friend class SfxSlotPool;
+
+ const char* pName; // Sfx-internal name of interface
+ const SfxInterface* pGenoType; // base interface
+ SfxSlot* pSlots; // SlotMap
+ sal_uInt16 nCount; // number of slots in SlotMap
+ SfxInterfaceId nClassId; // Id of interface
+ bool bSuperClass; // Whether children inherit its toolbars etc
+ std::unique_ptr<SfxInterface_Impl> pImplData;
+
+public:
+ SfxInterface( const char *pClass,
+ bool bSuperClass,
+ SfxInterfaceId nClassId,
+ const SfxInterface* pGeno,
+ SfxSlot &rMessages, sal_uInt16 nMsgCount );
+ ~SfxInterface();
+
+ void SetSlotMap( SfxSlot& rMessages, sal_uInt16 nMsgCount );
+ inline sal_uInt16 Count() const;
+
+ const SfxSlot* GetRealSlot( const SfxSlot * ) const;
+ const SfxSlot* GetSlot( sal_uInt16 nSlotId ) const;
+ const SfxSlot* GetSlot( const OUString& rCommand ) const;
+
+ const char* GetClassName() const { return pName; }
+ bool UseAsSuperClass() const { return bSuperClass; }
+
+ const SfxInterface* GetGenoType() const { return pGenoType; }
+
+ void RegisterObjectBar(sal_uInt16, SfxVisibilityFlags nFlags, ToolbarId eId);
+ void RegisterObjectBar(sal_uInt16, SfxVisibilityFlags nFlags, ToolbarId eId, SfxShellFeature nFeature);
+ void RegisterChildWindow(sal_uInt16, bool bContext = false);
+ void RegisterChildWindow(sal_uInt16, bool bContext, SfxShellFeature nFeature);
+ void RegisterStatusBar(StatusBarId eId);
+ ToolbarId GetObjectBarId(sal_uInt16 nNo) const;
+ sal_uInt16 GetObjectBarPos( sal_uInt16 nNo ) const;
+ SfxVisibilityFlags GetObjectBarFlags( sal_uInt16 nNo ) const;
+ SfxShellFeature GetObjectBarFeature(sal_uInt16 nNo) const;
+ sal_uInt16 GetObjectBarCount() const;
+ bool IsObjectBarVisible( sal_uInt16 nNo) const;
+ SfxShellFeature GetChildWindowFeature(sal_uInt16 nNo) const;
+ sal_uInt32 GetChildWindowId( sal_uInt16 nNo ) const;
+ sal_uInt16 GetChildWindowCount() const;
+ void RegisterPopupMenu( const OUString& );
+ const OUString& GetPopupMenuName() const;
+ StatusBarId GetStatusBarId() const;
+
+ void Register( const SfxModule* );
+
+ SAL_DLLPRIVATE bool ContainsSlot_Impl( const SfxSlot *pSlot ) const
+ { return pSlot >= pSlots && pSlot < pSlots + Count(); }
+};
+
+
+// returns the number of functions in this cluster
+
+inline sal_uInt16 SfxInterface::Count() const
+{
+ return nCount;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/objitem.hxx b/include/sfx2/objitem.hxx
new file mode 100644
index 000000000..17b7f0cf1
--- /dev/null
+++ b/include/sfx2/objitem.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_OBJITEM_HXX
+#define INCLUDED_SFX2_OBJITEM_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <svl/poolitem.hxx>
+
+class SfxShell;
+
+class SFX2_DLLPUBLIC SfxObjectItem final : public SfxPoolItem
+{
+ SfxShell* _pSh;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxObjectItem( sal_uInt16 nWhich=0, SfxShell *pSh=nullptr );
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxObjectItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool QueryValue(css::uno::Any&, sal_uInt8 nMemberId = 0) const override;
+ virtual bool PutValue(const css::uno::Any&, sal_uInt8) override;
+
+ SfxShell* GetShell() const
+ { return _pSh; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
new file mode 100644
index 000000000..428995bff
--- /dev/null
+++ b/include/sfx2/objsh.hxx
@@ -0,0 +1,918 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_OBJSH_HXX
+#define INCLUDED_SFX2_OBJSH_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/signaturestate.hxx>
+#include <sal/types.h>
+#include <vcl/errcode.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/frame/XModel3.hpp>
+#include <vcl/bitmapex.hxx>
+
+#include <svl/poolitem.hxx>
+#include <sot/formats.hxx>
+#include <sot/object.hxx>
+#include <tools/gen.hxx>
+#include <tools/link.hxx>
+
+#include <sfx2/shell.hxx>
+#include <comphelper/embeddedobjectcontainer.hxx>
+#include <memory>
+#include <set>
+#include <string_view>
+
+#include <o3tl/typed_flags_set.hxx>
+#include <functional>
+#include <sfx2/AccessibilityIssue.hxx>
+
+namespace weld {class Button; }
+class SbxValue;
+class SbxArray;
+class BasicManager;
+class SfxMedium;
+class SfxObjectFactory;
+class SfxDocumentInfoDialog;
+class SfxStyleSheetBasePool;
+class StarBASIC;
+class Printer;
+class SvKeyValueIterator;
+class SfxBaseModel;
+class SfxModule;
+class SfxProgress;
+class GDIMetaFile;
+class INetURLObject;
+class IndexBitSet;
+class JobSetup;
+class OutputDevice;
+class Color;
+class Fraction;
+class SvGlobalName;
+class InfobarData;
+class VirtualDevice;
+
+enum class SfxModelFlags;
+enum class SfxEventHintId;
+enum class InfobarType;
+
+// These values presumably must match exactly the corresponding
+// css::embed::Aspects ones (in offapi/com/sun/star/embed/Aspects.idl)
+// and the DVASPECT_* ones in the Win32 API.
+
+#define ASPECT_CONTENT 1
+#define ASPECT_THUMBNAIL 2 /* 120 * 120, 6 Colors DIB in MetaFile */
+#define ASPECT_ICON 4
+#define ASPECT_DOCPRINT 8
+
+namespace sfx2
+{
+ class SvLinkSource;
+ class StyleManager;
+}
+
+namespace com::sun::star::awt { class XWindow; }
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::document { struct CmisVersion; }
+namespace com::sun::star::document { class XDocumentProperties; }
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::graphic { class XGraphic; }
+namespace com::sun::star::io { class XStream; }
+namespace com::sun::star::script { class XLibraryContainer; }
+namespace com::sun::star::security { class XCertificate; }
+namespace com::sun::star::security { class XDocumentDigitalSignatures; }
+namespace com::sun::star::security { struct DocumentSignatureInformation; }
+namespace com::sun::star::task { class XInteractionHandler; }
+namespace com::sun::star::lang { class XComponent; }
+namespace com::sun::star::text { class XTextRange; }
+
+namespace sfx2 { class IXmlIdRegistry; }
+
+#define SFX_TITLE_TITLE 0
+#define SFX_TITLE_FILENAME 1
+#define SFX_TITLE_FULLNAME 2
+#define SFX_TITLE_APINAME 3
+#define SFX_TITLE_DETECT 4
+#define SFX_TITLE_CAPTION 5
+#define SFX_TITLE_PICKLIST 6
+#define SFX_TITLE_HISTORY 7
+#define SFX_TITLE_MAXLEN 10 // this gives the limits on length
+
+enum class SfxLoadedFlags
+{
+ NONE = 0,
+ MAINDOCUMENT = 1,
+ IMAGES = 2,
+ ALL = MAINDOCUMENT | IMAGES
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SfxLoadedFlags> : is_typed_flags<SfxLoadedFlags, 0x03> {};
+}
+
+enum class HiddenInformation
+{
+ NONE = 0x0000,
+ RECORDEDCHANGES = 0x0001,
+ NOTES = 0x0002,
+ DOCUMENTVERSIONS = 0x0004
+};
+namespace o3tl
+{
+ template<> struct typed_flags<HiddenInformation> : is_typed_flags<HiddenInformation, 0x07> {};
+}
+
+namespace weld { class Window; }
+
+enum class HiddenWarningFact
+{
+ WhenSaving = 0,
+ WhenPrinting,
+ WhenSigning,
+ WhenCreatingPDF
+};
+
+enum class SfxObjectCreateMode
+{
+ EMBEDDED,
+ STANDARD,
+ ORGANIZER,
+ INTERNAL
+};
+
+/*
+ The class SfxObjectShell is the base class for SFx-objects, ie documents
+ and parts of documents that can be integrated as separate objects
+ into foreign objects.
+ There can be multiple edit windows (SfxViewShell) for one SfxObjectShell.
+*/
+
+struct TransferableObjectDescriptor;
+template<class T> bool checkSfxObjectShell(const SfxObjectShell* pShell)
+{
+ return dynamic_cast<const T*>(pShell) != nullptr;
+}
+
+class SFX2_DLLPUBLIC SfxObjectShell :
+ public SfxShell, virtual public SotObject,
+ public ::comphelper::IEmbeddedHelper
+{
+friend struct ModifyBlocker_Impl;
+friend class SfxObjectShellLock;
+
+private:
+ std::unique_ptr<struct SfxObjectShell_Impl> pImpl; // internal data
+
+ SfxMedium * pMedium; // Description of the file for example
+ // storage that contains the object
+ SfxObjectCreateMode eCreateMode; // Purpose of the object
+ bool bHasName :1; // sal_True := existing object,
+ // sal_False := new object
+ bool bIsInGenerateThumbnail; //optimize thumbnail generate and store procedure to improve odt saving performance, i120030
+ bool mbAvoidRecentDocs; ///< Avoid adding to the recent documents list, if not necessary.
+
+ enum TriState {undefined, yes, no};
+ TriState mbContinueImportOnFilterExceptions = undefined; // try to import as much as possible
+
+ bool CloseInternal();
+
+ SAL_DLLPRIVATE void UpdateTime_Impl(const css::uno::Reference<
+ css::document::XDocumentProperties> & i_xDocProps);
+
+ SAL_DLLPRIVATE bool SaveTo_Impl(SfxMedium &rMedium, const SfxItemSet* pSet );
+
+protected:
+ SfxObjectShell(SfxObjectCreateMode);
+ SfxObjectShell(SfxModelFlags); // see sfxmodelfactory.hxx
+ virtual ~SfxObjectShell() override;
+
+ void ModifyChanged();
+ virtual bool Close() override;
+
+ /// template method, called by FlushDocInfo; this implementation is empty
+ virtual void DoFlushDocInfo();
+
+ // helper method
+ void AddToRecentlyUsedList();
+
+ // Parent class for actual guard objects that would do useful work
+ class LockAllViewsGuard
+ {
+ public:
+ virtual ~LockAllViewsGuard() {}
+ };
+
+public:
+ SFX_DECL_INTERFACE(SFX_INTERFACE_SFXDOCSH)
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl();
+
+public:
+ static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
+ /* Stampit disable/enable cancel button for print jobs
+ default = true = enable! */
+ void Stamp_SetPrintCancelState(bool bState);
+ bool Stamp_GetPrintCancelState() const;
+
+ static OUString CreateShellID( const SfxObjectShell* pShell );
+
+ // Document-Shell Iterator
+ static SfxObjectShell* GetFirst( const std::function<bool ( const SfxObjectShell* )>& isObjectShell = nullptr,
+ bool bOnlyVisible = true );
+ static SfxObjectShell* GetNext( const SfxObjectShell& rPrev,
+ const std::function<bool ( const SfxObjectShell* )>& isObjectShell = nullptr,
+ bool bOnlyVisible = true );
+ static SfxObjectShell* Current();
+ static css::uno::Reference< css::uno::XInterface >
+ GetCurrentComponent();
+ static void SetCurrentComponent( const css::uno::Reference< css::uno::XInterface >& _rxComponent );
+
+ virtual void Invalidate(sal_uInt16 nId = 0) override;
+
+ SfxModule* GetModule() const;
+
+ virtual SfxObjectFactory& GetFactory() const=0;
+ SfxMedium * GetMedium() const { return pMedium; }
+ css::uno::Reference< css::document::XDocumentProperties >
+ getDocProperties() const;
+ void UpdateDocInfoForSave( );
+ void FlushDocInfo();
+ bool HasName() const { return bHasName; }
+ OUString GetAPIName() const;
+ void SetReadOnly();
+ bool IsReadOnly() const;
+ bool IsReadOnlyMedium() const;
+ bool IsOriginallyReadOnlyMedium() const;
+ bool IsOriginallyLoadedReadOnlyMedium() const;
+ void SetReadOnlyUI( bool bReadOnly = true );
+ bool IsReadOnlyUI() const;
+ void SetNoName();
+ bool IsInModalMode() const;
+ bool IsInPrepareClose() const;
+ bool AcceptStateUpdate() const;
+ bool IsHelpDocument() const;
+
+ bool IsDocShared() const;
+ OUString GetSharedFileURL() const;
+ bool SwitchToShared( bool bShared, bool bSave );
+ SAL_DLLPRIVATE void FreeSharedFile( const OUString& aTempFileURL );
+ SAL_DLLPRIVATE void DoNotCleanShareControlFile();
+ void SetSharedXMLFlag( bool bFlag ) const;
+ bool HasSharedXMLFlagSet() const;
+
+ SAL_DLLPRIVATE void SetModalMode_Impl(bool bModal);
+ SAL_DLLPRIVATE void SetMacroMode_Impl(bool bModal=true);
+
+ void ResetError();
+ ErrCode GetError() const;
+ ErrCode GetErrorCode() const;
+ void SetError(ErrCode rErr);
+
+ /**
+ * Initialize bare minimum just enough for unit test runs.
+ *
+ * @return true if the initialization is successful, false otherwise.
+ */
+ void DoInitUnitTest();
+ bool DoInitNew();
+ bool DoLoad( SfxMedium* pMedium );
+ bool DoLoadExternal( SfxMedium* pMed );
+ bool DoSave();
+ bool DoSaveAs( SfxMedium &rNewStor );
+ bool DoSaveObjectAs( SfxMedium &rNewStor, bool bCommit );
+
+ // TODO/LATER: currently only overridden in Calc, should be made non-virtual
+ virtual bool DoSaveCompleted( SfxMedium* pNewStor=nullptr, bool bRegisterRecent=true );
+ /// Terminate any in-flight editing. Used before saving, primarily by Calc to commit cell changes.
+ virtual void TerminateEditing() {}
+
+ bool LoadOwnFormat( SfxMedium& pMedium );
+ virtual bool SaveAsOwnFormat( SfxMedium& pMedium );
+ virtual bool ConvertFrom( SfxMedium &rMedium );
+ virtual bool ConvertTo( SfxMedium &rMedium );
+ virtual bool InitNew( const css::uno::Reference< css::embed::XStorage >& xStorage );
+ virtual bool Load( SfxMedium &rMedium );
+ virtual bool LoadFrom( SfxMedium& rMedium );
+ virtual bool Save();
+ virtual bool SaveAs( SfxMedium &rMedium );
+ virtual bool SaveCompleted( const css::uno::Reference< css::embed::XStorage >& xStorage );
+ bool SwitchPersistence(
+ const css::uno::Reference< css::embed::XStorage >& xStorage );
+ virtual void UpdateLinks();
+ virtual bool LoadExternal( SfxMedium& rMedium );
+ bool IsConfigOptionsChecked() const;
+ void SetConfigOptionsChecked( bool bChecked );
+
+ // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action
+ virtual bool QuerySlotExecutable( sal_uInt16 nSlotId );
+
+ void SaveChildren(bool bObjectsOnly=false);
+ bool SaveAsChildren( SfxMedium &rMedium );
+ bool SwitchChildrenPersistence(
+ const css::uno::Reference< css::embed::XStorage >& xStorage,
+ bool bForceNonModified = false );
+ bool SaveCompletedChildren();
+
+ /** a very special case to insert at a position in Writer from UNO,
+ via OwnSubFilterService */
+ virtual bool InsertGeneratedStream(SfxMedium& rMedium,
+ css::uno::Reference<css::text::XTextRange> const& xInsertPosition);
+ virtual bool ImportFrom( SfxMedium &rMedium,
+ css::uno::Reference<css::text::XTextRange> const& xInsertPosition);
+ bool ExportTo( SfxMedium &rMedium );
+
+ /** Returns true if preparing was successful, else false. */
+ bool PrepareForSigning(weld::Window* pDialogParent);
+ bool CheckIsReadonly(bool bSignScriptingContent, weld::Window* pDialogParent = nullptr);
+ void RecheckSignature(bool bAlsoRecheckScriptingSignature);
+ void AfterSigning(bool bSignSuccess, bool bSignScriptingContent);
+ bool HasValidSignatures() const;
+ SignatureState GetDocumentSignatureState();
+ void SignDocumentContent(weld::Window* pDialogParent);
+ css::uno::Sequence<css::security::DocumentSignatureInformation> GetDocumentSignatureInformation(
+ bool bScriptingContent,
+ const css::uno::Reference<css::security::XDocumentDigitalSignatures>& xSigner
+ = css::uno::Reference<css::security::XDocumentDigitalSignatures>());
+
+ bool SignDocumentContentUsingCertificate(const css::uno::Reference<css::security::XCertificate>& xCertificate);
+
+ void SignSignatureLine(weld::Window* pDialogParent, const OUString& aSignatureLineId,
+ const css::uno::Reference<css::security::XCertificate>& xCert,
+ const css::uno::Reference<css::graphic::XGraphic>& xValidGraphic,
+ const css::uno::Reference<css::graphic::XGraphic>& xInvalidGraphic,
+ const OUString& aComment);
+ SignatureState GetScriptingSignatureState();
+ void SignScriptingContent(weld::Window* pDialogParent);
+ DECL_DLLPRIVATE_LINK(SignDocumentHandler, weld::Button&, void);
+
+ virtual std::shared_ptr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(weld::Window* pParent, const SfxItemSet& rItemSet);
+
+ ErrCode CallBasic( std::u16string_view rMacro, std::u16string_view rBasicName,
+ SbxArray* pArgs, SbxValue* pRet = nullptr );
+
+ ErrCode CallXScript(
+ const OUString& rScriptURL,
+ const css::uno::Sequence< css::uno::Any >& aParams,
+ css::uno::Any& aRet,
+ css::uno::Sequence< sal_Int16 >& aOutParamIndex,
+ css::uno::Sequence< css::uno::Any >& aOutParam,
+ bool bRaiseError = true,
+ const css::uno::Any* aCaller = nullptr );
+
+ static ErrCode CallXScript(
+ const css::uno::Reference< css::uno::XInterface >& _rxScriptContext,
+ const OUString& rScriptURL,
+ const css::uno::Sequence< css::uno::Any >& aParams,
+ css::uno::Any& aRet,
+ css::uno::Sequence< sal_Int16 >& aOutParamIndex,
+ css::uno::Sequence< css::uno::Any >& aOutParam,
+ bool bRaiseError = true,
+ const css::uno::Any* aCaller = nullptr
+ );
+
+ /** adjusts the internal macro mode, according to the current security settings
+
+ Finally, the macro mode is either NEVER_EXECUTE or ALWAYS_EXECUTE_NO_WARN.
+
+ @return
+ whether macros from this document should be executed
+ */
+ bool AdjustMacroMode();
+
+ static bool UnTrustedScript(const OUString& rScriptURL);
+
+ static bool isScriptAccessAllowed(const css::uno::Reference<css::uno::XInterface>& rScriptContext);
+
+ SvKeyValueIterator* GetHeaderAttributes();
+ void ClearHeaderAttributesForSourceViewHack();
+ void SetHeaderAttributesForSourceViewHack();
+
+ bool IsQueryLoadTemplate() const;
+ bool IsUseUserData() const;
+ bool IsUseThumbnailSave() const;
+ bool IsLoadReadonly() const;
+ bool IsSaveVersionOnClose() const;
+ void SetQueryLoadTemplate( bool b );
+ void SetUseUserData( bool bNew );
+ void SetUseThumbnailSave( bool _bNew );
+ void SetLoadReadonly( bool _bReadonly );
+ void SetSaveVersionOnClose( bool bSet );
+ void ResetFromTemplate( const OUString& rTemplateName, const OUString& rFileName );
+
+ // TODO/LATER: the following two methods should be replaced by Get/SetModifPasswordInfo in future
+ sal_uInt32 GetModifyPasswordHash() const;
+ bool SetModifyPasswordHash( sal_uInt32 nHash );
+
+ void SetMacroCallsSeenWhileLoading();
+ bool GetMacroCallsSeenWhileLoading() const;
+
+ const css::uno::Sequence< css::beans::PropertyValue >& GetModifyPasswordInfo() const;
+ bool SetModifyPasswordInfo( const css::uno::Sequence< css::beans::PropertyValue >& aInfo );
+
+ static ErrCode HandleFilter( SfxMedium* pMedium, SfxObjectShell const * pDoc );
+
+ virtual bool PrepareClose(bool bUI = true);
+ virtual HiddenInformation GetHiddenInformationState( HiddenInformation nStates );
+ sal_Int16 QueryHiddenInformation( HiddenWarningFact eFact, weld::Window* pParent );
+ bool IsSecurityOptOpenReadOnly() const;
+ void SetSecurityOptOpenReadOnly( bool bOpenReadOnly );
+
+ Size GetFirstPageSize() const;
+ bool DoClose();
+ std::shared_ptr<GDIMetaFile> GetPreviewMetaFile( bool bFullContent = false ) const;
+ BitmapEx GetPreviewBitmap() const;
+ virtual void CancelTransfers();
+
+ bool GenerateAndStoreThumbnail(
+ bool bEncrypted,
+ const css::uno::Reference< css::embed::XStorage >& xStor );
+
+ bool WriteThumbnail(
+ bool bEncrypted,
+ const css::uno::Reference< css::io::XStream >& xStream );
+
+ bool IsInGenerateAndStoreThumbnail() const {return bIsInGenerateThumbnail;}//optimize thumbnail generate and store procedure to improve odt saving performance, i120030
+
+ /// Don't add to the recent documents - it's an expensive operation, sometimes it is not wanted.
+ bool IsAvoidRecentDocs() const { return mbAvoidRecentDocs; }
+
+ /// Don't add to the recent documents - it's an expensive operation, sometimes it is not wanted.
+ void AvoidRecentDocs(bool bAvoid) { mbAvoidRecentDocs = bAvoid; }
+
+ /// On first error ask user if import should continue; return saved answer.
+ bool IsContinueImportOnFilterExceptions(std::u16string_view aErrMessage);
+
+ // Transfer IFace
+ bool IsAbortingImport() const;
+ void FinishedLoading( SfxLoadedFlags nWhich = SfxLoadedFlags::ALL );
+
+ void TemplateDisconnectionAfterLoad();
+ void SetLoading(SfxLoadedFlags nFlags);
+ bool IsLoading() const;
+ bool IsLoadingFinished() const;
+ void SetAutoLoad( const INetURLObject&, sal_uInt32 nTime, bool bReload );
+ bool IsAutoLoadLocked() const;
+
+ // Misc
+ bool IsPreview() const;
+ SfxObjectCreateMode GetCreateMode() const { return eCreateMode; }
+ SfxProgress* GetProgress() const;
+ void SetWaitCursor( bool bSet ) const;
+
+ // Naming Interface
+ void SetTitle( const OUString& rTitle );
+ /* Small non-zero values of nMaxLen don't mean length, but have a magic meaning:
+ 0 (default)
+ the title itself, as it is
+
+ 1 (==SFX_TITLE_FILENAME)
+ provides the logical file name without path
+ (under WNT depending on the system settings
+ without extension)
+
+ 2 (==SFX_TITLE_FULLNAME)
+ provides the logical file names with full path
+ (remote =>:: com:: sun:: star:: util:: URL)
+
+ 3 (==SFX_TITLE_APINAME)
+ provides the logical filename without path
+ and extension
+
+ 4 (==SFX_TITLE_DETECT)
+ provides the complete title, if not set yet
+ it will be created from DocInfo or the name of
+ the medium.
+
+ 5 (==SFX_TITLE_CAPTION)
+ provides the Title just like MB now in the
+ CaptionBar view
+
+ 6 (==SFX_TITLE_PICKLIST)
+ returns the Title, just like MB now would
+ display it in the PickList
+
+ 7 (==SFX_TITLE_HISTORY)
+ returns the Title just like MB now would
+ display it in the History
+
+ 10 bis USHRT_MAX
+ provides the 'nMaxLength' of the logical
+ file name including the path
+ (remote => css::util::URL)
+ */
+ OUString GetTitle( sal_uInt16 nMaxLen = 0 ) const;
+ void InvalidateName(); // Re-set to unnamed
+
+#if defined(_WIN32)
+ // DDE-Interface
+ bool DdeExecute( const OUString& rCmd );
+ virtual bool DdeGetData( const OUString& rItem,
+ const OUString& rMimeType,
+ css::uno::Any & rValue );
+ virtual bool DdeSetData( const OUString& rItem,
+ const OUString& rMimeType,
+ const css::uno::Any & rValue );
+#endif
+ virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const OUString& rItem );
+ virtual void ReconnectDdeLink(SfxObjectShell& rServer);
+
+ static void ReconnectDdeLinks(SfxObjectShell& rServer);
+
+ // Contents
+ virtual SfxStyleSheetBasePool* GetStyleSheetPool();
+
+ virtual void LoadStyles(SfxObjectShell &rSource);
+
+ virtual sfx2::StyleManager* GetStyleManager();
+
+ // Determine the position of the "Automatic" filter in the stylist
+ void SetAutoStyleFilterIndex(sal_uInt16 nSet);
+ sal_uInt16 GetAutoStyleFilterIndex() const;
+ bool HasBasic() const;
+ BasicManager* GetBasicManager() const;
+ css::uno::Reference< css::script::XLibraryContainer >
+ GetBasicContainer();
+ css::uno::Reference< css::script::XLibraryContainer >
+ GetDialogContainer();
+ StarBASIC* GetBasic() const;
+
+ virtual std::set<Color> GetDocColors();
+ virtual std::vector<Color> GetThemeColors();
+
+ // Accessibility Check
+ virtual sfx::AccessibilityIssueCollection runAccessibilityCheck();
+
+ // Documents, for which to format the view size
+
+ virtual SfxObjectShell* GetObjectShell() override;
+
+ css::uno::Reference< css::frame::XModel3 >
+ GetModel() const;
+ // Only temporarily for the applications!
+ void SetBaseModel( SfxBaseModel* pModel );
+ css::uno::Reference< css::frame::XModel3 > GetBaseModel() const;
+ // Only temporarily for the applications!
+
+ virtual css::uno::Sequence< OUString > GetEventNames();
+
+ css::uno::Reference<css::awt::XWindow> GetDialogParent(SfxMedium const* pMedium = nullptr);
+ static SfxObjectShell* CreateObject( const OUString& rServiceName, SfxObjectCreateMode = SfxObjectCreateMode::STANDARD );
+ static SfxObjectShell* CreateObjectByFactoryName( const OUString& rURL, SfxObjectCreateMode = SfxObjectCreateMode::STANDARD );
+ static css::uno::Reference< css::lang::XComponent >
+ CreateAndLoadComponent( const SfxItemSet& rSet );
+ static SfxObjectShell* GetShellFromComponent(const css::uno::Reference< css::uno::XInterface >& xComp);
+ static SfxObjectShell* GetParentShell(const css::uno::Reference<css::uno::XInterface>& xChild);
+ static OUString GetServiceNameFromFactory( const OUString& rFact );
+ bool IsInPlaceActive() const;
+ bool IsUIActive() const;
+
+ static bool CopyStoragesOfUnknownMediaType(
+ const css::uno::Reference< css::embed::XStorage >& xSource,
+ const css::uno::Reference<css::embed::XStorage>& xTarget,
+ const css::uno::Sequence<OUString>& rExceptions = css::uno::Sequence<OUString>());
+
+ bool isEditDocLocked() const;
+ bool isContentExtractionLocked() const;
+ bool isExportLocked() const;
+ bool isPrintLocked() const;
+ bool isSaveLocked() const;
+
+ // The functions from SvPersist
+ void EnableSetModified( bool bEnable = true );
+ bool IsEnableSetModified() const;
+ virtual void SetModified( bool bModified = true );
+ bool IsModified() const;
+
+ /**
+ * @param bChart true if the file is a chart doc and FillClass should not be called
+ */
+ void SetupStorage(
+ const css::uno::Reference< css::embed::XStorage >& xStorage,
+ sal_Int32 nVersion, bool bTemplate ) const;
+
+ css::uno::Reference< css::embed::XStorage > const & GetStorage();
+
+ SvGlobalName const & GetClassName() const;
+
+ // comphelper::IEmbeddedHelper
+ virtual css::uno::Reference< css::task::XInteractionHandler > getInteractionHandler() const override;
+ virtual css::uno::Reference < css::embed::XStorage > getStorage() const override
+ {
+ return const_cast<SfxObjectShell*>(this)->GetStorage();
+ }
+ virtual comphelper::EmbeddedObjectContainer& getEmbeddedObjectContainer() const override
+ {
+ return GetEmbeddedObjectContainer();
+ }
+ bool isEnableSetModified() const override
+ {
+ return IsEnableSetModified();
+ }
+ virtual OUString getDocumentBaseURL() const override;
+
+ comphelper::EmbeddedObjectContainer& GetEmbeddedObjectContainer() const;
+ void ClearEmbeddedObjects();
+
+ // The functions from SvEmbeddedObject
+ virtual Printer * GetDocumentPrinter();
+ virtual OutputDevice* GetDocumentRefDev();
+ virtual void OnDocumentPrinterChanged( Printer * pNewPrinter );
+ virtual tools::Rectangle GetVisArea( sal_uInt16 nAspect ) const;
+ virtual void SetVisArea( const tools::Rectangle & rVisArea );
+ const tools::Rectangle & GetVisArea() const;
+ void SetVisAreaSize( const Size & rVisSize );
+
+ MapUnit GetMapUnit() const;
+ void SetMapUnit( MapUnit nMUnit );
+
+ void FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ) const;
+ void DoDraw( OutputDevice *, const Point & rObjPos,
+ const Size & rSize,
+ const JobSetup & rSetup,
+ sal_uInt16 nAspect = ASPECT_CONTENT );
+ virtual void Draw( OutputDevice *, const JobSetup & rSetup,
+ sal_uInt16 nAspect ) = 0;
+
+
+ virtual void FillClass( SvGlobalName * pClassName,
+ SotClipboardFormatId * pFormat,
+ OUString * pFullTypeName,
+ sal_Int32 nVersion,
+ bool bTemplate = false) const = 0;
+
+ // change recording and respective passwword protection for Writer and Calc
+ // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON
+ // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT
+ virtual bool IsChangeRecording() const;
+ virtual bool HasChangeRecordProtection() const;
+ virtual void SetChangeRecording( bool bActivate, bool bLockAllViews = false );
+ virtual void SetProtectionPassword( const OUString &rPassword );
+ virtual bool GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPasswordHash );
+
+ static bool IsOwnStorageFormat(const SfxMedium &);
+
+ /** Append Infobar once the frame is ready.
+ Useful when you want to register an Infobar before the doc/frame is fully loaded. */
+ void AppendInfoBarWhenReady(const OUString& sId, const OUString& sPrimaryMessage,
+ const OUString& sSecondaryMessage, InfobarType aInfobarType,
+ bool bShowCloseButton = true);
+ std::vector<InfobarData>& getPendingInfobars();
+
+ SAL_DLLPRIVATE bool CreatePreview_Impl(bool bFullContent, VirtualDevice* pDevice, GDIMetaFile* pFile) const;
+
+ SAL_DLLPRIVATE static bool IsPackageStorageFormat_Impl(const SfxMedium &);
+
+ SAL_DLLPRIVATE bool ConnectTmpStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xStorage, SfxMedium* pMedium );
+ SAL_DLLPRIVATE bool DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& rTargetMedium );
+
+ SAL_DLLPRIVATE bool PutURLContentsToVersionStream_Impl(
+ const OUString& aURL,
+ const css::uno::Reference< css::embed::XStorage >& xDocStorage,
+ const OUString& aStreamName );
+
+ SAL_DLLPRIVATE OUString CreateTempCopyOfStorage_Impl(
+ const css::uno::Reference< css::embed::XStorage >& xStorage );
+
+ SAL_DLLPRIVATE void InitOwnModel_Impl();
+ SAL_DLLPRIVATE void BreakMacroSign_Impl( bool bBreakMacroSing );
+ SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl();
+ SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl();
+ SAL_DLLPRIVATE void CheckEncryption_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler );
+ SAL_DLLPRIVATE void SetModifyPasswordEntered( bool bEntered = true );
+ SAL_DLLPRIVATE bool IsModifyPasswordEntered() const;
+
+ SAL_DLLPRIVATE void InitBasicManager_Impl();
+ SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImpl.get(); }
+
+ SAL_DLLPRIVATE static bool UseInteractionToHandleError(
+ const css::uno::Reference< css::task::XInteractionHandler >& xHandler,
+ ErrCode nError );
+ SAL_DLLPRIVATE const SfxObjectShell_Impl* Get_Impl() const { return pImpl.get(); }
+
+ SAL_DLLPRIVATE void SetCreateMode_Impl( SfxObjectCreateMode nMode );
+
+ SAL_DLLPRIVATE void DoDraw_Impl( OutputDevice* pDev,
+ const Point & rViewPos,
+ const Fraction & rScaleX,
+ const Fraction & rScaleY,
+ const JobSetup & rSetup,
+ sal_uInt16 nAspect );
+
+ // Shell Interface
+ SAL_DLLPRIVATE void ExecFile_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&);
+ SAL_DLLPRIVATE void PrintExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void PrintState_Impl(SfxItemSet&);
+ SAL_DLLPRIVATE void ExecProps_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void StateProps_Impl(SfxItemSet &);
+ SAL_DLLPRIVATE void ExecView_Impl(SfxRequest &);
+ SAL_DLLPRIVATE static void StateView_Impl(SfxItemSet &);
+
+ // Load/Save public internals
+ SAL_DLLPRIVATE bool ImportFromGeneratedStream_Impl(
+ const css::uno::Reference< css::io::XStream >& xStream,
+ const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr );
+ SAL_DLLPRIVATE void UpdateFromTemplate_Impl();
+ SAL_DLLPRIVATE bool CanReload_Impl();
+ SAL_DLLPRIVATE void SetNamedVisibility_Impl();
+ SAL_DLLPRIVATE bool DoSave_Impl( const SfxItemSet* pSet );
+ SAL_DLLPRIVATE bool Save_Impl( const SfxItemSet* pSet );
+ SAL_DLLPRIVATE bool
+ PreDoSaveAs_Impl(const OUString& rFileName, const OUString& rFiltName,
+ SfxItemSet const& rItemSet,
+ const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
+ SAL_DLLPRIVATE bool APISaveAs_Impl(std::u16string_view aFileName, SfxItemSet& rItemSet,
+ const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
+ SAL_DLLPRIVATE bool
+ CommonSaveAs_Impl(const INetURLObject& aURL, const OUString& aFilterName, SfxItemSet& rItemSet,
+ const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
+ SAL_DLLPRIVATE bool GeneralInit_Impl(
+ const css::uno::Reference< css::embed::XStorage >& xStorage,
+ bool bTypeMustBeSetAlready );
+ SAL_DLLPRIVATE void PrepareSecondTryLoad_Impl();
+ SAL_DLLPRIVATE void SetInitialized_Impl( const bool i_fromInitNew );
+
+ // public-internals
+ SAL_DLLPRIVATE IndexBitSet& GetNoSet_Impl();
+ SAL_DLLPRIVATE void SetProgress_Impl( SfxProgress *pProgress );
+ SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame const * );
+ SAL_DLLPRIVATE void SetActivateEvent_Impl(SfxEventHintId );
+
+ // configuration items
+ SAL_DLLPRIVATE SignatureState ImplGetSignatureState( bool bScriptingContent = false );
+
+ SAL_DLLPRIVATE bool QuerySaveSizeExceededModules_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler );
+ SAL_DLLPRIVATE static bool QueryAllowExoticFormat_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler,
+ const OUString& rURL,
+ const OUString& rFilterUIName);
+
+ SAL_DLLPRIVATE void CheckOut( );
+ SAL_DLLPRIVATE void CancelCheckOut( );
+ SAL_DLLPRIVATE void CheckIn( );
+ SAL_DLLPRIVATE css::uno::Sequence< css::document::CmisVersion > GetCmisVersions() const;
+
+ /** override this if you have a XmlIdRegistry. */
+ virtual const sfx2::IXmlIdRegistry* GetXmlIdRegistry() const { return nullptr; }
+
+ /// Is this read-only object shell opened via .uno:SignPDF?
+ bool IsSignPDF() const;
+
+ /// Gets the certificate that is already picked by the user but not yet used for signing.
+ css::uno::Reference<css::security::XCertificate> GetSignPDFCertificate() const;
+
+ /// Gets grab-bagged password info to unprotect change tracking with verification
+ css::uno::Sequence< css::beans::PropertyValue > GetDocumentProtectionFromGrabBag() const;
+
+ // Lock all unlocked views, and returns a guard object which unlocks those views when destructed
+ virtual std::unique_ptr<LockAllViewsGuard> LockAllViews()
+ {
+ return std::make_unique<LockAllViewsGuard>();
+ }
+
+};
+
+#define SFX_GLOBAL_CLASSID \
+ 0x9eaba5c3, 0xb232, 0x4309, \
+ 0x84, 0x5f, 0x5f, 0x15, 0xea, 0x50, 0xd0, 0x74
+
+ struct ModifyBlocker_Impl
+ {
+ SfxObjectShell* pPersist;
+ bool bWasEnabled;
+ ModifyBlocker_Impl( SfxObjectShell* pPersistP ) : pPersist( pPersistP )
+ {
+ bWasEnabled = pPersistP->IsEnableSetModified();
+ if ( bWasEnabled )
+ pPersistP->EnableSetModified( false );
+ }
+ ~ModifyBlocker_Impl()
+ {
+ if ( bWasEnabled )
+ pPersist->EnableSetModified( bWasEnabled );
+ }
+ };
+
+
+typedef tools::SvRef<SfxObjectShell> SfxObjectShellRef;
+
+class SfxObjectShellLock
+{
+ SfxObjectShell * pObj;
+public:
+ SfxObjectShellLock() { pObj = nullptr; }
+ inline SfxObjectShellLock( const SfxObjectShellLock & rObj );
+ inline SfxObjectShellLock( SfxObjectShellLock && rObj ) noexcept;
+ inline SfxObjectShellLock( SfxObjectShell * pObjP );
+ inline void Clear();
+ inline ~SfxObjectShellLock();
+ inline SfxObjectShellLock & operator = ( const SfxObjectShellLock & rObj );
+ inline SfxObjectShellLock & operator = ( SfxObjectShellLock && rObj );
+ inline SfxObjectShellLock & operator = ( SfxObjectShell * pObj );
+ bool Is() const { return pObj != nullptr; }
+ SfxObjectShell * operator & () const { return pObj; }
+ SfxObjectShell * operator -> () const { return pObj; }
+ SfxObjectShell & operator * () const { return *pObj; }
+ operator SfxObjectShell * () const { return pObj; }
+};
+inline SfxObjectShellLock::SfxObjectShellLock( const SfxObjectShellLock & rObj )
+{
+ pObj = rObj.pObj;
+ if( pObj )
+ pObj->OwnerLock( true );
+}
+inline SfxObjectShellLock::SfxObjectShellLock( SfxObjectShellLock && rObj ) noexcept
+{
+ pObj = rObj.pObj;
+ rObj.pObj = nullptr;
+}
+inline SfxObjectShellLock::SfxObjectShellLock( SfxObjectShell * pObjP )
+{
+ pObj = pObjP;
+ if( pObj )
+ pObj->OwnerLock( true );
+}
+inline void SfxObjectShellLock::Clear()
+{
+ if( pObj )
+ {
+ SfxObjectShell* const pRefObj = pObj;
+ pObj = nullptr;
+ pRefObj->OwnerLock( false );
+ }
+}
+inline SfxObjectShellLock::~SfxObjectShellLock()
+{
+ if( pObj )
+ pObj->OwnerLock( false );
+}
+inline SfxObjectShellLock & SfxObjectShellLock::operator=( const SfxObjectShellLock & rObj )
+{
+ if( rObj.pObj )
+ rObj.pObj->OwnerLock( true );
+ SfxObjectShell* const pRefObj = pObj;
+ pObj = rObj.pObj;
+ if( pRefObj )
+ pRefObj->OwnerLock( false );
+ return *this;
+}
+inline SfxObjectShellLock & SfxObjectShellLock::operator=( SfxObjectShellLock && rObj )
+{
+ if (pObj)
+ pObj->OwnerLock( false );
+ pObj = rObj.pObj;
+ rObj.pObj = nullptr;
+ return *this;
+}
+inline SfxObjectShellLock & SfxObjectShellLock::operator=( SfxObjectShell * pObjP )
+{
+ *this = SfxObjectShellLock( pObjP );
+ return *this;
+}
+
+class SFX2_DLLPUBLIC SfxObjectShellItem final : public SfxPoolItem
+{
+ SfxObjectShell* pObjSh;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SfxObjectShellItem() :
+ SfxPoolItem( 0 ),
+ pObjSh( nullptr )
+ {}
+ SfxObjectShellItem( sal_uInt16 nWhichId,
+ SfxObjectShell *pObjShell ):
+ SfxPoolItem( nWhichId ),
+ pObjSh( pObjShell )
+ {}
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxObjectShellItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/opengrf.hxx b/include/sfx2/opengrf.hxx
new file mode 100644
index 000000000..d28f88c4f
--- /dev/null
+++ b/include/sfx2/opengrf.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_OPENGRF_HXX
+#define INCLUDED_SFX2_OPENGRF_HXX
+
+#include <memory>
+#include <sfx2/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <vcl/errcode.hxx>
+
+namespace com::sun::star::ui::dialogs { class XFilePickerControlAccess; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace weld { class Window; }
+
+class Graphic;
+struct SvxOpenGrf_Impl;
+
+class SFX2_DLLPUBLIC SvxOpenGraphicDialog
+{
+public:
+ SvxOpenGraphicDialog(const OUString& rTitle, weld::Window* pPreferredParent);
+ SvxOpenGraphicDialog(const OUString& rTitle, weld::Window* pPreferredParent,
+ sal_Int16 nDialogType);
+ ~SvxOpenGraphicDialog();
+
+ ErrCode Execute();
+
+ void SetPath( const OUString& rPath, bool bLinkState );
+ OUString GetPath() const;
+
+ ErrCode GetGraphic(Graphic&) const;
+
+ void EnableLink(bool);
+ void AsLink(bool);
+ bool IsAsLink() const;
+
+ //what the dialog thought the format was
+ OUString GetCurrentFilter() const;
+ void SetCurrentFilter(const OUString&);
+
+ //what was subsequently found to be the format
+ OUString const & GetDetectedFilter() const;
+ void SetDetectedFilter(const OUString&);
+
+ css::uno::Reference<css::ui::dialogs::XFilePickerControlAccess> const & GetFilePickerControlAccess() const;
+
+private:
+ SvxOpenGraphicDialog (const SvxOpenGraphicDialog&) = delete;
+ SvxOpenGraphicDialog& operator = ( const SvxOpenGraphicDialog & ) = delete;
+
+ const std::unique_ptr< SvxOpenGrf_Impl > mpImpl;
+};
+
+#endif // _SVX_OPENGRF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/pageids.hxx b/include/sfx2/pageids.hxx
new file mode 100644
index 000000000..9371848b7
--- /dev/null
+++ b/include/sfx2/pageids.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_PAGEIDS_HXX
+#define INCLUDED_SFX2_PAGEIDS_HXX
+
+#include <svl/solar.hrc>
+
+#define RID_OPTIONS_START (SID_LIB_START + 2000)
+// RID_OPTIONS_END (RID_OPTIONS_START + 100)
+
+// ResId's ------------------------------------------------------------------
+
+#define RID_SFXPAGE_SAVE (RID_OPTIONS_START + 0)
+#define RID_SFXPAGE_GENERAL (RID_OPTIONS_START + 1)
+#define RID_SFXPAGE_PATH (RID_OPTIONS_START + 6)
+#define RID_SFXPAGE_LINGU (RID_OPTIONS_START + 7)
+
+#define RID_SFXPAGE_PRINTOPTIONS (RID_OPTIONS_START + 12)
+
+// treeopt
+#define RID_SVXPAGE_COLOR (RID_SVX_START + 60)
+#define OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE ( RID_OFA_START + 256 )
+
+// options
+#define RID_SVXPAGE_ONLINEUPDATE (RID_SVX_START + 298)
+#define RID_SVXPAGE_INET_SECURITY (RID_SVX_START + 200)
+#define RID_SVXPAGE_INET_PROXY (RID_SVX_START + 157)
+#define RID_SVXPAGE_INET_MAIL (RID_SVX_START + 155)
+#define RID_OFAPAGE_HTMLOPT (RID_OFA_START + 100)
+#define OFA_TP_LANGUAGES (RID_OFA_START + 205)
+#define OFA_TP_MISC (RID_OFA_START + 200)
+#define OFA_TP_VIEW (RID_OFA_START + 202)
+#define RID_OFAPAGE_MSFILTEROPT2 (RID_OFA_START + 121)
+#define RID_SVXPAGE_OPTIONS_CTL (RID_SVX_START + 252)
+#define RID_SVXPAGE_OPTIONS_JAVA (RID_SVX_START + 253)
+#define RID_SVXPAGE_ACCESSIBILITYCONFIG (RID_SVX_START + 250)
+#define RID_SVXPAGE_ASIAN_LAYOUT (RID_SVX_START + 246)
+#define RID_OPTPAGE_CHART_DEFCOLORS (RID_SVX_START + 299)
+#define RID_SVXPAGE_PERSONALIZATION (RID_SVX_START + 247)
+#define RID_SVXPAGE_COLORCONFIG (RID_SVX_START + 249)
+#define RID_SVXPAGE_BASICIDE_OPTIONS (RID_SVX_START + 209)
+#define RID_SVXPAGE_LANGTOOL_OPTIONS (RID_SVX_START + 210)
+
+// Resource-Id's ------------------------------------------------------------
+
+// options
+#define RID_SVXPAGE_JSEARCH_OPTIONS (RID_SVX_START + 840)
+#define RID_SVX_FONT_SUBSTITUTION (RID_SVX_START + 18)
+
+#define RID_SVXPAGE_OPENCL (RID_SVX_START + 254)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/passwd.hxx b/include/sfx2/passwd.hxx
new file mode 100644
index 000000000..3302c370b
--- /dev/null
+++ b/include/sfx2/passwd.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_PASSWD_HXX
+#define INCLUDED_SFX2_PASSWD_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <vcl/weld.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+// defines ---------------------------------------------------------------
+
+enum class SfxShowExtras
+{
+ NONE = 0x0000,
+ USER = 0x0001,
+ CONFIRM = 0x0002,
+ PASSWORD2 = 0x0004,
+ CONFIRM2 = 0x0008,
+ ALL = USER | CONFIRM
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SfxShowExtras> : is_typed_flags<SfxShowExtras, 0x0f> {};
+}
+
+// class SfxPasswordDialog -----------------------------------------------
+
+class SFX2_DLLPUBLIC SfxPasswordDialog final : public weld::GenericDialogController
+{
+private:
+ std::unique_ptr<weld::Frame> m_xPassword1Box;
+ std::unique_ptr<weld::Label> m_xUserFT;
+ std::unique_ptr<weld::Entry> m_xUserED;
+ std::unique_ptr<weld::Label> m_xPassword1FT;
+ std::unique_ptr<weld::Entry> m_xPassword1ED;
+ std::unique_ptr<weld::Label> m_xConfirm1FT;
+ std::unique_ptr<weld::Entry> m_xConfirm1ED;
+
+ std::unique_ptr<weld::Frame> m_xPassword2Box;
+ std::unique_ptr<weld::Label> m_xPassword2FT;
+ std::unique_ptr<weld::Entry> m_xPassword2ED;
+ std::unique_ptr<weld::Label> m_xConfirm2FT;
+ std::unique_ptr<weld::Entry> m_xConfirm2ED;
+
+ std::unique_ptr<weld::Label> m_xMinLengthFT;
+ std::unique_ptr<weld::Label> m_xOnlyAsciiFT;
+
+ std::unique_ptr<weld::Button> m_xOKBtn;
+
+ OUString maMinLenPwdStr;
+ OUString maMinLenPwdStr1;
+ OUString maEmptyPwdStr;
+ OUString maMainPwdStr;
+ sal_uInt16 mnMinLen;
+ SfxShowExtras mnExtras;
+
+ bool mbAsciiOnly;
+ DECL_DLLPRIVATE_LINK(OKHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(InsertTextHdl, OUString&, bool);
+ DECL_DLLPRIVATE_LINK(EditModifyHdl, weld::Entry&, void);
+ void ModifyHdl();
+
+ void SetPasswdText();
+
+public:
+ SfxPasswordDialog(weld::Widget* pParent, const OUString* pGroupText = nullptr);
+
+ OUString GetUser() const
+ {
+ return m_xUserED->get_text();
+ }
+ OUString GetPassword() const
+ {
+ return m_xPassword1ED->get_text();
+ }
+ OUString GetConfirm() const
+ {
+ return m_xConfirm1ED->get_text();
+ }
+ OUString GetPassword2() const
+ {
+ return m_xPassword2ED->get_text();
+ }
+ void SetGroup2Text(const OUString& i_rText)
+ {
+ m_xPassword2Box->set_label(i_rText);
+ }
+ void SetMinLen(sal_uInt16 Len);
+ void SetEditHelpId(const OString& rId)
+ {
+ m_xPassword1ED->set_help_id(rId);
+ }
+ /* tdf#60874 we need a custom help ID for the Confirm
+ field of the Protect Document window */
+ void SetConfirmHelpId(const OString& rId)
+ {
+ m_xConfirm1ED->set_help_id(rId);
+ }
+
+ void ShowExtras(SfxShowExtras nExtras)
+ {
+ mnExtras = nExtras;
+ }
+
+ void AllowAsciiOnly();
+ void ShowMinLengthText(bool bShow);
+
+ virtual short run() override;
+};
+
+#endif // INCLUDED_SFX2_PASSWD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/printer.hxx b/include/sfx2/printer.hxx
new file mode 100644
index 000000000..8d10b2cc7
--- /dev/null
+++ b/include/sfx2/printer.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_PRINTER_HXX
+#define INCLUDED_SFX2_PRINTER_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <vcl/print.hxx>
+
+class SfxItemSet;
+
+// class SfxPrinter ------------------------------------------------------
+
+class SFX2_DLLPUBLIC SfxPrinter final : public Printer
+{
+private:
+ std::unique_ptr<SfxItemSet> pOptions;
+ bool bKnown;
+
+ SfxPrinter& operator =(SfxPrinter const &) = delete;
+
+public:
+ SfxPrinter( std::unique_ptr<SfxItemSet> &&pTheOptions );
+ SfxPrinter( std::unique_ptr<SfxItemSet> &&pTheOptions,
+ const OUString &rPrinterName );
+ SfxPrinter( std::unique_ptr<SfxItemSet> &&pTheOptions,
+ const JobSetup &rTheOrigJobSetup );
+ SfxPrinter( const SfxPrinter &rPrinter );
+ virtual ~SfxPrinter() override;
+ virtual void dispose() override;
+
+ VclPtr<SfxPrinter> Clone() const;
+
+ static VclPtr<SfxPrinter> Create( SvStream &rStream, std::unique_ptr<SfxItemSet> &&pOptions );
+ void Store( SvStream &rStream ) const;
+
+ const SfxItemSet& GetOptions() const { return *pOptions; }
+ void SetOptions( const SfxItemSet &rNewOptions );
+
+ bool IsKnown() const { return bKnown; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/printopt.hxx b/include/sfx2/printopt.hxx
new file mode 100644
index 000000000..ef7fd4683
--- /dev/null
+++ b/include/sfx2/printopt.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_PRINTOPT_HXX
+#define INCLUDED_SFX2_PRINTOPT_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/tabdlg.hxx>
+#include <sal/types.h>
+#include <vcl/printer/Options.hxx>
+
+class SFX2_DLLPUBLIC SfxCommonPrintOptionsTabPage final : public SfxTabPage
+{
+private:
+
+ std::unique_ptr<weld::RadioButton> m_xPrinterOutputRB;
+ std::unique_ptr<weld::RadioButton> m_xPrintFileOutputRB;
+ std::unique_ptr<weld::CheckButton> m_xReduceTransparencyCB;
+ std::unique_ptr<weld::RadioButton> m_xReduceTransparencyAutoRB;
+ std::unique_ptr<weld::RadioButton> m_xReduceTransparencyNoneRB;
+ std::unique_ptr<weld::CheckButton> m_xReduceGradientsCB;
+ std::unique_ptr<weld::RadioButton> m_xReduceGradientsStripesRB;
+ std::unique_ptr<weld::RadioButton> m_xReduceGradientsColorRB;
+ std::unique_ptr<weld::SpinButton> m_xReduceGradientsStepCountNF;
+ std::unique_ptr<weld::CheckButton> m_xReduceBitmapsCB;
+ std::unique_ptr<weld::RadioButton> m_xReduceBitmapsOptimalRB;
+ std::unique_ptr<weld::RadioButton> m_xReduceBitmapsNormalRB;
+ std::unique_ptr<weld::RadioButton> m_xReduceBitmapsResolutionRB;
+ std::unique_ptr<weld::ComboBox> m_xReduceBitmapsResolutionLB;
+ std::unique_ptr<weld::CheckButton> m_xReduceBitmapsTransparencyCB;
+ std::unique_ptr<weld::CheckButton> m_xConvertToGreyscalesCB;
+ std::unique_ptr<weld::CheckButton> m_xPDFCB;
+ std::unique_ptr<weld::CheckButton> m_xPaperSizeCB;
+ std::unique_ptr<weld::CheckButton> m_xPaperOrientationCB;
+ std::unique_ptr<weld::CheckButton> m_xTransparencyCB;
+
+private:
+
+ vcl::printer::Options maPrinterOptions;
+ vcl::printer::Options maPrintFileOptions;
+
+ DECL_DLLPRIVATE_LINK( ToggleOutputPrinterRBHdl, weld::Toggleable&, void );
+ DECL_DLLPRIVATE_LINK( ToggleOutputPrintFileRBHdl, weld::Toggleable&, void);
+
+ DECL_DLLPRIVATE_LINK( ClickReduceTransparencyCBHdl, weld::Toggleable&, void );
+ DECL_DLLPRIVATE_LINK( ClickReduceGradientsCBHdl, weld::Toggleable&, void );
+ DECL_DLLPRIVATE_LINK( ClickReduceBitmapsCBHdl, weld::Toggleable&, void );
+
+ DECL_DLLPRIVATE_LINK( ToggleReduceGradientsStripesRBHdl, weld::Toggleable&, void );
+ DECL_DLLPRIVATE_LINK( ToggleReduceBitmapsResolutionRBHdl, weld::Toggleable&, void );
+
+ SAL_DLLPRIVATE void ImplUpdateControls( const vcl::printer::Options* pCurrentOptions );
+ SAL_DLLPRIVATE void ImplSaveControls( vcl::printer::Options* pCurrentOptions );
+
+ virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
+
+public:
+
+ SfxCommonPrintOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
+ virtual ~SfxCommonPrintOptionsTabPage() override;
+ virtual bool FillItemSet( SfxItemSet* rSet ) override;
+ virtual void Reset( const SfxItemSet* rSet ) override;
+
+ static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*);
+};
+
+#endif // INCLUDED_SFX2_PRINTOPT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/progress.hxx b/include/sfx2/progress.hxx
new file mode 100644
index 000000000..ceee49b6c
--- /dev/null
+++ b/include/sfx2/progress.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_PROGRESS_HXX
+#define INCLUDED_SFX2_PROGRESS_HXX
+
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sal/types.h>
+#include <sfx2/dllapi.h>
+#include <memory>
+
+
+class SfxObjectShell;
+struct SfxProgress_Impl;
+
+class SFX2_DLLPUBLIC SfxProgress
+{
+ std::unique_ptr< SfxProgress_Impl > pImpl;
+ sal_uInt32 nVal;
+ bool bSuspended;
+
+public:
+ SfxProgress( SfxObjectShell* pObjSh,
+ const OUString& rText,
+ sal_uInt32 nRange,
+ bool bWait = true);
+ virtual ~SfxProgress();
+
+ void SetState( sal_uInt32 nVal, sal_uInt32 nNewRange = 0 );
+ sal_uInt32 GetState() const { return nVal; }
+
+ void Resume();
+ void Suspend();
+ bool IsSuspended() const { return bSuspended; }
+
+ static void Reschedule();
+
+ void Stop();
+
+ static SfxProgress* GetActiveProgress( SfxObjectShell const *pDocSh = nullptr );
+ static void EnterLock();
+ static void LeaveLock();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/request.hxx b/include/sfx2/request.hxx
new file mode 100644
index 000000000..5a97cb9e6
--- /dev/null
+++ b/include/sfx2/request.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_REQUEST_HXX
+#define INCLUDED_SFX2_REQUEST_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <svl/itemset.hxx>
+#include <svl/hint.hxx>
+
+#include <memory>
+
+class SfxPoolItem;
+class SfxItemPool;
+class SfxShell;
+class SfxSlot;
+class SfxViewFrame;
+struct SfxRequest_Impl;
+enum class SfxCallMode : sal_uInt16;
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::frame { class XDispatchRecorder; }
+namespace com::sun::star::uno { template <class E> class Sequence; }
+namespace weld { class Window; }
+
+class SFX2_DLLPUBLIC SfxRequest final : public SfxHint
+{
+friend struct SfxRequest_Impl;
+
+ sal_uInt16 nSlot;
+ std::unique_ptr<SfxAllItemSet> pArgs;
+ std::unique_ptr< SfxRequest_Impl > pImpl;
+
+public:
+ SAL_DLLPRIVATE void Record_Impl( SfxShell &rSh, const SfxSlot &rSlot,
+ const css::uno::Reference< css::frame::XDispatchRecorder >& xRecorder,
+ SfxViewFrame* );
+private:
+ SAL_DLLPRIVATE void Done_Impl( const SfxItemSet *pSet );
+
+public:
+ SfxRequest( SfxViewFrame*, sal_uInt16 nSlotId );
+ SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, SfxItemPool &rPool );
+ SfxRequest( const SfxSlot* pSlot, const css::uno::Sequence < css::beans::PropertyValue >& rArgs,
+ SfxCallMode nCallMode, SfxItemPool &rPool );
+ SfxRequest(sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs);
+ SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs, const SfxAllItemSet& rSfxInternalArgs );
+ SfxRequest( const SfxRequest& rOrig );
+ virtual ~SfxRequest() override;
+
+ sal_uInt16 GetSlot() const { return nSlot; }
+ void SetSlot(sal_uInt16 nNewSlot) { nSlot = nNewSlot; }
+
+ sal_uInt16 GetModifier() const;
+ void SetModifier( sal_uInt16 nModi );
+ void SetInternalArgs_Impl( const SfxAllItemSet& rArgs );
+ SAL_DLLPRIVATE const SfxItemSet* GetInternalArgs_Impl() const;
+ const SfxItemSet* GetArgs() const { return pArgs.get(); }
+ void SetArgs( const SfxAllItemSet& rArgs );
+ void AppendItem(const SfxPoolItem &);
+ void RemoveItem( sal_uInt16 nSlotId );
+
+ /** Templatized access to the individual parameters of the SfxRequest.
+
+ Use like: const SfxInt32Item *pPosItem = rReq.GetArg<SfxInt32Item>(SID_POS);
+ */
+ template<class T> const T* GetArg(sal_uInt16 nSlotId) const
+ {
+ if (!pArgs)
+ return nullptr;
+ return pArgs->GetItem<T>(nSlotId, false);
+ }
+ template<class T> const T* GetArg(TypedWhichId<T> nSlotId) const
+ {
+ if (!pArgs)
+ return nullptr;
+ return pArgs->GetItem(nSlotId, false);
+ }
+
+ void ReleaseArgs();
+ void SetReturnValue(const SfxPoolItem &);
+ const SfxPoolItem* GetReturnValue() const;
+
+ static css::uno::Reference< css::frame::XDispatchRecorder > GetMacroRecorder( SfxViewFrame const * pFrame );
+ static bool HasMacroRecorder( SfxViewFrame const * pFrame );
+ SfxCallMode GetCallMode() const;
+ void AllowRecording( bool );
+ bool AllowsRecording() const;
+ bool IsAPI() const;
+ bool IsSynchronCall() const;
+ void SetSynchronCall( bool bSynchron );
+
+ bool IsDone() const;
+ void Done( bool bRemove = false );
+
+ void Ignore();
+ void Cancel();
+ bool IsCancelled() const;
+ void Done(const SfxItemSet &);
+
+ void ForgetAllArgs();
+
+ /** Return the window that should be used as the parent for any dialogs this request creates
+ */
+ weld::Window* GetFrameWeld() const;
+private:
+ const SfxRequest& operator=(const SfxRequest &) = delete;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/safemode.hxx b/include/sfx2/safemode.hxx
new file mode 100644
index 000000000..34602c4ea
--- /dev/null
+++ b/include/sfx2/safemode.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_SAFEMODE_HXX
+#define INCLUDED_SFX2_SAFEMODE_HXX
+
+#include <sfx2/dllapi.h>
+
+#include <rtl/ustring.hxx>
+
+namespace sfx2
+{
+class SFX2_DLLPUBLIC SafeMode
+{
+public:
+ /**
+ * Write a flag file to the user profile indicating that the next launch should be in safe mode.
+ *
+ * @return Whether the file could be written successfully
+ */
+ static bool putFlag();
+
+ /**
+ * Check the existence of the safe mode flag file.
+ *
+ * @return Whether the flag file for the safe mode exists
+ */
+ static bool hasFlag();
+
+ /**
+ * Remove the flag file for the safe mode.
+ *
+ * @return Whether the flag file could be removed successfully
+ */
+ static bool removeFlag();
+
+ /**
+ * Write a flag to the user profile indicating that we are currently restarting from safe mode -
+ * that means we don't want to enter safe mode again.
+ *
+ * @return Whether the file could be written successfully
+ */
+ static bool putRestartFlag();
+
+ /**
+ * Check the existence of the restart flag file.
+ *
+ * @return Whether the restart flag file exists
+ */
+ static bool hasRestartFlag();
+
+ /**
+ * Remove the restart flag file.
+ *
+ * @return Whether the flag file could be removed successfully
+ */
+ static bool removeRestartFlag();
+
+private:
+ /** Returns the path of the safe mode flag file.*/
+ static OUString getFilePath(const OUString& sFilename);
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxbasecontroller.hxx b/include/sfx2/sfxbasecontroller.hxx
new file mode 100644
index 000000000..ac4950e5a
--- /dev/null
+++ b/include/sfx2/sfxbasecontroller.hxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_SFXBASECONTROLLER_HXX
+#define INCLUDED_SFX2_SFXBASECONTROLLER_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
+#include <com/sun/star/frame/XController2.hpp>
+#include <com/sun/star/frame/XControllerBorder.hpp>
+#include <com/sun/star/frame/XInfobarProvider.hpp>
+#include <com/sun/star/frame/XTitle.hpp>
+#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+#include <com/sun/star/ui/XContextMenuInterception.hpp>
+#include <com/sun/star/awt/XUserInputInterception.hpp>
+#include <tools/link.hxx>
+
+#include <sfx2/groupid.hxx>
+
+namespace com::sun::star::awt { class XKeyHandler; }
+namespace com::sun::star::awt { class XMouseClickHandler; }
+namespace com::sun::star::frame { class XDispatch; }
+namespace com::sun::star::frame { class XFrame; }
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::frame { struct DispatchDescriptor; }
+namespace com::sun::star::ui { class XContextMenuInterceptor; }
+namespace com::sun::star::ui { class XSidebarProvider; }
+namespace com::sun::star::util { struct URL; }
+namespace weld { class Button; }
+
+struct IMPL_SfxBaseController_DataContainer ; // impl. struct to hold member of class SfxBaseController
+
+class NotifyEvent;
+class SfxViewFrame;
+class SfxViewShell;
+
+sal_Int16 MapGroupIDToCommandGroup( SfxGroupId nGroupID );
+
+
+
+
+typedef ::cppu::WeakImplHelper < css::frame::XController2
+ , css::frame::XControllerBorder
+ , css::frame::XDispatchProvider
+ , css::task::XStatusIndicatorSupplier
+ , css::ui::XContextMenuInterception
+ , css::awt::XUserInputInterception
+ , css::frame::XDispatchInformationProvider
+ , css::frame::XInfobarProvider
+ , css::frame::XTitle
+ , css::frame::XTitleChangeBroadcaster
+ , css::lang::XInitialization
+ > SfxBaseController_Base;
+
+class SFX2_DLLPUBLIC SfxBaseController :public SfxBaseController_Base
+ ,public ::cppu::BaseMutex
+{
+
+// public methods
+
+
+public:
+
+
+ // constructor/destructor
+
+
+ SfxBaseController( SfxViewShell* pView ) ;
+
+ virtual ~SfxBaseController() override ;
+
+ SAL_DLLPRIVATE void ReleaseShell_Impl();
+ SAL_DLLPRIVATE void BorderWidthsChanged_Impl();
+
+ css::uno::Reference< css::task::XStatusIndicator > SAL_CALL getStatusIndicator( ) override;
+
+
+ // XController2
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() override;
+ virtual OUString SAL_CALL getViewControllerName() override;
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCreationArguments() override;
+
+ virtual css::uno::Reference< css::ui::XSidebarProvider > SAL_CALL getSidebar() override;
+
+
+ // XController
+
+
+ virtual void SAL_CALL attachFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) override ;
+
+ virtual sal_Bool SAL_CALL attachModel( const css::uno::Reference< css::frame::XModel >& xModel ) override ;
+
+ virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) override ;
+
+ css::uno::Any SAL_CALL getViewData() override ;
+
+ void SAL_CALL restoreViewData( const css::uno::Any& aValue ) override ;
+
+ css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() override ;
+
+ css::uno::Reference< css::frame::XModel > SAL_CALL getModel() override ;
+
+
+ // XDispatchProvider
+
+
+ virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL & aURL ,
+ const OUString & sTargetFrameName,
+ sal_Int32 eSearchFlags ) override ;
+
+ virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescriptor ) override ;
+
+
+ // XControllerBorder
+
+
+ virtual css::frame::BorderWidths SAL_CALL getBorder() override;
+ virtual void SAL_CALL addBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) override;
+ virtual void SAL_CALL removeBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) override;
+ virtual css::awt::Rectangle SAL_CALL queryBorderedArea( const css::awt::Rectangle& aPreliminaryRectangle ) override;
+
+
+ // XComponent
+
+
+ virtual void SAL_CALL dispose() override ;
+
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override ;
+
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override ;
+ virtual void SAL_CALL registerContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) override;
+ virtual void SAL_CALL releaseContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) override;
+
+ virtual void SAL_CALL addKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) override;
+ virtual void SAL_CALL removeKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) override;
+ virtual void SAL_CALL addMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) override;
+ virtual void SAL_CALL removeMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) override;
+
+
+ // XDispatchInformationProvider
+ virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups() override;
+ virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 nCommandGroup ) override;
+
+ // css::frame::XTitle
+ virtual OUString SAL_CALL getTitle( ) override;
+ virtual void SAL_CALL setTitle( const OUString& sTitle ) override;
+
+ // css::frame::XTitleChangeBroadcaster
+ virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
+ virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
+
+ // css::lang::XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
+ // XInfobarProvider
+ virtual void SAL_CALL
+ appendInfobar(const OUString& sId, const OUString& sPrimaryMessage,
+ const OUString& sSecondaryMessage, sal_Int32 aInfobarType,
+ const css::uno::Sequence<css::beans::StringPair>& actionButtons,
+ sal_Bool bShowCloseButton) override;
+ virtual void SAL_CALL updateInfobar(const OUString& sId, const OUString& sPrimaryMessage,
+ const OUString& sSecondaryMessage,
+ sal_Int32 aInfobarType) override;
+ virtual void SAL_CALL removeInfobar(const OUString& sId) override;
+ virtual sal_Bool SAL_CALL hasInfobar(const OUString& sId) override;
+
+ // FIXME: TL needs this in sw/source/ui/uno/unotxdoc.cxx now;
+ // either the _Impl name should vanish or there should be an "official" API
+ SfxViewShell* GetViewShell_Impl() const;
+ SAL_DLLPRIVATE bool HandleEvent_Impl( NotifyEvent const & rEvent );
+ SAL_DLLPRIVATE bool HasKeyListeners_Impl() const;
+ SAL_DLLPRIVATE bool HasMouseClickListeners_Impl() const;
+ SAL_DLLPRIVATE void SetCreationArguments_Impl( const css::uno::Sequence< css::beans::PropertyValue >& i_rCreationArgs );
+ SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper ();
+private:
+ enum ConnectSfxFrame
+ {
+ E_CONNECT,
+ E_DISCONNECT,
+ E_RECONNECT
+ };
+ SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect );
+ SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const;
+ SAL_DLLPRIVATE void ShowInfoBars( );
+
+ DECL_DLLPRIVATE_LINK( CheckOutHandler, weld::Button&, void );
+
+ std::unique_ptr<IMPL_SfxBaseController_DataContainer> m_pData ;
+
+} ; // class SfxBaseController
+
+#endif // _SFX_SFXBASECONTROLLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx
new file mode 100644
index 000000000..8ccd59292
--- /dev/null
+++ b/include/sfx2/sfxbasemodel.hxx
@@ -0,0 +1,753 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <com/sun/star/frame/XModule.hpp>
+#include <com/sun/star/frame/XTitle.hpp>
+#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/document/XCmisDocument.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentRecovery.hpp>
+#include <com/sun/star/document/XUndoManagerSupplier.hpp>
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/document/XShapeEventBroadcaster.hpp>
+#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/document/XScriptInvocationContext.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/frame/XModel3.hpp>
+#include <com/sun/star/util/XModifiable2.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/view/XPrintable.hpp>
+#include <com/sun/star/view/XPrintJobBroadcaster.hpp>
+#include <com/sun/star/frame/XStorable2.hpp>
+#include <com/sun/star/frame/XLoadable.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/script/XStarBasicAccess.hpp>
+
+#include <com/sun/star/document/XViewDataSupplier.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <svl/lstner.hxx>
+
+#include <memory>
+
+class ErrCode;
+class SfxMedium;
+class SfxObjectShell ;
+class SfxViewFrame;
+struct IMPL_SfxBaseModel_DataContainer ; // impl. struct to hold member of class SfxBaseModel
+
+namespace sfx::intern {
+ class ViewCreationGuard;
+}
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::container { class XNameContainer; }
+namespace com::sun::star::container { class XNameReplace; }
+namespace com::sun::star::document { class XEventListener; }
+namespace com::sun::star::document { struct CmisProperty; }
+namespace com::sun::star::document { struct CmisVersion; }
+namespace com::sun::star::document { struct EventObject; }
+namespace com::sun::star::frame { class XController2; }
+namespace com::sun::star::task { class XInteractionHandler; }
+namespace com::sun::star::ui { class XUIConfigurationManager2; }
+namespace com::sun::star::util { class XCloseListener; }
+namespace com::sun::star::util { class XModifyListener; }
+
+
+
+/**_______________________________________________________________________________________________________
+ @implements XChild
+ XComponent
+ document::XDocumentPropertiesSupplier
+ rdf::XDocumentMetadataAccess
+ XEventListener
+ XModel
+ XModifiable2
+ XPrintable
+ XStorable2
+ document::XEventBroadcaster
+ document::XEventsSupplier
+ document::XEmbeddedScripts
+ document::XScriptInvocationContext
+ XCloseable
+ XCloseBroadcaster
+
+ @base cppu::BaseMutex
+ SfxListener
+*/
+
+typedef ::cppu::WeakImplHelper < css::container::XChild
+ , css::document::XDocumentPropertiesSupplier
+ , css::document::XCmisDocument
+ , css::rdf::XDocumentMetadataAccess
+ , css::document::XDocumentRecovery
+ , css::document::XUndoManagerSupplier
+ , css::document::XShapeEventBroadcaster
+ , css::document::XDocumentEventBroadcaster
+ , css::lang::XEventListener
+ , css::document::XEventsSupplier
+ , css::document::XEmbeddedScripts
+ , css::document::XScriptInvocationContext
+ , css::frame::XModel3
+ , css::util::XModifiable2
+ , css::view::XPrintable
+ , css::view::XPrintJobBroadcaster
+ , css::frame::XStorable2
+ , css::frame::XLoadable
+ , css::script::XStarBasicAccess
+ , css::document::XViewDataSupplier
+ , css::util::XCloseable // => css::util::XCloseBroadcaster
+ , css::datatransfer::XTransferable
+ , css::document::XDocumentSubStorageSupplier
+ , css::document::XStorageBasedDocument
+ , css::script::provider::XScriptProviderSupplier
+ , css::ui::XUIConfigurationManagerSupplier
+ , css::embed::XVisualObject
+ , css::lang::XUnoTunnel
+ , css::frame::XModule
+ , css::frame::XTitle
+ , css::frame::XTitleChangeBroadcaster
+ , css::frame::XUntitledNumbers
+ > SfxBaseModel_Base;
+
+class SFX2_DLLPUBLIC SfxBaseModel : protected ::cppu::BaseMutex
+ , public SfxBaseModel_Base
+ , public SfxListener
+{
+
+
+// public methods
+
+
+public:
+
+
+ // constructor/destructor
+
+
+ SfxBaseModel( SfxObjectShell *pObjectShell ) ;
+
+ virtual ~SfxBaseModel() override ;
+
+
+ // XInterface
+
+
+ /**___________________________________________________________________________________________________
+ @short give answer, if interface is supported
+ @descr The interfaces are searched by type.
+
+ @seealso XInterface
+
+ @param "rType" is the type of searched interface.
+
+ @return Any information about found interface
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override ;
+
+ /**___________________________________________________________________________________________________
+ @short increment refcount
+ @seealso XInterface
+ @seealso release()
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+
+ /**___________________________________________________________________________________________________
+ @short decrement refcount
+ @seealso XInterface
+ @seealso acquire()
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+
+ // XTypeProvider
+
+
+ /**___________________________________________________________________________________________________
+ @short get information about supported interfaces
+ @seealso XTypeProvider
+ @return Sequence of types of all supported interfaces
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override ;
+
+ /**___________________________________________________________________________________________________
+ @short get implementation id
+ @descr This ID is necessary for UNO-caching. If there no ID, cache is disabled.
+ Another way, cache is enabled.
+
+ @seealso XTypeProvider
+ @return ID as Sequence of byte
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override ;
+
+
+ // XStarBasicAccess
+
+
+ /**___________________________________________________________________________________________________
+ @seealso XStarBasicAccess
+ */
+ virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getLibraryContainer() override;
+
+ /**___________________________________________________________________________________________________
+ @seealso XStarBasicAccess
+ */
+ virtual void SAL_CALL createLibrary( const OUString& LibName, const OUString& Password,
+ const OUString& ExternalSourceURL, const OUString& LinkTargetURL ) override;
+
+ /**___________________________________________________________________________________________________
+ @seealso XStarBasicAccess
+ */
+ virtual void SAL_CALL addModule( const OUString& LibraryName, const OUString& ModuleName,
+ const OUString& Language, const OUString& Source ) override;
+
+ /**___________________________________________________________________________________________________
+ @seealso XStarBasicAccess
+ */
+ virtual void SAL_CALL addDialog( const OUString& LibraryName, const OUString& DialogName,
+ const css::uno::Sequence< sal_Int8 >& Data ) override;
+
+
+ // XChild
+
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override ;
+
+ virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& xParent ) override;
+
+
+ // XComponent
+
+
+ virtual void SAL_CALL dispose() override;
+
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener) override;
+
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
+
+ // XDocumentPropertiesSupplier
+ virtual css::uno::Reference< css::document::XDocumentProperties >
+ SAL_CALL getDocumentProperties() override;
+
+
+ // XEventListener
+
+
+ virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) override;
+
+
+ // XModel
+
+
+ virtual sal_Bool SAL_CALL attachResource(const OUString& sURL,
+ const css::uno::Sequence< css::beans::PropertyValue >& aArgs) override;
+
+ virtual OUString SAL_CALL getURL() override;
+
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs() override;
+
+ virtual void SAL_CALL connectController( const css::uno::Reference< css::frame::XController >& xController ) override;
+
+ virtual void SAL_CALL disconnectController( const css::uno::Reference< css::frame::XController >& xController ) override;
+
+ virtual void SAL_CALL lockControllers() override;
+
+ virtual void SAL_CALL unlockControllers() override;
+
+ virtual sal_Bool SAL_CALL hasControllersLocked() override;
+
+ virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController() override;
+
+ virtual void SAL_CALL setCurrentController( const css::uno::Reference< css::frame::XController >& xController ) override;
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getCurrentSelection() override;
+
+
+ // XModel2
+
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL getControllers() override;
+
+ virtual css::uno::Sequence< OUString > SAL_CALL getAvailableViewControllerNames() override;
+
+ virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createDefaultViewController(const css::uno::Reference< css::frame::XFrame >& Frame ) override;
+
+ virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createViewController(const OUString& ViewName ,
+ const css::uno::Sequence< css::beans::PropertyValue >& Arguments ,
+ const css::uno::Reference< css::frame::XFrame >& Frame ) override;
+
+ virtual void SAL_CALL setArgs(const css::uno::Sequence<css::beans::PropertyValue>& aArgs) override;
+
+
+ // XModel3
+
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs2( const css::uno::Sequence< OUString > & requestedArgs ) override;
+
+ // XModifiable2
+
+
+ virtual sal_Bool SAL_CALL disableSetModified( ) override;
+ virtual sal_Bool SAL_CALL enableSetModified( ) override;
+ virtual sal_Bool SAL_CALL isSetModifiedEnabled( ) override;
+
+ virtual sal_Bool SAL_CALL isModified() override;
+
+ virtual void SAL_CALL setModified( sal_Bool bModified ) override;
+
+ virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& xListener ) override ;
+
+ virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > & xListener) override ;
+
+
+ // XCloseable
+
+
+ virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) override;
+
+
+ // XCloseBroadcaster
+
+
+ virtual void SAL_CALL addCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) override;
+ virtual void SAL_CALL removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) override;
+
+
+ // XPrintJobBroadcaster
+
+
+ virtual void SAL_CALL addPrintJobListener( const css::uno::Reference< css::view::XPrintJobListener >& xListener ) override;
+ virtual void SAL_CALL removePrintJobListener( const css::uno::Reference< css::view::XPrintJobListener >& xListener ) override;
+
+
+ // XPrintable
+
+
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPrinter() override;
+
+ virtual void SAL_CALL setPrinter( const css::uno::Sequence< css::beans::PropertyValue >& seqPrinter ) override;
+ virtual void SAL_CALL print( const css::uno::Sequence< css::beans::PropertyValue >& seqOptions ) override;
+
+
+ // XStorable2
+
+
+ virtual void SAL_CALL storeSelf( const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ) override;
+
+
+ // XStorable
+
+
+ virtual sal_Bool SAL_CALL hasLocation() override;
+
+ virtual OUString SAL_CALL getLocation() override;
+
+ virtual sal_Bool SAL_CALL isReadonly() override;
+
+ virtual void SAL_CALL store() override;
+
+ virtual void SAL_CALL storeAsURL( const OUString& sURL,
+ const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ) override ;
+
+ virtual void SAL_CALL storeToURL( const OUString& sURL,
+ const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ) override;
+
+ SAL_DLLPRIVATE void
+ impl_store(const OUString& sURL,
+ const css::uno::Sequence<css::beans::PropertyValue>& seqArguments, bool bSaveTo);
+
+ // XLoadable
+
+
+ virtual void SAL_CALL initNew() override;
+
+ virtual void SAL_CALL load( const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ) override;
+
+
+ // XDocumentSubStorageSupplier
+
+
+ virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getDocumentSubStorage( const OUString& aStorageName, sal_Int32 nMode ) override;
+
+ virtual css::uno::Sequence< OUString > SAL_CALL getDocumentSubStoragesNames() override;
+
+
+ // XStorageBasedDocument
+
+
+ virtual void SAL_CALL loadFromStorage( const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescriptor ) override;
+
+ virtual void SAL_CALL storeToStorage( const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescriptor ) override;
+
+ virtual void SAL_CALL switchToStorage( const css::uno::Reference< css::embed::XStorage >& xStorage ) override;
+
+ virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getDocumentStorage() override;
+
+ virtual void SAL_CALL addStorageChangeListener(
+ const css::uno::Reference< css::document::XStorageChangeListener >& xListener ) override;
+
+ virtual void SAL_CALL removeStorageChangeListener(
+ const css::uno::Reference< css::document::XStorageChangeListener >& xListener ) override;
+
+
+ // XVisualObject
+
+
+ virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize ) override;
+
+ virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect ) override;
+
+ virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) override;
+
+ virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect ) override;
+
+
+ // XScriptProviderSupplier
+
+
+ virtual css::uno::Reference< css::script::provider::XScriptProvider > SAL_CALL getScriptProvider() override;
+
+
+ // XUIConfigurationManagerSupplier
+ virtual css::uno::Reference< css::ui::XUIConfigurationManager > SAL_CALL getUIConfigurationManager() override;
+
+
+ // XTransferable
+
+
+ virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) override;
+
+ virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() override;
+
+ virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor ) override;
+
+
+ // XEventsSupplier
+
+
+ /**___________________________________________________________________________________________________
+ @descr - offers a list of event handlers which are be bound to events of
+ this object.
+ @return - an Events object.
+ */
+
+ virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override;
+
+
+ // XEmbeddedScripts
+
+
+ virtual css::uno::Reference< css::script::XStorageBasedLibraryContainer > SAL_CALL getBasicLibraries() override;
+ virtual css::uno::Reference< css::script::XStorageBasedLibraryContainer > SAL_CALL getDialogLibraries() override;
+ virtual sal_Bool SAL_CALL getAllowMacroExecution() override;
+
+
+ // XScriptInvocationContext
+
+
+ virtual css::uno::Reference< css::document::XEmbeddedScripts > SAL_CALL getScriptContainer() override;
+
+
+ // document::XEventBroadcaster
+
+ /**___________________________________________________________________________________________________
+ @descr - registers the given XEventListener.
+ */
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::document::XEventListener >& xListener ) override;
+
+ /**___________________________________________________________________________________________________
+ @descr - unregisters the given XEventListener.
+ */
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::document::XEventListener >& xListener ) override;
+
+
+ // document::XShapeEventBroadcaster
+
+ /**___________________________________________________________________________________________________
+ @descr - registers the given XEventListener.
+ */
+ virtual void SAL_CALL addShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::document::XShapeEventListener >& xListener ) override;
+
+ /**___________________________________________________________________________________________________
+ @descr - unregisters the given XEventListener.
+ */
+ virtual void SAL_CALL removeShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::document::XShapeEventListener >& xListener ) override;
+
+
+ // XDocumentEventBroadcaster
+
+ virtual void SAL_CALL addDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& Listener ) override;
+ virtual void SAL_CALL removeDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& Listener ) override;
+ virtual void SAL_CALL notifyDocumentEvent( const OUString& EventName, const css::uno::Reference< css::frame::XController2 >& ViewController, const css::uno::Any& Supplement ) override;
+
+
+ // XUnoTunnel
+
+
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+
+ // css.frame.XModule
+ virtual void SAL_CALL setIdentifier(const OUString& sIdentifier) override;
+
+ // css.frame.XModule
+ virtual OUString SAL_CALL getIdentifier() override;
+
+ // css.frame.XTitle
+ virtual OUString SAL_CALL getTitle() override;
+
+ // css.frame.XTitle
+ virtual void SAL_CALL setTitle( const OUString& sTitle ) override;
+
+ // css.frame.XTitleChangeBroadcaster
+ virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
+
+ // css.frame.XTitleChangeBroadcaster
+ virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
+
+ // css.frame.XUntitledNumbers
+ virtual ::sal_Int32 SAL_CALL leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent ) override;
+
+ // css.frame.XUntitledNumbers
+ virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber ) override;
+
+ // css.frame.XUntitledNumbers
+ virtual void SAL_CALL releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent ) override;
+
+ // css.frame.XUntitledNumbers
+ virtual OUString SAL_CALL getUntitledPrefix() override;
+
+ // css.document.XDocumentRecovery
+ virtual sal_Bool SAL_CALL wasModifiedSinceLastSave() override;
+ virtual void SAL_CALL storeToRecoveryFile( const OUString& i_TargetLocation, const css::uno::Sequence< css::beans::PropertyValue >& i_MediaDescriptor ) override;
+ virtual void SAL_CALL recoverFromFile( const OUString& i_SourceLocation, const OUString& i_SalvagedFile, const css::uno::Sequence< css::beans::PropertyValue >& i_MediaDescriptor ) override;
+
+ // css.document.XUndoManagerSupplier
+ virtual css::uno::Reference< css::document::XUndoManager > SAL_CALL getUndoManager( ) override;
+
+
+ // css::rdf::XNode:
+ virtual OUString SAL_CALL getStringValue() override;
+
+ // css::rdf::XURI:
+ virtual OUString SAL_CALL getNamespace() override;
+ virtual OUString SAL_CALL getLocalName() override;
+
+ // css::rdf::XRepositorySupplier:
+ virtual css::uno::Reference<
+ css::rdf::XRepository > SAL_CALL getRDFRepository() override;
+
+ // css::rdf::XDocumentMetadataAccess:
+ virtual css::uno::Reference<
+ css::rdf::XMetadatable > SAL_CALL
+ getElementByMetadataReference(
+ const css::beans::StringPair & i_rReference) override;
+ virtual css::uno::Reference<
+ css::rdf::XMetadatable > SAL_CALL
+ getElementByURI(const css::uno::Reference<
+ css::rdf::XURI > & i_xURI) override;
+ virtual css::uno::Sequence< css::uno::Reference<
+ css::rdf::XURI > > SAL_CALL getMetadataGraphsWithType(
+ const css::uno::Reference<
+ css::rdf::XURI > & i_xType) override;
+ virtual css::uno::Reference<
+ css::rdf::XURI> SAL_CALL
+ addMetadataFile(const OUString & i_rFileName,
+ const css::uno::Sequence<
+ css::uno::Reference< css::rdf::XURI >
+ > & i_rTypes) override;
+ virtual css::uno::Reference<
+ css::rdf::XURI> SAL_CALL
+ importMetadataFile(::sal_Int16 i_Format,
+ const css::uno::Reference<
+ css::io::XInputStream > & i_xInStream,
+ const OUString & i_rFileName,
+ const css::uno::Reference<
+ css::rdf::XURI > & i_xBaseURI,
+ const css::uno::Sequence<
+ css::uno::Reference< css::rdf::XURI >
+ > & i_rTypes) override;
+ virtual void SAL_CALL removeMetadataFile(
+ const css::uno::Reference<
+ css::rdf::XURI > & i_xGraphName) override;
+ virtual void SAL_CALL addContentOrStylesFile(
+ const OUString & i_rFileName) override;
+ virtual void SAL_CALL removeContentOrStylesFile(
+ const OUString & i_rFileName) override;
+
+ virtual void SAL_CALL loadMetadataFromStorage(
+ const css::uno::Reference<
+ css::embed::XStorage > & i_xStorage,
+ const css::uno::Reference<
+ css::rdf::XURI > & i_xBaseURI,
+ const css::uno::Reference<
+ css::task::XInteractionHandler> & i_xHandler) override;
+ virtual void SAL_CALL storeMetadataToStorage(
+ const css::uno::Reference<
+ css::embed::XStorage > & i_xStorage) override;
+ virtual void SAL_CALL loadMetadataFromMedium(
+ const css::uno::Sequence<
+ css::beans::PropertyValue > & i_rMedium) override;
+ virtual void SAL_CALL storeMetadataToMedium(
+ const css::uno::Sequence<
+ css::beans::PropertyValue > & i_rMedium) override;
+
+ // XCmisDocument
+
+ virtual css::uno::Sequence< css::document::CmisProperty >
+ SAL_CALL getCmisProperties() override;
+ virtual void SAL_CALL setCmisProperties(
+ const css::uno::Sequence<
+ css::document::CmisProperty >& _cmisproperties ) override;
+
+ virtual void SAL_CALL updateCmisProperties(
+ const css::uno::Sequence<
+ css::document::CmisProperty >& _cmisproperties ) override;
+
+ virtual css::uno::Sequence< css::document::CmisVersion > SAL_CALL getAllVersions ( ) override;
+
+ virtual void SAL_CALL checkOut( ) override;
+ virtual void SAL_CALL cancelCheckOut( ) override;
+ virtual void SAL_CALL checkIn( sal_Bool bIsMajor, const OUString & rMessage ) override;
+
+ virtual sal_Bool SAL_CALL isVersionable( ) override;
+ virtual sal_Bool SAL_CALL canCheckOut( ) override;
+ virtual sal_Bool SAL_CALL canCancelCheckOut( ) override;
+ virtual sal_Bool SAL_CALL canCheckIn( ) override;
+
+ /// @throws css::uno::RuntimeException
+ bool getBoolPropertyValue( const OUString& rName );
+
+
+ // SfxListener
+
+
+ void Notify( SfxBroadcaster& aBC ,
+ const SfxHint& aHint ) override ;
+
+
+ // public IMPL?
+
+
+ void changing() ;
+
+ SfxObjectShell* GetObjectShell() const ;
+
+ SAL_DLLPRIVATE bool impl_isDisposed() const ;
+ bool IsInitialized() const;
+ void MethodEntryCheck( const bool i_mustBeInitialized ) const;
+
+ css::uno::Reference < css::container::XIndexAccess > SAL_CALL getViewData() override;
+ void SAL_CALL setViewData( const css::uno::Reference < css::container::XIndexAccess >& aData ) override;
+
+ /** calls all XEventListeners */
+ void notifyEvent( const css::document::EventObject& aEvent ) const;
+
+ /** returns true if someone added a XEventListener to this XEventBroadcaster */
+ bool hasEventListeners() const;
+
+protected:
+
+ /* returns a unique id for the model that is valid as long as the document
+ is loaded. The id is not saved across document close/reload. */
+ OUString const & getRuntimeUID() const;
+
+ /* returns true if the document signatures are valid, otherwise false */
+ bool hasValidSignatures() const;
+
+ /* GrabBagItem for interim interop purposes */
+ void getGrabBagItem(css::uno::Any& rVal) const;
+
+ void setGrabBagItem(const css::uno::Any& rVal);
+
+
+// private methods
+
+
+private:
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::ui::XUIConfigurationManager2 > getUIConfigurationManager2();
+ void impl_getPrintHelper();
+ SAL_DLLPRIVATE void ListenForStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xStorage );
+ SAL_DLLPRIVATE OUString GetMediumFilterName_Impl() const;
+
+ SAL_DLLPRIVATE void postEvent_Impl( const OUString& aName, const css::uno::Reference< css::frame::XController2 >& xController = css::uno::Reference< css::frame::XController2 >(), const css::uno::Any& aSupplement = css::uno::Any());
+
+ SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper ();
+ SAL_DLLPRIVATE css::uno::Reference< css::frame::XUntitledNumbers > impl_getUntitledHelper ();
+
+ SAL_DLLPRIVATE SfxViewFrame* FindOrCreateViewFrame_Impl(
+ const css::uno::Reference< css::frame::XFrame >& i_rFrame,
+ ::sfx::intern::ViewCreationGuard& i_rGuard
+ ) const;
+
+ SAL_DLLPRIVATE void NotifyModifyListeners_Impl() const;
+
+ SAL_DLLPRIVATE void loadCmisProperties();
+
+ SAL_DLLPRIVATE SfxMedium* handleLoadError( ErrCode nError, SfxMedium* pMedium );
+
+
+// private variables and methods
+
+
+private:
+
+ std::shared_ptr<IMPL_SfxBaseModel_DataContainer> m_pData;
+ // cannot be held in m_pData, since it needs to be accessed in non-threadsafe context
+ const bool m_bSupportEmbeddedScripts;
+ const bool m_bSupportDocRecovery;
+
+} ; // class SfxBaseModel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxdlg.hxx b/include/sfx2/sfxdlg.hxx
new file mode 100644
index 000000000..ba3062693
--- /dev/null
+++ b/include/sfx2/sfxdlg.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_SFXDLG_HXX
+#define INCLUDED_SFX2_SFXDLG_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+
+#include <vcl/abstdlg.hxx>
+
+#include <sot/formats.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+class SfxItemSet;
+class SfxItemPool;
+class SvObjectServerList;
+class TransferableDataHelper;
+class SvGlobalName;
+
+namespace sfx2
+{
+ class LinkManager;
+ class SvBaseLink;
+}
+
+namespace com::sun::star::embed { class XEmbeddedObject; }
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::uno { class Any; }
+
+class SfxAbstractDialog : virtual public VclAbstractDialog
+{
+protected:
+ virtual ~SfxAbstractDialog() override = default;
+public:
+ /** Get a set of items changed in the dialog.
+ */
+ virtual const SfxItemSet* GetOutputItemSet() const = 0;
+ virtual void SetText( const OUString& rStr ) = 0;
+};
+
+class SfxAbstractTabDialog : virtual public SfxAbstractDialog
+{
+protected:
+ virtual ~SfxAbstractTabDialog() override = default;
+public:
+ virtual void SetCurPageId( const OString &rName ) = 0;
+ virtual WhichRangesContainer GetInputRanges( const SfxItemPool& ) = 0;
+ virtual void SetInputSet( const SfxItemSet* pInSet ) = 0;
+};
+
+class SfxAbstractApplyTabDialog : virtual public SfxAbstractTabDialog
+{
+protected:
+ virtual ~SfxAbstractApplyTabDialog() override = default;
+public:
+ virtual void SetApplyHdl( const Link<LinkParamNone*,void>& rLink ) = 0;
+};
+
+class SfxAbstractInsertObjectDialog : virtual public VclAbstractDialog
+{
+protected:
+ virtual ~SfxAbstractInsertObjectDialog() override = default;
+public:
+ virtual css::uno::Reference < css::embed::XEmbeddedObject > GetObject()=0;
+ virtual css::uno::Reference< css::io::XInputStream > GetIconIfIconified( OUString* pGraphicMediaType )=0;
+ virtual bool IsCreateNew()=0;
+};
+
+class SfxAbstractPasteDialog : virtual public VclAbstractDialog
+{
+protected:
+ virtual ~SfxAbstractPasteDialog() override = default;
+public:
+ virtual void Insert( SotClipboardFormatId nFormat, const OUString & rFormatName ) = 0;
+ virtual void InsertUno( const OUString& sCmd, const OUString& sLabel ) = 0;
+ virtual void SetObjName( const SvGlobalName & rClass, const OUString & rObjName ) = 0;
+ virtual void PreGetFormat( const TransferableDataHelper& aHelper ) = 0;
+ virtual SotClipboardFormatId GetFormatOnly() = 0;
+ virtual SotClipboardFormatId GetFormat( const TransferableDataHelper& aHelper ) = 0;
+};
+
+class SfxAbstractLinksDialog : virtual public VclAbstractDialog
+{
+protected:
+ virtual ~SfxAbstractLinksDialog() override = default;
+};
+
+class AbstractScriptSelectorDialog : virtual public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractScriptSelectorDialog() override = default;
+public:
+ virtual OUString GetScriptURL() const = 0;
+ virtual void SetRunLabel() = 0;
+};
+
+namespace com::sun::star::frame { class XFrame; }
+
+class SFX2_DLLPUBLIC SfxAbstractDialogFactory : virtual public VclAbstractDialogFactory
+{
+public:
+ virtual ~SfxAbstractDialogFactory() override; // needed for export of vtable
+ static SfxAbstractDialogFactory* Create();
+ virtual VclPtr<VclAbstractDialog> CreateFrameDialog(weld::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rFrame, sal_uInt32 nResId, const OUString& rParameter) = 0;
+ virtual VclPtr<SfxAbstractTabDialog> CreateAutoCorrTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet) = 0;
+ virtual VclPtr<SfxAbstractTabDialog> CreateCustomizeTabDialog(weld::Window* pParent,
+ const SfxItemSet* pAttrSet,
+ const css::uno::Reference< css::frame::XFrame >& xViewFrame ) = 0;
+ virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) = 0;
+ virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId ) = 0;
+ virtual VclPtr<SfxAbstractInsertObjectDialog> CreateInsertObjectDialog(weld::Window* pParent, const OUString& rCommand,
+ const css::uno::Reference < css::embed::XStorage >& xStor,
+ const SvObjectServerList* pList )=0;
+ virtual VclPtr<VclAbstractDialog> CreateEditObjectDialog(weld::Window* pParent, const OUString& rCommand,
+ const css::uno::Reference < css::embed::XEmbeddedObject >& xObj )=0;
+ virtual VclPtr<SfxAbstractPasteDialog> CreatePasteDialog(weld::Window* pParent) = 0;
+ virtual VclPtr<SfxAbstractLinksDialog> CreateLinksDialog(weld::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML=false, sfx2::SvBaseLink* p=nullptr) = 0;
+ virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) = 0;
+
+ virtual VclPtr<AbstractScriptSelectorDialog> CreateScriptSelectorDialog(weld::Window* pParent,
+ const css::uno::Reference< css::frame::XFrame >& rxFrame) = 0;
+
+ virtual void ShowAsyncScriptErrorDialog( weld::Window* pParent, const css::uno::Any& rException ) = 0;
+
+ virtual VclPtr<VclAbstractDialog> CreateOptionsDialog(
+ weld::Window* pParent, const OUString& rExtensionId ) = 0;
+
+ virtual VclPtr<VclAbstractDialog> CreateAboutDialog(weld::Window* _pParent) = 0;
+
+ virtual VclPtr<VclAbstractDialog> CreateTipOfTheDayDialog(weld::Window* _pParent) = 0;
+
+ virtual VclPtr<VclAbstractDialog> CreateToolbarmodeDialog(weld::Window* _pParent) = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxhelp.hxx b/include/sfx2/sfxhelp.hxx
new file mode 100644
index 000000000..212188063
--- /dev/null
+++ b/include/sfx2/sfxhelp.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_SFXHELP_HXX
+#define INCLUDED_SFX2_SFXHELP_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <rtl/ustring.hxx>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <vcl/help.hxx>
+
+class SFX2_DLLPUBLIC SfxHelp final : public Help
+{
+ bool bIsDebug;
+ bool bLaunchingHelp; // tdf#140539 don't allow help to be re-launched during help launch
+
+private:
+ SAL_DLLPRIVATE static bool Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUString& rKeyword);
+ SAL_DLLPRIVATE virtual void SearchKeyword( const OUString& rKeyWord ) override;
+ SAL_DLLPRIVATE virtual bool Start(const OUString& rURL, weld::Widget* pWidget = nullptr) override;
+ SAL_DLLPRIVATE static OUString GetHelpModuleName_Impl(std::u16string_view rHelpId);
+ SAL_DLLPRIVATE static OUString CreateHelpURL_Impl( const OUString& aCommandURL, const OUString& rModuleName );
+
+ SAL_DLLPRIVATE static bool Start_Impl( const OUString& rURL, const vcl::Window* pWindow );
+ SAL_DLLPRIVATE virtual bool Start( const OUString& rURL, const vcl::Window* pWindow ) override;
+
+public:
+ SfxHelp();
+ virtual ~SfxHelp() override;
+
+ virtual OUString GetHelpText(const OUString&, const vcl::Window* pWindow) override;
+ virtual OUString GetHelpText(const OUString&, const weld::Widget* pWindow) override;
+
+ static OUString CreateHelpURL( const OUString& aCommandURL, const OUString& rModuleName );
+ static OUString GetDefaultHelpModule();
+ static OUString GetCurrentModuleIdentifier();
+ // Check for built-in help
+ static bool IsHelpInstalled();
+
+ static OUString GetURLHelpText(std::u16string_view);
+};
+
+#endif // INCLUDED_SFX2_SFXHELP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxhtml.hxx b/include/sfx2/sfxhtml.hxx
new file mode 100644
index 000000000..9f5a03f5b
--- /dev/null
+++ b/include/sfx2/sfxhtml.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_SFXHTML_HXX
+#define INCLUDED_SFX2_SFXHTML_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <i18nlangtag/lang.h>
+#include <svtools/parhtml.hxx>
+#include <svl/macitem.hxx>
+#include <memory>
+
+
+class ImageMap;
+class SfxMedium;
+class SvNumberFormatter;
+
+class SFX2_DLLPUBLIC SfxHTMLParser : public HTMLParser
+{
+ OUString aScriptType;
+
+ SfxMedium* pMedium;
+ std::unique_ptr<SfxMedium> pDLMedium; // Medium for Download Files
+
+ ScriptType eScriptType;
+
+ SAL_DLLPRIVATE void GetScriptType_Impl( SvKeyValueIterator* );
+
+protected:
+
+ SfxHTMLParser( SvStream& rStream, bool bNewDoc, SfxMedium *pMedium );
+
+ virtual ~SfxHTMLParser() override;
+
+public:
+ // Read the options of an image map
+ // <MAP>: sal_True = Image-Map has a name
+ // <AREA>: sal_True = Image-Map has now one vcl::Region more
+ static bool ParseMapOptions(ImageMap* pImageMap, const HTMLOptions& rOptions);
+ bool ParseMapOptions(ImageMap * pImageMap)
+ { return ParseMapOptions(pImageMap, GetOptions()); }
+ static bool ParseAreaOptions(ImageMap * pImageMap, std::u16string_view rBaseURL,
+ const HTMLOptions& rOptions,
+ SvMacroItemId nEventMouseOver,
+ SvMacroItemId nEventMouseOut );
+ inline bool ParseAreaOptions(ImageMap * pImageMap, std::u16string_view rBaseURL,
+ SvMacroItemId nEventMouseOver,
+ SvMacroItemId nEventMouseOut);
+
+ // <TD SDVAL="..." SDNUM="...">
+ static double GetTableDataOptionsValNum( sal_uInt32& nNumForm,
+ LanguageType& eNumLang, const OUString& aValStr,
+ std::u16string_view aNumStr, SvNumberFormatter& rFormatter );
+
+protected:
+ // Start a file download. This is done asynchronously or synchronously.
+ // In the synchronous case, the parser is in the working state after
+ // it has been called. The read file can then be picked up directly with
+ // FinishFileDownload. In the asynchronous case, the parser is in the
+ // pending state after it hs been called. The parser then has to leave
+ // over the Continue (without Reschedule!). If the file is loaded,
+ // a Continue is called with passed on token. The file can then be picked
+ // up by FinishFileDownload. To cancel the download should a shell be
+ // left. It can only exist a single download at the same time, For every
+ // started download FinishFileDownload must be called.
+ void StartFileDownload(const OUString& rURL);
+
+ // End of an asynchronous file download. Returns TRUE if the download
+ // was successful. The read file is then passed into String.
+ bool FinishFileDownload( OUString& rStr );
+
+ // Returns TRUE if a file was downloaded and if FileDownloadFinished
+ // has not yet been called
+ bool ShouldFinishFileDownload() const { return pDLMedium != nullptr; }
+
+ SfxMedium *GetMedium() { return pMedium; }
+ const SfxMedium *GetMedium() const { return pMedium; }
+
+ // Default (without iterator) is JavaScript
+ ScriptType GetScriptType( SvKeyValueIterator* ) const;
+ const OUString& GetScriptTypeString( SvKeyValueIterator* ) const;
+};
+
+inline bool SfxHTMLParser::ParseAreaOptions(ImageMap * pImageMap, std::u16string_view rBaseURL,
+ SvMacroItemId nEventMouseOver,
+ SvMacroItemId nEventMouseOut)
+{
+ return ParseAreaOptions( pImageMap, rBaseURL, GetOptions(),
+ nEventMouseOver, nEventMouseOut );
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxmodelfactory.hxx b/include/sfx2/sfxmodelfactory.hxx
new file mode 100644
index 000000000..4d166c4d4
--- /dev/null
+++ b/include/sfx2/sfxmodelfactory.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_SFXMODELFACTORY_HXX
+#define INCLUDED_SFX2_SFXMODELFACTORY_HXX
+
+#include <sfx2/dllapi.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <functional>
+
+namespace com::sun::star::lang { class XMultiServiceFactory; }
+namespace com::sun::star::lang { class XSingleServiceFactory; }
+namespace com::sun::star::uno { class XInterface; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+enum class SfxModelFlags
+{
+ NONE = 0x00,
+ EMBEDDED_OBJECT = 0x01,
+ EXTERNAL_LINK = 0x02,
+ DISABLE_EMBEDDED_SCRIPTS = 0x04,
+ DISABLE_DOCUMENT_RECOVERY = 0x08,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SfxModelFlags> : is_typed_flags<SfxModelFlags, 0x0f> {};
+}
+
+namespace sfx2
+{
+ /**
+ * Intended to be called from UNO constructor functions
+ * This evaluates certain creation arguments (passed to createInstanceWithArguments)
+ * and passes them to the factory function of the derived class.
+ */
+ css::uno::Reference<css::uno::XInterface>
+ SFX2_DLLPUBLIC createSfxModelInstance(
+ const css::uno::Sequence<css::uno::Any> & rxArgs,
+ std::function<css::uno::Reference<css::uno::XInterface>( SfxModelFlags )> creationFunc
+ );
+
+} // namespace sfx2
+
+
+#endif // INCLUDED_SFX2_SFXMODELFACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxresid.hxx b/include/sfx2/sfxresid.hxx
new file mode 100644
index 000000000..f5cd1aca4
--- /dev/null
+++ b/include/sfx2/sfxresid.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_SFXRESID_HXX
+#define INCLUDED_SFX2_SFXRESID_HXX
+
+#include <sfx2/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <unotools/resmgr.hxx>
+
+SFX2_DLLPUBLIC OUString SfxResId(TranslateId aId);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
new file mode 100644
index 000000000..b48f827ae
--- /dev/null
+++ b/include/sfx2/sfxsids.hrc
@@ -0,0 +1,739 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_SFXSIDS_HRC
+#define INCLUDED_SFX2_SFXSIDS_HRC
+
+#include <svl/solar.hrc>
+#include <svl/memberid.h>
+#include <svl/typedwhich.hxx>
+
+class SfxAllEnumItem;
+class SfxBoolItem;
+class SfxDocumentInfoItem;
+class SfxEventNamesItem;
+class SfxFlagItem;
+class SfxInt16Item;
+class SfxInt32Item;
+class SfxHyphenRegionItem;
+class SfxMacroInfoItem;
+class SfxScriptOrganizerItem;
+class SfxStringItem;
+class SfxStringListItem;
+class SfxUInt16Item;
+class SfxUnoAnyItem;
+class SfxUnoFrameItem;
+class SfxWatermarkItem;
+class SvxClipboardFormatItem;
+class SvxHyperlinkItem;
+class SvxLanguageItem;
+class SvxSearchItem;
+class SvxZoomItem;
+
+// Please be careful:
+// Changing just one part here doesn't add new
+// docking windows automatically!
+
+#define SID_DOCKWIN_0 SID_DOCKWIN_START
+#define SID_DOCKWIN_1 SID_DOCKWIN_START+1
+#define SID_DOCKWIN_2 SID_DOCKWIN_START+2
+#define SID_DOCKWIN_3 SID_DOCKWIN_START+3
+#define SID_DOCKWIN_4 SID_DOCKWIN_START+4
+#define SID_DOCKWIN_5 SID_DOCKWIN_START+5
+#define SID_DOCKWIN_6 SID_DOCKWIN_START+6
+#define SID_DOCKWIN_7 SID_DOCKWIN_START+7
+#define SID_DOCKWIN_8 SID_DOCKWIN_START+8
+#define SID_DOCKWIN_9 SID_DOCKWIN_START+9
+
+// default-ids for application
+#define SID_QUITAPP (SID_SFX_START + 300)
+#define SID_ABOUT (SID_SFX_START + 301)
+#define SID_SETUPPRINTER (SID_SFX_START + 302)
+#define SID_SAFE_MODE (SID_SFX_START + 303)
+
+#define SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW (SID_SFX_START + 306)
+#define SID_INSPECT_SELECTED_OBJECT (SID_SFX_START + 307)
+
+#define SID_CONTEXT (SID_SFX_START + 310)
+
+#define SID_PASTE_SPECIAL (SID_SFX_START + 311)
+#define SID_CLIPBOARD_FORMAT_ITEMS TypedWhichId<SvxClipboardFormatItem>(SID_SFX_START + 312)
+
+#define SID_PASTE_UNFORMATTED (SID_SFX_START + 314)
+#define SID_PRINTER_NOTFOUND_WARN TypedWhichId<SfxBoolItem>(SID_SFX_START + 320)
+#define SID_PRINTER_NAME (SID_SFX_START + 322)
+#define SID_PRINTER_CHANGESTODOC TypedWhichId<SfxFlagItem>(SID_SFX_START + 324)
+#define SID_PRINTPREVIEW (SID_SFX_START + 325)
+
+#define SID_MAIL_SUBJECT (SID_SFX_START + 328)
+#define SID_MAIL_SENDDOC (SID_SFX_START + 331)
+#define SID_MAIL_SENDDOCASPDF (SID_SFX_START + 1672)
+
+#define SID_MAIL_RECIPIENT (SID_SFX_START + 334)
+#define SID_MAIL_TEXT (SID_SFX_START + 335)
+#define SID_MAIL_PRIORITY (SID_SFX_START + 337)
+
+#define SID_MAIL_PREPAREEXPORT (SID_SFX_START + 385)
+
+#define SID_MAIL_EXPORT_FINISHED (SID_SFX_START + 388)
+#define SID_WEBHTML (SID_SFX_START + 393)
+#define SID_MAIL_SCROLLBODY_PAGEDOWN (SID_SFX_START + 1588)
+
+#define SID_PROGRESS_STATUSBAR_CONTROL TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1597)
+
+#define SID_SELECTION TypedWhichId<SfxBoolItem>(SID_SFX_START + 346)
+
+// 360-400 see SID_MAIL_...
+
+// default-ids for help
+#define SID_HELPINDEX (SID_SFX_START + 401)
+#define SID_EXTENDEDHELP (SID_SFX_START + 402)
+#define SID_HELPBALLOONS TypedWhichId<SfxBoolItem>(SID_SFX_START + 403)
+#define SID_HELPTIPS TypedWhichId<SfxBoolItem>(SID_SFX_START + 404)
+#define SID_EMOJI_CONTROL (SID_SFX_START + 405)
+#define SID_CHARMAP_CONTROL (SID_SFX_START + 406)
+#define SID_TIPOFTHEDAY (SID_SFX_START + 407)
+
+// free (SID_SFX_START + 410)
+#define SID_SEND_FEEDBACK (SID_SFX_START + 421)
+#define SID_Q_AND_A (SID_SFX_START + 422)
+#define SID_DOCUMENTATION (SID_SFX_START + 423)
+#define SID_DONATION (SID_SFX_START + 424)
+#define SID_GETINVOLVED (SID_SFX_START + 425)
+#define SID_WHATSNEW (SID_SFX_START + 426)
+#define SID_HYPHENATIONMISSING (SID_SFX_START + 427)
+
+#define SID_SHOW_LICENSE (SID_SFX_START + 1683)
+#define SID_SHOW_CREDITS (SID_SFX_START + 1711)
+
+// default-ids for document
+#define SID_NEWDOC (SID_SFX_START + 500)
+#define SID_OPENDOC (SID_SFX_START + 501)
+#define SID_OPENREMOTE (SID_SFX_START + 517)
+#define SID_OPENURL (SID_SFX_START + 596)
+#define SID_JUMPTOMARK (SID_SFX_START + 598)
+#define SID_OPENTEMPLATE (SID_SFX_START + 594)
+#define SID_SAVEASDOC (SID_SFX_START + 502)
+#define SID_SAVEASREMOTE (SID_SFX_START + 516)
+#define SID_SAVESIMPLE (SID_SFX_START + 518)
+#define SID_SIGNPDF (SID_SFX_START + 519)
+#define SID_SAVEACOPY (SID_SFX_START + 999)
+#define SID_SAVEACOPYITEM (SID_SFX_START + 998)
+#define SID_CONVERT_IMAGES TypedWhichId<SfxStringItem>(SID_SFX_START + 997)
+#define SID_CLOSING (SID_SFX_START +1539)
+#define SID_CLOSEDOC (SID_SFX_START + 503)
+#define SID_CLOSEDOCS (SID_SFX_START + 595)
+#define SID_CLOSEDOC_SAVE (SID_SFX_START + 1)
+#define SID_CLOSEDOC_FILENAME (SID_SFX_START + 2)
+#define SID_PRINTDOC (SID_SFX_START + 504)
+#define SID_PRINT_COPIES (SID_SFX_START + 3)
+#define SID_PRINT_PAGES (SID_SFX_START +1589)
+#define SID_PRINT_COLLATE (SID_SFX_START +1590)
+#define SID_PRINT_SORT (SID_SFX_START +1591)
+#define SID_SAVEDOC (SID_SFX_START + 505)
+#define SID_FILE_NAME TypedWhichId<SfxStringItem>(SID_SFX_START + 507)
+#define SID_DOCINFO_TITLE TypedWhichId<SfxStringItem>(SID_SFX_START + 557)
+#define SID_FILE_FILTEROPTIONS TypedWhichId<SfxStringItem>(SID_SFX_START + 527)
+#define SID_RELOAD (SID_SFX_START + 508)
+#define SID_PRINTDOCDIRECT (SID_SFX_START + 509)
+#define SID_DOC_REPAIR TypedWhichId<SfxBoolItem>(SID_SFX_START + 510)
+#define SID_DOC_SERVICE TypedWhichId<SfxStringItem>(SID_SFX_START + 511)
+#define SID_PLUGIN_MODE TypedWhichId<SfxUInt16Item>(SID_SFX_START + 827)
+#define SID_EXPORTDOC (SID_SFX_START + 829)
+#define SID_EXPORTDOCASPDF (SID_SFX_START + 1673)
+#define SID_DIRECTEXPORTDOCASPDF (SID_SFX_START + 1674)
+#define SID_EXPORTDOCASEPUB (SID_SFX_START + 1677)
+#define SID_DIRECTEXPORTDOCASEPUB (SID_SFX_START + 1678)
+#define SID_REDACTDOC (SID_SFX_START + 1732)
+#define SID_AUTOREDACTDOC (SID_SFX_START + 1736)
+#define SID_UPDATEDOCMODE TypedWhichId<SfxUInt16Item>(SID_SFX_START + 1668)
+#define SID_CHECKOUT (SID_SFX_START + 512)
+#define SID_CANCELCHECKOUT (SID_SFX_START + 513)
+#define SID_CHECKIN (SID_SFX_START + 514)
+#define SID_FILTER_PROVIDER TypedWhichId<SfxStringItem>(SID_SFX_START + 515)
+
+#define SID_FORCERELOAD (SID_SFX_START + 1502)
+#define SID_FILE_DIALOG TypedWhichId<SfxBoolItem>(SID_SFX_START + 304)
+#define SID_REMOTE_DIALOG (SID_SFX_START + 305)
+#define SID_PATH TypedWhichId<SfxStringItem>(SID_SFX_START + 308)
+#define SID_SAVEDOCS (SID_SFX_START + 309)
+#define SID_STANDARD_DIR TypedWhichId<SfxStringItem>(SID_SFX_START + 450)
+#define SID_DENY_LIST TypedWhichId<SfxStringListItem>(SID_SFX_START + 451)
+
+// browse-ids
+#define SID_BROWSE_FORWARD (SID_SFX_START + 1300)
+#define SID_BROWSE_BACKWARD (SID_SFX_START + 1301)
+#define SID_CREATELINK (SID_SFX_START + 1309)
+#define SID_EDITDOC TypedWhichId<SfxBoolItem>(SID_SFX_START + 1312)
+#define SID_BROWSER_MODE (SID_SFX_START + 1313)
+#define SID_READONLYDOC (SID_SFX_START + 1314)
+#define SID_BROWSER (SID_SFX_START + 1318)
+#define SID_MACROEXECMODE TypedWhichId<SfxUInt16Item>(SID_SFX_START + 1319)
+
+#define SID_FILTER_DATA TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1375)
+
+#define SID_EXPLORER_FILEPROPS_START (SID_SFX_START + 1390)
+// SID_EXPLORER_FILEPROPS_END (SID_SFX_START + 1399)
+
+#define SID_ATTR_ZOOM TypedWhichId<SvxZoomItem>(SID_SVX_START + 0)
+
+#define SID_EXPLORER_PROPS_START TypedWhichId<SfxStringItem>(SID_SFX_START + 1410)
+// SID_EXPLORER_PROPS_END (SID_SFX_START + 1499)
+
+#define SID_AUTOLOAD (SID_SFX_START + 1509)
+#define SID_FILLFRAME TypedWhichId<SfxUnoFrameItem>(SID_SFX_START + 1516)
+#define SID_BASEURL (SID_SFX_START + 1518)
+#define SID_TEMPLATE TypedWhichId<SfxBoolItem>(SID_SFX_START + 1519)
+
+#define SID_CONTENTTYPE TypedWhichId<SfxStringItem>(SID_SFX_START + 1541)
+
+#define SID_SAVETO TypedWhichId<SfxBoolItem>(SID_SFX_START + 1546)
+
+#define SID_VERSION TypedWhichId<SfxInt16Item>(SID_SFX_START + 1583)
+
+#define SID_DOCUMENT_COMPARE (SID_SFX_START + 1586)
+#define SID_DOCUMENT_MERGE (SID_SFX_START + 1587)
+
+#define SID_OFFICE_CHECK_PLZ (SID_SFX_START + 1610)
+#define SID_CURRENT_URL (SID_SFX_START + 1613)
+
+#define SID_CHARSET TypedWhichId<SfxStringItem>(SID_SFX_START + 1633)
+#define SID_OVERWRITE (SID_SFX_START + 1634)
+ // FREE (was: SID_CRASH)
+#define SID_FAIL_ON_WARNING TypedWhichId<SfxBoolItem>(SID_SFX_START + 1646)
+#define SID_INPUTSTREAM TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1648)
+#define SID_LOGOUT (SID_SFX_START + 1652)
+#define SID_JUMPMARK TypedWhichId<SfxStringItem>(SID_SFX_START + 1654)
+#define SID_BROWSE (SID_SFX_START + 1658)
+ // FREE (was: SID_BACKTOWEBTOP)
+#define SID_VIEW_DATA_SOURCE_BROWSER (SID_SFX_START + 1660)
+#define SID_UNPACK (SID_SFX_START + 1662)
+// (SID_SFX_START + 1663) used further down
+ // FREE
+#define SID_OUTPUTSTREAM TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1666)
+#define SID_IMAGE_ORIENTATION (SID_SFX_START + 1667)
+
+#define SID_STOP_RECORDING (SID_SFX_START + 1671)
+#define SID_INTERACTIONHANDLER TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1675)
+#define SID_OPENHYPERLINK (SID_SFX_START + 1676)
+#define SID_CONTENT TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1679)
+#define SID_VIEWONLY TypedWhichId<SfxBoolItem>(SID_SFX_START + 1682)
+#define SID_REPAIRPACKAGE TypedWhichId<SfxBoolItem>(SID_SFX_START + 1683)
+#define SID_MINIMIZED TypedWhichId<SfxBoolItem>(SID_SFX_START + 1687)
+#define SID_COMPONENTDATA TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1688)
+#define SID_COMPONENTCONTEXT TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1689)
+#define SID_SCRIPTORGANIZER TypedWhichId<SfxScriptOrganizerItem>(SID_SFX_START + 1690)
+#define SID_MACROORGANIZER TypedWhichId<SfxUInt16Item>(SID_SFX_START + 1691)
+#define SID_RUNMACRO (SID_SFX_START + 1692)
+#define SID_AVMEDIA_TOOLBOX TypedWhichId<::avmedia::MediaItem>(SID_SFX_START + 1693)
+#define SID_AVMEDIA_PLAYER (SID_SFX_START + 1694)
+#define SID_INSERT_AVMEDIA (SID_SFX_START + 1696)
+#define SID_RECENTFILELIST (SID_SFX_START + 1697)
+#define SID_AVAILABLE_TOOLBARS (SID_SFX_START + 1698)
+#define SID_STREAM TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1699)
+#define SID_DOC_BASEURL TypedWhichId<SfxStringItem>(SID_SFX_START + 1700)
+#define SID_DOC_HIERARCHICALNAME TypedWhichId<SfxStringItem>(SID_SFX_START + 1701)
+#define SID_TERMINATE_INPLACEACTIVATION (SID_SFX_START + 1702)
+#define SID_APPLY_STYLE (SID_SFX_START + 1703)
+#define SID_MACRO_SIGNATURE (SID_SFX_START + 1704)
+#define SID_ATTR_WARNALIENFORMAT TypedWhichId<SfxBoolItem>(SID_SFX_START + 1705)
+#define SID_COPY_STREAM_IF_POSSIBLE TypedWhichId<SfxBoolItem>(SID_SFX_START + 1706)
+#define SID_MAIL_SENDDOCASFORMAT (SID_SFX_START + 1707)
+#define SID_MAIL_SENDDOCASMS (SID_SFX_START + 1708)
+#define SID_MAIL_SENDDOCASOOO (SID_SFX_START + 1709)
+#define SID_NO_ACCEPT_DIALOG TypedWhichId<SfxBoolItem>(SID_SFX_START + 1710)
+#define SID_NOAUTOSAVE TypedWhichId<SfxBoolItem>(SID_SFX_START + 1711)
+#define SID_PRINT_SELECTEDSHEET TypedWhichId<SfxBoolItem>(SID_SFX_START + 1712)
+#define SID_OPTIONS_PAGEURL (SID_SFX_START + 1713)
+#define SID_MORE_DICTIONARIES (SID_SFX_START + 1714)
+#define SID_ACTIVATE_STYLE_APPLY (SID_SFX_START + 1715)
+#define SID_FONT_NAME (SID_SFX_START + 1716)
+#define SID_DEFAULTFILENAME (SID_SFX_START + 1717)
+#define SID_MODIFYPASSWORDINFO TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1718)
+#define SID_RECOMMENDREADONLY (SID_SFX_START + 1719)
+#define SID_SUGGESTEDSAVEASDIR TypedWhichId<SfxStringItem>(SID_SFX_START + 1720)
+#define SID_SUGGESTEDSAVEASNAME TypedWhichId<SfxStringItem>(SID_SFX_START + 1721)
+#define SID_ENCRYPTIONDATA TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1722)
+#define SID_PASSWORDINTERACTION (SID_SFX_START + 1723)
+#define SID_GOTOLINE (SID_SFX_START + 1724)
+#define SID_SHOWLINES (SID_SFX_START + 1725)
+#define SID_BLUETOOTH_SENDDOC (SID_SFX_START + 1726)
+#define SID_TEMPLATE_MANAGER (SID_SFX_START + 1727)
+#define SID_TOOLBAR_MODE (SID_SFX_START + 1728)
+#define SID_NO_FILE_SYNC (SID_SFX_START + 1729)
+#define SID_NO_THUMBNAIL (SID_SFX_START + 1730)
+#define SID_LOCK_CONTENT_EXTRACTION TypedWhichId<SfxBoolItem>(SID_SFX_START + 1731)
+#define SID_LOCK_EXPORT TypedWhichId<SfxBoolItem>(SID_SFX_START + 1732)
+// Used to export a temporary file for preview in Mail Merge Wizard, where saving the data source is
+// not required for preview, but interferes with not-yet-saved embedded data source for main document.
+#define SID_NO_EMBEDDED_DS TypedWhichId<SfxBoolItem>(SID_SFX_START + 1731)
+#define SID_IS_REDACT_MODE (SID_SFX_START + 1733)
+#define SID_REDACTION_STYLE (SID_SFX_START + 1734)
+#define SID_DIALOG_PARENT TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1735)
+#define SID_LOCK_PRINT TypedWhichId<SfxBoolItem>(SID_SFX_START + 1736)
+#define SID_LOCK_SAVE TypedWhichId<SfxBoolItem>(SID_SFX_START + 1737)
+#define SID_LOCK_EDITDOC TypedWhichId<SfxBoolItem>(SID_SFX_START + 1738)
+#define SID_REPLACEABLE TypedWhichId<SfxBoolItem>(SID_SFX_START + 1739)
+#define SID_ADDITIONS_DIALOG (SID_SFX_START + 1740)
+#define FN_PARAM_ADDITIONS_TAG TypedWhichId<SfxStringItem>(SID_SFX_START + 1741)
+#define SID_TOOLBAR_MODE_UI (SID_SFX_START + 1742)
+#define SID_TOOLBAR_LOCK (SID_SFX_START + 1743)
+
+// SID_SFX_free_END (SID_SFX_START + 3999)
+
+#define SID_OPEN_NEW_VIEW TypedWhichId<SfxBoolItem>(SID_SFX_START + 520)
+ // FREE, was SID_VIEW_ZOOM_MODE
+ // FREE, was SID_VIEW_POS_SIZE
+#define SID_VIEW_ID TypedWhichId<SfxUInt16Item>(SID_SFX_START + 523)
+ // FREE, was SID_USER_DATA
+#define SID_VIEW_DATA TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1582)
+#define SID_SILENT TypedWhichId<SfxBoolItem>(SID_SFX_START + 528)
+#define SID_HIDDEN TypedWhichId<SfxBoolItem>(SID_SFX_START + 534)
+#define SID_PREVIEW TypedWhichId<SfxBoolItem>(SID_SFX_START + 1404)
+
+#define SID_FOCUSURLBOX (SID_SFX_START + 1406)
+
+#define SID_ACTIVATE (SID_SFX_START + 525)
+#define SID_PRINTOUT (SID_SFX_START + 526)
+
+#define SID_FILTER_NAME TypedWhichId<SfxStringItem>(SID_SFX_START + 530)
+#define SID_DOC_SALVAGE TypedWhichId<SfxStringItem>(SID_SFX_START + 531)
+#define SID_INSERTDOC (SID_SFX_START + 532)
+#define SID_TYPE_NAME TypedWhichId<SfxStringItem>(SID_SFX_START + 533)
+
+#define SID_DOC_READONLY TypedWhichId<SfxBoolItem>(SID_SFX_START + 590)
+#define SID_DOC_MODIFIED (SID_SFX_START + 584)
+#define SID_DOC_LOADING (SID_SFX_START + 585)
+#define SID_IMG_LOADING (SID_SFX_START + 586)
+#define SID_DOC_SAVED (SID_SFX_START + 599)
+#define SID_DOCINFO TypedWhichId<SfxDocumentInfoItem>(SID_SFX_START + 535)
+#define SID_DOCINFO_KEYWORDS (SID_SFX_START + 591)
+#define SID_DOCINFO_COMMENTS (SID_SFX_START + 592)
+#define SID_DOCINFO_AUTHOR (SID_SFX_START + 593)
+#define SID_DOCINFO_MAJOR (SID_SFX_START + 594)
+#define SID_NEWDOCDIRECT (SID_SFX_START + 537)
+#define SID_DOCFRAME (SID_SFX_START + 598)
+#define SID_TARGETNAME TypedWhichId<SfxStringItem>(SID_SFX_START + 560)
+#define SID_POSTDATA TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1536)
+#define SID_DONELINK (SID_SFX_START + 646)
+#define SID_REFERER (SID_SFX_START + 654)
+#define SID_PAGE_NUMBER (SID_SFX_START + 655)
+#define SID_MODIFIER TypedWhichId<SfxUInt16Item>(SID_SFX_START + 669)
+#define SID_SETOPTIONS (SID_SFX_START + 670)
+#define SID_SOURCEVIEW (SID_SFX_START + 675)
+#define SID_DOC_STARTPRESENTATION TypedWhichId<SfxBoolItem>(SID_SFX_START + 695)
+#define SID_DDE_RECONNECT_ONLOAD TypedWhichId<SfxBoolItem>(SID_SFX_START + 696)
+
+#define SID_DOCTEMPLATE (SID_SFX_START + 538)
+#define SID_AUTOPILOTMENU (SID_SFX_START + 1381)
+
+// Floating Window Template
+#define SID_STYLE_DESIGNER TypedWhichId<SfxBoolItem>(SID_SFX_START + 539)
+
+#define SID_SIDEBAR_DECK (SID_SFX_START + 850)
+
+#define SID_TEMPLATE_ADDRESSBOOKSOURCE (SID_SFX_START + 1655)
+
+// Ruby dialog
+#define SID_RUBY_DIALOG (SID_SFX_START + 1656)
+
+#define SID_STYLE_FAMILY_START (SID_SFX_START + 541)
+#define SID_STYLE_FAMILY1 (SID_STYLE_FAMILY_START)
+#define SID_STYLE_FAMILY2 (SID_STYLE_FAMILY_START + 1)
+#define SID_STYLE_FAMILY3 (SID_STYLE_FAMILY_START + 2)
+#define SID_STYLE_FAMILY4 (SID_STYLE_FAMILY_START + 3)
+#define SID_STYLE_FAMILY5 (SID_STYLE_FAMILY_START + 4)
+#define SID_STYLE_FAMILY6 (SID_STYLE_FAMILY_START + 5)
+
+#define SID_STYLE_NEW (SID_SFX_START + 549)
+#define SID_STYLE_EDIT (SID_SFX_START + 550)
+#define SID_STYLE_DELETE (SID_SFX_START + 551)
+#define SID_STYLE_APPLY (SID_SFX_START + 552)
+#define SID_STYLE_FAMILY TypedWhichId<SfxUInt16Item>(SID_SFX_START + 553)
+#define SID_STYLE_FAMILYNAME TypedWhichId<SfxStringItem>(SID_SFX_START + 566)
+#define SID_STYLE_WATERCAN (SID_SFX_START + 554)
+#define SID_STYLE_NEW_BY_EXAMPLE (SID_SFX_START + 555)
+#define SID_STYLE_UPDATE_BY_EXAMPLE (SID_SFX_START + 556)
+#define SID_STYLE_DRAGHIERARCHIE (SID_SFX_START + 565)
+#define SID_STYLE_MASK (SID_SFX_START + 562)
+#define SID_STYLE_PREVIEW (SID_SFX_START + 567)
+#define SID_STYLE_END_PREVIEW (SID_SFX_START + 568)
+#define SID_STYLE_HIDE (SID_SFX_START + 1603)
+#define SID_STYLE_SHOW (SID_SFX_START + 1604)
+#define SID_STYLE_UPD_BY_EX_NAME TypedWhichId<SfxStringItem>(SID_SFX_START + 1585)
+#define SID_STYLE_REFERENCE TypedWhichId<SfxStringItem>(SID_SFX_START + 1602)
+
+#define SID_TEMPLATE_NAME TypedWhichId<SfxStringItem>(SID_SFX_START + 660)
+#define SID_TEMPLATE_REGIONNAME TypedWhichId<SfxStringItem>(SID_SFX_START + 662)
+#define SID_TEMPLATE_LOAD (SID_SFX_START + 663)
+
+#define SID_INSERT_OBJECT (SID_SFX_START + 561)
+#define SID_INSERT_FLOATINGFRAME (SID_SFX_START + 563)
+#define SID_CLASSIFICATION_APPLY (SID_SFX_START + 672)
+#define SID_WATERMARK TypedWhichId<SfxWatermarkItem>(SID_SFX_START + 676)
+#define SID_WATERMARK_FONT TypedWhichId<SfxStringItem>(SID_SFX_START + 677)
+#define SID_WATERMARK_TRANSPARENCY TypedWhichId<SfxInt16Item>(SID_SFX_START + 805)
+#define SID_WATERMARK_COLOR TypedWhichId<SfxUInt32Item>(SID_SFX_START + 806)
+#define SID_WATERMARK_ANGLE TypedWhichId<SfxInt16Item>(SID_SFX_START + 807)
+
+#define SID_HYPERLINK_DIALOG (SID_SFX_START + 678)
+
+#define SID_DEFAULTFILEPATH (SID_SFX_START + 571)
+#define SID_OBJECT (SID_SFX_START + 575)
+
+// Doc-Properties
+#define SID_DOCFULLNAME (SID_SFX_START + 581)
+#define SID_DOCPATH (SID_SFX_START + 582)
+#define SID_DOCTITLE TypedWhichId<SfxStringItem>(SID_SFX_START + 583)
+
+#define SID_DOCUMENT TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 588)
+
+// default-ids for windows
+
+#define SID_COMMAND_POPUP (SID_SFX_START + 610)
+#define SID_NEWWINDOW (SID_SFX_START + 620)
+#define SID_CLOSEWIN (SID_SFX_START + 621)
+#define SID_VIEWSHELL TypedWhichId<SfxUInt16Item>(SID_SFX_START + 623)
+#define SID_WIN_FULLSCREEN TypedWhichId<SfxBoolItem>(SID_SFX_START + 627)
+
+#define SID_VIEWSHELL0 (SID_SFX_START + 630)
+#define SID_VIEWSHELL1 (SID_SFX_START + 631)
+#define SID_VIEWSHELL2 (SID_SFX_START + 632)
+#define SID_VIEWSHELL3 (SID_SFX_START + 633)
+#define SID_VIEWSHELL4 (SID_SFX_START + 634)
+
+// id for thesaurus entry in context menu
+#define SID_THES (SID_SFX_START + 698)
+#define FN_PARAM_THES_WORD_REPLACE TypedWhichId<SfxStringItem>(SID_SFX_START + 699)
+
+// default-ids for editing, cursor travelling and selection
+#define SID_REDO (SID_SFX_START + 700)
+#define SID_UNDO (SID_SFX_START + 701)
+#define SID_REPEAT (SID_SFX_START + 702)
+#define SID_CLEARHISTORY (SID_SFX_START + 703)
+#define SID_CUT (SID_SFX_START + 710)
+#define SID_COPY (SID_SFX_START + 711)
+#define SID_PASTE (SID_SFX_START + 712)
+#define SID_DELETE (SID_SFX_START + 713)
+
+#define SID_BACKSPACE (SID_SFX_START + 714)
+#define SID_FORMATPAINTBRUSH TypedWhichId<SfxBoolItem>(SID_SFX_START + 715)
+#define SID_SELECT (SID_SFX_START + 720)
+#define SID_SELECTALL (SID_SFX_START + 723)
+#define SID_CURSORDOWN (SID_SFX_START + 731)
+#define SID_CURSORUP (SID_SFX_START + 732)
+#define SID_CURSORLEFT (SID_SFX_START + 733)
+#define SID_CURSORRIGHT (SID_SFX_START + 734)
+#define SID_CURSORPAGEDOWN (SID_SFX_START + 735)
+#define SID_CURSORPAGEUP (SID_SFX_START + 736)
+#define SID_CURSORENDOFFILE (SID_SFX_START + 741)
+#define SID_CURSORTOPOFFILE (SID_SFX_START + 742)
+#define SID_CURSORENDOFSCREEN (SID_SFX_START + 743)
+#define SID_CURSORTOPOFSCREEN (SID_SFX_START + 744)
+#define SID_CURSORHOME (SID_SFX_START + 745)
+#define SID_CURSOREND (SID_SFX_START + 746)
+#define SID_UNICODE_NOTATION_TOGGLE (SID_SFX_START + 792)
+
+// default-ids for macros
+#define SID_RECORDING_FLOATWINDOW (SID_SFX_START + 800)
+#define SID_RECORDMACRO TypedWhichId<SfxBoolItem>(SID_SFX_START + 1669)
+
+// Paste Special
+#define SID_PASTE_ONLY_TEXT (SID_SFX_START + 802)
+#define SID_PASTE_ONLY_FORMULA (SID_SFX_START + 803)
+#define SID_PASTE_ONLY_VALUE (SID_SFX_START + 804)
+#define SID_PASTE_TEXTIMPORT_DIALOG (SID_SFX_START + 805)
+#define SID_PASTE_TRANSPOSED (SID_SFX_START + 812)
+#define SID_PASTE_AS_LINK (SID_SFX_START + 813)
+
+// Used for redaction
+#define SID_SHAPE_NAME (SID_SFX_START + 808)
+ // FREE: SID_SFX_START + 809
+#define SID_GRAPHIC_SIZE_CHECK (SID_SFX_START + 809)
+#define SID_ACCESSIBILITY_CHECK (SID_SFX_START + 810)
+#define SID_ASYNCHRON (SID_SFX_START + 811)
+
+// default-ids for configuration
+#define SID_CONFIG (SID_SFX_START + 904)
+#define SID_TOOLBOXOPTIONS (SID_SFX_START + 907)
+#define SID_TOGGLEFUNCTIONBAR (SID_SFX_START + 910)
+#define SID_MACROINFO TypedWhichId<SfxMacroInfoItem>(SID_SFX_START + 919)
+#define SID_TOGGLESTATUSBAR (SID_SFX_START + 920)
+#define SID_CONFIGSTATUSBAR (SID_SFX_START + 921)
+#define SID_CONFIGMENU (SID_SFX_START + 924)
+#define SID_CONFIGACCEL (SID_SFX_START + 925)
+#define SID_CONFIGEVENT (SID_SFX_START + 926)
+#define SID_CFGFILE (SID_SFX_START + 927)
+#define SID_SHOWPOPUPS (SID_SFX_START + 929)
+
+// Item-Id for the assigned event Tabpage.
+// FIXME this has two different associated pool item types, SvxMacroItem and SfxBoolItem
+#define SID_ATTR_MACROITEM TypedWhichId<SvxMacroItem>(SID_SFX_START + 934)
+
+#define SID_OPTIONS (SID_SFX_START + 940)
+#define SID_BASICLOAD (SID_SFX_START + 951)
+#define SID_BASICSAVEAS (SID_SFX_START + 953)
+#define SID_BASICCOMPILE (SID_SFX_START + 954)
+#define SID_BASICRUN (SID_SFX_START + 955)
+#define SID_BASICSTEPINTO (SID_SFX_START + 956)
+#define SID_BASICSTEPOVER (SID_SFX_START + 957)
+#define SID_BASICSTEPOUT (SID_SFX_START + 963)
+#define SID_BASICSTOP (SID_SFX_START + 958)
+#define SID_BASICCHOOSER (SID_SFX_START + 959)
+#define SID_GALLERY (SID_SFX_START + 960)
+#define SID_SEARCH_DLG (SID_SFX_START + 961)
+#define SID_SEARCH_QUIET (SID_SFX_START + 1684)
+#define SID_EXPORT_DIALOG (SID_SFX_START + 965)
+#define SID_IMPORT_DIALOG (SID_SFX_START + 966)
+
+#define SID_BASICBREAK (SID_SFX_START +1521)
+
+#define SID_OBJECTRESIZE TypedWhichId<SfxRectangleItem>(SID_SFX_START + 1000)
+
+#define SID_EVENTCONFIG TypedWhichId<SfxEventNamesItem>(SID_SFX_START + 1101)
+#define SID_VERB_START (SID_SFX_START + 1100)
+#define SID_VERB_END (SID_SFX_START + 1121)
+
+#define SID_SIGNATURE (SID_SFX_START + 1643)
+
+// SaveTabPage
+#define SID_ATTR_DOCINFO TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 0)
+#define SID_ATTR_BACKUP TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 1)
+#define SID_ATTR_AUTOSAVE TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 2)
+#define SID_ATTR_AUTOSAVEPROMPT TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 3)
+#define SID_ATTR_USERAUTOSAVE TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 4)
+#define SID_ATTR_AUTOSAVEMINUTE TypedWhichId<SfxUInt16Item>(SID_OPTIONS_START + 5)
+#define SID_ATTR_WORKINGSET TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 13)
+#define SID_ATTR_UNDO_COUNT TypedWhichId<SfxUInt16Item>(SID_OPTIONS_START + 16)
+ // unused
+#define SID_ATTR_SAVEDOCVIEW TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 18)
+
+// GeneralTabPage
+
+#define SID_ATTR_METRIC TypedWhichId<SfxUInt16Item>(SID_OPTIONS_START + 8)
+#define SID_ATTR_DEFTABSTOP TypedWhichId<SfxUInt16Item>(SID_OPTIONS_START + 14)
+#define SID_ATTR_BUTTON_BIGSIZE TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 63)
+#define SID_ATTR_QUICKLAUNCHER TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 74)
+#define SID_ATTR_YEAR2000 TypedWhichId<SfxUInt16Item>(SID_OPTIONS_START + 87)
+#define SID_ATTR_APPLYCHARUNIT TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 88)
+
+// PathTabPage
+#define SID_ATTR_PATHNAME TypedWhichId<SfxAllEnumItem>(SID_OPTIONS_START + 11)
+
+// LinguTabPage
+#define SID_ATTR_LANGUAGE TypedWhichId<SvxLanguageItem>(SID_OPTIONS_START + 7)
+#define SID_ATTR_HYPHENREGION TypedWhichId<SfxHyphenRegionItem>(SID_OPTIONS_START + 12)
+#define SID_AUTOSPELL_CHECK TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 21)
+
+// InetTabPage
+
+#define SID_INET_PROXY_TYPE TypedWhichId<SfxUInt16Item>(SID_OPTIONS_START + 23)
+
+#define SID_SAVEREL_INET TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 30)
+#define SID_SAVEREL_FSYS TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 31)
+
+#define SID_PASSWORD TypedWhichId<SfxStringItem>(SID_OPTIONS_START + 36)
+
+#define SID_INET_NOPROXY TypedWhichId<SfxStringItem>(SID_OPTIONS_START + 37)
+
+#define SID_INET_HTTP_PROXY_NAME TypedWhichId<SfxStringItem>(SID_OPTIONS_START + 38)
+#define SID_INET_HTTP_PROXY_PORT TypedWhichId<SfxInt32Item>(SID_OPTIONS_START + 39)
+#define SID_INET_FTP_PROXY_NAME TypedWhichId<SfxStringItem>(SID_OPTIONS_START + 40)
+#define SID_INET_FTP_PROXY_PORT TypedWhichId<SfxInt32Item>(SID_OPTIONS_START + 41)
+
+// Automatic update of Styles - manage TabPage
+#define SID_ATTR_AUTO_STYLE_UPDATE TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 65)
+
+#define SID_SECURE_URL TypedWhichId<SfxStringListItem>(SID_OPTIONS_START + 66)
+
+// configured locale changed
+#define SID_OPT_LOCALE_CHANGED (SID_OPTIONS_START + 94)
+//middle mouse button
+#define SID_ATTR_PRETTYPRINTING TypedWhichId<SfxBoolItem>(SID_OPTIONS_START + 98)
+#define SID_HELP_STYLESHEET TypedWhichId<SfxStringItem>(SID_OPTIONS_START + 99)
+
+// slot IDs from SVX (svxids.hrc) ---------------------------------------------
+// These SID_SVX_START entries came from include/svx/svxids.hrc, avoid
+// accidentally colliding entries with include/svx/svxids.hrc and
+// include/editeng/editids.hrc. Only add new SID_SVX_START entries
+// to include/svx/svxids.hrc
+
+#define SID_ZOOM_TOOLBOX (SID_SVX_START + 96)
+#define SID_ZOOM_OUT (SID_SVX_START + 97)
+#define SID_ZOOM_IN (SID_SVX_START + 98)
+#define SID_SIZE_REAL (SID_SVX_START + 99)
+#define SID_SIZE_PAGE (SID_SVX_START + 100)
+#define SID_GALLERY_BG_BRUSH (SID_SVX_START + 279)
+#define SID_SEARCH_OPTIONS (SID_SVX_START + 281)
+#define SID_SEARCH_ITEM TypedWhichId<SvxSearchItem>(SID_SVX_START + 291)
+#define SID_SIDEBAR (SID_SVX_START + 336)
+#define SID_NOTEBOOKBAR (SID_SVX_START + 338)
+#define SID_MENUBAR (SID_SVX_START + 339)
+#define SID_HYPERLINK_GETLINK TypedWhichId<SvxHyperlinkItem>(SID_SVX_START + 361)
+#define SID_HYPERLINK_SETLINK TypedWhichId<SvxHyperlinkItem>(SID_SVX_START + 362)
+#define SID_INFOBAR (SID_SVX_START + 365)
+#define SID_NAVIGATOR (SID_SVX_START + 366)
+#define SID_ZOOM_NEXT (SID_SVX_START + 402)
+#define SID_ZOOM_PREV (SID_SVX_START + 403)
+#define SID_INET_DLG (SID_SVX_START + 416)
+#define SID_AUTO_CORRECT_DLG (SID_SVX_START + 424)
+#define SID_ATTR_CHAR_COLOR_EXT (SID_SVX_START + 488)
+#define SID_ATTR_CHAR_COLOR_BACKGROUND (SID_SVX_START + 489)
+#define SID_ATTR_CHAR_COLOR_BACKGROUND_EXT (SID_SVX_START + 490)
+#define SID_ATTR_CHAR_COLOR2 (SID_SVX_START + 537)
+#define SID_ATTR_COLOR_STR TypedWhichId<SfxStringItem>(SID_SVX_START + 540)
+#define SID_COMP_BIBLIOGRAPHY (SID_SVX_START + 880)
+#define SID_ADDRESS_DATA_SOURCE (SID_SVX_START + 934)
+#define SID_OPEN_SMARTTAGOPTIONS TypedWhichId<SfxBoolItem>(SID_SVX_START + 1062)
+#define SID_RULER_MARGIN1 TypedWhichId<SfxStringItem>(SID_SVX_START + 1063)
+#define SID_RULER_MARGIN2 TypedWhichId<SfxStringItem>(SID_SVX_START + 1064)
+#define SID_TABLE_BORDER_TYPE TypedWhichId<SfxStringItem>(SID_SVX_START + 1065)
+#define SID_TABLE_BORDER_INDEX TypedWhichId<SfxUInt16Item>(SID_SVX_START + 1066)
+#define SID_TABLE_BORDER_OFFSET TypedWhichId<SfxInt32Item>(SID_SVX_START + 1067)
+
+#define FID_SVX_START (SID_LIB_START + 500)
+#define FID_SEARCH_NOW (FID_SVX_START + 2)
+#define SID_BASICIDE_REPEAT_SEARCH (FID_SVX_START + 3)
+
+// SlotIds for Basic -------------------------------------------------------
+#define SID_BASICIDE_TOGGLEBRKPNT ( SID_BASICIDE_START + 0 )
+#define SID_BASICIDE_ADDWATCH ( SID_BASICIDE_START + 1 )
+#define SID_BASICIDE_CHOOSEMACRO ( SID_BASICIDE_START + 2 )
+#define SID_BASICIDE_EDITMACRO ( SID_BASICIDE_START + 3 )
+#define SID_BASICIDE_CREATEMACRO ( SID_BASICIDE_START + 4 )
+#define SID_BASICIDE_MODULEDLG ( SID_BASICIDE_START + 5 )
+#define SID_BASICIDE_OBJCAT ( SID_BASICIDE_START + 6 )
+#define SID_BASICIDE_REMOVEWATCH ( SID_BASICIDE_START + 7 )
+#define SID_BASICIDE_SHOWSBX ( SID_BASICIDE_START + 9 )
+#define SID_BASICIDE_HIDECURPAGE ( SID_BASICIDE_START + 10 )
+#define SID_BASICIDE_NAMECHANGEDONTAB ( SID_BASICIDE_START + 11 )
+#define SID_BASICIDE_UPDATEMODULESOURCE ( SID_BASICIDE_START + 12 )
+#define SID_BASICIDE_STOREMODULESOURCE ( SID_BASICIDE_START + 13 )
+#define SID_BASICIDE_MATCHGROUP ( SID_BASICIDE_START + 14 )
+#define SID_BASICIDE_APPEAR ( SID_BASICIDE_START + 15 )
+#define SID_BASICIDE_STOREALLMODULESOURCES ( SID_BASICIDE_START + 16 )
+#define SID_BASICIDE_UPDATEALLMODULESOURCES ( SID_BASICIDE_START + 17 )
+#define SID_BASICIDE_LIBSELECTED ( SID_BASICIDE_START + 18 )
+#define SID_BASICIDE_LIBSELECTOR ( SID_BASICIDE_START + 19 )
+#define SID_BASICIDE_NEWDIALOG ( SID_BASICIDE_START + 20 )
+#define SID_BASICIDE_NEWMODULE ( SID_BASICIDE_START + 21 )
+#define SID_BASICIDE_DELETECURRENT ( SID_BASICIDE_START + 22 )
+#define SID_BASICIDE_RENAMECURRENT ( SID_BASICIDE_START + 23 )
+#define SID_BASICIDE_SBXDELETED ( SID_BASICIDE_START + 24 )
+#define SID_BASICIDE_SBXINSERTED ( SID_BASICIDE_START + 25 )
+#define SID_BASICIDE_SBXRENAMED ( SID_BASICIDE_START + 26 )
+#define SID_BASICIDE_LIBLOADED ( SID_BASICIDE_START + 27 )
+#define SID_BASICIDE_LIBREMOVED ( SID_BASICIDE_START + 28 )
+#define SID_BASICIDE_ARG_TABID TypedWhichId<SfxUInt16Item>( SID_BASICIDE_START + 30 )
+#define SID_BASICIDE_ARG_SBX TypedWhichId<SbxItem>( SID_BASICIDE_START + 31 )
+#define SID_BASICIDE_ARG_MACROINFO TypedWhichId<SfxMacroInfoItem>( SID_BASICIDE_START + 32 )
+#define SID_BASICIDE_ARG_LIBNAME TypedWhichId<SfxStringItem>( SID_BASICIDE_START + 34 )
+#define SID_BASICIDE_ARG_MODULENAME TypedWhichId<SfxStringItem>( SID_BASICIDE_START + 35 )
+#define SID_BASICIDE_BRKPNTSCHANGED ( SID_BASICIDE_START + 36 )
+#define SID_BASICIDE_STAT_POS ( SID_BASICIDE_START + 38 )
+#define SID_BASICIDE_STAT_DATE ( SID_BASICIDE_START + 39 )
+#define SID_BASICIDE_STAT_TITLE ( SID_BASICIDE_START + 40 )
+#define SID_BASICIDE_MANAGEBRKPNTS ( SID_BASICIDE_START + 42 )
+#define SID_BASICIDE_TOGGLEBRKPNTENABLED ( SID_BASICIDE_START + 43 )
+#define SID_BASICIDE_SHOWWINDOW ( SID_BASICIDE_START + 44 )
+#define SID_BASICIDE_ARG_DOCUMENT TypedWhichId<SfxUnoAnyItem>( SID_BASICIDE_START + 45 )
+#define SID_BASICIDE_ARG_NAME ( SID_BASICIDE_START + 46 )
+#define SID_BASICIDE_ARG_TYPE ( SID_BASICIDE_START + 47 )
+#define SID_BASICIDE_ARG_LINE ( SID_BASICIDE_START + 48 )
+#define SID_BASICIDE_ARG_COLUMN1 ( SID_BASICIDE_START + 49 )
+#define SID_BASICIDE_ARG_COLUMN2 ( SID_BASICIDE_START + 50 )
+#define SID_BASICIDE_ARG_DOCUMENT_MODEL TypedWhichId<SfxUnoAnyItem>( SID_BASICIDE_START + 51 )
+#define SID_BASICIDE_MANAGE_LANG ( SID_BASICIDE_START + 52 )
+#define SID_BASICIDE_CURRENT_LANG ( SID_BASICIDE_START + 53 )
+#define SID_OPTIONS_TREEDIALOG ( SID_BASICIDE_START + 862)
+
+// SlotIds for Apps --------------------------------------------------------
+#define FN_PARAM (SID_SW_START + 1100)
+#define FN_PARAM_1 (FN_PARAM+60)
+#define FN_PARAM_2 (FN_PARAM+61)
+#define FN_PARAM_3 (FN_PARAM+62)
+#define FN_PARAM_4 (FN_PARAM+63)
+#define FN_PARAM_5 (FN_PARAM+64)
+#define FN_PARAM_6 (FN_PARAM+65)
+#define FN_FAX (SID_SW_START + 28) /* Fax */
+
+#define SID_KEYFUNC_START (SID_SC_START + 521)
+#define SID_CURSORDOWN_SEL (SID_KEYFUNC_START + 0)
+#define SID_CURSORUP_SEL (SID_KEYFUNC_START + 1)
+#define SID_CURSORLEFT_SEL (SID_KEYFUNC_START + 2)
+#define SID_CURSORRIGHT_SEL (SID_KEYFUNC_START + 3)
+#define SID_CURSORPAGEDOWN_SEL (SID_KEYFUNC_START + 4)
+#define SID_CURSORPAGEUP_SEL (SID_KEYFUNC_START + 5)
+#define SID_CURSORPAGELEFT_SEL (SID_KEYFUNC_START + 7)
+#define SID_CURSORPAGERIGHT_SEL (SID_KEYFUNC_START + 9)
+#define SID_CURSORTOPOFFILE_SEL (SID_KEYFUNC_START + 10)
+#define SID_CURSORENDOFFILE_SEL (SID_KEYFUNC_START + 11)
+#define SID_CURSORHOME_SEL (SID_KEYFUNC_START + 12)
+#define SID_CURSOREND_SEL (SID_KEYFUNC_START + 13)
+#define SID_REPAINT (SID_SC_START + 12)
+
+#define SID_MODIFIED TypedWhichId<SfxBoolItem>(SID_SD_START+89)
+#define ID_VAL_DUMMY0 (SID_SD_START+230)
+#define SID_SIZE_OPTIMAL (SID_SD_START+99)
+
+#define SID_ZOOM_OPTIMAL (SID_SIZE_OPTIMAL)
+#define SID_ZOOM_ENTIRE_PAGE (SID_SIZE_PAGE)
+#define SID_ZOOM_PAGE_WIDTH (SID_SVX_START + 1420)
+#define SID_ZOOM_50_PERCENT (SID_SVX_START + 1421)
+#define SID_ZOOM_75_PERCENT (SID_SVX_START + 1422)
+#define SID_ZOOM_100_PERCENT (SID_SIZE_REAL)
+#define SID_ZOOM_150_PERCENT (SID_SVX_START + 1423)
+#define SID_ZOOM_200_PERCENT (SID_SVX_START + 1424)
+
+// SfxScriptOrganizerItem
+#define MID_SCRIPT_ORGANIZER_LANGUAGE 1 // Don't use zero for MID's. It's forbidden to do it!
+
+#define SID_NEWSD (SID_SFX_START + 1686)
+#define FN_LABEL (SID_SW_START + 1051 )
+#define FN_BUSINESS_CARD (SID_SW_START + 1052)
+#define FN_XFORMS_INIT (SID_SW_START + 1053)
+
+#define SID_RESTORE_EDITING_VIEW (SID_SFX_START + 1663)
+
+// SfxSecurityPage related stuff
+
+#define FN_EDIT2 (SID_SW_START + 1800)
+#define FN_REDLINE_PROTECT TypedWhichId<SfxBoolItem>(FN_EDIT2 + 23)
+#define FN_REDLINE_ON TypedWhichId<SfxBoolItem>(FN_EDIT2 + 25)
+
+#define SID_HTML_MODE TypedWhichId<SfxUInt16Item>(SID_SVX_START + 414)
+
+// Calc-Id's used for SfxSecurityPage
+#ifndef SC_FUNCTION_START
+#define SC_FUNCTION_START (SID_SC_START + 200)
+#endif
+#ifndef FILE_MENU_END
+#define FILE_MENU_END (SC_FUNCTION_START + 20)
+#endif
+#ifndef EDIT_MENU_START
+#define EDIT_MENU_START (FILE_MENU_END)
+#endif
+#ifndef SC_VIEW_START
+#define SC_VIEW_START (SID_SC_START)
+#endif
+#define FID_CHG_RECORD TypedWhichId<SfxBoolItem>(EDIT_MENU_START + 18)
+#define SID_CHG_PROTECT TypedWhichId<SfxBoolItem>(SC_VIEW_START + 84)
+
+#endif // #ifndef INCLUDED_SFX2_SFXSIDS_HRC
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxstatuslistener.hxx b/include/sfx2/sfxstatuslistener.hxx
new file mode 100644
index 000000000..384d5ac19
--- /dev/null
+++ b/include/sfx2/sfxstatuslistener.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_SFXSTATUSLISTENER_HXX
+#define INCLUDED_SFX2_SFXSTATUSLISTENER_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <svl/poolitem.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+
+#include <cppuhelper/implbase.hxx>
+
+namespace com::sun::star::frame { class XDispatch; }
+namespace com::sun::star::frame { class XDispatchProvider; }
+namespace com::sun::star::frame { struct FeatureStateEvent; }
+
+class SFX2_DLLPUBLIC SfxStatusListener : public cppu::WeakImplHelper<
+ css::frame::XStatusListener,
+ css::lang::XComponent>
+{
+ public:
+
+ SfxStatusListener( const css::uno::Reference< css::frame::XDispatchProvider >& rDispatchProvider, sal_uInt16 nSlotId, const OUString& aCommand );
+ virtual ~SfxStatusListener() override;
+
+ // old methods from SfxControllerItem
+ sal_uInt16 GetId() const { return m_nSlotID; }
+ void UnBind();
+ void ReBind();
+
+ virtual void StateChangedAtStatusListener( SfxItemState eState, const SfxPoolItem* pState );
+
+ // XComponent
+ virtual void SAL_CALL dispose() override;
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override;
+
+ private:
+ SfxStatusListener( const SfxStatusListener& ) = delete;
+ SfxStatusListener& operator=( const SfxStatusListener& ) = delete;
+
+ sal_uInt16 m_nSlotID;
+ css::util::URL m_aCommand;
+ css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchProvider;
+ css::uno::Reference< css::frame::XDispatch > m_xDispatch;
+};
+
+#endif // INCLUDED_SFX2_SFXSTATUSLISTENER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxuno.hxx b/include/sfx2/sfxuno.hxx
new file mode 100644
index 000000000..6c6253f37
--- /dev/null
+++ b/include/sfx2/sfxuno.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_SFXUNO_HXX
+#define INCLUDED_SFX2_SFXUNO_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+
+namespace com::sun::star::beans { struct NamedValue; }
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+class SfxAllItemSet ;
+class SfxItemSet ;
+class SfxSlot ;
+
+SFX2_DLLPUBLIC void TransformParameters( sal_uInt16 nSlotId ,
+ const css::uno::Sequence< css::beans::PropertyValue >& seqArgs ,
+ SfxAllItemSet& aSet ,
+ const SfxSlot* pSlot = nullptr );
+
+SFX2_DLLPUBLIC void TransformItems( sal_uInt16 nSlotId ,
+ const SfxItemSet& aSet ,
+ css::uno::Sequence< css::beans::PropertyValue >& seqArgs ,
+ const SfxSlot* pSlot = nullptr );
+
+bool GetEncryptionData_Impl( const SfxItemSet* pSet, css::uno::Sequence< css::beans::NamedValue >& aEncryptionData );
+
+typedef sal_Int32 FrameSearchFlags;
+
+#endif // INCLUDED_SFX2_SFXUNO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx
new file mode 100644
index 000000000..2da1472a8
--- /dev/null
+++ b/include/sfx2/shell.hxx
@@ -0,0 +1,587 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_SHELL_HXX
+#define INCLUDED_SFX2_SHELL_HXX
+
+#include <memory>
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sal/types.h>
+#include <svl/typedwhich.hxx>
+#include <sfx2/dllapi.h>
+#include <svl/SfxBroadcaster.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <o3tl/strong_int.hxx>
+#include <optional>
+
+namespace com::sun::star::embed { struct VerbDescriptor; }
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+class SfxItemPool;
+class SfxPoolItem;
+class SfxRequest;
+class SfxItemSet;
+class SfxInterface;
+class SfxViewShell;
+class SfxObjectShell;
+
+class SfxShell;
+struct SfxShell_Impl;
+class SfxDispatcher;
+class SfxViewFrame;
+class SfxSlot;
+class SfxRepeatTarget;
+class SfxBindings;
+class SfxModule;
+class SfxUndoManager;
+
+/**
+ Id for <SfxInterface>s, gives a quasi-static access to the interface
+ through an array to <SfxApplication>.
+*/
+typedef o3tl::strong_int<sal_uInt16, struct SfxInterfaceIdTag> SfxInterfaceId;
+
+constexpr auto SFX_INTERFACE_NONE = SfxInterfaceId(0);
+constexpr auto SFX_INTERFACE_SFXAPP = SfxInterfaceId(1);
+constexpr auto SFX_INTERFACE_SFXDOCSH = SfxInterfaceId(2);
+constexpr auto SFX_INTERFACE_SFXVIEWSH = SfxInterfaceId(3);
+constexpr auto SFX_INTERFACE_SFXVIEWFRM = SfxInterfaceId(4);
+constexpr auto SFX_INTERFACE_SFXMODULE = SfxInterfaceId(5);
+constexpr auto SFX_INTERFACE_SC_START = SfxInterfaceId(150);
+constexpr auto SFX_INTERFACE_SD_START = SfxInterfaceId(200);
+constexpr auto SFX_INTERFACE_SW_START = SfxInterfaceId(250);
+constexpr auto SFX_INTERFACE_SMA_START = SfxInterfaceId(340);
+constexpr auto SFX_INTERFACE_IDE_START = SfxInterfaceId(400);
+constexpr auto SFX_INTERFACE_IDE_END = SfxInterfaceId(409);
+
+enum class SfxShellFeature
+{
+ NONE = 0x0000,
+ // Writer only, class SwView
+ SwChildWindowLabel = 0x0001,
+ // Basic only, class Shell
+ BasicShowBrowser = 0x0004,
+ // Forms only, class FmFormShell
+ FormShowDatabaseBar = 0x0008,
+ FormShowField = 0x0010,
+ FormShowProperties = 0x0020,
+ FormShowExplorer = 0x0040,
+ FormShowFilterBar = 0x0080,
+ FormShowFilterNavigator = 0x0100,
+ FormShowTextControlBar = 0x0200,
+ FormTBControls = 0x0400,
+ FormTBDesign = 0x1000,
+ FormShowDataNavigator = 0x2000,
+ // masks to make sure modules don't use flags from another
+ SwMask = 0x0001,
+ BasicMask = 0x0004,
+ FormMask = 0x3ff8
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SfxShellFeature> : is_typed_flags<SfxShellFeature, 0x37fd> {};
+}
+
+/* Flags that are being used in the slot definitions for the disable-features */
+enum class SfxDisableFlags {
+ NONE,
+ SwOnProtectedCursor = 0x0001,
+ SwOnMailboxEditor = 0x0002,
+};
+namespace o3tl {
+ template<> struct typed_flags<SfxDisableFlags> : is_typed_flags<SfxDisableFlags, 0x0003> {};
+}
+
+typedef void (*SfxExecFunc)(SfxShell *, SfxRequest &rReq);
+typedef void (*SfxStateFunc)(SfxShell *, SfxItemSet &rSet);
+
+/**
+ The class SfxShell is the base class for all classes, which provide
+ the functionality of the form <Slot>s.
+
+ Each instance has a reference to an interface description, which is
+ obtainable through <SfxShell::GetInterface()const>. This interface
+ provides the connection to specific methods and contains some other
+ descriptive data for controllers like menus and toolboxes, but also
+ for the various APIs. The main part of the interface description is in
+ the form of a <Type-Library>, which is generated from an IDL-file by
+ the <SVIDL-Compiler>. For each SfxShell Subclass-File there is one
+ such IDL-file to write.
+*/
+class SFX2_DLLPUBLIC SfxShell: public SfxBroadcaster
+{
+ friend class SfxObjectItem;
+
+ std::unique_ptr< SfxShell_Impl > pImpl;
+ SfxItemPool* pPool;
+ SfxUndoManager* pUndoMgr;
+
+private:
+ SfxShell( const SfxShell & ) = delete;
+ SfxShell& operator = ( const SfxShell & ) = delete;
+
+protected:
+ /**
+ The constructor of the SfxShell class initializes only simple types,
+ the corresponding SbxObject is only created on-demand. Therefore,
+ the application of a SfxShell instance is very cheap.
+ */
+ SfxShell();
+
+ /**
+ The constructor of the SfxShell class initializes only simple types,
+ the corresponding SbxObject is only created on-demand. Therefore,
+ the application of a SfxShell instance is very cheap.
+ */
+ SfxShell( SfxViewShell *pViewSh );
+
+ void SetViewShell_Impl( SfxViewShell* pView );
+ SAL_DLLPRIVATE void Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId );
+ static void HandleOpenXmlFilterSettings(SfxRequest &);
+
+public:
+
+ /**
+ The connection to a possible corresponding SbxObject is dissolved.
+ The SbxObject may continue to exist, but can not any longer perform
+ any functions and can not provide any properties.
+ */
+ virtual ~SfxShell() override;
+
+ /**
+ With this virtual method, which is automatically overridden by each subclass
+ with its own slots through the macro <SFX_DECL_INTERFACE>, one can access
+ each of the <SfxInterface> instance belonging to the subclass.
+
+ The class SfxShell itself has no own SfxInterface (no slots), therefore a
+ NULL-pointer is returned.
+ */
+ virtual SfxInterface* GetInterface() const;
+ static SfxInterface* GetStaticInterface() { return nullptr; }
+
+ /**
+ Sets the name of the Shell object. With this name, the SfxShell instance
+ of BASIC can be expressed.
+ */
+ void SetName( const OUString &rName );
+
+ /**
+ Returns the name of the Shell object. With this name, the SfxShell instance
+ of BASIC can be expressed.
+ */
+ const OUString& GetName() const;
+
+ /**
+ Returns the SfxViewShell in which they are located in the subshells.
+ Otherwise, and if not specified by the App developer, this method
+ returns NULL.
+ */
+ SfxViewShell* GetViewShell() const;
+
+ static void EmptyExecStub(SfxShell *pShell, SfxRequest &);
+ static void EmptyStateStub(SfxShell *pShell, SfxItemSet &);
+
+ /**
+ This method returns the status of the slot with the specified slot ID
+ on the specified interface.
+
+ If the slot is disabled or in this SfxShell (and their parent shells) are
+ not known, a Null-pointer is returned.
+
+ If the slot does not have a Status, a SfxVoidItem is returned.
+
+ The status is set directly in this Set when pStateSet != 0 , so that
+ overridden Slots of the <SfxShell> Subclasses and also in the Status
+ method of the base implementation can be called.
+
+ [Example]
+
+ In a derived class of SfxViewShell the SID_PRINTDOCDIRECT will be
+ intercepted. Under certain circumstances a query should appear before
+ you print, and the request will be aborted if necessary.
+
+ Also in the IDL of this subclass of the above slot is entered. The status
+ method will contain in outline:
+
+ void SubViewShell::PrintState( SfxItemSet &rState )
+ {
+ if ( rState.GetItemState( SID_PRINTDOCDIRECT ) != SfxItemState::UNKNOWN )
+ GetSlotState( SID_PRINTDOCDIRECT, SfxViewShell::GetInterface(),
+ &rState );
+ ...
+ }
+
+ [Cross-reference]
+
+ <SfxShell::ExecuteSlot(SfxRequest&)>
+ */
+ const SfxPoolItem* GetSlotState( sal_uInt16 nSlotId, const SfxInterface *pIF = nullptr, SfxItemSet *pStateSet = nullptr );
+
+ /**
+ This method allows you to forward a <SfxRequest> to the specified
+ base <SfxShell>.
+
+ [Example]
+
+ In a derived class of SfxViewShell the SID_PRINTDOCDIRECT will be
+ intercepted. Under certain circumstances a query should appear before
+ you print, and the request will be aborted if necessary.
+
+ Also in the IDL of this subclass of the above slot is entered. The status
+ method will contain in outline:
+
+ void SubViewShell::Exec( SfxRequest &rReq )
+ {
+ if ( rReq.GetSlot() == SID_PRINTDOCDIRECT )
+ {
+ 'dialog'
+ if ( 'condition' )
+ ExecuteSlot( rReq, SfxViewShell::GetInterface() );
+ }
+ }
+
+ It usually takes no rReq.Done() to be called as that is already completed
+ in implementation of the SfxViewShell, for instance it has been canceled.
+
+ [Cross-reference]
+
+ <SfxShell::GetSlotState(sal_uInt16,const SfxInterface*,SfxItemSet*)>
+ */
+ const SfxPoolItem* ExecuteSlot( SfxRequest &rReq, const SfxInterface *pIF = nullptr );
+
+ /**
+ Asynchronous ExecuteSlot for the RELOAD
+ */
+ void ExecuteSlot( SfxRequest &rReq, bool bAsync );
+
+ inline SfxItemPool& GetPool() const;
+ inline void SetPool( SfxItemPool *pNewPool ) ;
+
+ /**
+ Each Subclass of SfxShell can have a <SfxUndoManager>. This can be set in
+ the derived class with <SfxShell:SetUndoManager()>.
+
+ The class SfxShell itself does not have a SfxUndoManager, a NULL-pointer
+ is therefore returned.
+ */
+ virtual SfxUndoManager* GetUndoManager();
+
+ /**
+ Sets a <SfxUndoManager> for this <SfxShell> Instance. For the undo
+ is only the undo-manager used for SfxShell at the top of the stack of each
+ <SfxDispatcher>.
+
+ On the given <SfxUndoManager> is automatically the current
+ Max-Undo-Action-Count setting set from the options.
+
+ 'pNewUndoMgr' must exist until the Destructor of SfxShell instance is called
+ or until the next 'SetUndoManager()'.
+ */
+ void SetUndoManager( SfxUndoManager *pNewUndoMgr );
+
+ /**
+ Returns a pointer to the <SfxRepeatTarget> instance that is used in
+ SID_REPEAT as repeat target when it is addressed from the <SfxUndoManager>
+ supplied by this SfxShell. The return value can be NULL.
+
+ [Note]
+
+ A derivation of <SfxShell> or one of its subclasses of <SfxRepeatTarget>
+ is not recommended, as compiler errors are provoked.
+ (due to Call-to-Pointer-to-Member-Function to the subclass).
+ */
+ SfxRepeatTarget* GetRepeatTarget() const;
+
+ /**
+ Sets the <SfxRepeatTarget> instance that is used in SID_REPEAT as
+ RepeatTarget, when the current supplied by this <SfxUndoManager> is
+ addressed. By 'pTarget==0' the SID_REPEAT is disabled for this SfxShell.
+ The instance '*pTarget' must live as long as it is registered.
+
+ [Note]
+
+ A derivation of <SfxShell> or one of its subclasses of <SfxRepeatTarget>
+ is not recommended, as compiler errors are provoked.
+ (due to Call-to-Pointer-to-Member-Function to the subclass).
+ */
+ void SetRepeatTarget( SfxRepeatTarget *pTarget );
+
+ /**
+ With this method can the slots of the subclasses be invalidated through the
+ slot Id or alternatively through the Which ID. Slot IDs, which are
+ inherited by the subclass are also invalidated.
+
+ [Cross-reference]
+
+ <SfxBindings::Invalidate(sal_uInt16)>
+ <SfxBindings::InvalidateAll(sal_Bool)>
+ */
+ virtual void Invalidate(sal_uInt16 nId = 0);
+
+ virtual bool IsDesignMode() const { return false; };
+
+ bool IsActive() const;
+
+ /**
+ Virtual method that is called when enabling the SfxShell instance,
+ in order to give the Subclasses the opportunity to respond to the
+ to the enabling.
+
+ [Cross-reference]
+
+ StarView SystemWindow::Activate(bool)
+ */
+ virtual void Activate(bool bMDI);
+
+ /**
+ Virtual method that is called when disabling the SfxShell instance,
+ to give the Subclasses the opportunity to respond to the disabling.
+
+ [Cross-reference]
+
+ StarView SystemWindow::Deactivate(bool)
+ */
+ virtual void Deactivate(bool bMDI);
+
+ /**
+ This method returns a pointer to the <SfxDispatcher>, when the SfxShell
+ is currently <UI-active> or a NULL-pointer if it is not UI-active.
+
+ The returned pointer is only valid in the immediate context of the method
+ call.
+ */
+ SfxDispatcher* GetDispatcher() const;
+
+ /**
+ This method returns a pointer to the <SfxViewFrame> to which this SfxShell
+ instance is associated or in which they currently is <UI-active>.
+ A NULL pointer is returned if this SfxShell instance is not UI-active at
+ the moment and also no SfxViewFrame is permanently assigned.
+
+ The returned pointer is only valid in the immediate context of the method
+ call.
+
+ [Note]
+
+ Only instances of a subclass of SfxApplication and SfxObjectShell
+ should here provide a NULL-pointer. Otherwise, there is an error in the
+ application program (wrong constructor was called from SfxShell).
+
+ [Cross-reference]
+
+ <SfxViewShell::GetViewFrame()const>
+ */
+ SfxViewFrame* GetFrame() const;
+
+ virtual bool HasUIFeature(SfxShellFeature nFeature) const;
+ void UIFeatureChanged();
+
+ // Items
+ /**
+ With this method any objects of <SfxPoolItemu> subclasses can be accessed.
+ This exchange method is needed if, for example special <SfxToolBoxControl>
+ subclasses need access to certain data such as the <SfxObjectShell>.
+
+ The returned instance belongs to the particular SfxShell and may be
+ used only in the immediate context of the method call.
+
+ [Cross-reference]
+
+ <SfxShell::PutItem(const SfxPoolItem&)>
+ <SfxShell::RemoveItem(sal_uInt16)>
+ */
+ const SfxPoolItem* GetItem( sal_uInt16 nSlotId ) const;
+ template<class T> const T* GetItem( TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T*>(GetItem(sal_uInt16(nWhich)));
+ }
+
+ /**
+ With this method, any objects of subclasses of <SfxPoolItem> can be made
+ available. This exchange technology is needed if, for example, special
+ <SfxToolBoxControl> Subclasses need access to certain data such as the
+ <SfxObjectShell>
+
+ If a SfxPoolItem exists with the same slot ID, it is deleted automatically.
+
+ [Cross-reference]
+
+ <SfxShell::RemoveItem(sal_uInt16)>
+ <SfxShell::GetItem(sal_uInt16)>
+ */
+ void PutItem( const SfxPoolItem& rItem );
+
+ // TODO/CLEANUP: still needed?!
+ void SetVerbs(const css::uno::Sequence < css::embed::VerbDescriptor >& aVerbs);
+ const css::uno::Sequence < css::embed::VerbDescriptor >& GetVerbs() const;
+ void VerbExec (SfxRequest&);
+ static void VerbState (SfxItemSet&);
+ SAL_DLLPRIVATE const SfxSlot* GetVerbSlot_Impl(sal_uInt16 nId) const;
+
+ virtual SfxObjectShell* GetObjectShell();
+ void SetDisableFlags( SfxDisableFlags nFlags );
+ SfxDisableFlags GetDisableFlags() const;
+
+ virtual std::optional<SfxItemSet> CreateItemSet( sal_uInt16 nId );
+ virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
+
+ /** Set the name of the sidebar context that is broadcast on calls
+ to Activation().
+ */
+ void SetContextName (const OUString& rsContextName);
+
+ /** Broadcast a sidebar context change.
+ This method is typically called from Activate() or
+ Deactivate().
+ @param bIsActivated
+ When <TRUE/> then broadcast the context name that was
+ defined with an earlier call to SetContextName().
+ When <FALSE/> then broadcast the 'default' context.
+ */
+ void BroadcastContextForActivation (const bool bIsActivated);
+
+ /** Enabled or disable the context broadcaster. Returns the old state.
+ */
+ bool SetContextBroadcasterEnabled (const bool bIsEnabled);
+
+ /**
+
+ This method determines by calling the status function whether 'rSlot'
+ can be executed currently.
+ */
+ SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot );
+
+ /**
+
+ This method determines whether we need to execute without checking
+ the disabled state of the slot. This is used for dynamic conditions
+ while you can use SfxSlotMode::FASTCALL for a specific slotid in general.
+ */
+ virtual bool IsConditionalFastCall( const SfxRequest &rReq );
+
+ /**
+
+ This method controls the activation of SfxShell instance. First, by calling
+ the virtual method <SfxShell::Activate(sal_Bool)> which gives the subclass the
+ opportunity to respond to the event.
+
+ When bMDI == TRUE, the associated SbxObject is being 'armed', so that
+ unqualified methods of the object (without the name of the object)
+ from BASIC are found.
+ */
+ SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, bool bMDI);
+
+ /**
+
+ This method controls the deactivation of the SfxShell instance. When
+ bMDI == TRUE the SbxObject is first set to a status that only qualified
+ BASIC methods can be called.
+
+ Then the subclass gets the opportunity in every case to respond to the
+ event by calling the virtual method <SfxShell::Deactivate(sal_Bool)>.
+ */
+ SAL_DLLPRIVATE void DoDeactivate_Impl( SfxViewFrame const *pFrame, bool bMDI);
+};
+
+/**
+ Each Subclass of SfxShell must reference a pool. This is partly set by
+ SFx's own set of subclasses (eg <SfxViewShell>). In particular however
+ this must be set directly from one derived SfxShell class and ny
+ derivatives of SfxObjectShell.
+
+ The SfxShell class itself does not have any SfxItemPool, therefore a
+ null-pointer is returned.
+*/
+SfxItemPool& SfxShell::GetPool() const
+{
+ assert(pPool && "no pool");
+ return *pPool;
+}
+
+/**
+ With this method, the subclasses register their special <SfxItemPool>
+ in the SfxShell. Each SfxShell instance must have access to a SfxItemPool.
+ Usually this is the SfxItemPool of the SfxDocumentShell. The SfxShell
+ subclass does not take ownership of the orphaned pool. Before it is
+ deleted it has to be deregistered with SetPool(0).
+*/
+inline void SfxShell::SetPool
+(
+ SfxItemPool* pNewPool // Pointer to the new Pool or null
+)
+{
+ pPool = pNewPool;
+}
+
+#define SFX_DECL_INTERFACE(nId) \
+ static SfxInterface* s_pInterface; \
+ static SfxInterface* GetStaticInterface(); \
+ static SfxInterfaceId GetInterfaceId() {return nId;} \
+ static void RegisterInterface(const SfxModule* pMod=nullptr); \
+ virtual SfxInterface* GetInterface() const override;
+
+#define SFX_TMPL_INTERFACE(Class,SuperClass,Abstract) \
+ \
+ SfxInterface* Class::s_pInterface = nullptr; \
+ SfxInterface* Class::GetStaticInterface() \
+ { \
+ if ( !s_pInterface ) \
+ { \
+ s_pInterface = \
+ new SfxInterface( \
+ #Class, Abstract, GetInterfaceId(), \
+ SuperClass::GetStaticInterface(), \
+ a##Class##Slots_Impl[0], \
+ sal_uInt16(sizeof(a##Class##Slots_Impl) / sizeof(SfxSlot) ) ); \
+ InitInterface_Impl(); \
+ } \
+ return s_pInterface; \
+ } \
+ \
+ SfxInterface* Class::GetInterface() const \
+ { \
+ return GetStaticInterface(); \
+ } \
+ \
+ void Class::RegisterInterface(const SfxModule* pMod) \
+ { \
+ GetStaticInterface()->Register(pMod); \
+ }
+
+#define SFX_IMPL_INTERFACE(Class,SuperClass) \
+SFX_TMPL_INTERFACE(Class,SuperClass,false) \
+
+#define SFX_IMPL_SUPERCLASS_INTERFACE(Class,SuperClass) \
+SFX_TMPL_INTERFACE(Class,SuperClass,true) \
+
+enum class SfxVisibilityFlags {
+ Invisible = 0x0000, // Never visible
+ Viewer = 0x0040,
+ ReadonlyDoc = 0x0400,
+ Standard = 0x1000,
+ FullScreen = 0x2000,
+ Client = 0x4000,
+ Server = 0x8000,
+};
+namespace o3tl {
+ template<> struct typed_flags<SfxVisibilityFlags> : is_typed_flags<SfxVisibilityFlags, 0xf440> {};
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/AsynchronousCall.hxx b/include/sfx2/sidebar/AsynchronousCall.hxx
new file mode 100644
index 000000000..0f2377abc
--- /dev/null
+++ b/include/sfx2/sidebar/AsynchronousCall.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <tools/link.hxx>
+
+#include <functional>
+
+struct ImplSVEvent;
+
+namespace sfx2::sidebar
+{
+/** A simple asynchronous call via Application::PostUserCall.
+*/
+class AsynchronousCall
+{
+public:
+ typedef ::std::function<void()> Action;
+
+ AsynchronousCall(const Action& rAction);
+ ~AsynchronousCall();
+
+ void RequestCall();
+ void CancelRequest();
+ void Sync();
+
+private:
+ Action maAction;
+ ImplSVEvent* mnCallId;
+
+ DECL_LINK(HandleUserCall, void*, void);
+};
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/Context.hxx b/include/sfx2/sidebar/Context.hxx
new file mode 100644
index 000000000..f4ca42d75
--- /dev/null
+++ b/include/sfx2/sidebar/Context.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <rtl/ustring.hxx>
+
+#include <sfx2/dllapi.h>
+
+namespace sfx2::sidebar
+{
+class SFX2_DLLPUBLIC Context
+{
+public:
+ OUString msApplication;
+ OUString msContext;
+
+ Context();
+ Context(const OUString& rsApplication, const OUString& rsContext);
+
+ /** When two contexts are matched against each other, then
+ application or context name may have the wildcard value 'any'.
+ In order to prefer matches without wildcards over matches with
+ wildcards we introduce an integer evaluation for matches.
+ */
+ const static sal_Int32 NoMatch;
+ const static sal_Int32 OptimalMatch;
+ const static sal_Int32 ApplicationWildcardMatch;
+ const static sal_Int32 ContextWildcardMatch;
+
+ /** Return the numeric value that describes how good the match
+ between two contexts is.
+ Smaller values represent better matches.
+ */
+ sal_Int32 EvaluateMatch(const Context& rOther) const;
+
+ bool operator==(const Context& rOther) const;
+ bool operator!=(const Context& rOther) const;
+};
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/ControllerItem.hxx b/include/sfx2/sidebar/ControllerItem.hxx
new file mode 100644
index 000000000..a8f82195a
--- /dev/null
+++ b/include/sfx2/sidebar/ControllerItem.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sfx2/ctrlitem.hxx>
+
+namespace com::sun::star::lang { class XComponent; }
+
+
+namespace sfx2::sidebar {
+
+/** The sfx2::sidebar::ControllerItem is a wrapper around the
+ SfxControllerItem that becomes necessary to allow objects (think
+ sidebar panels) to receive state changes without having one
+ SfxControllerItem per supported item as base class (which is not
+ possible in C++ anyway).
+
+ It also gives access to the label and icon of a slot/command.
+*/
+class SFX2_DLLPUBLIC ControllerItem final
+ : public SfxControllerItem
+{
+public:
+ class SFX2_DLLPUBLIC ItemUpdateReceiverInterface
+ {
+ public:
+ virtual void NotifyItemUpdate(
+ const sal_uInt16 nSId,
+ const SfxItemState eState,
+ const SfxPoolItem* pState) = 0;
+ virtual void GetControlState(
+ const sal_uInt16 nSId,
+ boost::property_tree::ptree& rState) = 0;
+ virtual ~ItemUpdateReceiverInterface();
+ };
+
+ /** This is the simpler constructor variant that still exists for
+ compatibility reasons. Note that GetLabel() and GetIcon() will
+ return empty strings/images.
+ */
+ ControllerItem (
+ const sal_uInt16 nId,
+ SfxBindings &rBindings,
+ ItemUpdateReceiverInterface& rItemUpdateReceiver);
+
+ virtual ~ControllerItem() override;
+
+ /** Force the controller item to call its NotifyItemUpdate
+ callback with up-to-date data.
+ */
+ void RequestUpdate();
+
+private:
+
+ virtual void StateChangedAtToolBoxControl (sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState) override;
+ virtual void GetControlState (sal_uInt16 nSId, boost::property_tree::ptree& rState) override;
+
+ ItemUpdateReceiverInterface& mrItemUpdateReceiver;
+};
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
new file mode 100644
index 000000000..fe73e6332
--- /dev/null
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sfx2/sidebar/Panel.hxx>
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/weld.hxx>
+
+namespace sfx2::sidebar
+{
+class DeckDescriptor;
+class DeckTitleBar;
+class SidebarDockingWindow;
+
+/** This is the parent window of the panels.
+ It displays the deck title.
+
+ A deck consists of multiple panels.
+ E.g. Properties, Styles, Navigator.
+*/
+class Deck final : public InterimItemWindow
+{
+public:
+ Deck(const DeckDescriptor& rDeckDescriptor, SidebarDockingWindow* pParentWindow,
+ const std::function<void()>& rCloserAction);
+ virtual ~Deck() override;
+ virtual void dispose() override;
+
+ const OUString& GetId() const { return msId; }
+
+ DeckTitleBar* GetTitleBar() const;
+ tools::Rectangle GetContentArea() const;
+ void ResetPanels(SharedPanelContainer&& rPanels);
+ const SharedPanelContainer& GetPanels() const { return maPanels; }
+
+ std::shared_ptr<Panel> GetPanel(std::u16string_view panelId);
+
+ void RequestLayout();
+ weld::Widget* GetPanelParentWindow();
+
+ /** Try to make the panel completely visible.
+ When the whole panel does not fit then make its top visible
+ and it off at the bottom.
+ */
+ void ShowPanel(const Panel& rPanel);
+
+ virtual void DataChanged(const DataChangedEvent& rEvent) override;
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+
+ sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; }
+
+private:
+ void RequestLayoutInternal();
+
+private:
+ const OUString msId;
+ sal_Int32 mnMinimalWidth;
+ sal_Int32 mnScrolledWindowExtraWidth;
+ sal_Int32 mnMinimalHeight;
+ SharedPanelContainer maPanels;
+
+ VclPtr<SidebarDockingWindow> mxParentWindow;
+ std::unique_ptr<DeckTitleBar> mxTitleBar;
+ std::unique_ptr<weld::ScrolledWindow> mxVerticalScrollBar;
+ std::unique_ptr<weld::Box> mxContents;
+};
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/FocusManager.hxx b/include/sfx2/sidebar/FocusManager.hxx
new file mode 100644
index 000000000..c51ccbfa8
--- /dev/null
+++ b/include/sfx2/sidebar/FocusManager.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sfx2/sidebar/Panel.hxx>
+#include <tools/link.hxx>
+#include <vcl/keycod.hxx>
+
+namespace weld {
+class Widget;
+}
+
+namespace sfx2::sidebar {
+
+class DeckTitleBar;
+
+/** Concentrate all focus handling in this class.
+
+ There is one ring of windows that accept the input focus which are
+ cycled through with the arrow keys:
+ - the closer in the deck title (present only when docked)
+ - the panel title bars
+ - the tab bar items
+
+ When the focus is in a panel title then focus travels over
+ - the panel title
+ - the panel closer
+ - the panel content
+
+ Once the focus is in the panel content then focus cycles through
+ all controls inside the panel but not back to the title bar of
+ the panel. Escape places the focus back in the panel title.
+*/
+class FocusManager
+{
+public:
+ FocusManager(const std::function<void(const Panel&)>& rShowPanelFunctor);
+ ~FocusManager();
+
+ /** Forget all panels and buttons. Remove all window listeners.
+ */
+ void Clear();
+
+ /** Transfer the focus into the sidebar tree of windows. This is
+ typically called from the SidebarChildWindow as result of
+ pressing the F6 key.
+ */
+ void GrabFocus();
+ void GrabFocusPanel();
+
+ void SetDeck(Deck* pDeck);
+ void SetPanels(const SharedPanelContainer& rPanels);
+ void SetButtons(const std::vector<weld::Widget*>& rButtons);
+
+private:
+ VclPtr<Deck> mxDeck;
+ DeckTitleBar* mpDeckTitleBar;
+ SharedPanelContainer maPanels;
+ std::vector<weld::Widget*> maButtons;
+ const std::function<void(const Panel&)> maShowPanelFunctor;
+
+ enum PanelComponent
+ {
+ PC_DeckToolBox,
+ PC_PanelTitle,
+ PC_PanelToolBox,
+ PC_PanelContent,
+ PC_TabBar,
+ PC_None
+ };
+ class FocusLocation
+ {
+ public:
+ PanelComponent meComponent;
+ sal_Int32 mnIndex;
+ FocusLocation(const PanelComponent eComponent, const sal_Int32 nIndex);
+ };
+
+ /** Listen for key events for panels and buttons.
+ */
+ DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+
+ void ClearPanels();
+ void ClearButtons();
+
+ /** Let the focus manager listen for window events for the given
+ window.
+ */
+ void RegisterWindow(weld::Widget& rWidget);
+ static void UnregisterWindow(weld::Widget& rWidget);
+
+ void FocusDeckTitle();
+ bool IsDeckTitleVisible() const;
+ bool IsPanelTitleVisible(const sal_Int32 nPanelIndex) const;
+
+ /** Set the focus to the title bar of the panel or, if the
+ title bar is not visible, directly to the panel.
+ @param nPanelIndex
+ Index of the panel to focus.
+ @param bFallbackToDeckTitle
+ When the panel title bar is not visible then The fallback
+ bias defines whether to focus the deck (true) or the panel
+ content (false) will be focused instead.
+ */
+ void FocusPanel(const sal_Int32 nPanelIndex,
+ const bool bFallbackToDeckTitle);
+
+ void FocusPanelContent(const sal_Int32 nPanelIndex);
+ void FocusButton(const sal_Int32 nButtonIndex);
+ void MoveFocusInsidePanel(const FocusLocation& rLocation,
+ const sal_Int32 nDirection);
+ bool MoveFocusInsideDeckTitle(const FocusLocation& rLocation,
+ const sal_Int32 nDirection);
+
+ bool HandleKeyEvent(const vcl::KeyCode& rKeyCode,
+ const FocusLocation& rLocation);
+
+ FocusLocation GetFocusLocation() const;
+
+};
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/IContextChangeReceiver.hxx b/include/sfx2/sidebar/IContextChangeReceiver.hxx
new file mode 100644
index 000000000..784193c04
--- /dev/null
+++ b/include/sfx2/sidebar/IContextChangeReceiver.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sfx2/dllapi.h>
+
+namespace vcl
+{
+class EnumContext;
+}
+
+namespace sfx2::sidebar
+{
+class SFX2_DLLPUBLIC IContextChangeReceiver
+{
+public:
+ virtual ~IContextChangeReceiver();
+
+ virtual void HandleContextChange(const vcl::EnumContext& rContext) = 0;
+};
+
+} // end of namespace ::sd::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/ILayoutableWindow.hxx b/include/sfx2/sidebar/ILayoutableWindow.hxx
new file mode 100644
index 000000000..344e7fd4f
--- /dev/null
+++ b/include/sfx2/sidebar/ILayoutableWindow.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <com/sun/star/ui/LayoutSize.hpp>
+
+namespace sfx2::sidebar
+{
+class SFX2_DLLPUBLIC ILayoutableWindow
+{
+public:
+ virtual ~ILayoutableWindow();
+
+ /** Return the preferred height with the constraint, that the
+ window will be set to the given width.
+ */
+ virtual css::ui::LayoutSize GetHeightForWidth(const sal_Int32 nWidth) = 0;
+};
+
+} // end of namespace ::sd::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/Panel.hxx b/include/sfx2/sidebar/Panel.hxx
new file mode 100644
index 000000000..1c0af8ad2
--- /dev/null
+++ b/include/sfx2/sidebar/Panel.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sfx2/dllapi.h>
+#include <vcl/weld.hxx>
+#include <vector>
+
+namespace com::sun::star::frame
+{
+class XFrame;
+}
+namespace com::sun::star::ui
+{
+class XSidebarPanel;
+}
+namespace com::sun::star::ui
+{
+class XUIElement;
+}
+namespace com::sun::star::awt
+{
+class XWindow;
+}
+
+namespace sfx2::sidebar
+{
+class Context;
+class Deck;
+class PanelDescriptor;
+class PanelTitleBar;
+
+/**
+ * Multiple panels form a single deck.
+ * E.g. the Properties deck has panels like Styles, Character, paragraph.
+ */
+class SFX2_DLLPUBLIC Panel final
+{
+public:
+ Panel(const PanelDescriptor& rPanelDescriptor, weld::Widget* pParentWindow,
+ const bool bIsInitiallyExpanded, Deck* pDeck,
+ const std::function<Context()>& rContextAccess,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
+ ~Panel();
+
+ PanelTitleBar* GetTitleBar() const;
+ weld::Box* GetContents() const;
+ void Show(bool bShow);
+ bool IsTitleBarOptional() const { return mbIsTitleBarOptional; }
+ void SetUIElement(const css::uno::Reference<css::ui::XUIElement>& rxElement);
+ const css::uno::Reference<css::ui::XSidebarPanel>& GetPanelComponent() const
+ {
+ return mxPanelComponent;
+ }
+ const css::uno::Reference<css::awt::XWindow>& GetElementParentWindow();
+ css::uno::Reference<css::awt::XWindow> GetElementWindow();
+ void SetExpanded(const bool bIsExpanded);
+ bool IsExpanded() const { return mbIsExpanded; }
+ bool HasIdPredicate(std::u16string_view rsId) const;
+ const OUString& GetId() const { return msPanelId; }
+ const OUString& GetTitle() const { return msTitle; }
+ void TriggerDeckLayouting();
+
+ void SetHeightPixel(int nHeight);
+
+ bool get_extents(tools::Rectangle& rExtents) const;
+
+ /// Set whether a panel should be present but invisible / inactive
+ void SetLurkMode(bool bLurk);
+ bool IsLurking() const { return mbLurking; }
+
+ void set_margin_top(int nMargin);
+ void set_margin_bottom(int nMargin);
+ void set_vexpand(bool bExpand);
+
+ weld::Window* GetFrameWeld();
+
+ void DataChanged();
+
+private:
+ std::unique_ptr<weld::Builder> mxBuilder;
+ const OUString msPanelId;
+ const OUString msTitle;
+ const bool mbIsTitleBarOptional;
+ const bool mbWantsAWT;
+ css::uno::Reference<css::ui::XUIElement> mxElement;
+ css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
+ bool mbIsExpanded;
+ bool mbLurking;
+ const std::function<Context()> maContextAccess;
+ const css::uno::Reference<css::frame::XFrame>& mxFrame;
+ weld::Widget* mpParentWindow;
+ VclPtr<Deck> mxDeck;
+ std::unique_ptr<weld::Box> mxContainer;
+ std::unique_ptr<PanelTitleBar> mxTitleBar;
+ std::unique_ptr<weld::Box> mxContents;
+ css::uno::Reference<css::awt::XWindow> mxXWindow;
+
+ DECL_DLLPRIVATE_LINK(DumpAsPropertyTreeHdl, tools::JsonWriter&, void);
+};
+
+typedef std::vector<std::shared_ptr<Panel>> SharedPanelContainer;
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/PanelLayout.hxx b/include/sfx2/sidebar/PanelLayout.hxx
new file mode 100644
index 000000000..301159362
--- /dev/null
+++ b/include/sfx2/sidebar/PanelLayout.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sfx2/dllapi.h>
+#include <vcl/weld.hxx>
+
+class DataChangedEvent;
+class VclSimpleEvent;
+namespace sfx2 { namespace sidebar { class Panel; } }
+namespace tools { class JsonWriter; }
+
+/// This class is the base for the Widget Layout-based sidebar panels.
+class SFX2_DLLPUBLIC PanelLayout
+{
+protected:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ sfx2::sidebar::Panel* m_pPanel;
+
+ virtual void DataChanged(const DataChangedEvent& rEvent);
+ virtual void DumpAsPropertyTree(tools::JsonWriter&);
+
+ virtual weld::Window* GetFrameWeld() const;
+
+private:
+ DECL_DLLPRIVATE_LINK(DataChangedEventListener, VclSimpleEvent&, void);
+ DECL_DLLPRIVATE_LINK(DumpAsPropertyTreeHdl, tools::JsonWriter&, void);
+
+public:
+ PanelLayout(weld::Widget* pParent, const OString& rID, const OUString& rUIXMLDescription);
+
+ void SetPanel(sfx2::sidebar::Panel* pPanel);
+
+ virtual ~PanelLayout();
+
+ Size get_preferred_size() const
+ {
+ return m_xContainer->get_preferred_size();
+ }
+
+ void queue_resize();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/ResourceManager.hxx b/include/sfx2/sidebar/ResourceManager.hxx
new file mode 100644
index 000000000..9ac1130cc
--- /dev/null
+++ b/include/sfx2/sidebar/ResourceManager.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <unotools/confignode.hxx>
+#include <map>
+#include <vector>
+#include <set>
+
+#include <sfx2/dllapi.h>
+
+namespace com::sun::star::frame { class XController; }
+namespace com::sun::star::frame { class XModel; }
+namespace sfx2::sidebar { class DeckDescriptor; }
+namespace sfx2::sidebar { class PanelDescriptor; }
+
+namespace sfx2::sidebar {
+
+class Context;
+class ContextList;
+
+/** Read the content of the Sidebar.xcu file and provide access
+ methods so that the sidebar can easily decide which content panels
+ to display for a certain context.
+*/
+class SFX2_DLLPUBLIC ResourceManager
+{
+public:
+
+ ResourceManager();
+ ~ResourceManager();
+
+ std::shared_ptr<DeckDescriptor> GetDeckDescriptor(std::u16string_view rsDeckId) const;
+ std::shared_ptr<PanelDescriptor> GetPanelDescriptor(std::u16string_view rsPanelId) const;
+
+ void UpdateModel(const css::uno::Reference<css::frame::XModel>& xModel);
+
+ void InitDeckContext(const Context& rContex);
+ void SaveDecksSettings(const Context& rContext);
+ void SaveDeckSettings(const DeckDescriptor* pDeckDesc);
+ void SaveLastActiveDeck(const Context& rContext, const OUString& rActiveDeck);
+
+ void disposeDecks();
+
+ class DeckContextDescriptor
+ {
+ public:
+ OUString msId;
+ bool mbIsEnabled;
+ };
+ typedef std::vector<DeckContextDescriptor> DeckContextDescriptorContainer;
+
+ class PanelContextDescriptor
+ {
+ public:
+ OUString msId;
+ OUString msMenuCommand;
+ bool mbIsInitiallyVisible;
+ bool mbShowForReadOnlyDocuments;
+ };
+ typedef std::vector<PanelContextDescriptor> PanelContextDescriptorContainer;
+
+ const DeckContextDescriptorContainer& GetMatchingDecks(
+ DeckContextDescriptorContainer& rDeckDescriptors,
+ const Context& rContext,
+ const bool bIsDocumentReadOnly,
+ const css::uno::Reference<css::frame::XController>& rxController);
+
+ const PanelContextDescriptorContainer& GetMatchingPanels(
+ PanelContextDescriptorContainer& rPanelDescriptors,
+ const Context& rContext,
+ std::u16string_view rsDeckId,
+ const css::uno::Reference<css::frame::XController>& rxController);
+
+ const OUString& GetLastActiveDeck( const Context& rContext );
+ void SetLastActiveDeck( const Context& rContext, const OUString& rsDeckId );
+
+ /** Remember the expansions state per panel and context.
+ */
+ void StorePanelExpansionState(std::u16string_view rsPanelId,
+ const bool bExpansionState,
+ const Context& rContext);
+
+private:
+
+
+ typedef std::vector<std::shared_ptr<DeckDescriptor>> DeckContainer;
+ DeckContainer maDecks;
+
+ typedef std::vector<std::shared_ptr<PanelDescriptor>> PanelContainer;
+ PanelContainer maPanels;
+ mutable std::set<OUString> maProcessedApplications;
+ std::map<OUString, OUString> maLastActiveDecks;
+
+ void ReadDeckList();
+ void ReadPanelList();
+ void ReadLastActive();
+ static void ReadContextList(const utl::OConfigurationNode& rNode,
+ ContextList& rContextList,
+ const OUString& rsDefaultMenuCommand);
+
+ void ReadLegacyAddons(const css::uno::Reference<css::frame::XController>& rxController);
+ static utl::OConfigurationTreeRoot GetLegacyAddonRootNode(const OUString& rsModuleName);
+ static void GetToolPanelNodeNames(std::vector<OUString>& rMatchingNames,
+ const utl::OConfigurationTreeRoot& aRoot);
+ bool IsDeckEnabled(std::u16string_view rsDeckId,
+ const Context& rContext,
+ const css::uno::Reference<css::frame::XController>& rxController);
+
+ std::shared_ptr<DeckDescriptor> ImplGetDeckDescriptor(std::u16string_view rsDeckId) const;
+ std::shared_ptr<PanelDescriptor> ImplGetPanelDescriptor(std::u16string_view rsPanelId) const;
+};
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/Sidebar.hxx b/include/sfx2/sidebar/Sidebar.hxx
new file mode 100644
index 000000000..2520a80a4
--- /dev/null
+++ b/include/sfx2/sidebar/Sidebar.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sfx2/dllapi.h>
+#include <sfx2/viewfrm.hxx>
+
+#include <string_view>
+
+namespace com::sun::star::frame { class XFrame; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+
+namespace sfx2::sidebar {
+
+/** Accept requests for switching to certain panels or decks.
+*/
+class SFX2_DLLPUBLIC Sidebar
+{
+public:
+ static void ToggleDeck(std::u16string_view rsDeckId, SfxViewFrame *pViewFrame);
+
+ /** Switch to the deck that contains the specified panel and make
+ sure that the panel is visible (expanded and scrolled into the
+ visible area.)
+ Note that most of the work is done asynchronously and that
+ this function probably returns before the requested panel is visible.
+ */
+ static void ShowPanel (
+ std::u16string_view rsPanelId,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame, bool bFocus = false);
+
+ /** Switch to the deck that contains the specified panel and toggle
+ the visibility of the panel (expanded and scrolled into the
+ visible area when visible)
+ Note that most of the work is done asynchronously and that
+ this function probably returns before the requested panel is visible.
+ */
+ static void TogglePanel (
+ std::u16string_view rsPanelId,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
+ static bool IsPanelVisible(
+ std::u16string_view rsPanelId,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+};
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/SidebarChildWindow.hxx b/include/sfx2/sidebar/SidebarChildWindow.hxx
new file mode 100644
index 000000000..279aa79b5
--- /dev/null
+++ b/include/sfx2/sidebar/SidebarChildWindow.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sfx2/childwin.hxx>
+
+
+namespace sfx2::sidebar {
+
+/** Outer container of the sidebar window.
+
+ Has to be registered for every application via the
+ RegisterChildWindow() method from the RegisterControllers() method
+ of the applications DLL.
+*/
+class SFX2_DLLPUBLIC SidebarChildWindow final : public SfxChildWindow
+{
+public:
+ SidebarChildWindow(vcl::Window* pParent, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo);
+
+ SFX_DECL_CHILDWINDOW_WITHID(SidebarChildWindow);
+
+ static sal_Int32 GetDefaultWidth(vcl::Window const * pWindow);
+};
+
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
new file mode 100644
index 000000000..8d8dcf215
--- /dev/null
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -0,0 +1,302 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <memory>
+#include <sal/config.h>
+
+#include <sfx2/sidebar/AsynchronousCall.hxx>
+#include <sfx2/sidebar/Context.hxx>
+#include <sfx2/sidebar/Deck.hxx>
+#include <sfx2/sidebar/FocusManager.hxx>
+#include <sfx2/sidebar/ResourceManager.hxx>
+#include <sfx2/sidebar/TabBar.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+#include <com/sun/star/ui/XContextChangeEventListener.hpp>
+#include <com/sun/star/ui/XSidebar.hpp>
+
+#include <optional>
+#include <comphelper/compbase.hxx>
+
+namespace com::sun::star::awt { class XWindow; }
+namespace com::sun::star::frame { class XDispatch; }
+namespace com::sun::star::ui { class XUIElement; }
+
+typedef comphelper::WeakComponentImplHelper <
+ css::ui::XContextChangeEventListener,
+ css::beans::XPropertyChangeListener,
+ css::ui::XSidebar,
+ css::frame::XStatusListener,
+ css::frame::XFrameActionListener
+ > SidebarControllerInterfaceBase;
+
+class SfxSplitWindow;
+class SfxViewShell;
+
+namespace sfx2::sidebar {
+
+class DeckDescriptor;
+class SidebarDockingWindow;
+
+class SFX2_DLLPUBLIC SidebarController final
+ : public SidebarControllerInterfaceBase
+{
+public:
+ static rtl::Reference<SidebarController> create(SidebarDockingWindow* pParentWindow,
+ const SfxViewFrame* pViewFrame);
+ virtual ~SidebarController() override;
+ SidebarController(const SidebarController&) = delete;
+ SidebarController& operator=( const SidebarController& ) = delete;
+
+ /** Return the SidebarController object that is associated with
+ the given XFrame.
+ @return
+ When there is no SidebarController object for the given
+ XFrame then <NULL/> is returned.
+ */
+ static SidebarController* GetSidebarControllerForFrame (
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
+ static void registerSidebarForFrame(SidebarController* pController, const css::uno::Reference<css::frame::XController>& xFrame);
+
+ static void unregisterSidebarForFrame(SidebarController* pController, const css::uno::Reference<css::frame::XController>& xFrame);
+
+ // ui::XContextChangeEventListener
+ virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing (const css::lang::EventObject& rEventObject) override;
+
+ // beans::XPropertyChangeListener
+ virtual void SAL_CALL propertyChange (const css::beans::PropertyChangeEvent& rEvent) override;
+
+ // frame::XStatusListener
+ virtual void SAL_CALL statusChanged (const css::frame::FeatureStateEvent& rEvent) override;
+
+ // frame::XFrameActionListener
+ virtual void SAL_CALL frameAction (const css::frame::FrameActionEvent& rEvent) override;
+
+ // ui::XSidebar
+ virtual void SAL_CALL requestLayout() override;
+
+ void NotifyResize();
+
+ /** In some situations it is necessary to force an update of the
+ current deck and its panels. One reason is a change of the
+ view scale. Some panels can handle this only when
+ constructed. In this case we have to a context change and
+ also force that all panels are destroyed and created new.
+ */
+ const static sal_Int32 SwitchFlag_NoForce = 0x00;
+ const static sal_Int32 SwitchFlag_ForceSwitch = 0x01;
+ const static sal_Int32 SwitchFlag_ForceNewDeck = 0x02;
+ const static sal_Int32 SwitchFlag_ForceNewPanels = 0x02;
+
+ void OpenThenSwitchToDeck(std::u16string_view rsDeckId);
+ void OpenThenToggleDeck(const OUString& rsDeckId);
+
+ /** Show only the tab bar, not the deck.
+ */
+ void RequestCloseDeck();
+
+ /** Open the deck area and restore the parent window to its old width.
+ */
+ void RequestOpenDeck();
+
+ /** Returns true when the given deck is the currently visible deck
+ */
+ bool IsDeckVisible(std::u16string_view rsDeckId);
+
+ bool IsDeckOpen(const sal_Int32 nIndex = -1);
+
+ FocusManager& GetFocusManager() { return maFocusManager;}
+
+ ResourceManager* GetResourceManager() { return mpResourceManager.get();}
+
+ // std::unique_ptr<ResourceManager> GetResourceManager() { return mpResourceManager;}
+
+ const Context& GetCurrentContext() const { return maCurrentContext;}
+ bool IsDocumentReadOnly (void) const { return mbIsDocumentReadOnly;}
+
+ void SwitchToDeck(std::u16string_view rsDeckId);
+ void SwitchToDefaultDeck();
+ bool WasFloatingDeckClosed() const { return mbFloatingDeckClosed; }
+ void SetFloatingDeckClosed(bool bWasClosed) { mbFloatingDeckClosed = bWasClosed; }
+
+ void CreateDeck(std::u16string_view rDeckId);
+ void CreateDeck(std::u16string_view rDeckId, const Context& rContext, bool bForceCreate = false);
+
+ ResourceManager::DeckContextDescriptorContainer GetMatchingDecks();
+ ResourceManager::PanelContextDescriptorContainer GetMatchingPanels(std::u16string_view rDeckId);
+
+ void notifyDeckTitle(std::u16string_view targetDeckId);
+
+ void updateModel(const css::uno::Reference<css::frame::XModel>& xModel);
+
+ void disposeDecks();
+
+ void FadeIn();
+ void FadeOut();
+
+ tools::Rectangle GetDeckDragArea() const;
+
+ css::uno::Reference<css::frame::XFrame> const & getXFrame() const {return mxFrame;}
+
+ sal_Int32 getMaximumWidth() const { return mnMaximumSidebarWidth; }
+ void setMaximumWidth(sal_Int32 nMaximumWidth) { mnMaximumSidebarWidth = nMaximumWidth; }
+
+ void saveDeckState();
+
+ void SyncUpdate();
+
+ bool hasChartContextCurrently() const;
+
+ static SidebarController* GetSidebarControllerForView(const SfxViewShell* pViewShell);
+
+private:
+ SidebarController(SidebarDockingWindow* pParentWindow, const SfxViewFrame* pViewFrame);
+
+ VclPtr<Deck> mpCurrentDeck;
+ VclPtr<SidebarDockingWindow> mpParentWindow;
+ const SfxViewFrame* mpViewFrame;
+ css::uno::Reference<css::frame::XFrame> mxFrame;
+ VclPtr<TabBar> mpTabBar;
+ Context maCurrentContext;
+ Context maRequestedContext;
+ css::uno::Reference<css::frame::XController> mxCurrentController;
+ /// Use a combination of SwitchFlag_* as value.
+ sal_Int32 mnRequestedForceFlags;
+ sal_Int32 mnMaximumSidebarWidth;
+ bool mbMinimumSidebarWidth;
+ OUString msCurrentDeckId;
+ AsynchronousCall maPropertyChangeForwarder;
+ AsynchronousCall maContextChangeUpdate;
+ css::uno::Reference<css::beans::XPropertySet> mxThemePropertySet;
+
+ /** Two flags control whether the deck is displayed or if only the
+ tab bar remains visible.
+ The mbIsDeckOpen flag stores the current state while
+ mbIsDeckRequestedOpen stores how this state should be. User
+ actions like clicking on the deck closer affect the
+ mbIsDeckRequestedOpen. Normally both flags have the same
+ value. A document being read-only can prevent the deck from opening.
+ */
+ ::std::optional<bool> mbIsDeckRequestedOpen;
+ ::std::optional<bool> mbIsDeckOpen;
+
+ bool mbFloatingDeckClosed;
+
+ /** Before the deck is closed the sidebar width is saved into this variable,
+ so that it can be restored when the deck is reopened.
+ */
+ sal_Int32 mnSavedSidebarWidth;
+ FocusManager maFocusManager;
+ css::uno::Reference<css::frame::XDispatch> mxReadOnlyModeDispatch;
+ bool mbIsDocumentReadOnly;
+ VclPtr<SfxSplitWindow> mpSplitWindow;
+ /** When the user moves the splitter then we remember the
+ width at that time.
+ */
+ sal_Int32 mnWidthOnSplitterButtonDown;
+ /** Control that is temporarily used as replacement for the deck
+ to indicate that when the current mouse drag operation ends, the
+ sidebar will only show the tab bar.
+ */
+ VclPtr<vcl::Window> mpCloseIndicator;
+
+ DECL_DLLPRIVATE_LINK(WindowEventHandler, VclWindowEvent&, void);
+ /** Make maRequestedContext the current context.
+ */
+ void UpdateConfigurations();
+
+ css::uno::Reference<css::ui::XUIElement> CreateUIElement (
+ const css::uno::Reference<css::awt::XWindow>& rxWindow,
+ const OUString& rsImplementationURL,
+ const bool bWantsCanvas,
+ const Context& rContext);
+
+ void CreatePanels(
+ std::u16string_view rDeckId,
+ const Context& rContext);
+ std::shared_ptr<Panel> CreatePanel (
+ std::u16string_view rsPanelId,
+ weld::Widget* pParentWindow,
+ const bool bIsInitiallyExpanded,
+ const Context& rContext,
+ const VclPtr<Deck>& pDeck);
+
+ void SwitchToDeck (
+ const DeckDescriptor& rDeckDescriptor,
+ const Context& rContext);
+
+ void ShowPopupMenu (
+ weld::Menu& rMainMenu,
+ weld::Menu& rSubMenu,
+ const ::std::vector<TabBar::DeckMenuData>& rMenuData) const;
+ void PopulatePopupMenus(
+ weld::Menu& rMainButton,
+ weld::Menu& rSubMenu,
+ const ::std::vector<TabBar::DeckMenuData>& rMenuData) const;
+ DECL_DLLPRIVATE_LINK(OnMenuItemSelected, const OString&, void);
+ DECL_DLLPRIVATE_LINK(OnSubMenuItemSelected, const OString&, void);
+ void BroadcastPropertyChange();
+
+ /** The close of the deck changes the width of the child window.
+ That is only possible if there is no other docking window docked above or below the sidebar.
+ Return whether the width of the child window can be modified.
+ */
+ bool CanModifyChildWindowWidth();
+
+ /** Set the child window container to a new width.
+ Return the old width.
+ */
+ sal_Int32 SetChildWindowWidth (const sal_Int32 nNewWidth);
+
+ /** Update the icons displayed in the title bars of the deck and
+ the panels. This is called once when a deck is created and
+ every time when a data change event is processed.
+ */
+ void UpdateTitleBarIcons();
+
+ void UpdateDeckOpenState();
+ void RestrictWidth (sal_Int32 nWidth);
+ SfxSplitWindow* GetSplitWindow();
+ void ProcessNewWidth (const sal_Int32 nNewWidth);
+ void UpdateCloseIndicator (const bool bIsIndicatorVisible);
+
+ /** Typically called when a panel is focused via keyboard.
+ Tries to scroll the deck up or down to make the given panel
+ completely visible.
+ */
+ void ShowPanel (const Panel& rPanel);
+
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
+
+ std::unique_ptr<ResourceManager> mpResourceManager;
+
+};
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx b/include/sfx2/sidebar/SidebarDockingWindow.hxx
new file mode 100644
index 000000000..9bad1f5a8
--- /dev/null
+++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sfx2/dockwin.hxx>
+
+#include <rtl/ref.hxx>
+
+class SfxViewShell;
+
+namespace svt { class AcceleratorExecute; }
+
+namespace sfx2::sidebar {
+
+class SidebarChildWindow;
+
+class SidebarController;
+
+class SFX2_DLLPUBLIC SidebarDockingWindow final : public SfxDockingWindow
+{
+public:
+ SidebarDockingWindow(SfxBindings* pBindings, SidebarChildWindow& rChildWindow,
+ vcl::Window* pParent, WinBits nBits);
+ virtual ~SidebarDockingWindow() override;
+ virtual void dispose() override;
+ virtual bool EventNotify(NotifyEvent& rEvent) override;
+ virtual bool Close() override;
+
+ /// Force generation of all panels by completion.
+ void SyncUpdate();
+
+ auto& GetSidebarController() const { return mpSidebarController; }
+ using SfxDockingWindow::Close;
+
+private:
+ // Window overridables
+ virtual void GetFocus() override;
+
+ virtual SfxChildAlignment CheckAlignment (
+ SfxChildAlignment eCurrentAlignment,
+ SfxChildAlignment eRequestedAlignment) override;
+
+ ::rtl::Reference<sfx2::sidebar::SidebarController> mpSidebarController;
+ bool mbIsReadyToDrag;
+ std::unique_ptr<svt::AcceleratorExecute> mpAccel;
+};
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/SidebarModelUpdate.hxx b/include/sfx2/sidebar/SidebarModelUpdate.hxx
new file mode 100644
index 000000000..988478bce
--- /dev/null
+++ b/include/sfx2/sidebar/SidebarModelUpdate.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sfx2/dllapi.h>
+
+namespace com::sun::star::frame
+{
+class XModel;
+}
+namespace com::sun::star::uno
+{
+template <typename> class Reference;
+}
+
+namespace sfx2::sidebar
+{
+class SFX2_DLLPUBLIC SidebarModelUpdate
+{
+public:
+ virtual ~SidebarModelUpdate();
+ virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) = 0;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/SidebarPanelBase.hxx b/include/sfx2/sidebar/SidebarPanelBase.hxx
new file mode 100644
index 000000000..b00d4ca3c
--- /dev/null
+++ b/include/sfx2/sidebar/SidebarPanelBase.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <memory>
+
+#include <sfx2/dllapi.h>
+
+#include <comphelper/compbase.hxx>
+
+#include <com/sun/star/ui/XContextChangeEventListener.hpp>
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/ui/XToolPanel.hpp>
+#include <com/sun/star/ui/XSidebarPanel.hpp>
+#include <com/sun/star/ui/XUpdateModel.hpp>
+
+class PanelLayout;
+
+namespace sfx2::sidebar {
+
+class Panel;
+
+typedef comphelper::WeakComponentImplHelper<css::ui::XContextChangeEventListener,
+ css::ui::XUIElement,
+ css::ui::XToolPanel,
+ css::ui::XSidebarPanel,
+ css::ui::XUpdateModel>
+ SidebarPanelBaseInterfaceBase;
+
+/** Base class for sidebar panels that provides some convenience
+ functionality.
+*/
+class SFX2_DLLPUBLIC SidebarPanelBase final : public SidebarPanelBaseInterfaceBase
+{
+public:
+ static css::uno::Reference<css::ui::XUIElement> Create(const OUString& rsResourceURL,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ std::unique_ptr<PanelLayout> xControl,
+ const css::ui::LayoutSize& rLayoutSize);
+
+ // XContextChangeEventListener
+ virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override;
+
+ // XUIElement
+ virtual css::uno::Reference<css::frame::XFrame> SAL_CALL getFrame() override;
+ virtual OUString SAL_CALL getResourceURL() override;
+ virtual sal_Int16 SAL_CALL getType() override;
+ virtual css::uno::Reference<css::uno::XInterface> SAL_CALL getRealInterface() override;
+
+ // XToolPanel
+ virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL createAccessible(
+ const css::uno::Reference<css::accessibility::XAccessible>& rxParentAccessible) override;
+ virtual css::uno::Reference<css::awt::XWindow> SAL_CALL getWindow() override;
+
+ // XSidebarPanel
+ virtual css::ui::LayoutSize SAL_CALL getHeightForWidth(sal_Int32 nWidth) override;
+ virtual sal_Int32 SAL_CALL getMinimalWidth() override;
+
+ // XUpdateModel
+ virtual void SAL_CALL updateModel(const css::uno::Reference<css::frame::XModel>& xModel) override;
+
+ void SetParentPanel(sfx2::sidebar::Panel* pPanel);
+
+private:
+ SidebarPanelBase(const OUString& rsResourceURL, const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ std::unique_ptr<PanelLayout> xControl, const css::ui::LayoutSize& rLayoutSize);
+ virtual ~SidebarPanelBase() override;
+ SidebarPanelBase(const SidebarPanelBase&) = delete;
+ SidebarPanelBase& operator=( const SidebarPanelBase& ) = delete;
+
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
+
+ css::uno::Reference<css::frame::XFrame> mxFrame;
+ std::unique_ptr<PanelLayout> mxControl;
+ const OUString msResourceURL;
+ const css::ui::LayoutSize maLayoutSize;
+};
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
new file mode 100644
index 000000000..5cc092c23
--- /dev/null
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sfx2/sidebar/ResourceManager.hxx>
+
+#include <vcl/InterimItemWindow.hxx>
+
+#include <functional>
+
+namespace com::sun::star::frame { class XFrame; }
+
+namespace svt { class AcceleratorExecute; }
+
+namespace weld { class Toolbar; }
+
+namespace sfx2::sidebar {
+
+class FocusManager;
+class SidebarController;
+
+/** The tab bar is the container for the individual tabs.
+*/
+class TabBar final : public InterimItemWindow
+{
+public:
+ /** DeckMenuData has entries for display name, and a flag:
+ - isCurrentDeck for the deck selection data
+ - isEnabled for the show/hide menu
+ */
+ class DeckMenuData
+ {
+ public:
+ OUString msDisplayName;
+ bool mbIsCurrentDeck;
+ bool mbIsActive;
+ bool mbIsEnabled;
+ };
+ typedef ::std::function<void (
+ weld::Menu& rMainMenu, weld::Menu& rSubMenu,
+ const ::std::vector<DeckMenuData>& rMenuData)> PopupMenuProvider;
+ TabBar (
+ vcl::Window* pParentWindow,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ const ::std::function<void (const OUString& rsDeckId)>& rDeckActivationFunctor,
+ const PopupMenuProvider& rPopupMenuProvider,
+ SidebarController* rParentSidebarController);
+
+ weld::Container* GetContainer() { return m_xContainer.get(); }
+
+ virtual ~TabBar() override;
+ virtual void dispose() override;
+
+ virtual void DataChanged (const DataChangedEvent& rDataChangedEvent) override;
+ virtual bool EventNotify (NotifyEvent& rEvent) override;
+
+ static sal_Int32 GetDefaultWidth();
+
+ void SetDecks (
+ const ResourceManager::DeckContextDescriptorContainer& rDecks);
+ void HighlightDeck (std::u16string_view rsDeckId);
+ void RemoveDeckHighlight ();
+ OUString const & GetDeckIdForIndex (const sal_Int32 nIndex) const;
+ void ToggleHideFlag (const sal_Int32 nIndex);
+ void RestoreHideFlags();
+
+ void UpdateFocusManager (FocusManager& rFocusManager);
+
+ /// Enables/Disables the menu button. Used by LoKit.
+ void EnableMenuButton(const bool bEnable);
+
+private:
+ css::uno::Reference<css::frame::XFrame> mxFrame;
+
+ // This unusual auxiliary builder is because without a toplevel GtkWindow
+ // gtk will warn on loading a .ui with an accelerator defined, so use a
+ // temporary toplevel to suppress that and move the contents after load
+ std::unique_ptr<weld::Builder> mxAuxBuilder;
+ std::unique_ptr<weld::Box> mxTempToplevel;
+ std::unique_ptr<weld::Widget> mxContents;
+
+ std::unique_ptr<weld::MenuButton> mxMenuButton;
+ std::unique_ptr<weld::Menu> mxMainMenu;
+ std::unique_ptr<weld::Menu> mxSubMenu;
+ std::unique_ptr<weld::Widget> mxMeasureBox;
+ class Item
+ {
+ private:
+ TabBar& mrTabBar;
+ std::unique_ptr<weld::Builder> mxBuilder;
+ public:
+ Item(TabBar& rTabBar);
+ ~Item();
+ DECL_LINK(HandleClick, const OString&, void);
+ std::unique_ptr<weld::Toolbar> mxButton;
+ OUString msDeckId;
+ ::std::function<void (const OUString& rsDeckId)> maDeckActivationFunctor;
+ bool mbIsHidden;
+ bool mbIsHiddenByDefault;
+ };
+ typedef ::std::vector<std::unique_ptr<Item>> ItemContainer;
+ ItemContainer maItems;
+ const ::std::function<void (const OUString& rsDeckId)> maDeckActivationFunctor;
+ PopupMenuProvider maPopupMenuProvider;
+
+ void CreateTabItem(weld::Toolbar& rButton, const DeckDescriptor& rDeckDescriptor);
+ css::uno::Reference<css::graphic::XGraphic> GetItemImage(const DeckDescriptor& rDeskDescriptor) const;
+ void UpdateButtonIcons();
+
+ DECL_LINK(OnToolboxClicked, weld::Toggleable&, void);
+
+ SidebarController* pParentSidebarController;
+ std::unique_ptr<svt::AcceleratorExecute> mpAccel;
+
+};
+
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/Theme.hxx b/include/sfx2/sidebar/Theme.hxx
new file mode 100644
index 000000000..a3f827f4a
--- /dev/null
+++ b/include/sfx2/sidebar/Theme.hxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sfx2/dllapi.h>
+
+#include <tools/color.hxx>
+#include <comphelper/compbase.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <map>
+#include <unordered_map>
+
+
+namespace sfx2::sidebar {
+
+typedef comphelper::WeakComponentImplHelper <
+ css::beans::XPropertySet,
+ css::beans::XPropertySetInfo
+ > ThemeInterfaceBase;
+
+/** Simple collection of colors, gradients, fonts that define the
+ look of the sidebar and its controls.
+*/
+class SFX2_DLLPUBLIC Theme final
+ : public ThemeInterfaceBase
+{
+public:
+ enum ThemeItem
+ {
+ Begin_,
+ Pre_Color_ = Begin_,
+
+ AnyItem_ = Pre_Color_,
+
+ Image_Color_,
+
+ Color_Highlight,
+ Color_HighlightText,
+ Color_DeckBackground,
+ Color_DeckTitleBarBackground,
+ Color_PanelBackground,
+ Color_PanelTitleBarBackground,
+ Color_TabBarBackground,
+
+ Color_Int_,
+
+ Int_DeckBorderSize,
+ Int_DeckSeparatorHeight,
+ Int_DeckLeftPadding,
+ Int_DeckTopPadding,
+ Int_DeckRightPadding,
+ Int_DeckBottomPadding,
+
+ Int_Bool_,
+
+ Bool_UseSystemColors,
+ Bool_IsHighContrastModeActive,
+
+ Post_Bool_,
+ End_=Post_Bool_
+ };
+
+ static Color GetColor (const ThemeItem eItem);
+ static sal_Int32 GetInteger (const ThemeItem eItem);
+
+ static bool IsHighContrastMode();
+
+ static void HandleDataChange();
+
+ void InitializeTheme();
+
+ Theme();
+ virtual ~Theme() override;
+ Theme(const Theme&) = delete;
+ Theme& operator=( const Theme& ) = delete;
+
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
+
+ static css::uno::Reference<css::beans::XPropertySet> GetPropertySet();
+
+ // beans::XPropertySet
+ virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual void SAL_CALL setPropertyValue (
+ const OUString& rsPropertyName,
+ const css::uno::Any& rValue) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue (
+ const OUString& rsPropertyName) override;
+ virtual void SAL_CALL addPropertyChangeListener(
+ const OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XPropertyChangeListener>& rxListener) override;
+ virtual void SAL_CALL removePropertyChangeListener(
+ const OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XPropertyChangeListener>& rxListener) override;
+ virtual void SAL_CALL addVetoableChangeListener(
+ const OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XVetoableChangeListener>& rxListener) override;
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XVetoableChangeListener>& rxListener) override;
+
+ // beans::XPropertySetInfo
+ virtual css::uno::Sequence<css::beans::Property> SAL_CALL getProperties() override;
+ virtual css::beans::Property SAL_CALL getPropertyByName (const OUString& rsName) override;
+ virtual sal_Bool SAL_CALL hasPropertyByName (const OUString& rsName) override;
+
+private:
+ static Theme& GetCurrentTheme();
+
+ std::vector<Color> maColors;
+ std::vector<sal_Int32> maIntegers;
+ std::vector<bool> maBooleans;
+ bool mbIsHighContrastMode;
+ bool mbIsHighContrastModeSetManually;
+
+ typedef std::unordered_map<OUString,ThemeItem> PropertyNameToIdMap;
+ PropertyNameToIdMap maPropertyNameToIdMap;
+ typedef std::vector<OUString> PropertyIdToNameMap;
+ PropertyIdToNameMap maPropertyIdToNameMap;
+ typedef ::std::vector<css::uno::Any> RawValueContainer;
+ RawValueContainer maRawValues;
+
+ typedef std::vector<css::uno::Reference<css::beans::XPropertyChangeListener> > ChangeListenerContainer;
+ typedef std::map<ThemeItem,ChangeListenerContainer> ChangeListeners;
+ ChangeListeners maChangeListeners;
+ typedef std::vector<css::uno::Reference<css::beans::XVetoableChangeListener> > VetoableListenerContainer;
+ typedef std::map<ThemeItem,VetoableListenerContainer> VetoableListeners;
+ VetoableListeners maVetoableListeners;
+
+ enum PropertyType
+ {
+ PT_Color,
+ PT_Integer,
+ PT_Boolean,
+ PT_Invalid
+ };
+
+ void SetupPropertyMaps();
+ void UpdateTheme();
+ static PropertyType GetPropertyType (const ThemeItem eItem);
+ static css::uno::Type const & GetCppuType (const PropertyType eType);
+ static sal_Int32 GetIndex (
+ const ThemeItem eItem,
+ const PropertyType eType);
+
+ VetoableListenerContainer* GetVetoableListeners (
+ const ThemeItem eItem,
+ const bool bCreate);
+ ChangeListenerContainer* GetChangeListeners (
+ const ThemeItem eItem,
+ const bool bCreate);
+ static bool DoVetoableListenersVeto (
+ const VetoableListenerContainer* pListeners,
+ const css::beans::PropertyChangeEvent& rEvent);
+ static void BroadcastPropertyChange (
+ const ChangeListenerContainer* pListeners,
+ const css::beans::PropertyChangeEvent& rEvent);
+ void ProcessNewValue (
+ const css::uno::Any& rValue,
+ const ThemeItem eItem,
+ const PropertyType eType);
+};
+
+
+} // end of namespace sfx2::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/signaturestate.hxx b/include/sfx2/signaturestate.hxx
new file mode 100644
index 000000000..d63498d1c
--- /dev/null
+++ b/include/sfx2/signaturestate.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_SIGNATURESTATE_HXX
+#define INCLUDED_SFX2_SIGNATURESTATE_HXX
+
+#include <sfx2/dllapi.h>
+
+#include <com/sun/star/security/DocumentSignatureInformation.hpp>
+
+enum class SignatureState
+{
+ // FIXME: Do these values have to be these, and given at all, or is this just cargo cult?
+ UNKNOWN = 0xffff, // used to be -1 when this was a sal_uInt16
+ NOSIGNATURES = 0,
+ OK = 1,
+ BROKEN = 2,
+ // State was SignatureState::OK, but doc is modified now
+ INVALID = 3,
+ // signature is OK, but certificate could not be validated
+ NOTVALIDATED = 4,
+ // signature and certificate are ok, but not all files are signed, as it was the case in
+ // OOo 2.x - OOo 3.1.1. This state is only used together with document signatures.
+ PARTIAL_OK = 5,
+ /// Certificate could not be validated and the document is only partially signed.
+ NOTVALIDATED_PARTIAL_OK = 6
+};
+
+namespace DocumentSignatures
+{
+/** Get document signature state */
+SFX2_DLLPUBLIC SignatureState
+getSignatureState(const css::uno::Sequence<css::security::DocumentSignatureInformation>& aInfos);
+}
+
+#endif // INCLUDED_SFX2_SIGNATURESTATE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/stbitem.hxx b/include/sfx2/stbitem.hxx
new file mode 100644
index 000000000..67c88c687
--- /dev/null
+++ b/include/sfx2/stbitem.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_STBITEM_HXX
+#define INCLUDED_SFX2_STBITEM_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <svl/poolitem.hxx>
+#include <svtools/statusbarcontroller.hxx>
+#include <vcl/vclptr.hxx>
+
+class SfxModule;
+class SfxStatusBarControl;
+class StatusBar;
+
+rtl::Reference<svt::StatusbarController> SfxStatusBarControllerFactory(
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ StatusBar* pStatusBar,
+ unsigned short nID,
+ const OUString& aCommandURL );
+typedef rtl::Reference<SfxStatusBarControl> (*SfxStatusBarControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb );
+
+struct SfxStbCtrlFactory
+{
+ SfxStatusBarControlCtor pCtor;
+ const std::type_info& nTypeId;
+ sal_uInt16 nSlotId;
+
+ SfxStbCtrlFactory( SfxStatusBarControlCtor pTheCtor,
+ const std::type_info& nTheTypeId, sal_uInt16 nTheSlotId ):
+ pCtor(pTheCtor),
+ nTypeId(nTheTypeId),
+ nSlotId(nTheSlotId)
+ {}
+};
+
+
+class CommandEvent;
+class MouseEvent;
+class UserDrawEvent;
+
+class SFX2_DLLPUBLIC SfxStatusBarControl: public svt::StatusbarController
+{
+ sal_uInt16 nSlotId;
+ sal_uInt16 nId;
+ VclPtr<StatusBar> pBar;
+
+public:
+ // new controller API
+ // XInterface
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+protected:
+ // XEventListener
+ using svt::StatusbarController::disposing;
+
+ // XComponent
+ using svt::StatusbarController::dispose;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
+
+ // XStatusbarController
+ virtual sal_Bool SAL_CALL mouseButtonDown( const css::awt::MouseEvent& aMouseEvent ) override;
+ virtual sal_Bool SAL_CALL mouseMove( const css::awt::MouseEvent& aMouseEvent ) override;
+ virtual sal_Bool SAL_CALL mouseButtonUp( const css::awt::MouseEvent& aMouseEvent ) override;
+ virtual void SAL_CALL command( const css::awt::Point& aPos,
+ ::sal_Int32 nCommand,
+ sal_Bool bMouseEvent,
+ const css::uno::Any& aData ) override;
+ virtual void SAL_CALL paint( const css::uno::Reference< css::awt::XGraphics >& xGraphics,
+ const css::awt::Rectangle& rOutputRectangle,
+ ::sal_Int32 nStyle ) override;
+ virtual void SAL_CALL click( const css::awt::Point& aPos ) override;
+ virtual void SAL_CALL doubleClick( const css::awt::Point& aPos ) override;
+
+ // Old sfx2 interface
+ virtual void StateChangedAtStatusBarControl( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual void Click();
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual bool MouseButtonDown( const MouseEvent & );
+ virtual bool MouseMove( const MouseEvent & );
+ virtual bool MouseButtonUp( const MouseEvent & );
+ virtual void Paint( const UserDrawEvent &rUDEvt );
+
+ static sal_uInt16 convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons );
+
+public:
+ SfxStatusBarControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar& rBar );
+ virtual ~SfxStatusBarControl() override;
+
+ sal_uInt16 GetSlotId() const { return nSlotId; }
+ sal_uInt16 GetId() const { return nId; }
+ StatusBar& GetStatusBar() const { return *pBar; }
+
+ static rtl::Reference<SfxStatusBarControl> CreateControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar *pBar, SfxModule const * );
+ static void RegisterStatusBarControl(SfxModule*, const SfxStbCtrlFactory&);
+
+};
+
+
+#define SFX_DECL_STATUSBAR_CONTROL() \
+ static rtl::Reference<SfxStatusBarControl> CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ); \
+ static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=nullptr)
+
+#define SFX_IMPL_STATUSBAR_CONTROL(Class, nItemClass) \
+ rtl::Reference<SfxStatusBarControl> Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ) \
+ { return new Class( nSlotId, nId, rStb ); } \
+ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \
+ { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \
+ Class::CreateImpl, typeid(nItemClass), nSlotId ) ); }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc
new file mode 100644
index 000000000..e392b1d03
--- /dev/null
+++ b/include/sfx2/strings.hrc
@@ -0,0 +1,361 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_INC_STRINGS_HRC
+#define INCLUDED_SFX2_INC_STRINGS_HRC
+
+#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
+
+#define STR_TEMPLATE_FILTER NC_("STR_TEMPLATE_FILTER", "Templates")
+#define STR_SAVEDOC NC_("STR_SAVEDOC", "~Save")
+#define STR_SAVEASDOC NC_("STR_SAVEASDOC", "Save ~As...")
+#define STR_SAVEACOPY NC_("STR_SAVEACOPY", "Save a Copy...")
+#define STR_CLOSEDOC NC_("STR_CLOSEDOC", "~Close")
+#define STR_OPEN NC_("STR_OPEN", "~Open")
+#define STR_EDIT_TEMPLATE NC_("STR_EDIT_TEMPLATE", "~Edit")
+#define STR_DEFAULT_TEMPLATE NC_("STR_DEFAULT_TEMPLATE", "Set as De~fault")
+#define STR_RESET_DEFAULT NC_("STR_RESET_DEFAULT", "Reset De~fault")
+#define STR_DELETE_TEMPLATE NC_("STR_DELETE_TEMPLATE", "~Delete")
+#define STR_SFX_RENAME NC_("STR_SFX_RENAME", "~Rename")
+#define STR_MOVE NC_("STR_ACTION_MOVE","~Move")
+#define STR_EXPORT NC_("STR_ACTION_EXPORT","E~xport")
+#define STR_CATEGORY_RENAME NC_("STR_CATEGORY_RENAME", "Ren~ame Category")
+#define STR_RENAME_TEMPLATE NC_("STR_RENAME_TEMPLATE", "Enter new template name:")
+#define STR_TEMPLATE_TOOLTIP NC_("STR_TEMPLATE_TOOLTIP", "Title: $1\nCategory: $2")
+#define STR_TEMPLATE_SELECTION NC_("STR_TEMPLATE_SELECTION", "Select a Template")
+#define STR_AUTOMATICVERSION NC_("STR_AUTOMATICVERSION", "Automatically saved version")
+#define STR_EXPORTBUTTON NC_("STR_EXPORTBUTTON", "Export")
+#define STR_LABEL_FILEFORMAT NC_("STR_LABEL_FILEFORMAT", "File format:")
+#define STR_HIDDENINFO_CONTAINS NC_("STR_HIDDENINFO_CONTAINS", "This document contains:\n\n")
+#define STR_HIDDENINFO_RECORDCHANGES NC_("STR_HIDDENINFO_RECORDCHANGES", "Recorded changes")
+#define STR_HIDDENINFO_NOTES NC_("STR_HIDDENINFO_NOTES", "Notes")
+#define STR_HIDDENINFO_DOCVERSIONS NC_("STR_HIDDENINFO_DOCVERSIONS", "Document versions")
+#define STR_HIDDENINFO_CONTINUE_SAVING NC_("STR_HIDDENINFO_CONTINUE_SAVING", "Do you want to continue saving the document?")
+#define STR_HIDDENINFO_CONTINUE_PRINTING NC_("STR_HIDDENINFO_CONTINUE_PRINTING", "Do you want to continue printing the document?")
+#define STR_HIDDENINFO_CONTINUE_SIGNING NC_("STR_HIDDENINFO_CONTINUE_SIGNING", "Do you want to continue signing the document?")
+#define STR_HIDDENINFO_CONTINUE_CREATEPDF NC_("STR_HIDDENINFO_CONTINUE_CREATEPDF", "Do you want to continue creating a PDF file?")
+#define STR_NEW_FILENAME_SAVE NC_("STR_NEW_FILENAME_SAVE", "If you do not want to overwrite the original document, you should save your work under a new filename.")
+// Used in the title of a shared document.
+#define STR_SHARED NC_("STR_SHARED", " (shared)")
+#define STR_XMLSEC_ODF12_EXPECTED NC_("STR_XMLSEC_ODF12_EXPECTED", "The document format version is set to ODF 1.1 (OpenOffice.org 2.x) in Tools-Options-Load/Save-General. Signing documents requires ODF 1.2 (OpenOffice.org 3.x).")
+#define STR_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN NC_("STR_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN", "The document has to be saved before it can be signed. Saving the document removes all present signatures.\nDo you want to save the document?")
+#define STR_QRYTEMPL_MESSAGE NC_("STR_QRYTEMPL_MESSAGE", "The template '$(ARG1)' on which this document is based, has been modified. Do you want to update the styles of the current document, using the modified template?")
+#define STR_QRYTEMPL_UPDATE_BTN NC_("STR_QRYTEMPL_UPDATE_BTN", "~Update Styles")
+#define STR_QRYTEMPL_KEEP_BTN NC_("STR_QRYTEMPL_KEEP_BTN", "~Keep Old Styles")
+#define STR_CATEGORY_NEW NC_("STR_CATEGORY_NEW", "~New Category")
+#define STR_CATEGORY_DELETE NC_("STR_CATEGORY_DELETE", "~Delete Category")
+#define STR_MSG_EXPORT_SUCCESS NC_("STR_MSG_EXPORT_SUCCESS", "$1 templates successfully exported.")
+#define STR_MSG_QUERY_COPY NC_("STR_MSG_QUERY_COPY", "$1 could not be moved to the category \"$2\". Do you want to copy the template instead?")
+#define STR_CREATE_ERROR NC_("STR_CREATE_ERROR", "Cannot create category: $1")
+#define STR_ERROR_SAVEAS NC_("STR_ERROR_SAVEAS", "Cannot save template: $1")
+#define STR_INPUT_NEW NC_("STR_INPUT_NEW", "Enter new category name:")
+#define STR_MSG_ERROR_LOCAL_MOVE NC_("STR_MSG_ERROR_LOCAL_MOVE", "Error moving the following templates to $1.\n$2")
+#define STR_MSG_ERROR_EXPORT NC_("STR_MSG_ERROR_EXPORT", "Error exporting the following templates:\n$1")
+#define STR_MSG_ERROR_IMPORT NC_("STR_MSG_ERROR_IMPORT", "Error importing the following templates to $1:\n$2")
+#define STR_MSG_ERROR_DELETE_TEMPLATE NC_("STR_MSG_ERROR_DELETE_TEMPLATE", "The following templates cannot be deleted:\n$1")
+#define STR_MSG_ERROR_DELETE_FOLDER NC_("STR_MSG_ERROR_DELETE_FOLDER", "The following folders cannot be deleted:\n$1")
+#define STR_TOOLTIP_ERROR_RENAME_TEMPLATE NC_("STR_TOOLTIP_ERROR_RENAME_TEMPLATE", "There is another template with the name $1 in $2.")
+#define STR_QMSG_SEL_FOLDER_DELETE NC_("STR_QMSG_SEL_FOLDER_DELETE", "Do you want to delete the selected category?")
+#define STR_QMSG_TEMPLATE_OVERWRITE NC_("STR_QMSG_TEMPLATE_OVERWRITE", "A template named $1 already exists in $2. Do you want to overwrite it?")
+#define STR_QMSG_SEL_TEMPLATE_DELETE NC_("STR_QMSG_SEL_TEMPLATE_DELETE", "Do you want to delete the selected templates?")
+#define STR_QMSG_ERROR_OPENING_FILE NC_("STR_QMSG_ERROR_OPENING_FILE", "An error occurred during opening the file. This may be caused by incorrect file contents.\n")
+#define STR_QMSG_ERROR_OPENING_FILE_DETAILS NC_("STR_QMSG_ERROR_OPENING_FILE_DETAILS", "The error details are:\n")
+#define STR_QMSG_ERROR_OPENING_FILE_CONTINUE NC_("STR_QMSG_ERROR_OPENING_FILE_CONTINUE", "\nProceeding with import may cause data loss or corruption, and application may become unstable or crash.\n\nDo you want to ignore the error and attempt to continue loading the file?")
+
+#define STR_HELP_WINDOW_TITLE NC_("STR_HELP_WINDOW_TITLE", "%PRODUCTNAME Help")
+#define STR_HELP_BUTTON_INDEX_ON NC_("STR_HELP_BUTTON_INDEX_ON", "Show Navigation Pane")
+#define STR_HELP_BUTTON_INDEX_OFF NC_("STR_HELP_BUTTON_INDEX_OFF", "Hide Navigation Pane")
+#define STR_HELP_BUTTON_START NC_("STR_HELP_BUTTON_START", "First Page")
+#define STR_HELP_BUTTON_PREV NC_("STR_HELP_BUTTON_PREV", "Previous Page")
+#define STR_HELP_BUTTON_NEXT NC_("STR_HELP_BUTTON_NEXT", "Next Page")
+#define STR_HELP_BUTTON_PRINT NC_("STR_HELP_BUTTON_PRINT", "Print...")
+#define STR_HELP_BUTTON_ADDBOOKMARK NC_("STR_HELP_BUTTON_ADDBOOKMARK", "Add to Bookmarks...")
+#define STR_HELP_BUTTON_SEARCHDIALOG NC_("STR_HELP_BUTTON_SEARCHDIALOG", "Find on this Page...")
+#define STR_HELP_BUTTON_SOURCEVIEW NC_("STR_HELP_BUTTON_SOURCEVIEW", "HTML Source")
+#define STR_HELP_MENU_TEXT_SELECTION_MODE NC_("STR_HELP_MENU_TEXT_SELECTION_MODE", "Select Text")
+#define STR_HELP_MENU_TEXT_COPY NC_("STR_HELP_MENU_TEXT_COPY", "~Copy")
+#define STR_INFO_NOSEARCHRESULTS NC_("STR_INFO_NOSEARCHRESULTS", "No topics found.")
+#define STR_INFO_NOSEARCHTEXTFOUND NC_("STR_INFO_NOSEARCHTEXTFOUND", "The text you entered was not found.")
+#define RID_HELP_ONSTARTUP_TEXT NC_("RID_HELP_ONSTARTUP_TEXT", "~Display %PRODUCTNAME %MODULENAME Help at Startup")
+
+#define STR_NONAME NC_("STR_NONAME", "Untitled")
+#define STR_STANDARD_SHORTCUT NC_("STR_STANDARD_SHORTCUT", "Standard")
+#define STR_BYTES NC_("STR_BYTES", "Bytes")
+#define STR_KB NC_("STR_KB", "kB")
+#define STR_MB NC_("STR_MB", "MB")
+#define STR_GB NC_("STR_GB", "GB")
+#define STR_QUERY_LASTVERSION NC_("STR_QUERY_LASTVERSION", "Cancel all changes?")
+#define STR_NO_WEBBROWSER_FOUND NC_("STR_NO_WEBBROWSER_FOUND", "Opening \"$(ARG1)\" failed with error code $(ARG2) and message: \"$(ARG3)\"\nMaybe no web browser could be found on your system. In that case, please check your Desktop Preferences or install a web browser (for example, Firefox) in the default location requested during the browser installation.")
+#define STR_DANGEROUS_TO_OPEN NC_("STR_DANGEROUS_TO_OPEN", "It might be dangerous to open \"$(ARG1)\".\nDo you really want to open it?")
+#define STR_NO_ABS_URI_REF NC_("STR_NO_ABS_URI_REF", "\"$(ARG1)\" cannot be passed to an external application to open it (e.g., it might not be an absolute URL, or might denote no existing file).")
+#define STR_GID_INTERN NC_("STR_GID_INTERN", "Internal")
+#define STR_GID_APPLICATION NC_("STR_GID_APPLICATION", "Application")
+#define STR_GID_VIEW NC_("STR_GID_VIEW", "View")
+#define STR_GID_DOCUMENT NC_("STR_GID_DOCUMENT", "Documents")
+#define STR_GID_EDIT NC_("STR_GID_EDIT", "Edit")
+#define STR_GID_MACRO NC_("STR_GID_MACRO", "BASIC")
+#define STR_GID_OPTIONS NC_("STR_GID_OPTIONS", "Options")
+#define STR_GID_MATH NC_("STR_GID_MATH", "Math")
+#define STR_GID_NAVIGATOR NC_("STR_GID_NAVIGATOR", "Navigate")
+#define STR_GID_INSERT NC_("STR_GID_INSERT", "Insert")
+#define STR_GID_FORMAT NC_("STR_GID_FORMAT", "Format")
+#define STR_GID_TEMPLATE NC_("STR_GID_TEMPLATE", "Templates")
+#define STR_GID_TEXT NC_("STR_GID_TEXT", "Text")
+#define STR_GID_FRAME NC_("STR_GID_FRAME", "Frame")
+#define STR_GID_GRAPHIC NC_("STR_GID_GRAPHIC", "Image")
+#define STR_GID_TABLE NC_("STR_GID_TABLE", "Table")
+#define STR_GID_ENUMERATION NC_("STR_GID_ENUMERATION", "Numbering")
+#define STR_GID_DATA NC_("STR_GID_DATA", "Data")
+#define STR_GID_SPECIAL NC_("STR_GID_SPECIAL", "Special Functions")
+#define STR_GID_IMAGE NC_("STR_GID_IMAGE", "Image")
+#define STR_GID_CHART NC_("STR_GID_CHART", "Chart")
+#define STR_GID_EXPLORER NC_("STR_GID_EXPLORER", "Explorer")
+#define STR_GID_CONNECTOR NC_("STR_GID_CONNECTOR", "Connector")
+#define STR_GID_MODIFY NC_("STR_GID_MODIFY", "Modify")
+#define STR_GID_DRAWING NC_("STR_GID_DRAWING", "Drawing")
+#define STR_GID_CONTROLS NC_("STR_GID_CONTROLS", "Controls")
+#define STR_QUITAPP NC_("STR_QUITAPP", "E~xit %PRODUCTNAME")
+#define RID_STR_HELP NC_("RID_STR_HELP", "Help")
+#define RID_STR_HLPFILENOTEXIST NC_("RID_STR_HLPFILENOTEXIST", "The help file for this topic is not installed.")
+#define STR_QUICKSTART_EXIT NC_("STR_QUICKSTART_EXIT", "Exit Quickstarter")
+#define STR_QUICKSTART_TIP NC_("STR_QUICKSTART_TIP", "%PRODUCTNAME %PRODUCTVERSION Quickstarter")
+#define STR_QUICKSTART_FILEOPEN NC_("STR_QUICKSTART_FILEOPEN", "Open Document...")
+#define STR_QUICKSTART_FROMTEMPLATE NC_("STR_QUICKSTART_FROMTEMPLATE", "From Template...")
+#define STR_QUICKSTART_PRELAUNCH NC_("STR_QUICKSTART_PRELAUNCH", "Load %PRODUCTNAME During System Start-Up")
+#define STR_QUICKSTART_LNKNAME NC_("STR_QUICKSTART_LNKNAME", "%PRODUCTNAME %PRODUCTVERSION")
+#define STR_QUICKSTART_FILE NC_("STR_QUICKSTART_FILE", "File")
+#define STR_QUICKSTART_STARTCENTER NC_("STR_QUICKSTART_STARTCENTER", "Startcenter")
+#define STR_QUICKSTART_RECENTDOC NC_("STR_QUICKSTART_RECENTDOC", "Recent Documents")
+#define STR_QUERY_UPDATE_LINKS NC_("STR_QUERY_UPDATE_LINKS", "The document %{filename} contains one or more links to external data.\n\nWould you like to change the document, and update all links\nto get the most recent data?")
+#define STR_DDE_ERROR NC_("STR_DDE_ERROR", "DDE link to %1 for %2 area %3 are not available.")
+#define STR_SECURITY_WARNING_NO_HYPERLINKS NC_("STR_SECURITY_WARNING_NO_HYPERLINKS", "For security reasons, the hyperlink cannot be executed.\nThe stated address will not be opened.")
+#define RID_SECURITY_WARNING_TITLE NC_("RID_SECURITY_WARNING_TITLE", "Security Warning")
+#define RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE NC_("RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE", "Saving will remove all existing signatures.\nDo you want to continue saving the document?")
+#define RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN NC_("RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN", "The document has to be saved before it can be signed.\nDo you want to save the document?")
+#define STR_QUERY_CANCELCHECKOUT NC_("STR_QUERY_CANCELCHECKOUT", "This will discard all changes on the server since check-out.\nDo you want to proceed?")
+#define STR_INFO_WRONGDOCFORMAT NC_("STR_INFO_WRONGDOCFORMAT", "This document must be saved in OpenDocument file format before it can be digitally signed.")
+#define RID_XMLSEC_DOCUMENTSIGNED NC_("RID_XMLSEC_DOCUMENTSIGNED", " (Signed)")
+#define STR_EMBEDDED_TITLE NC_("STR_EMBEDDED_TITLE", " (Embedded document)")
+#define STR_STANDARD NC_("STR_STANDARD", "Standard")
+#define RID_SVXSTR_FILELINK NC_("RID_SVXSTR_FILELINK", "Document")
+#define STR_NONE NC_("STR_NONE", "- None -")
+#define STR_CATEGORY_NONE NC_("saveastemplatedlg|categorylist", "None")
+#define RID_SVXSTR_GRAPHICLINK NC_("RID_SVXSTR_GRAPHICLINK", "Image")
+#define STR_SFX_FILTERNAME_ALL NC_("STR_SFX_FILTERNAME_ALL", "All files")
+#define STR_SFX_FILTERNAME_PDF NC_("STR_SFX_FILTERNAME_PDF", "PDF files")
+#define RID_SVXSTR_EDITGRFLINK NC_("RID_SVXSTR_EDITGRFLINK", "Link Image")
+// i66948 used in project scripting
+#define STR_ERRUNOEVENTBINDUNG NC_("STR_ERRUNOEVENTBINDUNG", "An appropriate component method %1\ncould not be found.\n\nCheck spelling of method name.")
+#define RID_SVXSTR_GRFILTER_OPENERROR NC_("RID_SVXSTR_GRFILTER_OPENERROR", "Image file cannot be opened")
+#define RID_SVXSTR_GRFILTER_IOERROR NC_("RID_SVXSTR_GRFILTER_IOERROR", "Image file cannot be read")
+#define RID_SVXSTR_GRFILTER_FORMATERROR NC_("RID_SVXSTR_GRFILTER_FORMATERROR", "Unknown image format")
+#define RID_SVXSTR_GRFILTER_VERSIONERROR NC_("RID_SVXSTR_GRFILTER_VERSIONERROR", "This version of the image file is not supported")
+#define RID_SVXSTR_GRFILTER_FILTERERROR NC_("RID_SVXSTR_GRFILTER_FILTERERROR", "Image filter not found")
+#define RID_SVXSTR_TXTFILTER_FILTERERROR NC_("RID_SVXSTR_TXTFILTER_FILTERERROR", "This is not a text document")
+#define RID_SVXSTR_END_REDLINING_WARNING NC_("RID_SVXSTR_END_REDLINING_WARNING", "This action will exit the change recording mode.\nNo information about changes will be recorded from now on.\n\nExit change recording mode?\n\n")
+#define RID_SVXSTR_INCORRECT_PASSWORD NC_("RID_SVXSTR_INCORRECT_PASSWORD", "Incorrect password")
+#define RID_SVXSTR_GPG_ENCRYPT_FAILURE NC_("RID_SVXSTR_GPG_ENCRYPT_FAILURE", "OpenPGP key not trusted, damaged, or encryption failure. Please try again.")
+
+#define STR_PASSWD_MIN_LEN NC_("STR_PASSWD_MIN_LEN", "(Minimum $(MINLEN) characters)")
+#define STR_PASSWD_MIN_LEN1 NC_("STR_PASSWD_MIN_LEN1", "(Minimum 1 character)")
+#define STR_PASSWD_EMPTY NC_("STR_PASSWD_EMPTY", "(The password can be empty)")
+#define STR_MODULENOTINSTALLED NC_("STR_MODULENOTINSTALLED", "The action could not be executed. The %PRODUCTNAME program module needed for this action is currently not installed.")
+
+#define STR_FILTER_NOT_INSTALLED NC_("STR_FILTER_NOT_INSTALLED", "The selected filter $(FILTER) has not been installed.\nWould you like to do this now?")
+#define STR_FILTER_CONSULT_SERVICE NC_("STR_FILTER_CONSULT_SERVICE", "The selected filter $(FILTER) is not included in your edition.\nYou can find information about orders on our homepage.")
+
+#define STR_WELCOME_LINE1 NC_("STR_WELCOME_LINE1", "Welcome to %PRODUCTNAME.")
+#define STR_WELCOME_LINE2 NC_("STR_WELCOME_LINE2", "Drop a document here or open an app to create one.")
+
+// Translators: Target types in Auto-redaction dialog
+#define STR_REDACTION_TARGET_TYPE_TEXT NC_("STR_REDACTION_TARGET_TYPE_TEXT", "Text")
+#define STR_REDACTION_TARGET_TYPE_REGEX NC_("STR_REDACTION_TARGET_TYPE_REGEX", "Regular expression")
+#define STR_REDACTION_TARGET_TYPE_PREDEF NC_("STR_REDACTION_TARGET_TYPE_PREDEF", "Predefined")
+#define STR_REDACTION_TARGET_TYPE_UNKNOWN NC_("STR_REDACTION_TARGET_TYPE_UNKNOWN", "Unknown")
+
+// Translators: Values for the Case Sensitive and the Whole Words columns in Auto-redaction dialog
+#define STR_REDACTION_YES NC_("STR_REDACTION_YES", "Yes")
+#define STR_REDACTION_NO NC_("STR_REDACTION_NO", "No")
+
+// Translators: Misc strings of the Auto Redaction dialog
+#define STR_REDACTION_TARGET NC_("STR_REDACTION_TARGET", "Target")
+#define STR_REDACTION_LOAD_TARGETS NC_("STR_REDACTION_LOAD_TARGETS", "Load Targets")
+#define STR_REDACTION_SAVE_TARGETS NC_("STR_REDACTION_SAVE_TARGETS", "Save Targets")
+#define STR_REDACTION_FIELDS_REQUIRED NC_("STR_REDACTION_FIELDS_REQUIRED", "All fields are required")
+#define STR_REDACTION_TARGET_NAME_CLASH NC_("STR_REDACTION_TARGET_NAME_CLASH", "There is already a target with this name")
+#define STR_REDACTION_MULTI_EDIT NC_("STR_REDACTION_MULTI_EDIT", "You have selected multiple targets, but only one target can be edited at once.")
+#define STR_REDACTION_MULTI_DELETE NC_("STR_REDACTION_MULTI_DELETE", "Are you sure you would like to delete $(TARGETSCOUNT) targets at once?")
+#define STR_REDACTION_JSON_FILE_FILTER NC_("STR_REDACTION_JSON_FILE_FILTER", "Target Set (*.json)")
+#define STR_REDACTION_EDIT_TARGET NC_("STR_REDACTION_EDIT_TARGET", "Edit Target")
+#define STR_REDACTION_TARGET_ADD_ERROR NC_("STR_REDACTION_TARGET_ADD_ERROR", "An error occurred while adding new target. Please report this incident.")
+#define STR_REDACTION_NO_DRAW_WARNING NC_("STR_REDACTION_NO_DRAW_WARNING", "Draw module is needed for redaction. Please make sure you have %PRODUCTNAME Draw installed and working correctly.")
+
+#define STR_SFX_FILEDLG_ACTUALVERSION NC_("STR_SFX_FILEDLG_ACTUALVERSION", "Current version")
+#define STR_SFX_EXPLORERFILE_EXPORT NC_("STR_SFX_EXPLORERFILE_EXPORT", "Export")
+#define STR_SFX_EXPLORERFILE_INSERT NC_("STR_SFX_EXPLORERFILE_INSERT", "Insert")
+#define STR_SFX_EXPLORERFILE_BUTTONINSERT NC_("STR_SFX_EXPLORERFILE_BUTTONINSERT", "~Insert")
+#define STR_SFX_IMPORT_ALL_IMAGES NC_("STR_SFX_IMPORT_ALL_IMAGES", "<All images>")
+#define STR_PB_SAVEACOPY NC_("STR_PB_SAVEACOPY", "Save a Copy")
+#define STR_PB_COMPAREDOC NC_("STR_PB_COMPAREDOC", "Compare to")
+#define STR_PB_MERGEDOC NC_("STR_PB_MERGEDOC", "Merge with")
+
+#define STR_SFX_NEWOFFICEDOC NC_("STR_SFX_NEWOFFICEDOC", "%PRODUCTNAME document")
+#define SFX_ST_DURATION_FORMAT NC_("SFX_ST_DURATION_FORMAT", " Y: %1 M: %2 D: %3 H: %4 M: %5 S: %6")
+#define STR_SFX_QUERY_WRONG_TYPE NC_("STR_SFX_QUERY_WRONG_TYPE", "The value entered does not match the specified type.\nThe value will be stored as text.")
+
+#define STR_QUERY_OVERWRITE NC_("STR_QUERY_OVERWRITE", "Style already exists. Overwrite?")
+
+#define STR_RESET NC_("STR_RESET", "~Reset")
+#define STR_TABPAGE_INVALIDNAME NC_("STR_TABPAGE_INVALIDNAME", "This name is already in use.")
+#define STR_TABPAGE_INVALIDSTYLE NC_("STR_TABPAGE_INVALIDSTYLE", "This Style does not exist.")
+#define STR_TABPAGE_INVALIDPARENT NC_("STR_TABPAGE_INVALIDPARENT", "This Style cannot be used as a base Style,\nbecause it would result in a recursive reference.")
+#define STR_POOL_STYLE_NAME NC_("STR_POOL_STYLE_NAME", "Name already exists as a default Style.\nPlease choose another name.")
+#define STR_DELETE_STYLE_USED NC_("STR_DELETE_STYLE_USED", "One or more of the selected styles is in use in this document.\nIf you will delete it, text or objects using these styles will revert to the parent style.\nDo you still wish to delete these styles?\n")
+#define STR_DELETE_STYLE NC_("STR_DELETE_STYLE", "Styles in use: ")
+#define STR_SID_NAVIGATOR NC_("STR_SID_NAVIGATOR", "Navigator")
+#define STR_ERROR_WRONG_CONFIRM NC_("STR_ERROR_WRONG_CONFIRM", "Faulty password confirmation")
+#define STR_PDF_EXPORT_SEND NC_("STR_PDF_EXPORT_SEND", "Send")
+#define STR_FONT_TABPAGE NC_("STR_FONT_TABPAGE", "Font")
+
+#define STR_VIEWVERSIONCOMMENT NC_("STR_VIEWVERSIONCOMMENT", "View Version Comment")
+#define STR_NO_NAME_SET NC_("STR_NO_NAME_SET", "(no name set)")
+
+#define STR_STYLE_FILTER_HIERARCHICAL NC_("STR_STYLE_FILTER_HIERARCHICAL", "Hierarchical")
+
+#define STR_MACRO_LOSS NC_("STR_MACRO_LOSS", "Do you really want to cancel the recording? Any steps recorded up to this point will be lost.")
+#define STR_CANCEL_RECORDING NC_("STR_CANCEL_RECORDING", "Cancel Recording")
+
+#define RID_CNT_STR_WAITING NC_("RID_CNT_STR_WAITING", "The templates are being initialized for first-time usage.")
+
+#define STR_NODEFPRINTER NC_("STR_NODEFPRINTER", "No default printer found.\nPlease choose a printer and try again.")
+#define STR_NOSTARTPRINTER NC_("STR_NOSTARTPRINTER", "Could not start printer.\nPlease check your printer configuration.")
+#define STR_ERROR_PRINTER_BUSY NC_("STR_ERROR_PRINTER_BUSY", "Printer busy")
+#define STR_READONLY NC_("STR_READONLY", " (read-only)")
+#define STR_PRINT_NEWORI NC_("STR_PRINT_NEWORI", "The page size and orientation have been modified.\nWould you like to save the new settings in the\nactive document?")
+#define STR_PRINT_NEWSIZE NC_("STR_PRINT_NEWSIZE", "The page size has been modified.\nShould the new settings be saved\nin the active document?")
+#define STR_PRINT_NEWORISIZE NC_("STR_PRINT_NEWORISIZE", "The page size and orientation have been modified.\nWould you like to save the new settings in the\nactive document?")
+#define STR_CANT_CLOSE NC_("STR_CANT_CLOSE", "The document cannot be closed because a\n print job is being carried out.")
+#define STR_ERROR_SEND_MAIL NC_("STR_ERROR_SEND_MAIL", "An error occurred in sending the message. Possible errors could be a missing user account or a defective setup.\nPlease check the %PRODUCTNAME settings or your email program settings.")
+// Error codes look like "MAPI_E_FAILURE" or "1234"
+#define STR_ERROR_SEND_MAIL_CODE NC_("STR_ERROR_SEND_MAIL_CODE", "An error occurred in sending the message. Possible errors could be a missing user account or a defective setup.\n\nError code is $1")
+#define STR_ERROR_SEND_MAIL_HEADER NC_("STR_ERROR_SEND_MAIL_HEADER", "Error sending mail")
+#define STR_QUERY_OPENASTEMPLATE NC_("STR_QUERY_OPENASTEMPLATE", "This document cannot be edited, possibly due to missing access rights. Do you want to edit a copy of the document?")
+#define STR_QUERY_OPENASTEMPLATE_LOCKED NC_("STR_QUERY_OPENASTEMPLATE_LOCKED", "This document cannot be edited, because it is locked in another session.%LOCKINFO\nDo you want to edit a copy of the document?")
+#define STR_QUERY_OPENASTEMPLATE_ALLOW_IGNORE NC_("STR_QUERY_OPENASTEMPLATE_ALLOW_IGNORE", "You can also try to ignore the lock and open the file for editing.")
+#define STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN NC_("STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN", "Open ~Copy")
+#define STR_QUERY_OPENASTEMPLATE_OPEN_BTN NC_("STR_QUERY_OPENASTEMPLATE_OPEN_BTN", "~Open")
+#define STR_REPAIREDDOCUMENT NC_("STR_REPAIREDDOCUMENT", " (repaired document)")
+#define STR_NONCHECKEDOUT_DOCUMENT NC_("STR_NONCHECKEDOUT_DOCUMENT", "This document is not checked out on the server.")
+#define STR_GET_INVOLVED_TEXT NC_("STR_GET_INVOLVED_TEXT", "Help us make %PRODUCTNAME even better!")
+#define STR_GET_INVOLVED_BUTTON NC_("STR_GET_INVOLVED_BUTTON", "Get involved")
+#define STR_DONATE_TEXT NC_("STR_DONATE_TEXT", "Your donations support our worldwide community.")
+#define STR_DONATE_BUTTON NC_("STR_DONATE_BUTTON", "Donate")
+#define STR_WHATSNEW_TEXT NC_("STR_WHATSNEW", "You are running version %PRODUCTVERSION of %PRODUCTNAME for the first time. Do you want to learn what's new?")
+#define STR_WHATSNEW_BUTTON NC_("STR_WHATSNEW_BUTTON", "Release Notes")
+#define STR_READONLY_DOCUMENT NC_("STR_READONLY_DOCUMENT", "This document is open in read-only mode.")
+#define STR_READONLY_PDF NC_("STR_READONLY_PDF", "This PDF is open in read-only mode to allow signing the existing file.")
+#define STR_CLASSIFIED_DOCUMENT NC_("STR_CLASSIFIED_DOCUMENT", "The classification label of this document is %1.")
+#define STR_TARGET_DOC_NOT_CLASSIFIED NC_("STR_TARGET_DOC_NOT_CLASSIFIED", "This document must be classified before the clipboard can be pasted.")
+#define STR_DOC_CLASSIFICATION_TOO_LOW NC_("STR_DOC_CLASSIFICATION_TOO_LOW", "This document has a lower classification level than the clipboard.")
+#define STR_CLASSIFIED_INTELLECTUAL_PROPERTY NC_("STR_CLASSIFIED_INTELLECTUAL_PROPERTY", "Level")
+#define STR_CLASSIFIED_NATIONAL_SECURITY NC_("STR_CLASSIFIED_NATIONAL_SECURITY", "National Security:")
+#define STR_CLASSIFIED_EXPORT_CONTROL NC_("STR_CLASSIFIED_EXPORT_CONTROL", "Export Control:")
+#define STR_CHECKOUT NC_("STR_CHECKOUT", "Check Out")
+#define STR_READONLY_EDIT NC_("STR_READONLY_EDIT", "Edit Document")
+#define STR_READONLY_SIGN NC_("STR_READONLY_SIGN", "Sign Document")
+#define STR_READONLY_FINISH_SIGN NC_("STR_READONLY_FINISH_SIGN", "Finish Signing")
+#define STR_SIGNATURE_BROKEN NC_("STR_SIGNATURE_BROKEN", "This document has an invalid signature.")
+#define STR_SIGNATURE_INVALID NC_("STR_SIGNATURE_INVALID", "The signature was valid, but the document has been modified")
+#define STR_SIGNATURE_NOTVALIDATED NC_("STR_SIGNATURE_NOTVALIDATED", "At least one signature has problems: the certificate could not be validated.")
+#define STR_SIGNATURE_PARTIAL_OK NC_("STR_SIGNATURE_PARTIAL_OK", "At least one signature has problems: the document is only partially signed.")
+#define STR_SIGNATURE_NOTVALIDATED_PARTIAL_OK NC_("STR_SIGNATURE_NOTVALIDATED_PARTIAL_OK", "The certificate could not be validated and the document is only partially signed.")
+#define STR_SIGNATURE_OK NC_("STR_SIGNATURE_OK", "This document is digitally signed and the signature is valid.")
+#define STR_SIGNATURE_SHOW NC_("STR_SIGNATURE_SHOW", "Show Signatures")
+#define STR_TRACK_CHANGES_BUTTON NC_("STR_TRACK_CHANGES_BUTTON", "Show Toolbar")
+#define STR_TRACK_CHANGES_BUTTON_HIDE NC_("STR_TRACK_CHANGES_BUTTON_HIDE", "Hide Toolbar")
+#define STR_HYPHENATION_BUTTON NC_("STR_HYPHENATION_BUTTON", "Learn more")
+#define STR_REFRESH_MASTER_PASSWORD NC_("STR_REFRESH_MASTER_PASSWORD", "The master password is stored in an outdated format, you should refresh it")
+#define STR_REFRESH_PASSWORD NC_("STR_REFRESH_PASSWORD", "Refresh Password")
+
+// Translators: default Impress template names
+#define STR_TEMPLATE_NAME1 NC_("STR_TEMPLATE_NAME1", "Grey Elegant")
+#define STR_TEMPLATE_NAME2 NC_("STR_TEMPLATE_NAME2", "Beehive")
+#define STR_TEMPLATE_NAME3 NC_("STR_TEMPLATE_NAME3", "Blue Curve")
+#define STR_TEMPLATE_NAME4 NC_("STR_TEMPLATE_NAME4", "Blueprint Plans")
+#define STR_TEMPLATE_NAME5 NC_("STR_TEMPLATE_NAME5", "Candy")
+#define STR_TEMPLATE_NAME6 NC_("STR_TEMPLATE_NAME6", "Yellow Idea")
+#define STR_TEMPLATE_NAME7 NC_("STR_TEMPLATE_NAME7", "DNA")
+#define STR_TEMPLATE_NAME8 NC_("STR_TEMPLATE_NAME8", "Focus")
+#define STR_TEMPLATE_NAME9 NC_("STR_TEMPLATE_NAME9", "Forestbird")
+#define STR_TEMPLATE_NAME10 NC_("STR_TEMPLATE_NAME10", "Freshes")
+#define STR_TEMPLATE_NAME11 NC_("STR_TEMPLATE_NAME11", "Inspiration")
+#define STR_TEMPLATE_NAME12 NC_("STR_TEMPLATE_NAME12", "Lights")
+#define STR_TEMPLATE_NAME13 NC_("STR_TEMPLATE_NAME13", "Growing Liberty")
+#define STR_TEMPLATE_NAME14 NC_("STR_TEMPLATE_NAME14", "Metropolis")
+#define STR_TEMPLATE_NAME15 NC_("STR_TEMPLATE_NAME15", "Midnightblue")
+#define STR_TEMPLATE_NAME16 NC_("STR_TEMPLATE_NAME16", "Nature Illustration")
+#define STR_TEMPLATE_NAME17 NC_("STR_TEMPLATE_NAME17", "Pencil")
+#define STR_TEMPLATE_NAME18 NC_("STR_TEMPLATE_NAME18", "Piano")
+#define STR_TEMPLATE_NAME19 NC_("STR_TEMPLATE_NAME19", "Portfolio")
+#define STR_TEMPLATE_NAME20 NC_("STR_TEMPLATE_NAME20", "Progress")
+#define STR_TEMPLATE_NAME21 NC_("STR_TEMPLATE_NAME21", "Sunset")
+#define STR_TEMPLATE_NAME22 NC_("STR_TEMPLATE_NAME22", "Vintage")
+#define STR_TEMPLATE_NAME23 NC_("STR_TEMPLATE_NAME23", "Vivid")
+// Translators: default Writer template names
+#define STR_TEMPLATE_NAME24 NC_("STR_TEMPLATE_NAME24", "CV")
+#define STR_TEMPLATE_NAME25 NC_("STR_TEMPLATE_NAME25", "Resume")
+#define STR_TEMPLATE_NAME26 NC_("STR_TEMPLATE_NAME26", "Default")
+#define STR_TEMPLATE_NAME27 NC_("STR_TEMPLATE_NAME27", "Modern")
+#define STR_TEMPLATE_NAME28 NC_("STR_TEMPLATE_NAME28", "Modern business letter sans-serif")
+#define STR_TEMPLATE_NAME29 NC_("STR_TEMPLATE_NAME29", "Modern business letter serif")
+#define STR_TEMPLATE_NAME30 NC_("STR_TEMPLATE_NAME30", "Businesscard with logo")
+#define STR_TEMPLATE_NAME31 NC_("STR_TEMPLATE_NAME31", "Simple")
+#define STR_TEMPLATE_NAME32 NC_("STR_TEMPLATE_NAME32", "BPMN")
+
+#define STR_CLEAR_CHAR NC_("STR_CLEAR_CHAR", "Remove")
+#define STR_CLEAR_ALL_CHAR NC_("STR_CLEAR_ALL_CHAR", "Clear All")
+
+#define STR_PASSWORD_LEN NC_("STR_PASSWORD_LEN", "Password length")
+#define STR_PASSWORD_WARNING NC_("STR_PASSWORD_WARNING", "The password you have entered causes interoperability issues. Please enter a password that is shorter than 52 bytes, or longer than 55 bytes.")
+
+#define STR_CTRLCLICKHYPERLINK NC_("STR_CTRLCLICKHYPERLINK", "%{key}-click to open hyperlink: %{link}")
+#define STR_CLICKHYPERLINK NC_("STR_CLICKHYPERLINK", "Click to open hyperlink: %{link}")
+
+#define STR_STYLEUSEDBY NC_("STR_STYLEUSEDBY", "(used by: %STYLELIST)")
+
+#define STR_DOCUMENT NC_("STR_DOCUMENT", "Document")
+#define STR_SPREADSHEET NC_("STR_SPREADSHEET", "Spreadsheet")
+#define STR_PRESENTATION NC_("STR_PRESENTATION", "Presentation")
+#define STR_DRAWING NC_("STR_DRAWING", "Drawing")
+#define STR_RECENT NC_("STR_RECENT", "Recently used")
+#define STR_NORECENT NC_("STR_NORECENT", "No recent characters")
+
+#define STR_ACTION_RESET_ALL_DEFAULT_TEMPLATES NC_("STR_ACTION_RESET_ALL_DEFAULT_TEMPLATES","Reset All De~fault Templates")
+#define STR_ACTION_RESET_WRITER_TEMPLATE NC_("STR_ACTION_RESET_WRITER_TEMPLATE","Reset De~fault Text Document")
+#define STR_ACTION_RESET_CALC_TEMPLATE NC_("STR_ACTION_RESET_CALC_TEMPLATE","Reset De~fault Spreadsheet")
+#define STR_ACTION_RESET_IMPRESS_TEMPLATE NC_("STR_ACTION_RESET_IMPRESS_TEMPLATE","Reset De~fault Presentation")
+#define STR_ACTION_RESET_DRAW_TEMPLATE NC_("STR_ACTION_RESET_DRAW_TEMPLATE","Reset De~fault Drawing")
+#define STR_ACTION_IMPORT NC_("STR_ACTION_IMPORT","~Import")
+#define STR_ACTION_EXTENSIONS NC_("STR_ACTION_EXTENSIONS","E~xtensions")
+#define STR_WINDOW_TITLE_RENAME_TEMPLATE NC_("STR_WINDOW_TITLE_RENAME_TEMPLATE","Rename")
+#define STR_WINDOW_TITLE_RENAME_CATEGORY NC_("STR_WINDOW_TITLE_RENAME_CATEGORY","Rename Category")
+#define STR_WINDOW_TITLE_RENAME_NEW_CATEGORY NC_("STR_WINDOW_TITLE_RENAME_NEW_CATEGORY","New Category")
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/styfitem.hxx b/include/sfx2/styfitem.hxx
new file mode 100644
index 000000000..dc2efd88c
--- /dev/null
+++ b/include/sfx2/styfitem.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_STYFITEM_HXX
+#define INCLUDED_SFX2_STYFITEM_HXX
+
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <svl/style.hxx>
+#include <unotools/resmgr.hxx>
+#include <vector>
+
+struct SFX2_DLLPUBLIC SfxFilterTuple
+{
+ OUString aName;
+ SfxStyleSearchBits nFlags;
+ SfxFilterTuple(const OUString& rName, SfxStyleSearchBits nArg)
+ : aName(rName)
+ , nFlags(nArg)
+ {
+ }
+};
+
+typedef std::vector<SfxFilterTuple> SfxStyleFilter;
+
+class SFX2_DLLPUBLIC SfxStyleFamilyItem
+{
+ SfxStyleFamily nFamily;
+ OUString aText;
+ OUString aImage;
+ SfxStyleFilter aFilterList;
+
+public:
+ SfxStyleFamilyItem(SfxStyleFamily nFamily, const OUString &rName, const OUString& rImage, const std::pair<TranslateId, SfxStyleSearchBits>* pStringArray, const std::locale& rLocale);
+
+ const OUString& GetText() const { return aText; }
+ SfxStyleFamily GetFamily() const { return nFamily; }
+ const SfxStyleFilter& GetFilterList() const { return aFilterList; }
+ const OUString& GetImage() const { return aImage; }
+};
+
+using SfxStyleFamilies = std::vector<SfxStyleFamilyItem>;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/styledlg.hxx b/include/sfx2/styledlg.hxx
new file mode 100644
index 000000000..6fd7afde1
--- /dev/null
+++ b/include/sfx2/styledlg.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_STYLEDLG_HXX
+#define INCLUDED_SFX2_STYLEDLG_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/tabdlg.hxx>
+
+class SfxStyleSheetBase;
+class SfxStyleSheetBasePool;
+enum class SfxStyleFamily;
+
+class SFX2_DLLPUBLIC SfxStyleDialogController : public SfxTabDialogController
+{
+private:
+ SfxStyleSheetBase& m_rStyle;
+ DECL_DLLPRIVATE_LINK(CancelHdl, weld::Button&, void);
+
+public:
+ SfxStyleDialogController(weld::Window* pParent,
+ const OUString& rUIXMLDescription, const OString& rID, SfxStyleSheetBase&);
+
+ virtual ~SfxStyleDialogController() override;
+
+ SfxStyleSheetBase& GetStyleSheet() { return m_rStyle; }
+ const SfxStyleSheetBase& GetStyleSheet() const { return m_rStyle; }
+
+ virtual short Ok() override;
+
+ static OUString GenerateUnusedName(SfxStyleSheetBasePool &rPool, SfxStyleFamily eFam);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
new file mode 100644
index 000000000..4c519964e
--- /dev/null
+++ b/include/sfx2/tabdlg.hxx
@@ -0,0 +1,269 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_TABDLG_HXX
+#define INCLUDED_SFX2_TABDLG_HXX
+
+#include <memory>
+#include <unordered_map>
+#include <string_view>
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/basedlgs.hxx>
+#include <sal/types.h>
+#include <vcl/bitmapex.hxx>
+#include <vcl/builderpage.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/setitem.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+class SfxTabPage;
+
+typedef std::unique_ptr<SfxTabPage> (*CreateTabPage)(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rAttrSet);
+typedef WhichRangesContainer (*GetTabPageRanges)(); // provides international Which-value
+struct TabPageImpl;
+
+struct TabDlg_Impl;
+
+namespace com::sun::star::frame { class XFrame; }
+
+#define RET_USER 100
+#define RET_USER_CANCEL 101
+
+class SFX2_DLLPUBLIC SfxTabDialogItem final : public SfxSetItem
+{
+public:
+ SfxTabDialogItem( sal_uInt16 nId, const SfxItemSet& rItemSet );
+ SfxTabDialogItem(const SfxTabDialogItem& rAttr, SfxItemPool* pItemPool);
+ virtual SfxTabDialogItem* Clone(SfxItemPool* pToPool = nullptr) const override;
+};
+
+class SFX2_DLLPUBLIC SfxTabDialogController : public SfxOkDialogController
+{
+protected:
+ std::unique_ptr<weld::Notebook> m_xTabCtrl;
+
+ DECL_LINK(OkHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(ResetHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(BaseFmtHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(UserHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(CancelHdl, weld::Button&, void);
+private:
+ std::unique_ptr<weld::Button> m_xOKBtn;
+ std::unique_ptr<weld::Button> m_xApplyBtn;
+ std::unique_ptr<weld::Button> m_xUserBtn;
+ std::unique_ptr<weld::Button> m_xCancelBtn;
+ std::unique_ptr<weld::Button> m_xResetBtn;
+ std::unique_ptr<weld::Button> m_xBaseFmtBtn;
+ std::unique_ptr<weld::SizeGroup> m_xSizeGroup;
+
+ std::unique_ptr<SfxItemSet> m_pSet;
+ std::unique_ptr<SfxItemSet> m_pOutSet;
+ std::unique_ptr<TabDlg_Impl> m_pImpl;
+ WhichRangesContainer m_pRanges;
+ OString m_sAppPageId;
+ bool m_bStandardPushed;
+ std::unique_ptr<SfxAllItemSet> m_xItemSet;
+
+ DECL_DLLPRIVATE_LINK(ActivatePageHdl, const OString&, void);
+ DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OString&, bool);
+ SAL_DLLPRIVATE void Start_Impl();
+ SAL_DLLPRIVATE void CreatePages();
+ SAL_DLLPRIVATE void setPreviewsToSamePlace();
+
+protected:
+ virtual short Ok();
+ virtual void RefreshInputSet();
+ virtual SfxItemSet* CreateInputItemSet(const OString& rName);
+ virtual void PageCreated(const OString &rName, SfxTabPage &rPage);
+
+ std::unique_ptr<SfxItemSet> m_xExampleSet;
+ SfxItemSet* GetInputSetImpl();
+ SfxTabPage* GetTabPage(std::string_view rPageId) const;
+
+ /** prepare to leave the current page. Calls the DeactivatePage method of the current page, (if necessary),
+ handles the item sets to copy.
+ @return sal_True if it is allowed to leave the current page, sal_False otherwise
+ */
+ bool PrepareLeaveCurrentPage();
+
+ /** save the position of the TabDialog and which tab page is the currently active one
+ */
+ void SavePosAndId();
+public:
+ SfxTabDialogController(weld::Widget* pParent, const OUString& rUIXMLDescription, const OString& rID,
+ const SfxItemSet * = nullptr, bool bEditFmt = false);
+ virtual ~SfxTabDialogController() override;
+
+ void AddTabPage(const OString& rName, // Name of the label for the existing page in the notebook .ui
+ CreateTabPage pCreateFunc, // != 0
+ GetTabPageRanges pRangesFunc); // can be 0
+
+ void AddTabPage(const OString& rName, // Name of the label for the existing page in the notebook .ui
+ sal_uInt16 nPageCreateId); // Identifier of the Factory Method to create the page
+
+ void AddTabPage(const OString& rName, // Name of the label for the new page to create
+ const OUString& rLabel, // UI Label for the new page to create
+ CreateTabPage pCreateFunc); // != 0
+
+ void AddTabPage(const OString& rName, // Name of the label for the new page to create
+ const OUString& rLabel, // UI Label for the new page to create
+ sal_uInt16 nPageCreateId); // Identifier of the Factory Method to create the page
+
+ void RemoveTabPage( const OString& rName ); // Name of the label for the page in the notebook .ui
+
+ void SetCurPageId(const OString& rName);
+ void ShowPage(const OString& rName); // SetCurPageId + call Activate on it
+ OString GetCurPageId() const;
+ SfxTabPage* GetCurTabPage() const { return GetTabPage(GetCurPageId()); }
+
+ // may provide local slots converted by Map
+ const WhichRangesContainer& GetInputRanges( const SfxItemPool& );
+ void SetInputSet( const SfxItemSet* pInSet );
+ const SfxItemSet* GetOutputItemSet() const { return m_pOutSet.get(); }
+
+ virtual weld::Button& GetOKButton() const override { return *m_xOKBtn; }
+ weld::Button& GetCancelButton() const { return *m_xCancelBtn; }
+ weld::Button* GetUserButton() const { return m_xUserBtn.get(); }
+ weld::Button* GetStandardButton() const { return m_xBaseFmtBtn.get(); }
+ weld::Button* GetApplyButton() const { return m_xApplyBtn.get(); }
+ weld::Button* GetResetButton() const { return m_xResetBtn.get(); }
+ void RemoveResetButton();
+ void RemoveStandardButton();
+
+ virtual short run() override;
+ static bool runAsync(const std::shared_ptr<SfxTabDialogController>& rController,
+ const std::function<void(sal_Int32)>&);
+
+ virtual const SfxItemSet* GetExampleSet() const override { return m_xExampleSet.get(); }
+
+ void SetApplyHandler(const Link<weld::Button&,void>& _rHdl);
+
+ //calls Ok without closing dialog
+ bool Apply();
+ void Applied() { m_xExampleSet->Put(*GetInputSetImpl()); }
+
+ //screenshotting
+ std::vector<OString> getAllPageUIXMLDescriptions() const;
+ bool selectPageByUIXMLDescription(const OString& rUIXMLDescription);
+ BitmapEx createScreenshot() const;
+ OString GetScreenshotId() const;
+};
+
+enum class DeactivateRC {
+ KeepPage = 0x00, // Error handling; page does not change
+ // 2. Fill an itemset for update
+ // parent examples, this pointer can be NULL all the time!
+ LeavePage = 0x01,
+ // Set, refresh and update other Page
+ RefreshSet = 0x02
+};
+namespace o3tl {
+ template<> struct typed_flags<DeactivateRC> : is_typed_flags<DeactivateRC, 0x03> {};
+}
+
+class SFX2_DLLPUBLIC SfxTabPage : public BuilderPage
+{
+friend class SfxTabDialog;
+friend class SfxTabDialogController;
+
+private:
+ const SfxItemSet* pSet;
+ OUString aUserString;
+ bool bHasExchangeSupport;
+ std::unordered_map<OString, css::uno::Any> maAdditionalProperties;
+
+ std::unique_ptr< TabPageImpl > pImpl;
+
+protected:
+ SfxTabPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet *rAttrSet);
+
+ sal_uInt16 GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const
+ { return pSet->GetPool()->GetWhich( nSlot, bDeep ); }
+ template<class T>
+ TypedWhichId<T> GetWhich( TypedWhichId<T> nSlot, bool bDeep = true ) const
+ {
+ return TypedWhichId<T>(GetWhich(sal_uInt16(nSlot), bDeep));
+ }
+
+ const SfxPoolItem* GetOldItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true );
+ template<class T> const T* GetOldItem( const SfxItemSet& rSet, TypedWhichId<T> nSlot, bool bDeep = true )
+ {
+ return static_cast<const T*>(GetOldItem(rSet, sal_uInt16(nSlot), bDeep));
+ }
+
+ SfxOkDialogController* GetDialogController() const;
+public:
+ void SetDialogController(SfxOkDialogController* pDialog);
+public:
+ virtual ~SfxTabPage() override;
+
+ void set_visible(bool bVisible)
+ {
+ m_xContainer->set_visible(bVisible);
+ }
+
+ const SfxItemSet& GetItemSet() const { return *pSet; }
+
+ virtual bool FillItemSet( SfxItemSet* );
+ virtual void Reset( const SfxItemSet* );
+ // Allows to postpone some initialization to the first activation
+ virtual bool DeferResetToFirstActivation();
+
+ bool HasExchangeSupport() const
+ { return bHasExchangeSupport; }
+ void SetExchangeSupport()
+ { bHasExchangeSupport = true; }
+
+ virtual void ActivatePage( const SfxItemSet& );
+ virtual DeactivateRC DeactivatePage( SfxItemSet* pSet );
+ void SetUserData(const OUString& rString)
+ { aUserString = rString; }
+ const OUString& GetUserData() const { return aUserString; }
+ virtual void FillUserData();
+ virtual bool IsReadOnly() const;
+ virtual void PageCreated (const SfxAllItemSet& aSet);
+ virtual void ChangesApplied();
+ static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true );
+ template<class T> static const T* GetItem( const SfxItemSet& rSet, TypedWhichId<T> nSlot, bool bDeep = true )
+ {
+ return static_cast<const T*>(GetItem(rSet, sal_uInt16(nSlot), bDeep));
+ }
+
+ void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame);
+ css::uno::Reference< css::frame::XFrame > GetFrame() const;
+
+ const SfxItemSet* GetDialogExampleSet() const;
+
+ OString GetHelpId() const;
+ OString GetConfigId() const { return GetHelpId(); }
+ bool IsVisible() const { return m_xContainer->get_visible(); }
+
+ weld::Window* GetFrameWeld() const;
+
+ std::unordered_map<OString, css::uno::Any>& getAdditionalProperties()
+ {
+ return maAdditionalProperties;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
new file mode 100644
index 000000000..e3953c4e5
--- /dev/null
+++ b/include/sfx2/tbxctrl.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_TBXCTRL_HXX
+#define INCLUDED_SFX2_TBXCTRL_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <svl/poolitem.hxx>
+#include <svtools/toolboxcontroller.hxx>
+#include <rtl/ref.hxx>
+#include <vcl/vclptr.hxx>
+
+namespace com::sun::star::frame { class XDispatchProvider; }
+namespace com::sun::star::frame { class XFrame; }
+namespace vcl { class Window; }
+namespace com::sun::star::frame { class XToolbarController; }
+
+class InterimItemWindow;
+class SfxToolBoxControl;
+class SfxModule;
+
+rtl::Reference<svt::ToolboxController> SfxToolBoxControllerFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolbox, ToolBoxItemId nID, const OUString& aCommandURL );
+
+typedef rtl::Reference<SfxToolBoxControl> (*SfxToolBoxControlCtor)( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rBox );
+
+struct SfxTbxCtrlFactory
+{
+ SfxToolBoxControlCtor pCtor;
+ const std::type_info& nTypeId;
+ sal_uInt16 nSlotId;
+
+ SfxTbxCtrlFactory( SfxToolBoxControlCtor pTheCtor,
+ const std::type_info& nTheTypeId, sal_uInt16 nTheSlotId ):
+ pCtor(pTheCtor),
+ nTypeId(nTheTypeId),
+ nSlotId(nTheSlotId)
+ {}
+};
+
+
+#define SFX_DECL_TOOLBOX_CONTROL() \
+ static rtl::Reference<SfxToolBoxControl> CreateImpl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx ); \
+ static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=nullptr)
+
+/* For special ToolBox controls, such as a font selection box or toolbox
+ tear-off floating windows, an appropriate Item-Subclass of SfxTooBoxControl
+ has to be implemented.
+
+ This class has to be registered in SfxApplication:Init() with the static
+ control method RegisterControl(). The SFx then automatically creates these
+ controls in the toolbox, if the associated slots are of the specific type.
+ */
+
+struct SfxToolBoxControl_Impl;
+class SFX2_DLLPUBLIC SfxToolBoxControl: public svt::ToolboxController
+{
+friend struct SfxTbxCtrlFactory;
+
+ std::unique_ptr< SfxToolBoxControl_Impl> pImpl;
+
+protected:
+ // old SfxToolBoxControl methods
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual void Select( sal_uInt16 nSelectModifier );
+
+ virtual void DoubleClick();
+ virtual void Click();
+ virtual void CreatePopupWindow();
+ virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window *pParent);
+
+public:
+ // XComponent
+ virtual void SAL_CALL dispose() override;
+
+ // new controller API
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) override;
+ virtual void SAL_CALL click() override;
+ virtual void SAL_CALL doubleClick() override;
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override;
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& rParent ) override;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SfxToolBoxControl( sal_uInt16 nSlotID, ToolBoxItemId nId, ToolBox& rBox, bool bShowStrings = false );
+ virtual ~SfxToolBoxControl() override;
+
+ ToolBox& GetToolBox() const;
+ ToolBoxItemId GetId() const;
+ unsigned short GetSlotId() const;
+
+ void Dispatch( const OUString& aCommand,
+ css::uno::Sequence< css::beans::PropertyValue > const & aArgs );
+ static void Dispatch( const css::uno::Reference< css::frame::XDispatchProvider >& rDispatchProvider,
+ const OUString& rCommand,
+ css::uno::Sequence< css::beans::PropertyValue > const & aArgs );
+
+ static SfxItemState GetItemState( const SfxPoolItem* pState );
+ static rtl::Reference<SfxToolBoxControl> CreateControl( sal_uInt16 nSlotId, ToolBoxItemId nTbxId, ToolBox *pBox, SfxModule const *pMod );
+ static void RegisterToolBoxControl( SfxModule*, const SfxTbxCtrlFactory&);
+};
+
+#define SFX_IMPL_TOOLBOX_CONTROL(Class, nItemClass) \
+ rtl::Reference<SfxToolBoxControl> Class::CreateImpl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx ) \
+ { return new Class( nSlotId, nId, rTbx ); } \
+ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \
+ { SfxToolBoxControl::RegisterToolBoxControl( pMod, SfxTbxCtrlFactory( \
+ Class::CreateImpl, typeid(nItemClass), nSlotId ) ); }
+
+#define SFX_IMPL_TOOLBOX_CONTROL_ARG(Class, nItemClass, Arg) \
+ rtl::Reference<SfxToolBoxControl> Class::CreateImpl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx ) \
+ { return new Class( nSlotId, nId, rTbx, Arg); } \
+ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \
+ { SfxToolBoxControl::RegisterToolBoxControl( pMod, SfxTbxCtrlFactory( \
+ Class::CreateImpl, typeid(nItemClass), nSlotId ) ); }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx
new file mode 100644
index 000000000..10d3107fc
--- /dev/null
+++ b/include/sfx2/templatedlg.hxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_INC_TEMPLATEDLG_HXX
+#define INCLUDED_SFX2_INC_TEMPLATEDLG_HXX
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+
+#include <set>
+#include <string_view>
+
+#include <vcl/idle.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/weld.hxx>
+
+#include <sfx2/templatedlglocalview.hxx>
+
+class ThumbnailViewItem;
+
+namespace com
+{
+namespace sun::star::frame
+{
+class XDesktop2;
+class XModel;
+}
+}
+
+class SFX2_DLLPUBLIC SfxTemplateManagerDlg : public weld::GenericDialogController
+{
+ typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*, const ThumbnailViewItem*);
+
+public:
+ SfxTemplateManagerDlg(weld::Window* parent);
+
+ virtual ~SfxTemplateManagerDlg() override;
+ virtual short run() override;
+
+ void setDocumentModel(const css::uno::Reference<css::frame::XModel>& rModel);
+ void setTemplateViewMode(TemplateViewMode eViewMode);
+ TemplateViewMode getTemplateViewMode() const;
+
+protected:
+ void getApplicationSpecificSettings();
+
+ void readSettings();
+
+ void writeSettings();
+
+ void fillFolderComboBox();
+
+ DECL_DLLPRIVATE_LINK(SelectApplicationHdl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(SelectRegionHdl, weld::ComboBox&, void);
+
+ DECL_DLLPRIVATE_LINK(OkClickHdl, weld::Button&, void);
+ void ImportActionHdl();
+ static void ExtensionsActionHdl();
+
+ DECL_DLLPRIVATE_LINK(TVItemStateHdl, const ThumbnailViewItem*, void);
+
+ DECL_DLLPRIVATE_LINK(MenuSelectHdl, const OString&, void);
+ void DefaultTemplateMenuSelectHdl(std::string_view rIdent);
+
+ DECL_DLLPRIVATE_LINK(OpenRegionHdl, void*, void);
+ DECL_DLLPRIVATE_LINK(CreateContextMenuHdl, ThumbnailViewItem*, void);
+ DECL_DLLPRIVATE_LINK(OpenTemplateHdl, ThumbnailViewItem*, void);
+ DECL_DLLPRIVATE_LINK(EditTemplateHdl, ThumbnailViewItem*, void);
+ DECL_DLLPRIVATE_LINK(DeleteTemplateHdl, void*, void);
+ DECL_DLLPRIVATE_LINK(DefaultTemplateHdl, ThumbnailViewItem*, void);
+ DECL_DLLPRIVATE_LINK(MoveTemplateHdl, void*, void);
+ DECL_DLLPRIVATE_LINK(ExportTemplateHdl, void*, void);
+
+ void SearchUpdate();
+
+ DECL_DLLPRIVATE_LINK(SearchUpdateHdl, weld::Entry&, void);
+ DECL_DLLPRIVATE_LINK(GetFocusHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(LoseFocusHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(ImplUpdateDataHdl, Timer*, void);
+ DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool);
+
+ DECL_DLLPRIVATE_LINK(ListViewHdl, weld::Toggleable&, void);
+ DECL_DLLPRIVATE_LINK(ThumbnailViewHdl, weld::Toggleable&, void);
+ DECL_DLLPRIVATE_LINK(FocusRectLocalHdl, weld::Widget&, tools::Rectangle);
+
+ void OnTemplateImportCategory(std::u16string_view sCategory);
+ // static void OnTemplateLink ();
+ void OnTemplateOpen();
+ void OnTemplateExport();
+
+ void OnTemplateState(const ThumbnailViewItem* pItem);
+
+ void OnCategoryNew();
+ void OnCategoryRename();
+ void OnCategoryDelete();
+
+ void updateMenuItems();
+
+ /**
+ *
+ * Move templates stored in the filesystem to another folder.
+ *
+ **/
+
+ void localMoveTo(sal_uInt16 nMenuId);
+
+ /// Return filter according to the currently selected application filter.
+ FILTER_APPLICATION getCurrentApplicationFilter() const;
+
+protected:
+ std::set<const ThumbnailViewItem*, selection_cmp_fn> maSelTemplates;
+ css::uno::Reference<css::frame::XModel> m_xModel;
+ css::uno::Reference<css::frame::XDesktop2> mxDesktop;
+
+ Timer m_aUpdateDataTimer;
+
+ std::unique_ptr<weld::Entry> mxSearchFilter;
+ std::unique_ptr<weld::ComboBox> mxCBApp;
+ std::unique_ptr<weld::ComboBox> mxCBFolder;
+
+ std::unique_ptr<weld::Button> mxOKButton;
+ std::unique_ptr<weld::CheckButton> mxCBXHideDlg;
+ std::unique_ptr<weld::MenuButton> mxActionBar;
+ std::unique_ptr<TemplateDlgLocalView> mxLocalView;
+ std::unique_ptr<weld::Menu> mxTemplateDefaultMenu;
+ std::unique_ptr<weld::CustomWeld> mxLocalViewWeld;
+ std::unique_ptr<weld::Toggleable> mxListViewButton;
+ std::unique_ptr<weld::Toggleable> mxThumbnailViewButton;
+ TemplateViewMode mViewMode;
+ bool bMakeSelItemVisible;
+};
+
+// class SfxTemplateCategoryDialog -------------------------------------------------------------------
+
+class SfxTemplateCategoryDialog final : public weld::GenericDialogController
+{
+private:
+ OUString msSelectedCategory;
+ bool mbIsNewCategory;
+
+ std::unique_ptr<weld::TreeView> mxLBCategory;
+ std::unique_ptr<weld::Label> mxSelectLabel;
+ std::unique_ptr<weld::Entry> mxNewCategoryEdit;
+ std::unique_ptr<weld::Label> mxCreateLabel;
+ std::unique_ptr<weld::Button> mxOKButton;
+
+public:
+ DECL_LINK(NewCategoryEditHdl, weld::Entry&, void);
+ DECL_LINK(SelectCategoryHdl, weld::TreeView&, void);
+
+ void SetCategoryLBEntries(std::vector<OUString> names);
+
+ const OUString& GetSelectedCategory() const { return msSelectedCategory; };
+
+ bool IsNewCategoryCreated() const { return mbIsNewCategory; }
+
+public:
+ explicit SfxTemplateCategoryDialog(weld::Window* pParent);
+
+ virtual ~SfxTemplateCategoryDialog() override;
+};
+
+// class SfxTemplateSelectionDialog -------------------------------------------------------------------
+
+class SFX2_DLLPUBLIC SfxTemplateSelectionDlg final : public SfxTemplateManagerDlg
+{
+public:
+ SfxTemplateSelectionDlg(weld::Window* parent);
+
+ virtual ~SfxTemplateSelectionDlg() override;
+ virtual short run() override;
+
+ OUString const& getTemplatePath() const { return msTemplatePath; };
+ bool IsStartWithTemplate() const { return mxCBXHideDlg->get_active(); };
+
+private:
+ DECL_DLLPRIVATE_LINK(OpenTemplateHdl, ThumbnailViewItem*, void);
+ DECL_DLLPRIVATE_LINK(OkClickHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(TimeOut, Timer*, void);
+
+ OUString msTemplatePath;
+ Idle maIdle;
+};
+
+#endif // INCLUDED_SFX2_INC_TEMPLATEDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templatedlglocalview.hxx b/include/sfx2/templatedlglocalview.hxx
new file mode 100644
index 000000000..65b77ead1
--- /dev/null
+++ b/include/sfx2/templatedlglocalview.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <sfx2/templatelocalview.hxx>
+#include <sfx2/listview.hxx>
+
+class TemplateDlgLocalView final : public TemplateLocalView, public ListView
+{
+public:
+ TemplateDlgLocalView(std::unique_ptr<weld::ScrolledWindow> xWindow,
+ std::unique_ptr<weld::Menu> xMenu,
+ std::unique_ptr<weld::TreeView> xTreeView);
+
+ void setTemplateViewMode(TemplateViewMode eMode);
+
+ virtual void showAllTemplates() override;
+
+ void showRegion(TemplateContainerItem const* pItem);
+
+ void showRegion(std::u16string_view rName);
+
+ void reload();
+
+ virtual bool KeyInput(const KeyEvent& rKEvt) override;
+
+ void createContextMenu(const bool bIsDefault, const bool bIsBuiltIn, const bool bIsSingleSel,
+ const OUString& rDefaultImg);
+
+ virtual void Show() override;
+
+ virtual void Hide() override;
+
+ bool IsVisible() const;
+
+ void connect_focus_rect(const Link<weld::Widget&, tools::Rectangle>& rLink)
+ {
+ GetDrawingArea()->connect_focus_rect(rLink);
+ }
+
+ void MakeItemVisible(sal_uInt16 nId) { ThumbnailView::MakeItemVisible(nId); }
+
+ void insertItems(const std::vector<TemplateItemProperties>& rTemplates, bool isRegionSelected,
+ bool bShowCategoryInTooltip);
+
+private:
+ void ContextMenuSelectHdl(std::string_view rIdent);
+
+ void insertFilteredItems();
+
+ void syncCursor();
+
+ void updateSelection();
+
+ DECL_LINK(RowActivatedHdl, weld::TreeView&, bool);
+
+ DECL_LINK(ListViewChangedHdl, weld::TreeView&, void);
+
+ DECL_LINK(PopupMenuHdl, const CommandEvent&, bool);
+
+ DECL_LINK(KeyPressHdl, const KeyEvent&, bool);
+
+ TemplateViewMode mViewMode;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx
new file mode 100644
index 000000000..020ad2ba3
--- /dev/null
+++ b/include/sfx2/templatelocalview.hxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_TEMPLATELOCALVIEW_HXX
+#define INCLUDED_SFX2_TEMPLATELOCALVIEW_HXX
+
+#include <sfx2/thumbnailview.hxx>
+#include <sfx2/templateproperties.hxx>
+#include <functional>
+#include <memory>
+#include <set>
+
+//template thumbnail item defines
+#define TEMPLATE_ITEM_MAX_WIDTH 160
+#define TEMPLATE_ITEM_MAX_HEIGHT 148
+#define TEMPLATE_ITEM_PADDING 5
+#define TEMPLATE_ITEM_MAX_TEXT_LENGTH 20
+#define TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT 96
+
+//template thumbnail height with a subtitle
+#define TEMPLATE_ITEM_MAX_HEIGHT_SUB 160
+
+//template thumbnail image defines
+#define TEMPLATE_THUMBNAIL_MAX_HEIGHT TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT - 2*TEMPLATE_ITEM_PADDING
+#define TEMPLATE_THUMBNAIL_MAX_WIDTH TEMPLATE_ITEM_MAX_WIDTH - 2*TEMPLATE_ITEM_PADDING
+
+class SfxDocumentTemplates;
+class TemplateContainerItem;
+class TemplateViewItem;
+
+enum class FILTER_APPLICATION
+{
+ NONE,
+ WRITER,
+ CALC,
+ IMPRESS,
+ DRAW
+};
+
+// Display template items depending on the generator application
+class ViewFilter_Application final
+{
+public:
+
+ ViewFilter_Application (FILTER_APPLICATION App)
+ : mApp(App)
+ {}
+
+ bool operator () (const ThumbnailViewItem *pItem);
+
+ static bool isFilteredExtension(FILTER_APPLICATION filter, std::u16string_view rExt);
+ bool isValid (std::u16string_view rPath) const;
+
+private:
+
+ FILTER_APPLICATION mApp;
+};
+
+class TemplateLocalView : public ThumbnailView
+{
+ typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*);
+
+public:
+
+ TemplateLocalView(std::unique_ptr<weld::ScrolledWindow> xWindow,
+ std::unique_ptr<weld::Menu> xMenu);
+
+ virtual ~TemplateLocalView () override;
+
+ // Fill view with new item list
+ void insertItems (const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected = true, bool bShowCategoryInTooltip = false);
+
+ // Fill view with template folders thumbnails
+ void Populate ();
+
+ void reload ();
+
+ virtual void showAllTemplates ();
+
+ void showRegion (TemplateContainerItem const *pItem);
+
+ void ContextMenuSelectHdl(std::string_view rIdent);
+
+ TemplateContainerItem* getRegion(std::u16string_view sStr);
+
+ sal_uInt16 getRegionId (size_t pos) const;
+
+ sal_uInt16 getRegionId (std::u16string_view sRegionName) const;
+
+ OUString getRegionName(const sal_uInt16 nRegionId) const;
+
+ OUString getRegionItemName(const sal_uInt16 nItemId) const;
+
+ std::vector<OUString> getFolderNames ();
+
+ std::vector<TemplateItemProperties>
+ getFilteredItems (const std::function<bool (const TemplateItemProperties&) > &rFunc) const;
+
+ sal_uInt16 createRegion (const OUString &rName);
+
+ bool renameRegion(std::u16string_view rTitle, const OUString &rNewTitle);
+
+ bool removeRegion (const sal_uInt16 nItemId);
+
+ bool removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId);
+
+ void moveTemplates (const std::set<const ThumbnailViewItem*,selection_cmp_fn> &rItems, const sal_uInt16 nTargetItem);
+
+ bool copyFrom(TemplateContainerItem *pItem, const OUString &rPath);
+
+ bool exportTo (const sal_uInt16 nItemId, const sal_uInt16 nRegionItemId, std::u16string_view rName);
+
+ virtual bool renameItem(ThumbnailViewItem* pItem, const OUString& sNewTitle) override;
+
+ virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
+
+ virtual bool Command(const CommandEvent& rPos) override;
+
+ virtual bool KeyInput( const KeyEvent& rKEvt ) override;
+
+ sal_uInt16 getCurRegionId () const { return mnCurRegionId;}
+
+ void setCurRegionId (sal_uInt16 nCurRegionId) { mnCurRegionId = nCurRegionId;}
+
+ void setOpenRegionHdl(const Link<void*,void> &rLink);
+
+ void setCreateContextMenuHdl(const Link<ThumbnailViewItem*,void> &rLink);
+
+ void setOpenTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
+
+ void setEditTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
+
+ void setDeleteTemplateHdl(const Link<void*,void> &rLink);
+
+ void setDefaultTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
+
+ void setMoveTemplateHdl(const Link<void*,void> &rLink);
+
+ void setExportTemplateHdl(const Link<void*,void> &rLink);
+
+ void updateThumbnailDimensions(tools::Long itemMaxSize);
+
+ void RemoveDefaultTemplateIcon( std::u16string_view rPath);
+
+ bool IsBuiltInRegion(const OUString& rRegionName);
+
+ static BitmapEx scaleImg (const BitmapEx &rImg, tools::Long width, tools::Long height);
+
+ static BitmapEx getDefaultThumbnail( std::u16string_view rPath );
+
+ static BitmapEx fetchThumbnail (const OUString &msURL, tools::Long width, tools::Long height);
+
+ static bool IsDefaultTemplate(const OUString& rPath);
+
+ static bool IsInternalTemplate(const OUString& rPath);
+
+protected:
+ virtual void OnItemDblClicked(ThumbnailViewItem *pItem) override;
+
+ sal_uInt16 mnCurRegionId;
+
+ TemplateViewItem *maSelectedItem;
+
+ tools::Long mnThumbnailWidth;
+ tools::Long mnThumbnailHeight;
+
+ Point maPosition; //store the point of click event
+
+ Link<void*,void> maOpenRegionHdl;
+ Link<ThumbnailViewItem*,void> maCreateContextMenuHdl;
+ Link<ThumbnailViewItem*,void> maOpenTemplateHdl;
+ Link<ThumbnailViewItem*,void> maEditTemplateHdl;
+ Link<void*,void> maDeleteTemplateHdl;
+ Link<ThumbnailViewItem*,void> maDefaultTemplateHdl;
+ Link<void*,void> maMoveTemplateHdl;
+ Link<void*,void> maExportTemplateHdl;
+
+ std::unique_ptr<SfxDocumentTemplates> mpDocTemplates;
+ std::vector<std::unique_ptr<TemplateContainerItem> > maRegions;
+ std::vector<TemplateItemProperties > maAllTemplates;
+};
+
+
+#endif // INCLUDED_SFX2_TEMPLATELOCALVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templateproperties.hxx b/include/sfx2/templateproperties.hxx
new file mode 100644
index 000000000..2c1de0125
--- /dev/null
+++ b/include/sfx2/templateproperties.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_TEMPLATEPROPERTIES_HXX
+#define INCLUDED_SFX2_TEMPLATEPROPERTIES_HXX
+
+#include <rtl/ustring.hxx>
+#include <vcl/bitmapex.hxx>
+
+struct TemplateItemProperties
+{
+ sal_uInt16 nId; ///< Index for ThumbnailView
+ sal_uInt16 nDocId; ///< Index based on SfxTemplateDocument
+ sal_uInt16 nRegionId;
+ OUString aName;
+ OUString aPath;
+ OUString aRegionName;
+ BitmapEx aThumbnail;
+};
+
+#endif // INCLUDED_SFX2_TEMPLATEPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templdlg.hxx b/include/sfx2/templdlg.hxx
new file mode 100644
index 000000000..5dd5b8b6b
--- /dev/null
+++ b/include/sfx2/templdlg.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_TEMPLDLG_HXX
+#define INCLUDED_SFX2_TEMPLDLG_HXX
+
+#include <config_options.h>
+#include <memory>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/sidebar/PanelLayout.hxx>
+
+class SfxBindings;
+class SfxTemplateDialog_Impl;
+
+class UNLESS_MERGELIBS(SFX2_DLLPUBLIC) SfxTemplatePanelControl final : public PanelLayout
+{
+public:
+ SfxTemplatePanelControl(SfxBindings* pBindings, weld::Widget* pParent);
+ virtual ~SfxTemplatePanelControl() override;
+
+ weld::Builder* get_builder() { return m_xBuilder.get(); }
+ weld::Container* get_container() { return m_xContainer.get(); }
+
+private:
+ std::unique_ptr<SfxTemplateDialog_Impl> pImpl;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx
new file mode 100644
index 000000000..453f3c9c5
--- /dev/null
+++ b/include/sfx2/thumbnailview.hxx
@@ -0,0 +1,331 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_THUMBNAILVIEW_HXX
+#define INCLUDED_SFX2_THUMBNAILVIEW_HXX
+
+#include <sfx2/dllapi.h>
+
+#include <functional>
+#include <memory>
+#include <vector>
+
+#include <vcl/customweld.hxx>
+
+class BitmapEx;
+class MouseEvent;
+class KeyEvent;
+class DataChangedEvent;
+class ScrollBar;
+class ThumbnailViewItem;
+typedef ::std::vector< ThumbnailViewItem* > ThumbnailValueItemList;
+
+
+struct ThumbnailItemAttributes;
+
+/*************************************************************************
+
+ Description
+ ============
+
+ class ThumbnailView
+
+ This class allows the selection of an item. In the process items are
+ drawn side by side. The selection of items can be more clear than in a
+ ListBox shape for example in case of colors or samples.
+ The amount of columns drawn by the control and whether the items
+ should be encircled can be specified. Optional a NoSelection or name
+ field could be shown. By default image and color items are supported.
+ Items could be drawn by oneself if InsertItem() is only called with
+ an ID. To achieve this the UserDraw handler needs to be overridden. The
+ description text could be specified afterwards in case of UserDraw
+ and any other items.
+
+ Cross references
+
+ class ListBox
+
+ --------------------------------------------------------------------------
+
+ WinBits
+
+ WB_VSCROLL A scrollbar will be always shown. The visible number of
+ lines have to be specified with SetLineCount() if this
+ flag is set.
+ WB_TABSTOP It is possible to jump into the ValueSet with the tab key.
+ WB_NOTABSTOP It is not possible to jump into the ValueSet with the
+ tab key.
+ --------------------------------------------------------------------------
+
+ The number of columns must be either set with SetColCount() or
+ SetItemWidth(). If the number of columns is specified by SetColCount()
+ the width of the items will be calculated by the visible range.
+ If the items should have a static width, it has to be specified
+ with SetItemWidth(). In this case the number of columns will be calculated
+ by the visible range.
+
+ The number of rows is given by the number of items / number of columns. The
+ number of visible rows must either specified by SetLineCount() or
+ SetItemWidth(). If the number of visible rows is specified by SetLineCount(),
+ the height of the items will be calculated from the visible height. If the
+ items should have a fixed height it has to be specified with SetItemHeight().
+ In this case the number of visible rows is then calculated from the visible
+ height. If the number of visible rows is neither specified by SetLineCount()
+ nor by SetItemHeight() all rows will be shown. The height of the items will
+ be calculated by the visible height. If the number of visible rows is
+ specified by SetLineCount() or SetItemHeight() ValueSet does scroll
+ automatically when more lines are available, as are visible. If scrolling
+ should be also possible with a ScrollBar WB_VSCROLL needs to be set.
+
+ The distance between the items can be increased by SetExtraSpacing(). The
+ distance, which will be shown between two items (both in x and in y), is
+ measured in pixels.
+
+ The exact window size for a specific item size can be calculated by
+ CalcWindowSizePixel(). To do this all relevant data (number of columns/...)
+ have to be specified and if no number of rows was set, all items need to
+ be inserted. If the window was created with WB_BORDER/Border=sal_True the
+ size has to be specified with SetOutputSizePixel(). In other cases different
+ size-methods can be used. With CalcItemSize() the inner and outer size of
+ an item could be calculated (for this the free space defined by
+ SetExtraSpacing() will not be included).
+
+ The background color could be specified by SetColor(), with which the image
+ or UserDraw items will be underlaid. If no color is specified the color
+ of other windows (WindowColor) will be used for the background.
+
+ --------------------------------------------------------------------------
+
+ At first all items should be inserted and only then Show() should be called
+ since the output area will be precomputed. If this is not done the first
+ Paint will appear a little bit slower. Therefore the Control, if it is loaded
+ from the resource and only supplied with items during runtime, should be
+ loaded with Hide = sal_True and then displayed with Show().
+
+ In case of a visible Control the creation of the new output area could be
+ activated before Paint by calling Format().
+
+ --------------------------------------------------------------------------
+
+ If Drag and Drop will be called from the ValueSet the Command-Handler has to
+ be overridden. From this StartDrag needs to be called. If this method returns
+ sal_True the drag-process could be initiated by ExecuteDrag(), otherwise no
+ processing will take place. This method makes sure that ValueSet stops its
+ processing and as appropriate selects the entry. Therefore the calling of
+ Select-Handler within this function must be expected.
+
+ For dropping QueryDrop() and Drop() need to be overridden and ShowDropPos()
+ and HideDropPos() should be called within these methods.
+ To show the insertion point ShowDropPos() has to be called within the
+ QueryDrop-Handler. ShowDropPos() also scrolls the ValueSet if the passed
+ position is located at the window border. Furthermore ShowDropPos() returns
+ the position, at which the item should be inserted respectively which
+ insertion point was shown. If no insertion point was determined
+ VALUESET_ITEM_NOTFOUND will be returned. If the window was left during dragging
+ or the drag process is terminated HideDropPos() should be called in any case.
+
+ --------------------------------------------------------------------------
+
+ This class is currently still in the SV-Tools. That's why the ValueSet needs
+ to be loaded as a Control out of the resource and the desired WinBits have
+ to be set (before Show) with SetStyle().
+
+*************************************************************************/
+
+/* ThumbnailView types */
+
+#define THUMBNAILVIEW_ITEM_NOTFOUND (sal_uInt16(-1))
+
+// Display all the available items in the thumbnail.
+class ViewFilterAll
+{
+public:
+
+ bool operator () (const ThumbnailViewItem*) const
+ {
+ return true;
+ }
+};
+
+/**
+ *
+ * Class to display thumbnails with their names below their respective icons
+ *
+ **/
+
+class SFX2_DLLPUBLIC ThumbnailView : public weld::CustomWidgetController
+{
+ friend class ThumbnailViewAcc;
+ friend class ThumbnailViewItemAcc;
+
+public:
+ ThumbnailView(std::unique_ptr<weld::ScrolledWindow> xWindow, std::unique_ptr<weld::Menu> xMenu);
+
+ virtual ~ThumbnailView() override;
+
+ virtual bool MouseMove(const MouseEvent& rMEvt) override;
+
+ /// Updates information in the view; used only in RecentDocsView ATM.
+ virtual void Reload() {}
+
+ void AppendItem(std::unique_ptr<ThumbnailViewItem> pItem);
+
+ void RemoveItem(sal_uInt16 nItemId);
+
+ virtual void Clear();
+
+ // Change current thumbnail item list with new one (invalidates all pointers to a thumbnail item)
+ void updateItems(std::vector<std::unique_ptr<ThumbnailViewItem>> items);
+
+ size_t GetItemPos( sal_uInt16 nItemId ) const;
+
+ sal_uInt16 GetItemId( size_t nPos ) const;
+
+ sal_uInt16 GetItemId( const Point& rPos ) const;
+
+ sal_uInt16 getNextItemId () const;
+
+ virtual bool renameItem(ThumbnailViewItem* pItem, const OUString& sNewTitle);
+
+ bool isDrawMnemonic() const { return mbDrawMnemonics; }
+
+ void setItemMaxTextLength (sal_uInt32 nLength);
+
+ void setItemDimensions (tools::Long ItemWidth, tools::Long ThumbnailHeight,
+ tools::Long DisplayHeight, int itemPadding);
+
+ void SelectItem( sal_uInt16 nItemId );
+
+ bool IsItemSelected( sal_uInt16 nItemId ) const;
+
+ /**
+ *
+ * @brief deselect all current selected items.
+ *
+ **/
+
+ void deselectItems ();
+
+ void ShowTooltips( bool bShowTooltips );
+
+ void DrawMnemonics( bool bDrawMnemonics );
+
+ void filterItems (const std::function<bool (const ThumbnailViewItem*) > &func);
+
+ void setItemStateHdl (const Link<const ThumbnailViewItem*,void> &aLink) { maItemStateHdl = aLink; }
+
+ virtual void Resize() override;
+
+ virtual void Show() override
+ {
+ mxScrolledWindow->show();
+ CustomWidgetController::Show();
+ }
+
+ virtual void Hide() override
+ {
+ mxScrolledWindow->hide();
+ CustomWidgetController::Hide();
+ }
+
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+
+ static BitmapEx readThumbnail(const OUString &msURL);
+
+protected:
+
+ virtual bool KeyInput( const KeyEvent& rKEvt ) override;
+
+ virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+
+ virtual void GetFocus() override;
+
+ virtual void LoseFocus() override;
+
+ virtual OUString RequestHelp(tools::Rectangle& rRect) override;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+
+ const css::uno::Reference<css::accessibility::XAccessible> & getAccessible() const;
+
+protected:
+
+ // Drawing item related functions, override them to make your own custom ones.
+
+ void DrawItem (ThumbnailViewItem const *pItem);
+
+ virtual void OnItemDblClicked (ThumbnailViewItem *pItem);
+
+ // Set Item colors from the ThumbnailView colors
+ void UpdateColors();
+
+protected:
+
+ friend class ThumbnailViewAcc;
+ friend class ThumbnailViewItemAcc;
+
+ void CalculateItemPositions (bool bScrollBarUsed = false);
+ void MakeItemVisible( sal_uInt16 nId );
+
+ void ImplInit();
+
+ void ImplDeleteItems();
+ size_t ImplGetItem( const Point& rPoint ) const;
+ ThumbnailViewItem* ImplGetItem( size_t nPos );
+ sal_uInt16 ImplGetVisibleItemCount() const;
+ ThumbnailViewItem* ImplGetVisibleItem(sal_uInt16 nVisiblePos);
+ void ImplFireAccessibleEvent( short nEventId, const css::uno::Any& rOldValue, const css::uno::Any& rNewValue );
+ bool ImplHasAccessibleListeners() const;
+ DECL_DLLPRIVATE_LINK( ImplScrollHdl, weld::ScrolledWindow&, void );
+
+protected:
+
+ std::vector< std::unique_ptr<ThumbnailViewItem> > mItemList;
+ css::uno::Reference<css::accessibility::XAccessible> mxAccessible;
+ ThumbnailValueItemList mFilteredItemList; ///< Cache to store the filtered items
+ ThumbnailValueItemList::iterator mpStartSelRange;
+ tools::Long mnItemWidth;
+ tools::Long mnItemHeight;
+ tools::Long mnItemPadding;
+ tools::Long mnThumbnailHeight; // Maximum height of the thumbnail
+ tools::Long mnDisplayHeight; // Height of the data display box (name, etc)
+ tools::Long mnVItemSpace; // Vertical spacing between rows, -1 to use excess unused height split up between items
+ tools::Long mnVisLines;
+ tools::Long mnLines;
+
+ sal_uInt16 mnCols;
+ sal_uInt16 mnFirstLine;
+ bool mbScroll : 1; // Whether we need to scroll
+ bool mbAllowVScrollBar : 1; // Whether to show a visible scrollbar
+ bool mbHasVisibleItems : 1;
+ bool mbShowTooltips : 1;
+ bool mbDrawMnemonics : 1;
+ bool mbSelectOnFocus : 1;
+ Color maFillColor; ///< Background color of the thumbnail view widget.
+ Color maTextColor; ///< Text color.
+ Color maHighlightColor; ///< Color of the highlight (background) of the hovered item.
+ Color maHighlightTextColor; ///< Color of the text for the highlighted item.
+ Color maSelectHighlightColor; ///< Color of the highlight (background) of the selected and hovered item.
+ Color maSelectHighlightTextColor; ///< Color of the text of the selected and hovered item.
+ double mfHighlightTransparence; ///< Transparence of the highlight.
+
+ Link<const ThumbnailViewItem*, void> maItemStateHdl;
+ std::unique_ptr<ThumbnailItemAttributes> mpItemAttrs;
+ std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow;
+ std::unique_ptr<weld::Menu> mxContextMenu;
+
+ std::function<bool (const ThumbnailViewItem*)> maFilterFunc;
+};
+
+
+#endif // INCLUDED_SFX2_THUMBNAILVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/thumbnailviewitem.hxx b/include/sfx2/thumbnailviewitem.hxx
new file mode 100644
index 000000000..d0da2edae
--- /dev/null
+++ b/include/sfx2/thumbnailviewitem.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/vector/b2dvector.hxx>
+#include <drawinglayer/attribute/fontattribute.hxx>
+#include <vcl/bitmapex.hxx>
+#include <sfx2/dllapi.h>
+#include <rtl/ref.hxx>
+
+namespace com::sun::star::accessibility { class XAccessible; }
+namespace drawinglayer::primitive2d { class Primitive2DContainer; }
+
+#define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE
+
+const int THUMBNAILVIEW_ITEM_CORNER = 5;
+
+class ThumbnailView;
+class MouseEvent;
+
+namespace basegfx {
+ class B2DPolygon;
+}
+
+namespace drawinglayer {
+ namespace processor2d {
+ class BaseProcessor2D;
+ }
+ namespace primitive2d {
+ class PolygonHairlinePrimitive2D;
+ }
+}
+
+struct ThumbnailItemAttributes
+{
+ sal_uInt32 nMaxTextLength;
+ basegfx::BColor aFillColor;
+ basegfx::BColor aTextColor;
+ basegfx::BColor aHighlightColor;
+ basegfx::BColor aHighlightTextColor;
+ basegfx::BColor aSelectHighlightColor;
+ basegfx::BColor aSelectHighlightTextColor;
+ double fHighlightTransparence;
+ basegfx::B2DVector aFontSize;
+ drawinglayer::attribute::FontAttribute aFontAttr;
+};
+
+class SFX2_DLLPUBLIC ThumbnailViewItem
+{
+public:
+
+ ThumbnailView& mrParent;
+ sal_uInt16 mnId;
+ bool mbVisible;
+ bool mbBorder;
+ bool mbSelected;
+ bool mbHover;
+ BitmapEx maPreview1;
+ OUString maTitle;
+ OUString maHelpText;
+ css::uno::Reference< css::accessibility::XAccessible > mxAcc;
+
+ ThumbnailViewItem(ThumbnailView& rView, sal_uInt16 nId);
+
+ virtual ~ThumbnailViewItem ();
+
+ bool isVisible () const { return mbVisible; }
+
+ void show (bool bVisible);
+
+ bool isSelected () const { return mbSelected; }
+
+ void setSelection (bool state);
+
+ bool isHighlighted () const { return mbHover; }
+
+ void setHighlight (bool state);
+
+ /** Updates own highlight status based on the aPoint position.
+
+ Returns rectangle that needs to be invalidated.
+ */
+ virtual tools::Rectangle updateHighlight(bool bVisible, const Point& rPoint);
+
+ /// Text to be used for the tooltip.
+
+ void setHelpText (const OUString &sText) { maHelpText = sText; }
+
+ virtual OUString getHelpText() const { return maHelpText; };
+ OUString const & getTitle() const { return maTitle; };
+
+ void setTitle (const OUString& rTitle);
+
+ css::uno::Reference< css::accessibility::XAccessible > const &
+ GetAccessible( bool bIsTransientChildrenDisabled );
+
+ void setDrawArea (const tools::Rectangle &area);
+
+ const tools::Rectangle& getDrawArea () const { return maDrawArea; }
+
+ virtual void calculateItemsPosition (const tools::Long nThumbnailHeight,
+ const tools::Long nPadding, sal_uInt32 nMaxTextLength,
+ const ThumbnailItemAttributes *pAttrs);
+
+ virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
+ const ThumbnailItemAttributes *pAttrs);
+ void addTextPrimitives (const OUString& rText, const ThumbnailItemAttributes *pAttrs, Point aPos, drawinglayer::primitive2d::Primitive2DContainer& rSeq);
+
+ static rtl::Reference<drawinglayer::primitive2d::PolygonHairlinePrimitive2D>
+ createBorderLine (const basegfx::B2DPolygon &rPolygon);
+
+ virtual void MouseButtonUp(const MouseEvent&) {}
+
+protected:
+
+ Point maTextPos;
+ Point maPrev1Pos;
+ tools::Rectangle maDrawArea;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/toolbarids.hxx b/include/sfx2/toolbarids.hxx
new file mode 100644
index 000000000..1aedb4eda
--- /dev/null
+++ b/include/sfx2/toolbarids.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_TOOLBARIDS_HXX
+#define INCLUDED_SFX2_TOOLBARIDS_HXX
+
+#include <sal/types.h>
+
+//these numbers end up in the configuration to identify toolbars
+//so don't blindly change their numbers
+enum class ToolbarId : sal_uInt32
+{
+ None = 0,
+ FullScreenToolbox = 558,
+ EnvToolbox = 560,
+ Svx_Extrusion_Bar = 10986,
+ Svx_Fontwork_Bar = 10987,
+ Basicide_Objectbar = 14850,
+ SvxTbx_Form_Navigation = 18001,
+ SvxTbx_Form_Filter = 18002,
+ SvxTbx_Text_Control_Attributes = 18003,
+ SvxTbx_Controls = 18004,
+ SvxTbx_FormDesign = 18006,
+ Math_Toolbox = 20050,
+ Webtools_Toolbox = 20402,
+ Webtext_Toolbox = 20403,
+ Webframe_Toolbox = 20408,
+ Webgraphic_Toolbox = 20410,
+ Webole_Toolbox = 20411,
+ Draw_Toolbox_Sd = 23011,
+ Slide_Toolbox = 23012,
+ Draw_Obj_Toolbox = 23013,
+ Slide_Obj_Toolbox = 23014,
+ Bezier_Toolbox_Sd = 23015,
+ Draw_Text_Toolbox_Sd = 23016,
+ Outline_Toolbox = 23017,
+ Draw_Table_Toolbox = 23018,
+ Gluepoints_Toolbox = 23019,
+ Draw_Options_Toolbox = 23020,
+ Draw_CommonTask_Toolbox = 23021,
+ FormLayer_Toolbox = 23022,
+ Draw_Viewer_Toolbox = 23023,
+ Graphic_Obj_Toolbox = 23027,
+ Draw_Graf_Toolbox = 23030,
+ Draw_Media_Toolbox = 23031,
+ Text_Toolbox_Sw = 23265,
+ Table_Toolbox = 23266,
+ Frame_Toolbox = 23267,
+ Grafik_Toolbox = 23268,
+ Draw_Toolbox_Sw = 23269,
+ Draw_Text_Toolbox_Sw = 23270,
+ Num_Toolbox = 23271,
+ Ole_Toolbox = 23272,
+ Tools_Toolbox = 23273,
+ PView_Toolbox = 23281,
+ Bezier_Toolbox_Sw = 23283,
+ Module_Toolbox = 23310,
+ Media_Toolbox = 23311,
+ Objectbar_App = 25000,
+ Objectbar_Format = 25001,
+ Text_Toolbox_Sc = 25005,
+ Objectbar_Preview = 25006,
+ Objectbar_Tools = 25035,
+ Draw_Objectbar = 25053,
+ Graphic_Objectbar = 25054,
+ Media_Objectbar = 25060
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/sfx2/tplpitem.hxx b/include/sfx2/tplpitem.hxx
new file mode 100644
index 000000000..647e2b8e7
--- /dev/null
+++ b/include/sfx2/tplpitem.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_TPLPITEM_HXX
+#define INCLUDED_SFX2_TPLPITEM_HXX
+
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <svl/flagitem.hxx>
+#include <svl/style.hxx>
+
+class SFX2_DLLPUBLIC SfxTemplateItem final : public SfxFlagItem
+{
+ OUString aStyle;
+ OUString aStyleIdentifier;
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxTemplateItem();
+ SfxTemplateItem( sal_uInt16 nWhich,
+ const OUString &rStyle,
+ const OUString &rStyleIdentifier = "" );
+
+ const OUString& GetStyleName() const { return aStyle; }
+ const OUString& GetStyleIdentifier() const { return aStyleIdentifier; }
+
+ virtual SfxTemplateItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual sal_uInt8 GetFlagCount() const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ SfxStyleSearchBits GetValue() const { return static_cast<SfxStyleSearchBits>(SfxFlagItem::GetValue()); }
+ void SetValue(SfxStyleSearchBits n) { SfxFlagItem::SetValue(static_cast<sal_uInt16>(n)); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/userinputinterception.hxx b/include/sfx2/userinputinterception.hxx
new file mode 100644
index 000000000..f94857978
--- /dev/null
+++ b/include/sfx2/userinputinterception.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_USERINPUTINTERCEPTION_HXX
+#define INCLUDED_SFX2_USERINPUTINTERCEPTION_HXX
+
+#include <sfx2/dllapi.h>
+
+#include <memory>
+
+namespace com::sun::star::awt { class XKeyHandler; }
+namespace com::sun::star::awt { class XMouseClickHandler; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace osl { class Mutex; }
+
+class NotifyEvent;
+
+namespace cppu { class OWeakObject; }
+
+
+namespace sfx2
+{
+
+
+ //= UserInputInterception
+
+ struct UserInputInterception_Data;
+ /** helper class for implementing the XUserInputInterception interface
+ for a controller implementation
+ */
+ class SFX2_DLLPUBLIC UserInputInterception
+ {
+ public:
+ UserInputInterception( ::cppu::OWeakObject& _rControllerImpl, ::osl::Mutex& _rMutex );
+ ~UserInputInterception();
+ UserInputInterception(const UserInputInterception&) = delete;
+ UserInputInterception& operator=( const UserInputInterception& ) = delete;
+
+ // delegator functions for your XUserInputInterception implementation
+ /// @throws css::uno::RuntimeException
+ void addKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler );
+ /// @throws css::uno::RuntimeException
+ void removeKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler );
+ /// @throws css::uno::RuntimeException
+ void addMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler );
+ /// @throws css::uno::RuntimeException
+ void removeMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler );
+
+ // state
+ bool hasKeyHandlers() const;
+ bool hasMouseClickListeners() const;
+
+ // forwarding a NotifyEvent to the KeyListeners respectively MouseClickListeners
+ bool handleNotifyEvent( const NotifyEvent& _rEvent );
+
+ private:
+ ::std::unique_ptr< UserInputInterception_Data > m_pData;
+ };
+
+
+} // namespace sfx2
+
+
+#endif // INCLUDED_SFX2_USERINPUTINTERCEPTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/viewfac.hxx b/include/sfx2/viewfac.hxx
new file mode 100644
index 000000000..efd511ea2
--- /dev/null
+++ b/include/sfx2/viewfac.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_VIEWFAC_HXX
+#define INCLUDED_SFX2_VIEWFAC_HXX
+
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/shell.hxx>
+
+class SfxViewFrame;
+class SfxViewShell;
+
+typedef SfxViewShell* (*SfxViewCtor)(SfxViewFrame*, SfxViewShell*);
+
+// CLASS -----------------------------------------------------------------
+class SFX2_DLLPUBLIC SfxViewFactory
+{
+public:
+ SfxViewFactory( SfxViewCtor fnC,
+ SfxInterfaceId nOrdinal, const char* asciiViewName );
+
+ SfxViewShell* CreateInstance(SfxViewFrame *pViewFrame, SfxViewShell *pOldSh);
+ SfxInterfaceId GetOrdinal() const { return nOrd; }
+
+ /// returns a legacy view name. This is "view" with an appended ordinal/ID.
+ OUString GetLegacyViewName() const;
+
+ /** returns an API-compatible view name.
+
+ For details on which view names are specified, see the XModel2.getAvailableViewControllerNames
+ documentation.
+ */
+ OUString GetAPIViewName() const;
+
+private:
+ SfxViewCtor fnCreate;
+ SfxInterfaceId nOrd;
+ const OUString m_sViewName;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
new file mode 100644
index 000000000..24d1c35db
--- /dev/null
+++ b/include/sfx2/viewfrm.hxx
@@ -0,0 +1,277 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_VIEWFRM_HXX
+#define INCLUDED_SFX2_VIEWFRM_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <svl/lstner.hxx>
+#include <sfx2/frame.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/shell.hxx>
+#include <svl/poolitem.hxx>
+#include <vcl/svapp.hxx>
+
+namespace weld {
+ class Button;
+ class Window;
+}
+class SvBorder;
+class SfxDispatcher;
+class SfxBindings;
+class SfxProgress;
+class SfxViewShell;
+class Point;
+class Size;
+class SfxChildWindow;
+class SfxInfoBarWindow;
+enum class InfobarType;
+class CommandPopupHandler;
+
+class SFX2_DLLPUBLIC SfxViewFrame final : public SfxShell, public SfxListener
+{
+ std::unique_ptr<struct SfxViewFrame_Impl> m_pImpl;
+
+ SfxObjectShellRef m_xObjSh;
+ std::unique_ptr<SfxDispatcher> m_pDispatcher;
+ SfxBindings* m_pBindings;
+ ImplSVHelpData* m_pHelpData;
+ ImplSVWinData* m_pWinData;
+ sal_uInt16 m_nAdjustPosPixelLock;
+
+ std::unique_ptr<CommandPopupHandler> m_pCommandPopupHandler;
+
+ SAL_DLLPRIVATE void Construct_Impl( SfxObjectShell *pObjSh );
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+ DECL_DLLPRIVATE_LINK(GetInvolvedHandler, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(DonationHandler, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(WhatsNewHandler, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(SwitchReadOnlyHandler, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(SignDocumentHandler, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(HiddenTrackChangesHandler, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(HyphenationMissingHandler, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(RefreshMasterPasswordHdl, weld::Button&, void);
+ SAL_DLLPRIVATE void KillDispatcher_Impl();
+
+ virtual ~SfxViewFrame() override;
+
+public:
+ SfxViewFrame( SfxFrame& rFrame, SfxObjectShell *pDoc );
+
+ SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWFRM)
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl();
+
+public:
+
+ static void SetViewFrame( SfxViewFrame* );
+
+ static SfxViewFrame* LoadHiddenDocument( SfxObjectShell const & i_rDoc, SfxInterfaceId i_nViewId );
+ static SfxViewFrame* LoadDocument( SfxObjectShell const & i_rDoc, SfxInterfaceId i_nViewId );
+ static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell const & i_rDoc, const SfxFrameItem* i_pFrameItem, SfxInterfaceId i_nViewId );
+ static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell const & i_rDoc, const css::uno::Reference< css::frame::XFrame >& i_rFrameItem );
+ static SfxViewFrame* DisplayNewDocument( SfxObjectShell const & i_rDoc, const SfxRequest& i_rCreateDocRequest );
+
+ static SfxViewFrame* Current();
+ static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = nullptr, bool bOnlyVisible = true );
+ static SfxViewFrame* GetNext( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc = nullptr, bool bOnlyVisible = true );
+
+ static SfxViewFrame* Get( const css::uno::Reference< css::frame::XController>& i_rController, const SfxObjectShell* i_pDoc );
+
+ void DoActivate(bool bMDI);
+ void DoDeactivate(bool bMDI, SfxViewFrame const *pOld);
+
+ using SfxShell::GetDispatcher;
+ SfxDispatcher* GetDispatcher() { return m_pDispatcher.get(); }
+ SfxBindings& GetBindings() { return *m_pBindings; }
+ const SfxBindings& GetBindings() const { return *m_pBindings; }
+ vcl::Window& GetWindow() const;
+ weld::Window* GetFrameWeld() const;
+
+ SfxProgress* GetProgress() const;
+
+ void LockAdjustPosSizePixel()
+ { m_nAdjustPosPixelLock++; }
+ void UnlockAdjustPosSizePixel()
+ { m_nAdjustPosPixelLock--; }
+ void DoAdjustPosSizePixel( SfxViewShell * pSh,
+ const Point &rPos, const Size &rSize,
+ bool inplaceEditModeChange );
+ void Show();
+ bool IsVisible() const;
+ void ToTop();
+ void Enable( bool bEnable );
+ void Close();
+ virtual void Activate( bool bUI ) override;
+ virtual void Deactivate( bool bUI ) override;
+
+ void UpdateTitle();
+
+ // interne Handler
+ SAL_DLLPRIVATE void SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder );
+ SAL_DLLPRIVATE const SvBorder& GetBorderPixelImpl() const;
+ SAL_DLLPRIVATE void InvalidateBorderImpl( const SfxViewShell *pSh );
+
+ virtual SfxObjectShell* GetObjectShell() override;
+ SfxInterfaceId GetCurViewId() const;
+ SfxFrame& GetFrame() const;
+ SfxViewFrame* GetTopViewFrame() const;
+
+ bool DoClose();
+ static void GetTargetList( TargetList& rList )
+ { SfxFrame::GetDefaultTargetList( rList ); }
+
+ void SetModalMode( bool );
+ bool IsInModalMode() const;
+ void Resize(bool bForce=false);
+
+ void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true);
+ void ToggleChildWindow(sal_uInt16);
+ bool HasChildWindow(sal_uInt16);
+ bool KnowsChildWindow(sal_uInt16);
+ void ShowChildWindow(sal_uInt16,bool bVisible=true);
+ SfxChildWindow* GetChildWindow(sal_uInt16);
+ void ChildWindowExecute(SfxRequest&);
+ void ChildWindowState(SfxItemSet&);
+
+ /** Append a new InfoBar (see https://wiki.documentfoundation.org/Design/Whiteboards/Infobar).
+
+ The buttons will be added from Right to Left at the right of the info bar. The parent, size
+ and position of each button will be changed: only the width will remain unchanged.
+ */
+ VclPtr<SfxInfoBarWindow> AppendInfoBar(const OUString& sId,
+ const OUString& sPrimaryMessage,
+ const OUString& sSecondaryMessage,
+ InfobarType aInfobarType,
+ bool bShowCloseButton=true);
+ void RemoveInfoBar(std::u16string_view sId);
+ void UpdateInfoBar(std::u16string_view sId, const OUString& sPrimaryMessage,
+ const OUString& sSecondaryMessage,
+ InfobarType eType);
+ bool HasInfoBarWithID(std::u16string_view sId);
+ void AppendReadOnlyInfobar();
+
+ SAL_DLLPRIVATE void GetDocNumber_Impl();
+ SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell *pVSh );
+ SAL_DLLPRIVATE void ReleaseObjectShell_Impl();
+
+ SAL_DLLPRIVATE void GetState_Impl( SfxItemSet &rSet );
+ void ExecReload_Impl(SfxRequest& rReq);
+ SAL_DLLPRIVATE void StateReload_Impl( SfxItemSet &rSet );
+ SAL_DLLPRIVATE void ExecView_Impl( SfxRequest &rReq );
+ SAL_DLLPRIVATE void StateView_Impl( SfxItemSet &rSet );
+ SAL_DLLPRIVATE void ExecHistory_Impl( SfxRequest &rReq );
+ SAL_DLLPRIVATE void StateHistory_Impl( SfxItemSet &rSet );
+ SAL_DLLPRIVATE void ForceOuterResize_Impl();
+ SAL_DLLPRIVATE void UpdateDocument_Impl();
+
+ SAL_DLLPRIVATE void LockObjectShell_Impl();
+
+ SAL_DLLPRIVATE void MakeActive_Impl( bool bActivate );
+ SAL_DLLPRIVATE const Size& GetMargin_Impl() const;
+ SAL_DLLPRIVATE OUString GetActualPresentationURL_Impl() const;
+ SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &);
+ SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl();
+ SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const OUString& sMacro);
+
+ SAL_DLLPRIVATE void Exec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &);
+
+ SAL_DLLPRIVATE void SetCurViewId_Impl( const SfxInterfaceId i_nID );
+
+private:
+ SAL_DLLPRIVATE bool SwitchToViewShell_Impl( sal_uInt16 nNo, bool bIsIndex = false );
+ SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell );
+ SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const SfxInterfaceId i_nNewViewId );
+
+ /** loads the given existing document into the given frame
+
+ This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked.
+
+ @param i_rDoc
+ the document to load
+ @param i_rFrame
+ the frame to load the document into
+ @param i_rLoadArgs
+ the arguments to pass to the component loader. If this sequence is empty, then the current arguments of the
+ model will be obtained, and passed to the loader. This ensures that any arguments in the model will be preserved,
+ instead of being reset.
+ @param i_nViewId
+ the ID of the view to create
+ @throws Exception
+ if something goes wrong. The caller is responsible for handling this.
+ */
+ SAL_DLLPRIVATE static SfxViewShell* LoadViewIntoFrame_Impl(
+ const SfxObjectShell& i_rDoc,
+ const css::uno::Reference< css::frame::XFrame >& i_rFrame,
+ const css::uno::Sequence< css::beans::PropertyValue >& i_rLoadArgs,
+ const SfxInterfaceId i_nViewId,
+ const bool i_bHidden
+ );
+
+ /** loads the given existing document into the given frame
+
+ This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked.
+
+ If no frame is given, a blank top level frame is created.
+
+ If anything fails during the process, as much as possible is cleaned up.
+
+ @param i_rDoc
+ the document to load
+ @param i_rFrame
+ the frame to load the document into. Might be <NULL/>, in which case a new frame is created.
+ @param i_nViewId
+ the ID of the view to create
+ */
+ SAL_DLLPRIVATE static SfxViewFrame* LoadViewIntoFrame_Impl_NoThrow(
+ const SfxObjectShell& i_rDoc,
+ const css::uno::Reference< css::frame::XFrame >& i_rFrame,
+ const SfxInterfaceId i_nViewId,
+ const bool i_bHidden
+ );
+};
+
+
+class SFX2_DLLPUBLIC SfxViewFrameItem final : public SfxPoolItem
+{
+ SfxViewFrame* pFrame;
+
+public:
+ SfxViewFrameItem( SfxViewFrame *pViewFrame ):
+ SfxPoolItem( 0 ),
+ pFrame( pViewFrame)
+ {}
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxViewFrameItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ SfxViewFrame* GetFrame() const
+ { return pFrame; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
new file mode 100644
index 000000000..31fac39ee
--- /dev/null
+++ b/include/sfx2/viewsh.hxx
@@ -0,0 +1,435 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_VIEWSH_HXX
+#define INCLUDED_SFX2_VIEWSH_HXX
+
+#include <sal/config.h>
+#include <memory>
+#include <sfx2/dllapi.h>
+#include <sal/types.h>
+#include <com/sun/star/uno/Reference.h>
+#include <svl/lstner.hxx>
+#include <sfx2/shell.hxx>
+#include <i18nlangtag/languagetag.hxx>
+#include <vcl/IDialogRenderable.hxx>
+#include <vcl/errcode.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <vcl/vclptr.hxx>
+#include <editeng/outliner.hxx>
+#include <functional>
+#include <unordered_set>
+
+class SfxTabPage;
+class SfxBaseController;
+class Size;
+class Point;
+class Fraction;
+namespace weld {
+ class Container;
+ class DialogController;
+ class Window;
+}
+class KeyEvent;
+class SvBorder;
+class SdrView;
+class SfxModule;
+class SfxViewFrame;
+class Printer;
+class SfxPrinter;
+class NotifyEvent;
+class SfxInPlaceClient;
+class SfxLokCallbackInterface;
+namespace vcl { class PrinterController; }
+
+namespace com::sun::star::awt{ class XPopupMenu; }
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::datatransfer::clipboard { class XClipboardListener; }
+namespace com::sun::star::datatransfer::clipboard { class XClipboardNotifier; }
+namespace com::sun::star::embed { class XEmbeddedObject; }
+namespace com::sun::star::frame { class XController; }
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::ui { class XContextMenuInterceptor; }
+namespace com::sun::star::ui { struct ContextMenuExecuteEvent; }
+namespace com::sun::star::view { class XRenderable; }
+
+
+enum class SfxPrinterChangeFlags
+{
+ NONE = 0,
+ PRINTER = 1, // without JOB SETUP => Temporary
+ JOBSETUP = 2,
+ OPTIONS = 4,
+ CHG_ORIENTATION = 8,
+ CHG_SIZE = 16
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SfxPrinterChangeFlags> : is_typed_flags<SfxPrinterChangeFlags, 31> {};
+}
+#define SFX_PRINTER_ALL (SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP | SfxPrinterChangeFlags::OPTIONS | SfxPrinterChangeFlags::CHG_ORIENTATION | SfxPrinterChangeFlags::CHG_SIZE)
+
+#define SFX_PRINTERROR_BUSY 1
+
+// "Verified" using www.apple.com and Netscape 3.01
+#define DEFAULT_MARGIN_WIDTH 8
+#define DEFAULT_MARGIN_HEIGHT 12
+
+
+// @[SfxViewShell-Flags]
+
+enum class SfxViewShellFlags
+{
+ NONE = 0x0000,
+ HAS_PRINTOPTIONS = 0x0010, /* Options-Button and Options-Dialog in PrintDialog */
+ NO_NEWWINDOW = 0x0100, /* Allow N View */
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SfxViewShellFlags> : is_typed_flags<SfxViewShellFlags, 0x0110> {};
+}
+
+/* [Description]
+
+ The SfxViewShell flags control the behavior of SfxViewShell for the
+ duration of its lifetime. They are defined in the constructor of
+ <SfxViewShell>.
+*/
+
+enum class LOKDeviceFormFactor
+{
+ UNKNOWN = 0,
+ DESKTOP = 1,
+ TABLET = 2,
+ MOBILE = 3
+};
+
+class SfxViewFactory;
+#define SFX_DECL_VIEWFACTORY(Class) \
+private: \
+ static SfxViewFactory *s_pFactory; \
+public: \
+ static SfxViewShell *CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView); \
+ static void RegisterFactory( SfxInterfaceId nPrio ); \
+ static SfxViewFactory*Factory() { return s_pFactory; } \
+ static void InitFactory()
+
+#define SFX_IMPL_NAMED_VIEWFACTORY(Class, AsciiViewName) \
+ SfxViewFactory* Class::s_pFactory; \
+ SfxViewShell* Class::CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView) \
+ { return new Class(pFrame, pOldView); } \
+ void Class::RegisterFactory( SfxInterfaceId nPrio ) \
+ { \
+ s_pFactory = new SfxViewFactory(&CreateInstance,nPrio,AsciiViewName);\
+ InitFactory(); \
+ } \
+ void Class::InitFactory()
+
+#define SFX_VIEW_REGISTRATION(DocClass) \
+ DocClass::Factory().RegisterViewFactory( *Factory() )
+
+template<class T> bool checkSfxViewShell(const SfxViewShell* pShell)
+{
+ return dynamic_cast<const T*>(pShell) != nullptr;
+}
+
+/**
+ * One SfxViewShell more or less represents one edit window for a document, there can be multiple
+ * ones for a single opened document (SfxObjectShell).
+ */
+class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener, public OutlinerViewShell, public vcl::ILibreOfficeKitNotifier
+{
+friend class SfxViewFrame;
+friend class SfxBaseController;
+friend class SfxPrinterController;
+
+ std::unique_ptr<struct SfxViewShell_Impl> pImpl;
+ SfxViewFrame* pFrame;
+ VclPtr<vcl::Window> pWindow;
+ bool bNoNewWindow;
+ bool mbPrinterSettingsModified;
+ LanguageTag maLOKLanguageTag;
+ LanguageTag maLOKLocale;
+ LOKDeviceFormFactor maLOKDeviceFormFactor;
+ std::unordered_set<OUString> mvLOKBlockedCommandList;
+
+ /// Used to set the DocId at construction time. See SetCurrentDocId.
+ static ViewShellDocId mnCurrentDocId;
+
+protected:
+ virtual void Activate(bool IsMDIActivate) override;
+ virtual void Deactivate(bool IsMDIActivate) override;
+
+ virtual void InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange );
+ virtual void OuterResizePixel( const Point &rOfs, const Size &rSize );
+ virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY );
+
+ virtual void Move();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+
+public:
+ // Iteration
+ static SfxViewShell* GetFirst( bool bOnlyVisible = true, const std::function<bool ( const SfxViewShell* )>& isViewShell = nullptr );
+ static SfxViewShell* GetNext( const SfxViewShell& rPrev,
+ bool bOnlyVisible = true,
+ const std::function<bool ( const SfxViewShell* )>& isViewShell = nullptr );
+ static SfxViewShell* Current();
+
+ static SfxViewShell* Get( const css::uno::Reference< css::frame::XController>& i_rController );
+
+ // Initialize Constructors/Destructors
+ SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWSH)
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl();
+
+public:
+
+ SfxViewShell( SfxViewFrame *pFrame, SfxViewShellFlags nFlags );
+ virtual ~SfxViewShell() override;
+
+ SfxInPlaceClient* GetIPClient() const;
+ SfxInPlaceClient* GetUIActiveClient() const;
+ SfxInPlaceClient* FindIPClient( const css::uno::Reference < css::embed::XEmbeddedObject >& xObj, vcl::Window *pObjParentWin ) const;
+
+ virtual ErrCode DoVerb(sal_Int32 nVerb);
+
+ void OutplaceActivated( bool bActive );
+ virtual void UIActivating( SfxInPlaceClient* pClient );
+ virtual void UIDeactivated( SfxInPlaceClient* pClient );
+
+ void JumpToMark( const OUString& rMark );
+ void VisAreaChanged();
+
+ // Misc
+
+ /**
+ * Initialize is called after the frame has been loaded and the controller
+ * has been set. By the time this is called the document has been fully
+ * imported.
+ * @param bOnlyASample used by some dialogs to avoid constructing monster strings e.g. in calc
+ */
+ virtual bool PrepareClose( bool bUI = true );
+ virtual OUString GetSelectionText( bool bCompleteWords = false, bool bOnlyASample = false );
+ virtual bool HasSelection( bool bText = true ) const;
+ virtual SdrView* GetDrawView() const;
+
+ void AddSubShell( SfxShell& rShell );
+ void RemoveSubShell( SfxShell *pShell=nullptr );
+ SfxShell* GetSubShell( sal_uInt16 );
+
+ virtual SfxShell* GetFormShell() { return nullptr; };
+ virtual const SfxShell* GetFormShell() const { return nullptr; };
+
+ // ILibreOfficeKitNotifier
+ virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) const override;
+
+ // Focus, KeyInput, Cursor
+ virtual void ShowCursor( bool bOn = true );
+ virtual bool KeyInput( const KeyEvent &rKeyEvent );
+ bool Escape();
+
+ // Viewing Interface
+ vcl::Window* GetWindow() const { return pWindow; }
+ weld::Window* GetFrameWeld() const;
+ void SetWindow( vcl::Window *pViewPort );
+ const SvBorder& GetBorderPixel() const;
+ void SetBorderPixel( const SvBorder &rBorder );
+ void InvalidateBorder();
+ inline SfxViewFrame* GetViewFrame() const;
+
+ // Printing Interface
+ virtual SfxPrinter* GetPrinter( bool bCreate = false );
+ virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL );
+ virtual bool HasPrintOptionsPage() const;
+ virtual std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rOptions);
+ Printer* GetActivePrinter() const;
+
+ // Working set
+ virtual void WriteUserData( OUString&, bool bBrowse = false );
+ virtual void ReadUserData( const OUString&, bool bBrowse = false );
+ virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& );
+ virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& );
+ virtual void QueryObjAreaPixel( tools::Rectangle& rRect ) const;
+
+ virtual SfxObjectShell* GetObjectShell() override;
+
+ /** retrieves the document which shall be considered the "current document" when the frame is active
+
+ The default implementation simply returns the XModel of the associated SfxObjectShell. You will rarely
+ need to overwrite this behavior.
+ */
+ virtual css::uno::Reference< css::frame::XModel >
+ GetCurrentDocument() const;
+
+ /** forwards the current document, as returned by ->GetCurrentDocument, to SfxObjectShell::SetWorkingDocument
+ */
+ void SetCurrentDocument() const;
+
+ /** get an XRenderable instance that can render this document
+ */
+ virtual css::uno::Reference< css::view::XRenderable > GetRenderable();
+
+
+ virtual void MarginChanged();
+ const Size& GetMargin() const;
+ void SetMargin( const Size& );
+ void DisconnectAllClients();
+ bool NewWindowAllowed() const { return !bNoNewWindow; }
+ void SetNewWindowAllowed( bool bSet ) { bNoNewWindow = !bSet; }
+
+ void SetController( SfxBaseController* pController );
+ css::uno::Reference<css::frame::XController> GetController() const;
+
+ bool TryContextMenuInterception(const css::uno::Reference<css::awt::XPopupMenu>& rIn,
+ const OUString& rMenuIdentifier,
+ css::uno::Reference<css::awt::XPopupMenu>& rOut,
+ css::ui::ContextMenuExecuteEvent aEvent);
+ bool TryContextMenuInterception(const css::uno::Reference<css::awt::XPopupMenu>&,
+ const OUString& rMenuIdentifier,
+ css::ui::ContextMenuExecuteEvent aEvent);
+
+ void ExecPrint( const css::uno::Sequence < css::beans::PropertyValue >&, bool, bool );
+ // Like ExecPrint(), but only sets up for printing. Use Printer::ExecutePrintJob() and Printer::FinishPrintJob() afterwards.
+ void StartPrint( const css::uno::Sequence < css::beans::PropertyValue >&, bool, bool );
+ const std::shared_ptr< vcl::PrinterController >& GetPrinterController() const;
+
+ void AddRemoveClipboardListener( const css::uno::Reference < css::datatransfer::clipboard::XClipboardListener>&, bool );
+ css::uno::Reference< css::datatransfer::clipboard::XClipboardNotifier > GetClipboardNotifier() const;
+
+ SAL_DLLPRIVATE SfxInPlaceClient* GetUIActiveIPClient_Impl() const;
+ SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl( const css::uno::Reference < css::ui::XContextMenuInterceptor >& xInterceptor );
+ SAL_DLLPRIVATE void RemoveContextMenuInterceptor_Impl( const css::uno::Reference < css::ui::XContextMenuInterceptor >& xInterceptor );
+ SAL_DLLPRIVATE bool GlobalKeyInput_Impl( const KeyEvent &rKeyEvent );
+
+ SAL_DLLPRIVATE void NewIPClient_Impl( SfxInPlaceClient *pIPClient );
+ SAL_DLLPRIVATE void IPClientGone_Impl( SfxInPlaceClient const *pIPClient );
+ SAL_DLLPRIVATE void ResetAllClients_Impl( SfxInPlaceClient const *pIP );
+
+ SAL_DLLPRIVATE void SetPrinter_Impl( VclPtr<SfxPrinter>& pNewPrinter );
+
+ SAL_DLLPRIVATE bool HandleNotifyEvent_Impl( NotifyEvent const & rEvent );
+ SAL_DLLPRIVATE bool HasKeyListeners_Impl() const;
+ SAL_DLLPRIVATE bool HasMouseClickListeners_Impl() const;
+
+ SAL_DLLPRIVATE SfxBaseController* GetBaseController_Impl() const;
+
+ // Shell Interface
+ SAL_DLLPRIVATE void ExecPrint_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void ExecMisc_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&);
+ SAL_DLLPRIVATE void CheckIPClient_Impl(SfxInPlaceClient const *, const tools::Rectangle&);
+ SAL_DLLPRIVATE void PushSubShells_Impl( bool bPush=true );
+ SAL_DLLPRIVATE void PopSubShells_Impl() { PushSubShells_Impl( false ); }
+ SAL_DLLPRIVATE bool ExecKey_Impl(const KeyEvent& aKey);
+
+ /// Set up a more efficient internal callback instead of LibreOfficeKitCallback.
+ void setLibreOfficeKitViewCallback(SfxLokCallbackInterface* pCallback);
+ /// Invokes the registered callback, if there are any.
+ virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const override;
+ virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const override;
+ virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const override;
+ // Performs any pending calls to libreOfficeKitViewInvalidateTilesCallback() as necessary.
+ virtual void flushPendingLOKInvalidateTiles();
+ virtual void libreOfficeKitViewUpdatedCallback(int nType) const override;
+ virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const override;
+ // Returns current payload for nType, after libreOfficeKitViewUpdatedCallback() or
+ // libreOfficeKitViewUpdatedCallbackPerViewId() were called. If no payload should
+ // be generated, the ignore flag should be set.
+ virtual OString getLOKPayload(int nType, int nViewId, bool* ignore) const;
+
+ /// Set if we are doing tiled searching.
+ void setTiledSearching(bool bTiledSearching);
+ /// See lok::Document::getPart().
+ virtual int getPart() const;
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
+ /// See OutlinerViewShell::GetViewShellId().
+ ViewShellId GetViewShellId() const override;
+
+ /// Set the current DocId, which is used by Mobile LOKit to
+ /// load multiple documents and yet identify the views of each.
+ /// There are events that are fired while creating a new view,
+ /// and if we don't have a DocId, we can't know which other views
+ /// within the same document (if any) should get those events.
+ /// By setting this static value, we are able to set the DocId
+ /// of each SfxViewShell at construction time.
+ static void SetCurrentDocId(ViewShellDocId nId);
+ /// Get the DocId used by Mobile LOKit to load multiple documents.
+ ViewShellDocId GetDocId() const override;
+
+ /// See OutlinerViewShell::NotifyOtherViews().
+ void NotifyOtherViews(int nType, const OString& rKey, const OString& rPayload) override;
+ /// See OutlinerViewShell::NotifyOtherView().
+ void NotifyOtherView(OutlinerViewShell* pOtherShell, int nType, const OString& rKey, const OString& rPayload) override;
+ /// Ask this view to send its cursor position to pViewShell.
+ virtual void NotifyCursor(SfxViewShell* /*pViewShell*/) const;
+ /// Where a new view can perform some update/initialization soon after the callback has been registered.
+ virtual void afterCallbackRegistered();
+ /// See OutlinerViewShell::GetEditWindowForActiveOLEObj().
+ virtual vcl::Window* GetEditWindowForActiveOLEObj() const override;
+
+ /// Set the LibreOfficeKit language of this view.
+ void SetLOKLanguageTag(const OUString& rBcp47LanguageTag);
+ /// Get the LibreOfficeKit language of this view.
+ const LanguageTag& GetLOKLanguageTag() const { return maLOKLanguageTag; }
+
+ /// Set the LibreOfficeKit locale of this view.
+ void SetLOKLocale(const OUString& rBcp47LanguageTag);
+ /// Get the LibreOfficeKit locale of this view.
+ const LanguageTag& GetLOKLocale() const { return maLOKLocale; }
+ /// Get the form factor of the device where the lok client is running.
+ LOKDeviceFormFactor GetLOKDeviceFormFactor() const { return maLOKDeviceFormFactor; }
+ /// Check if the lok client is running on a desktop machine.
+ bool isLOKDesktop() const { return maLOKDeviceFormFactor == LOKDeviceFormFactor::DESKTOP; }
+ /// Check if the lok client is running on a tablet.
+ bool isLOKTablet() const { return maLOKDeviceFormFactor == LOKDeviceFormFactor::TABLET; }
+ /// Check if the lok client is running on a mobile device.
+ bool isLOKMobilePhone() const { return maLOKDeviceFormFactor == LOKDeviceFormFactor::MOBILE; }
+
+ virtual tools::Rectangle getLOKVisibleArea() const { return tools::Rectangle(); }
+
+ // Blocked Command view settings
+ void setBlockedCommandList(const char* blockedCommandList);
+ bool isBlockedCommand(OUString command);
+};
+
+
+inline SfxViewFrame* SfxViewShell::GetViewFrame() const
+
+/* [Description]
+
+ This method returns a pointer to the <SfxViewFrame> Instance in which
+ this SfxViewShell is displayed. This is the instance that was passed
+ on in the constructor. It is guaranteed that the returned pointer
+ points on the valid SfxViewFrame instance.
+
+ [Cross-reference]
+
+ <SfxShell::GetFrame()const>
+*/
+
+{
+ return pFrame;
+}
+
+#endif // INCLUDED_SFX2_VIEWSH_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/watermarkitem.hxx b/include/sfx2/watermarkitem.hxx
new file mode 100644
index 000000000..c298894bb
--- /dev/null
+++ b/include/sfx2/watermarkitem.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_SFX2_WATERMARKITEM_HXX
+#define INCLUDED_SFX2_WATERMARKITEM_HXX
+
+#include <sfx2/dllapi.h>
+#include <svl/poolitem.hxx>
+#include <tools/color.hxx>
+
+class SFX2_DLLPUBLIC SfxWatermarkItem final : public SfxPoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxWatermarkItem();
+ virtual SfxWatermarkItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ OUString const & GetText() const { return m_aText; }
+ void SetText(const OUString& aText) { m_aText = aText; }
+ OUString const & GetFont() const { return m_aFont; }
+ void SetFont(const OUString& aFont) { m_aFont = aFont; }
+ sal_Int16 GetAngle() const { return m_nAngle; }
+ void SetAngle(const sal_Int16 nAngle) { m_nAngle = nAngle; }
+ sal_Int16 GetTransparency() const { return m_nTransparency; }
+ void SetTransparency(const sal_Int16 nTransparency) { m_nTransparency = nTransparency; }
+ Color GetColor() const { return m_nColor; }
+ void SetColor(Color nColor) { m_nColor = nColor; }
+
+private:
+ OUString m_aText;
+ OUString m_aFont;
+ sal_Int16 m_nAngle;
+ sal_Int16 m_nTransparency;
+ Color m_nColor;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/sfx2/weldutils.hxx b/include/sfx2/weldutils.hxx
new file mode 100644
index 000000000..8f230cee5
--- /dev/null
+++ b/include/sfx2/weldutils.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_WELDUTILS_HXX
+#define INCLUDED_SFX2_WELDUTILS_HXX
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XToolbarController.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <tools/link.hxx>
+#include <sfx2/dllapi.h>
+#include <svtools/miscopt.hxx>
+#include <vcl/weld.hxx>
+
+#include <map>
+
+namespace weld
+{
+class Builder;
+class Toolbar;
+}
+
+class SFX2_DLLPUBLIC ToolbarUnoDispatcher
+{
+private:
+ css::uno::Reference<css::frame::XFrame> m_xFrame;
+ SvtMiscOptions m_aToolbarOptions;
+ weld::Toolbar* m_pToolbar;
+ weld::Builder* m_pBuilder;
+ bool m_bSideBar;
+
+ DECL_DLLPRIVATE_LINK(SelectHdl, const OString&, void);
+ DECL_DLLPRIVATE_LINK(ToggleMenuHdl, const OString&, void);
+ DECL_DLLPRIVATE_LINK(ChangedIconSizeHandler, LinkParamNone*, void);
+
+ void CreateController(const OUString& rCommand);
+ static vcl::ImageType GetIconSize();
+
+ typedef std::map<OUString, css::uno::Reference<css::frame::XToolbarController>>
+ ControllerContainer;
+ ControllerContainer maControllers;
+
+public:
+ // fill in the label and icons for actions and dispatch the action on item click
+ ToolbarUnoDispatcher(weld::Toolbar& rToolbar, weld::Builder& rBuilder,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ bool bSideBar = true);
+
+ css::uno::Reference<css::frame::XToolbarController>
+ GetControllerForCommand(const OUString& rCommand) const;
+
+ const css::uno::Reference<css::frame::XFrame>& GetFrame() const { return m_xFrame; }
+
+ void dispose();
+ ~ToolbarUnoDispatcher();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/xmldump.hxx b/include/sfx2/xmldump.hxx
new file mode 100644
index 000000000..245a07b22
--- /dev/null
+++ b/include/sfx2/xmldump.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/types.h>
+
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+
+namespace sfx2
+{
+/// Implemented by objects that can be dumped to xml for debugging purposes.
+class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI XmlDump
+{
+public:
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const = 0;
+
+protected:
+ ~XmlDump() noexcept = default;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/zoomitem.hxx b/include/sfx2/zoomitem.hxx
new file mode 100644
index 000000000..4e7703dfd
--- /dev/null
+++ b/include/sfx2/zoomitem.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX2_ZOOMITEM_HXX
+#define INCLUDED_SFX2_ZOOMITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/dllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+
+enum class SvxZoomType
+{
+ PERCENT, // GetValue() is no special percentage value
+ OPTIMAL, // GetValue() corresponds to the optimal size
+ WHOLEPAGE, // GetValue() corresponds to the whole page
+ PAGEWIDTH, // GetValue() corresponds to the page width
+ PAGEWIDTH_NOBORDER // GetValue() pagewidth without border
+};
+
+enum class SvxZoomEnableFlags
+{
+ NONE = 0x0000,
+ N50 = 0x0001,
+ N75 = 0x0002,
+ N100 = 0x0004,
+ N150 = 0x0008,
+ N200 = 0x0010,
+ OPTIMAL = 0x1000,
+ WHOLEPAGE = 0x2000,
+ PAGEWIDTH = 0x4000,
+ ALL = 0x701F
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvxZoomEnableFlags> : is_typed_flags<SvxZoomEnableFlags, 0x701f> {};
+}
+
+class SFX2_DLLPUBLIC SvxZoomItem final : public SfxUInt16Item
+{
+ SvxZoomEnableFlags nValueSet; // allowed values (see #defines below)
+ SvxZoomType eType;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxZoomItem( SvxZoomType eZoomType = SvxZoomType::PERCENT,
+ sal_uInt16 nVal = 0, sal_uInt16 nWhich = SID_ATTR_ZOOM );
+
+ void SetValueSet( SvxZoomEnableFlags nValues ) { nValueSet = nValues; }
+ SvxZoomEnableFlags GetValueSet() const { return nValueSet; }
+
+ SvxZoomType GetType() const { return eType; }
+ void SetType( SvxZoomType eNewType ) { eType = eNewType; }
+
+ virtual SvxZoomItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/exchange.hxx b/include/sot/exchange.hxx
new file mode 100644
index 000000000..c7fed6d3b
--- /dev/null
+++ b/include/sot/exchange.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SOT_EXCHANGE_HXX
+#define INCLUDED_SOT_EXCHANGE_HXX
+
+#include <vector>
+#include <com/sun/star/datatransfer/DataFlavor.hpp>
+#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
+#include <sot/sotdllapi.h>
+#include <sot/formats.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace com::sun::star::datatransfer {
+ class XTransferable;
+}
+
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+struct DataFlavorEx : public css::datatransfer::DataFlavor
+{
+ SotClipboardFormatId mnSotId;
+};
+
+typedef ::std::vector<DataFlavorEx> DataFlavorExVector;
+
+
+SOT_DLLPUBLIC bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector,
+ SotClipboardFormatId nId );
+
+// actions
+#define EXCHG_INOUT_ACTION_NONE (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_NONE))
+#define EXCHG_IN_ACTION_DEFAULT EXCHG_INOUT_ACTION_NONE
+#define EXCHG_IN_ACTION_MOVE (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_MOVE))
+#define EXCHG_IN_ACTION_COPY (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_COPY))
+#define EXCHG_IN_ACTION_LINK (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_LINK))
+#define EXCHG_OUT_ACTION_INSERT_FILE (sal_uInt8(20))
+#define EXCHG_OUT_ACTION_INSERT_IMAGEMAP (sal_uInt8(22))
+#define EXCHG_OUT_ACTION_INSERT_OLE (sal_uInt8(23))
+#define EXCHG_OUT_ACTION_INSERT_INTERACTIVE (sal_uInt8(24))
+#define EXCHG_OUT_ACTION_REPLACE_IMAGEMAP (sal_uInt8(29))
+#define EXCHG_OUT_ACTION_GET_ATTRIBUTES (sal_uInt8(30))
+#define EXCHG_OUT_ACTION_INSERT_PRIVATE (sal_uInt8(35))
+#define EXCHG_OUT_ACTION_INSERT_HTML (sal_uInt8(36))
+#define EXCHG_OUT_ACTION_MOVE_PRIVATE (sal_uInt8(37))
+#define EXCHG_OUT_ACTION_INSERT_STRING (sal_uInt8(38))
+#define EXCHG_OUT_ACTION_INSERT_DRAWOBJ (sal_uInt8(39))
+#define EXCHG_OUT_ACTION_INSERT_SVXB (sal_uInt8(40))
+#define EXCHG_OUT_ACTION_INSERT_GDIMETAFILE (sal_uInt8(41))
+#define EXCHG_OUT_ACTION_INSERT_BITMAP (sal_uInt8(42))
+#define EXCHG_OUT_ACTION_INSERT_DDE (sal_uInt8(43))
+#define EXCHG_OUT_ACTION_INSERT_HYPERLINK (sal_uInt8(44))
+#define EXCHG_OUT_ACTION_REPLACE_DRAWOBJ (sal_uInt8(45))
+#define EXCHG_OUT_ACTION_REPLACE_SVXB (sal_uInt8(46))
+#define EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE (sal_uInt8(47))
+#define EXCHG_OUT_ACTION_REPLACE_BITMAP (sal_uInt8(48))
+#define EXCHG_OUT_ACTION_REPLACE_GRAPH (sal_uInt8(49))
+#define EXCHG_OUT_ACTION_INSERT_GRAPH (sal_uInt8(50))
+
+enum class SotExchangeActionFlags {
+ NONE = 0x0000,
+ InsertImageMap = 0x0400,
+ ReplaceImageMap = 0x0800,
+ InsertTargetUrl = 0x2000,
+};
+namespace o3tl {
+ template<> struct typed_flags<SotExchangeActionFlags> : is_typed_flags<SotExchangeActionFlags, 0x2c00> {};
+}
+
+// destinations
+enum class SotExchangeDest
+{
+ NONE = 0,
+ DOC_OLEOBJ = 1,
+ CHARTDOC_OLEOBJ = 2,
+ DOC_TEXTFRAME = 3,
+ DOC_GRAPHOBJ = 4,
+ DOC_LNKD_GRAPHOBJ = 5,
+ DOC_GRAPH_W_IMAP = 6,
+ DOC_LNKD_GRAPH_W_IMAP = 7,
+ DOC_IMAPREGION = 8,
+ DOC_DRAWOBJ = 9,
+ DOC_URLBUTTON = 10,
+ DOC_URLFIELD = 11,
+ DOC_GROUPOBJ = 12,
+ SWDOC_FREE_AREA = 13,
+ SCDOC_FREE_AREA = 14,
+ SDDOC_FREE_AREA = 15,
+ DOC_TEXTFRAME_WEB = 16,
+ SWDOC_FREE_AREA_WEB = 17,
+};
+
+class SvGlobalName;
+
+class SOT_DLLPUBLIC SotExchange
+{
+public:
+ static SotClipboardFormatId RegisterFormat( const css::datatransfer::DataFlavor& rFlavor );
+ static SotClipboardFormatId RegisterFormatName( const OUString& rName );
+ static SotClipboardFormatId RegisterFormatMimeType( const OUString& rMimeType );
+
+ static SotClipboardFormatId GetFormat( const css::datatransfer::DataFlavor& rFlavor );
+ static OUString GetFormatName( SotClipboardFormatId nFormat );
+ static bool GetFormatDataFlavor( SotClipboardFormatId nFormat, css::datatransfer::DataFlavor& rFlavor );
+ static OUString GetFormatMimeType( SotClipboardFormatId nFormat );
+ static bool IsInternal( const SvGlobalName& );
+ static SotClipboardFormatId GetFormatIdFromMimeType( const OUString& rMimeType );
+
+ // same for XTransferable interface
+ static sal_uInt8 GetExchangeAction(
+ // XTransferable
+ const DataFlavorExVector& rDataFlavorExVector,
+ // destination of an action
+ SotExchangeDest nDestination,
+ // action for a source
+ sal_uInt16 nSourceOptions,
+ // user action (EXCHG_IN_*, EXCHG_INOUT_*)
+ sal_uInt8 nUserAction,
+ // In:- Out: format to use
+ SotClipboardFormatId& rFormat,
+ // In:- Out: default action (EXCHG_IN_*, EXCHG_INOUT_*)
+ sal_uInt8& rDefaultAction,
+ // In:- optional - check only for this specific format
+ SotClipboardFormatId nOnlyTestFormat = SotClipboardFormatId::NONE,
+ // In:- optional - check the contents of Xtransferable
+ const css::uno::Reference< css::datatransfer::XTransferable >* pxTransferable = nullptr,
+ // Out: optional: - default action flags
+ SotExchangeActionFlags* pActionFlags = nullptr);
+
+ static sal_uInt16 IsChart( const SvGlobalName& rName );
+ static sal_uInt16 IsMath( const SvGlobalName& rName );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/filelist.hxx b/include/sot/filelist.hxx
new file mode 100644
index 000000000..e95ea38cc
--- /dev/null
+++ b/include/sot/filelist.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SOT_FILELIST_HXX
+#define INCLUDED_SOT_FILELIST_HXX
+
+#include <sot/sotdllapi.h>
+#include <rtl/ustring.hxx>
+
+#include <vector>
+
+class SvStream;
+
+class SOT_DLLPUBLIC FileList
+{
+ std::vector<OUString> aStrList;
+
+private:
+ void clear() { aStrList.clear(); }
+
+public:
+ // import / export
+ SOT_DLLPUBLIC friend SvStream& ReadFileList(SvStream& rIStm, FileList& rFileList);
+
+ // fill in / interrogate list
+ void AppendFile(const OUString& rStr);
+ OUString GetFile(size_t nIndex) const;
+ size_t Count() const;
+};
+
+#endif // INCLUDED_SOT_FILELIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/formats.hxx b/include/sot/formats.hxx
new file mode 100644
index 000000000..12727ffb3
--- /dev/null
+++ b/include/sot/formats.hxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SOT_FORMATS_HXX
+#define INCLUDED_SOT_FORMATS_HXX
+
+#include <sal/types.h>
+
+// - predefined formats -
+// Do NOT change the order of these values as the implementation depends on them!
+enum class SotClipboardFormatId : sal_uInt32
+{
+// standard formats for that Copy/Paste methods exist
+ STRING = 1,
+ BITMAP = 2,
+ GDIMETAFILE = 3,
+ PRIVATE = 4,
+ SIMPLE_FILE = 5,
+ FILE_LIST = 6,
+// further formats (only via CopyData/PasteData)
+ RTF = 10,
+
+ NONE = 0,
+ ONLY_USED_IN_SW = 8, // the SW module essentially creates its own ID's and this is one of them
+ DRAWING = 11,
+ SVXB = 12,
+ SVIM = 13,
+ XFA = 14,
+ EDITENGINE_ODF_TEXT_FLAT = 15,
+ INTERNALLINK_STATE = 16,
+ SOLK = 17,
+ NETSCAPE_BOOKMARK = 18,
+ TREELISTBOX = 19,
+ NATIVE = 20,
+ OWNERLINK = 21,
+ STARSERVER = 22,
+ STAROBJECT = 23,
+ APPLETOBJECT = 24,
+ PLUGIN_OBJECT = 25,
+ STARWRITER_30 = 26,
+ STARWRITER_40 = 27,
+ STARWRITER_50 = 28,
+ STARWRITERWEB_40 = 29,
+ STARWRITERWEB_50 = 30,
+ STARWRITERGLOB_40 = 31,
+ STARWRITERGLOB_50 = 32,
+ STARDRAW = 33,
+ STARDRAW_40 = 34,
+ STARIMPRESS_50 = 35,
+ STARDRAW_50 = 36,
+ STARCALC = 37,
+ STARCALC_40 = 38,
+ STARCALC_50 = 39,
+ STARCHART = 40,
+ STARCHART_40 = 41,
+ STARCHART_50 = 42,
+ STARIMAGE = 43,
+ STARIMAGE_40 = 44,
+ STARIMAGE_50 = 45,
+ STARMATH = 46,
+ STARMATH_40 = 47,
+ STARMATH_50 = 48,
+ STAROBJECT_PAINTDOC = 49,
+ FILLED_AREA = 50,
+ HTML = 51,
+ HTML_SIMPLE = 52,
+ CHAOS = 53,
+ CNT_MSGATTACHFILE = 54,
+ BIFF_5 = 55,
+ BIFF__5 = 56,
+ SYLK = 57,
+ SYLK_BIGCAPS = 58,
+ LINK = 59,
+ DIF = 60,
+ STARDRAW_TABBAR = 61,
+ SONLK = 62,
+ MSWORD_DOC = 63,
+ STAR_FRAMESET_DOC = 64,
+ OFFICE_DOC = 65,
+ NOTES_DOCINFO = 66,
+ NOTES_HNOTE = 67,
+ NOTES_NATIVE = 68,
+ SFX_DOC = 69,
+ EVDF = 70,
+ ESDF = 71,
+ IDF = 72,
+ EFTP = 73,
+ EFD = 74,
+ SVX_FORMFIELDEXCH = 75,
+ EXTENDED_TABBAR = 76,
+ SBA_DATAEXCHANGE = 77,
+ SBA_FIELDDATAEXCHANGE = 78,
+ SBA_PRIVATE_URL = 79,
+ SBA_TABED = 80,
+ SBA_TABID = 81,
+ SBA_JOIN = 82,
+ OBJECTDESCRIPTOR = 83,
+ LINKSRCDESCRIPTOR = 84,
+ EMBED_SOURCE = 85,
+ LINK_SOURCE = 86,
+ EMBEDDED_OBJ = 87,
+ FILECONTENT = 88,
+ FILEGRPDESCRIPTOR = 89,
+ FILENAME = 90,
+ SD_OLE = 91,
+ EMBEDDED_OBJ_OLE = 92,
+ EMBED_SOURCE_OLE = 93,
+ OBJECTDESCRIPTOR_OLE = 94,
+ LINKSRCDESCRIPTOR_OLE = 95,
+ LINK_SOURCE_OLE = 96,
+ SBA_CTRLDATAEXCHANGE = 97,
+ OUTPLACE_OBJ = 98,
+ CNT_OWN_CLIP = 99,
+ INET_IMAGE = 100,
+ NETSCAPE_IMAGE = 101,
+ SBA_FORMEXCHANGE = 102,
+ SBA_REPORTEXCHANGE = 103,
+ UNIFORMRESOURCELOCATOR = 104,
+ STARCHARTDOCUMENT_50 = 105,
+ GRAPHOBJ = 106,
+ STARWRITER_60 = 107,
+ STARWRITERWEB_60 = 108,
+ STARWRITERGLOB_60 = 109,
+ STARDRAW_60 = 110,
+ STARIMPRESS_60 = 111,
+ STARCALC_60 = 112,
+ STARCHART_60 = 113,
+ STARMATH_60 = 114,
+ WMF = 115,
+ DBACCESS_QUERY = 116,
+ DBACCESS_TABLE = 117,
+ DBACCESS_COMMAND = 118,
+ DIALOG_60 = 119,
+ EMF = 120,
+ BIFF_8 = 121,
+ BMP = 122,
+ HTML_NO_COMMENT = 123,
+ STARWRITER_8 = 124,
+ STARWRITERWEB_8 = 125,
+ STARWRITERGLOB_8 = 126,
+ STARDRAW_8 = 127,
+ STARIMPRESS_8 = 128,
+ STARCALC_8 = 129,
+ STARCHART_8 = 130,
+ STARMATH_8 = 131,
+ XFORMS = 132,
+ STARWRITER_8_TEMPLATE = 133,
+ STARDRAW_8_TEMPLATE = 134,
+ STARIMPRESS_8_TEMPLATE = 135,
+ STARCALC_8_TEMPLATE = 136,
+ STARCHART_8_TEMPLATE = 137,
+ STARMATH_8_TEMPLATE = 138,
+ STARBASE_8 = 139,
+ HC_GDIMETAFILE = 140,
+ PNG = 141,
+ STARWRITERGLOB_8_TEMPLATE = 142,
+ MATHML = 143,
+ JPEG = 144,
+ RICHTEXT = 145,
+ STRING_TSVC = 146,
+ PDF = 147,
+ // the point at which we start allocating "runtime" format IDs
+ USER_END = PDF
+};
+
+/** Make it easier to iterate over format IDs */
+inline SotClipboardFormatId& operator++(SotClipboardFormatId& eFormat)
+{
+ eFormat = static_cast<SotClipboardFormatId>(static_cast<sal_uInt32>(eFormat) + 1);
+ return eFormat;
+}
+
+#define SOT_FORMAT_SYSTEM_START SotClipboardFormatId::NONE
+
+#endif // INCLUDED_SOT_FORMATS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/object.hxx b/include/sot/object.hxx
new file mode 100644
index 000000000..1657986c8
--- /dev/null
+++ b/include/sot/object.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SOT_OBJECT_HXX
+#define INCLUDED_SOT_OBJECT_HXX
+
+#include <sal/config.h>
+
+#include <tools/ref.hxx>
+#include <sot/sotdllapi.h>
+
+class SOT_DLLPUBLIC SotObject : virtual public SvRefBase
+{
+ sal_uInt16 nOwnerLockCount;
+ bool bInClose; // TRUE, in DoClose
+
+protected:
+ virtual ~SotObject() override;
+ virtual bool Close();
+
+public:
+ SotObject();
+
+ sal_uInt16 GetOwnerLockCount() const { return nOwnerLockCount; }
+
+ void OwnerLock(bool bLock);
+ bool DoClose();
+ bool IsInClose() const { return bInClose; }
+
+private:
+ SotObject& operator=(const SotObject&) = delete;
+ SotObject(const SotObject&) = delete;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/sotdllapi.h b/include/sot/sotdllapi.h
new file mode 100644
index 000000000..c01d6ed3a
--- /dev/null
+++ b/include/sot/sotdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SOT_SOTDLLAPI_H
+#define INCLUDED_SOT_SOTDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(SOT_DLLIMPLEMENTATION)
+#define SOT_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SOT_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SOT_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_SOT_SOTDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/stg.hxx b/include/sot/stg.hxx
new file mode 100644
index 000000000..72003f08f
--- /dev/null
+++ b/include/sot/stg.hxx
@@ -0,0 +1,317 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SOT_STG_HXX
+#define INCLUDED_SOT_STG_HXX
+
+#include <tools/stream.hxx>
+#include <tools/globname.hxx>
+#include <sot/storinfo.hxx>
+#include <sot/sotdllapi.h>
+#include <config_options.h>
+
+namespace com::sun::star::ucb { class XProgressHandler; }
+namespace com::sun::star::uno { class Any; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+class StgIo;
+class StgDirEntry;
+typedef struct SvGUID ClsId;
+
+class StorageBase : public SvRefBase
+{
+protected:
+ mutable ErrCode m_nError; // error code
+ StreamMode m_nMode; // open mode
+ bool m_bAutoCommit;
+ StorageBase();
+ virtual ~StorageBase() override;
+public:
+ virtual bool Validate( bool=false ) const = 0;
+ virtual bool ValidateMode( StreamMode ) const = 0;
+ void ResetError() const;
+ void SetError( ErrCode ) const;
+ ErrCode GetError() const;
+ bool Good() const { return m_nError == ERRCODE_NONE; }
+ StreamMode GetMode() const { return m_nMode; }
+ void SetAutoCommit( bool bSet )
+ { m_bAutoCommit = bSet; }
+};
+
+class BaseStorageStream : public StorageBase
+{
+public:
+ virtual sal_Int32 Read( void * pData, sal_Int32 nSize ) = 0;
+ virtual sal_Int32 Write( const void* pData, sal_Int32 nSize ) = 0;
+ virtual sal_uInt64 Seek( sal_uInt64 nPos ) = 0;
+ virtual sal_uInt64 Tell() = 0;
+ virtual void Flush() = 0;
+ virtual bool SetSize( sal_uInt64 nNewSize ) = 0;
+ virtual sal_uInt64 GetSize() const = 0;
+ virtual void CopyTo( BaseStorageStream * pDestStm ) = 0;
+ virtual bool Commit() = 0;
+ virtual bool Equals( const BaseStorageStream& rStream ) const = 0;
+};
+
+enum class SotClipboardFormatId : sal_uInt32;
+
+class SAL_DLLPUBLIC_RTTI BaseStorage : public StorageBase
+{
+public:
+ virtual const OUString& GetName() const = 0;
+ virtual bool IsRoot() const = 0;
+ virtual void SetClassId( const ClsId& ) = 0;
+ virtual const ClsId& GetClassId() const = 0;
+ virtual void SetDirty() = 0;
+ virtual void SetClass( const SvGlobalName & rClass,
+ SotClipboardFormatId nOriginalClipFormat,
+ const OUString & rUserTypeName ) = 0;
+ virtual SvGlobalName GetClassName() = 0;
+ virtual SotClipboardFormatId GetFormat() = 0;
+ virtual OUString GetUserName() = 0;
+ virtual void FillInfoList( SvStorageInfoList* ) const = 0;
+ virtual bool CopyTo( BaseStorage* pDestStg ) const = 0;
+ virtual bool Commit() = 0;
+ virtual bool Revert() = 0;
+ virtual BaseStorageStream* OpenStream( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = true ) = 0;
+ virtual BaseStorage* OpenStorage( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = false ) = 0;
+ virtual BaseStorage* OpenUCBStorage( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = false ) = 0;
+ virtual BaseStorage* OpenOLEStorage( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = false ) = 0;
+ virtual bool IsStream( const OUString& rEleName ) const = 0;
+ virtual bool IsStorage( const OUString& rEleName ) const = 0;
+ virtual bool IsContained( const OUString& rEleName ) const = 0;
+ virtual void Remove( const OUString & rEleName ) = 0;
+ virtual bool CopyTo( const OUString & rEleName, BaseStorage * pDest, const OUString & rNewName ) = 0;
+ virtual bool ValidateFAT() = 0;
+ virtual bool Equals( const BaseStorage& rStream ) const = 0;
+};
+
+class OLEStorageBase
+{
+protected:
+ StreamMode& nStreamMode; // open mode
+ StgIo* pIo; // I/O subsystem
+ StgDirEntry* pEntry; // the dir entry
+ OLEStorageBase( StgIo*, StgDirEntry*, StreamMode& );
+ ~OLEStorageBase();
+ bool Validate_Impl( bool ) const;
+ static bool ValidateMode_Impl( StreamMode, StgDirEntry const * p = nullptr );
+};
+
+class StorageStream final : public BaseStorageStream, public OLEStorageBase
+{
+//friend class Storage;
+ sal_uInt64 nPos; // current position
+
+ virtual ~StorageStream() override;
+public:
+ StorageStream( StgIo*, StgDirEntry*, StreamMode );
+ virtual sal_Int32 Read( void * pData, sal_Int32 nSize ) override;
+ virtual sal_Int32 Write( const void* pData, sal_Int32 nSize ) override;
+ virtual sal_uInt64 Seek( sal_uInt64 nPos ) override;
+ virtual sal_uInt64 Tell() override { return nPos; }
+ virtual void Flush() override;
+ virtual bool SetSize( sal_uInt64 nNewSize ) override;
+ virtual sal_uInt64 GetSize() const override;
+ virtual void CopyTo( BaseStorageStream * pDestStm ) override;
+ virtual bool Commit() final override;
+ virtual bool Validate( bool=false ) const override;
+ virtual bool ValidateMode( StreamMode ) const override;
+ virtual bool Equals( const BaseStorageStream& rStream ) const override;
+};
+
+class UCBStorageStream;
+
+class UNLESS_MERGELIBS(SOT_DLLPUBLIC) Storage final : public BaseStorage, public OLEStorageBase
+{
+ OUString aName;
+ bool bIsRoot;
+ void Init( bool bCreate );
+ Storage( StgIo*, StgDirEntry*, StreamMode );
+ virtual ~Storage() override;
+public:
+ Storage( OUString, StreamMode, bool bDirect );
+ Storage( SvStream& rStrm, bool bDirect );
+ Storage( UCBStorageStream& rStrm, bool bDirect );
+
+ static bool IsStorageFile( const OUString & rFileName );
+ static bool IsStorageFile( SvStream* );
+
+ virtual const OUString& GetName() const final override;
+ virtual bool IsRoot() const override { return bIsRoot; }
+ virtual void SetClassId( const ClsId& ) override;
+ virtual const ClsId& GetClassId() const override;
+ virtual void SetDirty() override;
+ virtual void SetClass( const SvGlobalName & rClass,
+ SotClipboardFormatId nOriginalClipFormat,
+ const OUString & rUserTypeName ) override;
+ virtual SvGlobalName GetClassName() override;
+ virtual SotClipboardFormatId GetFormat() override;
+ virtual OUString GetUserName() override;
+ virtual void FillInfoList( SvStorageInfoList* ) const override;
+ virtual bool CopyTo( BaseStorage* pDestStg ) const override;
+ virtual bool Commit() final override;
+ virtual bool Revert() override;
+ virtual BaseStorageStream* OpenStream( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = true ) override;
+ virtual BaseStorage* OpenStorage( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = false ) override;
+ virtual BaseStorage* OpenUCBStorage( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = false ) override;
+ virtual BaseStorage* OpenOLEStorage( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = false ) override;
+ virtual bool IsStream( const OUString& rEleName ) const override;
+ virtual bool IsStorage( const OUString& rEleName ) const override;
+ virtual bool IsContained( const OUString& rEleName ) const override;
+ virtual void Remove( const OUString & rEleName ) override;
+ virtual bool CopyTo( const OUString & rEleName, BaseStorage * pDest, const OUString & rNewName ) override;
+ virtual bool ValidateFAT() override;
+ virtual bool Validate( bool=false ) const override;
+ virtual bool ValidateMode( StreamMode ) const override;
+ bool ValidateMode( StreamMode, StgDirEntry const * p ) const;
+ virtual bool Equals( const BaseStorage& rStream ) const override;
+};
+
+class UCBStorageStream_Impl;
+class UCBStorageStream final : public BaseStorageStream
+{
+friend class UCBStorage;
+
+ UCBStorageStream_Impl*
+ pImp;
+ virtual ~UCBStorageStream() override;
+public:
+ UCBStorageStream( const OUString& rName, StreamMode nMode, bool bDirect, bool bRepair, css::uno::Reference< css::ucb::XProgressHandler > const & xProgress );
+ UCBStorageStream( UCBStorageStream_Impl* );
+
+ virtual sal_Int32 Read( void * pData, sal_Int32 nSize ) override;
+ virtual sal_Int32 Write( const void* pData, sal_Int32 nSize ) override;
+ virtual sal_uInt64 Seek( sal_uInt64 nPos ) override;
+ virtual sal_uInt64 Tell() override;
+ virtual void Flush() override;
+ virtual bool SetSize( sal_uInt64 nNewSize ) override;
+ virtual sal_uInt64 GetSize() const override;
+ virtual void CopyTo( BaseStorageStream * pDestStm ) override;
+ virtual bool Commit() override;
+ virtual bool Validate( bool=false ) const override;
+ virtual bool ValidateMode( StreamMode ) const override;
+ virtual bool Equals( const BaseStorageStream& rStream ) const override;
+ bool SetProperty( const OUString& rName, const css::uno::Any& rValue );
+
+ SvStream* GetModifySvStream();
+};
+
+namespace ucbhelper
+{
+ class Content;
+}
+
+class UCBStorage_Impl;
+struct UCBStorageElement_Impl;
+class SOT_DLLPUBLIC UCBStorage final : public BaseStorage
+{
+ UCBStorage_Impl* pImp;
+
+ virtual ~UCBStorage() override;
+public:
+ static bool IsStorageFile( SvStream* );
+
+ UCBStorage( const ::ucbhelper::Content& rContent,
+ const OUString& rName,
+ StreamMode nMode,
+ bool bDirect,
+ bool bIsRoot );
+
+ UCBStorage( const OUString& rName,
+ StreamMode nMode,
+ bool bDirect,
+ bool bIsRoot );
+
+ UCBStorage( const OUString& rName,
+ StreamMode nMode,
+ bool bDirect,
+ bool bIsRoot,
+ bool bIsRepair,
+ css::uno::Reference< css::ucb::XProgressHandler > const &
+ xProgressHandler );
+
+ UCBStorage( UCBStorage_Impl* );
+
+ UCBStorage( SvStream& rStrm, bool bDirect );
+
+ virtual const OUString& GetName() const override;
+ virtual bool IsRoot() const override;
+ virtual void SetClassId( const ClsId& ) override;
+ virtual const ClsId& GetClassId() const override;
+ virtual void SetDirty() override;
+ virtual void SetClass( const SvGlobalName & rClass,
+ SotClipboardFormatId nOriginalClipFormat,
+ const OUString & rUserTypeName ) override;
+ virtual SvGlobalName GetClassName() override;
+ virtual SotClipboardFormatId GetFormat() override;
+ virtual OUString GetUserName() override;
+ virtual void FillInfoList( SvStorageInfoList* ) const override;
+ virtual bool CopyTo( BaseStorage* pDestStg ) const override;
+ virtual bool Commit() final override;
+ virtual bool Revert() override;
+ virtual BaseStorageStream* OpenStream( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = true ) override;
+ virtual BaseStorage* OpenStorage( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = false ) override;
+ virtual BaseStorage* OpenUCBStorage( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = false ) override;
+ virtual BaseStorage* OpenOLEStorage( const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool bDirect = false ) override;
+ virtual bool IsStream( const OUString& rEleName ) const override;
+ virtual bool IsStorage( const OUString& rEleName ) const override;
+ virtual bool IsContained( const OUString& rEleName ) const override;
+ virtual void Remove( const OUString & rEleName ) override;
+ virtual bool CopyTo( const OUString & rEleName, BaseStorage * pDest, const OUString & rNewName ) override;
+ virtual bool ValidateFAT() override;
+ virtual bool Validate( bool=false ) const override;
+ virtual bool ValidateMode( StreamMode ) const override;
+ virtual bool Equals( const BaseStorage& rStream ) const override;
+
+ UCBStorageElement_Impl* FindElement_Impl( std::u16string_view rName ) const;
+ bool CopyStorageElement_Impl( UCBStorageElement_Impl const & rElement,
+ BaseStorage* pDest, const OUString& rNew ) const;
+ BaseStorage* OpenStorage_Impl( const OUString & rEleName,
+ StreamMode, bool bDirect, bool bForceUCBStorage );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/storage.hxx b/include/sot/storage.hxx
new file mode 100644
index 000000000..dd44b0206
--- /dev/null
+++ b/include/sot/storage.hxx
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SOT_STORAGE_HXX
+#define INCLUDED_SOT_STORAGE_HXX
+
+#include <sot/object.hxx>
+#include <tools/stream.hxx>
+#include <tools/globname.hxx>
+#include <vcl/errcode.hxx>
+#include <sot/storinfo.hxx>
+#include <sot/sotdllapi.h>
+
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::uno { class Any; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+enum class SotClipboardFormatId : sal_uInt32;
+
+class BaseStorageStream;
+
+class SOT_DLLPUBLIC SotTempStream final : virtual public SvRefBase, public SvStream
+{
+friend class SotStorage;
+
+ virtual ~SotTempStream() override;
+public:
+ SotTempStream(OUString const & rString, StreamMode = StreamMode::STD_READWRITE);
+
+ void CopyTo(SotTempStream * pDestStm);
+};
+
+class SOT_DLLPUBLIC SotStorageStream final : virtual public SotObject, public SvStream
+{
+friend class SotStorage;
+ BaseStorageStream * pOwnStm; // pointer to the own stream
+
+ virtual std::size_t GetData(void* pData, std::size_t nSize) override;
+ virtual std::size_t PutData(const void* pData, std::size_t nSize) override;
+ virtual sal_uInt64 SeekPos(sal_uInt64 nPos) override;
+ virtual void FlushData() override;
+
+ virtual ~SotStorageStream() override;
+public:
+ SotStorageStream(BaseStorageStream *pBaseStream);
+
+ virtual void ResetError() override;
+
+ virtual void SetSize(sal_uInt64 nNewSize) override;
+ sal_uInt32 GetSize() const;
+ void Commit();
+ bool SetProperty(OUString const & rName, css::uno::Any const & rValue);
+ virtual sal_uInt64 TellEnd() override;
+};
+
+class BaseStorage;
+class SOT_DLLPUBLIC SotStorage final : virtual public SotObject
+{
+friend class SotStorageStream;
+
+ BaseStorage* m_pOwnStg; // target storage
+ SvStream* m_pStorStm; // only for SDSTORAGES
+ ErrCode m_nError;
+ OUString m_aName;// name of the storage
+ bool m_bIsRoot; // e.g.: File Storage
+ bool m_bDelStm;
+ OString m_aKey; // aKey.Len != 0 -> encryption
+ sal_Int32 m_nVersion;
+
+ virtual ~SotStorage() override;
+ void CreateStorage(bool bUCBStorage, StreamMode);
+public:
+ SotStorage(OUString const & rString, StreamMode eMode = StreamMode::STD_READWRITE);
+ SotStorage(bool bUCBStorage, const OUString & rString,
+ StreamMode = StreamMode::STD_READWRITE);
+ SotStorage(BaseStorage * pStorage);
+ SotStorage(SvStream & rStream);
+ SotStorage(bool bUCBStorage, SvStream & rStream);
+ SotStorage(SvStream * rStream, bool bDelete);
+
+ std::unique_ptr<SvMemoryStream> CreateMemoryStream();
+
+ static bool IsStorageFile(OUString const & rFileName);
+ static bool IsStorageFile(SvStream* pStream);
+
+ const OUString& GetName() const;
+
+ bool Validate();
+
+ const OString& GetKey() const { return m_aKey;}
+
+ void SetVersion(sal_Int32 nVersion)
+ {
+ m_nVersion = nVersion;
+ }
+ sal_Int32 GetVersion() const
+ {
+ return m_nVersion;
+ }
+
+ ErrCode GetError() const
+ {
+ return m_nError.IgnoreWarning();
+ }
+ void SetError(ErrCode nErrorCode)
+ {
+ if (m_nError == ERRCODE_NONE)
+ m_nError = nErrorCode;
+ }
+
+ void SignAsRoot(bool bRoot) { m_bIsRoot = bRoot; }
+
+ // own data sector
+ void SetClass(const SvGlobalName & rClass,
+ SotClipboardFormatId bOriginalClipFormat,
+ const OUString & rUserTypeName);
+
+ SvGlobalName GetClassName(); // type of data in the storage
+ SotClipboardFormatId GetFormat();
+ OUString GetUserName();
+
+ // list of all elements
+ void FillInfoList(SvStorageInfoList *) const;
+ bool CopyTo(SotStorage * pDestStg);
+ bool Commit();
+
+ // create stream with connection to Storage,
+ // more or less a Parent-Child relationship
+ tools::SvRef<SotStorageStream> OpenSotStream(const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE);
+ SotStorage* OpenSotStorage(const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool transacted = true);
+
+ // query whether Storage or Stream
+ bool IsStream( const OUString & rEleName ) const;
+ bool IsStorage( const OUString & rEleName ) const;
+ bool IsContained( const OUString & rEleName ) const;
+ // remove element
+ bool Remove(const OUString & rEleName);
+ bool CopyTo(const OUString & rEleName, SotStorage* pDest,
+ const OUString & rNewName);
+
+ bool IsOLEStorage() const;
+ static bool IsOLEStorage(const OUString & rFileName);
+ static bool IsOLEStorage(SvStream* pStream);
+
+ static SotStorage* OpenOLEStorage(css::uno::Reference<css::embed::XStorage> const & xStorage,
+ OUString const & rEleName, StreamMode = StreamMode::STD_READWRITE);
+ static SotClipboardFormatId GetFormatID(css::uno::Reference<css::embed::XStorage> const & xStorage);
+ static sal_Int32 GetVersion(css::uno::Reference<css::embed::XStorage> const & xStorage);
+};
+
+#endif // INCLUDED_SOT_STORAGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/storinfo.hxx b/include/sot/storinfo.hxx
new file mode 100644
index 000000000..c1283cffe
--- /dev/null
+++ b/include/sot/storinfo.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SOT_STORINFO_HXX
+#define INCLUDED_SOT_STORINFO_HXX
+
+#include <rtl/ustring.hxx>
+#include <utility>
+#include <vector>
+#include <sot/sotdllapi.h>
+#include <sot/formats.hxx>
+
+class StgDirEntry;
+class SvStream;
+
+class SvStorageInfo
+{
+ friend class SotStorage;
+ OUString aName;
+ sal_uInt64 nSize;
+ bool bStream;
+ bool bStorage;
+
+public:
+ SvStorageInfo(const StgDirEntry&);
+ SvStorageInfo(OUString _aName, sal_uInt64 nSz, bool bIsStorage)
+ : aName(std::move(_aName))
+ , nSize(nSz)
+ , bStream(!bIsStorage)
+ , bStorage(bIsStorage)
+ {
+ }
+
+ const OUString& GetName() const { return aName; }
+ bool IsStream() const { return bStream; }
+ bool IsStorage() const { return bStorage; }
+ sal_uInt64 GetSize() const { return nSize; }
+};
+
+typedef std::vector<SvStorageInfo> SvStorageInfoList;
+
+SotClipboardFormatId ReadClipboardFormat(SvStream& rStm);
+SOT_DLLPUBLIC void WriteClipboardFormat(SvStream& rStm, SotClipboardFormatId nFormat);
+
+#endif // _STORINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/store/store.h b/include/store/store.h
new file mode 100644
index 000000000..2fdfa4a30
--- /dev/null
+++ b/include/store/store.h
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <store/storedllapi.h>
+#include <store/types.h>
+#include <rtl/ustring.h>
+#include <sal/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Handle opaque type.
+ */
+typedef void* storeHandle;
+
+/** Acquire a Handle.
+ @param Handle [in] the Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError store_acquireHandle (
+ storeHandle Handle
+) SAL_THROW_EXTERN_C();
+
+/** Release a Handle.
+ @param Handle [in] the Handle.
+ @return store_E_None upon success,
+ store_E_InvalidHandle otherwise.
+ */
+STORE_DLLPUBLIC storeError store_releaseHandle (
+ storeHandle Handle
+) SAL_THROW_EXTERN_C();
+
+/** File Handle opaque type.
+ */
+typedef void* storeFileHandle;
+
+/** Open a temporary file in memory.
+ @param nPageSize [in] the creation page size,
+ integer multiple of minimum page size.
+ @param phFile [out] the File Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError store_createMemoryFile (
+ sal_uInt16 nPageSize,
+ storeFileHandle *phFile
+) SAL_THROW_EXTERN_C();
+
+/** Open a file.
+ @param pFilename [in] the filename as URL or system path.
+ @param eAccessMode [in] the access mode.
+ storeAccessMode::Create truncate existing and create,
+ store_AccessReadCreate create not existing,
+ storeAccessMode::ReadWrite write existing,
+ storeAccessMode::ReadOnly never modifies.
+ @param nPageSize [in] the creation page size,
+ integer multiple of minimum page size.
+ @param phFile [out] the File Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError store_openFile (
+ rtl_uString *pFilename,
+ storeAccessMode eAccessMode,
+ sal_uInt16 nPageSize,
+ storeFileHandle *phFile
+) SAL_THROW_EXTERN_C();
+
+/** Close a file.
+ @param hFile [in] the File Handle.
+ @return store_E_None upon success,
+ store_E_InvalidHandle otherwise.
+ */
+STORE_DLLPUBLIC storeError store_closeFile (
+ storeFileHandle hFile
+) SAL_THROW_EXTERN_C();
+
+/** Flush a file.
+ @param hFile [in] the File Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError store_flushFile (
+ storeFileHandle hFile
+) SAL_THROW_EXTERN_C();
+
+/** Directory Handle opaque type.
+ */
+typedef void* storeDirectoryHandle;
+
+/** Open a directory.
+ @see store_openFile()
+
+ @param hFile [in] the File Handle.
+ @param pPath [in] the directory path.
+ @param pName [in] the directory name.
+ @param eAccessMode [in] the access mode.
+ @param phDirectory [out] the Directory Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError store_openDirectory (
+ storeFileHandle hFile,
+ rtl_uString const *pPath,
+ rtl_uString const *pName,
+ storeAccessMode eAccessMode,
+ storeDirectoryHandle *phDirectory
+) SAL_THROW_EXTERN_C();
+
+/** Find first directory entry.
+ @param hDirectory [in] the Directory Handle.
+ @param pFindData [out] the Find Data structure.
+ @return store_E_None upon success,
+ store_E_NoMoreFile upon end of iteration.
+ */
+STORE_DLLPUBLIC storeError store_findFirst (
+ storeDirectoryHandle hDirectory,
+ storeFindData *pFindData
+) SAL_THROW_EXTERN_C();
+
+/** Find next directory entry.
+ @param hDirectory [in] the Directory Handle.
+ @param pFindData [out] the Find Data structure.
+ @return store_E_None upon success,
+ store_E_NoMoreFile upon end of iteration.
+ */
+STORE_DLLPUBLIC storeError store_findNext (
+ storeDirectoryHandle hDirectory,
+ storeFindData *pFindData
+) SAL_THROW_EXTERN_C();
+
+/** Stream Handle opaque type.
+ */
+typedef void* storeStreamHandle;
+
+/** Open a stream.
+ @see store_openFile()
+
+ @param hFile [in] the File Handle.
+ @param pPath [in] the stream path.
+ @param pName [in] the stream name.
+ @param eMode [in] the access mode.
+ @param phStrm [out] the Stream Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError store_openStream (
+ storeFileHandle hFile,
+ rtl_uString const *pPath,
+ rtl_uString const *pName,
+ storeAccessMode eMode,
+ storeStreamHandle *phStrm
+) SAL_THROW_EXTERN_C();
+
+/** Read from a stream.
+ @param hStrm [in] the Stream Handle.
+ @param nOffset [in] the offset of the first byte to read.
+ @param pBuffer [out] the buffer.
+ @param nBytes [in] the number of bytes to read.
+ @param pnDone [out] the number of bytes actually read.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError store_readStream (
+ storeStreamHandle hStrm,
+ sal_uInt32 nOffset,
+ void *pBuffer,
+ sal_uInt32 nBytes,
+ sal_uInt32 *pnDone
+) SAL_THROW_EXTERN_C();
+
+/** Write to a stream.
+ @param hStrm [in] the Stream Handle.
+ @param nOffset [in] the offset of the first byte to write.
+ @param pBuffer [in] the buffer.
+ @param nBytes [in] the number of bytes to write.
+ @param pnDone [out] the number of bytes actually written.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError store_writeStream (
+ storeStreamHandle hStrm,
+ sal_uInt32 nOffset,
+ const void *pBuffer,
+ sal_uInt32 nBytes,
+ sal_uInt32 *pnDone
+) SAL_THROW_EXTERN_C();
+
+/** Remove a file entry.
+ @param hFile [in] the File Handle
+ @param pPath [in] the entry path
+ @param pName [in] the entry name
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError store_remove (
+ storeFileHandle hFile,
+ rtl_uString const *pPath,
+ rtl_uString const *pName
+) SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/store/store.hxx b/include/store/store.hxx
new file mode 100644
index 000000000..d32ceefbe
--- /dev/null
+++ b/include/store/store.hxx
@@ -0,0 +1,353 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <store/store.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <store/types.h>
+
+namespace store
+{
+
+class OStoreStream
+{
+public:
+ /** Construction.
+ */
+ OStoreStream()
+ : m_hImpl (nullptr)
+ {}
+
+ /** Destruction.
+ */
+ ~OStoreStream()
+ {
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ }
+
+ /** Copy construction.
+ */
+ OStoreStream (OStoreStream const & rhs)
+ : m_hImpl (rhs.m_hImpl)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
+
+ /** Assignment.
+ */
+ OStoreStream & operator= (OStoreStream const & rhs)
+ {
+ if (rhs.m_hImpl)
+ (void) store_acquireHandle (rhs.m_hImpl);
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = rhs.m_hImpl;
+ return *this;
+ }
+
+ /** Open the stream.
+ @see store_openStream()
+ */
+ storeError create (
+ storeFileHandle hFile,
+ OUString const & rPath,
+ OUString const & rName,
+ storeAccessMode eMode)
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = nullptr;
+ }
+ return store_openStream (hFile, rPath.pData, rName.pData, eMode, &m_hImpl);
+ }
+
+ /** Read from the stream.
+ @see store_readStream()
+ */
+ storeError readAt (
+ sal_uInt32 nOffset,
+ void * pBuffer,
+ sal_uInt32 nBytes,
+ sal_uInt32 & rnDone)
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_readStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone);
+ }
+
+ /** Write to the stream.
+ @see store_writeStream()
+ */
+ storeError writeAt (
+ sal_uInt32 nOffset,
+ void const * pBuffer,
+ sal_uInt32 nBytes,
+ sal_uInt32 & rnDone)
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_writeStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone);
+ }
+
+private:
+ /** Representation.
+ */
+ storeStreamHandle m_hImpl;
+};
+
+class OStoreDirectory
+{
+public:
+ /** Construction.
+ */
+ OStoreDirectory()
+ : m_hImpl (nullptr)
+ {}
+
+ /** Destruction.
+ */
+ ~OStoreDirectory()
+ {
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ }
+
+ /** Copy construction.
+ */
+ OStoreDirectory (OStoreDirectory const & rhs)
+ : m_hImpl (rhs.m_hImpl)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
+
+ /** Move construction.
+ */
+ OStoreDirectory (OStoreDirectory && rhs) noexcept
+ : m_hImpl (rhs.m_hImpl)
+ {
+ rhs.m_hImpl = nullptr;
+ }
+
+ /** Assignment.
+ */
+ OStoreDirectory & operator= (OStoreDirectory const & rhs)
+ {
+ if (rhs.m_hImpl)
+ (void) store_acquireHandle (rhs.m_hImpl);
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = rhs.m_hImpl;
+ return *this;
+ }
+
+ /** Move assignment.
+ */
+ OStoreDirectory & operator= (OStoreDirectory && rhs) noexcept
+ {
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = rhs.m_hImpl;
+ rhs.m_hImpl = nullptr;
+ return *this;
+ }
+
+ /** Open the directory.
+ @see store_openDirectory()
+ */
+ storeError create (
+ storeFileHandle hFile,
+ OUString const & rPath,
+ OUString const & rName,
+ storeAccessMode eMode)
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = nullptr;
+ }
+ return store_openDirectory (hFile, rPath.pData, rName.pData, eMode, &m_hImpl);
+ }
+
+ /** Directory iterator type.
+ @see first()
+ @see next()
+ */
+ typedef storeFindData iterator;
+
+ /** Find first directory entry.
+ @see store_findFirst()
+ */
+ storeError first (iterator& it)
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_findFirst (m_hImpl, &it);
+ }
+
+ /** Find next directory entry.
+ @see store_findNext()
+ */
+ storeError next (iterator& it)
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_findNext (m_hImpl, &it);
+ }
+
+private:
+ /** Representation.
+ */
+ storeDirectoryHandle m_hImpl;
+};
+
+class OStoreFile
+{
+public:
+ /** Construction.
+ */
+ OStoreFile()
+ : m_hImpl (nullptr)
+ {}
+
+ /** Destruction.
+ */
+ ~OStoreFile()
+ {
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ }
+
+ /** Copy construction.
+ */
+ OStoreFile (OStoreFile const & rhs)
+ : m_hImpl (rhs.m_hImpl)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
+
+ /** Assignment.
+ */
+ OStoreFile & operator= (OStoreFile const & rhs)
+ {
+ if (rhs.m_hImpl)
+ (void) store_acquireHandle (rhs.m_hImpl);
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = rhs.m_hImpl;
+ return *this;
+ }
+
+ /** Conversion into File Handle.
+ */
+ operator storeFileHandle() const
+ {
+ return m_hImpl;
+ }
+
+ /** Check for a valid File Handle.
+ @return sal_True if valid, sal_False otherwise.
+ */
+ bool isValid() const
+ {
+ return (m_hImpl != nullptr);
+ }
+
+ /** Open the file.
+ @see store_openFile()
+ */
+ storeError create(
+ OUString const & rFilename,
+ storeAccessMode eAccessMode )
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = nullptr;
+ }
+ return store_openFile (rFilename.pData, eAccessMode, STORE_DEFAULT_PAGESIZE, &m_hImpl);
+ }
+
+ /** Open the temporary file in memory.
+ @see store_createMemoryFile()
+ */
+ storeError createInMemory ()
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = nullptr;
+ }
+ return store_createMemoryFile (STORE_DEFAULT_PAGESIZE, &m_hImpl);
+ }
+
+ /** Close the file.
+ @see store_closeFile()
+ */
+ void close()
+ {
+ if (m_hImpl)
+ {
+ (void) store_closeFile (m_hImpl);
+ m_hImpl = nullptr;
+ }
+ }
+
+ /** Flush the file.
+ @see store_flushFile()
+ */
+ storeError flush() const
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_flushFile (m_hImpl);
+ }
+
+ /** Remove a file entry.
+ @see store_remove()
+ */
+ storeError remove (
+ OUString const & rPath, OUString const & rName)
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_remove (m_hImpl, rPath.pData, rName.pData);
+ }
+
+private:
+ /** Representation.
+ */
+ storeFileHandle m_hImpl;
+};
+
+} // namespace store
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/store/storedllapi.h b/include/store/storedllapi.h
new file mode 100644
index 000000000..14a0d2feb
--- /dev/null
+++ b/include/store/storedllapi.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/types.h>
+
+#if defined(STORE_DLLIMPLEMENTATION)
+#define STORE_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define STORE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/store/types.h b/include/store/types.h
new file mode 100644
index 000000000..7abf012ea
--- /dev/null
+++ b/include/store/types.h
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** PageSize (recommended) default.
+ @see store_openFile()
+ */
+constexpr sal_uInt16 STORE_DEFAULT_PAGESIZE = 0x0400;
+
+
+/** PageSize (enforced) limits.
+ @see store_openFile()
+ */
+constexpr sal_uInt16 STORE_MINIMUM_PAGESIZE = 0x0200;
+constexpr sal_uInt16 STORE_MAXIMUM_PAGESIZE = 0x8000;
+
+
+/** NameSize (enforced) limit.
+ @see any param pName
+ @see store_E_NameTooLong
+ */
+constexpr auto STORE_MAXIMUM_NAMESIZE = 256;
+
+
+/** Attributes (predefined).
+ @see store_attrib()
+ */
+constexpr sal_uInt32 STORE_ATTRIB_ISLINK = 0x10000000;
+constexpr sal_uInt32 STORE_ATTRIB_ISDIR = 0x20000000;
+constexpr sal_uInt32 STORE_ATTRIB_ISFILE = 0x40000000;
+
+
+/** Access Mode enumeration.
+ @see store_openFile()
+ @see store_openDirectory()
+ @see store_openStream()
+ */
+enum class storeAccessMode
+{
+ Create,
+ ReadWrite,
+ ReadOnly,
+ FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+
+/** Error Code enumeration.
+ */
+typedef enum
+{
+ store_E_None = 0,
+ store_E_AccessViolation,
+ store_E_LockingViolation,
+ store_E_CantSeek,
+ store_E_CantRead,
+ store_E_CantWrite,
+ store_E_InvalidAccess,
+ store_E_InvalidHandle,
+ store_E_InvalidParameter,
+ store_E_InvalidChecksum,
+ store_E_AlreadyExists,
+ store_E_NotExists,
+ store_E_NotDirectory,
+ store_E_NotFile,
+ store_E_NoMoreFiles,
+ store_E_NameTooLong,
+ store_E_OutOfMemory,
+ store_E_OutOfSpace,
+ store_E_Pending,
+ store_E_WrongFormat,
+ store_E_WrongVersion,
+ store_E_Unknown,
+ store_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} storeError;
+
+
+/** Find Data structure.
+ @see store_findFirst()
+ @see store_findNext()
+ */
+typedef struct
+{
+ /** Name.
+ @see m_nLength
+ */
+ sal_Unicode m_pszName[STORE_MAXIMUM_NAMESIZE];
+
+ /** Name Length.
+ @see m_pszName
+ */
+ sal_Int32 m_nLength;
+
+ /** Attributes.
+ @see store_attrib()
+ */
+ sal_uInt32 m_nAttrib;
+
+ /** Reserved for internal use.
+ */
+ sal_uInt32 m_nReserved;
+} storeFindData;
+
+#ifdef __cplusplus
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/IndexedStyleSheets.hxx b/include/svl/IndexedStyleSheets.hxx
new file mode 100644
index 000000000..910acd9e2
--- /dev/null
+++ b/include/svl/IndexedStyleSheets.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVL_INDEXEDSTYLESHEETS_HXX
+#define INCLUDED_SVL_INDEXEDSTYLESHEETS_HXX
+
+#include <svl/style.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
+
+#include <svl/svldllapi.h>
+
+#include <unordered_map>
+#include <vector>
+
+namespace svl
+{
+/** Function object to check whether a style sheet a fulfills specific criteria.
+ * Derive from this class and override the Check() method.
+ */
+struct StyleSheetPredicate
+{
+ virtual bool Check(const SfxStyleSheetBase& styleSheet) = 0;
+ virtual ~StyleSheetPredicate() {}
+};
+
+/** Function object for cleanup-Strategy for IndexedSfxStyleSheets::Clear().
+ * Derive from it and do what is necessary to dispose of a style sheet in Dispose().
+ */
+struct StyleSheetDisposer
+{
+ virtual void Dispose(rtl::Reference<SfxStyleSheetBase> styleSheet) = 0;
+ virtual ~StyleSheetDisposer() {}
+};
+
+/** Function object to apply a method on all style sheets.
+ * Derive from it and do whatever you want to with the style sheet in the DoIt() method.
+ */
+struct StyleSheetCallback
+{
+ virtual void DoIt(const SfxStyleSheetBase& styleSheet) = 0;
+ virtual ~StyleSheetCallback() {}
+};
+
+/** This class holds SfxStyleSheets and allows for access via an id and a name.
+ *
+ * @warning
+ * The identification of style sheets happens by their name. If the name of a sheet changes,
+ * it will not be found again! Please call Reindex() after changing a style sheet's name.
+ *
+ * @internal
+ * This class was implemented to mitigate solve #fdo 30770.
+ * The issue describes an Excel file which takes several hours to open.
+ * An analysis revealed that the time is spent searching for style sheets with linear scans in an array.
+ * This class implements access to the style sheets via their name in (usually) constant time.
+ *
+ * The return type for most methods is a vector of unsigned integers which denote the position
+ * of the style sheets in the vector, and not of pointers to style sheets.
+ * You will need a non-const StyleSheetPool to obtain the actual style sheets.
+ *
+ *
+ * Index-based access is required in several code portions. Hence we have to store the style sheets
+ * in a vector as well as in a map.
+ */
+class SVL_DLLPUBLIC IndexedStyleSheets final
+{
+public:
+ IndexedStyleSheets();
+
+ /** Destructor.
+ *
+ * @internal
+ * Is explicit because it has to know how to dispose of SfxStyleSheetBase objects.
+ */
+ ~IndexedStyleSheets();
+
+ /** Adds a style sheet.
+ *
+ * If the style sheet is already contained, this call has no effect.
+ */
+ void AddStyleSheet(const rtl::Reference<SfxStyleSheetBase>& style);
+
+ /** Removes a style sheet. */
+ bool RemoveStyleSheet(const rtl::Reference<SfxStyleSheetBase>& style);
+
+ /** Check whether a specified style sheet is stored. */
+ bool HasStyleSheet(const rtl::Reference<SfxStyleSheetBase>& style) const;
+
+ /** Obtain the number of style sheets which are held */
+ sal_Int32 GetNumberOfStyleSheets() const;
+
+ /** Obtain the number of style sheets for which a certain condition holds */
+ sal_Int32 GetNumberOfStyleSheetsWithPredicate(StyleSheetPredicate& predicate) const;
+
+ /** Return the stylesheet by its position.
+ * You can obtain the position by, e.g., FindStyleSheetPosition()
+ * @internal
+ * Method is not const because the returned style sheet is not const
+ */
+ SfxStyleSheetBase* GetStyleSheetByPosition(sal_Int32 pos);
+
+ /** Find the position of a provided style.
+ *
+ * @throws std::runtime_error if the style has not been found.
+ */
+ sal_Int32 FindStyleSheetPosition(const SfxStyleSheetBase& style) const;
+
+ /** Obtain the positions of all styles which have a given name
+ */
+ std::vector<sal_Int32> FindPositionsByName(const OUString& name) const;
+
+ enum class SearchBehavior
+ {
+ ReturnAll,
+ ReturnFirst
+ };
+ /** Obtain the positions of all styles which have a certain name and fulfill a certain condition.
+ *
+ * This method is fast because it can use the name-based index
+ */
+ std::vector<sal_Int32>
+ FindPositionsByNameAndPredicate(const OUString& name, StyleSheetPredicate& predicate,
+ SearchBehavior behavior = SearchBehavior::ReturnAll) const;
+
+ /** Obtain the positions of all styles which fulfill a certain condition.
+ *
+ * This method is slow because it cannot use the name-based index
+ */
+ std::vector<sal_Int32> FindPositionsByPredicate(StyleSheetPredicate& predicate) const;
+
+ /** Execute a callback on all style sheets */
+ void ApplyToAllStyleSheets(StyleSheetCallback& callback) const;
+
+ /** Clear the contents of the index.
+ * The StyleSheetDisposer::Dispose() method is called on each style sheet, e.g., if you want to broadcast
+ * changes.
+ */
+ void Clear(StyleSheetDisposer& cleanup);
+
+ void Reindex();
+
+ /** Warning: counting for n starts at 0, i.e., the 0th style sheet is the first that is found. */
+ SfxStyleSheetBase* GetNthStyleSheetThatMatchesPredicate(sal_Int32 n,
+ StyleSheetPredicate& predicate,
+ sal_Int32 startAt = 0);
+
+ /** Get the positions of the style sheets which belong to a certain family.
+ */
+ const std::vector<sal_Int32>& GetStyleSheetPositionsByFamily(SfxStyleFamily) const;
+
+private:
+ /** Register the position of a styleName in the index */
+ void Register(const SfxStyleSheetBase& style, sal_Int32 pos);
+
+ typedef std::vector<rtl::Reference<SfxStyleSheetBase>> VectorType;
+ /** Vector with the stylesheets to allow for index-based access.
+ */
+ VectorType mStyleSheets;
+
+ /** The map type that is used to store the mapping from strings to ids in mStyleSheets
+ *
+ * @internal
+ * Must be an unordered map. A regular map is too slow for some files. */
+ typedef std::unordered_multimap<OUString, unsigned> MapType;
+
+ /** A map which stores the positions of style sheets by their name */
+ MapType mPositionsByName;
+
+ std::vector<std::vector<sal_Int32>> mStyleSheetPositionsByFamily;
+};
+
+} /* namespace svl */
+
+#endif // INCLUDED_SVL_INDEXEDSTYLESHEETS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/PasswordHelper.hxx b/include/svl/PasswordHelper.hxx
new file mode 100644
index 000000000..aa7e55867
--- /dev/null
+++ b/include/svl/PasswordHelper.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_PASSWORDHELPER_HXX
+#define INCLUDED_SVL_PASSWORDHELPER_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <svl/svldllapi.h>
+#include <sal/types.h>
+#include <com/sun/star/uno/Sequence.hxx>
+
+class SvPasswordHelper
+{
+ static void GetHashPasswordLittleEndian(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
+ static void GetHashPasswordBigEndian(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
+
+public:
+ SVL_DLLPUBLIC static void GetHashPassword(css::uno::Sequence <sal_Int8>& rPassHash, const char* pPass, sal_uInt32 nLen);
+
+ SVL_DLLPUBLIC static void GetHashPassword(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
+ SVL_DLLPUBLIC static void GetHashPasswordSHA1UTF8(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
+ SVL_DLLPUBLIC static void GetHashPasswordSHA256(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
+ /**
+ Use this method to compare a given string with another given Hash value.
+ This is necessary, because in older versions exists different hashes of the same string. They were endian dependent.
+ We need this to handle old files. This method will compare against big and
+ little endian UTF-16.
+ tdf#115483: also check 2 different new ways of hashing that were added in
+ ODF 1.2, requiring UTF-8 encoding.
+ */
+ SVL_DLLPUBLIC static bool CompareHashPassword(const css::uno::Sequence<sal_Int8>& rOldPassHash, std::u16string_view sNewPass);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/SfxBroadcaster.hxx b/include/svl/SfxBroadcaster.hxx
new file mode 100644
index 000000000..2c05a6abf
--- /dev/null
+++ b/include/svl/SfxBroadcaster.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_BRDCST_HXX
+#define INCLUDED_SVL_BRDCST_HXX
+
+#include <svl/svldllapi.h>
+#include <vector>
+
+class SfxListener;
+class SfxHint;
+class SfxBroadcasterTest;
+
+class SVL_DLLPUBLIC SfxBroadcaster
+{
+ /** Contains the positions of removed listeners. */
+ std::vector<size_t> m_RemovedPositions;
+ std::vector<SfxListener*> m_Listeners;
+
+private:
+ void AddListener( SfxListener& rListener );
+ void RemoveListener( SfxListener& rListener );
+ const SfxBroadcaster& operator=(const SfxBroadcaster &) = delete;
+
+protected:
+ void Forward(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+public:
+
+ SfxBroadcaster() {}
+ SfxBroadcaster( const SfxBroadcaster &rBC );
+ virtual ~SfxBroadcaster() COVERITY_NOEXCEPT_FALSE;
+
+ void Broadcast( const SfxHint &rHint );
+ bool HasListeners() const;
+
+ /** Get the number of listeners which are registered at this broadcaster */
+ size_t GetListenerCount() const;
+
+ /** Get the size of the internally stored vector.
+ * Use it to iterate over all listeners.
+ */
+ size_t GetSizeOfVector() const;
+
+ /** Get a listener by its position in the internally stored vector.
+ * Note that this method may return NULL
+ */
+ SfxListener* GetListener( size_t nNo ) const;
+
+ friend class SfxListener;
+ friend class ::SfxBroadcasterTest;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/adrparse.hxx b/include/svl/adrparse.hxx
new file mode 100644
index 000000000..f19fc7ef0
--- /dev/null
+++ b/include/svl/adrparse.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_ADRPARSE_HXX
+#define INCLUDED_SVL_ADRPARSE_HXX
+
+#include <rtl/ustring.hxx>
+#include <svl/svldllapi.h>
+#include <vector>
+
+
+class SVL_DLLPUBLIC SvAddressParser
+{
+ friend class SvAddressParser_Impl;
+
+ ::std::vector< OUString >
+ m_vAddresses;
+
+public:
+ SvAddressParser(const OUString& rInput);
+
+ ~SvAddressParser();
+
+ sal_Int32 Count() const { return m_vAddresses.size(); }
+
+ const OUString& GetEmailAddress(sal_Int32 nIndex) const
+ {
+ return m_vAddresses[nIndex];
+ }
+};
+
+#endif // INCLUDED_SVL_ADRPARSE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/aeitem.hxx b/include/svl/aeitem.hxx
new file mode 100644
index 000000000..447e6d710
--- /dev/null
+++ b/include/svl/aeitem.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_AEITEM_HXX
+#define INCLUDED_SVL_AEITEM_HXX
+
+#include <config_options.h>
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+
+#include <vector>
+
+class UNLESS_MERGELIBS(SVL_DLLPUBLIC) SfxAllEnumItem final : public SfxPoolItem
+{
+ std::vector<OUString> m_Values;
+
+public:
+ explicit SfxAllEnumItem( sal_uInt16 nWhich);
+ SfxAllEnumItem( const SfxAllEnumItem & );
+ virtual ~SfxAllEnumItem() override;
+
+ void SetTextByPos( sal_uInt16 nPos, const OUString &rText );
+ OUString const & GetTextByPos( sal_uInt16 nPos ) const;
+ sal_Int32 GetTextCount() const;
+ virtual SfxAllEnumItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool operator==( SfxPoolItem const & ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/asiancfg.hxx b/include/svl/asiancfg.hxx
new file mode 100644
index 000000000..6ee88fe35
--- /dev/null
+++ b/include/svl/asiancfg.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_ASIANCFG_HXX
+#define INCLUDED_SVL_ASIANCFG_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <svl/svldllapi.h>
+
+namespace com::sun::star::lang {
+ struct Locale;
+}
+
+/// These constants define character compression in Asian text.
+/// Must match the values in com::sun::star::text::CharacterCompressionType.
+/// For bonus points, also appears to be directly stored in the ww8 file format.
+enum class CharCompressType {
+ NONE, /// No Compression
+ PunctuationOnly, /// Only punctuation is compressed
+ PunctuationAndKana, /// Punctuation and Japanese Kana are compressed.
+ Invalid = 0xff /// only used in SC
+};
+
+class SVL_DLLPUBLIC SvxAsianConfig {
+public:
+ SvxAsianConfig();
+ ~SvxAsianConfig();
+ SvxAsianConfig(const SvxAsianConfig&) = delete;
+ SvxAsianConfig& operator=( const SvxAsianConfig& ) = delete;
+
+ void Commit();
+
+ bool IsKerningWesternTextOnly() const;
+
+ void SetKerningWesternTextOnly(bool value);
+
+ CharCompressType GetCharDistanceCompression() const;
+
+ void SetCharDistanceCompression(CharCompressType value);
+
+ css::uno::Sequence< css::lang::Locale > GetStartEndCharLocales() const;
+
+ bool GetStartEndChars(
+ css::lang::Locale const & locale, OUString & startChars,
+ OUString & endChars) const;
+
+ void SetStartEndChars(
+ css::lang::Locale const & locale,
+ OUString const * startChars, OUString const * endChars);
+
+private:
+ struct Impl;
+
+ std::unique_ptr< Impl > impl_;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/broadcast.hxx b/include/svl/broadcast.hxx
new file mode 100644
index 000000000..30592d22c
--- /dev/null
+++ b/include/svl/broadcast.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_BROADCAST_HXX
+#define INCLUDED_SVL_BROADCAST_HXX
+
+#include <svl/svldllapi.h>
+
+#include <vector>
+
+class SvtListener;
+class SfxHint;
+
+class SVL_DLLPUBLIC SvtBroadcaster
+{
+public:
+ friend class SvtListener;
+
+ typedef std::vector<SvtListener*> ListenersType;
+
+private:
+ const SvtBroadcaster& operator=(const SvtBroadcaster &) = delete;
+
+ /**
+ * Ensure that the container doesn't contain any duplicated listener
+ * entries. As a side effect, the listeners get sorted by pointer values
+ * after this call.
+ */
+ void Normalize() const;
+
+ void Add( SvtListener* p );
+ void Remove( SvtListener* p );
+
+protected:
+ virtual void ListenersGone();
+
+public:
+ SvtBroadcaster()
+ : mnEmptySlots(0), mnListenersFirstUnsorted(0), mbAboutToDie(false)
+ , mbDisposing(false), mbDestNormalized(true) {}
+ SvtBroadcaster( const SvtBroadcaster &rBC );
+ virtual ~SvtBroadcaster();
+
+ void Broadcast( const SfxHint &rHint );
+
+ ListenersType& GetAllListeners();
+ const ListenersType& GetAllListeners() const;
+
+ bool HasListeners() const { return (maListeners.size() - mnEmptySlots) > 0; }
+
+ /**
+ * Listeners and broadcasters are M:N relationship. If you want to
+ * destruct them, you easily end up in O(M*N) situation; where for every
+ * listener, you iterate all broadcasters, to remove that one listener.
+ *
+ * To avoid that, use this call to announce to the broadcaster it is going
+ * to die, and the listeners do not have to bother with removing
+ * themselves from the broadcaster - the broadcaster will not broadcast
+ * anything after the PrepareForDestruction() call anyway.
+ */
+ void PrepareForDestruction();
+
+private:
+ /// contains only one of each listener, which is enforced by SvtListener
+ mutable ListenersType maListeners;
+
+ /// When the broadcaster is about to die, collect listeners that asked for removal.
+ mutable ListenersType maDestructedListeners;
+
+ /**
+ Note that this class is very performance sensitive, so the following fields have been
+ carefully sized and packed so we can access them quickly, while also taking as little CPU cache
+ space as possible (because e.g. calc can have a LOT of them)
+ */
+ mutable sal_Int32 mnEmptySlots;
+ // The first item in maListeners that is not sorted. The container can become large, so this optimizes sorting.
+ mutable sal_Int32 mnListenersFirstUnsorted;
+ /// Indicate that this broadcaster will be destructed (we indicate this on all ScColumn's broadcasters during the ScTable destruction, eg.)
+ bool mbAboutToDie:1;
+ bool mbDisposing:1;
+ // Whether maDestructedListeners is sorted or not.
+ mutable bool mbDestNormalized:1;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cenumitm.hxx b/include/svl/cenumitm.hxx
new file mode 100644
index 000000000..9428e095c
--- /dev/null
+++ b/include/svl/cenumitm.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_CENUMITM_HXX
+#define INCLUDED_SVL_CENUMITM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+
+class SVL_DLLPUBLIC SfxEnumItemInterface: public SfxPoolItem
+{
+protected:
+ explicit SfxEnumItemInterface(sal_uInt16 which): SfxPoolItem(which) {}
+
+ SfxEnumItemInterface(const SfxEnumItemInterface &) = default;
+
+public:
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&) const override;
+
+ virtual bool QueryValue(css::uno::Any & rVal, sal_uInt8 = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any & rVal, sal_uInt8 ) override;
+
+ virtual sal_uInt16 GetValueCount() const = 0;
+
+ virtual sal_uInt16 GetEnumValue() const = 0;
+
+ virtual void SetEnumValue(sal_uInt16 nValue) = 0;
+
+ virtual bool HasBoolValue() const;
+
+ virtual bool GetBoolValue() const;
+
+ virtual void SetBoolValue(bool bValue);
+};
+
+#endif // INCLUDED_SVL_CENUMITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cintitem.hxx b/include/svl/cintitem.hxx
new file mode 100644
index 000000000..bde59c399
--- /dev/null
+++ b/include/svl/cintitem.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_CINTITEM_HXX
+#define INCLUDED_SVL_CINTITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <tools/debug.hxx>
+#include <svl/poolitem.hxx>
+
+class SVL_DLLPUBLIC CntByteItem: public SfxPoolItem
+{
+ sal_uInt8 m_nValue;
+
+public:
+
+ CntByteItem(sal_uInt16 which, sal_uInt8 nTheValue):
+ SfxPoolItem(which), m_nValue(nTheValue) {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal,
+ sal_uInt8 nMemberId) override;
+
+ virtual CntByteItem* Clone(SfxItemPool * = nullptr) const override;
+
+ sal_uInt8 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_uInt8 nTheValue);
+};
+
+inline void CntByteItem::SetValue(sal_uInt8 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntByteItem::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+class SVL_DLLPUBLIC CntUInt16Item: public SfxPoolItem
+{
+ sal_uInt16 m_nValue;
+
+public:
+
+ CntUInt16Item(sal_uInt16 which, sal_uInt16 nTheValue):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal,
+ sal_uInt8 nMemberId) override;
+
+ virtual CntUInt16Item* Clone(SfxItemPool * = nullptr) const override;
+
+ sal_uInt16 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_uInt16 nTheValue);
+};
+
+inline void CntUInt16Item::SetValue(sal_uInt16 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntUInt16Item::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+class SVL_DLLPUBLIC CntInt32Item: public SfxPoolItem
+{
+ sal_Int32 m_nValue;
+
+public:
+
+ CntInt32Item(sal_uInt16 which, sal_Int32 nTheValue):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal,
+ sal_uInt8 nMemberId) override;
+
+ virtual CntInt32Item* Clone(SfxItemPool * = nullptr) const override;
+
+ sal_Int32 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_Int32 nTheValue);
+};
+
+inline void CntInt32Item::SetValue(sal_Int32 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntInt32Item::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+class SVL_DLLPUBLIC CntUInt32Item: public SfxPoolItem
+{
+ sal_uInt32 m_nValue;
+
+public:
+
+ CntUInt32Item(sal_uInt16 which, sal_uInt32 nTheValue):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal,
+ sal_uInt8 nMemberId) override;
+
+ virtual CntUInt32Item* Clone(SfxItemPool * = nullptr) const override;
+
+ sal_uInt32 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_uInt32 nTheValue);
+};
+
+inline void CntUInt32Item::SetValue(sal_uInt32 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntUInt32Item::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+#endif // INCLUDED_SVL_CINTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cjkoptions.hxx b/include/svl/cjkoptions.hxx
new file mode 100644
index 000000000..9ac227541
--- /dev/null
+++ b/include/svl/cjkoptions.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svl/svldllapi.h>
+
+namespace SvtCJKOptions
+{
+enum EOption
+{
+ E_CJKFONT,
+ E_VERTICALTEXT,
+ E_ASIANTYPOGRAPHY,
+ E_JAPANESEFIND,
+ E_RUBY,
+ E_CHANGECASEMAP,
+ E_DOUBLELINES,
+ E_ALL // special one for IsAnyEnabled()/SetAll() functionality
+};
+
+SVL_DLLPUBLIC bool IsCJKFontEnabled();
+SVL_DLLPUBLIC bool IsVerticalTextEnabled();
+SVL_DLLPUBLIC bool IsAsianTypographyEnabled();
+SVL_DLLPUBLIC bool IsJapaneseFindEnabled();
+SVL_DLLPUBLIC bool IsRubyEnabled();
+SVL_DLLPUBLIC bool IsChangeCaseMapEnabled();
+SVL_DLLPUBLIC bool IsDoubleLinesEnabled();
+
+SVL_DLLPUBLIC void SetAll(bool bSet);
+SVL_DLLPUBLIC bool IsAnyEnabled();
+SVL_DLLPUBLIC bool IsReadOnly(EOption eOption);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/converter.hxx b/include/svl/converter.hxx
new file mode 100644
index 000000000..7b2000c88
--- /dev/null
+++ b/include/svl/converter.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_CONVERTER_HXX
+#define INCLUDED_SVL_CONVERTER_HXX
+
+#include <svl/svldllapi.h>
+
+class SvDbaseConverter
+{
+public:
+ SVL_DLLPUBLIC static sal_Int32 ConvertPrecisionToDbase(sal_Int32 _nLen, sal_Int32 _nScale);
+ SVL_DLLPUBLIC static sal_Int32 ConvertPrecisionToOdbc(sal_Int32 _nLen, sal_Int32 _nScale);
+};
+
+#endif //_CONVERTER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cryptosign.hxx b/include/svl/cryptosign.hxx
new file mode 100644
index 000000000..3bb682916
--- /dev/null
+++ b/include/svl/cryptosign.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/types.h>
+
+#include <utility>
+#include <vector>
+
+#include <rtl/strbuf.hxx>
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <svl/svldllapi.h>
+
+// Is this length truly the maximum possible, or just a number that
+// seemed large enough when the author tested this (with some type of
+// certificates)? I suspect the latter.
+
+// Used to be 0x4000 = 16384, but a sample signed PDF (produced by
+// some other software) provided by the customer has a signature
+// content that is 30000 bytes. The SampleSignedPDFDocument.pdf from
+// Adobe has one that is 21942 bytes. So let's be careful. Pity this
+// can't be dynamic, at least not without restructuring the code. Also
+// note that the checks in the code for this being too small
+// apparently are broken, if this overflows you end up with an invalid
+// PDF. Need to fix that.
+
+#define MAX_SIGNATURE_CONTENT_LENGTH 50000
+
+namespace com::sun::star::security { class XCertificate; }
+class SvStream;
+struct SignatureInformation;
+
+namespace svl::crypto {
+
+/// Converts a hex-encoded string into a byte array.
+SVL_DLLPUBLIC std::vector<unsigned char> DecodeHexString(std::string_view rHex);
+
+/// Helper to cryptographically sign and verify
+/// arbitrary data blocks.
+class SVL_DLLPUBLIC Signing
+{
+public:
+
+ Signing(css::uno::Reference<css::security::XCertificate> xCertificate) :
+ m_xCertificate(std::move(xCertificate))
+ {
+ }
+
+ /// Add a range to sign.
+ /// Note: for efficiency this takes a naked pointer, which must remain valid
+ /// until this object is discarded.
+ void AddDataRange(const void* pData, sal_Int32 size)
+ {
+ m_dataBlocks.emplace_back(pData, size);
+ }
+
+ void SetSignTSA(const OUString& tsa) { m_aSignTSA = tsa; }
+ void SetSignPassword(const OUString& password) { m_aSignPassword = password; }
+
+ /// Signs one or more data blocks (as a single, contiguous, array).
+ /// Returns the signature (in PKCS#7 format) as string (hex).
+ bool Sign(OStringBuffer& rCMSHexBuffer);
+
+ /// Verify and get Signature Information given a byte array.
+ static bool Verify(const std::vector<unsigned char>& aData,
+ const bool bNonDetached,
+ const std::vector<unsigned char>& aSignature,
+ SignatureInformation& rInformation);
+
+ /// Verify and get Signature Information given a signature and stream.
+ static bool Verify(SvStream& rStream,
+ const std::vector<std::pair<size_t, size_t>>& aByteRanges,
+ const bool bNonDetached,
+ const std::vector<unsigned char>& aSignature,
+ SignatureInformation& rInformation);
+
+private:
+ /// The certificate to use for signing.
+ const css::uno::Reference<css::security::XCertificate> m_xCertificate;
+
+ /// Data blocks (pointer-size pairs).
+ std::vector<std::pair<const void*, sal_Int32>> m_dataBlocks;
+ OUString m_aSignTSA;
+ OUString m_aSignPassword;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/include/svl/ctloptions.hxx b/include/svl/ctloptions.hxx
new file mode 100644
index 000000000..5140907dd
--- /dev/null
+++ b/include/svl/ctloptions.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_CTLOPTIONS_HXX
+#define INCLUDED_SVL_CTLOPTIONS_HXX
+
+#include <svl/svldllapi.h>
+#include <unotools/options.hxx>
+#include <memory>
+
+class SvtCTLOptions_Impl;
+
+// class SvtCTLOptions --------------------------------------------------------
+
+class SVL_DLLPUBLIC SvtCTLOptions final : public utl::detail::Options
+{
+private:
+ std::shared_ptr<SvtCTLOptions_Impl> m_pImpl;
+
+public:
+
+ // bDontLoad is for referencing purposes only
+ SvtCTLOptions( bool bDontLoad = false );
+ virtual ~SvtCTLOptions() override;
+
+ void SetCTLFontEnabled( bool _bEnabled );
+ bool IsCTLFontEnabled() const;
+
+ void SetCTLSequenceChecking( bool _bEnabled );
+ bool IsCTLSequenceChecking() const;
+
+ void SetCTLSequenceCheckingRestricted( bool _bEnable );
+ bool IsCTLSequenceCheckingRestricted() const;
+
+ void SetCTLSequenceCheckingTypeAndReplace( bool _bEnable );
+ bool IsCTLSequenceCheckingTypeAndReplace() const;
+
+ enum CursorMovement
+ {
+ MOVEMENT_LOGICAL = 0,
+ MOVEMENT_VISUAL
+ };
+ void SetCTLCursorMovement( CursorMovement _eMovement );
+ CursorMovement GetCTLCursorMovement() const;
+
+ enum TextNumerals
+ {
+ NUMERALS_ARABIC = 0,
+ NUMERALS_HINDI,
+ NUMERALS_SYSTEM,
+ NUMERALS_CONTEXT
+ };
+ void SetCTLTextNumerals( TextNumerals _eNumerals );
+ TextNumerals GetCTLTextNumerals() const;
+
+ enum EOption
+ {
+ E_CTLFONT,
+ E_CTLSEQUENCECHECKING,
+ E_CTLCURSORMOVEMENT,
+ E_CTLTEXTNUMERALS,
+ E_CTLSEQUENCECHECKINGRESTRICTED,
+ E_CTLSEQUENCECHECKINGTYPEANDREPLACE
+ };
+ bool IsReadOnly(EOption eOption) const;
+};
+
+#endif // INCLUDED_SVL_CTLOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/currencytable.hxx b/include/svl/currencytable.hxx
new file mode 100644
index 000000000..a990ba4e0
--- /dev/null
+++ b/include/svl/currencytable.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_SVL_CURRENCYTABLE_HXX
+#define INCLUDED_SVL_CURRENCYTABLE_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/zforlist.hxx>
+
+#include <vector>
+
+class SVL_DLLPUBLIC NfCurrencyTable
+{
+ typedef std::vector<NfCurrencyEntry> DataType;
+ DataType maData;
+
+ NfCurrencyTable(NfCurrencyTable const&) = delete;
+ void operator=(NfCurrencyTable const&) = delete;
+
+public:
+ NfCurrencyTable() {}
+ typedef DataType::iterator iterator;
+ typedef DataType::const_iterator const_iterator;
+
+ iterator begin();
+
+ NfCurrencyEntry& operator[](size_t i);
+ const NfCurrencyEntry& operator[](size_t i) const;
+
+ size_t size() const;
+
+ void insert(const iterator& it, NfCurrencyEntry p);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/custritm.hxx b/include/svl/custritm.hxx
new file mode 100644
index 000000000..90215aff4
--- /dev/null
+++ b/include/svl/custritm.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_CUSTRITM_HXX
+#define INCLUDED_SVL_CUSTRITM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <cassert>
+#include <utility>
+
+class SVL_DLLPUBLIC CntUnencodedStringItem: public SfxPoolItem
+{
+ OUString m_aValue;
+
+public:
+
+ CntUnencodedStringItem(sal_uInt16 which): SfxPoolItem(which)
+ {}
+
+ CntUnencodedStringItem(sal_uInt16 which, OUString aTheValue):
+ SfxPoolItem(which), m_aValue(std::move(aTheValue))
+ {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+ virtual bool operator <(const SfxPoolItem & rItem) const override;
+ virtual bool IsSortable() const override { return true; }
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&) const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
+
+ virtual CntUnencodedStringItem* Clone(SfxItemPool * = nullptr) const override;
+
+ const OUString & GetValue() const { return m_aValue; }
+
+ inline void SetValue(const OUString & rTheValue);
+};
+
+inline void CntUnencodedStringItem::SetValue(const OUString & rTheValue)
+{
+ assert(GetRefCount() == 0 && "cannot modify name of pooled item");
+ m_aValue = rTheValue;
+}
+
+#endif // INCLUDED_SVL_CUSTRITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/documentlockfile.hxx b/include/svl/documentlockfile.hxx
new file mode 100644
index 000000000..b4f731db7
--- /dev/null
+++ b/include/svl/documentlockfile.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_DOCUMENTLOCKFILE_HXX
+#define INCLUDED_SVL_DOCUMENTLOCKFILE_HXX
+
+#include <svl/svldllapi.h>
+
+#include <svl/lockfilecommon.hxx>
+
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::io { class XOutputStream; }
+
+namespace svt {
+
+/// Generalized class for LO and MSO lockfile handling.
+class SVL_DLLPUBLIC GenDocumentLockFile : public LockFileCommon
+{
+public:
+ GenDocumentLockFile(const OUString& aLockFileURL);
+ virtual ~GenDocumentLockFile() override;
+
+ bool CreateOwnLockFile();
+ bool OverwriteOwnLockFile();
+ /// Delete the Lockfile, if current user is the owner
+ virtual void RemoveFile();
+ /// Only delete lockfile, disregarding ownership
+ void RemoveFileDirectly();
+
+ virtual LockFileEntry GetLockData() = 0;
+
+protected:
+ virtual void WriteEntryToStream( const LockFileEntry& aEntry, const css::uno::Reference< css::io::XOutputStream >& xStream ) = 0;
+ virtual css::uno::Reference< css::io::XInputStream > OpenStream();
+};
+
+/// Class implementing reading and writing LO lockfiles.
+class SVL_DLLPUBLIC DocumentLockFile final : public GenDocumentLockFile
+{
+ virtual void WriteEntryToStream( const LockFileEntry& aEntry, const css::uno::Reference< css::io::XOutputStream >& xStream ) override;
+
+public:
+ DocumentLockFile( std::u16string_view aOrigURL );
+ virtual ~DocumentLockFile() override;
+
+ virtual LockFileEntry GetLockData() override;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx
new file mode 100644
index 000000000..114e451c0
--- /dev/null
+++ b/include/svl/eitem.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_EITEM_HXX
+#define INCLUDED_SVL_EITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/cenumitm.hxx>
+
+
+template<typename EnumT>
+class SAL_DLLPUBLIC_RTTI SfxEnumItem : public SfxEnumItemInterface
+{
+ EnumT m_nValue;
+
+protected:
+ explicit SfxEnumItem(sal_uInt16 const nWhich, EnumT const nValue)
+ : SfxEnumItemInterface(nWhich)
+ , m_nValue(nValue)
+ { }
+
+ SfxEnumItem(const SfxEnumItem &) = default;
+
+public:
+
+ EnumT GetValue() const { return m_nValue; }
+
+ void SetValue(EnumT nTheValue)
+ {
+ assert(GetRefCount() == 0 && "SfxEnumItem::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+ }
+
+ virtual sal_uInt16 GetEnumValue() const override
+ {
+ return static_cast<sal_uInt16>(GetValue());
+ }
+
+ virtual void SetEnumValue(sal_uInt16 nTheValue) override
+ {
+ SetValue(static_cast<EnumT>(nTheValue));
+ }
+
+ virtual bool operator==(SfxPoolItem const & other) const override
+ {
+ return SfxEnumItemInterface::operator==(other) &&
+ m_nValue == static_cast<const SfxEnumItem<EnumT> &>(other).m_nValue;
+ }
+};
+
+class SVL_DLLPUBLIC SfxBoolItem
+ : public SfxPoolItem
+{
+ bool m_bValue;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxBoolItem(sal_uInt16 const nWhich = 0, bool const bValue = false)
+ : SfxPoolItem(nWhich)
+ , m_bValue(bValue)
+ { }
+
+ bool GetValue() const { return m_bValue; }
+
+ void SetValue(bool const bTheValue) { m_bValue = bTheValue; }
+
+ // SfxPoolItem
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8) override;
+
+
+ virtual SfxBoolItem* Clone(SfxItemPool * = nullptr) const override;
+
+ virtual OUString GetValueTextByVal(bool bTheValue) const;
+};
+
+#endif // INCLUDED_SVL_EITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/filenotation.hxx b/include/svl/filenotation.hxx
new file mode 100644
index 000000000..d33e442b9
--- /dev/null
+++ b/include/svl/filenotation.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_FILENOTATION_HXX
+#define INCLUDED_SVL_FILENOTATION_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+
+
+namespace svt
+{
+
+
+ //= OFileNotation
+
+ class SVL_DLLPUBLIC OFileNotation final
+ {
+ public:
+ enum NOTATION
+ {
+ N_SYSTEM,
+ N_URL
+ };
+
+ OFileNotation( const OUString& _rUrlOrPath );
+ OFileNotation( const OUString& _rUrlOrPath, NOTATION _eInputNotation );
+
+ OUString get(NOTATION _eOutputNotation) const;
+
+ private:
+ SVL_DLLPRIVATE void construct( const OUString& _rUrlOrPath );
+ SVL_DLLPRIVATE bool implInitWithSystemNotation( const OUString& _rSystemPath );
+ SVL_DLLPRIVATE void implInitWithURLNotation( const OUString& _rURL );
+
+ OUString m_sSystem;
+ OUString m_sFileURL;
+ };
+
+
+} // namespace svt
+
+
+#endif // INCLUDED_SVL_FILENOTATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/flagitem.hxx b/include/svl/flagitem.hxx
new file mode 100644
index 000000000..70b968f2c
--- /dev/null
+++ b/include/svl/flagitem.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_FLAGITEM_HXX
+#define INCLUDED_SVL_FLAGITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/svldllapi.h>
+#include <tools/debug.hxx>
+
+class SvStream;
+
+class SVL_DLLPUBLIC SfxFlagItem: public SfxPoolItem
+{
+ sal_uInt16 nVal;
+
+public:
+
+ explicit SfxFlagItem( sal_uInt16 nWhich = 0, sal_uInt16 nValue = 0 );
+
+ virtual sal_uInt8 GetFlagCount() const;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual SfxFlagItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString & rText,
+ const IntlWrapper& ) const override;
+ sal_uInt16 GetValue() const { return nVal; }
+ void SetValue( sal_uInt16 nNewVal ) {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nVal = nNewVal;
+ }
+ bool GetFlag( sal_uInt8 nFlag ) const { return (nVal & ( 1<<nFlag)); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/fstathelper.hxx b/include/svl/fstathelper.hxx
new file mode 100644
index 000000000..f6e4343f4
--- /dev/null
+++ b/include/svl/fstathelper.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_FSTATHELPER_HXX
+#define INCLUDED_SVL_FSTATHELPER_HXX
+
+#include <rtl/ustring.hxx>
+#include <svl/svldllapi.h>
+
+class Date;
+namespace tools { class Time; }
+
+namespace FStatHelper {
+
+/** Return the modified time and date stamp for this URL.
+
+ @param URL the asking URL
+
+ @param pDate if unequal 0, the function set the date stamp
+
+ @param pTime if unequal 0, the function set the time stamp
+
+ @return it was be able to get the date/time stamp
+*/
+SVL_DLLPUBLIC bool GetModifiedDateTimeOfFile( const OUString& rURL,
+ Date* pDate, tools::Time* pTime );
+
+/** Return if under the URL a document exist. This is only a wrapper for the
+ UCB.IsContent.
+*/
+SVL_DLLPUBLIC bool IsDocument( const OUString& rURL );
+
+/** Return if under the URL a folder exist. This is only a wrapper for the
+ UCB.isFolder.
+*/
+SVL_DLLPUBLIC bool IsFolder( const OUString& rURL );
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/globalnameitem.hxx b/include/svl/globalnameitem.hxx
new file mode 100644
index 000000000..edbb56273
--- /dev/null
+++ b/include/svl/globalnameitem.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_GLOBALNAMEITEM_HXX
+#define INCLUDED_SVL_GLOBALNAMEITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <tools/globname.hxx>
+#include <svl/poolitem.hxx>
+
+class SVL_DLLPUBLIC SfxGlobalNameItem final : public SfxPoolItem
+{
+ SvGlobalName m_aName;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SfxGlobalNameItem();
+ SfxGlobalNameItem( sal_uInt16 nWhich, const SvGlobalName& );
+ virtual ~SfxGlobalNameItem() override;
+
+ SfxGlobalNameItem(SfxGlobalNameItem const &) = default;
+ SfxGlobalNameItem(SfxGlobalNameItem &&) = default;
+ SfxGlobalNameItem & operator =(SfxGlobalNameItem const &) = delete; // due to SfxPoolItem
+ SfxGlobalNameItem & operator =(SfxGlobalNameItem &&) = delete; // due to SfxPoolItem
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxGlobalNameItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ const SvGlobalName& GetValue() const { return m_aName; }
+
+ virtual bool PutValue ( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/grabbagitem.hxx b/include/svl/grabbagitem.hxx
new file mode 100644
index 000000000..77a619aec
--- /dev/null
+++ b/include/svl/grabbagitem.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_SVL_GRABBAGITEM_HXX
+#define INCLUDED_SVL_GRABBAGITEM_HXX
+
+#include <map>
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+/// Grab bag item provides a string-any map for keys with untyped values.
+class SVL_DLLPUBLIC SfxGrabBagItem final : public SfxPoolItem
+{
+private:
+ std::map<OUString, css::uno::Any> m_aMap;
+
+public:
+ SfxGrabBagItem();
+ SfxGrabBagItem(sal_uInt16 nWhich);
+ ~SfxGrabBagItem() override;
+
+ SfxGrabBagItem(SfxGrabBagItem const&) = default;
+ SfxGrabBagItem(SfxGrabBagItem&&) = default;
+ SfxGrabBagItem& operator=(SfxGrabBagItem const&) = delete; // due to SfxPoolItem
+ SfxGrabBagItem& operator=(SfxGrabBagItem&&) = delete; // due to SfxPoolItem
+
+ const std::map<OUString, css::uno::Any>& GetGrabBag() const { return m_aMap; }
+
+ std::map<OUString, css::uno::Any>& GetGrabBag() { return m_aMap; }
+
+ bool operator==(const SfxPoolItem& rItem) const override;
+ SfxGrabBagItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
+ bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/gridprinter.hxx b/include/svl/gridprinter.hxx
new file mode 100644
index 000000000..e69d9f50c
--- /dev/null
+++ b/include/svl/gridprinter.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVL_GRIDPRINTER_HXX
+#define INCLUDED_SVL_GRIDPRINTER_HXX
+
+#include <rtl/ustring.hxx>
+#include <svl/svldllapi.h>
+#include <memory>
+
+namespace svl
+{
+/**
+ * Print 2-dimensional data in a nice and pleasant fashion. Useful when
+ * debugging grid layout data.
+ */
+class SVL_DLLPUBLIC GridPrinter
+{
+ struct Impl;
+ std::unique_ptr<Impl> mpImpl;
+
+public:
+ GridPrinter(size_t nRows, size_t nCols, bool bPrint);
+ ~GridPrinter();
+ void set(size_t nRow, size_t nCol, const OUString& rStr);
+ void print(const char* pHeader) const;
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
new file mode 100644
index 000000000..ba26bf7e0
--- /dev/null
+++ b/include/svl/hint.hxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_HINT_HXX
+#define INCLUDED_SVL_HINT_HXX
+
+#include <ostream>
+#include <string>
+
+#include <svl/svldllapi.h>
+
+enum class SfxHintId {
+ NONE,
+ Dying,
+ NameChanged,
+ TitleChanged,
+ DataChanged,
+ DocChanged,
+ UpdateDone,
+ Deinitializing,
+ ModeChanged,
+ ColorsChanged,
+ LanguageChanged,
+ RedlineChanged,
+ DocumentRepair,
+
+// VCL text hints
+ TextParaInserted,
+ TextParaRemoved,
+ TextParaContentChanged,
+ TextHeightChanged,
+ TextFormatPara,
+ TextFormatted,
+ TextModified,
+ TextProcessNotifications,
+ TextViewScrolled,
+ TextViewSelectionChanged,
+ TextViewCaretChanged,
+
+// BASIC hints
+ BasicDataWanted,
+ BasicDataChanged,
+ BasicInfoWanted,
+ BasicStart,
+ BasicStop,
+
+// SVX edit source
+ EditSourceParasMoved,
+ EditSourceSelectionChanged,
+
+// SC hints
+ ScDataChanged,
+ ScTableOpDirty,
+ ScCalcAll,
+ ScReference,
+ ScDrawLayerNew,
+ ScDbAreasChanged,
+ ScAreasChanged,
+ ScTablesChanged,
+ ScDrawChanged,
+ ScDocNameChanged,
+ ScAreaLinksChanged,
+ ScShowRangeFinder,
+ ScDocSaved,
+ ScForceSetTab,
+ ScNavigatorUpdateAll,
+ ScAnyDataChanged,
+ ScPrintOptions,
+ ScRefModeChanged,
+ ScKillEditView,
+ ScKillEditViewNoPaint,
+ ScHiddenRowsChanged,
+ ScSelectionChanged,
+ ScClearCache,
+
+// SC accessibility hints
+ ScAccTableChanged,
+ ScAccCursorChanged,
+ ScAccVisAreaChanged,
+ ScAccEnterEditMode,
+ ScAccLeaveEditMode,
+ ScAccMakeDrawLayer,
+ ScAccWindowResized,
+
+
+// SFX stylesheet
+ StyleSheetCreated, // new
+ StyleSheetModified, // changed
+ StyleSheetChanged, // erased and re-created (replaced)
+ StyleSheetErased, // erased
+ StyleSheetInDestruction, // in the process of being destructed
+
+// STARMATH
+ MathFormatChanged,
+
+// Sw
+ SwDrawViewsCreated,
+ SwSplitNodeOperation,
+ SwSectionFrameMoveAndDelete,
+ SwNavigatorUpdateTracking,
+ SwNavigatorSelectOutlinesWithSelections,
+ SwLegacyModify,
+
+ ThisIsAnSdrHint // used to avoid dynamic_cast
+};
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const SfxHintId& id )
+{
+ switch(id)
+ {
+ case SfxHintId::NONE: return stream << "NONE";
+ case SfxHintId::Dying: return stream << "Dying";
+ case SfxHintId::NameChanged: return stream << "NameChanged";
+ case SfxHintId::TitleChanged: return stream << "TitleChanged";
+ case SfxHintId::DataChanged: return stream << "DataChanged";
+ case SfxHintId::DocChanged: return stream << "DocChanged";
+ case SfxHintId::UpdateDone: return stream << "UpdateDone";
+ case SfxHintId::Deinitializing: return stream << "Deinitializing";
+ case SfxHintId::ModeChanged: return stream << "ModeChanged";
+ case SfxHintId::ColorsChanged: return stream << "ColorsChanged";
+ case SfxHintId::LanguageChanged: return stream << "LanguageChanged";
+ case SfxHintId::RedlineChanged: return stream << "RedlineChanged";
+ case SfxHintId::DocumentRepair: return stream << "DocumentRepair";
+ case SfxHintId::TextParaInserted: return stream << "TextParaInserted";
+ case SfxHintId::TextParaRemoved: return stream << "TextParaRemoved";
+ case SfxHintId::TextParaContentChanged: return stream << "TextParaContentChanged";
+ case SfxHintId::TextHeightChanged: return stream << "TextHeightChanged";
+ case SfxHintId::TextFormatPara: return stream << "TextFormatPara";
+ case SfxHintId::TextFormatted: return stream << "TextFormatted";
+ case SfxHintId::TextModified: return stream << "TextModified";
+ case SfxHintId::TextProcessNotifications: return stream << "TextProcessNotifications";
+ case SfxHintId::TextViewScrolled: return stream << "TextViewScrolled";
+ case SfxHintId::TextViewSelectionChanged: return stream << "TextViewSelectionChanged";
+ case SfxHintId::TextViewCaretChanged: return stream << "TextViewCaretChanged";
+ case SfxHintId::BasicDataWanted: return stream << "BasicDataWanted";
+ case SfxHintId::BasicDataChanged: return stream << "BasicDataChanged";
+ case SfxHintId::BasicInfoWanted: return stream << "BasicInfoWanted";
+ case SfxHintId::BasicStart: return stream << "BasicStart";
+ case SfxHintId::BasicStop: return stream << "BasicStop";
+ case SfxHintId::EditSourceParasMoved: return stream << "EditSourceParasMoved";
+ case SfxHintId::EditSourceSelectionChanged: return stream << "EditSourceSelectionChanged";
+ case SfxHintId::ScDataChanged: return stream << "ScDataChanged";
+ case SfxHintId::ScTableOpDirty: return stream << "ScTableOpDirty";
+ case SfxHintId::ScCalcAll: return stream << "ScCalcAll";
+ case SfxHintId::ScReference: return stream << "ScReference";
+ case SfxHintId::ScDrawLayerNew: return stream << "ScDrawLayerNew";
+ case SfxHintId::ScDbAreasChanged: return stream << "ScDbAreasChanged";
+ case SfxHintId::ScAreasChanged: return stream << "ScAreasChanged";
+ case SfxHintId::ScTablesChanged: return stream << "ScTablesChanged";
+ case SfxHintId::ScDrawChanged: return stream << "ScDrawChanged";
+ case SfxHintId::ScDocNameChanged: return stream << "ScDocNameChanged";
+ case SfxHintId::ScAreaLinksChanged: return stream << "ScAreaLinksChanged";
+ case SfxHintId::ScShowRangeFinder: return stream << "ScShowRangeFinder";
+ case SfxHintId::ScDocSaved: return stream << "ScDocSaved";
+ case SfxHintId::ScForceSetTab: return stream << "ScForceSetTab";
+ case SfxHintId::ScNavigatorUpdateAll: return stream << "ScNavigatorUpdateAll";
+ case SfxHintId::ScAnyDataChanged: return stream << "ScAnyDataChanged";
+ case SfxHintId::ScPrintOptions: return stream << "ScPrintOptions";
+ case SfxHintId::ScRefModeChanged: return stream << "ScRefModeChanged";
+ case SfxHintId::ScKillEditView: return stream << "ScKillEditView";
+ case SfxHintId::ScKillEditViewNoPaint: return stream << "ScKillEditViewNoPaint";
+ case SfxHintId::ScHiddenRowsChanged: return stream << "ScHiddenRowsChanged";
+ case SfxHintId::ScSelectionChanged: return stream << "ScSelectionChanged";
+ case SfxHintId::ScClearCache: return stream << "ScClearCache";
+ case SfxHintId::ScAccTableChanged: return stream << "ScAccTableChanged";
+ case SfxHintId::ScAccCursorChanged: return stream << "ScAccCursorChanged";
+ case SfxHintId::ScAccVisAreaChanged: return stream << "ScAccVisAreaChanged";
+ case SfxHintId::ScAccEnterEditMode: return stream << "ScAccEnterEditMode";
+ case SfxHintId::ScAccLeaveEditMode: return stream << "ScAccLeaveEditMode";
+ case SfxHintId::ScAccMakeDrawLayer: return stream << "ScAccMakeDrawLayer";
+ case SfxHintId::ScAccWindowResized: return stream << "ScAccWindowResized";
+ case SfxHintId::StyleSheetCreated: return stream << "StyleSheetCreated";
+ case SfxHintId::StyleSheetModified: return stream << "StyleSheetModified";
+ case SfxHintId::StyleSheetChanged: return stream << "StyleSheetChanged";
+ case SfxHintId::StyleSheetErased: return stream << "StyleSheetErased";
+ case SfxHintId::StyleSheetInDestruction: return stream << "StyleSheetInDestruction";
+ case SfxHintId::MathFormatChanged: return stream << "MathFormatChanged";
+ case SfxHintId::SwDrawViewsCreated: return stream << "SwDrawViewsCreated";
+ case SfxHintId::SwSplitNodeOperation: return stream << "SwSplitNodeOperation";
+ case SfxHintId::SwSectionFrameMoveAndDelete: return stream << "SwSectionFrameMoveAndDelete";
+ case SfxHintId::SwNavigatorUpdateTracking: return stream << "SwNavigatorUpdateTracking";
+ case SfxHintId::SwNavigatorSelectOutlinesWithSelections:
+ return stream << "SwNavigatorSelectOutlinesWithSelections";
+ case SfxHintId::ThisIsAnSdrHint: return stream << "SdrHint";
+ default: return stream << "unk(" << std::to_string(int(id)) << ")";
+ }
+}
+
+class SVL_DLLPUBLIC SfxHint
+{
+private:
+ SfxHintId mnId;
+public:
+ SfxHint() : mnId(SfxHintId::NONE) {}
+ explicit SfxHint( SfxHintId nId ) : mnId(nId) {}
+ virtual ~SfxHint() {};
+
+ SfxHint(SfxHint const &) = default;
+ SfxHint(SfxHint &&) = default;
+ SfxHint & operator =(SfxHint const &) = default;
+ SfxHint & operator =(SfxHint &&) = default;
+
+ SfxHintId GetId() const { return mnId; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ilstitem.hxx b/include/svl/ilstitem.hxx
new file mode 100644
index 000000000..bb49d18c9
--- /dev/null
+++ b/include/svl/ilstitem.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_ILSTITEM_HXX
+#define INCLUDED_SVL_ILSTITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <vector>
+
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+class SVL_DLLPUBLIC SfxIntegerListItem final : public SfxPoolItem
+{
+ std::vector < sal_Int32 > m_aList;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxIntegerListItem();
+ SfxIntegerListItem( sal_uInt16 nWhich, std::vector < sal_Int32 >&& rList );
+ SfxIntegerListItem( sal_uInt16 nWhich, const css::uno::Sequence < sal_Int32 >& rList );
+ virtual ~SfxIntegerListItem() override;
+
+ SfxIntegerListItem(SfxIntegerListItem const &) = default;
+ SfxIntegerListItem(SfxIntegerListItem &&) = default;
+ SfxIntegerListItem & operator =(SfxIntegerListItem const &) = delete; // due to SfxPoolItem
+ SfxIntegerListItem & operator =(SfxIntegerListItem &&) = delete; // due to SfxPoolItem
+
+ const std::vector< sal_Int32 >& GetList() const { return m_aList; }
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxIntegerListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool PutValue ( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+};
+
+#endif // INCLUDED_SVL_ILSTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/imageitm.hxx b/include/svl/imageitm.hxx
new file mode 100644
index 000000000..f06eb7fd6
--- /dev/null
+++ b/include/svl/imageitm.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_IMAGEITM_HXX
+#define INCLUDED_SVL_IMAGEITM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/intitem.hxx>
+#include <tools/degree.hxx>
+
+struct SfxImageItem_Impl;
+class SVL_DLLPUBLIC SfxImageItem final : public SfxInt16Item
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxImageItem( sal_uInt16 nWhich = 0 );
+ SfxImageItem( const SfxImageItem& );
+ virtual ~SfxImageItem() override;
+
+ virtual SfxImageItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ void SetRotation( Degree10 nValue ) { mnAngle = nValue; }
+ Degree10 GetRotation() const { return mnAngle; }
+ void SetMirrored( bool bSet ) { mbMirrored = bSet; }
+ bool IsMirrored() const { return mbMirrored; }
+
+private:
+ OUString maURL;
+ Degree10 mnAngle;
+ bool mbMirrored;
+};
+
+#endif // _SFX_IMAGEITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/inethist.hxx b/include/svl/inethist.hxx
new file mode 100644
index 000000000..9f88fd84b
--- /dev/null
+++ b/include/svl/inethist.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_INETHIST_HXX
+#define INCLUDED_SVL_INETHIST_HXX
+
+#include <svl/SfxBroadcaster.hxx>
+#include <svl/hint.hxx>
+#include <svl/svldllapi.h>
+#include <tools/urlobj.hxx>
+#include <memory>
+
+class INetURLHistory_Impl;
+class SVL_DLLPUBLIC INetURLHistory final : public SfxBroadcaster
+{
+ /** Representation.
+ */
+ std::unique_ptr<INetURLHistory_Impl> m_pImpl;
+
+ /** Construction/Destruction.
+ */
+ SAL_DLLPRIVATE INetURLHistory();
+ SAL_DLLPRIVATE virtual ~INetURLHistory() override;
+
+ /** Implementation.
+ */
+ SAL_DLLPRIVATE static void NormalizeUrl_Impl (INetURLObject &rUrl);
+
+ void PutUrl_Impl (const INetURLObject &rUrl);
+ bool QueryUrl_Impl (INetURLObject rUrl) const;
+
+ /** Not implemented.
+ */
+ INetURLHistory (const INetURLHistory&) = delete;
+ INetURLHistory& operator= (const INetURLHistory&) = delete;
+
+public:
+ /** GetOrCreate.
+ */
+ static INetURLHistory* GetOrCreate();
+
+ /** QueryProtocol.
+ */
+ bool QueryProtocol (INetProtocol eProto) const
+ {
+ return ((eProto == INetProtocol::File ) ||
+ (eProto == INetProtocol::Ftp ) ||
+ (eProto == INetProtocol::Http ) ||
+ (eProto == INetProtocol::Https) );
+ }
+
+ /** QueryUrl.
+ */
+ bool QueryUrl (const INetURLObject &rUrl) const
+ {
+ if (QueryProtocol (rUrl.GetProtocol()))
+ return QueryUrl_Impl (rUrl);
+ else
+ return false;
+ }
+
+ bool QueryUrl (std::u16string_view rUrl) const;
+
+ /** PutUrl.
+ */
+ void PutUrl (const INetURLObject &rUrl)
+ {
+ if (QueryProtocol (rUrl.GetProtocol()))
+ PutUrl_Impl (rUrl);
+ }
+};
+
+// broadcasted from PutUrl().
+class SVL_DLLPUBLIC INetURLHistoryHint final : public SfxHint
+{
+ const INetURLObject* pObj;
+public:
+ explicit INetURLHistoryHint( const INetURLObject* Object ) : pObj(Object) {}
+ const INetURLObject* GetObject() const { return pObj; }
+};
+
+#endif // INCLUDED_SVL_INETHIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/inettype.hxx b/include/svl/inettype.hxx
new file mode 100644
index 000000000..ea955437e
--- /dev/null
+++ b/include/svl/inettype.hxx
@@ -0,0 +1,263 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_INETTYPE_HXX
+#define INCLUDED_SVL_INETTYPE_HXX
+
+#include <svl/svldllapi.h>
+#include <tools/inetmime.hxx>
+
+/** Definitions for frequently used media type names.
+ */
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_OCTSTREAM = u"application/octet-stream";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_PDF = u"application/pdf";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_RTF = u"application/rtf";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_CALC
+ = u"application/vnd.stardivision.calc";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_CHART
+ = u"application/vnd.stardivision.chart";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_DRAW
+ = u"application/vnd.stardivision.draw";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_IMAGE
+ = u"application/vnd.stardivision.image";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED
+ = u"application/vnd.stardivision.impress-packed";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_IMPRESS
+ = u"application/vnd.stardivision.impress";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_MAIL
+ = u"application/vnd.stardivision.mail";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_MATH
+ = u"application/vnd.stardivision.math";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_NEWS
+ = u"application/vnd.stardivision.news";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_OUTTRAY
+ = u"application/vnd.stardivision.outtray";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_TEMPLATE
+ = u"application/vnd.stardivision.template";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL
+ = u"application/vnd.stardivision.writer-global";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_WRITER_WEB
+ = u"application/vnd.stardivision.writer-web";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_WRITER
+ = u"application/vnd.stardivision.writer";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_FRAMESET = u"application/x-frameset";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_GALLERY_THEME
+ = u"application/x-gallery-theme";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_GALLERY = u"application/x-gallery";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_JAR = u"application/x-jar";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MACRO = u"application/x-macro";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSEXCEL_TEMPL
+ = u"application/x-msexcel-template";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSEXCEL = u"application/x-msexcel";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSPPOINT_TEMPL
+ = u"application/x-mspowerpoint-template";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSPPOINT = u"application/x-mspowerpoint";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSWORD_TEMPL
+ = u"application/x-msword-template";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSWORD = u"application/x-msword";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARCALC = u"application/x-starcalc";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARCHART = u"application/x-starchart;";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARDRAW = u"application/x-stardraw";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARHELP = u"application/x-starhelp";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARIMAGE = u"application/x-starimage";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARIMPRESS = u"application/x-starimpress";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARMAIL_SDM = u"application/x-starmail-sdm";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARMAIL_SMD = u"application/x-starmail-smd";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARMATH = u"application/x-starmath";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARWRITER_GLOB
+ = u"application/x-starwriter-global";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARWRITER = u"application/x-starwriter";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_CDE_CALENDAR_APP
+ = u"application/x-sun-ae-file";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_ZIP = u"application/x-zip-compressed";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_AIFF = u"audio/aiff";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_BASIC = u"audio/basic";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_MIDI = u"audio/midi";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_VORBIS = u"audio/vorbis";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_WAV = u"audio/wav";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_WEBM = u"audio/webm";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_X_CNT_FSYSBOX = u".chaos/fsys-box";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_X_CNT_FSYSFOLDER = u".chaos/fsys-folder";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFOLDER
+ = u".chaos/fsys-special-folder";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_GENERIC = u"image/generic";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_GIF = u"image/gif";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_JPEG = u"image/jpeg";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_PCX = u"image/pcx";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_PNG = u"image/png";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_TIFF = u"image/tiff";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_BMP = u"image/x-MS-bmp";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_WEBP = u"image/webp";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MSG_RFC822 = u"message/rfc822";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MULTI_ALTERNATIVE = u"multipart/alternative";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MULTI_DIGEST = u"multipart/digest";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MULTI_MIXED = u"multipart/mixed";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MULTI_PARALLEL = u"multipart/parallel";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MULTI_RELATED = u"multipart/related";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_ICALENDAR = u"text/calendar";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_HTML = u"text/html";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_PLAIN = u"text/plain";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_XMLICALENDAR = u"text/x-icalxml";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_URL = u"text/x-url";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_VCALENDAR = u"text/x-vCalendar";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_VCARD = u"text/x-vCard";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_VIDEO_MSVIDEO = u"video/x-msvideo";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_VIDEO_THEORA = u"video/theora";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_VIDEO_VDO = u"video/vdo";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_VIDEO_WEBM = u"audio/webm";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_X_STARMAIL = u"x-starmail";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_X_VRML = u"x-world/x-vrml";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER
+ = u"application/vnd.sun.xml.writer";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_CALC
+ = u"application/vnd.sun.xml.calc";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESS
+ = u"application/vnd.sun.xml.impress";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_DRAW
+ = u"application/vnd.sun.xml.draw";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_CHART
+ = u"application/vnd.sun.xml.chart";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_MATH
+ = u"application/vnd.sun.xml.math";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER_GLOBAL
+ = u"application/vnd.sun.xml.writer-global";
+inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESSPACKED
+ = u"application/vnd.sun.xml.impress-packed";
+
+/** Definitions for matching parts of URIs.
+ */
+#define INETTYPE_URL_PROT_DATA "data"
+#define INETTYPE_URL_PROT_FILE "file"
+#define INETTYPE_URL_PROT_HTTP "http"
+#define INETTYPE_URL_PROT_HTTPS "https"
+#define INETTYPE_URL_PROT_MACRO "macro"
+#define INETTYPE_URL_PROT_MAILTO "mailto"
+#define INETTYPE_URL_PROT_PRIVATE "private"
+
+enum INetContentType
+{
+ CONTENT_TYPE_UNKNOWN,
+ CONTENT_TYPE_APP_OCTSTREAM,
+ CONTENT_TYPE_APP_PDF,
+ CONTENT_TYPE_APP_RTF,
+ CONTENT_TYPE_APP_MSWORD,
+ CONTENT_TYPE_APP_MSWORD_TEMPL,
+ CONTENT_TYPE_APP_STARCALC,
+ CONTENT_TYPE_APP_STARCHART,
+ CONTENT_TYPE_APP_STARDRAW,
+ CONTENT_TYPE_APP_STARHELP,
+ CONTENT_TYPE_APP_STARIMAGE,
+ CONTENT_TYPE_APP_STARIMPRESS,
+ CONTENT_TYPE_APP_STARMATH,
+ CONTENT_TYPE_APP_STARWRITER,
+ CONTENT_TYPE_APP_ZIP,
+ CONTENT_TYPE_AUDIO_AIFF,
+ CONTENT_TYPE_AUDIO_BASIC,
+ CONTENT_TYPE_AUDIO_MIDI,
+ CONTENT_TYPE_AUDIO_VORBIS,
+ CONTENT_TYPE_AUDIO_WAV,
+ CONTENT_TYPE_AUDIO_WEBM,
+ CONTENT_TYPE_IMAGE_GIF,
+ CONTENT_TYPE_IMAGE_JPEG,
+ CONTENT_TYPE_IMAGE_PCX,
+ CONTENT_TYPE_IMAGE_PNG,
+ CONTENT_TYPE_IMAGE_TIFF,
+ CONTENT_TYPE_IMAGE_BMP,
+ CONTENT_TYPE_IMAGE_WEBP,
+ CONTENT_TYPE_TEXT_HTML,
+ CONTENT_TYPE_TEXT_PLAIN,
+ CONTENT_TYPE_TEXT_URL,
+ CONTENT_TYPE_TEXT_VCARD,
+ CONTENT_TYPE_VIDEO_MSVIDEO,
+ CONTENT_TYPE_VIDEO_THEORA,
+ CONTENT_TYPE_VIDEO_VDO,
+ CONTENT_TYPE_VIDEO_WEBM,
+ CONTENT_TYPE_X_CNT_FSYSBOX,
+ CONTENT_TYPE_X_CNT_FSYSFOLDER,
+ CONTENT_TYPE_X_STARMAIL,
+ CONTENT_TYPE_X_VRML,
+ CONTENT_TYPE_APP_GALLERY,
+ CONTENT_TYPE_APP_GALLERY_THEME,
+ CONTENT_TYPE_APP_STARWRITER_GLOB,
+ CONTENT_TYPE_APP_STARMAIL_SDM,
+ CONTENT_TYPE_APP_STARMAIL_SMD,
+ CONTENT_TYPE_APP_VND_CALC,
+ CONTENT_TYPE_APP_VND_CHART,
+ CONTENT_TYPE_APP_VND_DRAW,
+ CONTENT_TYPE_APP_VND_IMAGE,
+ CONTENT_TYPE_APP_VND_IMPRESS,
+ CONTENT_TYPE_APP_VND_MAIL,
+ CONTENT_TYPE_APP_VND_MATH,
+ CONTENT_TYPE_APP_VND_WRITER,
+ CONTENT_TYPE_APP_VND_WRITER_GLOBAL,
+ CONTENT_TYPE_APP_VND_WRITER_WEB,
+ CONTENT_TYPE_APP_FRAMESET,
+ CONTENT_TYPE_APP_MACRO,
+ CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER,
+ CONTENT_TYPE_APP_VND_TEMPLATE,
+ CONTENT_TYPE_IMAGE_GENERIC,
+ CONTENT_TYPE_APP_VND_NEWS,
+ CONTENT_TYPE_APP_VND_OUTTRAY,
+ CONTENT_TYPE_APP_MSEXCEL,
+ CONTENT_TYPE_APP_MSEXCEL_TEMPL,
+ CONTENT_TYPE_APP_MSPPOINT,
+ CONTENT_TYPE_APP_MSPPOINT_TEMPL,
+ CONTENT_TYPE_TEXT_VCALENDAR,
+ CONTENT_TYPE_TEXT_ICALENDAR,
+ CONTENT_TYPE_TEXT_XMLICALENDAR,
+ CONTENT_TYPE_APP_CDE_CALENDAR_APP,
+ CONTENT_TYPE_INET_MESSAGE_RFC822,
+ CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE,
+ CONTENT_TYPE_INET_MULTIPART_DIGEST,
+ CONTENT_TYPE_INET_MULTIPART_PARALLEL,
+ CONTENT_TYPE_INET_MULTIPART_RELATED,
+ CONTENT_TYPE_INET_MULTIPART_MIXED,
+ CONTENT_TYPE_APP_VND_IMPRESSPACKED,
+ CONTENT_TYPE_APP_JAR,
+ CONTENT_TYPE_APP_VND_SUN_XML_WRITER,
+ CONTENT_TYPE_APP_VND_SUN_XML_CALC,
+ CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS,
+ CONTENT_TYPE_APP_VND_SUN_XML_DRAW,
+ CONTENT_TYPE_APP_VND_SUN_XML_CHART,
+ CONTENT_TYPE_APP_VND_SUN_XML_MATH,
+ CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL,
+ CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED,
+ CONTENT_TYPE_LAST = CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED
+};
+
+class SVL_DLLPUBLIC INetContentTypes
+{
+public:
+ static INetContentType GetContentType(OUString const& rTypeName);
+
+ static OUString GetContentType(INetContentType eTypeID);
+
+ static INetContentType GetContentType4Extension(OUString const& rExtension);
+
+ static INetContentType GetContentTypeFromURL(OUString const& rURL);
+
+ static bool GetExtensionFromURL(std::u16string_view rURL, OUString& rExtension);
+
+ static bool parse(OUString const& rMediaType, OUString& rType, OUString& rSubType,
+ INetContentTypeParameterList* pParameters = nullptr);
+};
+
+#endif // INCLUDED_SVL_INETTYPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/instrm.hxx b/include/svl/instrm.hxx
new file mode 100644
index 000000000..66f30a107
--- /dev/null
+++ b/include/svl/instrm.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_INSTRM_HXX
+#define INCLUDED_SVL_INSTRM_HXX
+
+#include <svl/svldllapi.h>
+#include <com/sun/star/uno/Reference.h>
+#include <tools/stream.hxx>
+#include <memory>
+
+namespace com::sun::star::io {
+ class XInputStream;
+ class XSeekable;
+}
+
+class SvDataPipe_Impl;
+
+
+class SVL_DLLPUBLIC SvInputStream final : public SvStream
+{
+ css::uno::Reference< css::io::XInputStream > m_xStream;
+ css::uno::Reference< css::io::XSeekable > m_xSeekable;
+ std::unique_ptr<SvDataPipe_Impl> m_pPipe;
+ sal_uInt64 m_nSeekedFrom;
+
+ SVL_DLLPRIVATE bool open();
+
+ SVL_DLLPRIVATE virtual std::size_t GetData(void * pData, std::size_t nSize) override;
+
+ SVL_DLLPRIVATE virtual std::size_t PutData(void const *, std::size_t) override;
+
+ SVL_DLLPRIVATE virtual sal_uInt64 SeekPos(sal_uInt64 nPos) override;
+
+ SVL_DLLPRIVATE virtual void FlushData() override;
+
+ SVL_DLLPRIVATE virtual void SetSize(sal_uInt64) override;
+
+public:
+ SvInputStream( css::uno::Reference< css::io::XInputStream > xTheStream );
+
+ virtual ~SvInputStream() override;
+};
+
+#endif // INCLUDED_SVL_INSTRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/int64item.hxx b/include/svl/int64item.hxx
new file mode 100644
index 000000000..70a502c64
--- /dev/null
+++ b/include/svl/int64item.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVL_INT64ITEM_HXX
+#define INCLUDED_SVL_INT64ITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/svldllapi.h>
+
+class SVL_DLLPUBLIC SfxInt64Item final : public SfxPoolItem
+{
+ sal_Int64 mnValue;
+
+public:
+ SfxInt64Item( sal_uInt16 nWhich, sal_Int64 nVal );
+
+ virtual ~SfxInt64Item() override;
+
+ SfxInt64Item(SfxInt64Item const &) = default;
+ SfxInt64Item(SfxInt64Item &&) = default;
+ SfxInt64Item & operator =(SfxInt64Item const &) = delete; // due to SfxPoolItem;
+ SfxInt64Item & operator =(SfxInt64Item &&) = delete; // due to SfxPoolItem
+
+ virtual bool operator== ( const SfxPoolItem& rItem ) const override;
+
+ virtual bool GetPresentation(
+ SfxItemPresentation, MapUnit, MapUnit,
+ OUString& rText, const IntlWrapper& rIntlWrapper ) const override;
+
+ virtual bool QueryValue(
+ css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+
+ virtual bool PutValue(
+ const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual SfxInt64Item* Clone( SfxItemPool* pOther = nullptr ) const override;
+
+ sal_Int64 GetValue() const { return mnValue;}
+
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx
new file mode 100644
index 000000000..92999568b
--- /dev/null
+++ b/include/svl/intitem.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_INTITEM_HXX
+#define INCLUDED_SVL_INTITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/cintitem.hxx>
+#include <boost/property_tree/ptree_fwd.hpp>
+
+
+class SVL_DLLPUBLIC SfxByteItem: public CntByteItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxByteItem(sal_uInt16 which = 0, sal_uInt8 nValue = 0):
+ CntByteItem(which, nValue) {}
+
+ virtual SfxByteItem* Clone(SfxItemPool * = nullptr) const override
+ { return new SfxByteItem(*this); }
+};
+
+class SVL_DLLPUBLIC SfxInt16Item: public SfxPoolItem
+{
+ sal_Int16 m_nValue;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxInt16Item(sal_uInt16 which = 0, sal_Int16 nTheValue = 0):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+
+ virtual bool PutValue( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+
+ virtual SfxInt16Item* Clone(SfxItemPool * = nullptr) const override;
+
+ sal_Int16 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_Int16 nTheValue);
+};
+
+inline void SfxInt16Item::SetValue(sal_Int16 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "SfxInt16Item::SetValue(); Pooled item");
+ m_nValue = nTheValue;
+}
+
+
+class SVL_DLLPUBLIC SfxUInt16Item: public CntUInt16Item
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxUInt16Item(sal_uInt16 which = 0, sal_uInt16 nValue = 0):
+ CntUInt16Item(which, nValue) {}
+
+ virtual SfxUInt16Item* Clone(SfxItemPool * = nullptr) const override
+ { return new SfxUInt16Item(*this); }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+
+class SVL_DLLPUBLIC SfxInt32Item: public CntInt32Item
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxInt32Item(sal_uInt16 which = 0, sal_Int32 nValue = 0):
+ CntInt32Item(which, nValue) {}
+
+ virtual SfxInt32Item* Clone(SfxItemPool * = nullptr) const override
+ { return new SfxInt32Item(*this); }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+
+class SVL_DLLPUBLIC SfxUInt32Item: public CntUInt32Item
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxUInt32Item(sal_uInt16 which = 0, sal_uInt32 nValue = 0):
+ CntUInt32Item(which, nValue) {}
+
+ virtual SfxUInt32Item* Clone(SfxItemPool * = nullptr) const override
+ { return new SfxUInt32Item(*this); }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+#endif // INCLUDED_SVL_INTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/isethint.hxx b/include/svl/isethint.hxx
new file mode 100644
index 000000000..89dbc3b71
--- /dev/null
+++ b/include/svl/isethint.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_ISETHINT_HXX
+#define INCLUDED_SVL_ISETHINT_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/hint.hxx>
+#include <svl/itemset.hxx>
+
+
+class SVL_DLLPUBLIC SfxItemSetHint final : public SfxHint
+{
+ SfxItemSet maItemSet;
+
+public:
+ SfxItemSetHint( const SfxItemSet &rItemSet );
+ virtual ~SfxItemSetHint() override;
+
+ const SfxItemSet& GetItemSet() const { return maItemSet; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itemiter.hxx b/include/svl/itemiter.hxx
new file mode 100644
index 000000000..13cf14b61
--- /dev/null
+++ b/include/svl/itemiter.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_ITEMITER_HXX
+#define INCLUDED_SVL_ITEMITER_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/itemset.hxx>
+
+class SfxPoolItem;
+
+class SVL_DLLPUBLIC SfxItemIter
+{
+ const SfxItemSet& m_rSet;
+ sal_uInt16 m_nStart;
+ sal_uInt16 m_nEnd;
+ sal_uInt16 m_nCurrent;
+
+public:
+ SfxItemIter(const SfxItemSet& rSet);
+
+ /// get item, or null if no items
+ const SfxPoolItem* GetCurItem() const
+ {
+ return m_rSet.m_nCount ? *(m_rSet.m_ppItems + m_nCurrent) : nullptr;
+ }
+ const SfxPoolItem* NextItem() { return (m_nCurrent < m_nEnd) ? ImplNextItem() : nullptr; }
+
+ bool IsAtEnd() const { return m_nCurrent == m_nEnd; }
+
+ sal_uInt16 GetCurPos() const { return m_nCurrent; }
+ sal_uInt16 GetFirstPos() const { return m_nStart; }
+ sal_uInt16 GetLastPos() const { return m_nEnd; }
+
+ SfxItemState GetItemState(bool bSrchInParent = true,
+ const SfxPoolItem** ppItem = nullptr) const;
+ void ClearItem();
+
+private:
+ const SfxPoolItem* ImplNextItem();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
new file mode 100644
index 000000000..e85451ecb
--- /dev/null
+++ b/include/svl/itempool.hxx
@@ -0,0 +1,228 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <rtl/ref.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/svldllapi.h>
+#include <svl/typedwhich.hxx>
+#include <svl/whichranges.hxx>
+#include <memory>
+#include <vector>
+#include <o3tl/sorted_vector.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+class SfxBroadcaster;
+struct SfxItemPool_Impl;
+
+struct SfxItemInfo
+{
+ sal_uInt16 _nSID;
+ bool _bPoolable;
+};
+
+class SfxItemPool;
+
+/** Base class for providers of defaults of SfxPoolItems.
+ *
+ * The derived classes hold the concrete (const) instances which are referenced in several places
+ * (usually within a single document).
+ * This helps to lower the amount of calls to lifecycle methods, speeds up comparisons within a document
+ * and facilitates loading and saving of attributes.
+ */
+class SVL_DLLPUBLIC SfxItemPool : public salhelper::SimpleReferenceObject
+{
+ friend struct SfxItemPool_Impl;
+ friend class SfxItemSet;
+ friend class SfxAllItemSet;
+
+ const SfxItemInfo* pItemInfos;
+ std::unique_ptr<SfxItemPool_Impl> pImpl;
+
+private:
+ sal_uInt16 GetIndex_Impl(sal_uInt16 nWhich) const;
+ sal_uInt16 GetSize_Impl() const;
+
+ SVL_DLLPRIVATE bool IsItemPoolable_Impl( sal_uInt16 nWhich ) const;
+
+public:
+ // for default SfxItemSet::CTOR, set default WhichRanges
+ void FillItemIdRanges_Impl( WhichRangesContainer& pWhichRanges ) const;
+ const WhichRangesContainer & GetFrozenIdRanges() const;
+
+protected:
+ static inline void ClearRefCount(SfxPoolItem& rItem);
+ static inline void AddRef(const SfxPoolItem& rItem);
+ static inline sal_uInt32 ReleaseRef(const SfxPoolItem& rItem, sal_uInt32 n = 1);
+
+public:
+ SfxItemPool( const SfxItemPool &rPool,
+ bool bCloneStaticDefaults = false );
+ SfxItemPool( const OUString &rName,
+ sal_uInt16 nStart, sal_uInt16 nEnd,
+ const SfxItemInfo *pItemInfos,
+ std::vector<SfxPoolItem*> *pDefaults = nullptr );
+
+public:
+ virtual ~SfxItemPool();
+
+ SfxBroadcaster& BC();
+
+ void SetPoolDefaultItem( const SfxPoolItem& );
+
+ const SfxPoolItem* GetPoolDefaultItem( sal_uInt16 nWhich ) const;
+ template<class T> const T* GetPoolDefaultItem( TypedWhichId<T> nWhich ) const
+ { return static_cast<const T*>(GetPoolDefaultItem(sal_uInt16(nWhich))); }
+
+ void ResetPoolDefaultItem( sal_uInt16 nWhich );
+
+ void SetDefaults(std::vector<SfxPoolItem*>* pDefaults);
+ void ClearDefaults();
+ void ReleaseDefaults( bool bDelete = false );
+ static void ReleaseDefaults( std::vector<SfxPoolItem*> *pDefaults, bool bDelete = false );
+
+ virtual MapUnit GetMetric( sal_uInt16 nWhich ) const;
+ void SetDefaultMetric( MapUnit eNewMetric );
+ MapUnit GetDefaultMetric() const;
+
+ /** Request string representation of pool items.
+
+ This virtual function produces a string representation
+ from the respective SfxItemPool subclass' known SfxPoolItems.
+
+ Subclasses, please override this method, and handle
+ SfxPoolItems that don't return useful/complete information on
+ SfxPoolItem::GetPresentation()
+
+ This baseclass yields the unmodified string representation of
+ rItem.
+
+ @param[in] rItem
+ SfxPoolItem to query the string representation of
+
+ @param[in] ePresent
+ requested kind of representation - see SfxItemPresentation
+
+ @param[in] eMetric
+ requested unit of measure of the representation
+
+ @param[out] rText
+ string representation of 'rItem'
+
+ @return true if it has a valid string representation
+ */
+ virtual bool GetPresentation( const SfxPoolItem& rItem,
+ MapUnit ePresentationMetric,
+ OUString& rText,
+ const IntlWrapper& rIntlWrapper ) const;
+ virtual rtl::Reference<SfxItemPool> Clone() const;
+ const OUString& GetName() const;
+
+ template<class T> const T& Put( std::unique_ptr<T> xItem, sal_uInt16 nWhich = 0 )
+ { return static_cast<const T&>(PutImpl( *xItem.release(), nWhich, /*bPassingOwnership*/true)); }
+ template<class T> const T& Put( const T& rItem, sal_uInt16 nWhich = 0 )
+ { return static_cast<const T&>(PutImpl( rItem, nWhich, /*bPassingOwnership*/false)); }
+ void Remove( const SfxPoolItem& );
+
+ const SfxPoolItem& GetDefaultItem( sal_uInt16 nWhich ) const;
+ template<class T> const T& GetDefaultItem( TypedWhichId<T> nWhich ) const
+ { return static_cast<const T&>(GetDefaultItem(sal_uInt16(nWhich))); }
+
+ bool CheckItemInPool(const SfxPoolItem *) const;
+
+ struct Item2Range
+ {
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator m_begin;
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator m_end;
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator const & begin() const { return m_begin; }
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator const & end() const { return m_end; }
+ };
+ const SfxPoolItem * GetItem2Default(sal_uInt16 nWhich) const;
+ template<class T> const T* GetItem2Default( TypedWhichId<T> nWhich ) const
+ { return static_cast<const T*>(GetItem2Default(sal_uInt16(nWhich))); }
+
+ sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const;
+ Item2Range GetItemSurrogates(sal_uInt16 nWhich) const;
+ /*
+ This is only valid for SfxPoolItem that override IsSortable and operator<.
+ Returns a range of items defined by using operator<.
+ @param rNeedle must be the same type or a supertype of the pool items for nWhich.
+ */
+ std::vector<const SfxPoolItem*> FindItemSurrogate(sal_uInt16 nWhich, SfxPoolItem const & rNeedle) const;
+
+ sal_uInt16 GetFirstWhich() const;
+ sal_uInt16 GetLastWhich() const;
+ bool IsInRange( sal_uInt16 nWhich ) const;
+ void SetSecondaryPool( SfxItemPool *pPool );
+ SfxItemPool* GetSecondaryPool() const;
+ /* get the last pool by following the GetSecondaryPool chain */
+ SfxItemPool* GetLastPoolInChain();
+ SfxItemPool* GetMasterPool() const;
+ void FreezeIdRanges();
+
+ void Delete();
+
+ bool IsItemPoolable( sal_uInt16 nWhich ) const;
+ bool IsItemPoolable( const SfxPoolItem &rItem ) const
+ { return IsItemPoolable( rItem.Which() ); }
+ void SetItemInfos( const SfxItemInfo *pInfos );
+ sal_uInt16 GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const;
+ template<class T>
+ TypedWhichId<T> GetWhich( TypedWhichId<T> nSlot, bool bDeep = true ) const
+ { return TypedWhichId<T>(GetWhich(sal_uInt16(nSlot), bDeep)); }
+ sal_uInt16 GetSlotId( sal_uInt16 nWhich ) const;
+ sal_uInt16 GetTrueWhich( sal_uInt16 nSlot, bool bDeep = true ) const;
+ sal_uInt16 GetTrueSlotId( sal_uInt16 nWhich ) const;
+
+ static bool IsWhich(sal_uInt16 nId) {
+ return nId && nId <= SFX_WHICH_MAX; }
+ static bool IsSlot(sal_uInt16 nId) {
+ return nId && nId > SFX_WHICH_MAX; }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+protected:
+ virtual const SfxPoolItem& PutImpl( const SfxPoolItem&, sal_uInt16 nWhich = 0, bool bPassingOwnership = false );
+private:
+ const SfxItemPool& operator=(const SfxItemPool &) = delete;
+
+ //IDs below or equal are Which IDs, IDs above slot IDs
+ static const sal_uInt16 SFX_WHICH_MAX = 4999;
+};
+
+// only the pool may manipulate the reference counts
+inline void SfxItemPool::ClearRefCount(SfxPoolItem& rItem)
+{
+ rItem.SetRefCount(0);
+}
+
+// only the pool may manipulate the reference counts
+inline void SfxItemPool::AddRef(const SfxPoolItem& rItem)
+{
+ rItem.AddRef();
+}
+
+// only the pool may manipulate the reference counts
+inline sal_uInt32 SfxItemPool::ReleaseRef(const SfxPoolItem& rItem, sal_uInt32 n)
+{
+ return rItem.ReleaseRef(n);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itemprop.hxx b/include/svl/itemprop.hxx
new file mode 100644
index 000000000..08207f1b1
--- /dev/null
+++ b/include/svl/itemprop.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_ITEMPROP_HXX
+#define INCLUDED_SVL_ITEMPROP_HXX
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <comphelper/propertysetinfo.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <svl/itemset.hxx>
+#include <svl/svldllapi.h>
+#include <o3tl/sorted_vector.hxx>
+#include <string_view>
+#include <utility>
+
+// values from com/sun/star/beans/PropertyAttribute
+#define PROPERTY_NONE 0
+
+/// map a property between beans::XPropertySet and SfxPoolItem
+struct SfxItemPropertyMapEntry
+{
+ OUString aName; ///< name of property
+ css::uno::Type aType; ///< UNO type of property
+ sal_uInt16 nWID; ///< WhichId of SfxPoolItem
+ /// flag bitmap, @see css::beans::PropertyAttribute
+ sal_Int16 nFlags;
+ /// "member ID" to tell QueryValue/PutValue which property it is
+ /// (when multiple properties map to the same nWID)
+ sal_uInt8 nMemberId;
+ PropertyMoreFlags nMoreFlags;
+
+ SfxItemPropertyMapEntry(OUString _aName, sal_uInt16 _nWID, css::uno::Type const & _rType,
+ sal_Int16 _nFlags, sal_uInt8 const _nMemberId, PropertyMoreFlags _nMoreFlags = PropertyMoreFlags::NONE)
+ : aName(std::move( _aName ))
+ , aType( _rType )
+ , nWID( _nWID )
+ , nFlags( _nFlags )
+ , nMemberId( _nMemberId )
+ , nMoreFlags( _nMoreFlags )
+ {
+ assert(_nFlags <= 0x1ff );
+ assert( (_nMemberId & 0x40) == 0 );
+ // Verify that if METRIC_ITEM is set, we are one of the types supported by
+ // SvxUnoConvertToMM.
+ assert(!(_nMoreFlags & PropertyMoreFlags::METRIC_ITEM) ||
+ ( (aType.getTypeClass() == css::uno::TypeClass_BYTE)
+ || (aType.getTypeClass() == css::uno::TypeClass_SHORT)
+ || (aType.getTypeClass() == css::uno::TypeClass_UNSIGNED_SHORT)
+ || (aType.getTypeClass() == css::uno::TypeClass_LONG)
+ || (aType.getTypeClass() == css::uno::TypeClass_UNSIGNED_LONG)
+ ) );
+ }
+};
+
+struct SfxItemPropertyMapCompare
+{
+ bool operator() ( const SfxItemPropertyMapEntry * lhs, const SfxItemPropertyMapEntry * rhs ) const
+ {
+ return lhs->aName < rhs->aName;
+ }
+};
+class SVL_DLLPUBLIC SfxItemPropertyMap
+{
+ o3tl::sorted_vector< const SfxItemPropertyMapEntry*, SfxItemPropertyMapCompare > m_aMap;
+ mutable css::uno::Sequence< css::beans::Property > m_aPropSeq;
+public:
+ SfxItemPropertyMap( const SfxItemPropertyMapEntry* pEntries );
+ SfxItemPropertyMap( const SfxItemPropertyMap& rSource );
+ ~SfxItemPropertyMap();
+
+ const SfxItemPropertyMapEntry* getByName( std::u16string_view rName ) const;
+ css::uno::Sequence< css::beans::Property > const & getProperties() const;
+ /// @throws css::beans::UnknownPropertyException
+ css::beans::Property getPropertyByName( const OUString & rName ) const;
+ bool hasPropertyByName( std::u16string_view rName ) const;
+
+ const o3tl::sorted_vector< const SfxItemPropertyMapEntry*, SfxItemPropertyMapCompare >& getPropertyEntries() const { return m_aMap; }
+};
+
+class SVL_DLLPUBLIC SfxItemPropertySet final
+{
+ SfxItemPropertyMap m_aMap;
+ mutable css::uno::Reference<css::beans::XPropertySetInfo> m_xInfo;
+
+public:
+ SfxItemPropertySet( const SfxItemPropertyMapEntry *pMap ) :
+ m_aMap(pMap) {}
+ ~SfxItemPropertySet();
+
+ /// @throws css::uno::RuntimeException
+ void getPropertyValue( const SfxItemPropertyMapEntry& rEntry,
+ const SfxItemSet& rSet,
+ css::uno::Any& rAny) const;
+ /// @throws css::uno::RuntimeException
+ /// @throws css::beans::UnknownPropertyException
+ void getPropertyValue( const OUString &rName,
+ const SfxItemSet& rSet,
+ css::uno::Any& rAny) const;
+ /// @throws css::uno::RuntimeException
+ /// @throws css::beans::UnknownPropertyException
+ css::uno::Any
+ getPropertyValue( const OUString &rName,
+ const SfxItemSet& rSet ) const;
+ /// @throws css::uno::RuntimeException
+ /// @throws css::lang::IllegalArgumentException
+ void setPropertyValue( const SfxItemPropertyMapEntry& rEntry,
+ const css::uno::Any& aVal,
+ SfxItemSet& rSet ) const;
+ /// @throws css::uno::RuntimeException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::beans::UnknownPropertyException
+ void setPropertyValue( const OUString& rPropertyName,
+ const css::uno::Any& aVal,
+ SfxItemSet& rSet ) const;
+
+ /// @throws css::beans::UnknownPropertyException
+ css::beans::PropertyState
+ getPropertyState(const OUString& rName, const SfxItemSet& rSet)const;
+ css::beans::PropertyState
+ getPropertyState(const SfxItemPropertyMapEntry& rEntry, const SfxItemSet& rSet) const
+ noexcept;
+
+ css::uno::Reference<css::beans::XPropertySetInfo> const &
+ getPropertySetInfo() const;
+ const SfxItemPropertyMap& getPropertyMap() const {return m_aMap;}
+};
+
+// workaround for incremental linking bugs in MSVC2015
+class SAL_DLLPUBLIC_TEMPLATE SfxItemPropertySetInfo_Base : public cppu::WeakImplHelper< css::beans::XPropertySetInfo > {};
+
+class SVL_DLLPUBLIC SfxItemPropertySetInfo final : public SfxItemPropertySetInfo_Base
+{
+ SfxItemPropertyMap m_aOwnMap;
+
+public:
+ SfxItemPropertySetInfo(const SfxItemPropertyMap &rMap );
+ SfxItemPropertySetInfo(const SfxItemPropertyMapEntry *pEntries );
+ virtual ~SfxItemPropertySetInfo() override;
+
+ virtual css::uno::Sequence< css::beans::Property > SAL_CALL
+ getProperties( ) override;
+
+ virtual css::beans::Property SAL_CALL
+ getPropertyByName( const OUString& aName ) override;
+
+ virtual sal_Bool SAL_CALL
+ hasPropertyByName( const OUString& Name ) override;
+
+};
+
+struct SfxItemPropertyMapCompare2
+{
+ bool operator() ( const SfxItemPropertyMapEntry & lhs, const SfxItemPropertyMapEntry & rhs ) const
+ {
+ return lhs.aName < rhs.aName;
+ }
+};
+
+// workaround for incremental linking bugs in MSVC2015
+class SAL_DLLPUBLIC_TEMPLATE SfxExtItemPropertySetInfo_Base : public cppu::WeakImplHelper< css::beans::XPropertySetInfo > {};
+
+class SVL_DLLPUBLIC SfxExtItemPropertySetInfo final : public SfxExtItemPropertySetInfo_Base
+{
+public:
+ SfxExtItemPropertySetInfo(
+ const SfxItemPropertyMapEntry *pMap,
+ const css::uno::Sequence<css::beans::Property>& rPropSeq );
+ virtual ~SfxExtItemPropertySetInfo() override;
+
+ virtual css::uno::Sequence< css::beans::Property > SAL_CALL
+ getProperties( ) override;
+
+ virtual css::beans::Property SAL_CALL
+ getPropertyByName( const OUString& aName ) override;
+
+ virtual sal_Bool SAL_CALL
+ hasPropertyByName( const OUString& Name ) override;
+
+private:
+ const SfxItemPropertyMapEntry* getByName( std::u16string_view rName ) const;
+ o3tl::sorted_vector< SfxItemPropertyMapEntry, SfxItemPropertyMapCompare2 > maMap;
+ mutable css::uno::Sequence< css::beans::Property > m_aPropSeq;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
new file mode 100644
index 000000000..b6404b6cc
--- /dev/null
+++ b/include/svl/itemset.hxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <cassert>
+#include <cstddef>
+#include <memory>
+#include <optional>
+#include <utility>
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <svl/typedwhich.hxx>
+#include <svl/whichranges.hxx>
+
+class SfxItemPool;
+
+class SAL_WARN_UNUSED SVL_DLLPUBLIC SfxItemSet
+{
+ friend class SfxItemIter;
+ friend class SfxWhichIter;
+
+ SfxItemPool* m_pPool; ///< pool that stores the items
+ const SfxItemSet* m_pParent; ///< derivation
+ SfxPoolItem const** m_ppItems; ///< pointer to array of items, we allocate and free this unless m_bItemsFixed==true
+ WhichRangesContainer m_pWhichRanges; ///< array of Which Ranges
+ sal_uInt16 m_nCount; ///< number of items
+ bool m_bItemsFixed; ///< true if this is a SfxItemSetFixed object
+
+friend class SfxItemPoolCache;
+friend class SfxAllItemSet;
+
+private:
+ SVL_DLLPRIVATE void RecreateRanges_Impl(const WhichRangesContainer& pNewRanges);
+
+ SfxItemSet( SfxItemPool & pool, const WhichRangesContainer& wids, std::size_t items );
+
+public:
+ SfxPoolItem const** GetItems_Impl() const { return m_ppItems; }
+
+private:
+ const SfxItemSet& operator=(const SfxItemSet &) = delete;
+
+protected:
+ // Notification-Callback
+ virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew );
+
+ void PutDirect(const SfxPoolItem &rItem);
+
+ virtual const SfxPoolItem* PutImpl( const SfxPoolItem&, sal_uInt16 nWhich, bool bPassingOwnership );
+
+ /** special constructor for SfxAllItemSet */
+ enum class SfxAllItemSetFlag { Flag };
+ SfxItemSet( SfxItemPool&, SfxAllItemSetFlag );
+ /** special constructor for SfxItemSetFixed */
+ SfxItemSet( SfxItemPool&, WhichRangesContainer&& ranges, SfxPoolItem const ** ppItems );
+
+public:
+ SfxItemSet( const SfxItemSet& );
+ SfxItemSet( SfxItemSet&& ) noexcept;
+ SfxItemSet( SfxItemPool& );
+ SfxItemSet( SfxItemPool&, const WhichRangesContainer& ranges );
+ SfxItemSet( SfxItemPool&, WhichRangesContainer&& ranges );
+
+ SfxItemSet( SfxItemPool& rPool, sal_uInt16 nWhichStart, sal_uInt16 nWhichEnd )
+ : SfxItemSet(rPool, WhichRangesContainer(nWhichStart, nWhichEnd)) {}
+
+ template<sal_uInt16... WIDs>
+ SfxItemSet(SfxItemPool& pool, svl::Items_t<WIDs...> wids)
+ : SfxItemSet(pool, WhichRangesContainer(wids)) {}
+
+ virtual ~SfxItemSet();
+
+ virtual std::unique_ptr<SfxItemSet> Clone(bool bItems = true, SfxItemPool *pToPool = nullptr) const;
+ /** note that this only works if you know for sure that you are dealing with an SfxItemSet
+ and not one of it's subclasses. */
+ SfxItemSet CloneAsValue(bool bItems = true, SfxItemPool *pToPool = nullptr) const;
+
+ // Get number of items
+ sal_uInt16 Count() const { return m_nCount; }
+ sal_uInt16 TotalCount() const;
+
+ const SfxPoolItem& Get( sal_uInt16 nWhich, bool bSrchInParent = true ) const;
+ template<class T>
+ const T& Get( TypedWhichId<T> nWhich, bool bSrchInParent = true ) const
+ {
+ return static_cast<const T&>(Get(sal_uInt16(nWhich), bSrchInParent));
+ }
+
+ /** This method eases accessing single Items in the SfxItemSet.
+
+ @param nId SlotId or the Item's WhichId
+ @param bSearchInParent also search in parent ItemSets
+ @returns 0 if the ItemSet does not contain an Item with the Id 'nWhich'
+ */
+ const SfxPoolItem* GetItem(sal_uInt16 nWhich, bool bSearchInParent = true) const;
+
+ /// Templatized version of GetItem() to directly return the correct type.
+ template<class T> const T* GetItem(sal_uInt16 nWhich, bool bSearchInParent = true) const
+ {
+ const SfxPoolItem* pItem = GetItem(nWhich, bSearchInParent);
+ const T* pCastedItem = dynamic_cast<const T*>(pItem);
+
+ assert(!pItem || pCastedItem); // if it exists, must have the correct type
+ return pCastedItem;
+ }
+ template<class T> const T* GetItem( TypedWhichId<T> nWhich, bool bSearchInParent = true ) const
+ {
+ return GetItem<T>(sal_uInt16(nWhich), bSearchInParent);
+ }
+
+
+ /// Templatized static version of GetItem() to directly return the correct type if the SfxItemSet is available.
+ template<class T> static const T* GetItem(const SfxItemSet* pItemSet, sal_uInt16 nWhich, bool bSearchInParent)
+ {
+ if (pItemSet)
+ return pItemSet->GetItem<T>(nWhich, bSearchInParent);
+
+ return nullptr;
+ }
+ template <class T>
+ static const T* GetItem(const SfxItemSet* pItemSet, TypedWhichId<T> nWhich,
+ bool bSearchInParent)
+ {
+ return GetItem<T>(pItemSet, static_cast<sal_uInt16>(nWhich), bSearchInParent);
+ }
+
+ sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const;
+
+ SfxItemState GetItemState( sal_uInt16 nWhich,
+ bool bSrchInParent = true,
+ const SfxPoolItem **ppItem = nullptr ) const;
+
+ template <class T>
+ SfxItemState GetItemState( TypedWhichId<T> nWhich,
+ bool bSrchInParent = true,
+ const T **ppItem = nullptr ) const
+ { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<SfxPoolItem const**>(ppItem)); }
+
+ /// Templatized version of GetItemState() to directly return the correct type.
+ template<class T>
+ const T * GetItemIfSet( TypedWhichId<T> nWhich,
+ bool bSrchInParent = true ) const
+ {
+ const SfxPoolItem * pItem = nullptr;
+ if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
+ return static_cast<const T*>(pItem);
+ return nullptr;
+ }
+
+ bool HasItem(sal_uInt16 nWhich, const SfxPoolItem** ppItem = nullptr) const;
+ template<class T>
+ bool HasItem(TypedWhichId<T> nWhich, const T** ppItem = nullptr) const
+ { return HasItem(sal_uInt16(nWhich), reinterpret_cast<const SfxPoolItem**>(ppItem)); }
+
+ void DisableItem(sal_uInt16 nWhich);
+ void InvalidateItem( sal_uInt16 nWhich );
+ sal_uInt16 ClearItem( sal_uInt16 nWhich = 0);
+ void ClearInvalidItems();
+ void InvalidateAllItems(); // HACK(via nWhich = 0) ???
+
+ inline void SetParent( const SfxItemSet* pNew );
+
+ // add, delete items, work on items
+public:
+ const SfxPoolItem* Put( const SfxPoolItem& rItem, sal_uInt16 nWhich )
+ { return PutImpl(rItem, nWhich, /*bPassingOwnership*/false); }
+ const SfxPoolItem* Put( std::unique_ptr<SfxPoolItem> xItem, sal_uInt16 nWhich )
+ { return PutImpl(*xItem.release(), nWhich, /*bPassingOwnership*/true); }
+ const SfxPoolItem* Put( const SfxPoolItem& rItem )
+ { return Put(rItem, rItem.Which()); }
+ const SfxPoolItem* Put( std::unique_ptr<SfxPoolItem> xItem )
+ { auto nWhich = xItem->Which(); return Put(std::move(xItem), nWhich); }
+ bool Put( const SfxItemSet&,
+ bool bInvalidAsDefault = true );
+ void PutExtended( const SfxItemSet&,
+ SfxItemState eDontCareAs,
+ SfxItemState eDefaultAs );
+
+ bool Set( const SfxItemSet&, bool bDeep = true );
+
+ void Intersect( const SfxItemSet& rSet );
+ void MergeValues( const SfxItemSet& rSet );
+ void Differentiate( const SfxItemSet& rSet );
+ void MergeValue( const SfxPoolItem& rItem, bool bOverwriteDefaults = false );
+
+ SfxItemPool* GetPool() const { return m_pPool; }
+ const WhichRangesContainer & GetRanges() const { return m_pWhichRanges; }
+ void SetRanges( const WhichRangesContainer& );
+ void SetRanges( WhichRangesContainer&& );
+ void MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo );
+ const SfxItemSet* GetParent() const { return m_pParent; }
+
+ bool operator==(const SfxItemSet &) const;
+
+ /** Compare possibly ignoring SfxItemPool pointer.
+
+ This can be used to compare the content of two SfxItemSet even if they
+ don't share the same pool. EditTextObject::Equals(...,false) uses this
+ which is needed in ScGlobal::EETextObjEqual() for
+ ScPageHFItem::operator==()
+
+ @param bComparePool
+ if <FALSE/> ignore SfxItemPool pointer,
+ if <TRUE/> compare also SfxItemPool pointer (identical to operator==())
+ */
+ bool Equals(const SfxItemSet &, bool bComparePool) const;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+private:
+ sal_uInt16 ClearSingleItemImpl( sal_uInt16 nWhich, std::optional<sal_uInt16> oItemOffsetHint );
+ sal_uInt16 ClearAllItemsImpl();
+ SfxItemState GetItemStateImpl( sal_uInt16 nWhich,
+ bool bSrchInParent,
+ const SfxPoolItem **ppItem,
+ std::optional<sal_uInt16> oItemsOffsetHint) const;
+};
+
+inline void SfxItemSet::SetParent( const SfxItemSet* pNew )
+{
+ m_pParent = pNew;
+}
+
+class SVL_DLLPUBLIC SfxAllItemSet final : public SfxItemSet
+
+// Handles all Ranges. Ranges are automatically modified by putting items.
+
+{
+public:
+ SfxAllItemSet( SfxItemPool &rPool );
+ SfxAllItemSet( const SfxItemSet & );
+ SfxAllItemSet( const SfxAllItemSet & );
+
+ virtual std::unique_ptr<SfxItemSet> Clone( bool bItems = true, SfxItemPool *pToPool = nullptr ) const override;
+private:
+ virtual const SfxPoolItem* PutImpl( const SfxPoolItem&, sal_uInt16 nWhich, bool bPassingOwnership ) override;
+};
+
+
+namespace svl::detail
+{
+/**
+ * Determines the number of sal_uInt16s in a container of pairs of
+ * sal_uInt16s, each representing a range of sal_uInt16s, and total capacity of the ranges.
+ */
+template <sal_uInt16 WID1, sal_uInt16 WID2, sal_uInt16... Rest>
+static constexpr sal_uInt16 CountRanges1()
+{
+ sal_uInt16 nCapacity = rangeSize(WID1, WID2);
+ if constexpr (sizeof...(Rest) > 0)
+ nCapacity += CountRanges1<Rest...>();
+ return nCapacity;
+}}
+
+// Allocate the items array inside the object, to reduce allocation cost.
+//
+template<sal_uInt16... WIDs>
+class SfxItemSetFixed : public SfxItemSet
+{
+public:
+ SfxItemSetFixed( SfxItemPool& rPool)
+ : SfxItemSet(rPool, WhichRangesContainer(svl::Items_t<WIDs...>{}), m_aItems) {}
+private:
+ static constexpr sal_uInt16 NITEMS = svl::detail::CountRanges1<WIDs...>();
+ const SfxPoolItem* m_aItems[NITEMS] = {};
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/languageoptions.hxx b/include/svl/languageoptions.hxx
new file mode 100644
index 000000000..e780ed475
--- /dev/null
+++ b/include/svl/languageoptions.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_LANGUAGEOPTIONS_HXX
+#define INCLUDED_SVL_LANGUAGEOPTIONS_HXX
+
+#include <svl/svldllapi.h>
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <i18nlangtag/lang.h>
+
+// class SvtLanguageOptions ----------------------------------------------------
+
+// these defines can be ORed
+// note these values DO NOT match the values in css::i18n::ScriptType
+enum class SvtScriptType : sal_uInt8
+{
+ NONE = 0x00,
+ LATIN = 0x01,
+ ASIAN = 0x02,
+ COMPLEX = 0x04,
+ UNKNOWN = 0x08 // (only used in SC) if type has not been determined yet
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvtScriptType> : is_typed_flags<SvtScriptType, 0x0f> {};
+}
+
+namespace SvtLanguageOptions
+{
+ // CJK options
+// SVL_DLLPUBLIC bool IsCJKFontEnabled() { m_pCJKOptions->IsCJKFontEnabled(); }
+// SVL_DLLPUBLIC bool IsVerticalTextEnabled() m_pCJKOptions->IsVerticalTextEnabled();
+// SVL_DLLPUBLIC bool IsAsianTypographyEnabled() m_pCJKOptions->IsAsianTypographyEnabled();
+// SVL_DLLPUBLIC bool IsJapaneseFindEnabled() m_pCJKOptions->IsJapaneseFindEnabled();
+// SVL_DLLPUBLIC void SetAll( bool _bSet ) m_pCJKOptions->SetAll( _bSet );
+// SVL_DLLPUBLIC bool IsAnyEnabled() m_pCJKOptions->IsAnyEnabled();
+
+ // CTL options
+ //SVL_DLLPUBLIC void SetCTLFontEnabled( bool _bEnabled ) m_pCTLOptions->SetCTLFontEnabled( _bEnabled );
+// SVL_DLLPUBLIC bool IsCTLFontEnabled() m_pCTLOptions->IsCTLFontEnabled();
+
+// SVL_DLLPUBLIC void SetCTLSequenceChecking( bool _bEnabled ) m_pCTLOptions->SetCTLSequenceChecking( _bEnabled );
+
+ //SVL_DLLPUBLIC void SetCTLSequenceCheckingRestricted( bool _bEnable ) m_pCTLOptions->SetCTLSequenceCheckingRestricted( _bEnable );
+
+// SVL_DLLPUBLIC void SetCTLSequenceCheckingTypeAndReplace( bool _bEnable ) m_pCTLOptions->SetCTLSequenceCheckingTypeAndReplace( _bEnable );
+
+ // returns for a language the scripttype
+ SVL_DLLPUBLIC SvtScriptType GetScriptTypeOfLanguage( LanguageType nLang );
+
+ // convert from css::i18n::ScriptType constants to SvtScriptType
+ SVL_DLLPUBLIC SvtScriptType FromI18NToSvtScriptType( sal_Int16 nI18NType );
+
+ SVL_DLLPUBLIC sal_Int16 FromSvtScriptTypeToI18N( SvtScriptType nI18NType );
+
+ SVL_DLLPUBLIC sal_Int16 GetI18NScriptTypeOfLanguage( LanguageType nLang );
+
+};
+
+/** #i42730# Gives access to the Windows 16bit system locale
+ */
+namespace SvtSystemLanguageOptions
+{
+ bool isCJKKeyboardLayoutInstalled();
+};
+
+#endif // INCLUDED_SVL_LANGUAGEOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lckbitem.hxx b/include/svl/lckbitem.hxx
new file mode 100644
index 000000000..5625a7aac
--- /dev/null
+++ b/include/svl/lckbitem.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_LCKBITEM_HXX
+#define INCLUDED_SVL_LCKBITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/svldllapi.h>
+#include <tools/stream.hxx>
+
+class SVL_DLLPUBLIC SfxLockBytesItem final : public SfxPoolItem
+{
+ SvLockBytesRef _xVal;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxLockBytesItem();
+ virtual ~SfxLockBytesItem() override;
+
+ SfxLockBytesItem(SfxLockBytesItem const &) = default;
+ SfxLockBytesItem(SfxLockBytesItem &&) = default;
+ SfxLockBytesItem & operator =(SfxLockBytesItem const &) = delete; // due to SfxPoolItem
+ SfxLockBytesItem & operator =(SfxLockBytesItem &&) = delete; // due to SfxPoolItem
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxLockBytesItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ SvLockBytes* GetValue() const { return _xVal.get(); }
+
+ virtual bool PutValue ( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/legacyitem.hxx b/include/svl/legacyitem.hxx
new file mode 100644
index 000000000..b2035aeca
--- /dev/null
+++ b/include/svl/legacyitem.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_LEGACYITEM_HXX
+#define INCLUDED_SVL_LEGACYITEM_HXX
+
+#include <svl/svldllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// // svl
+// SfxBoolItem aLinebreak;
+// SfxInt32Item aRotateAngle; -> CntInt32Item
+//////////////////////////////////////////////////////////////////////////////
+
+class SvStream;
+class SfxBoolItem;
+class CntInt32Item;
+
+namespace legacy
+{
+ namespace SfxBool
+ {
+ sal_uInt16 SVL_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion);
+ void SVL_DLLPUBLIC Create(SfxBoolItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ SVL_DLLPUBLIC SvStream& Store(const SfxBoolItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+ namespace CntInt32
+ {
+ sal_uInt16 SVL_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion);
+ void SVL_DLLPUBLIC Create(CntInt32Item& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ SVL_DLLPUBLIC SvStream& Store(const CntInt32Item& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+}
+
+#endif // INCLUDED_SVL_LEGACYITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/listener.hxx b/include/svl/listener.hxx
new file mode 100644
index 000000000..e7c589625
--- /dev/null
+++ b/include/svl/listener.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_LISTENER_HXX
+#define INCLUDED_SVL_LISTENER_HXX
+
+#include <svl/svldllapi.h>
+
+#include <o3tl/sorted_vector.hxx>
+
+class SvtBroadcaster;
+class SfxHint;
+
+class SVL_DLLPUBLIC SvtListener
+{
+ friend class SvtBroadcaster;
+ typedef o3tl::sorted_vector<SvtBroadcaster*> BroadcastersType;
+ BroadcastersType maBroadcasters;
+
+ const SvtListener& operator=(const SvtListener &) = delete;
+ // called from the SvtBroadcaster destructor
+ void BroadcasterDying( SvtBroadcaster& rBroadcaster );
+
+public:
+ class SVL_DLLPUBLIC QueryBase
+ {
+ sal_uInt16 mnId;
+ public:
+ QueryBase( sal_uInt16 nId ) : mnId(nId) {}
+ virtual ~QueryBase() {};
+
+ sal_uInt16 getId() const { return mnId; }
+ };
+
+ SvtListener() = default;
+ SvtListener( const SvtListener &r ) = default;
+ virtual ~SvtListener() COVERITY_NOEXCEPT_FALSE;
+
+ bool StartListening( SvtBroadcaster& rBroadcaster );
+ void EndListening( SvtBroadcaster& rBroadcaster );
+ void EndListeningAll();
+
+ /// Overwrites existing broadcasters with the ones from the specified listener
+ void CopyAllBroadcasters( const SvtListener& r );
+ bool HasBroadcaster() const { return !maBroadcasters.empty(); }
+
+ virtual void Notify( const SfxHint& rHint );
+ virtual void Query( QueryBase& rQuery ) const;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lngmisc.hxx b/include/svl/lngmisc.hxx
new file mode 100644
index 000000000..eb7b7cbbe
--- /dev/null
+++ b/include/svl/lngmisc.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_LNGMISC_HXX
+#define INCLUDED_SVL_LNGMISC_HXX
+
+#include <svl/svldllapi.h>
+
+#include <rtl/ustring.hxx>
+
+#define SVT_SOFT_HYPHEN u'\x00AD'
+#define SVT_HARD_HYPHEN u'\x2011'
+
+// the non-breaking space
+#define SVT_HARD_SPACE u'\x00A0'
+
+namespace linguistic
+{
+ inline bool IsHyphen(sal_Unicode cChar)
+ {
+ return cChar == SVT_SOFT_HYPHEN || cChar == SVT_HARD_HYPHEN;
+ }
+
+ inline bool IsControlChar(sal_Unicode cChar)
+ {
+ // TODO: why doesn't this include 0x7F DEL?
+ return cChar < u' ';
+ }
+
+ sal_Int32 GetNumControlChars( std::u16string_view rTxt );
+
+ SVL_DLLPUBLIC bool RemoveHyphens(OUString &rTxt);
+ SVL_DLLPUBLIC bool RemoveControlChars(OUString &rTxt);
+ SVL_DLLPUBLIC bool ReplaceControlChars(OUString &rTxt);
+ SVL_DLLPUBLIC OUString GetThesaurusReplaceText(const OUString &rText);
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lockfilecommon.hxx b/include/svl/lockfilecommon.hxx
new file mode 100644
index 000000000..d71cb8262
--- /dev/null
+++ b/include/svl/lockfilecommon.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_LOCKFILECOMMON_HXX
+#define INCLUDED_SVL_LOCKFILECOMMON_HXX
+
+#include <svl/svldllapi.h>
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <osl/mutex.hxx>
+#include <tools/urlobj.hxx>
+#include <o3tl/enumarray.hxx>
+
+#include <string_view>
+#include <vector>
+
+enum class LockFileComponent
+{
+ OOOUSERNAME, SYSUSERNAME, LOCALHOST, EDITTIME, USERURL, LAST=USERURL
+};
+
+typedef o3tl::enumarray<LockFileComponent,OUString> LockFileEntry;
+
+namespace svt {
+
+/// This is a general implementation that is used in document lock file implementation and in sharing control file implementation
+class SVL_DLLPUBLIC LockFileCommon
+{
+private:
+ OUString m_aURL;
+
+protected:
+ ::osl::Mutex m_aMutex;
+
+ /// This method generates the URL of the lock file based on the document URL and the specified prefix.
+ static OUString GenerateOwnLockFileURL(std::u16string_view aOrigURL, std::u16string_view aPrefix);
+
+public:
+ LockFileCommon(OUString aLockFileURL);
+ virtual ~LockFileCommon();
+
+ const OUString& GetURL() const;
+ void SetURL(const OUString& aURL);
+
+ static void ParseList( const css::uno::Sequence< sal_Int8 >& aBuffer, std::vector< LockFileEntry > &rOutput );
+ static LockFileEntry ParseEntry( const css::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos );
+ static OUString ParseName( const css::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos );
+ static OUString EscapeCharacters( const OUString& aSource );
+ static OUString GetOOOUserName();
+ static OUString GetCurrentLocalTime();
+ static LockFileEntry GenerateOwnEntry();
+
+ static INetURLObject ResolveLinks( const INetURLObject& aDocURL );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lstner.hxx b/include/svl/lstner.hxx
new file mode 100644
index 000000000..1b0e88063
--- /dev/null
+++ b/include/svl/lstner.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_LSTNER_HXX
+#define INCLUDED_SVL_LSTNER_HXX
+
+#include <svl/svldllapi.h>
+#include <map>
+#include <memory>
+#include <vector>
+#ifdef DBG_UTIL
+#include <sal/backtrace.hxx>
+#endif
+
+class SfxBroadcaster;
+class SfxHint;
+
+//StartListening duplicate handling options
+//Prevent only adds the listener if it's not already added
+//Allow allows duplicate listeners
+//Unexpected, the default, is for the usual case where the
+//listener should only be added once and duplicates are
+//unexpected. In dbgutil mode this tracks where the original
+//listener was added from and reports the duplicate addition
+//as an error
+enum class DuplicateHandling { Unexpected, Prevent, Allow };
+
+class SVL_DLLPUBLIC SfxListener
+{
+ std::vector<SfxBroadcaster*> maBCs;
+#ifdef DBG_UTIL
+ std::map<SfxBroadcaster*, std::unique_ptr<sal::BacktraceState>>
+ maCallStacks;
+#endif
+
+private:
+ const SfxListener& operator=(const SfxListener &) = delete;
+
+public:
+
+ SfxListener() {}
+ SfxListener( const SfxListener &rCopy );
+ virtual ~SfxListener() COVERITY_NOEXCEPT_FALSE;
+
+ void StartListening(SfxBroadcaster& rBroadcaster, DuplicateHandling eDuplicateHanding = DuplicateHandling::Unexpected);
+ void EndListening( SfxBroadcaster& rBroadcaster, bool bRemoveAllDuplicates = false );
+ void EndListeningAll();
+ bool IsListening( SfxBroadcaster& rBroadcaster ) const;
+
+ sal_uInt16 GetBroadcasterCount() const;
+ SfxBroadcaster* GetBroadcasterJOE( sal_uInt16 nNo ) const;
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ void RemoveBroadcaster_Impl( SfxBroadcaster& rBC );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/macitem.hxx b/include/svl/macitem.hxx
new file mode 100644
index 000000000..e58871101
--- /dev/null
+++ b/include/svl/macitem.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_MACITEM_HXX
+#define INCLUDED_SVL_MACITEM_HXX
+
+// class SvxMacroItem ----------------------------------------------------
+
+#include <rtl/ustring.hxx>
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <map>
+#include <utility>
+
+class SvStream;
+enum class SvMacroItemId : sal_uInt16;
+
+inline constexpr OUStringLiteral SVX_MACRO_LANGUAGE_JAVASCRIPT = u"JavaScript";
+inline constexpr OUStringLiteral SVX_MACRO_LANGUAGE_STARBASIC = u"StarBasic";
+inline constexpr OUStringLiteral SVX_MACRO_LANGUAGE_SF = u"Script";
+
+enum ScriptType
+{
+ STARBASIC,
+ JAVASCRIPT,
+ EXTENDED_STYPE
+};
+
+class SVL_DLLPUBLIC SvxMacro
+{
+ OUString aMacName;
+ OUString aLibName;
+ ScriptType eType;
+
+public:
+
+ SvxMacro( OUString aMacName, const OUString &rLanguage);
+
+ SvxMacro( OUString aMacName, OUString aLibName,
+ ScriptType eType); // = STARBASIC removes
+
+ const OUString &GetLibName() const { return aLibName; }
+ const OUString &GetMacName() const { return aMacName; }
+ OUString GetLanguage()const;
+
+ ScriptType GetScriptType() const { return eType; }
+
+ bool HasMacro() const { return !aMacName.isEmpty(); }
+};
+
+inline SvxMacro::SvxMacro( OUString _aMacName, OUString _aLibName,
+ ScriptType eTyp )
+ : aMacName(std::move( _aMacName )), aLibName(std::move( _aLibName )), eType( eTyp )
+{}
+
+// Macro Table, destroys the pointers in the DTor!
+typedef std::map<SvMacroItemId, SvxMacro> SvxMacroTable;
+
+#define SVX_MACROTBL_VERSION31 0
+#define SVX_MACROTBL_VERSION40 1
+
+class SVL_DLLPUBLIC SvxMacroTableDtor
+{
+private:
+ SvxMacroTable aSvxMacroTable;
+public:
+ SvxMacroTableDtor() {}
+ SvxMacroTableDtor( const SvxMacroTableDtor &rCpy ) : aSvxMacroTable(rCpy.aSvxMacroTable) { }
+
+ SvxMacroTableDtor& operator=( const SvxMacroTableDtor &rCpy );
+ bool operator==( const SvxMacroTableDtor& rOther ) const;
+
+ void Read( SvStream & );
+ SvStream& Write( SvStream & ) const;
+
+ bool empty() const { return aSvxMacroTable.empty(); }
+
+ // returns NULL if no entry exists, or a pointer to the internal value
+ const SvxMacro* Get(SvMacroItemId nEvent) const;
+ // returns NULL if no entry exists, or a pointer to the internal value
+ SvxMacro* Get(SvMacroItemId nEvent);
+ // return true if the key exists
+ bool IsKeyValid(SvMacroItemId nEvent) const;
+ // This stores a copy of the rMacro parameter
+ SvxMacro& Insert(SvMacroItemId nEvent, const SvxMacro& rMacro);
+ // If the entry exists, remove it from the map and release it's storage
+ void Erase(SvMacroItemId nEvent);
+};
+
+
+/*
+This item describes a Macro table.
+*/
+
+class SVL_DLLPUBLIC SvxMacroItem final : public SfxPoolItem
+{
+public:
+ explicit inline SvxMacroItem ( const sal_uInt16 nId );
+
+ // "pure virtual methods" of SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+ virtual SvxMacroItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ const SvxMacroTableDtor& GetMacroTable() const { return aMacroTable;}
+ void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aMacroTable = rTbl; }
+
+ inline const SvxMacro& GetMacro( SvMacroItemId nEvent ) const;
+ inline bool HasMacro( SvMacroItemId nEvent ) const;
+ void SetMacro( SvMacroItemId nEvent, const SvxMacro& );
+
+private:
+ SvxMacroTableDtor aMacroTable;
+
+ SvxMacroItem( const SvxMacroItem& ) = default;
+};
+
+inline SvxMacroItem::SvxMacroItem( const sal_uInt16 nId )
+ : SfxPoolItem( nId )
+{}
+
+inline bool SvxMacroItem::HasMacro( SvMacroItemId nEvent ) const
+{
+ return aMacroTable.IsKeyValid( nEvent );
+}
+inline const SvxMacro& SvxMacroItem::GetMacro( SvMacroItemId nEvent ) const
+{
+ return *(aMacroTable.Get(nEvent));
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/memberid.h b/include/svl/memberid.h
new file mode 100644
index 000000000..afe106d41
--- /dev/null
+++ b/include/svl/memberid.h
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_MEMBERID_H
+#define INCLUDED_SVL_MEMBERID_H
+
+#define MID_X 1
+#define MID_Y 2
+#define MID_RECT_LEFT 3
+#define MID_RECT_TOP 4
+#define MID_WIDTH 5
+#define MID_HEIGHT 6
+#define MID_RECT_RIGHT 7
+
+// SvxSizeItem
+#define MID_SIZE_SIZE 0
+#define MID_SIZE_WIDTH 1
+#define MID_SIZE_HEIGHT 2
+
+// SvxSearchItem
+// XXX When changing the MID count here, also increment the corresponding
+// SvxSearchItem SFX_DECL_TYPE(n) value in include/sfx2/msg.hxx to match, and
+// add a member to struct SvxSearch in sfx2/sdi/sfxitems.sdi so that dependent
+// slot items get generated.
+#define MID_SEARCH_STYLEFAMILY 1
+#define MID_SEARCH_CELLTYPE 2
+#define MID_SEARCH_ROWDIRECTION 3
+#define MID_SEARCH_ALLTABLES 4
+#define MID_SEARCH_SEARCHFILTERED 5
+#define MID_SEARCH_BACKWARD 6
+#define MID_SEARCH_PATTERN 7
+#define MID_SEARCH_CONTENT 8
+#define MID_SEARCH_ASIANOPTIONS 9
+#define MID_SEARCH_ALGORITHMTYPE 10
+#define MID_SEARCH_FLAGS 11
+#define MID_SEARCH_SEARCHSTRING 12
+#define MID_SEARCH_REPLACESTRING 13
+#define MID_SEARCH_LOCALE 14
+#define MID_SEARCH_CHANGEDCHARS 15
+#define MID_SEARCH_DELETEDCHARS 16
+#define MID_SEARCH_INSERTEDCHARS 17
+#define MID_SEARCH_TRANSLITERATEFLAGS 18
+#define MID_SEARCH_COMMAND 19
+#define MID_SEARCH_STARTPOINTX 20
+#define MID_SEARCH_STARTPOINTY 21
+#define MID_SEARCH_SEARCHFORMATTED 22
+#define MID_SEARCH_ALGORITHMTYPE2 23
+
+// SfxDocumentInfoItem
+#define MID_DOCINFO_DESCRIPTION 0x13
+#define MID_DOCINFO_KEYWORDS 0x17
+#define MID_DOCINFO_SUBJECT 0x1b
+#define MID_DOCINFO_TITLE 0x1d
+#define MID_DOCINFO_AUTOLOADENABLED 0x2d
+#define MID_DOCINFO_AUTOLOADURL 0x2e
+#define MID_DOCINFO_AUTOLOADSECS 0x2f
+#define MID_DOCINFO_DEFAULTTARGET 0x30
+#define MID_DOCINFO_USEUSERDATA 0x31
+#define MID_DOCINFO_DELETEUSERDATA 0x32
+#define MID_DOCINFO_USETHUMBNAILSAVE 0x33
+
+// only for FastPropertySet
+#define MID_TYPE 0x38
+#define MID_VALUE 0x39
+#define MID_VALUESET 0x40
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/metitem.hxx b/include/svl/metitem.hxx
new file mode 100644
index 000000000..30cf75b7f
--- /dev/null
+++ b/include/svl/metitem.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_METITEM_HXX
+#define INCLUDED_SVL_METITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/intitem.hxx>
+
+class SVL_DLLPUBLIC SfxMetricItem: public SfxInt32Item
+{
+public:
+ explicit SfxMetricItem( sal_uInt16 nWhich, sal_Int32 nValue );
+
+ virtual void ScaleMetrics( tools::Long lMult, tools::Long lDiv ) override;
+ virtual bool HasMetrics() const override;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/msodocumentlockfile.hxx b/include/svl/msodocumentlockfile.hxx
new file mode 100644
index 000000000..f91c7ccff
--- /dev/null
+++ b/include/svl/msodocumentlockfile.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVL_MSODOCUMENTLOCKFILE_HXX
+#define INCLUDED_SVL_MSODOCUMENTLOCKFILE_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/documentlockfile.hxx>
+
+#define MSO_WORD_LOCKFILE_SIZE 162
+#define MSO_EXCEL_AND_POWERPOINT_LOCKFILE_SIZE 165
+#define MSO_USERNAME_MAX_LENGTH 52
+
+namespace svt
+{
+/// Class implementing reading and writing MSO lockfiles.
+class SVL_DLLPUBLIC MSODocumentLockFile final : public GenDocumentLockFile
+{
+private:
+ enum class AppType
+ {
+ Word,
+ Excel,
+ PowerPoint
+ };
+ static AppType getAppType(std::u16string_view sOrigURL);
+ AppType m_eAppType;
+
+ virtual void
+ WriteEntryToStream(const LockFileEntry& aEntry,
+ const css::uno::Reference<css::io::XOutputStream>& xStream) override;
+
+ virtual css::uno::Reference<css::io::XInputStream> OpenStream() override;
+
+public:
+ MSODocumentLockFile(std::u16string_view aOrigURL);
+ virtual ~MSODocumentLockFile() override;
+
+ virtual LockFileEntry GetLockData() override;
+
+ virtual void RemoveFile() override;
+
+ static bool IsMSOSupportedFileFormat(std::u16string_view aURL);
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/svl/nfkeytab.hxx b/include/svl/nfkeytab.hxx
new file mode 100644
index 000000000..3ab012f39
--- /dev/null
+++ b/include/svl/nfkeytab.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_NFKEYTAB_HXX
+#define INCLUDED_SVL_NFKEYTAB_HXX
+
+#include <array>
+#include <rtl/ustring.hxx>
+
+//! For ImpSvNumberformatScan: first the short symbols, then the long symbols!
+//! e.g. first YY then YYYY
+//! The internal order is essential for the format code string scanner.
+//
+// This table is externally only to be used with method
+// OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable&, const LocaleDataWrapper& );
+// and method
+// void SvNumberFormatter::FillKeywordTable( NfKeywordTable&, LanguageType );
+enum NfKeywordIndex
+{
+ NF_KEY_NONE = 0,
+ NF_KEY_E, // exponential symbol
+ NF_KEY_AMPM, // AM/PM
+ NF_KEY_AP, // a/p
+ NF_KEY_MI, // minute (!)
+ NF_KEY_MMI, // minute 02 (!)
+ NF_KEY_M, // month (!)
+ NF_KEY_MM, // month 02 (!)
+ NF_KEY_MMM, // month short name
+ NF_KEY_MMMM, // month long name
+ NF_KEY_MMMMM, // month narrow name, first letter
+ NF_KEY_H, // hour
+ NF_KEY_HH, // hour 02
+ NF_KEY_S, // second
+ NF_KEY_SS, // second 02
+ NF_KEY_Q, // quarter
+ NF_KEY_QQ, // quarter 02
+ NF_KEY_D, // day of month
+ NF_KEY_DD, // day of month 02
+ NF_KEY_DDD, // day of week short
+ NF_KEY_DDDD, // day of week long
+ NF_KEY_YY, // year two digits
+ NF_KEY_YYYY, // year four digits
+ NF_KEY_NN, // day of week short
+ NF_KEY_NNN, // day of week long without separator, as of version 6, 10.10.97
+ NF_KEY_NNNN, // day of week long with separator
+ NF_KEY_AAA, // abbreviated day name from Japanese Xcl, same as DDD or NN English
+ NF_KEY_AAAA, // full day name from Japanese Xcl, same as DDDD or NNN English
+ NF_KEY_EC, // E non-gregorian calendar year without preceding 0
+ NF_KEY_EEC, // EE non-gregorian calendar year with preceding 0 (two digit)
+ NF_KEY_G, // abbreviated era name, latin characters M T S or H for Gengou calendar
+ NF_KEY_GG, // abbreviated era name
+ NF_KEY_GGG, // full era name
+ NF_KEY_R, // acts as EE (Xcl) => GR==GEE, GGR==GGEE, GGGR==GGGEE
+ NF_KEY_RR, // acts as GGGEE (Xcl)
+ NF_KEY_WW, // week of year, as of version 8, 19.06.98
+ NF_KEY_THAI_T, // Thai T modifier, speciality of Thai Excel, only used with Thai locale and converted to [NatNum1]
+ NF_KEY_CCC, // currency bank symbol (old version)
+ NF_KEY_BOOLEAN, // boolean
+ NF_KEY_GENERAL, // General / Standard
+ NF_KEY_LASTKEYWORD = NF_KEY_GENERAL,
+
+ // Reserved words translated and color names follow:
+ NF_KEY_TRUE, // boolean true
+ NF_KEY_FALSE, // boolean false
+ NF_KEY_COLOR, // color
+ NF_KEY_FIRSTCOLOR,
+ NF_KEY_BLACK = NF_KEY_FIRSTCOLOR, // you do know colors, don't you?
+ NF_KEY_BLUE,
+ NF_KEY_GREEN,
+ NF_KEY_CYAN,
+ NF_KEY_RED,
+ NF_KEY_MAGENTA,
+ NF_KEY_BROWN,
+ NF_KEY_GREY,
+ NF_KEY_YELLOW,
+ NF_KEY_WHITE,
+ NF_KEY_LASTCOLOR = NF_KEY_WHITE,
+
+ NF_KEYWORD_ENTRIES_COUNT
+};
+
+typedef ::std::array<OUString, NF_KEYWORD_ENTRIES_COUNT> NfKeywordTable;
+
+#endif // INCLUDED_SVL_NFKEYTAB_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/nfsymbol.hxx b/include/svl/nfsymbol.hxx
new file mode 100644
index 000000000..8a659857e
--- /dev/null
+++ b/include/svl/nfsymbol.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_NFSYMBOL_HXX
+#define INCLUDED_SVL_NFSYMBOL_HXX
+
+/* ATTENTION! If new types arrive that had its content previously handled as
+ * SYMBOLTYPE_STRING, they have to be added at several places in zforscan.cxx
+ * and/or zformat.cxx, and in xmloff/source/style/xmlnumfe.cxx. Mostly these
+ * are places where already NF_SYMBOLTYPE_STRING together with
+ * NF_SYMBOLTYPE_CURRENCY or NF_SYMBOLTYPE_DATESEP are used in the same case of
+ * a switch respectively an if-condition.
+ */
+
+namespace svt {
+
+/// Number formatter's symbol types of a token, if not key words, which are >0
+enum NfSymbolType
+{
+ NF_SYMBOLTYPE_STRING = -1, // literal string in output
+ NF_SYMBOLTYPE_DEL = -2, // special character
+ NF_SYMBOLTYPE_BLANK = -3, // blank for '_'
+ NF_SYMBOLTYPE_STAR = -4, // *-character
+ NF_SYMBOLTYPE_DIGIT = -5, // digit place holder
+ NF_SYMBOLTYPE_DECSEP = -6, // decimal separator
+ NF_SYMBOLTYPE_THSEP = -7, // group AKA thousand separator
+ NF_SYMBOLTYPE_EXP = -8, // exponent E
+ NF_SYMBOLTYPE_FRAC = -9, // fraction /
+ NF_SYMBOLTYPE_EMPTY = -10, // deleted symbols
+ NF_SYMBOLTYPE_FRACBLANK = -11, // delimiter between integer and fraction
+ NF_SYMBOLTYPE_CURRENCY = -12, // currency symbol
+ NF_SYMBOLTYPE_CURRDEL = -13, // currency symbol delimiter [$]
+ NF_SYMBOLTYPE_CURREXT = -14, // currency symbol extension -xxx
+ NF_SYMBOLTYPE_CALENDAR = -15, // calendar ID
+ NF_SYMBOLTYPE_CALDEL = -16, // calendar delimiter [~]
+ NF_SYMBOLTYPE_DATESEP = -17, // date separator
+ NF_SYMBOLTYPE_TIMESEP = -18, // time separator
+ NF_SYMBOLTYPE_TIME100SECSEP = -19, // time 100th seconds separator
+ NF_SYMBOLTYPE_PERCENT = -20, // percent %
+ NF_SYMBOLTYPE_FRAC_FDIV = -21 // forced divisors
+};
+
+} // namespace svt
+
+#endif // INCLUDED_SVL_NFSYMBOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/numformat.hxx b/include/svl/numformat.hxx
new file mode 100644
index 000000000..dc1c704d3
--- /dev/null
+++ b/include/svl/numformat.hxx
@@ -0,0 +1,750 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svl/svldllapi.h>
+#include <com/sun/star/i18n/XNumberFormatCode.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <i18nlangtag/lang.h>
+#include <tools/link.hxx>
+#include <svl/nfkeytab.hxx>
+#include <svl/ondemand.hxx>
+#include <svl/zforlist.hxx>
+#include <unotools/charclass.hxx>
+
+#include <map>
+
+class Color;
+class ImpSvNumberformatScan;
+class ImpSvNumberInputScan;
+class SvNumberFormatterRegistry_Impl;
+class NfCurrencyTable;
+
+class SVL_DLLPUBLIC SvNumberFormatter
+{
+ friend class SvNumberFormatterRegistry_Impl;
+
+public:
+ /**
+ * We can't technically have an "infinite" value, so we use an arbitrary
+ * upper precision threshold to represent the "unlimited" precision.
+ */
+ static const sal_uInt16 UNLIMITED_PRECISION;
+
+ /**
+ * Precision suitable for numbers displayed in input bar, for instance
+ * Calc's formula input bar.
+ */
+ static const sal_uInt16 INPUTSTRING_PRECISION;
+
+ /// Preferred ctor with service manager and language/country enum
+ SvNumberFormatter(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ LanguageType eLang);
+
+ ~SvNumberFormatter();
+
+ /// Set CallBack to ColorTable
+ void SetColorLink(const Link<sal_uInt16, Color*>& rColorTableCallBack);
+ /// Do the CallBack to ColorTable
+ Color* GetUserDefColor(sal_uInt16 nIndex);
+
+ /// Change language/country, also input and format scanner
+ void ChangeIntl(LanguageType eLnge);
+ /// Change the reference null date
+ void ChangeNullDate(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear);
+ /// Change standard precision
+ void ChangeStandardPrec(short nPrec);
+ /// Set zero value suppression
+ void SetNoZero(bool bNZ);
+
+ /** The language with which the formatter was initialized (system setting),
+ NOT the current language after a ChangeIntl() */
+ LanguageType GetLanguage() const;
+
+ // Determine whether two format types are input compatible or not
+ static bool IsCompatible(SvNumFormatType eOldType, SvNumFormatType eNewType);
+
+ /** Get table of formats of a specific type of a locale. A format FIndex is
+ tested whether it has the type and locale requested, if it doesn't
+ match FIndex returns the default format for the type/locale. If no
+ specific format is to be selected FIndex may be initialized to 0. */
+ SvNumberFormatTable& GetEntryTable(SvNumFormatType eType, sal_uInt32& FIndex,
+ LanguageType eLnge);
+
+ /** Get table of formats of a specific type of a language/country.
+ FIndex returns the default format of that type.
+ If the language/country was never touched before new entries are generated */
+ SvNumberFormatTable& ChangeCL(SvNumFormatType eType, sal_uInt32& FIndex, LanguageType eLnge);
+
+ /** Get table of formats of the same type as FIndex; eType and rLnge are
+ set accordingly. An unknown format is set to Standard/General */
+ SvNumberFormatTable& GetFirstEntryTable(SvNumFormatType& eType, sal_uInt32& FIndex,
+ LanguageType& rLnge);
+
+ /// Delete an entry including the format it is referring to
+ void DeleteEntry(sal_uInt32 nKey);
+
+ /** Create new entry of a format code string for language/country.
+ @return
+ <TRUE/> if string new and ok and inserted.
+ <FALSE/> if string already exists or an unresolvable parse error
+ occurred, in which case nCheckPos is the error position within rString.
+ If the error occurs at position 0 or rString is empty nCheckPos
+ will be 1, so an error in the string is always indicated by
+ nCheckPos not being zero.
+ The content of the rString variable can be changed and corrected
+ by the method.
+ nType contains the type of the format.
+ nKey contains the index key of the format.
+ */
+ bool PutEntry(OUString& rString, sal_Int32& nCheckPos, SvNumFormatType& nType, sal_uInt32& nKey,
+ LanguageType eLnge = LANGUAGE_DONTKNOW, bool bReplaceBooleanEquivalent = true);
+
+ /** Same as <method>PutEntry</method> but the format code string is
+ considered to be of language/country eLnge and is converted to
+ language/country eNewLnge */
+ bool PutandConvertEntry(OUString& rString, sal_Int32& nCheckPos, SvNumFormatType& nType,
+ sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge,
+ bool bConvertDateOrder, bool bReplaceBooleanEquivalent = true);
+
+ /** Same as <method>PutandConvertEntry</method> but the format code string
+ is considered to be of the System language/country eLnge and is
+ converted to another System language/country eNewLnge. In this case
+ the automatic currency is converted too. */
+ bool PutandConvertEntrySystem(OUString& rString, sal_Int32& nCheckPos, SvNumFormatType& nType,
+ sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge);
+
+ /** Similar to <method>PutEntry</method> and
+ <method>PutandConvertEntry</method> or
+ <method>PutandConvertEntrySystem</method>, the format code string
+ passed is considered to be of language/country eLnge. If
+ eLnge==LANGUAGE_SYSTEM the format code has to match eSysLnge, and if
+ eSysLnge is not the current application locale the format code is
+ converted to the current locale. Additionally, if the format code
+ represents an old "automatic" currency format, it is converted to the
+ new default currency format of the eLnge locale. The rString format
+ code passed as an argument may get adapted in case eLnge was used (or
+ is LANGUAGE_SYSTEM and eSysLnge is identical); in case it wasn't the
+ method works on a copy instead, otherwise the resulting string would
+ not match eSysLnge anymore.
+
+ <p> This method was introduced to handle the legacy currency formats of
+ the "autotbl.fmt" file used by Calc and Writer and convert them to
+ fixed currency codes of the actual currency. Note that in the case of
+ legacy currency formats no special attribution is converted, only the
+ default currency format of the locale is chosen, and that new fixed
+ currency codes are of course not converted to other currencies. The
+ method may also be used as a general method taking, converting and
+ inserting almost arbitrary format codes. To insert or use, for example,
+ the default currency format code matching the current locale, the
+ method could be called with<br/>
+
+ <code>
+ GetIndexPuttingAndConverting( "0 $", LANGUAGE_SYSTEM, LANGUAGE_ENGLISH_US, ...);
+ </code>
+
+ @return
+ The index key of the resulting number format. If the format code
+ was empty, could not be converted or has errors, the eLnge locale's
+ standard number format is chosen instead. The index key is
+ guaranteed to represent some valid number format. If
+ rNewInserted==false and rCheckPos>0 the format code has errors
+ and/or could not be converted.
+ */
+ sal_uInt32 GetIndexPuttingAndConverting(OUString& rString, LanguageType eLnge,
+ LanguageType eSysLnge, SvNumFormatType& rType,
+ bool& rNewInserted, sal_Int32& rCheckPos);
+
+ /** Create a format code string using format nIndex as a template and
+ applying other settings (passed from the dialog) */
+ OUString GenerateFormat(sal_uInt32 nIndex, LanguageType eLnge = LANGUAGE_DONTKNOW,
+ bool bThousand = false, bool IsRed = false, sal_uInt16 nPrecision = 0,
+ sal_uInt16 nLeadingCnt = 1);
+
+ /** Analyze an input string
+ @return
+ <TRUE/> if input is a number or is matching a format F_Index
+ F_Index is set to a matching format if number, the value is
+ returned in fOutNumber
+ <FALSE/> if input is not a number
+ */
+ bool IsNumberFormat(const OUString& sString, sal_uInt32& F_Index, double& fOutNumber,
+ SvNumInputOptions eInputOptions = SvNumInputOptions::NONE);
+
+ /// Format a number according to a format index, return string and color
+ void GetOutputString(const double& fOutNumber, sal_uInt32 nFIndex, OUString& sOutString,
+ const Color** ppColor, bool bUseStarFormat = false);
+
+ /** Format a string according to a format index, return string and color.
+ Formats only if the format code is of type text or the 4th subcode
+ of a format code is specified, otherwise sOutString will be == "" */
+ void GetOutputString(const OUString& sString, sal_uInt32 nFIndex, OUString& sOutString,
+ const Color** ppColor, bool bUseStarFormat = false);
+
+ /** Format a number according to the standard default format matching
+ the given format index. rOutString will be the real cell string (e.g.
+ a number rounded by the cell format, which rounded value is used
+ in the filtering condition now), instead of the EditFormat string
+ (e.g a not rounded value, which is visible during editing).*/
+ void GetInputLineString(const double& fOutNumber, sal_uInt32 nFIndex, OUString& rOutString,
+ bool bFiltering = false, bool bForceSystemLocale = false);
+
+ /** Format a number according to a format code string to be scanned.
+ @return
+ <FALSE/> if format code contains an error
+ <TRUE/> else, in which case the string and color are returned.
+ */
+ bool GetPreviewString(const OUString& sFormatString, double fPreviewNumber,
+ OUString& sOutString, const Color** ppColor, LanguageType eLnge,
+ bool bUseStarFormat = false);
+
+ /** Same as <method>GetPreviewString</method> but the format code string
+ may be either language/country eLnge or en_US english US */
+ bool GetPreviewStringGuess(const OUString& sFormatString, double fPreviewNumber,
+ OUString& sOutString, const Color** ppColor,
+ LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Format a string according to a format code string to be scanned.
+ @return
+ <FALSE/> if format code contains an error
+ <TRUE/> else, in which case the string and color are returned.
+ */
+ bool GetPreviewString(const OUString& sFormatString, const OUString& sPreviewString,
+ OUString& sOutString, const Color** ppColor,
+ LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Test whether the format code string is already present in container
+ @return
+ NUMBERFORMAT_ENTRY_NOT_FOUND if not found, else the format index.
+ */
+ sal_uInt32 TestNewString(const OUString& sFormatString, LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /// Whether format index nFIndex is of type text or not
+ bool IsTextFormat(sal_uInt32 nFIndex) const;
+
+ /// Get additional info of a format index, e.g. for dialog box
+ void GetFormatSpecialInfo(sal_uInt32 nFormat, bool& bThousand, bool& IsRed,
+ sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt);
+
+ /// Count of decimals
+ sal_uInt16 GetFormatPrecision(sal_uInt32 nFormat) const;
+
+ /// Count of integer digits
+ sal_uInt16 GetFormatIntegerDigits(sal_uInt32 nFormat) const;
+
+ /** Get additional info of a format code string, e.g. for dialog box.
+ Uses a temporary parse, if possible use only if format code is not
+ present in container yet, otherwise ineffective.
+ @return
+ 0 if format code string parsed without errors, otherwise error
+ position (like nCheckPos on <method>PutEntry</method>)
+ */
+ sal_uInt32 GetFormatSpecialInfo(const OUString&, bool& bThousand, bool& IsRed,
+ sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt,
+ LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /// Get return string for Calc CELL() function, "G", "D1", ...
+ OUString GetCalcCellReturn(sal_uInt32 nFormat) const;
+
+ bool IsUserDefined(sal_uInt32 F_Index) const;
+
+ /// Check if format code string may be deleted by user
+ bool IsUserDefined(std::u16string_view sStr, LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Return the format index of the format code string for language/country,
+ or NUMBERFORMAT_ENTRY_NOT_FOUND */
+ sal_uInt32 GetEntryKey(std::u16string_view sStr, LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /// Return the format for a format index
+ const SvNumberformat* GetEntry(sal_uInt32 nKey) const;
+
+ /// Obtain substituted GetFormatEntry(), i.e. system formats.
+ const SvNumberformat* GetSubstitutedEntry(sal_uInt32 nKey, sal_uInt32& o_rNewKey) const;
+
+ /// Return the format index of the standard default number format for language/country
+ sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /// Return the format index of the default format of a type for language/country
+ sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Return the format index of the default format of a type for language/country.
+ Maybe not the default format but a special builtin format, e.g. for
+ NF_TIME_HH_MMSS00, if that format is passed in nFIndex. */
+ sal_uInt32 GetStandardFormat(sal_uInt32 nFIndex, SvNumFormatType eType, LanguageType eLnge);
+
+ /** Return the format index of the default format of a type for language/country.
+ Maybe not the default format but a special builtin format, e.g. for
+ NF_TIME_HH_MMSS00, or NF_TIME_HH_MMSS if fNumber >= 1.0 */
+ sal_uInt32 GetStandardFormat(double fNumber, sal_uInt32 nFIndex, SvNumFormatType eType,
+ LanguageType eLnge);
+
+ /// Whether nFIndex is a special builtin format
+ bool IsSpecialStandardFormat(sal_uInt32 nFIndex, LanguageType eLnge);
+
+ /** Return a time format that best matches fNumber. */
+ sal_uInt32 GetTimeFormat(double fNumber, LanguageType eLnge, bool bForceDuration);
+
+ /** Return a format and type that best matches the value of fNumber if
+ fNumber is assumed to be a date, time or datetime value, but unknown
+ which. Originally introduced for Chart databrowser editor, probably
+ should not be used otherwise. */
+ sal_uInt32 GuessDateTimeFormat(SvNumFormatType& rType, double fNumber, LanguageType eLnge);
+
+ /** Return the corresponding edit format of a format.
+
+ nFIndex, eType and pFormat (if not nullptr) are assumed to match each
+ other / be of one format. The locale to use is obtained from pFormat,
+ if nullptr then LANGUAGE_SYSTEM is used. This can be overridden by
+ specifying eForLocale other than LANGUAGE_DONTKNOW.
+ */
+ sal_uInt32 GetEditFormat(double fNumber, sal_uInt32 nFIndex, SvNumFormatType eType,
+ SvNumberformat const* pFormat,
+ LanguageType eForLocale = LANGUAGE_DONTKNOW);
+
+ /// Return the reference date
+ const Date& GetNullDate() const;
+ /// Return the standard decimal precision
+ sal_uInt16 GetStandardPrec() const;
+ /// Return whether zero suppression is switched on
+ bool GetNoZero() const;
+ /** Get the type of a format (or css::util::NumberFormat::UNDEFINED if no entry),
+ but with css::util::NumberFormat::DEFINED masked out */
+ SvNumFormatType GetType(sal_uInt32 nFIndex) const;
+
+ /// As the name says
+ void ClearMergeTable();
+ /// Merge in all new entries from rNewTable and return a table of resulting new format indices
+ SvNumberFormatterIndexTable* MergeFormatter(SvNumberFormatter& rNewTable);
+
+ /// Whether a merge table is present or not
+ bool HasMergeFormatTable() const;
+ /// Return the new format index for an old format index, if a merge table exists
+ sal_uInt32 GetMergeFormatIndex(sal_uInt32 nOldFmt) const;
+
+ /** Convert the ugly old tools' Table type bloated with new'ed sal_uInt32
+ entries merge table to ::std::map with old index key and new index key.
+ @ATTENTION! Also clears the old table using ClearMergeTable() */
+ SvNumberFormatterMergeMap ConvertMergeTableToMap();
+
+ /** Return the format index of a builtin format for a specific language/country.
+ If nFormat is not a builtin format nFormat is returned. */
+ sal_uInt32 GetFormatForLanguageIfBuiltIn(sal_uInt32 nFormat,
+ LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Return the format index for a builtin format of a specific language
+ @see NfIndexTableOffset
+ */
+ sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Return enum index of a format index of a builtin format,
+ NF_INDEX_TABLE_ENTRIES if it's not a builtin format.
+ @see NfIndexTableOffset
+ */
+ NfIndexTableOffset GetIndexTableOffset(sal_uInt32 nFormat) const;
+
+ /** Set evaluation type and order of input date strings
+ @see NfEvalDateFormat
+ */
+ void SetEvalDateFormat(NfEvalDateFormat eEDF);
+ NfEvalDateFormat GetEvalDateFormat() const;
+
+ /** Set TwoDigitYearStart, how the input string scanner handles a two digit year.
+ Default from VCL: 1930, 30-99 19xx, 00-29 20xx
+
+ <p> Historically (prior to src513e) it was a two digit number determining
+ until which number the string scanner recognizes a year to be 20xx,
+ default <= 29 is used by SFX/OfaMiscCfg.
+ The name Year2000 is kept although the actual functionality is now a
+ TwoDigitYearStart which might be in any century.
+ */
+ void SetYear2000(sal_uInt16 nVal);
+ sal_uInt16 GetYear2000() const;
+ static sal_uInt16 GetYear2000Default();
+
+ sal_uInt16 ExpandTwoDigitYear(sal_uInt16 nYear) const;
+ static sal_uInt16 ExpandTwoDigitYear(sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart);
+
+ /// Return the decimal separator matching the locale of the given format
+ OUString GetFormatDecimalSep(sal_uInt32 nFormat) const;
+
+ /// Return the decimal separator matching the given locale / LanguageType.
+ OUString GetLangDecimalSep(LanguageType nLang) const;
+
+ static void resetTheCurrencyTable();
+
+ /// Return a NfCurrencyTable with pointers to <type>NfCurrencyEntry</type> entries
+ static const NfCurrencyTable& GetTheCurrencyTable();
+
+ /** Searches, according to the default locale currency, an entry of the
+ CurrencyTable which is <bold>not</bold> the first (LANGUAGE_SYSTEM) entry.
+ @return
+ <NULL/> if not found
+ else pointer to NfCurrencyEntry
+ */
+ static const NfCurrencyEntry* MatchSystemCurrency();
+
+ /** Return a NfCurrencyEntry matching a language/country.
+ If language/country is LANGUAGE_SYSTEM a <method>MatchSystemCurrency</method>
+ call is tried to get an entry. If that fails or the corresponding
+ language/country is not present the entry for LANGUAGE_SYSTEM is returned.
+ */
+ static const NfCurrencyEntry& GetCurrencyEntry(LanguageType);
+
+ /** Return a NfCurrencyEntry pointer matching a language/country
+ and currency abbreviation (AKA banking symbol).
+ This method is meant for the configuration of the default currency.
+ @return
+ <NULL/> if not found
+ else pointer to NfCurrencyEntry
+ */
+ static const NfCurrencyEntry* GetCurrencyEntry(std::u16string_view rAbbrev, LanguageType eLang);
+
+ /** Return a NfCurrencyEntry pointer matching the symbol
+ combination of a LegacyOnly currency. Note that this means only that
+ the currency matching both symbols was once used in the Office, but is
+ not offered in dialogs anymore. It doesn't even mean that the currency
+ symbol combination is valid, since the reason for removing it may have
+ been just that. #i61657#
+ @return
+ A matching entry, or else <NULL/>.
+ */
+ static const NfCurrencyEntry* GetLegacyOnlyCurrencyEntry(std::u16string_view rSymbol,
+ std::u16string_view rAbbrev);
+
+ /** Set the default system currency. The combination of abbreviation and
+ language must match an existent element of theCurrencyTable. If not,
+ the SYSTEM (current locale) entry becomes the default.
+ This method is meant for the configuration of the default currency.
+ */
+ static void SetDefaultSystemCurrency(std::u16string_view rAbbrev, LanguageType eLang);
+
+ /** Get all standard formats for a specific currency, formats are
+ appended to the NfWSStringsDtor list.
+ @param bBank
+ <TRUE/>: generate only format strings with currency abbreviation
+ <FALSE/>: mixed format strings
+ @return
+ position of default format
+ */
+ sal_uInt16 GetCurrencyFormatStrings(NfWSStringsDtor&, const NfCurrencyEntry&, bool bBank) const;
+
+ /** Whether nFormat is of type css::util::NumberFormat::CURRENCY and the format code
+ contains a new SYMBOLTYPE_CURRENCY and if so which one [$xxx-nnn].
+ If ppEntry is not NULL and exactly one entry is found, a [$xxx-nnn] is
+ returned, even if the format code only contains [$xxx] !
+ */
+ bool GetNewCurrencySymbolString(sal_uInt32 nFormat, OUString& rSymbol,
+ const NfCurrencyEntry** ppEntry, bool* pBank = nullptr) const;
+
+ /** Look up the corresponding NfCurrencyEntry matching
+ rSymbol (may be CurrencySymbol or CurrencyAbbreviation) and possibly
+ a rExtension (being yyy of [$xxx-yyy]) or a given language/country
+ value. Tries to match a rSymbol with rExtension first, then with
+ eFormatLanguage, then rSymbol only. This is because a currency entry
+ might have been constructed using I18N locale data where a used locale
+ of a currency format code must not necessarily match the locale of
+ the locale data itself, e.g. [$HK$-40C] (being "zh_HK" locale) in
+ zh_CN locale data. Here the rExtension would have the value 0x40c but
+ eFormatLanguage of the number format would have the value of zh_CN
+ locale, the value with which the corresponding CurrencyEntry is
+ constructed.
+
+ @param bFoundBank
+ Only used for output.
+ If the return value is not <NULL/> this value is set to <TRUE/> if
+ the matching entry was found by comparing rSymbol against the
+ CurrencyAbbreviation (AKA BankSymbol).
+ If the return value is <NULL/> the value of bFoundBank is undefined.
+ @param rSymbol
+ Currency symbol, preferably obtained of a format by a call to
+ <method>SvNumberformat::GetNewCurrencySymbol()</method>
+ @param rExtension
+ Currency extension, preferably obtained of a format by a call to
+ <method>SvNumberformat::GetNewCurrencySymbol()</method>
+ @param eFormatLanguage
+ The language/country value of the format of which rSymbol and
+ rExtension are obtained (<method>SvNumberformat::GetLanguage()</method>).
+ @param bOnlyStringLanguage
+ If <TRUE/> only entries with language/country of rExtension are
+ checked, no match on eFormatLanguage. If rExtension is empty all
+ entries are checked.
+ @return
+ The matching entry if unique (in which case bFoundBank is set),
+ else <NULL/>.
+ */
+ static const NfCurrencyEntry* GetCurrencyEntry(bool& bFoundBank, std::u16string_view rSymbol,
+ const OUString& rExtension,
+ LanguageType eFormatLanguage,
+ bool bOnlyStringLanguage = false);
+
+ /// Get compatibility ("automatic" old style) currency from I18N locale data
+ void GetCompatibilityCurrency(OUString& rSymbol, OUString& rAbbrev) const;
+
+ /// Fill rList with the language/country codes that have been allocated
+ void GetUsedLanguages(std::vector<LanguageType>& rList);
+
+ /// Fill a NfKeywordIndex table with keywords of a language/country
+ void FillKeywordTable(NfKeywordTable& rKeywords, LanguageType eLang);
+
+ /** Fill a NfKeywordIndex table with keywords usable in Excel export with
+ GetFormatStringForExcel() or SvNumberformat::GetMappedFormatstring() */
+ void FillKeywordTableForExcel(NfKeywordTable& rKeywords);
+
+ /** Return a format code string suitable for Excel export.
+
+ @param rTempFormatter
+ SvNumberFormatter to use if a non-en-US format code needs to be
+ converted and put, should not be the same formatter to not
+ pollute the entries of this one here.
+ */
+ OUString GetFormatStringForExcel(sal_uInt32 nKey, const NfKeywordTable& rKeywords,
+ SvNumberFormatter& rTempFormatter) const;
+
+ /** Return a keyword for a language/country and NfKeywordIndex
+ for XML import, to generate number format strings. */
+ OUString GetKeyword(LanguageType eLnge, sal_uInt16 nIndex);
+
+ /** Return the GENERAL keyword in proper case ("General") for a
+ language/country, used in XML import */
+ OUString GetStandardName(LanguageType eLnge);
+
+ /** Check if a specific locale has supported locale data. */
+ static bool IsLocaleInstalled(LanguageType eLang);
+
+ /** Obtain NfKeywordTable used with a format, possibly localized.
+
+ XXX NOTE: the content (actual keywords) is only valid as long as the
+ locale context of the associated ImpSvNumberformatScan instance does
+ not change to a locale with different keywords, which may happen
+ anytime with a call (implicit or explicit) to
+ SvNumberFormatter::ChangeIntl(). If needed longer, copy-create another
+ NfKeywordTable instance or copy individual elements.
+
+ If the format specified with nKey does not exist, the content of the
+ NfKeywordTable matches the locale with which the SvNumberFormatter
+ instance was created and initialized.
+
+ This function preliminary exists for unit tests and otherwise is
+ pretty much useless.
+ */
+ const NfKeywordTable& GetKeywords(sal_uInt32 nKey);
+
+ /** Access for unit tests. */
+ const NfKeywordTable& GetEnglishKeywords() const;
+
+ /** Access for unit tests. */
+ const std::vector<Color>& GetStandardColors() const;
+
+ /** Access for unit tests. */
+ size_t GetMaxDefaultColors() const;
+
+ struct InputScannerPrivateAccess
+ {
+ friend class ImpSvNumberInputScan;
+
+ private:
+ InputScannerPrivateAccess() {}
+ };
+ /** Access for input scanner to temporarily (!) switch locales. */
+ OnDemandLocaleDataWrapper& GetOnDemandLocaleDataWrapper(const InputScannerPrivateAccess&)
+ {
+ return xLocaleData;
+ }
+
+private:
+ mutable ::osl::Mutex m_aMutex;
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ LanguageTag maLanguageTag;
+ std::map<sal_uInt32, std::unique_ptr<SvNumberformat>>
+ aFTable; // Table of format keys to format entries
+ typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap;
+ DefaultFormatKeysMap aDefaultFormatKeys; // Table of default standard to format keys
+ std::unique_ptr<SvNumberFormatTable> pFormatTable; // For the UI dialog
+ std::unique_ptr<SvNumberFormatterIndexTable>
+ pMergeTable; // List of indices for merging two formatters
+ OnDemandCharClass xCharClass; // CharacterClassification
+ OnDemandLocaleDataWrapper xLocaleData; // LocaleData switched between SYSTEM, ENGLISH and other
+ OnDemandTransliterationWrapper xTransliteration; // Transliteration loaded on demand
+ OnDemandCalendarWrapper xCalendar; // Calendar loaded on demand
+ OnDemandNativeNumberWrapper xNatNum; // Native number service loaded on demand
+ std::unique_ptr<ImpSvNumberInputScan> pStringScanner; // Input string scanner
+ std::unique_ptr<ImpSvNumberformatScan> pFormatScanner; // Format code string scanner
+ Link<sal_uInt16, Color*> aColorLink; // User defined color table CallBack
+ sal_uInt32 MaxCLOffset; // Max language/country offset used
+ sal_uInt32 nDefaultSystemCurrencyFormat; // NewCurrency matching SYSTEM locale
+ LanguageType IniLnge; // Initialized setting language/country
+ LanguageType ActLnge; // Current setting language/country
+ NfEvalDateFormat eEvalDateFormat; // DateFormat evaluation
+ bool bNoZero; // Zero value suppression
+
+ // cached locale data items needed almost any time
+ OUString aDecimalSep;
+ OUString aDecimalSepAlt;
+ OUString aThousandSep;
+ OUString aDateSep;
+
+ SVL_DLLPRIVATE static volatile bool bCurrencyTableInitialized;
+ SVL_DLLPRIVATE static sal_uInt16 nSystemCurrencyPosition;
+ SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl* pFormatterRegistry;
+
+ // get the registry, create one if none exists
+ SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl& GetFormatterRegistry();
+
+ // called by ctors
+ SVL_DLLPRIVATE void ImpConstruct(LanguageType eLang);
+
+ // Generate builtin formats provided by i18n behind CLOffset,
+ // if bNoAdditionalFormats==false also generate additional i18n formats.
+ SVL_DLLPRIVATE void ImpGenerateFormats(sal_uInt32 CLOffset, bool bNoAdditionalFormats);
+
+ // Generate additional formats provided by i18n
+ SVL_DLLPRIVATE void ImpGenerateAdditionalFormats(
+ sal_uInt32 CLOffset,
+ css::uno::Reference<css::i18n::XNumberFormatCode> const& rNumberFormatCode,
+ bool bAfterChangingSystemCL);
+
+ SVL_DLLPRIVATE SvNumberformat* ImpInsertFormat(const css::i18n::NumberFormatCode& rCode,
+ sal_uInt32 nPos,
+ bool bAfterChangingSystemCL = false,
+ sal_Int16 nOrgIndex = 0);
+
+ // Return CLOffset or (MaxCLOffset + SV_COUNTRY_LANGUAGE_OFFSET) if new language/country
+ SVL_DLLPRIVATE sal_uInt32 ImpGetCLOffset(LanguageType eLnge) const;
+
+ // Test whether format code already exists, then return index key,
+ // otherwise NUMBERFORMAT_ENTRY_NOT_FOUND
+ SVL_DLLPRIVATE sal_uInt32 ImpIsEntry(std::u16string_view rString, sal_uInt32 CLOffset,
+ LanguageType eLnge);
+
+ // Create builtin formats for language/country if necessary, return CLOffset
+ SVL_DLLPRIVATE sal_uInt32 ImpGenerateCL(LanguageType eLnge);
+
+ // Create theCurrencyTable with all <type>NfCurrencyEntry</type>
+ SVL_DLLPRIVATE static void ImpInitCurrencyTable();
+
+ // Return the format index of the currency format of the system locale.
+ // Format is created if not already present.
+ SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultSystemCurrencyFormat();
+
+ // Return the format index of the currency format of the current locale.
+ // Format is created if not already present.
+ SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultCurrencyFormat();
+
+ // Return the default format for a given type and current locale.
+ // May ONLY be called from within GetStandardFormat().
+ SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultFormat(SvNumFormatType nType);
+
+ // Return the index in a sequence of format codes matching an enum of
+ // NfIndexTableOffset. If not found 0 is returned. If the sequence doesn't
+ // contain any format code elements a default element is created and inserted.
+ SVL_DLLPRIVATE sal_Int32 ImpGetFormatCodeIndex(
+ css::uno::Sequence<css::i18n::NumberFormatCode>& rSeq, const NfIndexTableOffset nTabOff);
+
+ // Adjust a sequence of format codes to contain only one (THE) default
+ // instead of multiple defaults for short/medium/long types.
+ // If there is no medium but a short and a long default the long is taken.
+ // Non-PRODUCT version may check locale data for matching defaults in one
+ // FormatElement group.
+ SVL_DLLPRIVATE void ImpAdjustFormatCodeDefault(css::i18n::NumberFormatCode* pFormatArr,
+ sal_Int32 nCount);
+
+ // Obtain the format entry for a given key index.
+ SVL_DLLPRIVATE SvNumberformat* GetFormatEntry(sal_uInt32 nKey);
+ SVL_DLLPRIVATE const SvNumberformat* GetFormatEntry(sal_uInt32 nKey) const;
+
+ // used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry()
+ static bool ImpLookupCurrencyEntryLoopBody(const NfCurrencyEntry*& pFoundEntry,
+ bool& bFoundBank, const NfCurrencyEntry* pData,
+ sal_uInt16 nPos, std::u16string_view rSymbol);
+
+ // link to be set at <method>SvtSysLocaleOptions::SetCurrencyChangeLink()</method>
+ DECL_DLLPRIVATE_STATIC_LINK(SvNumberFormatter, CurrencyChangeLink, LinkParamNone*, void);
+
+ // return position of a special character
+ sal_Int32 ImpPosToken(const OUStringBuffer& sFormat, sal_Unicode token,
+ sal_Int32 nStartPos = 0) const;
+
+ // Substitute a format during GetFormatEntry(), i.e. system formats.
+ SvNumberformat* ImpSubstituteEntry(SvNumberformat* pFormat, sal_uInt32* o_pRealKey = nullptr);
+
+ // own mutex, may also be used by internal class SvNumberFormatterRegistry_Impl
+ static ::osl::Mutex& GetGlobalMutex();
+ ::osl::Mutex& GetInstanceMutex() const { return m_aMutex; }
+
+public:
+ // called by SvNumberFormatterRegistry_Impl::Notify if the default system currency changes
+ void ResetDefaultSystemCurrency();
+
+ // Called by SvNumberFormatterRegistry_Impl::Notify if the system locale's
+ // date acceptance patterns change.
+ void InvalidateDateAcceptancePatterns();
+
+ // Replace the SYSTEM language/country format codes. Called upon change of
+ // the user configurable locale.
+ // Old compatibility codes are replaced, user defined are converted, and
+ // new format codes are appended.
+ void ReplaceSystemCL(LanguageType eOldLanguage);
+
+ const css::uno::Reference<css::uno::XComponentContext>& GetComponentContext() const;
+
+ //! The following method is not to be used from outside but must be
+ //! public for the InputScanner.
+ // return the current FormatScanner
+ const ImpSvNumberformatScan* GetFormatScanner() const;
+
+ //! The following methods are not to be used from outside but must be
+ //! public for the InputScanner and FormatScanner.
+
+ // return current (!) Locale
+ const LanguageTag& GetLanguageTag() const;
+
+ // return corresponding Transliteration wrapper
+ const ::utl::TransliterationWrapper* GetTransliteration() const;
+
+ // return the corresponding CharacterClassification wrapper
+ const CharClass* GetCharClass() const;
+
+ // return the corresponding LocaleData wrapper
+ const LocaleDataWrapper* GetLocaleData() const;
+
+ // return the corresponding Calendar wrapper
+ CalendarWrapper* GetCalendar() const;
+
+ // return the corresponding NativeNumberSupplier wrapper
+ const NativeNumberWrapper* GetNatNum() const;
+
+ // cached locale data items
+
+ // return the corresponding decimal separator
+ const OUString& GetNumDecimalSep() const;
+
+ // return the corresponding decimal separator alternative
+ const OUString& GetNumDecimalSepAlt() const;
+
+ // return the corresponding group (AKA thousand) separator
+ const OUString& GetNumThousandSep() const;
+
+ // return the corresponding date separator
+ const OUString& GetDateSep() const;
+
+ // checks for decimal separator and optional alternative
+ bool IsDecimalSep(std::u16string_view rStr) const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/numuno.hxx b/include/svl/numuno.hxx
new file mode 100644
index 000000000..a439b9559
--- /dev/null
+++ b/include/svl/numuno.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_NUMUNO_HXX
+#define INCLUDED_SVL_NUMUNO_HXX
+
+#include <svl/svldllapi.h>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <memory>
+
+class SvNumberFormatter;
+class SvNumFmtSuppl_Impl;
+
+namespace comphelper
+{
+ class SharedMutex;
+}
+
+
+// SvNumberFormatsSupplierObj: aggregate to document,
+// construct with SvNumberFormatter
+
+class SVL_DLLPUBLIC SvNumberFormatsSupplierObj : public cppu::WeakAggImplHelper2<
+ css::util::XNumberFormatsSupplier,
+ css::lang::XUnoTunnel>
+{
+private:
+ std::unique_ptr<SvNumFmtSuppl_Impl> pImpl;
+
+public:
+ SvNumberFormatsSupplierObj();
+ SvNumberFormatsSupplierObj(SvNumberFormatter* pForm);
+ virtual ~SvNumberFormatsSupplierObj() override;
+
+ void SetNumberFormatter(SvNumberFormatter* pNew);
+ SvNumberFormatter* GetNumberFormatter() const;
+
+ // XNumberFormatsSupplier
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL
+ getNumberFormatSettings() override;
+ virtual css::uno::Reference< css::util::XNumberFormats > SAL_CALL
+ getNumberFormats() override;
+
+ // XUnoTunnel
+ UNO3_GETIMPLEMENTATION_DECL(SvNumberFormatsSupplierObj)
+
+ ::comphelper::SharedMutex& getSharedMutex() const;
+};
+
+#endif // INCLUDED_SVL_NUMUNO_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ondemand.hxx b/include/svl/ondemand.hxx
new file mode 100644
index 000000000..4a0a91b18
--- /dev/null
+++ b/include/svl/ondemand.hxx
@@ -0,0 +1,349 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <i18nlangtag/lang.h>
+#include <i18nutil/transliteration.hxx>
+#include <unotools/syslocale.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/calendarwrapper.hxx>
+#include <unotools/transliterationwrapper.hxx>
+#include <unotools/nativenumberwrapper.hxx>
+#include <unotools/charclass.hxx>
+#include <optional>
+
+/*
+ On demand instantiation and initialization of several i18n wrappers,
+ helping the number formatter to not perform worse than it already does.
+ */
+
+/** @short
+ Switch between LANGUAGE_SYSTEM and LANGUAGE_ENGLISH_US and any other
+ LocaleDataWrapper.
+ SvNumberformatter uses it upon switching locales.
+
+ @descr
+ Avoids reloading and analysing of locale data again and again.
+
+ @ATTENTION
+ If the default ctor is used the init() method MUST be called before
+ accessing any locale data. The passed parameters Locale and LanguageType
+ must match each other.
+ */
+
+class OnDemandLocaleDataWrapper
+{
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ SvtSysLocale aSysLocale;
+ LanguageType eCurrentLanguage;
+ LanguageType eLastAnyLanguage;
+ std::optional<LocaleDataWrapper> moEnglish;
+ std::optional<LocaleDataWrapper> moAny;
+ int nCurrent; // 0 == system, 1 == english, 2 == any
+ bool bInitialized;
+
+public:
+ OnDemandLocaleDataWrapper()
+ : eLastAnyLanguage(LANGUAGE_DONTKNOW)
+ , nCurrent(0)
+ , bInitialized(false)
+ {
+ eCurrentLanguage = LANGUAGE_SYSTEM;
+ }
+
+ bool isInitialized() const { return bInitialized; }
+
+ void init(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ const LanguageTag& rLanguageTag)
+ {
+ m_xContext = rxContext;
+ changeLocale(rLanguageTag);
+ bInitialized = true;
+ }
+
+ void changeLocale(const LanguageTag& rLanguageTag)
+ {
+ LanguageType eLang = rLanguageTag.getLanguageType(false);
+ if (eLang == LANGUAGE_SYSTEM)
+ nCurrent = 0;
+ else if (eLang == LANGUAGE_ENGLISH_US)
+ {
+ if (!moEnglish)
+ moEnglish.emplace(m_xContext, rLanguageTag);
+ nCurrent = 1;
+ }
+ else
+ {
+ if (!moAny)
+ {
+ moAny.emplace(m_xContext, rLanguageTag);
+ eLastAnyLanguage = eLang;
+ }
+ else if (eLastAnyLanguage != eLang)
+ {
+ moAny.emplace(m_xContext, rLanguageTag);
+ eLastAnyLanguage = eLang;
+ }
+ nCurrent = 2;
+ }
+ eCurrentLanguage = eLang;
+ }
+
+ LanguageType getCurrentLanguage() const { return eCurrentLanguage; }
+
+ const LocaleDataWrapper* get() const
+ {
+ switch (nCurrent)
+ {
+ case 0:
+ return &aSysLocale.GetLocaleData();
+ case 1:
+ return &*moEnglish;
+ case 2:
+ return &*moAny;
+ default:
+ assert(false);
+ return nullptr;
+ }
+ }
+ const LocaleDataWrapper* operator->() const { return get(); }
+ const LocaleDataWrapper& operator*() const { return *get(); }
+};
+
+/** Load a calendar only if it's needed. Keep calendar for "en-US" locale
+ separately, as there can be alternation between locale dependent and
+ locale independent formats.
+ SvNumberformatter uses it upon switching locales.
+
+ @ATTENTION If the default ctor is used the init() method MUST be called
+ before accessing the calendar.
+ */
+class OnDemandCalendarWrapper
+{
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ css::lang::Locale aEnglishLocale;
+ css::lang::Locale aLocale;
+ mutable css::lang::Locale aLastAnyLocale;
+ mutable std::optional<CalendarWrapper> moEnglish;
+ mutable std::optional<CalendarWrapper> moAny;
+
+public:
+ OnDemandCalendarWrapper()
+ {
+ LanguageTag aEnglishLanguageTag(LANGUAGE_ENGLISH_US);
+ aEnglishLocale = aEnglishLanguageTag.getLocale();
+ aLastAnyLocale = aEnglishLocale;
+ }
+
+ void init(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ const css::lang::Locale& rLocale)
+ {
+ m_xContext = rxContext;
+ changeLocale(rLocale);
+ moEnglish.reset();
+ moAny.reset();
+ }
+
+ void changeLocale(const css::lang::Locale& rLocale) { aLocale = rLocale; }
+
+ CalendarWrapper* get() const
+ {
+ CalendarWrapper* pPtr;
+ if (aLocale == aEnglishLocale)
+ {
+ if (!moEnglish)
+ {
+ moEnglish.emplace(m_xContext);
+ moEnglish->loadDefaultCalendar(aEnglishLocale);
+ }
+ pPtr = &*moEnglish;
+ }
+ else
+ {
+ if (!moAny)
+ {
+ moAny.emplace(m_xContext);
+ moAny->loadDefaultCalendar(aLocale);
+ aLastAnyLocale = aLocale;
+ }
+ else if (aLocale != aLastAnyLocale)
+ {
+ moAny->loadDefaultCalendar(aLocale);
+ aLastAnyLocale = aLocale;
+ }
+ pPtr = &*moAny;
+ }
+ return pPtr;
+ }
+};
+
+/** Load a transliteration only if it's needed.
+ SvNumberformatter uses it upon switching locales.
+ @ATTENTION If the default ctor is used the init() method MUST be called
+ before accessing the transliteration.
+ */
+class OnDemandTransliterationWrapper
+{
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ LanguageType eLanguage;
+ TransliterationFlags nType;
+ mutable std::optional<::utl::TransliterationWrapper> moTransliterate;
+ mutable bool bValid;
+ bool bInitialized;
+
+public:
+ OnDemandTransliterationWrapper()
+ : eLanguage(LANGUAGE_SYSTEM)
+ , nType(TransliterationFlags::NONE)
+ , bValid(false)
+ , bInitialized(false)
+ {
+ }
+
+ bool isInitialized() const { return bInitialized; }
+
+ void init(const css::uno::Reference<css::uno::XComponentContext>& rxContext, LanguageType eLang)
+ {
+ m_xContext = rxContext;
+ nType = TransliterationFlags::IGNORE_CASE;
+ changeLocale(eLang);
+ moTransliterate.reset();
+ bInitialized = true;
+ }
+
+ void changeLocale(LanguageType eLang)
+ {
+ bValid = false;
+ eLanguage = eLang;
+ }
+
+ const ::utl::TransliterationWrapper* get() const
+ {
+ if (!bValid)
+ {
+ if (!moTransliterate)
+ moTransliterate.emplace(m_xContext, nType);
+ moTransliterate->loadModuleIfNeeded(eLanguage);
+ bValid = true;
+ }
+ return &*moTransliterate;
+ }
+
+ const ::utl::TransliterationWrapper* operator->() const { return get(); }
+};
+
+/** Load a native number service wrapper only if it's needed.
+ SvNumberformatter uses it.
+
+ @ATTENTION
+ If the default ctor is used the init() method MUST be called
+ before accessing the native number supplier.
+ */
+class OnDemandNativeNumberWrapper
+{
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ mutable std::optional<NativeNumberWrapper> moNativeNumber;
+
+public:
+ OnDemandNativeNumberWrapper() {}
+
+ void init(const css::uno::Reference<css::uno::XComponentContext>& rxContext)
+ {
+ m_xContext = rxContext;
+ moNativeNumber.reset();
+ }
+
+ NativeNumberWrapper* get() const
+ {
+ if (!moNativeNumber)
+ moNativeNumber.emplace(m_xContext);
+ return &*moNativeNumber;
+ }
+};
+
+/** @short
+ SvNumberformatter uses it upon switching locales.
+
+ @descr
+ Avoids reloading and analysing of locale data again and again.
+
+ @ATTENTION
+ If the default ctor is used the init() method MUST be called before
+ accessing any locale data.
+ */
+
+class OnDemandCharClass
+{
+ std::optional<CharClass> moCharClass1;
+ std::optional<CharClass> moCharClass2;
+ int nCurrent; // -1 == uninitialised, 0 == class1, 1 == class2
+
+public:
+ OnDemandCharClass()
+ : nCurrent(-1)
+ {
+ }
+
+ void changeLocale(const css::uno::Reference<css::uno::XComponentContext>& xContext,
+ const LanguageTag& rLanguageTag)
+ {
+ // check for existing match
+ if (moCharClass1 && moCharClass1->getLanguageTag() == rLanguageTag)
+ {
+ nCurrent = 0;
+ return;
+ }
+ if (moCharClass2 && moCharClass2->getLanguageTag() == rLanguageTag)
+ {
+ nCurrent = 1;
+ return;
+ }
+ // no match - update one the current entries
+ if (nCurrent == -1 || nCurrent == 1)
+ {
+ moCharClass1.emplace(xContext, rLanguageTag);
+ nCurrent = 0;
+ }
+ else
+ {
+ moCharClass2.emplace(xContext, rLanguageTag);
+ nCurrent = 1;
+ }
+ }
+
+ const CharClass* get() const
+ {
+ switch (nCurrent)
+ {
+ case 0:
+ return &*moCharClass1;
+ case 1:
+ return &*moCharClass2;
+ default:
+ assert(false);
+ return nullptr;
+ }
+ }
+ const CharClass* operator->() const { return get(); }
+ const CharClass& operator*() const { return *get(); }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/outstrm.hxx b/include/svl/outstrm.hxx
new file mode 100644
index 000000000..f85b26515
--- /dev/null
+++ b/include/svl/outstrm.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_OUTSTRM_HXX
+#define INCLUDED_SVL_OUTSTRM_HXX
+
+#include <svl/svldllapi.h>
+#include <com/sun/star/uno/Reference.h>
+#include <tools/stream.hxx>
+
+namespace com::sun::star::io
+{
+class XOutputStream;
+}
+
+class SVL_DLLPUBLIC SvOutputStream final : public SvStream
+{
+ css::uno::Reference<css::io::XOutputStream> m_xStream;
+
+ SVL_DLLPRIVATE virtual std::size_t GetData(void*, std::size_t) override;
+
+ SVL_DLLPRIVATE virtual std::size_t PutData(void const* pData, std::size_t nSize) override;
+
+ SVL_DLLPRIVATE virtual sal_uInt64 SeekPos(sal_uInt64) override;
+
+ SVL_DLLPRIVATE virtual void FlushData() override;
+
+ SVL_DLLPRIVATE virtual void SetSize(sal_uInt64) override;
+
+public:
+ SvOutputStream(css::uno::Reference<css::io::XOutputStream> xTheStream);
+
+ virtual ~SvOutputStream() override;
+};
+
+#endif // INCLUDED_SVL_OUTSTRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ownlist.hxx b/include/svl/ownlist.hxx
new file mode 100644
index 000000000..cd93e6436
--- /dev/null
+++ b/include/svl/ownlist.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_OWNLIST_HXX
+#define INCLUDED_SVL_OWNLIST_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+
+class SvCommand
+/*
+ Contains a string that defines the command and another string for the
+ command arguments. If such a command were given in the command line,
+ it would look like this: command = argument
+*/
+{
+ OUString aCommand;
+ OUString aArgument;
+public:
+ SvCommand( const OUString & rCommand, const OUString & rArg )
+ {
+ aCommand = rCommand;
+ aArgument = rArg;
+ }
+ const OUString & GetCommand() const { return aCommand; }
+ const OUString & GetArgument() const { return aArgument; }
+};
+
+class SVL_DLLPUBLIC SvCommandList
+/*
+ The list contains objects of type SvCommand.
+ If an object is inserted, it is copied and inserted at the end
+ of the list.
+ */
+{
+private:
+ ::std::vector< SvCommand > aCommandList;
+
+public:
+ void Append( const OUString & rCommand, const OUString & rArg );
+
+ void FillFromSequence( const css::uno::Sequence < css::beans::PropertyValue >& );
+ void FillSequence( css::uno::Sequence < css::beans::PropertyValue >& ) const;
+
+ size_t size() const { return aCommandList.size(); }
+
+ SvCommand const & operator[]( size_t i) {
+ return aCommandList[ i ];
+ }
+
+};
+
+#endif // INCLUDED_SVL_OWNLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/pickerhistoryaccess.hxx b/include/svl/pickerhistoryaccess.hxx
new file mode 100644
index 000000000..7e855f17a
--- /dev/null
+++ b/include/svl/pickerhistoryaccess.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_PICKERHISTORYACCESS_HXX
+#define INCLUDED_SVL_PICKERHISTORYACCESS_HXX
+
+#include <svl/svldllapi.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+
+namespace svt
+{
+
+
+ SVL_DLLPUBLIC void addFolderPicker(
+ const css::uno::Reference< css::uno::XInterface >& _rxPicker );
+
+ SVL_DLLPUBLIC void addFilePicker(
+ const css::uno::Reference< css::uno::XInterface >& _rxPicker );
+
+
+} // namespace svt
+
+
+#endif // INCLUDED_SVL_PICKERHISTORYACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/poolcach.hxx b/include/svl/poolcach.hxx
new file mode 100644
index 000000000..fe06ce416
--- /dev/null
+++ b/include/svl/poolcach.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_POOLCACH_HXX
+#define INCLUDED_SVL_POOLCACH_HXX
+
+#include <svl/svldllapi.h>
+#include <vector>
+
+class SfxItemPool;
+class SfxItemSet;
+class SfxPoolItem;
+class SfxSetItem;
+
+class SVL_DLLPUBLIC SfxItemPoolCache
+{
+ struct SfxItemModifyImpl
+ {
+ const SfxSetItem *pOrigItem;
+ SfxSetItem *pPoolItem;
+ };
+
+ SfxItemPool *pPool;
+ std::vector<SfxItemModifyImpl>
+ m_aCache;
+ const SfxItemSet *pSetToPut;
+ const SfxPoolItem *pItemToPut;
+
+public:
+ SfxItemPoolCache( SfxItemPool *pPool,
+ const SfxPoolItem *pPutItem );
+ SfxItemPoolCache( SfxItemPool *pPool,
+ const SfxItemSet *pPutSet );
+ ~SfxItemPoolCache();
+
+ const SfxSetItem& ApplyTo( const SfxSetItem& rSetItem );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
new file mode 100644
index 000000000..10a7901b4
--- /dev/null
+++ b/include/svl/poolitem.hxx
@@ -0,0 +1,333 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_POOLITEM_HXX
+#define INCLUDED_SVL_POOLITEM_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <svl/hint.hxx>
+#include <svl/svldllapi.h>
+#include <svl/typedwhich.hxx>
+#include <tools/mapunit.hxx>
+#include <tools/long.hxx>
+#include <boost/property_tree/ptree_fwd.hpp>
+
+class IntlWrapper;
+
+enum class SfxItemKind : sal_Int8
+{
+ NONE,
+ DeleteOnIdle,
+ StaticDefault,
+ PoolDefault
+};
+
+#define SFX_ITEMS_OLD_MAXREF 0xffef
+#define SFX_ITEMS_MAXREF 0xfffffffe
+#define SFX_ITEMS_SPECIAL 0xffffffff
+
+#define CONVERT_TWIPS 0x80 // Uno conversion for measurement (for MemberId)
+
+// warning, if there is no boolean inside the any this will always return the value false
+inline bool Any2Bool( const css::uno::Any&rValue )
+{
+ bool bValue = false;
+ if( !(rValue >>= bValue) )
+ {
+ sal_Int32 nNum = 0;
+ if( rValue >>= nNum )
+ bValue = nNum != 0;
+ }
+
+ return bValue;
+}
+
+/*
+ * The values of this enum describe the degree of textual
+ * representation of an item after calling the virtual
+ * method <SfxPoolItem::GetPresentation()const>.
+ */
+enum class SfxItemPresentation
+{
+ Nameless,
+ Complete
+};
+
+/**
+ * These values have to match the values in the
+ * css::frame::status::ItemState IDL
+ * to be found at offapi/com/sun/star/frame/status/ItemState.idl
+*/
+enum class SfxItemState {
+
+ /** Specifies an unknown state. */
+ UNKNOWN = 0,
+
+ /** Specifies that the property is currently disabled. */
+ DISABLED = 0x0001,
+
+ /** Specifies that the property is currently in a don't care state.
+ * <br/>
+ * This is normally used if a selection provides more than one state
+ * for a property at the same time.
+ */
+ DONTCARE = 0x0010,
+
+ /** Specifies that the property is currently in a default state. */
+ DEFAULT = 0x0020,
+
+ /** The property has been explicitly set to a given value hence we know
+ * we are not taking the default value.
+ * <br/>
+ * For example, you may want to get the font color and it might either
+ * be the default one or one that has been explicitly set.
+ */
+ SET = 0x0040
+};
+
+#define INVALID_POOL_ITEM reinterpret_cast<SfxPoolItem*>(-1)
+
+class SfxItemPool;
+class SfxItemSet;
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+
+class SVL_DLLPUBLIC SfxPoolItem
+{
+friend class SfxItemPool;
+friend class SfxItemDisruptor_Impl;
+friend class SfxItemPoolCache;
+friend class SfxItemSet;
+friend class SfxVoidItem;
+
+ mutable sal_uInt32 m_nRefCount;
+ sal_uInt16 m_nWhich;
+ SfxItemKind m_nKind;
+
+private:
+ inline void SetRefCount(sal_uInt32 n);
+ inline void SetKind( SfxItemKind n );
+public:
+ inline void AddRef(sal_uInt32 n = 1) const;
+private:
+ inline sal_uInt32 ReleaseRef(sal_uInt32 n = 1) const;
+
+protected:
+ explicit SfxPoolItem( sal_uInt16 nWhich = 0 );
+ SfxPoolItem( const SfxPoolItem& rCopy)
+ : SfxPoolItem(rCopy.m_nWhich) {}
+
+public:
+ virtual ~SfxPoolItem();
+
+ void SetWhich( sal_uInt16 nId )
+ {
+ // can only change the Which before we are in a set
+ assert(m_nRefCount==0);
+ m_nWhich = nId;
+ }
+ sal_uInt16 Which() const { return m_nWhich; }
+ // StaticWhichCast asserts if the TypedWhichId is not matching its type, otherwise it returns a reference.
+ // You can use StaticWhichCast when you are sure about the type at compile time -- like a static_cast.
+ template<class T> T& StaticWhichCast(TypedWhichId<T> nId)
+ {
+ (void)nId;
+ assert(nId == m_nWhich);
+ assert(dynamic_cast<T*>(this));
+ return *static_cast<T*>(this);
+ }
+ template<class T> const T& StaticWhichCast(TypedWhichId<T> nId) const
+ {
+ (void)nId;
+ assert(nId == m_nWhich);
+ assert(dynamic_cast<const T*>(this));
+ return *static_cast<const T*>(this);
+ }
+ // DynamicWhichCast returns nullptr if the TypedWhichId is not matching its type, otherwise it returns a typed pointer.
+ // it asserts if the TypedWhichId matches its Which, but not the RTTI type.
+ // You can use DynamicWhichCast when you are not sure about the type at compile time -- like a dynamic_cast.
+ template<class T> T* DynamicWhichCast(TypedWhichId<T> nId)
+ {
+ if(m_nWhich != nId)
+ return nullptr;
+ assert(dynamic_cast<T*>(this));
+ return static_cast<T*>(this);
+ }
+ template<class T> const T* DynamicWhichCast(TypedWhichId<T> nId) const
+ {
+ if(m_nWhich != nId)
+ return nullptr;
+ assert(dynamic_cast<const T*>(this));
+ return static_cast<const T*>(this);
+ }
+ virtual bool operator==( const SfxPoolItem& ) const = 0;
+ bool operator!=( const SfxPoolItem& rItem ) const
+ { return !(*this == rItem); }
+
+ // Sorting is only used for faster searching in a pool which contains large quantities
+ // of a single kind of pool item.
+ virtual bool operator<( const SfxPoolItem& ) const { assert(false); return false; }
+ virtual bool IsSortable() const { return false; }
+
+ // Some item types cannot be IsSortable() (such as because they are modified while stored
+ // in a pool, which would change the ordering position, see e.g. 585e0ac43b9bd8a2f714903034).
+ // To improve performance in such cases it is possible to reimplement Lookup() to do a linear
+ // lookup optimized for the specific class (avoiding virtual functions may allow the compiler
+ // to generate better code and class-specific optimizations such as hashing or caching may
+ // be used.)
+ // If reimplemented, the Lookup() function should search [begin,end) for an item matching
+ // this object and return an iterator pointing to the item or the end iterator.
+ virtual bool HasLookup() const { return false; }
+ typedef std::vector<SfxPoolItem*>::const_iterator lookup_iterator;
+ virtual lookup_iterator Lookup(lookup_iterator /*begin*/, lookup_iterator end ) const
+ { assert( false ); return end; }
+
+ /** @return true if it has a valid string representation */
+ virtual bool GetPresentation( SfxItemPresentation ePresentation,
+ MapUnit eCoreMetric,
+ MapUnit ePresentationMetric,
+ OUString &rText,
+ const IntlWrapper& rIntlWrapper ) const;
+
+ virtual void ScaleMetrics( tools::Long lMult, tools::Long lDiv );
+ virtual bool HasMetrics() const;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const = 0;
+ // clone and call SetWhich
+ std::unique_ptr<SfxPoolItem> CloneSetWhich( sal_uInt16 nNewWhich ) const;
+ template<class T> std::unique_ptr<T> CloneSetWhich( TypedWhichId<T> nId ) const
+ {
+ return std::unique_ptr<T>(static_cast<T*>(CloneSetWhich(sal_uInt16(nId)).release()));
+ }
+
+ sal_uInt32 GetRefCount() const { return m_nRefCount; }
+ SfxItemKind GetKind() const { return m_nKind; }
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
+ virtual boost::property_tree::ptree dumpAsJSON() const;
+
+ /** Only SfxVoidItem shall and must return true for this.
+
+ This avoids costly calls to dynamic_cast<const SfxVoidItem*>()
+ specifically in SfxItemSet::GetItemState()
+ */
+ virtual bool IsVoidItem() const;
+
+private:
+ SfxPoolItem& operator=( const SfxPoolItem& ) = delete;
+};
+
+inline void SfxPoolItem::SetRefCount(sal_uInt32 n)
+{
+ m_nRefCount = n;
+ m_nKind = SfxItemKind::NONE;
+}
+
+inline void SfxPoolItem::SetKind( SfxItemKind n )
+{
+ m_nRefCount = SFX_ITEMS_SPECIAL;
+ m_nKind = n;
+}
+
+inline void SfxPoolItem::AddRef(sal_uInt32 n) const
+{
+ assert(m_nRefCount <= SFX_ITEMS_MAXREF && "AddRef with non-Pool-Item");
+ assert(n <= SFX_ITEMS_MAXREF - m_nRefCount && "AddRef: refcount overflow");
+ m_nRefCount += n;
+}
+
+inline sal_uInt32 SfxPoolItem::ReleaseRef(sal_uInt32 n) const
+{
+ assert(m_nRefCount <= SFX_ITEMS_MAXREF && "ReleaseRef with non-Pool-Item");
+ assert(n <= m_nRefCount);
+ m_nRefCount -= n;
+ return m_nRefCount;
+}
+
+inline bool IsPoolDefaultItem(const SfxPoolItem *pItem )
+{
+ return pItem && pItem->GetKind() == SfxItemKind::PoolDefault;
+}
+
+inline bool IsStaticDefaultItem(const SfxPoolItem *pItem )
+{
+ return pItem && pItem->GetKind() == SfxItemKind::StaticDefault;
+}
+
+inline bool IsDefaultItem( const SfxPoolItem *pItem )
+{
+ return pItem && (pItem->GetKind() == SfxItemKind::StaticDefault || pItem->GetKind() == SfxItemKind::PoolDefault);
+}
+
+inline bool IsPooledItem( const SfxPoolItem *pItem )
+{
+ return pItem && pItem->GetRefCount() > 0 && pItem->GetRefCount() <= SFX_ITEMS_MAXREF;
+}
+
+inline bool IsInvalidItem(const SfxPoolItem *pItem)
+{
+ return pItem == INVALID_POOL_ITEM;
+}
+
+class SVL_DLLPUBLIC SfxVoidItem final: public SfxPoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ explicit SfxVoidItem( sal_uInt16 nWhich );
+ virtual ~SfxVoidItem() override;
+
+ SfxVoidItem(SfxVoidItem const &) = default;
+ SfxVoidItem(SfxVoidItem &&) = default;
+ SfxVoidItem & operator =(SfxVoidItem const &) = delete; // due to SfxPoolItem
+ SfxVoidItem & operator =(SfxVoidItem &&) = delete; // due to SfxPoolItem
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+
+ // create a copy of itself
+ virtual SfxVoidItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ /** Always returns true as this is an SfxVoidItem. */
+ virtual bool IsVoidItem() const override;
+};
+
+
+class SVL_DLLPUBLIC SfxPoolItemHint final : public SfxHint
+{
+ SfxPoolItem* pObj;
+public:
+ explicit SfxPoolItemHint( SfxPoolItem* Object ) : pObj(Object) {}
+ SfxPoolItem* GetObject() const { return pObj; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ptitem.hxx b/include/svl/ptitem.hxx
new file mode 100644
index 000000000..2ceb39410
--- /dev/null
+++ b/include/svl/ptitem.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_PTITEM_HXX
+#define INCLUDED_SVL_PTITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <tools/gen.hxx>
+#include <tools/debug.hxx>
+
+class SvStream;
+
+class SVL_DLLPUBLIC SfxPointItem final : public SfxPoolItem
+{
+ Point aVal;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxPointItem();
+ SfxPointItem( sal_uInt16 nWhich, const Point& rVal );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual SfxPointItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ const Point& GetValue() const { return aVal; }
+ void SetValue( const Point& rNewVal ) {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ aVal = rNewVal;
+ }
+
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/rectitem.hxx b/include/svl/rectitem.hxx
new file mode 100644
index 000000000..94465bad4
--- /dev/null
+++ b/include/svl/rectitem.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_RECTITEM_HXX
+#define INCLUDED_SVL_RECTITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <tools/gen.hxx>
+#include <svl/poolitem.hxx>
+
+class SvStream;
+
+class SVL_DLLPUBLIC SfxRectangleItem final : public SfxPoolItem
+{
+ tools::Rectangle aVal;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxRectangleItem();
+ SfxRectangleItem( sal_uInt16 nWhich, const tools::Rectangle& rVal );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxRectangleItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ const tools::Rectangle& GetValue() const { return aVal; }
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/rngitem.hxx b/include/svl/rngitem.hxx
new file mode 100644
index 000000000..7e8caf937
--- /dev/null
+++ b/include/svl/rngitem.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_RNGITEM_HXX
+#define INCLUDED_SVL_RNGITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+
+class SvStream;
+
+
+class SVL_DLLPUBLIC SfxRangeItem final : public SfxPoolItem
+{
+private:
+ sal_uInt16 nFrom;
+ sal_uInt16 nTo;
+public:
+ SfxRangeItem( sal_uInt16 nWID, sal_uInt16 nFrom, sal_uInt16 nTo );
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+ virtual SfxRangeItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/setitem.hxx b/include/svl/setitem.hxx
new file mode 100644
index 000000000..69ebea4b1
--- /dev/null
+++ b/include/svl/setitem.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <svl/poolitem.hxx>
+#include <svl/itemset.hxx>
+
+class SVL_DLLPUBLIC SfxSetItem : public SfxPoolItem
+{
+ SfxItemSet maSet;
+
+ SfxSetItem& operator=(const SfxSetItem&) = delete;
+
+public:
+ SfxSetItem(sal_uInt16 nWhich, SfxItemSet&& pSet);
+ SfxSetItem(sal_uInt16 nWhich, const SfxItemSet& rSet);
+ SfxSetItem(const SfxSetItem&, SfxItemPool* pPool = nullptr);
+
+ virtual bool operator==(const SfxPoolItem&) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric,
+ MapUnit ePresMetric, OUString& rText,
+ const IntlWrapper&) const override;
+
+ // create a copy of itself
+ virtual SfxSetItem* Clone(SfxItemPool* pPool = nullptr) const override = 0;
+
+ const SfxItemSet& GetItemSet() const { return maSet; }
+ SfxItemSet& GetItemSet() { return maSet; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/sharecontrolfile.hxx b/include/svl/sharecontrolfile.hxx
new file mode 100644
index 000000000..fe7171312
--- /dev/null
+++ b/include/svl/sharecontrolfile.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_SHARECONTROLFILE_HXX
+#define INCLUDED_SVL_SHARECONTROLFILE_HXX
+
+#include <svl/svldllapi.h>
+
+#include <svl/lockfilecommon.hxx>
+#include <vector>
+
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::io { class XOutputStream; }
+namespace com::sun::star::io { class XSeekable; }
+namespace com::sun::star::io { class XStream; }
+namespace com::sun::star::io { class XTruncate; }
+
+namespace svt {
+
+class SVL_DLLPUBLIC ShareControlFile final : public LockFileCommon
+{
+ css::uno::Reference< css::io::XStream > m_xStream;
+ css::uno::Reference< css::io::XInputStream > m_xInputStream;
+ css::uno::Reference< css::io::XOutputStream > m_xOutputStream;
+ css::uno::Reference< css::io::XSeekable > m_xSeekable;
+ css::uno::Reference< css::io::XTruncate > m_xTruncate;
+
+ std::vector< LockFileEntry > m_aUsersData;
+
+ void Close();
+ bool IsValid() const
+ {
+ return ( m_xStream.is() && m_xInputStream.is() && m_xOutputStream.is() && m_xSeekable.is() && m_xTruncate.is() );
+ }
+
+public:
+
+ // The constructor will throw exception in case the stream can not be opened
+ ShareControlFile( std::u16string_view aOrigURL );
+ virtual ~ShareControlFile() override;
+
+ std::vector< LockFileEntry > GetUsersData();
+ void SetUsersDataAndStore( std::vector< LockFileEntry >&& aUserNames );
+ LockFileEntry InsertOwnEntry();
+ bool HasOwnEntry();
+ void RemoveEntry( const LockFileEntry& aOptionalSpecification );
+ void RemoveEntry();
+ void RemoveFile();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/sharedstring.hxx b/include/svl/sharedstring.hxx
new file mode 100644
index 000000000..5b5c35b95
--- /dev/null
+++ b/include/svl/sharedstring.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVL_SHAREDSTRING_HXX
+#define INCLUDED_SVL_SHAREDSTRING_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace svl {
+
+class SVL_DLLPUBLIC SharedString
+{
+ rtl_uString* mpData;
+ rtl_uString* mpDataIgnoreCase;
+public:
+
+ static const SharedString & getEmptyString();
+
+ SharedString();
+ SharedString( rtl_uString* pData, rtl_uString* pDataIgnoreCase );
+ explicit SharedString( const OUString& rStr );
+ SharedString( const SharedString& r );
+ SharedString(SharedString&& r) noexcept;
+ ~SharedString();
+
+ SharedString& operator= ( const SharedString& r );
+ SharedString& operator=(SharedString&& r) noexcept;
+
+ bool operator== ( const SharedString& r ) const;
+ bool operator!= ( const SharedString& r ) const;
+
+ OUString getString() const;
+
+ rtl_uString* getData();
+ const rtl_uString* getData() const;
+
+ rtl_uString* getDataIgnoreCase();
+ const rtl_uString* getDataIgnoreCase() const;
+
+ bool isValid() const;
+ bool isEmpty() const;
+
+ sal_Int32 getLength() const;
+};
+
+inline SharedString::SharedString() : mpData(nullptr), mpDataIgnoreCase(nullptr) {}
+
+inline SharedString::SharedString( rtl_uString* pData, rtl_uString* pDataIgnoreCase ) :
+ mpData(pData), mpDataIgnoreCase(pDataIgnoreCase)
+{
+ if (mpData)
+ rtl_uString_acquire(mpData);
+ if (mpDataIgnoreCase)
+ rtl_uString_acquire(mpDataIgnoreCase);
+}
+
+inline SharedString::SharedString( const OUString& rStr ) : mpData(rStr.pData), mpDataIgnoreCase(nullptr)
+{
+ rtl_uString_acquire(mpData);
+}
+
+inline SharedString::SharedString( const SharedString& r ) : mpData(r.mpData), mpDataIgnoreCase(r.mpDataIgnoreCase)
+{
+ if (mpData)
+ rtl_uString_acquire(mpData);
+ if (mpDataIgnoreCase)
+ rtl_uString_acquire(mpDataIgnoreCase);
+}
+
+inline SharedString::SharedString(SharedString&& r) noexcept : mpData(r.mpData), mpDataIgnoreCase(r.mpDataIgnoreCase)
+{
+ r.mpData = nullptr;
+ r.mpDataIgnoreCase = nullptr;
+}
+
+inline SharedString::~SharedString()
+{
+ if (mpData)
+ rtl_uString_release(mpData);
+ if (mpDataIgnoreCase)
+ rtl_uString_release(mpDataIgnoreCase);
+}
+
+inline SharedString& SharedString::operator=(SharedString&& r) noexcept
+{
+ // Having this inline helps Calc's mdds::multi_type_vector to do some operations
+ // much faster.
+ if (mpData)
+ rtl_uString_release(mpData);
+ if (mpDataIgnoreCase)
+ rtl_uString_release(mpDataIgnoreCase);
+
+ mpData = r.mpData;
+ mpDataIgnoreCase = r.mpDataIgnoreCase;
+
+ r.mpData = nullptr;
+ r.mpDataIgnoreCase = nullptr;
+
+ return *this;
+}
+
+inline bool SharedString::operator!= ( const SharedString& r ) const
+{
+ return !operator== (r);
+}
+
+inline OUString SharedString::getString() const
+{
+ return mpData ? OUString(mpData) : OUString();
+}
+
+inline rtl_uString* SharedString::getData()
+{
+ return mpData;
+}
+
+inline const rtl_uString* SharedString::getData() const
+{
+ return mpData;
+}
+
+inline rtl_uString* SharedString::getDataIgnoreCase()
+{
+ return mpDataIgnoreCase;
+}
+
+inline const rtl_uString* SharedString::getDataIgnoreCase() const
+{
+ return mpDataIgnoreCase;
+}
+
+inline bool SharedString::isValid() const
+{
+ return mpData != nullptr;
+}
+
+inline bool SharedString::isEmpty() const
+{
+ return mpData == nullptr || mpData->length == 0;
+}
+
+inline sal_Int32 SharedString::getLength() const
+{
+ return mpData ? mpData->length : 0;
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/sharedstringpool.hxx b/include/svl/sharedstringpool.hxx
new file mode 100644
index 000000000..6880fec2a
--- /dev/null
+++ b/include/svl/sharedstringpool.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVL_SHAREDSTRINGPOOL_HXX
+#define INCLUDED_SVL_SHAREDSTRINGPOOL_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+#include <memory>
+
+class CharClass;
+
+namespace svl
+{
+class SharedString;
+
+/**
+ * Storage for pool of shared strings. It also provides mapping from
+ * original-cased strings to upper-cased strings for case insensitive
+ * operations.
+ */
+class SVL_DLLPUBLIC SharedStringPool
+{
+ struct Impl;
+ std::unique_ptr<Impl> mpImpl;
+
+ SharedStringPool(const SharedStringPool&) = delete;
+ SharedStringPool& operator=(const SharedStringPool&) = delete;
+
+public:
+ SharedStringPool(const CharClass& rCharClass);
+ ~SharedStringPool();
+
+ /**
+ * Intern a string object into the shared string pool.
+ *
+ * @param rStr string object to intern.
+ *
+ * @return a pointer to the string object stored inside the pool, or NULL
+ * if the insertion fails.
+ */
+ SharedString intern(const OUString& rStr);
+
+ /**
+ * Go through all string objects in the pool, and clear those that are no
+ * longer used outside of the pool.
+ */
+ void purge();
+
+ // For unit tests. Note that an "empty" pool may contain some internal items,
+ // such as SharedString::getEmptyString().
+ size_t getCount() const;
+ size_t getCountIgnoreCase() const;
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/sigstruct.hxx b/include/svl/sigstruct.hxx
new file mode 100644
index 000000000..20cb0ebd2
--- /dev/null
+++ b/include/svl/sigstruct.hxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLSECURITY_INC_SIGSTRUCT_HXX
+#define INCLUDED_XMLSECURITY_INC_SIGSTRUCT_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/xml/crypto/SecurityOperationStatus.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <set>
+#include <vector>
+
+namespace com::sun::star::graphic { class XGraphic; }
+
+/*
+ * type of reference
+ */
+enum class SignatureReferenceType
+{
+ SAMEDOCUMENT = 1,
+ BINARYSTREAM = 2,
+ XMLSTREAM = 3
+};
+
+struct SignatureReferenceInformation
+{
+ SignatureReferenceType nType;
+ OUString ouURI;
+ // For ODF: XAdES digests (SHA256) or the old SHA1, from css::xml::crypto::DigestID
+ sal_Int32 nDigestID;
+ OUString ouDigestValue;
+ /// Type of the reference: a URI (newer idSignedProperties references) or empty.
+ OUString ouType;
+
+ SignatureReferenceInformation() :
+ nType(SignatureReferenceType::SAMEDOCUMENT),
+ ouURI(""),
+ nDigestID(css::xml::crypto::DigestID::SHA1),
+ ouDigestValue("")
+ {
+ }
+
+ SignatureReferenceInformation( SignatureReferenceType type, sal_Int32 digestID, const OUString& uri, const OUString& rType ) :
+ SignatureReferenceInformation()
+ {
+ nType = type;
+ nDigestID = digestID;
+ ouURI = uri;
+ ouType = rType;
+ }
+};
+
+typedef ::std::vector< SignatureReferenceInformation > SignatureReferenceInformations;
+
+namespace svl::crypto
+{
+/// Specifies the algorithm used for signature generation and validation.
+enum class SignatureMethodAlgorithm
+{
+ RSA,
+ ECDSA
+};
+}
+
+
+struct SignatureInformation
+{
+ sal_Int32 nSecurityId;
+ css::xml::crypto::SecurityOperationStatus nStatus;
+ SignatureReferenceInformations vSignatureReferenceInfors;
+ struct X509CertInfo
+ {
+ OUString X509IssuerName;
+ OUString X509SerialNumber;
+ OUString X509Certificate;
+ /// OOXML certificate SHA-256 digest, empty for ODF except when doing XAdES signature.
+ OUString CertDigest;
+ /// The certificate owner (aka subject).
+ OUString X509Subject;
+ };
+ typedef std::vector<X509CertInfo> X509Data;
+ // note: at parse time, it's unknown which one is the signing certificate;
+ // ImplVerifySignatures() figures it out and puts it at the back
+ std::vector<X509Data> X509Datas;
+
+ X509CertInfo const* GetSigningCertificate() const
+ {
+ if (X509Datas.empty())
+ {
+ return nullptr;
+ }
+ assert(!X509Datas.back().empty());
+ return & X509Datas.back().back();
+ }
+
+ OUString ouGpgKeyID;
+ OUString ouGpgCertificate;
+ OUString ouGpgOwner;
+
+ OUString ouSignatureValue;
+ css::util::DateTime stDateTime;
+
+ // XAdES EncapsulatedX509Certificate values
+ std::set<OUString> maEncapsulatedX509Certificates;
+
+ OUString ouSignatureId;
+ // signature may contain multiple time stamps - check they're consistent
+ bool hasInconsistentSigningTime = false;
+ //We also keep the date and time as string. This is done when this
+ //structure is created as a result of a XML signature being read.
+ //When then a signature is added or another removed, then the original
+ //XML signatures are written again (unless they have been removed).
+ //If the date time string is converted into the DateTime structure
+ //then information can be lost because it only holds a fractional
+ //of a second with an accuracy of one hundredth of second.
+ //If the string contains
+ //milliseconds (because the document was created by an application other than OOo)
+ //and the converted time is written back, then the string looks different
+ //and the signature is broken.
+ OUString ouDateTime;
+ /// The Id attribute of the <SignatureProperty> element that contains the <dc:date>.
+ OUString ouDateTimePropertyId;
+ /// Characters of the <dc:description> element inside the signature.
+ OUString ouDescription;
+ /// The Id attribute of the <SignatureProperty> element that contains the <dc:description>.
+ OUString ouDescriptionPropertyId;
+ /// Valid and invalid signature line images
+ css::uno::Reference<css::graphic::XGraphic> aValidSignatureImage;
+ css::uno::Reference<css::graphic::XGraphic> aInvalidSignatureImage;
+ /// Signature Line Id, used to map signatures to their respective signature line images.
+ OUString ouSignatureLineId;
+ /// A full OOXML signature for unchanged roundtrip, empty for ODF.
+ css::uno::Sequence<sal_Int8> aSignatureBytes;
+ /// For PDF: digest format, from css::xml::crypto::DigestID
+ sal_Int32 nDigestID;
+ /// For PDF: has id-aa-signingCertificateV2 as a signed attribute.
+ bool bHasSigningCertificate;
+ /// For PDF: the byte range doesn't cover the whole document.
+ bool bPartialDocumentSignature;
+
+ svl::crypto::SignatureMethodAlgorithm eAlgorithmID;
+
+ SignatureInformation( sal_Int32 nId )
+ {
+ nSecurityId = nId;
+ nStatus = css::xml::crypto::SecurityOperationStatus_UNKNOWN;
+ nDigestID = 0;
+ bHasSigningCertificate = false;
+ bPartialDocumentSignature = false;
+ eAlgorithmID = svl::crypto::SignatureMethodAlgorithm::RSA;
+ }
+};
+
+typedef ::std::vector< SignatureInformation > SignatureInformations;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/slstitm.hxx b/include/svl/slstitm.hxx
new file mode 100644
index 000000000..48e558149
--- /dev/null
+++ b/include/svl/slstitm.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_SLSTITM_HXX
+#define INCLUDED_SVL_SLSTITM_HXX
+
+#include <vector>
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <memory>
+
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+class SVL_DLLPUBLIC SfxStringListItem final : public SfxPoolItem
+{
+ std::shared_ptr<std::vector<OUString>> mpList;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SfxStringListItem();
+ SfxStringListItem( sal_uInt16 nWhich, const std::vector<OUString> *pList=nullptr );
+ virtual ~SfxStringListItem() override;
+
+ SfxStringListItem(SfxStringListItem const &) = default;
+ SfxStringListItem(SfxStringListItem &&) = default;
+ SfxStringListItem & operator =(SfxStringListItem const &) = delete; // due to SfxPoolItem
+ SfxStringListItem & operator =(SfxStringListItem &&) = delete; // due to SfxPoolItem
+
+ std::vector<OUString>& GetList();
+
+ const std::vector<OUString>& GetList() const;
+
+ // String-Separator: \n
+ void SetString( const OUString& );
+ OUString GetString();
+
+ void SetStringList( const css::uno::Sequence< OUString >& rList );
+ void GetStringList( css::uno::Sequence< OUString >& rList ) const;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+ virtual SfxStringListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool PutValue ( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/solar.hrc b/include/svl/solar.hrc
new file mode 100644
index 000000000..5caeb64f4
--- /dev/null
+++ b/include/svl/solar.hrc
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_SOLAR_HRC
+#define INCLUDED_SVL_SOLAR_HRC
+
+// defines ------------------------------------------------------------------
+
+#define OWN_ATTR_VALUE_START 3900
+#define OWN_ATTR_VALUE_END 4007
+
+#define RID_LIB_START 10000
+#define RID_LIB_END 19999
+
+#define RID_SVX_START (RID_LIB_START)
+// RID_SVX_END (RID_LIB_START+499)
+
+#define RID_OFA_START (RID_LIB_START+6900)
+// RID_OFA_END (RID_LIB_START+7399)
+
+// do *NOT* add more ranges here, RID_LIB_END is (RID_LIB_START + 10000)
+
+#define RID_APP_START 20000
+// RID_APP_END 31999
+
+#define RID_SW_START (20000)
+// RID_SW_END (25999)
+
+// free: 26000-28199
+
+// Help-Ids --------------------------------------------------------------
+
+#define HID_START 32768
+
+#define HID_SC_START (HID_START+25000)
+// HID_SC_END (HID_START+26999)
+
+#define HID_SD_START (HID_START+27000)
+// HID_SD_END (HID_START+27999)
+
+// Slot Ids
+
+#define SID_SFX_START 5000
+// SID_SFX_END 8999
+#define SID_DOCKWIN_START 9800
+// SID_DOCKWIN_END 9999
+
+#define SID_LIB_START 10000
+// SID_LIB_END 19999
+// free: 20000-29999
+#define SID_OBJ_START 30000
+
+#define SID_SW_START 20000
+// SID_SW_END 25999
+#define SID_SC_START 26000
+// SID_SC_END 26999
+#define SID_SD_START 27000
+// SID_SD_END 27999
+
+#define SID_SMA_START (SID_OBJ_START + 256)
+// SID_SMA_END (SID_OBJ_START + 511)
+#define SID_BASICIDE_START (SID_OBJ_START + 768)
+// SID_BASICIDE_END (SID_BASICIDE_START + 255)
+
+#define SID_SVX_START SID_LIB_START // 10000
+#define SID_SVX_END (SID_SVX_START + 1499)
+#define SID_EDIT_START (SID_SVX_END + 1) // 11500
+#define SID_EDIT_END (SID_EDIT_START + 499)
+#define SID_OPTIONS_START (SID_EDIT_END + 1) // 12000
+#define SID_OPTIONS_END (SID_OPTIONS_START + 100)
+#define SID_SBA_START (SID_OPTIONS_END + 1) // 12101
+#define SID_SBA_END (SID_SBA_START + 149)
+#define SID_DBACCESS_START (SID_SBA_END + 1) // 12251
+#define SID_DBACCESS_END (SID_DBACCESS_START + 200)
+#define SID_RPTUI_START (SID_DBACCESS_END + 1) // 12452
+// SID_RPTUI_END (SID_RPTUI_START + 199)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/srchdefs.hxx b/include/svl/srchdefs.hxx
new file mode 100644
index 000000000..d77341c36
--- /dev/null
+++ b/include/svl/srchdefs.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF, under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License",; you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_SRCHDEFS_HXX
+#define INCLUDED_SVL_SRCHDEFS_HXX
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class SearchOptionFlags
+{
+ NONE = 0x0000,
+ SEARCH = 0x0001,
+ SEARCHALL = 0x0002, // named to this way to avoid conflict with macro on Windows.
+ REPLACE = 0x0004,
+ REPLACE_ALL = 0x0008,
+ WHOLE_WORDS = 0x0010,
+ BACKWARDS = 0x0020,
+ REG_EXP = 0x0040,
+ EXACT = 0x0080,
+ SELECTION = 0x0100,
+ FAMILIES = 0x0200,
+ FORMAT = 0x0400,
+ SIMILARITY = 0x0800,
+ WILDCARD = 0x1000,
+ ALL = 0x1fff
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SearchOptionFlags> : is_typed_flags<SearchOptionFlags, 0x1fff> {};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx
new file mode 100644
index 000000000..7aa403211
--- /dev/null
+++ b/include/svl/srchitem.hxx
@@ -0,0 +1,326 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_SRCHITEM_HXX
+#define INCLUDED_SVL_SRCHITEM_HXX
+
+#include <sal/config.h>
+#include <svl/svldllapi.h>
+#include <com/sun/star/util/SearchAlgorithms2.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <i18nutil/transliteration.hxx>
+#include <i18nutil/searchopt.hxx>
+#include <unotools/configitem.hxx>
+#include <svl/style.hxx>
+#include <svl/poolitem.hxx>
+
+// defines ---------------------------------------------------------------
+
+// commands
+enum class SvxSearchCmd
+{
+ FIND = 0,
+ FIND_ALL = 1,
+ REPLACE = 2,
+ REPLACE_ALL = 3,
+};
+
+// search flags
+enum class SvxSearchCellType
+{
+ FORMULA = 0,
+ VALUE = 1,
+ NOTE = 2,
+};
+
+enum class SvxSearchApp
+{
+ WRITER = 0,
+ CALC = 1,
+ DRAW = 2,
+};
+
+// class SvxSearchItem ---------------------------------------------------
+
+class SVL_DLLPUBLIC SvxSearchItem final :
+ public SfxPoolItem,
+ public utl::ConfigItem
+{
+ i18nutil::SearchOptions2 m_aSearchOpt;
+
+ SfxStyleFamily m_eFamily; // style family
+
+ SvxSearchCmd m_nCommand; // command (Search, Search all, Replace, Replace all)
+
+ // Calc-specific
+ SvxSearchCellType m_nCellType; // Search in Formulas/Values/Notes
+ SvxSearchApp m_nAppFlag; // application which the dialog is for
+ bool m_bRowDirection; // search direction: row-wise/column-wise
+ bool m_bAllTables; // search in all sheets
+ bool m_bSearchFiltered; // search filtered cells.
+ bool m_bSearchFormatted; // search formatted display strings
+
+ // Writer-specific
+ bool m_bNotes;
+
+ bool m_bBackward; // search backwards
+ bool m_bPattern; // search for styles
+ bool m_bContent; // search in content
+ bool m_bAsianOptions; // use asian options?
+
+ // Start search at this point (absolute twips).
+ sal_Int32 m_nStartPointX;
+ sal_Int32 m_nStartPointY;
+
+ virtual void ImplCommit() override;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxSearchItem( const sal_uInt16 nId );
+ SvxSearchItem( const SvxSearchItem& rItem );
+ virtual ~SvxSearchItem() override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual bool operator == ( const SfxPoolItem& ) const override;
+ virtual SvxSearchItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ // ConfigItem
+ virtual void Notify( const css::uno::Sequence< OUString > &rPropertyNames ) override;
+
+ bool equalsIgnoring(const SvxSearchItem& rSItem, bool bIgnoreReplace,
+ bool bIgnoreCommand) const;
+
+ SvxSearchCmd GetCommand() const { return m_nCommand; }
+ void SetCommand(SvxSearchCmd nNewCommand) { m_nCommand = nNewCommand; }
+
+ inline const OUString& GetSearchString() const;
+ inline void SetSearchString(const OUString& rNewString);
+
+ inline const OUString& GetReplaceString() const;
+ inline void SetReplaceString(const OUString& rNewString);
+
+ inline bool GetWordOnly() const;
+ void SetWordOnly(bool bNewWordOnly);
+
+ inline bool GetExact() const;
+ void SetExact(bool bNewExact);
+
+ bool GetBackward() const { return m_bBackward; }
+ void SetBackward(bool bNewBackward) { m_bBackward = bNewBackward; }
+
+ inline bool GetSelection() const;
+ void SetSelection(bool bNewSelection);
+
+ inline bool GetRegExp() const;
+ void SetRegExp( bool bVal );
+
+ inline bool GetWildcard() const;
+ void SetWildcard( bool bVal );
+
+ bool GetPattern() const { return m_bPattern; }
+ void SetPattern(bool bNewPattern) { m_bPattern = bNewPattern; }
+
+ SfxStyleFamily GetFamily() const { return m_eFamily; }
+ void SetFamily( SfxStyleFamily eNewFamily )
+ { m_eFamily = eNewFamily; }
+
+ bool GetRowDirection() const { return m_bRowDirection; }
+ void SetRowDirection(bool bNewRowDirection) { m_bRowDirection = bNewRowDirection; }
+
+ bool IsAllTables() const { return m_bAllTables; }
+ void SetAllTables(bool bNew) { m_bAllTables = bNew; }
+
+ bool IsSearchFiltered() const { return m_bSearchFiltered; }
+ void SetSearchFiltered(bool b) { m_bSearchFiltered = b; }
+
+ bool IsSearchFormatted() const { return m_bSearchFormatted; }
+ void SetSearchFormatted(bool b) { m_bSearchFormatted = b; }
+
+ SvxSearchCellType GetCellType() const { return m_nCellType; }
+ void SetCellType(SvxSearchCellType nNewCellType) { m_nCellType = nNewCellType; }
+
+ bool GetNotes() const { return m_bNotes; }
+ void SetNotes(bool bNew) { m_bNotes = bNew; }
+
+ SvxSearchApp GetAppFlag() const { return m_nAppFlag; }
+ void SetAppFlag(SvxSearchApp nNewAppFlag) { m_nAppFlag = nNewAppFlag; }
+
+ inline bool IsLevenshtein() const;
+ void SetLevenshtein( bool bVal );
+
+ inline bool IsLEVRelaxed() const;
+ void SetLEVRelaxed(bool bSet);
+
+ inline sal_uInt16 GetLEVOther() const;
+ inline void SetLEVOther(sal_uInt16 nSet);
+
+ inline sal_uInt16 GetLEVShorter() const;
+ inline void SetLEVShorter(sal_uInt16 nSet);
+
+ inline sal_uInt16 GetLEVLonger() const;
+ inline void SetLEVLonger(sal_uInt16 nSet);
+
+ inline const i18nutil::SearchOptions2 &
+ GetSearchOptions() const;
+ inline void SetSearchOptions( const i18nutil::SearchOptions2 &rOpt );
+
+ inline TransliterationFlags
+ GetTransliterationFlags() const;
+ void SetTransliterationFlags( TransliterationFlags nFlags );
+
+ inline bool IsMatchFullHalfWidthForms() const;
+ void SetMatchFullHalfWidthForms( bool bVal );
+
+ bool IsUseAsianOptions() const { return m_bAsianOptions; }
+ void SetUseAsianOptions( bool bVal ) { m_bAsianOptions = bVal; }
+
+ sal_Int32 GetStartPointX() const;
+ sal_Int32 GetStartPointY() const;
+ /// Either x or y start point is set.
+ bool HasStartPoint() const;
+};
+
+const OUString& SvxSearchItem::GetSearchString() const
+{
+ return m_aSearchOpt.searchString;
+}
+
+void SvxSearchItem::SetSearchString(const OUString& rNewString)
+{
+ m_aSearchOpt.searchString = rNewString;
+}
+
+const OUString& SvxSearchItem::GetReplaceString() const
+{
+ return m_aSearchOpt.replaceString;
+}
+
+void SvxSearchItem::SetReplaceString(const OUString& rNewString)
+{
+ m_aSearchOpt.replaceString = rNewString;
+}
+
+bool SvxSearchItem::GetWordOnly() const
+{
+ return 0 != (m_aSearchOpt.searchFlag &
+ css::util::SearchFlags::NORM_WORD_ONLY);
+}
+
+bool SvxSearchItem::GetExact() const
+{
+ return !(m_aSearchOpt.transliterateFlags & TransliterationFlags::IGNORE_CASE);
+}
+
+bool SvxSearchItem::GetSelection() const
+{
+ return 0 != (m_aSearchOpt.searchFlag & css::util::SearchFlags::REG_NOT_BEGINOFLINE);
+}
+
+bool SvxSearchItem::GetRegExp() const
+{
+ // Ensure old and new algorithm types are in sync until all places are
+ // adapted to use only new types.
+ assert( (m_aSearchOpt.algorithmType == css::util::SearchAlgorithms_REGEXP) ==
+ (m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::REGEXP));
+ return m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::REGEXP ;
+}
+
+bool SvxSearchItem::GetWildcard() const
+{
+ // Ensure old and new algorithm types are in sync, in this case old is not
+ // REGEXP or APPROXIMATE.
+ assert( m_aSearchOpt.AlgorithmType2 != css::util::SearchAlgorithms2::WILDCARD ||
+ (m_aSearchOpt.algorithmType != css::util::SearchAlgorithms_REGEXP &&
+ m_aSearchOpt.algorithmType != css::util::SearchAlgorithms_APPROXIMATE) );
+ return m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::WILDCARD ;
+}
+
+bool SvxSearchItem::IsLEVRelaxed() const
+{
+ return 0 != (m_aSearchOpt.searchFlag & css::util::SearchFlags::LEV_RELAXED);
+}
+
+sal_uInt16 SvxSearchItem::GetLEVOther() const
+{
+ return static_cast<sal_Int16>(m_aSearchOpt.changedChars);
+}
+
+void SvxSearchItem::SetLEVOther( sal_uInt16 nVal )
+{
+ m_aSearchOpt.changedChars = nVal;
+}
+
+sal_uInt16 SvxSearchItem::GetLEVShorter() const
+{
+ return static_cast<sal_Int16>(m_aSearchOpt.insertedChars);
+}
+
+void SvxSearchItem::SetLEVShorter( sal_uInt16 nVal )
+{
+ m_aSearchOpt.insertedChars = nVal;
+}
+
+sal_uInt16 SvxSearchItem::GetLEVLonger() const
+{
+ return static_cast<sal_Int16>(m_aSearchOpt.deletedChars);
+}
+
+void SvxSearchItem::SetLEVLonger( sal_uInt16 nVal )
+{
+ m_aSearchOpt.deletedChars = nVal;
+}
+
+bool SvxSearchItem::IsLevenshtein() const
+{
+ // Ensure old and new algorithm types are in sync until all places are
+ // adapted to use only new types.
+ assert( (m_aSearchOpt.algorithmType == css::util::SearchAlgorithms_APPROXIMATE) ==
+ (m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::APPROXIMATE));
+ return m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::APPROXIMATE;
+}
+
+const i18nutil::SearchOptions2 & SvxSearchItem::GetSearchOptions() const
+{
+ return m_aSearchOpt;
+}
+
+void SvxSearchItem::SetSearchOptions( const i18nutil::SearchOptions2 &rOpt )
+{
+ m_aSearchOpt = rOpt;
+}
+
+TransliterationFlags SvxSearchItem::GetTransliterationFlags() const
+{
+ return m_aSearchOpt.transliterateFlags;
+}
+
+bool SvxSearchItem::IsMatchFullHalfWidthForms() const
+{
+ return bool(m_aSearchOpt.transliterateFlags & TransliterationFlags::IGNORE_WIDTH);
+}
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/stritem.hxx b/include/svl/stritem.hxx
new file mode 100644
index 000000000..fe3695f79
--- /dev/null
+++ b/include/svl/stritem.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_STRITEM_HXX
+#define INCLUDED_SVL_STRITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/custritm.hxx>
+
+
+class SVL_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SfxStringItem(sal_uInt16 which = 0): CntUnencodedStringItem(which) {}
+
+ SfxStringItem(sal_uInt16 which, const OUString & rValue):
+ CntUnencodedStringItem(which, rValue) {}
+
+ virtual SfxStringItem* Clone(SfxItemPool * = nullptr) const override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+
+};
+
+#endif // INCLUDED_SVL_STRITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/style.hxx b/include/svl/style.hxx
new file mode 100644
index 000000000..b5b7aa3ad
--- /dev/null
+++ b/include/svl/style.hxx
@@ -0,0 +1,359 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_STYLE_HXX
+#define INCLUDED_SVL_STYLE_HXX
+
+#include <config_options.h>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <rtl/ref.hxx>
+#include <comphelper/weak.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <svl/svldllapi.h>
+#include <svl/hint.hxx>
+#include <svl/lstner.hxx>
+#include <svl/SfxBroadcaster.hxx>
+#include <svl/stylesheetuser.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <tools/mapunit.hxx>
+#include <tools/solar.h>
+
+#include <memory>
+#include <optional>
+
+// This is used as a flags enum in sw/, but only there,
+// so I don't pull in o3tl::typed_flags here
+enum class SfxStyleFamily {
+ None = 0x00,
+ Char = 0x01,
+ Para = 0x02,
+ Frame = 0x04,
+ Page = 0x08,
+ Pseudo = 0x10,
+ Table = 0x20,
+ Cell = 0x40,
+ All = 0x7fff
+};
+
+enum class SfxStyleSearchBits {
+ // sc/calc styles
+ ScStandard = 0x0001,
+
+ // sw/writer styles
+ SwText = 0x0001,
+ SwChapter = 0x0002,
+ SwList = 0x0004,
+ SwIndex = 0x0008,
+ SwExtra = 0x0010,
+ SwHtml = 0x0020,
+ SwCondColl = 0x0040,
+
+ Auto = 0x0000, ///< automatic: flags from application
+ Hidden = 0x0200, ///< hidden styles (search mask)
+ ReadOnly = 0x2000, ///< readonly styles (search mask)
+ Used = 0x4000, ///< used styles (search mask)
+ UserDefined = 0x8000, ///< user defined styles (search mask)
+ AllVisible = 0xe07f, ///< all visible styles
+ All = 0xe27f, ///< all styles
+};
+namespace o3tl {
+ template<> struct typed_flags<SfxStyleSearchBits> : is_typed_flags<SfxStyleSearchBits, 0xe27f> {};
+}
+
+
+class SfxItemSet;
+class SfxItemPool;
+class SfxStyleSheetBasePool;
+class SvStream;
+
+namespace svl { class IndexedStyleSheets; }
+/*
+Everyone changing instances of SfxStyleSheetBasePool or SfxStyleSheetBase
+must broadcast this using <SfxStyleSheetBasePool::GetBroadcaster()> broadcasts.
+The class <SfxStyleSheetHint> is used for this, it contains an Action-Id and a
+pointer to the <SfxStyleSheetBase>. The actions are:
+
+#define SfxHintId::StyleSheetCreated // style is created
+#define SfxHintId::StyleSheetModified // style is modified
+#define SfxHintId::StyleSheetChanged // style is replaced
+#define SfxHintId::StyleSheetErased // style is deleted
+
+The following methods already broadcast themself
+
+SfxSimpleHint(SfxHintId::Dying) from:
+ SfxStyleSheetBasePool::~SfxStyleSheetBasePool()
+
+SfxStyleSheetHint( SfxHintId::StyleSheetCreated, *p ) from:
+ SfxStyleSheetBasePool::Make( const String& rName,
+ SfxStyleFamily eFam, sal_uInt16 mask)
+
+SfxStyleSheetHint( SfxHintId::StyleSheetChanged, *pNew ) from:
+ SfxStyleSheetBasePool::Add( SfxStyleSheetBase& rSheet )
+
+SfxStyleSheetHint( SfxHintId::StyleSheetErased, *p ) from:
+ SfxStyleSheetBasePool::Erase( SfxStyleSheetBase* p )
+ SfxStyleSheetBasePool::Clear()
+*/
+
+class SVL_DLLPUBLIC SfxStyleSheetBase : public comphelper::OWeakTypeObject
+{
+private:
+ friend class SfxStyleSheetBasePool;
+
+protected:
+ SfxStyleSheetBasePool* m_pPool; // related pool
+ SfxStyleFamily nFamily;
+
+ OUString aName, aParent, aFollow;
+ OUString aHelpFile; // name of the help file
+ SfxItemSet* pSet; // ItemSet
+ SfxStyleSearchBits nMask; // Flags
+
+ sal_uLong nHelpId; // help ID
+
+ bool bMySet; // sal_True: delete Set in dtor
+ bool bHidden;
+
+ SfxStyleSheetBase( const OUString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, SfxStyleSearchBits mask );
+ SfxStyleSheetBase( const SfxStyleSheetBase& );
+ virtual ~SfxStyleSheetBase() override;
+
+public:
+
+ // returns the internal name of this style
+ const OUString& GetName() const;
+
+ // sets the internal name of this style.
+ //
+ // If the name of a style is changed, then the styles container needs to be
+ // reindexed (see IndexedStyleSheets). If you set bReindexNow to false to
+ // defer that indexing, then you must call the Reindex manually on the
+ // SfxStyleSheetBasePool parent.
+ virtual bool SetName(const OUString& rNewName, bool bReindexNow = true);
+
+ virtual const OUString& GetParent() const;
+ virtual bool SetParent( const OUString& );
+ virtual const OUString& GetFollow() const;
+ virtual bool SetFollow( const OUString& );
+ virtual bool HasFollowSupport() const; // Default true
+ virtual bool HasParentSupport() const; // Default true
+ virtual bool HasClearParentSupport() const; // Default false
+ virtual bool IsUsed() const; // Default true
+ virtual OUString GetDescription( MapUnit eMetric );
+
+ virtual OUString GetUsedBy() { return OUString(); }
+
+ SfxStyleSheetBasePool* GetPool() { return m_pPool; }
+ SfxStyleFamily GetFamily() const { return nFamily; }
+ SfxStyleSearchBits GetMask() const { return nMask; }
+ void SetMask( SfxStyleSearchBits mask) { nMask = mask; }
+ bool IsUserDefined() const
+ { return bool( nMask & SfxStyleSearchBits::UserDefined); }
+
+ virtual bool IsHidden() const { return bHidden; }
+ virtual void SetHidden( bool bValue );
+
+ virtual sal_uLong GetHelpId( OUString& rFile );
+ virtual void SetHelpId( const OUString& r, sal_uLong nId );
+
+ virtual SfxItemSet& GetItemSet();
+ /// Due to writer's usual lack of sanity this is a separate function for
+ /// preview only; it shall not create the style in case it does not exist.
+ /// If the style has parents, it is _not_ required that the returned item
+ /// set has parents (i.e. use it for display purposes only).
+ virtual std::optional<SfxItemSet> GetItemSetForPreview();
+
+ /// Fix for expensive dynamic_cast
+ virtual bool isScStyleSheet() const { return false; }
+};
+
+/* Class to iterate and search on a SfxStyleSheetBasePool */
+class SVL_DLLPUBLIC SfxStyleSheetIterator
+{
+public:
+ /** Constructor.
+ * The iterator will only iterate over style sheets which have the family \p eFam
+ */
+ SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase,
+ SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All );
+ SfxStyleSearchBits GetSearchMask() const;
+ SfxStyleFamily GetSearchFamily() const;
+ virtual sal_Int32 Count();
+ virtual SfxStyleSheetBase *operator[](sal_Int32 nIdx);
+ virtual SfxStyleSheetBase* First();
+ virtual SfxStyleSheetBase* Next();
+ virtual SfxStyleSheetBase* Find(const OUString& rStr);
+ virtual ~SfxStyleSheetIterator();
+
+ bool SearchUsed() const { return bSearchUsed; }
+
+protected:
+
+ SfxStyleSheetBasePool* pBasePool;
+ SfxStyleFamily nSearchFamily;
+ SfxStyleSearchBits nMask;
+
+
+private:
+ SVL_DLLPRIVATE bool IsTrivialSearch() const;
+
+ SfxStyleSheetBase* pCurrentStyle;
+ sal_Int32 mnCurrentPosition;
+ bool bSearchUsed;
+
+friend class SfxStyleSheetBasePool;
+};
+
+class SfxStyleSheetBasePool_Impl;
+
+class SVL_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public comphelper::OWeakTypeObject
+{
+friend class SfxStyleSheetIterator;
+friend class SfxStyleSheetBase;
+
+ std::unique_ptr<SfxStyleSheetBasePool_Impl> pImpl;
+
+ SfxStyleSheetIterator& GetIterator_Impl(SfxStyleFamily eFamily, SfxStyleSearchBits eMask);
+protected:
+ SfxStyleSheetIterator* GetCachedIterator();
+
+ SfxItemPool& rPool;
+
+ void ChangeParent(std::u16string_view rOld, const OUString& rNew, SfxStyleFamily eFamily, bool bVirtual = true);
+ virtual rtl::Reference<SfxStyleSheetBase> Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits );
+ virtual rtl::Reference<SfxStyleSheetBase> Create( const SfxStyleSheetBase& );
+
+ virtual ~SfxStyleSheetBasePool() override;
+
+ void StoreStyleSheet(const rtl::Reference< SfxStyleSheetBase >&);
+
+ /** Obtain the indexed style sheets.
+ */
+ const svl::IndexedStyleSheets&
+ GetIndexedStyleSheets() const;
+ SfxStyleSheetBase* GetStyleSheetByPositionInIndex(unsigned pos);
+
+public:
+ SfxStyleSheetBasePool( SfxItemPool& );
+ SfxStyleSheetBasePool( const SfxStyleSheetBasePool& );
+
+ SfxItemPool& GetPool() { return rPool;}
+ const SfxItemPool& GetPool() const { return rPool;}
+
+ virtual std::unique_ptr<SfxStyleSheetIterator> CreateIterator(SfxStyleFamily, SfxStyleSearchBits nMask = SfxStyleSearchBits::All);
+
+ virtual SfxStyleSheetBase& Make(const OUString&,
+ SfxStyleFamily eFam,
+ SfxStyleSearchBits nMask = SfxStyleSearchBits::All);
+
+ virtual void Remove( SfxStyleSheetBase* );
+ void Insert( SfxStyleSheetBase* );
+
+ void Clear();
+
+ SfxStyleSheetBasePool& operator=( const SfxStyleSheetBasePool& );
+ SfxStyleSheetBasePool& operator+=( const SfxStyleSheetBasePool& );
+
+ SfxStyleSheetBase* First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask = SfxStyleSearchBits::All);
+ SfxStyleSheetBase* Next();
+ virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All );
+
+ virtual bool SetParent(SfxStyleFamily eFam,
+ const OUString &rStyle,
+ const OUString &rParent);
+
+ void Reindex();
+ /** Add a style sheet.
+ * Not an actual public function. Do not call it from non-subclasses.
+ */
+ void Add( const SfxStyleSheetBase& );
+};
+
+class SVL_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase,
+ public SfxListener, public SfxBroadcaster, public svl::StyleSheetUser
+{
+public:
+
+ SfxStyleSheet( const OUString&, const SfxStyleSheetBasePool&, SfxStyleFamily, SfxStyleSearchBits );
+ SfxStyleSheet( const SfxStyleSheet& );
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+
+ virtual bool isUsedByModel() const override;
+
+ virtual bool SetParent( const OUString& ) override;
+
+protected:
+ virtual ~SfxStyleSheet() override;
+};
+
+class SVL_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool
+{
+protected:
+ using SfxStyleSheetBasePool::Create;
+ virtual rtl::Reference<SfxStyleSheetBase> Create(const OUString&, SfxStyleFamily, SfxStyleSearchBits mask) override;
+
+public:
+ SfxStyleSheetPool( SfxItemPool const& );
+};
+
+
+class SVL_DLLPUBLIC SfxStyleSheetPoolHint final : public SfxHint
+{
+public:
+ SfxStyleSheetPoolHint() {}
+};
+
+
+class SVL_DLLPUBLIC SfxStyleSheetHint: public SfxHint
+{
+ SfxStyleSheetBase* pStyleSh;
+public:
+ SfxStyleSheetHint( SfxHintId, SfxStyleSheetBase& );
+ SfxStyleSheetBase* GetStyleSheet() const
+ { return pStyleSh; }
+};
+
+class UNLESS_MERGELIBS(SVL_DLLPUBLIC) SfxStyleSheetModifiedHint final : public SfxStyleSheetHint
+{
+ OUString aName;
+
+public:
+ SfxStyleSheetModifiedHint( OUString aOld,
+ SfxStyleSheetBase& );
+ const OUString& GetOldName() const { return aName; }
+};
+
+class SVL_DLLPUBLIC SfxUnoStyleSheet : public cppu::ImplInheritanceHelper<SfxStyleSheet, css::style::XStyle, css::lang::XUnoTunnel>
+{
+public:
+ SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask );
+
+ static SfxUnoStyleSheet* getUnoStyleSheet( const css::uno::Reference< css::style::XStyle >& xStyle );
+
+ // XUnoTunnel
+ static const css::uno::Sequence< ::sal_Int8 >& getUnoTunnelId();
+ virtual ::sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< ::sal_Int8 >& aIdentifier ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/stylepool.hxx b/include/svl/stylepool.hxx
new file mode 100644
index 000000000..0a22cb1f7
--- /dev/null
+++ b/include/svl/stylepool.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_STYLEPOOL_HXX
+#define INCLUDED_SVL_STYLEPOOL_HXX
+
+#include <memory>
+#include <rtl/ustring.hxx>
+#include <svl/itemset.hxx>
+
+class StylePoolImpl;
+class IStylePoolIteratorAccess;
+
+class SVL_DLLPUBLIC StylePool final
+{
+private:
+ std::unique_ptr<StylePoolImpl> pImpl;
+public:
+ explicit StylePool( SfxItemSet const * pIgnorableItems = nullptr );
+
+ /** Insert a SfxItemSet into the style pool.
+
+ The pool makes a copy of the provided SfxItemSet.
+
+ @param SfxItemSet
+ the SfxItemSet to insert
+
+ @param pParentName
+ Name of the parent of rSet. If set, createIterator() can be more deterministic by iterating
+ over item sets ordered by parent names.
+
+ @return a shared pointer to the SfxItemSet
+ */
+ std::shared_ptr<SfxItemSet> insertItemSet( const SfxItemSet& rSet, const OUString* pParentName = nullptr );
+
+ /** Create an iterator
+
+ The iterator walks through the StylePool
+ OD 2008-03-07 #i86923#
+ introduce optional parameter to control, if unused SfxItemsSet are skipped or not
+ introduce optional parameter to control, if ignorable items are skipped or not
+
+ @attention every change, e.g. destruction, of the StylePool could cause undefined effects.
+
+ @param bSkipUnusedItemSets
+ input parameter - boolean, indicating if unused SfxItemSets are skipped or not
+
+ @param bSkipIgnorableItems
+ input parameter - boolean, indicating if ignorable items are skipped or not
+
+ @postcond the iterator "points before the first" SfxItemSet of the pool.
+ The first StylePoolIterator::getNext() call will deliver the first SfxItemSet.
+ */
+ std::unique_ptr<IStylePoolIteratorAccess> createIterator( const bool bSkipUnusedItemSets = false,
+ const bool bSkipIgnorableItems = false );
+
+ ~StylePool();
+
+ static OUString nameOf( const std::shared_ptr<SfxItemSet>& pSet );
+};
+
+class SVL_DLLPUBLIC IStylePoolIteratorAccess
+{
+public:
+ /** Delivers a shared pointer to the next SfxItemSet of the pool
+ If there is no more SfxItemSet, the delivered share_pointer is empty.
+ */
+ virtual std::shared_ptr<SfxItemSet> getNext() = 0;
+ virtual ~IStylePoolIteratorAccess() {};
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/stylesheetuser.hxx b/include/svl/stylesheetuser.hxx
new file mode 100644
index 000000000..ba69268da
--- /dev/null
+++ b/include/svl/stylesheetuser.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVL_STYLESHEETUSER_HXX
+#define INCLUDED_SVL_STYLESHEETUSER_HXX
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+namespace svl
+{
+/** Test whether object that uses a stylesheet is used itself.
+
+ This interface should be implemented by all classes that use
+ a SfxStyleSheet (and listen on it). It can be queried by the stylesheet
+ to determine if it is really used.
+ */
+class SAL_DLLPUBLIC_RTTI StyleSheetUser
+{
+public:
+ /** Test whether this object is used.
+
+ @return true, if the object is used, false otherwise
+ */
+ virtual bool isUsedByModel() const = 0;
+
+protected:
+ ~StyleSheetUser() {}
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/svdde.hxx b/include/svl/svdde.hxx
new file mode 100644
index 000000000..e8b808ea1
--- /dev/null
+++ b/include/svl/svdde.hxx
@@ -0,0 +1,326 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_SVDDE_HXX
+#define INCLUDED_SVL_SVDDE_HXX
+
+#include <sal/config.h>
+
+#include <svl/svldllapi.h>
+#include <sot/formats.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/solar.h>
+#include <tools/link.hxx>
+#include <tools/long.hxx>
+#include <memory>
+#include <vector>
+
+class DdeString;
+class DdeConnection;
+class DdeTopic;
+class DdeService;
+struct DdeDataImp;
+struct DdeImp;
+struct DdeItemImpData;
+struct Conversation;
+
+typedef ::std::vector< DdeService* > DdeServices;
+
+
+class SVL_DLLPUBLIC DdeData
+{
+ friend class DdeInternal;
+ friend class DdeService;
+ friend class DdeConnection;
+ friend class DdeTransaction;
+ std::unique_ptr<DdeDataImp> xImp;
+
+ SVL_DLLPRIVATE void Lock();
+
+ void SetFormat( SotClipboardFormatId nFmt );
+
+public:
+ DdeData();
+ DdeData(SAL_UNUSED_PARAMETER const void*, SAL_UNUSED_PARAMETER tools::Long, SAL_UNUSED_PARAMETER SotClipboardFormatId = SotClipboardFormatId::STRING);
+ DdeData(SAL_UNUSED_PARAMETER const OUString&);
+ DdeData(const DdeData&);
+ DdeData(DdeData&&) noexcept;
+ ~DdeData();
+
+ void const * getData() const;
+ tools::Long getSize() const;
+
+ SotClipboardFormatId GetFormat() const;
+
+ DdeData& operator=(const DdeData&);
+ DdeData& operator=(DdeData&&) noexcept;
+
+ static sal_uInt32 GetExternalFormat(SotClipboardFormatId nFmt);
+ static SotClipboardFormatId GetInternalFormat(sal_uLong nFmt);
+};
+
+
+class SVL_DLLPUBLIC DdeTransaction
+{
+public:
+ void Data( const DdeData* );
+ void Done( bool bDataValid );
+protected:
+ DdeConnection& rDde;
+ DdeData aDdeData;
+ DdeString* pName;
+ short nType;
+ sal_IntPtr nId;
+ sal_IntPtr nTime;
+ Link<const DdeData*,void> aData;
+ Link<bool,void> aDone;
+ bool bBusy;
+
+ DdeTransaction( DdeConnection&, SAL_UNUSED_PARAMETER const OUString&, SAL_UNUSED_PARAMETER tools::Long = 0 );
+
+public:
+ virtual ~DdeTransaction();
+
+ bool IsBusy() const { return bBusy; }
+ OUString GetName() const;
+
+ void Execute();
+
+ void SetDataHdl( const Link<const DdeData*,void>& rLink ) { aData = rLink; }
+ const Link<const DdeData*,void>& GetDataHdl() const { return aData; }
+
+ void SetDoneHdl( const Link<bool,void>& rLink ) { aDone = rLink; }
+ const Link<bool,void>& GetDoneHdl() const { return aDone; }
+
+ void SetFormat( SotClipboardFormatId nFmt ) { aDdeData.SetFormat( nFmt ); }
+ SotClipboardFormatId GetFormat() const { return aDdeData.GetFormat(); }
+
+ tools::Long GetError() const;
+
+private:
+ friend class DdeInternal;
+ friend class DdeConnection;
+
+ DdeTransaction( const DdeTransaction& ) = delete;
+ const DdeTransaction& operator= ( const DdeTransaction& ) = delete;
+
+};
+
+
+class SVL_DLLPUBLIC DdeLink : public DdeTransaction
+{
+ Link<void*,void> aNotify;
+
+public:
+ DdeLink( DdeConnection&, const OUString&, tools::Long = 0 );
+ virtual ~DdeLink() override;
+
+ void SetNotifyHdl( const Link<void*,void>& rLink ) { aNotify = rLink; }
+ const Link<void*,void>& GetNotifyHdl() const { return aNotify; }
+ void Notify();
+};
+
+
+class SVL_DLLPUBLIC DdeHotLink : public DdeLink
+{
+public:
+ DdeHotLink( DdeConnection&, const OUString& );
+};
+
+
+class SVL_DLLPUBLIC DdeRequest : public DdeTransaction
+{
+public:
+ DdeRequest( DdeConnection&, const OUString&, tools::Long = 0 );
+};
+
+
+class SVL_DLLPUBLIC DdePoke : public DdeTransaction
+{
+public:
+ DdePoke( DdeConnection&, const OUString&, SAL_UNUSED_PARAMETER const DdeData&, tools::Long = 0 );
+};
+
+
+class SVL_DLLPUBLIC DdeExecute : public DdeTransaction
+{
+public:
+ DdeExecute( DdeConnection&, const OUString&, tools::Long = 0 );
+};
+
+
+class SVL_DLLPUBLIC DdeConnection
+{
+ friend class DdeInternal;
+ friend class DdeTransaction;
+ std::vector<DdeTransaction*> aTransactions;
+ DdeString* pService;
+ DdeString* pTopic;
+ std::unique_ptr<DdeImp> pImp;
+
+public:
+ DdeConnection( SAL_UNUSED_PARAMETER const OUString&, SAL_UNUSED_PARAMETER const OUString& );
+ ~DdeConnection();
+
+ tools::Long GetError() const;
+
+ static const std::vector<DdeConnection*>& GetConnections();
+
+ bool IsConnected();
+
+ OUString GetServiceName() const;
+ OUString GetTopicName() const;
+
+private:
+ DdeConnection( const DdeConnection& ) = delete;
+ const DdeConnection& operator= ( const DdeConnection& ) = delete;
+};
+
+
+class SVL_DLLPUBLIC DdeItem
+{
+ friend class DdeInternal;
+ friend class DdeTopic;
+ DdeString* pName;
+ DdeTopic* pMyTopic;
+ std::vector<DdeItemImpData>* pImpData;
+
+protected:
+ sal_uInt8 nType;
+
+public:
+ DdeItem( const sal_Unicode* );
+ DdeItem( SAL_UNUSED_PARAMETER const OUString& );
+ DdeItem( const DdeItem& );
+ virtual ~DdeItem();
+
+ OUString GetName() const;
+ short GetLinks();
+ void NotifyClient();
+};
+
+
+class SVL_DLLPUBLIC DdeGetPutItem : public DdeItem
+{
+public:
+ DdeGetPutItem( const sal_Unicode* p );
+ DdeGetPutItem( const OUString& rStr );
+ DdeGetPutItem( const DdeItem& rItem );
+
+ virtual DdeData* Get( SotClipboardFormatId );
+ virtual bool Put( const DdeData* );
+ virtual void AdviseLoop( bool ); // Start / Stop AdviseLoop
+};
+
+
+class SVL_DLLPUBLIC DdeTopic
+{
+
+public:
+ virtual DdeData* Get(SotClipboardFormatId);
+ virtual bool Put( const DdeData* );
+ virtual bool Execute( const OUString* );
+ // Eventually create a new item. return 0 -> Item creation failed
+ virtual bool MakeItem( const OUString& rItem );
+
+ // A Warm-/Hot-Link is created. Return true if successful
+ virtual bool StartAdviseLoop();
+
+private:
+ friend class DdeInternal;
+ friend class DdeService;
+ friend class DdeItem;
+
+private:
+ DdeString* pName;
+ OUString aItem;
+ std::vector<DdeItem*> aItems;
+
+public:
+ DdeTopic( SAL_UNUSED_PARAMETER const OUString& );
+ virtual ~DdeTopic();
+
+ OUString GetName() const;
+
+ void NotifyClient( const OUString& );
+ bool IsSystemTopic();
+
+ void InsertItem( DdeItem* ); // For own superclasses
+ DdeItem* AddItem( const DdeItem& ); // Will be cloned
+ void RemoveItem( const DdeItem& );
+ const OUString& GetCurItem() const { return aItem; }
+ const std::vector<DdeItem*>& GetItems() const { return aItems; }
+
+private:
+ DdeTopic( const DdeTopic& ) = delete;
+ const DdeTopic& operator= ( const DdeTopic& ) = delete;
+};
+
+
+class SVL_DLLPUBLIC DdeService
+{
+ friend class DdeInternal;
+
+protected:
+ OUString Topics();
+ OUString Formats();
+ OUString SysItems();
+ OUString Status();
+
+ const DdeTopic* GetSysTopic() const { return pSysTopic; }
+private:
+ std::vector<DdeTopic*> aTopics;
+ std::vector< sal_uInt32 > aFormats;
+ DdeTopic* pSysTopic;
+ DdeString* pName;
+ std::vector<std::unique_ptr<Conversation>>
+ m_vConv;
+ short nStatus;
+
+ SVL_DLLPRIVATE bool HasCbFormat( sal_uInt32 );
+
+public:
+ DdeService( SAL_UNUSED_PARAMETER const OUString& );
+ virtual ~DdeService();
+
+ DdeService( const DdeService& ) = delete;
+ DdeService& operator= ( const DdeService& ) = delete;
+
+ OUString GetName() const;
+ short GetError() const { return nStatus; }
+
+ static DdeServices& GetServices();
+ std::vector<DdeTopic*>& GetTopics() { return aTopics; }
+
+ void AddTopic( const DdeTopic& );
+ void RemoveTopic( const DdeTopic& );
+
+ void AddFormat(SotClipboardFormatId);
+ void RemoveFormat(SotClipboardFormatId);
+ bool HasFormat(SotClipboardFormatId);
+};
+
+
+inline tools::Long DdeTransaction::GetError() const
+{
+ return rDde.GetError();
+}
+#endif // INCLUDED_SVL_SVDDE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/svl.hrc b/include/svl/svl.hrc
new file mode 100644
index 000000000..205227377
--- /dev/null
+++ b/include/svl/svl.hrc
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_SVL_HRC
+#define INCLUDED_SVL_SVL_HRC
+
+#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
+
+// Internet Media Type Presentations
+
+#define STR_SVT_MIMETYPE_CNT_FSYSBOX NC_("STR_SVT_MIMETYPE_CNT_FSYSBOX", "Workplace")
+#define STR_FILECTRL_BUTTONTEXT NC_("STR_FILECTRL_BUTTONTEXT", "Browse...")
+
+// tdf#145919 localizable strings to be shared in vcl and cui modules
+#define GRTSTR_PASSED NC_("GRTSTR_PASSED", "PASSED")
+#define GRTSTR_QUIRKY NC_("GRTSTR_QUIRKY", "QUIRKY")
+#define GRTSTR_FAILED NC_("GRTSTR_FAILED", "FAILED")
+#define GRTSTR_SKIPPED NC_("GRTSTR_SKIPPED", "SKIPPED")
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/svldllapi.h b/include/svl/svldllapi.h
new file mode 100644
index 000000000..31402a7b1
--- /dev/null
+++ b/include/svl/svldllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_SVLDLLAPI_H
+#define INCLUDED_SVL_SVLDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(SVL_DLLIMPLEMENTATION)
+#define SVL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SVL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SVL_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_SVL_SVLDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/svlresid.hxx b/include/svl/svlresid.hxx
new file mode 100644
index 000000000..5b57aa2c0
--- /dev/null
+++ b/include/svl/svlresid.hxx
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVL_SVTRESID_HXX
+#define INCLUDED_SVL_SVTRESID_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+#include <unotools/resmgr.hxx>
+
+SVL_DLLPUBLIC OUString SvlResId(TranslateId sContextAndId);
+
+#endif // INCLUDED_SVL_SVTRESID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/typedwhich.hxx b/include/svl/typedwhich.hxx
new file mode 100644
index 000000000..cb9efabd5
--- /dev/null
+++ b/include/svl/typedwhich.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_SVL_TYPEDWHICH_HXX
+#define INCLUDED_SVL_TYPEDWHICH_HXX
+
+#include <sal/config.h>
+#include <sal/types.h>
+#include <type_traits>
+
+/**
+ * A very thin wrapper around the sal_uInt16 WhichId whose purpose is mostly to carry type information,
+ * so that we Put() and Get() the right subclasses of SfxPoolItem for each WhichId.
+ */
+template <class T> class TypedWhichId final
+{
+public:
+ explicit constexpr TypedWhichId(sal_uInt16 nWhich)
+ : mnWhich(nWhich)
+ {
+ }
+
+ /** Up-casting conversion constructor
+ */
+ template <class derived_type>
+ constexpr TypedWhichId(TypedWhichId<derived_type> other,
+ std::enable_if_t<std::is_base_of_v<T, derived_type>, int> = 0)
+ : mnWhich(sal_uInt16(other))
+ {
+ }
+
+ constexpr operator sal_uInt16() const { return mnWhich; }
+
+private:
+ sal_uInt16 mnWhich;
+};
+
+template <class T> constexpr bool operator==(sal_uInt16 lhs, TypedWhichId<T> const& rhs)
+{
+ return lhs == sal_uInt16(rhs);
+}
+template <class T> constexpr bool operator!=(sal_uInt16 lhs, TypedWhichId<T> const& rhs)
+{
+ return lhs != sal_uInt16(rhs);
+}
+template <class T> constexpr bool operator==(TypedWhichId<T> const& lhs, sal_uInt16 rhs)
+{
+ return sal_uInt16(lhs) == rhs;
+}
+template <class T> constexpr bool operator!=(TypedWhichId<T> const& lhs, sal_uInt16 rhs)
+{
+ return sal_uInt16(lhs) != rhs;
+}
+
+#endif // INCLUDED_SVL_TYPEDWHICH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx
new file mode 100644
index 000000000..eff352298
--- /dev/null
+++ b/include/svl/undo.hxx
@@ -0,0 +1,343 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_UNDO_HXX
+#define INCLUDED_SVL_UNDO_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+#include <tools/datetime.hxx>
+#include <o3tl/strong_int.hxx>
+
+#include <memory>
+#include <vector>
+
+typedef o3tl::strong_int<sal_Int32, struct ViewShellIdTag> ViewShellId;
+typedef o3tl::strong_int<int, struct ViewShellDocIdTag> ViewShellDocId;
+
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+
+class SVL_DLLPUBLIC SfxRepeatTarget
+{
+public:
+ virtual ~SfxRepeatTarget() = 0;
+};
+
+
+class SVL_DLLPUBLIC SfxUndoContext
+{
+public:
+ /**
+ * Don't undo the top undo action, but an earlier one. It's the caller's responsibility to
+ * ensure that the earlier undo action is independent from the following ones.
+ */
+ virtual size_t GetUndoOffset() { return 0; }
+
+ virtual ~SfxUndoContext() = 0;
+};
+
+
+class SVL_DLLPUBLIC SfxUndoAction
+{
+public:
+ SfxUndoAction();
+ virtual ~SfxUndoAction() COVERITY_NOEXCEPT_FALSE;
+
+ virtual void Undo();
+ virtual void UndoWithContext( SfxUndoContext& i_context );
+ virtual void Redo();
+ virtual void RedoWithContext( SfxUndoContext& i_context );
+ virtual void Repeat(SfxRepeatTarget&);
+ virtual bool CanRepeat(SfxRepeatTarget&) const;
+
+ virtual bool Merge( SfxUndoAction *pNextAction );
+
+ virtual OUString GetComment() const;
+ virtual OUString GetRepeatComment(SfxRepeatTarget&) const;
+ /// ID of the view shell that created this undo action.
+ virtual ViewShellId GetViewShellId() const;
+ /// Timestamp when this undo item was created.
+ const DateTime& GetDateTime() const;
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+private:
+ SfxUndoAction( const SfxUndoAction& ) = delete;
+ SfxUndoAction& operator=( const SfxUndoAction& ) = delete;
+
+ DateTime m_aDateTime;
+};
+
+
+/// is a mark on the Undo stack
+typedef sal_Int32 UndoStackMark;
+#define MARK_INVALID ::std::numeric_limits< UndoStackMark >::max()
+
+struct MarkedUndoAction
+{
+ std::unique_ptr<SfxUndoAction> pAction;
+ ::std::vector< UndoStackMark > aMarks;
+
+ MarkedUndoAction(std::unique_ptr<SfxUndoAction> p) : pAction(std::move(p)) {}
+};
+
+/** do not make use of these implementation details, unless you
+ really really have to! */
+struct SVL_DLLPUBLIC SfxUndoArray
+{
+ std::vector<MarkedUndoAction> maUndoActions;
+ size_t nMaxUndoActions;
+ size_t nCurUndoAction;
+ SfxUndoArray *pFatherUndoArray;
+
+ SfxUndoArray(size_t nMax=0) :
+ nMaxUndoActions(nMax), nCurUndoAction(0), pFatherUndoArray(nullptr) {}
+ virtual ~SfxUndoArray();
+
+ SfxUndoArray& operator=( SfxUndoArray const & ) = delete; // MSVC2017 workaround
+ SfxUndoArray( SfxUndoArray const & ) = delete; // MSVC2017 workaround
+
+ SfxUndoAction* GetUndoAction(size_t idx) { return maUndoActions[idx].pAction.get(); }
+ std::unique_ptr<SfxUndoAction> Remove(int idx);
+ void Remove( size_t i_pos, size_t i_count );
+ void Insert( std::unique_ptr<SfxUndoAction> i_action, size_t i_pos );
+};
+
+
+/** do not make use of these implementation details, unless you
+ really really have to! */
+class SVL_DLLPUBLIC SfxListUndoAction final : public SfxUndoAction, public SfxUndoArray
+
+/* [Explanation]
+
+ UndoAction to composite multiple Undos in one UndoAction.
+ These actions are used by SfxUndomanager. With < SfxUndoManager::EnterListAction >
+ you can go one composite level down and with < SfxUndoManager::LeaveListAction > up again.
+ Redo and Undo work element wise on SfxListUndoActions.
+*/
+{
+ struct Impl;
+ std::unique_ptr<Impl> mpImpl;
+
+public:
+
+ SfxListUndoAction(
+ const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId, SfxUndoArray *pFather );
+ virtual ~SfxListUndoAction() override;
+
+ virtual void Undo() override;
+ virtual void UndoWithContext( SfxUndoContext& i_context ) override;
+ virtual void Redo() override;
+ virtual void RedoWithContext( SfxUndoContext& i_context ) override;
+ virtual void Repeat(SfxRepeatTarget&) override;
+ virtual bool CanRepeat(SfxRepeatTarget&) const override;
+
+ virtual bool Merge( SfxUndoAction *pNextAction ) override;
+
+ virtual OUString GetComment() const override;
+ /// See SfxUndoAction::GetViewShellId().
+ ViewShellId GetViewShellId() const override;
+ virtual OUString GetRepeatComment(SfxRepeatTarget&) const override;
+ sal_uInt16 GetId() const;
+
+ void SetComment(const OUString& rComment);
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+
+/** is a callback interface for notifications about state changes of an SfxUndoManager
+*/
+class SAL_NO_VTABLE SfxUndoListener
+{
+public:
+ virtual void actionUndone( const OUString& i_actionComment ) = 0;
+ virtual void actionRedone( const OUString& i_actionComment ) = 0;
+ virtual void undoActionAdded( const OUString& i_actionComment ) = 0;
+ virtual void cleared() = 0;
+ virtual void clearedRedo() = 0;
+ virtual void resetAll() = 0;
+ virtual void listActionEntered( const OUString& i_comment ) = 0;
+ virtual void listActionLeft( const OUString& i_comment ) = 0;
+ virtual void listActionCancelled() = 0;
+
+protected:
+ ~SfxUndoListener() {}
+};
+
+
+namespace svl::undo::impl
+{
+ class UndoManagerGuard;
+ class LockGuard;
+}
+
+struct SfxUndoManager_Data;
+class SVL_DLLPUBLIC SfxUndoManager
+{
+ std::unique_ptr< SfxUndoManager_Data >
+ m_xData;
+public:
+ static bool const CurrentLevel = true;
+ static bool const TopLevel = false;
+
+ SfxUndoManager( size_t nMaxUndoActionCount = 20 );
+ virtual ~SfxUndoManager();
+
+ void SetMaxUndoActionCount( size_t nMaxUndoActionCount );
+ virtual void AddUndoAction( std::unique_ptr<SfxUndoAction> pAction, bool bTryMerg=false );
+ virtual size_t GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const;
+ OUString GetUndoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
+ SfxUndoAction* GetUndoAction( size_t nNo=0 ) const;
+ /// Get info about all undo actions (comment, view shell id, etc.)
+ OUString GetUndoActionsInfo() const;
+ virtual size_t GetRedoActionCount( bool const i_currentLevel = CurrentLevel ) const;
+ OUString GetRedoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
+ SfxUndoAction* GetRedoAction(size_t nNo = 0) const;
+ /// Get info about all redo actions (comment, view shell id, etc.)
+ OUString GetRedoActionsInfo() const;
+ virtual bool Undo();
+ virtual bool Redo();
+ /** Clears both the Redo and the Undo stack.
+ Will assert and bail out when called while within a list action (<member>IsInListAction</member>).
+ */
+ virtual void Clear();
+ /** Clears the Redo stack.
+ Will assert and bail out when called while within a list action (<member>IsInListAction</member>).
+ */
+ virtual void ClearRedo();
+ /** leaves any possible open list action (<member>IsInListAction</member>), and clears both the Undo and the
+ Redo stack.
+
+ Effectively, calling this method is equivalent to <code>while ( IsInListAction() ) LeaveListAction();</code>,
+ followed by <code>Clear()</code>. The only difference to this calling sequence is that Reset is an
+ atomic operation, also resulting in only one notification.
+ */
+ void Reset();
+ /** determines whether an Undo or Redo is currently running
+ */
+ bool IsDoing() const;
+ size_t GetRepeatActionCount() const;
+ OUString GetRepeatActionComment( SfxRepeatTarget &rTarget) const;
+ bool Repeat( SfxRepeatTarget &rTarget );
+ bool CanRepeat( SfxRepeatTarget &rTarget ) const;
+ virtual void EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId);
+ /** Leaves the list action entered with EnterListAction
+ @return the number of the sub actions in the list which has just been left. Note that in case no such
+ actions exist, the list action does not contribute to the Undo stack, but is silently removed.
+ */
+ size_t LeaveListAction();
+
+ /** Leaves the list action entered with EnterListAction, and forcefully merges the previous
+ action on the stack into the newly created list action.
+
+ Say you have an Undo action A on the stack, then call EnterListAction, followed by one or more calls to
+ AddUndoAction, followed by a call to LeaveAndMergeListAction. In opposite to LeaveListAction, your Undo
+ stack will now still contain one undo action: the newly created list action, whose first child is the
+ original A, whose other children are those you added via AddUndoAction, and whose comment is the same as
+ the comment of A.
+
+ Effectively, this means that all actions added between EnterListAction and LeaveAndMergeListAction are
+ hidden from the user.
+
+ @return the number of the sub actions in the list which has just been left. Note that in case no such
+ actions exist, the list action does not contribute to the Undo stack, but is silently removed.
+ */
+ size_t LeaveAndMergeListAction();
+ /// determines whether we're within a ListAction context, i.e. a LeaveListAction/LeaveAndMergeListAction call is pending
+ bool IsInListAction() const;
+ /// Determines how many nested list actions are currently open
+ size_t GetListActionDepth() const;
+ /** Clears the redo stack and removes the top undo action */
+ void RemoveLastUndoAction();
+ /** enables (true) or disables (false) recording of undo actions
+
+ If undo actions are added while undo is disabled, they are deleted.
+ Disabling undo does not clear the current undo buffer!
+
+ Multiple calls to <code>EnableUndo</code> are not cumulative. That is, calling <code>EnableUndo( false )</code>
+ twice, and then calling <code>EnableUndo( true )</code> means that Undo is enable afterwards.
+ */
+ void EnableUndo( bool bEnable );
+ /// returns true if undo is currently enabled.
+ /// This returns false if undo was disabled using EnableUndo( false ) and
+ /// also during the runtime of the Undo() and Redo() methods.
+ bool IsUndoEnabled() const;
+ /// Adds a new listener to be notified about changes in the UndoManager's state
+ void AddUndoListener( SfxUndoListener& i_listener );
+ void RemoveUndoListener( SfxUndoListener& i_listener );
+ bool IsEmptyActions() const;
+
+
+ /** marks the current top-level element of the Undo stack, and returns a unique ID for it
+ */
+ UndoStackMark MarkTopUndoAction();
+
+ /** removes a mark given by its ID.
+ After the call, the mark ID is invalid.
+ */
+ void RemoveMark( UndoStackMark const i_mark );
+
+ /** determines whether the top action on the Undo stack has a given mark
+ */
+ bool HasTopUndoActionMark( UndoStackMark const i_mark );
+
+ /** removes the oldest Undo actions from the stack
+ */
+ void RemoveOldestUndoAction();
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+protected:
+ bool UndoWithContext( SfxUndoContext& i_context );
+ bool RedoWithContext( SfxUndoContext& i_context );
+
+ void ImplClearRedo_NoLock( bool const i_currentLevel );
+
+ /** clears all undo actions on the current level, plus all undo actions on superordinate levels,
+ as soon as those levels are reached.
+
+ If no list action is active currently, i.e. we're on the top level already, this method is equivalent to
+ ->Clear.
+
+ Otherwise, the Undo actions on the current level are removed. Upon leaving the current list action, all
+ undo actions on the then-current level are removed, too. This is continued until the top level is reached.
+ */
+ void ClearAllLevels();
+ virtual void EmptyActionsChanged();
+
+private:
+ size_t ImplLeaveListAction( const bool i_merge, ::svl::undo::impl::UndoManagerGuard& i_guard );
+ bool ImplAddUndoAction_NoNotify( std::unique_ptr<SfxUndoAction> pAction, bool bTryMerge, bool bClearRedo, ::svl::undo::impl::UndoManagerGuard& i_guard );
+ void ImplClearRedo( ::svl::undo::impl::UndoManagerGuard& i_guard, bool const i_currentLevel );
+ void ImplClearUndo( ::svl::undo::impl::UndoManagerGuard& i_guard );
+ void ImplClearCurrentLevel_NoNotify( ::svl::undo::impl::UndoManagerGuard& i_guard );
+ size_t ImplGetRedoActionCount_Lock( bool const i_currentLevel = CurrentLevel ) const;
+ bool ImplIsUndoEnabled_Lock() const;
+ bool ImplIsInListAction_Lock() const;
+ void ImplEnableUndo_Lock( bool const i_enable );
+
+ bool ImplUndo( SfxUndoContext* i_contextOrNull );
+ bool ImplRedo( SfxUndoContext* i_contextOrNull );
+ void ImplCheckEmptyActions();
+ inline bool ImplIsEmptyActions() const;
+
+ friend class ::svl::undo::impl::LockGuard;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/urihelper.hxx b/include/svl/urihelper.hxx
new file mode 100644
index 000000000..9f8588c97
--- /dev/null
+++ b/include/svl/urihelper.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_URIHELPER_HXX
+#define INCLUDED_SVL_URIHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/textenc.h>
+#include <svl/svldllapi.h>
+#include <tools/link.hxx>
+#include <tools/urlobj.hxx>
+
+namespace com::sun::star {
+ namespace uno { class XComponentContext; }
+ namespace uri { class XUriReference; }
+}
+
+class CharClass;
+
+namespace URIHelper {
+
+/**
+ @ATT
+ Calling this function with defaulted arguments rMaybeFileHdl = Link() and
+ bCheckFileExists = true often leads to results that are not intended:
+ Whenever the given rTheBaseURIRef is a file URL, the given rTheRelURIRef is
+ relative, and rTheRelURIRef could also be smart-parsed as a non-file URL
+ (e.g., the relative URL "foo/bar" can be smart-parsed as "http://foo/bar"),
+ then SmartRel2Abs called with rMaybeFileHdl = Link() and bCheckFileExists =
+ true returns the non-file URL interpretation. To avoid this, either pass
+ some non-null rMaybeFileHdl if you want to check generated file URLs for
+ existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false
+ if you want to generate file URLs without checking for their existence.
+*/
+SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const & rTheBaseURIRef,
+ OUString const & rTheRelURIRef,
+ Link<OUString *, bool> const & rMaybeFileHdl = Link<OUString *, bool>(),
+ bool bCheckFileExists = true,
+ bool bIgnoreFragment = false,
+ INetURLObject::EncodeMechanism eEncodeMechanism = INetURLObject::EncodeMechanism::WasEncoded,
+ INetURLObject::DecodeMechanism eDecodeMechanism = INetURLObject::DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ FSysStyle eStyle = FSysStyle::Detect);
+
+SVL_DLLPUBLIC void SetMaybeFileHdl(Link<OUString *, bool> const & rTheMaybeFileHdl);
+
+SVL_DLLPUBLIC Link<OUString *, bool> const & GetMaybeFileHdl();
+
+/**
+ Converts a URI reference to a relative one, ignoring certain differences (for
+ example, treating file URLs for case-ignoring file systems
+ case-insensitively).
+
+ @param context a component context; must not be null
+
+ @param baseUriReference a base URI reference
+
+ @param uriReference a URI reference
+
+ @return a URI reference representing the given uriReference relative to the
+ given baseUriReference; if the given baseUriReference is not an absolute,
+ hierarchical URI reference, or the given uriReference is not a valid URI
+ reference, null is returned
+
+ @exception std::bad_alloc if an out-of-memory condition occurs
+
+ @exception css::uno::RuntimeException if any error occurs
+ */
+SVL_DLLPUBLIC css::uno::Reference< css::uri::XUriReference >
+normalizedMakeRelative(
+ css::uno::Reference< css::uno::XComponentContext > const & context,
+ OUString const & baseUriReference,
+ OUString const & uriReference);
+
+/**
+ A variant of normalizedMakeRelative with a simplified interface.
+
+ Internally calls normalizedMakeRelative with the default component context.
+
+ @param baseUriReference a base URI reference, passed to
+ normalizedMakeRelative
+
+ @param uriReference a URI reference, passed to normalizedMakeRelative
+
+ @return if the XUriReference returned by normalizedMakeRelative is empty,
+ uriReference is returned unmodified; otherwise, the result of calling
+ XUriReference::getUriReference on the XUriReference returned by
+ normalizedMakeRelative is returned
+
+ @exception std::bad_alloc if an out-of-memory condition occurs
+
+ @exception css::uno::RuntimeException if any error occurs
+
+ @deprecated
+ No code should rely on the default component context.
+*/
+SVL_DLLPUBLIC OUString simpleNormalizedMakeRelative( OUString const & baseUriReference,
+ OUString const & uriReference);
+
+SVL_DLLPUBLIC OUString FindFirstURLInText(OUString const & rText,
+ sal_Int32 & rBegin,
+ sal_Int32 & rEnd,
+ CharClass const & rCharClass,
+ INetURLObject::EncodeMechanism eMechanism = INetURLObject::EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+/** Remove any password component from both absolute and relative URLs.
+
+ @ATT The current implementation will not remove a password from a
+ relative URL that has an authority component (e.g., the password is not
+ removed from the relative ftp URL <//user:password@domain/path>). But
+ since our functions to translate between absolute and relative URLs never
+ produce relative URLs with authority components, this is no real problem.
+
+ @ATT For relative URLs (or anything not recognized as an absolute URI),
+ the current implementation will return the input unmodified, not applying
+ any translations implied by the encode/decode parameters.
+
+ @param rURI An absolute or relative URI reference.
+
+ @param eEncodeMechanism See the general discussion for INetURLObject set-
+ methods.
+
+ @param eDecodeMechanism See the general discussion for INetURLObject get-
+ methods.
+
+ @param eCharset See the general discussion for INetURLObject get- and
+ set-methods.
+
+ @return The input URI with any password component removed.
+ */
+SVL_DLLPUBLIC OUString removePassword(OUString const & rURI,
+ INetURLObject::EncodeMechanism eEncodeMechanism,
+ INetURLObject::DecodeMechanism eDecodeMechanism = INetURLObject::DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+/** Resolve a URL's host component domain name in IDNA syntax to plain DNS
+ syntax.
+
+ For details, see RFC 5890 "Internationalized Domain Names for Applications
+ (IDNA): Definitions and Document Framework."
+
+ @param: url An arbitrary string, should be a URI.
+
+ @return If the input matches the syntax of a hierarchical URL, and it has
+ a host component that matches the IDNA2008 domain name syntax, and that
+ domain name contains any U-labels, return a version of the input URL with
+ the host component resolved to plain DNS syntax. Otherwise, return the
+ input unchanged.
+*/
+SVL_DLLPUBLIC OUString resolveIdnaHost(OUString const & url);
+
+}
+
+#endif // INCLUDED_SVL_URIHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/urlbmk.hxx b/include/svl/urlbmk.hxx
new file mode 100644
index 000000000..e2a090806
--- /dev/null
+++ b/include/svl/urlbmk.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_URLBMK_HXX
+#define INCLUDED_SVL_URLBMK_HXX
+
+#include <rtl/ustring.hxx>
+#include <utility>
+
+
+/**
+ * This class represents a bookmark that consists of a URL and
+ * a corresponding description text.
+ *
+ * There is an own clipboard format and helper methods to copy
+ * to and from clipboard and DragServer.
+ */
+class INetBookmark
+{
+ OUString aUrl;
+ OUString aDescr;
+
+public:
+ INetBookmark( OUString _aUrl, OUString _aDescr )
+ : aUrl(std::move( _aUrl )), aDescr(std::move( _aDescr ))
+ {}
+ INetBookmark()
+ {}
+
+ const OUString& GetURL() const { return aUrl; }
+ const OUString& GetDescription() const { return aDescr; }
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/visitem.hxx b/include/svl/visitem.hxx
new file mode 100644
index 000000000..4ae5cdd55
--- /dev/null
+++ b/include/svl/visitem.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_VISITEM_HXX
+#define INCLUDED_SVL_VISITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <com/sun/star/frame/status/Visibility.hpp>
+
+class SVL_DLLPUBLIC SfxVisibilityItem final : public SfxPoolItem
+{
+ css::frame::status::Visibility m_nValue;
+
+public:
+
+ explicit SfxVisibilityItem(sal_uInt16 which, bool bVisible):
+ SfxPoolItem(which)
+ {
+ m_nValue.bVisible = bVisible;
+ }
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+
+ virtual bool PutValue( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+
+ virtual SfxVisibilityItem* Clone(SfxItemPool * = nullptr) const override;
+
+ bool GetValue() const { return m_nValue.bVisible; }
+};
+
+#endif // INCLUDED_SVL_VISITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/whichranges.hxx b/include/svl/whichranges.hxx
new file mode 100644
index 000000000..744a0f2ed
--- /dev/null
+++ b/include/svl/whichranges.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <sal/config.h>
+#include <sal/types.h>
+#include <svl/svldllapi.h>
+#include <array>
+#include <memory>
+#include <cassert>
+
+typedef std::pair<sal_uInt16, sal_uInt16> WhichPair;
+
+namespace svl
+{
+namespace detail
+{
+constexpr bool validRange(sal_uInt16 wid1, sal_uInt16 wid2) { return wid1 != 0 && wid1 <= wid2; }
+
+constexpr bool validGap(sal_uInt16 wid1, sal_uInt16 wid2) { return wid2 > wid1; }
+
+template <sal_uInt16 WID1, sal_uInt16 WID2> constexpr bool validRanges()
+{
+ return validRange(WID1, WID2);
+}
+
+template <sal_uInt16 WID1, sal_uInt16 WID2, sal_uInt16 WID3, sal_uInt16... WIDs>
+constexpr bool validRanges()
+{
+ return validRange(WID1, WID2) && validGap(WID2, WID3) && validRanges<WID3, WIDs...>();
+}
+
+// The calculations in rangeSize cannot overflow, assuming
+// std::size_t is no smaller than sal_uInt16:
+constexpr std::size_t rangeSize(sal_uInt16 wid1, sal_uInt16 wid2)
+{
+ assert(validRange(wid1, wid2));
+ return wid2 - wid1 + 1;
+}
+}
+
+template <sal_uInt16... WIDs> struct Items_t
+{
+ using Array = std::array<WhichPair, sizeof...(WIDs) / 2>;
+ template <sal_uInt16 WID1, sal_uInt16 WID2, sal_uInt16... Rest>
+ static constexpr void fill(typename Array::iterator it)
+ {
+ it->first = WID1;
+ it->second = WID2;
+ if constexpr (sizeof...(Rest) > 0)
+ fill<Rest...>(++it);
+ }
+ static constexpr Array make()
+ {
+ assert(svl::detail::validRanges<WIDs...>());
+ Array a{};
+ fill<WIDs...>(a.begin());
+ return a;
+ }
+ // This is passed to WhichRangesContainer so we can avoid needing to malloc()
+ // for compile-time data.
+ static constexpr Array value = make();
+};
+
+template <sal_uInt16... WIDs> inline static constexpr auto Items = Items_t<WIDs...>{};
+}
+
+/**
+ * Most of the time, the which ranges we point at are a compile-time literal.
+ * So we take advantage of that, and avoid the cost of allocating our own array and copying into it.
+ */
+struct SVL_DLLPUBLIC WhichRangesContainer
+{
+ using const_iterator = WhichPair const*;
+
+ WhichPair const* m_pairs = nullptr;
+ sal_Int32 m_size = 0;
+ /** if true, we allocated and need to delete the pairs, if not, we are pointing
+ * at a global const literal */
+ bool m_bOwnRanges = false;
+
+ WhichRangesContainer() = default;
+
+ WhichRangesContainer(std::unique_ptr<WhichPair[]> wids, sal_Int32 nSize)
+ : m_pairs(wids.release())
+ , m_size(nSize)
+ , m_bOwnRanges(true)
+ {
+ }
+ template <sal_uInt16... WIDs>
+ WhichRangesContainer(svl::Items_t<WIDs...>)
+ : m_pairs(svl::Items_t<WIDs...>::value.data())
+ , m_size(svl::Items_t<WIDs...>::value.size())
+ , m_bOwnRanges(false)
+ {
+ }
+ WhichRangesContainer(const WhichPair* wids, sal_Int32 nSize);
+ WhichRangesContainer(sal_uInt16 nWhichStart, sal_uInt16 nWhichEnd);
+ WhichRangesContainer(WhichRangesContainer const& other) { operator=(other); }
+ WhichRangesContainer(WhichRangesContainer&& other);
+ ~WhichRangesContainer();
+
+ WhichRangesContainer& operator=(WhichRangesContainer&& other);
+ WhichRangesContainer& operator=(WhichRangesContainer const& other);
+
+ bool operator==(WhichRangesContainer const& other) const;
+ const_iterator begin() const noexcept { return m_pairs; }
+ const_iterator end() const noexcept { return begin() + size(); }
+ bool empty() const noexcept { return m_size == 0; }
+ sal_Int32 size() const noexcept { return m_size; }
+ WhichPair const& operator[](sal_Int32 idx) const noexcept
+ {
+ assert(idx >= 0 && idx < size() && "index out of range");
+ return m_pairs[idx];
+ }
+ void reset();
+
+ // Adds a range to which ranges, keeping the ranges in valid state (sorted, non-overlapping)
+ SAL_WARN_UNUSED_RESULT WhichRangesContainer MergeRange(sal_uInt16 nFrom, sal_uInt16 nTo) const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/svl/whiter.hxx b/include/svl/whiter.hxx
new file mode 100644
index 000000000..155d02d7f
--- /dev/null
+++ b/include/svl/whiter.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svl/svldllapi.h>
+#include <svl/whichranges.hxx>
+
+class SfxItemSet;
+class SfxPoolItem;
+enum class SfxItemState;
+
+/**
+ * Iterates over the which ids and the pool items arrays together (which are stored in parallel arrays).
+ * Primarily so that we can call GetItemSet on the SfxItemSet and pass in a hint, which avoids
+ * searching the array the SfxItemSet, which speeds up GetItemState greatly.
+ */
+class SVL_DLLPUBLIC SfxWhichIter
+{
+ const SfxItemSet& m_rItemSet;
+ const WhichPair* m_pCurrentWhichPair;
+ sal_uInt16 m_nOffsetFromStartOfCurrentWhichPair;
+ /// Offset into m_ppItems array in SfxItemSet
+ sal_uInt16 m_nItemsOffset;
+
+public:
+ SfxWhichIter(const SfxItemSet& rSet);
+
+ sal_uInt16 GetCurWhich() const;
+ sal_uInt16 NextWhich();
+ sal_uInt16 FirstWhich();
+ SfxItemState GetItemState(bool bSrchInParent = true,
+ const SfxPoolItem** ppItem = nullptr) const;
+ void ClearItem();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
new file mode 100644
index 000000000..4159ce0fb
--- /dev/null
+++ b/include/svl/zforlist.hxx
@@ -0,0 +1,381 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_ZFORLIST_HXX
+#define INCLUDED_SVL_ZFORLIST_HXX
+
+#include <config_options.h>
+#include <svl/svldllapi.h>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <i18nlangtag/lang.h>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <unotools/localedatawrapper.hxx>
+
+#include <map>
+#include <unordered_map>
+
+namespace com::sun::star::i18n { struct Currency; }
+
+class SvNumberformat;
+
+#define SV_COUNTRY_LANGUAGE_OFFSET 10000 // Max count of formats per country/language
+#define SV_MAX_COUNT_STANDARD_FORMATS 100 // Max count of builtin default formats per CL
+
+constexpr size_t NF_MAX_FORMAT_SYMBOLS = 100;
+
+/// The built-in @ Text format, offset within a locale, key in the locale the
+/// number formatter was constructed with.
+constexpr sal_uInt32 NF_STANDARD_FORMAT_TEXT = SV_MAX_COUNT_STANDARD_FORMATS;
+
+constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND = 0xffffffff; /// MAX_ULONG
+
+enum class SvNumFormatType : sal_Int16
+{
+ /** selects all number formats.
+ */
+ ALL = css::util::NumberFormat::ALL, // 0
+ /** selects only user-defined number formats.
+ */
+ DEFINED = css::util::NumberFormat::DEFINED, // 1
+ /** selects date formats.
+ */
+ DATE = css::util::NumberFormat::DATE, // 2
+ /** selects time formats.
+ */
+ TIME = css::util::NumberFormat::TIME, // 4
+ /** selects currency formats.
+ */
+ CURRENCY = css::util::NumberFormat::CURRENCY, // 8
+ /** selects decimal number formats.
+ */
+ NUMBER = css::util::NumberFormat::NUMBER, // 16
+ /** selects scientific number formats.
+ */
+ SCIENTIFIC = css::util::NumberFormat::SCIENTIFIC, // 32
+ /** selects number formats for fractions.
+ */
+ FRACTION = css::util::NumberFormat::FRACTION, // 64
+ /** selects percentage number formats.
+ */
+ PERCENT = css::util::NumberFormat::PERCENT, // 128
+ /** selects text number formats.
+ */
+ TEXT = css::util::NumberFormat::TEXT, // 256
+ /** selects number formats which contain date and time.
+ */
+ DATETIME = DATE | TIME, // 6
+ /** selects boolean number formats.
+ */
+ LOGICAL = css::util::NumberFormat::LOGICAL, // 1024
+ /** is used as a return value if no format exists.
+ */
+ UNDEFINED = css::util::NumberFormat::UNDEFINED, // 2048
+ /** @internal is used to flag an empty sub format.
+ @since LibreOffice 5.1
+ */
+ EMPTY = css::util::NumberFormat::EMPTY, // 4096
+ /** @internal selects a time duration format.
+ 8192 + TIME (4)
+ @since LibreOffice 6.2
+ */
+ DURATION = css::util::NumberFormat::DURATION, // 8196
+};
+namespace o3tl {
+ template<> struct typed_flags<SvNumFormatType> : is_typed_flags<SvNumFormatType, 0x3dff> {};
+}
+
+/** enum values for <method>SvNumberFormatter::GetFormatIndex</method>
+
+ <p>
+ Builtin standard formats, order should be also the arrangement in the
+ dialog list box representation.</p>
+
+ <p>
+ Date specials:<ul>
+ <li>SYSTEM: As set in System Regional Settings.
+ <li>SYS: short/long defined, order and separators from System Regional Settings.
+ <li>DEF: short/long and order defined, separators from System Regional Settings.
+ <li>DIN: all settings hard coded as DIN (Deutsche Industrie Norm) and EN (European Norm) require.
+ <li>all other: hard coded
+ </ul>
+
+ Do NOT insert any new values!
+ The values here correspond with those in offapi/com/sun/star/i18n/NumberFormatIndex.idl
+ You may append values though after NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS.
+ */
+enum NfIndexTableOffset
+{
+ NF_NUMERIC_START = 0,
+
+ NF_NUMBER_START = NF_NUMERIC_START,
+ NF_NUMBER_STANDARD = NF_NUMBER_START, // Standard/General
+ NF_NUMBER_INT, // 0
+ NF_NUMBER_DEC2, // 0.00
+ NF_NUMBER_1000INT, // #,##0
+ NF_NUMBER_1000DEC2, // #,##0.00
+ NF_NUMBER_SYSTEM, // #,##0.00 or whatever is set in System Regional Settings
+ NF_NUMBER_END = NF_NUMBER_SYSTEM,
+
+ NF_SCIENTIFIC_START,
+ NF_SCIENTIFIC_000E000 = NF_SCIENTIFIC_START, // 0.00E+000
+ NF_SCIENTIFIC_000E00, // 0.00E+00
+ NF_SCIENTIFIC_END = NF_SCIENTIFIC_000E00,
+
+ NF_PERCENT_START,
+ NF_PERCENT_INT = NF_PERCENT_START, // 0%
+ NF_PERCENT_DEC2, // 0.00%
+ NF_PERCENT_END = NF_PERCENT_DEC2,
+
+ NF_FRACTION_START,
+ NF_FRACTION_1D = NF_FRACTION_START, // # ?/?
+ NF_FRACTION_2D, // # ??/??
+ NF_FRACTION_END = NF_FRACTION_2D,
+
+ NF_NUMERIC_END = NF_FRACTION_END,
+
+ NF_CURRENCY_START,
+ NF_CURRENCY_1000INT = NF_CURRENCY_START,// #,##0 DM
+ NF_CURRENCY_1000DEC2, // #,##0.00 DM
+ NF_CURRENCY_1000INT_RED, // #,##0 DM negative in red
+ NF_CURRENCY_1000DEC2_RED, // #,##0.00 DM negative in red
+ NF_CURRENCY_1000DEC2_CCC, // #,##0.00 DEM currency abbreviation
+ NF_CURRENCY_1000DEC2_DASHED, // #,##0.-- DM
+ NF_CURRENCY_END = NF_CURRENCY_1000DEC2_DASHED,
+
+ NF_DATE_START,
+ NF_DATE_SYSTEM_SHORT = NF_DATE_START, // 08.10.97
+ NF_DATE_SYSTEM_LONG, // Wednesday, 8. October 1997
+ NF_DATE_SYS_DDMMYY, // 08.10.97
+ NF_DATE_SYS_DDMMYYYY, // 08.10.1997 THE edit format, formatindex="21"
+ NF_DATE_SYS_DMMMYY, // 8. Oct 97
+ NF_DATE_SYS_DMMMYYYY, // 8. Oct 1997
+ NF_DATE_DIN_DMMMYYYY, // 8. Oct. 1997 DIN
+ NF_DATE_SYS_DMMMMYYYY, // 8. October 1997
+ NF_DATE_DIN_DMMMMYYYY, // 8. October 1997 DIN
+ NF_DATE_SYS_NNDMMMYY, // Wed, 8. Okt 97
+ NF_DATE_DEF_NNDDMMMYY, // Wed 08.Okt 97
+ NF_DATE_SYS_NNDMMMMYYYY, // Wed, 8. Oktober 1997
+ NF_DATE_SYS_NNNNDMMMMYYYY, // Wednesday, 8. Oktober 1997
+ NF_DATE_DIN_MMDD, // 10-08 DIN
+ NF_DATE_DIN_YYMMDD, // 97-10-08 DIN
+ NF_DATE_DIN_YYYYMMDD, // 1997-10-08 DIN
+ NF_DATE_ISO_YYYYMMDD = NF_DATE_DIN_YYYYMMDD, // 1997-10-08 ISO clarify with name, formatindex="33"
+ NF_DATE_SYS_MMYY, // 10.97
+ NF_DATE_SYS_DDMMM, // 08.Oct
+ NF_DATE_MMMM, // October
+ NF_DATE_QQJJ, // 4. Quarter 97
+ NF_DATE_WW, // week of year
+ NF_DATE_END = NF_DATE_WW,
+
+ NF_TIME_START,
+ NF_TIME_HHMM = NF_TIME_START, // HH:MM
+ NF_TIME_HHMMSS, // HH:MM:SS
+ NF_TIME_HHMMAMPM, // HH:MM AM/PM
+ NF_TIME_HHMMSSAMPM, // HH:MM:SS AM/PM
+ NF_TIME_HH_MMSS, // [HH]:MM:SS formatindex="43"
+ NF_TIME_MMSS00, // MM:SS,00 formatindex="44"
+ NF_TIME_HH_MMSS00, // [HH]:MM:SS,00 formatindex="45"
+ NF_TIME_END = NF_TIME_HH_MMSS00,
+
+ NF_DATETIME_START,
+ NF_DATETIME_SYSTEM_SHORT_HHMM = NF_DATETIME_START, // 08.10.97 01:23
+ NF_DATETIME_SYS_DDMMYYYY_HHMMSS, // 08.10.1997 01:23:45 THE edit format, formatindex="47"
+ NF_DATETIME_END = NF_DATETIME_SYS_DDMMYYYY_HHMMSS,
+
+ NF_BOOLEAN, // BOOLEAN
+ NF_TEXT, // @
+
+ NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS, // == 50, old number of predefined entries, i18npool locale data additions start after this
+
+ // From here on are values of new predefined and built-in formats that are
+ // not in the original NumberFormatIndex.idl
+
+ // XXX Values appended here must also get a corresponding entry in
+ // svl/source/numbers/zforlist.cxx indexTable[] in the same order.
+
+ // XXX The dialog's number format shell assumes start/end spans
+ // (NF_..._START and NF_..._END above) to fill its categories with builtin
+ // formats, make new formats known to svx/source/items/numfmtsh.cxx
+ // SvxNumberFormatShell::FillEListWithStd_Impl(), otherwise they will not
+ // be listed at all. Yes that is ugly.
+ // DATETIME formats need to be added to
+ // SvxNumberFormatShell::FillEListWithDateTime_Impl().
+
+ // New predefined format added to i18npool locale data.
+ NF_DATETIME_SYS_DDMMYYYY_HHMM = NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS, // 08.10.1997 01:23 formatindex="50"
+
+ // No i18npool defined locale data between here and NF_INDEX_TABLE_ENTRIES.
+ NF_INDEX_TABLE_RESERVED_START,
+
+ NF_FRACTION_3D = NF_INDEX_TABLE_RESERVED_START, // # ???/???
+ NF_FRACTION_2, // # ?/2
+ NF_FRACTION_4, // # ?/4
+ NF_FRACTION_8, // # ?/8
+ NF_FRACTION_16, // # ??/16
+ NF_FRACTION_10, // # ??/10
+ NF_FRACTION_100, // # ??/100
+
+ NF_DATETIME_ISO_YYYYMMDD_HHMMSS, // 1997-10-08 01:23:45 ISO (with blank instead of T)
+ NF_DATETIME_ISO_YYYYMMDD_HHMMSS000, // 1997-10-08 01:23:45.678 not quite ISO with locale's separator
+ NF_DATETIME_ISO_YYYYMMDDTHHMMSS, // 1997-10-08T01:23:45 ISO
+ NF_DATETIME_ISO_YYYYMMDDTHHMMSS000, // 1997-10-08T01:23:45,678 ISO with milliseconds and ',' or '.'
+
+ // XXX When adding values here, follow the comment above about
+ // svx/source/items/numfmtsh.cxx
+
+ NF_INDEX_TABLE_ENTRIES // == 62, reserved to not be used in i18npool locale data.
+
+ // XXX Adding values above may increment the reserved area that can't be
+ // used by i18npool's locale data FormatCode definitions, see the
+ // description at i18npool/source/localedata/data/locale.dtd for ELEMENT
+ // FormatCode what the current convention's value is. In that case, the
+ // used formatIndex values in i18npool/source/localedata/data/*.xml will
+ // have to be adjusted.
+ // Overlapping the area will bail out with a check in
+ // SvNumberFormatter::ImpInsertFormat() in debug builds.
+};
+
+
+// #45717# IsNumberFormat( "98-10-24", 30, x ), YMD Format set with DMY
+// International settings doesn't recognize the string as a date.
+/** enum values for <method>SvNumberFormatter::SetEvalDateFormat</method>
+
+ <p>How <method>ImpSvNumberInputScan::GetDateRef</method> shall take the
+ DateFormat order (YMD,DMY,MDY) into account, if called from IsNumberFormat
+ with a date format to match against.
+ */
+enum NfEvalDateFormat
+{
+ /** DateFormat only from International, default. */
+ NF_EVALDATEFORMAT_INTL,
+
+ /** DateFormat only from date format passed to function (if any).
+ If no date format is passed then the DateFormat is taken from International. */
+ NF_EVALDATEFORMAT_FORMAT,
+
+ /** First try the DateFormat from International. If it doesn't match a
+ valid date try the DateFormat from the date format passed. */
+ NF_EVALDATEFORMAT_INTL_FORMAT,
+
+ /** First try the DateFormat from the date format passed. If it doesn't
+ match a valid date try the DateFormat from International. */
+ NF_EVALDATEFORMAT_FORMAT_INTL
+};
+
+
+/// This table is std::map because it needs to preserve insertion order,
+/// because the formats are roughly ordered from most to least common, and some
+/// parts of the UI want to show them in that order.
+typedef std::map<sal_uInt32, SvNumberformat*> SvNumberFormatTable;
+typedef std::unordered_map<sal_uInt16, sal_uInt32> SvNumberFormatterIndexTable;
+typedef std::unordered_map< sal_uInt32, sal_uInt32> SvNumberFormatterMergeMap;
+
+
+/** Language/country dependent currency entries
+ */
+class UNLESS_MERGELIBS(SVL_DLLPUBLIC) NfCurrencyEntry final
+{
+ OUString aSymbol; /// currency symbol
+ OUString aBankSymbol; /// currency abbreviation
+ LanguageType eLanguage; /// language/country value
+ sal_uInt16 nPositiveFormat; /// position of symbol
+ sal_uInt16 nNegativeFormat; /// position of symbol and type and position of negative sign
+ sal_uInt16 nDigits; /// count of decimal digits
+ sal_Unicode cZeroChar; /// which character is used for zeros as last decimal digits
+
+private:
+
+ // nDecimalFormat := 0, 1, 2
+ // #,##0 or #,##0.00 or #,##0.-- is returned
+ SVL_DLLPRIVATE OUString Impl_BuildFormatStringNumChars( const LocaleDataWrapper&, sal_uInt16 nDecimalFormat) const;
+
+public:
+
+ NfCurrencyEntry( const LocaleDataWrapper& rLocaleData,
+ LanguageType eLang );
+ NfCurrencyEntry( const css::i18n::Currency & rCurr,
+ const LocaleDataWrapper& rLocaleData,
+ LanguageType eLang );
+
+ /// Symbols and language identical
+ bool operator==( const NfCurrencyEntry& r ) const;
+
+ const OUString& GetSymbol() const { return aSymbol; }
+ const OUString& GetBankSymbol() const { return aBankSymbol; }
+ LanguageType GetLanguage() const { return eLanguage; }
+ sal_uInt16 GetPositiveFormat() const { return nPositiveFormat; }
+ sal_uInt16 GetNegativeFormat() const { return nNegativeFormat; }
+ sal_uInt16 GetDigits() const { return nDigits; }
+
+ /** Only to resolve system locale for currency list. */
+ void SetLanguage( LanguageType nLang ) { eLanguage = nLang; }
+
+ /** [$DM-407] (bBank==false) or [$DEM] (bBank==true)
+ is returned. If bBank==false and
+ bWithoutExtension==true only [$DM] */
+ OUString BuildSymbolString(bool bBank, bool bWithoutExtension = false) const;
+
+ /** #,##0.00 [$DM-407] is returned, separators
+ from rLoc, incl. minus sign but without [RED] */
+ OUString BuildPositiveFormatString(bool bBank, const LocaleDataWrapper&,
+ sal_uInt16 nDecimalFormat = 1) const;
+ OUString BuildNegativeFormatString(bool bBank, const LocaleDataWrapper&,
+ sal_uInt16 nDecimalFormat = 1) const;
+
+ /** [$DM-407] (or [$DEM] if bBank==true)
+ is appended/prepended to rStr, incl. minus sign */
+ void CompletePositiveFormatString(OUStringBuffer& rStr, bool bBank,
+ sal_uInt16 nPosiFormat) const;
+ void CompleteNegativeFormatString(OUStringBuffer& rStr, bool bBank,
+ sal_uInt16 nNegaFormat) const;
+
+ /// rSymStr is appended/prepended to rStr, incl. minus sign
+ static void CompletePositiveFormatString(OUStringBuffer& rStr,
+ std::u16string_view rSymStr, sal_uInt16 nPosiFormat);
+ static void CompleteNegativeFormatString(OUStringBuffer& rStr,
+ std::u16string_view rSymStr, sal_uInt16 nNegaFormat);
+
+ /** Representation of a currency (symbol position and
+ negative sign) in other language settings */
+ static sal_uInt16 GetEffectivePositiveFormat( sal_uInt16 nIntlFormat,
+ sal_uInt16 nCurrFormat, bool bBank );
+ static sal_uInt16 GetEffectiveNegativeFormat( sal_uInt16 nIntlFormat,
+ sal_uInt16 nCurrFormat, bool bBank );
+
+ /// General Unicode Euro symbol
+ static sal_Unicode GetEuroSymbol() { return u'\x20AC'; }
+};
+
+typedef std::vector< OUString > NfWSStringsDtor;
+
+/** Input options to be used with IsNumberFormat() */
+enum class SvNumInputOptions : sal_uInt16
+{
+ NONE = 0,
+ LAX_TIME = 1 ///< allow input of minutes or seconds >59
+};
+namespace o3tl {
+ template<> struct typed_flags<SvNumInputOptions> : is_typed_flags<SvNumInputOptions, 0x0001> {};
+}
+
+
+#endif // INCLUDED_SVL_ZFORLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
new file mode 100644
index 000000000..ae57f5c86
--- /dev/null
+++ b/include/svl/zformat.hxx
@@ -0,0 +1,760 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVL_ZFORMAT_HXX
+#define INCLUDED_SVL_ZFORMAT_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/zforlist.hxx>
+#include <svl/nfkeytab.hxx>
+#include <vector>
+
+namespace utl {
+ class DigitGroupingIterator;
+}
+
+namespace com::sun::star::i18n { struct NativeNumberXmlAttributes2; }
+
+class Color;
+
+class ImpSvNumberformatScan; // format code string scanner
+class ImpSvNumberInputScan; // input string scanner
+class SvNumberFormatter;
+
+enum SvNumberformatLimitOps
+{
+ NUMBERFORMAT_OP_NO = 0, // Undefined, no OP
+ NUMBERFORMAT_OP_EQ = 1, // Operator =
+ NUMBERFORMAT_OP_NE = 2, // Operator <>
+ NUMBERFORMAT_OP_LT = 3, // Operator <
+ NUMBERFORMAT_OP_LE = 4, // Operator <=
+ NUMBERFORMAT_OP_GT = 5, // Operator >
+ NUMBERFORMAT_OP_GE = 6 // Operator >=
+};
+
+struct ImpSvNumberformatInfo // Struct for FormatInfo
+{
+ std::vector<OUString> sStrArray; // Array of symbols
+ std::vector<short> nTypeArray; // Array of infos
+ sal_uInt16 nThousand; // Count of group separator sequences
+ sal_uInt16 nCntPre; // Count of digits before decimal point
+ sal_uInt16 nCntPost; // Count of digits after decimal point
+ sal_uInt16 nCntExp; // Count of exponent digits, or AM/PM
+ SvNumFormatType eScannedType; // Type determined by scan
+ bool bThousand; // Has group (AKA thousand) separator
+
+ void Copy( const ImpSvNumberformatInfo& rNumFor, sal_uInt16 nCount );
+};
+
+// NativeNumber, represent numbers using CJK or other digits if nNum>0,
+// eLang specifies the Locale to use.
+class SvNumberNatNum
+{
+ OUString sParams; // For [NatNum12 ordinal-number]-like syntax
+ LanguageType eLang;
+ sal_uInt8 nNum;
+ bool bDBNum :1; // DBNum, to be converted to NatNum
+ bool bDate :1; // Used in date? (needed for DBNum/NatNum mapping)
+ bool bSet :1; // If set, since NatNum0 is possible
+
+public:
+
+ static sal_uInt8 MapDBNumToNatNum( sal_uInt8 nDBNum, LanguageType eLang, bool bDate );
+ static sal_uInt8 MapNatNumToDBNum( sal_uInt8 nNatNum, LanguageType eLang, bool bDate );
+
+ SvNumberNatNum() : eLang( LANGUAGE_DONTKNOW ), nNum(0),
+ bDBNum(false), bDate(false), bSet(false) {}
+ bool IsComplete() const { return bSet && eLang != LANGUAGE_DONTKNOW; }
+ sal_uInt8 GetNatNum() const { return bDBNum ? MapDBNumToNatNum( nNum, eLang, bDate ) : nNum; }
+ sal_uInt8 GetDBNum() const { return bDBNum ? nNum : MapNatNumToDBNum( nNum, eLang, bDate ); }
+ LanguageType GetLang() const { return eLang; }
+ void SetLang( LanguageType e ) { eLang = e; }
+ void SetNum( sal_uInt8 nNumber, bool bDBNumber )
+ {
+ nNum = nNumber;
+ bDBNum = bDBNumber;
+ bSet = true;
+ }
+ bool IsSet() const { return bSet; }
+ void SetDate( bool bDateP ) { bDate = bDateP; }
+ void SetParams(const OUString& s) { sParams = s; }
+ OUString const & GetParams() const { return sParams; }
+};
+
+class CharClass;
+
+class ImpSvNumFor // One of four subformats of the format code string
+{
+public:
+ ImpSvNumFor(); // Ctor without filling the Info
+ ~ImpSvNumFor();
+
+ void Enlarge(sal_uInt16 nCount); // Init of arrays to the right size
+
+ // if pSc is set, it is used to get the Color pointer
+ void Copy( const ImpSvNumFor& rNumFor, const ImpSvNumberformatScan* pSc );
+
+ // Access to Info; call Enlarge before!
+ ImpSvNumberformatInfo& Info() { return aI;}
+ const ImpSvNumberformatInfo& Info() const { return aI; }
+
+ // Get count of substrings (symbols)
+ sal_uInt16 GetCount() const { return nStringsCnt;}
+
+ const Color* GetColor() const { return pColor; }
+ void SetColor(const Color* pCol, OUString const& rName)
+ { pColor = pCol; sColorName = rName; }
+ const OUString& GetColorName() const { return sColorName; }
+
+ // new SYMBOLTYPE_CURRENCY in subformat?
+ bool HasNewCurrency() const;
+ bool GetNewCurrencySymbol( OUString& rSymbol, OUString& rExtension ) const;
+
+ // [NatNum1], [NatNum2], ...
+ void SetNatNumNum( sal_uInt8 nNum, bool bDBNum ) { aNatNum.SetNum( nNum, bDBNum ); }
+ void SetNatNumLang( LanguageType eLang ) { aNatNum.SetLang( eLang ); }
+ void SetNatNumDate( bool bDate ) { aNatNum.SetDate( bDate ); }
+ void SetNatNumParams(const OUString& sParams) { aNatNum.SetParams(sParams); }
+ const SvNumberNatNum& GetNatNum() const { return aNatNum; }
+
+private:
+ ImpSvNumberformatInfo aI; // helper struct for remaining information
+ OUString sColorName; // color name
+ const Color* pColor; // pointer to color of subformat
+ sal_uInt16 nStringsCnt; // count of symbols
+ SvNumberNatNum aNatNum; // DoubleByteNumber
+
+};
+
+class SVL_DLLPUBLIC SvNumberformat
+{
+ struct SAL_DLLPRIVATE LocaleType
+ {
+ enum class Substitute : sal_uInt8
+ {
+ NONE,
+ TIME,
+ LONGDATE
+ };
+
+ LanguageType meLanguage;
+ LanguageType meLanguageWithoutLocaleData;
+ Substitute meSubstitute;
+ sal_uInt8 mnNumeralShape;
+ sal_uInt8 mnCalendarType;
+
+ OUString generateCode() const;
+
+ LocaleType();
+ LocaleType(sal_uInt32 nRawCode);
+
+ bool isPlainLocale() const;
+ };
+
+public:
+ // Normal ctor
+ SvNumberformat( OUString& rString,
+ ImpSvNumberformatScan* pSc,
+ ImpSvNumberInputScan* pISc,
+ sal_Int32& nCheckPos,
+ LanguageType& eLan,
+ bool bReplaceBooleanEquivalent = true );
+
+ // Copy ctor
+ SvNumberformat( SvNumberformat const & rFormat );
+
+ // Copy ctor with exchange of format code string scanner (used in merge)
+ SvNumberformat( SvNumberformat const & rFormat, ImpSvNumberformatScan& rSc );
+
+ ~SvNumberformat();
+
+ /// Get type of format, may include css::util::NumberFormat::DEFINED bit
+ SvNumFormatType GetType() const { return eType; }
+
+ /// Get type of format, does not include css::util::NumberFormat::DEFINED
+ SvNumFormatType GetMaskedType() const { return eType & ~SvNumFormatType::DEFINED; }
+
+ void SetType(SvNumFormatType eSetType) { eType = eSetType; }
+ // Standard means the I18N defined standard format of this type
+ void SetStandard() { bStandard = true; }
+ bool IsStandard() const { return bStandard; }
+
+ // If this format is an additional built-in format defined by i18n.
+ void SetAdditionalBuiltin() { bAdditionalBuiltin = true; }
+ bool IsAdditionalBuiltin() const { return bAdditionalBuiltin; }
+
+ LanguageType GetLanguage() const { return maLocale.meLanguage;}
+
+ /** If the format is a placeholder and needs to be substituted. */
+ bool IsSubstituted() const
+ {
+ return maLocale.meSubstitute != LocaleType::Substitute::NONE;
+ }
+
+ /** If the format is a placeholder for the system time format and needs to
+ be substituted during formatting time.
+ */
+ bool IsSystemTimeFormat() const
+ {
+ return maLocale.meSubstitute == LocaleType::Substitute::TIME && maLocale.meLanguage == LANGUAGE_SYSTEM;
+ }
+
+ /** If the format is a placeholder for the system long date format and needs
+ to be substituted during formatting time.
+ */
+ bool IsSystemLongDateFormat() const
+ {
+ return maLocale.meSubstitute == LocaleType::Substitute::LONGDATE && maLocale.meLanguage == LANGUAGE_SYSTEM;
+ }
+
+ /** If the format is a MM:SS or [MM]:SS format, or MM:[SS] (sic!) or even
+ MM:SS.00 or [MM]:SS.00 or MM:[SS].00
+ */
+ bool IsMinuteSecondFormat() const;
+
+ const OUString& GetFormatstring() const { return sFormatstring; }
+
+ // Build a format string of application defined keywords
+ OUString GetMappedFormatstring( const NfKeywordTable& rKeywords,
+ const LocaleDataWrapper& rLoc,
+ LanguageType nOriginalLang = LANGUAGE_DONTKNOW,
+ bool bSystemLanguage = false ) const;
+
+ void SetStarFormatSupport( bool b ) { bStarFlag = b; }
+
+ /**
+ * Get output string from a numeric value that fits the number of
+ * characters specified.
+ */
+ bool GetOutputString( double fNumber, sal_uInt16 nCharCount, OUString& rOutString ) const;
+
+ bool GetOutputString( double fNumber, OUString& OutString, const Color** ppColor );
+ void GetOutputString( std::u16string_view sString, OUString& OutString, const Color** ppColor );
+
+ // True if type text
+ bool IsTextFormat() const { return bool(eType & SvNumFormatType::TEXT); }
+ // True if 4th subformat present
+ bool HasTextFormat() const
+ {
+ return (NumFor[3].GetCount() > 0) ||
+ (NumFor[3].Info().eScannedType == SvNumFormatType::TEXT);
+ }
+
+ void GetFormatSpecialInfo(bool& bThousand,
+ bool& IsRed,
+ sal_uInt16& nPrecision,
+ sal_uInt16& nLeadingCnt) const;
+
+ /// Get index of subformat (0..3) according to conditions and fNumber value
+ sal_uInt16 GetSubformatIndex( double fNumber ) const;
+
+ /// Count of decimal precision
+ sal_uInt16 GetFormatPrecision( sal_uInt16 nIx = 0 ) const
+ { return NumFor[nIx].Info().nCntPost; }
+
+ /// Count of integer digits
+ sal_uInt16 GetFormatIntegerDigits( sal_uInt16 nIx = 0 ) const
+ { return NumFor[nIx].Info().nCntPre; }
+
+ /** Count of hidden integer digits with thousands divisor:
+ formats like "0," to show only thousands.
+
+ Works only with SvNumFormatType::NUMBER and SvNumFormatType::CURRENCY,
+ returns 0 otherwise.
+
+ Returns SvNumberFormatter::UNLIMITED_PRECISION for formats that contain
+ the General keyword.
+ */
+ sal_uInt16 GetThousandDivisorPrecision( sal_uInt16 nIx = 0 ) const;
+
+ //! Read/write access on a special sal_uInt16 component, may only be used on the
+ //! standard format 0, 10000, ... and only by the number formatter!
+ struct FormatterPrivateAccess { friend SvNumberFormatter; private: FormatterPrivateAccess() {} };
+ sal_uInt16 GetLastInsertKey( const FormatterPrivateAccess& ) const
+ { return NumFor[0].Info().nThousand; }
+ void SetLastInsertKey( sal_uInt16 nKey, const FormatterPrivateAccess& )
+ { NumFor[0].Info().nThousand = nKey; }
+
+ //! Only onLoad: convert from stored to current system language/country
+ void ConvertLanguage( SvNumberFormatter& rConverter,
+ LanguageType eConvertFrom, LanguageType eConvertTo );
+
+ // Substring of a subformat code nNumFor (0..3)
+ // nPos == 0xFFFF => last substring
+ // bString==true: first/last SYMBOLTYPE_STRING or SYMBOLTYPE_CURRENCY
+ const OUString* GetNumForString( sal_uInt16 nNumFor, sal_uInt16 nPos,
+ bool bString = false ) const;
+
+ // Subtype of a subformat code nNumFor (0..3)
+ // nPos == 0xFFFF => last substring
+ short GetNumForType( sal_uInt16 nNumFor, sal_uInt16 nPos ) const;
+
+ OUString GetPercentString( sal_uInt16 nNumFor = 0 ) const;
+
+ OUString GetDenominatorString( sal_uInt16 nNumFor ) const;
+ OUString GetNumeratorString( sal_uInt16 nNumFor ) const;
+ OUString GetIntegerFractionDelimiterString( sal_uInt16 nNumFor ) const;
+ /// Round fNumber to its fraction representation
+ double GetRoundFractionValue ( double fNumber ) const;
+
+ /// Create a format string for time with a new precision
+ OUString GetFormatStringForTimePrecision( int nPrecision ) const;
+
+
+ /** If the count of string elements (substrings, ignoring [modifiers] and
+ so on) in a subformat code nNumFor (0..3) is equal to the given number.
+ Used by ImpSvNumberInputScan::IsNumberFormatMain() to detect a matched
+ format. */
+ bool IsNumForStringElementCountEqual( sal_uInt16 nNumFor, sal_uInt16 nAllCount,
+ sal_uInt16 nNumCount ) const
+ {
+ if ( nNumFor < 4 )
+ {
+ // First try a simple approach. Note that this is called only
+ // if all MidStrings did match so far, to verify that all
+ // strings of the format were matched and not just the starting
+ // sequence, so we don't have to check if GetCount() includes
+ // [modifiers] or anything else if both counts are equal.
+ sal_uInt16 nCnt = NumFor[nNumFor].GetCount();
+ if ( nAllCount == nCnt )
+ return true;
+ if ( nAllCount < nCnt ) // check ignoring [modifiers] and so on
+ return ImpGetNumForStringElementCount( nNumFor ) ==
+ (nAllCount - nNumCount);
+ }
+ return false;
+ }
+ /** Get the count of numbers among string elements **/
+ sal_uInt16 GetNumForNumberElementCount( sal_uInt16 nNumFor ) const;
+
+ /** Get the scanned type of the specified subformat. */
+ SvNumFormatType GetNumForInfoScannedType( sal_uInt16 nNumFor ) const
+ {
+ return (nNumFor < 4) ? NumFor[nNumFor].Info().eScannedType : SvNumFormatType::UNDEFINED;
+ }
+
+ // Whether the second subformat code is really for negative numbers
+ // or another limit set.
+ bool IsSecondSubformatRealNegative() const
+ {
+ return fLimit1 == 0.0 && fLimit2 == 0.0 &&
+ ( (eOp1 == NUMBERFORMAT_OP_GE && eOp2 == NUMBERFORMAT_OP_NO) ||
+ (eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_LT) ||
+ (eOp1 == NUMBERFORMAT_OP_NO && eOp2 == NUMBERFORMAT_OP_NO) );
+ }
+
+ // Whether the first subformat code is really for negative numbers
+ // or another limit set.
+ bool IsFirstSubformatRealNegative() const
+ {
+ return fLimit1 == 0.0 && fLimit2 == 0.0 &&
+ ((eOp1 == NUMBERFORMAT_OP_LT &&
+ (eOp2 == NUMBERFORMAT_OP_GT || eOp2 == NUMBERFORMAT_OP_EQ ||
+ eOp2 == NUMBERFORMAT_OP_GE || eOp2 == NUMBERFORMAT_OP_NO)) ||
+ (eOp1 == NUMBERFORMAT_OP_LE &&
+ (eOp2 == NUMBERFORMAT_OP_NO || eOp2 == NUMBERFORMAT_OP_GT)));
+ }
+
+ // Whether the negative format is without a sign or not
+ bool IsNegativeWithoutSign() const;
+
+ bool IsNegativeInBracket() const;
+
+ bool HasPositiveBracketPlaceholder() const;
+
+ // Whether a new SYMBOLTYPE_CURRENCY is contained in the format
+ bool HasNewCurrency() const;
+
+ // strip [$-yyy] from all [$xxx-yyy] leaving only xxx's,
+ static OUString StripNewCurrencyDelimiters( const OUString& rStr );
+
+ // If a new SYMBOLTYPE_CURRENCY is contained if the format is of type
+ // css::util::NumberFormat::CURRENCY, and if so the symbol xxx and the extension nnn
+ // of [$xxx-nnn] are returned
+ bool GetNewCurrencySymbol( OUString& rSymbol, OUString& rExtension ) const;
+
+ static bool HasStringNegativeSign( const OUString& rStr );
+
+ /**
+ Whether a character at position nPos is somewhere between two matching
+ cQuote or not.
+ If nPos points to a cQuote, a true is returned on an opening cQuote,
+ a false is returned on a closing cQuote.
+ A cQuote between quotes may be escaped by a cEscIn, a cQuote outside of
+ quotes may be escaped by a cEscOut.
+ The default '\0' results in no escapement possible.
+ Defaults are set right according to the "unlogic" of the Numberformatter
+ */
+ static bool IsInQuote( const OUString& rString, sal_Int32 nPos,
+ sal_Unicode cQuote = '"',
+ sal_Unicode cEscIn = '\0', sal_Unicode cEscOut = '\\' );
+
+ /**
+ Return the position of a matching closing cQuote if the character at
+ position nPos is between two matching cQuote, otherwise return -1.
+ If nPos points to an opening cQuote the position of the matching
+ closing cQuote is returned.
+ If nPos points to a closing cQuote nPos is returned.
+ If nPos points into a part which starts with an opening cQuote but has
+ no closing cQuote, rString.Len() is returned.
+ Uses <method>IsInQuote</method> internally, so you don't have to call
+ that prior to a call of this method.
+ */
+ static sal_Int32 GetQuoteEnd( const OUString& rString, sal_Int32 nPos,
+ sal_Unicode cQuote = '"',
+ sal_Unicode cEscIn = '\0' );
+
+ void SetComment( const OUString& rStr )
+ { sComment = rStr; }
+ const OUString& GetComment() const { return sComment; }
+
+ /** Insert the number of blanks into the string that is needed to simulate
+ the width of character c for underscore formats */
+ static sal_Int32 InsertBlanks( OUString& r, sal_Int32 nPos, sal_Unicode c )
+ {
+ sal_Int32 result;
+ OUStringBuffer sBuff(r);
+
+ result = InsertBlanks(sBuff, nPos, c);
+ r = sBuff.makeStringAndClear();
+
+ return result;
+ }
+
+ /** Insert the number of blanks into the string that is needed to simulate
+ the width of character c for underscore formats */
+ static sal_Int32 InsertBlanks( OUStringBuffer& r, sal_Int32 nPos, sal_Unicode c );
+
+ /// One of YMD,DMY,MDY if date format
+ DateOrder GetDateOrder() const;
+
+ /** A coded value of the exact YMD combination used, if date format.
+ For example: YYYY-MM-DD => ('Y' << 16) | ('M' << 8) | 'D'
+ or: MM/YY => ('M' << 8) | 'Y' */
+ sal_uInt32 GetExactDateOrder() const;
+
+ // used in XML export
+ void GetConditions( SvNumberformatLimitOps& rOper1, double& rVal1,
+ SvNumberformatLimitOps& rOper2, double& rVal2 ) const;
+ const Color* GetColor( sal_uInt16 nNumFor ) const;
+ void GetNumForInfo( sal_uInt16 nNumFor, SvNumFormatType& rScannedType,
+ bool& bThousand, sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt ) const;
+
+ // rAttr.Number not empty if NatNum attributes are to be stored
+ void GetNatNumXml(
+ css::i18n::NativeNumberXmlAttributes2& rAttr,
+ sal_uInt16 nNumFor ) const;
+
+ /** Switches to the first non-"gregorian" calendar, but only if the current
+ calendar is "gregorian"; original calendar name and date/time returned,
+ but only if calendar switched and rOrgCalendar was empty. */
+ void SwitchToOtherCalendar( OUString& rOrgCalendar, double& fOrgDateTime ) const;
+
+ /** Switches to the "gregorian" calendar, but only if the current calendar
+ is non-"gregorian" and rOrgCalendar is not empty. Thus a preceding
+ ImpSwitchToOtherCalendar() call should have been placed prior to
+ calling this method. */
+ void SwitchToGregorianCalendar( const OUString& rOrgCalendar, double fOrgDateTime ) const;
+
+#ifdef THE_FUTURE
+ /** Switches to the first specified calendar, if any, in subformat nNumFor
+ (0..3). Original calendar name and date/time returned, but only if
+ calendar switched and rOrgCalendar was empty.
+
+ @return
+ <TRUE/> if a calendar was specified and switched to,
+ <FALSE/> else.
+ */
+ bool SwitchToSpecifiedCalendar( OUString& rOrgCalendar, double& fOrgDateTime,
+ sal_uInt16 nNumFor ) const
+ {
+ if ( nNumFor < 4 )
+ return ImpSwitchToSpecifiedCalendar( rOrgCalendar,
+ fOrgDateTime, NumFor[nNumFor] );
+ return false;
+ }
+#endif
+
+ /// Whether it's a (YY)YY-M(M)-D(D) format.
+ bool IsIso8601( sal_uInt16 nNumFor ) const
+ {
+ if ( nNumFor < 4 )
+ return ImpIsIso8601( NumFor[nNumFor]);
+ return false;
+ }
+
+private:
+ ImpSvNumFor NumFor[4]; // Array for the 4 subformats
+ OUString sFormatstring; // The format code string
+ OUString sComment; // Comment, since number formatter version 6
+ double fLimit1; // Value for first condition
+ double fLimit2; // Value for second condition
+ ImpSvNumberformatScan& rScan; // Format code scanner
+ LocaleType maLocale; // Language/country of the format, numeral shape and calendar type from Excel.
+ SvNumberformatLimitOps eOp1; // Operator for first condition
+ SvNumberformatLimitOps eOp2; // Operator for second condition
+ SvNumFormatType eType; // Type of format
+ bool bAdditionalBuiltin; // If this is an additional built-in format defined by i18n
+ bool bStarFlag; // Take *n format as ESC n
+ bool bStandard; // If this is a default standard format
+ bool bIsUsed; // Flag as used for storing
+
+ SVL_DLLPRIVATE sal_uInt16 ImpGetNumForStringElementCount( sal_uInt16 nNumFor ) const;
+
+ SVL_DLLPRIVATE bool ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const;
+
+#ifdef THE_FUTURE
+ SVL_DLLPRIVATE bool ImpSwitchToSpecifiedCalendar( OUString& rOrgCalendar,
+ double& fOrgDateTime,
+ const ImpSvNumFor& rNumFor ) const;
+#endif
+
+ /** Whether to use possessive genitive case month name, or partitive case
+ month name, instead of nominative name (noun).
+
+ @param io_nState
+ 0: execute check <br>
+ set to 1 if nominative case is returned, <br>
+ set to 2 if genitive case is returned, <br>
+ set to 3 if partitive case is returned <br>
+ 1: don't execute check, return nominative case <br>
+ 2: don't execute check, return genitive case <br>
+ 3: don't execute check, return partitive case <br>
+
+ @param eCodeType
+ a NfKeywordIndex, must designate a month type code
+
+ @returns one of css::i18n::CalendarDisplayCode values
+ according to eCodeType and the check executed (or passed).
+ */
+ SVL_DLLPRIVATE static sal_Int32 ImpUseMonthCase( int & io_nState, const ImpSvNumFor& rNumFor, NfKeywordIndex eCodeType );
+
+ /// Whether it's a (YY)YY-M(M)-D(D) format.
+ SVL_DLLPRIVATE bool ImpIsIso8601( const ImpSvNumFor& rNumFor ) const;
+
+ const CharClass& rChrCls() const;
+ const LocaleDataWrapper& rLoc() const;
+ CalendarWrapper& GetCal() const;
+ const SvNumberFormatter& GetFormatter() const;
+
+ // divide in substrings and color conditions
+ SVL_DLLPRIVATE short ImpNextSymbol( OUStringBuffer& rString,
+ sal_Int32& nPos,
+ OUString& sSymbol ) const;
+
+ // read string until ']' and strip blanks (after condition)
+ SVL_DLLPRIVATE static sal_Int32 ImpGetNumber( OUStringBuffer& rString,
+ sal_Int32& nPos,
+ OUString& sSymbol );
+
+ /**
+ * Parse the content of '[$-xxx] or '[$-xxxxxxxx]' and extract the locale
+ * type from it. Given the string, start parsing at position specified by
+ * nPos, and store the end position with nPos when the parsing is
+ * complete. The nPos should point to the '$' before the parsing, and to
+ * the closing bracket after the parsing. When the content is [$-xxx],
+ * the xxx part represents the language type (aka LCID) in hex numerals.
+ * When the content is [$-xxxxxxxx] the last 4 digits represent the LCID
+ * (again in hex), the next 2 digits represent the calendar type, and the
+ * 2 highest digits (if exists) is the numeral shape.
+ *
+ * @reference
+ * http://office.microsoft.com/en-us/excel-help/creating-international-number-formats-HA001034635.aspx
+ *
+ * @param rString input string
+ * @param nPos position (see above).
+ *
+ * @return struct containing numeral shape, calendar type, and LCID that
+ * specifies language type. See i18nlangtag/lang.h for a complete
+ * list of language types. These numbers also correspond with the
+ * numbers used by Microsoft Office.
+ */
+ SVL_DLLPRIVATE static LocaleType ImpGetLocaleType( const OUString& rString, sal_Int32& nPos );
+
+ /** Obtain calendar and numerals from a LocaleType that was parsed from a
+ LCID with ImpGetLocaleType().
+
+ Inserts a NatNum modifier to rString at nPos if needed as determined
+ from the numeral code.
+
+ @ATTENTION: may modify <member>maLocale</member> to make it follow
+ aTmpLocale, in which case also nLang is adapted.
+
+ @returns a string with the calendar if one was determined from the
+ calendar code, else an empty string. The calendar string needs to be
+ inserted at a proper position to rString after all bracketed prefixes.
+ */
+ SVL_DLLPRIVATE OUString ImpObtainCalendarAndNumerals( OUStringBuffer & rString,
+ sal_Int32 nPos,
+ LanguageType & nLang,
+ const LocaleType & aTmpLocale );
+
+ // standard number output
+ SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, OUString& OutString ) const;
+ SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, OUStringBuffer& OutString ) const;
+ SVL_DLLPRIVATE void ImpGetOutputStdToPrecision( double& rNumber, OUString& rOutString, sal_uInt16 nPrecision ) const;
+ // numbers in input line
+ SVL_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, OUString& OutString ) const;
+
+ // check subcondition
+ // OP undefined => -1
+ // else 0 or 1
+ SVL_DLLPRIVATE static short ImpCheckCondition(double fNumber,
+ double fLimit,
+ SvNumberformatLimitOps eOp);
+
+ // Helper function for number strings
+ // append string symbols, insert leading 0 or ' ', or ...
+ SVL_DLLPRIVATE bool ImpNumberFill( OUStringBuffer& sStr,
+ double& rNumber,
+ sal_Int32& k,
+ sal_uInt16& j,
+ sal_uInt16 nIx,
+ short eSymbolType,
+ bool bInsertRightBlank = false );
+
+ // Helper function to fill in the integer part and the group (AKA thousand) separators
+ SVL_DLLPRIVATE bool ImpNumberFillWithThousands( OUStringBuffer& sStr,
+ double& rNumber,
+ sal_Int32 k,
+ sal_uInt16 j,
+ sal_uInt16 nIx,
+ sal_Int32 nDigCnt,
+ bool bAddDecSep = true );
+
+ // Helper function to fill in the group (AKA thousand) separators
+ // or to skip additional digits
+ SVL_DLLPRIVATE void ImpDigitFill( OUStringBuffer& sStr,
+ sal_Int32 nStart,
+ sal_Int32& k,
+ sal_uInt16 nIx,
+ sal_Int32 & nDigitCount,
+ utl::DigitGroupingIterator & );
+
+ SVL_DLLPRIVATE bool ImpDecimalFill( OUStringBuffer& sStr,
+ double& rNumber,
+ sal_Int32 nDecPos,
+ sal_uInt16 j,
+ sal_uInt16 nIx,
+ bool bInteger );
+
+ /** Calculate each element of fraction:
+ * integer part, numerator part, denominator part
+ * @param fNumber value to be represented as fraction. Will contain absolute fractional part
+ * @param nIx subformat number 0..3
+ * @param fIntPart integral part of fraction
+ * @param nFrac numerator of fraction
+ * @param nDic denominator of fraction
+ */
+ SVL_DLLPRIVATE void ImpGetFractionElements( double& fNumber,
+ sal_uInt16 nIx,
+ double& fIntPart,
+ sal_Int64& nFrac,
+ sal_Int64& nDiv ) const;
+ SVL_DLLPRIVATE bool ImpGetFractionOutput(double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString);
+ SVL_DLLPRIVATE bool ImpGetScientificOutput(double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString);
+
+ SVL_DLLPRIVATE bool ImpGetDateOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+ SVL_DLLPRIVATE bool ImpGetTimeOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+ SVL_DLLPRIVATE bool ImpGetDateTimeOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+
+ // Switches to the "gregorian" calendar if the current calendar is
+ // non-"gregorian" and the era is a "Dummy" era of a calendar which doesn't
+ // know a "before" era (like zh_TW ROC or ja_JP Gengou). If switched and
+ // rOrgCalendar was "gregorian" the string is emptied. If rOrgCalendar was
+ // empty the previous calendar name and date/time are returned.
+ SVL_DLLPRIVATE bool ImpFallBackToGregorianCalendar( OUString& rOrgCalendar, double& fOrgDateTime );
+
+ // Append a "G" short era string of the given calendar. In the case of a
+ // Gengou calendar this is a one character abbreviation, for other
+ // calendars the XExtendedCalendar::getDisplayString() method is called.
+ SVL_DLLPRIVATE static void ImpAppendEraG( OUStringBuffer& OutStringBuffer, const CalendarWrapper& rCal,
+ sal_Int16 nNatNum );
+
+ SVL_DLLPRIVATE bool ImpGetLogicalOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+
+ SVL_DLLPRIVATE bool ImpGetNumberOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+
+ SVL_DLLPRIVATE void ImpCopyNumberformat( const SvNumberformat& rFormat );
+
+ // normal digits or other digits, depending on ImpSvNumFor.aNatNum,
+ // [NatNum1], [NatNum2], ...
+ SVL_DLLPRIVATE OUString ImpGetNatNumString( const SvNumberNatNum& rNum, sal_Int64 nVal,
+ sal_uInt16 nMinDigits ) const;
+
+ OUString ImpIntToString( sal_uInt16 nIx, sal_Int64 nVal, sal_uInt16 nMinDigits = 0 ) const
+ {
+ const SvNumberNatNum& rNum = NumFor[nIx].GetNatNum();
+ if ( nMinDigits || rNum.IsComplete() )
+ {
+ return ImpGetNatNumString( rNum, nVal, nMinDigits );
+ }
+ return OUString::number(nVal);
+ }
+
+ // Obtain the string of the fraction of second, without leading "0.",
+ // rounded to nFractionDecimals (or nFractionDecimals+1 if
+ // bAddOneRoundingDecimal==true but then truncated at nFractionDecimals,
+ // for use with the result of tools::Time::GetClock()) with the length of
+ // nFractionDecimals, unless nMinimumInputLineDecimals>0 is given for input
+ // line string where extra trailing "0" are discarded.
+ SVL_DLLPRIVATE sal_uInt16 ImpGetFractionOfSecondString( OUStringBuffer& rBuf, double fFractionOfSecond,
+ int nFractionDecimals, bool bAddOneRoundingDecimal, sal_uInt16 nIx, sal_uInt16 nMinimumInputLineDecimals );
+
+ // transliterate according to NativeNumber
+ SVL_DLLPRIVATE OUString impTransliterateImpl(const OUString& rStr, const SvNumberNatNum& rNum) const;
+ SVL_DLLPRIVATE void impTransliterateImpl(OUStringBuffer& rStr, const SvNumberNatNum& rNum) const;
+ SVL_DLLPRIVATE OUString impTransliterateImpl(const OUString& rStr, const SvNumberNatNum& rNum, sal_uInt16 nDateKey) const;
+
+ OUString impTransliterate(const OUString& rStr, const SvNumberNatNum& rNum) const
+ {
+ return rNum.IsComplete() ? impTransliterateImpl(rStr, rNum) : rStr;
+ }
+
+ SVL_DLLPRIVATE void impTransliterate(OUStringBuffer& rStr, const SvNumberNatNum& rNum) const
+ {
+ if(rNum.IsComplete())
+ {
+ impTransliterateImpl(rStr, rNum);
+ }
+ }
+
+ OUString impTransliterate(const OUString& rStr, const SvNumberNatNum& rNum, sal_uInt16 nDateKey) const
+ {
+ return rNum.IsComplete() ? impTransliterateImpl(rStr, rNum, nDateKey) : rStr;
+ }
+
+};
+
+#endif // INCLUDED_SVL_ZFORMAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/DocumentToGraphicRenderer.hxx b/include/svtools/DocumentToGraphicRenderer.hxx
new file mode 100644
index 000000000..a5dc8e115
--- /dev/null
+++ b/include/svtools/DocumentToGraphicRenderer.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#pragma once
+
+#include <vector>
+
+#include <vcl/graph.hxx>
+
+#include <svtools/svtdllapi.h>
+
+namespace com :: sun :: star :: awt { class XToolkit; }
+namespace com :: sun :: star :: frame { class XModel; }
+namespace com :: sun :: star :: lang { class XComponent; }
+namespace com :: sun :: star :: view { class XRenderable; }
+
+namespace com::sun::star {
+ namespace drawing {
+ class XShapes;
+ class XShape;
+ }
+ namespace frame {
+ class XController;
+ }
+}
+
+class SVT_DLLPUBLIC DocumentToGraphicRenderer
+{
+ const css::uno::Reference<css::lang::XComponent>& mxDocument;
+
+ enum DocType {
+ WRITER,
+ CALC,
+ IMPRESS,
+ UNKNOWN
+ };
+
+ css::uno::Reference<css::frame::XModel> mxModel;
+ css::uno::Reference<css::frame::XController> mxController;
+ css::uno::Reference<css::view::XRenderable> mxRenderable;
+ css::uno::Reference<css::awt::XToolkit> mxToolkit;
+ css::uno::Any maSelection;
+ DocType meDocType;
+ std::vector<OUString> maChapterNames;
+
+ bool hasSelection() const;
+
+ /** Always something even if hasSelection() is false (in which case the
+ selection is mxDocument).
+ */
+ css::uno::Any getSelection() const;
+
+ sal_Int32 getCurrentPageWriter();
+
+public:
+ DocumentToGraphicRenderer(const css::uno::Reference<css::lang::XComponent>& xDocument, bool bSelectionOnly);
+ ~DocumentToGraphicRenderer();
+
+ sal_Int32 getCurrentPage();
+ sal_Int32 getPageCount();
+ /**
+ * Get list of chapter names for a page, current page is set by
+ * renderToGraphic().
+ */
+ const std::vector<OUString>& getChapterNames() const;
+
+ Size getDocumentSizeInPixels( sal_Int32 nCurrentPage );
+
+ Size getDocumentSizeIn100mm(sal_Int32 nCurrentPage, Point* pDocumentPosition = nullptr,
+ Point* pCalcPagePosition = nullptr, Size *pCalcPageSize = nullptr);
+
+ Graphic renderToGraphic( sal_Int32 nCurrentPage, Size aDocumentSizePixel,
+ Size aTargetSizePixel, Color aPageColor, bool bExtOutDevData);
+
+ /** Determine whether rxController has a css::view::XSelectionSupplier at
+ which either a css::drawing::XShapes or css::drawing::XShape is
+ selected. XShapes has precedence over XShape.
+
+ Call only if the SelectionOnly property was set.
+ */
+ static bool isShapeSelected(
+ css::uno::Reference< css::drawing::XShapes > & rxShapes,
+ css::uno::Reference< css::drawing::XShape > & rxShape,
+ const css::uno::Reference< css::frame::XController > & rxController );
+
+ bool isWriter() const;
+ bool isCalc() const;
+ bool isImpress() const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/HtmlWriter.hxx b/include/svtools/HtmlWriter.hxx
new file mode 100644
index 000000000..21ccad0cd
--- /dev/null
+++ b/include/svtools/HtmlWriter.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <rtl/string.hxx>
+#include <string_view>
+#include <vector>
+#include <svtools/svtdllapi.h>
+
+class SvStream;
+
+class SVT_DLLPUBLIC HtmlWriter final
+{
+private:
+ std::vector<OString> maElementStack;
+
+ SvStream& mrStream;
+
+ bool mbElementOpen;
+ bool mbCharactersWritten;
+ bool mbPrettyPrint;
+ /// XML namespace, in case of XHTML.
+ OString maNamespace;
+
+public:
+ HtmlWriter(SvStream& rStream, std::string_view rNamespace = std::string_view());
+ ~HtmlWriter();
+
+ void prettyPrint(bool b);
+
+ void start(const OString& aElement);
+
+ bool end(const OString& aElement);
+ void end();
+
+ void flushStack();
+
+ static void writeAttribute(SvStream& rStream, std::string_view aAttribute, sal_Int32 aValue);
+ static void writeAttribute(SvStream& rStream, std::string_view aAttribute,
+ std::string_view aValue);
+
+ void attribute(std::string_view aAttribute, const char* aValue);
+ void attribute(std::string_view aAttribute, sal_Int32 aValue);
+ void attribute(std::string_view aAttribute, std::string_view aValue);
+ void attribute(std::string_view aAttribute, std::u16string_view aValue);
+ // boolean attribute e.g. <img ismap>
+ void attribute(std::string_view aAttribute);
+
+ void single(const OString& aContent);
+ void endAttribute();
+
+ /// Writes character data.
+ void characters(std::string_view rChars);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx
new file mode 100644
index 000000000..931aad16f
--- /dev/null
+++ b/include/svtools/PlaceEditDialog.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <svtools/svtdllapi.h>
+#include <vcl/weld.hxx>
+
+#include <memory>
+#include <vector>
+
+class Place;
+class DetailsContainer;
+
+class UNLESS_MERGELIBS(SVT_DLLPUBLIC) PlaceEditDialog final : public weld::GenericDialogController
+{
+private:
+ std::shared_ptr<DetailsContainer> m_xCurrentDetails;
+ /** Vector holding the details UI control for each server type.
+
+ The elements in this vector need to match the order in the type listbox, e.g.
+ the m_aDetailsContainer[0] will be shown for the type corresponding to entry 0
+ in the listbox.
+ */
+ std::vector<std::shared_ptr<DetailsContainer>> m_aDetailsContainers;
+
+ sal_Int32 m_nCurrentType;
+
+ bool m_bLabelChanged;
+ bool m_bShowPassword;
+
+public:
+ std::unique_ptr<weld::Entry> m_xEDServerName;
+ std::unique_ptr<weld::ComboBox> m_xLBServerType;
+ std::unique_ptr<weld::Entry> m_xEDUsername;
+ std::unique_ptr<weld::Label> m_xFTUsernameLabel;
+ std::unique_ptr<weld::Button> m_xBTOk;
+ std::unique_ptr<weld::Button> m_xBTCancel;
+ std::unique_ptr<weld::Button> m_xBTDelete;
+ std::unique_ptr<weld::Button> m_xBTRepoRefresh;
+ std::unique_ptr<weld::CheckButton> m_xCBPassword;
+ std::unique_ptr<weld::Entry> m_xEDPassword;
+ std::unique_ptr<weld::Label> m_xFTPasswordLabel;
+ std::unique_ptr<weld::Widget> m_xTypeGrid;
+
+ std::unique_ptr<weld::Widget> m_xRepositoryBox;
+ std::unique_ptr<weld::Label> m_xFTRepository;
+ std::unique_ptr<weld::ComboBox> m_xLBRepository;
+
+ std::unique_ptr<weld::Entry> m_xEDShare;
+ std::unique_ptr<weld::Label> m_xFTShare;
+
+ std::unique_ptr<weld::Widget> m_xDetailsGrid;
+ std::unique_ptr<weld::Widget> m_xHostBox;
+ std::unique_ptr<weld::Entry> m_xEDHost;
+ std::unique_ptr<weld::Label> m_xFTHost;
+ std::unique_ptr<weld::SpinButton> m_xEDPort;
+ std::unique_ptr<weld::Label> m_xFTPort;
+ std::unique_ptr<weld::Entry> m_xEDRoot;
+ std::unique_ptr<weld::Label> m_xFTRoot;
+
+ std::unique_ptr<weld::CheckButton> m_xCBDavs;
+
+public:
+ PlaceEditDialog(weld::Window* pParent);
+ PlaceEditDialog(weld::Window* pParent, const std::shared_ptr<Place>& rPlace);
+ virtual ~PlaceEditDialog() override;
+
+ // Returns a place instance with given information
+ std::shared_ptr<Place> GetPlace();
+
+ OUString GetServerName() const { return m_xEDServerName->get_text(); }
+ OUString GetServerUrl();
+ OUString GetPassword() const { return m_xEDPassword->get_text(); };
+ OUString GetUser() const { return m_xEDUsername->get_text(); };
+ bool IsRememberChecked() const { return m_xCBPassword->get_active(); }
+
+ void ShowPasswordControl() { m_bShowPassword = true; }
+
+private:
+ void InitDetails();
+
+ DECL_DLLPRIVATE_LINK(OKHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(DelHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(EditHdl, DetailsContainer*, void);
+ DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
+ void SelectType(bool bSkipSeparator);
+ DECL_DLLPRIVATE_LINK(SelectTypeHdl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(EditLabelHdl, weld::Entry&, void);
+ DECL_DLLPRIVATE_LINK(EditUsernameHdl, weld::Entry&, void);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/acceleratorexecute.hxx b/include/svtools/acceleratorexecute.hxx
new file mode 100644
index 000000000..5acf9bcd2
--- /dev/null
+++ b/include/svtools/acceleratorexecute.hxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+
+#include <memory>
+#include <mutex>
+
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <vcl/keycod.hxx>
+
+namespace com :: sun :: star :: frame { class XDispatchProvider; }
+namespace com :: sun :: star :: frame { class XFrame; }
+namespace com :: sun :: star :: frame { class XModel; }
+namespace com :: sun :: star :: ui { class XAcceleratorConfiguration; }
+namespace com :: sun :: star :: uno { class XComponentContext; }
+namespace com :: sun :: star :: util { class XURLTransformer; }
+
+
+namespace svt
+{
+
+
+/**
+ @descr implements a helper, which can be used to
+ convert vcl key codes into awt key codes ...
+ and reverse.
+
+ Further such key code can be triggered.
+ Doing so different accelerator
+ configurations are merged together; a suitable
+ command registered for the given key code is searched
+ and will be dispatched.
+
+ @attention
+
+ Because execution of an accelerator command can be dangerous
+ (in case it force an office shutdown for key "ALT+F4"!)
+ all internal dispatches are done asynchronous.
+ Means that the trigger call doesn't wait till the dispatch
+ is finished. You can call very often. All requests will be
+ queued internal and dispatched ASAP.
+
+ Of course this queue will be stopped if the environment
+ will be destructed...
+ */
+class SVT_DLLPUBLIC AcceleratorExecute final
+{
+ // member
+ private:
+ std::mutex m_aLock;
+
+ /** TODO document me */
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ /** TODO document me */
+ css::uno::Reference< css::util::XURLTransformer > m_xURLParser;
+
+ /** TODO document me */
+ css::uno::Reference< css::frame::XDispatchProvider > m_xDispatcher;
+
+ /** TODO document me */
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobalCfg;
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModuleCfg;
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xDocCfg;
+ // interface
+ public:
+
+
+ /** @short factory method to create new accelerator
+ helper instance.
+
+ @descr Such helper instance must be initialized at first.
+ So it can know its environment (global/module or
+ document specific).
+
+ Afterwards it can be used to execute incoming
+ accelerator requests.
+
+ The "end of life" of such helper can be reached as follow:
+
+ - delete the object
+ => If it stands currently in its execute method, they will
+ be finished. All further queued requests will be removed
+ and further not executed!
+
+ - "let it stay alone"
+ => All currently queued events will be finished. The
+ helper kills itself afterwards. A shutdown of the
+ environment will be recognized ... The helper stop its
+ work immediately then!
+ */
+ static std::unique_ptr<AcceleratorExecute> createAcceleratorHelper();
+
+
+ /** @short fight against inlining ... */
+ ~AcceleratorExecute();
+
+
+ /** @short init this instance.
+
+ @descr It must be called as first method after creation.
+ And further it can be called more than once...
+ but at least it should be used one times only.
+ Otherwise nobody can say, which asynchronous
+ executions will be used inside the old and which one
+ will be used inside the new environment.
+
+ @param rxContext
+ reference to a uno service manager.
+
+ @param xEnv
+ if it points to a valid frame it will be used
+ to execute the dispatch there. Further the frame
+ is used to locate the right module configuration
+ and use it merged together with the document and
+ the global configuration.
+
+ If this parameter is set to NULL, the global configuration
+ is used only. Further the global Desktop instance is
+ used for dispatch.
+ */
+ void init(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XFrame >& xEnv );
+
+
+ /** @short trigger this accelerator.
+
+ @descr The internal configurations are used to find
+ as suitable command for this key code.
+ This command will be queued and executed later
+ asynchronous.
+
+ @param aKey
+ specify the accelerator for execute.
+
+ @return [bool]
+ true if this key is configured and match to a command.
+ Attention: This state does not mean the success state
+ of the corresponding execute. Because it's done asynchronously!
+ */
+ bool execute(const vcl::KeyCode& aKey);
+ bool execute(const css::awt::KeyEvent& aKey);
+
+ /** search the command for the given key event.
+ *
+ * @param aKey The key event
+ * @return The command or an empty string if the key event could not be found.
+ */
+ OUString findCommand(const css::awt::KeyEvent& aKey);
+
+ /** TODO document me */
+ static css::awt::KeyEvent st_VCLKey2AWTKey(const vcl::KeyCode& aKey);
+ static vcl::KeyCode st_AWTKey2VCLKey(const css::awt::KeyEvent& aKey);
+
+
+ /** TODO document me */
+ static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openModuleConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext ,
+ const css::uno::Reference< css::frame::XFrame >& xFrame);
+
+
+ /** TODO document me */
+ static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openDocConfig(const css::uno::Reference< css::frame::XModel >& xModel);
+
+
+ // internal
+ private:
+
+
+ /** @short allow creation of instances of this class
+ by using our factory only!
+ */
+ SVT_DLLPRIVATE AcceleratorExecute();
+
+ AcceleratorExecute(const AcceleratorExecute& rCopy) = delete;
+ void operator=(const AcceleratorExecute&) = delete;
+
+ /** TODO document me */
+ SVT_DLLPRIVATE OUString impl_ts_findCommand(const css::awt::KeyEvent& aKey);
+
+
+ /** TODO document me */
+ SVT_DLLPRIVATE css::uno::Reference< css::util::XURLTransformer > impl_ts_getURLParser();
+};
+
+} // namespace svt
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/accessibilityoptions.hxx b/include/svtools/accessibilityoptions.hxx
new file mode 100644
index 000000000..2733cfa0e
--- /dev/null
+++ b/include/svtools/accessibilityoptions.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <unotools/options.hxx>
+
+class SvtAccessibilityOptions_Impl;
+
+class SVT_DLLPUBLIC SvtAccessibilityOptions final :
+ public utl::detail::Options
+{
+private:
+ static SvtAccessibilityOptions_Impl* sm_pSingleImplConfig;
+ static sal_Int32 sm_nAccessibilityRefCount;
+
+public:
+ SvtAccessibilityOptions();
+ virtual ~SvtAccessibilityOptions() override;
+
+ // get & set config entries
+ bool GetIsAllowAnimatedGraphics() const;
+ bool GetIsAllowAnimatedText() const;
+ bool GetIsAutomaticFontColor() const;
+ bool IsSelectionInReadonly() const;
+
+ void SetVCLSettings();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/addresstemplate.hxx b/include/svtools/addresstemplate.hxx
new file mode 100644
index 000000000..04ce8d9be
--- /dev/null
+++ b/include/svtools/addresstemplate.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <memory>
+#include <svtools/svtdllapi.h>
+#include <vcl/weld.hxx>
+
+namespace com :: sun :: star :: container { class XNameAccess; }
+namespace com :: sun :: star :: sdbc { class XDataSource; }
+namespace com :: sun :: star :: sdb { class XDatabaseContext; }
+namespace com :: sun :: star :: uno { class XComponentContext; }
+namespace com :: sun :: star :: util { struct AliasProgrammaticPair; }
+
+#define FIELD_PAIRS_VISIBLE 5
+#define FIELD_CONTROLS_VISIBLE 2 * FIELD_PAIRS_VISIBLE
+
+namespace svt
+{
+ // = AddressBookSourceDialog
+ struct AddressBookSourceDialogData;
+ class UNLESS_MERGELIBS(SVT_DLLPUBLIC) AddressBookSourceDialog final : public weld::GenericDialogController
+ {
+ public:
+ AddressBookSourceDialog(weld::Window* _pParent,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB );
+
+ /** if you use this ctor, the dialog
+ <ul><li>will not store it's data in the configuration (nor initially retrieve it from there)</li>
+ <li>will not allow to change the data source name</li>
+ <li>will not allow to change the table name</li>
+ <li>will not allow to call the data source administration dialog</li>
+ </ul>
+
+ @param _rxORB
+ a service factory to use for various UNO related needs
+ @param _rxTransientDS
+ the data source to obtain connections from
+ @param _rDataSourceName
+ the to-be name of _rxTransientDS. This is only for displaying this
+ name to the user, since the dialog completely works on _rxTransientDS,
+ and doesn't allow to change this.
+ @param _rTable
+ the table name to display. It must refer to a valid table, relative to a connection
+ obtained from <arg>_rxTransientDS</arg>
+ */
+ AddressBookSourceDialog(weld::Window* _pParent,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
+ const css::uno::Reference< css::sdbc::XDataSource >& _rxTransientDS,
+ const OUString& _rDataSourceName,
+ const OUString& _rTable,
+ const css::uno::Sequence< css::util::AliasProgrammaticPair >& _rMapping
+ );
+
+ virtual ~AddressBookSourceDialog() override;
+
+ // to be used if the object was constructed for editing a field mapping only
+ void getFieldMapping(
+ css::uno::Sequence< css::util::AliasProgrammaticPair >& _rMapping) const;
+
+ private:
+ void implConstruct();
+
+ // implementations
+ void implScrollFields(sal_Int32 nPos, bool bAdjustFocus, bool bAdjustScrollbar);
+ static void implSelectField(weld::ComboBox* pBox, const OUString& rText);
+
+ void resetTables();
+ void resetFields();
+
+ // fill in the data sources listbox
+ void initializeDatasources();
+
+ // initialize the dialog from the configuration data
+ void loadConfiguration();
+
+ DECL_DLLPRIVATE_LINK(OnFieldScroll, weld::ScrolledWindow&, void);
+ DECL_DLLPRIVATE_LINK(OnFieldSelect, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(OnAdministrateDatasources, weld::Button&, void);
+ DECL_DLLPRIVATE_STATIC_LINK(AddressBookSourceDialog, OnComboGetFocus, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(OnComboLoseFocus, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(OnComboSelect, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(OnOkClicked, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(OnDelayedInitialize, void*, void);
+
+ // string to display for "no selection"
+ const OUString m_sNoFieldSelection;
+
+ /// the DatabaseContext for selecting data sources
+ css::uno::Reference< css::sdb::XDatabaseContext >
+ m_xDatabaseContext;
+ // the ORB for creating objects
+ css::uno::Reference< css::uno::XComponentContext >
+ m_xORB;
+ css::uno::Reference< css::container::XNameAccess >
+ m_xCurrentDatasourceTables;
+
+ // Controls
+ std::unique_ptr<weld::ComboBox> m_xDatasource;
+ std::unique_ptr<weld::Button> m_xAdministrateDatasources;
+ std::unique_ptr<weld::ComboBox> m_xTable;
+ std::unique_ptr<weld::ScrolledWindow> m_xFieldScroller;
+ std::unique_ptr<weld::Button> m_xOKButton;
+ std::unique_ptr<weld::Widget> m_xGrid;
+
+ std::unique_ptr<AddressBookSourceDialogData> m_pImpl;
+ };
+} // namespace svt
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/apearcfg.hxx b/include/svtools/apearcfg.hxx
new file mode 100644
index 000000000..900155856
--- /dev/null
+++ b/include/svtools/apearcfg.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <unotools/configitem.hxx>
+
+class Application;
+enum class MouseMiddleButtonAction;
+
+enum class SnapType {
+ ToButton = 0,
+ ToMiddle,
+ NONE
+};
+
+enum class DragMode {
+ FullWindow,
+ Frame,
+ SystemDep
+};
+
+
+class SVT_DLLPUBLIC SvtTabAppearanceCfg final : public utl::ConfigItem
+{
+ DragMode nDragMode ;
+ SnapType nSnapMode ;
+ MouseMiddleButtonAction nMiddleMouse;
+ short nAAMinPixelHeight ;
+ bool bFontAntialiasing ;
+
+ bool bMenuMouseFollow ;
+
+ static bool bInitialized ;
+
+ SVT_DLLPRIVATE static const css::uno::Sequence<OUString>& GetPropertyNames();
+ virtual void ImplCommit() override;
+
+public:
+ SvtTabAppearanceCfg( );
+ virtual ~SvtTabAppearanceCfg( ) override;
+
+ virtual void Notify( const css::uno::Sequence< OUString >& _rPropertyNames) override;
+
+ DragMode GetDragMode () const { return nDragMode; }
+
+ SnapType GetSnapMode () const { return nSnapMode; }
+ void SetSnapMode ( SnapType nSet );
+
+ MouseMiddleButtonAction GetMiddleMouseButton () const { return nMiddleMouse; }
+ void SetMiddleMouseButton ( MouseMiddleButtonAction nSet );
+
+ void SetApplicationDefaults ( Application* pApp );
+
+ bool IsMenuMouseFollow() const{return bMenuMouseFollow;}
+
+ void SetFontAntiAliasing( bool bSet ) { bFontAntialiasing = bSet; SetModified(); }
+ bool IsFontAntiAliasing() const { return bFontAntialiasing; }
+
+ sal_uInt16 GetFontAntialiasingMinPixelHeight( ) const { return nAAMinPixelHeight; }
+ void SetFontAntialiasingMinPixelHeight( sal_uInt16 _nMinHeight ) { nAAMinPixelHeight = _nMinHeight; SetModified(); }
+
+ static bool IsInitialized() { return bInitialized; }
+ static void SetInitialized() { bInitialized = true; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/asynclink.hxx b/include/svtools/asynclink.hxx
new file mode 100644
index 000000000..ae5139e32
--- /dev/null
+++ b/include/svtools/asynclink.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <svtools/svtdllapi.h>
+#include <tools/link.hxx>
+#include <vcl/idle.hxx>
+#include <mutex>
+
+class Timer;
+struct ImplSVEvent;
+
+namespace svtools {
+
+class UNLESS_MERGELIBS(SVT_DLLPUBLIC) AsynchronLink
+{
+ Link<void*,void> _aLink;
+ ImplSVEvent* _nEventId;
+ void* _pArg;
+ std::mutex _aMutex;
+
+ DECL_DLLPRIVATE_LINK( HandleCall_PostUserEvent, void*, void );
+
+public:
+ AsynchronLink( const Link<void*,void>& rLink )
+ : _aLink( rLink )
+ , _nEventId( nullptr )
+ , _pArg( nullptr )
+ {}
+ AsynchronLink()
+ : _nEventId( nullptr )
+ , _pArg( nullptr )
+ {}
+ ~AsynchronLink();
+
+ void operator=( const Link<void*,void>& rLink ) { _aLink = rLink; }
+ void Call( void* pObj, bool bAllowDoubles = false );
+ void ClearPendingCall( );
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/bindablecontrolhelper.hxx b/include/svtools/bindablecontrolhelper.hxx
new file mode 100644
index 000000000..8ec4762d2
--- /dev/null
+++ b/include/svtools/bindablecontrolhelper.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com :: sun :: star :: frame { class XModel; }
+namespace com :: sun :: star :: uno { class XInterface; }
+
+namespace svt
+{
+
+
+ //= GraphicAccess
+
+ /** helper class for obtaining streams (which also can be used with the ImageProducer)
+ from a resource
+ */
+ namespace BindableControlHelper
+ {
+ SVT_DLLPUBLIC void ApplyListSourceAndBindableData( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::uno::XInterface >& rObj, const OUString& rsCtrlSource, const OUString& rsRowSource, sal_uInt16 nRefTab = 0 );
+ }
+
+
+} // namespace svt
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/borderhelper.hxx b/include/svtools/borderhelper.hxx
new file mode 100644
index 000000000..c7169d767
--- /dev/null
+++ b/include/svtools/borderhelper.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+
+class OutputDevice;
+class Point;
+
+enum class SvxBorderLineStyle : sal_Int16;
+
+namespace svtools {
+
+SVT_DLLPUBLIC std::vector<double> GetLineDashing( SvxBorderLineStyle nDashing, double fScale );
+
+SVT_DLLPUBLIC basegfx::B2DPolyPolygon ApplyLineDashing(
+ const basegfx::B2DPolygon& rPolygon, SvxBorderLineStyle nDashing, double fScale );
+
+SVT_DLLPUBLIC void DrawLine( OutputDevice& rDev, const basegfx::B2DPoint& rBeg,
+ const basegfx::B2DPoint& rEnd, sal_uInt32 nWidth, SvxBorderLineStyle nDashing );
+
+SVT_DLLPUBLIC void DrawLine( OutputDevice& rDev, const Point& rBeg,
+ const Point& rEnd, sal_uInt32 nWidth, SvxBorderLineStyle nDashing );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/borderline.hxx b/include/svtools/borderline.hxx
new file mode 100644
index 000000000..36780bddf
--- /dev/null
+++ b/include/svtools/borderline.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <tools/long.hxx>
+
+/**
+ Class computing border widths shared between Line style listbox and the
+ SvxBorderLine implementation.
+
+ This class doesn't know anything about units: it all depends on the different
+ values set. A border is composed of 2 lines separated by a gap. The computed
+ widths are the ones of each line and the gap and they can either be fix or vary.
+
+ The #m_nflags member will define which widths will vary (value 0 means that all
+ widths are fixed). The available flags are:
+ - CHANGE_LINE1
+ - CHANGE_LINE2
+ - CHANGE_DIST
+
+ For each line, the rate member is used as a multiplication factor is the width
+ isn't fixed. Otherwise it is the width in the unit expected by the client code.
+ */
+enum class BorderWidthImplFlags
+{
+ FIXED = 0,
+ CHANGE_LINE1 = 1,
+ CHANGE_LINE2 = 2,
+ CHANGE_DIST = 4,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<BorderWidthImplFlags> : is_typed_flags<BorderWidthImplFlags, 0x07> {};
+}
+class SVT_DLLPUBLIC BorderWidthImpl
+{
+ BorderWidthImplFlags m_nFlags;
+ double m_nRate1;
+ double m_nRate2;
+ double m_nRateGap;
+
+public:
+
+ BorderWidthImpl( BorderWidthImplFlags nFlags = BorderWidthImplFlags::CHANGE_LINE1, double nRate1 = 0.0,
+ double nRate2 = 0.0, double nRateGap = 0.0 );
+
+ bool operator== ( const BorderWidthImpl& r ) const;
+
+ tools::Long GetLine1 ( tools::Long nWidth ) const;
+ tools::Long GetLine2( tools::Long nWidth ) const;
+ tools::Long GetGap( tools::Long nWidth ) const;
+
+ tools::Long GuessWidth( tools::Long nLine1, tools::Long nLine2, tools::Long nGap );
+
+ bool IsEmpty( ) const { return (0 == m_nRate1) && (0 == m_nRate2); }
+ bool IsDouble( ) const { return (0 != m_nRate1) && (0 != m_nRate2); }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
new file mode 100644
index 000000000..6f65c6b30
--- /dev/null
+++ b/include/svtools/brwbox.hxx
@@ -0,0 +1,849 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <vcl/ctrl.hxx>
+#include <vcl/vclptr.hxx>
+#include <tools/multisel.hxx>
+#include <vcl/event.hxx>
+#include <vcl/headbar.hxx>
+#include <vcl/transfer.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/AccessibleBrowseBoxObjType.hxx>
+#include <vcl/accessibletableprovider.hxx>
+#include <vector>
+#include <stack>
+
+#include <limits.h>
+#include <memory>
+#include <o3tl/typed_flags_set.hxx>
+
+class BrowserColumn;
+class BrowserHeader;
+class ScrollBar;
+class MeasureStatusBar;
+
+namespace svt {
+ class BrowseBoxImpl;
+}
+
+namespace utl {
+ class AccessibleStateSetHelper;
+}
+
+namespace vcl {
+ class IAccessibleFactory;
+}
+
+#define BROWSER_INVALIDID SAL_MAX_UINT16
+constexpr sal_Int32 BROWSER_ENDOFSELECTION = SFX_ENDOFSELECTION;
+
+enum class BrowserMode
+{
+ NONE = 0x000000,
+ COLUMNSELECTION = 0x000001,
+ MULTISELECTION = 0x000002,
+ KEEPHIGHLIGHT = 0x000008,
+ HLINES = 0x000010,
+ VLINES = 0x000020,
+
+ HIDESELECT = 0x000100,
+ HIDECURSOR = 0x000200,
+
+ NO_HSCROLL = 0x000400,
+
+ AUTO_VSCROLL = 0x001000,
+ AUTO_HSCROLL = 0x002000,
+
+ TRACKING_TIPS = 0x004000,
+
+ NO_VSCROLL = 0x008000,
+
+ HEADERBAR_NEW = 0x040000,
+ AUTOSIZE_LASTCOL = 0x080000,
+
+ CURSOR_WO_FOCUS = 0x200000,
+ // Allows a cursor which is shown even if the control does not have the focus. This does not affect other
+ // situations which require to temporarily hide the cursor (such as scrolling).
+
+};
+namespace o3tl
+{
+ template<> struct typed_flags<BrowserMode> : is_typed_flags<BrowserMode, 0x2cf73b> {};
+}
+
+#define BROWSER_NONE 0
+#define BROWSER_SELECT 720
+#define BROWSER_ENHANCESELECTION 722
+#define BROWSER_SELECTDOWN 724
+#define BROWSER_SELECTUP 725
+#define BROWSER_CURSORDOWN 731
+#define BROWSER_CURSORUP 732
+#define BROWSER_CURSORLEFT 733
+#define BROWSER_CURSORRIGHT 734
+#define BROWSER_CURSORPAGEDOWN 735
+#define BROWSER_CURSORPAGEUP 736
+#define BROWSER_CURSORENDOFFILE 741
+#define BROWSER_CURSORTOPOFFILE 742
+#define BROWSER_CURSORENDOFSCREEN 743
+#define BROWSER_CURSORTOPOFSCREEN 744
+#define BROWSER_CURSORHOME 745
+#define BROWSER_CURSOREND 746
+#define BROWSER_SCROLLDOWN 751
+#define BROWSER_SCROLLUP 752
+#define BROWSER_SELECTHOME 753
+#define BROWSER_SELECTEND 754
+#define BROWSER_SELECTCOLUMN 755
+#define BROWSER_MOVECOLUMNLEFT 756
+#define BROWSER_MOVECOLUMNRIGHT 757
+
+
+class BrowseEvent
+{
+ VclPtr<vcl::Window> pWin;
+ tools::Rectangle aRect;
+ sal_Int32 nRow;
+ sal_uInt16 nCol;
+ sal_uInt16 nColId;
+
+public:
+ BrowseEvent( vcl::Window* pWindow,
+ sal_Int32 nAbsRow,
+ sal_uInt16 nColumn, sal_uInt16 nColumnId,
+ const tools::Rectangle& rRect );
+
+ vcl::Window* GetWindow() const { return pWin; }
+ sal_Int32 GetRow() const { return nRow; }
+ sal_uInt16 GetColumn() const { return nCol; }
+ sal_uInt16 GetColumnId() const { return nColId; }
+ const tools::Rectangle& GetRect() const { return aRect; }
+};
+
+class BrowseBox;
+class ScrollBarBox;
+class BrowserMouseEvent;
+
+class BrowserDataWin final
+ :public Control
+ ,public DragSourceHelper
+ ,public DropTargetHelper
+{
+public:
+ VclPtr<BrowserHeader> pHeaderBar; // only for BrowserMode::HEADERBAR_NEW
+ VclPtr<ScrollBarBox> pCornerWin; // Window in the corner btw the ScrollBars
+ bool bInDtor;
+ AutoTimer aMouseTimer; // recalls MouseMove on dragging out
+ MouseEvent aRepeatEvt; // a MouseEvent to repeat
+ Point aLastMousePos; // prevents pseudo-MouseMoves
+
+ OUString aRealRowCount; // to show in VScrollBar
+
+ std::vector<tools::Rectangle> aInvalidRegion; // invalidated Rectangles during !UpdateMode
+ bool bInPaint; // TRUE while in Paint
+ bool bInCommand; // TRUE while in Command
+ bool bNoHScroll; // no horizontal scrollbar
+ bool bNoVScroll; // no vertical scrollbar
+ bool bAutoHScroll; // autohide horizontaler Scrollbar
+ bool bAutoVScroll; // autohide horizontaler Scrollbar
+ bool bUpdateMode; // not SV-UpdateMode because of Invalidate()
+ bool bAutoSizeLastCol; // last column always fills up window
+ bool bResizeOnPaint; // outstanding resize-event
+ bool bUpdateOnUnlock; // Update() while locked
+ bool bInUpdateScrollbars; // prevents recursions
+ bool bHadRecursion; // a recursion occurred
+ bool bCallingDropCallback; // we're in a callback to AcceptDrop or ExecuteDrop currently
+ sal_uInt16 nUpdateLock; // lock count, don't call Control::Update()!
+ short nCursorHidden; // new counter for DoHide/ShowCursor
+
+ tools::Long m_nDragRowDividerLimit;
+ tools::Long m_nDragRowDividerOffset;
+
+public:
+ explicit BrowserDataWin( BrowseBox* pParent );
+ virtual ~BrowserDataWin() override;
+ virtual void dispose() override;
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+ virtual void Command( const CommandEvent& rEvt ) override;
+ virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
+ virtual void MouseMove( const MouseEvent& rEvt ) override;
+ DECL_LINK( RepeatedMouseMove, Timer *, void );
+
+ virtual void MouseButtonUp( const MouseEvent& rEvt ) override;
+ virtual void KeyInput( const KeyEvent& rEvt ) override;
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+
+ // DropTargetHelper overridables
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+
+ // DragSourceHelper overridables
+ virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) override;
+
+
+ BrowseEvent CreateBrowseEvent( const Point& rPosPixel );
+ BrowseBox* GetParent() const;
+ const OUString& GetRealRowCount() const { return aRealRowCount; }
+
+ void SetUpdateMode( bool bMode );
+ bool GetUpdateMode() const { return bUpdateMode; }
+ void EnterUpdateLock() { ++nUpdateLock; }
+ void LeaveUpdateLock();
+ void Update();
+ void DoOutstandingInvalidations();
+ void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
+ void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
+ using Control::Invalidate;
+
+private:
+ void StartRowDividerDrag( const Point& _rStartPos );
+ bool ImplRowDividerHitTest( const BrowserMouseEvent& _rEvent ) const;
+};
+
+class BrowserMouseEvent: public MouseEvent, public BrowseEvent
+{
+public:
+ BrowserMouseEvent( BrowserDataWin* pWin, const MouseEvent& rEvt );
+ BrowserMouseEvent( vcl::Window* pWin, const MouseEvent& rEvt,
+ sal_Int32 nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId,
+ const tools::Rectangle& rRect );
+};
+
+
+class BrowserAcceptDropEvent : public AcceptDropEvent, public BrowseEvent
+{
+public:
+ BrowserAcceptDropEvent( BrowserDataWin* pWin, const AcceptDropEvent& rEvt );
+};
+
+
+class BrowserExecuteDropEvent : public ExecuteDropEvent, public BrowseEvent
+{
+public:
+ BrowserExecuteDropEvent( BrowserDataWin* pWin, const ExecuteDropEvent& rEvt );
+};
+
+// TODO
+// The whole selection thingie in this class is somewhat... suspicious to me.
+// some oddities:
+// * method parameters named like members (and used in both semantics within the method!)
+// * the multi selection flag is sometimes used as if it is for row selection, sometimes as if
+// it's for column selection, too (and sometimes in an even stranger way :)
+// * it is not really defined like all these hundreds selection related flags/methods work together
+// and influence each other. I do not understand it very well, but this may be my fault :)
+// * There is a GetColumnSelection, but it can't be used to determine the selected columns (at least
+// not without a const_cast)
+//
+// We should clearly define this somewhere in the future. Or, even better, we should re-implement this
+// whole class, which is planned for a long time :)
+//
+// sorry for the ranting. could not resist
+
+class SVT_DLLPUBLIC BrowseBox
+ :public Control
+ ,public DragSourceHelper
+ ,public DropTargetHelper
+ ,public vcl::IAccessibleTableProvider
+{
+ friend class BrowserDataWin;
+ friend class ::svt::BrowseBoxImpl;
+
+public:
+ static const sal_uInt16 HandleColumnId = 0;
+
+private:
+ VclPtr<BrowserDataWin> pDataWin; // window to display data rows
+ VclPtr<ScrollBar> pVScroll; // vertical scrollbar
+ VclPtr<ScrollBar> aHScroll; // horizontal scrollbar
+ VclPtr<MeasureStatusBar> aStatusBarHeight; // statusbar, just to measure its height
+
+ tools::Long m_nDataRowHeight; // height of a single data-row
+ sal_uInt16 nTitleLines; // number of lines in title row
+ sal_uLong nControlAreaWidth; // width of fixed area beneath hscroll
+ bool bColumnCursor; // single columns and fields selectable
+ bool bMultiSelection;// allow multiple selected rows
+ bool bKeepHighlight; // don't hide selection on LoseFocus
+
+ bool bHLines; // draw lines between rows
+ bool bVLines; // draw lines between columns
+ bool bBootstrapped; // child windows resized etc.
+ sal_Int32 nTopRow; // no. of first visible row (0...)
+ sal_Int32 nCurRow; // no. of row with cursor
+ sal_Int32 nRowCount; // total number of rows in model
+ sal_uInt16 nFirstCol; // no. of first visible scrollable column
+ sal_uInt16 nCurColId; // column id of cursor
+
+ bool bSelecting;
+ bool bRowDividerDrag;
+ bool bHit;
+ bool mbInteractiveRowHeight;
+
+ tools::Long nResizeX; // mouse position at start of resizing
+ tools::Long nMinResizeX; // never drag more left
+ tools::Long nDragX; // last dragged column (MouseMove)
+ sal_uInt16 nResizeCol; // resize this column in MouseMove
+ bool bResizing; // mouse captured for column resizing
+
+ bool bSelect; /// select or deselect
+ bool bSelectionIsVisible; // depending on focus
+ bool bScrolling; // hidden cursor while scrolling
+ bool bNotToggleSel; // set while in ToggleSelection() etc.
+ bool bHasFocus; // set/unset in Get/LoseFocus
+ bool bHideSelect; // hide selection (highlight)
+ TriState bHideCursor; // hide cursor (frame)
+ Range aSelRange; // for selection expansion
+
+ ::std::vector< std::unique_ptr<BrowserColumn> > mvCols; // array of column-descriptions
+ union
+ {
+ MultiSelection* pSel; // selected rows for multi-selection
+ sal_Int32 nSel; // selected row for single-selection
+ } uRow;
+ std::unique_ptr<MultiSelection> pColSel; // selected column-ids
+
+ // fdo#83943, detect if making the cursor position visible is impossible to achieve
+ struct CursorMoveAttempt
+ {
+ sal_Int32 m_nCol;
+ sal_Int32 m_nRow;
+ bool m_bScrolledToReachCell;
+ CursorMoveAttempt(sal_Int32 nCol, sal_Int32 nRow, bool bScrolledToReachCell)
+ : m_nCol(nCol)
+ , m_nRow(nRow)
+ , m_bScrolledToReachCell(bScrolledToReachCell)
+ {
+ }
+ bool operator==(const CursorMoveAttempt& r) const
+ {
+ return m_nCol == r.m_nCol &&
+ m_nRow == r.m_nRow &&
+ m_bScrolledToReachCell == r.m_bScrolledToReachCell;
+ }
+ bool operator!=(const CursorMoveAttempt& r) const { return !(*this == r); }
+ };
+ std::stack<CursorMoveAttempt>
+ m_aGotoStack;
+
+ ::std::unique_ptr< ::svt::BrowseBoxImpl > m_pImpl; // impl structure of the BrowseBox object
+
+ bool m_bFocusOnlyCursor; // hide cursor if we don't have the focus
+ Color m_aCursorColor; // special color for cursor, COL_TRANSPARENT for usual (VCL-painted) "inverted" cursor
+ BrowserMode m_nCurrentMode; // last argument of SetMode (redundant, as our other members represent the current settings, too)
+
+private:
+ SVT_DLLPRIVATE void ConstructImpl(BrowserMode nMode);
+ SVT_DLLPRIVATE void ExpandRowSelection( const BrowserMouseEvent& rEvt );
+ SVT_DLLPRIVATE void ToggleSelection();
+
+ SVT_DLLPRIVATE void UpdateScrollbars();
+ SVT_DLLPRIVATE void AutoSizeLastColumn();
+
+ SVT_DLLPRIVATE tools::Long ImpGetDataRowHeight() const;
+ SVT_DLLPRIVATE tools::Rectangle ImplFieldRectPixel( sal_Int32 nRow, sal_uInt16 nColId ) const;
+ SVT_DLLPRIVATE sal_uInt16 FrozenColCount() const;
+
+ SVT_DLLPRIVATE void ColumnInserted( sal_uInt16 nPos );
+
+ DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar*, void );
+ DECL_DLLPRIVATE_LINK( StartDragHdl, HeaderBar*, void );
+
+ SVT_DLLPRIVATE tools::Long GetFrozenWidth() const;
+
+ SVT_DLLPRIVATE tools::Long GetBarHeight() const;
+
+ bool GoToRow(sal_Int32 nRow, bool bRowColMove, bool bDoNotModifySelection = false );
+
+ bool GoToColumnId( sal_uInt16 nColId, bool bMakeVisible, bool bRowColMove = false);
+ void SelectColumnPos( sal_uInt16 nCol, bool _bSelect, bool bMakeVisible);
+
+ void ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRect, bool _bForeignDevice);
+
+ bool PaintCursorIfHiddenOnce() const { return !m_bFocusOnlyCursor && !HasFocus(); }
+
+ sal_uInt16 ToggleSelectedColumn();
+ void SetToggledSelectedColumn(sal_uInt16 _nSelectedColumnId);
+
+protected:
+ /// retrieves the XAccessible implementation associated with the BrowseBox instance
+ ::vcl::IAccessibleFactory& getAccessibleFactory();
+
+protected:
+ sal_uInt16 ColCount() const;
+
+ // software plug for database access
+ // RowCount is counted automatically
+ // (with the help of RowInserted and RowRemoved), so overriding of
+ // the method is needless
+public:
+ virtual sal_Int32 GetRowCount() const override;
+
+protected:
+ // for display in VScrollBar set it e.g. on "?"
+ void SetRealRowCount( const OUString &rRealRowCount );
+
+ // Return Value has to be sal_True always - SeekRow *has* to work!
+ // (else ASSERT) MI: who integrated that? It must not be like that!
+
+ /** seeks for the given row position
+ @param nRow
+ nRow starts at 0
+ */
+ virtual bool SeekRow( sal_Int32 nRow ) = 0;
+ void DrawCursor();
+ void PaintData(vcl::Window const & rWin, vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
+ virtual void PaintField(vcl::RenderContext& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId) const = 0;
+ // Advice for the subclass: the visible scope of rows has changed.
+ // The subclass is able to announce changes of the model with the
+ // help of the methods RowInserted and RowRemoved. Because of the
+ // new status a paint is induced (SeekRow is called etc).
+ //
+ // parameters: nNewTopRow: number of the new TopRow (can get changed from
+ // VisibleRowsChanged by request of RowInserted and RowDeleted).
+ // nNumRows: number of visible rows (a partial visible row is counted too)
+ //
+ // Possible reason for changing the visible scope:
+ // - in front of the visible scope rows were inserted or removed, so the
+ // numbering of the visible scope has changed
+ // - Scrolling (and thereof resulting in another first visible row)
+ // - Resize the window
+ virtual void VisibleRowsChanged( sal_Int32 nNewTopRow, sal_uInt16 nNumRows);
+
+ // number of visible rows in the window (incl. "truncated" rows)
+ sal_uInt16 GetVisibleRows() const;
+ sal_Int32 GetTopRow() const { return nTopRow; }
+ sal_uInt16 GetFirstVisibleColNumber() const { return nFirstCol; }
+
+ // Focus-Rect enable / disable
+ void DoShowCursor();
+ void DoHideCursor();
+ short GetCursorHideCount() const;
+
+ virtual VclPtr<BrowserHeader> CreateHeaderBar( BrowseBox* pParent );
+
+ // HACK(virtual create is not called in Ctor)
+ void SetHeaderBar( BrowserHeader* );
+
+ tools::Long CalcReverseZoom(tools::Long nVal) const;
+
+ const DataFlavorExVector&
+ GetDataFlavors() const;
+
+ bool IsDropFormatSupported( SotClipboardFormatId nFormat ) const; // need this because the base class' IsDropFormatSupported is not const ...
+
+ void DisposeAccessible();
+
+protected:
+ // callbacks for the data window
+ virtual void ImplStartTracking();
+ virtual void ImplEndTracking();
+
+public:
+ BrowseBox( vcl::Window* pParent, WinBits nBits,
+ BrowserMode nMode = BrowserMode::NONE );
+ virtual ~BrowseBox() override;
+ virtual void dispose() override;
+
+ // override inherited handler
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
+ virtual void MouseMove( const MouseEvent& rEvt ) override;
+ virtual void MouseButtonUp( const MouseEvent& rEvt ) override;
+ virtual void KeyInput( const KeyEvent& rEvt ) override;
+ virtual void LoseFocus() override;
+ virtual void GetFocus() override;
+ virtual void Resize() override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void Command( const CommandEvent& rEvt ) override;
+ virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) override;
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; // will forward everything got to the second AcceptDrop method
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; // will forward everything got to the second ExecuteDrop method
+
+ virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt );
+
+ // new handlers
+ virtual void MouseButtonDown( const BrowserMouseEvent& rEvt );
+ virtual void MouseButtonUp( const BrowserMouseEvent& rEvt );
+ void StartScroll();
+ virtual void EndScroll();
+ virtual void Select();
+ virtual void DoubleClick( const BrowserMouseEvent& rEvt );
+ virtual bool IsCursorMoveAllowed( sal_Int32 nNewRow, sal_uInt16 nNewColId ) const;
+ virtual void CursorMoved();
+ virtual void ColumnMoved( sal_uInt16 nColId );
+ virtual void ColumnResized( sal_uInt16 nColId );
+ /// called when the row height has been changed interactively
+ virtual void RowHeightChanged();
+ virtual tools::Long QueryMinimumRowHeight();
+
+ // Window-Control (pass to DataWindow)
+ void SetUpdateMode( bool bUpdate );
+ bool GetUpdateMode() const;
+
+ // map-mode and font control
+ void SetFont( const vcl::Font& rNewFont );
+ const vcl::Font& GetFont() const;
+ void SetTitleFont( const vcl::Font& rNewFont )
+ { Control::SetFont( rNewFont ); }
+
+ // inserting, changing, removing and freezing of columns
+ void InsertHandleColumn( sal_uLong nWidth );
+ void InsertDataColumn( sal_uInt16 nItemId, const OUString& rText,
+ tools::Long nSize, HeaderBarItemBits nBits = HeaderBarItemBits::STDSTYLE,
+ sal_uInt16 nPos = HEADERBAR_APPEND );
+ void SetColumnTitle( sal_uInt16 nColumnId, const OUString &rTitle );
+ void SetColumnWidth( sal_uInt16 nColumnId, sal_uLong nWidth );
+ void SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos );
+ void FreezeColumn( sal_uInt16 nColumnId );
+ void RemoveColumn( sal_uInt16 nColumnId );
+ void RemoveColumns();
+
+ // control of title and data row height
+ void SetDataRowHeight( tools::Long nPixel );
+ tools::Long GetDataRowHeight() const;
+ void SetTitleLines( sal_uInt16 nLines );
+ tools::Long GetTitleHeight() const;
+
+ // access to dynamic values of cursor row
+ OUString GetColumnTitle( sal_uInt16 nColumnId ) const;
+ tools::Rectangle GetFieldRect( sal_uInt16 nColumnId ) const;
+ sal_uLong GetColumnWidth( sal_uInt16 nColumnId ) const;
+ sal_uInt16 GetColumnId( sal_uInt16 nPos ) const;
+ sal_uInt16 GetColumnPos( sal_uInt16 nColumnId ) const;
+ bool IsFrozen( sal_uInt16 nColumnId ) const;
+
+ // movement of visible area
+ sal_Int32 ScrollColumns( sal_Int32 nColumns );
+ sal_Int32 ScrollRows( sal_Int32 nRows );
+ void MakeFieldVisible( sal_Int32 nRow, sal_uInt16 nColId );
+
+ // access and movement of cursor
+ sal_Int32 GetCurRow() const { return nCurRow; }
+ sal_uInt16 GetCurColumnId() const { return nCurColId; }
+ bool GoToRow( sal_Int32 nRow );
+ bool GoToColumnId( sal_uInt16 nColId );
+ bool GoToRowColumnId( sal_Int32 nRow, sal_uInt16 nColId );
+
+ // selections
+ virtual void SetNoSelection() override;
+ virtual void SelectAll() override;
+ virtual void SelectRow( sal_Int32 nRow, bool _bSelect = true, bool bExpand = true ) override;
+ void SelectColumnPos( sal_uInt16 nCol, bool _bSelect = true )
+ { SelectColumnPos( nCol, _bSelect, true); }
+ void SelectColumnId( sal_uInt16 nColId )
+ { SelectColumnPos( GetColumnPos(nColId), true, true); }
+ sal_Int32 GetSelectRowCount() const;
+ sal_uInt16 GetSelectColumnCount() const;
+ virtual bool IsRowSelected( sal_Int32 nRow ) const override;
+ bool IsColumnSelected( sal_uInt16 nColumnId ) const;
+ sal_Int32 FirstSelectedRow();
+ sal_Int32 LastSelectedRow();
+ sal_Int32 NextSelectedRow();
+ const MultiSelection* GetColumnSelection() const { return pColSel.get(); }
+ const MultiSelection* GetSelection() const
+ { return bMultiSelection ? uRow.pSel : nullptr; }
+
+ sal_Int32 FirstSelectedColumn( ) const;
+
+ bool IsResizing() const { return bResizing; }
+
+ // access to positions of fields, column and rows
+ BrowserDataWin& GetDataWindow() const;
+ tools::Rectangle GetRowRectPixel( sal_Int32 nRow ) const;
+ tools::Rectangle GetFieldRectPixel( sal_Int32 nRow, sal_uInt16 nColId,
+ bool bRelToBrowser = true) const;
+ bool IsFieldVisible( sal_Int32 nRow, sal_uInt16 nColId,
+ bool bComplete = false ) const;
+ sal_Int32 GetRowAtYPosPixel( tools::Long nY,
+ bool bRelToBrowser = true ) const;
+ sal_uInt16 GetColumnAtXPosPixel( tools::Long nX ) const;
+
+ // invalidations
+ void Clear();
+ void RowRemoved( sal_Int32 nRow, sal_Int32 nNumRows = 1, bool bDoPaint = true );
+ void RowModified( sal_Int32 nRow, sal_uInt16 nColId = BROWSER_INVALIDID );
+ void RowInserted( sal_Int32 nRow, sal_Int32 nNumRows = 1, bool bDoPaint = true, bool bKeepSelection = false );
+
+ // miscellaneous
+ bool ReserveControlArea(sal_uInt16 nWidth = USHRT_MAX);
+ tools::Rectangle GetControlArea() const;
+ virtual bool ProcessKey(const KeyEvent& rEvt);
+ virtual void ChildFocusIn();
+ virtual void ChildFocusOut();
+ void Dispatch( sal_uInt16 nId );
+ void SetMode( BrowserMode nMode );
+ BrowserMode GetMode( ) const { return m_nCurrentMode; }
+
+ void SetCursorColor(const Color& _rCol);
+
+ /** specifies that the user is allowed to interactively change the height of a row,
+ by simply dragging an arbitrary row separator.
+
+ Note that this works only if there's a handle column, since only in this case,
+ there *is* something for the user to click onto
+ */
+ void EnableInteractiveRowHeight() { mbInteractiveRowHeight = true; }
+ bool IsInteractiveRowHeightEnabled( ) const { return mbInteractiveRowHeight; }
+
+ /// access to selected methods, to be granted to the BrowserColumn
+ struct BrowserColumnAccess { friend class BrowserColumn; private: BrowserColumnAccess() { } };
+ /** public version of PaintField, with selected access rights for the BrowserColumn
+ */
+ void DoPaintField( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId, BrowserColumnAccess ) const
+ { PaintField( rDev, rRect, nColumnId ); }
+
+ /** suggests a default width for a column containing a given text
+
+ The width is calculated so that the text fits completely, plus some margin.
+ */
+ sal_uLong GetDefaultColumnWidth( const OUString& _rText ) const;
+
+ /** GetCellText returns the text at the given position
+ @param _nRow
+ the number of the row
+ @param _nColId
+ the ID of the column
+ @return
+ the text out of the cell
+ */
+ virtual OUString GetCellText(sal_Int32 _nRow, sal_uInt16 _nColId) const;
+
+ /** @return
+ the current column count
+ */
+ sal_uInt16 GetColumnCount() const override { return ColCount(); }
+
+ /** commitBrowseBoxEvent commit the event at all listeners of the browsebox
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ void commitBrowseBoxEvent(sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue);
+
+ /** commitTableEvent commit the event at all listeners of the table
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ void commitTableEvent(sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue);
+
+ /** fires an AccessibleEvent relative to a header bar AccessibleContext
+
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ void commitHeaderBarEvent(sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue,
+ bool _bColumnHeaderBar
+ );
+
+ /** returns the Rectangle for either the column header bar or the row header bar
+ @param _bIsColumnBar
+ <TRUE/> when column header bar is used
+ @param _bOnScreen
+ <TRUE/> when the rectangle should be calculated OnScreen
+ @return
+ the Rectangle
+ */
+ virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen = true) override;
+
+ /** calculates the Rectangle of the table
+ @param _bOnScreen
+ <TRUE/> when the rectangle should be calculated OnScreen
+ @return
+ the Rectangle
+ */
+ virtual tools::Rectangle calcTableRect(bool _bOnScreen = true) override;
+
+ /**
+ @param _nRowId
+ the current row
+ @param _nColId
+ the column id
+ @param _bOnScreen
+ <TRUE/> when the rectangle should be calculated OnScreen
+ @return
+ the Rectangle
+ */
+ virtual tools::Rectangle GetFieldRectPixelAbs(sal_Int32 _nRowId, sal_uInt16 _nColId, bool _bIsHeader, bool _bOnScreen = true) override;
+
+ /// return <TRUE/> if and only if the accessible object for this instance has been created and is alive
+ bool isAccessibleAlive( ) const;
+
+public:
+ /** Creates and returns the accessible object of the whole BrowseBox. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible > CreateAccessible() override;
+
+ // Children ---------------------------------------------------------------
+
+ /** Creates the accessible object of a data table cell.
+ @param nRow The row index of the cell.
+ @param nColumnId The column pos of the cell.
+ @return The XAccessible interface of the specified cell. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible >
+ CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnPos ) override;
+
+ /** Creates the accessible object of a row header.
+ @param nRow The row index of the header.
+ @return The XAccessible interface of the specified row header. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible >
+ CreateAccessibleRowHeader( sal_Int32 nRow ) override;
+
+ /** Creates the accessible object of a column header.
+ @param nColumnId The column ID of the header.
+ @return The XAccessible interface of the specified column header. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible >
+ CreateAccessibleColumnHeader( sal_uInt16 nColumnPos ) override;
+
+ /** @return The count of additional controls of the control area. */
+ virtual sal_Int32 GetAccessibleControlCount() const override;
+
+ /** Creates the accessible object of an additional control.
+ @param nIndex The 0-based index of the control.
+ @return The XAccessible interface of the specified control. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible >
+ CreateAccessibleControl( sal_Int32 nIndex ) override;
+
+ /** Converts a point relative to the data window origin to a cell address.
+ @param rnRow Out-parameter that takes the row index.
+ @param rnColumnId Out-parameter that takes the column ID.
+ @param rPoint The position in pixels relative to the data window.
+ @return <TRUE/>, if the point could be converted to a valid address. */
+ virtual bool ConvertPointToCellAddress(
+ sal_Int32& rnRow, sal_uInt16& rnColumnId, const Point& rPoint ) override;
+
+ /** Converts a point relative to the row header bar origin to a row header
+ index.
+ @param rnRow Out-parameter that takes the row index.
+ @param rPoint The position in pixels relative to the header bar.
+ @return <TRUE/>, if the point could be converted to a valid index. */
+ virtual bool ConvertPointToRowHeader( sal_Int32& rnRow, const Point& rPoint ) override;
+
+ /** Converts a point relative to the column header bar origin to a column
+ header index.
+ @param rnColumnId Out-parameter that takes the column ID.
+ @param rPoint The position in pixels relative to the header bar.
+ @return <TRUE/>, if the point could be converted to a valid index. */
+ virtual bool ConvertPointToColumnHeader( sal_uInt16& rnColumnPos, const Point& rPoint ) override;
+
+ /** Converts a point relative to the BrowseBox origin to the index of an
+ existing control.
+ @param rnRow Out-parameter that takes the 0-based control index.
+ @param rPoint The position in pixels relative to the BrowseBox.
+ @return <TRUE/>, if the point could be converted to a valid index. */
+ virtual bool ConvertPointToControlIndex( sal_Int32& rnIndex, const Point& rPoint ) override;
+
+ /** return the name of the specified object.
+ @param eObjType
+ The type to ask for
+ @param _nPosition
+ The position of a tablecell (index position), header bar column/row cell
+ @return
+ The name of the specified object.
+ */
+ virtual OUString GetAccessibleObjectName( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
+
+ /** return the description of the specified object.
+ @param eObjType
+ The type to ask for
+ @param _nPosition
+ The position of a tablecell (index position), header bar column/row cell
+ @return
+ The description of the specified object.
+ */
+ virtual OUString GetAccessibleObjectDescription( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
+
+ /** @return The header text of the specified row. */
+ virtual OUString GetRowDescription( sal_Int32 nRow ) const override;
+
+ /** @return The header text of the specified column. */
+ virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const override;
+
+ /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
+ the accessible object), depending on the specified object type. */
+ virtual void FillAccessibleStateSet(
+ ::utl::AccessibleStateSetHelper& rStateSet,
+ AccessibleBrowseBoxObjType eObjType ) const override;
+
+ /** Fills the StateSet with all states for one cell (except DEFUNC and SHOWING, done by
+ the accessible object). */
+ virtual void FillAccessibleStateSetForCell(
+ ::utl::AccessibleStateSetHelper& _rStateSet,
+ sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
+
+ /** Sets focus to current cell of the data table. */
+ virtual void GrabTableFocus() override;
+
+ // IAccessibleTableProvider
+ virtual sal_Int32 GetCurrRow() const override;
+ virtual sal_uInt16 GetCurrColumn() const override;
+ virtual bool HasRowHeader() const override;
+ virtual bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
+ virtual void SelectColumn( sal_uInt16 _nColumn, bool _bSelect = true ) override;
+ virtual bool IsColumnSelected( sal_Int32 _nColumn ) const override;
+ virtual sal_Int32 GetSelectedRowCount() const override;
+ virtual sal_Int32 GetSelectedColumnCount() const override;
+ virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const override;
+ virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const override;
+ virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
+ virtual OUString GetAccessibleCellText(sal_Int32 _nRow, sal_uInt16 _nColPos) const override;
+ virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) override;
+ virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const override;
+ virtual void GrabFocus() override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;
+ virtual vcl::Window* GetAccessibleParentWindow() const override;
+ virtual vcl::Window* GetWindowInstance() override;
+
+private:
+ // the following declares some Window/OutputDevice methods private. This happened in the course
+ // of CWS warnings01, which pointed out nameclashs in those methods. If the build breaks in some
+ // upper module, you should investigate whether you really wanted to call base class methods,
+ // or the versions at this class. In the latter case, use the renamed versions above.
+
+ // ToTop/ToBottom were never property implemented. If you currently call it, this is most probably wrong
+ // and not doing as intended
+ using Window::ToTop;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/brwhead.hxx b/include/svtools/brwhead.hxx
new file mode 100644
index 000000000..6d753e0ee
--- /dev/null
+++ b/include/svtools/brwhead.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <vcl/headbar.hxx>
+
+class BrowseBox;
+
+
+class SVT_DLLPUBLIC BrowserHeader: public HeaderBar
+{
+ VclPtr<BrowseBox> _pBrowseBox;
+
+public:
+ virtual ~BrowserHeader() override;
+ virtual void dispose() override;
+protected:
+ virtual void Command( const CommandEvent& rCEvt ) override;
+ virtual void EndDrag() override;
+
+public:
+ BrowserHeader( BrowseBox* pParent, WinBits nWinBits = WB_STDHEADERBAR | WB_DRAG );
+
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/cliplistener.hxx b/include/svtools/cliplistener.hxx
new file mode 100644
index 000000000..fb0452f67
--- /dev/null
+++ b/include/svtools/cliplistener.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <tools/link.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
+
+namespace vcl { class Window; }
+
+class TransferableDataHelper;
+
+class SVT_DLLPUBLIC TransferableClipboardListener final : public cppu::WeakImplHelper<
+ css::datatransfer::clipboard::XClipboardListener >
+{
+ Link<TransferableDataHelper*,void> aLink;
+
+ void AddRemoveListener( vcl::Window* pWin, bool bAdd );
+public:
+ // Link is called with a TransferableDataHelper pointer
+ TransferableClipboardListener( const Link<TransferableDataHelper*,void>& rCallback );
+ virtual ~TransferableClipboardListener() override;
+
+ void AddListener( vcl::Window* pWin ) { AddRemoveListener(pWin, true); }
+ void RemoveListener( vcl::Window* pWin ) { AddRemoveListener(pWin, false); }
+ void ClearCallbackLink();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+ // XClipboardListener
+ virtual void SAL_CALL changedContents( const css::datatransfer::clipboard::ClipboardEvent& event ) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/collatorres.hxx b/include/svtools/collatorres.hxx
new file mode 100644
index 000000000..9da09b152
--- /dev/null
+++ b/include/svtools/collatorres.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+
+class SVT_DLLPUBLIC CollatorResource
+{
+private:
+ // wrapper for locale specific translations data of collator algorithm
+ class CollatorResourceData
+ {
+ friend class CollatorResource;
+
+ private:
+ OUString m_aName;
+ OUString m_aTranslation;
+
+ public:
+ CollatorResourceData(const OUString& rAlgorithm, const OUString& rTranslation)
+ : m_aName(rAlgorithm)
+ , m_aTranslation(rTranslation)
+ {
+ }
+ const OUString& GetAlgorithm() const { return m_aName; }
+ const OUString& GetTranslation() const { return m_aTranslation; }
+ };
+ std::vector<CollatorResourceData> m_aData;
+
+public:
+ CollatorResource();
+ const OUString& GetTranslation(const OUString& rAlgorithm);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx
new file mode 100644
index 000000000..562d4a3e4
--- /dev/null
+++ b/include/svtools/colorcfg.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <unotools/options.hxx>
+#include <memory>
+
+
+namespace svtools{
+enum ColorConfigEntry
+{
+ DOCCOLOR ,
+ DOCBOUNDARIES ,
+ APPBACKGROUND ,
+ OBJECTBOUNDARIES ,
+ TABLEBOUNDARIES ,
+ FONTCOLOR ,
+ LINKS ,
+ LINKSVISITED ,
+ SPELL ,
+ SMARTTAGS ,
+ SHADOWCOLOR ,
+ WRITERTEXTGRID ,
+ WRITERFIELDSHADINGS ,
+ WRITERIDXSHADINGS ,
+ WRITERDIRECTCURSOR ,
+ WRITERSCRIPTINDICATOR,
+ WRITERSECTIONBOUNDARIES,
+ WRITERHEADERFOOTERMARK,
+ WRITERPAGEBREAKS,
+ HTMLSGML ,
+ HTMLCOMMENT ,
+ HTMLKEYWORD ,
+ HTMLUNKNOWN ,
+ CALCGRID ,
+ CALCPAGEBREAK ,
+ CALCPAGEBREAKMANUAL,
+ CALCPAGEBREAKAUTOMATIC,
+ CALCHIDDENROWCOL ,
+ CALCDETECTIVE ,
+ CALCDETECTIVEERROR ,
+ CALCREFERENCE ,
+ CALCNOTESBACKGROUND ,
+ CALCVALUE,
+ CALCFORMULA,
+ CALCTEXT,
+ CALCPROTECTEDBACKGROUND,
+ DRAWGRID ,
+ BASICIDENTIFIER,
+ BASICCOMMENT ,
+ BASICNUMBER ,
+ BASICSTRING ,
+ BASICOPERATOR ,
+ BASICKEYWORD ,
+ BASICERROR ,
+ SQLIDENTIFIER,
+ SQLNUMBER,
+ SQLSTRING,
+ SQLOPERATOR,
+ SQLKEYWORD,
+ SQLPARAMETER,
+ SQLCOMMENT,
+ ColorConfigEntryCount
+};
+
+class ColorConfig_Impl;
+struct ColorConfigValue
+{
+
+ bool bIsVisible; //validity depends on the element type
+ ::Color nColor;
+ ColorConfigValue() : bIsVisible(false), nColor(0) {}
+ bool operator !=(const ColorConfigValue& rCmp) const
+ { return nColor != rCmp.nColor || bIsVisible != rCmp.bIsVisible;}
+};
+
+class SVT_DLLPUBLIC ColorConfig final :
+ public utl::detail::Options
+{
+ friend class ColorConfig_Impl;
+private:
+ static ColorConfig_Impl* m_pImpl;
+public:
+ ColorConfig();
+ virtual ~ColorConfig() override;
+
+ // get the configured value - if bSmart is set the default color setting is provided
+ // instead of the automatic color
+ ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart = true) const;
+ static Color GetDefaultColor(ColorConfigEntry eEntry);
+};
+
+class SVT_DLLPUBLIC EditableColorConfig
+{
+ std::unique_ptr<ColorConfig_Impl> m_pImpl;
+ bool m_bModified;
+public:
+ EditableColorConfig();
+ ~EditableColorConfig();
+
+ css::uno::Sequence< OUString > GetSchemeNames() const;
+ void DeleteScheme(const OUString& rScheme );
+ void AddScheme(const OUString& rScheme );
+ void LoadScheme(const OUString& rScheme );
+ const OUString& GetCurrentSchemeName() const;
+ void SetCurrentSchemeName(const OUString& rScheme);
+
+ const ColorConfigValue& GetColorValue(ColorConfigEntry eEntry) const;
+ void SetColorValue(ColorConfigEntry eEntry, const ColorConfigValue& rValue);
+ void SetModified();
+ void ClearModified() {m_bModified = false;}
+ bool IsModified() const {return m_bModified;}
+ void Commit();
+
+ void DisableBroadcast();
+ void EnableBroadcast();
+};
+}//namespace svtools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/colrdlg.hxx b/include/svtools/colrdlg.hxx
new file mode 100644
index 000000000..a8785ad8a
--- /dev/null
+++ b/include/svtools/colrdlg.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <tools/color.hxx>
+#include <tools/link.hxx>
+#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
+
+#include <functional>
+
+namespace weld { class Window; }
+
+namespace svtools
+{
+ // Select is the default.
+ // These values must match the constants used in ColorPickerDialog in cui/source/dialogs/colorpicker.cxx
+ enum class ColorPickerMode { Select = 0, Modify = 2 };
+}
+
+class SVT_DLLPUBLIC SvColorDialog final
+{
+public:
+ SvColorDialog();
+ ~SvColorDialog();
+
+ void SetColor( const Color& rColor );
+ const Color& GetColor() const { return maColor;}
+
+ void SetMode( svtools::ColorPickerMode eMode );
+
+ short Execute(weld::Window* pParent);
+ void ExecuteAsync(weld::Window* pParent, const std::function<void(sal_Int32)>& func);
+
+private:
+ Color maColor;
+ svtools::ColorPickerMode meMode;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog > mxDialog;
+ std::function<void(sal_Int32)> m_aResultFunc;
+
+ DECL_DLLPRIVATE_LINK( DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
new file mode 100644
index 000000000..180fb64bf
--- /dev/null
+++ b/include/svtools/ctrlbox.hxx
@@ -0,0 +1,505 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <editeng/borderline.hxx>
+#include <vcl/idle.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/weld.hxx>
+
+#include <memory>
+
+namespace weld { class CustomWeld; }
+
+class BitmapEx;
+class BorderWidthImpl;
+class FontList;
+class VclSimpleEvent;
+class VirtualDevice;
+
+/** Utility class storing the border line width, style and colors. The widths
+ are defined in Twips.
+ */
+class ImpLineListData
+{
+private:
+ BorderWidthImpl const m_aWidthImpl;
+
+ Color ( * m_pColor1Fn )( Color );
+ Color ( * m_pColor2Fn )( Color );
+ Color ( * m_pColorDistFn )( Color, Color );
+
+ tools::Long m_nMinWidth;
+ SvxBorderLineStyle m_nStyle;
+
+public:
+ ImpLineListData( BorderWidthImpl aWidthImpl,
+ SvxBorderLineStyle nStyle, tools::Long nMinWidth, Color ( *pColor1Fn )( Color ),
+ Color ( *pColor2Fn )( Color ), Color ( *pColorDistFn )( Color, Color ) ) :
+ m_aWidthImpl( aWidthImpl ),
+ m_pColor1Fn( pColor1Fn ),
+ m_pColor2Fn( pColor2Fn ),
+ m_pColorDistFn( pColorDistFn ),
+ m_nMinWidth( nMinWidth ),
+ m_nStyle( nStyle )
+ {
+ }
+
+ /** Returns the computed width of the line 1 in twips. */
+ tools::Long GetLine1ForWidth( tools::Long nWidth ) const { return m_aWidthImpl.GetLine1( nWidth ); }
+
+ /** Returns the computed width of the line 2 in twips. */
+ tools::Long GetLine2ForWidth( tools::Long nWidth ) const { return m_aWidthImpl.GetLine2( nWidth ); }
+
+ /** Returns the computed width of the gap in twips. */
+ tools::Long GetDistForWidth( tools::Long nWidth ) const { return m_aWidthImpl.GetGap( nWidth ); }
+
+ Color GetColorLine1( const Color& rMain ) const
+ {
+ return ( *m_pColor1Fn )( rMain );
+ }
+
+ Color GetColorLine2( const Color& rMain ) const
+ {
+ return ( *m_pColor2Fn )( rMain );
+ }
+
+ Color GetColorDist( const Color& rMain, const Color& rDefault ) const
+ {
+ return ( *m_pColorDistFn )( rMain, rDefault );
+ }
+
+ /** Returns the minimum width in twips */
+ tools::Long GetMinWidth( ) const { return m_nMinWidth;}
+ SvxBorderLineStyle GetStyle( ) const { return m_nStyle;}
+};
+
+enum class SvxBorderLineStyle : sal_Int16;
+
+typedef ::std::vector< FontMetric > ImplFontList;
+
+/*************************************************************************
+
+class LineListBox
+
+Description
+
+Allows selection of line styles and sizes. Note that before first insert,
+units and window size need to be set. Supported units are typographic point
+(pt) and millimeters (mm). For SourceUnit, pt, mm and twips are supported.
+All scalar numbers in 1/100 of the corresponding unit.
+
+Line1 is the outer, Line2 the inner line, Distance is the distance between
+these two lines. If Line2 == 0, only Line1 will be shown. Defaults for
+source and target unit are FieldUnit::POINT.
+
+SetColor() sets the line color.
+
+Remarks
+
+Contrary to a simple ListBox, user-specific data are not supported.
+If UpdateMode is disabled, no data should be read, no selections
+should be set, and the return code shall be ignore, as in these are
+not defined in this mode. Also the bit WinBit WB_SORT may not be set.
+
+--------------------------------------------------------------------------
+
+class FontNameBox
+
+Description
+
+Allows selection of fonts. The ListBox will be filled using Fill parameter,
+which is pointer to an FontList object.
+
+Calling EnableWYSIWYG() enables rendering the font name in the currently
+selected font.
+
+See also
+
+FontList; FontStyleBox; FontSizeBox; FontNameMenu
+
+--------------------------------------------------------------------------
+
+class FontStyleBox
+
+Description
+
+Allows select of FontStyle's. The parameter Fill points to a list
+of available font styles for the font.
+
+Reproduced styles are always added - this could change in future, as
+potentially not all applications [Draw,Equation,FontWork] can properly
+handle synthetic fonts. On filling, the previous name will be retained
+if possible.
+
+For DontKnow, the FontStyleBox should be filled with OUString(),
+so it will contain a list with the default attributes. The currently
+shown style probably needs to be reset by the application.
+
+See also
+
+FontList; FontNameBox; FontSizeBox;
+
+--------------------------------------------------------------------------
+
+class FontSizeBox
+
+Description
+
+Allows selection of font sizes. The values are retrieved via GetValue()
+and set via SetValue(). The Fill parameter fills the ListBox with the
+available sizes for the passed font.
+
+All sizes are in 1/10 typographic point (pt).
+
+The passed FontList must be retained until the next fill call.
+
+Additionally it supports a relative mod, which allows entering
+percentage values. This, eg., can be useful for template dialogs.
+This mode can only be enabled, but not disabled again.
+
+For DontKnow the FontSizeBox should be filled FontMetric(), so it will
+contain a list with the standard sizes. Th currently shown size
+probably needs to be reset by the application.
+
+See also
+
+FontList; FontNameBox; FontStyleBox; FontSizeMenu
+
+*************************************************************************/
+
+inline Color sameColor( Color rMain )
+{
+ return rMain;
+}
+
+inline Color sameDistColor( Color /*rMain*/, Color rDefault )
+{
+ return rDefault;
+}
+
+class ValueSet;
+
+class SVT_DLLPUBLIC SvtLineListBox
+{
+public:
+ typedef Color (*ColorFunc)(Color);
+ typedef Color (*ColorDistFunc)(Color, Color);
+
+ SvtLineListBox(std::unique_ptr<weld::MenuButton> pControl);
+ ~SvtLineListBox();
+
+ static OUString GetLineStyleName(SvxBorderLineStyle eStyle);
+
+ /** Set the width in Twips */
+ void SetWidth(tools::Long nWidth)
+ {
+ m_nWidth = nWidth;
+ UpdateEntries();
+ UpdatePreview();
+ }
+
+ tools::Long GetWidth() const { return m_nWidth; }
+
+ /** Insert a listbox entry with all widths in Twips. */
+ void InsertEntry(const BorderWidthImpl& rWidthImpl,
+ SvxBorderLineStyle nStyle, tools::Long nMinWidth = 0,
+ ColorFunc pColor1Fn = &sameColor,
+ ColorFunc pColor2Fn = &sameColor,
+ ColorDistFunc pColorDistFn = &sameDistColor);
+
+ void SelectEntry( SvxBorderLineStyle nStyle );
+ SvxBorderLineStyle GetSelectEntryStyle() const;
+
+ void SetSourceUnit( FieldUnit eNewUnit ) { eSourceUnit = eNewUnit; }
+
+ void SetColor( const Color& rColor )
+ {
+ aColor = rColor;
+ UpdateEntries();
+ UpdatePreview();
+ }
+
+ const Color& GetColor() const { return aColor; }
+
+ void SetSelectHdl(const Link<SvtLineListBox&,void>& rLink) { maSelectHdl = rLink; }
+
+ void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
+
+private:
+
+ SVT_DLLPRIVATE void ImpGetLine( tools::Long nLine1, tools::Long nLine2, tools::Long nDistance,
+ Color nColor1, Color nColor2, Color nColorDist,
+ SvxBorderLineStyle nStyle, BitmapEx& rBmp );
+
+ void UpdatePaintLineColor(); // returns sal_True if maPaintCol has changed
+ DECL_DLLPRIVATE_LINK(ValueSelectHdl, ValueSet*, void);
+ DECL_DLLPRIVATE_LINK(FocusHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(ToggleHdl, weld::Toggleable&, void);
+ DECL_DLLPRIVATE_LINK(NoneHdl, weld::Button&, void);
+
+ void UpdateEntries();
+ sal_Int32 GetStylePos(sal_Int32 nListPos) const;
+
+ const Color& GetPaintColor() const
+ {
+ return maPaintCol;
+ }
+ Color GetColorLine1( sal_Int32 nPos );
+ Color GetColorLine2( sal_Int32 nPos );
+ Color GetColorDist( sal_Int32 nPos );
+
+ void UpdatePreview();
+
+ SvtLineListBox( const SvtLineListBox& ) = delete;
+ SvtLineListBox& operator =( const SvtLineListBox& ) = delete;
+
+ std::unique_ptr<weld::MenuButton> m_xControl;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Widget> m_xTopLevel;
+ std::unique_ptr<weld::Button> m_xNoneButton;
+ std::unique_ptr<ValueSet> m_xLineSet;
+ std::unique_ptr<weld::CustomWeld> m_xLineSetWin;
+
+ std::vector<std::unique_ptr<ImpLineListData>> m_vLineList;
+ tools::Long m_nWidth;
+ ScopedVclPtr<VirtualDevice> aVirDev;
+ Color aColor;
+ Color maPaintCol;
+ FieldUnit eSourceUnit;
+ Link<SvtLineListBox&,void> maSelectHdl;
+};
+
+class SVT_DLLPUBLIC SvtCalendarBox
+{
+public:
+ SvtCalendarBox(std::unique_ptr<weld::MenuButton> pControl, bool bUseLabel = true);
+ ~SvtCalendarBox();
+
+ weld::MenuButton& get_button() { return *m_xControl; }
+
+ void set_date(const Date& rDate);
+ Date get_date() const { return m_xCalendar->get_date(); }
+
+ void set_label(const OUString& rLabel) { m_xControl->set_label(rLabel); }
+ OUString get_label() const { return m_xControl->get_label(); }
+
+ void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
+ bool get_sensitive() const { return m_xControl->get_sensitive(); }
+ void set_visible(bool bSensitive) { m_xControl->set_visible(bSensitive); }
+ void show() { set_visible(true); }
+ void grab_focus() { m_xControl->grab_focus(); }
+
+ void connect_activated(const Link<SvtCalendarBox&, void>& rActivatedHdl) { m_aActivatedHdl = rActivatedHdl; }
+ void connect_selected(const Link<SvtCalendarBox&, void>& rSelectHdl) { m_aSelectHdl = rSelectHdl; }
+
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink) { m_xControl->connect_focus_in(rLink); }
+ void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_xControl->connect_focus_out(rLink); }
+private:
+ DECL_DLLPRIVATE_LINK(SelectHdl, weld::Calendar&, void);
+ DECL_DLLPRIVATE_LINK(ActivateHdl, weld::Calendar&, void);
+
+ bool m_bUseLabel;
+
+ std::unique_ptr<weld::MenuButton> m_xControl;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Widget> m_xTopLevel;
+ std::unique_ptr<weld::Calendar> m_xCalendar;
+
+ Link<SvtCalendarBox&, void> m_aActivatedHdl;
+ Link<SvtCalendarBox&, void> m_aSelectHdl;
+
+ void set_label_from_date();
+};
+
+class SVT_DLLPUBLIC FontNameBox
+{
+private:
+ std::unique_ptr<weld::ComboBox> m_xComboBox;
+ std::unique_ptr<ImplFontList> mpFontList;
+ size_t mnPreviewProgress;
+ bool mbWYSIWYG;
+ OUString maFontMRUEntriesFile;
+ Idle maUpdateIdle;
+
+ SVT_DLLPRIVATE void ImplDestroyFontList();
+
+ DECL_DLLPRIVATE_LINK(CustomRenderHdl, weld::ComboBox::render_args, void);
+ DECL_DLLPRIVATE_LINK(CustomGetSizeHdl, OutputDevice&, Size);
+ DECL_DLLPRIVATE_LINK(SettingsChangedHdl, VclSimpleEvent&, void);
+ DECL_DLLPRIVATE_LINK(UpdateHdl, Timer*, void);
+
+ void LoadMRUEntries( const OUString& aFontMRUEntriesFile );
+ void SaveMRUEntries( const OUString& aFontMRUEntriesFile ) const;
+
+ OutputDevice& CachePreview(size_t nIndex, Point* pTopLeft);
+
+public:
+ FontNameBox(std::unique_ptr<weld::ComboBox> p);
+ ~FontNameBox();
+
+ void Fill( const FontList* pList );
+
+ void EnableWYSIWYG(bool bEnable);
+ bool IsWYSIWYGEnabled() const { return mbWYSIWYG; }
+
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xComboBox->connect_changed(rLink); }
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink) { m_xComboBox->connect_focus_in(rLink); }
+ void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_xComboBox->connect_focus_out(rLink); }
+ void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_xComboBox->connect_key_press(rLink); }
+ int get_active() const { return m_xComboBox->get_active(); }
+ OUString get_active_text() const { return m_xComboBox->get_active_text(); }
+ void set_active_or_entry_text(const OUString& rText);
+ void set_active(int nPos) { m_xComboBox->set_active(nPos); }
+ int get_count() const { return m_xComboBox->get_count(); }
+ OUString get_text(int nIndex) const { return m_xComboBox->get_text(nIndex); }
+ void set_sensitive(bool bSensitive) { m_xComboBox->set_sensitive(bSensitive); }
+ void save_value() { m_xComboBox->save_value(); }
+ OUString const& get_saved_value() const { return m_xComboBox->get_saved_value(); }
+ void select_entry_region(int nStartPos, int nEndPos) { m_xComboBox->select_entry_region(nStartPos, nEndPos); }
+ bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) { return m_xComboBox->get_entry_selection_bounds(rStartPos, rEndPos); }
+ void clear() { m_xComboBox->clear(); }
+ void grab_focus() { m_xComboBox->grab_focus(); }
+ bool has_focus() const { return m_xComboBox->has_focus(); }
+ void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xComboBox->connect_entry_activate(rLink); }
+ void connect_get_property_tree(const Link<tools::JsonWriter&, void>& rLink) { m_xComboBox->connect_get_property_tree(rLink); }
+ void set_entry_width_chars(int nWidth) { m_xComboBox->set_entry_width_chars(nWidth); }
+ void set_size_request(int nWidth, int nHeight) { m_xComboBox->set_size_request(nWidth, nHeight); }
+ int get_max_mru_count() const { return m_xComboBox->get_max_mru_count(); }
+ void set_max_mru_count(int nCount) { m_xComboBox->set_max_mru_count(nCount); }
+
+ // font size is in points, not pixels, e.g. see Window::[G]etPointFont
+ void set_entry_font(const vcl::Font& rFont) { m_xComboBox->set_entry_font(rFont); }
+ vcl::Font get_entry_font() { return m_xComboBox->get_entry_font(); }
+
+ void set_tooltip_text(const OUString& rTip) { m_xComboBox->set_tooltip_text(rTip); }
+
+private:
+ void InitFontMRUEntriesFile();
+
+ FontNameBox( const FontNameBox& ) = delete;
+ FontNameBox& operator =( const FontNameBox& ) = delete;
+};
+
+class SVT_DLLPUBLIC FontStyleBox
+{
+ std::unique_ptr<weld::ComboBox> m_xComboBox;
+public:
+ FontStyleBox(std::unique_ptr<weld::ComboBox> p);
+
+ void Fill(std::u16string_view rName, const FontList* pList);
+
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xComboBox->connect_changed(rLink); }
+ OUString get_active_text() const { return m_xComboBox->get_active_text(); }
+ void set_active_text(const OUString& rText) { m_xComboBox->set_active_text(rText); }
+ void set_size_request(int nWidth, int nHeight) { m_xComboBox->set_size_request(nWidth, nHeight); }
+
+ void append_text(const OUString& rStr) { m_xComboBox->append_text(rStr); }
+ void set_sensitive(bool bSensitive) { m_xComboBox->set_sensitive(bSensitive); }
+ void save_value() { m_xComboBox->save_value(); }
+ OUString const& get_saved_value() const { return m_xComboBox->get_saved_value(); }
+ int get_count() const { return m_xComboBox->get_count(); }
+ int find_text(const OUString& rStr) const { return m_xComboBox->find_text(rStr); }
+private:
+ FontStyleBox(const FontStyleBox& ) = delete;
+ FontStyleBox& operator=(const FontStyleBox&) = delete;
+};
+
+class SVT_DLLPUBLIC FontSizeBox
+{
+ const FontList* pFontList;
+ int nSavedValue;
+ int nMin;
+ int nMax;
+ FieldUnit eUnit;
+ sal_uInt16 nDecimalDigits;
+ sal_uInt16 nRelMin;
+ sal_uInt16 nRelMax;
+ sal_uInt16 nRelStep;
+ short nPtRelMin;
+ short nPtRelMax;
+ short nPtRelStep;
+ bool bRelativeMode:1,
+ bRelative:1,
+ bPtRelative:1,
+ bStdSize:1;
+ Link<weld::ComboBox&, void> m_aChangeHdl;
+ Link<weld::Widget&, void> m_aFocusOutHdl;
+ std::unique_ptr<weld::ComboBox> m_xComboBox;
+
+ sal_uInt16 GetDecimalDigits() const { return nDecimalDigits; }
+ void SetDecimalDigits(sal_uInt16 nDigits) { nDecimalDigits = nDigits; }
+ FieldUnit GetUnit() const { return eUnit; }
+ void SetUnit(FieldUnit _eUnit) { eUnit = _eUnit; }
+ void SetRange(int nNewMin, int nNewMax) { nMin = nNewMin; nMax = nNewMax; }
+ void SetValue(int nNewValue, FieldUnit eInUnit);
+
+ void InsertValue(int i);
+
+ OUString format_number(int nValue) const;
+
+ DECL_DLLPRIVATE_LINK(ModifyHdl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(ReformatHdl, weld::Widget&, void);
+public:
+ FontSizeBox(std::unique_ptr<weld::ComboBox> p);
+
+ void Fill(const FontList* pList);
+
+ void EnableRelativeMode(sal_uInt16 nMin, sal_uInt16 nMax, sal_uInt16 nStep = 5);
+ void EnablePtRelativeMode(short nMin, short nMax, short nStep = 10);
+ bool IsRelativeMode() const { return bRelativeMode; }
+ void SetRelative( bool bRelative );
+ bool IsRelative() const { return bRelative; }
+ void SetPtRelative( bool bPtRel )
+ {
+ bPtRelative = bPtRel;
+ SetRelative(true);
+ }
+ bool IsPtRelative() const { return bPtRelative; }
+
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_aChangeHdl = rLink; }
+ void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_aFocusOutHdl = rLink; }
+ void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_xComboBox->connect_key_press(rLink); }
+ OUString get_active_text() const { return m_xComboBox->get_active_text(); }
+ void set_active_or_entry_text(const OUString& rText);
+ void set_sensitive(bool bSensitive) { m_xComboBox->set_sensitive(bSensitive); }
+ void set_size_request(int nWidth, int nHeight) { m_xComboBox->set_size_request(nWidth, nHeight); }
+
+ int get_active() const { return m_xComboBox->get_active(); }
+ int get_value() const;
+ void set_value(int nValue);
+ void save_value() { nSavedValue = get_value(); }
+ int get_saved_value() const { return nSavedValue; }
+ bool get_value_changed_from_saved() const { return get_value() != get_saved_value(); }
+ int get_count() const { return m_xComboBox->get_count(); }
+ OUString get_text(int i) const { return m_xComboBox->get_text(i); }
+ void grab_focus() { m_xComboBox->grab_focus(); }
+ bool has_focus() const { return m_xComboBox->has_focus(); }
+ void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xComboBox->connect_entry_activate(rLink); }
+ void disable_entry_completion() { m_xComboBox->set_entry_completion(false, false); }
+ void connect_get_property_tree(const Link<tools::JsonWriter&, void>& rLink) { m_xComboBox->connect_get_property_tree(rLink); }
+
+private:
+ FontSizeBox(const FontSizeBox&) = delete;
+ FontSizeBox& operator=(const FontSizeBox&) = delete;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx
new file mode 100644
index 000000000..d70a49177
--- /dev/null
+++ b/include/svtools/ctrltool.hxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <svtools/svtdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vcl/metric.hxx>
+#include <vcl/vclptr.hxx>
+
+#include <vector>
+#include <memory>
+#include <string_view>
+
+class ImplFontListNameInfo;
+class OutputDevice;
+
+/*
+
+Description
+============
+
+class FontList
+
+This class manages all fonts which can be display on one or two output devices.
+Additionally, this class offers methods for generating the StyleName from
+bold and italics or the missing attributes from a StyleName.
+Furthermore, this class can handle synthetically reproduced fonts.
+It also works with several standard controls and standard menus.
+
+Links:
+
+class FontNameBox, class FontStyleBox, class FontSizeBox,
+class FontNameMenu, class FontSizeMenu
+
+--------------------------------------------------------------------------
+
+FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2 = NULL,
+ bool bAll = true );
+
+Constructor of the FontList class. The relevant fonts will be queried from
+the OutputDevice. The OutputDevice needs to exist as long as the FontList
+class exists. Optionally, a second output device can be given in order to,
+e.g., manage the fonts from both, a printer and a screen in a single FontList
+and thus also give FontMenus the fonts if both OutputDevices.
+The pDevice2 needs to exist as long as the FontList class exists.
+
+The OutputDevice given first should be the preferred one. This is usually
+the printer. Because if two different device fonts (one for the printer and
+one for the screen) exist, the ones from the "pDevice" are preferred.
+
+The third parameter governs whether only scalable or all fonts shall be queried.
+With sal_True bitmap fonts will also be queried.
+With sal_False vectorized and scalable fonts will be queried.
+
+--------------------------------------------------------------------------
+
+String FontList::GetStyleName( const FontMetric& rFontMetric ) const;
+
+This method returns the StyleName of a FontMetric.
+If no StyleName is set, a name will be generated from the set attributes.
+
+--------------------------------------------------------------------------
+
+OUString FontList::GetFontMapText( const FontMetric& rFontMetric ) const;
+
+This method returns a Matchstring which indicates the problem that could
+arise when using a font. This string should be displayed to the user.
+
+--------------------------------------------------------------------------
+
+FontMetric FontList::Get( const String& rName, const String& rStyleName ) const;
+
+This method search a FontMetric for the given name and the given style name.
+The Stylename can also be a synthetic one.
+In that case the relevant FontMetric fields will be set.
+If a StyleName is provided, a FontMetric structure without a Stylename can be
+returned. To get a representation of the StyleName for displaying it to the user,
+call GetStyleName() on this FontMetric structure.
+
+Links:
+
+FontList::GetStyleName()
+
+--------------------------------------------------------------------------
+
+FontMetric FontList::Get( const String& rName, FontWeight eWeight,
+ FontItalic eItalic ) const;
+
+This method search a FontMetric structure for a provided name and styles.
+This method can also return a FontMetric without a Stylename.
+To get a representation of the StyleName to be presented to the user
+call GetStyleName() with this FontMetric.
+
+Links:
+
+FontList::GetStyleName()
+
+--------------------------------------------------------------------------
+
+static const int* FontList::GetStdSizeAry();
+
+This method returns the available sizes for the given font.
+As all fonts are scalable, standard sizes are returned.
+The array contains the heights of the font in tenth (1/10) point.
+The last value of the array is 0.
+The returned array will destroyed by the FontList.
+You should thus not reference the array after the next method call on the
+FontList.
+*/
+
+class SVT_DLLPUBLIC FontList
+{
+private:
+ static const int aStdSizeAry[];
+
+ OUString maMapBoth;
+ OUString maMapPrinterOnly;
+ OUString maMapStyleNotAvailable;
+ mutable OUString maMapNotAvailable;
+ OUString maLight;
+ OUString maLightItalic;
+ OUString maNormal;
+ OUString maNormalItalic;
+ OUString maBold;
+ OUString maBoldItalic;
+ OUString maBlack;
+ OUString maBlackItalic;
+ VclPtr<OutputDevice> mpDev;
+ VclPtr<OutputDevice> mpDev2;
+ std::vector<std::unique_ptr<ImplFontListNameInfo>> m_Entries;
+
+ SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( std::u16string_view rSearchName, sal_uInt32* pIndex ) const;
+ SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( std::u16string_view rStr ) const;
+ SVT_DLLPRIVATE void ImplInsertFonts(OutputDevice* pDev, bool bInsertData);
+
+public:
+ FontList( OutputDevice* pDevice,
+ OutputDevice* pDevice2 = nullptr);
+ ~FontList();
+
+ std::unique_ptr<FontList> Clone() const;
+
+ OUString GetFontMapText( const FontMetric& rFontMetric ) const;
+
+ const OUString& GetNormalStr() const { return maNormal; }
+ const OUString& GetItalicStr() const { return maNormalItalic; }
+ const OUString& GetBoldStr() const { return maBold; }
+ const OUString& GetBoldItalicStr() const { return maBoldItalic; }
+ const OUString& GetStyleName( FontWeight eWeight, FontItalic eItalic ) const;
+ OUString GetStyleName( const FontMetric& rFontMetric ) const;
+
+ FontMetric Get( const OUString& rName,
+ const OUString& rStyleName ) const;
+ FontMetric Get( const OUString& rName,
+ FontWeight eWeight,
+ FontItalic eItalic ) const;
+
+ bool IsAvailable( std::u16string_view rName ) const;
+ size_t GetFontNameCount() const
+ {
+ return m_Entries.size();
+ }
+ const FontMetric& GetFontName(size_t nFont) const;
+ sal_Handle GetFirstFontMetric( std::u16string_view rName ) const;
+ static sal_Handle GetNextFontMetric( sal_Handle hFontMetric );
+ static const FontMetric& GetFontMetric( sal_Handle hFontMetric );
+
+ static const int* GetStdSizeAry() { return aStdSizeAry; }
+
+private:
+ FontList( const FontList& ) = delete;
+ FontList& operator =( const FontList& ) = delete;
+};
+
+class UNLESS_MERGELIBS(SVT_DLLPUBLIC) FontSizeNames
+{
+private:
+ const struct ImplFSNameItem* mpArray;
+ sal_Int32 mnElem;
+
+public:
+ FontSizeNames( LanguageType eLanguage /* = LANGUAGE_DONTKNOW */ );
+
+ sal_Int32 Count() const { return mnElem; }
+ bool IsEmpty() const { return !mnElem; }
+
+ sal_Int32 Name2Size( std::u16string_view ) const;
+ OUString Size2Name( sal_Int32 ) const;
+
+ OUString GetIndexName( sal_Int32 nIndex ) const;
+ sal_Int32 GetIndexSize( sal_Int32 nIndex ) const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/dialogclosedlistener.hxx b/include/svtools/dialogclosedlistener.hxx
new file mode 100644
index 000000000..c460c1afa
--- /dev/null
+++ b/include/svtools/dialogclosedlistener.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/ui/dialogs/XDialogClosedListener.hpp>
+#include <tools/link.hxx>
+
+
+namespace svt
+{
+
+
+ //= ODialogClosedListener
+
+ /**
+ C++ class to implement a css::ui::dialogs::XDialogClosedListener
+ */
+ class SVT_DLLPUBLIC DialogClosedListener final :
+ public cppu::WeakImplHelper< css::ui::dialogs::XDialogClosedListener >
+ {
+ private:
+ /**
+ This link will be called when the dialog was closed.
+ */
+ Link<css::ui::dialogs::DialogClosedEvent*, void> m_aDialogClosedLink;
+
+ public:
+ DialogClosedListener();
+
+ void SetDialogClosedLink( const Link<css::ui::dialogs::DialogClosedEvent*,void>& rLink ) { m_aDialogClosedLink = rLink; }
+
+ // XDialogClosedListener methods
+ virtual void SAL_CALL dialogClosed( const css::ui::dialogs::DialogClosedEvent& aEvent ) override;
+
+ // XEventListener methods
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+ };
+
+
+} // namespace svt
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
new file mode 100644
index 000000000..2297c45a6
--- /dev/null
+++ b/include/svtools/editbrowsebox.hxx
@@ -0,0 +1,1119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <svtools/svtdllapi.h>
+#include <tools/ref.hxx>
+
+#include <svtools/brwbox.hxx>
+#include <svtools/brwhead.hxx>
+#include <tools/lineend.hxx>
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/weldutils.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+class BrowserDataWin;
+
+// EditBrowseBoxFlags (EBBF)
+enum class EditBrowseBoxFlags
+{
+ NONE = 0x0000,
+/** if this bit is _not_ set, the handle column will be invalidated upon
+ changing the row in the browse box. This is for forcing the row picture to
+ be repainted. If you do not have row pictures or text, you don't need this
+ invalidation, then you would specify this bit to prevent flicker
+*/
+ NO_HANDLE_COLUMN_CONTENT = 0x0001,
+/** set this bit to activate the cell on a MouseButtonDown, not a MouseButtonUp event
+ */
+ ACTIVATE_ON_BUTTONDOWN = 0x0002,
+/** if this bit is set and EditBrowseBoxFlags::NO_HANDLE_COLUMN_CONTENT is _not_ set, the handle
+ column is drawn with the text contained in column 0 instead of an image
+*/
+ HANDLE_COLUMN_TEXT = 0x0004,
+
+/** If this bit is set, tab traveling is somewhat modified<br/>
+ If the control gets the focus because the user pressed the TAB key, then the
+ first or last cell (depending on whether the traveling was cycling forward or backward)
+ gets activated.
+ @see Window::GetGetFocusFlags
+ @see GETFOCUS_*
+*/
+ SMART_TAB_TRAVEL = 0x0008,
+
+};
+namespace o3tl
+{
+ template<> struct typed_flags<EditBrowseBoxFlags> : is_typed_flags<EditBrowseBoxFlags, 0x0f> {};
+}
+
+namespace svt
+{
+ class ControlBase;
+
+ class SVT_DLLPUBLIC CellController : public SvRefBase
+ {
+ friend class EditBrowseBox;
+ Link<LinkParamNone*, void> maModifyHdl;
+
+ VclPtr<ControlBase> pWindow;
+ bool bSuspended; // <true> if the window is hidden and disabled
+
+ public:
+
+ CellController(ControlBase* pW);
+ virtual ~CellController() override;
+
+ ControlBase& GetWindow() const { return *const_cast<CellController*>(this)->pWindow; }
+
+ virtual void SaveValue() = 0;
+ virtual bool IsValueChangedFromSaved() const = 0;
+
+ // commit any current changes. Especially, do any reformatting you need (from input formatting
+ // to output formatting) here
+ virtual void CommitModifications();
+
+ // suspending the controller is not cumulative!
+ void suspend( );
+ void resume( );
+ bool isSuspended( ) const { return bSuspended; }
+
+ protected:
+ virtual bool MoveAllowed(const KeyEvent& rEvt) const;
+ void SetModifyHdl(const Link<LinkParamNone*,void>& rLink) { maModifyHdl = rLink; }
+ virtual void ActivatingMouseEvent(const BrowserMouseEvent& rEvt, bool bUp);
+ virtual void callModifyHdl() { maModifyHdl.Call(nullptr); }
+ };
+
+ typedef tools::SvRef<CellController> CellControllerRef;
+
+
+ //= IEditImplementation
+
+ class SVT_DLLPUBLIC IEditImplementation
+ {
+ public:
+ virtual ~IEditImplementation() = 0;
+
+ virtual ControlBase& GetControl() = 0;
+
+ virtual OUString GetText( LineEnd aSeparator ) const = 0;
+ virtual void SetText( const OUString& _rStr ) = 0;
+
+ virtual bool IsReadOnly() const = 0;
+ virtual void SetReadOnly( bool bReadOnly ) = 0;
+
+ virtual sal_Int32 GetMaxTextLen() const = 0;
+ virtual void SetMaxTextLen( sal_Int32 _nMaxLen ) = 0;
+
+ virtual Selection GetSelection() const = 0;
+ virtual void SetSelection( const Selection& _rSelection ) = 0;
+
+ virtual void ReplaceSelected( const OUString& _rStr ) = 0;
+ virtual OUString GetSelected( LineEnd aSeparator ) const = 0;
+
+ virtual bool IsValueChangedFromSaved() const = 0;
+ virtual void SaveValue() = 0;
+
+ virtual bool CanUp() const = 0;
+ virtual bool CanDown() const = 0;
+
+ virtual void Cut() = 0;
+ virtual void Copy() = 0;
+ virtual void Paste() = 0;
+
+ // sets a link to call when the text is changed by the user
+ void SetModifyHdl(const Link<LinkParamNone*,void>& rLink)
+ {
+ m_aModify1Hdl = rLink;
+ }
+
+ // sets an additional link to call when the text is changed by the user
+ void SetAuxModifyHdl(const Link<LinkParamNone*,void>& rLink)
+ {
+ m_aModify2Hdl = rLink;
+ }
+
+ private:
+ Link<LinkParamNone*,void> m_aModify1Hdl;
+ Link<LinkParamNone*,void> m_aModify2Hdl;
+
+ protected:
+ void CallModifyHdls()
+ {
+ m_aModify1Hdl.Call(nullptr);
+ m_aModify2Hdl.Call(nullptr);
+ }
+ };
+
+ class SVT_DLLPUBLIC ControlBase : public InterimItemWindow
+ {
+ public:
+ ControlBase(BrowserDataWin* pParent, const OUString& rUIXMLDescription, const OString& rID);
+
+ virtual void SetEditableReadOnly(bool bReadOnly);
+
+ virtual bool ProcessKey(const KeyEvent& rKEvt);
+
+ virtual void SetPointFont(const vcl::Font& rFont) = 0;
+
+ // chain after the FocusInHdl
+ void SetFocusInHdl(const Link<LinkParamNone*,void>& rHdl)
+ {
+ m_aFocusInHdl = rHdl;
+ }
+
+ // chain after the FocusOutHdl
+ void SetFocusOutHdl(const Link<LinkParamNone*,void>& rHdl)
+ {
+ m_aFocusOutHdl = rHdl;
+ }
+
+ void SetMousePressHdl(const Link<const MouseEvent&,void>& rHdl)
+ {
+ m_aMousePressHdl = rHdl;
+ }
+
+ void SetMouseReleaseHdl(const Link<const MouseEvent&,void>& rHdl)
+ {
+ m_aMouseReleaseHdl = rHdl;
+ }
+
+ void SetMouseMoveHdl(const Link<const MouseEvent&,void>& rHdl)
+ {
+ m_aMouseMoveHdl = rHdl;
+ }
+
+ void SetKeyInputHdl(const Link<const KeyEvent&,void>& rHdl)
+ {
+ m_aKeyInputHdl = rHdl;
+ }
+
+ void SetKeyReleaseHdl(const Link<const KeyEvent&,void>& rHdl)
+ {
+ m_aKeyReleaseHdl = rHdl;
+ }
+
+ protected:
+ DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool);
+ DECL_DLLPRIVATE_LINK(KeyReleaseHdl, const KeyEvent&, bool);
+ DECL_DLLPRIVATE_LINK(FocusInHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(FocusOutHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(MousePressHdl, const MouseEvent&, bool);
+ DECL_DLLPRIVATE_LINK(MouseReleaseHdl, const MouseEvent&, bool);
+ DECL_DLLPRIVATE_LINK(MouseMoveHdl, const MouseEvent&, bool);
+ private:
+ Link<LinkParamNone*,void> m_aFocusInHdl;
+ Link<LinkParamNone*,void> m_aFocusOutHdl;
+ Link<const MouseEvent&,void> m_aMousePressHdl;
+ Link<const MouseEvent&,void> m_aMouseReleaseHdl;
+ Link<const MouseEvent&,void> m_aMouseMoveHdl;
+ Link<const KeyEvent&,void> m_aKeyInputHdl;
+ Link<const KeyEvent&,void> m_aKeyReleaseHdl;
+ };
+
+ class SVT_DLLPUBLIC EditControlBase : public ControlBase
+ {
+ public:
+ EditControlBase(BrowserDataWin* pParent);
+
+ virtual void SetEditableReadOnly(bool bReadOnly) override
+ {
+ m_pEntry->set_editable(!bReadOnly);
+ }
+
+ virtual void SetPointFont(const vcl::Font& rFont) override
+ {
+ m_pEntry->set_font(rFont);
+ }
+
+ virtual void dispose() override;
+
+ weld::Entry& get_widget() { return *m_pEntry; }
+
+ virtual void connect_changed(const Link<weld::Entry&, void>& rLink) = 0;
+ virtual void connect_focus_in(const Link<weld::Widget&, void>& rLink) = 0;
+ virtual void connect_focus_out(const Link<weld::Widget&, void>& rLink) = 0;
+ virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) = 0;
+
+ protected:
+ void InitEditControlBase(weld::Entry* pEntry);
+
+ private:
+ weld::Entry* m_pEntry;
+ };
+
+ class SVT_DLLPUBLIC EditControl : public EditControlBase
+ {
+ public:
+ EditControl(BrowserDataWin* pParent);
+
+ virtual void dispose() override;
+
+ virtual void connect_changed(const Link<weld::Entry&, void>& rLink) override
+ {
+ m_xWidget->connect_changed(rLink);
+ }
+
+ virtual void connect_focus_in(const Link<weld::Widget&, void>& rLink) override
+ {
+ m_xWidget->connect_focus_in(rLink);
+ }
+
+ virtual void connect_focus_out(const Link<weld::Widget&, void>& rLink) override
+ {
+ m_xWidget->connect_focus_out(rLink);
+ }
+
+ virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override
+ {
+ m_xWidget->connect_key_press(rLink);
+ }
+
+ protected:
+ std::unique_ptr<weld::Entry> m_xWidget;
+ };
+
+ class SVT_DLLPUBLIC EntryImplementation final : public IEditImplementation
+ {
+ EditControlBase& m_rEdit;
+ int m_nMaxTextLen;
+
+ DECL_LINK(ModifyHdl, weld::Entry&, void);
+ public:
+ EntryImplementation(EditControlBase& rEdit)
+ : m_rEdit(rEdit)
+ , m_nMaxTextLen(0)
+ {
+ m_rEdit.connect_changed(LINK(this, EntryImplementation, ModifyHdl));
+ }
+
+ virtual ControlBase& GetControl() override
+ {
+ return m_rEdit;
+ }
+
+ virtual OUString GetText( LineEnd /*aSeparator*/ ) const override
+ {
+ // ignore the line end - this base implementation does not support it
+ return m_rEdit.get_widget().get_text();
+ }
+
+ virtual void SetText( const OUString& _rStr ) override
+ {
+ return m_rEdit.get_widget().set_text(_rStr);
+ }
+
+ virtual bool IsReadOnly() const override
+ {
+ return !m_rEdit.get_widget().get_editable();
+ }
+
+ virtual void SetReadOnly( bool bReadOnly ) override
+ {
+ m_rEdit.SetEditableReadOnly(bReadOnly);
+ }
+
+ virtual sal_Int32 GetMaxTextLen() const override
+ {
+ return m_nMaxTextLen;
+ }
+
+ virtual void SetMaxTextLen( sal_Int32 nMaxLen ) override
+ {
+ m_nMaxTextLen = nMaxLen;
+ m_rEdit.get_widget().set_max_length(m_nMaxTextLen);
+ }
+
+ virtual Selection GetSelection() const override
+ {
+ int nStartPos, nEndPos;
+ m_rEdit.get_widget().get_selection_bounds(nStartPos, nEndPos);
+ return Selection(nStartPos, nEndPos);
+ }
+
+ virtual void SetSelection( const Selection& rSelection ) override
+ {
+ auto nMin = rSelection.Min();
+ auto nMax = rSelection.Max();
+ m_rEdit.get_widget().select_region(nMin < 0 ? 0 : nMin, nMax == SELECTION_MAX ? -1 : nMax);
+ }
+
+ virtual void ReplaceSelected( const OUString& rStr ) override
+ {
+ m_rEdit.get_widget().replace_selection(rStr);
+ }
+
+ virtual OUString GetSelected( LineEnd /*aSeparator*/ ) const override
+ // ignore the line end - this base implementation does not support it
+ {
+ int nStartPos, nEndPos;
+ weld::Entry& rEntry = m_rEdit.get_widget();
+ rEntry.get_selection_bounds(nStartPos, nEndPos);
+ return rEntry.get_text().copy(nStartPos, nEndPos - nStartPos);
+ }
+
+ virtual bool IsValueChangedFromSaved() const override
+ {
+ return m_rEdit.get_widget().get_value_changed_from_saved();
+ }
+
+ virtual void SaveValue() override
+ {
+ m_rEdit.get_widget().save_value();
+ }
+
+ virtual bool CanUp() const override
+ {
+ return false;
+ }
+
+ virtual bool CanDown() const override
+ {
+ return false;
+ }
+
+ virtual void Cut() override
+ {
+ m_rEdit.get_widget().cut_clipboard();
+ }
+
+ virtual void Copy() override
+ {
+ m_rEdit.get_widget().copy_clipboard();
+ }
+
+ virtual void Paste() override
+ {
+ m_rEdit.get_widget().paste_clipboard();
+ }
+ };
+
+ //= MultiLineTextCell
+
+ /** a multi line edit which can be used in a cell of an EditBrowseBox
+ */
+ class SVT_DLLPUBLIC MultiLineTextCell final : public ControlBase
+ {
+ public:
+ MultiLineTextCell(BrowserDataWin* pParent);
+
+ virtual void SetEditableReadOnly(bool bReadOnly) override
+ {
+ m_xWidget->set_editable(!bReadOnly);
+ }
+
+ virtual void SetPointFont(const vcl::Font& rFont) override
+ {
+ m_xWidget->set_font(rFont);
+ }
+
+ virtual void GetFocus() override;
+
+ virtual void dispose() override;
+
+ void connect_changed(const Link<weld::TextView&, void>& rLink)
+ {
+ m_xWidget->connect_changed(rLink);
+ }
+
+ weld::TextView& get_widget() { return *m_xWidget; }
+
+ private:
+ std::unique_ptr<weld::TextView> m_xWidget;
+
+ virtual bool ProcessKey(const KeyEvent& rKEvt) override;
+ };
+
+ class SVT_DLLPUBLIC MultiLineEditImplementation final : public IEditImplementation
+ {
+ MultiLineTextCell& m_rEdit;
+ int m_nMaxTextLen;
+
+ DECL_LINK(ModifyHdl, weld::TextView&, void);
+ public:
+ MultiLineEditImplementation(MultiLineTextCell& rEdit)
+ : m_rEdit(rEdit)
+ , m_nMaxTextLen(0)
+ {
+ m_rEdit.connect_changed(LINK(this, MultiLineEditImplementation, ModifyHdl));
+ }
+
+ virtual ControlBase& GetControl() override
+ {
+ return m_rEdit;
+ }
+
+ virtual OUString GetText(LineEnd aSeparator) const override;
+
+ virtual void SetText(const OUString& rStr) override
+ {
+ return m_rEdit.get_widget().set_text(rStr);
+ }
+
+ virtual bool IsReadOnly() const override
+ {
+ return !m_rEdit.get_widget().get_editable();
+ }
+
+ virtual void SetReadOnly( bool bReadOnly ) override
+ {
+ m_rEdit.SetEditableReadOnly(bReadOnly);
+ }
+
+ virtual sal_Int32 GetMaxTextLen() const override
+ {
+ return m_nMaxTextLen;
+ }
+
+ virtual void SetMaxTextLen( sal_Int32 nMaxLen ) override
+ {
+ m_nMaxTextLen = nMaxLen;
+ m_rEdit.get_widget().set_max_length(m_nMaxTextLen);
+ }
+
+ virtual Selection GetSelection() const override
+ {
+ int nStartPos, nEndPos;
+ m_rEdit.get_widget().get_selection_bounds(nStartPos, nEndPos);
+ return Selection(nStartPos, nEndPos);
+ }
+
+ virtual void SetSelection( const Selection& rSelection ) override
+ {
+ auto nMin = rSelection.Min();
+ auto nMax = rSelection.Max();
+ m_rEdit.get_widget().select_region(nMin < 0 ? 0 : nMin, nMax == SELECTION_MAX ? -1 : nMax);
+ }
+
+ virtual void ReplaceSelected( const OUString& rStr ) override
+ {
+ m_rEdit.get_widget().replace_selection(rStr);
+ }
+
+ virtual OUString GetSelected( LineEnd aSeparator ) const override;
+
+ virtual bool IsValueChangedFromSaved() const override
+ {
+ return m_rEdit.get_widget().get_value_changed_from_saved();
+ }
+
+ virtual void SaveValue() override
+ {
+ m_rEdit.get_widget().save_value();
+ }
+
+ virtual bool CanUp() const override
+ {
+ return m_rEdit.get_widget().can_move_cursor_with_up();
+ }
+
+ virtual bool CanDown() const override
+ {
+ return m_rEdit.get_widget().can_move_cursor_with_down();
+ }
+
+ virtual void Cut() override
+ {
+ m_rEdit.get_widget().cut_clipboard();
+ }
+
+ virtual void Copy() override
+ {
+ m_rEdit.get_widget().copy_clipboard();
+ }
+
+ virtual void Paste() override
+ {
+ m_rEdit.get_widget().paste_clipboard();
+ }
+ };
+
+
+ //= EditCellController
+ class SVT_DLLPUBLIC EditCellController : public CellController
+ {
+ IEditImplementation* m_pEditImplementation;
+ bool m_bOwnImplementation; // did we create m_pEditImplementation?
+
+ public:
+ EditCellController( EditControlBase* _pEdit );
+ EditCellController( IEditImplementation* _pImplementation );
+ virtual ~EditCellController( ) override;
+
+ const IEditImplementation* GetEditImplementation( ) const { return m_pEditImplementation; }
+ IEditImplementation* GetEditImplementation( ) { return m_pEditImplementation; }
+
+ virtual bool IsValueChangedFromSaved() const override;
+ virtual void SaveValue() override;
+
+ void Modify()
+ {
+ ModifyHdl(nullptr);
+ }
+
+ protected:
+ virtual bool MoveAllowed(const KeyEvent& rEvt) const override;
+ private:
+ DECL_LINK(ModifyHdl, LinkParamNone*, void);
+ };
+
+ //= CheckBoxControl
+ class SVT_DLLPUBLIC CheckBoxControl final : public ControlBase
+ {
+ std::unique_ptr<weld::CheckButton> m_xBox;
+ weld::TriStateEnabled m_aModeState;
+ Link<weld::CheckButton&,void> m_aToggleLink;
+ Link<LinkParamNone*,void> m_aModify1Hdl;
+ Link<LinkParamNone*,void> m_aModify2Hdl;
+
+ public:
+ CheckBoxControl(BrowserDataWin* pParent);
+ virtual ~CheckBoxControl() override;
+ virtual void dispose() override;
+
+ virtual void SetPointFont(const vcl::Font& rFont) override;
+
+ void SetToggleHdl(const Link<weld::CheckButton&,void>& rHdl) {m_aToggleLink = rHdl;}
+
+ // sets a link to call when the text is changed by the user
+ void SetModifyHdl(const Link<LinkParamNone*,void>& rHdl)
+ {
+ m_aModify1Hdl = rHdl;
+ }
+
+ // sets an additional link to call when the text is changed by the user
+ void SetAuxModifyHdl(const Link<LinkParamNone*,void>& rLink)
+ {
+ m_aModify2Hdl = rLink;
+ }
+
+ void SetState(TriState eState);
+ TriState GetState() const { return m_xBox->get_state(); }
+
+ void EnableTriState(bool bTriState);
+
+ weld::CheckButton& GetBox() {return *m_xBox;};
+
+ // for pseudo-click when initially clicking in a cell activates
+ // the cell and performs a state change on the button as if
+ // it was clicked on
+ void Clicked();
+
+ private:
+ DECL_DLLPRIVATE_LINK(OnToggle, weld::Toggleable&, void);
+
+ void CallModifyHdls()
+ {
+ m_aModify1Hdl.Call(nullptr);
+ m_aModify2Hdl.Call(nullptr);
+ }
+ };
+
+ //= CheckBoxCellController
+ class SVT_DLLPUBLIC CheckBoxCellController final : public CellController
+ {
+ public:
+
+ CheckBoxCellController(CheckBoxControl* pWin);
+ weld::CheckButton& GetCheckBox() const;
+
+ virtual bool IsValueChangedFromSaved() const override;
+ virtual void SaveValue() override;
+
+ private:
+ virtual void ActivatingMouseEvent(const BrowserMouseEvent& rEvt, bool bUp) override;
+ DECL_DLLPRIVATE_LINK(ModifyHdl, LinkParamNone*, void);
+ };
+
+ //= ComboBoxControl
+ class SVT_DLLPUBLIC ComboBoxControl final : public ControlBase
+ {
+ private:
+ std::unique_ptr<weld::ComboBox> m_xWidget;
+ Link<LinkParamNone*,void> m_aModify1Hdl;
+ Link<bool,void> m_aModify2Hdl;
+
+ friend class ComboBoxCellController;
+
+ public:
+ ComboBoxControl(BrowserDataWin* pParent);
+
+ virtual void SetPointFont(const vcl::Font& rFont) override;
+
+ virtual void SetEditableReadOnly(bool bReadOnly) override
+ {
+ m_xWidget->set_entry_editable(!bReadOnly);
+ }
+
+ weld::ComboBox& get_widget() { return *m_xWidget; }
+
+ // sets a link to call when the selection is changed by the user
+ void SetModifyHdl(const Link<LinkParamNone*,void>& rHdl)
+ {
+ m_aModify1Hdl = rHdl;
+ }
+
+ // sets an additional link to call when the selection is changed by the user
+ // bool arg is true when triggered interactively by the user
+ void SetAuxModifyHdl(const Link<bool,void>& rLink)
+ {
+ m_aModify2Hdl = rLink;
+ }
+
+ void TriggerAuxModify()
+ {
+ m_aModify2Hdl.Call(false);
+ }
+
+ virtual void dispose() override;
+
+ private:
+ DECL_DLLPRIVATE_LINK(SelectHdl, weld::ComboBox&, void);
+
+ void CallModifyHdls()
+ {
+ m_aModify1Hdl.Call(nullptr);
+ m_aModify2Hdl.Call(true);
+ }
+ };
+
+ //= ComboBoxCellController
+ class SVT_DLLPUBLIC ComboBoxCellController final : public CellController
+ {
+ public:
+
+ ComboBoxCellController(ComboBoxControl* pParent);
+ weld::ComboBox& GetComboBox() const { return static_cast<ComboBoxControl&>(GetWindow()).get_widget(); }
+
+ virtual bool IsValueChangedFromSaved() const override;
+ virtual void SaveValue() override;
+
+ private:
+ virtual bool MoveAllowed(const KeyEvent& rEvt) const override;
+ DECL_DLLPRIVATE_LINK(ModifyHdl, LinkParamNone*, void);
+ };
+
+ //= ListBoxControl
+ class SVT_DLLPUBLIC ListBoxControl final : public ControlBase
+ {
+ private:
+ std::unique_ptr<weld::ComboBox> m_xWidget;
+ Link<LinkParamNone*,void> m_aModify1Hdl;
+ Link<bool,void> m_aModify2Hdl;
+
+ friend class ListBoxCellController;
+
+ public:
+ ListBoxControl(BrowserDataWin* pParent);
+
+ virtual void SetPointFont(const vcl::Font& rFont) override;
+
+ weld::ComboBox& get_widget() { return *m_xWidget; }
+
+ // sets a link to call when the selection is changed by the user
+ void SetModifyHdl(const Link<LinkParamNone*,void>& rHdl)
+ {
+ m_aModify1Hdl = rHdl;
+ }
+
+ // sets an additional link to call when the selection is changed,
+ // bool arg is true when triggered interactively by the user
+ void SetAuxModifyHdl(const Link<bool,void>& rLink)
+ {
+ m_aModify2Hdl = rLink;
+ }
+
+ void TriggerAuxModify()
+ {
+ m_aModify2Hdl.Call(false);
+ }
+
+ virtual void dispose() override;
+ private:
+ DECL_DLLPRIVATE_LINK(SelectHdl, weld::ComboBox&, void);
+
+ void CallModifyHdls()
+ {
+ m_aModify1Hdl.Call(nullptr);
+ m_aModify2Hdl.Call(true);
+ }
+ };
+
+ //= ListBoxCellController
+ class SVT_DLLPUBLIC ListBoxCellController : public CellController
+ {
+ public:
+
+ ListBoxCellController(ListBoxControl* pParent);
+ weld::ComboBox& GetListBox() const { return static_cast<ListBoxControl&>(GetWindow()).get_widget(); }
+
+ virtual bool IsValueChangedFromSaved() const override;
+ virtual void SaveValue() override;
+
+ protected:
+ virtual bool MoveAllowed(const KeyEvent& rEvt) const override;
+ private:
+ DECL_DLLPRIVATE_LINK(ListBoxSelectHdl, LinkParamNone*, void);
+ };
+
+ class SVT_DLLPUBLIC FormattedControlBase : public EditControlBase
+ {
+ public:
+ FormattedControlBase(BrowserDataWin* pParent, bool bSpinVariant);
+
+ virtual void dispose() override;
+
+ virtual void connect_changed(const Link<weld::Entry&, void>& rLink) override;
+ virtual void connect_focus_in(const Link<weld::Widget&, void>& rLink) override;
+ virtual void connect_focus_out(const Link<weld::Widget&, void>& rLink) override;
+ virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override;
+
+ weld::EntryFormatter& get_formatter();
+
+ protected:
+ bool m_bSpinVariant;
+ std::unique_ptr<weld::Entry> m_xEntry;
+ std::unique_ptr<weld::FormattedSpinButton> m_xSpinButton;
+ std::unique_ptr<weld::EntryFormatter> m_xEntryFormatter;
+
+ void InitFormattedControlBase();
+ };
+
+ class SVT_DLLPUBLIC FormattedControl final : public FormattedControlBase
+ {
+ public:
+ FormattedControl(BrowserDataWin* pParent, bool bSpinVariant);
+ };
+
+ class SVT_DLLPUBLIC DoubleNumericControl final : public FormattedControlBase
+ {
+ public:
+ DoubleNumericControl(BrowserDataWin* pParent, bool bSpinVariant);
+ };
+
+ class SVT_DLLPUBLIC LongCurrencyControl final : public FormattedControlBase
+ {
+ public:
+ LongCurrencyControl(BrowserDataWin* pParent, bool bSpinVariant);
+ };
+
+ class SVT_DLLPUBLIC TimeControl final : public FormattedControlBase
+ {
+ public:
+ TimeControl(BrowserDataWin* pParent, bool bSpinVariant);
+ };
+
+ class SVT_DLLPUBLIC DateControl final : public FormattedControlBase
+ {
+ public:
+ DateControl(BrowserDataWin* pParent, bool bDropDown);
+
+ void SetDate(const Date& rDate);
+
+ virtual void dispose() override;
+ private:
+ std::unique_ptr<weld::MenuButton> m_xMenuButton;
+ std::unique_ptr<weld::Builder> m_xCalendarBuilder;
+ std::unique_ptr<weld::Widget> m_xTopLevel;
+ std::unique_ptr<weld::Calendar> m_xCalendar;
+ std::unique_ptr<weld::Widget> m_xExtras;
+ std::unique_ptr<weld::Button> m_xTodayBtn;
+ std::unique_ptr<weld::Button> m_xNoneBtn;
+
+ DECL_DLLPRIVATE_LINK(ToggleHdl, weld::Toggleable&, void);
+ DECL_DLLPRIVATE_LINK(ActivateHdl, weld::Calendar&, void);
+ DECL_DLLPRIVATE_LINK(ImplClickHdl, weld::Button&, void);
+ };
+
+ class SVT_DLLPUBLIC PatternControl final : public EditControlBase
+ {
+ public:
+ PatternControl(BrowserDataWin* pParent);
+
+ weld::PatternFormatter& get_formatter() { return *m_xEntryFormatter; }
+
+ virtual void connect_changed(const Link<weld::Entry&, void>& rLink) override;
+ virtual void connect_focus_in(const Link<weld::Widget&, void>& rLink) override;
+ virtual void connect_focus_out(const Link<weld::Widget&, void>& rLink) override;
+ virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override;
+
+ virtual void dispose() override;
+ private:
+ std::unique_ptr<weld::Entry> m_xWidget;
+ std::unique_ptr<weld::PatternFormatter> m_xEntryFormatter;
+ };
+
+ //= FormattedFieldCellController
+ class SVT_DLLPUBLIC FormattedFieldCellController final : public EditCellController
+ {
+ public:
+ FormattedFieldCellController( FormattedControlBase* _pFormatted );
+
+ virtual void CommitModifications() override;
+ };
+
+ //= EditBrowserHeader
+ class SVT_DLLPUBLIC EditBrowserHeader : public BrowserHeader
+ {
+ public:
+ EditBrowserHeader( BrowseBox* pParent, WinBits nWinBits = WB_BUTTONSTYLE )
+ :BrowserHeader(pParent, nWinBits){}
+
+ protected:
+ virtual void DoubleClick() override;
+ };
+
+
+ //= EditBrowseBox
+ class EditBrowseBoxImpl;
+ class SVT_DLLPUBLIC EditBrowseBox: public BrowseBox
+ {
+ friend class EditBrowserHeader;
+
+ enum BrowseInfo
+ {
+ COLSELECT = 1,
+ ROWSELECT = 2,
+ ROWCHANGE = 4,
+ COLCHANGE = 8
+ };
+
+ public:
+ enum RowStatus
+ {
+ CLEAN = 0,
+ CURRENT = 1,
+ CURRENTNEW = 2,
+ MODIFIED = 3,
+ NEW = 4,
+ DELETED = 5,
+ PRIMARYKEY = 6,
+ CURRENT_PRIMARYKEY = 7,
+ FILTER = 8,
+ HEADERFOOTER = 9
+ };
+
+ private:
+ EditBrowseBox(EditBrowseBox const &) = delete;
+ EditBrowseBox& operator=(EditBrowseBox const &) = delete;
+
+ class BrowserMouseEventPtr
+ {
+ std::unique_ptr<BrowserMouseEvent> pEvent;
+ bool bDown;
+
+ public:
+ BrowserMouseEventPtr()
+ : bDown(false)
+ {
+ }
+
+ bool Is() const {return pEvent != nullptr;}
+ bool IsDown() const {return bDown;}
+ const BrowserMouseEvent* operator->() const {return pEvent.get();}
+
+ SVT_DLLPUBLIC void Clear();
+ void Set(const BrowserMouseEvent* pEvt, bool bIsDown);
+ } aMouseEvent;
+
+ CellControllerRef aController,
+ aOldController;
+
+ ImplSVEvent * nStartEvent, * nEndEvent, * nCellModifiedEvent; // event ids
+ VclPtr<vcl::Window> m_pFocusWhileRequest;
+ // In ActivateCell, we grab the focus asynchronously, but if between requesting activation
+ // and the asynchronous event the focus has changed, we won't grab it for ourself.
+
+ sal_Int32 nPaintRow; // row being painted
+ sal_Int32 nEditRow;
+ sal_uInt16 nEditCol;
+
+ bool bHasFocus : 1;
+ mutable bool bPaintStatus : 1; // paint a status (image) in the handle column
+ bool bActiveBeforeTracking;
+
+ VclPtr<CheckBoxControl> pCheckBoxPaint;
+
+ EditBrowseBoxFlags m_nBrowserFlags;
+ std::unique_ptr< EditBrowseBoxImpl> m_aImpl;
+
+ protected:
+ VclPtr<BrowserHeader> pHeader;
+
+ BrowserMouseEventPtr& getMouseEvent() { return aMouseEvent; }
+
+ protected:
+ BrowserHeader* GetHeaderBar() const {return pHeader;}
+
+ virtual VclPtr<BrowserHeader> CreateHeaderBar(BrowseBox* pParent) override;
+
+ // if you want to have an own header ...
+ virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent);
+
+ virtual void ColumnMoved(sal_uInt16 nId) override;
+ virtual void ColumnResized(sal_uInt16 nColId) override;
+ virtual void Resize() override;
+ virtual void ArrangeControls(sal_uInt16& nX, sal_uInt16 nY);
+ virtual bool SeekRow(sal_Int32 nRow) override;
+
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void KeyInput(const KeyEvent& rEvt) override;
+ virtual void MouseButtonDown(const BrowserMouseEvent& rEvt) override;
+ virtual void MouseButtonUp(const BrowserMouseEvent& rEvt) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ using BrowseBox::MouseButtonUp;
+ using BrowseBox::MouseButtonDown;
+
+ virtual bool PreNotify(NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify(NotifyEvent& rNEvt) override;
+
+ virtual void EndScroll() override;
+
+ // should be used instead of GetFieldRectPixel, 'cause this method here takes into account the borders
+ tools::Rectangle GetCellRect(sal_Int32 nRow, sal_uInt16 nColId, bool bRelToBrowser = true) const;
+ virtual sal_uInt32 GetTotalCellWidth(sal_Int32 nRow, sal_uInt16 nColId);
+ sal_uInt32 GetAutoColumnWidth(sal_uInt16 nColId);
+
+ virtual void PaintStatusCell(OutputDevice& rDev, const tools::Rectangle& rRect) const;
+ virtual void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColId) const = 0;
+
+ virtual RowStatus GetRowStatus(sal_Int32 nRow) const;
+
+ virtual void RowHeightChanged() override;
+
+ // callbacks for the data window
+ virtual void ImplStartTracking() override;
+ virtual void ImplEndTracking() override;
+
+ // when changing a row:
+ // CursorMoving: cursor is being moved, but GetCurRow() still provides the old row
+ virtual bool CursorMoving(sal_Int32 nNewRow, sal_uInt16 nNewCol);
+
+ // cursor has been moved
+ virtual void CursorMoved() override;
+
+ virtual void CellModified(); // called whenever a cell has been modified
+ virtual bool SaveModified(); // called whenever a cell should be left, and it's content should be saved
+ // return sal_False prevents leaving the cell
+ virtual bool SaveRow(); // commit the current row
+
+ virtual bool IsModified() const {return aController.is() && aController->IsValueChangedFromSaved();}
+
+ virtual CellController* GetController(sal_Int32 nRow, sal_uInt16 nCol);
+ virtual void InitController(CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol);
+ static void ResizeController(CellControllerRef const & rController, const tools::Rectangle&);
+ virtual void DoubleClick(const BrowserMouseEvent&) override;
+
+ void ActivateCell() { ActivateCell(GetCurRow(), GetCurColumnId()); }
+
+ // retrieve the image for the row status
+ Image GetImage(RowStatus) const;
+
+ // inserting columns
+ // if you don't set a width, this will be calculated automatically
+ // if the id isn't set the smallest unused will do it ...
+ virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = sal_uInt16(-1));
+
+ // called whenever (Shift)Tab or Enter is pressed. If true is returned, these keys
+ // result in traveling to the next or to th previous cell
+ virtual bool IsTabAllowed(bool bForward) const;
+
+ virtual bool IsCursorMoveAllowed(sal_Int32 nNewRow, sal_uInt16 nNewColId) const override;
+
+ void PaintTristate(const tools::Rectangle& rRect, const TriState& eState, bool _bEnabled=true) const;
+
+ void AsynchGetFocus();
+ // secure starting of StartEditHdl
+
+ public:
+ EditBrowseBox(vcl::Window* pParent, EditBrowseBoxFlags nBrowserFlags, WinBits nBits, BrowserMode nMode = BrowserMode::NONE );
+ virtual ~EditBrowseBox() override;
+ virtual void dispose() override;
+
+ bool IsEditing() const {return aController.is();}
+ void InvalidateStatusCell(sal_Int32 nRow) {RowModified(nRow, 0);}
+ void InvalidateHandleColumn();
+
+ // late construction
+ virtual void Init();
+ virtual void RemoveRows();
+ virtual void Dispatch(sal_uInt16 nId);
+
+ const CellControllerRef& Controller() const { return aController; }
+ EditBrowseBoxFlags GetBrowserFlags() const { return m_nBrowserFlags; }
+ void SetBrowserFlags(EditBrowseBoxFlags nFlags);
+
+ virtual void ActivateCell(sal_Int32 nRow, sal_uInt16 nCol, bool bSetCellFocus = true);
+ virtual void DeactivateCell(bool bUpdate = true);
+ // Children ---------------------------------------------------------------
+
+ /** @return The count of additional controls of the control area. */
+ virtual sal_Int32 GetAccessibleControlCount() const override;
+
+ /** Creates the accessible object of an additional control.
+ @param nIndex
+ The 0-based index of the control.
+ @return
+ The XAccessible interface of the specified control. */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ CreateAccessibleControl( sal_Int32 nIndex ) override;
+
+ /** Sets focus to current cell of the data table. */
+ virtual void GrabTableFocus() override;
+
+ virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override;
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override;
+
+ virtual bool ProcessKey(const KeyEvent& rEvt) override;
+
+ virtual void ChildFocusIn() override;
+ virtual void ChildFocusOut() override;
+
+ css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCheckBoxCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos,const TriState& eState);
+ bool ControlHasFocus() const;
+ protected:
+ // creates the accessible which wraps the active cell
+ void implCreateActiveAccessible( );
+
+ private:
+ virtual void PaintField(vcl::RenderContext& rDev, const tools::Rectangle& rRect,
+ sal_uInt16 nColumnId ) const override;
+ using Control::ImplInitSettings;
+ SVT_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
+ SVT_DLLPRIVATE void DetermineFocus( const GetFocusFlags _nGetFocusFlags = GetFocusFlags::NONE);
+ inline void EnableAndShow() const;
+
+ SVT_DLLPRIVATE void implActivateCellOnMouseEvent(const BrowserMouseEvent& _rEvt, bool _bUp);
+
+ DECL_DLLPRIVATE_LINK( ModifyHdl, LinkParamNone*, void );
+ DECL_DLLPRIVATE_LINK( StartEditHdl, void*, void );
+ DECL_DLLPRIVATE_LINK( EndEditHdl, void*, void );
+ DECL_DLLPRIVATE_LINK( CellModifiedHdl, void*, void );
+ };
+
+
+} // namespace svt
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/ehdl.hxx b/include/svtools/ehdl.hxx
new file mode 100644
index 000000000..2324a5107
--- /dev/null
+++ b/include/svtools/ehdl.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <svtools/svtresid.hxx>
+#include <vcl/errinf.hxx>
+
+typedef std::pair<TranslateId, ErrCode> ErrMsgCode;
+SVT_DLLPUBLIC extern const ErrMsgCode RID_ERRHDL[];
+SVT_DLLPUBLIC extern const ErrMsgCode RID_ERRCTX[];
+
+namespace weld { class Window; }
+
+class SVT_DLLPUBLIC SfxErrorContext final : private ErrorContext
+{
+public:
+ SfxErrorContext(
+ sal_uInt16 nCtxIdP, weld::Window *pWin=nullptr,
+ const ErrMsgCode* pIds = nullptr, const std::locale& rResLocaleP = SvtResLocale());
+ SfxErrorContext(
+ sal_uInt16 nCtxIdP, const OUString &aArg1, weld::Window *pWin=nullptr,
+ const ErrMsgCode* pIds = nullptr, const std::locale& rResLocaleP = SvtResLocale());
+ bool GetString(ErrCode nErrId, OUString &rStr) override;
+
+private:
+ sal_uInt16 nCtxId;
+ const ErrMsgCode* pIds;
+ std::locale aResLocale;
+ OUString aArg1;
+};
+
+class SVT_DLLPUBLIC SfxErrorHandler : private ErrorHandler
+{
+public:
+ SfxErrorHandler(const ErrMsgCode* pIds, ErrCodeArea lStart, ErrCodeArea lEnd, const std::locale& rResLocale = SvtResLocale());
+ virtual ~SfxErrorHandler() override;
+
+protected:
+ bool GetErrorString(ErrCode lErrId, OUString &) const;
+
+private:
+
+ ErrCodeArea lStart;
+ ErrCodeArea lEnd;
+ const ErrMsgCode* pIds;
+ std::locale aResLocale;
+
+ SVT_DLLPRIVATE static void GetClassString(ErrCodeClass lErrId, OUString &);
+ virtual bool CreateString(const ErrorInfo *, OUString &) const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/embedhlp.hxx b/include/svtools/embedhlp.hxx
new file mode 100644
index 000000000..e87ebfbf9
--- /dev/null
+++ b/include/svtools/embedhlp.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <com/sun/star/uno/Reference.hxx>
+#include <vcl/graph.hxx>
+#include <rtl/ustring.hxx>
+#include <memory>
+
+namespace com :: sun :: star :: io { class XInputStream; }
+
+namespace comphelper
+{
+ class EmbeddedObjectContainer;
+}
+
+namespace com::sun::star::embed {
+ class XEmbeddedObject;
+}
+
+class OutputDevice;
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+
+namespace svt {
+
+struct EmbeddedObjectRef_Impl;
+
+class SVT_DLLPUBLIC EmbeddedObjectRef
+{
+ std::unique_ptr<EmbeddedObjectRef_Impl> mpImpl;
+
+ SVT_DLLPRIVATE std::unique_ptr<SvStream> GetGraphicStream( bool bUpdate ) const;
+ SVT_DLLPRIVATE void GetReplacement( bool bUpdate );
+ SVT_DLLPRIVATE void UpdateOleObject( bool bUpdateOle);
+
+ EmbeddedObjectRef& operator = ( const EmbeddedObjectRef& ) = delete;
+
+public:
+ static void DrawPaintReplacement( const tools::Rectangle &rRect, const OUString &rText, OutputDevice *pOut );
+ static void DrawShading( const tools::Rectangle &rRect, OutputDevice *pOut );
+ static bool TryRunningState( const css::uno::Reference < css::embed::XEmbeddedObject >& );
+ static void SetGraphicToContainer( const Graphic& rGraphic,
+ comphelper::EmbeddedObjectContainer& aContainer,
+ const OUString& aName,
+ const OUString& aMediaType );
+
+ static css::uno::Reference< css::io::XInputStream > GetGraphicReplacementStream(
+ sal_Int64 nViewAspect,
+ const css::uno::Reference < css::embed::XEmbeddedObject >&,
+ OUString* pMediaType )
+ noexcept;
+
+ static bool IsChart(const css::uno::Reference < css::embed::XEmbeddedObject >& xObj);
+
+ const css::uno::Reference <css::embed::XEmbeddedObject>& operator->() const;
+ const css::uno::Reference <css::embed::XEmbeddedObject>& GetObject() const;
+
+ // default constructed object; needs further assignment before it can be used
+ EmbeddedObjectRef();
+
+ // assign a previously default constructed object
+ void Assign( const css::uno::Reference < css::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
+
+ // create object for a certain view aspect
+ EmbeddedObjectRef( const css::uno::Reference < css::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
+
+ ~EmbeddedObjectRef();
+ EmbeddedObjectRef( const EmbeddedObjectRef& );
+
+ // assigning to a container enables the object to exchange graphical representations with a storage
+ void AssignToContainer( comphelper::EmbeddedObjectContainer* pContainer, const OUString& rPersistName );
+ comphelper::EmbeddedObjectContainer* GetContainer() const;
+
+ sal_Int64 GetViewAspect() const;
+ void SetViewAspect( sal_Int64 nAspect );
+ const Graphic* GetGraphic() const;
+
+ // the original size of the object ( size of the icon for iconified object )
+ // no conversion is done if no target mode is provided
+ Size GetSize( MapMode const * pTargetMapMode ) const;
+
+ void SetGraphic( const Graphic& rGraphic, const OUString& rMediaType );
+ void SetGraphicStream(
+ const css::uno::Reference< css::io::XInputStream >& xInGrStream,
+ const OUString& rMediaType );
+
+ // bUpdateOle = false update the Link-Objects
+ // = true update the OLE-Objects
+ void UpdateReplacement( bool bUpdateOle = false );
+ void UpdateReplacementOnDemand();
+ void Lock( bool bLock = true );
+ void Clear();
+ bool is() const;
+
+ bool IsLocked() const;
+
+ void SetIsProtectedHdl(const Link<LinkParamNone*, bool>& rProtectedHdl);
+ const Link<LinkParamNone*, bool> & GetIsProtectedHdl() const;
+
+ bool IsChart() const;
+
+ OUString GetChartType();
+
+ // #i104867#
+ // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally,
+ // that number is incremented at each change of the Graphic. This mechanism is needed to identify if a
+ // remembered Graphic (e.g. primitives) has changed compared to the current one, but without actively
+ // fetching the Graphic what would be too expensive e.g. for charts
+ sal_uInt32 getGraphicVersion() const;
+ void SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM );//#i103460# charts do not necessarily have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/embedtransfer.hxx b/include/svtools/embedtransfer.hxx
new file mode 100644
index 000000000..98bab1683
--- /dev/null
+++ b/include/svtools/embedtransfer.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <vcl/transfer.hxx>
+#include <memory>
+
+namespace com :: sun :: star :: embed { class XEmbeddedObject; }
+
+class Graphic;
+class SVT_DLLPUBLIC SvEmbedTransferHelper final : public TransferableHelper
+{
+private:
+
+ css::uno::Reference< css::embed::XEmbeddedObject > m_xObj;
+ std::unique_ptr<Graphic> m_pGraphic;
+ sal_Int64 m_nAspect;
+
+ OUString maParentShellID;
+
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+ virtual void ObjectReleased() override;
+
+public:
+ // object, replacement image, and the aspect
+ SvEmbedTransferHelper( const css::uno::Reference< css::embed::XEmbeddedObject >& xObj,
+ const Graphic* pGraphic,
+ sal_Int64 nAspect );
+ virtual ~SvEmbedTransferHelper() override;
+
+ void SetParentShellID( const OUString& rShellID );
+
+ static void FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc,
+ const css::uno::Reference< css::embed::XEmbeddedObject >& xObj,
+ const Graphic* pGraphic,
+ sal_Int64 nAspect );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/extcolorcfg.hxx b/include/svtools/extcolorcfg.hxx
new file mode 100644
index 000000000..408f8651e
--- /dev/null
+++ b/include/svtools/extcolorcfg.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <rtl/ustring.hxx>
+#include <svl/SfxBroadcaster.hxx>
+#include <svl/lstner.hxx>
+#include <tools/color.hxx>
+#include <memory>
+
+
+namespace svtools {
+
+class ExtendedColorConfig_Impl;
+
+class ExtendedColorConfigValue
+{
+ OUString m_sName;
+ OUString m_sDisplayName;
+ Color m_nColor;
+ Color m_nDefaultColor;
+public:
+ ExtendedColorConfigValue() : m_nColor(0),m_nDefaultColor(0){}
+ ExtendedColorConfigValue(const OUString& _sName
+ ,const OUString& _sDisplayName
+ ,Color _nColor
+ ,Color _nDefaultColor)
+ : m_sName(_sName)
+ ,m_sDisplayName(_sDisplayName)
+ ,m_nColor(_nColor)
+ ,m_nDefaultColor(_nDefaultColor)
+ {}
+
+ const OUString& getName() const { return m_sName; }
+ const OUString& getDisplayName() const { return m_sDisplayName; }
+ Color getColor() const { return m_nColor; }
+ Color getDefaultColor() const { return m_nDefaultColor; }
+
+ void setColor(Color _nColor) { m_nColor = _nColor; }
+};
+
+class SVT_DLLPUBLIC ExtendedColorConfig final : public SfxBroadcaster, public SfxListener
+{
+ friend class ExtendedColorConfig_Impl;
+private:
+ static ExtendedColorConfig_Impl* m_pImpl;
+public:
+ ExtendedColorConfig();
+ virtual ~ExtendedColorConfig() override;
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+
+ // get the configured value
+ ExtendedColorConfigValue GetColorValue(const OUString& _sComponentName,const OUString& _sName)const;
+ sal_Int32 GetComponentCount() const;
+ OUString GetComponentName(sal_uInt32 _nPos) const;
+ OUString GetComponentDisplayName(const OUString& _sComponentName) const;
+ sal_Int32 GetComponentColorCount(const OUString& _sName) const;
+ ExtendedColorConfigValue GetComponentColorConfigValue(const OUString& _sComponentName,sal_uInt32 _nPos) const;
+};
+
+class SVT_DLLPUBLIC EditableExtendedColorConfig
+{
+ std::unique_ptr<ExtendedColorConfig_Impl> m_pImpl;
+ bool m_bModified;
+public:
+ EditableExtendedColorConfig();
+ ~EditableExtendedColorConfig();
+
+ void DeleteScheme(const OUString& rScheme );
+ void AddScheme(const OUString& rScheme );
+ void LoadScheme(const OUString& rScheme );
+ void SetCurrentSchemeName(const OUString& rScheme);
+
+ sal_Int32 GetComponentCount() const;
+ OUString GetComponentName(sal_uInt32 _nPos) const;
+ sal_Int32 GetComponentColorCount(const OUString& _sName) const;
+ ExtendedColorConfigValue GetComponentColorConfigValue(const OUString& _sName,sal_uInt32 _nPos) const;
+ void SetColorValue(const OUString& _sComponentName, const ExtendedColorConfigValue& rValue);
+ void SetModified();
+ void ClearModified() {m_bModified = false;}
+ bool IsModified() const {return m_bModified;}
+ void Commit();
+
+ void DisableBroadcast();
+ void EnableBroadcast();
+};
+}//namespace svtools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/filechangedchecker.hxx b/include/svtools/filechangedchecker.hxx
new file mode 100644
index 000000000..d50fea631
--- /dev/null
+++ b/include/svtools/filechangedchecker.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+
+#include <osl/time.h>
+#include <rtl/ustring.hxx>
+#include <vcl/timer.hxx>
+
+#include <functional>
+
+/** Periodically checks if a file has been modified
+
+ Instances of this class setup a vcl timer to occasionally wake up
+ check whether file modification time has changed.
+ */
+class SVT_DLLPUBLIC FileChangedChecker
+{
+private:
+ Timer mTimer;
+ OUString mFileName;
+ TimeValue mLastModTime;
+ ::std::function<void ()> mpCallback;
+
+ bool SVT_DLLPRIVATE getCurrentModTime(TimeValue& o_rValue) const;
+ DECL_DLLPRIVATE_LINK(TimerHandler, Timer *, void);
+
+public:
+ void resetTimer();
+ // bUpdate = true when file has changed, get the return and the object get the new time
+ // = false when file has changed, only get the return, not change the object
+ bool hasFileChanged(bool bUpdate = true);
+ FileChangedChecker(const OUString& rFilename,
+ const ::std::function<void ()>& rCallback);
+ // without Timer function
+ FileChangedChecker(const OUString& rFilename);
+};
diff --git a/include/svtools/fontsubstconfig.hxx b/include/svtools/fontsubstconfig.hxx
new file mode 100644
index 000000000..06097cf3b
--- /dev/null
+++ b/include/svtools/fontsubstconfig.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+
+struct SubstitutionStruct
+{
+ OUString sFont;
+ OUString sReplaceBy;
+ bool bReplaceAlways;
+ bool bReplaceOnScreenOnly;
+};
+
+namespace svtools
+{
+ SVT_DLLPUBLIC bool IsFontSubstitutionsEnabled();
+ SVT_DLLPUBLIC std::vector<SubstitutionStruct> GetFontSubstitutions();
+ SVT_DLLPUBLIC void SetFontSubstitutions(bool bIsEnabled, std::vector<SubstitutionStruct> const &);
+ SVT_DLLPUBLIC void ApplyFontSubstitutionsToVcl();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/genericunodialog.hxx b/include/svtools/genericunodialog.hxx
new file mode 100644
index 000000000..467a52382
--- /dev/null
+++ b/include/svtools/genericunodialog.hxx
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <vcl/weld.hxx>
+
+namespace com :: sun :: star :: awt { class XWindow; }
+namespace com :: sun :: star :: uno { class XComponentContext; }
+
+class VclWindowEvent;
+
+
+namespace svt
+{
+
+
+#define UNODIALOG_PROPERTY_ID_TITLE 1
+#define UNODIALOG_PROPERTY_ID_PARENT 2
+
+inline constexpr OUStringLiteral UNODIALOG_PROPERTY_TITLE = u"Title";
+inline constexpr OUStringLiteral UNODIALOG_PROPERTY_PARENT = u"ParentWindow";
+
+ typedef cppu::WeakImplHelper< css::ui::dialogs::XExecutableDialog,
+ css::lang::XServiceInfo,
+ css::lang::XInitialization > OGenericUnoDialogBase;
+
+ /** abstract base class for implementing UNO objects representing dialogs (com.sun.star.awt::XDialog)
+ */
+ class SVT_DLLPUBLIC OGenericUnoDialog
+ :public OGenericUnoDialogBase
+ ,public ::comphelper::OMutexAndBroadcastHelper
+ ,public ::comphelper::OPropertyContainer
+ {
+ protected:
+ std::unique_ptr<weld::DialogController> m_xDialog; /// the dialog to execute
+ bool m_bExecuting : 1; /// we're currently executing the dialog
+ bool m_bTitleAmbiguous : 1; /// m_sTitle has not been set yet
+ bool m_bInitialized : 1; /// has "initialize" been called?
+
+ // <properties>
+ OUString m_sTitle; /// title of the dialog
+ css::uno::Reference<css::awt::XWindow> m_xParent; /// parent window
+ // </properties>
+
+ css::uno::Reference<css::uno::XComponentContext> m_aContext;
+
+ protected:
+ OGenericUnoDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+ virtual ~OGenericUnoDialog() override;
+
+ public:
+ // UNO
+ DECLARE_UNO3_DEFAULTS(OGenericUnoDialog, OGenericUnoDialogBase)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override = 0;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override = 0;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override = 0;
+
+ // OPropertySetHelper
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& rConvertedValue, css::uno::Any& rOldValue, sal_Int32 nHandle, const css::uno::Any& rValue) override;
+
+ // XExecutableDialog
+ virtual void SAL_CALL setTitle( const OUString& aTitle ) override;
+ virtual sal_Int16 SAL_CALL execute( ) override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
+ protected:
+ /** create the concrete dialog instance. Note that m_aMutex is not locked when this method get called,
+ but the application-wide solar mutex is (to guard the not thread-safe ctor of the dialog).
+ @param pParent the parent window for the new dialog
+ */
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) = 0;
+
+ /// called to destroy the dialog used. deletes m_pDialog and resets it to NULL
+ void destroyDialog();
+
+ /** called after the dialog has been executed
+ @param _nExecutionResult the execution result as returned by Dialog::Execute
+ */
+ virtual void executedDialog(sal_Int16 /*_nExecutionResult*/) { }
+
+ /** smaller form of <method>initialize</method>.<p/>
+ The <method>initialize</method> method is called with a sequence of com.sun.star.uno::Any's,
+ which is split up into the single elements, which are passed to implInitialize. The default implementation
+ tries to extract a com.sun.star.beans::PropertyValue from the value a pass it to the
+ com.sun.star.beans::XPropertySet interface of the object.
+ */
+ virtual void implInitialize(const css::uno::Any& _rValue);
+
+ private:
+
+ /** ensures that m_pDialog is not <NULL/>
+
+ This method does nothing if m_pDialog is already non-<NULL/>. Else, it calls createDialog and does
+ all necessary initializations of the new dialog instance.
+
+ @precond
+ m_aMutex is locked
+
+ @return
+ <TRUE/> if and only if m_pDialog is non-<NULL/> upon returning from the method. Note that the only
+ case where m_pDialog is <NULL/> is when createDialog returned <NULL/>, which is will fire an assertion
+ in non-product builds.
+ */
+ bool impl_ensureDialog_lck();
+ };
+
+ /// helper class for guarding access to methods of an OGenericUnoDialog
+ class UnoDialogEntryGuard
+ {
+ public:
+ UnoDialogEntryGuard( OGenericUnoDialog& _rDialog )
+ :m_aGuard( _rDialog.GetMutex() )
+ {
+ }
+
+ private:
+ ::osl::MutexGuard m_aGuard;
+ };
+
+
+} // namespace svt
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/helpids.h b/include/svtools/helpids.h
new file mode 100644
index 000000000..d6b1da9e7
--- /dev/null
+++ b/include/svtools/helpids.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <rtl/string.hxx>
+
+inline constexpr OStringLiteral HID_FILEDLG_LINK_CB = "SVT_HID_FILEDLG_LINK_CB";
+inline constexpr OStringLiteral HID_FILEDLG_PREVIEW_CB = "SVT_HID_FILEDLG_PREVIEW_CB";
+inline constexpr OStringLiteral HID_FILEDLG_STANDARD = "SVT_HID_FILEDLG_STANDARD";
+
+// help ids for the different modi of the file picker dialog
+inline constexpr OStringLiteral HID_FILESAVE_LEVELUP = "SVT_HID_FILESAVE_LEVELUP";
+inline constexpr OStringLiteral HID_FILESAVE_CREATEDIRECTORY = "SVT_HID_FILESAVE_CREATEDIRECTORY";
+inline constexpr OStringLiteral HID_FILESAVE_FILEVIEW = "SVT_HID_FILESAVE_FILEVIEW";
+inline constexpr OStringLiteral HID_FILESAVE_TEMPLATE = "SVT_HID_FILESAVE_TEMPLATE";
+inline constexpr OStringLiteral HID_FILESAVE_FILEURL = "SVT_HID_FILESAVE_FILEURL";
+inline constexpr OStringLiteral HID_FILESAVE_FILETYPE = "SVT_HID_FILESAVE_FILETYPE";
+inline constexpr OStringLiteral HID_FILESAVE_DOSAVE = "SVT_HID_FILESAVE_DOSAVE";
+inline constexpr OStringLiteral HID_FILESAVE_AUTOEXTENSION = "SVT_HID_FILESAVE_AUTOEXTENSION";
+inline constexpr OStringLiteral HID_FILESAVE_SAVEWITHPASSWORD = "SVT_HID_FILESAVE_SAVEWITHPASSWORD";
+inline constexpr OStringLiteral HID_FILESAVE_CUSTOMIZEFILTER = "SVT_HID_FILESAVE_CUSTOMIZEFILTER";
+inline constexpr OStringLiteral HID_FILESAVE_SELECTION = "SVT_HID_FILESAVE_SELECTION";
+inline constexpr OStringLiteral HID_FILESAVE_DIALOG = "SVT_HID_FILESAVE_DIALOG";
+inline constexpr OStringLiteral HID_FILESAVE_DOPLAY = "SVT_HID_FILESAVE_DOPLAY";
+
+inline constexpr OStringLiteral HID_FILEOPEN_LEVELUP = "SVT_HID_FILEOPEN_LEVELUP";
+inline constexpr OStringLiteral HID_FILEOPEN_READONLY = "SVT_HID_FILEOPEN_READONLY";
+inline constexpr OStringLiteral HID_FILEOPEN_VERSION = "SVT_HID_FILEOPEN_VERSION";
+inline constexpr OStringLiteral HID_FILEOPEN_IMAGE_TEMPLATE = "SVT_HID_FILEOPEN_IMAGE_TEMPLATE";
+inline constexpr OStringLiteral HID_FILEOPEN_IMAGE_ANCHOR = "SVT_HID_FILEOPEN_IMAGE_ANCHOR";
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/htmlcfg.hxx b/include/svtools/htmlcfg.hxx
new file mode 100644
index 000000000..1ed542867
--- /dev/null
+++ b/include/svtools/htmlcfg.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <rtl/textenc.h>
+
+#define HTML_FONT_COUNT 7
+
+// !!!be aware!!!: the following defines are _not_ used as values in the configuration file
+// this is because of compatibility reasons
+#define HTML_CFG_MSIE 1 // Internet Explorer
+#define HTML_CFG_WRITER 2 // Writer
+#define HTML_CFG_NS40 3 // Netscape 4.0
+
+#define HTML_CFG_MAX HTML_CFG_NS40
+
+namespace SvxHtmlOptions
+{
+SVT_DLLPUBLIC sal_uInt16 GetFontSize(sal_uInt16 nPos);
+
+SVT_DLLPUBLIC sal_uInt16 GetExportMode();
+
+SVT_DLLPUBLIC bool IsPrintLayoutExtension();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/htmlkywd.hxx b/include/svtools/htmlkywd.hxx
new file mode 100644
index 000000000..9a84cddd3
--- /dev/null
+++ b/include/svtools/htmlkywd.hxx
@@ -0,0 +1,689 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+// tdf#126879 - drop obsolete DOCTYPE HTML 4.0 and use the HTML5 DOCTYPE declaration
+#define OOO_STRING_SVTOOLS_HTML_doctype5 "html"
+#define OOO_STRING_SVTOOLS_XHTML_doctype11 \
+ "html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN\" " \
+ "\"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd\""
+
+// these are only switched on
+#define OOO_STRING_SVTOOLS_HTML_area "area"
+#define OOO_STRING_SVTOOLS_HTML_base "base"
+#define OOO_STRING_SVTOOLS_HTML_comment "!--"
+#define OOO_STRING_SVTOOLS_HTML_doctype "!DOCTYPE"
+#define OOO_STRING_SVTOOLS_HTML_cdata "![cdata["
+#define OOO_STRING_SVTOOLS_HTML_embed "embed"
+#define OOO_STRING_SVTOOLS_HTML_horzrule "hr"
+#define OOO_STRING_SVTOOLS_HTML_image "img"
+#define OOO_STRING_SVTOOLS_HTML_input "input"
+#define OOO_STRING_SVTOOLS_HTML_linebreak "br"
+#define OOO_STRING_SVTOOLS_HTML_li "li"
+#define OOO_STRING_SVTOOLS_HTML_link "link"
+#define OOO_STRING_SVTOOLS_HTML_meta "meta"
+#define OOO_STRING_SVTOOLS_HTML_nobr "nobr"
+#define OOO_STRING_SVTOOLS_HTML_option "option"
+#define OOO_STRING_SVTOOLS_HTML_param "param"
+#define OOO_STRING_SVTOOLS_HTML_spacer "spacer"
+
+// these are switched off again
+#define OOO_STRING_SVTOOLS_HTML_abbreviation "abbrev"
+#define OOO_STRING_SVTOOLS_HTML_acronym "acronym"
+#define OOO_STRING_SVTOOLS_HTML_address "address"
+#define OOO_STRING_SVTOOLS_HTML_anchor "a"
+#define OOO_STRING_SVTOOLS_HTML_applet "applet"
+#define OOO_STRING_SVTOOLS_HTML_author "au"
+#define OOO_STRING_SVTOOLS_HTML_banner "banner"
+#define OOO_STRING_SVTOOLS_HTML_basefont "basefont"
+#define OOO_STRING_SVTOOLS_HTML_bigprint "big"
+#define OOO_STRING_SVTOOLS_HTML_blink "blink"
+#define OOO_STRING_SVTOOLS_HTML_blockquote "blockquote"
+#define OOO_STRING_SVTOOLS_HTML_blockquote30 "bq"
+#define OOO_STRING_SVTOOLS_HTML_body "body"
+#define OOO_STRING_SVTOOLS_HTML_bold "b"
+#define OOO_STRING_SVTOOLS_HTML_caption "caption"
+#define OOO_STRING_SVTOOLS_HTML_center "center"
+#define OOO_STRING_SVTOOLS_HTML_citation "cite"
+#define OOO_STRING_SVTOOLS_HTML_code "code"
+#define OOO_STRING_SVTOOLS_HTML_col "col"
+#define OOO_STRING_SVTOOLS_HTML_colgroup "colgroup"
+#define OOO_STRING_SVTOOLS_HTML_credit "credit"
+#define OOO_STRING_SVTOOLS_HTML_dd "dd"
+#define OOO_STRING_SVTOOLS_HTML_deflist "dl"
+#define OOO_STRING_SVTOOLS_HTML_deletedtext "del"
+#define OOO_STRING_SVTOOLS_HTML_dirlist "dir"
+#define OOO_STRING_SVTOOLS_HTML_division "div"
+#define OOO_STRING_SVTOOLS_HTML_dt "dt"
+#define OOO_STRING_SVTOOLS_HTML_emphasis "em"
+#define OOO_STRING_SVTOOLS_HTML_figure "fig"
+#define OOO_STRING_SVTOOLS_HTML_font "font"
+#define OOO_STRING_SVTOOLS_HTML_footnote "fn"
+#define OOO_STRING_SVTOOLS_HTML_form "form"
+#define OOO_STRING_SVTOOLS_HTML_frame "frame"
+#define OOO_STRING_SVTOOLS_HTML_frameset "frameset"
+#define OOO_STRING_SVTOOLS_HTML_head1 "h1"
+#define OOO_STRING_SVTOOLS_HTML_head2 "h2"
+#define OOO_STRING_SVTOOLS_HTML_head3 "h3"
+#define OOO_STRING_SVTOOLS_HTML_head4 "h4"
+#define OOO_STRING_SVTOOLS_HTML_head5 "h5"
+#define OOO_STRING_SVTOOLS_HTML_head6 "h6"
+#define OOO_STRING_SVTOOLS_HTML_head "head"
+#define OOO_STRING_SVTOOLS_HTML_html "html"
+#define OOO_STRING_SVTOOLS_HTML_iframe "iframe"
+#define OOO_STRING_SVTOOLS_HTML_insertedtext "ins"
+#define OOO_STRING_SVTOOLS_HTML_italic "i"
+#define OOO_STRING_SVTOOLS_HTML_keyboard "kbd"
+#define OOO_STRING_SVTOOLS_HTML_language "lang"
+#define OOO_STRING_SVTOOLS_HTML_listheader "lh"
+#define OOO_STRING_SVTOOLS_HTML_map "map"
+#define OOO_STRING_SVTOOLS_HTML_menulist "menu"
+#define OOO_STRING_SVTOOLS_HTML_multicol "multicol"
+#define OOO_STRING_SVTOOLS_HTML_noembed "noembed"
+#define OOO_STRING_SVTOOLS_HTML_noframe "noframe"
+#define OOO_STRING_SVTOOLS_HTML_noframes "noframes"
+#define OOO_STRING_SVTOOLS_HTML_noscript "noscript"
+#define OOO_STRING_SVTOOLS_HTML_note "note"
+#define OOO_STRING_SVTOOLS_HTML_object "object"
+#define OOO_STRING_SVTOOLS_HTML_orderlist "ol"
+#define OOO_STRING_SVTOOLS_HTML_parabreak "p"
+#define OOO_STRING_SVTOOLS_HTML_person "person"
+#define OOO_STRING_SVTOOLS_HTML_plaintext "t"
+#define OOO_STRING_SVTOOLS_HTML_preformtxt "pre"
+#define OOO_STRING_SVTOOLS_HTML_sample "samp"
+#define OOO_STRING_SVTOOLS_HTML_script "script"
+#define OOO_STRING_SVTOOLS_HTML_select "select"
+#define OOO_STRING_SVTOOLS_HTML_shortquote "q"
+#define OOO_STRING_SVTOOLS_HTML_smallprint "small"
+#define OOO_STRING_SVTOOLS_HTML_span "span"
+#define OOO_STRING_SVTOOLS_HTML_strikethrough "s"
+#define OOO_STRING_SVTOOLS_HTML_strong "strong"
+#define OOO_STRING_SVTOOLS_HTML_style "style"
+#define OOO_STRING_SVTOOLS_HTML_subscript "sub"
+#define OOO_STRING_SVTOOLS_HTML_superscript "sup"
+#define OOO_STRING_SVTOOLS_HTML_table "table"
+#define OOO_STRING_SVTOOLS_HTML_tablerow "tr"
+#define OOO_STRING_SVTOOLS_HTML_tabledata "td"
+#define OOO_STRING_SVTOOLS_HTML_tableheader "th"
+#define OOO_STRING_SVTOOLS_HTML_tbody "tbody"
+#define OOO_STRING_SVTOOLS_HTML_teletype "tt"
+#define OOO_STRING_SVTOOLS_HTML_textarea "textarea"
+#define OOO_STRING_SVTOOLS_HTML_tfoot "tfoot"
+#define OOO_STRING_SVTOOLS_HTML_thead "thead"
+#define OOO_STRING_SVTOOLS_HTML_title "title"
+#define OOO_STRING_SVTOOLS_HTML_underline "u"
+#define OOO_STRING_SVTOOLS_HTML_unorderlist "ul"
+#define OOO_STRING_SVTOOLS_HTML_variable "var"
+
+// obsolete features
+#define OOO_STRING_SVTOOLS_HTML_xmp "xmp"
+#define OOO_STRING_SVTOOLS_HTML_listing "listing"
+
+// proposed features
+#define OOO_STRING_SVTOOLS_HTML_definstance "dfn"
+#define OOO_STRING_SVTOOLS_HTML_strike "strike"
+#define OOO_STRING_SVTOOLS_HTML_comment2 "comment"
+#define OOO_STRING_SVTOOLS_HTML_marquee "marquee"
+#define OOO_STRING_SVTOOLS_HTML_plaintext2 "plaintext"
+#define OOO_STRING_SVTOOLS_HTML_sdfield "sdfield"
+
+// names for all characters
+#define OOO_STRING_SVTOOLS_HTML_C_lt "lt"
+#define OOO_STRING_SVTOOLS_HTML_C_gt "gt"
+#define OOO_STRING_SVTOOLS_HTML_C_amp "amp"
+#define OOO_STRING_SVTOOLS_HTML_C_quot "quot"
+#define OOO_STRING_SVTOOLS_HTML_C_Aacute "Aacute"
+#define OOO_STRING_SVTOOLS_HTML_C_Agrave "Agrave"
+#define OOO_STRING_SVTOOLS_HTML_C_Acirc "Acirc"
+#define OOO_STRING_SVTOOLS_HTML_C_Atilde "Atilde"
+#define OOO_STRING_SVTOOLS_HTML_C_Aring "Aring"
+#define OOO_STRING_SVTOOLS_HTML_C_Auml "Auml"
+#define OOO_STRING_SVTOOLS_HTML_C_AElig "AElig"
+#define OOO_STRING_SVTOOLS_HTML_C_Ccedil "Ccedil"
+#define OOO_STRING_SVTOOLS_HTML_C_Eacute "Eacute"
+#define OOO_STRING_SVTOOLS_HTML_C_Egrave "Egrave"
+#define OOO_STRING_SVTOOLS_HTML_C_Ecirc "Ecirc"
+#define OOO_STRING_SVTOOLS_HTML_C_Euml "Euml"
+#define OOO_STRING_SVTOOLS_HTML_C_Iacute "Iacute"
+#define OOO_STRING_SVTOOLS_HTML_C_Igrave "Igrave"
+#define OOO_STRING_SVTOOLS_HTML_C_Icirc "Icirc"
+#define OOO_STRING_SVTOOLS_HTML_C_Iuml "Iuml"
+#define OOO_STRING_SVTOOLS_HTML_C_ETH "ETH"
+#define OOO_STRING_SVTOOLS_HTML_C_Ntilde "Ntilde"
+#define OOO_STRING_SVTOOLS_HTML_C_Oacute "Oacute"
+#define OOO_STRING_SVTOOLS_HTML_C_Ograve "Ograve"
+#define OOO_STRING_SVTOOLS_HTML_C_Ocirc "Ocirc"
+#define OOO_STRING_SVTOOLS_HTML_C_Otilde "Otilde"
+#define OOO_STRING_SVTOOLS_HTML_C_Ouml "Ouml"
+#define OOO_STRING_SVTOOLS_HTML_C_Oslash "Oslash"
+#define OOO_STRING_SVTOOLS_HTML_C_Uacute "Uacute"
+#define OOO_STRING_SVTOOLS_HTML_C_Ugrave "Ugrave"
+#define OOO_STRING_SVTOOLS_HTML_C_Ucirc "Ucirc"
+#define OOO_STRING_SVTOOLS_HTML_C_Uuml "Uuml"
+#define OOO_STRING_SVTOOLS_HTML_C_Yacute "Yacute"
+#define OOO_STRING_SVTOOLS_HTML_C_THORN "THORN"
+#define OOO_STRING_SVTOOLS_HTML_C_szlig "szlig"
+#define OOO_STRING_SVTOOLS_HTML_S_aacute "aacute"
+#define OOO_STRING_SVTOOLS_HTML_S_agrave "agrave"
+#define OOO_STRING_SVTOOLS_HTML_S_acirc "acirc"
+#define OOO_STRING_SVTOOLS_HTML_S_atilde "atilde"
+#define OOO_STRING_SVTOOLS_HTML_S_aring "aring"
+#define OOO_STRING_SVTOOLS_HTML_S_auml "auml"
+#define OOO_STRING_SVTOOLS_HTML_S_aelig "aelig"
+#define OOO_STRING_SVTOOLS_HTML_S_ccedil "ccedil"
+#define OOO_STRING_SVTOOLS_HTML_S_eacute "eacute"
+#define OOO_STRING_SVTOOLS_HTML_S_egrave "egrave"
+#define OOO_STRING_SVTOOLS_HTML_S_ecirc "ecirc"
+#define OOO_STRING_SVTOOLS_HTML_S_euml "euml"
+#define OOO_STRING_SVTOOLS_HTML_S_iacute "iacute"
+#define OOO_STRING_SVTOOLS_HTML_S_igrave "igrave"
+#define OOO_STRING_SVTOOLS_HTML_S_icirc "icirc"
+#define OOO_STRING_SVTOOLS_HTML_S_iuml "iuml"
+#define OOO_STRING_SVTOOLS_HTML_S_eth "eth"
+#define OOO_STRING_SVTOOLS_HTML_S_ntilde "ntilde"
+#define OOO_STRING_SVTOOLS_HTML_S_oacute "oacute"
+#define OOO_STRING_SVTOOLS_HTML_S_ograve "ograve"
+#define OOO_STRING_SVTOOLS_HTML_S_ocirc "ocirc"
+#define OOO_STRING_SVTOOLS_HTML_S_otilde "otilde"
+#define OOO_STRING_SVTOOLS_HTML_S_ouml "ouml"
+#define OOO_STRING_SVTOOLS_HTML_S_oslash "oslash"
+#define OOO_STRING_SVTOOLS_HTML_S_uacute "uacute"
+#define OOO_STRING_SVTOOLS_HTML_S_ugrave "ugrave"
+#define OOO_STRING_SVTOOLS_HTML_S_ucirc "ucirc"
+#define OOO_STRING_SVTOOLS_HTML_S_uuml "uuml"
+#define OOO_STRING_SVTOOLS_HTML_S_yacute "yacute"
+#define OOO_STRING_SVTOOLS_HTML_S_thorn "thorn"
+#define OOO_STRING_SVTOOLS_HTML_S_yuml "yuml"
+#define OOO_STRING_SVTOOLS_HTML_S_acute "acute"
+#define OOO_STRING_SVTOOLS_HTML_S_brvbar "brvbar"
+#define OOO_STRING_SVTOOLS_HTML_S_cedil "cedil"
+#define OOO_STRING_SVTOOLS_HTML_S_cent "cent"
+#define OOO_STRING_SVTOOLS_HTML_S_copy "copy"
+#define OOO_STRING_SVTOOLS_HTML_S_curren "curren"
+#define OOO_STRING_SVTOOLS_HTML_S_deg "deg"
+#define OOO_STRING_SVTOOLS_HTML_S_divide "divide"
+#define OOO_STRING_SVTOOLS_HTML_S_frac12 "frac12"
+#define OOO_STRING_SVTOOLS_HTML_S_frac14 "frac14"
+#define OOO_STRING_SVTOOLS_HTML_S_frac34 "frac34"
+#define OOO_STRING_SVTOOLS_HTML_S_iexcl "iexcl"
+#define OOO_STRING_SVTOOLS_HTML_S_iquest "iquest"
+#define OOO_STRING_SVTOOLS_HTML_S_laquo "laquo"
+#define OOO_STRING_SVTOOLS_HTML_S_macr "macr"
+#define OOO_STRING_SVTOOLS_HTML_S_micro "micro"
+#define OOO_STRING_SVTOOLS_HTML_S_middot "middot"
+#define OOO_STRING_SVTOOLS_HTML_S_nbsp "nbsp"
+#define OOO_STRING_SVTOOLS_HTML_S_not "not"
+#define OOO_STRING_SVTOOLS_HTML_S_ordf "ordf"
+#define OOO_STRING_SVTOOLS_HTML_S_ordm "ordm"
+#define OOO_STRING_SVTOOLS_HTML_S_para "para"
+#define OOO_STRING_SVTOOLS_HTML_S_plusmn "plusmn"
+#define OOO_STRING_SVTOOLS_HTML_S_pound "pound"
+#define OOO_STRING_SVTOOLS_HTML_S_raquo "raquo"
+#define OOO_STRING_SVTOOLS_HTML_S_reg "reg"
+#define OOO_STRING_SVTOOLS_HTML_S_sect "sect"
+#define OOO_STRING_SVTOOLS_HTML_S_shy "shy"
+#define OOO_STRING_SVTOOLS_HTML_S_sup1 "sup1"
+#define OOO_STRING_SVTOOLS_HTML_S_sup2 "sup2"
+#define OOO_STRING_SVTOOLS_HTML_S_sup3 "sup3"
+#define OOO_STRING_SVTOOLS_HTML_S_times "times"
+#define OOO_STRING_SVTOOLS_HTML_S_uml "uml"
+#define OOO_STRING_SVTOOLS_HTML_S_yen "yen"
+
+// HTML4
+#define OOO_STRING_SVTOOLS_HTML_S_alefsym "alefsym"
+#define OOO_STRING_SVTOOLS_HTML_S_Alpha "Alpha"
+#define OOO_STRING_SVTOOLS_HTML_S_alpha "alpha"
+#define OOO_STRING_SVTOOLS_HTML_S_and "and"
+#define OOO_STRING_SVTOOLS_HTML_S_ang "ang"
+#define OOO_STRING_SVTOOLS_HTML_S_asymp "asymp"
+#define OOO_STRING_SVTOOLS_HTML_S_bdquo "bdquo"
+#define OOO_STRING_SVTOOLS_HTML_S_Beta "Beta"
+#define OOO_STRING_SVTOOLS_HTML_S_beta "beta"
+#define OOO_STRING_SVTOOLS_HTML_S_bull "bull"
+#define OOO_STRING_SVTOOLS_HTML_S_cap "cap"
+#define OOO_STRING_SVTOOLS_HTML_S_chi "chi"
+#define OOO_STRING_SVTOOLS_HTML_S_Chi "Chi"
+#define OOO_STRING_SVTOOLS_HTML_S_circ "circ"
+#define OOO_STRING_SVTOOLS_HTML_S_clubs "clubs"
+#define OOO_STRING_SVTOOLS_HTML_S_cong "cong"
+#define OOO_STRING_SVTOOLS_HTML_S_crarr "crarr"
+#define OOO_STRING_SVTOOLS_HTML_S_cup "cup"
+#define OOO_STRING_SVTOOLS_HTML_S_dagger "dagger"
+#define OOO_STRING_SVTOOLS_HTML_S_Dagger "Dagger"
+#define OOO_STRING_SVTOOLS_HTML_S_darr "darr"
+#define OOO_STRING_SVTOOLS_HTML_S_dArr "dArr"
+#define OOO_STRING_SVTOOLS_HTML_S_Delta "Delta"
+#define OOO_STRING_SVTOOLS_HTML_S_delta "delta"
+#define OOO_STRING_SVTOOLS_HTML_S_diams "diams"
+#define OOO_STRING_SVTOOLS_HTML_S_empty "empty"
+#define OOO_STRING_SVTOOLS_HTML_S_emsp "emsp"
+#define OOO_STRING_SVTOOLS_HTML_S_ensp "ensp"
+#define OOO_STRING_SVTOOLS_HTML_S_Epsilon "Epsilon"
+#define OOO_STRING_SVTOOLS_HTML_S_epsilon "epsilon"
+#define OOO_STRING_SVTOOLS_HTML_S_equiv "equiv"
+#define OOO_STRING_SVTOOLS_HTML_S_Eta "Eta"
+#define OOO_STRING_SVTOOLS_HTML_S_eta "eta"
+#define OOO_STRING_SVTOOLS_HTML_S_euro "euro"
+#define OOO_STRING_SVTOOLS_HTML_S_exist "exist"
+#define OOO_STRING_SVTOOLS_HTML_S_fnof "fnof"
+#define OOO_STRING_SVTOOLS_HTML_S_forall "forall"
+#define OOO_STRING_SVTOOLS_HTML_S_frasl "frasl"
+#define OOO_STRING_SVTOOLS_HTML_S_Gamma "Gamma"
+#define OOO_STRING_SVTOOLS_HTML_S_gamma "gamma"
+#define OOO_STRING_SVTOOLS_HTML_S_ge "ge"
+#define OOO_STRING_SVTOOLS_HTML_S_harr "harr"
+#define OOO_STRING_SVTOOLS_HTML_S_hArr "hArr"
+#define OOO_STRING_SVTOOLS_HTML_S_hearts "hearts"
+#define OOO_STRING_SVTOOLS_HTML_S_hellip "hellip"
+#define OOO_STRING_SVTOOLS_HTML_S_image "image"
+#define OOO_STRING_SVTOOLS_HTML_S_infin "infin"
+#define OOO_STRING_SVTOOLS_HTML_S_int "int"
+#define OOO_STRING_SVTOOLS_HTML_S_Iota "Iota"
+#define OOO_STRING_SVTOOLS_HTML_S_iota "iota"
+#define OOO_STRING_SVTOOLS_HTML_S_isin "isin"
+#define OOO_STRING_SVTOOLS_HTML_S_Kappa "Kappa"
+#define OOO_STRING_SVTOOLS_HTML_S_kappa "kappa"
+#define OOO_STRING_SVTOOLS_HTML_S_Lambda "Lambda"
+#define OOO_STRING_SVTOOLS_HTML_S_lambda "lambda"
+#define OOO_STRING_SVTOOLS_HTML_S_lang "lang"
+#define OOO_STRING_SVTOOLS_HTML_S_larr "larr"
+#define OOO_STRING_SVTOOLS_HTML_S_lArr "lArr"
+#define OOO_STRING_SVTOOLS_HTML_S_lceil "lceil"
+#define OOO_STRING_SVTOOLS_HTML_S_ldquo "ldquo"
+#define OOO_STRING_SVTOOLS_HTML_S_le "le"
+#define OOO_STRING_SVTOOLS_HTML_S_lfloor "lfloor"
+#define OOO_STRING_SVTOOLS_HTML_S_lowast "lowast"
+#define OOO_STRING_SVTOOLS_HTML_S_loz "loz"
+#define OOO_STRING_SVTOOLS_HTML_S_lrm "lrm"
+#define OOO_STRING_SVTOOLS_HTML_S_lsaquo "lsaquo"
+#define OOO_STRING_SVTOOLS_HTML_S_lsquo "lsquo"
+#define OOO_STRING_SVTOOLS_HTML_S_mdash "mdash"
+#define OOO_STRING_SVTOOLS_HTML_S_minus "minus"
+#define OOO_STRING_SVTOOLS_HTML_S_Mu "Mu"
+#define OOO_STRING_SVTOOLS_HTML_S_mu "mu"
+#define OOO_STRING_SVTOOLS_HTML_S_nabla "nabla"
+#define OOO_STRING_SVTOOLS_HTML_S_ndash "ndash"
+#define OOO_STRING_SVTOOLS_HTML_S_ne "ne"
+#define OOO_STRING_SVTOOLS_HTML_S_ni "ni"
+#define OOO_STRING_SVTOOLS_HTML_S_notin "notin"
+#define OOO_STRING_SVTOOLS_HTML_S_nsub "nsub"
+#define OOO_STRING_SVTOOLS_HTML_S_Nu "Nu"
+#define OOO_STRING_SVTOOLS_HTML_S_nu "nu"
+#define OOO_STRING_SVTOOLS_HTML_S_OElig "OElig"
+#define OOO_STRING_SVTOOLS_HTML_S_oelig "oelig"
+#define OOO_STRING_SVTOOLS_HTML_S_oline "oline"
+#define OOO_STRING_SVTOOLS_HTML_S_Omega "Omega"
+#define OOO_STRING_SVTOOLS_HTML_S_omega "omega"
+#define OOO_STRING_SVTOOLS_HTML_S_Omicron "Omicron"
+#define OOO_STRING_SVTOOLS_HTML_S_omicron "omicron"
+#define OOO_STRING_SVTOOLS_HTML_S_oplus "oplus"
+#define OOO_STRING_SVTOOLS_HTML_S_or "or"
+#define OOO_STRING_SVTOOLS_HTML_S_otimes "otimes"
+#define OOO_STRING_SVTOOLS_HTML_S_part "part"
+#define OOO_STRING_SVTOOLS_HTML_S_permil "permil"
+#define OOO_STRING_SVTOOLS_HTML_S_perp "perp"
+#define OOO_STRING_SVTOOLS_HTML_S_Phi "Phi"
+#define OOO_STRING_SVTOOLS_HTML_S_phi "phi"
+#define OOO_STRING_SVTOOLS_HTML_S_Pi "Pi"
+#define OOO_STRING_SVTOOLS_HTML_S_pi "pi"
+#define OOO_STRING_SVTOOLS_HTML_S_piv "piv"
+#define OOO_STRING_SVTOOLS_HTML_S_prime "prime"
+#define OOO_STRING_SVTOOLS_HTML_S_Prime "Prime"
+#define OOO_STRING_SVTOOLS_HTML_S_prod "prod"
+#define OOO_STRING_SVTOOLS_HTML_S_prop "prop"
+#define OOO_STRING_SVTOOLS_HTML_S_Psi "Psi"
+#define OOO_STRING_SVTOOLS_HTML_S_psi "psi"
+#define OOO_STRING_SVTOOLS_HTML_S_radic "radic"
+#define OOO_STRING_SVTOOLS_HTML_S_rang "rang"
+#define OOO_STRING_SVTOOLS_HTML_S_rarr "rarr"
+#define OOO_STRING_SVTOOLS_HTML_S_rArr "rArr"
+#define OOO_STRING_SVTOOLS_HTML_S_rceil "rceil"
+#define OOO_STRING_SVTOOLS_HTML_S_rdquo "rdquo"
+#define OOO_STRING_SVTOOLS_HTML_S_real "real"
+#define OOO_STRING_SVTOOLS_HTML_S_rfloor "rfloor"
+#define OOO_STRING_SVTOOLS_HTML_S_Rho "Rho"
+#define OOO_STRING_SVTOOLS_HTML_S_rho "rho"
+#define OOO_STRING_SVTOOLS_HTML_S_rlm "rlm"
+#define OOO_STRING_SVTOOLS_HTML_S_rsaquo "rsaquo"
+#define OOO_STRING_SVTOOLS_HTML_S_rsquo "rsquo"
+#define OOO_STRING_SVTOOLS_HTML_S_sbquo "sbquo"
+#define OOO_STRING_SVTOOLS_HTML_S_Scaron "Scaron"
+#define OOO_STRING_SVTOOLS_HTML_S_scaron "scaron"
+#define OOO_STRING_SVTOOLS_HTML_S_sdot "sdot"
+#define OOO_STRING_SVTOOLS_HTML_S_Sigma "Sigma"
+#define OOO_STRING_SVTOOLS_HTML_S_sigma "sigma"
+#define OOO_STRING_SVTOOLS_HTML_S_sigmaf "sigmaf"
+#define OOO_STRING_SVTOOLS_HTML_S_sim "sim"
+#define OOO_STRING_SVTOOLS_HTML_S_spades "spades"
+#define OOO_STRING_SVTOOLS_HTML_S_sub "sub"
+#define OOO_STRING_SVTOOLS_HTML_S_sube "sube"
+#define OOO_STRING_SVTOOLS_HTML_S_sum "sum"
+#define OOO_STRING_SVTOOLS_HTML_S_sup "sup"
+#define OOO_STRING_SVTOOLS_HTML_S_supe "supe"
+#define OOO_STRING_SVTOOLS_HTML_S_Tau "Tau"
+#define OOO_STRING_SVTOOLS_HTML_S_tau "tau"
+#define OOO_STRING_SVTOOLS_HTML_S_there4 "there4"
+#define OOO_STRING_SVTOOLS_HTML_S_Theta "Theta"
+#define OOO_STRING_SVTOOLS_HTML_S_theta "theta"
+#define OOO_STRING_SVTOOLS_HTML_S_thetasym "thetasym"
+#define OOO_STRING_SVTOOLS_HTML_S_thinsp "thinsp"
+#define OOO_STRING_SVTOOLS_HTML_S_tilde "tilde"
+#define OOO_STRING_SVTOOLS_HTML_S_trade "trade"
+#define OOO_STRING_SVTOOLS_HTML_S_uarr "uarr"
+#define OOO_STRING_SVTOOLS_HTML_S_uArr "uArr"
+#define OOO_STRING_SVTOOLS_HTML_S_upsih "upsih"
+#define OOO_STRING_SVTOOLS_HTML_S_Upsilon "Upsilon"
+#define OOO_STRING_SVTOOLS_HTML_S_upsilon "upsilon"
+#define OOO_STRING_SVTOOLS_HTML_S_weierp "weierp"
+#define OOO_STRING_SVTOOLS_HTML_S_Xi "Xi"
+#define OOO_STRING_SVTOOLS_HTML_S_xi "xi"
+#define OOO_STRING_SVTOOLS_HTML_S_Yuml "Yuml"
+#define OOO_STRING_SVTOOLS_HTML_S_Zeta "Zeta"
+#define OOO_STRING_SVTOOLS_HTML_S_zeta "zeta"
+#define OOO_STRING_SVTOOLS_HTML_S_zwj "zwj"
+#define OOO_STRING_SVTOOLS_HTML_S_zwnj "zwnj"
+
+// HTML attribute tokens (=options)
+
+// attributes without value
+#define OOO_STRING_SVTOOLS_HTML_O_checked "checked"
+#define OOO_STRING_SVTOOLS_HTML_O_compact "compact"
+#define OOO_STRING_SVTOOLS_HTML_O_declare "declare"
+#define OOO_STRING_SVTOOLS_HTML_O_disabled "disabled"
+#define OOO_STRING_SVTOOLS_HTML_O_ismap "ismap"
+#define OOO_STRING_SVTOOLS_HTML_O_mayscript "mayscript"
+#define OOO_STRING_SVTOOLS_HTML_O_multiple "multiple"
+#define OOO_STRING_SVTOOLS_HTML_O_nohref "nohref"
+#define OOO_STRING_SVTOOLS_HTML_O_noresize "noresize"
+#define OOO_STRING_SVTOOLS_HTML_O_noshade "noshade"
+#define OOO_STRING_SVTOOLS_HTML_O_nowrap "nowrap"
+#define OOO_STRING_SVTOOLS_HTML_O_sdfixed "sdfixed"
+#define OOO_STRING_SVTOOLS_HTML_O_selected "selected"
+
+// attributes with a string as value
+#define OOO_STRING_SVTOOLS_HTML_O_accesskey "accesskey"
+#define OOO_STRING_SVTOOLS_HTML_O_accept "accept"
+#define OOO_STRING_SVTOOLS_HTML_O_alt "alt"
+#define OOO_STRING_SVTOOLS_HTML_O_axis "axis"
+#define OOO_STRING_SVTOOLS_HTML_O_char "char"
+#define OOO_STRING_SVTOOLS_HTML_O_charset "charset"
+#define OOO_STRING_SVTOOLS_HTML_O_class "class"
+#define OOO_STRING_SVTOOLS_HTML_O_code "code"
+#define OOO_STRING_SVTOOLS_HTML_O_codetype "codetype"
+#define OOO_STRING_SVTOOLS_HTML_O_content "content"
+#define OOO_STRING_SVTOOLS_HTML_O_coords "coords"
+#define OOO_STRING_SVTOOLS_HTML_O_enctype "enctype"
+#define OOO_STRING_SVTOOLS_HTML_O_face "face"
+#define OOO_STRING_SVTOOLS_HTML_O_frameborder "frameborder"
+#define OOO_STRING_SVTOOLS_HTML_O_httpequiv "http-equiv"
+#define OOO_STRING_SVTOOLS_HTML_O_language "language"
+#define OOO_STRING_SVTOOLS_HTML_O_name "name"
+#define OOO_STRING_SVTOOLS_HTML_O_prompt "prompt"
+#define OOO_STRING_SVTOOLS_HTML_O_shape "shape"
+#define OOO_STRING_SVTOOLS_HTML_O_standby "standby"
+#define OOO_STRING_SVTOOLS_HTML_O_style "style"
+#define OOO_STRING_SVTOOLS_HTML_O_title "title"
+#define OOO_STRING_SVTOOLS_HTML_O_value "value"
+#define OOO_STRING_SVTOOLS_HTML_O_SDval "sdval"
+#define OOO_STRING_SVTOOLS_HTML_O_SDnum "sdnum"
+#define OOO_STRING_SVTOOLS_HTML_O_sdlibrary "sdlibrary"
+#define OOO_STRING_SVTOOLS_HTML_O_sdmodule "sdmodule"
+#define OOO_STRING_SVTOOLS_HTML_O_sdevent "sdevent-"
+#define OOO_STRING_SVTOOLS_HTML_O_sdaddparam "sdaddparam-"
+
+// attributes with an SGML identifier as value
+#define OOO_STRING_SVTOOLS_HTML_O_id "id"
+#define OOO_STRING_SVTOOLS_HTML_O_target "target"
+#define OOO_STRING_SVTOOLS_HTML_O_to "to"
+
+// attributes with a URI as value
+#define OOO_STRING_SVTOOLS_HTML_O_action "action"
+#define OOO_STRING_SVTOOLS_HTML_O_archive "archive"
+#define OOO_STRING_SVTOOLS_HTML_O_background "background"
+#define OOO_STRING_SVTOOLS_HTML_O_classid "classid"
+#define OOO_STRING_SVTOOLS_HTML_O_codebase "codebase"
+#define OOO_STRING_SVTOOLS_HTML_O_data "data"
+#define OOO_STRING_SVTOOLS_HTML_O_href "href"
+#define OOO_STRING_SVTOOLS_HTML_O_script "script"
+#define OOO_STRING_SVTOOLS_HTML_O_src "src"
+#define OOO_STRING_SVTOOLS_HTML_O_usemap "usemap"
+
+// attributes with a colour as value (all Netscape)
+#define OOO_STRING_SVTOOLS_HTML_O_alink "alink"
+#define OOO_STRING_SVTOOLS_HTML_O_bgcolor "bgcolor"
+#define OOO_STRING_SVTOOLS_HTML_O_bordercolor "bordercolor"
+#define OOO_STRING_SVTOOLS_HTML_O_bordercolorlight "bordercolorlight"
+#define OOO_STRING_SVTOOLS_HTML_O_bordercolordark "bordercolordark"
+#define OOO_STRING_SVTOOLS_HTML_O_color "color"
+#define OOO_STRING_SVTOOLS_HTML_O_link "link"
+#define OOO_STRING_SVTOOLS_HTML_O_text "text"
+#define OOO_STRING_SVTOOLS_HTML_O_vlink "vlink"
+
+// attributes with a numerical value
+#define OOO_STRING_SVTOOLS_HTML_O_border "border"
+#define OOO_STRING_SVTOOLS_HTML_O_cellspacing "cellspacing"
+#define OOO_STRING_SVTOOLS_HTML_O_cellpadding "cellpadding"
+#define OOO_STRING_SVTOOLS_HTML_O_charoff "charoff"
+#define OOO_STRING_SVTOOLS_HTML_O_colspan "colspan"
+#define OOO_STRING_SVTOOLS_HTML_O_framespacing "framespacing"
+#define OOO_STRING_SVTOOLS_HTML_O_gutter "gutter"
+#define OOO_STRING_SVTOOLS_HTML_O_height "height"
+#define OOO_STRING_SVTOOLS_HTML_O_hspace "hspace"
+#define OOO_STRING_SVTOOLS_HTML_O_left "left"
+#define OOO_STRING_SVTOOLS_HTML_O_loop "loop"
+#define OOO_STRING_SVTOOLS_HTML_O_marginheight "marginheight"
+#define OOO_STRING_SVTOOLS_HTML_O_marginwidth "marginwidth"
+#define OOO_STRING_SVTOOLS_HTML_O_maxlength "maxlength"
+#define OOO_STRING_SVTOOLS_HTML_O_rowspan "rowspan"
+#define OOO_STRING_SVTOOLS_HTML_O_scrollamount "scrollamount"
+#define OOO_STRING_SVTOOLS_HTML_O_scrolldelay "scrolldelay"
+#define OOO_STRING_SVTOOLS_HTML_O_span "span"
+#define OOO_STRING_SVTOOLS_HTML_O_tabindex "tabindex"
+#define OOO_STRING_SVTOOLS_HTML_O_vspace "vspace"
+#define OOO_STRING_SVTOOLS_HTML_O_width "width"
+#define OOO_STRING_SVTOOLS_HTML_O_zindex "z-index"
+
+// attributes with enum values
+#define OOO_STRING_SVTOOLS_HTML_O_behavior "behavior"
+#define OOO_STRING_SVTOOLS_HTML_O_clear "clear"
+#define OOO_STRING_SVTOOLS_HTML_O_dir "dir"
+#define OOO_STRING_SVTOOLS_HTML_O_direction "direction"
+#define OOO_STRING_SVTOOLS_HTML_O_format "format"
+#define OOO_STRING_SVTOOLS_HTML_O_frame "frame"
+#define OOO_STRING_SVTOOLS_HTML_O_lang "lang"
+#define OOO_STRING_SVTOOLS_XHTML_O_lang "xml:lang"
+#define OOO_STRING_SVTOOLS_HTML_O_method "method"
+#define OOO_STRING_SVTOOLS_HTML_O_rel "rel"
+#define OOO_STRING_SVTOOLS_HTML_O_rev "rev"
+#define OOO_STRING_SVTOOLS_HTML_O_rules "rules"
+#define OOO_STRING_SVTOOLS_HTML_O_scrolling "scrolling"
+#define OOO_STRING_SVTOOLS_HTML_O_sdreadonly "readonly"
+#define OOO_STRING_SVTOOLS_HTML_O_subtype "subtype"
+#define OOO_STRING_SVTOOLS_HTML_O_type "type"
+#define OOO_STRING_SVTOOLS_HTML_O_valign "valign"
+#define OOO_STRING_SVTOOLS_HTML_O_valuetype "valuetype"
+#define OOO_STRING_SVTOOLS_HTML_O_wrap "wrap"
+
+// attributes with script code as value
+#define OOO_STRING_SVTOOLS_HTML_O_onblur "onblur"
+#define OOO_STRING_SVTOOLS_HTML_O_onchange "onchange"
+#define OOO_STRING_SVTOOLS_HTML_O_onclick "onclick"
+#define OOO_STRING_SVTOOLS_HTML_O_onfocus "onfocus"
+#define OOO_STRING_SVTOOLS_HTML_O_onload "onload"
+#define OOO_STRING_SVTOOLS_HTML_O_onmouseover "onmouseover"
+#define OOO_STRING_SVTOOLS_HTML_O_onreset "onreset"
+#define OOO_STRING_SVTOOLS_HTML_O_onselect "onselect"
+#define OOO_STRING_SVTOOLS_HTML_O_onsubmit "onsubmit"
+#define OOO_STRING_SVTOOLS_HTML_O_onunload "onunload"
+#define OOO_STRING_SVTOOLS_HTML_O_onabort "onabort"
+#define OOO_STRING_SVTOOLS_HTML_O_onerror "onerror"
+#define OOO_STRING_SVTOOLS_HTML_O_onmouseout "onmouseout"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonblur "sdonblur"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonchange "sdonchange"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonclick "sdonclick"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonfocus "sdonfocus"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonload "sdonload"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonmouseover "sdonmouseover"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonreset "sdonreset"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonselect "sdonselect"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonsubmit "sdonsubmit"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonunload "sdonunload"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonabort "sdonabort"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonerror "sdonerror"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonmouseout "sdonmouseout"
+
+// attributes with context-dependent values
+#define OOO_STRING_SVTOOLS_HTML_O_align "align"
+#define OOO_STRING_SVTOOLS_HTML_O_cols "cols"
+#define OOO_STRING_SVTOOLS_HTML_O_rows "rows"
+#define OOO_STRING_SVTOOLS_HTML_O_start "start"
+#define OOO_STRING_SVTOOLS_HTML_O_size "size"
+
+// values of <INPUT TYPE=...>
+#define OOO_STRING_SVTOOLS_HTML_IT_text "text"
+#define OOO_STRING_SVTOOLS_HTML_IT_password "password"
+#define OOO_STRING_SVTOOLS_HTML_IT_checkbox "checkbox"
+#define OOO_STRING_SVTOOLS_HTML_IT_radio "radio"
+#define OOO_STRING_SVTOOLS_HTML_IT_range "range"
+#define OOO_STRING_SVTOOLS_HTML_IT_scribble "scribble"
+#define OOO_STRING_SVTOOLS_HTML_IT_file "file"
+#define OOO_STRING_SVTOOLS_HTML_IT_hidden "hidden"
+#define OOO_STRING_SVTOOLS_HTML_IT_submit "submit"
+#define OOO_STRING_SVTOOLS_HTML_IT_image "image"
+#define OOO_STRING_SVTOOLS_HTML_IT_reset "reset"
+#define OOO_STRING_SVTOOLS_HTML_IT_button "button"
+
+// values of <TABLE FRAME=...>
+#define OOO_STRING_SVTOOLS_HTML_TF_void "void"
+#define OOO_STRING_SVTOOLS_HTML_TF_above "above"
+#define OOO_STRING_SVTOOLS_HTML_TF_below "below"
+#define OOO_STRING_SVTOOLS_HTML_TF_hsides "hsides"
+#define OOO_STRING_SVTOOLS_HTML_TF_lhs "lhs"
+#define OOO_STRING_SVTOOLS_HTML_TF_rhs "rhs"
+#define OOO_STRING_SVTOOLS_HTML_TF_vsides "vsides"
+#define OOO_STRING_SVTOOLS_HTML_TF_box "box"
+#define OOO_STRING_SVTOOLS_HTML_TF_border "border"
+
+// values of <TABLE RULES=...>
+#define OOO_STRING_SVTOOLS_HTML_TR_none "none"
+#define OOO_STRING_SVTOOLS_HTML_TR_groups "groups"
+#define OOO_STRING_SVTOOLS_HTML_TR_rows "rows"
+#define OOO_STRING_SVTOOLS_HTML_TR_cols "cols"
+#define OOO_STRING_SVTOOLS_HTML_TR_all "all"
+
+// values of <P, H?, TR, TH, TD ALIGN=...>
+#define OOO_STRING_SVTOOLS_HTML_AL_left "left"
+#define OOO_STRING_SVTOOLS_HTML_AL_center "center"
+#define OOO_STRING_SVTOOLS_HTML_AL_middle "middle"
+#define OOO_STRING_SVTOOLS_HTML_AL_right "right"
+#define OOO_STRING_SVTOOLS_HTML_AL_justify "justify"
+#define OOO_STRING_SVTOOLS_HTML_AL_char "char"
+#define OOO_STRING_SVTOOLS_HTML_AL_all "all"
+
+// values of <TR VALIGN=...>, <IMG ALIGN=...>
+#define OOO_STRING_SVTOOLS_HTML_VA_top "top"
+#define OOO_STRING_SVTOOLS_HTML_VA_middle "middle"
+#define OOO_STRING_SVTOOLS_HTML_VA_bottom "bottom"
+#define OOO_STRING_SVTOOLS_HTML_VA_baseline "baseline"
+#define OOO_STRING_SVTOOLS_HTML_VA_texttop "texttop"
+#define OOO_STRING_SVTOOLS_HTML_VA_absmiddle "absmiddle"
+#define OOO_STRING_SVTOOLS_HTML_VA_absbottom "absbottom"
+
+// values of <AREA SHAPE=...>
+#define OOO_STRING_SVTOOLS_HTML_SH_rect "rect"
+#define OOO_STRING_SVTOOLS_HTML_SH_rectangle "rectangle"
+#define OOO_STRING_SVTOOLS_HTML_SH_circ "circ"
+#define OOO_STRING_SVTOOLS_HTML_SH_circle "circle"
+#define OOO_STRING_SVTOOLS_HTML_SH_poly "poly"
+#define OOO_STRING_SVTOOLS_HTML_SH_polygon "polygon"
+
+#define OOO_STRING_SVTOOLS_HTML_LG_starbasic "starbasic"
+#define OOO_STRING_SVTOOLS_HTML_LG_javascript "javascript"
+#define OOO_STRING_SVTOOLS_HTML_LG_javascript11 "javascript1.1"
+#define OOO_STRING_SVTOOLS_HTML_LG_livescript "livescript"
+
+// a few values for StarBASIC-Support
+#define OOO_STRING_SVTOOLS_HTML_SB_library "$LIBRARY:"
+#define OOO_STRING_SVTOOLS_HTML_SB_module "$MODULE:"
+
+// values of <FORM METHOD=...>
+#define OOO_STRING_SVTOOLS_HTML_METHOD_get "get"
+#define OOO_STRING_SVTOOLS_HTML_METHOD_post "post"
+
+// values of <META CONTENT/HTTP-EQUIV=...>
+#define OOO_STRING_SVTOOLS_HTML_META_refresh "refresh"
+#define OOO_STRING_SVTOOLS_HTML_META_generator "generator"
+#define OOO_STRING_SVTOOLS_HTML_META_author "author"
+#define OOO_STRING_SVTOOLS_HTML_META_classification "classification"
+#define OOO_STRING_SVTOOLS_HTML_META_description "description"
+#define OOO_STRING_SVTOOLS_HTML_META_keywords "keywords"
+#define OOO_STRING_SVTOOLS_HTML_META_changed "changed"
+#define OOO_STRING_SVTOOLS_HTML_META_changedby "changedby"
+#define OOO_STRING_SVTOOLS_HTML_META_created "created"
+#define OOO_STRING_SVTOOLS_HTML_META_content_type "content-type"
+#define OOO_STRING_SVTOOLS_HTML_META_content_script_type "content-script-type"
+#define OOO_STRING_SVTOOLS_HTML_META_sdendnote "sdendnote"
+#define OOO_STRING_SVTOOLS_HTML_META_sdfootnote "sdfootnote"
+
+// values of <UL TYPE=...>
+#define OOO_STRING_SVTOOLS_HTML_ULTYPE_disc "disc"
+#define OOO_STRING_SVTOOLS_HTML_ULTYPE_square "square"
+#define OOO_STRING_SVTOOLS_HTML_ULTYPE_circle "circle"
+
+// values of <MARQUEE BEHAVIOUR=...>
+#define OOO_STRING_SVTOOLS_HTML_BEHAV_scroll "scroll"
+#define OOO_STRING_SVTOOLS_HTML_BEHAV_slide "slide"
+#define OOO_STRING_SVTOOLS_HTML_BEHAV_alternate "alternate"
+
+// values of <MARQUEE LOOP=...>
+#define OOO_STRING_SVTOOLS_HTML_LOOP_infinite "infinite"
+#define OOO_STRING_SVTOOLS_HTML_SPTYPE_block "block"
+#define OOO_STRING_SVTOOLS_HTML_SPTYPE_horizontal "horizontal"
+#define OOO_STRING_SVTOOLS_HTML_SPTYPE_vertical "vertical"
+
+// internal graphics names
+#define OOO_STRING_SVTOOLS_HTML_private_image "private:image/"
+#define OOO_STRING_SVTOOLS_HTML_internal_icon "internal-icon-"
+#define OOO_STRING_SVTOOLS_HTML_INT_ICON_baddata "baddata"
+#define OOO_STRING_SVTOOLS_HTML_INT_ICON_delayed "delayed"
+#define OOO_STRING_SVTOOLS_HTML_INT_ICON_embed "embed"
+#define OOO_STRING_SVTOOLS_HTML_INT_ICON_insecure "insecure"
+#define OOO_STRING_SVTOOLS_HTML_INT_ICON_notfound "notfound"
+#define OOO_STRING_SVTOOLS_HTML_sdendnote "sdendnote"
+#define OOO_STRING_SVTOOLS_HTML_sdendnote_anc "sdendnoteanc"
+#define OOO_STRING_SVTOOLS_HTML_sdendnote_sym "sdendnotesym"
+#define OOO_STRING_SVTOOLS_HTML_sdfootnote "sdfootnote"
+#define OOO_STRING_SVTOOLS_HTML_sdfootnote_anc "sdfootnoteanc"
+#define OOO_STRING_SVTOOLS_HTML_sdfootnote_sym "sdfootnotesym"
+#define OOO_STRING_SVTOOLS_HTML_FTN_anchor "anc"
+#define OOO_STRING_SVTOOLS_HTML_FTN_symbol "sym"
+#define OOO_STRING_SVTOOLS_HTML_WW_off "off"
+#define OOO_STRING_SVTOOLS_HTML_WW_hard "hard"
+#define OOO_STRING_SVTOOLS_HTML_WW_soft "soft"
+#define OOO_STRING_SVTOOLS_HTML_WW_virtual "virtual"
+#define OOO_STRING_SVTOOLS_HTML_WW_physical "physical"
+#define OOO_STRING_SVTOOLS_HTML_on "on"
+#define OOO_STRING_SVTOOLS_HTML_ET_url "application/x-www-form-urlencoded"
+#define OOO_STRING_SVTOOLS_HTML_ET_multipart "multipart/form-data"
+#define OOO_STRING_SVTOOLS_HTML_ET_text "text/plain"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/htmlout.hxx b/include/svtools/htmlout.hxx
new file mode 100644
index 000000000..8bd34b5f1
--- /dev/null
+++ b/include/svtools/htmlout.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <svtools/svtdllapi.h>
+#include <rtl/textenc.h>
+#include <rtl/string.hxx>
+#include <svl/macitem.hxx>
+
+class Color;
+class ImageMap;
+class HtmlWriter;
+class SvStream;
+class SvNumberFormatter;
+
+struct HTMLOutEvent
+{
+ const char *pBasicName;
+ const char *pJavaName;
+ SvMacroItemId nEvent;
+};
+
+struct HTMLOutFuncs
+{
+ SVT_DLLPUBLIC static OString ConvertStringToHTML( const OUString& sSrc,
+ OUString *pNonConvertableChars = nullptr );
+
+ SVT_DLLPUBLIC static SvStream& Out_AsciiTag( SvStream&, std::string_view rStr,
+ bool bOn = true);
+ SVT_DLLPUBLIC static SvStream& Out_Char( SvStream&, sal_uInt32 cChar,
+ OUString *pNonConvertableChars = nullptr );
+ SVT_DLLPUBLIC static SvStream& Out_String( SvStream&, const OUString&,
+ OUString *pNonConvertableChars = nullptr );
+ SVT_DLLPUBLIC static SvStream& Out_Hex( SvStream&, sal_uInt32 nHex, sal_uInt8 nLen );
+ SVT_DLLPUBLIC static SvStream& Out_Color( SvStream&, const Color&, bool bXHTML = false );
+ SVT_DLLPUBLIC static SvStream& Out_ImageMap( SvStream&, const OUString&, const ImageMap&, const OUString&,
+ const HTMLOutEvent *pEventTable,
+ bool bOutStarBasic,
+ const char *pDelim,
+ const char *pIndentArea,
+ const char *pIndentMap,
+ OUString *pNonConvertableChars = nullptr );
+ SVT_DLLPUBLIC static SvStream& FlushToAscii( SvStream& );
+
+ SVT_DLLPUBLIC static SvStream& OutScript( SvStream& rStrm,
+ const OUString& rBaseURL,
+ std::u16string_view rSource,
+ const OUString& rLanguage,
+ ScriptType eScriptType,
+ const OUString& rSrc,
+ const OUString *pSBLibrary,
+ const OUString *pSBModule,
+ OUString *pNonConvertableChars = nullptr );
+
+ // the 3rd parameter is an array of HTMLOutEvents which is terminated
+ // by an entry that consists only of 0s
+ SVT_DLLPUBLIC static SvStream& Out_Events( SvStream&, const SvxMacroTableDtor&,
+ const HTMLOutEvent*, bool bOutStarBasic,
+ OUString *pNonConvertableChars = nullptr );
+
+ // <TD SDVAL="..." SDNUM="...">
+ SVT_DLLPUBLIC static OString CreateTableDataOptionsValNum(
+ bool bValue, double fVal, sal_uInt32 nFormat,
+ SvNumberFormatter& rFormatter,
+ OUString *pNonConvertableChars = nullptr);
+ SVT_DLLPUBLIC static bool PrivateURLToInternalImg( OUString& rURL );
+};
+
+struct HtmlWriterHelper
+{
+ SVT_DLLPUBLIC static void applyColor( HtmlWriter& rHtmlWriter, std::string_view aAttributeName, const Color& rColor);
+ SVT_DLLPUBLIC static void applyEvents(HtmlWriter& rHtmlWriter, const SvxMacroTableDtor& rMacroTable, const HTMLOutEvent* pEventTable, bool bOutStarBasic);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/htmltokn.h b/include/svtools/htmltokn.h
new file mode 100644
index 000000000..9dca8a8f3
--- /dev/null
+++ b/include/svtools/htmltokn.h
@@ -0,0 +1,479 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <sal/types.h>
+#include <stdexcept>
+#include <string_view>
+
+namespace rtl {
+ class OUString;
+};
+enum class HtmlOptionId;
+enum class HtmlTokenId : sal_Int16;
+
+// search the char for the CharName
+sal_Unicode GetHTMLCharName( std::u16string_view rName );
+
+// search the TokenID for the token
+SVT_DLLPUBLIC HtmlTokenId GetHTMLToken( std::u16string_view rName );
+
+// search the TokenId for an attribute token
+HtmlOptionId GetHTMLOption( std::u16string_view rName );
+
+// search the 24-bit color for a color name (not found = SAL_MAX_UINT32)
+SVT_DLLPUBLIC sal_uInt32 GetHTMLColor( const rtl::OUString& rName );
+
+enum class HtmlTokenId : sal_Int16
+{
+ INVALID = -1,
+ NONE = 0,
+// always starting from 256 on, greater than a char
+ TEXTTOKEN = 0x100,
+ SINGLECHAR,
+ NEWPARA,
+ TABCHAR,
+ RAWDATA,
+ LINEFEEDCHAR,
+
+ // these will only be turned on
+ AREA, // Netscape 2.0
+ BASE, // HTML 3.0
+ COMMENT,
+ CDATA,
+ DUMMY, // so ONOFF_START is even
+ DOCTYPE,
+ EMBED, // Netscape 2.0 ignore </EMBED>
+ HORZRULE, // ignore </HR>
+ IMAGE, // ignore </IMG>
+ INPUT, // ignore </INPUT>
+ LINEBREAK, // </BR> -> <BR>
+ LINK, // HTML 3.0
+ META, // HTML 3.0 ignore </META>
+ OPTION, // ignore </OPTION>
+ PARAM, // HotJava
+ SPACER, // Netscape 3.0b5 // ignore </SPACER>
+
+ // tokens recognised using HTML character
+ NONBREAKSPACE,
+ SOFTHYPH,
+
+ // these will be turned back off,
+ // the off value is always located behind (+1) !!
+ ONOFF_START,
+ ABBREVIATION_ON = ONOFF_START, // HTML 3.0
+ ABBREVIATION_OFF, // HTML 3.0
+ ACRONYM_ON, // HTML 3.0
+ ACRONYM_OFF, // HTML 3.0
+ ADDRESS_ON,
+ ADDRESS_OFF,
+ ANCHOR_ON,
+ ANCHOR_OFF,
+ APPLET_ON, // HotJava
+ APPLET_OFF, // HotJava
+ AUTHOR_ON, // HTML 3.0
+ AUTHOR_OFF, // HTML 3.0
+ BANNER_ON, // HTML 3.0
+ BANNER_OFF, // HTML 3.0
+ BASEFONT_ON, // Netscape
+ BASEFONT_OFF, // Netscape
+ BIGPRINT_ON, // HTML 3.0
+ BIGPRINT_OFF, // HTML 3.0
+ BLINK_ON, // Netscape
+ BLINK_OFF, // Netscape
+ BLOCKQUOTE30_ON, // HTML 3.0
+ BLOCKQUOTE30_OFF, // HTML 3.0
+ BLOCKQUOTE_ON,
+ BLOCKQUOTE_OFF,
+ BODY_ON,
+ BODY_OFF,
+ BOLD_ON,
+ BOLD_OFF,
+ CAPTION_ON, // HTML 3.0
+ CAPTION_OFF, // HTML 3.0
+ CENTER_ON, // Netscape
+ CENTER_OFF, // Netscape
+ CITATION_ON,
+ CITATION_OFF,
+ CODE_ON,
+ CODE_OFF,
+ COL_ON, // HTML3 Table Model Draft
+ COL_OFF, // HTML3 Table Model Draft
+ COLGROUP_ON, // HTML3 Table Model Draft
+ COLGROUP_OFF, // HTML3 Table Model Draft
+ CREDIT_ON, // HTML 3.0
+ CREDIT_OFF, // HTML 3.0
+ DD_ON,
+ DD_OFF,
+ DEFLIST_ON,
+ DEFLIST_OFF,
+ DELETEDTEXT_ON, // HTML 3.0
+ DELETEDTEXT_OFF, // HTML 3.0
+ DIRLIST_ON,
+ DIRLIST_OFF,
+ DIVISION_ON, // HTML 3.0
+ DIVISION_OFF, // HTML 3.0
+ DT_ON,
+ DT_OFF,
+ EMPHASIS_ON,
+ EMPHASIS_OFF,
+ FIGURE_ON, // HTML 3.0
+ FIGURE_OFF, // HTML 3.0
+ FONT_ON, // Netscape
+ FONT_OFF, // Netscape
+ FOOTNOTE_ON, // HTML 3.0
+ FOOTNOTE_OFF, // HTML 3.0
+ FORM_ON,
+ FORM_OFF,
+ FRAME_ON, // Netscape 2.0
+ FRAME_OFF, // Netscape 2.0
+ FRAMESET_ON, // Netscape 2.0
+ FRAMESET_OFF, // Netscape 2.0
+ HEAD1_ON,
+ HEAD1_OFF,
+ HEAD2_ON,
+ HEAD2_OFF,
+ HEAD3_ON,
+ HEAD3_OFF,
+ HEAD4_ON,
+ HEAD4_OFF,
+ HEAD5_ON,
+ HEAD5_OFF,
+ HEAD6_ON,
+ HEAD6_OFF,
+ HEAD_ON,
+ HEAD_OFF,
+ HTML_ON,
+ HTML_OFF,
+ IFRAME_ON, // IE 3.0b2
+ IFRAME_OFF, // IE 3.0b2
+ INSERTEDTEXT_ON, // HTML 3.0
+ INSERTEDTEXT_OFF, // HTML 3.0
+ ITALIC_ON,
+ ITALIC_OFF,
+ KEYBOARD_ON,
+ KEYBOARD_OFF,
+ LANGUAGE_ON, // HTML 3.0
+ LANGUAGE_OFF, // HTML 3.0
+ LISTHEADER_ON, // HTML 3.0
+ LISTHEADER_OFF, // HTML 3.0
+ LI_ON,
+ LI_OFF,
+ MAP_ON, // Netscape 2.0
+ MAP_OFF, // Netscape 2.0
+ MENULIST_ON,
+ MENULIST_OFF,
+ MULTICOL_ON, // Netscape 3.0b5
+ MULTICOL_OFF, // Netscape 3.0b5
+ NOBR_ON, // Netscape
+ NOBR_OFF, // Netscape
+ NOEMBED_ON, // Netscape 2.0
+ NOEMBED_OFF, // Netscape 2.0
+ NOFRAMES_ON, // Netscape 2.0
+ NOFRAMES_OFF, // Netscape 2.0
+ NOSCRIPT_ON, // Netscape 2.0
+ NOSCRIPT_OFF, // Netscape 3.0
+ NOTE_ON, // HTML 3.0
+ NOTE_OFF, // HTML 3.0
+ OBJECT_ON, // HotJava
+ OBJECT_OFF, // HotJava
+ ORDERLIST_ON,
+ ORDERLIST_OFF,
+ PARABREAK_ON,
+ PARABREAK_OFF,
+ PERSON_ON, // HTML 3.0
+ PERSON_OFF, // HTML 3.0
+ PLAINTEXT_ON, // HTML 3.0
+ PLAINTEXT_OFF, // HTML 3.0
+ PREFORMTXT_ON,
+ PREFORMTXT_OFF,
+ SAMPLE_ON,
+ SAMPLE_OFF,
+ SCRIPT_ON, // HTML 3.2
+ SCRIPT_OFF, // HTML 3.2
+ SELECT_ON,
+ SELECT_OFF,
+ SHORTQUOTE_ON, // HTML 3.0
+ SHORTQUOTE_OFF, // HTML 3.0
+ SMALLPRINT_ON, // HTML 3.0
+ SMALLPRINT_OFF, // HTML 3.0
+ SPAN_ON, // Style Sheets
+ SPAN_OFF, // Style Sheets
+ STRIKETHROUGH_ON, // HTML 3.0
+ STRIKETHROUGH_OFF, // HTML 3.0
+ STRONG_ON,
+ STRONG_OFF,
+ STYLE_ON, // HTML 3.0
+ STYLE_OFF, // HTML 3.0
+ SUBSCRIPT_ON, // HTML 3.0
+ SUBSCRIPT_OFF, // HTML 3.0
+ SUPERSCRIPT_ON, // HTML 3.0
+ SUPERSCRIPT_OFF, // HTML 3.0
+ TABLE_ON, // HTML 3.0
+ TABLE_OFF, // HTML 3.0
+ TABLEDATA_ON, // HTML 3.0
+ TABLEDATA_OFF, // HTML 3.0
+ TABLEHEADER_ON, // HTML 3.0
+ TABLEHEADER_OFF, // HTML 3.0
+ TABLEROW_ON, // HTML 3.0
+ TABLEROW_OFF, // HTML 3.0
+ TBODY_ON, // HTML3 Table Model Draft
+ TBODY_OFF, // HTML3 Table Model Draft
+ TELETYPE_ON,
+ TELETYPE_OFF,
+ TEXTAREA_ON,
+ TEXTAREA_OFF,
+ TFOOT_ON, // HTML3 Table Model Draft
+ TFOOT_OFF, // HTML3 Table Model Draft
+ THEAD_ON, // HTML3 Table Model Draft
+ THEAD_OFF, // HTML3 Table Model Draft
+ TITLE_ON,
+ TITLE_OFF,
+ UNDERLINE_ON,
+ UNDERLINE_OFF,
+ UNORDERLIST_ON,
+ UNORDERLIST_OFF,
+ VARIABLE_ON,
+ VARIABLE_OFF,
+
+ // obsolete features
+ XMP_ON,
+ XMP_OFF,
+ LISTING_ON,
+ LISTING_OFF,
+
+ // proposed features
+ DEFINSTANCE_ON,
+ DEFINSTANCE_OFF,
+ STRIKE_ON,
+ STRIKE_OFF,
+
+ UNKNOWNCONTROL_ON,
+ UNKNOWNCONTROL_OFF,
+
+ // Microsoft features
+ COMMENT2_ON, // HTML 2.0 ?
+ COMMENT2_OFF, // HTML 2.0 ?
+ MARQUEE_ON,
+ MARQUEE_OFF,
+ PLAINTEXT2_ON, // HTML 2.0 ?
+ PLAINTEXT2_OFF, // HTML 2.0 ?
+
+ SDFIELD_ON,
+ SDFIELD_OFF
+};
+
+constexpr bool isOffToken(HtmlTokenId nToken)
+{
+ return (nToken == HtmlTokenId::NONE || nToken >= HtmlTokenId::ONOFF_START)
+ ? (1 & static_cast<int>(nToken))
+ : throw std::logic_error("Assertion failed!"); // C++11 does not do assert in constexpr
+}
+
+constexpr HtmlTokenId getOnToken(HtmlTokenId nToken)
+{
+ return (nToken == HtmlTokenId::NONE || nToken >= HtmlTokenId::ONOFF_START)
+ ? HtmlTokenId(~1 & static_cast<int>(nToken))
+ : throw std::logic_error("Assertion failed!"); // C++11 does not do assert in constexpr
+}
+
+// HTML attribute token (=Options)
+
+enum class HtmlOptionId
+{
+// always starting from 256 on, greater than a char
+BOOL_START = 0x100,
+
+// attributes without value
+ CHECKED = BOOL_START,
+ COMPACT,
+ DECLARE, // IExplorer 3.0b5
+ DISABLED,
+ ISMAP,
+ MAYSCRIPT, // Netscape 3.0
+ MULTIPLE,
+ NOHREF, // Netscape
+ NORESIZE, // Netscape 2.0
+ NOSHADE, // Netscape
+ NOWRAP,
+ SDFIXED,
+ SELECTED,
+BOOL_END,
+
+// attributes with a string as value
+STRING_START = BOOL_END,
+ ACCEPT = STRING_START,
+ ACCESSKEY,
+ ALT,
+ AXIS,
+ CHAR, // HTML3 Table Model Draft
+ CHARSET,
+ CLASS,
+ CODE, // HotJava
+ CODETYPE,
+ CONTENT,
+ COORDS, // Netscape 2.0
+ ENCTYPE,
+ FACE, // IExplorer 2.0
+ FRAMEBORDER, // IExplorer 3.0
+ HTTPEQUIV,
+ LANGUAGE, // JavaScript
+ NAME,
+ PROMPT,
+ SHAPE,
+ STANDBY,
+ STYLE, // Style Sheets
+ TITLE,
+ VALUE,
+ SDVAL, // StarDiv NumberValue
+ SDNUM, // StarDiv NumberFormat
+ SDLIBRARY,
+ SDMODULE,
+STRING_END,
+
+// attributes with an SGML identifier as value
+SGMLID_START = STRING_END,
+ ID = SGMLID_START,
+ TARGET, // Netscape 2.0
+ TO,
+SGMLID_END,
+
+// attributes with a URI as value
+URI_START = SGMLID_END,
+ ACTION = URI_START,
+ ARCHIVE,
+ BACKGROUND,
+ CLASSID,
+ CODEBASE, // HotJava
+ DATA,
+ HREF,
+ SCRIPT,
+ SRC,
+ USEMAP, // Netscape 2.0
+URI_END,
+
+// attributes with a color as value (all Netscape)
+COLOR_START = URI_END,
+ ALINK = COLOR_START,
+ BGCOLOR,
+ BORDERCOLOR, // IExplorer 2.0
+ BORDERCOLORLIGHT, // IExplorer 2.0
+ BORDERCOLORDARK, // IExplorer 2.0
+ COLOR,
+ LINK,
+ TEXT,
+ VLINK,
+COLOR_END,
+
+// attributes with a numeric value
+NUMBER_START = COLOR_END,
+ BORDER = NUMBER_START,
+ CELLSPACING, // HTML3 Table Model Draft
+ CELLPADDING, // HTML3 Table Model Draft
+ CHAROFF, // HTML3 Table Model Draft
+ COLSPAN,
+ FRAMESPACING, // IExplorer 3.0
+ GUTTER, // Netscape 3.0b5
+ HEIGHT,
+ HSPACE, // Netscape
+ LEFT,
+ LOOP, // IExplorer 2.0
+ MARGINWIDTH, // Netscape 2.0
+ MARGINHEIGHT, // Netscape 2.0
+ MAXLENGTH,
+ ROWSPAN,
+ SCROLLAMOUNT, // IExplorer 2.0
+ SCROLLDELAY, // IExplorer 2.0
+ SPAN, // HTML3 Table Model Draft
+ TABINDEX,
+ VSPACE, // Netscape
+ WIDTH,
+ ZINDEX,
+NUMBER_END,
+
+// attributes with Enum values
+ENUM_START = NUMBER_END,
+ BEHAVIOR = ENUM_START, // IExplorer 2.0
+ CLEAR,
+ DIR,
+ DIRECTION, // IExplorer 2.0
+ FORMAT,
+ FRAME, // HTML3 Table Model Draft
+ LANG,
+ METHOD,
+ REL,
+ REV,
+ RULES, // HTML3 Table Model Draft
+ SCROLLING, // Netscape 2.0
+ SDREADONLY,
+ SUBTYPE,
+ TYPE,
+ VALIGN,
+ VALUETYPE,
+ WRAP,
+ENUM_END,
+
+// attributes with script code as value
+SCRIPT_START = ENUM_END,
+ ONABORT = SCRIPT_START, // JavaScript
+ ONBLUR, // JavaScript
+ ONCHANGE, // JavaScript
+ ONCLICK, // JavaScript
+ ONERROR, // JavaScript
+ ONFOCUS, // JavaScript
+ ONLOAD, // JavaScript
+ ONMOUSEOUT, // JavaScript
+ ONMOUSEOVER, // JavaScript
+ ONRESET, // JavaScript
+ ONSELECT, // JavaScript
+ ONSUBMIT, // JavaScript
+ ONUNLOAD, // JavaScript
+
+ SDONABORT, // StarBasic
+ SDONBLUR, // StarBasic
+ SDONCHANGE, // StarBasic
+ SDONCLICK, // StarBasic
+ SDONERROR, // StarBasic
+ SDONFOCUS, // StarBasic
+ SDONLOAD, // StarBasic
+ SDONMOUSEOUT, // StarBasic
+ SDONMOUSEOVER, // StarBasic
+ SDONRESET, // StarBasic
+ SDONSELECT, // StarBasic
+ SDONSUBMIT, // StarBasic
+ SDONUNLOAD, // StarBasic
+SCRIPT_END,
+
+// attributes with context dependent values
+CONTEXT_START = SCRIPT_END,
+ ALIGN = CONTEXT_START,
+ COLS, // Netscape 2.0 vs HTML 2.0
+ ROWS, // Netscape 2.0 vs HTML 2.0
+ SIZE,
+ START,
+CONTEXT_END,
+
+// an unknown option
+UNKNOWN = CONTEXT_END,
+END
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imagemgr.hxx b/include/svtools/imagemgr.hxx
new file mode 100644
index 000000000..a2b48247f
--- /dev/null
+++ b/include/svtools/imagemgr.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+#include <svtools/svtdllapi.h>
+#include <unotools/ucbhelper.hxx>
+#include <vcl/vclenum.hxx>
+
+enum class SvImageId {
+ NONE = 0,
+ START = 3076, // must match to old Id's in SFX!
+
+ Impress = START + 47,
+ Bitmap = START + 49,
+ Calc = START + 50,
+ CalcTemplate = START + 51,
+ Database = START + 53,
+ ImpressTemplate = START + 54,
+ GIF = START + 61,
+ HTML = START + 63,
+ JPG = START + 64,
+ WEBP = START + 65,
+ Math = START + 68,
+ MathTemplate = START + 69,
+ File = START + 74,
+ PCD = START + 76,
+ PCT = START + 77,
+ PCX = START + 78,
+ SIM = START + 79,
+ TextFile = START + 80,
+ TIFF = START + 82,
+ WMF = START + 84,
+ Writer = START + 86,
+ WriterTemplate = START + 87,
+ FixedDevice = START + 88,
+ RemoveableDevice = START + 89,
+ CDRomDevice = START + 90,
+ NetworkDevice = START + 91,
+ Table = START + 112,
+ Folder = START + 113,
+ DXF = START + 141,
+ MET = START + 142,
+ PNG = START + 143,
+ //retired SGF = START + 144,
+ //retired SGV = START + 145,
+ SVM = START + 146,
+ GlobalDoc = START + 150,
+ Draw = START + 151,
+ DrawTemplate = START + 152,
+ OO_DatabaseDoc = START + 169,
+ OO_DrawDoc = START + 170,
+ OO_MathDoc = START + 171,
+ OO_GlobalDoc = START + 172,
+ OO_ImpressDoc = START + 173,
+ OO_CalcDoc = START + 174,
+ OO_WriterDoc = START + 175,
+ OO_DrawTemplate = START + 176,
+ OO_ImpressTemplate = START + 177,
+ OO_CalcTemplate = START + 178,
+ OO_WriterTemplate = START + 179,
+ Extension = START + 180,
+};
+
+
+class Image;
+class INetURLObject;
+
+namespace svtools {
+
+struct VolumeInfo
+{
+ bool m_bIsVolume;
+ bool m_bIsRemote;
+ bool m_bIsRemoveable;
+ bool m_bIsFloppy;
+ bool m_bIsCompactDisc;
+
+ VolumeInfo() :
+ m_bIsVolume ( false ),
+ m_bIsRemote ( false ),
+ m_bIsRemoveable ( false ),
+ m_bIsFloppy ( false ),
+ m_bIsCompactDisc( false ) {}
+
+ VolumeInfo( bool _bIsVolume,
+ bool _bIsRemote,
+ bool _bIsRemoveable,
+ bool _bIsFloppy,
+ bool _bIsCompactDisc ) :
+ m_bIsVolume ( _bIsVolume ),
+ m_bIsRemote ( _bIsRemote ),
+ m_bIsRemoveable ( _bIsRemoveable ),
+ m_bIsFloppy ( _bIsFloppy ),
+ m_bIsCompactDisc( _bIsCompactDisc ) {}
+};
+
+}
+
+class SvFileInformationManager
+{
+private:
+ static OUString GetDescription_Impl( const INetURLObject& rObject, bool bDetectFolder );
+
+public:
+ SVT_DLLPUBLIC static OUString GetImageId( const INetURLObject& rURL, bool bBig = false );
+ SVT_DLLPUBLIC static Image GetImage(
+ const INetURLObject& rURL, bool bBig = false,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & env
+ = utl::UCBContentHelper::getDefaultCommandEnvironment());
+ SVT_DLLPUBLIC static OUString GetFileImageId( const INetURLObject& rURL );
+ SVT_DLLPUBLIC static Image GetImageNoDefault(const INetURLObject& rURL, vcl::ImageType eImageType = vcl::ImageType::Small);
+ SVT_DLLPUBLIC static OUString GetFolderImageId( const svtools::VolumeInfo& rInfo );
+
+ SVT_DLLPUBLIC static OUString GetDescription( const INetURLObject& rObject );
+ SVT_DLLPUBLIC static OUString GetFileDescription( const INetURLObject& rObject );
+ SVT_DLLPUBLIC static OUString GetFolderDescription( const svtools::VolumeInfo& rInfo );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imageresourceaccess.hxx b/include/svtools/imageresourceaccess.hxx
new file mode 100644
index 000000000..ca76c0909
--- /dev/null
+++ b/include/svtools/imageresourceaccess.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <memory>
+#include <string_view>
+
+#include <config_options.h>
+#include <svtools/svtdllapi.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com :: sun :: star :: io { class XInputStream; }
+namespace com :: sun :: star :: uno { class XComponentContext; }
+
+class SvStream;
+
+namespace svt::GraphicAccess
+{
+
+/** Helpers for obtaining streams (which also can be used with the ImageProducer)
+ from a resource.
+*/
+
+/** determines whether the given URL denotes an image within a resource */
+UNLESS_MERGELIBS(SVT_DLLPUBLIC) bool isSupportedURL(std::u16string_view rURL);
+
+/** for a given URL of an image within a resource, this method retrieves an
+ SvStream for this image.
+
+ This method works for arbitrary URLs denoting an image, since the
+ css::graphics::GraphicsProvider service is used
+ to resolve the URL. However, obtaining the stream is expensive (since
+ the image must be copied), so you are strongly encouraged to only use it
+ when you know that the image is small enough.
+*/
+UNLESS_MERGELIBS(SVT_DLLPUBLIC) std::unique_ptr<SvStream> getImageStream(
+ css::uno::Reference<css::uno::XComponentContext> const & rxContext,
+ OUString const & rImageResourceURL);
+
+/** for a given URL of an image within a resource, this method retrieves
+ a css::io::XInputStream for this image.
+*/
+UNLESS_MERGELIBS(SVT_DLLPUBLIC) css::uno::Reference<css::io::XInputStream> getImageXStream(
+ css::uno::Reference<css::uno::XComponentContext> const & rxContext,
+ OUString const & rImageResourceURL);
+
+} // namespace svt::GraphicAccess
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imgdef.hxx b/include/svtools/imgdef.hxx
new file mode 100644
index 000000000..44212cc47
--- /dev/null
+++ b/include/svtools/imgdef.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+enum SfxSymbolsSize
+{
+ SFX_SYMBOLS_SIZE_SMALL = 0,
+ SFX_SYMBOLS_SIZE_LARGE = 1,
+ SFX_SYMBOLS_SIZE_32 = 3, // keep the numbers as they are written into the profile
+ SFX_SYMBOLS_SIZE_AUTO = 2,
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/indexentryres.hxx b/include/svtools/indexentryres.hxx
new file mode 100644
index 000000000..42e809ad8
--- /dev/null
+++ b/include/svtools/indexentryres.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+
+class SVT_DLLPUBLIC IndexEntryResource
+{
+private:
+ // wrapper for locale specific translations data of indexentry algorithm
+ class IndexEntryResourceData
+ {
+ friend class IndexEntryResource;
+
+ private:
+ OUString m_aName;
+ OUString m_aTranslation;
+
+ public:
+ IndexEntryResourceData(const OUString& rAlgorithm, const OUString& rTranslation)
+ : m_aName(rAlgorithm)
+ , m_aTranslation(rTranslation)
+ {
+ }
+ const OUString& GetAlgorithm() const { return m_aName; }
+ const OUString& GetTranslation() const { return m_aTranslation; }
+ };
+ std::vector<IndexEntryResourceData> m_aData;
+
+public:
+ IndexEntryResource();
+ const OUString& GetTranslation(const OUString& rAlgorithm);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx
new file mode 100644
index 000000000..1789440f6
--- /dev/null
+++ b/include/svtools/inettbc.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <rtl/ref.hxx>
+#include <svtools/svtdllapi.h>
+#include <tools/urlobj.hxx>
+
+#include <vcl/idle.hxx>
+#include <vcl/weld.hxx>
+
+class SvtMatchContext_Impl;
+class SvtURLBox_Impl;
+
+class SVT_DLLPUBLIC SvtURLBox
+{
+ friend class SvtMatchContext_Impl;
+ friend class SvtURLBox_Impl;
+
+ Idle aChangedIdle;
+ OUString aBaseURL;
+ OUString aPlaceHolder;
+ rtl::Reference<SvtMatchContext_Impl> pCtx;
+ std::unique_ptr<SvtURLBox_Impl> pImpl;
+ INetProtocol eSmartProtocol;
+ bool bOnlyDirectories : 1;
+ bool bHistoryDisabled : 1;
+ bool bNoSelection : 1;
+
+ Link<weld::ComboBox&, void> aChangeHdl;
+ Link<weld::Widget&, void> aFocusInHdl;
+ Link<weld::Widget&, void> aFocusOutHdl;
+
+ std::unique_ptr<weld::ComboBox> m_xWidget;
+
+ DECL_DLLPRIVATE_LINK( TryAutoComplete, Timer*, void);
+ SVT_DLLPRIVATE void UpdatePicklistForSmartProtocol_Impl();
+ DECL_DLLPRIVATE_LINK( ChangedHdl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK( FocusInHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK( FocusOutHdl, weld::Widget&, void);
+ SVT_DLLPRIVATE void Init();
+
+public:
+ SvtURLBox(std::unique_ptr<weld::ComboBox> xWidget);
+ ~SvtURLBox();
+
+ void set_entry_text(const OUString& rStr) { m_xWidget->set_entry_text(rStr); }
+ void show() { m_xWidget->show(); }
+ void clear() { m_xWidget->clear(); }
+ void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xWidget->connect_entry_activate(rLink); }
+ void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_xWidget->connect_key_press(rLink); }
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { aChangeHdl = rLink; }
+ void trigger_changed() { aChangeHdl.Call(*m_xWidget); }
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink) { aFocusInHdl = rLink; }
+ void connect_focus_out(const Link<weld::Widget&, void>& rLink) { aFocusOutHdl = rLink; }
+ void append_text(const OUString& rStr) { m_xWidget->append_text(rStr); }
+ int find_text(const OUString& rStr) const { return m_xWidget->find_text(rStr); }
+ OUString get_active_text() const { return m_xWidget->get_active_text(); }
+ void grab_focus() { m_xWidget->grab_focus(); }
+ void set_sensitive(bool bSensitive) { m_xWidget->set_sensitive(bSensitive); }
+ void set_help_id(const OString& rHelpId) { m_xWidget->set_help_id(rHelpId); }
+ void select_entry_region(int nStartPos, int nEndPos) { m_xWidget->select_entry_region(nStartPos, nEndPos); }
+ Size get_preferred_size() const { return m_xWidget->get_preferred_size(); }
+
+ void EnableAutocomplete(bool bEnable = true) { m_xWidget->set_entry_completion(bEnable); }
+ void SetBaseURL( const OUString& rURL );
+ const OUString& GetBaseURL() const { return aBaseURL; }
+ void SetOnlyDirectories( bool bDir );
+ void SetNoURLSelection( bool bSet );
+ void SetSmartProtocol( INetProtocol eProt );
+ INetProtocol GetSmartProtocol() const { return eSmartProtocol; }
+ OUString GetURL();
+ void DisableHistory();
+
+ weld::ComboBox* getWidget() { return m_xWidget.get(); }
+
+ static OUString ParseSmart( const OUString& aText, const OUString& aBaseURL );
+
+ void SetPlaceHolder(const OUString& sPlaceHolder) { aPlaceHolder = sPlaceHolder; }
+ const OUString& GetPlaceHolder() const { return aPlaceHolder; }
+ bool MatchesPlaceHolder(std::u16string_view sToMatch) const
+ {
+ return (!aPlaceHolder.isEmpty() && aPlaceHolder == sToMatch);
+ }
+
+ void SetFilter(const OUString& _sFilter);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/insdlg.hxx b/include/svtools/insdlg.hxx
new file mode 100644
index 000000000..826933bd3
--- /dev/null
+++ b/include/svtools/insdlg.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <tools/globname.hxx>
+#include <sot/formats.hxx>
+
+#include <vector>
+#include <vcl/transfer.hxx>
+
+class SvObjectServer
+{
+private:
+ SvGlobalName aClassName;
+ OUString aHumanName;
+
+public:
+ SvObjectServer( const SvGlobalName & rClassP, const OUString & rHumanP ) :
+ aClassName( rClassP ),
+ aHumanName( rHumanP ) {}
+
+ const SvGlobalName & GetClassName() const { return aClassName; }
+ const OUString & GetHumanName() const { return aHumanName; }
+};
+
+class SVT_DLLPUBLIC SvObjectServerList
+{
+private:
+ std::vector< SvObjectServer > aObjectServerList;
+
+public:
+ const SvObjectServer * Get( std::u16string_view rHumanName ) const;
+ const SvObjectServer * Get( const SvGlobalName & ) const;
+ void Remove( const SvGlobalName & );
+ void FillInsertObjects();
+ size_t Count() const
+ {
+ return aObjectServerList.size();
+ }
+
+ const SvObjectServer& operator[]( size_t n ) const
+ {
+ return aObjectServerList[ n ];
+ }
+};
+
+class SVT_DLLPUBLIC SvPasteObjectHelper
+{
+public:
+ static OUString GetSotFormatUIName( SotClipboardFormatId nId );
+ static bool GetEmbeddedName(const TransferableDataHelper& rData, OUString& _rName, OUString& _rSource, SotClipboardFormatId const & _nFormat);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/javacontext.hxx b/include/svtools/javacontext.hxx
new file mode 100644
index 000000000..124b191fd
--- /dev/null
+++ b/include/svtools/javacontext.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+
+#include <com/sun/star/uno/XCurrentContext.hpp>
+
+
+namespace com :: sun :: star :: task { class XInteractionHandler; }
+
+namespace svt
+{
+// We cannot derive from cppu::WeakImplHelper because we would export the inline
+//generated class. This conflicts with other libraries if they use the same inline
+//class.
+ class SVT_DLLPUBLIC JavaContext final :
+ public css::uno::XCurrentContext
+ {
+
+ public:
+ /** A message box is
+ only displayed once for a recurring Java error. That is only
+ the first time JavaInteractionHandler.handle is called with a
+ particular Request then the message box is shown. Afterwards
+ nothing happens.
+ */
+ JavaContext( const css::uno::Reference< css::uno::XCurrentContext> & ctx );
+ virtual ~JavaContext();
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type& aType ) override;
+
+ virtual void SAL_CALL acquire() noexcept override;
+
+ virtual void SAL_CALL release() noexcept override;
+
+ // XCurrentContext
+ virtual css::uno::Any SAL_CALL getValueByName( const OUString& Name ) override;
+
+ private:
+ JavaContext(JavaContext const &) = delete;
+ JavaContext& operator = (JavaContext const &) = delete;
+
+ oslInterlockedCount m_aRefCount;
+ css::uno::Reference< css::uno::XCurrentContext > m_xNextContext;
+ css::uno::Reference< css::task::XInteractionHandler> m_xHandler;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/javainteractionhandler.hxx b/include/svtools/javainteractionhandler.hxx
new file mode 100644
index 000000000..1abeb73a1
--- /dev/null
+++ b/include/svtools/javainteractionhandler.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <sal/types.h>
+
+#include <com/sun/star/task/XInteractionHandler.hpp>
+
+namespace com :: sun :: star :: task { class XInteractionRequest; }
+
+inline constexpr OUStringLiteral JAVA_INTERACTION_HANDLER_NAME = u"java-vm.interaction-handler";
+
+namespace svt
+{
+// We cannot derive from cppu::WeakImplHelper because we would export the inline
+//generated class. This conflicts with other libraries if they use the same inline
+//class.
+
+class SVT_DLLPUBLIC JavaInteractionHandler final :
+ public css::task::XInteractionHandler
+{
+public:
+ JavaInteractionHandler();
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface(
+ const css::uno::Type& aType ) override;
+
+ virtual void SAL_CALL acquire() noexcept override;
+
+ virtual void SAL_CALL release() noexcept override;
+
+ // XCurrentContext
+ virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& Request ) override;
+
+private:
+ oslInterlockedCount m_aRefCount;
+ JavaInteractionHandler(JavaInteractionHandler const&) = delete;
+ JavaInteractionHandler& operator = (JavaInteractionHandler const &) = delete;
+ SVT_DLLPRIVATE virtual ~JavaInteractionHandler();
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/langhelp.hxx b/include/svtools/langhelp.hxx
new file mode 100644
index 000000000..1aa8bcb72
--- /dev/null
+++ b/include/svtools/langhelp.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <rtl/ustring.hxx>
+
+/** Localize a URI to one of the foundation's webservices
+
+ @param io_rURI
+ URI to localize - depending on your UI locale, a country local
+ part is appended to the URI (like "en", or "fr", or "es")
+ */
+SVT_DLLPUBLIC void localizeWebserviceURI( OUString& io_rURI );
+
+OUString SVT_DLLPUBLIC getInstalledLocaleForLanguage(css::uno::Sequence<OUString> const & installed, OUString const & locale);
+OUString SVT_DLLPUBLIC getInstalledLocaleForSystemUILanguage(css::uno::Sequence<OUString> const & installed, bool bRequestInstallIfMissing, const OUString& rPreferredLocale = OUString());
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/langtab.hxx b/include/svtools/langtab.hxx
new file mode 100644
index 000000000..2d71901c1
--- /dev/null
+++ b/include/svtools/langtab.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <i18nlangtag/lang.h>
+#include <rtl/ustring.hxx>
+#include <svtools/svtdllapi.h>
+
+class LanguageTag;
+
+class SVT_DLLPUBLIC SvtLanguageTable
+{
+public:
+
+ static bool HasLanguageType( const LanguageType eType );
+ /** Obtain the UI name for a LanguageType of a language/locale (string
+ resource STR_ARR_SVT_LANGUAGE_TABLE).
+ */
+ static OUString GetLanguageString( const LanguageType eType );
+ /** Obtain the LanguageType for a UI name of a language/locale (string
+ resource STR_ARR_SVT_LANGUAGE_TABLE).
+ */
+ static LanguageType GetLanguageType( std::u16string_view rStr );
+ static sal_uInt32 GetLanguageEntryCount();
+ static LanguageType GetLanguageTypeAtIndex( sal_uInt32 nIndex );
+
+ /** Add a language tag to the table.
+ */
+ static sal_uInt32 AddLanguageTag( const LanguageTag& rLanguageTag );
+};
+
+// Add LRE or RLE embedding characters to the string based on the
+// String content (see #i78466#, #i32179#)
+SVT_DLLPUBLIC OUString ApplyLreOrRleEmbedding( const OUString &rText );
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/languagetoolcfg.hxx b/include/svtools/languagetoolcfg.hxx
new file mode 100644
index 000000000..7578ad6ba
--- /dev/null
+++ b/include/svtools/languagetoolcfg.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+#include <unotools/configitem.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <svtools/svtdllapi.h>
+
+using namespace utl;
+using namespace com::sun::star::uno;
+
+struct LanguageToolOptions_Impl;
+
+class SVT_DLLPUBLIC SvxLanguageToolOptions final : public utl::ConfigItem
+{
+public:
+ SvxLanguageToolOptions();
+ virtual ~SvxLanguageToolOptions() override;
+
+ virtual void Notify(const css::uno::Sequence<OUString>& _rPropertyNames) override;
+ static SvxLanguageToolOptions& Get();
+
+ const OUString& getBaseURL() const;
+ void setBaseURL(const OUString& rVal);
+
+ const OUString& getUsername() const;
+ void setUsername(const OUString& rVal);
+
+ OUString getLocaleListURL() const;
+ OUString getCheckerURL() const;
+
+ const OUString& getApiKey() const;
+ void setApiKey(const OUString& rVal);
+
+ bool getEnabled() const;
+ void setEnabled(bool enabled);
+
+private:
+ std::unique_ptr<LanguageToolOptions_Impl> pImpl;
+ void Load(const css::uno::Sequence<OUString>& rPropertyNames);
+ virtual void ImplCommit() override;
+ static const Sequence<OUString>& GetPropertyNames();
+};
diff --git a/include/svtools/miscopt.hxx b/include/svtools/miscopt.hxx
new file mode 100644
index 000000000..190de033c
--- /dev/null
+++ b/include/svtools/miscopt.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+#include <memory>
+
+template <typename Arg, typename Ret> class Link;
+class LinkParamNone;
+
+/*-************************************************************************************************************
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is necessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtMiscOptions_Impl;
+enum class ToolBoxButtonSize;
+
+/*-************************************************************************************************************
+ @short collect information about misc group
+ @ATTENTION This class is partially threadsafe.
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class SVT_DLLPUBLIC SvtMiscOptions final : public utl::detail::Options
+{
+ public:
+ SvtMiscOptions();
+ virtual ~SvtMiscOptions() override;
+
+ void AddListenerLink( const Link<LinkParamNone*,void>& rLink );
+ void RemoveListenerLink( const Link<LinkParamNone*,void>& rLink );
+
+ sal_Int16 GetSymbolsSize() const;
+ void SetSymbolsSize( sal_Int16 eSet );
+ sal_Int16 GetCurrentSymbolsSize() const;
+ bool AreCurrentSymbolsLarge() const;
+
+ OUString GetIconTheme() const;
+ void SetIconTheme(const OUString&);
+ bool IconThemeWasSetAutomatically() const;
+
+ private:
+ std::shared_ptr<SvtMiscOptions_Impl> m_pImpl;
+
+}; // class SvtMiscOptions
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/openfiledroptargetlistener.hxx b/include/svtools/openfiledroptargetlistener.hxx
new file mode 100644
index 000000000..56f983e20
--- /dev/null
+++ b/include/svtools/openfiledroptargetlistener.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <svtools/svtdllapi.h>
+
+#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
+
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/weakref.hxx>
+
+#include <sot/exchange.hxx>
+
+namespace com :: sun :: star :: frame { class XFrame; }
+
+namespace com::sun::star::uno {
+ class XComponentContext;
+}
+
+/** DropTargetListener that takes care of opening a file when it is dropped in the frame.
+*/
+class UNLESS_MERGELIBS(SVT_DLLPUBLIC) OpenFileDropTargetListener final : public cppu::WeakImplHelper< css::datatransfer::dnd::XDropTargetListener >
+{
+ private:
+ /// uno service manager to create necessary services
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ /// weakreference to target frame (Don't use a hard reference. Owner can't delete us then!)
+ css::uno::WeakReference< css::frame::XFrame > m_xTargetFrame;
+
+ /// drag/drop info
+ DataFlavorExVector m_aFormats;
+
+ public:
+ OpenFileDropTargetListener( const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::frame::XFrame >& xFrame );
+ virtual ~OpenFileDropTargetListener() override;
+
+ public:
+ // XEventListener
+ virtual void SAL_CALL disposing ( const css::lang::EventObject& Source ) override;
+
+ // XDropTargetListener
+ virtual void SAL_CALL drop ( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) override;
+ virtual void SAL_CALL dragEnter ( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) override;
+ virtual void SAL_CALL dragExit ( const css::datatransfer::dnd::DropTargetEvent& dte ) override;
+ virtual void SAL_CALL dragOver ( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
+ virtual void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
+
+ private:
+ void implts_BeginDrag( const css::uno::Sequence< css::datatransfer::DataFlavor >& rSupportedDataFlavors );
+ void implts_EndDrag();
+ bool implts_IsDropFormatSupported( SotClipboardFormatId nFormat );
+ void implts_OpenFile( const OUString& rFilePath );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/optionsdrawinglayer.hxx b/include/svtools/optionsdrawinglayer.hxx
new file mode 100644
index 000000000..5d6316aa3
--- /dev/null
+++ b/include/svtools/optionsdrawinglayer.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <sal/types.h>
+#include <tools/color.hxx>
+
+namespace SvtOptionsDrawinglayer
+{
+
+/*-****************************************************************************************************
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/Drawinglayer/..."
+ @descr These options describe internal states to enable/disable features of installed office.
+
+ IsOverlayBuffer()
+ SetOverlayBuffer() => Activate this field for letting Overlay use a buffer
+
+ IsPaintBuffer()
+ SetPaintBuffer() => Activate this field for letting Paint use a prerender buffer
+
+ GetStripeColorA()
+ SetStripeColorA() => Set first of two colors which overlay uses to draw stripes
+
+ GetStripeColorB()
+ SetStripeColorB() => Set second of two colors which overlay uses to draw stripes
+
+ GetStripeLength()
+ SetStripeLength() => Set length of a single stripe in pixels
+
+ @seealso configuration package "org.openoffice.Office.Common/Drawinglayer"
+*//*-*****************************************************************************************************/
+
+SVT_DLLPUBLIC bool IsOverlayBuffer();
+SVT_DLLPUBLIC bool IsPaintBuffer();
+SVT_DLLPUBLIC Color GetStripeColorA();
+SVT_DLLPUBLIC Color GetStripeColorB();
+SVT_DLLPUBLIC sal_uInt16 GetStripeLength();
+
+// #i73602#
+SVT_DLLPUBLIC bool IsOverlayBuffer_Calc();
+SVT_DLLPUBLIC bool IsOverlayBuffer_Writer();
+SVT_DLLPUBLIC bool IsOverlayBuffer_DrawImpress();
+
+// #i74769#, #i75172#
+SVT_DLLPUBLIC bool IsPaintBuffer_Calc();
+SVT_DLLPUBLIC bool IsPaintBuffer_Writer();
+SVT_DLLPUBLIC bool IsPaintBuffer_DrawImpress();
+
+// #i4219#
+SVT_DLLPUBLIC sal_uInt32 GetMaximumPaperWidth();
+SVT_DLLPUBLIC sal_uInt32 GetMaximumPaperHeight();
+SVT_DLLPUBLIC sal_uInt32 GetMaximumPaperLeftMargin();
+SVT_DLLPUBLIC sal_uInt32 GetMaximumPaperRightMargin();
+SVT_DLLPUBLIC sal_uInt32 GetMaximumPaperTopMargin();
+SVT_DLLPUBLIC sal_uInt32 GetMaximumPaperBottomMargin();
+
+// #i95644# helper to check if AA is allowed on this system. Currently, for WIN it's disabled
+// and OutDevSupportType::TransparentRect is checked (this hits XRenderExtension, e.g.
+// currently for SunRay as long as not supported there)
+SVT_DLLPUBLIC bool IsAAPossibleOnThisSystem();
+
+// primitives
+SVT_DLLPUBLIC bool IsAntiAliasing();
+SVT_DLLPUBLIC bool IsSnapHorVerLinesToDiscrete();
+SVT_DLLPUBLIC bool IsSolidDragCreate();
+SVT_DLLPUBLIC bool IsRenderDecoratedTextDirect();
+SVT_DLLPUBLIC bool IsRenderSimpleTextDirect();
+SVT_DLLPUBLIC sal_uInt32 GetQuadratic3DRenderLimit();
+SVT_DLLPUBLIC sal_uInt32 GetQuadraticFormControlRenderLimit();
+
+SVT_DLLPUBLIC void SetAntiAliasing( bool bOn, bool bTemporary );
+
+// #i97672# selection settings
+SVT_DLLPUBLIC bool IsTransparentSelection();
+SVT_DLLPUBLIC sal_uInt16 GetTransparentSelectionPercent();
+SVT_DLLPUBLIC sal_uInt16 GetSelectionMaximumLuminancePercent();
+
+// get system highlight color, limited to the maximum allowed luminance
+// (defined in GetSelectionMaximumLuminancePercent() in SvtOptionsDrawinglayer,
+// combined with Application::GetSettings().GetStyleSettings().GetHighlightColor())
+SVT_DLLPUBLIC Color getHilightColor();
+
+} // namespace SvtOptionsDrawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/parhtml.hxx b/include/svtools/parhtml.hxx
new file mode 100644
index 000000000..d05a9e36c
--- /dev/null
+++ b/include/svtools/parhtml.hxx
@@ -0,0 +1,293 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <svtools/svparser.hxx>
+#include <svtools/htmltokn.h>
+
+#include <string_view>
+#include <vector>
+
+namespace com :: sun :: star :: uno { template <class interface_type> class Reference; }
+
+namespace com::sun::star {
+ namespace document {
+ class XDocumentProperties;
+ }
+}
+
+class Color;
+enum class HtmlOptionId;
+
+#define HTMLFONTSZ1_DFLT 7
+#define HTMLFONTSZ2_DFLT 10
+#define HTMLFONTSZ3_DFLT 12
+#define HTMLFONTSZ4_DFLT 14
+#define HTMLFONTSZ5_DFLT 18
+#define HTMLFONTSZ6_DFLT 24
+#define HTMLFONTSZ7_DFLT 36
+
+enum class HTMLTableFrame { Void, Above, Below, HSides, LHS, RHS, VSides, Box };
+
+enum class HTMLTableRules { NONE, Groups, Rows, Cols, All };
+
+enum class HTMLInputType
+{
+ Text = 1,
+ Password,
+ Checkbox,
+ Radio,
+ Range,
+ Scribble,
+ File,
+ Hidden,
+ Submit,
+ Image,
+ Reset,
+ Button
+};
+
+enum class HTMLScriptLanguage
+{
+ StarBasic,
+ JavaScript,
+ Unknown
+};
+
+template<typename EnumT>
+struct HTMLOptionEnum
+{
+ const char *pName; // value of an HTML option
+ EnumT nValue; // and corresponding value of an enum
+};
+
+/** Representation of an HTML option (=attribute in a start tag).
+ * The values of the options are always stored as strings.
+ * The methods GetNumber,... may only be called if the option
+ * is actually numerical,...
+ */
+class SVT_DLLPUBLIC HTMLOption
+{
+ OUString aValue; // value of the option (always as string)
+ OUString aToken; // name of the option as string
+ HtmlOptionId nToken; // and respective token
+
+public:
+
+ HTMLOption( HtmlOptionId nTyp, const OUString& rToken, const OUString& rValue );
+
+ // name of the option...
+ HtmlOptionId GetToken() const { return nToken; } // ... as enum
+ const OUString& GetTokenString() const { return aToken; } // ... as string
+
+ // value of the option ...
+ const OUString& GetString() const { return aValue; } // ... as string
+
+ sal_uInt32 GetNumber() const; // ... as number
+ sal_Int32 GetSNumber() const; // ... as number
+ void GetNumbers( std::vector<sal_uInt32> &rNumbers ) const; // ... as numbers
+ void GetColor( Color& ) const; // ... as color
+
+ template<typename EnumT>
+ EnumT GetEnum( const HTMLOptionEnum<EnumT> *pOptEnums,
+ EnumT nDflt = static_cast<EnumT>(0) ) const
+ {
+ while( pOptEnums->pName )
+ {
+ if( aValue.equalsIgnoreAsciiCaseAscii( pOptEnums->pName ) )
+ return pOptEnums->nValue;
+ pOptEnums++;
+ }
+ return nDflt;
+ }
+
+ template<typename EnumT>
+ bool GetEnum( EnumT &rEnum, const HTMLOptionEnum<EnumT> *pOptEnums ) const
+ {
+ while( pOptEnums->pName )
+ {
+ if( aValue.equalsIgnoreAsciiCaseAscii( pOptEnums->pName ) )
+ {
+ rEnum = pOptEnums->nValue;
+ return true;
+ }
+ pOptEnums++;
+ }
+ return false;
+ }
+
+ // ... and as a few special enums
+ HTMLInputType GetInputType() const; // <INPUT TYPE=...>
+ HTMLTableFrame GetTableFrame() const; // <TABLE FRAME=...>
+ HTMLTableRules GetTableRules() const; // <TABLE RULES=...>
+ //SvxAdjust GetAdjust() const; // <P,TH,TD ALIGN=>
+};
+
+typedef ::std::vector<HTMLOption> HTMLOptions;
+
+class SVT_DLLPUBLIC HTMLParser : public SvParser<HtmlTokenId>
+{
+private:
+ mutable HTMLOptions maOptions; // options of the start tag
+
+ bool bNewDoc : 1; // read new Doc?
+ bool bIsInHeader : 1; // scan header section
+ bool bReadListing : 1; // read listings
+ bool bReadXMP : 1; // read XMP
+ bool bReadPRE : 1; // read preformatted text
+ bool bReadTextArea : 1; // read TEXTAREA
+ bool bReadScript : 1; // read <SCRIPT>
+ bool bReadStyle : 1; // read <STYLE>
+ bool bEndTokenFound : 1; // found </SCRIPT> or </STYLE>
+
+ bool bPre_IgnoreNewPara : 1; // flags for reading of PRE paragraphs
+ bool bReadNextChar : 1; // true: read NextChar again(JavaScript!)
+ bool bReadComment : 1; // true: read NextChar again (JavaScript!)
+
+ sal_uInt32 nPre_LinePos; // Pos in the line in the PRE-Tag
+
+ HtmlTokenId mnPendingOffToken; ///< OFF token pending for a <XX.../> ON/OFF ON token
+
+ OUString aEndToken;
+
+ /// XML namespace, in case of XHTML.
+ OUString maNamespace;
+
+protected:
+ OUString sSaveToken; // the read tag as string
+
+ HtmlTokenId ScanText( const sal_Unicode cBreak = 0U );
+
+ HtmlTokenId GetNextRawToken();
+
+ // scan next token
+ virtual HtmlTokenId GetNextToken_() override;
+
+ virtual ~HTMLParser() override;
+
+ void FinishHeader() { bIsInHeader = false; }
+
+ void SetNamespace(std::u16string_view rNamespace);
+
+public:
+ HTMLParser( SvStream& rIn, bool bReadNewDoc = true );
+
+ virtual SvParserState CallParser() override;
+
+ bool IsNewDoc() const { return bNewDoc; }
+ bool IsInHeader() const { return bIsInHeader; }
+ bool IsReadListing() const { return bReadListing; }
+ bool IsReadXMP() const { return bReadXMP; }
+ bool IsReadPRE() const { return bReadPRE; }
+ bool IsReadScript() const { return bReadScript; }
+ bool IsReadStyle() const { return bReadStyle; }
+
+ // start PRE-/LISTING or XMP mode or filter tags respectively
+ inline void StartPRE();
+ void FinishPRE() { bReadPRE = false; }
+ HtmlTokenId FilterPRE( HtmlTokenId nToken );
+
+ inline void StartListing();
+ void FinishListing() { bReadListing = false; }
+ HtmlTokenId FilterListing( HtmlTokenId nToken );
+
+ inline void StartXMP();
+ void FinishXMP() { bReadXMP = false; }
+ HtmlTokenId FilterXMP( HtmlTokenId nToken );
+
+ void FinishTextArea() { bReadTextArea = false; }
+
+ // finish PRE-/LISTING- and XMP mode
+ void FinishPREListingXMP() { bReadPRE = bReadListing = bReadXMP = false; }
+
+ // Filter the current token according to the current mode
+ // (PRE, XMP, ...) and set the flags. Is called by Continue before
+ // NextToken is called. If you implement own loops or call
+ // NextToken yourself, you should call this method beforehand.
+ HtmlTokenId FilterToken( HtmlTokenId nToken );
+
+ void ReadRawData( const OUString &rEndToken ) { aEndToken = rEndToken; }
+
+ // Token without \-sequences
+ void UnescapeToken();
+
+ // Determine the options. pNoConvertToken is the optional token
+ // of an option, for which the CR/LFs are not deleted from the value
+ // of the option.
+ const HTMLOptions& GetOptions( HtmlOptionId const *pNoConvertToken=nullptr );
+
+ // for asynchronous reading from the SvStream
+ virtual void Continue( HtmlTokenId nToken ) override;
+
+
+protected:
+
+ static rtl_TextEncoding GetEncodingByMIME( const OUString& rMime );
+
+ /// template method: called when ParseMetaOptions adds a user-defined meta
+ virtual void AddMetaUserDefined( OUString const & i_rMetaName );
+
+private:
+ /// parse meta options into XDocumentProperties and encoding
+ bool ParseMetaOptionsImpl( const css::uno::Reference< css::document::XDocumentProperties>&,
+ SvKeyValueIterator*,
+ const HTMLOptions&,
+ rtl_TextEncoding& rEnc );
+
+public:
+ /// overriding method must call this implementation!
+ virtual bool ParseMetaOptions( const css::uno::Reference< css::document::XDocumentProperties>&,
+ SvKeyValueIterator* );
+
+ void ParseScriptOptions( OUString& rLangString, std::u16string_view rBaseURL, HTMLScriptLanguage& rLang,
+ OUString& rSrc, OUString& rLibrary, OUString& rModule );
+
+ // Remove a comment around the content of <SCRIPT> or <STYLE>.
+ // The whole line behind a "<!--" might be deleted (for JavaScript).
+ static void RemoveSGMLComment( OUString &rString );
+
+ static bool InternalImgToPrivateURL( OUString& rURL );
+ static rtl_TextEncoding GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader );
+ bool SetEncodingByHTTPHeader( SvKeyValueIterator *pHTTPHeader );
+};
+
+inline void HTMLParser::StartPRE()
+{
+ bReadPRE = true;
+ bPre_IgnoreNewPara = true;
+ nPre_LinePos = 0;
+}
+
+inline void HTMLParser::StartListing()
+{
+ bReadListing = true;
+ bPre_IgnoreNewPara = true;
+ nPre_LinePos = 0;
+}
+
+inline void HTMLParser::StartXMP()
+{
+ bReadXMP = true;
+ bPre_IgnoreNewPara = true;
+ nPre_LinePos = 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/parrtf.hxx b/include/svtools/parrtf.hxx
new file mode 100644
index 000000000..136026f56
--- /dev/null
+++ b/include/svtools/parrtf.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <svtools/svparser.hxx>
+#include <stack>
+
+struct RtfParserState_Impl
+{
+ rtl_TextEncoding eCodeSet;
+ sal_uInt8 nUCharOverread;
+
+ RtfParserState_Impl( sal_uInt8 nUOverread, rtl_TextEncoding eCdSt )
+ : eCodeSet( eCdSt ), nUCharOverread( nUOverread )
+ {}
+};
+
+class SVT_DLLPUBLIC SvRTFParser : public SvParser<int>
+{
+ std::stack< RtfParserState_Impl > aParserStates;
+ int nOpenBrackets;
+ rtl_TextEncoding eCodeSet;
+ sal_uInt8 nUCharOverread;
+
+private:
+ static short _inSkipGroup;
+
+protected:
+ sal_Unicode GetHexValue();
+ void ScanText();
+ void SkipGroup();
+
+ // scan the next Token
+ virtual int GetNextToken_() override;
+
+ void ReadUnknownData();
+ void ReadBitmapData();
+
+ virtual ~SvRTFParser() override;
+
+ rtl_TextEncoding GetCodeSet() const { return eCodeSet; }
+ void SetEncoding( rtl_TextEncoding eEnc );
+
+public:
+ SvRTFParser( SvStream& rIn, sal_uInt8 nStackSize = 3 );
+
+ virtual SvParserState CallParser() override; // calling the parser
+
+ // for asynchronous read from the SvStream
+ virtual void Continue( int nToken ) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/place.hxx b/include/svtools/place.hxx
new file mode 100644
index 000000000..315621c65
--- /dev/null
+++ b/include/svtools/place.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <tools/urlobj.hxx>
+
+class Place
+{
+private:
+ OUString msName;
+ INetURLObject maUrl;
+
+ bool mbEditable;
+
+public:
+
+ Place( const OUString& sName, std::u16string_view sUrl, bool bEditable = false ) :
+ msName( sName ),
+ maUrl( sUrl ),
+ mbEditable( bEditable ) {};
+
+ void SetName(const OUString& aName ) { msName = aName; }
+ void SetUrl(std::u16string_view aUrl ) { maUrl.SetURL( aUrl ); }
+
+ OUString& GetName( ) { return msName; }
+ OUString GetUrl( ) const { return maUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ); }
+ INetURLObject& GetUrlObject( ) { return maUrl; }
+ bool IsLocal( ) const { return maUrl.GetProtocol() == INetProtocol::File; }
+ bool IsEditable( ) const { return mbEditable; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/popupmenucontrollerbase.hxx b/include/svtools/popupmenucontrollerbase.hxx
new file mode 100644
index 000000000..6ce19444a
--- /dev/null
+++ b/include/svtools/popupmenucontrollerbase.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <svtools/svtdllapi.h>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
+
+#include <tools/link.hxx>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com :: sun :: star :: frame { class XFrame; }
+namespace com :: sun :: star :: uno { class XComponentContext; }
+namespace com :: sun :: star :: util { class XURLTransformer; }
+
+namespace svt
+{
+
+ typedef cppu::WeakComponentImplHelper<
+ css::lang::XServiceInfo ,
+ css::frame::XPopupMenuController ,
+ css::lang::XInitialization ,
+ css::frame::XStatusListener ,
+ css::awt::XMenuListener ,
+ css::frame::XDispatchProvider ,
+ css::frame::XDispatch > PopupMenuControllerBaseType;
+
+ class UNLESS_MERGELIBS(SVT_DLLPUBLIC) PopupMenuControllerBase : protected ::cppu::BaseMutex, // Struct for right initialization of mutex member! Must be first of baseclasses.
+ public PopupMenuControllerBaseType
+ {
+ public:
+ PopupMenuControllerBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ virtual ~PopupMenuControllerBase() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) override = 0;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override = 0;
+
+ // XPopupMenuController
+ virtual void SAL_CALL setPopupMenu( const css::uno::Reference< css::awt::XPopupMenu >& PopupMenu ) override;
+ virtual void SAL_CALL updatePopupMenu() override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override = 0;
+
+ // XMenuListener
+ virtual void SAL_CALL itemHighlighted( const css::awt::MenuEvent& rEvent ) override;
+ virtual void SAL_CALL itemSelected( const css::awt::MenuEvent& rEvent ) override;
+ virtual void SAL_CALL itemActivated( const css::awt::MenuEvent& rEvent ) override;
+ virtual void SAL_CALL itemDeactivated( const css::awt::MenuEvent& rEvent ) override;
+
+ // XDispatchProvider
+ virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const OUString& sTarget, sal_Int32 nFlags ) override;
+ virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) override;
+
+ // XDispatch
+ virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& seqProperties ) override;
+ virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override;
+ virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ void dispatchCommand( const OUString& sCommandURL, const css::uno::Sequence< css::beans::PropertyValue >& rArgs, const OUString& sTarget = OUString() );
+
+ protected:
+ /// @throws css::uno::RuntimeException
+ void throwIfDisposed();
+
+ /** helper method to cause statusChanged is called once for the given command url */
+ void updateCommand( const OUString& rCommandURL );
+
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing() override;
+
+ static void resetPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu );
+ virtual void impl_setPopupMenu();
+ static OUString determineBaseURL( const OUString& aURL );
+
+ DECL_DLLPRIVATE_STATIC_LINK( PopupMenuControllerBase, ExecuteHdl_Impl, void*, void );
+
+
+ bool m_bInitialized;
+ OUString m_aCommandURL;
+ OUString m_aBaseURL;
+ OUString m_aModuleName;
+ css::uno::Reference< css::frame::XDispatch > m_xDispatch;
+ css::uno::Reference< css::frame::XFrame > m_xFrame;
+ css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer;
+ css::uno::Reference< css::awt::XPopupMenu > m_xPopupMenu;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/popupwindowcontroller.hxx b/include/svtools/popupwindowcontroller.hxx
new file mode 100644
index 000000000..4f1b84f67
--- /dev/null
+++ b/include/svtools/popupwindowcontroller.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <o3tl/deleter.hxx>
+#include <svtools/svtdllapi.h>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <cppuhelper/implbase.hxx>
+#include <svtools/toolboxcontroller.hxx>
+#include <vcl/vclptr.hxx>
+
+namespace vcl
+{
+class Window;
+}
+
+class InterimToolbarPopup;
+class ToolbarPopupContainer;
+class WeldToolbarPopup;
+
+namespace svt
+{
+class PopupWindowControllerImpl;
+
+//HACK to avoid duplicate ImplInheritanceHelper symbols with MSVC:
+class SAL_DLLPUBLIC_TEMPLATE PopupWindowController_Base
+ : public cppu::ImplInheritanceHelper<svt::ToolboxController, css::lang::XServiceInfo>
+{
+ using ImplInheritanceHelper::ImplInheritanceHelper;
+};
+
+class SVT_DLLPUBLIC PopupWindowController : public PopupWindowController_Base
+{
+public:
+ PopupWindowController(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ const css::uno::Reference<css::frame::XFrame>& xFrame,
+ const OUString& aCommandURL);
+
+ virtual ~PopupWindowController() override;
+
+ void EndPopupMode();
+
+ virtual VclPtr<vcl::Window> createVclPopupWindow(vcl::Window* pParent);
+ virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() = 0;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override = 0;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override = 0;
+
+ // XComponent
+ virtual void SAL_CALL dispose() override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override;
+
+ // XToolbarController
+ virtual css::uno::Reference<css::awt::XWindow> SAL_CALL createPopupWindow() override;
+ virtual void SAL_CALL click() override;
+
+protected:
+ std::unique_ptr<ToolbarPopupContainer> mxPopoverContainer;
+ VclPtr<InterimToolbarPopup> mxInterimPopover;
+
+private:
+ std::unique_ptr<PopupWindowControllerImpl, o3tl::default_delete<PopupWindowControllerImpl>>
+ mxImpl;
+};
+
+} // namespace svt
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/printoptions.hxx b/include/svtools/printoptions.hxx
new file mode 100644
index 000000000..9fe4c4dce
--- /dev/null
+++ b/include/svtools/printoptions.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+
+namespace vcl::printer { class Options; }
+
+namespace svtools
+{
+ SVT_DLLPUBLIC void GetPrinterOptions( vcl::printer::Options& rOptions, bool bFile );
+ SVT_DLLPUBLIC void SetPrinterOptions( const vcl::printer::Options& rOptions, bool bFile );
+};
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/prnsetup.hxx b/include/svtools/prnsetup.hxx
new file mode 100644
index 000000000..2ec0cfbfe
--- /dev/null
+++ b/include/svtools/prnsetup.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <vcl/print.hxx>
+#include <vcl/weld.hxx>
+#include <vcl/timer.hxx>
+
+class Printer;
+class QueueInfo;
+class VclSimpleEvent;
+
+class SVT_DLLPUBLIC PrinterSetupDialog final : public weld::GenericDialogController
+{
+private:
+ std::unique_ptr<weld::ComboBox> m_xLbName;
+ std::unique_ptr<weld::Button> m_xBtnProperties;
+ std::unique_ptr<weld::Button> m_xBtnOptions;
+ std::unique_ptr<weld::Label> m_xFiStatus;
+ std::unique_ptr<weld::Label> m_xFiType;
+ std::unique_ptr<weld::Label> m_xFiLocation;
+ std::unique_ptr<weld::Label> m_xFiComment;
+ AutoTimer maStatusTimer;
+ VclPtr<Printer> mpPrinter;
+ VclPtr<Printer> mpTempPrinter;
+
+ SVT_DLLPRIVATE void ImplSetInfo();
+
+ DECL_DLLPRIVATE_LINK( ImplPropertiesHdl, weld::Button&, void );
+ DECL_DLLPRIVATE_LINK( ImplChangePrinterHdl, weld::ComboBox&, void );
+ DECL_DLLPRIVATE_LINK( ImplGetFocusHdl, weld::Widget&, void );
+ DECL_DLLPRIVATE_LINK( ImplStatusHdl, Timer*, void );
+ DECL_DLLPRIVATE_LINK( ImplDataChangedHdl, VclSimpleEvent&, void);
+
+public:
+ PrinterSetupDialog(weld::Window* pWindow);
+ virtual ~PrinterSetupDialog() override;
+
+ void SetPrinter( Printer* pNewPrinter ) { mpPrinter = pNewPrinter; }
+ Printer* GetPrinter() const { return mpPrinter; }
+
+ virtual short run() override;
+
+ weld::Window* GetFrameWeld() const { return m_xDialog.get(); }
+
+ void SetOptionsHdl( const Link<weld::Button&,void>& rLink );
+};
+
+
+#define IMPL_PRINTDLG_STATUS_UPDATE 15000
+
+void ImplFillPrnDlgListBox( const Printer* pPrinter,
+ weld::ComboBox* pBox, weld::Button* pPropBtn );
+void ImplFreePrnDlgListBox( weld::ComboBox* pBox, bool bClear = true );
+Printer* ImplPrnDlgListBoxSelect( weld::ComboBox const * pBox, weld::Button* pPropBtn,
+ Printer const * pPrinter, Printer* pTempPrinter );
+Printer* ImplPrnDlgUpdatePrinter( Printer const * pPrinter, Printer* pTempPrinter );
+void ImplPrnDlgUpdateQueueInfo( weld::ComboBox const * pBox, QueueInfo& rInfo );
+OUString ImplPrnDlgGetStatusText( const QueueInfo& rInfo );
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/querydelete.hxx b/include/svtools/querydelete.hxx
new file mode 100644
index 000000000..31f494ea6
--- /dev/null
+++ b/include/svtools/querydelete.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <memory>
+#include <vcl/weld.hxx>
+#include <svtools/svtdllapi.h>
+
+namespace svtools
+{
+// QueryDeleteDlg_Impl
+
+enum QueryDeleteResult_Impl
+{
+ QUERYDELETE_YES = RET_YES,
+ QUERYDELETE_ALL = 101
+};
+
+class SVT_DLLPUBLIC QueryDeleteDlg_Impl final : public weld::MessageDialogController
+{
+private:
+ std::unique_ptr<weld::Button> m_xAllButton;
+
+public:
+ QueryDeleteDlg_Impl(weld::Widget* pParent, std::u16string_view rName);
+ virtual ~QueryDeleteDlg_Impl() override;
+
+ void EnableAllButton() { m_xAllButton->set_sensitive(true); }
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/recorditemwindow.hxx b/include/svtools/recorditemwindow.hxx
new file mode 100644
index 000000000..a238148dd
--- /dev/null
+++ b/include/svtools/recorditemwindow.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/InterimItemWindow.hxx>
+#include <svtools/svtdllapi.h>
+
+class SVT_DLLPUBLIC RecordItemWindowBase
+{
+public:
+ RecordItemWindowBase(std::unique_ptr<weld::Entry> xEntry);
+ virtual ~RecordItemWindowBase();
+
+ void set_text(const OUString& rText) { m_xWidget->set_text(rText); }
+ void set_font(const vcl::Font& rFont) { m_xWidget->set_font(rFont); }
+ void set_help_id(const OString& rHelpId) { m_xWidget->set_help_id(rHelpId); }
+
+protected:
+ std::unique_ptr<weld::Entry> m_xWidget;
+
+ virtual bool DoKeyInput(const KeyEvent& rEvt);
+
+private:
+ virtual void PositionFired(sal_Int64 nRecord);
+
+ DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool);
+
+ DECL_DLLPRIVATE_LINK(ActivatedHdl, weld::Entry&, bool);
+ // for invalidating our content when losing the focus
+ DECL_DLLPRIVATE_LINK(FocusOutHdl, weld::Widget&, void);
+
+ void FirePosition(bool bForce);
+};
+
+class SVT_DLLPUBLIC RecordItemWindow : public InterimItemWindow, public RecordItemWindowBase
+{
+public:
+ RecordItemWindow(vcl::Window* pParent);
+ virtual void dispose() override;
+ virtual ~RecordItemWindow() override;
+
+protected:
+ virtual bool DoKeyInput(const KeyEvent& rEvt) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/svtools/restartdialog.hxx b/include/svtools/restartdialog.hxx
new file mode 100644
index 000000000..001f32277
--- /dev/null
+++ b/include/svtools/restartdialog.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <svtools/svtdllapi.h>
+
+namespace com :: sun :: star :: uno { template <typename > class Reference; }
+
+namespace weld { class Window; }
+namespace com::sun::star::uno {
+ class XComponentContext;
+}
+
+namespace svtools {
+
+enum RestartReason {
+ // "For the selected Java runtime environment to work properly,
+ // %PRODUCTNAME must be restarted.":
+ RESTART_REASON_JAVA,
+ // For the modified default print job format to take effect,
+ // %PRODUCTNAME must be restarted:
+ RESTART_REASON_PDF_AS_STANDARD_JOB_FORMAT,
+ // "For the bibliography to work properly,
+ // %PRODUCTNAME must be restarted.":
+ RESTART_REASON_BIBLIOGRAPHY_INSTALL,
+ // "For the mail merge to work properly,
+ // %PRODUCTNAME must be restarted.":
+ RESTART_REASON_MAILMERGE_INSTALL,
+ // "For the updated language settings to take effect,
+ // %PRODUCTNAME must be restarted.":
+ RESTART_REASON_LANGUAGE_CHANGE,
+ // "For the added path to take effect,
+ // %PRODUCTNAME must be restarted.":
+ RESTART_REASON_ADDING_PATH,
+ // "For the assigned java parameters to take effect,
+ // %PRODUCTNAME must be restarted.":
+ RESTART_REASON_ASSIGNING_JAVAPARAMETERS,
+ // "For the assigned folders and archives to take effect,
+ // %PRODUCTNAME must be restarted.":
+ RESTART_REASON_ASSIGNING_FOLDERS,
+ // "For the modified experimental features to take effect,
+ // %PRODUCTNAME must be restarted.":
+ RESTART_REASON_EXP_FEATURES,
+ // "For the extension to work properly,
+ // %PRODUCTNAME must be restarted.":
+ RESTART_REASON_EXTENSION_INSTALL,
+ // For the Skia changes to take effect,
+ // %PRODUCTNAME must be restarted:
+ RESTART_REASON_SKIA,
+ // For the OpenCL changes to take effect,
+ // %PRODUCTNAME must be restarted:
+ RESTART_REASON_OPENCL,
+ // For the multi-threaded calculation changes to take effect,
+ // %PRODUCTNAME must be restarted:
+ RESTART_REASON_THREADING,
+ // For restructuring the Form menu,
+ // %PRODUCTNAME must be restarted:
+ RESTART_REASON_MSCOMPATIBLE_FORMS_MENU,
+ // For the modified save settings to take effect,
+ // %PRODUCTNAME must be restarted:
+ RESTART_REASON_SAVE,
+ // To apply changes, %PRODUCTNAME,
+ // %PRODUCTNAME must be restarted:
+ RESTART_REASON_UI_CHANGE,
+ // No particular reason:
+ RESTART_REASON_NONE
+};
+
+// Must be called with the solar mutex locked; returns if restart was initiated:
+SVT_DLLPUBLIC bool executeRestartDialog(
+ css::uno::Reference< css::uno::XComponentContext > const & context,
+ weld::Window* parent, RestartReason reason);
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/rtfkeywd.hxx b/include/svtools/rtfkeywd.hxx
new file mode 100644
index 000000000..49771933c
--- /dev/null
+++ b/include/svtools/rtfkeywd.hxx
@@ -0,0 +1,1230 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#define OOO_STRING_SVTOOLS_RTF_HEXCHAR "\\'"
+#define OOO_STRING_SVTOOLS_RTF_IGNORE "\\*"
+#define OOO_STRING_SVTOOLS_RTF_OPTHYPH "\\-"
+#define OOO_STRING_SVTOOLS_RTF_SUBENTRY "\\:"
+#define OOO_STRING_SVTOOLS_RTF_ABSH "\\absh"
+#define OOO_STRING_SVTOOLS_RTF_ABSW "\\absw"
+#define OOO_STRING_SVTOOLS_RTF_ALT "\\alt"
+#define OOO_STRING_SVTOOLS_RTF_ANNOTATION "\\annotation"
+#define OOO_STRING_SVTOOLS_RTF_ANSI "\\ansi"
+#define OOO_STRING_SVTOOLS_RTF_ATNDATE "\\atndate"
+#define OOO_STRING_SVTOOLS_RTF_ATNID "\\atnid"
+#define OOO_STRING_SVTOOLS_RTF_AUTHOR "\\author"
+#define OOO_STRING_SVTOOLS_RTF_B "\\b"
+#define OOO_STRING_SVTOOLS_RTF_BGBDIAG "\\bgbdiag"
+#define OOO_STRING_SVTOOLS_RTF_BGCROSS "\\bgcross"
+#define OOO_STRING_SVTOOLS_RTF_BGDCROSS "\\bgdcross"
+#define OOO_STRING_SVTOOLS_RTF_BGDKBDIAG "\\bgdkbdiag"
+#define OOO_STRING_SVTOOLS_RTF_BGDKCROSS "\\bgdkcross"
+#define OOO_STRING_SVTOOLS_RTF_BGDKDCROSS "\\bgdkdcross"
+#define OOO_STRING_SVTOOLS_RTF_BGDKFDIAG "\\bgdkfdiag"
+#define OOO_STRING_SVTOOLS_RTF_BGDKHORIZ "\\bgdkhoriz"
+#define OOO_STRING_SVTOOLS_RTF_BGDKVERT "\\bgdkvert"
+#define OOO_STRING_SVTOOLS_RTF_BGFDIAG "\\bgfdiag"
+#define OOO_STRING_SVTOOLS_RTF_BGHORIZ "\\bghoriz"
+#define OOO_STRING_SVTOOLS_RTF_BGVERT "\\bgvert"
+#define OOO_STRING_SVTOOLS_RTF_BIN "\\bin"
+#define OOO_STRING_SVTOOLS_RTF_BINFSXN "\\binfsxn"
+#define OOO_STRING_SVTOOLS_RTF_BINSXN "\\binsxn"
+#define OOO_STRING_SVTOOLS_RTF_BKMKCOLF "\\bkmkcolf"
+#define OOO_STRING_SVTOOLS_RTF_BKMKCOLL "\\bkmkcoll"
+#define OOO_STRING_SVTOOLS_RTF_BKMKEND "\\bkmkend"
+#define OOO_STRING_SVTOOLS_RTF_BKMKSTART "\\bkmkstart"
+#define OOO_STRING_SVTOOLS_RTF_BLUE "\\blue"
+#define OOO_STRING_SVTOOLS_RTF_BOX "\\box"
+#define OOO_STRING_SVTOOLS_RTF_BRDRB "\\brdrb"
+#define OOO_STRING_SVTOOLS_RTF_BRDRBAR "\\brdrbar"
+#define OOO_STRING_SVTOOLS_RTF_BRDRBTW "\\brdrbtw"
+#define OOO_STRING_SVTOOLS_RTF_BRDRCF "\\brdrcf"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDB "\\brdrdb"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDOT "\\brdrdot"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASH "\\brdrdash"
+#define OOO_STRING_SVTOOLS_RTF_BRDRHAIR "\\brdrhair"
+#define OOO_STRING_SVTOOLS_RTF_BRDRL "\\brdrl"
+#define OOO_STRING_SVTOOLS_RTF_BRDRR "\\brdrr"
+#define OOO_STRING_SVTOOLS_RTF_BRDRS "\\brdrs"
+#define OOO_STRING_SVTOOLS_RTF_BRDRSH "\\brdrsh"
+#define OOO_STRING_SVTOOLS_RTF_BRDRT "\\brdrt"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTH "\\brdrth"
+#define OOO_STRING_SVTOOLS_RTF_BRDRW "\\brdrw"
+#define OOO_STRING_SVTOOLS_RTF_BRSP "\\brsp"
+#define OOO_STRING_SVTOOLS_RTF_BULLET "\\bullet"
+#define OOO_STRING_SVTOOLS_RTF_BUPTIM "\\buptim"
+#define OOO_STRING_SVTOOLS_RTF_BXE "\\bxe"
+#define OOO_STRING_SVTOOLS_RTF_CAPS "\\caps"
+#define OOO_STRING_SVTOOLS_RTF_CB "\\cb"
+#define OOO_STRING_SVTOOLS_RTF_CBPAT "\\cbpat"
+#define OOO_STRING_SVTOOLS_RTF_CELL "\\cell"
+#define OOO_STRING_SVTOOLS_RTF_CELLX "\\cellx"
+#define OOO_STRING_SVTOOLS_RTF_CF "\\cf"
+#define OOO_STRING_SVTOOLS_RTF_CFPAT "\\cfpat"
+#define OOO_STRING_SVTOOLS_RTF_CHATN "\\chatn"
+#define OOO_STRING_SVTOOLS_RTF_CHDATE "\\chdate"
+#define OOO_STRING_SVTOOLS_RTF_CHDPA "\\chdpa"
+#define OOO_STRING_SVTOOLS_RTF_CHDPL "\\chdpl"
+#define OOO_STRING_SVTOOLS_RTF_CHFTN "\\chftn"
+#define OOO_STRING_SVTOOLS_RTF_CHFTNSEP "\\chftnsep"
+#define OOO_STRING_SVTOOLS_RTF_CHFTNSEPC "\\chftnsepc"
+#define OOO_STRING_SVTOOLS_RTF_CHPGN "\\chpgn"
+#define OOO_STRING_SVTOOLS_RTF_CHTIME "\\chtime"
+#define OOO_STRING_SVTOOLS_RTF_CLBGBDIAG "\\clbgbdiag"
+#define OOO_STRING_SVTOOLS_RTF_CLBGCROSS "\\clbgcross"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDCROSS "\\clbgdcross"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKBDIAG "\\clbgdkbdiag"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKCROSS "\\clbgdkcross"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKDCROSS "\\clbgdkdcross"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKFDIAG "\\clbgdkfdiag"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKHOR "\\clbgdkhor"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKVERT "\\clbgdkvert"
+#define OOO_STRING_SVTOOLS_RTF_CLBGFDIAG "\\clbgfdiag"
+#define OOO_STRING_SVTOOLS_RTF_CLBGHORIZ "\\clbghoriz"
+#define OOO_STRING_SVTOOLS_RTF_CLBGVERT "\\clbgvert"
+#define OOO_STRING_SVTOOLS_RTF_CLBRDRB "\\clbrdrb"
+#define OOO_STRING_SVTOOLS_RTF_CLBRDRL "\\clbrdrl"
+#define OOO_STRING_SVTOOLS_RTF_CLBRDRR "\\clbrdrr"
+#define OOO_STRING_SVTOOLS_RTF_CLBRDRT "\\clbrdrt"
+#define OOO_STRING_SVTOOLS_RTF_CLCBPAT "\\clcbpat"
+#define OOO_STRING_SVTOOLS_RTF_CLCFPAT "\\clcfpat"
+#define OOO_STRING_SVTOOLS_RTF_CLMGF "\\clmgf"
+#define OOO_STRING_SVTOOLS_RTF_CLMRG "\\clmrg"
+#define OOO_STRING_SVTOOLS_RTF_CLSHDNG "\\clshdng"
+#define OOO_STRING_SVTOOLS_RTF_COLNO "\\colno"
+#define OOO_STRING_SVTOOLS_RTF_COLORTBL "\\colortbl"
+#define OOO_STRING_SVTOOLS_RTF_COLS "\\cols"
+#define OOO_STRING_SVTOOLS_RTF_COLSR "\\colsr"
+#define OOO_STRING_SVTOOLS_RTF_COLSX "\\colsx"
+#define OOO_STRING_SVTOOLS_RTF_COLUMN "\\column"
+#define OOO_STRING_SVTOOLS_RTF_COLW "\\colw"
+#define OOO_STRING_SVTOOLS_RTF_COMMENT "\\comment"
+#define OOO_STRING_SVTOOLS_RTF_CONTEXTUALSPACE "\\contextualspace"
+#define OOO_STRING_SVTOOLS_RTF_CREATIM "\\creatim"
+#define OOO_STRING_SVTOOLS_RTF_CTRL "\\ctrl"
+#define OOO_STRING_SVTOOLS_RTF_DEFF "\\deff"
+#define OOO_STRING_SVTOOLS_RTF_DEFFORMAT "\\defformat"
+#define OOO_STRING_SVTOOLS_RTF_DEFLANG "\\deflang"
+#define OOO_STRING_SVTOOLS_RTF_DEFTAB "\\deftab"
+#define OOO_STRING_SVTOOLS_RTF_DELETED "\\deleted"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTX "\\dfrmtxtx"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTY "\\dfrmtxty"
+#define OOO_STRING_SVTOOLS_RTF_DIBITMAP "\\dibitmap"
+#define OOO_STRING_SVTOOLS_RTF_DN "\\dn"
+#define OOO_STRING_SVTOOLS_RTF_DOCCOMM "\\doccomm"
+#define OOO_STRING_SVTOOLS_RTF_DOCTEMP "\\doctemp"
+#define OOO_STRING_SVTOOLS_RTF_DROPCAPLI "\\dropcapli"
+#define OOO_STRING_SVTOOLS_RTF_DROPCAPT "\\dropcapt"
+#define OOO_STRING_SVTOOLS_RTF_ABSNOOVRLP "\\absnoovrlp"
+#define OOO_STRING_SVTOOLS_RTF_DXFRTEXT "\\dxfrtext"
+#define OOO_STRING_SVTOOLS_RTF_DY "\\dy"
+#define OOO_STRING_SVTOOLS_RTF_EDMINS "\\edmins"
+#define OOO_STRING_SVTOOLS_RTF_EMDASH "\\emdash"
+#define OOO_STRING_SVTOOLS_RTF_ENDASH "\\endash"
+#define OOO_STRING_SVTOOLS_RTF_ENDDOC "\\enddoc"
+#define OOO_STRING_SVTOOLS_RTF_ENDNHERE "\\endnhere"
+#define OOO_STRING_SVTOOLS_RTF_ENDNOTES "\\endnotes"
+#define OOO_STRING_SVTOOLS_RTF_EXPND "\\expnd"
+#define OOO_STRING_SVTOOLS_RTF_EXPNDTW "\\expndtw"
+#define OOO_STRING_SVTOOLS_RTF_F "\\f"
+#define OOO_STRING_SVTOOLS_RTF_FACINGP "\\facingp"
+#define OOO_STRING_SVTOOLS_RTF_FACPGSXN "\\facpgsxn"
+#define OOO_STRING_SVTOOLS_RTF_FALT "\\falt"
+#define OOO_STRING_SVTOOLS_RTF_FCHARSET "\\fcharset"
+#define OOO_STRING_SVTOOLS_RTF_FDECOR "\\fdecor"
+#define OOO_STRING_SVTOOLS_RTF_FI "\\fi"
+#define OOO_STRING_SVTOOLS_RTF_FIELD "\\field"
+#define OOO_STRING_SVTOOLS_RTF_FLDDIRTY "\\flddirty"
+#define OOO_STRING_SVTOOLS_RTF_FLDEDIT "\\fldedit"
+#define OOO_STRING_SVTOOLS_RTF_FLDINST "\\fldinst"
+#define OOO_STRING_SVTOOLS_RTF_FLDLOCK "\\fldlock"
+#define OOO_STRING_SVTOOLS_RTF_FLDPRIV "\\fldpriv"
+#define OOO_STRING_SVTOOLS_RTF_FLDRSLT "\\fldrslt"
+#define OOO_STRING_SVTOOLS_RTF_FMODERN "\\fmodern"
+#define OOO_STRING_SVTOOLS_RTF_FN "\\fn"
+#define OOO_STRING_SVTOOLS_RTF_FNIL "\\fnil"
+#define OOO_STRING_SVTOOLS_RTF_FONTTBL "\\fonttbl"
+#define OOO_STRING_SVTOOLS_RTF_FOOTER "\\footer"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERF "\\footerf"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERL "\\footerl"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERR "\\footerr"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERY "\\footery"
+#define OOO_STRING_SVTOOLS_RTF_FOOTNOTE "\\footnote"
+#define OOO_STRING_SVTOOLS_RTF_FPRQ "\\fprq"
+#define OOO_STRING_SVTOOLS_RTF_FRACWIDTH "\\fracwidth"
+#define OOO_STRING_SVTOOLS_RTF_FROMAN "\\froman"
+#define OOO_STRING_SVTOOLS_RTF_FS "\\fs"
+#define OOO_STRING_SVTOOLS_RTF_FSCRIPT "\\fscript"
+#define OOO_STRING_SVTOOLS_RTF_FSWISS "\\fswiss"
+#define OOO_STRING_SVTOOLS_RTF_FTECH "\\ftech"
+#define OOO_STRING_SVTOOLS_RTF_FTNBJ "\\ftnbj"
+#define OOO_STRING_SVTOOLS_RTF_FTNCN "\\ftncn"
+#define OOO_STRING_SVTOOLS_RTF_FTNRESTART "\\ftnrestart"
+#define OOO_STRING_SVTOOLS_RTF_FTNSEP "\\ftnsep"
+#define OOO_STRING_SVTOOLS_RTF_FTNSEPC "\\ftnsepc"
+#define OOO_STRING_SVTOOLS_RTF_FTNSTART "\\ftnstart"
+#define OOO_STRING_SVTOOLS_RTF_FTNTJ "\\ftntj"
+#define OOO_STRING_SVTOOLS_RTF_GREEN "\\green"
+#define OOO_STRING_SVTOOLS_RTF_GUTTER "\\gutter"
+#define OOO_STRING_SVTOOLS_RTF_GUTTERSXN "\\guttersxn"
+#define OOO_STRING_SVTOOLS_RTF_HEADER "\\header"
+#define OOO_STRING_SVTOOLS_RTF_HEADERF "\\headerf"
+#define OOO_STRING_SVTOOLS_RTF_HEADERL "\\headerl"
+#define OOO_STRING_SVTOOLS_RTF_HEADERR "\\headerr"
+#define OOO_STRING_SVTOOLS_RTF_HEADERY "\\headery"
+#define OOO_STRING_SVTOOLS_RTF_HR "\\hr"
+#define OOO_STRING_SVTOOLS_RTF_HYPHHOTZ "\\hyphhotz"
+#define OOO_STRING_SVTOOLS_RTF_I "\\i"
+#define OOO_STRING_SVTOOLS_RTF_ID "\\id"
+#define OOO_STRING_SVTOOLS_RTF_INFO "\\info"
+#define OOO_STRING_SVTOOLS_RTF_INTBL "\\intbl"
+#define OOO_STRING_SVTOOLS_RTF_IXE "\\ixe"
+#define OOO_STRING_SVTOOLS_RTF_KEEP "\\keep"
+#define OOO_STRING_SVTOOLS_RTF_KEEPN "\\keepn"
+#define OOO_STRING_SVTOOLS_RTF_KERNING "\\kerning"
+#define OOO_STRING_SVTOOLS_RTF_KEYCODE "\\keycode"
+#define OOO_STRING_SVTOOLS_RTF_KEYWORDS "\\keywords"
+#define OOO_STRING_SVTOOLS_RTF_LANDSCAPE "\\landscape"
+#define OOO_STRING_SVTOOLS_RTF_LANG "\\lang"
+#define OOO_STRING_SVTOOLS_RTF_LDBLQUOTE "\\ldblquote"
+#define OOO_STRING_SVTOOLS_RTF_LEVEL "\\level"
+#define OOO_STRING_SVTOOLS_RTF_LI "\\li"
+#define OOO_STRING_SVTOOLS_RTF_LIN "\\lin"
+#define OOO_STRING_SVTOOLS_RTF_LINE "\\line"
+#define OOO_STRING_SVTOOLS_RTF_LINEBETCOL "\\linebetcol"
+#define OOO_STRING_SVTOOLS_RTF_LINECONT "\\linecont"
+#define OOO_STRING_SVTOOLS_RTF_LINEMOD "\\linemod"
+#define OOO_STRING_SVTOOLS_RTF_LINEPPAGE "\\lineppage"
+#define OOO_STRING_SVTOOLS_RTF_LINERESTART "\\linerestart"
+#define OOO_STRING_SVTOOLS_RTF_LINESTART "\\linestart"
+#define OOO_STRING_SVTOOLS_RTF_LINESTARTS "\\linestarts"
+#define OOO_STRING_SVTOOLS_RTF_LINEX "\\linex"
+#define OOO_STRING_SVTOOLS_RTF_LNDSCPSXN "\\lndscpsxn"
+#define OOO_STRING_SVTOOLS_RTF_LQUOTE "\\lquote"
+#define OOO_STRING_SVTOOLS_RTF_MAC "\\mac"
+#define OOO_STRING_SVTOOLS_RTF_MACPICT "\\macpict"
+#define OOO_STRING_SVTOOLS_RTF_MAKEBACKUP "\\makebackup"
+#define OOO_STRING_SVTOOLS_RTF_MARGB "\\margb"
+#define OOO_STRING_SVTOOLS_RTF_MARGBSXN "\\margbsxn"
+#define OOO_STRING_SVTOOLS_RTF_MARGL "\\margl"
+#define OOO_STRING_SVTOOLS_RTF_MARGLSXN "\\marglsxn"
+#define OOO_STRING_SVTOOLS_RTF_MARGMIRROR "\\margmirror"
+#define OOO_STRING_SVTOOLS_RTF_MARGR "\\margr"
+#define OOO_STRING_SVTOOLS_RTF_MARGRSXN "\\margrsxn"
+#define OOO_STRING_SVTOOLS_RTF_MARGT "\\margt"
+#define OOO_STRING_SVTOOLS_RTF_MARGTSXN "\\margtsxn"
+#define OOO_STRING_SVTOOLS_RTF_MIN "\\min"
+#define OOO_STRING_SVTOOLS_RTF_MO "\\mo"
+#define OOO_STRING_SVTOOLS_RTF_NEXTCSET "\\nextcset"
+#define OOO_STRING_SVTOOLS_RTF_NEXTFILE "\\nextfile"
+#define OOO_STRING_SVTOOLS_RTF_NOFCHARS "\\nofchars"
+#define OOO_STRING_SVTOOLS_RTF_NOFPAGES "\\nofpages"
+#define OOO_STRING_SVTOOLS_RTF_NOFWORDS "\\nofwords"
+#define OOO_STRING_SVTOOLS_RTF_NOLINE "\\noline"
+#define OOO_STRING_SVTOOLS_RTF_NOSUPERSUB "\\nosupersub"
+#define OOO_STRING_SVTOOLS_RTF_NOWRAP "\\nowrap"
+#define OOO_STRING_SVTOOLS_RTF_OPERATOR "\\operator"
+#define OOO_STRING_SVTOOLS_RTF_OUTL "\\outl"
+#define OOO_STRING_SVTOOLS_RTF_PAGE "\\page"
+#define OOO_STRING_SVTOOLS_RTF_PAGEBB "\\pagebb"
+#define OOO_STRING_SVTOOLS_RTF_PAPERH "\\paperh"
+#define OOO_STRING_SVTOOLS_RTF_PAPERW "\\paperw"
+#define OOO_STRING_SVTOOLS_RTF_PAR "\\par"
+#define OOO_STRING_SVTOOLS_RTF_PARD "\\pard"
+#define OOO_STRING_SVTOOLS_RTF_PC "\\pc"
+#define OOO_STRING_SVTOOLS_RTF_PCA "\\pca"
+#define OOO_STRING_SVTOOLS_RTF_PGHSXN "\\pghsxn"
+#define OOO_STRING_SVTOOLS_RTF_PGNCONT "\\pgncont"
+#define OOO_STRING_SVTOOLS_RTF_PGNDEC "\\pgndec"
+#define OOO_STRING_SVTOOLS_RTF_PGNLCLTR "\\pgnlcltr"
+#define OOO_STRING_SVTOOLS_RTF_PGNLCRM "\\pgnlcrm"
+#define OOO_STRING_SVTOOLS_RTF_PGNRESTART "\\pgnrestart"
+#define OOO_STRING_SVTOOLS_RTF_PGNSTART "\\pgnstart"
+#define OOO_STRING_SVTOOLS_RTF_PGNSTARTS "\\pgnstarts"
+#define OOO_STRING_SVTOOLS_RTF_PGNUCLTR "\\pgnucltr"
+#define OOO_STRING_SVTOOLS_RTF_PGNUCRM "\\pgnucrm"
+#define OOO_STRING_SVTOOLS_RTF_PGNX "\\pgnx"
+#define OOO_STRING_SVTOOLS_RTF_PGNY "\\pgny"
+#define OOO_STRING_SVTOOLS_RTF_PGWSXN "\\pgwsxn"
+#define OOO_STRING_SVTOOLS_RTF_PHCOL "\\phcol"
+#define OOO_STRING_SVTOOLS_RTF_PHMRG "\\phmrg"
+#define OOO_STRING_SVTOOLS_RTF_PHPG "\\phpg"
+#define OOO_STRING_SVTOOLS_RTF_PICCROPB "\\piccropb"
+#define OOO_STRING_SVTOOLS_RTF_PICCROPL "\\piccropl"
+#define OOO_STRING_SVTOOLS_RTF_PICCROPR "\\piccropr"
+#define OOO_STRING_SVTOOLS_RTF_PICCROPT "\\piccropt"
+#define OOO_STRING_SVTOOLS_RTF_PICH "\\pich"
+#define OOO_STRING_SVTOOLS_RTF_PICHGOAL "\\pichgoal"
+#define OOO_STRING_SVTOOLS_RTF_PICSCALED "\\picscaled"
+#define OOO_STRING_SVTOOLS_RTF_PICSCALEX "\\picscalex"
+#define OOO_STRING_SVTOOLS_RTF_PICSCALEY "\\picscaley"
+#define OOO_STRING_SVTOOLS_RTF_PICT "\\pict"
+#define OOO_STRING_SVTOOLS_RTF_PICW "\\picw"
+#define OOO_STRING_SVTOOLS_RTF_PICWGOAL "\\picwgoal"
+#define OOO_STRING_SVTOOLS_RTF_PLAIN "\\plain"
+#define OOO_STRING_SVTOOLS_RTF_PMMETAFILE "\\pmmetafile"
+#define OOO_STRING_SVTOOLS_RTF_POSNEGX "\\posnegx"
+#define OOO_STRING_SVTOOLS_RTF_POSNEGY "\\posnegy"
+#define OOO_STRING_SVTOOLS_RTF_POSX "\\posx"
+#define OOO_STRING_SVTOOLS_RTF_POSXC "\\posxc"
+#define OOO_STRING_SVTOOLS_RTF_POSXI "\\posxi"
+#define OOO_STRING_SVTOOLS_RTF_POSXL "\\posxl"
+#define OOO_STRING_SVTOOLS_RTF_POSXO "\\posxo"
+#define OOO_STRING_SVTOOLS_RTF_POSXR "\\posxr"
+#define OOO_STRING_SVTOOLS_RTF_POSY "\\posy"
+#define OOO_STRING_SVTOOLS_RTF_POSYB "\\posyb"
+#define OOO_STRING_SVTOOLS_RTF_POSYC "\\posyc"
+#define OOO_STRING_SVTOOLS_RTF_POSYIL "\\posyil"
+#define OOO_STRING_SVTOOLS_RTF_POSYT "\\posyt"
+#define OOO_STRING_SVTOOLS_RTF_PRINTIM "\\printim"
+#define OOO_STRING_SVTOOLS_RTF_PSOVER "\\psover"
+#define OOO_STRING_SVTOOLS_RTF_PVMRG "\\pvmrg"
+#define OOO_STRING_SVTOOLS_RTF_PVPARA "\\pvpara"
+#define OOO_STRING_SVTOOLS_RTF_PVPG "\\pvpg"
+#define OOO_STRING_SVTOOLS_RTF_QC "\\qc"
+#define OOO_STRING_SVTOOLS_RTF_QD "\\qd"
+#define OOO_STRING_SVTOOLS_RTF_QJ "\\qj"
+#define OOO_STRING_SVTOOLS_RTF_QL "\\ql"
+#define OOO_STRING_SVTOOLS_RTF_QR "\\qr"
+#define OOO_STRING_SVTOOLS_RTF_RDBLQUOTE "\\rdblquote"
+#define OOO_STRING_SVTOOLS_RTF_RED "\\red"
+#define OOO_STRING_SVTOOLS_RTF_REVBAR "\\revbar"
+#define OOO_STRING_SVTOOLS_RTF_REVISED "\\revised"
+#define OOO_STRING_SVTOOLS_RTF_REVISIONS "\\revisions"
+#define OOO_STRING_SVTOOLS_RTF_REVPROP "\\revprop"
+#define OOO_STRING_SVTOOLS_RTF_REVTIM "\\revtim"
+#define OOO_STRING_SVTOOLS_RTF_RI "\\ri"
+#define OOO_STRING_SVTOOLS_RTF_RIN "\\rin"
+#define OOO_STRING_SVTOOLS_RTF_ROW "\\row"
+#define OOO_STRING_SVTOOLS_RTF_RQUOTE "\\rquote"
+#define OOO_STRING_SVTOOLS_RTF_RTF "\\rtf"
+#define OOO_STRING_SVTOOLS_RTF_RXE "\\rxe"
+#define OOO_STRING_SVTOOLS_RTF_S "\\s"
+#define OOO_STRING_SVTOOLS_RTF_SA "\\sa"
+#define OOO_STRING_SVTOOLS_RTF_SB "\\sb"
+#define OOO_STRING_SVTOOLS_RTF_SBASEDON "\\sbasedon"
+#define OOO_STRING_SVTOOLS_RTF_SBKCOL "\\sbkcol"
+#define OOO_STRING_SVTOOLS_RTF_SBKEVEN "\\sbkeven"
+#define OOO_STRING_SVTOOLS_RTF_SBKNONE "\\sbknone"
+#define OOO_STRING_SVTOOLS_RTF_SBKODD "\\sbkodd"
+#define OOO_STRING_SVTOOLS_RTF_SBKPAGE "\\sbkpage"
+#define OOO_STRING_SVTOOLS_RTF_SBYS "\\sbys"
+#define OOO_STRING_SVTOOLS_RTF_SCAPS "\\scaps"
+#define OOO_STRING_SVTOOLS_RTF_SECT "\\sect"
+#define OOO_STRING_SVTOOLS_RTF_SECTD "\\sectd"
+#define OOO_STRING_SVTOOLS_RTF_SHAD "\\shad"
+#define OOO_STRING_SVTOOLS_RTF_SHADING "\\shading"
+#define OOO_STRING_SVTOOLS_RTF_SHIFT "\\shift"
+#define OOO_STRING_SVTOOLS_RTF_SL "\\sl"
+#define OOO_STRING_SVTOOLS_RTF_SNEXT "\\snext"
+#define OOO_STRING_SVTOOLS_RTF_STRIKE "\\strike"
+#define OOO_STRING_SVTOOLS_RTF_STYLESHEET "\\stylesheet"
+#define OOO_STRING_SVTOOLS_RTF_SUB "\\sub"
+#define OOO_STRING_SVTOOLS_RTF_SUBJECT "\\subject"
+#define OOO_STRING_SVTOOLS_RTF_SUPER "\\super"
+#define OOO_STRING_SVTOOLS_RTF_TAB "\\tab"
+#define OOO_STRING_SVTOOLS_RTF_TB "\\tb"
+#define OOO_STRING_SVTOOLS_RTF_TC "\\tc"
+#define OOO_STRING_SVTOOLS_RTF_TCF "\\tcf"
+#define OOO_STRING_SVTOOLS_RTF_TCL "\\tcl"
+#define OOO_STRING_SVTOOLS_RTF_TEMPLATE "\\template"
+#define OOO_STRING_SVTOOLS_RTF_TITLE "\\title"
+#define OOO_STRING_SVTOOLS_RTF_TITLEPG "\\titlepg"
+#define OOO_STRING_SVTOOLS_RTF_TLDOT "\\tldot"
+#define OOO_STRING_SVTOOLS_RTF_TLEQ "\\tleq"
+#define OOO_STRING_SVTOOLS_RTF_TLHYPH "\\tlhyph"
+#define OOO_STRING_SVTOOLS_RTF_TLTH "\\tlth"
+#define OOO_STRING_SVTOOLS_RTF_TLUL "\\tlul"
+#define OOO_STRING_SVTOOLS_RTF_TQC "\\tqc"
+#define OOO_STRING_SVTOOLS_RTF_TQDEC "\\tqdec"
+#define OOO_STRING_SVTOOLS_RTF_TQR "\\tqr"
+#define OOO_STRING_SVTOOLS_RTF_TQL "\\tql"
+#define OOO_STRING_SVTOOLS_RTF_TRGAPH "\\trgaph"
+#define OOO_STRING_SVTOOLS_RTF_TRLEFT "\\trleft"
+#define OOO_STRING_SVTOOLS_RTF_TROWD "\\trowd"
+#define OOO_STRING_SVTOOLS_RTF_TRQC "\\trqc"
+#define OOO_STRING_SVTOOLS_RTF_TRQL "\\trql"
+#define OOO_STRING_SVTOOLS_RTF_TRQR "\\trqr"
+#define OOO_STRING_SVTOOLS_RTF_TRRH "\\trrh"
+#define OOO_STRING_SVTOOLS_RTF_TX "\\tx"
+#define OOO_STRING_SVTOOLS_RTF_TXE "\\txe"
+#define OOO_STRING_SVTOOLS_RTF_UL "\\ul"
+#define OOO_STRING_SVTOOLS_RTF_ULD "\\uld"
+#define OOO_STRING_SVTOOLS_RTF_ULDB "\\uldb"
+#define OOO_STRING_SVTOOLS_RTF_ULNONE "\\ulnone"
+#define OOO_STRING_SVTOOLS_RTF_ULW "\\ulw"
+#define OOO_STRING_SVTOOLS_RTF_UP "\\up"
+#define OOO_STRING_SVTOOLS_RTF_V "\\v"
+#define OOO_STRING_SVTOOLS_RTF_VERN "\\vern"
+#define OOO_STRING_SVTOOLS_RTF_VERSION "\\version"
+#define OOO_STRING_SVTOOLS_RTF_VERTALB "\\vertalb"
+#define OOO_STRING_SVTOOLS_RTF_VERTALC "\\vertalc"
+#define OOO_STRING_SVTOOLS_RTF_VERTALJ "\\vertalj"
+#define OOO_STRING_SVTOOLS_RTF_VERTALT "\\vertalt"
+#define OOO_STRING_SVTOOLS_RTF_WBITMAP "\\wbitmap"
+#define OOO_STRING_SVTOOLS_RTF_WBMBITSPIXEL "\\wbmbitspixel"
+#define OOO_STRING_SVTOOLS_RTF_WBMPLANES "\\wbmplanes"
+#define OOO_STRING_SVTOOLS_RTF_WBMWIDTHBYTES "\\wbmwidthbytes"
+#define OOO_STRING_SVTOOLS_RTF_WIDOWCTRL "\\widowctrl"
+#define OOO_STRING_SVTOOLS_RTF_WMETAFILE "\\wmetafile"
+#define OOO_STRING_SVTOOLS_RTF_XE "\\xe"
+#define OOO_STRING_SVTOOLS_RTF_YR "\\yr"
+#define OOO_STRING_SVTOOLS_RTF_NOBRKHYPH "\\_"
+#define OOO_STRING_SVTOOLS_RTF_FORMULA "\\|"
+#define OOO_STRING_SVTOOLS_RTF_NOBREAK "\\~"
+#define OOO_STRING_SVTOOLS_RTF_AB "\\ab"
+#define OOO_STRING_SVTOOLS_RTF_ACAPS "\\acaps"
+#define OOO_STRING_SVTOOLS_RTF_ACF "\\acf"
+#define OOO_STRING_SVTOOLS_RTF_ADDITIVE "\\additive"
+#define OOO_STRING_SVTOOLS_RTF_ADN "\\adn"
+#define OOO_STRING_SVTOOLS_RTF_AENDDOC "\\aenddoc"
+#define OOO_STRING_SVTOOLS_RTF_AENDNOTES "\\aendnotes"
+#define OOO_STRING_SVTOOLS_RTF_AEXPND "\\aexpnd"
+#define OOO_STRING_SVTOOLS_RTF_AF "\\af"
+#define OOO_STRING_SVTOOLS_RTF_AFS "\\afs"
+#define OOO_STRING_SVTOOLS_RTF_AFTNBJ "\\aftnbj"
+#define OOO_STRING_SVTOOLS_RTF_AFTNCN "\\aftncn"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNALC "\\aftnnalc"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNAR "\\aftnnar"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNAUC "\\aftnnauc"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNCHI "\\aftnnchi"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNRLC "\\aftnnrlc"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNRUC "\\aftnnruc"
+#define OOO_STRING_SVTOOLS_RTF_SAFTNNALC "\\saftnnalc"
+#define OOO_STRING_SVTOOLS_RTF_SAFTNNAR "\\saftnnar"
+#define OOO_STRING_SVTOOLS_RTF_SAFTNNAUC "\\saftnnauc"
+#define OOO_STRING_SVTOOLS_RTF_SAFTNNCHI "\\saftnnchi"
+#define OOO_STRING_SVTOOLS_RTF_SAFTNNRLC "\\saftnnrlc"
+#define OOO_STRING_SVTOOLS_RTF_SAFTNNRUC "\\saftnnruc"
+#define OOO_STRING_SVTOOLS_RTF_AFTNRESTART "\\aftnrestart"
+#define OOO_STRING_SVTOOLS_RTF_AFTNRSTCONT "\\aftnrstcont"
+#define OOO_STRING_SVTOOLS_RTF_AFTNSEP "\\aftnsep"
+#define OOO_STRING_SVTOOLS_RTF_AFTNSEPC "\\aftnsepc"
+#define OOO_STRING_SVTOOLS_RTF_AFTNSTART "\\aftnstart"
+#define OOO_STRING_SVTOOLS_RTF_AFTNTJ "\\aftntj"
+#define OOO_STRING_SVTOOLS_RTF_AI "\\ai"
+#define OOO_STRING_SVTOOLS_RTF_ALANG "\\alang"
+#define OOO_STRING_SVTOOLS_RTF_ALLPROT "\\allprot"
+#define OOO_STRING_SVTOOLS_RTF_ANNOTPROT "\\annotprot"
+#define OOO_STRING_SVTOOLS_RTF_AOUTL "\\aoutl"
+#define OOO_STRING_SVTOOLS_RTF_ASCAPS "\\ascaps"
+#define OOO_STRING_SVTOOLS_RTF_ASHAD "\\ashad"
+#define OOO_STRING_SVTOOLS_RTF_ASTRIKE "\\astrike"
+#define OOO_STRING_SVTOOLS_RTF_ATNAUTHOR "\\atnauthor"
+#define OOO_STRING_SVTOOLS_RTF_ATNICN "\\atnicn"
+#define OOO_STRING_SVTOOLS_RTF_ATNREF "\\atnref"
+#define OOO_STRING_SVTOOLS_RTF_ATNTIME "\\atntime"
+#define OOO_STRING_SVTOOLS_RTF_ATRFEND "\\atrfend"
+#define OOO_STRING_SVTOOLS_RTF_ATRFSTART "\\atrfstart"
+#define OOO_STRING_SVTOOLS_RTF_AUL "\\aul"
+#define OOO_STRING_SVTOOLS_RTF_AULD "\\auld"
+#define OOO_STRING_SVTOOLS_RTF_AULDB "\\auldb"
+#define OOO_STRING_SVTOOLS_RTF_AULNONE "\\aulnone"
+#define OOO_STRING_SVTOOLS_RTF_AULW "\\aulw"
+#define OOO_STRING_SVTOOLS_RTF_AUP "\\aup"
+#define OOO_STRING_SVTOOLS_RTF_BKMKPUB "\\bkmkpub"
+#define OOO_STRING_SVTOOLS_RTF_BRKFRM "\\brkfrm"
+#define OOO_STRING_SVTOOLS_RTF_CCHS "\\cchs"
+#define OOO_STRING_SVTOOLS_RTF_CPG "\\cpg"
+#define OOO_STRING_SVTOOLS_RTF_CS "\\cs"
+#define OOO_STRING_SVTOOLS_RTF_CVMME "\\cvmme"
+#define OOO_STRING_SVTOOLS_RTF_DATAFIELD "\\datafield"
+#define OOO_STRING_SVTOOLS_RTF_DO "\\do"
+#define OOO_STRING_SVTOOLS_RTF_DOBXCOLUMN "\\dobxcolumn"
+#define OOO_STRING_SVTOOLS_RTF_DOBXMARGIN "\\dobxmargin"
+#define OOO_STRING_SVTOOLS_RTF_DOBXPAGE "\\dobxpage"
+#define OOO_STRING_SVTOOLS_RTF_DOBYMARGIN "\\dobymargin"
+#define OOO_STRING_SVTOOLS_RTF_DOBYPAGE "\\dobypage"
+#define OOO_STRING_SVTOOLS_RTF_DOBYPARA "\\dobypara"
+#define OOO_STRING_SVTOOLS_RTF_DODHGT "\\dodhgt"
+#define OOO_STRING_SVTOOLS_RTF_DOLOCK "\\dolock"
+#define OOO_STRING_SVTOOLS_RTF_DPAENDHOL "\\dpaendhol"
+#define OOO_STRING_SVTOOLS_RTF_DPAENDL "\\dpaendl"
+#define OOO_STRING_SVTOOLS_RTF_DPAENDSOL "\\dpaendsol"
+#define OOO_STRING_SVTOOLS_RTF_DPAENDW "\\dpaendw"
+#define OOO_STRING_SVTOOLS_RTF_DPARC "\\dparc"
+#define OOO_STRING_SVTOOLS_RTF_DPARCFLIPX "\\dparcflipx"
+#define OOO_STRING_SVTOOLS_RTF_DPARCFLIPY "\\dparcflipy"
+#define OOO_STRING_SVTOOLS_RTF_DPASTARTHOL "\\dpastarthol"
+#define OOO_STRING_SVTOOLS_RTF_DPASTARTL "\\dpastartl"
+#define OOO_STRING_SVTOOLS_RTF_DPASTARTSOL "\\dpastartsol"
+#define OOO_STRING_SVTOOLS_RTF_DPASTARTW "\\dpastartw"
+#define OOO_STRING_SVTOOLS_RTF_DPCALLOUT "\\dpcallout"
+#define OOO_STRING_SVTOOLS_RTF_DPCOA "\\dpcoa"
+#define OOO_STRING_SVTOOLS_RTF_DPCOACCENT "\\dpcoaccent"
+#define OOO_STRING_SVTOOLS_RTF_DPCOBESTFIT "\\dpcobestfit"
+#define OOO_STRING_SVTOOLS_RTF_DPCOBORDER "\\dpcoborder"
+#define OOO_STRING_SVTOOLS_RTF_DPCODABS "\\dpcodabs"
+#define OOO_STRING_SVTOOLS_RTF_DPCODBOTTOM "\\dpcodbottom"
+#define OOO_STRING_SVTOOLS_RTF_DPCODCENTER "\\dpcodcenter"
+#define OOO_STRING_SVTOOLS_RTF_DPCODTOP "\\dpcodtop"
+#define OOO_STRING_SVTOOLS_RTF_DPCOLENGTH "\\dpcolength"
+#define OOO_STRING_SVTOOLS_RTF_DPCOMINUSX "\\dpcominusx"
+#define OOO_STRING_SVTOOLS_RTF_DPCOMINUSY "\\dpcominusy"
+#define OOO_STRING_SVTOOLS_RTF_DPCOOFFSET "\\dpcooffset"
+#define OOO_STRING_SVTOOLS_RTF_DPCOSMARTA "\\dpcosmarta"
+#define OOO_STRING_SVTOOLS_RTF_DPCOTDOUBLE "\\dpcotdouble"
+#define OOO_STRING_SVTOOLS_RTF_DPCOTRIGHT "\\dpcotright"
+#define OOO_STRING_SVTOOLS_RTF_DPCOTSINGLE "\\dpcotsingle"
+#define OOO_STRING_SVTOOLS_RTF_DPCOTTRIPLE "\\dpcottriple"
+#define OOO_STRING_SVTOOLS_RTF_DPCOUNT "\\dpcount"
+#define OOO_STRING_SVTOOLS_RTF_DPELLIPSE "\\dpellipse"
+#define OOO_STRING_SVTOOLS_RTF_DPENDGROUP "\\dpendgroup"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCB "\\dpfillbgcb"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCG "\\dpfillbgcg"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCR "\\dpfillbgcr"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLBGGRAY "\\dpfillbggray"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLBGPAL "\\dpfillbgpal"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCB "\\dpfillfgcb"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCG "\\dpfillfgcg"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCR "\\dpfillfgcr"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLFGGRAY "\\dpfillfggray"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLFGPAL "\\dpfillfgpal"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLPAT "\\dpfillpat"
+#define OOO_STRING_SVTOOLS_RTF_DPGROUP "\\dpgroup"
+#define OOO_STRING_SVTOOLS_RTF_DPLINE "\\dpline"
+#define OOO_STRING_SVTOOLS_RTF_DPLINECOB "\\dplinecob"
+#define OOO_STRING_SVTOOLS_RTF_DPLINECOG "\\dplinecog"
+#define OOO_STRING_SVTOOLS_RTF_DPLINECOR "\\dplinecor"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEDADO "\\dplinedado"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEDADODO "\\dplinedadodo"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEDASH "\\dplinedash"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEDOT "\\dplinedot"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEGRAY "\\dplinegray"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEHOLLOW "\\dplinehollow"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEPAL "\\dplinepal"
+#define OOO_STRING_SVTOOLS_RTF_DPLINESOLID "\\dplinesolid"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEW "\\dplinew"
+#define OOO_STRING_SVTOOLS_RTF_DPPOLYCOUNT "\\dppolycount"
+#define OOO_STRING_SVTOOLS_RTF_DPPOLYGON "\\dppolygon"
+#define OOO_STRING_SVTOOLS_RTF_DPPOLYLINE "\\dppolyline"
+#define OOO_STRING_SVTOOLS_RTF_DPPTX "\\dpptx"
+#define OOO_STRING_SVTOOLS_RTF_DPPTY "\\dppty"
+#define OOO_STRING_SVTOOLS_RTF_DPRECT "\\dprect"
+#define OOO_STRING_SVTOOLS_RTF_DPROUNDR "\\dproundr"
+#define OOO_STRING_SVTOOLS_RTF_DPSHADOW "\\dpshadow"
+#define OOO_STRING_SVTOOLS_RTF_DPSHADX "\\dpshadx"
+#define OOO_STRING_SVTOOLS_RTF_DPSHADY "\\dpshady"
+#define OOO_STRING_SVTOOLS_RTF_DPTXBX "\\dptxbx"
+#define OOO_STRING_SVTOOLS_RTF_DPTXBXMAR "\\dptxbxmar"
+#define OOO_STRING_SVTOOLS_RTF_DPTXBXTEXT "\\dptxbxtext"
+#define OOO_STRING_SVTOOLS_RTF_DPX "\\dpx"
+#define OOO_STRING_SVTOOLS_RTF_DPXSIZE "\\dpxsize"
+#define OOO_STRING_SVTOOLS_RTF_DPY "\\dpy"
+#define OOO_STRING_SVTOOLS_RTF_DPYSIZE "\\dpysize"
+#define OOO_STRING_SVTOOLS_RTF_DS "\\ds"
+#define OOO_STRING_SVTOOLS_RTF_EMSPACE "\\emspace"
+#define OOO_STRING_SVTOOLS_RTF_ENSPACE "\\enspace"
+#define OOO_STRING_SVTOOLS_RTF_FBIDI "\\fbidi"
+#define OOO_STRING_SVTOOLS_RTF_FET "\\fet"
+#define OOO_STRING_SVTOOLS_RTF_FID "\\fid"
+#define OOO_STRING_SVTOOLS_RTF_FILE "\\file"
+#define OOO_STRING_SVTOOLS_RTF_FILETBL "\\filetbl"
+#define OOO_STRING_SVTOOLS_RTF_FLDALT "\\fldalt"
+#define OOO_STRING_SVTOOLS_RTF_FNETWORK "\\fnetwork"
+#define OOO_STRING_SVTOOLS_RTF_FONTEMB "\\fontemb"
+#define OOO_STRING_SVTOOLS_RTF_FONTFILE "\\fontfile"
+#define OOO_STRING_SVTOOLS_RTF_FORMDISP "\\formdisp"
+#define OOO_STRING_SVTOOLS_RTF_FORMPROT "\\formprot"
+#define OOO_STRING_SVTOOLS_RTF_FORMSHADE "\\formshade"
+#define OOO_STRING_SVTOOLS_RTF_FOSNUM "\\fosnum"
+#define OOO_STRING_SVTOOLS_RTF_FRELATIVE "\\frelative"
+#define OOO_STRING_SVTOOLS_RTF_FTNALT "\\ftnalt"
+#define OOO_STRING_SVTOOLS_RTF_FTNIL "\\ftnil"
+#define OOO_STRING_SVTOOLS_RTF_FTNNALC "\\ftnnalc"
+#define OOO_STRING_SVTOOLS_RTF_FTNNAR "\\ftnnar"
+#define OOO_STRING_SVTOOLS_RTF_FTNNAUC "\\ftnnauc"
+#define OOO_STRING_SVTOOLS_RTF_FTNNCHI "\\ftnnchi"
+#define OOO_STRING_SVTOOLS_RTF_FTNNRLC "\\ftnnrlc"
+#define OOO_STRING_SVTOOLS_RTF_FTNNRUC "\\ftnnruc"
+#define OOO_STRING_SVTOOLS_RTF_SFTNNALC "\\sftnnalc"
+#define OOO_STRING_SVTOOLS_RTF_SFTNNAR "\\sftnnar"
+#define OOO_STRING_SVTOOLS_RTF_SFTNNAUC "\\sftnnauc"
+#define OOO_STRING_SVTOOLS_RTF_SFTNNCHI "\\sftnnchi"
+#define OOO_STRING_SVTOOLS_RTF_SFTNNRLC "\\sftnnrlc"
+#define OOO_STRING_SVTOOLS_RTF_SFTNNRUC "\\sftnnruc"
+#define OOO_STRING_SVTOOLS_RTF_FTNRSTCONT "\\ftnrstcont"
+#define OOO_STRING_SVTOOLS_RTF_FTNRSTPG "\\ftnrstpg"
+#define OOO_STRING_SVTOOLS_RTF_FTTRUETYPE "\\fttruetype"
+#define OOO_STRING_SVTOOLS_RTF_FVALIDDOS "\\fvaliddos"
+#define OOO_STRING_SVTOOLS_RTF_FVALIDHPFS "\\fvalidhpfs"
+#define OOO_STRING_SVTOOLS_RTF_FVALIDMAC "\\fvalidmac"
+#define OOO_STRING_SVTOOLS_RTF_FVALIDNTFS "\\fvalidntfs"
+#define OOO_STRING_SVTOOLS_RTF_HYPHAUTO "\\hyphauto"
+#define OOO_STRING_SVTOOLS_RTF_HYPHCAPS "\\hyphcaps"
+#define OOO_STRING_SVTOOLS_RTF_HYPHCONSEC "\\hyphconsec"
+#define OOO_STRING_SVTOOLS_RTF_HYPHPAR "\\hyphpar"
+#define OOO_STRING_SVTOOLS_RTF_LINKSELF "\\linkself"
+#define OOO_STRING_SVTOOLS_RTF_LINKSTYLES "\\linkstyles"
+#define OOO_STRING_SVTOOLS_RTF_LTRCH "\\ltrch"
+#define OOO_STRING_SVTOOLS_RTF_LTRDOC "\\ltrdoc"
+#define OOO_STRING_SVTOOLS_RTF_LTRMARK "\\ltrmark"
+#define OOO_STRING_SVTOOLS_RTF_LTRPAR "\\ltrpar"
+#define OOO_STRING_SVTOOLS_RTF_LTRROW "\\ltrrow"
+#define OOO_STRING_SVTOOLS_RTF_LTRSECT "\\ltrsect"
+#define OOO_STRING_SVTOOLS_RTF_NOCOLBAL "\\nocolbal"
+#define OOO_STRING_SVTOOLS_RTF_NOEXTRASPRL "\\noextrasprl"
+#define OOO_STRING_SVTOOLS_RTF_NOTABIND "\\notabind"
+#define OOO_STRING_SVTOOLS_RTF_NOWIDCTLPAR "\\nowidctlpar"
+#define OOO_STRING_SVTOOLS_RTF_OBJALIAS "\\objalias"
+#define OOO_STRING_SVTOOLS_RTF_OBJALIGN "\\objalign"
+#define OOO_STRING_SVTOOLS_RTF_OBJAUTLINK "\\objautlink"
+#define OOO_STRING_SVTOOLS_RTF_OBJCLASS "\\objclass"
+#define OOO_STRING_SVTOOLS_RTF_OBJCROPB "\\objcropb"
+#define OOO_STRING_SVTOOLS_RTF_OBJCROPL "\\objcropl"
+#define OOO_STRING_SVTOOLS_RTF_OBJCROPR "\\objcropr"
+#define OOO_STRING_SVTOOLS_RTF_OBJCROPT "\\objcropt"
+#define OOO_STRING_SVTOOLS_RTF_OBJDATA "\\objdata"
+#define OOO_STRING_SVTOOLS_RTF_OBJECT "\\object"
+#define OOO_STRING_SVTOOLS_RTF_OBJEMB "\\objemb"
+#define OOO_STRING_SVTOOLS_RTF_OBJH "\\objh"
+#define OOO_STRING_SVTOOLS_RTF_OBJICEMB "\\objicemb"
+#define OOO_STRING_SVTOOLS_RTF_OBJLINK "\\objlink"
+#define OOO_STRING_SVTOOLS_RTF_OBJLOCK "\\objlock"
+#define OOO_STRING_SVTOOLS_RTF_OBJNAME "\\objname"
+#define OOO_STRING_SVTOOLS_RTF_OBJPUB "\\objpub"
+#define OOO_STRING_SVTOOLS_RTF_OBJSCALEX "\\objscalex"
+#define OOO_STRING_SVTOOLS_RTF_OBJSCALEY "\\objscaley"
+#define OOO_STRING_SVTOOLS_RTF_OBJSECT "\\objsect"
+#define OOO_STRING_SVTOOLS_RTF_OBJSETSIZE "\\objsetsize"
+#define OOO_STRING_SVTOOLS_RTF_OBJSUB "\\objsub"
+#define OOO_STRING_SVTOOLS_RTF_OBJTIME "\\objtime"
+#define OOO_STRING_SVTOOLS_RTF_OBJTRANSY "\\objtransy"
+#define OOO_STRING_SVTOOLS_RTF_OBJUPDATE "\\objupdate"
+#define OOO_STRING_SVTOOLS_RTF_OBJW "\\objw"
+#define OOO_STRING_SVTOOLS_RTF_OTBLRUL "\\otblrul"
+#define OOO_STRING_SVTOOLS_RTF_PGNHN "\\pgnhn"
+#define OOO_STRING_SVTOOLS_RTF_PGNHNSC "\\pgnhnsc"
+#define OOO_STRING_SVTOOLS_RTF_PGNHNSH "\\pgnhnsh"
+#define OOO_STRING_SVTOOLS_RTF_PGNHNSM "\\pgnhnsm"
+#define OOO_STRING_SVTOOLS_RTF_PGNHNSN "\\pgnhnsn"
+#define OOO_STRING_SVTOOLS_RTF_PGNHNSP "\\pgnhnsp"
+#define OOO_STRING_SVTOOLS_RTF_PICBMP "\\picbmp"
+#define OOO_STRING_SVTOOLS_RTF_PICBPP "\\picbpp"
+#define OOO_STRING_SVTOOLS_RTF_PN "\\pn"
+#define OOO_STRING_SVTOOLS_RTF_PNACROSS "\\pnacross"
+#define OOO_STRING_SVTOOLS_RTF_PNB "\\pnb"
+#define OOO_STRING_SVTOOLS_RTF_PNCAPS "\\pncaps"
+#define OOO_STRING_SVTOOLS_RTF_PNCARD "\\pncard"
+#define OOO_STRING_SVTOOLS_RTF_PNCF "\\pncf"
+#define OOO_STRING_SVTOOLS_RTF_PNDEC "\\pndec"
+#define OOO_STRING_SVTOOLS_RTF_PNF "\\pnf"
+#define OOO_STRING_SVTOOLS_RTF_PNFS "\\pnfs"
+#define OOO_STRING_SVTOOLS_RTF_PNHANG "\\pnhang"
+#define OOO_STRING_SVTOOLS_RTF_PNI "\\pni"
+#define OOO_STRING_SVTOOLS_RTF_PNINDENT "\\pnindent"
+#define OOO_STRING_SVTOOLS_RTF_PNLCLTR "\\pnlcltr"
+#define OOO_STRING_SVTOOLS_RTF_PNLCRM "\\pnlcrm"
+#define OOO_STRING_SVTOOLS_RTF_PNLVL "\\pnlvl"
+#define OOO_STRING_SVTOOLS_RTF_PNLVLBLT "\\pnlvlblt"
+#define OOO_STRING_SVTOOLS_RTF_PNLVLBODY "\\pnlvlbody"
+#define OOO_STRING_SVTOOLS_RTF_PNLVLCONT "\\pnlvlcont"
+#define OOO_STRING_SVTOOLS_RTF_PNNUMONCE "\\pnnumonce"
+#define OOO_STRING_SVTOOLS_RTF_PNORD "\\pnord"
+#define OOO_STRING_SVTOOLS_RTF_PNORDT "\\pnordt"
+#define OOO_STRING_SVTOOLS_RTF_PNPREV "\\pnprev"
+#define OOO_STRING_SVTOOLS_RTF_PNQC "\\pnqc"
+#define OOO_STRING_SVTOOLS_RTF_PNQL "\\pnql"
+#define OOO_STRING_SVTOOLS_RTF_PNQR "\\pnqr"
+#define OOO_STRING_SVTOOLS_RTF_PNRESTART "\\pnrestart"
+#define OOO_STRING_SVTOOLS_RTF_PNSCAPS "\\pnscaps"
+#define OOO_STRING_SVTOOLS_RTF_PNSECLVL "\\pnseclvl"
+#define OOO_STRING_SVTOOLS_RTF_PNSP "\\pnsp"
+#define OOO_STRING_SVTOOLS_RTF_PNSTART "\\pnstart"
+#define OOO_STRING_SVTOOLS_RTF_PNSTRIKE "\\pnstrike"
+#define OOO_STRING_SVTOOLS_RTF_PNTEXT "\\pntext"
+#define OOO_STRING_SVTOOLS_RTF_PNTXTA "\\pntxta"
+#define OOO_STRING_SVTOOLS_RTF_PNTXTB "\\pntxtb"
+#define OOO_STRING_SVTOOLS_RTF_PNUCLTR "\\pnucltr"
+#define OOO_STRING_SVTOOLS_RTF_PNUCRM "\\pnucrm"
+#define OOO_STRING_SVTOOLS_RTF_PNUL "\\pnul"
+#define OOO_STRING_SVTOOLS_RTF_PNULD "\\pnuld"
+#define OOO_STRING_SVTOOLS_RTF_PNULDB "\\pnuldb"
+#define OOO_STRING_SVTOOLS_RTF_PNULNONE "\\pnulnone"
+#define OOO_STRING_SVTOOLS_RTF_PNULW "\\pnulw"
+#define OOO_STRING_SVTOOLS_RTF_PRCOLBL "\\prcolbl"
+#define OOO_STRING_SVTOOLS_RTF_PRINTDATA "\\printdata"
+#define OOO_STRING_SVTOOLS_RTF_PSZ "\\psz"
+#define OOO_STRING_SVTOOLS_RTF_PUBAUTO "\\pubauto"
+#define OOO_STRING_SVTOOLS_RTF_RESULT "\\result"
+#define OOO_STRING_SVTOOLS_RTF_REVAUTH "\\revauth"
+#define OOO_STRING_SVTOOLS_RTF_REVDTTM "\\revdttm"
+#define OOO_STRING_SVTOOLS_RTF_REVPROT "\\revprot"
+#define OOO_STRING_SVTOOLS_RTF_REVTBL "\\revtbl"
+#define OOO_STRING_SVTOOLS_RTF_RSLTBMP "\\rsltbmp"
+#define OOO_STRING_SVTOOLS_RTF_RSLTMERGE "\\rsltmerge"
+#define OOO_STRING_SVTOOLS_RTF_RSLTPICT "\\rsltpict"
+#define OOO_STRING_SVTOOLS_RTF_RSLTRTF "\\rsltrtf"
+#define OOO_STRING_SVTOOLS_RTF_RSLTTXT "\\rslttxt"
+#define OOO_STRING_SVTOOLS_RTF_RTLCH "\\rtlch"
+#define OOO_STRING_SVTOOLS_RTF_RTLDOC "\\rtldoc"
+#define OOO_STRING_SVTOOLS_RTF_RTLMARK "\\rtlmark"
+#define OOO_STRING_SVTOOLS_RTF_RTLPAR "\\rtlpar"
+#define OOO_STRING_SVTOOLS_RTF_RTLROW "\\rtlrow"
+#define OOO_STRING_SVTOOLS_RTF_RTLSECT "\\rtlsect"
+#define OOO_STRING_SVTOOLS_RTF_SEC "\\sec"
+#define OOO_STRING_SVTOOLS_RTF_SECTNUM "\\sectnum"
+#define OOO_STRING_SVTOOLS_RTF_SECTUNLOCKED "\\sectunlocked"
+#define OOO_STRING_SVTOOLS_RTF_SLMULT "\\slmult"
+#define OOO_STRING_SVTOOLS_RTF_SOFTCOL "\\softcol"
+#define OOO_STRING_SVTOOLS_RTF_SOFTLHEIGHT "\\softlheight"
+#define OOO_STRING_SVTOOLS_RTF_SOFTLINE "\\softline"
+#define OOO_STRING_SVTOOLS_RTF_SOFTPAGE "\\softpage"
+#define OOO_STRING_SVTOOLS_RTF_SPRSSPBF "\\sprsspbf"
+#define OOO_STRING_SVTOOLS_RTF_SPRSTSP "\\sprstsp"
+#define OOO_STRING_SVTOOLS_RTF_SUBDOCUMENT "\\subdocument"
+#define OOO_STRING_SVTOOLS_RTF_SWPBDR "\\swpbdr"
+#define OOO_STRING_SVTOOLS_RTF_TCN "\\tcn"
+#define OOO_STRING_SVTOOLS_RTF_TRANSMF "\\transmf"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRB "\\trbrdrb"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRH "\\trbrdrh"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRL "\\trbrdrl"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRR "\\trbrdrr"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRT "\\trbrdrt"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRV "\\trbrdrv"
+#define OOO_STRING_SVTOOLS_RTF_TRHDR "\\trhdr"
+#define OOO_STRING_SVTOOLS_RTF_TRKEEP "\\trkeep"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDB "\\trpaddb"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDL "\\trpaddl"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDR "\\trpaddr"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDT "\\trpaddt"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDFB "\\trpaddfb"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDFL "\\trpaddfl"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDFR "\\trpaddfr"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDFT "\\trpaddft"
+#define OOO_STRING_SVTOOLS_RTF_WRAPTRSP "\\wraptrsp"
+#define OOO_STRING_SVTOOLS_RTF_XEF "\\xef"
+#define OOO_STRING_SVTOOLS_RTF_ZWJ "\\zwj"
+#define OOO_STRING_SVTOOLS_RTF_ZWNJ "\\zwnj"
+
+// new tokens for 1.5
+#define OOO_STRING_SVTOOLS_RTF_ABSLOCK "\\abslock"
+#define OOO_STRING_SVTOOLS_RTF_ADJUSTRIGHT "\\adjustright"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNCHOSUNG "\\aftnnchosung"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNCNUM "\\aftnncnum"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNDBAR "\\aftnndbar"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUM "\\aftnndbnum"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMD "\\aftnndbnumd"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMK "\\aftnndbnumk"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMT "\\aftnndbnumt"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNGANADA "\\aftnnganada"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUM "\\aftnngbnum"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUMD "\\aftnngbnumd"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUMK "\\aftnngbnumk"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUML "\\aftnngbnuml"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIAC "\\aftnnzodiac"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIACD "\\aftnnzodiacd"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIACL "\\aftnnzodiacl"
+#define OOO_STRING_SVTOOLS_RTF_ANIMTEXT "\\animtext"
+#define OOO_STRING_SVTOOLS_RTF_ANSICPG "\\ansicpg"
+#define OOO_STRING_SVTOOLS_RTF_BACKGROUND "\\background"
+#define OOO_STRING_SVTOOLS_RTF_BDBFHDR "\\bdbfhdr"
+#define OOO_STRING_SVTOOLS_RTF_BLIPTAG "\\bliptag"
+#define OOO_STRING_SVTOOLS_RTF_BLIPUID "\\blipuid"
+#define OOO_STRING_SVTOOLS_RTF_BLIPUPI "\\blipupi"
+#define OOO_STRING_SVTOOLS_RTF_BRDRART "\\brdrart"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASHD "\\brdrdashd"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASHDD "\\brdrdashdd"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASHDOTSTR "\\brdrdashdotstr"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASHSM "\\brdrdashsm"
+#define OOO_STRING_SVTOOLS_RTF_BRDREMBOSS "\\brdremboss"
+#define OOO_STRING_SVTOOLS_RTF_BRDRENGRAVE "\\brdrengrave"
+#define OOO_STRING_SVTOOLS_RTF_BRDROUTSET "\\brdroutset"
+#define OOO_STRING_SVTOOLS_RTF_BRDRINSET "\\brdrinset"
+#define OOO_STRING_SVTOOLS_RTF_BRDRNONE "\\brdrnone"
+#define OOO_STRING_SVTOOLS_RTF_BRDRFRAME "\\brdrframe"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNLG "\\brdrthtnlg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNMG "\\brdrthtnmg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNSG "\\brdrthtnsg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHLG "\\brdrtnthlg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHMG "\\brdrtnthmg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHSG "\\brdrtnthsg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNLG "\\brdrtnthtnlg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNMG "\\brdrtnthtnmg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNSG "\\brdrtnthtnsg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTRIPLE "\\brdrtriple"
+#define OOO_STRING_SVTOOLS_RTF_BRDRWAVY "\\brdrwavy"
+#define OOO_STRING_SVTOOLS_RTF_BRDRWAVYDB "\\brdrwavydb"
+#define OOO_STRING_SVTOOLS_RTF_CATEGORY "\\category"
+#define OOO_STRING_SVTOOLS_RTF_CGRID "\\cgrid"
+#define OOO_STRING_SVTOOLS_RTF_CHARSCALEX "\\charscalex"
+#define OOO_STRING_SVTOOLS_RTF_CHBGBDIAG "\\chbgbdiag"
+#define OOO_STRING_SVTOOLS_RTF_CHBGCROSS "\\chbgcross"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDCROSS "\\chbgdcross"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKBDIAG "\\chbgdkbdiag"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKCROSS "\\chbgdkcross"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKDCROSS "\\chbgdkdcross"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKFDIAG "\\chbgdkfdiag"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKHORIZ "\\chbgdkhoriz"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKVERT "\\chbgdkvert"
+#define OOO_STRING_SVTOOLS_RTF_CHBGFDIAG "\\chbgfdiag"
+#define OOO_STRING_SVTOOLS_RTF_CHBGHORIZ "\\chbghoriz"
+#define OOO_STRING_SVTOOLS_RTF_CHBGVERT "\\chbgvert"
+#define OOO_STRING_SVTOOLS_RTF_CHBRDR "\\chbrdr"
+#define OOO_STRING_SVTOOLS_RTF_CHCBPAT "\\chcbpat"
+#define OOO_STRING_SVTOOLS_RTF_CHCFPAT "\\chcfpat"
+#define OOO_STRING_SVTOOLS_RTF_CHSHDNG "\\chshdng"
+#define OOO_STRING_SVTOOLS_RTF_CLPADL "\\clpadl"
+#define OOO_STRING_SVTOOLS_RTF_CLPADT "\\clpadt"
+#define OOO_STRING_SVTOOLS_RTF_CLPADB "\\clpadb"
+#define OOO_STRING_SVTOOLS_RTF_CLPADR "\\clpadr"
+#define OOO_STRING_SVTOOLS_RTF_CLPADFL "\\clpadfl"
+#define OOO_STRING_SVTOOLS_RTF_CLPADFT "\\clpadft"
+#define OOO_STRING_SVTOOLS_RTF_CLPADFB "\\clpadfb"
+#define OOO_STRING_SVTOOLS_RTF_CLPADFR "\\clpadfr"
+#define OOO_STRING_SVTOOLS_RTF_CLTXLRTB "\\cltxlrtb"
+#define OOO_STRING_SVTOOLS_RTF_CLTXTBRL "\\cltxtbrl"
+#define OOO_STRING_SVTOOLS_RTF_CLVERTALB "\\clvertalb"
+#define OOO_STRING_SVTOOLS_RTF_CLVERTALC "\\clvertalc"
+#define OOO_STRING_SVTOOLS_RTF_CLVERTALT "\\clvertalt"
+#define OOO_STRING_SVTOOLS_RTF_CLVMGF "\\clvmgf"
+#define OOO_STRING_SVTOOLS_RTF_CLVMRG "\\clvmrg"
+#define OOO_STRING_SVTOOLS_RTF_CLTXTBRLV "\\cltxtbrlv"
+#define OOO_STRING_SVTOOLS_RTF_CLTXBTLR "\\cltxbtlr"
+#define OOO_STRING_SVTOOLS_RTF_CLTXLRTBV "\\cltxlrtbv"
+#define OOO_STRING_SVTOOLS_RTF_COMPANY "\\company"
+#define OOO_STRING_SVTOOLS_RTF_CRAUTH "\\crauth"
+#define OOO_STRING_SVTOOLS_RTF_CRDATE "\\crdate"
+#define OOO_STRING_SVTOOLS_RTF_DATE "\\date"
+#define OOO_STRING_SVTOOLS_RTF_DEFLANGFE "\\deflangfe"
+#define OOO_STRING_SVTOOLS_RTF_DFRAUTH "\\dfrauth"
+#define OOO_STRING_SVTOOLS_RTF_DFRDATE "\\dfrdate"
+#define OOO_STRING_SVTOOLS_RTF_DFRSTART "\\dfrstart"
+#define OOO_STRING_SVTOOLS_RTF_DFRSTOP "\\dfrstop"
+#define OOO_STRING_SVTOOLS_RTF_DFRXST "\\dfrxst"
+#define OOO_STRING_SVTOOLS_RTF_DGMARGIN "\\dgmargin"
+#define OOO_STRING_SVTOOLS_RTF_DNTBLNSBDB "\\dntblnsbdb"
+#define OOO_STRING_SVTOOLS_RTF_DOCTYPE "\\doctype"
+#define OOO_STRING_SVTOOLS_RTF_DOCVAR "\\docvar"
+#define OOO_STRING_SVTOOLS_RTF_DPCODESCENT "\\dpcodescent"
+#define OOO_STRING_SVTOOLS_RTF_EMBO "\\embo"
+#define OOO_STRING_SVTOOLS_RTF_EMFBLIP "\\emfblip"
+#define OOO_STRING_SVTOOLS_RTF_EXPSHRTN "\\expshrtn"
+#define OOO_STRING_SVTOOLS_RTF_FAAUTO "\\faauto"
+#define OOO_STRING_SVTOOLS_RTF_FBIAS "\\fbias"
+#define OOO_STRING_SVTOOLS_RTF_FFDEFRES "\\ffdefres"
+#define OOO_STRING_SVTOOLS_RTF_FFDEFTEXT "\\ffdeftext"
+#define OOO_STRING_SVTOOLS_RTF_FFENTRYMCR "\\ffentrymcr"
+#define OOO_STRING_SVTOOLS_RTF_FFEXITMCR "\\ffexitmcr"
+#define OOO_STRING_SVTOOLS_RTF_FFFORMAT "\\ffformat"
+#define OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX "\\ffhaslistbox"
+#define OOO_STRING_SVTOOLS_RTF_FFHELPTEXT "\\ffhelptext"
+#define OOO_STRING_SVTOOLS_RTF_FFHPS "\\ffhps"
+#define OOO_STRING_SVTOOLS_RTF_FFL "\\ffl"
+#define OOO_STRING_SVTOOLS_RTF_FFMAXLEN "\\ffmaxlen"
+#define OOO_STRING_SVTOOLS_RTF_FFNAME "\\ffname"
+#define OOO_STRING_SVTOOLS_RTF_FFOWNHELP "\\ffownhelp"
+#define OOO_STRING_SVTOOLS_RTF_FFOWNSTAT "\\ffownstat"
+#define OOO_STRING_SVTOOLS_RTF_FFPROT "\\ffprot"
+#define OOO_STRING_SVTOOLS_RTF_FFRECALC "\\ffrecalc"
+#define OOO_STRING_SVTOOLS_RTF_FFRES "\\ffres"
+#define OOO_STRING_SVTOOLS_RTF_FFSIZE "\\ffsize"
+#define OOO_STRING_SVTOOLS_RTF_FFSTATTEXT "\\ffstattext"
+#define OOO_STRING_SVTOOLS_RTF_FFTYPE "\\fftype"
+#define OOO_STRING_SVTOOLS_RTF_FFTYPETXT "\\fftypetxt"
+#define OOO_STRING_SVTOOLS_RTF_FLDTYPE "\\fldtype"
+#define OOO_STRING_SVTOOLS_RTF_FNAME "\\fname"
+#define OOO_STRING_SVTOOLS_RTF_FORMFIELD "\\formfield"
+#define OOO_STRING_SVTOOLS_RTF_FROMTEXT "\\fromtext"
+#define OOO_STRING_SVTOOLS_RTF_FTNNCHOSUNG "\\ftnnchosung"
+#define OOO_STRING_SVTOOLS_RTF_FTNNCNUM "\\ftnncnum"
+#define OOO_STRING_SVTOOLS_RTF_FTNNDBAR "\\ftnndbar"
+#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUM "\\ftnndbnum"
+#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMD "\\ftnndbnumd"
+#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMK "\\ftnndbnumk"
+#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMT "\\ftnndbnumt"
+#define OOO_STRING_SVTOOLS_RTF_FTNNGANADA "\\ftnnganada"
+#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUM "\\ftnngbnum"
+#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUMD "\\ftnngbnumd"
+#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUMK "\\ftnngbnumk"
+#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUML "\\ftnngbnuml"
+#define OOO_STRING_SVTOOLS_RTF_FTNNZODIAC "\\ftnnzodiac"
+#define OOO_STRING_SVTOOLS_RTF_FTNNZODIACD "\\ftnnzodiacd"
+#define OOO_STRING_SVTOOLS_RTF_FTNNZODIACL "\\ftnnzodiacl"
+#define OOO_STRING_SVTOOLS_RTF_G "\\g"
+#define OOO_STRING_SVTOOLS_RTF_GCW "\\gcw"
+#define OOO_STRING_SVTOOLS_RTF_GRIDTBL "\\gridtbl"
+#define OOO_STRING_SVTOOLS_RTF_HIGHLIGHT "\\highlight"
+#define OOO_STRING_SVTOOLS_RTF_HLFR "\\hlfr"
+#define OOO_STRING_SVTOOLS_RTF_HLINKBASE "\\hlinkbase"
+#define OOO_STRING_SVTOOLS_RTF_HLLOC "\\hlloc"
+#define OOO_STRING_SVTOOLS_RTF_HLSRC "\\hlsrc"
+#define OOO_STRING_SVTOOLS_RTF_ILVL "\\ilvl"
+#define OOO_STRING_SVTOOLS_RTF_IMPR "\\impr"
+#define OOO_STRING_SVTOOLS_RTF_JPEGBLIP "\\jpegblip"
+#define OOO_STRING_SVTOOLS_RTF_LEVELFOLLOW "\\levelfollow"
+#define OOO_STRING_SVTOOLS_RTF_LEVELINDENT "\\levelindent"
+#define OOO_STRING_SVTOOLS_RTF_LEVELJC "\\leveljc"
+#define OOO_STRING_SVTOOLS_RTF_LEVELLEGAL "\\levellegal"
+#define OOO_STRING_SVTOOLS_RTF_LEVELNFC "\\levelnfc"
+#define OOO_STRING_SVTOOLS_RTF_LEVELNORESTART "\\levelnorestart"
+#define OOO_STRING_SVTOOLS_RTF_LEVELNUMBERS "\\levelnumbers"
+#define OOO_STRING_SVTOOLS_RTF_LEVELOLD "\\levelold"
+#define OOO_STRING_SVTOOLS_RTF_LEVELPREV "\\levelprev"
+#define OOO_STRING_SVTOOLS_RTF_LEVELPREVSPACE "\\levelprevspace"
+#define OOO_STRING_SVTOOLS_RTF_LEVELSPACE "\\levelspace"
+#define OOO_STRING_SVTOOLS_RTF_LEVELSTARTAT "\\levelstartat"
+#define OOO_STRING_SVTOOLS_RTF_LEVELTEXT "\\leveltext"
+#define OOO_STRING_SVTOOLS_RTF_LINKVAL "\\linkval"
+#define OOO_STRING_SVTOOLS_RTF_LIST "\\list"
+#define OOO_STRING_SVTOOLS_RTF_LISTID "\\listid"
+#define OOO_STRING_SVTOOLS_RTF_LISTLEVEL "\\listlevel"
+#define OOO_STRING_SVTOOLS_RTF_LISTNAME "\\listname"
+#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDE "\\listoverride"
+#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDECOUNT "\\listoverridecount"
+#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDEFORMAT "\\listoverrideformat"
+#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDESTART "\\listoverridestart"
+#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDETABLE "\\listoverridetable"
+#define OOO_STRING_SVTOOLS_RTF_LISTRESTARTHDN "\\listrestarthdn"
+#define OOO_STRING_SVTOOLS_RTF_LISTSIMPLE "\\listsimple"
+#define OOO_STRING_SVTOOLS_RTF_LISTTABLE "\\listtable"
+#define OOO_STRING_SVTOOLS_RTF_LISTTEMPLATEID "\\listtemplateid"
+#define OOO_STRING_SVTOOLS_RTF_LISTTEXT "\\listtext"
+#define OOO_STRING_SVTOOLS_RTF_LS "\\ls"
+#define OOO_STRING_SVTOOLS_RTF_LYTEXCTTP "\\lytexcttp"
+#define OOO_STRING_SVTOOLS_RTF_LYTPRTMET "\\lytprtmet"
+#define OOO_STRING_SVTOOLS_RTF_MANAGER "\\manager"
+#define OOO_STRING_SVTOOLS_RTF_MSMCAP "\\msmcap"
+#define OOO_STRING_SVTOOLS_RTF_NOFCHARSWS "\\nofcharsws"
+#define OOO_STRING_SVTOOLS_RTF_NOLEAD "\\nolead"
+#define OOO_STRING_SVTOOLS_RTF_NONSHPPICT "\\nonshppict"
+#define OOO_STRING_SVTOOLS_RTF_NOSECTEXPAND "\\nosectexpand"
+#define OOO_STRING_SVTOOLS_RTF_NOSNAPLINEGRID "\\nosnaplinegrid"
+#define OOO_STRING_SVTOOLS_RTF_NOSPACEFORUL "\\nospaceforul"
+#define OOO_STRING_SVTOOLS_RTF_NOULTRLSPC "\\noultrlspc"
+#define OOO_STRING_SVTOOLS_RTF_NOXLATTOYEN "\\noxlattoyen"
+#define OOO_STRING_SVTOOLS_RTF_OBJATTPH "\\objattph"
+#define OOO_STRING_SVTOOLS_RTF_OBJHTML "\\objhtml"
+#define OOO_STRING_SVTOOLS_RTF_OBJOCX "\\objocx"
+#define OOO_STRING_SVTOOLS_RTF_OLDLINEWRAP "\\oldlinewrap"
+#define OOO_STRING_SVTOOLS_RTF_OUTLINELEVEL "\\outlinelevel"
+#define OOO_STRING_SVTOOLS_RTF_OVERLAY "\\overlay"
+#define OOO_STRING_SVTOOLS_RTF_PANOSE "\\panose"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRB "\\pgbrdrb"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRFOOT "\\pgbrdrfoot"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRHEAD "\\pgbrdrhead"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRL "\\pgbrdrl"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDROPT "\\pgbrdropt"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRR "\\pgbrdrr"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRSNAP "\\pgbrdrsnap"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRT "\\pgbrdrt"
+#define OOO_STRING_SVTOOLS_RTF_PGNCHOSUNG "\\pgnchosung"
+#define OOO_STRING_SVTOOLS_RTF_PGNCNUM "\\pgncnum"
+#define OOO_STRING_SVTOOLS_RTF_PGNDBNUMK "\\pgndbnumk"
+#define OOO_STRING_SVTOOLS_RTF_PGNDBNUMT "\\pgndbnumt"
+#define OOO_STRING_SVTOOLS_RTF_PGNGANADA "\\pgnganada"
+#define OOO_STRING_SVTOOLS_RTF_PGNGBNUM "\\pgngbnum"
+#define OOO_STRING_SVTOOLS_RTF_PGNGBNUMD "\\pgngbnumd"
+#define OOO_STRING_SVTOOLS_RTF_PGNGBNUMK "\\pgngbnumk"
+#define OOO_STRING_SVTOOLS_RTF_PGNGBNUML "\\pgngbnuml"
+#define OOO_STRING_SVTOOLS_RTF_PGNZODIAC "\\pgnzodiac"
+#define OOO_STRING_SVTOOLS_RTF_PGNZODIACD "\\pgnzodiacd"
+#define OOO_STRING_SVTOOLS_RTF_PGNZODIACL "\\pgnzodiacl"
+#define OOO_STRING_SVTOOLS_RTF_PICPROP "\\picprop"
+#define OOO_STRING_SVTOOLS_RTF_PNAIUEO "\\pnaiueo"
+#define OOO_STRING_SVTOOLS_RTF_PNAIUEOD "\\pnaiueod"
+#define OOO_STRING_SVTOOLS_RTF_PNCHOSUNG "\\pnchosung"
+#define OOO_STRING_SVTOOLS_RTF_PNDBNUMD "\\pndbnumd"
+#define OOO_STRING_SVTOOLS_RTF_PNDBNUMK "\\pndbnumk"
+#define OOO_STRING_SVTOOLS_RTF_PNDBNUML "\\pndbnuml"
+#define OOO_STRING_SVTOOLS_RTF_PNDBNUMT "\\pndbnumt"
+#define OOO_STRING_SVTOOLS_RTF_PNGANADA "\\pnganada"
+#define OOO_STRING_SVTOOLS_RTF_PNGBLIP "\\pngblip"
+#define OOO_STRING_SVTOOLS_RTF_PNGBNUM "\\pngbnum"
+#define OOO_STRING_SVTOOLS_RTF_PNGBNUMD "\\pngbnumd"
+#define OOO_STRING_SVTOOLS_RTF_PNGBNUMK "\\pngbnumk"
+#define OOO_STRING_SVTOOLS_RTF_PNGBNUML "\\pngbnuml"
+#define OOO_STRING_SVTOOLS_RTF_PNRAUTH "\\pnrauth"
+#define OOO_STRING_SVTOOLS_RTF_PNRDATE "\\pnrdate"
+#define OOO_STRING_SVTOOLS_RTF_PNRNFC "\\pnrnfc"
+#define OOO_STRING_SVTOOLS_RTF_PNRNOT "\\pnrnot"
+#define OOO_STRING_SVTOOLS_RTF_PNRPNBR "\\pnrpnbr"
+#define OOO_STRING_SVTOOLS_RTF_PNRRGB "\\pnrrgb"
+#define OOO_STRING_SVTOOLS_RTF_PNRSTART "\\pnrstart"
+#define OOO_STRING_SVTOOLS_RTF_PNRSTOP "\\pnrstop"
+#define OOO_STRING_SVTOOLS_RTF_PNRXST "\\pnrxst"
+#define OOO_STRING_SVTOOLS_RTF_PNZODIAC "\\pnzodiac"
+#define OOO_STRING_SVTOOLS_RTF_PNZODIACD "\\pnzodiacd"
+#define OOO_STRING_SVTOOLS_RTF_PNZODIACL "\\pnzodiacl"
+#define OOO_STRING_SVTOOLS_RTF_LFOLEVEL "\\lfolevel"
+#define OOO_STRING_SVTOOLS_RTF_POSYIN "\\posyin"
+#define OOO_STRING_SVTOOLS_RTF_POSYOUT "\\posyout"
+#define OOO_STRING_SVTOOLS_RTF_PRIVATE "\\private"
+#define OOO_STRING_SVTOOLS_RTF_PROPNAME "\\propname"
+#define OOO_STRING_SVTOOLS_RTF_PROPTYPE "\\proptype"
+#define OOO_STRING_SVTOOLS_RTF_REVAUTHDEL "\\revauthdel"
+#define OOO_STRING_SVTOOLS_RTF_REVDTTMDEL "\\revdttmdel"
+#define OOO_STRING_SVTOOLS_RTF_SAUTOUPD "\\sautoupd"
+#define OOO_STRING_SVTOOLS_RTF_SECTDEFAULTCL "\\sectdefaultcl"
+#define OOO_STRING_SVTOOLS_RTF_SECTEXPAND "\\sectexpand"
+#define OOO_STRING_SVTOOLS_RTF_SECTLINEGRID "\\sectlinegrid"
+#define OOO_STRING_SVTOOLS_RTF_SECTSPECIFYCL "\\sectspecifycl"
+#define OOO_STRING_SVTOOLS_RTF_SECTSPECIFYL "\\sectspecifyl"
+#define OOO_STRING_SVTOOLS_RTF_SHIDDEN "\\shidden"
+#define OOO_STRING_SVTOOLS_RTF_SHPBOTTOM "\\shpbottom"
+#define OOO_STRING_SVTOOLS_RTF_SHPBXCOLUMN "\\shpbxcolumn"
+#define OOO_STRING_SVTOOLS_RTF_SHPBXMARGIN "\\shpbxmargin"
+#define OOO_STRING_SVTOOLS_RTF_SHPBXPAGE "\\shpbxpage"
+#define OOO_STRING_SVTOOLS_RTF_SHPBXIGNORE "\\shpbxignore"
+#define OOO_STRING_SVTOOLS_RTF_SHPBYMARGIN "\\shpbymargin"
+#define OOO_STRING_SVTOOLS_RTF_SHPBYPAGE "\\shpbypage"
+#define OOO_STRING_SVTOOLS_RTF_SHPBYPARA "\\shpbypara"
+#define OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE "\\shpbyignore"
+#define OOO_STRING_SVTOOLS_RTF_SHPFBLWTXT "\\shpfblwtxt"
+#define OOO_STRING_SVTOOLS_RTF_SHPFHDR "\\shpfhdr"
+#define OOO_STRING_SVTOOLS_RTF_SHPGRP "\\shpgrp"
+#define OOO_STRING_SVTOOLS_RTF_SHPINST "\\shpinst"
+#define OOO_STRING_SVTOOLS_RTF_SHPLEFT "\\shpleft"
+#define OOO_STRING_SVTOOLS_RTF_SHPLID "\\shplid"
+#define OOO_STRING_SVTOOLS_RTF_SHPLOCKANCHOR "\\shplockanchor"
+#define OOO_STRING_SVTOOLS_RTF_SHPPICT "\\shppict"
+#define OOO_STRING_SVTOOLS_RTF_SHPRIGHT "\\shpright"
+#define OOO_STRING_SVTOOLS_RTF_SHPRSLT "\\shprslt"
+#define OOO_STRING_SVTOOLS_RTF_SHPTOP "\\shptop"
+#define OOO_STRING_SVTOOLS_RTF_SHPTXT "\\shptxt"
+#define OOO_STRING_SVTOOLS_RTF_SHPWRK "\\shpwrk"
+#define OOO_STRING_SVTOOLS_RTF_SHPWR "\\shpwr"
+#define OOO_STRING_SVTOOLS_RTF_SHPZ "\\shpz"
+#define OOO_STRING_SVTOOLS_RTF_SPRSBSP "\\sprsbsp"
+#define OOO_STRING_SVTOOLS_RTF_SPRSLNSP "\\sprslnsp"
+#define OOO_STRING_SVTOOLS_RTF_SPRSTSM "\\sprstsm"
+#define OOO_STRING_SVTOOLS_RTF_STATICVAL "\\staticval"
+#define OOO_STRING_SVTOOLS_RTF_STEXTFLOW "\\stextflow"
+#define OOO_STRING_SVTOOLS_RTF_STRIKED "\\striked"
+#define OOO_STRING_SVTOOLS_RTF_SUBFONTBYSIZE "\\subfontbysize"
+#define OOO_STRING_SVTOOLS_RTF_TCELLD "\\tcelld"
+#define OOO_STRING_SVTOOLS_RTF_TIME "\\time"
+#define OOO_STRING_SVTOOLS_RTF_TRUNCATEFONTHEIGHT "\\truncatefontheight"
+#define OOO_STRING_SVTOOLS_RTF_UC "\\uc"
+#define OOO_STRING_SVTOOLS_RTF_UD "\\ud"
+#define OOO_STRING_SVTOOLS_RTF_ULDASH "\\uldash"
+#define OOO_STRING_SVTOOLS_RTF_ULDASHD "\\uldashd"
+#define OOO_STRING_SVTOOLS_RTF_ULDASHDD "\\uldashdd"
+#define OOO_STRING_SVTOOLS_RTF_ULTH "\\ulth"
+#define OOO_STRING_SVTOOLS_RTF_ULWAVE "\\ulwave"
+#define OOO_STRING_SVTOOLS_RTF_ULC "\\ulc"
+#define OOO_STRING_SVTOOLS_RTF_U "\\u"
+#define OOO_STRING_SVTOOLS_RTF_UPR "\\upr"
+#define OOO_STRING_SVTOOLS_RTF_USERPROPS "\\userprops"
+#define OOO_STRING_SVTOOLS_RTF_VIEWKIND "\\viewkind"
+#define OOO_STRING_SVTOOLS_RTF_VIEWSCALE "\\viewscale"
+#define OOO_STRING_SVTOOLS_RTF_VIEWZK "\\viewzk"
+#define OOO_STRING_SVTOOLS_RTF_WIDCTLPAR "\\widctlpar"
+#define OOO_STRING_SVTOOLS_RTF_WINDOWCAPTION "\\windowcaption"
+#define OOO_STRING_SVTOOLS_RTF_WPEQN "\\wpeqn"
+#define OOO_STRING_SVTOOLS_RTF_WPJST "\\wpjst"
+#define OOO_STRING_SVTOOLS_RTF_WPSP "\\wpsp"
+#define OOO_STRING_SVTOOLS_RTF_YXE "\\yxe"
+#define OOO_STRING_SVTOOLS_RTF_FRMTXLRTB "\\frmtxlrtb"
+#define OOO_STRING_SVTOOLS_RTF_FRMTXTBRL "\\frmtxtbrl"
+#define OOO_STRING_SVTOOLS_RTF_FRMTXBTLR "\\frmtxbtlr"
+#define OOO_STRING_SVTOOLS_RTF_FRMTXLRTBV "\\frmtxlrtbv"
+#define OOO_STRING_SVTOOLS_RTF_FRMTXTBRLV "\\frmtxtbrlv"
+
+// MS-2000 Tokens
+#define OOO_STRING_SVTOOLS_RTF_ULTHD "\\ulthd"
+#define OOO_STRING_SVTOOLS_RTF_ULTHDASH "\\ulthdash"
+#define OOO_STRING_SVTOOLS_RTF_ULLDASH "\\ulldash"
+#define OOO_STRING_SVTOOLS_RTF_ULTHLDASH "\\ulthldash"
+#define OOO_STRING_SVTOOLS_RTF_ULTHDASHD "\\ulthdashd"
+#define OOO_STRING_SVTOOLS_RTF_ULTHDASHDD "\\ulthdashdd"
+#define OOO_STRING_SVTOOLS_RTF_ULHWAVE "\\ulhwave"
+#define OOO_STRING_SVTOOLS_RTF_ULULDBWAVE "\\ululdbwave"
+#define OOO_STRING_SVTOOLS_RTF_LOCH "\\loch"
+#define OOO_STRING_SVTOOLS_RTF_HICH "\\hich"
+#define OOO_STRING_SVTOOLS_RTF_DBCH "\\dbch"
+#define OOO_STRING_SVTOOLS_RTF_LANGFE "\\langfe"
+#define OOO_STRING_SVTOOLS_RTF_ADEFLANG "\\adeflang"
+#define OOO_STRING_SVTOOLS_RTF_ADEFF "\\adeff"
+#define OOO_STRING_SVTOOLS_RTF_ACCNONE "\\accnone"
+#define OOO_STRING_SVTOOLS_RTF_ACCDOT "\\accdot"
+#define OOO_STRING_SVTOOLS_RTF_ACCCOMMA "\\acccomma"
+#define OOO_STRING_SVTOOLS_RTF_ACCCIRCLE "\\acccircle"
+#define OOO_STRING_SVTOOLS_RTF_ACCUNDERDOT "\\accunderdot"
+#define OOO_STRING_SVTOOLS_RTF_TWOINONE "\\twoinone"
+#define OOO_STRING_SVTOOLS_RTF_HORZVERT "\\horzvert"
+#define OOO_STRING_SVTOOLS_RTF_FAHANG "\\fahang"
+#define OOO_STRING_SVTOOLS_RTF_FAVAR "\\favar"
+#define OOO_STRING_SVTOOLS_RTF_FACENTER "\\facenter"
+#define OOO_STRING_SVTOOLS_RTF_FAROMAN "\\faroman"
+#define OOO_STRING_SVTOOLS_RTF_FAFIXED "\\fafixed"
+#define OOO_STRING_SVTOOLS_RTF_NOCWRAP "\\nocwrap"
+#define OOO_STRING_SVTOOLS_RTF_NOOVERFLOW "\\nooverflow"
+#define OOO_STRING_SVTOOLS_RTF_ASPALPHA "\\aspalpha"
+
+// SWG-specific attributes
+#define OOO_STRING_SVTOOLS_RTF_GRFALIGNV "\\grfalignv"
+#define OOO_STRING_SVTOOLS_RTF_GRFALIGNH "\\grfalignh"
+#define OOO_STRING_SVTOOLS_RTF_GRFMIRROR "\\grfmirror"
+#define OOO_STRING_SVTOOLS_RTF_HEADERYB "\\headeryb"
+#define OOO_STRING_SVTOOLS_RTF_HEADERXL "\\headerxl"
+#define OOO_STRING_SVTOOLS_RTF_HEADERXR "\\headerxr"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERYT "\\footeryt"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERXL "\\footerxl"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERXR "\\footerxr"
+#define OOO_STRING_SVTOOLS_RTF_HEADERYH "\\headeryh"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERYH "\\footeryh"
+#define OOO_STRING_SVTOOLS_RTF_BALANCEDCOLUMN "\\swcolmnblnc"
+#define OOO_STRING_SVTOOLS_RTF_UPDNPROP "\\updnprop"
+#define OOO_STRING_SVTOOLS_RTF_PRTDATA "\\prtdata"
+#define OOO_STRING_SVTOOLS_RTF_BKMKKEY "\\bkmkkey"
+
+// attributes for free-flying frames
+#define OOO_STRING_SVTOOLS_RTF_FLYPRINT "\\flyprint"
+#define OOO_STRING_SVTOOLS_RTF_FLYOPAQUE "\\flyopaque"
+#define OOO_STRING_SVTOOLS_RTF_FLYPRTCTD "\\flyprtctd"
+#define OOO_STRING_SVTOOLS_RTF_FLYMAINCNT "\\flymaincnt"
+#define OOO_STRING_SVTOOLS_RTF_FLYVERT "\\flyvert"
+#define OOO_STRING_SVTOOLS_RTF_FLYHORZ "\\flyhorz"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTL "\\dfrmtxtl"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTR "\\dfrmtxtr"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTU "\\dfrmtxtu"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTW "\\dfrmtxtw"
+#define OOO_STRING_SVTOOLS_RTF_FLYANCHOR "\\flyanchor"
+#define OOO_STRING_SVTOOLS_RTF_FLYCNTNT "\\flycntnt"
+#define OOO_STRING_SVTOOLS_RTF_FLYCOLUMN "\\flycolumn"
+#define OOO_STRING_SVTOOLS_RTF_FLYPAGE "\\flypage"
+#define OOO_STRING_SVTOOLS_RTF_FLYINPARA "\\flyinpara"
+#define OOO_STRING_SVTOOLS_RTF_BRDBOX "\\brdbox"
+#define OOO_STRING_SVTOOLS_RTF_BRDLNCOL "\\brdlncol"
+#define OOO_STRING_SVTOOLS_RTF_BRDLNIN "\\brdlnin"
+#define OOO_STRING_SVTOOLS_RTF_BRDLNOUT "\\brdlnout"
+#define OOO_STRING_SVTOOLS_RTF_BRDLNDIST "\\brdlndist"
+#define OOO_STRING_SVTOOLS_RTF_SHADOW "\\shadow"
+#define OOO_STRING_SVTOOLS_RTF_SHDWDIST "\\shdwdist"
+#define OOO_STRING_SVTOOLS_RTF_SHDWSTYLE "\\shdwstyle"
+#define OOO_STRING_SVTOOLS_RTF_SHDWCOL "\\shdwcol"
+#define OOO_STRING_SVTOOLS_RTF_SHDWFCOL "\\shdwfcol"
+#define OOO_STRING_SVTOOLS_RTF_PGDSCTBL "\\pgdsctbl"
+#define OOO_STRING_SVTOOLS_RTF_PGDSC "\\pgdsc"
+#define OOO_STRING_SVTOOLS_RTF_PGDSCUSE "\\pgdscuse"
+#define OOO_STRING_SVTOOLS_RTF_PGDSCNXT "\\pgdscnxt"
+#define OOO_STRING_SVTOOLS_RTF_HYPHEN "\\hyphen"
+#define OOO_STRING_SVTOOLS_RTF_HYPHLEAD "\\hyphlead"
+#define OOO_STRING_SVTOOLS_RTF_HYPHTRAIL "\\hyphtrail"
+#define OOO_STRING_SVTOOLS_RTF_HYPHMAX "\\hyphmax"
+#define OOO_STRING_SVTOOLS_RTF_TLSWG "\\tlswg"
+#define OOO_STRING_SVTOOLS_RTF_PGBRK "\\pgbrk"
+#define OOO_STRING_SVTOOLS_RTF_PGDSCNO "\\pgdscno"
+#define OOO_STRING_SVTOOLS_RTF_SOUTLVL "\\soutlvl"
+#define OOO_STRING_SVTOOLS_RTF_SHP "\\shp"
+#define OOO_STRING_SVTOOLS_RTF_SN "\\sn"
+#define OOO_STRING_SVTOOLS_RTF_SV "\\sv"
+#define OOO_STRING_SVTOOLS_RTF_SP "\\sp"
+
+// Support for overline attributes
+#define OOO_STRING_SVTOOLS_RTF_OL "\\ol"
+#define OOO_STRING_SVTOOLS_RTF_OLD "\\old"
+#define OOO_STRING_SVTOOLS_RTF_OLDB "\\oldb"
+#define OOO_STRING_SVTOOLS_RTF_OLNONE "\\olnone"
+#define OOO_STRING_SVTOOLS_RTF_OLW "\\olw"
+#define OOO_STRING_SVTOOLS_RTF_OLDASH "\\oldash"
+#define OOO_STRING_SVTOOLS_RTF_OLDASHD "\\oldashd"
+#define OOO_STRING_SVTOOLS_RTF_OLDASHDD "\\oldashdd"
+#define OOO_STRING_SVTOOLS_RTF_OLTH "\\olth"
+#define OOO_STRING_SVTOOLS_RTF_OLWAVE "\\olwave"
+#define OOO_STRING_SVTOOLS_RTF_OLC "\\olc"
+#define OOO_STRING_SVTOOLS_RTF_OLTHD "\\olthd"
+#define OOO_STRING_SVTOOLS_RTF_OLTHDASH "\\olthdash"
+#define OOO_STRING_SVTOOLS_RTF_OLLDASH "\\olldash"
+#define OOO_STRING_SVTOOLS_RTF_OLTHLDASH "\\olthldash"
+#define OOO_STRING_SVTOOLS_RTF_OLTHDASHD "\\olthdashd"
+#define OOO_STRING_SVTOOLS_RTF_OLTHDASHDD "\\olthdashdd"
+#define OOO_STRING_SVTOOLS_RTF_OLHWAVE "\\olhwave"
+#define OOO_STRING_SVTOOLS_RTF_OLOLDBWAVE "\\ololdbwave"
+
+// Support for nested tables
+#define OOO_STRING_SVTOOLS_RTF_ITAP "\\itap"
+#define OOO_STRING_SVTOOLS_RTF_NESTCELL "\\nestcell"
+#define OOO_STRING_SVTOOLS_RTF_NESTTABLEPROPRS "\\nesttableprops"
+#define OOO_STRING_SVTOOLS_RTF_NESTROW "\\nestrow"
+#define OOO_STRING_SVTOOLS_RTF_NONESTTABLES "\\nonesttables"
+
+// Math
+#define LO_STRING_SVTOOLS_RTF_MACC "\\macc"
+#define LO_STRING_SVTOOLS_RTF_MACCPR "\\maccPr"
+#define LO_STRING_SVTOOLS_RTF_MBAR "\\mbar"
+#define LO_STRING_SVTOOLS_RTF_MBARPR "\\mbarPr"
+#define LO_STRING_SVTOOLS_RTF_MBEGCHR "\\mbegChr"
+#define LO_STRING_SVTOOLS_RTF_MBORDERBOX "\\mborderBox"
+#define LO_STRING_SVTOOLS_RTF_MBORDERBOXPR "\\mborderBoxPr"
+#define LO_STRING_SVTOOLS_RTF_MCHR "\\mchr"
+#define LO_STRING_SVTOOLS_RTF_MDEGHIDE "\\mdegHide"
+#define LO_STRING_SVTOOLS_RTF_MDEG "\\mdeg"
+#define LO_STRING_SVTOOLS_RTF_MDEN "\\mden"
+#define LO_STRING_SVTOOLS_RTF_MD "\\md"
+#define LO_STRING_SVTOOLS_RTF_MDPR "\\mdPr"
+#define LO_STRING_SVTOOLS_RTF_ME "\\me"
+#define LO_STRING_SVTOOLS_RTF_MENDCHR "\\mendChr"
+#define LO_STRING_SVTOOLS_RTF_MEQARR "\\meqArr"
+#define LO_STRING_SVTOOLS_RTF_MF "\\mf"
+#define LO_STRING_SVTOOLS_RTF_MFNAME "\\mfName"
+#define LO_STRING_SVTOOLS_RTF_MFPR "\\mfPr"
+#define LO_STRING_SVTOOLS_RTF_MFUNC "\\mfunc"
+#define LO_STRING_SVTOOLS_RTF_MGROUPCHR "\\mgroupChr"
+#define LO_STRING_SVTOOLS_RTF_MGROUPCHRPR "\\mgroupChrPr"
+#define LO_STRING_SVTOOLS_RTF_MHIDEBOT "\\mhideBot"
+#define LO_STRING_SVTOOLS_RTF_MHIDELEFT "\\mhideLeft"
+#define LO_STRING_SVTOOLS_RTF_MHIDERIGHT "\\mhideRight"
+#define LO_STRING_SVTOOLS_RTF_MHIDETOP "\\mhideTop"
+#define LO_STRING_SVTOOLS_RTF_MLIMLOW "\\mlimLow"
+#define LO_STRING_SVTOOLS_RTF_MLIM "\\mlim"
+#define LO_STRING_SVTOOLS_RTF_MLIMUPP "\\mlimUpp"
+#define LO_STRING_SVTOOLS_RTF_MM "\\mm"
+#define LO_STRING_SVTOOLS_RTF_MMR "\\mmr"
+#define LO_STRING_SVTOOLS_RTF_MNARY "\\mnary"
+#define LO_STRING_SVTOOLS_RTF_MNARYPR "\\mnaryPr"
+#define LO_STRING_SVTOOLS_RTF_MNUM "\\mnum"
+#define LO_STRING_SVTOOLS_RTF_MOMATH "\\moMath"
+#define LO_STRING_SVTOOLS_RTF_MPOS "\\mpos"
+#define LO_STRING_SVTOOLS_RTF_MRAD "\\mrad"
+#define LO_STRING_SVTOOLS_RTF_MRADPR "\\mradPr"
+#define LO_STRING_SVTOOLS_RTF_MR "\\mr"
+#define LO_STRING_SVTOOLS_RTF_MSEPCHR "\\msepChr"
+#define LO_STRING_SVTOOLS_RTF_MSPRE "\\msPre"
+#define LO_STRING_SVTOOLS_RTF_MSSUB "\\msSub"
+#define LO_STRING_SVTOOLS_RTF_MSSUBSUP "\\msSubSup"
+#define LO_STRING_SVTOOLS_RTF_MSSUP "\\msSup"
+#define LO_STRING_SVTOOLS_RTF_MSTRIKEH "\\mstrikeH"
+#define LO_STRING_SVTOOLS_RTF_MSUBHIDE "\\msubHide"
+#define LO_STRING_SVTOOLS_RTF_MSUB "\\msub"
+#define LO_STRING_SVTOOLS_RTF_MSUPHIDE "\\msupHide"
+#define LO_STRING_SVTOOLS_RTF_MSUP "\\msup"
+#define LO_STRING_SVTOOLS_RTF_MTYPE "\\mtype"
+#define LO_STRING_SVTOOLS_RTF_MVERTJC "\\mvertJc"
+#define LO_STRING_SVTOOLS_RTF_MMATH "\\mmath"
+#define LO_STRING_SVTOOLS_RTF_MMATHPICT "\\mmathPict"
+#define LO_STRING_SVTOOLS_RTF_MNOR "\\mnor"
+#define LO_STRING_SVTOOLS_RTF_LISTPICTURE "\\listpicture"
+#define LO_STRING_SVTOOLS_RTF_LEVELPICTURE "\\levelpicture"
+#define LO_STRING_SVTOOLS_RTF_BRDRSH "\\brdrsh"
+#define LO_STRING_SVTOOLS_RTF_GENERATOR "\\generator"
+#define LO_STRING_SVTOOLS_RTF_VIEWBKSP "\\viewbksp"
+#define LO_STRING_SVTOOLS_RTF_SBAUTO "\\sbauto"
+#define LO_STRING_SVTOOLS_RTF_SAAUTO "\\saauto"
+#define LO_STRING_SVTOOLS_RTF_HTMAUTSP "\\htmautsp"
+#define LO_STRING_SVTOOLS_RTF_GUTTERPRL "\\gutterprl"
+#define LO_STRING_SVTOOLS_RTF_RTLGUTTER "\\rtlgutter"
+#define LO_STRING_SVTOOLS_RTF_LBR "\\lbr"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/rtfout.hxx b/include/svtools/rtfout.hxx
new file mode 100644
index 000000000..50b738836
--- /dev/null
+++ b/include/svtools/rtfout.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+
+#include <rtl/ustring.hxx>
+#include <rtl/textenc.h>
+
+class SvStream;
+
+namespace RTFOutFuncs {
+
+SVT_DLLPUBLIC SvStream& Out_String(
+ SvStream&, const OUString&,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252 );
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/rtftoken.h b/include/svtools/rtftoken.h
new file mode 100644
index 000000000..fb191c8ff
--- /dev/null
+++ b/include/svtools/rtftoken.h
@@ -0,0 +1,1267 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+
+namespace rtl {
+ class OUString;
+};
+
+// search the TokenID for the token
+int GetRTFToken( std::u16string_view rSearch );
+
+enum RTF_TOKEN_RANGES {
+ RTF_NOGROUP = 0x0100,
+ RTF_DOCFMT = 0x0200,
+ RTF_SECTFMT = 0x0300,
+ RTF_PARFMT = 0x0400,
+ RTF_TABSTOPDEF = 0x0500,
+ RTF_BRDRDEF = 0x0600,
+ RTF_CHRFMT = 0x0700,
+ RTF_SPECCHAR = 0x0800,
+ RTF_APOCTL = 0x0900,
+ RTF_SHADINGDEF = 0x0A00,
+ // free = 0x0B00,
+ RTF_DRAWOBJECTS = 0x0C00,
+ RTF_OBJECTS = 0x0D00,
+ RTF_NUMBULLETS = 0x0E00,
+
+ // !!! can be mixed in using the "or" operator (border/background) !!!!
+ RTF_TABLEDEF = 0x1000,
+
+ // !!! can be mixed in using the "or" operator (border/tab) !!!!
+ RTF_SWGDEFS = 0x4000
+};
+
+enum RTF_TOKEN_IDS {
+
+ RTF_TEXTTOKEN = RTF_NOGROUP,
+ RTF_SINGLECHAR,
+ RTF_UNKNOWNCONTROL,
+ RTF_UNKNOWNDATA,
+
+ RTF_RTF,
+ RTF_ANSITYPE,
+ RTF_MACTYPE,
+ RTF_PCTYPE,
+ RTF_PCATYPE,
+ RTF_NEXTTYPE,
+
+ RTF_STYLESHEET,
+ RTF_SBASEDON,
+ RTF_SNEXT,
+ RTF_SHIDDEN,
+ RTF_SAUTOUPD,
+
+ RTF_KEYCODE,
+ RTF_FNKEY,
+ RTF_ALTKEY,
+ RTF_SHIFTKEY,
+ RTF_CTRLKEY,
+
+ RTF_FONTTBL,
+ RTF_DEFF,
+ RTF_FNIL,
+ RTF_FROMAN,
+ RTF_FSWISS,
+ RTF_FMODERN,
+ RTF_FSCRIPT,
+ RTF_FDECOR,
+ RTF_FTECH,
+
+ RTF_COLORTBL,
+ RTF_RED,
+ RTF_GREEN,
+ RTF_BLUE,
+
+ RTF_INFO,
+ RTF_TITLE,
+ RTF_SUBJECT,
+ RTF_AUTHOR,
+ RTF_OPERATOR,
+ RTF_KEYWORDS,
+ RTF_COMMENT,
+ RTF_VERSION,
+ RTF_DOCCOMM,
+ RTF_VERN,
+ RTF_CREATIM,
+ RTF_REVTIM,
+ RTF_PRINTIM,
+ RTF_BUPTIM,
+ RTF_EDMINS,
+ RTF_NOFPAGES,
+ RTF_NOFWORDS,
+ RTF_NOFCHARS,
+ RTF_ID,
+ RTF_YR,
+ RTF_MO,
+ RTF_DY,
+ RTF_HR,
+ RTF_MIN,
+ RTF_USERPROPS,
+ RTF_CATEGORY,
+ RTF_COMPANY,
+ RTF_MANAGER,
+ RTF_PROPNAME,
+ RTF_LINKVAL,
+ RTF_NOFCHARSWS,
+ RTF_HLINKBASE,
+ RTF_STATICVAL,
+ RTF_PROPTYPE,
+
+ RTF_ANNOTATION,
+ RTF_ATNID,
+
+ RTF_FOOTNOTE,
+
+ RTF_XE,
+ RTF_BXE,
+ RTF_IXE,
+ RTF_RXE,
+ RTF_TXE,
+ RTF_YXE,
+
+ RTF_TC,
+ RTF_TCF,
+ RTF_TCL,
+
+ RTF_BKMKSTART,
+ RTF_BKMKEND,
+
+ RTF_PICT, // Bitmaps
+ RTF_PICW,
+ RTF_PICH,
+ RTF_WBMBITSPIXEL,
+ RTF_WBMPLANES,
+ RTF_WBMWIDTHBYTES,
+ RTF_PICWGOAL,
+ RTF_PICHGOAL,
+ RTF_BIN,
+ RTF_PICSCALEX,
+ RTF_PICSCALEY,
+ RTF_PICSCALED,
+ RTF_WBITMAP,
+ RTF_WMETAFILE,
+ RTF_MACPICT,
+ RTF_OSMETAFILE,
+ RTF_DIBITMAP,
+ RTF_PICCROPT,
+ RTF_PICCROPB,
+ RTF_PICCROPL,
+ RTF_PICCROPR,
+ RTF_PICDATA,
+ RTF_PICBMP,
+ RTF_PICBPP,
+ RTF_PICPROP,
+ RTF_SHPPICT,
+ RTF_EMFBLIP,
+ RTF_PNGBLIP,
+ RTF_JPEGBLIP,
+ RTF_NONSHPPICT,
+ RTF_BLIPTAG,
+ RTF_BLIPUID,
+ RTF_BLIPUPI,
+
+ RTF_FIELD, // Fields
+ RTF_FLDDIRTY,
+ RTF_FLDEDIT,
+ RTF_FLDLOCK,
+ RTF_FLDPRIV,
+ RTF_FLDINST,
+ RTF_FLDRSLT,
+ RTF_FLDTYPE,
+ RTF_TIME,
+ RTF_DATE,
+ RTF_WPEQN,
+
+ RTF_NOLINE,
+ RTF_REVISED,
+
+ RTF_BKMKCOLF,
+ RTF_BKMKCOLL,
+ RTF_PSOVER,
+ RTF_DOCTEMP,
+ RTF_DELETED,
+
+ RTF_FCHARSET,
+ RTF_FALT,
+ RTF_FPRQ,
+ RTF_PANOSE,
+ RTF_FNAME,
+ RTF_FBIAS,
+
+ RTF_ADDITIVE,
+ RTF_BKMKPUB,
+ RTF_CPG,
+ RTF_DATAFIELD,
+
+ RTF_FBIDI,
+ RTF_FID,
+ RTF_FILE,
+ RTF_FILETBL,
+ RTF_FNETWORK,
+ RTF_FONTEMB,
+ RTF_FONTFILE,
+ RTF_FOSNUM,
+ RTF_FRELATIVE,
+ RTF_FTNIL,
+ RTF_FTTRUETYPE,
+ RTF_FVALIDDOS,
+ RTF_FVALIDHPFS,
+ RTF_FVALIDMAC,
+ RTF_FVALIDNTFS,
+ RTF_LINKSELF,
+ RTF_PUBAUTO,
+ RTF_REVTBL,
+ RTF_RTLMARK,
+ RTF_SEC,
+ RTF_TCN,
+ RTF_XEF,
+
+ RTF_UD, // Unicode
+ RTF_UPR,
+ RTF_U,
+ RTF_UC,
+ RTF_ANSICPG,
+
+ RTF_FFEXITMCR, // Form Fields
+ RTF_FFENTRYMCR,
+ RTF_FFDEFTEXT,
+ RTF_FFFORMAT,
+ RTF_FFSTATTEXT,
+ RTF_FORMFIELD,
+ RTF_FFNAME,
+ RTF_FFHELPTEXT,
+ RTF_FFL,
+ RTF_FFOWNHELP,
+ RTF_FFOWNSTAT,
+ RTF_FFMAXLEN,
+ RTF_FFHASLISTBOX,
+ RTF_FFHPS,
+ RTF_FFPROT,
+ RTF_FFTYPE,
+ RTF_FFTYPETXT,
+ RTF_FFSIZE,
+ RTF_FFRECALC,
+ RTF_FFRES,
+ RTF_FFDEFRES,
+
+ RTF_HIGHLIGHT,
+
+/* */
+
+ RTF_DEFTAB = RTF_DOCFMT,
+ RTF_HYPHHOTZ,
+ RTF_LINESTART,
+ RTF_FRACWIDTH,
+ RTF_NEXTFILE,
+ RTF_TEMPLATE,
+ RTF_MAKEBACKUP,
+ RTF_DEFFORMAT,
+ RTF_DEFLANG,
+ RTF_FTNSEP,
+ RTF_FTNSEPC,
+ RTF_FTNCN,
+ RTF_ENDNOTES,
+ RTF_ENDDOC,
+ RTF_FTNTJ,
+ RTF_FTNBJ,
+ RTF_FTNSTART,
+ RTF_FTNRESTART,
+ RTF_PAPERW,
+ RTF_PAPERH,
+ RTF_MARGL,
+ RTF_MARGR,
+ RTF_MARGT,
+ RTF_MARGB,
+ RTF_FACINGP,
+ RTF_GUTTER,
+ RTF_MARGMIRROR,
+ RTF_LANDSCAPE,
+ RTF_PGNSTART,
+ RTF_WIDOWCTRL,
+ RTF_REVISIONS,
+ RTF_REVPROP,
+ RTF_REVBAR,
+
+ RTF_AENDDOC,
+ RTF_AENDNOTES,
+ RTF_AFTNBJ,
+ RTF_AFTNCN,
+ RTF_AFTNNALC,
+ RTF_AFTNNAR,
+ RTF_AFTNNAUC,
+ RTF_AFTNNCHI,
+ RTF_AFTNNRLC,
+ RTF_AFTNNRUC,
+ RTF_AFTNRESTART,
+ RTF_AFTNRSTCONT,
+ RTF_AFTNSEP,
+ RTF_AFTNSEPC,
+ RTF_AFTNSTART,
+ RTF_AFTNTJ,
+ RTF_ALLPROT,
+ RTF_ANNOTPROT,
+ RTF_ATNAUTHOR,
+ RTF_ATNICN,
+ RTF_ATNREF,
+ RTF_ATNTIME,
+ RTF_ATRFEND,
+ RTF_ATRFSTART,
+ RTF_BRKFRM,
+ RTF_CVMME,
+ RTF_FET,
+ RTF_FLDALT,
+ RTF_FORMDISP,
+ RTF_FORMPROT,
+ RTF_FORMSHADE,
+ RTF_FTNALT,
+ RTF_FTNNALC,
+ RTF_FTNNAR,
+ RTF_FTNNAUC,
+ RTF_FTNNCHI,
+ RTF_FTNNRLC,
+ RTF_FTNNRUC,
+ RTF_FTNRSTCONT,
+ RTF_FTNRSTPG,
+ RTF_HYPHAUTO,
+ RTF_HYPHCAPS,
+ RTF_HYPHCONSEC,
+ RTF_LINKSTYLES,
+ RTF_LTRDOC,
+ RTF_NOCOLBAL,
+ RTF_NOEXTRASPRL,
+ RTF_NOTABIND,
+ RTF_OTBLRUL,
+ RTF_PRCOLBL,
+ RTF_PRINTDATA,
+ RTF_PSZ,
+ RTF_REVPROT,
+ RTF_RTLDOC,
+ RTF_SPRSSPBF,
+ RTF_SPRSTSP,
+ RTF_SWPBDR,
+ RTF_TRANSMF,
+ RTF_WRAPTRSP,
+
+ RTF_PRIVATE,
+ RTF_NOULTRLSPC,
+ RTF_MSMCAP,
+ RTF_NOLEAD,
+ RTF_NOSPACEFORUL,
+ RTF_LYTEXCTTP,
+ RTF_LYTPRTMET,
+ RTF_DNTBLNSBDB,
+ RTF_FROMTEXT,
+ RTF_EXPSHRTN,
+ RTF_PGBRDRT,
+ RTF_SPRSBSP,
+ RTF_PGBRDRR,
+ RTF_PGBRDRSNAP,
+ RTF_BDBFHDR,
+ RTF_SUBFONTBYSIZE,
+ RTF_TRUNCATEFONTHEIGHT,
+ RTF_SPRSLNSP,
+ RTF_SPRSTSM,
+ RTF_PGBRDRL,
+ RTF_WPJST,
+ RTF_PGBRDRB,
+ RTF_WPSP,
+ RTF_NOXLATTOYEN,
+ RTF_OLDLINEWRAP,
+ RTF_PGBRDRFOOT,
+ RTF_PGBRDRHEAD,
+ RTF_DEFLANGFE,
+ RTF_DOCTYPE,
+ RTF_PGBRDROPT,
+ RTF_VIEWKIND,
+ RTF_VIEWSCALE,
+ RTF_WINDOWCAPTION,
+ RTF_BRDRART,
+ RTF_VIEWZK,
+ RTF_DOCVAR,
+
+ RTF_DGMARGIN,
+ RTF_AFTNNCHOSUNG,
+ RTF_AFTNNCNUM,
+ RTF_AFTNNDBAR,
+ RTF_AFTNNDBNUM,
+ RTF_AFTNNDBNUMD,
+ RTF_AFTNNDBNUMK,
+ RTF_AFTNNDBNUMT,
+ RTF_AFTNNGANADA,
+ RTF_AFTNNGBNUM,
+ RTF_AFTNNGBNUMD,
+ RTF_AFTNNGBNUMK,
+ RTF_AFTNNGBNUML,
+ RTF_AFTNNZODIAC,
+ RTF_AFTNNZODIACD,
+ RTF_AFTNNZODIACL,
+ RTF_FTNNCHOSUNG,
+ RTF_FTNNCNUM,
+ RTF_FTNNDBAR,
+ RTF_FTNNDBNUM,
+ RTF_FTNNDBNUMD,
+ RTF_FTNNDBNUMK,
+ RTF_FTNNDBNUMT,
+ RTF_FTNNGANADA,
+ RTF_FTNNGBNUM,
+ RTF_FTNNGBNUMD,
+ RTF_FTNNGBNUMK,
+ RTF_FTNNGBNUML,
+ RTF_FTNNZODIAC,
+ RTF_FTNNZODIACD,
+ RTF_FTNNZODIACL,
+
+ RTF_ADEFLANG,
+ RTF_ADEFF,
+
+/* */
+
+ RTF_SECTD = RTF_SECTFMT,
+ RTF_ENDNHERE,
+ RTF_BINFSXN,
+ RTF_BINSXN,
+ RTF_SBKNONE,
+ RTF_SBKCOL,
+ RTF_SBKPAGE,
+ RTF_SBKEVEN,
+ RTF_SBKODD,
+ RTF_COLS,
+ RTF_COLSX,
+ RTF_COLNO,
+ RTF_COLSR,
+ RTF_COLW,
+ RTF_LINEBETCOL,
+ RTF_LINEMOD,
+ RTF_LINEX,
+ RTF_LINESTARTS,
+ RTF_LINERESTART,
+ RTF_LINEPAGE,
+ RTF_LINECONT,
+ RTF_PGWSXN,
+ RTF_PGHSXN,
+ RTF_MARGLSXN,
+ RTF_MARGRSXN,
+ RTF_MARGTSXN,
+ RTF_MARGBSXN,
+ RTF_GUTTERSXN,
+ RTF_LNDSCPSXN,
+ RTF_FACPGSXN,
+ RTF_TITLEPG,
+ RTF_HEADERY,
+ RTF_FOOTERY,
+ RTF_PGNSTARTS,
+ RTF_PGNCONT,
+ RTF_PGNRESTART,
+ RTF_PGNX,
+ RTF_PGNY,
+ RTF_PGNDEC,
+ RTF_PGNUCRM,
+ RTF_PGNLCRM,
+ RTF_PGNUCLTR,
+ RTF_PGNLCLTR,
+ RTF_VERTALT,
+ RTF_VERTALB,
+ RTF_VERTALC,
+ RTF_VERTALJ,
+
+ RTF_FOOTER,
+ RTF_FOOTERL,
+ RTF_FOOTERR,
+ RTF_FOOTERF,
+ RTF_HEADER,
+ RTF_HEADERL,
+ RTF_HEADERR,
+ RTF_HEADERF,
+ RTF_DS,
+ RTF_LTRSECT,
+ RTF_PGNHN,
+ RTF_PGNHNSC,
+ RTF_PGNHNSH,
+ RTF_PGNHNSM,
+ RTF_PGNHNSN,
+ RTF_PGNHNSP,
+ RTF_RTLSECT,
+ RTF_SECTUNLOCKED,
+ RTF_STEXTFLOW,
+ RTF_PGNCHOSUNG,
+ RTF_PGNCNUM,
+ RTF_PGNDBNUMK,
+ RTF_PGNDBNUMT,
+ RTF_PGNGANADA,
+ RTF_PGNGBNUM,
+ RTF_PGNGBNUMD,
+ RTF_PGNGBNUMK,
+ RTF_PGNGBNUML,
+ RTF_PGNZODIAC,
+ RTF_PGNZODIACD,
+ RTF_PGNZODIACL,
+ RTF_SECTDEFAULTCL,
+ RTF_SECTEXPAND,
+ RTF_SECTLINEGRID,
+ RTF_SECTSPECIFYCL,
+ RTF_SECTSPECIFYL,
+
+ // Swg header/footer tokens
+ RTF_HEADER_YB = (RTF_SECTFMT|RTF_SWGDEFS),
+ RTF_HEADER_XL,
+ RTF_HEADER_XR,
+ RTF_FOOTER_YT,
+ RTF_FOOTER_XL,
+ RTF_FOOTER_XR,
+ RTF_HEADER_YH,
+ RTF_FOOTER_YH,
+ RTF_BALANCED_COLUMN,
+
+
+/* */
+
+ RTF_PARD = RTF_PARFMT,
+ RTF_S,
+ RTF_INTBL,
+ RTF_KEEP,
+ RTF_KEEPN,
+ RTF_LEVEL,
+ RTF_PAGEBB,
+ RTF_SBYS,
+ RTF_QL,
+ RTF_QR,
+ RTF_QJ,
+ RTF_QC,
+ RTF_FI,
+ RTF_LI,
+ RTF_LIN,
+ RTF_RI,
+ RTF_RIN,
+ RTF_SB,
+ RTF_SA,
+ RTF_SL,
+ RTF_HYPHPAR,
+ RTF_LTRPAR,
+ RTF_NOWIDCTLPAR,
+ RTF_RTLPAR,
+ RTF_SLMULT,
+ RTF_SUBDOCUMENT,
+
+ RTF_WIDCTLPAR,
+
+ RTF_LISTTEXT,
+ RTF_POSYIN,
+ RTF_PNRNOT,
+ RTF_BRDRDASHDOTSTR,
+ RTF_POSYOUT,
+ RTF_BRDRDASHD,
+ RTF_BRDRDASHDD,
+ RTF_BRDRENGRAVE,
+ RTF_BRDRTHTNLG,
+ RTF_BRDREMBOSS,
+ RTF_BRDRTNTHTNLG,
+ RTF_BRDRDASHSM,
+ RTF_BRDRTHTNMG,
+ RTF_OVERLAY,
+ RTF_BRDRTNTHSG,
+ RTF_BRDRTNTHMG,
+ RTF_BRDRTHTNSG,
+ RTF_BRDRTNTHLG,
+ RTF_BRDRTRIPLE,
+ RTF_BRDRTNTHTNSG,
+ RTF_BRDRTNTHTNMG,
+ RTF_BRDRWAVYDB,
+ RTF_BRDRWAVY,
+ RTF_ILVL,
+ RTF_DFRSTOP,
+ RTF_DFRXST,
+ RTF_PNRAUTH,
+ RTF_DFRSTART,
+ RTF_OUTLINELEVEL,
+ RTF_DFRAUTH,
+ RTF_DFRDATE,
+ RTF_PNRRGB,
+ RTF_PNRPNBR,
+ RTF_PNRSTART,
+ RTF_PNRXST,
+ RTF_PNRSTOP,
+ RTF_PNRDATE,
+ RTF_PNRNFC,
+ RTF_NOSNAPLINEGRID,
+ RTF_FAAUTO,
+ RTF_FAHANG,
+ RTF_FAVAR,
+ RTF_FACENTER,
+ RTF_FAROMAN,
+ RTF_FAFIXED,
+ RTF_ADJUSTRIGHT,
+ RTF_LS,
+ RTF_NOCWRAP,
+ RTF_NOOVERFLOW,
+ RTF_ASPALPHA,
+
+
+/* */
+
+ RTF_TX = RTF_TABSTOPDEF,
+ RTF_TB,
+ RTF_TQL,
+ RTF_TQR,
+ RTF_TQC,
+ RTF_TQDEC,
+ RTF_TLDOT,
+ RTF_TLHYPH,
+ RTF_TLUL,
+ RTF_TLTH,
+ RTF_TLEQ,
+
+ // Swg TabStop tokens
+ RTF_TLSWG = (RTF_TABSTOPDEF|RTF_SWGDEFS),
+
+/* */
+
+ RTF_BRDRT = RTF_BRDRDEF,
+ RTF_BRDRB,
+ RTF_BRDRL,
+ RTF_BRDRR,
+ RTF_BRDRBTW,
+ RTF_BRDRBAR,
+ RTF_BOX,
+ RTF_BRSP,
+ RTF_BRDRW,
+ RTF_BRDRCF,
+ RTF_BRDRS,
+ RTF_BRDRTH,
+ RTF_BRDRSH,
+ RTF_BRDRDB,
+ RTF_BRDRDOT,
+ RTF_BRDRHAIR,
+ RTF_BRDRDASH,
+ RTF_BRDRINSET,
+ RTF_BRDROUTSET,
+ RTF_BRDRFRAME,
+
+ // Swg border tokens
+ RTF_BRDBOX = (RTF_BRDRDEF|RTF_SWGDEFS),
+ RTF_BRDLINE_COL,
+ RTF_BRDLINE_IN,
+ RTF_BRDLINE_OUT,
+ RTF_BRDLINE_DIST,
+
+/* */
+
+ RTF_PLAIN = RTF_CHRFMT,
+ RTF_B,
+ RTF_CAPS,
+ RTF_DN,
+ RTF_SUB,
+ RTF_NOSUPERSUB,
+ RTF_EXPND,
+ RTF_EXPNDTW,
+ RTF_KERNING,
+ RTF_F,
+ RTF_FS,
+ RTF_I,
+ RTF_OUTL,
+ RTF_SCAPS,
+ RTF_SHAD,
+ RTF_STRIKE,
+ RTF_UL,
+ RTF_ULD,
+ RTF_ULDB,
+ RTF_ULNONE,
+ RTF_ULW,
+ RTF_OL,
+ RTF_OLD,
+ RTF_OLDB,
+ RTF_OLNONE,
+ RTF_OLW,
+ RTF_UP,
+ RTF_SUPER,
+ RTF_V,
+ RTF_CF,
+ RTF_CB,
+ RTF_LANG,
+ RTF_CCHS,
+ RTF_CS,
+ RTF_LTRCH,
+ RTF_REVAUTH,
+ RTF_REVDTTM,
+ RTF_RTLCH,
+
+ RTF_CHBGFDIAG,
+ RTF_CHBGDKVERT,
+ RTF_CHBGDKHORIZ,
+ RTF_CHBRDR,
+ RTF_CHBGVERT,
+ RTF_CHBGHORIZ,
+ RTF_CHBGDKFDIAG,
+ RTF_CHBGDCROSS,
+ RTF_CHBGCROSS,
+ RTF_CHBGBDIAG,
+ RTF_CHBGDKDCROSS,
+ RTF_CHBGDKCROSS,
+ RTF_CHBGDKBDIAG,
+ RTF_ULDASHD,
+ RTF_ULDASH,
+ RTF_ULDASHDD,
+ RTF_ULWAVE,
+ RTF_ULC,
+ RTF_ULTH,
+ RTF_OLDASHD,
+ RTF_OLDASH,
+ RTF_OLDASHDD,
+ RTF_OLWAVE,
+ RTF_OLC,
+ RTF_OLTH,
+ RTF_EMBO,
+ RTF_IMPR,
+ RTF_STRIKED,
+ RTF_CRDATE,
+ RTF_CRAUTH,
+ RTF_CHARSCALEX,
+ RTF_CHCBPAT,
+ RTF_CHCFPAT,
+ RTF_CHSHDNG,
+ RTF_REVAUTHDEL,
+ RTF_REVDTTMDEL,
+ RTF_CGRID,
+ RTF_GCW,
+ RTF_NOSECTEXPAND,
+ RTF_GRIDTBL,
+ RTF_G,
+ RTF_ANIMTEXT,
+ RTF_ULTHD,
+ RTF_ULTHDASH,
+ RTF_ULLDASH,
+ RTF_ULTHLDASH,
+ RTF_ULTHDASHD,
+ RTF_ULTHDASHDD,
+ RTF_ULHWAVE,
+ RTF_ULULDBWAVE,
+ RTF_OLTHD,
+ RTF_OLTHDASH,
+ RTF_OLLDASH,
+ RTF_OLTHLDASH,
+ RTF_OLTHDASHD,
+ RTF_OLTHDASHDD,
+ RTF_OLHWAVE,
+ RTF_OLOLDBWAVE,
+
+ // association control words
+ RTF_AB,
+ RTF_ACAPS,
+ RTF_ACF,
+ RTF_ADN,
+ RTF_AEXPND,
+ RTF_AF,
+ RTF_AFS,
+ RTF_AI,
+ RTF_ALANG,
+ RTF_AOUTL,
+ RTF_ASCAPS,
+ RTF_ASHAD,
+ RTF_ASTRIKE,
+ RTF_AUL,
+ RTF_AULD,
+ RTF_AULDB,
+ RTF_AULNONE,
+ RTF_AULW,
+ RTF_AUP,
+
+ RTF_LOCH,
+ RTF_HICH,
+ RTF_DBCH,
+ RTF_LANGFE,
+ RTF_ACCNONE,
+ RTF_ACCDOT,
+ RTF_ACCCOMMA,
+ RTF_TWOINONE,
+ RTF_HORZVERT,
+
+ // Swg border tokens
+ RTF_SWG_ESCPROP = (RTF_CHRFMT|RTF_SWGDEFS),
+ RTF_HYPHEN,
+ RTF_HYPHLEAD,
+ RTF_HYPHTRAIL,
+ RTF_HYPHMAX,
+
+
+/* */
+
+ RTF_CHDATE = RTF_SPECCHAR,
+ RTF_CHDATEL,
+ RTF_CHDATEA,
+ RTF_CHTIME,
+ RTF_CHPGN,
+ RTF_CHFTN,
+ RTF_CHATN,
+ RTF_CHFTNSEP,
+ RTF_CHFTNSEPC,
+ RTF_CELL,
+ RTF_ROW,
+ RTF_PAR,
+ RTF_SECT,
+ RTF_PAGE,
+ RTF_COLUM,
+ RTF_LINE,
+ RTF_TAB,
+ RTF_EMDASH,
+ RTF_ENDASH,
+ RTF_BULLET,
+ RTF_LQUOTE,
+ RTF_RQUOTE,
+ RTF_LDBLQUOTE,
+ RTF_RDBLQUOTE,
+ RTF_FORMULA,
+ RTF_NONBREAKINGSPACE,
+ RTF_OPTIONALHYPHEN,
+ RTF_NONBREAKINGHYPHEN,
+ RTF_SUBENTRYINDEX,
+ RTF_IGNOREFLAG,
+ RTF_HEX,
+ RTF_EMSPACE,
+ RTF_ENSPACE,
+ RTF_LTRMARK,
+ RTF_SECTNUM,
+ RTF_SOFTCOL,
+ RTF_SOFTLHEIGHT,
+ RTF_SOFTLINE,
+ RTF_SOFTPAGE,
+ RTF_ZWJ,
+ RTF_ZWNJ,
+
+/* */
+
+ RTF_ABSW = RTF_APOCTL,
+ RTF_ABSH,
+ RTF_NOWRAP,
+ RTF_DXFRTEXT,
+ RTF_DFRMTXTX,
+ RTF_DFRMTXTY,
+ RTF_DROPCAPLI,
+ RTF_DROPCAPT,
+ RTF_ABSNOOVRLP,
+ RTF_PHMRG,
+ RTF_PHPG,
+ RTF_PHCOL,
+ RTF_POSX,
+ RTF_POSNEGX,
+ RTF_POSXC,
+ RTF_POSXI,
+ RTF_POSXO,
+ RTF_POSXL,
+ RTF_POSXR,
+ RTF_PVMRG,
+ RTF_PVPG,
+ RTF_PVPARA,
+ RTF_POSY,
+ RTF_POSNEGY,
+ RTF_POSYT,
+ RTF_POSYIL,
+ RTF_POSYB,
+ RTF_POSYC,
+ RTF_ABSLOCK,
+ RTF_FRMTXLRTB,
+ RTF_FRMTXTBRL,
+ RTF_FRMTXBTLR,
+ RTF_FRMTXLRTBV,
+ RTF_FRMTXTBRLV,
+
+ // Swg frame tokens
+ RTF_FLYPRINT = (RTF_APOCTL|RTF_SWGDEFS),
+ RTF_FLYOPAQUE,
+ RTF_FLYPRTCTD,
+ RTF_FLYMAINCNT,
+ RTF_FLYVERT,
+ RTF_FLYHORZ,
+ RTF_FLYOUTLEFT,
+ RTF_FLYOUTRIGHT,
+ RTF_FLYOUTUPPER,
+ RTF_FLYOUTLOWER,
+ RTF_FLYANCHOR,
+ RTF_FLY_CNTNT,
+ RTF_FLY_COLUMN,
+ RTF_FLY_PAGE,
+ RTF_FLY_INPARA,
+
+
+/* */
+
+ RTF_SHADING = RTF_SHADINGDEF,
+ RTF_CFPAT,
+ RTF_CBPAT,
+ RTF_BGHORIZ,
+ RTF_BGVERT,
+ RTF_BGFDIAG,
+ RTF_BGBDIAG,
+ RTF_BGCROSS,
+ RTF_BGDCROSS,
+ RTF_BGDKHORIZ,
+ RTF_BGDKVERT,
+ RTF_BGDKFDIAG,
+ RTF_BGDKBDIAG,
+ RTF_BGDKCROSS,
+ RTF_BGDKDCROSS,
+
+/* */
+
+ RTF_TROWD = RTF_TABLEDEF,
+ RTF_TRGAPH,
+ RTF_TRLEFT,
+ RTF_TRRH,
+
+ RTF_TRQL,
+ RTF_TRQR,
+ RTF_TRQC,
+
+ RTF_CLMGF,
+ RTF_CLMRG,
+ RTF_CELLX,
+ RTF_LTRROW,
+ RTF_RTLROW,
+ RTF_TRBRDRB,
+ RTF_TRBRDRH,
+ RTF_TRBRDRL,
+ RTF_TRBRDRR,
+ RTF_TRBRDRT,
+ RTF_TRBRDRV,
+ RTF_TRHDR,
+ RTF_TRKEEP,
+ RTF_TRPADDB,
+ RTF_TRPADDL,
+ RTF_TRPADDR,
+ RTF_TRPADDT,
+ RTF_TRPADDFB,
+ RTF_TRPADDFL,
+ RTF_TRPADDFR,
+ RTF_TRPADDFT,
+ RTF_TCELLD,
+ RTF_CLTXTBRL,
+ RTF_CLTXLRTB,
+ RTF_CLVERTALB,
+ RTF_CLVERTALT,
+ RTF_CLVERTALC,
+ RTF_CLVMGF,
+ RTF_CLVMRG,
+ RTF_CLTXTBRLV,
+ RTF_CLTXBTLR,
+ RTF_CLTXLRTBV,
+ RTF_CLPADL,
+ RTF_CLPADT,
+ RTF_CLPADB,
+ RTF_CLPADR,
+ RTF_CLPADFL,
+ RTF_CLPADFT,
+ RTF_CLPADFB,
+ RTF_CLPADFR,
+
+
+ RTF_CLBRDRT = (RTF_BRDRDEF|RTF_TABLEDEF),
+ RTF_CLBRDRL,
+ RTF_CLBRDRB,
+ RTF_CLBRDRR,
+
+ RTF_CLCFPAT = (RTF_SHADINGDEF|RTF_TABLEDEF),
+ RTF_CLCBPAT,
+ RTF_CLSHDNG,
+ RTF_CLBGHORIZ,
+ RTF_CLBGVERT,
+ RTF_CLBGFDIAG,
+ RTF_CLBGBDIAG,
+ RTF_CLBGCROSS,
+ RTF_CLBGDCROSS,
+ RTF_CLBGDKHOR,
+ RTF_CLBGDKVERT,
+ RTF_CLBGDKFDIAG,
+ RTF_CLBGDKBDIAG,
+ RTF_CLBGDKCROSS,
+ RTF_CLBGDKDCROSS,
+
+/* */
+
+
+/* */
+
+ RTF_DO = RTF_DRAWOBJECTS,
+ RTF_DOBXCOLUMN,
+ RTF_DOBXMARGIN,
+ RTF_DOBXPAGE,
+ RTF_DOBYMARGIN,
+ RTF_DOBYPAGE,
+ RTF_DOBYPARA,
+ RTF_DODHGT,
+ RTF_DOLOCK,
+ RTF_DPAENDHOL,
+ RTF_DPAENDL,
+ RTF_DPAENDSOL,
+ RTF_DPAENDW,
+ RTF_DPARC,
+ RTF_DPARCFLIPX,
+ RTF_DPARCFLIPY,
+ RTF_DPASTARTHOL,
+ RTF_DPASTARTL,
+ RTF_DPASTARTSOL,
+ RTF_DPASTARTW,
+ RTF_DPCALLOUT,
+ RTF_DPCOA,
+ RTF_DPCOACCENT,
+ RTF_DPCOBESTFIT,
+ RTF_DPCOBORDER,
+ RTF_DPCODABS,
+ RTF_DPCODBOTTOM,
+ RTF_DPCODCENTER,
+ RTF_DPCODTOP,
+ RTF_DPCOLENGTH,
+ RTF_DPCOMINUSX,
+ RTF_DPCOMINUSY,
+ RTF_DPCOOFFSET,
+ RTF_DPCOSMARTA,
+ RTF_DPCOTDOUBLE,
+ RTF_DPCOTRIGHT,
+ RTF_DPCOTSINGLE,
+ RTF_DPCOTTRIPLE,
+ RTF_DPCOUNT,
+ RTF_DPELLIPSE,
+ RTF_DPENDGROUP,
+ RTF_DPFILLBGCB,
+ RTF_DPFILLBGCG,
+ RTF_DPFILLBGCR,
+ RTF_DPFILLBGGRAY,
+ RTF_DPFILLBGPAL,
+ RTF_DPFILLFGCB,
+ RTF_DPFILLFGCG,
+ RTF_DPFILLFGCR,
+ RTF_DPFILLFGGRAY,
+ RTF_DPFILLFGPAL,
+ RTF_DPFILLPAT,
+ RTF_DPGROUP,
+ RTF_DPLINE,
+ RTF_DPLINECOB,
+ RTF_DPLINECOG,
+ RTF_DPLINECOR,
+ RTF_DPLINEDADO,
+ RTF_DPLINEDADODO,
+ RTF_DPLINEDASH,
+ RTF_DPLINEDOT,
+ RTF_DPLINEGRAY,
+ RTF_DPLINEHOLLOW,
+ RTF_DPLINEPAL,
+ RTF_DPLINESOLID,
+ RTF_DPLINEW,
+ RTF_DPPOLYCOUNT,
+ RTF_DPPOLYGON,
+ RTF_DPPOLYLINE,
+ RTF_DPPTX,
+ RTF_DPPTY,
+ RTF_DPRECT,
+ RTF_DPROUNDR,
+ RTF_DPSHADOW,
+ RTF_DPSHADX,
+ RTF_DPSHADY,
+ RTF_DPTXBX,
+ RTF_DPTXBXMAR,
+ RTF_DPTXBXTEXT,
+ RTF_DPX,
+ RTF_DPXSIZE,
+ RTF_DPY,
+ RTF_DPYSIZE,
+
+ RTF_DPCODESCENT,
+ RTF_BACKGROUND,
+ RTF_SHPBYPAGE,
+ RTF_SHPBYPARA,
+ RTF_SHPBYMARGIN,
+ RTF_SHPBXCOLUMN,
+ RTF_SHPBXMARGIN,
+ RTF_SHPBXPAGE,
+ RTF_SHPLOCKANCHOR,
+ RTF_SHPWR,
+ RTF_HLLOC,
+ RTF_HLSRC,
+ RTF_SHPWRK,
+ RTF_SHPTOP,
+ RTF_SHPRSLT,
+ RTF_HLFR,
+ RTF_SHPTXT,
+ RTF_SHPFHDR,
+ RTF_SHPGRP,
+ RTF_SHPINST,
+ RTF_SHPRIGHT,
+ RTF_SHPFBLWTXT,
+ RTF_SHPZ,
+ RTF_SHPBOTTOM,
+ RTF_SHPLEFT,
+ RTF_SHPLID,
+
+/* */
+
+ RTF_OBJALIAS = RTF_OBJECTS,
+ RTF_OBJALIGN,
+ RTF_OBJAUTLINK,
+ RTF_OBJCLASS,
+ RTF_OBJCROPB,
+ RTF_OBJCROPL,
+ RTF_OBJCROPR,
+ RTF_OBJCROPT,
+ RTF_OBJDATA,
+ RTF_OBJECT,
+ RTF_OBJEMB,
+ RTF_OBJH,
+ RTF_OBJICEMB,
+ RTF_OBJLINK,
+ RTF_OBJLOCK,
+ RTF_OBJNAME,
+ RTF_OBJPUB,
+ RTF_OBJSCALEX,
+ RTF_OBJSCALEY,
+ RTF_OBJSECT,
+ RTF_OBJSETSIZE,
+ RTF_OBJSUB,
+ RTF_OBJTIME,
+ RTF_OBJTRANSY,
+ RTF_OBJUPDATE,
+ RTF_OBJW,
+ RTF_RESULT,
+ RTF_RSLTBMP,
+ RTF_RSLTMERGE,
+ RTF_RSLTPICT,
+ RTF_RSLTRTF,
+ RTF_RSLTTXT,
+ RTF_OBJOCX,
+ RTF_OBJHTML,
+ RTF_OBJATTPH,
+
+/* */
+
+ RTF_PN = RTF_NUMBULLETS,
+ RTF_PNACROSS,
+ RTF_PNB,
+ RTF_PNCAPS,
+ RTF_PNCARD,
+ RTF_PNCF,
+ RTF_PNDEC,
+ RTF_PNF,
+ RTF_PNFS,
+ RTF_PNHANG,
+ RTF_PNI,
+ RTF_PNINDENT,
+ RTF_PNLCLTR,
+ RTF_PNLCRM,
+ RTF_PNLVL,
+ RTF_PNLVLBLT,
+ RTF_PNLVLBODY,
+ RTF_PNLVLCONT,
+ RTF_PNNUMONCE,
+ RTF_PNORD,
+ RTF_PNORDT,
+ RTF_PNPREV,
+ RTF_PNQC,
+ RTF_PNQL,
+ RTF_PNQR,
+ RTF_PNRESTART,
+ RTF_PNSCAPS,
+ RTF_PNSECLVL,
+ RTF_PNSP,
+ RTF_PNSTART,
+ RTF_PNSTRIKE,
+ RTF_PNTEXT,
+ RTF_PNTXTA,
+ RTF_PNTXTB,
+ RTF_PNUCLTR,
+ RTF_PNUCRM,
+ RTF_PNUL,
+ RTF_PNULD,
+ RTF_PNULDB,
+ RTF_PNULNONE,
+ RTF_PNULW,
+ RTF_LIST,
+ RTF_LISTLEVEL,
+ RTF_LISTOVERRIDE,
+ RTF_LISTOVERRIDETABLE,
+ RTF_LISTTABLE,
+ RTF_LISTNAME,
+ RTF_LEVELNUMBERS,
+ RTF_LEVELNORESTART,
+ RTF_LEVELNFC,
+ RTF_LEVELOLD,
+ RTF_LISTOVERRIDECOUNT,
+ RTF_LISTTEMPLATEID,
+ RTF_LEVELINDENT,
+ RTF_LEVELFOLLOW,
+ RTF_LEVELLEGAL,
+ RTF_LEVELJC,
+ RTF_LISTOVERRIDESTART,
+ RTF_LISTID,
+ RTF_LISTRESTARTHDN,
+ RTF_LEVELTEXT,
+ RTF_LISTOVERRIDEFORMAT,
+ RTF_LEVELPREVSPACE,
+ RTF_LEVELPREV,
+ RTF_LEVELSPACE,
+ RTF_LISTSIMPLE,
+ RTF_LEVELSTARTAT,
+ RTF_PNAIUEO,
+ RTF_PNAIUEOD,
+ RTF_PNCHOSUNG,
+ RTF_PNDBNUMD,
+ RTF_PNDBNUMK,
+ RTF_PNDBNUML,
+ RTF_PNDBNUMT,
+ RTF_PNGANADA,
+ RTF_PNGBNUM,
+ RTF_PNGBNUMD,
+ RTF_PNGBNUMK,
+ RTF_PNGBNUML,
+ RTF_PNZODIAC,
+ RTF_PNZODIACD,
+ RTF_PNZODIACL,
+ RTF_LFOLEVEL,
+
+/* */
+
+ RTF_GRF_ALIGNV= RTF_SWGDEFS,
+ RTF_GRF_ALIGNH,
+ RTF_GRF_MIRROR,
+ RTF_SWG_PRTDATA,
+ RTF_BKMK_KEY,
+ RTF_SHADOW,
+ RTF_SHDW_DIST,
+ RTF_SHDW_STYLE,
+ RTF_SHDW_COL,
+ RTF_SHDW_FCOL,
+ RTF_PGDSCTBL,
+ RTF_PGDSC,
+ RTF_PGDSCUSE,
+ RTF_PGDSCNXT,
+ RTF_PGDSCNO,
+ RTF_PGBRK,
+ RTF_SOUTLVL,
+
+// shapes
+ RTF_SHP, RTF_SN, RTF_SV, RTF_SP
+/*
+ RTF_SHPLEFT,
+ RTF_SHPTOP,
+ RTF_SHPBOTTOM,
+ RTF_SHPRIGHT
+*/
+
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx
new file mode 100644
index 000000000..8acc70aa1
--- /dev/null
+++ b/include/svtools/ruler.hxx
@@ -0,0 +1,799 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <map>
+#include <vector>
+#include <svtools/svtdllapi.h>
+#include <rtl/ref.hxx>
+#include <tools/fldunit.hxx>
+#include <tools/link.hxx>
+#include <tools/fract.hxx>
+#include <vcl/window.hxx>
+#include <vcl/glyphitem.hxx>
+
+class MouseEvent;
+class TrackingEvent;
+class DataChangedEvent;
+class SvtRulerAccessible;
+
+/*************************************************************************
+
+Description
+============
+
+class Ruler
+
+This class is used for displaying a ruler, but it can also be used
+for setting or moving tabs and margins.
+
+--------------------------------------------------------------------------
+
+WinBits
+
+WB_HORZ ruler is displayed horizontally
+WB_VERT ruler is displayed vertically
+WB_3DLOOK 3D look
+WB_BORDER border at the bottom/right margin
+WB_EXTRAFIELD Field in the upper left corner for
+ displaying and selecting tabs, origin of coordinates, ...
+WB_RIGHT_ALIGNED Marks the vertical ruler as right aligned
+
+--------------------------------------------------------------------------
+
+All ruler parameters are set in pixel units. This way double conversions
+and rounding errors are avoided and the ruler displays the margins
+at their actual position in the document. Because of this, the application can,
+for example in tables, do its own roundings and the positions on the ruler will
+still match those in the document. However, for the ruler to know how the
+document is displayed on the screen, some additional values have to be configured
+
+SetWinPos() sets the offset of the ruler's edit window. In doing so,
+the width of the window can also be configured. If there is a 0 among the
+values passed to the function, the position/width is automatically set to
+the width of the ruler.
+
+SetPagePos() sets the offset of the page relative to the edit window and the
+width of the page. If there is a 0 among the values passed to the function,
+the position/width is automatically set as if the page filled the whole edit window.
+
+SetBorderPos() sets the offset of the border. The position is relative to
+the upper/left margin of the window. This is needed when there are a horizontal
+and a vertical ruler visible at the same time. Example:
+ aHRuler.SetBorderPos( aVRuler.GetSizePixel().Width()-1 );
+
+SetNullOffset() sets the origin relative to the page.
+
+All the other values (margins, indentation, tabs, ...) refer to the origin,
+which is set with SetNullOffset().
+
+The values are computed as described below:
+
+- WinPos (if both windows have the same parent)
+
+ Point aHRulerPos = aHRuler.GetPosPixel();
+ Point aEditWinPos = aEditWin.GetPosPixel();
+ aHRuler.SetWinPos( aEditWinPos().X() - aHRulerPos.X() );
+
+- PagePos
+
+ Point aPagePos = aEditWin.LogicToPixel( aEditWin.GetPagePos() );
+ aHRuler.SetPagePos( aPagePos().X() );
+
+- All other values
+
+ Add the logical values, recompute as position and subtract the
+ previously saved pixel positions (of PagePos and Null Offset).
+
+--------------------------------------------------------------------------
+
+SetUnit() and SetZoom() configure which unit is used to display
+the values on the ruler. The following units are accepted:
+
+ FieldUnit::MM
+ FieldUnit::CM (Default)
+ FieldUnit::M
+ FieldUnit::KM
+ FieldUnit::INCH
+ FieldUnit::FOOT
+ FieldUnit::MILE
+ FieldUnit::POINT
+ FieldUnit::PICA
+
+--------------------------------------------------------------------------
+
+SetMargin1() sets the upper/left margin and SetMargin2() sets the
+bottom/right margin. If these methods are called without arguments,
+no margins are displayed. Otherwise, the following arguments can be passed:
+
+ long nPos - offset in pixels relative to the origin
+ sal_uInt16 nStyle - bit style:
+ RULER_MARGIN_SIZEABLE
+ margin size can be changed
+
+ The following bits can be set in addition
+ to these styles:
+ RULER_STYLE_INVISIBLE
+
+
+SetBorders() sets an array of margins. To do this, an array of type RulerBorder
+has to be passed. In the array, the following values have to be initialized:
+
+ long nPos - offset in pixels relative to the origin
+ long nWidth - column spacing in pixels (can also be 0, for example,
+ for table columns)
+ sal_uInt16 nStyle - bit style:
+ RulerBorderStyle::Sizeable
+ Column spacing can be changed. This flag should
+ only be set if the size of the spacing is changed,
+ not that of a cell.
+ RulerBorderStyle::Moveable
+ Column spacing/border can be moved. Whenever
+ table borders are to be moved, this flag should
+ be set instead of SIZEABLE (SIZEABLE indicates
+ that the size of a spacing, not that of a single
+ cell can be changed).
+ RulerBorderStyle::Variable
+ Not all of the column spacings are equal
+ RulerBorderStyle::Table
+ Table border. Whenever this style is set, the column
+ width must be 0.
+ RulerBorderStyle::Snap
+ Auxiliary line. Whenever this style is set, the
+ column width must be 0.
+ RulerBorderStyle::Margin
+ Margin. Whenever this style is set, the column
+ width must be 0.
+
+ The following bits can be set in addition
+ to these styles:
+ RULER_STYLE_INVISIBLE
+
+SetIndents() sets an array of indents. This method may only be used for horizontal
+rulers. A Ruler Indent must be passed as an argument, with the following values
+initialized:
+
+ long nPos - offset relative to the origin in pixels
+ sal_uInt16 nStyle - bit style:
+ RulerIndentStyle::Top (indent of the first line)
+ RulerIndentStyle::Bottom (left/right indent)
+ RulerIndentStyle::Border (Vertical line that shows the border distance)
+ The following bits can be set in addition
+ to these styles:
+ RULER_STYLE_DONTKNOW (for old position or for
+ ambiguity)
+ RULER_STYLE_INVISIBLE
+
+SetTabs() sets an array of tabs. This method may only be used for horizontal rulers.
+An array of type RulerTab must be passed as an argument, with the following values
+initialized:
+
+ long nPos - offset relative to the origin in pixels
+ sal_uInt16 nStyle - bit style:
+ RULER_TAB_DEFAULT (can't be selected)
+ RULER_TAB_LEFT
+ RULER_TAB_CENTER
+ RULER_TAB_RIGHT
+ RULER_TAB_DECIMAL
+ The following bits can be set in addition
+ to these styles:
+ RULER_STYLE_DONTKNOW (for old position of for
+ ambiguity)
+ RULER_STYLE_INVISIBLE
+
+SetLines() displays position lines in the ruler. An array of type RulerLine must be passed, with
+the following values initialized:
+
+ long nPos - offset relative to the origin in pixels
+ sal_uInt16 nStyle - bit style (has to be 0 currently)
+
+--------------------------------------------------------------------------
+
+If the user should also be able to change the margins tabs, borders, ...
+in the ruler, a bit more effort is necessary. In this case, the StartDrag(),
+Drag() and EndDrag() methods have to be overridden. For the StartDrag() method
+it is possible to prevent dragging by returning FALSE. In the drag handler,
+the drag position must be queried and the values must be moved to the new
+position. This is done by calling the particular Set methods. While in the
+drag handler, the values are just cached and only afterward the ruler is redrawn.
+All the handlers can also be set as links with the particular Set..Hdl() methods.
+
+ - StartDrag()
+ Is called when dragging is started. If FALSE is returned, the dragging.
+ won't be executed. If TRUE is returned, the dragging will be permitted.
+ If the handler isn't overridden, FALSE will be returned.
+
+ - EndDrag()
+ Is called at the end of dragging.
+
+ - Drag()
+ Is called when dragging takes place.
+
+ - Click()
+ This handler is called when no element has been clicked on.
+ The position can be queried with GetClickPos(). This way it is possible
+ to, for example, ser tabs in the ruler. After calling the click handler,
+ the drag, if any, is immediately triggered. This makes it possible to
+ set a new tab in the click handler and then immediately move it.
+
+ - DoubleClick()
+ This handler is called when a double-click has been performed outside
+ the special panel. The methods GetClickType(), GetClickAryPos() and
+ GetClickPos() can be used to query what has been clicked on.
+ This way you can, for example, show the tab dialog when a double-click
+ is performed on a tab.
+
+In the drag handler it is possible to query what has been dragged and where
+it has been dragged. There are the following query methods:
+
+ - GetDragType()
+ Returns what has been dragged.
+ RulerType::Margin1
+ RulerType::Margin2
+ RulerType::Border
+ RulerType::Indent
+ RulerType::Tab
+
+ - GetDragPos()
+ Returns the pixel position to which the user has moved the mouse
+ relative to the set zero-offset.
+
+ - GetDragAryPos()
+ Returns the index in the array if a border, an indent or a tab
+ is being dragged. Attention: During a drag process, the array position
+ of the item that has been set before the drag is returned.
+ Therefore, it is for example also possible, to no longer show a tab
+ if the mouse is dragged out of the ruler in bottom/right direction.
+
+ - GetDragSize()
+ If Borders are dragged, this can be used to query whether the size
+ resp. which side or the position should be changed.
+ RulerDragSize::Move or 0 - Move
+ RulerDragSize::N1 - left/upper border
+ RulerDragSize::N2 - right/bottom border
+
+ - IsDragDelete()
+ This method can be used to query whether the mouse has been
+ moved out of the window at the bottom/right while dragging.
+ By this, it can for example be determined whether the user
+ wants to delete a tab.
+
+ - IsDragCanceled()
+ Using this Handler, it can be queried in the EndDrag handler
+ whether the action was canceled by the user releasing the
+ mouse at the top/left of the window or by pressing ESC.
+ In this case, the values are not applied. If during the
+ dragging, the mouse is dragged out of the window at the
+ top/left, the old values are displayed automatically without
+ the Drag handler being called.
+ But if the user has moved the value to the old position, the
+ method returns 'false' nevertheless.
+ If this should be avoided, the application must remember the
+ old value in the StartDrag handler and compare the value in the
+ EndDrag handler.
+
+ - GetDragModifier()
+ Returns the modifier keys that were pressed when the Drag process
+ was started. See MouseEvent.
+
+ - GetClickPos()
+ Returns the pixel position at which the user has pressed the mouse
+ with respect to the configured null-offset.
+
+ - GetClickType()
+ Returns what is applied by double click:
+ RulerType::DontKnow (no element in the ruler area)
+ RulerType::Outside (outside of the ruler area)
+ RulerType::Margin1 (only Margin1 border)
+ RulerType::Margin2 (only Margin2 border)
+ RulerType::Border (Border: GetClickAryPos())
+ RulerType::Indent (indent: GetClickAryPos())
+ RulerType::Tab (Tab: GetClickAryPos())
+
+ - GetClickAryPos()
+ Returns the index in the array if a Border, an Indent or a Tab
+ is applied via DoubleClick.
+
+ - GetType()
+ This method can be used to carry out a HitTest,
+ in order to possibly also apply sth to an Item using the right
+ mouse button by catching the MouseButtonDown handler. As
+ parameters, the window position and possibly a pointer to a
+ sal_uInt16 are passed, in order to determine the array position
+ of a Tab, an Indent, or a Border. The following values are
+ returned as type:
+ RulerType::DontKnow (no element in the ruler area)
+ RulerType::Outside (outside of the ruler area)
+ RulerType::Margin1 (only Margin1 border)
+ RulerType::Margin2 (only Margin2 border)
+ RulerType::Border (Border: GetClickAryPos())
+ RulerType::Indent (indent: GetClickAryPos())
+ RulerType::Tab (Tab: GetClickAryPos())
+
+If the drag process should be canceled, this can be done using CancelDrag().
+There are the following methods for controlling the Drag:
+
+ - IsDrag()
+ Returns 'true' if the ruler is in a drag process.
+
+ - CancelDrag()
+ Cancels the drag process, if one is being carried out. During this,
+ the old values are restored and the Drag and the EndDrag handlers
+ are called.
+
+In order to trigger a Drag from the document, there are the following
+methods:
+
+ - StartDocDrag()
+ This method is passed the MouseEvent of the document window
+ and what should be dragged. If RulerType::DontKnow is passed
+ as DragType, the ruler decides what should be dragged. In case
+ of the other types, the Drag is only started if a respective
+ element was found at the given position.
+ This is for example necessary if indents and columns are located
+ at the same X position.
+ The return value indicates whether the Drag has been triggered.
+ If a Drag is triggered, the ruler takes over the normal drag
+ control and behaves as if the ruler had been clicked directly.
+ Thus, the ruler captures the mouse and also takes over control
+ of the Cancel (via keyboard, or if the mouse is moved outside
+ of the ruler above it or left of it). All handlers are called,
+ too (including the StartDrag handler). If a MouseEvent with
+ ClickCount 2 is passed, the DoubleClick handler is also called,
+ respectively.
+
+--------------------------------------------------------------------------
+
+For the extra field, the content can be determined and there are handlers
+that can be used to handle specific actions.
+
+ - ExtraDown()
+ This handler is called when the mouse is pressed in the extra field.
+
+ - SetExtraType()
+ With this method, it can be defined what should be displayed in
+ the extra field.
+ - ExtraType what should be displayed in the extra field
+ RulerExtra::DontKnow (nothing)
+ RulerExtra::NullOffset (coordinate axes)
+ RulerExtra::Tab (Tab)
+ - sal_uInt16 nStyle bit field as style:
+ RULER_STYLE_HIGHLIGHT (selected)
+ RULER_TAB_... (a Tab style)
+
+ - GetExtraClick()
+ Returns the number of mouse clicks. By this, it is for example
+ also possible to trigger an action by a DoubleClick in the
+ extra field.
+
+ - GetExtraModifier()
+ Returns the modifier keys that were pressed when the extra field
+ was clicked. See MouseEvent.
+
+--------------------------------------------------------------------------
+
+Further helper functions:
+
+- static Ruler::DrawTab()
+ With this method, a Tab can be output on an OutputDevice.
+ By this, it is also possible to show the Tabs in dialogs like
+ they are drawn in the ruler.
+
+ This method outputs the Tab centred at the given position. The size
+ of the tabs can be defined by the defines RULER_TAB_WIDTH and
+ RULER_TAB_HEIGHT.
+
+--------------------------------------------------------------------------
+
+Tips for the use of the ruler:
+
+- For the ruler, neither in the Drag mode nor elsewhere, the setting
+ of the values must be bracketed in SetUpdateMode(). The ruler itself
+ takes care that, if multiple values are set, they are automatically
+ grouped together and output flicker-free.
+
+- Initially, the sizes, positions and values should be set first for the
+ ruler, before it is displayed. This is important because otherwise
+ many values are calculated unnecessarily.
+
+- When the document window, in which the ruler resides, becomes active
+ resp. unactive, the methods Activate() and Deactivate() should be
+ called by the ruler. That is so because the display is switched according
+ to the settings and the system.
+
+- For example, while dragging Tabs and Indents, the old positions should
+ also be shown if possible. For that, while setting the Tabs and Indents,
+ the old positions should be inserted first into the array in addition
+ and be linked with the style RULER_STYLE_DONTKNOW. After that, the
+ remaining values should be set in the array.
+
+- In case of multiple selected paragraphs and table cells, the Tabs and
+ Indents should be displayed in grey in front of the first cell resp.
+ the first paragraph. This can also be achieved by the style
+ RULER_STYLE_DONTKNOW.
+
+- The measuring arrow should always be shown when the Alt key (WW-Like)
+ is pressed during the drag. Maybe, this setting should be configurable
+ always and possibly the measuring arrows always be shown while
+ dragging. For all settings, the values should always be rounded to the
+ multiple of one value because the screen resolution is very imprecise.
+
+- DoubleClicks should be handled in the following way (GetClickType()):
+ - RulerType::DontKnow
+ RulerType::Margin1
+ RulerType::Margin2
+ If the conditions GetClickPos() <= GetMargin1() or
+ GetClickPos() >= GetMargin2() are met or the type is equal to
+ RulerType::Margin1 or RulerType::Margin2, a side dialog should
+ be displayed in which the focus is at the respective border.
+ - RulerType::Border
+ A column or table dialog should be shown in which the focus
+ is at the respective column that can be queried using
+ GetClickAryPos().
+ - RulerType::Indent
+ The dialog, in which the indents can be configured, should be
+ shown. In this, the focus should be on the indent which can
+ be queried using GetClickAryPos().
+ - RulerType::Tab
+ A TabDialog should be displayed in which the Tab, that can be
+ queried using GetClickAryPos(), should be selected.
+
+*************************************************************************/
+
+
+constexpr WinBits WB_EXTRAFIELD = 0x00004000;
+constexpr WinBits WB_RIGHT_ALIGNED = 0x00008000;
+constexpr auto WB_STDRULER = WB_HORZ;
+
+
+enum class RulerType { DontKnow, Outside,
+ Margin1, Margin2,
+ Border, Indent, Tab };
+
+enum class RulerExtra { DontKnow, NullOffset, Tab };
+
+constexpr sal_uInt16 RULER_STYLE_HIGHLIGHT = 0x8000;
+constexpr sal_uInt16 RULER_STYLE_DONTKNOW = 0x4000;
+constexpr sal_uInt16 RULER_STYLE_INVISIBLE = 0x2000;
+
+enum class RulerDragSize {
+ Move,
+ N1,
+ N2
+};
+
+constexpr auto RULER_MOUSE_BORDERMOVE = 5;
+constexpr auto RULER_MOUSE_BORDERWIDTH = 5;
+constexpr auto RULER_MOUSE_MARGINWIDTH = 3;
+
+
+enum class RulerMarginStyle {
+ NONE = 0x0000,
+ Sizeable = 0x0001,
+ Invisible = 0x0002
+};
+namespace o3tl {
+ template<> struct typed_flags<RulerMarginStyle> : is_typed_flags<RulerMarginStyle, 0x0003> {};
+}
+
+
+enum class RulerBorderStyle {
+ Sizeable = 0x0001,
+ Moveable = 0x0002,
+ Variable = 0x0004,
+ Invisible = 0x0008
+};
+namespace o3tl {
+ template<> struct typed_flags<RulerBorderStyle> : is_typed_flags<RulerBorderStyle, 0x000f> {};
+}
+
+struct RulerBorder
+{
+ tools::Long nPos;
+ tools::Long nWidth;
+ RulerBorderStyle nStyle;
+ tools::Long nMinPos; //minimum/maximum position, supported for table borders/rows
+ tools::Long nMaxPos;
+};
+
+enum class RulerIndentStyle {
+ Top, Bottom
+};
+
+struct RulerIndent
+{
+ tools::Long nPos;
+ RulerIndentStyle nStyle;
+ bool bInvisible;
+};
+
+
+constexpr sal_uInt16 RULER_TAB_LEFT = 0x0000;
+constexpr sal_uInt16 RULER_TAB_RIGHT = 0x0001;
+constexpr sal_uInt16 RULER_TAB_CENTER = 0x0002;
+constexpr sal_uInt16 RULER_TAB_DECIMAL = 0x0003;
+constexpr sal_uInt16 RULER_TAB_DEFAULT = 0x0004;
+constexpr sal_uInt16 RULER_TAB_STYLE = 0x000F;
+constexpr sal_uInt16 RULER_TAB_RTL = 0x0010;
+
+struct RulerTab
+{
+ tools::Long nPos;
+ sal_uInt16 nStyle;
+};
+
+
+struct RulerLine
+{
+ tools::Long nPos;
+};
+
+
+struct RulerSelection
+{
+ tools::Long nPos;
+ RulerType eType;
+ sal_uInt16 nAryPos;
+ RulerDragSize mnDragSize;
+ bool bSize;
+ bool bSizeBar;
+ bool bExpandTest;
+
+ RulerSelection()
+ : nPos(0)
+ , eType(RulerType::DontKnow)
+ , nAryPos(0)
+ , mnDragSize(RulerDragSize::Move)
+ , bSize(false)
+ , bSizeBar(false)
+ , bExpandTest( false )
+ {}
+};
+
+
+struct RulerUnitData
+{
+ MapUnit eMapUnit; // MAP_UNIT for calculation
+ tools::Long nTickUnit; // Unit divider
+ double nTick1; // Minimal step
+ double nTick2; // Tick quarter unit
+ double nTick3; // Tick half unit
+ double nTick4; // Tick whole unit
+ char aUnitStr[8]; // Unit string
+};
+
+
+// Data for drawing ruler tabstops
+struct RulerTabData
+{
+ sal_uInt16 DPIScaleFactor;
+ sal_uInt16 width;
+ sal_uInt16 height;
+ sal_uInt16 height2;
+ sal_uInt16 width2;
+ sal_uInt16 cwidth;
+ sal_uInt16 cwidth2;
+ sal_uInt16 cwidth3;
+ sal_uInt16 cwidth4;
+ sal_uInt16 dheight;
+ sal_uInt16 dheight2;
+ sal_uInt16 dwidth;
+ sal_uInt16 dwidth2;
+ sal_uInt16 dwidth3;
+ sal_uInt16 dwidth4;
+ sal_uInt16 textoff;
+};
+
+
+class ImplRulerData;
+
+class SVT_DLLPUBLIC Ruler : public vcl::Window
+{
+private:
+ ScopedVclPtr<VirtualDevice> maVirDev;
+ MapMode maMapMode;
+ tools::Long mnBorderOff;
+ tools::Long mnWinOff;
+ tools::Long mnWinWidth;
+ tools::Long mnWidth;
+ tools::Long mnHeight;
+ tools::Long mnVirOff;
+ tools::Long mnVirWidth;
+ tools::Long mnVirHeight;
+ tools::Long mnBorderWidth;
+ tools::Long mnStartDragPos;
+ tools::Long mnDragPos;
+ std::unique_ptr<ImplRulerData> mpSaveData;
+ ImplRulerData* mpData;
+ std::unique_ptr<ImplRulerData> mpDragData;
+ tools::Rectangle maExtraRect;
+ WinBits mnWinStyle;
+ sal_uInt16 mnUnitIndex;
+ sal_uInt16 mnDragAryPos;
+ RulerDragSize mnDragSize;
+ sal_uInt16 mnDragModifier;
+ sal_uInt16 mnExtraStyle;
+ tools::Long mnCharWidth;
+ tools::Long mnLineHeight;
+
+ RulerExtra meExtraType;
+ RulerType meDragType;
+ FieldUnit meUnit;
+ Fraction maZoom;
+ bool mbCalc;
+ bool mbFormat;
+ bool mbDrag;
+ bool mbDragDelete;
+ bool mbDragCanceled;
+ bool mbAutoWinWidth;
+ bool mbActive;
+ sal_uInt8 mnUpdateFlags;
+
+ RulerSelection maHoverSelection;
+
+ Link<Ruler*,void> maDoubleClickHdl;
+
+ std::unique_ptr<RulerSelection> mxCurrentHitTest;
+ std::unique_ptr<RulerSelection> mxPreviousHitTest;
+
+ rtl::Reference<SvtRulerAccessible> mxAccContext;
+
+ std::map<OUString, SalLayoutGlyphs> maTextGlyphs;
+
+ SVT_DLLPRIVATE void ImplVDrawLine(vcl::RenderContext& rRenderContext, tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 );
+ SVT_DLLPRIVATE void ImplVDrawRect(vcl::RenderContext& rRenderContext, tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 );
+ SVT_DLLPRIVATE void ImplVDrawText(vcl::RenderContext& rRenderContext, tools::Long nX, tools::Long nY, const OUString& rText,
+ tools::Long nMin = LONG_MIN, tools::Long nMax = LONG_MAX );
+
+ SVT_DLLPRIVATE void ImplDrawTicks(vcl::RenderContext& rRenderContext,
+ tools::Long nMin, tools::Long nMax, tools::Long nStart, tools::Long nVirTop, tools::Long nVirBottom);
+ SVT_DLLPRIVATE void ImplDrawBorders(vcl::RenderContext& rRenderContext,
+ tools::Long nMin, tools::Long nMax, tools::Long nVirTop, tools::Long nVirBottom);
+ SVT_DLLPRIVATE static void ImplDrawIndent(vcl::RenderContext& rRenderContext,
+ const tools::Polygon& rPoly, bool bIsHit);
+ SVT_DLLPRIVATE void ImplDrawIndents(vcl::RenderContext& rRenderContext,
+ tools::Long nMin, tools::Long nMax, tools::Long nVirTop, tools::Long nVirBottom);
+ SVT_DLLPRIVATE void ImplDrawTab(vcl::RenderContext& rRenderContext, const Point& rPos, sal_uInt16 nStyle);
+ SVT_DLLPRIVATE void ImplDrawTabs(vcl::RenderContext& rRenderContext,
+ tools::Long nMin, tools::Long nMax, tools::Long nVirTop, tools::Long nVirBottom);
+
+ using Window::ImplInit;
+ SVT_DLLPRIVATE void ImplInit( WinBits nWinBits );
+ SVT_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
+ SVT_DLLPRIVATE void ImplCalc();
+ SVT_DLLPRIVATE void ImplFormat(vcl::RenderContext const & rRenderContext);
+ SVT_DLLPRIVATE void ImplInitExtraField( bool bUpdate );
+ SVT_DLLPRIVATE void ImplInvertLines(vcl::RenderContext& rRenderContext);
+ SVT_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext);
+ SVT_DLLPRIVATE void ImplDrawExtra(vcl::RenderContext& rRenderContext);
+ SVT_DLLPRIVATE void ImplUpdate( bool bMustCalc = false );
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+
+ SVT_DLLPRIVATE bool ImplDoHitTest( const Point& rPosition,
+ RulerSelection* pHitTest,
+ bool bRequiredStyle = false,
+ RulerIndentStyle nRequiredStyle = RulerIndentStyle::Top ) const;
+ SVT_DLLPRIVATE bool ImplDocHitTest( const Point& rPos, RulerType eDragType, RulerSelection* pHitTest ) const;
+ SVT_DLLPRIVATE bool ImplStartDrag( RulerSelection const * pHitTest, sal_uInt16 nModifier );
+ SVT_DLLPRIVATE void ImplDrag( const Point& rPos );
+ SVT_DLLPRIVATE void ImplEndDrag();
+
+ Ruler (const Ruler &) = delete;
+ Ruler& operator= (const Ruler &) = delete;
+
+protected:
+ tools::Long GetRulerVirHeight() const { return mnVirHeight;}
+ const MapMode& GetCurrentMapMode() const { return maMapMode; }
+ const RulerUnitData& GetCurrentRulerUnit() const;
+
+public:
+ Ruler( vcl::Window* pParent, WinBits nWinStyle = WB_STDRULER );
+ virtual ~Ruler() override;
+ virtual void dispose() override;
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void Resize() override;
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual bool StartDrag();
+ virtual void Drag();
+ virtual void EndDrag();
+ virtual void Click();
+ void DoubleClick();
+ virtual void ExtraDown();
+
+ void Activate() override;
+ void Deactivate() override;
+
+ void SetWinPos( tools::Long nOff, tools::Long nWidth = 0 );
+ tools::Long GetWinOffset() const { return mnWinOff; }
+ void SetPagePos( tools::Long nOff = 0, tools::Long nWidth = 0 );
+ tools::Long GetPageOffset() const;
+ void SetBorderPos( tools::Long nOff = 0 );
+ tools::Long GetBorderOffset() const { return mnBorderOff; }
+ const tools::Rectangle& GetExtraRect() const { return maExtraRect; }
+
+ void SetUnit( FieldUnit eNewUnit );
+ FieldUnit GetUnit() const { return meUnit; }
+ void SetZoom( const Fraction& rNewZoom );
+
+ void SetExtraType( RulerExtra eNewExtraType, sal_uInt16 nStyle = 0 );
+
+ bool StartDocDrag( const MouseEvent& rMEvt,
+ RulerType eDragType );
+ RulerType GetDragType() const { return meDragType; }
+ tools::Long GetDragPos() const { return mnDragPos; }
+ sal_uInt16 GetDragAryPos() const { return mnDragAryPos; }
+ RulerDragSize GetDragSize() const { return mnDragSize; }
+ bool IsDragDelete() const { return mbDragDelete; }
+ bool IsDragCanceled() const { return mbDragCanceled; }
+ sal_uInt16 GetDragModifier() const { return mnDragModifier; }
+ bool IsDrag() const { return mbDrag; }
+ void CancelDrag();
+ tools::Long GetClickPos() const { return mnDragPos; }
+ RulerType GetClickType() const { return meDragType; }
+
+ const RulerSelection& GetHoverSelection() const { return maHoverSelection; }
+
+ RulerType GetRulerType( const Point& rPos, sal_uInt16* pAryPos = nullptr );
+
+ void SetNullOffset( tools::Long nPos );
+ tools::Long GetNullOffset() const;
+ void SetMargin1() { SetMargin1( 0, RulerMarginStyle::Invisible ); }
+ void SetMargin1( tools::Long nPos, RulerMarginStyle nMarginStyle = RulerMarginStyle::Sizeable );
+ tools::Long GetMargin1() const;
+ void SetMargin2() { SetMargin2( 0, RulerMarginStyle::Invisible ); }
+ void SetMargin2( tools::Long nPos, RulerMarginStyle nMarginStyle = RulerMarginStyle::Sizeable );
+ tools::Long GetMargin2() const;
+
+ void SetLeftFrameMargin( tools::Long nPos );
+ void SetRightFrameMargin( tools::Long nPos );
+ void SetLines( sal_uInt32 n = 0, const RulerLine* pLineAry = nullptr );
+ void SetBorders( sal_uInt32 n = 0, const RulerBorder* pBrdAry = nullptr );
+ void SetIndents( sal_uInt32 n = 0, const RulerIndent* pIndentAry = nullptr );
+
+ void SetTabs( sal_uInt32 n = 0, const RulerTab* pTabAry = nullptr );
+ const std::vector<RulerTab>& GetTabs() const;
+
+ static void DrawTab(vcl::RenderContext& rRenderContext, const Color &rFillColor,
+ const Point& rPos, sal_uInt16 nStyle);
+
+ void SetStyle( WinBits nStyle );
+ WinBits GetStyle() const { return mnWinStyle; }
+
+ void SetDoubleClickHdl( const Link<Ruler*,void>& rLink ) { maDoubleClickHdl = rLink; }
+
+ void SetTextRTL(bool bRTL);
+ bool GetTextRTL() const;
+ void SetCharWidth( tools::Long nWidth ) { mnCharWidth = nWidth ; }
+ void SetLineHeight( tools::Long nHeight ) { mnLineHeight = nHeight ; }
+
+ void DrawTicks();
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/sampletext.hxx b/include/svtools/sampletext.hxx
new file mode 100644
index 000000000..d85391b5b
--- /dev/null
+++ b/include/svtools/sampletext.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <rtl/ustring.hxx>
+#include <unicode/uscript.h>
+#include <vcl/fontcapabilities.hxx>
+
+class OutputDevice;
+namespace vcl
+{
+class Font;
+}
+
+UScriptCode otCoverageToScript(vcl::UnicodeCoverage::UnicodeCoverageEnum eOTCoverage);
+
+bool isSymbolFont(const vcl::Font& rFont);
+
+bool canRenderNameOfSelectedFont(OutputDevice const& rDevice);
+
+//These ones are typically for use in the font dropdown box beside the
+//fontname, so say things roughly like "Script/Alphabet/Name-Of-Major-Language"
+OUString makeShortRepresentativeSymbolTextForSelectedFont(OutputDevice const& rDevice);
+OUString makeShortRepresentativeTextForSelectedFont(OutputDevice const& rDevice);
+OUString makeShortRepresentativeTextForScript(UScriptCode eScript);
+//For the cases where the font doesn't fully support a script, but has partial support
+//for a useful subset
+OUString makeShortMinimalTextForScript(UScriptCode eScript);
+
+//These ones are typically for use in the font preview window in format character
+SVT_DLLPUBLIC OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const vcl::Font& rFont);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/scriptedtext.hxx b/include/svtools/scriptedtext.hxx
new file mode 100644
index 000000000..553cd9ba6
--- /dev/null
+++ b/include/svtools/scriptedtext.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <rtl/ustring.hxx>
+#include <memory>
+
+
+namespace com :: sun :: star :: i18n { class XBreakIterator; }
+namespace com :: sun :: star :: uno { template <typename > class Reference; }
+
+class OutputDevice;
+namespace vcl { class Font; }
+class SvtScriptedTextHelper_Impl;
+class Size;
+class Point;
+
+
+/**
+This class provides drawing text with different script types on any output devices.
+*/
+class SVT_DLLPUBLIC SvtScriptedTextHelper final
+{
+private:
+ std::unique_ptr<SvtScriptedTextHelper_Impl> mpImpl; /// Implementation of class functionality.
+
+ SvtScriptedTextHelper& operator=( const SvtScriptedTextHelper& ) = delete;
+
+public:
+ /** Constructor sets an output device and no fonts.
+ @param _rOutDevice
+ A reference to an output device. */
+ SvtScriptedTextHelper( OutputDevice& _rOutDevice );
+
+ /** Copy constructor. */
+ SvtScriptedTextHelper(
+ const SvtScriptedTextHelper& _rCopy );
+
+ /** Destructor. */
+ ~SvtScriptedTextHelper();
+
+ /** Sets new fonts and recalculates the text width.
+ @param _pLatinFont
+ The font for latin characters.
+ @param _pAsianFont
+ The font for asian characters.
+ @param _pCmplxFont
+ The font for complex text layout. */
+ void SetFonts( vcl::Font const * _pLatinFont, vcl::Font const * _pAsianFont, vcl::Font const * _pCmplxFont );
+
+ /** Sets the default font of the current output device to all script types. */
+ void SetDefaultFont();
+
+ /** Sets a new text and calculates all script breaks and the text width.
+ @param _rText
+ The new text.
+ @param _xBreakIter
+ The break iterator for iterating through the script portions. */
+ void SetText(
+ const OUString& _rText,
+ const css::uno::Reference< css::i18n::XBreakIterator >& _xBreakIter );
+
+ /** Returns a size struct containing the width and height of the text in the current output device.
+ @return A size struct with the text dimensions. */
+ const Size& GetTextSize() const;
+
+ /** Draws the text in the current output device.
+ @param _rPos
+ The position of the top left edge of the text. */
+ void DrawText( const Point& _rPos );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/sfxecode.hxx b/include/svtools/sfxecode.hxx
new file mode 100644
index 000000000..fe6f26dc3
--- /dev/null
+++ b/include/svtools/sfxecode.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+class ErrCode;
+
+#define ERRCODE_SFX_NOTATEMPLATE ErrCode(ErrCodeArea::Sfx, ErrCodeClass::Format, 2)
+#define ERRCODE_SFX_GENERAL ErrCode(ErrCodeArea::Sfx, ErrCodeClass::General, 3)
+#define ERRCODE_SFX_DOLOADFAILED ErrCode(ErrCodeArea::Sfx, ErrCodeClass::Read, 4)
+#define ERRCODE_SFX_ALREADYOPEN ErrCode(ErrCodeArea::Sfx, ErrCodeClass::AlreadyExists, 10)
+#define ERRCODE_SFX_WRONGPASSWORD ErrCode(ErrCodeArea::Sfx, ErrCodeClass::Read, 11)
+#define ERRCODE_SFX_DOCUMENTREADONLY ErrCode(ErrCodeArea::Sfx, ErrCodeClass::Write, 12)
+#define ERRCODE_SFX_OLEGENERAL ErrCode(ErrCodeArea::Sfx, ErrCodeClass::NONE, 14)
+#define ERRCODE_SFX_TEMPLATENOTFOUND ErrCode(ErrCodeArea::Sfx, ErrCodeClass::NotExists, 15)
+
+#define ERRCODE_SFX_CANTCREATECONTENT ErrCode(ErrCodeArea::Sfx, ErrCodeClass::Create, 21)
+#define ERRCODE_SFX_INVALIDSYNTAX ErrCode(ErrCodeArea::Sfx, ErrCodeClass::Path, 36)
+#define ERRCODE_SFX_CANTGETPASSWD ErrCode(ErrCodeArea::Sfx, ErrCodeClass::Read, 42)
+#define ERRCODE_SFX_NOMOREDOCUMENTSALLOWED ErrCode(WarningFlag::Yes, ErrCodeArea::Sfx, ErrCodeClass::NONE, 44)
+#define ERRCODE_SFX_CANTCREATEBACKUP ErrCode(ErrCodeArea::Sfx, ErrCodeClass::Create, 50)
+#define ERRCODE_SFX_MACROS_SUPPORT_DISABLED ErrCode(WarningFlag::Yes, ErrCodeArea::Sfx, ErrCodeClass::NONE, 51)
+#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED ErrCode(WarningFlag::Yes, ErrCodeArea::Sfx, ErrCodeClass::NONE, 52)
+#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED_CONTENT_UNSIGNED ErrCode(WarningFlag::Yes, ErrCodeArea::Sfx, ErrCodeClass::NONE, 53)
+#define ERRCODE_SFX_SHARED_NOPASSWORDCHANGE ErrCode(WarningFlag::Yes, ErrCodeArea::Sfx, ErrCodeClass::NONE, 54)
+#define ERRCODE_SFX_INCOMPLETE_ENCRYPTION ErrCode(WarningFlag::Yes, ErrCodeArea::Sfx, ErrCodeClass::NONE, 55)
+#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED_MAC \
+ ErrCode(WarningFlag::Yes, ErrCodeArea::Sfx, ErrCodeClass::NONE, 56)
+#define ERRCODE_SFX_FORMAT_ROWCOL ErrCode(ErrCodeArea::Sfx, ErrCodeClass::NONE, 57)
+
+
+// Various
+#define ERRCTX_ERROR 21
+#define ERRCTX_WARNING 22
+
+// Document
+#define ERRCTX_SFX_LOADTEMPLATE 1
+#define ERRCTX_SFX_SAVEDOC 2
+#define ERRCTX_SFX_SAVEASDOC 3
+#define ERRCTX_SFX_DOCINFO 4
+#define ERRCTX_SFX_DOCTEMPLATE 5
+#define ERRCTX_SFX_MOVEORCOPYCONTENTS 6
+
+// Application
+#define ERRCTX_SFX_DOCMANAGER 50
+#define ERRCTX_SFX_OPENDOC 51
+#define ERRCTX_SFX_NEWDOCDIRECT 52
+#define ERRCTX_SFX_NEWDOC 53
+
+// Organizer
+#define ERRCTX_SFX_CREATEOBJSH 70
+
+// BASIC
+#define ERRCTX_SFX_LOADBASIC 80
+
+// Addressbook
+#define ERRCTX_SFX_SEARCHADDRESS 90
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/slidesorterbaropt.hxx b/include/svtools/slidesorterbaropt.hxx
new file mode 100644
index 000000000..9250838fa
--- /dev/null
+++ b/include/svtools/slidesorterbaropt.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <unotools/options.hxx>
+#include <memory>
+
+/** forward declaration to our private date container implementation
+
+ We use these class as internal member to support small memory requirements.
+ You can create the container if it is necessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*/
+class SvtSlideSorterBarOptions_Impl;
+
+/** collect information about sidebar group
+
+ \attention This class is partially threadsafe.
+*/
+class SVT_DLLPUBLIC SvtSlideSorterBarOptions final : public utl::detail::Options
+{
+ public:
+ SvtSlideSorterBarOptions();
+ virtual ~SvtSlideSorterBarOptions() override;
+
+ bool GetVisibleImpressView() const;
+ void SetVisibleImpressView( bool bVisible );
+ bool GetVisibleOutlineView() const;
+ void SetVisibleOutlineView( bool bVisible );
+ bool GetVisibleNotesView() const;
+ void SetVisibleNotesView( bool bVisible );
+ bool GetVisibleHandoutView() const;
+ void SetVisibleHandoutView( bool bVisible );
+ bool GetVisibleSlideSorterView() const;
+ void SetVisibleSlideSorterView( bool bVisible );
+ bool GetVisibleDrawView() const;
+ void SetVisibleDrawView( bool bVisible );
+
+
+ private:
+ std::shared_ptr<SvtSlideSorterBarOptions_Impl> m_pImpl;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/soerr.hxx b/include/svtools/soerr.hxx
new file mode 100644
index 000000000..de314db6d
--- /dev/null
+++ b/include/svtools/soerr.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/ehdl.hxx>
+#include <svtools/svtdllapi.h>
+
+// error codes
+#define SO_ERR(x) ErrCode(ErrCodeArea::So, ErrCodeClass::So, x)
+#define SO_WRN(x) ErrCode(WarningFlag::Yes, ErrCodeArea::So, ErrCodeClass::So, x)
+
+#define ERRCODE_SO_GENERALERROR SO_ERR(1)
+#define ERRCODE_SO_CANNOT_DOVERB_NOW SO_WRN(28)
+#define ERRCODE_SO_NOVERBS SO_ERR(30)
+#define ERRCODE_SO_NOTIMPL SO_ERR(33)
+
+// error contexts
+#define ERRCTX_SO_DOVERB 1
+
+SVT_DLLPUBLIC extern const ErrMsgCode RID_SO_ERROR_HANDLER[];
+SVT_DLLPUBLIC extern const ErrMsgCode RID_SO_ERRCTX[];
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/statusbarcontroller.hxx b/include/svtools/statusbarcontroller.hxx
new file mode 100644
index 000000000..fee4b2869
--- /dev/null
+++ b/include/svtools/statusbarcontroller.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <com/sun/star/frame/XStatusbarController.hpp>
+#include <cppuhelper/weak.hxx>
+#include <comphelper/multicontainer2.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <tools/gen.hxx>
+#include <unordered_map>
+
+namespace com :: sun :: star :: awt { class XWindow; }
+namespace com :: sun :: star :: beans { struct PropertyValue; }
+namespace com :: sun :: star :: frame { class XDispatch; }
+namespace com :: sun :: star :: frame { class XFrame; }
+namespace com :: sun :: star :: ui { class XStatusbarItem; }
+namespace com :: sun :: star :: uno { class XComponentContext; }
+namespace com :: sun :: star :: util { class XURLTransformer; }
+
+namespace svt
+{
+
+class SVT_DLLPUBLIC StatusbarController :
+ public css::frame::XStatusbarController,
+ public ::cppu::BaseMutex,
+ public ::cppu::OWeakObject
+{
+ public:
+ StatusbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XFrame >& xFrame,
+ const OUString& aCommandURL,
+ unsigned short nID );
+ StatusbarController();
+ virtual ~StatusbarController() override;
+
+ css::uno::Reference< css::frame::XFrame > getFrameInterface() const;
+ css::uno::Reference< css::util::XURLTransformer > getURLTransformer() const;
+
+ ::tools::Rectangle getControlRect() const;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
+ // XUpdatable
+ virtual void SAL_CALL update() override;
+
+ // XComponent
+ virtual void SAL_CALL dispose() override;
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
+
+ // XStatusbarController
+ virtual sal_Bool SAL_CALL mouseButtonDown( const css::awt::MouseEvent& aMouseEvent ) override;
+ virtual sal_Bool SAL_CALL mouseMove( const css::awt::MouseEvent& aMouseEvent ) override;
+ virtual sal_Bool SAL_CALL mouseButtonUp( const css::awt::MouseEvent& aMouseEvent ) override;
+ virtual void SAL_CALL command( const css::awt::Point& aPos,
+ ::sal_Int32 nCommand,
+ sal_Bool bMouseEvent,
+ const css::uno::Any& aData ) override;
+ virtual void SAL_CALL paint( const css::uno::Reference< css::awt::XGraphics >& xGraphics,
+ const css::awt::Rectangle& rOutputRectangle,
+ ::sal_Int32 nStyle ) override;
+ virtual void SAL_CALL click( const css::awt::Point& aPos ) override;
+ virtual void SAL_CALL doubleClick( const css::awt::Point& aPos ) override;
+
+ protected:
+ struct Listener
+ {
+ Listener( const css::util::URL& rURL, const css::uno::Reference< css::frame::XDispatch >& rDispatch ) :
+ aURL( rURL ), xDispatch( rDispatch ) {}
+
+ css::util::URL aURL;
+ css::uno::Reference< css::frame::XDispatch > xDispatch;
+ };
+
+ typedef std::unordered_map< OUString,
+ css::uno::Reference< css::frame::XDispatch > > URLToDispatchMap;
+
+ // methods to support status forwarder, known by the old sfx2 toolbox controller implementation
+ void addStatusListener( const OUString& aCommandURL );
+ void bindListener();
+
+ // execute methods
+ // execute bound status bar controller command/execute various commands
+ void execute( const css::uno::Sequence< css::beans::PropertyValue >& aArgs );
+ void execute( const OUString& aCommand, const css::uno::Sequence< css::beans::PropertyValue >& aArgs );
+
+ bool m_bInitialized : 1,
+ m_bDisposed : 1;
+ unsigned short m_nID;
+ css::uno::Reference< css::frame::XFrame > m_xFrame;
+ css::uno::Reference< css::awt::XWindow > m_xParentWindow;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ OUString m_aCommandURL;
+ URLToDispatchMap m_aListenerMap;
+ comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener
+ mutable css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer;
+ css::uno::Reference< css::ui::XStatusbarItem > m_xStatusbarItem;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/strings.hrc b/include/svtools/strings.hrc
new file mode 100644
index 000000000..d8bcaae7d
--- /dev/null
+++ b/include/svtools/strings.hrc
@@ -0,0 +1,344 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
+
+// To translators: tdf#125447 use no mnemonic in this string
+#define STR_UNDO NC_("STR_UNDO", "Undo: ")
+// To translators: tdf#125447 use no mnemonic in this string
+#define STR_REDO NC_("STR_REDO", "Redo: ")
+#define STR_REPEAT NC_("STR_REPEAT", "~Repeat: ")
+
+#define STR_FORMAT_STRING NC_("STR_FORMAT_STRING", "Unformatted text")
+#define STR_FORMAT_ID_STRING_TSVC NC_("STR_FORMAT_ID_STRING_TSVC", "Unformatted text (TSV-Calc)")
+#define STR_FORMAT_BITMAP NC_("STR_FORMAT_BITMAP", "Bitmap Image (BMP)")
+#define STR_FORMAT_GDIMETAFILE NC_("STR_FORMAT_GDIMETAFILE", "Graphics Device Interface metafile (GDI)")
+#define STR_FORMAT_RTF NC_("STR_FORMAT_RTF", "Rich text formatting (RTF)")
+#define STR_FORMAT_ID_RICHTEXT NC_("STR_FORMAT_ID_RICHTEXT", "Rich text formatting (Richtext)")
+#define STR_FORMAT_ID_DRAWING NC_("STR_FORMAT_ID_DRAWING", "%PRODUCTNAME drawing format")
+#define STR_FORMAT_ID_SVXB NC_("STR_FORMAT_ID_SVXB", "StarView bitmap/animation (SVXB)")
+#define STR_FORMAT_ID_INTERNALLINK_STATE NC_("STR_FORMAT_ID_INTERNALLINK_STATE", "Status Info from Svx Internal Link")
+#define STR_FORMAT_ID_SOLK NC_("STR_FORMAT_ID_SOLK", "%PRODUCTNAME Link (SOLK)")
+#define STR_FORMAT_ID_NETSCAPE_BOOKMARK NC_("STR_FORMAT_ID_NETSCAPE_BOOKMARK", "Netscape Bookmark")
+#define STR_FORMAT_ID_STARSERVER NC_("STR_FORMAT_ID_STARSERVER", "Star server format")
+#define STR_FORMAT_ID_STAROBJECT NC_("STR_FORMAT_ID_STAROBJECT", "Star object format")
+#define STR_FORMAT_ID_APPLETOBJECT NC_("STR_FORMAT_ID_APPLETOBJECT", "Applet object")
+#define STR_FORMAT_ID_PLUGIN_OBJECT NC_("STR_FORMAT_ID_PLUGIN_OBJECT", "Plug-in object")
+#define STR_FORMAT_ID_STARWRITER_30 NC_("STR_FORMAT_ID_STARWRITER_30", "StarWriter 3.0 object")
+#define STR_FORMAT_ID_STARWRITER_40 NC_("STR_FORMAT_ID_STARWRITER_40", "StarWriter 4.0 object")
+#define STR_FORMAT_ID_STARWRITER_50 NC_("STR_FORMAT_ID_STARWRITER_50", "StarWriter 5.0 object")
+#define STR_FORMAT_ID_STARWRITERWEB_40 NC_("STR_FORMAT_ID_STARWRITERWEB_40", "StarWriter/Web 4.0 object")
+#define STR_FORMAT_ID_STARWRITERWEB_50 NC_("STR_FORMAT_ID_STARWRITERWEB_50", "StarWriter/Web 5.0 object")
+#define STR_FORMAT_ID_STARWRITERGLOB_40 NC_("STR_FORMAT_ID_STARWRITERGLOB_40", "StarWriter/Master 4.0 object")
+#define STR_FORMAT_ID_STARWRITERGLOB_50 NC_("STR_FORMAT_ID_STARWRITERGLOB_50", "StarWriter/Master 5.0 object")
+#define STR_FORMAT_ID_STARDRAW NC_("STR_FORMAT_ID_STARDRAW", "StarDraw object")
+#define STR_FORMAT_ID_STARDRAW_40 NC_("STR_FORMAT_ID_STARDRAW_40", "StarDraw 4.0 object")
+#define STR_FORMAT_ID_STARIMPRESS_50 NC_("STR_FORMAT_ID_STARIMPRESS_50", "StarImpress 5.0 object")
+#define STR_FORMAT_ID_STARDRAW_50 NC_("STR_FORMAT_ID_STARDRAW_50", "StarDraw 5.0 object")
+#define STR_FORMAT_ID_STARCALC NC_("STR_FORMAT_ID_STARCALC", "StarCalc object")
+#define STR_FORMAT_ID_STARCALC_40 NC_("STR_FORMAT_ID_STARCALC_40", "StarCalc 4.0 object")
+#define STR_FORMAT_ID_STARCALC_50 NC_("STR_FORMAT_ID_STARCALC_50", "StarCalc 5.0 object")
+#define STR_FORMAT_ID_STARCHART NC_("STR_FORMAT_ID_STARCHART", "StarChart object")
+#define STR_FORMAT_ID_STARCHART_40 NC_("STR_FORMAT_ID_STARCHART_40", "StarChart 4.0 object")
+#define STR_FORMAT_ID_STARCHART_50 NC_("STR_FORMAT_ID_STARCHART_50", "StarChart 5.0 object")
+#define STR_FORMAT_ID_STARIMAGE NC_("STR_FORMAT_ID_STARIMAGE", "StarImage object")
+#define STR_FORMAT_ID_STARIMAGE_40 NC_("STR_FORMAT_ID_STARIMAGE_40", "StarImage 4.0 object")
+#define STR_FORMAT_ID_STARIMAGE_50 NC_("STR_FORMAT_ID_STARIMAGE_50", "StarImage 5.0 object")
+#define STR_FORMAT_ID_STARMATH NC_("STR_FORMAT_ID_STARMATH", "StarMath object")
+#define STR_FORMAT_ID_STARMATH_40 NC_("STR_FORMAT_ID_STARMATH_40", "StarMath 4.0 object")
+#define STR_FORMAT_ID_STARMATH_50 NC_("STR_FORMAT_ID_STARMATH_50", "StarMath 5.0 object")
+#define STR_FORMAT_ID_STAROBJECT_PAINTDOC NC_("STR_FORMAT_ID_STAROBJECT_PAINTDOC", "StarObject Paint object")
+#define STR_FORMAT_ID_HTML NC_("STR_FORMAT_ID_HTML", "HyperText Markup Language (HTML)")
+#define STR_FORMAT_ID_HTML_SIMPLE NC_("STR_FORMAT_ID_HTML_SIMPLE", "Stripped HyperText Markup Language (Simple HTML)")
+#define STR_FORMAT_ID_BIFF_5 NC_("STR_FORMAT_ID_BIFF_5", "Microsoft Excel Binary Interchange Format 5.0/95 (Biff5)")
+#define STR_FORMAT_ID_BIFF_8 NC_("STR_FORMAT_ID_BIFF_8", "Microsoft Excel Binary Interchange Format 97/2000/XP/2003 (Biff8)")
+#define STR_FORMAT_ID_SYLK NC_("STR_FORMAT_ID_SYLK", "Sylk")
+#define STR_FORMAT_ID_LINK NC_("STR_FORMAT_ID_LINK", "Dynamic Data Exchange (DDE link)" )
+#define STR_FORMAT_ID_DIF NC_("STR_FORMAT_ID_DIF", "Data Interchange Format (DIF)")
+#define STR_FORMAT_ID_MSWORD_DOC NC_("STR_FORMAT_ID_MSWORD_DOC", "Microsoft Word object")
+#define STR_FORMAT_ID_STAR_FRAMESET_DOC NC_("STR_FORMAT_ID_STAR_FRAMESET_DOC", "StarFrameSet object")
+#define STR_FORMAT_ID_OFFICE_DOC NC_("STR_FORMAT_ID_OFFICE_DOC", "Office document object")
+#define STR_FORMAT_ID_NOTES_DOCINFO NC_("STR_FORMAT_ID_NOTES_DOCINFO", "Notes document info")
+#define STR_FORMAT_ID_SFX_DOC NC_("STR_FORMAT_ID_SFX_DOC", "Sfx document")
+#define STR_FORMAT_ID_STARCHARTDOCUMENT_50 NC_("STR_FORMAT_ID_STARCHARTDOCUMENT_50", "StarChart 5.0 object")
+#define STR_FORMAT_ID_GRAPHOBJ NC_("STR_FORMAT_ID_GRAPHOBJ", "Graphic object")
+#define STR_FORMAT_ID_STARWRITER_60 NC_("STR_FORMAT_ID_STARWRITER_60", "OpenOffice.org 1.0 Writer object")
+#define STR_FORMAT_ID_STARWRITERWEB_60 NC_("STR_FORMAT_ID_STARWRITERWEB_60", "OpenOffice.org 1.0 Writer/Web object")
+#define STR_FORMAT_ID_STARWRITERGLOB_60 NC_("STR_FORMAT_ID_STARWRITERGLOB_60", "OpenOffice.org 1.0 Writer/Master object")
+#define STR_FORMAT_ID_STARDRAW_60 NC_("STR_FORMAT_ID_STARDRAW_60", "OpenOffice.org 1.0 Draw object")
+#define STR_FORMAT_ID_STARIMPRESS_60 NC_("STR_FORMAT_ID_STARIMPRESS_60", "OpenOffice.org 1.0 Impress object")
+#define STR_FORMAT_ID_STARCALC_60 NC_("STR_FORMAT_ID_STARCALC_60", "OpenOffice.org 1.0 Calc object")
+#define STR_FORMAT_ID_STARCHART_60 NC_("STR_FORMAT_ID_STARCHART_60", "OpenOffice.org 1.0 Chart object")
+#define STR_FORMAT_ID_STARMATH_60 NC_("STR_FORMAT_ID_STARMATH_60", "OpenOffice.org 1.0 Math object")
+#define STR_FORMAT_ID_WMF NC_("STR_FORMAT_ID_WMF", "Windows metafile")
+#define STR_FORMAT_ID_DBACCESS_QUERY NC_("STR_FORMAT_ID_DBACCESS_QUERY", "Data source object")
+#define STR_FORMAT_ID_DBACCESS_TABLE NC_("STR_FORMAT_ID_DBACCESS_TABLE", "Data source table")
+#define STR_FORMAT_ID_DBACCESS_COMMAND NC_("STR_FORMAT_ID_DBACCESS_COMMAND", "SQL query")
+#define STR_FORMAT_ID_DIALOG_60 NC_("STR_FORMAT_ID_DIALOG_60", "OpenOffice.org 1.0 dialog")
+#define STR_FORMAT_ID_FILEGRPDESCRIPTOR NC_("STR_FORMAT_ID_FILEGRPDESCRIPTOR", "Link")
+#define STR_FORMAT_ID_HTML_NO_COMMENT NC_("STR_FORMAT_ID_HTML_NO_COMMENT", "HTML format without comments")
+#define STR_FORMAT_ID_PNG_BITMAP NC_("STR_FORMAT_ID_PNG_BITMAP", "Portable Network Graphics (PNG)")
+
+#define STR_ERROR_OBJNOCREATE NC_("STR_ERROR_OBJNOCREATE", "Object % could not be inserted.")
+#define STR_ERROR_OBJNOCREATE_FROM_FILE NC_("STR_ERROR_OBJNOCREATE_FROM_FILE", "Object from file % could not be inserted.")
+#define STR_FURTHER_OBJECT NC_("STR_FURTHER_OBJECT", "Further objects")
+#define STR_UNKNOWN_SOURCE NC_("STR_UNKNOWN_SOURCE", "Unknown source")
+
+#define STR_SVT_BYTES NC_("STR_SVT_BYTES", "Bytes")
+#define STR_SVT_KB NC_("STR_SVT_KB", "kB")
+#define STR_SVT_MB NC_("STR_SVT_MB", "MB")
+#define STR_SVT_GB NC_("STR_SVT_GB", "GB")
+
+/*
+ * resources for CollatorResource / CollatorResourceData resp.
+ */
+/* alphanumeric sorting algorithm */
+#define STR_SVT_COLLATE_ALPHANUMERIC NC_("STR_SVT_COLLATE_ALPHANUMERIC", "Alphanumeric")
+/* default or normal sorting algorithm */
+#define STR_SVT_COLLATE_NORMAL NC_("STR_SVT_COLLATE_NORMAL", "Normal")
+/* default or normal sorting algorithm */
+#define STR_SVT_COLLATE_CHARSET NC_("STR_SVT_COLLATE_CHARSET", "Character set")
+/* german dictionary word order / sorting */
+#define STR_SVT_COLLATE_DICTIONARY NC_("STR_SVT_COLLATE_DICTIONARY", "Dictionary")
+/* chinese sorting algorithm */
+#define STR_SVT_COLLATE_PINYIN NC_("STR_SVT_COLLATE_PINYIN", "Pinyin")
+/* chinese sorting algorithm */
+#define STR_SVT_COLLATE_STROKE NC_("STR_SVT_COLLATE_STROKE", "Stroke")
+/* chinese sorting algorithm */
+#define STR_SVT_COLLATE_RADICAL NC_("STR_SVT_COLLATE_RADICAL", "Radical")
+/* sorting according to the unicode code point of the character */
+#define STR_SVT_COLLATE_UNICODE NC_("STR_SVT_COLLATE_UNICODE", "Unicode")
+/* chinese sorting algorithm */
+#define STR_SVT_COLLATE_ZHUYIN NC_("STR_SVT_COLLATE_ZHUYIN", "Zhuyin")
+/* phone book sorting algorithm. e.g. German */
+#define STR_SVT_COLLATE_PHONEBOOK NC_("STR_SVT_COLLATE_PHONEBOOK", "Phone book")
+#define STR_SVT_COLLATE_PHONETIC_F NC_("STR_SVT_COLLATE_PHONETIC_F", "Phonetic (alphanumeric first)")
+#define STR_SVT_COLLATE_PHONETIC_L NC_("STR_SVT_COLLATE_PHONETIC_L", "Phonetic (alphanumeric last)")
+/* alphanumeric indexentry algorithm */
+#define STR_SVT_INDEXENTRY_ALPHANUMERIC NC_("STR_SVT_INDEXENTRY_ALPHANUMERIC", "Alphanumeric")
+/* korean dictionary indexentry algorithm */
+#define STR_SVT_INDEXENTRY_DICTIONARY NC_("STR_SVT_INDEXENTRY_DICTIONARY", "Dictionary")
+/* chinese sorting algorithm */
+#define STR_SVT_INDEXENTRY_PINYIN NC_("STR_SVT_INDEXENTRY_PINYIN", "Pinyin")
+/* chinese indexentry algorithm */
+#define STR_SVT_INDEXENTRY_RADICAL NC_("STR_SVT_INDEXENTRY_RADICAL", "Radical")
+/* chinese indexentry algorithm */
+#define STR_SVT_INDEXENTRY_STROKE NC_("STR_SVT_INDEXENTRY_STROKE", "Stroke")
+/* chinese indexentry algorithm */
+#define STR_SVT_INDEXENTRY_ZHUYIN NC_("STR_SVT_INDEXENTRY_ZHUYIN", "Zhuyin")
+#define STR_SVT_INDEXENTRY_PHONETIC_FS NC_("STR_SVT_INDEXENTRY_PHONETIC_FS", "Phonetic (alphanumeric first, grouped by syllables)")
+#define STR_SVT_INDEXENTRY_PHONETIC_FC NC_("STR_SVT_INDEXENTRY_PHONETIC_FC", "Phonetic (alphanumeric first, grouped by consonants)")
+#define STR_SVT_INDEXENTRY_PHONETIC_LS NC_("STR_SVT_INDEXENTRY_PHONETIC_LS", "Phonetic (alphanumeric last, grouped by syllables)")
+#define STR_SVT_INDEXENTRY_PHONETIC_LC NC_("STR_SVT_INDEXENTRY_PHONETIC_LC", "Phonetic (alphanumeric last, grouped by consonants)")
+
+#define STR_SVT_STYLE_LIGHT NC_("STR_SVT_STYLE_LIGHT", "Light")
+#define STR_SVT_STYLE_LIGHT_ITALIC NC_("STR_SVT_STYLE_LIGHT_ITALIC", "Light Italic")
+#define STR_SVT_STYLE_NORMAL NC_("STR_SVT_STYLE_NORMAL", "Regular")
+#define STR_SVT_STYLE_NORMAL_ITALIC NC_("STR_SVT_STYLE_NORMAL_ITALIC", "Italic")
+#define STR_SVT_STYLE_BOLD NC_("STR_SVT_STYLE_BOLD", "Bold")
+#define STR_SVT_STYLE_BOLD_ITALIC NC_("STR_SVT_STYLE_BOLD_ITALIC", "Bold Italic")
+#define STR_SVT_STYLE_BLACK NC_("STR_SVT_STYLE_BLACK", "Black")
+#define STR_SVT_STYLE_BLACK_ITALIC NC_("STR_SVT_STYLE_BLACK_ITALIC", "Black Italic")
+#define STR_SVT_STYLE_BOOK NC_("STR_SVT_STYLE_BOOK", "Book")
+#define STR_SVT_STYLE_BOLD_OBLIQUE NC_("STR_SVT_STYLE_BOLD_OBLIQUE", "Bold Oblique")
+#define STR_SVT_STYLE_CONDENSED NC_("STR_SVT_STYLE_CONDENSED", "Condensed")
+#define STR_SVT_STYLE_CONDENSED_BOLD NC_("STR_SVT_STYLE_CONDENSED_BOLD", "Condensed Bold")
+#define STR_SVT_STYLE_CONDENSED_BOLD_ITALIC NC_("STR_SVT_STYLE_CONDENSED_BOLD_ITALIC", "Condensed Bold Italic")
+#define STR_SVT_STYLE_CONDENSED_BOLD_OBLIQUE NC_("STR_SVT_STYLE_CONDENSED_BOLD_OBLIQUE", "Condensed Bold Oblique")
+#define STR_SVT_STYLE_CONDENSED_ITALIC NC_("STR_SVT_STYLE_CONDENSED_ITALIC", "Condensed Italic")
+#define STR_SVT_STYLE_CONDENSED_OBLIQUE NC_("STR_SVT_STYLE_CONDENSED_OBLIQUE", "Condensed Oblique")
+#define STR_SVT_STYLE_EXTRALIGHT NC_("STR_SVT_STYLE_EXTRALIGHT", "ExtraLight")
+#define STR_SVT_STYLE_EXTRALIGHT_ITALIC NC_("STR_SVT_STYLE_EXTRALIGHT_ITALIC", "ExtraLight Italic")
+#define STR_SVT_STYLE_OBLIQUE NC_("STR_SVT_STYLE_OBLIQUE", "Oblique")
+#define STR_SVT_STYLE_SEMIBOLD NC_("STR_SVT_STYLE_SEMIBOLD", "Semibold")
+#define STR_SVT_STYLE_SEMIBOLD_ITALIC NC_("STR_SVT_STYLE_SEMIBOLD_ITALIC", "Semibold Italic")
+#define STR_SVT_FONTMAP_BOTH NC_("STR_SVT_FONTMAP_BOTH", "The same font will be used on both your printer and your screen.")
+#define STR_SVT_FONTMAP_PRINTERONLY NC_("STR_SVT_FONTMAP_PRINTERONLY", "This is a printer font. The screen image may differ.")
+#define STR_SVT_FONTMAP_STYLENOTAVAILABLE NC_("STR_SVT_FONTMAP_STYLENOTAVAILABLE", "This font style will be simulated or the closest matching style will be used.")
+#define STR_SVT_FONTMAP_NOTAVAILABLE NC_("STR_SVT_FONTMAP_NOTAVAILABLE", "This font has not been installed. The closest available font will be used.")
+
+#define STR_TABBAR_PUSHBUTTON_MOVET0HOME NC_("STR_TABBAR_PUSHBUTTON_MOVET0HOME", "Move To Home")
+#define STR_TABBAR_PUSHBUTTON_MOVELEFT NC_("STR_TABBAR_PUSHBUTTON_MOVELEFT", "Move Left")
+#define STR_TABBAR_PUSHBUTTON_MOVERIGHT NC_("STR_TABBAR_PUSHBUTTON_MOVERIGHT", "Move Right")
+#define STR_TABBAR_PUSHBUTTON_MOVETOEND NC_("STR_TABBAR_PUSHBUTTON_MOVETOEND", "Move To End")
+#define STR_TABBAR_PUSHBUTTON_ADDTAB NC_("STR_TABBAR_PUSHBUTTON_ADDTAB", "Add")
+
+#define STR_SVT_ACC_RULER_HORZ_NAME NC_("STR_SVT_ACC_RULER_HORZ_NAME", "Horizontal Ruler")
+#define STR_SVT_ACC_RULER_VERT_NAME NC_("STR_SVT_ACC_RULER_VERT_NAME", "Vertical Ruler")
+
+#define STR_SVT_1BIT_THRESHOLD NC_("STR_SVT_1BIT_THRESHOLD", "1-bit threshold")
+#define STR_SVT_8BIT_GRAYSCALE NC_("STR_SVT_8BIT_GRAYSCALE", "8-bit grayscale")
+#define STR_SVT_8BIT_COLOR_PALETTE NC_("STR_SVT_8BIT_COLOR_PALETTE", "8-bit color")
+#define STR_SVT_24BIT_TRUE_COLOR NC_("STR_SVT_24BIT_TRUE_COLOR", "24-bit true color")
+#define STR_SVT_ESTIMATED_SIZE_PIX_1 NC_("STR_SVT_ESTIMATED_SIZE_PIX_1", "The image needs about %1 kB of memory.")
+#define STR_SVT_ESTIMATED_SIZE_PIX_2 NC_("STR_SVT_ESTIMATED_SIZE_PIX_2", "The image needs about %1 kB of memory; the file size is %2 kB.")
+#define STR_SVT_ESTIMATED_SIZE_VEC NC_("STR_SVT_ESTIMATED_SIZE_VEC", "The file size is %1 kB.")
+#define STR_SVT_HOST NC_("STR_SVT_HOST", "host")
+#define STR_SVT_PORT NC_("STR_SVT_PORT", "port")
+#define STR_SVT_OTHER_CMIS NC_("STR_SVT_OTHER_CMIS", "Other CMIS")
+#define STR_SVT_PRNDLG_READY NC_("STR_SVT_PRNDLG_READY", "Ready")
+#define STR_SVT_PRNDLG_PAUSED NC_("STR_SVT_PRNDLG_PAUSED", "Paused")
+#define STR_SVT_PRNDLG_PENDING NC_("STR_SVT_PRNDLG_PENDING", "Pending deletion")
+#define STR_SVT_PRNDLG_BUSY NC_("STR_SVT_PRNDLG_BUSY", "Busy")
+#define STR_SVT_PRNDLG_INITIALIZING NC_("STR_SVT_PRNDLG_INITIALIZING", "Initializing")
+#define STR_SVT_PRNDLG_WAITING NC_("STR_SVT_PRNDLG_WAITING", "Waiting")
+#define STR_SVT_PRNDLG_WARMING_UP NC_("STR_SVT_PRNDLG_WARMING_UP", "Warming up")
+#define STR_SVT_PRNDLG_PROCESSING NC_("STR_SVT_PRNDLG_PROCESSING", "Processing")
+#define STR_SVT_PRNDLG_PRINTING NC_("STR_SVT_PRNDLG_PRINTING", "Printing")
+#define STR_SVT_PRNDLG_OFFLINE NC_("STR_SVT_PRNDLG_OFFLINE", "Offline")
+#define STR_SVT_PRNDLG_ERROR NC_("STR_SVT_PRNDLG_ERROR", "Error")
+#define STR_SVT_PRNDLG_SERVER_UNKNOWN NC_("STR_SVT_PRNDLG_SERVER_UNKNOWN", "Unknown Server")
+#define STR_SVT_PRNDLG_PAPER_JAM NC_("STR_SVT_PRNDLG_PAPER_JAM", "Paper jam")
+#define STR_SVT_PRNDLG_PAPER_OUT NC_("STR_SVT_PRNDLG_PAPER_OUT", "Not enough paper")
+#define STR_SVT_PRNDLG_MANUAL_FEED NC_("STR_SVT_PRNDLG_MANUAL_FEED", "Manual feed")
+#define STR_SVT_PRNDLG_PAPER_PROBLEM NC_("STR_SVT_PRNDLG_PAPER_PROBLEM", "Paper problem")
+#define STR_SVT_PRNDLG_IO_ACTIVE NC_("STR_SVT_PRNDLG_IO_ACTIVE", "I/O active")
+#define STR_SVT_PRNDLG_OUTPUT_BIN_FULL NC_("STR_SVT_PRNDLG_OUTPUT_BIN_FULL", "Output bin full")
+#define STR_SVT_PRNDLG_TONER_LOW NC_("STR_SVT_PRNDLG_TONER_LOW", "Toner low")
+#define STR_SVT_PRNDLG_NO_TONER NC_("STR_SVT_PRNDLG_NO_TONER", "No toner")
+#define STR_SVT_PRNDLG_PAGE_PUNT NC_("STR_SVT_PRNDLG_PAGE_PUNT", "Delete Page")
+#define STR_SVT_PRNDLG_USER_INTERVENTION NC_("STR_SVT_PRNDLG_USER_INTERVENTION", "User intervention necessary")
+#define STR_SVT_PRNDLG_OUT_OF_MEMORY NC_("STR_SVT_PRNDLG_OUT_OF_MEMORY", "Insufficient memory")
+#define STR_SVT_PRNDLG_DOOR_OPEN NC_("STR_SVT_PRNDLG_DOOR_OPEN", "Cover open")
+#define STR_SVT_PRNDLG_POWER_SAVE NC_("STR_SVT_PRNDLG_POWER_SAVE", "Power save mode")
+#define STR_SVT_PRNDLG_DEFPRINTER NC_("STR_SVT_PRNDLG_DEFPRINTER", "Default printer")
+#define STR_SVT_PRNDLG_JOBCOUNT NC_("STR_SVT_PRNDLG_JOBCOUNT", "%d documents")
+
+#define STR_NO_FIELD_SELECTION NC_("STR_NO_FIELD_SELECTION", "<none>")
+#define STR_FIELD_COMPANY NC_("STR_FIELD_COMPANY", "Company")
+#define STR_FIELD_DEPARTMENT NC_("STR_FIELD_DEPARTMENT", "Department")
+#define STR_FIELD_FIRSTNAME NC_("STR_FIELD_FIRSTNAME", "First name")
+#define STR_FIELD_LASTNAME NC_("STR_FIELD_LASTNAME", "Last name")
+#define STR_FIELD_STREET NC_("STR_FIELD_STREET", "Street")
+#define STR_FIELD_COUNTRY NC_("STR_FIELD_COUNTRY", "Country")
+#define STR_FIELD_ZIPCODE NC_("STR_FIELD_ZIPCODE", "ZIP Code")
+#define STR_FIELD_CITY NC_("STR_FIELD_CITY", "City")
+#define STR_FIELD_TITLE NC_("STR_FIELD_TITLE", "Title")
+#define STR_FIELD_POSITION NC_("STR_FIELD_POSITION", "Position")
+#define STR_FIELD_ADDRFORM NC_("STR_FIELD_ADDRFORM", "Addr. Form")
+#define STR_FIELD_INITIALS NC_("STR_FIELD_INITIALS", "Initials")
+#define STR_FIELD_SALUTATION NC_("STR_FIELD_SALUTATION", "Complimentary close")
+#define STR_FIELD_HOMETEL NC_("STR_FIELD_HOMETEL", "Tel: Home")
+#define STR_FIELD_WORKTEL NC_("STR_FIELD_WORKTEL", "Tel: Work")
+#define STR_FIELD_FAX NC_("STR_FIELD_FAX", "Fax")
+#define STR_FIELD_EMAIL NC_("STR_FIELD_EMAIL", "Email")
+#define STR_FIELD_URL NC_("STR_FIELD_URL", "URL")
+#define STR_FIELD_NOTE NC_("STR_FIELD_NOTE", "Note")
+#define STR_FIELD_USER1 NC_("STR_FIELD_USER1", "User 1")
+#define STR_FIELD_USER2 NC_("STR_FIELD_USER2", "User 2")
+#define STR_FIELD_USER3 NC_("STR_FIELD_USER3", "User 3")
+#define STR_FIELD_USER4 NC_("STR_FIELD_USER4", "User 4")
+#define STR_FIELD_ID NC_("STR_FIELD_ID", "ID")
+#define STR_FIELD_STATE NC_("STR_FIELD_STATE", "State")
+#define STR_FIELD_OFFICETEL NC_("STR_FIELD_OFFICETEL", "Tel: Office")
+#define STR_FIELD_PAGER NC_("STR_FIELD_PAGER", "Pager")
+#define STR_FIELD_MOBILE NC_("STR_FIELD_MOBILE", "Mobile")
+#define STR_FIELD_TELOTHER NC_("STR_FIELD_TELOTHER", "Tel: Other")
+#define STR_FIELD_CALENDAR NC_("STR_FIELD_CALENDAR", "Calendar")
+#define STR_FIELD_INVITE NC_("STR_FIELD_INVITE", "Invite")
+
+#define STR_SVT_DEFAULT_SERVICE_LABEL NC_("STR_SVT_DEFAULT_SERVICE_LABEL", "$user$'s $service$")
+
+#define STR_WARNING_JAVANOTFOUND NC_("STR_WARNING_JAVANOTFOUND", "%PRODUCTNAME requires a Java runtime environment (JRE) to perform this task. Please install a JRE and restart %PRODUCTNAME. %FAQLINK")
+#define STR_WARNING_JAVANOTFOUND_WIN NC_("STR_WARNING_JAVANOTFOUND_WIN", "%PRODUCTNAME requires a %BITNESS-bit Java runtime environment (JRE) to perform this task. Please install a JRE and restart %PRODUCTNAME. %FAQLINK")
+#define STR_WARNING_JAVANOTFOUND_MAC NC_("STR_WARNING_JAVANOTFOUND_MAC", "%PRODUCTNAME requires Oracle's Java Development Kit (JDK) on macOS 10.10 or greater to perform this task. Please install them and restart %PRODUCTNAME. %FAQLINK")
+#define STR_WARNING_INVALIDJAVASETTINGS_MAC NC_("STR_WARNING_INVALIDJAVASETTINGS_MAC", "The %PRODUCTNAME configuration has been changed. Under %PRODUCTNAME - Preferences - %PRODUCTNAME - Advanced, select the Java runtime environment you want to have used by %PRODUCTNAME.")
+#define STR_WARNING_INVALIDJAVASETTINGS NC_("STR_WARNING_INVALIDJAVASETTINGS", "The %PRODUCTNAME configuration has been changed. Under Tools - Options - %PRODUCTNAME - Advanced, select the Java runtime environment you want to have used by %PRODUCTNAME.")
+#define STR_ERROR_JVMCREATIONFAILED_MAC NC_("STR_ERROR_JVMCREATIONFAILED_MAC", "%PRODUCTNAME requires a Java runtime environment (JRE) to perform this task. The selected JRE is defective. Please select another version or install a new JRE and select it under %PRODUCTNAME - Preferences - %PRODUCTNAME - Advanced.")
+#define STR_ERROR_JVMCREATIONFAILED NC_("STR_ERROR_JVMCREATIONFAILED", "%PRODUCTNAME requires a Java runtime environment (JRE) to perform this task. The selected JRE is defective. Please select another version or install a new JRE and select it under Tools - Options - %PRODUCTNAME - Advanced.")
+#define STR_WARNING_JAVANOTFOUND_TITLE NC_("STR_WARNING_JAVANOTFOUND_TITLE", "JRE Required")
+#define STR_WARNING_INVALIDJAVASETTINGS_TITLE NC_("STR_WARNING_INVALIDJAVASETTINGS_TITLE", "Select JRE")
+#define STR_ERROR_JVMCREATIONFAILED_TITLE NC_("STR_ERROR_JVMCREATIONFAILED_TITLE", "JRE is Defective")
+
+// accessibility descriptions that use %PRODUCTNAME, we set these explicitly because querying a11y descs
+// in order to change %PRODUCTNAME at runtime is expensive, so limit doing that as much as possible.
+#define STR_A11Y_DESC_OPTIONS NC_("printersetupdialog|extended_tip|options", "Opens the Printer Options dialog where you can override the global printer options set on the Tools - Options - %PRODUCTNAME Writer/Web - Print panel for the current document.")
+
+#define STR_DESCRIPTION_SOURCEFILE NC_("STR_DESCRIPTION_SOURCEFILE", "Source code")
+#define STR_DESCRIPTION_BOOKMARKFILE NC_("STR_DESCRIPTION_BOOKMARKFILE", "Bookmark file")
+#define STR_DESCRIPTION_GRAPHIC_DOC NC_("STR_DESCRIPTION_GRAPHIC_DOC", "Graphics")
+#define STR_DESCRIPTION_CFGFILE NC_("STR_DESCRIPTION_CFGFILE", "Configuration file")
+#define STR_DESCRIPTION_APPLICATION NC_("STR_DESCRIPTION_APPLICATION", "Application")
+#define STR_DESCRIPTION_DATABASE_TABLE NC_("STR_DESCRIPTION_DATABASE_TABLE", "Database table")
+#define STR_DESCRIPTION_SYSFILE NC_("STR_DESCRIPTION_SYSFILE", "System file")
+#define STR_DESCRIPTION_WORD_DOC NC_("STR_DESCRIPTION_WORD_DOC", "MS Word document")
+#define STR_DESCRIPTION_HELP_DOC NC_("STR_DESCRIPTION_HELP_DOC", "Help file")
+#define STR_DESCRIPTION_HTMLFILE NC_("STR_DESCRIPTION_HTMLFILE", "HTML document")
+#define STR_DESCRIPTION_ARCHIVFILE NC_("STR_DESCRIPTION_ARCHIVFILE", "Archive file")
+#define STR_DESCRIPTION_LOGFILE NC_("STR_DESCRIPTION_LOGFILE", "Log file")
+#define STR_DESCRIPTION_SDATABASE_DOC NC_("STR_DESCRIPTION_SDATABASE_DOC", "StarOffice Database")
+#define STR_DESCRIPTION_GLOBALDOC NC_("STR_DESCRIPTION_GLOBALDOC", "StarWriter 4.0 / 5.0 Master Document")
+#define STR_DESCRIPTION_SIMAGE_DOC NC_("STR_DESCRIPTION_SIMAGE_DOC", "StarOffice Image")
+#define STR_DESCRIPTION_TEXTFILE NC_("STR_DESCRIPTION_TEXTFILE", "Text file")
+#define STR_DESCRIPTION_LINK NC_("STR_DESCRIPTION_LINK", "Link")
+#define STR_DESCRIPTION_SOFFICE_TEMPLATE_DOC NC_("STR_DESCRIPTION_SOFFICE_TEMPLATE_DOC", "StarOffice 3.0 - 5.0 Template")
+#define STR_DESCRIPTION_EXCEL_DOC NC_("STR_DESCRIPTION_EXCEL_DOC", "MS Excel document")
+#define STR_DESCRIPTION_EXCEL_TEMPLATE_DOC NC_("STR_DESCRIPTION_EXCEL_TEMPLATE_DOC", "MS Excel template")
+#define STR_DESCRIPTION_BATCHFILE NC_("STR_DESCRIPTION_BATCHFILE", "Batch file")
+#define STR_DESCRIPTION_FILE NC_("STR_DESCRIPTION_FILE", "File")
+#define STR_DESCRIPTION_FOLDER NC_("STR_DESCRIPTION_FOLDER", "Folder")
+#define STR_DESCRIPTION_FACTORY_WRITER NC_("STR_DESCRIPTION_FACTORY_WRITER", "Text Document")
+#define STR_DESCRIPTION_FACTORY_CALC NC_("STR_DESCRIPTION_FACTORY_CALC", "Spreadsheet")
+#define STR_DESCRIPTION_FACTORY_IMPRESS NC_("STR_DESCRIPTION_FACTORY_IMPRESS", "Presentation")
+#define STR_DESCRIPTION_FACTORY_DRAW NC_("STR_DESCRIPTION_FACTORY_DRAW", "Drawing")
+#define STR_DESCRIPTION_FACTORY_WRITERWEB NC_("STR_DESCRIPTION_FACTORY_WRITERWEB", "HTML document")
+#define STR_DESCRIPTION_FACTORY_GLOBALDOC NC_("STR_DESCRIPTION_FACTORY_GLOBALDOC", "Master document")
+#define STR_DESCRIPTION_FACTORY_MATH NC_("STR_DESCRIPTION_FACTORY_MATH", "Formula")
+#define STR_DESCRIPTION_FACTORY_DATABASE NC_("STR_DESCRIPTION_FACTORY_DATABASE", "Database")
+#define STR_DESCRIPTION_CALC_TEMPLATE NC_("STR_DESCRIPTION_CALC_TEMPLATE", "OpenOffice.org 1.0 Spreadsheet Template")
+#define STR_DESCRIPTION_DRAW_TEMPLATE NC_("STR_DESCRIPTION_DRAW_TEMPLATE", "OpenOffice.org 1.0 Drawing Template")
+#define STR_DESCRIPTION_IMPRESS_TEMPLATE NC_("STR_DESCRIPTION_IMPRESS_TEMPLATE", "OpenOffice.org 1.0 Presentation Template")
+#define STR_DESCRIPTION_WRITER_TEMPLATE NC_("STR_DESCRIPTION_WRITER_TEMPLATE", "OpenOffice.org 1.0 Text Document Template")
+#define STR_DESCRIPTION_LOCALE_VOLUME NC_("STR_DESCRIPTION_LOCALE_VOLUME", "Local drive")
+#define STR_DESCRIPTION_FLOPPY_VOLUME NC_("STR_DESCRIPTION_FLOPPY_VOLUME", "Disk drive")
+#define STR_DESCRIPTION_CDROM_VOLUME NC_("STR_DESCRIPTION_CDROM_VOLUME", "CD-ROM drive")
+#define STR_DESCRIPTION_REMOTE_VOLUME NC_("STR_DESCRIPTION_REMOTE_VOLUME", "Network connection")
+#define STR_DESCRIPTION_POWERPOINT NC_("STR_DESCRIPTION_POWERPOINT", "MS PowerPoint Document")
+#define STR_DESCRIPTION_POWERPOINT_TEMPLATE NC_("STR_DESCRIPTION_POWERPOINT_TEMPLATE", "MS PowerPoint Template")
+#define STR_DESCRIPTION_POWERPOINT_SHOW NC_("STR_DESCRIPTION_POWERPOINT_SHOW", "MS PowerPoint Show")
+#define STR_DESCRIPTION_SXMATH_DOC NC_("STR_DESCRIPTION_SXMATH_DOC", "OpenOffice.org 1.0 Formula")
+#define STR_DESCRIPTION_SXCHART_DOC NC_("STR_DESCRIPTION_SXCHART_DOC", "OpenOffice.org 1.0 Chart")
+#define STR_DESCRIPTION_SXDRAW_DOC NC_("STR_DESCRIPTION_SXDRAW_DOC", "OpenOffice.org 1.0 Drawing")
+#define STR_DESCRIPTION_SXCALC_DOC NC_("STR_DESCRIPTION_SXCALC_DOC", "OpenOffice.org 1.0 Spreadsheet")
+#define STR_DESCRIPTION_SXIMPRESS_DOC NC_("STR_DESCRIPTION_SXIMPRESS_DOC", "OpenOffice.org 1.0 Presentation")
+#define STR_DESCRIPTION_SXWRITER_DOC NC_("STR_DESCRIPTION_SXWRITER_DOC", "OpenOffice.org 1.0 Text Document")
+#define STR_DESCRIPTION_SXGLOBAL_DOC NC_("STR_DESCRIPTION_SXGLOBAL_DOC", "OpenOffice.org 1.0 Master Document")
+#define STR_DESCRIPTION_MATHML_DOC NC_("STR_DESCRIPTION_MATHML_DOC", "MathML Document")
+#define STR_DESCRIPTION_OO_DATABASE_DOC NC_("STR_DESCRIPTION_OO_DATABASE_DOC", "OpenDocument Database")
+#define STR_DESCRIPTION_OO_DRAW_DOC NC_("STR_DESCRIPTION_OO_DRAW_DOC", "OpenDocument Drawing")
+#define STR_DESCRIPTION_OO_MATH_DOC NC_("STR_DESCRIPTION_OO_MATH_DOC", "OpenDocument Formula")
+#define STR_DESCRIPTION_OO_GLOBAL_DOC NC_("STR_DESCRIPTION_OO_GLOBAL_DOC", "OpenDocument Master Document")
+#define STR_DESCRIPTION_OO_IMPRESS_DOC NC_("STR_DESCRIPTION_OO_IMPRESS_DOC", "OpenDocument Presentation")
+#define STR_DESCRIPTION_OO_CALC_DOC NC_("STR_DESCRIPTION_OO_CALC_DOC", "OpenDocument Spreadsheet")
+#define STR_DESCRIPTION_OO_WRITER_DOC NC_("STR_DESCRIPTION_OO_WRITER_DOC", "OpenDocument Text")
+#define STR_DESCRIPTION_OO_CALC_TEMPLATE NC_("STR_DESCRIPTION_OO_CALC_TEMPLATE", "OpenDocument Spreadsheet Template")
+#define STR_DESCRIPTION_OO_DRAW_TEMPLATE NC_("STR_DESCRIPTION_OO_DRAW_TEMPLATE", "OpenDocument Drawing Template")
+#define STR_DESCRIPTION_OO_IMPRESS_TEMPLATE NC_("STR_DESCRIPTION_OO_IMPRESS_TEMPLATE", "OpenDocument Presentation Template")
+#define STR_DESCRIPTION_OO_WRITER_TEMPLATE NC_("STR_DESCRIPTION_OO_WRITER_TEMPLATE", "OpenDocument Text Template")
+#define STR_DESCRIPTION_EXTENSION NC_("STR_DESCRIPTION_EXTENSION", "%PRODUCTNAME Extension")
+
+#define STR_DESCRIPTION_HUNSPELL NC_("STR_DESCRIPTION_HUNSPELL", "Hunspell SpellChecker")
+#define STR_DESCRIPTION_LIBHYPHEN NC_("STR_DESCRIPTION_LIBHYPHEN", "Libhyphen Hyphenator")
+#define STR_DESCRIPTION_MYTHES NC_("STR_DESCRIPTION_MYTHES", "MyThes Thesaurus")
+#define STR_DESCRIPTION_IGNOREALLLIST NC_("STR_DESCRIPTION_IGNOREALLLIST", "List of Ignored Words")
+#define STR_DESCRIPTION_LANGUAGETOOL NC_("STR_DESCRIPTION_LANGUAGETOOL", "LanguageTool Remote Grammar Checker")
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/stringtransfer.hxx b/include/svtools/stringtransfer.hxx
new file mode 100644
index 000000000..d8c99a132
--- /dev/null
+++ b/include/svtools/stringtransfer.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <vcl/transfer.hxx>
+
+
+namespace svt
+{
+ //= OStringTransferable
+ class SVT_DLLPUBLIC OStringTransferable final : public TransferDataContainer
+ {
+ public:
+ OStringTransferable(const OUString& rContent);
+ void SetData(const OUString& rContent);
+
+ private:
+ // TransferableHelper overridables
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& _rFlavor, const OUString& rDestDoc ) override;
+
+ OUString m_sContent;
+ };
+
+
+ //= OStringTransfer
+ class OStringTransfer
+ {
+ public:
+ /** copies the string given into the system clipboard
+ <p>Beware: In opposite to the old DragServer::CopyString, this method does not <em>add</em> the string
+ to the clipboard, instead the old clipboard content is <em>replaced</em>!</p>
+ */
+ SVT_DLLPUBLIC static void CopyString( const OUString& _rContent, vcl::Window* _pWindow );
+
+ /** extracts a string from the system clipboard given
+ @return <TRUE/> if the extraction was successful, i.e. if the clipboard contained a string content
+ */
+ SVT_DLLPUBLIC static bool PasteString( OUString& _rContent, vcl::Window* _pWindow );
+
+ /** starts dragging a simple string
+ */
+ SVT_DLLPUBLIC static void StartStringDrag( const OUString& _rContent, vcl::Window* _pWindow, sal_Int8 _nDragSourceActions );
+ };
+
+} // namespace svt
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svparser.hxx b/include/svtools/svparser.hxx
new file mode 100644
index 000000000..4f4e1ab9a
--- /dev/null
+++ b/include/svtools/svparser.hxx
@@ -0,0 +1,214 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <tools/link.hxx>
+#include <tools/ref.hxx>
+#include <tools/long.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <memory>
+
+template<typename T> struct SvParser_Impl;
+class SvStream;
+
+enum class SvParserState
+{
+ Accepted = 0,
+ NotStarted,
+ Working,
+ Pending,
+ Error
+};
+
+template<typename T>
+class SVT_DLLPUBLIC SvParser : public SvRefBase
+{
+ DECL_DLLPRIVATE_LINK( NewDataRead, LinkParamNone*, void );
+
+protected:
+ SvStream& rInput;
+ OUStringBuffer aToken; // scanned token
+ sal_uInt32 nlLineNr; // current line number
+ sal_uInt32 nlLinePos; // current column number
+
+ std::unique_ptr<SvParser_Impl<T>> pImplData; // internal data
+ tools::Long m_nTokenIndex; // current token index to detect loops for seeking backwards
+ tools::Long nTokenValue; // additional value (RTF)
+ bool bTokenHasValue; // indicates whether nTokenValue is valid
+ SvParserState eState; // status also in derived classes
+
+ rtl_TextEncoding eSrcEnc; // Source encoding
+
+ sal_uInt64 nNextChPos;
+ sal_uInt32 nNextCh; // current character codepoint in UTF32 for the "lex"
+
+ bool bSwitchToUCS2 : 1; // switching is allowed
+ bool bRTF_InTextRead : 1; // only for RTF-Parser!!!
+
+ struct TokenStackType
+ {
+ OUString sToken;
+ tools::Long nTokenValue;
+ bool bTokenHasValue;
+ T nTokenId;
+
+ TokenStackType();
+ };
+
+ // methods for Token stack
+ T SkipToken( short nCnt = -1 ); // "skip" n Tokens back
+ TokenStackType* GetStackPtr( short nCnt );
+
+ // scan the next token:
+ // work off Token stack and call GetNextToken_() if necessary.
+ // That one is responsible for the recognition of new Tokens.
+ T GetNextToken();
+ virtual T GetNextToken_() = 0;
+
+ // is called for each Token that is recognized in CallParser
+ virtual void NextToken( T nToken ) = 0;
+
+ // at times of SvRefBase derivation, not everybody may delete
+ virtual ~SvParser() override;
+
+ void ClearTxtConvContext();
+
+private:
+ std::unique_ptr<TokenStackType[]> pTokenStack;
+ TokenStackType *pTokenStackPos;
+ sal_uInt8 nTokenStackSize, nTokenStackPos;
+
+public:
+ SvParser( SvStream& rIn, sal_uInt8 nStackSize = 3 );
+
+ virtual SvParserState CallParser() = 0; // calling of the parser
+
+ SvParserState GetStatus() const; // StatusInfo
+
+ sal_uInt32 GetLineNr() const;
+ sal_uInt32 GetLinePos() const;
+ void IncLineNr();
+ sal_uInt32 IncLinePos();
+ void SetLineNr( sal_uInt32 nlNum );
+ void SetLinePos( sal_uInt32 nlPos );
+
+ sal_uInt32 GetNextChar(); // Return next Unicode codepoint in UTF32.
+ void RereadLookahead();
+
+ bool IsParserWorking() const;
+
+ Link<LinkParamNone*,void> GetAsynchCallLink() const;
+
+ // for asynchronous reading from the SvStream
+ void SaveState( T nToken );
+ void RestoreState();
+ virtual void Continue( T nToken );
+
+ // Set/get source encoding. The UCS2BEncoding flag is valid if source
+ // encoding is UCS2. It specifies a big endian encoding.
+ void SetSrcEncoding( rtl_TextEncoding eSrcEnc );
+ rtl_TextEncoding GetSrcEncoding() const;
+
+ // May the character set be switched to UCS/2, if a BOM
+ // is in the first two characters of the stream?
+ void SetSwitchToUCS2( bool bSet );
+ bool IsSwitchToUCS2() const;
+
+ // how many bytes a character consists of
+ sal_uInt16 GetCharSize() const;
+
+ T GetSaveToken() const;
+};
+
+
+/*========================================================================
+ *
+ * SvKeyValue.
+ *
+ *======================================================================*/
+
+class SvKeyValue
+{
+ /** Representation.
+ */
+ OUString m_aKey;
+ OUString m_aValue;
+
+public:
+ /** Construction.
+ */
+ SvKeyValue()
+ {}
+
+ SvKeyValue (const OUString &rKey, const OUString &rValue)
+ : m_aKey (rKey), m_aValue (rValue)
+ {}
+
+ SvKeyValue (const SvKeyValue &rOther)
+ : m_aKey (rOther.m_aKey), m_aValue (rOther.m_aValue)
+ {}
+
+ /** Assignment.
+ */
+ SvKeyValue& operator= (SvKeyValue const &rOther)
+ {
+ m_aKey = rOther.m_aKey;
+ m_aValue = rOther.m_aValue;
+ return *this;
+ }
+
+ /** Operation.
+ */
+ const OUString& GetKey() const { return m_aKey; }
+ const OUString& GetValue() const { return m_aValue; }
+};
+
+/*========================================================================
+ *
+ * SvKeyValueIterator.
+ *
+ *======================================================================*/
+
+class SVT_DLLPUBLIC SvKeyValueIterator : public SvRefBase
+{
+ struct Impl;
+ std::unique_ptr<Impl> mpImpl;
+
+public:
+ /** Construction/Destruction.
+ */
+ SvKeyValueIterator();
+ virtual ~SvKeyValueIterator() override;
+ SvKeyValueIterator(const SvKeyValueIterator&) = delete;
+ SvKeyValueIterator& operator=( const SvKeyValueIterator& ) = delete;
+
+ /** Operation.
+ */
+ virtual bool GetFirst (SvKeyValue &rKeyVal);
+ virtual bool GetNext (SvKeyValue &rKeyVal);
+ virtual void Append (const SvKeyValue &rKeyVal);
+};
+
+typedef tools::SvRef<SvKeyValueIterator> SvKeyValueIteratorRef;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svtdllapi.h b/include/svtools/svtdllapi.h
new file mode 100644
index 000000000..ce301e9f8
--- /dev/null
+++ b/include/svtools/svtdllapi.h
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+
+#if defined(SVT_DLLIMPLEMENTATION)
+#define SVT_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SVT_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SVT_DLLPRIVATE SAL_DLLPRIVATE
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svtresid.hxx b/include/svtools/svtresid.hxx
new file mode 100644
index 000000000..c24ee7d93
--- /dev/null
+++ b/include/svtools/svtresid.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <rtl/ustring.hxx>
+#include <unotools/resmgr.hxx>
+#include <locale>
+
+SVT_DLLPUBLIC std::locale SvtResLocale();
+SVT_DLLPUBLIC OUString SvtResId(TranslateId aId);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx
new file mode 100644
index 000000000..948e60b35
--- /dev/null
+++ b/include/svtools/tabbar.hxx
@@ -0,0 +1,505 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <tools/link.hxx>
+#include <vcl/window.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <memory>
+
+class StyleSettings;
+
+/*
+
+Allowed StylbeBits
+------------------
+
+WB_SCROLL - The tabs can be scrolled via an extra field
+WB_MINSCROLL - The tabs can be scrolled via 2 additional buttons
+WB_RANGESELECT - Connected ranges can be selected
+WB_MULTISELECT - single tabs can be selected
+WB_BORDER - a border is drawn in the top and in the bottom
+WB_DRAG - A StartDrag handler is called by the TabBar, if drag
+ and drop should be started. In addition, drag and drop
+ is activated in the TabBar with EnableDrop().
+WB_SIZEABLE - a Split handler is called by the TabBar, if the user
+ wants to change the width of the TabBar
+WB_STDTABBAR - WB_BORDER
+
+
+Allowed PageBits
+-----------------
+
+Setting page bits modify the display attributes of the tab name
+
+TabBarPageBits::Blue
+ - Display tab name in light blue, used in draw for
+ invisible layers and in calc for scenario pages
+TabBarPageBits::Italic
+ - Display tab name italic, used in draw for
+ locked layers
+TabBarPageBits::Underline
+ - Display tab name underlined, used in draw for
+ non-printable layers
+
+
+Handlers
+-------
+
+Select - is called when a tab is selected or unselected
+DoubleClick - Is called when a DoubleClick has been fired in the
+ TabBar. Inside of the handler, GetCurPageId() returns
+ the clicked tab or 0, if no tab has been clicked.
+ActivatePage - Is called, if another page is activated.
+ GetCurPageId() returns the activated page.
+DeactivatePage - Is called, when a page is deactivated. If another page
+ may be activated, true must be returned; if another
+ page shall be excluded from the activation, false must
+ be returned. GetCurPageId() returns the page to be
+ deactivated.
+
+
+Drag and Drop
+-------------
+
+For Drag and Drop, the WinBit WB_DRAG must be set. In addition, the
+Command handler, the QueryDrop handler and the Drop handler must be overlaid.
+In doing so, the following must be implemented in the handlers:
+
+Command - If dragging should be started in this handler,
+ StartDrag() must be called. This method
+ then selects the respective entry or returns
+ false, if dragging cannot be carried out.
+
+QueryDrop - This handler is always called by StarView, when the
+ mouse is pulled over the window while dragging
+ (s.a. SV documentation). In this handler, it must be
+ determined whether a drop is possible. The drop
+ position can be shown in TabBar using ShowDropPos().
+ When calling, the position of the Event must be passed.
+ If the position is at the left or right border,
+ scrolling automatically takes place in the TabBar.
+ This method also returns the respective drop position,
+ which is also needed for a drop. If the window is left
+ while dragging, the drop position can be taken back
+ using HideDropPos(). Thus, it is also possible to handle
+ a drag which was triggered from outside the TabBar.
+
+Drop - In the Drop handler, the pages have to be moved, or
+ the new pages have to be inserted. The respective
+ drop position can be determined using ShowDropPos().
+
+The following methods are needed for Drag and Drop and must be called
+by the handlers:
+
+StartDrag - Must be called from the Command handler. As parameters,
+ the CommandEvent and a reference to a Region must be
+ passed. This vcl::Region then must be passed in
+ ExecuteDrag(), if the return value indicates that
+ ExecuteDrag shall be carried out. If the entry is not
+ selected, it is set as the current entry beforehand.
+ Because of this, attention must be paid that the Select
+ handler can be called from this method.
+
+ShowDropPos - This method must be called by the QueryDrop handler,
+ so that the TabBar shows where the Tabs are
+ inserted. This method can also be used in the Drop
+ handler, in order to determine the position at which
+ the Tabs shall be inserted. In the method, the
+ position of the Event must be passed. This method
+ returns the position, at which the Tabs shall be inserted.
+
+HideDropPos - This method takes back the DropPosition previously
+ displayed using ShowDropPos(). This method should be
+ called, when the window is left in the QueryDrop()
+ handler or the drag process has been ended.
+
+The following methods can be used if the pages should be switched
+in the Drag and Drop:
+
+SwitchPage - This method must be called by the QueryDrop handler
+ if the page, over which the mouse pointer resides,
+ should be switched. This method should be called
+ each time the QueryDrop-Handler is called.
+ Switching the page happens with a delay (500 ms) and
+ is automatically managed by this method.
+ The Position of the Event must be passed in the method.
+ This method returns true if the page has been switched.
+
+EndSwitchPage - This method resets the data for the switching of the
+ page. This method should be called when the window
+ is left in QueryDrop() or the drag process has been
+ ended.
+
+IsInSwitching - With this method, it can be queried in
+ ActivatePage()/DeactivatePage() whether this has been
+ caused by SwitchPage(). Thus, for example, switching
+ can be avoided in DeactivatePage() without an error
+ box.
+
+
+Window Resize
+--------------
+
+If the window width can be changed by the user, the WinBit WB_SIZEABLE
+must be set. In this case, the following handler must be overlaid:
+
+Split - When this handler is called, the window should be
+ adapted to the width that is returned by GetSplitSize().
+ In doing so, no minimal or maximum width is taken into
+ account. A minimal size can be queried using
+ GetMinSize() and the maximum width must be calculated
+ by the application itself. As only Online Resize is
+ supported, the window width must be changed inside
+ this handler and possibly the width of dependent windows
+ as well. For this handler, a link can also be set using
+ SetSplitHdl().
+
+The following methods deliver more information while Splitting:
+
+GetSplitSize() - Returns the width of the TabBar, to which the user
+ wants to resize the window. No minimum or maximum
+ width is taken into account. However, a width < 5
+ is never returned. This method only returns valid
+ values as long as splitting is active.
+
+GetMinSize() - With this method, a minimum window width can be
+ queried, so that at least something of a Tab is
+ visible. Still, the TabBar can be set more narrow
+ then the width that this method returns.
+ This method can also be called, when no splitting
+ is active.
+
+
+Edit Mode
+----------
+
+The TabBar also offers the user the possibility to change the names
+in the Tabs.
+
+EnableEditMode - With this, it can be configured that on Alt+LeftClick,
+ StartEditMode() is automatically called by the TabBar.
+ In the StartRenaming() handler, the renaming can still
+ be rejected.
+StartEditMode - With this method, the EditMode is started on a Tab.
+ false is returned, if the EditMode is already
+ active, the mode is rejected with StartRenaming()
+ or no space is available for editing.
+EndEditMode - With this method, the EditMode is ended.
+SetEditText - With this method, the text in the AllowRenaming()
+ handler can still be replaced by another text.
+GetEditText - With this method, the text, which the user has typed
+ in, can be queried in the AllowRenaming() handler.
+IsInEditMode - This method is used to query whether the EditMode
+ is active.
+IsEditModeCanceled - This method can be used in the EndRenaming()
+ handler to query whether the renaming has
+ been canceled.
+GetEditPageId - With this method, the tab that is being/has been
+ renamed is queried in the Renaming handlers.
+
+StartRenaming() - This handler is called when the EditMode hast been
+ started using StartEditMode(). GetEditPageId()
+ can be used to query which Tab should be renamed.
+ false should be returned if the EditMod should
+ not be started.
+AllowRenaming() - This handler is called when the EditMode is ended
+ (not in case of Cancel). Within this handler, it
+ can then be tested whether the text is OK.
+ The Tab which was renamed can be queried using
+ GetEditPageId().
+ One of the following values should be returned:
+ TAB_RENAMING_YES
+ The Tab is renamed.
+ TAB_RENAMING_NO
+ The Tab is not renamed, but the EditMode remains
+ active, so that the user can adapt the name
+ accordingly.
+ TAB_RENAMING_CANCEL
+ The EditMode was cancelled and the old text
+ is restored.
+EndRenaming() - This handler is called when the EditMode has been
+ ended. The tab that has been renamed can be
+ queried using GetEditPageId(). Using
+ IsEditModeCanceled(), it can be queried whether
+ the mode has been cancelled and the name has
+ thus not been changed.
+
+
+Maximum Page width
+-------------------
+
+The Page width of the tabs can be limited in order to make an easier
+navigation by them possible. If then, the text cannot be displayed
+completely, it is abbreviated with "..." and the whole text is
+displayed in the Tip or in the active help (if no help text is set).
+Using EnableAutoMaxPageWidth(), it can be configured whether the
+maximum page width should be based on the currently visible width
+(which is the default). Otherwise, the maximum page width can
+also be set using SetMaxPageWidth() (in pixels) (in this case, the
+AutoMaxPageWidth is ignored).
+
+ContextMenu
+-----------
+
+If a context-sensitive PopupMenu should be displayed, the Command
+handler must be overlaid. Using GetPageId() and when passing the
+mouse position, it can be determined whether the mouse click has been
+carried out over an item resp. over which item the mouse click has
+been carried out.
+*/
+
+namespace weld {
+class Button;
+}
+
+#define WB_RANGESELECT (WinBits(0x00200000))
+#define WB_MULTISELECT (WinBits(0x00400000))
+#define WB_MINSCROLL (WinBits(0x20000000))
+#define WB_INSERTTAB (WinBits(0x40000000))
+#define WB_STDTABBAR WB_BORDER
+
+// Page bits
+
+enum class TabBarPageBits {
+ NONE = 0x00,
+ Blue = 0x01,
+ Italic = 0x02,
+ Underline = 0x04,
+};
+namespace o3tl {
+ template<> struct typed_flags<TabBarPageBits> : is_typed_flags<TabBarPageBits, 0x07> {};
+};
+
+ // interface checks only, do not use in regular control flow
+
+#define TPB_DISPLAY_NAME_ALLFLAGS (TabBarPageBits::Blue | TabBarPageBits::Italic | TabBarPageBits::Underline)
+
+// - TabBar-Types - used in TabBar::AllowRenaming
+
+enum TabBarAllowRenamingReturnCode {
+ TABBAR_RENAMING_NO,
+ TABBAR_RENAMING_YES,
+ TABBAR_RENAMING_CANCEL
+};
+
+class MouseEvent;
+class DataChangedEvent;
+
+struct ImplTabBarItem;
+struct TabBar_Impl;
+
+
+class SVT_DLLPUBLIC TabBar : public vcl::Window
+{
+ friend class ImplTabSizer;
+
+private:
+ std::unique_ptr<TabBar_Impl> mpImpl;
+
+ OUString maEditText;
+ Size maWinSize;
+ tools::Long mnMaxPageWidth;
+ tools::Long mnCurMaxWidth;
+ tools::Long mnOffX;
+ tools::Long mnOffY;
+ tools::Long mnLastOffX;
+ tools::Long mnSplitSize;
+ sal_uInt64 mnSwitchTime;
+ WinBits mnWinStyle;
+ sal_uInt16 mnCurPageId;
+ sal_uInt16 mnFirstPos;
+ sal_uInt16 mnDropPos;
+ sal_uInt16 mnSwitchId;
+ sal_uInt16 mnEditId;
+
+ bool mbFormat : 1;
+ bool mbFirstFormat : 1;
+ bool mbSizeFormat : 1;
+ bool mbAutoEditMode : 1;
+ bool mbEditCanceled : 1;
+ bool mbDropPos : 1;
+ bool mbInSelect : 1;
+ bool mbMirrored : 1;
+ bool mbScrollAlwaysEnabled : 1;
+
+ Link<TabBar*,void> maSelectHdl;
+ Link<TabBar*,void> maSplitHdl;
+ Link<const CommandEvent&, void> maScrollAreaContextHdl;
+ size_t maCurrentItemList;
+
+ using Window::ImplInit;
+ SVT_DLLPRIVATE void ImplInit( WinBits nWinStyle );
+ SVT_DLLPRIVATE void ImplInitSettings( bool bFont, bool bBackground );
+ SVT_DLLPRIVATE void ImplGetColors(const StyleSettings& rStyleSettings,
+ Color& rFaceColor, Color& rFaceTextColor,
+ Color& rSelectColor, Color& rSelectTextColor);
+ SVT_DLLPRIVATE void ImplShowPage( sal_uInt16 nPos );
+ SVT_DLLPRIVATE bool ImplCalcWidth();
+ SVT_DLLPRIVATE void ImplFormat();
+ SVT_DLLPRIVATE sal_uInt16 ImplGetLastFirstPos();
+ SVT_DLLPRIVATE void ImplInitControls();
+ SVT_DLLPRIVATE void ImplEnableControls();
+ SVT_DLLPRIVATE void ImplSelect();
+ SVT_DLLPRIVATE void ImplActivatePage();
+ SVT_DLLPRIVATE bool ImplDeactivatePage();
+ SVT_DLLPRIVATE void ImplPrePaint();
+ SVT_DLLPRIVATE ImplTabBarItem* ImplGetLastTabBarItem( sal_uInt16 nItemCount );
+
+ DECL_DLLPRIVATE_LINK(ImplClickHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(ImplAddClickHandler, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(MousePressHdl, const MouseEvent&, bool);
+ DECL_DLLPRIVATE_LINK(ContextMenuHdl, const CommandEvent&, void);
+
+ ImplTabBarItem* seek( size_t i );
+ ImplTabBarItem* prev();
+ ImplTabBarItem* next();
+
+protected:
+ virtual void AddTabClick();
+ OUString GetAuxiliaryText(sal_uInt16 nPageId) const; // needed in derived class LayerTabBar
+ void SetAuxiliaryText(sal_uInt16 nPageId, const OUString& rText );
+
+public:
+ static const sal_uInt16 APPEND;
+ static const sal_uInt16 PAGE_NOT_FOUND;
+
+ TabBar( vcl::Window* pParent, WinBits nWinStyle );
+ virtual ~TabBar() override;
+ virtual void dispose() override;
+
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+ virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+
+ virtual void Select();
+ virtual void DoubleClick();
+ void Split();
+ virtual void ActivatePage();
+ virtual bool DeactivatePage();
+ virtual bool StartRenaming();
+ virtual TabBarAllowRenamingReturnCode AllowRenaming();
+ virtual void EndRenaming();
+ virtual void Mirror();
+
+ virtual void InsertPage( sal_uInt16 nPageId, const OUString& rText,
+ TabBarPageBits nBits = TabBarPageBits::NONE,
+ sal_uInt16 nPos = TabBar::APPEND );
+ void RemovePage( sal_uInt16 nPageId );
+ void MovePage( sal_uInt16 nPageId, sal_uInt16 nNewPos );
+
+ Color GetTabBgColor( sal_uInt16 nPageId ) const;
+ void SetTabBgColor( sal_uInt16 nPageId, const Color& aTabBgColor );
+
+ void Clear();
+
+ bool IsPageEnabled( sal_uInt16 nPageId ) const;
+
+ void SetPageBits( sal_uInt16 nPageId, TabBarPageBits nBits );
+ TabBarPageBits GetPageBits( sal_uInt16 nPageId ) const;
+
+ sal_uInt16 GetPageCount() const;
+ sal_uInt16 GetPageId( sal_uInt16 nPos ) const;
+ sal_uInt16 GetPagePos( sal_uInt16 nPageId ) const;
+ sal_uInt16 GetCurPagePos() const { return GetPagePos(GetCurPageId()); }
+ sal_uInt16 GetPageId( const Point& rPos ) const;
+ tools::Rectangle GetPageRect( sal_uInt16 nPageId ) const;
+ // returns the rectangle in which page tabs are drawn
+ tools::Rectangle GetPageArea() const;
+
+ void SetCurPageId( sal_uInt16 nPageId );
+ sal_uInt16 GetCurPageId() const { return mnCurPageId; }
+
+ void SetFirstPageId( sal_uInt16 nPageId );
+ void MakeVisible( sal_uInt16 nPageId );
+
+ void SelectPage( sal_uInt16 nPageId, bool bSelect );
+ sal_uInt16 GetSelectPageCount() const;
+ bool IsPageSelected( sal_uInt16 nPageId ) const;
+ void SetProtectionSymbol( sal_uInt16 nPageId, bool bProtection );
+
+ void SetMaxPageWidth( tools::Long nMaxWidth );
+
+ void EnableEditMode() { mbAutoEditMode = true; }
+ bool StartEditMode( sal_uInt16 nPageId );
+ void EndEditMode( bool bCancel = false );
+ void SetEditText( const OUString& rText ) { maEditText = rText; }
+ const OUString& GetEditText() const { return maEditText; }
+ bool IsInEditMode() const;
+ bool IsEditModeCanceled() const { return mbEditCanceled; }
+ sal_uInt16 GetEditPageId() const { return mnEditId; }
+
+ /** Mirrors the entire control including position of buttons and splitter.
+ Mirroring is done relative to the current direction of the GUI.
+ @param bMirrored sal_True = the control will draw itself RTL in LTR GUI,
+ and vice versa; sal_False = the control behaves according to the
+ current direction of the GUI. */
+ void SetMirrored(bool bMirrored);
+ /** Returns true, if the control is set to mirrored mode (see SetMirrored()). */
+ bool IsMirrored() const { return mbMirrored; }
+
+ /** Sets the control to LTR or RTL mode regardless of the GUI direction.
+ @param bRTL sal_False = the control will draw from left to right;
+ sal_True = the control will draw from right to left. */
+ void SetEffectiveRTL( bool bRTL );
+ /** Returns true, if the control draws from right to left (see SetEffectiveRTL()). */
+ bool IsEffectiveRTL() const;
+
+ bool StartDrag( const CommandEvent& rCEvt, vcl::Region& rRegion );
+ sal_uInt16 ShowDropPos( const Point& rPos );
+ void HideDropPos();
+ void SwitchPage( const Point& rPos );
+ void EndSwitchPage();
+
+ virtual void SetPageText( sal_uInt16 nPageId, const OUString& rText );
+ OUString GetPageText( sal_uInt16 nPageId ) const;
+ OUString GetHelpText( sal_uInt16 nPageId ) const;
+
+ tools::Long GetSplitSize() const { return mnSplitSize; }
+
+ using Window::SetHelpText;
+ using Window::GetHelpText;
+ using Window::SetHelpId;
+ using Window::GetHelpId;
+
+ void SetStyle( WinBits nStyle );
+ WinBits GetStyle() const { return mnWinStyle; }
+
+ void SetScrollAlwaysEnabled(bool bScrollAlwaysEnabled);
+
+ Size CalcWindowSizePixel() const;
+
+ void SetSelectHdl( const Link<TabBar*,void>& rLink ) { maSelectHdl = rLink; }
+ void SetSplitHdl( const Link<TabBar*,void>& rLink ) { maSplitHdl = rLink; }
+ void SetScrollAreaContextHdl( const Link<const CommandEvent&,void>& rLink ) { maScrollAreaContextHdl = rLink; }
+ void SetAddButtonEnabled(bool bAddButtonEnabled);
+
+ // accessibility
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/templatefoldercache.hxx b/include/svtools/templatefoldercache.hxx
new file mode 100644
index 000000000..a7bcb785f
--- /dev/null
+++ b/include/svtools/templatefoldercache.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <svtools/svtdllapi.h>
+#include <o3tl/deleter.hxx>
+#include <memory>
+
+namespace svt
+{
+
+
+ //= TemplateFolderCache
+
+ class TemplateFolderCacheImpl;
+ /** allows to cache the state of the template directories of OOo
+ <p>Usually, this class is used together with an instance of the
+ <service scope="com.sun.star.frame">DocumentTemplates</service> service. It allows to scan the template folders
+ of the Office, and updates the configuration so that it reflects the most recent state of the folders.<br/>
+ As this is an expensive, the TemplateFolderCache has been introduced. It caches the state of the template
+ folders, and allows to determine if the DocumentTemplates service needs to be invoked to do the (much more expensive)
+ update.</p>
+ @example C++
+ <listing>
+ TemplateFolderCache aTemplateFolders;
+ if ( aTemplateFolders.needsUpdate() )
+ {
+ // store the current state
+ aCache.storeState();
+
+ // create the DocumentTemplates instance
+ Reference< XDocumentTemplates > xTemplates = ...;
+
+ // update the templates configuration
+ xTemplates->update();
+ }
+
+ // do anything which relies on a up-to-date template configuration
+ </listing>
+ */
+ class UNLESS_MERGELIBS(SVT_DLLPUBLIC) TemplateFolderCache
+ {
+ private:
+ std::unique_ptr<TemplateFolderCacheImpl, o3tl::default_delete<TemplateFolderCacheImpl>> m_pImpl;
+
+ public:
+ /** ctor.
+ @param _bAutoStoreState
+ Set this to <TRUE/> if you want the instance to automatically store the state of the template folders upon
+ destruction.<br/>
+ If set to <FALSE/>, you would explicitly need to call <method>storeState</method> to do this.<br/>
+ If the current state is not known (e.g. because you did not call needsUpdate, which retrieves it),
+ it is not retrieved in the dtor, regardless of the <arg>_bAutoStoreState</arg> flag.
+ */
+ TemplateFolderCache( bool _bAutoStoreState = false );
+ ~TemplateFolderCache( );
+
+ /** determines whether or not the template configuration needs to be updated
+ @return
+ <TRUE/> if the template configuration needs to be updated
+ */
+ bool needsUpdate();
+
+ /** stores the current state of the template folders in the cache */
+ void storeState();
+ };
+
+
+} // namespace svt
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolbarmenu.hxx b/include/svtools/toolbarmenu.hxx
new file mode 100644
index 000000000..f82d87f0d
--- /dev/null
+++ b/include/svtools/toolbarmenu.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+
+#include <memory>
+
+#include <rtl/ref.hxx>
+#include <vcl/dockwin.hxx>
+#include <vcl/weld.hxx>
+
+namespace com :: sun :: star :: frame { class XFrame; }
+namespace com :: sun :: star :: frame { struct FeatureStateEvent; }
+namespace svt { class FrameStatusListener; }
+
+class SVT_DLLPUBLIC WeldToolbarPopup
+{
+private:
+ DECL_DLLPRIVATE_LINK(FocusHdl, weld::Widget&, void);
+
+protected:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xTopLevel;
+ std::unique_ptr<weld::Container> m_xContainer;
+ css::uno::Reference<css::frame::XFrame> m_xFrame;
+ rtl::Reference<svt::FrameStatusListener> m_xStatusListener;
+
+public:
+ WeldToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame,
+ weld::Widget* pParent, const OUString& rUIFile, const OString& rId);
+ virtual ~WeldToolbarPopup();
+ weld::Container* getTopLevel() { return m_xTopLevel.get(); }
+ weld::Container* getContainer() { return m_xContainer.get(); }
+ void AddStatusListener(const OUString& rCommandURL);
+
+ // Forwarded from XStatusListener (subclasses must override this one to get the status updates):
+ /// @throws css::uno::RuntimeException
+ virtual void statusChanged(const css::frame::FeatureStateEvent& Event);
+ virtual void GrabFocus() = 0;
+};
+
+// we want to create WeldToolbarPopup on-demand when a toolbar dropdown is
+// clicked, but the widget to be shown must exist before the dropdown
+// is activated, so ToolbarPopupContainer is that widget and the
+// contents of the on-demand created WeldToolbarPopup is placed
+// within the ToolbarPopupContainer
+class SVT_DLLPUBLIC ToolbarPopupContainer final
+{
+private:
+ DECL_DLLPRIVATE_LINK(FocusHdl, weld::Widget&, void);
+
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xTopLevel;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<WeldToolbarPopup> m_xPopup;
+public:
+ ToolbarPopupContainer(weld::Widget* pParent);
+ ~ToolbarPopupContainer();
+ weld::Container* getTopLevel() { return m_xTopLevel.get(); }
+
+ void setPopover(std::unique_ptr<WeldToolbarPopup> xPopup);
+ WeldToolbarPopup* getPopover() const { return m_xPopup.get(); }
+ void unsetPopover();
+};
+
+class SVT_DLLPUBLIC InterimToolbarPopup final : public DropdownDockingWindow
+{
+private:
+ css::uno::Reference<css::frame::XFrame> m_xFrame;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<WeldToolbarPopup> m_xPopup;
+public:
+ InterimToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, vcl::Window* pParent,
+ std::unique_ptr<WeldToolbarPopup> xPopup, bool bTearable = false);
+ virtual void dispose() override;
+ virtual ~InterimToolbarPopup() override;
+
+ virtual void GetFocus() override;
+
+ void EndPopupMode();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolboxcontroller.hxx b/include/svtools/toolboxcontroller.hxx
new file mode 100644
index 000000000..78a9b2282
--- /dev/null
+++ b/include/svtools/toolboxcontroller.hxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XToolbarController.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/multicontainer2.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <tools/link.hxx>
+#include <vcl/toolboxid.hxx>
+
+#include <unordered_map>
+
+namespace com :: sun :: star :: frame { class XDispatch; }
+namespace com :: sun :: star :: frame { class XFrame; }
+namespace com :: sun :: star :: frame { class XLayoutManager; }
+namespace com :: sun :: star :: uno { class XComponentContext; }
+namespace com :: sun :: star :: util { class XURLTransformer; }
+
+class ToolBox;
+
+namespace weld
+{
+ class Builder;
+ class Toolbar;
+}
+
+namespace svt
+{
+
+typedef cppu::WeakImplHelper<
+ css::frame::XStatusListener, css::frame::XToolbarController,
+ css::lang::XInitialization, css::util::XUpdatable,
+ css::lang::XComponent >
+ ToolboxController_Base;
+
+class SVT_DLLPUBLIC ToolboxController :
+ public ToolboxController_Base,
+ public ::comphelper::OMutexAndBroadcastHelper,
+ public ::comphelper::OPropertyContainer,
+ public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >
+{
+ private:
+ bool m_bSupportVisible;
+ public:
+ ToolboxController( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XFrame >& xFrame,
+ const OUString& aCommandURL );
+ ToolboxController();
+ virtual ~ToolboxController() override;
+
+ css::uno::Reference< css::frame::XFrame > getFrameInterface() const;
+ const css::uno::Reference< css::uno::XComponentContext >& getContext() const;
+ css::uno::Reference< css::frame::XLayoutManager > getLayoutManager() const;
+
+ void updateStatus( const OUString& aCommandURL );
+ void updateStatus();
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+ virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
+ // XUpdatable
+ virtual void SAL_CALL update() override;
+
+ // XComponent
+ virtual void SAL_CALL dispose() override;
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
+
+ // XEventListener
+ using cppu::OPropertySetHelper::disposing;
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override = 0;
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) override;
+ virtual void SAL_CALL click() override;
+ virtual void SAL_CALL doubleClick() override;
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override;
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) override;
+ // OPropertySetHelper
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& rConvertedValue, css::uno::Any& rOldValue, sal_Int32 nHandle, const css::uno::Any& rValue) override;
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+
+
+ const OUString& getCommandURL() const { return m_aCommandURL; }
+ const OUString& getModuleName() const { return m_sModuleName; }
+
+ void dispatchCommand( const OUString& sCommandURL, const css::uno::Sequence< css::beans::PropertyValue >& rArgs, const OUString &rTarget = OUString() );
+
+ void enable( bool bEnable );
+
+ bool IsInSidebar() const { return m_bSidebar; }
+
+ protected:
+ bool getToolboxId( ToolBoxItemId& rItemId, ToolBox** ppToolBox );
+ struct Listener
+ {
+ Listener( const css::util::URL& rURL, const css::uno::Reference< css::frame::XDispatch >& rDispatch ) :
+ aURL( rURL ), xDispatch( rDispatch ) {}
+
+ css::util::URL aURL;
+ css::uno::Reference< css::frame::XDispatch > xDispatch;
+ };
+
+ struct DispatchInfo
+ {
+ css::uno::Reference< css::frame::XDispatch > mxDispatch;
+ const css::util::URL maURL;
+ const css::uno::Sequence< css::beans::PropertyValue > maArgs;
+
+ DispatchInfo( const css::uno::Reference< css::frame::XDispatch >& xDispatch,
+ const css::util::URL& rURL,
+ const css::uno::Sequence< css::beans::PropertyValue >& rArgs )
+ : mxDispatch( xDispatch )
+ , maURL( rURL )
+ , maArgs( rArgs )
+ {}
+ };
+
+ DECL_DLLPRIVATE_STATIC_LINK( ToolboxController, ExecuteHdl_Impl, void*, void );
+
+ typedef std::unordered_map< OUString,
+ css::uno::Reference< css::frame::XDispatch > > URLToDispatchMap;
+
+ // methods to support status forwarder, known by the old sfx2 toolbox controller implementation
+ void addStatusListener( const OUString& aCommandURL );
+ void removeStatusListener( const OUString& aCommandURL );
+ void bindListener();
+ void unbindListener();
+
+ // TODO remove
+ const css::uno::Reference< css::util::XURLTransformer >& getURLTransformer() const { return m_xUrlTransformer;}
+ // TODO remove
+ const css::uno::Reference< css::awt::XWindow >& getParent() const { return m_xParentWindow;}
+
+ bool m_bInitialized,
+ m_bDisposed,
+ m_bSidebar;
+ ToolBoxItemId m_nToolBoxId;
+ css::uno::Reference< css::frame::XFrame > m_xFrame;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ OUString m_aCommandURL;
+ URLToDispatchMap m_aListenerMap;
+ comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener
+
+ css::uno::Reference< css::awt::XWindow > m_xParentWindow;
+ css::uno::Reference< css::util::XURLTransformer > m_xUrlTransformer;
+ OUString m_sModuleName;
+ weld::Toolbar* m_pToolbar;
+ weld::Builder* m_pBuilder;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/unitconv.hxx b/include/svtools/unitconv.hxx
new file mode 100644
index 000000000..ab9bdf50a
--- /dev/null
+++ b/include/svtools/unitconv.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <tools/mapunit.hxx>
+#include <tools/fldunit.hxx>
+#include <tools/long.hxx>
+
+namespace weld { class MetricSpinButton; }
+
+// macro -----------------------------------------------------------------
+
+// typedef ---------------------------------------------------------------
+
+typedef tools::Long (*FUNC_CONVERT)(tools::Long);
+
+// Functions -------------------------------------------------------------
+
+SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton& rCtrl, FieldUnit eUnit, bool bAll = false);
+
+SVT_DLLPUBLIC tools::Long CalcToUnit( float nIn, MapUnit eUnit );
+SVT_DLLPUBLIC tools::Long CalcToPoint( tools::Long nIn, MapUnit eUnit, sal_uInt16 nFactor );
+
+SVT_DLLPUBLIC tools::Long ItemToControl( tools::Long nIn, MapUnit eItem, FieldUnit eCtrl );
+SVT_DLLPUBLIC tools::Long ControlToItem( tools::Long nIn, FieldUnit eCtrl, MapUnit eItem );
+
+SVT_DLLPUBLIC FieldUnit MapToFieldUnit( const MapUnit eUnit );
+
+SVT_DLLPUBLIC void SetMetricValue(weld::MetricSpinButton& rField, sal_Int64 nCoreValue, MapUnit eUnit);
+SVT_DLLPUBLIC sal_Int64 GetCoreValue(const weld::MetricSpinButton& rField, MapUnit eUnit);
+
+SVT_DLLPUBLIC tools::Long TransformMetric( tools::Long nVal, FieldUnit aOld, FieldUnit aNew );
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/unoevent.hxx b/include/svtools/unoevent.hxx
new file mode 100644
index 000000000..825280e16
--- /dev/null
+++ b/include/svtools/unoevent.hxx
@@ -0,0 +1,259 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <vector>
+#include <memory>
+
+namespace com :: sun :: star :: uno { class XInterface; }
+
+class SvxMacroTableDtor;
+class SvxMacroItem;
+class SvxMacro;
+enum class SvMacroItemId : sal_uInt16;
+
+/** SvEventDescription: Description of a single event.
+ mnEvent is the id used by SvxMacroItem
+ mpEventName is the api name for this event
+
+ the last event in an array is indicated by mnEvent && mpEventName == 0
+*/
+struct SvEventDescription
+{
+ SvMacroItemId mnEvent;
+ const char* mpEventName;
+};
+
+/**
+ * SvBaseEventDescriptor: Abstract class that implements the basics
+ * of an XNameReplace that is delivered by the
+ * XEventsSupplier::getEvents() method.
+ *
+ * The functionality this class provides is:
+ * 1) Which elements are in the XNameReplace?
+ * 2) Mapping from Api names to item IDs.
+ * 3) conversion from SvxMacroItem to Any and vice versa.
+ *
+ * All details of how to actually get and set SvxMacroItem(s) have to
+ * be supplied by the base class.
+ */
+class SVT_DLLPUBLIC SvBaseEventDescriptor : public cppu::WeakImplHelper
+<
+ css::container::XNameReplace,
+ css::lang::XServiceInfo
+>
+{
+protected:
+ /// last element is 0, 0
+ const SvEventDescription* mpSupportedMacroItems;
+ sal_Int16 mnMacroItems;
+
+public:
+
+ SvBaseEventDescriptor(const SvEventDescription* pSupportedMacroItems);
+
+ virtual ~SvBaseEventDescriptor() override;
+
+
+ // XNameReplace
+ /// calls replaceByName(const sal_uInt16, const SvxMacro&)
+ virtual void SAL_CALL replaceByName(
+ const OUString& rName, /// API name of event
+ const css::uno::Any& rElement ) /// event (PropertyValues)
+ override;
+
+ // XNameAccess (via XNameReplace)
+ /// calls getByName(sal_uInt16)
+ virtual css::uno::Any SAL_CALL getByName(
+ const OUString& rName ) /// API name of event
+ override;
+
+ // XNameAxcess (via XNameReplace)
+ virtual css::uno::Sequence< OUString > SAL_CALL
+ getElementNames() override;
+
+ // XNameAccess (via XNameReplace)
+ virtual sal_Bool SAL_CALL hasByName(
+ const OUString& rName ) override;
+
+ // XElementAccess (via XNameReplace)
+ virtual css::uno::Type SAL_CALL getElementType() override;
+
+ // XElementAccess (via XNameReplace)
+ virtual sal_Bool SAL_CALL hasElements() override;
+
+ // XServiceInfo
+ /// must be implemented in subclass
+ virtual OUString SAL_CALL getImplementationName() override = 0;
+
+ // XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+
+ // XServiceInfo
+ virtual css::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames() override;
+
+protected:
+
+ /// Must be implemented in subclass.
+ ///
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::container::NoSuchElementException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void replaceByName(
+ const SvMacroItemId nEvent, /// item ID of event
+ const SvxMacro& rMacro) /// event (will be copied)
+ = 0;
+
+ /// Must be implemented in subclass.
+ ///
+ /// @throws css::container::NoSuchElementException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void getByName(
+ SvxMacro& rMacro,
+ const SvMacroItemId nEvent ) = 0;
+
+ /// convert an API event name to the event ID as used by SvxMacroItem
+ SvMacroItemId mapNameToEventID(std::u16string_view rName) const;
+
+ /// get the event ID for the name; return 0 if not supported
+ SvMacroItemId getMacroID(std::u16string_view rName) const;
+};
+
+
+/**
+ * SvEventDescriptor: Implement the XNameReplace that is delivered by
+ * the XEventsSupplier::getEvents() method. The SvEventDescriptor has
+ * to be subclassed to implement the events for a specific
+ * objects. The subclass has to
+ * 1) supply the super class constructor with a list of known events (item IDs)
+ * 2) supply the super class constructor with a reference of its parent object
+ * (to prevent destruction)
+ * 3) implement getItem() and setItem(...) methods.
+ *
+ * If no object is available to which the SvEventDescriptor can attach itself,
+ * the class SvDetachedEventDescriptor should be used.
+ */
+class SVT_DLLPUBLIC SvEventDescriptor : public SvBaseEventDescriptor
+{
+ /// keep reference to parent to prevent it from being destroyed
+ css::uno::Reference< css::uno::XInterface > xParentRef;
+
+public:
+
+ SvEventDescriptor(css::uno::XInterface& rParent,
+ const SvEventDescription* pSupportedMacroItems);
+
+ virtual ~SvEventDescriptor() override;
+
+
+protected:
+
+
+ using SvBaseEventDescriptor::replaceByName;
+ virtual void replaceByName(
+ const SvMacroItemId nEvent, /// item ID of event
+ const SvxMacro& rMacro) /// event (will be copied)
+ override;
+
+ using SvBaseEventDescriptor::getByName;
+ virtual void getByName(
+ SvxMacro& rMacros, /// macro to be filled with values
+ const SvMacroItemId nEvent ) /// item ID of event
+ override;
+
+
+ /// Get the SvxMacroItem from the parent.
+ /// must be implemented by subclass
+ virtual const SvxMacroItem& getMacroItem() = 0;
+
+ /// Set the SvxMacroItem at the parent.
+ /// must be implemented by subclass
+ virtual void setMacroItem(const SvxMacroItem& rItem) = 0;
+
+ /// Get the SvxMacroItem Which Id needed for the current application
+ /// must be implemented by subclass
+ virtual sal_uInt16 getMacroItemWhich() const = 0;
+};
+
+
+/**
+ * SvDetachedEventDescriptor:
+ */
+class SVT_DLLPUBLIC SvDetachedEventDescriptor : public SvBaseEventDescriptor
+{
+ // the macros; aMacros[i] is the value for aSupportedMacroItemIDs[i]
+ std::vector<std::unique_ptr<SvxMacro>> aMacros;
+
+public:
+
+ SvDetachedEventDescriptor(const SvEventDescription* pSupportedMacroItems);
+ SvDetachedEventDescriptor& operator=( SvDetachedEventDescriptor const & ) = delete; // MSVC2015 workaround
+ SvDetachedEventDescriptor( SvDetachedEventDescriptor const & ) = delete; // MSVC2015 workaround
+
+ virtual ~SvDetachedEventDescriptor() override;
+
+ //XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+
+protected:
+
+ sal_Int16 getIndex(const SvMacroItemId nID) const;
+
+ using SvBaseEventDescriptor::replaceByName;
+ virtual void replaceByName(
+ const SvMacroItemId nEvent, /// item ID of event
+ const SvxMacro& rMacro) /// event (will be copied)
+ override;
+
+ using SvBaseEventDescriptor::getByName;
+ virtual void getByName(
+ SvxMacro& rMacro, /// macro to be filled
+ const SvMacroItemId nEvent ) /// item ID of event
+ override;
+
+ /// do we have an event?
+ /// return true: we have a macro for the event
+ /// return false: no macro; getByName() will return an empty macro
+ /// @throws css::lang::IllegalArgumentException if the event is not supported
+ bool hasById(
+ const SvMacroItemId nEvent ) const; /// item ID of event
+
+};
+
+class SVT_DLLPUBLIC SvMacroTableEventDescriptor final : public SvDetachedEventDescriptor
+{
+public:
+
+ SvMacroTableEventDescriptor(const SvEventDescription* pSupportedMacroItems);
+ SvMacroTableEventDescriptor(const SvxMacroTableDtor& aFmt,
+ const SvEventDescription* pSupportedMacroItems);
+
+ virtual ~SvMacroTableEventDescriptor() override;
+
+ void copyMacrosIntoTable(SvxMacroTableDtor& aFmt);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/unoimap.hxx b/include/svtools/unoimap.hxx
new file mode 100644
index 000000000..f668aaa38
--- /dev/null
+++ b/include/svtools/unoimap.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com :: sun :: star :: uno { class XInterface; }
+
+class ImageMap;
+struct SvEventDescription;
+
+SVT_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvUnoImageMapRectangleObject_createInstance( const SvEventDescription* pSupportedMacroItems );
+SVT_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvUnoImageMapCircleObject_createInstance( const SvEventDescription* pSupportedMacroItems );
+SVT_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvUnoImageMapPolygonObject_createInstance( const SvEventDescription* pSupportedMacroItems );
+
+SVT_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvUnoImageMap_createInstance();
+SVT_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvUnoImageMap_createInstance( const ImageMap& rMap, const SvEventDescription* pSupportedMacroItems );
+SVT_DLLPUBLIC bool SvUnoImageMap_fillImageMap( const css::uno::Reference< css::uno::XInterface >& xImageMap, ImageMap& rMap );
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/urlfilter.hxx b/include/svtools/urlfilter.hxx
new file mode 100644
index 000000000..e62902d34
--- /dev/null
+++ b/include/svtools/urlfilter.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <svtools/svtdllapi.h>
+#include <tools/wldcrd.hxx>
+#include <vector>
+
+struct UNLESS_MERGELIBS(SVT_DLLPUBLIC) FilterMatch
+{
+private:
+ const OUString& m_rCompareString;
+public:
+ FilterMatch( const OUString& _rCompareString ) : m_rCompareString( _rCompareString ) { }
+
+ bool operator()( const WildCard& _rMatcher )
+ {
+ return _rMatcher.Matches( m_rCompareString );
+ }
+
+ static void createWildCardFilterList(const OUString& _rFilterList,::std::vector< WildCard >& _rFilters);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
new file mode 100644
index 000000000..9fe1b885e
--- /dev/null
+++ b/include/svtools/valueset.hxx
@@ -0,0 +1,412 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <tools/wintypes.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/image.hxx>
+#include <memory>
+#include <vector>
+
+class MouseEvent;
+class TrackingEvent;
+class HelpEvent;
+class KeyEvent;
+class DataChangedEvent;
+class ScrollBar;
+class UserDrawEvent;
+class VirtualDevice;
+
+struct ValueSetItem;
+
+enum class DrawFrameStyle;
+
+/*************************************************************************
+
+Description
+============
+
+class ValueSet
+
+This class allows the selection of an item. In the process items are
+drawn side by side. The selection of items can be more clear than in a
+ListBox shape for example in case of colors or samples.
+The amount of columns drawn by the control and whether the items
+should be encircled can be specified. Optional a NoSelection or name
+field could be shown. By default image and color items are supported.
+Items could be drawn by oneself if InsertItem() is only called with
+an ID. To achieve this the UserDraw handler needs to be overridden. The
+description text could be specified afterwards in case of UserDraw
+and any other items.
+
+Cross references
+
+class ListBox
+
+--------------------------------------------------------------------------
+
+WinBits
+
+WB_FLATVALUESET Flat Look (if you set WB_ITEMBORDER or WB_DOUBLEBORDER,
+ then you get extra border space, but the Borders
+ aren't painted),
+WB_ITEMBORDER Items will be bordered
+WB_DOUBLEBORDER Items will be bordered twice. Additionally WB_ITEMBORDER
+ has to be set, as otherwise this WinBit wouldn't have any
+ effect. It is needed if there are items with a white
+ background, since otherwise the 3D effect wouldn't be
+ recognizable.
+WB_NAMEFIELD There is a namefield, where the name of an item will be
+ shown.
+WB_NONEFIELD There is a NoSelection field which can be selected if
+ 0 is passed along with SelectItem. Respectively
+ GetSelectedItemId() returns 0 if this field or nothing
+ is selected. This field shows the text which is specified
+ by SetText() respectively no one, if no text was set. With
+ SetNoSelection() the selection can be disabled.
+WB_VSCROLL A scrollbar will be always shown. The visible number of
+ lines have to be specified with SetLineCount() if this
+ flag is set.
+WB_BORDER A border will be drawn around the window.
+WB_TABSTOP It is possible to jump into the ValueSet with the tab key.
+WB_NOTABSTOP It is not possible to jump into the ValueSet with the
+ tab key.
+WB_NO_DIRECTSELECT Cursor travelling doesn't call select immediately. To
+ execute the selection <RETURN> has to be pressed.
+--------------------------------------------------------------------------
+
+The number of columns must be either set with SetColCount() or
+SetItemWidth(). If the number of columns is specified by SetColCount()
+the width of the items will be calculated by the visible range.
+If the items should have a static width, it has to be specified
+with SetItemWidth(). In this case the number of columns will be calculated
+by the visible range.
+
+The number of rows is given by the number of items / number of columns. The
+number of visible rows must either specified by SetLineCount() or
+SetItemWidth(). If the number of visible rows is specified by SetLineCount(),
+the height of the items will be calculated from the visible height. If the
+items should have a fixed height it has to be specified with SetItemHeight().
+In this case the number of visible rows is then calculated from the visible
+height. If the number of visible rows is neither specified by SetLineCount()
+nor by SetItemHeight() all rows will be shown. The height of the items will
+be calculated by the visible height. If the number of visible rows is
+specified by SetLineCount() or SetItemHeight() ValueSet does scroll
+automatically when more lines are available, as are visible. If scrolling
+should be also possible with a ScrollBar WB_VSCROLL needs to be set.
+
+The distance between the items can be increased by SetExtraSpacing(). The
+distance, which will be shown between two items (both in x and in y), is
+measured in pixels.
+
+The exact window size for a specific item size can be calculated by
+CalcWindowSizePixel(). To do this all relevant data (number of columns/...)
+have to be specified and if no number of rows was set, all items need to
+be inserted. If the window was created with WB_BORDER/Border=sal_True the
+size has to be specified with SetOutputSizePixel(). In other cases different
+size-methods can be used. With CalcItemSize() the inner and outer size of
+an item could be calculated (for this the free space defined by
+SetExtraSpacing() will not be included).
+
+The background color could be specified by SetColor(), with which the image
+or UserDraw items will be underlaid. If no color is specified the color
+of other windows (WindowColor) will be used for the background.
+
+--------------------------------------------------------------------------
+
+At first all items should be inserted and only then Show() should be called
+since the output area will be precomputed. If this is not done the first
+Paint will appear a little bit slower. Therefore the Control, if it is loaded
+from the resource and only supplied with items during runtime, should be
+loaded with Hide = sal_True and then displayed with Show().
+
+In case of a visible Control the creation of the new output area could be
+activated before Paint by calling Format().
+
+--------------------------------------------------------------------------
+
+If Drag and Drop will be called from the ValueSet the Command-Handler has to
+be overridden. From this StartDrag needs to be called. If this method returns
+sal_True the drag-process could be initiated by ExecuteDrag(), otherwise no
+processing will take place. This method makes sure that ValueSet stops its
+processing and as appropriate selects the entry. Therefore the calling of
+Select-Handler within this function must be expected.
+
+For dropping QueryDrop() and Drop() need to be overridden and ShowDropPos()
+and HideDropPos() should be called within these methods.
+To show the insertion point ShowDropPos() has to be called within the
+QueryDrop-Handler. ShowDropPos() also scrolls the ValueSet if the passed
+position is located at the window border. Furthermore ShowDropPos() returns
+the position, at which the item should be inserted respectively which
+insertion point was shown. If no insertion point was determined
+VALUESET_ITEM_NOTFOUND will be returned. If the window was left during dragging
+or the drag process is terminated HideDropPos() should be called in any case.
+
+--------------------------------------------------------------------------
+
+This class is currently still in the SV-Tools. That's why the ValueSet needs
+to be loaded as a Control out of the resource and the desired WinBits have
+to be set (before Show) with SetStyle().
+
+*************************************************************************/
+
+typedef std::vector<std::unique_ptr<ValueSetItem>> ValueItemList;
+
+#define WB_ITEMBORDER (WinBits(0x00010000))
+#define WB_DOUBLEBORDER (WinBits(0x00020000))
+#define WB_NAMEFIELD (WinBits(0x00040000))
+#define WB_NONEFIELD (WinBits(0x00080000))
+#define WB_FLATVALUESET (WinBits(0x02000000))
+#define WB_NO_DIRECTSELECT (WinBits(0x04000000))
+#define WB_MENUSTYLEVALUESET (WinBits(0x08000000))
+
+#define VALUESET_APPEND (size_t(-1))
+#define VALUESET_ITEM_NOTFOUND (size_t(-1))
+
+class SVT_DLLPUBLIC ValueSet : public weld::CustomWidgetController
+{
+private:
+ ScopedVclPtr<VirtualDevice> maVirDev;
+ css::uno::Reference<css::accessibility::XAccessible> mxAccessible;
+ ValueItemList mItemList;
+ std::unique_ptr<ValueSetItem> mpNoneItem;
+ std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow;
+ tools::Rectangle maNoneItemRect;
+ tools::Rectangle maItemListRect;
+ tools::Long mnItemWidth;
+ tools::Long mnItemHeight;
+ tools::Long mnTextOffset;
+ tools::Long mnVisLines;
+ tools::Long mnLines;
+ tools::Long mnUserItemWidth;
+ tools::Long mnUserItemHeight;
+ sal_uInt16 mnSelItemId;
+ int mnSavedItemId;
+ sal_uInt16 mnHighItemId;
+ sal_uInt16 mnCols;
+ sal_uInt16 mnCurCol;
+ sal_uInt16 mnUserCols;
+ sal_uInt16 mnUserVisLines;
+ sal_uInt16 mnFirstLine;
+ sal_uInt16 mnSpacing;
+ DrawFrameStyle mnFrameStyle;
+ Color maColor;
+ OUString maText;
+ WinBits mnStyle;
+ Link<ValueSet*,void> maDoubleClickHdl;
+ Link<ValueSet*,void> maSelectHdl;
+
+ bool mbFormat : 1;
+ bool mbHighlight : 1;
+ bool mbNoSelection : 1;
+ bool mbDoubleSel : 1;
+ bool mbScroll : 1;
+ bool mbFullMode : 1;
+ bool mbEdgeBlending : 1;
+ bool mbHasVisibleItems : 1;
+
+ friend class ValueItemAcc;
+ friend class ValueSetAcc;
+
+ SVT_DLLPRIVATE void ImplDeleteItems();
+ SVT_DLLPRIVATE void ImplFormatItem(vcl::RenderContext const & rRenderContext, ValueSetItem* pItem, tools::Rectangle aRect);
+ SVT_DLLPRIVATE void ImplDrawItemText(vcl::RenderContext& rRenderContext, const OUString& rStr);
+ // nItemId is the item to draw selected, but if nothing is selected something else may be drawn as selected instead, the item to draw
+ // selected is returned
+ SVT_DLLPRIVATE ValueSetItem* ImplGetDrawSelectItem(sal_uInt16 nItemId, const bool bFocus, tools::Rectangle& rRect);
+ SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext,
+ const tools::Rectangle& rRect, const ValueSetItem* pItem,
+ const bool bFocus, const bool bDrawSel,
+ const bool bSelected, const bool bHover);
+ SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext);
+ SVT_DLLPRIVATE void ImplHighlightItem(sal_uInt16 nItemId);
+ SVT_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext);
+ SVT_DLLPRIVATE size_t ImplGetItem( const Point& rPoint ) const;
+ SVT_DLLPRIVATE ValueSetItem* ImplGetItem( size_t nPos );
+ SVT_DLLPRIVATE ValueSetItem* ImplGetFirstItem();
+ SVT_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const;
+ SVT_DLLPRIVATE void ImplInsertItem( std::unique_ptr<ValueSetItem> pItem, const size_t nPos );
+ SVT_DLLPRIVATE tools::Rectangle ImplGetItemRect( size_t nPos ) const;
+ SVT_DLLPRIVATE void ImplFireAccessibleEvent( short nEventId, const css::uno::Any& rOldValue, const css::uno::Any& rNewValue );
+ SVT_DLLPRIVATE bool ImplHasAccessibleListeners() const;
+ SVT_DLLPRIVATE void ImplTracking(bool bLeaveWindow, const Point& rPos);
+ SVT_DLLPRIVATE void QueueReformat();
+ SVT_DLLPRIVATE void SetFirstLine(sal_uInt16 nNewFirstLine); // set mnFirstLine and update scrollbar to match
+ SVT_DLLPRIVATE void RecalcScrollBar();
+ SVT_DLLPRIVATE bool TurnOffScrollBar();
+ SVT_DLLPRIVATE void TurnOnScrollBar();
+ DECL_DLLPRIVATE_LINK(ImplScrollHdl, weld::ScrolledWindow&, void);
+
+ Size GetLargestItemSize();
+
+ ValueSet (const ValueSet &) = delete;
+ ValueSet & operator= (const ValueSet &) = delete;
+
+protected:
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
+ weld::ScrolledWindow* GetScrollBar() const { return mxScrolledWindow.get(); }
+
+public:
+ ValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow);
+ virtual ~ValueSet() override;
+
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+
+ virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual bool MouseMove( const MouseEvent& rMEvt ) override;
+ virtual bool KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void Resize() override;
+ virtual void StyleUpdated() override;
+ virtual void Show() override;
+ virtual void Hide() override;
+ virtual OUString RequestHelp(tools::Rectangle& rHelpRect) override;
+
+ virtual void Select();
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ OUString const & GetText() const { return maText; }
+ void SetText(const OUString& rText) { maText = rText; }
+ void SetStyle(WinBits nStyle);
+ WinBits GetStyle() const { return mnStyle; }
+
+ void SetOptimalSize();
+
+ /// Insert @rImage item.
+ void InsertItem(sal_uInt16 nItemId, const Image& rImage);
+ /// Insert @rImage item with @rStr as either a legend or tooltip depending on @bShowLegend.
+ void InsertItem(sal_uInt16 nItemId, const Image& rImage,
+ const OUString& rStr, size_t nPos = VALUESET_APPEND, bool bShowLegend = false);
+ /// Insert an @rColor item with @rStr tooltip.
+ void InsertItem(sal_uInt16 nItemId, const Color& rColor,
+ const OUString& rStr);
+ /// Insert an User Drawn item.
+ void InsertItem(sal_uInt16 nItemId, size_t nPos = VALUESET_APPEND);
+ /// Insert an User Drawn item with @rStr tooltip.
+ void InsertItem(sal_uInt16 nItemId, const OUString& rStr, size_t nPos);
+ void RemoveItem(sal_uInt16 nItemId);
+
+ void Clear();
+
+ size_t GetItemCount() const;
+ size_t GetItemPos( sal_uInt16 nItemId ) const;
+ sal_uInt16 GetItemId( size_t nPos ) const;
+ sal_uInt16 GetItemId( const Point& rPos ) const;
+ tools::Rectangle GetItemRect( sal_uInt16 nItemId ) const;
+ void EnableFullItemMode( bool bFullMode );
+
+ void SetColCount( sal_uInt16 nNewCols = 1 );
+ sal_uInt16 GetColCount() const
+ {
+ return mnUserCols;
+ }
+ void SetLineCount( sal_uInt16 nNewLines = 0 );
+ sal_uInt16 GetLineCount() const
+ {
+ return mnUserVisLines;
+ }
+ void SetItemWidth( tools::Long nItemWidth );
+ void SetItemHeight( tools::Long nLineHeight );
+
+ void SelectItem( sal_uInt16 nItemId );
+ sal_uInt16 GetSelectedItemId() const
+ {
+ return mnSelItemId;
+ }
+ size_t GetSelectItemPos() const
+ {
+ return GetItemPos( mnSelItemId );
+ }
+ bool IsItemSelected( sal_uInt16 nItemId ) const
+ {
+ return !mbNoSelection && (nItemId == mnSelItemId);
+ }
+ void SetNoSelection();
+ bool IsNoSelection() const
+ {
+ return mbNoSelection;
+ }
+
+ void RecalculateItemSizes();
+
+ void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
+ Image GetItemImage( sal_uInt16 nItemId ) const;
+ void SetItemColor( sal_uInt16 nItemId, const Color& rColor );
+ Color GetItemColor( sal_uInt16 nItemId ) const;
+ void SetItemData( sal_uInt16 nItemId, void* pData );
+ void* GetItemData( sal_uInt16 nItemId ) const;
+ void SetItemText( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetItemText( sal_uInt16 nItemId ) const;
+ void SetColor( const Color& rColor );
+ void SetColor()
+ {
+ SetColor(COL_TRANSPARENT);
+ }
+ bool IsColor() const
+ {
+ return !maColor.IsTransparent();
+ }
+
+ void SetExtraSpacing( sal_uInt16 nNewSpacing );
+
+ void Format(vcl::RenderContext const & rRenderContext);
+ void SetFormat();
+
+ Size CalcWindowSizePixel(const Size& rItemSize,
+ sal_uInt16 nCalcCols = 0,
+ sal_uInt16 nCalcLines = 0) const;
+ Size CalcItemSizePixel(const Size& rSize) const;
+ int GetScrollWidth() const;
+
+ void SetSelectHdl(const Link<ValueSet*,void>& rLink)
+ {
+ maSelectHdl = rLink;
+ }
+
+ void SetDoubleClickHdl(const Link<ValueSet*,void>& rLink)
+ {
+ maDoubleClickHdl = rLink;
+ }
+
+ bool GetEdgeBlending() const
+ {
+ return mbEdgeBlending;
+ }
+ void SetEdgeBlending(bool bNew);
+
+ void SaveValue()
+ {
+ mnSavedItemId = IsNoSelection() ? -1 : GetSelectedItemId();
+ }
+
+ bool IsValueChangedFromSaved() const
+ {
+ int nItemId = IsNoSelection() ? -1 : GetSelectedItemId();
+ return mnSavedItemId != nItemId;
+ }
+
+ virtual FactoryFunction GetUITestFactory() const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibilityCheckDialog.hxx b/include/svx/AccessibilityCheckDialog.hxx
new file mode 100644
index 000000000..e3e1e201f
--- /dev/null
+++ b/include/svx/AccessibilityCheckDialog.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_SVX_ACCESSIBILITYCHECKDIALOG_HXX
+#define INCLUDED_SVX_ACCESSIBILITYCHECKDIALOG_HXX
+
+#include <sfx2/AccessibilityIssue.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/link.hxx>
+#include <vcl/weld.hxx>
+
+namespace svx
+{
+class AccessibilityCheckEntry final
+{
+private:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::Label> m_xLabel;
+ std::unique_ptr<weld::Button> m_xGotoButton;
+
+ std::shared_ptr<sfx::AccessibilityIssue> const& m_pAccessibilityIssue;
+
+public:
+ AccessibilityCheckEntry(weld::Container* pParent,
+ std::shared_ptr<sfx::AccessibilityIssue> const& pAccessibilityIssue);
+
+ weld::Widget* get_widget() const { return m_xContainer.get(); }
+
+ DECL_LINK(GotoButtonClicked, weld::Button&, void);
+};
+
+class SVX_DLLPUBLIC AccessibilityCheckDialog final : public weld::GenericDialogController
+{
+private:
+ sfx::AccessibilityIssueCollection m_aIssueCollection;
+ std::vector<std::unique_ptr<AccessibilityCheckEntry>> m_aAccessibilityCheckEntries;
+
+ // Controls
+ std::unique_ptr<weld::Box> m_xAccessibilityCheckBox;
+
+public:
+ AccessibilityCheckDialog(weld::Window* pParent,
+ sfx::AccessibilityIssueCollection const& rIssueCollection);
+ virtual ~AccessibilityCheckDialog() override;
+};
+
+} // end svx namespace
+
+#endif // INCLUDED_SVX_ACCESSIBILITYCHECKDIALOG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleControlShape.hxx b/include/svx/AccessibleControlShape.hxx
new file mode 100644
index 000000000..a90ab5ee9
--- /dev/null
+++ b/include/svx/AccessibleControlShape.hxx
@@ -0,0 +1,207 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ACCESSIBLECONTROLSHAPE_HXX
+#define INCLUDED_SVX_ACCESSIBLECONTROLSHAPE_HXX
+
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/XModeChangeListener.hpp>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svx/AccessibleShape.hxx>
+
+namespace com::sun::star {
+ namespace accessibility { class XAccessible; }
+ namespace accessibility { class XAccessibleContext; }
+ namespace accessibility { struct AccessibleEventObject; }
+ namespace accessibility { class XAccessibleRelationSet; }
+ namespace awt { class XControl; }
+ namespace beans { class XPropertySet; }
+ namespace beans { class XPropertySetInfo; }
+ namespace beans { struct PropertyChangeEvent; }
+ namespace container { struct ContainerEvent; }
+ namespace lang { class XComponent; }
+ namespace lang { class XTypeProvider; }
+ namespace uno { class XAggregation; }
+ namespace util { struct ModeChangeEvent; }
+}
+
+namespace comphelper
+{
+ class OWrappedAccessibleChildrenManager;
+}
+
+namespace accessibility {
+
+ class AccessibleShapeInfo;
+ class AccessibleShapeTreeInfo;
+
+ typedef ::cppu::ImplHelper4 < css::beans::XPropertyChangeListener
+ , css::util::XModeChangeListener
+ , css::container::XContainerListener
+ , css::accessibility::XAccessibleEventListener
+ > AccessibleControlShape_Base;
+/** @descr
+*/
+class SAL_DLLPUBLIC_RTTI AccessibleControlShape final
+ :public AccessibleShape
+ ,public AccessibleControlShape_Base
+{
+public:
+ //===== internal ========================================================
+ AccessibleControlShape(
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+ virtual ~AccessibleControlShape( ) override;
+
+ const css::uno::Reference< css::beans::XPropertySet >& GetControlModel( ) const { return m_xControlModel;}
+ AccessibleControlShape* GetLabeledByControlShape();
+
+private:
+ //--- XAccessibleComponent -------------------------------
+ /// forward the focus to the contained control(in alive mode)
+ virtual void SAL_CALL grabFocus( ) override;
+
+ //--- XAccessibleContext ---------------------------------
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
+
+ //--- XServiceInfo ---------------------------------------
+ virtual OUString SAL_CALL getImplementationName( ) override;
+
+ //--- XInterface -----------------------------------------
+ DECLARE_XINTERFACE( )
+
+ //--- XTypeProvider --------------------------------------
+ DECLARE_XTYPEPROVIDER( )
+
+ //--- XPropertyChangeListener ----------------------------
+ virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& _rEvent ) override;
+
+ //--- XComponent -----------------------------------------
+ virtual void SAL_CALL disposing( ) override;
+
+ //--- XEventListener -------------------------------------
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ //--- XModeChangeListener --------------------------------
+ virtual void SAL_CALL modeChanged( const css::util::ModeChangeEvent& _rSource ) override;
+
+ //--- XAccessibleEventListener ----------------------------
+ virtual void SAL_CALL notifyEvent( const css::accessibility::AccessibleEventObject& aEvent ) override;
+
+ // XVclContainerListener
+ virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override;
+ virtual void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override;
+ virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
+
+ /** Initialize a new shape. See the documentation of the base' constructor
+ for the reason of this method's existence.
+ */
+ virtual void Init( ) override;
+
+ /// Create a name string that contains the accessible name.
+ virtual OUString
+ CreateAccessibleBaseName( ) override;
+
+ /** Create a unique name string that contains the accessible name. The
+ name consists of the base name and the index.
+ */
+ virtual OUString
+ CreateAccessibleName( ) override;
+
+ /// Create a description string that contains the accessible description.
+ OUString CreateAccessibleDescription();
+
+#ifdef DBG_UTIL
+ /// Set the specified state
+ virtual bool SetState( sal_Int16 _nState ) override;
+#endif // DBG_UTIL
+
+ /// (safely) reads the given property from the model of the UNO control
+ OUString getControlModelStringProperty( const OUString& _rPropertyName ) const;
+
+ /// ensure that our control model exists(will be retrieved upon need only)
+ bool ensureControlModelAccess( );
+
+ /// ensures that we're listening for the given property if(and only if!) necessary
+ bool ensureListeningState( const bool _bCurrentlyListening, const bool _bNeedNewListening,
+ const OUString& _rPropertyName );
+
+ /// starts multiplexing the state changes of our aggregate context
+ void startStateMultiplexing( );
+ /// stops multiplexing the state changes of our aggregate context
+ void stopStateMultiplexing( );
+
+ /** adjusts our AccessibleRole, depending on the control type we're working for
+
+ <p>Only to be called during initialization</p>
+ */
+ void adjustAccessibleRole( );
+
+ /** initializes composed states of the context
+
+ <p>Some of the states of our inner context need to be propagated to the "composed context", too
+ (such as "checked" for check boxes). At lifetime, this is done by multiplexing state changes,
+ at initialization time, this method is used.</p>
+ */
+ void initializeComposedState( );
+
+ AccessibleControlShape(const AccessibleControlShape&) = delete;
+ AccessibleControlShape& operator= (const AccessibleControlShape&) = delete;
+
+ css::uno::Reference< css::beans::XPropertySet >
+ m_xControlModel;
+ css::uno::Reference< css::beans::XPropertySetInfo >
+ m_xModelPropsMeta; // cache this for performance reasons
+ css::uno::Reference< css::awt::XControl >
+ m_xUnoControl; // our UNO control
+
+ css::uno::WeakReference< css::accessibility::XAccessibleContext >
+ m_aControlContext; // the AccessibleContext of the control
+ css::uno::Reference< css::uno::XAggregation >
+ m_xControlContextProxy; // the proxy for "aggregating" the AccessibleContext of the control
+ css::uno::Reference< css::lang::XTypeProvider >
+ m_xControlContextTypeAccess; // cached interface of our aggregate
+ css::uno::Reference< css::lang::XComponent >
+ m_xControlContextComponent; // cached interface of our aggregate
+
+ rtl::Reference<::comphelper::OWrappedAccessibleChildrenManager>
+ m_pChildManager;
+
+ bool m_bListeningForName : 1; // are we currently listening for changes of the "Name" property?
+ bool m_bListeningForDesc : 1; // are we currently listening for changes of the "HelpText" property?
+ bool m_bMultiplexingStates : 1; // are we currently multiplexing state changes of the native context?
+ bool m_bDisposeNativeContext : 1; // do we need to dispose mxNativeContextComponent?
+ bool m_bWaitingForControl : 1; // if we are created before our control exists, we need to wait for it to appear ...
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleGraphicShape.hxx b/include/svx/AccessibleGraphicShape.hxx
new file mode 100644
index 000000000..a81aa130b
--- /dev/null
+++ b/include/svx/AccessibleGraphicShape.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ACCESSIBLEGRAPHICSHAPE_HXX
+#define INCLUDED_SVX_ACCESSIBLEGRAPHICSHAPE_HXX
+
+#include <com/sun/star/accessibility/XAccessibleImage.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svx/AccessibleShape.hxx>
+#include <svx/svxdllapi.h>
+
+namespace accessibility {
+
+class AccessibleShapeInfo;
+class AccessibleShapeTreeInfo;
+
+/** @descr
+ This class makes graphic shapes accessible. With respect to its
+ base class AccessibleShape it supports the additional
+ XAccessibleImage interface.
+*/
+class SVX_DLLPUBLIC AccessibleGraphicShape
+ : public AccessibleShape,
+ public css::accessibility::XAccessibleImage
+{
+public:
+ //===== internal ========================================================
+ AccessibleGraphicShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+
+ virtual ~AccessibleGraphicShape() override;
+
+ //===== XAccessibleImage ================================================
+
+ OUString SAL_CALL getAccessibleImageDescription() override;
+
+ sal_Int32 SAL_CALL getAccessibleImageHeight() override;
+
+ sal_Int32 SAL_CALL getAccessibleImageWidth() override;
+
+ //===== XInterface ======================================================
+
+ virtual css::uno::Any SAL_CALL
+ queryInterface (const css::uno::Type & rType) override;
+
+ virtual void SAL_CALL
+ acquire()
+ noexcept override;
+
+ virtual void SAL_CALL
+ release()
+ noexcept override;
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual OUString SAL_CALL
+ getImplementationName() override;
+
+ virtual css::uno::Sequence< OUString> SAL_CALL
+ getSupportedServiceNames() override;
+
+ //===== XTypeProvider ===================================================
+
+ virtual css::uno::Sequence< css::uno::Type> SAL_CALL
+ getTypes() override;
+
+protected:
+ /// Create a name string that contains the accessible name.
+ virtual OUString
+ CreateAccessibleBaseName () override;
+
+private:
+ AccessibleGraphicShape (const AccessibleGraphicShape&) = delete;
+
+ AccessibleGraphicShape& operator= (const AccessibleGraphicShape&) = delete;
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleOLEShape.hxx b/include/svx/AccessibleOLEShape.hxx
new file mode 100644
index 000000000..5816de245
--- /dev/null
+++ b/include/svx/AccessibleOLEShape.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ACCESSIBLEOLESHAPE_HXX
+#define INCLUDED_SVX_ACCESSIBLEOLESHAPE_HXX
+
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svx/AccessibleShape.hxx>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star {
+ namespace accessibility { class XAccessibleKeyBinding; }
+}
+
+namespace accessibility {
+
+class AccessibleShapeInfo;
+class AccessibleShapeTreeInfo;
+
+/** @descr
+ This class makes OLE objects accessible. With respect to its
+ base class AccessibleShape it supports the additional
+ XAccessibleAction interface.
+*/
+class SVX_DLLPUBLIC AccessibleOLEShape
+ : public AccessibleShape,
+ public css::accessibility::XAccessibleAction
+{
+public:
+ //===== internal ========================================================
+ AccessibleOLEShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+ virtual ~AccessibleOLEShape() override;
+
+ //===== XAccessibleAction ===============================================
+
+ sal_Int32 SAL_CALL getAccessibleActionCount() override;
+
+ sal_Bool SAL_CALL doAccessibleAction (sal_Int32 nIndex) override;
+
+ OUString SAL_CALL getAccessibleActionDescription (sal_Int32 nIndex) override;
+
+ css::uno::Reference<
+ css::accessibility::XAccessibleKeyBinding> SAL_CALL getAccessibleActionKeyBinding (
+ sal_Int32 nIndex) override;
+
+ //===== XInterface ======================================================
+
+ virtual css::uno::Any SAL_CALL
+ queryInterface (const css::uno::Type & rType) override;
+
+ virtual void SAL_CALL
+ acquire()
+ noexcept override;
+
+ virtual void SAL_CALL
+ release()
+ noexcept override;
+
+ //===== XServiceInfo ====================================================
+
+ virtual OUString SAL_CALL
+ getImplementationName() override;
+
+ virtual css::uno::Sequence< OUString> SAL_CALL
+ getSupportedServiceNames() override;
+
+ //===== XTypeProvider ===================================================
+
+ virtual css::uno::Sequence< css::uno::Type> SAL_CALL
+ getTypes() override;
+// ====== XAccessibleExtendedAttributes =====================================
+ virtual css::uno::Any SAL_CALL getExtendedAttributes() override ;
+protected:
+ /// Create a name string that contains the accessible name.
+ virtual OUString
+ CreateAccessibleBaseName () override;
+
+private:
+ AccessibleOLEShape (const AccessibleOLEShape&) = delete;
+
+ AccessibleOLEShape& operator= (const AccessibleOLEShape&) = delete;
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleShape.hxx b/include/svx/AccessibleShape.hxx
new file mode 100644
index 000000000..082bb72c4
--- /dev/null
+++ b/include/svx/AccessibleShape.hxx
@@ -0,0 +1,439 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_SVX_ACCESSIBLESHAPE_HXX
+#define INCLUDED_SVX_ACCESSIBLESHAPE_HXX
+
+#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
+#include <com/sun/star/accessibility/TextSegment.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#include <com/sun/star/accessibility/XAccessibleGroupPosition.hpp>
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/document/XShapeEventListener.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/servicehelper.hxx>
+#include <editeng/AccessibleContextBase.hxx>
+#include <editeng/AccessibleComponentBase.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svx/AccessibleShapeTreeInfo.hxx>
+#include <svx/IAccessibleViewForwarderListener.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+namespace com::sun::star {
+ namespace accessibility { class XAccessible; }
+ namespace accessibility { class XAccessibleEventListener; }
+ namespace accessibility { class XAccessibleHyperlink; }
+ namespace accessibility { class XAccessibleRelationSet; }
+ namespace accessibility { class XAccessibleStateSet; }
+ namespace beans { struct PropertyValue; }
+ namespace document { struct EventObject; }
+ namespace drawing { class XShape; }
+ namespace uno { class XInterface; }
+}
+
+class SdrObject;
+
+namespace accessibility {
+
+class AccessibleShapeInfo;
+class AccessibleTextHelper;
+class ChildrenManager;
+class IAccessibleParent;
+
+/** This base class provides a base implementation for all shapes. For more
+ detailed documentation about the methods refer to the descriptions of
+ the implemented interfaces. These are, among others,
+ XAccessible, <type>XAccessibleContext</type>,
+ XAccessibleComponent and
+ XAccessibleExtendedComponent.
+
+ <p>The children of a shape can stem from two sources which, in case of
+ SVX and SD shapes, are mutually exclusive. This implementation,
+ however, handles both simultaneously to cope with future extensions or
+ shapes from other projects.
+ <ul>
+ <li>If this shape is a group shape, i.e. a
+ SvxShapeGroup or a <type>Svx3DSceneObject</type>, it
+ can have nested shapes.</li>
+ <li>If this shape is a descendant from SvxShapeText
+ then the text paragraphs are its children.</li>
+ </ul>
+ </p>
+
+ <p>Accessible shapes do not listen for disposing() calls of the UNO
+ shapes they make accessible. This is the task of their owner, usually a
+ container, who can then call dispose() at the accessible object.</p>
+*/
+class SVX_DLLPUBLIC AccessibleShape
+ : public AccessibleContextBase,
+ public AccessibleComponentBase,
+ public css::accessibility::XAccessibleSelection,
+ public css::accessibility::XAccessibleExtendedAttributes,
+ public css::accessibility::XAccessibleGroupPosition,
+ public css::accessibility::XAccessibleHypertext,
+ public IAccessibleViewForwarderListener,
+ public css::document::XShapeEventListener,
+ public css::lang::XUnoTunnel
+{
+public:
+ //===== internal ========================================================
+
+ /** Create a new accessible object that makes the given shape accessible.
+ @param rShapeInfo
+ This object contains all information specific to the new
+ accessible shape. That are e.g. the shape to be made accessible
+ and the accessible object that will become the parent of the new
+ object.
+ @param rShapeTreeInfo
+ Bundle of information passed to this shape and all of its descendants.
+ @attention
+ Always call the <member>init</member> method after creating a
+ new accessible shape. This is one way to overcome the potential
+ problem of registering the new object with e.g. event
+ broadcasters. That would delete the new object if a broadcaster
+ would not keep a strong reference to the new object.
+ */
+ AccessibleShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+ //Solution: Overwrite the object's current name.
+ virtual OUString SAL_CALL getAccessibleName() override;
+ virtual OUString SAL_CALL getAccessibleDescription() override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet() override;
+//===== XAccessibleSelection ============================================
+
+ virtual void SAL_CALL selectAccessibleChild(
+ sal_Int32 nChildIndex ) override;
+
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected(
+ sal_Int32 nChildIndex ) override;
+
+ virtual void SAL_CALL clearAccessibleSelection( ) override;
+
+ virtual void SAL_CALL selectAllAccessibleChildren( ) override;
+
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
+ sal_Int32 nSelectedChildIndex ) override;
+
+ virtual void SAL_CALL deselectAccessibleChild(
+ sal_Int32 nSelectedChildIndex ) override;
+
+ // ====== XAccessibleExtendedAttributes =====================================
+ virtual css::uno::Any SAL_CALL getExtendedAttributes() override ;
+ /// Return this object's role.
+ virtual sal_Int16 SAL_CALL getAccessibleRole() override;
+ //===== XAccessibleGroupPosition =========================================
+ virtual css::uno::Sequence< sal_Int32 > SAL_CALL
+ getGroupPosition( const css::uno::Any& rAny ) override;
+ virtual OUString SAL_CALL getObjectLink( const css::uno::Any& accoject ) override;
+ /** The destructor releases its children manager and text engine if
+ still existent. These are responsible to send appropriate events.
+ */
+ virtual ~AccessibleShape() override;
+
+ /** Initialize a new shape. See the documentation of the constructor
+ for the reason of this method's existence.
+ */
+ virtual void Init();
+
+ /** Set the specified state. If the state is <const>FOCUSED</const>
+ then, additionally to the inherited functionality, the focus
+ listeners registered with the XAccessibleComponent
+ interface are called (if that state really changes).
+
+ @param aState
+ The state to turn on.
+
+ @return
+ The returned flag indicates whether the specified state has been
+ changed (<TRUE/>), i.e. it has formerly not been set.
+ */
+ virtual bool SetState (sal_Int16 aState) override;
+
+ /** Reset the specified state. If the state is <const>FOCUSED</const>
+ then, additionally to the inherited functionality, the focus
+ listeners registered with the XAccessibleComponent
+ interface are called (if that state really changes).
+
+ @param aState
+ The state to turn off.
+
+ @return
+ The returned flag indicates whether the specified state has been
+ changed (<TRUE/>), i.e. it has formerly been set.
+ */
+ virtual bool ResetState (sal_Int16 aState) override;
+
+ /** Return the state of the specified state. Take the
+ <const>FOCUSED</const> state from the accessible edit engine.
+
+ @param aState
+ The state for which to return its value.
+ @return
+ A value of <TRUE/> indicates that the state is set. A <FALSE/>
+ value indicates an unset state or the inability to access the
+ entity that manages the state set.
+
+ */
+ bool GetState (sal_Int16 aState);
+
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount() override;
+
+ /** Return the specified child.
+ @param nIndex
+ Index of the requested child.
+ @return
+ Reference of the requested child which is the accessible object
+ of a visible shape.
+ @throws IndexOutOfBoundsException
+ Throws an exception if the index is not valid.
+ */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 nIndex) override;
+
+
+ /// Return the set of current states.
+ virtual css::uno::Reference<
+ css::accessibility::XAccessibleStateSet> SAL_CALL
+ getAccessibleStateSet() override;
+
+ /// Return this objects index among the parents children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent() override;
+
+ //===== XAccessibleComponent ============================================
+
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint (const css::awt::Point& aPoint) override;
+
+ virtual css::awt::Rectangle SAL_CALL getBounds() override;
+
+ virtual css::awt::Point SAL_CALL getLocation() override;
+
+ virtual css::awt::Point SAL_CALL getLocationOnScreen() override;
+
+ virtual css::awt::Size SAL_CALL getSize() override;
+
+ virtual sal_Int32 SAL_CALL getForeground() override;
+
+ virtual sal_Int32 SAL_CALL getBackground() override;
+
+ //===== XAccessibleEventBroadcaster =====================================
+
+ /** This call is forwarded to a) the base class and b) to the
+ accessible edit engine if it is present.
+
+ @param rxListener
+ This listener is informed about accessibility events.
+ */
+ virtual void SAL_CALL
+ addAccessibleEventListener (
+ const css::uno::Reference<
+ css::accessibility::XAccessibleEventListener >& rxListener) override;
+
+ /** This call is forwarded to a) the base class and b) to the
+ accessible edit engine if it is present.
+
+ @param rxListener
+ This listener will not be informed about accessibility events
+ anymore.
+ */
+ virtual void SAL_CALL
+ removeAccessibleEventListener (
+ const css::uno::Reference<
+ css::accessibility::XAccessibleEventListener >& rxListener) override;
+
+
+ //===== XInterface ======================================================
+
+ virtual css::uno::Any SAL_CALL
+ queryInterface (const css::uno::Type & rType) override;
+
+ virtual void SAL_CALL
+ acquire()
+ noexcept override;
+
+ virtual void SAL_CALL
+ release()
+ noexcept override;
+
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual OUString SAL_CALL
+ getImplementationName() override;
+
+ virtual css::uno::Sequence< OUString> SAL_CALL
+ getSupportedServiceNames() override;
+
+ //===== XTypeProvider ===================================================
+
+ virtual css::uno::Sequence< css::uno::Type> SAL_CALL
+ getTypes() override;
+
+ //===== IAccessibleViewForwarderListener ================================
+ virtual void ViewForwarderChanged() override;
+
+ /** Listen for disposing events of the model. The accessible shape
+ remains functional when this happens.
+ */
+ void disposing (const css::lang::EventObject& Source);
+
+ //===== document::XShapeEventListener ========================================
+
+ virtual void SAL_CALL
+ notifyShapeEvent (const css::document::EventObject& rEventObject) override;
+
+
+ //===== XUnoTunnel ========================================================
+
+ UNO3_GETIMPLEMENTATION_DECL(AccessibleShape)
+
+ //===== XAccessibleHypertext ========================================================
+ virtual sal_Int32 SAL_CALL getHyperLinkCount() override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleHyperlink >
+ SAL_CALL getHyperLink( sal_Int32 nLinkIndex ) override;
+ virtual sal_Int32 SAL_CALL getHyperLinkIndex( sal_Int32 nCharIndex ) override;
+ //===== XAccessibleText ==================================================
+ virtual sal_Int32 SAL_CALL getCaretPosition( ) override;
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override;
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override;//Shen Zhen Jie changed sal_Unicode to sal_uInt32; change back to sal_Unicode
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override;
+ virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override;
+ virtual sal_Int32 SAL_CALL getCharacterCount( ) override;
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override;
+ virtual OUString SAL_CALL getSelectedText( ) override;
+ virtual sal_Int32 SAL_CALL getSelectionStart( ) override;
+ virtual sal_Int32 SAL_CALL getSelectionEnd( ) override;
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+ virtual OUString SAL_CALL getText( ) override;
+ virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+ virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+ virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
+
+ //===== Misc ========================================================
+
+ const css::uno::Reference< css::drawing::XShape >&
+ GetXShape() const { return mxShape; }
+
+ /** set the index _nIndex at the accessible shape
+ @param _nIndex
+ The new index in parent.
+ */
+ void setIndexInParent(sal_Int32 _nIndex) { m_nIndexInParent = _nIndex; }
+
+protected:
+ /// Children manager. May be empty if there are no children.
+ std::unique_ptr<ChildrenManager> mpChildrenManager;
+
+ /// Reference to the actual shape.
+ css::uno::Reference<
+ css::drawing::XShape> mxShape;
+
+ /** Bundle of information passed to all shapes in a document tree.
+ */
+ AccessibleShapeTreeInfo maShapeTreeInfo;
+
+ /** the index in parent.
+ */
+ sal_Int32 m_nIndexInParent;
+
+ /** The accessible text engine. May be NULL if it can not be created.
+ */
+ std::unique_ptr<AccessibleTextHelper> mpText;
+
+ /** This object can be used to modify the child list of our parent.
+ */
+ IAccessibleParent* mpParent;
+
+ /** This object can be removed when we have an extra interface to ask if the shape is selected
+ */
+ SdrObject* m_pShape;
+
+ /** This method is called from the component helper base class while
+ disposing.
+ */
+ virtual void SAL_CALL disposing() override;
+
+ /** Create a base name string that contains the accessible name.
+
+ @throws css::uno::RuntimeException
+ */
+ virtual OUString
+ CreateAccessibleBaseName();
+
+ /** Create a unique name string that contains the accessible name. The
+ name consists of the base name and the index.
+ */
+ virtual OUString
+ CreateAccessibleName() override;
+
+ /// @throws css::uno::RuntimeException
+ OUString
+ GetFullAccessibleName(AccessibleShape *shape);
+ virtual OUString GetStyle() const;
+ /** Update the <const>OPAQUE</const> and <const>SELECTED</const> state.
+ */
+ void UpdateStates();
+
+private:
+ AccessibleShape (const AccessibleShape&) = delete;
+ AccessibleShape& operator= (const AccessibleShape&) = delete;
+ //Old accessible name
+ OUString aAccName;
+
+ /** Call this method when the title, name, or description of the mxShape
+ member (may) have been changed.
+ This method adapts the name and description members of the
+ AccessibleContextBase base class.
+ */
+ void UpdateNameAndDescription();
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleShapeInfo.hxx b/include/svx/AccessibleShapeInfo.hxx
new file mode 100644
index 000000000..5cb9bfb0d
--- /dev/null
+++ b/include/svx/AccessibleShapeInfo.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ACCESSIBLESHAPEINFO_HXX
+#define INCLUDED_SVX_ACCESSIBLESHAPEINFO_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star {
+ namespace accessibility { class XAccessible; }
+ namespace drawing { class XShape; }
+}
+
+namespace accessibility {
+
+class IAccessibleParent;
+
+/** @descr
+ This class is a container for the information specific for a single
+ shape that is passed to the constructor of that shape. It allows to
+ separate the class definitions of the shapes from the information
+ needed on construction. Only the shapes' implementation has to be
+ adapted to a modified AccessibleShapeInfo definition.
+
+ <p>Note that this class complements the
+ AccessibleShapeTreeInfo interface which contains
+ information that is passed to all shapes in a subtree not just to a
+ single shape. </p>
+*/
+class SVX_DLLPUBLIC AccessibleShapeInfo
+{
+public:
+ /** The shape itself for which an accessible object is to be
+ constructed.
+ */
+ css::uno::Reference<
+ css::drawing::XShape> mxShape;
+
+ /** The accessible parent object of the shape.
+ */
+ css::uno::Reference<
+ css::accessibility::XAccessible> mxParent;
+
+ /** This object that may be realized by the same implementation as that
+ of that of <member>mxParent</member> can be used to modify
+ parent/child relationships with the shape as initiator.
+ Note that NULL is a valid value for this member.
+ */
+ IAccessibleParent* mpChildrenManager;
+
+ /** Copy the given values into the members described above.
+ */
+ AccessibleShapeInfo (
+ const css::uno::Reference<
+ css::drawing::XShape>& rxShape,
+ const css::uno::Reference<
+ css::accessibility::XAccessible>& rxParent,
+ IAccessibleParent* pChildrenManager);
+
+ /** Copy the given values into the members described above.
+ The accessible parent implementation object is set to NULL.
+ */
+ AccessibleShapeInfo (
+ const css::uno::Reference<
+ css::drawing::XShape>& rxShape,
+ const css::uno::Reference<
+ css::accessibility::XAccessible>& rxParent);
+
+ ~AccessibleShapeInfo();
+
+ AccessibleShapeInfo (const AccessibleShapeInfo&);
+private:
+ AccessibleShapeInfo& operator= (const AccessibleShapeInfo&) = delete;
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleShapeTreeInfo.hxx b/include/svx/AccessibleShapeTreeInfo.hxx
new file mode 100644
index 000000000..f50061ad4
--- /dev/null
+++ b/include/svx/AccessibleShapeTreeInfo.hxx
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ACCESSIBLESHAPETREEINFO_HXX
+#define INCLUDED_SVX_ACCESSIBLESHAPETREEINFO_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <svx/svxdllapi.h>
+#include <vcl/vclptr.hxx>
+
+namespace com::sun::star {
+ namespace accessibility { class XAccessibleComponent; }
+ namespace document { class XShapeEventBroadcaster; }
+ namespace frame { class XController; }
+}
+namespace vcl { class Window; }
+
+class SdrView;
+
+namespace accessibility {
+
+class IAccessibleViewForwarder;
+
+/** This class bundles all information that is passed down the tree of
+ accessible shapes so that each shape has access to that info.
+
+ There are basically four members that can be set and queried:
+ <ul>
+ <li>The model broadcaster is used for getting notified about shape
+ changes. Using this broadcaster makes in unnecessary to register at
+ each shape separately.</li>
+ <li>The view forwarder is responsible for transformation between
+ coordinate systems and for providing the visible area both with respect
+ to a specific window.</li>
+ <li>The SdrView is used for creating accessible edit engines.</li>
+ <li>The Window is used for creating accessible edit engines.</li>
+ </ul>
+*/
+class SVX_DLLPUBLIC AccessibleShapeTreeInfo
+{
+public:
+ /** Use this constructor to create an empty object that is filled later
+ with more meaningful data.
+ */
+ AccessibleShapeTreeInfo();
+
+ /** Create a copy of the given shape info.
+ @param rInfo
+ The shape tree info object to copy.
+ */
+ AccessibleShapeTreeInfo (const AccessibleShapeTreeInfo& rInfo);
+
+ ~AccessibleShapeTreeInfo();
+
+ AccessibleShapeTreeInfo& operator= (const AccessibleShapeTreeInfo& rInfo);
+
+ void dispose();
+
+ /** Deprecated. Don't use this method.
+ */
+ void SetDocumentWindow (const css::uno::Reference<
+ css::accessibility::XAccessibleComponent>& rxViewWindow);
+
+ /** Deprecated. Don't use this method.
+ */
+ const css::uno::Reference<
+ css::accessibility::XAccessibleComponent>&
+ GetDocumentWindow() const { return mxDocumentWindow;}
+
+ /** Set a new broadcaster that sends events indicating shape changes.
+ The broadcaster usually is or belongs to a document model.
+ @param rxModelBroadcaster
+ The new broadcaster. It replaces the current one. An empty
+ reference may be passed to unset the broadcaster
+ */
+ void SetModelBroadcaster (const css::uno::Reference<
+ css::document::XShapeEventBroadcaster>& rxModelBroadcaster);
+
+ /** Return the current model broadcaster.
+ @return
+ The returned reference may be empty if the broadcaster has not
+ been set or has been set to an empty reference.
+ */
+ const css::uno::Reference<
+ css::document::XShapeEventBroadcaster>&
+ GetModelBroadcaster() const { return mxModelBroadcaster;}
+
+ /** Set the view that will be used to construct SvxTextEditSources which
+ in turn are used to create accessible edit engines.
+ @param pView
+ The new SdrView that replaces the current one. A NULL pointer
+ may be passed to unset the view.
+ */
+ void SetSdrView (SdrView* pView);
+
+ /** Return the current SdrView.
+ @return
+ The returned value may be NULL.
+ */
+ SdrView* GetSdrView() const { return mpView;}
+
+ /** Set a new controller. This will usually but not necessarily
+ correspond to the SdrView.
+ @param rxController
+ The new controller that replaces the current one. An empty
+ reference may be passed to unset the controller.
+ */
+ void SetController (const css::uno::Reference<
+ css::frame::XController>& rxController);
+
+ /** Return the currently set controller.
+ @return
+ The reference to the currently set controller may be empty.
+ */
+ const css::uno::Reference<
+ css::frame::XController>&
+ GetController() const { return mxController;}
+
+ /** Set the window that is used to construct SvxTextEditSources which in
+ turn is used to create accessible edit engines.
+ */
+ void SetWindow(vcl::Window* pWindow);
+
+ /** Return the current Window.
+ @return
+ The returned value may be NULL.
+ */
+ vcl::Window* GetWindow() const
+ {
+ return mpWindow.get();
+ }
+
+ /** The view forwarder allows the transformation between internal
+ and pixel coordinates and can be asked for the visible area.
+ @param pViewForwarder
+ This view forwarder replaces the current one.
+ */
+ void SetViewForwarder (const IAccessibleViewForwarder* pViewForwarder);
+
+ /** Return the current view forwarder.
+ @return
+ The returned pointer may be NULL.
+ */
+ const IAccessibleViewForwarder* GetViewForwarder() const { return mpViewForwarder;}
+
+private:
+ /** Deprecated.
+ */
+ css::uno::Reference<
+ css::accessibility::XAccessibleComponent> mxDocumentWindow;
+
+ /** this broadcaster sends events indicating shape changes.
+ The broadcaster usually is or belongs to a document model.
+
+ This once was named mxControllerBroadcaster.
+ */
+ css::uno::Reference<
+ css::document::XShapeEventBroadcaster> mxModelBroadcaster;
+
+ /** This view is necessary to construct an SvxTextEditSource which in
+ turn is used to create an accessible edit engine.
+ */
+ SdrView* mpView;
+
+ /** The controller is used e.g. for obtaining the selected shapes.
+ */
+ css::uno::Reference<
+ css::frame::XController> mxController;
+
+ /** This window is necessary to construct an SvxTextEditSource which in
+ turn is used to create an accessible edit engine.
+ */
+ VclPtr<vcl::Window> mpWindow;
+
+ /** The view forwarder allows the transformation between internal
+ and pixel coordinates and can be asked for the visible area.
+ */
+ const IAccessibleViewForwarder* mpViewForwarder;
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleTextHelper.hxx b/include/svx/AccessibleTextHelper.hxx
new file mode 100644
index 000000000..45592748f
--- /dev/null
+++ b/include/svx/AccessibleTextHelper.hxx
@@ -0,0 +1,374 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ACCESSIBLETEXTHELPER_HXX
+#define INCLUDED_SVX_ACCESSIBLETEXTHELPER_HXX
+
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star
+{
+namespace accessibility
+{
+class XAccessible;
+}
+namespace accessibility
+{
+class XAccessibleEventListener;
+}
+namespace awt
+{
+struct Point;
+}
+}
+
+class Point;
+class SvxEditSource;
+
+namespace accessibility
+{
+class AccessibleTextHelper_Impl;
+
+/** Helper class for objects containing EditEngine/Outliner text
+
+ This class provides the methods from the XAccessibleContext,
+ XAccessibleEventBroadcaster and XAccessibleComponent
+ interfaces, that are common to all accessible objects
+ containing an edit engine.
+
+ The text contained in the EditEngine/Outliner is presented as
+ children of this class, namely for every text paragraph a
+ AccessibleEditableTextPara child object is generated. As this
+ class manages these children for itself, it has to send out
+ AccessibleEventId::CHILD events on your
+ behalf. Thus, you must forward every call to your
+ addEventListener()/removeEventListener() methods to the
+ AccessibleTextHelper (methods
+ AddEventListener/RemoveEventListener), otherwise none or not
+ everyone of your event listener will notice child changes.
+
+ You have to implement the SvxEditSource, SvxTextForwarder,
+ SvxViewForwarder and SvxEditViewForwarder interfaces in order
+ to enable your object to cooperate with this
+ class. SvxTextForwarder encapsulates the fact that text
+ objects do not necessarily have an EditEngine at their
+ disposal, SvxViewForwarder and SvxEditViewForwarder do the
+ same for the document and the edit view. The three mentioned
+ forwarder objects are not stored by the AccessibleTextHelper,
+ but fetched every time from the SvxEditSource. So you are best
+ off making your SvxEditSource::Get*Forwarder methods cache the
+ current forwarder.
+
+ To support changes in edit mode or conversion of fixed text
+ into EditEngine text, you can change the SvxEditSource this
+ class is referring to. This might render all children invalid
+ and change the child count, since the AccessibleTextHelper
+ reinitializes itself from scratch.
+
+ This class registers itself at the SvxEditSource as a state
+ listener and manages the state of its children (i.e. the
+ paragraphs). See the method documentation of
+ AccessibleTextHelper::SetEditSource for the expected
+ events. Generally, be prepared that when sending any of these
+ events via SvxEditSource::GetBroadcaster() broadcaster, the
+ AccessibleTextHelper will call the SvxEditSource and their
+ forwarder to update it's state. Avoid being inconsistent in
+ the facts you tell in the events, e.g. when sending a
+ SfxHintId::TextParaInserted event, the
+ SvxEditSource::GetTextForwarder().GetParagraphCount() should
+ already include the newly inserted paragraph.
+
+ @attention All public methods must not be called with any
+ mutex hold, except when calling from the main thread (with
+ holds the solar mutex), unless stated otherwise. This is
+ because they themselves might need the solar mutex in addition
+ to the object mutex, and the ordering of the locking must be:
+ first solar mutex, then object mutex. Furthermore, state
+ change events might be fired internally.
+
+ @derive Use this class in an aggregation and forward, or
+ derive from it and overwrite.
+ too.
+
+ @see SvxEditSource
+ @see SvxTextForwarder
+ @see SvxViewForwarder
+ @see SvxEditViewForwarder
+*/
+class SVX_DLLPUBLIC AccessibleTextHelper final
+{
+public:
+ typedef ::std::vector<sal_Int16> VectorOfStates;
+
+ /** Create accessible text object for given edit source
+
+ @param pEditSource
+ The edit source to use. Object ownership is transferred
+ from the caller to the callee. The object listens on the
+ SvxEditSource for object disposal, so no provisions have
+ to be taken if the caller destroys the data (e.g. the
+ model) contained in the given SvxEditSource.
+
+ */
+ explicit AccessibleTextHelper(::std::unique_ptr<SvxEditSource>&& pEditSource);
+
+ ~AccessibleTextHelper();
+
+ AccessibleTextHelper(const AccessibleTextHelper&) = delete;
+ AccessibleTextHelper& operator=(const AccessibleTextHelper&) = delete;
+
+ /** Query the current edit source
+
+ @attention This method returns by reference, so you are
+ responsible for serialization (typically, you acquired the
+ solar mutex when calling this method). Thus, the method
+ should only be called from the main office thread.
+
+ */
+ const SvxEditSource& GetEditSource() const;
+
+ /** Set the current edit source
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ The EditSource set here is required to broadcast out the
+ following hints: SfxHintId::EditSourceParasMoved,
+ SfxHintId::EditSourceSelectionChanged, SfxHintId::TextModified,
+ SfxHintId::TextParaInserted, SfxHintId::TextParaRemoved,
+ SfxHintId::TextHeightChanged,
+ SfxHintId::TextViewScrolled. Otherwise, not all state changes
+ will get noticed by the accessibility object. Further
+ more, when the corresponding core object or the model is
+ dying, either the edit source must be set to NULL or it
+ has to broadcast a SfxHintId::Dying hint.
+
+ If the SvxEditSource's managed text can change between
+ edit/non-edit mode (i.e. there are times when
+ SvxEditSource::GetEditViewForwarder(sal_False) returns
+ NULL), then the two additional hints are required:
+ SdrHintKind::BeginEdit and SdrHintKind::EndEdit. When the
+ AccessibleTextHelper receives a SdrHintKind::BeginEdit, it expects
+ the SvxEditSource already in edit mode. On a SdrHintKind::EndEdit,
+ edit mode must already been left. The rationale for these
+ events are the fact that focus and selection have to be
+ updated in edit mode, and completely relinquished and
+ reset to the parent (for the focus) in non-edit mode.
+
+ This class does not have a dispose method, since it is not
+ a UNO component. Nevertheless, it holds C++ references to
+ several core objects, so you should issue a
+ SetEditSource(::std::unique_ptr<SvxEditSource>()) in
+ your dispose() method.
+
+ @param pEditSource
+ The new edit source to set. Object ownership is transferred
+ from the caller to the callee.
+ */
+ void SetEditSource(::std::unique_ptr<SvxEditSource>&& pEditSource);
+
+ /** Set the event source
+
+ You should set the event source before registering any
+ event listener and before requesting any child. Children
+ of this object receive the event source as their parent
+ accessible object. That is, the event source is best set
+ in your object's init method.
+
+ @attention When setting a reference here, you should call
+ Dispose() when you as the owner are disposing, since until
+ then this object will hold that reference
+
+ @param rInterface
+ The interface that should be set as the source for
+ accessibility events sent by this object.
+ */
+ void SetEventSource(const css::uno::Reference<css::accessibility::XAccessible>& rInterface);
+
+ /** Set offset of EditEngine/Outliner from parent
+
+ If the origin of the underlying EditEngine/Outliner does
+ not correspond to the upper left corner of the object
+ using this class, you have to specify the offset.
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ @param rPoint
+ The offset in screen coordinates (i.e. pixel)
+ */
+ void SetOffset(const Point& rPoint);
+
+ /** Set offset the object adds to all children's indices
+
+ This can be used if the owner of this object has children
+ handled by itself. Setting an offset different from 0
+ leads to this object mimicking that all its children are
+ within the range [nOffset, GetChildCount()+nOffset). That
+ means, GetChild() also expects the index to be in this
+ range.
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ @param nOffset
+ The offset to add to every children's index.
+ */
+ void SetStartIndex(sal_Int32 nOffset);
+
+ /** Query offset the object adds to all children's indices
+
+ @return the offset to add to every children's index.
+ */
+ sal_Int32 GetStartIndex() const;
+
+ /** Sets a vector of additional accessible states.
+
+ The states are passed to every created child object
+ (text paragraph). The state values are defined in
+ css::accessibility::AccessibleStateType.
+
+ This function has to be called before querying for
+ any children (e.g. with GetChild()).
+ */
+ void SetAdditionalChildStates(VectorOfStates&& rChildStates);
+
+ /** Update the visible children
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ This method reevaluates the visibility of all
+ children. Call this method if your visibility state has
+ changed somehow, e.g. if the visible area has changed and
+ the AccessibleTextHelper isn't notified internally
+ (e.g. via SfxHintId::TextViewScrolled). Normally, there should
+ not be a need to call this method.
+ */
+ void UpdateChildren();
+
+ /** Drop all references and enter disposed state
+
+ This method drops all references to external objects (also
+ the event source reference set via SetEventSource()) and
+ sets the object into the disposed state (i.e. the methods
+ return default values or throw a uno::DisposedException
+ exception).
+ */
+ void Dispose();
+
+ /** Set the focus state of the accessibility object
+
+ Since this class handles children which also might get the
+ focus, the user of this class is encouraged to delegate
+ focus handling. Whenever the focus state of the
+ surrounding object changes, this method has to be called.
+
+ The protocol of focus handling for a user of this class is
+ then to call SetFocus() with the appropriate focus state,
+ and HaveFocus() to determine the focus state you tell the
+ outside.
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ @param bHaveFocus
+ Whether we got or we lost the focus. Set to true if
+ focus is gotten, false otherwise.
+
+ @see HaveFocus()
+ */
+ void SetFocus(bool bHaveFocus = true);
+
+ /** Query the focus state of the surrounding object
+
+ If focus handling is delegated to this class, determine
+ focus state with this method. Be prepared that even if you
+ set the focus with SetFocus(true), this method might
+ return false. This is the case if one of the children
+ actually got the focus.
+
+ @return the state of the focus ownership
+ */
+ bool HaveFocus();
+
+ // XAccessibleContext child handling methods
+
+ /** Implements getAccessibleChildCount
+
+ @attention Don't call with locked mutexes. You may hold
+ the solar mutex, but this method acquires it anyway.
+ */
+ sal_Int32 GetChildCount() const;
+ /** Implements getAccessibleChild
+
+ @attention Don't call with locked mutexes. You may hold
+ the solar mutex, but this method acquires it anyway.
+ */
+ css::uno::Reference<css::accessibility::XAccessible> GetChild(sal_Int32 i);
+
+ // XAccessibleEventBroadcaster child related methods
+
+ /** Implements addEventListener
+
+ @attention Don't call with locked mutexes
+ */
+ void AddEventListener(
+ const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener);
+ /** Implements removeEventListener
+
+ @attention Don't call with locked mutexes
+ */
+ void RemoveEventListener(
+ const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener);
+
+ // XAccessibleComponent child related methods
+
+ /** Implements getAccessibleAt
+
+ @attention Don't call with locked mutexes. You may hold
+ the solar mutex, but this method acquires it anyway.
+ */
+ css::uno::Reference<css::accessibility::XAccessible> GetAt(const css::awt::Point& aPoint);
+
+private:
+ /// @dyn
+ const std::unique_ptr<AccessibleTextHelper_Impl> mpImpl;
+};
+
+} // end of namespace accessibility
+
+#endif // INCLUDED_SVX_ACCESSIBLETEXTHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ActionDescriptionProvider.hxx b/include/svx/ActionDescriptionProvider.hxx
new file mode 100644
index 000000000..4aa889eb1
--- /dev/null
+++ b/include/svx/ActionDescriptionProvider.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ACTIONDESCRIPTIONPROVIDER_HXX
+#define INCLUDED_SVX_ACTIONDESCRIPTIONPROVIDER_HXX
+
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+
+
+/** This class provides localized descriptions for some basic actions done with objects.
+The strings are intended to be provided to the user e.g. as description for undo actions in the menu.
+The name of the object acted on and the type of action needs to be given as input parameter.
+*/
+
+class SVX_DLLPUBLIC ActionDescriptionProvider
+{
+public:
+ enum class ActionType
+ {
+ Insert
+ , Delete
+ , Move
+ , Resize
+ , Rotate
+ , Format
+ , MoveToTop
+ , MoveToBottom
+ , PosSize
+ };
+
+public:
+ static OUString createDescription( ActionType eActionType
+ , std::u16string_view rObjectName );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ChildrenManager.hxx b/include/svx/ChildrenManager.hxx
new file mode 100644
index 000000000..0498b43fd
--- /dev/null
+++ b/include/svx/ChildrenManager.hxx
@@ -0,0 +1,214 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_CHILDRENMANAGER_HXX
+#define INCLUDED_SVX_CHILDRENMANAGER_HXX
+
+#include <sal/config.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ref.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/long.hxx>
+
+namespace com::sun::star
+{
+namespace accessibility
+{
+class XAccessible;
+}
+namespace drawing
+{
+class XShape;
+}
+namespace drawing
+{
+class XShapes;
+}
+}
+
+namespace accessibility
+{
+class AccessibleContextBase;
+class AccessibleShapeTreeInfo;
+class ChildrenManagerImpl;
+
+/** The AccessibleChildrenManager class acts as a cache of the
+ accessible objects of the currently visible shapes of a draw page and as
+ a factory to create the corresponding accessible object for a given
+ shape.
+
+ <p>There are two sources of shapes. The first is a list of UNO shapes.
+ It is passes to the constructor and can be re-set with a call to
+ <member>SetShapeList</member>. Accessibility objects which represent
+ these shapes are constructed usually on demand. The second source is a
+ set of single AccessibleShape objects added by calls to
+ <member>AddAccessibleShape</member>. These are not modified by this
+ class. They are only copied into the list of visible shapes depending
+ on their visibility. The later list can be cleared by calling
+ <member>ClearAccessibleShapeList</member>. The actual set of children
+ accessible through the <member>GetChildrenCount</member> and
+ <member>GetChild</member> methods are the accessible objects that lie
+ completely or partially inside the visible area obtained from the view
+ forwarder in the shape tree info.</p>
+
+ <p>A children manager registers itself at the broadcaster passed to its
+ constructor and transforms/forwards the received events to the listeners
+ of the also given context base. The transformation process includes
+ interpreting a document::XEventListener, the change from
+ XShape references to the associated XAccessible reference, and the
+ creation of an XAccessibleEventObject. The event object is then passed
+ to the <method>fireEvent</method> method of the context and from there
+ forwarded to all listeners.</p>
+
+ <p>Note that some of the data given to the constructor is passed to the
+ accessible shape objects created by that child manager which in turn
+ pass these data to their child managers. The data is thus propagated
+ down a tree of child managers/accessible shape objects from a top level
+ class that is usually a document/model. This is the way to give all
+ accessible objects access to data normally known only to the top level
+ owner of the shapes.</p>
+*/
+class SVX_DLLPUBLIC ChildrenManager final
+{
+public:
+ /** Create a children manager, which manages the children of the given
+ parent. The parent is used for creating accessible objects. The
+ list of shapes for which to create those objects is not derived from
+ the parent and has to be provided separately by calling one of the
+ update methods.
+ @param rxParent
+ The parent of the accessible objects which will be created
+ on demand at some point of time in the future.
+ @param rxShapeList
+ List of UNO shapes to manage.
+ @param rShapeTreeInfo
+ Bundle of information passed down the shape tree.
+ @param rContext
+ An accessible context object that is called for firing events
+ for new and deleted children, i.e. that holds a list of
+ listeners to be informed.
+ */
+ ChildrenManager(const css::uno::Reference<css::accessibility::XAccessible>& rxParent,
+ const css::uno::Reference<css::drawing::XShapes>& rxShapeList,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo, AccessibleContextBase& rContext);
+
+ /** If there still are managed children these are marked as DEFUNC and
+ released.
+ */
+ ~ChildrenManager();
+
+ /** Return the number of currently visible accessible children.
+ @return
+ If there are no children a 0 is returned.
+ */
+ tools::Long GetChildCount() const noexcept;
+
+ /** Return the requested accessible child or throw and
+ IndexOutOfBoundsException if the given index is invalid.
+ @param nIndex
+ Index of the requested child. Call getChildCount for obtaining
+ the number of children.
+ @return
+ In case of a valid index this method returns a reference to the
+ requested accessible child. This reference is empty if it has
+ not been possible to create the accessible object of the
+ corresponding shape.
+ @throws
+ Throws an IndexOutOfBoundsException if the index is not valid.
+ */
+ css::uno::Reference<css::accessibility::XAccessible> GetChild(tools::Long nIndex);
+ /// @throws css::lang::IndexOutOfBoundsException
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference<css::drawing::XShape> GetChildShape(tools::Long nIndex);
+
+ /** Update the child manager. Take care of a modified set of children
+ and modified visible area. This method can optimize the update
+ process with respect separate updates of a modified children list
+ and visible area.
+ @param bCreateNewObjectsOnDemand
+ If </true> then accessible objects associated with the visible
+ shapes are created only when asked for. No event is sent on
+ creation. If </false> then the accessible objects are created
+ before this method returns and events are sent to inform the
+ listeners of the new object.
+ */
+ void Update(bool bCreateNewObjectsOnDemand = true);
+
+ /** Replace the list of UNO shapes by the specified list.
+ @param xShapeList
+ The new list of shapes.
+ */
+ void SetShapeList(const css::uno::Reference<css::drawing::XShapes>& xShapeList);
+
+ /** Add an accessible shape. The difference to the UNO shapes in the
+ list passed to the constructor the specified object does not have to
+ be created by the shape factory. This gives the caller full control
+ over object creation.
+
+ @param shape must be non-null
+ */
+ void AddAccessibleShape(css::uno::Reference<css::accessibility::XAccessible> const& shape);
+
+ /** Clear the list of accessible shapes which have been added by
+ previous calls to <member>AddAccessibleShape</member>.
+ */
+ void ClearAccessibleShapeList();
+
+ /** Take a new event shape tree info. Call this method to inform the
+ children manager of a change of the info bundle.
+ @param rShapeTreeInfo
+ The new info that replaces the current one.
+ */
+ void SetInfo(AccessibleShapeTreeInfo const& rShapeTreeInfo);
+
+ /** Update the SELECTED and FOCUSED states of all visible children
+ according to the given selection. This includes setting
+ <em>and</em> resetting the states.
+ */
+ void UpdateSelection();
+
+ /** Return whether one of the shapes managed by this object has
+ currently the focus.
+ @return
+ Returns <true/> when there is a shape that has the focus and
+ <false/> when there is no such shape.
+ */
+ bool HasFocus() const;
+
+ /** When there is a shape that currently has the focus,
+ i.e. <member>HasFocus()</member> returns <true/> then remove the
+ focus from that shape. Otherwise nothing changes.
+ */
+ void RemoveFocus();
+
+ void ViewForwarderChanged();
+
+private:
+ rtl::Reference<ChildrenManagerImpl> mpImpl;
+
+ ChildrenManager(const ChildrenManager&) = delete;
+ ChildrenManager& operator=(const ChildrenManager&) = delete;
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ClassificationCommon.hxx b/include/svx/ClassificationCommon.hxx
new file mode 100644
index 000000000..71be4b85c
--- /dev/null
+++ b/include/svx/ClassificationCommon.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_SVX_CLASSIFICATIONCOMMON_HXX
+#define INCLUDED_SVX_CLASSIFICATIONCOMMON_HXX
+
+#include <sal/config.h>
+#include <svx/svxdllapi.h>
+#include <vector>
+#include <sfx2/classificationhelper.hxx>
+
+namespace com::sun::star::beans
+{
+class XPropertyContainer;
+}
+namespace com::sun::star::beans
+{
+struct Property;
+}
+namespace svx
+{
+class ClassificationResult;
+}
+
+namespace svx::classification
+{
+SVX_DLLPUBLIC OUString
+convertClassificationResultToString(std::vector<svx::ClassificationResult> const& rResults);
+
+SVX_DLLPUBLIC OUString
+getProperty(css::uno::Reference<css::beans::XPropertyContainer> const& rxPropertyContainer,
+ OUString const& rName);
+
+SVX_DLLPUBLIC bool containsProperty(css::uno::Sequence<css::beans::Property> const& rProperties,
+ std::u16string_view rName);
+
+SVX_DLLPUBLIC void
+removeAllProperties(css::uno::Reference<css::beans::XPropertyContainer> const& rxPropertyContainer);
+
+SVX_DLLPUBLIC bool addOrInsertDocumentProperty(
+ css::uno::Reference<css::beans::XPropertyContainer> const& rxPropertyContainer,
+ OUString const& rsKey, OUString const& rsValue);
+
+SVX_DLLPUBLIC void insertFullTextualRepresentationAsDocumentProperty(
+ css::uno::Reference<css::beans::XPropertyContainer> const& rxPropertyContainer,
+ sfx::ClassificationKeyCreator const& rKeyCreator,
+ std::vector<svx::ClassificationResult> const& rResults);
+
+SVX_DLLPUBLIC void
+insertCreationOrigin(css::uno::Reference<css::beans::XPropertyContainer> const& rxPropertyContainer,
+ sfx::ClassificationKeyCreator const& rKeyCreator,
+ sfx::ClassificationCreationOrigin eOrigin);
+
+} // end svx::classification namespace
+
+#endif // INCLUDED_SVX_CLASSIFICATIONCOMMON_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ClassificationDialog.hxx b/include/svx/ClassificationDialog.hxx
new file mode 100644
index 000000000..2763f6d09
--- /dev/null
+++ b/include/svx/ClassificationDialog.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_SVX_CLASSIFICATIONDIALOG_HXX
+#define INCLUDED_SVX_CLASSIFICATIONDIALOG_HXX
+
+#include <sal/config.h>
+#include <vcl/weld.hxx>
+#include <svx/svxdllapi.h>
+#include <sfx2/classificationhelper.hxx>
+#include <svx/ClassificationField.hxx>
+
+namespace svx
+{
+class ClassificationEditView;
+}
+namespace weld
+{
+class CustomWeld;
+}
+
+namespace svx
+{
+class SVX_DLLPUBLIC ClassificationDialog final : public weld::GenericDialogController
+{
+private:
+ SfxClassificationHelper maHelper;
+ SfxClassificationHelper maInternationalHelper;
+
+ const bool m_bPerParagraph;
+ const std::function<void()> m_aParagraphSignHandler;
+
+ ImplSVEvent* m_nAsyncExpandEvent;
+ sal_Int32 m_nCurrentSelectedCategory;
+
+ std::vector<std::vector<ClassificationResult>> m_aRecentlyUsedValuesCollection;
+ std::vector<ClassificationResult> m_aInitialValues;
+
+ std::unique_ptr<weld::Button> m_xOkButton;
+ std::unique_ptr<weld::Button> m_xSignButton;
+ std::unique_ptr<weld::ToggleButton> m_xToolBox;
+ std::unique_ptr<weld::ComboBox> m_xRecentlyUsedListBox;
+ std::unique_ptr<weld::ComboBox> m_xClassificationListBox;
+ std::unique_ptr<weld::ComboBox> m_xInternationalClassificationListBox;
+ std::unique_ptr<weld::Label> m_xMarkingLabel;
+ std::unique_ptr<weld::TreeView> m_xMarkingListBox;
+ std::unique_ptr<weld::TreeView> m_xIntellectualPropertyPartListBox;
+ std::unique_ptr<weld::TreeView> m_xIntellectualPropertyPartNumberListBox;
+ std::unique_ptr<weld::Button> m_xIntellectualPropertyPartAddButton;
+ std::unique_ptr<weld::Entry> m_xIntellectualPropertyPartEdit;
+ std::unique_ptr<weld::Expander> m_xIntellectualPropertyExpander;
+ std::unique_ptr<ClassificationEditView> m_xEditWindow;
+ std::unique_ptr<weld::CustomWeld> m_xEditWindowWeld;
+
+ DECL_DLLPRIVATE_LINK(ButtonClicked, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(OkHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(SelectToolboxHdl, weld::Toggleable&, void);
+ DECL_DLLPRIVATE_LINK(SelectClassificationHdl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(SelectMarkingHdl, weld::TreeView&, bool);
+ DECL_DLLPRIVATE_LINK(SelectIPPartNumbersHdl, weld::TreeView&, bool);
+ DECL_DLLPRIVATE_LINK(SelectRecentlyUsedHdl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(SelectIPPartHdl, weld::TreeView&, bool);
+ DECL_DLLPRIVATE_LINK(EditWindowModifiedHdl, LinkParamNone*, void);
+ DECL_DLLPRIVATE_STATIC_LINK(ClassificationDialog, ExpandedHdl, weld::Expander&, void);
+ DECL_DLLPRIVATE_STATIC_LINK(ClassificationDialog, KeyInput, const KeyEvent&, bool);
+ DECL_DLLPRIVATE_LINK(OnAsyncExpandHdl, void*, void);
+
+ void insertField(ClassificationType eType, OUString const& rString, OUString const& rFullString,
+ OUString const& rIdentifier = OUString());
+ void insertCategoryField(sal_Int32 nID);
+
+ void readIn(std::vector<ClassificationResult> const& rInput);
+ void readRecentlyUsed();
+ void writeRecentlyUsed();
+ void toggleWidgetsDependingOnCategory();
+
+public:
+ ClassificationDialog(weld::Window* pParent,
+ const css::uno::Reference<css::document::XDocumentProperties>& rDocProps,
+ bool bPerParagraph,
+ const std::function<void()>& rParagraphSignHandler = []() {});
+ ~ClassificationDialog() override;
+
+ std::vector<ClassificationResult> getResult();
+ void setupValues(std::vector<ClassificationResult>&& rInput);
+};
+
+} // end svx namespace
+
+#endif // INCLUDED_SVX_CLASSIFICATIONDIALOG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ClassificationField.hxx b/include/svx/ClassificationField.hxx
new file mode 100644
index 000000000..8588a3e02
--- /dev/null
+++ b/include/svx/ClassificationField.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
+#define INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
+
+#include <sal/config.h>
+#include <svx/svxdllapi.h>
+#include <editeng/flditem.hxx>
+
+namespace svx {
+
+enum class ClassificationType
+{
+ CATEGORY,
+ MARKING,
+ TEXT,
+ INTELLECTUAL_PROPERTY_PART,
+ PARAGRAPH,
+};
+
+class SVX_DLLPUBLIC ClassificationResult
+{
+public:
+ ClassificationType meType;
+ OUString msName; //< Display text or 'Name' field (from example.xml).
+ OUString msAbbreviatedName; //< Abbreviated name, displayed instead of Name.
+ OUString msIdentifier; //< The identifier of this entry (from example.xml).
+
+ ClassificationResult(ClassificationType eType, const OUString& sName,
+ const OUString& sAbbreviatedName, const OUString& sIdentifier = "")
+ : meType(eType)
+ , msName(sName)
+ , msAbbreviatedName(sAbbreviatedName)
+ , msIdentifier(sIdentifier)
+ {
+ }
+
+ /// Returns the text to display, which is the Abbreviated Name, if provided, otherwise Name.
+ OUString const & getDisplayText() const
+ {
+ return !msAbbreviatedName.isEmpty() ? msAbbreviatedName : msName;
+ }
+
+ bool operator==(const ClassificationResult& rOther) const
+ {
+ return (meType == rOther.meType &&
+ msName == rOther.msName &&
+ msAbbreviatedName == rOther.msAbbreviatedName &&
+ msIdentifier == rOther.msIdentifier);
+ }
+};
+
+class SVX_DLLPUBLIC ClassificationField final : public SvxFieldData
+{
+public:
+ ClassificationType meType;
+ OUString msDescription;
+ OUString msFullClassName;
+ OUString msIdentifier;
+
+ ClassificationField(ClassificationType eType, OUString const & sDescription, OUString const & sFullClassName, OUString const & sIdentifier)
+ : meType(eType)
+ , msDescription(sDescription)
+ , msFullClassName(sFullClassName)
+ , msIdentifier(sIdentifier)
+ {}
+
+ std::unique_ptr<SvxFieldData> Clone() const override
+ {
+ return std::make_unique<ClassificationField>(meType, msDescription, msFullClassName, msIdentifier);
+ }
+
+ bool operator==(const SvxFieldData& rOther) const override
+ {
+ if (typeid(rOther) != typeid(*this))
+ return false;
+
+ const ClassificationField& rOtherField = static_cast<const ClassificationField&>(rOther);
+ return (meType == rOtherField.meType &&
+ msDescription == rOtherField.msDescription &&
+ msFullClassName == rOtherField.msFullClassName &&
+ msIdentifier == rOtherField.msIdentifier);
+ }
+};
+
+} // end svx namespace
+
+#endif // INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
new file mode 100644
index 000000000..eace8ca26
--- /dev/null
+++ b/include/svx/ColorSets.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_SVX_COLORSETS_HXX
+#define INCLUDED_SVX_COLORSETS_HXX
+
+#include <vector>
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+#include <tools/color.hxx>
+
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+class SdrPage;
+
+namespace svx
+{
+
+class ColorSet
+{
+ OUString maColorSetName;
+ std::vector<Color> maColors;
+public:
+ ColorSet(OUString const & aName);
+
+ void add(sal_uInt32 nIndex, ::Color aColorData)
+ {
+ maColors[nIndex] = aColorData;
+ }
+
+ const OUString& getName() const
+ {
+ return maColorSetName;
+ }
+ const Color& getColor(sal_uInt32 nIndex) const
+ {
+ return maColors[nIndex];
+ }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+};
+
+class SVXCORE_DLLPUBLIC ColorSets
+{
+ std::vector<ColorSet> maColorSets;
+public:
+ ColorSets();
+ ~ColorSets();
+
+ void init();
+ const std::vector<ColorSet>& getColorSets() const
+ {
+ return maColorSets;
+ }
+
+ const ColorSet& getColorSet(sal_uInt32 nIndex)
+ {
+ return maColorSets[nIndex];
+ }
+
+ const ColorSet& getColorSet(std::u16string_view rName);
+};
+
+/// Offsets into the color list of a theme.
+enum class ThemeColorType
+{
+ DK1 = 0,
+ LT1 = 1,
+ DK2 = 2,
+ LT2 = 3,
+ ACCENT1 = 4,
+ ACCENT2 = 5,
+ ACCENT3 = 6,
+ ACCENT4 = 7,
+ ACCENT5 = 8,
+ ACCENT6 = 9,
+ HLINK = 10,
+ FOLHLINK = 11,
+};
+
+/// A named theme has a named color set.
+class SVXCORE_DLLPUBLIC Theme
+{
+ OUString maName;
+ std::unique_ptr<ColorSet> mpColorSet;
+
+public:
+ Theme(OUString const& rName);
+ ~Theme();
+
+ void SetColorSet(std::unique_ptr<ColorSet> pColorSet);
+ ColorSet* GetColorSet();
+
+ void SetName(const OUString& rName);
+ const OUString& GetName() const;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+ void ToAny(css::uno::Any& rVal) const;
+
+ static std::unique_ptr<Theme> FromAny(const css::uno::Any& rVal);
+
+ void UpdateSdrPage(const SdrPage* pPage);
+
+ std::vector<Color> GetColors() const;
+
+ Color GetColor(ThemeColorType eType) const;
+};
+
+} // end of namespace svx
+
+#endif // INCLUDED_SVX_COLORSETS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/CommonStyleManager.hxx b/include/svx/CommonStyleManager.hxx
new file mode 100644
index 000000000..a7f2a7ae3
--- /dev/null
+++ b/include/svx/CommonStyleManager.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVX_COMMONSTYLEMANAGER_HXX
+#define INCLUDED_SVX_COMMONSTYLEMANAGER_HXX
+
+#include <sfx2/StyleManager.hxx>
+#include <svx/svxdllapi.h>
+
+namespace sfx2 { class StylePreviewRenderer; }
+
+class OutputDevice;
+class SfxObjectShell;
+class SfxStyleSheetBase;
+
+namespace svx
+{
+
+class SVXCORE_DLLPUBLIC CommonStyleManager final : public sfx2::StyleManager
+{
+public:
+ CommonStyleManager(SfxObjectShell& rShell)
+ : StyleManager(rShell)
+ {}
+
+ virtual std::unique_ptr<sfx2::StylePreviewRenderer> CreateStylePreviewRenderer(
+ OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle,
+ tools::Long nMaxHeight) override;
+};
+
+} // end namespace svx
+
+#endif // INCLUDED_SVX_COMMONSTYLEMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/EnhancedCustomShape2d.hxx b/include/svx/EnhancedCustomShape2d.hxx
new file mode 100644
index 000000000..abe931940
--- /dev/null
+++ b/include/svx/EnhancedCustomShape2d.hxx
@@ -0,0 +1,224 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ENHANCEDCUSTOMSHAPE2D_HXX
+#define INCLUDED_SVX_ENHANCEDCUSTOMSHAPE2D_HXX
+
+#include <svx/msdffdef.hxx>
+#include <svx/sdasitm.hxx>
+#include <svx/svdotext.hxx>
+#include <tools/degree.hxx>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <svl/itemset.hxx>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+
+#include <svx/EnhancedCustomShapeFunctionParser.hxx>
+#include <tools/gen.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+
+#include <memory>
+#include <vector>
+
+namespace com::sun::star::awt { struct Point; }
+
+class Color;
+class SdrObject;
+class SdrPathObj;
+class SdrObjCustomShape;
+
+enum class HandleFlags
+{
+ NONE = 0x0000,
+ MIRRORED_X = 0x0001,
+ MIRRORED_Y = 0x0002,
+ SWITCHED = 0x0004,
+ POLAR = 0x0008,
+ RANGE_X_MINIMUM = 0x0020,
+ RANGE_X_MAXIMUM = 0x0040,
+ RANGE_Y_MINIMUM = 0x0080,
+ RANGE_Y_MAXIMUM = 0x0100,
+ RADIUS_RANGE_MINIMUM = 0x0200,
+ RADIUS_RANGE_MAXIMUM = 0x0400,
+ REFX = 0x0800,
+ REFY = 0x1000,
+ REFANGLE = 0x2000,
+ REFR = 0x4000,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<HandleFlags> : is_typed_flags<HandleFlags, 0x7fef> {};
+}
+
+// MSDFF_HANDLE_FLAGS_RANGE_Y seems to be not defined in
+// escher, but we are using it internally in to differentiate
+// between X_RANGE and Y_RANGE
+
+class SVXCORE_DLLPUBLIC EnhancedCustomShape2d final : public SfxItemSet
+{
+ SdrObjCustomShape& mrSdrObjCustomShape;
+ MSO_SPT eSpType;
+
+ sal_Int32 nCoordLeft;
+ sal_Int32 nCoordTop;
+ sal_Int32 nCoordWidthG;
+ sal_Int32 nCoordHeightG;
+ sal_Int32 nCoordWidth;
+ sal_Int32 nCoordHeight;
+ tools::Rectangle aLogicRect;
+
+ double fXScale;
+ double fYScale;
+ double fXRatio;
+ double fYRatio;
+
+ bool bOOXMLShape;
+
+ sal_Int32 nXRef;
+ sal_Int32 nYRef;
+ sal_uInt32 nColorData;
+
+ /*
+
+ */
+ struct SAL_DLLPRIVATE EquationResult {
+ bool bReady;
+ double fValue;
+ };
+ css::uno::Sequence< OUString > seqEquations;
+ std::vector< std::shared_ptr< EnhancedCustomShape::ExpressionNode > > vNodesSharedPtr;
+ std::vector< EquationResult > vEquationResults;
+
+ css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments;
+ css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqCoordinates;
+ css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames;
+ css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqGluePoints;
+ css::uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > seqAdjustmentValues;
+ css::uno::Sequence< css::beans::PropertyValues > seqHandles;
+ css::uno::Sequence< css::awt::Size > seqSubViewSize;
+
+ bool bFilled : 1;
+ bool bStroked : 1;
+
+ bool bFlipH;
+ bool bFlipV;
+ Degree100 nRotateAngle;
+
+ SAL_DLLPRIVATE bool SetAdjustValueAsDouble( const double& rValue, const sal_Int32 nIndex );
+ SAL_DLLPRIVATE Color GetColorData( const Color& rFillColor, sal_uInt32 nIndex, double dBrightness ) const;
+ SAL_DLLPRIVATE void AdaptObjColor(
+ SdrPathObj& rObj,
+ double dBrightness,
+ const SfxItemSet& rCustomShapeSet,
+ sal_uInt32& nColorIndex,
+ sal_uInt32 nColorCount);
+ SAL_DLLPRIVATE Point GetPoint( const css::drawing::EnhancedCustomShapeParameterPair&,
+ const bool bScale = true, const bool bReplaceGeoSize = false ) const;
+ SAL_DLLPRIVATE basegfx::B2DPoint GetPointAsB2DPoint(const css::drawing::EnhancedCustomShapeParameterPair&,
+ const bool bScale = true, const bool bReplaceGeoSize = false ) const;
+
+ SAL_DLLPRIVATE void CreateSubPath(
+ sal_Int32& rSrcPt,
+ sal_Int32& rSegmentInd,
+ std::vector< std::pair< SdrPathObjUniquePtr, double> >& rObjectList,
+ bool bLineGeometryNeededOnly,
+ bool bSortFilledObjectsToBack,
+ sal_Int32 nIndex);
+ SAL_DLLPRIVATE SdrObjectUniquePtr CreatePathObj( bool bLineGeometryNeededOnly );
+ SAL_DLLPRIVATE void ApplyShapeAttributes( const SdrCustomShapeGeometryItem& rItem );
+
+ SAL_DLLPRIVATE void SetPathSize( sal_Int32 nIndex = 0 );
+
+ public:
+
+ struct SAL_DLLPRIVATE Handle
+ {
+ HandleFlags nFlags;
+
+ css::drawing::EnhancedCustomShapeParameterPair aPosition;
+ css::drawing::EnhancedCustomShapeParameterPair aPolar;
+
+ sal_Int32 nRefX;
+ sal_Int32 nRefY;
+ sal_Int32 nRefAngle;
+ sal_Int32 nRefR;
+
+ css::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
+ css::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
+ css::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
+ css::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
+ css::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
+ css::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
+
+ Handle()
+ : nFlags(HandleFlags::NONE)
+ , nRefX( -1 )
+ , nRefY( -1 )
+ , nRefAngle( -1 )
+ , nRefR( -1 )
+ {
+ }
+ };
+
+ sal_Int32 GetLuminanceChange( sal_uInt32 nIndex ) const;
+ SAL_DLLPRIVATE bool IsFlipVert() const { return bFlipV; };
+ SAL_DLLPRIVATE bool IsFlipHorz() const { return bFlipH; };
+ SAL_DLLPRIVATE Degree100 GetRotateAngle() const { return nRotateAngle; };
+
+ SdrObjectUniquePtr CreateLineGeometry();
+ SdrObjectUniquePtr CreateObject( bool bLineGeometryNeededOnly );
+ void ApplyGluePoints( SdrObject* pObj );
+ tools::Rectangle GetTextRect() const;
+ const tools::Rectangle& GetLogicRect() const { return aLogicRect; }
+
+ sal_uInt32 GetHdlCount() const;
+ bool GetHandlePosition( const sal_uInt32 nIndex, Point& rReturnPosition ) const;
+ bool SetHandleControllerPosition( const sal_uInt32 nIndex, const css::awt::Point& rPosition );
+
+ EnhancedCustomShape2d(SdrObjCustomShape& rSdrObjCustomShape);
+ virtual ~EnhancedCustomShape2d() override;
+
+ SAL_DLLPRIVATE double GetEnumFunc( const EnhancedCustomShape::ExpressionFunct eVal ) const;
+
+ void GetParameter( double& rParameterReturnValue, const css::drawing::EnhancedCustomShapeParameter&,
+ const bool bReplaceGeoWidth, const bool bReplaceGeoHeight ) const;
+ SAL_DLLPRIVATE double GetAdjustValueAsDouble( const sal_Int32 nIndex ) const;
+ SAL_DLLPRIVATE double GetEquationValueAsDouble( const sal_Int32 nIndex ) const;
+
+ static OUString GetEquation( const sal_uInt16 nFlags, sal_Int32 nPara1, sal_Int32 nPara2, sal_Int32 nPara3 );
+
+ SAL_DLLPRIVATE static void AppendEnhancedCustomShapeEquationParameter( OUString& rParameter, const sal_Int32 nPara, const bool bIsSpecialValue );
+
+ static void SetEnhancedCustomShapeParameter( css::drawing::EnhancedCustomShapeParameter&
+ rParameter, const sal_Int32 nValue );
+ static void SetEnhancedCustomShapeHandleParameter( css::drawing::EnhancedCustomShapeParameter&
+ rParameter, const sal_Int32 nPara, const bool bIsSpecialValue, bool bHorz );
+ SAL_DLLPRIVATE static bool ConvertSequenceToEnhancedCustomShape2dHandle( const css::beans::PropertyValues& rHandleProperties,
+ EnhancedCustomShape2d::Handle& rDestinationHandle );
+ SAL_DLLPRIVATE static void SwapStartAndEndArrow( SdrObject* pObj );
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/EnhancedCustomShapeFunctionParser.hxx b/include/svx/EnhancedCustomShapeFunctionParser.hxx
new file mode 100644
index 000000000..28d2491c7
--- /dev/null
+++ b/include/svx/EnhancedCustomShapeFunctionParser.hxx
@@ -0,0 +1,249 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ENHANCEDCUSTOMSHAPEFUNCTIONPARSER_HXX
+#define INCLUDED_SVX_ENHANCEDCUSTOMSHAPEFUNCTIONPARSER_HXX
+
+#include <config_options.h>
+#include <sal/config.h>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp>
+#include <memory>
+#include <ostream>
+#include <string_view>
+#include <vector>
+
+#include <svx/svxdllapi.h>
+
+struct EnhancedCustomShapeEquation
+{
+ sal_Int32 nOperation;
+ sal_Int32 nPara[ 3 ];
+
+ EnhancedCustomShapeEquation() :
+ nOperation ( 0 )
+ {
+ nPara[ 0 ] = nPara[ 1 ] = nPara[ 2 ] = 0;
+ }
+};
+
+class EnhancedCustomShape2d;
+
+namespace EnhancedCustomShape {
+
+enum class ExpressionFunct
+{
+ Const,
+
+ EnumPi,
+ EnumLeft,
+ EnumTop,
+ EnumRight,
+ EnumBottom,
+ EnumXStretch,
+ EnumYStretch,
+ EnumHasStroke,
+ EnumHasFill,
+ EnumWidth,
+ EnumHeight,
+ EnumLogWidth,
+ EnumLogHeight,
+ EnumAdjustment,
+ EnumEquation,
+
+ UnaryAbs,
+ UnarySqrt,
+ UnarySin,
+ UnaryCos,
+ UnaryTan,
+ UnaryAtan,
+ UnaryNeg,
+
+ BinaryPlus,
+ BinaryMinus,
+ BinaryMul,
+ BinaryDiv,
+ BinaryMin,
+ BinaryMax,
+ BinaryAtan2,
+
+ TernaryIf
+};
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const ExpressionFunct& eFunc )
+{
+ switch (eFunc)
+ {
+ case ExpressionFunct::Const : return stream << "const";
+
+ case ExpressionFunct::EnumPi : return stream << "pi";
+ case ExpressionFunct::EnumLeft : return stream << "left";
+ case ExpressionFunct::EnumTop : return stream << "top";
+ case ExpressionFunct::EnumRight : return stream << "right";
+ case ExpressionFunct::EnumBottom : return stream << "bottom";
+ case ExpressionFunct::EnumXStretch : return stream << "xstretch";
+ case ExpressionFunct::EnumYStretch : return stream << "ystretch";
+ case ExpressionFunct::EnumHasStroke : return stream << "hasstroke";
+ case ExpressionFunct::EnumHasFill : return stream << "hasfill";
+ case ExpressionFunct::EnumWidth : return stream << "width";
+ case ExpressionFunct::EnumHeight : return stream << "height";
+ case ExpressionFunct::EnumLogWidth : return stream << "logwidth";
+ case ExpressionFunct::EnumLogHeight : return stream << "logheight";
+ case ExpressionFunct::EnumAdjustment : return stream << "adjustment";
+ case ExpressionFunct::EnumEquation : return stream << "equation";
+
+ case ExpressionFunct::UnaryAbs : return stream << "abs";
+ case ExpressionFunct::UnarySqrt : return stream << "sqrt";
+ case ExpressionFunct::UnarySin : return stream << "sin";
+ case ExpressionFunct::UnaryCos : return stream << "cos";
+ case ExpressionFunct::UnaryTan : return stream << "tan";
+ case ExpressionFunct::UnaryAtan : return stream << "atan";
+ case ExpressionFunct::UnaryNeg : return stream << "neg";
+
+ case ExpressionFunct::BinaryPlus : return stream << "plus";
+ case ExpressionFunct::BinaryMinus : return stream << "minus";
+ case ExpressionFunct::BinaryMul : return stream << "mul";
+ case ExpressionFunct::BinaryDiv : return stream << "div";
+ case ExpressionFunct::BinaryMin : return stream << "min";
+ case ExpressionFunct::BinaryMax : return stream << "max";
+ case ExpressionFunct::BinaryAtan2 : return stream << "atan2";
+
+ case ExpressionFunct::TernaryIf : return stream << "if";
+
+ default: return stream << "?(" << static_cast<int>(eFunc) << ")";
+ }
+}
+
+#define EXPRESSION_FLAG_SUMANGLE_MODE 1
+
+SVXCORE_DLLPUBLIC void FillEquationParameter( const css::drawing::EnhancedCustomShapeParameter&, const sal_Int32, EnhancedCustomShapeEquation& );
+
+class SAL_DLLPUBLIC_RTTI ExpressionNode
+{
+public:
+ virtual ~ExpressionNode();
+
+ /** Predicate whether this node is constant.
+
+ This predicate returns true, if this node is
+ neither time- nor ViewInfo dependent. This allows
+ for certain optimizations, i.e. not the full
+ expression tree needs be represented by
+ ExpressionNodes.
+
+ @returns true, if the note is constant
+ */
+ virtual bool isConstant() const = 0;
+
+ /** Operator to calculate function value.
+
+ This method calculates the function value.
+ */
+ virtual double operator()() const = 0;
+
+ /** Operator to retrieve the type of expression node
+ */
+ virtual ExpressionFunct getType() const = 0;
+
+ /** Operator to retrieve the ms version of expression
+ */
+ virtual css::drawing::EnhancedCustomShapeParameter fillNode(
+ std::vector< EnhancedCustomShapeEquation >& rEquations, ExpressionNode* pOptionalArg, sal_uInt32 nFlags ) = 0;
+};
+
+/** This exception is thrown, when the arithmetic expression
+ parser failed to parse a string.
+ */
+struct ParseError
+{
+ ParseError( const char* ) {}
+};
+
+class FunctionParser
+{
+public:
+
+ /** Parse a string
+
+ The following grammar is accepted by this method:
+ <code>
+
+ number_digit = '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'
+
+ number = number number_digit | number_digit
+
+ identifier = 'pi'|'left'|'top'|'right'|'bottom'|'xstretch'|'ystretch'|
+ 'hasstroke'|'hasfill'|'width'|'height'|'logwidth'|'logheight'
+
+ unary_function = 'abs'|'sqrt'|'sin'|'cos'|'tan'|'atan'
+ binary_function = 'min'|'max'|'atan2'
+ ternary_function = 'if'
+
+ function_reference = '?' 'a-z,A-Z,0-9' ' '
+ modifier_reference = '$' '0-9' ' '
+
+ basic_expression =
+ number |
+ identifier |
+ function_reference |
+ unary_function '(' additive_expression ')' |
+ binary_function '(' additive_expression ',' additive_expression ')' |
+ ternary_function '(' additive_expression ',' additive_expression ',
+ ' additive_expression ')' | '(' additive_expression ')'
+
+ unary_expression = '-' basic_expression
+
+ multiplicative_expression =
+ basic_expression |
+ multiplicative_expression '*' basic_expression |
+ multiplicative_expression '/' basic_expression
+
+ additive_expression =
+ multiplicative_expression |
+ additive_expression '+' multiplicative_expression |
+ additive_expression '-' multiplicative_expression
+
+ </code>
+
+ @param rFunction
+ The string to parse
+
+ @param rCustoShape
+ The CustomShape is required for calculation of dynamic values such
+ "hasstroke", function references and or modifier references ...
+
+ @throws ParseError if an invalid expression is given.
+
+ @return the generated function object.
+ */
+
+ UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) static std::shared_ptr<ExpressionNode> const & parseFunction( std::u16string_view rFunction, const EnhancedCustomShape2d& rCustoShape );
+
+ // this is a singleton
+ FunctionParser() = delete;
+ FunctionParser(const FunctionParser&) = delete;
+ FunctionParser& operator=( const FunctionParser& ) = delete;
+};
+
+}
+
+#endif // INCLUDED_SVX_ENHANCEDCUSTOMSHAPEFUNCTIONPARSER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/EnhancedCustomShapeGeometry.hxx b/include/svx/EnhancedCustomShapeGeometry.hxx
new file mode 100644
index 000000000..a52dc4820
--- /dev/null
+++ b/include/svx/EnhancedCustomShapeGeometry.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ENHANCEDCUSTOMSHAPEGEOMETRY_HXX
+#define INCLUDED_SVX_ENHANCEDCUSTOMSHAPEGEOMETRY_HXX
+
+#include <sal/types.h>
+#include <svx/msdffdef.hxx>
+#include <svx/svxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+struct SvxMSDffVertPair
+{
+ sal_Int32 nValA;
+ sal_Int32 nValB;
+};
+struct SvxMSDffCalculationData
+{
+ sal_uInt16 nFlags;
+ sal_Int32 nVal[ 3 ];
+};
+struct SvxMSDffTextRectangles
+{
+ SvxMSDffVertPair nPairA;
+ SvxMSDffVertPair nPairB;
+};
+
+enum class SvxMSDffHandleFlags
+{
+ NONE = 0x0000,
+ MIRRORED_X = 0x0001,
+ MIRRORED_Y = 0x0002,
+ SWITCHED = 0x0004,
+ POLAR = 0x0008,
+ MAP = 0x0010,
+ RANGE = 0x0020,
+ RANGE_X_MIN_IS_SPECIAL = 0x0080,
+ RANGE_X_MAX_IS_SPECIAL = 0x0100,
+ RANGE_Y_MIN_IS_SPECIAL = 0x0200,
+ RANGE_Y_MAX_IS_SPECIAL = 0x0400,
+ CENTER_X_IS_SPECIAL = 0x0800,
+ CENTER_Y_IS_SPECIAL = 0x1000,
+ RADIUS_RANGE = 0x2000,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvxMSDffHandleFlags> : is_typed_flags<SvxMSDffHandleFlags, 0x3fbf> {};
+}
+
+struct SvxMSDffHandle
+{
+ SvxMSDffHandleFlags nFlags;
+ sal_Int32 nPositionX, nPositionY, nCenterX, nCenterY, nRangeXMin, nRangeXMax, nRangeYMin, nRangeYMax;
+};
+struct mso_CustomShape
+{
+ SvxMSDffVertPair* pVertices;
+ sal_uInt32 nVertices;
+ sal_uInt16* pElements;
+ sal_uInt32 nElements;
+ SvxMSDffCalculationData* pCalculation;
+ sal_uInt32 nCalculation;
+ sal_Int32* pDefData;
+ SvxMSDffTextRectangles* pTextRect;
+ sal_uInt32 nTextRect;
+ sal_Int32 nCoordWidth;
+ sal_Int32 nCoordHeight;
+ sal_Int32 nXRef;
+ sal_Int32 nYRef;
+ SvxMSDffVertPair* pGluePoints;
+ sal_uInt32 nGluePoints;
+ SvxMSDffHandle* pHandles;
+ sal_uInt32 nHandles;
+};
+
+#define MSO_I | sal_Int32(0x80000000)
+
+bool SortFilledObjectsToBackByDefault( MSO_SPT eSpType );
+SVXCORE_DLLPUBLIC bool IsCustomShapeFilledByDefault( MSO_SPT eSpType );
+SVXCORE_DLLPUBLIC sal_Int16 GetCustomShapeConnectionTypeDefault( MSO_SPT eSpType );
+
+// #i28269#
+SVXCORE_DLLPUBLIC bool IsCustomShapeStrokedByDefault( MSO_SPT eSpType );
+
+SVXCORE_DLLPUBLIC const mso_CustomShape* GetCustomShapeContent( MSO_SPT eSpType );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/EnhancedCustomShapeTypeNames.hxx b/include/svx/EnhancedCustomShapeTypeNames.hxx
new file mode 100644
index 000000000..b369c8c42
--- /dev/null
+++ b/include/svx/EnhancedCustomShapeTypeNames.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ENHANCEDCUSTOMSHAPETYPENAMES_HXX
+#define INCLUDED_SVX_ENHANCEDCUSTOMSHAPETYPENAMES_HXX
+#include <svx/msdffdef.hxx>
+#include <svx/svxdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace EnhancedCustomShapeTypeNames
+{
+SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString&);
+SVXCORE_DLLPUBLIC OUString Get(const MSO_SPT);
+SVXCORE_DLLPUBLIC const OUString& GetAccName(const OUString&);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/FileExportedDialog.hxx b/include/svx/FileExportedDialog.hxx
new file mode 100644
index 000000000..3ad5ab559
--- /dev/null
+++ b/include/svx/FileExportedDialog.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <vcl/weld.hxx>
+#include <svx/svxdllapi.h>
+
+class SVX_DLLPUBLIC FileExportedDialog final : public weld::GenericDialogController
+{
+private:
+ std::unique_ptr<weld::Label> m_xFileLabel;
+ std::unique_ptr<weld::Button> m_xButton;
+
+ DECL_DLLPRIVATE_LINK(OpenHdl, weld::Button&, void);
+
+public:
+ explicit FileExportedDialog(weld::Window* pParent, OUString atitle);
+};
diff --git a/include/svx/GenericCheckDialog.hxx b/include/svx/GenericCheckDialog.hxx
new file mode 100644
index 000000000..9878ea9fa
--- /dev/null
+++ b/include/svx/GenericCheckDialog.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <svx/svxdllapi.h>
+#include <tools/link.hxx>
+#include <vcl/weld.hxx>
+
+namespace svx
+{
+/**
+ * Interface for the data of a check, which must be extended by the
+ * check itself, to show the data in the GenericCheckDialog.
+ */
+class CheckData
+{
+public:
+ virtual ~CheckData() {}
+
+ /// check entry text
+ virtual OUString getText() = 0;
+
+ /// true, if we can show the "Mark" button
+ virtual bool canMarkObject() = 0;
+ /// executed, when the "Mark" button is hit
+ virtual void markObject() = 0;
+
+ /// true, if we can show the "Properties" button
+ virtual bool hasProperties() = 0;
+ /// executed, when the "Properties" button is hit
+ virtual void runProperties() = 0;
+};
+
+/**
+ * Check data collection contains all the checks in one data structure,
+ * and also serves to define additional attributes that are used by the
+ * GenericCheckDialog (the title of the check dialog).
+ */
+class CheckDataCollection
+{
+protected:
+ std::vector<std::unique_ptr<CheckData>> m_aCollection;
+
+public:
+ virtual ~CheckDataCollection() {}
+
+ std::vector<std::unique_ptr<CheckData>>& getCollection() { return m_aCollection; }
+
+ virtual OUString getTitle() = 0;
+};
+
+/**
+ * A UI piece to show check result text and other widgets, which are
+ * relevant for the check (various buttons to act on the check result).
+ */
+class GenericCheckEntry final
+{
+private:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::Label> m_xLabel;
+ std::unique_ptr<weld::Button> m_xMarkButton;
+ std::unique_ptr<weld::Button> m_xPropertiesButton;
+
+ std::unique_ptr<CheckData>& m_pCheckData;
+
+public:
+ GenericCheckEntry(weld::Container* pParent, std::unique_ptr<CheckData>& rCheckData);
+
+ weld::Widget* get_widget() const { return m_xContainer.get(); }
+
+ DECL_LINK(MarkButtonClicked, weld::Button&, void);
+ DECL_LINK(PropertiesButtonClicked, weld::Button&, void);
+};
+
+/**
+ * This is a generic dialog, which is used to display results of a
+ * document checks, like for example image size check.
+ */
+class SVX_DLLPUBLIC GenericCheckDialog final : public weld::GenericDialogController
+{
+private:
+ std::vector<std::unique_ptr<GenericCheckEntry>> m_aCheckEntries;
+ CheckDataCollection& m_rCheckDataCollection;
+
+ std::unique_ptr<weld::Box> m_xCheckBox;
+
+public:
+ GenericCheckDialog(weld::Window* pParent, CheckDataCollection& rCheckDataCollection);
+ virtual ~GenericCheckDialog() override;
+ virtual short run() override;
+};
+
+} // end svx namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/IAccessibleParent.hxx b/include/svx/IAccessibleParent.hxx
new file mode 100644
index 000000000..50530c0a0
--- /dev/null
+++ b/include/svx/IAccessibleParent.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_IACCESSIBLEPARENT_HXX
+#define INCLUDED_SVX_IACCESSIBLEPARENT_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <tools/long.hxx>
+
+namespace accessibility { class AccessibleControlShape; }
+namespace com::sun::star::accessibility { class XAccessible; }
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::drawing { class XShape; }
+
+namespace accessibility {
+
+class AccessibleShape;
+class AccessibleShapeTreeInfo;
+
+/** This interface contains methods missing from the
+ XAccessibleContext interface that allow the modification of
+ parent/child relationship.
+*/
+class IAccessibleParent
+{
+public:
+ /** Allow for a virtual destructor.
+ */
+ virtual ~IAccessibleParent(){};
+
+ /** A call to this method requests the implementor to replace one child
+ with another and send the appropriate notifications. That are two
+ child events: One notifying the removal of the current child and one
+ about the existence of the new child. The index of the new child is
+ implementation dependent, i.e. it is not guaranteed that the
+ replacement has the same index as the current child has.
+
+ <p>A default implementation can just use the ShapeTypeHandler::CreateAccessibleObject
+ to let a factory create the new instance with the parameters given, and then
+ place the new shape into the own structures.</p>
+
+ @param pCurrentChild
+ This child is about to be replaced.
+
+ @param _rxShape
+ The UNO shape which the old and new child represent
+
+ @param _nIndex
+ The IndexInParent of the old child. Note that the index in
+ parent of the replacement is not necessarily the same as
+ that of the current child.
+
+ @param _rShapeTreeInfo
+ The TreeInfo for the old child.
+
+ @return
+ If the replacement has taken place successfully <TRUE/> is
+ returned. If the replacement can not be carried out or an error
+ occurs that does not result in an exception then <FALSE/> is
+ returned.
+
+ @throws RuntimeException
+ in case something went heavily wrong
+ */
+ virtual bool ReplaceChild (
+ AccessibleShape* pCurrentChild,
+ const css::uno::Reference< css::drawing::XShape >& _rxShape,
+ const tools::Long _nIndex,
+ const AccessibleShapeTreeInfo& _rShapeTreeInfo
+ ) = 0;
+ //Add this method to support Form Controls
+ /// @throws css::uno::RuntimeException
+ virtual AccessibleControlShape* GetAccControlShapeFromModel
+ (css::beans::XPropertySet*){return nullptr;};
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible>
+ GetAccessibleCaption (const css::uno::Reference<
+ css::drawing::XShape>&){return nullptr;};
+ virtual bool IsDocumentSelAll(){ return false; }
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/IAccessibleViewForwarder.hxx b/include/svx/IAccessibleViewForwarder.hxx
new file mode 100644
index 000000000..fd9a5f638
--- /dev/null
+++ b/include/svx/IAccessibleViewForwarder.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_IACCESSIBLEVIEWFORWARDER_HXX
+#define INCLUDED_SVX_IACCESSIBLEVIEWFORWARDER_HXX
+
+#include <tools/gen.hxx>
+
+namespace accessibility
+{
+/** <p>This interface provides the means to transform between internal
+ coordinates in 100th of mm and screen coordinates without giving direct
+ access to the underlying view. Each view forwarder represents a
+ specific real or virtual window. A call to
+ <method>GetVisibleArea</method> returns the visible rectangle that
+ corresponds to this window.</p>
+
+ <p>This interface is similar to the SvxViewForwarder but
+ differs in two important points: Firstly the <member>GetVisArea</member>
+ method returns a rectangle in internal coordinates and secondly the
+ transformation methods do not require explicit mapmodes. These have to
+ be provided implicitly by the classes that implement this
+ interface. A third, less important, difference are the additional
+ transformation methods for sizes. The reasons for their existence are
+ convenience and improved performance.</p>
+
+ @attention
+ Note, that modifications of the underlying view that lead to
+ different transformations between internal and screen coordinates or
+ change the validity of the forwarder have to be signaled separately.
+*/
+class IAccessibleViewForwarder
+{
+public:
+ IAccessibleViewForwarder() = default;
+ IAccessibleViewForwarder(IAccessibleViewForwarder const&) = default;
+ IAccessibleViewForwarder(IAccessibleViewForwarder&&) = default;
+ IAccessibleViewForwarder& operator=(IAccessibleViewForwarder const&) = default;
+ IAccessibleViewForwarder& operator=(IAccessibleViewForwarder&&) = default;
+
+ virtual ~IAccessibleViewForwarder(){};
+
+ /** Returns the area of the underlying document that is visible in the
+ * corresponding window.
+
+ @return
+ The rectangle of the visible part of the document. The values
+ are, contrary to the base class, in internal coordinates of
+ 100th of mm.
+ */
+ virtual tools::Rectangle GetVisibleArea() const = 0;
+
+ /** Transform the specified point from internal coordinates in 100th of
+ mm to an absolute screen position.
+
+ @param rPoint
+ Point in internal coordinates (100th of mm).
+
+ @return
+ The same point but in screen coordinates relative to the upper
+ left corner of the (current) screen.
+ */
+ virtual Point LogicToPixel(const Point& rPoint) const = 0;
+
+ /** Transform the specified size from internal coordinates in 100th of
+ mm to a screen oriented pixel size.
+
+ @param rSize
+ Size in internal coordinates (100th of mm).
+
+ @return
+ The same size but in screen coordinates.
+ */
+ virtual Size LogicToPixel(const Size& rSize) const = 0;
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/IAccessibleViewForwarderListener.hxx b/include/svx/IAccessibleViewForwarderListener.hxx
new file mode 100644
index 000000000..bd2265b96
--- /dev/null
+++ b/include/svx/IAccessibleViewForwarderListener.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_IACCESSIBLEVIEWFORWARDERLISTENER_HXX
+#define INCLUDED_SVX_IACCESSIBLEVIEWFORWARDERLISTENER_HXX
+
+namespace accessibility
+{
+/** <p>The purpose of this interface is to notify a user of an
+ IAccessibleViewForwarder when that view forwarder changes its
+ properties. Such a change may be one of the following:
+ <ul>
+ <li>Change of the coordinate transformation.</li>
+ <li>Change of the visible area (which in turn results in a change of the
+ coordinate transformation.</li>
+ <li>Change of the validity state of the view forwarder.</li>
+*/
+class IAccessibleViewForwarderListener
+{
+public:
+ /** This method is called to indicate a change of the specified view
+ forwarder, specifically, a change in visible area.
+ */
+ virtual void ViewForwarderChanged() = 0;
+
+protected:
+ ~IAccessibleViewForwarderListener() {}
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ImageMapInfo.hxx b/include/svx/ImageMapInfo.hxx
new file mode 100644
index 000000000..0e12df24d
--- /dev/null
+++ b/include/svx/ImageMapInfo.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdobj.hxx>
+#include <svx/svxdllapi.h>
+#include <vcl/imap.hxx>
+
+#define SVX_IMAPINFO_ID 2
+
+class SVXCORE_DLLPUBLIC SvxIMapInfo final : public SdrObjUserData, public SfxListener
+{
+ ImageMap aImageMap;
+
+public:
+ SvxIMapInfo(const ImageMap& rImageMap)
+ : SdrObjUserData(SdrInventor::StarDrawUserData, SVX_IMAPINFO_ID)
+ , aImageMap(rImageMap){};
+
+ SvxIMapInfo(const SvxIMapInfo& rIMapInfo)
+ : SdrObjUserData(SdrInventor::StarDrawUserData, SVX_IMAPINFO_ID)
+ , SfxListener()
+ , aImageMap(rIMapInfo.aImageMap){};
+
+ virtual std::unique_ptr<SdrObjUserData> Clone(SdrObject*) const override
+ {
+ return std::unique_ptr<SdrObjUserData>(new SvxIMapInfo(*this));
+ }
+
+ void SetImageMap(const ImageMap& rIMap) { aImageMap = rIMap; }
+ const ImageMap& GetImageMap() const { return aImageMap; }
+
+ static SvxIMapInfo* GetIMapInfo(const SdrObject* pObject);
+ static IMapObject* GetHitIMapObject(const SdrObject* pObj, const Point& rWinPoint,
+ const OutputDevice* pCmpWnd = nullptr);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/MediaShellHelpers.hxx b/include/svx/MediaShellHelpers.hxx
new file mode 100644
index 000000000..c0d27e37b
--- /dev/null
+++ b/include/svx/MediaShellHelpers.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svxdllapi.h>
+
+class SdrMarkView;
+class SfxItemSet;
+class SfxRequest;
+
+namespace avmedia
+{
+class MediaItem;
+}
+
+namespace svx::MediaShellHelpers
+{
+SVX_DLLPUBLIC void GetState(const SdrMarkView* pSdrView, SfxItemSet& rSet);
+SVX_DLLPUBLIC const ::avmedia::MediaItem* Execute(const SdrMarkView* pSdrView,
+ SfxRequest const& rReq);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx
new file mode 100644
index 000000000..c23a09f9c
--- /dev/null
+++ b/include/svx/Palette.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_PALETTE_HXX
+#define INCLUDED_SVX_PALETTE_HXX
+
+#include <sal/config.h>
+
+#include <functional>
+
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+#include <svx/svxdllapi.h>
+
+class SvxColorValueSet;
+
+typedef std::pair<Color, OUString> NamedColor;
+
+namespace svx
+{
+/// A color with an optional name and other theming-related properties.
+struct SVXCORE_DLLPUBLIC NamedThemedColor
+{
+ Color m_aColor;
+ OUString m_aName;
+ sal_Int16 m_nThemeIndex = -1;
+ sal_Int16 m_nLumMod = 10000;
+ sal_Int16 m_nLumOff = 0;
+
+ static NamedThemedColor FromNamedColor(const NamedColor& rNamedColor);
+
+ NamedColor ToNamedColor() const;
+};
+}
+
+typedef std::function<void(const OUString&, const svx::NamedThemedColor&)> ColorSelectFunction;
+
+class Palette
+{
+public:
+ virtual ~Palette();
+
+ virtual const OUString& GetName() = 0;
+ virtual const OUString& GetPath() = 0;
+ virtual void LoadColorSet(SvxColorValueSet& rColorSet) = 0;
+
+ virtual bool IsValid() = 0;
+};
+
+#endif // INCLUDED_SVX_PALETTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
new file mode 100644
index 000000000..4e45df001
--- /dev/null
+++ b/include/svx/PaletteManager.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_PALETTEMANAGER_HXX
+#define INCLUDED_SVX_PALETTEMANAGER_HXX
+
+#include <svx/Palette.hxx>
+#include <rtl/ustring.hxx>
+#include <svx/xtable.hxx>
+#include <svtools/colrdlg.hxx>
+
+#include <deque>
+#include <vector>
+#include <memory>
+
+namespace com::sun::star::uno { class XComponentContext; }
+namespace svx { class ToolboxButtonColorUpdaterBase; }
+namespace weld { class Window; }
+
+class SVXCORE_DLLPUBLIC PaletteManager
+{
+ const sal_uInt16 mnMaxRecentColors;
+
+ sal_uInt16 mnNumOfPalettes;
+ sal_uInt16 mnCurrentPalette;
+
+ tools::Long mnColorCount;
+ svx::ToolboxButtonColorUpdaterBase* mpBtnUpdater;
+
+ XColorListRef pColorList;
+ std::deque<NamedColor> maRecentColors;
+ std::vector<std::unique_ptr<Palette>> m_Palettes;
+
+ ColorSelectFunction maColorSelectFunction;
+
+ std::unique_ptr<SvColorDialog> m_pColorDlg;
+public:
+ PaletteManager();
+ ~PaletteManager();
+ PaletteManager(const PaletteManager&) = delete;
+ PaletteManager& operator=(const PaletteManager&) = delete;
+ void LoadPalettes();
+ void ReloadColorSet(SvxColorValueSet& rColorSet);
+ void ReloadRecentColorSet(SvxColorValueSet& rColorSet);
+ std::vector<OUString> GetPaletteList();
+ void SetPalette( sal_Int32 nPos );
+ sal_Int32 GetPalette() const;
+ sal_Int32 GetPaletteCount() const { return mnNumOfPalettes; }
+ OUString GetPaletteName();
+ OUString GetSelectedPalettePath();
+
+ tools::Long GetColorCount() const;
+ tools::Long GetRecentColorCount() const;
+ void AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true);
+
+ void SetBtnUpdater(svx::ToolboxButtonColorUpdaterBase* pBtnUpdater);
+ void PopupColorPicker(weld::Window* pParent, const OUString& aCommand, const Color& rInitialColor);
+
+ void SetColorSelectFunction(const ColorSelectFunction& aColorSelectFunction);
+
+ bool IsThemePaletteSelected() const;
+
+ static void GetThemeIndexLumModOff(sal_uInt16 nItemId, sal_Int16& rThemeIndex,
+ sal_Int16& rLumMod, sal_Int16& rLumOff);
+
+ static void DispatchColorCommand(const OUString& aCommand, const svx::NamedThemedColor& rColor);
+};
+
+#endif // INCLUDED_SVX_PALETTEMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ParaSpacingControl.hxx b/include/svx/ParaSpacingControl.hxx
new file mode 100644
index 000000000..3a5c1d0fa
--- /dev/null
+++ b/include/svx/ParaSpacingControl.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARASPACINGCONTROL_HXX
+#define INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARASPACINGCONTROL_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include <svx/svxdllapi.h>
+#include <com/sun/star/ui/XContextChangeEventListener.hpp>
+
+namespace com::sun::star::ui
+{
+class XContextChangeEventMultiplexer;
+}
+namespace com::sun::star::ui
+{
+struct ContextChangeEventObject;
+}
+namespace vcl
+{
+class Window;
+}
+
+namespace svx
+{
+class ParaULSpacingControl : public SfxToolBoxControl
+{
+public:
+ ParaULSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
+ virtual ~ParaULSpacingControl() override;
+
+ virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState) override;
+ virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override = 0;
+};
+
+class SVX_DLLPUBLIC ParaAboveSpacingControl final : public ParaULSpacingControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ ParaAboveSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
+ virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
+};
+
+class SVX_DLLPUBLIC ParaBelowSpacingControl final : public ParaULSpacingControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ ParaBelowSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
+ virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
+};
+
+class ParaLRSpacingControl : public SfxToolBoxControl, public css::ui::XContextChangeEventListener
+{
+public:
+ ParaLRSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
+ virtual ~ParaLRSpacingControl() override;
+
+ virtual void SAL_CALL dispose() override;
+
+ virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState) override;
+ virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override = 0;
+
+ // XContextChangeEventListener
+ virtual void SAL_CALL
+ notifyContextChangeEvent(const css::ui::ContextChangeEventObject& rEvent) override;
+
+ virtual ::css::uno::Any SAL_CALL queryInterface(const ::css::uno::Type& aType) override;
+
+ virtual void SAL_CALL acquire() noexcept override;
+
+ virtual void SAL_CALL disposing(const ::css::lang::EventObject&) override;
+
+ virtual void SAL_CALL release() noexcept override;
+
+private:
+ css::uno::Reference<css::ui::XContextChangeEventMultiplexer> m_xMultiplexer;
+};
+
+class SVX_DLLPUBLIC ParaLeftSpacingControl final : public ParaLRSpacingControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ ParaLeftSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
+ virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
+};
+
+class SVX_DLLPUBLIC ParaRightSpacingControl final : public ParaLRSpacingControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ ParaRightSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
+ virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
+};
+
+class SVX_DLLPUBLIC ParaFirstLineSpacingControl final : public ParaLRSpacingControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ ParaFirstLineSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
+ virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ParseContext.hxx b/include/svx/ParseContext.hxx
new file mode 100644
index 000000000..4b8f451a8
--- /dev/null
+++ b/include/svx/ParseContext.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_PARSECONTEXT_HXX
+#define INCLUDED_SVX_PARSECONTEXT_HXX
+
+#include <com/sun/star/lang/Locale.hpp>
+
+#include <connectivity/IParseContext.hxx>
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+#include <vector>
+
+namespace svxform
+{
+
+ //= OSystemParseContext
+
+ class SAL_DLLPUBLIC_RTTI OSystemParseContext final : public ::connectivity::IParseContext
+ {
+ private:
+
+ ::std::vector< OUString > m_aLocalizedKeywords;
+
+ public:
+ SVXCORE_DLLPUBLIC OSystemParseContext();
+ SVXCORE_DLLPUBLIC virtual ~OSystemParseContext();
+
+ // retrieves language specific error messages
+ virtual OUString getErrorMessage(ErrorCode _eCodes) const override;
+
+ // retrieves language specific keyword strings (only ASCII allowed)
+ virtual OString getIntlKeywordAscii(InternationalKeyCode _eKey) const override;
+
+ // finds out, if we have an international keyword (only ASCII allowed)
+ virtual InternationalKeyCode getIntlKeyCode(const OString& rToken) const override;
+
+ /** gets a locale instance which should be used when parsing in the context specified by this instance
+ <p>if this is not overridden by derived classes, it returns the static default locale.</p>
+ */
+ SVXCORE_DLLPUBLIC virtual css::lang::Locale getPreferredLocale( ) const override;
+
+ };
+
+
+ //= OParseContextClient
+
+ /** helper class which needs access to a (shared and ref-counted) OSystemParseContext
+ instance.
+ */
+ class SVXCORE_DLLPUBLIC OParseContextClient
+ {
+ protected:
+ OParseContextClient();
+ virtual ~OParseContextClient();
+
+ const OSystemParseContext* getParseContext() const;
+ };
+}
+#endif // INCLUDED_SVX_PARSECONTEXT_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ShapeTypeHandler.hxx b/include/svx/ShapeTypeHandler.hxx
new file mode 100644
index 000000000..26d4aafd3
--- /dev/null
+++ b/include/svx/ShapeTypeHandler.hxx
@@ -0,0 +1,199 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SHAPETYPEHANDLER_HXX
+#define INCLUDED_SVX_SHAPETYPEHANDLER_HXX
+
+#include <svx/svxdllapi.h>
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/long.hxx>
+#include <unordered_map>
+#include <vector>
+
+namespace accessibility { class AccessibleShape; }
+namespace accessibility { class AccessibleShapeInfo; }
+namespace accessibility { class AccessibleShapeTreeInfo; }
+namespace com::sun::star::drawing { class XShape; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+namespace accessibility {
+
+/** Use an integer to represent shape type ids. A ShapeTypeId is unique
+ inside one project but is not over the project boundaries.
+*/
+typedef int ShapeTypeId;
+
+/** Define the function type for creating accessible objects for given
+ service names.
+*/
+typedef rtl::Reference<AccessibleShape> (*tCreateFunction)
+ (const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ ShapeTypeId nId);
+
+/** Each shape type is described by listing its id, its service name and a
+ function which creates a new accessible object that can represent that
+ service. The id has to be unique with respect to the create function.
+*/
+struct ShapeTypeDescriptor
+{
+ ShapeTypeId mnShapeTypeId;
+ OUString msServiceName;
+ tCreateFunction maCreateFunction;
+ ShapeTypeDescriptor (
+ ShapeTypeId nId, const OUString& sName, tCreateFunction aFunction)
+ : mnShapeTypeId (nId),
+ msServiceName (sName),
+ maCreateFunction (aFunction)
+ {}
+ ShapeTypeDescriptor()
+ : mnShapeTypeId (-1),
+ maCreateFunction (nullptr)
+ {}
+};
+
+/** @descr
+ This class is a singleton that has the purpose to transform between
+ service names of shapes and associated enum values and to create new
+ accessible objects for given shapes.
+*/
+class SVX_DLLPUBLIC ShapeTypeHandler final
+{
+public:
+ enum { UNKNOWN_SHAPE_TYPE = 0 };
+
+ /** This function returns a reference to the only instance of this class.
+ Use this instance to retrieve a shape's type and service name.
+ @return
+ Returns a reference to a ShapeTypeHandler object.
+ */
+ static ShapeTypeHandler& Instance();
+
+ /** Determines the type id of a shape with the given service name.
+ @param aServiceName
+ Service name of the shape for which to return the type id.
+ @return
+ Returns the type id of the shape with the given service name or
+ -1 when the service name is not known.
+ */
+ ShapeTypeId GetTypeId (const OUString& aServiceName) const;
+
+ /** Determines the type id of the specified shape.
+ @param xShape
+ Reference to the shape for which to return the type id.
+ @return
+ Returns the type id of the specified shape or
+ -1 when the given reference is either not
+ set or the referenced object does not support the
+ XShapeDescriptor interface.
+ */
+ ShapeTypeId GetTypeId (const css::uno::Reference<
+ css::drawing::XShape>& rxShape) const;
+
+ /** Create a new accessible object for the given shape.
+ @param rShapeInfo
+ Bundle of information passed to the new accessible shape.
+ @param rShapeTreeInfo
+ Bundle of information passed down the shape tree.
+ @return
+ Pointer to the implementation object that implements the
+ <code>XAccessible</code> interface. This pointer may be NULL
+ if the specified shape is of unknown type.
+ */
+ rtl::Reference<AccessibleShape>
+ CreateAccessibleObject (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo) const;
+
+ /** Add new shape types to the internal tables. Each new shape type is
+ described by one shape type descriptor. See
+ ShapeTypeDescriptor for more details.
+
+ @param nDescriptorCount
+ Number of new shape types.
+ @param aDescriptorList
+ Array of new shape type descriptors.
+ */
+ void AddShapeTypeList (int nDescriptorCount,
+ ShapeTypeDescriptor const aDescriptorList[]);
+
+ /// get the accessible base name for an object
+ ///
+ /// @throws css::uno::RuntimeException
+ static OUString CreateAccessibleBaseName (
+ const css::uno::Reference< css::drawing::XShape >& rxShape);
+
+private:
+ // Declare default constructor, copy constructor, destructor, and
+ // assignment operation protected so that no one accidentally creates a
+ // second instance of this singleton class or deletes it.
+ ShapeTypeHandler();
+ ShapeTypeHandler (const ShapeTypeHandler& aHandler); // never implemented, this is a singleton class
+ ShapeTypeHandler& operator= (const ShapeTypeHandler& aHandler); // never implemented, this is a singleton class
+
+ /** This destructor is never called at the moment. But because this
+ class is a singleton this is not a problem.
+ */
+ ~ShapeTypeHandler();
+
+ /// Pointer to the only instance of this class.
+ static ShapeTypeHandler* instance;
+
+ /** List of shape type descriptors. This list is normally build up in
+ several steps when libraries that implement shapes are loaded and
+ call the addShapeTypeList method. After that no modifications of
+ the list take place.
+ */
+ ::std::vector<ShapeTypeDescriptor> maShapeTypeDescriptorList;
+
+ /** This hash map allows the fast look up of a type descriptor for a
+ given service name.
+ */
+ typedef std::unordered_map<OUString,ShapeTypeId> tServiceNameToSlotId;
+ mutable tServiceNameToSlotId maServiceNameToSlotId;
+
+ /** Determine the slot id of the specified shape type. With this id
+ internal methods can access the associated type descriptor.
+ @param aServiceName
+ Service name of the shape for which to return the slot id.
+ @return
+ Returns the slot id of the shape with the given service name or
+ 0 when the service name is not known.
+ */
+ SVX_DLLPRIVATE tools::Long GetSlotId (const OUString& aServiceName) const;
+
+ /** Determine the slot id of the specified shape type. With this id
+ internal methods can access the associated type descriptor.
+ @param rxShape
+ Shape for which to return the slot id.
+ @return
+ Returns the slot id of the shape with the given service name or
+ 0 when the service name is not known.
+ */
+ SVX_DLLPRIVATE tools::Long GetSlotId (const css::uno::Reference<
+ css::drawing::XShape>& rxShape) const;
+};
+
+} // end of namespace accessible
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SmartTagItem.hxx b/include/svx/SmartTagItem.hxx
new file mode 100644
index 000000000..caf0c4551
--- /dev/null
+++ b/include/svx/SmartTagItem.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SMARTTAGITEM_HXX
+#define INCLUDED_SVX_SMARTTAGITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/smarttags/XSmartTagAction.hpp>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star::container {
+ class XStringKeyMap;
+}
+
+namespace com::sun::star::text {
+ class XTextRange;
+}
+
+namespace com::sun::star::frame {
+ class XController;
+}
+class SVX_DLLPUBLIC SvxSmartTagItem final : public SfxPoolItem
+{
+ const css::uno::Sequence < css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > > maActionComponentsSequence;
+ const css::uno::Sequence < css::uno::Sequence< sal_Int32 > > maActionIndicesSequence;
+ const css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > > maStringKeyMaps;
+ const css::uno::Reference<css::text::XTextRange> mxRange;
+ const css::uno::Reference<css::frame::XController> mxController;
+ const css::lang::Locale maLocale;
+ const OUString maApplicationName;
+ const OUString maRangeText;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxSmartTagItem( const TypedWhichId<SvxSmartTagItem> nId,
+ const css::uno::Sequence < css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > >& rActionComponentsSequence,
+ const css::uno::Sequence < css::uno::Sequence< sal_Int32 > >& rActionIndicesSequence,
+ const css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > >& rStringKeyMaps,
+ const css::uno::Reference<css::text::XTextRange>& rRange,
+ const css::uno::Reference<css::frame::XController>& rController,
+ const css::lang::Locale& rLocale,
+ const OUString& rApplicationName,
+ const OUString& rRangeText );
+
+ // "purely virtual methods" from the SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxSmartTagItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ const css::uno::Sequence < css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > >& GetActionComponentsSequence() const { return maActionComponentsSequence; }
+ const css::uno::Sequence < css::uno::Sequence< sal_Int32 > >& GetActionIndicesSequence() const { return maActionIndicesSequence; }
+ const css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > >& GetStringKeyMaps() const { return maStringKeyMaps; }
+ const css::uno::Reference<css::text::XTextRange>& GetTextRange() const { return mxRange; }
+ const css::uno::Reference<css::frame::XController>& GetController() const { return mxController; }
+ const css::lang::Locale& GetLocale() const { return maLocale; }
+ const OUString& GetApplicationName() const { return maApplicationName; }
+ const OUString& GetRangeText() const { return maRangeText; }
+};
+
+#endif // INCLUDED_SVX_SMARTTAGITEM_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SmartTagMgr.hxx b/include/svx/SmartTagMgr.hxx
new file mode 100644
index 000000000..510f5d53a
--- /dev/null
+++ b/include/svx/SmartTagMgr.hxx
@@ -0,0 +1,231 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SMARTTAGMGR_HXX
+#define INCLUDED_SVX_SMARTTAGMGR_HXX
+
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include <svx/svxdllapi.h>
+
+#include <vector>
+#include <map>
+#include <set>
+#include <string_view>
+
+namespace com::sun::star::uno {
+ class XComponentContext;
+}
+
+namespace com::sun::star::smarttags {
+ class XSmartTagRecognizer;
+ class XSmartTagAction;
+}
+
+namespace com::sun::star::text {
+ class XTextMarkup;
+ class XTextRange;
+}
+
+namespace com::sun::star::i18n {
+ class XBreakIterator;
+}
+
+namespace com::sun::star::lang {
+ struct Locale;
+ struct EventObject;
+ struct ChangesEvent;
+}
+
+namespace com::sun::star::beans {
+ class XPropertySet;
+}
+
+namespace com::sun::star::frame {
+ class XController;
+}
+
+/** A reference to a smart tag action
+
+ An action service can support various actions. Therefore an ActionReference
+ consists of a reference to the service and index.
+ */
+struct ActionReference
+{
+ css::uno::Reference< css::smarttags::XSmartTagAction > mxSmartTagAction;
+ sal_Int32 mnSmartTagIndex;
+ ActionReference( css::uno::Reference< css::smarttags::XSmartTagAction > const & xSmartTagAction, sal_Int32 nSmartTagIndex )
+ : mxSmartTagAction( xSmartTagAction), mnSmartTagIndex( nSmartTagIndex ) {}
+};
+
+/** The smart tag manager maintains all installed action and recognizer services
+
+ This class organizes the available smarttag libraries and provides access functions
+ to these libraries. The smart tag manager is a singleton.
+*/
+class SVX_DLLPUBLIC SmartTagMgr : public cppu::WeakImplHelper< css::util::XModifyListener,
+ css::util::XChangesListener >
+{
+private:
+
+ const OUString maApplicationName;
+ std::vector< css::uno::Reference< css::smarttags::XSmartTagRecognizer > > maRecognizerList;
+ std::vector< css::uno::Reference< css::smarttags::XSmartTagAction > > maActionList;
+ std::set< OUString > maDisabledSmartTagTypes;
+ std::multimap < OUString, ActionReference > maSmartTagMap;
+ mutable css::uno::Reference< css::i18n::XBreakIterator > mxBreakIter;
+ css::uno::Reference< css::uno::XComponentContext> mxContext;
+ css::uno::Reference< css::beans::XPropertySet > mxConfigurationSettings;
+ bool mbLabelTextWithSmartTags;
+
+ /** Checks for installed smart tag recognizers/actions and stores them in
+ maRecognizerList and maActionList.
+ */
+ void LoadLibraries();
+
+ /** Prepare configuration access.
+ */
+ void PrepareConfiguration( std::u16string_view rConfigurationGroupName );
+
+ /** Reads the configuration data.
+ */
+ void ReadConfiguration( bool bExcludedTypes, bool bRecognize );
+
+ /** Registers the smart tag manager as listener at the package manager.
+ */
+ void RegisterListener();
+
+ /** Sets up a map that maps smart tag type names to actions references.
+ */
+ void AssociateActionsWithRecognizers();
+
+public:
+
+ SmartTagMgr( const OUString& rApplicationName );
+ virtual ~SmartTagMgr() override;
+
+ /** Triggers configuration reading, library loading and listener registration
+ NOTE: MUST BE CALLED AFTER CONSTRUCTION!
+ */
+ void Init( std::u16string_view rConfigurationGroupName );
+
+ /** Dispatches the recognize call to all installed smart tag recognizers
+
+ @param rText
+ The string to be scanned by the recognizers.
+
+ @param xMarkup
+ The object allows the recognizers to store any found smart tags.
+
+ @param xController
+ The current controller of the document.
+
+ @param rLocale
+ The locale of rText.
+
+ @param nStart
+ The start offset of the text to be scanned in rText.
+
+ @param nLen
+ The length of the text to be scanned.
+
+ */
+
+ void RecognizeString( const OUString& rText,
+ const css::uno::Reference< css::text::XTextMarkup >& rMarkup,
+ const css::uno::Reference< css::frame::XController >& rController,
+ const css::lang::Locale& rLocale,
+ sal_uInt32 nStart, sal_uInt32 nLen ) const;
+
+ void RecognizeTextRange(const css::uno::Reference< css::text::XTextRange>& rRange,
+ const css::uno::Reference< css::text::XTextMarkup >& rMarkup,
+ const css::uno::Reference< css::frame::XController >& rController) const;
+
+ /** Returns all action references associated with a given list of smart tag types
+
+ @param rSmartTagTypes
+ The list of types
+
+ @param rActionComponentsSequence
+ Output parameter
+
+ @param rActionIndicesSequence
+ Output parameter
+ */
+ void GetActionSequences( std::vector< OUString >& rSmartTagTypes,
+ css::uno::Sequence < css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > >& rActionComponentsSequence,
+ css::uno::Sequence < css::uno::Sequence< sal_Int32 > >& rActionIndicesSequence ) const;
+
+ /** Returns the caption for a smart tag type.
+
+ @param rSmartTagType
+ The given smart tag type.
+
+ @param rLocale
+ The locale.
+ */
+ OUString GetSmartTagCaption( const OUString& rSmartTagType, const css::lang::Locale& rLocale ) const;
+
+ /** Returns true if the given smart tag type is enabled.
+ */
+ bool IsSmartTagTypeEnabled( const OUString& rSmartTagType ) const;
+
+ /** Enable or disable smart tags.
+ */
+ bool IsLabelTextWithSmartTags() const { return mbLabelTextWithSmartTags; }
+
+ /** Returns the number of registered recognizers.
+ */
+ sal_uInt32 NumberOfRecognizers() const { return maRecognizerList.size(); }
+
+ /** Returns a recognizer.
+ */
+ css::uno::Reference< css::smarttags::XSmartTagRecognizer > const &
+ GetRecognizer( sal_uInt32 i ) const { return maRecognizerList[i]; }
+
+ /** Is smart tag recognition active?
+ */
+ bool IsSmartTagsEnabled() const { return 0 != NumberOfRecognizers() &&
+ IsLabelTextWithSmartTags(); }
+
+ /** Writes configuration settings.
+ */
+ void WriteConfiguration( const bool* bLabelTextWithSmartTags,
+ const std::vector< OUString >* pDisabledTypes ) const;
+
+ /** Returns the name of the application this instance has been created by.
+ */
+ const OUString& GetApplicationName() const { return maApplicationName; }
+
+ // css::lang::XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // css::util::XModifyListener
+ virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override;
+
+ // css::util::XChangesListener
+ virtual void SAL_CALL changesOccurred( const css::util::ChangesEvent& Event ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SpellDialogChildWindow.hxx b/include/svx/SpellDialogChildWindow.hxx
new file mode 100644
index 000000000..21ebd227c
--- /dev/null
+++ b/include/svx/SpellDialogChildWindow.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SPELLDIALOGCHILDWINDOW_HXX
+#define INCLUDED_SVX_SPELLDIALOGCHILDWINDOW_HXX
+
+#include <sfx2/childwin.hxx>
+#include <editeng/SpellPortions.hxx>
+#include <svx/svxdllapi.h>
+
+class AbstractSpellDialog;
+
+namespace svx
+{
+/** The child window wrapper of the actual spelling dialog. To use the
+ spelling dialog in an application you have to do the usual things:
+ <ol>
+ <li>Call this class' RegisterChildWindow() method with the module
+ as second argument that you want the dialog included in.</li>
+ <li>In the SFX_IMPL_INTERFACE implementation of the view shell
+ that wants to use the dialog call RegisterChildWindow()
+ with the id returned by this class' GetChildWindowId()
+ method.</li>
+ <li>Include the item associated with this child window to the SDI
+ description of the view shell.</li>
+ </ol>
+*/
+class SVX_DLLPUBLIC SpellDialogChildWindow : public SfxChildWindow
+{
+ friend class SpellDialog;
+ VclPtr<AbstractSpellDialog> m_xAbstractSpellDialog;
+
+public:
+ SpellDialogChildWindow(vcl::Window* pParent, sal_uInt16 nId, SfxBindings* pBindings);
+ virtual ~SpellDialogChildWindow() override;
+
+protected:
+ /** This abstract method has to be defined by a derived class. It
+ returns the next wrong sentence.
+ @return
+ returns an empty vector if no error could be found
+ */
+ virtual SpellPortions GetNextWrongSentence(bool bRecheck) = 0;
+
+ /** This abstract method applies the changes made in the spelling dialog
+ to the document.
+ The dialog always updates its settings when it gets the focus. The document
+ can rely on the fact that the methods ApplyChangedSentence() is called for the
+ position that the last GetNextWrongSentence() returned.
+ If 'bRecheck' is set to true then the same sentence should be rechecked once from
+ the start. This should be used to find errors that the user has introduced by
+ manual changes in the edit field, and in order to not miss the still following errors
+ in that sentence.
+ */
+ virtual void ApplyChangedSentence(const SpellPortions& rChanged, bool bRecheck) = 0;
+ /** This methods determines whether the application supports AutoCorrection
+ */
+ virtual bool HasAutoCorrection();
+ /** This method adds a word pair to the AutoCorrection - if available
+ */
+ virtual void AddAutoCorrection(const OUString& rOld, const OUString& rNew,
+ LanguageType eLanguage);
+ /** Return the sfx bindings for this child window. They are
+ retrieved from the dialog so they do not have to be stored in
+ this class as well. The bindings may be necessary to be used
+ by the abstract methods.
+ */
+ /** This method determines if grammar checking is supported
+ */
+ virtual bool HasGrammarChecking();
+ /** determines if grammar checking is switched on
+ */
+ virtual bool IsGrammarChecking();
+ /** switches grammar checking on/off
+ */
+ virtual void SetGrammarChecking(bool bOn);
+
+ SfxBindings& GetBindings() const;
+ /** Set the spell dialog into the 'resume' state. This method should be called
+ to notify the SpellDialog about changes in the document that invalidate the
+ current state which results in disabling most of the dialog controls and presenting
+ a "Resume" button that initiates a reinitialization.
+ */
+ void InvalidateSpellDialog();
+ /** Notifies the ChildWindow about the get focus event. The ChildWindow should no check if
+ the spelling dialog should be set to the 'Resume' state by calling InvalidateSpellDialog()
+ */
+ virtual void GetFocus() = 0;
+ /** Notifies the ChildWindow about the lose focus event. The ChildWindow should use it to save
+ the current selection/state.
+ */
+ virtual void LoseFocus() = 0;
+};
+
+} // end of namespace ::svx
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SvxColorChildWindow.hxx b/include/svx/SvxColorChildWindow.hxx
new file mode 100644
index 000000000..07b44a08f
--- /dev/null
+++ b/include/svx/SvxColorChildWindow.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SVXCOLORCHILDWINDOW_HXX
+#define INCLUDED_SVX_SVXCOLORCHILDWINDOW_HXX
+
+#include <sfx2/childwin.hxx>
+#include <svx/svxdllapi.h>
+
+/**
+ * Child of SfxChildWindow as a "container" for Controller
+ */
+class SVX_DLLPUBLIC SvxColorChildWindow final : public SfxChildWindow
+{
+ public:
+ SvxColorChildWindow( vcl::Window*, sal_uInt16, SfxBindings*,
+ SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW_WITHID(SvxColorChildWindow);
+};
+
+
+#endif // INCLUDED_SVX_SVXCOLORCHILDWINDOW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SvxColorValueSet.hxx b/include/svx/SvxColorValueSet.hxx
new file mode 100644
index 000000000..1872b58fd
--- /dev/null
+++ b/include/svx/SvxColorValueSet.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SVXCOLORVALUESET_HXX
+#define INCLUDED_SVX_SVXCOLORVALUESET_HXX
+
+#include <svtools/valueset.hxx>
+#include <svx/svxdllapi.h>
+#include <set>
+
+class XColorList;
+
+class SVXCORE_DLLPUBLIC SvxColorValueSet : public ValueSet
+{
+public:
+ SvxColorValueSet(std::unique_ptr<weld::ScrolledWindow> pWindow);
+
+ virtual void Resize() override;
+
+ /* Maximum row/line count for the ColorValueSet control. If more lines would be needed, a scrollbar will
+ be used. */
+ static constexpr sal_uInt32 getMaxRowCount() { return 10; }
+ static sal_uInt32 getEntryEdgeLength();
+ static sal_uInt32 getColumnCount();
+
+ void addEntriesForXColorList(const XColorList& rXColorList, sal_uInt32 nStartIndex = 1);
+ void addEntriesForColorSet(const std::set<Color>& rColorSet, const OUString& rNamePrefix);
+ Size layoutAllVisible(sal_uInt32 nEntryCount);
+ void layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount);
+
+ virtual FactoryFunction GetUITestFactory() const override;
+};
+
+#endif // INCLUDED_SVX_SVXCOLORVALUESET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SvxNumOptionsTabPageHelper.hxx b/include/svx/SvxNumOptionsTabPageHelper.hxx
new file mode 100644
index 000000000..98766254d
--- /dev/null
+++ b/include/svx/SvxNumOptionsTabPageHelper.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVXNUMOPTIONSTABPAGEHELPER_HXX
+#define INCLUDED_SVX_SVXNUMOPTIONSTABPAGEHELPER_HXX
+
+#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
+#include <vcl/weld.hxx>
+#include <svx/svxdllapi.h>
+
+using namespace css::uno;
+using namespace css::text;
+
+class SVXCORE_DLLPUBLIC SvxNumOptionsTabPageHelper
+{
+public:
+ static Reference<XDefaultNumberingProvider> GetNumberingProvider();
+
+ /** Get the numberings provided by the i18n framework (CTL, Asian, ...) and
+ add them to the listbox. Extended numbering schemes present in the
+ resource and already in the listbox but not offered by the i18n
+ framework per configuration are removed.
+
+ @param nDoNotRemove
+ A value that shall not be removed, i.e. the ugly 0x88
+ (SVX_NUM_BITMAP|0x80)
+ Pass ::std::numeric_limits<sal_uInt16>::max() if there is no such
+ restriction.
+ */
+ static void GetI18nNumbering(weld::ComboBox& rFmtLB, sal_uInt16 nDoNotRemove);
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SvxPresetListBox.hxx b/include/svx/SvxPresetListBox.hxx
new file mode 100644
index 000000000..ec608c830
--- /dev/null
+++ b/include/svx/SvxPresetListBox.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVXPRESETLISTBOX_HXX
+#define INCLUDED_SVX_SVXPRESETLISTBOX_HXX
+
+#include <svtools/valueset.hxx>
+#include <svx/xtable.hxx>
+#include <tools/gen.hxx>
+
+class SVXCORE_DLLPUBLIC SvxPresetListBox final : public ValueSet
+{
+private:
+ static constexpr sal_uInt32 nColCount = 3;
+ Size aIconSize;
+ Link<SvxPresetListBox*,void> maRenameHdl;
+ Link<SvxPresetListBox*,void> maDeleteHdl;
+
+ void OnMenuItemSelected(std::string_view rIdent);
+
+ template< typename ListType, typename EntryType >
+ void FillPresetListBoxImpl(ListType& pList, sal_uInt32 nStartIndex);
+
+public:
+ SvxPresetListBox(std::unique_ptr<weld::ScrolledWindow> pWindow);
+
+ virtual void Resize() override;
+ virtual bool Command(const CommandEvent& rEvent) override;
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ Size const & GetIconSize() const { return aIconSize; }
+
+ void SetRenameHdl( const Link<SvxPresetListBox*,void>& rLink )
+ {
+ maRenameHdl = rLink;
+ }
+ void SetDeleteHdl( const Link<SvxPresetListBox*,void>& rLink )
+ {
+ maDeleteHdl = rLink;
+ }
+
+ void FillPresetListBox(XGradientList& pList, sal_uInt32 nStartIndex = 1);
+ void FillPresetListBox(XHatchList& pList, sal_uInt32 nStartIndex = 1);
+ void FillPresetListBox(XBitmapList& pList, sal_uInt32 nStartIndex = 1);
+ void FillPresetListBox(XPatternList& pList, sal_uInt32 nStartIndex = 1);
+ void DrawLayout();
+};
+
+#endif // INCLUDED_SVX_SVXPRESETLISTBOX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SvxShapeTypes.hxx b/include/svx/SvxShapeTypes.hxx
new file mode 100644
index 000000000..84429198b
--- /dev/null
+++ b/include/svx/SvxShapeTypes.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVXSHAPETYPES_HXX
+#define INCLUDED_SVX_SVXSHAPETYPES_HXX
+
+namespace accessibility
+{
+/** Register the SVX draw shape types with the ShapeTypeHandler singleton.
+ This method is usually called from the shape type handler constructor.
+*/
+void RegisterDrawShapeTypes();
+
+/** Enum describing all shape types known in the SVX project.
+*/
+enum SvxShapeTypes
+{
+ DRAWING_RECTANGLE = 1,
+ DRAWING_ELLIPSE,
+ DRAWING_CONTROL,
+ DRAWING_CONNECTOR,
+ DRAWING_MEASURE,
+ DRAWING_LINE,
+ DRAWING_POLY_POLYGON,
+ DRAWING_POLY_LINE,
+ DRAWING_OPEN_BEZIER,
+ DRAWING_CLOSED_BEZIER,
+ DRAWING_OPEN_FREEHAND,
+ DRAWING_CLOSED_FREEHAND,
+ DRAWING_POLY_POLYGON_PATH,
+ DRAWING_POLY_LINE_PATH,
+ DRAWING_GRAPHIC_OBJECT,
+ DRAWING_GROUP,
+ DRAWING_TEXT,
+ DRAWING_OLE,
+ DRAWING_PAGE,
+ DRAWING_CAPTION,
+ DRAWING_FRAME,
+ DRAWING_PLUGIN,
+ DRAWING_APPLET,
+ DRAWING_3D_SCENE,
+ DRAWING_3D_CUBE,
+ DRAWING_3D_SPHERE,
+ DRAWING_3D_LATHE,
+ DRAWING_3D_EXTRUDE,
+ DRAWING_CUSTOM,
+ DRAWING_TABLE, /* = 30 */
+ DRAWING_MEDIA, /* = 31 */
+ DRAWING_END = DRAWING_MEDIA
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SvxXTextColumns.hxx b/include/svx/SvxXTextColumns.hxx
new file mode 100644
index 000000000..0dbc92ba9
--- /dev/null
+++ b/include/svx/SvxXTextColumns.hxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <svx/svxdllapi.h>
+
+SVXCORE_DLLPUBLIC css::uno::Reference<css::uno::XInterface>
+SvxXTextColumns_createInstance() noexcept;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/svx/UnoNamespaceMap.hxx b/include/svx/UnoNamespaceMap.hxx
new file mode 100644
index 000000000..b20cf44a6
--- /dev/null
+++ b/include/svx/UnoNamespaceMap.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UNONAMESPACEMAP_HXX
+#define INCLUDED_SVX_UNONAMESPACEMAP_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <svx/svxdllapi.h>
+
+class SfxItemPool;
+
+namespace svx
+{
+SVX_DLLPUBLIC css::uno::Reference<css::uno::XInterface>
+NamespaceMap_createInstance(sal_uInt16* pWhichIds, SfxItemPool* pPool);
+}
+
+#endif // INCLUDED_SVX_UNONAMESPACEMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/XPropertyEntry.hxx b/include/svx/XPropertyEntry.hxx
new file mode 100644
index 000000000..c697ee915
--- /dev/null
+++ b/include/svx/XPropertyEntry.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_XPROPERTYENTRY_HXX
+#define INCLUDED_SVX_XPROPERTYENTRY_HXX
+
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+#include <vcl/bitmapex.hxx>
+
+class SVXCORE_DLLPUBLIC XPropertyEntry
+{
+private:
+ OUString maPropEntryName;
+ BitmapEx maUiBitmap;
+
+protected:
+ XPropertyEntry(const OUString& rPropEntryName);
+
+ XPropertyEntry(XPropertyEntry const&) = default;
+ XPropertyEntry(XPropertyEntry&&) = default;
+
+public:
+ virtual ~XPropertyEntry();
+
+ XPropertyEntry& operator=(XPropertyEntry const&) = default;
+ XPropertyEntry& operator=(XPropertyEntry&&) = default;
+
+ void SetName(const OUString& rPropEntryName) { maPropEntryName = rPropEntryName; }
+ const OUString& GetName() const { return maPropEntryName; }
+ void SetUiBitmap(const BitmapEx& rUiBitmap) { maUiBitmap = rUiBitmap; }
+ const BitmapEx& GetUiBitmap() const { return maUiBitmap; }
+};
+
+#endif // INCLUDED_SVX_XPROPERTYENTRY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/algitem.hxx b/include/svx/algitem.hxx
new file mode 100644
index 000000000..d02454033
--- /dev/null
+++ b/include/svx/algitem.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_ALGITEM_HXX
+#define INCLUDED_SVX_ALGITEM_HXX
+
+#include <editeng/svxenum.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svl/poolitem.hxx>
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/degree.hxx>
+
+class IntlWrapper;
+class SfxItemPool;
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxOrientationItem final : public SfxEnumItem<SvxCellOrientation>
+{
+public:
+ SvxOrientationItem(
+ const SvxCellOrientation eOrientation,
+ const TypedWhichId<SvxOrientationItem> nId );
+
+ SvxOrientationItem(
+ Degree100 nRotation, bool bStacked,
+ const TypedWhichId<SvxOrientationItem> nId );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual sal_uInt16 GetValueCount() const override;
+ static OUString GetValueText( SvxCellOrientation nVal );
+ virtual SvxOrientationItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ /** Returns sal_True, if the item represents STACKED state. */
+ bool IsStacked() const;
+ /** Returns the rotation this item represents (returns nStdAngle for STANDARD and STACKED state). */
+ Degree100 GetRotation( Degree100 nStdAngle ) const;
+};
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxMarginItem final : public SfxPoolItem
+{
+ sal_Int16 nLeftMargin;
+ sal_Int16 nTopMargin;
+ sal_Int16 nRightMargin;
+ sal_Int16 nBottomMargin;
+public:
+ static SfxPoolItem* CreateDefault();
+ SvxMarginItem( const TypedWhichId<SvxMarginItem> nId );
+ SvxMarginItem( sal_Int16 nLeft, sal_Int16 nTop /*= 0*/,
+ sal_Int16 nRight /*= 0*/, sal_Int16 nBottom /*= 0*/,
+ const TypedWhichId<SvxMarginItem> nId );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxMarginItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ sal_Int16 GetLeftMargin() const {return nLeftMargin; }
+ void SetLeftMargin(sal_Int16 nLeft);
+ sal_Int16 GetTopMargin() const {return nTopMargin; }
+ void SetTopMargin(sal_Int16 nTop);
+ sal_Int16 GetRightMargin() const {return nRightMargin; }
+ void SetRightMargin(sal_Int16 nRight);
+ sal_Int16 GetBottomMargin() const {return nBottomMargin; }
+ void SetBottomMargin(sal_Int16 nBottom);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/anchorid.hxx b/include/svx/anchorid.hxx
new file mode 100644
index 000000000..da7387010
--- /dev/null
+++ b/include/svx/anchorid.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_ANCHORID_HXX
+#define INCLUDED_SVX_ANCHORID_HXX
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class SvxAnchorIds
+{
+ NONE = 0x0000,
+ Paragraph = 0x0001, // Frame bound to paragraph
+ Character = 0x0002, // Frame bound to character
+ Page = 0x0004, // Frame bound to page
+ Fly = 0x0008, // Frame bound to other frame
+ /** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor
+ to disable the size controls */
+ NoResize = 0x0100,
+ /** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor
+ to disable the protect controls */
+ NoProtect = 0x0200
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvxAnchorIds> : is_typed_flags<SvxAnchorIds, 0x030f> {};
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/autoformathelper.hxx b/include/svx/autoformathelper.hxx
new file mode 100644
index 000000000..2d292b1de
--- /dev/null
+++ b/include/svx/autoformathelper.hxx
@@ -0,0 +1,222 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_AUTOFORMATHELPER_HXX
+#define INCLUDED_SVX_AUTOFORMATHELPER_HXX
+
+#include <svx/svxdllapi.h>
+#include <memory>
+
+class SvStream;
+class SvxFontItem;
+class SvxFontHeightItem;
+class SvxWeightItem;
+class SvxPostureItem;
+class SvxUnderlineItem;
+class SvxOverlineItem;
+class SvxCrossedOutItem;
+class SvxContourItem;
+class SvxShadowedItem;
+class SvxColorItem;
+class SvxBoxItem;
+class SvxLineItem;
+class SvxBrushItem;
+class SvxAdjustItem;
+class SvxHorJustifyItem;
+class SvxVerJustifyItem;
+class SfxBoolItem;
+class SvxMarginItem;
+class SfxInt32Item;
+class SvxRotateModeItem;
+
+//////////////////////////////////////////////////////////////////////////////
+/// Struct with version numbers of the Items
+
+struct SVX_DLLPUBLIC AutoFormatVersions
+{
+public:
+ // BlockA
+ sal_uInt16 nFontVersion;
+ sal_uInt16 nFontHeightVersion;
+ sal_uInt16 nWeightVersion;
+ sal_uInt16 nPostureVersion;
+ sal_uInt16 nUnderlineVersion;
+ sal_uInt16 nOverlineVersion;
+ sal_uInt16 nCrossedOutVersion;
+ sal_uInt16 nContourVersion;
+ sal_uInt16 nShadowedVersion;
+ sal_uInt16 nColorVersion;
+ sal_uInt16 nBoxVersion;
+ sal_uInt16 nLineVersion;
+ sal_uInt16 nBrushVersion;
+ sal_uInt16 nAdjustVersion;
+
+ // BlockB
+ sal_uInt16 nHorJustifyVersion;
+ sal_uInt16 nVerJustifyVersion;
+ sal_uInt16 nOrientationVersion;
+ sal_uInt16 nMarginVersion;
+ sal_uInt16 nBoolVersion;
+ sal_uInt16 nInt32Version;
+ sal_uInt16 nRotateModeVersion;
+ sal_uInt16 nNumFormatVersion;
+
+ AutoFormatVersions();
+
+ void LoadBlockA( SvStream& rStream, sal_uInt16 nVer );
+ void LoadBlockB( SvStream& rStream, sal_uInt16 nVer );
+
+ static void WriteBlockA(SvStream& rStream, sal_uInt16 fileVersion);
+ static void WriteBlockB(SvStream& rStream, sal_uInt16 fileVersion);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC AutoFormatBase
+{
+protected:
+ // common attributes of Calc and Writer
+ // --- from 641 on: CJK and CTL font settings
+ std::unique_ptr<SvxFontItem> m_aFont;
+ std::unique_ptr<SvxFontHeightItem> m_aHeight;
+ std::unique_ptr<SvxWeightItem> m_aWeight;
+ std::unique_ptr<SvxPostureItem> m_aPosture;
+
+ std::unique_ptr<SvxFontItem> m_aCJKFont;
+ std::unique_ptr<SvxFontHeightItem> m_aCJKHeight;
+ std::unique_ptr<SvxWeightItem> m_aCJKWeight;
+ std::unique_ptr<SvxPostureItem> m_aCJKPosture;
+
+ std::unique_ptr<SvxFontItem> m_aCTLFont;
+ std::unique_ptr<SvxFontHeightItem> m_aCTLHeight;
+ std::unique_ptr<SvxWeightItem> m_aCTLWeight;
+ std::unique_ptr<SvxPostureItem> m_aCTLPosture;
+
+ std::unique_ptr<SvxUnderlineItem> m_aUnderline;
+ std::unique_ptr<SvxOverlineItem> m_aOverline;
+ std::unique_ptr<SvxCrossedOutItem> m_aCrossedOut;
+ std::unique_ptr<SvxContourItem> m_aContour;
+ std::unique_ptr<SvxShadowedItem> m_aShadowed;
+ std::unique_ptr<SvxColorItem> m_aColor;
+ std::unique_ptr<SvxBoxItem> m_aBox;
+ std::unique_ptr<SvxLineItem> m_aTLBR;
+ std::unique_ptr<SvxLineItem> m_aBLTR;
+ std::unique_ptr<SvxBrushItem> m_aBackground;
+
+ // Writer specific
+ std::unique_ptr<SvxAdjustItem> m_aAdjust;
+
+ // Calc specific
+ std::unique_ptr<SvxHorJustifyItem> m_aHorJustify;
+ std::unique_ptr<SvxVerJustifyItem> m_aVerJustify;
+ std::unique_ptr<SfxBoolItem> m_aStacked;
+ std::unique_ptr<SvxMarginItem> m_aMargin;
+ std::unique_ptr<SfxBoolItem> m_aLinebreak;
+
+ // from SO5, 504k on, rotated text
+ std::unique_ptr<SfxInt32Item> m_aRotateAngle;
+ std::unique_ptr<SvxRotateModeItem> m_aRotateMode;
+
+ // assignment-op is protected due to this being a tooling
+ // class, so callers need to be aware of what they do
+ AutoFormatBase& operator=(const AutoFormatBase&);
+
+ AutoFormatBase();
+ AutoFormatBase( const AutoFormatBase& rNew );
+ ~AutoFormatBase();
+
+ /// Comparing based of boxes backgrounds.
+ bool operator==(const AutoFormatBase& rRight) const;
+
+public:
+ // The get-methods.
+ const SvxFontItem &GetFont() const { return *m_aFont; }
+ const SvxFontHeightItem &GetHeight() const { return *m_aHeight; }
+ const SvxWeightItem &GetWeight() const { return *m_aWeight; }
+ const SvxPostureItem &GetPosture() const { return *m_aPosture; }
+ const SvxFontItem &GetCJKFont() const { return *m_aCJKFont; }
+ const SvxFontHeightItem &GetCJKHeight() const { return *m_aCJKHeight; }
+ const SvxWeightItem &GetCJKWeight() const { return *m_aCJKWeight; }
+ const SvxPostureItem &GetCJKPosture() const { return *m_aCJKPosture; }
+ const SvxFontItem &GetCTLFont() const { return *m_aCTLFont; }
+ const SvxFontHeightItem &GetCTLHeight() const { return *m_aCTLHeight; }
+ const SvxWeightItem &GetCTLWeight() const { return *m_aCTLWeight; }
+ const SvxPostureItem &GetCTLPosture() const { return *m_aCTLPosture; }
+ const SvxUnderlineItem &GetUnderline() const { return *m_aUnderline; }
+ const SvxOverlineItem &GetOverline() const { return *m_aOverline; }
+ const SvxCrossedOutItem &GetCrossedOut() const { return *m_aCrossedOut; }
+ const SvxContourItem &GetContour() const { return *m_aContour; }
+ const SvxShadowedItem &GetShadowed() const { return *m_aShadowed; }
+ const SvxColorItem &GetColor() const { return *m_aColor; }
+ const SvxBoxItem &GetBox() const { return *m_aBox; }
+ const SvxLineItem& GetTLBR() const { return *m_aTLBR; }
+ const SvxLineItem& GetBLTR() const { return *m_aBLTR; }
+ const SvxBrushItem &GetBackground() const { return *m_aBackground; }
+ const SvxAdjustItem &GetAdjust() const { return *m_aAdjust; }
+ const SvxHorJustifyItem& GetHorJustify() const { return *m_aHorJustify; }
+ const SvxVerJustifyItem& GetVerJustify() const { return *m_aVerJustify; }
+ const SfxBoolItem& GetStacked() const { return *m_aStacked; }
+ const SvxMarginItem& GetMargin() const { return *m_aMargin; }
+ const SfxBoolItem& GetLinebreak() const { return *m_aLinebreak; }
+ const SfxInt32Item& GetRotateAngle() const { return *m_aRotateAngle; }
+ const SvxRotateModeItem& GetRotateMode() const { return *m_aRotateMode; }
+
+ // The set-methods.
+ void SetFont( const SvxFontItem& rNew );
+ void SetHeight( const SvxFontHeightItem& rNew );
+ void SetWeight( const SvxWeightItem& rNew );
+ void SetPosture( const SvxPostureItem& rNew );
+ void SetCJKFont( const SvxFontItem& rNew );
+ void SetCJKHeight( const SvxFontHeightItem& rNew );
+ void SetCJKWeight( const SvxWeightItem& rNew );
+ void SetCJKPosture( const SvxPostureItem& rNew );
+ void SetCTLFont( const SvxFontItem& rNew );
+ void SetCTLHeight( const SvxFontHeightItem& rNew );
+ void SetCTLWeight( const SvxWeightItem& rNew );
+ void SetCTLPosture( const SvxPostureItem& rNew );
+ void SetUnderline( const SvxUnderlineItem& rNew );
+ void SetOverline( const SvxOverlineItem& rNew );
+ void SetCrossedOut( const SvxCrossedOutItem& rNew );
+ void SetContour( const SvxContourItem& rNew );
+ void SetShadowed( const SvxShadowedItem& rNew );
+ void SetColor( const SvxColorItem& rNew );
+ void SetBox( const SvxBoxItem& rNew );
+ void SetTLBR( const SvxLineItem& rNew );
+ void SetBLTR( const SvxLineItem& rNew );
+ void SetBackground( const SvxBrushItem& rNew );
+ void SetAdjust( const SvxAdjustItem& rNew );
+ void SetHorJustify( const SvxHorJustifyItem& rNew );
+ void SetVerJustify( const SvxVerJustifyItem& rNew );
+ void SetStacked( const SfxBoolItem& rNew );
+ void SetMargin( const SvxMarginItem& rNew );
+ void SetLinebreak( const SfxBoolItem& rNew );
+ void SetRotateAngle( const SfxInt32Item& rNew );
+ void SetRotateMode( const SvxRotateModeItem& rNew );
+
+ bool LoadBlockA( SvStream& rStream, const AutoFormatVersions& rVersions, sal_uInt16 nVer );
+ bool LoadBlockB( SvStream& rStream, const AutoFormatVersions& rVersions, sal_uInt16 nVer );
+
+ bool SaveBlockA( SvStream& rStream, sal_uInt16 fileVersion ) const;
+ bool SaveBlockB( SvStream& rStream, sal_uInt16 fileVersion ) const;
+};
+
+#endif // INCLUDED_SVX_AUTOFORMATHELPER_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/bmpmask.hxx b/include/svx/bmpmask.hxx
new file mode 100644
index 000000000..1500b8d3b
--- /dev/null
+++ b/include/svx/bmpmask.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_BMPMASK_HXX
+#define INCLUDED_SVX_BMPMASK_HXX
+
+#include <sal/types.h>
+#include <sfx2/childwin.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/dockwin.hxx>
+#include <svl/poolitem.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/color.hxx>
+#include <vcl/animate/Animation.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/graph.hxx>
+#include <memory>
+
+namespace vcl { class Window; }
+namespace weld { class CustomWeld; }
+
+class SfxBindings;
+class SfxModule;
+
+/*************************************************************************
+|*
+|* class SvxBmpMaskSelectItem
+|*
+\************************************************************************/
+class SvxBmpMask;
+
+class SvxBmpMaskSelectItem final : public SfxControllerItem
+{
+ SvxBmpMask &rBmpMask;
+
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState ) override;
+
+public:
+ SvxBmpMaskSelectItem( SvxBmpMask& rMask,
+ SfxBindings& rBindings );
+};
+
+/*************************************************************************
+|*
+|* Derivative from SfxChildWindow as 'container' for Float
+|*
+\************************************************************************/
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMaskChildWindow final : public SfxChildWindow
+{
+ public:
+ SvxBmpMaskChildWindow( vcl::Window*,
+ sal_uInt16, SfxBindings*,
+ SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW_WITHID(SvxBmpMaskChildWindow);
+};
+
+/*************************************************************************
+|*
+|* class SvxBmpMask
+|*
+\************************************************************************/
+
+class MaskData;
+class MaskSet;
+class BmpColorWindow;
+class ColorListBox;
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask final : public SfxDockingWindow
+{
+ friend class MaskData;
+ friend class MaskSet;
+
+ std::unique_ptr<weld::Toolbar> m_xTbxPipette;
+ std::unique_ptr<BmpColorWindow> m_xCtlPipette;
+ std::unique_ptr<weld::CustomWeld> m_xCtlPipetteWin;
+ std::unique_ptr<weld::Button> m_xBtnExec;
+
+ std::unique_ptr<weld::CheckButton> m_xCbx1;
+ std::unique_ptr<MaskSet> m_xQSet1;
+ std::unique_ptr<weld::CustomWeld> m_xQSetWin1;
+ std::unique_ptr<weld::MetricSpinButton> m_xSp1;
+ std::unique_ptr<ColorListBox> m_xLbColor1;
+
+ std::unique_ptr<weld::CheckButton> m_xCbx2;
+ std::unique_ptr<MaskSet> m_xQSet2;
+ std::unique_ptr<weld::CustomWeld> m_xQSetWin2;
+ std::unique_ptr<weld::MetricSpinButton> m_xSp2;
+ std::unique_ptr<ColorListBox> m_xLbColor2;
+
+ std::unique_ptr<weld::CheckButton> m_xCbx3;
+ std::unique_ptr<MaskSet> m_xQSet3;
+ std::unique_ptr<weld::CustomWeld> m_xQSetWin3;
+ std::unique_ptr<weld::MetricSpinButton> m_xSp3;
+ std::unique_ptr<ColorListBox> m_xLbColor3;
+
+ std::unique_ptr<weld::CheckButton> m_xCbx4;
+ std::unique_ptr<MaskSet> m_xQSet4;
+ std::unique_ptr<weld::CustomWeld> m_xQSetWin4;
+ std::unique_ptr<weld::MetricSpinButton> m_xSp4;
+ std::unique_ptr<ColorListBox> m_xLbColor4;
+
+ std::unique_ptr<weld::CheckButton> m_xCbxTrans;
+ std::unique_ptr<ColorListBox> m_xLbColorTrans;
+
+ std::unique_ptr<MaskData> m_xData;
+
+ Color aPipetteColor;
+ SvxBmpMaskSelectItem aSelItem;
+
+ virtual bool Close() override;
+
+ sal_uInt16 InitColorArrays( Color* pSrcCols, Color* pDstCols,
+ sal_uInt8* pTols );
+
+ void ImpMask( BitmapEx& rBitmap );
+ GDIMetaFile ImpMask( const GDIMetaFile& rMtf );
+ Animation ImpMask( const Animation& rAnimation );
+ BitmapEx ImpMaskTransparent( const BitmapEx& rBitmapEx,
+ const Color& rColor,
+ const sal_uInt8 nTol );
+
+ GDIMetaFile GetMetaFile(const Graphic& rGraphic);
+
+ static Animation ImpReplaceTransparency( const Animation& rAnim,
+ const Color& rColor );
+ static GDIMetaFile ImpReplaceTransparency( const GDIMetaFile& rMtf,
+ const Color& rColor );
+
+public:
+
+ SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* pParent);
+ virtual ~SvxBmpMask() override;
+ virtual void dispose() override;
+
+ void SetColor( const Color& rColor );
+ void PipetteClicked();
+
+ void SetExecState( bool bEnable );
+
+ Graphic Mask( const Graphic& rGraphic );
+
+ bool IsEyedropping() const;
+
+ void onSelect( const MaskSet* pSet );
+
+private:
+
+ /** Set names for accessible objects. This is necessary for objects
+ like the source color checkboxes which initially have no name and
+ for which the description would be read by AT.
+ */
+ SVX_DLLPRIVATE void SetAccessibleNames();
+};
+
+#endif // INCLUDED_SVX_BMPMASK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/camera3d.hxx b/include/svx/camera3d.hxx
new file mode 100644
index 000000000..e151f2883
--- /dev/null
+++ b/include/svx/camera3d.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_CAMERA3D_HXX
+#define INCLUDED_SVX_CAMERA3D_HXX
+
+#include <basegfx/point/b3dpoint.hxx>
+#include <sal/types.h>
+#include <svx/viewpt3d.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* Camera derivative
+|*
+\************************************************************************/
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC Camera3D final : public Viewport3D
+{
+ basegfx::B3DPoint aPosition;
+ basegfx::B3DPoint aLookAt;
+ double fFocalLength;
+ double fBankAngle;
+
+ bool bAutoAdjustProjection;
+
+public:
+ Camera3D(const basegfx::B3DPoint& rPos, const basegfx::B3DPoint& rLookAt,
+ double fFocalLen = 35.0);
+ Camera3D();
+
+ void SetViewWindow(double fX, double fY, double fW, double fH);
+
+ void SetPosition(const basegfx::B3DPoint& rNewPos);
+ const basegfx::B3DPoint& GetPosition() const { return aPosition; }
+ void SetLookAt(const basegfx::B3DPoint& rNewLookAt);
+ void SetPosAndLookAt(const basegfx::B3DPoint& rNewPos, const basegfx::B3DPoint& rNewLookAt);
+
+ // Focal length in mm
+ void SetFocalLength(double fLen);
+ double GetFocalLength() const { return fFocalLength; }
+
+ // Bank angle left/right
+ void SetBankAngle(double fAngle);
+
+ void SetAutoAdjustProjection(bool bAdjust) { bAutoAdjustProjection = bAdjust; }
+};
+
+#endif // INCLUDED_SVX_CAMERA3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
new file mode 100644
index 000000000..faf5aea9b
--- /dev/null
+++ b/include/svx/charmap.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_CHARMAP_HXX
+#define INCLUDED_SVX_CHARMAP_HXX
+
+#include <sal/config.h>
+
+#include <deque>
+#include <map>
+#include <memory>
+
+#include <sal/types.h>
+#include <rtl/ref.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/gen.hxx>
+#include <tools/link.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
+
+namespace com::sun::star {
+ namespace accessibility { class XAccessible; }
+}
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+using namespace ::com::sun::star;
+
+#define COLUMN_COUNT 16
+#define ROW_COUNT 8
+
+namespace svx
+{
+ struct SvxShowCharSetItem;
+ class SvxShowCharSetAcc;
+}
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxShowCharSet : public weld::CustomWidgetController
+{
+protected:
+ VclPtr<VirtualDevice> mxVirDev;
+ vcl::Font maFont;
+ std::unique_ptr<weld::ScrolledWindow> mxScrollArea;
+public:
+ SvxShowCharSet(std::unique_ptr<weld::ScrolledWindow> pScrollArea, const VclPtr<VirtualDevice>& rVirDev);
+ virtual ~SvxShowCharSet() override;
+
+ virtual void RecalculateFont(vcl::RenderContext& rRenderContext);
+
+ void SelectCharacter( sal_UCS4 cNew );
+ virtual sal_UCS4 GetSelectCharacter() const;
+ void createContextMenu();
+
+ void SetDoubleClickHdl( const Link<SvxShowCharSet*,void>& rLink ) { aDoubleClkHdl = rLink; }
+ void SetSelectHdl( const Link<SvxShowCharSet*,void>& rHdl ) { aSelectHdl = rHdl; }
+ void SetHighlightHdl( const Link<SvxShowCharSet*,void>& rHdl ) { aHighHdl = rHdl; }
+ void SetPreSelectHdl( const Link<SvxShowCharSet*,void>& rHdl ) { aPreSelectHdl = rHdl; }
+ void SetFavClickHdl( const Link<SvxShowCharSet*,void>& rHdl ) { aFavClickHdl = rHdl; }
+ static sal_uInt32& getSelectedChar();
+ void SetFont( const vcl::Font& rFont );
+ vcl::Font const & GetFont() const { return maFont; }
+ FontCharMapRef const & GetFontCharMap();
+ bool isFavChar(const OUString& sTitle, const OUString& rFont);
+ void getFavCharacterList(); //gets both Fav char and Fav char font list
+ void updateFavCharacterList(const OUString& rChar, const OUString& rFont);
+
+ virtual svx::SvxShowCharSetItem* ImplGetItem( int _nPos );
+ int FirstInView() const;
+ virtual int LastInView() const;
+ int PixelToMapIndex( const Point&) const;
+ virtual void SelectIndex( int index, bool bFocus = false );
+ void OutputIndex( int index );
+ void DeSelect();
+ static void CopyToClipboard(const OUString& str);
+ bool IsSelected(sal_uInt16 _nPos) const { return _nPos == nSelectedIndex; }
+ sal_uInt16 GetSelectIndexId() const { return sal::static_int_cast<sal_uInt16>(nSelectedIndex); }
+ static sal_uInt16 GetRowPos(sal_uInt16 _nPos);
+ static sal_uInt16 GetColumnPos(sal_uInt16 _nPos);
+
+ virtual sal_Int32 getMaxCharCount() const;
+
+ virtual void Show() override { mxScrollArea->show(); }
+ virtual void Hide() override { mxScrollArea->hide(); }
+
+ uno::Reference<css::accessibility::XAccessible> getAccessibleParent() const { return GetDrawingArea()->get_accessible_parent(); }
+
+private:
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void Resize() override;
+ virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual bool MouseMove(const MouseEvent& rMEvt) override;
+ virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual bool KeyInput(const KeyEvent&) override;
+
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
+ virtual FactoryFunction GetUITestFactory() const override;
+
+protected:
+ typedef std::map<sal_Int32, std::shared_ptr<svx::SvxShowCharSetItem> > ItemsMap;
+ ItemsMap m_aItems;
+ Link<SvxShowCharSet*,void> aDoubleClkHdl;
+ Link<SvxShowCharSet*,void> aSelectHdl;
+ Link<SvxShowCharSet*,void> aFavClickHdl;
+ Link<SvxShowCharSet*,void> aHighHdl;
+ Link<SvxShowCharSet*,void> aPreSelectHdl;
+
+ std::deque<OUString> maFavCharList;
+ std::deque<OUString> maFavCharFontList;
+
+ rtl::Reference<svx::SvxShowCharSetAcc> m_xAccessible;
+ tools::Long nX;
+ tools::Long nY;
+ tools::Long m_nXGap;
+ tools::Long m_nYGap;
+ bool bDrag;
+
+ sal_Int32 nSelectedIndex;
+
+ FontCharMapRef mxFontCharMap;
+ Size maFontSize;
+ Point maPosition;
+
+ bool mbRecalculateFont : 1;
+ bool mbUpdateForeground : 1;
+ bool mbUpdateBackground : 1;
+
+
+protected:
+ virtual void DrawChars_Impl(vcl::RenderContext& rRenderContext, int n1, int n2);
+ void InitSettings(vcl::RenderContext& rRenderContext);
+ // abstraction layers are: Unicode<->MapIndex<->Pixel
+ Point MapIndexToPixel( int) const;
+ DECL_DLLPRIVATE_LINK(VscrollHdl, weld::ScrolledWindow&, void);
+ void ContextMenuSelect(std::string_view rIdent);
+
+ void init();
+ tools::Rectangle getGridRectangle(const Point &rPointUL, const Size &rOutputSize) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/charthelper.hxx b/include/svx/charthelper.hxx
new file mode 100644
index 000000000..3ad1fba53
--- /dev/null
+++ b/include/svx/charthelper.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_CHARTHELPER_HXX
+#define INCLUDED_SVX_CHARTHELPER_HXX
+
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star {
+ namespace embed { class XEmbeddedObject; }
+ namespace frame { class XModel; }
+ namespace uno { template <typename > class Reference; }
+}
+
+namespace basegfx { class B2DRange; }
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC ChartHelper
+{
+public:
+ /// Use chart's XUpdatable::update() to update values.
+ static void updateChart( const css::uno::Reference< css::frame::XModel >& rXModel );
+
+ // try to access rXModel in case of a chart to get the chart content
+ // as sequence of primitives. Return range of primitives (chart size) in rRange;
+ // it will be used to embed the chart to the SdrObject transformation. This
+ // allows to define possible distances between chart and SDrObject bounds here
+ static drawinglayer::primitive2d::Primitive2DContainer tryToGetChartContentAsPrimitive2DSequence(
+ const css::uno::Reference< css::frame::XModel >& rXModel,
+ basegfx::B2DRange& rRange);
+
+ // #i121334# Allow to switch off line and fill style by setting these as attributes
+ // at the OLE chart object. This is needed to allow fill styles of the covering objects
+ // to make their own fill/line settings work. This should not be done by changing
+ // the defaults at the chart (see StaticPageBackgroundDefaults_Initializer::lcl_AddDefaultsToMap)
+ // since this would not be saved/loaded, thus the compatibility will be better when setting it at
+ // newly created charts using this method
+ static void AdaptDefaultsForChart(
+ const css::uno::Reference < css::embed::XEmbeddedObject > & xEmbObj);
+};
+
+#endif // INCLUDED_SVX_CHARTHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/chrtitem.hxx b/include/svx/chrtitem.hxx
new file mode 100644
index 000000000..a8910845d
--- /dev/null
+++ b/include/svx/chrtitem.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_CHRTITEM_HXX
+#define INCLUDED_SVX_CHRTITEM_HXX
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svl/eitem.hxx>
+#include <svl/poolitem.hxx>
+#include <svx/svxdllapi.h>
+
+class IntlWrapper;
+class SfxItemPool;
+
+enum class SvxChartTextOrder
+{
+ SideBySide,
+ UpDown,
+ DownUp,
+ Auto
+};
+
+#define CHTXTORDER_COUNT (sal_uInt16(SvxChartTextOrder::Auto) + 1)
+
+enum class SvxChartKindError
+{
+ NONE,
+ Variant,
+ Sigma,
+ Percent,
+ BigError,
+ Const,
+ StdError,
+ Range
+};
+
+#define CHERROR_COUNT (sal_uInt16(SvxChartKindError::Range) + 1)
+
+enum class SvxChartIndicate
+{
+ NONE,
+ Both,
+ Up,
+ Down
+};
+
+#define CHINDICATE_COUNT (sal_uInt16(SvxChartIndicate::Down) + 1)
+
+enum class SvxChartRegress
+{
+ NONE,
+ Linear,
+ Log,
+ Exp,
+ Power,
+ Polynomial,
+ MovingAverage,
+ MeanValue,
+ Unknown
+};
+
+#define CHREGRESS_COUNT (sal_uInt16(SvxChartRegress::Unknown) + 1)
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxChartRegressItem final : public SfxEnumItem<SvxChartRegress>
+{
+public:
+ SvxChartRegressItem(SvxChartRegress eRegress /*= SvxChartRegress::Linear*/,
+ TypedWhichId<SvxChartRegressItem> nId );
+
+ virtual SvxChartRegressItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ sal_uInt16 GetValueCount() const override { return CHREGRESS_COUNT; }
+};
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxChartTextOrderItem final : public SfxEnumItem<SvxChartTextOrder>
+{
+public:
+ SvxChartTextOrderItem(SvxChartTextOrder eOrder /*= SvxChartTextOrder::SideBySide*/,
+ TypedWhichId<SvxChartTextOrderItem> nId );
+
+ virtual SvxChartTextOrderItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ sal_uInt16 GetValueCount() const override { return CHTXTORDER_COUNT; }
+};
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxChartKindErrorItem final : public SfxEnumItem<SvxChartKindError>
+{
+public:
+ SvxChartKindErrorItem(SvxChartKindError /*eOrient = SvxChartKindError::NONE*/,
+ TypedWhichId<SvxChartKindErrorItem> nId );
+
+ virtual SvxChartKindErrorItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ sal_uInt16 GetValueCount() const override { return CHERROR_COUNT; }
+};
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxChartIndicateItem final : public SfxEnumItem<SvxChartIndicate>
+{
+public:
+ SvxChartIndicateItem(SvxChartIndicate eOrient /*= SvxChartIndicate::NONE*/,
+ TypedWhichId<SvxChartIndicateItem> nId );
+
+ virtual SvxChartIndicateItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ sal_uInt16 GetValueCount() const override { return CHINDICATE_COUNT; }
+};
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxDoubleItem final : public SfxPoolItem
+{
+ double fVal;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SvxDoubleItem(double fValue /*= 0.0*/, TypedWhichId<SvxDoubleItem> nId );
+ SvxDoubleItem(const SvxDoubleItem& rItem);
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper&) const override;
+
+ virtual bool operator == (const SfxPoolItem&) const override;
+ virtual SvxDoubleItem* Clone(SfxItemPool *pPool = nullptr) const override;
+
+ double GetValue() const { return fVal; }
+};
+
+#endif // INCLUDED_SVX_CHRTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/clipboardctl.hxx b/include/svx/clipboardctl.hxx
new file mode 100644
index 000000000..44c79040d
--- /dev/null
+++ b/include/svx/clipboardctl.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_CLIPBOARDCTL_HXX
+#define INCLUDED_SVX_CLIPBOARDCTL_HXX
+
+#include <sal/types.h>
+#include <sfx2/tbxctrl.hxx>
+#include <svl/poolitem.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+class SfxModule;
+class ToolBox;
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxClipBoardControl final : public SfxToolBoxControl
+{
+ std::unique_ptr<SfxPoolItem> pClipboardFmtItem;
+ bool bDisabled;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxClipBoardControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+ virtual ~SvxClipBoardControl() override;
+
+ void CreatePopupWindow() override;
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/clipfmtitem.hxx b/include/svx/clipfmtitem.hxx
new file mode 100644
index 000000000..eb87aecbb
--- /dev/null
+++ b/include/svx/clipfmtitem.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_CLIPFMTITEM_HXX
+#define INCLUDED_SVX_CLIPFMTITEM_HXX
+
+#include <climits>
+#include <memory>
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <sot/formats.hxx>
+#include <svl/poolitem.hxx>
+#include <svx/svxdllapi.h>
+
+class SfxItemPool;
+struct SvxClipboardFormatItem_Impl;
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxClipboardFormatItem final : public SfxPoolItem
+{
+ virtual bool operator==(const SfxPoolItem&) const override;
+ virtual SvxClipboardFormatItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SvxClipboardFormatItem(TypedWhichId<SvxClipboardFormatItem> nId);
+ SvxClipboardFormatItem(const SvxClipboardFormatItem&);
+ virtual ~SvxClipboardFormatItem() override;
+
+ virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
+ virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
+
+ void AddClipbrdFormat(SotClipboardFormatId nId);
+ void AddClipbrdFormat(SotClipboardFormatId nId, const OUString& rName,
+ sal_uInt16 nPos = USHRT_MAX);
+ sal_uInt16 Count() const;
+
+ SotClipboardFormatId GetClipbrdFormatId(sal_uInt16 nPos) const;
+ OUString const& GetClipbrdFormatName(sal_uInt16 nPos) const;
+
+private:
+ std::unique_ptr<SvxClipboardFormatItem_Impl> pImpl;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx
new file mode 100644
index 000000000..3775fc187
--- /dev/null
+++ b/include/svx/colorbox.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVX_COLORBOX_HXX
+#define INCLUDED_SVX_COLORBOX_HXX
+
+#include <memory>
+#include <vcl/weld.hxx>
+#include <svx/colorwindow.hxx>
+
+class ColorListBox;
+
+class ListBoxColorWrapper
+{
+public:
+ ListBoxColorWrapper(ColorListBox* pControl);
+ void operator()(const OUString& rCommand,
+ const svx::NamedThemedColor& rColor); // ColorSelectFunction signature
+private:
+ ColorListBox* mpControl;
+};
+
+class SVXCORE_DLLPUBLIC ColorListBox
+{
+private:
+ friend class ListBoxColorWrapper;
+ std::unique_ptr<ColorWindow> m_xColorWindow;
+ std::unique_ptr<weld::MenuButton> m_xButton;
+ Link<ColorListBox&, void> m_aSelectedLink;
+ ListBoxColorWrapper m_aColorWrapper;
+ Color m_aAutoDisplayColor;
+ Color m_aSaveColor;
+ svx::NamedThemedColor m_aSelectedColor;
+ sal_uInt16 m_nSlotId;
+ bool m_bShowNoneButton;
+ std::shared_ptr<PaletteManager> m_xPaletteManager;
+ TopLevelParentFunction m_aTopLevelParentFunction;
+ ColorStatus m_aColorStatus;
+
+ void Selected(const svx::NamedThemedColor& rNamedColor);
+ void createColorWindow();
+ void LockWidthRequest();
+ ColorWindow* getColorWindow() const;
+
+ DECL_DLLPRIVATE_LINK(ToggleHdl, weld::Toggleable&, void);
+
+public:
+ // rTopLevelParentFunction will be used to get parent for any color picker dialog created
+ ColorListBox(std::unique_ptr<weld::MenuButton> pControl,
+ TopLevelParentFunction const& rTopLevelParentFunction);
+ ~ColorListBox();
+
+ void SetSelectHdl(const Link<ColorListBox&, void>& rLink) { m_aSelectedLink = rLink; }
+
+ void SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton = false);
+
+ Color const& GetSelectEntryColor() const { return m_aSelectedColor.m_aColor; }
+ NamedColor GetSelectedEntry() const { return m_aSelectedColor.ToNamedColor(); }
+ const svx::NamedThemedColor& GetSelectedEntryThemedColor() const { return m_aSelectedColor; }
+
+ void SelectEntry(const NamedColor& rColor);
+ void SelectEntry(const Color& rColor);
+
+ void SetNoSelection() { getColorWindow()->SetNoSelection(); }
+ bool IsNoSelection() const { return getColorWindow()->IsNoSelection(); }
+
+ void SetAutoDisplayColor(const Color& rColor) { m_aAutoDisplayColor = rColor; }
+
+ void ShowPreview(const NamedColor& rColor);
+ void EnsurePaletteManager();
+
+ void SaveValue() { m_aSaveColor = GetSelectEntryColor(); }
+ bool IsValueChangedFromSaved() const { return m_aSaveColor != GetSelectEntryColor(); }
+
+ void set_sensitive(bool sensitive) { m_xButton->set_sensitive(sensitive); }
+ bool get_sensitive() const { return m_xButton->get_sensitive(); }
+ void show() { m_xButton->show(); }
+ void hide() { m_xButton->hide(); }
+ void set_visible(bool bShow) { m_xButton->set_visible(bShow); }
+ void set_help_id(const OString& rHelpId) { m_xButton->set_help_id(rHelpId); }
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink)
+ {
+ m_xButton->connect_focus_in(rLink);
+ }
+ void connect_focus_out(const Link<weld::Widget&, void>& rLink)
+ {
+ m_xButton->connect_focus_out(rLink);
+ }
+ weld::MenuButton& get_widget() { return *m_xButton; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx
new file mode 100644
index 000000000..823c819f0
--- /dev/null
+++ b/include/svx/colorwindow.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/toolbarmenu.hxx>
+#include <rtl/ustring.hxx>
+#include <svx/SvxColorValueSet.hxx>
+#include <svx/Palette.hxx>
+#include <vcl/toolboxid.hxx>
+
+typedef std::function<weld::Window*()> TopLevelParentFunction;
+
+namespace com::sun::star::frame { class XFrame; }
+
+class PaletteManager;
+class ToolBox;
+
+class SVXCORE_DLLPUBLIC ColorStatus
+{
+ Color maColor;
+ Color maTLBRColor;
+ Color maBLTRColor;
+public:
+ ColorStatus();
+ void statusChanged( const css::frame::FeatureStateEvent& rEvent );
+ Color GetColor();
+};
+
+class Button;
+
+#define COL_NONE_COLOR ::Color(ColorTransparency, 0x80, 0xFF, 0xFF, 0xFF)
+
+class SvxColorToolBoxControl;
+
+class SVXCORE_DLLPUBLIC MenuOrToolMenuButton
+{
+private:
+ // either
+ weld::MenuButton* m_pMenuButton;
+ // or
+ weld::Toolbar* m_pToolbar;
+ OString m_aIdent;
+ // or
+ SvxColorToolBoxControl* m_pControl;
+ VclPtr<ToolBox> m_xToolBox;
+ ToolBoxItemId m_nId;
+public:
+ MenuOrToolMenuButton(weld::MenuButton* pMenuButton);
+ MenuOrToolMenuButton(weld::Toolbar* pToolbar, const OString& rIdent);
+ MenuOrToolMenuButton(SvxColorToolBoxControl* pControl, ToolBox* pToolbar, ToolBoxItemId nId);
+ ~MenuOrToolMenuButton();
+
+ MenuOrToolMenuButton(MenuOrToolMenuButton const &) = default;
+ MenuOrToolMenuButton(MenuOrToolMenuButton &&) = default;
+ MenuOrToolMenuButton & operator =(MenuOrToolMenuButton const &) = default;
+ MenuOrToolMenuButton & operator =(MenuOrToolMenuButton &&) = default;
+
+ bool get_active() const;
+ void set_inactive() const;
+ weld::Widget* get_widget() const;
+};
+
+class SVXCORE_DLLPUBLIC ColorWindow final : public WeldToolbarPopup
+{
+private:
+ const sal_uInt16 theSlotId;
+ OUString maCommand;
+ MenuOrToolMenuButton maMenuButton;
+ std::shared_ptr<PaletteManager> mxPaletteManager;
+ ColorStatus& mrColorStatus;
+ TopLevelParentFunction maTopLevelParentFunction;
+ ColorSelectFunction maColorSelectFunction;
+
+ std::unique_ptr<SvxColorValueSet> mxColorSet;
+ std::unique_ptr<SvxColorValueSet> mxRecentColorSet;
+ std::unique_ptr<weld::ComboBox> mxPaletteListBox;
+ std::unique_ptr<weld::Button> mxButtonAutoColor;
+ std::unique_ptr<weld::Button> mxButtonNoneColor;
+ std::unique_ptr<weld::Button> mxButtonPicker;
+ std::unique_ptr<weld::Widget> mxAutomaticSeparator;
+ std::unique_ptr<weld::CustomWeld> mxColorSetWin;
+ std::unique_ptr<weld::CustomWeld> mxRecentColorSetWin;
+ weld::Button* mpDefaultButton;
+
+ Link<const NamedColor&, void> maSelectedLink;
+ DECL_DLLPRIVATE_LINK(SelectHdl, ValueSet*, void);
+ DECL_DLLPRIVATE_LINK(SelectPaletteHdl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(AutoColorClickHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(OpenPickerClickHdl, weld::Button&, void);
+
+ static bool SelectValueSetEntry(SvxColorValueSet* pColorSet, const Color& rColor);
+ static NamedColor GetSelectEntryColor(ValueSet const * pColorSet);
+ NamedColor GetAutoColor() const;
+
+public:
+ ColorWindow(const OUString& rCommand,
+ std::shared_ptr<PaletteManager> const & rPaletteManager,
+ ColorStatus& rColorStatus,
+ sal_uInt16 nSlotId,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ const MenuOrToolMenuButton &rMenuButton,
+ TopLevelParentFunction const& rTopLevelParentFunction,
+ ColorSelectFunction const& rColorSelectFunction);
+ virtual ~ColorWindow() override;
+ void ShowNoneButton();
+ void SetNoSelection();
+ bool IsNoSelection() const;
+ void SelectEntry(const NamedColor& rColor);
+ void SelectEntry(const Color& rColor);
+ NamedColor GetSelectEntryColor() const;
+
+ virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
+
+ void SetSelectedHdl( const Link<const NamedColor&, void>& rLink ) { maSelectedLink = rLink; }
+
+ virtual void GrabFocus() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/compressgraphicdialog.hxx b/include/svx/compressgraphicdialog.hxx
new file mode 100644
index 000000000..87556ecbc
--- /dev/null
+++ b/include/svx/compressgraphicdialog.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_COMPRESSGRAPHICDIALOG_HXX
+#define INCLUDED_SVX_COMPRESSGRAPHICDIALOG_HXX
+
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+#include <tools/gen.hxx>
+#include <tools/link.hxx>
+#include <vcl/weld.hxx>
+#include <vcl/graph.hxx>
+
+class SdrGrafObj;
+class SfxBindings;
+class SvStream;
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC CompressGraphicsDialog final : public weld::GenericDialogController
+{
+private:
+ std::unique_ptr<weld::Label> m_xLabelGraphicType;
+ std::unique_ptr<weld::Label> m_xFixedText2;
+ std::unique_ptr<weld::Label> m_xFixedText3;
+ std::unique_ptr<weld::Label> m_xFixedText5;
+ std::unique_ptr<weld::Label> m_xFixedText6;
+
+ std::unique_ptr<weld::CheckButton> m_xReduceResolutionCB;
+ std::unique_ptr<weld::SpinButton> m_xMFNewWidth;
+ std::unique_ptr<weld::SpinButton> m_xMFNewHeight;
+ std::unique_ptr<weld::ComboBox> m_xResolutionLB;
+ std::unique_ptr<weld::RadioButton> m_xLosslessRB;
+ std::unique_ptr<weld::RadioButton> m_xJpegCompRB;
+ std::unique_ptr<weld::SpinButton> m_xCompressionMF;
+ std::unique_ptr<weld::Scale> m_xCompressionSlider;
+ std::unique_ptr<weld::SpinButton> m_xQualityMF;
+ std::unique_ptr<weld::Scale> m_xQualitySlider;
+ std::unique_ptr<weld::Button> m_xBtnCalculate;
+ std::unique_ptr<weld::ComboBox> m_xInterpolationCombo;
+ std::unique_ptr<weld::Button> m_xBtnOkay;
+
+ SdrGrafObj* m_xGraphicObj;
+ Graphic m_aGraphic;
+ Size m_aViewSize100mm;
+ tools::Rectangle m_aCropRectangle;
+ SfxBindings& m_rBindings;
+
+ double m_dResolution;
+ sal_Int32 m_aNativeSize;
+
+ void Initialize();
+ void recallParameter();
+
+ DECL_DLLPRIVATE_LINK( SlideHdl, weld::Scale&, void );
+ DECL_DLLPRIVATE_LINK( NewInterpolationModifiedHdl, weld::ComboBox&, void );
+ DECL_DLLPRIVATE_LINK( NewQualityModifiedHdl, weld::Entry&, void );
+ DECL_DLLPRIVATE_LINK( NewCompressionModifiedHdl, weld::Entry&, void );
+ DECL_DLLPRIVATE_LINK( NewWidthModifiedHdl, weld::Entry&, void );
+ DECL_DLLPRIVATE_LINK( NewHeightModifiedHdl, weld::Entry&, void );
+ DECL_DLLPRIVATE_LINK( ResolutionModifiedHdl, weld::ComboBox&, void );
+ DECL_DLLPRIVATE_LINK( ToggleCompressionRB, weld::Toggleable&, void );
+ DECL_DLLPRIVATE_LINK( ToggleReduceResolutionRB, weld::Toggleable&, void );
+
+ DECL_DLLPRIVATE_LINK( CalculateClickHdl, weld::Button&, void );
+ DECL_DLLPRIVATE_LINK( OkayClickHdl, weld::Button&, void );
+
+ void Update();
+ void UpdateNewWidthMF();
+ void UpdateNewHeightMF();
+ void UpdateResolutionLB();
+
+ void Compress(SvStream& aStream);
+
+ double GetViewWidthInch() const;
+ double GetViewHeightInch() const;
+
+ BmpScaleFlag GetSelectedInterpolationType() const;
+
+public:
+ CompressGraphicsDialog( weld::Window* pParent, SdrGrafObj* pGraphicObj, SfxBindings& rBindings );
+ CompressGraphicsDialog( weld::Window* pParent, Graphic const & rGraphic, Size rViewSize100mm, tools::Rectangle const & rCropRectangle, SfxBindings& rBindings );
+ virtual ~CompressGraphicsDialog() override;
+
+ SdrGrafObj* GetCompressedSdrGrafObj();
+ Graphic GetCompressedGraphic();
+
+ tools::Rectangle GetScaledCropRectangle() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/connctrl.hxx b/include/svx/connctrl.hxx
new file mode 100644
index 000000000..44768922f
--- /dev/null
+++ b/include/svx/connctrl.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_CONNCTRL_HXX
+#define INCLUDED_SVX_CONNCTRL_HXX
+
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+#include <vcl/customweld.hxx>
+#include <vcl/outdev.hxx>
+
+class SfxItemSet;
+class SdrEdgeObj;
+class SdrView;
+class SdrPage;
+
+/*************************************************************************
+|*
+|* SvxXConnectionPreview
+|*
+\************************************************************************/
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXConnectionPreview final : public weld::CustomWidgetController
+{
+ friend class SvxConnectionPage;
+
+private:
+ MapMode aNewMapMode;
+ SdrEdgeObj* pEdgeObj;
+ rtl::Reference<SdrPage> mxSdrPage;
+ const SdrView* pView;
+
+ SVX_DLLPRIVATE void AdaptSize();
+ SVX_DLLPRIVATE void SetMapMode(const MapMode& rNewMapMode) { aNewMapMode = rNewMapMode; }
+ SVX_DLLPRIVATE const MapMode& GetMapMode() const { return aNewMapMode; }
+public:
+ SvxXConnectionPreview();
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual ~SvxXConnectionPreview() override;
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+ virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
+
+ void SetAttributes( const SfxItemSet& rInAttrs );
+ sal_uInt16 GetLineDeltaCount() const;
+
+ void Construct();
+ void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
+};
+
+#endif // INCLUDED_SVX_CONNCTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/contdlg.hxx b/include/svx/contdlg.hxx
new file mode 100644
index 000000000..cb3034fd6
--- /dev/null
+++ b/include/svx/contdlg.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_CONTDLG_HXX
+#define INCLUDED_SVX_CONTDLG_HXX
+
+#include <sal/types.h>
+
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/childwin.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/poly.hxx>
+
+class SfxBindings;
+class SfxModule;
+
+/*************************************************************************
+|*
+|* Derivation from SfxChildWindow as "container" for Float
+|*
+\************************************************************************/
+
+class Graphic;
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxContourDlgChildWindow final : public SfxChildWindow
+{
+public:
+ SvxContourDlgChildWindow( vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo const * );
+
+ SFX_DECL_CHILDWINDOW_WITHID( SvxContourDlgChildWindow );
+};
+
+class SvxSuperContourDlg;
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxContourDlg final : public SfxModelessDialogController
+{
+ std::unique_ptr<SvxSuperContourDlg> m_xImpl;
+
+public:
+
+ SvxContourDlg(SfxBindings *pBindings, SfxChildWindow *pCW, weld::Window* pParent);
+ virtual ~SvxContourDlg() override;
+
+ const Graphic& GetGraphic() const;
+ bool IsGraphicChanged() const;
+
+ tools::PolyPolygon GetPolyPolygon();
+
+ const void* GetEditingObject() const;
+
+ void Update( const Graphic& rGraphic, bool bGraphicLinked,
+ const tools::PolyPolygon* pPolyPoly, void* pEditingObj );
+
+ static tools::PolyPolygon CreateAutoContour( const Graphic& rGraphic,
+ const tools::Rectangle* pRect = nullptr );
+};
+
+#endif // INCLUDED_SVX_CONTDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx
new file mode 100644
index 000000000..84cf456cb
--- /dev/null
+++ b/include/svx/ctredlin.hxx
@@ -0,0 +1,339 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_CTREDLIN_HXX
+#define INCLUDED_SVX_CTREDLIN_HXX
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+#include <tools/date.hxx>
+#include <tools/datetime.hxx>
+#include <tools/link.hxx>
+#include <tools/time.hxx>
+#include <vcl/weld.hxx>
+#include <memory>
+
+namespace utl {
+ class SearchParam;
+ class TextSearch;
+}
+
+namespace comphelper::string { class NaturalStringSorter; }
+
+class Point;
+class SvViewDataEntry;
+class SvtCalendarBox;
+
+enum class SvxRedlinDateMode
+{
+ BEFORE, SINCE, EQUAL, NOTEQUAL, BETWEEN, SAVE, NONE
+};
+
+enum class RedlineType : sal_uInt16
+{
+ // Range of RedlineTypes is 0 to 127.
+ Insert = 0x0,// Content has been inserted.
+ Delete = 0x1,// Content has been deleted.
+ Format = 0x2,// Attributes have been applied.
+ Table = 0x3,// Table structure has been altered.
+ FmtColl = 0x4,// Style has been altered (Autoformat!).
+ ParagraphFormat = 0x5,// Paragraph attributes have been changed.
+ TableRowInsert = 0x6,// Table row has been inserted.
+ TableRowDelete = 0x7,// Table row has been deleted.
+ TableCellInsert = 0x8,// Table cell has been inserted.
+ TableCellDelete = 0x9,// Table cell has been deleted.
+ None = USHRT_MAX - 1, // special value to indicate missing redlining in some return value
+ Any = USHRT_MAX // special value to indicate any redline type in some method calls
+};
+
+/// Struct for sorting data.
+class SAL_WARN_UNUSED SVX_DLLPUBLIC RedlinData
+{
+public:
+ RedlinData();
+ virtual ~RedlinData();
+ DateTime aDateTime;
+ void* pData;
+ RedlineType eType;
+ bool bDisabled;
+};
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxRedlinTable
+{
+private:
+ std::unique_ptr<comphelper::string::NaturalStringSorter> xSorter;
+ std::unique_ptr<weld::TreeView> xWriterTreeView;
+ std::unique_ptr<weld::TreeView> xCalcTreeView;
+ weld::TreeView* pTreeView;
+
+ sal_uInt16 nDatePos;
+ bool bAuthor;
+ bool bDate;
+ bool bComment;
+ bool bSorted;
+ SvxRedlinDateMode nDaTiMode;
+ DateTime aDaTiFirst;
+ DateTime aDaTiLast;
+ DateTime aDaTiFilterFirst;
+ DateTime aDaTiFilterLast;
+ OUString aAuthor;
+ std::unique_ptr<utl::TextSearch> pCommentSearcher;
+
+ int ColCompare(const weld::TreeIter& rLeft, const weld::TreeIter& rRight);
+
+public:
+ SvxRedlinTable(std::unique_ptr<weld::TreeView> xWriterControl,
+ std::unique_ptr<weld::TreeView> xCalcControl);
+
+ weld::TreeView& GetWidget() { return *pTreeView; }
+ bool IsSorted() const { return bSorted; }
+
+ ~SvxRedlinTable();
+
+ // For FilterPage only {
+ void SetFilterDate(bool bFlag);
+ void SetDateTimeMode(SvxRedlinDateMode nMode);
+ void SetFirstDate(const Date&);
+ void SetLastDate(const Date&);
+ void SetFirstTime(const tools::Time&);
+ void SetLastTime(const tools::Time&);
+ void SetFilterAuthor(bool bFlag);
+ void SetAuthor(const OUString &);
+ void SetFilterComment(bool bFlag);
+ void SetCommentParams( const utl::SearchParam* pSearchPara );
+
+ void UpdateFilterTest();
+ // } For FilterPage only
+
+ void SetCalcView();
+ void SetWriterView();
+
+ bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime, const OUString &rComment);
+ bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime);
+ bool IsValidComment(const OUString &rComment);
+
+ DECL_LINK(HeaderBarClick, int, void);
+};
+
+class SVX_DLLPUBLIC SvxTPage
+{
+protected:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+public:
+ SvxTPage(weld::Container* pParent, const OUString& rUIXMLDescription, const OString& rID);
+ virtual ~SvxTPage();
+ virtual void ActivatePage();
+ void Show() { m_xContainer->show(); }
+};
+
+namespace weld
+{
+ class TimeFormatter;
+}
+
+/// Tabpage with the filter text entries etc.
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPFilter final : public SvxTPage
+{
+ Link<SvxTPFilter*,void> aReadyLink;
+ Link<SvxTPFilter*,void> aRefLink;
+
+ bool bModified;
+
+ SvxRedlinTable* m_pRedlinTable;
+ std::unique_ptr<weld::CheckButton> m_xCbDate;
+ std::unique_ptr<weld::ComboBox> m_xLbDate;
+ std::unique_ptr<SvtCalendarBox> m_xDfDate;
+ std::unique_ptr<weld::FormattedSpinButton> m_xTfDate;
+ std::unique_ptr<weld::TimeFormatter> m_xTfDateFormatter;
+ std::unique_ptr<weld::Button> m_xIbClock;
+ std::unique_ptr<weld::Label> m_xFtDate2;
+ std::unique_ptr<SvtCalendarBox> m_xDfDate2;
+ std::unique_ptr<weld::FormattedSpinButton> m_xTfDate2;
+ std::unique_ptr<weld::TimeFormatter> m_xTfDate2Formatter;
+ std::unique_ptr<weld::Button> m_xIbClock2;
+ std::unique_ptr<weld::CheckButton> m_xCbAuthor;
+ std::unique_ptr<weld::ComboBox> m_xLbAuthor;
+ std::unique_ptr<weld::CheckButton> m_xCbRange;
+ std::unique_ptr<weld::Entry> m_xEdRange;
+ std::unique_ptr<weld::Button> m_xBtnRange;
+ std::unique_ptr<weld::CheckButton> m_xCbAction;
+ std::unique_ptr<weld::ComboBox> m_xLbAction;
+ std::unique_ptr<weld::CheckButton> m_xCbComment;
+ std::unique_ptr<weld::Entry> m_xEdComment;
+
+ DECL_DLLPRIVATE_LINK( SelDateHdl, weld::ComboBox&, void );
+ DECL_DLLPRIVATE_LINK( RowEnableHdl, weld::Toggleable&, void );
+ DECL_DLLPRIVATE_LINK( TimeHdl, weld::Button&, void );
+ DECL_DLLPRIVATE_LINK( ModifyHdl, weld::Entry&, void );
+ DECL_DLLPRIVATE_LINK( ModifyListBoxHdl, weld::ComboBox&, void );
+ DECL_DLLPRIVATE_LINK( ModifyDate, SvtCalendarBox&, void );
+ DECL_DLLPRIVATE_LINK( ModifyTime, weld::FormattedSpinButton&, void );
+ DECL_DLLPRIVATE_LINK( RefHandle, weld::Button&, void );
+
+ void EnableDateLine1(bool bFlag);
+ void EnableDateLine2(bool bFlag);
+
+public:
+ SvxTPFilter(weld::Container* pParent);
+ virtual ~SvxTPFilter() override;
+
+ void DeactivatePage();
+ void SetRedlinTable(SvxRedlinTable*);
+
+ Date GetFirstDate() const;
+ void SetFirstDate(const Date &aDate);
+ tools::Time GetFirstTime() const;
+ void SetFirstTime(const tools::Time &aTime);
+
+ Date GetLastDate() const;
+ void SetLastDate(const Date &aDate);
+ tools::Time GetLastTime() const;
+ void SetLastTime(const tools::Time &aTime);
+
+ void SetDateMode(sal_uInt16 nMode);
+ SvxRedlinDateMode GetDateMode() const;
+
+ void ClearAuthors();
+ void InsertAuthor( const OUString& rString );
+ OUString GetSelectedAuthor()const;
+ void SelectedAuthorPos(sal_Int32 nPos);
+ sal_Int32 SelectAuthor(const OUString& aString);
+ void SetComment(const OUString& rComment);
+ OUString GetComment()const;
+
+ // Methods for Calc {
+ void SetRange(const OUString& rString);
+ OUString GetRange() const;
+ void HideRange(bool bHide=true);
+ void SetFocusToRange();
+ // } Methods for Calc
+
+ bool IsDate() const;
+ bool IsAuthor() const;
+ bool IsRange() const;
+ bool IsAction() const;
+ bool IsComment() const;
+
+ void ShowAction(bool bShow=true);
+
+ void CheckDate(bool bFlag);
+ void CheckAuthor(bool bFlag);
+ void CheckRange(bool bFlag);
+ void CheckAction(bool bFlag);
+ void CheckComment(bool bFlag);
+
+ weld::ComboBox* GetLbAction() { return m_xLbAction.get(); }
+
+ void SetReadyHdl( const Link<SvxTPFilter*,void>& rLink ) { aReadyLink= rLink; }
+
+
+ // Methods for Calc {
+ void SetRefHdl( const Link<SvxTPFilter*,void>& rLink ) { aRefLink = rLink; }
+
+ void Enable( bool bEnable = true );
+ // } Methods for Calc
+};
+
+/// Tabpage with the redlining entries.
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPView final : public SvxTPage
+{
+private:
+
+ Link<SvxTPView*,void> AcceptClickLk;
+ Link<SvxTPView*,void> AcceptAllClickLk;
+ Link<SvxTPView*,void> RejectClickLk;
+ Link<SvxTPView*,void> RejectAllClickLk;
+ Link<SvxTPView*,void> UndoClickLk;
+
+ bool bEnableAccept;
+ bool bEnableAcceptAll;
+ bool bEnableReject;
+ bool bEnableRejectAll;
+ bool bEnableUndo;
+
+ bool bEnableClearFormat;
+ bool bEnableClearFormatAll;
+
+ std::unique_ptr<weld::Button> m_xAccept;
+ std::unique_ptr<weld::Button> m_xReject;
+ std::unique_ptr<weld::Button> m_xAcceptAll;
+ std::unique_ptr<weld::Button> m_xRejectAll;
+ std::unique_ptr<weld::Button> m_xUndo;
+ std::unique_ptr<SvxRedlinTable> m_xViewData;
+
+ DECL_DLLPRIVATE_LINK( PbClickHdl, weld::Button&, void );
+
+public:
+ SvxTPView(weld::Container* pParent);
+ virtual ~SvxTPView() override;
+
+ SvxRedlinTable* GetTableControl() { return m_xViewData.get(); }
+
+ void EnableAccept(bool bFlag);
+ void EnableAcceptAll(bool bFlag);
+ void EnableReject(bool bFlag);
+ void EnableRejectAll(bool bFlag);
+ void EnableClearFormat(bool bFlag);
+ void EnableClearFormatAll(bool bFlag);
+ void EnableUndo(bool bFlag=true);
+ void DisableUndo() {EnableUndo(false);}
+ void ShowUndo();
+
+ void SetAcceptClickHdl( const Link<SvxTPView*,void>& rLink ) { AcceptClickLk = rLink; }
+
+ void SetAcceptAllClickHdl( const Link<SvxTPView*,void>& rLink ) { AcceptAllClickLk = rLink; }
+
+ void SetRejectClickHdl( const Link<SvxTPView*,void>& rLink ) { RejectClickLk = rLink; }
+
+ void SetRejectAllClickHdl( const Link<SvxTPView*,void>& rLink ) { RejectAllClickLk = rLink; }
+
+ void SetUndoClickHdl( const Link<SvxTPView*,void>& rLink ) { UndoClickLk = rLink; }
+
+ virtual void ActivatePage() override;
+ void DeactivatePage();
+};
+
+// Redlining - Control (Accept- Changes)
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxAcceptChgCtr
+{
+private:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Notebook> m_xTabCtrl;
+
+ std::unique_ptr<SvxTPFilter> m_xTPFilter;
+ std::unique_ptr<SvxTPView> m_xTPView;
+
+ DECL_DLLPRIVATE_LINK(ActivatePageHdl, const OString&, void);
+ DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OString&, bool);
+
+public:
+ SvxAcceptChgCtr(weld::Container* pParent);
+ ~SvxAcceptChgCtr();
+
+ void ShowFilterPage();
+
+ SvxTPFilter* GetFilterPage() { return m_xTPFilter.get(); }
+ SvxTPView* GetViewPage() { return m_xTPView.get(); }
+};
+
+#endif // INCLUDED_SVX_CTREDLIN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/cube3d.hxx b/include/svx/cube3d.hxx
new file mode 100644
index 000000000..9842b26f0
--- /dev/null
+++ b/include/svx/cube3d.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_CUBE3D_HXX
+#define INCLUDED_SVX_CUBE3D_HXX
+
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svx/obj3d.hxx>
+#include <svx/svxdllapi.h>
+
+namespace sdr::contact { class ViewContact; }
+
+class E3dDefaultAttributes;
+
+/*************************************************************************
+|*
+|* |
+|* Create a 3D cuboid; aPos: Center or left, bottom, behind |__
+|* (depending on bPosIsCenter) /
+|* nSideFlags indicates, if only some of the cuboid surfaces can
+|* be created; the corresponding bits are defined in the enum.
+|* The flag bDblSided indicates whether the created surfaces are
+|* two-sided (which only makes sense if not all of the surfaces were
+|* created).
+|*
+\************************************************************************/
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC E3dCubeObj final : public E3dCompoundObject
+{
+ // Parameter
+ basegfx::B3DPoint aCubePos;
+ basegfx::B3DVector aCubeSize;
+
+ // BOOLeans
+ bool bPosIsCenter : 1;
+
+ void SetDefaultAttributes(const E3dDefaultAttributes& rDefault);
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+
+private:
+ // protected destructor - due to final, make private
+ virtual ~E3dCubeObj() override;
+
+public:
+ E3dCubeObj(SdrModel& rSdrModel,
+ const E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPoint& aPos,
+ const basegfx::B3DVector& r3DSize);
+ E3dCubeObj(SdrModel& rSdrModel, E3dCubeObj const &);
+ E3dCubeObj(SdrModel& rSdrModel);
+
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ virtual E3dCubeObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ // Set local parameters with geometry recreation
+ void SetCubePos(const basegfx::B3DPoint& rNew);
+ const basegfx::B3DPoint& GetCubePos() const { return aCubePos; }
+
+ void SetCubeSize(const basegfx::B3DVector& rNew);
+ const basegfx::B3DVector& GetCubeSize() const { return aCubeSize; }
+
+ void SetPosIsCenter(bool bNew);
+ bool GetPosIsCenter() const { return bPosIsCenter; }
+
+ // TakeObjName...() is for the display in the UI, for example "3 frames selected".
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+};
+
+#endif // INCLUDED_SVX_CUBE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/dataaccessdescriptor.hxx b/include/svx/dataaccessdescriptor.hxx
new file mode 100644
index 000000000..bc3423999
--- /dev/null
+++ b/include/svx/dataaccessdescriptor.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DATAACCESSDESCRIPTOR_HXX
+#define INCLUDED_SVX_DATAACCESSDESCRIPTOR_HXX
+
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::uno { class Any; }
+namespace com::sun::star::uno { template <class E> class Sequence; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+namespace svx
+{
+ class ODADescriptorImpl;
+
+ //= DataAccessDescriptorProperty
+ enum class DataAccessDescriptorProperty
+ {
+ DataSource, /// data source name (string)
+ DatabaseLocation, /// database file URL (string)
+ ConnectionResource, /// database driver URL (string)
+ Connection, /// connection (XConnection)
+
+ Command, /// command (string)
+ CommandType, /// command type (long)
+ EscapeProcessing, /// escape processing (boolean)
+ Filter, /// additional filter (string)
+ Cursor, /// the cursor (XResultSet)
+
+ ColumnName, /// column name (string)
+ ColumnObject, /// column object (XPropertySet)
+
+ Selection, /// selection (sequence< any >)
+ BookmarkSelection, /// selection are bookmarks? (boolean)
+
+ Component /// component name (XContent)
+ };
+
+ //= ODataAccessDescriptor
+
+ /** class encapsulating the css::sdb::DataAccessDescriptor service.
+ */
+ class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC ODataAccessDescriptor final
+ {
+ std::unique_ptr<ODADescriptorImpl> m_pImpl;
+
+ public:
+ ODataAccessDescriptor();
+ ODataAccessDescriptor( const ODataAccessDescriptor& _rSource );
+ ODataAccessDescriptor(ODataAccessDescriptor&& _rSource) noexcept;
+ ODataAccessDescriptor( const css::uno::Reference< css::beans::XPropertySet >& _rValues );
+ ODataAccessDescriptor( const css::uno::Sequence< css::beans::PropertyValue >& _rValues );
+
+ // allows to construct a descriptor from an Any containing either an XPropertySet or a property value sequence
+ ODataAccessDescriptor( const css::uno::Any& _rValues );
+
+ ODataAccessDescriptor& operator=(const ODataAccessDescriptor& _rSource);
+ ODataAccessDescriptor& operator=(ODataAccessDescriptor&& _rSource) noexcept;
+
+ ~ODataAccessDescriptor();
+
+ /** returns the descriptor as property value sequence
+ <p>If you call this method more than once, without writing any values between both calls, the same object
+ is returned. If you wrote values, a new object is returned.</p>
+ */
+ css::uno::Sequence< css::beans::PropertyValue > const &
+ createPropertyValueSequence();
+
+ /** initialized the descriptor from the property values given
+ The descriptor will clear all its current settings before
+ initializing with the new ones.
+ */
+ void initializeFrom(
+ const css::uno::Sequence< css::beans::PropertyValue >& _rValues);
+
+ /// checks whether or not a given property is present in the descriptor
+ bool has(DataAccessDescriptorProperty _eWhich) const;
+
+ /** erases the given property from the descriptor
+ */
+ void erase(DataAccessDescriptorProperty _eWhich);
+
+ /** empties the descriptor
+ */
+ void clear();
+
+ /// return the value of a given property
+ const css::uno::Any& operator [] ( DataAccessDescriptorProperty _eWhich ) const;
+
+ /** return the (modifiable) value of a given property
+ <p>This operator is not allowed to be called if the descriptor is readonly.</p>
+ */
+ css::uno::Any& operator [] ( DataAccessDescriptorProperty _eWhich );
+
+ /** returns either the data source name if given or the database location
+ */
+ OUString getDataSource() const;
+
+ /** set the data source name, if it is not file URL
+ @param _sDataSourceNameOrLocation
+ the data source name or database location
+ */
+ void setDataSource(const OUString& _sDataSourceNameOrLocation);
+ };
+
+}
+
+#endif // INCLUDED_SVX_DATAACCESSDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/databaselocationinput.hxx b/include/svx/databaselocationinput.hxx
new file mode 100644
index 000000000..edc186b89
--- /dev/null
+++ b/include/svx/databaselocationinput.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DATABASELOCATIONINPUT_HXX
+#define INCLUDED_SVX_DATABASELOCATIONINPUT_HXX
+
+#include <svx/svxdllapi.h>
+#include <rtl/ustring.hxx>
+
+#include <memory>
+
+class SvtURLBox;
+namespace weld { class Button; class Window; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+namespace svx
+{
+ //= DatabaseLocationInputController
+ class DatabaseLocationInputController_Impl;
+ /** helper class to control controls needed to input a database location
+
+ If you allow, in your dialog, to save a database document, then you usually
+ have an URLBox for inputting the actual location, and a push button
+ to browse for a location.
+
+ This helper class controls such two UI elements.
+ */
+ class SAL_WARN_UNUSED SVX_DLLPUBLIC DatabaseLocationInputController
+ {
+ public:
+ DatabaseLocationInputController(
+ const css::uno::Reference<css::uno::XComponentContext>& _rContext,
+ SvtURLBox& _rLocationInput,
+ weld::Button& _rBrowseButton,
+ weld::Window& _rDialog
+ );
+ ~DatabaseLocationInputController();
+
+ /** sets the given URL at the input control, after translating it into a system path
+ */
+ void setURL( const OUString& _rURL );
+
+ /** returns the current database location, in form of a URL (not a system path)
+ */
+ OUString getURL() const;
+
+ /** prepares committing the database location entered in the input field
+
+ Effectively, this method checks whether the file in the location already
+ exists, and if so, it asks the user whether to overwrite it.
+
+ If the method is called multiple times, this check only happens when the location
+ changed since the last call.
+ */
+ bool prepareCommit();
+
+ private:
+ ::std::unique_ptr< DatabaseLocationInputController_Impl >
+ m_pImpl;
+ };
+}
+
+#endif // INCLUDED_SVX_DATABASELOCATIONINPUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/databaseregistrationui.hxx b/include/svx/databaseregistrationui.hxx
new file mode 100644
index 000000000..7cb5f6c55
--- /dev/null
+++ b/include/svx/databaseregistrationui.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DATABASEREGISTRATIONUI_HXX
+#define INCLUDED_SVX_DATABASEREGISTRATIONUI_HXX
+
+#include <svx/svxdllapi.h>
+#include <svl/solar.hrc>
+
+namespace weld { class Window; }
+
+#define SID_SB_POOLING_ENABLED (RID_OFA_START + 247)
+#define SID_SB_DRIVER_TIMEOUTS (RID_OFA_START + 248)
+#define SID_SB_DB_REGISTER (RID_OFA_START + 249)
+
+namespace svx
+{
+ /** opens a dialog which allows the user to administrate the database registrations
+ */
+ sal_uInt16 SVX_DLLPUBLIC administrateDatabaseRegistration( weld::Window* _parentWindow );
+
+}
+
+#endif // INCLUDED_SVX_DATABASEREGISTRATIONUI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/dbaexchange.hxx b/include/svx/dbaexchange.hxx
new file mode 100644
index 000000000..c5a0193b8
--- /dev/null
+++ b/include/svx/dbaexchange.hxx
@@ -0,0 +1,277 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DBAEXCHANGE_HXX
+#define INCLUDED_SVX_DBAEXCHANGE_HXX
+
+#include <sal/config.h>
+
+#include <o3tl/typed_flags_set.hxx>
+#include <vcl/transfer.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <svx/dataaccessdescriptor.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star::sdbc { class XConnection; }
+namespace com::sun::star::beans { class XPropertySet; }
+
+// column transfer formats
+enum class ColumnTransferFormatFlags
+{
+ FIELD_DESCRIPTOR = 0x01, // the field descriptor format
+ CONTROL_EXCHANGE = 0x02, // the control exchange format
+ COLUMN_DESCRIPTOR = 0x04, // data access descriptor for a column
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ColumnTransferFormatFlags> : is_typed_flags<ColumnTransferFormatFlags, 0x07> {};
+}
+
+
+namespace svx
+{
+
+
+ //= OColumnTransferable
+
+ class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC OColumnTransferable final : public TransferDataContainer
+ {
+ public:
+ OColumnTransferable(ColumnTransferFormatFlags nFormats);
+
+ /** construct the transferable from a data access descriptor
+
+ Note that some of the aspects, in particular all which cannot be represented
+ as string, can only be transported via the CTF_COLUMN_DESCRIPTOR format.
+
+ @param rDescriptor
+ The descriptor for the column. It must contain at least
+ <ul><li>information sufficient to create a connection, that is, either one of DataSource, DatabaseLocation,
+ ConnectionResource, and DataAccessDescriptorProperty::Connection</li>
+ <li>a Command</li>
+ <li>a CommandType</li>
+ <li>a ColumnName or ColumnObject</li>
+ </ul>
+ */
+ void setDescriptor(const ODataAccessDescriptor& rDescriptor);
+
+
+ /** construct the transferable from a DatabaseForm component and a field name
+
+ @param _rxForm
+ the form which is bound to the data source which's field is to be dragged
+
+ @param _rFieldName
+ the name of the field to be dragged
+
+ @param _rxColumn
+ the column object. Won't be used if <arg>_nFormats</arg> does not include the CTF_COLUMN_DESCRIPTOR
+ flag.<br/>
+ May be <NULL/>.
+
+ @param _rxConnection
+ the connection the column belongs to. Won't be used if <arg>_nFormats</arg> does not include the CTF_COLUMN_DESCRIPTOR
+ flag.<br/>
+ May be <NULL/>.
+
+ @param _nFormats
+ supported formats. Must be a combination of the CTF_XXX flags
+ */
+ OColumnTransferable(
+ const css::uno::Reference< css::beans::XPropertySet >& _rxForm,
+ const OUString& _rFieldName,
+ const css::uno::Reference< css::beans::XPropertySet >& _rxColumn,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ ColumnTransferFormatFlags _nFormats
+ );
+
+ /** checks whether or not a column descriptor can be extracted from the data flavor vector given
+ @param _rFlavors
+ available flavors
+ @param _nFormats
+ formats to accept
+ */
+ static bool canExtractColumnDescriptor(const DataFlavorExVector& _rFlavors, ColumnTransferFormatFlags _nFormats);
+
+ /** extracts a column descriptor from the transferable given
+ */
+ static bool extractColumnDescriptor(
+ const TransferableDataHelper& _rData
+ ,OUString& _rDatasource
+ ,OUString& _rDatabaseLocation
+ ,OUString& _rConnectionResource
+ ,sal_Int32& _nCommandType
+ ,OUString& _rCommand
+ ,OUString& _rFieldName
+ );
+
+ /** extracts a column descriptor from the transferable given
+ */
+ static ODataAccessDescriptor
+ extractColumnDescriptor(const TransferableDataHelper& _rData);
+
+ private:
+ // TransferableHelper overridables
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+
+ static SotClipboardFormatId getDescriptorFormatId();
+
+ SVX_DLLPRIVATE void implConstruct(
+ const OUString& _rDatasource
+ ,const OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const OUString& _rCommand
+ ,const OUString& _rFieldName
+ );
+
+ ODataAccessDescriptor m_aDescriptor;
+ OUString m_sCompatibleFormat;
+ ColumnTransferFormatFlags m_nFormatFlags;
+ };
+
+
+ //= ODataAccessObjectTransferable
+
+ /** class for transferring data access objects (tables, queries, statements ...)
+ */
+ class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC ODataAccessObjectTransferable : public TransferDataContainer
+ {
+ ODataAccessDescriptor m_aDescriptor;
+ OUString m_sCompatibleObjectDescription;
+ // needed to provide a SotClipboardFormatId::SBA_DATAEXCHANGE format
+
+ public:
+ /** should be used copying and the connection is needed.
+ @param _rDatasource
+ The data source name.
+ @param _nCommandType
+ The kind of command. @see com.sun.star.sdbc.CommandType
+ @param _rCommand
+ The command, either a name of a table or query or a SQL statement.
+ */
+ void Update(
+ const OUString& _rDatasource,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
+ );
+
+ /** should be used when copying a query object and no connection is available.
+ @param _rDatasource
+ The data source name.
+ @param _nCommandType
+ The kind of command. @see com.sun.star.sdbc.CommandType
+ @param _rCommand
+ The command, either a name of a table or query or a SQL statement.
+ */
+ void Update(
+ const OUString& _rDatasource,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand
+ );
+
+ /** with this ctor, only the object descriptor format will be provided
+ */
+ ODataAccessObjectTransferable(
+ const css::uno::Reference< css::beans::XPropertySet >& _rxLivingForm
+ );
+
+ ODataAccessObjectTransferable();
+
+ /** checks whether or not an object descriptor can be extracted from the data flavor vector given
+ @param _rFlavors
+ available flavors
+ @param _nFormats
+ formats to accept
+ */
+ static bool canExtractObjectDescriptor(const DataFlavorExVector& _rFlavors);
+
+ /** extracts an object descriptor from the transferable given
+ */
+ static ODataAccessDescriptor
+ extractObjectDescriptor(const TransferableDataHelper& _rData);
+
+ protected:
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+ virtual void ObjectReleased() override;
+
+ protected:
+ const ODataAccessDescriptor& getDescriptor() const { return m_aDescriptor; }
+ ODataAccessDescriptor& getDescriptor() { return m_aDescriptor; }
+ protected:
+ void addCompatibleSelectionDescription(
+ const css::uno::Sequence< css::uno::Any >& _rSelRows
+ );
+ // normally, a derived class could simply access getDescriptor[DataAccessDescriptorProperty::Selection] and place the sequence therein
+ // but unfortunately, we have this damned compatible format, and this can't be accessed in
+ // derived classes (our class is the only one which should be contaminated with this)
+
+ private:
+ SVX_DLLPRIVATE void construct( const OUString& _rDatasourceOrLocation
+ ,const OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const OUString& _rCommand
+ ,const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
+ ,bool _bAddCommand
+ ,const OUString& _sActiveCommand);
+ };
+
+
+ //= OMultiColumnTransferable
+
+ /** class for transferring multiple columns
+ */
+ class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC OMultiColumnTransferable final : public TransferDataContainer
+ {
+ public:
+ OMultiColumnTransferable();
+
+ void setDescriptors(const css::uno::Sequence< css::beans::PropertyValue >& rDescriptors);
+
+ /** checks whether or not an object descriptor can be extracted from the data flavor vector given
+ @param _rFlavors
+ available flavors
+ @param _nFormats
+ formats to accept
+ */
+ static bool canExtractDescriptor(const DataFlavorExVector& _rFlavors);
+
+ /** extracts an object descriptor from the transferable given
+ */
+ static css::uno::Sequence< css::beans::PropertyValue > extractDescriptor(const TransferableDataHelper& _rData);
+
+ private:
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+ virtual void ObjectReleased() override;
+ static SotClipboardFormatId getDescriptorFormatId();
+
+ css::uno::Sequence< css::beans::PropertyValue > m_aDescriptors;
+ };
+
+
+}
+
+
+#endif // INCLUDED_SVX_DBAEXCHANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/dbaobjectex.hxx b/include/svx/dbaobjectex.hxx
new file mode 100644
index 000000000..2a0d243cc
--- /dev/null
+++ b/include/svx/dbaobjectex.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DBAOBJECTEX_HXX
+#define INCLUDED_SVX_DBAOBJECTEX_HXX
+
+#include <vcl/transfer.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star::ucb { class XContent; }
+
+namespace svx
+{
+ //= OComponentTransferable
+ class SAL_WARN_UNUSED SVX_DLLPUBLIC OComponentTransferable final : public TransferDataContainer
+ {
+ public:
+ OComponentTransferable();
+
+ void Update(
+ const OUString& rDatasourceOrLocation,
+ const css::uno::Reference< css::ucb::XContent>& xContent
+ );
+
+ /** checks whether or not a component descriptor can be extracted from the data flavor vector given
+ @param _rFlavors
+ available flavors
+ */
+ static bool canExtractComponentDescriptor(const DataFlavorExVector& _rFlavors, bool _bForm );
+
+ /** extracts a component descriptor from the transferable given
+ */
+ static ODataAccessDescriptor
+ extractComponentDescriptor(const TransferableDataHelper& _rData);
+
+ private:
+ // TransferableHelper overridables
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+
+ static SotClipboardFormatId getDescriptorFormatId(bool _bExtractForm);
+
+ ODataAccessDescriptor m_aDescriptor;
+ };
+}
+
+#endif // INCLUDED_SVX_DBAOBJECTEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/def3d.hxx b/include/svx/def3d.hxx
new file mode 100644
index 000000000..37770602d
--- /dev/null
+++ b/include/svx/def3d.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DEF3D_HXX
+#define INCLUDED_SVX_DEF3D_HXX
+
+#include <o3tl/typed_flags_set.hxx>
+
+// 3D helper functions
+
+enum class E3dDragConstraint
+{
+ X = 0x0001,
+ Y = 0x0002,
+ Z = 0x0004,
+ XYZ = X | Y | Z
+};
+namespace o3tl
+{
+template <> struct typed_flags<E3dDragConstraint> : is_typed_flags<E3dDragConstraint, 0x7>
+{
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/deflt3d.hxx b/include/svx/deflt3d.hxx
new file mode 100644
index 000000000..f3312afd5
--- /dev/null
+++ b/include/svx/deflt3d.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DEFLT3D_HXX
+#define INCLUDED_SVX_DEFLT3D_HXX
+
+#include <config_options.h>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* Class for managing the 3D default attributes
+|*
+\************************************************************************/
+
+class SAL_WARN_UNUSED UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) E3dDefaultAttributes
+{
+private:
+ // Cube object
+ basegfx::B3DPoint aDefaultCubePos;
+ basegfx::B3DVector aDefaultCubeSize;
+ bool bDefaultCubePosIsCenter;
+
+ // Sphere object
+ basegfx::B3DPoint aDefaultSphereCenter;
+ basegfx::B3DVector aDefaultSphereSize;
+
+ // Lathe object
+ bool bDefaultLatheSmoothed;
+ bool bDefaultLatheSmoothFrontBack;
+ bool bDefaultLatheCharacterMode;
+ bool bDefaultLatheCloseFront;
+ bool bDefaultLatheCloseBack;
+
+ // Extrude object
+ bool bDefaultExtrudeSmoothed;
+ bool bDefaultExtrudeSmoothFrontBack;
+ bool bDefaultExtrudeCharacterMode;
+ bool bDefaultExtrudeCloseFront;
+ bool bDefaultExtrudeCloseBack;
+
+public:
+ // Constructor
+ E3dDefaultAttributes();
+
+ // Reset to defaults
+ void Reset();
+
+ // Cube object
+ const basegfx::B3DPoint& GetDefaultCubePos() const { return aDefaultCubePos; }
+ const basegfx::B3DVector& GetDefaultCubeSize() const { return aDefaultCubeSize; }
+ bool GetDefaultCubePosIsCenter() const { return bDefaultCubePosIsCenter; }
+
+ // Sphere object
+ const basegfx::B3DPoint& GetDefaultSphereCenter() const { return aDefaultSphereCenter; }
+ const basegfx::B3DVector& GetDefaultSphereSize() const { return aDefaultSphereSize; }
+
+ // Lathe object
+ bool GetDefaultLatheSmoothed() const { return bDefaultLatheSmoothed; }
+ bool GetDefaultLatheSmoothFrontBack() const { return bDefaultLatheSmoothFrontBack; }
+ bool GetDefaultLatheCharacterMode() const { return bDefaultLatheCharacterMode; }
+ void SetDefaultLatheCharacterMode(const bool bNew) { bDefaultLatheCharacterMode = bNew; }
+ bool GetDefaultLatheCloseFront() const { return bDefaultLatheCloseFront; }
+ bool GetDefaultLatheCloseBack() const { return bDefaultLatheCloseBack; }
+
+ // Extrude object
+ bool GetDefaultExtrudeSmoothed() const { return bDefaultExtrudeSmoothed; }
+ bool GetDefaultExtrudeSmoothFrontBack() const { return bDefaultExtrudeSmoothFrontBack; }
+ bool GetDefaultExtrudeCharacterMode() const { return bDefaultExtrudeCharacterMode; }
+ void SetDefaultExtrudeCharacterMode(const bool bNew) { bDefaultExtrudeCharacterMode = bNew; }
+ bool GetDefaultExtrudeCloseFront() const { return bDefaultExtrudeCloseFront; }
+ void SetDefaultExtrudeCloseFront(const bool bNew) { bDefaultExtrudeCloseFront = bNew; }
+ bool GetDefaultExtrudeCloseBack() const { return bDefaultExtrudeCloseBack; }
+ void SetDefaultExtrudeCloseBack(const bool bNew) { bDefaultExtrudeCloseBack = bNew; }
+};
+
+#endif // INCLUDED_SVX_DEFLT3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/diagram/IDiagramHelper.hxx b/include/svx/diagram/IDiagramHelper.hxx
new file mode 100644
index 000000000..e93056f70
--- /dev/null
+++ b/include/svx/diagram/IDiagramHelper.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vector>
+#include <svx/svxdllapi.h>
+#include <rtl/ustring.hxx>
+#include <svx/svdhdl.hxx>
+
+// Forward declarations
+class SdrObjGroup;
+class SdrHdlList;
+
+namespace svx { namespace diagram {
+
+// Helper class to visualize an imminently recognizable
+// additional visualization for DynamicDiagrams that can also
+// be used to show/hide the DiagramDialog by the user
+// Note: is also used as additional drag/move handle
+class SVXCORE_DLLPUBLIC DiagramFrameHdl final : public SdrHdl
+{
+ // object dimensions
+ basegfx::B2DHomMatrix maTransformation;
+
+ // create marker for this kind
+ virtual void CreateB2dIAObject() override;
+
+public:
+ DiagramFrameHdl(const basegfx::B2DHomMatrix& rTransformation);
+
+ static void clicked(const Point& rPnt);
+};
+
+class DiagramDataState;
+
+// Helper class to allow administer advanced Diagram related
+// data and functionality
+class SVXCORE_DLLPUBLIC IDiagramHelper
+{
+private:
+ // These values define behaviour to where take data from at re-creation time.
+ // Different definitions will have different consequences for re-creation
+ // of Diagram visualization (if needed/triggered).
+ // The style attributes per shape e.g. can be re-stored frm either an
+ // existing Theme, or the preserved key/value list of properties per XShape.
+ // With the current default settings the re-creation uses the preserved
+ // key/value pairs, but re-creation from Theme may also be desirable. It
+ // is also good to preserve both data packages at initial import to allow
+ // alternatively one of these two methods for re-construction
+
+ // If true, the oox::Theme data from ::DiagramData get/set/ThemeDocument()
+ // aka mxThemeDocument - if it exists - will be used to create the style
+ // attributes for the to-be-created XShapes (theoretically allows re-creation
+ // with other Theme)
+ bool mbUseDiagramThemeData; // false
+
+ // If true, the UNO API form of attributes per Point as Key/value list
+ // that was secured after initial XShape creation is used to create the
+ // style attributes for the to-be-created XShapes
+ bool mbUseDiagramModelData; // true
+
+ // If true and mxThemeDocument exists it will be re-imported to
+ // a newly created oox::drawingml::Theme object
+ bool mbForceThemePtrRecreation; // false
+
+protected:
+ void anchorToSdrObjGroup(SdrObjGroup& rTarget);
+
+public:
+ IDiagramHelper();
+ virtual ~IDiagramHelper();
+
+ // re-create XShapes
+ virtual void reLayout(SdrObjGroup& rTarget) = 0;
+
+ // get text representation of data tree
+ virtual OUString getString() const = 0;
+
+ // get children of provided data node
+ // use empty string for top-level nodes
+ // returns vector of (id, text)
+ virtual std::vector<std::pair<OUString, OUString>>
+ getChildren(const OUString& rParentId) const = 0;
+
+ // add/remove new top-level node to data model, returns its id
+ virtual OUString addNode(const OUString& rText) = 0;
+ virtual bool removeNode(const OUString& rNodeId) = 0;
+
+ // Undo/Redo helpers for extracting/restoring Diagram-defining data
+ virtual std::shared_ptr<svx::diagram::DiagramDataState> extractDiagramDataState() const = 0;
+ virtual void applyDiagramDataState(const std::shared_ptr<svx::diagram::DiagramDataState>& rState) = 0;
+
+ bool UseDiagramThemeData() const { return mbUseDiagramThemeData; }
+ bool UseDiagramModelData() const { return mbUseDiagramModelData; }
+ bool ForceThemePtrRecreation() const { return mbForceThemePtrRecreation; };
+
+ static void AddAdditionalVisualization(const SdrObjGroup& rTarget, SdrHdlList& rHdlList);
+};
+
+}} // end of namespace
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/diagram/datamodel.hxx b/include/svx/diagram/datamodel.hxx
new file mode 100644
index 000000000..850cd8f78
--- /dev/null
+++ b/include/svx/diagram/datamodel.hxx
@@ -0,0 +1,274 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DIAGRAM_DATAMODEL_HXX
+#define INCLUDED_SVX_DIAGRAM_DATAMODEL_HXX
+
+#include <vector>
+#include <optional>
+#include <map>
+
+#include <svx/svxdllapi.h>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+
+namespace svx::diagram {
+
+enum TypeConstant {
+ XML_none = 0,
+ XML_type = 395,
+ XML_asst = 680,
+ XML_doc = 1924,
+ XML_node = 3596,
+ XML_norm = 3609,
+ XML_parOf = 3878,
+ XML_parTrans = 3879,
+ XML_pres = 4085,
+ XML_presOf = 4090,
+ XML_presParOf = 4091,
+ XML_rel = 4298,
+ XML_sibTrans = 4746,
+};
+
+/** A Connection
+ */
+struct SVXCORE_DLLPUBLIC Connection
+{
+ Connection();
+
+ TypeConstant mnXMLType;
+ OUString msModelId;
+ OUString msSourceId;
+ OUString msDestId;
+ OUString msParTransId;
+ OUString msPresId;
+ OUString msSibTransId;
+ sal_Int32 mnSourceOrder;
+ sal_Int32 mnDestOrder;
+
+};
+
+typedef std::vector< Connection > Connections;
+
+/** Text and properties for a point
+ * For proof of concept to make TextData available in svx level this
+ * is in a first run pretty simple, but may need to be extended accordingly
+ * up to similar data as in oox::drawingml::TextBody.
+ */
+struct SVXCORE_DLLPUBLIC TextBody
+{
+ // text from 1st paragraph (1st run)
+ OUString msText;
+
+ // attributes from TextBody::getTextProperties()
+ std::vector< std::pair< OUString, css::uno::Any >> maTextProps;
+};
+
+typedef std::shared_ptr< TextBody > TextBodyPtr;
+
+/** Styles for a Point (FillStyle/LineStyle/...)
+ */
+struct SVXCORE_DLLPUBLIC PointStyle
+{
+ // attributes (LineStyle/FillStyle/...)
+ std::vector< std::pair< OUString, css::uno::Any >> maProperties;
+};
+
+typedef std::shared_ptr< PointStyle > PointStylePtr;
+
+/** A point
+ */
+struct SVXCORE_DLLPUBLIC Point
+{
+ Point();
+
+ // The minimal text data from the imported Diagram
+ // in source format
+ TextBodyPtr msTextBody;
+
+ // The property sequence of pairs<OUString, css::uno::Any>,
+ // interpreted & assigned by the ::addShape(s) creators in the
+ // import filter that created a XShape associated/based on this entry
+ PointStylePtr msPointStylePtr;
+
+ OUString msCnxId;
+ OUString msModelId;
+ OUString msColorTransformCategoryId;
+ OUString msColorTransformTypeId;
+ OUString msLayoutCategoryId;
+ OUString msLayoutTypeId;
+ OUString msPlaceholderText;
+ OUString msPresentationAssociationId;
+ OUString msPresentationLayoutName;
+ OUString msPresentationLayoutStyleLabel;
+ OUString msQuickStyleCategoryId;
+ OUString msQuickStyleTypeId;
+
+ TypeConstant mnXMLType;
+ sal_Int32 mnMaxChildren;
+ sal_Int32 mnPreferredChildren;
+ sal_Int32 mnDirection;
+ std::optional<sal_Int32> moHierarchyBranch;
+ sal_Int32 mnResizeHandles;
+ sal_Int32 mnCustomAngle;
+ sal_Int32 mnPercentageNeighbourWidth;
+ sal_Int32 mnPercentageNeighbourHeight;
+ sal_Int32 mnPercentageOwnWidth;
+ sal_Int32 mnPercentageOwnHeight;
+ sal_Int32 mnIncludeAngleScale;
+ sal_Int32 mnRadiusScale;
+ sal_Int32 mnWidthScale;
+ sal_Int32 mnHeightScale;
+ sal_Int32 mnWidthOverride;
+ sal_Int32 mnHeightOverride;
+ sal_Int32 mnLayoutStyleCount;
+ sal_Int32 mnLayoutStyleIndex;
+
+ bool mbOrgChartEnabled;
+ bool mbBulletEnabled;
+ bool mbCoherent3DOffset;
+ bool mbCustomHorizontalFlip;
+ bool mbCustomVerticalFlip;
+ bool mbCustomText;
+ bool mbIsPlaceholder;
+};
+
+typedef std::vector< Point > Points;
+
+/** Snippet of Diagram ModelData for Diagram-defining data undo/redo
+ */
+class SVXCORE_DLLPUBLIC DiagramDataState
+{
+ Connections maConnections;
+ Points maPoints;
+
+public:
+ DiagramDataState(const Connections& rConnections, const Points& rPoints);
+
+ Connections& getConnections() { return maConnections; }
+ Points& getPoints() { return maPoints; }
+};
+
+typedef std::shared_ptr< DiagramDataState > DiagramDataStatePtr;
+
+/** The collected Diagram ModelData
+ */
+class SVXCORE_DLLPUBLIC DiagramData
+{
+public:
+ typedef std::map< OUString, Point* > PointNameMap;
+ typedef std::map< OUString, std::vector< Point* > > PointsNameMap;
+ typedef std::map< OUString, const Connection* > ConnectionNameMap;
+
+ struct SourceIdAndDepth
+ {
+ OUString msSourceId;
+ sal_Int32 mnDepth = 0;
+ };
+
+ /// Tracks connections: destination id -> {destination order, details} map.
+ typedef std::map< OUString, std::map<sal_Int32, SourceIdAndDepth > > StringMap;
+
+protected:
+ // Make constructor protected to signal that this anyway pure virtual class
+ // shall not be incarnated - target to use is oox::drawingml::DiagramData
+ DiagramData();
+
+public:
+ virtual ~DiagramData();
+
+ // creates temporary processing data from model data
+ virtual void buildDiagramDataModel(bool bClearOoxShapes);
+
+ // dump to readable format
+ virtual void dump() const = 0;
+
+ // read accesses
+ Connections& getConnections() { return maConnections; }
+ Points& getPoints() { return maPoints; }
+ StringMap& getPresOfNameMap() { return maPresOfNameMap; }
+ PointNameMap& getPointNameMap() { return maPointNameMap; }
+ PointsNameMap& getPointsPresNameMap() { return maPointsPresNameMap; }
+ ::std::vector<OUString>& getExtDrawings() { return maExtDrawings; }
+ const Point* getRootPoint() const;
+ OUString getString() const;
+ std::vector<std::pair<OUString, OUString>> getChildren(const OUString& rParentId) const;
+
+ const css::uno::Reference< css::xml::dom::XDocument >& getThemeDocument() const { return mxThemeDocument; }
+ void setThemeDocument( const css::uno::Reference< css::xml::dom::XDocument >& xRef ) { mxThemeDocument = xRef; }
+
+ const OUString& getBackgroundShapeModelID() const { return msBackgroundShapeModelID; }
+ void setBackgroundShapeModelID( const OUString& rModelID ) { msBackgroundShapeModelID = rModelID; }
+
+ // model modifiers
+ OUString addNode(const OUString& rText);
+ bool removeNode(const OUString& rNodeId);
+
+ // Undo/Redo helpers to extract/restore Diagram-defining data
+ DiagramDataStatePtr extractDiagramDataState() const;
+ void applyDiagramDataState(const DiagramDataStatePtr& rState);
+
+protected:
+ // helpers
+ void getChildrenString(OUStringBuffer& rBuf, const Point* pPoint, sal_Int32 nLevel) const;
+ void addConnection(TypeConstant nType, const OUString& sSourceId, const OUString& sDestId);
+
+ // evtl. existing alternative imported visualization identifier
+ ::std::vector<OUString> maExtDrawings;
+
+ // The model definition, the parts available in svx.
+ // See evtl. parts in oox::drawingml::DiagramData that may need t obe accessed
+ // - logic connections/associations
+ Connections maConnections;
+
+ // - data point entries
+ Points maPoints;
+
+ // - style for the BackgroundShape (if used)
+ // this is the property sequence of pairs<OUString, css::uno::Any>,
+ // as interpreted & assigned by the ::addShape(s) creators in the
+ // import filter
+ PointStylePtr maBackgroundShapeStyle;
+
+ // - Theme definition as css::xml::dom::XDocument
+ // Note: I decided to use dom::XDocument which is already in use, instead of a
+ // temp file what is also possible (implemented that for POC) but would
+ // need to be created in PresentationFragmentHandler::importSlide. If
+ // this needs to be written to a File, please refer to
+ // fileDocxExport::WriteTheme(), look for "OOXTheme"
+ css::uno::Reference< css::xml::dom::XDocument > mxThemeDocument;
+
+ // temporary processing data, partially deleted when using build()
+ PointNameMap maPointNameMap;
+ PointsNameMap maPointsPresNameMap;
+ ConnectionNameMap maConnectionNameMap;
+ StringMap maPresOfNameMap;
+ OUString msBackgroundShapeModelID;
+};
+
+typedef std::shared_ptr< DiagramData > DiagramDataPtr;
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/dialcontrol.hxx b/include/svx/dialcontrol.hxx
new file mode 100644
index 000000000..8fafb3fc0
--- /dev/null
+++ b/include/svx/dialcontrol.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DIALCONTROL_HXX
+#define INCLUDED_SVX_DIALCONTROL_HXX
+
+#include <memory>
+#include <vcl/customweld.hxx>
+#include <vcl/virdev.hxx>
+#include <svx/svxdllapi.h>
+
+class Edit;
+
+namespace svx {
+
+
+class SAL_WARN_UNUSED DialControlBmp final : public VirtualDevice
+{
+public:
+ explicit DialControlBmp(OutputDevice& rReference);
+
+ void InitBitmap(const vcl::Font& rFont);
+ void SetSize(const Size& rSize);
+ void CopyBackground( const DialControlBmp& rSrc );
+ void DrawBackground( const Size& rSize, bool bEnabled );
+ void DrawBackground();
+ void DrawElements( const OUString& rText, Degree100 nAngle );
+ Color GetBackgroundColor() const override;
+
+private:
+ const Color& GetTextColor() const;
+ const Color& GetScaleLineColor() const;
+ const Color& GetButtonLineColor() const;
+ const Color& GetButtonFillColor( bool bMain ) const;
+
+ void Init();
+
+ tools::Rectangle maRect;
+ bool mbEnabled;
+ OutputDevice& mrParent;
+ tools::Long mnCenterX;
+ tools::Long mnCenterY;
+};
+
+/** This control allows to input a rotation angle, visualized by a dial.
+
+ Usage: A single click sets a rotation angle rounded to steps of 15 degrees.
+ Dragging with the left mouse button sets an exact rotation angle. Pressing
+ the ESCAPE key during mouse drag cancels the operation and restores the old
+ state of the control.
+
+ It is possible to link a numeric field to this control using the function
+ SetLinkedField(). The DialControl will take full control of this numeric
+ field:
+ - Sets the rotation angle to the numeric field in mouse operations.
+ - Shows the value entered/modified in the numeric field.
+ - Enables/disables/shows/hides the field according to own state changes.
+ */
+class SAL_WARN_UNUSED SVX_DLLPUBLIC DialControl final : public weld::CustomWidgetController
+{
+public:
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+
+ virtual void StyleUpdated() override;
+
+ virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual bool MouseMove( const MouseEvent& rMEvt ) override;
+ virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual bool KeyInput(const KeyEvent& rKEvt) override;
+ virtual void LoseFocus() override;
+
+ virtual void Resize() override;
+
+ /** Returns the current rotation angle in 1/100 degrees. */
+ Degree100 GetRotation() const;
+ /** Sets the rotation to the passed value (in 1/100 degrees). */
+ void SetRotation( Degree100 nAngle );
+ /** Returns true, if the control is not in "don't care" state. */
+ bool HasRotation() const;
+ /** Sets the control to "don't care" state. */
+ void SetNoRotation();
+
+ /** Links the passed numeric edit field to the control (bi-directional).
+ * nDecimalPlaces:
+ * field value is unsign given decimal places
+ * default is 0 which means field values are in degrees,
+ * 2 means 100th of degree
+ */
+ void SetLinkedField(weld::MetricSpinButton* pField, sal_Int32 nDecimalPlaces = 0);
+
+ /** Save value for later comparison */
+ void SaveValue();
+
+ /** Compare value with the saved value */
+ bool IsValueModified() const;
+
+ const OUString& GetText() const { return mpImpl->maText; }
+ void SetText(const OUString& rText) { mpImpl->maText = rText; }
+
+ void SetModifyHdl( const Link<DialControl&,void>& rLink );
+
+ void Init( const Size& rWinSize );
+
+ void set_visible(bool bVisible)
+ {
+ if (bVisible)
+ Show();
+ else
+ Hide();
+ }
+private:
+ struct SAL_DLLPRIVATE DialControl_Impl
+ {
+ ScopedVclPtr<DialControlBmp> mxBmpEnabled;
+ ScopedVclPtr<DialControlBmp> mxBmpDisabled;
+ ScopedVclPtr<DialControlBmp> mxBmpBuffered;
+ Link<DialControl&,void> maModifyHdl;
+ OUString maText;
+ weld::MetricSpinButton* mpLinkField;
+ sal_Int32 mnLinkedFieldValueMultiplyer;
+ Size maWinSize;
+ vcl::Font maWinFont;
+ Degree100 mnAngle;
+ Degree100 mnInitialAngle;
+ Degree100 mnOldAngle;
+ tools::Long mnCenterX;
+ tools::Long mnCenterY;
+ bool mbNoRot;
+
+ explicit DialControl_Impl(OutputDevice& rReference);
+ void Init( const Size& rWinSize, const vcl::Font& rWinFont );
+ void SetSize( const Size& rWinSize );
+ };
+ std::unique_ptr< DialControl_Impl > mpImpl;
+
+ void HandleMouseEvent( const Point& rPos, bool bInitial );
+ void HandleEscapeEvent();
+
+ void SetRotation( Degree100 nAngle, bool bBroadcast );
+
+ void Init( const Size& rWinSize, const vcl::Font& rWinFont );
+
+ void InvalidateControl();
+
+ DECL_DLLPRIVATE_LINK(LinkedFieldModifyHdl, weld::MetricSpinButton&, void);
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/dialmgr.hxx b/include/svx/dialmgr.hxx
new file mode 100644
index 000000000..34681a510
--- /dev/null
+++ b/include/svx/dialmgr.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_DIALMGR_HXX
+#define INCLUDED_SVX_DIALMGR_HXX
+
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+#include <unotools/resmgr.hxx>
+
+SVXCORE_DLLPUBLIC std::locale SvxResLocale();
+SVXCORE_DLLPUBLIC OUString SvxResId(TranslateId aId);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
new file mode 100644
index 000000000..d3d7f6d8b
--- /dev/null
+++ b/include/svx/dialogs.hrc
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DIALOGS_HRC
+#define INCLUDED_SVX_DIALOGS_HRC
+
+#include <svl/solar.hrc>
+
+// factory IDs of tabpages implemented in CUI
+#define RID_SVXPAGE_CHAR_TWOLINES (RID_SVX_START + 242)
+#define RID_SVXPAGE_EXT_PARAGRAPH (RID_SVX_START + 7)
+#define RID_SVXPAGE_GRFCROP (RID_SVX_START + 238)
+#define RID_SVXPAGE_CHAR_NAME (RID_SVX_START + 239)
+#define RID_SVXPAGE_CHAR_EFFECTS (RID_SVX_START + 240)
+#define RID_SVXPAGE_CHAR_POSITION (RID_SVX_START + 241)
+#define RID_SVXPAGE_STD_PARAGRAPH (RID_SVX_START + 6)
+#define RID_SVXPAGE_ALIGN_PARAGRAPH (RID_SVX_START + 187)
+#define RID_SVXPAGE_PARA_ASIAN (RID_SVX_START + 245)
+#define RID_SVXPAGE_TABULATOR (RID_SVX_START + 2)
+#define RID_SFXPAGE_DBREGISTER (RID_OFA_START + 123)
+#define RID_SVXPAGE_NUMBERFORMAT (RID_SVX_START + 41)
+#define RID_SVXPAGE_ALIGNMENT (RID_SVX_START + 90)
+#define RID_SVXPAGE_BORDER (RID_SVX_START + 5)
+#define RID_SVXPAGE_PAGE (RID_SVX_START + 25)
+#define RID_SVXPAGE_LINE (RID_SVX_START + 51)
+#define RID_SVXPAGE_AREA (RID_SVX_START + 56)
+#define RID_SVXPAGE_BKG (RID_SVX_START + 57)
+#define RID_SVXPAGE_SHADOW (RID_SVX_START + 61)
+#define RID_SVXPAGE_TRANSPARENCE (RID_SVX_START + 54)
+#define RID_SVXPAGE_THEME (RID_SVX_START + 55)
+#define RID_SVXPAGE_TEXTATTR (RID_SVX_START + 153)
+#define RID_SVXPAGE_TEXTANIMATION (RID_SVX_START + 184)
+#define RID_SVXPAGE_TEXTCOLUMNS (RID_SVX_START + 154)
+#define RID_SVXPAGE_MEASURE (RID_SVX_START + 161)
+#define RID_SVXPAGE_CONNECTION (RID_SVX_START + 191)
+#define RID_SVXPAGE_LINE_DEF (RID_SVX_START + 52)
+#define RID_SVXPAGE_LINEEND_DEF (RID_SVX_START + 53)
+#define RID_SVXPAGE_NUM_OPTIONS (RID_SVX_START + 219)
+#define RID_SVXPAGE_NUM_POSITION (RID_SVX_START + 220)
+#define RID_SVXPAGE_PICK_SINGLE_NUM (RID_SVX_START + 215)
+#define RID_SVXPAGE_PICK_BULLET (RID_SVX_START + 216)
+#define RID_SVXPAGE_PICK_NUM (RID_SVX_START + 217)
+#define RID_SVXPAGE_PICK_BMP (RID_SVX_START + 218)
+#define RID_SVXPAGE_MACROASSIGN (RID_SVX_START + 296)
+
+// ID of tabpages implemented in SVX, but used in CUI
+#define RID_SVXPAGE_GRID (RID_SVX_START + 152)
+
+// IDs of options pages of applications
+#define RID_SW_TP_MAILCONFIG (RID_OFA_START + 102)
+#define RID_SW_TP_STD_FONT_CJK (RID_OFA_START + 247)
+#define RID_SW_TP_STD_FONT_CTL (RID_OFA_START + 251)
+#define RID_SW_TP_OPTLOAD_PAGE (RID_OFA_START + 214)
+#define RID_SW_TP_CONTENT_OPT (RID_OFA_START + 206)
+#define RID_SW_TP_OPTSHDWCRSR (RID_OFA_START + 211)
+#define RID_SW_TP_STD_FONT (RID_OFA_START + 208)
+#define RID_SW_TP_OPTPRINT_PAGE (RID_OFA_START + 209)
+#define RID_SW_TP_OPTTABLE_PAGE (RID_OFA_START + 210)
+#define RID_SW_TP_REDLINE_OPT (RID_OFA_START + 212)
+#define RID_SW_TP_DOC_STAT (RID_OFA_START + 252)
+#define RID_SW_TP_OPTCOMPATIBILITY_PAGE (RID_OFA_START + 255)
+#define RID_SW_TP_COMPARISON_OPT (RID_OFA_START + 257)
+#define RID_SW_TP_HTML_CONTENT_OPT (RID_OFA_START + 240)
+#define RID_SW_TP_HTML_OPTPRINT_PAGE (RID_OFA_START + 242)
+#define RID_SW_TP_HTML_OPTTABLE_PAGE (RID_OFA_START + 243)
+#define RID_SW_TP_HTML_OPTGRID_PAGE (RID_OFA_START + 244)
+#define RID_SW_TP_HTML_OPTSHDWCRSR (RID_OFA_START + 246)
+#define RID_SW_TP_BACKGROUND (RID_OFA_START + 217)
+#define RID_SW_TP_OPTCAPTION_PAGE (RID_OFA_START + 256)
+#define SID_SC_TP_LAYOUT (RID_OFA_START + 218)
+#define SID_SC_TP_CONTENT (RID_OFA_START + 219)
+#define SID_SC_TP_GRID (RID_OFA_START + 221)
+#define SID_SC_TP_USERLISTS (RID_OFA_START + 222)
+#define SID_SC_TP_CALC (RID_OFA_START + 223)
+#define SID_SC_TP_CHANGES (RID_OFA_START + 224)
+#define RID_SC_TP_PRINT (RID_OFA_START + 248)
+#define SID_SI_TP_PRINT (RID_OFA_START + 236)
+#define SID_SI_TP_CONTENTS (RID_OFA_START + 232)
+#define SID_SI_TP_SNAP (RID_OFA_START + 234)
+#define SID_SI_TP_MISC (RID_OFA_START + 237)
+#define SID_SD_TP_PRINT (RID_OFA_START + 220)
+#define SID_SD_TP_CONTENTS (RID_OFA_START + 225)
+#define SID_SD_TP_SNAP (RID_OFA_START + 227)
+#define SID_SD_TP_MISC (RID_OFA_START + 231)
+#define RID_SC_TP_DEFAULTS (RID_OFA_START + 253)
+#define SID_SC_TP_STAT (RID_OFA_START + 254)
+
+// if we have _a_lot_ time, we should group the resource ids by type, instead
+// of grouping them by semantics. The reason is that resource ids have to be
+// unique relative to a fixed type (you can't have two dialogs with the same
+// resource id), but they do not need to be unique globally (means you can have
+// a dialog and a string, both with the same id)
+// I suggest sticking to per-type ids instead of per-semantic ids, this is
+// better maintainable (IMO), and does not waste that much ids
+
+// "ModalDialog" resource ids
+
+// TabPages --------------------------------------------------------------
+
+#define RID_SW_TP_OPTTEST_PAGE (RID_OFA_START + 215)
+#define SID_SC_TP_FORMULA (RID_OFA_START + 259)
+#define SID_SC_TP_COMPATIBILITY (RID_OFA_START + 260)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/dlgctl3d.hxx b/include/svx/dlgctl3d.hxx
new file mode 100644
index 000000000..afa246b16
--- /dev/null
+++ b/include/svx/dlgctl3d.hxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DLGCTL3D_HXX
+#define INCLUDED_SVX_DLGCTL3D_HXX
+
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svxdllapi.h>
+#include <basegfx/vector/b3dvector.hxx>
+#include <memory>
+
+class FmFormModel;
+class FmFormPage;
+class E3dView;
+class E3dObject;
+class E3dScene;
+
+enum class SvxPreviewObjectType { SPHERE, CUBE };
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC Svx3DPreviewControl : public weld::CustomWidgetController
+{
+protected:
+ std::unique_ptr<FmFormModel> mpModel;
+ rtl::Reference<FmFormPage> mxFmPage;
+ std::unique_ptr<E3dView> mp3DView;
+ E3dScene* mpScene;
+ E3dObject* mp3DObj;
+ SvxPreviewObjectType mnObjectType;
+
+ void Construct();
+
+public:
+ Svx3DPreviewControl();
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual ~Svx3DPreviewControl() override;
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void Resize() override;
+
+ virtual void SetObjectType(SvxPreviewObjectType nType);
+ SvxPreviewObjectType GetObjectType() const { return mnObjectType; }
+ SfxItemSet const & Get3DAttributes() const;
+ virtual void Set3DAttributes(const SfxItemSet& rAttr);
+};
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC Svx3DLightControl final : public Svx3DPreviewControl
+{
+ // Callback for interactive changes
+ Link<Svx3DLightControl*,void> maChangeCallback;
+ Link<Svx3DLightControl*,void> maSelectionChangeCallback;
+
+ // lights
+ sal_uInt32 maSelectedLight;
+
+ // extra objects for light control
+ E3dObject* mpExpansionObject;
+ E3dObject* mpLampBottomObject;
+ E3dObject* mpLampShaftObject;
+ std::vector< E3dObject* > maLightObjects;
+
+ // 3d rotations of object
+ double mfRotateX;
+ double mfRotateY;
+ double mfRotateZ;
+
+ // interaction parameters
+ Point maActionStartPoint;
+ double mfSaveActionStartHor;
+ double mfSaveActionStartVer;
+ double mfSaveActionStartRotZ;
+
+ bool mbMouseMoved : 1;
+ bool mbMouseCaptured : 1;
+ bool mbGeometrySelected : 1;
+
+ void Construct2();
+ void ConstructLightObjects();
+ void AdaptToSelectedLight();
+ void TrySelection(Point aPosPixel);
+
+public:
+ Svx3DLightControl();
+
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual tools::Rectangle GetFocusRect() override;
+ virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual bool MouseMove( const MouseEvent& rMEvt ) override;
+ virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual void Resize() override;
+
+ virtual void SetObjectType(SvxPreviewObjectType nType) override;
+
+ // register user callback
+ void SetChangeCallback(Link<Svx3DLightControl*,void> aNew) { maChangeCallback = aNew; }
+ void SetSelectionChangeCallback(Link<Svx3DLightControl*,void> aNew) { maSelectionChangeCallback = aNew; }
+
+ // selection checks
+ bool IsSelectionValid();
+ bool IsGeometrySelected() const { return mbGeometrySelected; }
+
+ // get/set position of selected lamp in polar coordinates, Hor:[0..360.0[ and Ver:[-90..90] degrees
+ void GetPosition(double& rHor, double& rVer);
+ void SetPosition(double fHor, double fVer);
+
+ // get/set rotation of 3D object
+ void SetRotation(double fRotX, double fRotY, double fRotZ);
+ void GetRotation(double& rRotX, double& rRotY, double& rRotZ);
+
+ void SelectLight(sal_uInt32 nLightNumber);
+ virtual void Set3DAttributes(const SfxItemSet& rAttr) override;
+ sal_uInt32 GetSelectedLight() const { return maSelectedLight; }
+
+ // light data access
+ bool GetLightOnOff(sal_uInt32 nNum) const;
+ Color GetLightColor(sal_uInt32 nNum) const;
+ basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const;
+};
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxLightCtl3D
+{
+ // local controls
+ Svx3DLightControl& mrLightControl;
+ weld::Scale& mrHorScroller;
+ weld::Scale& mrVerScroller;
+ weld::Button& mrSwitcher;
+
+ // callback for interactive changes
+ Link<SvxLightCtl3D*,void> maUserInteractiveChangeCallback;
+ Link<SvxLightCtl3D*,void> maUserSelectionChangeCallback;
+
+public:
+ SvxLightCtl3D(Svx3DLightControl& rLightControl, weld::Scale& rHori,
+ weld::Scale& rVert, weld::Button& rButton);
+
+ // check the selection for validity
+ void CheckSelection();
+
+ // bring further settings to the outside world
+ Svx3DLightControl& GetSvx3DLightControl() { return mrLightControl; }
+
+ // register user callback
+ void SetUserInteractiveChangeCallback(Link<SvxLightCtl3D*,void> aNew) { maUserInteractiveChangeCallback = aNew; }
+ void SetUserSelectionChangeCallback(Link<SvxLightCtl3D*,void> aNew) { maUserSelectionChangeCallback = aNew; }
+
+private:
+
+ DECL_DLLPRIVATE_LINK(InternalInteractiveChange, Svx3DLightControl*, void);
+ DECL_DLLPRIVATE_LINK(InternalSelectionChange, Svx3DLightControl*, void);
+ DECL_DLLPRIVATE_LINK(ScrollBarMove, weld::Scale&, void);
+ DECL_DLLPRIVATE_LINK(ButtonPress, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(KeyInput, const KeyEvent&, bool);
+ DECL_DLLPRIVATE_LINK(FocusIn, weld::Widget&, void);
+
+ // initialize local parameters
+ void Init();
+
+ void move( double fDeltaHor, double fDeltaVer );
+};
+
+
+#endif // _SCH_DLGCTL3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
new file mode 100644
index 000000000..9787e025f
--- /dev/null
+++ b/include/svx/dlgctrl.hxx
@@ -0,0 +1,410 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_DLGCTRL_HXX
+#define INCLUDED_SVX_DLGCTRL_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/rectenum.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
+#include <vcl/virdev.hxx>
+#include <svx/xtable.hxx>
+#include <rtl/ref.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <memory>
+#include <array>
+
+namespace com::sun::star::awt {
+ struct Point;
+}
+
+/*************************************************************************
+|* Derived from SfxTabPage for being able to get notified through the
+|* virtual method from the control.
+\************************************************************************/
+
+class SAL_WARN_UNUSED SvxTabPage : public SfxTabPage
+{
+
+public:
+ SvxTabPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet &rAttrSet)
+ : SfxTabPage(pPage, pController, rUIXMLDescription, rID, &rAttrSet)
+ {
+ }
+ virtual void PointChanged(weld::DrawingArea* pArea, RectPoint eRP) = 0;
+};
+
+/*************************************************************************
+|* Control for display and selection of the corner and center points of
+|* an object
+\************************************************************************/
+
+enum class CTL_STATE
+{
+ NONE = 0,
+ NOHORZ = 1, // no horizontal input information is used
+ NOVERT = 2, // no vertical input information is used
+};
+namespace o3tl
+{
+ template<> struct typed_flags<CTL_STATE> : is_typed_flags<CTL_STATE, 0x03> {};
+}
+
+class SvxRectCtlAccessibleContext;
+class SvxPixelCtlAccessible;
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxRectCtl : public weld::CustomWidgetController
+{
+private:
+ SvxTabPage* m_pPage;
+
+ SVX_DLLPRIVATE static void InitSettings(vcl::RenderContext& rRenderContext);
+ SVX_DLLPRIVATE void InitRectBitmap();
+ SVX_DLLPRIVATE BitmapEx& GetRectBitmap();
+ SVX_DLLPRIVATE void Resize_Impl(const Size& rSize);
+
+ SvxRectCtl(const SvxRectCtl&) = delete;
+ SvxRectCtl& operator=(const SvxRectCtl&) = delete;
+
+protected:
+ rtl::Reference<SvxRectCtlAccessibleContext> pAccContext;
+ sal_uInt16 nBorderWidth;
+ Point aPtLT, aPtMT, aPtRT;
+ Point aPtLM, aPtMM, aPtRM;
+ Point aPtLB, aPtMB, aPtRB;
+ Point aPtNew;
+ RectPoint eRP, eDefRP;
+ std::unique_ptr<BitmapEx> pBitmap;
+ CTL_STATE m_nState;
+
+ bool mbCompleteDisable : 1;
+
+ RectPoint GetRPFromPoint( Point, bool bRTL = false ) const;
+ const Point& GetPointFromRP( RectPoint ) const;
+ Point SetActualRPWithoutInvalidate( RectPoint eNewRP ); // returns the last point
+
+ Point GetApproxLogPtFromPixPt( const Point& rRoughPixelPoint ) const;
+public:
+ SvxRectCtl(SvxTabPage* pPage);
+ void SetControlSettings(RectPoint eRpt, sal_uInt16 nBorder);
+ virtual ~SvxRectCtl() override;
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
+ virtual void Resize() override;
+ virtual bool MouseButtonDown(const MouseEvent&) override;
+ virtual bool KeyInput(const KeyEvent&) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual tools::Rectangle GetFocusRect() override;
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual void StyleUpdated() override;
+
+ void Reset();
+ RectPoint GetActualRP() const { return eRP;}
+ void SetActualRP( RectPoint eNewRP );
+
+ void SetState( CTL_STATE nState );
+
+ static const sal_uInt8 NO_CHILDREN = 9; // returns number of usable radio buttons
+
+ tools::Rectangle CalculateFocusRectangle() const;
+ tools::Rectangle CalculateFocusRectangle( RectPoint eRectPoint ) const;
+
+ css::uno::Reference<css::accessibility::XAccessible> getAccessibleParent() const { return GetDrawingArea()->get_accessible_parent(); }
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
+ a11yrelationset get_accessible_relation_set() const { return GetDrawingArea()->get_accessible_relation_set(); }
+
+ RectPoint GetApproxRPFromPixPt( const css::awt::Point& rPixelPoint ) const;
+
+ bool IsCompletelyDisabled() const { return mbCompleteDisable; }
+ void DoCompletelyDisable(bool bNew);
+};
+
+/*************************************************************************
+|* Control for editing bitmaps
+\************************************************************************/
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxPixelCtl final : public weld::CustomWidgetController
+{
+private:
+ static sal_uInt16 constexpr nLines = 8;
+ static sal_uInt16 constexpr nSquares = nLines * nLines;
+
+ SvxTabPage* m_pPage;
+
+ Color aPixelColor;
+ Color aBackgroundColor;
+ Size aRectSize;
+ std::array<sal_uInt8,nSquares> maPixelData;
+ bool bPaintable;
+ //Add member identifying position
+ Point aFocusPosition;
+ rtl::Reference<SvxPixelCtlAccessible> m_xAccess;
+
+ tools::Rectangle implCalFocusRect( const Point& aPosition );
+ void ChangePixel( sal_uInt16 nPixel );
+
+ SvxPixelCtl(SvxPixelCtl const&) = delete;
+ SvxPixelCtl(SvxPixelCtl&&) = delete;
+ SvxPixelCtl& operator=(SvxPixelCtl const&) = delete;
+ SvxPixelCtl& operator=(SvxPixelCtl&&) = delete;
+
+public:
+ SvxPixelCtl(SvxTabPage* pPage);
+
+ virtual ~SvxPixelCtl() override;
+
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void Resize() override;
+ virtual tools::Rectangle GetFocusRect() override;
+
+ void SetXBitmap( const BitmapEx& rBitmapEx );
+
+ void SetPixelColor( const Color& rCol ) { aPixelColor = rCol; }
+ void SetBackgroundColor( const Color& rCol ) { aBackgroundColor = rCol; }
+
+ static sal_uInt16 GetLineCount() { return nLines; }
+
+ sal_uInt8 GetBitmapPixel( const sal_uInt16 nPixelNumber ) const;
+ std::array<sal_uInt8,64> const & GetBitmapPixelPtr() const { return maPixelData; }
+
+ void SetPaintable( bool bTmp ) { bPaintable = bTmp; }
+ void Reset();
+
+ css::uno::Reference<css::accessibility::XAccessible> getAccessibleParent() const { return GetDrawingArea()->get_accessible_parent(); }
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
+ a11yrelationset get_accessible_relation_set() const { return GetDrawingArea()->get_accessible_relation_set(); }
+
+ static tools::Long GetSquares() { return nSquares ; }
+ tools::Long GetWidth() const { return aRectSize.getWidth() ; }
+ tools::Long GetHeight() const { return aRectSize.getHeight() ; }
+
+ //Device Pixel .
+ tools::Long ShowPosition( const Point &pt);
+
+ tools::Long PointToIndex(const Point &pt) const;
+ Point IndexToPoint(tools::Long nIndex) const ;
+ tools::Long GetFocusPosIndex() const ;
+ //Keyboard function for key input and focus handling function
+ virtual bool KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+};
+
+/************************************************************************/
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxLineLB
+{
+private:
+ std::unique_ptr<weld::ComboBox> m_xControl;
+
+ /// defines if standard fields (none, solid) are added, default is true
+ bool mbAddStandardFields : 1;
+
+public:
+ SvxLineLB(std::unique_ptr<weld::ComboBox> pControl);
+
+ void Fill(const XDashListRef &pList);
+ bool getAddStandardFields() const { return mbAddStandardFields; }
+ void setAddStandardFields(bool bNew);
+
+ void Append(const XDashEntry& rEntry, const BitmapEx& rBitmap );
+ void Modify(const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap );
+
+ void clear() { m_xControl->clear(); }
+ void remove(int nPos) { m_xControl->remove(nPos); }
+ int get_active() const { return m_xControl->get_active(); }
+ void set_active(int nPos) { m_xControl->set_active(nPos); }
+ void set_active_text(const OUString& rStr) { m_xControl->set_active_text(rStr); }
+ OUString get_active_text() const { return m_xControl->get_active_text(); }
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
+ int get_count() const { return m_xControl->get_count(); }
+ void append_text(const OUString& rStr) { m_xControl->append_text(rStr); }
+ bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); }
+ void save_value() { m_xControl->save_value(); }
+};
+
+/************************************************************************/
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxLineEndLB
+{
+private:
+ std::unique_ptr<weld::ComboBox> m_xControl;
+
+public:
+ SvxLineEndLB(std::unique_ptr<weld::ComboBox> pControl);
+
+ void Fill( const XLineEndListRef &pList, bool bStart = true );
+
+ void Append( const XLineEndEntry& rEntry, const BitmapEx& rBitmap );
+ void Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap );
+
+ void clear() { m_xControl->clear(); }
+ void remove(int nPos) { m_xControl->remove(nPos); }
+ int get_active() const { return m_xControl->get_active(); }
+ void set_active(int nPos) { m_xControl->set_active(nPos); }
+ void set_active_text(const OUString& rStr) { m_xControl->set_active_text(rStr); }
+ OUString get_active_text() const { return m_xControl->get_active_text(); }
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
+ int get_count() const { return m_xControl->get_count(); }
+ void append_text(const OUString& rStr) { m_xControl->append_text(rStr); }
+ bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); }
+ void save_value() { m_xControl->save_value(); }
+ void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
+ bool get_sensitive() const { return m_xControl->get_sensitive(); }
+};
+
+class SdrObject;
+class SdrPathObj;
+class SdrModel;
+
+class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI SvxPreviewBase : public weld::CustomWidgetController
+{
+private:
+ std::unique_ptr<SdrModel> mpModel;
+ VclPtr<VirtualDevice> mpBufferDevice;
+
+protected:
+ void InitSettings();
+
+ tools::Rectangle GetPreviewSize() const;
+
+ // prepare buffered paint
+ void LocalPrePaint(vcl::RenderContext const & rRenderContext);
+
+ // end and output buffered paint
+ void LocalPostPaint(vcl::RenderContext& rRenderContext);
+
+public:
+ SvxPreviewBase();
+ virtual void SetDrawingArea(weld::DrawingArea*) override;
+ virtual ~SvxPreviewBase() override;
+
+ // change support
+ virtual void StyleUpdated() override;
+
+ void SetDrawMode(DrawModeFlags nDrawMode)
+ {
+ mpBufferDevice->SetDrawMode(nDrawMode);
+ }
+
+ Size GetOutputSize() const
+ {
+ return mpBufferDevice->PixelToLogic(GetOutputSizePixel());
+ }
+
+ // dada read access
+ SdrModel& getModel() const
+ {
+ return *mpModel;
+ }
+ OutputDevice& getBufferDevice() const
+ {
+ return *mpBufferDevice;
+ }
+};
+
+
+/*************************************************************************
+|*
+|* SvxLinePreview
+|*
+\************************************************************************/
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXLinePreview final : public SvxPreviewBase
+{
+private:
+ SdrPathObj* mpLineObjA;
+ SdrPathObj* mpLineObjB;
+ SdrPathObj* mpLineObjC;
+
+ Graphic* mpGraphic;
+ bool mbWithSymbol;
+ Size maSymbolSize;
+
+public:
+ SvxXLinePreview();
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual ~SvxXLinePreview() override;
+
+ void SetLineAttributes(const SfxItemSet& rItemSet);
+
+ void ShowSymbol( bool b ) { mbWithSymbol = b; };
+ void SetSymbol( Graphic* p, const Size& s );
+ void ResizeSymbol( const Size& s );
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+};
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXRectPreview final : public SvxPreviewBase
+{
+private:
+ SdrObject* mpRectangleObject;
+
+public:
+ SvxXRectPreview();
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual ~SvxXRectPreview() override;
+
+ void SetAttributes(const SfxItemSet& rItemSet);
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+};
+
+/*************************************************************************
+|*
+|* SvxXShadowPreview
+|*
+\************************************************************************/
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXShadowPreview final : public SvxPreviewBase
+{
+private:
+ Point maShadowOffset;
+
+ SdrObject* mpRectangleObject;
+ SdrObject* mpRectangleShadow;
+
+public:
+ SvxXShadowPreview();
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual ~SvxXShadowPreview() override;
+
+ void SetRectangleAttributes(const SfxItemSet& rItemSet);
+ void SetShadowAttributes(const SfxItemSet& rItemSet);
+ void SetShadowPosition(const Point& rPos);
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+};
+
+class SvxRelativeField;
+
+void limitWidthForSidebar(weld::SpinButton& rSpinButton);
+SVX_DLLPUBLIC void limitWidthForSidebar(SvxRelativeField& rMetricSpinButton);
+//tdf#130197 Give this toolbar a width as if it had 5 standard toolbutton entries
+SVX_DLLPUBLIC void padWidthForSidebar(weld::Toolbar& rToolbar, const css::uno::Reference<css::frame::XFrame>& rFrame);
+
+#endif // INCLUDED_SVX_DLGCTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/dlgutil.hxx b/include/svx/dlgutil.hxx
new file mode 100644
index 000000000..f8b53c0a5
--- /dev/null
+++ b/include/svx/dlgutil.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_DLGUTIL_HXX
+#define INCLUDED_SVX_DLGUTIL_HXX
+
+#include <tools/fldunit.hxx>
+#include <svx/svxdllapi.h>
+#include <vcl/rendercontext/DrawModeFlags.hxx>
+
+class SfxItemSet;
+
+SVXCORE_DLLPUBLIC FieldUnit GetModuleFieldUnit(const SfxItemSet&);
+SVXCORE_DLLPUBLIC FieldUnit GetModuleFieldUnit();
+SVXCORE_DLLPUBLIC bool GetApplyCharUnit(const SfxItemSet&);
+
+constexpr DrawModeFlags OUTPUT_DRAWMODE_COLOR = DrawModeFlags::Default;
+constexpr DrawModeFlags OUTPUT_DRAWMODE_CONTRAST
+ = DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill | DrawModeFlags::SettingsText
+ | DrawModeFlags::SettingsGradient;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/drawitem.hxx b/include/svx/drawitem.hxx
new file mode 100644
index 000000000..d40848c53
--- /dev/null
+++ b/include/svx/drawitem.hxx
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_DRAWITEM_HXX
+#define INCLUDED_SVX_DRAWITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svx/xtable.hxx>
+#include <svx/svxdllapi.h>
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxColorListItem final : public SfxPoolItem
+{
+ XColorListRef pColorList;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxColorListItem();
+ SvxColorListItem( XColorListRef const & pTable,
+ TypedWhichId<SvxColorListItem> nWhich );
+ SvxColorListItem( const SvxColorListItem& );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxColorListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ const XColorListRef& GetColorList() const { return pColorList; }
+};
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxGradientListItem final : public SfxPoolItem
+{
+ XGradientListRef pGradientList;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxGradientListItem();
+ SvxGradientListItem( XGradientListRef const & pList,
+ TypedWhichId<SvxGradientListItem> nWhich );
+ SvxGradientListItem( const SvxGradientListItem& );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxGradientListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ const XGradientListRef& GetGradientList() const { return pGradientList; }
+};
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxHatchListItem final : public SfxPoolItem
+{
+ XHatchListRef pHatchList;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SvxHatchListItem();
+ SvxHatchListItem( XHatchListRef const & pList,
+ TypedWhichId<SvxHatchListItem> nWhich );
+ SvxHatchListItem( const SvxHatchListItem& );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxHatchListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ const XHatchListRef& GetHatchList() const { return pHatchList; }
+};
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxBitmapListItem final : public SfxPoolItem
+{
+ XBitmapListRef pBitmapList;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxBitmapListItem();
+ SvxBitmapListItem( XBitmapListRef const & pBL,
+ TypedWhichId<SvxBitmapListItem> nWhich );
+ SvxBitmapListItem( const SvxBitmapListItem& );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxBitmapListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ const XBitmapListRef& GetBitmapList() const { return pBitmapList; }
+};
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxPatternListItem final : public SfxPoolItem
+{
+ XPatternListRef pPatternList;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxPatternListItem();
+ SvxPatternListItem( XPatternListRef const & pBL,
+ TypedWhichId<SvxPatternListItem> nWhich );
+ SvxPatternListItem( const SvxPatternListItem& );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxPatternListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ const XPatternListRef& GetPatternList() const { return pPatternList; }
+};
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxDashListItem final : public SfxPoolItem
+{
+ XDashListRef pDashList;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxDashListItem();
+ SvxDashListItem( XDashListRef const & pList,
+ TypedWhichId<SvxDashListItem> nWhich );
+ SvxDashListItem( const SvxDashListItem& );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxDashListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ const XDashListRef& GetDashList() const { return pDashList; }
+};
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxLineEndListItem final : public SfxPoolItem
+{
+ XLineEndListRef pLineEndList;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxLineEndListItem();
+ SvxLineEndListItem( XLineEndListRef const & pList,
+ TypedWhichId<SvxLineEndListItem> nWhich );
+ SvxLineEndListItem( const SvxLineEndListItem& );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxLineEndListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ const XLineEndListRef& GetLineEndList() const { return pLineEndList; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/e3ditem.hxx b/include/svx/e3ditem.hxx
new file mode 100644
index 000000000..3a8ad1690
--- /dev/null
+++ b/include/svx/e3ditem.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_E3DITEM_HXX
+#define INCLUDED_SVX_E3DITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <svx/svxdllapi.h>
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxB3DVectorItem final : public SfxPoolItem
+{
+ basegfx::B3DVector aVal;
+
+public:
+ SvxB3DVectorItem( TypedWhichId<SvxB3DVectorItem> nWhich, const basegfx::B3DVector& rVal );
+ SvxB3DVectorItem( const SvxB3DVectorItem& );
+ virtual ~SvxB3DVectorItem() override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxB3DVectorItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ const basegfx::B3DVector& GetValue() const { return aVal; }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/e3dsceneupdater.hxx b/include/svx/e3dsceneupdater.hxx
new file mode 100644
index 000000000..bcb6d92fa
--- /dev/null
+++ b/include/svx/e3dsceneupdater.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_E3DSCENEUPDATER_HXX
+#define INCLUDED_SVX_E3DSCENEUPDATER_HXX
+
+#include <svx/svxdllapi.h>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <optional>
+
+class SdrObject;
+class E3dScene;
+
+/** Helper for 3d object changes affecting 2d geometry
+
+ This class is a helper to encapsulate 3D object changes which shall
+ change the scene's 2D geometry. E.g. when moving one 3D object in a
+ scene, the visualisation would not change since the scene's 2D
+ attributes are defined by its 2D object transformation and the
+ changed content would be projected to the same 2D bounds as
+ before. To reflect the fact that the 2D positions may 'change' for
+ the user's imagination, it is necessary to calculate a new 2D
+ object transformation of the scene (the SnapRect) using the old 3D
+ transformation stack and the possibly modified 3D content and to
+ use it. This is only desirable if changes to the scene's content
+ are intended to change the scene's 2D geometry attributes
+*/
+class SVXCORE_DLLPUBLIC E3DModifySceneSnapRectUpdater
+{
+ // the scene which may be changed. This gets set to the outmost scene
+ // of the to-be-changed 3D object when the scene has a 3d transformation
+ // stack at construction time. In all other cases it's set to zero and
+ // no action needs to be taken
+ E3dScene* mpScene;
+
+ // the 3d transformation stack at the time of construction, valid when
+ // mpScene is not zero
+ std::optional<drawinglayer::geometry::ViewInformation3D> mpViewInformation3D;
+
+public:
+ // the constructor evaluates and sets the members at construction time
+ E3DModifySceneSnapRectUpdater(const SdrObject* mpObject);
+
+ // the destructor will take action if mpScene is not zero and modify the
+ // 2D geometry of the target scene
+ ~E3DModifySceneSnapRectUpdater();
+};
+
+#endif // INCLUDED_SVX_E3DSCENEUPDATER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/e3dundo.hxx b/include/svx/e3dundo.hxx
new file mode 100644
index 000000000..9c0515b86
--- /dev/null
+++ b/include/svx/e3dundo.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_E3DUNDO_HXX
+#define INCLUDED_SVX_E3DUNDO_HXX
+
+#include <svl/itemset.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/svxdllapi.h>
+
+/************************************************************************\
+|*
+|* Base class for all 3D undo actions.
+|*
+\************************************************************************/
+class SAL_WARN_UNUSED E3dUndoAction : public SdrUndoAction
+{
+ protected:
+ E3dObject& mrMy3DObj;
+
+ public:
+ E3dUndoAction(E3dObject &r3DObj)
+ : SdrUndoAction(r3DObj.getSdrModelFromSdrObject()),
+ mrMy3DObj(r3DObj)
+ {
+ }
+
+ virtual ~E3dUndoAction () override;
+
+ virtual bool CanRepeat(SfxRepeatTarget&) const override;
+};
+
+/************************************************************************\
+|*
+|* Undo for 3D rotation through the rotation matrices
+|*
+\************************************************************************/
+class SAL_WARN_UNUSED E3dRotateUndoAction final : public E3dUndoAction
+{
+private:
+ basegfx::B3DHomMatrix maMyOldRotation;
+ basegfx::B3DHomMatrix maMyNewRotation;
+
+public:
+ E3dRotateUndoAction(
+ E3dObject& r3DObj,
+ const basegfx::B3DHomMatrix &aOldRotation,
+ const basegfx::B3DHomMatrix &aNewRotation)
+ : E3dUndoAction(r3DObj),
+ maMyOldRotation(aOldRotation),
+ maMyNewRotation(aNewRotation)
+ {
+ }
+
+ virtual ~E3dRotateUndoAction () override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+};
+
+/************************************************************************\
+|*
+|* Undo for 3D attributes (implemented using Set3DAttributes())
+|*
+\************************************************************************/
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC E3dAttributesUndoAction final : public SdrUndoAction
+{
+private:
+ using SdrUndoAction::Repeat;
+
+ SdrObject& mrObject;
+ const SfxItemSet maNewSet;
+ const SfxItemSet maOldSet;
+
+ public:
+ E3dAttributesUndoAction(
+ E3dObject& rInObject,
+ const SfxItemSet& rNewSet,
+ const SfxItemSet& rOldSet);
+
+ virtual ~E3dAttributesUndoAction() override;
+
+ virtual bool CanRepeat(SfxRepeatTarget& rView) const override;
+ virtual void Undo() override;
+ virtual void Redo() override;
+};
+
+#endif // INCLUDED_SVX_E3DUNDO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/extedit.hxx b/include/svx/extedit.hxx
new file mode 100644
index 000000000..0168068f6
--- /dev/null
+++ b/include/svx/extedit.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVX_EXTEDIT_HXX
+#define INCLUDED_SVX_EXTEDIT_HXX
+
+#include <svx/svxdllapi.h>
+#include <svl/lstner.hxx>
+#include <rtl/ustring.hxx>
+#include <memory>
+
+class Graphic;
+class GraphicObject;
+class FileChangedChecker;
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC ExternalToolEdit
+{
+protected:
+ OUString m_aFileName;
+
+ ::std::unique_ptr<FileChangedChecker> m_pChecker;
+
+public:
+
+ ExternalToolEdit();
+ virtual ~ExternalToolEdit();
+
+ virtual void Update( Graphic& aGraphic ) = 0;
+ void Edit(GraphicObject const*const pGraphic);
+
+ void StartListeningEvent();
+
+ static void HandleCloseEvent( ExternalToolEdit* pData );
+};
+
+class FmFormView;
+class SdrObject;
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SdrExternalToolEdit final
+: public ExternalToolEdit
+ ,public SfxListener
+{
+private:
+ FmFormView* m_pView;
+ SdrObject* m_pObj;
+
+ SAL_DLLPRIVATE virtual void Update(Graphic&) override;
+ SAL_DLLPRIVATE virtual void Notify(SfxBroadcaster&, const SfxHint&) override;
+
+public:
+ SdrExternalToolEdit(
+ FmFormView* pView,
+ SdrObject* pObj);
+};
+
+#endif
diff --git a/include/svx/extrusionbar.hxx b/include/svx/extrusionbar.hxx
new file mode 100644
index 000000000..c3bf86ad0
--- /dev/null
+++ b/include/svx/extrusionbar.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_EXTRUSIONBAR_HXX
+#define INCLUDED_SVX_EXTRUSIONBAR_HXX
+
+#include <sfx2/shell.hxx>
+#include <svx/ifaceids.hxx>
+#include <svx/svxdllapi.h>
+
+class SfxViewShell;
+class SdrView;
+
+/************************************************************************/
+
+namespace svx
+{
+SVXCORE_DLLPUBLIC bool checkForSelectedCustomShapes(SdrView const* pSdrView, bool bOnlyExtruded);
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC ExtrusionBar final : public SfxShell
+{
+public:
+ SFX_DECL_INTERFACE(SVX_INTERFACE_EXTRUSION_BAR)
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl();
+
+public:
+ ExtrusionBar(SfxViewShell* pViewShell);
+ virtual ~ExtrusionBar() override;
+
+ static void execute(SdrView* pSdrView, SfxRequest const& rReq, SfxBindings& rBindings);
+ static void getState(SdrView const* pSdrView, SfxItemSet& rSet);
+};
+}
+
+#endif // INCLUDED_SVX_EXTRUSIONBAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/f3dchild.hxx b/include/svx/f3dchild.hxx
new file mode 100644
index 000000000..1cd46695b
--- /dev/null
+++ b/include/svx/f3dchild.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_F3DCHILD_HXX
+#define INCLUDED_SVX_F3DCHILD_HXX
+
+#include <sfx2/childwin.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* Derived from SfxChildWindow as "container" for 3D Window
+|*
+\************************************************************************/
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC Svx3DChildWindow final : public SfxChildWindow
+{
+public:
+ Svx3DChildWindow(vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo*);
+
+ SFX_DECL_CHILDWINDOW_WITHID(Svx3DChildWindow);
+};
+
+#endif // INCLUDED_SVX_F3DCHILD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fillctrl.hxx b/include/svx/fillctrl.hxx
new file mode 100644
index 000000000..978f63e35
--- /dev/null
+++ b/include/svx/fillctrl.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FILLCTRL_HXX
+#define INCLUDED_SVX_FILLCTRL_HXX
+
+#include <memory>
+#include <vcl/InterimItemWindow.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include <sfx2/weldutils.hxx>
+#include <svx/svxdllapi.h>
+
+class XFillStyleItem;
+class XFillColorItem;
+class XFillGradientItem;
+class XFillHatchItem;
+class XFillBitmapItem;
+class FillControl;
+
+/*************************************************************************
+|*
+|* Class for surface attributes (controls and controller)
+|*
+\************************************************************************/
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFillToolBoxControl final : public SfxToolBoxControl
+{
+private:
+ std::unique_ptr< XFillStyleItem > mpStyleItem;
+ std::unique_ptr< XFillColorItem > mpColorItem;
+ std::unique_ptr< XFillGradientItem > mpFillGradientItem;
+ std::unique_ptr< XFillHatchItem > mpHatchItem;
+ std::unique_ptr< XFillBitmapItem > mpBitmapItem;
+
+ VclPtr<FillControl> mxFillControl;
+ weld::ComboBox* mpLbFillType;
+ weld::Toolbar* mpToolBoxColor;
+ weld::ComboBox* mpLbFillAttr;
+
+ sal_Int32 mnLastXFS;
+ sal_Int32 mnLastPosGradient;
+ sal_Int32 mnLastPosHatch;
+ sal_Int32 mnLastPosBitmap;
+ sal_Int32 mnLastPosPattern;
+
+ DECL_DLLPRIVATE_LINK(SelectFillTypeHdl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(SelectFillAttrHdl, weld::ComboBox&, void);
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxFillToolBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
+ virtual ~SvxFillToolBoxControl() override;
+
+ virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) override;
+ void Update();
+ virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
+};
+
+class SAL_WARN_UNUSED FillControl final : public InterimItemWindow
+{
+private:
+ friend class SvxFillToolBoxControl;
+
+ std::unique_ptr<weld::ComboBox> mxLbFillType;
+ std::unique_ptr<weld::Toolbar> mxToolBoxColor;
+ std::unique_ptr<ToolbarUnoDispatcher> mxColorDispatch;
+ std::unique_ptr<weld::ComboBox> mxLbFillAttr;
+ int mnTypeCurPos;
+ int mnAttrCurPos;
+
+ DECL_LINK(AttrKeyInputHdl, const KeyEvent&, bool);
+ DECL_LINK(TypeKeyInputHdl, const KeyEvent&, bool);
+ DECL_LINK(ColorKeyInputHdl, const KeyEvent&, bool);
+ DECL_STATIC_LINK(FillControl, DumpAsPropertyTreeHdl, tools::JsonWriter&, void);
+ DECL_LINK(AttrFocusHdl, weld::Widget&, void);
+ DECL_LINK(TypeFocusHdl, weld::Widget&, void);
+
+ void SetOptimalSize();
+
+ virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
+
+ static void ReleaseFocus_Impl();
+
+public:
+ FillControl(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame);
+ virtual void dispose() override;
+ virtual ~FillControl() override;
+};
+
+#endif // INCLUDED_SVX_FILLCTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/flagsdef.hxx b/include/svx/flagsdef.hxx
new file mode 100644
index 000000000..3fbb70ca6
--- /dev/null
+++ b/include/svx/flagsdef.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_FLAGSDEF_HXX
+#define INCLUDED_SVX_FLAGSDEF_HXX
+
+#include <o3tl/typed_flags_set.hxx>
+#include <o3tl/enumarray.hxx>
+#include <o3tl/unit_conversion.hxx>
+#include <tools/long.hxx>
+
+// Border-Modes for SvxBorderTabPage
+enum class SwBorderModes
+{
+ NONE = 0x00,
+ PARA = 0x01,
+ TABLE = 0x02,
+ FRAME = 0x04,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<SwBorderModes> : is_typed_flags<SwBorderModes, 0x07> {};
+}
+
+// flags for SvxBackgroundTabPage
+enum class SvxBackgroundTabFlags
+{
+ NONE = 0x00,
+ SHOW_SELECTOR = 0x01,
+ SHOW_TBLCTL = 0x08,
+ SHOW_HIGHLIGHTING = 0x10,
+ SHOW_CHAR_BKGCOLOR = 0x20,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvxBackgroundTabFlags> : is_typed_flags<SvxBackgroundTabFlags, 0x39> {};
+}
+
+// flags for SvxBorderTabPage
+#define SVX_HIDESHADOWCTL 0x01
+
+#define DISABLE_CASEMAP (sal_uInt16(0x0001))
+#define DISABLE_HIDE_LANGUAGE (sal_uInt16(0x0020))
+
+// flags for SvxCharBasePage's child class
+#define SVX_PREVIEW_CHARACTER 0x01
+// flags for SvxCharNamePage
+#define SVX_RELATIVE_MODE 0x02
+// flags for SvxCharEffectsPage
+#define SVX_ENABLE_CHAR_TRANSPARENCY 0x08
+
+
+// Default values for Number Format Category List and Preview
+enum class SvxNumValCategory
+{
+ Standard = 0,
+ Percent,
+ Currency,
+ Date,
+ Time,
+ Scientific,
+ Fraction,
+ Boolean,
+ NoValue,
+ LAST = NoValue
+};
+const o3tl::enumarray<SvxNumValCategory, double> fSvxNumValConst = {
+ -1234.56789012345678, // SvxNumValCategory::Standard
+ -0.1295, // SvxNumValCategory::Percent
+ -1234.0, // SvxNumValCategory::Currency
+ 36525.5678935185, // SvxNumValCategory::Date
+ 36525.5678935185, // SvxNumValCategory::Time
+ 12345.67889, // SvxNumValCategory::Scientific
+ 123.456, // SvxNumValCategory::Fraction
+ 1.0, // SvxNumValCategory::Boolean
+ 0.0 // SvxNumValCategory::NoValue
+};
+
+enum SvxModeType
+{
+ SVX_PAGE_MODE_STANDARD,
+ SVX_PAGE_MODE_CENTER,
+ SVX_PAGE_MODE_PRESENTATION
+};
+
+// 1/2 cm in TWIPS
+// Is also used for minimum size of LayFrms of any kind
+constexpr tools::Long MM50 = o3tl::convert(tools::Long(5), o3tl::Length::mm, o3tl::Length::twip);
+
+enum class TabulatorDisableFlags {
+ TypeLeft = 0x0001,
+ TypeRight = 0x0002,
+ TypeCenter = 0x0004,
+ TypeDecimal = 0x0008,
+ TypeMask = 0x000F,
+
+ FillNone = 0x0010,
+ FillPoint = 0x0020,
+ FillDashLine = 0x0040,
+ FillSolidLine = 0x0080,
+ FillSpecial = 0x0100,
+ FillMask = 0x01F0
+};
+namespace o3tl {
+ template<> struct typed_flags<TabulatorDisableFlags> : is_typed_flags<TabulatorDisableFlags, 0x1ff> {};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/float3d.hxx b/include/svx/float3d.hxx
new file mode 100644
index 000000000..bf68917be
--- /dev/null
+++ b/include/svx/float3d.hxx
@@ -0,0 +1,288 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FLOAT3D_HXX
+#define INCLUDED_SVX_FLOAT3D_HXX
+
+#include <memory>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/dockwin.hxx>
+#include <vcl/weld.hxx>
+#include <svx/svxdllapi.h>
+
+#include <svx/dlgctl3d.hxx>
+
+
+enum class ViewType3D
+{
+ Geo = 1,
+ Representation,
+ Light,
+ Texture,
+ Material
+};
+
+class FmFormModel;
+class Svx3DCtrlItem;
+class SvxConvertTo3DItem;
+class ColorListBox;
+
+struct Svx3DWinImpl;
+
+class SVX_DLLPUBLIC LightButton final
+{
+public:
+ explicit LightButton(std::unique_ptr<weld::ToggleButton> xButton);
+
+ void switchLightOn(bool bOn);
+ bool isLightOn() const { return m_bLightOn;}
+
+ bool get_active() const { return m_xButton->get_active(); }
+ void set_active(bool bActive) { m_xButton->set_active(bActive); }
+
+ TriState get_state() const { return m_xButton->get_state(); }
+ void set_state(TriState eState) { m_xButton->set_state(eState); }
+
+ weld::ToggleButton* get_widget() const { return m_xButton.get(); }
+
+ void connect_clicked(const Link<weld::Button&, void>& rLink)
+ {
+ m_xButton->connect_clicked(rLink);
+ }
+
+ bool get_prev_active() const { return m_bButtonPrevActive; }
+ void set_prev_active(bool bPrevActive) { m_bButtonPrevActive = bPrevActive; }
+
+private:
+ std::unique_ptr<weld::ToggleButton> m_xButton;
+ bool m_bLightOn;
+ bool m_bButtonPrevActive;
+};
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC Svx3DWin final : public SfxDockingWindow
+{
+ friend class Svx3DChildWindow;
+ friend class Svx3DCtrlItem;
+
+private:
+ std::unique_ptr<weld::ToggleButton> m_xBtnGeo;
+ std::unique_ptr<weld::ToggleButton> m_xBtnRepresentation;
+ std::unique_ptr<weld::ToggleButton> m_xBtnLight;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexture;
+ std::unique_ptr<weld::ToggleButton> m_xBtnMaterial;
+ std::unique_ptr<weld::ToggleButton> m_xBtnUpdate;
+ std::unique_ptr<weld::Button> m_xBtnAssign;
+
+// geometry
+ std::unique_ptr<weld::Container> m_xFLGeometrie;
+ std::unique_ptr<weld::Label> m_xFtPercentDiagonal;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrPercentDiagonal;
+ std::unique_ptr<weld::Label> m_xFtBackscale;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrBackscale;
+ std::unique_ptr<weld::Label> m_xFtEndAngle;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrEndAngle;
+ std::unique_ptr<weld::Label> m_xFtDepth;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrDepth;
+
+ std::unique_ptr<weld::Container> m_xFLSegments;
+ std::unique_ptr<weld::SpinButton> m_xNumHorizontal;
+ std::unique_ptr<weld::SpinButton> m_xNumVertical;
+
+ std::unique_ptr<weld::Container> m_xFLNormals;
+ std::unique_ptr<weld::ToggleButton> m_xBtnNormalsObj;
+ std::unique_ptr<weld::ToggleButton> m_xBtnNormalsFlat;
+ std::unique_ptr<weld::ToggleButton> m_xBtnNormalsSphere;
+ std::unique_ptr<weld::ToggleButton> m_xBtnNormalsInvert;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTwoSidedLighting;
+ std::unique_ptr<weld::ToggleButton> m_xBtnDoubleSided;
+
+// presentation
+ std::unique_ptr<weld::Container> m_xFLRepresentation;
+ std::unique_ptr<weld::ComboBox> m_xLbShademode;
+
+ std::unique_ptr<weld::Container> m_xFLShadow;
+ std::unique_ptr<weld::ToggleButton> m_xBtnShadow3d;
+ std::unique_ptr<weld::Label> m_xFtSlant;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrSlant;
+
+ std::unique_ptr<weld::Container> m_xFLCamera;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFocalLength;
+
+// lighting
+ std::unique_ptr<weld::Container> m_xFLLight;
+ std::unique_ptr<LightButton> m_xBtnLight1;
+ std::unique_ptr<LightButton> m_xBtnLight2;
+ std::unique_ptr<LightButton> m_xBtnLight3;
+ std::unique_ptr<LightButton> m_xBtnLight4;
+ std::unique_ptr<LightButton> m_xBtnLight5;
+ std::unique_ptr<LightButton> m_xBtnLight6;
+ std::unique_ptr<LightButton> m_xBtnLight7;
+ std::unique_ptr<LightButton> m_xBtnLight8;
+ std::unique_ptr<ColorListBox> m_xLbLight1;
+ std::unique_ptr<ColorListBox> m_xLbLight2;
+ std::unique_ptr<ColorListBox> m_xLbLight3;
+ std::unique_ptr<ColorListBox> m_xLbLight4;
+ std::unique_ptr<ColorListBox> m_xLbLight5;
+ std::unique_ptr<ColorListBox> m_xLbLight6;
+ std::unique_ptr<ColorListBox> m_xLbLight7;
+ std::unique_ptr<ColorListBox> m_xLbLight8;
+ std::unique_ptr<weld::Button> m_xBtnLightColor;
+ std::unique_ptr<ColorListBox> m_xLbAmbientlight; // ListBox
+ std::unique_ptr<weld::Button> m_xBtnAmbientColor; // color button
+
+// Textures
+ std::unique_ptr<weld::Container> m_xFLTexture;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexLuminance;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexColor;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexReplace;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexModulate;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexObjectX;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexParallelX;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexCircleX;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexObjectY;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexParallelY;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexCircleY;
+ std::unique_ptr<weld::ToggleButton> m_xBtnTexFilter;
+
+// material
+// material editor
+ std::unique_ptr<weld::Container> m_xFLMaterial;
+ std::unique_ptr<weld::ComboBox> m_xLbMatFavorites;
+ std::unique_ptr<ColorListBox> m_xLbMatColor;
+ std::unique_ptr<weld::Button> m_xBtnMatColor;
+ std::unique_ptr<ColorListBox> m_xLbMatEmission;
+ std::unique_ptr<weld::Button> m_xBtnEmissionColor;
+
+ std::unique_ptr<weld::Container> m_xFLMatSpecular;
+ std::unique_ptr<ColorListBox> m_xLbMatSpecular;
+ std::unique_ptr<weld::Button> m_xBtnSpecularColor;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrMatSpecularIntensity;
+
+ std::unique_ptr<Svx3DPreviewControl> m_xCtlPreview;
+ std::unique_ptr<weld::CustomWeld> m_xCtlPreviewWin;
+
+ std::unique_ptr<weld::Widget> m_xLightPreviewGrid;
+ std::unique_ptr<weld::Scale> m_xHoriScale;
+ std::unique_ptr<weld::Scale> m_xVertScale;
+ std::unique_ptr<weld::Button> m_xBtn_Corner;
+ std::unique_ptr<Svx3DLightControl> m_xLightPreview;
+ std::unique_ptr<weld::CustomWeld> m_xCtlLightPreviewWin;
+ std::unique_ptr<SvxLightCtl3D> m_xCtlLightPreview;
+
+// bottom part
+ std::unique_ptr<weld::Button> m_xBtnConvertTo3D;
+ std::unique_ptr<weld::Button> m_xBtnLatheObject;
+ std::unique_ptr<weld::ToggleButton> m_xBtnPerspective;
+
+// the rest ...
+ bool bUpdate;
+ ViewType3D eViewType;
+
+ // Model, Page, View etc. for favourites
+ std::unique_ptr<FmFormModel> pModel;
+
+ SfxBindings* pBindings;
+ std::unique_ptr<Svx3DCtrlItem> pControllerItem;
+
+ std::unique_ptr<SvxConvertTo3DItem> pConvertTo3DItem;
+ std::unique_ptr<SvxConvertTo3DItem> pConvertTo3DLatheItem;
+
+ std::unique_ptr<Svx3DWinImpl> mpImpl;
+ MapUnit ePoolUnit;
+ FieldUnit eFUnit;
+
+ // ItemSet used to remember set 2d attributes
+ std::unique_ptr<SfxItemSet> mpRemember2DAttributes;
+
+ DECL_DLLPRIVATE_LINK( ClickViewTypeHdl, weld::Button&, void );
+ DECL_DLLPRIVATE_LINK( ClickUpdateHdl, weld::Toggleable&, void );
+ DECL_DLLPRIVATE_LINK( ClickAssignHdl, weld::Button&, void );
+ DECL_DLLPRIVATE_LINK( ClickHdl, weld::Button&, void );
+ DECL_DLLPRIVATE_LINK( ClickColorHdl, weld::Button&, void );
+ DECL_DLLPRIVATE_LINK( SelectHdl, weld::ComboBox&, void );
+ DECL_DLLPRIVATE_LINK( SelectColorHdl, ColorListBox&, void );
+ DECL_DLLPRIVATE_LINK( ModifyMetricHdl, weld::MetricSpinButton&, void );
+ DECL_DLLPRIVATE_LINK( ModifySpinHdl, weld::SpinButton&, void );
+ void ClickLight(const LightButton& rBtn);
+
+ DECL_DLLPRIVATE_LINK( ChangeSelectionCallbackHdl, SvxLightCtl3D*, void );
+
+ SVX_DLLPRIVATE void Construct();
+ SVX_DLLPRIVATE void Reset();
+
+ SVX_DLLPRIVATE static void LBSelectColor( ColorListBox* pLb, const Color& rColor );
+ SVX_DLLPRIVATE sal_uInt16 GetLightSource( const LightButton* pBtn ) const;
+ SVX_DLLPRIVATE ColorListBox* GetCLbByButton( const LightButton* pBtn = nullptr );
+ SVX_DLLPRIVATE LightButton* GetLbByButton( const weld::Button* pBtn );
+
+ virtual void Resize() override;
+
+public:
+ Svx3DWin( SfxBindings* pBindings, SfxChildWindow *pCW,
+ vcl::Window* pParent );
+ virtual ~Svx3DWin() override;
+ virtual void dispose() override;
+
+ void InitColorLB();
+ bool IsUpdateMode() const { return bUpdate; }
+
+ void Update( SfxItemSet const & rSet );
+ void GetAttr( SfxItemSet& rSet );
+
+ void UpdatePreview(); // upward (private)
+ void DocumentReload();
+};
+
+/*************************************************************************
+|*
+|* Controller item for 3D Window (Floating/Docking)
+|*
+\************************************************************************/
+
+class Svx3DCtrlItem final : public SfxControllerItem
+{
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSId, SfxItemState eState,
+ const SfxPoolItem* pState ) override;
+
+ public:
+ Svx3DCtrlItem( sal_uInt16, SfxBindings* );
+};
+
+/*************************************************************************
+|*
+|* ControllerItem for State of a Slot
+|* (SID_CONVERT_TO_3D, SID_CONVERT_TO_3D_LATHE_FAST)
+|*
+\************************************************************************/
+
+class SvxConvertTo3DItem final : public SfxControllerItem
+{
+ bool bState;
+
+ virtual void StateChangedAtToolBoxControl(sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState) override;
+
+public:
+ SvxConvertTo3DItem(sal_uInt16 nId, SfxBindings* pBindings);
+ bool GetState() const { return bState; }
+};
+
+#endif // INCLUDED_SVX_FLOAT3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmdmod.hxx b/include/svx/fmdmod.hxx
new file mode 100644
index 000000000..69ef27704
--- /dev/null
+++ b/include/svx/fmdmod.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_FMDMOD_HXX
+#define INCLUDED_SVX_FMDMOD_HXX
+
+#include <svx/unomod.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC SvxFmMSFactory : public SvxUnoDrawMSFactory
+{
+public:
+ SvxFmMSFactory(){};
+
+ virtual ~SvxFmMSFactory() {}
+
+ virtual ::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface>
+ SAL_CALL createInstance(const OUString& ServiceSpecifier) override;
+ virtual ::com::sun::star::uno::Sequence<OUString> SAL_CALL getAvailableServiceNames() override;
+};
+
+#endif // INCLUDED_SVX_FMDMOD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmdpage.hxx b/include/svx/fmdpage.hxx
new file mode 100644
index 000000000..ae864e611
--- /dev/null
+++ b/include/svx/fmdpage.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_FMDPAGE_HXX
+#define INCLUDED_SVX_FMDPAGE_HXX
+
+#include <com/sun/star/form/XFormsSupplier2.hpp>
+#include <svx/unopage.hxx>
+#include <comphelper/uno3.hxx>
+#include <svx/svxdllapi.h>
+
+
+// SvxFmDrawPage
+
+class SVXCORE_DLLPUBLIC SvxFmDrawPage :public SvxDrawPage
+ ,public css::form::XFormsSupplier2
+{
+protected:
+
+ // Creating a SdrObject based on a Description. Can be used by derived classes to
+ // support own css::drawing::Shapes (for example Controls)
+ virtual SdrObject *CreateSdrObject_( const css::uno::Reference< css::drawing::XShape > & xShape ) override;
+
+ // The following method is called when a SvxShape object should be created.
+ // Derived classes can create a derivation or an object aggregating SvxShape.
+ virtual css::uno::Reference< css::drawing::XShape > CreateShape( SdrObject *pObj ) const override;
+
+public:
+ SvxFmDrawPage( SdrPage* pPage );
+ virtual ~SvxFmDrawPage() noexcept override;
+
+ // UNO binding
+ DECLARE_UNO3_AGG_DEFAULTS(SvxFmDrawPage, SvxDrawPage)
+
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+
+ // XFormsSupplier
+ virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getForms() override;
+
+ // XFormsSupplier2
+ virtual sal_Bool SAL_CALL hasForms() override;
+};
+
+#endif // INCLUDED_SVX_FMDPAGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmgridcl.hxx b/include/svx/fmgridcl.hxx
new file mode 100644
index 000000000..8f3db081e
--- /dev/null
+++ b/include/svx/fmgridcl.hxx
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_FMGRIDCL_HXX
+#define INCLUDED_SVX_FMGRIDCL_HXX
+
+#include <svx/gridctrl.hxx>
+#include <vcl/transfer.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::container { class XIndexContainer; }
+namespace com::sun::star::container { class XNameAccess; }
+namespace weld { class Menu; }
+
+// FmGridHeader
+
+struct FmGridHeaderData;
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FmGridHeader
+ :public ::svt::EditBrowserHeader
+ ,public DropTargetHelper
+{
+protected:
+ std::unique_ptr<FmGridHeaderData> m_pImpl;
+
+public:
+ FmGridHeader( BrowseBox* pParent, WinBits nWinBits = WB_STDHEADERBAR | WB_DRAG );
+ virtual ~FmGridHeader() override;
+ virtual void dispose() override;
+
+public:
+ // trigger context menu execution
+ void triggerColumnContextMenu( const ::Point& _rPreferredPos );
+
+protected:
+ virtual void Command( const CommandEvent& rCEvt ) override;
+ virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+ virtual void Select() override;
+
+ /** the value returned by GetItemPos is meaningless for the grid model if there are hidden columns,
+ so use GetModelColumnPos instead
+ */
+ sal_uInt16 GetModelColumnPos(sal_uInt16 nId) const;
+
+ /** This is called before executing a context menu for a column. rMenu contains the initial entries
+ handled by this base class' method (which always has to be called).
+ Derived classes may alter the menu in any way and handle any additional entries in
+ PostExecuteColumnContextMenu.
+ All disabled entries will be removed before executing the menu, so be careful with separators
+ near entries you probably wish to disable ...
+ */
+ virtual void PreExecuteColumnContextMenu(sal_uInt16 nColId, weld::Menu& rMenu,
+ weld::Menu& rInsertMenu, weld::Menu& rChangeMenu,
+ weld::Menu& rShowMenu);
+ /** After executing the context menu for a column this method is called.
+ */
+ virtual void PostExecuteColumnContextMenu(sal_uInt16 nColId, const weld::Menu& rMenu, const OString& rExecutionResult);
+
+ // DropTargetHelper
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+
+ /** selects the column at the selection supplier.
+ @param nColumnId
+ The column id.
+ */
+ void notifyColumnSelect(sal_uInt16 nColumnId);
+private:
+ DECL_DLLPRIVATE_LINK( OnAsyncExecuteDrop, void*, void );
+};
+
+
+// FmGridControl
+
+class FmXGridPeer;
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FmGridControl : public DbGridControl
+
+{
+ friend class FmGridHeader;
+ friend class FmXGridPeer;
+
+ FmXGridPeer* m_pPeer;
+ sal_Int32 m_nCurrentSelectedColumn; // this is the column model (not the view) position...
+ sal_uInt16 m_nMarkedColumnId;
+ bool m_bSelecting;
+ bool m_bInColumnMove : 1;
+
+public:
+ FmGridControl(
+ const css::uno::Reference< css::uno::XComponentContext >&,
+ vcl::Window* pParent,
+ FmXGridPeer* _pPeer,
+ WinBits nBits);
+
+ // Window
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+
+ // css::beans::XPropertyChangeListener
+ void propertyChange(const css::beans::PropertyChangeEvent& evt);
+
+ // css::form::XPositioningListener
+ void positioned();
+
+ // XBound
+ bool commit();
+
+ // css::form::XInsertListener
+ void inserted();
+
+ void markColumn(sal_uInt16 nId);
+ bool isColumnMarked(sal_uInt16 nId) const;
+
+ sal_Int32 GetSelectedColumn() const { return m_nCurrentSelectedColumn;}
+
+ /** return the name of the specified object.
+ @param eObjType
+ The type to ask for
+ @param _nPosition
+ The position of a tablecell (index position), header bar column/row cell
+ @return
+ The name of the specified object.
+ */
+ virtual OUString GetAccessibleObjectName( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
+
+ /** return the description of the specified object.
+ @param eObjType
+ The type to ask for
+ @param _nPosition
+ The position of a tablecell (index position), header bar column/row cell
+ @return
+ The description of the specified object.
+ */
+ virtual OUString GetAccessibleObjectDescription( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
+
+protected:
+ virtual void Command(const CommandEvent& rEvt) override;
+
+ virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) override;
+ virtual tools::Long QueryMinimumRowHeight() override;
+ virtual void RowHeightChanged() override;
+ virtual void ColumnResized(sal_uInt16 nId) override;
+ virtual void ColumnMoved(sal_uInt16 nId) override;
+ virtual void DeleteSelectedRows() override;
+ virtual void SetDesignMode(bool bMode) override;
+ virtual void CellModified() override;
+ virtual void HideColumn(sal_uInt16 nId) override;
+ virtual void ShowColumn(sal_uInt16 nId) override;
+
+ bool IsInColumnMove() const {return m_bInColumnMove;}
+
+ virtual void BeginCursorAction() override;
+ virtual void EndCursorAction() override;
+ virtual void Select() override;
+
+ // Initialize columns
+ // a.) only by column description
+ void InitColumnsByModels(const css::uno::Reference< css::container::XIndexContainer >& xColumns);
+ // b.) during alivemode by database fields
+ virtual void InitColumnsByFields(const css::uno::Reference< css::container::XIndexAccess >& xFields) override;
+
+ // some kind of impl version (for one single column) of our version of InitColumnsByFields
+ static void InitColumnByField(
+ DbGridColumn* _pColumn,
+ const css::uno::Reference< css::beans::XPropertySet >& _rxColumnModel,
+ const css::uno::Reference< css::container::XNameAccess >& _rxFieldsByNames,
+ const css::uno::Reference< css::container::XIndexAccess >& _rxFieldsByIndex
+ );
+
+ FmXGridPeer* GetPeer() const {return m_pPeer;}
+
+ css::uno::Sequence< css::uno::Any>
+ getSelectionBookmarks();
+ bool selectBookmarks(const css::uno::Sequence< css::uno::Any>& _rBookmarks);
+
+ /** returns if a column is selected
+ @param _pColumn
+ The column to compare with.
+ @return
+ <TRUE/> if the column is selected, otherwise <FALSE/>
+ */
+ bool isColumnSelected(DbGridColumn const * _pColumn) const;
+};
+
+#endif // INCLUDED_SVX_FMGRIDCL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx
new file mode 100644
index 000000000..668eb1335
--- /dev/null
+++ b/include/svx/fmgridif.hxx
@@ -0,0 +1,534 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_FMGRIDIF_HXX
+#define INCLUDED_SVX_FMGRIDIF_HXX
+
+#include <svx/svxdllapi.h>
+
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/sdbc/XRowSetListener.hpp>
+#include <com/sun/star/sdb/XRowSetSupplier.hpp>
+#include <com/sun/star/form/XResetListener.hpp>
+#include <com/sun/star/form/XBoundComponent.hpp>
+#include <com/sun/star/form/XLoadListener.hpp>
+#include <com/sun/star/form/XGridControl.hpp>
+#include <com/sun/star/form/XGridPeer.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/util/XModeSelector.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+
+#include <tools/wintypes.hxx>
+#include <toolkit/controls/unocontrol.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/servicehelper.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/implbase10.hxx>
+#include <memory>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::uno { class XComponentContext; }
+
+class DbGridColumn;
+enum class DbGridControlNavigationBarState;
+
+class SAL_WARN_UNUSED OWeakSubObject : public ::cppu::OWeakObject
+{
+protected:
+ ::cppu::OWeakObject& m_rParent;
+
+public:
+ OWeakSubObject(::cppu::OWeakObject& rParent) : m_rParent(rParent) { }
+
+ virtual void SAL_CALL acquire() noexcept override { m_rParent.acquire(); }
+ virtual void SAL_CALL release() noexcept override { m_rParent.release(); }
+};
+
+
+// FmXModifyMultiplexer
+
+class SAL_WARN_UNUSED FmXModifyMultiplexer final : public OWeakSubObject
+ ,public ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener>
+ ,public css::util::XModifyListener
+{
+public:
+ FmXModifyMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS(FmXModifyMultiplexer,OWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+// css::lang::XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+// css::util::XModifyListener
+ virtual void SAL_CALL modified(const css::lang::EventObject& Source) override;
+
+// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators
+ using OWeakSubObject::operator new;
+ using OWeakSubObject::operator delete;
+};
+
+
+// FmXUpdateMultiplexer
+
+class SAL_WARN_UNUSED FmXUpdateMultiplexer final : public OWeakSubObject,
+ public ::comphelper::OInterfaceContainerHelper3<css::form::XUpdateListener>,
+ public css::form::XUpdateListener
+{
+public:
+ FmXUpdateMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS(FmXUpdateMultiplexer,OWeakSubObject)
+
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+// css::lang::XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+// css::form::XUpdateListener
+ virtual sal_Bool SAL_CALL approveUpdate(const css::lang::EventObject &) override;
+ virtual void SAL_CALL updated(const css::lang::EventObject &) override;
+
+// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators
+ using OWeakSubObject::operator new;
+ using OWeakSubObject::operator delete;
+};
+
+
+// FmXSelectionMultiplexer
+
+class SAL_WARN_UNUSED FmXSelectionMultiplexer final : public OWeakSubObject
+ ,public ::comphelper::OInterfaceContainerHelper3<css::view::XSelectionChangeListener>
+ ,public css::view::XSelectionChangeListener
+{
+public:
+ FmXSelectionMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS(FmXSelectionMultiplexer, OWeakSubObject)
+
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+// css::lang::XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+// css::view::XSelectionChangeListener
+ virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override;
+
+// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators
+ using OWeakSubObject::operator new;
+ using OWeakSubObject::operator delete;
+};
+
+
+// FmXGridControlMultiplexer
+
+class SAL_WARN_UNUSED FmXGridControlMultiplexer final : public OWeakSubObject
+ ,public ::comphelper::OInterfaceContainerHelper3<css::form::XGridControlListener>
+ ,public css::form::XGridControlListener
+{
+public:
+ FmXGridControlMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS( FmXGridControlMultiplexer, OWeakSubObject )
+
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+// css::lang::XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+// css::view::XSelectionChangeListener
+ virtual void SAL_CALL columnChanged( const css::lang::EventObject& _event ) override;
+
+// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators
+ using OWeakSubObject::operator new;
+ using OWeakSubObject::operator delete;
+};
+
+
+// FmXContainerMultiplexer
+
+class SAL_WARN_UNUSED FmXContainerMultiplexer final : public OWeakSubObject,
+ public ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener>,
+ public css::container::XContainerListener
+{
+public:
+ FmXContainerMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(FmXContainerMultiplexer,OWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+// css::lang::XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+// css::container::XContainerListener
+ virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& Event) override;
+ virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& Event) override;
+ virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& Event) override;
+
+// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators
+ using OWeakSubObject::operator new;
+ using OWeakSubObject::operator delete;
+};
+
+
+// FmXGridControl
+
+typedef ::cppu::ImplHelper10< css::form::XBoundComponent,
+ css::form::XGridControl,
+ css::util::XModifyBroadcaster,
+ css::container::XIndexAccess,
+ css::container::XEnumerationAccess,
+ css::util::XModeSelector,
+ css::container::XContainer,
+ css::frame::XDispatchProvider,
+ css::frame::XDispatchProviderInterception,
+ css::view::XSelectionSupplier
+ > FmXGridControl_BASE;
+
+class FmXGridPeer;
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FmXGridControl :public UnoControl
+ ,public FmXGridControl_BASE
+{
+ FmXModifyMultiplexer m_aModifyListeners;
+ FmXUpdateMultiplexer m_aUpdateListeners;
+ FmXContainerMultiplexer m_aContainerListeners;
+ FmXSelectionMultiplexer m_aSelectionListeners;
+ FmXGridControlMultiplexer m_aGridControlListeners;
+
+protected:
+ bool m_bInDraw;
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+public:
+ FmXGridControl(const css::uno::Reference< css::uno::XComponentContext >&);
+ virtual ~FmXGridControl() override;
+
+ // UNO binding
+ DECLARE_UNO3_AGG_DEFAULTS(FmXGridControl, UnoControl)
+ virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type& _rType) override;
+
+// XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type> SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;
+
+// css::lang::XComponent
+ virtual void SAL_CALL dispose() override;
+
+// css::lang::XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+// css::awt::XControl
+ virtual void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit >& _rToolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent) override;
+ virtual sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel >& Model) override;
+ virtual void SAL_CALL setDesignMode(sal_Bool bOn) override;
+
+// css::awt::XView
+ virtual void SAL_CALL draw( sal_Int32 x, sal_Int32 y ) override;
+
+// css::form::XBoundComponent
+ virtual void SAL_CALL addUpdateListener(const css::uno::Reference< css::form::XUpdateListener >& l) override;
+ virtual void SAL_CALL removeUpdateListener(const css::uno::Reference< css::form::XUpdateListener >& l) override;
+ virtual sal_Bool SAL_CALL commit() override;
+
+// css::container::XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType( ) override;
+ virtual sal_Bool SAL_CALL hasElements( ) override;
+
+// css::container::XEnumerationAccess
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override;
+
+// css::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() override;
+ virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) override;
+
+// css::form::XGridControl
+ virtual void SAL_CALL addGridControlListener( const css::uno::Reference< css::form::XGridControlListener >& _listener ) override;
+ virtual void SAL_CALL removeGridControlListener( const css::uno::Reference< css::form::XGridControlListener >& _listener ) override;
+
+// css::form::XGrid (base of XGridControl)
+ virtual sal_Int16 SAL_CALL getCurrentColumnPosition() override;
+ virtual void SAL_CALL setCurrentColumnPosition(sal_Int16 nPos) override;
+
+// css::form::XGridFieldDataSupplier (base of XGridControl)
+ virtual css::uno::Sequence< sal_Bool > SAL_CALL queryFieldDataType( const css::uno::Type& xType ) override;
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL queryFieldData( sal_Int32 nRow, const css::uno::Type& xType ) override;
+
+// UnoControl
+ virtual OUString GetComponentServiceName() const override;
+
+// css::util::XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener >& l) override;
+ virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener >& l) override;
+
+// css::util::XModeSelector
+ virtual void SAL_CALL setMode(const OUString& Mode) override;
+ virtual OUString SAL_CALL getMode() override;
+ virtual css::uno::Sequence< OUString> SAL_CALL getSupportedModes() override;
+ virtual sal_Bool SAL_CALL supportsMode(const OUString& Mode) override;
+
+// css::container::XContainer
+ virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener >& l) override;
+ virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener >& l) override;
+
+// css::frame::XDispatchProvider
+ virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags) override;
+ virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor >& aDescripts) override;
+
+// css::frame::XDispatchProviderInterception
+ virtual void SAL_CALL registerDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) override;
+ virtual void SAL_CALL releaseDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) override;
+
+// css::view::XSelectionSupplier
+ virtual sal_Bool SAL_CALL select( const css::uno::Any& aSelection ) override;
+ virtual css::uno::Any SAL_CALL getSelection( ) override;
+ virtual void SAL_CALL addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
+ virtual void SAL_CALL removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
+
+// css::awt::XWindow
+ virtual void SAL_CALL setFocus() override;
+
+protected:
+ virtual rtl::Reference<FmXGridPeer> imp_CreatePeer(vcl::Window* pParent);
+ // ImplCreatePeer would be better, but doesn't work because it's not exported
+};
+
+// FmXGridPeer -> Peer for the Gridcontrol
+class FmGridControl;
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FmXGridPeer:
+ public cppu::ImplInheritanceHelper<
+ VCLXWindow,
+ css::form::XGridPeer,
+ css::form::XBoundComponent,
+ css::form::XGridControl,
+ css::sdb::XRowSetSupplier,
+ css::util::XModifyBroadcaster,
+ css::beans::XPropertyChangeListener,
+ css::container::XContainerListener,
+ css::sdbc::XRowSetListener,
+ css::form::XLoadListener,
+ css::view::XSelectionChangeListener,
+ css::container::XIndexAccess,
+ css::container::XEnumerationAccess,
+ css::util::XModeSelector,
+ css::container::XContainer,
+ css::frame::XStatusListener,
+ css::frame::XDispatchProvider,
+ css::frame::XDispatchProviderInterception,
+ css::form::XResetListener,
+ css::view::XSelectionSupplier>
+{
+protected:
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ ::osl::Mutex m_aMutex;
+
+private:
+ css::uno::Reference< css::container::XIndexContainer > m_xColumns;
+ css::uno::Reference< css::sdbc::XRowSet > m_xCursor;
+ ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener> m_aModifyListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::form::XUpdateListener> m_aUpdateListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener> m_aContainerListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::view::XSelectionChangeListener> m_aSelectionListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::form::XGridControlListener> m_aGridControlListeners;
+
+ OUString m_aMode;
+ sal_Int32 m_nCursorListening;
+
+ css::uno::Reference< css::frame::XDispatchProviderInterceptor > m_xFirstDispatchInterceptor;
+
+ bool m_bInterceptingDispatch;
+
+ std::unique_ptr<bool[]> m_pStateCache;
+ // one bool for each supported url
+ std::unique_ptr<css::uno::Reference< css::frame::XDispatch >[]> m_pDispatchers;
+ // one dispatcher for each supported url
+ // (I would like to have a vector here but including the stl in an exported file seems
+ // very risky to me...)
+
+ class SAL_DLLPRIVATE GridListenerDelegator;
+ friend class GridListenerDelegator;
+ std::unique_ptr<GridListenerDelegator> m_pGridListener;
+
+public:
+ FmXGridPeer(const css::uno::Reference< css::uno::XComponentContext >&);
+ virtual ~FmXGridPeer() override;
+
+ // late constructor, to always be called after the real constructor!
+ void Create(vcl::Window* pParent, WinBits nStyle);
+
+// css::lang::XUnoTunnel
+ UNO3_GETIMPLEMENTATION_DECL(FmXGridPeer)
+
+// css::form::XGridPeer
+ virtual css::uno::Reference< css::container::XIndexContainer > SAL_CALL getColumns( ) override;
+ virtual void SAL_CALL setColumns( const css::uno::Reference< css::container::XIndexContainer >& aColumns ) override final;
+
+// css::lang::XComponent
+ virtual void SAL_CALL dispose() override;
+
+// css::lang::XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+// css::form::XBoundComponent
+ virtual void SAL_CALL addUpdateListener(const css::uno::Reference< css::form::XUpdateListener >& l) override;
+ virtual void SAL_CALL removeUpdateListener(const css::uno::Reference< css::form::XUpdateListener >& l) override;
+ virtual sal_Bool SAL_CALL commit() override;
+
+// css::container::XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType( ) override;
+ virtual sal_Bool SAL_CALL hasElements( ) override;
+
+// css::container::XEnumerationAccess
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override;
+
+// css::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() override;
+ virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) override;
+
+// css::beans::XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override;
+
+// css::form::XLoadListener
+ virtual void SAL_CALL loaded(const css::lang::EventObject& rEvent) override;
+ virtual void SAL_CALL unloaded(const css::lang::EventObject& rEvent) override;
+ virtual void SAL_CALL unloading(const css::lang::EventObject& aEvent) override;
+ virtual void SAL_CALL reloading(const css::lang::EventObject& aEvent) override;
+ virtual void SAL_CALL reloaded(const css::lang::EventObject& aEvent) override;
+
+// css::sdbc::XRowSetListener
+ virtual void SAL_CALL cursorMoved(const css::lang::EventObject& event) override;
+ virtual void SAL_CALL rowChanged(const css::lang::EventObject& event) override;
+ virtual void SAL_CALL rowSetChanged(const css::lang::EventObject& event) override;
+
+// css::container::XContainerListener
+ virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& Event) override;
+ virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& Event) override;
+ virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& Event) override;
+
+// VCLXWindow
+ virtual void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ virtual css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ CreateAccessibleContext() override;
+
+// css::form::XGridControl
+ virtual void SAL_CALL addGridControlListener( const css::uno::Reference< css::form::XGridControlListener >& _listener ) override;
+ virtual void SAL_CALL removeGridControlListener( const css::uno::Reference< css::form::XGridControlListener >& _listener ) override;
+
+// css::form::XGrid (base of XGridControl)
+ virtual sal_Int16 SAL_CALL getCurrentColumnPosition() override;
+ virtual void SAL_CALL setCurrentColumnPosition(sal_Int16 nPos) override;
+
+// css::form::XGridFieldDataSupplier (base of XGridControl)
+ virtual css::uno::Sequence< sal_Bool > SAL_CALL queryFieldDataType( const css::uno::Type& xType ) override;
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL queryFieldData( sal_Int32 nRow, const css::uno::Type& xType ) override;
+
+// css::sdb::XRowSetSupplier
+ virtual css::uno::Reference< css::sdbc::XRowSet > SAL_CALL getRowSet() override;
+ virtual void SAL_CALL setRowSet(const css::uno::Reference< css::sdbc::XRowSet >& xDataSource) override final;
+
+// css::util::XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener >& l) override;
+ virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener >& l) override;
+
+// UnoControl
+ virtual void SAL_CALL setDesignMode(sal_Bool bOn) override;
+ virtual sal_Bool SAL_CALL isDesignMode() override;
+
+// css::view::XSelectionChangeListener
+ virtual void SAL_CALL selectionChanged(const css::lang::EventObject& aEvent) override;
+
+ void CellModified();
+
+// PropertyListening
+ void updateGrid(const css::uno::Reference< css::sdbc::XRowSet >& _rDatabaseCursor);
+ void startCursorListening();
+ void stopCursorListening();
+
+// css::util::XModeSelector
+ virtual void SAL_CALL setMode(const OUString& Mode) override;
+ virtual OUString SAL_CALL getMode() override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedModes() override;
+ virtual sal_Bool SAL_CALL supportsMode(const OUString& Mode) override;
+
+// css::container::XContainer
+ virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener >& l) override;
+ virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener >& l) override;
+
+ void columnVisible(DbGridColumn const * pColumn);
+ void columnHidden(DbGridColumn const * pColumn);
+
+// css::awt::XView
+ virtual void SAL_CALL draw( sal_Int32 x, sal_Int32 y ) override;
+
+// css::frame::XDispatchProvider
+ virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags) override;
+ virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor >& aDescripts) override;
+
+// css::frame::XDispatchProviderInterception
+ virtual void SAL_CALL registerDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) override;
+ virtual void SAL_CALL releaseDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) override;
+
+// css::frame::XStatusListener
+ virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override;
+
+// css::form::XResetListener
+ virtual sal_Bool SAL_CALL approveReset(const css::lang::EventObject& rEvent) override;
+ virtual void SAL_CALL resetted(const css::lang::EventObject& rEvent) override;
+
+// css::view::XSelectionSupplier
+ virtual sal_Bool SAL_CALL select( const css::uno::Any& aSelection ) override;
+ virtual css::uno::Any SAL_CALL getSelection( ) override;
+ virtual void SAL_CALL addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
+ virtual void SAL_CALL removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
+
+protected:
+ virtual VclPtr<FmGridControl> imp_CreateControl(vcl::Window* pParent, WinBits nStyle);
+
+ static css::uno::Sequence< css::util::URL>& getSupportedURLs();
+ static const std::vector<DbGridControlNavigationBarState>& getSupportedGridSlots();
+ void ConnectToDispatcher();
+ void DisConnectFromDispatcher();
+ void UpdateDispatches(); // will connect if not already connected and just update else
+
+ /** If a derived class wants to listen at some column properties, it doesn't have
+ to override all methods affecting columns (setColumns, elementInserted, elementRemoved ...)
+ Instead it may use addColumnListeners and removeColumnListeners which are called in all
+ the cases.
+ */
+ void addColumnListeners(const css::uno::Reference< css::beans::XPropertySet >& xCol);
+ void removeColumnListeners(const css::uno::Reference< css::beans::XPropertySet >& xCol);
+
+ void selectionChanged();
+ void columnChanged();
+
+ DECL_DLLPRIVATE_LINK(OnQueryGridSlotState, DbGridControlNavigationBarState, int);
+ DECL_DLLPRIVATE_LINK(OnExecuteGridSlot, DbGridControlNavigationBarState, bool);
+};
+
+
+#endif // _SVX_FMGRID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmmodel.hxx b/include/svx/fmmodel.hxx
new file mode 100644
index 000000000..15577d1dc
--- /dev/null
+++ b/include/svx/fmmodel.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FMMODEL_HXX
+#define INCLUDED_SVX_FMMODEL_HXX
+
+#include <svx/svdmodel.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+class SfxObjectShell;
+class SfxItemPool;
+class FmXUndoEnvironment;
+
+struct FmFormModelImplData;
+class SVXCORE_DLLPUBLIC FmFormModel :
+ public SdrModel
+{
+private:
+ std::unique_ptr<FmFormModelImplData> m_pImpl;
+ SfxObjectShell* m_pObjShell;
+
+ bool m_bOpenInDesignMode : 1;
+ bool m_bAutoControlFocus : 1;
+
+ FmFormModel( const FmFormModel& ) = delete;
+ void operator=(const FmFormModel& rSrcModel) = delete;
+
+public:
+ FmFormModel(
+ SfxItemPool* pPool = nullptr,
+ SfxObjectShell* pPers = nullptr);
+
+ virtual ~FmFormModel() override;
+
+ virtual rtl::Reference<SdrPage> AllocPage(bool bMasterPage) override;
+ virtual void InsertPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF) override;
+ virtual rtl::Reference<SdrPage> RemovePage(sal_uInt16 nPgNum) override;
+ virtual void InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF) override;
+ virtual rtl::Reference<SdrPage> RemoveMasterPage(sal_uInt16 nPgNum) override;
+
+ SfxObjectShell* GetObjectShell() const { return m_pObjShell; }
+ void SetObjectShell( SfxObjectShell* pShell );
+
+ bool GetOpenInDesignMode() const { return m_bOpenInDesignMode; }
+ void SetOpenInDesignMode( bool _bOpenDesignMode );
+
+ bool GetAutoControlFocus() const { return m_bAutoControlFocus; }
+ void SetAutoControlFocus( bool _bAutoControlFocus );
+
+ /** check whether the OpenInDesignMode has been set explicitly or been loaded (<FALSE/>)
+ or if it still has the default value from construction (<TRUE/>)
+ */
+ bool OpenInDesignModeIsDefaulted();
+
+ /** determines whether form controls should use the SdrModel's reference device for text rendering
+ */
+ bool ControlsUseRefDevice() const;
+
+ FmXUndoEnvironment& GetUndoEnv();
+
+private:
+ void implSetOpenInDesignMode( bool _bOpenDesignMode );
+};
+
+#endif // _FM_FMMODEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmobjfac.hxx b/include/svx/fmobjfac.hxx
new file mode 100644
index 000000000..f165cf7b2
--- /dev/null
+++ b/include/svx/fmobjfac.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FMOBJFAC_HXX
+#define INCLUDED_SVX_FMOBJFAC_HXX
+
+#include <tools/link.hxx>
+#include <svx/svxdllapi.h>
+
+class SdrObject;
+struct SdrObjCreatorParams;
+
+class SVX_DLLPUBLIC FmFormObjFactory
+{
+public:
+ FmFormObjFactory();
+
+ DECL_DLLPRIVATE_STATIC_LINK(FmFormObjFactory, MakeObject, SdrObjCreatorParams, SdrObject*);
+};
+
+#endif // _FM_FMOBJFAC_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmpage.hxx b/include/svx/fmpage.hxx
new file mode 100644
index 000000000..f8b3c11cb
--- /dev/null
+++ b/include/svx/fmpage.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FMPAGE_HXX
+#define INCLUDED_SVX_FMPAGE_HXX
+
+#include <memory>
+#include <svx/svdpage.hxx>
+#include <svx/svxdllapi.h>
+
+class FmFormModel;
+class FmFormPageImpl; // contains a list of all forms
+
+namespace com::sun::star {
+ namespace form {
+ class XForms;
+ }
+}
+
+class SdrView;
+class HelpEvent;
+
+class SVXCORE_DLLPUBLIC FmFormPage : public SdrPage
+{
+ FmFormPage& operator=(const FmFormPage&) = delete;
+ FmFormPage(const FmFormPage&) = delete;
+
+ friend class FmFormObj;
+ std::unique_ptr<FmFormPageImpl> m_pImpl;
+ OUString m_sPageName;
+
+public:
+
+ explicit FmFormPage(FmFormModel& rModel, bool bMasterPage=false);
+ virtual ~FmFormPage() override;
+
+ virtual rtl::Reference<SdrPage> CloneSdrPage(SdrModel& rTargetModel) const override;
+
+ virtual void InsertObject(SdrObject* pObj, size_t nPos = SAL_MAX_SIZE) override;
+
+ virtual SdrObject* RemoveObject(size_t nObjNum) override;
+
+ // access to all forms
+ const css::uno::Reference< css::form::XForms>& GetForms( bool _bForceCreate = true ) const;
+
+ FmFormPageImpl& GetImpl() const { return *m_pImpl; }
+
+public:
+ const OUString& GetName() const { return m_sPageName; }
+ void SetName( const OUString& rName ) { m_sPageName = rName; }
+ static bool RequestHelp(
+ vcl::Window* pWin,
+ SdrView const * pView,
+ const HelpEvent& rEvt );
+
+protected:
+ // lateInit -> copyValuesToClonedInstance (?)
+ void lateInit(const FmFormPage& rPage);
+};
+
+#endif // INCLUDED_SVX_FMPAGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmsearch.hxx b/include/svx/fmsearch.hxx
new file mode 100644
index 000000000..bb0d303d1
--- /dev/null
+++ b/include/svx/fmsearch.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FMSEARCH_HXX
+#define INCLUDED_SVX_FMSEARCH_HXX
+
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <vector>
+
+namespace com::sun::star::sdbc { class XResultSet; }
+
+// Helper methods
+
+SVXCORE_DLLPUBLIC bool IsSearchableControl( const css::uno::Reference< css::uno::XInterface>& _xControl,
+ OUString* pCurrentText = nullptr);
+ // check if the control has one of the interfaces we can use for searching
+ // *pCurrentText will be filled with the current text of the control (as used when searching this control)
+
+
+// Helper structs
+
+struct FmFoundRecordInformation
+{
+ css::uno::Any aPosition; // bookmark of the record in which the text was found
+ sal_Int16 nFieldPos; // ditto: the relative position of the column (in the string name of the field list in the constructor)
+ sal_Int16 nContext; // the context in which was searched and found (if the current search knows several contexts)
+};
+
+// FmSearchContext - information for the search in different contexts
+
+struct FmSearchContext
+{
+ // [in]
+ sal_Int16 nContext; // the number of the context
+ // [out]
+ css::uno::Reference< css::sdbc::XResultSet>
+ xCursor; // the iterator for the context
+ OUString strUsedFields; // a list of field names separated by ';'
+ ::std::vector< css::uno::Reference< css::uno::XInterface > >
+ arrFields; // the corresponding text interfaces for the fields in strUsedFields
+ OUString sFieldDisplayNames; // if not empty: names to be displayed for the searchable fields (must have the same token count as strUsedFields!)
+};
+
+#endif // INCLUDED_SVX_FMSEARCH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmshell.hxx b/include/svx/fmshell.hxx
new file mode 100644
index 000000000..765f4eabc
--- /dev/null
+++ b/include/svx/fmshell.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_FMSHELL_HXX
+#define INCLUDED_SVX_FMSHELL_HXX
+
+// ***************************************************************************************************
+// ***************************************************************************************************
+// ***************************************************************************************************
+
+#include <memory>
+#include <rtl/ref.hxx>
+#include <sfx2/shell.hxx>
+#include <vcl/outdev.hxx>
+
+#include <svx/svxdllapi.h>
+#include <svx/ifaceids.hxx>
+#include <svl/hint.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+class FmFormModel;
+class FmFormPage;
+class FmXFormShell;
+class FmFormView;
+class SdrView;
+class SdrUnoObj;
+class LinkParamNone;
+
+namespace com::sun::star::form {
+ class XForm;
+ namespace runtime {
+ class XFormController;
+ }
+}
+
+namespace com::sun::star::awt { class XControl; }
+namespace com::sun::star::awt { class XControlModel; }
+template <typename Arg, typename Ret> class Link;
+
+namespace svx
+{
+ class ISdrObjectFilter;
+}
+
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FmDesignModeChangedHint final : public SfxHint
+{
+ bool m_bDesignMode;
+
+public:
+ FmDesignModeChangedHint( bool bDesMode );
+ virtual ~FmDesignModeChangedHint() override;
+
+ bool GetDesignMode() const { return m_bDesignMode; }
+};
+
+class SVXCORE_DLLPUBLIC FmFormShell final : public SfxShell
+{
+ friend class FmFormView;
+ friend class FmXFormShell;
+
+ rtl::Reference<FmXFormShell> m_pImpl;
+ FmFormView* m_pFormView;
+ FmFormModel* m_pFormModel;
+
+ sal_uInt16 m_nLastSlot;
+ bool m_bDesignMode : 1;
+ bool m_bHasForms : 1; // flag storing if the forms on a page exist,
+ // only for the DesignMode, see UIFeatureChanged!
+
+ // the marks of a FormView have changed...
+ void NotifyMarkListChanged(FmFormView*);
+ // (the FormView itself is not a broadcaster, therefore it can't always correctly notify the
+ // form explorer who is interested in the event)
+
+public:
+ SFX_DECL_INTERFACE(SVX_INTERFACE_FORM_SH)
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl();
+
+public:
+ FmFormShell(SfxViewShell* pParent, FmFormView* pView = nullptr);
+ virtual ~FmFormShell() override;
+
+ void Execute( SfxRequest& );
+ void GetState( SfxItemSet& );
+ virtual bool HasUIFeature(SfxShellFeature nFeature) const override;
+
+ void ExecuteTextAttribute( SfxRequest& );
+ void GetTextAttributeState( SfxItemSet& );
+
+ bool GetY2KState(sal_uInt16& nReturn);
+ void SetY2KState(sal_uInt16 n);
+
+ void SetView(FmFormView* pView);
+
+ FmFormView* GetFormView() const { return m_pFormView; }
+ FmFormModel* GetFormModel() const { return m_pFormModel; }
+ FmFormPage* GetCurPage() const;
+ FmXFormShell* GetImpl() const {return m_pImpl.get();};
+
+ bool PrepareClose(bool bUI = true);
+
+ bool IsActiveControl() const;
+ void ForgetActiveControl();
+ void SetControlActivationHandler( const Link<LinkParamNone*,void>& _rHdl );
+
+ virtual void Activate(bool bMDI) override;
+ virtual void Deactivate(bool bMDI) override;
+
+ // helper methods for implementing XFormLayerAccess
+ SdrUnoObj* GetFormControl(
+ const css::uno::Reference< css::awt::XControlModel >& _rxModel,
+ const SdrView& _rView,
+ const OutputDevice& _rDevice,
+ css::uno::Reference< css::awt::XControl >& _out_rxControl
+ ) const;
+
+ static css::uno::Reference< css::form::runtime::XFormController > GetFormController(
+ const css::uno::Reference< css::form::XForm >& _rxForm,
+ const SdrView& _rView,
+ const OutputDevice& _rDevice
+ );
+
+ /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus
+ to the control belonging to the given SdrUnoObj.
+ */
+ void ToggleControlFocus(
+ const SdrUnoObj& i_rNextCandidate,
+ const SdrView& i_rView,
+ const OutputDevice& i_rDevice
+ ) const;
+
+ static ::std::unique_ptr< svx::ISdrObjectFilter >
+ CreateFocusableControlFilter(
+ const SdrView& i_rView,
+ const OutputDevice& i_rDevice
+ );
+
+ virtual bool IsDesignMode() const override { return m_bDesignMode; }
+ void SetDesignMode( bool _bDesignMode );
+
+private:
+ void GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich);
+
+ // is there a form on the current page?
+ void DetermineForms(bool bInvalidate);
+ void impl_setDesignMode( bool bDesign);
+};
+
+#endif // INCLUDED_SVX_FMSHELL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmsrccfg.hxx b/include/svx/fmsrccfg.hxx
new file mode 100644
index 000000000..ea8e80fe7
--- /dev/null
+++ b/include/svx/fmsrccfg.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FMSRCCFG_HXX
+#define INCLUDED_SVX_FMSRCCFG_HXX
+
+#include <unotools/configvaluecontainer.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <svx/svxdllapi.h>
+
+enum class TransliterationFlags;
+
+#define MATCHING_ANYWHERE 0
+#define MATCHING_BEGINNING 1
+#define MATCHING_END 2
+#define MATCHING_WHOLETEXT 3
+
+// this constants should NOT be just changed, since the SearchDialog performs no conversion of the settings of
+// its ListBox, but instead just passes them along to the appropriate methods of SearchEngine
+// (so if you change the constants or the order of the listbox entries in the dialog, then the other has
+// to be adapted)
+
+
+namespace svxform
+{
+
+
+ // = struct FmSearchParams - parameters of a search
+
+
+ struct SVX_DLLPUBLIC FmSearchParams
+ {
+ protected:
+ TransliterationFlags
+ nTransliterationFlags;
+ // they're way too sensitive for direct access...
+
+ public:
+ // no bit fields at all (want to pass the addresses to the OConfigurationValueContainer)
+ css::uno::Sequence< OUString >
+ aHistory;
+ OUString sSingleSearchField;
+
+ sal_Int16 nSearchForType;
+ sal_Int16 nPosition;
+ sal_Int16 nLevOther;
+ sal_Int16 nLevShorter;
+ sal_Int16 nLevLonger;
+ bool bLevRelaxed;
+
+ bool bAllFields;
+ bool bUseFormatter;
+ bool bBackwards;
+ bool bWildcard;
+ bool bRegular;
+ bool bApproxSearch;
+ // the last three are mutually exclusive
+
+ bool bSoundsLikeCJK;
+
+
+ FmSearchParams();
+
+ bool isIgnoreWidthCJK( ) const;
+
+ TransliterationFlags
+ getTransliterationFlags( ) const { return nTransliterationFlags; }
+ void setTransliterationFlags( TransliterationFlags _nFlags ) { nTransliterationFlags = _nFlags; }
+
+ bool isCaseSensitive( ) const;
+ void setCaseSensitive( bool _bCase );
+ };
+
+
+ // = class FmSearchConfigItem - a ConfigItem, that remembers search parameters
+
+
+ class SAL_WARN_UNUSED SVX_DLLPUBLIC FmSearchConfigItem
+ :protected FmSearchParams
+ ,public ::utl::OConfigurationValueContainer
+ // order matters!
+ {
+ private:
+ ::osl::Mutex m_aMutex;
+
+ // wrapper properties:
+ // some of the members of FmSearchParams are must be translated to be stored in the configuration
+ OUString m_sSearchForType;
+ OUString m_sSearchPosition;
+
+ bool m_bIsMatchCase;
+ bool m_bIsMatchFullHalfWidthForms;
+ bool m_bIsMatchHiraganaKatakana;
+ bool m_bIsMatchContractions;
+ bool m_bIsMatchMinusDashCho_on;
+ bool m_bIsMatchRepeatCharMarks;
+ bool m_bIsMatchVariantFormKanji;
+ bool m_bIsMatchOldKanaForms;
+ bool m_bIsMatch_DiZi_DuZu;
+ bool m_bIsMatch_BaVa_HaFa;
+ bool m_bIsMatch_TsiThiChi_DhiZi;
+ bool m_bIsMatch_HyuIyu_ByuVyu;
+ bool m_bIsMatch_SeShe_ZeJe;
+ bool m_bIsMatch_IaIya;
+ bool m_bIsMatch_KiKu;
+ bool m_bIsIgnorePunctuation;
+ bool m_bIsIgnoreWhitespace;
+ bool m_bIsIgnoreProlongedSoundMark;
+ bool m_bIsIgnoreMiddleDot;
+
+ public:
+ FmSearchConfigItem();
+ ~FmSearchConfigItem();
+
+ const FmSearchParams& getParams( ) const;
+ void setParams( const FmSearchParams& _rParams );
+
+ private:
+ SVX_DLLPRIVATE void implTranslateFromConfig( );
+ SVX_DLLPRIVATE void implTranslateToConfig( );
+ };
+
+
+}
+
+
+#endif // INCLUDED_SVX_FMSRCCFG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmsrcimp.hxx b/include/svx/fmsrcimp.hxx
new file mode 100644
index 000000000..fdcf12fa3
--- /dev/null
+++ b/include/svx/fmsrcimp.hxx
@@ -0,0 +1,350 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FMSRCIMP_HXX
+#define INCLUDED_SVX_FMSRCIMP_HXX
+
+#include <svx/fmtools.hxx>
+#include <svx/svxdllapi.h>
+
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+
+#include <cppuhelper/implbase.hxx>
+#include <unotools/charclass.hxx>
+#include <unotools/collatorwrapper.hxx>
+#include <tools/link.hxx>
+
+#include <atomic>
+#include <deque>
+#include <memory>
+#include <string_view>
+#include <vector>
+
+namespace com::sun::star::awt { class XCheckBox; }
+namespace com::sun::star::awt { class XListBox; }
+namespace com::sun::star::awt { class XTextComponent; }
+namespace com::sun::star::sdb { class XColumn; }
+
+enum class TransliterationFlags;
+
+/**
+ * struct FmSearchProgress - the owner of SearchEngine receives this structure for status updates
+ * (at the end of the search)
+ */
+struct FmSearchProgress
+{
+ enum class State { Progress, ProgressCounting, Canceled, Successful, NothingFound, Error };
+ // (move to new record; progress during counting of records; cancelled; record found; nothing found;
+ // any non-processable error)
+ State aSearchState;
+
+ // current record - always valid (e.g. of interest for continuing search in case of cancellation)
+ sal_uInt32 nCurrentRecord;
+ // Overflow - only valid in case of STATE_PROGRESS
+ bool bOverflow;
+
+ // the position of the search cursor - valid in case of STATE_SUCCESSFUL, STATE_CANCELED and STATE_NOTHING_FOUND
+ css::uno::Any aBookmark;
+ // the field, in which the text was found - valid in case of STATE_SUCCESSFUL
+ sal_Int32 nFieldIndex;
+};
+
+/**
+ * class FmRecordCountListener - utility class for FmSearchEngine, listens at a certain cursor and provides
+ * the differences in RecordCount
+ */
+// workaround for incremental linking bugs in MSVC2019
+class SAL_DLLPUBLIC_TEMPLATE FmRecordCountListener_Base : public cppu::WeakImplHelper< css::beans::XPropertyChangeListener > {};
+class SAL_WARN_UNUSED FmRecordCountListener final : public FmRecordCountListener_Base
+{
+// attribute
+ Link<sal_Int32,void> m_lnkWhoWantsToKnow;
+ css::uno::Reference< css::beans::XPropertySet > m_xListening;
+
+// attribute access
+public:
+ void SetPropChangeHandler(const Link<sal_Int32,void>& lnk);
+
+// methods
+public:
+ FmRecordCountListener(const css::uno::Reference< css::sdbc::XResultSet >& dbcCursor);
+ // the set has to support the sdb::ResultSet service
+ virtual ~FmRecordCountListener() override;
+
+ // DECLARE_UNO3_AGG_DEFAULTS(FmPropertyListener, UsrObject)
+ // virtual sal_Bool queryInterface(css::uno::Uik aUik, css::uno::Reference< css::uno::XInterface >& rOut);
+
+ // css::lang::XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ // css::beans::XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override;
+
+ void DisConnect();
+
+private:
+ void NotifyCurrentCount();
+
+};
+
+/**
+ * class FmSearchEngine - Impl class for FmSearchDialog
+ */
+namespace svxform {
+ // We have three possible control types we may search in, determined by the supported interfaces : css::awt::XTextComponent,
+ // css::awt::XListBox, css::awt::XCheckBox.
+ // While searching we don't want to do this distinction for every control in every round. So we need some helpers.
+ class SAL_WARN_UNUSED ControlTextWrapper
+ {
+ // attributes
+ css::uno::Reference< css::uno::XInterface > m_xControl;
+ // attribute access
+ public:
+ const css::uno::Reference< css::uno::XInterface >& getControl() const{ return m_xControl; }
+ public:
+ ControlTextWrapper(const css::uno::Reference< css::uno::XInterface >& _xControl) { m_xControl = _xControl; }
+ virtual ~ControlTextWrapper() { }
+
+ virtual OUString getCurrentText() const = 0;
+ };
+
+ class SAL_WARN_UNUSED SimpleTextWrapper final : public ControlTextWrapper
+ {
+ css::uno::Reference< css::awt::XTextComponent > m_xText;
+ public:
+ SimpleTextWrapper(const css::uno::Reference< css::awt::XTextComponent >& _xText);
+ virtual OUString getCurrentText() const override;
+ };
+
+ class SAL_WARN_UNUSED ListBoxWrapper final : public ControlTextWrapper
+ {
+ css::uno::Reference< css::awt::XListBox > m_xBox;
+ public:
+ ListBoxWrapper(const css::uno::Reference< css::awt::XListBox >& _xBox);
+ virtual OUString getCurrentText() const override;
+ };
+
+ class SAL_WARN_UNUSED CheckBoxWrapper final : public ControlTextWrapper
+ {
+ css::uno::Reference< css::awt::XCheckBox > m_xBox;
+ public:
+ CheckBoxWrapper(const css::uno::Reference< css::awt::XCheckBox >& _xBox);
+ virtual OUString getCurrentText() const override;
+ };
+}
+
+typedef std::vector< css::uno::Reference< css::uno::XInterface> > InterfaceArray;
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC FmSearchEngine final
+{
+ friend class FmSearchThread;
+
+ enum class SearchResult { Found, NotFound, Error, Cancelled };
+ enum class SearchFor { String, Null, NotNull };
+
+ CursorWrapper m_xSearchCursor;
+ std::deque<sal_Int32> m_arrFieldMapping;
+ // Since the iterator could have more columns, as managed here (in this field listbox),
+ // a mapping of this css::form keys on the indices of the respective columns is kept in the iterator
+
+ CharClass m_aCharacterClassficator;
+ CollatorWrapper m_aStringCompare;
+
+ // the collection of all interesting fields (or their css::data::XDatabaseVariant interfaces and FormatKeys)
+ struct FieldInfo
+ {
+ css::uno::Reference< css::sdb::XColumn > xContents;
+ };
+
+ typedef std::vector<FieldInfo> FieldCollection;
+ FieldCollection m_arrUsedFields;
+ sal_Int32 m_nCurrentFieldIndex; // the last parameter of RebuildUsedFields, it allows checks in FormatField
+
+ std::vector<std::unique_ptr<svxform::ControlTextWrapper>>
+ m_aControlTexts;
+
+ CursorWrapper m_xOriginalIterator;
+ CursorWrapper m_xClonedIterator;
+
+ // Data for the decision in which field a "Found" is accepted
+ css::uno::Any m_aPreviousLocBookmark; // position of the last finding
+ FieldCollection::iterator m_iterPreviousLocField; // field of the last finding
+
+ // Communication with the thread that does the actual searching
+ OUString m_strSearchExpression; // forward direction
+ SearchFor m_eSearchForType; // ditto
+ SearchResult m_srResult; // backward direction
+
+ // The link we broadcast the progress and the result to
+ Link<const FmSearchProgress*,void> m_aProgressHandler;
+ std::atomic<bool> m_bCancelAsynchRequest; // should be cancelled?
+
+ // parameters for the search
+ bool m_bSearchingCurrently : 1; // is an (asynchronous) search running?
+ bool m_bFormatter : 1; // use field formatting
+ bool m_bForward : 1; // direction
+ bool m_bWildcard : 1; // wildcard search
+ bool m_bRegular : 1; // regular expression
+ bool m_bLevenshtein : 1; // Levenshtein search
+ bool m_bTransliteration : 1; // Levenshtein search
+
+ bool m_bLevRelaxed : 1; // parameters for Levenshtein search
+ sal_uInt16 m_nLevOther;
+ sal_uInt16 m_nLevShorter;
+ sal_uInt16 m_nLevLonger;
+
+ sal_uInt16 m_nPosition; // if not regular or levenshtein, then one of the MATCHING_... values
+
+ TransliterationFlags m_nTransliterationFlags;
+
+
+// member access
+private:
+ SVX_DLLPRIVATE bool CancelRequested(); // provides a through m_aCancelAsynchAccess backed interpretation of m_bCancelAsynchRequest
+
+public:
+ void SetCaseSensitive(bool bSet);
+ bool GetCaseSensitive() const;
+
+ void SetFormatterUsing(bool bSet); // this is somewhat more extensive, so no inline ... here
+ bool GetFormatterUsing() const { return m_bFormatter; }
+
+ void SetDirection(bool bForward) { m_bForward = bForward; }
+ bool GetDirection() const { return m_bForward; }
+
+ void SetWildcard(bool bSet) { m_bWildcard = bSet; }
+ bool GetWildcard() const { return m_bWildcard; }
+
+ void SetRegular(bool bSet) { m_bRegular = bSet; }
+ bool GetRegular() const { return m_bRegular; }
+
+ void SetLevenshtein(bool bSet) { m_bLevenshtein = bSet; }
+ bool GetLevenshtein() const { return m_bLevenshtein; }
+
+ void SetIgnoreWidthCJK(bool bSet);
+ bool GetIgnoreWidthCJK() const;
+
+ void SetTransliteration(bool bSet) { m_bTransliteration = bSet; }
+ bool GetTransliteration() const { return m_bTransliteration; }
+
+ void SetLevRelaxed(bool bSet) { m_bLevRelaxed = bSet; }
+ bool GetLevRelaxed() const { return m_bLevRelaxed; }
+ void SetLevOther(sal_uInt16 nHowMuch) { m_nLevOther = nHowMuch; }
+ sal_uInt16 GetLevOther() const { return m_nLevOther; }
+ void SetLevShorter(sal_uInt16 nHowMuch) { m_nLevShorter = nHowMuch; }
+ sal_uInt16 GetLevShorter() const { return m_nLevShorter; }
+ void SetLevLonger(sal_uInt16 nHowMuch) { m_nLevLonger = nHowMuch; }
+ sal_uInt16 GetLevLonger() const { return m_nLevLonger; }
+ // all Lev. values will only be considered in case of m_bLevenshtein==sal_True
+
+ void SetTransliterationFlags(TransliterationFlags _nFlags) { m_nTransliterationFlags = _nFlags; }
+ TransliterationFlags
+ GetTransliterationFlags() const { return m_nTransliterationFlags; }
+
+ void SetPosition(sal_uInt16 nValue) { m_nPosition = nValue; }
+ sal_uInt16 GetPosition() const { return m_nPosition; }
+ // position will be ignored in case of m_bWildCard==sal_True
+
+public:
+ /** two constructs, both analogical to FmSearchDialog, therefore look this up for explanations...
+ xCursor has to implement css::data::DatabaseCursor service each time.
+ If eMode == SM_USETHREAD, a ProgressHandler should be set, because in this case the result forwarding will be done
+ by this handler.
+ If eMode != SM_USETHREAD, SearchNext and StarOver won't return, until the search has finished (independently of its
+ success), only then the result can be requested. If additionally the ProgressHandler is set, it will be called for
+ every record as well as at the end of the search.
+ */
+ FmSearchEngine(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const css::uno::Reference< css::sdbc::XResultSet >& xCursor,
+ std::u16string_view strVisibleFields,
+ const InterfaceArray& arrFields);
+
+ /** the link will be called on every record and after the completion of the search, the parameter is a pointer to
+ a FmSearchProgress structure
+ the handler should be in any case thread-safe
+ */
+ void SetProgressHandler(Link<const FmSearchProgress*,void> aHdl) { m_aProgressHandler = aHdl; }
+
+ /// search for the next appearance (for nDirection values check DIRECTION_*-defines)
+ void SearchNext(const OUString& strExpression);
+ /// analogous, search for "NULL" (_bSearchForNull==sal_True) or "not NULL"
+ void SearchNextSpecial(bool _bSearchForNull);
+ /// search for the next appearance, dependent on nDirection from the start or end
+ void StartOver(const OUString& strExpression);
+ /// analogous, search for "NULL" (_bSearchForNull==sal_True) or "not NULL"
+ void StartOverSpecial(bool _bSearchForNull);
+ /// invalidate previous search reference
+ void InvalidatePreviousLoc();
+
+ /** rebuilds m_arrUsedFields (nFieldIndex==-1 means all fields, otherwise it specifies the field index)
+ if bForce is not set, nothing will happen in case of nFieldIndex == m_nCurrentFieldIndex
+ (calls InvalidatePreviousLoc)
+ */
+ void RebuildUsedFields(sal_Int32 nFieldIndex, bool bForce = false);
+ OUString FormatField(sal_Int32 nWhich);
+
+ /// returns directly; once it was really aborted, ProgressHandler is called with STATE_CANCELED
+ void CancelSearch();
+
+ /** only valid, if not an (asynchronous) search is running, the next search will then be executed
+ on top of the new iterator with the new parameter
+ */
+ void SwitchToContext(const css::uno::Reference< css::sdbc::XResultSet >& xCursor, std::u16string_view strVisibleFields, const InterfaceArray& arrFields,
+ sal_Int32 nFieldIndex);
+
+private:
+ void Init(std::u16string_view strVisibleFields);
+
+ void SearchNextImpl();
+ // this Impl method is running in SearchThread
+
+ // start a thread-search (or call SearchNextImpl directly, depending on the search mode)
+ void ImplStartNextSearch();
+
+ SVX_DLLPRIVATE void fillControlTexts(const InterfaceArray& arrFields);
+
+ // three methods implementing a complete search loop (null/not null, wildcard, SearchText)
+ // (they all have some code in common, but with this solution we have to do a distinction only once per search (before
+ // starting the loop), not in every loop step
+ SVX_DLLPRIVATE SearchResult SearchSpecial(bool _bSearchForNull, sal_Int32& nFieldPos, FieldCollection::iterator& iterFieldLoop,
+ const FieldCollection::iterator& iterBegin, const FieldCollection::iterator& iterEnd);
+ SVX_DLLPRIVATE SearchResult SearchWildcard(std::u16string_view strExpression, sal_Int32& nFieldPos, FieldCollection::iterator& iterFieldLoop,
+ const FieldCollection::iterator& iterBegin, const FieldCollection::iterator& iterEnd);
+ SVX_DLLPRIVATE SearchResult SearchRegularApprox(const OUString& strExpression, sal_Int32& nFieldPos, FieldCollection::iterator& iterFieldLoop,
+ const FieldCollection::iterator& iterBegin, const FieldCollection::iterator& iterEnd);
+
+ SVX_DLLPRIVATE void PropagateProgress(bool _bDontPropagateOverflow);
+ // call the ProgressHandler with STATE_PROGRESS and the current position of the search iterator
+
+ // helpers, that are needed several times
+ SVX_DLLPRIVATE bool MoveCursor();
+ // moves m_xSearchIterator with respect to direction/overflow cursor
+ SVX_DLLPRIVATE bool MoveField(sal_Int32& nPos, FieldCollection::iterator& iter, const FieldCollection::iterator& iterBegin, const FieldCollection::iterator& iterEnd);
+ // moves the iterator with respect to the direction/overflow iterator/overflow cursor
+ SVX_DLLPRIVATE void BuildAndInsertFieldInfo(const css::uno::Reference< css::container::XIndexAccess >& xAllFields, sal_Int32 nField);
+
+ void OnSearchTerminated();
+ // is used by SearchThread, after the return from this handler the thread removes itself
+ DECL_DLLPRIVATE_LINK(OnNewRecordCount, sal_Int32, void);
+};
+
+#endif // INCLUDED_SVX_FMSRCIMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmtools.hxx b/include/svx/fmtools.hxx
new file mode 100644
index 000000000..10f52d474
--- /dev/null
+++ b/include/svx/fmtools.hxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_FMTOOLS_HXX
+#define INCLUDED_SVX_FMTOOLS_HXX
+
+#include <config_options.h>
+#include <svx/svxdllapi.h>
+
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+
+#include <rtl/ref.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <o3tl/sorted_vector.hxx>
+#include <mutex>
+
+namespace com::sun::star::awt { class XWindow; }
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::container { class XIndexAccess; }
+namespace com::sun::star::container { class XNameAccess; }
+namespace com::sun::star::lang { class XComponent; }
+namespace com::sun::star::lang { class XServiceInfo; }
+namespace com::sun::star::sdbc { class SQLException; }
+namespace com::sun::star::sdbc { class XRowSet; }
+namespace com::sun::star::sdb { class SQLContext; }
+namespace com::sun::star::sdb { struct SQLErrorEvent; }
+enum class SdrObjKind : sal_uInt16;
+
+// common types
+
+// displaying a database exception for the user
+// display info about a simple css::sdbc::SQLException
+void displayException(const css::sdbc::SQLException&, const css::uno::Reference<css::awt::XWindow>& rParent);
+SVXCORE_DLLPUBLIC void displayException(const css::sdb::SQLContext&, const css::uno::Reference<css::awt::XWindow>& rParent);
+void displayException(const css::sdb::SQLErrorEvent&, const css::uno::Reference<css::awt::XWindow>& rParent);
+void displayException(const css::uno::Any&, const css::uno::Reference<css::awt::XWindow>& rParent);
+
+sal_Int32 getElementPos(const css::uno::Reference< css::container::XIndexAccess>& xCont, const css::uno::Reference< css::uno::XInterface>& xElement);
+
+SVXCORE_DLLPUBLIC OUString getLabelName(const css::uno::Reference< css::beans::XPropertySet>& xControlModel);
+
+
+// = class CursorWrapper - a helper class which works in common with a css::uno::Reference<XDatabaseUpdateCursor>,
+// XDatabaseBookmarkCursor and XDatabaseDirectCursor each
+
+
+class SAL_WARN_UNUSED CursorWrapper
+{
+private:
+ css::uno::Reference< css::uno::XInterface> m_xGeneric;
+ css::uno::Reference< css::sdbc::XResultSet> m_xMoveOperations;
+ css::uno::Reference< css::sdbcx::XRowLocate> m_xBookmarkOperations;
+ css::uno::Reference< css::sdbcx::XColumnsSupplier> m_xColumnsSupplier;
+ css::uno::Reference< css::beans::XPropertySet> m_xPropertyAccess;
+
+public:
+ // Construction/Destruction
+ CursorWrapper(const css::uno::Reference< css::sdbc::XRowSet>& _rxCursor, bool bUseCloned = false);
+ UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) CursorWrapper(const css::uno::Reference< css::sdbc::XResultSet>& _rxCursor, bool bUseCloned = false);
+ // if bUseCloned == sal_True, the cursor is first doubled over the XCloneable interface (which it must implement)
+ // and then used
+
+ friend bool operator==(const CursorWrapper& lhs, const CursorWrapper& rhs)
+ {
+ return lhs.m_xGeneric.get() == rhs.m_xGeneric.get();
+ }
+
+ bool is() const { return m_xMoveOperations.is(); }
+ bool Is() const { return m_xMoveOperations.is(); }
+
+ operator const css::uno::Reference< css::uno::XInterface>& () const{ return m_xGeneric; }
+
+ // 'Conversions'
+ CursorWrapper& operator=(const css::uno::Reference< css::sdbc::XRowSet>& xCursor);
+ operator const css::uno::Reference< css::sdbc::XResultSet>& () const { return m_xMoveOperations; }
+
+ const css::uno::Reference< css::beans::XPropertySet >& getPropertySet() const { return m_xPropertyAccess; }
+
+ // css::uno::Reference< css::sdbcx::XRowLocate>
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ css::uno::Any getBookmark()
+ { return m_xBookmarkOperations->getBookmark(); }
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ bool moveToBookmark(const css::uno::Any& bookmark) { return m_xBookmarkOperations->moveToBookmark(bookmark); }
+
+ // css::sdbc::XResultSet
+ bool isBeforeFirst() const { return m_xMoveOperations->isBeforeFirst(); }
+ bool isAfterLast() const { return m_xMoveOperations->isAfterLast(); }
+ bool isFirst() const { return m_xMoveOperations->isFirst(); }
+ bool isLast() const { return m_xMoveOperations->isLast(); }
+ void beforeFirst() { m_xMoveOperations->beforeFirst(); }
+ bool first() { return m_xMoveOperations->first(); }
+ bool last() { return m_xMoveOperations->last(); }
+ sal_Int32 getRow() const { return m_xMoveOperations->getRow(); }
+ bool absolute(sal_Int32 nPosition) { return m_xMoveOperations->absolute(nPosition); }
+ bool relative(sal_Int32 nCount) { return m_xMoveOperations->relative(nCount); }
+ bool previous() { return m_xMoveOperations->previous(); }
+ bool next() { return m_xMoveOperations->next(); }
+ void refreshRow() { m_xMoveOperations->refreshRow(); }
+ bool rowDeleted() { return m_xMoveOperations->rowDeleted(); }
+ // css::sdbcx::XColumnsSupplier
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::container::XNameAccess> getColumns() const { return m_xColumnsSupplier->getColumns(); }
+private:
+ void ImplConstruct(const css::uno::Reference< css::sdbc::XResultSet>& _rxCursor, bool bUseCloned);
+};
+
+
+class FmXDisposeMultiplexer;
+class SAL_WARN_UNUSED FmXDisposeListener
+{
+ friend class FmXDisposeMultiplexer;
+
+ rtl::Reference<FmXDisposeMultiplexer> m_pAdapter;
+ std::mutex m_aMutex;
+
+public:
+ virtual ~FmXDisposeListener();
+
+ /// @throws css::uno::RuntimeException
+ virtual void disposing(sal_Int16 _nId) = 0;
+
+protected:
+ void setAdapter(FmXDisposeMultiplexer* pAdapter);
+};
+
+class SAL_WARN_UNUSED FmXDisposeMultiplexer final : public cppu::WeakImplHelper< css::lang::XEventListener >
+{
+ css::uno::Reference< css::lang::XComponent> m_xObject;
+ FmXDisposeListener* m_pListener;
+
+ virtual ~FmXDisposeMultiplexer() override;
+public:
+ FmXDisposeMultiplexer(FmXDisposeListener* _pListener, const css::uno::Reference< css::lang::XComponent>& _rxObject);
+
+// css::lang::XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ void dispose();
+};
+
+SdrObjKind getControlTypeByObject(const css::uno::Reference< css::lang::XServiceInfo>& _rxObject);
+ // get the object type (OBJ_FM_...) from the services the object supports
+
+
+bool isRowSetAlive(const css::uno::Reference< css::uno::XInterface>& _rxRowSet);
+ // checks if the css::sdbcx::XColumnsSupplier provided by _rxRowSet supplies any columns
+
+
+typedef ::o3tl::sorted_vector< css::uno::Reference< css::uno::XInterface > > InterfaceBag;
+
+#endif // INCLUDED_SVX_FMTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fmview.hxx b/include/svx/fmview.hxx
new file mode 100644
index 000000000..77928837d
--- /dev/null
+++ b/include/svx/fmview.hxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FMVIEW_HXX
+#define INCLUDED_SVX_FMVIEW_HXX
+
+#include <svx/view3d.hxx>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star {
+ namespace beans {
+ class XPropertySet;
+ }
+ namespace util {
+ class XNumberFormats;
+ }
+}
+
+class OutputDevice;
+class FmFormObj;
+class FmFormPage;
+class FmFormShell;
+class FmXFormView;
+
+namespace svx {
+ class ODataAccessDescriptor;
+ struct OXFormsDescriptor;
+}
+
+class SdrUnoObj;
+namespace com::sun::star::form {
+ class XForm;
+ namespace runtime {
+ class XFormController;
+ }
+}
+
+class SVXCORE_DLLPUBLIC FmFormView : public E3dView
+{
+ rtl::Reference<FmXFormView> pImpl;
+ FmFormShell* pFormShell;
+
+ void Init();
+
+public:
+ FmFormView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
+ virtual ~FmFormView() override;
+
+ /** create a control pair (label/bound control) for the database field description given.
+ @param rFieldDesc
+ description of the field. see clipboard format SBA-FIELDFORMAT
+ @deprecated
+ This method is deprecated. Use the version with an ODataAccessDescriptor instead.
+ */
+ SdrObjectUniquePtr CreateFieldControl(std::u16string_view rFieldDesc) const;
+
+ /** create a control pair (label/bound control) for the database field description given.
+ */
+ SdrObjectUniquePtr CreateFieldControl( const svx::ODataAccessDescriptor& _rColumnDescriptor );
+
+ /** create a control pair (label/bound control) for the xforms description given.
+ */
+ SdrObjectUniquePtr CreateXFormsControl( const svx::OXFormsDescriptor &_rDesc );
+
+ virtual void MarkListHasChanged() override;
+ virtual void AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pWindow) override;
+ virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin) override;
+
+ static void createControlLabelPair(
+ OutputDevice const * _pOutDev,
+ sal_Int32 _nXOffsetMM,
+ sal_Int32 _nYOffsetMM,
+ const css::uno::Reference< css::beans::XPropertySet >& _rxField,
+ const css::uno::Reference< css::util::XNumberFormats >& _rxNumberFormats,
+ SdrObjKind _nControlObjectID,
+ SdrInventor _nInventor,
+ SdrObjKind _nLabelObjectID,
+
+ // tdf#118963 Need a SdrModel for SdrObject creation. To make the
+ // demand clear, hand over a SdrMldel&
+ SdrModel& _rModel,
+
+ std::unique_ptr<SdrUnoObj, SdrObjectFreeOp>& _rpLabel,
+ std::unique_ptr<SdrUnoObj, SdrObjectFreeOp>& _rpControl
+ );
+
+ virtual SdrPageView* ShowSdrPage(SdrPage* pPage) override;
+ virtual void HideSdrPage() override;
+
+ virtual bool MouseButtonDown( const MouseEvent& _rMEvt, OutputDevice* _pWin ) override;
+
+ /** grab the focus to the first form control on the view
+ */
+ SVX_DLLPRIVATE void GrabFirstControlFocus();
+
+ /** returns the form controller for a given form and a given device
+ */
+ SVX_DLLPRIVATE css::uno::Reference< css::form::runtime::XFormController >
+ GetFormController( const css::uno::Reference< css::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const;
+
+ // SdrView
+ bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) override;
+
+ /// shortcut to "GetSdrPageView() ? PTR_CAST( FmFormPage, GetSdrPageView() ) : NULL"
+ FmFormPage* GetCurPage();
+
+ SVX_DLLPRIVATE void ActivateControls(SdrPageView const *);
+ SVX_DLLPRIVATE void DeactivateControls(SdrPageView const *);
+
+ SVX_DLLPRIVATE void ChangeDesignMode(bool bDesign);
+
+ SVX_DLLPRIVATE FmXFormView* GetImpl() const { return pImpl.get(); }
+ SVX_DLLPRIVATE FmFormShell* GetFormShell() const { return pFormShell; }
+
+ struct FormShellAccess { friend class FmFormShell; private: FormShellAccess() { } };
+ void SetFormShell( FmFormShell* pShell, FormShellAccess ) { pFormShell = pShell; }
+
+ struct ImplAccess { friend class FmXFormView; private: ImplAccess() { } };
+ void SetMoveOutside( bool _bMoveOutside, ImplAccess ) { E3dView::SetMoveOutside( _bMoveOutside ); }
+ void InsertControlContainer(const css::uno::Reference< css::awt::XControlContainer >& xCC);
+ void RemoveControlContainer(const css::uno::Reference< css::awt::XControlContainer >& xCC);
+
+ virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut) override;
+ virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer) override;
+
+ SVX_DLLPRIVATE const OutputDevice* GetActualOutDev() const {return mpActualOutDev;}
+ SVX_DLLPRIVATE bool checkUnMarkAll(const css::uno::Reference< css::uno::XInterface >& _xSource);
+
+private:
+ SVX_DLLPRIVATE FmFormObj* getMarkedGrid() const;
+ protected:
+ using E3dView::SetMoveOutside;
+};
+
+#endif // _FML_FMVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fntctrl.hxx b/include/svx/fntctrl.hxx
new file mode 100644
index 000000000..1751c3ac8
--- /dev/null
+++ b/include/svx/fntctrl.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_FNTCTRL_HXX
+#define INCLUDED_SVX_FNTCTRL_HXX
+
+#include <memory>
+#include <editeng/svxfont.hxx>
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+#include <vcl/customweld.hxx>
+
+class SfxItemSet;
+class FontPrevWin_Impl;
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontPrevWindow final : public weld::CustomWidgetController
+{
+private:
+ std::unique_ptr<FontPrevWin_Impl> pImpl;
+
+ SVX_DLLPRIVATE static void ApplySettings(vcl::RenderContext& rRenderContext);
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ SVX_DLLPRIVATE static void SetFontSize(const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont);
+ SVX_DLLPRIVATE static void SetFontLang(const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont);
+
+public:
+ SvxFontPrevWindow();
+ virtual ~SvxFontPrevWindow() override;
+
+ SvxFont& GetFont();
+ const SvxFont& GetFont() const;
+ void SetFont( const SvxFont& rNormalFont, const SvxFont& rCJKFont, const SvxFont& rCTLFont );
+ SvxFont& GetCJKFont();
+ SvxFont& GetCTLFont();
+ void SetColor( const Color& rColor );
+ void ResetColor();
+ void SetTextLineColor(const Color& rColor);
+ void SetOverlineColor(const Color& rColor);
+ void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
+
+ bool IsTwoLines() const;
+ void SetTwoLines(bool bSet);
+
+ void SetBrackets(sal_Unicode cStart, sal_Unicode cEnd);
+
+ void SetFontWidthScale( sal_uInt16 nScaleInPercent );
+
+ void AutoCorrectFontColor();
+
+ void SetPreviewText( const OUString& rString );
+ void SetFontNameAsPreviewText();
+
+ void SetFromItemSet( const SfxItemSet &rSet,
+ bool bPreviewBackgroundToCharacter );
+};
+
+#endif // INCLUDED_SVX_FNTCTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fontwork.hxx b/include/svx/fontwork.hxx
new file mode 100644
index 000000000..7fe65fd45
--- /dev/null
+++ b/include/svx/fontwork.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_FONTWORK_HXX
+#define INCLUDED_SVX_FONTWORK_HXX
+
+#include <sfx2/dockwin.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <svx/svxdllapi.h>
+#include <vcl/idle.hxx>
+#include <vcl/weld.hxx>
+
+class ColorListBox;
+
+class XFormTextAdjustItem;
+class XFormTextDistanceItem;
+class XFormTextStartItem;
+class XFormTextStyleItem;
+class XFormTextMirrorItem;
+class XFormTextHideFormItem;
+class XFormTextOutlineItem;
+class XFormTextShadowItem;
+class XFormTextShadowColorItem;
+class XFormTextShadowXValItem;
+class XFormTextShadowYValItem;
+
+/** ControllerItem for Fontwork
+ */
+
+
+class SvxFontWorkDialog;
+
+class SvxFontWorkControllerItem final : public SfxControllerItem
+{
+ SvxFontWorkDialog &rFontWorkDlg;
+
+ virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState) override;
+
+public:
+ SvxFontWorkControllerItem(sal_uInt16 nId, SvxFontWorkDialog&, SfxBindings&);
+};
+
+/** Derived from SfxChildWindow as "container" for fontwork dialog
+ */
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkChildWindow final : public SfxChildWindow
+{
+ public:
+ SvxFontWorkChildWindow(vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo*);
+ SFX_DECL_CHILDWINDOW_WITHID(SvxFontWorkChildWindow);
+};
+
+/** Floating window for setting attributes of text effects
+ */
+
+class SAL_WARN_UNUSED SvxFontWorkDialog final : public SfxDockingWindow
+{
+#define CONTROLLER_COUNT 11
+
+ SfxBindings& rBindings;
+ Idle aInputIdle;
+
+ OString m_sLastStyleTbxId;
+ OString m_sLastAdjustTbxId;
+ OString m_sLastShadowTbxId;
+
+ tools::Long nSaveShadowX;
+ tools::Long nSaveShadowY;
+ tools::Long nSaveShadowAngle;
+ tools::Long nSaveShadowSize;
+
+ SvxFontWorkControllerItem* pCtrlItems[CONTROLLER_COUNT];
+
+ std::unique_ptr<weld::Toolbar> m_xTbxStyle;
+ std::unique_ptr<weld::Toolbar> m_xTbxAdjust;
+
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDistance;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldTextStart;
+
+ std::unique_ptr<weld::Toolbar> m_xTbxShadow;
+
+ std::unique_ptr<weld::Image> m_xFbShadowX;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldShadowX;
+ std::unique_ptr<weld::Image> m_xFbShadowY;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldShadowY;
+
+ std::unique_ptr<ColorListBox> m_xShadowColorLB;
+
+ friend class SvxFontWorkChildWindow;
+ friend class SvxFontWorkControllerItem;
+
+ DECL_LINK( SelectStyleHdl_Impl, const OString&, void );
+ DECL_LINK( SelectAdjustHdl_Impl, const OString&, void );
+ DECL_LINK( SelectShadowHdl_Impl, const OString&, void );
+
+ DECL_LINK( ModifyInputHdl_Impl, weld::MetricSpinButton&, void );
+ DECL_LINK( InputTimeoutHdl_Impl, Timer*, void );
+
+ DECL_LINK( ColorSelectHdl_Impl, ColorListBox&, void );
+
+ void SetStyle_Impl(const XFormTextStyleItem*);
+ void SetAdjust_Impl(const XFormTextAdjustItem*);
+ void SetDistance_Impl(const XFormTextDistanceItem*);
+ void SetStart_Impl(const XFormTextStartItem*);
+ void SetMirror_Impl(const XFormTextMirrorItem*);
+ void SetShowForm_Impl(const XFormTextHideFormItem*);
+ void SetOutline_Impl(const XFormTextOutlineItem*);
+ void SetShadow_Impl(const XFormTextShadowItem*, bool bRestoreValues = false);
+ void SetShadowColor_Impl(const XFormTextShadowColorItem*);
+ void SetShadowXVal_Impl(const XFormTextShadowXValItem*);
+ void SetShadowYVal_Impl(const XFormTextShadowYValItem*);
+
+ void ApplyImageList();
+
+ virtual SfxChildAlignment CheckAlignment( SfxChildAlignment eActAlign,
+ SfxChildAlignment eAlign ) override;
+public:
+ SvxFontWorkDialog(SfxBindings *pBinding, SfxChildWindow *pCW,
+ vcl::Window* pParent);
+ virtual ~SvxFontWorkDialog() override;
+ virtual void dispose() override;
+};
+
+#endif // INCLUDED_SVX_FONTWORK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fontworkbar.hxx b/include/svx/fontworkbar.hxx
new file mode 100644
index 000000000..3b60c7b89
--- /dev/null
+++ b/include/svx/fontworkbar.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FONTWORKBAR_HXX
+#define INCLUDED_SVX_FONTWORKBAR_HXX
+
+#include <sfx2/shell.hxx>
+#include <svx/ifaceids.hxx>
+#include <svx/svxdllapi.h>
+
+class SfxViewShell;
+class SdrView;
+class SdrObject;
+
+/************************************************************************/
+
+namespace svx
+{
+bool SVXCORE_DLLPUBLIC checkForSelectedFontWork(SdrView const* pSdrView);
+bool SVXCORE_DLLPUBLIC checkForFontWork(const SdrObject* pObj);
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FontworkBar final : public SfxShell
+{
+public:
+ SFX_DECL_INTERFACE(SVX_INTERFACE_FONTWORK_BAR)
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl();
+
+public:
+ FontworkBar(SfxViewShell* pViewShell);
+ virtual ~FontworkBar() override;
+
+ static void execute(SdrView& rSdrView, SfxRequest const& rReq, SfxBindings& rBindings);
+ static void getState(SdrView const* pSdrView, SfxItemSet& rSet);
+};
+}
+
+#endif // INCLUDED_SVX_FONTWORKBAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/fontworkgallery.hxx b/include/svx/fontworkgallery.hxx
new file mode 100644
index 000000000..78e0370db
--- /dev/null
+++ b/include/svx/fontworkgallery.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_SVX_FONTWORKGALLERY_HXX
+#define INCLUDED_SVX_FONTWORKGALLERY_HXX
+
+#include <svx/svxdllapi.h>
+#include <vcl/weld.hxx>
+#include <vector>
+
+class SdrView;
+class SdrObject;
+class SdrModel;
+
+namespace svx
+{
+
+class SAL_WARN_UNUSED FontworkCharacterSpacingDialog final : public weld::GenericDialogController
+{
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrScale;
+
+public:
+ FontworkCharacterSpacingDialog(weld::Window* pParent, sal_Int32 nScale);
+ virtual ~FontworkCharacterSpacingDialog() override;
+
+ sal_Int32 getScale() const;
+};
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FontWorkGalleryDialog final : public weld::GenericDialogController
+{
+ sal_uInt16 mnThemeId;
+ SdrView& mrSdrView;
+
+ bool mbInsertIntoPage;
+ SdrObject* mpSdrObject;
+ SdrModel* mpDestModel;
+
+ std::vector<VclPtr< VirtualDevice >> maFavoritesHorizontal;
+
+ std::unique_ptr<weld::IconView> maCtlFavorites;
+ std::unique_ptr<weld::Button> mxOKButton;
+
+ void initFavorites(sal_uInt16 nThemeId);
+ void insertSelectedFontwork();
+ void fillFavorites(sal_uInt16 nThemeId);
+
+ DECL_DLLPRIVATE_LINK(DoubleClickFavoriteHdl, weld::IconView&, bool);
+ DECL_DLLPRIVATE_LINK(ClickOKHdl, weld::Button&, void );
+
+public:
+ FontWorkGalleryDialog(weld::Window* pParent, SdrView& rView);
+ virtual ~FontWorkGalleryDialog() override;
+
+ // SJ: if the SdrObject** is set, the SdrObject is not inserted into the page when executing the dialog
+ void SetSdrObjectRef( SdrModel* pModel );
+ SdrObject* GetSdrObjectRef() { return mpSdrObject; }
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/formatpaintbrushctrl.hxx b/include/svx/formatpaintbrushctrl.hxx
new file mode 100644
index 000000000..300483595
--- /dev/null
+++ b/include/svx/formatpaintbrushctrl.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FORMATPAINTBRUSHCTRL_HXX
+#define INCLUDED_SVX_FORMATPAINTBRUSHCTRL_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include <vcl/timer.hxx>
+#include <svx/svxdllapi.h>
+
+
+namespace svx
+{
+
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC FormatPaintBrushToolBoxControl final : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+ virtual ~FormatPaintBrushToolBoxControl() override;
+
+ virtual void DoubleClick() override;
+ virtual void Click() override;
+ virtual void Select(sal_uInt16 nSelectModifier) override;
+
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState ) override;
+private:
+ DECL_DLLPRIVATE_LINK( WaitDoubleClickHdl, Timer*, void );
+ void impl_executePaintBrush();
+
+private:
+ bool m_bPersistentCopy;//indicates that the content of the format clipboard should not be erased after paste
+ Timer m_aDoubleClickTimer;
+};
+
+
+} //namespace svx
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/framebordertype.hxx b/include/svx/framebordertype.hxx
new file mode 100644
index 000000000..2eda99606
--- /dev/null
+++ b/include/svx/framebordertype.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FRAMEBORDERTYPE_HXX
+#define INCLUDED_SVX_FRAMEBORDERTYPE_HXX
+
+#include <svx/svxdllapi.h>
+
+namespace svx {
+
+
+/** Enumerates all borders a frame selection control can contain. */
+enum class FrameBorderType
+{
+ NONE, /// No border (special state).
+ Left, /// Left frame border.
+ Right, /// Right frame border.
+ Top, /// Top frame border.
+ Bottom, /// Bottom frame border.
+ Horizontal, /// Inner horizontal frame border.
+ Vertical, /// Inner vertical frame border.
+ TLBR, /// Top-left to bottom-right frame border.
+ BLTR /// Bottom-left to top-right frame border.
+};
+
+/** The number of valid frame border types (excluding FrameBorderType::NONE). */
+const int FRAMEBORDERTYPE_COUNT = 8;
+
+/** Returns the frame border type from a 0-based integer index. */
+SVX_DLLPUBLIC FrameBorderType GetFrameBorderTypeFromIndex( size_t nIndex );
+
+/** Returns the zero-based index of a valid frame border type. */
+size_t GetIndexFromFrameBorderType( FrameBorderType eBorder );
+
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx
new file mode 100644
index 000000000..ae35185a4
--- /dev/null
+++ b/include/svx/framelink.hxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FRAMELINK_HXX
+#define INCLUDED_SVX_FRAMELINK_HXX
+
+#include <sal/types.h>
+#include <tools/color.hxx>
+#include <svx/svxdllapi.h>
+#include <editeng/borderline.hxx>
+
+namespace svx::frame {
+
+
+// Enums
+
+
+/** Specifies how the reference points for frame borders are used.
+ */
+enum class RefMode : sal_uInt8
+{
+ /** Frame borders are drawn centered to the reference points. */
+ Centered,
+
+ /** The reference points specify the begin of the frame border width.
+
+ The result is that horizontal lines are drawn below, and vertical lines
+ are drawn right of the reference points.
+ */
+ Begin,
+
+ /** The reference points specify the end of the frame border width.
+
+ The result is that horizontal lines are drawn above, and vertical lines
+ are drawn left of the reference points.
+ */
+ End
+};
+
+
+// Classes
+
+
+/** Contains the widths of primary and secondary line of a frame style.
+
+ In the following, "frame style" is a complete style of one frame border,
+ i.e. the double line at the left side of the frame. A "line" is always a
+ trivial single line, i.e. the first line of a double frame style.
+
+ The following states of the members of this struct are valid:
+
+ mnPrim mnDist mnSecn frame style
+ -------------------------------------------------
+ 0 0 0 invisible
+ >0 0 0 single
+ >0 >0 >0 double
+
+ The behaviour of the member functions for other states is not defined.
+
+ Per definition the primary line in double frame styles is:
+ - The top line for horizontal frame borders.
+ - The left line for vertical frame borders.
+ - The bottom-left line for top-left to bottom-right diagonal frame borders.
+ - The top-left line for bottom-left to top-right diagonal frame borders.
+
+ The following picture shows the upper end of a vertical double frame
+ border.
+
+ |<---------------- GetWidth() ----------------->|
+ | |
+ |<----- mnPrim ----->||<- mnDist ->||<- mnSecn >|
+ | || || |
+ ###################### #############
+ ###################### #############
+ ###################### #############
+ ###################### #############
+ ###################### | #############
+ ###################### | #############
+ |
+ |<- middle of the frame border
+ */
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC Style
+{
+private:
+ Color maColorPrim;
+ Color maColorSecn;
+ Color maColorGap;
+ double mfPrim; /// Width of primary (single, left, or top) line.
+ double mfDist; /// Distance between primary and secondary line.
+ double mfSecn; /// Width of secondary (right or bottom) line.
+ double mfPatternScale; /// Scale used for line pattern spacing.
+ RefMode meRefMode; /// Reference point handling for this frame border.
+ SvxBorderLineStyle mnType;
+ bool mbWordTableCell : 1;
+ bool mbUseGapColor : 1;
+
+public:
+ /** Constructs an invisible frame style. */
+ explicit Style();
+ /** Constructs a frame style with passed line widths. */
+ explicit Style( double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale );
+ /** Constructs a frame style with passed color and line widths. */
+ explicit Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale );
+ /** Constructs a frame style from the passed SvxBorderLine struct. */
+ explicit Style( const editeng::SvxBorderLine* pBorder, double fScale );
+
+ RefMode GetRefMode() const { return meRefMode; }
+ Color GetColorPrim() const { return maColorPrim; }
+ Color GetColorSecn() const { return maColorSecn; }
+ Color GetColorGap() const { return maColorGap; }
+ bool UseGapColor() const { return mbUseGapColor; }
+ double Prim() const { return mfPrim; }
+ double Dist() const { return mfDist; }
+ double Secn() const { return mfSecn; }
+ double PatternScale() const { return mfPatternScale;}
+ SvxBorderLineStyle Type() const { return mnType; }
+
+ /// Check if this style is used - this depends on it having any width definition.
+ /// As can be seen in the definition comment above, Prim() *must* be non zero to have a width
+ bool IsUsed() const { return 0.0 != mfPrim; }
+
+ /** Returns the total width of this frame style. */
+ double GetWidth() const { return mfPrim + mfDist + mfSecn; }
+
+ /** Sets the frame style to invisible state. */
+ void Clear();
+ /** Sets the frame style to the passed line widths. */
+ void Set( double nP, double nD, double nS );
+ /** Sets the frame style to the passed line widths. */
+ void Set( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS );
+ /** Sets the frame style to the passed SvxBorderLine struct. If nullptr, resets the style */
+ void Set( const editeng::SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 );
+
+ /** Sets a new reference point handling mode, does not modify other settings. */
+ void SetRefMode( RefMode eRefMode ) { meRefMode = eRefMode; }
+ /** Sets a new color, does not modify other settings. */
+ void SetColorPrim( const Color& rColor ) { maColorPrim = rColor; }
+ void SetColorSecn( const Color& rColor ) { maColorSecn = rColor; }
+ /** Sets whether to use dotted style for single hair lines. */
+ void SetType( SvxBorderLineStyle nType ) { mnType = nType; }
+
+ /** Mirrors this style (exchanges primary and secondary), if it is a double frame style. */
+ Style& MirrorSelf();
+
+ /** Enables the Word-compatible Style comparison code. */
+ void SetWordTableCell(bool bWordTableCell) { mbWordTableCell = bWordTableCell; }
+
+ bool operator==( const Style& rOther) const;
+ bool operator<( const Style& rOther) const;
+};
+
+inline bool operator>( const Style& rL, const Style& rR ) { return rR.operator<(rL); }
+
+inline Style::Style()
+ : mfPrim(0)
+ , mfDist(0)
+ , mfSecn(0)
+ , mfPatternScale(1.0)
+ , meRefMode(RefMode::Centered)
+ , mnType(SvxBorderLineStyle::SOLID)
+ , mbWordTableCell(false)
+ , mbUseGapColor(false)
+{}
+
+}
+
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx
new file mode 100644
index 000000000..10c8f4da2
--- /dev/null
+++ b/include/svx/framelinkarray.hxx
@@ -0,0 +1,326 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FRAMELINKARRAY_HXX
+#define INCLUDED_SVX_FRAMELINKARRAY_HXX
+
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/rotmodit.hxx>
+#include <memory>
+
+class Color;
+
+namespace svx::frame {
+
+struct ArrayImpl;
+class Style;
+
+/** Stores frame styles of an array of cells, supports merged ranges.
+
+ This class is able to store the frame styles of an array of cells and to
+ draw the entire array or parts of it to any output device.
+
+ Every cell contains the style of the left, right, top, bottom, top-left to
+ bottom-right, and bottom-left to top-right frame border.
+
+ On drawing, the thicker frame border of neighbored cells is selected
+ automatically. All borders are drawn "connected", that means, the correct
+ start and end coordinates of all lines of the borders are calculated,
+ especially, if they are drawn together with diagonal frame borders.
+
+ This array fully supports merged cell ranges. In a merged range, the frame
+ borders of the top-left cell is extended to the entire range, and all other
+ cells in that range are overlapped. Again, all connected frame borders,
+ also diagonals and frame borders from adjacent merged ranges, are handled
+ automatically.
+
+ Additionally, a clipping range can be set. If such a range is used, all
+ frame borders outside this range are completely ignored, and are not used
+ in the connected border calculation anymore.
+
+ The array can be mirrored in both directions. It is possible to specify,
+ whether to mirror the double frame styles, and whether to swap diagonal
+ frame borders.
+ */
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC Array
+{
+public:
+ /** Constructs an empty array. */
+ explicit Array();
+
+ /** Destructs the array. */
+ ~Array();
+
+ // array size and column/row indexes
+
+ /** Reinitializes the array with the specified size. Clears all styles. */
+ void Initialize( sal_Int32 nWidth, sal_Int32 nHeight );
+
+ /** Returns the number of columns in the array. */
+ sal_Int32 GetColCount() const;
+
+ /** Returns the number of rows in the array. */
+ sal_Int32 GetRowCount() const;
+
+ /** Returns the number of cells in the array. */
+ sal_Int32 GetCellCount() const;
+
+ /** Returns the cell index from the cell address (nCol,nRow). */
+ sal_Int32 GetCellIndex( sal_Int32 nCol, sal_Int32 nRow, bool bRTL) const;
+
+ // cell border styles
+
+ /** Sets the left frame style of the cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleLeft( sal_Int32 nCol, sal_Int32 nRow, const Style& rStyle );
+
+ /** Sets the right frame style of the cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleRight( sal_Int32 nCol, sal_Int32 nRow, const Style& rStyle );
+
+ /** Sets the top frame style of the cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleTop( sal_Int32 nCol, sal_Int32 nRow, const Style& rStyle );
+
+ /** Sets the bottom frame style of the specified cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleBottom( sal_Int32 nCol, sal_Int32 nRow, const Style& rStyle );
+
+ /** Sets the top-left to bottom-right frame style of the cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleTLBR( sal_Int32 nCol, sal_Int32 nRow, const Style& rStyle );
+
+ /** Sets the bottom-left to top-right frame style of the cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleBLTR( sal_Int32 nCol, sal_Int32 nRow, const Style& rStyle );
+
+ /** Sets both diagonal frame styles of the specified cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleDiag( sal_Int32 nCol, sal_Int32 nRow, const Style& rTLBR, const Style& rBLTR );
+
+ /** Sets the left frame style of the specified column. Ignores merged ranges. */
+ void SetColumnStyleLeft( sal_Int32 nCol, const Style& rStyle );
+
+ /** Sets the right frame style of the specified column. Ignores merged ranges. */
+ void SetColumnStyleRight( sal_Int32 nCol, const Style& rStyle );
+
+ /** Sets the top frame style of the specified row. Ignores merged ranges. */
+ void SetRowStyleTop( sal_Int32 nRow, const Style& rStyle );
+
+ /** Sets the bottom frame style of the specified row. Ignores merged ranges. */
+ void SetRowStyleBottom( sal_Int32 nRow, const Style& rStyle );
+
+ /** Sets the rotation parameters of the cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellRotation(sal_Int32 nCol, sal_Int32 nRow, SvxRotateMode eRotMode, double fOrientation);
+
+ /** Check if at least one cell is rotated */
+ bool HasCellRotation() const;
+
+ /** Returns the left frame style of the cell (nCol,nRow).
+ Returns thicker of own left style or right style of the cell to the left.
+ Returns the style only if visible (i.e. at left border of a merged range).
+ @return
+ The left frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleLeft( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ /** Returns the right frame style of the cell (nCol,nRow).
+ Returns thicker of own right style or left style of the cell to the right.
+ Returns the style only if visible (i.e. at right border of a merged range).
+ @return
+ The left frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleRight( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ /** Returns the top frame style of the cell (nCol,nRow).
+ Returns thicker of own top style or bottom style of the cell above.
+ Returns the style only if visible (i.e. at top border of a merged range).
+ @return
+ The top frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleTop( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ /** Returns the top frame style of the cell (nCol,nRow).
+ Returns thicker of own top style or bottom style of the cell above.
+ Returns the style only if visible (i.e. at top border of a merged range).
+ @return
+ The top frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleBottom( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ /** Returns the top-left to bottom-right frame style of the cell (nCol,nRow).
+ Ignores merged ranges;
+ @return
+ The top-left to bottom-right frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleTLBR( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ /** Returns the bottom-left to top-right frame style of the cell (nCol,nRow).
+ Ignores merged ranges;
+ @return
+ The bottom-left to top-right frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleBLTR( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ /** Returns the top-left to bottom-right frame style of the cell (nCol,nRow).
+ @return
+ The top-left to bottom-right frame style, if the cell is not part of
+ a merged range, or if (nCol,nRow) is the top-left corner of a merged
+ range (useful to find connected frame styles).
+ An invisible style for invalid cell addresses. */
+ const Style& GetCellStyleTL( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ /** Returns the top-left to bottom-right frame style of the cell (nCol,nRow).
+ @return
+ The top-left to bottom-right frame style, if the cell is not part of
+ a merged range, or if (nCol,nRow) is the bottom-right corner of a
+ merged range (useful to find connected frame styles).
+ An invisible style for invalid cell addresses. */
+ const Style& GetCellStyleBR( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ /** Returns the bottom-left to top-right frame style of the cell (nCol,nRow).
+ @return
+ The bottom-left to top-right frame style, if the cell is not part of
+ a merged range, or if (nCol,nRow) is the bottom-left corner of a
+ merged range (useful to find connected frame styles).
+ An invisible style for invalid cell addresses. */
+ const Style& GetCellStyleBL( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ /** Returns the bottom-left to top-right frame style of the cell (nCol,nRow).
+ @return
+ The bottom-left to top-right frame style, if the cell is not part of
+ a merged range, or if (nCol,nRow) is the top-right corner of a
+ merged range (useful to find connected frame styles).
+ An invisible style for invalid cell addresses. */
+ const Style& GetCellStyleTR( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ // cell merging
+
+ /** Inserts a new merged cell range.
+ @precond The range must not intersect other merged ranges. */
+ void SetMergedRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow );
+
+ /** Sets an additional left width for the merged range that contains (nCol,nRow).
+ @descr Useful to handle merged ranges that are not completely part of the array.
+ @precond The merged range must be at the left border of the array. */
+ void SetAddMergedLeftSize( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize );
+
+ /** Sets an additional right width for the merged range that contains (nCol,nRow).
+ @descr Useful to handle merged ranges that are not completely part of the array.
+ @precond The merged range must be at the right border of the array. */
+ void SetAddMergedRightSize( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize );
+
+ /** Sets an additional top height for the merged range that contains (nCol,nRow).
+ @descr Useful to handle merged ranges that are not completely part of the array.
+ @precond The merged range must be at the top border of the array. */
+ void SetAddMergedTopSize( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize );
+
+ /** Sets an additional bottom height for the merged range that contains (nCol,nRow).
+ @descr Useful to handle merged ranges that are not completely part of the array.
+ @precond The merged range must be at the bottom border of the array. */
+ void SetAddMergedBottomSize( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize );
+
+ /** Returns true, if the cell (nCol,nRow) is part of a merged range. */
+ bool IsMerged( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ /** Returns the address of the top-left cell of the merged range that contains (nCol,nRow). */
+ void GetMergedOrigin( sal_Int32& rnFirstCol, sal_Int32& rnFirstRow, sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ /** Returns the top-left and bottom-right address of the merged range that contains (nCol,nRow). */
+ void GetMergedRange( sal_Int32& rnFirstCol, sal_Int32& rnFirstRow,
+ sal_Int32& rnLastCol, sal_Int32& rnLastRow, sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ // clipping
+
+ /** Sets a clipping range.
+ @descr
+ No cell borders outside of this clipping range will be drawn. In
+ difference to simply using the CreateB2DPrimitiveRange() function with the same
+ range, a clipping range causes the drawing functions to completely
+ ignore the frame styles connected from outside. This is used i.e.
+ in Calc to print single pages and to draw the print preview.
+ Partly visible diagonal frame borders in merged ranges are correctly
+ clipped too. This array can handle only one clip range at a time. */
+ void SetClipRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow );
+
+ // cell coordinates
+
+ /** Sets the X output coordinate of the left column. */
+ void SetXOffset( sal_Int32 nXOffset );
+
+ /** Sets the Y output coordinate of the top row. */
+ void SetYOffset( sal_Int32 nYOffset );
+
+ /** Sets the output width of the specified column. */
+ void SetColWidth( sal_Int32 nCol, sal_Int32 nWidth );
+
+ /** Sets the output height of the specified row. */
+ void SetRowHeight( sal_Int32 nRow, sal_Int32 nHeight );
+
+ /** Sets the same output width for all columns. */
+ void SetAllColWidths( sal_Int32 nWidth );
+
+ /** Sets the same output height for all rows. */
+ void SetAllRowHeights( sal_Int32 nHeight );
+
+ /** Returns the X output coordinate of the left border of the specified column.
+ @descr The column index <array-width> returns the X output coordinate
+ of the right array border. */
+ sal_Int32 GetColPosition( sal_Int32 nCol ) const;
+
+ /** Returns the Y output coordinate of the top border of the specified row.
+ @descr The row index <array-height> returns the Y output coordinate
+ of the bottom array border. */
+ sal_Int32 GetRowPosition( sal_Int32 nRow ) const;
+
+ /** Returns the output width of the specified range of columns. */
+ sal_Int32 GetColWidth( sal_Int32 nFirstCol, sal_Int32 nLastCol ) const;
+
+ /** Returns the output height of the specified range of rows. */
+ sal_Int32 GetRowHeight( sal_Int32 nFirstRow, sal_Int32 nLastRow ) const;
+
+ /** Returns the output width of the entire array. */
+ sal_Int32 GetWidth() const;
+
+ /** Returns the output height of the entire array. */
+ sal_Int32 GetHeight() const;
+
+ /** Returns the output range of the cell (nCol,nRow).
+ Returns total output range of merged ranges. */
+ basegfx::B2DRange GetCellRange( sal_Int32 nCol, sal_Int32 nRow ) const;
+
+ // return output range of given row/col range in logical coordinates
+ basegfx::B2DRange GetB2DRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow ) const;
+
+ // mirroring
+
+ /** Mirrors the entire array horizontally. */
+ void MirrorSelfX();
+
+ // drawing
+
+ /** Draws the part of the specified range, that is inside the clipping range.
+ @param pForceColor
+ If not NULL, only this color will be used to draw all frame borders. */
+ drawinglayer::primitive2d::Primitive2DContainer CreateB2DPrimitiveRange(
+ sal_Int32 nFirstCol, sal_Int32 nFirstRow,
+ sal_Int32 nLastCol, sal_Int32 nLastRow,
+ const Color* pForceColor ) const;
+
+ /** Draws the part of the array, that is inside the clipping range. */
+ drawinglayer::primitive2d::Primitive2DContainer CreateB2DPrimitiveArray() const;
+
+private:
+ std::unique_ptr<ArrayImpl> mxImpl;
+};
+
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/frmdirlbox.hxx b/include/svx/frmdirlbox.hxx
new file mode 100644
index 000000000..84160d846
--- /dev/null
+++ b/include/svx/frmdirlbox.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FRMDIRLBOX_HXX
+#define INCLUDED_SVX_FRMDIRLBOX_HXX
+
+#include <vcl/weld.hxx>
+#include <editeng/frmdir.hxx>
+#include <svx/svxdllapi.h>
+
+namespace svx
+{
+/** This listbox contains entries to select horizontal text direction.
+
+ The control works on the SvxFrameDirection enumeration (i.e. left-to-right,
+ right-to-left), used i.e. in conjunction with the SvxFrameDirectionItem.
+ */
+class SAL_WARN_UNUSED SVX_DLLPUBLIC FrameDirectionListBox
+{
+private:
+ std::unique_ptr<weld::ComboBox> m_xControl;
+
+public:
+ explicit FrameDirectionListBox(std::unique_ptr<weld::ComboBox> pControl);
+ virtual ~FrameDirectionListBox();
+ bool get_visible() const { return m_xControl->get_visible(); }
+ void save_value() { m_xControl->save_value(); }
+ bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); }
+ SvxFrameDirection get_active_id() const
+ {
+ return static_cast<SvxFrameDirection>(m_xControl->get_active_id().toUInt32());
+ }
+ void set_active_id(SvxFrameDirection eDir)
+ {
+ m_xControl->set_active_id(OUString::number(static_cast<sal_uInt32>(eDir)));
+ }
+ void remove_id(SvxFrameDirection eDir)
+ {
+ int nPos = m_xControl->find_id(OUString::number(static_cast<sal_uInt32>(eDir)));
+ if (nPos != -1)
+ m_xControl->remove(nPos);
+ }
+ void set_active(int pos) { m_xControl->set_active(pos); }
+ int get_active() const { return m_xControl->get_active(); }
+ void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
+ void hide() { m_xControl->hide(); }
+ void set_visible(bool bVisible) { m_xControl->set_visible(bVisible); }
+ void show() { m_xControl->show(); }
+ int get_count() const { return m_xControl->get_count(); }
+ /** Inserts a string with corresponding direction enum into the listbox. */
+ void append(SvxFrameDirection eDirection, const OUString& rString)
+ {
+ m_xControl->append(OUString::number(static_cast<sal_uInt32>(eDirection)), rString);
+ }
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink)
+ {
+ m_xControl->connect_changed(rLink);
+ }
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/frmsel.hxx b/include/svx/frmsel.hxx
new file mode 100644
index 000000000..498b4857c
--- /dev/null
+++ b/include/svx/frmsel.hxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_FRMSEL_HXX
+#define INCLUDED_SVX_FRMSEL_HXX
+
+#include <memory>
+#include <vcl/customweld.hxx>
+#include <editeng/borderline.hxx>
+#include <svx/framebordertype.hxx>
+#include <svx/svxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+class Color;
+
+enum class FrameSelFlags
+{
+ NONE = 0x0000,
+ /** If set, the left frame border is enabled. */
+ Left = 0x0001,
+ /** If set, the right frame border is enabled. */
+ Right = 0x0002,
+ /** If set, the top frame border is enabled. */
+ Top = 0x0004,
+ /** If set, the bottom frame border is enabled. */
+ Bottom = 0x0008,
+ /** If set, the inner horizontal frame border is enabled. */
+ InnerHorizontal = 0x0010,
+ /** If set, the inner vertical frame border is enabled. */
+ InnerVertical = 0x0020,
+ /** If set, the top-left to bottom-right diagonal frame border is enabled. */
+ DiagonalTLBR = 0x0040,
+ /** If set, the bottom-left to top-right diagonal frame border is enabled. */
+ DiagonalBLTR = 0x0080,
+
+ /** If set, all four outer frame borders are enabled. */
+ Outer = Left | Right | Top | Bottom,
+
+ /** If set, all frame borders will support the don't care state. */
+ DontCare = 0x0100
+};
+namespace o3tl
+{
+ template<> struct typed_flags<FrameSelFlags> : is_typed_flags<FrameSelFlags, 0x1ff> {};
+}
+
+namespace svx {
+
+struct FrameSelectorImpl;
+namespace a11y { class AccFrameSelectorChild; }
+
+/** All possible states of a frame border. */
+enum class FrameBorderState
+{
+ Show, /// Frame border has a visible style.
+ Hide, /// Frame border is hidden (off).
+ DontCare /// Frame border is in don't care state (if enabled).
+};
+
+
+namespace a11y
+{
+ class AccFrameSelector;
+}
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC FrameSelector final : public weld::CustomWidgetController
+{
+public:
+ FrameSelector();
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual ~FrameSelector() override;
+
+ /** Initializes the control, enables/disables frame borders according to flags. */
+ void Initialize( FrameSelFlags nFlags );
+
+ // enabled frame borders
+
+ /** Returns true, if the specified frame border is enabled. */
+ bool IsBorderEnabled( FrameBorderType eBorder ) const;
+ /** Returns the number of enabled frame borders. */
+ sal_Int32 GetEnabledBorderCount() const;
+ /** Returns the border type from the passed index (counts only enabled frame borders). */
+ FrameBorderType GetEnabledBorderType( sal_Int32 nIndex ) const;
+
+ // frame border state and style
+
+ /** Returns true, if the control supports the "don't care" frame border state. */
+ bool SupportsDontCareState() const;
+
+ /** Returns the state (visible/hidden/don't care) of the specified frame border. */
+ FrameBorderState GetFrameBorderState( FrameBorderType eBorder ) const;
+ /** Returns the style of the specified frame border, if it is visible. */
+ const editeng::SvxBorderLine* GetFrameBorderStyle( FrameBorderType eBorder ) const;
+
+ /** Shows the specified frame border using the passed style, or hides it, if pStyle is 0. */
+ void ShowBorder( FrameBorderType eBorder, const editeng::SvxBorderLine* pStyle );
+ /** Sets the specified frame border to "don't care" state. */
+ void SetBorderDontCare( FrameBorderType eBorder );
+
+ /** Returns true, if any enabled frame border has a visible style (not "don't care"). */
+ bool IsAnyBorderVisible() const;
+ /** Hides all enabled frame borders. */
+ void HideAllBorders();
+
+ /** Returns true, if all visible frame borders have equal widths.
+ @descr Ignores hidden and "don't care" frame borders. On success,
+ returns the width in the passed parameter. */
+ bool GetVisibleWidth( tools::Long& rnWidth, SvxBorderLineStyle& rnStyle ) const;
+ /** Returns true, if all visible frame borders have equal color.
+ @descr Ignores hidden and "don't care" frame borders. On success,
+ returns the color in the passed parameter. */
+ bool GetVisibleColor( Color& rColor ) const;
+
+ // frame border selection
+
+ /** Returns the current selection handler. */
+ const Link<LinkParamNone*,void>& GetSelectHdl() const;
+ /** Sets the passed handler that is called if the selection of the control changes. */
+ void SetSelectHdl( const Link<LinkParamNone*,void>& rHdl );
+
+ /** Returns true, if the specified frame border is selected. */
+ bool IsBorderSelected( FrameBorderType eBorder ) const;
+ /** Selects or deselects the specified frame border. */
+ void SelectBorder( FrameBorderType eBorder );
+ /** Returns true, if any of the enabled frame borders is selected. */
+ bool IsAnyBorderSelected() const;
+ /** Selects or deselects all frame borders. */
+ void SelectAllBorders( bool bSelect );
+ /** Deselects all frame borders. */
+ void DeselectAllBorders() { SelectAllBorders( false ); }
+
+ /** Selects or deselects all visible frame borders (ignores hidden and "don't care" borders). */
+ void SelectAllVisibleBorders();
+
+ /** Sets the passed line widths to all selected frame borders (in twips). */
+ void SetStyleToSelection( tools::Long nWidth, SvxBorderLineStyle nStyle );
+ /** Sets the passed color to all selected frame borders. */
+ void SetColorToSelection( const Color& rColor );
+
+ SvxBorderLineStyle getCurrentStyleLineStyle() const;
+
+ // accessibility
+
+ css::uno::Reference<css::accessibility::XAccessible> getAccessibleParent() const { return GetDrawingArea()->get_accessible_parent(); }
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
+ a11yrelationset get_accessible_relation_set() const { return GetDrawingArea()->get_accessible_relation_set(); }
+
+ /** Returns the accessibility child object of the specified frame border (if enabled). */
+ rtl::Reference< a11y::AccFrameSelectorChild >
+ GetChildAccessible( FrameBorderType eBorder );
+ /** Returns the accessibility child object with specified index (counts enabled frame borders only). */
+ css::uno::Reference< css::accessibility::XAccessible >
+ GetChildAccessible( sal_Int32 nIndex );
+ /** Returns the accessibility child object at the specified position (relative to control). */
+ css::uno::Reference< css::accessibility::XAccessible >
+ GetChildAccessible( const Point& rPos );
+
+ /** Returns the bounding rectangle of the specified frame border (if enabled). */
+ tools::Rectangle GetClickBoundRect( FrameBorderType eBorder ) const;
+
+private:
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual bool KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void StyleUpdated() override;
+ virtual void Resize() override;
+
+ rtl::Reference<a11y::AccFrameSelector> mxAccess; /// Pointer to accessibility object of the control.
+ std::unique_ptr< FrameSelectorImpl > mxImpl;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galctrl.hxx b/include/svx/galctrl.hxx
new file mode 100644
index 000000000..61fd62927
--- /dev/null
+++ b/include/svx/galctrl.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_GALCTRL_HXX
+#define INCLUDED_SVX_GALCTRL_HXX
+
+#include <vcl/graph.hxx>
+#include <vcl/customweld.hxx>
+#include <svtools/valueset.hxx>
+#include <vcl/GraphicObject.hxx>
+#include <svx/svxdllapi.h>
+
+class GalleryDragDrop;
+class GalleryTheme;
+class GalleryBrowser2;
+class INetURLObject;
+
+class GalleryPreview final : public weld::CustomWidgetController
+{
+private:
+
+ std::unique_ptr<GalleryDragDrop> mxDragDropTargetHelper;
+ std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow;
+ GraphicObject aGraphicObj;
+ tools::Rectangle aPreviewRect;
+ GalleryBrowser2* mpParent;
+ GalleryTheme* mpTheme;
+
+ bool ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const;
+
+ // Window
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual bool Command(const CommandEvent& rCEvt) override;
+ virtual bool KeyInput( const KeyEvent& rKEvt ) override;
+
+public:
+
+ GalleryPreview(GalleryBrowser2* pParent, std::unique_ptr<weld::ScrolledWindow> xScrolledWindow);
+ void SetTheme(GalleryTheme* pTheme) { mpTheme = pTheme; }
+ virtual ~GalleryPreview() override;
+
+ virtual bool StartDrag() override;
+
+ virtual void Show() override;
+ virtual void Hide() override;
+
+ void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
+ static void PreviewMedia( const INetURLObject& rURL );
+};
+
+class SVXCORE_DLLPUBLIC DialogGalleryPreview final : public weld::CustomWidgetController
+{
+private:
+ GraphicObject aGraphicObj;
+ tools::Rectangle aPreviewRect;
+
+ SVX_DLLPRIVATE bool ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const;
+
+ SVX_DLLPRIVATE virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+
+public:
+
+ DialogGalleryPreview();
+
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
+ bool SetGraphic( const INetURLObject& );
+};
+
+class GalleryIconView final : public ValueSet
+{
+private:
+ std::unique_ptr<GalleryDragDrop> mxDragDropTargetHelper;
+
+ GalleryBrowser2* mpParent;
+ GalleryTheme* mpTheme;
+
+ // ValueSet
+ virtual void UserDraw( const UserDrawEvent& rUDEvt ) override;
+
+ // Window
+ virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual bool Command( const CommandEvent& rCEvt ) override;
+ virtual bool KeyInput( const KeyEvent& rKEvt ) override;
+
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+
+public:
+
+ GalleryIconView(GalleryBrowser2* pParent, std::unique_ptr<weld::ScrolledWindow> xScrolledWindow);
+ void SetTheme(GalleryTheme* pTheme) { mpTheme = pTheme; }
+ virtual ~GalleryIconView() override;
+
+ virtual bool StartDrag() override;
+
+ static void drawTransparenceBackground(vcl::RenderContext& rOut, const Point& rPos, const Size& rSize);
+};
+
+#endif // INCLUDED_SVX_GALCTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/gallery.hxx b/include/svx/gallery.hxx
new file mode 100644
index 000000000..d668bf9e6
--- /dev/null
+++ b/include/svx/gallery.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_GALLERY_HXX
+#define INCLUDED_SVX_GALLERY_HXX
+
+#include <svx/svxdllapi.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+
+// Defines for preinstalled themes
+#define GALLERY_THEME_3D 1
+#define GALLERY_THEME_BULLETS 3
+#define GALLERY_THEME_HOMEPAGE 10
+#define GALLERY_THEME_HTMLBUTTONS 15
+#define GALLERY_THEME_POWERPOINT 16
+#define GALLERY_THEME_RULERS 17
+#define GALLERY_THEME_SOUNDS 18
+#define GALLERY_THEME_MYTHEME 20
+#define GALLERY_THEME_USERSOUNDS 21
+#define GALLERY_THEME_DUMMY5 36
+#define GALLERY_THEME_FONTWORK 37
+#define GALLERY_THEME_FONTWORK_VERTICAL 38
+
+#define RID_GALLERY_THEME_START (6000)
+
+// ATTENTION: This list has to be in sync with
+// * share/gallery (theme files are identified by id)
+//
+// Since galleries may be copied from older offices to newer, do *never* change
+// these IDs except adding new ones (and adapting GALLERY_THEME_LAST). The ID
+// *is* written into the binary file *.thm (which is a gallery theme combined
+// of three files, *.thm, *.sdv and *.sdg)
+
+#define RID_GALLERY_THEME_3D (RID_GALLERY_THEME_START + 1)
+#define RID_GALLERY_THEME_ANIMATIONS (RID_GALLERY_THEME_START + 2)
+#define RID_GALLERY_THEME_BULLETS (RID_GALLERY_THEME_START + 3)
+#define RID_GALLERY_THEME_OFFICE (RID_GALLERY_THEME_START + 4)
+#define RID_GALLERY_THEME_FLAGS (RID_GALLERY_THEME_START + 5)
+#define RID_GALLERY_THEME_FLOWCHARTS (RID_GALLERY_THEME_START + 6)
+#define RID_GALLERY_THEME_EMOTICONS (RID_GALLERY_THEME_START + 7)
+#define RID_GALLERY_THEME_PHOTOS (RID_GALLERY_THEME_START + 8)
+#define RID_GALLERY_THEME_BACKGROUNDS (RID_GALLERY_THEME_START + 9)
+#define RID_GALLERY_THEME_HOMEPAGE (RID_GALLERY_THEME_START + 10)
+#define RID_GALLERY_THEME_INTERACTION (RID_GALLERY_THEME_START + 11)
+#define RID_GALLERY_THEME_MAPS (RID_GALLERY_THEME_START + 12)
+#define RID_GALLERY_THEME_PEOPLE (RID_GALLERY_THEME_START + 13)
+#define RID_GALLERY_THEME_SURFACES (RID_GALLERY_THEME_START + 14)
+
+#define RID_GALLERY_THEME_SOUNDS (RID_GALLERY_THEME_START + 18)
+#define RID_GALLERY_THEME_SYMBOLS (RID_GALLERY_THEME_START + 19)
+#define RID_GALLERY_THEME_MYTHEME (RID_GALLERY_THEME_START + 20)
+
+#define RID_GALLERY_THEME_ARROWS (RID_GALLERY_THEME_START + 22)
+#define RID_GALLERY_THEME_BALLOONS (RID_GALLERY_THEME_START + 23)
+#define RID_GALLERY_THEME_KEYBOARD (RID_GALLERY_THEME_START + 24)
+#define RID_GALLERY_THEME_TIME (RID_GALLERY_THEME_START + 25)
+#define RID_GALLERY_THEME_PRESENTATION (RID_GALLERY_THEME_START + 26)
+#define RID_GALLERY_THEME_CALENDAR (RID_GALLERY_THEME_START + 27)
+#define RID_GALLERY_THEME_NAVIGATION (RID_GALLERY_THEME_START + 28)
+#define RID_GALLERY_THEME_COMMUNICATION (RID_GALLERY_THEME_START + 29)
+#define RID_GALLERY_THEME_FINANCES (RID_GALLERY_THEME_START + 30)
+#define RID_GALLERY_THEME_COMPUTER (RID_GALLERY_THEME_START + 31)
+#define RID_GALLERY_THEME_CLIMA (RID_GALLERY_THEME_START + 32)
+#define RID_GALLERY_THEME_EDUCATION (RID_GALLERY_THEME_START + 33)
+#define RID_GALLERY_THEME_TROUBLE (RID_GALLERY_THEME_START + 34)
+#define RID_GALLERY_THEME_SCREENBEANS (RID_GALLERY_THEME_START + 35)
+
+#define RID_GALLERY_THEME_COMPUTERS (RID_GALLERY_THEME_START + 39)
+#define RID_GALLERY_THEME_DIAGRAMS (RID_GALLERY_THEME_START + 40)
+#define RID_GALLERY_THEME_ENVIRONMENT (RID_GALLERY_THEME_START + 41)
+#define RID_GALLERY_THEME_FINANCE (RID_GALLERY_THEME_START + 42)
+#define RID_GALLERY_THEME_TRANSPORT (RID_GALLERY_THEME_START + 43)
+#define RID_GALLERY_THEME_TXTSHAPES (RID_GALLERY_THEME_START + 44)
+
+#define RID_GALLERY_THEME_FIRST RID_GALLERY_THEME_3D
+#define RID_GALLERY_THEME_LAST RID_GALLERY_THEME_TXTSHAPES
+
+class SdrModel;
+class Graphic;
+class BitmapEx;
+
+class SVXCORE_DLLPUBLIC GalleryExplorer
+{
+public:
+
+ static bool FillThemeList( std::vector<OUString>& rThemeList );
+
+ // FillObjList is filling rObjList with Strings of the internal Gallery Object URL
+ static bool FillObjList( std::u16string_view rThemeName, std::vector<OUString> &rObjList );
+ static bool FillObjList( const sal_uInt32 nThemeId, std::vector<OUString> &rObjList );
+
+ // FillObjTitleList is filling the rList with the title for each gallery object
+ static bool FillObjListTitle( const sal_uInt32 nThemeId, std::vector< OUString >& rList );
+
+ static bool InsertURL( std::u16string_view rThemeName, std::u16string_view rURL );
+ static bool InsertURL( sal_uInt32 nThemeId, std::u16string_view rURL );
+
+ static bool GetGraphicObj( std::u16string_view rThemeName, sal_uInt32 nPos,
+ Graphic* pGraphic );
+ static bool GetGraphicObj( sal_uInt32 nThemeId, sal_uInt32 nPos,
+ Graphic* pGraphic );
+
+ static sal_uInt32 GetSdrObjCount( std::u16string_view rThemeName );
+ static sal_uInt32 GetSdrObjCount( sal_uInt32 nThemeId );
+
+ static bool GetSdrObj( std::u16string_view rThemeName, sal_uInt32 nSdrModelPos,
+ SdrModel* pModel, BitmapEx* pThumb = nullptr );
+ static bool GetSdrObj( sal_uInt32 nThemeId, sal_uInt32 nSdrModelPos,
+ SdrModel* pModel, BitmapEx* pThumb = nullptr );
+
+ static bool BeginLocking( std::u16string_view rThemeName );
+ static bool BeginLocking( sal_uInt32 nThemeId );
+
+ static bool EndLocking( std::u16string_view rThemeName );
+ static bool EndLocking( sal_uInt32 nThemeId );
+};
+
+#endif // INCLUDED_SVX_GALLERY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/gallery1.hxx b/include/svx/gallery1.hxx
new file mode 100644
index 000000000..708d6fa0d
--- /dev/null
+++ b/include/svx/gallery1.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_GALLERY1_HXX
+#define INCLUDED_SVX_GALLERY1_HXX
+
+#include <rtl/ustring.hxx>
+#include <svl/SfxBroadcaster.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/urlobj.hxx>
+#include <svx/gallerybinaryengineentry.hxx>
+#include <svx/gallerybinaryengine.hxx>
+
+#include <cstdio>
+#include <memory>
+#include <vector>
+
+class GalleryBinaryEngineEntry;
+class GalleryStorageLocations;
+class GalleryTheme;
+
+class GalleryThemeEntry
+{
+private:
+
+ std::unique_ptr<GalleryBinaryEngineEntry> mpGalleryStorageEngineEntry;
+ OUString aName;
+ sal_uInt32 nId;
+ bool bReadOnly;
+ bool bModified;
+ bool bThemeNameFromResource;
+
+public:
+ GalleryThemeEntry( bool bCreateUniqueURL,
+ const INetURLObject& rBaseURL,
+ const OUString& rName,
+ bool bReadOnly, bool bNewFile,
+ sal_uInt32 nId, bool bThemeNameFromResource );
+
+ const std::unique_ptr<GalleryBinaryEngineEntry>& getGalleryStorageEngineEntry() const { return mpGalleryStorageEngineEntry; }
+
+ GalleryStorageLocations& getGalleryStorageLocations() const { return *mpGalleryStorageEngineEntry->getGalleryStorageLocations(); }
+
+ GalleryTheme* createGalleryTheme(Gallery* pGallery);
+
+ std::unique_ptr<GalleryBinaryEngine> createGalleryStorageEngine(GalleryObjectCollection& mrGalleryObjectCollection);
+
+ const OUString& GetThemeName() const { return aName; }
+
+ bool IsReadOnly() const { return bReadOnly; }
+ bool IsDefault() const;
+
+ bool IsHidden() const { return aName.match("private://gallery/hidden/"); }
+
+ bool IsModified() const { return bModified; }
+ void SetModified( bool bSet ) { bModified = ( bSet && !IsReadOnly() ); }
+
+ void SetName( const OUString& rNewName );
+ bool IsNameFromResource() const { return bThemeNameFromResource; }
+
+ sal_uInt32 GetId() const { return nId; }
+ void SetId( sal_uInt32 nNewId, bool bResetThemeName );
+
+
+ void removeTheme();
+
+ std::unique_ptr<GalleryTheme> getCachedTheme(Gallery* pGallery);
+
+ void setStorageLocations(INetURLObject& rURL);
+};
+
+class SfxListener;
+class GalleryTheme;
+class GalleryThemeCacheEntry;
+
+
+class SVXCORE_DLLPUBLIC Gallery final : public SfxBroadcaster
+{
+ typedef std::vector<GalleryThemeCacheEntry*> GalleryCacheThemeList;
+
+private:
+
+ std::vector< std::unique_ptr<GalleryThemeEntry> > aThemeList;
+ GalleryCacheThemeList aThemeCache;
+ INetURLObject aRelURL;
+ INetURLObject aUserURL;
+ bool bMultiPath;
+
+ SAL_DLLPRIVATE void ImplLoad( std::u16string_view rMultiPath );
+ SAL_DLLPRIVATE void ImplLoadSubDirs( const INetURLObject& rBaseURL, bool& rbIsReadOnly );
+
+ GalleryThemeEntry* ImplGetThemeEntry( std::u16string_view rThemeName );
+
+ SAL_DLLPRIVATE GalleryTheme* ImplGetCachedTheme( GalleryThemeEntry* pThemeEntry );
+ SAL_DLLPRIVATE void ImplDeleteCachedTheme( GalleryTheme const * pTheme );
+
+ Gallery& operator=( Gallery const & ) = delete; // MSVC2015 workaround
+ Gallery( Gallery const & ) = delete; // MSVC2015 workaround
+
+public:
+ // only for gengal utility!
+ Gallery( std::u16string_view rMultiPath );
+ virtual ~Gallery() override;
+
+ static Gallery* GetGalleryInstance();
+
+ size_t GetThemeCount() const { return aThemeList.size(); }
+ SAL_DLLPRIVATE const GalleryThemeEntry* GetThemeInfo( size_t nPos )
+ { return nPos < aThemeList.size() ? aThemeList[ nPos ].get() : nullptr; }
+ const GalleryThemeEntry* GetThemeInfo( std::u16string_view rThemeName ) { return ImplGetThemeEntry( rThemeName ); }
+
+ bool HasTheme( std::u16string_view rThemeName );
+ SAL_DLLPRIVATE OUString GetThemeName( sal_uInt32 nThemeId ) const;
+
+ bool CreateTheme( const OUString& rThemeName );
+ void RenameTheme( const OUString& rOldName, const OUString& rNewName );
+ bool RemoveTheme( const OUString& rThemeName );
+
+ GalleryTheme* AcquireTheme( std::u16string_view rThemeName, SfxListener& rListener );
+ void ReleaseTheme( GalleryTheme* pTheme, SfxListener& rListener );
+
+public:
+
+ SAL_DLLPRIVATE const INetURLObject& GetUserURL() const { return aUserURL; }
+ SAL_DLLPRIVATE const INetURLObject& GetRelativeURL() const { return aRelURL; }
+};
+
+#endif // INCLUDED_SVX_GALLERY1_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/gallerybinaryengine.hxx b/include/svx/gallerybinaryengine.hxx
new file mode 100644
index 000000000..5e89b5dd7
--- /dev/null
+++ b/include/svx/gallerybinaryengine.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/galmisc.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/fmmodel.hxx>
+#include <svx/gallerybinarystoragelocations.hxx>
+#include <svx/galleryfilestorage.hxx>
+#include <tools/urlobj.hxx>
+#include <sot/storage.hxx>
+#include <vcl/salctype.hxx>
+
+#include <tools/datetime.hxx>
+
+#include <memory>
+
+class GalleryStorageLocations;
+class GalleryBinaryStorageLocations;
+class GalleryObjectCollection;
+class SgaObjectSvDraw;
+class SgaObjectBmp;
+class SgaObject;
+class SotStorage;
+struct GalleryObject;
+class FmFormModel;
+class GalleryTheme;
+class GalleryThemeEntry;
+
+class SVXCORE_DLLPUBLIC GalleryBinaryEngine final : public GalleryFileStorage
+{
+private:
+ tools::SvRef<SotStorage> m_aSvDrawStorageRef;
+ const GalleryBinaryStorageLocations& maGalleryStorageLocations;
+ GalleryObjectCollection& mrGalleryObjectCollection;
+ bool mbReadOnly;
+ OUString m_aDestDir;
+ bool m_bDestDirRelative;
+
+ const INetURLObject& GetSdgURL() const { return maGalleryStorageLocations.GetSdgURL(); }
+ const INetURLObject& GetSdvURL() const { return maGalleryStorageLocations.GetSdvURL(); }
+ const INetURLObject& GetStrURL() const { return maGalleryStorageLocations.GetStrURL(); }
+ const INetURLObject& GetThmURL() const { return maGalleryStorageLocations.GetThmURL(); }
+
+public:
+ GalleryBinaryEngine(const GalleryBinaryStorageLocations& rGalleryStorageLocations,
+ GalleryObjectCollection& rGalleryObjectCollection, bool bReadOnly);
+ SAL_DLLPRIVATE ~GalleryBinaryEngine();
+
+ void clearSotStorage();
+
+ void setDestDir(const OUString& rDestDir, bool bRelative);
+
+ SAL_DLLPRIVATE void ImplCreateSvDrawStorage();
+ SAL_DLLPRIVATE const tools::SvRef<SotStorage>& GetSvDrawStorage() const;
+
+ const INetURLObject& getThemeURL() const { return maGalleryStorageLocations.getThemeURL(); }
+
+ SAL_DLLPRIVATE bool implWrite(const GalleryTheme& rTheme, const GalleryThemeEntry* pThm);
+
+ void insertObject(const SgaObject& rObj, GalleryObject* pFoundEntry, sal_uInt32 nInsertPos);
+ void removeObject(const std::unique_ptr<GalleryObject>& pEntry);
+
+ std::unique_ptr<SgaObject> implReadSgaObject(GalleryObject const* pEntry);
+ bool implWriteSgaObject(const SgaObject& rObj, sal_uInt32 nPos, GalleryObject* pExistentEntry);
+
+ bool readModel(const GalleryObject* pObject, SdrModel& rModel);
+ SgaObjectSvDraw insertModel(const FmFormModel& rModel, const INetURLObject& rUserURL);
+
+ bool readModelStream(const GalleryObject* pObject,
+ tools::SvRef<SotTempStream> const& rxModelStream);
+ SgaObjectSvDraw insertModelStream(const tools::SvRef<SotTempStream>& rxModelStream,
+ const INetURLObject& rUserURL);
+
+ INetURLObject implCreateUniqueURL(SgaObjKind eObjKind, const INetURLObject& rUserURL,
+ ConvertDataFormat nFormat = ConvertDataFormat::Unknown);
+
+ SgaObjectBmp insertGraphic(const Graphic& rGraphic, const GfxLink& aGfxLink,
+ const ConvertDataFormat& nExportFormat,
+ const INetURLObject& rUserURL);
+
+ SgaObjectSvDraw updateSvDrawObject(const GalleryObject* pEntry);
+
+ void updateTheme();
+ static void insertFileOrDirURL(const INetURLObject& rFileOrDirURL,
+ std::vector<INetURLObject>& rURLVector);
+
+ SvStream& writeGalleryTheme(SvStream& rOStm, const GalleryTheme& rTheme,
+ const GalleryThemeEntry* pThm);
+
+ DateTime getModificationDate() const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/gallerybinaryengineentry.hxx b/include/svx/gallerybinaryengineentry.hxx
new file mode 100644
index 000000000..f624e9177
--- /dev/null
+++ b/include/svx/gallerybinaryengineentry.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <tools/urlobj.hxx>
+#include <svx/galtheme.hxx>
+#include <svx/gallerybinaryengine.hxx>
+#include <svx/gallerybinarystoragelocations.hxx>
+#include <svx/galleryfilestorageentry.hxx>
+
+class GalleryBinaryStorageLocations;
+class GalleryObjectCollection;
+class GalleryBinaryEngine;
+
+class GalleryBinaryEngineEntry final : public GalleryFileStorageEntry
+{
+private:
+ std::unique_ptr<GalleryBinaryStorageLocations> mpGalleryStorageLocations;
+
+public:
+ GalleryBinaryEngineEntry();
+ static void CreateUniqueURL(const INetURLObject& rBaseURL, INetURLObject& aURL);
+
+ OUString ReadStrFromIni(std::u16string_view aKeyName) const;
+
+ const INetURLObject& GetThmURL() const { return mpGalleryStorageLocations->GetThmURL(); }
+ const INetURLObject& GetSdgURL() const { return mpGalleryStorageLocations->GetSdgURL(); }
+ const INetURLObject& GetSdvURL() const { return mpGalleryStorageLocations->GetSdvURL(); }
+ const INetURLObject& GetStrURL() const { return mpGalleryStorageLocations->GetStrURL(); }
+
+ const std::unique_ptr<GalleryBinaryStorageLocations>& getGalleryStorageLocations() const
+ {
+ return mpGalleryStorageLocations;
+ }
+
+ static GalleryThemeEntry* CreateThemeEntry(const INetURLObject& rURL, bool bReadOnly);
+
+ void removeTheme();
+
+ std::unique_ptr<GalleryTheme>& getCachedTheme(std::unique_ptr<GalleryTheme>& pNewTheme);
+
+ void setStorageLocations(INetURLObject& rURL);
+
+ std::unique_ptr<GalleryBinaryEngine>
+ createGalleryStorageEngine(GalleryObjectCollection& mrGalleryObjectCollection, bool& bReadOnly);
+};
+
+SvStream& ReadGalleryTheme(SvStream& rIn, GalleryTheme& rTheme);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/gallerybinarystoragelocations.hxx b/include/svx/gallerybinarystoragelocations.hxx
new file mode 100644
index 000000000..6876c64a2
--- /dev/null
+++ b/include/svx/gallerybinarystoragelocations.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <tools/urlobj.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/gallerystoragelocations.hxx>
+
+class SVXCORE_DLLPUBLIC GalleryBinaryStorageLocations final : public GalleryStorageLocations
+{
+private:
+ INetURLObject maThmURL;
+ INetURLObject maSdgURL;
+ INetURLObject maSdvURL;
+ INetURLObject maStrURL;
+
+ void SetThmExtension(INetURLObject& aURL);
+ void SetSdgExtension(INetURLObject& aURL);
+ void SetSdvExtension(INetURLObject& aURL);
+ void SetStrExtension(INetURLObject& aURL);
+
+public:
+ static INetURLObject ImplGetURLIgnoreCase(const INetURLObject& rURL);
+
+ const INetURLObject& GetThmURL() const { return maThmURL; }
+ const INetURLObject& GetSdgURL() const { return maSdgURL; }
+ const INetURLObject& GetSdvURL() const { return maSdvURL; }
+ const INetURLObject& GetStrURL() const { return maStrURL; }
+
+ void SetStorageLocations(INetURLObject& aURL);
+
+ const INetURLObject& getThemeURL() const { return maSdgURL; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galleryfilestorage.hxx b/include/svx/galleryfilestorage.hxx
new file mode 100644
index 000000000..fee632e9b
--- /dev/null
+++ b/include/svx/galleryfilestorage.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+class GalleryFileStorage
+{
+public:
+ virtual ~GalleryFileStorage() = 0;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galleryfilestorageentry.hxx b/include/svx/galleryfilestorageentry.hxx
new file mode 100644
index 000000000..0f00cfb5a
--- /dev/null
+++ b/include/svx/galleryfilestorageentry.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+class GalleryFileStorageEntry
+{
+public:
+ virtual ~GalleryFileStorageEntry() = 0;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galleryitem.hxx b/include/svx/galleryitem.hxx
new file mode 100644
index 000000000..de16c6f24
--- /dev/null
+++ b/include/svx/galleryitem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_GALLERYITEM_HXX
+#define INCLUDED_SVX_GALLERYITEM_HXX
+
+#include <svx/svxdllapi.h>
+#include <svl/poolitem.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::graphic { class XGraphic; }
+namespace com::sun::star::lang { class XComponent; }
+
+// property names map those from css::gallery::GalleryItem
+// with exception of "AsLink" and "FilterName"
+inline constexpr OUStringLiteral SVXGALLERYITEM_TYPE = u"GalleryItemType";
+inline constexpr OUStringLiteral SVXGALLERYITEM_URL = u"URL";
+inline constexpr OUStringLiteral SVXGALLERYITEM_FILTER = u"FilterName";
+inline constexpr OUStringLiteral SVXGALLERYITEM_DRAWING = u"Drawing";
+inline constexpr OUStringLiteral SVXGALLERYITEM_GRAPHIC = u"Graphic";
+#define SVXGALLERYITEM_PARAMS 5
+inline constexpr OUStringLiteral SVXGALLERYITEM_ARGNAME = u"GalleryItem";
+
+class SVXCORE_DLLPUBLIC SvxGalleryItem final : public SfxPoolItem
+{
+ sal_Int8 m_nType;
+ OUString m_aURL;
+ css::uno::Reference< css::lang::XComponent > m_xDrawing;
+ css::uno::Reference< css::graphic::XGraphic > m_xGraphic;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxGalleryItem();
+ SvxGalleryItem( const SvxGalleryItem& );
+ virtual ~SvxGalleryItem() override;
+
+ sal_Int8 GetType() const { return m_nType; }
+ const OUString& GetURL() const { return m_aURL; }
+ const css::uno::Reference< css::graphic::XGraphic >& GetGraphic() const { return m_xGraphic; }
+
+ // pure virtual methods from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxGalleryItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ // bridge to UNO
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galleryobjectcollection.hxx b/include/svx/galleryobjectcollection.hxx
new file mode 100644
index 000000000..07a952b59
--- /dev/null
+++ b/include/svx/galleryobjectcollection.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svxdllapi.h>
+#include <svx/galmisc.hxx>
+#include <svx/galleryobjectstorage.hxx>
+
+#include <vcl/bitmapex.hxx>
+#include <tools/urlobj.hxx>
+#include <memory>
+#include <vector>
+
+struct GalleryObject
+{
+ std::unique_ptr<GalleryObjectStorage> m_pGalleryObjectStorage;
+ sal_uInt32 nOffset;
+ SgaObjKind eObjKind;
+ bool mbDelete;
+
+ //UI visualization buffering
+ BitmapEx maPreviewBitmapEx;
+ Size maPreparedSize;
+ OUString maTitle;
+ OUString maPath;
+
+ const INetURLObject& getURL() const { return m_pGalleryObjectStorage->getURL(); }
+};
+
+class SVXCORE_DLLPUBLIC GalleryObjectCollection
+{
+private:
+ std::vector<std::unique_ptr<GalleryObject>> m_aObjectList;
+
+public:
+ GalleryObjectCollection();
+ std::vector<std::unique_ptr<GalleryObject>>& getObjectList() { return m_aObjectList; }
+ std::unique_ptr<GalleryObject>& get(sal_uInt32 nPos) { return m_aObjectList[nPos]; }
+ const std::unique_ptr<GalleryObject>& get(sal_uInt32 nPos) const { return m_aObjectList[nPos]; }
+ sal_uInt32 size() const { return m_aObjectList.size(); }
+
+ const GalleryObject* searchObjectWithURL(const INetURLObject& rURL);
+ const GalleryObject* getForPosition(sal_uInt32 nPos) const;
+ sal_uInt32 searchPosWithObject(const GalleryObject* pObj);
+ const INetURLObject& getURLForPosition(sal_uInt32 nPos) const;
+
+ void clear();
+
+ GalleryObjectCollection(GalleryObjectCollection const&) = delete;
+ void operator=(GalleryObjectCollection const&) = delete;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galleryobjectstorage.hxx b/include/svx/galleryobjectstorage.hxx
new file mode 100644
index 000000000..cdca68b14
--- /dev/null
+++ b/include/svx/galleryobjectstorage.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <tools/urlobj.hxx>
+
+class GalleryObjectStorage
+{
+public:
+ virtual ~GalleryObjectStorage() = 0;
+ virtual const INetURLObject& getURL() const = 0;
+ virtual void setURL(INetURLObject aURL) = 0;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/gallerystoragelocations.hxx b/include/svx/gallerystoragelocations.hxx
new file mode 100644
index 000000000..343ed0b7e
--- /dev/null
+++ b/include/svx/gallerystoragelocations.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svxdllapi.h>
+#include <tools/urlobj.hxx>
+
+class SVXCORE_DLLPUBLIC GalleryStorageLocations
+{
+public:
+ virtual ~GalleryStorageLocations() = 0;
+ virtual void SetStorageLocations(INetURLObject& aURL) = 0;
+ virtual const INetURLObject& getThemeURL() const = 0;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx
new file mode 100644
index 000000000..6c45f7de6
--- /dev/null
+++ b/include/svx/galmisc.hxx
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_GALMISC_HXX
+#define INCLUDED_SVX_GALMISC_HXX
+
+#include <vcl/imap.hxx>
+#include <svl/hint.hxx>
+#include <vcl/transfer.hxx>
+#include <svx/svdobj.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <svx/svxdllapi.h>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+#include <memory>
+
+namespace com::sun::star::awt { class XProgressBar; }
+
+class INetURLObject;
+class GalleryTheme;
+class SotStorageStream;
+class SotTempStream;
+
+struct ExchangeData
+{
+ GalleryTheme* pTheme;
+ OUString aEditedTitle;
+ Date aThemeChangeDate;
+ tools::Time aThemeChangeTime;
+
+ ExchangeData()
+ : pTheme(nullptr)
+ , aThemeChangeDate( Date::EMPTY )
+ , aThemeChangeTime( tools::Time::EMPTY )
+ {
+ }
+};
+
+enum class SgaObjKind
+{
+ NONE = 0, // abstract object
+ Bitmap = 1, // bitmap object
+ Sound = 2, // sound object
+ Animation = 4, // animation object
+ SvDraw = 5, // Svdraw object
+ Inet = 6 // graphics from the internet
+};
+
+#define ID_IMAPINFO 2
+
+#define STREAMBUF_SIZE 16384L
+
+enum class GalleryGraphicImportRet
+{
+ IMPORT_NONE, IMPORT_FILE
+};
+
+#define GALLERY_PROGRESS_RANGE 10000
+
+#define GALLERY_FG_COLOR Application::GetSettings().GetStyleSettings().GetWindowTextColor()
+#define GALLERY_BG_COLOR Application::GetSettings().GetStyleSettings().GetWindowColor()
+#define GALLERY_DLG_COLOR Application::GetSettings().GetStyleSettings().GetDialogColor()
+
+class SvStream;
+class Graphic;
+class FmFormModel;
+
+GalleryGraphicImportRet GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic, OUString& rFilterName );
+bool GallerySvDrawImport( SvStream& rIStm, SdrModel& rModel );
+bool CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageMap& rImageMap );
+SVXCORE_DLLPUBLIC OUString
+ GetReducedString( const INetURLObject& rURL, sal_Int32 nMaxLen );
+OUString GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL );
+
+bool FileExists( const INetURLObject& rURL );
+bool CreateDir( const INetURLObject& rURL );
+bool CopyFile( const INetURLObject& rSrcURL, const INetURLObject& rDstURL );
+bool KillFile( const INetURLObject& rURL );
+
+class SgaIMapInfo final : public SdrObjUserData, public SfxListener
+{
+ ImageMap aImageMap;
+
+public:
+ SgaIMapInfo() : SdrObjUserData( SdrInventor::SgaImap, ID_IMAPINFO ) {};
+
+ SgaIMapInfo( const ImageMap& rImageMap) :
+ SdrObjUserData( SdrInventor::SgaImap, ID_IMAPINFO ),
+ aImageMap( rImageMap ) {};
+
+ virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* ) const override
+ {
+ SgaIMapInfo* pInfo = new SgaIMapInfo;
+ pInfo->aImageMap = aImageMap;
+ return std::unique_ptr<SdrObjUserData>(pInfo);
+ }
+
+ const ImageMap& GetImageMap() const { return aImageMap; }
+};
+
+class GraphicFilter;
+
+class SVXCORE_DLLPUBLIC GalleryProgress
+{
+ css::uno::Reference< css::awt::XProgressBar > mxProgressBar;
+
+ public:
+
+ GalleryProgress( const GraphicFilter* pFilter = nullptr );
+ ~GalleryProgress();
+
+ void Update( sal_Int32 nVal, sal_Int32 nMaxVal );
+};
+
+class GalleryTheme;
+class GraphicObject;
+
+class GalleryTransferable final : public TransferDataContainer
+{
+friend class GalleryTheme;
+using TransferableHelper::CopyToClipboard;
+
+ GalleryTheme* mpTheme;
+ SgaObjKind meObjectKind;
+ sal_uInt32 mnObjectPos;
+ tools::SvRef<SotTempStream> mxModelStream;
+ std::unique_ptr<GraphicObject> mpGraphicObject;
+ std::unique_ptr<INetURLObject> mpURL;
+
+ void InitData( bool bLazy );
+
+public:
+ GalleryTransferable( GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bLazy );
+ virtual ~GalleryTransferable() override;
+
+ void SelectObject(sal_uInt32 nObjectPos);
+
+ // TransferableHelper
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual void DragFinished( sal_Int8 nDropAction ) override;
+ virtual void ObjectReleased() override;
+
+ bool StartDrag();
+};
+
+enum class GalleryHintType
+{
+ CLOSE_THEME,
+ THEME_REMOVED,
+ THEME_RENAMED,
+ THEME_CREATED,
+ THEME_UPDATEVIEW,
+ CLOSE_OBJECT
+};
+
+class GalleryHint final : public SfxHint
+{
+private:
+
+ GalleryHintType mnType;
+ OUString maThemeName;
+ OUString maStringData;
+ void* mnData1;
+
+public:
+
+ GalleryHint( GalleryHintType nType, const OUString& rThemeName, void* nData1 = nullptr ) :
+ mnType( nType ), maThemeName( rThemeName ), mnData1( nData1 ) {}
+
+ GalleryHint( GalleryHintType nType, const OUString& rThemeName, const OUString& rStringData ) :
+ mnType( nType ), maThemeName( rThemeName ), maStringData( rStringData ), mnData1( nullptr ) {}
+
+ GalleryHintType GetType() const { return mnType; }
+ const OUString& GetThemeName() const { return maThemeName; }
+ const OUString& GetStringData() const { return maStringData; }
+ void* GetData1() const { return mnData1; }
+};
+
+struct GalleryObject;
+
+INetURLObject ImplGetURL(const GalleryObject* pObject);
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
new file mode 100644
index 000000000..585293be0
--- /dev/null
+++ b/include/svx/galtheme.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_GALTHEME_HXX
+#define INCLUDED_SVX_GALTHEME_HXX
+
+#include <svx/svxdllapi.h>
+#include <svx/galleryobjectcollection.hxx>
+#include <svx/gallerybinaryengine.hxx>
+
+#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/datetime.hxx>
+#include <vcl/bitmapex.hxx>
+#include <svl/SfxBroadcaster.hxx>
+#include <svx/galmisc.hxx>
+#include <memory>
+
+namespace weld { class ComboBox; }
+
+class SotStorageStream;
+
+class GalleryThemeEntry;
+class SgaObject;
+class FmFormModel;
+class Gallery;
+
+namespace unogallery
+{
+ class GalleryTheme;
+ class GalleryItem;
+}
+
+class SVXCORE_DLLPUBLIC GalleryTheme final : public SfxBroadcaster
+{
+ friend class Gallery;
+ friend class GalleryThemeCacheEntry;
+ friend class ::unogallery::GalleryTheme;
+ friend class ::unogallery::GalleryItem;
+
+private:
+
+ std::unique_ptr<GalleryBinaryEngine> mpGalleryStorageEngine;
+ GalleryObjectCollection maGalleryObjectCollection;
+ Gallery* pParent;
+ GalleryThemeEntry* pThm;
+ sal_uInt32 mnThemeLockCount;
+ sal_uInt32 mnBroadcasterLockCount;
+ sal_uInt32 nDragPos;
+ bool bDragging;
+ bool bAbortActualize;
+
+ const std::unique_ptr<GalleryBinaryEngine>& getGalleryStorageEngine() const { return mpGalleryStorageEngine; }
+
+ SAL_DLLPRIVATE void ImplSetModified( bool bModified );
+ SAL_DLLPRIVATE void ImplBroadcast(sal_uInt32 nUpdatePos);
+
+ GalleryTheme(GalleryTheme const &) = delete;
+ void operator =(GalleryTheme const &) = delete;
+
+public:
+ SAL_DLLPRIVATE GalleryTheme(Gallery* pGallery, GalleryThemeEntry* pThemeEntry);
+
+ SAL_DLLPRIVATE virtual ~GalleryTheme() override;
+
+ SAL_DLLPRIVATE sal_uInt32 GetObjectCount() const { return maGalleryObjectCollection.size(); }
+
+ std::unique_ptr<SgaObject> AcquireObject(sal_uInt32 nPos);
+
+ bool InsertObject(const SgaObject& rObj, sal_uInt32 nPos = SAL_MAX_UINT32);
+ void RemoveObject(sal_uInt32 nPos);
+ bool ChangeObjectPos(sal_uInt32 nOldPos, sal_uInt32 nNewPos);
+
+ const OUString& GetName() const;
+
+ // used for building gallery themes during compilation:
+ void SetDestDir(const OUString& rDestDir, bool bRelative);
+
+ sal_uInt32 GetId() const;
+ SAL_DLLPRIVATE void SetId( sal_uInt32 nNewId, bool bResetThemeName );
+
+ SAL_DLLPRIVATE void SetDragging( bool bSet ) { bDragging = bSet; }
+ SAL_DLLPRIVATE bool IsDragging() const { return bDragging; }
+
+ SAL_DLLPRIVATE void LockTheme() { ++mnThemeLockCount; }
+ SAL_DLLPRIVATE bool UnlockTheme();
+
+ SAL_DLLPRIVATE void LockBroadcaster() { mnBroadcasterLockCount++; }
+ void UnlockBroadcaster();
+ SAL_DLLPRIVATE bool IsBroadcasterLocked() const { return mnBroadcasterLockCount > 0; }
+
+ SAL_DLLPRIVATE void SetDragPos(sal_uInt32 nPos) { nDragPos = nPos; }
+ SAL_DLLPRIVATE sal_uInt32 GetDragPos() const { return nDragPos; }
+
+ bool IsReadOnly() const;
+ bool IsDefault() const;
+
+ void Actualize( const Link<const INetURLObject&, void>& rActualizeLink, GalleryProgress* pProgress = nullptr );
+ SAL_DLLPRIVATE void AbortActualize() { bAbortActualize = true; }
+
+ SAL_DLLPRIVATE Gallery* GetParent() const { return pParent; }
+
+public:
+
+ SAL_DLLPRIVATE SgaObjKind GetObjectKind(sal_uInt32 nPos) const
+ {
+ if (nPos < GetObjectCount())
+ return maGalleryObjectCollection.getForPosition( nPos )->eObjKind;
+ return SgaObjKind::NONE;
+ }
+
+ SAL_DLLPRIVATE const INetURLObject& GetObjectURL(sal_uInt32 nPos) const
+ {
+ DBG_ASSERT(nPos < GetObjectCount(), "Position out of range");
+ return maGalleryObjectCollection.getURLForPosition(nPos);
+ }
+
+ SAL_DLLPRIVATE bool GetThumb(sal_uInt32 nPos, BitmapEx& rBmp);
+
+ bool GetGraphic(sal_uInt32 nPos, Graphic& rGraphic);
+ bool InsertGraphic(const Graphic& rGraphic, sal_uInt32 nInsertPos);
+
+ bool GetModel(sal_uInt32 nPos, SdrModel& rModel);
+ bool InsertModel(const FmFormModel& rModel, sal_uInt32 nInsertPos);
+
+ SAL_DLLPRIVATE bool GetModelStream(sal_uInt32 nPos, tools::SvRef<SotTempStream> const & rModelStreamRef);
+ SAL_DLLPRIVATE bool InsertModelStream(const tools::SvRef<SotTempStream>& rModelStream, sal_uInt32 nInsertPos);
+
+ SAL_DLLPRIVATE bool GetURL(sal_uInt32 nPos, INetURLObject& rURL);
+ bool InsertURL(const INetURLObject& rURL, sal_uInt32 nInsertPos = SAL_MAX_UINT32);
+ SAL_DLLPRIVATE bool InsertFileOrDirURL(const INetURLObject& rFileOrDirURL, sal_uInt32 nInsertPos);
+
+ SAL_DLLPRIVATE bool InsertTransferable(const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable, sal_uInt32 nInsertPos);
+
+ SAL_DLLPRIVATE void CopyToClipboard(const weld::Widget& rWidget, sal_uInt32 nPos);
+
+ DateTime getModificationDate() const;
+
+ const INetURLObject& getThemeURL() const { return mpGalleryStorageEngine->getThemeURL(); }
+
+public:
+
+ SAL_DLLPRIVATE SvStream& ReadData( SvStream& rIn );
+ static void InsertAllThemes(weld::ComboBox& rListBox);
+
+ // for buffering PreviewBitmaps and strings for object and path
+ SAL_DLLPRIVATE void GetPreviewBitmapExAndStrings(sal_uInt32 nPos, BitmapEx& rBitmapEx, Size& rSize, OUString& rTitle, OUString& rPath);
+ SAL_DLLPRIVATE void SetPreviewBitmapExAndStrings(sal_uInt32 nPos, const BitmapEx& rBitmapEx, const Size& rSize, const OUString& rTitle, const OUString& rPath);
+};
+
+#endif // INCLUDED_SVX_GALTHEME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/grafctrl.hxx b/include/svx/grafctrl.hxx
new file mode 100644
index 000000000..bdb49f323
--- /dev/null
+++ b/include/svx/grafctrl.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_GRAFCTRL_HXX
+#define INCLUDED_SVX_GRAFCTRL_HXX
+
+#include <svl/lstner.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include <svx/svxdllapi.h>
+
+
+class SvxGrafToolBoxControl : public SfxToolBoxControl
+{
+public:
+ SvxGrafToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+ virtual ~SvxGrafToolBoxControl() override;
+
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
+ virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override;
+};
+
+
+class SVX_DLLPUBLIC SvxGrafRedToolBoxControl final : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafRedToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+};
+
+
+class SVX_DLLPUBLIC SvxGrafGreenToolBoxControl final : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafGreenToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+};
+
+
+class SVX_DLLPUBLIC SvxGrafBlueToolBoxControl final : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafBlueToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+};
+
+
+class SVX_DLLPUBLIC SvxGrafLuminanceToolBoxControl final : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafLuminanceToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+};
+
+
+class SVX_DLLPUBLIC SvxGrafContrastToolBoxControl final : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafContrastToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+};
+
+
+class SVX_DLLPUBLIC SvxGrafGammaToolBoxControl final : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafGammaToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+};
+
+
+class SVX_DLLPUBLIC SvxGrafTransparenceToolBoxControl final : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafTransparenceToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+};
+
+
+class SVX_DLLPUBLIC SvxGrafModeToolBoxControl final : public SfxToolBoxControl, public SfxListener
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafModeToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+ virtual ~SvxGrafModeToolBoxControl() override;
+
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
+ virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override;
+};
+
+
+class SdrView;
+class SfxRequest;
+
+
+class SVX_DLLPUBLIC SvxGrafAttrHelper
+{
+public:
+
+ static void ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView );
+ static void GetGrafAttrState( SfxItemSet& rSet, SdrView const & rView );
+};
+
+#endif // INCLUDED_SVX_GRAFCTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/graphctl.hxx b/include/svx/graphctl.hxx
new file mode 100644
index 000000000..10f5b26fe
--- /dev/null
+++ b/include/svx/graphctl.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_GRAPHCTL_HXX
+#define INCLUDED_SVX_GRAPHCTL_HXX
+
+#include <vcl/graph.hxx>
+#include <vcl/customweld.hxx>
+#include <svx/svxdllapi.h>
+
+#include <svx/svdview.hxx>
+#include <svx/svdobj.hxx>
+
+class GraphCtrl;
+
+class GraphCtrlUserCall final : public SdrObjUserCall
+{
+ GraphCtrl& rWin;
+
+public:
+
+ GraphCtrlUserCall(GraphCtrl& rGraphWin)
+ : rWin(rGraphWin)
+ {}
+
+ virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& rOldBoundRect) override;
+};
+
+class SvxGraphCtrlAccessibleContext;
+
+class SVX_DLLPUBLIC GraphCtrl : public weld::CustomWidgetController
+{
+ friend class GraphCtrlView;
+ friend class GraphCtrlUserCall;
+
+ Graphic aGraphic;
+ ScopedVclPtrInstance<VirtualDevice> xVD;
+ Idle aUpdateIdle;
+ Link<GraphCtrl*,void> aMousePosLink;
+ Link<GraphCtrl*,void> aGraphSizeLink;
+ Link<GraphCtrl*,void> aUpdateLink;
+ MapMode aMap100;
+ Size aGraphSize;
+ Point aMousePos;
+ std::unique_ptr<GraphCtrlUserCall> pUserCall;
+ SdrObjKind eObjKind;
+ sal_uInt16 nPolyEdit;
+ bool bEditMode;
+ bool mbSdrMode;
+ bool mbInIdleUpdate;
+ weld::Dialog* mpDialog;
+
+ DECL_DLLPRIVATE_LINK( UpdateHdl, Timer*, void );
+
+ rtl::Reference<SvxGraphCtrlAccessibleContext> mpAccContext;
+
+protected:
+
+ std::unique_ptr<SdrModel> pModel;
+ std::unique_ptr<SdrView> pView;
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+ virtual bool KeyInput(const KeyEvent& rKEvt) override;
+ virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
+ virtual bool MouseMove(const MouseEvent& rMEvt) override;
+
+ virtual void InitSdrModel();
+
+ virtual void SdrObjCreated( const SdrObject& rObj );
+ virtual void SdrObjChanged( const SdrObject& rObj );
+ virtual void MarkListHasChanged();
+
+ void GraphicToVD();
+
+ SdrObjUserCall* GetSdrUserCall() { return pUserCall.get(); }
+
+public:
+
+ GraphCtrl(weld::Dialog* pDialog);
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual ~GraphCtrl() override;
+
+ void SetGraphic( const Graphic& rGraphic, bool bNewModel = true );
+ const Graphic& GetGraphic() const { return aGraphic; }
+ const Size& GetGraphicSize() const { return aGraphSize; }
+
+ const Point& GetMousePos() const { return aMousePos; }
+
+ void SetEditMode( const bool bEditMode );
+
+ void SetPolyEditMode( const sal_uInt16 nPolyEdit );
+ sal_uInt16 GetPolyEditMode() const { return nPolyEdit; }
+
+ void SetObjKind( const SdrObjKind eObjKind );
+
+ SdrModel* GetSdrModel() const { return pModel.get(); }
+ SdrView* GetSdrView() const { return pView.get(); }
+ SdrObject* GetSelectedSdrObject() const;
+ bool IsChanged() const { return mbSdrMode && pModel->IsChanged(); }
+
+ void SetMousePosLink( const Link<GraphCtrl*,void>& rLink ) { aMousePosLink = rLink; }
+
+ void SetGraphSizeLink( const Link<GraphCtrl*,void>& rLink ) { aGraphSizeLink = rLink; }
+
+ void SetUpdateLink( const Link<GraphCtrl*,void>& rLink ) { aUpdateLink = rLink; }
+ void QueueIdleUpdate();
+
+ void SetSdrMode(bool b);
+
+ Point GetPositionInDialog() const;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+};
+
+class GraphCtrlView final : public SdrView
+{
+ GraphCtrl& rGraphCtrl;
+
+ virtual void MarkListHasChanged() override
+ {
+ SdrView::MarkListHasChanged();
+ rGraphCtrl.MarkListHasChanged();
+ }
+
+public:
+ GraphCtrlView(SdrModel& rSdrModel, GraphCtrl* pWindow)
+ : SdrView(rSdrModel, &pWindow->GetDrawingArea()->get_ref_device())
+ , rGraphCtrl(*pWindow)
+ {
+ }
+
+ virtual ~GraphCtrlView() override;
+
+ // override these so we can get the occasions SdrPaintView would call Window::Invalidate on its vcl::Window
+ // if it had one, and route to WidgetController::Invalidate instead
+ virtual rtl::Reference<sdr::overlay::OverlayManager> CreateOverlayManager(OutputDevice& rDevice) const override;
+ virtual void InvalidateOneWin(OutputDevice& rWin) override;
+ virtual void InvalidateOneWin(OutputDevice& rWin, const tools::Rectangle& rRect) override;
+};
+
+#endif // INCLUDED_SVX_GRAPHCTL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/graphichelper.hxx b/include/svx/graphichelper.hxx
new file mode 100644
index 000000000..1d3c6ee58
--- /dev/null
+++ b/include/svx/graphichelper.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_GRAPHICHELPER_HXX
+#define INCLUDED_SVX_GRAPHICHELPER_HXX
+
+#include <vcl/graph.hxx>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star::drawing { class XShape; }
+namespace com::sun::star::lang
+{
+class XComponent;
+}
+namespace weld { class Widget; }
+namespace weld { class Window; }
+
+class SVXCORE_DLLPUBLIC GraphicHelper
+{
+
+public:
+ static void GetPreferredExtension( OUString& rExtension, const Graphic& rGraphic );
+ static OUString GetImageType(const Graphic& rGraphic);
+ static OUString ExportGraphic(weld::Window* pWin, const Graphic& rGraphic, const OUString& rGraphicName);
+ static void
+ SaveShapeAsGraphicToPath(const css::uno::Reference<css::lang::XComponent>& xComponent,
+ const css::uno::Reference<css::drawing::XShape>& xShape,
+ const OUString& rMimeType, const OUString& rPath);
+ static void SaveShapeAsGraphic(weld::Window* pWin,
+ const css::uno::Reference<css::lang::XComponent>& xComponent,
+ const css::uno::Reference<css::drawing::XShape>& xShape);
+ static short HasToSaveTransformedImage(weld::Widget* pWin);
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/grfcrop.hxx b/include/svx/grfcrop.hxx
new file mode 100644
index 000000000..de0cfef5b
--- /dev/null
+++ b/include/svx/grfcrop.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_GRFCROP_HXX
+#define INCLUDED_SVX_GRFCROP_HXX
+
+#include <svl/poolitem.hxx>
+#include <svx/svxdllapi.h>
+
+#define GRFCROP_VERSION_SWDEFAULT 0
+#define GRFCROP_VERSION_MOVETOSVX 1
+
+class SVXCORE_DLLPUBLIC SvxGrfCrop : public SfxPoolItem
+{
+ sal_Int32 nLeft, nRight, nTop, nBottom;
+public:
+ SvxGrfCrop( TypedWhichId<SvxGrfCrop> );
+ SvxGrfCrop( sal_Int32 nLeft, sal_Int32 nRight,
+ sal_Int32 nTop, sal_Int32 nBottom,
+ TypedWhichId<SvxGrfCrop> );
+ virtual ~SvxGrfCrop() override;
+
+ SvxGrfCrop(SvxGrfCrop const &) = default;
+ SvxGrfCrop(SvxGrfCrop &&) = default;
+ SvxGrfCrop & operator =(SvxGrfCrop const &) = delete; // due to SfxPoolItem
+ SvxGrfCrop & operator =(SvxGrfCrop &&) = delete; // due to SfxPoolItem
+
+ // "pure virtual methods" from SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& rIntl ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+
+ void SetLeft( sal_Int32 nVal ) { nLeft = nVal; }
+ void SetRight( sal_Int32 nVal ) { nRight = nVal; }
+ void SetTop( sal_Int32 nVal ) { nTop = nVal; }
+ void SetBottom( sal_Int32 nVal ) { nBottom = nVal; }
+
+ sal_Int32 GetLeft() const { return nLeft; }
+ sal_Int32 GetRight() const { return nRight; }
+ sal_Int32 GetTop() const { return nTop; }
+ sal_Int32 GetBottom() const { return nBottom; }
+};
+
+#endif // INCLUDED_SVX_GRFCROP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/grfflt.hxx b/include/svx/grfflt.hxx
new file mode 100644
index 000000000..7c24bcd38
--- /dev/null
+++ b/include/svx/grfflt.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_GRFFLT_HXX
+#define INCLUDED_SVX_GRFFLT_HXX
+
+#include <svx/svxdllapi.h>
+
+enum class SvxGraphicFilterResult {
+ NONE, UnsupportedGraphicType, UnsupportedSlot
+};
+
+class GraphicObject;
+class SfxRequest;
+class SfxItemSet;
+
+class SVX_DLLPUBLIC SvxGraphicFilter
+{
+public:
+
+ static SvxGraphicFilterResult ExecuteGrfFilterSlot( SfxRequest const & rReq, GraphicObject& rFilterObject );
+ static void DisableGraphicFilterSlots( SfxItemSet& rSet );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx
new file mode 100644
index 000000000..e029b8e23
--- /dev/null
+++ b/include/svx/gridctrl.hxx
@@ -0,0 +1,600 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_GRIDCTRL_HXX
+#define INCLUDED_SVX_GRIDCTRL_HXX
+
+#include <com/sun/star/util/Date.hpp>
+
+#include <tools/ref.hxx>
+#include <svtools/editbrowsebox.hxx>
+#include <svtools/recorditemwindow.hxx>
+#include <osl/mutex.hxx>
+#include <svx/svxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <memory>
+#include <vector>
+
+namespace comphelper { class OPropertyChangeMultiplexer; }
+namespace com::sun::star::beans { struct PropertyChangeEvent; }
+namespace com::sun::star::container { class XIndexAccess; }
+namespace com::sun::star::sdbc { class XRowSet; }
+namespace com::sun::star::sdb { class XRowsChangeListener; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::util { class XNumberFormatter; }
+namespace weld { class Menu; }
+
+class CursorWrapper;
+
+bool CompareBookmark(const css::uno::Any& aLeft, const css::uno::Any& aRight);
+
+namespace svxform
+{
+ class DataColumn;
+}
+
+enum class GridRowStatus
+{
+ Clean,
+ Modified,
+ Deleted,
+ Invalid
+};
+
+
+// DbGridRow, description of rows
+
+
+class SAL_DLLPUBLIC_RTTI DbGridRow final : public SvRefBase
+{
+ css::uno::Any m_aBookmark; // Bookmark of the row, can be set
+ ::std::vector< std::unique_ptr<::svxform::DataColumn> >
+ m_aVariants;
+ GridRowStatus m_eStatus;
+ bool m_bIsNew;
+ // row is no longer valid
+ // is removed on the next positioning
+public:
+ DbGridRow();
+ DbGridRow(CursorWrapper* pCur, bool bPaintCursor);
+ void SetState(CursorWrapper* pCur, bool bPaintCursor);
+
+ virtual ~DbGridRow() override;
+
+ bool HasField(sal_uInt32 nPos) const { return nPos < m_aVariants.size(); }
+ const ::svxform::DataColumn& GetField(sal_uInt32 nPos) const { return *m_aVariants[ nPos ]; }
+
+ void SetStatus(GridRowStatus _eStat) { m_eStatus = _eStat; }
+ GridRowStatus GetStatus() const { return m_eStatus; }
+ void SetNew(bool _bNew) { m_bIsNew = _bNew; }
+ bool IsNew() const { return m_bIsNew; }
+
+ const css::uno::Any& GetBookmark() const { return m_aBookmark; }
+
+ bool IsValid() const { return m_eStatus == GridRowStatus::Clean || m_eStatus == GridRowStatus::Modified; }
+ bool IsModified() const { return m_eStatus == GridRowStatus::Modified; }
+};
+
+typedef tools::SvRef<DbGridRow> DbGridRowRef;
+
+
+// DbGridControl
+
+class DbGridColumn;
+
+class FmGridListener
+{
+public:
+ virtual void selectionChanged() = 0;
+ virtual void columnChanged() = 0;
+
+protected:
+ ~FmGridListener() {}
+};
+
+#define GRID_COLUMN_NOT_FOUND SAL_MAX_UINT16
+
+
+// InitWindowFacet, describing which aspect of a column's Window to (re-)initialize
+
+enum class InitWindowFacet
+{
+ Font = 0x01,
+ Foreground = 0x02,
+ Background = 0x04,
+ WritingMode = 0x08,
+ All = 0x0F
+};
+namespace o3tl
+{
+ template<> struct typed_flags<InitWindowFacet> : is_typed_flags<InitWindowFacet, 0x0f> {};
+}
+
+
+// these options are or'ed and indicate, which of the single
+// features can be released, default is readonly which means 0
+enum class DbGridControlOptions
+{
+ Readonly = 0x00,
+ Insert = 0x01,
+ Update = 0x02,
+ Delete = 0x04
+};
+namespace o3tl
+{
+ template<> struct typed_flags<DbGridControlOptions> : is_typed_flags<DbGridControlOptions, 0x07> {};
+}
+
+// StatusIds for Controls of the Bar
+// important for invalidation
+enum class DbGridControlNavigationBarState
+{
+ NONE,
+ Text,
+ Absolute,
+ Of,
+ Count,
+ First,
+ Next,
+ Prev,
+ Last,
+ New,
+ Undo // related to SID_FM_RECORD_UNDO
+};
+
+class FmXGridSourcePropListener;
+class DisposeListenerGridBridge;
+
+// NavigationBar
+class NavigationBar final : public InterimItemWindow
+{
+ class AbsolutePos final : public RecordItemWindowBase
+ {
+ public:
+ AbsolutePos(std::unique_ptr<weld::Entry> xEntry, NavigationBar* pBar);
+
+ virtual bool DoKeyInput(const KeyEvent& rEvt) override;
+ virtual void PositionFired(sal_Int64 nRecord) override;
+
+ weld::Entry* GetWidget() { return m_xWidget.get(); }
+ private:
+ VclPtr<NavigationBar> m_xParent;
+ };
+
+ friend class NavigationBar::AbsolutePos;
+
+ // additional controls
+ std::unique_ptr<weld::Label> m_xRecordText;
+ std::unique_ptr<AbsolutePos> m_xAbsolute; // absolute positioning
+ std::unique_ptr<weld::Label> m_xRecordOf;
+ std::unique_ptr<weld::Label> m_xRecordCount;
+
+ std::unique_ptr<weld::Button> m_xFirstBtn; // Button for 'go to the first record'
+ std::unique_ptr<weld::Button> m_xPrevBtn; // Button for 'go to the previous record'
+ std::unique_ptr<weld::Button> m_xNextBtn; // Button for 'go to the next record'
+ std::unique_ptr<weld::Button> m_xLastBtn; // Button for 'go to the last record'
+ std::unique_ptr<weld::Button> m_xNewBtn; // Button for 'go to a new record'
+
+ std::shared_ptr<weld::ButtonPressRepeater> m_xPrevRepeater;
+ std::shared_ptr<weld::ButtonPressRepeater> m_xNextRepeater;
+
+ sal_Int32 m_nCurrentPos;
+
+ bool m_bPositioning; // protect PositionDataSource against recursion
+
+public:
+ NavigationBar(vcl::Window* pParent);
+ virtual ~NavigationBar() override;
+ virtual void dispose() override;
+
+ // Status methods for Controls
+ void InvalidateAll(sal_Int32 nCurrentPos, bool bAll = false);
+ void InvalidateState(DbGridControlNavigationBarState nWhich) {SetState(nWhich);}
+ void SetState(DbGridControlNavigationBarState nWhich);
+ bool GetState(DbGridControlNavigationBarState nWhich) const;
+ sal_uInt16 ArrangeControls();
+
+private:
+
+ DECL_LINK(OnClick, weld::Button&, void);
+
+ void PositionDataSource(sal_Int32 nRecord);
+};
+
+class SVXCORE_DLLPUBLIC DbGridControl : public svt::EditBrowseBox
+{
+ friend class FmXGridSourcePropListener;
+ friend class GridFieldValueListener;
+ friend class DisposeListenerGridBridge;
+
+public:
+
+ friend class NavigationBar;
+
+private:
+ Link<DbGridControlNavigationBarState,int> m_aMasterStateProvider;
+ Link<DbGridControlNavigationBarState,bool> m_aMasterSlotExecutor;
+
+ css::uno::Reference< css::util::XNumberFormatter > m_xFormatter;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ std::vector< std::unique_ptr<DbGridColumn> > m_aColumns; // Column description
+ VclPtr<NavigationBar> m_aBar;
+ DbGridRowRef m_xDataRow; // Row which can be modified
+ // comes from the data cursor
+ DbGridRowRef m_xSeekRow, // Row to which the iterator can set
+ // comes from the data cursor
+
+ m_xEmptyRow; // record set to insert
+
+ ImplSVEvent * m_nAsynAdjustEvent;
+
+ // if we modify the row for the new record, we automatically insert a "new new row".
+ // But if somebody else inserts a new record into the data source, we have to do the same.
+ // For that reason we have to listen to some properties of our data source.
+ rtl::Reference<::comphelper::OPropertyChangeMultiplexer> m_pDataSourcePropMultiplexer;
+ FmXGridSourcePropListener* m_pDataSourcePropListener;
+ css::uno::Reference< css::sdb::XRowsChangeListener>
+ m_xRowSetListener; // get notification when rows were changed
+
+ void* m_pFieldListeners;
+ // property listeners for field values
+
+ std::unique_ptr<DisposeListenerGridBridge> m_pCursorDisposeListener;
+ // need to know about the disposing of the seek cursor
+ // construct analogous to the data source proplistener/multiplexer above :
+ // DisposeListenerGridBridge is a bridge from FmXDisposeListener which I don't want to be derived from
+
+ FmGridListener* m_pGridListener;
+
+protected:
+ std::unique_ptr<CursorWrapper> m_pDataCursor; // Cursor for Updates
+ std::unique_ptr<CursorWrapper> m_pSeekCursor; // Cursor for Seeking
+
+private:
+ // iteration variables
+ DbGridRowRef m_xCurrentRow;
+ DbGridRowRef m_xPaintRow; // Row to be displayed
+ sal_Int32 m_nSeekPos; // Position of the SeekCursor
+ sal_Int32 m_nTotalCount; // is set when the data cursor finished counting the
+ // records. Initial value is -1
+ osl::Mutex m_aDestructionSafety;
+ osl::Mutex m_aAdjustSafety;
+
+ css::util::Date
+ m_aNullDate; // NullDate of the Numberformatter;
+
+ BrowserMode m_nMode;
+ sal_Int32 m_nCurrentPos; // Current position;
+ ImplSVEvent * m_nDeleteEvent; // EventId for asynchronous deletion of rows
+ DbGridControlOptions m_nOptions; // What is the able to do (Insert, Update, Delete)
+ // default readonly
+ DbGridControlOptions m_nOptionMask; // the mask of options to be enabled in setDataSource
+ // (with respect to the data source capabilities)
+ // defaults to (insert | update | delete)
+ sal_uInt16 m_nLastColId;
+ sal_Int32 m_nLastRowId;
+
+ bool m_bDesignMode : 1; // default = sal_False
+ bool m_bRecordCountFinal : 1;
+ bool m_bNavigationBar : 1;
+
+ bool m_bSynchDisplay : 1;
+ bool m_bHandle : 1;
+ bool m_bFilterMode : 1;
+ bool m_bWantDestruction : 1;
+ bool m_bPendingAdjustRows : 1; // if an async adjust is pending, is it for AdjustRows or AdjustDataSource ?
+ bool m_bHideScrollbars : 1;
+
+protected:
+ bool m_bUpdating : 1; // are any updates being executed right now?
+
+protected:
+ virtual bool SeekRow(sal_Int32 nRow) override;
+ virtual void VisibleRowsChanged( sal_Int32 nNewTopRow, sal_uInt16 nNumRows) override;
+ virtual void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColId) const override;
+ virtual RowStatus GetRowStatus(sal_Int32 nRow) const override;
+ virtual bool CursorMoving(sal_Int32 nNewRow, sal_uInt16 nNewCol) override;
+ virtual void CursorMoved() override;
+ virtual void ArrangeControls(sal_uInt16& nX, sal_uInt16 nY) override;
+ virtual sal_uInt32 GetTotalCellWidth(sal_Int32 nRow, sal_uInt16 nColId) override;
+ virtual void Command(const CommandEvent& rEvt) override;
+ virtual bool PreNotify(NotifyEvent& rEvt) override;
+ virtual void KeyInput(const KeyEvent& rEvt) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual void Select() override;
+
+ virtual ::svt::CellController* GetController(sal_Int32 nRow, sal_uInt16 nCol) override;
+
+ virtual void CellModified() override;
+ virtual bool SaveModified() override;
+ virtual bool IsModified() const override;
+
+ virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = sal_uInt16(-1)) override;
+ void RemoveColumn(sal_uInt16 nId);
+ std::unique_ptr<DbGridColumn> CreateColumn(sal_uInt16 nId);
+ virtual void ColumnMoved(sal_uInt16 nId) override;
+ virtual bool SaveRow() override;
+ virtual bool IsTabAllowed(bool bForward) const override;
+
+ /// hide a column
+ virtual void HideColumn(sal_uInt16 nId);
+ /// show a column
+ virtual void ShowColumn(sal_uInt16 nId);
+
+ /** This is called before executing a context menu for a row. rMenu contains the initial entries
+ handled by this base class' method (which always has to be called).
+ Derived classes may alter the menu in any way and handle any additional entries in
+ PostExecuteColumnContextMenu.
+ All disabled entries will be removed before executing the menu, so be careful with separators
+ near entries you probably wish to disable ...
+ */
+ virtual void PreExecuteRowContextMenu(weld::Menu& rMenu);
+ /** After executing the context menu for a row this method is called.
+ */
+ virtual void PostExecuteRowContextMenu(const OString& rExecutionResult);
+
+ /// @throws css::uno::RuntimeException
+ void DataSourcePropertyChanged(const css::beans::PropertyChangeEvent& evt);
+
+ void FieldValueChanged(sal_uInt16 _nId);
+ void FieldListenerDisposing(sal_uInt16 _nId);
+
+ void disposing(sal_uInt16 _nId);
+
+ // own overridables
+ /// called when the current row changed
+ virtual void onRowChange();
+ /// called when the current column changed
+ virtual void onColumnChange();
+
+ // DragSourceHelper overridables
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
+
+ void executeRowContextMenu(const Point& _rPreferredPos);
+
+public:
+ DbGridControl(
+ css::uno::Reference< css::uno::XComponentContext > const & _rxContext,
+ vcl::Window* pParent,
+ WinBits nBits);
+
+ virtual ~DbGridControl() override;
+ virtual void dispose() override;
+
+ virtual void Init() override;
+ virtual void InitColumnsByFields(const css::uno::Reference< css::container::XIndexAccess >& xFields) = 0;
+ virtual void RemoveRows() override;
+
+ /** GetCellText returns the text at the given position
+ @param _nRow
+ the number of the row
+ @param _nColId
+ the ID of the column
+ @return
+ the text out of the cell
+ */
+ virtual OUString GetCellText(sal_Int32 _nRow, sal_uInt16 _nColId) const override;
+
+ void RemoveRows(bool bNewCursor);
+
+ const css::uno::Reference< css::util::XNumberFormatter >& getNumberFormatter() const {return m_xFormatter;}
+
+ // the data source
+ // the options can restrict but not extend the update abilities
+ void setDataSource(const css::uno::Reference< css::sdbc::XRowSet >& rCursor,
+ DbGridControlOptions nOpts = DbGridControlOptions::Insert | DbGridControlOptions::Update | DbGridControlOptions::Delete);
+ virtual void Dispatch(sal_uInt16 nId) override;
+
+ CursorWrapper* getDataSource() const {return m_pDataCursor.get();}
+ const std::vector< std::unique_ptr<DbGridColumn> >& GetColumns() const {return m_aColumns;}
+
+ void EnableHandle(bool bEnable);
+ bool HasHandle() const {return m_bHandle;}
+ void InsertHandleColumn();
+
+ // which position does the column with the id in the View have, the handle column doesn't count
+ sal_uInt16 GetViewColumnPos( sal_uInt16 nId ) const { sal_uInt16 nPos = GetColumnPos(nId); return (nPos==BROWSER_INVALIDID) ? GRID_COLUMN_NOT_FOUND : nPos-1; }
+
+ // which position does the column with the id in m_aColumns have, that means the css::sdbcx::Container
+ // returned from the GetColumns (may be different from the position returned by GetViewColumnPos
+ // if there are hidden columns)
+ sal_uInt16 GetModelColumnPos( sal_uInt16 nId ) const;
+
+ // the number of columns in the model
+ sal_uInt16 GetViewColCount() const { return ColCount() - 1; }
+ sal_uInt16 GetModelColCount() const { return static_cast<sal_uInt16>(m_aColumns.size()); }
+ // reverse to GetViewColumnPos: Id of position, the first non-handle column has position 0
+ sal_uInt16 GetColumnIdFromViewPos( sal_uInt16 nPos ) const { return GetColumnId(nPos + 1); }
+ sal_uInt16 GetColumnIdFromModelPos( sal_uInt16 nPos ) const;
+
+ virtual void SetDesignMode(bool bMode);
+ bool IsDesignMode() const {return m_bDesignMode;}
+ bool IsOpen() const {return m_pSeekCursor != nullptr;}
+
+ void SetFilterMode(bool bMode);
+ bool IsFilterMode() const {return m_bFilterMode;}
+ bool IsFilterRow(sal_Int32 nRow) const {return m_bFilterMode && nRow == 0;}
+
+ void EnableNavigationBar(bool bEnable);
+ bool HasNavigationBar() const {return m_bNavigationBar;}
+
+ DbGridControlOptions GetOptions() const {return m_nOptions;}
+ NavigationBar& GetNavigationBar() {return *m_aBar;}
+ DbGridControlOptions SetOptions(DbGridControlOptions nOpt);
+ // The new options are interpreted with respect to the current data source. If it is unable
+ // to update, to insert or to restore, the according options are ignored. If the grid isn't
+ // connected to a data source, all options except OPT_READONLY are ignored.
+
+ const css::util::Date& getNullDate() const {return m_aNullDate;}
+
+ // positioning
+ void MoveToPosition(sal_uInt32 nPos);
+ void MoveToFirst();
+ void MoveToNext();
+ void MoveToPrev();
+ void MoveToLast();
+ void AppendNew();
+
+ // adjustment of the cursors in case the data cursor has been
+ // moved from the outside.
+ // the flag indicates if an adjustment of the row count should be
+ // done as well
+ void AdjustDataSource(bool bFull = false);
+ void Undo();
+
+ virtual void BeginCursorAction();
+ virtual void EndCursorAction();
+
+ // is the current line being updated
+ bool IsUpdating() const {return m_bUpdating;}
+
+ void RowRemoved( sal_Int32 nRow, sal_Int32 nNumRows = 1, bool bDoPaint = true );
+ void RowInserted( sal_Int32 nRow, sal_Int32 nNumRows = 1, bool bDoPaint = true );
+ void RowModified( sal_Int32 nRow );
+
+ void resetCurrentRow();
+
+ bool getDisplaySynchron() const { return m_bSynchDisplay; }
+ void setDisplaySynchron(bool bSync);
+ // when set to sal_False, the display is no longer in sync with the current cursor position
+ // (means that in AdjustDataSource we are jumping to a row not belonging to CursorPosition)
+ // when using this, you should know what you are doing, because for example entering data
+ // in a row in the display that is not in sync with the position of the cursor can be very critical
+
+ const DbGridRowRef& GetCurrentRow() const {return m_xCurrentRow;}
+
+ void SetStateProvider(const Link<DbGridControlNavigationBarState,int>& rProvider) { m_aMasterStateProvider = rProvider; }
+ // if this link is set the given provider will be asked for the state of my items.
+ // the return values are interpreted as follows :
+ // <0 -> not specified (use default mechanism to determine the state)
+ // ==0 -> the item is disabled
+ // >0 -> the item is enabled
+ void SetSlotExecutor(const Link<DbGridControlNavigationBarState,bool>& rExecutor) { m_aMasterSlotExecutor = rExecutor; }
+ // analogous : if this link is set, all nav-bar slots will be routed through it when executed
+ // if the handler returns nonzero, no further handling of the slot occurs
+
+ void EnablePermanentCursor(bool bEnable);
+ bool IsPermanentCursorEnabled() const;
+
+ /** forces both scrollbars to be hidden
+
+ For the horizontal scrollbar, this is overruled by enabling the navigation bar: A navigation
+ bar <b>always</b> implies a horizontal scroll bar
+ @seealso EnableNavigationBar
+ */
+ void ForceHideScrollbars();
+
+ const css::uno::Reference< css::uno::XComponentContext >&
+ getContext() const { return m_xContext; }
+
+ /// returns <TRUE/> if the text of the given cell can be copied into the clipboard
+ bool canCopyCellText(sal_Int32 _nRow, sal_uInt16 _nColId);
+ /// copies the text of the given cell into the clipboard
+ void copyCellText(sal_Int32 _nRow, sal_uInt16 _nColId);
+
+ // select in listener handling
+ void setGridListener( FmGridListener* _pListener ) { m_pGridListener = _pListener; }
+
+ // helper class to grant access to selected methods from within the DbCellControl class
+ struct GrantControlAccess final
+ {
+ friend class DbCellControl;
+ friend class RowSetEventListener;
+ };
+
+ /// called when a controller needs to be re-initialized
+ void refreshController(sal_uInt16 _nColId, GrantControlAccess _aAccess);
+
+ CursorWrapper* GetSeekCursor(GrantControlAccess /*_aAccess*/) const { return m_pSeekCursor.get(); }
+ const DbGridRowRef& GetSeekRow(GrantControlAccess /*_aAccess*/) const { return m_xSeekRow; }
+ void SetSeekPos(sal_Int32 nPos,GrantControlAccess /*_aAccess*/) {m_nSeekPos = nPos;}
+
+ /**
+ @return
+ The count of additional controls of the control area.
+ */
+ virtual sal_Int32 GetAccessibleControlCount() const override;
+
+ /** Creates the accessible object of an additional control.
+ @param _nIndex
+ The 0-based index of the control.
+ @return
+ The XAccessible interface of the specified control.
+ */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible >
+ CreateAccessibleControl( sal_Int32 _nIndex ) override;
+
+ // IAccessibleTableProvider
+ /** Creates the accessible object of a data table cell.
+ @param nRow The row index of the cell.
+ @param nColumnId The column ID of the cell.
+ @return The XAccessible interface of the specified cell. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible >
+ CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ) override;
+
+protected:
+ void RecalcRows(sal_Int32 nNewTopRow, sal_uInt16 nLinesOnScreen, bool bUpdateCursor);
+ bool SeekCursor(sal_Int32 nRow, bool bAbsolute = false);
+ void RemoveColumns(); // cleaning of own structures
+ void AdjustRows();
+ sal_Int32 AlignSeekCursor();
+ bool SetCurrent(sal_Int32 nNewRow);
+
+ OUString GetCurrentRowCellText(DbGridColumn const * pCol,const DbGridRowRef& _rRow) const;
+ virtual void DeleteSelectedRows();
+ static bool IsValid(const DbGridRowRef& _xRow) { return _xRow.is() && _xRow->IsValid(); }
+
+ // row which is currently being appended
+ bool IsCurrentAppending() const;
+
+ // empty row for insertion
+ bool IsInsertionRow(sal_Int32 nRow) const;
+
+ void SetSeekPos(sal_Int32 nPos) {m_nSeekPos = nPos;}
+ sal_Int32 GetCurrentPos() const {return m_nCurrentPos;}
+ sal_Int32 GetSeekPos() const {return m_nSeekPos;}
+ sal_Int32 GetTotalCount() const {return m_nTotalCount;}
+
+ const DbGridRowRef& GetEmptyRow() const { return m_xEmptyRow; }
+ const DbGridRowRef& GetSeekRow() const { return m_xSeekRow; }
+ const DbGridRowRef& GetPaintRow() const { return m_xPaintRow; }
+
+ void ConnectToFields();
+ void DisconnectFromFields();
+
+ void implAdjustInSolarThread(bool _bRows);
+ // calls AdjustRows or AdjustDataSource, synchron if the caller is running in the solar thread, else asynchron
+
+protected:
+ void ImplInitWindow( const InitWindowFacet _eInitWhat );
+ DECL_DLLPRIVATE_LINK(OnDelete, void*, void);
+
+ DECL_DLLPRIVATE_LINK(OnAsyncAdjust, void*, void);
+ // if the param is != NULL, AdjustRows will be called, else AdjustDataSource
+
+private:
+ using BrowseBox::InsertHandleColumn;
+};
+
+#endif // INCLUDED_SVX_GRIDCTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx
new file mode 100644
index 000000000..8eadfa366
--- /dev/null
+++ b/include/svx/hdft.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_HDFT_HXX
+#define INCLUDED_SVX_HDFT_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+#include <vcl/weld.hxx>
+
+#include <svx/pagectrl.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+namespace weld { class CustomWeld; }
+
+namespace svx
+{
+ SVX_DLLPUBLIC bool ShowBorderBackgroundDlg(weld::Window* pParent, SfxItemSet* pBBSet);
+}
+
+class SVX_DLLPUBLIC SvxHFPage : public SfxTabPage
+{
+public:
+
+ virtual bool FillItemSet( SfxItemSet* rOutSet ) override;
+ virtual void Reset( const SfxItemSet* rSet ) override;
+
+ virtual ~SvxHFPage() override;
+
+ void DisableDeleteQueryBox() { mbDisableQueryBox = true; }
+
+ virtual void PageCreated(const SfxAllItemSet&) override;
+
+ void EnableDynamicSpacing();
+
+protected:
+ static const WhichRangesContainer pRanges;
+
+ virtual void ActivatePage( const SfxItemSet& rSet ) override;
+ virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
+
+ SvxHFPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet, sal_uInt16 nSetId);
+
+ sal_uInt16 nId;
+ std::unique_ptr<SfxItemSet> pBBSet;
+ bool mbDisableQueryBox : 1;
+ bool mbEnableDrawingLayerFillStyles : 1;
+
+ SvxPageWindow m_aBspWin;
+ std::unique_ptr<weld::Label> m_xPageLbl;
+ std::unique_ptr<weld::CheckButton> m_xTurnOnBox;
+ std::unique_ptr<weld::CheckButton> m_xCntSharedBox;
+ std::unique_ptr<weld::CheckButton> m_xCntSharedFirstBox;
+ std::unique_ptr<weld::Label> m_xLMLbl;
+ std::unique_ptr<weld::MetricSpinButton>m_xLMEdit;
+ std::unique_ptr<weld::Label> m_xRMLbl;
+ std::unique_ptr<weld::MetricSpinButton> m_xRMEdit;
+ std::unique_ptr<weld::Label> m_xDistFT;
+ std::unique_ptr<weld::MetricSpinButton> m_xDistEdit;
+ std::unique_ptr<weld::CheckButton> m_xDynSpacingCB;
+ std::unique_ptr<weld::Label> m_xHeightFT;
+ std::unique_ptr<weld::MetricSpinButton> m_xHeightEdit;
+ std::unique_ptr<weld::CheckButton> m_xHeightDynBtn;
+ std::unique_ptr<weld::Button> m_xBackgroundBtn;
+ std::unique_ptr<weld::CustomWeld> m_xBspWin;
+
+ void InitHandler();
+ void TurnOn(const weld::Toggleable* pButton);
+ DECL_LINK(TurnOnHdl, weld::Toggleable&, void);
+ DECL_DLLPRIVATE_LINK(BackgroundHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(ValueChangeHdl, weld::MetricSpinButton&, void);
+ void RangeHdl();
+ void UpdateExample();
+
+private:
+ SVX_DLLPRIVATE void ResetBackground_Impl( const SfxItemSet& rSet );
+};
+
+class SVX_DLLPUBLIC SvxHeaderPage final : public SvxHFPage
+{
+public:
+ static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
+ // returns the Which values to the range
+ static WhichRangesContainer GetRanges() { return pRanges; }
+ SVX_DLLPRIVATE SvxHeaderPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
+};
+
+class SVX_DLLPUBLIC SvxFooterPage final : public SvxHFPage
+{
+public:
+ static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
+ static WhichRangesContainer GetRanges() { return pRanges; }
+ SVX_DLLPRIVATE SvxFooterPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
+};
+
+class SVX_DLLPUBLIC DeleteHeaderDialog final : public weld::MessageDialogController
+{
+public:
+ DeleteHeaderDialog(weld::Widget* pParent)
+ : MessageDialogController(pParent, "svx/ui/deleteheaderdialog.ui",
+ "DeleteHeaderDialog")
+ {
+ }
+};
+
+class SVX_DLLPUBLIC DeleteFooterDialog final : public weld::MessageDialogController
+{
+public:
+ DeleteFooterDialog(weld::Widget* pParent)
+ : MessageDialogController(pParent, "svx/ui/deletefooterdialog.ui",
+ "DeleteFooterDialog")
+ {
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/helperhittest3d.hxx b/include/svx/helperhittest3d.hxx
new file mode 100644
index 000000000..f262564b9
--- /dev/null
+++ b/include/svx/helperhittest3d.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_HELPERHITTEST3D_HXX
+#define INCLUDED_SVX_HELPERHITTEST3D_HXX
+
+#include <svx/svxdllapi.h>
+#include <vector>
+
+
+// predefines
+
+namespace basegfx {
+ class B2DPoint;
+}
+
+namespace drawinglayer::geometry {
+ class ViewInformation3D;
+}
+
+class E3dCompoundObject;
+class E3dScene;
+
+
+/** support for getting a ViewInformation3D for a given CompoudObject3D
+ with correct ObjectTransformation filled out
+
+ @param o_rViewInformation3D
+ The ViewInformation3D created which will be overwritten
+
+ @param rCandidate
+ The E3dCompoundObject for which the ViewInformation3D shall be
+ prepared
+
+ @return
+ A pointer to the found and used root scene. This is also a hint
+ if the operation succeeded or not, since when object has no root
+ scene (is not inserted to a model), an empty ViewInformation3D
+ will be used
+*/
+E3dScene* fillViewInformation3DForCompoundObject(
+ drawinglayer::geometry::ViewInformation3D& o_rViewInformation3D,
+ const E3dCompoundObject& rCandidate);
+
+/** support for getting all from a 2d position hit objects in a 3d scene
+ in a depth sorted array
+
+ @param rPoint
+ 2D Point in view coordinates
+
+ @param rScene
+ The 3D Scene for HitTest
+
+ @param o_rResult
+ Output parameter which contains all hit 3D objects inside rScene. This
+ vector will be changed in any case. If it's empty, no hit exists. If it's
+ not empty, the first object is the object closest to the viewer
+
+*/
+SVXCORE_DLLPUBLIC void getAllHit3DObjectsSortedFrontToBack(
+ const basegfx::B2DPoint& rPoint,
+ const E3dScene& rScene,
+ ::std::vector< const E3dCompoundObject* >& o_rResult);
+
+/** support for checking if the single given 3d object is hit at position
+
+ @param rPoint
+ 2D Point in view coordinates
+
+ @param rCandidate
+ The 3D Object which needs checking
+
+ @return
+ true if hit, false if not
+*/
+bool checkHitSingle3DObject(
+ const basegfx::B2DPoint& rPoint,
+ const E3dCompoundObject& rCandidate);
+
+
+#endif // INCLUDED_SVX_HELPERHITTEST3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/hexcolorcontrol.hxx b/include/svx/hexcolorcontrol.hxx
new file mode 100644
index 000000000..e1470c982
--- /dev/null
+++ b/include/svx/hexcolorcontrol.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_HEXCOLOR_HXX
+#define INCLUDED_SVX_HEXCOLOR_HXX
+
+#include <svx/svxdllapi.h>
+#include <tools/color.hxx>
+#include <tools/link.hxx>
+
+namespace weld { class Entry; }
+
+struct ImplSVEvent;
+
+namespace weld {
+
+class SVXCORE_DLLPUBLIC HexColorControl
+{
+private:
+ std::unique_ptr<weld::Entry> m_xEntry;
+ Link<weld::Entry&, void> m_aModifyHdl;
+ ImplSVEvent* m_nAsyncModifyEvent;
+
+ DECL_DLLPRIVATE_STATIC_LINK(HexColorControl, ImplProcessInputHdl, OUString&, bool);
+ DECL_DLLPRIVATE_LINK(ImplProcessModifyHdl, weld::Entry&, void);
+ DECL_DLLPRIVATE_LINK(OnAsyncModifyHdl, void*, void);
+public:
+ HexColorControl(std::unique_ptr<weld::Entry> pEdit);
+ ~HexColorControl();
+
+ void connect_changed(const Link<weld::Entry&, void>& rLink) { m_aModifyHdl = rLink; }
+
+ void SetColor( ::Color nColor );
+ ::Color GetColor() const;
+};
+
+}
+
+#endif // INCLUDED_SVX_HEXCOLOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/hlnkitem.hxx b/include/svx/hlnkitem.hxx
new file mode 100644
index 000000000..a129cc720
--- /dev/null
+++ b/include/svx/hlnkitem.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_HLNKITEM_HXX
+#define INCLUDED_SVX_HLNKITEM_HXX
+
+#include <rtl/ustring.hxx>
+#include <svl/poolitem.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <svl/macitem.hxx>
+#include <svx/svxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <memory>
+
+enum class HyperDialogEvent {
+ NONE = 0x0000,
+ MouseOverObject = 0x0001,
+ MouseClickObject = 0x0002,
+ MouseOutObject = 0x0004,
+};
+namespace o3tl {
+ template<> struct typed_flags<HyperDialogEvent> : is_typed_flags<HyperDialogEvent, 0x07> {};
+}
+
+enum SvxLinkInsertMode
+{
+ HLINK_DEFAULT,
+ HLINK_FIELD,
+ HLINK_BUTTON,
+ HLINK_HTMLMODE = 0x0080
+};
+
+class SVX_DLLPUBLIC SvxHyperlinkItem final : public SfxPoolItem
+{
+ OUString sName;
+ OUString sURL;
+ OUString sTarget;
+ SvxLinkInsertMode eType;
+
+ OUString sIntName;
+ std::unique_ptr<SvxMacroTableDtor> pMacroTable;
+
+ HyperDialogEvent nMacroEvents;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxHyperlinkItem( TypedWhichId<SvxHyperlinkItem> _nWhich = SID_HYPERLINK_GETLINK ):
+ SfxPoolItem(_nWhich) { eType = HLINK_DEFAULT; nMacroEvents=HyperDialogEvent::NONE; };
+ SvxHyperlinkItem( const SvxHyperlinkItem& rHyperlinkItem );
+ SvxHyperlinkItem( TypedWhichId<SvxHyperlinkItem> nWhich, const OUString& rName, const OUString& rURL,
+ const OUString& rTarget, const OUString& rIntName,
+ SvxLinkInsertMode eTyp,
+ HyperDialogEvent nEvents,
+ SvxMacroTableDtor const *pMacroTbl );
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxHyperlinkItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ const OUString& GetName() const { return sName; }
+ void SetName(const OUString& rName) { sName = rName; }
+
+ const OUString& GetURL() const { return sURL; }
+ void SetURL(const OUString& rURL) { sURL = rURL; }
+
+ const OUString& GetIntName () const { return sIntName; }
+ void SetIntName(const OUString& rIntName) { sIntName = rIntName; }
+
+ const OUString& GetTargetFrame() const { return sTarget; }
+ void SetTargetFrame(const OUString& rTarget) { sTarget = rTarget; }
+
+ SvxLinkInsertMode GetInsertMode() const { return eType; }
+ void SetInsertMode( SvxLinkInsertMode eNew ) { eType = eNew; }
+
+ void SetMacro( HyperDialogEvent nEvent, const SvxMacro& rMacro );
+
+ void SetMacroTable( const SvxMacroTableDtor& rTbl );
+ const SvxMacroTableDtor* GetMacroTable() const { return pMacroTable.get(); }
+
+ void SetMacroEvents (const HyperDialogEvent nEvents) { nMacroEvents = nEvents; }
+ HyperDialogEvent GetMacroEvents() const { return nMacroEvents; }
+
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/hyperdlg.hxx b/include/svx/hyperdlg.hxx
new file mode 100644
index 000000000..d86a65d22
--- /dev/null
+++ b/include/svx/hyperdlg.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_HYPERDLG_HXX
+#define INCLUDED_SVX_HYPERDLG_HXX
+
+#include <sfx2/childwin.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* Hyperlink-Dialog
+|*
+\************************************************************************/
+
+class AbstractSvxHpLinkDlg;
+
+class SVX_DLLPUBLIC SvxHlinkDlgWrapper final : public SfxChildWindow
+{
+private:
+ VclPtr<AbstractSvxHpLinkDlg> mpDlg;
+
+public:
+ SvxHlinkDlgWrapper( vcl::Window*pParent, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo );
+ virtual ~SvxHlinkDlgWrapper() override;
+
+ SFX_DECL_CHILDWINDOW_WITHID(SvxHlinkDlgWrapper);
+ virtual bool QueryClose() override;
+};
+
+#endif // INCLUDED_SVX_HYPERDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ifaceids.hxx b/include/svx/ifaceids.hxx
new file mode 100644
index 000000000..f9942e3f1
--- /dev/null
+++ b/include/svx/ifaceids.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_IFACEIDS_HXX
+#define INCLUDED_SVX_IFACEIDS_HXX
+
+
+#include <sfx2/shell.hxx>
+
+#define SVX_INTERFACE_BASIDE_DOCSH (SFX_INTERFACE_IDE_START)
+#define SVX_INTERFACE_BASIDE_VIEWSH (SFX_INTERFACE_IDE_START + SfxInterfaceId(1))
+#define SVX_INTERFACE_EXTRUSION_BAR (SFX_INTERFACE_IDE_START + SfxInterfaceId(2))
+#define SVX_INTERFACE_FONTWORK_BAR (SFX_INTERFACE_IDE_START + SfxInterfaceId(3))
+
+
+#define SVX_INTERFACE_FORM_SH (SFX_INTERFACE_IDE_END + SfxInterfaceId(1))
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/imapdlg.hxx b/include/svx/imapdlg.hxx
new file mode 100644
index 000000000..e3586e290
--- /dev/null
+++ b/include/svx/imapdlg.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_IMAPDLG_HXX
+#define INCLUDED_SVX_IMAPDLG_HXX
+
+#include <sfx2/childwin.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+#include <vector>
+
+namespace vcl { class Window; }
+namespace weld { class Button; }
+namespace weld { class ComboBox; }
+namespace weld { class CustomWeld; }
+namespace weld { class Entry; }
+namespace weld { class Label; }
+namespace weld { class Toolbar; }
+namespace weld { class Widget; }
+namespace weld { class Window; }
+
+class ImageMap;
+class SvtURLBox;
+
+/*************************************************************************
+|*
+|* Derivation from SfxChildWindow as "container" for float
+|*
+\************************************************************************/
+
+class Graphic;
+typedef ::std::vector< OUString > TargetList;
+
+class SVX_DLLPUBLIC SvxIMapDlgChildWindow final : public SfxChildWindow
+{
+ public:
+
+ SvxIMapDlgChildWindow( vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo const * );
+
+ SFX_DECL_CHILDWINDOW_WITHID( SvxIMapDlgChildWindow );
+
+ static void UpdateIMapDlg( const Graphic& rGraphic, const ImageMap* pImageMap,
+ const TargetList* pTargetList, void* pEditingObj );
+};
+
+
+class SvxIMapDlg;
+
+class SvxIMapDlgItem final : public SfxControllerItem
+{
+ SvxIMapDlg& rIMap;
+
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState ) override;
+
+
+public:
+
+ SvxIMapDlgItem( SvxIMapDlg& rIMapDlg, SfxBindings& rBindings );
+};
+
+class IMapOwnData;
+class IMapWindow;
+class GraphCtrl;
+
+class SVX_DLLPUBLIC SvxIMapDlg final : public SfxModelessDialogController
+{
+ friend class IMapOwnData;
+ friend class IMapWindow;
+
+ std::unique_ptr<IMapOwnData> pOwnData;
+ void* pCheckObj;
+ SvxIMapDlgItem aIMapItem;
+
+ std::unique_ptr<IMapWindow> m_xIMapWnd;
+ std::unique_ptr<weld::Toolbar> m_xTbxIMapDlg1;
+ std::unique_ptr<weld::Label> m_xFtURL;
+ std::unique_ptr<SvtURLBox> m_xURLBox;
+ std::unique_ptr<weld::Label> m_xFtText;
+ std::unique_ptr<weld::Entry> m_xEdtText;
+ std::unique_ptr<weld::Label> m_xFtTarget;
+ std::unique_ptr<weld::ComboBox> m_xCbbTarget;
+ std::unique_ptr<weld::Button> m_xCancelBtn;
+ std::unique_ptr<weld::Label> m_xStbStatus1;
+ std::unique_ptr<weld::Label> m_xStbStatus2;
+ std::unique_ptr<weld::Label> m_xStbStatus3;
+ std::unique_ptr<weld::CustomWeld> m_xIMapWndWeld;
+
+ DECL_DLLPRIVATE_LINK( TbxClickHdl, const OString&, void );
+ DECL_DLLPRIVATE_LINK( InfoHdl, IMapWindow&, void );
+ DECL_DLLPRIVATE_LINK( MousePosHdl, GraphCtrl*, void );
+ DECL_DLLPRIVATE_LINK( GraphSizeHdl, GraphCtrl*, void );
+ DECL_DLLPRIVATE_LINK( URLModifyHdl, weld::ComboBox&, void );
+ DECL_DLLPRIVATE_LINK( EntryModifyHdl, weld::Entry&, void );
+ DECL_DLLPRIVATE_LINK( URLLoseFocusHdl, weld::Widget&, void );
+ DECL_DLLPRIVATE_LINK( UpdateHdl, Timer *, void );
+ DECL_DLLPRIVATE_LINK( StateHdl, GraphCtrl*, void );
+ DECL_DLLPRIVATE_LINK( CancelHdl, weld::Button&, void );
+
+ void URLModify();
+ void DoOpen();
+ bool DoSave();
+ void SetActiveTool(std::string_view rId);
+
+public:
+
+ SvxIMapDlg(SfxBindings *pBindings, SfxChildWindow *pCW,
+ weld::Window* pParent);
+ virtual ~SvxIMapDlg() override;
+
+ void SetExecState( bool bEnable );
+
+ const void* GetEditingObject() const { return pCheckObj; }
+
+ const ImageMap& GetImageMap() const;
+
+ void SetTargetList( const TargetList& rTargetList );
+
+ void UpdateLink( const Graphic& rGraphic, const ImageMap* pImageMap,
+ const TargetList* pTargetList, void* pEditingObj );
+};
+
+SVX_DLLPUBLIC SvxIMapDlg* GetIMapDlg();
+
+#endif // INCLUDED_SVX_IMAPDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/insctrl.hxx b/include/svx/insctrl.hxx
new file mode 100644
index 000000000..b2a5102ca
--- /dev/null
+++ b/include/svx/insctrl.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_INSCTRL_HXX
+#define INCLUDED_SVX_INSCTRL_HXX
+
+#include <sfx2/stbitem.hxx>
+#include <svx/svxdllapi.h>
+
+class SVX_DLLPUBLIC SvxInsertStatusBarControl final : public SfxStatusBarControl
+{
+public:
+ virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState) override;
+ virtual void Paint(const UserDrawEvent& rEvt) override;
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxInsertStatusBarControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb);
+ virtual ~SvxInsertStatusBarControl() override;
+
+private:
+ bool bInsert;
+
+ SVX_DLLPRIVATE void DrawItemText_Impl();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ipolypolygoneditorcontroller.hxx b/include/svx/ipolypolygoneditorcontroller.hxx
new file mode 100644
index 000000000..22f787121
--- /dev/null
+++ b/include/svx/ipolypolygoneditorcontroller.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_IPOLYPOLYGONEDITORCONTROLLER_HXX
+#define INCLUDED_SVX_IPOLYPOLYGONEDITORCONTROLLER_HXX
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+// Defines
+
+enum class SdrPathSmoothKind
+{
+ DontCare, // only for status query
+ Angular, // angular
+ Asymmetric, // asymmetric, normal Smooth
+ Symmetric // symmetric
+};
+enum class SdrPathSegmentKind
+{
+ DontCare, // only for status query
+ Line, // straight path segment
+ Curve, // curve path segment (Bezier)
+ Toggle // only for Set: Toggle
+};
+enum class SdrObjClosedKind
+{
+ DontCare, // only for status query
+ Open, // non-closed object (line, polyline, ...)
+ Closed // closed object (polygon, ...)
+};
+
+class SAL_DLLPUBLIC_RTTI IPolyPolygonEditorController
+{
+public:
+ virtual void DeleteMarkedPoints() = 0;
+ virtual bool IsDeleteMarkedPointsPossible() const = 0;
+
+ virtual void RipUpAtMarkedPoints() = 0;
+ virtual bool IsRipUpAtMarkedPointsPossible() const = 0;
+
+ virtual bool IsSetMarkedSegmentsKindPossible() const = 0;
+ virtual SdrPathSegmentKind GetMarkedSegmentsKind() const = 0;
+ virtual void SetMarkedSegmentsKind(SdrPathSegmentKind eKind) = 0;
+
+ virtual bool IsSetMarkedPointsSmoothPossible() const = 0;
+ virtual SdrPathSmoothKind GetMarkedPointsSmooth() const = 0;
+ virtual void SetMarkedPointsSmooth(SdrPathSmoothKind eKind) = 0;
+
+ virtual bool IsOpenCloseMarkedObjectsPossible() const = 0;
+ virtual SdrObjClosedKind GetMarkedObjectsClosedState() const = 0;
+
+protected:
+ ~IPolyPolygonEditorController() {}
+};
+
+#endif // INCLUDED_SVX_IPOLYPOLYGONEDITORCONTROLLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/itemwin.hxx b/include/svx/itemwin.hxx
new file mode 100644
index 000000000..5d434d1ae
--- /dev/null
+++ b/include/svx/itemwin.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_ITEMWIN_HXX
+#define INCLUDED_SVX_ITEMWIN_HXX
+
+#include <svtools/toolbarmenu.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/xtable.hxx>
+#include <vcl/customweld.hxx>
+
+class SfxObjectShell;
+class ValueSet;
+class SvxLineStyleToolBoxControl;
+
+class SvxLineBox final : public WeldToolbarPopup
+{
+ rtl::Reference<SvxLineStyleToolBoxControl> mxControl;
+ std::unique_ptr<ValueSet> mxLineStyleSet;
+ std::unique_ptr<weld::CustomWeld> mxLineStyleSetWin;
+
+ void FillControl();
+ void Fill(const XDashListRef& pList);
+
+ DECL_LINK(SelectHdl, ValueSet*, void);
+
+ virtual void GrabFocus() override;
+
+public:
+ SvxLineBox(SvxLineStyleToolBoxControl* pControl, weld::Widget* pParent, int nInitialIndex);
+ virtual ~SvxLineBox() override;
+};
+
+namespace SvxFillTypeBox
+{
+SVX_DLLPUBLIC void Fill(weld::ComboBox& rListBox);
+}
+
+namespace SvxFillAttrBox
+{
+SVX_DLLPUBLIC void Fill(weld::ComboBox&, const XHatchListRef& pList);
+SVX_DLLPUBLIC void Fill(weld::ComboBox&, const XGradientListRef& pList);
+SVX_DLLPUBLIC void Fill(weld::ComboBox&, const XBitmapListRef& pList);
+SVX_DLLPUBLIC void Fill(weld::ComboBox&, const XPatternListRef& pList);
+}
+
+#endif // INCLUDED_SVX_ITEMWIN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/itextprovider.hxx b/include/svx/itextprovider.hxx
new file mode 100644
index 000000000..361b2293e
--- /dev/null
+++ b/include/svx/itextprovider.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVX_ITEXTPROVIDER_HXX
+#define INCLUDED_SVX_ITEXTPROVIDER_HXX
+
+#include <sal/types.h>
+
+#include <svx/svxdllapi.h>
+
+class SdrText;
+
+namespace svx
+{
+
+ /** This interface provides access to text object(s) in an SdrObject.
+
+ */
+ class SVXCORE_DLLPUBLIC ITextProvider
+ {
+ public:
+ /** Return the number of texts available for this object. */
+ virtual sal_Int32 getTextCount() const = 0;
+
+ /** Return the nth available text. */
+ virtual SdrText* getText(sal_Int32 nIndex) const = 0;
+
+ protected:
+ ~ITextProvider() {}
+ };
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/labelitemwindow.hxx b/include/svx/labelitemwindow.hxx
new file mode 100644
index 000000000..5271482b1
--- /dev/null
+++ b/include/svx/labelitemwindow.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/InterimItemWindow.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC LabelItemWindow final : public InterimItemWindow
+{
+private:
+ std::unique_ptr<weld::Label> m_xLabel;
+
+public:
+ LabelItemWindow(vcl::Window* pParent, const OUString& rLabel);
+ void set_label(const OUString& rLabel);
+ OUString get_label() const;
+
+ void SetOptimalSize();
+ virtual void dispose() override;
+ virtual ~LabelItemWindow() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx
new file mode 100644
index 000000000..a3d74adba
--- /dev/null
+++ b/include/svx/langbox.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_LANGBOX_HXX
+#define INCLUDED_SVX_LANGBOX_HXX
+
+#include <memory>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <svx/svxdllapi.h>
+#include <vcl/weld.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+enum class SvxLanguageListFlags
+{
+ EMPTY = 0x0000,
+ ALL = 0x0001,
+ WESTERN = 0x0002,
+ CTL = 0x0004,
+ CJK = 0x0008,
+ FBD_CHARS = 0x0010,
+ ONLY_KNOWN = 0x0020, // list only locales provided by I18N
+ SPELL_USED = 0x0040,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvxLanguageListFlags> : is_typed_flags<SvxLanguageListFlags, 0x007f> {};
+}
+
+// load language strings from resource
+SVXCORE_DLLPUBLIC OUString GetDicInfoStr( std::u16string_view rName, const LanguageType nLang, bool bNeg );
+
+class SVXCORE_DLLPUBLIC
+SvxLanguageBox
+{
+public:
+ enum class EditedAndValid
+ {
+ No,
+ Valid,
+ Invalid
+ };
+
+private:
+ std::unique_ptr<weld::ComboBox> m_xControl;
+ Link<weld::ComboBox&, void> m_aChangeHdl;
+ OUString m_aAllString;
+ std::unique_ptr<css::uno::Sequence<sal_Int16>> m_xSpellUsedLang;
+ LanguageType m_eSavedLanguage;
+ EditedAndValid m_eEditedAndValid;
+ bool m_bHasLangNone;
+ bool m_bLangNoneIsLangAll;
+ bool m_bWithCheckmark;
+
+ SVX_DLLPRIVATE weld::ComboBoxEntry BuildEntry(const LanguageType nLangType, sal_Int16 nType = css::i18n::ScriptType::WEAK);
+ SVX_DLLPRIVATE void AddLanguages(const std::vector< LanguageType >& rLanguageTypes, SvxLanguageListFlags nLangList,
+ std::vector<weld::ComboBoxEntry>& rEntries);
+ SVX_DLLPRIVATE void InsertLanguage(const LanguageType nLangType, sal_Int16 nType);
+
+ SVX_DLLPRIVATE int ImplTypeToPos(LanguageType eType) const;
+ DECL_DLLPRIVATE_LINK(ChangeHdl, weld::ComboBox&, void);
+public:
+ SvxLanguageBox(std::unique_ptr<weld::ComboBox> pControl);
+ void SetLanguageList( SvxLanguageListFlags nLangList,
+ bool bHasLangNone, bool bLangNoneIsLangAll = false,
+ bool bCheckSpellAvail = false, bool bDefaultLangExist = false,
+ LanguageType eDefaultLangType = LANGUAGE_NONE,
+ sal_Int16 nDefaultType = 0 );
+ void InsertLanguage(const LanguageType nLangType);
+
+ EditedAndValid GetEditedAndValid() const { return m_eEditedAndValid;}
+ sal_Int32 SaveEditedAsEntry();
+
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_aChangeHdl = rLink; }
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink) { m_xControl->connect_focus_in(rLink); }
+ void grab_focus() { m_xControl->grab_focus(); }
+ void save_active_id() { m_eSavedLanguage = get_active_id(); }
+ LanguageType get_saved_active_id() const { return m_eSavedLanguage; }
+ bool get_active_id_changed_from_saved() const { return m_eSavedLanguage != get_active_id(); }
+ void hide() { m_xControl->hide(); }
+ void set_visible(bool bShow) { m_xControl->set_visible(bShow); }
+ void set_size_request(int nWidth, int nHeight) { m_xControl->set_size_request(nWidth, nHeight); }
+ void set_width_chars(int nChars) { m_xControl->set_entry_width_chars(nChars); }
+ void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
+ void set_active(int nPos) { m_xControl->set_active(nPos); }
+ int get_active() const { return m_xControl->get_active(); }
+ void set_active_id(const LanguageType eLangType);
+ OUString get_active_text() const { return m_xControl->get_active_text(); }
+ bool get_visible() const { return m_xControl->get_visible(); }
+ LanguageType get_active_id() const;
+ int find_id(const LanguageType eLangType) const;
+ LanguageType get_id(int nPos) const;
+ void set_id(int nPos, const LanguageType eLangType);
+ void remove_id(const LanguageType eLangType);
+ void append(const LanguageType eLangType, const OUString& rStr);
+ int find_text(const OUString& rStr) const { return m_xControl->find_text(rStr); }
+ OUString get_text(int nPos) const { return m_xControl->get_text(nPos); }
+ int get_count() const { return m_xControl->get_count(); }
+ weld::ComboBox* get_widget() { return m_xControl.get(); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/lathe3d.hxx b/include/svx/lathe3d.hxx
new file mode 100644
index 000000000..4bd2fea31
--- /dev/null
+++ b/include/svx/lathe3d.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_LATHE3D_HXX
+#define INCLUDED_SVX_LATHE3D_HXX
+
+#include <svl/intitem.hxx>
+#include <svl/itemset.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/svddef.hxx>
+#include <svx/svx3ditems.hxx>
+
+class E3dDefaultAttributes;
+
+/*************************************************************************
+|*
+|* Create a 3D rotation object from a passed 2D polygon
+|*
+|* The aPolyPoly3D is rotated around its axis in nHSegments steps.
+|* nVSegments contains the number of lines of aPolyPoly3D and therefore
+|* is effectively a vertical segmentation.
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC E3dLatheObj final : public E3dCompoundObject
+{
+ basegfx::B2DPolyPolygon maPolyPoly2D;
+
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+ void SetDefaultAttributes(const E3dDefaultAttributes& rDefault);
+
+private:
+ // protected destructor - due to final, make private
+ virtual ~E3dLatheObj() override;
+
+public:
+ E3dLatheObj(
+ SdrModel& rSdrModel,
+ const E3dDefaultAttributes& rDefault,
+ const basegfx::B2DPolyPolygon& rPoly2D);
+ E3dLatheObj(SdrModel& rSdrModel, E3dLatheObj const & rSource);
+ E3dLatheObj(SdrModel& rSdrModel);
+
+ // HorizontalSegments:
+ sal_uInt32 GetHorizontalSegments() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_HORZ_SEGS).GetValue(); }
+
+ // VerticalSegments:
+ sal_uInt32 GetVerticalSegments() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_VERT_SEGS).GetValue(); }
+
+ // PercentDiagonal: 0..100, before 0.0..0.5
+ sal_uInt16 GetPercentDiagonal() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL).GetValue(); }
+
+ // BackScale: 0..100, before 0.0..1.0
+ sal_uInt16 GetBackScale() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_BACKSCALE).GetValue(); }
+
+ // EndAngle: 0..10000
+ sal_uInt32 GetEndAngle() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_END_ANGLE).GetValue(); }
+
+ // #107245# GetSmoothNormals() for bLatheSmoothed
+ bool GetSmoothNormals() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_NORMALS).GetValue(); }
+
+ // #107245# GetSmoothLids() for bLatheSmoothFrontBack
+ bool GetSmoothLids() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_LIDS).GetValue(); }
+
+ // #107245# GetCharacterMode() for bLatheCharacterMode
+ bool GetCharacterMode() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_CHARACTER_MODE).GetValue(); }
+
+ // #107245# GetCloseFront() for bLatheCloseFront
+ bool GetCloseFront() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_FRONT).GetValue(); }
+
+ // #107245# GetCloseBack() for bLatheCloseBack
+ bool GetCloseBack() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_BACK).GetValue(); }
+
+ virtual SdrObjKind GetObjIdentifier() const override;
+
+ virtual E3dLatheObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ // TakeObjName...() is for the display in the UI, for example "3 frames selected".
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ // set/get local parameters with geometry recreation
+ void SetPolyPoly2D(const basegfx::B2DPolyPolygon& rNew);
+ const basegfx::B2DPolyPolygon& GetPolyPoly2D() const { return maPolyPoly2D; }
+
+ // break up
+ virtual bool IsBreakObjPossible() override;
+ virtual std::unique_ptr<SdrAttrObj,SdrObjectFreeOp> GetBreakObj() override;
+};
+
+#endif // INCLUDED_SVX_LATHE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/legacyitem.hxx b/include/svx/legacyitem.hxx
new file mode 100644
index 000000000..b8d1362b4
--- /dev/null
+++ b/include/svx/legacyitem.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_LEGACYITEM_HXX
+#define INCLUDED_SVX_LEGACYITEM_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// // svx
+// SvxOrientationItem aOrientation( aRotateAngle.GetValue(), aStacked.GetValue(), 0 );
+// SvxMarginItem aMargin;
+// SvxRotateModeItem aRotateMode;
+//////////////////////////////////////////////////////////////////////////////
+
+class SvStream;
+class SvxOrientationItem;
+class SvxMarginItem;
+class SvxRotateModeItem;
+
+namespace legacy
+{
+ namespace SvxOrientation
+ {
+ sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion);
+ void Create(SvxOrientationItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ SvStream& Store(const SvxOrientationItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+ namespace SvxMargin
+ {
+ sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion);
+ void Create(SvxMarginItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ SvStream& Store(const SvxMarginItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+ namespace SvxRotateMode
+ {
+ sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion);
+ void Create(SvxRotateModeItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ SvStream& Store(const SvxRotateModeItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+}
+
+#endif // INCLUDED_SVX_LEGACYITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
new file mode 100644
index 000000000..e2cd9e6c8
--- /dev/null
+++ b/include/svx/linectrl.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_LINECTRL_HXX
+#define INCLUDED_SVX_LINECTRL_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include <svtools/popupwindowcontroller.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+namespace svx {
+ class ToolboxButtonLineStyleUpdater;
+}
+
+class XLineStyleItem;
+class XLineDashItem;
+
+typedef std::function<bool(const OUString&, const css::uno::Any&)> LineStyleSelectFunction;
+typedef std::function<void(bool)> LineStyleIsNoneFunction;
+
+// SvxLineStyleController:
+class SVXCORE_DLLPUBLIC SvxLineStyleToolBoxControl final : public svt::PopupWindowController
+{
+private:
+ std::unique_ptr<svx::ToolboxButtonLineStyleUpdater> m_xBtnUpdater;
+
+ LineStyleSelectFunction m_aLineStyleSelectFunction;
+ LineStyleIsNoneFunction m_aLineStyleIsNoneFunction;
+
+public:
+ SvxLineStyleToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence<css::uno::Any>& rArguments ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ virtual void SAL_CALL execute(sal_Int16 nKeyModifier) override;
+ virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& rEvent) override;
+
+ virtual ~SvxLineStyleToolBoxControl() override;
+
+ // called when the user selects a line style
+ void setLineStyleSelectFunction(const LineStyleSelectFunction& aLineStyleSelectFunction);
+ // called when the line style changes, can be used to trigger disabling the arrows if the none line style is selected
+ void setLineStyleIsNoneFunction(const LineStyleIsNoneFunction& aLineStyleIsNoneFunction);
+ void dispatchLineStyleCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
+
+private:
+ virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override;
+ virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override;
+
+};
+
+// SvxLineWidthController:
+
+class SVX_DLLPUBLIC SvxLineWidthToolBoxControl final : public SfxToolBoxControl
+{
+ static MapUnit GetCoreMetric();
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxLineWidthToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+ virtual ~SvxLineWidthToolBoxControl() override;
+
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState ) override;
+ virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/linkwarn.hxx b/include/svx/linkwarn.hxx
new file mode 100644
index 000000000..c72f7f85e
--- /dev/null
+++ b/include/svx/linkwarn.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_LINKWARN_HXX
+#define INCLUDED_SVX_LINKWARN_HXX
+
+#include <vcl/weld.hxx>
+#include <svx/svxdllapi.h>
+
+class SVX_DLLPUBLIC SvxLinkWarningDialog final : public weld::MessageDialogController
+{
+private:
+ std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
+
+public:
+ SvxLinkWarningDialog(weld::Widget* pParent, const OUString& _rFileName);
+ virtual ~SvxLinkWarningDialog() override;
+};
+
+#endif // INCLUDED_SVX_LINKWARN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/measctrl.hxx b/include/svx/measctrl.hxx
new file mode 100644
index 000000000..ccdcab46f
--- /dev/null
+++ b/include/svx/measctrl.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_MEASCTRL_HXX
+#define INCLUDED_SVX_MEASCTRL_HXX
+
+#include <vcl/customweld.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/svdobj.hxx>
+#include <memory>
+
+class SfxItemSet;
+class SdrMeasureObj;
+class SdrModel;
+
+class SVX_DLLPUBLIC SvxXMeasurePreview final : public weld::CustomWidgetController
+{
+ friend class SvxMeasurePage;
+
+private:
+ MapMode m_aMapMode;
+ std::unique_ptr<SdrModel> pModel;
+ std::unique_ptr<SdrMeasureObj, SdrObjectFreeOp> pMeasureObj;
+
+ void ResizeImpl(const Size& rSize);
+
+public:
+ SvxXMeasurePreview();
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual ~SvxXMeasurePreview() override;
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void Resize() override;
+ virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
+
+ void SetAttributes(const SfxItemSet& rInAttrs);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/modctrl.hxx b/include/svx/modctrl.hxx
new file mode 100644
index 000000000..d0b02ec98
--- /dev/null
+++ b/include/svx/modctrl.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_MODCTRL_HXX
+#define INCLUDED_SVX_MODCTRL_HXX
+
+#include <tools/link.hxx>
+#include <sfx2/stbitem.hxx>
+#include <svx/svxdllapi.h>
+
+#include <memory>
+
+class Timer;
+
+class SVX_DLLPUBLIC SvxModifyControl final : public SfxStatusBarControl
+{
+public:
+ virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState) override;
+ virtual void Paint(const UserDrawEvent& rUsrEvt) override;
+ virtual void Click() override;
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxModifyControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb);
+
+private: // Links
+ DECL_DLLPRIVATE_LINK(OnTimer, Timer*, void);
+
+private: // Functions
+ void _repaint();
+
+private:
+ struct ImplData;
+ std::shared_ptr<ImplData> mxImpl;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/msdffdef.hxx b/include/svx/msdffdef.hxx
new file mode 100644
index 000000000..373974e67
--- /dev/null
+++ b/include/svx/msdffdef.hxx
@@ -0,0 +1,858 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <limits.h>
+#include <sal/types.h>
+
+#define DFF_COMMON_RECORD_HEADER_SIZE 8
+
+const sal_uInt32 nMaxLegalDffRecordLength =
+ SAL_MAX_UINT32 - DFF_COMMON_RECORD_HEADER_SIZE;
+
+#define DFF_PSFLAG_CONTAINER 0x0F // If the version field of a record
+ // header takes on this value, the
+ // record header marks the start of
+ // a container.
+
+#define DFF_PST_TextHeaderAtom 3999
+#define DFF_PST_TextCharsAtom 4000
+#define DFF_PST_TextBytesAtom 4008
+#define DFF_PST_ExOleObjStg 4113
+
+// Record Name FBT-Value Instance Contents Wrd Exl Ppt Ver
+
+#define DFF_msofbtDggContainer 0xF000 // per-document data X X X
+#define DFF_msofbtDgg 0xF006 // an FDGG and several FIDCLs X X X 0
+#define DFF_msofbtCLSID 0xF016 // the CLSID of the application that put the data on the clipboard C C C 0
+#define DFF_msofbtOPT 0xF00B // count of properties the document-wide default shape properties X X X 3
+#define DFF_msofbtColorMRU 0xF11A // count of colors the colors in the MRU swatch X X X 0
+#define DFF_msofbtSplitMenuColors 0xF11E // count of colors the colors in the top-level split menus X X X 0
+#define DFF_msofbtBstoreContainer 0xF001 // count of BLIPs all images in the document (JPEGs, metafiles, etc.) X X X
+#define DFF_msofbtBSE 0xF007 // BLIP type an FBSE (one per BLIP) X X X 2
+#define DFF_msofbtBlipFirst 0xF018 // range of fbts reserved for various kinds of BLIPs X X X
+#define DFF_msofbtBlipLast 0xF117 // range of fbts reserved for various kinds of BLIPs X X X
+
+#define DFF_msofbtDgContainer 0xF002 // per-sheet/page/slide data X X X
+#define DFF_msofbtDg 0xF008 // drawing ID an FDG X X X 0
+#define DFF_msofbtRegroupItems 0xF118 // count of regroup entries several FRITs X X X 0
+#define DFF_msofbtColorScheme 0xF120 // count of colors the colors of the source host's color scheme C C 0
+#define DFF_msofbtSpgrContainer 0xF003 // several SpContainers, the first of which is the group shape itself X X X
+#define DFF_msofbtSpContainer 0xF004 // a shape X X X
+#define DFF_msofbtSpgr 0xF009 // an FSPGR; only present if the shape is a group shape X X X 1
+#define DFF_msofbtSp 0xF00A // shape type an FSP X X X 2
+#define DFF_msofbtTextbox 0xF00C // RTF text C C C 0
+#define DFF_msofbtClientTextbox 0xF00D // host-defined the text in the textbox, in host-defined format X X X
+#define DFF_msofbtAnchor 0xF00E // a RECT, in 100000ths of an inch C C C 0
+#define DFF_msofbtChildAnchor 0xF00F // a RECT, in units relative to the parent group X X X 0
+#define DFF_msofbtClientAnchor 0xF010 // host-defined the location of the shape, in a host-defined format X X X
+#define DFF_msofbtClientData 0xF011 // host-defined host-specific data X X X
+#define DFF_msofbtOleObject 0xF11F // a serialized IStorage for an OLE object C C C 0
+#define DFF_msofbtDeletedPspl 0xF11D // an FPSPL; only present in top-level deleted shapes X 0
+#define DFF_msofbtUDefProp 0xF122 // range of fbts reserved for various kinds of BLIPs X X X
+#define DFF_msofbtSolverContainer 0xF005 // count of rules the rules governing shapes X X X
+#define DFF_msofbtConnectorRule 0xF012 // an FConnectorRule X X 1
+#define DFF_msofbtAlignRule 0xF013 // an FAlignRule X X X 0
+#define DFF_msofbtArcRule 0xF014 // an FARCRU X X X 0
+#define DFF_msofbtClientRule 0xF015 // host-defined host-defined
+#define DFF_msofbtCalloutRule 0xF017 // an FCORU X X X 0
+
+
+// Values for the ULONG in DFF_PST_TextHeaderAtom
+enum DFF_TextHeader {
+ DFFTH_TITLE,
+ DFFTH_BODY,
+ DFFTH_NOTES,
+ DFFTH_NOTUSED,
+ DFFTH_OTHER, // Text in a Shape
+ DFFTH_CENTERBODY, // Subtitle in Title-Slide
+ DFFTH_CENTERTITLE, // Title in Title-Slide
+ DFFTH_HALFBODY, // Body in two-column slide
+ DFFTH_QUARTERBODY // Body in four-body slide
+};
+
+
+// Shape Properties
+// 1pt = 12700 EMU (English Metric Units)
+// 1pt = 20 Twip = 20/1440" = 1/72"
+// 1twip=635 EMU
+// 1" = 12700*72 = 914400 EMU
+// 1" = 25.4mm
+// 1mm = 36000 EMU
+
+
+// Record Name FBT-Value Instance Contents Wrd Exl Ppt Ver
+// Transform
+#define DFF_Prop_Rotation 4 // Fixed Point 16.16 degrees
+// Protection
+#define DFF_Prop_LockAgainstGrouping 127 // sal_Bool Do not group this shape
+// Text
+#define DFF_Prop_lTxid 128 // LONG id for the text, value determined by the host
+#define DFF_Prop_dxTextLeft 129 // LONG margins relative to shape's inscribed text rectangle (in EMUs)
+#define DFF_Prop_dyTextTop 130 // LONG
+#define DFF_Prop_dxTextRight 131 // LONG
+#define DFF_Prop_dyTextBottom 132 // LONG
+#define DFF_Prop_WrapText 133 // MSO_WRAPMODE Wrap text at shape margins
+#define DFF_Prop_anchorText 135 // MSO_ANCHOR How to anchor the text
+#define DFF_Prop_txflTextFlow 136 // MSO_TXFL Text flow
+#define DFF_Prop_cdirFont 137 // MSO_CDIR Font rotation
+#define DFF_Prop_hspNext 138 // MSO_HSP ID of the next shape (used by Word for linked textboxes)
+#define DFF_Prop_AutoTextMargin 188 // sal_Bool use host's margin calculations
+#define DFF_Prop_RotateText 189 // sal_Bool Rotate text with shape
+#define DFF_Prop_FitTextToShape 191 // sal_Bool Size text to fit shape size
+// GeoText
+#define DFF_Prop_gtextUNICODE 192 // WCHAR* UNICODE text string
+#define DFF_Prop_gtextAlign 194 // MSO_GEOTEXTALIGN alignment on curve
+#define DFF_Prop_gtextSize 195 // LONG default point size
+#define DFF_Prop_gtextSpacing 196 // LONG fixed point 16.16
+#define DFF_Prop_gtextFont 197 // WCHAR* font family name
+#define DFF_Prop_gtextFStretch 245 // sal_Bool 400 Stretch to fit shape
+#define DFF_Prop_gtextFBold 250 // sal_Bool 20 Bold font
+#define DFF_Prop_gtextFItalic 251 // sal_Bool 10 Italic font
+#define DFF_Prop_gtextFStrikethrough 255 // sal_Bool 1 Strike through font
+// Blip
+#define DFF_Prop_cropFromTop 256 // LONG 16.16 fraction times total image width or height, as appropriate.
+#define DFF_Prop_cropFromBottom 257 // LONG
+#define DFF_Prop_cropFromLeft 258 // LONG
+#define DFF_Prop_cropFromRight 259 // LONG
+#define DFF_Prop_pib 260 // IMsoBlip* Blip to display
+#define DFF_Prop_pibName 261 // WCHAR* Blip file name
+#define DFF_Prop_pibFlags 262 // MSO_BLIPFLAGS Blip flags
+#define DFF_Prop_pictureTransparent 263 // LONG transparent color (none if ~0UL)
+#define DFF_Prop_pictureContrast 264 // LONG contrast setting
+#define DFF_Prop_pictureBrightness 265 // LONG brightness setting
+#define DFF_Prop_pictureGamma 266 // LONG 16.16 gamma
+#define DFF_Prop_pictureId 267 // LONG Host-defined ID for OLE objects (usually a pointer)
+#define DFF_Prop_pictureActive 319 // sal_Bool Server is active (OLE objects only)
+// Geometry
+#define DFF_Prop_geoLeft 320 // LONG Defines the G (geometry) coordinate space.
+#define DFF_Prop_geoTop 321 // LONG
+#define DFF_Prop_geoRight 322 // LONG
+#define DFF_Prop_geoBottom 323 // LONG
+#define DFF_Prop_pVertices 325 // IMsoArray An array of points, in G units.
+#define DFF_Prop_pSegmentInfo 326 // IMsoArray
+#define DFF_Prop_adjustValue 327 // LONG Adjustment values corresponding to the positions of the
+#define DFF_Prop_adjust2Value 328 // LONG adjust handles of the shape. The number of values used
+#define DFF_Prop_adjust3Value 329 // LONG and their allowable ranges vary from shape type to shape type.
+#define DFF_Prop_adjust4Value 330 // LONG
+#define DFF_Prop_adjust5Value 331 // LONG
+#define DFF_Prop_adjust6Value 332 // LONG
+#define DFF_Prop_adjust7Value 333 // LONG
+#define DFF_Prop_adjust8Value 334 // LONG
+#define DFF_Prop_adjust9Value 335 // LONG
+#define DFF_Prop_adjust10Value 336 // LONG
+#define DFF_Prop_connectorPoints 337 // IMsoArray
+#define DFF_Prop_stretchPointX 339 // LONG
+#define DFF_Prop_stretchPointY 340 // LONG
+#define DFF_Prop_Handles 341 // H*
+#define DFF_Prop_pFormulas 342 // LONG
+#define DFF_Prop_textRectangles 343 // LONG
+#define DFF_Prop_connectorType 344 // LONG ->0=none, 1=segments, 2=custom, 3=rect
+#define DFF_Prop_f3DOK 379 // sal_Bool 3D may be set
+#define DFF_Prop_fGtextOK 381 // sal_Bool Text effect (FontWork) supported
+#define DFF_Prop_fFillShadeShapeOK 382 // BOOL
+#define DFF_Prop_fFillOK 383 // sal_Bool OK to fill the shape through the UI or VBA?
+// FillStyle
+#define DFF_Prop_fillType 384 // MSO_FILLTYPE Type of fill
+#define DFF_Prop_fillColor 385 // MSO_CLR Foreground color
+#define DFF_Prop_fillOpacity 386 // LONG Fixed 16.16
+#define DFF_Prop_fillBackColor 387 // MSO_CLR Background color
+#define DFF_Prop_fillBackOpacity 388 // LONG Shades only
+#define DFF_Prop_fillBlip 390 // IMsoBlip* Pattern/texture
+#define DFF_Prop_fillWidth 393 // LONG How big (A units) to make a metafile texture.
+#define DFF_Prop_fillHeight 394 // LONG
+#define DFF_Prop_fillAngle 395 // LONG Fade angle - degrees in 16.16
+#define DFF_Prop_fillFocus 396 // LONG Linear shaded fill focus percent
+#define DFF_Prop_fillToRight 399 // LONG Fraction 16.16
+#define DFF_Prop_fillToBottom 400 // LONG Fraction 16.16
+#define DFF_Prop_fillShadeColors 407 // IMsoArray a preset array of colors
+#define DFF_Prop_fFilled 443 // sal_Bool Is shape filled?
+#define DFF_Prop_fNoFillHitTest 447 // sal_Bool Hit test a shape as though filled
+// LineStyle
+#define DFF_Prop_lineColor 448 // MSO_CLR Color of line
+#define DFF_Prop_lineOpacity 449 // LONG Not implemented
+#define DFF_Prop_lineBackColor 450 // MSO_CLR Background color
+#define DFF_Prop_lineWidth 459 // LONG A units; 1pt == 12700 EMUs
+#define DFF_Prop_lineStyle 461 // MSO_LINESTYLE Draw parallel lines?
+#define DFF_Prop_lineDashing 462 // MSO_LINEDASHING Can be overridden by:
+#define DFF_Prop_lineDashStyle 463 // IMsoArray As Win32 ExtCreatePen
+#define DFF_Prop_lineStartArrowhead 464 // MSO_LINEEND Arrow at start
+#define DFF_Prop_lineEndArrowhead 465 // MSO_LINEEND Arrow at end
+#define DFF_Prop_lineStartArrowWidth 466 // MSO_LINEENDWIDTH Arrow at start
+#define DFF_Prop_lineStartArrowLength 467 // MSO_LINEENDLENGTH Arrow at end
+#define DFF_Prop_lineEndArrowWidth 468 // MSO_LINEENDWIDTH Arrow at start
+#define DFF_Prop_lineEndArrowLength 469 // MSO_LINEENDLENGTH Arrow at end
+#define DFF_Prop_lineJoinStyle 470 // MSO_LINEJOIN How to join lines
+#define DFF_Prop_lineEndCapStyle 471 // MSO_LINECAP How to end lines
+#define DFF_Prop_fLine 508 // sal_Bool Any line?
+#define DFF_Prop_fNoLineDrawDash 511 // sal_Bool Draw a dashed line if no line
+// ShadowStyle
+#define DFF_Prop_shadowType 512 // MSO_SHADOWTYPE Type of effect
+#define DFF_Prop_shadowColor 513 // MSO_CLR Foreground color
+#define DFF_Prop_shadowOpacity 516 // LONG Fixed 16.16
+#define DFF_Prop_shadowOffsetX 517 // LONG Offset shadow
+#define DFF_Prop_shadowOffsetY 518 // LONG Offset shadow
+#define DFF_Prop_fshadowObscured 575 // sal_Bool Excel5-style shadow
+// PerspectiveStyle
+#define DFF_Prop_fPerspective 639 // sal_Bool On/off
+// 3D Object
+#define DFF_Prop_c3DSpecularAmt 640 // LONG Fixed-point 16.16
+#define DFF_Prop_c3DDiffuseAmt 641 // LONG Fixed-point 16.16
+#define DFF_Prop_c3DShininess 642 // LONG Default gives OK results
+#define DFF_Prop_c3DExtrudeForward 644 // LONG Distance of extrusion in EMUs
+#define DFF_Prop_c3DExtrudeBackward 645 // LONG
+#define DFF_Prop_c3DExtrusionColor 647 // MSO_CLR Basic color of extruded part of shape; the lighting model used will determine the exact shades used when rendering.
+#define DFF_Prop_fc3DLightFace 703 // BOOL
+// 3D Style
+#define DFF_Prop_c3DYRotationAngle 704 // LONG degrees (16.16) about y axis
+#define DFF_Prop_c3DXRotationAngle 705 // LONG degrees (16.16) about x axis
+#define DFF_Prop_c3DRotationCenterX 710 // LONG rotation center x (16.16 or g-units)
+#define DFF_Prop_c3DRotationCenterY 711 // LONG rotation center y (16.16 or g-units)
+#define DFF_Prop_c3DRotationCenterZ 712 // LONG rotation center z (absolute (emus))
+#define DFF_Prop_c3DRenderMode 713 // MSO_3DRENDERMODE Full,wireframe, or bcube
+#define DFF_Prop_c3DTolerance 714 // LONG pixels (16.16)
+#define DFF_Prop_c3DXViewpoint 715 // LONG X view point (emus)
+#define DFF_Prop_c3DYViewpoint 716 // LONG Y view point (emus)
+#define DFF_Prop_c3DZViewpoint 717 // LONG Z view distance (emus)
+#define DFF_Prop_c3DOriginX 718 // LONG
+#define DFF_Prop_c3DOriginY 719 // LONG
+#define DFF_Prop_c3DSkewAngle 720 // LONG degree (16.16) skew angle
+#define DFF_Prop_c3DSkewAmount 721 // LONG Percentage skew amount
+#define DFF_Prop_c3DAmbientIntensity 722 // LONG Fixed point intensity
+#define DFF_Prop_c3DKeyX 723 // LONG Key light source direc-
+#define DFF_Prop_c3DKeyY 724 // LONG tion; only their relative
+#define DFF_Prop_c3DKeyZ 725 // LONG magnitudes matter
+#define DFF_Prop_c3DKeyIntensity 726 // LONG Fixed point intensity
+#define DFF_Prop_c3DFillX 727 // LONG Fill light source direc-
+#define DFF_Prop_c3DFillY 728 // LONG tion; only their relative
+#define DFF_Prop_c3DFillZ 729 // LONG magnitudes matter
+#define DFF_Prop_c3DFillIntensity 730 // LONG Fixed point intensity
+#define DFF_Prop_fc3DFillHarsh 767 // sal_Bool Is fill lighting harsh?
+// Shape
+#define DFF_Prop_hspMaster 769 // MSO_HSP master shape
+#define DFF_Prop_cxstyle 771 // MSO_CXSTYLE Type of connector
+#define DFF_Prop_fBackground 831 // sal_Bool If sal_True, this is the background shape.
+
+// Callout
+#define DFF_Prop_fCalloutLengthSpecified 895 // sal_Bool if true, we look at dxyCalloutLengthSpecified
+
+// GroupShape
+#define DFF_Prop_wzName 896 // WCHAR* Shape Name (present only if explicitly set)
+#define DFF_Prop_wzDescription 897 // WCHAR* alternate text
+#define DFF_Prop_pihlShape 898 // IHlink* The hyperlink in the shape.
+#define DFF_Prop_pWrapPolygonVertices 899 // IMsoArray The polygon that text will be wrapped around (Word)
+#define DFF_Prop_dxWrapDistLeft 900 // LONG Left wrapping distance from text (Word)
+#define DFF_Prop_dyWrapDistTop 901 // LONG Top wrapping distance from text (Word)
+#define DFF_Prop_dxWrapDistRight 902 // LONG Right wrapping distance from text (Word)
+#define DFF_Prop_dyWrapDistBottom 903 // LONG Bottom wrapping distance from text (Word)
+#define DFF_Prop_tableProperties 927 // LONG
+#define DFF_Prop_tableRowProperties 928 // LONG*
+#define DFF_Prop_fHidden 958 // sal_Bool Do not display
+#define DFF_Prop_fPrint 959 // sal_Bool Print this shape
+
+// properties of the second property set
+#define DFF_Prop_metroBlob 937 // XML ZipPackage*
+
+// linchpin: the shape type
+enum MSO_SPT: sal_Int32 {
+ mso_sptMin = 0,
+ mso_sptNotPrimitive = mso_sptMin,
+ mso_sptRectangle = 1,
+ mso_sptRoundRectangle = 2,
+ mso_sptEllipse = 3,
+ mso_sptDiamond = 4,
+ mso_sptIsocelesTriangle = 5,
+ mso_sptRightTriangle = 6,
+ mso_sptParallelogram = 7,
+ mso_sptTrapezoid = 8,
+ mso_sptHexagon = 9,
+ mso_sptOctagon = 10,
+ mso_sptPlus = 11,
+ mso_sptStar = 12,
+ mso_sptArrow = 13,
+ mso_sptThickArrow = 14,
+ mso_sptHomePlate = 15,
+ mso_sptCube = 16,
+ mso_sptBalloon = 17,
+ mso_sptSeal = 18,
+ mso_sptArc = 19,
+ mso_sptLine = 20,
+ mso_sptPlaque = 21,
+ mso_sptCan = 22,
+ mso_sptDonut = 23,
+ mso_sptTextSimple = 24,
+ mso_sptTextOctagon = 25,
+ mso_sptTextHexagon = 26,
+ mso_sptTextCurve = 27,
+ mso_sptTextWave = 28,
+ mso_sptTextRing = 29,
+ mso_sptTextOnCurve = 30,
+ mso_sptTextOnRing = 31,
+ mso_sptStraightConnector1 = 32,
+ mso_sptBentConnector2 = 33,
+ mso_sptBentConnector3 = 34,
+ mso_sptBentConnector4 = 35,
+ mso_sptBentConnector5 = 36,
+ mso_sptCurvedConnector2 = 37,
+ mso_sptCurvedConnector3 = 38,
+ mso_sptCurvedConnector4 = 39,
+ mso_sptCurvedConnector5 = 40,
+ mso_sptCallout1 = 41,
+ mso_sptCallout2 = 42,
+ mso_sptCallout3 = 43,
+ mso_sptAccentCallout1 = 44,
+ mso_sptAccentCallout2 = 45,
+ mso_sptAccentCallout3 = 46,
+ mso_sptBorderCallout1 = 47,
+ mso_sptBorderCallout2 = 48,
+ mso_sptBorderCallout3 = 49,
+ mso_sptAccentBorderCallout1 = 50,
+ mso_sptAccentBorderCallout2 = 51,
+ mso_sptAccentBorderCallout3 = 52,
+ mso_sptRibbon = 53,
+ mso_sptRibbon2 = 54,
+ mso_sptChevron = 55,
+ mso_sptPentagon = 56,
+ mso_sptNoSmoking = 57,
+ mso_sptSeal8 = 58,
+ mso_sptSeal16 = 59,
+ mso_sptSeal32 = 60,
+ mso_sptWedgeRectCallout = 61,
+ mso_sptWedgeRRectCallout = 62,
+ mso_sptWedgeEllipseCallout = 63,
+ mso_sptWave = 64,
+ mso_sptFoldedCorner = 65,
+ mso_sptLeftArrow = 66,
+ mso_sptDownArrow = 67,
+ mso_sptUpArrow = 68,
+ mso_sptLeftRightArrow = 69,
+ mso_sptUpDownArrow = 70,
+ mso_sptIrregularSeal1 = 71,
+ mso_sptIrregularSeal2 = 72,
+ mso_sptLightningBolt = 73,
+ mso_sptHeart = 74,
+ mso_sptPictureFrame = 75,
+ mso_sptQuadArrow = 76,
+ mso_sptLeftArrowCallout = 77,
+ mso_sptRightArrowCallout = 78,
+ mso_sptUpArrowCallout = 79,
+ mso_sptDownArrowCallout = 80,
+ mso_sptLeftRightArrowCallout = 81,
+ mso_sptUpDownArrowCallout = 82,
+ mso_sptQuadArrowCallout = 83,
+ mso_sptBevel = 84,
+ mso_sptLeftBracket = 85,
+ mso_sptRightBracket = 86,
+ mso_sptLeftBrace = 87,
+ mso_sptRightBrace = 88,
+ mso_sptLeftUpArrow = 89,
+ mso_sptBentUpArrow = 90,
+ mso_sptBentArrow = 91,
+ mso_sptSeal24 = 92,
+ mso_sptStripedRightArrow = 93,
+ mso_sptNotchedRightArrow = 94,
+ mso_sptBlockArc = 95,
+ mso_sptSmileyFace = 96,
+ mso_sptVerticalScroll = 97,
+ mso_sptHorizontalScroll = 98,
+ mso_sptCircularArrow = 99,
+ mso_sptNotchedCircularArrow = 100,
+ mso_sptUturnArrow = 101,
+ mso_sptCurvedRightArrow = 102,
+ mso_sptCurvedLeftArrow = 103,
+ mso_sptCurvedUpArrow = 104,
+ mso_sptCurvedDownArrow = 105,
+ mso_sptCloudCallout = 106,
+ mso_sptEllipseRibbon = 107,
+ mso_sptEllipseRibbon2 = 108,
+ mso_sptFlowChartProcess = 109,
+ mso_sptFlowChartDecision = 110,
+ mso_sptFlowChartInputOutput = 111,
+ mso_sptFlowChartPredefinedProcess = 112,
+ mso_sptFlowChartInternalStorage = 113,
+ mso_sptFlowChartDocument = 114,
+ mso_sptFlowChartMultidocument = 115,
+ mso_sptFlowChartTerminator = 116,
+ mso_sptFlowChartPreparation = 117,
+ mso_sptFlowChartManualInput = 118,
+ mso_sptFlowChartManualOperation = 119,
+ mso_sptFlowChartConnector = 120,
+ mso_sptFlowChartPunchedCard = 121,
+ mso_sptFlowChartPunchedTape = 122,
+ mso_sptFlowChartSummingJunction = 123,
+ mso_sptFlowChartOr = 124,
+ mso_sptFlowChartCollate = 125,
+ mso_sptFlowChartSort = 126,
+ mso_sptFlowChartExtract = 127,
+ mso_sptFlowChartMerge = 128,
+ mso_sptFlowChartOfflineStorage = 129,
+ mso_sptFlowChartOnlineStorage = 130,
+ mso_sptFlowChartMagneticTape = 131,
+ mso_sptFlowChartMagneticDisk = 132,
+ mso_sptFlowChartMagneticDrum = 133,
+ mso_sptFlowChartDisplay = 134,
+ mso_sptFlowChartDelay = 135,
+ mso_sptTextPlainText = 136,
+ mso_sptTextStop = 137,
+ mso_sptTextTriangle = 138,
+ mso_sptTextTriangleInverted = 139,
+ mso_sptTextChevron = 140,
+ mso_sptTextChevronInverted = 141,
+ mso_sptTextRingInside = 142,
+ mso_sptTextRingOutside = 143,
+ mso_sptTextArchUpCurve = 144,
+ mso_sptTextArchDownCurve = 145,
+ mso_sptTextCircleCurve = 146,
+ mso_sptTextButtonCurve = 147,
+ mso_sptTextArchUpPour = 148,
+ mso_sptTextArchDownPour = 149,
+ mso_sptTextCirclePour = 150,
+ mso_sptTextButtonPour = 151,
+ mso_sptTextCurveUp = 152,
+ mso_sptTextCurveDown = 153,
+ mso_sptTextCascadeUp = 154,
+ mso_sptTextCascadeDown = 155,
+ mso_sptTextWave1 = 156,
+ mso_sptTextWave2 = 157,
+ mso_sptTextWave3 = 158,
+ mso_sptTextWave4 = 159,
+ mso_sptTextInflate = 160,
+ mso_sptTextDeflate = 161,
+ mso_sptTextInflateBottom = 162,
+ mso_sptTextDeflateBottom = 163,
+ mso_sptTextInflateTop = 164,
+ mso_sptTextDeflateTop = 165,
+ mso_sptTextDeflateInflate = 166,
+ mso_sptTextDeflateInflateDeflate = 167,
+ mso_sptTextFadeRight = 168,
+ mso_sptTextFadeLeft = 169,
+ mso_sptTextFadeUp = 170,
+ mso_sptTextFadeDown = 171,
+ mso_sptTextSlantUp = 172,
+ mso_sptTextSlantDown = 173,
+ mso_sptTextCanUp = 174,
+ mso_sptTextCanDown = 175,
+ mso_sptFlowChartAlternateProcess = 176,
+ mso_sptFlowChartOffpageConnector = 177,
+ mso_sptCallout90 = 178,
+ mso_sptAccentCallout90 = 179,
+ mso_sptBorderCallout90 = 180,
+ mso_sptAccentBorderCallout90 = 181,
+ mso_sptLeftRightUpArrow = 182,
+ mso_sptSun = 183,
+ mso_sptMoon = 184,
+ mso_sptBracketPair = 185,
+ mso_sptBracePair = 186,
+ mso_sptSeal4 = 187,
+ mso_sptDoubleWave = 188,
+ mso_sptActionButtonBlank = 189,
+ mso_sptActionButtonHome = 190,
+ mso_sptActionButtonHelp = 191,
+ mso_sptActionButtonInformation = 192,
+ mso_sptActionButtonForwardNext = 193,
+ mso_sptActionButtonBackPrevious = 194,
+ mso_sptActionButtonEnd = 195,
+ mso_sptActionButtonBeginning = 196,
+ mso_sptActionButtonReturn = 197,
+ mso_sptActionButtonDocument = 198,
+ mso_sptActionButtonSound = 199,
+ mso_sptActionButtonMovie = 200,
+ mso_sptHostControl = 201,
+ mso_sptTextBox = 202,
+ //for pptx shape which doesn't exist in ppt
+ mso_sptTearDrop = 203,
+ mso_sptMax = 0x0FFF,
+ mso_sptNil = mso_sptMax
+};
+
+// different enums from the OfficeDraw documentation, Appendix D - beginning
+
+// note: in opposite to the MS documentation, they all
+// start with "mso_" instead of "mso"
+
+enum MSO_ShapePath {
+ mso_shapeLines, // A line of straight segments
+ mso_shapeLinesClosed, // A closed polygonal object
+ mso_shapeCurves, // A line of Bezier curve segments
+ mso_shapeCurvesClosed, // A closed shape with curved edges
+ mso_shapeComplex // pSegmentInfo must be non-empty
+};
+
+enum MSO_WrapMode {
+ mso_wrapSquare,
+ mso_wrapByPoints,
+ mso_wrapNone,
+ mso_wrapTopBottom,
+ mso_wrapThrough
+};
+
+enum MSO_BWMode {
+ mso_bwColor, // only used for predefined shades
+ mso_bwAutomatic, // depends on object type
+ mso_bwGrayScale, // shades of gray only
+ mso_bwLightGrayScale, // shades of light gray only
+ mso_bwInverseGray, // dark gray mapped to light gray, etc.
+ mso_bwGrayOutline, // pure gray and white
+ mso_bwBlackTextLine, // black text and lines, all else grayscale
+ mso_bwHighContrast, // pure black and white mode (no grays)
+ mso_bwBlack, // solid black
+ mso_bwWhite, // solid white
+ mso_bwDontShow, // object not drawn
+ mso_bwNumModes // number of Black and white modes
+};
+
+enum MSO_Anchor {
+ mso_anchorTop,
+ mso_anchorMiddle,
+ mso_anchorBottom,
+ mso_anchorTopCentered,
+ mso_anchorMiddleCentered,
+ mso_anchorBottomCentered,
+ mso_anchorTopBaseline,
+ mso_anchorBottomBaseline,
+ mso_anchorTopCenteredBaseline,
+ mso_anchorBottomCenteredBaseline
+};
+
+enum MSO_CDir {
+ mso_cdir0, // Right
+ mso_cdir90, // Down
+ mso_cdir180, // Left
+ mso_cdir270 // Up
+};
+
+// connector style
+enum MSO_ConnectorStyle {
+ mso_cxstyleStraight = 0,
+ mso_cxstyleBent,
+ mso_cxstyleCurved,
+ mso_cxstyleNone
+};
+
+// MSO_TXFL -- text flow
+enum MSO_TextFlow {
+ mso_txflHorzN, // Horizontal non-@
+ mso_txflTtoBA, // Top to Bottom @-font
+ mso_txflBtoT, // Bottom to Top non-@
+ mso_txflTtoBN, // Top to Bottom non-@
+ mso_txflHorzA, // Horizontal @-font
+ mso_txflVertN // Vertical, non-@
+};
+
+// MSO_TXDIR - text direction (needed for Bi-Di support)
+enum MSO_TextDir {
+ mso_txdirLTR, // left-to-right text direction
+ mso_txdirRTL, // right-to-left text direction
+ mso_txdirContext // context text direction
+};
+
+// MSO_SPCOT -- Callout Type
+enum MSO_SPCalloutType {
+ mso_spcotRightAngle = 1,
+ mso_spcotOneSegment = 2,
+ mso_spcotTwoSegment = 3,
+ mso_spcotThreeSegment = 4
+};
+
+// MSO_SPCOA -- Callout Angle
+enum MSO_SPCalloutAngle {
+ mso_spcoaAny,
+ mso_spcoa30,
+ mso_spcoa45,
+ mso_spcoa60,
+ mso_spcoa90,
+ mso_spcoa0
+};
+
+// MSO_SPCOD -- Callout Drop
+enum MSO_SPCalloutDrop {
+ mso_spcodTop,
+ mso_spcodCenter,
+ mso_spcodBottom,
+ mso_spcodSpecified
+};
+
+// MSO_GEOTEXTALIGN - FontWork alignment
+enum MSO_GeoTextAlign {
+ mso_alignTextStretch, /* Stretch each line of text to fit width. */
+ mso_alignTextCenter, /* Center text on width. */
+ mso_alignTextLeft, /* Left justify. */
+ mso_alignTextRight, /* Right justify. */
+ mso_alignTextLetterJust, /* Spread letters out to fit width. */
+ mso_alignTextWordJust, /* Spread words out to fit width. */
+ mso_alignTextInvalid /* Invalid */
+};
+
+// MSO_BLIPFLAGS - flags for pictures
+enum MSO_BlipFlags {
+ mso_blipflagDefault = 0,
+ mso_blipflagComment = 0, // Blip name is a comment
+ mso_blipflagFile, // Blip name is a file name
+ mso_blipflagURL, // Blip name is a full URL
+ mso_blipflagType = 3, // Mask to extract type
+ /* Or the following flags with any of the above. */
+ mso_blipflagDontSave = 4, // A "dont" is the depression in the metal
+ // body work of an automobile caused when a
+ // cyclist violently trusts his or her nose
+ // at it, thus a DontSave is another name for
+ // a cycle lane.
+ mso_blipflagDoNotSave = 4, // For those who prefer English
+ mso_blipflagLinkToFile = 8
+};
+
+enum MSO_3DRenderMode {
+ mso_FullRender, // Generate a full rendering
+ mso_Wireframe, // Generate a wireframe
+ mso_BoundingCube // Generate a bounding cube
+};
+
+enum MSO_XFormType {
+ mso_xformAbsolute, // Apply transform in absolute space centered on shape
+ mso_xformShape, // Apply transform to shape geometry
+ mso_xformDrawing // Apply transform in drawing space
+};
+
+enum MSO_ShadowType {
+ mso_shadowOffset, // N pixel offset shadow
+ mso_shadowDouble, // Use second offset too
+ mso_shadowRich, // Rich perspective shadow (cast relative to shape)
+ mso_shadowShape, // Rich perspective shadow (cast in shape space)
+ mso_shadowDrawing, // Perspective shadow cast in drawing space
+ mso_shadowEmbossOrEngrave
+};
+
+// MSO_DZTYPE - the type of a (length) measurement
+enum MSO_DZType {
+ mso_dztypeMin = 0,
+ mso_dztypeDefault = 0, // Default size, ignore the values
+ mso_dztypeA = 1, // Values are in EMUs
+ mso_dztypeV = 2, // Values are in pixels
+ mso_dztypeShape = 3, // Values are 16.16 fractions of shape size
+ mso_dztypeFixedAspect = 4, // Aspect ratio is fixed
+ mso_dztypeAFixed = 5, // EMUs, fixed aspect ratio
+ mso_dztypeVFixed = 6, // Pixels, fixed aspect ratio
+ mso_dztypeShapeFixed = 7, // Proportion of shape, fixed aspect ratio
+ mso_dztypeFixedAspectEnlarge
+ = 8, // Aspect ratio is fixed, favor larger size
+ mso_dztypeAFixedBig = 9, // EMUs, fixed aspect ratio
+ mso_dztypeVFixedBig = 10, // Pixels, fixed aspect ratio
+ mso_dztypeShapeFixedBig= 11, // Proportion of shape, fixed aspect ratio
+ mso_dztypeMax = 11
+};
+
+enum MSO_FillType {
+ mso_fillSolid, // Fill with a solid color
+ mso_fillPattern, // Fill with a pattern (bitmap)
+ mso_fillTexture, // A texture (pattern with its own color map)
+ mso_fillPicture, // Center a picture in the shape
+ mso_fillShade, // Shade from start to end points
+ mso_fillShadeCenter, // Shade from bounding rectangle to end point
+ mso_fillShadeShape, // Shade from shape outline to end point
+ mso_fillShadeScale, // Similar to mso_fillShade, but the fillAngle
+ // is additionally scaled by the aspect ratio of
+ // the shape. If shape is square, it is the
+ // same as mso_fillShade.
+ mso_fillShadeTitle, // special type - shade to title --- for PP
+ mso_fillBackground // Use the background fill color/pattern
+};
+
+// MSOLINESTYLE - compound line style
+enum MSO_LineStyle {
+ mso_lineSimple, // Single line (of width lineWidth)
+ mso_lineDouble, // Double lines of equal width
+ mso_lineThickThin, // Double lines, one thick, one thin
+ mso_lineThinThick, // Double lines, reverse order
+ mso_lineTriple, // Three lines, thin, thick, thin
+ MSO_LineStyle_NONE = USHRT_MAX
+};
+
+// MSO_LINETYPE - how to "fill" the line contour
+enum MSO_LineType {
+ mso_lineSolidType, // Fill with a solid color
+ mso_linePattern, // Fill with a pattern (bitmap)
+ mso_lineTexture, // A texture (pattern with its own color map)
+ mso_linePicture // Center a picture in the shape
+};
+
+// MSO_LINEDASHING - dashed line style
+enum MSO_LineDashing {
+ mso_lineSolid, // Solid (continuous) pen
+ mso_lineDashSys, // PS_DASH system dash style
+ mso_lineDotSys, // PS_DOT system dash style
+ mso_lineDashDotSys, // PS_DASHDOT system dash style
+ mso_lineDashDotDotSys, // PS_DASHDOTDOT system dash style
+ mso_lineDotGEL, // square dot style
+ mso_lineDashGEL, // dash style
+ mso_lineLongDashGEL, // long dash style
+ mso_lineDashDotGEL, // dash short dash
+ mso_lineLongDashDotGEL, // long dash short dash
+ mso_lineLongDashDotDotGEL // long dash short dash short dash
+};
+
+// MSO_LINEEND - line end effect
+enum MSO_LineEnd {
+ mso_lineNoEnd,
+ mso_lineArrowEnd,
+ mso_lineArrowStealthEnd,
+ mso_lineArrowDiamondEnd,
+ mso_lineArrowOvalEnd,
+ mso_lineArrowOpenEnd
+};
+
+// MSO_LINEENDWIDTH - size of arrowhead
+enum MSO_LineEndWidth {
+ mso_lineNarrowArrow,
+ mso_lineMediumWidthArrow,
+ mso_lineWideArrow
+};
+
+// MSO_LINEENDLENGTH - size of arrowhead
+enum MSO_LineEndLength {
+ mso_lineShortArrow,
+ mso_lineMediumLenArrow,
+ mso_lineLongArrow
+};
+
+// MSO_LINEJOIN - line join style.
+enum MSO_LineJoin {
+ mso_lineJoinBevel, // Join edges by a straight line
+ mso_lineJoinMiter, // Extend edges until they join
+ mso_lineJoinRound // Draw an arc between the two edges
+};
+
+// MSO_LINECAP - line cap style (applies to ends of dash segments too).
+enum MSO_LineCap {
+ mso_lineEndCapRound, // Rounded ends - the default
+ mso_lineEndCapSquare, // Square protrudes by half line width
+ mso_lineEndCapFlat // Line ends at end point
+};
+// Various enums from the OfficeDraw documentation Appendix D - End
+
+// BStore-Container
+
+
+enum MSO_BLIPUSAGE {
+ mso_blipUsageDefault, // All non-texture fill blips get this.
+ mso_blipUsageTexture,
+ mso_blipUsageMax = 255 // Since this is stored in a byte
+};
+
+enum MSO_BLIPTYPE { // GEL provided types...
+ mso_blipERROR = 0, // An error occurred during loading
+ mso_blipUNKNOWN, // An unknown blip type
+ mso_blipEMF, // Windows Enhanced Metafile
+ mso_blipWMF, // Windows Metafile
+ mso_blipPICT, // Macintosh PICT
+ mso_blipJPEG, // JFIF
+ mso_blipPNG, // PNG
+ mso_blipDIB, // Windows DIB
+ mso_blipFirstClient = 32, // First client defined blip type
+ mso_blipLastClient = 255 // Last client defined blip type
+};
+
+enum MSO_BI {
+ mso_biUNKNOWN = 0,
+ mso_biWMF = 0x216, // Metafile header then compressed WMF
+ mso_biEMF = 0x3D4, // Metafile header then compressed EMF
+ mso_biPICT = 0x542, // Metafile header then compressed PICT
+ mso_biPNG = 0x6E0, // One byte tag then PNG data
+ mso_biJFIF = 0x46A, // One byte tag then JFIF data
+ mso_biJPEG = mso_biJFIF,
+ mso_biDIB = 0x7A8, // One byte tag then DIB data
+ mso_biClient=0x800 // Clients should set this bit
+}; // Blip signature as encoded in the MSO_FBH.inst
+
+enum MSO_BLIPCOMPRESSION {
+ mso_compressionDeflate = 0,
+ mso_compressionNone = 254, // Used only if compression fails
+ mso_compressionTest = 255 // For testing only
+};
+
+enum MSO_BLIPFILTER {
+ mso_filterAdaptive = 0, // PNG type - not used/supported for metafile
+ mso_filterNone = 254,
+ mso_filterTest = 255 // For testing only
+};
+
+enum MSO_SYSCOLORINDEX {
+ mso_syscolorButtonFace, // COLOR_BTNFACE
+ mso_syscolorWindowText, // COLOR_WINDOWTEXT
+ mso_syscolorMenu, // COLOR_MENU
+ mso_syscolorHighlight, // COLOR_HIGHLIGHT
+ mso_syscolorHighlightText, // COLOR_HIGHLIGHTTEXT
+ mso_syscolorCaptionText, // COLOR_CAPTIONTEXT
+ mso_syscolorActiveCaption, // COLOR_ACTIVECAPTION
+ mso_syscolorButtonHighlight, // COLOR_BTNHIGHLIGHT
+ mso_syscolorButtonShadow, // COLOR_BTNSHADOW
+ mso_syscolorButtonText, // COLOR_BTNTEXT
+ mso_syscolorGrayText, // COLOR_GRAYTEXT
+ mso_syscolorInactiveCaption, // COLOR_INACTIVECAPTION
+ mso_syscolorInactiveCaptionText, // COLOR_INACTIVECAPTIONTEXT
+ mso_syscolorInfoBackground, // COLOR_INFOBK
+ mso_syscolorInfoText, // COLOR_INFOTEXT
+ mso_syscolorMenuText, // COLOR_MENUTEXT
+ mso_syscolorScrollbar, // COLOR_SCROLLBAR
+ mso_syscolorWindow, // COLOR_WINDOW
+ mso_syscolorWindowFrame, // COLOR_WINDOWFRAME
+ mso_syscolor3DLight, // COLOR_3DLIGHT
+ mso_syscolorMax, // Count of system colors
+
+ mso_colorFillColor = 0xF0, // Use the fillColor property
+ mso_colorLineOrFillColor, // Use the line color only if there is a line
+ mso_colorLineColor, // Use the lineColor property
+ mso_colorShadowColor, // Use the shadow color
+ mso_colorThis, // Use this color (only valid as described below)
+ mso_colorFillBackColor, // Use the fillBackColor property
+ mso_colorLineBackColor, // Use the lineBackColor property
+ mso_colorFillThenLine, // Use the fillColor unless no fill and line
+ mso_colorIndexMask = 0xFF, // Extract the color index
+
+ mso_colorProcessMask =0xFFFF00,// All the processing bits
+ mso_colorModificationMask =0x0F00, // Just the function
+ mso_colorModFlagMask =0xF000, // Just the additional flags
+ mso_colorDarken =0x0100, // Darken color by parameter/255
+ mso_colorLighten =0x0200, // Lighten color by parameter/255
+ mso_colorAdd =0x0300, // Add grey level RGB(param,param,param)
+ mso_colorSubtract =0x0400, // Subtract grey level RGB(p,p,p)
+ mso_colorReverseSubtract =0x0500, // Subtract from grey level RGB(p,p,p)
+ /* In the following "black" means maximum component value, white minimum.
+ The operation is per component, to guarantee white combine with
+ mso_colorGray */
+ mso_colorBlackWhite =0x0600, // Black if < uParam, else white (>=)
+ mso_colorInvert =0x2000, // Invert color (at the *end*)
+ mso_colorInvert128 =0x4000, // Invert by toggling the top bit
+ mso_colorGray =0x8000, // Make the color gray (before the above!)
+ mso_colorBParamMask =0xFF0000,// Parameter used as above
+ mso_colorBParamShift = 16 // To extract the parameter value
+};
+
+enum MSO_TextGeometryProperties {
+ use_gtextFBestFit = 0x00000100,
+ use_gtextFShrinkFit = 0x00000200,
+ use_gtextFStretch = 0x00000400,
+ gtextFBestFit = 0x01000000,
+ gtextFShrinkFit = 0x02000000,
+ gtextFStretch = 0x04000000
+};
+
+//ALT_TXT_MSINTEROP
+#define MSPROP_DESCRIPTION_MAX_LEN 4096
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/nbdtmg.hxx b/include/svx/nbdtmg.hxx
new file mode 100644
index 000000000..7d397687a
--- /dev/null
+++ b/include/svx/nbdtmg.hxx
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_NBDTMG_HXX
+#define INCLUDED_SVX_NBDTMG_HXX
+#include <svx/svxdllapi.h>
+#include <memory>
+#include <vector>
+#include <editeng/numitem.hxx>
+#include <vcl/font.hxx>
+
+namespace svx::sidebar {
+
+#define DEFAULT_BULLET_TYPES 8
+#define DEFAULT_NUM_VALUSET_COUNT 8
+#define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION 0x10
+
+enum class NBOType
+{
+ Bullets = 1, Numbering, Outline
+};
+
+class SVX_DLLPUBLIC NumSettings_Impl
+{
+ public:
+ SvxNumType nNumberType;
+ short nParentNumbering;
+ SvxNumberFormat::LabelFollowedBy eLabelFollowedBy;
+ tools::Long nTabValue;
+ SvxAdjust eNumAlign;
+ tools::Long nNumAlignAt;
+ tools::Long nNumIndentAt;
+ OUString sPrefix;
+ OUString sSuffix;
+ OUString sBulletChar;
+ OUString sBulletFont;
+ SvxBrushItem *pBrushItem;
+ Size aSize;
+
+ public:
+ NumSettings_Impl()
+ : nNumberType(SVX_NUM_CHARS_UPPER_LETTER)
+ , nParentNumbering(0)
+ , eLabelFollowedBy(SvxNumberFormat::NOTHING)
+ , nTabValue (0)
+ , eNumAlign(SvxAdjust::Left)
+ , nNumAlignAt(0)
+ , nNumIndentAt(0)
+ , pBrushItem(nullptr)
+ , aSize(0,0)
+ {}
+};
+
+typedef std::vector< std::shared_ptr<NumSettings_Impl> > NumSettingsArr_Impl;
+
+class SVX_DLLPUBLIC BulletsSettings
+{
+public:
+ vcl::Font aFont;
+ OUString sDescription;
+ sal_UCS4 cBulletChar;
+ bool bIsCustomized;
+ BulletsSettings() : cBulletChar(0), bIsCustomized(false) {}
+};
+
+
+class SVX_DLLPUBLIC NumberSettings_Impl
+{
+ public:
+ bool bIsCustomized;
+ OUString sDescription;
+ NumSettings_Impl* pNumSetting;
+ public:
+ NumberSettings_Impl() :
+ bIsCustomized(false),
+ pNumSetting(nullptr)
+ {}
+};
+
+typedef std::vector< std::shared_ptr<NumberSettings_Impl> > NumberSettingsArr_Impl;
+
+class SVX_DLLPUBLIC OutlineSettings_Impl
+{
+ public:
+ bool bIsCustomized;
+ OUString sDescription;
+ NumSettingsArr_Impl *pNumSettingsArr;
+ public:
+ OutlineSettings_Impl() :
+ bIsCustomized(false),
+ pNumSettingsArr(nullptr)
+ {}
+};
+
+class SVX_DLLPUBLIC NBOTypeMgrBase
+{
+ private:
+ const SfxItemSet* pSet;
+ MapUnit eCoreUnit;
+ // store the attributes passed from pSet
+ OUString aBulletCharFmtName;
+ OUString aNumCharFmtName;
+ bool bIsLoading;
+
+ NBOTypeMgrBase(const NBOTypeMgrBase&) = delete;
+
+ public:
+ NBOTypeMgrBase()
+ : pSet(nullptr)
+ , eCoreUnit(MapUnit::MapTwip)
+ , bIsLoading(false)
+ {}
+ virtual ~NBOTypeMgrBase() {}
+ virtual void Init()=0;
+ virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0) = 0;
+ virtual void RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) = 0;
+ virtual void ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false,bool isResetSize=false) = 0;
+ virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault)=0;
+ virtual bool IsCustomized(sal_uInt16 nIndex)=0;
+ static sal_uInt16 IsSingleLevel(sal_uInt16 nCurLevel);
+ // store the attributes passed from pSet
+ void SetItems(const SfxItemSet* pArg);
+ protected:
+ const OUString& GetBulletCharFmtName() const { return aBulletCharFmtName;}
+ const OUString& GetNumCharFmtName() const { return aNumCharFmtName;}
+ MapUnit GetMapUnit() const { return eCoreUnit;}
+ protected:
+ void ImplLoad(std::u16string_view filename);
+ void ImplStore(std::u16string_view filename);
+
+};
+
+
+class BulletsTypeMgr final : public NBOTypeMgrBase
+{
+ friend class OutlineTypeMgr;
+ friend class NumberingTypeMgr;
+ private:
+ BulletsTypeMgr(const BulletsTypeMgr&) = delete;
+ public:
+ static sal_Unicode aDynamicBulletTypes[DEFAULT_BULLET_TYPES];
+ static sal_Unicode aDynamicRTLBulletTypes[DEFAULT_BULLET_TYPES];
+ static BulletsSettings* pActualBullets[DEFAULT_BULLET_TYPES];
+ public:
+ BulletsTypeMgr();
+ virtual void Init() override;
+ virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0) override;
+ virtual void RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override;
+ virtual void ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false,bool isResetSize=false) override;
+ virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override;
+ virtual bool IsCustomized(sal_uInt16 nIndex) override;
+ static BulletsTypeMgr& GetInstance();
+};
+
+
+class NumberingTypeMgr final : public NBOTypeMgrBase
+{
+ private:
+ NumberingTypeMgr(const NumberingTypeMgr&) = delete;
+ public:
+ NumberSettingsArr_Impl maNumberSettingsArr;
+ NumberSettingsArr_Impl maDefaultNumberSettingsArr;
+ public:
+ NumberingTypeMgr();
+ virtual ~NumberingTypeMgr() override;
+ virtual void Init() override;
+ virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0) override;
+ virtual void RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override;
+ virtual void ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false,bool isResetSize=false) override;
+ virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override;
+ virtual bool IsCustomized(sal_uInt16 nIndex) override;
+ static NumberingTypeMgr& GetInstance();
+};
+
+class OutlineTypeMgr final : public NBOTypeMgrBase
+{
+ private:
+ OutlineTypeMgr(const OutlineTypeMgr&) = delete;
+ public:
+ OutlineSettings_Impl* pOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT];
+ OutlineSettings_Impl* pDefaultOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT];
+ public:
+ OutlineTypeMgr();
+ virtual void Init() override;
+ virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0) override;
+ virtual void RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override;
+ virtual void ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false,bool isResetSize=false) override;
+ virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override;
+ virtual bool IsCustomized(sal_uInt16 nIndex) override;
+ static OutlineTypeMgr& GetInstance();
+};
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/nbdtmgfact.hxx b/include/svx/nbdtmgfact.hxx
new file mode 100644
index 000000000..5b7ff5bf4
--- /dev/null
+++ b/include/svx/nbdtmgfact.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_NBDTMGFACT_HXX
+#define INCLUDED_SVX_NBDTMGFACT_HXX
+
+#include <svx/nbdtmg.hxx>
+
+namespace svx::sidebar::NBOutlineTypeMgrFact
+{
+SVX_DLLPUBLIC NBOTypeMgrBase* CreateInstance(const NBOType aType);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/numfmtsh.hxx b/include/svx/numfmtsh.hxx
new file mode 100644
index 000000000..360a067e0
--- /dev/null
+++ b/include/svx/numfmtsh.hxx
@@ -0,0 +1,229 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_NUMFMTSH_HXX
+#define INCLUDED_SVX_NUMFMTSH_HXX
+
+#include <i18nlangtag/lang.h>
+
+#include <svx/svxdllapi.h>
+
+#include <svl/zforlist.hxx>
+
+#include <vector>
+
+class Color;
+class SvNumberFormatter;
+
+enum class SvxNumberValueType
+{
+ Undefined,
+ Number,
+ String
+};
+
+// sort order of the category ListBox entries in the TabPage
+#define CAT_ALL 0
+#define CAT_USERDEFINED 1
+#define CAT_NUMBER 2
+#define CAT_PERCENT 3
+#define CAT_CURRENCY 4
+#define CAT_DATE 5
+#define CAT_TIME 6
+#define CAT_SCIENTIFIC 7
+#define CAT_FRACTION 8
+#define CAT_BOOLEAN 9
+#define CAT_TEXT 10
+
+#define SELPOS_NONE -1
+
+#define NUMBERFORMAT_ENTRY_NEW_CURRENCY NUMBERFORMAT_ENTRY_NOT_FOUND-1
+
+
+class SVX_DLLPUBLIC SvxNumberFormatShell
+{
+public:
+ SvxNumberFormatShell( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ const OUString& rNumStr );
+
+ SvxNumberFormatShell( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ double nNumVal,
+ const OUString* pNumStr );
+
+ ~SvxNumberFormatShell();
+
+
+ static SvxNumberFormatShell* Create( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ const OUString& rNumStr );
+
+ static SvxNumberFormatShell* Create( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ double nNumVal,
+ const OUString* pNumStr );
+
+
+ void GetInitSettings( sal_uInt16& nCatLbPos,
+ LanguageType& rLangType,
+ sal_uInt16& nFmtLbSelPos,
+ std::vector<OUString>& rFmtEntries,
+ OUString& rPrevString,
+ const Color*& rpPrevColor );
+
+ void CategoryChanged( sal_uInt16 nCatLbPos,
+ short& rFmtSelPos,
+ std::vector<OUString>& rFmtEntries );
+
+ void LanguageChanged( LanguageType eLangType,
+ short& rFmtSelPos,
+ std::vector<OUString>& rFmtEntries );
+
+ void FormatChanged( sal_uInt16 nFmtLbPos,
+ OUString& rPreviewStr,
+ const Color*& rpFontColor );
+
+ bool AddFormat( OUString& rFormat,
+ sal_Int32& rErrPos,
+ sal_uInt16& rCatLbSelPos,
+ short& rFmtSelPos,
+ std::vector<OUString>& rFmtEntries );
+
+ void RemoveFormat( std::u16string_view rFormat,
+ sal_uInt16& rCatLbSelPos,
+ short& rFmtSelPos,
+ std::vector<OUString>& rFmtEntries );
+
+ void MakeFormat( OUString& rFormat,
+ bool bThousand,
+ bool bNegRed,
+ sal_uInt16 nPrecision,
+ sal_uInt16 nLeadingZeroes,
+ sal_uInt16 nCurrencyEntryPos);
+
+ void GetOptions( const OUString& rFormat,
+ bool& rThousand,
+ bool& rNegRed,
+ sal_uInt16& rPrecision,
+ sal_uInt16& rLeadingZeroes,
+ sal_uInt16& rCatLbPos );
+
+ sal_uInt16 GetFormatIntegerDigits( std::u16string_view rFormat ) const;
+
+ void MakePreviewString( const OUString& rFormatStr,
+ OUString& rPreviewStr,
+ const Color*& rpFontColor );
+
+ void MakePrevStringFromVal( const OUString& rFormatStr,
+ OUString& rPreviewStr,
+ const Color*& rpFontColor,
+ double nValue);
+
+ bool IsUserDefined( const OUString& rFmtString );
+ bool IsTmpCurrencyFormat( const OUString& rFmtString );
+ bool FindEntry( const OUString& rFmtString, sal_uInt32* pAt = nullptr );
+
+ void ValidateNewEntries() { bUndoAddList = false; }
+ std::vector<sal_uInt32> const & GetUpdateData() const;
+
+ void SetCurNumFmtKey( sal_uInt32 nNew ) { nCurFormatKey = nNew; }
+ sal_uInt32 GetCurNumFmtKey() const { return nCurFormatKey; }
+ LanguageType GetCurLanguage() const { return eCurLanguage; }
+
+ /** Returns the name of Standard, General, ... for the
+ current language. */
+ OUString GetStandardName() const;
+
+ OUString GetComment4Entry(short nEntry);
+ short GetCategory4Entry(short nEntry) const;
+ bool GetUserDefined4Entry(short nEntry);
+ OUString GetFormat4Entry(short nEntry);
+ void SetComment4Entry(short nEntry, const OUString& aCommentString);
+
+ void SetCurrencySymbol(sal_uInt32 nPos);
+ sal_uInt32 GetCurrencySymbol() const { return nCurCurrencyEntryPos;}
+ sal_uInt16 FindCurrencyFormat( const OUString& rFmtString );
+ sal_uInt16 FindCurrencyFormat(const NfCurrencyEntry* pTmpCurrencyEntry,bool bTmpBanking);
+ void SetCurCurrencyEntry(NfCurrencyEntry*);
+ short GetListPos4Entry( sal_uInt32 nIdx, std::u16string_view rFmtString );
+
+ void GetCurrencySymbols(std::vector<OUString>& rList, sal_uInt16* pPos );
+
+ sal_uInt16 FindCurrencyTableEntry( const OUString& rFmtString, bool &bTestBanking );
+ bool IsInTable(sal_uInt16 nPos, bool bTmpBanking,
+ std::u16string_view rFmtString) const;
+
+ void SetUseStarFormat( bool bUse ) { bUseStarFormat = bUse; }
+private:
+ SvNumberFormatter* pFormatter;
+ SvNumberFormatTable* pCurFmtTable;
+ SvxNumberValueType eValType;
+ OUString aValStr;
+ double nValNum;
+ bool bUndoAddList;
+ std::vector<sal_uInt32> aAddList;
+ std::vector<sal_uInt32> aDelList;
+ std::vector<sal_uInt32> aCurEntryList;
+ sal_uInt32 nCurFormatKey;
+ SvNumFormatType nCurCategory;
+ LanguageType eCurLanguage;
+ std::vector<sal_uInt16> aCurCurrencyList;
+ NfCurrencyEntry* pCurCurrencyEntry;
+ bool bBankingSymbol;
+ sal_uInt32 nCurCurrencyEntryPos;
+ std::vector<OUString> aCurrencyFormatList;
+ bool bUseStarFormat;
+ bool bIsDefaultValNum;
+
+ SVX_DLLPRIVATE short FillEntryList_Impl( std::vector<OUString>& rList );
+ SVX_DLLPRIVATE void FillEListWithStd_Impl( std::vector<OUString>& rList, SvNumFormatType eCategory, short &Pos,
+ bool bSuppressDuplicates = false );
+ SVX_DLLPRIVATE short FillEListWithFormats_Impl( std::vector<OUString>& rList,short nSelPos,
+ NfIndexTableOffset eOffsetStart,
+ NfIndexTableOffset eOffsetEnd,
+ bool bSuppressDuplicates );
+ SVX_DLLPRIVATE short FillEListWithDateTime_Impl( std::vector<OUString>& rList,short nSelPos,
+ bool bSuppressDuplicates );
+ SVX_DLLPRIVATE void FillEListWithOneFormat_Impl( std::vector<OUString>& rList, short & nSelPos,
+ bool bSuppressDuplicates, NfIndexTableOffset nOffset,
+ bool bSuppressIsoDateTime );
+ SVX_DLLPRIVATE short FillEListWithCurrency_Impl( std::vector<OUString>& rList,short nSelPos);
+ SVX_DLLPRIVATE short FillEListWithSysCurrencys( std::vector<OUString>& rList,short nSelPos);
+ SVX_DLLPRIVATE short FillEListWithUserCurrencys( std::vector<OUString>& rList,short nSelPos);
+ SVX_DLLPRIVATE short FillEListWithUsD_Impl( std::vector<OUString>& rList, SvNumFormatType eCategory, short Pos );
+
+ SVX_DLLPRIVATE bool IsEssentialFormat_Impl( SvNumFormatType eType, sal_uInt32 nKey );
+
+ SVX_DLLPRIVATE ::std::vector<sal_uInt32>::iterator GetRemoved_Impl( size_t nKey );
+ SVX_DLLPRIVATE bool IsRemoved_Impl( size_t nKey );
+ SVX_DLLPRIVATE ::std::vector<sal_uInt32>::iterator GetAdded_Impl( size_t nKey );
+
+ SVX_DLLPRIVATE void GetPreviewString_Impl( OUString& rString,
+ const Color*& rpColor );
+ SVX_DLLPRIVATE static void PosToCategory_Impl(sal_uInt16 nPos, SvNumFormatType& rCategory);
+ SVX_DLLPRIVATE static void CategoryToPos_Impl(SvNumFormatType nCategory, sal_uInt16& rPos);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/numinf.hxx b/include/svx/numinf.hxx
new file mode 100644
index 000000000..4d4b07478
--- /dev/null
+++ b/include/svx/numinf.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_NUMINF_HXX
+#define INCLUDED_SVX_NUMINF_HXX
+
+#include <svl/poolitem.hxx>
+#include <svx/numfmtsh.hxx>
+#include <svx/svxdllapi.h>
+
+/** This item is used as a transport medium for a number formatter
+ */
+
+class SVX_DLLPUBLIC SvxNumberInfoItem final : public SfxPoolItem
+{
+public:
+
+ SvxNumberInfoItem( const TypedWhichId<SvxNumberInfoItem> nId );
+ SvxNumberInfoItem( SvNumberFormatter* pNumFormatter,
+ const TypedWhichId<SvxNumberInfoItem> nId );
+ SvxNumberInfoItem( SvNumberFormatter* pNumFormatter, const OUString& rVal,
+ const TypedWhichId<SvxNumberInfoItem> nId );
+ SvxNumberInfoItem( SvNumberFormatter* pNumFormatter, const double& rVal,
+ const TypedWhichId<SvxNumberInfoItem> nId );
+ // if both double and String are supplied, String is used for text formats
+ SvxNumberInfoItem( SvNumberFormatter* pNumFormatter, const double& rVal,
+ const OUString& rValueStr, const TypedWhichId<SvxNumberInfoItem> nId );
+ SvxNumberInfoItem( const SvxNumberInfoItem& );
+ virtual ~SvxNumberInfoItem() override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxNumberInfoItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ SvNumberFormatter* GetNumberFormatter() const { return pFormatter; }
+ const OUString& GetValueString() const { return aStringVal; }
+ double GetValueDouble() const { return nDoubleVal; }
+
+ const std::vector<sal_uInt32> & GetDelFormats() const { return mvDelFormats; }
+ void SetDelFormats( std::vector<sal_uInt32> && );
+
+ SvxNumberValueType GetValueType() const { return eValueType; }
+
+private:
+ SvNumberFormatter* pFormatter;
+ SvxNumberValueType eValueType;
+ OUString aStringVal;
+ double nDoubleVal;
+
+ std::vector<sal_uInt32> mvDelFormats;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/numvset.hxx b/include/svx/numvset.hxx
new file mode 100644
index 000000000..059d6b7bc
--- /dev/null
+++ b/include/svx/numvset.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_NUMVSET_HXX
+#define INCLUDED_SVX_NUMVSET_HXX
+
+#include <vcl/idle.hxx>
+#include <svtools/valueset.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/lang/Locale.hpp>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star {
+ namespace container{
+ class XIndexAccess;
+ }
+ namespace beans{
+ struct PropertyValue;
+ }
+ namespace text{
+ class XNumberingFormatter;
+ }
+}
+
+enum class NumberingPageType
+{
+ BULLET,
+ SINGLENUM,
+ OUTLINE,
+ BITMAP
+};
+
+class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet
+{
+ NumberingPageType ePageType;
+ tools::Rectangle aOrgRect;
+ VclPtr<VirtualDevice> pVDev;
+
+ css::uno::Reference<css::text::XNumberingFormatter> xFormatter;
+ css::lang::Locale aLocale;
+
+ css::uno::Sequence<
+ css::uno::Sequence<
+ css::beans::PropertyValue> > aNumSettings;
+
+ css::uno::Sequence<
+ css::uno::Reference<
+ css::container::XIndexAccess> > aOutlineSettings;
+
+public:
+ SvxNumValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow);
+ void init(NumberingPageType eType);
+ virtual ~SvxNumValueSet() override;
+
+ virtual void UserDraw( const UserDrawEvent& rUDEvt ) override;
+
+ void SetNumberingSettings(
+ const css::uno::Sequence<
+ css::uno::Sequence<css::beans::PropertyValue> >& aNum,
+ css::uno::Reference<css::text::XNumberingFormatter> const & xFormatter,
+ const css::lang::Locale& rLocale );
+
+ void SetOutlineNumberingSettings(
+ css::uno::Sequence<
+ css::uno::Reference<css::container::XIndexAccess> > const & rOutline,
+ css::uno::Reference<css::text::XNumberingFormatter> const & xFormatter,
+ const css::lang::Locale& rLocale);
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+};
+
+
+class SVX_DLLPUBLIC SvxBmpNumValueSet final : public SvxNumValueSet
+{
+ Idle aFormatIdle;
+ bool bGrfNotFound;
+
+ DECL_DLLPRIVATE_LINK(FormatHdl_Impl, Timer *, void);
+
+public:
+ SvxBmpNumValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow);
+ void init();
+ virtual ~SvxBmpNumValueSet() override;
+
+ virtual void UserDraw( const UserDrawEvent& rUDEvt ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx
new file mode 100644
index 000000000..29feec983
--- /dev/null
+++ b/include/svx/obj3d.hxx
@@ -0,0 +1,188 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_OBJ3D_HXX
+#define INCLUDED_SVX_OBJ3D_HXX
+
+#include <svx/svdoattr.hxx>
+#include <svx/svdobj.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/range/b3drange.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <svx/svxdllapi.h>
+
+// Forward declarations
+class E3dScene;
+
+namespace sdr::properties {
+ class BaseProperties;
+ class E3dCompoundProperties;
+ class E3dExtrudeProperties;
+ class E3dLatheProperties;
+ class E3dSphereProperties;
+}
+
+/*************************************************************************
+|*
+|* GeoData relevant for undo actions
+|*
+\************************************************************************/
+
+class E3DObjGeoData : public SdrObjGeoData
+{
+public:
+ basegfx::B3DRange maLocalBoundVol; // surrounding volume of the object
+ basegfx::B3DHomMatrix maTransformation; // local transformations
+
+ E3DObjGeoData() {}
+};
+
+/*************************************************************************
+|*
+|* Base class for 3D objects
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC E3dObject : public SdrAttrObj
+{
+private:
+ // Allow everything for E3dObjList and E3dDragMethod
+ friend class E3dDragMethod;
+
+ protected:
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+
+ basegfx::B3DRange maLocalBoundVol; // surrounding volume of the object (from the geometry generation)
+ basegfx::B3DHomMatrix maTransformation; // local transformation
+ basegfx::B3DHomMatrix maFullTransform; // global transformation (including. parents)
+
+ // Flags
+ bool mbTfHasChanged : 1;
+ bool mbIsSelected : 1;
+
+protected:
+ virtual basegfx::B3DRange RecalcBoundVolume() const;
+
+ // E3dObject is only a helper class (for E3DScene and E3DCompoundObject)
+ // and no instances should be created from anyone, so i move the constructors
+ // to protected area
+ E3dObject(SdrModel& rSdrModel);
+ E3dObject(SdrModel& rSdrModel, E3dObject const & rSource);
+
+ // protected destructor
+ virtual ~E3dObject() override;
+
+public:
+ virtual void StructureChanged();
+ virtual void SetTransformChanged();
+ virtual void RecalcSnapRect() override;
+
+ virtual SdrInventor GetObjInventor() const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual void NbcMove(const Size& rSize) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+
+ E3dScene* getParentE3dSceneFromE3dObject() const;
+ virtual E3dScene* getRootE3dSceneFromE3dObject() const;
+
+ const basegfx::B3DRange& GetBoundVolume() const;
+ void InvalidateBoundVolume();
+
+ // calculate complete transformation including all parents
+ const basegfx::B3DHomMatrix& GetFullTransform() const;
+
+ // get and (re)set transformation matrix
+ const basegfx::B3DHomMatrix& GetTransform() const { return maTransformation;}
+ virtual void NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix);
+ virtual void SetTransform(const basegfx::B3DHomMatrix& rMatrix);
+
+ // 2D rotations, are implemented as a rotation around the Z axis
+ // which is vertical to the screen, plus a shift of the scene.
+ // This means that also the scene (E3dScene) must define this
+ // routine as virtual in its class.
+ virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
+
+ // get wireframe polygon for local object. No transform is applied.
+ basegfx::B3DPolyPolygon CreateWireframe() const;
+
+ // TakeObjName...() is for the display in the UI, for example "3 frames selected".
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+ virtual E3dObject* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+
+ // get/set the selection
+ bool GetSelected() const { return mbIsSelected; }
+ virtual void SetSelected(bool bNew);
+
+ // break up
+ virtual bool IsBreakObjPossible();
+ virtual std::unique_ptr<SdrAttrObj,SdrObjectFreeOp> GetBreakObj();
+};
+
+/*************************************************************************
+|*
+|* Class for all compound objects (Cube, Lathe, Scene, Extrude)
+|* This class saves some ISA queries and accelerates the behaviour
+|* significantly, because all the attributes etc. are kept through this.
+|* The polygons may only keep attributes if they are directly
+|* subordinated to the scene.
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC E3dCompoundObject : public E3dObject
+{
+private:
+ // to allow sdr::properties::E3dCompoundProperties access to SetGeometryValid()
+ friend class sdr::properties::E3dCompoundProperties;
+ friend class sdr::properties::E3dExtrudeProperties;
+ friend class sdr::properties::E3dLatheProperties;
+ friend class sdr::properties::E3dSphereProperties;
+
+protected:
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+
+protected:
+ // convert given basegfx::B3DPolyPolygon to screen coor
+ basegfx::B2DPolyPolygon TransformToScreenCoor(const basegfx::B3DPolyPolygon& rCandidate) const;
+
+ // protected destructor
+ virtual ~E3dCompoundObject() override;
+
+public:
+ E3dCompoundObject(SdrModel& rSdrModel, E3dCompoundObject const & rSource);
+ E3dCompoundObject(SdrModel& rSdrModel);
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual void RecalcSnapRect() override;
+
+ virtual E3dCompoundObject* CloneSdrObject(SdrModel& rTargetModel) const override;
+};
+
+#endif // INCLUDED_SVX_OBJ3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/objfac3d.hxx b/include/svx/objfac3d.hxx
new file mode 100644
index 000000000..24b14de5a
--- /dev/null
+++ b/include/svx/objfac3d.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_OBJFAC3D_HXX
+#define INCLUDED_SVX_OBJFAC3D_HXX
+
+#include <svx/svxdllapi.h>
+#include <tools/link.hxx>
+
+/*************************************************************************
+|*
+|* Factory for chart-specific objects
+|*
+\************************************************************************/
+
+class SdrObject;
+struct SdrObjCreatorParams;
+
+class SVXCORE_DLLPUBLIC E3dObjFactory
+{
+public:
+ E3dObjFactory();
+
+ DECL_DLLPRIVATE_STATIC_LINK(E3dObjFactory, MakeObject, SdrObjCreatorParams, SdrObject*);
+};
+
+#endif // INCLUDED_SVX_OBJFAC3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ofaitem.hxx b/include/svx/ofaitem.hxx
new file mode 100644
index 000000000..5e9e52b92
--- /dev/null
+++ b/include/svx/ofaitem.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_OFAITEM_HXX
+#define INCLUDED_SVX_OFAITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <rtl/ref.hxx>
+#include <svx/svxdllapi.h>
+
+class SVX_DLLPUBLIC OfaPtrItem final : public SfxPoolItem
+{
+private:
+ void* pPtr;
+
+public:
+ OfaPtrItem( sal_uInt16 nWhich, void *pPtr );
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual OfaPtrItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ void* GetValue() const { return pPtr; }
+};
+
+class XColorList;
+class SVX_DLLPUBLIC OfaXColorListItem final : public SfxPoolItem
+{
+ private:
+ rtl::Reference<XColorList> mxRef;
+public:
+ OfaXColorListItem( sal_uInt16 _nWhich, const rtl::Reference<XColorList> &xRef );
+
+ virtual bool operator==( const SfxPoolItem& rItem ) const override;
+
+ virtual OfaXColorListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/optgenrl.hxx b/include/svx/optgenrl.hxx
new file mode 100644
index 000000000..2ee463d9d
--- /dev/null
+++ b/include/svx/optgenrl.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_OPTGENRL_HXX
+#define INCLUDED_SVX_OPTGENRL_HXX
+
+// Defines for setting the focus of an Edit via a slot from external.
+enum class EditPosition
+{
+ UNKNOWN = 0,
+ COMPANY = 1,
+ FIRSTNAME = 2,
+ LASTNAME = 3,
+ STREET = 4,
+ COUNTRY = 5,
+ PLZ = 6,
+ CITY = 7,
+ STATE = 8,
+ TITLE = 9,
+ POSITION = 10,
+ SHORTNAME = 11,
+ TELPRIV = 12,
+ TELCOMPANY = 13,
+ FAX = 14,
+ EMAIL = 15,
+};
+
+#endif // INCLUDED_SVX_OPTGENRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/optgrid.hxx b/include/svx/optgrid.hxx
new file mode 100644
index 000000000..97ec7a228
--- /dev/null
+++ b/include/svx/optgrid.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_OPTGRID_HXX
+#define INCLUDED_SVX_OPTGRID_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <svx/svxdllapi.h>
+
+namespace weld { class CheckButton; }
+namespace weld { class MetricSpinButton; }
+namespace weld { class SpinButton; }
+namespace weld { class ToggleButton; }
+namespace weld { class Widget; }
+
+class SVX_DLLPUBLIC SvxOptionsGrid
+{
+protected:
+ sal_uInt32 nFldDrawX;
+ sal_uInt32 nFldDivisionX;
+ sal_uInt32 nFldDrawY;
+ sal_uInt32 nFldDivisionY;
+ sal_uInt32 nFldSnapX;
+ sal_uInt32 nFldSnapY;
+ bool bUseGridsnap:1;
+ bool bSynchronize:1;
+ bool bGridVisible:1;
+ bool bEqualGrid: 1;
+
+public:
+ SvxOptionsGrid();
+
+ void SetFieldDrawX( sal_uInt32 nSet){nFldDrawX = nSet;}
+ void SetFieldDivisionX(sal_uInt32 nSet){nFldDivisionX = nSet;}
+ void SetFieldDrawY ( sal_uInt32 nSet){nFldDrawY = nSet;}
+ void SetFieldDivisionY(sal_uInt32 nSet){nFldDivisionY = nSet;}
+ void SetFieldSnapX( sal_uInt32 nSet){nFldSnapX = nSet;}
+ void SetFieldSnapY ( sal_uInt32 nSet){nFldSnapY = nSet;}
+ void SetUseGridSnap( bool bSet ) {bUseGridsnap = bSet;}
+ void SetSynchronize( bool bSet ) {bSynchronize = bSet;}
+ void SetGridVisible( bool bSet ) {bGridVisible = bSet;}
+ void SetEqualGrid( bool bSet ) {bEqualGrid = bSet;}
+
+ sal_uInt32 GetFieldDrawX( ) const { return nFldDrawX; }
+ sal_uInt32 GetFieldDivisionX() const { return nFldDivisionX;}
+ sal_uInt32 GetFieldDrawY ( ) const { return nFldDrawY; }
+ sal_uInt32 GetFieldDivisionY() const { return nFldDivisionY;}
+ sal_uInt32 GetFieldSnapX( ) const { return nFldSnapX; }
+ sal_uInt32 GetFieldSnapY ( ) const { return nFldSnapY; }
+ bool GetUseGridSnap( ) const { return bUseGridsnap; }
+ bool GetSynchronize( ) const { return bSynchronize; }
+ bool GetGridVisible( ) const { return bGridVisible; }
+ bool GetEqualGrid() const { return bEqualGrid; }
+};
+
+class SVX_DLLPUBLIC SvxGridItem : public SvxOptionsGrid, public SfxPoolItem
+{
+ // #i9076#
+ friend class SvxGridTabPage;
+
+public:
+ SvxGridItem( TypedWhichId<SvxGridItem> _nWhich) : SfxPoolItem(_nWhich){};
+
+ virtual SvxGridItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+};
+
+class SVX_DLLPUBLIC SvxGridTabPage : public SfxTabPage
+{
+public:
+ SvxGridTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
+ virtual ~SvxGridTabPage() override;
+
+ static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet);
+
+ virtual bool FillItemSet( SfxItemSet* rSet ) override;
+ virtual void Reset( const SfxItemSet* rSet ) override;
+
+ virtual void ActivatePage( const SfxItemSet& rSet ) override;
+ virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
+
+private:
+ bool bAttrModified;
+
+ std::unique_ptr<weld::CheckButton> m_xCbxUseGridsnap;
+ std::unique_ptr<weld::CheckButton> m_xCbxGridVisible;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawX;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawY;
+ std::unique_ptr<weld::SpinButton> m_xNumFldDivisionX;
+ std::unique_ptr<weld::SpinButton> m_xNumFldDivisionY;
+ std::unique_ptr<weld::CheckButton> m_xCbxSynchronize;
+protected:
+ //these controls are used in draw and impress
+ std::unique_ptr<weld::Widget> m_xSnapFrames;
+ std::unique_ptr<weld::CheckButton> m_xCbxSnapHelplines;
+ std::unique_ptr<weld::CheckButton> m_xCbxSnapBorder;
+ std::unique_ptr<weld::CheckButton> m_xCbxSnapFrame;
+ std::unique_ptr<weld::CheckButton> m_xCbxSnapPoints;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldSnapArea;
+ std::unique_ptr<weld::CheckButton> m_xCbxOrtho;
+ std::unique_ptr<weld::CheckButton> m_xCbxBigOrtho;
+ std::unique_ptr<weld::CheckButton> m_xCbxRotate;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldAngle;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldBezAngle;
+
+ DECL_LINK(ClickRotateHdl_Impl, weld::Toggleable&, void);
+private:
+ DECL_DLLPRIVATE_LINK(ChangeDrawHdl_Impl, weld::MetricSpinButton&, void);
+ DECL_DLLPRIVATE_LINK(ChangeGridsnapHdl_Impl, weld::Toggleable&, void);
+ DECL_DLLPRIVATE_LINK(ChangeDivisionHdl_Impl, weld::SpinButton&, void);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/pagectrl.hxx b/include/svx/pagectrl.hxx
new file mode 100644
index 000000000..07186afdd
--- /dev/null
+++ b/include/svx/pagectrl.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_PAGECTRL_HXX
+#define INCLUDED_SVX_PAGECTRL_HXX
+
+#include <vcl/customweld.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
+
+enum class SvxPageUsage;
+enum class SvxFrameDirection;
+
+class SVX_DLLPUBLIC SvxPageWindow : public weld::CustomWidgetController
+{
+private:
+ Size aWinSize;
+ Size aSize;
+
+ tools::Long nTop;
+ tools::Long nBottom;
+ tools::Long nLeft;
+ tools::Long nRight;
+
+ bool bResetBackground;
+ bool bFrameDirection;
+ SvxFrameDirection nFrameDirection;
+
+ tools::Long nHdLeft;
+ tools::Long nHdRight;
+ tools::Long nHdDist;
+ tools::Long nHdHeight;
+
+ tools::Long nFtLeft;
+ tools::Long nFtRight;
+ tools::Long nFtDist;
+ tools::Long nFtHeight;
+
+ drawinglayer::attribute::SdrAllFillAttributesHelperPtr maHeaderFillAttributes;
+ drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFooterFillAttributes;
+ drawinglayer::attribute::SdrAllFillAttributesHelperPtr maPageFillAttributes;
+
+ bool bFooter : 1;
+ bool bHeader : 1;
+ bool bTable : 1;
+ bool bHorz : 1;
+ bool bVert : 1;
+
+ SvxPageUsage eUsage;
+
+protected:
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+
+ virtual void DrawPage(vcl::RenderContext& rRenderContext, const Point& rPoint,
+ const bool bSecond, const bool bEnabled);
+
+ static void drawFillAttributes(vcl::RenderContext& rRenderContext,
+ const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
+ const tools::Rectangle& rPaintRange, const tools::Rectangle& rDefineRange);
+
+public:
+ SvxPageWindow();
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual ~SvxPageWindow() override;
+
+ void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
+ {
+ maHeaderFillAttributes = rFillAttributes;
+ }
+ void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
+ {
+ maFooterFillAttributes = rFillAttributes;
+ }
+ void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
+ {
+ maPageFillAttributes = rFillAttributes;
+ }
+ const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& getPageFillAttributes() const
+ {
+ return maPageFillAttributes;
+ }
+ void SetSize(const Size& rSize)
+ {
+ aSize = rSize;
+ }
+ const Size& GetSize() const
+ {
+ return aSize;
+ }
+
+ void SetTop(tools::Long nNew) { nTop = nNew; }
+ void SetBottom(tools::Long nNew) { nBottom = nNew; }
+ void SetLeft(tools::Long nNew) { nLeft = nNew; }
+ void SetRight(tools::Long nNew) { nRight = nNew; }
+
+ tools::Long GetTop() const { return nTop; }
+ tools::Long GetBottom() const { return nBottom; }
+ tools::Long GetLeft() const { return nLeft; }
+ tools::Long GetRight() const { return nRight; }
+
+ void SetHdLeft(tools::Long nNew) { nHdLeft = nNew; }
+ void SetHdRight(tools::Long nNew) { nHdRight = nNew; }
+ void SetHdDist(tools::Long nNew) { nHdDist = nNew; }
+ void SetHdHeight(tools::Long nNew) { nHdHeight = nNew; }
+
+ tools::Long GetHdLeft() const { return nHdLeft; }
+ tools::Long GetHdRight() const { return nHdRight; }
+ tools::Long GetHdDist() const { return nHdDist; }
+ tools::Long GetHdHeight() const { return nHdHeight; }
+
+ void SetFtLeft(tools::Long nNew) { nFtLeft = nNew; }
+ void SetFtRight(tools::Long nNew) { nFtRight = nNew; }
+ void SetFtDist(tools::Long nNew) { nFtDist = nNew; }
+ void SetFtHeight(tools::Long nNew) { nFtHeight = nNew; }
+
+ tools::Long GetFtLeft() const { return nFtLeft; }
+ tools::Long GetFtRight() const { return nFtRight; }
+ tools::Long GetFtDist() const { return nFtDist; }
+ tools::Long GetFtHeight() const { return nFtHeight; }
+
+ void SetUsage(SvxPageUsage eU) { eUsage = eU; }
+ SvxPageUsage GetUsage() const { return eUsage; }
+
+ void SetHeader( bool bNew ) { bHeader = bNew; }
+ void SetFooter( bool bNew ) { bFooter = bNew; }
+ void SetTable( bool bNew ) { bTable = bNew; }
+ void SetHorz( bool bNew ) { bHorz = bNew; }
+ void SetVert( bool bNew ) { bVert = bNew; }
+
+ void EnableFrameDirection(bool bEnable);
+ void SetFrameDirection(SvxFrameDirection nDirection);
+
+ void ResetBackground();
+};
+
+#endif // INCLUDED_SVX_PAGECTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/pageitem.hxx b/include/svx/pageitem.hxx
new file mode 100644
index 000000000..32702fe80
--- /dev/null
+++ b/include/svx/pageitem.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_PAGEITEM_HXX
+#define INCLUDED_SVX_PAGEITEM_HXX
+
+#include <sal/config.h>
+
+#include <svl/setitem.hxx>
+#include <svx/svxdllapi.h>
+#include <editeng/svxenum.hxx>
+
+/*--------------------------------------------------------------------
+ usage of the page
+ --------------------------------------------------------------------*/
+
+enum class SvxPageUsage
+{
+ NONE = 0,
+ Left = 1,
+ Right = 2,
+ All = 3,
+ Mirror = 7
+};
+
+/*--------------------------------------------------------------------
+ parts of the page description
+ --------------------------------------------------------------------*/
+
+/*
+This item describes a page attribute (name of the template, enumeration,
+portrait or landscape, layout)
+*/
+
+class SVX_DLLPUBLIC SvxPageItem final : public SfxPoolItem
+{
+private:
+ OUString aDescName; // name of the template
+ SvxNumType eNumType;
+ bool bLandscape; // Portrait / Landscape
+ SvxPageUsage eUse; // Layout
+
+public:
+
+ static SfxPoolItem* CreateDefault();
+ SvxPageItem( const TypedWhichId<SvxPageItem> nId );
+ SvxPageItem( const SvxPageItem& rItem );
+
+ virtual ~SvxPageItem() override;
+
+ virtual SvxPageItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ // orientation
+ SvxPageUsage GetPageUsage() const { return eUse; }
+ void SetPageUsage(SvxPageUsage eU) { eUse= eU; }
+
+ bool IsLandscape() const { return bLandscape; }
+ void SetLandscape(bool bL) { bLandscape = bL; }
+
+ // enumeration
+ SvxNumType GetNumType() const { return eNumType; }
+ void SetNumType(SvxNumType eNum) { eNumType = eNum; }
+
+ // name of the descriptor
+ void SetDescName(const OUString& rStr) { aDescName = rStr; }
+};
+
+
+/*--------------------------------------------------------------------
+ container for header/footer attributes
+ --------------------------------------------------------------------*/
+
+class SVX_DLLPUBLIC SvxSetItem final : public SfxSetItem
+{
+public:
+ SvxSetItem( const TypedWhichId<SvxSetItem> nId, const SfxItemSet& rSet );
+ SvxSetItem( const SvxSetItem& rItem );
+ SvxSetItem( const TypedWhichId<SvxSetItem> nId, SfxItemSet&& pSet );
+
+ virtual SvxSetItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/pagenumberlistbox.hxx b/include/svx/pagenumberlistbox.hxx
new file mode 100644
index 000000000..9885d9822
--- /dev/null
+++ b/include/svx/pagenumberlistbox.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_PAGENUMBERINGHELPER_HXX
+#define INCLUDED_SVX_PAGENUMBERINGHELPER_HXX
+
+#include <editeng/svxenum.hxx>
+#include <svx/svxdllapi.h>
+#include <vcl/weld.hxx>
+
+class SVXCORE_DLLPUBLIC SvxPageNumberListBox
+{
+private:
+ std::unique_ptr<weld::ComboBox> m_xControl;
+public:
+ SvxPageNumberListBox(std::unique_ptr<weld::ComboBox> pControl);
+ SvxNumType get_active_id() const { return static_cast<SvxNumType>(m_xControl->get_active_id().toInt32()); }
+ void set_active_id(SvxNumType eId) const { m_xControl->set_active_id(OUString::number(static_cast<sal_Int32>(eId))); }
+ void save_value() { m_xControl->save_value(); }
+ bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); }
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
+ weld::ComboBox& get_widget() const { return *m_xControl; }
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/papersizelistbox.hxx b/include/svx/papersizelistbox.hxx
new file mode 100644
index 000000000..589dccda3
--- /dev/null
+++ b/include/svx/papersizelistbox.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_PAGESIZEHELPER_HXX
+#define INCLUDED_SVX_PAGESIZEHELPER_HXX
+
+#include <i18nutil/paper.hxx>
+#include <svx/svxdllapi.h>
+#include <vcl/weld.hxx>
+
+enum class PaperSizeApp
+{
+ Std,
+ Draw
+};
+
+class SVXCORE_DLLPUBLIC SvxPaperSizeListBox
+{
+private:
+ std::unique_ptr<weld::ComboBox> m_xControl;
+
+public:
+ SvxPaperSizeListBox(std::unique_ptr<weld::ComboBox> pControl);
+
+ void FillPaperSizeEntries(PaperSizeApp eApp);
+ void set_active_id(Paper eSize);
+ Paper get_active_id() const;
+
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink)
+ {
+ m_xControl->connect_changed(rLink);
+ }
+ int get_active() const { return m_xControl->get_active(); }
+ void clear() { m_xControl->clear(); }
+ void save_value() { return m_xControl->save_value(); }
+ bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); }
+
+ weld::ComboBox& get_widget() const { return *m_xControl; }
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/paraprev.hxx b/include/svx/paraprev.hxx
new file mode 100644
index 000000000..bb6607318
--- /dev/null
+++ b/include/svx/paraprev.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_PARAPREV_HXX
+#define INCLUDED_SVX_PARAPREV_HXX
+
+#include <vcl/customweld.hxx>
+#include <editeng/svxenum.hxx>
+#include <svx/svxdllapi.h>
+
+enum class SvxPrevLineSpace
+{
+ N1 = 0,
+ N115,
+ N15,
+ N2,
+ Prop,
+ Min,
+ Leading
+};
+
+class SVX_DLLPUBLIC SvxParaPrevWindow final : public weld::CustomWidgetController
+{
+ Size aSize;
+
+ // indentation
+ tools::Long nLeftMargin;
+ tools::Long nRightMargin;
+ short nFirstLineOffset;
+ // distances
+ sal_uInt16 nUpper;
+ sal_uInt16 nLower;
+ // adjustment
+ SvxAdjust eAdjust;
+ // last line in justification
+ SvxAdjust eLastLine;
+ // line distance
+ SvxPrevLineSpace eLine;
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ void DrawParagraph(vcl::RenderContext& rRenderContext);
+
+public:
+ SvxParaPrevWindow();
+
+ void SetFirstLineOffset( short nNew )
+ {
+ nFirstLineOffset = nNew;
+ }
+ void SetLeftMargin( tools::Long nNew )
+ {
+ nLeftMargin = nNew;
+ }
+ void SetRightMargin( tools::Long nNew )
+ {
+ nRightMargin = nNew;
+ }
+ void SetUpper( sal_uInt16 nNew )
+ {
+ nUpper = nNew;
+ }
+ void SetLower( sal_uInt16 nNew )
+ {
+ nLower = nNew;
+ }
+ void SetAdjust( SvxAdjust eNew )
+ {
+ eAdjust = eNew;
+ }
+ void SetLastLine( SvxAdjust eNew )
+ {
+ eLastLine = eNew;
+ }
+ void SetLineSpace( SvxPrevLineSpace eNew )
+ {
+ eLine = eNew;
+ }
+ void SetSize( Size aNew )
+ {
+ aSize = aNew;
+ }
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/passwd.hxx b/include/svx/passwd.hxx
new file mode 100644
index 000000000..c6342df0d
--- /dev/null
+++ b/include/svx/passwd.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_PASSWD_HXX
+#define INCLUDED_SVX_PASSWD_HXX
+
+#include <config_options.h>
+#include <sfx2/basedlgs.hxx>
+#include <svx/svxdllapi.h>
+
+class UNLESS_MERGELIBS(SVX_DLLPUBLIC) SvxPasswordDialog final : public SfxDialogController
+{
+private:
+ OUString m_aOldPasswdErrStr;
+ OUString m_aRepeatPasswdErrStr;
+ Link<SvxPasswordDialog*,bool> m_aCheckPasswordHdl;
+
+ std::unique_ptr<weld::Label> m_xOldFL;
+ std::unique_ptr<weld::Label> m_xOldPasswdFT;
+ std::unique_ptr<weld::Entry> m_xOldPasswdED;
+ std::unique_ptr<weld::Entry> m_xNewPasswdED;
+ std::unique_ptr<weld::Entry> m_xRepeatPasswdED;
+ std::unique_ptr<weld::Button> m_xOKBtn;
+
+ DECL_DLLPRIVATE_LINK(ButtonHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(EditModifyHdl, weld::Entry&, void);
+
+public:
+ SvxPasswordDialog(weld::Window* pParent, bool bDisableOldPassword);
+ virtual ~SvxPasswordDialog() override;
+
+ OUString GetOldPassword() const { return m_xOldPasswdED->get_text(); }
+ OUString GetNewPassword() const { return m_xNewPasswdED->get_text(); }
+
+ void SetCheckPasswordHdl( const Link<SvxPasswordDialog*,bool>& rLink ) { m_aCheckPasswordHdl = rLink; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/polypolygoneditor.hxx b/include/svx/polypolygoneditor.hxx
new file mode 100644
index 000000000..57110b414
--- /dev/null
+++ b/include/svx/polypolygoneditor.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_POLYPOLYGONEDITOR_HXX
+#define INCLUDED_SVX_POLYPOLYGONEDITOR_HXX
+
+#include <svx/svxdllapi.h>
+
+#include <svx/ipolypolygoneditorcontroller.hxx>
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <o3tl/sorted_vector.hxx>
+
+namespace sdr
+{
+
+/** this class implements some helper functions to edit a B2DPolyPolygon */
+class SVXCORE_DLLPUBLIC PolyPolygonEditor
+{
+public:
+ PolyPolygonEditor( const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+ const basegfx::B2DPolyPolygon& GetPolyPolygon() const { return maPolyPolygon; }
+
+ /** returns true if the B2DPolyPolygon was changed.
+ Warning: B2DPolyPolygon can be empty after this operation!
+ */
+ bool DeletePoints( const o3tl::sorted_vector< sal_uInt16 >& rAbsPoints );
+
+ /** returns true if the B2DPolyPolygon was changed.
+ */
+ bool SetSegmentsKind(SdrPathSegmentKind eKind, const o3tl::sorted_vector< sal_uInt16 >& rAbsPoints);
+
+ /** returns true if the B2DPolyPolygon was changed.
+ */
+ bool SetPointsSmooth( basegfx::B2VectorContinuity eFlags, const o3tl::sorted_vector< sal_uInt16 >& rAbsPoints);
+
+ /** Outputs the relative position ( polygon number and point number in that polygon ) from the absolute point number.
+ False is returned if the given absolute point is greater not inside this B2DPolyPolygon
+ */
+ static bool GetRelativePolyPoint( const basegfx::B2DPolyPolygon& rPoly, sal_uInt32 nAbsPnt, sal_uInt32& rPolyNum, sal_uInt32& rPointNum );
+
+private:
+ basegfx::B2DPolyPolygon maPolyPolygon;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/postattr.hxx b/include/svx/postattr.hxx
new file mode 100644
index 000000000..af980a3e5
--- /dev/null
+++ b/include/svx/postattr.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_POSTATTR_HXX
+#define INCLUDED_SVX_POSTATTR_HXX
+
+#include <svl/stritem.hxx>
+#include <svx/svxdllapi.h>
+
+/** The author shorthand symbol of a note
+ */
+
+class SVX_DLLPUBLIC SvxPostItAuthorItem final : public SfxStringItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxPostItAuthorItem( TypedWhichId<SvxPostItAuthorItem> nWhich );
+
+ SvxPostItAuthorItem( const OUString& rAuthor, TypedWhichId<SvxPostItAuthorItem> nWhich );
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxPostItAuthorItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+};
+
+
+/** The date of a note
+ */
+
+class SVX_DLLPUBLIC SvxPostItDateItem final : public SfxStringItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxPostItDateItem( TypedWhichId<SvxPostItDateItem> nWhich );
+
+ SvxPostItDateItem( const OUString& rDate, TypedWhichId<SvxPostItDateItem> nWhich );
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxPostItDateItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+};
+
+/** The text of a note
+ */
+
+class SVX_DLLPUBLIC SvxPostItTextItem final : public SfxStringItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxPostItTextItem( TypedWhichId<SvxPostItTextItem> nWhich );
+
+ SvxPostItTextItem( const OUString& rText, TypedWhichId<SvxPostItTextItem> nWhich );
+ // "pure virtual methods" from SfxPoolItem
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxPostItTextItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+};
+
+
+/** The internal id of a note
+ */
+
+class SVX_DLLPUBLIC SvxPostItIdItem final : public SfxStringItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxPostItIdItem( TypedWhichId<SvxPostItIdItem> nWhich );
+
+ virtual SvxPostItIdItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/pszctrl.hxx b/include/svx/pszctrl.hxx
new file mode 100644
index 000000000..e22b18096
--- /dev/null
+++ b/include/svx/pszctrl.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_PSZCTRL_HXX
+#define INCLUDED_SVX_PSZCTRL_HXX
+
+#include <memory>
+#include <sfx2/stbitem.hxx>
+#include <svx/svxdllapi.h>
+
+struct SvxPosSizeStatusBarControl_Impl;
+
+class SVX_DLLPUBLIC SvxPosSizeStatusBarControl final : public SfxStatusBarControl
+{
+private:
+ std::unique_ptr<SvxPosSizeStatusBarControl_Impl> pImpl;
+ SVX_DLLPRIVATE OUString GetMetricStr_Impl( tools::Long nVal ) const;
+public:
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxPosSizeStatusBarControl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb );
+ virtual ~SvxPosSizeStatusBarControl() override;
+
+ virtual void StateChangedAtStatusBarControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
+ virtual void Paint( const UserDrawEvent& rEvt ) override;
+ virtual void Command( const CommandEvent& rCEvt ) override;
+private:
+ void ImplUpdateItemText();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/rectenum.hxx b/include/svx/rectenum.hxx
new file mode 100644
index 000000000..5a67dfbbb
--- /dev/null
+++ b/include/svx/rectenum.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_RECTENUM_HXX
+#define INCLUDED_SVX_RECTENUM_HXX
+
+enum class RectPoint
+{
+ LT, // top left
+ MT, // top center
+ RT, // top right
+ LM, // left center
+ MM, // center
+ RM, // right center
+ LB, // bottom left
+ MB, // bottom center
+ RB // bottom right
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/relfld.hxx b/include/svx/relfld.hxx
new file mode 100644
index 000000000..8bc4c0558
--- /dev/null
+++ b/include/svx/relfld.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_RELFLD_HXX
+#define INCLUDED_SVX_RELFLD_HXX
+
+#include <tools/fldunit.hxx>
+#include <svtools/unitconv.hxx>
+#include <vcl/weld.hxx>
+#include <svx/svxdllapi.h>
+
+class SVX_DLLPUBLIC SvxRelativeField
+{
+private:
+ std::unique_ptr<weld::MetricSpinButton> m_xSpinButton;
+
+ sal_uInt16 nRelMin;
+ sal_uInt16 nRelMax;
+ bool bRelativeMode;
+ bool bRelative;
+ bool bNegativeEnabled;
+
+ DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
+
+public:
+ SvxRelativeField(std::unique_ptr<weld::MetricSpinButton> pControl);
+
+ void EnableRelativeMode( sal_uInt16 nMin, sal_uInt16 nMax );
+ void SetRelative( bool bRelative );
+ bool IsRelative() const { return bRelative; }
+ void EnableNegativeMode() {bNegativeEnabled = true;}
+
+ void set_sensitive(bool sensitive) { m_xSpinButton->set_sensitive(sensitive); }
+ void set_value(int nValue, FieldUnit eValueUnit) { m_xSpinButton->set_value(nValue, eValueUnit); }
+ int get_value(FieldUnit eDestUnit) const { return m_xSpinButton->get_value(eDestUnit); }
+ int get_min(FieldUnit eValueUnit) const { return m_xSpinButton->get_min(eValueUnit); }
+ void set_min(int min, FieldUnit eValueUnit) { m_xSpinButton->set_min(min, eValueUnit); }
+ void set_max(int max, FieldUnit eValueUnit) { m_xSpinButton->set_max(max, eValueUnit); }
+ int normalize(int nValue) const { return m_xSpinButton->normalize(nValue); }
+ int denormalize(int nValue) const { return m_xSpinButton->denormalize(nValue); }
+ void connect_value_changed(const Link<weld::MetricSpinButton&, void>& rLink) { m_xSpinButton->connect_value_changed(rLink); }
+ OUString get_text() const { return m_xSpinButton->get_text(); }
+ void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
+ void save_value() { m_xSpinButton->save_value(); }
+ bool get_value_changed_from_saved() const { return m_xSpinButton->get_value_changed_from_saved(); }
+ weld::SpinButton& get_widget() { return m_xSpinButton->get_widget(); }
+
+ int GetCoreValue(MapUnit eUnit) const { return ::GetCoreValue(*m_xSpinButton, eUnit); }
+ void SetFieldUnit(FieldUnit eUnit, bool bAll = false) { ::SetFieldUnit(*m_xSpinButton, eUnit, bAll); }
+ void SetMetricValue(int lCoreValue, MapUnit eUnit) { ::SetMetricValue(*m_xSpinButton, lCoreValue, eUnit); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/rotmodit.hxx b/include/svx/rotmodit.hxx
new file mode 100644
index 000000000..fa8510e50
--- /dev/null
+++ b/include/svx/rotmodit.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ROTMODIT_HXX
+#define INCLUDED_SVX_ROTMODIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+
+// Alignment with rotated text
+
+enum SvxRotateMode
+{
+ SVX_ROTATE_MODE_STANDARD,
+ SVX_ROTATE_MODE_TOP,
+ SVX_ROTATE_MODE_CENTER,
+ SVX_ROTATE_MODE_BOTTOM
+};
+
+class SVX_DLLPUBLIC SvxRotateModeItem final : public SfxEnumItem<SvxRotateMode>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxRotateModeItem( SvxRotateMode eMode, TypedWhichId<SvxRotateModeItem> nWhich);
+ SvxRotateModeItem( const SvxRotateModeItem& rItem );
+ virtual ~SvxRotateModeItem() override;
+
+ virtual sal_uInt16 GetValueCount() const override;
+ virtual SvxRotateModeItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString& rText, const IntlWrapper& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+private:
+ static OUString GetValueText(SvxRotateMode nVal);
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/rubydialog.hxx b/include/svx/rubydialog.hxx
new file mode 100644
index 000000000..12593c73f
--- /dev/null
+++ b/include/svx/rubydialog.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_SVX_RUBYDIALOG_HXX
+#define INCLUDED_SVX_RUBYDIALOG_HXX
+
+#include <sfx2/childwin.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <vcl/customweld.hxx>
+#include <svx/svxdllapi.h>
+#include <rtl/ref.hxx>
+
+class SvxRubyDialog;
+class RubyPreview final : public weld::CustomWidgetController
+{
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ SvxRubyDialog* m_pParentDlg;
+
+public:
+ RubyPreview();
+ virtual ~RubyPreview() override;
+ void setRubyDialog(SvxRubyDialog* pParentDlg)
+ {
+ m_pParentDlg = pParentDlg;
+ }
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+};
+
+class SVX_DLLPUBLIC SvxRubyChildWindow final : public SfxChildWindow
+{
+public:
+ SvxRubyChildWindow( vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo const * );
+ SFX_DECL_CHILDWINDOW( SvxRubyChildWindow );
+};
+
+class SvxRubyData_Impl;
+
+class SvxRubyDialog final : public SfxModelessDialogController
+{
+ friend class RubyPreview;
+
+
+ tools::Long nLastPos;
+ tools::Long nCurrentEdit;
+ bool bModified;
+ SfxBindings* pBindings;
+ rtl::Reference<SvxRubyData_Impl> m_pImpl;
+ weld::Entry* aEditArr[8];
+
+ std::unique_ptr<weld::Label> m_xLeftFT;
+ std::unique_ptr<weld::Label> m_xRightFT;
+ std::unique_ptr<weld::Entry> m_xLeft1ED;
+ std::unique_ptr<weld::Entry> m_xRight1ED;
+ std::unique_ptr<weld::Entry> m_xLeft2ED;
+ std::unique_ptr<weld::Entry> m_xRight2ED;
+ std::unique_ptr<weld::Entry> m_xLeft3ED;
+ std::unique_ptr<weld::Entry> m_xRight3ED;
+ std::unique_ptr<weld::Entry> m_xLeft4ED;
+ std::unique_ptr<weld::Entry> m_xRight4ED;
+
+ std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
+
+ std::unique_ptr<weld::ComboBox> m_xAdjustLB;
+
+ std::unique_ptr<weld::ComboBox> m_xPositionLB;
+
+ std::unique_ptr<weld::Label> m_xCharStyleFT;
+ std::unique_ptr<weld::ComboBox> m_xCharStyleLB;
+ std::unique_ptr<weld::Button> m_xStylistPB;
+
+ std::unique_ptr<weld::Button> m_xApplyPB;
+ std::unique_ptr<weld::Button> m_xClosePB;
+
+ std::unique_ptr<weld::Container> m_xContentArea;
+ std::unique_ptr<weld::Widget> m_xGrid;
+
+ std::unique_ptr<RubyPreview> m_xPreviewWin;
+ std::unique_ptr<weld::CustomWeld> m_xPreview;
+
+ DECL_LINK(ApplyHdl_Impl, weld::Button&, void);
+ DECL_LINK(CloseHdl_Impl, weld::Button&, void);
+ DECL_LINK(StylistHdl_Impl, weld::Button&, void);
+ DECL_LINK(ScrollHdl_Impl, weld::ScrolledWindow&, void);
+ DECL_LINK(PositionHdl_Impl, weld::ComboBox&, void);
+ DECL_LINK(AdjustHdl_Impl, weld::ComboBox&, void);
+ DECL_LINK(CharStyleHdl_Impl, weld::ComboBox&, void);
+ DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
+ DECL_LINK(EditFocusHdl_Impl, weld::Widget&, void);
+ DECL_LINK(KeyUpDownHdl_Impl, const KeyEvent&, bool);
+ DECL_LINK(KeyUpDownTabHdl_Impl, const KeyEvent&, bool);
+
+ bool EditScrollHdl_Impl(sal_Int32 nParam);
+ bool EditJumpHdl_Impl(sal_Int32 nParam);
+
+ void SetRubyText(sal_Int32 nPos, weld::Entry& rLeft, weld::Entry& rRight);
+ void GetRubyText();
+ void ClearCharStyleList();
+ void AssertOneEntry();
+
+ void Update();
+ virtual void Close() override;
+
+ tools::Long GetLastPos() const {return nLastPos;}
+ void SetLastPos(tools::Long nSet) {nLastPos = nSet;}
+
+ bool IsModified() const {return bModified;}
+ void SetModified(bool bSet) {bModified = bSet;}
+
+ void EnableControls(bool bEnable);
+
+ void GetCurrentText(OUString& rBase, OUString& rRuby);
+
+public:
+ SvxRubyDialog(SfxBindings *pBindings, SfxChildWindow *pCW, weld::Window* pParent);
+ virtual ~SvxRubyDialog() override;
+
+ virtual void Activate() override;
+};
+
+#endif // INCLUDED_SVX_RUBYDIALOG_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ruler.hxx b/include/svx/ruler.hxx
new file mode 100644
index 000000000..58b9e0a5c
--- /dev/null
+++ b/include/svx/ruler.hxx
@@ -0,0 +1,286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_RULER_HXX
+#define INCLUDED_SVX_RULER_HXX
+
+#include <svtools/ruler.hxx>
+#include <svl/lstner.hxx>
+#include <svx/svxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <memory>
+
+class Menu;
+class SvxProtectItem;
+class SvxRulerItem;
+class SfxBindings;
+class SvxLongLRSpaceItem;
+class SvxLongULSpaceItem;
+class SvxTabStopItem;
+class SvxLRSpaceItem;
+class SvxPagePosSizeItem;
+class SvxColumnItem;
+class SfxRectangleItem;
+class SvxObjectItem;
+class SfxBoolItem;
+struct SvxRuler_Impl;
+
+enum class RulerChangeType
+{
+ MARGIN1,
+ MARGIN2
+};
+
+enum class SvxRulerDragFlags
+{
+ NONE = 0x00,
+ OBJECT = 0x01,
+ // reduce size of the last column, shift
+ OBJECT_SIZE_LINEAR = 0x02,
+ OBJECT_SIZE_PROPORTIONAL = 0x04, // proportional, Ctrl
+ // only current line (table; Shift-Ctrl)
+ OBJECT_ACTLINE_ONLY = 0x08,
+ // currently same key assignment
+ OBJECT_LEFT_INDENT_ONLY = OBJECT_SIZE_PROPORTIONAL,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvxRulerDragFlags> : is_typed_flags<SvxRulerDragFlags, 0x0f> {};
+}
+
+enum class SvxRulerSupportFlags
+{
+ TABS = 0x0001,
+ PARAGRAPH_MARGINS = 0x0002,
+ BORDERS = 0x0004,
+ OBJECT = 0x0008,
+ SET_NULLOFFSET = 0x0010,
+ NEGATIVE_MARGINS = 0x0020,
+ PARAGRAPH_MARGINS_VERTICAL = 0x0040,
+ REDUCED_METRIC = 0x0080, //shorten the context menu to select metric
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvxRulerSupportFlags> : is_typed_flags<SvxRulerSupportFlags, 0x00ff> {};
+}
+
+class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
+{
+ friend class SvxRulerItem;
+
+ std::vector<std::unique_ptr<SvxRulerItem> > pCtrlItems;
+
+ std::unique_ptr<SvxLongLRSpaceItem> mxLRSpaceItem; // left and right edge
+ std::unique_ptr<SfxRectangleItem> mxMinMaxItem; // maxima for dragging
+ std::unique_ptr<SvxLongULSpaceItem> mxULSpaceItem; // upper and lower edge
+ std::unique_ptr<SvxTabStopItem> mxTabStopItem; // tab stops
+ std::unique_ptr<SvxLRSpaceItem> mxParaItem; // paragraphs
+ std::unique_ptr<SvxLRSpaceItem> mxBorderItem; // border distance
+ std::unique_ptr<SvxPagePosSizeItem> mxPagePosItem; // page distance to the rule
+ std::unique_ptr<SvxColumnItem> mxColumnItem; // columns
+ std::unique_ptr<SvxObjectItem> mxObjectItem; // object
+
+ VclPtr<vcl::Window> pEditWin;
+
+ std::unique_ptr<SvxRuler_Impl> mxRulerImpl;
+
+ bool bAppSetNullOffset :1;
+ bool bHorz :1;
+ tools::Long lLogicNullOffset; // in logic coordinates
+ tools::Long lAppNullOffset; // in logic coordinates
+ tools::Long lInitialDragPos;
+ SvxRulerSupportFlags nFlags;
+ SvxRulerDragFlags nDragType;
+ sal_uInt16 nDefTabType;
+ sal_uInt16 nTabCount;
+ sal_uInt16 nTabBufSize;
+ tools::Long lDefTabDist;
+ tools::Long lTabPos;
+
+ std::vector<RulerTab> mpTabs; // tab positions in pixel
+ std::vector<RulerIndent> mpIndents; // paragraph margins in pixel
+ std::vector<RulerBorder> mpBorders;
+ std::vector<RulerBorder> mpObjectBorders;
+
+ SfxBindings* pBindings;
+ tools::Long nDragOffset;
+ tools::Long nMaxLeft;
+ tools::Long nMaxRight;
+ bool bValid;
+ bool bListening;
+ bool bActive;
+
+ bool mbCoarseSnapping;
+ bool mbSnapping;
+
+ void StartListening_Impl();
+ tools::Long GetCorrectedDragPos(bool bLeft = true, bool bRight = true );
+ void DrawLine_Impl(tools::Long &lTabPos, int, bool Horizontal);
+ sal_uInt16 GetObjectBordersOff(sal_uInt16 nIdx) const;
+
+ // page borders or surrounding frame
+ void UpdateFrame(const SvxLongLRSpaceItem* pItem);
+ void UpdateFrame(const SvxLongULSpaceItem* pItem);
+ void UpdateFrameMinMax(const SfxRectangleItem* pItem);
+ // paragraph indentations
+ void UpdatePara(const SvxLRSpaceItem* pItem);
+ // Border distance
+ void UpdateBorder(const SvxLRSpaceItem* pItem);
+ // Tabs
+ void Update(const SvxTabStopItem* pItem);
+ // page position and width
+ void Update(const SvxPagePosSizeItem* pItem);
+ // columns
+ void Update(const SvxColumnItem* pItem, sal_uInt16 nSID);
+ // object selection
+ void Update(const SvxObjectItem* pItem);
+ // protect
+ void Update(const SvxProtectItem* pItem );
+ // left-to-right text
+ void UpdateTextRTL(const SfxBoolItem* pItem);
+ // paragraph indentations
+ void UpdatePara();
+ void UpdateTabs();
+ void UpdatePage();
+ void UpdateFrame();
+ void UpdateColumns();
+ void UpdateObject();
+
+ // Convert position to stick to ruler ticks
+ tools::Long MakePositionSticky(tools::Long rValue, tools::Long aPointOfReference, bool aSnapToFrameMargin = true) const;
+
+ tools::Long PixelHAdjust(tools::Long lPos, tools::Long lPos2) const;
+ tools::Long PixelVAdjust(tools::Long lPos, tools::Long lPos2) const;
+ tools::Long PixelAdjust(tools::Long lPos, tools::Long lPos2) const;
+
+ tools::Long ConvertHPosPixel(tools::Long lPos) const;
+ tools::Long ConvertVPosPixel(tools::Long lPos) const;
+ tools::Long ConvertHSizePixel(tools::Long lSize) const;
+ tools::Long ConvertVSizePixel(tools::Long lSize) const;
+
+ tools::Long ConvertPosPixel(tools::Long lPos) const;
+ tools::Long ConvertSizePixel(tools::Long lSize) const;
+
+ tools::Long ConvertHPosLogic(tools::Long lPos) const;
+ tools::Long ConvertVPosLogic(tools::Long lPos) const;
+ tools::Long ConvertHSizeLogic(tools::Long lSize) const;
+ tools::Long ConvertVSizeLogic(tools::Long lSize) const;
+
+ tools::Long ConvertPosLogic(tools::Long lPos) const;
+ tools::Long ConvertSizeLogic(tools::Long lSize) const;
+
+ tools::Long RoundToCurrentMapMode(tools::Long lValue) const;
+
+ tools::Long GetFirstLineIndent() const;
+ tools::Long GetLeftIndent() const;
+ tools::Long GetRightIndent() const;
+ tools::Long GetLogicRightIndent() const;
+
+ tools::Long GetLeftFrameMargin() const;
+ tools::Long GetRightFrameMargin() const;
+
+ void CalcMinMax();
+
+ void EvalModifier();
+ void DragMargin1();
+ //adjust the left margin either after DragMargin1() or after DragBorders()
+ void AdjustMargin1(tools::Long lDiff);
+ void DragMargin2();
+ void DragIndents();
+ void DragTabs();
+ void DragBorders();
+ void DragObjectBorder();
+
+ void ApplyMargins();
+ void ApplyIndents();
+ void ApplyTabs();
+ void ApplyBorders();
+ void ApplyObject();
+
+ tools::Long GetFrameLeft() const;
+
+ tools::Long GetLeftMin() const;
+ tools::Long GetRightMax() const;
+
+ void TabMenuSelect(std::string_view rIdent);
+ void MenuSelect(std::string_view ident);
+ void PrepareProportional_Impl(RulerType);
+
+ enum class UpdateType
+ {
+ MoveLeft,
+ MoveRight
+ };
+ void UpdateParaContents_Impl(tools::Long lDiff, UpdateType);
+
+protected:
+ virtual void Command( const CommandEvent& rCEvt ) override;
+ virtual void Click() override;
+ virtual bool StartDrag() override;
+ virtual void Drag() override;
+ virtual void EndDrag() override;
+ virtual void ExtraDown() override;
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+
+ virtual void Update();
+
+ bool IsActLastColumn(
+ bool bForceDontConsiderHidden = false,
+ sal_uInt16 nAct=USHRT_MAX) const;
+ bool IsActFirstColumn(
+ bool bForceDontConsiderHidden = false,
+ sal_uInt16 nAct=USHRT_MAX) const;
+ sal_uInt16 GetActLeftColumn(
+ bool bForceDontConsiderHidden = false,
+ sal_uInt16 nAct=USHRT_MAX ) const;
+ sal_uInt16 GetActRightColumn (
+ bool bForceDontConsiderHidden = false,
+ sal_uInt16 nAct=USHRT_MAX ) const;
+ tools::Long CalcPropMaxRight(sal_uInt16 nCol = USHRT_MAX) const;
+
+public:
+
+ SvxRuler(vcl::Window* pParent, vcl::Window *pEditWin, SvxRulerSupportFlags nRulerFlags,
+ SfxBindings &rBindings, WinBits nWinStyle);
+ virtual ~SvxRuler() override;
+ virtual void dispose() override;
+
+ void SetDefTabDist(tools::Long);
+
+ // set/get NullOffset in logic units
+ void SetNullOffsetLogic(tools::Long lOff);
+
+ void SetActive(bool bOn = true);
+
+ void ForceUpdate()
+ {
+ Update();
+ }
+
+ //#i24363# tab stops relative to indent
+ void SetTabsRelativeToIndent( bool bRel );
+ void SetValues(RulerChangeType type, tools::Long value);
+ tools::Long GetPageWidth() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/rulritem.hxx b/include/svx/rulritem.hxx
new file mode 100644
index 000000000..b45683d31
--- /dev/null
+++ b/include/svx/rulritem.hxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_RULRITEM_HXX
+#define INCLUDED_SVX_RULRITEM_HXX
+
+#include <tools/gen.hxx>
+#include <svl/poolitem.hxx>
+#include <svx/svxdllapi.h>
+#include <vector>
+
+class SVX_DLLPUBLIC SvxLongLRSpaceItem final : public SfxPoolItem
+{
+ tools::Long mlLeft; // nLeft or the negative first-line indentation
+ tools::Long mlRight; // the unproblematic right edge
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ const SvxLongLRSpaceItem& operator=(const SvxLongLRSpaceItem &) = delete;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SvxLongLRSpaceItem(tools::Long lLeft, tools::Long lRight, TypedWhichId<SvxLongLRSpaceItem> nId);
+ SvxLongLRSpaceItem();
+ SvxLongLRSpaceItem(SvxLongLRSpaceItem const &) = default;
+
+ virtual SvxLongLRSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ tools::Long GetLeft() const { return mlLeft;}
+ tools::Long GetRight() const { return mlRight;}
+ void SetLeft(tools::Long lArgLeft);
+ void SetRight(tools::Long lArgRight);
+};
+
+class SVX_DLLPUBLIC SvxLongULSpaceItem final : public SfxPoolItem
+{
+ tools::Long mlLeft; // nLeft or the negative first-line indentation
+ tools::Long mlRight; // the unproblematic right edge
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ const SvxLongULSpaceItem& operator=(const SvxLongULSpaceItem &) = delete;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SvxLongULSpaceItem(tools::Long lUpper, tools::Long lLower, TypedWhichId<SvxLongULSpaceItem> nId);
+ SvxLongULSpaceItem();
+ SvxLongULSpaceItem(SvxLongULSpaceItem const &) = default;
+
+ virtual SvxLongULSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ tools::Long GetUpper() const { return mlLeft;}
+ tools::Long GetLower() const { return mlRight;}
+ void SetUpper(tools::Long lArgLeft);
+ void SetLower(tools::Long lArgRight);
+};
+
+class SVX_DLLPUBLIC SvxPagePosSizeItem final : public SfxPoolItem
+{
+ Point aPos;
+ tools::Long lWidth;
+ tools::Long lHeight;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxPagePosSizeItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+private:
+ const SvxPagePosSizeItem& operator=(const SvxPagePosSizeItem &) = delete;
+public:
+ static SfxPoolItem* CreateDefault();
+ SvxPagePosSizeItem(const Point &rPos, tools::Long lWidth, tools::Long lHeight);
+ SvxPagePosSizeItem();
+ SvxPagePosSizeItem(SvxPagePosSizeItem const &) = default;
+
+ const Point &GetPos() const { return aPos; }
+ tools::Long GetWidth() const { return lWidth; }
+ tools::Long GetHeight() const { return lHeight; }
+};
+
+struct SVX_DLLPUBLIC SvxColumnDescription
+{
+ tools::Long nStart; /* Start of the column */
+ tools::Long nEnd; /* End of the column */
+ bool bVisible; /* Visibility */
+
+ tools::Long nEndMin; //min. possible position of end
+ tools::Long nEndMax; //max. possible position of end
+
+ SvxColumnDescription(tools::Long start, tools::Long end, bool bVis);
+
+ SvxColumnDescription(tools::Long start, tools::Long end,
+ tools::Long endMin, tools::Long endMax, bool bVis);
+
+ bool operator==(const SvxColumnDescription &rCmp) const;
+ bool operator!=(const SvxColumnDescription &rCmp) const;
+ tools::Long GetWidth() const;
+};
+
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, SvxColumnDescription const& dsc)
+{
+ return stream << "{ nStart " << dsc.nStart << " nEnd " << dsc.nEnd
+ << " bVisible " << dsc.bVisible << " nEndMin " << dsc.nEndMin
+ << " nEndMax " << dsc.nEndMax << " }";
+}
+
+
+class SVX_DLLPUBLIC SvxColumnItem final : public SfxPoolItem
+{
+ std::vector<SvxColumnDescription> aColumns; // Column array
+
+ tools::Long nLeft; // Left edge for the table
+ tools::Long nRight; // Right edge for the table; for columns always
+ // equal to the surrounding frame
+ sal_uInt16 nActColumn; // the current column
+ bool bTable; // table?
+ bool bOrtho; // evenly spread columns
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual SvxColumnItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ // right edge of the surrounding frame
+ // nLeft, nRight each the distance to the surrounding frame
+ SvxColumnItem(sal_uInt16 nAct = 0);
+ SvxColumnItem(sal_uInt16 nActCol, sal_uInt16 nLeft, sal_uInt16 nRight); // Table with borders
+
+ SvxColumnDescription& operator[](sal_uInt16 index);
+ const SvxColumnDescription& operator[](sal_uInt16 index) const;
+ SvxColumnDescription& At(sal_uInt16 index);
+ SvxColumnDescription& GetActiveColumnDescription();
+
+ sal_uInt16 Count() const;
+ void Append(const SvxColumnDescription& rDesc);
+ void SetLeft(tools::Long aLeft);
+ void SetRight(tools::Long aRight);
+ sal_uInt16 GetActColumn() const { return nActColumn;}
+ bool IsFirstAct() const;
+ bool IsLastAct() const;
+ tools::Long GetLeft() const { return nLeft;}
+ tools::Long GetRight() const { return nRight;}
+ bool IsTable() const { return bTable;}
+ bool CalcOrtho() const;
+ void SetOrtho(bool bVal);
+ bool IsConsistent() const;
+};
+
+class SVX_DLLPUBLIC SvxObjectItem final : public SfxPoolItem
+{
+ tools::Long nStartX; /* Start in x direction */
+ tools::Long nEndX; /* End in x direction */
+ tools::Long nStartY; /* Start in y direction */
+ tools::Long nEndY; /* End in y direction */
+ bool bLimits; /* boundary limit control by the application */
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual SvxObjectItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ const SvxObjectItem &operator=(const SvxObjectItem &) = delete;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SvxObjectItem(tools::Long nStartX, tools::Long nEndX,
+ tools::Long nStartY, tools::Long nEndY);
+ SvxObjectItem(SvxObjectItem const &) = default;
+
+ tools::Long GetStartX() const { return nStartX;}
+ tools::Long GetEndX() const { return nEndX;}
+ tools::Long GetStartY() const { return nStartY;}
+ tools::Long GetEndY() const { return nEndY;}
+
+ void SetStartX(tools::Long lValue);
+ void SetEndX(tools::Long lValue);
+ void SetStartY(tools::Long lValue);
+ void SetEndY(tools::Long lValue);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/samecontentlistbox.hxx b/include/svx/samecontentlistbox.hxx
new file mode 100644
index 000000000..f3553d43e
--- /dev/null
+++ b/include/svx/samecontentlistbox.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SAMECONTENTLISTBOXHELPER_HXX
+#define INCLUDED_SVX_SAMECONTENTLISTBOXHELPER_HXX
+
+#include <svx/svxdllapi.h>
+#include <vcl/weld.hxx>
+
+namespace SameContentListBox
+{
+void SVXCORE_DLLPUBLIC Fill(weld::ComboBox& rComboBox);
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx
new file mode 100644
index 000000000..8903e3bd4
--- /dev/null
+++ b/include/svx/scene3d.hxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SCENE3D_HXX
+#define INCLUDED_SVX_SCENE3D_HXX
+
+#include <svx/camera3d.hxx>
+#include <tools/b3dtrans.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/obj3d.hxx>
+#include <svx/svx3ditems.hxx>
+#include <memory>
+
+namespace sdr::properties {
+ class BaseProperties;
+}
+
+/*************************************************************************
+|*
+|* GeoData relevant for undo actions
+|*
+\************************************************************************/
+
+class E3DSceneGeoData final : public E3DObjGeoData
+{
+public:
+ Camera3D aCamera;
+
+ E3DSceneGeoData() {}
+};
+
+class Imp3DDepthRemapper;
+
+/*************************************************************************
+|*
+|* base class for 3D scenes
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC E3dScene final : public E3dObject, public SdrObjList
+{
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+
+ // transformations
+ B3dCamera aCameraSet;
+ Camera3D aCamera;
+
+ mutable std::unique_ptr<Imp3DDepthRemapper> mp3DDepthRemapper;
+
+ // Flag to determine if only selected objects should be drawn
+ bool bDrawOnlySelected : 1;
+
+ bool mbSkipSettingDirty : 1;
+
+ void RebuildLists();
+
+ virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override;
+
+ void SetDefaultAttributes();
+ void ImpCleanup3DDepthMapper();
+
+ // protected destructor
+ virtual ~E3dScene() override;
+
+public:
+ E3dScene(SdrModel& rSdrModel);
+ E3dScene(SdrModel& rSdrModel, E3dScene const &);
+
+ virtual void StructureChanged() override;
+
+ // derived from SdrObjList
+ virtual SdrPage* getSdrPageFromSdrObjList() const override;
+ virtual SdrObject* getSdrObjectFromSdrObjList() const override;
+
+ // derived from SdrObject
+ virtual SdrObjList* getChildrenOfSdrObject() const override;
+
+ virtual void SetBoundRectDirty() override;
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+
+ sal_uInt32 RemapOrdNum(sal_uInt32 nOrdNum) const;
+
+ // Perspective: enum ProjectionType { ProjectionType::Parallel, ProjectionType::Perspective }
+ ProjectionType GetPerspective() const
+ { return static_cast<ProjectionType>(GetObjectItemSet().Get(SDRATTR_3DSCENE_PERSPECTIVE).GetValue()); }
+
+ // Distance:
+ double GetDistance() const
+ { return static_cast<double>(GetObjectItemSet().Get(SDRATTR_3DSCENE_DISTANCE).GetValue()); }
+
+ // Focal length: before cm, now 1/10th mm (*100)
+ double GetFocalLength() const
+ { return GetObjectItemSet().Get(SDRATTR_3DSCENE_FOCAL_LENGTH).GetValue(); }
+
+ // set flag to draw only selected
+ void SetDrawOnlySelected(bool bNew) { bDrawOnlySelected = bNew; }
+ bool GetDrawOnlySelected() const { return bDrawOnlySelected; }
+ virtual SdrObjKind GetObjIdentifier() const override;
+
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
+ virtual void NbcMove(const Size& rSize) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& rXFact,
+ const Fraction& rYFact) override;
+ virtual void RecalcSnapRect() override;
+
+ virtual E3dScene* getRootE3dSceneFromE3dObject() const override;
+ void SetCamera(const Camera3D& rNewCamera);
+ const Camera3D& GetCamera() const { return aCamera; }
+ void removeAllNonSelectedObjects();
+
+ virtual E3dScene* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+
+ virtual void NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix) override;
+ virtual void SetTransform(const basegfx::B3DHomMatrix& rMatrix) override;
+
+ virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
+ void RotateScene(const Point& rRef, double sn, double cs);
+
+ // TakeObjName...() is for the display in the UI, for example "3 frames selected".
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ // get transformations
+ B3dCamera& GetCameraSet() { return aCameraSet; }
+ const B3dCamera& GetCameraSet() const { return aCameraSet; }
+
+ // break up
+ virtual bool IsBreakObjPossible() override;
+
+ // polygon which is built during creation
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
+
+ // create moves
+ virtual bool BegCreate(SdrDragStat& rStat) override;
+ virtual bool MovCreate(SdrDragStat& rStat) override; // true=Xor must be repainted
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+ virtual bool BckCreate(SdrDragStat& rStat) override;
+ virtual void BrkCreate(SdrDragStat& rStat) override;
+
+ void SuspendReportingDirtyRects();
+ void ResumeReportingDirtyRects();
+ void SetAllSceneRectsDirty();
+
+ // set selection from E3dObject (temporary flag for 3D actions)
+ virtual void SetSelected(bool bNew) override;
+
+ // derived from SdrObjList
+ virtual void NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override;
+ virtual void InsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override;
+ virtual SdrObject* NbcRemoveObject(size_t nObjNum) override;
+ virtual SdrObject* RemoveObject(size_t nObjNum) override;
+
+ // needed for group functionality
+ virtual void SetBoundAndSnapRectsDirty(bool bNotMyself = false, bool bRecursive = true) override;
+ virtual void NbcSetLayer(SdrLayerID nLayer) override;
+
+ // react on model/page change
+ virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
+
+ virtual SdrObjList* GetSubList() const override;
+ virtual void SetTransformChanged() override;
+
+private:
+ virtual basegfx::B3DRange RecalcBoundVolume() const override;
+};
+
+#endif // INCLUDED_SVX_SCENE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdangitm.hxx b/include/svx/sdangitm.hxx
new file mode 100644
index 000000000..ee4af385a
--- /dev/null
+++ b/include/svx/sdangitm.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDANGITM_HXX
+#define INCLUDED_SVX_SDANGITM_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/degree.hxx>
+
+
+
+class SVXCORE_DLLPUBLIC SdrAngleItem: public SfxInt32Item {
+public:
+ SdrAngleItem(TypedWhichId<SdrAngleItem> nId, Degree100 nAngle): SfxInt32Item(nId,nAngle.get()) {}
+ virtual SdrAngleItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString& rText,
+ const IntlWrapper& rIntlWrapper) const override;
+
+ Degree100 GetValue() const { return Degree100(SfxInt32Item::GetValue()); }
+ void SetValue(Degree100 nTheValue) { SfxInt32Item::SetValue(nTheValue.get()); }
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdasitm.hxx b/include/svx/sdasitm.hxx
new file mode 100644
index 000000000..ee1c05ebc
--- /dev/null
+++ b/include/svx/sdasitm.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDASITM_HXX
+#define INCLUDED_SVX_SDASITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdooitm.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+#include <unordered_map>
+
+namespace com::sun::star::uno { class Any; }
+
+class SVXCORE_DLLPUBLIC SdrCustomShapeGeometryItem final : public SfxPoolItem
+{
+public:
+ typedef std::pair < const OUString, const OUString > PropertyPair;
+
+private:
+ struct PropertyPairHash
+ {
+ inline size_t operator()( const SdrCustomShapeGeometryItem::PropertyPair& ) const;
+ };
+ typedef std::unordered_map <PropertyPair, sal_Int32, PropertyPairHash> PropertyPairHashMap;
+ typedef std::unordered_map<OUString, sal_Int32> PropertyHashMap;
+
+ PropertyHashMap aPropHashMap;
+ PropertyPairHashMap aPropPairHashMap;
+
+ css::uno::Sequence< css::beans::PropertyValue > aPropSeq;
+
+ // For fast comparisons keep a hash of the content, computed on demand
+ // (unusable state is if anyToHash() returns no hash).
+ enum HashState { Unknown, Valid, Unusable };
+ mutable HashState aHashState = HashState::Unknown;
+ mutable size_t aHash = 0xdeadbeef;
+
+ void SetPropSeq( const css::uno::Sequence< css::beans::PropertyValue >& rPropSeq );
+ inline void UpdateHash() const;
+ inline void InvalidateHash();
+
+ public:
+
+ SdrCustomShapeGeometryItem();
+ SdrCustomShapeGeometryItem( const css::uno::Sequence< css::beans::PropertyValue >& );
+ virtual ~SdrCustomShapeGeometryItem() override;
+
+ SdrCustomShapeGeometryItem(SdrCustomShapeGeometryItem const &) = default;
+ SdrCustomShapeGeometryItem(SdrCustomShapeGeometryItem &&) = default;
+ SdrCustomShapeGeometryItem & operator =(SdrCustomShapeGeometryItem const &) = delete; // due to SfxPoolItem
+ SdrCustomShapeGeometryItem & operator =(SdrCustomShapeGeometryItem &&) = delete; // due to SfxPoolItem
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool operator<( const SfxPoolItem& ) const override;
+ virtual bool IsSortable() const override { return true; }
+
+ virtual bool GetPresentation(SfxItemPresentation ePresentation,
+ MapUnit eCoreMetric, MapUnit ePresentationMetric,
+ OUString &rText, const IntlWrapper&) const override;
+
+ virtual SdrCustomShapeGeometryItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ css::uno::Any* GetPropertyValueByName( const OUString& rPropName );
+ const css::uno::Any* GetPropertyValueByName( const OUString& rPropName ) const;
+ css::uno::Any* GetPropertyValueByName( const OUString& rPropName, const OUString& rPropName2 );
+ const css::uno::Any* GetPropertyValueByName( const OUString& rPropName, const OUString& rPropName2 ) const;
+
+ void SetPropertyValue( const css::beans::PropertyValue& rPropVal );
+ void SetPropertyValue( const OUString& rSequenceName, const css::beans::PropertyValue& rPropVal );
+
+ void ClearPropertyValue( const OUString& rPropertyName );
+};
+
+inline SdrOnOffItem makeSdrTextWordWrapItem( bool bAuto ) {
+ return SdrOnOffItem( SDRATTR_TEXT_WORDWRAP, bAuto );
+}
+
+// some useful inline methods
+
+size_t SdrCustomShapeGeometryItem::PropertyPairHash::operator()( const SdrCustomShapeGeometryItem::PropertyPair &r1 ) const
+{
+ size_t hash = 17;
+ hash = hash * 37 + r1.first.hashCode();
+ hash = hash * 37 + r1.second.hashCode();
+ return hash;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sderitm.hxx b/include/svx/sderitm.hxx
new file mode 100644
index 000000000..2afd50ef8
--- /dev/null
+++ b/include/svx/sderitm.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDERITM_HXX
+#define INCLUDED_SVX_SDERITM_HXX
+
+#include <svx/sdmetitm.hxx>
+#include <svx/svddef.hxx>
+
+inline SdrMetricItem makeSdrEckenradiusItem(tools::Long nRadius)
+{
+ return SdrMetricItem(SDRATTR_CORNER_RADIUS, nRadius);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdgcpitm.hxx b/include/svx/sdgcpitm.hxx
new file mode 100644
index 000000000..a9712a156
--- /dev/null
+++ b/include/svx/sdgcpitm.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDGCPITM_HXX
+#define INCLUDED_SVX_SDGCPITM_HXX
+
+#include <config_options.h>
+#include <svx/grfcrop.hxx>
+#include <svx/svddef.hxx>
+
+
+// SdrGrafCropItem -
+
+
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SdrGrafCropItem final : public SvxGrfCrop
+{
+public:
+
+
+ SdrGrafCropItem( sal_Int32 nLeftCrop = 0, sal_Int32 nTopCrop = 0,
+ sal_Int32 nRightCrop = 0, sal_Int32 nBottomCrop = 0 ) :
+ SvxGrfCrop( nLeftCrop, nRightCrop, nTopCrop, nBottomCrop, SDRATTR_GRAFCROP ) {}
+
+ virtual SdrGrafCropItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+};
+
+#endif // INCLUDED_SVX_SDGCPITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdggaitm.hxx b/include/svx/sdggaitm.hxx
new file mode 100644
index 000000000..345082fca
--- /dev/null
+++ b/include/svx/sdggaitm.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDGGAITM_HXX
+#define INCLUDED_SVX_SDGGAITM_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+
+// SdrGrafGamma100Item -
+
+
+class SVXCORE_DLLPUBLIC SdrGrafGamma100Item final : public SfxUInt32Item
+{
+public:
+
+
+ SdrGrafGamma100Item( sal_uInt32 nGamma100 = 100 ) : SfxUInt32Item( SDRATTR_GRAFGAMMA, nGamma100 ) {}
+
+ virtual SdrGrafGamma100Item* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif // INCLUDED_SVX_SDGGAITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdgluitm.hxx b/include/svx/sdgluitm.hxx
new file mode 100644
index 000000000..4ef5e69e9
--- /dev/null
+++ b/include/svx/sdgluitm.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDGLUITM_HXX
+#define INCLUDED_SVX_SDGLUITM_HXX
+
+#include <svx/sdprcitm.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+
+// SdrGrafLuminanceItem -
+
+
+class SVXCORE_DLLPUBLIC SdrGrafLuminanceItem final : public SdrSignedPercentItem
+{
+public:
+
+
+ SdrGrafLuminanceItem( short nLuminancePercent = 0 ) : SdrSignedPercentItem(
+ SDRATTR_GRAFLUMINANCE, nLuminancePercent ) {}
+
+ virtual SdrGrafLuminanceItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+};
+
+
+// SdrGrafContrastItem -
+
+
+class SVXCORE_DLLPUBLIC SdrGrafContrastItem final : public SdrSignedPercentItem
+{
+public:
+
+
+ SdrGrafContrastItem( short nContrastPercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFCONTRAST, nContrastPercent ) {}
+
+ virtual SdrGrafContrastItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+};
+
+#endif // INCLUDED_SVX_SDGLUITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdgmoitm.hxx b/include/svx/sdgmoitm.hxx
new file mode 100644
index 000000000..fa205b6db
--- /dev/null
+++ b/include/svx/sdgmoitm.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDGMOITM_HXX
+#define INCLUDED_SVX_SDGMOITM_HXX
+
+#include <vcl/GraphicAttributes.hxx>
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+// MSVC hack:
+class SAL_DLLPUBLIC_RTTI SdrGrafModeItem_Base: public SfxEnumItem<GraphicDrawMode> {
+protected:
+ SdrGrafModeItem_Base(GraphicDrawMode eMode):
+ SfxEnumItem(SDRATTR_GRAFMODE, eMode) {}
+};
+
+class SVXCORE_DLLPUBLIC SdrGrafModeItem final : public SdrGrafModeItem_Base
+{
+public:
+ SdrGrafModeItem( GraphicDrawMode eMode = GraphicDrawMode::Standard ) : SdrGrafModeItem_Base( eMode ) {}
+
+ virtual SdrGrafModeItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+
+ static OUString GetValueTextByPos( sal_uInt16 nPos );
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString& rText, const IntlWrapper& ) const override;
+};
+
+#endif // INCLUDED_SVX_SDGMOITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdmetitm.hxx b/include/svx/sdmetitm.hxx
new file mode 100644
index 000000000..934c24034
--- /dev/null
+++ b/include/svx/sdmetitm.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDMETITM_HXX
+#define INCLUDED_SVX_SDMETITM_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svxdllapi.h>
+
+
+// class SdrAngleItem
+// For all metrics. GetPresentation returns for example for
+// Value=2500 a "25mm".
+
+class SVXCORE_DLLPUBLIC SdrMetricItem: public SfxInt32Item {
+public:
+ SdrMetricItem(TypedWhichId<SdrMetricItem> nId, sal_Int32 nVal): SfxInt32Item(nId,nVal) {}
+ virtual SdrMetricItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual bool HasMetrics() const override;
+ virtual void ScaleMetrics(tools::Long nMul, tools::Long nDiv) override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString& rText, const IntlWrapper&) const override;
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdooitm.hxx b/include/svx/sdooitm.hxx
new file mode 100644
index 000000000..befd67f74
--- /dev/null
+++ b/include/svx/sdooitm.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDOOITM_HXX
+#define INCLUDED_SVX_SDOOITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+
+// class SdrOnOffItem
+// here GetValueTextByVal() returns "on" or "off" instead
+// of "TRUE" or "FALSE"
+
+class SVXCORE_DLLPUBLIC SdrOnOffItem: public SfxBoolItem {
+public:
+ SdrOnOffItem(TypedWhichId<SdrOnOffItem> nId, bool bOn): SfxBoolItem(nId,bOn) {}
+ virtual SdrOnOffItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ virtual OUString GetValueTextByVal(bool bVal) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdprcitm.hxx b/include/svx/sdprcitm.hxx
new file mode 100644
index 000000000..f00c8d514
--- /dev/null
+++ b/include/svx/sdprcitm.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDPRCITM_HXX
+#define INCLUDED_SVX_SDPRCITM_HXX
+
+#include <config_options.h>
+#include <svl/intitem.hxx>
+#include <svx/svxdllapi.h>
+
+
+// class SdrPercentItem
+// Integer percents of 0
+
+
+class SVXCORE_DLLPUBLIC SdrPercentItem : public SfxUInt16Item
+{
+public:
+ SdrPercentItem(TypedWhichId<SdrPercentItem> nId, sal_uInt16 nVal): SfxUInt16Item(nId,nVal) {}
+ virtual SdrPercentItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+
+// class SdrSignedPercentItem
+// Integer percents of +/-
+
+
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SdrSignedPercentItem : public SfxInt16Item
+{
+public:
+ SdrSignedPercentItem( sal_uInt16 nId, sal_Int16 nVal ) : SfxInt16Item( nId,nVal ) {}
+ virtual SdrSignedPercentItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/animation/animationstate.hxx b/include/svx/sdr/animation/animationstate.hxx
new file mode 100644
index 000000000..92878897e
--- /dev/null
+++ b/include/svx/sdr/animation/animationstate.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_ANIMATION_ANIMATIONSTATE_HXX
+#define INCLUDED_SVX_SDR_ANIMATION_ANIMATIONSTATE_HXX
+
+#include <sal/types.h>
+#include <svx/sdr/animation/scheduler.hxx>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+
+namespace sdr::contact { class ViewObjectContact; }
+
+namespace sdr::animation
+ {
+ class PrimitiveAnimation final : public Event
+ {
+ // the animated VOC
+ sdr::contact::ViewObjectContact& mrVOContact;
+
+ // the vetor of animated primitives
+ drawinglayer::primitive2d::Primitive2DContainer maAnimatedPrimitives;
+
+ // local helpers
+ double getSmallestNextTime(double fCurrentTime);
+ void prepareNextEvent();
+
+ public:
+ // basic constructor.
+ PrimitiveAnimation(sdr::contact::ViewObjectContact& rVOContact, drawinglayer::primitive2d::Primitive2DContainer&& rAnimatedPrimitives);
+
+ // destructor
+ virtual ~PrimitiveAnimation() override;
+
+ // execute event, from base class Event
+ virtual void Trigger(sal_uInt32 nTime) override;
+ };
+
+} // end of namespace sdr::animation
+
+#endif // INCLUDED_SVX_SDR_ANIMATION_ANIMATIONSTATE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/animation/objectanimator.hxx b/include/svx/sdr/animation/objectanimator.hxx
new file mode 100644
index 000000000..a0e199932
--- /dev/null
+++ b/include/svx/sdr/animation/objectanimator.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_ANIMATION_OBJECTANIMATOR_HXX
+#define INCLUDED_SVX_SDR_ANIMATION_OBJECTANIMATOR_HXX
+
+#include <config_options.h>
+#include <svx/sdr/animation/scheduler.hxx>
+
+
+namespace sdr::animation
+{
+ class primitiveAnimator final : public Scheduler
+ {
+ public:
+ // basic constructor and destructor
+ primitiveAnimator();
+ UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) virtual ~primitiveAnimator() override;
+ };
+} // end of namespace sdr::animation
+
+
+#endif // INCLUDED_SVX_SDR_ANIMATION_OBJECTANIMATOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/animation/scheduler.hxx b/include/svx/sdr/animation/scheduler.hxx
new file mode 100644
index 000000000..312083b68
--- /dev/null
+++ b/include/svx/sdr/animation/scheduler.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_ANIMATION_SCHEDULER_HXX
+#define INCLUDED_SVX_SDR_ANIMATION_SCHEDULER_HXX
+
+#include <sal/types.h>
+#include <vcl/timer.hxx>
+#include <svx/svxdllapi.h>
+#include <vector>
+
+
+namespace sdr::animation
+ {
+
+ class SVXCORE_DLLPUBLIC Event
+ {
+ // time of event in ms
+ sal_uInt32 mnTime;
+
+ public:
+ // constructor/destructor
+ SAL_DLLPRIVATE explicit Event();
+ virtual ~Event();
+
+ // get/set time
+ SAL_DLLPRIVATE sal_uInt32 GetTime() const { return mnTime; }
+ void SetTime(sal_uInt32 nNew);
+
+ // execute event
+ virtual void Trigger(sal_uInt32 nTime) = 0;
+ };
+
+ class SVXCORE_DLLPUBLIC Scheduler : public Timer
+ {
+ // time in ms
+ sal_uInt32 mnTime;
+
+ // next delta time
+ sal_uInt32 mnDeltaTime;
+
+ // list of events, sorted by time
+ std::vector<Event*> mvEvents;
+
+ // Flag which remembers if this timer is paused. Default
+ // is false.
+ bool mbIsPaused;
+
+ public:
+ // constructor/destructor
+ SAL_DLLPRIVATE Scheduler();
+ virtual ~Scheduler() override;
+
+ // From baseclass Timer, the timeout call
+ virtual void Invoke() override;
+
+ // get time
+ SAL_DLLPRIVATE sal_uInt32 GetTime() const { return mnTime; }
+
+ // #i38135#
+ SAL_DLLPRIVATE void SetTime(sal_uInt32 nTime);
+
+ // execute all ripe events, removes executed ones from the scheduler
+ SAL_DLLPRIVATE void triggerEvents();
+
+ // re-start or stop timer according to event list
+ SAL_DLLPRIVATE void checkTimeout();
+
+ // insert/remove events, wrapper to EventList methods
+ void InsertEvent(Event& rNew);
+ SAL_DLLPRIVATE void RemoveEvent(Event* pOld);
+
+ // get/set pause
+ SAL_DLLPRIVATE bool IsPaused() const { return mbIsPaused; }
+ SAL_DLLPRIVATE void SetPaused(bool bNew);
+ };
+
+} // end of namespace sdr::animation
+
+
+#endif // INCLUDED_SVX_SDR_ANIMATION_SCHEDULER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/attribute/sdrallfillattributeshelper.hxx b/include/svx/sdr/attribute/sdrallfillattributeshelper.hxx
new file mode 100644
index 000000000..c9bb786a8
--- /dev/null
+++ b/include/svx/sdr/attribute/sdrallfillattributeshelper.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX
+#define INCLUDED_SVX_SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX
+
+#include <svx/svxdllapi.h>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+#include <svl/itemset.hxx>
+#include <optional>
+
+//////////////////////////////////////////////////////////////////////////////
+
+class Color;
+
+namespace drawinglayer::attribute
+ {
+ class SVXCORE_DLLPUBLIC SdrAllFillAttributesHelper
+ {
+ private:
+ basegfx::B2DRange maLastPaintRange;
+ basegfx::B2DRange maLastDefineRange;
+ std::optional<drawinglayer::attribute::SdrFillAttribute> maFillAttribute;
+ std::optional<drawinglayer::attribute::FillGradientAttribute> maFillGradientAttribute;
+ drawinglayer::primitive2d::Primitive2DContainer maPrimitives;
+
+ void createPrimitive2DSequence(
+ const basegfx::B2DRange& rPaintRange,
+ const basegfx::B2DRange& rDefineRange);
+
+ public:
+ SdrAllFillAttributesHelper(const Color& rColor);
+ SdrAllFillAttributesHelper(const SfxItemSet& rSet);
+ ~SdrAllFillAttributesHelper();
+
+ bool isUsed() const;
+ bool hasSdrFillAttribute() const { return bool(maFillAttribute); }
+ bool isTransparent() const;
+
+ const drawinglayer::attribute::SdrFillAttribute& getFillAttribute() const;
+ const drawinglayer::attribute::FillGradientAttribute& getFillGradientAttribute() const;
+ const drawinglayer::primitive2d::Primitive2DContainer& getPrimitive2DSequence(
+ const basegfx::B2DRange& rPaintRange,
+ const basegfx::B2DRange& rDefineRange) const;
+
+ // get average fill color; tries to calculate a 'medium' color
+ // which e.g. may be used as comparison to decide if other
+ // colors are visible
+ basegfx::BColor getAverageColor(const basegfx::BColor& rFallback) const;
+
+ // return if a repaint of this content needs a complete repaint. This
+ // is e.g. not needed for no fill or color fill (a partial repaint
+ // will do the trick), but necessary for everything that is not top-left
+ // oriented
+ bool needCompleteRepaint() const;
+ };
+
+} // end of namespace drawinglayer::attribute
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer::attribute
+{
+ typedef std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr;
+} // end of namespace drawinglayer::attribute
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/contact/displayinfo.hxx b/include/svx/sdr/contact/displayinfo.hxx
new file mode 100644
index 000000000..7075b04cc
--- /dev/null
+++ b/include/svx/sdr/contact/displayinfo.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_CONTACT_DISPLAYINFO_HXX
+#define INCLUDED_SVX_SDR_CONTACT_DISPLAYINFO_HXX
+
+#include <svx/svdsob.hxx>
+#include <vcl/region.hxx>
+#include <svx/svxdllapi.h>
+#include <basegfx/range/b2irectangle.hxx>
+
+namespace sdr::contact
+ {
+ class SVXCORE_DLLPUBLIC DisplayInfo final
+ {
+ // The Layers which shall be processed (visible)
+ SdrLayerIDSet maProcessLayers;
+
+ // The redraw area, in logical coordinates of OutputDevice. If Region
+ // is empty, everything needs to be redrawn
+ vcl::Region maRedrawArea;
+
+ /// only for Writer: current page being painted
+ basegfx::B2IRectangle m_WriterPageFrame;
+
+ // Internal flag to know when the control layer is painted. Default is
+ // false. If set to true, painting of the page, page borders and
+ // the rasters will be suppressed as if mbPageProcessingActive is set (see there).
+ // This flag is set internally from the processing mechanism to avoid double page
+ // painting when the control layer needs to be painted as last layer
+ bool mbControlLayerProcessingActive : 1;
+
+ // Internal flag to decide if page stuff (background, border, MasterPage, grid, etc...)
+ // will be processed at all. This flag is user-defined and will not be changed from the
+ // processing mechanism. Default is true, thus set to false if PagePainting should be suppressed.
+ // For more granular switching page stuff painting on and off, use the according flags at the
+ // view (->Is*Visible())
+ bool mbPageProcessingActive : 1;
+
+ // Internal flag to remember if EnteredGroupDrawMode is active. Default is true
+ // since this mode starts activated and gets switched off when reaching
+ // the current group level. Should only be changed by instances which do
+ // primitive processing
+ bool mbGhostedDrawModeActive : 1;
+
+ // Internal flag to know if a MasterPage is processed as SubContent of another
+ // page. Initialized to false, this should only be changed from the instance which
+ // is processing the MasterPage asSubContent and knows what it does
+ bool mbSubContentActive : 1;
+
+ public:
+ // basic constructor.
+ DisplayInfo();
+
+ // access to ProcessLayers
+ void SetProcessLayers(const SdrLayerIDSet& rSet);
+ const SdrLayerIDSet& GetProcessLayers() const { return maProcessLayers; }
+
+ // access to RedrawArea
+ void SetRedrawArea(const vcl::Region& rRegion);
+ const vcl::Region& GetRedrawArea() const { return maRedrawArea; }
+
+ void SetWriterPageFrame(basegfx::B2IRectangle const& rPageFrame);
+ basegfx::B2IRectangle const& GetWriterPageFrame() const { return m_WriterPageFrame; }
+
+ // Access to ControlLayerProcessingActive flag
+ void SetControlLayerProcessingActive(bool bDoPaint);
+ bool GetControlLayerProcessingActive() const { return mbControlLayerProcessingActive; }
+
+ // Access to PageProcessingActive flag
+ void SetPageProcessingActive(bool bDoPaint);
+ bool GetPageProcessingActive() const { return mbPageProcessingActive; }
+
+ // Save the original DrawMode from outdev
+ void ClearGhostedDrawMode();
+ void SetGhostedDrawMode();
+ bool IsGhostedDrawModeActive() const { return mbGhostedDrawModeActive; }
+
+ // access to master page painting flag
+ bool GetSubContentActive() const { return mbSubContentActive; }
+ void SetSubContentActive(bool bNew);
+ };
+
+} // end of namespace sdr::contact
+
+
+#endif // INCLUDED_SVX_SDR_CONTACT_DISPLAYINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/contact/objectcontact.hxx b/include/svx/sdr/contact/objectcontact.hxx
new file mode 100644
index 000000000..3e9b1b76d
--- /dev/null
+++ b/include/svx/sdr/contact/objectcontact.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
+#define INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
+
+#include <svx/sdr/animation/objectanimator.hxx>
+#include <svx/sdr/animation/animationstate.hxx>
+#include <svx/svxdllapi.h>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+class SdrLayerIDSet;
+namespace tools { class Rectangle; }
+class SdrPageView;
+class OutputDevice;
+
+namespace basegfx {
+ class B2DRange;
+ class B2DHomMatrix;
+}
+
+namespace sdr::contact {
+
+class DisplayInfo;
+class ViewContact;
+class ViewObjectContactRedirector;
+
+class SVXCORE_DLLPUBLIC ObjectContact
+{
+private:
+ // make ViewObjectContact a friend to exclusively allow it to use
+ // AddViewObjectContact/RemoveViewObjectContact
+ friend class ViewObjectContact;
+
+ // All VOCs which are created using this OC, thus remembering this OC
+ // as a reference. All those VOCs need to be deleted when the OC goes down.
+ // Registering and de-registering is done in the VOC constructors/destructors.
+ std::vector< ViewObjectContact* > maViewObjectContactVector;
+
+ // A new ViewObjectContact was created and shall be remembered.
+ void AddViewObjectContact(ViewObjectContact& rVOContact);
+
+ // A ViewObjectContact was deleted and shall be forgotten.
+ void RemoveViewObjectContact(ViewObjectContact& rVOContact);
+
+ // the primitiveAnimator which is used if this View and/or the contained primitives
+ // support animatedSwitchPrimitives
+ sdr::animation::primitiveAnimator maPrimitiveAnimator;
+
+ // The redirector. If set it is used to pipe all supported calls
+ // to the redirector
+ ViewObjectContactRedirector* mpViewObjectContactRedirector;
+
+ // the Primitive2DParameters containing view information
+ drawinglayer::geometry::ViewInformation2D maViewInformation2D;
+
+ // flag for preview renderer
+ bool mbIsPreviewRenderer : 1;
+
+protected:
+ // Interface to allow derivates to travel over the registered VOC's
+ sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); }
+ ViewObjectContact* getViewObjectContact(sal_uInt32 a) const { return maViewObjectContactVector[a]; }
+
+ // interface to allow derivates to set PreviewRenderer flag
+ void setPreviewRenderer(bool bNew) { mbIsPreviewRenderer = bNew; }
+
+ // interface to allow derivates to set ViewInformation2D
+ void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; }
+
+public:
+ // basic constructor
+ ObjectContact();
+ virtual ~ObjectContact() COVERITY_NOEXCEPT_FALSE;
+
+ // LazyInvalidate request. This is used from the VOCs to mark that they
+ // got invalidated by an ActionChanged() call. An active view needs to remember
+ // this and take action on it. Default implementation directly calls back
+ // triggerLazyInvalidate() which promptly handles the request
+ virtual void setLazyInvalidate(ViewObjectContact& rVOC);
+
+ // call this to support evtl. preparations for repaint. Default does nothing
+ virtual void PrepareProcessDisplay();
+
+ // Process the whole displaying
+ virtual void ProcessDisplay(DisplayInfo& rDisplayInfo);
+
+ // test if visualizing of entered groups is switched on at all. Default
+ // implementation returns sal_False.
+ virtual bool DoVisualizeEnteredGroup() const;
+
+ // get active group's (the entered group) ViewContact
+ virtual const ViewContact* getActiveViewContact() const;
+
+ // Invalidate given rectangle at the window/output which is represented by
+ // this ObjectContact. Default does nothing.
+ virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const;
+
+ // Get info about the need to visualize GluePoints. The default
+ // is that it is not necessary.
+ virtual bool AreGluePointsVisible() const;
+
+ // method to get the primitiveAnimator
+ sdr::animation::primitiveAnimator& getPrimitiveAnimator() { return maPrimitiveAnimator; }
+
+ // check if text animation is allowed. Default is sal_true.
+ virtual bool IsTextAnimationAllowed() const;
+
+ // check if graphic animation is allowed. Default is sal_true.
+ virtual bool IsGraphicAnimationAllowed() const;
+
+ // access to ViewObjectContactRedirector
+ ViewObjectContactRedirector* GetViewObjectContactRedirector() const { return mpViewObjectContactRedirector; }
+ void SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew);
+
+ // print? Default is false
+ virtual bool isOutputToPrinter() const;
+
+ // recording MetaFile? Default is false
+ virtual bool isOutputToRecordingMetaFile() const;
+
+ // pdf export? Default is false
+ virtual bool isOutputToPDFFile() const;
+ virtual bool isExportTaggedPDF() const;
+
+ // gray display mode
+ virtual bool isDrawModeGray() const;
+
+ // high contrast display mode
+ virtual bool isDrawModeHighContrast() const;
+
+ // check if this is a preview renderer. Default is sal_False.
+ bool IsPreviewRenderer() const { return mbIsPreviewRenderer; }
+
+ // get Primitive2DParameters for this view
+ const drawinglayer::geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; }
+
+ /// access to SdrPageView. May return 0L like the default implementations do. Override as needed.
+ virtual SdrPageView* TryToGetSdrPageView() const;
+
+ /// access to OutputDevice. May return 0L like the default implementations do. Override as needed.
+ virtual OutputDevice* TryToGetOutputDevice() const;
+
+ // interface to support GridOffset for non-linear ViewToDevice transformation (calc)
+ virtual bool supportsGridOffsets() const;
+ virtual void calculateGridOffsetForViewOjectContact(
+ basegfx::B2DVector& rTarget,
+ const ViewObjectContact& rClient) const;
+ virtual void calculateGridOffsetForB2DRange(
+ basegfx::B2DVector& rTarget,
+ const basegfx::B2DRange& rB2DRange) const;
+ void resetAllGridOffsets();
+};
+
+}
+
+
+#endif // INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/contact/objectcontactofpageview.hxx b/include/svx/sdr/contact/objectcontactofpageview.hxx
new file mode 100644
index 000000000..8d18083b9
--- /dev/null
+++ b/include/svx/sdr/contact/objectcontactofpageview.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_INC_SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX
+#define INCLUDED_SVX_INC_SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX
+
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <vcl/idle.hxx>
+
+class SdrPageWindow;
+class SdrPage;
+
+namespace sdr::contact
+ {
+ class SVXCORE_DLLPUBLIC ObjectContactOfPageView : public ObjectContact, public Idle
+ {
+ // the owner of this ObjectContactOfPageView. Set from constructor and not
+ // to be changed in any way.
+ SdrPageWindow& mrPageWindow;
+
+ // Process the whole displaying, the real version
+ void DoProcessDisplay(DisplayInfo& rDisplayInfo);
+
+ public:
+ // access to SdrPageWindow
+ SdrPageWindow& GetPageWindow() const { return mrPageWindow; }
+
+ // access to SdrPage of PageView
+ SdrPage* GetSdrPage() const;
+
+ // basic constructor, used from SdrPageView.
+ explicit ObjectContactOfPageView(SdrPageWindow& rPageWindow,
+ const char *pDebugName);
+ virtual ~ObjectContactOfPageView() override;
+
+ // LazyInvalidate request. This is used from the VOCs to mark that they
+ // got invalidated by an ActionChanged() call. An active view needs to remember
+ // this and take action on it. Default implementation directly calls back
+ // triggerLazyInvalidate() which promptly handles the request
+ virtual void setLazyInvalidate(ViewObjectContact& rVOC) override;
+
+ // call this to support evtl. preparations for repaint
+ virtual void PrepareProcessDisplay() override;
+
+ // From baseclass Timer, the timeout call triggered by the LazyInvalidate mechanism
+ virtual void Invoke() final override;
+
+ // Process the whole displaying
+ virtual void ProcessDisplay(DisplayInfo& rDisplayInfo) override;
+
+ // test if visualizing of entered groups is switched on at all
+ virtual bool DoVisualizeEnteredGroup() const override;
+
+ // get active group's (the entered group) ViewContact
+ virtual const ViewContact* getActiveViewContact() const override;
+
+ // Invalidate given rectangle at the window/output which is represented by
+ // this ObjectContact.
+ virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const override;
+
+ // Get info about the need to visualize GluePoints. The default
+ // is that it is not necessary.
+ virtual bool AreGluePointsVisible() const override;
+
+ // check if text animation is allowed.
+ virtual bool IsTextAnimationAllowed() const override;
+
+ // check if graphic animation is allowed.
+ virtual bool IsGraphicAnimationAllowed() const override;
+
+ // print? Default is false
+ virtual bool isOutputToPrinter() const override;
+
+ // recording MetaFile? Default is false
+ virtual bool isOutputToRecordingMetaFile() const override;
+
+ // pdf export? Default is false
+ virtual bool isOutputToPDFFile() const override;
+ virtual bool isExportTaggedPDF() const override;
+
+ // gray display mode
+ virtual bool isDrawModeGray() const override;
+
+ // high contrast display mode
+ virtual bool isDrawModeHighContrast() const override;
+
+ // override access to SdrPageView
+ virtual SdrPageView* TryToGetSdrPageView() const override;
+
+ // access to OutputDevice. May return 0L like the default implementations do. Override as needed.
+ virtual OutputDevice* TryToGetOutputDevice() const override;
+
+ /** sets all UNO controls which are associated with this ObjectContact to
+ design or alive mode.
+ */
+ void SetUNOControlsDesignMode( bool _bDesignMode ) const;
+ };
+} // end of namespace sdr::contact
+
+#endif // INCLUDED_SVX_INC_SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/contact/viewcontact.hxx b/include/svx/sdr/contact/viewcontact.hxx
new file mode 100644
index 000000000..ffdc6d055
--- /dev/null
+++ b/include/svx/sdr/contact/viewcontact.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACT_HXX
+#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACT_HXX
+
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+
+class SdrLayerIDSet;
+class SdrPage;
+class SdrObject;
+
+namespace sdr::contact
+{
+class ObjectContact;
+class ViewObjectContact;
+
+class SVXCORE_DLLPUBLIC ViewContact
+{
+private:
+ // make ViewObjectContact a friend to exclusively allow it to use
+ // AddViewObjectContact/RemoveViewObjectContact
+ friend class ViewObjectContact;
+
+ // List of ViewObjectContacts. This contains all VOCs which were constructed
+ // with this VC. Since the VOCs remember a reference to this VC, this list needs
+ // to be kept and is used e.g. at destructor to destroy all VOCs.
+ // Registering and de-registering is done in the VOC constructors/destructors.
+ std::vector<ViewObjectContact*> maViewObjectContactVector;
+
+ // Primitive2DContainer of the ViewContact. This contains all necessary information
+ // for the graphical visualisation and needs to be supported by all VCs which
+ // can be visualized.
+ drawinglayer::primitive2d::Primitive2DContainer mxViewIndependentPrimitive2DSequence;
+
+ // A new ViewObjectContact was created and shall be remembered.
+ void AddViewObjectContact(ViewObjectContact& rVOContact);
+
+ // A ViewObjectContact was deleted and shall be forgotten.
+ void RemoveViewObjectContact(ViewObjectContact& rVOContact);
+
+ // internal tooling to delete VOCs
+ void deleteAllVOCs();
+
+protected:
+ // Interface to allow derivates to travel over the registered VOC's
+ sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); }
+ ViewObjectContact* getViewObjectContact(sal_uInt32 a) const
+ {
+ return maViewObjectContactVector[a];
+ }
+
+ // Create an Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something. Default is to create
+ // a standard ViewObjectContact containing the given ObjectContact and *this
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ // This method is responsible for creating the graphical visualisation data derived ONLY from
+ // the model data. It will be stored/buffered in mxViewIndependentPrimitive2DSequence. The default implementation
+ // creates a yellow replacement rectangle (1000, 1000, 5000, 3000) to visualize missing
+ // implementations. All implementations have to provide basic geometry here, this is the central
+ // visualisation method and will also be used for BoundRect computations in the long run.
+ // This means it's always an error when the default implementation is called and thus gets
+ // asserted there
+ virtual void createViewIndependentPrimitive2DSequence(
+ drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const;
+
+ // basic constructor. Since this is a base class only, it shall
+ // never be called directly
+ ViewContact();
+
+public:
+ // basic destructor with needed cleanups
+ virtual ~ViewContact();
+
+ // get an Object-specific ViewObjectContact for a specific
+ // ObjectContact (->View). Always needs to return something.
+ ViewObjectContact& GetViewObjectContact(ObjectContact& rObjectContact);
+
+ // Test if this ViewContact has ViewObjectContacts(excluding previews) at all. This can
+ // be used to test if this ViewContact is visualized ATM or not
+ bool HasViewObjectContacts() const;
+
+ // Check if this primitive is animated in any OC (View) which means it has
+ // generated a PrimitiveAnimation in its VOC
+ bool isAnimatedInAnyViewObjectContact() const;
+
+ // Access to possible sub-hierarchy and parent. GetObjectCount() default is 0L
+ // and GetViewContact default pops up an assert since it's an error if
+ // GetObjectCount has a result != 0 and it's not overridden.
+ virtual sal_uInt32 GetObjectCount() const;
+ virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const;
+ virtual ViewContact* GetParentContact() const;
+
+ // React on insertion of a child into DRawHierarchy starting
+ // from this object
+ void ActionChildInserted(ViewContact& rChild);
+
+ // access to SdrObject. May return 0L like the default
+ // implementations do. Override as needed.
+ virtual SdrObject* TryToGetSdrObject() const;
+
+ // React on changes of the object of this ViewContact
+ virtual void ActionChanged();
+
+ // access to the local primitive. This will ensure that the primitive is
+ // current in comparing the local one with a fresh created incarnation
+ void getViewIndependentPrimitive2DContainer(
+ drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const;
+
+ // add Gluepoints (if available)
+ virtual drawinglayer::primitive2d::Primitive2DContainer
+ createGluePointPrimitive2DSequence() const;
+
+ // Allow embedding if needed (e.g. for SdrObjects, evtl. Name, Title and description get added). This
+ // is a helper normally used from getViewIndependentPrimitive2DContainer(), but there is one exception
+ // for 3D scenes.
+ // We take the param by value, since, for the common case, we can just std::move into the param, and
+ // std::move the result out, avoiding copying.
+ virtual drawinglayer::primitive2d::Primitive2DContainer
+ embedToObjectSpecificInformation(drawinglayer::primitive2d::Primitive2DContainer rSource) const;
+
+ virtual basegfx::B2DRange
+ getRange(const drawinglayer::geometry::ViewInformation2D& rViewInfo2D) const;
+
+ // delete all existing VOCs including DrawHierarchy which will invalidate all
+ // visualisations, too. Used mostly at object removal from DrawHierarchy to
+ // delete all existing VOCs by purpose, but can also be used for other purposes.
+ // It is always possible to delete the VOCs, these are re-created on demand
+ void flushViewObjectContacts(bool bWithHierarchy = true);
+};
+}
+
+#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/contact/viewcontactofe3dscene.hxx b/include/svx/sdr/contact/viewcontactofe3dscene.hxx
new file mode 100644
index 000000000..82de5435e
--- /dev/null
+++ b/include/svx/sdr/contact/viewcontactofe3dscene.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
+#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
+
+#include <svx/scene3d.hxx>
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+namespace basegfx {
+ class B3DRange;
+}
+
+namespace sdr::contact {
+
+class SVXCORE_DLLPUBLIC ViewContactOfE3dScene final : public ViewContactOfSdrObj
+{
+public:
+ // basic constructor, used from SdrObject.
+ explicit ViewContactOfE3dScene(E3dScene& rScene);
+
+ // access to SdrObject
+ const E3dScene& GetE3dScene() const
+ {
+ return static_cast<const E3dScene&>(GetSdrObject());
+ }
+
+ // React on changes of the object of this ViewContact
+ virtual void ActionChanged() override;
+
+ // access to ViewInformation3D and ObjectTransformation
+ const drawinglayer::geometry::ViewInformation3D& getViewInformation3D(const ::basegfx::B3DRange& rContentRange) const;
+ const drawinglayer::geometry::ViewInformation3D& getViewInformation3D() const;
+ const basegfx::B2DHomMatrix& getObjectTransformation() const;
+
+ // attribute providers
+ const drawinglayer::attribute::SdrSceneAttribute& getSdrSceneAttribute() const;
+ const drawinglayer::attribute::SdrLightingAttribute& getSdrLightingAttribute() const;
+
+ // scene primitive creators. If pLayerVisibility is given, a visibility test with the LayerID and the
+ // given SdrLayerIDSet is done.
+ drawinglayer::primitive2d::Primitive2DContainer createScenePrimitive2DSequence(const SdrLayerIDSet* pLayerVisibility) const;
+
+ // helpers to get the sequence of all contained 3D primitives and its range,
+ // regardless of layer or visibility constraints and using a neutral ViewInformation3D
+ drawinglayer::primitive3d::Primitive3DContainer getAllPrimitive3DContainer() const;
+ basegfx::B3DRange getAllContentRange3D() const;
+
+private:
+ // Create an Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something. Default is to create
+ // a standard ViewObjectContact containing the given ObjectContact and *this
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override;
+
+ // create methods for ViewInformation3D and ObjectTransformation
+ void createViewInformation3D(const ::basegfx::B3DRange& rContentRange);
+ void createObjectTransformation();
+
+ // attribute creators
+ void createSdrSceneAttribute();
+ void createSdrLightingAttribute();
+
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual void createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override;
+
+ // the 3d transformation stack
+ drawinglayer::geometry::ViewInformation3D maViewInformation3D;
+
+ // the object transformation
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ // attributes
+ drawinglayer::attribute::SdrSceneAttribute maSdrSceneAttribute;
+ drawinglayer::attribute::SdrLightingAttribute maSdrLightingAttribute;
+};
+
+}
+
+#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx b/include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx
new file mode 100644
index 000000000..4490818a0
--- /dev/null
+++ b/include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX
+#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/svdomedia.hxx>
+#include <tools/gen.hxx>
+
+namespace avmedia
+{
+class MediaItem;
+}
+
+namespace sdr::contact
+{
+class SVXCORE_DLLPUBLIC ViewContactOfSdrMediaObj final : public ViewContactOfSdrObj
+{
+ friend class ViewObjectContactOfSdrMediaObj;
+
+public:
+ // basic constructor, used from SdrObject.
+ explicit ViewContactOfSdrMediaObj(SdrMediaObj& rMediaObj);
+ virtual ~ViewContactOfSdrMediaObj() override;
+
+public:
+ // access to SdrMediaObj
+ const SdrMediaObj& GetSdrMediaObj() const
+ {
+ return static_cast<const SdrMediaObj&>(GetSdrObject());
+ }
+
+ Size getPreferredSize() const;
+
+ void updateMediaItem(::avmedia::MediaItem& rItem) const;
+ void executeMediaItem(const ::avmedia::MediaItem& rItem);
+
+private:
+ // Create an Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ virtual ViewObjectContact&
+ CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override;
+
+ // get notified if some properties have changed
+ void mediaPropertiesChanged(const ::avmedia::MediaItem& rNewState);
+
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual void createViewIndependentPrimitive2DSequence(
+ drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override;
+};
+}
+
+#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/contact/viewcontactofsdrobj.hxx b/include/svx/sdr/contact/viewcontactofsdrobj.hxx
new file mode 100644
index 000000000..788c8058d
--- /dev/null
+++ b/include/svx/sdr/contact/viewcontactofsdrobj.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX
+#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX
+
+#include <sal/types.h>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/svxdllapi.h>
+
+class SdrObject;
+
+namespace sdr::contact {
+
+class SVXCORE_DLLPUBLIC ViewContactOfSdrObj : public ViewContact
+{
+protected:
+ // the owner of this ViewContact. Set from constructor and not
+ // to be changed in any way.
+ SdrObject& mrObject;
+
+ // Create an Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override;
+
+public:
+ // access to SdrObject
+ SdrObject& GetSdrObject() const
+ {
+ return mrObject;
+ }
+
+ // basic constructor, used from SdrObject.
+ explicit ViewContactOfSdrObj(SdrObject& rObj);
+ virtual ~ViewContactOfSdrObj() override;
+
+ // Access to possible sub-hierarchy
+ virtual sal_uInt32 GetObjectCount() const override;
+ virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const override;
+ virtual ViewContact* GetParentContact() const override;
+
+ // React on changes of the object of this ViewContact
+ virtual void ActionChanged() override;
+
+ /// override for accessing the SdrObject
+ virtual SdrObject* TryToGetSdrObject() const override;
+
+
+ // primitive stuff
+
+ // add Gluepoints (if available)
+ virtual drawinglayer::primitive2d::Primitive2DContainer createGluePointPrimitive2DSequence() const override;
+
+ // allow embedding if needed (e.g. for SdrObjects, evtl. Name, Title and description get added). This
+ // is a helper normally used from getViewIndependentPrimitive2DContainer(), but there is one exception
+ // for 3D scenes
+ virtual drawinglayer::primitive2d::Primitive2DContainer embedToObjectSpecificInformation(drawinglayer::primitive2d::Primitive2DContainer aSource) const override;
+};
+
+}
+
+#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/contact/viewcontactofvirtobj.hxx b/include/svx/sdr/contact/viewcontactofvirtobj.hxx
new file mode 100644
index 000000000..3054e63f3
--- /dev/null
+++ b/include/svx/sdr/contact/viewcontactofvirtobj.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX
+#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+
+class SdrVirtObj;
+
+namespace sdr::contact
+{
+class SVXCORE_DLLPUBLIC ViewContactOfVirtObj : public ViewContactOfSdrObj
+{
+protected:
+ // internal access to SdrObject. Implementation in *.cxx to avoid
+ // including SdrVirtObj here.
+ SdrVirtObj& GetVirtObj() const;
+
+public:
+ // basic constructor, used from SdrObject.
+ explicit ViewContactOfVirtObj(SdrVirtObj& rObj);
+ virtual ~ViewContactOfVirtObj() override;
+
+ // Access to possible sub-hierarchy
+ virtual sal_uInt32 GetObjectCount() const override;
+
+protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual void createViewIndependentPrimitive2DSequence(
+ drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override;
+};
+}
+
+#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/contact/viewobjectcontact.hxx b/include/svx/sdr/contact/viewobjectcontact.hxx
new file mode 100644
index 000000000..1be4cac81
--- /dev/null
+++ b/include/svx/sdr/contact/viewobjectcontact.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX
+#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX
+
+#include <memory>
+#include <svx/svxdllapi.h>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+
+namespace vcl { class Region; }
+
+namespace sdr::animation {
+ class PrimitiveAnimation;
+}
+namespace drawinglayer::primitive2d { class Primitive2DDecompositionVisitor; }
+
+namespace sdr::contact {
+
+class DisplayInfo;
+class ObjectContact;
+class ViewContact;
+class ViewObjectContactRedirector;
+
+class SVXCORE_DLLPUBLIC ViewObjectContact
+{
+private:
+ // must-exist and constant contacts
+ ObjectContact& mrObjectContact;
+ ViewContact& mrViewContact;
+
+ // This range defines the object's BoundRect
+ basegfx::B2DRange maObjectRange;
+
+ // PrimitiveSequence of the ViewContact. This contains all necessary information
+ // for the graphical visualisation and needs to be supported by all VCs which
+ // can be visualized.
+ drawinglayer::primitive2d::Primitive2DContainer mxPrimitive2DSequence;
+
+ // the PrimitiveAnimation if Primitive2DContainer contains animations
+ std::unique_ptr<sdr::animation::PrimitiveAnimation> mpPrimitiveAnimation;
+
+ // possible on-demand calculated GridOffset for non-linear ViewToDevice transformation (calc)
+ basegfx::B2DVector maGridOffset;
+
+ // used to detect ActionChanged() during primitive construction
+ int mnActionChangedCount;
+
+ // This bool gets set when the object gets invalidated by ActionChanged() and
+ // can be used from the OC to late-invalidates
+ bool mbLazyInvalidate : 1;
+
+protected:
+ // make redirector a protected friend, it needs to call createPrimitives as default action
+ friend class ViewObjectContactRedirector;
+
+ // Called from getPrimitive2DSequence() when vector has changed. Evaluate object animation
+ // and setup accordingly
+ void checkForPrimitive2DAnimations();
+
+ // This method is responsible for creating the graphical visualisation data which is
+ // stored/cached in the local primitive. Default gets view-independent Primitive
+ // from the ViewContact using ViewContact::getViewIndependentPrimitive2DContainer(), takes care of
+ // visibility, handles glue and ghosted.
+ // This method will not handle included hierarchies and not check geometric visibility.
+ virtual void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const;
+
+ // method for flushing Primitive2DContainer for VOC implementations
+ void flushPrimitive2DSequence() { mxPrimitive2DSequence.clear(); }
+
+public:
+ // basic constructor.
+ ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContact();
+
+ // access to ObjectContact
+ ObjectContact& GetObjectContact() const { return mrObjectContact; }
+
+ // access to ViewContact
+ ViewContact& GetViewContact() const { return mrViewContact; }
+
+ // get the object size range
+ const basegfx::B2DRange& getObjectRange() const;
+
+ // React on changes of the object of this ViewContact
+ virtual void ActionChanged();
+
+ // LazyInvalidate handling
+ void triggerLazyInvalidate();
+
+ // Check if this primitive is animated in any OC (View) which means it has
+ // generated a PrimitiveAnimation
+ bool isAnimated() const { return (nullptr != mpPrimitiveAnimation); }
+
+ // Take some action when new objects are inserted
+ void ActionChildInserted(ViewContact& rChild);
+
+ // access to the local primitive. This will ensure that the local primitive is
+ // current in comparing the local one with a fresh created incarnation
+ // This method will not handle included hierarchies and not check visibility.
+ drawinglayer::primitive2d::Primitive2DContainer const & getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ // test this VOC for visibility concerning model-view stuff like e.g. Layer
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+
+ // test this VOC for ghosted mode
+ virtual bool isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) const;
+
+ // process this primitive: Eventually also recursively travel an existing hierarchy,
+ // e.g. for group objects, scenes or pages. This method will test geometrical visibility.
+ virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const;
+
+ // just process the sub-hierarchy, used as tooling from getPrimitive2DSequenceHierarchy
+ void getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const;
+
+ // interface to support GridOffset for non-linear ViewToDevice transformation (calc)
+ const basegfx::B2DVector& getGridOffset() const;
+ void resetGridOffset();
+};
+
+}
+
+
+#endif // INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx b/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
new file mode 100644
index 000000000..5989559c7
--- /dev/null
+++ b/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX
+#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX
+
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+
+class SdrObject;
+class SdrLayerIDSet;
+class OutputDevice;
+
+namespace sdr::contact
+{
+class SVXCORE_DLLPUBLIC ViewObjectContactOfSdrObj : public ViewObjectContact
+{
+ /** Test whether the primitive is visible on any layer from @c aLayers
+
+ This should be overridden by ViewObjectContacts of SDR classes
+ that have subparts which can be on different layers (that is,
+ SdrObjGroup .-)
+ */
+ virtual bool isPrimitiveVisibleOnAnyLayer(const SdrLayerIDSet& aLayers) const;
+
+protected:
+ const SdrObject& getSdrObject() const;
+
+public:
+ ViewObjectContactOfSdrObj(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfSdrObj() override;
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const override;
+
+ /** retrieves the device which a PageView belongs to, starting from its ObjectContactOfPageView
+
+ Since #i72752#, the PaintWindow (and thus the OutputDevice) associated with a PageView is not
+ constant over its lifetime. Instead, during some paint operations, the PaintWindow/OutputDevice
+ might be temporarily patched.
+
+ This method cares for this, by retrieving the very original OutputDevice.
+ */
+ const OutputDevice* getPageViewOutputDevice() const;
+};
+}
+
+#endif // INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/contact/viewobjectcontactredirector.hxx b/include/svx/sdr/contact/viewobjectcontactredirector.hxx
new file mode 100644
index 000000000..100d2ad87
--- /dev/null
+++ b/include/svx/sdr/contact/viewobjectcontactredirector.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX
+#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX
+
+#include <svx/svxdllapi.h>
+#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
+
+namespace sdr::contact {
+
+class DisplayInfo;
+class ViewObjectContact;
+
+// This class provides a mechanism to redirect the paint mechanism for all or
+// single ViewObjectContacts. An own derivation may be set at single ViewContacts
+// or at the ObjectContact for redirecting all. If both is used, the one at single
+// objects will have priority.
+class SVXCORE_DLLPUBLIC ViewObjectContactRedirector
+{
+public:
+ // basic constructor.
+ ViewObjectContactRedirector();
+
+ // The destructor.
+ virtual ~ViewObjectContactRedirector();
+
+ // all default implementations just call the same methods at the original. To do something
+ // different, override the method and at least do what the method does.
+ virtual void createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo,
+ drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor);
+};
+
+}
+
+#endif // INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx
new file mode 100644
index 000000000..cf1b41136
--- /dev/null
+++ b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX
+#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <vcl/bitmapex.hxx>
+
+
+namespace sdr::overlay
+ {
+ class SVXCORE_DLLPUBLIC OverlayAnimatedBitmapEx final : public OverlayObjectWithBasePosition
+ {
+ // the Bitmaps
+ BitmapEx maBitmapEx1;
+ BitmapEx maBitmapEx2;
+
+ // position of the basePosition inside the Bitmaps, in pixels
+ sal_uInt16 mnCenterX1;
+ sal_uInt16 mnCenterY1;
+ sal_uInt16 mnCenterX2;
+ sal_uInt16 mnCenterY2;
+
+ // #i53216# added CursorBlinkTime (in ms)
+ sal_uInt32 mnBlinkTime;
+
+ // optional shear and rotation
+ double mfShearX;
+ double mfRotation;
+
+ // Flag to remember which state to draw. Inited with false (0)
+ bool mbOverlayState : 1;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override;
+
+ public:
+ OverlayAnimatedBitmapEx(
+ const basegfx::B2DPoint& rBasePos,
+ const BitmapEx& rBitmapEx1,
+ const BitmapEx& rBitmapEx2,
+ sal_uInt64 nBlinkTime,
+ sal_uInt16 nCenX1 = 0,
+ sal_uInt16 nCenY1 = 0,
+ sal_uInt16 nCenX2 = 0,
+ sal_uInt16 nCenY2 = 0,
+ double fShearX = 0.0,
+ double fRotation = 0.0);
+ virtual ~OverlayAnimatedBitmapEx() override;
+
+ // execute event from base class sdr::animation::Event. Default
+ // implementation does nothing and does not create a new event.
+ virtual void Trigger(sal_uInt32 nTime) override;
+
+ // get shearX and rotation
+ double getShearX() const { return mfShearX; }
+ double getRotation() const { return mfRotation; }
+ };
+} // end of namespace sdr::overlay
+
+
+#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/overlay/overlaybitmapex.hxx b/include/svx/sdr/overlay/overlaybitmapex.hxx
new file mode 100644
index 000000000..42de7d653
--- /dev/null
+++ b/include/svx/sdr/overlay/overlaybitmapex.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYBITMAPEX_HXX
+#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYBITMAPEX_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <vcl/bitmapex.hxx>
+
+
+namespace sdr::overlay
+ {
+ class SVXCORE_DLLPUBLIC OverlayBitmapEx final : public OverlayObjectWithBasePosition
+ {
+ // the Bitmap itself
+ BitmapEx maBitmapEx;
+
+ // position of the basePosition inside the Bitmap, in pixels
+ sal_uInt16 mnCenterX;
+ sal_uInt16 mnCenterY;
+
+ // optional transparency, shear and rotation
+ double mfAlpha;
+ double mfShearX;
+ double mfRotation;
+
+ virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override;
+
+ public:
+ OverlayBitmapEx(
+ const basegfx::B2DPoint& rBasePos,
+ const BitmapEx& rBitmapEx,
+ sal_uInt16 nCenX = 0,
+ sal_uInt16 nCenY = 0,
+ double fAlpha = 0.0,
+ double fShearX = 0.0,
+ double fRotation = 0.0);
+ virtual ~OverlayBitmapEx() override;
+ };
+} // end of namespace sdr::overlay
+
+
+#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYBITMAPEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/overlay/overlaymanager.hxx b/include/svx/sdr/overlay/overlaymanager.hxx
new file mode 100644
index 000000000..696cf5c99
--- /dev/null
+++ b/include/svx/sdr/overlay/overlaymanager.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX
+#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX
+
+#include <rtl/ref.hxx>
+#include <svx/sdr/animation/scheduler.hxx>
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include <svx/svxdllapi.h>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+class OutputDevice;
+class SdrModel;
+namespace vcl { class Region; }
+
+namespace sdr::overlay {
+ class OverlayObject;
+}
+
+namespace basegfx {
+ class B2DRange;
+}
+
+namespace sdr::overlay
+ {
+ class SVXCORE_DLLPUBLIC OverlayManager
+ : protected sdr::animation::Scheduler
+ , public salhelper::SimpleReferenceObject
+ {
+ private:
+ OverlayManager(const OverlayManager&) = delete;
+ OverlayManager& operator=(const OverlayManager&) = delete;
+
+ protected:
+ // the OutputDevice to work on, set on construction and not to be changed
+ OutputDevice& mrOutputDevice;
+
+ // the vector of registered OverlayObjects
+ OverlayObjectVector maOverlayObjects;
+
+ // Stripe support. All striped OverlayObjects use these stripe
+ // values. Changes change all those objects.
+ Color maStripeColorA; // defaults to COL_BLACK
+ Color maStripeColorB; // defaults to COL_WHITE
+ sal_uInt32 mnStripeLengthPixel; // defaults to 4L
+
+ // hold buffered the logic length of discrete vector (1.0, 0.0) and the
+ // view transformation belonging to it. Update happens in getDiscreteOne()
+ basegfx::B2DHomMatrix maViewTransformation;
+ drawinglayer::geometry::ViewInformation2D maViewInformation2D;
+ double mfDiscreteOne;
+
+ // internal
+ void ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const;
+ void ImpStripeDefinitionChanged();
+ void impApplyRemoveActions(OverlayObject& rTarget);
+ void impApplyAddActions(OverlayObject& rTarget);
+
+ // return mfDiscreteOne to derivations, but also check for buffered local
+ // ViewTransformation and evtl. correct mfDiscreteOne
+ double getDiscreteOne() const;
+
+ tools::Rectangle RangeToInvalidateRectangle(const basegfx::B2DRange& rRange) const;
+
+ OverlayManager(OutputDevice& rOutputDevice);
+ virtual ~OverlayManager() override;
+
+ public:
+ static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice);
+
+ // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D
+ drawinglayer::geometry::ViewInformation2D const & getCurrentViewInformation2D() const;
+
+ // complete redraw
+ virtual void completeRedraw(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice = nullptr) const;
+
+ // flush. Do buffered updates.
+ virtual void flush();
+
+ // get the OutputDevice
+ OutputDevice& getOutputDevice() const { return mrOutputDevice; }
+
+ // add and remove OverlayObjects
+ void add(OverlayObject& rOverlayObject);
+ void remove(OverlayObject& rOverlayObject);
+
+ // invalidate the given range at local OutputDevice
+ virtual void invalidateRange(const basegfx::B2DRange& rRange);
+
+ // stripe support ColA
+ const Color& getStripeColorA() const { return maStripeColorA; }
+ void setStripeColorA(Color aNew);
+
+ // stripe support ColB
+ const Color& getStripeColorB() const { return maStripeColorB; }
+ void setStripeColorB(Color aNew);
+
+ // stripe support StripeLengthPixel
+ sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; }
+ void setStripeLengthPixel(sal_uInt32 nNew);
+
+ void InsertEvent(sdr::animation::Event& rNew) { Scheduler::InsertEvent(rNew); }
+ };
+
+} // end of namespace sdr::overlay
+
+#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/overlay/overlayobject.hxx b/include/svx/sdr/overlay/overlayobject.hxx
new file mode 100644
index 000000000..d4ef56646
--- /dev/null
+++ b/include/svx/sdr/overlay/overlayobject.hxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECT_HXX
+#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECT_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <tools/color.hxx>
+#include <svx/sdr/animation/scheduler.hxx>
+#include <svx/svxdllapi.h>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+
+#include <vector>
+
+class OutputDevice;
+
+namespace sdr::overlay
+{
+ class OverlayManager;
+}
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DPolyPolygon;
+ class B2DRange;
+}
+
+namespace sdr::overlay
+ {
+ class SVXCORE_DLLPUBLIC OverlayObject : public sdr::animation::Event
+ {
+ private:
+ OverlayObject(const OverlayObject&) = delete;
+ OverlayObject& operator=(const OverlayObject&) = delete;
+
+ // Manager is allowed access to private Member mpOverlayManager
+ friend class OverlayManager;
+
+ // pointer to OverlayManager, if object is added. Changed by
+ // OverlayManager, do not change Yourself.
+ OverlayManager* mpOverlayManager;
+
+ // Primitive2DContainer of the OverlayObject
+ drawinglayer::primitive2d::Primitive2DContainer maPrimitive2DSequence;
+
+ // Possible Offset added to the geometry (automatically in
+ // createOverlayObjectPrimitive2DSequence()). Usually zero, may
+ // be used e.g. from calc when GridOffset is needed
+ basegfx::B2DVector maOffset;
+
+ protected:
+ // access methods to maPrimitive2DSequence. The usage of this methods may allow
+ // later thread-safe stuff to be added if needed. Only to be used by getPrimitive2DSequence()
+ // implementations for buffering the last decomposition.
+ // Resetting is allowed e.g. in ::getOverlayObjectPrimitive2DSequence() implementations
+ // if the conditions have changed to force a re-creation in calling the base implementation.
+ // The only allowed setter of maPrimitive2DSequence is
+ // OverlayObject::getOverlayObjectPrimitive2DSequence() which should be called by calling
+ // the base implementation in derived functions. That one will use the result of
+ // createOverlayObjectPrimitive2DSequence() to provide the geometry.
+ const drawinglayer::primitive2d::Primitive2DContainer& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
+ void resetPrimitive2DSequence() { maPrimitive2DSequence.clear(); }
+
+ // the creation method for Primitive2DContainer. Called when getPrimitive2DSequence()
+ // sees that maPrimitive2DSequence is empty. Needs to be supported by all
+ // OverlayObject implementations. Default implementation will assert
+ // a missing implementation
+ virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence();
+
+ // #i53216# check blink time value range (currently 25 < mnBlinkTime < 10000)
+ static sal_uInt32 impCheckBlinkTimeValueRange(sal_uInt64 nBlinkTime);
+
+ // region in logical coordinates
+ basegfx::B2DRange maBaseRange;
+
+ // base color of this OverlayObject
+ Color maBaseColor;
+
+ // Flag for visibility
+ bool mbIsVisible : 1;
+
+ // Flag to control hittability
+ bool mbIsHittable : 1;
+
+ // Flag to hold info if this objects supports animation. Default is
+ // false. If true, the Trigger() method should be overridden
+ // to implement the animation effect and to re-initiate the event.
+ bool mbAllowsAnimation : 1;
+
+ // Flag to control if this OverlayObject allows AntiAliased visualisation.
+ // Default is true, but e.g. for selection visualisation in SC and SW,
+ // it is switched to false
+ bool mbAllowsAntiAliase : 1;
+
+ // set changed flag. Call after change, since the old range is invalidated
+ // and then the new one is calculated and invalidated, too. This will only
+ // work after the change.
+ void objectChange();
+
+ // write access to AntiAliase flag. This is protected since
+ // only implementations are allowed to change this, preferably in their
+ // constructor
+ void allowAntiAliase(bool bNew);
+
+ public:
+ explicit OverlayObject(Color aBaseColor);
+ virtual ~OverlayObject() override;
+
+ // get OverlayManager
+ OverlayManager* getOverlayManager() const { return mpOverlayManager; }
+
+ // the access method for Primitive2DContainer. Will use createPrimitive2DSequence and
+ // setPrimitive2DSequence if needed. Overriding may be used to allow disposal of last
+ // created primitives to react on changed circumstances and to re-create primitives
+ virtual drawinglayer::primitive2d::Primitive2DContainer getOverlayObjectPrimitive2DSequence() const;
+
+ // access to visibility state
+ bool isVisible() const { return mbIsVisible; }
+ void setVisible(bool bNew);
+
+ // access to hittable flag
+ bool isHittable() const { return mbIsHittable; }
+ void setHittable(bool bNew);
+
+ // read access to AntiAliase flag
+ bool allowsAntiAliase() const { return mbAllowsAntiAliase; }
+
+ // read access to baseRange. This may trigger createBaseRange() if
+ // object is changed.
+ const basegfx::B2DRange& getBaseRange() const;
+
+ // access to baseColor
+ const Color& getBaseColor() const { return maBaseColor; }
+ void setBaseColor(Color aNew);
+
+ // access to Offset
+ const basegfx::B2DVector& getOffset() const { return maOffset; }
+ void setOffset(const basegfx::B2DVector& rOffset);
+
+ // execute event from base class sdr::animation::Event. Default
+ // implementation does nothing and does not create a new event.
+ virtual void Trigger(sal_uInt32 nTime) override;
+
+ // access to AllowsAnimation flag
+ bool allowsAnimation() const { return mbAllowsAnimation; }
+
+ // stripe definition has changed. The OverlayManager does have
+ // support data to draw graphics in two colors striped. This
+ // method notifies the OverlayObject if that change takes place.
+ // Default implementation does nothing.
+ virtual void stripeDefinitionHasChanged();
+ };
+
+ // typedefs for a vector of OverlayObjects
+ typedef ::std::vector< OverlayObject* > OverlayObjectVector;
+
+} // end of namespace sdr::overlay
+
+namespace sdr::overlay
+ {
+ class SVXCORE_DLLPUBLIC OverlayObjectWithBasePosition : public OverlayObject
+ {
+ protected:
+ // base position in logical coordinates
+ basegfx::B2DPoint maBasePosition;
+
+ public:
+ OverlayObjectWithBasePosition(const basegfx::B2DPoint& rBasePos, Color aBaseColor);
+ virtual ~OverlayObjectWithBasePosition() override;
+
+ // access to basePosition
+ const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
+ void setBasePosition(const basegfx::B2DPoint& rNew);
+ };
+
+} // end of namespace sdr::overlay
+
+#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/overlay/overlayobjectlist.hxx b/include/svx/sdr/overlay/overlayobjectlist.hxx
new file mode 100644
index 000000000..6985a1b5a
--- /dev/null
+++ b/include/svx/sdr/overlay/overlayobjectlist.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECTLIST_HXX
+#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECTLIST_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+#include <memory>
+#include <vector>
+
+
+class Point;
+
+namespace sdr::overlay
+ {
+ class SVXCORE_DLLPUBLIC OverlayObjectList final
+ {
+ // the vector of OverlayObjects
+ ::std::vector< std::unique_ptr<OverlayObject> > maVector;
+
+ public:
+ OverlayObjectList() {}
+ OverlayObjectList(const OverlayObjectList&) = delete;
+ OverlayObjectList& operator=(const OverlayObjectList&) = delete;
+ ~OverlayObjectList();
+
+ // clear list, this includes deletion of all contained objects
+ void clear();
+
+ // append objects (takes ownership)
+ void append(std::unique_ptr<OverlayObject> pOverlayObject);
+
+ // access to objects
+ sal_uInt32 count() const { return maVector.size(); }
+ OverlayObject& getOverlayObject(sal_uInt32 nIndex) const { return *(maVector[nIndex]); }
+
+ // Hittest with logical coordinates
+ bool isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance = 0.0) const;
+
+ // Hittest with pixel coordinates
+ bool isHitPixel(const Point& rDiscretePosition) const;
+
+ // calculate BaseRange of all included OverlayObjects and return
+ basegfx::B2DRange getBaseRange() const;
+ };
+
+} // end of namespace sdr::overlay
+
+
+#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECTLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/overlay/overlaypolypolygon.hxx b/include/svx/sdr/overlay/overlaypolypolygon.hxx
new file mode 100644
index 000000000..d3aa2074d
--- /dev/null
+++ b/include/svx/sdr/overlay/overlaypolypolygon.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX
+#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+
+namespace sdr::overlay
+{
+ class SVXCORE_DLLPUBLIC OverlayPolyPolygon final : public OverlayObject
+ {
+ private:
+ basegfx::B2DPolyPolygon maLinePolyPolygon;
+ double mfLineWidth;
+ Color maFillColor;
+
+ virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override;
+
+ public:
+ explicit OverlayPolyPolygon(const basegfx::B2DPolyPolygon& rLinePolyPolygon,
+ Color const & rLineColor,
+ double mfLineWidth,
+ Color const & rFillColor);
+ virtual ~OverlayPolyPolygon() override;
+ };
+
+ class SVXCORE_DLLPUBLIC OverlayPolyPolygonStripedAndFilled final : public OverlayObject
+ {
+ // geometry
+ basegfx::B2DPolyPolygon maLinePolyPolygon;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override;
+
+ public:
+ explicit OverlayPolyPolygonStripedAndFilled(
+ const basegfx::B2DPolyPolygon& rLinePolyPolygon);
+ virtual ~OverlayPolyPolygonStripedAndFilled() override;
+
+ // change geometry
+ const basegfx::B2DPolyPolygon& getLinePolyPolygon() const { return maLinePolyPolygon; }
+
+ // react on stripe definition change
+ virtual void stripeDefinitionHasChanged() override;
+ };
+
+} // end of namespace sdr::overlay
+
+
+#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx b/include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx
new file mode 100644
index 000000000..06e7428de
--- /dev/null
+++ b/include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX
+#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+
+
+namespace sdr::overlay
+ {
+ class SVXCORE_DLLPUBLIC OverlayPrimitive2DSequenceObject final : public OverlayObjectWithBasePosition
+ {
+ // the sequence of primitives to show
+ const drawinglayer::primitive2d::Primitive2DContainer maSequence;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override;
+
+ public:
+ explicit OverlayPrimitive2DSequenceObject(drawinglayer::primitive2d::Primitive2DContainer&& rSequence);
+
+ virtual ~OverlayPrimitive2DSequenceObject() override;
+ };
+
+} // end of namespace sdr::overlay
+
+
+#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/overlay/overlayselection.hxx b/include/svx/sdr/overlay/overlayselection.hxx
new file mode 100644
index 000000000..d456ac6bf
--- /dev/null
+++ b/include/svx/sdr/overlay/overlayselection.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYSELECTION_HXX
+#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYSELECTION_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+
+namespace sdr::overlay
+ {
+ // overlay type definition
+ enum class OverlayType
+ {
+ Invert,
+ Solid,
+ Transparent
+ };
+
+ class SVXCORE_DLLPUBLIC OverlaySelection final : public OverlayObject
+ {
+ // type of overlay
+ OverlayType meOverlayType;
+
+ // geometry of overlay
+ std::vector< basegfx::B2DRange > maRanges;
+
+ // Values of last primitive creation. These are checked in getOverlayObjectPrimitive2DSequence
+ // to evtl. get rid of last Primitive2DContainer. This ensures that these values are up-to-date
+ // and are usable when creating primitives
+ OverlayType maLastOverlayType;
+ sal_uInt16 mnLastTransparence;
+
+ bool mbBorder : 1;
+
+ // geometry creation for OverlayObject, can use local *Last* values
+ virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override;
+
+ public:
+ OverlaySelection(
+ OverlayType eType,
+ const Color& rColor,
+ std::vector< basegfx::B2DRange >&& rRanges,
+ bool bBorder);
+ virtual ~OverlaySelection() override;
+
+ // data read access
+ const std::vector< basegfx::B2DRange >& getRanges() const { return maRanges; }
+
+ /// override to check conditions for last createOverlayObjectPrimitive2DSequence
+ virtual drawinglayer::primitive2d::Primitive2DContainer getOverlayObjectPrimitive2DSequence() const override;
+
+ // data write access
+ void setRanges(std::vector< basegfx::B2DRange >&& rNew);
+ };
+} // end of namespace sdr::overlay
+
+
+#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYSELECTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx
new file mode 100644
index 000000000..40638aa9d
--- /dev/null
+++ b/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRFRAMEBORDERPRIMITIVE2D_HXX
+#define INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRFRAMEBORDERPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
+#include <svx/framelink.hxx>
+
+#include <memory>
+
+// predefines
+
+namespace drawinglayer::primitive2d
+ {
+ class SVXCORE_DLLPUBLIC SdrFrameBorderData
+ {
+ private:
+ basegfx::B2DPoint maOrigin; /// start point of borderline
+ basegfx::B2DVector maX; /// X-Axis of borderline with length
+ svx::frame::Style maStyle; /// Style of borderline
+ Color maColor;
+ bool mbForceColor;
+
+ class SdrConnectStyleData
+ {
+ private:
+ svx::frame::Style maStyle;
+ basegfx::B2DVector maNormalizedPerpendicular;
+ bool mbStyleMirrored;
+
+ public:
+ SdrConnectStyleData(
+ const svx::frame::Style& rStyle,
+ const basegfx::B2DVector& rNormalizedPerpendicular,
+ bool bStyleMirrored);
+
+ const svx::frame::Style& getStyle() const { return maStyle; }
+ const basegfx::B2DVector& getNormalizedPerpendicular() const { return maNormalizedPerpendicular; }
+ bool getStyleMirrored() const { return mbStyleMirrored; }
+ bool operator==(const SdrConnectStyleData& rCompare) const;
+ };
+
+ std::vector<SdrConnectStyleData> maStart;
+ std::vector<SdrConnectStyleData> maEnd;
+
+ public:
+ SdrFrameBorderData(
+ const basegfx::B2DPoint& rOrigin,
+ const basegfx::B2DVector& rX,
+ const svx::frame::Style& rStyle,
+ const Color* pForceColor);
+
+ void addSdrConnectStyleData(
+ bool bStart,
+ const svx::frame::Style& rStyle,
+ const basegfx::B2DVector& rNormalizedPerpendicular,
+ bool bStyleMirrored);
+
+ void create2DDecomposition(
+ Primitive2DContainer& rContainer,
+ double fMinDiscreteUnit) const;
+
+ double getMinimalNonZeroBorderWidth() const;
+ bool operator==(const SdrFrameBorderData& rCompare) const;
+ };
+
+ typedef std::vector<SdrFrameBorderData> SdrFrameBorderDataVector;
+
+} // end of namespace drawinglayer::primitive2d
+
+namespace drawinglayer::primitive2d
+ {
+ class SVXCORE_DLLPUBLIC SdrFrameBorderPrimitive2D final : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ std::shared_ptr<SdrFrameBorderDataVector> maFrameBorders;
+ double mfMinimalNonZeroBorderWidth;
+ double mfMinimalNonZeroBorderWidthUsedForDecompose;
+ bool mbForceToSingleDiscreteUnit;
+
+ // local decomposition.
+ virtual void create2DDecomposition(
+ Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& aViewInformation) const override;
+
+ public:
+ SdrFrameBorderPrimitive2D(
+ std::shared_ptr<SdrFrameBorderDataVector>& rFrameBorders,
+ bool bForceToSingleDiscreteUnit);
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ // override to get view-dependent
+ virtual void get2DDecomposition(
+ Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+ // data access
+ const std::shared_ptr<SdrFrameBorderDataVector>& getFrameBorders() const { return maFrameBorders; }
+ bool doForceToSingleDiscreteUnit() const { return mbForceToSingleDiscreteUnit; }
+
+ // provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+ };
+
+} // end of namespace drawinglayer::primitive2d
+
+
+#endif // INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRFRAMEBORDERPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
new file mode 100644
index 000000000..917d22f14
--- /dev/null
+++ b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_PRIMITIVE2D_SVX_PRIMITIVETYPES2D_HXX
+#define INCLUDED_SVX_SDR_PRIMITIVE2D_SVX_PRIMITIVETYPES2D_HXX
+
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+
+
+#define PRIMITIVE2D_ID_SDRCAPTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 0)
+#define PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 1)
+#define PRIMITIVE2D_ID_SDRCUSTOMSHAPEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 2)
+#define PRIMITIVE2D_ID_SDRELLIPSEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 3)
+#define PRIMITIVE2D_ID_SDRELLIPSESEGMENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 4)
+#define PRIMITIVE2D_ID_SDRGRAFPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 5)
+#define PRIMITIVE2D_ID_SDRMEASUREPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 6)
+#define PRIMITIVE2D_ID_SDROLE2PRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 7)
+#define PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 8)
+#define PRIMITIVE2D_ID_SDRRECTANGLEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 9)
+#define PRIMITIVE2D_ID_SDRCONTOURTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 10)
+#define PRIMITIVE2D_ID_SDRPATHTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 11)
+#define PRIMITIVE2D_ID_SDRBLOCKTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 12)
+#define PRIMITIVE2D_ID_SDRSTRETCHTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 13)
+#define PRIMITIVE2D_ID_SDRCELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 14)
+#define PRIMITIVE2D_ID_OVERLAYBITMAPEXPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 15)
+#define PRIMITIVE2D_ID_OVERLAYCROSSHAIRPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 16)
+#define PRIMITIVE2D_ID_OVERLAYRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 17)
+#define PRIMITIVE2D_ID_OVERLAYHELPLINESTRIPEDPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 18)
+#define PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 19)
+#define PRIMITIVE2D_ID_SDRCONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 20)
+#define PRIMITIVE2D_ID_SDROLECONTENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 21)
+#define PRIMITIVE2D_ID_SDRAUTOFITTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 22)
+#define PRIMITIVE2D_ID_SDRCHAINEDTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 23)
+#define PRIMITIVE2D_ID_SDRFRAMEBORDERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 24)
+#define PRIMITIVE2D_ID_OVERLAYDIAGRAMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 25)
+#define PRIMITIVE2D_ID_SLIDEBACKGROUNDFILLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 26)
+
+
+#endif // INCLUDED_SVX_SDR_PRIMITIVE2D_SVX_PRIMITIVETYPES2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/properties/defaultproperties.hxx b/include/svx/sdr/properties/defaultproperties.hxx
new file mode 100644
index 000000000..bae37df27
--- /dev/null
+++ b/include/svx/sdr/properties/defaultproperties.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_PROPERTIES_DEFAULTPROPERTIES_HXX
+#define INCLUDED_SVX_SDR_PROPERTIES_DEFAULTPROPERTIES_HXX
+
+#include <sal/config.h>
+
+#include <optional>
+
+#include <svx/sdr/properties/properties.hxx>
+#include <svx/svxdllapi.h>
+#include <svl/itemset.hxx>
+#include <o3tl/span.hxx>
+
+struct _xmlTextWriter;
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+
+namespace sdr::properties
+ {
+ class SVXCORE_DLLPUBLIC DefaultProperties : public BaseProperties
+ {
+ protected:
+ // the to be used ItemSet
+ mutable std::optional<SfxItemSet> mxItemSet;
+
+ // create a new object specific itemset with object specific ranges.
+ virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) override;
+
+ // Test changeability for a single item. If an implementation wants to prevent
+ // changing an item it should override this method.
+ virtual bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) const;
+
+ // Do the internal ItemChange. If only nWhich is given, the item needs to be cleared.
+ // Also needs to handle if nWhich and pNewItem is 0, which means to clear all items.
+ virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr);
+
+ // Called after ItemChange() is done for all items. Allows local reactions on
+ // specific item changes
+ virtual void PostItemChange(const sal_uInt16 nWhich);
+
+ // Internally react on ItemSet changes. The given span contains changed items.
+ // If nDeletedWhich is not 0, it indicates a deleted item.
+ virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich);
+
+ // check if SfxItemSet exists
+ bool HasSfxItemSet() const { return bool(mxItemSet); }
+
+ public:
+ // basic constructor
+ explicit DefaultProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ DefaultProperties(const DefaultProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~DefaultProperties() override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const override;
+
+ // get itemset
+ virtual const SfxItemSet& GetObjectItemSet() const override;
+
+ // set single item
+ virtual void SetObjectItem(const SfxPoolItem& rItem) override;
+
+ // set single item direct, do not do any notifies or things like that
+ virtual void SetObjectItemDirect(const SfxPoolItem& rItem) override;
+
+ // clear single item
+ virtual void ClearObjectItem(const sal_uInt16 nWhich = 0) override;
+
+ // clear single item direct, do not do any notifies or things like that.
+ // Also supports complete deletion of items when default parameter 0 is used.
+ virtual void ClearObjectItemDirect(const sal_uInt16 nWhich) override;
+
+ // set complete item set
+ virtual void SetObjectItemSet(const SfxItemSet& rSet) override;
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool bBroadcast) override;
+
+ // get the installed StyleSheet
+ virtual SfxStyleSheet* GetStyleSheet() const override;
+
+ // force default attributes for a specific object type, called from
+ // DefaultProperties::GetObjectItemSet() if a new ItemSet is created.
+ // Default implementation does nothing.
+ virtual void ForceDefaultAttributes();
+ };
+
+} // end of namespace sdr::properties
+
+#endif // INCLUDED_SVX_SDR_PROPERTIES_DEFAULTPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/properties/properties.hxx b/include/svx/sdr/properties/properties.hxx
new file mode 100644
index 000000000..d793753c6
--- /dev/null
+++ b/include/svx/sdr/properties/properties.hxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_PROPERTIES_PROPERTIES_HXX
+#define INCLUDED_SVX_SDR_PROPERTIES_PROPERTIES_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+#include <svl/typedwhich.hxx>
+
+struct _xmlTextWriter;
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+class SdrObject;
+class SfxItemSet;
+class SfxPoolItem;
+class SfxStyleSheet;
+class Fraction;
+class SfxItemPool;
+class SdrModel;
+
+namespace sdr::properties
+{
+ class ItemChangeBroadcaster;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// BaseProperties
+// DefaultProperties ->SfxItemSet
+// AttributeProperties ->SfxStyleSheet
+// E3dProperties
+// E3dCompoundProperties
+// E3dExtrudeProperties
+// E3dLatheProperties
+// E3dSphereProperties
+// E3dSceneProperties
+// TextProperties ->maVersion
+// ConnectorProperties
+// CustomShapeProperties
+// MeasureProperties
+// RectangleProperties
+// CaptionProperties
+// CircleProperties
+// GraphicProperties
+// OleProperties
+// CellProperties
+// TableProperties
+// GroupProperties
+// EmptyProperties
+// PageProperties
+
+namespace sdr::properties
+ {
+ class SVXCORE_DLLPUBLIC BaseProperties
+ {
+ private:
+ // the owner of this Properties. Set from constructor and not
+ // to be changed in any way.
+ SdrObject& mrObject;
+
+ protected:
+ // internal access to SdrObject
+ const SdrObject& GetSdrObject() const;
+
+ SdrObject& GetSdrObject();
+
+ public:
+ // basic constructor, used from SdrObject.
+ explicit BaseProperties(SdrObject& rObj);
+
+ // destructor
+ virtual ~BaseProperties();
+
+ virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) = 0;
+
+ // Clone() operator, normally just calls the local copy constructor,
+ // see above.
+ virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const = 0;
+
+ // Get the local ItemSet. This directly returns the local ItemSet of the object. No
+ // merging of ItemSets is done for e.g. Group objects.
+ virtual const SfxItemSet& GetObjectItemSet() const = 0;
+
+ // get merged ItemSet. Normally, this maps directly to GetObjectItemSet(), but may
+ // be overridden e.g for group objects to return a merged ItemSet of the object.
+ // When using this method the returned ItemSet may contain items in the state
+ // SfxItemState::DONTCARE which means there were several such items with different
+ // values.
+ virtual const SfxItemSet& GetMergedItemSet() const;
+
+ // Sets all items which are on state SfxItemState::SET in rSet at the local ItemSet.
+ // Uses AllowItemChange(), ItemChange(), PostItemChange() and ItemSetChanged() calls.
+ virtual void SetObjectItemSet(const SfxItemSet& rSet) = 0;
+
+ // Set merged ItemSet. Normally, this maps to SetObjectItemSet().
+ virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false);
+
+ // Set single item at the local ItemSet. Uses AllowItemChange(),
+ // ItemChange(), PostItemChange() and ItemSetChanged() calls.
+ virtual void SetObjectItem(const SfxPoolItem& rItem) = 0;
+
+ // Set a single item direct. Only uses AllowItemChange() and ItemChange(),
+ // but not PostItemChange() and ItemSetChanged() calls.
+ virtual void SetObjectItemDirect(const SfxPoolItem& rItem) = 0;
+
+ // Clear a single local item. Uses AllowItemChange(),
+ // ItemChange(), PostItemChange() and ItemSetChanged() calls.
+ virtual void ClearObjectItem(const sal_uInt16 nWhich = 0) = 0;
+
+ // Set a single item, iterate over hierarchies if necessary. Default
+ // Implementation falls back to ClearObjectItem().
+ virtual void SetMergedItem(const SfxPoolItem& rItem);
+
+ // Clear a single item, iterate over hierarchies if necessary. Default
+ // Implementation falls back to ClearObjectItem().
+ virtual void ClearMergedItem(const sal_uInt16 nWhich);
+
+ // Clear single item direct. Only uses AllowItemChange() and ItemChange(),
+ // but not PostItemChange() and ItemSetChanged() calls.
+ // Also supports complete deletion of items when default parameter 0 is used.
+ virtual void ClearObjectItemDirect(const sal_uInt16 nWhich) = 0;
+
+ // Set a new StyleSheet. Registers as listener at the StyleSheet to get knowledge
+ // of StyleSheet changes.
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool bBroadcast) = 0;
+
+ // Get the installed StyleSheet.
+ virtual SfxStyleSheet* GetStyleSheet() const = 0;
+
+ // force all attributes which come from styles to hard attributes
+ // to be able to live without the style.
+ virtual void ForceStyleToHardAttributes();
+
+ // syntactical sugar for ItemSet accesses. Broadcasts before and after the changes
+ // to invalidate views in old and new BoundRects. As soon as the repaint mechanism
+ // will be changed these broadcasts will no longer be needed.
+ //void SetItemAndBroadcast(const SfxPoolItem& rItem);
+ //void ClearItemAndBroadcast(const sal_uInt16 nWhich = 0);
+ void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems = false);
+
+ // Just a convenient shortcut for GetObjectItemSet().Get(nWhich).
+ const SfxPoolItem& GetItem(const sal_uInt16 nWhich) const;
+ template<class T> const T& GetItem(TypedWhichId<T> nWhich) const
+ {
+ return static_cast<const T&>(GetItem(sal_uInt16(nWhich)));
+ }
+
+ // support for convenient broadcasting. Used from SetMergedItemAndBroadcast(),
+ // ClearItemAndBroadcast() and SetItemSetAndBroadcast(), see above.
+ // But also from inside SdrObjects.
+ void BroadcastItemChange(const ItemChangeBroadcaster& rChange);
+
+ // #i101556# add versioning mechanism; used from e.g. text attribute set to
+ // allow detection of e.g. style sheet or single text attribute changes. The
+ // default implementation returns 0 (zero)
+ virtual sal_uInt32 getVersion() const;
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
+ };
+
+ // checks the FillStyle item and removes unneeded Gradient, FillBitmap and Hatch items
+ void SVXCORE_DLLPUBLIC CleanupFillProperties( SfxItemSet& rItemSet );
+
+} // end of namespace sdr::properties
+
+#endif // INCLUDED_SVX_SDR_PROPERTIES_PROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx
new file mode 100644
index 000000000..ab9f1d28f
--- /dev/null
+++ b/include/svx/sdr/table/tablecontroller.hxx
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_TABLE_TABLECONTROLLER_HXX
+#define INCLUDED_SVX_SDR_TABLE_TABLECONTROLLER_HXX
+
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <rtl/ref.hxx>
+
+#include <svx/sdr/overlay/overlayobjectlist.hxx>
+#include <svx/selectioncontroller.hxx>
+#include <svx/svdotable.hxx>
+#include <svx/svdview.hxx>
+#include <optional>
+
+struct ImplSVEvent;
+class SdrView;
+class SdrObject;
+class SfxItemSet;
+class SvxBoxInfoItem;
+class SvxBoxItem;
+
+namespace sdr::table {
+
+class TableModel;
+
+class SVXCORE_DLLPUBLIC SvxTableController final : public sdr::SelectionController
+{
+public:
+ SVX_DLLPRIVATE SvxTableController(
+ SdrView& rView,
+ const SdrTableObj& rObj);
+ SVX_DLLPRIVATE virtual ~SvxTableController() override;
+
+ // from sdr::SelectionController
+ SVX_DLLPRIVATE virtual bool onKeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) override;
+ SVX_DLLPRIVATE virtual bool onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) override;
+ SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) override;
+ SVX_DLLPRIVATE virtual bool onMouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) override;
+
+ SVX_DLLPRIVATE bool HasMarked() const;
+ SVX_DLLPRIVATE virtual bool DeleteMarked() override;
+
+ SVX_DLLPRIVATE virtual void onSelectionHasChanged() override;
+ SVX_DLLPRIVATE virtual void onSelectAll() override;
+
+ SVX_DLLPRIVATE virtual void GetState( SfxItemSet& rSet ) override;
+ virtual void Execute( SfxRequest& rReq ) override;
+
+ SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const override;
+ SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr ) override;
+
+ SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ) override;
+
+ // slots
+ SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = nullptr );
+ SVX_DLLPRIVATE void onDelete( sal_uInt16 nSId );
+ SVX_DLLPRIVATE void onSelect( sal_uInt16 nSId );
+ SVX_DLLPRIVATE void onFormatTable(const SfxRequest& rReq);
+ SVX_DLLPRIVATE void MergeMarkedCells();
+ SVX_DLLPRIVATE void SplitMarkedCells(const SfxRequest& rReq);
+ SVX_DLLPRIVATE void DistributeColumns( const bool bOptimize, const bool bMinimize );
+ SVX_DLLPRIVATE void DistributeRows( const bool bOptimize, const bool bMinimize );
+ SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId );
+ SVX_DLLPRIVATE void changeTableEdge(const SfxRequest& rReq);
+
+ SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create(
+ SdrView& rView,
+ const SdrTableObj& rObj,
+ const rtl::Reference< sdr::SelectionController >& xRefController);
+
+ SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const;
+ SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll);
+ void SetAttrToSelectedShape(const SfxItemSet& rAttr);
+ /** Fill the values that are common for all selected cells.
+ *
+ * This lets the Borders dialog to display the line arrangement
+ * properly.
+ */
+ SVX_DLLPRIVATE void FillCommonBorderAttrFromSelectedCells(SvxBoxItem& rBox, SvxBoxInfoItem& rBoxInfo) const;
+
+ SVX_DLLPRIVATE virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const override;
+ SVX_DLLPRIVATE virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) override;
+
+ SVX_DLLPRIVATE virtual SdrObject* GetMarkedSdrObjClone( SdrModel& rTargetModel ) override;
+ SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel ) override;
+
+ SVX_DLLPRIVATE virtual bool hasSelectedCells() const override { return mbCellSelectionMode || mrView.IsTextEdit(); }
+ /// @see sdr::SelectionController::setCursorLogicPosition().
+ SVX_DLLPRIVATE virtual bool setCursorLogicPosition(const Point& rPosition, bool bPoint) override;
+
+ /// @see sdr::SelectionController::getSelectedCells().
+ void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos ) override;
+ void setSelectedCells( const CellPos& rFirstPos, const CellPos& rLastPos );
+
+ virtual bool ChangeFontSize(bool bGrow, const FontList* pFontList) override;
+
+ void clearSelection();
+ void selectAll();
+
+ SVX_DLLPRIVATE void onTableModified();
+
+ bool selectRow( sal_Int32 row );
+ bool selectColumn( sal_Int32 column );
+ bool deselectRow( sal_Int32 row );
+ bool deselectColumn( sal_Int32 column );
+ bool isRowSelected( sal_Int32 nRow );
+ bool isColumnSelected( sal_Int32 nColumn );
+ bool isRowHeader();
+ bool isColumnHeader();
+ sdr::table::SdrTableObj* GetTableObj() { return mxTableObj.get(); }
+private:
+ SvxTableController(SvxTableController const &) = delete;
+ SvxTableController& operator =(SvxTableController const &) = delete;
+
+ // internals
+ enum class TblAction
+ {
+ NONE,
+ GotoFirstCell, GotoFirstColumn, GotoFirstRow,
+ GotoLeftCell, GotoUpCell, GotoRightCell, GotoDownCell,
+ GotoLastCell, GotoLastColumn, GotoLastRow,
+ EditCell, StopTextEdit,
+ RemoveSelection,
+ HandledByView, Tab
+ };
+ SVX_DLLPRIVATE void ApplyBorderAttr( const SfxItemSet& rAttr );
+ SVX_DLLPRIVATE void UpdateTableShape();
+
+ SVX_DLLPRIVATE void SetTableStyle( const SfxItemSet* pArgs );
+ SVX_DLLPRIVATE void SetTableStyleSettings( const SfxItemSet* pArgs );
+
+ SVX_DLLPRIVATE bool PasteObject( SdrTableObj const * pPasteTableObj );
+
+ SVX_DLLPRIVATE bool checkTableObject();
+ SVX_DLLPRIVATE const CellPos& getSelectionStart();
+ SVX_DLLPRIVATE void setSelectionStart( const CellPos& rPos );
+ SVX_DLLPRIVATE const CellPos& getSelectionEnd();
+ SVX_DLLPRIVATE void checkCell( CellPos& rPos ) const;
+
+ SVX_DLLPRIVATE void MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow );
+
+ SVX_DLLPRIVATE void EditCell(const CellPos& rPos, vcl::Window* pWindow, TblAction nAction);
+ SVX_DLLPRIVATE void StopTextEdit();
+
+ SVX_DLLPRIVATE TblAction getKeyboardAction(const KeyEvent& rKEvt);
+ SVX_DLLPRIVATE bool executeAction(TblAction nAction, bool bSelect, vcl::Window* pWindow);
+ SVX_DLLPRIVATE void gotoCell(const CellPos& rCell, bool bSelect, vcl::Window* pWindow, TblAction nAction = TblAction::NONE);
+
+ SVX_DLLPRIVATE void StartSelection( const CellPos& rPos );
+ SVX_DLLPRIVATE void UpdateSelection( const CellPos& rPos );
+ SVX_DLLPRIVATE void RemoveSelection();
+ SVX_DLLPRIVATE void updateSelectionOverlay();
+ SVX_DLLPRIVATE void destroySelectionOverlay();
+
+ SVX_DLLPRIVATE void findMergeOrigin( CellPos& rPos );
+
+ DECL_DLLPRIVATE_LINK( UpdateHdl, void *, void );
+
+ //TableModelRef mxTable;
+ rtl::Reference< TableModel > mxTable;
+
+ CellPos maCursorFirstPos;
+ CellPos maCursorLastPos;
+ bool mbCellSelectionMode;
+ bool mbHasJustMerged;
+ CellPos maMouseDownPos;
+ bool mbLeftButtonDown;
+ std::optional<sdr::overlay::OverlayObjectList> mpSelectionOverlay;
+ SdrView& mrView;
+ tools::WeakReference<SdrTableObj> mxTableObj;
+ css::uno::Reference< css::util::XModifyListener > mxModifyListener;
+ ImplSVEvent * mnUpdateEvent;
+};
+
+rtl::Reference< sdr::SelectionController > CreateTableController(
+ SdrView& rView,
+ const SdrTableObj& rObj,
+ const rtl::Reference< sdr::SelectionController >& xRefController );
+
+}
+
+#endif // INCLUDED_SVX_SDR_TABLE_TABLECONTROLLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdr/table/tabledesign.hxx b/include/svx/sdr/table/tabledesign.hxx
new file mode 100644
index 000000000..118ebefcc
--- /dev/null
+++ b/include/svx/sdr/table/tabledesign.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDR_TABLE_TABLEDESIGN_HXX
+#define INCLUDED_SVX_SDR_TABLE_TABLEDESIGN_HXX
+
+#include <svx/svxdllapi.h>
+
+#include <com/sun/star/container/XNameAccess.hpp>
+
+namespace sdr::table
+{
+const sal_Int32 first_row_style = 0;
+const sal_Int32 last_row_style = 1;
+const sal_Int32 first_column_style = 2;
+const sal_Int32 last_column_style = 3;
+const sal_Int32 even_rows_style = 4;
+const sal_Int32 odd_rows_style = 5;
+const sal_Int32 even_columns_style = 6;
+const sal_Int32 odd_columns_style = 7;
+const sal_Int32 body_style = 8;
+const sal_Int32 background_style = 9;
+const sal_Int32 style_count = 10;
+
+extern SVX_DLLPUBLIC css::uno::Reference<css::container::XNameAccess> CreateTableDesignFamily();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdrhittesthelper.hxx b/include/svx/sdrhittesthelper.hxx
new file mode 100644
index 000000000..87cf1afbe
--- /dev/null
+++ b/include/svx/sdrhittesthelper.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDRHITTESTHELPER_HXX
+#define INCLUDED_SVX_SDRHITTESTHELPER_HXX
+
+#include <svx/svxdllapi.h>
+
+
+// #i101872# new Object HitTest as View-tooling
+
+
+class Point;
+class SdrObject;
+class SdrPageView;
+class SdrLayerIDSet;
+class SdrObjList;
+namespace sdr::contact { class ViewObjectContact; }
+namespace basegfx { class B2DPoint; }
+namespace drawinglayer::primitive2d { class Primitive2DContainer; }
+
+
+// Wrappers for classic Sdr* Mode/View classes
+
+SVXCORE_DLLPUBLIC SdrObject* SdrObjectPrimitiveHit(
+ const SdrObject& rObject,
+ const Point& rPnt,
+ sal_uInt16 nTol,
+ const SdrPageView& rSdrPageView,
+ const SdrLayerIDSet* pVisiLayer,
+ bool bTextOnly,
+ /// allow getting back an evtl. resulting primitive stack which lead to a hit
+ drawinglayer::primitive2d::Primitive2DContainer* pHitContainer = nullptr);
+
+SVXCORE_DLLPUBLIC SdrObject* SdrObjListPrimitiveHit(
+ const SdrObjList& rList,
+ const Point& rPnt,
+ sal_uInt16 nTol,
+ const SdrPageView& rSdrPageView,
+ const SdrLayerIDSet* pVisiLayer,
+ bool bTextOnly);
+
+
+// the pure HitTest based on a VOC
+
+bool ViewObjectContactPrimitiveHit(
+ const sdr::contact::ViewObjectContact& rVOC,
+ const basegfx::B2DPoint& rHitPosition,
+ double fLogicHitTolerance,
+ bool bTextOnly,
+ /// allow to get back the stack of primitives that lead to the hit
+ drawinglayer::primitive2d::Primitive2DContainer* pHitContainer);
+
+
+#endif // INCLUDED_SVX_SDRHITTESTHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdrmasterpagedescriptor.hxx b/include/svx/sdrmasterpagedescriptor.hxx
new file mode 100644
index 000000000..d7eac22a1
--- /dev/null
+++ b/include/svx/sdrmasterpagedescriptor.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDRMASTERPAGEDESCRIPTOR_HXX
+#define INCLUDED_SVX_SDRMASTERPAGEDESCRIPTOR_HXX
+
+#include <svx/sdrpageuser.hxx>
+#include <svx/svdsob.hxx>
+#include <memory>
+
+class SdrPageProperties;
+namespace sdr::contact { class ViewContact; }
+
+
+namespace sdr
+{
+ class MasterPageDescriptor final : public sdr::PageUser
+ {
+ private:
+ SdrPage& maOwnerPage;
+ SdrPage& maUsedPage;
+ SdrLayerIDSet maVisibleLayers;
+
+ // ViewContact part
+ mutable std::unique_ptr<sdr::contact::ViewContact> mpViewContact;
+
+ void operator=(const MasterPageDescriptor& rCandidate) = delete;
+
+ public:
+ MasterPageDescriptor(SdrPage& aOwnerPage, SdrPage& aUsedPage);
+ virtual ~MasterPageDescriptor();
+
+ // ViewContact part
+ sdr::contact::ViewContact& GetViewContact() const;
+
+ // this method is called from the destructor of the referenced page.
+ // do all necessary action to forget the page. It is not necessary to call
+ // RemovePageUser(), that is done from the destructor.
+ virtual void PageInDestruction(const SdrPage& rPage) override;
+
+ // member access to UsedPage
+ SdrPage& GetUsedPage() const { return maUsedPage; }
+
+ // member access to OwnerPage
+ SdrPage& GetOwnerPage() const { return maOwnerPage; }
+
+ // member access to VisibleLayers
+ const SdrLayerIDSet& GetVisibleLayers() const { return maVisibleLayers; }
+ void SetVisibleLayers(const SdrLayerIDSet& rNew);
+
+ const SdrPageProperties* getCorrectSdrPageProperties() const;
+ };
+} // end of namespace sdr
+
+#endif // INCLUDED_SVX_SDRMASTERPAGEDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdrobjectfilter.hxx b/include/svx/sdrobjectfilter.hxx
new file mode 100644
index 000000000..497bf51a2
--- /dev/null
+++ b/include/svx/sdrobjectfilter.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDROBJECTFILTER_HXX
+#define INCLUDED_SVX_SDROBJECTFILTER_HXX
+
+#include <svx/svxdllapi.h>
+
+class SdrObject;
+
+
+namespace svx
+{
+
+
+ //= SdrObjectFilter
+
+ /** specifies a boolean predicate on the set of all SdrObjects - vulgo a filter.
+ */
+ class SVXCORE_DLLPUBLIC SAL_NO_VTABLE ISdrObjectFilter
+ {
+ public:
+ virtual bool includeObject( const SdrObject& i_rObject ) const = 0;
+
+ virtual ~ISdrObjectFilter() = 0;
+ };
+
+
+}
+
+
+#endif // INCLUDED_SVX_SDROBJECTFILTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdrobjectuser.hxx b/include/svx/sdrobjectuser.hxx
new file mode 100644
index 000000000..f13beeb42
--- /dev/null
+++ b/include/svx/sdrobjectuser.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDROBJECTUSER_HXX
+#define INCLUDED_SVX_SDROBJECTUSER_HXX
+
+#include <vector>
+
+class SdrObject;
+
+// To make things more safe, allow users of an object to register at it. The users need to be derived
+// from sdr::ObjectUser to get a call. The users do not need to call RemoveObjectUser() at the page
+// when they get called from ObjectInDestruction().
+
+namespace sdr
+{
+ class ObjectUser
+ {
+ public:
+ // this method is called from the destructor of the referenced page.
+ // do all necessary action to forget the page. It is not necessary to call
+ // RemovePageUser(), that is done from the destructor.
+ virtual void ObjectInDestruction(const SdrObject& rObject) = 0;
+
+ protected:
+ ~ObjectUser() {}
+ };
+
+ // typedef for ObjectUserVector
+ typedef ::std::vector< ObjectUser* > ObjectUserVector;
+} // end of namespace sdr
+
+#endif // INCLUDED_SVX_SDROBJECTUSER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdrpageuser.hxx b/include/svx/sdrpageuser.hxx
new file mode 100644
index 000000000..8c31a2936
--- /dev/null
+++ b/include/svx/sdrpageuser.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDRPAGEUSER_HXX
+#define INCLUDED_SVX_SDRPAGEUSER_HXX
+
+#include <vector>
+
+class SdrPage;
+
+// To make things more safe, allow users of the page to register at it. The users need to be derived
+// from sdr::PageUser to get a call. The users do not need to call RemovePageUser() at the page
+// when they get called from PageInDestruction().
+
+namespace sdr
+{
+ class PageUser
+ {
+ public:
+ // this method is called from the destructor of the referenced page.
+ // do all necessary action to forget the page. It is not necessary to call
+ // RemovePageUser(), that is done from the destructor.
+ virtual void PageInDestruction(const SdrPage& rPage) = 0;
+
+ protected:
+ ~PageUser() {}
+ };
+
+ // typedef for PageUserVector
+ typedef ::std::vector< PageUser* > PageUserVector;
+} // end of namespace sdr
+
+#endif // INCLUDED_SVX_SDRPAGEUSER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdrpagewindow.hxx b/include/svx/sdrpagewindow.hxx
new file mode 100644
index 000000000..c7278233c
--- /dev/null
+++ b/include/svx/sdrpagewindow.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDRPAGEWINDOW_HXX
+#define INCLUDED_SVX_SDRPAGEWINDOW_HXX
+
+#include <basegfx/range/b2irectangle.hxx>
+#include <svx/svdtypes.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+namespace com::sun::star::awt { class XControlContainer; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace rtl { template <class reference_type> class Reference; }
+namespace sdr::overlay { class OverlayManager; }
+namespace vcl { class Region; }
+
+namespace sdr::contact
+{
+ class ObjectContact;
+ class ViewObjectContactRedirector;
+}
+
+
+namespace basegfx { class B2DRange; }
+
+class SdrPaintWindow;
+class SdrPageView;
+
+class SVXCORE_DLLPUBLIC SdrPageWindow
+{
+ struct Impl;
+
+ std::unique_ptr<Impl> mpImpl;
+
+ SdrPageWindow( const SdrPageWindow& ) = delete;
+ SdrPageWindow& operator= ( const SdrPageWindow& ) = delete;
+
+public:
+ SdrPageWindow(SdrPageView& rNewPageView, SdrPaintWindow& rPaintWindow);
+ ~SdrPageWindow();
+
+ // data read accesses
+ SdrPageView& GetPageView() const;
+ SdrPaintWindow& GetPaintWindow() const;
+ const SdrPaintWindow* GetOriginalPaintWindow() const;
+ css::uno::Reference<css::awt::XControlContainer> const & GetControlContainer( bool _bCreateIfNecessary = true ) const;
+
+ // OVERLAYMANAGER
+ rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const;
+
+ // #i72752# allow patcing SdrPaintWindow from SdrPageView::DrawLayer if needed
+ [[nodiscard]] SdrPaintWindow* patchPaintWindow(SdrPaintWindow& rPaintWindow);
+ void unpatchPaintWindow(SdrPaintWindow* pPreviousPaintWindow);
+
+ // the repaint method. For migration from pPaintProc, use one more parameter
+ void PrePaint();
+ void PrepareRedraw(const vcl::Region& rReg);
+ void RedrawAll( sdr::contact::ViewObjectContactRedirector* pRedirector );
+ void RedrawLayer( const SdrLayerID* pId, sdr::contact::ViewObjectContactRedirector* pRedirector, basegfx::B2IRectangle const*);
+
+ // Invalidate call, used from ObjectContact(OfPageView) in InvalidatePartOfView(...)
+ void InvalidatePageWindow(const basegfx::B2DRange& rRange);
+
+ // #110094# ObjectContact section
+ const sdr::contact::ObjectContact& GetObjectContact() const;
+ sdr::contact::ObjectContact& GetObjectContact();
+ /// determines whether there already exists an ObjectContact
+ bool HasObjectContact() const;
+
+ // #i26631#
+ void ResetObjectContact();
+
+ /** sets all elements in the view which support a design and an alive mode into the given mode
+ */
+ void SetDesignMode( bool _bDesignMode ) const;
+};
+
+#endif // INCLUDED_SVX_SDRPAGEWINDOW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdrpaintwindow.hxx b/include/svx/sdrpaintwindow.hxx
new file mode 100644
index 000000000..d6dee79a9
--- /dev/null
+++ b/include/svx/sdrpaintwindow.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SDRPAINTWINDOW_HXX
+#define INCLUDED_SVX_SDRPAINTWINDOW_HXX
+
+#include <rtl/ref.hxx>
+#include <vcl/virdev.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+class SdrPaintView;
+namespace sdr::overlay { class OverlayManager; }
+
+
+#ifdef _MSC_VER // broken msvc template instantiation
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#endif
+
+/// paint the transparent children of rWin that overlap rPixelRect
+/// (for example, transparent form controls like check boxes)
+void SVXCORE_DLLPUBLIC
+PaintTransparentChildren(vcl::Window const & rWindow, tools::Rectangle const& rPixelRect);
+
+class SdrPreRenderDevice
+{
+ // The original OutputDevice
+ VclPtr<OutputDevice> mpOutputDevice;
+
+ // The VirtualDevice for PreRendering
+ VclPtr<VirtualDevice> mpPreRenderDevice;
+
+public:
+ explicit SdrPreRenderDevice(OutputDevice& rOriginal);
+ ~SdrPreRenderDevice();
+
+ void PreparePreRenderDevice();
+ void OutputPreRenderDevice(const vcl::Region& rExpandedRegion);
+
+ OutputDevice& GetPreRenderDevice() { return *mpPreRenderDevice; }
+};
+
+class SVXCORE_DLLPUBLIC SdrPaintWindow
+{
+private:
+ // the OutputDevice this window represents
+ VclPtr<OutputDevice> mpOutputDevice;
+
+ /// In case mrOutputDevice is a buffer for a vcl::Window, this is the window.
+ VclPtr<vcl::Window> mpWindow;
+
+ // the SdrPaintView this window belongs to
+ SdrPaintView& mrPaintView;
+
+ // the new OverlayManager for the new OverlayObjects. Test add here, will
+ // replace the IAOManager as soon as it works.
+ rtl::Reference< sdr::overlay::OverlayManager > mxOverlayManager;
+
+ // The PreRenderDevice for PreRendering
+ std::unique_ptr<SdrPreRenderDevice> mpPreRenderDevice;
+
+ // The RedrawRegion used for rendering
+ vcl::Region maRedrawRegion;
+
+ // #i72889# flag if this is only a temporary target for repaint, default is false
+ bool mbTemporaryTarget : 1;
+
+ bool mbOutputToWindow : 1;
+
+ // ref to patched
+ SdrPaintWindow* mpPatched;
+
+ // helpers
+ void impCreateOverlayManager();
+
+public:
+ SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut, vcl::Window* pWindow = nullptr);
+ ~SdrPaintWindow();
+
+ // allow reference to patched, see patchPaintWindow/unpatchPaintWindow
+ void setPatched(SdrPaintWindow* pPaintWindow) { mpPatched = pPaintWindow; }
+ SdrPaintWindow* getPatched() const { return mpPatched; }
+
+ // data read accesses
+ OutputDevice& GetOutputDevice() const { return *mpOutputDevice; }
+ vcl::Window* GetWindow() const { return mpWindow; }
+
+ // OVERLAYMANAGER
+ rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const;
+
+ // #i73602# add flag if buffer shall be used
+ void DrawOverlay(const vcl::Region& rRegion);
+
+ // calculate visible area and return
+ tools::Rectangle GetVisibleArea() const;
+
+ // Is OutDev a printer?
+ bool OutputToPrinter() const { return (OUTDEV_PRINTER == mpOutputDevice->GetOutDevType()); }
+
+ // Is OutDev a window?
+ bool OutputToWindow() const { return mbOutputToWindow; }
+
+ void SetOutputToWindow(bool bOutputToWindow) { mbOutputToWindow = bOutputToWindow; }
+
+ // Is OutDev a recording MetaFile?
+ bool OutputToRecordingMetaFile() const;
+
+ // prepare PreRendering (evtl.)
+ void PreparePreRenderDevice();
+ void DestroyPreRenderDevice();
+ void OutputPreRenderDevice(const vcl::Region& rExpandedRegion);
+ SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice.get(); }
+
+ // RedrawRegion
+ const vcl::Region& GetRedrawRegion() const { return maRedrawRegion;}
+ void SetRedrawRegion(const vcl::Region& rNew);
+
+ // #i72889# read/write access to TemporaryTarget
+ bool getTemporaryTarget() const { return mbTemporaryTarget; }
+ void setTemporaryTarget(bool bNew) { mbTemporaryTarget = bNew; }
+
+ // #i72889# get target output device, take into account output buffering
+ OutputDevice& GetTargetOutputDevice() { if(mpPreRenderDevice) return mpPreRenderDevice->GetPreRenderDevice(); else return *mpOutputDevice; }
+};
+
+#endif // INCLUDED_SVX_SDRPAINTWINDOW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdrundomanager.hxx b/include/svx/sdrundomanager.hxx
new file mode 100644
index 000000000..9ff23e441
--- /dev/null
+++ b/include/svx/sdrundomanager.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDRUNDOMANAGER_HXX
+#define INCLUDED_SVX_SDRUNDOMANAGER_HXX
+
+#include <svx/svxdllapi.h>
+#include <editeng/editund2.hxx>
+#include <tools/link.hxx>
+
+class SfxObjectShell;
+
+class SVXCORE_DLLPUBLIC SdrUndoManager : public EditUndoManager
+{
+private:
+ using EditUndoManager::Undo;
+ using EditUndoManager::Redo;
+
+ Link<SdrUndoManager*, void> maEndTextEditHdl;
+ SfxUndoAction* mpLastUndoActionBeforeTextEdit;
+ size_t mnRedoActionCountBeforeTextEdit;
+ bool mbEndTextEditTriggeredFromUndo;
+
+ SfxObjectShell* m_pDocSh;
+
+protected:
+ // call to check for TextEdit active
+ bool isTextEditActive() const;
+ virtual void EmptyActionsChanged() override;
+
+public:
+ SdrUndoManager();
+ virtual ~SdrUndoManager() override;
+
+ /// react depending on edit mode and if no more undo is possible
+ virtual bool Undo() override;
+ virtual bool Redo() override;
+
+ // #i123350#
+ virtual void Clear() override;
+
+ // Call for the view which starts the interactive text edit. Use link to
+ // activate (start text edit) and empty link to reset (end text edit). On
+ // reset all text edit actions will be removed from this undo manager to
+ // restore the state before activation
+ void SetEndTextEditHdl(const Link<SdrUndoManager*, void>& rLink);
+
+ // check from outside if we are inside a callback for ending text edit. This
+ // is needed to detect inside end text edit if it is a regular one or triggered
+ // by a last undo during text edit
+ bool isEndTextEditTriggeredFromUndo() const { return mbEndTextEditTriggeredFromUndo; }
+ void SetDocShell(SfxObjectShell* pDocShell);
+ size_t GetRedoActionCountBeforeTextEdit() const { return mnRedoActionCountBeforeTextEdit; }
+};
+
+#endif // INCLUDED_SVX_SDRUNDOMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdshcitm.hxx b/include/svx/sdshcitm.hxx
new file mode 100644
index 000000000..a35b8988c
--- /dev/null
+++ b/include/svx/sdshcitm.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDSHCITM_HXX
+#define INCLUDED_SVX_SDSHCITM_HXX
+
+#include <svx/xcolit.hxx>
+#include <svx/svddef.hxx>
+
+inline XColorItem makeSdrShadowColorItem(const Color& rTheColor)
+{
+ return XColorItem(SDRATTR_SHADOWCOLOR, rTheColor);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdshitm.hxx b/include/svx/sdshitm.hxx
new file mode 100644
index 000000000..7dcbecc30
--- /dev/null
+++ b/include/svx/sdshitm.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDSHITM_HXX
+#define INCLUDED_SVX_SDSHITM_HXX
+
+#include <svx/sdooitm.hxx>
+#include <svx/svddef.hxx>
+
+inline SdrOnOffItem makeSdrShadowItem(bool bShadow)
+{
+ return SdrOnOffItem(SDRATTR_SHADOW, bShadow);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdshtitm.hxx b/include/svx/sdshtitm.hxx
new file mode 100644
index 000000000..2287e9703
--- /dev/null
+++ b/include/svx/sdshtitm.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDSHTITM_HXX
+#define INCLUDED_SVX_SDSHTITM_HXX
+
+#include <svx/sdprcitm.hxx>
+#include <svx/svddef.hxx>
+
+inline SdrPercentItem makeSdrShadowTransparenceItem(sal_uInt16 nTransp)
+{
+ return SdrPercentItem(SDRATTR_SHADOWTRANSPARENCE, nTransp);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdsxyitm.hxx b/include/svx/sdsxyitm.hxx
new file mode 100644
index 000000000..a0baac5d3
--- /dev/null
+++ b/include/svx/sdsxyitm.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDSXYITM_HXX
+#define INCLUDED_SVX_SDSXYITM_HXX
+
+#include <svx/sdmetitm.hxx>
+#include <svx/svddef.hxx>
+
+inline SdrMetricItem makeSdrShadowXDistItem(tools::Long nDist)
+{
+ return SdrMetricItem(SDRATTR_SHADOWXDIST, nDist);
+}
+
+inline SdrMetricItem makeSdrShadowYDistItem(tools::Long nDist)
+{
+ return SdrMetricItem(SDRATTR_SHADOWYDIST, nDist);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtaaitm.hxx b/include/svx/sdtaaitm.hxx
new file mode 100644
index 000000000..1a4a51c0e
--- /dev/null
+++ b/include/svx/sdtaaitm.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTAAITM_HXX
+#define INCLUDED_SVX_SDTAAITM_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC SdrTextAniAmountItem final : public SfxInt16Item {
+public:
+ SdrTextAniAmountItem(sal_Int16 nVal=0): SfxInt16Item(SDRATTR_TEXT_ANIAMOUNT,nVal) {}
+ virtual SdrTextAniAmountItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual bool HasMetrics() const override;
+ virtual void ScaleMetrics(tools::Long nMul, tools::Long nDiv) override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtacitm.hxx b/include/svx/sdtacitm.hxx
new file mode 100644
index 000000000..820aee926
--- /dev/null
+++ b/include/svx/sdtacitm.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTACITM_HXX
+#define INCLUDED_SVX_SDTACITM_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svddef.hxx>
+
+// Number of loops. 0=infinite.
+class SAL_DLLPUBLIC_RTTI SdrTextAniCountItem final : public SfxUInt16Item {
+public:
+ SdrTextAniCountItem(sal_uInt16 nVal=0): SfxUInt16Item(SDRATTR_TEXT_ANICOUNT,nVal) {}
+
+ virtual SdrTextAniCountItem* Clone(SfxItemPool * = nullptr) const override
+ { return new SdrTextAniCountItem(*this); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtaditm.hxx b/include/svx/sdtaditm.hxx
new file mode 100644
index 000000000..79ae6bc01
--- /dev/null
+++ b/include/svx/sdtaditm.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTADITM_HXX
+#define INCLUDED_SVX_SDTADITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+
+
+
+enum class SdrTextAniDirection
+{
+ Left, Right, Up, Down
+};
+
+class SVXCORE_DLLPUBLIC SdrTextAniDirectionItem final : public SfxEnumItem<SdrTextAniDirection> {
+public:
+ SdrTextAniDirectionItem(SdrTextAniDirection eDir=SdrTextAniDirection::Left): SfxEnumItem(SDRATTR_TEXT_ANIDIRECTION, eDir) {}
+ virtual SdrTextAniDirectionItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ static OUString GetValueTextByPos(sal_uInt16 nPos);
+
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtagitm.hxx b/include/svx/sdtagitm.hxx
new file mode 100644
index 000000000..88cf77bf1
--- /dev/null
+++ b/include/svx/sdtagitm.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTAGITM_HXX
+#define INCLUDED_SVX_SDTAGITM_HXX
+
+#include <svx/sdooitm.hxx>
+#include <svx/svddef.hxx>
+
+inline SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
+{
+ return SdrOnOffItem(SDRATTR_TEXT_AUTOGROWHEIGHT, bAuto);
+}
+
+inline SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
+{
+ return SdrOnOffItem(SDRATTR_TEXT_AUTOGROWWIDTH, bAuto);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtaiitm.hxx b/include/svx/sdtaiitm.hxx
new file mode 100644
index 000000000..d847208a6
--- /dev/null
+++ b/include/svx/sdtaiitm.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTAIITM_HXX
+#define INCLUDED_SVX_SDTAIITM_HXX
+
+#include <svx/sdynitm.hxx>
+#include <svx/svddef.hxx>
+
+class SVXCORE_DLLPUBLIC SdrTextAniStartInsideItem final : public SdrYesNoItem {
+public:
+ SdrTextAniStartInsideItem(bool bOn=false): SdrYesNoItem(SDRATTR_TEXT_ANISTARTINSIDE,bOn) {}
+ virtual ~SdrTextAniStartInsideItem() override;
+ virtual SdrTextAniStartInsideItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrTextAniStartInsideItem(SdrTextAniStartInsideItem const &) = default;
+ SdrTextAniStartInsideItem(SdrTextAniStartInsideItem &&) = default;
+ SdrTextAniStartInsideItem & operator =(SdrTextAniStartInsideItem const &) = delete; // due to SdrYesNoItem
+ SdrTextAniStartInsideItem & operator =(SdrTextAniStartInsideItem &&) = delete; // due to SdrYesNoItem
+};
+
+class SVXCORE_DLLPUBLIC SdrTextAniStopInsideItem final : public SdrYesNoItem {
+public:
+ SdrTextAniStopInsideItem(bool bOn=false): SdrYesNoItem(SDRATTR_TEXT_ANISTOPINSIDE,bOn) {}
+ virtual ~SdrTextAniStopInsideItem() override;
+ virtual SdrTextAniStopInsideItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrTextAniStopInsideItem(SdrTextAniStopInsideItem const &) = default;
+ SdrTextAniStopInsideItem(SdrTextAniStopInsideItem &&) = default;
+ SdrTextAniStopInsideItem & operator =(SdrTextAniStopInsideItem const &) = delete; // due to SdrYesNoItem
+ SdrTextAniStopInsideItem & operator =(SdrTextAniStopInsideItem &&) = delete; // due to SdrYesNoItem
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtaitm.hxx b/include/svx/sdtaitm.hxx
new file mode 100644
index 000000000..716f703ec
--- /dev/null
+++ b/include/svx/sdtaitm.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTAITM_HXX
+#define INCLUDED_SVX_SDTAITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+
+
+
+enum SdrTextVertAdjust {SDRTEXTVERTADJUST_TOP, // aligned to top (normally used)
+ SDRTEXTVERTADJUST_CENTER, // centered (for example for the title texts in Draw)
+ SDRTEXTVERTADJUST_BOTTOM, // aligned to bottom
+ SDRTEXTVERTADJUST_BLOCK // support vertical full with supported now
+ /*,SDRTEXTVERTADJUST_STRETCH*/}; // also stretch letters in their height (ni)
+
+class SVXCORE_DLLPUBLIC SdrTextVertAdjustItem final : public SfxEnumItem<SdrTextVertAdjust> {
+public:
+ SdrTextVertAdjustItem(SdrTextVertAdjust eAdj=SDRTEXTVERTADJUST_TOP): SfxEnumItem(SDRATTR_TEXT_VERTADJUST, eAdj) {}
+ SdrTextVertAdjustItem(SdrTextVertAdjust eAdj, TypedWhichId<SdrTextVertAdjustItem> nWhich): SfxEnumItem(nWhich, eAdj) {}
+ virtual SdrTextVertAdjustItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override; // { return 5; }
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ static OUString GetValueTextByPos(sal_uInt16 nPos);
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+
+
+
+enum SdrTextHorzAdjust {SDRTEXTHORZADJUST_LEFT, // left adjusted
+ SDRTEXTHORZADJUST_CENTER, // centered (for example for title texts in Draw)
+ SDRTEXTHORZADJUST_RIGHT, // right adjusted
+ SDRTEXTHORZADJUST_BLOCK // use the whole text frame width
+ /*,SDRTEXTHORZADJUST_STRETCH*/}; // FitToSize in X direction (ni).
+
+class SVXCORE_DLLPUBLIC SdrTextHorzAdjustItem final : public SfxEnumItem<SdrTextHorzAdjust> {
+public:
+ SdrTextHorzAdjustItem(SdrTextHorzAdjust eAdj=SDRTEXTHORZADJUST_BLOCK): SfxEnumItem(SDRATTR_TEXT_HORZADJUST, eAdj) {}
+ virtual SdrTextHorzAdjustItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ static OUString GetValueTextByPos(sal_uInt16 nPos);
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtakitm.hxx b/include/svx/sdtakitm.hxx
new file mode 100644
index 000000000..0d86e517b
--- /dev/null
+++ b/include/svx/sdtakitm.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTAKITM_HXX
+#define INCLUDED_SVX_SDTAKITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+/**
+ * Animation type for text frame.
+ */
+enum class SdrTextAniKind {
+ NONE, /// no animation
+ Blink, /// blinking
+ Scroll, /// scroll through
+ Alternate, /// scroll back and forth
+ Slide /// scroll in
+};
+
+// - SdrTextAniKind::Blink:
+// Just blink. Direction and Amount don't effect things.
+// Frequency delay: 0 = 0.5Hz (Delay = 250).
+// Count = number of blinks. (0 = forever)
+// start inside: sal_False = begin with the blinker off, sal_True = begin with the blinker on
+// stop inside: sal_False = end with the blinker off, sal_True = end with the blinker on
+// (Only if count! = 0)
+// - SdrTextAniKind::Scroll:
+// Text just scrolls all the way through, and starts over when it is done.
+
+// Delay in ms: (except delay = 0 means 50ms (20Hz) default)
+// Count = number of passes (0 = go forever)
+// Direction: the direction to scroll
+// StartInside: sal_False = on the first pass, scroll the text in (not initially visible)
+// sal_True = on the first pass, the left part of the text is already visible
+// in the scroll area before starting.
+// StopInside: sal_False = on the last pass, scroll the text all the way out.
+// sal_True = on the last pass, keep the right part of the text visible.
+// (Only if count! = 0)
+// Amount: Step size in logical units. Negative values = use Pixels instead
+// of logical units. If Amount = 0, then default to 1 Pixel.
+// - SdrTextAniKind::Alternate:
+// Like SdrTextAniKind::Scroll, except don't scroll until all of the text is out,
+// but just until the last part is visible. Then, change direction and
+// scroll the text the other way.
+// Count = number of passes (number of direction changes minus 1)
+// If count = 1, this is the same as SdrTextAniKind::Scroll
+// Direction = the starting direction.
+// All Other Parameters: just like SdrTextAniKind::Scroll
+// - SdrTextAniKind::Slide:
+// Text will slide into the original position.
+// -> same as SCROLL with StartInside = sal_False, StopInside = sal_True
+// and Count = 1 (Count = 0 is interpreted as count = 1).
+// For each count > 1, the text, will be slid out backwards
+// (much like ALTERNATE) and then slid back in again.
+// StopInside is not evaluated, because inside is always stopped.
+// StartInside is not evaluated, because outside is always started.
+// All other parameters are like SdrTextAniKind::Scroll
+// StartInside, StopInside: When sal_True, the starting / final position
+// of the text depends on the anchor of the drawing object. This
+// corresponds to the position of the text in normal Paint (without scrolling).
+
+class SVXCORE_DLLPUBLIC SdrTextAniKindItem final : public SfxEnumItem<SdrTextAniKind> {
+public:
+ SdrTextAniKindItem(SdrTextAniKind eKind=SdrTextAniKind::NONE): SfxEnumItem(SDRATTR_TEXT_ANIKIND, eKind) {}
+ virtual SdrTextAniKindItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override; // { return 5; }
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ static OUString GetValueTextByPos(sal_uInt16 nPos);
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtayitm.hxx b/include/svx/sdtayitm.hxx
new file mode 100644
index 000000000..7308991d0
--- /dev/null
+++ b/include/svx/sdtayitm.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTAYITM_HXX
+#define INCLUDED_SVX_SDTAYITM_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC SdrTextAniDelayItem final : public SfxUInt16Item {
+public:
+ SdrTextAniDelayItem(sal_uInt16 nVal=0): SfxUInt16Item(SDRATTR_TEXT_ANIDELAY,nVal) {}
+ virtual SdrTextAniDelayItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtcfitm.hxx b/include/svx/sdtcfitm.hxx
new file mode 100644
index 000000000..7b4ef6e2a
--- /dev/null
+++ b/include/svx/sdtcfitm.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTCFITM_HXX
+#define INCLUDED_SVX_SDTCFITM_HXX
+
+#include <svx/sdooitm.hxx>
+#include <svx/svddef.hxx>
+
+inline SdrOnOffItem makeSdrTextContourFrameItem(bool bOn)
+{
+ return SdrOnOffItem(SDRATTR_TEXT_CONTOURFRAME, bOn);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtditm.hxx b/include/svx/sdtditm.hxx
new file mode 100644
index 000000000..6fe41a437
--- /dev/null
+++ b/include/svx/sdtditm.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTDITM_HXX
+#define INCLUDED_SVX_SDTDITM_HXX
+
+#include <svx/sdmetitm.hxx>
+#include <svx/svddef.hxx>
+
+inline SdrMetricItem makeSdrTextLeftDistItem(tools::Long mnHeight)
+{
+ return SdrMetricItem(SDRATTR_TEXT_LEFTDIST, mnHeight);
+}
+
+inline SdrMetricItem makeSdrTextRightDistItem(tools::Long mnHeight)
+{
+ return SdrMetricItem(SDRATTR_TEXT_RIGHTDIST, mnHeight);
+}
+
+inline SdrMetricItem makeSdrTextUpperDistItem(tools::Long mnHeight)
+{
+ return SdrMetricItem(SDRATTR_TEXT_UPPERDIST, mnHeight);
+}
+
+inline SdrMetricItem makeSdrTextLowerDistItem(tools::Long mnHeight)
+{
+ return SdrMetricItem(SDRATTR_TEXT_LOWERDIST, mnHeight);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtfchim.hxx b/include/svx/sdtfchim.hxx
new file mode 100644
index 000000000..2fe5427c5
--- /dev/null
+++ b/include/svx/sdtfchim.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTFCHIM_HXX
+#define INCLUDED_SVX_SDTFCHIM_HXX
+
+#include <config_options.h>
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SdrTextFixedCellHeightItem final : public SfxBoolItem
+{
+public:
+
+ SdrTextFixedCellHeightItem( bool bUseFixedCellHeight = false );
+
+ SVX_DLLPRIVATE virtual bool GetPresentation(SfxItemPresentation ePresentation,
+ MapUnit eCoreMetric, MapUnit ePresentationMetric,
+ OUString &rText, const IntlWrapper&) const override;
+
+ SVX_DLLPRIVATE virtual SdrTextFixedCellHeightItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ SVX_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ SVX_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtfsitm.hxx b/include/svx/sdtfsitm.hxx
new file mode 100644
index 000000000..d98e431da
--- /dev/null
+++ b/include/svx/sdtfsitm.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTFSITM_HXX
+#define INCLUDED_SVX_SDTFSITM_HXX
+
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+
+// No automatic line breaks for AutoGrowingWidth as well (only if
+// TextMaxFrameWidth is reached).
+
+
+class SVXCORE_DLLPUBLIC SdrTextFitToSizeTypeItem final
+ : public SfxEnumItem<css::drawing::TextFitToSizeType>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ SdrTextFitToSizeTypeItem(
+ css::drawing::TextFitToSizeType const eFit = css::drawing::TextFitToSizeType_NONE)
+ : SfxEnumItem(SDRATTR_TEXT_FITTOSIZE, eFit) {}
+ SdrTextFitToSizeTypeItem(const SdrTextFitToSizeTypeItem& rItem)
+ : SfxEnumItem(rItem),
+ m_nMaxScale(rItem.GetMaxScale())
+ {
+ }
+ virtual SdrTextFitToSizeTypeItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ bool operator==(const SfxPoolItem& rItem) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ static OUString GetValueTextByPos(sal_uInt16 nPos);
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+ virtual bool HasBoolValue() const override;
+ virtual bool GetBoolValue() const override;
+ virtual void SetBoolValue(bool bVal) override;
+ void SetMaxScale(sal_Int16 nMaxScale) { m_nMaxScale = nMaxScale; }
+ sal_Int16 GetMaxScale() const { return m_nMaxScale; }
+private:
+ sal_Int16 m_nMaxScale = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdtmfitm.hxx b/include/svx/sdtmfitm.hxx
new file mode 100644
index 000000000..23046442b
--- /dev/null
+++ b/include/svx/sdtmfitm.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDTMFITM_HXX
+#define INCLUDED_SVX_SDTMFITM_HXX
+
+#include <svx/sdmetitm.hxx>
+#include <svx/svddef.hxx>
+
+inline SdrMetricItem makeSdrTextMinFrameHeightItem(tools::Long mnHeight)
+{
+ return SdrMetricItem(SDRATTR_TEXT_MINFRAMEHEIGHT, mnHeight);
+}
+
+inline SdrMetricItem makeSdrTextMaxFrameHeightItem(tools::Long mnHeight)
+{
+ return SdrMetricItem(SDRATTR_TEXT_MAXFRAMEHEIGHT, mnHeight);
+}
+
+inline SdrMetricItem makeSdrTextMinFrameWidthItem(tools::Long mnWidth)
+{
+ return SdrMetricItem(SDRATTR_TEXT_MINFRAMEWIDTH, mnWidth);
+};
+
+inline SdrMetricItem makeSdrTextMaxFrameWidthItem(tools::Long mnWidth)
+{
+ return SdrMetricItem(SDRATTR_TEXT_MAXFRAMEWIDTH, mnWidth);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sdynitm.hxx b/include/svx/sdynitm.hxx
new file mode 100644
index 000000000..970956a42
--- /dev/null
+++ b/include/svx/sdynitm.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SDYNITM_HXX
+#define INCLUDED_SVX_SDYNITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+
+// class SdrYesNoItem
+// GetValueTextByVal() returns "yes" or "no"
+// instead of "TRUE" and "FALSE"
+//-------------------------------------------------- ----------
+class SVXCORE_DLLPUBLIC SdrYesNoItem: public SfxBoolItem {
+public:
+ SdrYesNoItem(TypedWhichId<SdrYesNoItem> nId, bool bOn): SfxBoolItem(nId,bOn) {}
+ virtual SdrYesNoItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual OUString GetValueTextByVal(bool bVal) const override;
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/searchcharmap.hxx b/include/svx/searchcharmap.hxx
new file mode 100644
index 000000000..1af4ce5fe
--- /dev/null
+++ b/include/svx/searchcharmap.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SEARCHCHARMAP_HXX
+#define INCLUDED_SVX_SEARCHCHARMAP_HXX
+
+#include <memory>
+
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+#include <svx/charmap.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/vclptr.hxx>
+#include <unordered_map>
+
+namespace svx { struct SvxShowCharSetItem; }
+namespace tools { class Rectangle; }
+namespace weld { class ScrolledWindow; }
+
+class Subset;
+
+class SVX_DLLPUBLIC SvxSearchCharSet final : public SvxShowCharSet
+{
+public:
+ SvxSearchCharSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow, const VclPtr<VirtualDevice> &rDevice);
+ virtual ~SvxSearchCharSet() override;
+
+ virtual void RecalculateFont(vcl::RenderContext& rRenderContext) override;
+
+ void SelectCharacter( const Subset* sub);
+ virtual sal_UCS4 GetSelectCharacter() const override;
+
+ virtual svx::SvxShowCharSetItem* ImplGetItem( int _nPos ) override;
+ virtual int LastInView() const override;
+ virtual void SelectIndex( int index, bool bFocus = false ) override;
+ void AppendCharToList(sal_UCS4 cChar);
+ void ClearPreviousData();
+ void UpdateScrollRange();
+
+ virtual sal_Int32 getMaxCharCount() const override;
+
+private:
+ sal_Int32 nCount;
+
+ //index to char code mapping for the search
+ //to uniquely identify each appended element
+ std::unordered_map<sal_Int32, sal_UCS4> m_aItemList;
+private:
+ virtual void DrawChars_Impl(vcl::RenderContext& rRenderContext, int n1, int n2) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual bool KeyInput(const KeyEvent& rKEvt) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/selctrl.hxx b/include/svx/selctrl.hxx
new file mode 100644
index 000000000..8136418e6
--- /dev/null
+++ b/include/svx/selctrl.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SELCTRL_HXX
+#define INCLUDED_SVX_SELCTRL_HXX
+
+#include <vcl/image.hxx>
+#include <sfx2/stbitem.hxx>
+#include <svx/svxdllapi.h>
+
+/// Status bar control that indicates or changes the selection mode (standard / block / etc.)
+class SVX_DLLPUBLIC SvxSelectionModeControl final : public SfxStatusBarControl
+{
+public:
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxSelectionModeControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb);
+
+ virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState) override;
+ virtual bool MouseButtonDown(const MouseEvent& rEvt) override;
+ virtual void Paint(const UserDrawEvent& rEvt) override;
+ virtual void Click() override;
+
+private:
+ sal_uInt16 mnState;
+ Image maImages[4];
+ bool mbFeatureEnabled;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/selectioncontroller.hxx b/include/svx/selectioncontroller.hxx
new file mode 100644
index 000000000..57dec07b9
--- /dev/null
+++ b/include/svx/selectioncontroller.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SELECTIONCONTROLLER_HXX
+#define INCLUDED_SVX_SELECTIONCONTROLLER_HXX
+
+#include <svx/svxdllapi.h>
+#include <cppuhelper/weak.hxx>
+
+class KeyEvent;
+class MouseEvent;
+namespace vcl { class Window; }
+class SfxItemSet;
+class SfxRequest;
+class SfxStyleSheet;
+class SdrModel;
+class Point;
+class FontList;
+class SdrObject;
+
+namespace sdr
+{
+
+namespace table { struct CellPos; }
+
+class SVXCORE_DLLPUBLIC SelectionController: public cppu::OWeakObject
+{
+public:
+ virtual bool onKeyInput(const KeyEvent& rKEvt, vcl::Window* pWin);
+ virtual bool onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin);
+ virtual bool onMouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin);
+ virtual bool onMouseMove(const MouseEvent& rMEvt, vcl::Window* pWin);
+
+ virtual void onSelectionHasChanged();
+
+ virtual void onSelectAll();
+
+ virtual void GetState( SfxItemSet& rSet );
+ virtual void Execute( SfxRequest& rReq );
+
+ virtual bool DeleteMarked();
+
+ virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
+ virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
+
+ virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const;
+ virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr );
+
+ virtual SdrObject* GetMarkedSdrObjClone( SdrModel& rTargetModel );
+ virtual bool PasteObjModel( const SdrModel& rModel );
+
+ /** applies a format paint brush set from the current selection.
+ if bNoCharacterFormats is true, no character attributes are changed.
+ if bNoParagraphFormats is true, no paragraph attributes are changed.
+ */
+ virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats );
+ /// This is a table object, and one or more of its cells are selected.
+ virtual bool hasSelectedCells() const;
+ /// Allows adjusting the point or mark of the selection to a document coordinate.
+ virtual bool setCursorLogicPosition(const Point& rPosition, bool bPoint);
+ /// Get the position of the first and the last selected cell.
+ virtual void getSelectedCells(table::CellPos& rFirstPos, table::CellPos& rLastPos);
+ /// Changes the font (grow/shrink) according to the input parameters.
+ virtual bool ChangeFontSize(bool bGrow, const FontList* pFontList);
+};
+
+}
+
+#endif // INCLUDED_SVX_SELECTIONCONTROLLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/shapepropertynotifier.hxx b/include/svx/shapepropertynotifier.hxx
new file mode 100644
index 000000000..bcc6c357f
--- /dev/null
+++ b/include/svx/shapepropertynotifier.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SHAPEPROPERTYNOTIFIER_HXX
+#define INCLUDED_SVX_SHAPEPROPERTYNOTIFIER_HXX
+
+#include <svx/svxdllapi.h>
+#include <comphelper/multiinterfacecontainer3.hxx>
+#include <rtl/ustring.hxx>
+#include <o3tl/enumarray.hxx>
+
+#include <memory>
+#include <unordered_map>
+
+namespace com::sun::star::beans { class XPropertyChangeListener; }
+namespace com::sun::star::uno { class Any; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace osl { class Mutex; }
+
+namespace cppu
+{
+ class OWeakObject;
+}
+
+
+namespace svx
+{
+
+ //= ShapeProperty
+
+ enum class ShapePropertyProviderId
+ {
+ // generic (UNO) shape properties
+ Position,
+ Size,
+ // text doc shape properties
+ TextDocAnchor,
+ LAST = TextDocAnchor
+ };
+
+ //= PropertyValueProvider
+
+ /** Default provider for a property value
+
+ This default implementation queries the object which it is constructed with for the XPropertySet interface,
+ and calls the getPropertyValue method.
+ */
+ class SVXCORE_DLLPUBLIC PropertyValueProvider
+ {
+ public:
+ PropertyValueProvider( ::cppu::OWeakObject& _rContext, OUString _aPropertyName )
+ :m_rContext( _rContext )
+ ,m_sPropertyName( std::move( _aPropertyName ) )
+ {
+ }
+ virtual ~PropertyValueProvider();
+
+ /** returns the name of the property which this provider is responsible for
+ */
+ const OUString & getPropertyName() const;
+ /** returns the current value of the property which the provider is responsible for
+ */
+ virtual void getCurrentValue( css::uno::Any& _out_rValue ) const;
+
+ protected:
+ ::cppu::OWeakObject& getContext() const { return m_rContext; }
+ PropertyValueProvider(const PropertyValueProvider&) = delete;
+ PropertyValueProvider& operator=(const PropertyValueProvider&) = delete;
+
+ private:
+ ::cppu::OWeakObject& m_rContext;
+ const OUString m_sPropertyName;
+ };
+
+
+ /** helper class for notifying XPropertyChangeListeners
+
+ The class is intended to be held as member of the class which does the property change broadcasting.
+ */
+ class SVXCORE_DLLPUBLIC PropertyChangeNotifier
+ {
+ public:
+ /** constructs a notifier instance
+
+ @param _rOwner
+ the owner instance of the notifier. Will be used as css.lang.EventObject.Source when
+ notifying events.
+ */
+ PropertyChangeNotifier( ::cppu::OWeakObject& _rOwner, ::osl::Mutex& _rMutex );
+ ~PropertyChangeNotifier();
+
+ // listener maintenance
+ void addPropertyChangeListener( const OUString& _rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxListener );
+ void removePropertyChangeListener( const OUString& _rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxListener );
+
+ /** registers an PropertyValueProvider
+ */
+ void registerProvider( const ShapePropertyProviderId _eProperty, std::unique_ptr<PropertyValueProvider> _rProvider );
+
+ /** notifies changes in the given property to all registered listeners
+
+ If no property value provider for the given property ID is registered, this is worth an assertion in a
+ non-product build, and otherwise ignored.
+ */
+ void notifyPropertyChange( const ShapePropertyProviderId _eProperty ) const;
+
+ /** is called to dispose the instance
+ */
+ void disposing();
+
+ private:
+ PropertyChangeNotifier(const PropertyChangeNotifier&) = delete;
+ PropertyChangeNotifier& operator=(const PropertyChangeNotifier&) = delete;
+
+ ::cppu::OWeakObject& m_rContext;
+ o3tl::enumarray<ShapePropertyProviderId, std::unique_ptr<PropertyValueProvider>> m_aProviders;
+ comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XPropertyChangeListener, OUString> m_aPropertyChangeListeners;
+ };
+
+
+}
+
+
+#endif // INCLUDED_SVX_SHAPEPROPERTYNOTIFIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx b/include/svx/sidebar/AreaPropertyPanelBase.hxx
new file mode 100644
index 000000000..ed028d7b8
--- /dev/null
+++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANELBASE_HXX
+#define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANELBASE_HXX
+
+#include <memory>
+#include <svx/sidebar/AreaTransparencyGradientPopup.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <svx/colorbox.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xfilluseslidebackgrounditem.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <sfx2/sidebar/PanelLayout.hxx>
+#include <svl/intitem.hxx>
+#include <svx/svxdllapi.h>
+
+class ToolbarUnoDispatcher;
+class XFillFloatTransparenceItem;
+class XFillUseSlideBackgroundItem;
+class XFillTransparenceItem;
+class XFillStyleItem;
+class XFillGradientItem;
+class XFillColorItem;
+class XFillHatchItem;
+class XFillBitmapItem;
+
+namespace svx::sidebar {
+
+class SVX_DLLPUBLIC AreaPropertyPanelBase
+: public PanelLayout,
+ public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+public:
+
+ virtual void NotifyItemUpdate(
+ const sal_uInt16 nSId,
+ const SfxItemState eState,
+ const SfxPoolItem* pState) override;
+
+ virtual void GetControlState(
+ const sal_uInt16 /*nSId*/,
+ boost::property_tree::ptree& /*rState*/) override {};
+
+ const static sal_Int32 DEFAULT_CENTERX;
+ const static sal_Int32 DEFAULT_CENTERY;
+ const static sal_Int32 DEFAULT_ANGLE;
+ const static sal_Int32 DEFAULT_STARTVALUE;
+ const static sal_Int32 DEFAULT_ENDVALUE;
+ const static sal_Int32 DEFAULT_BORDER;
+
+ const XGradient& GetGradient (const css::awt::GradientStyle eStyle) const;
+ void SetGradient (const XGradient& rGradient);
+ sal_Int32 GetSelectedTransparencyTypeIndex() const;
+
+ // constructor/destructor
+ AreaPropertyPanelBase(
+ weld::Widget* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
+ virtual ~AreaPropertyPanelBase() override;
+
+ virtual void setFillTransparence(const XFillTransparenceItem& rItem) = 0;
+ virtual void setFillFloatTransparence(const XFillFloatTransparenceItem& rItem) = 0;
+ virtual void setFillStyle(const XFillStyleItem& rItem) = 0;
+ virtual void setFillStyleAndColor(const XFillStyleItem* pStyleItem, const XFillColorItem& aColorItem) = 0;
+ virtual void setFillStyleAndGradient(const XFillStyleItem* pStyleItem, const XFillGradientItem& aGradientItem) = 0;
+ virtual void setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const XFillHatchItem& aHatchItem) = 0;
+ virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& aHatchItem) = 0;
+ virtual void setFillUseBackground(const XFillStyleItem* pStyleItem, const XFillUseSlideBackgroundItem& rItem) = 0;
+
+ void updateFillTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
+ void updateFillFloatTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
+ void updateFillStyle(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
+ void updateFillGradient(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
+ void updateFillHatch(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
+ void updateFillColor(bool bDefaultOrSet, const SfxPoolItem* pState);
+ void updateFillBitmap(bool BDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
+ void updateFillUseBackground(bool BDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
+
+private:
+ void Initialize();
+
+protected:
+ const css::uno::Reference<css::frame::XFrame>& mxFrame;
+
+ sal_uInt16 meLastXFS;
+
+ sal_Int32 mnLastPosHatch;
+ sal_Int32 mnLastPosBitmap;
+ sal_Int32 mnLastPosPattern;
+ sal_uInt16 mnLastTransSolid;
+
+ XGradient maGradientLinear;
+ XGradient maGradientAxial;
+ XGradient maGradientRadial;
+ XGradient maGradientElliptical;
+ XGradient maGradientSquare;
+ XGradient maGradientRect;
+
+ //ui controls
+ std::unique_ptr<weld::Label> mxColorTextFT;
+ std::unique_ptr<weld::ComboBox> mxLbFillType;
+ std::unique_ptr<weld::ComboBox> mxLbFillAttr;
+ std::unique_ptr<ColorListBox> mxLbFillGradFrom;
+ std::unique_ptr<ColorListBox> mxLbFillGradTo;
+ std::unique_ptr<weld::Toolbar> mxToolBoxColor; // for new color picker
+ std::unique_ptr<ToolbarUnoDispatcher> mxColorDispatch;
+ std::unique_ptr<weld::Label> mxTrspTextFT;
+ std::unique_ptr<weld::ComboBox> mxLBTransType;
+ std::unique_ptr<weld::MetricSpinButton> mxMTRTransparent;
+ std::unique_ptr<weld::Scale> mxSldTransparent;
+ std::unique_ptr<weld::Toolbar> mxBTNGradient;
+ std::unique_ptr<weld::MetricSpinButton> mxMTRAngle;
+ std::unique_ptr<weld::ComboBox> mxGradientStyle;
+ std::unique_ptr<weld::Button> mxBmpImport;
+ std::unique_ptr<AreaTransparencyGradientPopup> mxTrGrPopup;
+
+ std::unique_ptr< XFillStyleItem > mpStyleItem;
+ std::unique_ptr< XFillColorItem > mpColorItem;
+ std::unique_ptr< XFillGradientItem > mpFillGradientItem;
+ std::unique_ptr< XFillHatchItem > mpHatchItem;
+ std::unique_ptr< XFillBitmapItem > mpBitmapItem;
+
+ OUString maImgAxial;
+ OUString maImgElli;
+ OUString maImgQuad;
+ OUString maImgRadial;
+ OUString maImgSquare;
+ OUString maImgLinear;
+
+ std::unique_ptr< XFillFloatTransparenceItem > mpFloatTransparenceItem;
+ std::unique_ptr< XFillUseSlideBackgroundItem > mpUseSlideBackgroundItem;
+ std::unique_ptr< SfxUInt16Item > mpTransparenceItem;
+
+ DECL_DLLPRIVATE_LINK(SelectFillTypeHdl, weld::ComboBox&, void );
+ DECL_DLLPRIVATE_LINK(SelectFillAttrHdl, weld::ComboBox&, void );
+ DECL_DLLPRIVATE_LINK(SelectFillColorHdl, ColorListBox&, void);
+ DECL_DLLPRIVATE_LINK(ChangeGradientAngle, weld::MetricSpinButton&, void);
+ DECL_DLLPRIVATE_LINK(ChangeTrgrTypeHdl_Impl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void);
+ DECL_DLLPRIVATE_LINK(ModifyTransSliderHdl, weld::Scale&, void);
+ DECL_DLLPRIVATE_LINK(ClickImportBitmapHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(ToolbarHdl_Impl, const OString&, void);
+
+ void ImpUpdateTransparencies();
+ void SetTransparency(sal_uInt16 nVal);
+ void SelectFillAttrHdl_Impl();
+ void FillStyleChanged(bool bUpdateModel);
+};
+
+} // end of namespace svx::sidebar
+
+#endif // INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sidebar/AreaTransparencyGradientPopup.hxx b/include/svx/sidebar/AreaTransparencyGradientPopup.hxx
new file mode 100644
index 000000000..3383884a8
--- /dev/null
+++ b/include/svx/sidebar/AreaTransparencyGradientPopup.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTPOPUP_HXX
+#define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTPOPUP_HXX
+
+#include <vcl/weld.hxx>
+#include <svtools/toolbarmenu.hxx>
+
+class XFillFloatTransparenceItem;
+
+namespace svx::sidebar
+{
+class AreaTransparencyGradientControl;
+class AreaPropertyPanelBase;
+
+class AreaTransparencyGradientPopup final : public WeldToolbarPopup
+{
+private:
+ AreaPropertyPanelBase& mrAreaPropertyPanel;
+ std::unique_ptr<weld::Widget> mxCenterGrid;
+ std::unique_ptr<weld::Widget> mxAngleGrid;
+ std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrCenterX;
+ std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrCenterY;
+ std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrAngle;
+ std::unique_ptr<weld::Toolbar> mxBtnLeft45;
+ std::unique_ptr<weld::Toolbar> mxBtnRight45;
+ std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrStartValue;
+ std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrEndValue;
+ std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrBorder;
+
+ void InitStatus(XFillFloatTransparenceItem const* pGradientItem);
+ void ExecuteValueModify(sal_uInt8 nStartCol, sal_uInt8 nEndCol);
+ DECL_LINK(ModifiedTrgrHdl_Impl, weld::MetricSpinButton&, void);
+ DECL_LINK(Left_Click45_Impl, const OString&, void);
+ DECL_LINK(Right_Click45_Impl, const OString&, void);
+
+public:
+ AreaTransparencyGradientPopup(const css::uno::Reference<css::frame::XFrame>& rFrame,
+ AreaPropertyPanelBase& rPanel, weld::Widget* pParent);
+ ~AreaTransparencyGradientPopup();
+
+ void Rearrange(XFillFloatTransparenceItem const* pItem);
+ virtual void GrabFocus() override;
+};
+
+} // end of namespace svx::sidebar
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sidebar/ContextChangeEventMultiplexer.hxx b/include/svx/sidebar/ContextChangeEventMultiplexer.hxx
new file mode 100644
index 000000000..1c8f58d1c
--- /dev/null
+++ b/include/svx/sidebar/ContextChangeEventMultiplexer.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SIDEBAR_CONTEXTCHANGEEVENTMULTIPLEXER_HXX
+#define INCLUDED_SVX_SIDEBAR_CONTEXTCHANGEEVENTMULTIPLEXER_HXX
+
+#include <svx/svxdllapi.h>
+#include <vcl/EnumContext.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+
+class SfxViewShell;
+
+/** Convenience frontend for css::ui::ContextChangeEventMultiplexer
+*/
+class SVX_DLLPUBLIC ContextChangeEventMultiplexer
+{
+public:
+ /** Notify the activation of a context.
+ @param rxController
+ This controller is used to determine the module (ie
+ application like Writer or Calc).
+ @param eContext
+ The activated context.
+ */
+ static void NotifyContextChange (
+ const css::uno::Reference<css::frame::XController>& rxController,
+ const vcl::EnumContext::Context eContext);
+
+ /** Notify the activation of a context.
+ @param pViewShell
+ This view shell is used to determine the module (ie
+ application like Writer or Calc). When <NULL/> then no
+ notification is made.
+ @param eContext
+ The activated context.
+ */
+ static void NotifyContextChange (
+ const SfxViewShell* pViewShell,
+ const vcl::EnumContext::Context eContext);
+
+private:
+ static OUString GetModuleName (
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sidebar/InspectorTextPanel.hxx b/include/svx/sidebar/InspectorTextPanel.hxx
new file mode 100644
index 000000000..f6ef0234a
--- /dev/null
+++ b/include/svx/sidebar/InspectorTextPanel.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sfx2/sidebar/PanelLayout.hxx>
+#include <svx/svxdllapi.h>
+
+namespace svx::sidebar
+{
+struct TreeNode
+{
+ OUString sNodeName;
+ css::uno::Any aValue;
+ bool isGrey;
+ enum
+ {
+ Category,
+ ComplexProperty,
+ SimpleProperty
+ } NodeType;
+ std::vector<TreeNode> children;
+ TreeNode()
+ : isGrey(false)
+ , NodeType(SimpleProperty)
+ {
+ }
+};
+class SVX_DLLPUBLIC InspectorTextPanel : public PanelLayout
+{
+public:
+ virtual ~InspectorTextPanel() override;
+
+ static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent);
+
+ InspectorTextPanel(weld::Widget* pParent);
+
+ void updateEntries(const std::vector<TreeNode>& rStore, const sal_Int32 nParIdx);
+
+private:
+ std::unique_ptr<weld::TreeView> mpListBoxStyles;
+};
+
+} // end of namespace svx::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx
new file mode 100644
index 000000000..e94612ff2
--- /dev/null
+++ b/include/svx/sidebar/LinePropertyPanelBase.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEPROPERTYPANELBASE_HXX
+#define INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEPROPERTYPANELBASE_HXX
+
+#include <vcl/weld.hxx>
+#include <memory>
+#include <svl/poolitem.hxx>
+#include <sfx2/sidebar/PanelLayout.hxx>
+#include <svx/sidebar/LineWidthPopup.hxx>
+#include <svx/svxdllapi.h>
+#include <com/sun/star/frame/XFrame.hpp>
+
+class ToolbarUnoDispatcher;
+class XLineStyleItem;
+class XLineDashItem;
+class XLineStartItem;
+class XLineWidthItem;
+class XLineEndItem;
+class XLineEndList;
+class XLineJointItem;
+class XLineCapItem;
+class XLineTransparenceItem;
+class XDashList;
+
+namespace svx::sidebar
+{
+class LineStyleNoneChange;
+
+class SVX_DLLPUBLIC LinePropertyPanelBase : public PanelLayout
+{
+public:
+ virtual ~LinePropertyPanelBase() override;
+
+ void SetWidth(tools::Long nWidth);
+ void SetWidthIcon(int n);
+ void SetWidthIcon();
+
+ void EndLineWidthPopup();
+
+ // constructor/destructor
+ LinePropertyPanelBase(weld::Widget* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
+ virtual void setLineWidth(const XLineWidthItem& rItem) = 0;
+
+ void SetNoneLineStyle(bool bNoneLineStyle)
+ {
+ if (bNoneLineStyle != mbNoneLineStyle)
+ {
+ mbNoneLineStyle = bNoneLineStyle;
+ ActivateControls();
+ }
+ }
+
+protected:
+ void ActivateControls();
+
+ virtual void setLineTransparency(const XLineTransparenceItem& rItem) = 0;
+ virtual void setLineJoint(const XLineJointItem* pItem) = 0;
+ virtual void setLineCap(const XLineCapItem* pItem) = 0;
+
+ void updateLineTransparence(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
+ virtual void updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
+ void updateLineJoint(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
+ void updateLineCap(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
+
+ void setMapUnit(MapUnit eMapUnit);
+
+ void enableArrowHead();
+ void disableArrowHead();
+
+protected:
+ std::unique_ptr<weld::Toolbar> mxTBColor;
+ std::unique_ptr<ToolbarUnoDispatcher> mxColorDispatch;
+
+ std::unique_ptr<weld::Toolbar> mxLineStyleTB;
+ std::unique_ptr<ToolbarUnoDispatcher> mxLineStyleDispatch;
+
+ sal_Int32 mnWidthCoreValue;
+
+private:
+ //ui controls
+ std::unique_ptr<weld::Label> mxFTWidth;
+ std::unique_ptr<weld::Toolbar> mxTBWidth;
+ std::unique_ptr<weld::Label> mxFTTransparency;
+ std::unique_ptr<weld::MetricSpinButton> mxMFTransparent;
+ std::unique_ptr<weld::Label> mxFTEdgeStyle;
+ std::unique_ptr<weld::ComboBox> mxLBEdgeStyle;
+ std::unique_ptr<weld::Label> mxFTCapStyle;
+ std::unique_ptr<weld::ComboBox> mxLBCapStyle;
+ std::unique_ptr<weld::Widget> mxGridLineProps;
+ std::unique_ptr<weld::Widget> mxBoxArrowProps;
+ //popup windows
+ std::unique_ptr<LineWidthPopup> mxLineWidthPopup;
+
+ std::unique_ptr<LineStyleNoneChange> mxLineStyleNoneChange;
+
+ sal_uInt16 mnTrans;
+ MapUnit meMapUnit;
+
+ // images from resource
+ OUString maIMGNone;
+
+ // multi-images
+ OUString maIMGWidthIcon[8];
+
+ bool mbWidthValuable : 1;
+ bool mbArrowSupported;
+ bool mbNoneLineStyle;
+
+ void Initialize();
+
+ DECL_DLLPRIVATE_LINK(ToolboxWidthSelectHdl, const OString&, void);
+ DECL_DLLPRIVATE_LINK(ChangeTransparentHdl, weld::MetricSpinButton&, void);
+ DECL_DLLPRIVATE_LINK(ChangeEdgeStyleHdl, weld::ComboBox&, void);
+ DECL_DLLPRIVATE_LINK(ChangeCapStyleHdl, weld::ComboBox&, void);
+};
+
+} // end of namespace svx::sidebar
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sidebar/LineWidthPopup.hxx b/include/svx/sidebar/LineWidthPopup.hxx
new file mode 100644
index 000000000..262f35409
--- /dev/null
+++ b/include/svx/sidebar/LineWidthPopup.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHPOPUP_HXX
+#define INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHPOPUP_HXX
+
+#include <tools/mapunit.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/image.hxx>
+#include <vcl/weld.hxx>
+#include <svtools/toolbarmenu.hxx>
+#include <array>
+
+class ValueSet;
+
+namespace svx::sidebar
+{
+class LinePropertyPanelBase;
+class LineWidthValueSet;
+
+class LineWidthPopup final : public WeldToolbarPopup
+{
+public:
+ LineWidthPopup(weld::Widget* pParent, LinePropertyPanelBase& rParent);
+ ~LineWidthPopup();
+
+ void SetWidthSelect(tools::Long lValue, bool bValuable, MapUnit eMapUnit);
+
+ weld::Container* getTopLevel() const { return m_xTopLevel.get(); }
+
+ virtual void GrabFocus() override;
+
+private:
+ LinePropertyPanelBase& m_rParent;
+ std::array<OUString, 9> maStrUnits;
+ OUString m_sPt;
+ MapUnit m_eMapUnit;
+ bool m_bVSFocus;
+ bool m_bCustom;
+ tools::Long m_nCustomWidth;
+ Image m_aIMGCus;
+ Image m_aIMGCusGray;
+
+ std::unique_ptr<weld::MetricSpinButton> m_xMFWidth;
+ std::unique_ptr<LineWidthValueSet> m_xVSWidth;
+ std::unique_ptr<weld::CustomWeld> m_xVSWidthWin;
+
+ DECL_LINK(VSSelectHdl, ValueSet*, void);
+ DECL_LINK(MFModifyHdl, weld::MetricSpinButton&, void);
+};
+
+} // end of namespace svx::sidebar
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sidebar/SelectionAnalyzer.hxx b/include/svx/sidebar/SelectionAnalyzer.hxx
new file mode 100644
index 000000000..349db8851
--- /dev/null
+++ b/include/svx/sidebar/SelectionAnalyzer.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SIDEBAR_SELECTIONANALYZER_HXX
+#define INCLUDED_SVX_SIDEBAR_SELECTIONANALYZER_HXX
+
+#include <vcl/EnumContext.hxx>
+#include <svx/svxdllapi.h>
+
+class SdrMarkList;
+class SdrObject;
+enum class SdrInventor : sal_uInt32;
+enum class SdrObjKind : sal_uInt16;
+
+namespace svx::sidebar {
+
+/** Analyze the current selection of Calc or Draw/Impress documents
+ and return the associated sidebar context.
+
+ The decision is based on heuristics. Do not expect pretty code.
+*/
+class SVX_DLLPUBLIC SelectionAnalyzer
+{
+public:
+ static vcl::EnumContext::Context GetContextForSelection_SC (
+ const SdrMarkList& rMarkList);
+
+ enum class ViewType
+ {
+ Standard,
+ Master,
+ Handout,
+ Notes,
+ };
+ static vcl::EnumContext::Context GetContextForSelection_SD (
+ const SdrMarkList& rMarkList,
+ const ViewType eViewType);
+
+private:
+ static vcl::EnumContext::Context GetContextForObjectId_SC (
+ const SdrObjKind nObjectId);
+ static vcl::EnumContext::Context GetContextForObjectId_SD (
+ const SdrObjKind nObjectId,
+ const ViewType eViewType);
+ static SdrInventor GetInventorTypeFromMark (
+ const SdrMarkList& rMarkList);
+ static SdrObjKind GetObjectTypeFromMark (
+ const SdrMarkList& rMarkList);
+ static SdrObjKind GetObjectTypeFromGroup (
+ const SdrObject* pObj);
+ static bool IsShapeType (
+ const SdrObjKind nType);
+ static bool IsTextObjType (
+ const SdrObjKind nType);
+};
+
+} // end of namespace svx::sidebar
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sidebar/SelectionChangeHandler.hxx b/include/svx/sidebar/SelectionChangeHandler.hxx
new file mode 100644
index 000000000..a4d5dbc32
--- /dev/null
+++ b/include/svx/sidebar/SelectionChangeHandler.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SIDEBAR_SELECTIONCHANGEHANDLER_HXX
+#define INCLUDED_SVX_SIDEBAR_SELECTIONCHANGEHANDLER_HXX
+
+#include <svx/svxdllapi.h>
+#include <vcl/EnumContext.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+
+#include <comphelper/compbase.hxx>
+
+#include <functional>
+
+class SdrMarkView;
+
+
+namespace svx::sidebar {
+
+typedef comphelper::WeakComponentImplHelper<
+ css::view::XSelectionChangeListener
+ > SelectionChangeHandlerInterfaceBase;
+
+class SVX_DLLPUBLIC SelectionChangeHandler final
+ : public SelectionChangeHandlerInterfaceBase
+{
+public:
+ SelectionChangeHandler (
+ const std::function<OUString ()>& rSelectionChangeCallback,
+ const css::uno::Reference<css::frame::XController>& rxController,
+ const vcl::EnumContext::Context eDefaultContext);
+ virtual ~SelectionChangeHandler() override;
+
+ virtual void SAL_CALL selectionChanged (const css::lang::EventObject& rEvent) override;
+
+ virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override;
+
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
+
+ void Connect();
+ void Disconnect();
+
+private:
+ SelectionChangeHandler(const SelectionChangeHandler&) = delete;
+ SelectionChangeHandler& operator=(const SelectionChangeHandler&) = delete;
+
+ const std::function<OUString ()> maSelectionChangeCallback;
+ css::uno::Reference<css::frame::XController> mxController;
+ const vcl::EnumContext::Context meDefaultContext;
+ bool mbIsConnected;
+};
+
+
+} // end of namespace svx::sidebar
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sidebar/ValueSetWithTextControl.hxx b/include/svx/sidebar/ValueSetWithTextControl.hxx
new file mode 100644
index 000000000..ac397f9fd
--- /dev/null
+++ b/include/svx/sidebar/ValueSetWithTextControl.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SIDEBAR_VALUESETWITHTEXTCONTROL_HXX
+#define INCLUDED_SVX_SIDEBAR_VALUESETWITHTEXTCONTROL_HXX
+
+#include <svx/svxdllapi.h>
+
+#include <svtools/valueset.hxx>
+
+#include <vector>
+
+namespace svx::sidebar
+{
+/** Specialization of class <ValueSet>.
+ This specialization allows is a one-columned ValueSet which allow
+ items containing an image and a text or a text and a second text.
+
+ Especially, used for sidebar related controls.
+*/
+class SVX_DLLPUBLIC ValueSetWithTextControl final : public ValueSet
+{
+public:
+ ValueSetWithTextControl();
+
+ SVX_DLLPRIVATE virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+
+ void AddItem(const OUString& rItemText, const OUString& rItemText2);
+
+ SVX_DLLPRIVATE virtual void UserDraw(const UserDrawEvent& rUDEvt) override;
+
+private:
+ struct ValueSetWithTextItem
+ {
+ OUString maItemText;
+ OUString maItemText2;
+ };
+
+ ::std::vector<ValueSetWithTextItem> maItems;
+};
+
+} // end of namespace svx::sidebar
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/signaturelinehelper.hxx b/include/svx/signaturelinehelper.hxx
new file mode 100644
index 000000000..9a10a09a2
--- /dev/null
+++ b/include/svx/signaturelinehelper.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVX_SIGNATURELINEHELPER_HXX
+#define INCLUDED_SVX_SIGNATURELINEHELPER_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/security/XCertificate.hpp>
+
+namespace weld
+{
+class Window;
+}
+class SdrView;
+class SfxObjectShell;
+
+namespace svx::SignatureLineHelper
+{
+/**
+ * Returns an SVG template. Once placeholders are replaced with real content, the result can be used
+ * as the graphic of a signature line shape.
+ */
+SVX_DLLPUBLIC OUString getSignatureImage(const OUString& rType = OUString());
+
+/**
+ * Choose a signature for signature line purposes.
+ */
+SVX_DLLPUBLIC css::uno::Reference<css::security::XCertificate>
+getSignatureCertificate(SfxObjectShell* pShell, weld::Window* pParent);
+
+/**
+ * Get a signer name out of a certificate.
+ */
+SVX_DLLPUBLIC OUString
+getSignerName(const css::uno::Reference<css::security::XCertificate>& xCertificate);
+
+/**
+ * Gets a localized date string.
+ */
+SVX_DLLPUBLIC OUString getLocalizedDate();
+
+/**
+ * Interprets rSVG as a graphic and gives back the resulting UNO wrapper.
+ */
+SVX_DLLPUBLIC css::uno::Reference<css::graphic::XGraphic> importSVG(std::u16string_view rSVG);
+
+/**
+ * Sets xCertificate as the signing certificate of the selected shape on pView.
+ */
+SVX_DLLPUBLIC void
+setShapeCertificate(const SdrView* pView,
+ const css::uno::Reference<css::security::XCertificate>& xCertificate);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/spacinglistbox.hxx b/include/svx/spacinglistbox.hxx
new file mode 100644
index 000000000..125da36d0
--- /dev/null
+++ b/include/svx/spacinglistbox.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SPACINGLISTBOXHELPER_HXX
+#define INCLUDED_SVX_SPACINGLISTBOXHELPER_HXX
+
+#include <svx/svxdllapi.h>
+#include <vcl/weld.hxx>
+
+enum class SpacingType
+{
+ SPACING_INCH,
+ MARGINS_INCH,
+ SPACING_CM,
+ MARGINS_CM
+};
+
+/// Custom Widget ListBox to hold entries for Spacing & Margin settings of Header/Footer
+namespace SpacingListBox
+{
+void SVXCORE_DLLPUBLIC Fill(SpacingType eType, weld::ComboBox&);
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sphere3d.hxx b/include/svx/sphere3d.hxx
new file mode 100644
index 000000000..4de73c1aa
--- /dev/null
+++ b/include/svx/sphere3d.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SPHERE3D_HXX
+#define INCLUDED_SVX_SPHERE3D_HXX
+
+#include <svl/intitem.hxx>
+#include <svl/itemset.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/svddef.hxx>
+
+class E3dDefaultAttributes;
+
+/**
+ * SphereObject with diameter r3DSize.
+ * The count of planes depends on the horizontal and vertical segment count.
+ */
+class SVXCORE_DLLPUBLIC E3dSphereObj final : public E3dCompoundObject
+{
+private:
+ basegfx::B3DPoint aCenter;
+ basegfx::B3DVector aSize;
+
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+ void SetDefaultAttributes(const E3dDefaultAttributes& rDefault);
+
+private:
+ // protected destructor - due to final, make private
+ virtual ~E3dSphereObj() override;
+
+public:
+ E3dSphereObj(
+ SdrModel& rSdrModel,
+ const E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPoint& rCenter,
+ const basegfx::B3DVector& r3DSize);
+
+ // FG: This constructor is only called from MakeObject from the 3d-Objectfactory
+ // when a document with a sphere is loaded. This constructor does not call
+ // CreateSphere, or create any spheres.
+ E3dSphereObj(SdrModel& rSdrModel);
+ E3dSphereObj(SdrModel& rSdrModel, E3dSphereObj const & rSource);
+
+ // horizontal segments:
+ sal_uInt32 GetHorizontalSegments() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_HORZ_SEGS).GetValue(); }
+
+ // VerticalSegments:
+ sal_uInt32 GetVerticalSegments() const
+ { return GetObjectItemSet().Get(SDRATTR_3DOBJ_VERT_SEGS).GetValue(); }
+
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ virtual E3dSphereObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ const basegfx::B3DPoint& Center() const { return aCenter; }
+ const basegfx::B3DVector& Size() const { return aSize; }
+
+ // set local parameters when the geometry is recreated
+ void SetCenter(const basegfx::B3DPoint& rNew);
+ void SetSize(const basegfx::B3DVector& rNew);
+
+ // TakeObjName...() is for displaying in the UI, eg "3 selected frames."
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+};
+
+#endif // INCLUDED_SVX_SPHERE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
new file mode 100644
index 000000000..2b975e435
--- /dev/null
+++ b/include/svx/srchdlg.hxx
@@ -0,0 +1,270 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SRCHDLG_HXX
+#define INCLUDED_SVX_SRCHDLG_HXX
+
+#include <sfx2/childwin.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/srchdefs.hxx>
+#include <svl/srchitem.hxx>
+#include <svx/svxdllapi.h>
+#include <vcl/timer.hxx>
+#include <memory>
+#include <vector>
+
+class SvxSearchItem;
+class SfxStyleSheetBasePool;
+class SvxJSearchOptionsPage;
+class SvxSearchController;
+class VclAbstractDialog;
+struct SearchDlg_Impl;
+enum class ModifyFlags;
+enum class TransliterationFlags;
+
+struct SearchAttrItem
+{
+ sal_uInt16 nSlot;
+ SfxPoolItem* pItem;
+};
+
+typedef std::vector<SearchAttrItem> SrchAttrItemList;
+
+class SVX_DLLPUBLIC SearchAttrItemList : private SrchAttrItemList
+{
+public:
+ SearchAttrItemList() {}
+ SearchAttrItemList( const SearchAttrItemList& rList );
+ SearchAttrItemList( SearchAttrItemList&& rList );
+ ~SearchAttrItemList();
+
+ void Put( const SfxItemSet& rSet );
+ SfxItemSet& Get( SfxItemSet& rSet );
+ void Clear();
+ sal_uInt16 Count() const { return SrchAttrItemList::size(); }
+ SearchAttrItem& operator[](sal_uInt16 nPos)
+ { return SrchAttrItemList::operator[]( nPos ); }
+ SearchAttrItem& GetObject( sal_uInt16 nPos )
+ { return SrchAttrItemList::operator[]( nPos ); }
+
+ // the pointer to the item is not being copied, so don't delete
+ void Insert( const SearchAttrItem& rItem )
+ { SrchAttrItemList::push_back( rItem ); }
+ // deletes the pointer to the items
+ void Remove(size_t nPos);
+};
+
+enum class SearchLabel
+{
+ Empty,
+ End,
+ Start,
+ EndSheet,
+ NotFound,
+ StartWrapped,
+ EndWrapped,
+ NavElementNotFound,
+ ReminderStartWrapped,
+ ReminderEndWrapped
+};
+
+class SvxSearchDialog;
+class SVX_DLLPUBLIC SvxSearchDialogWrapper final : public SfxChildWindow
+{
+ std::shared_ptr<SvxSearchDialog> dialog;
+public:
+ SvxSearchDialogWrapper( vcl::Window*pParent, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo const * pInfo );
+
+ virtual ~SvxSearchDialogWrapper () override;
+ SvxSearchDialog *getDialog () { return dialog.get();}
+ static void SetSearchLabel(const SearchLabel& rSL);
+ static void SetSearchLabel(const OUString& sStr);
+ static OUString GetSearchLabel();
+ SFX_DECL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper);
+};
+
+/**
+ In this modeless dialog the attributes for a search are configured
+ and a search is started from it. Several search types
+ (search, search all, replace, replace all) are possible.
+
+ */
+
+class SVX_DLLPUBLIC SvxSearchDialog final : public SfxModelessDialogController
+{
+friend class SvxSearchController;
+friend class SvxSearchDialogWrapper;
+friend class SvxJSearchOptionsDialog;
+
+public:
+ SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
+ virtual ~SvxSearchDialog() override;
+
+ virtual void ChildWinDispose() override;
+ virtual void Close() override;
+
+ // Window
+ virtual void Activate() override;
+
+ const SearchAttrItemList* GetSearchItemList() const
+ { return pSearchList.get(); }
+ const SearchAttrItemList* GetReplaceItemList() const
+ { return pReplaceList.get(); }
+
+ TransliterationFlags GetTransliterationFlags() const;
+
+ void SetSaveToModule(bool b);
+
+ void SetSearchLabel(const OUString& rStr);
+
+ // bring this window back to the foreground
+ void Present();
+
+private:
+ SfxBindings& rBindings;
+ Timer m_aPresentIdle;
+ bool bWriter;
+ bool bSearch;
+ bool bFormat;
+ bool bReplaceBackwards;
+ SearchOptionFlags nOptions;
+ bool bSet;
+ bool bConstruct;
+ ModifyFlags nModifyFlag;
+ OUString aStylesStr;
+ OUString aLayoutStr;
+ OUString aLayoutWriterStr;
+ OUString aLayoutCalcStr;
+ OUString aCalcStr;
+ sal_uInt16 nRememberSize;
+
+ std::vector<OUString> aSearchStrings;
+ std::vector<OUString> aReplaceStrings;
+
+ std::unique_ptr<SearchDlg_Impl> pImpl;
+ std::unique_ptr<SearchAttrItemList> pSearchList;
+ std::unique_ptr<SearchAttrItemList> pReplaceList;
+ std::unique_ptr<SvxSearchItem> pSearchItem;
+
+ std::unique_ptr<SvxSearchController> pSearchController;
+ std::unique_ptr<SvxSearchController> pOptionsController;
+ std::unique_ptr<SvxSearchController> pFamilyController;
+
+ mutable TransliterationFlags
+ nTransliterationFlags;
+
+ bool m_executingSubDialog = false;
+
+ std::unique_ptr<weld::Frame> m_xSearchFrame;
+ std::unique_ptr<weld::ComboBox> m_xSearchLB;
+ std::unique_ptr<weld::ComboBox> m_xSearchTmplLB;
+ std::unique_ptr<weld::Label> m_xSearchAttrText;
+ std::unique_ptr<weld::Label> m_xSearchLabel;
+
+ std::unique_ptr<weld::Frame> m_xReplaceFrame;
+ std::unique_ptr<weld::ComboBox> m_xReplaceLB;
+ std::unique_ptr<weld::ComboBox> m_xReplaceTmplLB;
+ std::unique_ptr<weld::Label> m_xReplaceAttrText;
+
+ std::unique_ptr<weld::Button> m_xSearchBtn;
+ std::unique_ptr<weld::Button> m_xBackSearchBtn;
+ std::unique_ptr<weld::Button> m_xSearchAllBtn;
+ std::unique_ptr<weld::Button> m_xReplaceBtn;
+ std::unique_ptr<weld::Button> m_xReplaceAllBtn;
+
+ std::unique_ptr<weld::Frame> m_xComponentFrame;
+ std::unique_ptr<weld::Button> m_xSearchComponent1PB;
+ std::unique_ptr<weld::Button> m_xSearchComponent2PB;
+
+ std::unique_ptr<weld::CheckButton> m_xMatchCaseCB;
+ std::unique_ptr<weld::CheckButton> m_xSearchFormattedCB;
+ std::unique_ptr<weld::CheckButton> m_xWordBtn;
+
+ std::unique_ptr<weld::Button> m_xCloseBtn;
+ std::unique_ptr<weld::CheckButton> m_xIncludeDiacritics;
+ std::unique_ptr<weld::CheckButton> m_xIncludeKashida;
+ std::unique_ptr<weld::Expander> m_xOtherOptionsExpander;
+ std::unique_ptr<weld::CheckButton> m_xSelectionBtn;
+ std::unique_ptr<weld::CheckButton> m_xRegExpBtn;
+ std::unique_ptr<weld::CheckButton> m_xWildcardBtn;
+ std::unique_ptr<weld::CheckButton> m_xSimilarityBox;
+ std::unique_ptr<weld::Button> m_xSimilarityBtn;
+ std::unique_ptr<weld::CheckButton> m_xLayoutBtn;
+ std::unique_ptr<weld::CheckButton> m_xNotesBtn;
+ std::unique_ptr<weld::CheckButton> m_xJapMatchFullHalfWidthCB;
+ std::unique_ptr<weld::CheckButton> m_xJapOptionsCB;
+ std::unique_ptr<weld::CheckButton> m_xReplaceBackwardsCB;
+ std::unique_ptr<weld::Button> m_xJapOptionsBtn;
+
+ std::unique_ptr<weld::Button> m_xAttributeBtn;
+ std::unique_ptr<weld::Button> m_xFormatBtn;
+ std::unique_ptr<weld::Button> m_xNoFormatBtn;
+
+ std::unique_ptr<weld::Widget> m_xCalcGrid;
+ std::unique_ptr<weld::Label> m_xCalcSearchInFT;
+ std::unique_ptr<weld::ComboBox> m_xCalcSearchInLB;
+ std::unique_ptr<weld::Label> m_xCalcSearchDirFT;
+ std::unique_ptr<weld::RadioButton> m_xRowsBtn;
+ std::unique_ptr<weld::RadioButton> m_xColumnsBtn;
+ std::unique_ptr<weld::CheckButton> m_xAllSheetsCB;
+ std::unique_ptr<weld::Label> m_xCalcStrFT;
+
+ DECL_DLLPRIVATE_LINK( ModifyHdl_Impl, weld::ComboBox&, void );
+ DECL_DLLPRIVATE_LINK( FlagHdl_Impl, weld::Toggleable&, void );
+ DECL_DLLPRIVATE_LINK( CommandHdl_Impl, weld::Button&, void );
+ DECL_DLLPRIVATE_LINK(TemplateHdl_Impl, weld::Toggleable&, void);
+ DECL_DLLPRIVATE_LINK( FocusHdl_Impl, weld::Widget&, void );
+ DECL_DLLPRIVATE_LINK( LBSelectHdl_Impl, weld::ComboBox&, void );
+ DECL_DLLPRIVATE_LINK(LoseFocusHdl_Impl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(FormatHdl_Impl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(NoFormatHdl_Impl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(AttributeHdl_Impl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK( TimeoutHdl_Impl, Timer*, void );
+ SVX_DLLPRIVATE void ClickHdl_Impl(const weld::Widget* pCtrl);
+
+ SVX_DLLPRIVATE void Construct_Impl();
+ SVX_DLLPRIVATE void InitControls_Impl();
+ SVX_DLLPRIVATE void ShowOptionalControls_Impl();
+ SVX_DLLPRIVATE void Init_Impl( bool bHasItemSet );
+ SVX_DLLPRIVATE void InitAttrList_Impl( const SfxItemSet* pSSet,
+ const SfxItemSet* pRSet );
+ SVX_DLLPRIVATE void Remember_Impl( const OUString &rStr, bool bSearch );
+ SVX_DLLPRIVATE void PaintAttrText_Impl();
+ SVX_DLLPRIVATE OUString& BuildAttrText_Impl( OUString& rStr, bool bSrchFlag ) const;
+
+ SVX_DLLPRIVATE void TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool );
+ SVX_DLLPRIVATE void EnableControls_Impl( const SearchOptionFlags nFlags );
+ SVX_DLLPRIVATE void EnableControl_Impl(const weld::Widget& rCtrl);
+ SVX_DLLPRIVATE void SetItem_Impl( const SvxSearchItem* pItem );
+
+ SVX_DLLPRIVATE void SetModifyFlag_Impl(const weld::Widget* pCtrl);
+ SVX_DLLPRIVATE void SaveToModule_Impl();
+
+ SVX_DLLPRIVATE void ApplyTransliterationFlags_Impl( TransliterationFlags nSettings );
+ SVX_DLLPRIVATE bool IsOtherOptionsExpanded() const;
+
+ SVX_DLLPRIVATE short executeSubDialog(VclAbstractDialog * dialog);
+
+ DECL_DLLPRIVATE_LINK(PresentTimeoutHdl_Impl, Timer*, void);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/strarray.hxx b/include/svx/strarray.hxx
new file mode 100644
index 000000000..f0cc28a38
--- /dev/null
+++ b/include/svx/strarray.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_STRARRAY_HXX
+#define INCLUDED_SVX_STRARRAY_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/fldunit.hxx>
+#include <svx/svxdllapi.h>
+
+class SVX_DLLPUBLIC SvxFieldUnitTable
+{
+public:
+ static OUString GetString(sal_uInt32 i);
+ static sal_uInt32 Count();
+ static FieldUnit GetValue(sal_uInt32 i);
+};
+
+class SVX_DLLPUBLIC SvxNumberingTypeTable
+{
+public:
+ static OUString GetString(sal_uInt32 i);
+ static sal_uInt32 Count();
+ static int GetValue(sal_uInt32 i);
+ static sal_uInt32 FindIndex(int nValue);
+};
+
+class SVX_DLLPUBLIC SvxAttrNameTable
+{
+public:
+ static OUString GetString(sal_uInt32 i);
+ static sal_uInt32 Count();
+ static sal_uInt32 FindIndex(int nValue);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
new file mode 100644
index 000000000..747e3fdcd
--- /dev/null
+++ b/include/svx/strings.hrc
@@ -0,0 +1,1838 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_INC_STRINGS_HRC
+#define INCLUDED_SVX_INC_STRINGS_HRC
+
+#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
+
+#define STR_ObjNameSingulNONE NC_("STR_ObjNameSingulNONE", "Drawing object")
+#define STR_ObjNamePluralNONE NC_("STR_ObjNamePluralNONE", "Drawing objects")
+#define STR_ObjNameSingulGRUP NC_("STR_ObjNameSingulGRUP", "Group object")
+#define STR_ObjNameSingulDIAGRAM NC_("STR_ObjNameSingulDIAGRAM", "Diagram")
+#define STR_ObjNamePluralGRUP NC_("STR_ObjNamePluralGRUP", "Group objects")
+#define STR_ObjNameSingulGRUPEMPTY NC_("STR_ObjNameSingulGRUPEMPTY", "Blank group object")
+#define STR_ObjNamePluralGRUPEMPTY NC_("STR_ObjNamePluralGRUPEMPTY", "Blank group objects")
+#define STR_ObjNameSingulLINE NC_("STR_ObjNameSingulLINE", "Line")
+#define STR_ObjNameSingulLINE_Hori NC_("STR_ObjNameSingulLINE_Hori", "Horizontal line")
+#define STR_ObjNameSingulLINE_Vert NC_("STR_ObjNameSingulLINE_Vert", "Vertical line")
+#define STR_ObjNameSingulLINE_Diag NC_("STR_ObjNameSingulLINE_Diag", "Diagonal line")
+#define STR_ObjNamePluralLINE NC_("STR_ObjNamePluralLINE", "Lines")
+#define STR_ObjNameSingulRECT NC_("STR_ObjNameSingulRECT", "Rectangle")
+#define STR_ObjNamePluralRECT NC_("STR_ObjNamePluralRECT", "Rectangles")
+#define STR_ObjNameSingulQUAD NC_("STR_ObjNameSingulQUAD", "Square")
+#define STR_ObjNamePluralQUAD NC_("STR_ObjNamePluralQUAD", "Squares")
+#define STR_ObjNameSingulPARAL NC_("STR_ObjNameSingulPARAL", "Parallelogram")
+#define STR_ObjNamePluralPARAL NC_("STR_ObjNamePluralPARAL", "Parallelograms")
+#define STR_ObjNameSingulRECTRND NC_("STR_ObjNameSingulRECTRND", "Rounded rectangle")
+#define STR_ObjNamePluralRECTRND NC_("STR_ObjNamePluralRECTRND", "Rounded Rectangles")
+#define STR_ObjNameSingulQUADRND NC_("STR_ObjNameSingulQUADRND", "rounded square")
+#define STR_ObjNamePluralQUADRND NC_("STR_ObjNamePluralQUADRND", "Rounded Squares")
+#define STR_ObjNameSingulPARALRND NC_("STR_ObjNameSingulPARALRND", "Rounded Parallelogram")
+#define STR_ObjNamePluralPARALRND NC_("STR_ObjNamePluralPARALRND", "Rounded parallelograms")
+#define STR_ObjNameSingulCIRC NC_("STR_ObjNameSingulCIRC", "Circle")
+#define STR_ObjNamePluralCIRC NC_("STR_ObjNamePluralCIRC", "Circles")
+#define STR_ObjNameSingulSECT NC_("STR_ObjNameSingulSECT", "Circle sector")
+#define STR_ObjNamePluralSECT NC_("STR_ObjNamePluralSECT", "Circle sectors")
+#define STR_ObjNameSingulCARC NC_("STR_ObjNameSingulCARC", "Arc")
+#define STR_ObjNamePluralCARC NC_("STR_ObjNamePluralCARC", "Arcs")
+#define STR_ObjNameSingulCCUT NC_("STR_ObjNameSingulCCUT", "Circle segment")
+#define STR_ObjNamePluralCCUT NC_("STR_ObjNamePluralCCUT", "Circle segments")
+#define STR_ObjNameSingulCIRCE NC_("STR_ObjNameSingulCIRCE", "Ellipse")
+#define STR_ObjNamePluralCIRCE NC_("STR_ObjNamePluralCIRCE", "Ellipses")
+#define STR_ObjNameSingulSECTE NC_("STR_ObjNameSingulSECTE", "Ellipse Pie")
+#define STR_ObjNamePluralSECTE NC_("STR_ObjNamePluralSECTE", "Ellipse Pies")
+#define STR_ObjNameSingulCARCE NC_("STR_ObjNameSingulCARCE", "Elliptical arc")
+#define STR_ObjNamePluralCARCE NC_("STR_ObjNamePluralCARCE", "Elliptical arcs")
+#define STR_ObjNameSingulCCUTE NC_("STR_ObjNameSingulCCUTE", "Ellipse Segment")
+#define STR_ObjNamePluralCCUTE NC_("STR_ObjNamePluralCCUTE", "Ellipse Segments")
+#define STR_ObjNameSingulPOLY NC_("STR_ObjNameSingulPOLY", "Polygon")
+#define STR_ObjNameSingulPOLY_PointCount NC_("STR_ObjNameSingulPOLY_PointCount", "Polygon %2 corners")
+#define STR_ObjNamePluralPOLY NC_("STR_ObjNamePluralPOLY", "Polygons")
+#define STR_ObjNameSingulPLIN NC_("STR_ObjNameSingulPLIN", "Polyline")
+#define STR_ObjNameSingulPLIN_PointCount NC_("STR_ObjNameSingulPLIN_PointCount", "Polyline with %2 corners")
+#define STR_ObjNamePluralPLIN NC_("STR_ObjNamePluralPLIN", "Polylines")
+#define STR_ObjNameSingulPATHLINE NC_("STR_ObjNameSingulPATHLINE", "Bézier curve")
+#define STR_ObjNamePluralPATHLINE NC_("STR_ObjNamePluralPATHLINE", "Bézier curves")
+#define STR_ObjNameSingulPATHFILL NC_("STR_ObjNameSingulPATHFILL", "Bézier curve")
+#define STR_ObjNamePluralPATHFILL NC_("STR_ObjNamePluralPATHFILL", "Bézier curves")
+#define STR_ObjNameSingulFREELINE NC_("STR_ObjNameSingulFREELINE", "Freeform Line")
+#define STR_ObjNamePluralFREELINE NC_("STR_ObjNamePluralFREELINE", "Freeform Lines")
+#define STR_ObjNameSingulFREEFILL NC_("STR_ObjNameSingulFREEFILL", "Freeform Line")
+#define STR_ObjNamePluralFREEFILL NC_("STR_ObjNamePluralFREEFILL", "Freeform Lines")
+#define STR_ObjNameSingulCOMBLINE NC_("STR_ObjNameSingulCOMBLINE", "Curve")
+#define STR_ObjNameSingulNATSPLN NC_("STR_ObjNameSingulNATSPLN", "Natural Spline")
+#define STR_ObjNamePluralNATSPLN NC_("STR_ObjNamePluralNATSPLN", "Natural Splines")
+#define STR_ObjNameSingulPERSPLN NC_("STR_ObjNameSingulPERSPLN", "Periodic Spline")
+#define STR_ObjNamePluralPERSPLN NC_("STR_ObjNamePluralPERSPLN", "Periodic Splines")
+#define STR_ObjNameSingulTEXT NC_("STR_ObjNameSingulTEXT", "Text Frame")
+#define STR_ObjNamePluralTEXT NC_("STR_ObjNamePluralTEXT", "Text Frame")
+#define STR_ObjNameSingulTEXTLNK NC_("STR_ObjNameSingulTEXTLNK", "Linked text frame")
+#define STR_ObjNamePluralTEXTLNK NC_("STR_ObjNamePluralTEXTLNK", "Linked text frames")
+#define STR_ObjNameSingulTITLETEXT NC_("STR_ObjNameSingulTITLETEXT", "Title text")
+#define STR_ObjNamePluralTITLETEXT NC_("STR_ObjNamePluralTITLETEXT", "Title texts")
+#define STR_ObjNameSingulOUTLINETEXT NC_("STR_ObjNameSingulOUTLINETEXT", "Outline Text")
+#define STR_ObjNamePluralOUTLINETEXT NC_("STR_ObjNamePluralOUTLINETEXT", "Outline Texts")
+#define STR_ObjNameSingulGRAF NC_("STR_ObjNameSingulGRAF", "Image")
+#define STR_ObjNamePluralGRAF NC_("STR_ObjNamePluralGRAF", "Images")
+#define STR_ObjNameSingulGRAFLNK NC_("STR_ObjNameSingulGRAFLNK", "Linked image")
+#define STR_ObjNamePluralGRAFLNK NC_("STR_ObjNamePluralGRAFLNK", "Linked images")
+#define STR_ObjNameSingulGRAFNONE NC_("STR_ObjNameSingulGRAFNONE", "Blank image object")
+#define STR_ObjNamePluralGRAFNONE NC_("STR_ObjNamePluralGRAFNONE", "Blank image objects")
+#define STR_ObjNameSingulGRAFNONELNK NC_("STR_ObjNameSingulGRAFNONELNK", "Blank linked image")
+#define STR_ObjNamePluralGRAFNONELNK NC_("STR_ObjNamePluralGRAFNONELNK", "Blank linked images")
+#define STR_ObjNameSingulGRAFMTF NC_("STR_ObjNameSingulGRAFMTF", "Metafile")
+#define STR_ObjNamePluralGRAFMTF NC_("STR_ObjNamePluralGRAFMTF", "Metafiles")
+#define STR_ObjNameSingulGRAFMTFLNK NC_("STR_ObjNameSingulGRAFMTFLNK", "Linked Metafile")
+#define STR_ObjNamePluralGRAFMTFLNK NC_("STR_ObjNamePluralGRAFMTFLNK", "Linked Metafiles")
+#define STR_ObjNameSingulGRAFBMP NC_("STR_ObjNameSingulGRAFBMP", "Image")
+#define STR_ObjNameSingulGRAFBMPTRANS NC_("STR_ObjNameSingulGRAFBMPTRANS", "Image with transparency")
+#define STR_ObjNameSingulGRAFBMPLNK NC_("STR_ObjNameSingulGRAFBMPLNK", "Linked Image")
+#define STR_ObjNameSingulGRAFBMPTRANSLNK NC_("STR_ObjNameSingulGRAFBMPTRANSLNK", "Linked image with transparency")
+#define STR_ObjNamePluralGRAFBMP NC_("STR_ObjNamePluralGRAFBMP", "Images")
+#define STR_ObjNamePluralGRAFBMPTRANS NC_("STR_ObjNamePluralGRAFBMPTRANS", "Images with transparency")
+#define STR_ObjNamePluralGRAFBMPLNK NC_("STR_ObjNamePluralGRAFBMPLNK", "Linked images")
+#define STR_ObjNamePluralGRAFBMPTRANSLNK NC_("STR_ObjNamePluralGRAFBMPTRANSLNK", "Linked images with transparency")
+#define STR_ObjNameSingulCUSTOMSHAPE NC_("STR_ObjNameSingulCUSTOMSHAPE", "Shape")
+#define STR_ObjNamePluralCUSTOMSHAPE NC_("STR_ObjNamePluralCUSTOMSHAPE", "Shapes")
+#define STR_ObjNameSingulGRAFSVG NC_("STR_ObjNameSingulGRAFSVG", "SVG")
+#define STR_ObjNamePluralGRAFSVG NC_("STR_ObjNamePluralGRAFSVG", "SVGs")
+#define STR_ObjNameSingulGRAFWMF NC_("STR_ObjNameSingulGRAFWMF", "WMF")
+#define STR_ObjNamePluralGRAFWMF NC_("STR_ObjNamePluralGRAFWMF", "WMFs")
+#define STR_ObjNameSingulGRAFEMF NC_("STR_ObjNameSingulGRAFEMF", "EMF")
+#define STR_ObjNamePluralGRAFEMF NC_("STR_ObjNamePluralGRAFEMF", "EMFs")
+#define STR_ObjNameSingulGRAFPDF NC_("STR_ObjNameSingulGRAFEMF", "PDF")
+#define STR_ObjNamePluralGRAFPDF NC_("STR_ObjNamePluralGRAFEMF", "PDFs")
+#define STR_ObjNameSingulOLE2 NC_("STR_ObjNameSingulOLE2", "embedded object (OLE)")
+#define STR_ObjNamePluralOLE2 NC_("STR_ObjNamePluralOLE2", "Embedded objects (OLE)")
+#define STR_ObjNameSingulUno NC_("STR_ObjNameSingulUno", "Control")
+#define STR_ObjNamePluralUno NC_("STR_ObjNamePluralUno", "Controls")
+#define STR_ObjNameSingulFrame NC_("STR_ObjNameSingulFrame", "Frame")
+#define STR_ObjNamePluralFrame NC_("STR_ObjNamePluralFrame", "Frames")
+#define STR_ObjNameSingulEDGE NC_("STR_ObjNameSingulEDGE", "Object Connectors")
+#define STR_ObjNamePluralEDGE NC_("STR_ObjNamePluralEDGE", "Object Connectors")
+#define STR_ObjNameSingulCAPTION NC_("STR_ObjNameSingulCAPTION", "Callout")
+#define STR_ObjNamePluralCAPTION NC_("STR_ObjNamePluralCAPTION", "Callouts")
+#define STR_ObjNameSingulPAGE NC_("STR_ObjNameSingulPAGE", "Preview object")
+#define STR_ObjNamePluralPAGE NC_("STR_ObjNamePluralPAGE", "Preview objects")
+#define STR_ObjNameSingulMEASURE NC_("STR_ObjNameSingulMEASURE", "Dimension line")
+#define STR_ObjNamePluralMEASURE NC_("STR_ObjNamePluralMEASURE", "Dimensioning objects")
+#define STR_ObjNamePlural NC_("STR_ObjNamePlural", "Drawing objects")
+#define STR_ObjNameNoObj NC_("STR_ObjNameNoObj", "No draw object")
+#define STR_ObjNameSingulPlural NC_("STR_ObjNameSingulPlural", "Draw object(s)")
+#define STR_ObjNameSingulCube3d NC_("STR_ObjNameSingulCube3d", "3D cube")
+#define STR_ObjNamePluralCube3d NC_("STR_ObjNamePluralCube3d", "3D cubes")
+#define STR_ObjNameSingulExtrude3d NC_("STR_ObjNameSingulExtrude3d", "Extrusion object")
+#define STR_ObjNamePluralExtrude3d NC_("STR_ObjNamePluralExtrude3d", "Extrusion objects")
+#define STR_ObjNameSingulLathe3d NC_("STR_ObjNameSingulLathe3d", "Rotation object")
+#define STR_ObjNamePluralLathe3d NC_("STR_ObjNamePluralLathe3d", "Rotation objects")
+#define STR_ObjNameSingulObj3d NC_("STR_ObjNameSingulObj3d", "3D object")
+#define STR_ObjNamePluralObj3d NC_("STR_ObjNamePluralObj3d", "3D objects")
+#define STR_ObjNameSingulScene3d NC_("STR_ObjNameSingulScene3d", "3D scene")
+#define STR_ObjNamePluralScene3d NC_("STR_ObjNamePluralScene3d", "3D scenes")
+#define STR_ObjNameSingulSphere3d NC_("STR_ObjNameSingulSphere3d", "Sphere")
+#define STR_ObjNamePluralSphere3d NC_("STR_ObjNamePluralSphere3d", "Spheres")
+#define STR_EditWithCopy NC_("STR_EditWithCopy", "with copy")
+#define STR_EditPosSize NC_("STR_EditPosSize", "Set position and size for %1")
+#define STR_EditDelete NC_("STR_EditDelete", "Delete %1")
+#define STR_EditMovToTop NC_("STR_EditMovToTop", "Move %1 forward")
+#define STR_EditMovToBtm NC_("STR_EditMovToBtm", "Move %1 further back")
+#define STR_EditPutToTop NC_("STR_EditPutToTop", "Move %1 to front")
+#define STR_EditPutToBtm NC_("STR_EditPutToBtm", "Move %1 to back")
+#define STR_EditRevOrder NC_("STR_EditRevOrder", "Reverse order of %1")
+#define STR_SortShapes NC_("STR_SortShapes", "Sort shapes")
+#define STR_EditMove NC_("STR_EditMove", "Move %1")
+#define STR_EditResize NC_("STR_EditResize", "Resize %1")
+#define STR_EditRotate NC_("STR_EditRotate", "Rotate %1")
+#define STR_EditMirrorHori NC_("STR_EditMirrorHori", "Flip %1 horizontal")
+#define STR_EditMirrorVert NC_("STR_EditMirrorVert", "Flip %1 vertical")
+#define STR_EditMirrorDiag NC_("STR_EditMirrorDiag", "Flip %1 diagonal")
+#define STR_EditMirrorFree NC_("STR_EditMirrorFree", "Flip %1 freehand")
+#define STR_EditShear NC_("STR_EditShear", "Distort %1 (slant)")
+#define STR_EditCrook NC_("STR_EditCrook", "Arrange %1 in circle")
+#define STR_EditCrookContortion NC_("STR_EditCrookContortion", "Curve %1 in circle")
+#define STR_EditDistort NC_("STR_EditDistort", "Distort %1")
+#define STR_EditRipUp NC_("STR_EditRipUp", "Undo %1")
+#define STR_EditSetPointsSmooth NC_("STR_EditSetPointsSmooth", "Modify bézier properties of %1")
+#define STR_EditSetSegmentsKind NC_("STR_EditSetSegmentsKind", "Modify bézier properties of %1")
+#define STR_EditSetGlueEscDir NC_("STR_EditSetGlueEscDir", "Set exit direction for %1")
+#define STR_EditSetGluePercent NC_("STR_EditSetGluePercent", "Set relative attribute at %1")
+#define STR_EditSetGlueAlign NC_("STR_EditSetGlueAlign", "Set reference point for %1")
+#define STR_EditGroup NC_("STR_EditGroup", "Group %1")
+#define STR_EditUngroup NC_("STR_EditUngroup", "Ungroup %1")
+#define STR_EditSetAttributes NC_("STR_EditSetAttributes", "Apply attributes to %1")
+#define STR_EditSetStylesheet NC_("STR_EditSetStylesheet", "Apply Styles to %1")
+#define STR_EditDelStylesheet NC_("STR_EditDelStylesheet", "Remove Style from %1")
+#define STR_EditConvToPoly NC_("STR_EditConvToPoly", "Convert %1 to polygon")
+#define STR_EditConvToPolys NC_("STR_EditConvToPolys", "Convert %1 to polygons")
+#define STR_EditConvToCurve NC_("STR_EditConvToCurve", "Convert %1 to curve")
+#define STR_EditConvToCurves NC_("STR_EditConvToCurves", "Convert %1 to curves")
+#define STR_EditConvToContour NC_("STR_EditConvToContour", "Convert %1 to contour")
+#define STR_EditConvToContours NC_("STR_EditConvToContours", "Convert %1 to contours")
+#define STR_EditAlign NC_("STR_EditAlign", "Align %1")
+#define STR_EditAlignVTop NC_("STR_EditAlignVTop", "Align %1 to top")
+#define STR_EditAlignVBottom NC_("STR_EditAlignVBottom", "Align %1 to bottom")
+#define STR_EditAlignVCenter NC_("STR_EditAlignVCenter", "Horizontally center %1")
+#define STR_EditAlignHLeft NC_("STR_EditAlignHLeft", "Align %1 to left")
+#define STR_EditAlignHRight NC_("STR_EditAlignHRight", "Align %1 to right")
+#define STR_EditAlignHCenter NC_("STR_EditAlignHCenter", "Vertically center %1")
+#define STR_EditAlignCenter NC_("STR_EditAlignCenter", "Center %1")
+#define STR_EditTransform NC_("STR_EditTransform", "Transform %1")
+#define STR_EditCombine_PolyPoly NC_("STR_EditCombine_PolyPoly", "Combine %1")
+#define STR_EditMergeMergePoly NC_("STR_EditMergeMergePoly", "Merge %1")
+#define STR_EditMergeSubstractPoly NC_("STR_EditMergeSubstractPoly", "Subtract %1")
+#define STR_EditMergeIntersectPoly NC_("STR_EditMergeIntersectPoly", "Intersect %1")
+#define STR_DistributeMarkedObjects NC_("STR_DistributeMarkedObjects", "Distribute selected objects")
+#define STR_EqualizeWidthMarkedObjects NC_("STR_EqualizeWidthMarkedObjects", "Equalize Width %1")
+#define STR_EqualizeHeightMarkedObjects NC_("STR_EqualizeHeightMarkedObjects", "Equalize Height %1")
+#define STR_EditCombine_OnePoly NC_("STR_EditCombine_OnePoly", "Combine %1")
+#define STR_EditDismantle_Polys NC_("STR_EditDismantle_Polys", "Split %1")
+#define STR_EditDismantle_Lines NC_("STR_EditDismantle_Lines", "Split %1")
+#define STR_EditImportMtf NC_("STR_EditImportMtf", "Split %1")
+#define STR_ExchangePaste NC_("STR_ExchangePaste", "Insert object(s)")
+#define STR_DragInsertPoint NC_("STR_DragInsertPoint", "Insert point to %1")
+#define STR_DragInsertGluePoint NC_("STR_DragInsertGluePoint", "Insert gluepoint to %1")
+#define STR_DragMethMovHdl NC_("STR_DragMethMovHdl", "Move reference-point")
+#define STR_DragMethObjOwn NC_("STR_DragMethObjOwn", "Geometrically change %1")
+#define STR_DiagramModelDataChange NC_("STR_DiagramModelDataChange", "Diagram change %1")
+#define STR_DragMethMove NC_("STR_DragMethMove", "Move %1")
+#define STR_DragMethResize NC_("STR_DragMethResize", "Resize %1")
+#define STR_DragMethRotate NC_("STR_DragMethRotate", "Rotate %1")
+#define STR_DragMethMirrorHori NC_("STR_DragMethMirrorHori", "Flip %1 horizontal")
+#define STR_DragMethMirrorVert NC_("STR_DragMethMirrorVert", "Flip %1 vertical")
+#define STR_DragMethMirrorDiag NC_("STR_DragMethMirrorDiag", "Flip %1 diagonal")
+#define STR_DragMethMirrorFree NC_("STR_DragMethMirrorFree", "Flip %1 freehand")
+#define STR_DragMethGradient NC_("STR_DragMethGradient", "Interactive gradient for %1")
+#define STR_DragMethTransparence NC_("STR_DragMethTransparence", "Interactive transparency for %1")
+#define STR_DragMethShear NC_("STR_DragMethShear", "Distort %1 (slant)")
+#define STR_DragMethCrook NC_("STR_DragMethCrook", "Arrange %1 in circle")
+#define STR_DragMethCrookContortion NC_("STR_DragMethCrookContortion", "Curve %1 in circle")
+#define STR_DragMethDistort NC_("STR_DragMethDistort", "Distort %1")
+#define STR_DragMethCrop NC_("STR_DragMethCrop", "Crop %1")
+#define STR_DragRectEckRad NC_("STR_DragRectEckRad", "Alter radius by %1")
+#define STR_DragPathObj NC_("STR_DragPathObj", "Change %1")
+#define STR_DragRectResize NC_("STR_DragRectResize", "Resize %1")
+#define STR_DragCaptFram NC_("STR_DragCaptFram", "Move %1")
+#define STR_DragCaptTail NC_("STR_DragCaptTail", "Move end point of %1")
+#define STR_DragCircAngle NC_("STR_DragCircAngle", "Adjust angle by %1")
+#define STR_DragEdgeTail NC_("STR_DragEdgeTail", "Change %1")
+#define STR_ViewTextEdit NC_("STR_ViewTextEdit", "TextEdit: Paragraph %1, Row %2, Column %3")
+#define STR_ViewMarked NC_("STR_ViewMarked", "%1 selected")
+#define STR_ViewMarkedPoint NC_("STR_ViewMarkedPoint", "Point from %1")
+#define STR_ViewMarkedPoints NC_("STR_ViewMarkedPoints", "%2 points from %1")
+#define STR_ViewMarkedGluePoint NC_("STR_ViewMarkedGluePoint", "Gluepoint from %1")
+#define STR_ViewMarkedGluePoints NC_("STR_ViewMarkedGluePoints", "%2 gluepoints from %1")
+#define STR_ViewMarkObjs NC_("STR_ViewMarkObjs", "Mark objects")
+#define STR_ViewMarkMoreObjs NC_("STR_ViewMarkMoreObjs", "Mark additional objects")
+#define STR_ViewMarkPoints NC_("STR_ViewMarkPoints", "Mark points")
+#define STR_ViewMarkMorePoints NC_("STR_ViewMarkMorePoints", "Mark additional points")
+#define STR_ViewMarkGluePoints NC_("STR_ViewMarkGluePoints", "Mark gluepoints")
+#define STR_ViewMarkMoreGluePoints NC_("STR_ViewMarkMoreGluePoints", "Mark additional gluepoints")
+#define STR_ViewCreateObj NC_("STR_ViewCreateObj", "Create %1")
+#define STR_UndoInsertObj NC_("STR_UndoInsertObj", "Insert %1")
+#define STR_UndoCopyObj NC_("STR_UndoCopyObj", "Copy %1")
+#define STR_UndoObjOrdNum NC_("STR_UndoObjOrdNum", "Change object order of %1")
+#define STR_UndoObjSetText NC_("STR_UndoObjSetText", "Edit text of %1")
+#define STR_UndoNewPage NC_("STR_UndoNewPage", "Insert page")
+#define STR_UndoDelPage NC_("STR_UndoDelPage", "Delete page")
+#define STR_UndoCopPage NC_("STR_UndoCopPage", "Copy page")
+#define STR_UndoMovPage NC_("STR_UndoMovPage", "Change order of pages")
+#define STR_UndoDelPageMasterDscr NC_("STR_UndoDelPageMasterDscr", "Clear background page assignment")
+#define STR_UndoChgPageMasterDscr NC_("STR_UndoChgPageMasterDscr", "Change background page assignment")
+#define STR_UndoMergeModel NC_("STR_UndoMergeModel", "Insert document")
+#define STR_UndoNewLayer NC_("STR_UndoNewLayer", "Insert Layer")
+#define STR_UndoDelLayer NC_("STR_UndoDelLayer", "Delete layer")
+// Undo/Redo for setting object's name (#i73249#)
+#define STR_UndoObjName NC_("STR_UndoObjName", "Change object name of %1 to")
+#define STR_UndoObjTitle NC_("STR_UndoObjTitle", "Change object title of %1")
+#define STR_UndoObjDescription NC_("STR_UndoObjDescription", "Change object description of %1")
+#define STR_ItemValON NC_("STR_ItemValON", "on")
+#define STR_ItemValOFF NC_("STR_ItemValOFF", "off")
+#define STR_ItemValYES NC_("STR_ItemValYES", "yes")
+#define STR_ItemValNO NC_("STR_ItemValNO", "No")
+#define STR_ItemValCAPTIONTYPE1 NC_("STR_ItemValCAPTIONTYPE1", "Type 1")
+#define STR_ItemValCAPTIONTYPE2 NC_("STR_ItemValCAPTIONTYPE2", "Type 2")
+#define STR_ItemValCAPTIONTYPE3 NC_("STR_ItemValCAPTIONTYPE3", "Type 3")
+#define STR_ItemValCAPTIONTYPE4 NC_("STR_ItemValCAPTIONTYPE4", "Type 4")
+#define STR_ItemValCAPTIONESCHORI NC_("STR_ItemValCAPTIONESCHORI", "Horizontal")
+#define STR_ItemValCAPTIONESCVERT NC_("STR_ItemValCAPTIONESCVERT", "Vertical")
+#define STR_ItemValCAPTIONESCBESTFIT NC_("STR_ItemValCAPTIONESCBESTFIT", "Automatic")
+#define STR_ItemValFITTOSIZENONE NC_("STR_ItemValFITTOSIZENONE", "Off")
+#define STR_ItemValFITTOSIZEPROP NC_("STR_ItemValFITTOSIZEPROP", "Proportional")
+#define STR_ItemValFITTOSIZEALLLINES NC_("STR_ItemValFITTOSIZEALLLINES", "Fit to size (all rows separately) ")
+#define STR_ItemValFITTOSIZERESIZEAT NC_("STR_ItemValFITTOSIZERESIZEAT", "Use hard attributes")
+#define STR_ItemValTEXTVADJTOP NC_("STR_ItemValTEXTVADJTOP", "Top")
+#define STR_ItemValTEXTVADJCENTER NC_("STR_ItemValTEXTVADJCENTER", "Center")
+#define STR_ItemValTEXTVADJBOTTOM NC_("STR_ItemValTEXTVADJBOTTOM", "Bottom")
+#define STR_ItemValTEXTVADJBLOCK NC_("STR_ItemValTEXTVADJBLOCK", "Use entire height")
+#define STR_ItemValTEXTVADJSTRETCH NC_("STR_ItemValTEXTVADJSTRETCH", "Stretched")
+#define STR_ItemValTEXTHADJLEFT NC_("STR_ItemValTEXTHADJLEFT", "Left")
+#define STR_ItemValTEXTHADJCENTER NC_("STR_ItemValTEXTHADJCENTER", "Center")
+#define STR_ItemValTEXTHADJRIGHT NC_("STR_ItemValTEXTHADJRIGHT", "Right")
+#define STR_ItemValTEXTHADJBLOCK NC_("STR_ItemValTEXTHADJBLOCK", "Use entire width")
+#define STR_ItemValTEXTHADJSTRETCH NC_("STR_ItemValTEXTHADJSTRETCH", "Stretched")
+#define STR_ItemValTEXTANI_NONE NC_("STR_ItemValTEXTANI_NONE", "off")
+#define STR_ItemValTEXTANI_BLINK NC_("STR_ItemValTEXTANI_BLINK", "flash")
+#define STR_ItemValTEXTANI_SCROLL NC_("STR_ItemValTEXTANI_SCROLL", "Scroll Through")
+#define STR_ItemValTEXTANI_ALTERNATE NC_("STR_ItemValTEXTANI_ALTERNATE", "alternating")
+#define STR_ItemValTEXTANI_SLIDE NC_("STR_ItemValTEXTANI_SLIDE", "Scroll In")
+#define STR_ItemValTEXTANI_LEFT NC_("STR_ItemValTEXTANI_LEFT", "left")
+#define STR_ItemValTEXTANI_UP NC_("STR_ItemValTEXTANI_UP", "up")
+#define STR_ItemValTEXTANI_RIGHT NC_("STR_ItemValTEXTANI_RIGHT", "right")
+#define STR_ItemValTEXTANI_DOWN NC_("STR_ItemValTEXTANI_DOWN", "down")
+#define STR_ItemValEDGE_ORTHOLINES NC_("STR_ItemValEDGE_ORTHOLINES", "Standard Connector")
+#define STR_ItemValEDGE_THREELINES NC_("STR_ItemValEDGE_THREELINES", "Line Connector")
+#define STR_ItemValEDGE_ONELINE NC_("STR_ItemValEDGE_ONELINE", "Straight Connector")
+#define STR_ItemValEDGE_BEZIER NC_("STR_ItemValEDGE_BEZIER", "Curved Connector")
+#define STR_ItemValMEASURE_STD NC_("STR_ItemValMEASURE_STD", "Standard")
+#define STR_ItemValMEASURE_RADIUS NC_("STR_ItemValMEASURE_RADIUS", "Radius")
+#define STR_ItemValMEASURE_TEXTVAUTO NC_("STR_ItemValMEASURE_TEXTVAUTO", "automatic")
+#define STR_ItemValMEASURE_ABOVE NC_("STR_ItemValMEASURE_ABOVE", "on the line")
+#define STR_ItemValMEASURETEXT_BREAKEDLINE NC_("STR_ItemValMEASURETEXT_BREAKEDLINE", "broken line")
+#define STR_ItemValMEASURE_BELOW NC_("STR_ItemValMEASURE_BELOW", "below the line")
+#define STR_ItemValMEASURETEXT_VERTICALCEN NC_("STR_ItemValMEASURETEXT_VERTICALCEN", "centered")
+#define STR_ItemValCIRC_FULL NC_("STR_ItemValCIRC_FULL", "full circle")
+#define STR_ItemValCIRC_SECT NC_("STR_ItemValCIRC_SECT", "Circle Pie")
+#define STR_ItemValCIRC_CUT NC_("STR_ItemValCIRC_CUT", "Circle segment")
+#define STR_ItemValCIRC_ARC NC_("STR_ItemValCIRC_ARC", "Arc")
+// Strings for the templates dialog
+#define SIP_UNKNOWN_ATTR NC_("SIP_UNKNOWN_ATTR", "Unknown attribute")
+// Strings for the templates dialog
+#define SIP_XA_LINESTYLE NC_("SIP_XA_LINESTYLE", "Line style")
+#define SIP_XA_LINEDASH NC_("SIP_XA_LINEDASH", "Line pattern")
+#define SIP_XA_LINEWIDTH NC_("SIP_XA_LINEWIDTH", "Line width")
+#define SIP_XA_LINECOLOR NC_("SIP_XA_LINECOLOR", "Line color")
+#define SIP_XA_LINESTART NC_("SIP_XA_LINESTART", "Line head")
+#define SIP_XA_LINEEND NC_("SIP_XA_LINEEND", "Line end")
+#define SIP_XA_LINESTARTWIDTH NC_("SIP_XA_LINESTARTWIDTH", "Line head width")
+#define SIP_XA_LINEENDWIDTH NC_("SIP_XA_LINEENDWIDTH", "Line end width")
+#define SIP_XA_LINESTARTCENTER NC_("SIP_XA_LINESTARTCENTER", "Center arrowhead")
+#define SIP_XA_LINEENDCENTER NC_("SIP_XA_LINEENDCENTER", "Center arrowend")
+#define SIP_XA_LINETRANSPARENCE NC_("SIP_XA_LINETRANSPARENCE", "Line transparency")
+#define SIP_XA_LINEJOINT NC_("SIP_XA_LINEJOINT", "Line joint")
+#define SIP_XATTRSET_LINE NC_("SIP_XATTRSET_LINE", "Line attributes")
+#define SIP_XA_FILLSTYLE NC_("SIP_XA_FILLSTYLE", "Fill style")
+#define SIP_XA_FILLCOLOR NC_("SIP_XA_FILLCOLOR", "Fillcolor")
+#define SIP_XA_FILLGRADIENT NC_("SIP_XA_FILLGRADIENT", "Gradient")
+#define SIP_XA_FILLHATCH NC_("SIP_XA_FILLHATCH", "Hatching")
+#define SIP_XA_FILLBITMAP NC_("SIP_XA_FILLBITMAP", "Fillbitmap")
+#define SIP_XA_FILLTRANSPARENCE NC_("SIP_XA_FILLTRANSPARENCE", "Transparency")
+#define SIP_XA_GRADIENTSTEPCOUNT NC_("SIP_XA_GRADIENTSTEPCOUNT", "Number of gradient steps")
+#define SIP_XA_FILLBMP_TILE NC_("SIP_XA_FILLBMP_TILE", "Tile fill")
+#define SIP_XA_FILLBMP_POS NC_("SIP_XA_FILLBMP_POS", "Fillbitmap position")
+#define SIP_XA_FILLBMP_SIZEX NC_("SIP_XA_FILLBMP_SIZEX", "Fillbitmap width")
+#define SIP_XA_FILLBMP_SIZEY NC_("SIP_XA_FILLBMP_SIZEY", "Height of fillbitmap")
+#define SIP_XA_FILLFLOATTRANSPARENCE NC_("SIP_XA_FILLFLOATTRANSPARENCE", "Transparent gradient")
+#define SIP_XA_SECONDARYFILLCOLOR NC_("SIP_XA_SECONDARYFILLCOLOR", "Fill reserved for 2")
+#define SIP_XA_FILLBMP_SIZELOG NC_("SIP_XA_FILLBMP_SIZELOG", "Tile size not in %")
+#define SIP_XA_FILLBMP_TILEOFFSETX NC_("SIP_XA_FILLBMP_TILEOFFSETX", "Tile offset X in %")
+#define SIP_XA_FILLBMP_TILEOFFSETY NC_("SIP_XA_FILLBMP_TILEOFFSETY", "Tile offset Y in %")
+#define SIP_XA_FILLBMP_STRETCH NC_("SIP_XA_FILLBMP_STRETCH", "Bitmap scaling")
+#define SIP_XA_FILLBMP_POSOFFSETX NC_("SIP_XA_FILLBMP_POSOFFSETX", "Tile position X in %")
+#define SIP_XA_FILLBMP_POSOFFSETY NC_("SIP_XA_FILLBMP_POSOFFSETY", "Tile position Y in %")
+#define SIP_XA_FILLBACKGROUND NC_("SIP_XA_FILLBACKGROUND", "Background fill")
+#define SIP_XA_FILLUSESLIDEBACKGROUND NC_("SIP_XA_FILLUSESLIDEBACKGROUND", "Use slide background fill")
+#define SIP_XATTRSET_FILL NC_("SIP_XATTRSET_FILL", "Area attributes")
+#define SIP_XA_FORMTXTSTYLE NC_("SIP_XA_FORMTXTSTYLE", "Fontwork style")
+#define SIP_XA_FORMTXTADJUST NC_("SIP_XA_FORMTXTADJUST", "Fontwork alignment")
+#define SIP_XA_FORMTXTDISTANCE NC_("SIP_XA_FORMTXTDISTANCE", "Fontwork spacing")
+#define SIP_XA_FORMTXTSTART NC_("SIP_XA_FORMTXTSTART", "Fontwork font begin")
+#define SIP_XA_FORMTXTMIRROR NC_("SIP_XA_FORMTXTMIRROR", "Fontwork mirror")
+#define SIP_XA_FORMTXTOUTLINE NC_("SIP_XA_FORMTXTOUTLINE", "Fontwork outline")
+#define SIP_XA_FORMTXTSHADOW NC_("SIP_XA_FORMTXTSHADOW", "Fontwork shadow")
+#define SIP_XA_FORMTXTSHDWCOLOR NC_("SIP_XA_FORMTXTSHDWCOLOR", "Fontwork shadow color")
+#define SIP_XA_FORMTXTSHDWXVAL NC_("SIP_XA_FORMTXTSHDWXVAL", "Fontwork shadow offset X")
+#define SIP_XA_FORMTXTSHDWYVAL NC_("SIP_XA_FORMTXTSHDWYVAL", "Fontwork shadow offset Y")
+#define SIP_XA_FORMTXTHIDEFORM NC_("SIP_XA_FORMTXTHIDEFORM", "Hide fontwork outline")
+#define SIP_XA_FORMTXTSHDWTRANSP NC_("SIP_XA_FORMTXTSHDWTRANSP", "Fontwork shadow transparency")
+#define SIP_SA_SHADOW NC_("SIP_SA_SHADOW", "Shadow")
+#define SIP_SA_SHADOWCOLOR NC_("SIP_SA_SHADOWCOLOR", "Shadow color")
+#define SIP_SA_SHADOWXDIST NC_("SIP_SA_SHADOWXDIST", "Shadow spacing X")
+#define SIP_SA_SHADOWYDIST NC_("SIP_SA_SHADOWYDIST", "Shadow spacing Y")
+#define SIP_SA_SHADOWTRANSPARENCE NC_("SIP_SA_SHADOWTRANSPARENCE", "Shadow transparency")
+#define SIP_SA_SHADOWBLUR NC_("SIP_SA_SHADOWBLUR", "Shadow blur")
+#define SIP_SA_SHADOW3D NC_("SIP_SA_SHADOW3D", "3D shadow")
+#define SIP_SA_SHADOWPERSP NC_("SIP_SA_SHADOWPERSP", "Perspective shadow")
+#define SIP_SA_CAPTIONTYPE NC_("SIP_SA_CAPTIONTYPE", "Type of legend")
+#define SIP_SA_CAPTIONFIXEDANGLE NC_("SIP_SA_CAPTIONFIXEDANGLE", "Fixed legend angle")
+#define SIP_SA_CAPTIONANGLE NC_("SIP_SA_CAPTIONANGLE", "Legend angle")
+#define SIP_SA_CAPTIONGAP NC_("SIP_SA_CAPTIONGAP", "Legend lines spacing")
+#define SIP_SA_CAPTIONESCDIR NC_("SIP_SA_CAPTIONESCDIR", "Legend exit alignment")
+#define SIP_SA_CAPTIONESCISREL NC_("SIP_SA_CAPTIONESCISREL", "Relative exit legend")
+#define SIP_SA_CAPTIONESCREL NC_("SIP_SA_CAPTIONESCREL", "Relative exit legend")
+#define SIP_SA_CAPTIONESCABS NC_("SIP_SA_CAPTIONESCABS", "Absolute exit of legend")
+#define SIP_SA_CAPTIONLINELEN NC_("SIP_SA_CAPTIONLINELEN", "Legend line length")
+#define SIP_SA_CAPTIONFITLINELEN NC_("SIP_SA_CAPTIONFITLINELEN", "AutoLength of legend lines")
+#define SIP_SA_CORNER_RADIUS NC_("SIP_SA_CORNER_RADIUS", "Corner radius")
+#define SIP_SA_TEXT_MINFRAMEHEIGHT NC_("SIP_SA_TEXT_MINFRAMEHEIGHT", "Minimal frame height")
+#define SIP_SA_TEXT_AUTOGROWHEIGHT NC_("SIP_SA_TEXT_AUTOGROWHEIGHT", "AutoFit height")
+#define SIP_SA_TEXT_FITTOSIZE NC_("SIP_SA_TEXT_FITTOSIZE", "Fit text to frame")
+#define SIP_SA_TEXT_LEFTDIST NC_("SIP_SA_TEXT_LEFTDIST", "Left text frame spacing")
+#define SIP_SA_TEXT_RIGHTDIST NC_("SIP_SA_TEXT_RIGHTDIST", "Right text frame spacing")
+#define SIP_SA_TEXT_UPPERDIST NC_("SIP_SA_TEXT_UPPERDIST", "Upper text frame spacing")
+#define SIP_SA_TEXT_LOWERDIST NC_("SIP_SA_TEXT_LOWERDIST", "Lower text frame spacing")
+#define SIP_SA_TEXT_VERTADJUST NC_("SIP_SA_TEXT_VERTADJUST", "Vertical text anchor")
+#define SIP_SA_TEXT_MAXFRAMEHEIGHT NC_("SIP_SA_TEXT_MAXFRAMEHEIGHT", "Maximal frame height")
+#define SIP_SA_TEXT_MINFRAMEWIDTH NC_("SIP_SA_TEXT_MINFRAMEWIDTH", "Minimal frame width")
+#define SIP_SA_TEXT_MAXFRAMEWIDTH NC_("SIP_SA_TEXT_MAXFRAMEWIDTH", "Maximal frame width")
+#define SIP_SA_TEXT_AUTOGROWWIDTH NC_("SIP_SA_TEXT_AUTOGROWWIDTH", "AutoFit width")
+#define SIP_SA_TEXT_HORZADJUST NC_("SIP_SA_TEXT_HORZADJUST", "Horizontal text anchor")
+#define SIP_SA_TEXT_ANIKIND NC_("SIP_SA_TEXT_ANIKIND", "Ticker")
+#define SIP_SA_TEXT_ANIDIRECTION NC_("SIP_SA_TEXT_ANIDIRECTION", "Ticker direction")
+#define SIP_SA_TEXT_ANISTARTINSIDE NC_("SIP_SA_TEXT_ANISTARTINSIDE", "Ticker start inside")
+#define SIP_SA_TEXT_ANISTOPINSIDE NC_("SIP_SA_TEXT_ANISTOPINSIDE", "Ticker stop inside")
+#define SIP_SA_TEXT_ANICOUNT NC_("SIP_SA_TEXT_ANICOUNT", "Number of ticker runs")
+#define SIP_SA_TEXT_ANIDELAY NC_("SIP_SA_TEXT_ANIDELAY", "Speed of ticker")
+#define SIP_SA_TEXT_ANIAMOUNT NC_("SIP_SA_TEXT_ANIAMOUNT", "Ticker step size")
+#define SIP_SA_TEXT_CONTOURFRAME NC_("SIP_SA_TEXT_CONTOURFRAME", "Outline text flow")
+#define SIP_SA_TEXTCOLUMNS_NUMBER NC_("SIP_SA_TEXTCOLUMNS_NUMBER", "Columns number")
+#define SIP_SA_TEXTCOLUMNS_SPACING NC_("SIP_SA_TEXTCOLUMNS_SPACING", "Columns spacing")
+#define SIP_SA_XMLATTRIBUTES NC_("SIP_SA_XMLATTRIBUTES", "User-defined attributes")
+#define SIP_SA_TEXT_USEFIXEDCELLHEIGHT NC_("SIP_SA_TEXT_USEFIXEDCELLHEIGHT", "Use font-independent line spacing")
+#define SIP_SA_WORDWRAP NC_("SIP_SA_WORDWRAP", "Word wrap text in shape")
+#define SIP_SA_CHAINNEXTNAME NC_("SIP_SA_CHAINNEXTNAME", "Next link in text chain")
+#define SIP_SA_EDGEKIND NC_("SIP_SA_EDGEKIND", "Type of connector")
+#define SIP_SA_EDGENODE1HORZDIST NC_("SIP_SA_EDGENODE1HORZDIST", "Horz. spacing object 1")
+#define SIP_SA_EDGENODE1VERTDIST NC_("SIP_SA_EDGENODE1VERTDIST", "Vert. spacing object 1")
+#define SIP_SA_EDGENODE2HORZDIST NC_("SIP_SA_EDGENODE2HORZDIST", "Horz. spacing object 2")
+#define SIP_SA_EDGENODE2VERTDIST NC_("SIP_SA_EDGENODE2VERTDIST", "Vert. spacing object 2")
+#define SIP_SA_EDGENODE1GLUEDIST NC_("SIP_SA_EDGENODE1GLUEDIST", "Glue spacing object 1")
+#define SIP_SA_EDGENODE2GLUEDIST NC_("SIP_SA_EDGENODE2GLUEDIST", "Glue spacing object 2")
+#define SIP_SA_EDGELINEDELTACOUNT NC_("SIP_SA_EDGELINEDELTACOUNT", "Number of movable lines")
+#define SIP_SA_EDGELINE1DELTA NC_("SIP_SA_EDGELINE1DELTA", "Offset line 1")
+#define SIP_SA_EDGELINE2DELTA NC_("SIP_SA_EDGELINE2DELTA", "Offset line 2")
+#define SIP_SA_EDGELINE3DELTA NC_("SIP_SA_EDGELINE3DELTA", "Offset line 3")
+#define SIP_SA_MEASUREKIND NC_("SIP_SA_MEASUREKIND", "Type of dimensioning")
+#define SIP_SA_MEASURETEXTHPOS NC_("SIP_SA_MEASURETEXTHPOS", "Dimension value - horizontal position")
+#define SIP_SA_MEASURETEXTVPOS NC_("SIP_SA_MEASURETEXTVPOS", "Dimension value - vertical position")
+#define SIP_SA_MEASURELINEDIST NC_("SIP_SA_MEASURELINEDIST", "Dimension line space")
+#define SIP_SA_MEASUREHELPLINEOVERHANG NC_("SIP_SA_MEASUREHELPLINEOVERHANG", "Dimension help line overhang")
+#define SIP_SA_MEASUREHELPLINEDIST NC_("SIP_SA_MEASUREHELPLINEDIST", "Dimension help line spacing")
+#define SIP_SA_MEASUREHELPLINE1LEN NC_("SIP_SA_MEASUREHELPLINE1LEN", "Backlog of dimension help line 1")
+#define SIP_SA_MEASUREHELPLINE2LEN NC_("SIP_SA_MEASUREHELPLINE2LEN", "Backlog of dimension help line 2")
+#define SIP_SA_MEASUREBELOWREFEDGE NC_("SIP_SA_MEASUREBELOWREFEDGE", "Lower edge dimensioning")
+#define SIP_SA_MEASURETEXTROTA90 NC_("SIP_SA_MEASURETEXTROTA90", "Dimension value across dimension line")
+#define SIP_SA_MEASURETEXTUPSIDEDOWN NC_("SIP_SA_MEASURETEXTUPSIDEDOWN", "Rotate dimension value by 180 degree")
+#define SIP_SA_MEASUREOVERHANG NC_("SIP_SA_MEASUREOVERHANG", "Dimension line overhang")
+#define SIP_SA_MEASUREUNIT NC_("SIP_SA_MEASUREUNIT", "Measure unit")
+#define SIP_SA_MEASURESCALE NC_("SIP_SA_MEASURESCALE", "Additional scale factor")
+#define SIP_SA_MEASURESHOWUNIT NC_("SIP_SA_MEASURESHOWUNIT", "Measure unit display")
+#define SIP_SA_MEASUREFORMATSTRING NC_("SIP_SA_MEASUREFORMATSTRING", "Dimension value format")
+#define SIP_SA_MEASURETEXTAUTOANGLE NC_("SIP_SA_MEASURETEXTAUTOANGLE", "AutoPositioning of the dimension value")
+#define SIP_SA_MEASURETEXTAUTOANGLEVIEW NC_("SIP_SA_MEASURETEXTAUTOANGLEVIEW", "Angle for the automatic positioning of the dimension value")
+#define SIP_SA_MEASURETEXTISFIXEDANGLE NC_("SIP_SA_MEASURETEXTISFIXEDANGLE", "Determination of the dimension value angle")
+#define SIP_SA_MEASURETEXTFIXEDANGLE NC_("SIP_SA_MEASURETEXTFIXEDANGLE", "Angle of the dimension value")
+#define SIP_SA_MEASUREDECIMALPLACES NC_("SIP_SA_MEASUREDECIMALPLACES", "Decimal places")
+#define SIP_SA_CIRCKIND NC_("SIP_SA_CIRCKIND", "Type of circle")
+#define SIP_SA_CIRCSTARTANGLE NC_("SIP_SA_CIRCSTARTANGLE", "Start angle")
+#define SIP_SA_CIRCENDANGLE NC_("SIP_SA_CIRCENDANGLE", "End angle")
+#define SIP_SA_OBJMOVEPROTECT NC_("SIP_SA_OBJMOVEPROTECT", "Protected object position")
+#define SIP_SA_OBJSIZEPROTECT NC_("SIP_SA_OBJSIZEPROTECT", "Protected object size")
+#define SIP_SA_OBJPRINTABLE NC_("SIP_SA_OBJPRINTABLE", "Object, printable")
+#define SIP_SA_OBJVISIBLE NC_("SIP_SA_OBJVISIBLE", "Object, visible")
+#define SIP_SA_LAYERID NC_("SIP_SA_LAYERID", "Level ID")
+#define SIP_SA_LAYERNAME NC_("SIP_SA_LAYERNAME", "Layer")
+#define SIP_SA_OBJECTNAME NC_("SIP_SA_OBJECTNAME", "Object name")
+#define SIP_SA_ALLPOSITIONX NC_("SIP_SA_ALLPOSITIONX", "Position X, complete")
+#define SIP_SA_ALLPOSITIONY NC_("SIP_SA_ALLPOSITIONY", "Position Y, complete")
+#define SIP_SA_ALLSIZEWIDTH NC_("SIP_SA_ALLSIZEWIDTH", "Total Width")
+#define SIP_SA_ALLSIZEHEIGHT NC_("SIP_SA_ALLSIZEHEIGHT", "Height, complete")
+#define SIP_SA_ONEPOSITIONX NC_("SIP_SA_ONEPOSITIONX", "Single position X")
+#define SIP_SA_ONEPOSITIONY NC_("SIP_SA_ONEPOSITIONY", "Single position Y")
+#define SIP_SA_ONESIZEWIDTH NC_("SIP_SA_ONESIZEWIDTH", "Single width")
+#define SIP_SA_ONESIZEHEIGHT NC_("SIP_SA_ONESIZEHEIGHT", "Single height")
+#define SIP_SA_LOGICSIZEWIDTH NC_("SIP_SA_LOGICSIZEWIDTH", "Logical width")
+#define SIP_SA_LOGICSIZEHEIGHT NC_("SIP_SA_LOGICSIZEHEIGHT", "Logical height")
+#define SIP_SA_ROTATEANGLE NC_("SIP_SA_ROTATEANGLE", "Single rotation angle")
+#define SIP_SA_SHEARANGLE NC_("SIP_SA_SHEARANGLE", "Single shear angle")
+#define SIP_SA_MOVEX NC_("SIP_SA_MOVEX", "Move horizontally")
+#define SIP_SA_MOVEY NC_("SIP_SA_MOVEY", "Move vertically")
+#define SIP_SA_RESIZEXONE NC_("SIP_SA_RESIZEXONE", "Resize X, single")
+#define SIP_SA_RESIZEYONE NC_("SIP_SA_RESIZEYONE", "Resize Y, single")
+#define SIP_SA_ROTATEONE NC_("SIP_SA_ROTATEONE", "Single rotation")
+#define SIP_SA_HORZSHEARONE NC_("SIP_SA_HORZSHEARONE", "Single horizontal shear")
+#define SIP_SA_VERTSHEARONE NC_("SIP_SA_VERTSHEARONE", "Single vertical shear")
+#define SIP_SA_RESIZEXALL NC_("SIP_SA_RESIZEXALL", "Resize X, complete")
+#define SIP_SA_RESIZEYALL NC_("SIP_SA_RESIZEYALL", "Resize Y, complete")
+#define SIP_SA_ROTATEALL NC_("SIP_SA_ROTATEALL", "Rotate all")
+#define SIP_SA_HORZSHEARALL NC_("SIP_SA_HORZSHEARALL", "Shear horizontal, complete")
+#define SIP_SA_VERTSHEARALL NC_("SIP_SA_VERTSHEARALL", "Shear vertical, complete")
+#define SIP_SA_TRANSFORMREF1X NC_("SIP_SA_TRANSFORMREF1X", "Reference point 1 X")
+#define SIP_SA_TRANSFORMREF1Y NC_("SIP_SA_TRANSFORMREF1Y", "Reference point 1 Y")
+#define SIP_SA_TRANSFORMREF2X NC_("SIP_SA_TRANSFORMREF2X", "Reference point 2 X")
+#define SIP_SA_TRANSFORMREF2Y NC_("SIP_SA_TRANSFORMREF2Y", "Reference point 2 Y")
+#define SIP_EE_PARA_HYPHENATE NC_("SIP_EE_PARA_HYPHENATE", "Hyphenation")
+#define SIP_EE_PARA_BULLETSTATE NC_("SIP_EE_PARA_BULLETSTATE", "Display bullets")
+#define SIP_EE_PARA_OUTLLRSPACE NC_("SIP_EE_PARA_OUTLLRSPACE", "Numbering indents")
+#define SIP_EE_PARA_OUTLLEVEL NC_("SIP_EE_PARA_OUTLLEVEL", "Numbering level")
+#define SIP_EE_PARA_BULLET NC_("SIP_EE_PARA_BULLET", "Bullets and Numberings")
+#define SIP_EE_PARA_LRSPACE NC_("SIP_EE_PARA_LRSPACE", "Indents")
+#define SIP_EE_PARA_ULSPACE NC_("SIP_EE_PARA_ULSPACE", "Paragraph spacing")
+#define SIP_EE_PARA_SBL NC_("SIP_EE_PARA_SBL", "Line spacing")
+#define SIP_EE_PARA_JUST NC_("SIP_EE_PARA_JUST", "Paragraph alignment")
+#define SIP_EE_PARA_TABS NC_("SIP_EE_PARA_TABS", "Tabulators")
+#define SIP_EE_CHAR_COLOR NC_("SIP_EE_CHAR_COLOR", "Font color")
+#define SIP_EE_CHAR_FONTINFO NC_("SIP_EE_CHAR_FONTINFO", "Character set")
+#define SIP_EE_CHAR_FONTHEIGHT NC_("SIP_EE_CHAR_FONTHEIGHT", "Font size")
+#define SIP_EE_CHAR_FONTWIDTH NC_("SIP_EE_CHAR_FONTWIDTH", "Font width")
+#define SIP_EE_CHAR_WEIGHT NC_("SIP_EE_CHAR_WEIGHT", "Bold (thickness)")
+#define SIP_EE_CHAR_UNDERLINE NC_("SIP_EE_CHAR_UNDERLINE", "Underline")
+#define SIP_EE_CHAR_OVERLINE NC_("SIP_EE_CHAR_OVERLINE", "Overline")
+#define SIP_EE_CHAR_STRIKEOUT NC_("SIP_EE_CHAR_STRIKEOUT", "Strikethrough")
+#define SIP_EE_CHAR_ITALIC NC_("SIP_EE_CHAR_ITALIC", "Italic")
+#define SIP_EE_CHAR_OUTLINE NC_("SIP_EE_CHAR_OUTLINE", "Outline")
+#define SIP_EE_CHAR_SHADOW NC_("SIP_EE_CHAR_SHADOW", "Font shadow")
+#define SIP_EE_CHAR_ESCAPEMENT NC_("SIP_EE_CHAR_ESCAPEMENT", "Superscript/subscript")
+#define SIP_EE_CHAR_PAIRKERNING NC_("SIP_EE_CHAR_PAIRKERNING", "Kerning")
+#define SIP_EE_CHAR_KERNING NC_("SIP_EE_CHAR_KERNING", "Manual kerning")
+#define SIP_EE_CHAR_WLM NC_("SIP_EE_CHAR_WLM", "No underline for spaces")
+#define SIP_EE_FEATURE_TAB NC_("SIP_EE_FEATURE_TAB", "Tabulator")
+#define SIP_EE_FEATURE_LINEBR NC_("SIP_EE_FEATURE_LINEBR", "Optional line break")
+#define SIP_EE_FEATURE_NOTCONV NC_("SIP_EE_FEATURE_NOTCONV", "Non-convertible character")
+#define SIP_EE_FEATURE_FIELD NC_("SIP_EE_FEATURE_FIELD", "Fields")
+#define SIP_SA_GRAFRED NC_("SIP_SA_GRAFRED", "Red")
+#define SIP_SA_GRAFGREEN NC_("SIP_SA_GRAFGREEN", "Green")
+#define SIP_SA_GRAFBLUE NC_("SIP_SA_GRAFBLUE", "Blue")
+#define SIP_SA_GRAFLUMINANCE NC_("SIP_SA_GRAFLUMINANCE", "Brightness")
+#define SIP_SA_GRAFCONTRAST NC_("SIP_SA_GRAFCONTRAST", "Contrast")
+#define SIP_SA_GRAFGAMMA NC_("SIP_SA_GRAFGAMMA", "Gamma")
+#define SIP_SA_GRAFTRANSPARENCE NC_("SIP_SA_GRAFTRANSPARENCE", "Transparency")
+#define SIP_SA_GRAFINVERT NC_("SIP_SA_GRAFINVERT", "Invert")
+#define SIP_SA_GRAFMODE NC_("SIP_SA_GRAFMODE", "Image mode")
+#define SIP_SA_GRAFCROP NC_("SIP_SA_GRAFCROP", "Crop")
+#define SIP_SA_GLOW_RADIUS NC_("SIP_SA_GLOW_RADIUS", "Radius of glow effect")
+#define SIP_SA_GLOW_COLOR NC_("SIP_SA_GLOW_COLOR", "Color of glow effect")
+#define SIP_SA_GLOW_TRANSPARENCY NC_("SIP_SA_GLOW_TRANSPARENCY", "Transparency of glow effect")
+#define SIP_SA_SOFTEDGE_RADIUS NC_("SIP_SA_SOFTEDGE_RADIUS", "Radius of soft edge effect")
+#define STR_ObjNameSingulMEDIA NC_("STR_ObjNameSingulMEDIA", "Media object")
+#define STR_ObjNamePluralMEDIA NC_("STR_ObjNamePluralMEDIA", "Media objects")
+// drawing layer table strings
+#define STR_TABLE_INSCOL NC_("STR_TABLE_INSCOL", "Insert column")
+#define STR_TABLE_INSROW NC_("STR_TABLE_INSROW", "Insert row")
+#define STR_UNDO_COL_DELETE NC_("STR_UNDO_COL_DELETE", "Delete column")
+#define STR_UNDO_ROW_DELETE NC_("STR_UNDO_ROW_DELETE", "Delete row")
+#define STR_TABLE_SPLIT NC_("STR_TABLE_SPLIT", "Split cells")
+#define STR_TABLE_MERGE NC_("STR_TABLE_MERGE", "Merge cells")
+#define STR_TABLE_NUMFORMAT NC_("STR_TABLE_NUMFORMAT", "Format cell")
+#define STR_TABLE_DISTRIBUTE_ROWS NC_("STR_TABLE_DISTRIBUTE_ROWS", "Distribute rows")
+#define STR_TABLE_DISTRIBUTE_COLUMNS NC_("STR_TABLE_DISTRIBUTE_COLUMNS", "Distribute columns")
+#define STR_TABLE_DELETE_CELL_CONTENTS NC_("STR_TABLE_DELETE_CELL_CONTENTS", "Delete cell contents")
+#define STR_TABLE_STYLE NC_("STR_TABLE_STYLE", "Table style")
+#define STR_TABLE_STYLE_SETTINGS NC_("STR_TABLE_STYLE_SETTINGS", "Table style settings")
+#define STR_ObjNameSingulTable NC_("STR_ObjNameSingulTable", "Table")
+#define STR_ObjNamePluralTable NC_("STR_ObjNamePluralTable", "Tables")
+#define STR_ObjNameSingulFONTWORK NC_("STR_ObjNameSingulFONTWORK", "Font work")
+// Strings for the Draw-Dialog --------------------------------------------
+#define RID_SVXSTR_SOLID NC_("RID_SVXSTR_SOLID", "Continuous")
+#define RID_SVXSTR_GRADIENT NC_("RID_SVXSTR_GRADIENT", "Gradient")
+#define RID_SVXSTR_BITMAP NC_("RID_SVXSTR_BITMAP", "Bitmap")
+#define RID_SVXSTR_PATTERN NC_("RID_SVXSTR_PATTERN", "Pattern")
+#define RID_SVXSTR_USE_BACKGROUND NC_("RID_SVXSTR_USE_BACKGROUND", "Use Slide Background")
+#define RID_SVXSTR_PATTERN_UNTITLED NC_("RID_SVXSTR_PATTERN_UNTITLED", "Untitled Pattern")
+#define RID_SVXSTR_LINESTYLE NC_("RID_SVXSTR_LINESTYLE", "Line Style")
+#define RID_SVXSTR_INVISIBLE NC_("RID_SVXSTR_INVISIBLE", "None")
+#define RID_SVXSTR_COLOR NC_("RID_SVXSTR_COLOR", "Color")
+#define RID_SVXSTR_HATCH NC_("RID_SVXSTR_HATCH", "Hatching")
+#define RID_SVXSTR_LINEEND NC_("RID_SVXSTR_LINEEND", "Arrowheads")
+#define RID_SVXSTR_ARROW NC_("RID_SVXSTR_ARROW", "Arrow")
+#define RID_SVXSTR_SQUARE NC_("RID_SVXSTR_SQUARE", "Square")
+#define RID_SVXSTR_CIRCLE NC_("RID_SVXSTR_CIRCLE", "Circle")
+#define RID_SVXSTR_NONE NC_("RID_SVXSTR_NONE", "- none -")
+#define RID_SVXSTR_TRANSPARENCE NC_("RID_SVXSTR_TRANSPARENCE", "Transparency")
+#define RID_SVXSTR_CENTERED NC_("RID_SVXSTR_CENTERED", "Centered")
+#define RID_SVXSTR_NOTCENTERED NC_("RID_SVXSTR_NOTCENTERED", "Not centered")
+#define RID_SVXSTR_GRAFMODE_STANDARD NC_("RID_SVXSTR_GRAFMODE_STANDARD", "Default")
+#define RID_SVXSTR_GRAFMODE_GREYS NC_("RID_SVXSTR_GRAFMODE_GREYS", "Grayscale")
+#define RID_SVXSTR_GRAFMODE_MONO NC_("RID_SVXSTR_GRAFMODE_MONO", "Black/White")
+#define RID_SVXSTR_GRAFMODE_WATERMARK NC_("RID_SVXSTR_GRAFMODE_WATERMARK", "Watermark")
+#define RID_SVXSTR_COLORBAR NC_("RID_SVXSTR_COLORBAR", "Left click to apply as background color, right click to set line color")
+// Default colors
+#define RID_SVXSTR_COLOR_DEFAULT_FONT NC_("RID_SVXSTR_COLOR_DEFAULT_FONTCOLOR", "Dark Red 2")
+#define RID_SVXSTR_COLOR_DEFAULT_FRAMELINE NC_("RID_SVXSTR_COLOR_DEFAULT_FRAMELINE", "Blue")
+#define RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT NC_("RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT", "Yellow")
+#define RID_SVXSTR_COLOR_DEFAULT_SHAPE_STROKE NC_("RID_SVXSTR_COLOR_DEFAULT_SHAPE_STROKE", "Dark Blue 1")
+#define RID_SVXSTR_COLOR_DEFAULT_SHAPE_FILLING NC_("RID_SVXSTR_COLOR_DEFAULT_SHAPE_FILLING", "Light Blue 2")
+// Elements of the standard color palette
+#define RID_SVXSTR_COLOR_BLACK NC_("RID_SVXSTR_COLOR_BLACK", "Black")
+#define RID_SVXSTR_COLOR_GREY NC_("RID_SVXSTR_COLOR_GREY", "Gray")
+#define RID_SVXSTR_COLOR_WHITE NC_("RID_SVXSTR_COLOR_WHITE", "White")
+#define RID_SVXSTR_COLOR_YELLOW NC_("RID_SVXSTR_COLOR_YELLOW", "Yellow")
+#define RID_SVXSTR_COLOR_GOLD NC_("RID_SVXSTR_COLOR_GOLD", "Gold")
+#define RID_SVXSTR_COLOR_ORANGE NC_("RID_SVXSTR_COLOR_ORANGE", "Orange")
+#define RID_SVXSTR_COLOR_BRICK NC_("RID_SVXSTR_COLOR_BRICK", "Brick")
+#define RID_SVXSTR_COLOR_RED NC_("RID_SVXSTR_COLOR_RED", "Red")
+#define RID_SVXSTR_COLOR_MAGENTA NC_("RID_SVXSTR_COLOR_MAGENTA", "Magenta")
+#define RID_SVXSTR_COLOR_PURPLE NC_("RID_SVXSTR_COLOR_PURPLE", "Purple")
+#define RID_SVXSTR_COLOR_INDIGO NC_("RID_SVXSTR_COLOR_INDIGO", "Indigo")
+#define RID_SVXSTR_COLOR_BLUE NC_("RID_SVXSTR_COLOR_BLUE", "Blue")
+#define RID_SVXSTR_COLOR_TEAL NC_("RID_SVXSTR_COLOR_TEAL", "Teal")
+#define RID_SVXSTR_COLOR_GREEN NC_("RID_SVXSTR_COLOR_GREEN", "Green")
+#define RID_SVXSTR_COLOR_LIME NC_("RID_SVXSTR_COLOR_LIME", "Lime")
+// Light variants of the standard color palette
+#define RID_SVXSTR_COLOR_LIGHTGRAY NC_("RID_SVXSTR_COLOR_LIGHTGRAY", "Light Gray")
+#define RID_SVXSTR_COLOR_LIGHTYELLOW NC_("RID_SVXSTR_COLOR_LIGHTYELLOW", "Light Yellow")
+#define RID_SVXSTR_COLOR_LIGHTGOLD NC_("RID_SVXSTR_COLOR_LIGHTGOLD", "Light Gold")
+#define RID_SVXSTR_COLOR_LIGHTORANGE NC_("RID_SVXSTR_COLOR_LIGHTORANGE", "Light Orange")
+#define RID_SVXSTR_COLOR_LIGHTBRICK NC_("RID_SVXSTR_COLOR_LIGHTBRICK", "Light Brick")
+#define RID_SVXSTR_COLOR_LIGHTRED NC_("RID_SVXSTR_COLOR_LIGHTRED", "Light Red")
+#define RID_SVXSTR_COLOR_LIGHTMAGENTA NC_("RID_SVXSTR_COLOR_LIGHTMAGENTA", "Light Magenta")
+#define RID_SVXSTR_COLOR_LIGHTPURPLE NC_("RID_SVXSTR_COLOR_LIGHTPURPLE", "Light Purple")
+#define RID_SVXSTR_COLOR_LIGHTINDIGO NC_("RID_SVXSTR_COLOR_LIGHTINDIGO", "Light Indigo")
+#define RID_SVXSTR_COLOR_LIGHTBLUE NC_("RID_SVXSTR_COLOR_LIGHTBLUE", "Light Blue")
+#define RID_SVXSTR_COLOR_LIGHTTEAL NC_("RID_SVXSTR_COLOR_LIGHTTEAL", "Light Teal")
+#define RID_SVXSTR_COLOR_LIGHTGREEN NC_("RID_SVXSTR_COLOR_LIGHTGREEN", "Light Green")
+#define RID_SVXSTR_COLOR_LIGHTLIME NC_("RID_SVXSTR_COLOR_LIGHTLIME", "Light Lime")
+// Dark variants of the standard color palette
+#define RID_SVXSTR_COLOR_DARKGRAY NC_("RID_SVXSTR_COLOR_DARKGRAY", "Dark Gray")
+#define RID_SVXSTR_COLOR_DARKYELLOW NC_("RID_SVXSTR_COLOR_DARKYELLOW", "Dark Yellow")
+#define RID_SVXSTR_COLOR_DARKGOLD NC_("RID_SVXSTR_COLOR_DARKGOLD", "Dark Gold")
+#define RID_SVXSTR_COLOR_DARKORANGE NC_("RID_SVXSTR_COLOR_DARKORANGE", "Dark Orange")
+#define RID_SVXSTR_COLOR_DARKBRICK NC_("RID_SVXSTR_COLOR_DARKBRICK", "Dark Brick")
+#define RID_SVXSTR_COLOR_DARKRED NC_("RID_SVXSTR_COLOR_DARKRED", "Dark Red")
+#define RID_SVXSTR_COLOR_DARKMAGENTA NC_("RID_SVXSTR_COLOR_DARKMAGENTA", "Dark Magenta")
+#define RID_SVXSTR_COLOR_DARKPURPLE NC_("RID_SVXSTR_COLOR_DARKPURPLE", "Dark Purple")
+#define RID_SVXSTR_COLOR_DARKINDIGO NC_("RID_SVXSTR_COLOR_DARKINDIGO", "Dark Indigo")
+#define RID_SVXSTR_COLOR_DARKBLUE NC_("RID_SVXSTR_COLOR_DARKBLUE", "Dark Blue")
+#define RID_SVXSTR_COLOR_DARKTEAL NC_("RID_SVXSTR_COLOR_DARKTEAL", "Dark Teal")
+#define RID_SVXSTR_COLOR_DARKGREEN NC_("RID_SVXSTR_COLOR_DARKGREEN", "Dark Green")
+#define RID_SVXSTR_COLOR_DARKLIME NC_("RID_SVXSTR_COLOR_DARKLIME", "Dark Lime")
+// Elements of the Tonal color palette
+#define RID_SVXSTR_COLOR_VIOLET NC_("RID_SVXSTR_COLOR_VIOLET", "Violet")
+#define RID_SVXSTR_COLOR_VIOLET_OUG NC_("RID_SVXSTR_COLOR_VIOLET_OUG", "Violet (Out of Gamut)")
+#define RID_SVXSTR_COLOR_BLUE_OUG NC_("RID_SVXSTR_COLOR_BLUE_OUG", "Blue (Out of Gamut)")
+#define RID_SVXSTR_COLOR_AZURE_OUG NC_("RID_SVXSTR_COLOR_AZURE_OUG", "Azure (Out of Gamut)")
+#define RID_SVXSTR_COLOR_SPRINGGREEN_OUG NC_("RID_SVXSTR_COLOR_SPRINGGREEN_OUG", "Spring Green (Out of Gamut)")
+#define RID_SVXSTR_COLOR_GREEN_OUG NC_("RID_SVXSTR_COLOR_GREEN_OUG", "Green (Out of Gamut)")
+#define RID_SVXSTR_COLOR_CHARTREUSEGREEN_OUG NC_("RID_SVXSTR_COLOR_CHARTREUSEGREEN_OUG", "Chartreuse Green (Out of Gamut)")
+#define RID_SVXSTR_COLOR_ORANGE_OUG NC_("RID_SVXSTR_COLOR_ORANGE_OUG", "Orange (Out of Gamut)")
+#define RID_SVXSTR_COLOR_RED_OUG NC_("RID_SVXSTR_COLOR_RED_OUG", "Red (Out of Gamut)")
+#define RID_SVXSTR_COLOR_ROSE_OUG NC_("RID_SVXSTR_COLOR_ROSE_OUG", "Rose (Out of Gamut)")
+#define RID_SVXSTR_COLOR_AZURE NC_("RID_SVXSTR_COLOR_AZURE", "Azure")
+#define RID_SVXSTR_COLOR_CYAN NC_("RID_SVXSTR_COLOR_CYAN", "Cyan")
+#define RID_SVXSTR_COLOR_SPRINGGREEN NC_("RID_SVXSTR_COLOR_SPRINGGREEN", "Spring Green")
+#define RID_SVXSTR_COLOR_CHARTREUSEGREEN NC_("RID_SVXSTR_COLOR_CHARTREUSEGREEN", "Chartreuse Green")
+#define RID_SVXSTR_COLOR_ROSE NC_("RID_SVXSTR_COLOR_ROSE", "Rose")
+//Elements of the Material color palette
+#define RID_SVXSTR_COLOR_MATERIAL_GRAY_A NC_("RID_SVXSTR_COLOR_MATERIAL_GRAY_A", "Gray A")
+#define RID_SVXSTR_COLOR_MATERIAL_YELLOW_A NC_("RID_SVXSTR_COLOR_MATERIAL_YELLOW_A", "Yellow A")
+#define RID_SVXSTR_COLOR_MATERIAL_AMBER_A NC_("RID_SVXSTR_COLOR_MATERIAL_AMBER_A", "Amber A")
+#define RID_SVXSTR_COLOR_MATERIAL_AMBER NC_("RID_SVXSTR_COLOR_MATERIAL_AMBER", "Amber")
+#define RID_SVXSTR_COLOR_MATERIAL_ORANGE_A NC_("RID_SVXSTR_COLOR_MATERIAL_ORANGE_A", "Orange A")
+#define RID_SVXSTR_COLOR_MATERIAL_DEEP_ORANGE_A NC_("RID_SVXSTR_COLOR_MATERIAL_DEEP_ORANGE_A", "Deep Orange A")
+#define RID_SVXSTR_COLOR_MATERIAL_DEEP_ORANGE NC_("RID_SVXSTR_COLOR_MATERIAL_DEEP_ORANGE", "Deep Orange")
+#define RID_SVXSTR_COLOR_MATERIAL_RED_A NC_("RID_SVXSTR_COLOR_MATERIAL_RED_A", "Red A")
+#define RID_SVXSTR_COLOR_MATERIAL_PINK_A NC_("RID_SVXSTR_COLOR_MATERIAL_PINK_A", "Pink A")
+#define RID_SVXSTR_COLOR_MATERIAL_PURPLE_A NC_("RID_SVXSTR_COLOR_MATERIAL_PURPLE_A", "Purple A")
+#define RID_SVXSTR_COLOR_MATERIAL_DEEP_PURPLE_A NC_("RID_SVXSTR_COLOR_MATERIAL_DEEP_PURPLE_A", "Deep Purple A")
+#define RID_SVXSTR_COLOR_MATERIAL_DEEP_PURPLE NC_("RID_SVXSTR_COLOR_MATERIAL_DEEP_PURPLE", "Deep Purple")
+#define RID_SVXSTR_COLOR_MATERIAL_INDIGO_A NC_("RID_SVXSTR_COLOR_MATERIAL_INDIGO_A", "Indigo A")
+#define RID_SVXSTR_COLOR_MATERIAL_BLUE_A NC_("RID_SVXSTR_COLOR_MATERIAL_BLUE_A", "Blue A")
+#define RID_SVXSTR_COLOR_MATERIAL_LIGHT_BLUE_A NC_("RID_SVXSTR_COLOR_MATERIAL_LIGHT_BLUE_A", "Light Blue A")
+#define RID_SVXSTR_COLOR_MATERIAL_CYAN_A NC_("RID_SVXSTR_COLOR_MATERIAL_CYAN_A", "Cyan A")
+#define RID_SVXSTR_COLOR_MATERIAL_TEAL_A NC_("RID_SVXSTR_COLOR_MATERIAL_TEAL_A", "Teal A")
+#define RID_SVXSTR_COLOR_MATERIAL_GREEN_A NC_("RID_SVXSTR_COLOR_MATERIAL_GREEN_A", "Green A")
+#define RID_SVXSTR_COLOR_MATERIAL_LIGHT_GREEN_A NC_("RID_SVXSTR_COLOR_MATERIAL_LIGHT_GREEN_A", "Light Green A")
+#define RID_SVXSTR_COLOR_MATERIAL_LIME_A NC_("RID_SVXSTR_COLOR_MATERIAL_LIME_A", "Lime A")
+#define RID_SVXSTR_COLOR_MATERIAL_BROWN_A NC_("RID_SVXSTR_COLOR_MATERIAL_BROWN_A", "Brown A")
+#define RID_SVXSTR_COLOR_MATERIAL_BROWN NC_("RID_SVXSTR_COLOR_MATERIAL_BROWN", "Brown")
+#define RID_SVXSTR_COLOR_MATERIAL_BLUE_GRAY_A NC_("RID_SVXSTR_COLOR_MATERIAL_BLUE_GRAY_A", "Blue Gray A")
+#define RID_SVXSTR_COLOR_MATERIAL_BLUE_GRAY NC_("RID_SVXSTR_COLOR_MATERIAL_BLUE_GRAY", "Blue Gray")
+/* Old default color names, probably often used in saved files */
+#define RID_SVXSTR_COLOR_BLUE_CLASSIC NC_("RID_SVXSTR_COLOR_BLUE_CLASSIC", "Blue classic")
+#define RID_SVXSTR_COLOR_BLUEGREY NC_("RID_SVXSTR_COLOR_BLUEGREY", "Blue gray")
+#define RID_SVXSTR_COLOR_BORDEAUX NC_("RID_SVXSTR_COLOR_BORDEAUX", "Bordeaux")
+#define RID_SVXSTR_COLOR_PALE_YELLOW NC_("RID_SVXSTR_COLOR_PALE_YELLOW", "Pale yellow")
+#define RID_SVXSTR_COLOR_PALE_GREEN NC_("RID_SVXSTR_COLOR_PALE_GREEN", "Pale green")
+#define RID_SVXSTR_COLOR_DARKVIOLET NC_("RID_SVXSTR_COLOR_DARKVIOLET", "Dark violet")
+#define RID_SVXSTR_COLOR_SALMON NC_("RID_SVXSTR_COLOR_SALMON", "Salmon")
+#define RID_SVXSTR_COLOR_SEABLUE NC_("RID_SVXSTR_COLOR_SEABLUE", "Sea blue")
+#define RID_SVXSTR_COLOR_CHART NC_("RID_SVXSTR_COLOR_CHART", "Chart")
+#define RID_SVXSTR_COLOR_SKYBLUE NC_("RID_SVXSTR_COLOR_SKYBLUE", "Sky blue")
+#define RID_SVXSTR_COLOR_YELLOWGREEN NC_("RID_SVXSTR_COLOR_YELLOWGREEN", "Yellow green")
+#define RID_SVXSTR_COLOR_PINK NC_("RID_SVXSTR_COLOR_PINK", "Pink")
+#define RID_SVXSTR_COLOR_TURQUOISE NC_("RID_SVXSTR_COLOR_TURQUOISE", "Turquoise")
+/* 16 old AutoFormat Table Styles */
+#define RID_SVXSTR_TBLAFMT_3D NC_("RID_SVXSTR_TBLAFMT_3D", "3D")
+#define RID_SVXSTR_TBLAFMT_BLACK1 NC_("RID_SVXSTR_TBLAFMT_BLACK1", "Black 1")
+#define RID_SVXSTR_TBLAFMT_BLACK2 NC_("RID_SVXSTR_TBLAFMT_BLACK2", "Black 2")
+#define RID_SVXSTR_TBLAFMT_BLUE NC_("RID_SVXSTR_TBLAFMT_BLUE", "Blue")
+#define RID_SVXSTR_TBLAFMT_BROWN NC_("RID_SVXSTR_TBLAFMT_BROWN", "Brown")
+#define RID_SVXSTR_TBLAFMT_CURRENCY NC_("RID_SVXSTR_TBLAFMT_CURRENCY", "Currency")
+#define RID_SVXSTR_TBLAFMT_CURRENCY_3D NC_("RID_SVXSTR_TBLAFMT_CURRENCY_3D", "Currency 3D")
+#define RID_SVXSTR_TBLAFMT_CURRENCY_GRAY NC_("RID_SVXSTR_TBLAFMT_CURRENCY_GRAY", "Currency Gray")
+#define RID_SVXSTR_TBLAFMT_CURRENCY_LAVENDER NC_("RID_SVXSTR_TBLAFMT_CURRENCY_LAVENDER", "Currency Lavender")
+#define RID_SVXSTR_TBLAFMT_CURRENCY_TURQUOISE NC_("RID_SVXSTR_TBLAFMT_CURRENCY_TURQUOISE", "Currency Turquoise")
+#define RID_SVXSTR_TBLAFMT_GRAY NC_("RID_SVXSTR_TBLAFMT_GRAY", "Gray")
+#define RID_SVXSTR_TBLAFMT_GREEN NC_("RID_SVXSTR_TBLAFMT_GREEN", "Green")
+#define RID_SVXSTR_TBLAFMT_LAVENDER NC_("RID_SVXSTR_TBLAFMT_LAVENDER", "Lavender")
+#define RID_SVXSTR_TBLAFMT_RED NC_("RID_SVXSTR_TBLAFMT_RED", "Red")
+#define RID_SVXSTR_TBLAFMT_TURQUOISE NC_("RID_SVXSTR_TBLAFMT_TURQUOISE", "Turquoise")
+#define RID_SVXSTR_TBLAFMT_YELLOW NC_("RID_SVXSTR_TBLAFMT_YELLOW", "Yellow")
+/* 10 new AutoFormat Table Styles since LibreOffice 6.0 */
+#define RID_SVXSTR_TBLAFMT_LO6_ACADEMIC NC_("RID_SVXSTR_TBLAFMT_LO6_ACADEMIC", "Academic")
+#define RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_BLUE NC_("RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_BLUE", "Box List Blue")
+#define RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_GREEN NC_("RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_GREEN", "Box List Green")
+#define RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_RED NC_("RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_RED", "Box List Red")
+#define RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_YELLOW NC_("RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_YELLOW", "Box List Yellow")
+#define RID_SVXSTR_TBLAFMT_LO6_ELEGANT NC_("RID_SVXSTR_TBLAFMT_LO6_ELEGANT", "Elegant")
+#define RID_SVXSTR_TBLAFMT_LO6_FINANCIAL NC_("RID_SVXSTR_TBLAFMT_LO6_FINANCIAL", "Financial")
+#define RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_COLUMNS NC_("RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_COLUMNS", "Simple Grid Columns")
+#define RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_ROWS NC_("RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_ROWS", "Simple Grid Rows")
+#define RID_SVXSTR_TBLAFMT_LO6_SIMPLE_LIST_SHADED NC_("RID_SVXSTR_TBLAFMT_LO6_SIMPLE_LIST_SHADED", "Simple List Shaded")
+#define RID_SVXSTR_LINEJOINT_MIDDLE NC_("RID_SVXSTR_LINEJOINT_MIDDLE", "Line joint averaged")
+#define RID_SVXSTR_LINEJOINT_BEVEL NC_("RID_SVXSTR_LINEJOINT_BEVEL", "Line joint bevel")
+#define RID_SVXSTR_LINEJOINT_MITER NC_("RID_SVXSTR_LINEJOINT_MITER", "Line joint miter")
+#define RID_SVXSTR_LINEJOINT_ROUND NC_("RID_SVXSTR_LINEJOINT_ROUND", "Line joint round")
+// the familiar name for it
+#define RID_SVXSTR_LINECAP_BUTT NC_("RID_SVXSTR_LINECAP_BUTT", "Line cap flat")
+#define RID_SVXSTR_LINECAP_ROUND NC_("RID_SVXSTR_LINECAP_ROUND", "Line cap round")
+#define RID_SVXSTR_LINECAP_SQUARE NC_("RID_SVXSTR_LINECAP_SQUARE", "Line cap square")
+#define RID_SVXSTR_GRDT0 NC_("RID_SVXSTR_GRDT0", "Gradient")
+#define RID_SVXSTR_GRDT1 NC_("RID_SVXSTR_GRDT1", "Linear blue/white")
+#define RID_SVXSTR_GRDT2 NC_("RID_SVXSTR_GRDT2", "Linear magenta/green")
+#define RID_SVXSTR_GRDT3 NC_("RID_SVXSTR_GRDT3", "Linear yellow/brown")
+#define RID_SVXSTR_GRDT4 NC_("RID_SVXSTR_GRDT4", "Radial green/black")
+#define RID_SVXSTR_GRDT5 NC_("RID_SVXSTR_GRDT5", "Radial red/yellow")
+#define RID_SVXSTR_GRDT6 NC_("RID_SVXSTR_GRDT6", "Rectangular red/white")
+#define RID_SVXSTR_GRDT7 NC_("RID_SVXSTR_GRDT7", "Square yellow/white")
+#define RID_SVXSTR_GRDT8 NC_("RID_SVXSTR_GRDT8", "Ellipsoid blue gray/light blue")
+#define RID_SVXSTR_GRDT9 NC_("RID_SVXSTR_GRDT9", "Axial light red/white")
+// l means left
+#define RID_SVXSTR_GRDT10 NC_("RID_SVXSTR_GRDT10", "Diagonal 1l")
+// r means right
+#define RID_SVXSTR_GRDT11 NC_("RID_SVXSTR_GRDT11", "Diagonal 1r")
+// l means left
+#define RID_SVXSTR_GRDT12 NC_("RID_SVXSTR_GRDT12", "Diagonal 2l")
+// r means right
+#define RID_SVXSTR_GRDT13 NC_("RID_SVXSTR_GRDT13", "Diagonal 2r")
+// l means left
+#define RID_SVXSTR_GRDT14 NC_("RID_SVXSTR_GRDT14", "Diagonal 3l")
+// r means right
+#define RID_SVXSTR_GRDT15 NC_("RID_SVXSTR_GRDT15", "Diagonal 3r")
+// l means left
+#define RID_SVXSTR_GRDT16 NC_("RID_SVXSTR_GRDT16", "Diagonal 4l")
+// r means right
+#define RID_SVXSTR_GRDT17 NC_("RID_SVXSTR_GRDT17", "Diagonal 4r")
+#define RID_SVXSTR_GRDT18 NC_("RID_SVXSTR_GRDT18", "Diagonal Blue")
+#define RID_SVXSTR_GRDT19 NC_("RID_SVXSTR_GRDT19", "Diagonal Green")
+#define RID_SVXSTR_GRDT20 NC_("RID_SVXSTR_GRDT20", "Diagonal Orange")
+#define RID_SVXSTR_GRDT21 NC_("RID_SVXSTR_GRDT21", "Diagonal Red")
+#define RID_SVXSTR_GRDT22 NC_("RID_SVXSTR_GRDT22", "Diagonal Turquoise")
+#define RID_SVXSTR_GRDT23 NC_("RID_SVXSTR_GRDT23", "Diagonal Violet")
+#define RID_SVXSTR_GRDT24 NC_("RID_SVXSTR_GRDT24", "From a Corner")
+#define RID_SVXSTR_GRDT25 NC_("RID_SVXSTR_GRDT25", "From a Corner, Blue")
+#define RID_SVXSTR_GRDT26 NC_("RID_SVXSTR_GRDT26", "From a Corner, Green")
+#define RID_SVXSTR_GRDT27 NC_("RID_SVXSTR_GRDT27", "From a Corner, Orange")
+#define RID_SVXSTR_GRDT28 NC_("RID_SVXSTR_GRDT28", "From a Corner, Red")
+#define RID_SVXSTR_GRDT29 NC_("RID_SVXSTR_GRDT29", "From a Corner, Turquoise")
+#define RID_SVXSTR_GRDT30 NC_("RID_SVXSTR_GRDT30", "From a Corner, Violet")
+#define RID_SVXSTR_GRDT31 NC_("RID_SVXSTR_GRDT31", "From the Middle")
+#define RID_SVXSTR_GRDT32 NC_("RID_SVXSTR_GRDT32", "From the Middle, Blue")
+#define RID_SVXSTR_GRDT33 NC_("RID_SVXSTR_GRDT33", "From the Middle, Green")
+#define RID_SVXSTR_GRDT34 NC_("RID_SVXSTR_GRDT34", "From the Middle, Orange")
+#define RID_SVXSTR_GRDT35 NC_("RID_SVXSTR_GRDT35", "From the Middle, Red")
+#define RID_SVXSTR_GRDT36 NC_("RID_SVXSTR_GRDT36", "From the Middle, Turquoise")
+#define RID_SVXSTR_GRDT37 NC_("RID_SVXSTR_GRDT37", "From the Middle, Violet")
+#define RID_SVXSTR_GRDT38 NC_("RID_SVXSTR_GRDT38", "Horizontal")
+#define RID_SVXSTR_GRDT39 NC_("RID_SVXSTR_GRDT39", "Horizontal Blue")
+#define RID_SVXSTR_GRDT40 NC_("RID_SVXSTR_GRDT40", "Horizontal Green")
+#define RID_SVXSTR_GRDT41 NC_("RID_SVXSTR_GRDT41", "Horizontal Orange")
+#define RID_SVXSTR_GRDT42 NC_("RID_SVXSTR_GRDT42", "Horizontal Red")
+#define RID_SVXSTR_GRDT43 NC_("RID_SVXSTR_GRDT43", "Horizontal Turquoise")
+#define RID_SVXSTR_GRDT44 NC_("RID_SVXSTR_GRDT44", "Horizontal Violet")
+#define RID_SVXSTR_GRDT45 NC_("RID_SVXSTR_GRDT45", "Radial")
+#define RID_SVXSTR_GRDT46 NC_("RID_SVXSTR_GRDT46", "Radial Blue")
+#define RID_SVXSTR_GRDT47 NC_("RID_SVXSTR_GRDT47", "Radial Green")
+#define RID_SVXSTR_GRDT48 NC_("RID_SVXSTR_GRDT48", "Radial Orange")
+#define RID_SVXSTR_GRDT49 NC_("RID_SVXSTR_GRDT49", "Radial Red")
+#define RID_SVXSTR_GRDT50 NC_("RID_SVXSTR_GRDT50", "Radial Turquoise")
+#define RID_SVXSTR_GRDT51 NC_("RID_SVXSTR_GRDT51", "Radial Violet")
+#define RID_SVXSTR_GRDT52 NC_("RID_SVXSTR_GRDT52", "Vertical")
+#define RID_SVXSTR_GRDT53 NC_("RID_SVXSTR_GRDT53", "Vertical Blue")
+#define RID_SVXSTR_GRDT54 NC_("RID_SVXSTR_GRDT54", "Vertical Green")
+#define RID_SVXSTR_GRDT55 NC_("RID_SVXSTR_GRDT55", "Vertical Orange")
+#define RID_SVXSTR_GRDT56 NC_("RID_SVXSTR_GRDT56", "Vertical Red")
+#define RID_SVXSTR_GRDT57 NC_("RID_SVXSTR_GRDT57", "Vertical Turquoise")
+#define RID_SVXSTR_GRDT58 NC_("RID_SVXSTR_GRDT58", "Vertical Violet")
+//gradients of unknown provenience
+#define RID_SVXSTR_GRDT59 NC_("RID_SVXSTR_GRDT59", "Gray Gradient")
+#define RID_SVXSTR_GRDT60 NC_("RID_SVXSTR_GRDT60", "Yellow Gradient")
+#define RID_SVXSTR_GRDT61 NC_("RID_SVXSTR_GRDT61", "Orange Gradient")
+#define RID_SVXSTR_GRDT62 NC_("RID_SVXSTR_GRDT62", "Red Gradient")
+#define RID_SVXSTR_GRDT63 NC_("RID_SVXSTR_GRDT63", "Pink Gradient")
+#define RID_SVXSTR_GRDT64 NC_("RID_SVXSTR_GRDT64", "Sky")
+#define RID_SVXSTR_GRDT65 NC_("RID_SVXSTR_GRDT65", "Cyan Gradient")
+#define RID_SVXSTR_GRDT66 NC_("RID_SVXSTR_GRDT66", "Blue Gradient")
+#define RID_SVXSTR_GRDT67 NC_("RID_SVXSTR_GRDT67", "Purple Pipe")
+#define RID_SVXSTR_GRDT68 NC_("RID_SVXSTR_GRDT68", "Night")
+#define RID_SVXSTR_GRDT69 NC_("RID_SVXSTR_GRDT69", "Green Gradient")
+//actual gradients defined for 6.1
+#define RID_SVXSTR_GRDT70 NC_("RID_SVXSTR_GRDT70", "Pastel Bouquet")
+#define RID_SVXSTR_GRDT71 NC_("RID_SVXSTR_GRDT71", "Pastel Dream")
+#define RID_SVXSTR_GRDT72 NC_("RID_SVXSTR_GRDT72", "Blue Touch")
+#define RID_SVXSTR_GRDT73 NC_("RID_SVXSTR_GRDT73", "Blank with Gray")
+#define RID_SVXSTR_GRDT74 NC_("RID_SVXSTR_GRDT74", "Spotted Gray")
+#define RID_SVXSTR_GRDT75 NC_("RID_SVXSTR_GRDT75", "London Mist")
+#define RID_SVXSTR_GRDT76 NC_("RID_SVXSTR_GRDT76", "Teal to Blue")
+#define RID_SVXSTR_GRDT77 NC_("RID_SVXSTR_GRDT77", "Midnight")
+#define RID_SVXSTR_GRDT78 NC_("RID_SVXSTR_GRDT78", "Deep Ocean")
+#define RID_SVXSTR_GRDT79 NC_("RID_SVXSTR_GRDT79", "Submarine")
+#define RID_SVXSTR_GRDT80 NC_("RID_SVXSTR_GRDT80", "Green Grass")
+#define RID_SVXSTR_GRDT81 NC_("RID_SVXSTR_GRDT81", "Neon Light")
+#define RID_SVXSTR_GRDT82 NC_("RID_SVXSTR_GRDT82", "Sunshine")
+#define RID_SVXSTR_GRDT83 NC_("RID_SVXSTR_GRDT83", "Present")
+#define RID_SVXSTR_GRDT84 NC_("RID_SVXSTR_GRDT84", "Mahogany")
+// /gradients
+#define RID_SVXSTR_HATCH0 NC_("RID_SVXSTR_HATCH0", "Black 0 Degrees")
+#define RID_SVXSTR_HATCH1 NC_("RID_SVXSTR_HATCH1", "Black 90 Degrees")
+#define RID_SVXSTR_HATCH2 NC_("RID_SVXSTR_HATCH2", "Black 180 Degrees Crossed")
+#define RID_SVXSTR_HATCH3 NC_("RID_SVXSTR_HATCH3", "Blue 45 Degrees")
+#define RID_SVXSTR_HATCH4 NC_("RID_SVXSTR_HATCH4", "Blue -45 Degrees")
+#define RID_SVXSTR_HATCH5 NC_("RID_SVXSTR_HATCH5", "Blue 45 Degrees Crossed")
+#define RID_SVXSTR_HATCH6 NC_("RID_SVXSTR_HATCH6", "Green 30 Degrees")
+#define RID_SVXSTR_HATCH7 NC_("RID_SVXSTR_HATCH7", "Green 60 Degrees")
+#define RID_SVXSTR_HATCH8 NC_("RID_SVXSTR_HATCH8", "Green 90 Degrees Triple")
+#define RID_SVXSTR_HATCH9 NC_("RID_SVXSTR_HATCH9", "Red 45 Degrees")
+#define RID_SVXSTR_HATCH10 NC_("RID_SVXSTR_HATCH10", "Red 90 Degrees Crossed")
+#define RID_SVXSTR_HATCH11 NC_("RID_SVXSTR_HATCH11", "Red -45 Degrees Triple")
+#define RID_SVXSTR_HATCH12 NC_("RID_SVXSTR_HATCH12", "Yellow 45 Degrees")
+#define RID_SVXSTR_HATCH13 NC_("RID_SVXSTR_HATCH13", "Yellow 45 Degrees Crossed")
+#define RID_SVXSTR_HATCH14 NC_("RID_SVXSTR_HATCH14", "Yellow 45 Degrees Triple")
+#define RID_SVXSTR_HATCH15 NC_("RID_SVXSTR_HATCH15", "Hatching")
+#define RID_SVXSTR_BMP0 NC_("RID_SVXSTR_BMP0", "Empty")
+#define RID_SVXSTR_BMP1 NC_("RID_SVXSTR_BMP1", "Painted White")
+#define RID_SVXSTR_BMP2 NC_("RID_SVXSTR_BMP2", "Paper Texture")
+#define RID_SVXSTR_BMP3 NC_("RID_SVXSTR_BMP3", "Paper Crumpled")
+#define RID_SVXSTR_BMP4 NC_("RID_SVXSTR_BMP4", "Paper Graph")
+#define RID_SVXSTR_BMP5 NC_("RID_SVXSTR_BMP5", "Parchment Paper")
+#define RID_SVXSTR_BMP6 NC_("RID_SVXSTR_BMP6", "Fence")
+#define RID_SVXSTR_BMP7 NC_("RID_SVXSTR_BMP7", "Wooden Board")
+#define RID_SVXSTR_BMP8 NC_("RID_SVXSTR_BMP8", "Maple Leaves")
+#define RID_SVXSTR_BMP9 NC_("RID_SVXSTR_BMP9", "Lawn")
+#define RID_SVXSTR_BMP10 NC_("RID_SVXSTR_BMP10", "Colorful Pebbles")
+#define RID_SVXSTR_BMP11 NC_("RID_SVXSTR_BMP11", "Coffee Beans")
+#define RID_SVXSTR_BMP12 NC_("RID_SVXSTR_BMP12", "Little Clouds")
+#define RID_SVXSTR_BMP13 NC_("RID_SVXSTR_BMP13", "Bathroom Tiles")
+#define RID_SVXSTR_BMP14 NC_("RID_SVXSTR_BMP14", "Wall of Rock")
+#define RID_SVXSTR_BMP15 NC_("RID_SVXSTR_BMP15", "Zebra")
+#define RID_SVXSTR_BMP16 NC_("RID_SVXSTR_BMP16", "Color Stripes")
+#define RID_SVXSTR_BMP17 NC_("RID_SVXSTR_BMP17", "Gravel")
+#define RID_SVXSTR_BMP18 NC_("RID_SVXSTR_BMP18", "Parchment Studio")
+#define RID_SVXSTR_BMP19 NC_("RID_SVXSTR_BMP19", "Night Sky")
+#define RID_SVXSTR_BMP20 NC_("RID_SVXSTR_BMP20", "Pool")
+#define RID_SVXSTR_BMP21 NC_("RID_SVXSTR_BMP21", "Bitmap")
+#define RID_SVXSTR_BMP79 NC_("RID_SVXSTR_BMP79", "Invoice Paper")
+#define RID_SVXSTR_BMP80 NC_("RID_SVXSTR_BMP80", "Concrete")
+#define RID_SVXSTR_BMP81 NC_("RID_SVXSTR_BMP81", "Brick Wall")
+#define RID_SVXSTR_BMP82 NC_("RID_SVXSTR_BMP82", "Stone Wall")
+#define RID_SVXSTR_BMP83 NC_("RID_SVXSTR_BMP83", "Floral")
+#define RID_SVXSTR_BMP84 NC_("RID_SVXSTR_BMP84", "Space")
+#define RID_SVXSTR_BMP85 NC_("RID_SVXSTR_BMP85", "Ice light")
+#define RID_SVXSTR_BMP86 NC_("RID_SVXSTR_BMP86", "Marble")
+#define RID_SVXSTR_BMP87 NC_("RID_SVXSTR_BMP87", "Sand light")
+#define RID_SVXSTR_BMP88 NC_("RID_SVXSTR_BMP88", "Stone")
+#define RID_SVXSTR_BMP89 NC_("RID_SVXSTR_BMP89", "White Diffusion")
+#define RID_SVXSTR_BMP90 NC_("RID_SVXSTR_BMP90", "Surface")
+#define RID_SVXSTR_BMP91 NC_("RID_SVXSTR_BMP91", "Cardboard")
+#define RID_SVXSTR_BMP92 NC_("RID_SVXSTR_BMP92", "Studio")
+#define RID_SVXSTR_BMP22 NC_("RID_SVXSTR_BMP22", "5 Percent")
+#define RID_SVXSTR_BMP23 NC_("RID_SVXSTR_BMP23", "10 Percent")
+#define RID_SVXSTR_BMP24 NC_("RID_SVXSTR_BMP24", "20 Percent")
+#define RID_SVXSTR_BMP25 NC_("RID_SVXSTR_BMP25", "25 Percent")
+#define RID_SVXSTR_BMP26 NC_("RID_SVXSTR_BMP26", "30 Percent")
+#define RID_SVXSTR_BMP27 NC_("RID_SVXSTR_BMP27", "40 Percent")
+#define RID_SVXSTR_BMP28 NC_("RID_SVXSTR_BMP28", "50 Percent")
+#define RID_SVXSTR_BMP29 NC_("RID_SVXSTR_BMP29", "60 Percent")
+#define RID_SVXSTR_BMP30 NC_("RID_SVXSTR_BMP30", "70 Percent")
+#define RID_SVXSTR_BMP31 NC_("RID_SVXSTR_BMP31", "75 Percent")
+#define RID_SVXSTR_BMP32 NC_("RID_SVXSTR_BMP32", "80 Percent")
+#define RID_SVXSTR_BMP33 NC_("RID_SVXSTR_BMP33", "90 Percent")
+#define RID_SVXSTR_BMP34 NC_("RID_SVXSTR_BMP34", "Light Downward Diagonal")
+#define RID_SVXSTR_BMP35 NC_("RID_SVXSTR_BMP35", "Light Upward Diagonal")
+#define RID_SVXSTR_BMP36 NC_("RID_SVXSTR_BMP36", "Dark Downward Diagonal")
+#define RID_SVXSTR_BMP37 NC_("RID_SVXSTR_BMP37", "Dark Upward Diagonal")
+#define RID_SVXSTR_BMP38 NC_("RID_SVXSTR_BMP38", "Wide Downward Diagonal")
+#define RID_SVXSTR_BMP39 NC_("RID_SVXSTR_BMP39", "Wide Upward Diagonal")
+#define RID_SVXSTR_BMP40 NC_("RID_SVXSTR_BMP40", "Light Vertical")
+#define RID_SVXSTR_BMP41 NC_("RID_SVXSTR_BMP41", "Light Horizontal")
+#define RID_SVXSTR_BMP42 NC_("RID_SVXSTR_BMP42", "Narrow Vertical")
+#define RID_SVXSTR_BMP43 NC_("RID_SVXSTR_BMP43", "Narrow Horizontal")
+#define RID_SVXSTR_BMP44 NC_("RID_SVXSTR_BMP44", "Dark Vertical")
+#define RID_SVXSTR_BMP45 NC_("RID_SVXSTR_BMP45", "Dark Horizontal")
+#define RID_SVXSTR_BMP46 NC_("RID_SVXSTR_BMP46", "Dashed Downward Diagonal")
+#define RID_SVXSTR_BMP47 NC_("RID_SVXSTR_BMP47", "Dashed Upward Diagonal")
+#define RID_SVXSTR_BMP48 NC_("RID_SVXSTR_BMP48", "Dashed Horizontal")
+#define RID_SVXSTR_BMP49 NC_("RID_SVXSTR_BMP49", "Dashed Vertical")
+#define RID_SVXSTR_BMP50 NC_("RID_SVXSTR_BMP50", "Small Confetti")
+#define RID_SVXSTR_BMP51 NC_("RID_SVXSTR_BMP51", "Large Confetti")
+#define RID_SVXSTR_BMP52 NC_("RID_SVXSTR_BMP52", "Zig Zag")
+#define RID_SVXSTR_BMP53 NC_("RID_SVXSTR_BMP53", "Wave")
+#define RID_SVXSTR_BMP54 NC_("RID_SVXSTR_BMP54", "Diagonal Brick")
+#define RID_SVXSTR_BMP55 NC_("RID_SVXSTR_BMP55", "Horizontal Brick")
+#define RID_SVXSTR_BMP56 NC_("RID_SVXSTR_BMP56", "Weave")
+#define RID_SVXSTR_BMP57 NC_("RID_SVXSTR_BMP57", "Plaid")
+#define RID_SVXSTR_BMP58 NC_("RID_SVXSTR_BMP58", "Divot")
+#define RID_SVXSTR_BMP59 NC_("RID_SVXSTR_BMP59", "Dotted Grid")
+#define RID_SVXSTR_BMP60 NC_("RID_SVXSTR_BMP60", "Dotted Diamond")
+#define RID_SVXSTR_BMP61 NC_("RID_SVXSTR_BMP61", "Shingle")
+#define RID_SVXSTR_BMP62 NC_("RID_SVXSTR_BMP62", "Trellis")
+#define RID_SVXSTR_BMP63 NC_("RID_SVXSTR_BMP63", "Sphere")
+#define RID_SVXSTR_BMP64 NC_("RID_SVXSTR_BMP64", "Small Grid")
+#define RID_SVXSTR_BMP65 NC_("RID_SVXSTR_BMP65", "Large Grid")
+#define RID_SVXSTR_BMP66 NC_("RID_SVXSTR_BMP66", "Small Checker Board")
+#define RID_SVXSTR_BMP67 NC_("RID_SVXSTR_BMP67", "Large Checker Board")
+#define RID_SVXSTR_BMP68 NC_("RID_SVXSTR_BMP68", "Outlined Diamond")
+#define RID_SVXSTR_BMP69 NC_("RID_SVXSTR_BMP69", "Solid Diamond")
+#define RID_SVXSTR_BMP70 NC_("RID_SVXSTR_BMP70", "Vertical")
+#define RID_SVXSTR_BMP71 NC_("RID_SVXSTR_BMP71", "Horizontal")
+#define RID_SVXSTR_BMP72 NC_("RID_SVXSTR_BMP72", "Downward Diagonal")
+#define RID_SVXSTR_BMP73 NC_("RID_SVXSTR_BMP73", "Upward Diagonal")
+#define RID_SVXSTR_BMP74 NC_("RID_SVXSTR_BMP74", "Cross")
+#define RID_SVXSTR_BMP75 NC_("RID_SVXSTR_BMP75", "Diagonal Cross")
+#define RID_SVXSTR_BMP76 NC_("RID_SVXSTR_BMP76", "Dashed Dotted")
+#define RID_SVXSTR_BMP77 NC_("RID_SVXSTR_BMP77", "Dashed Dotted Upward Diagonal")
+#define RID_SVXSTR_BMP78 NC_("RID_SVXSTR_BMP78", "Solid Dotted")
+#define RID_SVXSTR_DASH0 NC_("RID_SVXSTR_DASH0", "Dot")
+#define RID_SVXSTR_DASH1 NC_("RID_SVXSTR_DASH1", "Long Dot")
+#define RID_SVXSTR_DASH2 NC_("RID_SVXSTR_DASH2", "Dot (Rounded)")
+#define RID_SVXSTR_DASH3 NC_("RID_SVXSTR_DASH3", "Dash")
+#define RID_SVXSTR_DASH4 NC_("RID_SVXSTR_DASH4", "Long Dash")
+#define RID_SVXSTR_DASH5 NC_("RID_SVXSTR_DASH5", "Double Dash")
+#define RID_SVXSTR_DASH6 NC_("RID_SVXSTR_DASH6", "Long Dash Dot")
+#define RID_SVXSTR_DASH7 NC_("RID_SVXSTR_DASH7", "Double Dash Dot")
+#define RID_SVXSTR_DASH8 NC_("RID_SVXSTR_DASH8", "Double Dash Dot Dot")
+#define RID_SVXSTR_DASH9 NC_("RID_SVXSTR_DASH9", "Ultrafine Dotted")
+#define RID_SVXSTR_DASH10 NC_("RID_SVXSTR_DASH10", "Fine Dotted")
+#define RID_SVXSTR_DASH11 NC_("RID_SVXSTR_DASH11", "Ultrafine Dashed")
+#define RID_SVXSTR_DASH12 NC_("RID_SVXSTR_DASH12", "Fine Dashed")
+#define RID_SVXSTR_DASH13 NC_("RID_SVXSTR_DASH13", "Fine Dashed")
+#define RID_SVXSTR_DASH14 NC_("RID_SVXSTR_DASH14", "Dashed")
+#define RID_SVXSTR_DASH15 NC_("RID_SVXSTR_DASH15", "Line Style 9")
+#define RID_SVXSTR_DASH16 NC_("RID_SVXSTR_DASH16", "3 Dashes 3 Dots")
+#define RID_SVXSTR_DASH17 NC_("RID_SVXSTR_DASH17", "Ultrafine 2 Dots 3 Dashes")
+#define RID_SVXSTR_DASH18 NC_("RID_SVXSTR_DASH18", "2 Dots 1 Dash")
+#define RID_SVXSTR_DASH19 NC_("RID_SVXSTR_DASH19", "Line with Fine Dots")
+#define RID_SVXSTR_DASH20 NC_("RID_SVXSTR_DASH20", "Dash Dot")
+#define RID_SVXSTR_DASH21 NC_("RID_SVXSTR_DASH21", "Long Dot (Rounded)")
+#define RID_SVXSTR_DASH22 NC_("RID_SVXSTR_DASH22", "Dash Dot Dot")
+#define RID_SVXSTR_DASH23 NC_("RID_SVXSTR_DASH23", "Dash (Rounded)")
+#define RID_SVXSTR_DASH24 NC_("RID_SVXSTR_DASH24", "Long Dash (Rounded)")
+#define RID_SVXSTR_DASH25 NC_("RID_SVXSTR_DASH25", "Double Dash (Rounded)")
+#define RID_SVXSTR_DASH26 NC_("RID_SVXSTR_DASH26", "Dash Dot (Rounded)")
+#define RID_SVXSTR_DASH27 NC_("RID_SVXSTR_DASH27", "Long Dash Dot (Rounded)")
+#define RID_SVXSTR_DASH28 NC_("RID_SVXSTR_DASH28", "Double Dash Dot (Rounded)")
+#define RID_SVXSTR_DASH29 NC_("RID_SVXSTR_DASH29", "Dash Dot Dot (Rounded)")
+#define RID_SVXSTR_DASH30 NC_("RID_SVXSTR_DASH30", "Double Dash Dot Dot (Rounded)")
+
+#define RID_SVXSTR_IMAP_ALL_FILTER NC_("RID_SVXSTR_IMAP_ALL_FILTER", "All formats")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND0 NC_("RID_SVXSTR_LEND0", "Concave short")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND1 NC_("RID_SVXSTR_LEND1", "Square 45")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND2 NC_("RID_SVXSTR_LEND2", "Arrow short")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND3 NC_("RID_SVXSTR_LEND3", "Dimension Lines")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND4 NC_("RID_SVXSTR_LEND4", "Double Arrow")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND5 NC_("RID_SVXSTR_LEND5", "Triangle")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND6 NC_("RID_SVXSTR_LEND6", "Concave")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND7 NC_("RID_SVXSTR_LEND7", "Arrow large")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND8 NC_("RID_SVXSTR_LEND8", "Dimension Line")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND9 NC_("RID_SVXSTR_LEND9", "Circle")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND10 NC_("RID_SVXSTR_LEND10", "Square")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND11 NC_("RID_SVXSTR_LEND11", "Arrow")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND12 NC_("RID_SVXSTR_LEND12", "Half Circle")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND13 NC_("RID_SVXSTR_LEND13", "Triangle unfilled")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND14 NC_("RID_SVXSTR_LEND14", "Diamond unfilled")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND15 NC_("RID_SVXSTR_LEND15", "Diamond")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND16 NC_("RID_SVXSTR_LEND16", "Circle unfilled")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND17 NC_("RID_SVXSTR_LEND17", "Square 45 unfilled")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND18 NC_("RID_SVXSTR_LEND18", "Square unfilled")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND19 NC_("RID_SVXSTR_LEND19", "Half Circle unfilled")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND20 NC_("RID_SVXSTR_LEND20", "Dimension Line Arrow")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND21 NC_("RID_SVXSTR_LEND21", "Line short")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND22 NC_("RID_SVXSTR_LEND22", "Line")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND23 NC_("RID_SVXSTR_LEND23", "Half Arrow left")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND24 NC_("RID_SVXSTR_LEND24", "Half Arrow right")
+// To translators: this is an arrow head style
+#define RID_SVXSTR_LEND25 NC_("RID_SVXSTR_LEND25", "Reversed Arrow")
+// To translators: this is an arrow head style, CF is Crow's Foot, of Crow's Foot Notation
+#define RID_SVXSTR_LEND26 NC_("RID_SVXSTR_LEND26", "CF One")
+// To translators: this is an arrow head style, CF is Crow's Foot, of Crow's Foot Notation
+#define RID_SVXSTR_LEND27 NC_("RID_SVXSTR_LEND27", "CF Only One")
+// To translators: this is an arrow head style, CF is Crow's Foot, of Crow's Foot Notation
+#define RID_SVXSTR_LEND28 NC_("RID_SVXSTR_LEND28", "CF Many")
+// To translators: this is an arrow head style, CF is Crow's Foot, of Crow's Foot Notation
+#define RID_SVXSTR_LEND29 NC_("RID_SVXSTR_LEND29", "CF Many One")
+// To translators: this is an arrow head style, CF is Crow's Foot, of Crow's Foot Notation
+#define RID_SVXSTR_LEND30 NC_("RID_SVXSTR_LEND30", "CF Zero One")
+// To translators: this is an arrow head style, CF is Crow's Foot, of Crow's Foot Notation
+#define RID_SVXSTR_LEND31 NC_("RID_SVXSTR_LEND31", "CF Zero Many")
+#define RID_SVXSTR_TRASNGR0 NC_("RID_SVXSTR_TRASNGR0", "Transparency")
+#define RID_SVXSTR_COLOR_LIBRE_GREEN_1 NC_("RID_SVXSTR_COLOR_LIBRE_GREEN_1", "Green 1 (%PRODUCTNAME Main Color)")
+#define RID_SVXSTR_COLOR_LIBRE_GREEN_ACCENT NC_("RID_SVXSTR_COLOR_LIBRE_GREEN_ACCENT", "Green Accent")
+#define RID_SVXSTR_COLOR_LIBRE_BLUE_ACCENT NC_("RID_SVXSTR_COLOR_LIBRE_BLUE_ACCENT", "Blue Accent")
+#define RID_SVXSTR_COLOR_LIBRE_ORANGE_ACCENT NC_("RID_SVXSTR_COLOR_LIBRE_ORANGE_ACCENT", "Orange Accent")
+#define RID_SVXSTR_COLOR_LIBRE_PURPLE NC_("RID_SVXSTR_COLOR_LIBRE_PURPLE", "Purple")
+#define RID_SVXSTR_COLOR_LIBRE_PURPLE_ACCENT NC_("RID_SVXSTR_COLOR_LIBRE_PURPLE_ACCENT", "Purple Accent")
+#define RID_SVXSTR_COLOR_LIBRE_YELLOW_ACCENT NC_("RID_SVXSTR_COLOR_LIBRE_YELLOW_ACCENT", "Yellow Accent")
+
+#define RID_SVXSTR_GALLERYPROPS_GALTHEME NC_("RID_SVXSTR_GALLERYPROPS_GALTHEME", "Gallery Theme")
+#define RID_SVXSTR_SUCCESSRECOV NC_("RID_SVXSTR_SUCCESSRECOV", "Successfully recovered")
+#define RID_SVXSTR_ORIGDOCRECOV NC_("RID_SVXSTR_ORIGDOCRECOV", "Original document recovered")
+#define RID_SVXSTR_RECOVFAILED NC_("RID_SVXSTR_RECOVFAILED", "Recovery failed")
+#define RID_SVXSTR_RECOVINPROGR NC_("RID_SVXSTR_RECOVINPROGR", "Recovery in progress")
+#define RID_SVXSTR_NOTRECOVYET NC_("RID_SVXSTR_NOTRECOVYET", "Not recovered yet")
+#define RID_SVXSTR_RECOVERY_INPROGRESS NC_("RID_SVXSTR_RECOVERY_INPROGRESS", "%PRODUCTNAME %PRODUCTVERSION has begun recovering your documents. Depending on the size of the documents this process can take some time.")
+#define RID_SVXSTR_RECOVERYONLY_FINISH_DESCR NC_("RID_SVXSTR_RECOVERYONLY_FINISH_DESCR", "Recovery of your documents was finished. Click 'Finish' to see your documents.")
+#define RID_SVXSTR_RECOVERYONLY_FINISH NC_("RID_SVXSTR_RECOVERYONLY_FINISH", "~Finish")
+#define RID_SVXSTR_WIDTH_LAST_CUSTOM NC_("RID_SVXSTR_WIDTH_LAST_CUSTOM", "Last Custom Value")
+#define RID_SVXSTR_PT NC_("RID_SVXSTR_PT", "pt")
+
+#define RID_SVXSTR_EXPORT_GRAPHIC_TITLE NC_("RID_SVXSTR_EXPORT_GRAPHIC_TITLE", "Image Export")
+#define RID_SVXSTR_SAVEAS_IMAGE NC_("RID_SVXSTR_SAVEAS_IMAGE", "Save as Image")
+
+// Strings for the Draw Dialog --------------------------------------------
+#define RID_SVX_3D_UNDO_EXCHANGE_PASTE NC_("RID_SVX_3D_UNDO_EXCHANGE_PASTE", "Insert object(s)")
+#define RID_SVX_3D_UNDO_ROTATE NC_("RID_SVX_3D_UNDO_ROTATE", "Rotate 3D object")
+#define RID_SVX_3D_UNDO_EXTRUDE NC_("RID_SVX_3D_UNDO_EXTRUDE", "Create extrusion object")
+#define RID_SVX_3D_UNDO_LATHE NC_("RID_SVX_3D_UNDO_LATHE", "Create rotation object")
+#define RID_SVX_3D_UNDO_BREAK_LATHE NC_("RID_SVX_3D_UNDO_BREAK_LATHE", "Split 3D object")
+
+// Language-Strings ------------------------------------------------------
+#define RID_SVXSTR_LANGUAGE_ALL NC_("RID_SVXSTR_LANGUAGE_ALL", "[All]")
+
+#define RID_SVXSTR_GALLERY_FILTER NC_("RID_SVXSTR_GALLERY_FILTER", "Graphics filter")
+#define RID_SVXSTR_GALLERY_NEWTHEME NC_("RID_SVXSTR_GALLERY_NEWTHEME", "New Theme")
+
+#define RID_GALLERYSTR_THEME_3D NC_("RID_GALLERYSTR_THEME_3D", "3D Effects")
+#define RID_GALLERYSTR_THEME_ANIMATIONS NC_("RID_GALLERYSTR_THEME_ANIMATIONS", "Animations")
+#define RID_GALLERYSTR_THEME_BULLETS NC_("RID_GALLERYSTR_THEME_BULLETS", "Bullets")
+#define RID_GALLERYSTR_THEME_OFFICE NC_("RID_GALLERYSTR_THEME_OFFICE", "Office")
+#define RID_GALLERYSTR_THEME_FLAGS NC_("RID_GALLERYSTR_THEME_FLAGS", "Flags")
+#define RID_GALLERYSTR_THEME_FLOWCHARTS NC_("RID_GALLERYSTR_THEME_FLOWCHARTS", "Flow Charts")
+#define RID_GALLERYSTR_THEME_EMOTICONS NC_("RID_GALLERYSTR_THEME_EMOTICONS", "Emoticons")
+#define RID_GALLERYSTR_THEME_PHOTOS NC_("RID_GALLERYSTR_THEME_PHOTOS", "Images")
+#define RID_GALLERYSTR_THEME_BACKGROUNDS NC_("RID_GALLERYSTR_THEME_BACKGROUNDS", "Backgrounds")
+#define RID_GALLERYSTR_THEME_HOMEPAGE NC_("RID_GALLERYSTR_THEME_HOMEPAGE", "Homepage")
+#define RID_GALLERYSTR_THEME_INTERACTION NC_("RID_GALLERYSTR_THEME_INTERACTION", "Interaction")
+#define RID_GALLERYSTR_THEME_MAPS NC_("RID_GALLERYSTR_THEME_MAPS", "Maps")
+#define RID_GALLERYSTR_THEME_PEOPLE NC_("RID_GALLERYSTR_THEME_PEOPLE", "People")
+#define RID_GALLERYSTR_THEME_SURFACES NC_("RID_GALLERYSTR_THEME_SURFACES", "Surfaces")
+#define RID_GALLERYSTR_THEME_COMPUTERS NC_("RID_GALLERYSTR_THEME_COMPUTERS", "Computers")
+#define RID_GALLERYSTR_THEME_DIAGRAMS NC_("RID_GALLERYSTR_THEME_DIAGRAMS", "Diagrams")
+#define RID_GALLERYSTR_THEME_ENVIRONMENT NC_("RID_GALLERYSTR_THEME_ENVIRONMENT", "Environment")
+#define RID_GALLERYSTR_THEME_FINANCE NC_("RID_GALLERYSTR_THEME_FINANCE", "Finance")
+#define RID_GALLERYSTR_THEME_TRANSPORT NC_("RID_GALLERYSTR_THEME_TRANSPORT", "Transport")
+#define RID_GALLERYSTR_THEME_TXTSHAPES NC_("RID_GALLERYSTR_THEME_TXTSHAPES", "Textshapes")
+#define RID_GALLERYSTR_THEME_SOUNDS NC_("RID_GALLERYSTR_THEME_SOUNDS", "Sounds")
+#define RID_GALLERYSTR_THEME_SYMBOLS NC_("RID_GALLERYSTR_THEME_SYMBOLS", "Symbols")
+#define RID_GALLERYSTR_THEME_MYTHEME NC_("RID_GALLERYSTR_THEME_MYTHEME", "My Theme")
+#define RID_GALLERYSTR_THEME_ARROWS NC_("RID_GALLERYSTR_THEME_ARROWS", "Arrows")
+#define RID_GALLERYSTR_THEME_BALLOONS NC_("RID_GALLERYSTR_THEME_BALLOONS", "Balloons")
+#define RID_GALLERYSTR_THEME_KEYBOARD NC_("RID_GALLERYSTR_THEME_KEYBOARD", "Keyboard")
+#define RID_GALLERYSTR_THEME_TIME NC_("RID_GALLERYSTR_THEME_TIME", "Time")
+#define RID_GALLERYSTR_THEME_PRESENTATION NC_("RID_GALLERYSTR_THEME_PRESENTATION", "Presentation")
+#define RID_GALLERYSTR_THEME_CALENDAR NC_("RID_GALLERYSTR_THEME_CALENDAR", "Calendar")
+#define RID_GALLERYSTR_THEME_NAVIGATION NC_("RID_GALLERYSTR_THEME_NAVIGATION", "Navigation")
+#define RID_GALLERYSTR_THEME_COMMUNICATION NC_("RID_GALLERYSTR_THEME_COMMUNICATION", "Communication")
+#define RID_GALLERYSTR_THEME_FINANCES NC_("RID_GALLERYSTR_THEME_FINANCES", "Finances")
+#define RID_GALLERYSTR_THEME_COMPUTER NC_("RID_GALLERYSTR_THEME_COMPUTER", "Computers")
+#define RID_GALLERYSTR_THEME_CLIMA NC_("RID_GALLERYSTR_THEME_CLIMA", "Climate")
+#define RID_GALLERYSTR_THEME_EDUCATION NC_("RID_GALLERYSTR_THEME_EDUCATION", "School & University")
+#define RID_GALLERYSTR_THEME_TROUBLE NC_("RID_GALLERYSTR_THEME_TROUBLE", "Problem Solving")
+#define RID_GALLERYSTR_THEME_SCREENBEANS NC_("RID_GALLERYSTR_THEME_SCREENBEANS", "Screen Beans")
+
+#define RID_SVXSTR_QRY_PRINT_TITLE NC_("RID_SVXSTR_QRY_PRINT_TITLE", "Printing selection")
+#define RID_SVXSTR_QRY_PRINT_MSG NC_("RID_SVXSTR_QRY_PRINT_MSG", "Do you want to print the selection or the entire document?")
+#define RID_SVXSTR_QRY_PRINT_ALL NC_("RID_SVXSTR_QRY_PRINT_ALL", "~All")
+#define RID_SVXSTR_QRY_PRINT_SELECTION NC_("RID_SVXSTR_QRY_PRINT_SELECTION", "~Selection")
+
+#define RID_SVXSTR_DIRECTION_NW NC_("RID_SVXSTR_DIRECTION_NW", "Extrusion North-West")
+#define RID_SVXSTR_DIRECTION_N NC_("RID_SVXSTR_DIRECTION_N", "Extrusion North")
+#define RID_SVXSTR_DIRECTION_NE NC_("RID_SVXSTR_DIRECTION_NE", "Extrusion North-East")
+#define RID_SVXSTR_DIRECTION_W NC_("RID_SVXSTR_DIRECTION_W", "Extrusion West")
+#define RID_SVXSTR_DIRECTION_NONE NC_("RID_SVXSTR_DIRECTION_NONE", "Extrusion Backwards")
+#define RID_SVXSTR_DIRECTION_E NC_("RID_SVXSTR_DIRECTION_E", "Extrusion East")
+#define RID_SVXSTR_DIRECTION_SW NC_("RID_SVXSTR_DIRECTION_SW", "Extrusion South-West")
+#define RID_SVXSTR_DIRECTION_S NC_("RID_SVXSTR_DIRECTION_S", "Extrusion South")
+#define RID_SVXSTR_DIRECTION_SE NC_("RID_SVXSTR_DIRECTION_SE", "Extrusion South-East")
+#define RID_SVXSTR_DEPTH_0 NC_("RID_SVXSTR_DEPTH_0", "~0 cm")
+#define RID_SVXSTR_DEPTH_1 NC_("RID_SVXSTR_DEPTH_1", "~1 cm")
+#define RID_SVXSTR_DEPTH_2 NC_("RID_SVXSTR_DEPTH_2", "~2.5 cm")
+#define RID_SVXSTR_DEPTH_3 NC_("RID_SVXSTR_DEPTH_3", "~5 cm")
+#define RID_SVXSTR_DEPTH_4 NC_("RID_SVXSTR_DEPTH_4", "10 ~cm")
+#define RID_SVXSTR_DEPTH_0_INCH NC_("RID_SVXSTR_DEPTH_0_INCH", "0 inch")
+#define RID_SVXSTR_DEPTH_1_INCH NC_("RID_SVXSTR_DEPTH_1_INCH", "0.~5 inch")
+#define RID_SVXSTR_DEPTH_2_INCH NC_("RID_SVXSTR_DEPTH_2_INCH", "~1 inch")
+#define RID_SVXSTR_DEPTH_3_INCH NC_("RID_SVXSTR_DEPTH_3_INCH", "~2 inch")
+#define RID_SVXSTR_DEPTH_4_INCH NC_("RID_SVXSTR_DEPTH_4_INCH", "~4 inch")
+
+#define RID_SVXSTR_NOFILL NC_("RID_SVXSTR_NOFILL", "No Fill")
+#define RID_SVXSTR_TRANSPARENT NC_("RID_SVXSTR_TRANSPARENT", "Transparent")
+#define RID_SVXSTR_DEFAULT NC_("RID_SVXSTR_DEFAULT", "Default")
+#define RID_SVXSTR_FRAME NC_("RID_SVXSTR_FRAME", "Borders")
+#define RID_SVXSTR_FRAME_STYLE NC_("RID_SVXSTR_FRAME_STYLE", "Border Style")
+#define RID_SVXSTR_MORENUMBERING NC_("RID_SVXSTR_MORENUMBERING", "More Numbering...")
+#define RID_SVXSTR_MOREBULLETS NC_("RID_SVXSTR_MOREBULLETS", "More Bullets...")
+#define RID_SVXSTR_BY_AUTHOR NC_("RID_SVXSTR_BY_AUTHOR", "By author")
+#define RID_SVXSTR_PAGES NC_("RID_SVXSTR_PAGES", "Pages")
+#define RID_SVXSTR_CLEARFORM NC_("RID_SVXSTR_CLEARFORM", "Clear formatting")
+#define RID_SVXSTR_MORE_STYLES NC_("RID_SVXSTR_MORE_STYLES", "More Styles...")
+#define RID_SVXSTR_MORE NC_("RID_SVXSTR_MORE", "More Options...")
+// This is duplicated in GenericCommands.xcu in officecfg.
+#define RID_SVXSTR_CHARFONTNAME NC_("RID_SVXSTR_CHARFONTNAME", "Font Name")
+#define RID_SVXSTR_CHARFONTNAME_NOTAVAILABLE NC_("RID_SVXSTR_CHARFONTNAME_NOTAVAILABLE", "Font Name. The current font is not available and will be substituted.")
+#define RID_SVXSTR_CUSTOM_PAL NC_("RID_SVXSTR_CUSTOM_PAL", "custom")
+#define RID_SVXSTR_DOC_COLORS NC_("RID_SVXSTR_DOC_COLORS", "Document colors")
+#define RID_SVXSTR_THEME_COLORS NC_("RID_SVXSTR_THEME_COLORS", "Theme colors")
+#define RID_SVXSTR_DOC_COLOR_PREFIX NC_("RID_SVXSTR_DOC_COLOR_PREFIX", "Document Color")
+#define RID_SVXSTR_THEME_COLOR1 NC_("RID_SVXSTR_THEME_COLOR1", "Background - Dark 1")
+#define RID_SVXSTR_THEME_COLOR2 NC_("RID_SVXSTR_THEME_COLOR2", "Text - Light 1")
+#define RID_SVXSTR_THEME_COLOR3 NC_("RID_SVXSTR_THEME_COLOR3", "Background - Dark 2")
+#define RID_SVXSTR_THEME_COLOR4 NC_("RID_SVXSTR_THEME_COLOR4", "Text - Light 2")
+#define RID_SVXSTR_THEME_COLOR5 NC_("RID_SVXSTR_THEME_COLOR5", "Accent 1")
+#define RID_SVXSTR_THEME_COLOR6 NC_("RID_SVXSTR_THEME_COLOR6", "Accent 2")
+#define RID_SVXSTR_THEME_COLOR7 NC_("RID_SVXSTR_THEME_COLOR7", "Accent 3")
+#define RID_SVXSTR_THEME_COLOR8 NC_("RID_SVXSTR_THEME_COLOR8", "Accent 4")
+#define RID_SVXSTR_THEME_COLOR9 NC_("RID_SVXSTR_THEME_COLOR9", "Accent 5")
+#define RID_SVXSTR_THEME_COLOR10 NC_("RID_SVXSTR_THEME_COLOR10", "Accent 6")
+#define RID_SVXSTR_THEME_COLOR11 NC_("RID_SVXSTR_THEME_COLOR11", "Hyperlink")
+#define RID_SVXSTR_THEME_COLOR12 NC_("RID_SVXSTR_THEME_COLOR12", "Followed Hyperlink")
+#define RID_SVXSTR_THEME_EFFECT1 NC_("RID_SVXSTR_THEME_EFFECT1", "%1, 80% Lighter")
+#define RID_SVXSTR_THEME_EFFECT2 NC_("RID_SVXSTR_THEME_EFFECT2", "%1, 60% Lighter")
+#define RID_SVXSTR_THEME_EFFECT3 NC_("RID_SVXSTR_THEME_EFFECT3", "%1, 40% Lighter")
+#define RID_SVXSTR_THEME_EFFECT4 NC_("RID_SVXSTR_THEME_EFFECT4", "%1, 25% Darker")
+#define RID_SVXSTR_THEME_EFFECT5 NC_("RID_SVXSTR_THEME_EFFECT5", "%1, 50% Darker")
+
+#define RID_SVX_EXTRUSION_BAR NC_("RID_SVX_EXTRUSION_BAR", "Extrusion")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF", "Apply Extrusion On/Off")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_DOWN NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_DOWN", "Tilt Down")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_UP NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_UP", "Tilt Up")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_LEFT NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_LEFT", "Tilt Left")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_RIGHT NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_RIGHT", "Tilt Right")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_DEPTH NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_DEPTH", "Change Extrusion Depth")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ORIENTATION NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_ORIENTATION", "Change Orientation")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_PROJECTION NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_PROJECTION", "Change Projection Type")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_LIGHTING NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_LIGHTING", "Change Lighting")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_BRIGHTNESS NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_BRIGHTNESS", "Change Brightness")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_SURFACE NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_SURFACE", "Change Extrusion Surface")
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_COLOR NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_COLOR", "Change Extrusion Color")
+
+#define RID_SVXFLOAT3D_FIX_R NC_("RID_SVXFLOAT3D_FIX_R", "R:")
+#define RID_SVXFLOAT3D_FIX_G NC_("RID_SVXFLOAT3D_FIX_G", "G:")
+#define RID_SVXFLOAT3D_FIX_B NC_("RID_SVXFLOAT3D_FIX_B", "B:")
+
+#define RID_SVX_FONTWORK_BAR NC_("RID_SVX_FONTWORK_BAR", "Fontwork")
+#define RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE NC_("RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE", "Apply Fontwork Shape")
+#define RID_SVXSTR_UNDO_APPLY_FONTWORK_SAME_LETTER_HEIGHT NC_("RID_SVXSTR_UNDO_APPLY_FONTWORK_SAME_LETTER_HEIGHT", "Apply Fontwork Same Letter Heights")
+#define RID_SVXSTR_UNDO_APPLY_FONTWORK_ALIGNMENT NC_("RID_SVXSTR_UNDO_APPLY_FONTWORK_ALIGNMENT", "Apply Fontwork Alignment")
+#define RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING NC_("RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING", "Apply Fontwork Character Spacing")
+
+#define RID_SVXSTR_A11Y_WITH NC_("RID_SVXSTR_A11Y_WITH", "with")
+#define RID_SVXSTR_A11Y_STYLE NC_("RID_SVXSTR_A11Y_STYLE", "Style")
+#define RID_SVXSTR_A11Y_AND NC_("RID_SVXSTR_A11Y_AND", "and")
+// SvxRectCtl
+#define RID_SVXSTR_RECTCTL_ACC_CORN_NAME NC_("RID_SVXSTR_RECTCTL_ACC_CORN_NAME", "Corner control")
+#define RID_SVXSTR_RECTCTL_ACC_CORN_DESCR NC_("RID_SVXSTR_RECTCTL_ACC_CORN_DESCR", "Selection of a corner point.")
+#define RID_SVXSTR_RECTCTL_ACC_CHLD_LT NC_("RID_SVXSTR_RECTCTL_ACC_CHLD_LT", "Top left")
+#define RID_SVXSTR_RECTCTL_ACC_CHLD_MT NC_("RID_SVXSTR_RECTCTL_ACC_CHLD_MT", "Top middle")
+#define RID_SVXSTR_RECTCTL_ACC_CHLD_RT NC_("RID_SVXSTR_RECTCTL_ACC_CHLD_RT", "Top right")
+#define RID_SVXSTR_RECTCTL_ACC_CHLD_LM NC_("RID_SVXSTR_RECTCTL_ACC_CHLD_LM", "Left center")
+#define RID_SVXSTR_RECTCTL_ACC_CHLD_MM NC_("RID_SVXSTR_RECTCTL_ACC_CHLD_MM", "Center")
+#define RID_SVXSTR_RECTCTL_ACC_CHLD_RM NC_("RID_SVXSTR_RECTCTL_ACC_CHLD_RM", "Right center")
+#define RID_SVXSTR_RECTCTL_ACC_CHLD_LB NC_("RID_SVXSTR_RECTCTL_ACC_CHLD_LB", "Bottom left")
+#define RID_SVXSTR_RECTCTL_ACC_CHLD_MB NC_("RID_SVXSTR_RECTCTL_ACC_CHLD_MB", "Bottom middle")
+#define RID_SVXSTR_RECTCTL_ACC_CHLD_RB NC_("RID_SVXSTR_RECTCTL_ACC_CHLD_RB", "Bottom right")
+// SvxGraphCtrlAccessibleContext
+#define RID_SVXSTR_GRAPHCTRL_ACC_NAME NC_("RID_SVXSTR_GRAPHCTRL_ACC_NAME", "Contour control")
+#define RID_SVXSTR_GRAPHCTRL_ACC_DESCRIPTION NC_("RID_SVXSTR_GRAPHCTRL_ACC_DESCRIPTION", "This is where you can edit the contour.")
+#define RID_SVXSTR_CHARACTER_SELECTION NC_("RID_SVXSTR_CHARACTER_SELECTION", "Special character selection")
+#define RID_SVXSTR_CHAR_SEL_DESC NC_("RID_SVXSTR_CHAR_SEL_DESC", "Select special characters in this area.")
+// The space behind is a must.
+#define RID_SVXSTR_CHARACTER_CODE NC_("RID_SVXSTR_CHARACTER_CODE", "Character code ")
+
+#define RID_ERR_FIELDREQUIRED NC_("RID_ERR_FIELDREQUIRED", "Input required in field '#'. Please enter a value.")
+#define RID_STR_FORMS NC_("RID_STR_FORMS", "Forms")
+#define RID_STR_NO_PROPERTIES NC_("RID_STR_NO_PROPERTIES", "No control selected")
+#define RID_STR_PROPERTIES_CONTROL NC_("RID_STR_PROPERTIES_CONTROL", "Properties: ")
+#define RID_STR_PROPERTIES_FORM NC_("RID_STR_PROPERTIES_FORM", "Form Properties")
+#define RID_STR_FMEXPLORER NC_("RID_STR_FMEXPLORER", "Form Navigator")
+#define RID_STR_FORM NC_("RID_STR_FORM", "Form")
+#define RID_STR_HIDDEN NC_("RID_STR_HIDDEN", "Hidden")
+#define RID_STR_STDFORMNAME NC_("RID_STR_STDFORMNAME", "Form")
+#define RID_STR_PROPTITLE_HIDDEN NC_("RID_STR_PROPTITLE_HIDDEN", "Hidden Control")
+#define RID_STR_CONTROL NC_("RID_STR_CONTROL", "Control")
+#define RID_STR_REC_TEXT NC_("RID_STR_REC_TEXT", "Record")
+#define RID_STR_REC_FROM_TEXT NC_("RID_STR_REC_FROM_TEXT", "of")
+#define RID_STR_FIELDSELECTION NC_("RID_STR_FIELDSELECTION", "Add field:")
+#define RID_STR_WRITEERROR NC_("RID_STR_WRITEERROR", "Error writing data to database")
+#define RID_STR_SYNTAXERROR NC_("RID_STR_SYNTAXERROR", "Syntax error in query expression")
+#define RID_STR_DELETECONFIRM_RECORD NC_("RID_STR_DELETECONFIRM_RECORD", "You intend to delete 1 record.")
+#define RID_STR_DELETECONFIRM_RECORDS NC_("RID_STR_DELETECONFIRM_RECORDS", "# records will be deleted.")
+#define RID_STR_DELETECONFIRM NC_("RID_STR_DELETECONFIRM", "If you click Yes, you won't be able to undo this operation.\nDo you want to continue anyway?")
+#define RID_STR_NAVIGATIONBAR NC_("RID_STR_NAVIGATIONBAR", "Navigation bar")
+#define RID_STR_COLUMN NC_("RID_STR_COLUMN", "Col")
+#define RID_STR_UNDO_PROPERTY NC_("RID_STR_UNDO_PROPERTY", "Set property '#'")
+#define RID_STR_UNDO_CONTAINER_INSERT NC_("RID_STR_UNDO_CONTAINER_INSERT", "Insert in container")
+#define RID_STR_UNDO_CONTAINER_REMOVE NC_("RID_STR_UNDO_CONTAINER_REMOVE", "Delete #")
+#define RID_STR_UNDO_CONTAINER_REMOVE_MULTIPLE NC_("RID_STR_UNDO_CONTAINER_REMOVE_MULTIPLE", "Delete # objects")
+#define RID_STR_UNDO_CONTAINER_REPLACE NC_("RID_STR_UNDO_CONTAINER_REPLACE", "Replace a container element")
+#define RID_STR_UNDO_MODEL_REPLACE NC_("RID_STR_UNDO_MODEL_REPLACE", "Replace Control")
+
+#define RID_STR_PROPTITLE_EDIT NC_("RID_STR_PROPTITLE_EDIT", "Text Box")
+#define RID_STR_PROPTITLE_CHECKBOX NC_("RID_STR_PROPTITLE_CHECKBOX", "Check Box")
+#define RID_STR_PROPTITLE_COMBOBOX NC_("RID_STR_PROPTITLE_COMBOBOX", "Combo Box")
+#define RID_STR_PROPTITLE_LISTBOX NC_("RID_STR_PROPTITLE_LISTBOX", "List Box")
+#define RID_STR_PROPTITLE_DATEFIELD NC_("RID_STR_PROPTITLE_DATEFIELD", "Date Field")
+#define RID_STR_PROPTITLE_TIMEFIELD NC_("RID_STR_PROPTITLE_TIMEFIELD", "Time Field")
+#define RID_STR_PROPTITLE_NUMERICFIELD NC_("RID_STR_PROPTITLE_NUMERICFIELD", "Numeric Field")
+#define RID_STR_PROPTITLE_CURRENCYFIELD NC_("RID_STR_PROPTITLE_CURRENCYFIELD", "Currency Field")
+#define RID_STR_PROPTITLE_PATTERNFIELD NC_("RID_STR_PROPTITLE_PATTERNFIELD", "Pattern Field")
+#define RID_STR_PROPTITLE_FORMATTED NC_("RID_STR_PROPTITLE_FORMATTED", "Formatted Field")
+
+#define RID_STR_PROPTITLE_PUSHBUTTON NC_("RID_STR_PROPTITLE_PUSHBUTTON", "Push Button")
+#define RID_STR_PROPTITLE_RADIOBUTTON NC_("RID_STR_PROPTITLE_RADIOBUTTON", "Option Button")
+#define RID_STR_PROPTITLE_FIXEDTEXT NC_("RID_STR_PROPTITLE_FIXEDTEXT", "Label Field")
+#define RID_STR_PROPTITLE_GROUPBOX NC_("RID_STR_PROPTITLE_GROUPBOX", "Group Box")
+#define RID_STR_PROPTITLE_IMAGEBUTTON NC_("RID_STR_PROPTITLE_IMAGEBUTTON", "Image Button")
+#define RID_STR_PROPTITLE_IMAGECONTROL NC_("RID_STR_PROPTITLE_IMAGECONTROL", "Image Control")
+#define RID_STR_PROPTITLE_FILECONTROL NC_("RID_STR_PROPTITLE_FILECONTROL", "File Selection")
+#define RID_STR_PROPTITLE_DBGRID NC_("RID_STR_PROPTITLE_DBGRID", "Table Control ")
+#define RID_STR_PROPTITLE_SCROLLBAR NC_("RID_STR_PROPTITLE_SCROLLBAR", "Scrollbar")
+#define RID_STR_PROPTITLE_SPINBUTTON NC_("RID_STR_PROPTITLE_SPINBUTTON", "Spin Button")
+#define RID_STR_PROPTITLE_NAVBAR NC_("RID_STR_PROPTITLE_NAVBAR", "Navigation Bar")
+#define RID_STR_PROPTITLE_MULTISELECT NC_("RID_STR_PROPTITLE_MULTISELECT", "Multiselection")
+
+#define RID_STR_DATE_AND_TIME NC_("RID_STR_DATE_AND_TIME", "Date and Time Field")
+
+#define RID_STR_NODATACONTROLS NC_("RID_STR_NODATACONTROLS", "No data-related controls in the current form!")
+#define RID_STR_POSTFIX_DATE NC_("RID_STR_POSTFIX_DATE", " (Date)")
+#define RID_STR_POSTFIX_TIME NC_("RID_STR_POSTFIX_TIME", " (Time)")
+#define RID_STR_FILTER_NAVIGATOR NC_("RID_STR_FILTER_NAVIGATOR", "Filter navigator")
+#define RID_STR_FILTER_FILTER_FOR NC_("RID_STR_FILTER_FILTER_FOR", "Filter for")
+#define RID_STR_FILTER_FILTER_OR NC_("RID_STR_FILTER_FILTER_OR", "Or")
+#define RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY NC_("RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY", "Valid bound controls which can be used in the table view do not exist in the current form.")
+#define RID_STR_AUTOFIELD NC_("RID_STR_AUTOFIELD", "<AutoField>")
+#define RID_STR_SVT_SQL_SYNTAX_ERROR NC_("RID_STR_SVT_SQL_SYNTAX_ERROR", "Syntax error in SQL statement")
+#define RID_STR_SVT_SQL_SYNTAX_VALUE_NO_LIKE NC_("RID_STR_SVT_SQL_SYNTAX_VALUE_NO_LIKE", "The value #1 cannot be used with LIKE.")
+#define RID_STR_SVT_SQL_SYNTAX_FIELD_NO_LIKE NC_("RID_STR_SVT_SQL_SYNTAX_FIELD_NO_LIKE", "LIKE cannot be used with this field.")
+#define RID_STR_SVT_SQL_SYNTAX_ACCESS_DAT_NO_VALID NC_("RID_STR_SVT_SQL_SYNTAX_ACCESS_DAT_NO_VALID", "The value entered is not a valid date. Please enter a date in a valid format, for example, MM/DD/YY.")
+#define RID_STR_SVT_SQL_SYNTAX_INT_NO_VALID NC_("RID_STR_SVT_SQL_SYNTAX_INT_NO_VALID", "The field cannot be compared with an integer.")
+#define RID_STR_SVT_SQL_SYNTAX_TABLE NC_("RID_STR_SVT_SQL_SYNTAX_TABLE", "The database does not contain a table named \"#\".")
+#define RID_STR_SVT_SQL_SYNTAX_TABLE_OR_QUERY NC_("RID_STR_SVT_SQL_SYNTAX_TABLE_OR_QUERY", "The database does contain neither a table nor a query named \"#\".")
+#define RID_STR_SVT_SQL_SYNTAX_TABLE_EXISTS NC_("RID_STR_SVT_SQL_SYNTAX_TABLE_EXISTS", "The database already contains a table or view with name \"#\".")
+#define RID_STR_SVT_SQL_SYNTAX_QUERY_EXISTS NC_("RID_STR_SVT_SQL_SYNTAX_QUERY_EXISTS", "The database already contains a query with name \"#\".")
+#define RID_STR_SVT_SQL_SYNTAX_COLUMN NC_("RID_STR_SVT_SQL_SYNTAX_COLUMN", "The column \"#1\" is unknown in the table \"#2\".")
+#define RID_STR_SVT_SQL_SYNTAX_REAL_NO_VALID NC_("RID_STR_SVT_SQL_SYNTAX_REAL_NO_VALID", "The field cannot be compared with a floating point number.")
+#define RID_STR_SVT_SQL_SYNTAX_CRIT_NO_COMPARE NC_("RID_STR_SVT_SQL_SYNTAX_CRIT_NO_COMPARE", "The entered criterion cannot be compared with this field.")
+#define RID_STR_DATANAVIGATOR NC_("RID_STR_DATANAVIGATOR", "Data Navigator")
+#define RID_STR_READONLY_VIEW NC_("RID_STR_READONLY_VIEW", " (read-only)")
+#define RID_STR_ALREADYEXISTOVERWRITE NC_("RID_STR_ALREADYEXISTOVERWRITE", "The file already exists. Overwrite?")
+#define RID_STR_OBJECT_LABEL NC_("RID_STR_OBJECT_LABEL", "#object# label")
+
+#define RID_STR_QRY_REMOVE_MODEL NC_("RID_STR_QRY_REMOVE_MODEL", "Deleting the model '$MODELNAME' affects all controls currently bound to this model.\nDo you really want to delete this model?")
+#define RID_STR_QRY_REMOVE_INSTANCE NC_("RID_STR_QRY_REMOVE_INSTANCE", "Deleting the instance '$INSTANCENAME' affects all controls currently bound to this instance.\nDo you really want to delete this instance?")
+#define RID_STR_QRY_REMOVE_ELEMENT NC_("RID_STR_QRY_REMOVE_ELEMENT", "Deleting the element '$ELEMENTNAME' affects all controls currently bound to this element.\nDo you really want to delete this element?")
+#define RID_STR_QRY_REMOVE_ATTRIBUTE NC_("RID_STR_QRY_REMOVE_ATTRIBUTE", "Do you really want to delete the attribute '$ATTRIBUTENAME'?")
+#define RID_STR_QRY_REMOVE_SUBMISSION NC_("RID_STR_QRY_REMOVE_SUBMISSION", "Deleting the submission '$SUBMISSIONNAME' affects all controls currently bound to this submission.\n\nDo you really want to delete this submission?")
+#define RID_STR_QRY_REMOVE_BINDING NC_("RID_STR_QRY_REMOVE_BINDING", "Deleting the binding '$BINDINGNAME' affects all controls currently bound to this binding.\n\nDo you really want to delete this binding?")
+#define RID_STR_INVALID_XMLNAME NC_("RID_STR_INVALID_XMLNAME", "The name '%1' is not valid in XML. Please enter a different name.")
+#define RID_STR_INVALID_XMLPREFIX NC_("RID_STR_INVALID_XMLPREFIX", "The prefix '%1' is not valid in XML. Please enter a different prefix.")
+#define RID_STR_DOUBLE_MODELNAME NC_("RID_STR_DOUBLE_MODELNAME", "The name '%1' already exists. Please enter a new name.")
+#define RID_STR_EMPTY_SUBMISSIONNAME NC_("RID_STR_EMPTY_SUBMISSIONNAME", "The submission must have a name.")
+#define RID_STR_METHOD_POST NC_("RID_STR_METHOD_POST", "Post")
+#define RID_STR_METHOD_PUT NC_("RID_STR_METHOD_PUT", "Put")
+#define RID_STR_METHOD_GET NC_("RID_STR_METHOD_GET", "Get")
+#define RID_STR_REPLACE_NONE NC_("RID_STR_REPLACE_NONE", "None")
+#define RID_STR_REPLACE_INST NC_("RID_STR_REPLACE_INST", "Instance")
+#define RID_STR_REPLACE_DOC NC_("RID_STR_REPLACE_DOC", "Document")
+#define RID_STR_DATANAV_SUBM_BIND NC_("RID_STR_DATANAV_SUBM_BIND", "Binding: ")
+#define RID_STR_DATANAV_SUBM_REF NC_("RID_STR_DATANAV_SUBM_REF", "Reference: ")
+#define RID_STR_DATANAV_SUBM_ACTION NC_("RID_STR_DATANAV_SUBM_ACTION", "Action: ")
+#define RID_STR_DATANAV_SUBM_METHOD NC_("RID_STR_DATANAV_SUBM_METHOD", "Method: ")
+#define RID_STR_DATANAV_SUBM_REPLACE NC_("RID_STR_DATANAV_SUBM_REPLACE", "Replace: ")
+#define RID_STR_DATANAV_ADD_ELEMENT NC_("RID_STR_DATANAV_ADD_ELEMENT", "Add Element")
+#define RID_STR_DATANAV_EDIT_ELEMENT NC_("RID_STR_DATANAV_EDIT_ELEMENT", "Edit Element")
+#define RID_STR_DATANAV_REMOVE_ELEMENT NC_("RID_STR_DATANAV_REMOVE_ELEMENT", "Delete Element")
+#define RID_STR_DATANAV_ADD_ATTRIBUTE NC_("RID_STR_DATANAV_ADD_ATTRIBUTE", "Add Attribute")
+#define RID_STR_DATANAV_EDIT_ATTRIBUTE NC_("RID_STR_DATANAV_EDIT_ATTRIBUTE", "Edit Attribute")
+#define RID_STR_DATANAV_REMOVE_ATTRIBUTE NC_("RID_STR_DATANAV_REMOVE_ATTRIBUTE", "Delete Attribute")
+#define RID_STR_DATANAV_ADD_BINDING NC_("RID_STR_DATANAV_ADD_BINDING", "Add Binding")
+#define RID_STR_DATANAV_EDIT_BINDING NC_("RID_STR_DATANAV_EDIT_BINDING", "Edit Binding")
+#define RID_STR_DATANAV_REMOVE_BINDING NC_("RID_STR_DATANAV_REMOVE_BINDING", "Delete Binding")
+#define RID_STR_DATANAV_ADD_SUBMISSION NC_("RID_STR_DATANAV_ADD_SUBMISSION", "Add Submission")
+#define RID_STR_DATANAV_EDIT_SUBMISSION NC_("RID_STR_DATANAV_EDIT_SUBMISSION", "Edit Submission")
+#define RID_STR_DATANAV_REMOVE_SUBMISSION NC_("RID_STR_DATANAV_REMOVE_SUBMISSION", "Delete Submission")
+#define RID_STR_ELEMENT NC_("RID_STR_ELEMENT", "Element")
+#define RID_STR_ATTRIBUTE NC_("RID_STR_ATTRIBUTE", "Attribute")
+#define RID_STR_BINDING NC_("RID_STR_BINDING", "Binding")
+#define RID_STR_BINDING_EXPR NC_("RID_STR_BINDING_EXPR", "Binding expression")
+
+#define RID_SVXSTR_QUERY_EXIT_RECOVERY NC_("RID_SVXSTR_QUERY_EXIT_RECOVERY", "Are you sure you want to discard the %PRODUCTNAME document recovery data?")
+
+#define RID_SVXSTR_RULER_TAB_LEFT NC_("RID_SVXSTR_RULER_TAB_LEFT", "Left")
+#define RID_SVXSTR_RULER_TAB_RIGHT NC_("RID_SVXSTR_RULER_TAB_RIGHT", "Right")
+#define RID_SVXSTR_RULER_TAB_CENTER NC_("RID_SVXSTR_RULER_TAB_CENTER", "Center")
+#define RID_SVXSTR_RULER_TAB_DECIMAL NC_("RID_SVXSTR_RULER_TAB_DECIMAL", "Decimal")
+
+#define RID_SVXSTR_INSERT_HELPTEXT NC_("RID_SVXSTR_INSERT_HELPTEXT", "Insert mode. Click to change to overwrite mode.")
+#define RID_SVXSTR_OVERWRITE_HELPTEXT NC_("RID_SVXSTR_OVERWRITE_HELPTEXT", "Overwrite mode. Click to change to insert mode.")
+// To be shown in the status bar when in overwrite mode, please try to make it not longer than the word 'Overwrite'.
+#define RID_SVXSTR_OVERWRITE_TEXT NC_("RID_SVXSTR_OVERWRITE_TEXT", "Overwrite")
+#define RID_SVXSTR_INSERT_TEXT NC_("RID_SVXSTR_INSERT_TEXT", "Insert")
+#define RID_SVXSTR_SELECTIONMODE_HELPTEXT NC_("RID_SVXSTR_SELECTIONMODE_HELPTEXT", "%1. Click to change selection mode.")
+#define RID_SVXSTR_XMLSEC_SIG_OK NC_("RID_SVXSTR_XMLSEC_SIG_OK", "Digital Signature: The document signature is OK.")
+#define RID_SVXSTR_XMLSEC_SIG_OK_NO_VERIFY NC_("RID_SVXSTR_XMLSEC_SIG_OK_NO_VERIFY", "Digital Signature: The document signature is OK, but the certificates could not be validated.")
+#define RID_SVXSTR_XMLSEC_SIG_NOT_OK NC_("RID_SVXSTR_XMLSEC_SIG_NOT_OK", "Digital Signature: The document signature does not match the document content. We strongly recommend you not to trust this document.")
+#define RID_SVXSTR_XMLSEC_NO_SIG NC_("RID_SVXSTR_XMLSEC_NO_SIG", "Digital Signature: The document is not signed.")
+#define RID_SVXSTR_XMLSEC_SIG_CERT_OK_PARTIAL_SIG NC_("RID_SVXSTR_XMLSEC_SIG_CERT_OK_PARTIAL_SIG", "Digital Signature: The document signature and the certificate are OK, but not all parts of the document are signed.")
+#define RID_SVXSTR_DOC_MODIFIED_YES NC_("RID_SVXSTR_DOC_MODIFIED_YES", "The document has been modified. Click to save the document.")
+#define RID_SVXSTR_DOC_MODIFIED_NO NC_("RID_SVXSTR_DOC_MODIFIED_NO", "The document has not been modified since the last save.")
+#define RID_SVXSTR_DOC_LOAD NC_("RID_SVXSTR_DOC_LOAD", "Loading document...")
+#define RID_SVXSTR_FIT_SLIDE NC_("RID_SVXSTR_FIT_SLIDE", "Fit slide to current window.")
+#define RID_SVXSTR_WARN_MISSING_SMARTART NC_("RID_SVXSTR_WARN_MISSING_SMARTART", "Could not load all SmartArt objects. Saving in Microsoft Office 2010 or later would avoid this issue.")
+#define RID_SVXSTR_ZOOMTOOL_HINT NC_("RID_SVXSTR_ZOOMTOOL_HINT", "Zoom factor. Right-click to change zoom factor or click to open Zoom dialog.")
+#define RID_SVXSTR_ZOOM_IN NC_("RID_SVXSTR_ZOOM_IN", "Zoom In")
+#define RID_SVXSTR_ZOOM_OUT NC_("RID_SVXSTR_ZOOM_OUT", "Zoom Out")
+#define RID_SVXSTR_ZOOM_25 NC_("RID_SVXSTR_ZOOM_25", "25%")
+#define RID_SVXSTR_ZOOM_50 NC_("RID_SVXSTR_ZOOM_50", "50%")
+#define RID_SVXSTR_ZOOM_75 NC_("RID_SVXSTR_ZOOM_75", "75%")
+#define RID_SVXSTR_ZOOM_100 NC_("RID_SVXSTR_ZOOM_100", "100%")
+#define RID_SVXSTR_ZOOM_150 NC_("RID_SVXSTR_ZOOM_150", "150%")
+#define RID_SVXSTR_ZOOM_200 NC_("RID_SVXSTR_ZOOM_200", "200%")
+#define RID_SVXSTR_ZOOM_WHOLE_PAGE NC_("RID_SVXSTR_ZOOM_WHOLE_PAGE", "Entire Page")
+#define RID_SVXSTR_ZOOM_PAGE_WIDTH NC_("RID_SVXSTR_ZOOM_PAGE_WIDTH", "Page Width")
+#define RID_SVXSTR_ZOOM_OPTIMAL_VIEW NC_("RID_SVXSTR_ZOOM_OPTIMAL_VIEW", "Optimal View")
+
+#define RID_SVXSTR_SEARCH_STYLES NC_("RID_SVXSTR_SEARCH_STYLES", "Including Styles")
+#define RID_SVXSTR_WRITER_STYLES NC_("RID_SVXSTR_WRITER_STYLES", "Paragraph St~yles")
+#define RID_SVXSTR_CALC_STYLES NC_("RID_SVXSTR_CALC_STYLES", "Cell St~yles")
+#define RID_SVXSTR_SEARCH NC_("RID_SVXSTR_SEARCH", "Search for formatting")
+#define RID_SVXSTR_REPLACE NC_("RID_SVXSTR_REPLACE", "Replace with formatting")
+#define RID_SVXSTR_SEARCH_END NC_("RID_SVXSTR_SEARCH_END", "Reached the end of the document")
+#define RID_SVXSTR_SEARCH_END_WRAPPED NC_("RID_SVXSTR_SEARCH_END_WRAPPED", "Reached the end of the document, continued from the beginning")
+#define RID_SVXSTR_SEARCH_END_SHEET NC_("RID_SVXSTR_SEARCH_END_SHEET", "Reached the end of the sheet")
+#define RID_SVXSTR_SEARCH_NOT_FOUND NC_("RID_SVXSTR_SEARCH_NOT_FOUND", "Search key not found")
+#define RID_SVXSTR_SEARCH_NAV_ELEMENT_NOT_FOUND NC_("RID_SVXSTR_SEARCH_NAV_ELEMENT_NOT_FOUND", "Navigation Element not found")
+#define RID_SVXSTR_SEARCH_START NC_("RID_SVXSTR_SEARCH_START", "Reached the beginning of the document")
+#define RID_SVXSTR_SEARCH_START_WRAPPED NC_("RID_SVXSTR_SEARCH_START_WRAPPED", "Reached the beginning of the document, continued from the end")
+#define RID_SVXSTR_SEARCH_REMINDER_START_WRAPPED NC_("RID_SVXSTR_SEARCH_REMINDER_START_WRAPPED", "Reached the first reminder, continued from the last")
+#define RID_SVXSTR_SEARCH_REMINDER_END_WRAPPED NC_("RID_SVXSTR_SEARCH_REMINDER_END_WRAPPED", "Reached the last reminder, continued from the first")
+
+#define RID_SVXDLG_BMPMASK_STR_PALETTE NC_("RID_SVXDLG_BMPMASK_STR_PALETTE", "Color Palette")
+#define RID_SVXDLG_BMPMASK_STR_TITLE NC_("RID_SVXDLG_BMPMASK_STR_TITLE", "Color Replacer")
+
+#define RID_SVXDLG_FLOAT3D_STR_TITLE NC_("RID_SVXDLG_FLOAT3D_STR_TITLE", "3D Effects")
+
+#define RID_SVXSTR_ERR_OLD_PASSWD NC_("RID_SVXSTR_ERR_OLD_PASSWD", "Invalid password")
+#define RID_SVXSTR_ERR_REPEAT_PASSWD NC_("RID_SVXSTR_ERR_REPEAT_PASSWD", "Passwords do not match")
+
+#define RID_SVXSTR_BULLET_DESCRIPTION_0 NC_("RID_SVXSTR_BULLET_DESCRIPTION_0", "Solid small circular bullets")
+#define RID_SVXSTR_BULLET_DESCRIPTION_1 NC_("RID_SVXSTR_BULLET_DESCRIPTION_1", "Solid large circular bullets")
+#define RID_SVXSTR_BULLET_DESCRIPTION_2 NC_("RID_SVXSTR_BULLET_DESCRIPTION_2", "Solid diamond bullets")
+#define RID_SVXSTR_BULLET_DESCRIPTION_3 NC_("RID_SVXSTR_BULLET_DESCRIPTION_3", "Solid large square bullets")
+#define RID_SVXSTR_BULLET_DESCRIPTION_4 NC_("RID_SVXSTR_BULLET_DESCRIPTION_4", "Right pointing arrow bullets filled out")
+#define RID_SVXSTR_BULLET_DESCRIPTION_5 NC_("RID_SVXSTR_BULLET_DESCRIPTION_5", "Right pointing arrow bullets")
+#define RID_SVXSTR_BULLET_DESCRIPTION_6 NC_("RID_SVXSTR_BULLET_DESCRIPTION_6", "Cross mark bullets")
+#define RID_SVXSTR_BULLET_DESCRIPTION_7 NC_("RID_SVXSTR_BULLET_DESCRIPTION_7", "Check mark bullets")
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_0 NC_("RID_SVXSTR_SINGLENUM_DESCRIPTION_0", "Number 1) 2) 3)")
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_1 NC_("RID_SVXSTR_SINGLENUM_DESCRIPTION_1", "Number 1. 2. 3.")
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_2 NC_("RID_SVXSTR_SINGLENUM_DESCRIPTION_2", "Number (1) (2) (3)")
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_3 NC_("RID_SVXSTR_SINGLENUM_DESCRIPTION_3", "Uppercase Roman number I. II. III.")
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_4 NC_("RID_SVXSTR_SINGLENUM_DESCRIPTION_4", "Uppercase letter A) B) C)")
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_5 NC_("RID_SVXSTR_SINGLENUM_DESCRIPTION_5", "Lowercase letter a) b) c)")
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_6 NC_("RID_SVXSTR_SINGLENUM_DESCRIPTION_6", "Lowercase letter (a) (b) (c)")
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_7 NC_("RID_SVXSTR_SINGLENUM_DESCRIPTION_7", "Lowercase Roman number i. ii. iii.")
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 NC_("RID_SVXSTR_OUTLINENUM_DESCRIPTION_0", "Numeric, numeric, lowercase letters, solid small circular bullet")
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_1 NC_("RID_SVXSTR_OUTLINENUM_DESCRIPTION_1", "Numeric, lowercase letters, solid small circular bullet")
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_2 NC_("RID_SVXSTR_OUTLINENUM_DESCRIPTION_2", "Numeric, lowercase letters, lowercase Roman, uppercase letters, solid small circular bullet")
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_3 NC_("RID_SVXSTR_OUTLINENUM_DESCRIPTION_3", "Numeric")
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_4 NC_("RID_SVXSTR_OUTLINENUM_DESCRIPTION_4", "Uppercase Roman, uppercase letters, lowercase Roman, lowercase letters, solid small circular bullet")
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_5 NC_("RID_SVXSTR_OUTLINENUM_DESCRIPTION_5", "Uppercase letters, uppercase Roman, lowercase letters, lowercase Roman, solid small circular bullet")
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_6 NC_("RID_SVXSTR_OUTLINENUM_DESCRIPTION_6", "Numeric with all sublevels")
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_7 NC_("RID_SVXSTR_OUTLINENUM_DESCRIPTION_7", "Right pointing bullet, right pointing arrow bullet, solid diamond bullet, solid small circular bullet")
+
+#define RID_SVXSTR_SAFEMODE_ZIP_FAILURE NC_("RID_SVXSTR_SAFEMODE_ZIP_FAILURE", "The zip file could not be created.")
+
+#define RID_SVXSTR_STYLEFAMILY_TABLEDESIGN NC_("RID_SVXSTR_STYLEFAMILY_TABLEDESIGN", "Table Design Styles")
+
+#define RID_SVXSTR_NUM_UNDO_ACTIONS NC_("RID_SVXSTR_NUM_UNDO_ACTIONS", "Actions to undo: $(ARG1)")
+#define RID_SVXSTR_NUM_UNDO_ACTION NC_("RID_SVXSTR_NUM_UNDO_ACTION", "Actions to undo: $(ARG1)")
+#define RID_SVXSTR_NUM_REDO_ACTIONS NC_("RID_SVXSTR_NUM_REDO_ACTIONS", "Actions to redo: $(ARG1)")
+#define RID_SVXSTR_NUM_REDO_ACTION NC_("RID_SVXSTR_NUM_REDO_ACTION", "Actions to redo: $(ARG1)")
+
+#define RID_SVXSTR_FINDBAR_FIND NC_("RID_SVXSTR_FINDBAR_FIND", "Find")
+#define RID_SVXSTR_FINDBAR_MATCHCASE NC_("RID_SVXSTR_FINDBAR_MATCHCASE", "Match Case")
+#define RID_SVXSTR_FINDBAR_SEARCHFORMATTED NC_("RID_SVXSTR_FINDBAR_SEARCHFORMATTED", "Formatted Display")
+
+#define STR_IMAGE_ORIGINAL_SIZE NC_("STR_IMAGE_ORIGINAL_SIZE", "$(WIDTH) × $(HEIGHT) ($(WIDTH_IN_PX) × $(HEIGHT_IN_PX) px)")
+#define STR_IMAGE_VIEW_SIZE NC_("STR_IMAGE_VIEW_SIZE", "$(WIDTH) × $(HEIGHT) at $(DPI) DPI")
+#define STR_IMAGE_CAPACITY NC_("STR_IMAGE_CAPACITY", "$(CAPACITY) KiB")
+#define STR_IMAGE_CAPACITY_WITH_REDUCTION NC_("STR_IMAGE_CAPACITY_WITH_REDUCTION", "$(CAPACITY) KiB ($(REDUCTION)% reduction)")
+#define STR_IMAGE_GIF NC_("STR_IMAGE_GIF", "GIF image")
+#define STR_IMAGE_JPEG NC_("STR_IMAGE_JPEG", "JPEG image")
+#define STR_IMAGE_PNG NC_("STR_IMAGE_PNG", "PNG image")
+#define STR_IMAGE_TIFF NC_("STR_IMAGE_TIFF", "TIFF image")
+#define STR_IMAGE_WMF NC_("STR_IMAGE_WMF", "WMF image")
+#define STR_IMAGE_MET NC_("STR_IMAGE_MET", "MET image")
+#define STR_IMAGE_PCT NC_("STR_IMAGE_PCT", "PCT image")
+#define STR_IMAGE_SVG NC_("STR_IMAGE_SVG", "SVG image")
+#define STR_IMAGE_BMP NC_("STR_IMAGE_BMP", "BMP image")
+#define STR_IMAGE_WEBP NC_("STR_IMAGE_WEBP", "WebP image")
+#define STR_IMAGE_UNKNOWN NC_("STR_IMAGE_UNKNOWN", "Unknown")
+
+#define STR_SWITCH NC_("STR_SWITCH", "Switch")
+
+#define RID_SVXSTR_UNDO_GRAFMODE NC_("RID_SVXSTR_UNDO_GRAFMODE", "Image Mode")
+#define RID_SVXSTR_UNDO_GRAFRED NC_("RID_SVXSTR_UNDO_GRAFRED", "Red")
+#define RID_SVXSTR_UNDO_GRAFGREEN NC_("RID_SVXSTR_UNDO_GRAFGREEN", "Green")
+#define RID_SVXSTR_UNDO_GRAFBLUE NC_("RID_SVXSTR_UNDO_GRAFBLUE", "Blue")
+#define RID_SVXSTR_UNDO_GRAFLUMINANCE NC_("RID_SVXSTR_UNDO_GRAFLUMINANCE", "Brightness")
+#define RID_SVXSTR_UNDO_GRAFCONTRAST NC_("RID_SVXSTR_UNDO_GRAFCONTRAST", "Contrast")
+#define RID_SVXSTR_UNDO_GRAFGAMMA NC_("RID_SVXSTR_UNDO_GRAFGAMMA", "Gamma")
+#define RID_SVXSTR_UNDO_GRAFTRANSPARENCY NC_("RID_SVXSTR_UNDO_GRAFTRANSPARENCY", "Transparency")
+#define RID_SVXSTR_GRAFCROP NC_("RID_SVXSTR_GRAFCROP", "Crop")
+
+#define RID_SVXITEMS_ORI_STANDARD NC_("RID_SVXITEMS_ORI_STANDARD", "Default orientation")
+#define RID_SVXITEMS_ORI_TOPBOTTOM NC_("RID_SVXITEMS_ORI_TOPBOTTOM", "From top to bottom")
+#define RID_SVXITEMS_ORI_BOTTOMTOP NC_("RID_SVXITEMS_ORI_BOTTOMTOP", "Bottom to Top")
+#define RID_SVXITEMS_ORI_STACKED NC_("RID_SVXITEMS_ORI_STACKED", "Stacked")
+#define RID_SVXITEMS_MARGIN_LEFT NC_("RID_SVXITEMS_MARGIN_LEFT", "Left margin: ")
+#define RID_SVXITEMS_MARGIN_TOP NC_("RID_SVXITEMS_MARGIN_TOP", "Top margin: ")
+#define RID_SVXITEMS_MARGIN_RIGHT NC_("RID_SVXITEMS_MARGIN_RIGHT", "Right margin: ")
+#define RID_SVXITEMS_MARGIN_BOTTOM NC_("RID_SVXITEMS_MARGIN_BOTTOM", "Bottom margin: ")
+#define RID_SVXITEMS_PAGE_COMPLETE NC_("RID_SVXITEMS_PAGE_COMPLETE", "Page Description: ")
+#define RID_SVXITEMS_PAGE_NUM_CHR_UPPER NC_("RID_SVXITEMS_PAGE_NUM_CHR_UPPER", "Capitals")
+#define RID_SVXITEMS_PAGE_NUM_CHR_LOWER NC_("RID_SVXITEMS_PAGE_NUM_CHR_LOWER", "Lowercase")
+#define RID_SVXITEMS_PAGE_NUM_ROM_UPPER NC_("RID_SVXITEMS_PAGE_NUM_ROM_UPPER", "Uppercase Roman")
+#define RID_SVXITEMS_PAGE_NUM_ROM_LOWER NC_("RID_SVXITEMS_PAGE_NUM_ROM_LOWER", "Lowercase Roman")
+#define RID_SVXITEMS_PAGE_NUM_ARABIC NC_("RID_SVXITEMS_PAGE_NUM_ARABIC", "Arabic")
+#define RID_SVXITEMS_PAGE_NUM_NONE NC_("RID_SVXITEMS_PAGE_NUM_NONE", "None")
+#define RID_SVXITEMS_PAGE_LAND_TRUE NC_("RID_SVXITEMS_PAGE_LAND_TRUE", "Landscape")
+#define RID_SVXITEMS_PAGE_LAND_FALSE NC_("RID_SVXITEMS_PAGE_LAND_FALSE", "Portrait")
+#define RID_SVXITEMS_PAGE_USAGE_LEFT NC_("RID_SVXITEMS_PAGE_USAGE_LEFT", "Left")
+#define RID_SVXITEMS_PAGE_USAGE_RIGHT NC_("RID_SVXITEMS_PAGE_USAGE_RIGHT", "Right")
+#define RID_SVXITEMS_PAGE_USAGE_ALL NC_("RID_SVXITEMS_PAGE_USAGE_ALL", "All")
+#define RID_SVXITEMS_PAGE_USAGE_MIRROR NC_("RID_SVXITEMS_PAGE_USAGE_MIRROR", "Mirrored")
+#define RID_SVXITEMS_AUTHOR_COMPLETE NC_("RID_SVXITEMS_AUTHOR_COMPLETE", "Author: ")
+#define RID_SVXITEMS_DATE_COMPLETE NC_("RID_SVXITEMS_DATE_COMPLETE", "Date: ")
+#define RID_SVXITEMS_TEXT_COMPLETE NC_("RID_SVXITEMS_TEXT_COMPLETE", "Text: ")
+#define RID_SVXITEMS_BRUSH_CHAR NC_("RID_SVXITEMS_BRUSH_CHAR", "Character background")
+
+#define STR_COLORTABLE NC_("STR_COLORTABLE", "Color Palette")
+
+// Used in the Slide Setup dialog of Impress
+#define STR_SLIDE_NUMBERS NC_("STR_SLIDE_NUMBERS", "Slide numbers:")
+
+// String for saving modified image (instead of original)
+#define RID_SVXSTR_SAVE_MODIFIED_IMAGE NC_("RID_SVXSTR_SAVE_MODIFIED_IMAGE", "The image has been modified. By default the original image will be saved.\nDo you want to save the modified version instead?")
+
+#define RID_SUBSETSTR_BASIC_LATIN NC_("RID_SUBSETMAP", "Basic Latin")
+#define RID_SUBSETSTR_LATIN_1 NC_("RID_SUBSETMAP", "Latin-1")
+#define RID_SUBSETSTR_LATIN_EXTENDED_A NC_("RID_SUBSETMAP", "Latin Extended-A")
+#define RID_SUBSETSTR_LATIN_EXTENDED_B NC_("RID_SUBSETMAP", "Latin Extended-B")
+#define RID_SUBSETSTR_IPA_EXTENSIONS NC_("RID_SUBSETMAP", "IPA Extensions")
+#define RID_SUBSETSTR_SPACING_MODIFIERS NC_("RID_SUBSETMAP", "Spacing Modifier Letters")
+#define RID_SUBSETSTR_COMB_DIACRITICAL NC_("RID_SUBSETMAP", "Combining Diacritical Marks")
+#define RID_SUBSETSTR_BASIC_GREEK NC_("RID_SUBSETMAP", "Basic Greek")
+#define RID_SUBSETSTR_GREEK_SYMS_COPTIC NC_("RID_SUBSETMAP", "Greek Symbols And Coptic")
+#define RID_SUBSETSTR_CYRILLIC NC_("RID_SUBSETMAP", "Cyrillic")
+#define RID_SUBSETSTR_ARMENIAN NC_("RID_SUBSETMAP", "Armenian")
+#define RID_SUBSETSTR_BASIC_HEBREW NC_("RID_SUBSETMAP", "Basic Hebrew")
+#define RID_SUBSETSTR_HEBREW_EXTENDED NC_("RID_SUBSETMAP", "Hebrew Extended")
+#define RID_SUBSETSTR_BASIC_ARABIC NC_("RID_SUBSETMAP", "Basic Arabic")
+#define RID_SUBSETSTR_ARABIC_EXTENDED NC_("RID_SUBSETMAP", "Arabic Extended")
+#define RID_SUBSETSTR_DEVANAGARI NC_("RID_SUBSETMAP", "Devanagari")
+#define RID_SUBSETSTR_BENGALI NC_("RID_SUBSETMAP", "Bengali")
+#define RID_SUBSETSTR_GURMUKHI NC_("RID_SUBSETMAP", "Gurmukhi")
+#define RID_SUBSETSTR_GUJARATI NC_("RID_SUBSETMAP", "Gujarati")
+#define RID_SUBSETSTR_ODIA NC_("RID_SUBSETMAP", "Odia")
+#define RID_SUBSETSTR_TAMIL NC_("RID_SUBSETMAP", "Tamil")
+#define RID_SUBSETSTR_TELUGU NC_("RID_SUBSETMAP", "Telugu")
+#define RID_SUBSETSTR_KANNADA NC_("RID_SUBSETMAP", "Kannada")
+#define RID_SUBSETSTR_MALAYALAM NC_("RID_SUBSETMAP", "Malayalam")
+#define RID_SUBSETSTR_THAI NC_("RID_SUBSETMAP", "Thai")
+#define RID_SUBSETSTR_LAO NC_("RID_SUBSETMAP", "Lao")
+#define RID_SUBSETSTR_BASIC_GEORGIAN NC_("RID_SUBSETMAP", "Basic Georgian")
+#define RID_SUBSETSTR_GEORGIAN_EXTENDED NC_("RID_SUBSETMAP", "Georgian Extended")
+#define RID_SUBSETSTR_HANGUL_JAMO NC_("RID_SUBSETMAP", "Hangul Jamo")
+#define RID_SUBSETSTR_LATIN_EXTENDED_ADDS NC_("RID_SUBSETMAP", "Latin Extended Additionals")
+#define RID_SUBSETSTR_GREEK_EXTENDED NC_("RID_SUBSETMAP", "Greek Extended")
+#define RID_SUBSETSTR_GENERAL_PUNCTUATION NC_("RID_SUBSETMAP", "General punctuation")
+#define RID_SUBSETSTR_SUB_SUPER_SCRIPTS NC_("RID_SUBSETMAP", "Superscripts and Subscripts")
+#define RID_SUBSETSTR_CURRENCY_SYMBOLS NC_("RID_SUBSETMAP", "Currency Symbols")
+#define RID_SUBSETSTR_COMB_DIACRITIC_SYMS NC_("RID_SUBSETMAP", "Combining Diacritical Symbols")
+#define RID_SUBSETSTR_LETTERLIKE_SYMBOLS NC_("RID_SUBSETMAP", "Letterlike Symbols")
+#define RID_SUBSETSTR_NUMBER_FORMS NC_("RID_SUBSETMAP", "Number Forms")
+#define RID_SUBSETSTR_ARROWS NC_("RID_SUBSETMAP", "Arrows")
+#define RID_SUBSETSTR_MATH_OPERATORS NC_("RID_SUBSETMAP", "Mathematical Operators")
+#define RID_SUBSETSTR_MISC_TECHNICAL NC_("RID_SUBSETMAP", "Miscellaneous Technical")
+#define RID_SUBSETSTR_CONTROL_PICTURES NC_("RID_SUBSETMAP", "Control Pictures")
+#define RID_SUBSETSTR_OPTICAL_CHAR_REC NC_("RID_SUBSETMAP", "Optical Character Recognition")
+#define RID_SUBSETSTR_ENCLOSED_ALPHANUM NC_("RID_SUBSETMAP", "Enclosed Alphanumerics")
+#define RID_SUBSETSTR_BOX_DRAWING NC_("RID_SUBSETMAP", "Box Drawing")
+#define RID_SUBSETSTR_BLOCK_ELEMENTS NC_("RID_SUBSETMAP", "Block Elements")
+#define RID_SUBSETSTR_GEOMETRIC_SHAPES NC_("RID_SUBSETMAP", "Geometric Shapes")
+#define RID_SUBSETSTR_MISC_DINGBATS NC_("RID_SUBSETMAP", "Miscellaneous Symbols")
+#define RID_SUBSETSTR_DINGBATS NC_("RID_SUBSETMAP", "Dingbats")
+#define RID_SUBSETSTR_CJK_SYMS_PUNCTUATION NC_("RID_SUBSETMAP", "CJK Symbols And Punctuation")
+#define RID_SUBSETSTR_HIRAGANA NC_("RID_SUBSETMAP", "Hiragana")
+#define RID_SUBSETSTR_KATAKANA NC_("RID_SUBSETMAP", "Katakana")
+#define RID_SUBSETSTR_BOPOMOFO NC_("RID_SUBSETMAP", "Bopomofo")
+#define RID_SUBSETSTR_HANGUL_COMPAT_JAMO NC_("RID_SUBSETMAP", "Hangul Compatibility Jamo")
+#define RID_SUBSETSTR_CJK_MISC NC_("RID_SUBSETMAP", "CJK Miscellaneous")
+#define RID_SUBSETSTR_ENCLOSED_CJK_LETTERS NC_("RID_SUBSETMAP", "Enclosed CJK Letters And Months")
+#define RID_SUBSETSTR_CJK_COMPATIBILITY NC_("RID_SUBSETMAP", "CJK Compatibility")
+#define RID_SUBSETSTR_HANGUL NC_("RID_SUBSETMAP", "Hangul")
+#define RID_SUBSETSTR_CJK_UNIFIED_IDGRAPH NC_("RID_SUBSETMAP", "CJK Unified Ideographs")
+#define RID_SUBSETSTR_CJK_EXT_A_UNIFIED_IDGRAPH NC_("RID_SUBSETMAP", "CJK Unified Ideographs Extension A")
+#define RID_SUBSETSTR_PRIVATE_USE_AREA NC_("RID_SUBSETMAP", "Private Use Area")
+#define RID_SUBSETSTR_CJK_COMPAT_IDGRAPHS NC_("RID_SUBSETMAP", "CJK Compatibility Ideographs")
+#define RID_SUBSETSTR_ALPHA_PRESENTATION NC_("RID_SUBSETMAP", "Alphabetic Presentation Forms")
+#define RID_SUBSETSTR_ARABIC_PRESENT_A NC_("RID_SUBSETMAP", "Arabic Presentation Forms-A")
+#define RID_SUBSETSTR_COMBINING_HALF_MARKS NC_("RID_SUBSETMAP", "Combining Half Marks")
+#define RID_SUBSETSTR_CJK_COMPAT_FORMS NC_("RID_SUBSETMAP", "CJK Compatibility Forms")
+#define RID_SUBSETSTR_SMALL_FORM_VARIANTS NC_("RID_SUBSETMAP", "Small Form Variants")
+#define RID_SUBSETSTR_ARABIC_PRESENT_B NC_("RID_SUBSETMAP", "Arabic Presentation Forms-B")
+#define RID_SUBSETSTR_HALFW_FULLW_FORMS NC_("RID_SUBSETMAP", "Half-width and Full-width Forms")
+#define RID_SUBSETSTR_SPECIALS NC_("RID_SUBSETMAP", "Specials")
+#define RID_SUBSETSTR_YI_SYLLABLES NC_("RID_SUBSETMAP", "Yi Syllables")
+#define RID_SUBSETSTR_YI_RADICALS NC_("RID_SUBSETMAP", "Yi Radicals")
+#define RID_SUBSETSTR_OLD_ITALIC NC_("RID_SUBSETMAP", "Old Italic")
+#define RID_SUBSETSTR_GOTHIC NC_("RID_SUBSETMAP", "Gothic")
+#define RID_SUBSETSTR_DESERET NC_("RID_SUBSETMAP", "Deseret")
+#define RID_SUBSETSTR_BYZANTINE_MUSICAL_SYMBOLS NC_("RID_SUBSETMAP", "Byzantine Musical Symbols")
+#define RID_SUBSETSTR_MUSICAL_SYMBOLS NC_("RID_SUBSETMAP", "Musical Symbols")
+#define RID_SUBSETSTR_MATHEMATICAL_ALPHANUMERIC_SYMBOLS NC_("RID_SUBSETMAP", "Mathematical Alphanumeric Symbols")
+#define RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B NC_("RID_SUBSETMAP", "CJK Unified Ideographs Extension B")
+#define RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C NC_("RID_SUBSETMAP", "CJK Unified Ideographs Extension C")
+#define RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D NC_("RID_SUBSETMAP", "CJK Unified Ideographs Extension D")
+#define RID_SUBSETSTR_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT NC_("RID_SUBSETMAP", "CJK Compatibility Ideographs Supplement")
+#define RID_SUBSETSTR_TAGS NC_("RID_SUBSETMAP", "Tags")
+#define RID_SUBSETSTR_CYRILLIC_SUPPLEMENTARY NC_("RID_SUBSETMAP", "Cyrillic Supplement")
+#define RID_SUBSETSTR_VARIATION_SELECTORS NC_("RID_SUBSETMAP", "Variation Selectors")
+#define RID_SUBSETSTR_SUPPLEMENTARY_PRIVATE_USE_AREA_A NC_("RID_SUBSETMAP", "Supplementary Private Use Area-A")
+#define RID_SUBSETSTR_SUPPLEMENTARY_PRIVATE_USE_AREA_B NC_("RID_SUBSETMAP", "Supplementary Private Use Area-B")
+#define RID_SUBSETSTR_LIMBU NC_("RID_SUBSETMAP", "Limbu")
+#define RID_SUBSETSTR_TAI_LE NC_("RID_SUBSETMAP", "Tai Le")
+#define RID_SUBSETSTR_KHMER_SYMBOLS NC_("RID_SUBSETMAP", "Khmer Symbols")
+#define RID_SUBSETSTR_PHONETIC_EXTENSIONS NC_("RID_SUBSETMAP", "Phonetic Extensions")
+#define RID_SUBSETSTR_MISCELLANEOUS_SYMBOLS_AND_ARROWS NC_("RID_SUBSETMAP", "Miscellaneous Symbols And Arrows")
+#define RID_SUBSETSTR_YIJING_HEXAGRAM_SYMBOLS NC_("RID_SUBSETMAP", "Yijing Hexagram Symbols")
+#define RID_SUBSETSTR_LINEAR_B_SYLLABARY NC_("RID_SUBSETMAP", "Linear B Syllabary")
+#define RID_SUBSETSTR_LINEAR_B_IDEOGRAMS NC_("RID_SUBSETMAP", "Linear B Ideograms")
+#define RID_SUBSETSTR_AEGEAN_NUMBERS NC_("RID_SUBSETMAP", "Aegean Numbers")
+#define RID_SUBSETSTR_UGARITIC NC_("RID_SUBSETMAP", "Ugaritic")
+#define RID_SUBSETSTR_SHAVIAN NC_("RID_SUBSETMAP", "Shavian")
+#define RID_SUBSETSTR_OSMANYA NC_("RID_SUBSETMAP", "Osmanya")
+#define RID_SUBSETSTR_SINHALA NC_("RID_SUBSETMAP", "Sinhala")
+#define RID_SUBSETSTR_TIBETAN NC_("RID_SUBSETMAP", "Tibetan")
+#define RID_SUBSETSTR_MYANMAR NC_("RID_SUBSETMAP", "Myanmar")
+#define RID_SUBSETSTR_KHMER NC_("RID_SUBSETMAP", "Khmer")
+#define RID_SUBSETSTR_OGHAM NC_("RID_SUBSETMAP", "Ogham")
+#define RID_SUBSETSTR_RUNIC NC_("RID_SUBSETMAP", "Runic")
+#define RID_SUBSETSTR_SYRIAC NC_("RID_SUBSETMAP", "Syriac")
+#define RID_SUBSETSTR_THAANA NC_("RID_SUBSETMAP", "Thaana")
+#define RID_SUBSETSTR_ETHIOPIC NC_("RID_SUBSETMAP", "Ethiopic")
+#define RID_SUBSETSTR_CHEROKEE NC_("RID_SUBSETMAP", "Cherokee")
+#define RID_SUBSETSTR_CANADIAN_ABORIGINAL NC_("RID_SUBSETMAP", "Canadian Aboriginal Syllables")
+#define RID_SUBSETSTR_MONGOLIAN NC_("RID_SUBSETMAP", "Mongolian")
+#define RID_SUBSETSTR_MISC_MATH_SYMS_A NC_("RID_SUBSETMAP", "Miscellaneous Mathematical Symbols-A")
+#define RID_SUBSETSTR_SUPPL_ARROWS_A NC_("RID_SUBSETMAP", "Supplemental Arrows-A")
+#define RID_SUBSETSTR_BRAILLE_PATTERNS NC_("RID_SUBSETMAP", "Braille Patterns")
+#define RID_SUBSETSTR_SUPPL_ARROWS_B NC_("RID_SUBSETMAP", "Supplemental Arrows-B")
+#define RID_SUBSETSTR_MISC_MATH_SYMS_B NC_("RID_SUBSETMAP", "Miscellaneous Mathematical Symbols-B")
+#define RID_SUBSETSTR_CJK_RADICAL_SUPPL NC_("RID_SUBSETMAP", "CJK Radical Supplement")
+#define RID_SUBSETSTR_KANGXI_RADICALS NC_("RID_SUBSETMAP", "Kangxi Radicals")
+#define RID_SUBSETSTR_IDEO_DESC_CHARS NC_("RID_SUBSETMAP", "Ideographic Description Characters")
+#define RID_SUBSETSTR_TAGALOG NC_("RID_SUBSETMAP", "Tagalog")
+#define RID_SUBSETSTR_HANUNOO NC_("RID_SUBSETMAP", "Hanunoo")
+#define RID_SUBSETSTR_TAGBANWA NC_("RID_SUBSETMAP", "Tagbanwa")
+#define RID_SUBSETSTR_BUHID NC_("RID_SUBSETMAP", "Buhid")
+#define RID_SUBSETSTR_KANBUN NC_("RID_SUBSETMAP", "Kanbun")
+#define RID_SUBSETSTR_BOPOMOFO_EXTENDED NC_("RID_SUBSETMAP", "Bopomofo Extended")
+#define RID_SUBSETSTR_KATAKANA_PHONETIC NC_("RID_SUBSETMAP", "Katakana Phonetics")
+#define RID_SUBSETSTR_CJK_STROKES NC_("RID_SUBSETMAP", "CJK Strokes")
+#define RID_SUBSETSTR_CYPRIOT_SYLLABARY NC_("RID_SUBSETMAP", "Cypriot Syllabary")
+#define RID_SUBSETSTR_TAI_XUAN_JING_SYMBOLS NC_("RID_SUBSETMAP", "Tai Xuan Jing Symbols")
+#define RID_SUBSETSTR_VARIATION_SELECTORS_SUPPLEMENT NC_("RID_SUBSETMAP", "Variation Selectors Supplement")
+#define RID_SUBSETSTR_ANCIENT_GREEK_MUSICAL_NOTATION NC_("RID_SUBSETMAP", "Ancient Greek Musical Notation")
+#define RID_SUBSETSTR_ANCIENT_GREEK_NUMBERS NC_("RID_SUBSETMAP", "Ancient Greek Numbers")
+#define RID_SUBSETSTR_ARABIC_SUPPLEMENT NC_("RID_SUBSETMAP", "Arabic Supplement")
+#define RID_SUBSETSTR_BUGINESE NC_("RID_SUBSETMAP", "Buginese")
+#define RID_SUBSETSTR_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT NC_("RID_SUBSETMAP", "Combining Diacritical Marks Supplement")
+#define RID_SUBSETSTR_COPTIC NC_("RID_SUBSETMAP", "Coptic")
+#define RID_SUBSETSTR_ETHIOPIC_EXTENDED NC_("RID_SUBSETMAP", "Ethiopic Extended")
+#define RID_SUBSETSTR_ETHIOPIC_SUPPLEMENT NC_("RID_SUBSETMAP", "Ethiopic Supplement")
+#define RID_SUBSETSTR_GEORGIAN_SUPPLEMENT NC_("RID_SUBSETMAP", "Georgian Supplement")
+#define RID_SUBSETSTR_GLAGOLITIC NC_("RID_SUBSETMAP", "Glagolitic")
+#define RID_SUBSETSTR_KHAROSHTHI NC_("RID_SUBSETMAP", "Kharoshthi")
+#define RID_SUBSETSTR_MODIFIER_TONE_LETTERS NC_("RID_SUBSETMAP", "Modifier Tone Letters")
+#define RID_SUBSETSTR_NEW_TAI_LUE NC_("RID_SUBSETMAP", "New Tai Lue")
+#define RID_SUBSETSTR_OLD_PERSIAN NC_("RID_SUBSETMAP", "Old Persian")
+#define RID_SUBSETSTR_PHONETIC_EXTENSIONS_SUPPLEMENT NC_("RID_SUBSETMAP", "Phonetic Extensions Supplement")
+#define RID_SUBSETSTR_SUPPLEMENTAL_PUNCTUATION NC_("RID_SUBSETMAP", "Supplemental Punctuation")
+#define RID_SUBSETSTR_SYLOTI_NAGRI NC_("RID_SUBSETMAP", "Syloti Nagri")
+#define RID_SUBSETSTR_TIFINAGH NC_("RID_SUBSETMAP", "Tifinagh")
+#define RID_SUBSETSTR_VERTICAL_FORMS NC_("RID_SUBSETMAP", "Vertical Forms")
+#define RID_SUBSETSTR_NKO NC_("RID_SUBSETMAP", "Nko")
+#define RID_SUBSETSTR_BALINESE NC_("RID_SUBSETMAP", "Balinese")
+#define RID_SUBSETSTR_LATIN_EXTENDED_C NC_("RID_SUBSETMAP", "Latin Extended-C")
+#define RID_SUBSETSTR_LATIN_EXTENDED_D NC_("RID_SUBSETMAP", "Latin Extended-D")
+#define RID_SUBSETSTR_PHAGS_PA NC_("RID_SUBSETMAP", "Phags-Pa")
+#define RID_SUBSETSTR_PHOENICIAN NC_("RID_SUBSETMAP", "Phoenician")
+#define RID_SUBSETSTR_CUNEIFORM NC_("RID_SUBSETMAP", "Cuneiform")
+#define RID_SUBSETSTR_CUNEIFORM_NUMBERS_AND_PUNCTUATION NC_("RID_SUBSETMAP", "Cuneiform Numbers And Punctuation")
+#define RID_SUBSETSTR_COUNTING_ROD_NUMERALS NC_("RID_SUBSETMAP", "Counting Rod Numerals")
+#define RID_SUBSETSTR_SUNDANESE NC_("RID_SUBSETMAP", "Sundanese")
+#define RID_SUBSETSTR_LEPCHA NC_("RID_SUBSETMAP", "Lepcha")
+#define RID_SUBSETSTR_OL_CHIKI NC_("RID_SUBSETMAP", "Ol Chiki")
+#define RID_SUBSETSTR_CYRILLIC_EXTENDED_A NC_("RID_SUBSETMAP", "Cyrillic Extended-A")
+#define RID_SUBSETSTR_VAI NC_("RID_SUBSETMAP", "Vai")
+#define RID_SUBSETSTR_CYRILLIC_EXTENDED_B NC_("RID_SUBSETMAP", "Cyrillic Extended-B")
+#define RID_SUBSETSTR_SAURASHTRA NC_("RID_SUBSETMAP", "Saurashtra")
+#define RID_SUBSETSTR_KAYAH_LI NC_("RID_SUBSETMAP", "Kayah Li")
+#define RID_SUBSETSTR_REJANG NC_("RID_SUBSETMAP", "Rejang")
+#define RID_SUBSETSTR_CHAM NC_("RID_SUBSETMAP", "Cham")
+#define RID_SUBSETSTR_ANCIENT_SYMBOLS NC_("RID_SUBSETMAP", "Ancient Symbols")
+#define RID_SUBSETSTR_PHAISTOS_DISC NC_("RID_SUBSETMAP", "Phaistos Disc")
+#define RID_SUBSETSTR_LYCIAN NC_("RID_SUBSETMAP", "Lycian")
+#define RID_SUBSETSTR_CARIAN NC_("RID_SUBSETMAP", "Carian")
+#define RID_SUBSETSTR_LYDIAN NC_("RID_SUBSETMAP", "Lydian")
+#define RID_SUBSETSTR_MAHJONG_TILES NC_("RID_SUBSETMAP", "Mahjong Tiles")
+#define RID_SUBSETSTR_DOMINO_TILES NC_("RID_SUBSETMAP", "Domino Tiles")
+#define RID_SUBSETSTR_SAMARITAN NC_("RID_SUBSETMAP", "Samaritan")
+#define RID_SUBSETSTR_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED NC_("RID_SUBSETMAP", "Canadian Aboriginal Syllabics Extended")
+#define RID_SUBSETSTR_TAI_THAM NC_("RID_SUBSETMAP", "Tai Tham")
+#define RID_SUBSETSTR_VEDIC_EXTENSIONS NC_("RID_SUBSETMAP", "Vedic Extensions")
+#define RID_SUBSETSTR_LISU NC_("RID_SUBSETMAP", "Lisu")
+#define RID_SUBSETSTR_BAMUM NC_("RID_SUBSETMAP", "Bamum")
+#define RID_SUBSETSTR_COMMON_INDIC_NUMBER_FORMS NC_("RID_SUBSETMAP", "Common Indic Number Forms")
+#define RID_SUBSETSTR_DEVANAGARI_EXTENDED NC_("RID_SUBSETMAP", "Devanagari Extended")
+#define RID_SUBSETSTR_HANGUL_JAMO_EXTENDED_A NC_("RID_SUBSETMAP", "Hangul Jamo Extended-A")
+#define RID_SUBSETSTR_JAVANESE NC_("RID_SUBSETMAP", "Javanese")
+#define RID_SUBSETSTR_MYANMAR_EXTENDED_A NC_("RID_SUBSETMAP", "Myanmar Extended-A")
+#define RID_SUBSETSTR_TAI_VIET NC_("RID_SUBSETMAP", "Tai Viet")
+#define RID_SUBSETSTR_MEETEI_MAYEK NC_("RID_SUBSETMAP", "Meetei Mayek")
+#define RID_SUBSETSTR_HANGUL_JAMO_EXTENDED_B NC_("RID_SUBSETMAP", "Hangul Jamo Extended-B")
+#define RID_SUBSETSTR_IMPERIAL_ARAMAIC NC_("RID_SUBSETMAP", "Imperial Aramaic")
+#define RID_SUBSETSTR_OLD_SOUTH_ARABIAN NC_("RID_SUBSETMAP", "Old South Arabian")
+#define RID_SUBSETSTR_AVESTAN NC_("RID_SUBSETMAP", "Avestan")
+#define RID_SUBSETSTR_INSCRIPTIONAL_PARTHIAN NC_("RID_SUBSETMAP", "Inscriptional Parthian")
+#define RID_SUBSETSTR_INSCRIPTIONAL_PAHLAVI NC_("RID_SUBSETMAP", "Inscriptional Pahlavi")
+#define RID_SUBSETSTR_OLD_TURKIC NC_("RID_SUBSETMAP", "Old Turkic")
+#define RID_SUBSETSTR_RUMI_NUMERAL_SYMBOLS NC_("RID_SUBSETMAP", "Rumi Numeral Symbols")
+#define RID_SUBSETSTR_KAITHI NC_("RID_SUBSETMAP", "Kaithi")
+#define RID_SUBSETSTR_EGYPTIAN_HIEROGLYPHS NC_("RID_SUBSETMAP", "Egyptian Hieroglyphs")
+#define RID_SUBSETSTR_ENCLOSED_ALPHANUMERIC_SUPPLEMENT NC_("RID_SUBSETMAP", "Enclosed Alphanumeric Supplement")
+#define RID_SUBSETSTR_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT NC_("RID_SUBSETMAP", "Enclosed Ideographic Supplement")
+#define RID_SUBSETSTR_MANDAIC NC_("RID_SUBSETMAP", "Mandaic")
+#define RID_SUBSETSTR_BATAK NC_("RID_SUBSETMAP", "Batak")
+#define RID_SUBSETSTR_ETHIOPIC_EXTENDED_A NC_("RID_SUBSETMAP", "Ethiopic Extended-A")
+#define RID_SUBSETSTR_BRAHMI NC_("RID_SUBSETMAP", "Brahmi")
+#define RID_SUBSETSTR_BAMUM_SUPPLEMENT NC_("RID_SUBSETMAP", "Bamum Supplement")
+#define RID_SUBSETSTR_KANA_SUPPLEMENT NC_("RID_SUBSETMAP", "Kana Supplement")
+#define RID_SUBSETSTR_PLAYING_CARDS NC_("RID_SUBSETMAP", "Playing Cards")
+#define RID_SUBSETSTR_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS NC_("RID_SUBSETMAP", "Miscellaneous Symbols And Pictographs")
+#define RID_SUBSETSTR_EMOTICONS NC_("RID_SUBSETMAP", "Emoticons")
+#define RID_SUBSETSTR_TRANSPORT_AND_MAP_SYMBOLS NC_("RID_SUBSETMAP", "Transport And Map Symbols")
+#define RID_SUBSETSTR_ALCHEMICAL_SYMBOLS NC_("RID_SUBSETMAP", "Alchemical Symbols")
+#define RID_SUBSETSTR_ARABIC_EXTENDED_A NC_("RID_SUBSETMAP", "Arabic Extended-A")
+#define RID_SUBSETSTR_ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS NC_("RID_SUBSETMAP", "Arabic Mathematical Alphabetic Symbols")
+#define RID_SUBSETSTR_CHAKMA NC_("RID_SUBSETMAP", "Chakma")
+#define RID_SUBSETSTR_MEETEI_MAYEK_EXTENSIONS NC_("RID_SUBSETMAP", "Meetei Mayek Extensions")
+#define RID_SUBSETSTR_MEROITIC_CURSIVE NC_("RID_SUBSETMAP", "Meroitic Cursive")
+#define RID_SUBSETSTR_MEROITIC_HIEROGLYPHS NC_("RID_SUBSETMAP", "Meroitic Hieroglyphs")
+#define RID_SUBSETSTR_MIAO NC_("RID_SUBSETMAP", "Miao")
+#define RID_SUBSETSTR_SHARADA NC_("RID_SUBSETMAP", "Sharada")
+#define RID_SUBSETSTR_SORA_SOMPENG NC_("RID_SUBSETMAP", "Sora Sompeng")
+#define RID_SUBSETSTR_SUNDANESE_SUPPLEMENT NC_("RID_SUBSETMAP", "Sundanese Supplement")
+#define RID_SUBSETSTR_TAKRI NC_("RID_SUBSETMAP", "Takri")
+#define RID_SUBSETSTR_BASSA_VAH NC_("RID_SUBSETMAP", "Bassa Vah")
+#define RID_SUBSETSTR_CAUCASIAN_ALBANIAN NC_("RID_SUBSETMAP", "Caucasian Albanian")
+#define RID_SUBSETSTR_COPTIC_EPACT_NUMBERS NC_("RID_SUBSETMAP", "Coptic Epact Numbers")
+#define RID_SUBSETSTR_COMBINING_DIACRITICAL_MARKS_EXTENDED NC_("RID_SUBSETMAP", "Combining Diacritical Marks Extended")
+#define RID_SUBSETSTR_DUPLOYAN NC_("RID_SUBSETMAP", "Duployan")
+#define RID_SUBSETSTR_ELBASAN NC_("RID_SUBSETMAP", "Elbasan")
+#define RID_SUBSETSTR_GEOMETRIC_SHAPES_EXTENDED NC_("RID_SUBSETMAP", "Geometric Shapes Extended")
+#define RID_SUBSETSTR_GRANTHA NC_("RID_SUBSETMAP", "Grantha")
+#define RID_SUBSETSTR_KHOJKI NC_("RID_SUBSETMAP", "Khojki")
+#define RID_SUBSETSTR_KHUDAWADI NC_("RID_SUBSETMAP", "Khudawadi")
+#define RID_SUBSETSTR_LATIN_EXTENDED_E NC_("RID_SUBSETMAP", "Latin Extended-E")
+#define RID_SUBSETSTR_LINEAR_A NC_("RID_SUBSETMAP", "Linear A")
+#define RID_SUBSETSTR_MAHAJANI NC_("RID_SUBSETMAP", "Mahajani")
+#define RID_SUBSETSTR_MANICHAEAN NC_("RID_SUBSETMAP", "Manichaean")
+#define RID_SUBSETSTR_MENDE_KIKAKUI NC_("RID_SUBSETMAP", "Mende Kikakui")
+#define RID_SUBSETSTR_MODI NC_("RID_SUBSETMAP", "Modi")
+#define RID_SUBSETSTR_MRO NC_("RID_SUBSETMAP", "Mro")
+#define RID_SUBSETSTR_MYANMAR_EXTENDED_B NC_("RID_SUBSETMAP", "Myanmar Extended-B")
+#define RID_SUBSETSTR_NABATAEAN NC_("RID_SUBSETMAP", "Nabataean")
+#define RID_SUBSETSTR_OLD_NORTH_ARABIAN NC_("RID_SUBSETMAP", "Old North Arabian")
+#define RID_SUBSETSTR_OLD_PERMIC NC_("RID_SUBSETMAP", "Old Permic")
+#define RID_SUBSETSTR_ORNAMENTAL_DINGBATS NC_("RID_SUBSETMAP", "Ornamental Dingbats")
+#define RID_SUBSETSTR_PAHAWH_HMONG NC_("RID_SUBSETMAP", "Pahawh Hmong")
+#define RID_SUBSETSTR_PALMYRENE NC_("RID_SUBSETMAP", "Palmyrene")
+#define RID_SUBSETSTR_PAU_CIN_HAU NC_("RID_SUBSETMAP", "Pau Cin Hau")
+#define RID_SUBSETSTR_PSALTER_PAHLAVI NC_("RID_SUBSETMAP", "Psalter Pahlavi")
+#define RID_SUBSETSTR_SHORTHAND_FORMAT_CONTROLS NC_("RID_SUBSETMAP", "Shorthand Format Controls")
+#define RID_SUBSETSTR_SIDDHAM NC_("RID_SUBSETMAP", "Siddham")
+#define RID_SUBSETSTR_SINHALA_ARCHAIC_NUMBERS NC_("RID_SUBSETMAP", "Sinhala Archaic Numbers")
+#define RID_SUBSETSTR_SUPPLEMENTAL_ARROWS_C NC_("RID_SUBSETMAP", "Supplemental Arrows-C")
+#define RID_SUBSETSTR_TIRHUTA NC_("RID_SUBSETMAP", "Tirhuta")
+#define RID_SUBSETSTR_WARANG_CITI NC_("RID_SUBSETMAP", "Warang Citi")
+#define RID_SUBSETSTR_AHOM NC_("RID_SUBSETMAP", "Ahom")
+#define RID_SUBSETSTR_ANATOLIAN_HIEROGLYPHS NC_("RID_SUBSETMAP", "Anatolian Hieroglyphs")
+#define RID_SUBSETSTR_CHEROKEE_SUPPLEMENT NC_("RID_SUBSETMAP", "Cherokee Supplement")
+#define RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E NC_("RID_SUBSETMAP", "CJK Unified Ideographs Extension E")
+#define RID_SUBSETSTR_EARLY_DYNASTIC_CUNEIFORM NC_("RID_SUBSETMAP", "Early Dynastic Cuneiform")
+#define RID_SUBSETSTR_HATRAN NC_("RID_SUBSETMAP", "Hatran")
+#define RID_SUBSETSTR_MULTANI NC_("RID_SUBSETMAP", "Multani")
+#define RID_SUBSETSTR_OLD_HUNGARIAN NC_("RID_SUBSETMAP", "Old Hungarian")
+#define RID_SUBSETSTR_SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS NC_("RID_SUBSETMAP", "Supplemental Symbols And Pictographs")
+#define RID_SUBSETSTR_SUTTON_SIGNWRITING NC_("RID_SUBSETMAP", "Sutton Signwriting")
+#define RID_SUBSETSTR_ADLAM NC_("RID_SUBSETMAP", "Adlam")
+#define RID_SUBSETSTR_BHAIKSUKI NC_("RID_SUBSETMAP", "Bhaiksuki")
+#define RID_SUBSETSTR_CYRILLIC_EXTENDED_C NC_("RID_SUBSETMAP", "Cyrillic Extended-C")
+#define RID_SUBSETSTR_GLAGOLITIC_SUPPLEMENT NC_("RID_SUBSETMAP", "Glagolitic Supplement")
+#define RID_SUBSETSTR_IDEOGRAPHIC_SYMBOLS_AND_PUNCTUATION NC_("RID_SUBSETMAP", "Ideographic Symbols and Punctuation")
+#define RID_SUBSETSTR_MARCHEN NC_("RID_SUBSETMAP", "Marchen")
+#define RID_SUBSETSTR_MONGOLIAN_SUPPLEMENT NC_("RID_SUBSETMAP", "Mongolian Supplement")
+#define RID_SUBSETSTR_NEWA NC_("RID_SUBSETMAP", "Newa")
+#define RID_SUBSETSTR_OSAGE NC_("RID_SUBSETMAP", "Osage")
+#define RID_SUBSETSTR_TANGUT NC_("RID_SUBSETMAP", "Tangut")
+#define RID_SUBSETSTR_TANGUT_COMPONENTS NC_("RID_SUBSETMAP", "Tangut Components")
+#define RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F NC_("RID_SUBSETMAP", "CJK Unified Ideographs Extension F")
+#define RID_SUBSETSTR_KANA_EXTENDED_A NC_("RID_SUBSETMAP", "Kana Extended-A")
+#define RID_SUBSETSTR_MASARAM_GONDI NC_("RID_SUBSETMAP", "Masaram Gondi")
+#define RID_SUBSETSTR_NUSHU NC_("RID_SUBSETMAP", "Nushu")
+#define RID_SUBSETSTR_SOYOMBO NC_("RID_SUBSETMAP", "Soyombo")
+#define RID_SUBSETSTR_SYRIAC_SUPPLEMENT NC_("RID_SUBSETMAP", "Syriac Supplement")
+#define RID_SUBSETSTR_ZANABAZAR_SQUARE NC_("RID_SUBSETMAP", "Zanabazar Square")
+#define RID_SUBSETSTR_CHESS_SYMBOLS NC_("RID_SUBSETMAP", "Chess Symbols")
+#define RID_SUBSETSTR_DOGRA NC_("RID_SUBSETMAP", "Dogra")
+#define RID_SUBSETSTR_GUNJALA_GONDI NC_("RID_SUBSETMAP", "Gunjala Gondi")
+#define RID_SUBSETSTR_HANIFI_ROHINGYA NC_("RID_SUBSETMAP", "Hanifi Rohingya")
+#define RID_SUBSETSTR_INDIC_SIYAQ_NUMBERS NC_("RID_SUBSETMAP", "Indic Siyaq Numbers")
+#define RID_SUBSETSTR_MAKASAR NC_("RID_SUBSETMAP", "Makasar")
+#define RID_SUBSETSTR_MAYAN_NUMERALS NC_("RID_SUBSETMAP", "Mayan Numerals")
+#define RID_SUBSETSTR_MEDEFAIDRIN NC_("RID_SUBSETMAP", "Medefaidrin")
+#define RID_SUBSETSTR_OLD_SOGDIAN NC_("RID_SUBSETMAP", "Old Sogdian")
+#define RID_SUBSETSTR_SOGDIAN NC_("RID_SUBSETMAP", "Sogdian")
+#define RID_SUBSETSTR_EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS NC_("RID_SUBSETMAP", "Egyptian Hieroglyph Format Controls")
+#define RID_SUBSETSTR_ELYMAIC NC_("RID_SUBSETMAP", "Elymaic")
+#define RID_SUBSETSTR_NANDINAGARI NC_("RID_SUBSETMAP", "Nandinagari")
+#define RID_SUBSETSTR_NYIAKENG_PUACHUE_HMONG NC_("RID_SUBSETMAP", "Nyiakeng Puachue Hmong")
+#define RID_SUBSETSTR_OTTOMAN_SIYAQ_NUMBERS NC_("RID_SUBSETMAP", "Ottoman Siyaq Numbers")
+#define RID_SUBSETSTR_SMALL_KANA_EXTENSION NC_("RID_SUBSETMAP", "Small Kana Extension")
+#define RID_SUBSETSTR_SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A NC_("RID_SUBSETMAP", "Symbols and Pictographs Extended-A")
+#define RID_SUBSETSTR_TAMIL_SUPPLEMENT NC_("RID_SUBSETMAP", "Tamil Supplement")
+#define RID_SUBSETSTR_WANCHO NC_("RID_SUBSETMAP", "Wancho")
+#define RID_SUBSETSTR_CHORASMIAN NC_("RID_SUBSETMAP", "Chorasmian")
+#define RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_G NC_("RID_SUBSETMAP", "CJK Unified Ideographs Extension G")
+#define RID_SUBSETSTR_DIVES_AKURU NC_("RID_SUBSETMAP", "Dhives Akuru")
+#define RID_SUBSETSTR_KHITAN_SMALL_SCRIPT NC_("RID_SUBSETMAP", "Khitan small script")
+#define RID_SUBSETSTR_LISU_SUPPLEMENT NC_("RID_SUBSETMAP", "Lisu Supplement")
+#define RID_SUBSETSTR_SYMBOLS_FOR_LEGACY_COMPUTING NC_("RID_SUBSETMAP", "Symbols for Legacy Computing")
+#define RID_SUBSETSTR_TANGUT_SUPPLEMENT NC_("RID_SUBSETMAP", "Tangut Supplement")
+#define RID_SUBSETSTR_YEZIDI NC_("RID_SUBSETMAP", "Yezidi")
+#define RID_SUBSETSTR_ARABIC_EXTENDED_B NC_("RID_SUBSETMAP", "Arabic Extended-B")
+#define RID_SUBSETSTR_CYPRO_MINOAN NC_("RID_SUBSETMAP", "Cypro-Minoan")
+#define RID_SUBSETSTR_ETHIOPIC_EXTENDED_B NC_("RID_SUBSETMAP", "Ethiopic Extended-B")
+#define RID_SUBSETSTR_KANA_EXTENDED_B NC_("RID_SUBSETMAP", "Kana Extended-B")
+#define RID_SUBSETSTR_LATIN_EXTENDED_F NC_("RID_SUBSETMAP", "Latin Extended-F")
+#define RID_SUBSETSTR_LATIN_EXTENDED_G NC_("RID_SUBSETMAP", "Latin Extended-G")
+#define RID_SUBSETSTR_OLD_UYGHUR NC_("RID_SUBSETMAP", "Old Uyghur")
+#define RID_SUBSETSTR_TANGSA NC_("RID_SUBSETMAP", "Tangsa")
+#define RID_SUBSETSTR_TOTO NC_("RID_SUBSETMAP", "Toto")
+#define RID_SUBSETSTR_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED_A NC_("RID_SUBSETMAP", "Canadian Aboriginal Syllabics Extended-A")
+#define RID_SUBSETSTR_VITHKUQI NC_("RID_SUBSETMAP", "Vithkuqi")
+#define RID_SUBSETSTR_ZNAMENNY_MUSICAL_NOTATION NC_("RID_SUBSETMAP", "Znamenny Musical Notation")
+
+#define RID_SVXSTR_FRAMEDIR_LTR NC_("RID_SVXSTR_FRAMEDIR_LTR", "Left-to-right (LTR)")
+#define RID_SVXSTR_FRAMEDIR_RTL NC_("RID_SVXSTR_FRAMEDIR_RTL", "Right-to-left (RTL)")
+#define RID_SVXSTR_FRAMEDIR_SUPER NC_("RID_SVXSTR_FRAMEDIR_SUPER", "Use superordinate object settings")
+// page direction
+#define RID_SVXSTR_PAGEDIR_LTR_HORI NC_("RID_SVXSTR_PAGEDIR_LTR_HORI", "Left-to-right (horizontal)")
+#define RID_SVXSTR_PAGEDIR_RTL_HORI NC_("RID_SVXSTR_PAGEDIR_RTL_HORI", "Right-to-left (horizontal)")
+#define RID_SVXSTR_PAGEDIR_RTL_VERT NC_("RID_SVXSTR_PAGEDIR_RTL_VERT", "Right-to-left (vertical)")
+#define RID_SVXSTR_PAGEDIR_LTR_VERT NC_("RID_SVXSTR_PAGEDIR_LTR_VERT", "Left-to-right (vertical)")
+#define RID_SVXSTR_PAGEDIR_LTR_BTT_VERT NC_("RID_SVXSTR_PAGEDIR_LTR_BTT_VERT", "Bottom-to-top, left-to-right (vertical)")
+
+#define RID_SVXSTR_FONTWORK NC_("RID_SVXSTR_FONTWORK", "Fontwork")
+
+#define RID_SVXSTR_SIGNATURELINE_DSIGNED_BY NC_("RID_SVXSTR_SIGNATURELINE_DSIGNED_BY", "Digitally signed by:")
+#define RID_SVXSTR_SIGNATURELINE_DATE NC_("RID_SVXSTR_SIGNATURELINE_DATE", "Date: %1")
+
+#define RID_SVXSTR_TRANSPARENCY NC_("RID_SVXSTR_TRANSPARENCY", "Transparency:")
+
+
+// strings related to borders
+#define RID_SVXSTR_TABLE_PRESET_NONE NC_("RID_SVXSTR_TABLE_PRESET_NONE", "No Borders")
+#define RID_SVXSTR_TABLE_PRESET_ONLYOUTER NC_("RID_SVXSTR_TABLE_PRESET_ONLYOUTER", "Outer Border Only")
+#define RID_SVXSTR_TABLE_PRESET_OUTERHORI NC_("RID_SVXSTR_TABLE_PRESET_OUTERHORI", "Outer Border and Horizontal Lines")
+#define RID_SVXSTR_TABLE_PRESET_OUTERALL NC_("RID_SVXSTR_TABLE_PRESET_OUTERALL", "Outer Border and All Inner Lines")
+#define RID_SVXSTR_TABLE_PRESET_OUTERVERI NC_("RID_SVXSTR_TABLE_PRESET_OUTERVERI", "Outer Border and Vertical Lines")
+#define RID_SVXSTR_TABLE_PRESET_OUTERINNER NC_("RID_SVXSTR_TABLE_PRESET_OUTERINNER", "Outer Border Without Changing Inner Lines")
+#define RID_SVXSTR_PARA_PRESET_DIAGONAL NC_("RID_SVXSTR_PARA_PRESET_DIAGONAL", "Diagonal Lines Only")
+#define RID_SVXSTR_PARA_PRESET_DIAGONALDOWN NC_("RID_SVXSTR_PARA_PRESET_DIAGONALDOWN", "Diagonal Down Border")
+#define RID_SVXSTR_PARA_PRESET_DIAGONALUP NC_("RID_SVXSTR_PARA_PRESET_DIAGONALUP", "Diagonal Up Border")
+#define RID_SVXSTR_PARA_PRESET_CRISSCROSS NC_("RID_SVXSTR_PARA_PRESET_CRISSCROSS", "Criss-Cross Border")
+#define RID_SVXSTR_PARA_PRESET_ALL NC_("RID_SVXSTR_PARA_PRESET_ALL", "All Four Borders")
+#define RID_SVXSTR_PARA_PRESET_LEFTRIGHT NC_("RID_SVXSTR_PARA_PRESET_LEFTRIGHT", "Left and Right Borders Only")
+#define RID_SVXSTR_PARA_PRESET_TOPBOTTOM NC_("RID_SVXSTR_PARA_PRESET_TOPBOTTOM", "Top and Bottom Borders Only")
+#define RID_SVXSTR_PARA_PRESET_TOPBOTTOMHORI NC_("RID_SVXSTR_PARA_PRESET_TOPBOTTOMHORI", "Top and Bottom Borders, and All Horizontal Lines")
+#define RID_SVXSTR_PARA_PRESET_ONLYLEFT NC_("RID_SVXSTR_PARA_PRESET_ONLYLEFT", "Left Border Only")
+#define RID_SVXSTR_PARA_PRESET_ONLYRIGHT NC_("RID_SVXSTR_PARA_PRESET_ONLYRIGHT", "Right Border Only")
+#define RID_SVXSTR_PARA_PRESET_ONLYTOP NC_("RID_SVXSTR_PARA_PRESET_ONLYTOP", "Top Border Only")
+#define RID_SVXSTR_PARA_PRESET_ONLYTBOTTOM NC_("RID_SVXSTR_PARA_PRESET_ONLYTBOTTOM", "Bottom Border Only")
+#define RID_SVXSTR_HOR_PRESET_ONLYHOR NC_("RID_SVXSTR_HOR_PRESET_ONLYHOR", "Top and Bottom Borders, and All Inner Lines")
+#define RID_SVXSTR_VER_PRESET_ONLYVER NC_("RID_SVXSTR_VER_PRESET_ONLYVER", "Left and Right Borders, and All Inner Lines")
+
+/*--------------------------------------------------------------------
+ Description: GraphicSizeCheck strings
+ --------------------------------------------------------------------*/
+#define STR_GRAPHIC_SIZE_CHECK_DIALOG_TITLE NC_("STR_GRAPHIC_SIZE_CHECK_DIALOG_TITLE", "Graphic Size Check")
+#define STR_WARNING_GRAPHIC_PIXEL_COUNT_LOW NC_("STR_WARNING_GRAPHIC_PIXEL_COUNT_LOW", "Image '%NAME%' has too few pixels for the current size (%DPIX% x %DPIY% DPI)")
+#define STR_WARNING_GRAPHIC_PIXEL_COUNT_HIGH NC_("STR_WARNING_GRAPHIC_PIXEL_COUNT_HIGH", "Image '%NAME%' has too many pixels for the current size (%DPIX% x %DPIY% DPI)")
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdcrtv.hxx b/include/svx/svdcrtv.hxx
new file mode 100644
index 000000000..b7f7a5938
--- /dev/null
+++ b/include/svx/svdcrtv.hxx
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDCRTV_HXX
+#define INCLUDED_SVX_SVDCRTV_HXX
+
+#include <svx/svddrgv.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+class XLineAttrSetItem;
+class XFillAttrSetItem;
+class SdrEdgeObj;
+class SdrObjConnection;
+
+class ImplConnectMarkerOverlay;
+class ImpSdrCreateViewExtraData;
+
+class SVXCORE_DLLPUBLIC SdrCreateView : public SdrDragView
+{
+ friend class SdrPageView;
+
+protected:
+ SdrObject* mpCurrentCreate; // The currently being created object
+ SdrPageView* mpCreatePV; // Here, the creation is started
+ std::unique_ptr<ImplConnectMarkerOverlay> mpCoMaOverlay;
+
+ // for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to
+ // compile the apps all the time
+ std::unique_ptr<ImpSdrCreateViewExtraData> mpCreateViewExtraData;
+
+ PointerStyle maCurrentCreatePointer;
+
+ sal_Int32 mnAutoCloseDistPix;
+ sal_Int32 mnFreeHandMinDistPix;
+ SdrInventor mnCurrentInvent; // set the current ones
+ SdrObjKind mnCurrentIdent; // Obj for re-creating
+
+ bool mb1stPointAsCenter : 1;
+ bool mbUseIncompatiblePathCreateInterface : 1;
+
+ void ImpClearConnectMarker();
+
+protected:
+ bool ImpBegCreateObj(SdrInventor nInvent, SdrObjKind nIdent, const Point& rPnt, OutputDevice* pOut,
+ sal_Int16 nMinMov, const tools::Rectangle& rLogRect, SdrObject* pPreparedFactoryObject);
+
+ void ShowCreateObj(/*OutputDevice* pOut, bool bFull*/);
+ void HideCreateObj(/*OutputDevice* pOut, bool bFull*/);
+ bool CheckEdgeMode();
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrCreateView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
+ virtual ~SdrCreateView() override;
+
+public:
+ virtual bool IsAction() const override;
+ virtual void MovAction(const Point& rPnt) override;
+ virtual void EndAction() override;
+ virtual void BckAction() override;
+ virtual void BrkAction() override;
+ virtual void TakeActionRect(tools::Rectangle& rRect) const override;
+
+ virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override;
+
+ void SetMeasureLayer(const OUString& rName) { maMeasureLayer=rName; }
+
+ // If the MeasureLayer is not set (empty string), then use the active layer for measuring.
+ void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); }
+ void SetEditMode(bool bOn=true) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); }
+ void SetCreateMode(bool bOn=true) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); }
+ void SetGluePointEditMode(bool bOn=true) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); }
+
+ // Determine whether a text tool is activated
+ bool IsTextTool() const;
+
+ // Determine whether an object connector tool activated
+ bool IsEdgeTool() const;
+
+ // Determine whether a measurement tool activated
+ bool IsMeasureTool() const;
+
+ void SetCurrentObj(SdrObjKind nIdent, SdrInventor nInvent=SdrInventor::Default);
+ void TakeCurrentObj(SdrObjKind& nIdent, SdrInventor& nInvent) const
+ {
+ nInvent = mnCurrentInvent;
+ nIdent = mnCurrentIdent;
+ }
+ SdrInventor GetCurrentObjInventor() const { return mnCurrentInvent; }
+ SdrObjKind GetCurrentObjIdentifier() const { return mnCurrentIdent; }
+
+ // Beginning the regular Create
+ bool BegCreateObj(const Point& rPnt, OutputDevice* pOut=nullptr, short nMinMov=-3);
+ bool BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject);
+ void MovCreateObj(const Point& rPnt);
+ bool EndCreateObj(SdrCreateCmd eCmd);
+ void BckCreateObj(); // go back one polygon point
+ void BrkCreateObj();
+ bool IsCreateObj() const { return mpCurrentCreate != nullptr; }
+ SdrObject* GetCreateObj() const { return mpCurrentCreate; }
+
+ /// Setup layer (eg. foreground / background) of the given object.
+ static void SetupObjLayer(const SdrPageView* pPageView, const OUString& aActiveLayer, SdrObject* pObj);
+
+ // BegCreateCaptionObj() creates a SdrCaptionObj (legend item).
+ // rObjSiz is the initial size of the legend text frame.
+ // Only the length of the tip is dragged
+ bool BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz, OutputDevice* pOut=nullptr, short nMinMov=-3);
+
+ // Create a circle/rectangle/text frame with the first Point being
+ // the center of the object instead of the upper-left corner.
+ // Persistent flag. Default = FALSE.
+ bool IsCreate1stPointAsCenter() const { return mb1stPointAsCenter; }
+ void SetCreate1stPointAsCenter(bool bOn) { mb1stPointAsCenter = bOn; }
+
+ // Default = 5 Pixel
+ sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(mnAutoCloseDistPix); }
+
+ // Setting for the minimum distance in pixels between 2 bezier points when
+ // creating a freehand line.
+ // Default = 10 Pixel
+ sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(mnFreeHandMinDistPix); }
+
+ // FIXME: Whoever wants to keep the Create Interface for the PathObj which is
+ // incompatible with the rest of the Create functionality of SvDraw, needs
+ // to set the following flag. It affects the following object types:
+ // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL
+
+ // This flag should be regarded as temporary. The affected applications should
+ // be changed soon.
+ // Default = sal_False;
+ bool IsUseIncompatiblePathCreateInterface() const { return mbUseIncompatiblePathCreateInterface; }
+ void SetUseIncompatiblePathCreateInterface(bool bOn) { mbUseIncompatiblePathCreateInterface = bOn; }
+ void SetConnectMarker(const SdrObjConnection& rCon);
+ void HideConnectMarker();
+
+ // Attributes of the object that is in the process of being created
+ /* new interface src537 */
+ void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
+
+ bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
+ SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const;
+ void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
+};
+
+#endif // INCLUDED_SVX_SVDCRTV_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svddef.hxx b/include/svx/svddef.hxx
new file mode 100644
index 000000000..9332dc65a
--- /dev/null
+++ b/include/svx/svddef.hxx
@@ -0,0 +1,439 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDDEF_HXX
+#define INCLUDED_SVX_SVDDEF_HXX
+
+#include <svx/xdef.hxx>
+#include <svl/typedwhich.hxx>
+
+/*************************************************************************/
+// SdrItemPool V2, 09-11-1995:
+// 7 new Items for XLineAttrSetItem
+// 7 new Items for XFillAttrSetItem
+// 8 new Items for SdrShadowSetItem
+// 5 new Items for SdrCaptionSetItem
+// 25 new Items for SdrMiscSetItem
+// 6 new Items for SdrNotPersist
+// SdrItemPool V3, 29-02-1996
+// 17 new Items for XFillAttrSetItem (Bitmapfill)
+// SdrItemPool V4, 10-08-1996
+// 45 new Items for Edge and Measure (Connector and Measuring object)
+// SdrItemPool V4+, 18-10-1996
+// 8 new Items for CircItems
+// 18 new Items for NotPersist + Refactoring there
+// SdrItemPool V4++, 13-11-1996
+// 2 new Items for NotPersist+(MoveX/Y)
+// SdrItemPool V4+++, 07-06-1999
+// 15 new Items for NotPersist (Reserve)
+// 15 new Items for GrafItems
+
+// WhichMapping:
+// V1 Range = 1000..1065 (66)
+// V2 Range = 1000..1123 (124) (58 new Whiches)
+// V3 Range = 1000..1140 (141) (17 new Whiches)
+// V4 Range = 1000..1185 (186) (45 new Whiches)
+// Map V2: 10 6 20 4 11 6 9
+// V1: 1000..1009, 1010..1015, 1016..1035, 1036..1039, 1040..1050, 1051..1056 1057..1065
+// V2: 1000..1009, 1017..1022, 1030..1049, 1050..1053, 1062..1072, 1078..1083, 1109..1117, and 6 new ones appended at the end
+// |<------------ XOut ------------>| |<----------- SvDraw ----------->
+// Map V3:
+// V2: 1000..1029, 1030..1123
+// V3: 1000..1029, 1047..1140
+// Map V4:
+// V3: 1000..1126, 1127..1140
+// V4: 1000..1126, 1172..1185
+
+class SdrAllPositionXItem;
+class SdrAllPositionYItem;
+class SdrAllSizeHeightItem;
+class SdrAllSizeWidthItem;
+class SdrAngleItem;
+class SdrCaptionEscAbsItem;
+class SdrCaptionEscDirItem;
+class SdrCaptionEscIsRelItem;
+class SdrCaptionEscRelItem;
+class SdrCaptionFitLineLenItem;
+class SdrCaptionLineLenItem;
+class SdrCaptionTypeItem;
+class SdrCircKindItem;
+class SdrCustomShapeGeometryItem;
+class SdrEdgeKindItem;
+class SdrEdgeLineDeltaCountItem;
+class SdrEdgeNode1GlueDistItem;
+class SdrEdgeNode1HorzDistItem;
+class SdrEdgeNode1VertDistItem;
+class SdrEdgeNode2GlueDistItem;
+class SdrEdgeNode2HorzDistItem;
+class SdrEdgeNode2VertDistItem;
+class SdrGrafBlueItem;
+class SdrGrafContrastItem;
+class SdrGrafCropItem;
+class SdrGrafGamma100Item;
+class SdrGrafGreenItem;
+class SdrGrafInvertItem;
+class SdrGrafLuminanceItem;
+class SdrGrafModeItem;
+class SdrGrafRedItem;
+class SdrGrafTransparenceItem;
+class SdrHorzShearAllItem;
+class SdrHorzShearOneItem;
+class SdrLayerIdItem;
+class SdrLayerNameItem;
+class SdrLogicSizeHeightItem;
+class SdrLogicSizeWidthItem;
+class SdrMeasureBelowRefEdgeItem;
+class SdrMeasureDecimalPlacesItem;
+class SdrMeasureFormatStringItem;
+class SdrMeasureKindItem;
+class SdrMeasureOverhangItem;
+class SdrMeasureTextAutoAngleItem;
+class SdrMeasureTextFixedAngleItem;
+class SdrMeasureTextHPosItem;
+class SdrMeasureTextIsFixedAngleItem;
+class SdrMeasureTextRota90Item;
+class SdrMeasureTextVPosItem;
+class SdrMeasureUnitItem;
+class SdrMetricItem;
+class SdrMoveXItem;
+class SdrMoveYItem;
+class SdrObjPrintableItem;
+class SdrObjVisibleItem;
+class SdrOnOffItem;
+class SdrOnePositionXItem;
+class SdrOnePositionYItem;
+class SdrOneSizeHeightItem;
+class SdrOneSizeWidthItem;
+class SdrPercentItem;
+class SdrResizeXAllItem;
+class SdrResizeXOneItem;
+class SdrResizeYAllItem;
+class SdrResizeYOneItem;
+class SdrRotateOneItem;
+class SdrShearAngleItem;
+class SdrTextFitToSizeTypeItem;
+class SdrTextFixedCellHeightItem;
+class SdrTextVertAdjustItem;
+class SdrTransformRef1XItem;
+class SdrTransformRef1YItem;
+class SdrTransformRef2XItem;
+class SdrTransformRef2YItem;
+class SdrVertShearAllItem;
+class SdrVertShearOneItem;
+class SdrYesNoItem;
+class SfxBoolItem;
+class SfxInt16Item;
+class SfxUInt16Item;
+class SfxUInt32Item;
+class SfxStringItem;
+class SfxVoidItem;
+class Svx3DCharacterModeItem;
+class Svx3DCloseBackItem;
+class Svx3DCloseFrontItem;
+class Svx3DNormalsKindItem;
+class Svx3DPerspectiveItem;
+class Svx3DReducedLineGeometryItem;
+class Svx3DShadeModeItem;
+class Svx3DSmoothLidsItem;
+class Svx3DSmoothNormalsItem;
+class Svx3DTextureProjectionXItem;
+class Svx3DTextureProjectionYItem;
+class SvxB3DVectorItem;
+class SvxBoxInfoItem;
+class SvxBoxItem;
+class SvxColorItem;
+class SvxLineItem;
+class SvxTextRotateItem;
+class SvxWritingModeItem;
+class XColorItem;
+class SdrTextAniDirectionItem;
+class SdrTextAniKindItem;
+class SdrTextHorzAdjustItem;
+class SdrTextAniAmountItem;
+class SdrTextAniCountItem;
+class SdrTextAniStartInsideItem;
+class SdrTextAniStopInsideItem;
+class SdrTextAniDelayItem;
+class SdrMeasureScaleItem;
+class SdrRotateAllItem;
+class Svx3DTextureKindItem;
+class Svx3DTextureModeItem;
+class SvXMLAttrContainerItem;
+
+constexpr sal_uInt16 SDRATTR_START (XATTR_START); /* 1000 */
+ /* Pool V4*/ /* Pool V3*/ /* Pool V2*/
+constexpr sal_uInt16 SDRATTR_SHADOW_FIRST (XATTR_END + 1); /* 1067 */ /* 1067 */ /* 1050 */ /* Pool V1: 1036 */
+constexpr TypedWhichId<SdrOnOffItem> SDRATTR_SHADOW (SDRATTR_SHADOW_FIRST+ 0); /* 1067 */ /* 1067 */ /* 1050 */
+constexpr TypedWhichId<XColorItem> SDRATTR_SHADOWCOLOR (SDRATTR_SHADOW_FIRST+ 1); /* 1068 */ /* 1068 */ /* 1051 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_SHADOWXDIST (SDRATTR_SHADOW_FIRST+ 2); /* 1069 */ /* 1069 */ /* 1052 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_SHADOWYDIST (SDRATTR_SHADOW_FIRST+ 3); /* 1070 */ /* 1070 */ /* 1053 */
+constexpr TypedWhichId<SdrPercentItem> SDRATTR_SHADOWTRANSPARENCE (SDRATTR_SHADOW_FIRST+ 4); /* 1071 */ /* 1071 */ /* 1054 */ /* Pool V2 */
+constexpr TypedWhichId<SfxVoidItem> SDRATTR_SHADOW3D (SDRATTR_SHADOW_FIRST+ 5); /* 1072 */ /* 1072 */ /* 1055 */ /* Pool V2 */
+constexpr TypedWhichId<SfxVoidItem> SDRATTR_SHADOWPERSP (SDRATTR_SHADOW_FIRST+ 6); /* 1073 */ /* 1073 */ /* 1056 */ /* Pool V2 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_SHADOWSIZEX (SDRATTR_SHADOW_FIRST+ 7);
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_SHADOWSIZEY (SDRATTR_SHADOW_FIRST+ 8);
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_SHADOWBLUR (SDRATTR_SHADOW_FIRST+ 9);
+constexpr sal_uInt16 SDRATTR_SHADOW_LAST (SDRATTR_SHADOWBLUR); /* 1078 */ /* 1078 */ /* 1061 */ /* Pool V1: 1039 */
+
+constexpr sal_uInt16 SDRATTR_CAPTION_FIRST (SDRATTR_SHADOW_LAST + 1); /* 1080 */ /* 1080 */ /* 1063 */ /* Pool V1: 1041 */
+constexpr TypedWhichId<SdrCaptionTypeItem> SDRATTR_CAPTIONTYPE (SDRATTR_CAPTION_FIRST+ 0); /* 1080 */ /* 1080 */ /* 1063 */
+constexpr TypedWhichId<SdrOnOffItem> SDRATTR_CAPTIONFIXEDANGLE (SDRATTR_CAPTION_FIRST+ 1); /* 1081 */ /* 1081 */ /* 1064 */
+constexpr TypedWhichId<SdrAngleItem> SDRATTR_CAPTIONANGLE (SDRATTR_CAPTION_FIRST+ 2); /* 1082 */ /* 1082 */ /* 1065 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_CAPTIONGAP (SDRATTR_CAPTION_FIRST+ 3); /* 1083 */ /* 1083 */ /* 1066 */
+constexpr TypedWhichId<SdrCaptionEscDirItem> SDRATTR_CAPTIONESCDIR (SDRATTR_CAPTION_FIRST+ 4); /* 1084 */ /* 1084 */ /* 1067 */
+constexpr TypedWhichId<SdrCaptionEscIsRelItem> SDRATTR_CAPTIONESCISREL (SDRATTR_CAPTION_FIRST+ 5); /* 1085 */ /* 1085 */ /* 1068 */
+constexpr TypedWhichId<SdrCaptionEscRelItem> SDRATTR_CAPTIONESCREL (SDRATTR_CAPTION_FIRST+ 6); /* 1086 */ /* 1086 */ /* 1069 */
+constexpr TypedWhichId<SdrCaptionEscAbsItem> SDRATTR_CAPTIONESCABS (SDRATTR_CAPTION_FIRST+ 7); /* 1087 */ /* 1087 */ /* 1070 */
+constexpr TypedWhichId<SdrCaptionLineLenItem> SDRATTR_CAPTIONLINELEN (SDRATTR_CAPTION_FIRST+ 8); /* 1088 */ /* 1088 */ /* 1071 */
+constexpr TypedWhichId<SdrCaptionFitLineLenItem> SDRATTR_CAPTIONFITLINELEN (SDRATTR_CAPTION_FIRST+ 9); /* 1089 */ /* 1089 */ /* 1072 */
+constexpr sal_uInt16 SDRATTR_CAPTION_LAST (SDRATTR_CAPTIONFITLINELEN); /* 1094 */ /* 1094 */ /* 1077 */ /* Pool V1: 1050 */
+
+constexpr sal_uInt16 SDRATTR_MISC_FIRST (SDRATTR_CAPTION_LAST + 1); /* 1097 */ /* 1097 */ /* 1080 */ /* Pool V1: 1053 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_CORNER_RADIUS (SDRATTR_MISC_FIRST + 0); /* 1097 */ /* 1097 */ /* 1080 long, def=0 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_TEXT_MINFRAMEHEIGHT (SDRATTR_MISC_FIRST + 1); /* 1098 */ /* 1098 */ /* 1081 long, def=0 */
+constexpr TypedWhichId<SdrOnOffItem> SDRATTR_TEXT_AUTOGROWHEIGHT (SDRATTR_MISC_FIRST + 2); /* 1099 */ /* 1099 */ /* 1082 sal_Bool, def=sal_True */
+constexpr TypedWhichId<SdrTextFitToSizeTypeItem> SDRATTR_TEXT_FITTOSIZE (SDRATTR_MISC_FIRST + 3); /* 1100 */ /* 1100 */ /* 1083 enum, def=css::drawing::TextFitToSizeType_NONE */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_TEXT_LEFTDIST (SDRATTR_MISC_FIRST + 4); /* 1101 */ /* 1101 */ /* 1084 long, def=0 */ /* Pool V2 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_TEXT_RIGHTDIST (SDRATTR_MISC_FIRST + 5); /* 1102 */ /* 1102 */ /* 1085 long, def=0 */ /* Pool V2 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_TEXT_UPPERDIST (SDRATTR_MISC_FIRST + 6); /* 1103 */ /* 1103 */ /* 1086 long, def=0 */ /* Pool V2 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_TEXT_LOWERDIST (SDRATTR_MISC_FIRST + 7); /* 1104 */ /* 1104 */ /* 1087 long, def=0 */ /* Pool V2 */
+constexpr TypedWhichId<SdrTextVertAdjustItem> SDRATTR_TEXT_VERTADJUST (SDRATTR_MISC_FIRST + 8); /* 1105 */ /* 1105 */ /* 1088 enum, def=SDRTEXTVERTADJUST_TOP */ /* Pool V2 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_TEXT_MAXFRAMEHEIGHT (SDRATTR_MISC_FIRST + 9); /* 1106 */ /* 1106 */ /* 1089 long, def=0 - Pool V2 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_TEXT_MINFRAMEWIDTH (SDRATTR_MISC_FIRST +10); /* 1107 */ /* 1107 */ /* 1090 long, def=0 - Pool V2 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_TEXT_MAXFRAMEWIDTH (SDRATTR_MISC_FIRST +11); /* 1108 */ /* 1108 */ /* 1091 long, def=0 - Pool V2 */
+constexpr TypedWhichId<SdrOnOffItem> SDRATTR_TEXT_AUTOGROWWIDTH (SDRATTR_MISC_FIRST +12); /* 1109 */ /* 1109 */ /* 1092 sal_Bool, def=sal_False - Pool V2 */
+constexpr TypedWhichId<SdrTextHorzAdjustItem> SDRATTR_TEXT_HORZADJUST (SDRATTR_MISC_FIRST +13); /* 1110 */ /* 1110 */ /* 1093 enum, def=SDRTEXTHORZADJUST_LEFT */ /* Pool V2+ (04-12-1995) */
+constexpr TypedWhichId<SdrTextAniKindItem> SDRATTR_TEXT_ANIKIND (SDRATTR_MISC_FIRST +14); /* 1111 */ /* 1111 */ /* 1094 enum, def=SdrTextAniKind::NONE - Pool V2/V4 */
+constexpr TypedWhichId<SdrTextAniDirectionItem> SDRATTR_TEXT_ANIDIRECTION (SDRATTR_MISC_FIRST +15); /* 1112 */ /* 1112 */ /* 1095 enum, def=SdrTextAniDirection::Left - Pool V2/V4 */
+constexpr TypedWhichId<SdrTextAniStartInsideItem> SDRATTR_TEXT_ANISTARTINSIDE (SDRATTR_MISC_FIRST +16); /* 1113 */ /* 1113 */ /* 1096 sal_Bool, def=sal_False - Pool V2/V4 */
+constexpr TypedWhichId<SdrTextAniStopInsideItem> SDRATTR_TEXT_ANISTOPINSIDE (SDRATTR_MISC_FIRST +17); /* 1114 */ /* 1114 */ /* 1097 sal_Bool, def=sal_False - Pool V2/V4 */
+constexpr TypedWhichId<SdrTextAniCountItem> SDRATTR_TEXT_ANICOUNT (SDRATTR_MISC_FIRST +18); /* 1115 */ /* 1115 */ /* 1098 sal_uInt16, def=0 - Pool V2/V4 */
+constexpr TypedWhichId<SdrTextAniDelayItem> SDRATTR_TEXT_ANIDELAY (SDRATTR_MISC_FIRST +19); /* 1116 */ /* 1116 */ /* 1099 sal_uInt16, def=0 - Pool V2/V4 */
+constexpr TypedWhichId<SdrTextAniAmountItem> SDRATTR_TEXT_ANIAMOUNT (SDRATTR_MISC_FIRST +20); /* 1117 */ /* 1117 */ /* 1100 sal_uInt16, def=0 - Pool V2/V4 */
+constexpr TypedWhichId<SdrOnOffItem> SDRATTR_TEXT_CONTOURFRAME (SDRATTR_MISC_FIRST +21); /* 1118 */ /* 1118 */ /* 1101 */ /* Pool V2 */
+constexpr TypedWhichId<SvXMLAttrContainerItem> SDRATTR_XMLATTRIBUTES (SDRATTR_MISC_FIRST +22); /* 1120 */ /* 1120 */ /* 1103 */ /* Pool V2 */
+constexpr TypedWhichId<SdrTextFixedCellHeightItem> SDRATTR_TEXT_USEFIXEDCELLHEIGHT (SDRATTR_MISC_FIRST +23); /* 1121 */ /* 1121 */ /* 1104 */ /* Pool V2 */
+constexpr TypedWhichId<SdrOnOffItem> SDRATTR_TEXT_WORDWRAP (SDRATTR_MISC_FIRST +24); /* 1122 */ /* 1122 */ /* 1105 */ /* Pool V2 */
+constexpr TypedWhichId<SfxStringItem> SDRATTR_TEXT_CHAINNEXTNAME (SDRATTR_MISC_FIRST +25); /* 1123 */ /* 1123 */ /* 1106 */ /* Pool V2 */
+constexpr sal_uInt16 SDRATTR_MISC_LAST (SDRATTR_TEXT_CHAINNEXTNAME); /* 1125 */ /* 1125 */ /* 1108 */ /* Pool V1: 1056 */
+
+constexpr sal_uInt16 SDRATTR_EDGE_FIRST (SDRATTR_MISC_LAST + 1); /* 1127 */ /* Pool V4 */
+constexpr TypedWhichId<SdrEdgeKindItem> SDRATTR_EDGEKIND (SDRATTR_EDGE_FIRST + 0); /* 1127 */ /* Pool V4 */
+constexpr TypedWhichId<SdrEdgeNode1HorzDistItem> SDRATTR_EDGENODE1HORZDIST (SDRATTR_EDGE_FIRST + 1); /* 1128 */ /* Pool V4 */
+constexpr TypedWhichId<SdrEdgeNode1VertDistItem> SDRATTR_EDGENODE1VERTDIST (SDRATTR_EDGE_FIRST + 2); /* 1129 */ /* Pool V4 */
+constexpr TypedWhichId<SdrEdgeNode2HorzDistItem> SDRATTR_EDGENODE2HORZDIST (SDRATTR_EDGE_FIRST + 3); /* 1130 */ /* Pool V4 */
+constexpr TypedWhichId<SdrEdgeNode2VertDistItem> SDRATTR_EDGENODE2VERTDIST (SDRATTR_EDGE_FIRST + 4); /* 1131 */ /* Pool V4 */
+constexpr TypedWhichId<SdrEdgeNode1GlueDistItem> SDRATTR_EDGENODE1GLUEDIST (SDRATTR_EDGE_FIRST + 5); /* 1132 */ /* Pool V4 */
+constexpr TypedWhichId<SdrEdgeNode2GlueDistItem> SDRATTR_EDGENODE2GLUEDIST (SDRATTR_EDGE_FIRST + 6); /* 1133 */ /* Pool V4 */
+constexpr TypedWhichId<SdrEdgeLineDeltaCountItem> SDRATTR_EDGELINEDELTACOUNT (SDRATTR_EDGE_FIRST + 7); /* 1134 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_EDGELINE1DELTA (SDRATTR_EDGE_FIRST + 8); /* 1135 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_EDGELINE2DELTA (SDRATTR_EDGE_FIRST + 9); /* 1136 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_EDGELINE3DELTA (SDRATTR_EDGE_FIRST +10); /* 1137 */ /* Pool V4 */
+constexpr sal_uInt16 SDRATTR_EDGE_LAST (SDRATTR_EDGELINE3DELTA); /* 1145 */ /* Pool V4 */
+
+constexpr sal_uInt16 SDRATTR_MEASURE_FIRST (SDRATTR_EDGE_LAST + 1); /* 1147 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMeasureKindItem> SDRATTR_MEASUREKIND (SDRATTR_MEASURE_FIRST+ 0); /* 1147 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMeasureTextHPosItem> SDRATTR_MEASURETEXTHPOS (SDRATTR_MEASURE_FIRST+ 1); /* 1148 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMeasureTextVPosItem> SDRATTR_MEASURETEXTVPOS (SDRATTR_MEASURE_FIRST+ 2); /* 1149 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_MEASURELINEDIST (SDRATTR_MEASURE_FIRST+ 3); /* 1150 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_MEASUREHELPLINEOVERHANG (SDRATTR_MEASURE_FIRST+ 4); /* 1151 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_MEASUREHELPLINEDIST (SDRATTR_MEASURE_FIRST+ 5); /* 1152 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_MEASUREHELPLINE1LEN (SDRATTR_MEASURE_FIRST+ 6); /* 1153 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_MEASUREHELPLINE2LEN (SDRATTR_MEASURE_FIRST+ 7); /* 1154 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMeasureBelowRefEdgeItem> SDRATTR_MEASUREBELOWREFEDGE (SDRATTR_MEASURE_FIRST+ 8); /* 1155 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMeasureTextRota90Item> SDRATTR_MEASURETEXTROTA90 (SDRATTR_MEASURE_FIRST+ 9); /* 1156 */ /* Pool V4 */
+constexpr TypedWhichId<SdrYesNoItem> SDRATTR_MEASURETEXTUPSIDEDOWN (SDRATTR_MEASURE_FIRST+10); /* 1157 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMeasureOverhangItem> SDRATTR_MEASUREOVERHANG (SDRATTR_MEASURE_FIRST+11); /* 1158 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMeasureUnitItem> SDRATTR_MEASUREUNIT (SDRATTR_MEASURE_FIRST+12); /* 1159 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMeasureScaleItem> SDRATTR_MEASURESCALE (SDRATTR_MEASURE_FIRST+13); /* 1160 */ /* Pool V4 */
+constexpr TypedWhichId<SdrYesNoItem> SDRATTR_MEASURESHOWUNIT (SDRATTR_MEASURE_FIRST+14); /* 1161 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMeasureFormatStringItem> SDRATTR_MEASUREFORMATSTRING (SDRATTR_MEASURE_FIRST+15); /* 1162 */ /* Pool V4 */
+constexpr TypedWhichId<SdrMeasureTextAutoAngleItem> SDRATTR_MEASURETEXTAUTOANGLE (SDRATTR_MEASURE_FIRST+16); /* 1163 */ /* Pool V4, Correction 25-9-1996 */
+constexpr TypedWhichId<SdrAngleItem> SDRATTR_MEASURETEXTAUTOANGLEVIEW (SDRATTR_MEASURE_FIRST+17); /* 1164 */ /* Pool V4, Correction 25-9-1996 */
+constexpr TypedWhichId<SdrMeasureTextIsFixedAngleItem> SDRATTR_MEASURETEXTISFIXEDANGLE (SDRATTR_MEASURE_FIRST+18); /* 1165 */ /* Pool V4, Correction 25-9-1996 */
+constexpr TypedWhichId<SdrMeasureTextFixedAngleItem> SDRATTR_MEASURETEXTFIXEDANGLE (SDRATTR_MEASURE_FIRST+19); /* 1166 */ /* Pool V4, Correction 25-9-1996 */
+constexpr TypedWhichId<SdrMeasureDecimalPlacesItem> SDRATTR_MEASUREDECIMALPLACES (SDRATTR_MEASURE_FIRST+20); /* 1167 */ /* Pool V4 */
+constexpr sal_uInt16 SDRATTR_MEASURE_LAST (SDRATTR_MEASUREDECIMALPLACES); /* 1170 */ /* Pool V4 */
+
+constexpr sal_uInt16 SDRATTR_CIRC_FIRST (SDRATTR_MEASURE_LAST+ 1); /* 1172 */ /* Pool V4+ */
+constexpr TypedWhichId<SdrCircKindItem> SDRATTR_CIRCKIND (SDRATTR_CIRC_FIRST+ 0); /* 1172 */ /* Pool V4+ */
+constexpr TypedWhichId<SdrAngleItem> SDRATTR_CIRCSTARTANGLE (SDRATTR_CIRC_FIRST+ 1); /* 1173 */ /* Pool V4+ */
+constexpr TypedWhichId<SdrAngleItem> SDRATTR_CIRCENDANGLE (SDRATTR_CIRC_FIRST+ 2); /* 1174 */ /* Pool V4+ */
+constexpr sal_uInt16 SDRATTR_CIRC_LAST (SDRATTR_CIRCENDANGLE); /* 1178 */ /* Pool V4+ */
+
+// Only for Interfacing, not yet implemented. / * + * V4 /
+constexpr sal_uInt16 SDRATTR_NOTPERSIST_FIRST (SDRATTR_CIRC_LAST + 1); /* 1180 */ /* 1172 */ /* 1127 */ /* 1110 */ /* Pool V1: 1058 */
+constexpr TypedWhichId<SdrYesNoItem> SDRATTR_OBJMOVEPROTECT (SDRATTR_NOTPERSIST_FIRST+ 0); /* 1180 sal_Bool, def=sal_False */
+constexpr TypedWhichId<SdrYesNoItem> SDRATTR_OBJSIZEPROTECT (SDRATTR_NOTPERSIST_FIRST+ 1); /* 1181 sal_Bool, def=sal_False */
+constexpr TypedWhichId<SdrObjPrintableItem> SDRATTR_OBJPRINTABLE (SDRATTR_NOTPERSIST_FIRST+ 2); /* 1182 sal_Bool, def=sal_True */
+constexpr TypedWhichId<SdrLayerIdItem> SDRATTR_LAYERID (SDRATTR_NOTPERSIST_FIRST+ 3); /* 1183 sal_uInt16, def=0 */
+constexpr TypedWhichId<SdrLayerNameItem> SDRATTR_LAYERNAME (SDRATTR_NOTPERSIST_FIRST+ 4); /* 1184 String, def="" */
+constexpr TypedWhichId<SfxStringItem> SDRATTR_OBJECTNAME (SDRATTR_NOTPERSIST_FIRST+ 5); /* 1185 String, def="" */
+constexpr TypedWhichId<SdrAllPositionXItem> SDRATTR_ALLPOSITIONX (SDRATTR_NOTPERSIST_FIRST+ 6); /* 1186 long, def=0 */
+constexpr TypedWhichId<SdrAllPositionYItem> SDRATTR_ALLPOSITIONY (SDRATTR_NOTPERSIST_FIRST+ 7); /* 1187 long, def=0 */
+constexpr TypedWhichId<SdrAllSizeWidthItem> SDRATTR_ALLSIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+ 8); /* 1188 long, def=0 */
+constexpr TypedWhichId<SdrAllSizeHeightItem> SDRATTR_ALLSIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+ 9); /* 1189 long, def=0 */
+constexpr TypedWhichId<SdrOnePositionXItem> SDRATTR_ONEPOSITIONX (SDRATTR_NOTPERSIST_FIRST+10); /* 1190 long, def=0 */
+constexpr TypedWhichId<SdrOnePositionYItem> SDRATTR_ONEPOSITIONY (SDRATTR_NOTPERSIST_FIRST+11); /* 1191 long, def=0 */
+constexpr TypedWhichId<SdrOneSizeWidthItem> SDRATTR_ONESIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+12); /* 1192 long, def=0 */
+constexpr TypedWhichId<SdrOneSizeHeightItem> SDRATTR_ONESIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+13); /* 1193 long, def=0 */
+constexpr TypedWhichId<SdrLogicSizeWidthItem> SDRATTR_LOGICSIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+14); /* 1194 long, def=0 */
+constexpr TypedWhichId<SdrLogicSizeHeightItem> SDRATTR_LOGICSIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+15); /* 1195 long, def=0 */
+constexpr TypedWhichId<SdrAngleItem> SDRATTR_ROTATEANGLE (SDRATTR_NOTPERSIST_FIRST+16); /* 1196 long, def=0 */
+constexpr TypedWhichId<SdrShearAngleItem> SDRATTR_SHEARANGLE (SDRATTR_NOTPERSIST_FIRST+17); /* 1197 long, def=0 */
+constexpr TypedWhichId<SdrMoveXItem> SDRATTR_MOVEX (SDRATTR_NOTPERSIST_FIRST+18); /* 1198 long, def=0 */
+constexpr TypedWhichId<SdrMoveYItem> SDRATTR_MOVEY (SDRATTR_NOTPERSIST_FIRST+19); /* 1199 long, def=0 */
+constexpr TypedWhichId<SdrResizeXOneItem> SDRATTR_RESIZEXONE (SDRATTR_NOTPERSIST_FIRST+20); /* 1200 long, def=0 */
+constexpr TypedWhichId<SdrResizeYOneItem> SDRATTR_RESIZEYONE (SDRATTR_NOTPERSIST_FIRST+21); /* 1201 long, def=0 */
+constexpr TypedWhichId<SdrRotateOneItem> SDRATTR_ROTATEONE (SDRATTR_NOTPERSIST_FIRST+22); /* 1202 long, def=0 */
+constexpr TypedWhichId<SdrHorzShearOneItem> SDRATTR_HORZSHEARONE (SDRATTR_NOTPERSIST_FIRST+23); /* 1203 long, def=0 */
+constexpr TypedWhichId<SdrVertShearOneItem> SDRATTR_VERTSHEARONE (SDRATTR_NOTPERSIST_FIRST+24); /* 1204 long, def=0 */
+constexpr TypedWhichId<SdrResizeXAllItem> SDRATTR_RESIZEXALL (SDRATTR_NOTPERSIST_FIRST+25); /* 1205 long, def=0 */
+constexpr TypedWhichId<SdrResizeYAllItem> SDRATTR_RESIZEYALL (SDRATTR_NOTPERSIST_FIRST+26); /* 1206 long, def=0 */
+constexpr TypedWhichId<SdrRotateAllItem> SDRATTR_ROTATEALL (SDRATTR_NOTPERSIST_FIRST+27); /* 1207 long, def=0 */
+constexpr TypedWhichId<SdrHorzShearAllItem> SDRATTR_HORZSHEARALL (SDRATTR_NOTPERSIST_FIRST+28); /* 1208 long, def=0 */
+constexpr TypedWhichId<SdrVertShearAllItem> SDRATTR_VERTSHEARALL (SDRATTR_NOTPERSIST_FIRST+29); /* 1209 long, def=0 */
+constexpr TypedWhichId<SdrTransformRef1XItem> SDRATTR_TRANSFORMREF1X (SDRATTR_NOTPERSIST_FIRST+30); /* 1210 long, def=0 */
+constexpr TypedWhichId<SdrTransformRef1YItem> SDRATTR_TRANSFORMREF1Y (SDRATTR_NOTPERSIST_FIRST+31); /* 1211 long, def=0 */
+constexpr TypedWhichId<SdrTransformRef2XItem> SDRATTR_TRANSFORMREF2X (SDRATTR_NOTPERSIST_FIRST+32); /* 1212 long, def=0 */
+constexpr TypedWhichId<SdrTransformRef2YItem> SDRATTR_TRANSFORMREF2Y (SDRATTR_NOTPERSIST_FIRST+33); /* 1213 long, def=0 */
+constexpr TypedWhichId<SvxWritingModeItem> SDRATTR_TEXTDIRECTION (SDRATTR_NOTPERSIST_FIRST+34); /* 1214 V4+++ long, def=0 */
+constexpr TypedWhichId<SdrObjVisibleItem> SDRATTR_OBJVISIBLE (SDRATTR_NOTPERSIST_FIRST+35);
+constexpr sal_uInt16 SDRATTR_NOTPERSIST_LAST (SDRATTR_OBJVISIBLE); /* 1228 V4+++*/ /* 1213*/ /* 1085 */ /* 1040 */ /* 1123 */ /* Pool V1: 1065 */
+// no SetItem for this
+
+constexpr sal_uInt16 SDRATTR_GRAF_FIRST (SDRATTR_NOTPERSIST_LAST+1); /* 1229 V4+++*/
+constexpr TypedWhichId<SdrGrafRedItem> SDRATTR_GRAFRED (SDRATTR_GRAF_FIRST+0); /* 1229 V4+++*/
+constexpr TypedWhichId<SdrGrafGreenItem> SDRATTR_GRAFGREEN (SDRATTR_GRAF_FIRST+1); /* 1230 V4+++*/
+constexpr TypedWhichId<SdrGrafBlueItem> SDRATTR_GRAFBLUE (SDRATTR_GRAF_FIRST+2); /* 1231 V4+++*/
+constexpr TypedWhichId<SdrGrafLuminanceItem> SDRATTR_GRAFLUMINANCE (SDRATTR_GRAF_FIRST+3); /* 1232 V4+++*/
+constexpr TypedWhichId<SdrGrafContrastItem> SDRATTR_GRAFCONTRAST (SDRATTR_GRAF_FIRST+4); /* 1233 V4+++*/
+constexpr TypedWhichId<SdrGrafGamma100Item> SDRATTR_GRAFGAMMA (SDRATTR_GRAF_FIRST+5); /* 1234 V4+++*/
+constexpr TypedWhichId<SdrGrafTransparenceItem> SDRATTR_GRAFTRANSPARENCE (SDRATTR_GRAF_FIRST+6); /* 1235 V4+++*/
+constexpr TypedWhichId<SdrGrafInvertItem> SDRATTR_GRAFINVERT (SDRATTR_GRAF_FIRST+7); /* 1236 V4+++*/
+constexpr TypedWhichId<SdrGrafModeItem> SDRATTR_GRAFMODE (SDRATTR_GRAF_FIRST+8); /* 1237 V4+++*/
+constexpr TypedWhichId<SdrGrafCropItem> SDRATTR_GRAFCROP (SDRATTR_GRAF_FIRST+9); /* 1238 V4+++*/
+constexpr sal_uInt16 SDRATTR_GRAF_LAST (SDRATTR_GRAFCROP); /* 1242 V4+++*/
+
+constexpr sal_uInt16 SDRATTR_3D_FIRST (SDRATTR_GRAF_LAST + 1); /* 1244 V4+++*/
+
+constexpr sal_uInt16 SDRATTR_3DOBJ_FIRST (SDRATTR_3D_FIRST); /* 1244 V4+++*/
+constexpr TypedWhichId<SfxUInt16Item> SDRATTR_3DOBJ_PERCENT_DIAGONAL (SDRATTR_3DOBJ_FIRST + 0); /* 1244 V4+++*/
+constexpr TypedWhichId<SfxUInt16Item> SDRATTR_3DOBJ_BACKSCALE (SDRATTR_3DOBJ_FIRST + 1); /* 1245 V4+++*/
+constexpr TypedWhichId<SfxUInt32Item> SDRATTR_3DOBJ_DEPTH (SDRATTR_3DOBJ_FIRST + 2); /* 1246 V4+++*/
+constexpr TypedWhichId<SfxUInt32Item> SDRATTR_3DOBJ_HORZ_SEGS (SDRATTR_3DOBJ_FIRST + 3); /* 1247 V4+++*/
+constexpr TypedWhichId<SfxUInt32Item> SDRATTR_3DOBJ_VERT_SEGS (SDRATTR_3DOBJ_FIRST + 4); /* 1248 V4+++*/
+constexpr TypedWhichId<SfxUInt32Item> SDRATTR_3DOBJ_END_ANGLE (SDRATTR_3DOBJ_FIRST + 5); /* 1249 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DOBJ_DOUBLE_SIDED (SDRATTR_3DOBJ_FIRST + 6); /* 1250 V4+++*/
+constexpr TypedWhichId<Svx3DNormalsKindItem> SDRATTR_3DOBJ_NORMALS_KIND (SDRATTR_3DOBJ_FIRST + 7); /* 1251 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DOBJ_NORMALS_INVERT (SDRATTR_3DOBJ_FIRST + 8); /* 1252 V4+++*/
+constexpr TypedWhichId<Svx3DTextureProjectionXItem> SDRATTR_3DOBJ_TEXTURE_PROJ_X (SDRATTR_3DOBJ_FIRST + 9); /* 1253 V4+++*/
+constexpr TypedWhichId<Svx3DTextureProjectionYItem> SDRATTR_3DOBJ_TEXTURE_PROJ_Y (SDRATTR_3DOBJ_FIRST + 10); /* 1254 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DOBJ_SHADOW_3D (SDRATTR_3DOBJ_FIRST + 11); /* 1255 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DOBJ_MAT_COLOR (SDRATTR_3DOBJ_FIRST + 12); /* 1256 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DOBJ_MAT_EMISSION (SDRATTR_3DOBJ_FIRST + 13); /* 1257 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DOBJ_MAT_SPECULAR (SDRATTR_3DOBJ_FIRST + 14); /* 1258 V4+++*/
+constexpr TypedWhichId<SfxUInt16Item> SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY (SDRATTR_3DOBJ_FIRST + 15); /* 1259 V4+++*/
+constexpr TypedWhichId<Svx3DTextureKindItem> SDRATTR_3DOBJ_TEXTURE_KIND (SDRATTR_3DOBJ_FIRST + 16); /* 1260 V4+++*/
+constexpr TypedWhichId<Svx3DTextureModeItem> SDRATTR_3DOBJ_TEXTURE_MODE (SDRATTR_3DOBJ_FIRST + 17); /* 1261 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DOBJ_TEXTURE_FILTER (SDRATTR_3DOBJ_FIRST + 18); /* 1262 V4+++*/
+
+// #107245# New items for 3d objects use former range SDRATTR_3DOBJ_RESERVED_01
+// up to SDRATTR_3DOBJ_RESERVED_05
+constexpr TypedWhichId<Svx3DSmoothNormalsItem> SDRATTR_3DOBJ_SMOOTH_NORMALS (SDRATTR_3DOBJ_FIRST + 19); /* 1263 V4+++*/
+constexpr TypedWhichId<Svx3DSmoothLidsItem> SDRATTR_3DOBJ_SMOOTH_LIDS (SDRATTR_3DOBJ_FIRST + 20); /* 1264 V4+++*/
+constexpr TypedWhichId<Svx3DCharacterModeItem> SDRATTR_3DOBJ_CHARACTER_MODE (SDRATTR_3DOBJ_FIRST + 21); /* 1265 V4+++*/
+constexpr TypedWhichId<Svx3DCloseFrontItem> SDRATTR_3DOBJ_CLOSE_FRONT (SDRATTR_3DOBJ_FIRST + 22); /* 1266 V4+++*/
+constexpr TypedWhichId<Svx3DCloseBackItem> SDRATTR_3DOBJ_CLOSE_BACK (SDRATTR_3DOBJ_FIRST + 23); /* 1267 V4+++*/
+
+// #i28528#
+// Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+constexpr TypedWhichId<Svx3DReducedLineGeometryItem> SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY (SDRATTR_3DOBJ_FIRST + 24); /* 1268 V4+++*/
+
+constexpr sal_uInt16 SDRATTR_3DOBJ_LAST (SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY); /* 1282 V4+++*/
+
+constexpr sal_uInt16 SDRATTR_3DSCENE_FIRST (SDRATTR_3DOBJ_LAST + 1); /* 1283 V4+++*/
+constexpr TypedWhichId<Svx3DPerspectiveItem> SDRATTR_3DSCENE_PERSPECTIVE (SDRATTR_3DSCENE_FIRST + 0); /* 1283 V4+++*/
+constexpr TypedWhichId<SfxUInt32Item> SDRATTR_3DSCENE_DISTANCE (SDRATTR_3DSCENE_FIRST + 1); /* 1284 V4+++*/
+constexpr TypedWhichId<SfxUInt32Item> SDRATTR_3DSCENE_FOCAL_LENGTH (SDRATTR_3DSCENE_FIRST + 2); /* 1285 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DSCENE_TWO_SIDED_LIGHTING (SDRATTR_3DSCENE_FIRST + 3); /* 1286 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DSCENE_LIGHTCOLOR_1 (SDRATTR_3DSCENE_FIRST + 4); /* 1287 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DSCENE_LIGHTCOLOR_2 (SDRATTR_3DSCENE_FIRST + 5); /* 1288 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DSCENE_LIGHTCOLOR_3 (SDRATTR_3DSCENE_FIRST + 6); /* 1289 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DSCENE_LIGHTCOLOR_4 (SDRATTR_3DSCENE_FIRST + 7); /* 1290 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DSCENE_LIGHTCOLOR_5 (SDRATTR_3DSCENE_FIRST + 8); /* 1291 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DSCENE_LIGHTCOLOR_6 (SDRATTR_3DSCENE_FIRST + 9); /* 1292 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DSCENE_LIGHTCOLOR_7 (SDRATTR_3DSCENE_FIRST + 10); /* 1293 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DSCENE_LIGHTCOLOR_8 (SDRATTR_3DSCENE_FIRST + 11); /* 1294 V4+++*/
+constexpr TypedWhichId<SvxColorItem> SDRATTR_3DSCENE_AMBIENTCOLOR (SDRATTR_3DSCENE_FIRST + 12); /* 1295 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DSCENE_LIGHTON_1 (SDRATTR_3DSCENE_FIRST + 13); /* 1296 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DSCENE_LIGHTON_2 (SDRATTR_3DSCENE_FIRST + 14); /* 1297 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DSCENE_LIGHTON_3 (SDRATTR_3DSCENE_FIRST + 15); /* 1298 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DSCENE_LIGHTON_4 (SDRATTR_3DSCENE_FIRST + 16); /* 1299 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DSCENE_LIGHTON_5 (SDRATTR_3DSCENE_FIRST + 17); /* 1300 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DSCENE_LIGHTON_6 (SDRATTR_3DSCENE_FIRST + 18); /* 1301 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DSCENE_LIGHTON_7 (SDRATTR_3DSCENE_FIRST + 19); /* 1302 V4+++*/
+constexpr TypedWhichId<SfxBoolItem> SDRATTR_3DSCENE_LIGHTON_8 (SDRATTR_3DSCENE_FIRST + 20); /* 1303 V4+++*/
+constexpr TypedWhichId<SvxB3DVectorItem> SDRATTR_3DSCENE_LIGHTDIRECTION_1 (SDRATTR_3DSCENE_FIRST + 21); /* 1304 V4+++*/
+constexpr TypedWhichId<SvxB3DVectorItem> SDRATTR_3DSCENE_LIGHTDIRECTION_2 (SDRATTR_3DSCENE_FIRST + 22); /* 1305 V4+++*/
+constexpr TypedWhichId<SvxB3DVectorItem> SDRATTR_3DSCENE_LIGHTDIRECTION_3 (SDRATTR_3DSCENE_FIRST + 23); /* 1306 V4+++*/
+constexpr TypedWhichId<SvxB3DVectorItem> SDRATTR_3DSCENE_LIGHTDIRECTION_4 (SDRATTR_3DSCENE_FIRST + 24); /* 1307 V4+++*/
+constexpr TypedWhichId<SvxB3DVectorItem> SDRATTR_3DSCENE_LIGHTDIRECTION_5 (SDRATTR_3DSCENE_FIRST + 25); /* 1308 V4+++*/
+constexpr TypedWhichId<SvxB3DVectorItem> SDRATTR_3DSCENE_LIGHTDIRECTION_6 (SDRATTR_3DSCENE_FIRST + 26); /* 1309 V4+++*/
+constexpr TypedWhichId<SvxB3DVectorItem> SDRATTR_3DSCENE_LIGHTDIRECTION_7 (SDRATTR_3DSCENE_FIRST + 27); /* 1310 V4+++*/
+constexpr TypedWhichId<SvxB3DVectorItem> SDRATTR_3DSCENE_LIGHTDIRECTION_8 (SDRATTR_3DSCENE_FIRST + 28); /* 1311 V4+++*/
+constexpr TypedWhichId<SfxUInt16Item> SDRATTR_3DSCENE_SHADOW_SLANT (SDRATTR_3DSCENE_FIRST + 29); /* 1312 V4+++*/
+constexpr TypedWhichId<Svx3DShadeModeItem> SDRATTR_3DSCENE_SHADE_MODE (SDRATTR_3DSCENE_FIRST + 30); /* 1313 V4+++*/
+constexpr sal_uInt16 SDRATTR_3DSCENE_LAST (SDRATTR_3DSCENE_SHADE_MODE); /* 1333 V4+++*/
+constexpr sal_uInt16 SDRATTR_3D_LAST (SDRATTR_3DSCENE_LAST); /* 1333 V4+++*/
+
+constexpr sal_uInt16 SDRATTR_CUSTOMSHAPE_FIRST (SDRATTR_3D_LAST + 1); /* 1334 V4+++*/
+constexpr TypedWhichId<SfxStringItem> SDRATTR_CUSTOMSHAPE_ENGINE (SDRATTR_CUSTOMSHAPE_FIRST + 0); /* 1334 V4+++*/
+constexpr TypedWhichId<SfxStringItem> SDRATTR_CUSTOMSHAPE_DATA (SDRATTR_CUSTOMSHAPE_FIRST + 1); /* 1335 V4+++*/
+constexpr TypedWhichId<SdrCustomShapeGeometryItem> SDRATTR_CUSTOMSHAPE_GEOMETRY (SDRATTR_CUSTOMSHAPE_FIRST + 2); /* 1336 V4+++*/
+constexpr sal_uInt16 SDRATTR_CUSTOMSHAPE_LAST (SDRATTR_CUSTOMSHAPE_GEOMETRY); /* 1357 V4+++*/
+
+constexpr sal_uInt16 SDRATTR_TABLE_FIRST (SDRATTR_CUSTOMSHAPE_LAST+1);
+constexpr TypedWhichId<SvxBoxItem> SDRATTR_TABLE_BORDER (SDRATTR_TABLE_FIRST+0);
+constexpr TypedWhichId<SvxBoxInfoItem> SDRATTR_TABLE_BORDER_INNER (SDRATTR_TABLE_FIRST+1);
+constexpr TypedWhichId<SvxLineItem> SDRATTR_TABLE_BORDER_TLBR (SDRATTR_TABLE_FIRST+2);
+constexpr TypedWhichId<SvxLineItem> SDRATTR_TABLE_BORDER_BLTR (SDRATTR_TABLE_FIRST+3);
+constexpr TypedWhichId<SvxTextRotateItem> SDRATTR_TABLE_TEXT_ROTATION (SDRATTR_TABLE_FIRST+4);
+constexpr sal_uInt16 SDRATTR_TABLE_LAST (SDRATTR_TABLE_TEXT_ROTATION);
+
+constexpr sal_uInt16 SDRATTR_GLOW_FIRST (SDRATTR_TABLE_LAST+1);
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_GLOW_RADIUS (SDRATTR_GLOW_FIRST+0);
+constexpr TypedWhichId<XColorItem> SDRATTR_GLOW_COLOR (SDRATTR_GLOW_FIRST+1);
+constexpr TypedWhichId<SdrPercentItem> SDRATTR_GLOW_TRANSPARENCY(SDRATTR_GLOW_FIRST + 2);
+constexpr sal_uInt16 SDRATTR_GLOW_LAST (SDRATTR_GLOW_TRANSPARENCY);
+
+constexpr sal_uInt16 SDRATTR_SOFTEDGE_FIRST(SDRATTR_GLOW_LAST + 1);
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_SOFTEDGE_RADIUS(SDRATTR_SOFTEDGE_FIRST + 0);
+constexpr sal_uInt16 SDRATTR_SOFTEDGE_LAST(SDRATTR_SOFTEDGE_RADIUS);
+
+constexpr sal_uInt16 SDRATTR_TEXTCOLUMNS_FIRST(SDRATTR_SOFTEDGE_LAST + 1);
+constexpr TypedWhichId<SfxInt16Item> SDRATTR_TEXTCOLUMNS_NUMBER(SDRATTR_TEXTCOLUMNS_FIRST + 0);
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_TEXTCOLUMNS_SPACING(SDRATTR_TEXTCOLUMNS_FIRST + 1);
+constexpr sal_uInt16 SDRATTR_TEXTCOLUMNS_LAST(SDRATTR_TEXTCOLUMNS_SPACING);
+
+constexpr sal_uInt16 SDRATTR_END (SDRATTR_TEXTCOLUMNS_LAST); /* 1357 */ /* 1333 V4+++*/ /* 1243 V4+++*/ /*1213*/ /*1085*/ /*1040*/ /*Pool V2: 1123,V1: 1065 */
+
+#endif // INCLUDED_SVX_SVDDEF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svddrag.hxx b/include/svx/svddrag.hxx
new file mode 100644
index 000000000..5a1d8d16a
--- /dev/null
+++ b/include/svx/svddrag.hxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDDRAG_HXX
+#define INCLUDED_SVX_SVDDRAG_HXX
+
+
+#include <tools/gen.hxx>
+#include <tools/fract.hxx>
+#include <svx/svxdllapi.h>
+
+#include <memory>
+#include <vector>
+
+// Status information for specialized object dragging. In order for the model
+// to stay status free, the status data is kept on the View
+// and handed over to the object at the appropriate time as a parameter.
+// This also includes the status of the operation and Interactive
+// Object creation. In this case, pHdl is null.
+class SdrHdl;
+class SdrView;
+class SdrPageView;
+class SdrDragMethod;
+
+struct SdrDragStatUserData
+{
+ virtual ~SdrDragStatUserData() = 0;
+};
+
+class SVXCORE_DLLPUBLIC SdrDragStat final
+{
+ SdrHdl* pHdl; // The Handle for the User
+ SdrView* pView;
+ SdrPageView* pPageView;
+ std::vector<Point> mvPnts; // All previous Points: [0]=Start, [Count()-2]=Prev
+ Point aRef1; // Referencepoint: Resize fixed point, (axis of rotation,
+ Point aRef2; // axis of reflection, ...)
+ Point aPos0; // Position at the last Event
+ Point aRealNow; // Current dragging position without Snap, Ortho and Limit
+ tools::Rectangle aActionRect;
+
+ bool bEndDragChangesAttributes;
+ bool bEndDragChangesGeoAndAttributes;
+ /// Table row drag: table will re-layout itself later.
+ bool mbEndDragChangesLayout;
+ bool bMouseIsUp;
+
+ bool bShown; // Xor visible?
+ sal_uInt16 nMinMov; // So much has to be minimally moved first
+ bool bMinMoved; // MinMove surpassed?
+
+ bool bHorFixed; // Dragging only vertical
+ bool bVerFixed; // Dragging only horizontal
+ bool bWantNoSnap; // To decide if pObj-> MovCreate () should use NoSnapPos or not.
+ // Therefore, NoSnapPos is written into the buffer.
+ bool bOrtho4;
+ bool bOrtho8;
+
+ SdrDragMethod* pDragMethod;
+ std::unique_ptr<SdrDragStatUserData> mpUserData; // Userdata
+
+ void Clear();
+
+ sal_Int32 GetPrevPos() const { return mvPnts.size()-(mvPnts.size()>1 ? 2 : 1); }
+
+ // This is passed all the way through to ApplySpecialDrag of the Edge Object
+ // For LOK, we cannot really specify which gluepoint to select by default
+ // It selects the nearest gluepoints after DragEnd event.
+ // When multiple objects are on top of each other or somehow their gluepoints
+ // collide, the gluepoint is selected from the lowest order numbered object
+ // We can pass the ord number information inside the draginfo and choose the correct shape
+ struct {
+ sal_Int32 objectOrdNum = -1;
+ } mGlueOptions;
+
+public:
+ SdrDragStat() { Reset(); }
+ ~SdrDragStat();
+ void Reset();
+ SdrView* GetView() const { return pView; }
+ void SetView(SdrView* pV) { pView=pV; }
+ SdrPageView* GetPageView() const { return pPageView; }
+ void SetPageView(SdrPageView* pPV) { pPageView=pPV; }
+ const Point& GetPoint(sal_Int32 nNum) const { return mvPnts[nNum]; }
+ sal_Int32 GetPointCount() const { return mvPnts.size(); }
+ const Point& GetStart() const { return mvPnts[0]; }
+ const Point& GetPrev() const { return mvPnts[GetPrevPos()]; }
+ const Point& GetPos0() const { return aPos0; }
+ const Point& GetNow() const { return mvPnts.back(); }
+ void SetNow(Point const &pt) { mvPnts.back() = pt; }
+ const Point& GetRef1() const { return aRef1; }
+ void SetRef1(const Point &pt) { aRef1 = pt; }
+ const Point& GetRef2() const { return aRef2; }
+ void SetRef2(const Point &pt) { aRef2 = pt; }
+ const SdrHdl* GetHdl() const { return pHdl; }
+ void SetHdl(SdrHdl* pH) { pHdl=pH; }
+ SdrDragStatUserData* GetUser() const { return mpUserData.get(); }
+ void SetUser(std::unique_ptr<SdrDragStatUserData> pU) { mpUserData = std::move(pU); }
+ bool IsShown() const { return bShown; }
+ void SetShown(bool bOn) { bShown=bOn; }
+
+ bool IsMinMoved() const { return bMinMoved; }
+ void SetMinMoved() { bMinMoved=true; }
+ void ResetMinMoved() { bMinMoved=false; }
+ void SetMinMove(sal_uInt16 nDist) { nMinMov=nDist; if (nMinMov<1) nMinMov=1; }
+
+ bool IsHorFixed() const { return bHorFixed; }
+ void SetHorFixed(bool bOn) { bHorFixed=bOn; }
+ bool IsVerFixed() const { return bVerFixed; }
+ void SetVerFixed(bool bOn) { bVerFixed=bOn; }
+
+ // Here, the object can say: "I do not want to snap to coordinates!"
+ // for example, the angle of the arc ...
+ bool IsNoSnap() const { return bWantNoSnap; }
+ void SetNoSnap(bool bOn = true) { bWantNoSnap=bOn; }
+
+ // And here the Obj say which Ortho (if there is one) can be usefully applied to him.
+ // Ortho4 means Ortho in four directions (for Rect and CIRT)
+ bool IsOrtho4Possible() const { return bOrtho4; }
+ void SetOrtho4Possible(bool bOn = true) { bOrtho4=bOn; }
+ // Ortho8 means Ortho in 8 directions (for lines)
+ bool IsOrtho8Possible() const { return bOrtho8; }
+ void SetOrtho8Possible(bool bOn = true) { bOrtho8=bOn; }
+
+ // Is set by an object that was dragged.
+ bool IsEndDragChangesAttributes() const { return bEndDragChangesAttributes; }
+ void SetEndDragChangesAttributes(bool bOn) { bEndDragChangesAttributes=bOn; }
+ bool IsEndDragChangesGeoAndAttributes() const { return bEndDragChangesGeoAndAttributes; }
+ void SetEndDragChangesGeoAndAttributes(bool bOn) { bEndDragChangesGeoAndAttributes=bOn; }
+ bool IsEndDragChangesLayout() const { return mbEndDragChangesLayout; }
+ void SetEndDragChangesLayout(bool bOn) { mbEndDragChangesLayout=bOn; }
+
+ // Is set by the view and can be evaluated by Obj
+ bool IsMouseDown() const { return !bMouseIsUp; }
+ void SetMouseDown(bool bDown) { bMouseIsUp=!bDown; }
+
+ void Reset(const Point& rPnt);
+ void NextMove(const Point& rPnt);
+ void NextPoint();
+ void PrevPoint();
+ bool CheckMinMoved(const Point& rPnt);
+ tools::Long GetDX() const { return GetNow().X()-GetPrev().X(); }
+ tools::Long GetDY() const { return GetNow().Y()-GetPrev().Y(); }
+ Fraction GetXFact() const;
+ Fraction GetYFact() const;
+
+ SdrDragMethod* GetDragMethod() const { return pDragMethod; }
+ void SetDragMethod(SdrDragMethod* pMth) { pDragMethod=pMth; }
+
+ const tools::Rectangle& GetActionRect() const { return aActionRect; }
+ void SetActionRect(const tools::Rectangle& rR) { aActionRect=rR; }
+
+ // Also considering 1stPointAsCenter
+ void TakeCreateRect(tools::Rectangle& rRect) const;
+
+ auto& GetGlueOptions() { return mGlueOptions; }
+};
+
+#endif // INCLUDED_SVX_SVDDRAG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svddrgmt.hxx b/include/svx/svddrgmt.hxx
new file mode 100644
index 000000000..fe71ad5d6
--- /dev/null
+++ b/include/svx/svddrgmt.hxx
@@ -0,0 +1,304 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDDRGMT_HXX
+#define INCLUDED_SVX_SVDDRGMT_HXX
+
+#include <svx/svddrgv.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <memory>
+
+class SdrDragView;
+class SdrDragStat;
+
+class SAL_DLLPUBLIC_RTTI SdrDragEntry
+{
+private:
+ bool mbAddToTransparent : 1;
+
+protected:
+ // access for derived classes
+ void setAddToTransparent(bool bNew) { mbAddToTransparent = bNew; }
+
+public:
+ SdrDragEntry();
+ virtual ~SdrDragEntry();
+
+ virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod) = 0;
+
+ // data read access
+ bool getAddToTransparent() const { return mbAddToTransparent; }
+};
+
+
+class SVXCORE_DLLPUBLIC SdrDragEntryPolyPolygon final : public SdrDragEntry
+{
+private:
+ basegfx::B2DPolyPolygon maOriginalPolyPolygon;
+
+public:
+ SdrDragEntryPolyPolygon(const basegfx::B2DPolyPolygon& rOriginalPolyPolygon);
+ virtual ~SdrDragEntryPolyPolygon() override;
+
+ virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod) override;
+};
+
+
+class SdrDragEntrySdrObject final : public SdrDragEntry
+{
+private:
+ const SdrObject& maOriginal;
+ SdrObjectUniquePtr mxClone;
+ bool mbModify;
+
+public:
+ SdrDragEntrySdrObject(
+ const SdrObject& rOriginal,
+ bool bModify);
+ virtual ~SdrDragEntrySdrObject() override;
+
+ // #i54102# Split createPrimitive2DSequenceInCurrentState in prepareCurrentState and processing,
+ // added accessors to original and clone
+ void prepareCurrentState(SdrDragMethod& rDragMethod);
+ const SdrObject& getOriginal() const { return maOriginal; }
+ SdrObject* getClone() { return mxClone.get(); }
+
+ virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod) override;
+};
+
+
+class SdrDragEntryPrimitive2DSequence final : public SdrDragEntry
+{
+private:
+ drawinglayer::primitive2d::Primitive2DContainer maPrimitive2DSequence;
+
+public:
+ SdrDragEntryPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DContainer&& rSequence);
+ virtual ~SdrDragEntryPrimitive2DSequence() override;
+
+ virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod) override;
+};
+
+
+class SdrDragEntryPointGlueDrag final : public SdrDragEntry
+{
+private:
+ std::vector< basegfx::B2DPoint > maPositions;
+ bool mbIsPointDrag;
+
+public:
+ SdrDragEntryPointGlueDrag(std::vector< basegfx::B2DPoint >&& rPositions, bool bIsPointDrag);
+ virtual ~SdrDragEntryPointGlueDrag() override;
+
+ virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod) override;
+};
+
+
+class SVXCORE_DLLPUBLIC SdrDragMethod
+{
+private:
+ std::vector< std::unique_ptr<SdrDragEntry> > maSdrDragEntries;
+ sdr::overlay::OverlayObjectList maOverlayObjectList;
+ SdrDragView& mrSdrDragView;
+
+ bool mbMoveOnly : 1;
+ bool mbSolidDraggingActive : 1;
+ bool mbShiftPressed : 1;
+
+protected:
+ // access for derivated classes to maSdrDragEntries
+ void clearSdrDragEntries();
+ void addSdrDragEntry(std::unique_ptr<SdrDragEntry> pNew);
+ virtual void createSdrDragEntries();
+ virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal);
+
+ // Helper to support inserting a new OverlayObject. It will do all
+ // necessary stuff involved with that:
+ // - add GridOffset for non-linear ViewToDevice transformation (calc)
+ // - add to OverlayManager
+ // - add to local OverlayObjectList - ownership change (!)
+ // It is centralized here (and protected) to avoid that new usages/
+ // implementations forget one of these needed steps.
+ void insertNewlyCreatedOverlayObjectForSdrDragMethod(
+ std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject,
+ const sdr::contact::ObjectContact& rObjectContact,
+ sdr::overlay::OverlayManager& rOverlayManager);
+
+ // access for derivated classes to mrSdrDragView
+ SdrDragView& getSdrDragView() { return mrSdrDragView; }
+ const SdrDragView& getSdrDragView() const { return mrSdrDragView; }
+
+ // access for derivated classes for bools
+ void setMoveOnly(bool bNew) { mbMoveOnly = bNew; }
+ void setSolidDraggingActive(bool bNew) { mbSolidDraggingActive = bNew; }
+
+ // internal helpers for creation of standard drag entries
+ void createSdrDragEntries_SolidDrag();
+ void createSdrDragEntries_PolygonDrag();
+ void createSdrDragEntries_PointDrag();
+ void createSdrDragEntries_GlueDrag();
+
+ // old call forwarders to the SdrDragView
+ OUString ImpGetDescriptionStr(TranslateId pStrCacheID) const;
+ SdrHdl* GetDragHdl() const { return getSdrDragView().mpDragHdl; }
+ SdrHdlKind GetDragHdlKind() const { return getSdrDragView().meDragHdl; }
+ SdrDragStat& DragStat() { return getSdrDragView().maDragStat; }
+ const SdrDragStat& DragStat() const { return getSdrDragView().maDragStat; }
+ Point& Ref1() const { return mrSdrDragView.maRef1; }
+ Point& Ref2() const { return mrSdrDragView.maRef2; }
+ const SdrHdlList& GetHdlList() const { return getSdrDragView().GetHdlList(); }
+ void AddUndo(std::unique_ptr<SdrUndoAction> pUndo) { getSdrDragView().AddUndo(std::move(pUndo)); }
+ bool IsDragLimit() { return getSdrDragView().mbDragLimit; }
+ const tools::Rectangle& GetDragLimitRect() { return getSdrDragView().maDragLimit; }
+ const SdrMarkList& GetMarkedObjectList() { return getSdrDragView().GetMarkedObjectList(); }
+ Point GetSnapPos(const Point& rPt) const { return getSdrDragView().GetSnapPos(rPt,getSdrDragView().mpMarkedPV); }
+ SdrSnap SnapPos(Point& rPt) const { return getSdrDragView().SnapPos(rPt,getSdrDragView().mpMarkedPV); }
+ inline const tools::Rectangle& GetMarkedRect() const;
+ SdrPageView* GetDragPV() const;
+ SdrObject* GetDragObj() const;
+ bool IsDraggingPoints() const { return getSdrDragView().IsDraggingPoints(); }
+ bool IsDraggingGluePoints() const { return getSdrDragView().IsDraggingGluePoints(); }
+
+ bool DoAddConnectorOverlays();
+ drawinglayer::primitive2d::Primitive2DContainer AddConnectorOverlays();
+
+public:
+
+ void resetSdrDragEntries();
+ basegfx::B2DRange getCurrentRange() const;
+
+ // #i58950# also moved constructor implementation to cxx
+ SdrDragMethod(SdrDragView& rNewView);
+
+ // #i58950# virtual destructor was missing
+ virtual ~SdrDragMethod();
+
+ void Show();
+ void Hide();
+ bool IsShiftPressed() const { return mbShiftPressed; }
+ void SetShiftPressed(bool bShiftPressed) { mbShiftPressed = bShiftPressed; }
+ virtual OUString GetSdrDragComment() const=0;
+ virtual bool BeginSdrDrag()=0;
+ virtual void MoveSdrDrag(const Point& rPnt)=0;
+ virtual bool EndSdrDrag(bool bCopy)=0;
+ virtual void CancelSdrDrag();
+ virtual PointerStyle GetSdrDragPointer() const=0;
+
+ virtual void CreateOverlayGeometry(
+ sdr::overlay::OverlayManager& rOverlayManager,
+ const sdr::contact::ObjectContact& rObjectContact);
+ void destroyOverlayGeometry();
+
+ virtual basegfx::B2DHomMatrix getCurrentTransformation() const;
+ virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
+ virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget);
+
+ // data read access
+ bool getMoveOnly() const { return mbMoveOnly; }
+ bool getSolidDraggingActive() const { return mbSolidDraggingActive; }
+};
+
+inline const tools::Rectangle& SdrDragMethod::GetMarkedRect() const
+{
+ return getSdrDragView().meDragHdl==SdrHdlKind::Poly ? getSdrDragView().GetMarkedPointsRect() :
+ getSdrDragView().meDragHdl==SdrHdlKind::Glue ? getSdrDragView().GetMarkedGluePointsRect() :
+ getSdrDragView().GetMarkedObjRect();
+}
+
+
+// SdrDragMove
+
+class SVXCORE_DLLPUBLIC SdrDragMove : public SdrDragMethod
+{
+private:
+ tools::Long nBestXSnap;
+ tools::Long nBestYSnap;
+ bool bXSnapped;
+ bool bYSnapped;
+
+ void ImpCheckSnap(const Point& rPt);
+
+protected:
+ virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal) override;
+
+public:
+ SdrDragMove(SdrDragView& rNewView);
+
+ virtual OUString GetSdrDragComment() const override;
+ virtual bool BeginSdrDrag() override;
+ virtual void MoveSdrDrag(const Point& rPnt) override;
+ virtual bool EndSdrDrag(bool bCopy) override;
+ virtual PointerStyle GetSdrDragPointer() const override;
+
+ virtual basegfx::B2DHomMatrix getCurrentTransformation() const override;
+ virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override;
+};
+
+
+// SdrDragResize
+
+class SVXCORE_DLLPUBLIC SdrDragResize : public SdrDragMethod
+{
+protected:
+ Fraction aXFact;
+ Fraction aYFact;
+
+public:
+ SdrDragResize(SdrDragView& rNewView);
+
+ virtual OUString GetSdrDragComment() const override;
+ virtual bool BeginSdrDrag() override;
+ virtual void MoveSdrDrag(const Point& rPnt) override;
+ virtual bool EndSdrDrag(bool bCopy) override;
+ virtual PointerStyle GetSdrDragPointer() const override;
+
+ virtual basegfx::B2DHomMatrix getCurrentTransformation() const override;
+ virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override;
+};
+
+
+// SdrDragObjOwn
+
+class SVXCORE_DLLPUBLIC SdrDragObjOwn : public SdrDragMethod
+{
+private:
+ // SdrDragObjOwn always works on a clone since it has no transformation
+ // mechanism to modify wireframe visualisations, but uses the
+ // SdrObject::applySpecialDrag() method to change a clone of the
+ // SdrObject
+ SdrObjectUniquePtr mxClone;
+
+protected:
+ virtual void createSdrDragEntries() override;
+
+public:
+ SdrDragObjOwn(SdrDragView& rNewView);
+ virtual ~SdrDragObjOwn() override;
+
+ virtual OUString GetSdrDragComment() const override;
+ virtual bool BeginSdrDrag() override;
+ virtual void MoveSdrDrag(const Point& rPnt) override;
+ virtual bool EndSdrDrag(bool bCopy) override;
+ virtual PointerStyle GetSdrDragPointer() const override;
+};
+
+#endif // INCLUDED_SVX_SVDDRGMT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svddrgv.hxx b/include/svx/svddrgv.hxx
new file mode 100644
index 000000000..c88cf0b30
--- /dev/null
+++ b/include/svx/svddrgv.hxx
@@ -0,0 +1,230 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDDRGV_HXX
+#define INCLUDED_SVX_SVDDRGV_HXX
+
+#include <svx/svxdllapi.h>
+#include <svx/svdxcgv.hxx>
+#include <memory>
+
+class SdrUndoGeoObj;
+
+class SVXCORE_DLLPUBLIC SdrDragView : public SdrExchangeView
+{
+ friend class SdrPageView;
+ friend class SdrDragMethod;
+
+ // See GetDragXorPolyLimit/GetDragXorPointLimit
+ enum : size_t {
+ eDragXorPolyLimit = 100,
+ eDragXorPointLimit = 500
+ };
+
+protected:
+ SdrHdl* mpDragHdl;
+ std::unique_ptr<SdrDragMethod> mpCurrentSdrDragMethod;
+ SdrUndoGeoObj* mpInsPointUndo;
+ tools::Rectangle maDragLimit;
+ OUString maInsPointUndoStr;
+ SdrHdlKind meDragHdl;
+
+ bool mbFramDrag : 1; // currently frame dragging
+ bool mbMarkedHitMovesAlways : 1; // Persistent
+ bool mbDragLimit : 1; // Limit on SnapRect instead of BoundRect
+ bool mbDragHdl : 1; // TRUE: RefPt is slid
+ bool mbDragStripes : 1; // Persistent
+ bool mbSolidDragging : 1; // allow solid create/drag of objects
+ bool mbResizeAtCenter : 1;
+ bool mbCrookAtCenter : 1;
+ bool mbDragWithCopy : 1;
+ bool mbInsGluePoint : 1;
+ bool mbInsObjPointMode : 1;
+ bool mbInsGluePointMode : 1;
+ bool mbNoDragXorPolys : 1;
+
+protected:
+ virtual void SetMarkHandles(SfxViewShell* pOtherShell) override;
+ void ShowDragObj();
+ void HideDragObj();
+ bool ImpBegInsObjPoint(bool bIdxZwang, const Point& rPnt, bool bNewObj, OutputDevice* pOut);
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrDragView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
+ virtual ~SdrDragView() override;
+
+public:
+ virtual bool IsAction() const override;
+ virtual void MovAction(const Point& rPnt) override;
+ virtual void EndAction() override;
+ virtual void BckAction() override;
+ virtual void BrkAction() override;
+ virtual void TakeActionRect(tools::Rectangle& rRect) const override;
+
+ // special implementation for Writer:
+ // TakeDragObjAnchorPos() returns the position at which an object
+ // approximately ends up during dragging when it is "released"
+ // (EndDrag).
+ // As a general rule, this is the left upper corner of the expected
+ // new SnapRect. Exception: CaptionObj. There, it is the position
+ // of the "tail end".
+ // In case of return value 'false', the position could not be
+ // determined (e.g. point shift, multiple selection, shift of the
+ // mirror axis,...)
+ bool TakeDragObjAnchorPos(Point& rPos, bool bTopRight ) const;
+
+ // If pForcedMeth is passed, then pHdl, ... is not evaluated, but this Drag
+ // method is used. In this, the ownership of the instance passes
+ // to the View and is destroyed at the end of the dragging.
+ virtual bool BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl, short nMinMov=-3, SdrDragMethod* pForcedMeth=nullptr);
+ void MovDragObj(const Point& rPnt);
+ bool EndDragObj(bool bCopy=false);
+ void BrkDragObj();
+ bool IsDragObj() const { return mpCurrentSdrDragMethod && !mbInsPolyPoint && !mbInsGluePoint; }
+ SdrHdl* GetDragHdl() const { return mpDragHdl; }
+ SdrDragMethod* GetDragMethod() const { return mpCurrentSdrDragMethod.get(); }
+ bool IsDraggingPoints() const { return meDragHdl==SdrHdlKind::Poly; }
+ bool IsDraggingGluePoints() const { return meDragHdl==SdrHdlKind::Glue; }
+
+ // If you want to define that already during BegDrag
+ // or in the middle.
+ // (Is reset to 'false' on each BegDrag, so set it after BegDrag.)
+ void SetDragWithCopy(bool bOn) { mbDragWithCopy = bOn; }
+ bool IsDragWithCopy() const { return mbDragWithCopy; }
+
+ void SetInsertGluePoint(bool bOn) { mbInsGluePoint = bOn; }
+ bool IsInsertGluePoint() const { return mbInsGluePoint; }
+
+ // Interactive insertion of a new point. nIdx=0 => in front of the first point
+ bool IsInsObjPointPossible() const;
+ bool BegInsObjPoint(const Point& rPnt, bool bNewObj) { return ImpBegInsObjPoint(false, rPnt, bNewObj, nullptr); }
+ void MovInsObjPoint(const Point& rPnt) { MovDragObj(rPnt); }
+ bool EndInsObjPoint(SdrCreateCmd eCmd);
+ bool IsInsObjPoint() const { return mpCurrentSdrDragMethod && mbInsPolyPoint; }
+
+ // For the app to manage the status. GetPreferredPointer() is
+ // possibly going to deliver a matching pointer for it.
+ void SetInsObjPointMode(bool bOn) { mbInsObjPointMode = bOn; }
+ bool IsInsObjPointMode() const { return mbInsObjPointMode; }
+
+ bool IsInsGluePointPossible() const;
+ bool BegInsGluePoint(const Point& rPnt);
+ bool IsInsGluePoint() const { return mpCurrentSdrDragMethod && mbInsGluePoint; }
+
+ // For the app to manage the status. GetPreferredPointer() is
+ // possibly going to deliver a matching pointer for it.
+ void SetInsGluePointMode(bool bOn) { mbInsGluePointMode = bOn; }
+ bool IsInsGluePointMode() const { return mbInsGluePointMode; }
+
+ // border lines over the whole win persistent during the
+ // whole dragging. Default=FALSE.
+ void SetDragStripes(bool bOn);
+ bool IsDragStripes() const { return mbDragStripes; }
+
+ // As a general rule, the contours of the selected objects
+ // are displayed as Xor-polygons. If this flag is set, only one
+ // Xor-Frame is drawn (e.g. in case of multiple selection).
+ // In case of object-specific dragging (polygon points, corner radius,...),
+ // this setting has no influence.
+ // Also changeable during the dragging.
+ // Default=Off
+ void SetNoDragXorPolys(bool bOn);
+ bool IsNoDragXorPolys() const { return mbNoDragXorPolys; }
+
+ // If the number of selected objects exceeds the value set here,
+ // NoDragPolys is (temporarily) activated implicitly.
+ // PolyPolygons etc. are regarded as multiple objects respectively.
+ static size_t GetDragXorPolyLimit() { return eDragXorPolyLimit; }
+
+ // Like DragXorPolyLimit, but in respect to the total number of
+ // all polygons.
+ // NoDragPolys is (temporarily) activated, if one of the limits
+ // is exceeded.
+ static size_t GetDragXorPointLimit() { return eDragXorPointLimit; }
+
+ void SetSolidDragging(bool bOn);
+ bool IsSolidDragging() const;
+
+ // Connector handling is thus as follows (when using default settings):
+ // - If at most 10 Connectors are affected, they are recalculated
+ // on each MouseMove.
+ // - If 11 to 100 Connectors are affected, the connections
+ // are shown as straight lines while dragging.
+ // - In case of more than 100 affected Connectors, nothing that refers
+ // to the Connectors is drawn while dragging.
+
+ // If a special drag mode like Rotate, Mirror or Crook is enabled,
+ // then a Hit on the selected object triggers exactly this dragging.
+ // If MarkedHitMovesAlways is set to 'true', a Hit on the selected
+ // object always triggers a Move, independent of the DragMode that is
+ // set. This flag is persistent and should be configurable in the app
+ // by the user!
+ void SetMarkedHitMovesAlways(bool bOn) { mbMarkedHitMovesAlways = bOn; }
+ bool IsMarkedHitMovesAlways() const { return mbMarkedHitMovesAlways; }
+
+ bool IsOrthoDesired() const;
+
+ // center as reference on Resize
+ // Default=FALSE.
+ bool IsResizeAtCenter() const { return mbResizeAtCenter; }
+ void SetResizeAtCenter(bool bOn) { mbResizeAtCenter = bOn; }
+
+ // symmetric Crook
+ // Default=FALSE.
+ bool IsCrookAtCenter() const { return mbCrookAtCenter; }
+ void SetCrookAtCenter(bool bOn) { mbCrookAtCenter = bOn; }
+
+ // Limitation of the working area. The limitation refers to the View,
+ // not to the single PageViews. This limitation is only evaluated by
+ // the View on interactions like Dragging and Create.
+ // In case of actions controlled by the app through algorithms or
+ // UI-controlled actions (SetGeoAttr, MoveMarkedObj, ...), the
+ // app must honor this limit itself.
+ // Furthermore, this limit is to be seen as a rough limit. In certain
+ // cases (e.g. while rotating), objects cannot be dragged exactly
+ // up to this limit, objects can overlap a bit because of rounding
+ // errors,...
+ // Default=EmptyRect=no limitation
+ // only partially implemented
+ void SetWorkArea(const tools::Rectangle& rRect) { maMaxWorkArea=rRect; }
+ const tools::Rectangle& GetWorkArea() const { return maMaxWorkArea; }
+
+
+ // The DragLimit refers to the Page of the object.
+ // (TODO or to the View?? - must be researched...)
+ // 'false' = no limit
+ // The return Rect must contain absolute coordinates. The maximum
+ // drag area is then selected by the View in a way that the object's
+ // SnapRect is moved or resized at most up to the corner of the
+ // LimitRect. For objects like Bezier curves, rotated rectangles,
+ // it must be taken into account that because of subsequent
+ // recalculation of the SnapRect (on Resize), rounding errors can
+ // occur, because of which the LimitRect might be exceeded by a
+ // very small extent...
+ // Implemented for Move and Resize
+ virtual bool TakeDragLimit(SdrDragMode eMode, tools::Rectangle& rRect) const;
+};
+
+#endif // INCLUDED_SVX_SVDDRGV_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx
new file mode 100644
index 000000000..d2c9b3816
--- /dev/null
+++ b/include/svx/svdedtv.hxx
@@ -0,0 +1,418 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDEDTV_HXX
+#define INCLUDED_SVX_SVDEDTV_HXX
+
+#include <svx/svdmrkv.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/svdundo.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+class SfxUndoAction;
+class SdrUndoAction;
+class SdrUndoGroup;
+class SfxStyleSheet;
+class SdrLayer;
+class SvdProgressInfo;
+
+enum class SdrHorAlign {
+ NONE,
+ Left,
+ Right,
+ Center
+};
+
+enum class SdrVertAlign {
+ NONE,
+ Top,
+ Bottom,
+ Center
+};
+
+enum class SdrMergeMode {
+ Merge,
+ Subtract,
+ Intersect
+};
+
+// Options for InsertObject()
+enum class SdrInsertFlags
+{
+ NONE = 0x0000,
+ DONTMARK = 0x0001, /* object will not be marked (the actual marking remains) */
+ ADDMARK = 0x0002, /* object will be added an existing selection */
+ SETDEFATTR = 0x0004, /* actual attributes (+StyleSheet) are assigned to the object */
+ SETDEFLAYER = 0x0008, /* actual layer is assigned to the object */
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SdrInsertFlags> : is_typed_flags<SdrInsertFlags, 0x0f> {};
+}
+
+class SVXCORE_DLLPUBLIC SdrEditView : public SdrMarkView
+{
+ friend class SdrPageView;
+ friend class SdrDragDistort;
+ friend class SdrDragCrook;
+
+protected:
+
+ // cache the transformation queries, etc. a little
+ bool m_bPossibilitiesDirty : 1;
+ bool m_bReadOnly : 1;
+ bool m_bGroupPossible : 1;
+ bool m_bUnGroupPossible : 1;
+ bool m_bGrpEnterPossible : 1;
+ bool m_bToTopPossible : 1;
+ bool m_bToBtmPossible : 1;
+ bool m_bReverseOrderPossible : 1;
+ bool m_bImportMtfPossible : 1;
+ bool m_bCombinePossible : 1;
+ bool m_bDismantlePossible : 1;
+ bool m_bCombineNoPolyPolyPossible : 1;
+ bool m_bDismantleMakeLinesPossible : 1;
+ bool m_bOrthoDesiredOnMarked : 1;
+ bool m_bOneOrMoreMovable : 1; // at least one object is moveable
+ bool m_bMoreThanOneNoMovRot : 1; // more than one object is not movable nor turnable (Crook)
+ bool m_bContortionPossible : 1; // all polygones (grouped if necessary)
+ bool m_bMoveAllowed : 1;
+ bool m_bResizeFreeAllowed : 1;
+ bool m_bResizePropAllowed : 1;
+ bool m_bRotateFreeAllowed : 1;
+ bool m_bRotate90Allowed : 1;
+ bool m_bMirrorFreeAllowed : 1;
+ bool m_bMirror45Allowed : 1;
+ bool m_bMirror90Allowed : 1;
+ bool m_bShearAllowed : 1;
+ bool m_bEdgeRadiusAllowed : 1;
+ bool m_bTransparenceAllowed : 1;
+ bool m_bCropAllowed : 1;
+ bool m_bGradientAllowed : 1;
+ bool m_bCanConvToPath : 1;
+ bool m_bCanConvToPoly : 1;
+ bool m_bCanConvToContour : 1;
+ bool m_bMoveProtect : 1;
+ bool m_bResizeProtect : 1;
+
+private:
+ SVX_DLLPRIVATE void ImpResetPossibilityFlags();
+
+protected:
+ void ImpBroadcastEdgesOfMarkedNodes();
+
+ // convert the objects marked in poly resp. bezier
+ void ImpConvertTo(bool bPath, bool bLineToArea);
+
+ // converts an object, when positive it removes the old one from its List
+ // and inserts the new one instead. including Undo.
+ // Nor MarkEntry nor ModelChgBroadcast is created.
+ SdrObject* ImpConvertOneObj(SdrObject* pObj, bool bPath, bool bLineToArea);
+
+ // set both flags: bToTopPossible and bToBtmPossible.
+ // bToTopPossibleDirty and bToBtmPossibleDirty are reset at the same time
+ void ImpCheckToTopBtmPossible();
+
+ // for CombineMarkedObjects and DismantleMarkedObjects
+ void ImpCopyAttributes(const SdrObject* pSource, SdrObject* pDest) const;
+
+ // for CombineMarkedObjects
+ static bool ImpCanConvertForCombine1(const SdrObject* pObj);
+ static bool ImpCanConvertForCombine(const SdrObject* pObj);
+ static basegfx::B2DPolyPolygon ImpGetPolyPolygon1(const SdrObject* pObj);
+ static basegfx::B2DPolyPolygon ImpGetPolyPolygon(const SdrObject* pObj);
+ static basegfx::B2DPolygon ImpCombineToSinglePolygon(const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+ // for DismantleMarkedObjects
+ static bool ImpCanDismantle(const basegfx::B2DPolyPolygon& rPpolyPpolygon, bool bMakeLines);
+ static bool ImpCanDismantle(const SdrObject* pObj, bool bMakeLines);
+ void ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, size_t& rPos, SdrPageView* pPV, bool bMakeLines);
+ static void ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRad, SdrCrookMode eMode,
+ bool bVertical, bool bNoContortion, bool bRotate, const tools::Rectangle& rMarkRect);
+ static void ImpDistortObj(SdrObject* pO, const tools::Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion);
+ bool ImpDelLayerCheck(SdrObjList const * pOL, SdrLayerID nDelID) const;
+ void ImpDelLayerDelObjs(SdrObjList* pOL, SdrLayerID nDelID);
+
+ // Removes all objects of the MarkList from their ObjLists including Undo.
+ // The entries in rMark remain.
+ // @return a list of objects that must be deleted after the outermost EndUndo
+ std::vector<SdrObject *> DeleteMarkedList(SdrMarkList const& rMark); // DeleteMarked -> DeleteMarkedList
+
+ // Check possibilities of all marked objects
+ virtual void CheckPossibilities();
+ void ForcePossibilities() const { if (m_bPossibilitiesDirty || mbSomeObjChgdFlag) const_cast<SdrEditView*>(this)->CheckPossibilities(); }
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrEditView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
+ virtual ~SdrEditView() override;
+
+public:
+ // each call of an undo-capable method from its view, generates an undo action.
+ // If one wishes to group method calls into one, these calls should be put
+ // between BegUndo() and EndUndo() calls (unlimited).
+ // The comment used for the UndoAction is the first BegUndo(String).
+ // In this case NotifyNewUndoAction is called at the last EndUndo().
+ // NotifyNewUndoAction() is not called for an empty group.
+ void BegUndo() { mpModel->BegUndo(); } // open undo-grouping
+ void BegUndo(const OUString& rComment) { mpModel->BegUndo(rComment); } // open undo-grouping
+ void BegUndo(const OUString& rComment, const OUString& rObjDescr, SdrRepeatFunc eFunc=SdrRepeatFunc::NONE) { mpModel->BegUndo(rComment,rObjDescr,eFunc); } // open undo-grouping
+ void EndUndo(); // close undo-grouping (incl. BroadcastEdges)
+ void AddUndo(std::unique_ptr<SdrUndoAction> pUndo) { mpModel->AddUndo(std::move(pUndo)); } // add action
+ // only after first BegUndo or before last EndUndo:
+ void SetUndoComment(const OUString& rComment, const OUString& rObjDescr) { mpModel->SetUndoComment(rComment,rObjDescr); }
+ bool IsUndoEnabled() const;
+
+ /**
+ * Checks if this or other views have an active text edit, if true, end them.
+ */
+ void EndTextEditAllViews() const;
+ void EndTextEditCurrentView(bool bDontDeleteReally = false);
+
+ std::vector< std::unique_ptr<SdrUndoAction> > CreateConnectorUndo( const SdrObject& rO );
+ void AddUndoActions( std::vector< std::unique_ptr<SdrUndoAction> > );
+
+ // Layermanagement with Undo.
+ void InsertNewLayer(const OUString& rName, sal_uInt16 nPos);
+ // Delete a layer including all objects contained
+ void DeleteLayer(const OUString& rName);
+
+ // Marked objects which are outside a page
+ // are assigned to another page; at the moment without undo!!!
+ void ForceMarkedObjToAnotherPage();
+ void ForceMarkedToAnotherPage() { ForceMarkedObjToAnotherPage(); }
+
+ // delete all marked objects
+ void DeleteMarkedObj();
+
+ // Set a logical enclosing rectangle for all marked objects.
+ // It is not guaranteed if this succeeds, as a horizontal
+ // line has always a height of 0
+ void SetMarkedObjRect(const tools::Rectangle& rRect);
+ void MoveMarkedObj(const Size& rSiz, bool bCopy=false);
+ void ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false);
+ void ResizeMultMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, const bool bWdh, const bool bHgt);
+ Degree100 GetMarkedObjRotate() const;
+ void RotateMarkedObj(const Point& rRef, Degree100 nAngle, bool bCopy=false);
+ void MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy=false);
+ void MirrorMarkedObjHorizontal();
+ void MirrorMarkedObjVertical();
+ Degree100 GetMarkedObjShear() const;
+ void ShearMarkedObj(const Point& rRef, Degree100 nAngle, bool bVShear=false, bool bCopy=false);
+ void CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookMode eMode, bool bVertical, bool bNoContortion, bool bCopy=false);
+ void DistortMarkedObj(const tools::Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion, bool bCopy=false);
+
+ // copy marked objects and mark them instead of the old ones
+ void CopyMarkedObj();
+ void SetAllMarkedRect(const tools::Rectangle& rRect) { SetMarkedObjRect(rRect); }
+ void MoveAllMarked(const Size& rSiz, bool bCopy=false) { MoveMarkedObj(rSiz,bCopy); }
+ void ResizeAllMarked(const Point& rRef, const Fraction& xFact, const Fraction& yFact) { ResizeMarkedObj(rRef,xFact,yFact); }
+ void RotateAllMarked(const Point& rRef, Degree100 nAngle) { RotateMarkedObj(rRef,nAngle); }
+ void MirrorAllMarkedHorizontal() { MirrorMarkedObjHorizontal(); }
+ void MirrorAllMarkedVertical() { MirrorMarkedObjVertical(); }
+ void CopyMarked() { CopyMarkedObj(); }
+ bool IsMoveAllowed() const { ForcePossibilities(); return m_bMoveAllowed && !m_bMoveProtect; }
+ bool IsResizeAllowed(bool bProp=false) const;
+ bool IsRotateAllowed(bool b90Deg=false) const;
+ bool IsMirrorAllowed(bool b45Deg=false, bool b90Deg=false) const;
+ bool IsTransparenceAllowed() const;
+ bool IsGradientAllowed() const;
+ bool IsShearAllowed() const;
+ bool IsEdgeRadiusAllowed() const;
+ bool IsCrookAllowed(bool bNoContortion=false) const;
+ bool IsCropAllowed() const;
+ bool IsDistortAllowed(bool bNoContortion=false) const;
+
+ // Consolidate the text from multiple, selected TextObjects,
+ // attempting to identify paragraph fragments and join them together
+ void CombineMarkedTextObjects();
+
+ // Unite several objects to a polygon:
+ // - rectangles/circles/text... are implicitly converted.
+ // - polygones are closed automatically
+ // - attributes and layer are taken from the first object marked
+ // (thus from lowest Z-order).
+ // - group objects are included when all (!) member objects of
+ // the group can be changed. If a group includes for example
+ // a bitmap or an OLE-object, the complete group is not considered.
+ // bNoPolyPoly=TRUE: all is grouped to one single polygon
+ void CombineMarkedObjects(bool bNoPolyPoly = true);
+
+ // for combining multiple polygons, with direct support of the modes
+ // SID_POLY_MERGE, SID_POLY_SUBSTRACT, SID_POLY_INTERSECT
+ void MergeMarkedObjects(SdrMergeMode eMode);
+
+ // for distribution dialog function
+ void DistributeMarkedObjects(sal_uInt16 SlotID);
+
+ // for setting either the width or height of all selected
+ // objects to the width/height of the last selected object
+ // of the selection
+ void EqualizeMarkedObjects(bool bWidth);
+
+ // Decompose marked polypolygon objects into polygons.
+ // Grouped objects are searched and decomposed, if all member objects are PathObjs.
+ // bMakeLines=TRUE: all polygones are decomposed into single lines resp. bezier segments
+ void DismantleMarkedObjects(bool bMakeLines=false);
+ bool IsCombinePossible(bool bNoPolyPoly=false) const;
+ bool IsDismantlePossible(bool bMakeLines=false) const;
+
+ // Inserts a new, completely constructed object. Subsequently the object belongs to
+ // the model. After insertion the object is marked (if not prevented by nOptions).
+ // Sometimes the object is not inserted, but deleted, this is the case when
+ // the target layer is locked or not visible. In this case
+ // the method returns FALSE.
+ // Amongst others the method does not create an undo-action.
+ bool InsertObjectAtView(SdrObject* pObj, SdrPageView& rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE);
+
+ // Replace one drawing object by another.
+ // *pNewObj belongs to me, *pOldObj is changed into Undo.
+ // In any case an undo grouping is required and should be applied, e.g.:
+ // aStr+=" replace";
+ // BegUndo(aStr);
+ // ReplaceObject(...);
+
+ // EndUndo();
+ void ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrObject* pNewObj, bool bMark=true);
+
+ void SetNotPersistAttrToMarked(const SfxItemSet& rAttr);
+ void MergeNotPersistAttrFromMarked(SfxItemSet& rAttr) const;
+ void MergeAttrFromMarked(SfxItemSet& rAttr, bool bOnlyHardAttr) const;
+ SfxItemSet GetAttrFromMarked(bool bOnlyHardAttr) const;
+ void SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll);
+
+ // geometrical attribute (position, size, rotation angle)
+ // A PageOrigin set at a position is taken into account.
+ SfxItemSet GetGeoAttrFromMarked() const;
+ // In LOK, interactive shape movement uses this function
+ // in that case, margin is not taken into account
+ // and the final position of the shape becomes incorrect
+ // However, "Position and Size" dialog and other cases already add the margins.
+ void SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin = false);
+
+ // Returns NULL if:
+ // - nothing is marked,
+ // - no stylesheet is set at the marked object
+ // - point the marked objects to different StyleSheets for multiple selections
+ SfxStyleSheet* GetStyleSheetFromMarked() const;
+
+ // at the moment without undo :(
+ void SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
+
+ /* new interface src537 */
+ void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
+
+ void SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
+ SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const;
+ void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
+
+ // Group all marked objects to a single group.
+ // Subsequently mark the new group . If the group spawns multiple
+ // pages a group is created per page.
+ // All groups created are subsequently marked.
+ // The method creates SdrObjGroup-instances.
+ void GroupMarked();
+
+ // All marked object groups are dissolved (1 level).
+ // Now all previously marked member objects are marked.
+ // Previously marked objects, which are not group objects, remain marked.
+ void UnGroupMarked();
+
+ bool IsGroupPossible() const { ForcePossibilities(); return m_bGroupPossible; }
+ bool IsUnGroupPossible() const { ForcePossibilities(); return m_bUnGroupPossible; }
+ bool IsGroupEnterPossible() const { ForcePossibilities(); return m_bGrpEnterPossible; }
+
+ // Convert marked objects to polygones/Beziercurves. The bool-functions
+ // return sal_True, if at least one marked object could be converted.
+ // Also member objects of group objects are converted.
+ // For a better description see: SdrObj.HXX
+ bool IsConvertToPathObjPossible() const { ForcePossibilities(); return m_bCanConvToPath; }
+ bool IsConvertToPolyObjPossible() const { ForcePossibilities(); return m_bCanConvToPoly; }
+ bool IsConvertToContourPossible() const { ForcePossibilities(); return m_bCanConvToContour; }
+ void ConvertMarkedToPathObj(bool bLineToArea);
+ void ConvertMarkedToPolyObj();
+
+ // Align all marked objects vertically. Normally the SnapRect of an object is used.
+ void AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert);
+ bool IsAlignPossible() const;
+
+ // move marked objects "up"
+ void MovMarkedToTop();
+
+ // move marked objects "down"
+ void MovMarkedToBtm();
+
+ // move marked objects "at top"
+ void PutMarkedToTop();
+
+ // move marked objects "at bottom"
+ void PutMarkedToBtm();
+
+ // move marked immediately before the object passed
+ // NULL -> as PutMarkedToTop();
+ void PutMarkedInFrontOfObj(const SdrObject* pRefObj);
+
+ // move marked immediately after object passed
+ // NULL -> as PutMarkedToBtm();
+ void PutMarkedBehindObj(const SdrObject* pRefObj);
+
+ // swap Z-Order of marked objects
+ void ReverseOrderOfMarked();
+
+ // Check if forward, backward is possible.
+ // GetMaxToBtmObj() is only partly taken into account by these methods.
+ // Which means it can happen that IsToTopPossible() returns sal_True,
+ // but MovMarkedToTop() changes nothing (e.g. for multiple selections),
+ // as restriction derived via a view by GetMaxToTopObj() prevents this.
+ bool IsToTopPossible() const { ForcePossibilities(); return m_bToTopPossible; }
+ bool IsToBtmPossible() const { ForcePossibilities(); return m_bToBtmPossible; }
+ bool IsReverseOrderPossible() const { ForcePossibilities(); return m_bReverseOrderPossible; }
+
+ // Using this method the view determines how far an object
+ // can be moved forward or backward (Z-order).
+ // The object returned is not "obsolete". When NULL is
+ // returned there is not such a restriction.
+ virtual SdrObject* GetMaxToTopObj(SdrObject* pObj) const;
+ virtual SdrObject* GetMaxToBtmObj(SdrObject* pObj) const;
+
+ // Next method is called, if via ToTop, ToBtm, ... the
+ // sequence of object has been changed. It is called after
+ // each SdrObjList::SetObjectOrdNum(nOldPos,nNewPos);
+ virtual void ObjOrderChanged(SdrObject* pObj, size_t nOldPos, size_t nNewPos);
+
+ // If one or more objects of the type SdrGrafObj or SdrOle2Obj
+ // are marked and these are capable to deliver a StarView-metafile,
+ // this methods converts the metafile to a drawing object.
+ // The SdrGrafObjs/SdrOle2Objs are replaced by the new objects.
+ void DoImportMarkedMtf(SvdProgressInfo *pProgrInfo=nullptr);
+ bool IsImportMtfPossible() const { ForcePossibilities(); return m_bImportMtfPossible; }
+
+ // override SdrMarkView, for internal use
+ virtual void MarkListHasChanged() override;
+ virtual void ModelHasChanged() override;
+};
+
+#endif // INCLUDED_SVX_SVDEDTV_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
new file mode 100644
index 000000000..cbdecfea5
--- /dev/null
+++ b/include/svx/svdedxv.hxx
@@ -0,0 +1,325 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDEDXV_HXX
+#define INCLUDED_SVX_SVDEDXV_HXX
+
+#include <rtl/ref.hxx>
+#include <svl/languageoptions.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/svdglev.hxx>
+#include <svx/selectioncontroller.hxx>
+#include <editeng/editview.hxx>
+#include <memory>
+
+class SdrOutliner;
+class OutlinerView;
+class EditStatus;
+class EditFieldInfo;
+class ImpSdrEditPara;
+struct PasteOrDropInfos;
+class SdrUndoManager;
+class TextChainCursorManager;
+
+namespace com::sun::star::uno {
+ class Any;
+}
+
+namespace sdr {
+ class SelectionController;
+}
+
+enum class SdrEndTextEditKind
+{
+ Unchanged, // textobject unchanged
+ Changed, // textobject changed
+ Deleted, // textobject implicitly deleted
+ ShouldBeDeleted // for writer: textobject should be deleted
+};
+
+// - general edit for objectspecific properties
+// - textedit for all drawobjects, inherited from SdrTextObj
+// - macromode
+
+
+class SVXCORE_DLLPUBLIC SdrObjEditView : public SdrGlueEditView, public EditViewCallbacks
+{
+ friend class SdrPageView;
+ friend class ImpSdrEditPara;
+
+ // Now derived from EditViewCallbacks and overriding these callbacks to
+ // allow own EditText visualization
+ virtual void EditViewInvalidate(const tools::Rectangle& rRect) override;
+ virtual void EditViewSelectionChange() override;
+ virtual OutputDevice& EditViewOutputDevice() const override;
+ virtual Point EditViewPointerPosPixel() const override;
+ virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const override;
+ virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget() override;
+ virtual void EditViewInputContext(const InputContext& rInputContext) override;
+ virtual void EditViewCursorRect(const tools::Rectangle& rRect, int nExtTextInputWidth) override;
+
+ // The OverlayObjects used for visualizing active TextEdit (currently
+ // using TextEditOverlayObject, but not limited to it
+ sdr::overlay::OverlayObjectList maTEOverlayGroup;
+
+protected:
+ // TextEdit
+ tools::WeakReference<SdrTextObj> mxWeakTextEditObj; // current object in TextEdit
+ SdrPageView* mpTextEditPV;
+ std::unique_ptr<SdrOutliner> mpTextEditOutliner; // outliner for the TextEdit
+ OutlinerView* mpTextEditOutlinerView; // current view of the outliners
+ VclPtr<vcl::Window> mpTextEditWin; // matching window to pTextEditOutlinerView
+
+ vcl::Cursor* pTextEditCursorBuffer; // to restore the cursor in each window
+ SdrObject* pMacroObj;
+ SdrPageView* pMacroPV;
+ VclPtr<vcl::Window> pMacroWin;
+
+ tools::Rectangle aTextEditArea;
+ tools::Rectangle aMinTextEditArea;
+ Link<EditFieldInfo*,void> aOldCalcFieldValueLink; // for call the old handler
+ Point aMacroDownPos;
+
+ sal_uInt16 nMacroTol;
+
+ bool mbTextEditDontDelete : 1; // do not delete outliner and view of SdrEndTextEdit (f. spellchecking)
+ bool mbTextEditOnlyOneView : 1; // a single OutlinerView (f. spellchecking)
+ bool mbTextEditNewObj : 1; // current edited object was just recreated
+ bool mbQuickTextEditMode : 1; // persistent(->CrtV). Default=TRUE
+ bool mbMacroDown : 1;
+
+ rtl::Reference< sdr::SelectionController > mxSelectionController;
+ rtl::Reference< sdr::SelectionController > mxLastSelectionController;
+
+private:
+ SfxUndoManager* mpOldTextEditUndoManager;
+ std::unique_ptr<SdrUndoManager> mpLocalTextEditUndoManager;
+
+protected:
+ // Create a local UndoManager that is used for text editing.
+ virtual std::unique_ptr<SdrUndoManager> createLocalTextUndoManager();
+
+ void ImpMoveCursorAfterChainingEvent(TextChainCursorManager *pCursorManager);
+ std::unique_ptr<TextChainCursorManager> ImpHandleMotionThroughBoxesKeyInput(const KeyEvent& rKEvt, bool *bOutHandled);
+
+ OutlinerView* ImpFindOutlinerView(vcl::Window const * pWin) const;
+
+ // Create a new OutlinerView at the heap and initialize all required parameters.
+ // pTextEditObj, pTextEditPV and pTextEditOutliner have to be initialized
+ OutlinerView* ImpMakeOutlinerView(vcl::Window* pWin, OutlinerView* pGivenView, SfxViewShell* pViewShell = nullptr) const;
+ void ImpPaintOutlinerView(OutlinerView& rOutlView, const tools::Rectangle& rRect, OutputDevice& rTargetDevice) const;
+ void ImpInvalidateOutlinerView(OutlinerView const & rOutlView) const;
+
+ // Chaining
+ void ImpChainingEventHdl();
+ DECL_DLLPRIVATE_LINK(ImpAfterCutOrPasteChainingEventHdl, LinkParamNone*, void);
+
+
+ // Check if the whole text is selected.
+ // Still returns sal_True if there is no text present.
+ bool ImpIsTextEditAllSelected() const;
+ void ImpMakeTextCursorAreaVisible();
+
+ // handler for AutoGrowing text with active Outliner
+ DECL_DLLPRIVATE_LINK(ImpOutlinerStatusEventHdl, EditStatus&, void);
+ DECL_DLLPRIVATE_LINK(ImpOutlinerCalcFieldValueHdl, EditFieldInfo*, void);
+
+ // link for EndTextEditHdl
+ DECL_DLLPRIVATE_LINK(EndTextEditHdl, SdrUndoManager*, void);
+
+ void ImpMacroUp(const Point& rUpPos);
+ void ImpMacroDown(const Point& rDownPos);
+
+ DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos*, void );
+ DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos*, void );
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrObjEditView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
+ virtual ~SdrObjEditView() override;
+
+public:
+
+ // used to call the old ImpPaintOutlinerView. Will be replaced when the
+ // outliner will be displayed on the overlay in edit mode.
+ void TextEditDrawing(SdrPaintWindow& rPaintWindow);
+
+ // Actionhandling for macromode
+ virtual bool IsAction() const override;
+ virtual void MovAction(const Point& rPnt) override;
+ virtual void EndAction() override;
+ virtual void BrkAction() override;
+ virtual void BckAction() override;
+ virtual void TakeActionRect(tools::Rectangle& rRect) const override;
+
+ SdrPageView* ShowSdrPage(SdrPage* pPage) override;
+ void HideSdrPage() override;
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+ virtual void ModelHasChanged() override;
+
+ const std::unique_ptr<SdrUndoManager>& getViewLocalUndoManager() const
+ {
+ return mpLocalTextEditUndoManager;
+ }
+
+ // TextEdit over an outliner
+
+ // QuickTextEditMode = edit the text straight after selection. Default=TRUE. Persistent.
+ void SetQuickTextEditMode(bool bOn)
+ {
+ mbQuickTextEditMode = bOn;
+ }
+ bool IsQuickTextEditMode() const
+ {
+ return mbQuickTextEditMode;
+ }
+
+ // Start the TextEditMode. If pWin==NULL, use the first window, which is logged at the View.
+ // The cursor of the currently edited window is stored with SdrBeginTextEdit()
+ // and restored with SdrEndTextEdit().
+ // The app has to ensure, that the BegEdit of the window logged cursor is still valid,
+ // when SdrEndTextEdit is called.
+ // With the parameter pEditOutliner, the app has the possibility to specify his own outliner,
+ // which is used for editing. After the SdrBeginTextEdit call, the outliner belongs to
+ // SdrObjEditView, and is also later destroyed by this via delete (if bDontDeleteOutliner=sal_False).
+ // Afterwards the SdrObjEditView sets the modflag (EditEngine/Outliner) at this instance and also the
+ // StatusEventHdl.
+ // Similarly a specific OutlinerView can be specified.
+
+ virtual bool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = nullptr, vcl::Window* pWin = nullptr, bool bIsNewObj = false,
+ SdrOutliner* pGivenOutliner = nullptr, OutlinerView* pGivenOutlinerView = nullptr,
+ bool bDontDeleteOutliner = false, bool bOnlyOneView = false, bool bGrabFocus = true);
+ // bDontDeleteReally is a special parameter for writer
+ // If this flag is set, then a maybe empty textobject is not deleted.
+ // Instead you get a return code SdrEndTextEditKind::ShouldBeDeleted
+ // (in place of SDRENDTEXTEDIT_BEDELETED), which says, the obj should be
+ // deleted.
+ virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally = false);
+ virtual bool IsTextEdit() const final override;
+
+ // This method returns sal_True, if the point rHit is inside the
+ // objectspace or the OutlinerView.
+ bool IsTextEditHit(const Point& rHit) const;
+
+ // This method returns sal_True, if the point rHit is inside the
+ // handle-thick frame, which surrounds the OutlinerView at TextFrames.
+ bool IsTextEditFrameHit(const Point& rHit) const;
+
+ // At active selection, between MouseButtonDown and
+ // MouseButtonUp, this method always returns TRUE.
+ bool IsTextEditInSelectionMode() const;
+
+ // If sb needs the object out of the TextEdit:
+ SdrTextObj* GetTextEditObject() const { return mxWeakTextEditObj.get(); }
+
+ // info about TextEditPageView. Default is 0L.
+ SdrPageView* GetTextEditPageView() const;
+
+ // Current window of the outliners.
+ void SetTextEditWin(vcl::Window* pWin);
+
+ // Now at this outliner, events can be send, attributes can be set,
+ // call Cut/Copy/Paste, call Undo/Redo, and so on...
+ const SdrOutliner* GetTextEditOutliner() const
+ {
+ return mpTextEditOutliner.get();
+ }
+ SdrOutliner* GetTextEditOutliner()
+ {
+ return mpTextEditOutliner.get();
+ }
+ const OutlinerView* GetTextEditOutlinerView() const
+ {
+ return mpTextEditOutlinerView;
+ }
+ OutlinerView* GetTextEditOutlinerView()
+ {
+ return mpTextEditOutlinerView;
+ }
+
+ virtual bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) override;
+ virtual bool MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin) override;
+ virtual bool MouseButtonUp(const MouseEvent& rMEvt, OutputDevice* pWin) override;
+ virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override;
+ virtual bool Command(const CommandEvent& rCEvt, vcl::Window* pWin) override;
+
+ // #97766# make virtual to change implementation e.g. for SdOutlineView
+ virtual SvtScriptType GetScriptType() const;
+
+ /* new interface src537 */
+ void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
+
+ bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
+ SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const;
+ void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
+
+ // Intern: at mounting new OutlinerView...
+ virtual void AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pWindow) override;
+ virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin) override;
+
+ sal_uInt16 GetSelectionLevel() const;
+
+
+ // Object MacroMode (e.g. rect as button or sth. like that):
+
+ void BegMacroObj(const Point& rPnt, short nTol, SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin);
+ void BegMacroObj(const Point& rPnt, SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin) { BegMacroObj(rPnt,-2,pObj,pPV,pWin); }
+ void MovMacroObj(const Point& rPnt);
+ void BrkMacroObj();
+ bool EndMacroObj();
+ bool IsMacroObj() const { return pMacroObj!=nullptr; }
+
+ /** fills the given any with a XTextCursor for the current text selection.
+ Leaves the any untouched if there currently is no text selected */
+ void getTextSelection( css::uno::Any& rSelection );
+
+ virtual void MarkListHasChanged() override;
+
+ const rtl::Reference< sdr::SelectionController >& getSelectionController() const { return mxSelectionController; }
+
+ /** returns true if the shape identified by its inventor and identifier supports format paint brush operation */
+ static bool SupportsFormatPaintbrush( SdrInventor nObjectInventor, SdrObjKind nObjectIdentifier );
+
+ /** returns a format paint brush set from the current selection */
+ void TakeFormatPaintBrush( std::shared_ptr< SfxItemSet >& rFormatSet );
+
+ /** applies a format paint brush set from the current selection.
+ if bNoCharacterFormats is true, no character attributes are changed.
+ if bNoParagraphFormats is true, no paragraph attributes are changed.
+ */
+ void ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats );
+
+ /** helper function for selections with multiple SdrText for one SdrTextObj (f.e. tables ) */
+ static void ApplyFormatPaintBrushToText( SfxItemSet const & rFormatSet, SdrTextObj& rTextObj, SdrText* pText, bool bNoCharacterFormats, bool bNoParagraphFormats );
+
+ void DisposeUndoManager();
+
+protected:
+ virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfo );
+ virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfo );
+
+};
+
+#endif // INCLUDED_SVX_SVDEDXV_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdetc.hxx b/include/svx/svdetc.hxx
new file mode 100644
index 000000000..8bd6b744e
--- /dev/null
+++ b/include/svx/svdetc.hxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDETC_HXX
+#define INCLUDED_SVX_SVDETC_HXX
+
+#include <editeng/outliner.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/link.hxx>
+#include <tools/fract.hxx>
+#include <svx/svdobj.hxx>
+#include <svl/whichranges.hxx>
+#include <memory>
+
+
+/**
+ * Get ExchangeFormatID of the DrawingEngine.
+ * The data can then be made available via
+ * static bool CopyData(pData,nLen,nFormat);
+ *
+ * However, pData/nLen describe an SvMemoryStream in which an SdrModel is
+ * streamed. For its lifetime, the flag SdrModel::SetStreamingSdrModel(true)
+ * is set.
+ */
+
+class SdrOutliner;
+class SdrModel;
+class SvtSysLocale;
+class LocaleDataWrapper;
+
+namespace com::sun::star::lang {
+ struct Locale;
+}
+
+/**
+ * Create an Outliner with the engine-global default settings on the heap.
+ * If pMod != nullptr, the MapMode of the passed model is used.
+ * The resulting default font height, however, stays the same (the logical
+ * font height is converted).
+ */
+SVXCORE_DLLPUBLIC std::unique_ptr<SdrOutliner> SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel& rMod);
+
+/**
+ * Global default settings for the DrawingEngine.
+ *
+ * One should set these default settings as the first
+ * thing at program start, before any other method is called.
+ */
+namespace SdrEngineDefaults
+{
+ // Default FontColor is COL_AUTO
+ inline Color GetFontColor() { return COL_AUTO; }
+
+ // Default FontHeight is 847. The font height uses logical units (MapUnit/MapFraction
+ // see below for further details). The default setting 847/100mm corresponds to about
+ // 24 Point. If e.g. one would use Twips (SetMapUnit(MapUnit::MapTwip)) (20 Twip = 1 Point)
+ // instead, one would need to set the font height to 480, in order to get a 24 Point height.
+ inline size_t GetFontHeight() { return 847; }
+
+ // The MapMode is needed for the global Outliner.
+ // Incidentally, every newly instantiated SdrModel is assigned this MapMode by default.
+ // Default MapUnit is MapUnit::Map100thMM
+ inline MapUnit GetMapUnit() { return MapUnit::Map100thMM; }
+
+ // Default MapFraction is 1/1.
+ inline Fraction GetMapFraction() { return Fraction(1, 1); }
+};
+
+class SfxItemSet;
+
+/**
+ * Returns a replacement for an XFillStyle
+ *
+ * @returns false for XFILL_NONE and rCol remains unchanged
+ */
+SVXCORE_DLLPUBLIC bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol);
+
+
+/**
+ * Search an ItemSet for Outliner/EditEngine Items
+ *
+ * @returns true, if the set contains such items
+ */
+bool SearchOutlinerItems(const SfxItemSet& rSet, bool bInklDefaults, bool* pbOnlyEE=nullptr);
+
+/**
+ * @returns a new WhichTable, which we need to squash at some point with a delete
+ */
+WhichRangesContainer RemoveWhichRange(const WhichRangesContainer& pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd);
+
+/**
+ * Helper class for the communication between the dialog
+ * In order to break open Metafiles (sd/source/ui/dlg/brkdlg.cxx),
+ * SdrEditView::DoImportMarkedMtf() and ImpSdrGDIMetaFileImport::DoImport()
+ */
+class SVXCORE_DLLPUBLIC SvdProgressInfo
+{
+private:
+ size_t m_nSumCurAction; // Sum of all handled Actions
+
+ size_t m_nActionCount; // Count of Actions in the current object
+ size_t m_nCurAction; // Count of handled Actions in the current object
+
+ size_t m_nInsertCount; // Count of to-be-inserted Actions in the current object
+ size_t m_nCurInsert; // Count of already inserted Actions
+
+ size_t m_nObjCount; // Count of selected objects
+ size_t m_nCurObj; // Current object
+
+ Link<void*,bool> maLink;
+
+public:
+ SvdProgressInfo( const Link<void*,bool>& _pLink );
+
+ void Init( size_t _nObjCount );
+
+ void SetNextObject();
+
+ void SetActionCount( size_t _nActionCount );
+ void SetInsertCount( size_t _nInsertCount );
+
+ bool ReportActions( size_t nActionCount );
+ void ReportInserts( size_t nInsertCount );
+
+ size_t GetSumCurAction() const { return m_nSumCurAction; };
+ size_t GetObjCount() const { return m_nObjCount; };
+ size_t GetCurObj() const { return m_nCurObj; };
+
+ size_t GetActionCount() const { return m_nActionCount; };
+ size_t GetCurAction() const { return m_nCurAction; };
+
+ size_t GetInsertCount() const { return m_nInsertCount; };
+ size_t GetCurInsert() const { return m_nCurInsert; };
+
+ void ReportRescales( size_t nRescaleCount );
+};
+
+
+std::vector<Link<SdrObjCreatorParams, SdrObject*>>& ImpGetUserMakeObjHdl();
+
+class SdrOle2Obj;
+class AutoTimer;
+
+class OLEObjCache
+{
+ std::vector<SdrOle2Obj*> maObjs;
+
+ size_t nSize;
+ std::unique_ptr<AutoTimer> pTimer;
+
+ static bool UnloadObj(SdrOle2Obj& rObj);
+ DECL_LINK( UnloadCheckHdl, Timer*, void );
+
+public:
+ OLEObjCache();
+ SVXCORE_DLLPUBLIC ~OLEObjCache();
+
+ void InsertObj(SdrOle2Obj* pObj);
+ void RemoveObj(SdrOle2Obj* pObj);
+
+ SVXCORE_DLLPUBLIC size_t size() const;
+ SVXCORE_DLLPUBLIC SdrOle2Obj* operator[](size_t nPos);
+ SVXCORE_DLLPUBLIC const SdrOle2Obj* operator[](size_t nPos) const;
+};
+
+
+class SVXCORE_DLLPUBLIC SdrGlobalData
+{
+ const SvtSysLocale* pSysLocale; // follows always locale settings
+public:
+ std::vector<Link<SdrObjCreatorParams, SdrObject*>>
+ aUserMakeObjHdl;
+ OLEObjCache aOLEObjCache;
+
+
+ const SvtSysLocale* GetSysLocale(); // follows always locale settings
+ const LocaleDataWrapper* GetLocaleData(); // follows always SysLocale
+public:
+ SdrGlobalData();
+
+ OLEObjCache& GetOLEObjCache() { return aOLEObjCache; }
+};
+
+SVXCORE_DLLPUBLIC SdrGlobalData & GetSdrGlobalData();
+
+
+// #i101872# isolated GetTextEditBackgroundColor for tooling
+class SdrObjEditView;
+
+SVXCORE_DLLPUBLIC Color GetTextEditBackgroundColor(const SdrObjEditView& rView);
+
+
+#endif // INCLUDED_SVX_SVDETC_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdglev.hxx b/include/svx/svdglev.hxx
new file mode 100644
index 000000000..5a7d3a2eb
--- /dev/null
+++ b/include/svx/svdglev.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDGLEV_HXX
+#define INCLUDED_SVX_SVDGLEV_HXX
+
+#include <svx/svxdllapi.h>
+#include <svx/svdpoev.hxx>
+
+class SdrGluePoint;
+
+
+// Edit GluePoints at the objects (GluePoints for connector)
+
+
+class SVXCORE_DLLPUBLIC SdrGlueEditView : public SdrPolyEditView
+{
+ // copy marked GluePoints and mark instead of the old ones
+ void ImpCopyMarkedGluePoints();
+ typedef void (*PGlueDoFunc)(SdrGluePoint&, const SdrObject* pObj, const void*, const void*, const void*, const void*);
+ typedef void (*PGlueTrFunc)(Point&, const void*, const void*, const void*, const void*);
+ void ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, const void* p1, const void* p2=nullptr, const void* p3=nullptr, const void* p4=nullptr);
+ void ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const void* p1, const void* p2=nullptr, const void* p3=nullptr, const void* p4=nullptr);
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrGlueEditView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
+ virtual ~SdrGlueEditView() override;
+
+public:
+ // the parameter nThisEsc is used to hand over the direction,
+ // which one wished to check,set or delete
+ // possible values for nThisEsc are:
+ // SdrEscapeDirection::LEFT, SdrEscapeDirection::RIGHT, SdrEscapeDirection::TOP and SdrEscapeDirection::BOTTOM
+ TriState IsMarkedGluePointsEscDir(SdrEscapeDirection nThisEsc) const;
+ void SetMarkedGluePointsEscDir(SdrEscapeDirection nThisEsc, bool bOn);
+
+ // check/set, if the GluePoints are relative to the
+ // object size (Percent=sal_True) or not (Percent=sal_False)
+ TriState IsMarkedGluePointsPercent() const;
+ void SetMarkedGluePointsPercent(bool bOn);
+
+ // bVert=FALSE: check/set horizontal alignment
+ // SdrAlign::HORZ_CENTER
+ // SdrAlign::HORZ_LEFT
+ // SdrAlign::HORZ_RIGHT
+ // SdrAlign::HORZ_DONTCARE (only at Get())
+ // bVert=TRUE: check/set vertical alignment
+ // SdrAlign::VERT_CENTER
+ // SdrAlign::VERT_TOP
+ // SdrAlign::VERT_BOTTOM
+ // SdrAlign::VERT_DONTCARE (only at Get())
+ SdrAlign GetMarkedGluePointsAlign(bool bVert) const;
+ void SetMarkedGluePointsAlign(bool bVert, SdrAlign nAlign);
+
+ // delete all marked GluePoints
+ void DeleteMarkedGluePoints();
+
+ void MoveMarkedGluePoints (const Size& rSiz, bool bCopy);
+ void ResizeMarkedGluePoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy);
+ void RotateMarkedGluePoints(const Point& rRef, Degree100 nAngle, bool bCopy);
+};
+
+#endif // INCLUDED_SVX_SVDGLEV_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdglue.hxx b/include/svx/svdglue.hxx
new file mode 100644
index 000000000..3c70ebeac
--- /dev/null
+++ b/include/svx/svdglue.hxx
@@ -0,0 +1,228 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDGLUE_HXX
+#define INCLUDED_SVX_SVDGLUE_HXX
+
+#include <tools/gen.hxx>
+#include <tools/degree.hxx>
+#include <svx/svxdllapi.h>
+#include <vector>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace vcl { class Window; }
+class OutputDevice;
+class SdrObject;
+
+
+enum class SdrEscapeDirection
+{
+ SMART = 0x0000,
+ LEFT = 0x0001,
+ RIGHT = 0x0002,
+ TOP = 0x0004,
+ BOTTOM = 0x0008,
+ HORZ = LEFT | RIGHT,
+ VERT = TOP | BOTTOM,
+ ALL = 0x00ff,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SdrEscapeDirection> : is_typed_flags<SdrEscapeDirection, 0x00ff> {};
+}
+
+enum class SdrAlign
+{
+ NONE = 0x0000,
+ HORZ_CENTER = 0x0000,
+ HORZ_LEFT = 0x0001,
+ HORZ_RIGHT = 0x0002,
+ HORZ_DONTCARE = 0x0010,
+ VERT_CENTER = 0x0000,
+ VERT_TOP = 0x0100,
+ VERT_BOTTOM = 0x0200,
+ VERT_DONTCARE = 0x1000,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SdrAlign> : is_typed_flags<SdrAlign, 0x1313> {};
+}
+
+class SVXCORE_DLLPUBLIC SdrGluePoint {
+ // Reference Point is SdrObject::GetSnapRect().Center()
+ // bNoPercent=false: position is -5000..5000 (1/100)% or 0..10000 (depending on align)
+ // bNoPercent=true : position is in log unit, relative to the reference point
+ Point aPos;
+ SdrEscapeDirection nEscDir;
+ sal_uInt16 nId;
+ SdrAlign nAlign;
+ bool bNoPercent:1;
+ bool bReallyAbsolute:1; // temp for transformations on the reference object
+ bool bUserDefined:1; // #i38892#
+public:
+ SdrGluePoint()
+ : nEscDir(SdrEscapeDirection::SMART)
+ , nId(0)
+ , nAlign(SdrAlign::NONE)
+ , bNoPercent(false)
+ , bReallyAbsolute(false)
+ , bUserDefined(true)
+ {}
+ SdrGluePoint(const Point& rNewPos)
+ : aPos(rNewPos)
+ , nEscDir(SdrEscapeDirection::SMART)
+ , nId(0)
+ , nAlign(SdrAlign::NONE)
+ , bNoPercent(false)
+ , bReallyAbsolute(false)
+ , bUserDefined(true)
+ {}
+ const Point& GetPos() const
+ {
+ return aPos;
+ }
+ void SetPos(const Point& rNewPos)
+ {
+ aPos = rNewPos;
+ }
+ SdrEscapeDirection GetEscDir() const
+ {
+ return nEscDir;
+ }
+ void SetEscDir(SdrEscapeDirection nNewEsc)
+ {
+ nEscDir = nNewEsc;
+ }
+ sal_uInt16 GetId() const
+ {
+ return nId;
+ }
+ void SetId(sal_uInt16 nNewId)
+ {
+ nId = nNewId;
+ }
+ bool IsPercent() const
+ {
+ return !bNoPercent;
+ }
+ void SetPercent(bool bOn)
+ {
+ bNoPercent = !bOn;
+ }
+ // temp for transformations on the reference object
+ void SetReallyAbsolute(bool bOn, const SdrObject& rObj);
+
+ // #i38892#
+ bool IsUserDefined() const
+ {
+ return bUserDefined;
+ }
+ void SetUserDefined(bool bNew)
+ {
+ bUserDefined = bNew;
+ }
+
+ SdrAlign GetAlign() const
+ {
+ return nAlign;
+ }
+ void SetAlign(SdrAlign nAlg)
+ {
+ nAlign = nAlg;
+ }
+ SdrAlign GetHorzAlign() const
+ {
+ return nAlign & static_cast<SdrAlign>(0x00FF);
+ }
+ void SetHorzAlign(SdrAlign nAlg)
+ {
+ assert((nAlg & static_cast<SdrAlign>(0xFF00)) == SdrAlign::NONE);
+ nAlign = SdrAlign(nAlign & static_cast<SdrAlign>(0xFF00)) | (nAlg & static_cast<SdrAlign>(0x00FF));
+ }
+ SdrAlign GetVertAlign() const
+ {
+ return nAlign & static_cast<SdrAlign>(0xFF00);
+ }
+ void SetVertAlign(SdrAlign nAlg)
+ {
+ assert((nAlg & static_cast<SdrAlign>(0x00FF)) == SdrAlign::NONE);
+ nAlign = SdrAlign(nAlign & static_cast<SdrAlign>(0x00FF)) | (nAlg & static_cast<SdrAlign>(0xFF00));
+ }
+
+ bool IsHit(const Point& rPnt, const OutputDevice& rOut, const SdrObject* pObj) const;
+ void Invalidate(vcl::Window& rWin, const SdrObject* pObj) const;
+ Point GetAbsolutePos(const SdrObject& rObj) const;
+ void SetAbsolutePos(const Point& rNewPos, const SdrObject& rObj);
+ Degree100 GetAlignAngle() const;
+ void SetAlignAngle(Degree100 nAngle);
+ static Degree100 EscDirToAngle(SdrEscapeDirection nEsc);
+ static SdrEscapeDirection EscAngleToDir(Degree100 nAngle);
+ void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs, const SdrObject* pObj);
+ void Mirror(const Point& rRef1, const Point& rRef2, Degree100 nAngle, const SdrObject* pObj);
+ void Shear (const Point& rRef, double tn, bool bVShear, const SdrObject* pObj);
+};
+
+#define SDRGLUEPOINT_NOTFOUND 0xFFFF
+
+class SVXCORE_DLLPUBLIC SdrGluePointList
+{
+ std::vector<SdrGluePoint> aList;
+public:
+ SdrGluePointList() {};
+ SdrGluePointList(const SdrGluePointList& rSrcList)
+ {
+ *this = rSrcList;
+ }
+
+ SdrGluePointList& operator=(const SdrGluePointList& rSrcList);
+ sal_uInt16 GetCount() const
+ {
+ return sal_uInt16(aList.size());
+ }
+ // At insert, the object (GluePoint) automatically gets an ID assigned.
+ // Return value is the index of the new GluePoint in the list.
+ sal_uInt16 Insert(const SdrGluePoint& rGP);
+ void Delete(sal_uInt16 nPos)
+ {
+ aList.erase(aList.begin() + nPos);
+ }
+ SdrGluePoint& operator[](sal_uInt16 nPos)
+ {
+ return aList[nPos];
+ }
+ const SdrGluePoint& operator[](sal_uInt16 nPos) const
+ {
+ return aList[nPos];
+ }
+ sal_uInt16 FindGluePoint(sal_uInt16 nId) const;
+ sal_uInt16 HitTest(const Point& rPnt, const OutputDevice& rOut, const SdrObject* pObj) const;
+ void Invalidate(vcl::Window& rWin, const SdrObject* pObj) const;
+
+ // temp for transformations on the reference object
+ void SetReallyAbsolute(bool bOn, const SdrObject& rObj);
+ void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs, const SdrObject* pObj);
+ void Mirror(const Point& rRef1, const Point& rRef2, const SdrObject* pObj);
+ void Mirror(const Point& rRef1, const Point& rRef2, Degree100 nAngle, const SdrObject* pObj);
+ void Shear(const Point& rRef, double tn, bool bVShear, const SdrObject* pObj);
+};
+
+
+#endif // INCLUDED_SVX_SVDGLUE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdhdl.hxx b/include/svx/svdhdl.hxx
new file mode 100644
index 000000000..461937c05
--- /dev/null
+++ b/include/svx/svdhdl.hxx
@@ -0,0 +1,535 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDHDL_HXX
+#define INCLUDED_SVX_SVDHDL_HXX
+
+#include <tools/gen.hxx>
+#include <vcl/graph.hxx>
+
+#include <svx/svdoedge.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/overlay/overlayobjectlist.hxx>
+#include <svx/svxdllapi.h>
+#include <deque>
+
+class OutputDevice;
+class SdrHdlList;
+class SdrMarkView;
+class SdrObject;
+class SdrPageView;
+class MouseEvent;
+class HelpEvent;
+
+namespace sdr::contact {
+ class ObjectContact;
+}
+
+// Every object must be able to create its handles. They will be fetched on
+// selection, registered at the View and made visible.
+// When a handle is touched by the mouse (IsHit()), from the view the matching mouse pointer
+// is picked up from the handle and passed to the app (on demand) to be switched on
+// Handles like e.g. rotation center or the mirror axis are generated by
+// the view if the correct transformation mode was selected by the controller.
+// SdrHdlKind::Move...SdrHdlKind::LowerRight should always be consecutive in the enum!
+
+enum class SdrHdlKind
+{
+ Move, // Handle to move the object
+ UpperLeft, // Upper left
+ Upper, // Upper
+ UpperRight, // Upper right
+ Left, // Left
+ Right, // Right
+ LowerLeft, // Bottom left
+ Lower, // Bottom
+ LowerRight, // Bottom right
+ Poly, // Select point in polygon or beziercurve
+ BezierWeight, // Weight of a beziercurve
+ Circle, // Angle to circle segment, corner radius to rectangle
+ Ref1, // Reference point 1, e.g. rotation center
+ Ref2, // Reference point 2, e.g. endpoint of mirror axis
+ MirrorAxis, // Mirror axis
+ Glue, // GluePoint
+ Anchor, // Anchor symbol (SD, SW)
+ Transparence, // Interactive transparence
+ Gradient, // Interactive gradient
+ Color, // Interactive color
+ User,
+ Anchor_TR, // #101688# Anchor handle with (0,0) at top right for SW
+
+ // for SJ and the CustomShapeHandles:
+ CustomShape1,
+
+ SmartTag
+};
+
+
+enum class BitmapColorIndex
+{
+ LightGreen = 0,
+ Cyan = 1,
+ LightCyan = 2,
+ Red = 3,
+ LightRed = 4,
+ Yellow = 5,
+};
+
+
+enum class BitmapMarkerKind
+{
+ Rect_7x7,
+ Rect_9x9,
+ Rect_11x11,
+ Rect_13x13,
+ Circ_7x7,
+ Circ_9x9,
+ Circ_11x11,
+ Elli_7x9,
+ Elli_9x11,
+ Elli_9x7,
+ Elli_11x9,
+ RectPlus_7x7,
+ RectPlus_9x9,
+ RectPlus_11x11,
+ Crosshair,
+ Glue,
+ Glue_Deselected,
+ Anchor,
+
+ // #98388# add AnchorPressed to be able to animate anchor control, too.
+ AnchorPressed,
+
+ // #101688# AnchorTR for SW
+ AnchorTR,
+ AnchorPressedTR,
+
+ // for SJ and the CustomShapeHandles:
+ Customshape_7x7,
+ Customshape_9x9,
+ Customshape_11x11
+};
+
+
+class SVXCORE_DLLPUBLIC SdrHdl
+{
+ friend class SdrMarkView; // for the access to nObjHdlNum
+ friend class SdrHdlList;
+
+protected:
+ SdrObject* pObj; // does handle belong to an object?
+ SdrPageView* pPV; // does handle belong to an object in certain pageview?
+ SdrHdlList* pHdlList; // to store the handlesize
+ // OVERLAYMANAGER
+ sdr::overlay::OverlayObjectList maOverlayGroup;
+
+ Point aPos;
+
+ SdrHdlKind eKind;
+
+ Degree100 nRotationAngle; // turn handle or mousepointer
+ sal_uInt32 nObjHdlNum; // required by MarkView
+ sal_uInt32 nPolyNum; // Polygonpoint
+ sal_uInt32 nPPntNum; // Point number of the polygon
+ sal_uInt32 nSourceHdlNum; // still to implement
+
+ bool bSelect : 1; // is a polygon point selected?
+ bool b1PixMore : 1; // True=handle is shown 1 pixel larger
+ bool bPlusHdl : 1; // for Hld-Paint optimisation at MarkPoint/UnmarkPoint, and other ...
+
+ bool mbMoveOutside; // forces this handle to be moved outside of the selection rectangle
+
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+ // cleanup marker if one exists
+ void GetRidOfIAObject();
+
+private:
+ bool mbMouseOver; // is true if the mouse is over this handle
+
+protected:
+ std::unique_ptr<sdr::overlay::OverlayObject> CreateOverlayObject(
+ const basegfx::B2DPoint& rPos,
+ BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker,
+ Point aMoveOutsideOffset = Point());
+ static BitmapMarkerKind GetNextBigger(BitmapMarkerKind eKnd);
+
+ // Helper to support inserting a new OverlayObject. It will do all
+ // necessary stuff involved with that:
+ // - add GridOffset for non-linear ViewToDevice transformation (calc)
+ // - add to OverlayManager
+ // - add to local OverlayObjectList - ownership change (!)
+ // It is centralized here (and protected) to avoid that new usages/
+ // implementations forget one of these needed steps.
+ void insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject,
+ const sdr::contact::ObjectContact& rObjectContact,
+ sdr::overlay::OverlayManager& rOverlayManager);
+
+public:
+ SdrHdl();
+ explicit SdrHdl(const Point& rPnt, SdrHdlKind eNewKind);
+ virtual ~SdrHdl();
+
+ const sdr::overlay::OverlayObjectList& getOverlayObjectList() const { return maOverlayGroup; }
+
+ void SetHdlList(SdrHdlList* pList);
+ SdrHdlKind GetKind() const { return eKind; }
+ void Touch();
+
+ const Point& GetPos() const { return aPos; }
+ void SetPos(const Point& rPnt);
+
+ SdrPageView* GetPageView() const { return pPV; }
+ void SetPageView(SdrPageView* pNewPV) { pPV=pNewPV; }
+
+ SdrObject* GetObj() const { return pObj; }
+ void SetObj(SdrObject* pNewObj);
+
+ bool IsSelected() const { return bSelect; }
+ void SetSelected(bool bJa=true);
+
+ void Set1PixMore(bool bJa=true);
+ void SetRotationAngle(Degree100 n);
+
+ bool IsCornerHdl() const { return eKind==SdrHdlKind::UpperLeft || eKind==SdrHdlKind::UpperRight || eKind==SdrHdlKind::LowerLeft || eKind==SdrHdlKind::LowerRight; }
+ bool IsVertexHdl() const { return eKind==SdrHdlKind::Upper || eKind==SdrHdlKind::Lower || eKind==SdrHdlKind::Left || eKind==SdrHdlKind::Right; }
+
+ void SetObjHdlNum(sal_uInt32 nNum) { nObjHdlNum=nNum; }
+ sal_uInt32 GetObjHdlNum() const { return nObjHdlNum; }
+
+ void SetPolyNum(sal_uInt32 nNum) { nPolyNum=nNum; }
+ sal_uInt32 GetPolyNum() const { return nPolyNum; }
+
+ void SetPointNum(sal_uInt32 nNum) { nPPntNum=nNum; }
+ sal_uInt32 GetPointNum() const { return nPPntNum; }
+
+ void SetPlusHdl(bool bOn) { bPlusHdl=bOn; }
+ bool IsPlusHdl() const { return bPlusHdl; }
+
+ void SetSourceHdlNum(sal_uInt32 nNum) { nSourceHdlNum=nNum; }
+ sal_uInt32 GetSourceHdlNum() const { return nSourceHdlNum; }
+
+ virtual PointerStyle GetPointer() const;
+ bool IsHdlHit(const Point& rPnt) const;
+
+ virtual bool IsFocusHdl() const;
+
+ void SetMoveOutside( bool bMoveOutside );
+
+ /** is called when the mouse enters the area of this handle. If the handle changes his
+ visualisation during mouse over it must override this method and call Touch(). */
+ virtual void onMouseEnter(const MouseEvent& rMEvt);
+
+ /** is called when help is requested for the area of this handle */
+ virtual void onHelpRequest();
+
+ /** is called when the mouse leaves the area of this handle. If the handle changes his
+ visualisation during mouse over it must override this method and call Touch(). */
+ virtual void onMouseLeave();
+
+ static BitmapEx createGluePointBitmap();
+};
+
+
+#define SDR_HANDLE_COLOR_SIZE_NORMAL Size(13, 13)
+#define SDR_HANDLE_COLOR_SIZE_SELECTED Size(17, 17)
+
+class SVXCORE_DLLPUBLIC SdrHdlColor final : public SdrHdl
+{
+ // size of colr markers
+ Size aMarkerSize;
+
+ // color
+ Color aMarkerColor;
+
+ // callback link when value changed
+ Link<SdrHdlColor*,void> aColorChangeHdl;
+
+ // use luminance values only
+ bool bUseLuminance : 1;
+
+ // create marker for this kind
+ SVX_DLLPRIVATE virtual void CreateB2dIAObject() override;
+
+ // help functions
+ SVX_DLLPRIVATE BitmapEx CreateColorDropper(Color aCol);
+ SVX_DLLPRIVATE static Color GetLuminance(const Color& rCol);
+
+public:
+ explicit SdrHdlColor(const Point& rRef, Color aCol, const Size& rSize, bool bLuminance);
+ virtual ~SdrHdlColor() override;
+
+ bool IsUseLuminance() const { return bUseLuminance; }
+
+ const Color& GetColor() const { return aMarkerColor; }
+ void SetColor(Color aNew, bool bCallLink = false);
+
+ void SetSize(const Size& rNew);
+
+ void SetColorChangeHdl(const Link<SdrHdlColor*,void>& rLink) { aColorChangeHdl = rLink; }
+};
+
+
+class SdrHdlGradient final : public SdrHdl
+{
+private:
+ // pointer to used color handles
+ SdrHdlColor* pColHdl1;
+ SdrHdlColor* pColHdl2;
+
+ // 2nd position
+ Point a2ndPos;
+
+ // is this a gradient or a transparence
+ bool bGradient : 1;
+
+ // select which handle to move
+ bool bMoveSingleHandle : 1;
+ bool bMoveFirstHandle : 1;
+
+ // create marker for this kind
+ virtual void CreateB2dIAObject() override;
+
+public:
+ SdrHdlGradient(const Point& rRef1, const Point& rRef2, bool bGrad);
+ virtual ~SdrHdlGradient() override;
+
+ bool IsGradient() const { return bGradient; }
+
+ // set the associated color handles
+ void SetColorHandles(SdrHdlColor* pL1, SdrHdlColor* pL2) { pColHdl1 = pL1; pColHdl2 = pL2; }
+ SdrHdlColor* GetColorHdl1() const { return pColHdl1; }
+ SdrHdlColor* GetColorHdl2() const { return pColHdl2; }
+
+ const Point& Get2ndPos() const { return a2ndPos; }
+ void Set2ndPos(const Point& rPnt);
+
+ // the link called by the color handles
+ DECL_LINK(ColorChangeHdl, SdrHdlColor*, void);
+
+ // transformation call, create gradient from this handle
+ void FromIAOToItem(SdrObject* pObj, bool bSetItemOnObject, bool bUndo);
+
+ // selection flags for interaction
+ bool IsMoveSingleHandle() const { return bMoveSingleHandle; }
+ void SetMoveSingleHandle(bool bNew) { bMoveSingleHandle = bNew; }
+ bool IsMoveFirstHandle() const { return bMoveFirstHandle; }
+ void SetMoveFirstHandle(bool bNew) { bMoveFirstHandle = bNew; }
+};
+
+
+// Mirror axis
+class SdrHdlLine final : public SdrHdl
+{
+ // create marker for this kind
+ virtual void CreateB2dIAObject() override;
+
+ SdrHdl* pHdl1;
+ SdrHdl* pHdl2;
+
+public:
+ SdrHdlLine(SdrHdl& rHdl1, SdrHdl& rHdl2, SdrHdlKind eNewKind) { eKind=eNewKind; pHdl1=&rHdl1; pHdl2=&rHdl2; }
+ virtual ~SdrHdlLine() override;
+
+ virtual PointerStyle GetPointer() const override;
+};
+
+// a SdrHdlBezWgt knows about its "base handle". Its draw method
+// draws additionally a line from its position to the position
+// of the base handle
+class SdrHdlBezWgt final : public SdrHdl
+{
+public:
+ // this is not a Copy-Ctor!!!
+ SdrHdlBezWgt(const SdrHdl* pRefHdl1, SdrHdlKind eNewKind=SdrHdlKind::BezierWeight) { eKind=eNewKind; pHdl1=pRefHdl1; }
+ virtual ~SdrHdlBezWgt() override;
+
+private:
+ // create marker for this kind
+ virtual void CreateB2dIAObject() override;
+
+ const SdrHdl* pHdl1;
+};
+
+
+class E3dVolumeMarker final : public SdrHdl
+{
+ basegfx::B2DPolyPolygon aWireframePoly;
+
+ // create marker for this kind
+ virtual void CreateB2dIAObject() override;
+
+public:
+ explicit E3dVolumeMarker(const basegfx::B2DPolyPolygon& rWireframePoly);
+};
+
+
+class ImpEdgeHdl final : public SdrHdl
+{
+ SdrEdgeLineCode eLineCode;
+
+ // create marker for this kind
+ virtual void CreateB2dIAObject() override;
+
+public:
+ ImpEdgeHdl(const Point& rPnt, SdrHdlKind eNewKind): SdrHdl(rPnt,eNewKind),eLineCode(SdrEdgeLineCode::MiddleLine) {}
+ virtual ~ImpEdgeHdl() override;
+
+ void SetLineCode(SdrEdgeLineCode eCode);
+ SdrEdgeLineCode GetLineCode() const { return eLineCode; }
+ bool IsHorzDrag() const;
+ virtual PointerStyle GetPointer() const override;
+};
+
+
+class ImpMeasureHdl final : public SdrHdl
+{
+ // create marker for this kind
+ virtual void CreateB2dIAObject() override;
+
+public:
+ ImpMeasureHdl(const Point& rPnt, SdrHdlKind eNewKind): SdrHdl(rPnt,eNewKind) {}
+ virtual ~ImpMeasureHdl() override;
+
+ virtual PointerStyle GetPointer() const override;
+};
+
+
+class ImpTextframeHdl final : public SdrHdl
+{
+ const tools::Rectangle maRect;
+
+ // create marker for this kind
+ virtual void CreateB2dIAObject() override;
+
+public:
+ explicit ImpTextframeHdl(const tools::Rectangle& rRect);
+};
+
+
+class SVXCORE_DLLPUBLIC SdrHdlList
+{
+ size_t mnFocusIndex;
+ SdrMarkView* pView;
+ std::deque<std::unique_ptr<SdrHdl>> maList;
+ sal_uInt16 nHdlSize;
+
+ bool bRotateShear : 1;
+ bool bDistortShear : 1;
+ bool bMoveOutside : 1; // move handles outwards (for TextEdit)
+
+ SVX_DLLPRIVATE SdrHdlList(const SdrHdlList&) = delete;
+ SVX_DLLPRIVATE void operator=(const SdrHdlList&) = delete;
+
+public:
+ explicit SdrHdlList(SdrMarkView* pV);
+ ~SdrHdlList();
+ void Clear();
+
+ void TravelFocusHdl(bool bForward);
+ SdrHdl* GetFocusHdl() const;
+ void SetFocusHdl(SdrHdl* pNew);
+ void ResetFocusHdl();
+
+ // Access to View
+ SdrMarkView* GetView() const { return pView;}
+
+ // Sorting: 1.Level first reference point handle, then normal handles, next Glue, then User then Plushandles
+ // 2.Level PageView (Pointer)
+ // 3.Level Position (x+y)
+ void Sort();
+ size_t GetHdlCount() const { return maList.size(); }
+ SdrHdl* GetHdl(size_t nNum) const { return nNum < maList.size() ? maList[nNum].get() : nullptr; }
+ size_t GetHdlNum(const SdrHdl* pHdl) const;
+ void SetHdlSize(sal_uInt16 nSiz);
+ sal_uInt16 GetHdlSize() const { return nHdlSize; }
+ void SetMoveOutside(bool bOn);
+ bool IsMoveOutside() const { return bMoveOutside; }
+ void SetRotateShear(bool bOn);
+ bool IsRotateShear() const { return bRotateShear; }
+ void SetDistortShear(bool bOn);
+ bool IsDistortShear() const { return bDistortShear; }
+
+ // AddHdl takes ownership of the handle. It should be on the Heap
+ // as Clear() deletes it.
+ void AddHdl(std::unique_ptr<SdrHdl> pHdl);
+ std::unique_ptr<SdrHdl> RemoveHdl(size_t nNum);
+ void RemoveAllByKind(SdrHdlKind eKind);
+
+ // move the ownership of all the SdrHdl to rOther
+ void MoveTo(SdrHdlList& rOther);
+
+ // Last inserted handles are likely hit (if the handles are above each other)
+ SdrHdl* IsHdlListHit(const Point& rPnt) const;
+ SdrHdl* GetHdl(SdrHdlKind eKind1) const;
+};
+
+
+class SVXCORE_DLLPUBLIC SdrCropHdl final : public SdrHdl
+{
+public:
+ SdrCropHdl(
+ const Point& rPnt,
+ SdrHdlKind eNewKind,
+ double fShearX,
+ double fRotation);
+
+private:
+ // create marker for this kind
+ virtual void CreateB2dIAObject() override;
+
+ BitmapEx GetBitmapForHandle( const BitmapEx& rBitmap, int nSize );
+
+ // evtl. shear and rotation, equal to the object's one to allow adaptation of
+ // the visualization handles
+ double mfShearX;
+ double mfRotation;
+};
+
+
+class SdrCropViewHdl final : public SdrHdl
+{
+private:
+ basegfx::B2DHomMatrix maObjectTransform;
+ Graphic maGraphic;
+ double mfCropLeft;
+ double mfCropTop;
+ double mfCropRight;
+ double mfCropBottom;
+
+public:
+ SdrCropViewHdl(
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const Graphic& rGraphic,
+ double fCropLeft,
+ double fCropTop,
+ double fCropRight,
+ double fCropBottom);
+
+private:
+ // create marker for this kind
+ virtual void CreateB2dIAObject() override;
+};
+
+
+#endif // INCLUDED_SVX_SVDHDL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdhlpln.hxx b/include/svx/svdhlpln.hxx
new file mode 100644
index 000000000..aa850773c
--- /dev/null
+++ b/include/svx/svdhlpln.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDHLPLN_HXX
+#define INCLUDED_SVX_SVDHLPLN_HXX
+
+#include <sal/types.h>
+#include <tools/gen.hxx>
+
+#include <svx/svxdllapi.h>
+
+#include <vector>
+#include <memory>
+
+class OutputDevice;
+enum class PointerStyle;
+
+enum class SdrHelpLineKind { Point, Vertical, Horizontal };
+
+#define SDRHELPLINE_POINT_PIXELSIZE 15 /* actual size = PIXELSIZE*2+1 */
+
+class SdrHelpLine {
+ Point aPos; // X or Y may be unimportant, depending on the value of eKind
+ SdrHelpLineKind eKind;
+
+public:
+ explicit SdrHelpLine(SdrHelpLineKind eNewKind=SdrHelpLineKind::Point): eKind(eNewKind) {}
+ SdrHelpLine(SdrHelpLineKind eNewKind, const Point& rNewPos): aPos(rNewPos), eKind(eNewKind) {}
+ bool operator==(const SdrHelpLine& rCmp) const { return aPos==rCmp.aPos && eKind==rCmp.eKind; }
+ bool operator!=(const SdrHelpLine& rCmp) const { return !operator==(rCmp); }
+
+ void SetKind(SdrHelpLineKind eNewKind) { eKind=eNewKind; }
+ SdrHelpLineKind GetKind() const { return eKind; }
+ void SetPos(const Point& rPnt) { aPos=rPnt; }
+ const Point& GetPos() const { return aPos; }
+
+ PointerStyle GetPointer() const;
+ bool IsHit(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
+ // OutputDevice is required because capture points have a fixed pixel size
+ tools::Rectangle GetBoundRect(const OutputDevice& rOut) const;
+};
+
+#define SDRHELPLINE_NOTFOUND 0xFFFF
+
+class SVXCORE_DLLPUBLIC SdrHelpLineList {
+ std::vector<std::unique_ptr<SdrHelpLine>> aList;
+
+public:
+ SdrHelpLineList() {}
+ SdrHelpLineList(const SdrHelpLineList& rSrcList) { *this=rSrcList; }
+ SdrHelpLineList& operator=(const SdrHelpLineList& rSrcList);
+ bool operator==(const SdrHelpLineList& rCmp) const;
+ bool operator!=(const SdrHelpLineList& rCmp) const { return !operator==(rCmp); }
+ sal_uInt16 GetCount() const { return sal_uInt16(aList.size()); }
+ void Insert(const SdrHelpLine& rHL) { aList.emplace_back(new SdrHelpLine(rHL)); }
+ void Insert(const SdrHelpLine& rHL, sal_uInt16 nPos)
+ {
+ if(nPos==0xFFFF)
+ aList.emplace_back(new SdrHelpLine(rHL));
+ else
+ aList.emplace(aList.begin() + nPos, new SdrHelpLine(rHL));
+ }
+ void Delete(sal_uInt16 nPos)
+ {
+ aList.erase(aList.begin() + nPos);
+ }
+ SdrHelpLine& operator[](sal_uInt16 nPos) { return *aList[nPos]; }
+ const SdrHelpLine& operator[](sal_uInt16 nPos) const { return *aList[nPos]; }
+ sal_uInt16 HitTest(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
+};
+
+
+#endif // INCLUDED_SVX_SVDHLPLN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svditer.hxx b/include/svx/svditer.hxx
new file mode 100644
index 000000000..9b43b5637
--- /dev/null
+++ b/include/svx/svditer.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDITER_HXX
+#define INCLUDED_SVX_SVDITER_HXX
+
+#include <vector>
+
+#include <svx/svxdllapi.h>
+
+class SdrObjList;
+class SdrObject;
+class SdrPage;
+class SdrMarkList;
+
+// SdrObjListIter methods:
+// SdrIterMode::Flat : Flat over the list
+// SdrIterMode::DeepWithGroups : With recursive descent parser, Next() also returns group objects
+// SdrIterMode::DeepNoGroups : With recursive descent parser, Next() returns no group objects
+enum class SdrIterMode { Flat, DeepWithGroups, DeepNoGroups };
+
+class SVXCORE_DLLPUBLIC SdrObjListIter
+{
+ std::vector< const SdrObject* > maObjList;
+ size_t mnIndex;
+ bool mbReverse;
+ bool mbUseZOrder;
+
+ void ImpProcessObjectList(const SdrObjList& rSdrObjList, SdrIterMode eMode);
+ void ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode);
+ void ImpProcessObj(const SdrObject& rSdrObject, SdrIterMode eMode);
+
+public:
+ explicit SdrObjListIter(const SdrObjList* pObjList, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);
+ explicit SdrObjListIter(const SdrObjList* pObjList, bool bUseZOrder, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);
+
+ /* SJ: the following function can now be used with every
+ SdrObject and is no longer limited to group objects */
+ explicit SdrObjListIter(const SdrObject& rSdrObject, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);
+ explicit SdrObjListIter(const SdrPage* pSdrPage, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);
+
+ /** Iterates over a list of marked objects received from the SdrMarkView. TTTT used in sc */
+ explicit SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = SdrIterMode::DeepNoGroups);
+
+ void Reset() { mnIndex = (mbReverse ? maObjList.size() : 0L); }
+ bool IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.size())); }
+ SdrObject* Next()
+ {
+ const size_t idx(mbReverse ? --mnIndex : mnIndex++);
+ return (idx < maObjList.size()) ? const_cast< SdrObject* >(maObjList[idx]) : nullptr;
+ }
+
+ size_t Count() const { return maObjList.size(); }
+};
+
+#endif // INCLUDED_SVX_SVDITER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdlayer.hxx b/include/svx/svdlayer.hxx
new file mode 100644
index 000000000..40cac55d9
--- /dev/null
+++ b/include/svx/svdlayer.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDLAYER_HXX
+#define INCLUDED_SVX_SVDLAYER_HXX
+
+#include <svx/svdsob.hxx>
+#include <svx/svdtypes.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+#include <vector>
+
+/**
+ * Note on the layer mix with symbolic/ID-based interface:
+ * You create a new layer with
+ * pLayerAdmin->NewLayer("A new layer");
+ * This layer is automatically appended to the end of the list.
+ *
+ * The same holds true for layer sets.
+ *
+ * The interface for SdrLayerSet is based on LayerIDs. The app must get
+ * an ID for it at the SdrLayerAdmin, like so:
+ * SdrLayerID nLayerID=pLayerAdmin->GetLayerID("A new layer");
+ *
+ * If the layer cannot be found, SDRLAYER_NOTFOUND is returned.
+ * The methods with the ID interface usually handle that error in a
+ * meaningful way.
+ * If you not only got a name, but even a SdrLayer*, you can get the ID
+ * much faster via the layer directly.
+ *
+ * @param bInherited:
+ * TRUE If the layer/layer set cannot be found, we examine the parent layer admin,
+ * whether there's a corresponding definition
+ * FALSE We only search this layer admin
+ *
+ * Every page's layer admin has a parent layer admin (the model's). The model
+ * itself does not have a parent.
+ */
+
+class SdrModel;
+
+class SVXCORE_DLLPUBLIC SdrLayer
+{
+ friend class SdrLayerAdmin;
+
+ OUString maName;
+ OUString maTitle;
+ OUString maDescription;
+ SdrModel* pModel; // For broadcasting
+ bool mbVisibleODF; // corresponds to ODF draw:display
+ bool mbPrintableODF; // corresponds to ODF draw:display
+ bool mbLockedODF; // corresponds to ODF draw:protected
+ SdrLayerID nID;
+
+ SdrLayer(SdrLayerID nNewID, const OUString& rNewName);
+
+public:
+ bool operator==(const SdrLayer& rCmpLayer) const;
+
+ void SetName(const OUString& rNewName);
+ const OUString& GetName() const { return maName; }
+
+ void SetTitle(const OUString& rTitle) { maTitle = rTitle; }
+ const OUString& GetTitle() const { return maTitle; }
+
+ void SetDescription(const OUString& rDesc) { maDescription = rDesc; }
+ const OUString& GetDescription() const { return maDescription; }
+
+ void SetVisibleODF(bool bVisibleODF) { mbVisibleODF = bVisibleODF; }
+ bool IsVisibleODF() const { return mbVisibleODF; }
+
+ void SetPrintableODF(bool bPrintableODF) { mbPrintableODF = bPrintableODF; }
+ bool IsPrintableODF() const { return mbPrintableODF; }
+
+ void SetLockedODF(bool bLockedODF) { mbLockedODF = bLockedODF; }
+ bool IsLockedODF() const { return mbLockedODF; }
+
+ SdrLayerID GetID() const { return nID; }
+ void SetModel(SdrModel* pNewModel) { pModel=pNewModel; }
+};
+
+#define SDRLAYER_MAXCOUNT 255
+#define SDRLAYERPOS_NOTFOUND 0xffff
+
+// When Changing the layer data you currently have to set the Modify flag manually
+class SVXCORE_DLLPUBLIC SdrLayerAdmin {
+friend class SdrView;
+friend class SdrModel;
+friend class SdrPage;
+
+ std::vector<std::unique_ptr<SdrLayer>> maLayers;
+ SdrLayerAdmin* pParent; // The page's admin knows the doc's admin
+ SdrModel* pModel; // For broadcasting
+ OUString maControlLayerName;
+ // Find a LayerID which is not in use yet. If all have been used up,
+ // we return 0.
+ // If you want to play safe, check GetLayerCount()<SDRLAYER_MAXCOUNT
+ // first, else all are given away already.
+ SdrLayerID GetUniqueLayerID() const;
+ void Broadcast() const;
+public:
+ explicit SdrLayerAdmin(SdrLayerAdmin* pNewParent=nullptr);
+ SdrLayerAdmin(const SdrLayerAdmin& rSrcLayerAdmin);
+ ~SdrLayerAdmin();
+ SdrLayerAdmin& operator=(const SdrLayerAdmin& rSrcLayerAdmin);
+
+ void SetModel(SdrModel* pNewModel);
+
+ void InsertLayer(std::unique_ptr<SdrLayer> pLayer, sal_uInt16 nPos);
+ std::unique_ptr<SdrLayer> RemoveLayer(sal_uInt16 nPos);
+
+ // Delete all layers
+ void ClearLayers();
+
+ // New layer is created and inserted
+ SdrLayer* NewLayer(const OUString& rName, sal_uInt16 nPos=0xFFFF);
+
+ // Iterate over all layers
+ sal_uInt16 GetLayerCount() const { return sal_uInt16(maLayers.size()); }
+
+ SdrLayer* GetLayer(sal_uInt16 i) { return maLayers[i].get(); }
+ const SdrLayer* GetLayer(sal_uInt16 i) const { return maLayers[i].get(); }
+
+ sal_uInt16 GetLayerPos(const SdrLayer* pLayer) const;
+
+ SdrLayer* GetLayer(const OUString& rName);
+ const SdrLayer* GetLayer(const OUString& rName) const;
+ SdrLayerID GetLayerID(const OUString& rName) const;
+ SdrLayer* GetLayerPerID(SdrLayerID nID) { return const_cast<SdrLayer*>(const_cast<const SdrLayerAdmin*>(this)->GetLayerPerID(nID)); }
+ const SdrLayer* GetLayerPerID(SdrLayerID nID) const;
+
+ void SetControlLayerName(const OUString& rNewName);
+ const OUString& GetControlLayerName() const { return maControlLayerName; }
+
+ // Removes all elements in rOutSet and then adds all IDs of layers from member aLayer
+ // that fulfill the criterion visible, printable, or locked respectively.
+ void getVisibleLayersODF( SdrLayerIDSet& rOutSet) const;
+ void getPrintableLayersODF( SdrLayerIDSet& rOutSet) const;
+ void getLockedLayersODF( SdrLayerIDSet& rOutSet) const;
+
+ // Generates a bitfield for settings.xml from the SdrLayerIDSet.
+ // Output is a UNO sequence of BYTE (which is 'short' in API).
+ void QueryValue(const SdrLayerIDSet& rViewLayerSet, css::uno::Any& rAny);
+};
+
+#endif // INCLUDED_SVX_SVDLAYER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdmark.hxx b/include/svx/svdmark.hxx
new file mode 100644
index 000000000..041602600
--- /dev/null
+++ b/include/svx/svdmark.hxx
@@ -0,0 +1,261 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVDMARK_HXX
+#define INCLUDED_SVX_SVDMARK_HXX
+
+#include <config_options.h>
+#include <o3tl/sorted_vector.hxx>
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/sdrobjectuser.hxx>
+
+#include <memory>
+#include <vector>
+
+namespace tools { class Rectangle; }
+class SdrPage;
+class SdrObjList;
+class SdrObject;
+class SdrPageView;
+
+typedef o3tl::sorted_vector<sal_uInt16> SdrUShortCont;
+
+
+/**
+ * Everything a View needs to know about a selected object
+ */
+class SVXCORE_DLLPUBLIC SdrMark final : public sdr::ObjectUser
+{
+ sal_Int64 mnTimeStamp;
+ SdrObject* mpSelectedSdrObject; // the selected object
+ SdrPageView* mpPageView;
+ SdrUShortCont maPoints; // Selected Points
+ SdrUShortCont maGluePoints; // Selected Gluepoints (their Id's)
+ bool mbCon1; // for Connectors
+ bool mbCon2; // for Connectors
+ sal_uInt16 mnUser; // E.g. for CopyObjects, also copy Edges
+
+ void setTime();
+
+public:
+ explicit SdrMark(SdrObject* pNewObj = nullptr, SdrPageView* pNewPageView = nullptr);
+ SdrMark(const SdrMark& rMark);
+ virtual ~SdrMark();
+
+ // Derived from ObjectUser
+ virtual void ObjectInDestruction(const SdrObject& rObject) override;
+
+ SdrMark& operator=(const SdrMark& rMark);
+
+ void SetMarkedSdrObj(SdrObject* pNewObj);
+ SdrObject* GetMarkedSdrObj() const { return mpSelectedSdrObject;}
+
+ SdrPageView* GetPageView() const
+ {
+ return mpPageView;
+ }
+
+ void SetPageView(SdrPageView* pNewPageView)
+ {
+ mpPageView = pNewPageView;
+ }
+
+ void SetCon1(bool bOn)
+ {
+ mbCon1 = bOn;
+ }
+
+ bool IsCon1() const
+ {
+ return mbCon1;
+ }
+
+ void SetCon2(bool bOn)
+ {
+ mbCon2 = bOn;
+ }
+
+ bool IsCon2() const
+ {
+ return mbCon2;
+ }
+
+ void SetUser(sal_uInt16 nVal)
+ {
+ mnUser = nVal;
+ }
+
+ sal_uInt16 GetUser() const
+ {
+ return mnUser;
+ }
+
+ const SdrUShortCont& GetMarkedPoints() const
+ {
+ return maPoints;
+ }
+
+ const SdrUShortCont& GetMarkedGluePoints() const
+ {
+ return maGluePoints;
+ }
+
+ SdrUShortCont& GetMarkedPoints()
+ {
+ return maPoints;
+ }
+
+ SdrUShortCont& GetMarkedGluePoints()
+ {
+ return maGluePoints;
+ }
+
+ sal_Int64 getTimeStamp() const
+ {
+ return mnTimeStamp;
+ }
+};
+
+class SVXCORE_DLLPUBLIC SdrMarkList final
+{
+ std::vector<std::unique_ptr<SdrMark>> maList;
+
+ OUString maMarkName;
+ OUString maPointName;
+ OUString maGluePointName;
+
+ bool mbPointNameOk;
+ bool mbGluePointNameOk;
+ bool mbNameOk;
+ bool mbSorted;
+
+ SVX_DLLPRIVATE void ImpForceSort();
+ SVX_DLLPRIVATE const OUString& GetPointMarkDescription(bool bGlue) const;
+
+public:
+ SdrMarkList()
+ : mbPointNameOk(false),
+ mbGluePointNameOk(false),
+ mbNameOk(false),
+ mbSorted(true)
+ {
+ }
+
+ SdrMarkList(const SdrMarkList& rLst)
+ {
+ *this = rLst;
+ }
+
+ ~SdrMarkList()
+ {
+ Clear();
+ }
+
+ void Clear();
+ void ForceSort() const;
+ void SetUnsorted()
+ {
+ mbSorted = false;
+ }
+
+ size_t GetMarkCount() const
+ {
+ return maList.size();
+ }
+
+ SdrMark* GetMark(size_t nNum) const;
+ // returns SAL_MAX_SIZE if not found
+ size_t FindObject(const SdrObject* pObj) const;
+ void InsertEntry(const SdrMark& rMark, bool bChkSort = true);
+ void DeleteMark(size_t nNum);
+ void ReplaceMark(const SdrMark& rNewMark, size_t nNum);
+ void Merge(const SdrMarkList& rSrcList, bool bReverse = false);
+ bool DeletePageView(const SdrPageView& rPV);
+ bool InsertPageView(const SdrPageView& rPV);
+
+ void SetNameDirty()
+ {
+ mbNameOk = false;
+ mbPointNameOk = false;
+ mbGluePointNameOk = false;
+ }
+
+ // A verbal description of selected objects e.g.:
+ // "27 Lines", "12 Objects", "Polygon" or even "Not an object"
+ const OUString& GetMarkDescription() const;
+ const OUString& GetPointMarkDescription() const
+ {
+ return GetPointMarkDescription(false);
+ }
+
+ const OUString& GetGluePointMarkDescription() const
+ {
+ return GetPointMarkDescription(true);
+ }
+
+ // pPage=0: Selection of everything! Respect Pages
+ bool TakeBoundRect(SdrPageView const * pPageView, tools::Rectangle& rRect) const;
+ bool TakeSnapRect(SdrPageView const * pPageView, tools::Rectangle& rRect) const;
+
+ // All Entries are copied!
+ SdrMarkList& operator=(const SdrMarkList& rLst);
+};
+
+
+// migrate selections
+
+namespace sdr
+{
+ class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) ViewSelection
+ {
+ SdrMarkList maMarkedObjectList;
+ SdrMarkList maEdgesOfMarkedNodes;
+ SdrMarkList maMarkedEdgesOfMarkedNodes;
+ std::vector<SdrObject*> maAllMarkedObjects;
+
+ bool mbEdgesOfMarkedNodesDirty : 1;
+
+ SVX_DLLPRIVATE void ImpForceEdgesOfMarkedNodes();
+ SVX_DLLPRIVATE void ImplCollectCompleteSelection(SdrObject* pObj);
+
+ public:
+ ViewSelection();
+
+ void SetEdgesOfMarkedNodesDirty();
+
+ const SdrMarkList& GetMarkedObjectList() const
+ {
+ return maMarkedObjectList;
+ }
+
+ const SdrMarkList& GetEdgesOfMarkedNodes() const;
+ const SdrMarkList& GetMarkedEdgesOfMarkedNodes() const;
+ const std::vector<SdrObject*>& GetAllMarkedObjects() const;
+
+ SdrMarkList& GetMarkedObjectListWriteAccess()
+ {
+ return maMarkedObjectList;
+ }
+ };
+} // end of namespace sdr
+
+#endif // INCLUDED_SVX_SVDMARK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
new file mode 100644
index 000000000..62c9be034
--- /dev/null
+++ b/include/svx/svdmodel.hxx
@@ -0,0 +1,641 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <functional>
+#include <memory>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <editeng/forbiddencharacterstable.hxx>
+#include <editeng/outliner.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/weakbase.h>
+#include <svl/SfxBroadcaster.hxx>
+#include <tools/degree.hxx>
+#include <tools/fldunit.hxx>
+#include <tools/fract.hxx>
+#include <svl/hint.hxx>
+#include <o3tl/enumarray.hxx>
+
+#include <svl/style.hxx>
+#include <svx/xtable.hxx>
+
+#include <svx/svdtypes.hxx>
+#include <svx/svxdllapi.h>
+
+#include <rtl/ref.hxx>
+#include <deque>
+
+#ifdef DBG_UTIL
+// SdrObjectLifetimeWatchDog
+#include <unordered_set>
+#endif
+
+class OutputDevice;
+class SdrOutliner;
+class SdrLayerAdmin;
+class SdrObjList;
+class SdrObject;
+class SdrPage;
+class SdrPageView;
+class SdrTextObj;
+class SdrUndoAction;
+class SdrUndoGroup;
+class AutoTimer;
+class SfxItemPool;
+class SfxItemSet;
+class SfxRepeatTarget;
+class SfxStyleSheet;
+class SfxUndoAction;
+class SfxUndoManager;
+class XBitmapList;
+class XColorList;
+class XDashList;
+class XGradientList;
+class XHatchList;
+class XLineEndList;
+class SvxForbiddenCharactersTable;
+class SvNumberFormatter;
+class SdrOutlinerCache;
+class SdrUndoFactory;
+class ImageMap;
+class TextChain;
+enum class CharCompressType;
+namespace comphelper
+{
+ class IEmbeddedHelper;
+ class LifecycleProxy;
+}
+namespace sfx2
+{
+ class LinkManager;
+}
+namespace com::sun::star::beans {
+ struct PropertyValue;
+}
+
+namespace svx
+{
+class Theme;
+}
+
+constexpr const sal_Unicode DEGREE_CHAR = u'\x00B0'; /* U+00B0 DEGREE SIGN */
+
+
+enum class SdrHintKind
+{
+ LayerChange, // changed layer definition
+ LayerOrderChange, // order of layer changed (Insert/Remove/ChangePos)
+ PageOrderChange, // order of pages (object pages or master pages) changed (Insert/Remove/ChangePos)
+ ObjectChange, // object changed
+ ObjectInserted, // new object inserted
+ ObjectRemoved, // symbol object removed from list
+ ModelCleared, // deleted the whole model (no pages exist anymore). not impl.
+ RefDeviceChange, // RefDevice changed
+ DefaultTabChange, // Default tabulator width changed
+ SwitchToPage, // #94278# UNDO/REDO at an object evtl. on another page
+ BeginEdit, // Is called after the object has entered text edit mode
+ EndEdit // Is called after the object has left text edit mode
+};
+
+class SVXCORE_DLLPUBLIC SdrHint final : public SfxHint
+{
+private:
+ SdrHintKind meHint;
+ const SdrObject* mpObj;
+ const SdrPage* mpPage;
+
+public:
+ explicit SdrHint(SdrHintKind eNewHint);
+ explicit SdrHint(SdrHintKind eNewHint, const SdrObject& rNewObj);
+ explicit SdrHint(SdrHintKind eNewHint, const SdrPage* pPage);
+ explicit SdrHint(SdrHintKind eNewHint, const SdrObject& rNewObj, const SdrPage* pPage);
+
+ const SdrPage* GetPage() const { return mpPage;}
+ const SdrObject* GetObject() const { return mpObj;}
+ SdrHintKind GetKind() const { return meHint;}
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// SdrModel
+// DlgEdModel
+// FmFormModel
+// ScDrawLayer
+// SdDrawDocument
+// SwDrawModel
+// OReportModel
+
+struct SdrModelImpl;
+
+class SVXCORE_DLLPUBLIC SdrModel : public SfxBroadcaster, public tools::WeakBase
+{
+private:
+#ifdef DBG_UTIL
+ // SdrObjectLifetimeWatchDog:
+ // Use maAllIncarnatedObjects to keep track of all SdrObjects incarnated using this SdrModel
+ // (what is now possible after the paradigm change that a SdrObject stays at a single SdrModel
+ // for it's whole lifetime).
+ // The two methods are exclusive, debug-only, only-accessible-by SdrObject accesses to else
+ // hidden/non-existing maAllIncarnatedObjects.
+ // SdrObject::SdrObject uses impAddIncarnatedSdrObjectToSdrModel, while SdrObject::~SdrObject
+ // uses impRemoveIncarnatedSdrObjectToSdrModel.
+ // There are two places which may trigger SAL_WARN warnings:
+ // - impRemoveIncarnatedSdrObjectToSdrModel when the to-be-removed SdrObject is not member of SdrModel
+ // - SdrModel::~SdrModel after all SdrObjects *should* be cleaned-up.
+ // SdrModel::~SdrModel will also - for convenience - Free the non-deleted SdrObjects if there
+ // are any.
+ // Using std::unordered_set will use quasi constant access times, so this watchdog will not
+ // be expensive. Nonetheless, only use with debug code. It may be seductive to use this in
+ // product code, too, especially if it will indeed trigger - but its intention is clearly
+ // to find/identify MemoryLeaks caused by SdrObjects
+ friend void impAddIncarnatedSdrObjectToSdrModel(const SdrObject& rSdrObject, SdrModel& rSdrModel);
+ friend void impRemoveIncarnatedSdrObjectToSdrModel(const SdrObject& rSdrObject, SdrModel& rSdrModel);
+ std::unordered_set< const SdrObject* > maAllIncarnatedObjects;
+#endif
+protected:
+ std::vector<rtl::Reference<SdrPage>> maMasterPages;
+ std::vector<rtl::Reference<SdrPage>> maPages;
+ std::function<void(std::unique_ptr<SdrUndoAction>)> m_aUndoLink; // link to a NotifyUndo-Handler
+ Size m_aMaxObjSize; // e.g. for auto-growing text
+ Fraction m_aObjUnit; // description of the coordinate units for ClipBoard, Drag&Drop, ...
+ MapUnit m_eObjUnit; // see above
+ FieldUnit m_eUIUnit; // unit, scale (e.g. 1/1000) for the UI (status bar) is set by ImpSetUIUnit()
+ Fraction m_aUIScale; // see above
+ OUString m_aUIUnitStr; // see above
+ Fraction m_aUIUnitFact; // see above
+ int m_nUIUnitDecimalMark; // see above
+
+ std::unique_ptr<SdrLayerAdmin> m_pLayerAdmin;
+ rtl::Reference<SfxItemPool> m_pItemPool;
+ comphelper::IEmbeddedHelper* m_pEmbeddedHelper; // helper for embedded objects to get rid of the SfxObjectShell
+ std::unique_ptr<SdrOutliner> m_pDrawOutliner; // an Outliner for outputting text
+ std::unique_ptr<SdrOutliner> m_pHitTestOutliner;// an Outliner for the HitTest
+ std::unique_ptr<SdrOutliner> m_pChainingOutliner; // an Outliner for chaining overflowing text
+ sal_Int32 mnDefTextHgt; // Default text height in logical units
+ VclPtr<OutputDevice> m_pRefOutDev; // ReferenceDevice for the EditEngine
+ rtl::Reference< SfxStyleSheetBasePool > mxStyleSheetPool;
+ SfxStyleSheet* m_pDefaultStyleSheet;
+ SfxStyleSheet* mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj; // #i119287#
+ sfx2::LinkManager* m_pLinkManager; // LinkManager
+ std::deque<std::unique_ptr<SfxUndoAction>> m_aUndoStack;
+ std::deque<std::unique_ptr<SfxUndoAction>> m_aRedoStack;
+ std::unique_ptr<SdrUndoGroup> m_pCurrentUndoGroup; // For multi-level
+ sal_uInt16 m_nUndoLevel; // undo nesting
+ bool m_bIsWriter:1; // to clean up pMyPool from 303a
+ bool mbUndoEnabled:1; // If false no undo is recorded or we are during the execution of an undo action
+ bool mbChanged:1;
+ bool m_bPagNumsDirty:1;
+ bool m_bMPgNumsDirty:1;
+ bool m_bTransportContainer:1; // doc is temporary object container, no display (e.g. clipboard)
+ bool m_bReadOnly:1;
+ bool m_bTransparentTextFrames:1;
+ bool m_bSwapGraphics:1;
+ bool m_bPasteResize:1; // Objects are being resized due to Paste with different MapMode
+ bool m_bStarDrawPreviewMode:1;
+ bool mbDisableTextEditUsesCommonUndoManager:1;
+ bool mbVOCInvalidationIsReliable:1; // does the app reliably invalidate the VOC, or do we need to rebuild the primitives on every render?
+ sal_uInt16 m_nDefaultTabulator;
+ sal_uInt32 m_nMaxUndoCount;
+
+ std::unique_ptr<TextChain> m_pTextChain;
+
+
+public:
+ std::shared_ptr<SvxForbiddenCharactersTable> mpForbiddenCharactersTable;
+
+ std::unique_ptr<SdrOutlinerCache> mpOutlinerCache;
+ //get a vector of all the SdrOutliner belonging to the model
+ std::vector<SdrOutliner*> GetActiveOutliners() const;
+ std::unique_ptr<SdrModelImpl> mpImpl;
+ CharCompressType mnCharCompressType;
+ sal_uInt16 mnHandoutPageCount;
+ bool mbModelLocked;
+ bool mbKernAsianPunctuation;
+ bool mbAddExtLeading;
+ bool mbInDestruction;
+
+ // Color, Dash, Line-End, Hatch, Gradient, Bitmap property lists ...
+ o3tl::enumarray<XPropertyListType, XPropertyListRef> maProperties;
+
+ sal_uInt16 getHandoutPageCount() const { return mnHandoutPageCount; }
+ void setHandoutPageCount( sal_uInt16 nHandoutPageCount ) { mnHandoutPageCount = nHandoutPageCount; }
+
+ // Adapt to given Size and Borders scaling all contained data, maybe
+ // including PresObj's in higher derivations
+ virtual void adaptSizeAndBorderForAllPages(
+ const Size& rNewSize,
+ tools::Long nLeft = 0,
+ tools::Long nRight = 0,
+ tools::Long nUpper = 0,
+ tools::Long nLower = 0);
+
+protected:
+ virtual css::uno::Reference< css::uno::XInterface > createUnoModel();
+
+private:
+ SdrModel(const SdrModel& rSrcModel) = delete;
+ void operator=(const SdrModel& rSrcModel) = delete;
+ bool operator==(const SdrModel& rCmpModel) const = delete;
+ SVX_DLLPRIVATE void ImpPostUndoAction(std::unique_ptr<SdrUndoAction> pUndo);
+ SVX_DLLPRIVATE void ImpSetUIUnit();
+ SVX_DLLPRIVATE void ImpSetOutlinerDefaults( SdrOutliner* pOutliner, bool bInit = false );
+ SVX_DLLPRIVATE void ImpReformatAllTextObjects();
+ SVX_DLLPRIVATE void ImpReformatAllEdgeObjects();
+ SVX_DLLPRIVATE void ImpCreateTables(bool bDisablePropertyFiles);
+
+ // this is a weak reference to a possible living api wrapper for this model
+ css::uno::Reference< css::uno::XInterface > mxUnoModel;
+
+ // used to disable unique name checking during page move
+ bool mbMakePageObjectsNamesUnique = true;
+
+public:
+ SVX_DLLPRIVATE virtual bool IsCreatingDataObj() const { return false; }
+ bool IsTransportContainer() const { return m_bTransportContainer; }
+ bool IsPasteResize() const { return m_bPasteResize; }
+ void SetPasteResize(bool bOn) { m_bPasteResize=bOn; }
+ // If a custom Pool is put here, the class will call methods
+ // on it (Put(), Remove()). On disposal of SdrModel the pool
+ // will be deleted with delete.
+ // If you give NULL instead, it will create an own pool (SdrItemPool)
+ // which will also be disposed in the destructor.
+ // If you do use a custom Pool, make sure you inherit from SdrItemPool,
+ // if you want to use symbol objects inherited from SdrAttrObj.
+ // If, however, you use objects inheriting from SdrObject you are free
+ // to choose a pool of your liking.
+ //
+ // tdf#118731 a bDisablePropertyFiles of true will disable ability to load
+ // XPropertyFiles describing defaults. Useful for UI preview widgets
+ explicit SdrModel(
+ SfxItemPool* pPool = nullptr,
+ ::comphelper::IEmbeddedHelper* pPers = nullptr,
+ bool bDisablePropertyFiles = false);
+ virtual ~SdrModel() override;
+ void ClearModel(bool bCalledFromDestructor);
+
+ // Override this to enable the Swap/LoadOnDemand of graphics.
+ // If rbDeleteAfterUse is set to sal_True the SvStream instance from
+ // the caller will be disposed after use.
+ // If this method returns NULL, a temporary file will be allocated for
+ // swapping.
+ // The stream from which the model was loaded or in which is was saved last
+ // needs to be delivered
+ virtual css::uno::Reference<
+ css::embed::XStorage> GetDocumentStorage() const;
+ css::uno::Reference<
+ css::io::XInputStream >
+ GetDocumentStream(OUString const& rURL,
+ ::comphelper::LifecycleProxy const & rProxy) const;
+ // Change the template attributes of the symbol objects to hard attributes
+ void BurnInStyleSheetAttributes();
+ // If you inherit from SdrPage you also need to inherit from SdrModel
+ // and implement both VM AllocPage() and AllocModel()...
+ virtual rtl::Reference<SdrPage> AllocPage(bool bMasterPage);
+ virtual SdrModel* AllocModel() const;
+
+ // Changes on the layers set the modified flag and broadcast on the model!
+ const SdrLayerAdmin& GetLayerAdmin() const { return *m_pLayerAdmin; }
+ SdrLayerAdmin& GetLayerAdmin() { return *m_pLayerAdmin; }
+
+ const SfxItemPool& GetItemPool() const { return *m_pItemPool; }
+ SfxItemPool& GetItemPool() { return *m_pItemPool; }
+
+ SdrOutliner& GetDrawOutliner(const SdrTextObj* pObj=nullptr) const;
+
+ SdrOutliner& GetHitTestOutliner() const { return *m_pHitTestOutliner; }
+ const SdrTextObj* GetFormattingTextObj() const;
+ // put the TextDefaults (Font,Height,Color) in a Set
+ void SetTextDefaults() const;
+ static void SetTextDefaults( SfxItemPool* pItemPool, sal_Int32 nDefTextHgt );
+
+ SdrOutliner& GetChainingOutliner(const SdrTextObj* pObj) const;
+ TextChain * GetTextChain() const;
+
+ // ReferenceDevice for the EditEngine
+ void SetRefDevice(OutputDevice* pDev);
+ OutputDevice* GetRefDevice() const { return m_pRefOutDev.get(); }
+ // If a new MapMode is set on the RefDevice (or similar)
+ void RefDeviceChanged(); // not yet implemented
+ // default font height in logical units
+ void SetDefaultFontHeight(sal_Int32 nVal);
+ // default tabulator width for the EditEngine
+ void SetDefaultTabulator(sal_uInt16 nVal);
+ sal_uInt16 GetDefaultTabulator() const { return m_nDefaultTabulator; }
+
+ // The DefaultStyleSheet will be used in every symbol object which is inserted
+ // in this model and does not have a StyleSheet set.
+ SfxStyleSheet* GetDefaultStyleSheet() const { return m_pDefaultStyleSheet; }
+ void SetDefaultStyleSheet(SfxStyleSheet* pDefSS) { m_pDefaultStyleSheet = pDefSS; }
+
+ // #i119287# default StyleSheet for SdrGrafObj and SdrOle2Obj
+ SfxStyleSheet* GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj() const { return mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj; }
+ void SetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(SfxStyleSheet* pDefSS) { mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj = pDefSS; }
+
+ sfx2::LinkManager* GetLinkManager() { return m_pLinkManager; }
+ void SetLinkManager( sfx2::LinkManager* pLinkMgr ) { m_pLinkManager = pLinkMgr; }
+
+ ::comphelper::IEmbeddedHelper* GetPersist() const { return m_pEmbeddedHelper; }
+ void SetPersist( ::comphelper::IEmbeddedHelper *p ) { m_pEmbeddedHelper = p; }
+
+ // Unit for the symbol coordination
+ // Default is 1 logical unit = 1/100mm (Unit=MapUnit::Map100thMM, Fract=(1,1)).
+ // Examples:
+ // MapUnit::MapPoint, Fraction(72,1) : 1 log Einh = 72 Point = 1 Inch
+ // MapUnit::MapPoint, Fraction(1,20) : 1 log Einh = 1/20 Point = 1 Twip
+ // MapUnit::MapTwip, Fraction(1,1) : 1 log Einh = 1 Twip
+ // MapUnit::Map100thMM, Fraction(1,10) : 1 log Einh = 1/1000mm
+ // MapUnit::MapMM, Fraction(1000,1) : 1 log Einh = 1000mm = 1m
+ // MapUnit::MapCM, Fraction(100,1) : 1 log Einh = 100cm = 1m
+ // MapUnit::MapCM, Fraction(100000,1): 1 log Einh = 100000cm = 1km
+ // (FWIW: you cannot represent light years).
+ // The scaling unit is needed for the Engine to serve the Clipboard
+ // with the correct sizes.
+ MapUnit GetScaleUnit() const { return m_eObjUnit; }
+ void SetScaleUnit(MapUnit eMap);
+ const Fraction& GetScaleFraction() const { return m_aObjUnit; }
+ void SetScaleFraction(const Fraction& rFrac);
+ // Setting both simultaneously performs a little better
+ void SetScaleUnit(MapUnit eMap, const Fraction& rFrac);
+
+ // maximal size e.g. for auto growing texts
+ const Size& GetMaxObjSize() const { return m_aMaxObjSize; }
+ void SetMaxObjSize(const Size& rSiz) { m_aMaxObjSize=rSiz; }
+
+ // For the View! to display sane numbers in the status bar: Default is mm.
+ void SetUIUnit(FieldUnit eUnit);
+ FieldUnit GetUIUnit() const { return m_eUIUnit; }
+ // The scale of the drawing. Default 1/1.
+ void SetUIScale(const Fraction& rScale);
+ const Fraction& GetUIScale() const { return m_aUIScale; }
+ // Setting both simultaneously performs a little better
+ void SetUIUnit(FieldUnit eUnit, const Fraction& rScale);
+
+ static OUString GetUnitString(FieldUnit eUnit);
+ OUString GetMetricString(tools::Long nVal, bool bNoUnitChars = false, sal_Int32 nNumDigits = -1) const;
+ static OUString GetAngleString(Degree100 nAngle);
+ static OUString GetPercentString(const Fraction& rVal);
+
+ // RecalcPageNums is ordinarily only called by the Page.
+ bool IsPagNumsDirty() const { return m_bPagNumsDirty; };
+ bool IsMPgNumsDirty() const { return m_bMPgNumsDirty; };
+ void RecalcPageNums(bool bMaster);
+ // After the Insert the Page belongs to the SdrModel.
+ virtual void InsertPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
+ virtual void DeletePage(sal_uInt16 nPgNum);
+ // Remove means transferring ownership to the caller (opposite of Insert)
+ virtual rtl::Reference<SdrPage> RemovePage(sal_uInt16 nPgNum);
+ virtual void MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos);
+ const SdrPage* GetPage(sal_uInt16 nPgNum) const;
+ SdrPage* GetPage(sal_uInt16 nPgNum);
+ sal_uInt16 GetPageCount() const;
+ virtual void PageListChanged();
+
+ // Masterpages
+ virtual void InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
+ void DeleteMasterPage(sal_uInt16 nPgNum);
+ // Remove means transferring ownership to the caller (opposite of Insert)
+ virtual rtl::Reference<SdrPage> RemoveMasterPage(sal_uInt16 nPgNum);
+ void MoveMasterPage(sal_uInt16 nPgNum, sal_uInt16 nNewPos);
+ const SdrPage* GetMasterPage(sal_uInt16 nPgNum) const;
+ SdrPage* GetMasterPage(sal_uInt16 nPgNum);
+ sal_uInt16 GetMasterPageCount() const;
+ virtual void MasterPageListChanged();
+
+ // modified flag. Is set automatically when something changes on the Pages
+ // symbol objects. You need to reset it yourself, however, e.g. on Save().
+ bool IsChanged() const { return mbChanged; }
+ virtual void SetChanged(bool bFlg = true);
+
+ // If set to sal_True, graphics from graphics objects will:
+ // - not be loaded immediately when loading a document,
+ // but only once they are needed (e.g. displayed).
+ // - be pruned from memory if they are not needed.
+ // For that to work, override the virtual method GetDocumentStream().
+ // Default=FALSE. Flag is not persistent.
+ bool IsSwapGraphics() const { return m_bSwapGraphics; }
+ void SetSwapGraphics();
+
+ // Text frames without filling can be select with a mouse click by default (sal_False).
+ // With this flag set to true you can hit them only in the area in which text is to be
+ // found.
+ bool IsPickThroughTransparentTextFrames() const { return m_bTransparentTextFrames; }
+ void SetPickThroughTransparentTextFrames(bool bOn) { m_bTransparentTextFrames=bOn; }
+
+ // Can the model be changed at all?
+ // Is only evaluated by the possibility methods of the View.
+ // Direct manipulations on the model, ... do not respect this flag.
+ // Override this and return the appropriate ReadOnly status
+ // of the files, i.e. true or false. (Method is called multiple
+ // times, so use one flag only!)
+ virtual bool IsReadOnly() const;
+ void SetReadOnly(bool bYes);
+
+ // Mixing two SdrModels. Mind that rSourceModel is not const.
+ // The pages will not be copied but moved, when inserted.
+ // rSourceModel may very well be empty afterwards.
+ // nFirstPageNum,nLastPageNum: The pages to take from rSourceModel
+ // nDestPos..................: position to insert
+ // bMergeMasterPages.........: sal_True = needed MasterPages will be taken
+ // from rSourceModel
+ // sal_False= the MasterPageDescriptors of
+ // the pages of the rSourceModel will be
+ // mapped on the existing MasterPages.
+ // bUndo.....................: An undo action is generated for the merging.
+ // Undo is only for the target model, not for the
+ // rSourceModel.
+ // bTreadSourceAsConst.......: sal_True=the SourceModel will not be changed,
+ // so pages will be copied.
+ virtual void Merge(SdrModel& rSourceModel,
+ sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
+ sal_uInt16 nDestPos,
+ bool bMergeMasterPages, bool bAllMasterPages,
+ bool bUndo = true, bool bTreadSourceAsConst = false);
+
+ // Behaves like Merge(SourceModel=DestModel,nFirst,nLast,nDest,sal_False,sal_False,bUndo,!bMoveNoCopy);
+ void CopyPages(sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
+ sal_uInt16 nDestPos,
+ bool bUndo, bool bMoveNoCopy);
+
+ // BegUndo() / EndUndo() enables you to group arbitrarily many UndoActions
+ // arbitrarily deeply. As comment for the UndoAction the first BegUndo(String) of all
+ // nestings will be used.
+ // In that case the NotifyUndoActionHdl will be called on the last EndUndo().
+ // No UndoAction will be generated for an empty group.
+ // All direct modifications on the SdrModel do not create an UndoActions.
+ // Actions on the SdrView however do generate those.
+ void BegUndo(); // open Undo group
+ void BegUndo(const OUString& rComment); // open Undo group
+ void BegUndo(const OUString& rComment, const OUString& rObjDescr, SdrRepeatFunc eFunc); // open Undo group
+ void EndUndo(); // close Undo group
+ void AddUndo(std::unique_ptr<SdrUndoAction> pUndo);
+ sal_uInt16 GetUndoBracketLevel() const { return m_nUndoLevel; }
+ // only after the first BegUndo or before the last EndUndo:
+ void SetUndoComment(const OUString& rComment);
+ void SetUndoComment(const OUString& rComment, const OUString& rObjDescr);
+
+ // The Undo management is only done if NotifyUndoAction-Handler is not set.
+ // Default is 16. Minimal MaxUndoActionCount is 1.
+ void SetMaxUndoActionCount(sal_uInt32 nCount);
+ void ClearUndoBuffer();
+
+ bool HasUndoActions() const;
+ bool HasRedoActions() const;
+ void Undo();
+ void Redo();
+ void Repeat(SfxRepeatTarget&);
+
+ // The application can set a handler here which collects the UndoActions einsammelt.
+ // The handler has the following signature:
+ // void NotifyUndoActionHdl(SfxUndoAction* pUndoAction);
+ // When calling the handler ownership is transferred;
+ // The UndoAction belongs to the Handler, not the SdrModel.
+ void SetNotifyUndoActionHdl(const std::function<void(std::unique_ptr<SdrUndoAction>)>& rLink) { m_aUndoLink=rLink; }
+
+ /** application can set its own undo manager, BegUndo, EndUndo and AddUndoAction
+ calls are routed to this interface if given */
+ void SetSdrUndoManager( SfxUndoManager* pUndoManager );
+ SfxUndoManager* GetSdrUndoManager() const;
+
+ /** applications can set their own undo factory to override creation of
+ undo actions. The SdrModel will become owner of the given SdrUndoFactory
+ and delete it upon its destruction. */
+ void SetSdrUndoFactory( SdrUndoFactory* pUndoFactory );
+
+ /** returns the models undo factory. This must be used to create
+ undo actions for this model. */
+ SdrUndoFactory& GetSdrUndoFactory() const;
+
+ // Accessor methods for Palettes, Lists and Tables
+ // FIXME: this badly needs re-factoring...
+ const XPropertyListRef& GetPropertyList( XPropertyListType t ) const { return maProperties[ t ]; }
+ void SetPropertyList( XPropertyListRef const & p ) { maProperties[ p->Type() ] = p; }
+
+ // friendlier helpers
+ XDashListRef GetDashList() const { return XPropertyList::AsDashList(GetPropertyList( XPropertyListType::Dash )); }
+ XHatchListRef GetHatchList() const { return XPropertyList::AsHatchList(GetPropertyList( XPropertyListType::Hatch )); }
+ XColorListRef GetColorList() const { return XPropertyList::AsColorList(GetPropertyList( XPropertyListType::Color )); }
+ XBitmapListRef GetBitmapList() const { return XPropertyList::AsBitmapList(GetPropertyList( XPropertyListType::Bitmap )); }
+ XPatternListRef GetPatternList() const { return XPropertyList::AsPatternList(GetPropertyList( XPropertyListType::Pattern )); }
+ XLineEndListRef GetLineEndList() const { return XPropertyList::AsLineEndList(GetPropertyList( XPropertyListType::LineEnd )); }
+ XGradientListRef GetGradientList() const { return XPropertyList::AsGradientList(GetPropertyList( XPropertyListType::Gradient )); }
+
+ // The DrawingEngine only references the StyleSheetPool, whoever
+ // made it needs to delete it.
+ SfxStyleSheetBasePool* GetStyleSheetPool() const { return mxStyleSheetPool.get(); }
+ void SetStyleSheetPool(SfxStyleSheetBasePool* pPool) { mxStyleSheetPool=pPool; }
+
+ void SetTheme(std::unique_ptr<svx::Theme> pTheme);
+ svx::Theme* GetTheme();
+
+ void SetStarDrawPreviewMode(bool bPreview);
+ bool IsStarDrawPreviewMode() const { return m_bStarDrawPreviewMode; }
+
+ bool GetDisableTextEditUsesCommonUndoManager() const { return mbDisableTextEditUsesCommonUndoManager; }
+ void SetDisableTextEditUsesCommonUndoManager(bool bNew) { mbDisableTextEditUsesCommonUndoManager = bNew; }
+
+ css::uno::Reference< css::uno::XInterface > const & getUnoModel();
+ void setUnoModel( const css::uno::Reference< css::uno::XInterface >& xModel );
+
+ // these functions are used by the api to disable repaints during a
+ // set of api calls.
+ bool isLocked() const { return mbModelLocked; }
+ void setLock( bool bLock );
+
+ void SetForbiddenCharsTable( const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars );
+ const std::shared_ptr<SvxForbiddenCharactersTable>& GetForbiddenCharsTable() const { return mpForbiddenCharactersTable;}
+
+ void SetCharCompressType( CharCompressType nType );
+ CharCompressType GetCharCompressType() const { return mnCharCompressType; }
+
+ void SetKernAsianPunctuation( bool bEnabled );
+ bool IsKernAsianPunctuation() const { return mbKernAsianPunctuation; }
+
+ void SetAddExtLeading( bool bEnabled );
+ bool IsAddExtLeading() const { return mbAddExtLeading; }
+
+ // tdf#99729 compatibility flag
+ void SetAnchoredTextOverflowLegacy(bool bEnabled);
+ bool IsAnchoredTextOverflowLegacy() const;
+
+ void ReformatAllTextObjects();
+
+ std::unique_ptr<SdrOutliner> createOutliner( OutlinerMode nOutlinerMode );
+ void disposeOutliner( std::unique_ptr<SdrOutliner> pOutliner );
+
+ bool IsWriter() const { return m_bIsWriter; }
+
+ // Used as a fallback in *::ReadUserDataSequence() to process common properties
+ void ReadUserDataSequenceValue(const css::beans::PropertyValue *pValue);
+ void WriteUserDataSequence(css::uno::Sequence < css::beans::PropertyValue >& rValues);
+
+ /** returns the numbering type that is used to format page fields in drawing shapes */
+ virtual SvxNumType GetPageNumType() const;
+
+ /** copies the items from the source set to the destination set. Both sets must have
+ same ranges but can have different pools. */
+ static void MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSet, SdrModel* pNewModel );
+
+ bool IsInDestruction() const { return mbInDestruction;}
+
+ static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ /** enables (true) or disables (false) recording of undo actions
+ If undo actions are added while undo is disabled, they are deleted.
+ Disabling undo does not clear the current undo buffer! */
+ void EnableUndo( bool bEnable );
+
+ /** returns true if undo is currently enabled
+ This returns false if undo was disabled using EnableUndo( false ) and
+ also during the runtime of the Undo() and Redo() methods. */
+ bool IsUndoEnabled() const;
+
+ // used to prevent object name change during page move
+ bool DoesMakePageObjectsNamesUnique() const { return mbMakePageObjectsNamesUnique; }
+ void DoMakePageObjectsNamesUnique(bool bDo) { mbMakePageObjectsNamesUnique = bDo; }
+
+ virtual sal_Int32 getImagePreferredDPI() const { return 0; }
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+ bool IsVOCInvalidationIsReliable() const { return mbVOCInvalidationIsReliable; }
+ void SetVOCInvalidationIsReliable(bool b) { mbVOCInvalidationIsReliable = b; }
+};
+
+/*
+ +-----------+
+ | SdrModel |
+ +--+------+-+
+ | +-----------+
+ +----+-----+ |
+ | ... | |
+ +----+---+ +----+---+ +-----+--------+
+ |SdrPage | |SdrPage | |SdrLayerAdmin |
+ +---+----+ +-+--+--++ +---+-------+--+
+ | | | | | +-------------------+
+ +----+----+ +-----+-----+ +-------+-------+
+ | ... | | ... | | ... |
++---+---+ +---+---+ +----+----+ +----+----+ +-----+------+ +------+-----+
+|SdrObj | |SdrObj | |SdrLayer | |SdrLayer | |SdrLayerSet | |SdrLayerSet |
++-------+ +-------+ +---------+ +---------+ +------------+ +------------+
+This class: SdrModel is the head of the data models for the StarView Drawing Engine.
+
+///////////////////////////////////////////////////////////////////////////////////////////////// */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx
new file mode 100644
index 000000000..ec9055711
--- /dev/null
+++ b/include/svx/svdmrkv.hxx
@@ -0,0 +1,469 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdmark.hxx>
+#include <svx/svdhdl.hxx>
+#include <svx/svdsnpv.hxx>
+#include <svx/svdtypes.hxx>
+#include <svx/svxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <unotools/resmgr.hxx>
+
+class SfxViewShell;
+
+// The following is not yet implemented, or just partially:
+enum class SdrSearchOptions
+{
+ NONE = 0x0000,
+ DEEP = 0x0001, /* recursive into group objects */
+ ALSOONMASTER = 0x0002, /* MasterPages are also scanned */
+ WHOLEPAGE = 0x0004, /* Not just the ObjList of PageView */
+ TESTMARKABLE = 0x0008, /* just markable objects/points/handles/... */
+ TESTMACRO = 0x0010, /* Just objects with macro */
+ TESTTEXTEDIT = 0x0020, /* Just TextEdit-enabled objects */
+ MARKED = 0x0040, /* Just marked objects/points/... */
+ PASS2BOUND = 0x0080, /* In case of empty search results, then 2nd. try with BoundRectHit */
+ BEFOREMARK = 0x0100, /* if one marked one found, ignore all behind that */
+
+ IMPISMASTER = 0x0200, /* MasterPage is being searched right now */
+ PICKMARKABLE = TESTMARKABLE,
+ PICKTEXTEDIT = DEEP | TESTMARKABLE | TESTTEXTEDIT,
+ PICKMACRO = DEEP | ALSOONMASTER | WHOLEPAGE | TESTMACRO,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SdrSearchOptions> : is_typed_flags<SdrSearchOptions, 0x03ff> {};
+}
+
+enum class SdrHitKind
+{
+ NONE, // No hit
+ Object, // Hit
+ Handle, // Marking handle
+ HelpLine, // Reference line
+ Gluepoint, // Gluepoint
+ TextEdit, // Open OutlinerView was hit
+ TextEditObj, // Object for SdrBeginTextEdit (Textbereich)
+ UrlField, // Field in TextObj was hit (while it is currently not edited)
+ Macro, // Object for BegMacroObj
+ MarkedObject, // Marked object (e.g. for dragging)
+ UnmarkedObject, // non-marked Object (e.g. for marking)
+ Cell // hit on a cell inside a table shape (outside of the cells text area)
+};
+
+enum class SdrViewEditMode {
+ Edit, // Also known as arrow or pointer mode
+ Create, // Tool for object creation
+ GluePointEdit // Gluepoint editing mode
+};
+
+/** options for ImpGetDescriptionString() */
+enum class ImpGetDescriptionOptions
+{
+ NONE = 0,
+ POINTS = 1,
+ GLUEPOINTS = 2,
+};
+
+class ImplMarkingOverlay;
+class MarkingSubSelectionOverlay;
+
+class SVXCORE_DLLPUBLIC SdrMarkView : public SdrSnapView
+{
+ friend class SdrPageView;
+
+ // #114409#-3 Migrate selections
+ std::unique_ptr<ImplMarkingOverlay> mpMarkObjOverlay;
+ std::unique_ptr<ImplMarkingOverlay> mpMarkPointsOverlay;
+ std::unique_ptr<ImplMarkingOverlay> mpMarkGluePointsOverlay;
+
+ std::unique_ptr<MarkingSubSelectionOverlay> mpMarkingSubSelectionOverlay;
+
+protected:
+ SdrObject* mpMarkedObj; // If not just one object ( i.e. More than one object ) is marked.
+ SdrPageView* mpMarkedPV; // If all marked objects are situated on the same PageView.
+
+ Point maRef1; // Persistent - Rotation center / axis of reflection
+ Point maRef2; // Persistent
+ SdrHdlList maHdlList;
+
+ sdr::ViewSelection maSdrViewSelection;
+
+ std::vector<basegfx::B2DRectangle> maSubSelectionList;
+ tools::Rectangle maMarkedObjRect;
+ tools::Rectangle maMarkedPointsRect;
+ tools::Rectangle maMarkedGluePointsRect;
+
+ static constexpr sal_uInt16 mnFrameHandlesLimit = 50;
+
+ SdrDragMode meDragMode; // Persistent
+ SdrViewEditMode meEditMode; // Persistent
+ SdrViewEditMode meEditMode0; // Persistent
+
+ bool mbDesignMode : 1; // DesignMode for SdrUnoObj
+ bool mbForceFrameHandles : 1; // Persistent - FrameDrag also for single objects
+ bool mbPlusHdlAlways : 1; // Persistent
+ bool mbInsPolyPoint : 1; // at this time InsPolyPointDragging
+ bool mbMarkedObjRectDirty : 1;
+ bool mbMrkPntDirty : 1;
+ bool mbMarkedPointsRectsDirty : 1;
+
+ // flag to completely disable handles at the view
+ bool mbMarkHandlesHidden : 1;
+
+ // flag indicating whether all x coordinates are negated or not
+ bool mbNegativeX : 1;
+
+ // Helper to get a possible GridOffset from SdrObject
+ bool getPossibleGridOffsetForSdrObject(
+ basegfx::B2DVector& rOffset,
+ const SdrObject* pObj,
+ const SdrPageView* pPV) const;
+
+ // Helper to get a possible GridOffset from Position
+ bool getPossibleGridOffsetForPosition(
+ basegfx::B2DVector& rOffset,
+ const basegfx::B2DPoint& rPoint,
+ const SdrPageView* pPV) const;
+
+private:
+ SVX_DLLPRIVATE void ImpSetPointsRects() const;
+ void UndirtyMrkPnt() const;
+
+ void SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const SfxViewShell* pOtherShell);
+ bool dumpGluePointsToJSON(boost::property_tree::ptree& rTree);
+
+protected:
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+ virtual void ModelHasChanged() override; // Is called by the PaintView
+ virtual void SetMarkHandles(SfxViewShell* pOtherShell); // maHdlList - fill (List of handles)
+ void modelHasChangedLOKit();
+ void SetMarkRects(); // Rects at the PageViews
+ void CheckMarked(); // Scan MarkList after Del and Lock Layer ...
+ void AddDragModeHdl(SdrDragMode eMode);
+ virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override;
+ virtual bool RequestHelp(const HelpEvent& rHEvt) override;
+
+ // add custom handles (used by other apps, e.g. AnchorPos)
+ virtual void AddCustomHdl();
+
+ void ForceRefToMarked();
+ void ForceUndirtyMrkPnt() const { if (mbMrkPntDirty) UndirtyMrkPnt(); }
+
+ virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay) const;
+ SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList const * pOL, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay, SdrObject*& rpRootObj) const;
+ SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList const * pOL, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay, SdrObject*& rpRootObj,const SdrMarkList * pMarkList) const;
+ bool ImpIsFrameHandles() const;
+ OUString ImpGetDescriptionString(TranslateId pStrCacheID, ImpGetDescriptionOptions nOpt=ImpGetDescriptionOptions::NONE) const;
+
+ // Generates a string including degrees symbol, from an angel specification in 1/100deg
+ bool ImpMarkPoint(SdrHdl* pHdl, SdrMark* pMark, bool bUnmark);
+ virtual bool MarkPoints(const tools::Rectangle* pRect, bool bUnmark);
+ bool MarkGluePoints(const tools::Rectangle* pRect, bool bUnmark);
+
+ void SetMoveOutside(bool bOn);
+ bool MarkableObjectsExceed( int n ) const;
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrMarkView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
+ virtual ~SdrMarkView() override;
+
+public:
+ virtual bool IsAction() const override;
+ virtual void MovAction(const Point& rPnt) override;
+ virtual void EndAction() override;
+ virtual void BckAction() override;
+ virtual void BrkAction() override;
+ virtual void TakeActionRect(tools::Rectangle& rRect) const override;
+
+ virtual void ClearPageView() override;
+ virtual void HideSdrPage() override;
+ bool IsObjMarkable(SdrObject const * pObj, SdrPageView const * pPV) const;
+
+ // Returns sal_True if objects, points or gluepoints are selected by drawing a frame
+ // (as long as the frame is drawn).
+ bool IsMarking() const { return IsMarkObj() || IsMarkPoints() || IsMarkGluePoints(); }
+
+ // Marking objects by drawing of a selection frame
+ void BegMarkObj(const Point& rPnt, bool bUnmark = false);
+ void MovMarkObj(const Point& rPnt);
+ bool EndMarkObj();
+ void BrkMarkObj();
+ bool IsMarkObj() const { return (nullptr != mpMarkObjOverlay); }
+
+ // DragModes: SDRDRAG_CREATE,SdrDragMode::Move,SdrDragMode::Resize,SdrDragMode::Rotate,SdrDragMode::Mirror,SdrDragMode::Shear,SdrDragMode::Crook
+ // Move==Resize
+ // The interface might maybe be changed in the future because of Ortho-Drag
+ void SetDragMode(SdrDragMode eMode);
+ SdrDragMode GetDragMode() const { return meDragMode; }
+ void SetFrameHandles(bool bOn);
+ bool IsFrameHandles() const { return mbForceFrameHandles; }
+
+ // returns true if number of markable objects is greater than 1
+ bool HasMultipleMarkableObjects() const { return MarkableObjectsExceed(1); };
+
+ void SetEditMode(SdrViewEditMode eMode);
+ SdrViewEditMode GetEditMode() const { return meEditMode; }
+
+ void SetEditMode(bool bOn) { SetEditMode(bOn?SdrViewEditMode::Edit:SdrViewEditMode::Create); }
+ bool IsEditMode() const { return meEditMode==SdrViewEditMode::Edit; }
+ void SetCreateMode(bool bOn) { SetEditMode(bOn?SdrViewEditMode::Create:SdrViewEditMode::Edit); }
+ bool IsCreateMode() const { return meEditMode==SdrViewEditMode::Create; }
+ void SetGluePointEditMode(bool bOn) { SetEditMode(bOn?SdrViewEditMode::GluePointEdit:meEditMode0); }
+ bool IsGluePointEditMode() const { return meEditMode==SdrViewEditMode::GluePointEdit; }
+
+ void SetDesignMode(bool bOn = true);
+ bool IsDesignMode() const { return mbDesignMode; }
+
+ void SetFrameDragSingles(bool bOn=true) { SetFrameHandles(bOn); }
+ bool IsFrameDragSingles() const { return IsFrameHandles(); }
+
+ bool HasMarkableObj() const { return MarkableObjectsExceed(0); };
+
+ /// whether all x coordinates in use are negated or not
+ void SetNegativeX(bool bOn) { mbNegativeX = bOn; }
+ bool IsNegativeX() const { return mbNegativeX; }
+
+// migrate selections
+
+protected:
+ // all available changing methods
+ SdrMarkList& GetMarkedObjectListWriteAccess() { return maSdrViewSelection.GetMarkedObjectListWriteAccess(); }
+
+public:
+ // all available const methods for read access to selection
+ const SdrMarkList& GetMarkedObjectList() const { return maSdrViewSelection.GetMarkedObjectList(); }
+ // returns SAL_MAX_SIZE if not found
+ size_t TryToFindMarkedObject(const SdrObject* pObj) const { return GetMarkedObjectList().FindObject(pObj); }
+ SdrPageView* GetSdrPageViewOfMarkedByIndex(size_t nNum) const { return GetMarkedObjectList().GetMark(nNum)->GetPageView(); }
+ SdrMark* GetSdrMarkByIndex(size_t nNum) const { return GetMarkedObjectList().GetMark(nNum); }
+ SdrObject* GetMarkedObjectByIndex(size_t nNum) const { return GetMarkedObjectList().GetMark(nNum)->GetMarkedSdrObj(); }
+ size_t GetMarkedObjectCount() const { return GetMarkedObjectList().GetMarkCount(); }
+ void SortMarkedObjects() const { GetMarkedObjectList().ForceSort(); }
+ bool AreObjectsMarked() const { return 0 != GetMarkedObjectList().GetMarkCount(); }
+ OUString const & GetDescriptionOfMarkedObjects() const { return GetMarkedObjectList().GetMarkDescription(); }
+ OUString const & GetDescriptionOfMarkedPoints() const { return GetMarkedObjectList().GetPointMarkDescription(); }
+ OUString const & GetDescriptionOfMarkedGluePoints() const { return GetMarkedObjectList().GetGluePointMarkDescription(); }
+
+ // Get a list of all those links which are connected to marked nodes,
+ // but which are not marked themselves.
+ const SdrMarkList& GetEdgesOfMarkedNodes() const { return maSdrViewSelection.GetEdgesOfMarkedNodes(); }
+ const SdrMarkList& GetMarkedEdgesOfMarkedNodes() const { return maSdrViewSelection.GetMarkedEdgesOfMarkedNodes(); }
+ const std::vector<SdrObject*>& GetTransitiveHullOfMarkedObjects() const { return maSdrViewSelection.GetAllMarkedObjects(); }
+
+
+ // mechanism to complete disable handles at the view. Handles will be hidden and deleted
+ // when set, no new ones created, no interaction allowed. Handles will be recreated and shown
+ // when reset. Default is false.
+ void hideMarkHandles();
+ void showMarkHandles();
+ bool areMarkHandlesHidden() const { return mbMarkHandlesHidden; }
+
+ bool IsMarkedHit(const Point& rPnt, short nTol=-2) const { return IsMarkedObjHit(rPnt,nTol); }
+ bool IsMarkedObjHit(const Point& rPnt, short nTol=-2) const;
+
+ SdrHdl* PickHandle(const Point& rPnt) const;
+
+ // Pick: Supported options for nOptions are:
+ // SdrSearchOptions::DEEP SdrSearchOptions::ALSOONMASTER SdrSearchOptions::TESTMARKABLE SdrSearchOptions::TESTTEXTEDIT
+ // SdrSearchOptions::MARKED
+ // SdrSearchOptions::WHOLEPAGE
+ SdrObject* PickObj(const Point& rPnt, short nTol, SdrPageView*& rpPV, SdrSearchOptions nOptions, SdrObject** ppRootObj, bool* pbHitPassDirect=nullptr) const;
+ SdrObject* PickObj(const Point& rPnt, short nTol, SdrPageView*& rpPV, SdrSearchOptions nOptions=SdrSearchOptions::NONE) const;
+ bool MarkObj(const Point& rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false);
+
+ // Pick: Supported options for nOptions are SdrSearchOptions::PASS2BOUND
+ bool PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, SdrSearchOptions nOptions) const;
+
+ // Selects the most upper of the marked objects (O1) and scans from there
+ // towards bottom direction, selecting the first non-marked object (O2).
+ // In case of success the marking of O1 is deleted, a marking is created at
+ // O2 and TRUE is returned. With the parameter bPrev=sal_True the scan
+ // direction is turned to the other direction.
+ bool MarkNextObj(bool bPrev=false);
+
+ // Selects the most upper of the marked objects which is hit by rPnt/nTol
+ // and scans from there to bottom direction, selecting the first non-marked
+ // object (O2). In case of success the marking of O1 is deleted, a marking
+ // is created at O2 and sal_True is returned. With the parameter
+ // bPrev=sal_True the scan direction is turned to the other direction.
+ bool MarkNextObj(const Point& rPnt, short nTol, bool bPrev);
+
+ // Mark all objects within a rectangular area
+ // Just objects are marked which are inclosed completely
+ void MarkObj(const tools::Rectangle& rRect, bool bUnmark);
+ void MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark = false, bool bDoNoSetMarkHdl = false,
+ std::vector<basegfx::B2DRectangle> && rSubSelections = std::vector<basegfx::B2DRectangle>());
+ void MarkAllObj(SdrPageView* pPV=nullptr); // pPage=NULL => all displayed pages
+ void UnmarkAllObj(SdrPageView const * pPV=nullptr); // pPage=NULL => all displayed pages
+
+ // This function is time-consuming intensive, as the MarkList has to be scanned.
+ bool IsObjMarked(SdrObject const * pObj) const;
+ void UnMarkAll(SdrPageView const * pPV=nullptr) { UnmarkAllObj(pPV); }
+
+ // Request/set the size of the marking handles. Declaration in Pixel.
+ // The value is meant to be the edge length ( link length ).
+ // Pair values are round up to impair values: 3->3, 4->5, 5->5, 6->7, 7->7, ...
+ // Default value is 7, minimum value is 3 Pixels.
+ sal_uInt16 GetMarkHdlSizePixel() const;
+ void SetMarkHdlSizePixel(sal_uInt16 nSiz);
+
+ virtual bool HasMarkablePoints() const;
+ virtual sal_Int32 GetMarkablePointCount() const;
+ virtual bool HasMarkedPoints() const;
+
+ // There might be points which can't be marked:
+ bool IsPointMarkable(const SdrHdl& rHdl) const;
+ virtual bool MarkPoint(SdrHdl& rHdl, bool bUnmark=false);
+
+ /** should only be used from outside svx for special ui elements */
+ bool MarkPointHelper(SdrHdl* pHdl, SdrMark* pMark, bool bUnmark);
+
+ bool UnmarkPoint(SdrHdl& rHdl) { return MarkPoint(rHdl,true); }
+ bool IsPointMarked(const SdrHdl& rHdl) const { ForceUndirtyMrkPnt(); return rHdl.IsSelected(); }
+ bool MarkAllPoints() { return MarkPoints(nullptr,false); }
+ bool UnmarkAllPoints() { return MarkPoints(nullptr,true); }
+
+ // Selects the first marked point (P1) which is hit by rPnt
+ // and from there it searches the first non-marked point(P2).
+ // In case of success the marking of
+ // P1 is deleted, a mark is set at P2.
+ void MarkNextPoint();
+
+ // Search for the number of the suitable handle. In case of empty search result,
+ // SAL_MAX_SIZE is returned.
+ size_t GetHdlNum(SdrHdl const * pHdl) const { return maHdlList.GetHdlNum(pHdl); }
+ SdrHdl* GetHdl(size_t nHdlNum) const { return maHdlList.GetHdl(nHdlNum); }
+ const SdrHdlList& GetHdlList() const { return maHdlList; }
+
+ // Draw a selection frame for marking of points.
+ // This routine will just be started in case that HasMarkablePoints() returns sal_True.
+ bool BegMarkPoints(const Point& rPnt, bool bUnmark = false);
+ void MovMarkPoints(const Point& rPnt);
+ bool EndMarkPoints();
+ void BrkMarkPoints();
+ bool IsMarkPoints() const { return (nullptr != mpMarkPointsOverlay); }
+
+ // Select that additional handles are displayed permanently.
+ void SetPlusHandlesAlwaysVisible(bool bOn);
+ bool IsPlusHandlesAlwaysVisible() const { return mbPlusHdlAlways; }
+
+ bool HasMarkableGluePoints() const;
+ bool HasMarkedGluePoints() const;
+
+ // A gluepoint is clearly identified by the SdrObject
+ // (to which it belongs) as well as by a sal_uInt16 nId (as each SdrObject may consist of
+ // several gluepoints. Here at the View there is an additional
+ // SdrPageView, which should be defined correctly always.
+ // Alternatively a gluepoint may be characterized by a SdrHdl.
+ // In this case the SdrHdl instance consists of all required information.
+ // And in this case, the gluepoint are always is marked by enforcement
+ // (Handlers are just situated at marked gluepoints )
+ // Attention: With each change of the gluepoint status the handle list is re-calculated.
+ // All previously saved SdrHdl* became invalid by this, the same with the point IDs!
+ bool PickGluePoint(const Point& rPnt, SdrObject*& rpObj, sal_uInt16& rnId, SdrPageView*& rpPV) const;
+ bool MarkGluePoint(const SdrObject* pObj, sal_uInt16 nId, bool bUnmark);
+ void UnmarkGluePoint(const SdrObject* pObj, sal_uInt16 nId) { MarkGluePoint(pObj,nId,true); }
+ bool IsGluePointMarked(const SdrObject* pObj, sal_uInt16 nId) const;
+
+ // Get the Hdl (handle) of a marked GluePoint. Non-marked
+ // GluePoints don`t have handles
+ SdrHdl* GetGluePointHdl(const SdrObject* pObj, sal_uInt16 nId) const;
+
+ // Mark all points within this rectangular (View coordinates)
+ bool MarkAllGluePoints() { return MarkGluePoints(nullptr,false); }
+ bool UnmarkAllGluePoints() { return MarkGluePoints(nullptr,true); }
+
+ // Selects the first marked point (P1) which is hit by rPnt
+ // and from there it searches the first non-marked point(P2).
+ // In case of success the marking of
+ // P1 is deleted, a mark is set at P2.
+ void MarkNextGluePoint();
+
+ // Draw a selection frame for gluepoint marking.
+ // This routine will just be started in case that HasMarkablePoints() returns sal_True.
+ // The GlueEditMode sal_True is disregarded.
+ // bool BegMarkGluePoints(const Point& rPnt, OutputDevice* pOut);
+ bool BegMarkGluePoints(const Point& rPnt, bool bUnmark = false);
+ void MovMarkGluePoints(const Point& rPnt);
+ void EndMarkGluePoints();
+ void BrkMarkGluePoints();
+ bool IsMarkGluePoints() const { return (nullptr != mpMarkGluePointsOverlay); }
+
+ // bRestraintPaint=sal_False causes the handles not to be drawn immediately.
+ // AdjustMarkHdl is just called in case of changes; usually this causes an Invalidate
+ // At the end of a redraw the handles are drawn automatically.
+ // The purpose is to avoid unnecessary flickering. -> This does not yet work, that's why sal_True!
+ void AdjustMarkHdl(SfxViewShell* pOtherShell = nullptr); //HMHBOOL bRestraintPaint=sal_True);
+
+ const tools::Rectangle& GetMarkedObjRect() const; // SnapRects of Objects, without line width
+ tools::Rectangle GetMarkedObjBoundRect() const; // incl. line width, overlapping rags, ...
+ const tools::Rectangle& GetMarkedPointsRect() const; // Enclosing rectangle of all marked points
+ const tools::Rectangle& GetMarkedGluePointsRect() const; // Enclosing rectangle of all marked gluepoints
+ const tools::Rectangle& GetAllMarkedRect() const { return GetMarkedObjRect(); }
+ tools::Rectangle GetAllMarkedBoundRect() const { return GetMarkedObjBoundRect(); }
+
+ // Will be always called, if the list of marked objects might be changed.
+ // If you override this method, be sure that you call the
+ // methods of the base class!
+ virtual void MarkListHasChanged();
+
+ // Entering (Editing) of a maybe marked object group. If there are several
+ // object groups marked, the most upper group is selected. After that
+ // all member objects of the group are directly accessible. All other
+ // objects may not be processed in the meantime (until the next
+ // LeaveGroup()). With markings which overlaps pages, every page is processed
+ // separately. The method returns sal_True, if at least one group was entered.
+ void EnterMarkedGroup();
+
+ // Rotation center point and start point of the axis of reflection, respectively
+ const Point& GetRef1() const { return maRef1; }
+ void SetRef1(const Point& rPt);
+
+ // End point of the axis of reflection
+ const Point& GetRef2() const { return maRef2; }
+ void SetRef2(const Point& rPt);
+ /// Get access to the view shell owning this draw view, if any.
+ virtual SfxViewShell* GetSfxViewShell() const;
+};
+
+
+// - Hit tolerances:
+// It has to be declared in logical coordinates. So please translate the
+// wanted pixel value with PixelToLogic in Logical values.
+// Taking as example a logical value of 100:
+// - For a horizontal hairline (Object with height 0), the generated data is +/-100, i.e.
+// a vertical area of 200 logical units is sensitive.
+// - For a polygon, a rectangular of the size (200,200) is generated and a
+// touch test between Poly and this Rect is processed.
+// - Objects which respond SdrObject::HasEdit()==TRUE ( e.g. a text frame ),
+// are specially treated: An additional sensitive area with a width of
+// 2*Tol (200 units for this example) is created around the object.
+// When an object is directly hit, the Edit method is called.
+// In opposite, a hit in the surrounding sensitive area enables Dragging.
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx
new file mode 100644
index 000000000..e161db2a7
--- /dev/null
+++ b/include/svx/svdoashp.hxx
@@ -0,0 +1,253 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdobj.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdhdl.hxx>
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/drawing/XCustomShapeEngine.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <svx/svxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace sdr
+{
+ namespace properties
+ {
+ class CustomShapeProperties;
+ }
+}
+
+class SdrAShapeObjGeoData final : public SdrTextObjGeoData
+{
+public:
+ bool bMirroredX;
+ bool bMirroredY;
+ double fObjectRotation;
+
+ css::uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq;
+};
+
+enum class CustomShapeHandleModes
+{
+ NONE = 0,
+ RESIZE_FIXED = 1,
+ CREATE_FIXED = 2,
+ RESIZE_ABSOLUTE_X = 4,
+ RESIZE_ABSOLUTE_Y = 8,
+ MOVE_SHAPE = 16,
+ ORTHO4 = 32,
+ RESIZE_ABSOLUTE_NEGX = 64
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<CustomShapeHandleModes> : is_typed_flags<CustomShapeHandleModes, 127> {};
+}
+
+struct SdrCustomShapeInteraction
+{
+ css::uno::Reference< css::drawing::XCustomShapeHandle > xInteraction;
+ css::awt::Point aPosition;
+ CustomShapeHandleModes nMode;
+};
+
+class SVXCORE_DLLPUBLIC SdrObjCustomShape : public SdrTextObj
+{
+private:
+ // fObjectRotation is containing the object rotation in degrees.
+ double fObjectRotation;
+ bool mbAdjustingTextFrameWidthAndHeight;
+
+protected:
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+ virtual void setUnoShape(const css::uno::Reference<css::drawing::XShape>& rxUnoShape) override;
+
+public:
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+
+ // to allow sdr::properties::CustomShapeProperties access
+ friend class sdr::properties::CustomShapeProperties;
+
+ css::uno::Reference< css::drawing::XShape > mXRenderedCustomShape;
+
+ mutable css::uno::Reference< css::drawing::XCustomShapeEngine > mxCustomShapeEngine;
+
+ // #i37011# render geometry shadow
+ SdrObject* mpLastShadowGeometry;
+
+ css::uno::Reference< css::drawing::XCustomShapeEngine > const & GetCustomShapeEngine() const;
+
+ std::vector< SdrCustomShapeInteraction > GetInteractionHandles() const; // needed in unit test
+ SVX_DLLPRIVATE void DragCreateObject( SdrDragStat& rDrag );
+ SVX_DLLPRIVATE void DragResizeCustomShape( const tools::Rectangle& rNewRect );
+ void DragMoveCustomShapeHdl( const Point& rDestination,
+ const sal_uInt16 nCustomShapeHdlNum, bool bMoveCalloutRectangle ); // needed in unit test
+
+ // #i37011# centralize throw-away of render geometry
+ void InvalidateRenderGeometry();
+
+ // #i38892#
+ void ImpCheckCustomGluePointsAreAdded();
+
+ // returns the new text rect that corresponds to the current logic rect, the return value can be empty if nothing changed.
+ tools::Rectangle ImpCalculateTextFrame( const bool bHgt, const bool bWdt );
+
+public:
+ // #i37011#
+ const SdrObject* GetSdrObjectFromCustomShape() const;
+ const SdrObject* GetSdrObjectShadowFromCustomShape() const;
+ bool GetTextBounds( tools::Rectangle& rTextBound ) const;
+ bool IsTextPath() const;
+ basegfx::B2DPolyPolygon GetLineGeometry( const bool bBezierAllowed ) const;
+
+protected:
+ // #115391# new method for SdrObjCustomShape and SdrTextObj to correctly handle and set
+ // SdrTextMinFrameWidthItem and SdrTextMinFrameHeightItem based on all settings, necessities
+ // and object sizes
+ virtual void AdaptTextMinSize() override;
+
+ Size m_aSuggestedTextFrameSize;
+
+ // protected destructor
+ virtual ~SdrObjCustomShape() override;
+
+ virtual void InternalSetStyleSheet( SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast ) override;
+
+public:
+ bool UseNoFillStyle() const;
+
+ bool IsMirroredX() const;
+ bool IsMirroredY() const;
+ void SetMirroredX( const bool bMirroredX );
+ void SetMirroredY( const bool bMirroredY );
+
+ double GetObjectRotation() const { return fObjectRotation;}
+ double GetExtraTextRotation( const bool bPreRotation = false ) const;
+
+ SdrObjCustomShape(SdrModel& rSdrModel);
+ SdrObjCustomShape(SdrModel& rSdrModel, SdrObjCustomShape const & rSource);
+
+ /* is merging default attributes from type-shape into the SdrCustomShapeGeometryItem. If pType
+ is NULL then the type is being taken from the "Type" property of the SdrCustomShapeGeometryItem.
+ MergeDefaultAttributes is called when creating CustomShapes via UI and after importing */
+ void MergeDefaultAttributes( const OUString* pType = nullptr );
+
+ /* the method is checking if the geometry data is unchanged/default, in this case the data might not be stored */
+ enum class DefaultType
+ {
+ Path,
+ Viewbox,
+ Segments,
+ Gluepoints,
+ StretchX,
+ StretchY,
+ Equations,
+ TextFrames
+ };
+ bool IsDefaultGeometry( const DefaultType eDefaultType ) const;
+
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+
+ virtual void Move(const Size& rSiz) override;
+ virtual void Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
+ virtual void SetSnapRect(const tools::Rectangle& rRect) override;
+ virtual void SetLogicRect(const tools::Rectangle& rRect) override;
+ virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override;
+
+ virtual void NbcMove(const Size& rSiz) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+ virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
+ virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
+ virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
+
+ virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const override;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const override;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
+
+ virtual bool MovCreate(SdrDragStat& rStat) override; // #i37448#
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+
+ /**
+ * Allows suggesting the text frame size: in case the application has its
+ * own text associated to the shape, instead of using the shape's editeng
+ * text.
+ */
+ void SuggestTextFrameSize(Size aSuggestedTextFrameSize);
+ virtual bool AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool bHgt = true, bool bWdt = true) const override;
+ virtual bool NbcAdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true) override;
+ virtual bool AdjustTextFrameWidthAndHeight() override;
+ virtual bool IsAutoGrowHeight() const override;
+ virtual bool IsAutoGrowWidth() const override;
+ virtual void SetVerticalWriting(bool bVertical) override;
+ virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const override;
+ virtual void EndTextEdit( SdrOutliner& rOutl ) override;
+ virtual void TakeTextAnchorRect( tools::Rectangle& rAnchorRect ) const override;
+ virtual void TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText,
+ tools::Rectangle* pAnchorRect, bool bLineWidth = true ) const override;
+ virtual SdrObjCustomShape* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly( const SdrDragStat& rDrag) const override;
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+ virtual basegfx::B2DPolyPolygon TakeContour() const override;
+
+ virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject) override;
+
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ // react on model/page change
+ virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
+
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData &rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override;
+
+ // need to take fObjectRotation instead of aGeo.nAngle, replace it temporary
+ virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const override;
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) override;
+
+ virtual const SdrGluePointList* GetGluePointList() const override;
+ //virtual SdrGluePointList* GetGluePointList();
+ virtual SdrGluePointList* ForceGluePointList() override;
+
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+
+ // #i33136#
+ static bool doConstructOrthogonal(std::u16string_view rName);
+
+ using SdrTextObj::NbcSetOutlinerParaObject;
+
+ OUString GetCustomShapeName() const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdoattr.hxx b/include/svx/svdoattr.hxx
new file mode 100644
index 000000000..3933caa3f
--- /dev/null
+++ b/include/svx/svdoattr.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdobj.hxx>
+#include <svx/svxdllapi.h>
+
+// Initial Declarations
+class SfxPoolItem;
+class SfxSetItem;
+class SdrOutliner;
+class SfxItemSet;
+class SfxItemPool;
+
+// SdrAttrObj
+class SVXCORE_DLLPUBLIC SdrAttrObj : public SdrObject
+{
+private:
+ friend class SdrOutliner;
+
+protected:
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+
+ tools::Rectangle maSnapRect;
+
+protected:
+ /// Detects the width of the line. No line ->0.
+ sal_Int32 ImpGetLineWdt() const;
+
+ /// Detects when a stylesheet is changed
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+
+ SdrAttrObj(SdrModel& rSdrModel);
+ // Copy constructor
+ SdrAttrObj(SdrModel& rSdrModel, SdrAttrObj const &);
+ virtual ~SdrAttrObj() override;
+
+public:
+
+ // Detects if bFilledObj && Fill != FillNone
+ bool HasFill() const;
+
+ // Detects if Line != LineNone
+ bool HasLine() const;
+
+ virtual const tools::Rectangle& GetSnapRect() const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
new file mode 100644
index 000000000..4c8fce88b
--- /dev/null
+++ b/include/svx/svdobj.hxx
@@ -0,0 +1,1036 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <com/sun/star/uno/Any.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/outdev.hxx>
+#include <svl/lstner.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/typedwhich.hxx>
+#include <tools/degree.hxx>
+#include <svx/svdtypes.hxx>
+#include <svx/svdobjkind.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/link.hxx>
+#include <tools/weakbase.h>
+#include <tools/gen.hxx>
+#include <unotools/resmgr.hxx>
+
+#include <unordered_set>
+
+class SfxBroadcaster;
+class AutoTimer;
+class OutlinerParaObject;
+class Outliner;
+class SdrOutliner;
+class SdrDragStat;
+class SdrHdl;
+class SdrHdlList;
+class SdrItemPool;
+class SdrModel;
+class SdrObjList;
+class SdrObject;
+class SdrPage;
+class SdrPageView;
+class SdrView;
+class SfxItemSet;
+class SfxGrabBagItem;
+class SfxSetItem;
+class SfxStyleSheet;
+class SfxUndoAction;
+class XFillAttrSetItem;
+class XLineAttrSetItem;
+class SfxItemPool;
+namespace tools { class PolyPolygon; }
+class SfxPoolItem;
+class SdrVirtObj;
+class SdrDragView;
+class SdrObjUserDataList;
+class SdrObjPlusData;
+class SdrGluePoint;
+class SdrGluePointList;
+class SdrLayerIDSet;
+class Fraction;
+enum class PointerStyle;
+class Graphic;
+class SvxShape;
+namespace svx { enum class ShapePropertyProviderId; }
+
+namespace basegfx
+{
+ class B2DPoint;
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
+}
+
+namespace sdr { class ObjectUser; }
+namespace sdr::properties { class BaseProperties; }
+namespace sdr::contact { class ViewContact; }
+
+namespace svx { class PropertyChangeNotifier; }
+namespace com::sun::star::drawing { class XShape; }
+namespace svx::diagram { class IDiagramHelper; }
+
+
+struct SVXCORE_DLLPUBLIC SdrObjectFreeOp;
+
+// helper for constructing std::unique_ptr for SdrObjects where a
+// deleter is needed - here, SdrObject::Free needs to be used.
+typedef std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr;
+
+enum class SdrInventor : sal_uInt32 {
+ Unknown = 0,
+ BasicDialog = sal_uInt32( 'D' | ('L' << 8) | ('G' << 16) | ('1' << 24) ),
+ Default = sal_uInt32( 'S' | ('V' << 8) | ('D' << 16) | ('r' << 24) ),
+ E3d = sal_uInt32( 'E' | ('3' << 8) | ('D' << 16) | ('1' << 24) ),
+ FmForm = sal_uInt32( 'F' | ('M' << 8) | ('0' << 16) | ('1' << 24) ),
+ IMap = sal_uInt32( 'I' | ('M' << 8) | ('A' << 16) | ('P' << 24) ),
+ ReportDesign = sal_uInt32( 'R' | ('P' << 8) | ('T' << 16) | ('1' << 24) ),
+ ScOrSwDraw = sal_uInt32( 'S' | ('C' << 8) | ('3' << 16) | ('0' << 24) ), // Used in sc/ and sw/
+ SgaImap = sal_uInt32( 'S' | ('D' << 8) | ('U' << 16) | ('D' << 24) ),
+ StarDrawUserData = sal_uInt32( 'S' | ('D' << 8) | ('U' << 16) | ('D' << 24) ),
+ Swg = sal_uInt32( 'S' | ('W' << 8) | ('G' << 16) ),
+};
+
+enum class SdrUserCallType {
+ MoveOnly, // only moved, size unchanged
+ Resize, // size and maybe position changed
+ ChangeAttr, // attribute changed. Eventually new size, because of line width
+ Delete, // object is going to be deleted soon, no attributes anymore
+ Inserted, // inserted into an object list (e.g. Page)
+ Removed, // removed from an object list
+ ChildMoveOnly, // a child within a group has changed
+ ChildResize, // a child within a group has changed
+ ChildChangeAttr, // a child within a group has changed
+ ChildDelete, // a child within a group has changed
+ ChildInserted, // a child within a group has changed
+ ChildRemoved // a child within a group has changed
+};
+
+class SVXCORE_DLLPUBLIC SdrObjUserCall
+{
+public:
+ virtual ~SdrObjUserCall();
+ virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& rOldBoundRect);
+ virtual sal_Int32 GetPDFAnchorStructureElementId(SdrObject const& rObj, OutputDevice const&);
+};
+
+class SVXCORE_DLLPUBLIC SdrObjMacroHitRec
+{
+public:
+ Point aPos;
+ const SdrLayerIDSet* pVisiLayer;
+ const SdrPageView* pPageView;
+ sal_uInt16 nTol;
+
+ SdrObjMacroHitRec();
+};
+
+/**
+ * User data of a drawing object, e.g. application specific data.
+ * Every drawing object can have an arbitrary amount of such records (SV list).
+ * Whoever wants to save data here, must inherit from this and set a corresponding link in the factory.
+ */
+class SVXCORE_DLLPUBLIC SdrObjUserData
+{
+ SdrInventor nInventor;
+ sal_uInt16 nIdentifier;
+
+ void operator=(const SdrObjUserData& rData) = delete;
+ bool operator==(const SdrObjUserData& rData) const = delete;
+ bool operator!=(const SdrObjUserData& rData) const = delete;
+
+public:
+ SdrObjUserData(SdrInventor nInv, sal_uInt16 nId);
+ SdrObjUserData(const SdrObjUserData& rData);
+ virtual ~SdrObjUserData();
+
+ virtual std::unique_ptr<SdrObjUserData> Clone(SdrObject* pObj1) const = 0; // #i71039# NULL -> 0
+ SdrInventor GetInventor() const { return nInventor;}
+ sal_uInt16 GetId() const { return nIdentifier;}
+};
+
+/**
+ * All geometrical data of an arbitrary object for use in undo/redo
+ */
+class SVXCORE_DLLPUBLIC SdrObjGeoData
+{
+public:
+ tools::Rectangle aBoundRect;
+ Point aAnchor;
+ std::unique_ptr<SdrGluePointList>
+ pGPL;
+ bool bMovProt;
+ bool bSizProt;
+ bool bNoPrint;
+ bool bClosedObj;
+ bool mbVisible;
+ SdrLayerID mnLayerID;
+
+public:
+ SdrObjGeoData();
+ virtual ~SdrObjGeoData();
+};
+
+/**
+ * Provides information about various ZObject properties
+ */
+class SVXCORE_DLLPUBLIC SdrObjTransformInfoRec
+{
+public:
+ bool bMoveAllowed : 1; // if false, object cannot be moved
+ bool bResizeFreeAllowed : 1; // if false, object cannot be resized freely
+ bool bResizePropAllowed : 1; // if false, object cannot even be resized proportionally
+ bool bRotateFreeAllowed : 1; // if false, object cannot be rotated freely
+ bool bRotate90Allowed : 1; // if false, object cannot even be rotated in 90 degree steps
+ bool bMirrorFreeAllowed : 1; // if false, object cannot be mirrored freely
+ bool bMirror45Allowed : 1; // if false, object cannot even be mirrored over axes in a 45 degree raster
+ bool bMirror90Allowed : 1; // if false, object cannot even be mirrored over axes in a 90 degree raster
+ bool bTransparenceAllowed : 1; // if false, object does not have an interactive transparence control
+ bool bShearAllowed : 1; // if false, object cannot be sheared
+ bool bEdgeRadiusAllowed : 1;
+ bool bNoOrthoDesired : 1; // is true for Rect; is false for BMP, MTF
+ bool bNoContortion : 1; // if false, contortion not possible (for crook, only true for PathObj and grouped PathObjs)
+ bool bCanConvToPath : 1; // if false, no conversion into PathObj possible
+ bool bCanConvToPoly : 1; // if false, no conversion into PolyObj possible
+ bool bCanConvToContour : 1; // if false, no conversion down to whole contour possible
+ bool bCanConvToPathLineToArea : 1; // if false, no conversion into PathObj with transformation from LineToArea possible
+ bool bCanConvToPolyLineToArea : 1; // if false, no conversion into PolyObj with transformation from LineToArea possible
+
+ SdrObjTransformInfoRec();
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// SdrObject
+// SdrAttrObj
+// E3dObject
+// E3dCompoundObject
+// E3dCubeObj
+// E3dExtrudeObj
+// E3dLatheObj
+// E3dPolygonObj
+// E3dSphereObj
+// E3dScene
+// SdrTextObj
+// SdrObjCustomShape
+// OCustomShape
+// SdrEdgeObj
+// SdrMeasureObj
+// SdrPathObj
+// SdrRectObj
+// SdrCaptionObj
+// SdrCircObj
+// SdrGrafObj
+// SdrMediaObj
+// SdrOle2Obj
+// OOle2Obj
+// SdrUnoObj
+// DlgEdObj
+// DlgEdForm
+// OUnoObject
+// FmFormObj
+// SdrTableObj
+// SdrObjGroup
+// SdrPageObj
+// SdrVirtObj
+// SwDrawVirtObj
+// SwVirtFlyDrawObj
+// SwFlyDrawObj
+
+/// Abstract DrawObject
+class SVXCORE_DLLPUBLIC SdrObject : public SfxListener, public tools::WeakBase
+{
+public:
+ // Basic DiagramHelper support
+ virtual const std::shared_ptr< svx::diagram::IDiagramHelper >& getDiagramHelper() const;
+ bool isDiagram() const { return bool(getDiagramHelper()); }
+
+private:
+ friend class SdrObjListIter;
+ friend class SdrObjList;
+ friend class SdrVirtObj;
+ friend class SdrRectObj;
+
+ // OperationSmiley: Allow at each SdrObject to set a FillGeometryDefiningShape,
+ // so that for SdrObjects where this is set, the definition of a defined FillStyle
+ // will use this, but the local geometry will be filled. This allows to fill
+ // multiple shapes with a unified fill, e.g think about CustomShapes.
+ // Currently this is *only* used for CustomShapes, but may be developed to get a
+ // common mechanism - usages for it are easy to be found. The current limitation
+ // to CustomShapes allows to think about these SdrObjects to 'vanish' during the
+ // lifetime of 'this' - the SdrObjects without SdrPage and SdrModel are used as helper
+ // objects for SdrObjCustomShape and thus their lifetime is limited to the lifetime
+ // of this local object. For unifying this mechanism, some weak reference of
+ // SdrObjects would have to be thought about (not easy with the current implementation).
+ // So - allow *only* EnhancedCustomShape2d (which creates the visualizations for
+ // SdrObjCustomShape) to set this. Already allow unified read to use it - thus already
+ // allowing to implement as standard case for all kinds of SdrObjects.
+ friend class EnhancedCustomShape2d;
+ const SdrObject* mpFillGeometryDefiningShape;
+ void setFillGeometryDefiningShape(const SdrObject* pNew) { mpFillGeometryDefiningShape = pNew; }
+public:
+ const SdrObject* getFillGeometryDefiningShape() const { return mpFillGeometryDefiningShape; }
+
+private:
+ // the SdrModel this objects was created with, unchanged during SdrObject lifetime
+ SdrModel& mrSdrModelFromSdrObject;
+
+public:
+ // A SdrObject always needs a SdrModel for lifetime (Pool, ...)
+ SdrObject(SdrModel& rSdrModel);
+ // Copy constructor
+ SdrObject(SdrModel& rSdrModel, SdrObject const & rSource);
+
+ // SdrModel/SdrPage access on SdrObject level
+ SdrPage* getSdrPageFromSdrObject() const;
+ SdrModel& getSdrModelFromSdrObject() const;
+
+ // access to possible children (SdrObjGroup/E3dScene)
+ virtual SdrObjList* getChildrenOfSdrObject() const;
+
+ // access to parent
+ SdrObjList* getParentSdrObjListFromSdrObject() const;
+ SdrObject* getParentSdrObjectFromSdrObject() const;
+
+private:
+ SVX_DLLPRIVATE void setParentOfSdrObject(SdrObjList* pNew);
+
+public:
+ // react on model/page change
+ virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage);
+
+ void AddObjectUser(sdr::ObjectUser& rNewUser);
+ void RemoveObjectUser(sdr::ObjectUser& rOldUser);
+
+ sdr::contact::ViewContact& GetViewContact() const;
+
+ virtual sdr::properties::BaseProperties& GetProperties() const;
+
+ // DrawContact support: Methods for handling Object changes
+ void ActionChanged() const;
+
+ static SdrItemPool& GetGlobalDrawObjectItemPool();
+ void SetRelativeWidth( double nValue );
+ void SetRelativeWidthRelation( sal_Int16 eValue );
+ void SetRelativeHeight( double nValue );
+ void SetRelativeHeightRelation( sal_Int16 eValue );
+ const double* GetRelativeWidth() const;
+ sal_Int16 GetRelativeWidthRelation() const;
+ const double* GetRelativeHeight() const;
+ sal_Int16 GetRelativeHeightRelation() const;
+
+ /// @param bNotMyself = true: set only ObjList to dirty, don't mark this object as dirty.
+ ///
+ /// This is needed for instance for NbcMove, because usually one moves SnapRect and aOutRect
+ /// at the same time to avoid recomputation.
+ virtual void SetBoundAndSnapRectsDirty(bool bNotMyself = false, bool bRecursive = true);
+
+ // frees the SdrObject pointed to by the argument
+ // In case the object has an SvxShape, which has the ownership of the object, it
+ // is actually *not* deleted.
+ static void Free( SdrObject*& _rpObject );
+
+ // this method is only for access from Property objects
+ virtual void SetBoundRectDirty();
+
+ SfxItemPool & GetObjectItemPool() const;
+
+ void AddListener(SfxListener& rListener);
+ void RemoveListener(SfxListener& rListener);
+
+ void AddReference(SdrVirtObj& rVrtObj);
+ void DelReference(SdrVirtObj& rVrtObj);
+ virtual SdrInventor GetObjInventor() const;
+ virtual SdrObjKind GetObjIdentifier() const;
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+
+ // Layer interface
+ virtual SdrLayerID GetLayer() const;
+ virtual void NbcSetLayer(SdrLayerID nLayer);
+ virtual void SetLayer(SdrLayerID nLayer);
+ // renaming GetSdrLayerIDSet -> getMergedHierarchySdrLayerIDSet to make clear what happens here. rSet needs to be empty.
+ void getMergedHierarchySdrLayerIDSet(SdrLayerIDSet& rSet) const;
+
+ void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle& rBoundRect) const;
+
+ // #i68101#
+ // An object may have a user-set Name (Get/SetName()), e.g SdrGrafObj, SdrObjGroup
+ // or SdrOle2Obj.
+ // It may also have a Title and a Description for accessibility purposes.
+ virtual void SetName(const OUString& rStr, const bool bSetChanged = true);
+ virtual const OUString & GetName() const;
+ void MakeNameUnique();
+ void MakeNameUnique(std::unordered_set<OUString>& rNameSet);
+ virtual void SetTitle(const OUString& rStr);
+ virtual OUString GetTitle() const;
+ virtual void SetDescription(const OUString& rStr);
+ virtual OUString GetDescription() const;
+
+ // for group objects
+ bool IsGroupObject() const;
+ virtual SdrObjList* GetSubList() const;
+
+ /// The order number (aka ZOrder, aka z-index) determines whether a
+ /// SdrObject is located above or below another. Objects are painted from
+ /// lowest to highest order number. If the order of SdrObjects in the
+ /// SdrObjList is changed, the bObjOrdNumsDirty flag is set on the SdrPage
+ /// and the next GetOrdNum() call recalculates the order number of all
+ /// SdrObjects in the SdrObjList.
+ sal_uInt32 GetOrdNum() const;
+
+ // setting the order number should only happen from the model or from the page
+ void SetOrdNum(sal_uInt32 nNum);
+
+ // GrabBagItem for interim interop purposes
+ void GetGrabBagItem(css::uno::Any& rVal) const;
+
+ virtual void SetGrabBagItem(const css::uno::Any& rVal);
+
+ // Return the position in the navigation order for the called object.
+ // Note that this method may update the navigation position of the
+ // called and of other SdrObjects. Therefore this method can not be
+ // const.
+ // @return
+ // If no navigation position has been explicitly defined then the
+ // result of GetOrdNum() is returned.
+ sal_uInt32 GetNavigationPosition() const;
+
+ // To make clearer that this method may trigger RecalcBoundRect and thus may be
+ // expensive and sometimes problematic (inside a bigger object change You will get
+ // non-useful BoundRects sometimes) i rename that method from GetBoundRect() to
+ // GetCurrentBoundRect().
+ virtual const tools::Rectangle& GetCurrentBoundRect() const;
+
+ // To have a possibility to get the last calculated BoundRect e.g for producing
+ // the first rectangle for repaints (old and new need to be used) without forcing
+ // a RecalcBoundRect (which may be problematical and expensive sometimes) i add here
+ // a new method for accessing the last BoundRect.
+ virtual const tools::Rectangle& GetLastBoundRect() const;
+
+ virtual void RecalcBoundRect();
+
+ void BroadcastObjectChange() const;
+
+ const SfxBroadcaster* GetBroadcaster() const;
+
+ // set modified-flag in the model
+ virtual void SetChanged();
+
+ // Tooling for painting a single object to an OutputDevice. This will be needed as long
+ // as not all painting is changed to use DrawContact objects.
+ void SingleObjectPainter(OutputDevice& rOut) const;
+ bool LineGeometryUsageIsNecessary() const;
+
+ // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation, that
+ // means no change of the rotation point (only centered) and no shear allowed
+ virtual bool HasLimitedRotation() const;
+
+ // Returns a copy of the object. Every inherited class must reimplement this.
+ virtual SdrObject* CloneSdrObject(SdrModel& rTargetModel) const;
+
+ // Overwriting this object makes no sense, it is too complicated for that
+ SdrObject& operator=(const SdrObject& rObj) = delete;
+ SdrObject& operator=(SdrObject&& rObj) = delete;
+
+ // TakeObjName...() is for the display in the UI, e.g. "3 frames selected"
+ virtual OUString TakeObjNameSingul() const;
+ virtual OUString TakeObjNamePlural() const;
+
+ /// The Xor-Polygon is required by the View to drag the object.
+ /// All polygons within the PolyPolygon are interpreted as PolyLine.
+ /// To get a closed Polygon, close it explicitly.
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+
+ /// contour for TextToContour
+ virtual basegfx::B2DPolyPolygon TakeContour() const;
+
+ /// Via GetHdlCount the number of Handles can be retrieved.
+ /// Normally 8, if it's a line 2.
+ /// For Polygon objects (Polygon/Spline/Bezier) the number may be much
+ /// larger. Polygon objects are also allowed to select a point of a
+ /// selected object. The handle of that point will then be replaced by
+ /// a new set of handles (PlusHdl). For a Polygon this would be a simple
+ /// selection Handle, for a Bezier curve this may be up to 3 Handles
+ /// (including Weights).
+ /// GetHdl() and GetPlusHdl() must create Handle instances with new!
+ /// An object that returns true from HasSpacialDrag() must provide these
+ /// methods (incl. FillHdlList()).
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual void AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const;
+ virtual void addCropHandles(SdrHdlList& rTarget) const;
+
+ /// The standard transformations (Move,Resize,Rotate,Mirror,Shear) are
+ /// taken over by the View (TakeXorPoly(),...).
+ /// Object type specific dragging like corner radius of Rectangle,
+ /// control points of Splines, weights of Bezier curves, pointer of
+ /// Label objects must be handled by the object itself.
+ /// To keep the Model free of state, the state is kept in the View
+ /// and then passed to the object. EndDrag usually returns true for success,
+ /// false may be returned if the dragging did not modify the object,
+ /// where the View already handles the case that the pointer was not
+ /// moved at all.
+ virtual bool hasSpecialDrag() const;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+ virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const;
+ virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
+
+ // FullDrag support. This is for standard interactions and for SdrObjOwn
+ // support. If supportsFullDrag() returns true, getFullDragClone has to
+ // return a cloned SdrObject (who's ownership it loses) at which modifications
+ // like Move(), Scale(), etc or applySpecialDrag() will be executed. That
+ // object will be visualized on overlay for full drag, but should not be
+ // part of the model, thus not changing anything since it's only a temporary
+ // helper object for interaction
+ virtual bool supportsFullDrag() const;
+ virtual SdrObjectUniquePtr getFullDragClone() const;
+
+ /// Every object must be able to create itself interactively.
+ /// On MouseDown first an object is created, and its BegCreate() method
+ /// is called. On every MouseMove, MovCreate() is called. BrkCreate()
+ /// is called if the user cancels the interactive object creation.
+ /// EndCreate() is called on the MouseUp event. If EndCreate() returns
+ /// true, the creation is finished; the object is inserted into the
+ /// corresponding list. Otherwise it is assumed that further points
+ /// are necessary to create the object (Polygon, ...). The parameter
+ /// eCmd contains the number of mouse clicks (if the application
+ /// provides it).
+ /// BckCreate() will undo the previous EndCreate(), e.g. to delete the
+ /// last point of the Polygon. If BckCreate() returns false, creation
+ /// is cancelled.
+ virtual bool BegCreate(SdrDragStat& rStat);
+ virtual bool MovCreate(SdrDragStat& rStat); // if true, Xor needs to be repainted
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ virtual bool BckCreate(SdrDragStat& rStat);
+ virtual void BrkCreate(SdrDragStat& rStat);
+
+ /// get the cursor/pointer that signals creating this object
+ virtual PointerStyle GetCreatePointer() const;
+
+ /// Polygon dragged by the user when creating the object
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+
+ /// The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and
+ /// SetLogicRect call the corresponding Nbc-methods, send a Repaint
+ /// broadcast and set the Modified state on the Model.
+ /// Derived classes should usually only override the Nbc methods.
+ /// Nbc means "no broadcast".
+ virtual void NbcMove (const Size& rSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcCrop (const basegfx::B2DPoint& rRef, double fxFact, double fyFact);
+ virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs);
+ // Utility for call sites that don't have sin and cos handy
+ void NbcRotate(const Point& rRef, Degree100 nAngle);
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
+ virtual void NbcShear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear);
+
+ virtual void Move (const Size& rSiz);
+ virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true);
+ virtual void Crop (const basegfx::B2DPoint& rRef, double fxFact, double fyFact);
+ virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs);
+ virtual void Mirror(const Point& rRef1, const Point& rRef2);
+ virtual void Shear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear);
+
+ /// The relative position of a SdrObject is the distance of the upper
+ /// left corner of the logic bounding rectangle (SnapRect) to the anchor.
+ virtual void NbcSetRelativePos(const Point& rPnt);
+ virtual void SetRelativePos(const Point& rPnt);
+ virtual Point GetRelativePos() const;
+ void ImpSetAnchorPos(const Point& rPnt);
+ virtual void NbcSetAnchorPos(const Point& rPnt);
+ virtual void SetAnchorPos(const Point& rPnt);
+
+ /// Snap is not done on the BoundRect but if possible on logic coordinates
+ /// (i.e. without considering stroke width, ...)
+ /// SetSnapRect() tries to size the Object so that it fits into the
+ /// passed Rect (without stroke width, ...)
+ virtual void RecalcSnapRect();
+ virtual const tools::Rectangle& GetSnapRect() const;
+ virtual void SetSnapRect(const tools::Rectangle& rRect);
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect);
+
+ // Logic Rect: for the Rect for instance without regard to rotation angle, shear, ...
+ virtual const tools::Rectangle& GetLogicRect() const;
+ virtual void SetLogicRect(const tools::Rectangle& rRect);
+ virtual void NbcSetLogicRect(const tools::Rectangle& rRect);
+
+ // the default is to set the logic rect to the given rectangle rMaxRect. If the shape
+ // has an intrinsic aspect ratio it may set the logic rect so the aspect
+ // ratio is kept but still inside the rectangle rMaxRect.
+ // If bShrinkOnly is set to true, the size of the current logic rect will not
+ // be changed if it is smaller than the given rectangle rMaxRect.
+ virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false );
+
+ // rotation and shear angle
+ virtual Degree100 GetRotateAngle() const;
+ virtual Degree100 GetShearAngle(bool bVertical = false) const;
+
+ /// snap to special points of an Object (polygon points, center of circle)
+ virtual sal_uInt32 GetSnapPointCount() const;
+ virtual Point GetSnapPoint(sal_uInt32 i) const;
+
+ // For objects, whose points can be moved individually.
+ // (e.g. polygons, polylines, lines)
+ // The points of those objects are selected (if necessary multiselection),
+ // deleted, inserted, or as a multiselection moved or rotated...
+ // Only such objects can have PlusHandles (e.g. the weights of a Bezier curve).
+ virtual bool IsPolyObj() const;
+ virtual sal_uInt32 GetPointCount() const;
+ virtual Point GetPoint(sal_uInt32 i) const;
+ void SetPoint(const Point& rPnt, sal_uInt32 i);
+ virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
+
+ // get all geometrical data for undo/redo
+ virtual std::unique_ptr<SdrObjGeoData> GetGeoData() const;
+ virtual void SetGeoData(const SdrObjGeoData& rGeo);
+
+ // ItemSet access
+ const SfxItemSet& GetMergedItemSet() const;
+ void SetMergedItem(const SfxPoolItem& rItem);
+ void ClearMergedItem(const sal_uInt16 nWhich = 0);
+ void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false);
+ const SfxPoolItem& GetMergedItem(const sal_uInt16 nWhich) const;
+ template<class T>
+ const T& GetMergedItem( TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
+ }
+
+ // syntactical sugar for ItemSet accesses
+ void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems = false);
+
+ // NotPersistAttr for Layer, ObjName, geometrical transformations etc.
+ void TakeNotPersistAttr(SfxItemSet& rAttr) const;
+ void ApplyNotPersistAttr(const SfxItemSet& rAttr);
+ void NbcApplyNotPersistAttr(const SfxItemSet& rAttr);
+
+ // if bDontRemoveHardAttr is false, set all attributes, which were set in the style sheet, to their default value
+ // if true, all hard attributes keep their values
+ void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr);
+ void NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr);
+ SfxStyleSheet* GetStyleSheet() const;
+
+ virtual bool HasTextEdit() const;
+
+ // keep text in outliner's format
+ // SetOutlinerParaObject: transfer ownership of *pTextObject!
+ void SetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject);
+ virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject);
+ virtual OutlinerParaObject* GetOutlinerParaObject() const;
+ virtual void NbcReformatText();
+
+ void BurnInStyleSheetAttributes();
+
+ // macro abilities, e.g. a rectangle as PushButton.
+ virtual bool HasMacro() const;
+ virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const;
+ virtual PointerStyle GetMacroPointer (const SdrObjMacroHitRec& rRec) const;
+ virtual void PaintMacro (OutputDevice& rOut, const tools::Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const;
+ virtual bool DoMacro (const SdrObjMacroHitRec& rRec);
+ bool IsMacroHit(const SdrObjMacroHitRec& rRec) const;
+
+ // Connectors
+ // (see also documentation in SvdoEdge.hxx, SdrEdgeObj, as well as SvdGlue.hxx and SvdGlEV.hxx)
+ //
+ // There are nodes and edges. In theory an edge can also be a node, but this isn't implemented yet.
+ // A node has a number of gluepoints, onto which edges can glued to
+ // An edge can be either
+ // - without any connection to any node,
+ // - or connected on one end to a node, while the other end is not connected,
+ // - or connected on both ends with exactly one node each.
+ // The edge is listener for its up to two nodes.
+ // Whenever a node is moved or resized, all its connected edges follow.
+ // This is also true for SetGluePoint()... on the node.
+ // On the other hand, moving/resizing an edge breaks the connection.
+
+ // automatic gluepoints:
+ // a node object must provide four vertex and corner positions
+ // usually 0: top, 1: right, 2: bottom, 3: left
+ virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
+
+ // usually:
+ // 0: top-left, 1: top-right, 2: bottom-right, 3: bottom-left
+ virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
+
+ // list of all gluepoints, can be NULL
+ virtual const SdrGluePointList* GetGluePointList() const;
+
+ // after changing the GluePointList, one has to call the object's SendRepaintBroadcast!
+ virtual SdrGluePointList* ForceGluePointList();
+
+ // to be set temporarily when transforming related object(?)
+ void SetGlueReallyAbsolute(bool bOn);
+ void NbcRotateGluePoints(const Point& rRef, Degree100 nAngle, double sn, double cs);
+ void NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2);
+ void NbcShearGluePoints (const Point& rRef, double tn, bool bVShear);
+
+ // if bTail1 is true, line start, otherwise line end
+ // if pObj is null disconnect
+ virtual void ConnectToNode(bool bTail1, SdrObject* pObj);
+ virtual void DisconnectFromNode(bool bTail1);
+ virtual SdrObject* GetConnectedNode(bool bTail1) const;
+
+ // sets the writing mode of the object's context
+ // Objects which itself do not support different writing modes will ignore this call.
+ // Objects which support different writing modes, but have an own, explicit writing mode set,
+ // will also ignore this call.
+ // Objects which support different writing modes, and whose own mode is set to css.text.WritingMode2.CONTEXT,
+ // will use the given writing mode to calculate their "effective writing mode".
+ // The behaviour of this method is undefined if you pass css.text.WritingMode2.CONTEXT.
+ // @param _nContextWritingMode
+ // the effective writing mode of the context of the object
+ virtual void SetContextWritingMode( const sal_Int16 _nContextWritingMode );
+
+ // If an object is able to convert itself into a polygon or into a Bezier curve (or into both),
+ // then the following methods should be overridden.
+ // E.g., convert a RectObj with line width 10, SOLID_PEN into a polygon:
+ // In the bLineToArea=false mode a PolyObj with four supporting points,
+ // line width 10 and SOLID_PEN shall be created.
+ // On the contrary in the bLineToArea=true mode the generated object should
+ // still have a line attribute NULL_PEN, and the line (also line pattern)
+ // itself should be emulated by the polygon area, which thereby can be
+ // manipulated by the user afterwards.
+ // The RectObj therefore can only convert correctly if it has an area attribute NULL_BRUSH.
+ // In this case it would have to:
+ // - set SOLID_BRUSH with the color of the given pen,
+ // - set NULL_PEN, and
+ // - generate tools::PolyPolygon with two polygons with four supporting points each.
+ // In each case the return value is a SdrObject*, because it is also
+ // allowed to return group objects (e.g. for SdrTextObj).
+ // In the case of the conversion from TextObj to PathObj,
+ // both modi (bLineToArea=true/false) would be identical.
+ // The methods' default implementations report "I'm unable to do this" (false/null).
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const;
+ SdrObjectUniquePtr ConvertToPolyObj(bool bBezier, bool bLineToArea) const;
+
+ // convert this path object to contour object; bForceLineDash converts even
+ // when there is no filled new polygon created from line-to-polygon conversion,
+ // specially used for XLINE_DASH and 3D conversion
+ SdrObject* ConvertToContourObj(SdrObject* pRet, bool bForceLineDash = false) const;
+private:
+ SdrObject* ImpConvertToContourObj(bool bForceLineDash);
+public:
+
+ // if true, reference onto an object
+ bool IsVirtualObj() const { return m_bVirtObj;}
+
+ // is true, if object can probably be filled
+ // is false, if object has probably line ends
+ // is invalid, if this is a group object
+ bool IsClosedObj() const { return m_bClosedObj;}
+
+ // tdf#118662 reorganize inserted state, no local bool needed anymore,
+ // it depends on being a member of a SdrObjList
+ void InsertedStateChange();
+ bool IsInserted() const { return nullptr != getParentSdrObjListFromSdrObject(); }
+
+ bool IsEdgeObj() const { return m_bIsEdge;}
+ bool Is3DObj() const { return m_bIs3DObj;}
+ bool IsUnoObj() const { return m_bIsUnoObj;}
+ void SetMoveProtect(bool bProt);
+ bool IsMoveProtect() const { return m_bMovProt;}
+ void SetResizeProtect(bool bProt);
+ bool IsResizeProtect() const { return m_bSizProt;}
+ void SetPrintable(bool bPrn);
+ bool IsPrintable() const { return !m_bNoPrint;}
+ void SetVisible(bool bVisible);
+ bool IsVisible() const { return mbVisible;}
+ void SetMarkProtect(bool bProt);
+ bool IsMarkProtect() const { return m_bMarkProt;}
+
+ /// Whether the aspect ratio should be kept by default when resizing.
+ virtual bool shouldKeepAspectRatio() const { return false; }
+
+ // application specific data
+ sal_uInt16 GetUserDataCount() const;
+ SdrObjUserData* GetUserData(sal_uInt16 nNum) const;
+
+ void AppendUserData(std::unique_ptr<SdrObjUserData> pData);
+
+ // removes the record from the list and performs delete (FreeMem+Dtor).
+ void DeleteUserData(sal_uInt16 nNum);
+
+ // access to the UNO representation of the shape
+ virtual css::uno::Reference< css::drawing::XShape > getUnoShape();
+
+ static SdrObject* getSdrObjectFromXShape( const css::uno::Reference< css::uno::XInterface >& xInt );
+
+ // retrieves the instance responsible for notifying changes in the properties of the shape associated with
+ // the SdrObject
+ //
+ // @precond
+ // There already exists an SvxShape instance associated with the SdrObject
+ // @throws css::uno::RuntimeException
+ // if there does nt yet exists an SvxShape instance associated with the SdrObject.
+ svx::PropertyChangeNotifier& getShapePropertyChangeNotifier();
+
+ // notifies a change in the given property, to all applicable listeners registered at the associated SvxShape
+ //
+ // This method is equivalent to calling getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty ),
+ // exception that it is allowed to be called when there does not yet exist an associated SvxShape - in which
+ // case the method will silently return without doing anything.
+ void notifyShapePropertyChange( const svx::ShapePropertyProviderId _eProperty ) const;
+
+ // transformation interface for StarOfficeAPI. This implements support for
+ // homogen 3x3 matrices containing the transformation of the SdrObject. At the
+ // moment it contains a shearX, rotation and translation, but for setting all linear
+ // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
+ //
+ // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
+ // with the base geometry and returns TRUE. Otherwise it returns FALSE.
+ virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
+
+ // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+ // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
+ // to use (0,0) as upper left and will be scaled to the given size in the matrix.
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+ // give info if object is in destruction
+ bool IsInDestruction() const;
+
+ // return if fill is != XFILL_NONE
+ bool HasFillStyle() const;
+ bool HasLineStyle() const;
+
+ // on import of OLE object from MS documents the BLIP size might be retrieved,
+ // the following methods are used to control it;
+ // usually this data makes no sense after the import is finished, since the object
+ // might be resized
+ const tools::Rectangle& GetBLIPSizeRectangle() const { return maBLIPSizeRectangle;}
+ void SetBLIPSizeRectangle( const tools::Rectangle& aRect );
+
+ // #i121917#
+ virtual bool HasText() const;
+
+ bool Equals(const SdrObject&) const;
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+ /// Is this a textbox of a drawinglayer shape?
+ virtual bool IsTextBox() const;
+
+ void SetEmptyPresObj(bool bEpt);
+ bool IsEmptyPresObj() const { return m_bEmptyPresObj;}
+ void SetNotVisibleAsMaster(bool bFlg);
+ bool IsNotVisibleAsMaster() const { return m_bNotVisibleAsMaster;}
+ void SetUserCall(SdrObjUserCall* pUser);
+ SdrObjUserCall* GetUserCall() const { return m_pUserCall;}
+ /// @see mbDoNotInsertIntoPageAutomatically
+ void SetDoNotInsertIntoPageAutomatically(bool bSet);
+ /// @see mbDoNotInsertIntoPageAutomatically
+ bool IsDoNotInsertIntoPageAutomatically() const { return mbDoNotInsertIntoPageAutomatically;}
+
+ // Warning: this method should only be used if you really know what you're doing
+ sal_uInt32 GetOrdNumDirect() const { return m_nOrdNum;}
+
+ // #i25616#
+ bool DoesSupportTextIndentingOnLineWidthChange() const { return mbSupportTextIndentingOnLineWidthChange;}
+
+ const Point& GetAnchorPos() const;
+
+ // #i25616#
+ bool LineIsOutsideGeometry() const { return mbLineIsOutsideGeometry;}
+
+ // Set the position in the navigation position to the given value.
+ // This method is typically used only by the model after a change to
+ // the navigation order.
+ // This method does not change the navigation position of other
+ // objects.
+ // Use SdrObjList::SetObjectNavigationPosition() instead.
+ void SetNavigationPosition (const sal_uInt32 nPosition);
+
+ /// Sets a new UNO representation of the shape
+ ///
+ /// Calling this function is only allowed for the UNO representation
+ /// itself!
+ ///
+ /// The default implementation of this function sets the new UNO
+ /// shape. Derived classes should override the function to handle
+ /// any other actions that are needed when the shape is being
+ /// changed.
+ ///
+ /// The implementation _must_ call the same method of its parent
+ /// class (preferably as the first step)!
+ virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& _rxUnoShape );
+
+ const css::uno::WeakReference< css::drawing::XShape >& getWeakUnoShape() const { return maWeakUnoShape; }
+
+ // return true if a bg was set, false otherwise
+ bool setSuitableOutlinerBg(Outliner& rOutliner) const;
+ // If fillstyle is drawing::FillStyle_BITMAP, returns the graphic.
+ const Graphic* getFillGraphic() const;
+
+ const OUString& getHyperlink() const { return msHyperlink; }
+ void setHyperlink(const OUString& sHyperlink) { msHyperlink = sHyperlink; }
+
+ void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept;
+
+protected:
+ mutable tools::Rectangle m_aOutRect; // surrounding rectangle for Paint (incl. LineWidth, ...)
+ Point m_aAnchor; // anchor position (Writer)
+ SdrObjUserCall* m_pUserCall;
+ std::unique_ptr<SdrObjPlusData>
+ m_pPlusData; // Broadcaster, UserData, connectors, ... (this is the Bitsack)
+ // object is only pointing to another one
+ bool m_bVirtObj : 1;
+ bool m_bSnapRectDirty : 1;
+ // the following flags will be streamed
+ bool m_bMovProt : 1; // if true, the position is protected
+ bool m_bSizProt : 1; // if true, the size is protected
+ // If bEmptyPresObj is true, it is a presentation object that has no content yet.
+ // The flag's default value is false.
+ // The management is done by the application.
+ // Neither assign operator nor cloning copies the flag!
+ // The flag is persistent.
+ bool m_bEmptyPresObj : 1; // empty presentation object (Draw)
+ // if true, object is invisible as object of the MasterPage
+ bool m_bNotVisibleAsMaster : 1;
+ // if true, the object is closed, i.e. no line, arc...
+ bool m_bClosedObj : 1;
+ bool m_bIsEdge : 1;
+ bool m_bIs3DObj : 1;
+ bool m_bIsUnoObj : 1;
+ // #i25616#
+ bool mbLineIsOutsideGeometry : 1;
+ // #i25616#
+ bool mbSupportTextIndentingOnLineWidthChange : 1;
+
+ virtual ~SdrObject() override;
+
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties();
+
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact();
+
+ tools::Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
+
+ // for GetDragComment
+ OUString ImpGetDescriptionStr(TranslateId pStrCacheID) const;
+
+ void ImpForcePlusData();
+
+ OUString GetMetrStr(tools::Long nVal) const;
+
+ /// A derived class must override these 3 methods if it has own geometric
+ /// data that must be saved for Undo.
+ /// NewGeoData() creates an empty instance of a class derived from
+ /// SdrObjGeoData.
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo);
+
+ // internal versions
+ const SfxItemSet& GetObjectItemSet() const;
+ void SetObjectItem(const SfxPoolItem& rItem);
+ void SetObjectItemSet(const SfxItemSet& rSet);
+ const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const;
+ template<class T> const T& GetObjectItem( TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
+ }
+
+ const SfxItemSet* getBackgroundFillSet() const;
+
+ virtual void InternalSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast);
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> mpImpl;
+ SdrObjList* mpParentOfSdrObject; // list that includes this object
+ sal_uInt32 m_nOrdNum; // order number of the object in the list
+ std::unique_ptr<SfxGrabBagItem> m_pGrabBagItem; // holds the GrabBagItem property
+ // Position in the navigation order. SAL_MAX_UINT32 when not used.
+ sal_uInt32 mnNavigationPosition;
+ SdrLayerID mnLayerID;
+ bool m_bNoPrint : 1; // if true, the object is not printed.
+ bool mbVisible : 1; // if false, the object is not visible on screen (but maybe on printer, depending on bNoprint
+ bool m_bMarkProt : 1; // marking forbidden, persistent
+ // on import of OLE object from MS documents the BLIP size might be retrieved,
+ // in this case the following member is initialized as nonempty rectangle
+ tools::Rectangle maBLIPSizeRectangle;
+ std::unique_ptr<sdr::properties::BaseProperties>
+ mpProperties;
+ std::unique_ptr<sdr::contact::ViewContact>
+ mpViewContact;
+
+ // do not use directly, always use getSvxShape() if you have to!
+ SvxShape* mpSvxShape;
+ css::uno::WeakReference< css::drawing::XShape >
+ maWeakUnoShape;
+ // HACK: Do not automatically insert newly created object into a page.
+ // The user needs to do it manually later.
+ bool mbDoNotInsertIntoPageAutomatically;
+ // Hyperlink for the whole shape
+ OUString msHyperlink;
+
+ // only for internal use!
+ SvxShape* getSvxShape();
+
+ SdrObject( const SdrObject& ) = delete;
+};
+
+struct SVXCORE_DLLPUBLIC SdrObjectFreeOp
+{
+ void operator()(SdrObject* obj)
+ {
+ SdrObject::Free(obj);
+ }
+};
+
+struct SdrObjCreatorParams
+{
+ SdrInventor nInventor;
+ SdrObjKind nObjIdentifier;
+ SdrModel& rSdrModel;
+};
+
+/**
+ * Whoever creates his own objects must set a link in the SdrObjFactory class.
+ * The handler must have the following signature:
+ * void Hdl(SdrObjFactory*)
+ * He must take a look at the referenced instance's nInventor and nIdentifier values,
+ * and must create a new drawing object instance accordingly.
+ * He must also make the pNewObj pointer reference to this instance.
+ */
+class SVXCORE_DLLPUBLIC SdrObjFactory
+{
+public:
+ static SdrObject* MakeNewObject(
+ SdrModel& rSdrModel,
+ SdrInventor nInventor,
+ SdrObjKind nObjIdentifier,
+ const tools::Rectangle* pSnapRect = nullptr);
+
+ static void InsertMakeObjectHdl(Link<SdrObjCreatorParams, SdrObject*> const & rLink);
+ static void RemoveMakeObjectHdl(Link<SdrObjCreatorParams, SdrObject*> const & rLink);
+
+private:
+ static SVX_DLLPRIVATE SdrObject* CreateObjectFromFactory(
+ SdrModel& rSdrModel,
+ SdrInventor nInventor,
+ SdrObjKind nIdentifier);
+
+ SdrObjFactory() = delete;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdobjkind.hxx b/include/svx/svdobjkind.hxx
new file mode 100644
index 000000000..187fd0d6f
--- /dev/null
+++ b/include/svx/svdobjkind.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/form/FormComponentType.hpp>
+
+enum class SdrObjKind : sal_uInt16
+{
+ NONE = 0, /// abstract object (SdrObject)
+ Group = 1, /// object group
+ Line = 2, /// line
+ Rectangle = 3, /// rectangle (round corners optional)
+ CircleOrEllipse = 4, /// circle, ellipse
+ CircleSection = 5, /// circle section
+ CircleArc = 6, /// circle arc
+ CircleCut = 7, /// circle cut
+ Polygon = 8, /// polygon, PolyPolygon
+ PolyLine = 9, /// PolyLine
+ PathLine = 10, /// open Bezier-curve
+ PathFill = 11, /// closed Bezier-curve
+ FreehandLine = 12, /// open free-hand line
+ FreehandFill = 13, /// closed free-hand line
+ SplineLine = 14, /// natural cubic Spline (ni)
+ SplineFill = 15, /// periodic cubic Spline (ni)
+ Text = 16, /// text object
+ TitleText = 20, /// TitleText, special text object for StarDraw
+ OutlineText = 21, /// OutlineText, special text object for StarDraw
+ Graphic = 22, /// foreign graphic (StarView Graphic)
+ OLE2 = 23, /// OLE object
+ Edge = 24, /// connector object
+ Caption = 25, /// caption object
+ PathPoly = 26, /// Polygon/PolyPolygon represented by SdrPathObj
+ PathPolyLine = 27, /// Polyline represented by SdrPathObj
+ Page = 28, /// object that represents a SdrPage
+ Measure = 29, /// measurement object
+ OLEPluginFrame = 31, /// continuously activated OLE (PlugIn-Frame or similar)
+ UNO = 32, /// Universal Network Object packed into SvDraw object
+ CustomShape = 33, /// custom shape
+ Media = 34, /// media shape
+ Table = 35, /// table
+
+ OLE2Applet = 100,
+ OLE2Plugin = 101,
+
+ // engine3d, arbitrarily place at 200
+ E3D_Scene = 202,
+ // E3D_OBJECT_ID should not be used, it's only a helper class for E3DScene and E3DCompoundObject
+ E3D_Object = 203,
+ E3D_Cube = 204,
+ E3D_Sphere = 205,
+ E3D_Extrusion = 206,
+ E3D_Lathe = 207,
+ E3D_CompoundObject = 208,
+ E3D_Polygon = 209,
+ E3D_INVENTOR_FIRST = E3D_Scene,
+ E3D_INVENTOR_LAST = E3D_Polygon,
+
+ // for form components, arbitrarily place at 300
+ FormControl = 300 + css::form::FormComponentType::CONTROL,
+ FormEdit = 300 + css::form::FormComponentType::TEXTFIELD,
+ FormButton = 300 + css::form::FormComponentType::COMMANDBUTTON,
+ FormFixedText = 300 + css::form::FormComponentType::FIXEDTEXT,
+ FormListbox = 300 + css::form::FormComponentType::LISTBOX,
+ FormCheckbox = 300 + css::form::FormComponentType::CHECKBOX,
+ FormCombobox = 300 + css::form::FormComponentType::COMBOBOX,
+ FormRadioButton = 300 + css::form::FormComponentType::RADIOBUTTON,
+ FormGroupBox = 300 + css::form::FormComponentType::GROUPBOX,
+ FormGrid = 300 + css::form::FormComponentType::GRIDCONTROL,
+ FormImageButton = 300 + css::form::FormComponentType::IMAGEBUTTON,
+ FormFileControl = 300 + css::form::FormComponentType::FILECONTROL,
+ FormDateField = 300 + css::form::FormComponentType::DATEFIELD,
+ FormTimeField = 300 + css::form::FormComponentType::TIMEFIELD,
+ FormNumericField = 300 + css::form::FormComponentType::NUMERICFIELD,
+ FormCurrencyField = 300 + css::form::FormComponentType::CURRENCYFIELD,
+ FormPatternField = 300 + css::form::FormComponentType::PATTERNFIELD,
+ FormHidden = 300 + css::form::FormComponentType::HIDDENCONTROL,
+ FormImageControl = 300 + css::form::FormComponentType::IMAGECONTROL,
+ FormFormattedField = 300 + css::form::FormComponentType::PATTERNFIELD + 1,
+ FormScrollbar = 300 + css::form::FormComponentType::PATTERNFIELD + 2,
+ FormSpinButton = 300 + css::form::FormComponentType::PATTERNFIELD + 3,
+ FormNavigationBar = 300 + css::form::FormComponentType::PATTERNFIELD + 4,
+
+ // basctl, arbitrarily place at 400
+ BasicDialogControl = 401,
+ BasicDialogDialog = 402,
+ BasicDialogPushButton = 403,
+ BasicDialogRadioButton = 404,
+ BasicDialogCheckbox = 405,
+ BasicDialogListbox = 406,
+ BasicDialogCombobox = 407,
+ BasicDialogGroupBox = 408,
+ BasicDialogEdit = 409,
+ BasicDialogFixedText = 410,
+ BasicDialogImageControl = 411,
+ BasicDialogProgressbar = 412,
+ BasicDialogHorizontalScrollbar = 413,
+ BasicDialogVerticalScrollbar = 414,
+ BasicDialogHorizontalFixedLine = 415,
+ BasicDialogVerticalFixedLine = 416,
+ BasicDialogDateField = 417,
+ BasicDialogTimeField = 418,
+ BasicDialogNumericField = 419,
+ BasicDialogCurencyField = 420,
+ BasicDialogFormattedField = 421,
+ BasicDialogPatternField = 422,
+ BasicDialogFileControl = 423,
+ BasicDialogTreeControl = 424,
+ BasicDialogSpinButton = 425,
+ BasicDialogGridControl = 426,
+ BasicDialogHyperlinkControl = 427,
+
+ BasicDialogFormRadio = 428,
+ BasicDialogFormCheck = 429,
+ BasicDialogFormList = 430,
+ BasicDialogFormCombo = 431,
+ BasicDialogFormSpin = 432,
+ BasicDialogFormVerticalScroll = 433,
+ BasicDialogFormHorizontalScroll = 434,
+
+ // reportdesign, arbitrarily place at 500
+ ReportDesignFixedText = 501,
+ ReportDesignImageControl = 502,
+ ReportDesignFormattedField = 503,
+ ReportDesignHorizontalFixedLine = 504,
+ ReportDesignVerticalFixedLine = 505,
+ ReportDesignSubReport = 506,
+
+ // writer, arbitrarily place at 600
+ SwFlyDrawObjIdentifier = 601
+};
+
+inline constexpr bool IsInventorE3D(SdrObjKind e)
+{
+ return e >= SdrObjKind::E3D_INVENTOR_FIRST && e <= SdrObjKind::E3D_INVENTOR_LAST;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdocapt.hxx b/include/svx/svdocapt.hxx
new file mode 100644
index 000000000..28337b663
--- /dev/null
+++ b/include/svx/svdocapt.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdorect.hxx>
+#include <svx/svxdllapi.h>
+
+
+// Forward Declarations
+class ImpCaptParams;
+
+namespace sdr::properties {
+ class CaptionProperties;
+}
+
+// Helper Class SdrCaptObjGeoData
+class SdrCaptObjGeoData final : public SdrTextObjGeoData
+{
+public:
+ tools::Polygon aTailPoly;
+};
+
+// SdrCaptionObj
+class SVXCORE_DLLPUBLIC SdrCaptionObj final : public SdrRectObj
+{
+private:
+ // to allow sdr::properties::CaptionProperties access to ImpRecalcTail()
+ friend class sdr::properties::CaptionProperties;
+ friend class SdrTextObj; // for ImpRecalcTail() during AutoGrow
+
+ // tdf#118662 exclusive friend function and setter for SuppressGetBitmap
+ friend void setSuppressGetBitmapFromXclObjComment(SdrCaptionObj* pSdrCaptionObj, bool bValue);
+ void setSuppressGetBitmap(bool bNew)
+ {
+ mbSuppressGetBitmap = bNew;
+ }
+
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+
+ tools::Polygon aTailPoly; // the whole tail polygon
+ bool mbSpecialTextBoxShadow; // for calc special shadow, default FALSE
+ bool mbFixedTail; // for calc note box fixed tail, default FALSE
+ bool mbSuppressGetBitmap; // tdf#118662
+ Point maFixedTailPos; // for calc note box fixed tail position.
+
+ SVX_DLLPRIVATE void ImpGetCaptParams(ImpCaptParams& rPara) const;
+ SVX_DLLPRIVATE static void ImpCalcTail1(const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
+ SVX_DLLPRIVATE static void ImpCalcTail2(const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
+ SVX_DLLPRIVATE static void ImpCalcTail3(const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
+ SVX_DLLPRIVATE static void ImpCalcTail (const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
+ SVX_DLLPRIVATE void ImpRecalcTail();
+
+ // protected destructor
+ virtual ~SdrCaptionObj() override;
+
+public:
+ SdrCaptionObj(SdrModel& rSdrModel);
+ // Copy constructor
+ SdrCaptionObj(SdrModel& rSdrModel, SdrCaptionObj const & rSource);
+ SdrCaptionObj(
+ SdrModel& rSdrModel,
+ const tools::Rectangle& rRect,
+ const Point& rTail);
+
+ // tdf#118662 getter for SuppressGetBitmap
+ bool isSuppressGetBitmap() const { return mbSuppressGetBitmap; }
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual SdrCaptionObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ // for calc: special shadow only for text box
+ void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow = true; }
+ bool GetSpecialTextBoxShadow() const { return mbSpecialTextBoxShadow; }
+
+ // for calc: fixed note tail position.
+ void SetFixedTail() { mbFixedTail = true; }
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const override;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
+ virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
+
+ virtual bool BegCreate(SdrDragStat& rStat) override;
+ virtual bool MovCreate(SdrDragStat& rStat) override;
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+ virtual bool BckCreate(SdrDragStat& rStat) override;
+ virtual void BrkCreate(SdrDragStat& rStat) override;
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
+ virtual PointerStyle GetCreatePointer() const override;
+
+ virtual void NbcMove(const Size& rSiz) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+
+ virtual void NbcSetRelativePos(const Point& rPnt) override;
+ virtual Point GetRelativePos() const override;
+
+ virtual const tools::Rectangle& GetLogicRect() const override;
+ virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
+
+ virtual sal_uInt32 GetSnapPointCount() const override;
+ virtual Point GetSnapPoint(sal_uInt32 i) const override;
+
+private:
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+
+public:
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ const Point& GetTailPos() const;
+ void SetTailPos(const Point& rPos);
+ void NbcSetTailPos(const Point& rPos);
+
+ // #i32599#
+ // Add own implementation for TRSetBaseGeometry to handle TailPos over changes
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) override;
+
+ const Point& GetFixedTailPos() const {return maFixedTailPos;}
+
+ // geometry access
+ ::basegfx::B2DPolygon getTailPolygon() const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdocirc.hxx b/include/svx/svdocirc.hxx
new file mode 100644
index 000000000..5da739068
--- /dev/null
+++ b/include/svx/svdocirc.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdorect.hxx>
+#include <svx/svxdllapi.h>
+
+namespace sdr::properties {
+ class CircleProperties;
+}
+
+// Helper class SdrCircObjGeoData
+
+class SdrCircObjGeoData final : public SdrTextObjGeoData
+{
+public:
+ Degree100 nStartAngle;
+ Degree100 nEndAngle;
+};
+
+enum class SdrCircKind { Full, Section, Cut, Arc };
+
+extern SVXCORE_DLLPUBLIC SdrCircKind ToSdrCircKind(SdrObjKind);
+
+
+class SVXCORE_DLLPUBLIC SdrCircObj final : public SdrRectObj
+{
+private:
+ // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo()
+ friend class sdr::properties::CircleProperties;
+
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+
+ SdrCircKind meCircleKind;
+ Degree100 nStartAngle;
+ Degree100 nEndAngle;
+
+ SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrCircKind eKind, const tools::Rectangle& rRect1, Degree100 nStart, Degree100 nEnd) const;
+ SVX_DLLPRIVATE static void ImpSetCreateParams(SdrDragStat& rStat);
+ SVX_DLLPRIVATE void ImpSetAttrToCircInfo(); // copy values from pool
+ SVX_DLLPRIVATE void ImpSetCircInfoToAttr(); // copy values into pool
+
+ // returns sal_True if paint requires a XPolygon
+ SVX_DLLPRIVATE bool PaintNeedsXPolyCirc() const; // PaintNeedsXPoly-> PaintNeedsXPolyCirc
+ SVX_DLLPRIVATE virtual void RecalcXPoly() override;
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+
+private:
+ // protected destructor - due to final, make private
+ virtual ~SdrCircObj() override;
+
+public:
+ SdrCircObj(
+ SdrModel& rSdrModel,
+ SdrCircKind eNewKind);
+ SdrCircObj(
+ SdrModel& rSdrModel,
+ SdrCircKind eNewKind,
+ const tools::Rectangle& rRect);
+ // Copy constructor
+ SdrCircObj(SdrModel& rSdrModel, SdrCircObj const & rSource);
+
+ // 0=0.00Deg=3h 9000=90.00Deg=12h 18000=180.00Deg=9h 27000=270.00Deg=6h
+ // The circle is build up from StartAngle to EndWink anti-clockwise.
+ // If nNewStartAngle==nNewEndWink, then arc has an angle of 0 degrees.
+ // If nNewStartAngle+36000==nNewEndWink, then the arc has angle of 360 degrees.
+ SdrCircObj(
+ SdrModel& rSdrModel,
+ SdrCircKind eNewKind,
+ const tools::Rectangle& rRect,
+ Degree100 nNewStartAngle,
+ Degree100 nNewEndAngle);
+
+ SdrCircKind GetCircleKind() const { return meCircleKind; }
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ virtual SdrCircObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual void RecalcSnapRect() override;
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+
+ virtual sal_uInt32 GetSnapPointCount() const override;
+ virtual Point GetSnapPoint(sal_uInt32 i) const override;
+
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const override;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
+ virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
+
+ virtual bool BegCreate(SdrDragStat& rStat) override;
+ virtual bool MovCreate(SdrDragStat& rStat) override;
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+ virtual bool BckCreate(SdrDragStat& rStat) override;
+ virtual void BrkCreate(SdrDragStat& rStat) override;
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
+ virtual PointerStyle GetCreatePointer() const override;
+ virtual void NbcMove(const Size& aSiz) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
+ virtual void NbcShear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+private:
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+public:
+ Degree100 GetStartAngle() const { return nStartAngle; }
+ Degree100 GetEndAngle() const { return nEndAngle; }
+
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx
new file mode 100644
index 000000000..6e3acb339
--- /dev/null
+++ b/include/svx/svdoedge.hxx
@@ -0,0 +1,411 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <optional>
+#include <svx/svdotext.hxx>
+#include <svx/svdglue.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/xpoly.hxx>
+
+
+class SdrDragMethod;
+class SdrPageView;
+
+namespace sdr::properties {
+ class ConnectorProperties;
+}
+
+
+/// Utility class SdrObjConnection
+class SdrObjConnection final
+{
+ friend class SdrEdgeObj;
+ friend class ImpEdgeHdl;
+ friend class SdrCreateView;
+
+ Point aObjOfs; // set during dragging of a node
+ SdrObject* pObj; // referenced object
+ sal_uInt16 nConId; // connector number
+
+ bool bBestConn : 1; // true -> the best-matching connector is searched for
+ bool bBestVertex : 1; // true -> the best-matching vertex to connect is searched for
+ bool bAutoVertex : 1; // autoConnector at apex nCon
+ bool bAutoCorner : 1; // autoConnector at corner nCon
+
+public:
+ SdrObjConnection() { ResetVars(); }
+
+ void ResetVars();
+ bool TakeGluePoint(SdrGluePoint& rGP) const;
+
+ void SetBestConnection( bool rB ) { bBestConn = rB; };
+ void SetBestVertex( bool rB ) { bBestVertex = rB; };
+ void SetAutoVertex( bool rB ) { bAutoVertex = rB; };
+ void SetConnectorId( sal_uInt16 nId ) { nConId = nId; };
+
+ bool IsBestConnection() const { return bBestConn; };
+ bool IsAutoVertex() const { return bAutoVertex; };
+ sal_uInt16 GetConnectorId() const { return nConId; };
+ SdrObject* GetObject() const { return pObj; }
+};
+
+
+enum class SdrEdgeLineCode { Obj1Line2, Obj1Line3, Obj2Line2, Obj2Line3, MiddleLine };
+
+/// Utility class SdrEdgeInfoRec
+class SdrEdgeInfoRec
+{
+public:
+ // The 5 distances are set on dragging or via SetAttr and are
+ // evaluated by ImpCalcEdgeTrack. Only 0-3 longs are transported
+ // via Get/SetAttr/Get/SetStyleSh though.
+ Point aObj1Line2;
+ Point aObj1Line3;
+ Point aObj2Line2;
+ Point aObj2Line3;
+ Point aMiddleLine;
+
+ // Following values are set by ImpCalcEdgeTrack
+ tools::Long nAngle1; // exit angle at Obj1
+ tools::Long nAngle2; // exit angle at Obj2
+ sal_uInt16 nObj1Lines; // 1..3
+ sal_uInt16 nObj2Lines; // 1..3
+ sal_uInt16 nMiddleLine; // 0xFFFF=none, otherwise point number of the beginning of the line
+
+public:
+ SdrEdgeInfoRec()
+ : nAngle1(0),
+ nAngle2(0),
+ nObj1Lines(0),
+ nObj2Lines(0),
+ nMiddleLine(0xFFFF)
+ {}
+
+ Point& ImpGetLineOffsetPoint(SdrEdgeLineCode eLineCode);
+ sal_uInt16 ImpGetPolyIdx(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const;
+ bool ImpIsHorzLine(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const;
+ void ImpSetLineOffset(SdrEdgeLineCode eLineCode, const XPolygon& rXP, tools::Long nVal);
+ tools::Long ImpGetLineOffset(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const;
+};
+
+
+/// Utility class SdrEdgeObjGeoData
+class SdrEdgeObjGeoData final : public SdrTextObjGeoData
+{
+public:
+ SdrObjConnection aCon1; // connection status of the beginning of the line
+ SdrObjConnection aCon2; // connection status of the end of the line
+ std::optional<XPolygon> pEdgeTrack;
+ bool bEdgeTrackDirty; // true -> connector track needs to be recalculated
+ bool bEdgeTrackUserDefined;
+ SdrEdgeInfoRec aEdgeInfo;
+
+public:
+ SdrEdgeObjGeoData();
+ virtual ~SdrEdgeObjGeoData() override;
+};
+
+
+/// Utility class SdrEdgeObj
+class SVXCORE_DLLPUBLIC SdrEdgeObj final : public SdrTextObj
+{
+private:
+ // to allow sdr::properties::ConnectorProperties access to ImpSetAttrToEdgeInfo()
+ friend class sdr::properties::ConnectorProperties;
+
+ friend class SdrCreateView;
+ friend class ImpEdgeHdl;
+
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+
+ SdrObjConnection aCon1; // Connection status of the beginning of the line
+ SdrObjConnection aCon2; // Connection status of the end of the line
+
+ std::optional<XPolygon> pEdgeTrack;
+ sal_uInt16 nNotifyingCount; // Locking
+ SdrEdgeInfoRec aEdgeInfo;
+
+ bool bEdgeTrackDirty : 1; // true -> Connection track needs to be recalculated
+ bool bEdgeTrackUserDefined : 1;
+
+ // Bool to allow suppression of default connects at object
+ // inside test (HitTest) and object center test (see ImpFindConnector())
+ bool mbSuppressDefaultConnect : 1;
+
+ // Flag value for avoiding infinite loops when calculating
+ // BoundRects from ring-connected connectors. A coloring algorithm
+ // is used here. When the GetCurrentBoundRect() calculation of a
+ // SdrEdgeObj is running, the flag is set, else it is always
+ // false.
+ bool mbBoundRectCalculationRunning : 1;
+
+ // #i123048# need to remember if layouting was suppressed before to get
+ // to a correct state for first real layouting
+ bool mbSuppressed : 1;
+
+public:
+ // Interface to default connect suppression
+ void SetSuppressDefaultConnect(bool bNew) { mbSuppressDefaultConnect = bNew; }
+ bool GetSuppressDefaultConnect() const { return mbSuppressDefaultConnect; }
+
+private:
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+
+ static XPolygon ImpCalcObjToCenter(const Point& rStPt, tools::Long nEscAngle, const tools::Rectangle& rRect, const Point& rCenter);
+ void ImpRecalcEdgeTrack(); // recalculation of the connection track
+ XPolygon ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection& rCon1, SdrObjConnection& rCon2, SdrEdgeInfoRec* pInfo) const;
+ XPolygon ImpCalcEdgeTrack(const Point& rPt1, tools::Long nAngle1, const tools::Rectangle& rBoundRect1, const tools::Rectangle& rBewareRect1,
+ const Point& rPt2, tools::Long nAngle2, const tools::Rectangle& rBoundRect2, const tools::Rectangle& rBewareRect2,
+ sal_uIntPtr* pnQuality, SdrEdgeInfoRec* pInfo) const;
+ static bool ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrObjConnection& rCon, const SdrEdgeObj* pThis, OutputDevice* pOut=nullptr, SdrDragStat* pDragStat = nullptr);
+ static SdrEscapeDirection ImpCalcEscAngle(SdrObject const * pObj, const Point& aPt2);
+ void ImpSetTailPoint(bool bTail1, const Point& rPt);
+ void ImpUndirtyEdgeTrack(); // potential recalculation of the connection track
+ void ImpDirtyEdgeTrack(); // invalidate connector path, so it will be recalculated next time
+ void ImpSetAttrToEdgeInfo(); // copying values from the pool to aEdgeInfo
+ void ImpSetEdgeInfoToAttr(); // copying values from the aEdgeInfo to the pool
+
+ // protected destructor
+ virtual ~SdrEdgeObj() override;
+
+public:
+ SdrEdgeObj(SdrModel& rSdrModel);
+ // Copy constructor
+ SdrEdgeObj(SdrModel& rSdrModel, SdrEdgeObj const & rSource);
+
+ // react on model/page change
+ virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
+
+ SdrObjConnection& GetConnection(bool bTail1) { return *(bTail1 ? &aCon1 : &aCon2); }
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual const tools::Rectangle& GetCurrentBoundRect() const override;
+ virtual const tools::Rectangle& GetSnapRect() const override;
+ virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const override;
+ virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const override;
+ virtual const SdrGluePointList* GetGluePointList() const override;
+ virtual SdrGluePointList* ForceGluePointList() override;
+
+ // * for all of the below: bTail1=true: beginning of the line,
+ // otherwise end of the line
+ // * pObj=NULL: disconnect connector
+ void SetEdgeTrackDirty() { bEdgeTrackDirty=true; }
+ void ConnectToNode(bool bTail1, SdrObject* pObj) override;
+ void DisconnectFromNode(bool bTail1) override;
+ SdrObject* GetConnectedNode(bool bTail1) const override;
+ const SdrObjConnection& GetConnection(bool bTail1) const { return *(bTail1 ? &aCon1 : &aCon2); }
+ bool CheckNodeConnection(bool bTail1) const;
+
+ virtual void RecalcSnapRect() override;
+ virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
+ virtual SdrEdgeObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ void SetEdgeTrackPath( const basegfx::B2DPolyPolygon& rPoly );
+ basegfx::B2DPolyPolygon GetEdgeTrackPath() const;
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const override;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
+ virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
+
+ // FullDrag support
+ virtual SdrObjectUniquePtr getFullDragClone() const override;
+
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
+ virtual void NbcMove(const Size& aSize) override;
+ virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact) override;
+
+ // #i54102# added rotate, mirror and shear support
+ virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
+ virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
+
+ // #102344# Added missing implementation
+ virtual void NbcSetAnchorPos(const Point& rPnt) override;
+
+ virtual bool BegCreate(SdrDragStat& rStat) override;
+ virtual bool MovCreate(SdrDragStat& rStat) override;
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+ virtual bool BckCreate(SdrDragStat& rStat) override;
+ virtual void BrkCreate(SdrDragStat& rStat) override;
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
+ virtual PointerStyle GetCreatePointer() const override;
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ virtual sal_uInt32 GetSnapPointCount() const override;
+ virtual Point GetSnapPoint(sal_uInt32 i) const override;
+ virtual bool IsPolyObj() const override;
+ virtual sal_uInt32 GetPointCount() const override;
+ virtual Point GetPoint(sal_uInt32 i) const override;
+ virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i) override;
+
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+
+ /** updates edges that are connected to the edges of this object
+ as if the connected objects send a repaint broadcast
+ #103122#
+ */
+ void Reformat();
+
+ // helper methods for the StarOffice api
+ Point GetTailPoint( bool bTail ) const;
+ void SetTailPoint( bool bTail, const Point& rPt );
+ void setGluePointIndex( bool bTail, sal_Int32 nId = -1 );
+ sal_Int32 getGluePointIndex( bool bTail );
+
+ virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const override;
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) override;
+
+ // for geometry access
+ ::basegfx::B2DPolygon getEdgeTrack() const;
+
+ // helper method for SdrDragMethod::AddConnectorOverlays. Adds an overlay polygon for
+ // this connector to rResult.
+ basegfx::B2DPolygon ImplAddConnectorOverlay(const SdrDragMethod& rDragMethod, bool bTail1, bool bTail2, bool bDetail) const;
+};
+
+ // The following item parameters of the SdrItemPool are used to
+ // determine the actual connector line routing:
+ //
+ // sal_uInt16 EdgeFlowAngle default 9000 (= 90.00 deg), min 0, max 9000
+ // Clearance angle.
+ // The angle at which the connecting line may run.
+ //
+ // sal_uInt16 EdgeEscAngle default 9000 (= 90.00 Deg), min 0, max 9000
+ // Object exit angle.
+ // The angle at which the connection line may exit from the object.
+ //
+ // bool EdgeEscAsRay default false
+ // true -> the connecting line emerges from the object radially.
+ // Thus, angle specification by the line ObjCenter / connector.
+ //
+ // bool EdgeEscUseObjAngle default false
+ // Object rotation angle is considered
+ // true -> when determining the connector exit angle, angle for
+ // object rotation is taken as an offset.
+ //
+ // sal_uIntPtr EdgeFlowDefDist default 0, min 0, max ?
+ // This is the default minimum distance on calculation of the
+ // connection Line to the docked objects is in logical units.
+ // This distance is overridden within the object, as soon as the
+ // user drags on the lines. When docking onto a new object,
+ // however, this default is used again.
+ //
+ //
+ // General Information About Connectors:
+ //
+ // There are nodes and edge objects. Two nodes can be joined by an
+ // edge. If a connector is connected to a node only at one end, the
+ // other end is fixed to an absolute position in the document. It is
+ // of course also possible for a connector to be "free" at both ends,
+ // i.e. not connected to a node object on each side.
+ //
+ // A connector object can also theoretically be a node object at the
+ // same time. In the first version, however, this will not yet be
+ // realized.
+ //
+ // A connection between node and connector edge can be established by:
+ // - Interactive creation of a new edge object at the SdrView where
+ // the beginning or end point of the edge is placed on a connector
+ // (glueing point) of an already existing node object.
+ // - Interactive dragging of the beginning or end point of an
+ // existing connector edge object on the SdrView to a connector
+ // (glueing point) of an already existing node object.
+ // - Undo/Redo
+ // Moving node objects does not make any connections. Also not the
+ // direct shifting of edge endpoints on the SdrModel... Connections
+ // can also be established, if the connectors are not configured to
+ // be visible in the view.
+ //
+ // An existing connection between node and edge is retained for:
+ // - Dragging (Move/Resize/Rotate/...) of the node object
+ // - Moving a connector position in the node object
+ // - Simultaneous dragging (Move/Resize/Rotate/...) of the node and the
+ // edge
+ //
+ // A connection between node and edge can be removed by:
+ // - Deleting one of the objects
+ // - Dragging the edge object without simultaneously dragging the node
+ // - Deleting the connector at the node object
+ // - Undo/Redo/Repeat
+ // When dragging, the request to remove the connection must be
+ // requested from outside of the model (for example, from the
+ // SdrView). SdrEdgeObj::Move() itself does not remove the
+ // connection.
+ //
+ // Each node object can have connectors, so-called gluepoints. These
+ // are the geometric points at which the connecting edge object ends
+ // when the connection is established. By default, each object has no
+ // connectors. Nevertheless, one can dock an edge in certain view
+ // settings since then, e.g., connectors can be automatically
+ // generated at the 4 vertices of the node object when needed. Each
+ // object provides 2x4 so-called default connector positions, 4 at
+ // the vertices and 4 at the corner positions. In the normal case,
+ // these are located at the 8 handle positions; exceptions here are
+ // ellipses, parallelograms, ... . In addition, user-specific
+ // connectors can be set for each node object.
+ //
+ // Then there is also the possibility to dock an edge on an object
+ // with the attribute "bUseBestConnector". The best-matching
+ // connector position for the routing of the connection line is then
+ // used from the offering of connectors of the object or/and of the
+ // vertices. The user assigns this attribute by docking the node in
+ // its center (see, e.g., Visio).
+ // 09-06-1996: bUseBestConnector uses vertex gluepoints only.
+ //
+ // And here is some terminology:
+ // Connector : The connector object (edge object)
+ // Node : Any object to which a connector can be glued to, e.g., a rectangle,
+ // etc.
+ // Gluepoint: The point at which the connector is glued to the node object.
+ // There are:
+ // Vertex gluepoints: Each node object presents these glue
+ // points inherently. Perhaps there is already the option
+ // "automatically glue to object vertex" in Draw (default is
+ // on).
+ // Corner gluepoints: These gluepoints, too, are already
+ // auto-enabled on objects. Similar to the ones above,
+ // there may already be an option for them in Draw (default is
+ // off).
+ // In contrast to Visio, vertex gluepoints and corner glue
+ // points are not displayed in the UI; they are simply there (if
+ // the option is activated).
+ // Custom gluepoints: Any number of them are present on each
+ // node object. They can be made visible using the option
+ // (always visible when editing). At the moment, however, they
+ // are not yet fully implemented.
+ // Automatic gluepoint selection: If the connector is docked
+ // to the node object so that the black frame encompasses the
+ // entire object, then the connector tries to find the most
+ // convenient of the 4 vertex gluepoints (and only of those).
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
new file mode 100644
index 000000000..7c6f98650
--- /dev/null
+++ b/include/svx/svdograf.hxx
@@ -0,0 +1,301 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/drawing/BarCode.hpp>
+#include <vcl/graph.hxx>
+#include <svx/svdorect.hxx>
+#include <vcl/GraphicObject.hxx>
+#include <svx/svxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <memory>
+
+namespace sdr::properties { class GraphicProperties; }
+namespace sdr::contact { class ViewObjectContactOfGraphic; }
+
+/**
+ * Options for GetTransformedGraphic()
+ */
+enum class SdrGrafObjTransformsAttrs
+{
+ NONE = 0x00,
+ MIRROR = 0x01,
+ ROTATE = 0x02,
+ ALL = 0x03,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SdrGrafObjTransformsAttrs> : is_typed_flags<SdrGrafObjTransformsAttrs, 0x03> {};
+}
+
+class SdrGrafObjGeoData final : public SdrTextObjGeoData
+{
+public:
+ bool bMirrored;
+
+ SdrGrafObjGeoData()
+ : bMirrored(false)
+ {
+ }
+};
+
+class GraphicObject;
+class SdrGraphicLink;
+
+/**
+ * This class represents an embedded or linked bitmap graphic object.
+ */
+class SVXCORE_DLLPUBLIC SdrGrafObj final : public SdrRectObj
+{
+private:
+ // to allow sdr::properties::GraphicProperties access to SetXPolyDirty()
+ friend class sdr::properties::GraphicProperties;
+
+ // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink()
+ friend class sdr::contact::ViewObjectContactOfGraphic;
+ friend class SdrExchangeView; // Only for a ForceSwapIn() call.
+ friend class SdrGraphicLink;
+
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+
+ void ImpSetAttrToGrafInfo(); // Copy values from the pool
+ GraphicAttr aGrafInfo;
+
+ OUString aFileName; // If it's a Link, the filename can be found in here
+ OUString aFilterName;
+ std::unique_ptr<GraphicObject> mpGraphicObject; // In order to speed up output of bitmaps, especially rotated ones
+ std::unique_ptr<GraphicObject> mpReplacementGraphicObject;
+ SdrGraphicLink* pGraphicLink; // And here a pointer for linked graphics
+ bool bMirrored:1; // True: the graphic is horizontal, which means it's mirrored along the y-axis
+
+ // Flag for allowing text animation. Default is true.
+ bool mbGrafAnimationAllowed:1;
+
+ bool mbIsSignatureLine;
+ OUString maSignatureLineId;
+ OUString maSignatureLineSuggestedSignerName;
+ OUString maSignatureLineSuggestedSignerTitle;
+ OUString maSignatureLineSuggestedSignerEmail;
+ OUString maSignatureLineSigningInstructions;
+ bool mbIsSignatureLineShowSignDate;
+ bool mbIsSignatureLineCanAddComment;
+ bool mbSignatureLineIsSigned;
+ css::uno::Reference<css::graphic::XGraphic> mpSignatureLineUnsignedGraphic;
+
+ std::unique_ptr<css::drawing::BarCode> mpBarCode;
+ void ImpRegisterLink();
+ void ImpDeregisterLink();
+ void ImpSetLinkedGraphic( const Graphic& rGraphic );
+ void onGraphicChanged();
+ GDIMetaFile GetMetaFile(GraphicType &rGraphicType) const;
+
+ // protected destructor
+ virtual ~SdrGrafObj() override;
+
+public:
+ SdrGrafObj(SdrModel& rSdrModel);
+ // Copy constructor
+ SdrGrafObj(SdrModel& rSdrModel, SdrGrafObj const & rSource);
+ SdrGrafObj(
+ SdrModel& rSdrModel,
+ const Graphic& rGrf);
+ SdrGrafObj(
+ SdrModel& rSdrModel,
+ const Graphic& rGrf,
+ const tools::Rectangle& rRect);
+
+ void SetGraphicObject( const GraphicObject& rGrfObj );
+ const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const;
+ const GraphicObject* GetReplacementGraphicObject() const;
+
+ void NbcSetGraphic(const Graphic& rGrf);
+ void SetGraphic(const Graphic& rGrf);
+ const Graphic& GetGraphic() const;
+
+ Graphic GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
+
+ GraphicType GetGraphicType() const;
+
+ GraphicAttr GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
+
+ // Keep ATM for SD.
+ bool IsAnimated() const;
+ bool IsEPS() const;
+
+ MapMode GetGrafPrefMapMode() const;
+ Size GetGrafPrefSize() const;
+
+ void SetGrafStreamURL( const OUString& rGraphicStreamURL );
+ OUString const & GetGrafStreamURL() const;
+ Size getOriginalSize() const;
+
+private:
+ void ForceSwapIn() const;
+
+public:
+ void SetGraphicLink(const OUString& rFileName);
+ void ReleaseGraphicLink();
+ bool IsLinkedGraphic() const;
+
+ const OUString& GetFileName() const { return aFileName;}
+
+ void StartAnimation();
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ virtual SdrGrafObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+
+ bool HasGDIMetaFile() const;
+
+ // react on model/page change
+ virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
+
+ bool isEmbeddedVectorGraphicData() const;
+ GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const;
+
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override;
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+
+ bool IsMirrored() const { return bMirrored;}
+ void SetMirrored( bool _bMirrored );
+
+ virtual bool shouldKeepAspectRatio() const override { return true; }
+
+ // Access to GrafAnimationAllowed flag
+ void SetGrafAnimationAllowed(bool bNew);
+
+ css::uno::Reference< css::io::XInputStream > getInputStream() const;
+
+ // #i103116# FullDrag support
+ virtual SdrObjectUniquePtr getFullDragClone() const override;
+
+ // add handles for crop mode when selected
+ virtual void addCropHandles(SdrHdlList& rTarget) const override;
+
+ // Signature Line
+ void setIsSignatureLine(bool bIsSignatureLine) { mbIsSignatureLine = bIsSignatureLine; }
+ bool isSignatureLine() const { return mbIsSignatureLine; }
+
+ void setSignatureLineId(const OUString& rSignatureLineId)
+ {
+ maSignatureLineId = rSignatureLineId;
+ }
+
+ const OUString& getSignatureLineId() const { return maSignatureLineId; }
+
+ void setSignatureLineSuggestedSignerName(const OUString& rSuggestedSignerName)
+ {
+ maSignatureLineSuggestedSignerName = rSuggestedSignerName;
+ }
+
+ const OUString& getSignatureLineSuggestedSignerName() const
+ {
+ return maSignatureLineSuggestedSignerName;
+ }
+
+ void setSignatureLineSuggestedSignerTitle(const OUString& rSuggestedSignerTitle)
+ {
+ maSignatureLineSuggestedSignerTitle = rSuggestedSignerTitle;
+ }
+
+ const OUString& getSignatureLineSuggestedSignerTitle() const
+ {
+ return maSignatureLineSuggestedSignerTitle;
+ }
+
+ void setSignatureLineSuggestedSignerEmail(const OUString& rSuggestedSignerEmail)
+ {
+ maSignatureLineSuggestedSignerEmail = rSuggestedSignerEmail;
+ }
+ const OUString& getSignatureLineSuggestedSignerEmail() const
+ {
+ return maSignatureLineSuggestedSignerEmail;
+ }
+
+ void setSignatureLineSigningInstructions(const OUString& rSigningInstructions)
+ {
+ maSignatureLineSigningInstructions = rSigningInstructions;
+ }
+
+ const OUString& getSignatureLineSigningInstructions() const
+ {
+ return maSignatureLineSigningInstructions;
+ }
+
+ void setSignatureLineShowSignDate(bool bIsSignatureLineShowSignDate)
+ {
+ mbIsSignatureLineShowSignDate = bIsSignatureLineShowSignDate;
+ }
+
+ bool isSignatureLineShowSignDate() const { return mbIsSignatureLineShowSignDate; }
+
+ void setSignatureLineCanAddComment(bool bIsSignatureCanAddComment)
+ {
+ mbIsSignatureLineCanAddComment = bIsSignatureCanAddComment;
+ }
+
+ bool isSignatureLineCanAddComment() const { return mbIsSignatureLineCanAddComment; }
+
+ css::uno::Reference<css::graphic::XGraphic> const & getSignatureLineUnsignedGraphic() const
+ {
+ return mpSignatureLineUnsignedGraphic;
+ }
+
+ void setSignatureLineUnsignedGraphic(css::uno::Reference<css::graphic::XGraphic> rGraphic)
+ {
+ mpSignatureLineUnsignedGraphic = rGraphic;
+ }
+
+ bool isSignatureLineSigned() const { return mbSignatureLineIsSigned; }
+
+ void setSignatureLineIsSigned(bool bIsSigned) { mbSignatureLineIsSigned = bIsSigned; }
+
+ // Qr Code
+ void setQrCode(css::drawing::BarCode& rBarCode)
+ {
+ mpBarCode = std::make_unique<css::drawing::BarCode>(rBarCode);
+ }
+
+ css::drawing::BarCode* getQrCode() const
+ {
+ return mpBarCode.get();
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx
new file mode 100644
index 000000000..4322d56df
--- /dev/null
+++ b/include/svx/svdogrp.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <svx/svdobj.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/svdpage.hxx>
+
+// SdrObjGroup
+class SVXCORE_DLLPUBLIC SdrObjGroup final : public SdrObject, public SdrObjList
+{
+public:
+ // Basic DiagramHelper support
+ virtual const std::shared_ptr< svx::diagram::IDiagramHelper >& getDiagramHelper() const override;
+
+private:
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+ virtual std::unique_ptr<sdr::properties::BaseProperties>
+ CreateObjectSpecificProperties() override;
+
+ Point maRefPoint; // Reference point inside the object group
+
+ // Allow *only* DiagramHelper itself to set this internal reference to
+ // tightly control usage
+ friend class svx::diagram::IDiagramHelper;
+ std::shared_ptr< svx::diagram::IDiagramHelper > mp_DiagramHelper;
+
+ // protected destructor - due to final, make private
+ virtual ~SdrObjGroup() override;
+
+public:
+ SdrObjGroup(SdrModel& rSdrModel);
+ // Copy constructor
+ SdrObjGroup(SdrModel& rSdrModel, SdrObjGroup const& rSource);
+
+ // derived from SdrObjList
+ virtual SdrPage* getSdrPageFromSdrObjList() const override;
+ virtual SdrObject* getSdrObjectFromSdrObjList() const override;
+
+ // derived from SdrObject
+ virtual SdrObjList* getChildrenOfSdrObject() const override;
+
+ virtual void SetBoundRectDirty() override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrLayerID GetLayer() const override;
+ virtual void NbcSetLayer(SdrLayerID nLayer) override;
+
+ // react on model/page change
+ virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
+
+ virtual SdrObjList* GetSubList() const override;
+ virtual void SetGrabBagItem(const css::uno::Any& rVal) override;
+
+ virtual const tools::Rectangle& GetCurrentBoundRect() const override;
+ virtual const tools::Rectangle& GetSnapRect() const override;
+
+ virtual SdrObjGroup* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ virtual void RecalcSnapRect() override;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+
+ // special drag methods
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
+
+ virtual bool BegCreate(SdrDragStat& rStat) override;
+
+ virtual Degree100 GetRotateAngle() const override;
+ virtual Degree100 GetShearAngle(bool bVertical = false) const override;
+
+ virtual void Move(const Size& rSiz) override;
+ virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact,
+ bool bUnsetRelative = true) override;
+ virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
+ virtual void Mirror(const Point& rRef1, const Point& rRef2) override;
+ virtual void Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
+ virtual void SetAnchorPos(const Point& rPnt) override;
+ virtual void SetRelativePos(const Point& rPnt) override;
+ virtual void SetSnapRect(const tools::Rectangle& rRect) override;
+ virtual void SetLogicRect(const tools::Rectangle& rRect) override;
+
+ virtual void NbcMove(const Size& rSiz) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact,
+ const Fraction& yFact) override;
+ virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
+ virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
+ virtual void NbcSetAnchorPos(const Point& rPnt) override;
+ virtual void NbcSetRelativePos(const Point& rPnt) override;
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
+ virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
+
+ virtual void NbcReformatText() override;
+
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx
new file mode 100644
index 000000000..cd00b7d26
--- /dev/null
+++ b/include/svx/svdomeas.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdotext.hxx>
+#include <svx/svxdllapi.h>
+#include <editeng/measfld.hxx>
+
+class SdrOutliner;
+struct ImpMeasureRec;
+struct ImpMeasurePoly;
+
+namespace sdr::properties {
+ class MeasureProperties;
+}
+
+class SdrMeasureObjGeoData final : public SdrTextObjGeoData
+{
+public:
+ Point aPt1;
+ Point aPt2;
+
+public:
+ SdrMeasureObjGeoData();
+ virtual ~SdrMeasureObjGeoData() override;
+};
+
+class SVXCORE_DLLPUBLIC SdrMeasureObj final : public SdrTextObj
+{
+private:
+ // to allow sdr::properties::MeasureProperties access to SetTextDirty()
+ friend class sdr::properties::MeasureProperties;
+ friend class SdrMeasureField;
+
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+
+ Point aPt1;
+ Point aPt2;
+ bool bTextDirty;
+
+ void ImpTakeAttr(ImpMeasureRec& rRec) const;
+ OUString TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind) const;
+ void ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly& rPol) const;
+ static basegfx::B2DPolyPolygon ImpCalcXPoly(const ImpMeasurePoly& rPol);
+ void ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) const;
+ void SetTextDirty()
+ {
+ bTextDirty=true;
+ SetTextSizeDirty();
+ if (!m_aOutRect.IsEmpty())
+ {
+ SetBoundRectDirty();
+ SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
+ }
+ }
+ void UndirtyText() const;
+
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+
+ // protected destructor
+ virtual ~SdrMeasureObj() override;
+
+public:
+ SdrMeasureObj(SdrModel& rSdrModel);
+ // Copy constructor
+ SdrMeasureObj(SdrModel& rSdrModel, SdrMeasureObj const & rSource);
+ SdrMeasureObj(
+ SdrModel& rSdrModel,
+ const Point& rPt1,
+ const Point& rPt2);
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
+ virtual SdrMeasureObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const override;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
+ virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
+
+ virtual bool BegCreate(SdrDragStat& rStat) override;
+ virtual bool MovCreate(SdrDragStat& rStat) override;
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+ virtual bool BckCreate(SdrDragStat& rStat) override;
+ virtual void BrkCreate(SdrDragStat& rStat) override;
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
+ virtual PointerStyle GetCreatePointer() const override;
+
+ virtual void NbcMove(const Size& rSiz) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+ virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
+ virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
+ virtual Degree100 GetRotateAngle() const override;
+ virtual void RecalcSnapRect() override;
+
+ virtual sal_uInt32 GetSnapPointCount() const override;
+ virtual Point GetSnapPoint(sal_uInt32 i) const override;
+
+ virtual bool IsPolyObj() const override;
+ virtual sal_uInt32 GetPointCount() const override;
+ virtual Point GetPoint(sal_uInt32 i) const override;
+ virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i) override;
+
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ virtual bool BegTextEdit(SdrOutliner& rOutl) override;
+ virtual const Size& GetTextSize() const override;
+ virtual void TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText,
+ tools::Rectangle* pAnchorRect, bool bLineWidth = true ) const override;
+ virtual void TakeTextAnchorRect(tools::Rectangle& rAnchorRect) const override;
+ virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const override;
+ virtual EEAnchorMode GetOutlinerViewAnchorMode() const override;
+ virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject) override;
+ virtual OutlinerParaObject* GetOutlinerParaObject() const override;
+
+ virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos,
+ bool bEdit, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, OUString& rRet) const override;
+
+ // #i97878#
+ virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const override;
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) override;
+};
+
+// Creating:
+// ~~~~~~~~~
+// dragging reference point 1 to reference point 2 -> reference edge
+//
+// Defaults:
+// ~~~~~~~~~~~~~
+// dimension line and auxiliary dimension lines: solid black hairlines
+// arrows : 2mm x 4mm
+// text size
+// ___
+// | dimension | 2mm
+// |<--------------------->|---
+// | | 8mm
+// | |
+// Pt1============# Pt2-- <----reference edge (from Pt1 to Pt2)
+// # # |___ <-excess length of the auxiliary dimension line(s)
+// # #=========#
+// # objected to be dimensioned #
+// #=======================#
+//
+// Attributes:
+// ~~~~~~~~~~
+// 1. Where is the text: middle, right or left (default=automatic)
+// 2. Text above or below the line or line broken by text (default=automatic)
+// Default=8mm
+// 3. The distance from the dimension line to the reference edge (= to the dimensioned object)
+// 4. dimension line below the reference edge (default=no))
+// 5. excess length of the auxiliary dimension lines beyond the reference edge (2x, default=0)
+// 6. excess length of the auxiliary dimension lines past the dimension line (default=2mm)
+// 7. distance between the auxiliary dimension line and the reference edge
+//
+// Dragging: Handle Shift
+// ~~~~~~~~~
+// - reference points SolidQuadHdl only the length
+// 1.+2. Seizing the text
+// 3.+4. Hdl on arrow (2x) SolidQuadHdl only the Bool
+// 5. Hdl one end point CircHdl both lengths ?
+// 6.+7. no dragging
+//
+// Open:
+// ~~~~~~
+// - radiuses (anchor as type immediately)
+//
+// Special:
+// ~~~~~~~~
+// Connecting to a maximum of two objects
+// -> during Copy, etc. use the respective code of the connectors?!?
+// this probably will be pretty complicated ...
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdomedia.hxx b/include/svx/svdomedia.hxx
new file mode 100644
index 000000000..d80ec5a57
--- /dev/null
+++ b/include/svx/svdomedia.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <svx/svdorect.hxx>
+#include <avmedia/mediaitem.hxx>
+#include <svx/svxdllapi.h>
+
+class Graphic;
+
+namespace sdr::contact { class ViewContactOfSdrMediaObj; }
+namespace com::sun::star::graphic { class XGraphic; }
+
+
+class SVXCORE_DLLPUBLIC SdrMediaObj final : public SdrRectObj
+{
+ friend class sdr::contact::ViewContactOfSdrMediaObj;
+
+private:
+ // protected destructor - due to final, make private
+ virtual ~SdrMediaObj() override;
+
+public:
+ SdrMediaObj(SdrModel& rSdrModel);
+ // Copy constructor
+ SdrMediaObj(SdrModel& rSdrModel, SdrMediaObj const & rSource);
+ SdrMediaObj(
+ SdrModel& rSdrModel,
+ const tools::Rectangle& rRect);
+
+ virtual bool HasTextEdit() const override;
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ virtual SdrMediaObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override;
+
+ void setURL( const OUString& rURL, const OUString& rReferer, const OUString& rMimeType = OUString() );
+ const OUString& getURL() const;
+
+ void setMediaProperties( const ::avmedia::MediaItem& rState );
+ const ::avmedia::MediaItem& getMediaProperties() const;
+
+ css::uno::Reference< css::graphic::XGraphic > const &
+ getSnapshot() const;
+ css::uno::Reference< css::io::XInputStream>
+ GetInputStream() const;
+ void SetInputStream(css::uno::Reference<css::io::XInputStream> const&);
+
+ virtual bool shouldKeepAspectRatio() const override { return true; }
+
+private:
+ void mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState );
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+
+ struct Impl;
+ std::unique_ptr<Impl> m_xImpl;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
new file mode 100644
index 000000000..522bead95
--- /dev/null
+++ b/include/svx/svdoole2.hxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <svx/svdorect.hxx>
+#include <svx/svxdllapi.h>
+#include <sfx2/lnkbase.hxx>
+
+#include <com/sun/star/uno/Reference.h>
+
+namespace com::sun::star {
+
+namespace awt { class XWindow; }
+
+namespace datatransfer { class XTransferable; }
+
+namespace embed { class XEmbeddedObject; }
+
+namespace frame { class XModel; }
+
+namespace io { class XInputStream; }
+}
+
+namespace svt { class EmbeddedObjectRef; }
+
+class SdrOle2ObjImpl;
+class SvxOle2Shape;
+
+class SVXCORE_DLLPUBLIC SdrOle2Obj : public SdrRectObj
+{
+private:
+ std::unique_ptr<SdrOle2ObjImpl> mpImpl;
+
+private:
+ SVX_DLLPRIVATE void Connect_Impl(SvxOle2Shape* pCreator = nullptr);
+ SVX_DLLPRIVATE void Disconnect_Impl();
+ SVX_DLLPRIVATE void AddListeners_Impl();
+ SVX_DLLPRIVATE void RemoveListeners_Impl();
+ SVX_DLLPRIVATE void GetObjRef_Impl();
+
+ // #i118485# helper added
+ SVX_DLLPRIVATE SdrObjectUniquePtr createSdrGrafObjReplacement(bool bAddText) const;
+ SVX_DLLPRIVATE void ImpSetVisAreaSize();
+
+ SVX_DLLPRIVATE void Init();
+
+protected:
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+
+ // protected destructor
+ virtual ~SdrOle2Obj() override;
+
+public:
+ OUString GetStyleString();
+
+ SdrOle2Obj(
+ SdrModel& rSdrModel,
+ bool bFrame_ = false);
+ // Copy constructor
+ SdrOle2Obj(SdrModel& rSdrModel, SdrOle2Obj const & rSource);
+ SdrOle2Obj(
+ SdrModel& rSdrModel,
+ const svt::EmbeddedObjectRef& rNewObjRef,
+ const OUString& rNewObjName,
+ const tools::Rectangle& rNewRect);
+
+ const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const;
+
+ sal_Int64 GetAspect() const;
+ bool isInplaceActive() const;
+ bool isUiActive() const;
+ void SetAspect( sal_Int64 nAspect );
+
+ // An OLE graphic object can contain a StarView graphic,
+ // which will be displayed if the OLE object is empty.
+ void SetGraphic(const Graphic& rGrf);
+ void ClearGraphic();
+ const Graphic* GetGraphic() const;
+ void GetNewReplacement();
+
+ // The original size of the object (size of the icon for iconified object)
+ // no conversion is done if no target mode is provided
+ Size GetOrigObjSize( MapMode const * pTargetMapMode = nullptr ) const;
+
+ // #i118524# Allow suppress SetVisAreaSize in changing methods when call
+ // comes from OLE client
+ void setSuppressSetVisAreaSize( bool bNew );
+
+ // OLE object has got a separate PersistName member now;
+ // !!! use ::SetPersistName( ... ) only, if you know what you do !!!
+ const OUString& GetPersistName() const;
+ void SetPersistName( const OUString& rPersistName, SvxOle2Shape* pCreator = nullptr );
+
+ // One can add an application name to a SdrOle2Obj, which can be queried for
+ // later on (SD needs this for presentation objects).
+ void SetProgName( const OUString& rName );
+ const OUString& GetProgName() const;
+ bool IsEmpty() const;
+
+ void SetObjRef(const css::uno::Reference < css::embed::XEmbeddedObject >& rNewObjRef);
+ css::uno::Reference < css::embed::XEmbeddedObject > const & GetObjRef() const;
+
+ SVX_DLLPRIVATE css::uno::Reference < css::embed::XEmbeddedObject > const & GetObjRef_NoInit() const;
+
+ void AbandonObject();
+
+ // react on model/page change
+ virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
+
+ /** Change the IsClosedObj attribute
+
+ @param bIsClosed
+ Whether the OLE object is closed, i.e. has opaque background
+ */
+ void SetClosedObj( bool bIsClosed );
+
+ // FullDrag support
+ virtual SdrObjectUniquePtr getFullDragClone() const override;
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ virtual SdrOle2Obj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual void NbcMove(const Size& rSize) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
+ virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
+ virtual void SetGeoData(const SdrObjGeoData& rGeo) override;
+
+ static bool CanUnloadRunningObj( const css::uno::Reference< css::embed::XEmbeddedObject >& xObj,
+ sal_Int64 nAspect );
+ static bool Unload( const css::uno::Reference< css::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
+ bool Unload();
+ void Connect(SvxOle2Shape* pCreator = nullptr);
+ void Disconnect();
+ void ObjectLoaded();
+
+ css::uno::Reference< css::frame::XModel > getXModel() const;
+
+ bool IsChart() const;
+ bool IsCalc() const;
+
+ bool UpdateLinkURL_Impl();
+ void BreakFileLink_Impl();
+ void DisconnectFileLink_Impl();
+ void CheckFileLink_Impl();
+
+ // allows to transfer the graphics to the object helper
+ void SetGraphicToObj( const Graphic& aGraphic );
+ void SetGraphicToObj( const css::uno::Reference< css::io::XInputStream >& xGrStream,
+ const OUString& aMediaType );
+
+ css::uno::Reference< css::frame::XModel > GetParentXModel() const;
+ bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize );
+ bool AddOwnLightClient();
+
+ // handy to get the empty replacement graphic without accessing all the old stuff
+ static Graphic GetEmptyOLEReplacementGraphic();
+
+ void SetWindow(const css::uno::Reference < css::awt::XWindow >& _xWindow);
+
+ // #i118485# missing converter added
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+};
+
+class SVXCORE_DLLPUBLIC SdrEmbedObjectLink final : public sfx2::SvBaseLink
+{
+ SdrOle2Obj* pObj;
+
+public:
+ explicit SdrEmbedObjectLink(SdrOle2Obj* pObj);
+ virtual ~SdrEmbedObjectLink() override;
+
+ virtual void Closed() override;
+ virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
+ const OUString& rMimeType, const css::uno::Any & rValue ) override;
+
+ void Connect() { GetRealObject(); }
+};
+
+class SVXCORE_DLLPUBLIC SdrIFrameLink final : public sfx2::SvBaseLink
+{
+ SdrOle2Obj* m_pObject;
+
+public:
+ explicit SdrIFrameLink(SdrOle2Obj* pObject);
+ virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
+ const OUString& rMimeType, const css::uno::Any & rValue ) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdopage.hxx b/include/svx/svdopage.hxx
new file mode 100644
index 000000000..3f521ca7a
--- /dev/null
+++ b/include/svx/svdopage.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdobj.hxx>
+#include <svx/sdrpageuser.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC SdrPageObj final : public SdrObject, public sdr::PageUser
+{
+public:
+ // this method is called from the destructor of the referenced page.
+ // do all necessary action to forget the page. It is not necessary to call
+ // RemovePageUser(), that is done from the destructor.
+ virtual void PageInDestruction(const SdrPage& rPage) override;
+
+private:
+ // To make things more safe, remember the page, not a number
+ SdrPage* mpShownPage;
+
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+
+ // protected destructor
+ virtual ~SdrPageObj() override;
+
+public:
+ SdrPageObj(
+ SdrModel& rSdrModel,
+ SdrPage* pNewPage = nullptr);
+ // Copy constructor
+ SdrPageObj(SdrModel& rSdrModel, SdrPageObj const & rSource);
+ SdrPageObj(
+ SdrModel& rSdrModel,
+ const tools::Rectangle& rRect,
+ SdrPage* pNewPage = nullptr);
+
+ SdrPage* GetReferencedPage() const { return mpShownPage;}
+ void SetReferencedPage(SdrPage* pNewPage);
+
+ // #i96598#
+ virtual void SetBoundRectDirty() override;
+
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrPageObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdopath.hxx b/include/svx/svdopath.hxx
new file mode 100644
index 000000000..dd854468b
--- /dev/null
+++ b/include/svx/svdopath.hxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdotext.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+class ImpPathForDragAndCreate;
+
+// Helper class SdrPathObjGeoData
+// used for undo/redo
+
+class SdrPathObjGeoData final : public SdrTextObjGeoData
+{
+public:
+ basegfx::B2DPolyPolygon maPathPolygon;
+ SdrObjKind meKind;
+
+ SdrPathObjGeoData();
+ virtual ~SdrPathObjGeoData() override;
+};
+
+
+class SVXCORE_DLLPUBLIC SdrPathObj final : public SdrTextObj
+{
+private:
+ friend class ImpPathForDragAndCreate;
+
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+
+ basegfx::B2DPolyPolygon maPathPolygon;
+ SdrObjKind meKind;
+ bool mbHandleScale = false;
+
+ // for isolation of old Drag/Create code
+ std::unique_ptr<ImpPathForDragAndCreate> mpDAC;
+
+ // helper functions for GET, SET, INS etc. PNT
+ void ImpSetClosed(bool bClose);
+ void ImpForceKind();
+ void ImpForceLineAngle();
+ ImpPathForDragAndCreate& impGetDAC() const;
+
+private:
+ // protected destructor - due to final, make private
+ virtual ~SdrPathObj() override;
+
+public:
+ SdrPathObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewKind);
+ // Copy constructor
+ SdrPathObj(SdrModel& rSdrModel, SdrPathObj const & rSource);
+ SdrPathObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewKind,
+ const basegfx::B2DPolyPolygon& rPathPoly);
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
+ virtual SdrPathObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+ virtual void RecalcSnapRect() override;
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+ virtual void AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const override;
+ virtual const tools::Rectangle& GetLogicRect() const override;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const override;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
+ virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
+ virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const override;
+
+ virtual bool BegCreate(SdrDragStat& rStat) override;
+ virtual bool MovCreate(SdrDragStat& rStat) override;
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+ virtual bool BckCreate(SdrDragStat& rStat) override;
+ virtual void BrkCreate(SdrDragStat& rStat) override;
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
+ PointerStyle GetCreatePointer() const override;
+
+ // during drag or create, allow accessing the so-far created/modified polyPolygon
+ basegfx::B2DPolyPolygon getObjectPolyPolygon(const SdrDragStat& rDrag) const;
+ basegfx::B2DPolyPolygon getDragPolyPolygon(const SdrDragStat& rDrag) const;
+
+ virtual void NbcMove(const Size& aSize) override;
+ virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact) override;
+ virtual void NbcRotate(const Point& rRefPnt, Degree100 nAngle, double fSin, double fCos) override;
+ virtual void NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2) override;
+ virtual void NbcShear(const Point& rRefPnt, Degree100 nAngle, double fTan, bool bVShear) override;
+
+ virtual sal_uInt32 GetSnapPointCount() const override;
+ virtual Point GetSnapPoint(sal_uInt32 i) const override;
+
+ virtual bool IsPolyObj() const override;
+ virtual sal_uInt32 GetPointCount() const override;
+ virtual Point GetPoint(sal_uInt32 nHdlNum) const override;
+ virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 nHdlNum) override;
+
+ // insert point
+ sal_uInt32 NbcInsPointOld(const Point& rPos, bool bNewObj);
+ sal_uInt32 NbcInsPoint(const Point& rPos, bool bNewObj);
+
+ // rip at given point
+ SdrObject* RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index);
+
+private:
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+
+public:
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ // Bezier-polygon getter/setter
+ const basegfx::B2DPolyPolygon& GetPathPoly() const { return maPathPolygon; }
+ void SetPathPoly(const basegfx::B2DPolyPolygon& rPathPoly);
+ void NbcSetPathPoly(const basegfx::B2DPolyPolygon& rPathPoly);
+
+ // special functions for Bezier-polygon handling
+ bool IsClosed() const { return meKind==SdrObjKind::Polygon || meKind==SdrObjKind::PathPoly || meKind==SdrObjKind::PathFill || meKind==SdrObjKind::FreehandFill || meKind==SdrObjKind::SplineFill; }
+ bool IsLine() const { return meKind==SdrObjKind::PolyLine || meKind==SdrObjKind::PathPolyLine || meKind==SdrObjKind::PathLine || meKind==SdrObjKind::FreehandLine || meKind==SdrObjKind::SplineLine || meKind==SdrObjKind::Line; }
+ bool IsBezier() const { return meKind==SdrObjKind::PathLine || meKind==SdrObjKind::PathFill; }
+ bool IsSpline() const { return meKind==SdrObjKind::SplineLine || meKind==SdrObjKind::SplineFill; }
+
+ // close/open path
+ // if opening, move end point by "nOpenDistance"
+ void ToggleClosed(); // long nOpenDistance);
+
+ // transformation interface for StarOfficeAPI. This implements support for
+ // homogen 3x3 matrices containing the transformation of the SdrObject. At the
+ // moment it contains a shearX, rotation and translation, but for setting all linear
+ // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
+ //
+ // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
+ // with the base geometry and returns TRUE. Otherwise it returns FALSE.
+ virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const override;
+ // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+ // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
+ // to use (0,0) as upper left and will be scaled to the given size in the matrix.
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) override;
+
+ /**
+ * Scaling is ignored from the transform matrix by default, to not break compatibility. One can
+ * opt in to handle scaling if matching ODF behavior is more important.
+ */
+ void SetHandleScale(bool bHandleScale);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdorect.hxx b/include/svx/svdorect.hxx
new file mode 100644
index 000000000..ac7879cb5
--- /dev/null
+++ b/include/svx/svdorect.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <optional>
+#include <svx/svdotext.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svxdllapi.h>
+
+
+// Forward declaration
+namespace sdr::properties {
+ class RectangleProperties;
+}
+
+
+// SdrRectObj
+
+/// Rectangle objects (rectangle, circle, ...)
+class SVXCORE_DLLPUBLIC SdrRectObj : public SdrTextObj
+{
+private:
+ // to allow sdr::properties::RectangleProperties access to SetXPolyDirty()
+ friend class sdr::properties::RectangleProperties;
+ friend class SdrTextObj; // Due to SetXPolyDirty for GrowAdjust
+
+protected:
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+
+ std::optional<XPolygon> mpXPoly;
+
+protected:
+ XPolygon ImpCalcXPoly(const tools::Rectangle& rRect1, tools::Long nRad1) const;
+ void SetXPolyDirty();
+
+ /// Subclasses should override RecalcXPoly() by creating an XPolygon
+ /// instance with new and assigning it to mpXPoly.
+ virtual void RecalcXPoly();
+ const XPolygon& GetXPoly() const;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+
+ // protected destructor
+ virtual ~SdrRectObj() override;
+
+public:
+ /**
+ * The corner radius parameter is dropped at some point.
+ * We need to set the corner radius via SfxItems later on, using SetAttributes()
+ *
+ * Constructor of a rectangular drawing object
+ */
+ SdrRectObj(SdrModel& rSdrModel);
+ SdrRectObj(
+ SdrModel& rSdrModel,
+ const tools::Rectangle& rRect);
+
+ // Constructor of a text frame
+ SdrRectObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewTextKind);
+ SdrRectObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewTextKind,
+ const tools::Rectangle& rRect);
+
+ // Copy constructor
+ SdrRectObj(SdrModel& rSdrModel, SdrRectObj const & rSource);
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ virtual SdrRectObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+ virtual void RecalcSnapRect() override;
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
+ virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+
+ // Special drag methods
+ virtual bool hasSpecialDrag() const override;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
+ virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
+
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
+ virtual PointerStyle GetCreatePointer() const override;
+
+ virtual void NbcMove(const Size& rSiz) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+ virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
+ virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
+
+ virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const override;
+ virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const override;
+
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx
new file mode 100644
index 000000000..a5f60e692
--- /dev/null
+++ b/include/svx/svdotable.hxx
@@ -0,0 +1,294 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <rtl/ref.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svxdllapi.h>
+#include <boost/property_tree/ptree_fwd.hpp>
+
+class SvStream;
+class SfxStyleSheet;
+class SdrUndoAction;
+
+namespace sdr::contact {
+ class ViewContactOfTableObj;
+}
+
+namespace sdr::table {
+
+class TableLayouter;
+struct ImplTableShadowPaintInfo;
+
+#ifndef CellRef
+ class Cell;
+ typedef rtl::Reference< Cell > CellRef;
+#endif
+
+
+/// SdrTableHitKind
+enum class TableHitKind
+{
+ NONE,
+ Cell,
+ CellTextArea,
+ HorizontalBorder,
+ VerticallBorder
+};
+
+
+struct CellPos
+{
+ sal_Int32 mnCol;
+ sal_Int32 mnRow;
+
+ CellPos() : mnCol( 0 ), mnRow( 0 ) {}
+ CellPos( sal_Int32 nCol, sal_Int32 nRow ) { mnCol = nCol; mnRow = nRow; }
+
+ bool operator==( const CellPos& r ) const { return (r.mnCol == mnCol) && (r.mnRow == mnRow); }
+ bool operator!=( const CellPos& r ) const { return (r.mnCol != mnCol) || (r.mnRow != mnRow); }
+};
+
+
+/// TableStyleSettings
+struct TableStyleSettings
+{
+ bool mbUseFirstRow;
+ bool mbUseLastRow;
+ bool mbUseFirstColumn;
+ bool mbUseLastColumn;
+ bool mbUseRowBanding;
+ bool mbUseColumnBanding;
+
+ TableStyleSettings();
+ TableStyleSettings( const TableStyleSettings& rStyle );
+ TableStyleSettings& operator=(const TableStyleSettings& rStyle);
+
+ bool operator==( const TableStyleSettings& r ) const;
+};
+
+/// SdrTableObj
+class SdrTableObjImpl;
+
+class SVXCORE_DLLPUBLIC SdrTableObj final : public ::SdrTextObj
+{
+ friend class Cell;
+ friend class SdrTableObjImpl;
+
+ // protected destructor
+ virtual ~SdrTableObj() override;
+
+public:
+ SdrTableObj(SdrModel& rSdrModel);
+ // Copy constructor
+ SdrTableObj(SdrModel& rSdrModel, SdrTableObj const & rSource);
+ SdrTableObj(
+ SdrModel& rSdrModel,
+ const ::tools::Rectangle& rNewRect,
+ sal_Int32 nColumns,
+ sal_Int32 nRows);
+
+ // helper to limit existing TableModel to a given selection
+ void CropTableModelToSelection(const CellPos& rStart, const CellPos& rEnd);
+
+ // Table stuff
+ void DistributeColumns( sal_Int32 nFirstColumn, sal_Int32 nLastColumn, const bool bOptimize, const bool bMinimize );
+ void DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize, const bool bMinimize );
+
+ css::uno::Reference< css::table::XTable > getTable() const;
+
+ bool isValid( const sdr::table::CellPos& rPos ) const;
+ static CellPos getFirstCell();
+ CellPos getLastCell() const;
+ CellPos getLeftCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getRightCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getUpCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getDownCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getPreviousCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getNextCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getPreviousRow( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getNextRow( const CellPos& rPos, bool bEdgeTravel ) const;
+
+ void createCell( sdr::table::CellRef& xCell );
+
+ const sdr::table::TableStyleSettings& getTableStyleSettings() const;
+ void setTableStyleSettings( const sdr::table::TableStyleSettings& rStyle );
+
+ TableHitKind CheckTableHit( const Point& rPos, sal_Int32& rnX, sal_Int32& rnY, const sal_uInt16 aTol = 0 ) const;
+
+ void uno_lock();
+ void uno_unlock();
+
+ /** The active table has the focus or is currently edited */
+ const sdr::table::CellRef& getActiveCell() const;
+
+ void setActiveCell( const sdr::table::CellPos& rPos );
+ void getActiveCellPos( sdr::table::CellPos& rPos ) const;
+ sal_Int32 getColumnCount() const;
+ sal_Int32 getRowCount() const;
+
+ bool createTableEdgesJson(boost::property_tree::ptree & rJsonRoot);
+ void changeEdge(bool bHorizontal, int nEdge, sal_Int32 nOffset);
+
+ void getCellBounds( const sdr::table::CellPos& rPos, ::tools::Rectangle& rCellRect );
+
+ const SfxItemSet& GetActiveCellItemSet() const;
+
+ void setTableStyle( const css::uno::Reference< css::container::XIndexAccess >& xAutoFormatStyle );
+ const css::uno::Reference< css::container::XIndexAccess >& getTableStyle() const;
+
+ // Text stuff
+
+ /** Returns the currently active text */
+ virtual SdrText* getActiveText() const override;
+
+ /** Returns the nth available text */
+ virtual SdrText* getText( sal_Int32 nIndex ) const override;
+
+ /** Returns the number of texts available for this object */
+ virtual sal_Int32 getTextCount() const override;
+
+ /** Changes the current active text */
+ virtual void setActiveText( sal_Int32 nIndex ) override;
+
+ /** Returns the index of the text that contains the given point or -1 */
+ virtual sal_Int32 CheckTextHit(const Point& rPnt) const override;
+
+ // #i121917#
+ virtual bool HasText() const override;
+
+ bool IsTextEditActive() const { return mpEditingOutliner != nullptr; }
+ bool IsTextEditActive( const sdr::table::CellPos& rPos );
+
+ /** Returns true only if we are in edit mode and the user actually changed anything */
+ virtual bool IsReallyEdited() const override;
+
+ /** At the same time, we set the text in the outliner (if applicable the EditOutliners')
+ * as well as the PaperSize
+ */
+ void TakeTextRect( const sdr::table::CellPos& rPos, SdrOutliner& rOutliner, ::tools::Rectangle& rTextRect, bool bNoEditText, ::tools::Rectangle* pAnchorRect ) const;
+ virtual void TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText, tools::Rectangle* pAnchorRect, bool bLineWidth = true ) const override;
+ void TakeTextAnchorRect(const sdr::table::CellPos& rPos, ::tools::Rectangle& rAnchorRect ) const;
+ virtual void TakeTextAnchorRect(::tools::Rectangle& rAnchorRect) const override;
+
+ virtual bool IsAutoGrowHeight() const override;
+ virtual bool IsAutoGrowWidth() const override;
+
+ virtual bool IsFontwork() const override;
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual void SetChanged() override;
+
+ virtual bool AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool bHgt = true, bool bWdt = true) const override;
+ virtual bool AdjustTextFrameWidthAndHeight() override;
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+ virtual SdrTableObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+ virtual void RecalcSnapRect() override;
+ virtual const tools::Rectangle& GetSnapRect() const override;
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
+
+ virtual const tools::Rectangle& GetLogicRect() const override;
+ virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
+ virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override;
+
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+
+ // Special drag methods
+ virtual bool hasSpecialDrag() const override;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
+ virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const override;
+
+ virtual bool BegCreate(SdrDragStat& rStat) override;
+ virtual bool MovCreate(SdrDragStat& rStat) override;
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+ virtual bool BckCreate(SdrDragStat& rStat) override;
+ virtual void BrkCreate(SdrDragStat& rStat) override;
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
+ virtual PointerStyle GetCreatePointer() const override;
+
+ virtual void NbcMove(const Size& rSiz) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+
+ virtual bool BegTextEdit(SdrOutliner& rOutl) override;
+ virtual void EndTextEdit(SdrOutliner& rOutl) override;
+ virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const override;
+ void TakeTextEditArea(const sdr::table::CellPos& rPos, Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const;
+ virtual EEAnchorMode GetOutlinerViewAnchorMode() const override;
+
+ virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject) override;
+
+ virtual OutlinerParaObject* GetOutlinerParaObject() const override;
+
+ virtual void NbcReformatText() override;
+
+ virtual bool IsVerticalWriting() const override;
+ virtual void SetVerticalWriting(bool bVertical) override;
+
+ css::text::WritingMode GetWritingMode() const;
+
+ /// Add an undo action that should be on the undo stack after ending text edit.
+ void AddUndo(SdrUndoAction* pUndo);
+
+ /// Next time layouting would be done, skip it (to layout at the end of multiple actions).
+ void SetSkipChangeLayout(bool bSkipChangeLayout);
+
+ /** Tries to get table height if rows with sizes less then the minimum size were expanded
+
+ (i.e. Table height layouted without fitting to an area)
+ Helper for OOXML import
+ */
+ sal_Int32 getHeightWithoutFitting();
+
+ virtual void onEditOutlinerStatusEvent( EditStatus* pEditStatus ) override;
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+
+ const TableLayouter& getTableLayouter() const;
+
+private:
+ void init( sal_Int32 nColumns, sal_Int32 nRows );
+
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+
+ SdrOutliner* GetCellTextEditOutliner( const sdr::table::Cell& rCell ) const;
+
+ tools::Rectangle maLogicRect;
+ rtl::Reference<SdrTableObjImpl> mpImpl;
+};
+
+/** Hack for clipboard with calc and writer, export and import table content as rtf table */
+SVX_DLLPUBLIC void ExportAsRTF( SvStream& rStrm, SdrTableObj& rObj );
+SVX_DLLPUBLIC void ImportAsRTF( SvStream& rStrm, SdrTableObj& rObj );
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
new file mode 100644
index 000000000..03c828db7
--- /dev/null
+++ b/include/svx/svdotext.hxx
@@ -0,0 +1,633 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/itextprovider.hxx>
+#include <svx/svdoattr.hxx>
+#include <svx/sdtaitm.hxx>
+#include <svx/sdtakitm.hxx>
+#include <svx/sdtaditm.hxx>
+#include <svx/svdtrans.hxx>
+#include <tools/datetime.hxx>
+#include <svl/style.hxx>
+#include <svx/svdtext.hxx>
+#include <svx/svxdllapi.h>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+
+// forward declarations
+
+class OutlinerParaObject;
+class OverflowingText;
+class SdrOutliner;
+class SdrPathObj;
+class SdrTextObj;
+class SdrTextObjTest;
+class SvxFieldItem;
+class ImpSdrObjTextLink;
+class EditStatus;
+class TextChain;
+class TextChainFlow;
+
+enum class EEAnchorMode;
+enum class EETextFormat;
+
+namespace sdr::properties {
+ class TextProperties;
+}
+
+namespace drawinglayer::primitive2d {
+ class SdrContourTextPrimitive2D;
+ class SdrPathTextPrimitive2D;
+ class SdrBlockTextPrimitive2D;
+ class SdrAutoFitTextPrimitive2D;
+ class SdrStretchTextPrimitive2D;
+ class SdrChainedTextPrimitive2D;
+}
+
+namespace drawinglayer::animation {
+ class AnimationEntryList;
+}
+
+namespace drawinglayer::geometry {
+ class ViewInformation2D;
+}
+
+namespace sdr::table {
+ class Cell;
+ class SdrTableRtfExporter;
+ class SdrTableRTFParser;
+}
+
+
+// Defines
+constexpr const sal_uInt16 SDRUSERDATA_OBJTEXTLINK = 1;
+
+
+// helper class SdrTextObjGeoData
+class SdrTextObjGeoData : public SdrObjGeoData
+{
+public:
+ tools::Rectangle maRect;
+ GeoStat maGeo;
+};
+
+
+// helper class ImpSdrObjTextLinkUserData
+class ImpSdrObjTextLinkUserData final : public SdrObjUserData
+{
+ friend class SdrTextObj;
+ friend class ImpSdrObjTextLink;
+
+ OUString maFileName; // name of the referenced document
+ OUString maFilterName; // a filter, if need be
+ DateTime maFileDate0; // avoiding unnecessary reload
+ tools::SvRef<ImpSdrObjTextLink> mpLink;
+ rtl_TextEncoding meCharSet;
+
+public:
+ ImpSdrObjTextLinkUserData();
+ virtual ~ImpSdrObjTextLinkUserData() override;
+
+ virtual std::unique_ptr<SdrObjUserData> Clone(SdrObject* pObj1) const override;
+};
+
+namespace sdr::properties
+{
+ class CustomShapeProperties;
+ class CellProperties;
+}
+
+// SdrTextObj
+
+typedef std::unique_ptr<SdrPathObj, SdrObjectFreeOp> SdrPathObjUniquePtr;
+
+class SVXCORE_DLLPUBLIC SdrTextObj : public SdrAttrObj, public svx::ITextProvider
+{
+private:
+ // Cell needs access to ImpGetDrawOutliner();
+ friend class sdr::table::Cell;
+ friend class sdr::table::SdrTableRtfExporter;
+ friend class sdr::table::SdrTableRTFParser;
+ friend class TextChain;
+ friend class TextChainFlow;
+ friend class EditingTextChainFlow;
+
+ // CustomShapeproperties need to access the "bTextFrame" member:
+ friend class sdr::properties::CustomShapeProperties;
+
+protected:
+ virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+
+private:
+ // This method is only allowed for sdr::properties::TextProperties
+ SVX_DLLPRIVATE SdrOutliner* GetTextEditOutliner() const
+ {
+ return mpEditingOutliner;
+ }
+
+ // to allow sdr::properties::TextProperties access to SetPortionInfoChecked()
+ // and GetTextEditOutliner()
+ friend class sdr::properties::TextProperties;
+ friend class sdr::properties::CellProperties;
+
+ friend class ImpSdrObjTextLink;
+ friend class ImpSdrObjTextLinkUserData;
+ friend class SdrPowerPointImport; // for PowerPointImport
+ friend class SdrExchangeView; // for ImpGetDrawOutliner
+ friend class SdrView; // for ImpGetDrawOutliner
+ friend class SdrObjEditView; // for TextEdit
+ friend class SdrMeasureObj; // for ImpGetDrawOutliner
+ friend class SvxMSDffManager; // for ImpGetDrawOutliner
+ friend class SdrObjCustomShape; // for ImpGetDrawOutliner
+ friend class SdrText; // for ImpGetDrawOutliner
+
+protected:
+ // The "aRect" is also the rect of RectObj and CircObj.
+ // When bTextFrame=sal_True the text will be formatted into this rect
+ // When bTextFrame=sal_False the text will be centered around its middle
+ tools::Rectangle maRect;
+
+ // The GeoStat contains the rotation and shear angles
+ GeoStat maGeo;
+
+ // this is the active text
+ std::unique_ptr<SdrText> mpText;
+
+ // This contains the dimensions of the text
+ Size maTextSize;
+
+ // an Outliner*, so that
+ // 1. the TextObj won't be edited simultaneously by multiple views, and
+ // 2. when streaming while editing Flush() can be done
+ SdrOutliner* mpEditingOutliner;
+
+ // Possible values for eTextKind are:
+ // SdrObjKind::Text regular text frame
+ // SdrObjKind::TitleText TitleText for presentations
+ // SdrObjKind::OutlineText OutlineText for presentations
+ // eTextKind only has meaning when bTextFrame=sal_True, since otherwise
+ // we're dealing with a labeled graphical object
+ SdrObjKind meTextKind;
+
+ // For text editing in SW Header/Footer it is necessary to be
+ // able to set an offset for the text edit to allow text editing at the
+ // position of the virtual object. This offset is used when setting up
+ // and maintaining the OutlinerView.
+ Point maTextEditOffset;
+
+ virtual SdrObjectUniquePtr getFullDragClone() const override;
+
+
+public:
+ const Point& GetTextEditOffset() const { return maTextEditOffset; }
+ void SetTextEditOffset(const Point& rNew) { maTextEditOffset = rNew; }
+
+protected:
+ bool mbIsUnchainableClone = false;
+
+ // the successor in a chain
+ SdrTextObj* mpNextInChain = nullptr;
+ SdrTextObj* mpPrevInChain = nullptr;
+
+ // For labeled graphical objects bTextFrame is FALSE. The block of text
+ // will then be centered horizontally and vertically on aRect.
+ // For bTextFalse=sal_True the text will be formatted into aRect.
+ // The actual text frame is realized by an SdrRectObj with
+ // bTextFrame=sal_True.
+ bool mbTextFrame : 1;
+ bool mbNoShear : 1; // disable shearing (->graphic+Ole+TextFrame)
+ bool mbTextSizeDirty : 1;
+
+ bool mbInEditMode : 1; // Is this text object in edit mode?
+
+ // For objects with free size (flow text). The flag is set by the
+ // application on create. If the object width is later resized,
+ // AutoGrowWidth will be disabled (set to sal_False). This flag will
+ // then also be set to sal_False, so that the object behaves like a
+ // normal text object.
+ // Width resize can result from:
+ // - Interactive Resize in single or multiple selections
+ // - position/size dialog
+ bool mbDisableAutoWidthOnDragging : 1;
+
+ // Flag for allowing text animation. Default is sal_true.
+ bool mbTextAnimationAllowed : 1;
+
+ // flag for preventing recursive onEditOutlinerStatusEvent calls
+ bool mbInDownScale : 1;
+
+ SdrOutliner& ImpGetDrawOutliner() const;
+
+private:
+ // #101029#: Extracted from ImpGetDrawOutliner()
+ SVX_DLLPRIVATE void ImpInitDrawOutliner( SdrOutliner& rOutl ) const;
+ // #101029#: Extracted from Paint()
+ SVX_DLLPRIVATE void ImpSetupDrawOutlinerForPaint( bool bContourFrame,
+ SdrOutliner& rOutliner,
+ tools::Rectangle& rTextRect,
+ tools::Rectangle& rAnchorRect,
+ tools::Rectangle& rPaintRect,
+ Fraction& aFitXCorrection ) const;
+ void ImpAutoFitText( SdrOutliner& rOutliner ) const;
+ void ImpAutoFitText( SdrOutliner& rOutliner, const Size& rShapeSize, bool bIsVerticalWriting ) const;
+ SVX_DLLPRIVATE SdrObjectUniquePtr ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const;
+ SVX_DLLPRIVATE void ImpRegisterLink();
+ SVX_DLLPRIVATE void ImpDeregisterLink();
+ SVX_DLLPRIVATE ImpSdrObjTextLinkUserData* GetLinkUserData() const;
+
+ /** Appends the style family to a provided style name */
+ static void AppendFamilyToStyleName(OUString& styleName, SfxStyleFamily family);
+
+ /** Reads the style family from a style name to which the family has been appended. */
+ static SfxStyleFamily ReadFamilyFromStyleName(const OUString& styleName);
+
+protected:
+ bool ImpCanConvTextToCurve() const;
+ SdrPathObjUniquePtr ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed, bool bBezier) const;
+ SdrObjectUniquePtr ImpConvertAddText(SdrObjectUniquePtr pObj, bool bBezier) const;
+ void ImpSetTextStyleSheetListeners();
+ static void ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXCorrection);
+ static void ImpJustifyRect(tools::Rectangle& rRect);
+ void ImpCheckShear();
+ tools::Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
+ void ImpSetTextEditParams() const;
+ void SetTextSizeDirty() { mbTextSizeDirty = true; }
+
+ // rAnchorRect is InOut-Parameter!
+ void ImpSetContourPolygon( SdrOutliner& rOutliner, tools::Rectangle const & rAnchorRect, bool bLineWidth ) const;
+
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+ void NbcSetEckenradius(tools::Long nRad);
+
+ // #115391# new method for SdrObjCustomShape and SdrTextObj to correctly handle and set
+ // SdrTextMinFrameWidthItem and SdrTextMinFrameHeightItem based on all settings, necessities
+ // and object sizes
+ virtual void AdaptTextMinSize();
+
+ // constructors for labeled graphical objects
+ SdrTextObj(SdrModel& rSdrModel);
+ SdrTextObj(
+ SdrModel& rSdrModel,
+ const tools::Rectangle& rNewRect);
+
+ // constructors for text frames
+ SdrTextObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewTextKind);
+ SdrTextObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewTextKind,
+ const tools::Rectangle& rNewRect);
+
+ // copy constructor
+ SdrTextObj(SdrModel& rSdrModel, SdrTextObj const & rSource);
+
+ // protected destructor
+ virtual ~SdrTextObj() override;
+
+public:
+
+ bool IsInEditMode() const { return mbInEditMode; }
+
+ // Currently ASCII and RTF are supported and the differentiation is done
+ // internally.
+ // rFilterName has no meaning and must be empty
+ // Normally the application only has to call SetTextLink() - the
+ // remainder is automatic (SfxLinkManager).
+ // The LoadText() method can also be used to load a file into a text
+ // object (without linking.)
+ // TextLinks can't be edited (if needed later could be ReadOnly).
+ // Setting attributes can only be done on the text frame.
+ void SetTextLink(const OUString& rFileName, const OUString& rFilterName);
+ void ReleaseTextLink();
+ bool IsLinkedText() const { return m_pPlusData != nullptr && GetLinkUserData() != nullptr; }
+ bool ReloadLinkedText(bool bForceLoad);
+ bool LoadText(const OUString& rFileName, rtl_TextEncoding eCharSet);
+
+ virtual bool AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool bHgt = true, bool bWdt = true) const;
+ virtual bool NbcAdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true);
+ virtual bool AdjustTextFrameWidthAndHeight();
+ bool IsTextFrame() const { return mbTextFrame; }
+ bool IsOutlText() const { return mbTextFrame && (meTextKind==SdrObjKind::OutlineText || meTextKind==SdrObjKind::TitleText); }
+ /// returns true if the PPT autofit of text into shape bounds is enabled. implies IsFitToSize()==false!
+ bool IsAutoFit() const;
+ /// returns true if the old feature for fitting shape content should into shape is enabled. implies IsAutoFit()==false!
+ bool IsFitToSize() const;
+
+ // Chaining
+ SdrTextObj *GetNextLinkInChain() const;
+ void SetNextLinkInChain(SdrTextObj *);
+ SdrTextObj *GetPrevLinkInChain() const;
+ bool IsChainable() const;
+ bool GetPreventChainable() const;
+ TextChain *GetTextChain() const;
+
+ SdrObjKind GetTextKind() const { return meTextKind; }
+
+ // #i121917#
+ virtual bool HasText() const override;
+
+ bool IsTextEditActive() const { return mpEditingOutliner != nullptr; }
+
+ /** returns the currently active text. */
+ virtual SdrText* getActiveText() const;
+
+ /** returns the nth available text. */
+ virtual SdrText* getText( sal_Int32 nIndex ) const override;
+
+ /** returns the number of texts available for this object. */
+ virtual sal_Int32 getTextCount() const override;
+
+ /** returns true only if we are in edit mode and the user actually changed anything */
+ virtual bool IsReallyEdited() const;
+
+ /** changes the current active text */
+ virtual void setActiveText( sal_Int32 nIndex );
+
+ /** returns the index of the text that contains the given point or -1 */
+ virtual sal_Int32 CheckTextHit(const Point& rPnt) const;
+
+ void SetDisableAutoWidthOnDragging(bool bOn) { mbDisableAutoWidthOnDragging=bOn; }
+ void NbcSetText(const OUString& rStr);
+ void SetText(const OUString& rStr);
+ void NbcSetText(SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat);
+ void SetText(SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat);
+
+ // FitToSize and Fontwork are not taken into account in GetTextSize()!
+ virtual const Size& GetTextSize() const;
+ void FitFrameToTextSize();
+ sal_uInt16 GetFontScaleY() const;
+
+ // Simultaneously sets the text into the Outliner (possibly
+ // the one of the EditOutliner) and sets the PaperSize.
+ virtual void TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText,
+ tools::Rectangle* pAnchorRect, bool bLineWidth = true ) const;
+ // Takes writing direction into account when adjusting the rectangle
+ void AdjustRectToTextDistance(tools::Rectangle& rAnchorRect) const;
+ virtual void TakeTextAnchorRect(::tools::Rectangle& rAnchorRect) const;
+ const GeoStat& GetGeoStat() const { return maGeo; }
+
+ // get corner radius
+ tools::Long GetEckenradius() const;
+ virtual bool IsAutoGrowHeight() const;
+ tools::Long GetMinTextFrameHeight() const;
+ tools::Long GetMaxTextFrameHeight() const;
+ virtual bool IsAutoGrowWidth() const;
+ tools::Long GetMinTextFrameWidth() const;
+ tools::Long GetMaxTextFrameWidth() const;
+
+ css::drawing::TextFitToSizeType GetFitToSize() const;
+ const tools::Rectangle &GetGeoRect() const;
+
+ // check if it's a TextFontwork
+ virtual bool IsFontwork() const;
+
+ // should the Fontwork contour be hidden?
+ bool IsHideContour() const;
+
+ // text flow within contour
+ bool IsContourTextFrame() const;
+
+ SdrTextHorzAdjust GetTextHorizontalAdjust(const SfxItemSet& rSet) const;
+ SdrTextHorzAdjust GetTextHorizontalAdjust() const;
+
+ SdrTextVertAdjust GetTextVerticalAdjust(const SfxItemSet& rSet) const;
+ SdrTextVertAdjust GetTextVerticalAdjust() const;
+
+ /** Left inner spacing to borders */
+ tools::Long GetTextLeftDistance() const;
+ /** Right inner spacing to borders */
+ tools::Long GetTextRightDistance() const;
+ /** Top inner spacing to borders */
+ tools::Long GetTextUpperDistance() const;
+ /** Bottom inner spacing to borders */
+ tools::Long GetTextLowerDistance() const;
+ SdrTextAniKind GetTextAniKind() const;
+ SdrTextAniDirection GetTextAniDirection() const;
+
+ bool HasTextColumnsNumber() const;
+ sal_Int16 GetTextColumnsNumber() const;
+ void SetTextColumnsNumber(sal_Int16 nColumns);
+ bool HasTextColumnsSpacing() const;
+ sal_Int32 GetTextColumnsSpacing() const;
+ void SetTextColumnsSpacing(sal_Int32 nSpacing);
+
+ // react on model/page change
+ virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+
+ // needed to determine text anchor area
+ virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const;
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+ virtual SdrTextObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+ virtual basegfx::B2DPolyPolygon TakeContour() const override;
+ virtual void RecalcSnapRect() override;
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
+ virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
+ virtual const tools::Rectangle& GetLogicRect() const override;
+ virtual Degree100 GetRotateAngle() const override;
+ virtual Degree100 GetShearAngle(bool bVertical = false) const override;
+
+ virtual sal_uInt32 GetSnapPointCount() const override;
+ virtual Point GetSnapPoint(sal_uInt32 i) const override;
+
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const override;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
+ virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
+
+ virtual bool BegCreate(SdrDragStat& rStat) override;
+ virtual bool MovCreate(SdrDragStat& rStat) override;
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+ virtual bool BckCreate(SdrDragStat& rStat) override;
+ virtual void BrkCreate(SdrDragStat& rStat) override;
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
+ virtual PointerStyle GetCreatePointer() const override;
+
+ virtual void NbcMove(const Size& rSiz) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+ virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
+ virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
+
+ virtual bool HasTextEdit() const override;
+ // returns true if TextEditMode started
+ virtual bool BegTextEdit(SdrOutliner& rOutl);
+ virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const;
+ virtual void EndTextEdit(SdrOutliner& rOutl);
+ virtual EEAnchorMode GetOutlinerViewAnchorMode() const;
+
+ virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject) override;
+ void NbcSetOutlinerParaObjectForText( std::optional<OutlinerParaObject> pTextObject, SdrText* pText );
+ virtual OutlinerParaObject* GetOutlinerParaObject() const override;
+ bool CanCreateEditOutlinerParaObject() const;
+ std::optional<OutlinerParaObject> CreateEditOutlinerParaObject() const;
+
+ virtual void NbcReformatText() override;
+
+ virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos,
+ bool bEdit, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, OUString& rRet) const;
+
+ virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
+
+ void SetTextEditOutliner(SdrOutliner* pOutl) { mpEditingOutliner = pOutl; }
+
+ /** Setup given Outliner equivalently to SdrTextObj::Paint()
+
+ To setup an arbitrary Outliner in the same way as the draw
+ outliner on SdrTextObj::Paint(). Among others, the paper size,
+ control word and character stretching are initialized, such
+ that the formatting should match the screen representation.
+ The textual content of the outliner is not touched, i.e. no
+ Init() or Clear() is called on the Outliner.
+
+ @param rOutl
+ The Outliner to setup.
+
+ @param rPaintRect
+ The region to paint the outliner content into. This is useful
+ to e.g. determine the top, left position of text in shapes.
+ */
+ void SetupOutlinerFormatting( SdrOutliner& rOutl, tools::Rectangle& rPaintRect ) const;
+
+ /** Update given Outliner equivalently to SdrTextObj::Paint()
+
+ Same functionality as in SetupOutlinerFormatting(), except
+ that the outliner content is not cleared.
+
+ @param rOutl
+ The Outliner to update.
+
+ @param rPaintRect
+ The region to paint the outliner content into. This is useful
+ to e.g. determine the top, left position of text in shapes.
+ */
+ void UpdateOutlinerFormatting( SdrOutliner& rOutl, tools::Rectangle& rPaintRect ) const;
+ void ForceOutlinerParaObject();
+ virtual bool IsVerticalWriting() const;
+ virtual void SetVerticalWriting(bool bVertical);
+ bool IsTopToBottom() const;
+
+ /** called from the SdrObjEditView during text edit when the status of the edit outliner changes */
+ virtual void onEditOutlinerStatusEvent( EditStatus* pEditStatus );
+
+ /** called from the SdrObjEditView during text edit when a chain of boxes is to be updated */
+ void onChainingEvent();
+
+
+ // transformation interface for StarOfficeAPI. This implements support for
+ // homogen 3x3 matrices containing the transformation of the SdrObject. At the
+ // moment it contains a shearX, rotation and translation, but for setting all linear
+ // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
+
+
+ // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
+ // with the base geometry and returns TRUE. Otherwise it returns FALSE.
+ virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const override;
+
+ // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+ // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
+ // to use (0,0) as upper left and will be scaled to the given size in the matrix.
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) override;
+
+ // #103836# iterates over the paragraphs of a given SdrObject and removes all
+ // hard set character attributes with the which ids contained in the
+ // given vector
+ void RemoveOutlinerCharacterAttribs( const std::vector<sal_uInt16>& rCharWhichIds );
+
+ // Get necessary data for text scroll animation. ATM base it on a Text-Metafile and a
+ // painting rectangle. Rotation is taken from the object.
+ GDIMetaFile* GetTextScrollMetaFileAndRectangle(tools::Rectangle& rScrollRectangle, tools::Rectangle& rPaintRectangle);
+
+ // Access to TextAnimationAllowed flag
+ void SetTextAnimationAllowed(bool bNew);
+
+ // #i8824#
+ // Set single item at the local ItemSet. *Does not use* AllowItemChange(),
+ // ItemChange(), PostItemChange() and ItemSetChanged() calls.
+ void SetObjectItemNoBroadcast(const SfxPoolItem& rItem);
+ double GetCameraZRotation() const;
+
+public:
+
+ // text primitive decomposition helpers
+ void impDecomposeContourTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+ const drawinglayer::primitive2d::SdrContourTextPrimitive2D& rSdrContourTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+ void impDecomposePathTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+ const drawinglayer::primitive2d::SdrPathTextPrimitive2D& rSdrPathTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+ void impDecomposeBlockTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+ const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+ void impDecomposeAutoFitTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+ const drawinglayer::primitive2d::SdrAutoFitTextPrimitive2D& rSdrAutofitTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+ void impDecomposeStretchTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+ const drawinglayer::primitive2d::SdrStretchTextPrimitive2D& rSdrStretchTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+ void impDecomposeChainedTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+ const drawinglayer::primitive2d::SdrChainedTextPrimitive2D& rSdrChainedTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+ void impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutliner) const;
+
+ // timing generators
+ void impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const;
+ void impGetScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const;
+
+ // Direct decomposer for text visualization when you already have a prepared
+ // Outliner containing all the needed information
+ static void impDecomposeBlockTextPrimitiveDirect(
+ drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+ SdrOutliner& rOutliner,
+ const basegfx::B2DHomMatrix& rNewTransformA,
+ const basegfx::B2DHomMatrix& rNewTransformB,
+ const basegfx::B2DRange& rClipRange);
+
+ /** returns false if the given pointer is NULL
+ or if the given SdrOutliner contains no text.
+ Also checks for one empty paragraph.
+ */
+ static bool HasTextImpl( SdrOutliner const * pOutliner );
+
+ friend class ::SdrTextObjTest;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdouno.hxx b/include/svx/svdouno.hxx
new file mode 100644
index 000000000..2c81f47a1
--- /dev/null
+++ b/include/svx/svdouno.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <svx/svxdllapi.h>
+#include <svx/svdorect.hxx>
+#include <memory>
+
+
+// Forward declaration
+class SdrView;
+class SdrPageWindow;
+class SdrControlEventListenerImpl;
+
+namespace sdr::contact {
+ class ViewContactOfUnoControl;
+}
+
+
+// SdrUnoObj
+struct SdrUnoObjDataHolder;
+class SVXCORE_DLLPUBLIC SdrUnoObj : public SdrRectObj
+{
+ friend class SdrPageView;
+ friend class SdrControlEventListenerImpl;
+
+ std::unique_ptr<SdrUnoObjDataHolder> m_pImpl;
+
+ OUString aUnoControlModelTypeName;
+ OUString aUnoControlTypeName;
+
+protected:
+ css::uno::Reference< css::awt::XControlModel > xUnoControlModel; // Can also be set from outside
+
+private:
+ SVX_DLLPRIVATE void CreateUnoControlModel(const OUString& rModelName);
+ SVX_DLLPRIVATE void CreateUnoControlModel(const OUString& rModelName,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac );
+
+protected:
+ // protected destructor
+ virtual ~SdrUnoObj() override;
+
+public:
+ explicit SdrUnoObj(
+ SdrModel& rSdrModel,
+ const OUString& rModelName);
+ // Copy constructor
+ SdrUnoObj(SdrModel& rSdrModel, SdrUnoObj const & rSource);
+ SdrUnoObj(
+ SdrModel& rSdrModel,
+ const OUString& rModelName,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac);
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+
+ virtual SdrUnoObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+ virtual void NbcSetLayer(SdrLayerID nLayer) override;
+
+ // SpecialDrag support
+ virtual bool hasSpecialDrag() const override;
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ virtual void SetContextWritingMode( const sal_Int16 _nContextWritingMode ) override;
+
+ const css::uno::Reference< css::awt::XControlModel >& GetUnoControlModel() const {return xUnoControlModel;}
+ css::uno::Reference< css::awt::XControl > GetUnoControl(const SdrView& _rView, const OutputDevice& _rOut) const;
+
+ /** Retrieves a temporary XControl instance for a given output device
+
+ The method GetUnoControl, used to retrieve the XControl whose parent is a given device, only works
+ if the SdrUnoObj has already been painted at least once onto this device. However, there are valid
+ scenarios where you need certain information on how a control is painted onto a window, without
+ actually painting it. For example, you might be interested in the DeviceInfo of a UNO control.
+
+ For those cases, you can contain an XControl which behaves as the control which *would* be used to
+ paint onto a window.
+
+ @param _rWindow
+ the window for which should act as parent for the temporary control
+ @param _inout_ControlContainer
+ the control container belonging to the window, necessary as context
+ for the newly created control. A control container is usually created by calling
+ VCLUnoHelper::CreateControlContainer.
+ If _inout_ControlContainer is <NULL/>, it will be created internally, and passed to the caller.
+ In this case, the caller also takes ownership of the control container, and is responsible for
+ disposing it when not needed anymore.
+ @return
+ The requested control. This control is temporary only, and the caller is responsible for it.
+ In particular, the caller is required to dispose it when it's not needed anymore.
+
+ */
+ css::uno::Reference< css::awt::XControl >
+ GetTemporaryControlForWindow(
+ const vcl::Window& _rWindow,
+ css::uno::Reference< css::awt::XControlContainer >& _inout_ControlContainer
+ ) const;
+
+ const OUString& GetUnoControlTypeName() const { return aUnoControlTypeName; }
+ const OUString& getUnoControlModelTypeName() const { return aUnoControlModelTypeName; }
+
+ virtual void SetUnoControlModel( const css::uno::Reference< css::awt::XControlModel >& xModel );
+
+protected:
+ // SdrObject overridables
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+
+private:
+ /** Retrieves the typed ViewContact for the object
+ @param _out_rpContact
+ Upon successful return, ->_out_rpContact contains the ViewContact.
+ @return
+ <TRUE/> if and only if the contact was successfully retrieved. In this case,
+ ->_out_rpContact contains a pointer to this contact.
+ A failure to retrieve the contact object fires an assertion in non-product builds.
+ */
+ SVX_DLLPRIVATE bool impl_getViewContact( sdr::contact::ViewContactOfUnoControl*& _out_rpContact ) const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdoutl.hxx b/include/svx/svdoutl.hxx
new file mode 100644
index 000000000..f706d85bd
--- /dev/null
+++ b/include/svx/svdoutl.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <editeng/outliner.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/weakbase.h>
+
+class SdrTextObj;
+class SdrPage;
+
+class SVXCORE_DLLPUBLIC SdrOutliner : public Outliner
+{
+ tools::WeakReference<SdrTextObj> mxWeakTextObj;
+ const SdrPage* mpVisualizedPage;
+
+public:
+ SdrOutliner( SfxItemPool* pItemPool, OutlinerMode nMode );
+ virtual ~SdrOutliner() override ;
+
+ void SetTextObj( const SdrTextObj* pObj );
+ void SetTextObjNoInit( const SdrTextObj* pObj );
+ const SdrTextObj* GetTextObj() const;
+
+ void setVisualizedPage(const SdrPage* pPage) { if(pPage != mpVisualizedPage) mpVisualizedPage = pPage; }
+ const SdrPage* getVisualizedPage() const { return mpVisualizedPage; }
+
+ virtual OUString CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor) override;
+
+ bool hasEditViewCallbacks() const;
+};
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdovirt.hxx b/include/svx/svdovirt.hxx
new file mode 100644
index 000000000..1114d858a
--- /dev/null
+++ b/include/svx/svdovirt.hxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdobj.hxx>
+#include <svx/svxdllapi.h>
+
+/**
+ * FIXME: The virtual object is not yet fully implemented and tested.
+ * At the moment we only use it in a derived class in Writer.
+ */
+class SVXCORE_DLLPUBLIC SdrVirtObj : public SdrObject
+{
+ SdrVirtObj(const SdrVirtObj&) = delete;
+
+public:
+ virtual sdr::properties::BaseProperties& GetProperties() const override;
+
+protected:
+ virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
+
+ SdrObject& rRefObj; // Referenced drawing object
+ tools::Rectangle aSnapRect;
+
+protected:
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+
+ virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
+ virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
+
+ // protected destructor
+ virtual ~SdrVirtObj() override;
+
+public:
+ SdrVirtObj(SdrModel& rSdrModel, SdrObject& rNewObj);
+ // Copy constructor
+ SdrVirtObj(SdrModel& rSdrModel, SdrVirtObj const& rSource);
+
+ SdrObject& ReferencedObj();
+ const SdrObject& GetReferencedObj() const;
+ virtual void NbcSetAnchorPos(const Point& rAnchorPos) override;
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
+ virtual SdrInventor GetObjInventor() const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+ virtual SdrObjList* GetSubList() const override;
+ virtual void SetName(const OUString& rStr, const bool bSetChanged = true) override;
+ virtual const OUString& GetName() const override;
+ virtual void SetTitle(const OUString& rStr) override;
+ virtual OUString GetTitle() const override;
+ virtual void SetDescription(const OUString& rStr) override;
+ virtual OUString GetDescription() const override;
+
+ virtual const tools::Rectangle& GetCurrentBoundRect() const override;
+ virtual const tools::Rectangle& GetLastBoundRect() const override;
+ virtual void RecalcBoundRect() override;
+ virtual SdrVirtObj* CloneSdrObject(SdrModel& rTargetModel) const override;
+
+ virtual OUString TakeObjNameSingul() const override;
+ virtual OUString TakeObjNamePlural() const override;
+
+ // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation
+ virtual bool HasLimitedRotation() const override;
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
+ virtual sal_uInt32 GetHdlCount() const override;
+ virtual void AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const override;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const override;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
+ virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
+ virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const override;
+
+ // FullDrag support
+ virtual bool supportsFullDrag() const override;
+ virtual SdrObjectUniquePtr getFullDragClone() const override;
+
+ virtual bool BegCreate(SdrDragStat& rStat) override;
+ virtual bool MovCreate(SdrDragStat& rStat) override;
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+ virtual bool BckCreate(SdrDragStat& rStat) override;
+ virtual void BrkCreate(SdrDragStat& rStat) override;
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
+
+ virtual void NbcMove(const Size& rSiz) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact,
+ const Fraction& yFact) override;
+ virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
+ virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
+
+ virtual void Move(const Size& rSiz) override;
+ virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact,
+ bool bUnsetRelative = true) override;
+ virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
+ virtual void Mirror(const Point& rRef1, const Point& rRef2) override;
+ virtual void Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
+
+ virtual void RecalcSnapRect() override;
+ virtual const tools::Rectangle& GetSnapRect() const override;
+ virtual void SetSnapRect(const tools::Rectangle& rRect) override;
+ virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
+
+ virtual const tools::Rectangle& GetLogicRect() const override;
+ virtual void SetLogicRect(const tools::Rectangle& rRect) override;
+ virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
+
+ virtual Degree100 GetRotateAngle() const override;
+ virtual Degree100 GetShearAngle(bool bVertical = false) const override;
+
+ virtual sal_uInt32 GetSnapPointCount() const override;
+ virtual Point GetSnapPoint(sal_uInt32 i) const override;
+
+ virtual bool IsPolyObj() const override;
+ virtual sal_uInt32 GetPointCount() const override;
+ virtual Point GetPoint(sal_uInt32 i) const override;
+ virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i) override;
+
+ virtual std::unique_ptr<SdrObjGeoData> GetGeoData() const override;
+ virtual void SetGeoData(const SdrObjGeoData& rGeo) override;
+
+ virtual void NbcReformatText() override;
+
+ virtual bool HasMacro() const override;
+ virtual SdrObject* CheckMacroHit(const SdrObjMacroHitRec& rRec) const override;
+ virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec& rRec) const override;
+ virtual void PaintMacro(OutputDevice& rOut, const tools::Rectangle& rDirtyRect,
+ const SdrObjMacroHitRec& rRec) const override;
+ virtual bool DoMacro(const SdrObjMacroHitRec& rRec) override;
+
+ // #i73248# for default SdrVirtObj, offset is aAnchor, not (0,0)
+ virtual Point GetOffset() const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
new file mode 100644
index 000000000..2ba7017a0
--- /dev/null
+++ b/include/svx/svdpage.hxx
@@ -0,0 +1,545 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <cppuhelper/weak.hxx>
+#include <svl/stylesheetuser.hxx>
+#include <vcl/prntypes.hxx>
+#include <svl/itemset.hxx>
+#include <svx/sdrpageuser.hxx>
+#include <svx/sdr/contact/viewobjectcontactredirector.hxx>
+#include <svx/sdrmasterpagedescriptor.hxx>
+#include <svx/svxdllapi.h>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <svx/svdobj.hxx>
+#include <svx/ColorSets.hxx>
+#include <memory>
+#include <optional>
+#include <vector>
+#include <deque>
+
+
+// predefines
+namespace reportdesign { class OSection; }
+namespace sdr::contact { class ViewContact; }
+class SdrPage;
+class SdrModel;
+class SfxItemPool;
+class SdrPageView;
+class SdrLayerAdmin;
+class SdrLayerIDSet;
+class Color;
+class SfxStyleSheet;
+class SvxUnoDrawPagesAccess;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// SdrObjList
+// E3dObjList
+// SdrPage -> see continuation there
+
+// class SdrObjList
+class SVXCORE_DLLPUBLIC SdrObjList
+{
+friend class SdrObjListIter;
+friend class SdrEditView;
+
+private:
+ SdrObjList(const SdrObjList& rSrcList) = delete;
+ SdrObjList &operator=(const SdrObjList& rSrcList) = delete;
+
+protected:
+ void RecalcRects();
+
+private:
+ /// simple ActionChildInserted forwarder to have it on a central place
+ static void impChildInserted(SdrObject const & rChild);
+
+ // tdf#116879 Clear SdrObjList, no Undo done. Used from destructor, but also
+ // from other places. When used from destructor, suppress broadcasts
+ // to not get callbacks to evtl. derived objects already in destruction
+ // (e.g. SdrPage)
+ void impClearSdrObjList(bool bBroadcast);
+
+protected:
+ // protected constructor to make clear that this class should only
+ // be used as base for derivations, not naked. See getSdrModelFromSdrObjList
+ // which is pure virtual to force this, too
+ SdrObjList();
+ virtual ~SdrObjList();
+
+public:
+ // SdrModel/SdrPage access on SdrObjList level
+ virtual SdrPage* getSdrPageFromSdrObjList() const;
+ virtual SdrObject* getSdrObjectFromSdrObjList() const;
+
+ void CopyObjects(const SdrObjList& rSrcList);
+
+ // tdf#116879 clean up everything (without Undo), plus broadcasting
+ // changes. Split to this call and a private one (impClearSdrObjList)
+ // that allows cleanup without broadcasting in the destructor
+ void ClearSdrObjList();
+
+ /// recalculate order numbers / ZIndex
+ void RecalcObjOrdNums();
+ bool IsObjOrdNumsDirty() const { return mbObjOrdNumsDirty; }
+ virtual void NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE);
+ virtual void InsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE);
+ void sort( std::vector<sal_Int32>& sortOrder );
+
+ void InsertObjectThenMakeNameUnique(SdrObject* pObj);
+ void InsertObjectThenMakeNameUnique(SdrObject* pObj, std::unordered_set<rtl::OUString>& rNameSet, size_t nPos=SAL_MAX_SIZE);
+
+ /// remove from list without delete
+ virtual SdrObject* NbcRemoveObject(size_t nObjNum);
+ virtual SdrObject* RemoveObject(size_t nObjNum);
+
+ /// Replace existing object by different one.
+ /// Same as Remove(old)+Insert(new) but faster because the order numbers
+ /// do not have to be set dirty.
+ virtual SdrObject* ReplaceObject(SdrObject* pNewObj, size_t nObjNum);
+
+ /// Modify ZOrder of an SdrObject
+ virtual SdrObject* SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum);
+
+ /// Modify ZOrder of an SdrObject, object must already be in the list
+ void SetExistingObjectOrdNum(SdrObject* pExistingObj, size_t nNewObjNum);
+
+ void SetSdrObjListRectsDirty();
+
+ const tools::Rectangle& GetAllObjSnapRect() const;
+ const tools::Rectangle& GetAllObjBoundRect() const;
+
+ /// reformat all text objects, e.g. when changing printer
+ void NbcReformatAllTextObjects();
+ void ReformatAllTextObjects();
+
+ /** #103122# reformats all edge objects that are connected to other objects */
+ void ReformatAllEdgeObjects();
+
+ /// convert attributes of the style to hard formatting
+ void BurnInStyleSheetAttributes();
+
+ size_t GetObjCount() const;
+ SdrObject* GetObj(size_t nNum) const;
+
+ /// linked page or linked group object
+ virtual bool IsReadOnly() const;
+
+ /** Makes the object list flat, i.e. the object list content are
+ then tree leaves
+
+ This method travels recursively over all group objects in this
+ list, extracts the content, inserts it flat to the list and
+ removes the group object afterwards.
+ */
+ void FlattenGroups();
+
+ /** Ungroup the object at the given index
+
+ This method ungroups the content of the group object at the
+ given index, i.e. the content is put flat into the object list
+ (if the object at the given index is no group, this method is
+ a no-op). If the group itself contains group objects, the
+ operation is performed recursively, such that the content of
+ the given object contains no groups afterwards.
+ */
+ void UnGroupObj( size_t nObjNum );
+
+ /** Return whether there is an explicit, user defined, object navigation
+ order. When there is one this method returns <TRUE/> and the
+ GetObjectForNavigationPosition() and
+ SdrObject::GetNavigationPosition() methods will return values
+ different from those returned by SdrObject::GetOrdNum() and
+ GetObj().
+ */
+ bool HasObjectNavigationOrder() const;
+
+ /** Set the navigation position of the given object to the specified
+ value. Note that this changes the navigation position for all
+ objects on or following the old or new position.
+ */
+ void SetObjectNavigationPosition (
+ SdrObject& rObject,
+ const sal_uInt32 nNewNavigationPosition);
+
+ /** Return the object for the given navigation position. When there is
+ a user defined navigation order, i.e. mxNavigationOrder is not NULL,
+ then that is used to look up the object. Otherwise the z-order is
+ used by looking up the object in maList.
+ @param nNavigationPosition
+ Valid values include 0 and are smaller than the number of
+ objects as returned by GetObjCount().
+ @return
+ The returned pointer is NULL for invalid positions.
+ */
+ SdrObject* GetObjectForNavigationPosition (const sal_uInt32 nNavigationPosition) const;
+
+ /** Restore the navigation order to that defined by the z-order.
+ */
+ void ClearObjectNavigationOrder();
+
+ /** Set the navigation position of all SdrObjects to their position in
+ the mxNavigationOrder list. This method returns immediately when no
+ update is necessary.
+ @return
+ This method returns <TRUE/> when the navigation positions stored
+ in SdrObjects are up to date.
+ It returns <FALSE/> when the navigation positions are not valid,
+ for example because no explicit navigation order has been
+ defined, i.e. HasObjectNavigationOrder() would return <FALSE/>.
+ */
+ bool RecalcNavigationPositions();
+
+ /** Set the navigation order to the one defined by the given list of
+ XShape objects.
+ @param rxOrder
+ When this is an empty reference then the navigation order is
+ reset to the z-order. The preferred way to do this, however, is
+ to call ClearObjectNavigationOrder().
+ Otherwise this list is expected to contain all the shapes in the
+ called SdrObjList.
+ */
+ void SetNavigationOrder (const css::uno::Reference<
+ css::container::XIndexAccess>& rxOrder);
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+private:
+ tools::Rectangle maSdrObjListOutRect;
+ tools::Rectangle maSdrObjListSnapRect;
+ std::deque<SdrObject*> maList;
+ /// This list, if it exists, defines the navigation order. If it does
+ /// not exist then maList defines the navigation order.
+ std::optional<std::vector<tools::WeakReference<SdrObject>>> mxNavigationOrder;
+ bool mbObjOrdNumsDirty;
+ bool mbRectsDirty;
+ /// This flag is <TRUE/> when the mpNavigation list has been changed but
+ /// the indices of the referenced SdrObjects still have their old values.
+ bool mbIsNavigationOrderDirty;
+
+ /** Insert an SdrObject into maList. Do not modify the maList member
+ directly.
+ @param rObject
+ The object to insert into the object list.
+ @param nInsertPosition
+ The given object is inserted before the object at this
+ position. Valid values include 0 (the object is inserted at the
+ head of the list) and the number of objects in the list as
+ returned by GetObjCount() (the object is inserted at the end of
+ the list.)
+ */
+ void InsertObjectIntoContainer (
+ SdrObject& rObject,
+ const sal_uInt32 nInsertPosition);
+
+ /** Replace an object in the object list.
+ @param rObject
+ The new object that replaces the one in the list at the
+ specified position.
+ @param nObjectPosition
+ The object at this position in the object list is replaced by
+ the given object. Valid values include 0 and are smaller than
+ the number of objects in the list.
+ */
+ void ReplaceObjectInContainer (
+ SdrObject& rObject,
+ const sal_uInt32 nObjectPosition);
+
+ /** Remove an object from the object list.
+ The object list has to contain at least one element.
+ @param nObjectPosition
+ The object at this position is removed from the object list.
+ Valid values include 0 and are smaller than the number of
+ objects in the list.
+ */
+ void RemoveObjectFromContainer (
+ const sal_uInt32 nObjectPosition);
+};
+
+// Used for all methods which return a page number
+#define SDRPAGE_NOTFOUND 0xFFFF
+
+/// for the snap-to-grid in Writer
+class SdrPageGridFrame
+{
+ tools::Rectangle aPaper;
+ tools::Rectangle aUserArea;
+public:
+ SdrPageGridFrame(const tools::Rectangle& rPaper, const tools::Rectangle& rUser): aPaper(rPaper), aUserArea(rUser) {}
+ const tools::Rectangle& GetPaperRect() const { return aPaper; }
+ const tools::Rectangle& GetUserArea() const { return aUserArea; }
+};
+
+class SVXCORE_DLLPUBLIC SdrPageGridFrameList final
+{
+ std::vector<SdrPageGridFrame*> aList;
+
+ SdrPageGridFrameList(const SdrPageGridFrameList& rSrcList) = delete;
+ void operator=(const SdrPageGridFrameList& rSrcList) = delete;
+ SdrPageGridFrame* GetObject(sal_uInt16 i) const { return aList[i]; }
+
+public:
+ SdrPageGridFrameList() {}
+ ~SdrPageGridFrameList() { Clear(); }
+ void Clear();
+ sal_uInt16 GetCount() const { return sal_uInt16(aList.size()); }
+ void Insert(const SdrPageGridFrame& rGF) { aList.push_back(new SdrPageGridFrame(rGF)); }
+ SdrPageGridFrame& operator[](sal_uInt16 nPos) { return *GetObject(nPos); }
+ const SdrPageGridFrame& operator[](sal_uInt16 nPos) const { return *GetObject(nPos); }
+};
+
+// class SdrPageProperties
+class SVXCORE_DLLPUBLIC SdrPageProperties final : public SfxListener, public svl::StyleSheetUser
+{
+private:
+ // data
+ SdrPage* mpSdrPage;
+ SfxStyleSheet* mpStyleSheet;
+ std::unique_ptr<svx::Theme> mpTheme;
+ SfxItemSet maProperties;
+
+ // internal helpers
+ void ImpRemoveStyleSheet();
+ void ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet);
+
+ SdrPageProperties& operator=(const SdrPageProperties& rCandidate) = delete;
+
+public:
+ // construct/destruct
+ SdrPageProperties(SdrPage& rSdrPage);
+ virtual ~SdrPageProperties() override;
+
+ // Notify(...) from baseclass SfxListener
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+
+ virtual bool isUsedByModel() const override;
+
+ // data read/write
+ const SfxItemSet& GetItemSet() const { return maProperties;}
+ void PutItemSet(const SfxItemSet& rSet);
+ void PutItem(const SfxPoolItem& rItem);
+ void ClearItem(const sal_uInt16 nWhich = 0);
+
+ // StyleSheet access
+ void SetStyleSheet(SfxStyleSheet* pStyleSheet);
+ SfxStyleSheet* GetStyleSheet() const { return mpStyleSheet;}
+
+ void SetTheme(std::unique_ptr<svx::Theme> pTheme);
+ svx::Theme* GetTheme();
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+};
+
+
+/**
+ A SdrPage contains exactly one SdrObjList and a description of the physical
+ page dimensions (size / margins). The latter is required to "catch" objects
+ during drag-and-drop.
+ The SdrPage allows (via SdrObjList) inserting and removing SdrObjects,
+ as well as moving them into the foreground or background.
+ Also it's possible to request and directly set the order number (ZOrder)
+ of SdrObjects.
+*/
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// SdrPage
+// DlgEdPage
+// FmFormPage
+// ScDrawPage
+// SdPage
+// SwDPage
+// OReportPage
+
+class SVXCORE_DLLPUBLIC SdrPage : public SdrObjList, public cppu::OWeakObject
+{
+ // #i9076#
+ friend class SdrModel;
+ friend class SvxUnoDrawPagesAccess;
+
+ // this class uses its own UNO wrapper
+ // and thus has to set mxUnoPage (it also relies on mxUnoPage not being WeakRef)
+ friend class reportdesign::OSection;
+
+ SdrPage& operator=(const SdrPage&) = delete;
+ SdrPage(const SdrPage&) = delete;
+
+ // start PageUser section
+private:
+ // #111111# PageUser section
+ sdr::PageUserVector maPageUsers;
+
+ std::unique_ptr<sdr::contact::ViewContact> mpViewContact;
+
+public:
+ void AddPageUser(sdr::PageUser& rNewUser);
+ void RemovePageUser(sdr::PageUser& rOldUser);
+
+ // SdrModel access on SdrPage level
+ SdrModel& getSdrModelFromSdrPage() const { return mrSdrModelFromSdrPage; }
+
+protected:
+ std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact();
+public:
+ const sdr::contact::ViewContact& GetViewContact() const;
+ sdr::contact::ViewContact& GetViewContact();
+
+ // #110094# DrawContact support: Methods for handling Page changes
+ void ActionChanged();
+
+private:
+ // the SdrModel this page was created with, unchanged during SdrPage lifetime
+ SdrModel& mrSdrModelFromSdrPage;
+
+private:
+ tools::Long mnWidth; // page size
+ tools::Long mnHeight; // page size
+ sal_Int32 mnBorderLeft; // left page margin
+ sal_Int32 mnBorderUpper; // top page margin
+ sal_Int32 mnBorderRight; // right page margin
+ sal_Int32 mnBorderLower; // bottom page margin
+ bool mbBackgroundFullSize = false; ///< Background object to represent the whole page.
+
+ std::unique_ptr<SdrLayerAdmin> mpLayerAdmin;
+ std::unique_ptr<SdrPageProperties> mpSdrPageProperties;
+ css::uno::Reference< css::uno::XInterface > mxUnoPage;
+
+public:
+ SdrPageProperties& getSdrPageProperties();
+ const SdrPageProperties& getSdrPageProperties() const;
+ const SdrPageProperties* getCorrectSdrPageProperties() const;
+
+protected:
+ // new MasterPageDescriptorVector
+ std::unique_ptr<sdr::MasterPageDescriptor> mpMasterPageDescriptor;
+
+ sal_uInt16 nPageNum;
+
+ bool mbMaster : 1; // flag if this is a MasterPage
+ bool mbInserted : 1;
+ bool mbObjectsNotPersistent : 1;
+
+ // #i93597#
+ bool mbPageBorderOnlyLeftRight : 1;
+
+ void SetUnoPage(css::uno::Reference<css::drawing::XDrawPage> const&);
+ virtual css::uno::Reference< css::uno::XInterface > createUnoPage();
+
+ // Copying of pages is split into two parts: construction and copying of page objects,
+ // because the copying might need access to fully initialized page. CloneSdrPage() is responsible
+ // to call lateInit() after copy-construction of a new object. Any initialization in derived
+ // classes that needs access to the page objects must be deferred to lateInit. And it must
+ // call lateInit() of its parent class.
+ void lateInit(const SdrPage& rSrcPage);
+
+public:
+ explicit SdrPage(SdrModel& rModel, bool bMasterPage=false);
+ virtual ~SdrPage() override;
+
+ virtual rtl::Reference<SdrPage> CloneSdrPage(SdrModel& rTargetModel) const;
+ bool IsMasterPage() const { return mbMaster; }
+ void SetInserted(bool bNew = true);
+ bool IsInserted() const { return mbInserted; }
+ void SetChanged();
+
+ // derived from SdrObjList, returns this
+ virtual SdrPage* getSdrPageFromSdrObjList() const override;
+
+ // #i68775# React on PageNum changes (from Model in most cases)
+ void SetPageNum(sal_uInt16 nNew);
+ sal_uInt16 GetPageNum() const;
+
+ // #i93597# Allow page border definition to not be the full rectangle but to
+ // use only the left and right vertical edges (reportdesigner)
+ void setPageBorderOnlyLeftRight(bool bNew) { mbPageBorderOnlyLeftRight = bNew; }
+ bool getPageBorderOnlyLeftRight() const { return mbPageBorderOnlyLeftRight; }
+
+ virtual void SetSize(const Size& aSiz);
+ Size GetSize() const;
+ virtual void SetOrientation(Orientation eOri);
+ virtual Orientation GetOrientation() const;
+ tools::Long GetWidth() const;
+ tools::Long GetHeight() const;
+ virtual void SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr);
+ virtual void SetLeftBorder(sal_Int32 nBorder);
+ virtual void SetUpperBorder(sal_Int32 nBorder);
+ virtual void SetRightBorder(sal_Int32 nBorder);
+ virtual void SetLowerBorder(sal_Int32 nBorder);
+ sal_Int32 GetLeftBorder() const;
+ sal_Int32 GetUpperBorder() const;
+ sal_Int32 GetRightBorder() const;
+ sal_Int32 GetLowerBorder() const;
+ void SetBackgroundFullSize(bool bIn);
+ bool IsBackgroundFullSize() const;
+
+ // New MasterPage interface
+ bool TRG_HasMasterPage() const { return (nullptr != mpMasterPageDescriptor); }
+ void TRG_SetMasterPage(SdrPage& rNew);
+ void TRG_ClearMasterPage();
+ SdrPage& TRG_GetMasterPage() const;
+ const SdrLayerIDSet& TRG_GetMasterPageVisibleLayers() const;
+ void TRG_SetMasterPageVisibleLayers(const SdrLayerIDSet& rNew);
+ sdr::contact::ViewContact& TRG_GetMasterPageDescriptorViewContact() const;
+
+ void MakePageObjectsNamesUnique();
+
+protected:
+ void TRG_ImpMasterPageRemoved(const SdrPage& rRemovedPage);
+public:
+
+ /// changing the layers does not set the modified-flag!
+ const SdrLayerAdmin& GetLayerAdmin() const;
+ SdrLayerAdmin& GetLayerAdmin();
+
+ virtual OUString GetLayoutName() const;
+
+ /// for snap-to-grid in Writer, also for AlignObjects if 1 object is marked
+ /// if pRect != null, then the pages that are intersected by this Rect,
+ /// otherwise the visible pages
+ virtual const SdrPageGridFrameList* GetGridFrameList(const SdrPageView* pPV, const tools::Rectangle* pRect) const;
+
+ css::uno::Reference< css::uno::XInterface > const & getUnoPage();
+
+ virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const;
+
+ /** *deprecated* returns an averaged background color of this page */
+ // #i75566# GetBackgroundColor -> GetPageBackgroundColor
+ Color GetPageBackgroundColor() const;
+
+ /** *deprecated* returns an averaged background color of this page */
+ // #i75566# GetBackgroundColor -> GetPageBackgroundColor and bScreenDisplay hint value
+ Color GetPageBackgroundColor( SdrPageView const * pView, bool bScreenDisplay = true) const;
+
+ /** this method returns true if the object from the ViewObjectContact should
+ be visible on this page while rendering.
+ bEdit selects if visibility test is for an editing view or a final render,
+ like printing.
+ */
+ virtual bool checkVisibility(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo,
+ bool bEdit );
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdpagv.hxx b/include/svx/svdpagv.hxx
new file mode 100644
index 000000000..2f77dfa66
--- /dev/null
+++ b/include/svx/svdpagv.hxx
@@ -0,0 +1,254 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+#include <svx/svdhlpln.hxx>
+#include <svx/svdsob.hxx>
+#include <svx/svdtypes.hxx>
+#include <svx/svxdllapi.h>
+
+#include <memory>
+#include <vector>
+#include <basegfx/range/b2irectangle.hxx>
+
+
+namespace vcl { class Region; }
+class SdrObjList;
+class SdrObject;
+class SdrPage;
+class SdrUnoObj;
+class SdrPaintWindow;
+class SdrView;
+class SdrPageObj;
+class SdrPageView;
+
+namespace sdr::contact
+{
+ class ViewObjectContactRedirector;
+ class DisplayInfo;
+ class ViewObjectContactRedirector;
+}
+
+// typedefs for a list of SdrPageWindow
+class SdrPageWindow;
+
+class SVXCORE_DLLPUBLIC SdrPageView
+{
+private:
+ SdrView& mrView;
+ SdrPage* mpPage;
+ Point aPgOrg; // The Page's point of origin
+
+ tools::Rectangle aMarkBound;
+ tools::Rectangle aMarkSnap;
+ bool mbHasMarked;
+ bool mbVisible;
+
+ SdrLayerIDSet aLayerVisi; // Set of visible Layers
+ SdrLayerIDSet aLayerLock; // Set of non-editable Layers
+ SdrLayerIDSet aLayerPrn; // Set of printable Layers
+
+ SdrObjList* pCurrentList; // Current List, usually the Page
+ SdrObject* pCurrentGroup; // Current Group; nullptr means none
+
+ SdrHelpLineList aHelpLines; // Helper lines and points
+
+ // #103911# Use one reserved slot (bReserveBool2) for the document color
+ Color maDocumentColor;
+
+ // #103834# Use one reserved slot (bReserveBool1) for the background color
+ Color maBackgroundColor;
+
+ std::vector< std::unique_ptr<SdrPageWindow> > maPageWindows;
+
+ // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer
+ // was done
+ SdrPageWindow* mpPreparedPageWindow;
+
+public:
+ sal_uInt32 PageWindowCount() const { return maPageWindows.size(); }
+ SdrPageWindow* FindPageWindow( const SdrPaintWindow& rPaintWindow ) const;
+ SdrPageWindow* FindPageWindow( const OutputDevice& rOutDev ) const;
+ SdrPageWindow* GetPageWindow(sal_uInt32 nIndex) const;
+
+ /**
+ * Finds the page window whose PaintWindow belongs to the given output device
+ * In opposite to FindPageWindow, this method also cares possibly patched PaintWindow instances.
+ * That is, a SdrPageWindow might have an original, and a patched SdrPaintWindow instance - if
+ * this is the case, then the original SdrPaintWindow is examined before the patched one.
+ */
+ const SdrPageWindow* FindPatchedPageWindow( const OutputDevice& rOutDev ) const;
+
+private:
+ void ImpInvalidateHelpLineArea(sal_uInt16 nNum) const;
+
+ void SetLayer(const OUString& rName, SdrLayerIDSet& rBS, bool bJa);
+ bool IsLayer(const OUString& rName, const SdrLayerIDSet& rBS) const;
+
+ /// Let's see if the current Group (pCurrentGroup) is still inserted
+ void CheckCurrentGroup();
+
+ void AdjHdl();
+
+public:
+ SdrPageView(SdrPage* pPage1, SdrView& rNewView);
+ ~SdrPageView();
+
+ SdrPageView& operator=( SdrPageView const & ) = delete; // MSVC2017 workaround
+ SdrPageView( SdrPageView const & ) = delete; // MSVC2017 workaround
+
+
+ /// Is called by PaintView, when modal changes have finished
+ void ModelHasChanged();
+
+ void Show();
+ void Hide();
+
+ void AddPaintWindowToPageView(SdrPaintWindow& rPaintWindow);
+ void RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow);
+
+ SdrView& GetView() { return mrView; }
+ const SdrView& GetView() const { return mrView; }
+
+ /**
+ * Looks up the control container belonging to given output device
+ * @return
+ * If the given output device belongs to one of the SdrPageViewWinRecs associated with this
+ * SdrPageView instance, the XControlContainer for this output device is returned, <NULL/>
+ * otherwise.
+ */
+ css::uno::Reference< css::awt::XControlContainer >
+ GetControlContainer( const OutputDevice& _rDevice ) const;
+
+ /// Sets all elements in the view which support a design and an alive mode into the given mode
+ void SetDesignMode( bool _bDesignMode ) const;
+
+ bool IsVisible() const { return mbVisible; }
+
+ /// Invalidates the Page's whole area
+ void InvalidateAllWin();
+
+ /// PrePaint call forwarded from app windows
+ void PrePaint();
+
+ /// @param rReg refers to the OutDev and not to the Page
+ void CompleteRedraw( SdrPaintWindow& rPaintWindow, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector );
+
+ /// Write access to mpPreparedPageWindow
+ void setPreparedPageWindow(SdrPageWindow* pKnownTarget);
+
+ void DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr,
+ const tools::Rectangle& rRect = tools::Rectangle(),
+ basegfx::B2IRectangle const* pPageFrame = nullptr);
+ void DrawPageViewGrid(OutputDevice& rOut, const tools::Rectangle& rRect, Color aColor = COL_BLACK );
+
+ tools::Rectangle GetPageRect() const;
+ SdrPage* GetPage() const { return mpPage; }
+
+ /// Return current List
+ SdrObjList* GetObjList() const { return pCurrentList; }
+
+ /// Return current Group
+ SdrObject* GetCurrentGroup() const { return pCurrentGroup; }
+
+ /// Set current Group and List
+ void SetCurrentGroupAndList(SdrObject* pNewGroup, SdrObjList* pNewList);
+
+ bool HasMarkedObjPageView() const { return mbHasMarked; }
+ void SetHasMarkedObj(bool bOn) { mbHasMarked = bOn; }
+
+ const tools::Rectangle& MarkBound() const { return aMarkBound; }
+ const tools::Rectangle& MarkSnap() const { return aMarkSnap; }
+ tools::Rectangle& MarkBound() { return aMarkBound; }
+ tools::Rectangle& MarkSnap() { return aMarkSnap; }
+
+ void SetLayerVisible(const OUString& rName, bool bShow) {
+ SetLayer(rName, aLayerVisi, bShow);
+ if(!bShow) AdjHdl();
+ InvalidateAllWin();
+ }
+ bool IsLayerVisible(const OUString& rName) const { return IsLayer(rName, aLayerVisi); }
+
+ void SetLayerLocked(const OUString& rName, bool bLock) { SetLayer(rName, aLayerLock, bLock); if(bLock) AdjHdl(); }
+ bool IsLayerLocked(const OUString& rName) const { return IsLayer(rName,aLayerLock); }
+
+ void SetLayerPrintable(const OUString& rName, bool bPrn) { SetLayer(rName, aLayerPrn, bPrn); }
+ bool IsLayerPrintable(const OUString& rName) const { return IsLayer(rName, aLayerPrn); }
+
+ /// PV represents a RefPage or a SubList of a RefObj, or the Model is ReadOnly
+ bool IsReadOnly() const;
+
+ /// The Origin always refers to the upper left corner of the Page
+ const Point& GetPageOrigin() const { return aPgOrg; }
+ void SetPageOrigin(const Point& rOrg);
+
+ void LogicToPagePos(Point& rPnt) const { rPnt-=aPgOrg; }
+ void LogicToPagePos(tools::Rectangle& rRect) const { rRect.Move(-aPgOrg.X(),-aPgOrg.Y()); }
+ void PagePosToLogic(Point& rPnt) const { rPnt+=aPgOrg; }
+
+ void SetVisibleLayers(const SdrLayerIDSet& rSet) { aLayerVisi=rSet; }
+ const SdrLayerIDSet& GetVisibleLayers() const { return aLayerVisi; }
+ void SetPrintableLayers(const SdrLayerIDSet& rSet) { aLayerPrn=rSet; }
+ const SdrLayerIDSet& GetPrintableLayers() const { return aLayerPrn; }
+ void SetLockedLayers(const SdrLayerIDSet& rSet) { aLayerLock=rSet; }
+ const SdrLayerIDSet& GetLockedLayers() const { return aLayerLock; }
+
+ const SdrHelpLineList& GetHelpLines() const { return aHelpLines; }
+ void SetHelpLines(const SdrHelpLineList& rHLL);
+ //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos);
+ void SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine);
+ void DeleteHelpLine(sal_uInt16 nNum);
+ void InsertHelpLine(const SdrHelpLine& rHL);
+
+ /// At least one member must be visible for the Group object and
+ /// it must not be locked
+ /// @returns
+ /// true, if the object's layer is visible and not locked
+ bool IsObjMarkable(SdrObject const * pObj) const;
+
+ /// Entering (editing) an object group
+ /// After that, we have direct access to all member objects of the group.
+ /// All other objects are not editable in the meantime (until the next
+ /// LeaveGroup())
+ bool EnterGroup(SdrObject* pObj);
+
+ /// Leave an object group we entered previously
+ void LeaveOneGroup();
+
+ /// Leave all object groups we entered previously
+ void LeaveAllGroup();
+
+ /// Determine, how deep we descended (0 = Root(Page))
+ sal_uInt16 GetEnteredLevel() const;
+
+ // #103834# Set background color for svx at SdrPageViews
+ void SetApplicationBackgroundColor(Color aBackgroundColor);
+
+ const Color& GetApplicationBackgroundColor() const { return maBackgroundColor;}
+
+ // #103911# Set/Get document color for svx at SdrPageViews
+ void SetApplicationDocumentColor(Color aDocumentColor);
+ const Color& GetApplicationDocumentColor() const { return maDocumentColor;}
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx
new file mode 100644
index 000000000..557846fe0
--- /dev/null
+++ b/include/svx/svdpntv.hxx
@@ -0,0 +1,504 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svl/SfxBroadcaster.hxx>
+#include <svl/lstner.hxx>
+#include <svl/undo.hxx>
+#include <svx/svddrag.hxx>
+#include <svx/svdlayer.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svxdllapi.h>
+#include <unotools/options.hxx>
+#include <vcl/event.hxx>
+#include <vcl/idle.hxx>
+#include <vcl/timer.hxx>
+#include <memory>
+
+
+// Pre defines
+class SdrPageWindow;
+
+namespace com::sun::star::awt {
+ class XControlContainer;
+}
+namespace sdr::overlay { class OverlayManager; }
+
+class SdrPage;
+class SdrView;
+class SfxItemSet;
+class SfxStyleSheet;
+class SdrOle2Obj;
+class SdrModel;
+class SdrObject;
+enum class GraphicManagerDrawFlags;
+
+namespace sdr::contact {
+ class ViewObjectContactRedirector;
+}
+
+// Defines for AnimationMode
+enum class SdrAnimationMode
+{
+ Animate,
+ Disable
+};
+
+class SdrPaintView;
+namespace sdr::contact { class ViewObjectContactRedirector; }
+
+namespace vcl {
+ class Window;
+}
+
+
+class SvxViewChangedHint final : public SfxHint
+{
+public:
+ explicit SvxViewChangedHint();
+};
+
+class SdrPaintWindow;
+
+/**
+ * Helper to convert any GDIMetaFile to a good quality BitmapEx,
+ * using default parameters and graphic::XPrimitive2DRenderer
+ */
+BitmapEx convertMetafileToBitmapEx(
+ const GDIMetaFile& rMtf,
+ const basegfx::B2DRange& rTargetRange,
+ const sal_uInt32 nMaximumQuadraticPixels);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// SdrPaintView
+// SdrSnapView
+// SdrMarkView
+// SdrEditView
+// SdrPolyEditView
+// SdrGlueEditView
+// SdrObjEditView
+// SdrExchangeView
+// SdrDragView
+// SdrCreateView
+// SdrView
+// DlgEdView
+// GraphCtrlView
+// E3dView
+// DrawViewWrapper
+// FmFormView
+// ScDrawView
+// sd::View (may have more?)
+// sd::DrawView
+// SwDrawView
+// OSectionView
+
+class SVXCORE_DLLPUBLIC SdrPaintView : public SfxListener, public SfxRepeatTarget, public SfxBroadcaster, public ::utl::ConfigurationListener
+{
+private:
+ friend class SdrPageView;
+ friend class SdrGrafObj;
+
+ // the SdrModel this view was created with, unchanged during lifetime
+ SdrModel& mrSdrModelFromSdrView;
+
+ std::unique_ptr<SdrPageView> mpPageView;
+protected:
+ SdrModel* mpModel;
+ VclPtr<OutputDevice> mpActualOutDev; // Only for comparison
+ VclPtr<OutputDevice> mpDragWin;
+ SfxStyleSheet* mpDefaultStyleSheet;
+
+ OUString maActualLayer; // Current drawing layer
+ OUString maMeasureLayer; // Current layer for measurements
+
+// Container aPagV; // List of SdrPageViews
+
+ // All windows this view is displayed on
+ std::vector< std::unique_ptr<SdrPaintWindow> > maPaintWindows;
+
+ Size maGridBig; // FIXME: We need to get rid of this eventually
+ Size maGridFin; // FIXME: We need to get rid of this eventually
+ SdrDragStat maDragStat;
+ tools::Rectangle maMaxWorkArea;
+ SfxItemSet maDefaultAttr;
+ Idle maComeBackIdle;
+
+ SdrAnimationMode meAnimationMode;
+
+ sal_uInt16 mnHitTolPix;
+ sal_uInt16 mnMinMovPix;
+ sal_uInt16 mnHitTolLog;
+ sal_uInt16 mnMinMovLog;
+
+ bool mbPageVisible : 1;
+ bool mbPageShadowVisible : 1;
+ bool mbPageBorderVisible : 1;
+ bool mbBordVisible : 1;
+ bool mbGridVisible : 1;
+ bool mbGridFront : 1;
+ bool mbHlplVisible : 1;
+ bool mbHlplFront : 1;
+ bool mbGlueVisible : 1; // Persistent; show gluepoints
+ bool mbGlueVisible2 : 1; // Also show gluepoints for GluePointEdit
+ bool mbGlueVisible3 : 1; // Also show gluepoints for EdgeTool
+ bool mbGlueVisible4 : 1; // Show gluepoints, if one edge is selected
+ bool mbSomeObjChgdFlag : 1;
+ bool mbSwapAsynchron : 1;
+ bool mbPrintPreview : 1;
+
+ // These bools manage, the status that is displayed
+ //
+ bool mbAnimationPause : 1;
+
+ // Flag which decides if buffered output for this view is allowed. When
+ // set, PreRendering for PageView rendering will be used. Default is sal_False
+ bool mbBufferedOutputAllowed : 1;
+
+ // Flag which decides if buffered overlay for this view is allowed. When
+ // set, the output will be buffered in an overlay vdev. When not, overlay is
+ // directly painted to OutDev. Default is sal_False.
+ bool mbBufferedOverlayAllowed : 1;
+
+ // Allow page painting at all?
+ bool mbPagePaintingAllowed : 1;
+
+ // Is this a preview renderer?
+ bool mbPreviewRenderer : 1;
+
+ // Flags for calc and sw for suppressing OLE, CHART or DRAW objects
+ bool mbHideOle : 1;
+ bool mbHideChart : 1;
+ bool mbHideDraw : 1; // hide draw objects other than form controls
+ bool mbHideFormControl : 1; // hide form controls only
+
+public:
+ // Interface for PagePaintingAllowed flag
+ bool IsBufferedOutputAllowed() const;
+ void SetBufferedOutputAllowed(bool bNew);
+
+ // Interface for BufferedOverlayAllowed flag
+ bool IsBufferedOverlayAllowed() const;
+ void SetBufferedOverlayAllowed(bool bNew);
+
+ // Allow page painting at all?
+ bool IsPagePaintingAllowed() const { return mbPagePaintingAllowed;}
+ void SetPagePaintingAllowed(bool bNew);
+
+ virtual rtl::Reference<sdr::overlay::OverlayManager> CreateOverlayManager(OutputDevice& rDevice) const;
+
+protected:
+ svtools::ColorConfig maColorConfig;
+ Color maGridColor;
+
+ // Interface to SdrPaintWindow
+ void DeletePaintWindow(const SdrPaintWindow& rOld);
+ void ConfigurationChanged( ::utl::ConfigurationBroadcaster*, ConfigurationHints ) override;
+ static void InitOverlayManager(rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager);
+
+public:
+ sal_uInt32 PaintWindowCount() const { return maPaintWindows.size(); }
+ SdrPaintWindow* FindPaintWindow(const OutputDevice& rOut) const;
+ SdrPaintWindow* GetPaintWindow(sal_uInt32 nIndex) const;
+ // Replacement for GetWin(0), may return 0L (!)
+ OutputDevice* GetFirstOutputDevice() const;
+
+private:
+ DECL_DLLPRIVATE_LINK(ImpComeBackHdl, Timer*, void);
+
+protected:
+ sal_uInt16 ImpGetMinMovLogic(short nMinMov, const OutputDevice* pOut) const;
+ sal_uInt16 ImpGetHitTolLogic(short nHitTol, const OutputDevice* pOut) const;
+
+ // If one does not want to wait for the IdleState of the system (cheated as const)
+ void FlushComeBackTimer() const;
+ void TheresNewMapMode();
+ void ImpSetGlueVisible2(bool bOn) { if (mbGlueVisible2!=bOn) { mbGlueVisible2=bOn; if (!mbGlueVisible && !mbGlueVisible3 && !mbGlueVisible4) GlueInvalidate(); } }
+ void ImpSetGlueVisible3(bool bOn) { if (mbGlueVisible3!=bOn) { mbGlueVisible3=bOn; if (!mbGlueVisible && !mbGlueVisible2 && !mbGlueVisible4) GlueInvalidate(); } }
+ void ImpSetGlueVisible4(bool bOn) { if (mbGlueVisible4!=bOn) { mbGlueVisible4=bOn; if (!mbGlueVisible && !mbGlueVisible2 && !mbGlueVisible3) GlueInvalidate(); } }
+
+public:
+ bool ImpIsGlueVisible() const { return mbGlueVisible || mbGlueVisible2 || mbGlueVisible3 || mbGlueVisible4; }
+
+protected:
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+ void GlueInvalidate() const;
+
+ // ModelHasChanged is called, as soon as the system is idle again after many SdrHintKind::ObjectChange.
+ //
+ // Any sub-class override this method, MUST call the base class' ModelHasChanged() method
+ virtual void ModelHasChanged();
+
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ // A SdrView always needs a SdrModel for lifetime (Pool, ...)
+ SdrPaintView(SdrModel& rSdrModel, OutputDevice* pOut);
+ virtual ~SdrPaintView() override;
+
+public:
+ // SdrModel access on SdrView level
+ SdrModel& getSdrModelFromSdrView() const { return mrSdrModelFromSdrView; }
+
+ virtual void ClearPageView();
+ SdrModel* GetModel() const { return mpModel; }
+
+ virtual bool IsAction() const;
+ virtual void MovAction(const Point& rPnt);
+ virtual void EndAction();
+ virtual void BckAction();
+ virtual void BrkAction(); // Cancel all Actions (e.g. cancel dragging)
+ virtual void TakeActionRect(tools::Rectangle& rRect) const;
+
+ // Info about TextEdit. Default is sal_False.
+ virtual bool IsTextEdit() const;
+
+ // Must be called for every Window change as well as MapMode (Scaling) change:
+ // If the SdrView is shown in multiple windows at the same time (e.g.
+ // using the split pane), so that I can convert my pixel values to logical
+ // values.
+ void SetActualWin(const OutputDevice* pWin);
+ void SetMinMoveDistancePixel(sal_uInt16 nVal) { mnMinMovPix=nVal; TheresNewMapMode(); }
+ void SetHitTolerancePixel(sal_uInt16 nVal) { mnHitTolPix=nVal; TheresNewMapMode(); }
+ sal_uInt16 GetHitTolerancePixel() const { return mnHitTolPix; }
+
+ // Data read access on logic HitTolerance and MinMoveTolerance
+ sal_uInt16 getHitTolLog() const { return mnHitTolLog; }
+
+ // Using the DragState we can tell e.g. which distance was
+ // already dragged
+ const SdrDragStat& GetDragStat() const { return maDragStat; }
+
+ // Registering/de-registering a PageView at a View
+ //
+ // The same Page cannot be registered multiple times.
+ //
+ // Methods ending in PgNum expect being passed a Page number.
+ // Methods ending in PvNum, instead, expect the number of the
+ // PageView at the SdrView (iterating over all registered Pages).
+ virtual SdrPageView* ShowSdrPage(SdrPage* pPage);
+ virtual void HideSdrPage();
+
+ // Iterate over all registered PageViews
+ SdrPageView* GetSdrPageView() const { return mpPageView.get(); }
+
+ // A SdrView can be displayed on multiple Windows at the same time
+ virtual void AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pWindow);
+ virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
+
+ void SetLayerVisible(const OUString& rName, bool bShow);
+ bool IsLayerVisible(const OUString& rName) const;
+
+ void SetLayerLocked(const OUString& rName, bool bLock=true);
+ bool IsLayerLocked(const OUString& rName) const;
+
+ void SetLayerPrintable(const OUString& rName, bool bPrn);
+ bool IsLayerPrintable(const OUString& rName) const;
+
+ // PrePaint call forwarded from app windows
+ void PrePaint();
+
+
+ // Used internally for Draw/Impress/sch/chart2
+ virtual void CompleteRedraw(OutputDevice* pOut, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr);
+
+ // #i72889# used from CompleteRedraw() implementation internally, added to be able to do a complete redraw in single steps
+
+ // BeginCompleteRedraw returns (or even creates) a SdrPaintWindow which will then be used as the
+ // target for paints. Since paints may be buffered, use its GetTargetOutputDevice() method which will
+ // return the buffer in case it's buffered.
+ //
+ // DoCompleteRedraw then draws the DrawingLayer hierarchy
+ // EndCompleteRedraw does the necessary refreshes, paints text edit and overlay as well as destroys the
+ // SdrPaintWindow again, if needed.
+ // This means: the SdrPaintWindow is no longer safe after this closing call.
+ virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut);
+ void DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr);
+ virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer);
+
+
+ // Used for the other applications basctl/sc/sw which call DrawLayer at PageViews
+ // #i74769# Interface change to use common BeginCompleteRedraw/EndCompleteRedraw
+ // #i76114# bDisableIntersect disables intersecting rReg with the Window's paint region
+ SdrPaintWindow* BeginDrawLayers(OutputDevice* pOut, const vcl::Region& rReg, bool bDisableIntersect = false);
+
+ // Used when the region passed to BeginDrawLayers needs to be changed
+ void UpdateDrawLayersRegion(const OutputDevice* pOut, const vcl::Region& rReg);
+ void EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer);
+
+protected:
+
+ // Used to paint the form layer after the PreRender device is flushed (painted) to the window.
+ void ImpFormLayerDrawing( SdrPaintWindow& rPaintWindow );
+
+ static vcl::Region OptimizeDrawLayersRegion(const OutputDevice* pOut, const vcl::Region& rReg, bool bDisableIntersect);
+
+public:
+ /// Draw Page as a white area or not
+ bool IsPageVisible() const { return mbPageVisible; }
+
+ /// Draw Page shadow or not
+ bool IsPageShadowVisible() const { return mbPageShadowVisible; }
+
+ /// Draw Page as a white area or not
+ bool IsPageBorderVisible() const { return mbPageBorderVisible; }
+
+ /// Draw Border line or not
+ bool IsBordVisible() const { return mbBordVisible; }
+
+ /// Draw Grid or not
+ bool IsGridVisible() const { return mbGridVisible; }
+
+ /// Draw Grid in front of objects or behind them
+ bool IsGridFront() const { return mbGridFront ; }
+
+ /// Draw Help line of the Page or not
+ bool IsHlplVisible() const { return mbHlplVisible; }
+
+ /// Draw Help line in front of the objects or behind them
+ bool IsHlplFront() const { return mbHlplFront ; }
+
+ const Color& GetGridColor() const { return maGridColor;}
+ void SetPageVisible(bool bOn = true) { mbPageVisible=bOn; InvalidateAllWin(); }
+ void SetPageShadowVisible(bool bOn) { mbPageShadowVisible=bOn; InvalidateAllWin(); }
+ void SetPageBorderVisible(bool bOn = true) { mbPageBorderVisible=bOn; InvalidateAllWin(); }
+ void SetBordVisible(bool bOn = true) { mbBordVisible=bOn; InvalidateAllWin(); }
+ void SetGridVisible(bool bOn) { mbGridVisible=bOn; InvalidateAllWin(); }
+ void SetGridFront(bool bOn) { mbGridFront =bOn; InvalidateAllWin(); }
+ void SetHlplVisible(bool bOn = true) { mbHlplVisible=bOn; InvalidateAllWin(); }
+ void SetHlplFront(bool bOn) { mbHlplFront =bOn; InvalidateAllWin(); }
+ void SetGlueVisible(bool bOn = true) { if (mbGlueVisible!=bOn) { mbGlueVisible=bOn; if (!mbGlueVisible2 && !mbGlueVisible3 && !mbGlueVisible4) GlueInvalidate(); } }
+
+ bool IsPreviewRenderer() const { return mbPreviewRenderer; }
+ void SetPreviewRenderer(bool bOn) { mbPreviewRenderer=bOn; }
+
+ // Access methods for calc and sw hide object modes
+ bool getHideOle() const { return mbHideOle; }
+ bool getHideChart() const { return mbHideChart; }
+ bool getHideDraw() const { return mbHideDraw; }
+ bool getHideFormControl() const { return mbHideFormControl; }
+ void setHideOle(bool bNew) { if(bNew != mbHideOle) mbHideOle = bNew; }
+ void setHideChart(bool bNew) { if(bNew != mbHideChart) mbHideChart = bNew; }
+ void setHideDraw(bool bNew) { if(bNew != mbHideDraw) mbHideDraw = bNew; }
+ void setHideFormControl(bool bNew) { if(bNew != mbHideFormControl) mbHideFormControl = bNew; }
+
+ void SetGridCoarse(const Size& rSiz) { maGridBig=rSiz; }
+ void SetGridFine(const Size& rSiz) {
+ maGridFin=rSiz;
+ if (maGridFin.Height()==0) maGridFin.setHeight(maGridFin.Width());
+ if (mbGridVisible) InvalidateAllWin();
+ }
+ const Size& GetGridCoarse() const { return maGridBig; }
+ const Size& GetGridFine() const { return maGridFin; }
+
+ void InvalidateAllWin();
+ void InvalidateAllWin(const tools::Rectangle& rRect);
+
+ /// If the View should not call Invalidate() on the windows, override
+ /// the following 2 methods and do something else.
+ virtual void InvalidateOneWin(OutputDevice& rWin);
+ virtual void InvalidateOneWin(OutputDevice& rWin, const tools::Rectangle& rRect);
+
+ void SetActiveLayer(const OUString& rName) { maActualLayer=rName; }
+ const OUString& GetActiveLayer() const { return maActualLayer; }
+
+ /// Leave an object group of all visible Pages (like `chdir ..` in MS-DOS)
+ void LeaveOneGroup();
+
+ /// Leave all entered object groups of all visible Pages (like `chdir \` in MS-DOS)
+ void LeaveAllGroup();
+
+ /// Determine, whether Leave is useful or not
+ bool IsGroupEntered() const;
+
+ /// Default attributes at the View
+ /// Newly created objects are assigned these attributes by default when they are created.
+ void SetDefaultAttr(const SfxItemSet& rAttr, bool bReplaceAll);
+ const SfxItemSet& GetDefaultAttr() const { return maDefaultAttr; }
+ void SetDefaultStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
+
+ void SetNotPersistDefaultAttr(const SfxItemSet& rAttr);
+ void MergeNotPersistDefaultAttr(SfxItemSet& rAttr) const;
+
+ /// Execute a swap-in of e.g. graphics asynchronously.
+ /// This does not reload all graphics like Paint does, but kicks off
+ /// the loading there. When such an object is done loading, it is displayed.
+ /// TODO: Only works at the moment, if SwapGraphics is enabled in the model.
+ /// The default = false flag is non-persistent
+ bool IsSwapAsynchron() const { return mbSwapAsynchron; }
+ void SetSwapAsynchron(bool bJa=true) { mbSwapAsynchron=bJa; }
+ virtual bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin);
+
+ virtual bool MouseButtonDown(const MouseEvent& /*rMEvt*/, OutputDevice* /*pWin*/) { return false; }
+ virtual bool MouseButtonUp(const MouseEvent& /*rMEvt*/, OutputDevice* /*pWin*/) { return false; }
+ virtual bool MouseMove(const MouseEvent& /*rMEvt*/, OutputDevice* /*pWin*/) { return false; }
+ virtual bool RequestHelp(const HelpEvent& /*rHEvt*/) { return false; }
+ virtual bool Command(const CommandEvent& /*rCEvt*/, vcl::Window* /*pWin*/) { return false; }
+
+ void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
+
+ void SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
+ SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const;
+ void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
+
+ virtual void MakeVisible(const tools::Rectangle& rRect, vcl::Window& rWin);
+
+ /// For Plugins
+ /// Is called by the Paint of the OLE object
+ virtual void DoConnect(SdrOle2Obj* pOleObj);
+
+ /// Enable/disable animations for ::Paint
+ /// Is used by e.g. SdrGrafObj, if it contains an animation
+ /// Preventing automatic animation is needed for e.g. the presentation view
+ bool IsAnimationEnabled() const { return ( SdrAnimationMode::Animate == meAnimationMode ); }
+ void SetAnimationEnabled( bool bEnable=true );
+
+ /// Set/unset pause state for animations
+ void SetAnimationPause( bool bSet );
+
+ /// Mode when starting an animation in the Paint Handler:
+ /// 1. SdrAnimationMode::Animate (default): start animation normally
+ /// 2. SDR_ANIMATION_DONT_ANIMATE: only show the replacement picture
+ /// 3. SdrAnimationMode::Disable: don't start and don't show any replacement
+ void SetAnimationMode( const SdrAnimationMode eMode );
+
+ /// Must be called by the App when scrolling etc. in order for
+ /// an active FormControl to be moved too
+ void VisAreaChanged(const OutputDevice* pOut);
+ void VisAreaChanged();
+
+ bool IsPrintPreview() const { return mbPrintPreview; }
+ void SetPrintPreview(bool bOn = true) { mbPrintPreview=bOn; }
+
+ const svtools::ColorConfig& getColorConfig() const { return maColorConfig;}
+
+ void onChangeColorConfig();
+
+ // #103834# Set background color for svx at SdrPageViews
+ void SetApplicationBackgroundColor(Color aBackgroundColor);
+
+ // #103911# Set document color for svx at SdrPageViews
+ void SetApplicationDocumentColor(Color aDocumentColor);
+
+ // #i38135#
+ // Sets the timer for Object animations and restarts.
+ void SetAnimationTimer(sal_uInt32 nTime);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdpoev.hxx b/include/svx/svdpoev.hxx
new file mode 100644
index 000000000..8c0c8947c
--- /dev/null
+++ b/include/svx/svdpoev.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svxdllapi.h>
+#include <svx/svdedtv.hxx>
+
+#include <svx/ipolypolygoneditorcontroller.hxx>
+
+class SVXCORE_DLLPUBLIC SdrPolyEditView : public SdrEditView, public IPolyPolygonEditorController
+{
+ friend class SdrEditView;
+
+ bool bSetMarkedPointsSmoothPossible : 1;
+ bool bSetMarkedSegmentsKindPossible : 1;
+
+ SdrPathSmoothKind eMarkedPointsSmooth;
+ SdrPathSegmentKind eMarkedSegmentsKind;
+
+private:
+ SVX_DLLPRIVATE void ImpResetPolyPossibilityFlags();
+ SVX_DLLPRIVATE void ImpCheckPolyPossibilities();
+
+ typedef void (*PPolyTrFunc)(Point&, Point*, Point*, const void*, const void*, const void*, const void*);
+ SVX_DLLPRIVATE void ImpTransformMarkedPoints(PPolyTrFunc pTrFunc, const void* p1, const void* p2=nullptr, const void* p3=nullptr, const void* p4=nullptr);
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrPolyEditView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
+ virtual ~SdrPolyEditView() override;
+
+public:
+ bool IsSetMarkedPointsSmoothPossible() const override;
+ SdrPathSmoothKind GetMarkedPointsSmooth() const override;
+ void SetMarkedPointsSmooth(SdrPathSmoothKind eKind) override;
+
+ // A PolySegment can either be a segment or a Bézier curve
+ bool IsSetMarkedSegmentsKindPossible() const override;
+ SdrPathSegmentKind GetMarkedSegmentsKind() const override;
+ void SetMarkedSegmentsKind(SdrPathSegmentKind eKind) override;
+
+ // Probably Obj has been deleted afterwards
+ void DeleteMarkedPoints() override;
+ bool IsDeleteMarkedPointsPossible() const override;
+
+ void MoveMarkedPoints(const Size& rSiz);
+ void ResizeMarkedPoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ void RotateMarkedPoints(const Point& rRef, Degree100 nAngle);
+
+ // This probably creates an arbitrary amount of new objects
+ void RipUpAtMarkedPoints() override;
+ bool IsRipUpAtMarkedPointsPossible() const override;
+
+ // All marked Polylines are turned into polygons
+ // All open Bézier curves are turned into closed ones
+ bool IsOpenCloseMarkedObjectsPossible() const override;
+ SdrObjClosedKind GetMarkedObjectsClosedState() const override;
+
+ void CheckPolyPossibilitiesHelper( SdrMark* pM, bool& b1stSmooth, bool& b1stSegm, bool& bCurve, bool& bSmoothFuz, bool& bSegmFuz, basegfx::B2VectorContinuity& eSmooth );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdpool.hxx b/include/svx/svdpool.hxx
new file mode 100644
index 000000000..e61b6fe97
--- /dev/null
+++ b/include/svx/svdpool.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/xpool.hxx>
+#include <svx/svxdllapi.h>
+
+class XLineAttrSetItem;
+class XFillAttrSetItem;
+
+class SVXCORE_DLLPUBLIC SdrItemPool final : public XOutdevItemPool
+{
+public:
+ SdrItemPool(SfxItemPool* pMaster = nullptr);
+ SdrItemPool(const SdrItemPool& rPool);
+private:
+ virtual ~SdrItemPool() override;
+public:
+
+ virtual rtl::Reference<SfxItemPool> Clone() const override;
+ virtual bool GetPresentation(const SfxPoolItem& rItem,
+ MapUnit ePresentationMetric,
+ OUString& rText,
+ const IntlWrapper& rIntlWrapper) const override;
+
+ static OUString GetItemName(sal_uInt16 nWhich);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdsnpv.hxx b/include/svx/svdsnpv.hxx
new file mode 100644
index 000000000..1fd8fce3b
--- /dev/null
+++ b/include/svx/svdsnpv.hxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdpntv.hxx>
+#include <svx/svdhlpln.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/degree.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+/**
+ * Definition:
+ * - snap something means e.g. the mouse pointer or some marked objects in drag can be snapped
+ * - snap on something means you can e.g. snap on the grid or on auxiliary lines
+ *
+ *
+ * Basically, we only catch visible elements (borders, helper lines, connectors),
+ * with the exception of the grid. Likewise, we can only catch visible elements (i.e. connectors).
+ * We only catch on the grid, if nothing else is close by (magnetic behaviour).
+ *
+ * The cursor which is used during creation of objects, while dragging polygon points
+ * etc. (i.e. the mouse cursor) is always caught on all enabled catch alternatives (max 6).
+ *
+ * This is different, when moving selected objects. Instead of one mouse cursor, there are
+ * four alternatives, which can be caught at the selected objects:
+ * 1. the logically enclosing frame of every single object
+ * 2. the logically enclosing frame of all selected objects
+ * 3. highlighted points of all selected objects (polygon points, ...)
+ * 4. the connectors of the selected objects
+ *
+ * As the first and second case exclude each other (the second is a refinement of the first one)
+ * three alternatives remain, which are independent from each other. For 6 possible values for the
+ * caught ones, we would end up with max. 18 different possible combinations!
+ *
+ * Therefore, we introduce the following simplifications:
+ * 1. Connectors only catch on connectors
+ *
+ * Only max. 2*5+1 = 11 combinations remain for MoveDrag:
+ * 1-3. enclosing frame on grid/border/helper lines
+ * 4. enclosing frame on highlighted object points
+ * 5. enclosing frame on enclosing frame
+ * 6-8. highlighted points on grid/border/helper lines
+ * 7. highlighted points on highlighted object points
+ * 8-10. highlighted points on enclosing frame
+ * 11. connectors on connectors
+ *
+ * We test for all of these possible 11 combinations in the MouseMove event in the DragMove
+ * and those with the least need of correction are carried out.
+ *
+ * In the Resize() etc. methods we only catch the logically enclosing frame of the highlighted objects.
+ */
+
+/** Return value for SnapPos() method */
+enum class SdrSnap
+{
+ NOTSNAPPED = 0x00,
+ XSNAPPED = 0x01,
+ YSNAPPED = 0x02
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SdrSnap> : is_typed_flags<SdrSnap, 3> {};
+}
+
+// TODO SdrCrookMode::Stretch is not implemented yet!
+enum class SdrCrookMode {
+ Rotate,
+ Slant,
+ Stretch
+};
+
+
+// #114409#-1 Migrate PageOrigin
+class ImplPageOriginOverlay;
+
+class SVXCORE_DLLPUBLIC SdrSnapView : public SdrPaintView
+{
+protected:
+ // #114409#-1 Migrate PageOrigin
+ class ImplPageOriginOverlay* mpPageOriginOverlay;
+
+ // #114409#-2 Migrate HelpLine
+ class ImplHelpLineOverlay* mpHelpLineOverlay;
+
+ Size aMagnSiz;
+ Fraction aSnapWdtX;
+ Fraction aSnapWdtY;
+
+ sal_uInt16 nMagnSizPix;
+ Degree100 nSnapAngle;
+ Degree100 nEliminatePolyPointLimitAngle;
+
+ SdrCrookMode eCrookMode;
+
+ bool bSnapEnab : 1;
+ bool bGridSnap : 1;
+ bool bBordSnap : 1;
+ bool bHlplSnap : 1;
+ bool bOFrmSnap : 1;
+ bool bOPntSnap : 1;
+ bool bOConSnap : 1;
+ bool bMoveSnapOnlyTopLeft : 1; // Special for dialogeditor
+ bool bOrtho : 1;
+ bool bBigOrtho : 1;
+ bool bAngleSnapEnab : 1;
+ bool bMoveOnlyDragging : 1; // only move objects while Resize/Rotate/...
+ bool bSlantButShear : 1; // use slant instead of shear
+ bool bCrookNoContortion : 1; // no contorsion while Crook
+ bool bEliminatePolyPoints : 1;
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrSnapView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
+ virtual ~SdrSnapView() override;
+
+public:
+ virtual bool IsAction() const override;
+ virtual void MovAction(const Point& rPnt) override;
+ virtual void EndAction() override;
+ virtual void BckAction() override;
+ virtual void BrkAction() override; // break actions for derived classes e.g. interrupt dragging.
+ virtual void TakeActionRect(tools::Rectangle& rRect) const override;
+
+ void SetSnapGridWidth(const Fraction& rX, const Fraction& rY) { aSnapWdtX=rX; aSnapWdtY=rY; }
+ const Fraction& GetSnapGridWidthX() const { return aSnapWdtX; }
+ const Fraction& GetSnapGridWidthY() const { return aSnapWdtY; }
+
+ void SetSnapMagnetic(const Size& rSiz) { if (rSiz!=aMagnSiz) { aMagnSiz=rSiz; } }
+ void SetSnapMagneticPixel(sal_uInt16 nPix) { nMagnSizPix=nPix; }
+ sal_uInt16 GetSnapMagneticPixel() const { return nMagnSizPix; }
+
+ // RecalcLogicSnapMagnetic has to be called for every change of OutputDevices and every change of the MapMode!
+ void RecalcLogicSnapMagnetic(const OutputDevice& rOut) { SetSnapMagnetic(rOut.PixelToLogic(Size(nMagnSizPix,nMagnSizPix))); }
+ void SetActualWin(const OutputDevice* pWin) { SdrPaintView::SetActualWin(pWin); if (pWin!=nullptr) RecalcLogicSnapMagnetic(*pWin); }
+
+ // Coordinates referred to the view!
+ // Returnvalues are SdrSnap::NOTSNAPPED,SdrSnap::XSNAPPED,
+ // SdrSnap::YSNAPPED or SdrSnap::XYSNAPPED
+ SdrSnap SnapPos(Point& rPnt, const SdrPageView* pPV) const;
+ Point GetSnapPos(const Point& rPnt, const SdrPageView* pPV) const;
+ void CheckSnap(const Point& rPt, tools::Long& nBestXSnap, tools::Long& nBestYSnap, bool& bXSnapped, bool& bYSnapped) const;
+
+ // All attitudes to snap are persistent.
+ bool IsSnapEnabled() const { return bSnapEnab; }
+ bool IsGridSnap() const { return bGridSnap; } // Snap to grid
+ bool IsBordSnap() const { return bBordSnap; } // Snap to border
+ bool IsHlplSnap() const { return bHlplSnap; } // Snap to auxiliary line
+ bool IsOFrmSnap() const { return bOFrmSnap; } // Snap to LogFram from surrounding drawing objects
+ bool IsOPntSnap() const { return bOPntSnap; } // Snap to distinct points from surrounding drawing objects
+ bool IsOConSnap() const { return bOConSnap; } // Snap to connectors of the drawing objects
+ void SetSnapEnabled(bool bOn) { bSnapEnab=bOn; }
+ void SetGridSnap(bool bOn) { bGridSnap=bOn; }
+ void SetBordSnap(bool bOn) { bBordSnap=bOn; }
+ void SetHlplSnap(bool bOn) { bHlplSnap=bOn; }
+ void SetOFrmSnap(bool bOn) { bOFrmSnap=bOn; }
+ void SetOPntSnap(bool bOn) { bOPntSnap=bOn; }
+ void SetOConSnap(bool bOn) { bOConSnap=bOn; }
+
+ // Usually every 4 corners of Object-SnapRects are snapped for Move-Dragging.
+ // The following attitudes e.g. if you only want to snap the left corner on the top (e.g. DialogEditor)
+ // persistent, Default=FALSE.
+ void SetMoveSnapOnlyTopLeft(bool bOn) { bMoveSnapOnlyTopLeft=bOn; }
+ bool IsMoveSnapOnlyTopLeft() const { return bMoveSnapOnlyTopLeft; }
+
+ // #114409#-1 Migrate PageOrigin
+ void BegSetPageOrg(const Point& rPnt);
+ void MovSetPageOrg(const Point& rPnt);
+ void EndSetPageOrg();
+ void BrkSetPageOrg();
+ bool IsSetPageOrg() const { return (nullptr != mpPageOriginOverlay); }
+
+ // HitTest. If sal_True, in rnHelpLineNum is the number of the auxiliary line and in rpPv
+ // the appended PageView.
+ bool PickHelpLine(const Point& rPnt, short nTol, const OutputDevice& rOut, sal_uInt16& rnHelpLineNum, SdrPageView*& rpPV) const;
+
+ // Move of an available auxiliary line. Use nHelpLineNum and pPV from PickHelpLine.
+ bool BegDragHelpLine(sal_uInt16 nHelpLineNum, SdrPageView* pPV);
+ // interactive insertion of a new auxiliary line
+ void BegDragHelpLine(const Point& rPnt, SdrHelpLineKind eNewKind);
+ PointerStyle GetDraggedHelpLinePointer() const;
+
+ // change the type of auxiliary line while dragging
+ // void SetDraggedHelpLineKind(SdrHelpLineKind eNewKind);
+ void MovDragHelpLine(const Point& rPnt);
+ bool EndDragHelpLine();
+ void BrkDragHelpLine();
+ bool IsDragHelpLine() const { return (nullptr != mpHelpLineOverlay); }
+
+ // SnapAngle is for angles in circle, RotateDragging, ...
+ // The snapping of an angle is beared down, if it is switched off
+ // with SetAngleSnapEnabled(sal_False)
+ // The snapping angles is independent of snapping coordinates
+ // and so independent of the attitude IsSnapEnabled()
+ // Only values should be specified for them is applied:
+ // 36000 modulo nAngle = 0
+ // Implemented for:
+ // - Rotate (Dragging)
+ // - Shear (Dragging)
+ // - circular arc/-sector/-section angle (Create and Dragging)
+ // persistent.
+ void SetAngleSnapEnabled(bool bOn) { bAngleSnapEnab=bOn; }
+ bool IsAngleSnapEnabled() const { return bAngleSnapEnab; }
+ void SetSnapAngle(Degree100 nAngle) { nSnapAngle=nAngle; }
+ Degree100 GetSnapAngle() const { return nSnapAngle; }
+
+ // different effects from Ortho (depending on the context):
+ // - Create
+ // - only lines in 45deg grid
+ // - instead of rectangles squares are created
+ // - instead of ellipse circles are created
+ // - Dragging
+ // - general Dragging
+ // - Move only horizontal, vertical or 45deg
+ // - Resize proportional
+ // - Mirror: nothing
+ // - Shear without Resize
+ // - Crook without Resize
+ // - move handles
+ // - mirror axis only 45deg grid
+ // - object-specific Dragging
+ // - rectangle corner radius: nothing
+ // - circle object angle: nothing
+ // - line keeps while Dragging the angle and is only stretched/ contracted
+ // Default value for Ortho is off. persistent.
+ void SetOrtho(bool bOn) { bOrtho=bOn; } // incomplete
+ bool IsOrtho() const { return bOrtho; }
+
+ // BigOrtho is only relevant if Ortho is switched on.
+ // Example: rectangle is created and ortho is switched on (--> square)
+ // and the Mouse was dragged from zero to the coordinates
+ // (80,30). Now there are 2 alternatives to determine the edge length
+ // of the square: 30 and 80.
+ // The standard Ortho-Function took 30 (every time the smaller length)
+ // If BigOrtho is switched on, you get a square with edge length of 80.
+ // The same also applies to Resize.
+ // Default value for BigOrtho is on. persistent.
+ void SetBigOrtho(bool bOn) { bBigOrtho=bOn; }
+ bool IsBigOrtho() const { return bBigOrtho; }
+
+ // If MoveOnlyDragging=sal_True only the center of the marked objects is
+ // transformed when Resize/Rotate/Shear/Mirror/Crook is executed.
+ // Size, form and rotation angle of the objects are conserved only their positions
+ // are changed. persistent. Default=FALSE. (ni)
+ void SetMoveOnlyDragging(bool bOn) { bMoveOnlyDragging=bOn; }
+ bool IsMoveOnlyDragging() const { return bMoveOnlyDragging; }
+
+ // Use Slant instead of Shear. persistent. Default=FALSE.
+ void SetSlantButShear(bool bOn) { bSlantButShear=bOn; }
+ bool IsSlantButShear() const { return bSlantButShear; }
+
+ // Don't contort objecte while Crook. persistent. Default=FALSE. (ni)
+ void SetCrookNoContortion(bool bOn) { bCrookNoContortion=bOn; }
+ bool IsCrookNoContortion() const { return bCrookNoContortion; }
+
+ // Crook-Mode. persistent. Default=SdrCrookMode::Rotate. (ni)
+ void SetCrookMode(SdrCrookMode eMode) { eCrookMode=eMode; }
+ SdrCrookMode GetCrookMode() const { return eCrookMode; }
+
+ // Special for IBM: While Dragging of a traverse station, it is deleted
+ // if its adjacent lines are almost a solid line.
+ void SetEliminatePolyPoints(bool bOn) { bEliminatePolyPoints=bOn; }
+ bool IsEliminatePolyPoints() const { return bEliminatePolyPoints; }
+ void SetEliminatePolyPointLimitAngle(Degree100 nAngle) { nEliminatePolyPointLimitAngle=nAngle; }
+ Degree100 GetEliminatePolyPointLimitAngle() const { return nEliminatePolyPointLimitAngle; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdsob.hxx b/include/svx/svdsob.hxx
new file mode 100644
index 000000000..7e2b8578e
--- /dev/null
+++ b/include/svx/svdsob.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/Any.hxx>
+
+#include <svx/svxdllapi.h>
+#include <svx/svdtypes.hxx>
+
+/*
+ Stores a bitfield of the layer values that have been set.
+*/
+
+class SVXCORE_DLLPUBLIC SdrLayerIDSet final
+{
+ // For now, have up to 256 layers
+ sal_uInt8 aData[32];
+
+public:
+ explicit SdrLayerIDSet(bool bInitVal = false)
+ {
+ memset(aData, bInitVal ? 0xFF : 0x00, sizeof(aData));
+ }
+
+ bool operator!=(const SdrLayerIDSet& rCmpSet) const
+ {
+ return (memcmp(aData, rCmpSet.aData, sizeof(aData))!=0);
+ }
+
+ void Set(SdrLayerID a)
+ {
+ const sal_Int16 nId = a.get();
+ if (nId >= 0 && nId < 256)
+ aData[nId / 8] |= 1 << (nId % 8);
+ }
+
+ void Clear(SdrLayerID a)
+ {
+ const sal_Int16 nId = a.get();
+ if (nId >= 0 && nId < 256)
+ aData[nId / 8] &= ~(1 << (nId % 8));
+ }
+
+ void Set(SdrLayerID a, bool b)
+ {
+ if(b)
+ Set(a);
+ else
+ Clear(a);
+ }
+
+ bool IsSet(SdrLayerID a) const
+ {
+ const sal_Int16 nId = a.get();
+ return nId >= 0 && nId < 256 && (aData[nId / 8] & 1 << nId % 8) != 0;
+ }
+
+ void SetAll()
+ {
+ memset(aData, 0xFF, sizeof(aData));
+ }
+
+ void ClearAll()
+ {
+ memset(aData, 0x00, sizeof(aData));
+ }
+
+ bool IsEmpty() const;
+
+ void operator&=(const SdrLayerIDSet& r2ndSet);
+
+ // initialize this set with a UNO sequence of sal_Int8 (e.g. as stored in settings.xml)
+ void PutValue(const css::uno::Any & rAny);
+
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdtext.hxx b/include/svx/svdtext.hxx
new file mode 100644
index 000000000..f8e6a40da
--- /dev/null
+++ b/include/svx/svdtext.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <editeng/outlobj.hxx>
+#include <svx/sdr/properties/defaultproperties.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/weakbase.hxx>
+
+class OutlinerParaObject;
+class SdrOutliner;
+class SdrTextObj;
+class SdrModel;
+class SfxItemSet;
+enum class OutlinerMode;
+
+namespace sdr::properties
+{
+class TextProperties;
+}
+
+/** This class stores information about one text inside a shape.
+*/
+
+class SfxStyleSheet;
+class SVXCORE_DLLPUBLIC SdrText : public tools::WeakBase
+{
+public:
+ explicit SdrText(SdrTextObj& rObject);
+ virtual ~SdrText() override;
+
+ void ForceOutlinerParaObject(OutlinerMode nOutlMode);
+
+ virtual void SetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject);
+ OutlinerParaObject* GetOutlinerParaObject();
+ const OutlinerParaObject* GetOutlinerParaObject() const;
+
+ void CheckPortionInfo(const SdrOutliner& rOutliner);
+ void ReformatText();
+
+ // default uses GetObjectItemSet, but may be overridden to
+ // return a text-specific ItemSet
+ const SfxItemSet& GetItemSet() const;
+
+ // This class does not need an own SdrModel reference - always
+ // has the SdrTextObj working with so can use SdrModel::getSdrModelFromSdrObject()
+ SdrTextObj& GetObject() const { return mrObject; }
+
+ /** returns the current OutlinerParaObject and removes it from this instance */
+ std::optional<OutlinerParaObject> RemoveOutlinerParaObject();
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+protected:
+ virtual const SfxItemSet& GetObjectItemSet();
+ virtual SfxStyleSheet* GetStyleSheet() const;
+
+private:
+ std::optional<OutlinerParaObject> mpOutlinerParaObject;
+ SdrTextObj& mrObject;
+ bool mbPortionInfoChecked;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx
new file mode 100644
index 000000000..67741e777
--- /dev/null
+++ b/include/svx/svdtrans.hxx
@@ -0,0 +1,286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/degree.hxx>
+#include <tools/fldunit.hxx>
+#include <tools/fract.hxx>
+#include <tools/gen.hxx>
+#include <tools/helpers.hxx>
+#include <tools/mapunit.hxx>
+#include <tools/poly.hxx>
+
+// That maximum shear angle
+constexpr Degree100 SDRMAXSHEAR(8900);
+
+class XPolygon;
+class XPolyPolygon;
+
+inline void MovePoly(tools::Polygon& rPoly, const Size& S) { rPoly.Move(S.Width(),S.Height()); }
+void MoveXPoly(XPolygon& rPoly, const Size& S);
+
+SVXCORE_DLLPUBLIC void ResizeRect(tools::Rectangle& rRect, const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+inline void ResizePoint(Point& rPnt, const Point& rRef, const Fraction& xFract, const Fraction& yFract);
+void ResizePoly(tools::Polygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+
+inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs);
+SVXCORE_DLLPUBLIC void RotatePoly(tools::Polygon& rPoly, const Point& rRef, double sn, double cs);
+void RotateXPoly(XPolygon& rPoly, const Point& rRef, double sn, double cs);
+void RotateXPoly(XPolyPolygon& rPoly, const Point& rRef, double sn, double cs);
+
+void MirrorPoint(Point& rPnt, const Point& rRef1, const Point& rRef2);
+void MirrorXPoly(XPolygon& rPoly, const Point& rRef1, const Point& rRef2);
+
+inline void ShearPoint(Point& rPnt, const Point& rRef, double tn, bool bVShear = false);
+SVXCORE_DLLPUBLIC void ShearPoly(tools::Polygon& rPoly, const Point& rRef, double tn);
+void ShearXPoly(XPolygon& rPoly, const Point& rRef, double tn, bool bVShear = false);
+
+/**
+ * rPnt.X/rPnt.Y is set to rCenter.X or rCenter.Y!
+ * We then only need to rotate rPnt by rCenter.
+ *
+ * @return the returned angle is in rad
+ */
+inline double GetCrookAngle(Point& rPnt, const Point& rCenter, const Point& rRad, bool bVertical);
+
+/**
+ * The following methods accept a point of an XPolygon, whereas the neighbouring
+ * control points of the actual point are passed in pC1/pC2.
+ * Via rSin/rCos, sin(nAngle) and cos(nAngle) are returned.
+ *
+ * @return the returned angle is in rad
+ */
+double CrookRotateXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCenter,
+ const Point& rRad, double& rSin, double& rCos, bool bVert);
+double CrookSlantXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCenter,
+ const Point& rRad, double& rSin, double& rCos, bool bVert);
+double CrookStretchXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCenter,
+ const Point& rRad, double& rSin, double& rCos, bool bVert,
+ const tools::Rectangle& rRefRect);
+
+void CrookRotatePoly(XPolygon& rPoly, const Point& rCenter, const Point& rRad, bool bVert);
+void CrookSlantPoly(XPolygon& rPoly, const Point& rCenter, const Point& rRad, bool bVert);
+void CrookStretchPoly(XPolygon& rPoly, const Point& rCenter, const Point& rRad, bool bVert, const tools::Rectangle& rRefRect);
+
+void CrookRotatePoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rRad, bool bVert);
+void CrookSlantPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rRad, bool bVert);
+void CrookStretchPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rRad, bool bVert, const tools::Rectangle& rRefRect);
+
+/**************************************************************************************************/
+/* Inline */
+/**************************************************************************************************/
+
+inline void ResizePoint(Point& rPnt, const Point& rRef, const Fraction& xFract, const Fraction& yFract)
+{
+ double nxFract = xFract.IsValid() ? static_cast<double>(xFract) : 1.0;
+ double nyFract = yFract.IsValid() ? static_cast<double>(yFract) : 1.0;
+ rPnt.setX(rRef.X() + FRound( (rPnt.X() - rRef.X()) * nxFract ));
+ rPnt.setY(rRef.Y() + FRound( (rPnt.Y() - rRef.Y()) * nyFract ));
+}
+
+inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs)
+{
+ tools::Long dx=rPnt.X()-rRef.X();
+ tools::Long dy=rPnt.Y()-rRef.Y();
+ rPnt.setX(FRound(rRef.X()+dx*cs+dy*sn));
+ rPnt.setY(FRound(rRef.Y()+dy*cs-dx*sn));
+}
+
+inline void ShearPoint(Point& rPnt, const Point& rRef, double tn, bool bVShear)
+{
+ if (!bVShear) { // Horizontal
+ if (rPnt.Y()!=rRef.Y()) { // else not needed
+ rPnt.AdjustX(-FRound((rPnt.Y()-rRef.Y())*tn));
+ }
+ } else { // or else vertical
+ if (rPnt.X()!=rRef.X()) { // else not needed
+ rPnt.AdjustY(-FRound((rPnt.X()-rRef.X())*tn));
+ }
+ }
+}
+
+inline double GetCrookAngle(Point& rPnt, const Point& rCenter, const Point& rRad, bool bVertical)
+{
+ double nAngle;
+ if (bVertical) {
+ tools::Long dy=rPnt.Y()-rCenter.Y();
+ nAngle=static_cast<double>(dy)/static_cast<double>(rRad.Y());
+ rPnt.setY(rCenter.Y());
+ } else {
+ tools::Long dx=rCenter.X()-rPnt.X();
+ nAngle=static_cast<double>(dx)/static_cast<double>(rRad.X());
+ rPnt.setX(rCenter.X());
+ }
+ return nAngle;
+}
+
+/**************************************************************************************************/
+/**************************************************************************************************/
+
+/**
+ * The Y axis points down!
+ * The function negates the Y axis, when calculating the angle, such
+ * that GetAngle(Point(0,-1))=90 deg.
+ * GetAngle(Point(0,0)) returns 0.
+ *
+ * @return the returned value is in the range of -180.00..179.99 deg
+ * and is in 1/100 deg units
+ */
+SVXCORE_DLLPUBLIC Degree100 GetAngle(const Point& rPnt);
+
+Degree100 NormAngle18000(Degree100 a); /// Normalize angle to -180.00..179.99
+
+SVXCORE_DLLPUBLIC Degree100 NormAngle36000(Degree100 a); /// Normalize angle to 0.00..359.99
+
+sal_uInt16 GetAngleSector(Degree100 nAngle); /// Determine sector within the cartesian coordinate system
+
+/**
+ * Calculates the length of (0,0) via a^2 + b^2 = c^2
+ * In order to avoid overflows, we ignore some decimal places.
+ */
+tools::Long GetLen(const Point& rPnt);
+
+/**
+ * The transformation of a rectangle into a polygon, by
+ * using angle parameters from GeoStat. ------------
+ * The point of reference is always the Point 0, meaning /1 2/
+ * the upper left corner of the initial rectangle. / /
+ * When calculating the polygon, the order is first / /
+ * shear and then the rotation. / /
+ * / / \
+ * / / |
+ * A) Initial rectangle aRect B) After applying Shear /0 3/ Rot|
+ * +------------------+ -------------------- ------------------
+ * |0 1| \0 1\ C) After applying Rotate
+ * | | \ \
+ * | | | \ \
+ * |3 2| | \3 2\
+ * +------------------+ | --------------------
+ * |Shr
+ *
+ * When converting the polygon back into a rect, the order is necessarily the
+ * other way around:
+ * - Calculating the rotation angle: angle of the line 0-1 in figure C) to the horizontal
+ * - Turning the sheared rect back (we get figure B)
+ * - Determining the width of the rect = length of the line 0-1 in figure B)
+ * - Determining the height of the rect = vertical distance between the points 0 and 3
+ * of figure B)
+ * - Determining the shear angle from the line 0-3 to the perpendicular line.
+ *
+ * We need to keep in mind that the polygon can be mirrored when it was
+ * transformed in the meantime (e.g. mirror or resize with negative factor).
+ * In that case, we first need to normalize, by swapping points (0 with 3 and 1
+ * with 2), so that it has the right orientation.
+ *
+ * Note: a positive shear angle means a shear with a positive visible curvature
+ * on the screen. Mathematically, that would be a negative curvature, as the
+ * Y axis runs from top to bottom on the screen.
+ * Rotation angle: positive means a visible left rotation.
+ */
+
+class GeoStat { // Geometric state for a rect
+public:
+ Degree100 nRotationAngle;
+ Degree100 nShearAngle;
+ double mfTanShearAngle; // tan(nShearAngle)
+ double mfSinRotationAngle; // sin(nRotationAngle)
+ double mfCosRotationAngle; // cos(nRotationAngle)
+
+ GeoStat(): nRotationAngle(0),nShearAngle(0),mfTanShearAngle(0.0),mfSinRotationAngle(0.0),mfCosRotationAngle(1.0) {}
+ void RecalcSinCos();
+ void RecalcTan();
+};
+
+tools::Polygon Rect2Poly(const tools::Rectangle& rRect, const GeoStat& rGeo);
+void Poly2Rect(const tools::Polygon& rPol, tools::Rectangle& rRect, GeoStat& rGeo);
+
+void OrthoDistance8(const Point& rPt0, Point& rPt, bool bBigOrtho);
+void OrthoDistance4(const Point& rPt0, Point& rPt, bool bBigOrtho);
+
+// Multiplication and subsequent division
+// Calculation and intermediate values are in BigInt
+SVXCORE_DLLPUBLIC tools::Long BigMulDiv(tools::Long nVal, tools::Long nMul, tools::Long nDiv);
+
+class FrPair {
+ Fraction aX;
+ Fraction aY;
+public:
+ FrPair(const Fraction& rBoth) : aX(rBoth),aY(rBoth) {}
+ FrPair(const Fraction& rX, const Fraction& rY) : aX(rX),aY(rY) {}
+ FrPair(tools::Long nMul, tools::Long nDiv) : aX(nMul,nDiv),aY(nMul,nDiv) {}
+ FrPair(tools::Long xMul, tools::Long xDiv, tools::Long yMul, tools::Long yDiv): aX(xMul,xDiv),aY(yMul,yDiv) {}
+ const Fraction& X() const { return aX; }
+ const Fraction& Y() const { return aY; }
+ Fraction& X() { return aX; }
+ Fraction& Y() { return aY; }
+};
+
+// To convert units of measurement
+SVXCORE_DLLPUBLIC FrPair GetMapFactor(MapUnit eS, MapUnit eD);
+FrPair GetMapFactor(FieldUnit eS, FieldUnit eD);
+
+inline bool IsMetric(MapUnit eU) {
+ return (eU==MapUnit::Map100thMM || eU==MapUnit::Map10thMM || eU==MapUnit::MapMM || eU==MapUnit::MapCM);
+}
+
+inline bool IsInch(MapUnit eU) {
+ return (eU==MapUnit::Map1000thInch || eU==MapUnit::Map100thInch || eU==MapUnit::Map10thInch || eU==MapUnit::MapInch ||
+ eU==MapUnit::MapPoint || eU==MapUnit::MapTwip);
+}
+
+inline bool IsMetric(FieldUnit eU) {
+ return (eU == FieldUnit::MM || eU == FieldUnit::CM || eU == FieldUnit::M
+ || eU == FieldUnit::KM || eU == FieldUnit::MM_100TH);
+}
+
+inline bool IsInch(FieldUnit eU) {
+ return (eU == FieldUnit::TWIP || eU == FieldUnit::POINT
+ || eU == FieldUnit::PICA || eU == FieldUnit::INCH
+ || eU == FieldUnit::FOOT || eU == FieldUnit::MILE);
+}
+
+class SVXCORE_DLLPUBLIC SdrFormatter {
+ tools::Long nMul_;
+ tools::Long nDiv_;
+ short nComma_;
+ bool bDirty;
+ MapUnit eSrcMU;
+ MapUnit eDstMU;
+private:
+ SVX_DLLPRIVATE void Undirty();
+public:
+ SdrFormatter(MapUnit eSrc, MapUnit eDst)
+ : nMul_(0)
+ , nDiv_(0)
+ , nComma_(0)
+ , bDirty(true)
+ , eSrcMU(eSrc)
+ , eDstMU(eDst)
+ {
+ }
+ OUString GetStr(tools::Long nVal) const;
+ static OUString GetUnitStr(MapUnit eUnit);
+ static OUString GetUnitStr(FieldUnit eUnit);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdtypes.hxx b/include/svx/svdtypes.hxx
new file mode 100644
index 000000000..1009b0314
--- /dev/null
+++ b/include/svx/svdtypes.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <o3tl/strong_int.hxx>
+
+// commands for EndCreate()
+enum class SdrCreateCmd
+{
+ NextPoint, // next traverse station, segment of a circle: next coordinate
+ NextObject, // next polygon in PolyPolygon
+ ForceEnd // forced end
+};
+
+enum class SdrDragMode
+{
+ Move,
+ Resize,
+ Rotate,
+ Mirror,
+ Shear,
+ Crook,
+
+ // new modes for interactive transparence and gradient tools
+ Transparence,
+ Gradient,
+
+ // new mode for interactive cropping of graphics
+ Crop
+};
+
+/*
+ * Layer
+ */
+// You can use this value in the methods of SdrLayerSet, but false is returned
+// every time or the method does nothing.
+// type declaration for Layer-IDs
+typedef o3tl::strong_int<sal_Int16, struct SdrLayerIDTag> SdrLayerID;
+
+// If there is no layer when it should be identified, then
+// SdrLayerAdmin::GetLayerID(const String&) returns a value.
+constexpr SdrLayerID SDRLAYER_NOTFOUND(-1);
+
+/*
+ * Repeat
+ */
+enum class SdrRepeatFunc
+{
+ NONE,
+ // with parameter
+ Move, // distance
+ Resize, // factor, reference(%) related to MarkRect
+ Rotate, // rotation angle, reference(%) related to MarkRect
+ // Without parameter
+ Delete,
+ CombinePolyPoly,
+ CombineOnePoly,
+ DismantlePolys,
+ DismantleLines,
+ ConvertToPoly,
+ ConvertToPath,
+ Group,
+ Ungroup,
+ PutToTop,
+ PutToBottom,
+ MoveToTop,
+ MoveToBottom,
+ ReverseOrder,
+ ImportMtf,
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
new file mode 100644
index 000000000..01b4f6749
--- /dev/null
+++ b/include/svx/svdundo.hxx
@@ -0,0 +1,785 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <sal/config.h>
+
+#include <memory>
+#include <vector>
+
+#include <editeng/outlobj.hxx>
+#include <svl/itemset.hxx>
+#include <svl/undo.hxx>
+#include <svl/style.hxx>
+#include <tools/gen.hxx>
+#include <svx/svdtypes.hxx>
+#include <svx/svdsob.hxx>
+#include <svx/svxdllapi.h>
+#include <unotools/resmgr.hxx>
+
+class SfxItemSet;
+class SfxPoolItem;
+class SfxStyleSheet;
+class SdrView;
+class SdrPageView;
+class SdrModel;
+class SdrObject;
+class SdrPage;
+class SdrObjList;
+class SdrLayer;
+class SdrLayerAdmin;
+class SdrObjGeoData;
+class OutlinerParaObject;
+
+namespace svx { namespace diagram {
+ class DiagramDataState;
+}}
+
+/**
+ * Abstract base class (ABC) for all UndoActions of DrawingEngine
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoAction : public SfxUndoAction
+{
+protected:
+ SdrModel& rMod;
+ ViewShellId m_nViewShellId;
+
+protected:
+ SdrUndoAction(SdrModel& rNewMod);
+
+public:
+ virtual ~SdrUndoAction() override;
+
+ virtual bool CanRepeat(SfxRepeatTarget& rView) const override;
+ virtual void Repeat(SfxRepeatTarget& rView) override;
+
+ virtual OUString GetRepeatComment(SfxRepeatTarget& rView) const override;
+ virtual OUString GetSdrRepeatComment() const;
+
+ virtual bool CanSdrRepeat(SdrView& rView) const;
+ virtual void SdrRepeat(SdrView& rView);
+
+ /// See SfxUndoAction::GetViewShellId().
+ ViewShellId GetViewShellId() const override;
+};
+
+/**
+ * Aggregation of arbitrarily many UndoActions to a single UndoAction.
+ * Undo() executes the single UndoActions backwards (LIFO, first the last
+ * ones attached), Redo() executes the UndoActions in the order they were
+ * added (FIFO).
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoGroup final : public SdrUndoAction
+{
+ std::vector<std::unique_ptr<SdrUndoAction>> maActions;
+
+ // No expanded description of the Action (contains %O)
+ OUString aComment;
+ OUString aObjDescription;
+
+ SdrRepeatFunc eFunction;
+
+public:
+ SdrUndoGroup(SdrModel& rNewMod);
+ virtual ~SdrUndoGroup() override;
+
+ sal_Int32 GetActionCount() const { return maActions.size(); }
+ SdrUndoAction* GetAction(sal_Int32 nNum) const { return maActions[nNum].get(); }
+ void AddAction(std::unique_ptr<SdrUndoAction> pAct);
+
+ void SetComment(const OUString& rStr) { aComment=rStr; }
+ void SetObjDescription(const OUString& rStr) { aObjDescription=rStr; }
+ virtual OUString GetComment() const override;
+ virtual OUString GetSdrRepeatComment() const override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual bool CanSdrRepeat(SdrView& rView) const override;
+ virtual void SdrRepeat(SdrView& rView) override;
+ void SetRepeatFunction(SdrRepeatFunc eFunc) { eFunction=eFunc; }
+};
+
+/**
+ * Abstract base class for all UndoActions that handle objects.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoObj : public SdrUndoAction
+{
+protected:
+ SdrObject* pObj;
+
+protected:
+ SdrUndoObj(SdrObject& rNewObj);
+
+ OUString ImpGetDescriptionStr(TranslateId pStrCacheID, bool bRepeat = false) const;
+
+ [[nodiscard]] static OUString GetDescriptionStringForObject( const SdrObject& _rForObject, TranslateId pStrCacheID, bool bRepeat = false );
+
+ // #94278# new method for evtl. PageChange at UNDO/REDO
+ void ImpShowPageOfThisObject();
+};
+
+/**
+ * Changing the object attributes.
+ * Create Action right before setting the new attributes.
+ * Also for StyleSheets.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoAttrObj : public SdrUndoObj
+{
+protected:
+ std::optional<SfxItemSet> moUndoSet;
+ std::optional<SfxItemSet> moRedoSet;
+
+ // FIXME: Or should we better remember the StyleSheetNames?
+ rtl::Reference< SfxStyleSheetBase > mxUndoStyleSheet;
+ rtl::Reference< SfxStyleSheetBase > mxRedoStyleSheet;
+ bool bStyleSheet;
+ bool bHaveToTakeRedoSet;
+
+ // When assigning TextItems to a drawing object with text:
+ std::optional<OutlinerParaObject> pTextUndo;
+ // #i8508#
+ // The text rescue mechanism needs also to be implemented for redo actions.
+ std::optional<OutlinerParaObject> pTextRedo;
+
+ // If we have a group object:
+ std::unique_ptr<SdrUndoGroup> pUndoGroup;
+
+ // Helper to ensure StyleSheet is in pool (provided by SdrModel from SdrObject)
+ static void ensureStyleSheetInStyleSheetPool(SfxStyleSheetBasePool& rStyleSheetPool, SfxStyleSheet& rSheet);
+
+public:
+ SdrUndoAttrObj(SdrObject& rNewObj, bool bStyleSheet1 = false, bool bSaveText = false);
+ virtual ~SdrUndoAttrObj() override;
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+ virtual OUString GetSdrRepeatComment() const override;
+};
+
+/**
+ * Only moving of an object.
+ * Create Action right before moving.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoMoveObj final : public SdrUndoObj
+{
+ Size aDistance; // Distance by which we move
+
+public:
+ SdrUndoMoveObj(SdrObject& rNewObj, const Size& rDist): SdrUndoObj(rNewObj),aDistance(rDist) {}
+ virtual ~SdrUndoMoveObj() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+ virtual OUString GetSdrRepeatComment() const override;
+
+ virtual void SdrRepeat(SdrView& rView) override;
+ virtual bool CanSdrRepeat(SdrView& rView) const override;
+};
+
+/**
+ * Changing the geometry of an object.
+ * Create Action right before the geometric transformation.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoGeoObj : public SdrUndoObj
+{
+ std::unique_ptr<SdrObjGeoData> pUndoGeo;
+ std::unique_ptr<SdrObjGeoData> pRedoGeo;
+ // If we have a group object:
+ std::unique_ptr<SdrUndoGroup> pUndoGroup;
+ /// If we have a table object, should its layout change?
+ bool mbSkipChangeLayout;
+
+public:
+ SdrUndoGeoObj(SdrObject& rNewObj);
+ virtual ~SdrUndoGeoObj() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+ void SetSkipChangeLayout(bool bOn) { mbSkipChangeLayout=bOn; }
+};
+
+// Diagram ModelData changes
+class SVXCORE_DLLPUBLIC SdrUndoDiagramModelData : public SdrUndoObj
+{
+ std::shared_ptr< svx::diagram::DiagramDataState > m_aStartState;
+ std::shared_ptr< svx::diagram::DiagramDataState > m_aEndState;
+
+ void implUndoRedo(bool bUndo);
+
+public:
+ SdrUndoDiagramModelData(SdrObject& rNewObj, std::shared_ptr< svx::diagram::DiagramDataState >& rStartState);
+ virtual ~SdrUndoDiagramModelData() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+};
+
+/**
+ * Manipulation of an ObjList: New Object, DeleteObj, SetObjZLevel, Grouping, ...
+ * Abstract base class.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoObjList : public SdrUndoObj {
+ class ObjListListener;
+ friend class ObjListListener;
+
+private:
+ bool bOwner;
+
+protected:
+ SdrObjList* pObjList;
+ sal_uInt32 nOrdNum;
+
+protected:
+ SdrUndoObjList(SdrObject& rNewObj, bool bOrdNumDirect);
+ virtual ~SdrUndoObjList() override;
+
+ bool IsOwner() const { return bOwner; }
+ void SetOwner(bool bNew);
+};
+
+/**
+ * Removing an Object from an ObjectList.
+ * To be used with corresponding Inserts within a UndoGroup.
+ *
+ * Create Action before removing from the ObjList.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoRemoveObj : public SdrUndoObjList
+{
+public:
+ SdrUndoRemoveObj(SdrObject& rNewObj, bool bOrdNumDirect = false)
+ : SdrUndoObjList(rNewObj,bOrdNumDirect) {}
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual ~SdrUndoRemoveObj() override;
+};
+
+/**
+ * Inserting Objects into an ObjectList.
+ * Use with corresponding Removes within an UndoGroup.
+ * Create Action before removal from ObjList.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoInsertObj : public SdrUndoObjList
+{
+public:
+ SdrUndoInsertObj(SdrObject& rNewObj, bool bOrdNumDirect = false)
+ : SdrUndoObjList(rNewObj,bOrdNumDirect) {}
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+};
+
+/**
+ * Deleting an Object.
+ * Create Action before removing from ObjList.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoDelObj : public SdrUndoRemoveObj
+{
+public:
+ SdrUndoDelObj(SdrObject& rNewObj, bool bOrdNumDirect = false);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+ virtual OUString GetSdrRepeatComment() const override;
+
+ virtual void SdrRepeat(SdrView& rView) override;
+ virtual bool CanSdrRepeat(SdrView& rView) const override;
+};
+
+/**
+ * Inserting a NEW Object.
+ * Create Action after insertion into the ObjList.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoNewObj : public SdrUndoInsertObj
+{
+public:
+ SdrUndoNewObj(SdrObject& rNewObj, bool bOrdNumDirect = false)
+ : SdrUndoInsertObj(rNewObj,bOrdNumDirect) {}
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+
+ static OUString GetComment(const SdrObject& _rForObject);
+};
+
+/**
+ * Replacing an Object.
+ * Create Action before Replace in ObjList.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoReplaceObj : public SdrUndoObj
+{
+ bool bOldOwner;
+ bool bNewOwner;
+
+ SdrObjList* pObjList;
+ SdrObject* pNewObj;
+
+public:
+ SdrUndoReplaceObj(SdrObject& rOldObj1, SdrObject& rNewObj1);
+ virtual ~SdrUndoReplaceObj() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ bool IsNewOwner() const { return bNewOwner; }
+ void SetNewOwner(bool bNew);
+
+ bool IsOldOwner() const { return bOldOwner; }
+ void SetOldOwner(bool bNew);
+};
+
+/**
+ * Copying an Object.
+ * Create Action before inserting into the ObjList.
+ */
+
+class SdrUndoCopyObj final : public SdrUndoNewObj
+{
+public:
+ SdrUndoCopyObj(SdrObject& rNewObj, bool bOrdNumDirect)
+ : SdrUndoNewObj(rNewObj,bOrdNumDirect) {}
+
+ virtual OUString GetComment() const override;
+};
+
+class SdrUndoObjOrdNum final : public SdrUndoObj
+{
+ sal_uInt32 nOldOrdNum;
+ sal_uInt32 nNewOrdNum;
+
+public:
+ SdrUndoObjOrdNum(SdrObject& rNewObj, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+};
+
+class SdrUndoSort final : public SdrUndoAction
+{
+private:
+ ::std::vector<sal_Int32> m_OldSortOrder;
+ ::std::vector<sal_Int32> m_NewSortOrder;
+ sal_uInt16 const m_nPage;
+
+ void Do(::std::vector<sal_Int32> & rSortOrder);
+
+public:
+ SdrUndoSort(const SdrPage & rPage,
+ ::std::vector<sal_Int32> const& rSortOrder);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+};
+
+// #i11702#
+
+class SVXCORE_DLLPUBLIC SdrUndoObjectLayerChange final : public SdrUndoObj
+{
+ SdrLayerID maOldLayer;
+ SdrLayerID maNewLayer;
+
+public:
+ SdrUndoObjectLayerChange(SdrObject& rObj, SdrLayerID aOldLayer, SdrLayerID aNewLayer);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+};
+
+class SVXCORE_DLLPUBLIC SdrUndoObjSetText : public SdrUndoObj
+{
+protected:
+ std::optional<OutlinerParaObject>
+ pOldText;
+ std::optional<OutlinerParaObject>
+ pNewText;
+ bool bNewTextAvailable;
+ bool bEmptyPresObj;
+ sal_Int32 mnText;
+
+public:
+ SdrUndoObjSetText(SdrObject& rNewObj, sal_Int32 nText );
+ virtual ~SdrUndoObjSetText() override;
+
+ bool IsDifferent() const;
+ void AfterSetText();
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+ virtual OUString GetSdrRepeatComment() const override;
+
+ virtual void SdrRepeat(SdrView& rView) override;
+ virtual bool CanSdrRepeat(SdrView& rView) const override;
+};
+
+/**
+ * Implement Title/Description Elements UI for Writer
+ * text frames, graphics and embedded objects (#i73249#)
+ */
+class SdrUndoObjStrAttr final : public SdrUndoObj
+{
+public:
+ enum class ObjStrAttrType
+ {
+ Name,
+ Title,
+ Description
+ };
+
+ SdrUndoObjStrAttr( SdrObject& rNewObj,
+ const ObjStrAttrType eObjStrAttr,
+ const OUString& sOldStr,
+ const OUString& sNewStr);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ const ObjStrAttrType meObjStrAttr;
+ const OUString msOldStr;
+ const OUString msNewStr;
+
+};
+
+
+/*
+ * Layer
+ */
+
+/**
+ * Abstract base class for all UndoActions that have something to do with SdrLayer.
+ */
+
+class SdrUndoLayer : public SdrUndoAction
+{
+protected:
+ SdrLayer* pLayer;
+ SdrLayerAdmin* pLayerAdmin;
+ sal_uInt16 nNum;
+ bool bItsMine;
+
+protected:
+ SdrUndoLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
+ virtual ~SdrUndoLayer() override;
+};
+
+/**
+ * Inserting a new Layer.
+ * Create Action after Insertion.
+ */
+
+class SdrUndoNewLayer final : public SdrUndoLayer
+{
+public:
+ SdrUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
+ : SdrUndoLayer(nLayerNum,rNewLayerAdmin,rNewModel) {}
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+};
+
+/**
+ * Deleting a Layer.
+ * Create Action before the Remove.
+ */
+
+class SdrUndoDelLayer final : public SdrUndoLayer
+{
+public:
+ SdrUndoDelLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
+ : SdrUndoLayer(nLayerNum,rNewLayerAdmin,rNewModel) { bItsMine=true; }
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+};
+
+/*
+ * Pages
+ */
+
+/**
+ * ABC for all UndoActions that have something to do with SdrPages.
+ */
+
+class SdrUndoPage : public SdrUndoAction
+{
+protected:
+ rtl::Reference<SdrPage> mxPage;
+
+protected:
+ void ImpInsertPage(sal_uInt16 nNum);
+ void ImpRemovePage(sal_uInt16 nNum);
+ void ImpMovePage(sal_uInt16 nOldNum, sal_uInt16 nNewNum);
+
+protected:
+ SdrUndoPage(SdrPage& rNewPg);
+ ~SdrUndoPage();
+
+ static OUString ImpGetDescriptionStr(TranslateId pStrCacheID);
+};
+
+/**
+ * ABC for manipulation of a PageList: New Page, DeletePage, MovePage (ChangePageNum).
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoPageList : public SdrUndoPage
+{
+protected:
+ sal_uInt16 nPageNum;
+
+protected:
+ SdrUndoPageList(SdrPage& rNewPg);
+ virtual ~SdrUndoPageList() override;
+};
+
+/**
+ * Deleting a Page.
+ * Create Action before removing from the List.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoDelPage final : public SdrUndoPageList
+{
+ // When deleting a MasterPage, we remember all relations of the
+ // Character Page with the MasterPage in this UndoGroup.
+ std::unique_ptr<SdrUndoGroup> pUndoGroup;
+ std::unique_ptr<SfxPoolItem> mpFillBitmapItem;
+ bool mbHasFillBitmap;
+
+public:
+ SdrUndoDelPage(SdrPage& rNewPg);
+ virtual ~SdrUndoDelPage() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+ virtual OUString GetSdrRepeatComment() const override;
+
+ virtual void SdrRepeat(SdrView& rView) override;
+ virtual bool CanSdrRepeat(SdrView& rView) const override;
+
+private:
+ void queryFillBitmap(const SfxItemSet &rItemSet);
+ void clearFillBitmap();
+ void restoreFillBitmap();
+};
+
+/**
+ * Inserting a new Page.
+ * Create Action after inserting into the List.
+ */
+
+class SVXCORE_DLLPUBLIC SdrUndoNewPage : public SdrUndoPageList
+{
+public:
+ SdrUndoNewPage(SdrPage& rNewPg): SdrUndoPageList(rNewPg) {}
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+};
+
+/**
+ * Copying a Page.
+ * Create Action after inserting into the List.
+ */
+
+class SdrUndoCopyPage final : public SdrUndoNewPage
+{
+public:
+ SdrUndoCopyPage(SdrPage& rNewPg): SdrUndoNewPage(rNewPg) {}
+
+ virtual OUString GetComment() const override;
+ virtual OUString GetSdrRepeatComment() const override;
+
+ virtual void SdrRepeat(SdrView& rView) override;
+ virtual bool CanSdrRepeat(SdrView& rView) const override;
+};
+
+/**
+ * Moving a Page within the List.
+ * Create Action before moving the Page.
+ */
+
+class SdrUndoSetPageNum final : public SdrUndoPage
+{
+ sal_uInt16 nOldPageNum;
+ sal_uInt16 nNewPageNum;
+
+public:
+ SdrUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1)
+ : SdrUndoPage(rNewPg),nOldPageNum(nOldPageNum1),nNewPageNum(nNewPageNum1) {}
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+};
+
+
+/*
+ * Masterpages
+ */
+
+/**
+ * ABC for all UndoActions that have something to do with
+ * MasterPage relationships.
+ */
+
+class SdrUndoPageMasterPage : public SdrUndoPage
+{
+protected:
+ bool mbOldHadMasterPage;
+ SdrLayerIDSet maOldSet;
+ sal_uInt16 maOldMasterPageNumber;
+
+protected:
+ SdrUndoPageMasterPage(SdrPage& rChangedPage);
+
+public:
+ UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) virtual ~SdrUndoPageMasterPage() override;
+};
+
+/**
+ * Removal of a MasterPage from a Character Page.
+ * Create Action before removing the MasterPageDescriptor.
+ */
+
+class SdrUndoPageRemoveMasterPage final : public SdrUndoPageMasterPage
+{
+public:
+ SdrUndoPageRemoveMasterPage(SdrPage& rChangedPage);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+};
+
+/**
+ * Changing the MasterPageDescriptor (e.g. change of the VisibleLayer).
+ * Create Action before changing the MasterPageDescriptors.
+ */
+
+class SdrUndoPageChangeMasterPage final : public SdrUndoPageMasterPage
+{
+ bool mbNewHadMasterPage;
+ SdrLayerIDSet maNewSet;
+ sal_uInt16 maNewMasterPageNumber;
+
+public:
+ SdrUndoPageChangeMasterPage(SdrPage& rChangedPage);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual OUString GetComment() const override;
+};
+
+
+/**
+ * The SdrUndoFactory can be set and retrieved from the SdrModel.
+ * It is used by the drawing layer implementations to create undo actions.
+ * It can be used by applications to create application specific undo actions.
+ */
+class SVXCORE_DLLPUBLIC SdrUndoFactory
+{
+public:
+ // Shapes
+ virtual ~SdrUndoFactory();
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoMoveObject( SdrObject& rObject, const Size& rDist );
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoGeoObject( SdrObject& rObject );
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1 = false, bool bSaveText = false );
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoRemoveObject(SdrObject& rObject);
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoInsertObject( SdrObject& rObject, bool bOrdNumDirect = false);
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect = false);
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoNewObject( SdrObject& rObject, bool bOrdNumDirect = false);
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect = false);
+
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1);
+
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject );
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer );
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText );
+
+ // Implement Title/Description Elements UI for Writer text frames, graphics and embedded objects (#i73249#)
+ static std::unique_ptr<SdrUndoAction> CreateUndoObjectStrAttr( SdrObject& rObject,
+ SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType,
+ const OUString& sOldStr,
+ const OUString& sNewStr );
+
+ // Diagram ModelData changes
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoDiagramModelData( SdrObject& rObject, std::shared_ptr< svx::diagram::DiagramDataState >& rStartState );
+
+ // Layer
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
+
+ // Page
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoDeletePage(SdrPage& rPage);
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoNewPage(SdrPage& rPage);
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoCopyPage(SdrPage& rPage);
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1);
+ static std::unique_ptr<SdrUndoAction> CreateUndoSort(SdrPage& rPage, ::std::vector<sal_Int32> const& rSortOrder);
+
+ // Master page
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage);
+ virtual std::unique_ptr<SdrUndoAction> CreateUndoPageChangeMasterPage(SdrPage& rChangedPage);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx
new file mode 100644
index 000000000..166990985
--- /dev/null
+++ b/include/svx/svdview.hxx
@@ -0,0 +1,281 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+// HACK to avoid too deep includes and to have some
+// levels free in svdmark itself (MS compiler include depth limit)
+#include <svx/svdhdl.hxx>
+#include <tools/weakbase.h>
+#include <svtools/accessibilityoptions.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/svdcrtv.hxx>
+#include <vcl/event.hxx>
+#include <unotools/options.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+// class hierarchy of View:
+// SfxListener
+// SdrPaintView PntV Action ModChg Attr Notify
+// SdrSnapView SnpV Action
+//
+// SdrMarkView MrkV Action MrkChg ModChg Notify
+//
+// SdrEditView EdtV MrkChg ModChg Attr
+// SdrPolyEditView PoEV
+// SdrGlueEditView GlEV
+// SdrObjEditView EdxV Action ModChg Attr Notify
+//
+// SdrExchangeView XcgV
+// SdrDragView DrgV Action
+//
+// SdrCreateView CrtV Action
+// SdrView View
+
+class SvxURLField;
+namespace sdr::contact { class ObjectContact; }
+
+enum class SdrViewContext {
+ Standard,
+ PointEdit,
+ GluePointEdit,
+ Graphic,
+ Media,
+ Table
+};
+
+enum class SdrEventKind {
+ NONE,
+ TextEdit,
+ MoveAction,
+ EndAction,
+ BackAction,
+ EndCreate,
+ EndDrag,
+ MarkObj,
+ MarkPoint,
+ MarkGluePoint,
+ BeginMark,
+ BeginInsertObjPoint,
+ EndInsertObjPoint,
+ BeginInsertGluePoint,
+ BeginDragHelpline,
+ BeginDragObj,
+ BeginCreateObj,
+ BeginMacroObj,
+ BeginTextEdit,
+ EndMark,
+ BrkMark,
+ ExecuteUrl
+};
+
+/* for PickAnything() */
+enum class SdrMouseEventKind
+{
+ BUTTONDOWN = 1,
+ MOVE = 2,
+ BUTTONUP = 3,
+};
+
+// helper class SdrViewEvent
+struct SVXCORE_DLLPUBLIC SdrViewEvent
+{
+ SdrHdl* mpHdl;
+ SdrObject* mpObj;
+ SdrObject* mpRootObj; // mark this when SdrBeginTextEdit is executed
+ SdrPageView* mpPV;
+ const SvxURLField* mpURLField;
+
+ Point maLogicPos;
+ SdrHitKind meHit;
+ SdrEventKind meEvent;
+
+ sal_uInt16 mnMouseClicks;
+ MouseEventModifiers mnMouseMode;
+ sal_uInt16 mnMouseCode;
+ sal_uInt16 mnHlplIdx;
+ sal_uInt16 mnGlueId;
+
+ bool mbMouseDown : 1;
+ bool mbMouseUp : 1;
+ bool mbIsAction : 1; // Action is active
+ bool mbIsTextEdit : 1; // TextEdit runs currently
+ bool mbAddMark : 1;
+ bool mbUnmark : 1;
+ bool mbPrevNextMark : 1;
+ bool mbMarkPrev : 1;
+
+public:
+ SdrViewEvent();
+};
+
+// helper class for all D&D overlays
+class SVXCORE_DLLPUBLIC SdrDropMarkerOverlay
+{
+ // The OverlayObjects
+ sdr::overlay::OverlayObjectList maObjects;
+
+ void ImplCreateOverlays(
+ const SdrView& rView,
+ const basegfx::B2DPolyPolygon& rLinePolyPolygon);
+
+public:
+ SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject);
+ SdrDropMarkerOverlay(const SdrView& rView, const tools::Rectangle& rRectangle);
+ SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd);
+ ~SdrDropMarkerOverlay();
+};
+
+
+class SVXCORE_DLLPUBLIC SdrView : public SdrCreateView, public tools::WeakBase
+{
+ friend class SdrPageView;
+
+ bool mbNoExtendedMouseDispatcher : 1;
+ bool mbNoExtendedKeyDispatcher : 1;
+ bool mbMasterPagePaintCaching : 1;
+
+ SvtAccessibilityOptions maAccessibilityOptions;
+
+public:
+ explicit SdrView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut = nullptr);
+
+ virtual ~SdrView() override;
+
+ // The default value for all dispatchers is activated. If the app for example
+ // wants to intervene in MouseDispatcher for special treatment, you have to
+ // deactivate the MouseDispatcher with the help of the method below and you have
+ // to implement it yourself. Example for MouseButtonDown:
+ // SdrViewEvent aVEvt;
+ // SdrHitKind eHit=pSdrView->PickAnything(rMEvt,SdrMouseEventKind::BUTTONDOWN,aVEvt);
+ // ... here application-specific intervention ...
+ // pSdrView->DoMouseEvent(aVEvt);
+ // SetPointer(GetPreferredPointer(...))
+ // CaptureMouse(...)
+ void EnableExtendedMouseEventDispatcher(bool bOn) { mbNoExtendedMouseDispatcher = !bOn; }
+ bool IsExtendedMouseEventDispatcherEnabled() const { return mbNoExtendedMouseDispatcher; }
+
+ void EnableExtendedKeyInputDispatcher(bool bOn) { mbNoExtendedKeyDispatcher=!bOn; }
+ bool IsExtendedKeyInputDispatcherEnabled() const { return mbNoExtendedKeyDispatcher; }
+
+ void SetMasterPagePaintCaching(bool bOn);
+ bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching; }
+
+ bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) override;
+ virtual bool MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin) override;
+ virtual bool MouseButtonUp(const MouseEvent& rMEvt, OutputDevice* pWin) override;
+ virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override;
+ using SdrCreateView::RequestHelp;
+ virtual bool Command(const CommandEvent& rCEvt, vcl::Window* pWin) override;
+
+ virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) override;
+
+ bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll=false) { return SdrCreateView::SetAttributes(rSet,bReplaceAll); }
+
+ /* new interface src537 */
+ void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr=false) const;
+
+ // incomplete implementation:
+ // OutputDevice is necessary to determine HandleSize.
+ // If NULL the first signed on Win is used.
+ PointerStyle GetPreferredPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier=0, bool bLeftDown=false) const;
+ SdrHitKind PickAnything(const MouseEvent& rMEvt, SdrMouseEventKind nMouseDownOrMoveOrUp, SdrViewEvent& rVEvt) const;
+ SdrHitKind PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const;
+ bool DoMouseEvent(const SdrViewEvent& rVEvt);
+ virtual SdrViewContext GetContext() const;
+
+ // The methods consider the particular context:
+ // - simple drawing
+ // - mode for editing points
+ // - mode for editing gluepoints
+ // - TextEdit
+ // - ... to be continued
+ void MarkAll();
+ void UnmarkAll();
+
+ const tools::Rectangle& GetMarkedRect() const;
+
+ virtual void DeleteMarked();
+
+ // Marking objects, traverse stations or gluepoints (depending on view-
+ // context) by enveloping the selection frame.
+ // bAddMark=TRUE: add to existing selection (->Shift)
+ // bUnmark=TRUE: remove objects from selection which are inside of
+ // the enveloped frame.
+ bool BegMark(const Point& rPnt, bool bAddMark, bool bUnmark);
+
+ // The following actions are possible:
+ // - ObjectCreating
+ // - ObjectMarking
+ // - Object-specific dragging
+ // - General dragging
+ // and more...
+ OUString GetStatusText();
+
+ SvtAccessibilityOptions& getAccessibilityOptions() { return maAccessibilityOptions;}
+
+ virtual void onAccessibilityOptionsChanged();
+
+ // Do not create ObjectContact locally, but offer a call to allow override
+ // and to create own derivations of ObjectContact
+ virtual sdr::contact::ObjectContact* createViewSpecificObjectContact(
+ SdrPageWindow& rPageWindow,
+ const char* pDebugName) const;
+
+ // Interactive Move Action programmatically
+ bool MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint, const sal_Int32 aObjectOrdNum = -1);
+};
+
+// First of all the app creates a SdrModel.
+// Then it opens a Win and creates a SdrView.
+// ShowSdrPage() announces a page at SdrView.
+// It's possible to show SdrView in any Wins at once.
+// internal:
+// SdrView can show as many Wins as it wants at once. Pages are announced
+// or checked out with the help of ShowSdrPage()/HideSdrPage(). For every announced
+// page there is a SdrPageView instance in container aPages. If more than one page
+// is showed, you have to pay attention that the offset parameter of ShowSdrPage()
+// is conformed to the size of the page (to prevent overlapping of two pages).
+//
+// elementary methods:
+// ~~~~~~~~~~~~~~~~~~~~
+// simple events:
+// ~~~~~~~~~~~~~~~~
+// bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin);
+// bool MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin);
+// bool MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin);
+// bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin);
+// bool Command(const CommandEvent& rCEvt, vcl::Window* pWin);
+//
+// SfxItems:
+// ~~~~~~~~~
+// sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
+// sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
+// SfxStyleSheet* GetStyleSheet() const;
+// sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
+//
+// others:
+// ~~~~~~~~~~
+// Pointer GetPreferredPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nTol=0) const;
+// OUString GetStatusText();
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdviter.hxx b/include/svx/svdviter.hxx
new file mode 100644
index 000000000..bdb28469c
--- /dev/null
+++ b/include/svx/svdviter.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svxdllapi.h>
+
+/*
+
+Using this class, you can find out:
+- SdrView* First/NextView()
+ - All Views in which a model is displayed
+ - All Views in which a certain page is visible (also as MasterPage)
+ - All Views in which a certain object is visible (also as MasterPage)
+- SdrPageView* First/NextPageView()
+ - All PageViews in which a model is displayed
+ - All PageViews in which a certain page is visible (also as MasterPage)
+ - All PageViews in which a certain object is visible (also as MasterPage)
+- vcl::Window* First/NextWindow()
+ - All Windows in which a model is displayed
+ - All Windows in which a certain page is visible (also as MasterPage)
+ - All Windows in which a certain object is visible (also as MasterPage)
+You can specify if the selection is restricted to a certain page/object by
+choosing the corresponding constructor.
+
+Among others, the following are considered:
+- Visibility state of the layer
+- Visible Layer of MasterPages
+- Multiple layer for group objects
+
+Not considered are:
+- Whether the pages/objects were already painted or if an Invalidate is still pending
+- Whether the pages/objects in a Window are in a visible region
+
+*/
+
+class OutputDevice;
+class SdrView;
+class SdrPageView;
+class SdrModel;
+class SdrPage;
+class SdrObject;
+class SdrLayerIDSet;
+
+class SVXCORE_DLLPUBLIC SdrViewIter
+{
+ const SdrModel* mpModel;
+ const SdrPage* mpPage;
+ const SdrObject* mpObject;
+ SdrView* mpCurrentView;
+
+ size_t mnListenerNum;
+
+private:
+ SVX_DLLPRIVATE void ImpInitVars();
+ SVX_DLLPRIVATE SdrView* ImpFindView();
+ SVX_DLLPRIVATE bool ImpCheckPageView(SdrPageView const * pPV) const;
+
+public:
+ SdrViewIter(const SdrPage* pPage);
+ SdrViewIter(const SdrObject* pObject);
+
+ SdrView* FirstView();
+ SdrView* NextView();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdxcgv.hxx b/include/svx/svdxcgv.hxx
new file mode 100644
index 000000000..87ea2a285
--- /dev/null
+++ b/include/svx/svdxcgv.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svdedxv.hxx>
+
+#include <vcl/gdimtf.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC SdrExchangeView : public SdrObjEditView
+{
+ friend class SdrPageView;
+
+protected:
+
+ void ImpGetPasteObjList(Point& rPos, SdrObjList*& rpLst);
+ void ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Point& rCenter, const Size& rSiz, const MapMode& rMap, SdrInsertFlags nOptions);
+ bool ImpGetPasteLayer(const SdrObjList* pObjList, SdrLayerID& rLayer) const;
+
+ // Returns true if rPt has changed
+ bool ImpLimitToWorkArea(Point& rPt) const;
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrExchangeView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
+public:
+ // Output all marked objects on the specified OutputDevice
+ ::std::vector< SdrObject* > GetMarkedObjects() const;
+ virtual void DrawMarkedObj(OutputDevice& rOut) const;
+
+ // E.g. for Clipboard, Drag'n'Drop, ...
+ // Add all marked objects to a metafile.
+ // FIXME: This is known to be somewhat buggy still (Offset...,
+ // foreign graphics objects (SdrGrafObj), virtual object
+ // copies (SdrVirtObj) with anchor position <>(0,0)).
+ GDIMetaFile GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked = false) const;
+
+ // Draw all marked objects onto a bitmap, with the display's color depth
+ // and resolution
+ BitmapEx GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked = false, const sal_uInt32 nMaximumQuadraticPixels = 500000, const std::optional<Size>& rTargetDPI = std::nullopt) const;
+
+ // Copy all marked objects to a new model, consisting of exactly one page,
+ // with the flag PageNotValid set. This means, that only the page's objects
+ // are valid and not the page itself (page size, margins).
+ // The new model is created on the free store and passed to the caller of
+ // this method, which is responsible to dispose it later on.
+ //
+ // When inserting the marked objects into the one page of the new model,
+ // the page-local layer is merged. If there's no more room left for
+ // additional page-local layers, the corresponding objects are assigned
+ // the default layer (layer 0, document-global standard layer).
+ virtual std::unique_ptr<SdrModel> CreateMarkedObjModel() const;
+
+ Graphic GetAllMarkedGraphic() const;
+
+ /** Generate a Graphic for the given draw object
+
+ @param rSdrObject
+ The object (can also be a group object) to retrieve a Graphic
+ for.
+
+ @return a graphical representation of the given object, as it
+ appears on screen (e.g. with rotation, if any, applied).
+ */
+ static Graphic GetObjGraphic(const SdrObject& rSdrObject);
+
+ // The new Draw objects are marked for all paste methods.
+ // If bAddMark is true, the new Draw objects are added to an existing
+ // selection, which is meant for Drag'n'Drop with multiple items.
+ //
+ // The methods with a point parameter insert objects centered at that
+ // position, all others are centered at the 1st OutputDevice of the View.
+ //
+ // If pPg is set, the objects are inserted at that page. The positioning
+ // (rPos or alignment) are not relative to the View, but to the Page.
+ //
+ // Note: SdrObjList is the base class of SdrPage.
+ // All methods return true, if the objects have been successfully created
+ // and inserted.
+ // If pLst = false and no TextEdit active, we can rely on the fact, that
+ // it is marked at the View. Or else the marking only happens if the pLst
+ // is also shown at the View at the moment.
+ //
+ // Valid values for nOptions are SDRINSERT_DONTMARK and SDRINSERT_ADDMARK
+ // (@see svdedtv.hxx).
+ virtual bool Paste(
+ const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, SdrInsertFlags nOptions);
+
+ bool Paste(const OUString& rStr, const Point& rPos, SdrObjList* pLst, SdrInsertFlags nOptions);
+ bool Paste(SvStream& rInput, EETextFormat eFormat, const Point& rPos, SdrObjList* pLst, SdrInsertFlags nOptions);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svx3ditems.hxx b/include/svx/svx3ditems.hxx
new file mode 100644
index 000000000..7cb5eae6e
--- /dev/null
+++ b/include/svx/svx3ditems.hxx
@@ -0,0 +1,319 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SVX3DITEMS_HXX
+#define INCLUDED_SVX_SVX3DITEMS_HXX
+
+#include <config_options.h>
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+
+
+#include <editeng/colritem.hxx>
+#include <svx/e3ditem.hxx>
+#include <svx/viewpt3d.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+// Svx3D _3DOBJ_ Items
+inline SfxUInt16Item makeSvx3DPercentDiagonalItem(sal_uInt16 nVal) {
+ return SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, nVal);
+}
+
+inline SfxUInt16Item makeSvx3DBackscaleItem(sal_uInt16 nVal) {
+ return SfxUInt16Item(SDRATTR_3DOBJ_BACKSCALE, nVal);
+}
+
+inline SfxUInt32Item makeSvx3DDepthItem(sal_uInt32 nVal) {
+ return SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, nVal);
+}
+
+inline SfxUInt32Item makeSvx3DHorizontalSegmentsItem(sal_uInt32 nVal) {
+ return SfxUInt32Item(SDRATTR_3DOBJ_HORZ_SEGS, nVal);
+}
+
+inline SfxUInt32Item makeSvx3DVerticalSegmentsItem(sal_uInt32 nVal) {
+ return SfxUInt32Item(SDRATTR_3DOBJ_VERT_SEGS, nVal);
+}
+
+inline SfxUInt32Item makeSvx3DEndAngleItem(sal_uInt32 nVal) {
+ return SfxUInt32Item(SDRATTR_3DOBJ_END_ANGLE, nVal);
+}
+
+inline SfxBoolItem makeSvx3DDoubleSidedItem(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, bVal);
+}
+
+// #i28528#
+// Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+class Svx3DReducedLineGeometryItem final : public SfxBoolItem {
+public:
+ Svx3DReducedLineGeometryItem(bool bVal = false);
+ Svx3DReducedLineGeometryItem* Clone(SfxItemPool * = nullptr) const override;
+};
+
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DNormalsKindItem final : public SfxUInt16Item {
+public:
+ Svx3DNormalsKindItem(sal_uInt16 nVal = 0);
+
+ // use drawing::NormalsKind
+ SVX_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ SVX_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ SVX_DLLPRIVATE virtual Svx3DNormalsKindItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+inline SfxBoolItem makeSvx3DNormalsInvertItem(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DOBJ_NORMALS_INVERT, bVal);
+}
+
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DTextureProjectionXItem final : public SfxUInt16Item {
+public:
+ Svx3DTextureProjectionXItem(sal_uInt16 nVal = 0);
+
+ // use drawing::TextureProjectionMode
+ SVX_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ SVX_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ SVX_DLLPRIVATE virtual Svx3DTextureProjectionXItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DTextureProjectionYItem final : public SfxUInt16Item {
+public:
+ Svx3DTextureProjectionYItem(sal_uInt16 nVal = 0);
+
+ // use drawing::TextureProjectionMode
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual Svx3DTextureProjectionYItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+inline SfxBoolItem makeSvx3DShadow3DItem(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DOBJ_SHADOW_3D, bVal);
+}
+
+inline SvxColorItem makeSvx3DMaterialEmissionItem(const Color& rCol) {
+ return SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_EMISSION);
+}
+
+inline SvxColorItem makeSvx3DMaterialSpecularItem(const Color& rCol) {
+ return SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_SPECULAR);
+}
+
+inline SfxUInt16Item makeSvx3DMaterialSpecularIntensityItem(sal_uInt16 nVal) {
+ return SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, nVal);
+}
+
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DTextureKindItem final : public SfxUInt16Item {
+public:
+ Svx3DTextureKindItem(sal_uInt16 nVal = 3);
+
+ // use drawing::TextureKind
+ SVX_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ SVX_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ SVX_DLLPRIVATE virtual Svx3DTextureKindItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DTextureModeItem final : public SfxUInt16Item {
+public:
+ Svx3DTextureModeItem(sal_uInt16 nVal = 2);
+
+ // use drawing:TextureMode
+ SVX_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ SVX_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ SVX_DLLPRIVATE virtual Svx3DTextureModeItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+inline SfxBoolItem makeSvx3DTextureFilterItem(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DOBJ_TEXTURE_FILTER, bVal);
+}
+
+// Svx3D _3DSCENE_ Items
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DPerspectiveItem final : public SfxUInt16Item {
+public:
+ Svx3DPerspectiveItem(ProjectionType nVal = ProjectionType::Perspective);
+
+ // use drawing::ProjectionMode
+ SVX_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ SVX_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ SVX_DLLPRIVATE virtual Svx3DPerspectiveItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+inline SfxUInt32Item makeSvx3DDistanceItem(sal_uInt32 nVal) {
+ return SfxUInt32Item(SDRATTR_3DSCENE_DISTANCE, nVal);
+}
+
+inline SfxUInt32Item makeSvx3DFocalLengthItem(sal_uInt32 nVal) {
+ return SfxUInt32Item(SDRATTR_3DSCENE_FOCAL_LENGTH, nVal);
+}
+
+inline SfxBoolItem makeSvx3DTwoSidedLightingItem(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, bVal);
+}
+
+inline SvxColorItem makeSvx3DLightcolor1Item(const Color& rCol) {
+ return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_1);
+}
+
+inline SvxColorItem makeSvx3DLightcolor2Item(const Color& rCol) {
+ return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_2);
+}
+
+inline SvxColorItem makeSvx3DLightcolor3Item(const Color& rCol) {
+ return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_3);
+}
+
+inline SvxColorItem makeSvx3DLightcolor4Item(const Color& rCol) {
+ return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_4);
+}
+
+inline SvxColorItem makeSvx3DLightcolor5Item(const Color& rCol) {
+ return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_5);
+}
+
+inline SvxColorItem makeSvx3DLightcolor6Item(const Color& rCol) {
+ return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_6);
+}
+
+inline SvxColorItem makeSvx3DLightcolor7Item(const Color& rCol) {
+ return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_7);
+}
+
+inline SvxColorItem makeSvx3DLightcolor8Item(const Color& rCol) {
+ return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_8);
+}
+
+inline SvxColorItem makeSvx3DAmbientcolorItem(const Color& rCol) {
+ return SvxColorItem(rCol, SDRATTR_3DSCENE_AMBIENTCOLOR);
+}
+
+inline SfxBoolItem makeSvx3DLightOnOff1Item(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_1, bVal);
+}
+
+inline SfxBoolItem makeSvx3DLightOnOff2Item(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_2, bVal);
+}
+
+inline SfxBoolItem makeSvx3DLightOnOff3Item(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_3, bVal);
+}
+
+inline SfxBoolItem makeSvx3DLightOnOff4Item(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_4, bVal);
+}
+
+inline SfxBoolItem makeSvx3DLightOnOff5Item(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_5, bVal);
+}
+
+inline SfxBoolItem makeSvx3DLightOnOff6Item(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_6, bVal);
+}
+
+inline SfxBoolItem makeSvx3DLightOnOff7Item(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_7, bVal);
+}
+
+inline SfxBoolItem makeSvx3DLightOnOff8Item(bool bVal) {
+ return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_8, bVal);
+}
+
+inline SvxB3DVectorItem makeSvx3DLightDirection1Item(const basegfx::B3DVector& rVec) {
+ return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_1, rVec);
+}
+
+inline SvxB3DVectorItem makeSvx3DLightDirection2Item(const basegfx::B3DVector& rVec) {
+ return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_2, rVec);
+}
+
+inline SvxB3DVectorItem makeSvx3DLightDirection3Item(const basegfx::B3DVector& rVec) {
+ return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_3, rVec);
+}
+
+inline SvxB3DVectorItem makeSvx3DLightDirection4Item(const basegfx::B3DVector& rVec) {
+ return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_4, rVec);
+}
+
+inline SvxB3DVectorItem makeSvx3DLightDirection5Item(const basegfx::B3DVector& rVec) {
+ return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_5, rVec);
+}
+
+inline SvxB3DVectorItem makeSvx3DLightDirection6Item(const basegfx::B3DVector& rVec) {
+ return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_6, rVec);
+}
+
+inline SvxB3DVectorItem makeSvx3DLightDirection7Item(const basegfx::B3DVector& rVec) {
+ return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_7, rVec);
+}
+
+inline SvxB3DVectorItem makeSvx3DLightDirection8Item(const basegfx::B3DVector& rVec) {
+ return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_8, rVec);
+}
+
+inline SfxUInt16Item makeSvx3DShadowSlantItem(sal_uInt16 nVal) {
+ return SfxUInt16Item(SDRATTR_3DSCENE_SHADOW_SLANT, nVal);
+}
+
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DShadeModeItem final : public SfxUInt16Item {
+public:
+ Svx3DShadeModeItem(sal_uInt16 nVal = 2);
+
+ // use drawing::ShadeMode
+ SVX_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ SVX_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ SVX_DLLPRIVATE virtual Svx3DShadeModeItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+
+// #107245# Item to replace bExtrudeSmoothed and bLatheSmoothed
+class Svx3DSmoothNormalsItem final : public SfxBoolItem {
+public:
+ Svx3DSmoothNormalsItem(bool bVal = true);
+ Svx3DSmoothNormalsItem* Clone(SfxItemPool * = nullptr) const override;
+};
+
+// #107245# Item to replace bExtrudeSmoothFrontBack and bLatheSmoothFrontBack
+class Svx3DSmoothLidsItem final : public SfxBoolItem {
+public:
+ Svx3DSmoothLidsItem(bool bVal = false);
+ Svx3DSmoothLidsItem* Clone(SfxItemPool * = nullptr) const override;
+};
+
+// #107245# Item to replace bExtrudeCharacterMode and bLatheCharacterMode
+class Svx3DCharacterModeItem final : public SfxBoolItem {
+public:
+ Svx3DCharacterModeItem(bool bVal = false);
+ Svx3DCharacterModeItem* Clone(SfxItemPool * = nullptr) const override;
+};
+
+// #107245# Item to replace bExtrudeCloseFront and bLatheCloseFront
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DCloseFrontItem final : public SfxBoolItem {
+public:
+ Svx3DCloseFrontItem(bool bVal = true);
+ Svx3DCloseFrontItem* Clone(SfxItemPool * = nullptr) const override;
+};
+
+// #107245# Item to replace bExtrudeCloseBack and bLatheCloseBack
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DCloseBackItem final : public SfxBoolItem {
+public:
+ Svx3DCloseBackItem(bool bVal = true);
+ Svx3DCloseBackItem* Clone(SfxItemPool * = nullptr) const override;
+};
+
+#endif // INCLUDED_SVX_SVX3DITEMS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
new file mode 100644
index 000000000..d697da78a
--- /dev/null
+++ b/include/svx/svxdlg.hxx
@@ -0,0 +1,451 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SVXDLG_HXX
+#define INCLUDED_SVX_SVXDLG_HXX
+
+#include <sfx2/sfxdlg.hxx>
+#include <svx/anchorid.hxx>
+#include <svx/zoom_def.hxx>
+#include <editeng/edtdlg.hxx>
+
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <svx/svxdllapi.h>
+#include <vector>
+
+namespace sd {
+ class View;
+}
+
+namespace com::sun::star::linguistic2 {
+ class XDictionary;
+ class XSpellChecker1;
+ class XSpellChecker;
+ class XThesaurus;
+ class XHyphenator;
+}
+class SdrModel;
+class SdrView;
+class SvxSpellWrapper;
+enum class TransliterationFlags;
+struct ExchangeData;
+class INetURLObject;
+class GalleryTheme;
+class SvxHyperlinkTabPageBase;
+class SearchAttrItemList;
+class FmFormShell;
+class Graphic;
+class SdrObject;
+class SvxSpellWrapper;
+struct FmSearchContext;
+
+typedef WhichRangesContainer (*DialogGetRanges)();
+
+typedef ::std::vector< OUString > TargetList;
+
+namespace svx{ class SpellDialogChildWindow;}
+namespace weld{
+ class Dialog;
+ class Window;
+}
+
+class AbstractFmShowColsDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractFmShowColsDialog() override = default;
+public:
+ virtual void SetColumns(const css::uno::Reference< css::container::XIndexContainer>& xCols)= 0;
+};
+
+class AbstractSvxZoomDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSvxZoomDialog() override = default;
+public:
+ virtual void SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) = 0;
+ virtual void HideButton( ZoomButtonId nBtnId )= 0;
+ virtual const SfxItemSet* GetOutputItemSet() const = 0 ;
+};
+
+class AbstractSpellDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSpellDialog() override = default;
+public:
+ virtual void InvalidateDialog() = 0;
+ virtual std::shared_ptr<SfxDialogController> GetController() = 0;
+ virtual SfxBindings& GetBindings() = 0;
+};
+
+class AbstractTitleDialog :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractTitleDialog() override = default;
+public:
+ virtual OUString GetTitle() const =0;
+};
+
+class AbstractGalleryIdDialog :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractGalleryIdDialog() override = default;
+public:
+ virtual sal_uInt32 GetId() const =0;
+};
+
+class AbstractURLDlg :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractURLDlg() override = default;
+public:
+ virtual OUString GetURL() const = 0;
+ virtual OUString GetAltText() const = 0;
+ virtual OUString GetDesc() const = 0;
+ virtual OUString GetTarget() const = 0;
+ virtual OUString GetName() const = 0;
+};
+
+class AbstractSvxSearchSimilarityDialog :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSvxSearchSimilarityDialog() override = default;
+public:
+ virtual sal_uInt16 GetOther() =0 ;
+ virtual sal_uInt16 GetShorter() =0 ;
+ virtual sal_uInt16 GetLonger() =0 ;
+ virtual bool IsRelaxed() =0 ;
+};
+
+class AbstractSvxJSearchOptionsDialog :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSvxJSearchOptionsDialog() override = default;
+public:
+ virtual TransliterationFlags GetTransliterationFlags() const = 0;
+};
+
+class AbstractFmInputRecordNoDialog :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractFmInputRecordNoDialog() override = default;
+public:
+ virtual void SetValue(tools::Long dNew) = 0;
+ virtual tools::Long GetValue() const = 0;
+};
+
+class AbstractSvxNewDictionaryDialog :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSvxNewDictionaryDialog() override = default;
+public:
+ virtual css::uno::Reference< css::linguistic2::XDictionary > GetNewDictionary() = 0;
+};
+
+class AbstractSvxNameDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSvxNameDialog() override = default;
+public:
+ virtual void GetName( OUString& rName ) = 0;
+ virtual void SetCheckNameHdl( const Link<AbstractSvxNameDialog&,bool>& rLink, bool bCheckImmediately = false ) = 0;
+ virtual void SetCheckNameTooltipHdl( const Link<AbstractSvxNameDialog&,OUString>& rLink ) = 0;
+ virtual void SetEditHelpId(const OString&) = 0;
+ virtual void SetHelpId( const OString& ) = 0;
+ virtual void SetText( const OUString& rStr ) = 0;
+};
+
+class AbstractSvxObjectNameDialog :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSvxObjectNameDialog() override = default;
+public:
+ virtual void GetName(OUString& rName) = 0;
+ virtual void SetCheckNameHdl(const Link<AbstractSvxObjectNameDialog&,bool>& rLink) = 0;
+};
+
+class AbstractSvxObjectTitleDescDialog :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSvxObjectTitleDescDialog() override = default;
+public:
+ virtual void GetTitle(OUString& rTitle) = 0;
+ virtual void GetDescription(OUString& rDescription) = 0;
+};
+
+/// Abstract class provides the get information from the numbering and position dialog.
+class AbstractSvxBulletAndPositionDlg :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSvxBulletAndPositionDlg() override = default;
+public:
+ virtual const SfxItemSet* GetOutputItemSet( SfxItemSet* pSet) const = 0 ;
+ virtual bool IsApplyToMaster() = 0;
+ virtual bool IsSlideScope() = 0;
+};
+
+class AbstractSvxMultiPathDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSvxMultiPathDialog() override = default;
+public:
+ virtual OUString GetPath() const = 0;
+ virtual void SetPath( const OUString& rPath ) = 0;
+ virtual void SetTitle( const OUString& rNewTitle ) = 0;
+};
+
+class AbstractSvxHpLinkDlg : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSvxHpLinkDlg() override = default;
+public:
+ virtual std::shared_ptr<SfxDialogController> GetController() = 0;
+ virtual bool QueryClose() = 0;
+};
+
+struct FmFoundRecordInformation;
+class AbstractFmSearchDialog :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractFmSearchDialog() override = default;
+public:
+ virtual void SetFoundHandler(const Link<FmFoundRecordInformation&,void>& lnk) = 0;
+ virtual void SetCanceledNotFoundHdl(const Link<FmFoundRecordInformation&,void>& lnk)=0;
+ virtual void SetActiveField(const OUString& strField)=0;
+};
+
+class AbstractGraphicFilterDialog :public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractGraphicFilterDialog() override = default;
+public:
+ virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) = 0;
+};
+
+class AbstractSvxAreaTabDialog :public SfxAbstractTabDialog
+{
+protected:
+ virtual ~AbstractSvxAreaTabDialog() override = default;
+};
+
+struct SvxSwFrameValidation;
+class AbstractSvxTransformTabDialog : public SfxAbstractTabDialog
+{
+protected:
+ virtual ~AbstractSvxTransformTabDialog() override = default;
+public:
+ virtual void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink ) = 0;
+};
+
+class AbstractSvxCaptionDialog : public SfxAbstractTabDialog
+{
+protected:
+ virtual ~AbstractSvxCaptionDialog() override = default;
+public:
+ virtual void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink ) = 0;
+};
+
+class AbstractSvxPostItDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSvxPostItDialog() override = default;
+public:
+ virtual void SetText( const OUString& rStr ) = 0;
+ virtual const SfxItemSet* GetOutputItemSet() const = 0;
+ virtual void SetPrevHdl( const Link<AbstractSvxPostItDialog&,void>& rLink ) = 0;
+ virtual void SetNextHdl( const Link<AbstractSvxPostItDialog&,void>& rLink ) = 0;
+ virtual void EnableTravel(bool bNext, bool bPrev) = 0;
+ virtual OUString GetNote() = 0;
+ virtual void SetNote(const OUString& rTxt) = 0;
+ virtual void ShowLastAuthor(const OUString& rAuthor, const OUString& rDate) = 0;
+ virtual void DontChangeAuthor() = 0;
+ virtual void HideAuthor() = 0;
+ virtual std::shared_ptr<weld::Dialog> GetDialog() = 0;
+};
+
+class SvxAbstractSplitTableDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~SvxAbstractSplitTableDialog() override = default;
+public:
+ virtual bool IsHorizontal() const = 0;
+ virtual bool IsProportional() const = 0;
+ virtual tools::Long GetCount() const = 0;
+ virtual void SetSplitVerticalByDefault() = 0;
+};
+
+class SvxAbstractNewTableDialog
+{
+protected:
+ virtual ~SvxAbstractNewTableDialog() = default;
+public:
+ virtual sal_Int32 getRows() const = 0;
+ virtual sal_Int32 getColumns() const = 0;
+ virtual std::shared_ptr<weld::DialogController> getDialogController() = 0;
+};
+
+class SvxAbstractInsRowColDlg : public VclAbstractDialog
+{
+protected:
+ virtual ~SvxAbstractInsRowColDlg() override = default;
+public:
+ virtual bool isInsertBefore() const = 0;
+ virtual sal_uInt16 getInsertCount() const = 0;
+};
+
+class SVXCORE_DLLPUBLIC SvxAbstractDialogFactory : public SfxAbstractDialogFactory, public EditAbstractDialogFactory
+{
+public:
+ static SvxAbstractDialogFactory* Create();
+
+ virtual ~SvxAbstractDialogFactory() override;
+
+ virtual VclPtr<SfxAbstractTabDialog> CreateTextTabDialog( weld::Window* pParent,
+ const SfxItemSet* pAttrSet,
+ SdrView* pView ) = 0 ;
+
+ virtual VclPtr<AbstractSvxCaptionDialog> CreateCaptionDialog(weld::Window* pParent,
+ const SdrView* pView,
+ SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE) = 0;
+
+ virtual VclPtr<AbstractFmShowColsDialog> CreateFmShowColsDialog(weld::Window* pParent) = 0;
+
+ virtual VclPtr<AbstractSvxZoomDialog> CreateSvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet) = 0;
+
+ virtual VclPtr<AbstractSpellDialog> CreateSvxSpellDialog(weld::Window* pParent,
+ SfxBindings* pBindings,
+ svx::SpellDialogChildWindow* pSpellChildWindow )=0;
+
+ virtual VclPtr<VclAbstractDialog> CreateActualizeProgressDialog(weld::Widget* pParent,
+ GalleryTheme* pThm) = 0;
+ virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Widget* pParent,
+ const OUString& rOldText) = 0;
+ virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Widget* pParent,
+ GalleryTheme* pThm) = 0;
+ virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(weld::Widget* pParent,
+ ExchangeData* pData,
+ SfxItemSet* pItemSet ) = 0;
+
+ virtual VclPtr<AbstractURLDlg> CreateURLDialog(weld::Widget* pParent,
+ const OUString& rURL, const OUString& rAltText, const OUString& rDescription,
+ const OUString& rTarget, const OUString& rName,
+ TargetList& rTargetList ) = 0;
+
+ virtual VclPtr<SfxAbstractTabDialog> CreateTabItemDialog(weld::Window* pParent, const SfxItemSet& rSet) = 0;
+ virtual VclPtr<VclAbstractDialog> CreateSvxSearchAttributeDialog(weld::Window* pParent,
+ SearchAttrItemList& rLst,
+ const WhichRangesContainer& pWhRanges)=0;
+ virtual VclPtr<AbstractSvxSearchSimilarityDialog> CreateSvxSearchSimilarityDialog( weld::Window* pParent,
+ bool bRelax,
+ sal_uInt16 nOther,
+ sal_uInt16 nShorter,
+ sal_uInt16 nLonger ) = 0;
+ // add for SvxBorderBackgroundDlg
+ virtual VclPtr<SfxAbstractTabDialog> CreateSvxBorderBackgroundDlg(
+ weld::Window* pParent,
+ const SfxItemSet& rCoreSet,
+ bool bEnableDrawingLayerFillStyles) = 0;
+
+ virtual VclPtr<AbstractSvxTransformTabDialog> CreateSvxTransformTabDialog(weld::Window* pParent,
+ const SfxItemSet* pAttr,
+ const SdrView* pView,
+ SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE) = 0;
+ virtual VclPtr<SfxAbstractTabDialog> CreateSchTransformTabDialog(weld::Window* pParent,
+ const SfxItemSet* pAttr,
+ const SdrView* pSdrView,
+ bool bSizeTabPage) = 0;
+ virtual VclPtr<AbstractSvxJSearchOptionsDialog> CreateSvxJSearchOptionsDialog(weld::Window* pParent,
+ const SfxItemSet& rOptionsSet,
+ TransliterationFlags nInitialFlags) = 0;
+ virtual VclPtr<AbstractFmInputRecordNoDialog> CreateFmInputRecordNoDialog(weld::Window* pParent) = 0;
+ virtual VclPtr<AbstractSvxNewDictionaryDialog> CreateSvxNewDictionaryDialog(weld::Window* pParent) = 0;
+ virtual VclPtr<VclAbstractDialog> CreateSvxEditDictionaryDialog(weld::Window* pParent, const OUString& rName) = 0;
+ virtual VclPtr<AbstractSvxNameDialog> CreateSvxNameDialog(weld::Window* pParent,
+ const OUString& rName, const OUString& rDesc ) = 0;
+
+ // #i68101#
+ virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName) = 0;
+ virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription) = 0;
+ virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxMultiPathDialog(weld::Window* pParent) = 0 ;
+ virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxPathSelectDialog(weld::Window* pParent) = 0 ;
+ virtual VclPtr<AbstractSvxHpLinkDlg> CreateSvxHpLinkDlg(SfxChildWindow* pChild, SfxBindings* pBindings, weld::Window* pParent) = 0;
+ virtual VclPtr<AbstractFmSearchDialog> CreateFmSearchDialog(weld::Window* pParent,
+ const OUString& strInitialText,
+ const ::std::vector< OUString >& _rContexts,
+ sal_Int16 nInitialContext,
+ const Link<FmSearchContext&,sal_uInt32>& lnkContextSupplier)=0;
+ virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterEmboss(weld::Window* pParent,
+ const Graphic& rGraphic)=0;
+ virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterPoster(weld::Window* pParent,
+ const Graphic& rGraphic)=0;
+ virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSepia(weld::Window* pParent,
+ const Graphic& rGraphic)=0;
+ virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSmooth(weld::Window* pParent,
+ const Graphic& rGraphic,
+ double nRadius)=0;
+ virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSolarize(weld::Window* pParent,
+ const Graphic& rGraphic)=0;
+ virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterMosaic(weld::Window* pParent,
+ const Graphic& rGraphic)=0;
+ virtual VclPtr<AbstractSvxAreaTabDialog> CreateSvxAreaTabDialog(weld::Window* pParent,
+ const SfxItemSet* pAttr,
+ SdrModel* pModel,
+ bool bShadow,
+ bool bSlideBackground) = 0 ;
+ virtual VclPtr<SfxAbstractTabDialog> CreateSvxLineTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, //add forSvxLineTabDialog
+ SdrModel* pModel,
+ const SdrObject* pObj,
+ bool bHasObj )=0;
+ virtual VclPtr<SfxAbstractDialog> CreateSfxDialog( weld::Window* pParent,
+ const SfxItemSet& rAttr,
+ const SdrView* pView,
+ sal_uInt32 nResId )=0;
+ virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr,
+ const css::uno::Reference<css::frame::XFrame>& rFrame) = 0;
+ virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog(weld::Widget* pParent, const SfxItemSet& rAttr,
+ const css::uno::Reference< css::frame::XFrame >& rFrame) = 0;
+ virtual VclPtr<AbstractSvxPostItDialog> CreateSvxPostItDialog(weld::Widget* pParent, const SfxItemSet& rCoreSet, bool bPrevNext = false) = 0;
+ virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) override = 0;
+
+ virtual DialogGetRanges GetDialogGetRangesFunc() = 0;
+
+ virtual VclPtr<AbstractScriptSelectorDialog> CreateScriptSelectorDialog(weld::Window* pParent,
+ const css::uno::Reference< css::frame::XFrame >& rxFrame) override = 0;
+
+ virtual void ShowAsyncScriptErrorDialog(weld::Window* pParent, const css::uno::Any& rException) override = 0;
+
+ virtual VclPtr<VclAbstractDialog> CreateSvxMacroAssignDlg(
+ weld::Window* _pParent,
+ const css::uno::Reference< css::frame::XFrame >& _rxDocumentFrame,
+ const bool _bUnoDialogMode,
+ const css::uno::Reference< css::container::XNameReplace >& _rxEvents,
+ const sal_uInt16 _nInitiallySelectedEvent
+ ) = 0;
+
+ virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel )=0;
+
+ virtual VclPtr<SvxAbstractSplitTableDialog> CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, tools::Long nMaxVertical) = 0;
+
+ virtual std::shared_ptr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog(weld::Window* pParent) = 0;
+
+ virtual VclPtr<SvxAbstractInsRowColDlg> CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId) = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svxdllapi.h b/include/svx/svxdllapi.h
new file mode 100644
index 000000000..f799f3d50
--- /dev/null
+++ b/include/svx/svxdllapi.h
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SVXDLLAPI_H
+#define INCLUDED_SVX_SVXDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(SVX_DLLIMPLEMENTATION)
+#define SVX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SVX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SVX_DLLPRIVATE SAL_DLLPRIVATE
+
+#if defined(SVXCORE_DLLIMPLEMENTATION)
+#define SVXCORE_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SVXCORE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SVXCORE_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_SVX_SVXDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svxerr.hxx b/include/svx/svxerr.hxx
new file mode 100644
index 000000000..ecb98cd27
--- /dev/null
+++ b/include/svx/svxerr.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SVXERR_HXX
+#define INCLUDED_SVX_SVXERR_HXX
+
+#include <vcl/errcode.hxx>
+#include <svtools/ehdl.hxx>
+#include <svx/svxdllapi.h>
+
+#define ERRCODE_SVX_LINGU_LINGUNOTEXISTS ErrCode( ErrCodeArea::Svx, ErrCodeClass::NotExists, 3 )
+#define ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE ErrCode( ErrCodeArea::Svx, ErrCodeClass::Write, 6 )
+#define ERRCODE_SVX_GRAPHIC_NOTREADABLE ErrCode( ErrCodeArea::Svx, ErrCodeClass::Read, 7 )
+#define ERRCODE_SVX_LINGU_NOLANGUAGE ErrCode( ErrCodeArea::Svx, ErrCodeClass::NotExists, 9 )
+#define ERRCODE_SVX_MODIFIED_VBASIC_STORAGE ErrCode( WarningFlag::Yes, ErrCodeArea::Svx, ErrCodeClass::Write, 13 )
+#define ERRCODE_SVX_VBASIC_STORAGE_EXIST ErrCode( WarningFlag::Yes, ErrCodeArea::Svx, ErrCodeClass::Write, 14 )
+/** Error message: "Wrong password." */
+#define ERRCODE_SVX_WRONGPASS ErrCode( ErrCodeArea::Svx, ErrCodeClass::NONE, 15)
+/** Error message: "Read error. Unsupported encryption method." */
+#define ERRCODE_SVX_READ_FILTER_CRYPT ErrCode( ErrCodeArea::Svx, ErrCodeClass::Read, 16)
+/** Error message: "Read error. Passwort encrypted Powerpoint documents..." */
+#define ERRCODE_SVX_READ_FILTER_PPOINT ErrCode( ErrCodeArea::Svx, ErrCodeClass::Read, 17)
+/** Error message: "Warning. Passwort protection is not supported when..." */
+#define ERRCODE_SVX_EXPORT_FILTER_CRYPT ErrCode( WarningFlag::Yes, ErrCodeArea::Svx, ErrCodeClass::Export, 18)
+
+
+// both codes will be used twice : with ErrCodeClass::Read- and ErrCodeClass::Write-bits
+#define ERRCTX_SVX_LINGU_THESAURUS 1
+#define ERRCTX_SVX_LINGU_SPELLING 2
+#define ERRCTX_SVX_LINGU_HYPHENATION 3
+#define ERRCTX_SVX_LINGU_DICTIONARY 4
+#define ERRCTX_SVX_BACKGROUND 5
+#define ERRCTX_SVX_IMPORT_GRAPHIC 6
+
+class SVX_DLLPUBLIC SvxErrorHandler final : private SfxErrorHandler
+{
+public:
+ SvxErrorHandler();
+ static void ensure();
+};
+
+SVX_DLLPUBLIC extern const ErrMsgCode RID_SVXERRCODE[];
+SVX_DLLPUBLIC extern const ErrMsgCode RID_SVXERRCTX[];
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svxgraphicitem.hxx b/include/svx/svxgraphicitem.hxx
new file mode 100644
index 000000000..78592f382
--- /dev/null
+++ b/include/svx/svxgraphicitem.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svl/poolitem.hxx>
+#include <svx/svxdllapi.h>
+
+#include <vcl/graph.hxx>
+
+class SVX_DLLPUBLIC SvxGraphicItem final : public SfxPoolItem
+{
+ Graphic aGraphic;
+
+public:
+ SvxGraphicItem( const Graphic& rGraphic);
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxGraphicItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ const Graphic& GetGraphic() const { return aGraphic; }
+
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
new file mode 100644
index 000000000..96122a66b
--- /dev/null
+++ b/include/svx/svxids.hrc
@@ -0,0 +1,1068 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SVXIDS_HRC
+#define INCLUDED_SVX_SVXIDS_HRC
+
+#include <svl/solar.hrc>
+#include <sfx2/sfxsids.hrc>
+#include <editeng/editids.hrc>
+#include <svl/typedwhich.hxx>
+
+class OfaPtrItem;
+class OfaXColorListItem;
+class SdrAngleItem;
+class SfxBoolItem;
+class SfxInt32Item;
+class SfxInt64Item;
+class SfxIntegerListItem;
+class SfxPointItem;
+class SfxRectangleItem;
+class SfxStringItem;
+class SfxUInt32Item;
+class SvxBitmapListItem;
+class SvxBoxInfoItem;
+class SvxBrushItem;
+class SvxChartColorTableItem;
+class SvxColorItem;
+class SvxColorListItem;
+class SvxColumnItem;
+class SvxDashListItem;
+class SvxDoubleItem;
+class SvxGradientListItem;
+class SvxGridItem;
+class SvxHatchListItem;
+class SvxLineEndListItem;
+class SvxLineItem;
+class SvxLongLRSpaceItem;
+class SvxLongULSpaceItem;
+class SvxNumberInfoItem;
+class SvxObjectItem;
+class SvxPageItem;
+class SvxPagePosSizeItem;
+class SvxPatternListItem;
+class SvxPostItAuthorItem;
+class SvxPostItDateItem;
+class SvxPostItIdItem;
+class SvxPostItTextItem;
+class SvxRulerItem;
+class SvxSetItem;
+class SvxSizeItem;
+class SvxSmartTagItem;
+class SvxViewLayoutItem;
+class SvxZoomSliderItem;
+class XFillGradientItem;
+
+// member IDs
+
+#define MID_INTER_LINESPACE 0x36
+#define MID_INTER_SPACE 0x37
+
+#define MID_LOWER 0x3d
+#define MID_RIGHT 0x46
+#define MID_UPPER 0x4b
+
+#define MID_HLINK_NAME 0x6f
+#define MID_HLINK_URL 0x70
+#define MID_HLINK_TARGET 0x71
+#define MID_HLINK_TYPE 0x72
+#define MID_HLINK_TEXT 0x73
+
+#define MID_VIEWLAYOUT_COLUMNS 0x77
+#define MID_VIEWLAYOUT_BOOKMODE 0x78
+
+#define MID_ZOOMSLIDER_CURRENTZOOM 0x79
+#define MID_ZOOMSLIDER_SNAPPINGPOINTS 0x7a
+#define MID_ZOOMSLIDER_MINZOOM 0x7b
+#define MID_ZOOMSLIDER_MAXZOOM 0x7c
+
+// function IDs
+#define FID_SVX_START (SID_LIB_START + 500)
+
+#define FID_SEARCH_ON (FID_SVX_START + 0)
+#define FID_SEARCH_OFF (FID_SVX_START + 1)
+#define FID_SEARCH_NOW (FID_SVX_START + 2)
+
+#define SID_CHARMAP TypedWhichId<SfxStringItem>(FID_SVX_START + 3)
+
+#define FID_SEARCH_SEARCHSET (FID_SVX_START + 4)
+#define FID_SEARCH_REPLACESET (FID_SVX_START + 5)
+
+// SFX IDs
+
+#define SID_POLY_MERGE (SID_SFX_START + 679)
+#define SID_POLY_SUBSTRACT (SID_SFX_START + 680)
+#define SID_POLY_INTERSECT (SID_SFX_START + 681)
+#define SID_DISTRIBUTE_DLG (SID_SFX_START + 683) // dialog replaced by dropdown
+#define SID_EQUALIZEWIDTH (SID_SFX_START + 684)
+#define SID_EQUALIZEHEIGHT (SID_SFX_START + 685)
+#define SID_DISTRIBUTE_HLEFT (SID_SFX_START + 686)
+#define SID_DISTRIBUTE_HCENTER (SID_SFX_START + 687)
+#define SID_DISTRIBUTE_HDISTANCE (SID_SFX_START + 688)
+#define SID_DISTRIBUTE_HRIGHT (SID_SFX_START + 689)
+#define SID_DISTRIBUTE_VTOP (SID_SFX_START + 690)
+#define SID_DISTRIBUTE_VCENTER (SID_SFX_START + 691)
+#define SID_DISTRIBUTE_VDISTANCE (SID_SFX_START + 692)
+#define SID_DISTRIBUTE_VBOTTOM (SID_SFX_START + 693)
+
+// StarBase IDs
+
+#define SID_SBA_BRW_UPDATE (SID_SBA_START+100) // data in fields
+#define SID_SBA_BRW_INSERT (SID_SBA_START+101) // data in text
+#define SID_SBA_BRW_MERGE (SID_SBA_START+102) // form letter
+
+// SD IDs
+
+#define SID_RULER (SID_SD_START+40)
+#define SID_BEZIER_CONVERT (SID_SD_START+65)
+#define SID_BEZIER_ELIMINATE_POINTS (SID_SD_START+30)
+#define SID_BEZIER_EDGE (SID_SD_START+66)
+#define SID_BEZIER_SYMMTR (SID_SD_START+67)
+#define SID_TEXTEDIT (SID_SD_START+76)
+#define SID_ENTER_GROUP (SID_SD_START+96)
+#define SID_LEAVE_GROUP (SID_SD_START+97)
+#define SID_SIZE_PAGE_WIDTH (SID_SD_START+98)
+#define SID_INSERT_MATH (SID_SD_START+106)
+#define SID_SIZE_VISAREA (SID_SD_START+114)
+#define SID_ATTR_SYMBOLTYPE TypedWhichId<SfxInt32Item>(SID_SD_START+115) // used by Chart and SvxLineTabPage
+#define SID_ATTR_SYMBOLSIZE TypedWhichId<SvxSizeItem>(SID_SD_START+116)
+#define SID_HELPLINES_MOVE (SID_SD_START+153)
+#define SID_GRID_USE (SID_SD_START+154)
+#define ID_VAL_MOUSESTART_X (SID_SD_START+200)
+#define ID_VAL_MOUSESTART_Y (SID_SD_START+201)
+ // free
+#define ID_VAL_MOUSEEND_X (SID_SD_START+204)
+#define ID_VAL_MOUSEEND_Y (SID_SD_START+205)
+#define ID_VAL_AXIS_X (SID_SD_START+206)
+#define ID_VAL_AXIS_Y (SID_SD_START+207)
+#define ID_VAL_ANGLESTART (SID_SD_START+208)
+#define ID_VAL_ANGLEEND (SID_SD_START+209)
+#define ID_VAL_CENTER_X (SID_SD_START+210)
+#define ID_VAL_CENTER_Y (SID_SD_START+211)
+#define ID_VAL_STYLE (SID_SD_START+240)
+#define ID_VAL_DOTS (SID_SD_START+241)
+#define ID_VAL_DOTLEN (SID_SD_START+242)
+#define ID_VAL_DASHES (SID_SD_START+243)
+#define ID_VAL_DASHLEN (SID_SD_START+244)
+#define ID_VAL_DISTANCE (SID_SD_START+245)
+#define ID_VAL_INDEX (SID_SD_START+246)
+#define SID_BEZIERTO (SID_SD_START+252)
+#define SID_DASH (SID_SD_START+267)
+#define SID_TEXT_FITTOSIZE_VERTICAL (SID_SD_START+286)
+#define SID_GRID_VISIBLE (SID_SD_START+322)
+#define ID_VAL_USEFIRSTROWSTYLE TypedWhichId<SfxBoolItem>(SID_SD_START+323)
+#define ID_VAL_USELASTROWSTYLE TypedWhichId<SfxBoolItem>(SID_SD_START+324)
+#define ID_VAL_USEBANDINGROWSTYLE TypedWhichId<SfxBoolItem>(SID_SD_START+325)
+#define ID_VAL_USEFIRSTCOLUMNSTYLE TypedWhichId<SfxBoolItem>(SID_SD_START+326)
+#define ID_VAL_USELASTCOLUMNSTYLE TypedWhichId<SfxBoolItem>(SID_SD_START+327)
+#define ID_VAL_USEBANDINGCOLUMNSTYLE TypedWhichId<SfxBoolItem>(SID_SD_START+328)
+
+// Writer IDs
+
+#define FN_EDIT (SID_SW_START + 100) // 20100
+#define FN_NUM_BULLET_OFF (FN_EDIT + 37) // numbering off
+#define FN_NUM_BULLET_ON (FN_EDIT + 38) // numbering with bullets on
+#define FN_NUM_NUMBERING_ON (FN_EDIT + 44) // numbering on
+#define FN_BUL_NUM_RULE_INDEX (FN_EDIT + 120) // achieving num rule index
+#define FN_NUM_NUM_RULE_INDEX (FN_EDIT + 121)
+#define FN_OUTLINE_RULE_INDEX (FN_EDIT + 122)
+
+#define FN_INSERT (SID_SW_START + 300) // 20300
+#define FN_DELETE_BOOKMARK (FN_INSERT + 1)
+#define FN_INSERT_BREAK (FN_INSERT + 3)
+#define FN_INSERT_SOFT_HYPHEN (FN_INSERT + 43) /* optional hyphen */
+#define FN_INSERT_HARD_SPACE (FN_INSERT + 44) /* hard space */
+#define FN_INSERT_NNBSP (FN_INSERT + 45) /* U+202F NARROW NO-BREAK SPACE (NNBSP) */
+#define FN_INSERT_HARDHYPHEN (FN_INSERT + 85) /* hyphen without break*/
+
+//!! be aware to not overwrite something that is used in sw/inc/cmdid.h already !!
+#define FN_FORMAT (SID_SW_START + 400) // 20400
+#define FN_FORMAT_RESET (FN_FORMAT + 69)
+
+#define FN_EXTRA (SID_SW_START + 600) // 20600
+
+#define FN_SELECTION (SID_SW_START + 900) // 20900
+#define FN_END_OF_DOCUMENT (FN_SELECTION + 8)
+#define FN_START_DOC_DIRECT (FN_SELECTION + 78)
+#define FN_END_DOC_DIRECT (FN_SELECTION + 79)
+
+#define FN_PARAM (SID_SW_START + 1100)
+#define FN_PARAM_FILTER TypedWhichId<SfxStringItem>(FN_PARAM + 30)
+#define FN_PARAM_FIELD_CONTENT TypedWhichId<SfxStringItem>(FN_PARAM + 55)
+
+#define FN_PGPREVIEW (SID_SW_START + 1250)
+#define FN_SHOW_MULTIPLE_PAGES (FN_PGPREVIEW + 2)
+
+// Svx-Id's
+// When adding new entries here, note that other SID_SVX_START entries exist in
+// include/editeng/editids.hrc and include/sfx2/sfxsids.hrc so don't use the
+// same id for two different attributes
+
+// CAUTION! Range <1 .. 22> used by EditEngine (!)
+
+#define SID_ATTR_BORDER_INNER TypedWhichId<SvxBoxInfoItem>( SID_SVX_START + 23 )
+
+// CAUTION! Range <24 .. 49> used by EditEngine (!)
+
+#define SID_ATTR_PAGE TypedWhichId<SvxPageItem>( SID_SVX_START + 50 )
+#define SID_ATTR_PAGE_SIZE TypedWhichId<SvxSizeItem>( SID_SVX_START + 51 )
+#define SID_ATTR_PAGE_MAXSIZE TypedWhichId<SvxSizeItem>( SID_SVX_START + 52 )
+#define SID_ATTR_PAGE_ORIENTATION TypedWhichId<SvxPageItem>( SID_SVX_START + 53 )
+#define SID_ATTR_PAGE_PAPERBIN TypedWhichId<SvxPaperBinItem>( SID_SVX_START + 54 )
+// this is used both as a SfxBoolItem(sd/source/ui/func/fupage.cxx) and as a SfxStringItem(sw/source/uibase/utlui/uitool.cxx)
+#define SID_ATTR_PAGE_EXT1 ( SID_SVX_START + 55 )
+#define SID_ATTR_PAGE_EXT2 TypedWhichId<SfxBoolItem>( SID_SVX_START + 56 )
+#define SID_ATTR_PAGE_HEADERSET TypedWhichId<SvxSetItem>( SID_SVX_START + 57 )
+#define SID_ATTR_PAGE_FOOTERSET TypedWhichId<SvxSetItem>( SID_SVX_START + 58 )
+#define SID_ATTR_PAGE_ON TypedWhichId<SfxBoolItem>( SID_SVX_START + 59 )
+#define SID_ATTR_PAGE_DYNAMIC TypedWhichId<SfxBoolItem>( SID_SVX_START + 60 )
+#define SID_ATTR_PAGE_SHARED TypedWhichId<SfxBoolItem>( SID_SVX_START + 61 )
+#define SID_ATTR_PAGE_LRSPACE TypedWhichId<SvxLongLRSpaceItem>( SID_SVX_START + 62 )
+#define SID_ATTR_PAGE_ULSPACE TypedWhichId<SvxLongULSpaceItem>( SID_SVX_START + 63 )
+
+// CAUTION! Range <64 .. 68> used by EditEngine (!)
+
+#define SID_RULER_CHANGE_STATE ( SID_SVX_START + 78 )
+#define SID_RULER_NULL_OFFSET TypedWhichId<SfxPointItem>( SID_SVX_START + 79 )
+#define SID_RULER_BORDERS TypedWhichId<SvxColumnItem>( SID_SVX_START + 80 )
+#define SID_RULER_OBJECT TypedWhichId<SvxObjectItem>( SID_SVX_START + 81 )
+#define SID_RULER_PAGE_POS TypedWhichId<SvxPagePosSizeItem>( SID_SVX_START + 82 )
+#define SID_RULER_ACT_LINE_ONLY TypedWhichId<SfxBoolItem>( SID_SVX_START + 83 )
+#define SID_RULER_LR_MIN_MAX TypedWhichId<SfxUInt32Item>( SID_SVX_START + 84 )
+#define SID_ATTR_NUMBERFORMAT_VALUE TypedWhichId<SfxUInt32Item>( SID_SVX_START + 85 )
+#define SID_ATTR_NUMBERFORMAT_INFO TypedWhichId<SvxNumberInfoItem>( SID_SVX_START + 86 )
+#define SID_ATTR_TRANSFORM TypedWhichId<SfxInt32Item>( SID_SVX_START + 87 )
+#define SID_ATTR_TRANSFORM_POS_X TypedWhichId<SfxInt32Item>( SID_SVX_START + 88 )
+#define SID_ATTR_TRANSFORM_POS_Y TypedWhichId<SfxInt32Item>( SID_SVX_START + 89 )
+#define SID_ATTR_TRANSFORM_WIDTH TypedWhichId<SfxUInt32Item>( SID_SVX_START + 90 )
+#define SID_ATTR_TRANSFORM_HEIGHT TypedWhichId<SfxUInt32Item>( SID_SVX_START + 91 )
+#define SID_ATTR_TRANSFORM_SIZE_POINT TypedWhichId<SfxUInt16Item>( SID_SVX_START + 92 )
+#define SID_ATTR_TRANSFORM_ROT_X TypedWhichId<SfxInt32Item>( SID_SVX_START + 93 )
+#define SID_ATTR_TRANSFORM_ROT_Y TypedWhichId<SfxInt32Item>( SID_SVX_START + 94 )
+#define SID_ATTR_TRANSFORM_ANGLE TypedWhichId<SdrAngleItem>( SID_SVX_START + 95 )
+#define SID_ATTR_TRANSFORM_DELTA_ANGLE TypedWhichId<SdrAngleItem>( SID_SVX_START + 96 )
+// CAUTION! Range <96..100> used by SFX2 (!)
+#define SID_SIZE_ALL ( SID_SVX_START + 101 )
+#define SID_DRAW_LINE ( SID_SVX_START + 102 )
+#define SID_DRAW_XLINE ( SID_SVX_START + 103 )
+#define SID_DRAW_RECT ( SID_SVX_START + 104 )
+#define SID_DRAW_RECT_ROUND ( SID_SVX_START + 105 )
+#define SID_TABLE_CHANGE_CURRENT_BORDER_POSITION ( SID_SVX_START + 106 )
+#define SID_DRAW_ELLIPSE ( SID_SVX_START + 110 )
+#define SID_DRAW_PIE ( SID_SVX_START + 112 )
+#define SID_DRAW_ARC ( SID_SVX_START + 114 )
+#define SID_DRAW_CIRCLECUT ( SID_SVX_START + 115 )
+#define SID_DRAW_POLYGON ( SID_SVX_START + 117 )
+#define SID_DRAW_BEZIER_FILL ( SID_SVX_START + 118 )
+#define SID_BEZIER_INSERT ( SID_SVX_START + 119 )
+#define SID_BEZIER_DELETE ( SID_SVX_START + 120 )
+#define SID_BEZIER_MOVE ( SID_SVX_START + 121 )
+#define SID_BEZIER_CLOSE TypedWhichId<SfxBoolItem>( SID_SVX_START + 122 )
+#define SID_BEZIER_SMOOTH TypedWhichId<SfxBoolItem>( SID_SVX_START + 123 )
+#define SID_BEZIER_EDIT ( SID_SVX_START + 126 )
+#define SID_BEZIER_CUTLINE ( SID_SVX_START + 127 )
+#define SID_OBJECT_SELECT ( SID_SVX_START + 128 )
+#define SID_OBJECT_ROTATE TypedWhichId<SfxBoolItem>( SID_SVX_START + 129 )
+#define SID_OBJECT_ALIGN ( SID_SVX_START + 130 )
+#define SID_OBJECT_ALIGN_LEFT ( SID_SVX_START + 131 )
+#define SID_OBJECT_ALIGN_CENTER ( SID_SVX_START + 132 )
+#define SID_OBJECT_ALIGN_RIGHT ( SID_SVX_START + 133 )
+#define SID_OBJECT_ALIGN_UP ( SID_SVX_START + 134 )
+#define SID_OBJECT_ALIGN_MIDDLE ( SID_SVX_START + 135 )
+#define SID_OBJECT_ALIGN_DOWN ( SID_SVX_START + 136 )
+#define SID_INSERT_DIAGRAM ( SID_SVX_START + 140 )
+#define SID_INSERT_TABLE ( SID_SVX_START + 141 )
+#define SID_ATTRIBUTES_AREA ( SID_SVX_START + 142 )
+#define SID_ATTRIBUTES_LINE ( SID_SVX_START + 143 )
+#define SID_CHOOSE_CONTROLS ( SID_SVX_START + 144 )
+#define SID_INSERT_PUSHBUTTON ( SID_SVX_START + 146 )
+#define SID_INSERT_RADIOBUTTON ( SID_SVX_START + 147 )
+#define SID_INSERT_CHECKBOX ( SID_SVX_START + 148 )
+#define SID_OUTLINE_UP ( SID_SVX_START + 150 )
+#define SID_OUTLINE_DOWN ( SID_SVX_START + 151 )
+#define SID_OUTLINE_LEFT ( SID_SVX_START + 152 )
+#define SID_OUTLINE_RIGHT ( SID_SVX_START + 153 )
+#define SID_OUTLINE_FORMAT ( SID_SVX_START + 154 )
+#define SID_OUTLINE_COLLAPSE_ALL ( SID_SVX_START + 155 )
+#define SID_OUTLINE_BULLET ( SID_SVX_START + 156 )
+#define SID_PRESENTATION ( SID_SVX_START + 157 )
+#define SID_PRESENTATION_CURRENT_SLIDE ( SID_SVX_START + 158 )
+#define SID_REHEARSE_TIMINGS ( SID_SVX_START + 159 )
+//
+#define SID_HIDE_SLIDE ( SID_SVX_START + 161 )
+#define SID_ATTR_FILL_STYLE ( SID_SVX_START + 164 )
+#define SID_ATTR_FILL_COLOR ( SID_SVX_START + 165 )
+#define SID_ATTR_FILL_GRADIENT ( SID_SVX_START + 166 )
+#define SID_ATTR_FILL_HATCH ( SID_SVX_START + 167 )
+#define SID_ATTR_FILL_BITMAP ( SID_SVX_START + 168 )
+#define SID_ATTR_LINE_STYLE ( SID_SVX_START + 169 )
+#define SID_ATTR_LINE_DASH ( SID_SVX_START + 170 )
+#define SID_ATTR_LINE_WIDTH ( SID_SVX_START + 171 )
+#define SID_ATTR_LINE_COLOR ( SID_SVX_START + 172 )
+#define SID_ATTR_LINE_START ( SID_SVX_START + 173 )
+#define SID_ATTR_LINE_END ( SID_SVX_START + 174 )
+#define SID_ATTR_LINE_STARTWIDTH ( SID_SVX_START + 175 )
+#define SID_ATTR_LINE_ENDWIDTH ( SID_SVX_START + 176 )
+#define SID_ATTR_LINE_STARTCENTER ( SID_SVX_START + 177 )
+#define SID_ATTR_LINE_ENDCENTER ( SID_SVX_START + 178 )
+#define SID_COLOR_TABLE TypedWhichId<SvxColorListItem>( SID_SVX_START + 179 )
+#define SID_GRADIENT_LIST TypedWhichId<SvxGradientListItem>( SID_SVX_START + 180 )
+#define SID_HATCH_LIST TypedWhichId<SvxHatchListItem>( SID_SVX_START + 181 )
+#define SID_BITMAP_LIST TypedWhichId<SvxBitmapListItem>( SID_SVX_START + 182 )
+#define SID_PATTERN_LIST TypedWhichId<SvxPatternListItem>( SID_SVX_START + 183 )
+#define SID_DASH_LIST TypedWhichId<SvxDashListItem>( SID_SVX_START + 184 )
+#define SID_LINEEND_LIST TypedWhichId<SvxLineEndListItem>( SID_SVX_START + 185 )
+#define SID_BACKGROUND_COLOR TypedWhichId<SvxColorItem>( SID_SVX_START + 186 )
+#define SID_BACKGROUND_PATTERN ( SID_SVX_START + 187 )
+#define SID_ATTR_BORDER ( SID_SVX_START + 188 )
+#define SID_INSERT_FIXEDTEXT ( SID_SVX_START + 189 )
+#define SID_INSERT_GROUPBOX ( SID_SVX_START + 190 )
+#define SID_INSERT_EDIT ( SID_SVX_START + 191 )
+#define SID_INSERT_LISTBOX ( SID_SVX_START + 192 )
+#define SID_INSERT_COMBOBOX ( SID_SVX_START + 193 )
+#define SID_INSERT_SPINBUTTON ( SID_SVX_START + 194 )
+#define SID_INSERT_HSCROLLBAR ( SID_SVX_START + 195 )
+#define SID_INSERT_VSCROLLBAR ( SID_SVX_START + 196 )
+#define SID_INSERT_SELECT ( SID_SVX_START + 199 )
+#define SID_DIALOG_TESTMODE ( SID_SVX_START + 200 )
+#define SID_FRAME_LINESTYLE TypedWhichId<SvxLineItem>( SID_SVX_START + 201 )
+#define SID_FRAME_LINECOLOR TypedWhichId<SvxColorItem>( SID_SVX_START + 202 )
+#define SID_ATTR_LINE_WIDTH_ARG TypedWhichId<SvxDoubleItem>( SID_SVX_START + 203 )
+#define SID_FILL_GRADIENT_JSON TypedWhichId<SfxStringItem>( SID_SVX_START + 204 )
+#define SID_SEARCHDLG_SEARCHSTRINGS ( SID_SVX_START + 215 )
+#define SID_SEARCHDLG_REPLACESTRINGS ( SID_SVX_START + 216 )
+#define SID_ATTR_TABLE ( SID_SVX_START + 217 )
+#define SID_ATTR_TABLE_COLUMN TypedWhichId<SfxUInt16Item>( SID_SVX_START + 218 )
+#define SID_ATTR_TABLE_ROW TypedWhichId<SfxUInt16Item>( SID_SVX_START + 219 )
+#define SID_ATTR_COLUMNS TypedWhichId<SfxUInt16Item>( SID_SVX_START + 220 )
+#define SID_ATTR_INSERT TypedWhichId<SfxBoolItem>( SID_SVX_START + 221 )
+#define SID_ATTR_ZOOM_USER TypedWhichId<SfxUInt16Item>( SID_SVX_START + 222 )
+#define SID_ATTR_POSITION TypedWhichId<SfxPointItem>( SID_SVX_START + 223 )
+#define SID_ATTR_SIZE TypedWhichId<SvxSizeItem>( SID_SVX_START + 224 )
+#define SID_TABLE_CELL ( SID_SVX_START + 225 )
+#define SID_ATTR_ALIGN_MARGIN ( SID_SVX_START + 228 )
+#define SID_ATTR_ALIGN_STACKED ( SID_SVX_START + 229 )
+#define SID_ATTR_ALIGN_LINEBREAK ( SID_SVX_START + 230 )
+#define SID_OUTLINE_COLLAPSE ( SID_SVX_START + 231 )
+#define SID_OUTLINE_EXPAND_ALL ( SID_SVX_START + 232 )
+#define SID_OUTLINE_EXPAND ( SID_SVX_START + 233 )
+#define SID_OUTLINE_DELETEALL ( SID_SVX_START + 234 )
+#define SID_ATTR_TRANSFORM_PROTECT_POS TypedWhichId<SfxBoolItem>( SID_SVX_START + 236 )
+#define SID_ATTR_TRANSFORM_PROTECT_SIZE TypedWhichId<SfxBoolItem>( SID_SVX_START + 237 )
+#define SID_ATTR_TRANSFORM_AUTOSIZE ( SID_SVX_START + 238 ) // !!!
+#define SID_ATTR_TRANSFORM_INTERN TypedWhichId<SfxRectangleItem>( SID_SVX_START + 239 )
+#define SID_INSERT_FRAME ( SID_SVX_START + 240 )
+#define SID_INSERT_GRAPHIC TypedWhichId<SfxStringItem>( SID_SVX_START + 241 )
+#define SID_AUTOFORMAT TypedWhichId<SfxStringItem>( SID_SVX_START + 242 )
+#define SID_SPELL_DIALOG ( SID_SVX_START + 243 )
+#define SID_INSERT_DRAW ( SID_SVX_START + 244 )
+#define SID_THESAURUS ( SID_SVX_START + 245 )
+#define SID_SPELLCHECK_IGNORE ( SID_SVX_START + 246 )
+#define SID_SPELLCHECK_IGNORE_ALL ( SID_SVX_START + 247 )
+#define SID_SPELLCHECK_APPLY_SUGGESTION ( SID_SVX_START + 248 )
+#define SID_REGENERATE_DIAGRAM ( SID_SVX_START + 249 )
+#define SID_EDIT_DIAGRAM ( SID_SVX_START + 450 )
+
+// CAUTION! Range <250 .. 250> used by EditEngine (!)
+
+#define SID_DRAW_TEXT ( SID_SVX_START + 253 )
+#define SID_DRAW_CAPTION ( SID_SVX_START + 254 )
+#define SID_DRAW_SELECT ( SID_SVX_START + 255 )
+#define SID_FONTWORK ( SID_SVX_START + 256 )
+#define SID_FORMTEXT_STYLE ( SID_SVX_START + 257 )
+#define SID_FORMTEXT_ADJUST ( SID_SVX_START + 258 )
+#define SID_FORMTEXT_DISTANCE ( SID_SVX_START + 259 )
+#define SID_FORMTEXT_START ( SID_SVX_START + 260 )
+#define SID_FORMTEXT_MIRROR ( SID_SVX_START + 261 )
+#define SID_FORMTEXT_OUTLINE ( SID_SVX_START + 262 )
+#define SID_FORMTEXT_SHADOW ( SID_SVX_START + 263 )
+#define SID_FORMTEXT_SHDWCOLOR ( SID_SVX_START + 264 )
+#define SID_FORMTEXT_SHDWXVAL ( SID_SVX_START + 265 )
+#define SID_FORMTEXT_SHDWYVAL ( SID_SVX_START + 266 )
+#define SID_FORMTEXT_HIDEFORM ( SID_SVX_START + 268 )
+#define SID_GALLERY_ENABLE_ADDCOPY ( SID_SVX_START + 276 )
+#define SID_GALLERY_BG_POS ( SID_SVX_START + 278 )
+#define SID_GALLERY_FORMATS ( SID_SVX_START + 280 )
+#define SID_OBJECT_HELL ( SID_SVX_START + 282 )
+#define SID_OBJECT_HEAVEN ( SID_SVX_START + 283 )
+#define SID_ATTR_LONG_ULSPACE TypedWhichId<SvxLongULSpaceItem>( SID_SVX_START + 284 )
+#define SID_ATTR_LONG_LRSPACE TypedWhichId<SvxLongLRSpaceItem>( SID_SVX_START + 285 )
+#define SID_FRAME_TO_TOP ( SID_SVX_START + 286 )
+#define SID_FRAME_TO_BOTTOM ( SID_SVX_START + 287 )
+#define SID_SEARCH_SEARCHSET TypedWhichId<SvxSetItem>( SID_SVX_START + 292 )
+#define SID_SEARCH_REPLACESET TypedWhichId<SvxSetItem>( SID_SVX_START + 293 )
+#define SID_SET_SUPER_SCRIPT ( SID_SVX_START + 294 )
+#define SID_SET_SUB_SCRIPT ( SID_SVX_START + 295 )
+#define SID_CHAR_DLG ( SID_SVX_START + 296 )
+#define SID_PARA_DLG ( SID_SVX_START + 297 )
+#define SID_ATTR_GRID_OPTIONS TypedWhichId<SvxGridItem>( SID_SVX_START + 298 )
+#define SID_ATTR_FILL_SHADOW ( SID_SVX_START + 299 )
+
+// CAUTION! Range <300 .. 300> used by EditEngine (!)
+
+#define SID_ATTR_LINEEND_STYLE ( SID_SVX_START + 301 )
+#define SID_ATTR_TRANSFORM_SHEAR TypedWhichId<SdrAngleItem>( SID_SVX_START + 304 )
+#define SID_ATTR_TRANSFORM_SHEAR_X ( SID_SVX_START + 305 )
+#define SID_ATTR_TRANSFORM_SHEAR_Y ( SID_SVX_START + 306 )
+#define SID_ATTR_TRANSFORM_SHEAR_VERTICAL TypedWhichId<SfxBoolItem>( SID_SVX_START + 307 )
+#define SID_ATTR_TRANSFORM_RESIZE_REF_X ( SID_SVX_START + 308 )
+#define SID_ATTR_TRANSFORM_RESIZE_REF_Y ( SID_SVX_START + 309 )
+#define SID_ATTR_TRANSFORM_AUTOWIDTH TypedWhichId<SfxBoolItem>( SID_SVX_START + 310 )
+#define SID_ATTR_TRANSFORM_AUTOHEIGHT TypedWhichId<SfxBoolItem>( SID_SVX_START + 311 )
+#define SID_ATTR_TRANSFORM_HORI_RELATION TypedWhichId<SfxInt16Item>( SID_SVX_START + 312 )
+#define SID_ATTR_TRANSFORM_VERT_RELATION TypedWhichId<SfxInt16Item>( SID_SVX_START + 313 )
+#define SID_ATTR_TRANSFORM_HORI_ORIENT TypedWhichId<SfxInt16Item>( SID_SVX_START + 314 )
+#define SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT ( SID_SVX_START + 315 )
+#define SID_ATTR_TRANSFORM_IN_RTL_TEXT ( SID_SVX_START + 316 )
+#define SID_ATTR_TRANSFORM_HORI_MIRROR TypedWhichId<SfxBoolItem>( SID_SVX_START + 317 )
+#define SID_ATTR_TRANSFORM_ANCHOR TypedWhichId<SfxInt16Item>( SID_SVX_START + 318 )
+#define SID_ATTR_TRANSFORM_VERT_ORIENT TypedWhichId<SfxInt16Item>( SID_SVX_START + 319 )
+#define SID_ATTR_GLOW_RADIUS ( SID_SVX_START + 320 )
+#define SID_ATTR_GLOW_COLOR ( SID_SVX_START + 321 )
+#define SID_ATTR_GLOW_TRANSPARENCY ( SID_SVX_START + 322 )
+#define SID_ATTR_SOFTEDGE_RADIUS ( SID_SVX_START + 323 )
+#define SID_SCAN ( SID_SVX_START + 330 )
+#define SID_TWAIN_SELECT ( SID_SVX_START + 331 )
+#define SID_TWAIN_TRANSFER ( SID_SVX_START + 332 )
+#define SID_CONTOUR_DLG ( SID_SVX_START + 334 )
+#define SID_CONTOUR_EXEC ( SID_SVX_START + 335 )
+
+//#define SID_SIDEBAR ( SID_SVX_START + 336 ) -> sfxsids.hrc
+
+#define SID_ATTR_TEXTCOLUMNS_NUMBER ( SID_SVX_START + 340 )
+#define SID_ATTR_TEXTCOLUMNS_SPACING ( SID_SVX_START + 341 )
+
+#define SID_ATTR_COLOR_THEME_INDEX TypedWhichId<SfxInt16Item>( SID_SVX_START + 342 )
+#define SID_ATTR_COLOR_LUM_MOD TypedWhichId<SfxInt16Item>( SID_SVX_START + 343 )
+#define SID_ATTR_COLOR_LUM_OFF TypedWhichId<SfxInt16Item>( SID_SVX_START + 344 )
+
+#define SID_SB_CONNECTIONPOOLING ( SID_SVX_START + 348 )
+#define SID_SB_DBREGISTEROPTIONS ( SID_SVX_START + 349 )
+#define SID_BMPMASK ( SID_SVX_START + 350 )
+#define SID_BMPMASK_PIPETTE ( SID_SVX_START + 351 )
+#define SID_BMPMASK_EXEC ( SID_SVX_START + 353 )
+
+// CAUTION! Range <363 .. 363> used by EditEngine (!)
+
+#define SID_ATTR_TEXT_FITTOSIZE ( SID_SVX_START + 367 )
+#define SID_ATTR_BRUSH_ROW TypedWhichId<SvxBrushItem>( SID_SVX_START + 368 )
+#define SID_OPTFILTER_MSOFFICE ( SID_SVX_START + 369 )
+#define SID_IMAP ( SID_SVX_START + 371 )
+#define SID_IMAP_EXEC ( SID_SVX_START + 374 )
+#define SID_DRAW_RECT_NOFILL ( SID_SVX_START + 378 )
+#define SID_DRAW_RECT_ROUND_NOFILL ( SID_SVX_START + 379 )
+#define SID_DRAW_SQUARE ( SID_SVX_START + 380 )
+#define SID_DRAW_SQUARE_ROUND ( SID_SVX_START + 381 )
+#define SID_DRAW_SQUARE_NOFILL ( SID_SVX_START + 382 )
+#define SID_DRAW_SQUARE_ROUND_NOFILL ( SID_SVX_START + 383 )
+#define SID_DRAW_ELLIPSE_NOFILL ( SID_SVX_START + 384 )
+#define SID_DRAW_CIRCLE ( SID_SVX_START + 385 )
+#define SID_DRAW_CIRCLE_NOFILL ( SID_SVX_START + 386 )
+#define SID_DRAW_PIE_NOFILL ( SID_SVX_START + 387 )
+#define SID_DRAW_CIRCLEPIE ( SID_SVX_START + 388 )
+#define SID_DRAW_CIRCLEPIE_NOFILL ( SID_SVX_START + 389 )
+#define SID_DRAW_CIRCLEARC ( SID_SVX_START + 390 )
+#define SID_DRAW_CIRCLECUT_NOFILL ( SID_SVX_START + 391 )
+#define SID_DRAW_ELLIPSECUT ( SID_SVX_START + 392 )
+#define SID_DRAW_ELLIPSECUT_NOFILL ( SID_SVX_START + 393 )
+#define SID_DRAW_XPOLYGON ( SID_SVX_START + 394 )
+#define SID_DRAW_POLYGON_NOFILL ( SID_SVX_START + 395 )
+#define SID_DRAW_XPOLYGON_NOFILL ( SID_SVX_START + 396 )
+#define SID_DRAW_BEZIER_NOFILL ( SID_SVX_START + 397 )
+#define SID_DRAWTBX_TEXT ( SID_SVX_START + 398 )
+#define SID_DRAWTBX_RECTANGLES ( SID_SVX_START + 399 )
+#define SID_DRAWTBX_ELLIPSES ( SID_SVX_START + 400 )
+#define SID_DRAWTBX_LINES ( SID_SVX_START + 401 )
+#define SID_BACKGRND_DESTINATION TypedWhichId<SfxUInt16Item>( SID_SVX_START + 404 )
+#define SID_ATTR_FLASH ( SID_SVX_START + 406 )
+
+// CAUTION! Range <413 .. 413> used by EditEngine (!)
+
+#define SID_DRAWTBX_REDACTED_EXPORT ( SID_SVX_START + 606 )
+
+#define SID_ATTR_3D_START ( SID_SVX_START + 415 )
+#define SID_RULER_PROTECT SID_ATTR_3D_START
+#define SID_COLOR_CONTROL ( SID_SVX_START + 417 )
+
+#define SID_TABLE_INSERT_COL_BEFORE ( SID_SVX_START + 418 )
+#define SID_TABLE_INSERT_COL_AFTER ( SID_SVX_START + 419 )
+#define SID_TABLE_INSERT_ROW_BEFORE ( SID_SVX_START + 420 )
+#define SID_TABLE_INSERT_ROW_AFTER ( SID_SVX_START + 421 )
+
+#define SID_ATTR_3D_INTERN TypedWhichId<SfxUInt32Item>( SID_SVX_START + 422 )
+#define SID_PSZ_FUNCTION ( SID_SVX_START + 423 )
+
+// CAUTION! <424 > used by sfxids (!)
+#define SID_TABLE_INSERT_COL_DLG ( SID_SVX_START + 426 )
+#define SID_TABLE_INSERT_ROW_DLG ( SID_SVX_START + 427 )
+#define SID_TABLE_PARAM_INSERT_AFTER TypedWhichId<SfxBoolItem>( SID_SVX_START + 428 )
+
+#define SID_TABLEDESIGN ( SID_SVX_START + 429 )
+#define SID_GENERAL_OPTIONS ( SID_SVX_START + 432 )
+#define SID_SW_EDITOPTIONS ( SID_SVX_START + 433 )
+#define SID_SD_EDITOPTIONS ( SID_SVX_START + 434 )
+#define SID_SC_EDITOPTIONS ( SID_SVX_START + 435 )
+#define SID_SM_EDITOPTIONS ( SID_SVX_START + 436 )
+#define SID_SCH_EDITOPTIONS TypedWhichId<SvxChartColorTableItem>( SID_SVX_START + 437 )
+#define SID_SW_ONLINEOPTIONS ( SID_SVX_START + 439 )
+#define SID_GET_COLORLIST TypedWhichId<OfaXColorListItem>( SID_SVX_START + 441 )
+#define SID_OUTLINE_TO_IMPRESS ( SID_SVX_START + 443 )
+#define SID_SPELLCHECKER_CHANGED ( SID_SVX_START + 446 )
+#define SID_SD_GRAPHIC_OPTIONS ( SID_SVX_START + 447 )
+#define SID_SM_TP_PRINTOPTIONS ( SID_SVX_START + 448 )
+#define SID_SB_STARBASEOPTIONS ( SID_SVX_START + 450 )
+#define SID_SWREGISTER_COLLECTION TypedWhichId<SfxStringItem>( SID_SVX_START + 451 )
+#define SID_FILTER_DLG ( SID_SVX_START + 452 )
+#define SID_ATTR_BRUSH_TABLE TypedWhichId<SvxBrushItem>( SID_SVX_START + 453 )
+#define SID_GROUP ( SID_SVX_START + 454 )
+#define SID_UNGROUP ( SID_SVX_START + 455 )
+#define SID_SET_DEFAULT ( SID_SVX_START + 456 )
+
+// CAUTION! Range <457 .. 457> used by EditEngine (!)
+
+#define SID_REMOVE_HYPERLINK ( SID_SVX_START + 459 )
+#define SID_ATTR_ALIGN_INDENT ( SID_SVX_START + 460 )
+#define SID_DEC_INDENT ( SID_SVX_START + 461 )
+#define SID_INC_INDENT ( SID_SVX_START + 462 )
+#define SID_DRAW_FREELINE ( SID_SVX_START + 463 )
+#define SID_DRAW_FREELINE_NOFILL ( SID_SVX_START + 464 )
+#define SID_DRAW_TEXT_MARQUEE ( SID_SVX_START + 465 )
+#define SID_SWREGISTER_MODE TypedWhichId<SfxBoolItem>( SID_SVX_START + 467 )
+#define SID_GRFFILTER ( SID_SVX_START + 469 )
+#define SID_GRFFILTER_INVERT ( SID_SVX_START + 470 )
+#define SID_GRFFILTER_SMOOTH ( SID_SVX_START + 471 )
+#define SID_GRFFILTER_SHARPEN ( SID_SVX_START + 472 )
+#define SID_GRFFILTER_REMOVENOISE ( SID_SVX_START + 473 )
+#define SID_GRFFILTER_SOBEL ( SID_SVX_START + 474 )
+#define SID_GRFFILTER_MOSAIC ( SID_SVX_START + 475 )
+#define SID_GRFFILTER_EMBOSS ( SID_SVX_START + 476 )
+#define SID_GRFFILTER_POSTER ( SID_SVX_START + 477 )
+#define SID_GRFFILTER_POPART ( SID_SVX_START + 478 )
+#define SID_GRFFILTER_SEPIA ( SID_SVX_START + 479 )
+#define SID_GRFFILTER_SOLARIZE ( SID_SVX_START + 480 )
+#define SID_FIELD_GRABFOCUS ( SID_SVX_START + 567 )
+#define SID_ATTR_ALIGN_DEGREES ( SID_SVX_START + 577 )
+#define SID_ATTR_ALIGN_LOCKPOS ( SID_SVX_START + 578 )
+#define SID_ATTR_NUMBERFORMAT_ONE_AREA ( SID_SVX_START + 580 )
+#define SID_TABSTOP_ADD_OR_CHANGE ( SID_SVX_START + 581 )
+#define SID_TABSTOP_ATTR_INDEX ( SID_SVX_START + 582 )
+#define SID_TABSTOP_ATTR_POSITION ( SID_SVX_START + 583 )
+#define SID_TABSTOP_ATTR_REMOVE ( SID_SVX_START + 584 )
+
+// CAUTION! Range <587 .. 587> used by EditEngine (!)
+
+#define SID_PARAGRAPH_FIRST_LINE_INDENT TypedWhichId<SfxStringItem>( SID_SVX_START + 588 )
+#define SID_PARAGRAPH_LEFT_INDENT TypedWhichId<SfxStringItem>( SID_SVX_START + 589 )
+#define SID_PARAGRAPH_RIGHT_INDENT TypedWhichId<SfxStringItem>( SID_SVX_START + 590 )
+
+// CAUTION! Range <591 .. 591> used by EditEngine (!)
+
+#define SID_FMSLOTS_START ( SID_SVX_START + 592 )
+#define SID_FM_CONFIG ( SID_SVX_START + 593 )
+#define SID_FM_PUSHBUTTON ( SID_SVX_START + 594 )
+#define SID_FM_RADIOBUTTON ( SID_SVX_START + 595 )
+#define SID_FM_CHECKBOX ( SID_SVX_START + 596 )
+#define SID_FM_FIXEDTEXT ( SID_SVX_START + 597 )
+#define SID_FM_GROUPBOX ( SID_SVX_START + 598 )
+#define SID_FM_EDIT ( SID_SVX_START + 599 )
+#define SID_FM_LISTBOX ( SID_SVX_START + 600 )
+#define SID_FM_COMBOBOX ( SID_SVX_START + 601 )
+#define SID_FM_DBGRID ( SID_SVX_START + 603 )
+#define SID_FM_IMAGEBUTTON ( SID_SVX_START + 604 )
+#define SID_FM_FILECONTROL ( SID_SVX_START + 605 )
+//( SID_SVX_START + 606 ) is used by SID_DRAWTBX_REDACTED_EXPORT
+#define SID_FM_NAVIGATIONBAR ( SID_SVX_START + 607 )
+//FREE
+//FREE
+#define SID_FM_DELETEROWS ( SID_SVX_START + 610 )
+//FREE
+//FREE
+#define SID_FM_CTL_PROPERTIES TypedWhichId<SfxBoolItem>( SID_SVX_START + 613 )
+#define SID_FM_PROPERTIES ( SID_SVX_START + 614 )
+#define SID_FM_TAB_DIALOG ( SID_SVX_START + 615 )
+#define SID_FM_RECORD_FIRST ( SID_SVX_START + 616 )
+#define SID_FM_RECORD_NEXT ( SID_SVX_START + 617 )
+#define SID_FM_RECORD_PREV ( SID_SVX_START + 618 )
+#define SID_FM_RECORD_LAST ( SID_SVX_START + 619 )
+#define SID_FM_RECORD_NEW ( SID_SVX_START + 620 )
+#define SID_FM_RECORD_DELETE ( SID_SVX_START + 621 )
+#define SID_FM_RECORD_ABSOLUTE ( SID_SVX_START + 622 )
+#define SID_FM_ADD_FIELD ( SID_SVX_START + 623 )
+#define SID_FM_RECORD_TEXT ( SID_SVX_START + 624 )
+#define SID_FM_RECORD_FROM_TEXT ( SID_SVX_START + 625 )
+#define SID_FM_RECORD_TOTAL ( SID_SVX_START + 626 )
+#define SID_FM_RECORD_SAVE ( SID_SVX_START + 627 )
+#define SID_FM_CREATE_CONTROL ( SID_SVX_START + 628 )
+#define SID_FM_DESIGN_MODE ( SID_SVX_START + 629 )
+#define SID_FM_RECORD_UNDO ( SID_SVX_START + 630 )
+#define SID_FM_CONTROL_IDENTIFIER ( SID_SVX_START + 631 )
+#define SID_FM_CONTROL_INVENTOR ( SID_SVX_START + 632 )
+#define SID_FM_SHOW_FMEXPLORER ( SID_SVX_START + 633 )
+#define SID_FM_FIELDS_CONTROL ( SID_SVX_START + 634 )
+#define SID_FM_SHOW_PROPERTIES ( SID_SVX_START + 635 )
+#define SID_FM_PROPERTY_CONTROL ( SID_SVX_START + 636 )
+#define SID_FM_FMEXPLORER_CONTROL ( SID_SVX_START + 637 )
+//FREE
+//FREE
+//FREE
+#define SID_3D_WIN ( SID_SVX_START + 644 )
+#define SID_3D_STATE ( SID_SVX_START + 645 )
+#define SID_3D_INIT ( SID_SVX_START + 646 )
+#define SID_3D_ASSIGN ( SID_SVX_START + 647 )
+#define SID_CONVERT_TO_3D ( SID_SVX_START + 648 )
+#define SID_CONVERT_TO_3D_LATHE_FAST ( SID_SVX_START + 649 )
+#define SID_ATTR_3D_END SID_CONVERT_TO_3D_LATHE_FAST
+#define SID_ATTR_NUMBERFORMAT_NOLANGUAGE TypedWhichId<SfxBoolItem>( SID_SVX_START + 700 )
+
+#define SID_MORE_FMSLOTS_START ( SID_SVX_START + 702 )
+#define SID_FM_SHOW_PROPERTY_BROWSER ( SID_SVX_START + 703 )
+#define SID_FM_DATEFIELD ( SID_SVX_START + 704 )
+#define SID_FM_TIMEFIELD ( SID_SVX_START + 705 )
+#define SID_FM_NUMERICFIELD ( SID_SVX_START + 706 )
+#define SID_FM_CURRENCYFIELD ( SID_SVX_START + 707 )
+#define SID_FM_PATTERNFIELD ( SID_SVX_START + 708 )
+#define SID_FM_OPEN_READONLY ( SID_SVX_START + 709 )
+#define SID_FM_IMAGECONTROL ( SID_SVX_START + 710 )
+#define SID_FM_REMOVE_FILTER_SORT ( SID_SVX_START + 711 )
+#define SID_FM_SORTUP ( SID_SVX_START + 712 )
+#define SID_FM_SORTDOWN ( SID_SVX_START + 713 )
+#define SID_FM_ORDERCRIT ( SID_SVX_START + 714 )
+#define SID_FM_FILTERCRIT ( SID_SVX_START + 715 )
+#define SID_FM_AUTOFILTER ( SID_SVX_START + 716 )
+#define SID_FM_NATIVESQL ( SID_SVX_START + 720 )
+#define SID_FM_EXECUTE ( SID_SVX_START + 721 )
+#define SID_SBA_QRY_EXECUTE SID_FM_EXECUTE
+#define SID_FM_ADDTABLE ( SID_SVX_START + 722 )
+#define SID_FM_FORM_FILTERED ( SID_SVX_START + 723 )
+#define SID_FM_REFRESH ( SID_SVX_START + 724 )
+#define SID_FM_SEARCH ( SID_SVX_START + 725 )
+#define SID_FM_LEAVE_CREATE ( SID_SVX_START + 726 ) // pop Formcontroller Button
+#define SID_FM_USE_WIZARDS ( SID_SVX_START + 727 )
+#define SID_FM_FORMATTEDFIELD ( SID_SVX_START + 728 )
+#define SID_FM_FILTER_START ( SID_SVX_START + 729 )
+#define SID_FM_FILTER_EXIT ( SID_SVX_START + 730 )
+#define SID_FM_FILTER_EXECUTE ( SID_SVX_START + 731 )
+#define SID_FM_FILTER_NAVIGATOR ( SID_SVX_START + 732 )
+#define SID_FM_CHANGECONTROLTYPE ( SID_SVX_START + 733 )
+#define SID_FM_CONVERTTO_EDIT ( SID_SVX_START + 734 )
+#define SID_FM_CONVERTTO_BUTTON ( SID_SVX_START + 735 )
+#define SID_FM_CONVERTTO_FIXEDTEXT ( SID_SVX_START + 736 )
+#define SID_FM_CONVERTTO_LISTBOX ( SID_SVX_START + 737 )
+#define SID_FM_CONVERTTO_CHECKBOX ( SID_SVX_START + 738 )
+#define SID_FM_CONVERTTO_RADIOBUTTON ( SID_SVX_START + 739 )
+#define SID_FM_CONVERTTO_GROUPBOX ( SID_SVX_START + 740 )
+#define SID_FM_CONVERTTO_COMBOBOX ( SID_SVX_START + 741 )
+#define SID_FM_CONVERTTO_IMAGEBUTTON ( SID_SVX_START + 743 )
+#define SID_FM_CONVERTTO_FILECONTROL ( SID_SVX_START + 744 )
+#define SID_FM_CONVERTTO_DATE ( SID_SVX_START + 745 )
+#define SID_FM_CONVERTTO_TIME ( SID_SVX_START + 746 )
+#define SID_FM_CONVERTTO_NUMERIC ( SID_SVX_START + 747 )
+#define SID_FM_CONVERTTO_CURRENCY ( SID_SVX_START + 748 )
+#define SID_FM_CONVERTTO_PATTERN ( SID_SVX_START + 749 )
+#define SID_FM_CONVERTTO_IMAGECONTROL ( SID_SVX_START + 750 )
+#define SID_FM_CONVERTTO_FORMATTED ( SID_SVX_START + 751 )
+#define SID_FM_FILTER_NAVIGATOR_CONTROL ( SID_SVX_START + 752 )
+#define SID_INSERT_GRIDCONTROL ( SID_SVX_START + 753 )
+#define SID_PARAGRAPH_CHANGE_STATE ( SID_SVX_START + 754 )
+
+#define SID_ATTR_SHADOW_BLUR ( SID_SVX_START + 755 )
+
+//FREE
+//FREE
+//FREE
+//FREE
+//FREE
+#define SID_FM_VIEW_AS_GRID ( SID_SVX_START + 761 )
+#define SID_FM_AUTOCONTROLFOCUS ( SID_SVX_START + 763 )
+#define SID_DSBROWSER_EXPLORER ( SID_SVX_START + 764 )
+#define SID_FM_CREATE_FIELDCONTROL ( SID_SVX_START + 765 )
+#define SID_FM_DATACCESS_DESCRIPTOR ( SID_SVX_START + 766 )
+#define SID_FM_TOGGLECONTROLFOCUS ( SID_SVX_START + 767 )
+#define SID_FM_SCROLLBAR ( SID_SVX_START + 768 )
+#define SID_FM_SPINBUTTON ( SID_SVX_START + 769 )
+#define SID_FM_CONVERTTO_SCROLLBAR ( SID_SVX_START + 770 )
+#define SID_FM_CONVERTTO_SPINBUTTON ( SID_SVX_START + 771 )
+#define SID_FM_CONVERTTO_NAVIGATIONBAR ( SID_SVX_START + 772 )
+#define SID_FM_SHOW_DATANAVIGATOR ( SID_SVX_START + 773 )
+#define SID_FM_DATANAVIGATOR_CONTROL ( SID_SVX_START + 774 )
+#define SID_FM_REFRESH_FORM_CONTROL ( SID_SVX_START + 775 )
+#define SID_REFRESH_VIEW ( SID_SVX_START + 776 )
+
+// CAUTION! Range <855 .. 855> used by EditEngine (!)
+
+#define SID_PARAM_NUM_PRESET TypedWhichId<SfxBoolItem>( SID_SVX_START + 856 )
+#define SID_PARAM_CUR_NUM_LEVEL TypedWhichId<SfxUInt16Item>( SID_SVX_START + 859 )
+#define SID_CREATE_SW_DRAWVIEW ( SID_SVX_START + 860 )
+#define SID_ATTR_GRAF_LUMINANCE ( SID_SVX_START + 863 )
+#define SID_ATTR_GRAF_CONTRAST ( SID_SVX_START + 864 )
+#define SID_ATTR_GRAF_RED ( SID_SVX_START + 865 )
+#define SID_ATTR_GRAF_GREEN ( SID_SVX_START + 866 )
+#define SID_ATTR_GRAF_BLUE ( SID_SVX_START + 867 )
+#define SID_ATTR_GRAF_GAMMA ( SID_SVX_START + 868 )
+#define SID_ATTR_GRAF_TRANSPARENCE TypedWhichId<SfxUInt16Item>( SID_SVX_START + 869 )
+#define SID_ATTR_GRAF_INVERT ( SID_SVX_START + 870 )
+#define SID_ATTR_GRAF_MODE TypedWhichId<SfxUInt16Item>( SID_SVX_START + 871 )
+
+// CAUTION! Range <877 .. 877> used by EditEngine (!)
+
+#define SID_ATTR_GRAF_KEEP_ZOOM TypedWhichId<SfxBoolItem>( SID_SVX_START + 882 )
+#define SID_ATTR_GRAF_CROP ( SID_SVX_START + 883 )
+#define SID_ATTR_GRAF_FRMSIZE TypedWhichId<SvxSizeItem>( SID_SVX_START + 884 )
+#define SID_ATTR_GRAF_FRMSIZE_PERCENT TypedWhichId<SvxSizeItem>( SID_SVX_START + 885 )
+#define SID_ATTR_GRAF_GRAPHIC TypedWhichId<SvxBrushItem>( SID_SVX_START + 886 )
+#define SID_DRAW_TEXT_VERTICAL SID_ATTR_CHAR_VERTICAL
+
+// CAUTION! Range <887 .. 903> used by EditEngine (!)
+
+// CAUTION! Range <905 .. 905> used by EditEngine (!)
+
+#define SID_DRAW_CAPTION_VERTICAL ( SID_SVX_START + 906 )
+#define SID_TEXTDIRECTION_LEFT_TO_RIGHT ( SID_SVX_START + 907 )
+#define SID_TEXTDIRECTION_TOP_TO_BOTTOM ( SID_SVX_START + 908 )
+
+// CAUTION! Range <910 .. 911> used by EditEngine (!)
+
+#define SID_TRANSLITERATE_UPPER ( SID_SVX_START + 912 )
+#define SID_TRANSLITERATE_LOWER ( SID_SVX_START + 913 )
+#define SID_TRANSLITERATE_HALFWIDTH ( SID_SVX_START + 914 )
+#define SID_TRANSLITERATE_FULLWIDTH ( SID_SVX_START + 915 )
+#define SID_TRANSLITERATE_HIRAGANA ( SID_SVX_START + 916 )
+#define SID_TRANSLITERATE_KATAKANA ( SID_SVX_START + 917 )
+
+// CAUTION! Range <919 .. 920> used by EditEngine (!)
+
+#define SID_LANGUAGE_OPTIONS ( SID_SVX_START + 921 )
+#define SID_GETUNDOSTRINGS ( SID_SVX_START + 923 )
+#define SID_GETREDOSTRINGS ( SID_SVX_START + 924 )
+
+// CAUTION! Range <925 .. 925> used by EditEngine (!)
+
+#define SID_INSERT_IMAGECONTROL ( SID_SVX_START + 926 )
+#define SID_INSERT_PROGRESSBAR ( SID_SVX_START + 927 )
+#define SID_INSERT_HFIXEDLINE ( SID_SVX_START + 928 )
+#define SID_INSERT_VFIXEDLINE ( SID_SVX_START + 929 )
+#define SID_READONLY_MODE ( SID_SVX_START + 930 )
+#define SID_ATTR_ALIGN_HYPHENATION ( SID_SVX_START + 931 )
+#define SID_ATTR_NUMBERFORMAT_SOURCE TypedWhichId<SfxBoolItem>( SID_SVX_START + 932 )
+
+#define SID_RULER_BORDER_DISTANCE ( SID_SVX_START + 935 )
+#define SID_INSERT_DATEFIELD ( SID_SVX_START + 936 )
+#define SID_INSERT_TIMEFIELD ( SID_SVX_START + 937 )
+#define SID_INSERT_NUMERICFIELD ( SID_SVX_START + 938 )
+#define SID_INSERT_CURRENCYFIELD ( SID_SVX_START + 939 )
+#define SID_INSERT_FORMATTEDFIELD ( SID_SVX_START + 940 )
+#define SID_INSERT_PATTERNFIELD ( SID_SVX_START + 941 )
+#define SID_INSERT_FILECONTROL ( SID_SVX_START + 942 )
+#define SID_SHOW_PROPERTYBROWSER ( SID_SVX_START + 943 )
+
+// CAUTION! Range <944 .. 945> used by EditEngine (!)
+
+#define SID_ATTR_TABSTOP_VERTICAL ( SID_SVX_START + 946 )
+
+// CAUTION! Range <947 .. 947> used by EditEngine (!)
+
+#define SID_RULER_BORDERS_VERTICAL ( SID_SVX_START + 948 )
+#define SID_ATTR_ALIGN_ASIANVERTICAL ( SID_SVX_START + 949 )
+
+// CAUTION! Range <950 .. 951> used by EditEngine (!)
+
+#define SID_RULER_TEXT_RIGHT_TO_LEFT ( SID_SVX_START + 952 )
+#define SID_ATTR_HDFT_DYNAMIC_SPACING ( SID_SVX_START + 953 )
+#define SID_ATTR_NUMBERFORMAT_ADD_AUTO TypedWhichId<SfxBoolItem>( SID_SVX_START + 954 )
+#define SID_OPEN_HYPERLINK ( SID_SVX_START + 955 )
+#define SID_CTLFONT_STATE ( SID_SVX_START + 956 )
+#define SID_VERTICALTEXT_STATE ( SID_SVX_START + 957 )
+#define SID_OPEN_XML_FILTERSETTINGS ( SID_SVX_START + 958 )
+#define SID_HANGUL_HANJA_CONVERSION ( SID_SVX_START + 959 )
+#define SID_EXTRUSION_TOGGLE ( SID_SVX_START + 960 )
+#define SID_EXTRUSION_TILT_DOWN ( SID_SVX_START + 961 )
+#define SID_EXTRUSION_TILT_UP ( SID_SVX_START + 962 )
+#define SID_EXTRUSION_TILT_LEFT ( SID_SVX_START + 963 )
+#define SID_EXTRUSION_TILT_RIGHT ( SID_SVX_START + 964 )
+#define SID_EXTRUSION_DEPTH_FLOATER ( SID_SVX_START + 965 )
+#define SID_EXTRUSION_DIRECTION_FLOATER ( SID_SVX_START + 966 )
+#define SID_EXTRUSION_LIGHTING_FLOATER ( SID_SVX_START + 967 )
+#define SID_EXTRUSION_SURFACE_FLOATER ( SID_SVX_START + 968 )
+#define SID_EXTRUSION_3D_COLOR ( SID_SVX_START + 969 )
+#define SID_EXTRUSION_DEPTH TypedWhichId<SvxDoubleItem>( SID_SVX_START + 970 )
+#define SID_EXTRUSION_DIRECTION ( SID_SVX_START + 971 )
+#define SID_EXTRUSION_PROJECTION ( SID_SVX_START + 972 )
+#define SID_EXTRUSION_LIGHTING_DIRECTION ( SID_SVX_START + 973 )
+#define SID_EXTRUSION_LIGHTING_INTENSITY ( SID_SVX_START + 974 )
+#define SID_EXTRUSION_SURFACE ( SID_SVX_START + 975 )
+#define SID_EXTRUSION_DEPTH_DIALOG ( SID_SVX_START + 976 )
+#define SID_FONTWORK_GALLERY_FLOATER ( SID_SVX_START + 977 )
+#define SID_EDIT_HYPERLINK ( SID_SVX_START + 978 )
+#define SID_FONTWORK_SHAPE_TYPE ( SID_SVX_START + 979 )
+#define SID_FONTWORK_SAME_LETTER_HEIGHTS ( SID_SVX_START + 980 )
+#define SID_FONTWORK_ALIGNMENT_FLOATER ( SID_SVX_START + 981 )
+#define SID_FONTWORK_CHARACTER_SPACING_FLOATER ( SID_SVX_START + 982 )
+#define SID_FONTWORK_SHAPE ( SID_SVX_START + 983 )
+#define SID_FONTWORK_ALIGNMENT ( SID_SVX_START + 984 )
+#define SID_FONTWORK_CHARACTER_SPACING ( SID_SVX_START + 985 )
+#define SID_FONTWORK_KERN_CHARACTER_PAIRS ( SID_SVX_START + 986 )
+#define SID_DRAW_FONTWORK ( SID_SVX_START + 987 )
+#define SID_DRAW_FONTWORK_VERTICAL ( SID_SVX_START + 988 )
+
+// CAUTION! Range <989 .. 989> used by EditEngine (!)
+
+#define SID_ATTR_BORDER_CONNECT ( SID_SVX_START + 990 )
+#define SID_SW_FOLLOW_TEXT_FLOW ( SID_SVX_START + 991 ) /* #i18732# - slot-id for new option IsFollowingTextFlow' */
+#define SID_RULER_ROWS ( SID_SVX_START + 992 )
+#define SID_RULER_ROWS_VERTICAL ( SID_SVX_START + 993 )
+
+// CAUTION! Range <994 .. 998> used by EditEngine (!)
+
+#define SID_ATTR_TRANSFORM_HORI_POSITION TypedWhichId<SfxInt32Item>( SID_SVX_START + 999 )
+#define SID_ATTR_TRANSFORM_VERT_POSITION TypedWhichId<SfxInt32Item>( SID_SVX_START + 1000 )
+// Available for use 1001
+#define SID_ALIGN_ANY_LEFT ( SID_SVX_START + 1002 )
+#define SID_ALIGN_ANY_HCENTER ( SID_SVX_START + 1003 )
+#define SID_ALIGN_ANY_RIGHT ( SID_SVX_START + 1004 )
+#define SID_ALIGN_ANY_JUSTIFIED ( SID_SVX_START + 1005 )
+#define SID_ALIGN_ANY_TOP ( SID_SVX_START + 1006 )
+#define SID_ALIGN_ANY_VCENTER ( SID_SVX_START + 1007 )
+#define SID_ALIGN_ANY_BOTTOM ( SID_SVX_START + 1008 )
+#define SID_ALIGN_ANY_HDEFAULT ( SID_SVX_START + 1009 )
+#define SID_ALIGN_ANY_VDEFAULT ( SID_SVX_START + 1010 )
+#define SID_SW_COLLAPSING_BORDERS ( SID_SVX_START + 1011 )
+#define SID_SW_WRAP_INFLUENCE_ON_OBJPOS ( SID_SVX_START + 1012 ) /* #i28701# - slot-id for new attribute WrapInfluenceOnObjPos' */
+#define SID_ATTR_BORDER_DIAG_TLBR ( SID_SVX_START + 1013 )
+#define SID_ATTR_BORDER_DIAG_BLTR ( SID_SVX_START + 1014 )
+#define SID_ATTR_ALIGN_SHRINKTOFIT ( SID_SVX_START + 1015 )
+#define SID_CHINESE_CONVERSION ( SID_SVX_START + 1016 )
+#define SID_PAGE_TYPE ( SID_SVX_START + 1017 )
+#define SID_DLG_TYPE ( SID_SVX_START + 1018 )
+#define SID_TABPAGE_POS ( SID_SVX_START + 1019 )
+#define SID_GRAPHIC ( SID_SVX_START + 1020 )
+#define SID_OBJECT_LIST TypedWhichId<OfaPtrItem>( SID_SVX_START + 1021 )
+#define SID_ATTR_SET ( SID_SVX_START + 1022 )
+#define SID_CHAR_FMT_LIST_BOX ( SID_SVX_START + 1023 )
+#define SID_METRIC_ITEM TypedWhichId<SfxUInt16Item>( SID_SVX_START + 1024 )
+#define SID_NUM_CHAR_FMT ( SID_SVX_START + 1025 )
+#define SID_BULLET_CHAR_FMT ( SID_SVX_START + 1026 )
+#define SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK ( SID_SVX_START + 1027 )
+#define SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT ( SID_SVX_START + 1028 )
+#define SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH ( SID_SVX_START + 1029 )
+#define SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET ( SID_SVX_START + 1030 )
+#define SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST ( SID_SVX_START + 1031 )
+#define SID_SVXTABULATORTABPAGE_DISABLEFLAGS ( SID_SVX_START + 1032 )
+#define SID_SVXTEXTATTRPAGE_OBJKIND ( SID_SVX_START + 1033 )
+#define SID_FLAG_TYPE ( SID_SVX_START + 1034 )
+#define SID_SWMODE_TYPE ( SID_SVX_START + 1035 )
+#define SID_DISABLE_CTL ( SID_SVX_START + 1036 )
+#define SID_INSERT_HYPERLINKCONTROL ( SID_SVX_START + 1037 )
+#define SID_ENUM_PAGE_MODE TypedWhichId<SfxUInt16Item>( SID_SVX_START + 1038 )
+#define SID_PAPER_START TypedWhichId<SfxUInt16Item>( SID_SVX_START + 1039 )
+#define SID_PAPER_END TypedWhichId<SfxUInt16Item>( SID_SVX_START + 1040 )
+#define SID_COLLECT_LIST ( SID_SVX_START + 1041 )
+#define SID_GROW_FONT_SIZE ( SID_SVX_START + 1042 )
+#define SID_SHRINK_FONT_SIZE ( SID_SVX_START + 1043 )
+// color subtoolbar on graphictoolbar
+#define SID_COLOR_SETTINGS ( SID_SVX_START + 1044 )
+
+#define SID_FM_FORM_DESIGN_TOOLS ( SID_SVX_START + 1046 )
+#define SID_DRAWTBX_CS_BASIC ( SID_SVX_START + 1047 )
+#define SID_DRAWTBX_CS_SYMBOL ( SID_SVX_START + 1048 )
+#define SID_DRAWTBX_CS_ARROW ( SID_SVX_START + 1049 )
+#define SID_DRAWTBX_CS_FLOWCHART ( SID_SVX_START + 1050 )
+#define SID_DRAWTBX_CS_CALLOUT ( SID_SVX_START + 1051 )
+#define SID_DRAWTBX_CS_STAR ( SID_SVX_START + 1052 )
+#define SID_DRAW_CS_ID ( SID_SVX_START + 1053 )
+#define SID_FONTWORK_CHARACTER_SPACING_DIALOG ( SID_SVX_START + 1054 )
+#define SID_BORDER_REDUCED_MODE ( SID_SVX_START + 1055 )
+#define SID_INSERT_RLM ( SID_SVX_START + 1056 ) /* insert RLM - right to left mark */
+#define SID_INSERT_LRM ( SID_SVX_START + 1057 ) /* insert LRM - left to right mark */
+#define SID_INSERT_ZWSP ( SID_SVX_START + 1058 ) /* insert ZWJ - invisible space, keep words together*/
+#define SID_INSERT_WJ ( SID_SVX_START + 1059 ) /* insert WJ - Word Joiner */
+#define SID_OPTIONS_DATABASES ( SID_SVX_START + 1060 )
+#define SID_OPEN_SMARTTAGMENU TypedWhichId<SvxSmartTagItem>( SID_SVX_START + 1061 )
+
+// CAUTION! Range <1062 .. 1069> used by include/sfx2/sfxsids.hrc
+
+#define SID_TABLE_MERGE_CELLS ( SID_SVX_START + 1070 )
+#define SID_TABLE_SPLIT_CELLS ( SID_SVX_START + 1071 )
+#define SID_OPTIMIZE_TABLE ( SID_SVX_START + 1072 )
+#define SID_TABLE_VERT_BOTTOM ( SID_SVX_START + 1073 )
+#define SID_TABLE_VERT_CENTER ( SID_SVX_START + 1074 )
+#define SID_TABLE_VERT_NONE ( SID_SVX_START + 1075 )
+#define SID_TABLE_INSERT_ROW ( SID_SVX_START + 1076 )
+#define SID_TABLE_INSERT_COL ( SID_SVX_START + 1077 )
+#define SID_TABLE_DELETE_ROW ( SID_SVX_START + 1078 )
+#define SID_TABLE_DELETE_COL ( SID_SVX_START + 1079 )
+#define SID_TABLE_SELECT_ALL ( SID_SVX_START + 1080 )
+#define SID_TABLE_SELECT_COL ( SID_SVX_START + 1081 )
+#define SID_TABLE_SELECT_ROW ( SID_SVX_START + 1082 )
+#define SID_FORMAT_TABLE_DLG ( SID_SVX_START + 1083 )
+#define SID_TABLE_SORT_DIALOG ( SID_SVX_START + 1084 )
+#define SID_TABLE_AUTOSUM ( SID_SVX_START + 1085 )
+#define SID_TABLE_DISTRIBUTE_COLUMNS ( SID_SVX_START + 1086 )
+#define SID_TABLE_DISTRIBUTE_ROWS ( SID_SVX_START + 1087 )
+#define SID_TABLE_STYLE ( SID_SVX_START + 1088 )
+#define SID_TABLE_STYLE_SETTINGS ( SID_SVX_START + 1089 )
+#define SID_CHAR_DLG_PREVIEW_STRING ( SID_SVX_START + 1090 )
+#define SID_RECHECK_DOCUMENT ( SID_SVX_START + 1091 )
+// 1092 is used out of order below
+#define SID_OBJECT_MIRROR ( SID_SVX_START + 1093 )
+
+#define SID_DELETE_POSTIT ( SID_SVX_START + 1094 )
+#define SID_NEXT_POSTIT ( SID_SVX_START + 1095 )
+#define SID_PREVIOUS_POSTIT ( SID_SVX_START + 1096 )
+#define SID_DELETEALL_POSTIT ( SID_SVX_START + 1097 )
+#define SID_TOGGLE_NOTES ( SID_SVX_START + 1098 )
+#define SID_REPLYTO_POSTIT ( SID_SVX_START + 1099 )
+#define SID_DELETEALLBYAUTHOR_POSTIT ( SID_SVX_START + 1100 )
+#define SID_INSERT_POSTIT ( SID_SVX_START + 1101 )
+
+#define SID_TRANSLITERATE_SENTENCE_CASE ( SID_SVX_START + 1102 )
+#define SID_TRANSLITERATE_TITLE_CASE ( SID_SVX_START + 1103 )
+#define SID_TRANSLITERATE_TOGGLE_CASE ( SID_SVX_START + 1104 )
+#define SID_TRANSLITERATE_ROTATE_CASE ( SID_SVX_START + 1105 )
+#define SID_INSERT_FORM_RADIO ( SID_SVX_START + 1106 )
+#define SID_INSERT_FORM_CHECK ( SID_SVX_START + 1107 )
+#define SID_INSERT_FORM_LIST ( SID_SVX_START + 1108 )
+#define SID_INSERT_FORM_COMBO ( SID_SVX_START + 1109 )
+#define SID_INSERT_FORM_SPIN ( SID_SVX_START + 1110 )
+#define SID_INSERT_FORM_VSCROLL ( SID_SVX_START + 1111 )
+#define SID_INSERT_FORM_HSCROLL ( SID_SVX_START + 1112 )
+#define SID_EXTERNAL_EDIT ( SID_SVX_START + 1113 )
+#define SID_ATTR_PAGE_SHARED_FIRST ( SID_SVX_START + 1114 )
+#define SID_CHANGE_PICTURE ( SID_SVX_START + 1115 )
+#define SID_SAVE_GRAPHIC ( SID_SVX_START + 1116 )
+#define SID_COMPRESS_GRAPHIC ( SID_SVX_START + 1117 )
+#define SID_FRAME_UP ( SID_SVX_START + 1118 )
+#define SID_FRAME_DOWN ( SID_SVX_START + 1119 )
+#define SID_ATTR_SPECIALCHAR TypedWhichId<SfxStringItem>( SID_SVX_START + 1120 )
+#define SID_ROTATE_GRAPHIC_LEFT ( SID_SVX_START + 1121 )
+#define SID_ROTATE_GRAPHIC_RIGHT ( SID_SVX_START + 1122 )
+#define SID_ROTATE_GRAPHIC_180 ( SID_SVX_START + 1123 )
+#define SID_ROTATE_GRAPHIC_RESET ( SID_SVX_START + 1092 ) /* RotGrfFlyFrame: */
+
+// new slots for panels
+#define SID_ATTR_FILL_TRANSPARENCE ( SID_SVX_START + 1124 )
+#define SID_ATTR_FILL_FLOATTRANSPARENCE ( SID_SVX_START + 1125 )
+#define SID_ATTR_LINE_TRANSPARENCE ( SID_SVX_START + 1126 )
+#define SID_FLIP_HORIZONTAL ( SID_SVX_START + 1127 )
+#define SID_FLIP_VERTICAL ( SID_SVX_START + 1128 )
+#define SID_ATTR_LINE_JOINT ( SID_SVX_START + 1129 )
+#define SID_ATTR_LINE_CAP ( SID_SVX_START + 1130 )
+#define SID_ATTR_TRANSFORM_MATRIX ( SID_SVX_START + 1131 )
+
+#define SID_CELL_FORMAT_BORDER ( SID_SVX_START + 1132 )
+#define SID_CHAR_DLG_EFFECT ( SID_SVX_START + 1133 )
+#define SID_CHAR_DLG_POSITION ( SID_SVX_START + 1134 )
+#define SID_ATTR_FILL_USE_SLIDE_BACKGROUND ( SID_SVX_START + 1135 )
+#define FN_SVX_SET_NUMBER ( SID_SVX_START + 1136 )
+#define FN_SVX_SET_BULLET ( SID_SVX_START + 1137 )
+#define FN_SVX_SET_OUTLINE ( SID_SVX_START + 1138 )
+
+#define SID_ATTR_BORDER_STYLES TypedWhichId<SfxIntegerListItem>( SID_SVX_START + 1140 )
+#define SID_ATTR_BORDER_DEFAULT_WIDTH TypedWhichId<SfxInt64Item>( SID_SVX_START + 1141 )
+// 1142 is used by editeng (SID_ATTR_CHAR_GRABBAG)
+
+#define SID_OFFER_IMPORT ( SID_SVX_START + 1143 )
+#define SID_DRAWINGLAYER_FILLSTYLES ( SID_SVX_START + 1144)
+#define SID_PARASPACE_INCREASE ( SID_SVX_START + 1145 )
+#define SID_PARASPACE_DECREASE ( SID_SVX_START + 1146 )
+
+#define SID_OBJECT_CROP ( SID_SVX_START + 1147 )
+#define SID_ATTR_SHADOW_TRANSPARENCE ( SID_SVX_START + 1148 )
+#define SID_ATTR_SHADOW_COLOR ( SID_SVX_START + 1149 )
+#define SID_ATTR_SHADOW_XDISTANCE ( SID_SVX_START + 1150 )
+#define SID_ATTR_SHADOW_YDISTANCE ( SID_SVX_START + 1151 )
+
+#define SID_ATTR_PAGE_COLOR ( SID_SVX_START + 1152 )
+// 1153 is used by editeng (SID_ATTR_CHAR_BACK_COLOR)
+#define SID_ATTR_PAGE_GRADIENT TypedWhichId<XFillGradientItem>( SID_SVX_START + 1154 )
+#define SID_ATTR_PAGE_HATCH ( SID_SVX_START + 1155 )
+#define SID_ATTR_PAGE_BITMAP ( SID_SVX_START + 1156 )
+#define SID_ATTR_PAGE_FILLSTYLE ( SID_SVX_START + 1157 )
+
+#define SID_EDIT_POSTIT ( SID_SVX_START + 1158 )
+
+#define SID_LINE_ARROW_CIRCLE ( SID_SVX_START + 1159 )
+#define SID_LINE_ARROW_SQUARE ( SID_SVX_START + 1160 )
+#define SID_LINE_CIRCLE_ARROW ( SID_SVX_START + 1161 )
+#define SID_LINE_SQUARE_ARROW ( SID_SVX_START + 1162 )
+#define SID_LINE_ARROWS ( SID_SVX_START + 1163 )
+#define SID_DRAWTBX_ARROWS ( SID_SVX_START + 1164 )
+#define SID_LINE_ARROW_START ( SID_SVX_START + 1165 )
+#define SID_LINE_ARROW_END ( SID_SVX_START + 1166 )
+#define SID_DRAW_MEASURELINE ( SID_SVX_START + 1167 )
+#define SID_AUTHOR_COLOR ( SID_SVX_START + 1168 )
+#define SID_BMPMASK_COLOR ( SID_SVX_START + 1169 )
+#define SID_PARAGRAPH_SIGN_CLASSIFY_DLG ( SID_SVX_START + 1170 )
+#define SID_CLASSIFICATION_DIALOG ( SID_SVX_START + 1171 )
+#define SID_ANCHOR_MENU ( SID_SVX_START + 1172 )
+
+#define SID_INSERT_SIGNATURELINE ( SID_SVX_START + 1173 )
+#define SID_EDIT_SIGNATURELINE ( SID_SVX_START + 1174 )
+#define SID_SIGN_SIGNATURELINE ( SID_SVX_START + 1175 )
+#define SID_MEASURE_DLG ( SID_SVX_START + 1176 )
+// free slots - available for use
+#define SID_TABLE_DELETE_TABLE ( SID_SVX_START + 1184 )
+#define SID_TABLE_MINIMAL_COLUMN_WIDTH ( SID_SVX_START + 1185 )
+#define SID_TABLE_MINIMAL_ROW_HEIGHT ( SID_SVX_START + 1186 )
+#define SID_TABLE_OPTIMAL_COLUMN_WIDTH ( SID_SVX_START + 1187 )
+#define SID_TABLE_OPTIMAL_ROW_HEIGHT ( SID_SVX_START + 1188 )
+
+#define SID_TABLE_CELL_BACKGROUND_COLOR TypedWhichId<SvxColorItem>( SID_SVX_START + 1189 )
+
+#define SID_TOGGLE_RESOLVED_NOTES ( SID_SVX_START + 1190 )
+
+#define SID_INSERT_QRCODE ( SID_SVX_START + 1191 )
+#define SID_EDIT_QRCODE ( SID_SVX_START + 1192 )
+#define SID_COPY_HYPERLINK_LOCATION ( SID_SVX_START + 1193 )
+
+#define SID_IMPRESS_DOC TypedWhichId<SfxBoolItem>( SID_SVX_START + 1194 )
+
+#define SID_ULINE_VAL_NONE (SID_SVX_START + 1195) /* no underline */
+#define SID_ULINE_VAL_SINGLE (SID_SVX_START + 1196) /* single underline */
+#define SID_ULINE_VAL_DOUBLE (SID_SVX_START + 1197) /* double underline */
+#define SID_ULINE_VAL_DOTTED (SID_SVX_START + 1198) /* dotted underline */
+
+#define SID_MOVE_SHAPE_HANDLE ( SID_SVX_START + 1199 )
+
+#define SID_ATTR_POSTIT_AUTHOR TypedWhichId<SvxPostItAuthorItem>( SID_SVX_START + 1200 )
+#define SID_ATTR_POSTIT_DATE TypedWhichId<SvxPostItDateItem>( SID_SVX_START + 1201 )
+#define SID_ATTR_POSTIT_TEXT TypedWhichId<SvxPostItTextItem>( SID_SVX_START + 1202 )
+#define SID_ATTR_POSTIT_ID TypedWhichId<SvxPostItIdItem>( SID_SVX_START + 1203 )
+
+#define SID_ATTR_POSTIT_POSITION_X TypedWhichId<SfxInt32Item>( SID_SVX_START + 1204 )
+#define SID_ATTR_POSTIT_POSITION_Y TypedWhichId<SfxInt32Item>( SID_SVX_START + 1205 )
+
+#define SID_INSERT_TREECONTROL ( SID_SVX_START + 1206 )
+#define SID_ATTR_VIEWLAYOUT TypedWhichId<SvxViewLayoutItem>( SID_SVX_START + 1207 )
+#define SID_ATTR_ZOOMSLIDER TypedWhichId<SvxZoomSliderItem>( SID_SVX_START + 1208 )
+// Can be either SfxStringItem or SfxStringListItem
+#define SID_LANGUAGE_STATUS ( SID_SVX_START + 1209 )
+#define SID_CHAR_DLG_FOR_PARAGRAPH ( SID_SVX_START + 1210 )
+#define SID_SET_DOCUMENT_LANGUAGE TypedWhichId<SfxBoolItem>( SID_SVX_START + 1211 )
+
+// IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
+#define SID_SVX_FIRSTFREE ( SID_SVX_START + 1211 + 1 )
+
+
+// Overflow check for slot IDs
+#if SID_SVX_FIRSTFREE > SID_SVX_END
+#error Resource-overflow in #line, #file
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svxitems.hrc b/include/svx/svxitems.hrc
new file mode 100644
index 000000000..d42194497
--- /dev/null
+++ b/include/svx/svxitems.hrc
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_INC_SVX_ITEMS_HRC
+#define INCLUDED_SVX_INC_SVX_ITEMS_HRC
+
+#include <sal/types.h>
+#include <svx/svxitems.hrc>
+#include <svx/svxids.hrc>
+#include <editeng/editids.hrc>
+#include <unotools/resmgr.hxx>
+#include <utility>
+
+#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
+
+const std::pair<TranslateId, sal_uInt16> RID_ATTR_NAMES[] =
+{
+ { NC_("RID_ATTR_NAMES", "Scale") , SID_ATTR_ZOOM },
+ { NC_("RID_ATTR_NAMES", "Brush") , SID_ATTR_BRUSH },
+ { NC_("RID_ATTR_NAMES", "Tab stops") , SID_ATTR_TABSTOP },
+ { NC_("RID_ATTR_NAMES", "Character") , SID_ATTR_CHAR },
+ { NC_("RID_ATTR_NAMES", "Font") , SID_ATTR_CHAR_FONT },
+ { NC_("RID_ATTR_NAMES", "Font posture") , SID_ATTR_CHAR_POSTURE },
+ { NC_("RID_ATTR_NAMES", "Font weight") , SID_ATTR_CHAR_WEIGHT },
+ { NC_("RID_ATTR_NAMES", "Shadowed") , SID_ATTR_CHAR_SHADOWED },
+ { NC_("RID_ATTR_NAMES", "Individual words") , SID_ATTR_CHAR_WORDLINEMODE },
+ { NC_("RID_ATTR_NAMES", "Outline") , SID_ATTR_CHAR_CONTOUR },
+ { NC_("RID_ATTR_NAMES", "Strikethrough") , SID_ATTR_CHAR_STRIKEOUT },
+ { NC_("RID_ATTR_NAMES", "Underline") , SID_ATTR_CHAR_UNDERLINE },
+ { NC_("RID_ATTR_NAMES", "Font size") , SID_ATTR_CHAR_FONTHEIGHT },
+ { NC_("RID_ATTR_NAMES", "Font color") , SID_ATTR_CHAR_COLOR },
+ { NC_("RID_ATTR_NAMES", "Kerning") , SID_ATTR_CHAR_KERNING },
+ { NC_("RID_ATTR_NAMES", "Effects") , SID_ATTR_CHAR_CASEMAP },
+ { NC_("RID_ATTR_NAMES", "Language"), SID_ATTR_CHAR_LANGUAGE },
+ { NC_("RID_ATTR_NAMES", "Position") , SID_ATTR_CHAR_ESCAPEMENT },
+ { NC_("RID_ATTR_NAMES", "Character blinking") , SID_ATTR_CHAR_AUTOKERN },
+ { NC_("RID_ATTR_NAMES", "Character set color") , SID_ATTR_CHAR_CHARSETCOLOR },
+ { NC_("RID_ATTR_NAMES", "Overline") , SID_ATTR_CHAR_OVERLINE },
+ { NC_("RID_ATTR_NAMES", "Alignment") , SID_ATTR_PARA_ADJUST },
+ { NC_("RID_ATTR_NAMES", "Line spacing") , SID_ATTR_PARA_LINESPACE },
+ { NC_("RID_ATTR_NAMES", "Page Break") , SID_ATTR_PARA_PAGEBREAK },
+ { NC_("RID_ATTR_NAMES", "Hyphenation") , SID_ATTR_PARA_HYPHENZONE },
+ { NC_("RID_ATTR_NAMES", "Do not split paragraph"), SID_ATTR_PARA_SPLIT },
+ { NC_("RID_ATTR_NAMES", "Orphans") , SID_ATTR_PARA_ORPHANS },
+ { NC_("RID_ATTR_NAMES", "Widows") , SID_ATTR_PARA_WIDOWS },
+ { NC_("RID_ATTR_NAMES", "Paragraph spacing") , SID_ATTR_PARA_ULSPACE },
+ { NC_("RID_ATTR_NAMES", "Paragraph indent") , SID_ATTR_PARA_LRSPACE },
+ { NC_("RID_ATTR_NAMES", "Indent") , SID_ATTR_LRSPACE },
+ { NC_("RID_ATTR_NAMES", "Spacing") , SID_ATTR_ULSPACE },
+ { NC_("RID_ATTR_NAMES", "Page") , SID_ATTR_PAGE },
+ { NC_("RID_ATTR_NAMES", "Page Style") , SID_ATTR_PARA_MODEL },
+ { NC_("RID_ATTR_NAMES", "Keep with next paragraph"), SID_ATTR_PARA_KEEP },
+ { NC_("RID_ATTR_NAMES", "Blinking") , SID_ATTR_FLASH },
+ { NC_("RID_ATTR_NAMES", "Page line-spacing") , SID_ATTR_PARA_REGISTER },
+ { NC_("RID_ATTR_NAMES", "Character background") , SID_ATTR_BRUSH_CHAR },
+ { NC_("RID_ATTR_NAMES", "Asian font") , SID_ATTR_CHAR_CJK_FONT },
+ { NC_("RID_ATTR_NAMES", "Size of Asian font") , SID_ATTR_CHAR_CJK_FONTHEIGHT },
+ { NC_("RID_ATTR_NAMES", "Language of Asian font"), SID_ATTR_CHAR_CJK_LANGUAGE },
+ { NC_("RID_ATTR_NAMES", "Posture of Asian font") , SID_ATTR_CHAR_CJK_POSTURE },
+ { NC_("RID_ATTR_NAMES", "Weight of Asian font") , SID_ATTR_CHAR_CJK_WEIGHT },
+ { NC_("RID_ATTR_NAMES", "CTL") , SID_ATTR_CHAR_CTL_FONT },
+ { NC_("RID_ATTR_NAMES", "Size of complex scripts") , SID_ATTR_CHAR_CTL_FONTHEIGHT },
+ { NC_("RID_ATTR_NAMES", "Language of complex scripts"),SID_ATTR_CHAR_CTL_LANGUAGE },
+ { NC_("RID_ATTR_NAMES", "Posture of complex scripts"), SID_ATTR_CHAR_CTL_POSTURE },
+ { NC_("RID_ATTR_NAMES", "Weight of complex scripts"), SID_ATTR_CHAR_CTL_WEIGHT },
+ { NC_("RID_ATTR_NAMES", "Double-lined") , SID_ATTR_CHAR_TWO_LINES },
+ { NC_("RID_ATTR_NAMES", "Emphasis mark") , SID_ATTR_CHAR_EMPHASISMARK },
+ { NC_("RID_ATTR_NAMES", "Text spacing") , SID_ATTR_PARA_SCRIPTSPACE },
+ { NC_("RID_ATTR_NAMES", "Hanging punctuation") , SID_ATTR_PARA_HANGPUNCTUATION },
+ { NC_("RID_ATTR_NAMES", "Forbidden characters") , SID_ATTR_PARA_FORBIDDEN_RULES },
+ { NC_("RID_ATTR_NAMES", "Rotation") , SID_ATTR_CHAR_ROTATED },
+ { NC_("RID_ATTR_NAMES", "Character scaling") , SID_ATTR_CHAR_SCALEWIDTH },
+ { NC_("RID_ATTR_NAMES", "Relief") , SID_ATTR_CHAR_RELIEF },
+ { NC_("RID_ATTR_NAMES", "Vertical text alignment") , SID_PARA_VERTALIGN }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/swframeexample.hxx b/include/svx/swframeexample.hxx
new file mode 100644
index 000000000..fc64982ce
--- /dev/null
+++ b/include/svx/swframeexample.hxx
@@ -0,0 +1,94 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_SWFRAMEEXAMPLE_HXX
+#define INCLUDED_SVX_SWFRAMEEXAMPLE_HXX
+
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/swframetypes.hxx>
+#include <vcl/customweld.hxx>
+#include <com/sun/star/text/WrapTextMode.hpp>
+
+class SVX_DLLPUBLIC SwFrameExample final : public weld::CustomWidgetController
+{
+ Color m_aTransColor; ///< transparency
+ Color m_aBgCol; ///< background
+ Color m_aFrameColor; ///< graphic frame
+ Color m_aAlignColor; ///< align anchor
+ Color m_aBorderCol; ///< frame of doc
+ Color m_aPrintAreaCol; ///< frame of printable area of doc
+ Color m_aTxtCol; ///< symbolised text
+ Color m_aBlankCol; ///< area of symbol for blank
+ Color m_aBlankFrameCol; ///< frame of symbol for blank
+
+ tools::Rectangle aPage;
+ tools::Rectangle aPagePrtArea;
+ tools::Rectangle aTextLine;
+ tools::Rectangle aPara;
+ tools::Rectangle aParaPrtArea;
+ tools::Rectangle aFrameAtFrame;
+ tools::Rectangle aDrawObj;
+ tools::Rectangle aAutoCharFrame;
+ Size aFrmSize;
+
+ short nHAlign;
+ short nHRel;
+
+ short nVAlign;
+ short nVRel;
+
+ css::text::WrapTextMode nWrap;
+ RndStdIds nAnchor;
+ bool bTrans;
+
+ Point aRelPos;
+
+ void InitColors_Impl();
+ void InitAllRects_Impl(vcl::RenderContext& rRenderContext);
+ void CalcBoundRect_Impl(const vcl::RenderContext& rRenderContext, tools::Rectangle &rRect);
+ tools::Rectangle DrawInnerFrame_Impl(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor);
+
+ virtual void StyleUpdated() override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
+public:
+
+ SwFrameExample();
+
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+
+ void SetWrap(css::text::WrapTextMode nW) { nWrap = nW; }
+
+ void SetHAlign(short nH) { nHAlign = nH; }
+ void SetHoriRel(short nR) { nHRel = nR; }
+
+ void SetVAlign(short nV) { nVAlign = nV; }
+ void SetVertRel(short nR) { nVRel = nR; }
+
+ void SetTransparent(bool bT) { bTrans = bT; }
+ void SetAnchor(RndStdIds nA) { nAnchor = nA; }
+
+ void SetRelPos(const Point& rP);
+};
+
+
+
+#endif // INCLUDED_SVX_SWFRAMEEXAMPLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/swframeposstrings.hxx b/include/svx/swframeposstrings.hxx
new file mode 100644
index 000000000..2aca2f195
--- /dev/null
+++ b/include/svx/swframeposstrings.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+
+/*
+ contains strings needed for positioning dialogs
+ of frames and drawing in Writer
+ */
+class SVX_DLLPUBLIC SvxSwFramePosString
+{
+public:
+ enum StringId
+ {
+ LEFT ,
+ RIGHT ,
+ FROMLEFT ,
+ MIR_LEFT ,
+ MIR_RIGHT ,
+ MIR_FROMLEFT ,
+ FRAME ,
+ PRTAREA ,
+ REL_PG_LEFT ,
+ REL_PG_RIGHT ,
+ REL_FRM_LEFT ,
+ REL_FRM_RIGHT ,
+ MIR_REL_PG_LEFT ,
+ MIR_REL_PG_RIGHT ,
+ MIR_REL_FRM_LEFT ,
+ MIR_REL_FRM_RIGHT ,
+ REL_PG_FRAME ,
+ REL_PG_PRTAREA ,
+ REL_PG_PRTAREA_TOP ,
+ REL_PG_PRTAREA_BOTTOM ,
+ REL_BASE ,
+ REL_CHAR ,
+ REL_ROW ,
+ REL_BORDER ,
+ REL_PRTAREA ,
+ FLY_REL_PG_LEFT ,
+ FLY_REL_PG_RIGHT ,
+ FLY_REL_PG_FRAME ,
+ FLY_REL_PG_PRTAREA ,
+ FLY_MIR_REL_PG_LEFT ,
+ FLY_MIR_REL_PG_RIGHT ,
+ TOP,
+ BOTTOM,
+ CENTER_HORI,
+ CENTER_VERT,
+ FROMTOP,
+ FROMBOTTOM,
+ BELOW,
+ FROMRIGHT,
+ REL_PG_TOP,
+ REL_PG_BOTTOM,
+ REL_FRM_TOP,
+ REL_FRM_BOTTOM,
+ REL_LINE,
+
+ STR_MAX
+ };
+ static OUString GetString(StringId eId);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/swframetypes.hxx b/include/svx/swframetypes.hxx
new file mode 100644
index 000000000..abff5b0ee
--- /dev/null
+++ b/include/svx/swframetypes.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_INC_SWFRAMETYPES_HXX
+#define INCLUDED_SVX_INC_SWFRAMETYPES_HXX
+
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+
+// The former Rendezvous-IDs live on:
+// There are IDs for the anchors (SwFormatAnchor) and some others
+// that are only of importance for interfaces (SwDoc).
+enum class RndStdIds
+{
+ UNKNOWN = -1, // return value used by SwFEShell::GetAnchorId
+
+ // the following 5 values are deliberately the same as the values in css::text::TextContentAnchorType
+ FLY_AT_PARA = int(css::text::TextContentAnchorType_AT_PARAGRAPH), // Anchored at paragraph.
+ FLY_AS_CHAR = int(css::text::TextContentAnchorType_AS_CHARACTER), // Anchored as character.
+ FLY_AT_PAGE = int(css::text::TextContentAnchorType_AT_PAGE), // Anchored at page.
+ FLY_AT_FLY = int(css::text::TextContentAnchorType_AT_FRAME), // Anchored at frame.
+ FLY_AT_CHAR = int(css::text::TextContentAnchorType_AT_CHARACTER), // Anchored at character.
+
+ HEADER,
+ FOOTER,
+ HEADERL,
+ HEADERR,
+
+ DRAW_OBJECT // A draw-Object! For the SwDoc-interface only!
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/swframevalidation.hxx b/include/svx/swframevalidation.hxx
new file mode 100644
index 000000000..049fce9af
--- /dev/null
+++ b/include/svx/swframevalidation.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SWFRAMEVALIDATION_HXX
+#define INCLUDED_SVX_SWFRAMEVALIDATION_HXX
+
+#include <sal/types.h>
+#include <tools/gen.hxx>
+#include <svx/swframetypes.hxx>
+
+/*
+ struct to determine min/max values for fly frame positioning in Writer
+ */
+struct SvxSwFrameValidation
+{
+ RndStdIds nAnchorType;
+ sal_Int16 nHoriOrient; //css::text::HoriOrientation
+ sal_Int16 nVertOrient; //css::text::VertOrientation
+ sal_Int16 nHRelOrient; //css::text::RelOrientation
+ sal_Int16 nVRelOrient; //css::text::RelOrientation
+ bool bAutoHeight;
+ bool bMirror;
+ bool bFollowTextFlow;
+
+ sal_Int32 nHPos;
+ sal_Int32 nMaxHPos;
+ sal_Int32 nMinHPos;
+
+ sal_Int32 nVPos;
+ sal_Int32 nMaxVPos;
+ sal_Int32 nMinVPos;
+
+ sal_Int32 nWidth;
+ sal_Int32 nMinWidth;
+ sal_Int32 nMaxWidth;
+
+ sal_Int32 nHeight;
+ sal_Int32 nMinHeight;
+ sal_Int32 nMaxHeight;
+
+ Size aPercentSize; // Size for 100% value
+
+ SvxSwFrameValidation() :
+ nAnchorType(RndStdIds::FLY_AT_PARA),
+ nHoriOrient(0),
+ nVertOrient(0),
+ nHRelOrient(0),
+ nVRelOrient(0),
+ bAutoHeight(false),
+ bMirror(false),
+ bFollowTextFlow( false ),
+ nHPos(0),
+ nMaxHPos(SAL_MAX_INT32),
+ nMinHPos(0),
+ nVPos(0),
+ nMaxVPos(SAL_MAX_INT32),
+ nMinVPos(0),
+ nWidth( 283 * 4 ), //2.0 cm
+ nMinWidth(0),
+ nMaxWidth(SAL_MAX_INT32),
+ nHeight( 283 ), //0.5 cm
+ nMinHeight(0),
+ nMaxHeight(SAL_MAX_INT32)
+ {
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxcecitm.hxx b/include/svx/sxcecitm.hxx
new file mode 100644
index 000000000..6619c04be
--- /dev/null
+++ b/include/svx/sxcecitm.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXCECITM_HXX
+#define INCLUDED_SVX_SXCECITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+#include <svx/sdmetitm.hxx>
+#include <svx/svxdllapi.h>
+
+enum class SdrCaptionEscDir { Horizontal, Vertical, BestFit };
+
+
+// class SdrCaptionEscDirItem
+
+class SVXCORE_DLLPUBLIC SdrCaptionEscDirItem final : public SfxEnumItem<SdrCaptionEscDir> {
+public:
+ SdrCaptionEscDirItem(SdrCaptionEscDir eDir=SdrCaptionEscDir::Horizontal): SfxEnumItem(SDRATTR_CAPTIONESCDIR, eDir) {}
+ virtual SdrCaptionEscDirItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override; // { return 3; }
+
+ static OUString GetValueTextByPos(sal_uInt16 nPos);
+
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+
+// class SdrCaptionEscIsRelItem
+// sal_True = line escape position is relative
+// sal_False = line escape position is absolute
+
+class SVXCORE_DLLPUBLIC SdrCaptionEscIsRelItem final : public SdrYesNoItem {
+public:
+ SdrCaptionEscIsRelItem(bool bRel=true): SdrYesNoItem(SDRATTR_CAPTIONESCISREL,bRel) {}
+ virtual ~SdrCaptionEscIsRelItem() override;
+ virtual SdrCaptionEscIsRelItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrCaptionEscIsRelItem(SdrCaptionEscIsRelItem const &) = default;
+ SdrCaptionEscIsRelItem(SdrCaptionEscIsRelItem &&) = default;
+ SdrCaptionEscIsRelItem & operator =(SdrCaptionEscIsRelItem const &) = delete; // due to SdrYesNoItem
+ SdrCaptionEscIsRelItem & operator =(SdrCaptionEscIsRelItem &&) = delete; // due to SdrYesNoItem
+};
+
+
+// class SdrCaptionEscRelItem
+// relative line escape
+// 0 = 0.00% = up resp. left,
+// 10000 = 100.00% = right resp. down
+// only when SdrCaptionEscIsRelItem=TRUE
+
+class SVXCORE_DLLPUBLIC SdrCaptionEscRelItem final : public SfxInt32Item {
+public:
+ SdrCaptionEscRelItem(sal_Int32 nEscRel=5000): SfxInt32Item(SDRATTR_CAPTIONESCREL,nEscRel) {}
+ virtual ~SdrCaptionEscRelItem() override;
+ virtual SdrCaptionEscRelItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrCaptionEscRelItem(SdrCaptionEscRelItem const &) = default;
+ SdrCaptionEscRelItem(SdrCaptionEscRelItem &&) = default;
+ SdrCaptionEscRelItem & operator =(SdrCaptionEscRelItem const &) = delete; // due to SfxInt32Item
+ SdrCaptionEscRelItem & operator =(SdrCaptionEscRelItem &&) = delete; // due to SfxInt32Item
+};
+
+
+// class SdrCaptionEscAbsItem
+// absolute line escape
+// 0 = up resp. left,
+// >0 = in direction right resp. down
+// only when SdrCaptionEscIsRelItem=FALSE
+
+class SdrCaptionEscAbsItem final : public SdrMetricItem {
+public:
+ SdrCaptionEscAbsItem(tools::Long nEscAbs=0): SdrMetricItem(SDRATTR_CAPTIONESCABS,nEscAbs) {}
+ virtual SdrCaptionEscAbsItem* Clone(SfxItemPool*) const override
+ {
+ return new SdrCaptionEscAbsItem(*this);
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxcgitm.hxx b/include/svx/sxcgitm.hxx
new file mode 100644
index 000000000..993d164de
--- /dev/null
+++ b/include/svx/sxcgitm.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXCGITM_HXX
+#define INCLUDED_SVX_SXCGITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+
+/**
+ * class SdrCaptionGapItem
+ * Distance of the line start from the Rect
+ */
+class SdrCaptionGapItem final : public SdrMetricItem
+{
+public:
+ SdrCaptionGapItem(tools::Long nGap = 0)
+ : SdrMetricItem(SDRATTR_CAPTIONGAP, nGap)
+ {
+ }
+ virtual SdrCaptionGapItem* Clone(SfxItemPool*) const override
+ {
+ return new SdrCaptionGapItem(*this);
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxciaitm.hxx b/include/svx/sxciaitm.hxx
new file mode 100644
index 000000000..9d77c18e3
--- /dev/null
+++ b/include/svx/sxciaitm.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXCIAITM_HXX
+#define INCLUDED_SVX_SXCIAITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdangitm.hxx>
+
+inline SdrAngleItem makeSdrCircStartAngleItem(Degree100 nAngle)
+{
+ return SdrAngleItem(SDRATTR_CIRCSTARTANGLE, nAngle);
+}
+
+inline SdrAngleItem makeSdrCircEndAngleItem(Degree100 nAngle)
+{
+ return SdrAngleItem(SDRATTR_CIRCENDANGLE, nAngle);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxcllitm.hxx b/include/svx/sxcllitm.hxx
new file mode 100644
index 000000000..8ac03f0ea
--- /dev/null
+++ b/include/svx/sxcllitm.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXCLLITM_HXX
+#define INCLUDED_SVX_SXCLLITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+#include <svx/sdmetitm.hxx>
+
+/**
+ * Length of the first caption line
+ * Only for Type3 and Type4
+ * Only relevant, if SdrCaptionFitLineLenItem = false
+ */
+class SVXCORE_DLLPUBLIC SdrCaptionLineLenItem final : public SdrMetricItem {
+public:
+ SdrCaptionLineLenItem(tools::Long nLineLen=0): SdrMetricItem(SDRATTR_CAPTIONLINELEN,nLineLen) {}
+ virtual ~SdrCaptionLineLenItem() override;
+ virtual SdrCaptionLineLenItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrCaptionLineLenItem(SdrCaptionLineLenItem const &) = default;
+ SdrCaptionLineLenItem(SdrCaptionLineLenItem &&) = default;
+ SdrCaptionLineLenItem & operator =(SdrCaptionLineLenItem const &) = delete; // due to SdrMetricItem
+ SdrCaptionLineLenItem & operator =(SdrCaptionLineLenItem &&) = delete; // due to SdrMetricItem
+};
+
+/**
+ * The length of the first caption line is either automatically
+ * calculated or the default setting is used (SdrCaptionLineLenItem)
+ */
+class SVXCORE_DLLPUBLIC SdrCaptionFitLineLenItem final : public SdrYesNoItem {
+public:
+ SdrCaptionFitLineLenItem(bool bBestFit=true): SdrYesNoItem(SDRATTR_CAPTIONFITLINELEN,bBestFit) {}
+ virtual ~SdrCaptionFitLineLenItem() override;
+ virtual SdrCaptionFitLineLenItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrCaptionFitLineLenItem(SdrCaptionFitLineLenItem const &) = default;
+ SdrCaptionFitLineLenItem(SdrCaptionFitLineLenItem &&) = default;
+ SdrCaptionFitLineLenItem & operator =(SdrCaptionFitLineLenItem const &) = delete; // due to SdrYesNoItem
+ SdrCaptionFitLineLenItem & operator =(SdrCaptionFitLineLenItem &&) = delete; // due to SdrYesNoItem
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxctitm.hxx b/include/svx/sxctitm.hxx
new file mode 100644
index 000000000..3d46f54cb
--- /dev/null
+++ b/include/svx/sxctitm.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXCTITM_HXX
+#define INCLUDED_SVX_SXCTITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+enum class SdrCaptionType { Type1, Type2, Type3, Type4 };
+
+
+
+class SVXCORE_DLLPUBLIC SdrCaptionTypeItem final : public SfxEnumItem<SdrCaptionType> {
+public:
+ SdrCaptionTypeItem(SdrCaptionType eStyle=SdrCaptionType::Type3): SfxEnumItem(SDRATTR_CAPTIONTYPE, eStyle) {}
+ virtual SdrCaptionTypeItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override; // { return 4; }
+ static OUString GetValueTextByPos(sal_uInt16 nPos);
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxekitm.hxx b/include/svx/sxekitm.hxx
new file mode 100644
index 000000000..fd54d38bb
--- /dev/null
+++ b/include/svx/sxekitm.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXEKITM_HXX
+#define INCLUDED_SVX_SXEKITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdllapi.h>
+
+enum class SdrEdgeKind
+{
+ OrthoLines, ThreeLines, OneLine, Bezier, Arc
+};
+
+class SVXCORE_DLLPUBLIC SdrEdgeKindItem final : public SfxEnumItem<SdrEdgeKind> {
+public:
+ SdrEdgeKindItem(SdrEdgeKind eStyle=SdrEdgeKind::OrthoLines): SfxEnumItem(SDRATTR_EDGEKIND, eStyle) {}
+ virtual SdrEdgeKindItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override; // { return 5; }
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ static OUString GetValueTextByPos(sal_uInt16 nPos);
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxelditm.hxx b/include/svx/sxelditm.hxx
new file mode 100644
index 000000000..c957070ce
--- /dev/null
+++ b/include/svx/sxelditm.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXELDITM_HXX
+#define INCLUDED_SVX_SXELDITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+
+class SdrEdgeLineDeltaCountItem final : public SfxUInt16Item
+{
+public:
+ SdrEdgeLineDeltaCountItem(sal_uInt16 nVal = 0)
+ : SfxUInt16Item(SDRATTR_EDGELINEDELTACOUNT, nVal)
+ {
+ }
+ virtual SdrEdgeLineDeltaCountItem* Clone(SfxItemPool*) const override
+ {
+ return new SdrEdgeLineDeltaCountItem(*this);
+ }
+};
+
+inline SdrMetricItem makeSdrEdgeLine1DeltaItem(tools::Long nVal)
+{
+ return SdrMetricItem(SDRATTR_EDGELINE1DELTA, nVal);
+}
+
+inline SdrMetricItem makeSdrEdgeLine2DeltaItem(tools::Long nVal)
+{
+ return SdrMetricItem(SDRATTR_EDGELINE2DELTA, nVal);
+}
+
+inline SdrMetricItem makeSdrEdgeLine3DeltaItem(tools::Long nVal)
+{
+ return SdrMetricItem(SDRATTR_EDGELINE3DELTA, nVal);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxenditm.hxx b/include/svx/sxenditm.hxx
new file mode 100644
index 000000000..de7accd9b
--- /dev/null
+++ b/include/svx/sxenditm.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXENDITM_HXX
+#define INCLUDED_SVX_SXENDITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC SdrEdgeNode1HorzDistItem final : public SdrMetricItem {
+public:
+ SdrEdgeNode1HorzDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE1HORZDIST,nVal) {}
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual SdrEdgeNode1HorzDistItem* Clone(SfxItemPool* pPool=nullptr) const override;
+};
+
+class SVXCORE_DLLPUBLIC SdrEdgeNode1VertDistItem final : public SdrMetricItem {
+public:
+ SdrEdgeNode1VertDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE1VERTDIST,nVal) {}
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual SdrEdgeNode1VertDistItem* Clone(SfxItemPool* pPool=nullptr) const override;
+};
+
+class SVXCORE_DLLPUBLIC SdrEdgeNode2HorzDistItem final : public SdrMetricItem {
+public:
+ SdrEdgeNode2HorzDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE2HORZDIST,nVal) {}
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual SdrEdgeNode2HorzDistItem* Clone(SfxItemPool* pPool=nullptr) const override;
+};
+
+class SVXCORE_DLLPUBLIC SdrEdgeNode2VertDistItem final : public SdrMetricItem {
+public:
+ SdrEdgeNode2VertDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE2VERTDIST,nVal) {}
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual SdrEdgeNode2VertDistItem* Clone(SfxItemPool* pPool=nullptr) const override;
+};
+
+class SdrEdgeNode1GlueDistItem final : public SdrMetricItem {
+public:
+ SdrEdgeNode1GlueDistItem(tools::Long nVal=0): SdrMetricItem(SDRATTR_EDGENODE1GLUEDIST,nVal) {}
+ virtual SdrEdgeNode1GlueDistItem* Clone(SfxItemPool* pPool=nullptr) const override;
+};
+
+class SdrEdgeNode2GlueDistItem final : public SdrMetricItem {
+public:
+ SdrEdgeNode2GlueDistItem(tools::Long nVal=0): SdrMetricItem(SDRATTR_EDGENODE2GLUEDIST,nVal) {}
+ virtual SdrEdgeNode2GlueDistItem* Clone(SfxItemPool* pPool=nullptr) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxmbritm.hxx b/include/svx/sxmbritm.hxx
new file mode 100644
index 000000000..022656aaa
--- /dev/null
+++ b/include/svx/sxmbritm.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXMBRITM_HXX
+#define INCLUDED_SVX_SXMBRITM_HXX
+
+#include <svx/svddef.hxx>
+
+#include <svx/sdynitm.hxx>
+
+// dimension line below the reference edge
+// for dimensioning the lower edge of the object
+// (redundant to turn the reference edge through 180deg +
+// TextUpsideDown, but easily operated)
+// can also be dragged by dragging the measure line item
+// (SdrMeasureLineDistItem) over the reference edge
+class SVXCORE_DLLPUBLIC SdrMeasureBelowRefEdgeItem final : public SdrYesNoItem {
+public:
+ SdrMeasureBelowRefEdgeItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASUREBELOWREFEDGE,bOn) {}
+ virtual ~SdrMeasureBelowRefEdgeItem() override;
+ virtual SdrMeasureBelowRefEdgeItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrMeasureBelowRefEdgeItem(SdrMeasureBelowRefEdgeItem const &) = default;
+ SdrMeasureBelowRefEdgeItem(SdrMeasureBelowRefEdgeItem &&) = default;
+ SdrMeasureBelowRefEdgeItem & operator =(SdrMeasureBelowRefEdgeItem const &) = delete; // due to SdrYesNoItem
+ SdrMeasureBelowRefEdgeItem & operator =(SdrMeasureBelowRefEdgeItem &&) = delete; // due to SdrYesNoItem
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxmlhitm.hxx b/include/svx/sxmlhitm.hxx
new file mode 100644
index 000000000..8fdb7c64e
--- /dev/null
+++ b/include/svx/sxmlhitm.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXMLHITM_HXX
+#define INCLUDED_SVX_SXMLHITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+
+// Measure
+// ___
+// | 100,00km | 2mm = SdrMeasureHelplineOverhangItem
+// |<--------------------->|---
+// | | 8mm = SdrMeasureLineDistItem
+// | |
+// #=============# |---
+// # # | SdrMeasureHelpline1/2LenItem
+// # #=========#---
+// # dimensioned object #
+// #=======================#
+
+// gab between dimension line and document reference edge (norm=8mm)
+// can be dragged on the handles of the arrowheads
+inline SdrMetricItem makeSdrMeasureLineDistItem(tools::Long nVal)
+{
+ return SdrMetricItem(SDRATTR_MEASURELINEDIST, nVal);
+}
+
+// overhang of dimension help line to dimension line (norm=2mm)
+inline SdrMetricItem makeSdrMeasureHelplineOverhangItem(tools::Long nVal)
+{
+ return SdrMetricItem(SDRATTR_MEASUREHELPLINEOVERHANG, nVal);
+}
+
+// gab between dimension line and document reference edge
+// dimension help lines shell not touch the object
+inline SdrMetricItem makeSdrMeasureHelplineDistItem(tools::Long nVal)
+{
+ return SdrMetricItem(SDRATTR_MEASUREHELPLINEDIST, nVal);
+}
+
+// overlength of the help lines can be dragged at the round handles,
+// which are under the reference points by default
+inline SdrMetricItem makeSdrMeasureHelpline1LenItem(tools::Long nVal)
+{
+ return SdrMetricItem(SDRATTR_MEASUREHELPLINE1LEN, nVal);
+}
+inline SdrMetricItem makeSdrMeasureHelpline2LenItem(tools::Long nVal)
+{
+ return SdrMetricItem(SDRATTR_MEASUREHELPLINE2LEN, nVal);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxmtfitm.hxx b/include/svx/sxmtfitm.hxx
new file mode 100644
index 000000000..11de73286
--- /dev/null
+++ b/include/svx/sxmtfitm.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXMTFITM_HXX
+#define INCLUDED_SVX_SXMTFITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+#include <svx/sdangitm.hxx>
+
+// The two following are not implemented yet!
+// Nail text down to a fix angle.
+// The text angle is independent of the dimension line.
+// Abrogate TextUpsideDown, TextRota90 and TextAutoAngle. (n.i.)
+class SdrMeasureTextIsFixedAngleItem final : public SdrYesNoItem {
+public:
+ SdrMeasureTextIsFixedAngleItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTISFIXEDANGLE,bOn) {}
+ virtual ~SdrMeasureTextIsFixedAngleItem() override;
+ virtual SdrMeasureTextIsFixedAngleItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrMeasureTextIsFixedAngleItem(SdrMeasureTextIsFixedAngleItem const &) = default;
+ SdrMeasureTextIsFixedAngleItem(SdrMeasureTextIsFixedAngleItem &&) = default;
+ SdrMeasureTextIsFixedAngleItem & operator =(SdrMeasureTextIsFixedAngleItem const &) = delete; // due to SdrYesNoItem
+ SdrMeasureTextIsFixedAngleItem & operator =(SdrMeasureTextIsFixedAngleItem &&) = delete; // due to SdrYesNoItem
+};
+
+//Angle of the text in 1/100deg. 0=horizontal; read from left to right. (n.i.)
+class SdrMeasureTextFixedAngleItem final : public SdrAngleItem {
+public:
+ SdrMeasureTextFixedAngleItem(Degree100 nVal=0_deg100): SdrAngleItem(SDRATTR_MEASURETEXTFIXEDANGLE,nVal) {}
+ virtual ~SdrMeasureTextFixedAngleItem() override;
+ virtual SdrMeasureTextFixedAngleItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrMeasureTextFixedAngleItem(SdrMeasureTextFixedAngleItem const &) = default;
+ SdrMeasureTextFixedAngleItem(SdrMeasureTextFixedAngleItem &&) = default;
+ SdrMeasureTextFixedAngleItem & operator =(SdrMeasureTextFixedAngleItem const &) = delete; // due to SdrAngleItem
+ SdrMeasureTextFixedAngleItem & operator =(SdrMeasureTextFixedAngleItem &&) = delete; // due to SdrAngleItem
+};
+
+// The decimal places used for the measure value
+class SVXCORE_DLLPUBLIC SdrMeasureDecimalPlacesItem final : public SfxInt16Item {
+public:
+ SdrMeasureDecimalPlacesItem(sal_Int16 nVal=2): SfxInt16Item(SDRATTR_MEASUREDECIMALPLACES,nVal) {}
+ virtual ~SdrMeasureDecimalPlacesItem() override;
+ virtual SdrMeasureDecimalPlacesItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrMeasureDecimalPlacesItem(SdrMeasureDecimalPlacesItem const &) = default;
+ SdrMeasureDecimalPlacesItem(SdrMeasureDecimalPlacesItem &&) = default;
+ SdrMeasureDecimalPlacesItem & operator =(SdrMeasureDecimalPlacesItem const &) = delete; // due to SfxInt16Item
+ SdrMeasureDecimalPlacesItem & operator =(SdrMeasureDecimalPlacesItem &&) = delete; // due to SfxInt16Item
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxmtpitm.hxx b/include/svx/sxmtpitm.hxx
new file mode 100644
index 000000000..60e17d445
--- /dev/null
+++ b/include/svx/sxmtpitm.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXMTPITM_HXX
+#define INCLUDED_SVX_SXMTPITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+#include <com/sun/star/drawing/MeasureTextHorzPos.hpp>
+#include <com/sun/star/drawing/MeasureTextVertPos.hpp>
+
+class SVXCORE_DLLPUBLIC SdrMeasureTextHPosItem final : public SfxEnumItem<css::drawing::MeasureTextHorzPos> {
+public:
+ SdrMeasureTextHPosItem(css::drawing::MeasureTextHorzPos ePos = css::drawing::MeasureTextHorzPos::MeasureTextHorzPos_AUTO)
+ : SfxEnumItem(SDRATTR_MEASURETEXTHPOS, ePos)
+ {
+ }
+ virtual SdrMeasureTextHPosItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override; // { return 4; }
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ static const OUString & GetValueTextByPos(sal_uInt16 nPos);
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+class SVXCORE_DLLPUBLIC SdrMeasureTextVPosItem final : public SfxEnumItem<css::drawing::MeasureTextVertPos> {
+public:
+ SdrMeasureTextVPosItem(css::drawing::MeasureTextVertPos ePos = css::drawing::MeasureTextVertPos_AUTO)
+ : SfxEnumItem(SDRATTR_MEASURETEXTVPOS, ePos)
+ {
+ }
+ virtual SdrMeasureTextVPosItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override; // { return 5; }
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ static OUString GetValueTextByPos(sal_uInt16 nPos);
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxmtritm.hxx b/include/svx/sxmtritm.hxx
new file mode 100644
index 000000000..184a59f39
--- /dev/null
+++ b/include/svx/sxmtritm.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXMTRITM_HXX
+#define INCLUDED_SVX_SXMTRITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+
+// text across the dimension line (90deg counter-clockwise rotation)
+class SVXCORE_DLLPUBLIC SdrMeasureTextRota90Item final : public SdrYesNoItem {
+public:
+ SdrMeasureTextRota90Item(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTROTA90,bOn) {}
+ virtual ~SdrMeasureTextRota90Item() override;
+ virtual SdrMeasureTextRota90Item* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrMeasureTextRota90Item(SdrMeasureTextRota90Item const &) = default;
+ SdrMeasureTextRota90Item(SdrMeasureTextRota90Item &&) = default;
+ SdrMeasureTextRota90Item & operator =(SdrMeasureTextRota90Item const &) = delete; // due to SdrYesNoItem
+ SdrMeasureTextRota90Item & operator =(SdrMeasureTextRota90Item &&) = delete; // due to SdrYesNoItem
+};
+
+// Turn the calculated TextRect through 180 deg
+// Text is also switched to the other side of the dimension line, if not Rota90
+class SdrMeasureTextUpsideDownItem final : public SdrYesNoItem {
+public:
+ SdrMeasureTextUpsideDownItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTUPSIDEDOWN,bOn) {}
+ virtual ~SdrMeasureTextUpsideDownItem() override;
+ virtual SdrMeasureTextUpsideDownItem* Clone(SfxItemPool* pPool=nullptr) const override;
+
+ SdrMeasureTextUpsideDownItem(SdrMeasureTextUpsideDownItem const &) = default;
+ SdrMeasureTextUpsideDownItem(SdrMeasureTextUpsideDownItem &&) = default;
+ SdrMeasureTextUpsideDownItem & operator =(SdrMeasureTextUpsideDownItem const &) = delete; // due to SdrYesNoItem
+ SdrMeasureTextUpsideDownItem & operator =(SdrMeasureTextUpsideDownItem &&) = delete; // due to SdrYesNoItem
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sxmuitm.hxx b/include/svx/sxmuitm.hxx
new file mode 100644
index 000000000..ab0ad8a3c
--- /dev/null
+++ b/include/svx/sxmuitm.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_SXMUITM_HXX
+#define INCLUDED_SVX_SXMUITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+#include <tools/fldunit.hxx>
+
+// specification of the unit if measurement. The numerical quantity value is converted in this unity.
+// (based on the facts of the MapUnit of the model). This unity is displayed if necessary.
+class SVXCORE_DLLPUBLIC SdrMeasureUnitItem final : public SfxEnumItem<FieldUnit> {
+public:
+ SdrMeasureUnitItem(FieldUnit eUnit=FieldUnit::NONE): SfxEnumItem(SDRATTR_MEASUREUNIT, eUnit) {}
+ virtual SdrMeasureUnitItem* Clone(SfxItemPool* pPool=nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override; // { return 14; }
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ static OUString GetValueTextByPos(sal_uInt16 nPos);
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/tabarea.hxx b/include/svx/tabarea.hxx
new file mode 100644
index 000000000..b1307b4c4
--- /dev/null
+++ b/include/svx/tabarea.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_TABAREA_HXX
+#define INCLUDED_SVX_TABAREA_HXX
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class ChangeType
+{
+ NONE = 0x00,
+ MODIFIED = 0x01,
+ CHANGED = 0x02
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ChangeType> : is_typed_flags<ChangeType, 0x03> {};
+}
+
+#endif // INCLUDED_SVX_TABAREA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/tabline.hxx b/include/svx/tabline.hxx
new file mode 100644
index 000000000..2b6e318da
--- /dev/null
+++ b/include/svx/tabline.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_TABLINE_HXX
+#define INCLUDED_SVX_TABLINE_HXX
+
+class SvxBrushItem;
+class SdrModel;
+class SdrObject;
+
+//defines for the symbol selection on the page
+//Positive value (0,...n) declares the index in pSymbollist, else:
+#define SVX_SYMBOLTYPE_NONE (-3) //symbol hidden
+#define SVX_SYMBOLTYPE_AUTO (-2) //symbol automatically generated
+#define SVX_SYMBOLTYPE_BRUSHITEM (-1) //symbol is contained as graphic in item:
+#define SVX_SYMBOLTYPE_UNKNOWN (-100) //unknown/not initialized
+
+#endif // INCLUDED_SVX_TABLINE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
new file mode 100644
index 000000000..194db28a5
--- /dev/null
+++ b/include/svx/tbcontrl.hxx
@@ -0,0 +1,281 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_TBCONTRL_HXX
+#define INCLUDED_SVX_TBCONTRL_HXX
+
+/*--------------------------------------------------------------*\
+
+ Description:
+ -------------
+ ToolBox-Controller for:
+ Font-Name, Font-Height, Font-Color
+ Fore-/Background color /-patterns
+ Frames, Lines
+ (indentation-)templates
+
+ Use:
+ ----------
+ SvxFontNameToolBoxControl
+ -------------------------
+ Item type: SvxFontItem
+ Execute-Id: SID_ATTR_CHAR_FONT
+ -> SvxFontItem
+ Additional information
+ from DocShell: SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
+
+ SvxColorToolBoxControl
+ ----------------------
+ Item type: SvxColorItem
+ SvxLineItem
+ SfxBoolItem
+ XLineColorItem
+ and XFillColorItem
+
+ for font color (writer, ...)
+ Execute-Id SID_ATTR_CHAR_COLOR2
+ and SID_ATTR_CHAR_COLOR_EXT
+
+ for font color
+ (calc/impress/draw and writer drawing objects)
+ Execute-Id SID_ATTR_CHAR_COLOR
+
+ for character background color (writer)
+ Execute-Id SID_ATTR_CHAR_COLOR_BACKGROUND
+ and SID_ATTR_CHAR_COLOR_BACKGROUND_EXT
+
+ for paragraph background color (writer)
+ and cell background color (calc)
+ Execute-Id SID_BACKGROUND_COLOR
+
+ for table/cell border color (writer, calc)
+ Execute-Id SID_FRAME_LINECOLOR
+
+ for 3D extrusion
+ Execute-Id SID_EXTRUSION_3D_COLOR
+
+ for line color
+ Execute-Id SID_ATTR_LINE_COLOR
+
+ for area fill color
+ Execute-Id SID_ATTR_FILL_COLOR
+
+ SvxPatternToolBoxControl
+ ------------------------
+ Item type: SvxBrushItem
+ Execute-Id: SID_BACKGROUND_PATTERN
+ -> SvxBrushItem
+ Additional information
+ from DocShell: presently none
+ in future: color palette
+ Note: Analysis of BrushItem:
+ Brush-FillColor() is misused as switch,
+ to distinguish whether a new style
+ or a new color has been set
+
+ GetFillColor() == COL_BLACK -> GetStyle() ,
+ GetFillColor() == COL_WHITE -> GetColor()
+
+ SvxFrameToolBoxControl
+ ----------------------
+ Item type: SvxBoxItem
+ Execute-Id: SID_ATTR_BORDER
+ -> SvxBoxItem & SvxBoxInfoItem
+ Additional information
+ from DocShell: none
+ Note: provides, depending on chosen ValueSet-Item,
+ only SvxBoxItem or additionally SvxBoxInfoItem
+ If the Controller in SfxUInt16Item receives a
+ value != 0, paragraph mode will be switched on,
+ i.e. the last line will be hidden.
+ A value == 0 switches again to Table mode.
+
+ SvxFrameLineStyleToolBoxControl
+ -------------------------------
+ Item type: SvxLineItem
+ Execute-Id: SID_FRAME_LINESTYLE
+ -> SvxLineItem
+ Additional information
+ from DocShell: none
+ Note: provides a SvxLineItem, which provides a SvxBorderLine
+ without color information.
+
+ SvxStyleToolBoxControl
+ ----------------------
+ Item type: SfxTemplateItem
+ Execute-Id: SID_TEMPLATE_APPLY
+ -> StyleName (SfxStringItem)
+ -> eStyleFamily (SfxUInt16Item)
+ Additional information
+ from DocShell: none
+ Note: Switch family by Invalidate
+ at the Bindings (->SfxStyleControllerItem)
+
+\*--------------------------------------------------------------*/
+
+// ITEMID_... defines in the *.cxx
+
+#include <config_options.h>
+#include <svl/style.hxx>
+#include <svx/svxdllapi.h>
+#include <com/sun/star/frame/XSubToolbarController.hpp>
+#include <svtools/popupwindowcontroller.hxx>
+#include <svx/colorwindow.hxx>
+#include <memory>
+
+// important in the tbxctrls.hxx created with HeDaBu !!!
+class SvxLineItem;
+class SvxBoxInfoItem;
+class SvxFontItem;
+class SfxStyleControllerItem_Impl;
+class SfxStyleSheetBasePool;
+class SfxTemplateItem;
+class PaletteManager;
+
+namespace svx
+{
+ class ToolboxButtonColorUpdaterBase;
+}
+
+class SvxStyleToolBoxControl final : public cppu::ImplInheritanceHelper<svt::ToolboxController,
+ css::lang::XServiceInfo>
+{
+ struct Impl;
+ std::unique_ptr<Impl> pImpl;
+
+public:
+ SvxStyleToolBoxControl();
+ virtual ~SvxStyleToolBoxControl() override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
+
+ // XToolbarController
+ virtual css::uno::Reference<css::awt::XWindow> SAL_CALL createItemWindow(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& aArguments) override;
+
+ // XUpdatable
+ virtual void SAL_CALL update() override;
+
+ // XComponent
+ virtual void SAL_CALL dispose() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+private:
+#define MAX_FAMILIES 5
+
+ SfxStyleSheetBasePool* pStyleSheetPool;
+ rtl::Reference<SfxStyleControllerItem_Impl> m_xBoundItems[MAX_FAMILIES];
+ std::unique_ptr<SfxTemplateItem> pFamilyState[MAX_FAMILIES];
+ sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
+
+ void Update();
+ void FillStyleBox();
+ void SelectStyle(const OUString& rStyleName);
+
+friend class SfxStyleControllerItem_Impl;
+
+ void SetFamilyState(sal_uInt16 nIdx, const SfxTemplateItem* pItem);
+ SfxStyleFamily GetActFamily() const;
+};
+
+typedef std::function<void(const OUString&, const svx::NamedThemedColor&)> ColorSelectFunction;
+
+class SVXCORE_DLLPUBLIC SvxColorToolBoxControl final : public cppu::ImplInheritanceHelper< svt::PopupWindowController,
+ css::frame::XSubToolbarController >
+{
+ std::unique_ptr<svx::ToolboxButtonColorUpdaterBase> m_xBtnUpdater;
+ std::shared_ptr<PaletteManager> m_xPaletteManager;
+ ColorStatus m_aColorStatus;
+ bool m_bSplitButton;
+ sal_uInt16 m_nSlotId;
+ ColorSelectFunction m_aColorSelectFunction;
+ DECL_DLLPRIVATE_LINK(SelectedHdl, const NamedColor&, void);
+
+ weld::Window* GetParentFrame() const;
+
+public:
+ explicit SvxColorToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
+ virtual ~SvxColorToolBoxControl() override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence<css::uno::Any>& rArguments ) override;
+
+ // XUpdatable
+ virtual void SAL_CALL update() override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 nSelectModifier ) override;
+
+ virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override;
+ virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override;
+
+ // XSubToolbarController
+ virtual sal_Bool SAL_CALL opensSubToolbar() override;
+ virtual OUString SAL_CALL getSubToolbarName() override;
+ virtual void SAL_CALL functionSelected( const OUString& rCommand ) override;
+ virtual void SAL_CALL updateImage() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ void setColorSelectFunction(const ColorSelectFunction& aColorSelectFunction);
+ void EnsurePaletteManager();
+};
+
+class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SvxCurrencyToolBoxControl final : public svt::PopupWindowController
+{
+private:
+ OUString m_aFormatString;
+ LanguageType m_eLanguage;
+ sal_uInt32 m_nFormatKey;
+
+public:
+ static void GetCurrencySymbols( std::vector<OUString>& rList, bool bFlag,
+ std::vector<sal_uInt16>& rCurrencyList );
+
+ explicit SvxCurrencyToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
+ virtual ~SvxCurrencyToolBoxControl() override;
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 nSelectModifier ) override;
+
+ virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override;
+ virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override;
+};
+
+#endif // INCLUDED_SVX_TBCONTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/tbxcolor.hxx b/include/svx/tbxcolor.hxx
new file mode 100644
index 000000000..86dff9a92
--- /dev/null
+++ b/include/svx/tbxcolor.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <svx/svxdllapi.h>
+
+
+namespace svx
+{
+
+
+ //= ToolboxAccess
+
+ class SVX_DLLPUBLIC ToolboxAccess
+ {
+ private:
+ OUString m_sToolboxResName;
+ css::uno::Reference<
+ css::frame::XLayoutManager > m_xLayouter;
+
+ public:
+ ToolboxAccess( std::u16string_view rToolboxName );
+
+ public:
+ /** toggles the toolbox
+ */
+ void toggleToolbox() const;
+
+ /** determines whether the toolbox is currently visible
+ */
+ bool isToolboxVisible() const;
+ };
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/tbxctl.hxx b/include/svx/tbxctl.hxx
new file mode 100644
index 000000000..09af66c61
--- /dev/null
+++ b/include/svx/tbxctl.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_TBXCTL_HXX
+#define INCLUDED_SVX_TBXCTL_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* Class for SwToolbox
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxTbxCtlDraw final : public SfxToolBoxControl
+{
+private:
+ OUString m_sToolboxName;
+
+ void toggleToolbox();
+
+protected:
+
+public:
+ SvxTbxCtlDraw( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ virtual void Select(sal_uInt16 nSelectModifier) override;
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/transfrmhelper.hxx b/include/svx/transfrmhelper.hxx
new file mode 100644
index 000000000..9e683d445
--- /dev/null
+++ b/include/svx/transfrmhelper.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_TRANSFRMHELPER_HXX
+#define INCLUDED_SVX_TRANSFRMHELPER_HXX
+
+#include <basegfx/range/b2drange.hxx>
+#include <tools/fract.hxx>
+#include <tools/fldunit.hxx>
+#include <tools/mapunit.hxx>
+#include <vcl/fieldvalues.hxx>
+
+namespace TransfrmHelper
+{
+ inline void ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 nDigits, const MapUnit ePoolUnit, const FieldUnit eDlgUnit)
+ {
+ const basegfx::B2DPoint aTopLeft(
+ static_cast<double>(vcl::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit)),
+ static_cast<double>(vcl::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit)));
+ const basegfx::B2DPoint aBottomRight(
+ static_cast<double>(vcl::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit)),
+ static_cast<double>(vcl::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit)));
+
+ rRange = basegfx::B2DRange(aTopLeft, aBottomRight);
+ }
+
+ inline void ScaleRect(basegfx::B2DRange& rRange, const Fraction& rUIScale)
+ {
+ const double fFactor(1.0 / double(rUIScale));
+ rRange = basegfx::B2DRange(rRange.getMinimum() * fFactor, rRange.getMaximum() * fFactor);
+ }
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/txencbox.hxx b/include/svx/txencbox.hxx
new file mode 100644
index 000000000..c87f07b2e
--- /dev/null
+++ b/include/svx/txencbox.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_TXENCBOX_HXX
+#define INCLUDED_SVX_TXENCBOX_HXX
+
+#include <vcl/weld.hxx>
+#include <rtl/textenc.h>
+#include <svx/svxdllapi.h>
+
+class SVX_DLLPUBLIC SvxTextEncodingBox
+{
+private:
+ std::unique_ptr<weld::ComboBox> m_xControl;
+
+public:
+ SvxTextEncodingBox(std::unique_ptr<weld::ComboBox> pControl);
+
+ ~SvxTextEncodingBox();
+
+ /** Fill with all known encodings but exclude those matching one or more
+ given flags as defined in rtl/tencinfo.h
+
+ <p> If nButIncludeInfoFlags is given, encodings are included even if they
+ match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
+ Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
+ with RTL_TEXTENCODING_INFO_MIME </p>
+
+ @param bExcludeImportSubsets
+ If <TRUE/>, some specific encodings are not listed, as they are a
+ subset of another encoding. This is the case for
+ RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
+ RTL_TEXTENCODING_MS_936, which are covered by
+ RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
+ <TRUE/> whenever the box is used in import dialogs. */
+ void FillFromTextEncodingTable(
+ bool bExcludeImportSubsets,
+ sal_uInt32 nExcludeInfoFlags = 0,
+ sal_uInt32 nButIncludeInfoFlags = 0
+ );
+
+ /** Fill with all encodings known to the dbtools::OCharsetMap but exclude
+ those matching one or more given flags as defined in rtl/tencinfo.h
+
+ <p> If nButIncludeInfoFlags is given, encodings are included even if they
+ match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
+ Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
+ with RTL_TEXTENCODING_INFO_MIME </p>
+
+ @param bExcludeImportSubsets
+ If <TRUE/>, some specific encodings are not listed, as they are a
+ subset of another encoding. This is the case for
+ RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
+ RTL_TEXTENCODING_MS_936, which are covered by
+ RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
+ <TRUE/> whenever the box is used in import dialogs. */
+ void FillFromDbTextEncodingMap(
+ bool bExcludeImportSubsets,
+ sal_uInt32 nExcludeInfoFlags = 0);
+
+ void InsertTextEncoding( const rtl_TextEncoding nEnc );
+
+ void InsertTextEncoding( const rtl_TextEncoding nEnc,
+ const OUString& rEntry );
+
+ void SelectTextEncoding( const rtl_TextEncoding nEnc );
+
+ rtl_TextEncoding GetSelectTextEncoding() const;
+
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
+ void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
+ void grab_focus() { m_xControl->grab_focus(); }
+ int get_active() const { return m_xControl->get_active(); }
+ void set_active(int nActive) { m_xControl->set_active(nActive); }
+ void show() { m_xControl->show(); }
+ void hide() { m_xControl->hide(); }
+};
+
+class SVX_DLLPUBLIC SvxTextEncodingTreeView
+{
+private:
+ std::unique_ptr<weld::TreeView> m_xControl;
+
+public:
+ SvxTextEncodingTreeView(std::unique_ptr<weld::TreeView> pControl);
+
+ ~SvxTextEncodingTreeView();
+
+ /** Fill with all known encodings but exclude those matching one or more
+ given flags as defined in rtl/tencinfo.h
+
+ @param bExcludeImportSubsets
+ If <TRUE/>, some specific encodings are not listed, as they are a
+ subset of another encoding. This is the case for
+ RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
+ RTL_TEXTENCODING_MS_936, which are covered by
+ RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
+ <TRUE/> whenever the box is used in import dialogs. */
+ void FillFromTextEncodingTable(
+ bool bExcludeImportSubsets,
+ sal_uInt32 nExcludeInfoFlags = 0);
+
+ /** Fill with all encodings known to the dbtools::OCharsetMap but exclude
+ those matching one or more given flags as defined in rtl/tencinfo.h
+
+ @param bExcludeImportSubsets
+ If <TRUE/>, some specific encodings are not listed, as they are a
+ subset of another encoding. This is the case for
+ RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
+ RTL_TEXTENCODING_MS_936, which are covered by
+ RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
+ <TRUE/> whenever the box is used in import dialogs. */
+ void FillFromDbTextEncodingMap(
+ bool bExcludeImportSubsets,
+ sal_uInt32 nExcludeInfoFlags = 0);
+
+ void InsertTextEncoding( const rtl_TextEncoding nEnc );
+
+ void InsertTextEncoding( const rtl_TextEncoding nEnc,
+ const OUString& rEntry );
+
+ void SelectTextEncoding( const rtl_TextEncoding nEnc );
+
+ rtl_TextEncoding GetSelectTextEncoding() const;
+
+ void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xControl->connect_changed(rLink); }
+ void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { m_xControl->connect_row_activated(rLink); }
+ void grab_focus() { m_xControl->grab_focus(); }
+ void show() { m_xControl->show(); }
+ void hide() { m_xControl->hide(); }
+ int get_height_rows(int nRows) const
+ {
+ return m_xControl->get_height_rows(nRows);
+ }
+ void set_size_request(int nWidth, int nHeight)
+ {
+ m_xControl->set_size_request(nWidth, nHeight);
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/txenctab.hxx b/include/svx/txenctab.hxx
new file mode 100644
index 000000000..c4bbbd4e9
--- /dev/null
+++ b/include/svx/txenctab.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_TXENCTAB_HXX
+#define INCLUDED_SVX_TXENCTAB_HXX
+
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+
+class SVX_DLLPUBLIC SvxTextEncodingTable
+{
+public:
+ static OUString GetTextString(const rtl_TextEncoding nEnc);
+ static rtl_TextEncoding GetTextEncoding(const OUString& rStr);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ucsubset.hxx b/include/svx/ucsubset.hxx
new file mode 100644
index 000000000..21251c4b5
--- /dev/null
+++ b/include/svx/ucsubset.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UCSUBSET_HXX
+#define INCLUDED_SVX_UCSUBSET_HXX
+
+#include <svx/svxdllapi.h>
+
+#include <vcl/vclenum.hxx>
+#include <vcl/metric.hxx>
+
+#include <vector>
+
+class FontCharMap;
+
+// TODO: should be moved into Font Attributes territory,
+// we let them mature here though because this is currently the only use
+
+class Subset
+{
+public:
+ Subset(sal_UCS4 nMin, sal_UCS4 nMax, const OUString& rName);
+
+ sal_UCS4 GetRangeMin() const { return mnRangeMin;}
+ sal_UCS4 GetRangeMax() const { return mnRangeMax;}
+ const OUString& GetName() const { return maRangeName;}
+
+private:
+ sal_UCS4 mnRangeMin;
+ sal_UCS4 mnRangeMax;
+ OUString maRangeName;
+};
+
+inline bool operator<(const Subset &rLHS, const Subset &rRHS)
+{
+ return rLHS.GetRangeMin() < rRHS.GetRangeMin();
+}
+
+typedef ::std::vector<Subset> SubsetVec;
+
+class SVX_DLLPUBLIC SubsetMap
+{
+public:
+ SubsetMap( const FontCharMapRef& );
+
+ const Subset* GetSubsetByUnicode( sal_UCS4 ) const;
+ const SubsetVec& GetSubsetMap() const;
+
+private:
+ SubsetVec maSubsets;
+
+ SVX_DLLPRIVATE void InitList();
+ SVX_DLLPRIVATE void ApplyCharMap( const FontCharMapRef& );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/uiobject.hxx b/include/svx/uiobject.hxx
new file mode 100644
index 000000000..4fd63c9d0
--- /dev/null
+++ b/include/svx/uiobject.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVX_UIOBJECT_HXX
+#define INCLUDED_SVX_UIOBJECT_HXX
+
+#include <svx/svxdllapi.h>
+
+#include <svx/SvxColorValueSet.hxx>
+
+#include <vcl/uitest/uiobject.hxx>
+
+class SdrObject;
+class SvxColorValueSet;
+
+class SVXCORE_DLLPUBLIC SdrUIObject : public UIObject
+{
+public:
+
+ virtual ~SdrUIObject() override;
+
+ virtual StringMap get_state() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual OUString get_type() const override;
+
+ virtual SdrObject* get_object() = 0;
+};
+
+class SvxColorValueSetUIObject final : public DrawingAreaUIObject
+{
+ SvxColorValueSet* mpColorSet;
+
+public:
+
+ SvxColorValueSetUIObject(vcl::Window* pColorSetWin);
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual StringMap get_state() override;
+
+private:
+
+ OUString get_name() const override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unoapi.hxx b/include/svx/unoapi.hxx
new file mode 100644
index 000000000..3107a4835
--- /dev/null
+++ b/include/svx/unoapi.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UNOAPI_HXX
+#define INCLUDED_SVX_UNOAPI_HXX
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <rtl/ref.hxx>
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+#include <tools/fldunit.hxx>
+#include <tools/mapunit.hxx>
+
+class SvxShape;
+class SdrObject;
+class SdrPage;
+class SvxNumBulletItem;
+class SfxItemPool;
+enum class SdrInventor : sal_uInt32;
+enum class SdrObjKind : sal_uInt16;
+
+/**
+ * Creates a StarOffice API wrapper with the given type and inventor
+ * Deprecated: This will be replaced with a function returning XShape.
+ *
+ * @throws css::uno::RuntimeException
+ */
+SVXCORE_DLLPUBLIC rtl::Reference<SvxShape> CreateSvxShapeByTypeAndInventor(SdrObjKind nType, SdrInventor nInventor, OUString const & referer);
+
+/** Returns a StarOffice API wrapper for the given SdrObject */
+SVXCORE_DLLPUBLIC css::uno::Reference< css::drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) noexcept;
+
+/** Returns a StarOffice API wrapper for the given SdrPage */
+SVXCORE_DLLPUBLIC css::uno::Reference< css::drawing::XDrawPage > GetXDrawPageForSdrPage( SdrPage* pPage ) noexcept;
+
+/** Returns the SdrPage from the given StarOffice API wrapper */
+SVXCORE_DLLPUBLIC SdrPage* GetSdrPageFromXDrawPage( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage ) noexcept ;
+
+/**
+ * Maps the vcl MapUnit enum to an API constant MeasureUnit.
+ * Returns false if conversion is not supported.
+ */
+SVXCORE_DLLPUBLIC bool SvxMapUnitToMeasureUnit( const MapUnit nVcl, short& eApi ) noexcept;
+
+/**
+ * Maps the API constant MeasureUnit to a vcl MapUnit enum.
+ * Returns false if conversion is not supported.
+ */
+SVXCORE_DLLPUBLIC bool SvxMeasureUnitToFieldUnit( const short eApi, FieldUnit& nVcl ) noexcept;
+
+/**
+ * Maps the vcl MapUnit enum to an API constant MeasureUnit.
+ * Returns false if conversion is not supported.
+ */
+SVXCORE_DLLPUBLIC bool SvxFieldUnitToMeasureUnit( const FieldUnit nVcl, short& eApi ) noexcept;
+
+/**
+ * If the given name is a predefined name for the current language it is replaced by
+ * the corresponding API name.
+ *
+ * @throws std::exception
+*/
+[[nodiscard]] SVXCORE_DLLPUBLIC OUString
+ SvxUnogetApiNameForItem(const sal_uInt16 nWhich, const OUString& rInternalName);
+
+/**
+ * If the given name is a predefined API name it is replaced by the predefined name
+ * for the current language.
+ *
+ * @throws std::exception
+*/
+[[nodiscard]] OUString
+ SvxUnogetInternalNameForItem(const sal_uInt16 nWhich, const OUString& rApiName);
+
+#endif // INCLUDED_SVX_UNOAPI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unobrushitemhelper.hxx b/include/svx/unobrushitemhelper.hxx
new file mode 100644
index 000000000..1bb7d8f14
--- /dev/null
+++ b/include/svx/unobrushitemhelper.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_UNOBRUSHITEMHELPER_HXX
+#define INCLUDED_SVX_UNOBRUSHITEMHELPER_HXX
+
+#include <svx/svxdllapi.h>
+#include <editeng/brushitem.hxx>
+
+// Helper function definitions for UNO API fallbacks to replace SvxBrushItem. The
+// idea is to have fallbacks to create a SvxBrushItem if needed for backwards compatibility
+// if needed from the SfxItemSet and vice versa. This is used in cases where e.g. UNO API
+// accesses to slots in the SvxBrushItem are used (see cases in SvxBrushItem::QueryValue
+// and SvxBrushItem::PutValue as MID_BACK_COLOR and similar).
+// To make this work, a cycle of creating a SvxBrushItem from a SfxItemSet, changing a value
+// using PutValue, putting back to the SfxItemSet should create the *same* SvxBrushItem
+// the next time this will be created using getSvxBrushItemFromSourceSet. For more details,
+// see comments at the implementations of that two methods.
+
+// Set the equivalent in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST] in the given
+// SfxItemSet to create the same FillStyle as is expressed by the given SvxBrushItem.
+// This method will reset all items in the XATTR_FILL_* range first.
+SVXCORE_DLLPUBLIC void setSvxBrushItemAsFillAttributesToTargetSet(
+ const SvxBrushItem& rBrush,
+ SfxItemSet& rToSet);
+
+// Create a SvxBrushItem as close as possible to the settings in the DrawingLayer
+// items in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Since this is not 100%
+// representable this may lead to reduced data. With nBackgroundID a Which-ID for the
+// to-be-created SvxBrushItem has to be given (default should be 99 as in RES_BACKGROUND).
+SVXCORE_DLLPUBLIC std::unique_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(
+ const SfxItemSet& rSourceSet,
+ sal_uInt16 nBackgroundID,
+ bool bSearchInParents = true,
+ bool bXMLImportHack = false);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unodraw/SvxTableShape.hxx b/include/svx/unodraw/SvxTableShape.hxx
new file mode 100644
index 000000000..518d3ac2c
--- /dev/null
+++ b/include/svx/unodraw/SvxTableShape.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svxdllapi.h>
+#include <svx/unoshape.hxx>
+
+class SVXCORE_DLLPUBLIC SvxTableShape : public SvxShape
+{
+protected:
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl(const OUString& rName,
+ const SfxItemPropertyMapEntry* pProperty,
+ const css::uno::Any& rValue) override;
+ virtual bool getPropertyValueImpl(const OUString& rName,
+ const SfxItemPropertyMapEntry* pProperty,
+ css::uno::Any& rValue) override;
+
+ virtual void lock() override;
+ virtual void unlock() override;
+
+public:
+ explicit SvxTableShape(SdrObject* pObj);
+ virtual ~SvxTableShape() noexcept override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unofill.hxx b/include/svx/unofill.hxx
new file mode 100644
index 000000000..a59f9c8fb
--- /dev/null
+++ b/include/svx/unofill.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UNOFILL_HXX
+#define INCLUDED_SVX_UNOFILL_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <svx/svxdllapi.h>
+
+class SdrModel;
+
+SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoGradientTable_createInstance( SdrModel* pModel );
+SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoHatchTable_createInstance( SdrModel* pModel );
+SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoBitmapTable_createInstance( SdrModel* pModel );
+SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoTransGradientTable_createInstance( SdrModel* pModel );
+SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoMarkerTable_createInstance( SdrModel* pModel );
+SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoDashTable_createInstance( SdrModel* pModel );
+
+#endif // INCLUDED_SVX_UNOFILL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unomaster.hxx b/include/svx/unomaster.hxx
new file mode 100644
index 000000000..f544d2f8b
--- /dev/null
+++ b/include/svx/unomaster.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UNOMASTER_HXX
+#define INCLUDED_SVX_UNOMASTER_HXX
+
+#include <com/sun/star/uno/Type.h>
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+
+/** this abstract class is the interface for an instance that likes to enhance
+ the functionality of components implemented with derivations from SvxShape
+
+ @see SvxShape::setMaster
+*/
+class SvxShapeMaster
+{
+public:
+ virtual bool queryAggregation( const css::uno::Type & rType, css::uno::Any& aAny ) = 0;
+
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) = 0;
+
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) = 0;
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) = 0;
+
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) = 0;
+
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() = 0;
+
+ virtual void dispose() = 0;
+
+protected:
+ ~SvxShapeMaster() {}
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unomid.hxx b/include/svx/unomid.hxx
new file mode 100644
index 000000000..fe07fee51
--- /dev/null
+++ b/include/svx/unomid.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_UNOMID_HXX
+#define INCLUDED_SVX_UNOMID_HXX
+
+//SvxPageItem
+#define MID_PAGE_NUMTYPE 0
+#define MID_PAGE_ORIENTATION 1
+#define MID_PAGE_LAYOUT 2
+
+//SvxMarginItem
+#define MID_MARGIN_L_MARGIN 2
+#define MID_MARGIN_R_MARGIN 3
+#define MID_MARGIN_UP_MARGIN 4
+#define MID_MARGIN_LO_MARGIN 5
+
+#define ALL_BORDER 10
+#define ALL_BORDER_PADDING 11
+#define LEFT_BORDER_PADDING 12
+#define RIGHT_BORDER_PADDING 13
+#define TOP_BORDER_PADDING 14
+#define BOTTOM_BORDER_PADDING 15
+#define ALL_BORDER_LINE_WIDTH 16
+#define LEFT_BORDER_LINE_WIDTH 17
+#define RIGHT_BORDER_LINE_WIDTH 18
+#define TOP_BORDER_LINE_WIDTH 19
+#define BOTTOM_BORDER_LINE_WIDTH 20
+
+// XFillBitmapItem (is also a NameOrIndex)
+#define MID_BITMAP 8
+
+// SvxObjectItem
+#define MID_START_X 1
+#define MID_START_Y 2
+#define MID_END_X 3
+#define MID_END_Y 4
+#define MID_LIMIT 5
+
+// SvxColumnItem
+#define MID_COLUMNARRAY 7
+#define MID_ACTUAL 4
+#define MID_TABLE 5
+#define MID_ORTHO 6
+
+// XFillGradientItem
+// Don't use 0 as it used for the whole struct
+#define MID_FILLGRADIENT 1
+#define MID_GRADIENT_STYLE 2
+#define MID_GRADIENT_STARTCOLOR 3
+#define MID_GRADIENT_ENDCOLOR 4
+#define MID_GRADIENT_ANGLE 5
+#define MID_GRADIENT_BORDER 6
+#define MID_GRADIENT_XOFFSET 7
+#define MID_GRADIENT_YOFFSET 8
+#define MID_GRADIENT_STARTINTENSITY 9
+#define MID_GRADIENT_ENDINTENSITY 10
+#define MID_GRADIENT_STEPCOUNT 11
+
+// XFillHatchItem
+// Don't use 0 as it used for the whole struct
+#define MID_FILLHATCH 1
+#define MID_HATCH_STYLE 2
+#define MID_HATCH_COLOR 3
+#define MID_HATCH_DISTANCE 4
+#define MID_HATCH_ANGLE 5
+
+// XLineDashItem
+// Don't use 0 as it used for the whole struct
+#define MID_LINEDASH 1
+#define MID_LINEDASH_STYLE 2
+#define MID_LINEDASH_DOTS 3
+#define MID_LINEDASH_DOTLEN 4
+#define MID_LINEDASH_DASHES 5
+#define MID_LINEDASH_DASHLEN 6
+#define MID_LINEDASH_DISTANCE 7
+
+#define MID_LEFT 3
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unomod.hxx b/include/svx/unomod.hxx
new file mode 100644
index 000000000..d786824eb
--- /dev/null
+++ b/include/svx/unomod.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UNOMOD_HXX
+#define INCLUDED_SVX_UNOMOD_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <com/sun/star/document/EventObject.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <svx/svxdllapi.h>
+
+class SdrHint;
+class SdrModel;
+
+SVXCORE_DLLPUBLIC css::uno::Reference< css::container::XIndexReplace > SvxCreateNumRule(SdrModel* pModel);
+
+class SVXCORE_DLLPUBLIC SvxUnoDrawMSFactory : public css::lang::XMultiServiceFactory
+{
+protected:
+ /** abstract SdrModel provider */
+ // Every App has a DrwingLayer as internal Tooling, thus ist is
+ // not too hard to asl a UnoModel to hand back a DrawingLayer Model in the
+ // form of an SdrModel. Thus, returning a reference and make usages
+ // safer and easier is justified.
+ virtual SdrModel& getSdrModelFromUnoModel() const = 0; //TTTT make reference return
+
+public:
+ SvxUnoDrawMSFactory() noexcept {};
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) override;
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const OUString& ServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames( ) override;
+
+ /// @throws css::uno::Exception
+ /// @throws css::uno::RuntimeException
+ static css::uno::Reference< css::uno::XInterface > createTextField( std::u16string_view aServiceSpecifier );
+
+ /** fills the given EventObject from the given SdrHint.
+ @returns
+ true if the SdrHint could be translated to an EventObject<br>
+ false if not
+ */
+ static bool createEvent( const SdrModel* pDoc, const SdrHint* pSdrHint, css::document::EventObject& aEvent );
+
+protected:
+ ~SvxUnoDrawMSFactory() {}
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unomodel.hxx b/include/svx/unomodel.hxx
new file mode 100644
index 000000000..87ccd82b0
--- /dev/null
+++ b/include/svx/unomodel.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UNOMODEL_HXX
+#define INCLUDED_SVX_UNOMODEL_HXX
+
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <sfx2/sfxbasemodel.hxx>
+#include <svx/fmdmod.hxx>
+#include <svx/svxdllapi.h>
+#include <cppuhelper/weakref.hxx>
+
+class SdrModel;
+
+class SVXCORE_DLLPUBLIC SvxUnoDrawingModel
+: public SfxBaseModel, // implements SfxListener, OWEAKOBJECT & other
+ public SvxFmMSFactory,
+ public css::drawing::XDrawPagesSupplier,
+ public css::lang::XServiceInfo,
+ public css::ucb::XAnyCompareFactory
+{
+ friend class SvxUnoDrawPagesAccess;
+
+private:
+ SdrModel* mpDoc;
+
+ css::uno::WeakReference< css::drawing::XDrawPages > mxDrawPagesAccess;
+
+ css::uno::Reference< css::uno::XInterface > mxDashTable;
+ css::uno::Reference< css::uno::XInterface > mxGradientTable;
+ css::uno::Reference< css::uno::XInterface > mxHatchTable;
+ css::uno::Reference< css::uno::XInterface > mxBitmapTable;
+ css::uno::Reference< css::uno::XInterface > mxTransGradientTable;
+ css::uno::Reference< css::uno::XInterface > mxMarkerTable;
+
+ css::uno::Sequence< css::uno::Type > maTypeSequence;
+
+protected:
+ // SvxUnoDrawMSFactory
+ virtual SdrModel& getSdrModelFromUnoModel() const override;
+
+public:
+ SvxUnoDrawingModel( SdrModel* pDoc ) noexcept;
+ virtual ~SvxUnoDrawingModel() noexcept override;
+
+ SdrModel* GetDoc() const { return mpDoc; }
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { SfxBaseModel::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { SfxBaseModel::release(); }
+
+ // XModel
+ virtual void SAL_CALL lockControllers( ) override;
+ virtual void SAL_CALL unlockControllers( ) override;
+ virtual sal_Bool SAL_CALL hasControllersLocked( ) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ // XDrawPagesSupplier
+ virtual css::uno::Reference< css::drawing::XDrawPages > SAL_CALL getDrawPages( ) override;
+
+ // XMultiServiceFactory ( SvxFmMSFactory )
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames( ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XAnyCompareFactory
+ virtual css::uno::Reference< css::ucb::XAnyCompare > SAL_CALL createAnyCompareByName( const OUString& PropertyName ) override;
+};
+
+SVXCORE_DLLPUBLIC extern bool SvxDrawingLayerExport( SdrModel* pModel, const css::uno::Reference<css::io::XOutputStream>& xOut );
+extern bool SvxDrawingLayerExport( SdrModel* pModel, const css::uno::Reference<css::io::XOutputStream>& xOut, const css::uno::Reference< css::lang::XComponent >& xComponent );
+SVXCORE_DLLPUBLIC extern bool SvxDrawingLayerExport( SdrModel* pModel, const css::uno::Reference<css::io::XOutputStream>& xOut, const css::uno::Reference< css::lang::XComponent >& xComponent, const char* pExportService );
+SVXCORE_DLLPUBLIC extern bool SvxDrawingLayerImport( SdrModel* pModel, const css::uno::Reference<css::io::XInputStream>& xInputStream );
+extern bool SvxDrawingLayerImport( SdrModel* pModel, const css::uno::Reference<css::io::XInputStream>& xInputStream, const css::uno::Reference< css::lang::XComponent >& xComponent );
+SVXCORE_DLLPUBLIC extern bool SvxDrawingLayerImport( SdrModel* pModel, const css::uno::Reference<css::io::XInputStream>& xInputStream, const css::uno::Reference< css::lang::XComponent >& xComponent, const char* pImportService );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unopage.hxx b/include/svx/unopage.hxx
new file mode 100644
index 000000000..e69eb7ec8
--- /dev/null
+++ b/include/svx/unopage.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_UNOPAGE_HXX
+#define INCLUDED_SVX_UNOPAGE_HXX
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XShapes2.hpp>
+#include <com/sun/star/drawing/XShapes3.hpp>
+#include <com/sun/star/drawing/XShapeGrouper.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/basemutex.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/svdobjkind.hxx>
+#include <rtl/ref.hxx>
+
+#include <cppuhelper/implbase7.hxx>
+#include <comphelper/servicehelper.hxx>
+
+#include <memory>
+
+class SdrPage;
+class SdrModel;
+class SdrView;
+class SdrPageView;
+class SdrObject;
+class SvxShape;
+class SvxShapeGroup;
+class SvxShapeConnector;
+enum class SdrInventor : sal_uInt32;
+
+class SVXCORE_DLLPUBLIC SvxDrawPage : protected cppu::BaseMutex,
+ public ::cppu::WeakAggImplHelper7< css::drawing::XDrawPage,
+ css::drawing::XShapeGrouper,
+ css::drawing::XShapes2,
+ css::drawing::XShapes3,
+ css::lang::XServiceInfo,
+ css::lang::XUnoTunnel,
+ css::lang::XComponent>
+
+{
+ protected:
+ cppu::OBroadcastHelper mrBHelper;
+
+ SdrPage* mpPage; // TTTT should be reference
+ SdrModel* mpModel; // TTTT probably not needed -> use from SdrPage
+ std::unique_ptr<SdrView> mpView;
+
+ void SelectObjectsInView( const css::uno::Reference< css::drawing::XShapes >& aShapes, SdrPageView* pPageView ) noexcept;
+ void SelectObjectInView( const css::uno::Reference< css::drawing::XShape >& xShape, SdrPageView* pPageView ) noexcept;
+
+ virtual void disposing() noexcept;
+
+ public:
+ SvxDrawPage(SdrPage* pPage);
+ virtual ~SvxDrawPage() noexcept override;
+
+ // Internals
+ SdrPage* GetSdrPage() const { return mpPage; }
+
+ // Creation of a SdrObject and insertion into the SdrPage
+ SdrObject *CreateSdrObject( const css::uno::Reference< css::drawing::XShape >& xShape, bool bBeginning = false ) noexcept;
+
+ // Determine Type and Inventor
+ static void GetTypeAndInventor( SdrObjKind& rType, SdrInventor& rInventor, const OUString& aName ) noexcept;
+
+ // Creating a SdrObject using it's Description.
+ // Can be used by derived classes to support their owen Shapes (e.g. Controls).
+ /// @throws css::uno::RuntimeException
+ virtual SdrObject *CreateSdrObject_( const css::uno::Reference< css::drawing::XShape >& xShape );
+
+ /// @throws css::uno::RuntimeException
+ static rtl::Reference<SvxShape> CreateShapeByTypeAndInventor( SdrObjKind nType, SdrInventor nInventor, SdrObject *pObj, SvxDrawPage *pPage = nullptr, OUString const & referer = OUString() );
+
+ // The following method is called if a SvxShape object is to be created.
+ // Derived classes can create a derivation or an SvxShape aggregating object.
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Reference< css::drawing::XShape > CreateShape( SdrObject *pObj ) const;
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
+
+ // XInterface
+ virtual void SAL_CALL release() noexcept override;
+
+ // XShapes
+ virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
+ virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
+
+ // XShapes2
+ virtual void SAL_CALL addTop( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
+ virtual void SAL_CALL addBottom( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
+
+ // XShapes3
+ virtual void SAL_CALL sort( const css::uno::Sequence< sal_Int32 >& sortOrder ) override;
+
+ // XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType() override;
+ virtual sal_Bool SAL_CALL hasElements() override;
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() override ;
+ virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
+
+ // XShapeGrouper
+ virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override;
+ virtual void SAL_CALL ungroup( const css::uno::Reference< css::drawing::XShapeGroup >& aGroup ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XComponent
+ virtual void SAL_CALL dispose() override;
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unopool.hxx b/include/svx/unopool.hxx
new file mode 100644
index 000000000..96b9bc179
--- /dev/null
+++ b/include/svx/unopool.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UNOPOOL_HXX
+#define INCLUDED_SVX_UNOPOOL_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <comphelper/propertysethelper.hxx>
+#include <cppuhelper/weakagg.hxx>
+#include <svx/svxdllapi.h>
+#include <svl/itempool.hxx>
+
+class SdrModel;
+class SfxItemPool;
+
+/** This class implements the service com.sun.star.drawing.Defaults.
+ It works on the SfxItemPool from the given model and the global
+ draw object item pool.
+ The class can work in a read only mode without a model. Derivated
+ classes can set a model on demand by overriding getModelPool().
+*/
+class SVX_DLLPUBLIC SvxUnoDrawPool : public ::cppu::OWeakAggObject,
+ public css::lang::XServiceInfo,
+ public css::lang::XTypeProvider,
+ public comphelper::PropertySetHelper
+{
+public:
+ SvxUnoDrawPool(SdrModel* pModel, sal_Int32 nServiceId);
+
+ /** deprecated */
+ SvxUnoDrawPool(SdrModel* pModel);
+ virtual ~SvxUnoDrawPool() noexcept override;
+
+ /** This returns the item pool from the given model, or the default pool if there is no model and bReadOnly is true.
+ If bReadOnly is false and there is no model the default implementation returns NULL.
+ */
+ virtual SfxItemPool* getModelPool( bool bReadOnly ) noexcept;
+
+ // overridden helpers from comphelper::PropertySetHelper
+ virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const css::uno::Any* pValues ) override;
+ virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, css::uno::Any* pValue ) override;
+
+ virtual void _getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, css::beans::PropertyState* pStates ) override;
+ virtual void _setPropertyToDefault( const comphelper::PropertyMapEntry* pEntry ) override;
+ virtual css::uno::Any _getPropertyDefault( const comphelper::PropertyMapEntry* pEntry ) override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakAggObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+protected:
+ void init();
+
+ /// @throws css::beans::UnknownPropertyException
+ static void getAny( SfxItemPool const * pPool, const comphelper::PropertyMapEntry* pEntry, css::uno::Any& rValue );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::uno::RuntimeException
+ virtual void putAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, const css::uno::Any& rValue );
+
+protected:
+ SdrModel* mpModel;
+ rtl::Reference<SfxItemPool> mpDefaultsPool;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unoprov.hxx b/include/svx/unoprov.hxx
new file mode 100644
index 000000000..f7ee83979
--- /dev/null
+++ b/include/svx/unoprov.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UNOPROV_HXX
+#define INCLUDED_SVX_UNOPROV_HXX
+
+#include <config_options.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <svl/itemprop.hxx>
+#include <svx/svxdllapi.h>
+#include <editeng/unoipset.hxx>
+#include <rtl/ref.hxx>
+#include <memory>
+#include <optional>
+
+class SvxItemPropertySet;
+class SfxItemPool;
+enum class SdrObjKind : sal_uInt16;
+
+/**
+ * class UHashMap
+ */
+class UHashMap
+{
+ UHashMap() = delete;
+public:
+ static std::optional<SdrObjKind> getId( const OUString& rCompareString );
+ static OUString getNameFromId (SdrObjKind nId);
+ static css::uno::Sequence< OUString > getServiceNames();
+};
+
+/**
+ * Sorter
+ */
+
+#define SVXMAP_SHAPE 0
+#define SVXMAP_CONNECTOR 1
+#define SVXMAP_DIMENSIONING 2
+#define SVXMAP_CIRCLE 3
+#define SVXMAP_POLYPOLYGON 4
+#define SVXMAP_GRAPHICOBJECT 5
+#define SVXMAP_3DSCENEOBJECT 6
+#define SVXMAP_3DCUBEOBJECT 7
+#define SVXMAP_3DSPHEREOBJECT 8
+#define SVXMAP_3DLATHEOBJECT 9
+#define SVXMAP_3DEXTRUDEOBJECT 10
+#define SVXMAP_3DPOLYGONOBJECT 11
+#define SVXMAP_ALL 12
+#define SVXMAP_GROUP 13
+#define SVXMAP_CAPTION 14
+#define SVXMAP_OLE2 15
+#define SVXMAP_PLUGIN 16
+#define SVXMAP_FRAME 17
+#define SVXMAP_APPLET 18
+#define SVXMAP_CONTROL 19
+#define SVXMAP_TEXT 20
+#define SVXMAP_CUSTOMSHAPE 21
+#define SVXMAP_MEDIA 22
+#define SVXMAP_TABLE 23
+#define SVXMAP_PAGE 24
+#define SVXMAP_END 25 // last+1 !
+
+/**
+ * SvxUnoPropertyMapProvider
+ */
+
+class SVXCORE_DLLPUBLIC SvxUnoPropertyMapProvider
+{
+ SfxItemPropertyMapEntry const * aMapArr[SVXMAP_END];
+ std::unique_ptr<SvxItemPropertySet> aSetArr[SVXMAP_END];
+public:
+ SvxUnoPropertyMapProvider();
+ ~SvxUnoPropertyMapProvider();
+ const SfxItemPropertyMapEntry* GetMap(sal_uInt16 nPropertyId);
+ const SvxItemPropertySet* GetPropertySet(sal_uInt16 nPropertyId, SfxItemPool& rPool);
+};
+
+/**
+ * class SvxPropertySetInfoPool
+ */
+
+const sal_Int32 SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS = 0;
+const sal_Int32 SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER = 1;
+const sal_Int32 SVXUNO_SERVICEID_LASTID = 1;
+
+namespace comphelper { class PropertySetInfo; }
+
+class SvxPropertySetInfoPool
+{
+public:
+ UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) static rtl::Reference<comphelper::PropertySetInfo> const & getOrCreate( sal_Int32 nServiceId ) noexcept;
+
+private:
+ static rtl::Reference<comphelper::PropertySetInfo> mxInfos[SVXUNO_SERVICEID_LASTID+1];
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
new file mode 100644
index 000000000..3185d958a
--- /dev/null
+++ b/include/svx/unoshape.hxx
@@ -0,0 +1,871 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UNOSHAPE_HXX
+#define INCLUDED_SVX_UNOSHAPE_HXX
+
+#include <memory>
+#include <com/sun/star/document/XActionLockable.hpp>
+#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
+#include <com/sun/star/drawing/XGluePointsSupplier.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/drawing/PolygonKind.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XShapes2.hpp>
+#include <com/sun/star/drawing/XShapeGroup.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/drawing/XConnectorShape.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <sal/types.h>
+#include <tools/weakbase.hxx>
+#include <svl/lstner.hxx>
+#include <editeng/unoipset.hxx>
+#include <svx/svxdllapi.h>
+#include <rtl/ref.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <editeng/unotext.hxx>
+
+#include <svx/svdobj.hxx>
+
+#include <comphelper/servicehelper.hxx>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/implbase12.hxx>
+
+class SfxItemSet;
+class SdrModel;
+class SvxDrawPage;
+class SvGlobalName;
+class Pair;
+
+// Dimension arrows change size/position on save/reload (#i59051#)
+namespace basegfx
+ {
+ class B2DPolyPolygon;
+ } // end of namespace basegfx
+
+struct SvxShapeImpl;
+class SvxShapeMaster;
+class SvxItemPropertySet;
+class SfxItemSet;
+
+void SVXCORE_DLLPUBLIC SvxItemPropertySet_setPropertyValue( const SfxItemPropertyMapEntry* pMap,
+ const css::uno::Any& rVal, SfxItemSet& rSet );
+
+css::uno::Any SVXCORE_DLLPUBLIC SvxItemPropertySet_getPropertyValue( const SfxItemPropertyMapEntry* pMap, const SfxItemSet& rSet );
+
+
+// WARNING: if you update the supported interfaces,
+// also update SvxShape::_getTypes()
+typedef ::cppu::WeakAggImplHelper12<
+ css::drawing::XShape,
+ css::lang::XComponent,
+ css::beans::XPropertySet,
+ css::beans::XMultiPropertySet,
+ css::beans::XPropertyState,
+ css::lang::XUnoTunnel,
+ css::container::XNamed,
+ css::drawing::XGluePointsSupplier,
+ css::container::XChild,
+ css::lang::XServiceInfo,
+ css::document::XActionLockable,
+ css::beans::XMultiPropertyStates> SvxShape_UnoImplHelper;
+
+class SVXCORE_DLLPUBLIC SvxShape :
+ public cppu::BaseMutex,
+ public SvxShape_UnoImplHelper,
+ public SfxListener
+{
+private:
+ css::awt::Size maSize;
+ css::awt::Point maPosition;
+ OUString maShapeType;
+ OUString maShapeName;
+
+ /** these members are used to optimize XMultiProperty calls */
+ std::unique_ptr<SvxShapeImpl> mpImpl;
+ bool mbIsMultiPropertyCall;
+
+ css::uno::WeakReference< css::container::XIndexContainer > mxGluePoints;
+
+protected:
+ friend class SvxDrawPage;
+ friend class SvxShapeConnector;
+ friend class SdXShape;
+
+ const SvxItemPropertySet* mpPropSet;
+ SvxItemPropertySetUsrAnys maUrsAnys;
+ const SfxItemPropertyMapEntry* maPropMapEntries;
+
+private:
+ ::tools::WeakReference< SdrObject > mpSdrObjectWeakReference;
+
+protected:
+ // translations for writer, which works in TWIPS
+ void ForceMetricToItemPoolMetric(Pair& rPoint) const noexcept;
+ void ForceMetricToItemPoolMetric(Point& rPoint) const noexcept { ForceMetricToItemPoolMetric(rPoint.toPair()); }
+ void ForceMetricToItemPoolMetric(Size& rPoint) const noexcept { ForceMetricToItemPoolMetric(rPoint.toPair()); }
+ void ForceMetricTo100th_mm(Pair& rPoint) const noexcept;
+ void ForceMetricTo100th_mm(Point& rPoint) const noexcept { ForceMetricTo100th_mm(rPoint.toPair()); }
+ void ForceMetricTo100th_mm(Size& rPoint) const noexcept { ForceMetricTo100th_mm(rPoint.toPair()); }
+
+ // version for basegfx::B2DPolyPolygon
+ void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept;
+ void ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept;
+
+ // tdf#117145 version for basegfx::B2DHomMatrix
+ void ForceMetricToItemPoolMetric(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept;
+ void ForceMetricTo100th_mm(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept;
+
+ css::uno::Any GetAnyForItem( SfxItemSet const & aSet, const SfxItemPropertyMapEntry* pMap ) const;
+
+ bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName );
+
+ /** called from the XActionLockable interface methods on initial locking */
+ virtual void lock();
+
+ /** called from the XActionLockable interface methods on final unlock */
+ virtual void unlock();
+
+ /** used from the XActionLockable interface */
+ sal_uInt16 mnLockCount;
+
+ const SfxItemPropertyMapEntry* getPropertyMapEntries() const { return maPropMapEntries; }
+
+ void updateShapeKind();
+ void endSetPropertyValues();
+
+ // override these for special property handling in subcasses. Return true if property is handled
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ virtual bool getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ virtual bool setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty );
+
+public:
+ /// @throws css::uno::RuntimeException
+ SvxShape( SdrObject* pObj );
+ /// @throws css::uno::RuntimeException
+ SvxShape( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries, const SvxItemPropertySet* pPropertySet );
+ virtual ~SvxShape() noexcept override;
+
+ // Internals
+ void ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet);
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage );
+ /** takes the ownership of the SdrObject.
+
+ When the shape is disposed, and it has the ownership of its associated SdrObject, then
+ it will delete this object.
+ */
+ void TakeSdrObjectOwnership();
+ bool HasSdrObjectOwnership() const;
+
+ // used exclusively by SdrObject
+ void InvalidateSdrObject();
+
+ // Encapsulated access to SdrObject
+ SdrObject* GetSdrObject() const { return mpSdrObjectWeakReference.get(); }
+ bool HasSdrObject() const { return mpSdrObjectWeakReference.is(); }
+
+ void SetShapeType( const OUString& ShapeType ) { maShapeType = ShapeType; }
+ /// @throws css::uno::RuntimeException
+ css::uno::Any GetBitmap( bool bMetaFile = false ) const;
+
+ svx::PropertyChangeNotifier& getShapePropertyChangeNotifier();
+
+ void setShapeKind( SdrObjKind nKind );
+ SdrObjKind getShapeKind() const;
+
+ // styles need this
+ static bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet, SdrModel const * pModel );
+ static bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet );
+
+ /** same as SetFillAttribute but for property names instead of which ids,
+ and the property found is returned instead of set at the object
+ directly.
+ */
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxShape )
+
+ // access methods for master objects
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::beans::XPropertySetInfo > const & _getPropertySetInfo( );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::beans::PropertyVetoException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ void _setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ css::uno::Any _getPropertyValue( const OUString& PropertyName );
+
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ css::beans::PropertyState _getPropertyState( const OUString& PropertyName );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::uno::RuntimeException
+ void _setPropertyToDefault( const OUString& PropertyName );
+ /// @throws css::beans::UnknownPropertyException
+ /// @throws css::lang::WrappedTargetException
+ /// @throws css::uno::RuntimeException
+ css::uno::Any _getPropertyDefault( const OUString& aPropertyName );
+
+ /// @throws css::uno::RuntimeException
+ css::uno::Sequence< OUString > _getSupportedServiceNames();
+
+ /// @throws css::uno::RuntimeException
+ css::uno::Sequence< css::uno::Type > const & _getTypes( );
+
+ void setMaster( SvxShapeMaster* pMaster );
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) noexcept override;
+
+ // XAggregation
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) override;
+ virtual void SAL_CALL setName( const OUString& aName ) override;
+
+ // XShapeDescriptor
+ virtual OUString SAL_CALL getShapeType() override;
+
+ // XShape
+ virtual css::awt::Point SAL_CALL getPosition() override;
+ virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
+ virtual css::awt::Size SAL_CALL getSize() override;
+ virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
+
+ // XComponent
+ virtual void SAL_CALL dispose() override;
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
+ virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+ virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+ virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
+
+ // XPropertyState
+ virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
+ virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
+ virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
+
+ // XMultiPropertyStates
+ virtual void SAL_CALL setAllPropertiesToDefault() override;
+ virtual void SAL_CALL setPropertiesToDefault(
+ const css::uno::Sequence<
+ OUString >& aPropertyNames ) override;
+ virtual css::uno::Sequence< css::uno::Any >
+ SAL_CALL getPropertyDefaults(
+ const css::uno::Sequence<
+ OUString >& aPropertyNames ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+
+ // XGluePointsSupplier
+ virtual css::uno::Reference< css::container::XIndexContainer > SAL_CALL getGluePoints( ) override;
+
+ // XChild
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
+ virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ // XActionLockable
+ virtual sal_Bool SAL_CALL isActionLocked( ) override;
+ virtual void SAL_CALL addActionLock( ) override;
+ virtual void SAL_CALL removeActionLock( ) override;
+ virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) override;
+ virtual sal_Int16 SAL_CALL resetActionLocks( ) override;
+
+private:
+ /** initializes SdrObj-dependent members. Only to be called when GetSdrObject() != NULL
+ */
+ SVX_DLLPRIVATE void impl_initFromSdrObject();
+ /// CTOR-Impl
+ SVX_DLLPRIVATE void impl_construct();
+};
+
+class SVXCORE_DLLPUBLIC SvxShapeText : public SvxShape, public SvxUnoTextBase
+{
+protected:
+ /** called from the XActionLockable interface methods on initial locking */
+ virtual void lock() override;
+
+ /** called from the XActionLockable interface methods on final unlock */
+ virtual void unlock() override;
+
+protected:
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
+ virtual bool getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState ) override;
+ virtual bool setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty ) override;
+
+public:
+ SvxShapeText(SdrObject* pObj);
+ SvxShapeText(SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet);
+ virtual ~SvxShapeText() noexcept override;
+
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { SvxShape::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { SvxShape::release(); }
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+
+ // css::text::XTextRange
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
+ virtual OUString SAL_CALL getString() override;
+ virtual void SAL_CALL setString( const OUString& aString ) override;
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+};
+
+class SAL_DLLPUBLIC_RTTI SvxShapeRect final : public SvxShapeText
+{
+public:
+ SVXCORE_DLLPUBLIC SvxShapeRect(SdrObject* pObj);
+ virtual ~SvxShapeRect() noexcept override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakAggObject::release(); }
+
+ // XServiceInfo
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+};
+
+/// This only exists so I have a common base class for SvxShapeGroup and Svx3DSceneObject
+class SVXCORE_DLLPUBLIC SvxShapeGroupAnyD : public SvxShape,
+ public css::drawing::XShapes
+{
+public:
+ SvxShapeGroupAnyD( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries, const SvxItemPropertySet* pPropertySet );
+ virtual ~SvxShapeGroupAnyD() noexcept override;
+
+ virtual void SAL_CALL acquire() noexcept override
+ { SvxShape::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { SvxShape::release(); }
+
+ virtual void addShape(SvxShape& rShape) = 0;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SVXCORE_DLLPUBLIC SvxShapeGroup final : public SvxShapeGroupAnyD,
+ public css::drawing::XShapeGroup,
+ public css::drawing::XShapes2
+{
+private:
+ rtl::Reference< SvxDrawPage> mxPage;
+
+ void addUnoShape( const css::uno::Reference< css::drawing::XShape >& xShape, size_t nPos );
+ void addShape(SvxShape& rShape, size_t nPos);
+
+public:
+ SvxShapeGroup(SdrObject* pObj,SvxDrawPage* pDrawPage);
+ virtual ~SvxShapeGroup() noexcept override;
+
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { SvxShape::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { SvxShape::release(); }
+
+ // XShapes
+ virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
+ virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
+
+ // XShapes2
+ virtual void SAL_CALL addTop( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
+ virtual void SAL_CALL addBottom( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
+
+ // XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType() override;
+ virtual sal_Bool SAL_CALL hasElements() override;
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() override ;
+ virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
+
+ // XShapeDescriptor
+ virtual OUString SAL_CALL getShapeType() override;
+
+ // XShape
+ virtual css::awt::Point SAL_CALL getPosition() override;
+ virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
+ virtual css::awt::Size SAL_CALL getSize() override;
+ virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
+
+ // XShapeGroup
+ virtual void SAL_CALL enterGroup( ) override;
+ virtual void SAL_CALL leaveGroup( ) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ virtual void addShape(SvxShape& rShape) final override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SvxShapeConnector final : public css::drawing::XConnectorShape,
+ public SvxShapeText
+{
+public:
+ SvxShapeConnector(SdrObject* pObj);
+ virtual ~SvxShapeConnector() noexcept override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { SvxShapeText::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { SvxShapeText::release(); }
+
+ // XShapeDescriptor
+ virtual OUString SAL_CALL getShapeType() override;
+
+ // XShape
+ virtual css::awt::Point SAL_CALL getPosition() override;
+ virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
+ virtual css::awt::Size SAL_CALL getSize() override;
+ virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
+
+ // XConnectorShape
+ virtual void SAL_CALL connectStart( const css::uno::Reference< css::drawing::XConnectableShape >& xShape, css::drawing::ConnectionType nPos ) override;
+ virtual void SAL_CALL connectEnd( const css::uno::Reference< css::drawing::XConnectableShape >& xShape, css::drawing::ConnectionType nPos ) override;
+ virtual void SAL_CALL disconnectBegin( const css::uno::Reference< css::drawing::XConnectableShape >& xShape ) override;
+ virtual void SAL_CALL disconnectEnd( const css::uno::Reference< css::drawing::XConnectableShape >& xShape ) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SVXCORE_DLLPUBLIC SvxShapeControl final : public css::drawing::XControlShape, public SvxShapeText
+{
+protected:
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+public:
+ SvxShapeControl(SdrObject* pObj);
+ virtual ~SvxShapeControl() noexcept override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { SvxShapeText::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { SvxShapeText::release(); }
+
+ // XPropertySet
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
+
+ // XPropertyState
+ virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
+ virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
+
+ // XShapeDescriptor
+ virtual OUString SAL_CALL getShapeType() override;
+
+ // XShape
+ virtual css::awt::Point SAL_CALL getPosition() override;
+ virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
+ virtual css::awt::Size SAL_CALL getSize() override;
+ virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
+
+ // XControlShape
+ virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getControl() override;
+ virtual void SAL_CALL setControl( const css::uno::Reference< css::awt::XControlModel >& xControl ) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SvxShapeDimensioning final : public SvxShapeText
+{
+public:
+ SvxShapeDimensioning(SdrObject* pObj);
+ virtual ~SvxShapeDimensioning() noexcept override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SvxShapeCircle final : public SvxShapeText
+{
+public:
+ SVXCORE_DLLPUBLIC SvxShapeCircle(SdrObject* pObj);
+ virtual ~SvxShapeCircle() noexcept override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+// #i118485# changed parent to SvxShapeText to allow Text handling over UNO API
+class SVXCORE_DLLPUBLIC SvxOle2Shape : public SvxShapeText
+{
+protected:
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
+
+ void resetModifiedState();
+
+ SvGlobalName GetClassName_Impl(OUString& rHexCLSID);
+public:
+ SvxOle2Shape(SdrObject* pObj);
+ SvxOle2Shape(SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet);
+ virtual ~SvxOle2Shape() noexcept override;
+
+ bool createObject( const SvGlobalName &aClassName );
+
+ void createLink( const OUString& aLinkURL );
+
+ virtual OUString GetAndClearInitialFrameURL();
+};
+
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SAL_DLLPUBLIC_RTTI SvxShapePolyPolygon final : public SvxShapeText
+{
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
+
+ // local helper to detect PolygonKind from SdrObject::GetObjIdentifier()
+ css::drawing::PolygonKind GetPolygonKind() const;
+
+public:
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::beans::PropertyVetoException
+ SVXCORE_DLLPUBLIC SvxShapePolyPolygon( SdrObject* pObj );
+ virtual ~SvxShapePolyPolygon() noexcept override;
+
+ // Local support functions
+ /// @throws css::uno::RuntimeException
+ void SetPolygon(const basegfx::B2DPolyPolygon& rNew);
+ basegfx::B2DPolyPolygon GetPolygon() const noexcept;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SvxGraphicObject final : public SvxShapeText
+{
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
+
+public:
+ SVXCORE_DLLPUBLIC SvxGraphicObject(SdrObject* pObj);
+ virtual ~SvxGraphicObject() noexcept override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SAL_DLLPUBLIC_RTTI Svx3DSceneObject final : public SvxShapeGroupAnyD
+{
+private:
+ rtl::Reference< SvxDrawPage > mxPage;
+
+protected:
+ using SvxShape::setPropertyValue;
+ using SvxShape::getPropertyValue;
+
+public:
+ SVXCORE_DLLPUBLIC Svx3DSceneObject(SdrObject* pObj, SvxDrawPage* pDrawPage);
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
+ virtual bool getPropertyValueImpl(const OUString& rName, const SfxItemPropertyMapEntry* pProperty,
+ css::uno::Any& rValue ) override;
+
+ virtual ~Svx3DSceneObject() noexcept override;
+
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { SvxShape::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { SvxShape::release(); }
+
+ // XShapes
+ virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
+ virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
+
+ // XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType( ) override;
+ virtual sal_Bool SAL_CALL hasElements( ) override;
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) override ;
+ virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
+
+ // XServiceInfo
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ virtual void addShape(SvxShape& rShape) override final;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class Svx3DCubeObject final : public SvxShape
+{
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
+
+public:
+ Svx3DCubeObject(SdrObject* pObj);
+ virtual ~Svx3DCubeObject() noexcept override;
+
+ // XServiceInfo
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class Svx3DSphereObject final : public SvxShape
+{
+public:
+ Svx3DSphereObject(SdrObject* pObj);
+private:
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
+
+ virtual ~Svx3DSphereObject() noexcept override;
+
+ // XServiceInfo
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class Svx3DLatheObject final : public SvxShape
+{
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
+
+public:
+ SVXCORE_DLLPUBLIC Svx3DLatheObject(SdrObject* pObj);
+ virtual ~Svx3DLatheObject() noexcept override;
+
+ // XServiceInfo
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class Svx3DExtrudeObject final : public SvxShape
+{
+public:
+ SVXCORE_DLLPUBLIC Svx3DExtrudeObject(SdrObject* pObj);
+private:
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
+
+ virtual ~Svx3DExtrudeObject() noexcept override;
+
+ // XServiceInfo
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class Svx3DPolygonObject final : public SvxShape
+{
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
+
+public:
+ SVXCORE_DLLPUBLIC Svx3DPolygonObject(SdrObject* pObj);
+ virtual ~Svx3DPolygonObject() noexcept override;
+
+ // XServiceInfo
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SVXCORE_DLLPUBLIC SvxCustomShape final : public SvxShapeText, public css::drawing::XEnhancedCustomShapeDefaulter
+{
+protected:
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+public:
+ SvxCustomShape(SdrObject* pObj);
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
+
+
+ virtual ~SvxCustomShape() noexcept override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { SvxShapeText::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { SvxShapeText::release(); }
+
+ // XShape
+ virtual css::awt::Point SAL_CALL getPosition() override;
+
+ // XPropertySet
+ void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ //XEnhancedCustomShapeDefaulter
+ virtual void SAL_CALL createCustomShapeDefaults( const OUString& rShapeType ) override;
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SvxMediaShape final : public SvxShape
+{
+public:
+ SvxMediaShape(SdrObject* pObj, OUString const & referer);
+ virtual ~SvxMediaShape() noexcept override;
+
+private:
+ // override these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
+ virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
+ bool getPropertyStateImpl(const SfxItemPropertyMapEntry* pProperty,
+ css::beans::PropertyState& rState) override;
+
+ OUString referer_;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
new file mode 100644
index 000000000..b32b8672c
--- /dev/null
+++ b/include/svx/unoshprp.hxx
@@ -0,0 +1,577 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UNOSHPRP_HXX
+#define INCLUDED_SVX_UNOSHPRP_HXX
+
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/drawing/RectanglePoint.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/drawing/TextAnimationDirection.hpp>
+#include <com/sun/star/drawing/TextAnimationKind.hpp>
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/ConnectorType.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/MeasureKind.hpp>
+#include <com/sun/star/drawing/MeasureTextHorzPos.hpp>
+#include <com/sun/star/drawing/MeasureTextVertPos.hpp>
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/drawing/PolygonKind.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/ColorMode.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/TextureKind.hpp>
+#include <com/sun/star/drawing/TextureMode.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
+#include <com/sun/star/text/XTextColumns.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/drawing/BarCode.hpp>
+
+#include <editeng/unoprnms.hxx>
+#include <svx/svddef.hxx>
+#include <svx/unomid.hxx>
+#include <editeng/unotext.hxx>
+
+#include <editeng/memberids.h>
+#include <svl/solar.hrc>
+
+#define OWN_ATTR_VALUE_START_TEXT (OWN_ATTR_VALUE_START+0) // the next 10 entries are reserved for text
+#define OWN_ATTR_VALUE_POLYGONKIND (OWN_ATTR_VALUE_START+10)
+#define OWN_ATTR_VALUE_POLYPOLYGON (OWN_ATTR_VALUE_START+11)
+#define OWN_ATTR_VALUE_POLYPOLYGONBEZIER (OWN_ATTR_VALUE_START+12)
+#define OWN_ATTR_VALUE_FILLBITMAP (OWN_ATTR_VALUE_START+13)
+#define OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX (OWN_ATTR_VALUE_START+14)
+#define OWN_ATTR_3D_VALUE_POSITION (OWN_ATTR_VALUE_START+15)
+#define OWN_ATTR_3D_VALUE_SIZE (OWN_ATTR_VALUE_START+16)
+#define OWN_ATTR_3D_VALUE_POS_IS_CENTER (OWN_ATTR_VALUE_START+17)
+#define OWN_ATTR_3D_VALUE_POLYPOLYGON3D (OWN_ATTR_VALUE_START+18)
+#define OWN_ATTR_3D_VALUE_LINEONLY (OWN_ATTR_VALUE_START+19)
+#define OWN_ATTR_BITMAP (OWN_ATTR_VALUE_START+20)
+#define OWN_ATTR_EDGE_START_OBJ (OWN_ATTR_VALUE_START+21)
+#define OWN_ATTR_EDGE_START_POS (OWN_ATTR_VALUE_START+22)
+#define OWN_ATTR_EDGE_END_OBJ (OWN_ATTR_VALUE_START+23)
+#define OWN_ATTR_EDGE_END_POS (OWN_ATTR_VALUE_START+24)
+#define OWN_ATTR_FRAMERECT (OWN_ATTR_VALUE_START+25)
+#define OWN_ATTR_VALUE_POLYGON (OWN_ATTR_VALUE_START+26)
+#define OWN_ATTR_METAFILE (OWN_ATTR_VALUE_START+27)
+#define OWN_ATTR_ISFONTWORK (OWN_ATTR_VALUE_START+28)
+#define OWN_ATTR_BOUNDRECT (OWN_ATTR_VALUE_START+29)
+#define OWN_ATTR_LDNAME (OWN_ATTR_VALUE_START+30)
+#define OWN_ATTR_LDBITMAP (OWN_ATTR_VALUE_START+31)
+#define OWN_ATTR_OLESIZE (OWN_ATTR_VALUE_START+32)
+#define OWN_ATTR_GRAPHIC_URL (OWN_ATTR_VALUE_START+33)
+#define OWN_ATTR_OLEMODEL (OWN_ATTR_VALUE_START+34)
+#define OWN_ATTR_MIRRORED (OWN_ATTR_VALUE_START+35)
+#define OWN_ATTR_CLSID (OWN_ATTR_VALUE_START+36)
+#define OWN_ATTR_GLUEID_TAIL (OWN_ATTR_VALUE_START+37)
+#define OWN_ATTR_GLUEID_HEAD (OWN_ATTR_VALUE_START+38)
+#define OWN_ATTR_ZORDER (OWN_ATTR_VALUE_START+39)
+#define OWN_ATTR_MEASURE_START_POS (OWN_ATTR_VALUE_START+40)
+#define OWN_ATTR_MEASURE_END_POS (OWN_ATTR_VALUE_START+41)
+#define OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY (OWN_ATTR_VALUE_START+42)
+#define OWN_ATTR_WRITINGMODE (OWN_ATTR_VALUE_START+43)
+#define OWN_ATTR_GRAFSTREAMURL (OWN_ATTR_VALUE_START+44)
+#define OWN_ATTR_FILLBMP_MODE (OWN_ATTR_VALUE_START+45)
+#define OWN_ATTR_TRANSFORMATION (OWN_ATTR_VALUE_START+46)
+#define OWN_ATTR_BASE_GEOMETRY (OWN_ATTR_VALUE_START+47)
+
+/// reuse attr slots for GraphicObject which will never be used together with graphic object
+#define OWN_ATTR_REPLACEMENT_GRAPHIC (OWN_ATTR_VALUE_START+14)
+
+#define OWN_ATTR_APPLET_DOCBASE (OWN_ATTR_VALUE_START+48)
+#define OWN_ATTR_APPLET_CODEBASE (OWN_ATTR_VALUE_START+49)
+#define OWN_ATTR_APPLET_NAME (OWN_ATTR_VALUE_START+50)
+#define OWN_ATTR_APPLET_CODE (OWN_ATTR_VALUE_START+51)
+#define OWN_ATTR_APPLET_COMMANDS (OWN_ATTR_VALUE_START+52)
+#define OWN_ATTR_APPLET_ISSCRIPT (OWN_ATTR_VALUE_START+53)
+#define OWN_ATTR_PLUGIN_MIMETYPE (OWN_ATTR_VALUE_START+54)
+#define OWN_ATTR_PLUGIN_URL (OWN_ATTR_VALUE_START+55)
+#define OWN_ATTR_PLUGIN_COMMANDS (OWN_ATTR_VALUE_START+56)
+#define OWN_ATTR_FRAME_URL (OWN_ATTR_VALUE_START+57)
+#define OWN_ATTR_FRAME_NAME (OWN_ATTR_VALUE_START+58)
+#define OWN_ATTR_FRAME_ISAUTOSCROLL (OWN_ATTR_VALUE_START+59)
+#define OWN_ATTR_FRAME_ISBORDER (OWN_ATTR_VALUE_START+60)
+#define OWN_ATTR_FRAME_MARGIN_WIDTH (OWN_ATTR_VALUE_START+61)
+#define OWN_ATTR_FRAME_MARGIN_HEIGHT (OWN_ATTR_VALUE_START+62)
+
+// reuse own attr from ole shapes for tables
+#define OWN_ATTR_TABLETEMPLATE (OWN_ATTR_VALUE_START+48)
+#define OWN_ATTR_TABLETEMPLATE_FIRSTROW (OWN_ATTR_VALUE_START+49)
+#define OWN_ATTR_TABLETEMPLATE_LASTROW (OWN_ATTR_VALUE_START+50)
+#define OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN (OWN_ATTR_VALUE_START+51)
+#define OWN_ATTR_TABLETEMPLATE_LASTCOLUMN (OWN_ATTR_VALUE_START+52)
+#define OWN_ATTR_TABLETEMPLATE_BANDINGROWS (OWN_ATTR_VALUE_START+53)
+#define OWN_ATTR_TABLETEMPLATE_BANDINGCOLUMNS (OWN_ATTR_VALUE_START+54)
+#define OWN_ATTR_TABLEBORDER (OWN_ATTR_VALUE_START+55)
+
+#define OWN_ATTR_OLE_VISAREA (OWN_ATTR_VALUE_START+63)
+#define OWN_ATTR_CAPTION_POINT (OWN_ATTR_VALUE_START+64)
+#define OWN_ATTR_PAGE_NUMBER (OWN_ATTR_VALUE_START+65)
+#define OWN_ATTR_THUMBNAIL (OWN_ATTR_VALUE_START+66)
+#define OWN_ATTR_PERSISTNAME (OWN_ATTR_VALUE_START+67)
+#define OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT (OWN_ATTR_VALUE_START+68)
+#define OWN_ATTR_MEDIA_URL (OWN_ATTR_VALUE_START+69)
+#define OWN_ATTR_MEDIA_PREFERREDSIZE (OWN_ATTR_VALUE_START+70)
+#define OWN_ATTR_MEDIA_LOOP (OWN_ATTR_VALUE_START+71)
+#define OWN_ATTR_MEDIA_MUTE (OWN_ATTR_VALUE_START+72)
+#define OWN_ATTR_MEDIA_VOLUMEDB (OWN_ATTR_VALUE_START+73)
+#define OWN_ATTR_MEDIA_ZOOM (OWN_ATTR_VALUE_START+74)
+#define OWN_ATTR_UINAME_SINGULAR (OWN_ATTR_VALUE_START+75)
+#define OWN_ATTR_UINAME_PLURAL (OWN_ATTR_VALUE_START+76)
+#define OWN_ATTR_VALUE_GRAPHIC (OWN_ATTR_VALUE_START+77)
+#define OWN_ATTR_INTERNAL_OLE (OWN_ATTR_VALUE_START+78)
+#define OWN_ATTR_OLE_EMBEDDED_OBJECT (OWN_ATTR_VALUE_START+79)
+#define OWN_ATTR_OLE_ASPECT (OWN_ATTR_VALUE_START+80)
+
+// #i68101#
+#define OWN_ATTR_MISC_OBJ_TITLE (OWN_ATTR_VALUE_START+81)
+#define OWN_ATTR_MISC_OBJ_DESCRIPTION (OWN_ATTR_VALUE_START+82)
+
+#define OWN_ATTR_GRAPHIC_STREAM (OWN_ATTR_VALUE_START+83)
+#define OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D (OWN_ATTR_VALUE_START+84)
+#define OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D (OWN_ATTR_VALUE_START+85)
+
+#define OWN_ATTR_OLE_LINKURL (OWN_ATTR_VALUE_START+86)
+
+#define OWN_ATTR_STYLE (OWN_ATTR_VALUE_START+87)
+
+#define OWN_ATTR_EDGE_POLYPOLYGONBEZIER (OWN_ATTR_VALUE_START+88)
+
+#define OWN_ATTR_MEDIA_STREAM (OWN_ATTR_VALUE_START+89)
+#define OWN_ATTR_MEDIA_TEMPFILEURL (OWN_ATTR_VALUE_START+90)
+#define OWN_ATTR_INTEROPGRABBAG (OWN_ATTR_VALUE_START+91)
+#define OWN_ATTR_MEDIA_MIMETYPE (OWN_ATTR_VALUE_START+92)
+#define OWN_ATTR_FALLBACK_GRAPHIC (OWN_ATTR_VALUE_START+93)
+#define OWN_ATTR_IS_SIGNATURELINE (OWN_ATTR_VALUE_START+94)
+#define OWN_ATTR_SIGNATURELINE_ID (OWN_ATTR_VALUE_START+95)
+#define OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_NAME (OWN_ATTR_VALUE_START+96)
+#define OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_TITLE (OWN_ATTR_VALUE_START+97)
+#define OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL (OWN_ATTR_VALUE_START+98)
+#define OWN_ATTR_SIGNATURELINE_SIGNING_INSTRUCTIONS (OWN_ATTR_VALUE_START+99)
+#define OWN_ATTR_SIGNATURELINE_SHOW_SIGN_DATE (OWN_ATTR_VALUE_START+100)
+#define OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT (OWN_ATTR_VALUE_START+101)
+#define OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE (OWN_ATTR_VALUE_START+102)
+#define OWN_ATTR_SIGNATURELINE_IS_SIGNED (OWN_ATTR_VALUE_START+103)
+#define OWN_ATTR_QRCODE (OWN_ATTR_VALUE_START+104)
+#define OWN_ATTR_TEXTFITTOSIZESCALE (OWN_ATTR_VALUE_START+105)
+#define OWN_ATTR_TEXTCOLUMNS (OWN_ATTR_VALUE_START+106)
+#define OWN_ATTR_HYPERLINK (OWN_ATTR_VALUE_START+107)
+// ATTENTION: current maximum is OWN_ATTR_VALUE_START+107 svx; wnen adding values, update
+// OWN_ATTR_VALUE_END in include/svl/solar.hrc accordingly
+
+// #FontWork#
+#define FONTWORK_PROPERTIES \
+ { u"FontWorkStyle", XATTR_FORMTXTSTYLE, /*ENUM*/::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { u"FontWorkAdjust", XATTR_FORMTXTADJUST, /*ENUM*/::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { u"FontWorkDistance", XATTR_FORMTXTDISTANCE, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { u"FontWorkStart", XATTR_FORMTXTSTART, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { u"FontWorkMirror", XATTR_FORMTXTMIRROR, cppu::UnoType<bool>::get(), 0, 0}, \
+ { u"FontWorkOutline", XATTR_FORMTXTOUTLINE, cppu::UnoType<bool>::get(), 0, 0}, \
+ { u"FontWorkShadow", XATTR_FORMTXTSHADOW, /*ENUM*/::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { u"FontWorkShadowColor", XATTR_FORMTXTSHDWCOLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { u"FontWorkShadowOffsetX", XATTR_FORMTXTSHDWXVAL, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { u"FontWorkShadowOffsetY", XATTR_FORMTXTSHDWYVAL, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { u"FontWorkHideForm", XATTR_FORMTXTHIDEFORM, cppu::UnoType<bool>::get(), 0, 0}, \
+ { u"FontWorkShadowTransparence",XATTR_FORMTXTSHDWTRANSP, ::cppu::UnoType<sal_Int16>::get(), 0, 0},
+
+#define GLOW_PROPERTIES \
+ { u"GlowEffectRadius", SDRATTR_GLOW_RADIUS, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { u"GlowEffectColor", SDRATTR_GLOW_COLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { u"GlowEffectTransparency", SDRATTR_GLOW_TRANSPARENCY,::cppu::UnoType<sal_Int16>::get(), 0, 0 },
+
+#define SOFTEDGE_PROPERTIES \
+ { u"SoftEdgeRadius", SDRATTR_SOFTEDGE_RADIUS, cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM},
+
+#define SHADOW_PROPERTIES \
+ { UNO_NAME_SHADOW, SDRATTR_SHADOW, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_SHADOWCOLOR, SDRATTR_SHADOWCOLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_SHADOWTRANSPARENCE,SDRATTR_SHADOWTRANSPARENCE, ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_SHADOWXDIST, SDRATTR_SHADOWXDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_SHADOWYDIST, SDRATTR_SHADOWYDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_SHADOWSIZEX, SDRATTR_SHADOWSIZEX, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_SHADOWSIZEY, SDRATTR_SHADOWSIZEY, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_SHADOWBLUR, SDRATTR_SHADOWBLUR, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM},
+
+
+#define LINE_PROPERTIES_DEFAULTS\
+ { UNO_NAME_LINECAP, XATTR_LINECAP, ::cppu::UnoType<css::drawing::LineCap>::get(), 0, 0}, \
+ { UNO_NAME_LINECOLOR, XATTR_LINECOLOR, ::cppu::UnoType<sal_Int32>::get() , 0, 0}, \
+ { UNO_NAME_LINEENDCENTER, XATTR_LINEENDCENTER, cppu::UnoType<bool>::get() , 0, 0}, \
+ { UNO_NAME_LINEENDWIDTH, XATTR_LINEENDWIDTH, ::cppu::UnoType<sal_Int32>::get() , 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_LINEJOINT, XATTR_LINEJOINT, ::cppu::UnoType<css::drawing::LineJoint>::get(), 0, 0}, \
+ { UNO_NAME_LINESTARTCENTER, XATTR_LINESTARTCENTER, cppu::UnoType<bool>::get() , 0, 0}, \
+ { UNO_NAME_LINESTARTWIDTH, XATTR_LINESTARTWIDTH, ::cppu::UnoType<sal_Int32>::get() , 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_LINESTYLE, XATTR_LINESTYLE, cppu::UnoType<css::drawing::LineStyle>::get() , 0, 0}, \
+ { UNO_NAME_LINETRANSPARENCE, XATTR_LINETRANSPARENCE, ::cppu::UnoType<sal_Int16>::get() , 0, 0}, \
+ { UNO_NAME_LINEWIDTH, XATTR_LINEWIDTH, ::cppu::UnoType<sal_Int32>::get() , 0, 0, PropertyMoreFlags::METRIC_ITEM},
+
+#define LINE_PROPERTIES \
+ { UNO_NAME_LINEDASH, XATTR_LINEDASH, ::cppu::UnoType<css::drawing::LineDash>::get() , 0, MID_LINEDASH}, \
+ { u"LineDashName", XATTR_LINEDASH, ::cppu::UnoType<OUString>::get() , 0, MID_NAME}, \
+ LINE_PROPERTIES_DEFAULTS
+
+#define LINE_PROPERTIES_START_END \
+ { UNO_NAME_LINEEND, XATTR_LINEEND, ::cppu::UnoType<css::drawing::PolyPolygonBezierCoords>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { u"LineEndName", XATTR_LINEEND, ::cppu::UnoType<OUString>::get(), 0, MID_NAME }, \
+ { UNO_NAME_LINESTART, XATTR_LINESTART, ::cppu::UnoType<css::drawing::PolyPolygonBezierCoords>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { u"LineStartName", XATTR_LINESTART, ::cppu::UnoType<OUString>::get(), 0, MID_NAME },
+
+#define FILL_PROPERTIES_BMP \
+ { UNO_NAME_FILLBMP_LOGICAL_SIZE, XATTR_FILLBMP_SIZELOG, cppu::UnoType<bool>::get() , 0, 0}, \
+ { UNO_NAME_FILLBMP_OFFSET_X, XATTR_FILLBMP_TILEOFFSETX, ::cppu::UnoType<sal_Int32>::get() , 0, 0}, \
+ { UNO_NAME_FILLBMP_OFFSET_Y, XATTR_FILLBMP_TILEOFFSETY, ::cppu::UnoType<sal_Int32>::get() , 0, 0}, \
+ { UNO_NAME_FILLBMP_POSITION_OFFSET_X, XATTR_FILLBMP_POSOFFSETX, ::cppu::UnoType<sal_Int32>::get() , 0, 0}, \
+ { UNO_NAME_FILLBMP_POSITION_OFFSET_Y, XATTR_FILLBMP_POSOFFSETY, ::cppu::UnoType<sal_Int32>::get() , 0, 0}, \
+ { UNO_NAME_FILLBMP_RECTANGLE_POINT, XATTR_FILLBMP_POS, ::cppu::UnoType<css::drawing::RectanglePoint>::get() , 0, 0}, \
+ { UNO_NAME_FILLBMP_SIZE_X, XATTR_FILLBMP_SIZEX, ::cppu::UnoType<sal_Int32>::get() , 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_FILLBMP_SIZE_Y, XATTR_FILLBMP_SIZEY, ::cppu::UnoType<sal_Int32>::get() , 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_FILLBMP_STRETCH, XATTR_FILLBMP_STRETCH, cppu::UnoType<bool>::get() , 0, 0}, \
+ { UNO_NAME_FILLBMP_TILE, XATTR_FILLBMP_TILE, cppu::UnoType<bool>::get() , 0, 0},\
+ { UNO_NAME_FILLBMP_MODE, OWN_ATTR_FILLBMP_MODE, ::cppu::UnoType<css::drawing::BitmapMode>::get(), 0, 0},
+
+#define FILL_PROPERTIES_DEFAULTS \
+ { UNO_NAME_FILLCOLOR, XATTR_FILLCOLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+
+#define FILL_PROPERTIES \
+ FILL_PROPERTIES_BMP \
+ FILL_PROPERTIES_DEFAULTS \
+ { UNO_NAME_FILLBACKGROUND, XATTR_FILLBACKGROUND , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_FILLBITMAP, XATTR_FILLBITMAP , cppu::UnoType<css::awt::XBitmap>::get() , 0, MID_BITMAP}, \
+ { UNO_NAME_FILLBITMAPURL, XATTR_FILLBITMAP , cppu::UnoType<OUString>::get(), 0, MID_BITMAP }, \
+ { UNO_NAME_FILLBITMAPNAME, XATTR_FILLBITMAP , ::cppu::UnoType<OUString>::get(), 0, MID_NAME }, \
+ { UNO_NAME_FILLGRADIENTSTEPCOUNT, XATTR_GRADIENTSTEPCOUNT , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_FILLGRADIENT, XATTR_FILLGRADIENT , ::cppu::UnoType<css::awt::Gradient>::get(), 0, MID_FILLGRADIENT}, \
+ { UNO_NAME_FILLGRADIENTNAME, XATTR_FILLGRADIENT , ::cppu::UnoType<OUString>::get(), 0, MID_NAME }, \
+ { UNO_NAME_FILLHATCH, XATTR_FILLHATCH , ::cppu::UnoType<css::drawing::Hatch>::get(), 0, MID_FILLHATCH}, \
+ { UNO_NAME_FILLHATCHNAME, XATTR_FILLHATCH , ::cppu::UnoType<OUString>::get(), 0, MID_NAME }, \
+ { UNO_NAME_FILLSTYLE, XATTR_FILLSTYLE , ::cppu::UnoType<css::drawing::FillStyle>::get() , 0, 0}, \
+ { UNO_NAME_FILL_TRANSPARENCE, XATTR_FILLTRANSPARENCE, ::cppu::UnoType<sal_Int16>::get() , 0, 0}, \
+ { UNO_NAME_FILLTRANSPARENCEGRADIENT, XATTR_FILLFLOATTRANSPARENCE, ::cppu::UnoType<css::awt::Gradient>::get(), 0, MID_FILLGRADIENT}, \
+ { UNO_NAME_FILLTRANSPARENCEGRADIENTNAME, XATTR_FILLFLOATTRANSPARENCE, ::cppu::UnoType<OUString>::get(), 0, MID_NAME }, \
+ { UNO_NAME_FILLCOLOR_2, XATTR_SECONDARYFILLCOLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_FILLCOLOR_THEME, XATTR_FILLCOLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_THEME_INDEX}, \
+ { UNO_NAME_FILLCOLOR_LUM_MOD, XATTR_FILLCOLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_MOD}, \
+ { UNO_NAME_FILLCOLOR_LUM_OFF, XATTR_FILLCOLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_OFF}, \
+ { UNO_NAME_GRAPHIC_GRAPHICCROP, SDRATTR_GRAFCROP , ::cppu::UnoType<css::text::GraphicCrop>::get(), 0, 0 }, \
+ { UNO_NAME_FILLUSESLIDEBACKGROUND, XATTR_FILLUSESLIDEBACKGROUND, cppu::UnoType<bool>::get(), 0, 0},
+
+
+#define EDGERADIUS_PROPERTIES \
+ { UNO_NAME_EDGERADIUS, SDRATTR_CORNER_RADIUS , ::cppu::UnoType<sal_Int32>::get() , 0, 0, PropertyMoreFlags::METRIC_ITEM},
+
+#define TEXT_PROPERTIES_DEFAULTS\
+ { UNO_NAME_TEXT_WRITINGMODE, SDRATTR_TEXTDIRECTION, ::cppu::UnoType<css::text::WritingMode>::get(), 0, 0},\
+ { UNO_NAME_TEXT_ANIAMOUNT, SDRATTR_TEXT_ANIAMOUNT, ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_ANICOUNT, SDRATTR_TEXT_ANICOUNT, ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_ANIDELAY, SDRATTR_TEXT_ANIDELAY, ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_ANIDIRECTION, SDRATTR_TEXT_ANIDIRECTION, cppu::UnoType<css::drawing::TextAnimationDirection>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_ANIKIND, SDRATTR_TEXT_ANIKIND, cppu::UnoType<css::drawing::TextAnimationKind>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_ANISTARTINSIDE, SDRATTR_TEXT_ANISTARTINSIDE, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_ANISTOPINSIDE, SDRATTR_TEXT_ANISTOPINSIDE, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_CONTOURFRAME, SDRATTR_TEXT_CONTOURFRAME, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_FITTOSIZE, SDRATTR_TEXT_FITTOSIZE, cppu::UnoType<css::drawing::TextFitToSizeType>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_HORZADJUST, SDRATTR_TEXT_HORZADJUST, cppu::UnoType<css::drawing::TextHorizontalAdjust>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_LEFTDIST, SDRATTR_TEXT_LEFTDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_TEXT_LOWERDIST, SDRATTR_TEXT_LOWERDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_TEXT_MAXFRAMEHEIGHT, SDRATTR_TEXT_MAXFRAMEHEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_TEXT_MAXFRAMEWIDTH, SDRATTR_TEXT_MAXFRAMEWIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_MINFRAMEHEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_MINFRAMEWIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_TEXT_RIGHTDIST, SDRATTR_TEXT_RIGHTDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_TEXT_UPPERDIST, SDRATTR_TEXT_UPPERDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_TEXT_FONTINDEPENDENTLINESPACING,SDRATTR_TEXT_USEFIXEDCELLHEIGHT,cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST, cppu::UnoType<css::drawing::TextVerticalAdjust>::get(), 0, 0},\
+ { UNO_NAME_TEXT_WORDWRAP, SDRATTR_TEXT_WORDWRAP, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_TEXT_CHAINNEXTNAME, SDRATTR_TEXT_CHAINNEXTNAME, ::cppu::UnoType<OUString>::get(), 0, 0}, \
+ { u"TextColumns", OWN_ATTR_TEXTCOLUMNS, cppu::UnoType<css::text::XTextColumns>::get(), 0, 0 }, \
+ SVX_UNOEDIT_CHAR_PROPERTIES, \
+ SVX_UNOEDIT_PARA_PROPERTIES,
+
+#define TEXT_PROPERTIES \
+ SVX_UNOEDIT_NUMBERING_PROPERTY, \
+ TEXT_PROPERTIES_DEFAULTS
+
+// { "HasLevels", OWN_ATTR_HASLEVELS, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY, 0},
+
+#define MISC_OBJ_PROPERTIES_NO_SHEAR \
+ { u"Transformation", OWN_ATTR_TRANSFORMATION, cppu::UnoType<css::drawing::HomogenMatrix3>::get(), 0, 0 }, \
+ { UNO_NAME_MISC_OBJ_ZORDER, OWN_ATTR_ZORDER, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_MISC_OBJ_FRAMERECT, OWN_ATTR_FRAMERECT, cppu::UnoType<css::awt::Rectangle>::get(), 0, 0 }, \
+ { UNO_NAME_MISC_OBJ_ROTATEANGLE, SDRATTR_ROTATEANGLE, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_BITMAP, OWN_ATTR_BITMAP, cppu::UnoType<css::awt::XBitmap>::get(), css::beans::PropertyAttribute::READONLY, 0}, \
+ { UNO_NAME_OLE2_METAFILE, OWN_ATTR_METAFILE, cppu::UnoType<css::uno::Sequence<sal_Int8>>::get(), css::beans::PropertyAttribute::READONLY, 0}, \
+ { u"IsFontwork", OWN_ATTR_ISFONTWORK, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY, 0}, \
+ { UNO_NAME_MISC_OBJ_BOUNDRECT, OWN_ATTR_BOUNDRECT, cppu::UnoType<css::awt::Rectangle>::get(), css::beans::PropertyAttribute::READONLY, 0},
+
+#define MISC_OBJ_PROPERTIES \
+ { UNO_NAME_MISC_OBJ_INTEROPGRABBAG, OWN_ATTR_INTEROPGRABBAG, cppu::UnoType<css::uno::Sequence< css::beans::PropertyValue >>::get(), 0, 0}, \
+ MISC_OBJ_PROPERTIES_NO_SHEAR \
+ { UNO_NAME_MISC_OBJ_SHEARANGLE, SDRATTR_SHEARANGLE, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
+
+
+#define SHAPE_DESCRIPTOR_PROPERTIES \
+ { UNO_NAME_MISC_OBJ_LAYERID, SDRATTR_LAYERID , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_MISC_OBJ_LAYERNAME, SDRATTR_LAYERNAME , ::cppu::UnoType<OUString>::get(), 0, 0}, \
+ { UNO_NAME_MISC_OBJ_MOVEPROTECT, SDRATTR_OBJMOVEPROTECT , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_MISC_OBJ_NAME, SDRATTR_OBJECTNAME , ::cppu::UnoType<OUString>::get(), 0, 0}, \
+ { UNO_NAME_MISC_OBJ_PRINTABLE, SDRATTR_OBJPRINTABLE , cppu::UnoType<bool>::get(), 0, 0}, \
+ { u"Visible", SDRATTR_OBJVISIBLE , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_MISC_OBJ_SIZEPROTECT, SDRATTR_OBJSIZEPROTECT , cppu::UnoType<bool>::get(), 0, 0},\
+ { u"UINameSingular", OWN_ATTR_UINAME_SINGULAR , ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY, 0}, \
+ { u"UINamePlural", OWN_ATTR_UINAME_PLURAL , ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY, 0}, \
+ { u"TextFitToSizeScale", OWN_ATTR_TEXTFITTOSIZESCALE, ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ /* #i68101# */ \
+ { UNO_NAME_MISC_OBJ_TITLE, OWN_ATTR_MISC_OBJ_TITLE , ::cppu::UnoType<OUString>::get(), 0, 0}, \
+ { UNO_NAME_MISC_OBJ_DESCRIPTION, OWN_ATTR_MISC_OBJ_DESCRIPTION , ::cppu::UnoType<OUString>::get(), 0, 0}, \
+ { UNO_NAME_HYPERLINK, OWN_ATTR_HYPERLINK, ::cppu::UnoType<OUString>::get(), 0, 0},
+
+#define LINKTARGET_PROPERTIES \
+ { UNO_NAME_LINKDISPLAYNAME, OWN_ATTR_LDNAME , ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY, 0}, \
+ { UNO_NAME_LINKDISPLAYBITMAP, OWN_ATTR_LDBITMAP , cppu::UnoType<css::awt::XBitmap>::get(), css::beans::PropertyAttribute::READONLY, 0},
+
+
+#define CONNECTOR_PROPERTIES \
+ { UNO_NAME_EDGEKIND, SDRATTR_EDGEKIND, ::cppu::UnoType<css::drawing::ConnectorType>::get(), 0, 0}, \
+ { UNO_NAME_EDGENODE1HORZDIST, SDRATTR_EDGENODE1HORZDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_EDGENODE1VERTDIST, SDRATTR_EDGENODE1VERTDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_EDGENODE2HORZDIST, SDRATTR_EDGENODE2HORZDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_EDGENODE2VERTDIST, SDRATTR_EDGENODE2VERTDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
+
+#define SPECIAL_CONNECTOR_PROPERTIES \
+ CONNECTOR_PROPERTIES \
+ { UNO_NAME_EDGELINE1DELTA, SDRATTR_EDGELINE1DELTA, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_EDGELINE2DELTA, SDRATTR_EDGELINE2DELTA, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_EDGELINE3DELTA, SDRATTR_EDGELINE3DELTA, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { u"StartShape", OWN_ATTR_EDGE_START_OBJ, cppu::UnoType<css::drawing::XShape>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { u"StartGluePointIndex", OWN_ATTR_GLUEID_HEAD, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { u"StartPosition", OWN_ATTR_EDGE_START_POS, ::cppu::UnoType<css::awt::Point>::get(), 0, 0}, \
+ { u"EndShape", OWN_ATTR_EDGE_END_OBJ, cppu::UnoType<css::drawing::XShape>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { u"EndPosition", OWN_ATTR_EDGE_END_POS, ::cppu::UnoType<css::awt::Point>::get(), 0, 0},\
+ { u"EndGluePointIndex", OWN_ATTR_GLUEID_TAIL, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+\
+ { u"EdgeStartConnection", OWN_ATTR_EDGE_START_OBJ, cppu::UnoType<css::drawing::XShape>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { u"EdgeStartPoint", OWN_ATTR_EDGE_START_POS, ::cppu::UnoType<css::awt::Point>::get(), css::beans::PropertyAttribute::READONLY, 0}, \
+ { u"EdgeEndConnection", OWN_ATTR_EDGE_END_OBJ, cppu::UnoType<css::drawing::XShape>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { u"EdgeEndPoint", OWN_ATTR_EDGE_END_POS, ::cppu::UnoType<css::awt::Point>::get(), css::beans::PropertyAttribute::READONLY, 0}, \
+\
+ { UNO_NAME_POLYPOLYGONBEZIER, OWN_ATTR_EDGE_POLYPOLYGONBEZIER, ::cppu::UnoType<css::drawing::PolyPolygonBezierCoords>::get(), 0, 0},
+
+#define SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS \
+ { UNO_NAME_MEASUREBELOWREFEDGE, SDRATTR_MEASUREBELOWREFEDGE, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_MEASUREFORMATSTRING, SDRATTR_MEASUREFORMATSTRING, ::cppu::UnoType<OUString>::get(), 0, 0}, \
+ { UNO_NAME_MEASUREHELPLINE1LEN, SDRATTR_MEASUREHELPLINE1LEN, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_MEASUREHELPLINE2LEN, SDRATTR_MEASUREHELPLINE2LEN, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_MEASUREHELPLINEDIST, SDRATTR_MEASUREHELPLINEDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_MEASUREHELPLINEOVERHANG, SDRATTR_MEASUREHELPLINEOVERHANG, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_MEASUREKIND, SDRATTR_MEASUREKIND, ::cppu::UnoType<css::drawing::MeasureKind>::get(), 0, 0}, \
+ { UNO_NAME_MEASURELINEDIST, SDRATTR_MEASURELINEDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_MEASUREOVERHANG, SDRATTR_MEASUREOVERHANG, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_MEASUREUNIT, SDRATTR_MEASUREUNIT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},\
+ { UNO_NAME_MEASURESHOWUNIT, SDRATTR_MEASURESHOWUNIT, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_MEASURETEXTAUTOANGLE, SDRATTR_MEASURETEXTAUTOANGLE, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_MEASURETEXTAUTOANGLEVIEW, SDRATTR_MEASURETEXTAUTOANGLEVIEW, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_MEASURETEXTFIXEDANGLE, SDRATTR_MEASURETEXTFIXEDANGLE, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_MEASURETEXTHPOS, SDRATTR_MEASURETEXTHPOS, ::cppu::UnoType<css::drawing::MeasureTextHorzPos>::get(), 0, 0}, \
+ { UNO_NAME_MEASURETEXTISFIXEDANGLE, SDRATTR_MEASURETEXTISFIXEDANGLE, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_MEASURETEXTROTA90, SDRATTR_MEASURETEXTROTA90, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_MEASURETEXTUPSIDEDOWN, SDRATTR_MEASURETEXTUPSIDEDOWN, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_MEASURETEXTVPOS, SDRATTR_MEASURETEXTVPOS, ::cppu::UnoType<css::drawing::MeasureTextVertPos>::get(), 0, 0}, \
+ { u"MeasureDecimalPlaces", SDRATTR_MEASUREDECIMALPLACES, ::cppu::UnoType<sal_Int16>::get(), 0, 0},
+
+
+#define SPECIAL_DIMENSIONING_PROPERTIES \
+ SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS \
+ { u"StartPosition", OWN_ATTR_MEASURE_START_POS, ::cppu::UnoType<css::awt::Point>::get(), 0, 0},\
+ { u"EndPosition", OWN_ATTR_MEASURE_END_POS, ::cppu::UnoType<css::awt::Point>::get(), 0, 0},
+
+#define SPECIAL_CIRCLE_PROPERTIES \
+ { UNO_NAME_CIRCENDANGLE, SDRATTR_CIRCENDANGLE, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_CIRCKIND, SDRATTR_CIRCKIND, ::cppu::UnoType<css::drawing::CircleKind>::get(), 0, 0}, \
+ { UNO_NAME_CIRCSTARTANGLE,SDRATTR_CIRCSTARTANGLE, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
+
+#define SPECIAL_POLYGON_PROPERTIES \
+ { UNO_NAME_POLYGONKIND, OWN_ATTR_VALUE_POLYGONKIND, ::cppu::UnoType<css::drawing::PolygonKind>::get(), css::beans::PropertyAttribute::READONLY, 0},
+
+#define SPECIAL_POLYPOLYGON_PROPERTIES \
+ { UNO_NAME_POLYPOLYGON, OWN_ATTR_VALUE_POLYPOLYGON, ::cppu::UnoType<css::drawing::PointSequenceSequence>::get(), 0, 0}, \
+ { UNO_NAME_POLYGON, OWN_ATTR_VALUE_POLYGON, ::cppu::UnoType<css::drawing::PointSequence>::get(), 0, 0},
+
+#define SPECIAL_POLYPOLYGONBEZIER_PROPERTIES \
+ { UNO_NAME_POLYPOLYGONBEZIER, OWN_ATTR_VALUE_POLYPOLYGONBEZIER, ::cppu::UnoType<css::drawing::PolyPolygonBezierCoords>::get(), 0, 0},
+
+#define SPECIAL_GRAPHOBJ_PROPERTIES_DEFAULTS \
+ { UNO_NAME_GRAPHIC_LUMINANCE, SDRATTR_GRAFLUMINANCE , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHIC_CONTRAST, SDRATTR_GRAFCONTRAST , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHIC_RED, SDRATTR_GRAFRED , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHIC_GREEN, SDRATTR_GRAFGREEN , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHIC_BLUE, SDRATTR_GRAFBLUE , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHIC_GAMMA, SDRATTR_GRAFGAMMA , cppu::UnoType<double>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHIC_TRANSPARENCY, SDRATTR_GRAFTRANSPARENCE , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHIC_COLOR_MODE, SDRATTR_GRAFMODE , ::cppu::UnoType<css::drawing::ColorMode>::get(), 0, 0},
+
+#define SPECIAL_GRAPHOBJ_PROPERTIES \
+ SPECIAL_GRAPHOBJ_PROPERTIES_DEFAULTS \
+ { UNO_NAME_GRAPHIC_GRAPHICCROP, SDRATTR_GRAFCROP , ::cppu::UnoType<css::text::GraphicCrop>::get(), 0, 0 }, \
+ { UNO_NAME_GRAPHOBJ_REPLACEMENT_GRAPHIC, OWN_ATTR_REPLACEMENT_GRAPHIC, cppu::UnoType<css::graphic::XGraphic>::get() , 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_GRAFSTREAMURL, OWN_ATTR_GRAFSTREAMURL , ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 }, \
+ { UNO_NAME_GRAPHOBJ_FILLBITMAP, OWN_ATTR_VALUE_FILLBITMAP , cppu::UnoType<css::awt::XBitmap>::get() , 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_GRAPHIC, OWN_ATTR_VALUE_GRAPHIC , cppu::UnoType<css::graphic::XGraphic>::get() , 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_GRAPHIC_URL, OWN_ATTR_GRAPHIC_URL , cppu::UnoType<css::uno::Any>::get(), 0, 0 }, \
+ { UNO_NAME_GRAPHOBJ_IS_SIGNATURELINE, OWN_ATTR_IS_SIGNATURELINE , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_SIGNATURELINE_ID, OWN_ATTR_SIGNATURELINE_ID , cppu::UnoType<OUString>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_NAME, OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_NAME, cppu::UnoType<OUString>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_TITLE, OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_TITLE, cppu::UnoType<OUString>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL, OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL, cppu::UnoType<OUString>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_SIGNATURELINE_SIGNING_INSTRUCTIONS, OWN_ATTR_SIGNATURELINE_SIGNING_INSTRUCTIONS, cppu::UnoType<OUString>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_SIGNATURELINE_SHOW_SIGN_DATE, OWN_ATTR_SIGNATURELINE_SHOW_SIGN_DATE, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_SIGNATURELINE_CAN_ADD_COMMENT, OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE, OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE, cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_SIGNATURELINE_IS_SIGNED, OWN_ATTR_SIGNATURELINE_IS_SIGNED , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_GRAPHOBJ_QRCODE, OWN_ATTR_QRCODE , cppu::UnoType<css::drawing::BarCode>::get(), 0, 0},
+
+#define SPECIAL_3DSCENEOBJECT_PROPERTIES_DEFAULTS \
+ { UNO_NAME_3D_SCENE_AMBIENTCOLOR, SDRATTR_3DSCENE_AMBIENTCOLOR , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_DISTANCE, SDRATTR_3DSCENE_DISTANCE , ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_3D_SCENE_FOCAL_LENGTH, SDRATTR_3DSCENE_FOCAL_LENGTH , ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_3D_SCENE_LIGHTCOLOR_1, SDRATTR_3DSCENE_LIGHTCOLOR_1 , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTCOLOR_2, SDRATTR_3DSCENE_LIGHTCOLOR_2 , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTCOLOR_3, SDRATTR_3DSCENE_LIGHTCOLOR_3 , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTCOLOR_4, SDRATTR_3DSCENE_LIGHTCOLOR_4 , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTCOLOR_5, SDRATTR_3DSCENE_LIGHTCOLOR_5 , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTCOLOR_6, SDRATTR_3DSCENE_LIGHTCOLOR_6 , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTCOLOR_7, SDRATTR_3DSCENE_LIGHTCOLOR_7 , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTCOLOR_8, SDRATTR_3DSCENE_LIGHTCOLOR_8 , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTDIRECTION_1, SDRATTR_3DSCENE_LIGHTDIRECTION_1 , ::cppu::UnoType<css::drawing::Direction3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTDIRECTION_2, SDRATTR_3DSCENE_LIGHTDIRECTION_2 , ::cppu::UnoType<css::drawing::Direction3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTDIRECTION_3, SDRATTR_3DSCENE_LIGHTDIRECTION_3 , ::cppu::UnoType<css::drawing::Direction3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTDIRECTION_4, SDRATTR_3DSCENE_LIGHTDIRECTION_4 , ::cppu::UnoType<css::drawing::Direction3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTDIRECTION_5, SDRATTR_3DSCENE_LIGHTDIRECTION_5 , ::cppu::UnoType<css::drawing::Direction3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTDIRECTION_6, SDRATTR_3DSCENE_LIGHTDIRECTION_6 , ::cppu::UnoType<css::drawing::Direction3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTDIRECTION_7, SDRATTR_3DSCENE_LIGHTDIRECTION_7 , ::cppu::UnoType<css::drawing::Direction3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTDIRECTION_8, SDRATTR_3DSCENE_LIGHTDIRECTION_8 , ::cppu::UnoType<css::drawing::Direction3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTON_1, SDRATTR_3DSCENE_LIGHTON_1 , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTON_2, SDRATTR_3DSCENE_LIGHTON_2 , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTON_3, SDRATTR_3DSCENE_LIGHTON_3 , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTON_4, SDRATTR_3DSCENE_LIGHTON_4 , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTON_5, SDRATTR_3DSCENE_LIGHTON_5 , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTON_6, SDRATTR_3DSCENE_LIGHTON_6 , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTON_7, SDRATTR_3DSCENE_LIGHTON_7 , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_LIGHTON_8, SDRATTR_3DSCENE_LIGHTON_8 , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_PERSPECTIVE, SDRATTR_3DSCENE_PERSPECTIVE , cppu::UnoType<css::drawing::ProjectionMode>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_SHADOW_SLANT, SDRATTR_3DSCENE_SHADOW_SLANT , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_SHADE_MODE, SDRATTR_3DSCENE_SHADE_MODE , ::cppu::UnoType<css::drawing::ShadeMode>::get(), 0, 0}, \
+ { UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING,SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, cppu::UnoType<bool>::get(), 0, 0},
+
+#define SPECIAL_3DSCENEOBJECT_PROPERTIES \
+ SPECIAL_3DSCENEOBJECT_PROPERTIES_DEFAULTS \
+ { UNO_NAME_3D_TRANSFORM_MATRIX, OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX , ::cppu::UnoType<css::drawing::HomogenMatrix>::get(), 0, 0}, \
+ { UNO_NAME_3D_CAMERA_GEOMETRY, OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY , ::cppu::UnoType<css::drawing::CameraGeometry>::get(), 0, 0},
+
+// #i28528#
+// Added extra Item (Bool) for chart2 to be able to show reduced line geometry (SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY)
+#define MISC_3D_OBJ_PROPERTIES \
+ { UNO_NAME_3D_DOUBLE_SIDED ,SDRATTR_3DOBJ_DOUBLE_SIDED , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_MAT_COLOR ,SDRATTR_3DOBJ_MAT_COLOR , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_MAT_EMISSION ,SDRATTR_3DOBJ_MAT_EMISSION , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_MAT_SPECULAR ,SDRATTR_3DOBJ_MAT_SPECULAR , ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_MAT_SPECULAR_INTENSITY ,SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_3D_NORMALS_INVERT ,SDRATTR_3DOBJ_NORMALS_INVERT , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_NORMALS_KIND ,SDRATTR_3DOBJ_NORMALS_KIND , ::cppu::UnoType<css::drawing::NormalsKind>::get(), 0, 0}, \
+ { UNO_NAME_3D_SHADOW_3D ,SDRATTR_3DOBJ_SHADOW_3D , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_TEXTURE_FILTER ,SDRATTR_3DOBJ_TEXTURE_FILTER , cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_TEXTURE_KIND ,SDRATTR_3DOBJ_TEXTURE_KIND , ::cppu::UnoType<css::drawing::TextureKind>::get(), 0, 0}, \
+ { UNO_NAME_3D_TEXTURE_MODE ,SDRATTR_3DOBJ_TEXTURE_MODE , ::cppu::UnoType<css::drawing::TextureMode>::get(), 0, 0}, \
+ { UNO_NAME_3D_TEXTURE_PROJ_X ,SDRATTR_3DOBJ_TEXTURE_PROJ_X , ::cppu::UnoType<css::drawing::TextureProjectionMode>::get(), 0, 0}, \
+ { UNO_NAME_3D_TEXTURE_PROJ_Y ,SDRATTR_3DOBJ_TEXTURE_PROJ_Y , ::cppu::UnoType<css::drawing::TextureProjectionMode>::get(), 0, 0}, \
+ { UNO_NAME_3D_REDUCED_LINE_GEOMETRY ,SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY , cppu::UnoType<bool>::get(), 0, 0},
+
+#define SPECIAL_3DCUBEOBJECT_PROPERTIES \
+ { UNO_NAME_3D_TRANSFORM_MATRIX ,OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX , ::cppu::UnoType<css::drawing::HomogenMatrix>::get(), 0, 0}, \
+ { UNO_NAME_3D_POS ,OWN_ATTR_3D_VALUE_POSITION , cppu::UnoType<css::drawing::Position3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_SIZE ,OWN_ATTR_3D_VALUE_SIZE , ::cppu::UnoType<css::drawing::Direction3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_POS_IS_CENTER ,OWN_ATTR_3D_VALUE_POS_IS_CENTER , cppu::UnoType<bool>::get(), 0, 0},
+
+#define SPECIAL_3DSPHEREOBJECT_PROPERTIES \
+ { UNO_NAME_3D_TRANSFORM_MATRIX ,OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX , ::cppu::UnoType<css::drawing::HomogenMatrix>::get(), 0, 0}, \
+ { UNO_NAME_3D_POS ,OWN_ATTR_3D_VALUE_POSITION , cppu::UnoType<css::drawing::Position3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_SIZE ,OWN_ATTR_3D_VALUE_SIZE , ::cppu::UnoType<css::drawing::Direction3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_HORZ_SEGS ,SDRATTR_3DOBJ_HORZ_SEGS, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_VERT_SEGS ,SDRATTR_3DOBJ_VERT_SEGS, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
+
+// #107245# New 3D properties which are possible for lathe and extrude 3d objects
+#define SPECIAL_3DLATHEANDEXTRUDEOBJ_PROPERTIES \
+ { UNO_NAME_3D_SMOOTH_NORMALS , SDRATTR_3DOBJ_SMOOTH_NORMALS, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_SMOOTH_LIDS , SDRATTR_3DOBJ_SMOOTH_LIDS, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_CHARACTER_MODE , SDRATTR_3DOBJ_CHARACTER_MODE, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_CLOSE_FRONT , SDRATTR_3DOBJ_CLOSE_FRONT, cppu::UnoType<bool>::get(), 0, 0}, \
+ { UNO_NAME_3D_CLOSE_BACK , SDRATTR_3DOBJ_CLOSE_BACK, cppu::UnoType<bool>::get(), 0, 0},
+
+#define SPECIAL_3DLATHEOBJECT_PROPERTIES \
+ { UNO_NAME_3D_TRANSFORM_MATRIX ,OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX,::cppu::UnoType<css::drawing::HomogenMatrix>::get(), 0, 0}, \
+ { UNO_NAME_3D_POLYPOLYGON3D ,OWN_ATTR_3D_VALUE_POLYPOLYGON3D ,::cppu::UnoType<css::drawing::PolyPolygonShape3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_LATHE_END_ANGLE ,SDRATTR_3DOBJ_END_ANGLE ,::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_3D_HORZ_SEGS ,SDRATTR_3DOBJ_HORZ_SEGS ,::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
+ { UNO_NAME_3D_PERCENT_DIAGONAL ,SDRATTR_3DOBJ_PERCENT_DIAGONAL ,::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+ { UNO_NAME_3D_VERT_SEGS ,SDRATTR_3DOBJ_VERT_SEGS ,::cppu::UnoType<sal_Int32>::get(), 0, 0},
+
+#define SPECIAL_3DEXTRUDEOBJECT_PROPERTIES \
+ { UNO_NAME_3D_TRANSFORM_MATRIX ,OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX,::cppu::UnoType<css::drawing::HomogenMatrix>::get(), 0, 0}, \
+ { UNO_NAME_3D_POLYPOLYGON3D ,OWN_ATTR_3D_VALUE_POLYPOLYGON3D ,::cppu::UnoType<css::drawing::PolyPolygonShape3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_EXTRUDE_DEPTH ,SDRATTR_3DOBJ_DEPTH ,::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_3D_PERCENT_DIAGONAL ,SDRATTR_3DOBJ_PERCENT_DIAGONAL ,::cppu::UnoType<sal_Int16>::get(), 0, 0},
+
+#define SPECIAL_3DPOLYGONOBJECT_PROPERTIES \
+ { UNO_NAME_3D_TRANSFORM_MATRIX ,OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX, ::cppu::UnoType<css::drawing::HomogenMatrix>::get(), 0, 0}, \
+ { UNO_NAME_3D_POLYPOLYGON3D ,OWN_ATTR_3D_VALUE_POLYPOLYGON3D , ::cppu::UnoType<css::drawing::PolyPolygonShape3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_NORMALSPOLYGON3D ,OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D, ::cppu::UnoType<css::drawing::PolyPolygonShape3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_TEXTUREPOLYGON3D ,OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D, ::cppu::UnoType<css::drawing::PolyPolygonShape3D>::get(), 0, 0}, \
+ { UNO_NAME_3D_LINEONLY ,OWN_ATTR_3D_VALUE_LINEONLY , cppu::UnoType<bool>::get(), 0, 0},
+
+#define SPECIAL_3DBACKSCALE_PROPERTIES \
+ { UNO_NAME_3D_BACKSCALE ,SDRATTR_3DOBJ_BACKSCALE , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unoshtxt.hxx b/include/svx/unoshtxt.hxx
new file mode 100644
index 000000000..803b2996d
--- /dev/null
+++ b/include/svx/unoshtxt.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_UNOSHTXT_HXX
+#define INCLUDED_SVX_UNOSHTXT_HXX
+
+#include <memory>
+#include <editeng/unoedsrc.hxx>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star {
+ namespace uno {
+ class XInterface;
+ }
+ namespace accessibility {
+ struct TextSegment;
+ }
+}
+
+class SvxTextForwarder;
+class SdrObject;
+class SdrModel;
+class SdrView;
+class OutputDevice;
+class SvxTextEditSourceImpl;
+class SdrText;
+
+class SVXCORE_DLLPUBLIC SvxTextEditSource final : public SvxEditSource, public SvxViewForwarder
+{
+public:
+ SvxTextEditSource( SdrObject* pObj, SdrText* pText );
+
+ /** Since the views don't broadcast their dying, make sure that
+ this object gets destroyed if the view becomes invalid
+
+ The window is necessary, since our views can display on multiple windows
+ */
+ SvxTextEditSource( SdrObject& rObj, SdrText* pText, SdrView& rView, const OutputDevice& rViewWindow );
+ SvxTextEditSource(const SvxTextEditSource&) = delete;
+ SvxTextEditSource& operator=(const SvxTextEditSource&) = delete;
+ virtual ~SvxTextEditSource() override;
+
+ virtual std::unique_ptr<SvxEditSource> Clone() const override;
+ virtual SvxTextForwarder* GetTextForwarder() override;
+ virtual SvxViewForwarder* GetViewForwarder() override;
+ virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate = false ) override;
+ virtual void UpdateData() override;
+
+ virtual void addRange( SvxUnoTextRangeBase* pNewRange ) override;
+ virtual void removeRange( SvxUnoTextRangeBase* pOldRange ) override;
+ virtual const SvxUnoTextRangeBaseVec& getRanges() const override;
+
+ virtual SfxBroadcaster& GetBroadcaster() const override;
+
+ void lock();
+ void unlock();
+
+ // the SvxViewForwarder interface
+ virtual bool IsValid() const override;
+ virtual Point LogicToPixel( const Point&, const MapMode& ) const override;
+ virtual Point PixelToLogic( const Point&, const MapMode& ) const override;
+
+ void UpdateOutliner();
+
+private:
+ SVX_DLLPRIVATE SvxTextEditSource( SvxTextEditSourceImpl* pImpl );
+
+ rtl::Reference<SvxTextEditSourceImpl> mpImpl;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/view3d.hxx b/include/svx/view3d.hxx
new file mode 100644
index 000000000..359b3aa31
--- /dev/null
+++ b/include/svx/view3d.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_VIEW3D_HXX
+#define INCLUDED_SVX_VIEW3D_HXX
+
+#include <svx/svdview.hxx>
+#include <svx/deflt3d.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+/*
+ * Forward declarations
+ */
+
+class E3dObject;
+class E3dScene;
+class Impl3DMirrorConstructOverlay;
+
+/**
+ * Derived class of SdrView to edit 3D objects.
+ */
+
+class SVXCORE_DLLPUBLIC E3dView : public SdrView
+{
+ E3dDefaultAttributes a3DDefaultAttr;
+ MouseEvent aMouseEvent; // The parameters of the last Events (Mouse, Keyboard)
+
+ // Migrate selections
+ std::unique_ptr<Impl3DMirrorConstructOverlay> mpMirrorOverlay;
+
+protected:
+ void InitView();
+
+ void ImpCreate3DObject(E3dScene* pScene, SdrObject* pObj, bool bExtrude, double fDepth, basegfx::B2DHomMatrix const & rLatheMat);
+ void ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, bool bExtrude, double fDepth, basegfx::B2DHomMatrix const & rLatheMat);
+ void ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj);
+ void ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj);
+
+ void InitScene(E3dScene* pScene, double fW, double fH, double fCamZ);
+ void ImpIsConvertTo3DPossible(SdrObject const * pObj, bool& rAny3D, bool& rGroupSelected) const;
+ void BreakSingle3DObj(E3dObject* pObj);
+
+public:
+ E3dView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
+ virtual ~E3dView() override;
+
+ // Output all marked Objects on the given OutputDevice.
+ virtual void DrawMarkedObj(OutputDevice& rOut) const override;
+
+ // Access to the default attributes.
+ E3dDefaultAttributes& Get3DDefaultAttributes() { return a3DDefaultAttr; }
+ virtual bool BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl, short nMinMov = -3, SdrDragMethod* pForcedMeth = nullptr) override;
+ virtual void CheckPossibilities() override;
+
+ // Get/Set Event
+ void SetMouseEvent(const MouseEvent& rNew) { aMouseEvent = rNew; }
+ const MouseEvent& GetMouseEvent() const { return aMouseEvent; }
+
+ // Override getting the model, as we need to supply a Scene together with individual 3D Objects.
+ virtual std::unique_ptr<SdrModel> CreateMarkedObjModel() const override;
+
+ // On Paste: We need to insert the objects of the Scene, but not the Scene itself
+ using SdrView::Paste;
+ virtual bool Paste(
+ const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, SdrInsertFlags nOptions) override;
+
+ // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
+ bool ImpCloneAll3DObjectsToDestScene(E3dScene const * pSrcScene, E3dScene* pDstScene, Point aOffset);
+
+ bool IsConvertTo3DObjPossible() const;
+ void ConvertMarkedObjTo3D(bool bExtrude=true, const basegfx::B2DPoint& rPnt1 = basegfx::B2DPoint(0.0, 0.0), const basegfx::B2DPoint& rPnt2 = basegfx::B2DPoint(0.0, 1.0));
+
+ // Means to create all Extrudes in a certain depth order.
+ static void DoDepthArrange(E3dScene const * pScene, double fDepth);
+ void ConvertMarkedToPolyObj();
+ E3dScene* SetCurrent3DObj(E3dObject* p3DObj);
+ void Start3DCreation();
+
+ // Migration of overlay
+ bool Is3DRotationCreationActive() const { return (nullptr != mpMirrorOverlay); }
+
+ virtual void MovAction(const Point& rPnt) override;
+ void End3DCreation(bool bUseDefaultValuesForMirrorAxes=false);
+ void ResetCreationActive();
+
+ double GetDefaultCamPosZ();
+
+ double GetDefaultCamFocal();
+
+ bool IsBreak3DObjPossible() const;
+ void Break3DObj();
+
+ SfxItemSet Get3DAttributes() const;
+ void Set3DAttributes(const SfxItemSet& rAttr);
+};
+
+#endif // INCLUDED_SVX_VIEW3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/viewlayoutitem.hxx b/include/svx/viewlayoutitem.hxx
new file mode 100644
index 000000000..495443c85
--- /dev/null
+++ b/include/svx/viewlayoutitem.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_VIEWLAYOUTITEM_HXX
+#define INCLUDED_SVX_VIEWLAYOUTITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svxdllapi.h>
+
+
+class SVX_DLLPUBLIC SvxViewLayoutItem final : public SfxUInt16Item
+{
+ bool mbBookMode;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxViewLayoutItem( sal_uInt16 nColumns = 0, bool bBookMode = false, TypedWhichId<SvxViewLayoutItem> nWhich = SID_ATTR_VIEWLAYOUT );
+ SvxViewLayoutItem( const SvxViewLayoutItem& );
+ virtual ~SvxViewLayoutItem() override;
+
+ void SetBookMode( bool bNew ) {mbBookMode = bNew; }
+ bool IsBookMode() const {return mbBookMode; }
+
+ // "purely virtual methods" from the SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxViewLayoutItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; // empty
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; // empty
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/viewpt3d.hxx b/include/svx/viewpt3d.hxx
new file mode 100644
index 000000000..5d7856bd9
--- /dev/null
+++ b/include/svx/viewpt3d.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_VIEWPT3D_HXX
+#define INCLUDED_SVX_VIEWPT3D_HXX
+
+#include <svx/svxdllapi.h>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <tools/gen.hxx>
+
+// predefines
+namespace basegfx { class B3DRange; } // end of namespace basegfx
+
+/*************************************************************************
+|*
+|* enums for projection
+|*
+\************************************************************************/
+
+enum class ProjectionType { Parallel, Perspective };
+
+
+/*************************************************************************
+|*
+|* 3D viewport according to PHIGS
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC Viewport3D
+{
+ protected:
+ basegfx::B3DHomMatrix aViewTf; // the real transformations matrix
+ basegfx::B3DPoint aVRP; // View Reference Point
+ basegfx::B3DVector aVPN; // View Plane Normal
+ basegfx::B3DVector aVUV; // View Up Vector
+ basegfx::B3DPoint aPRP; // Projection Reference Point(View-coordinates)
+ // up to now only the z-coordinate is considered
+
+ ProjectionType eProjection; // kind of the projection
+ tools::Rectangle aDeviceRect; // position and size of the output area
+
+ struct
+ {
+ double X, Y, W, H; // position and size of the view window
+ } aViewWin; // in view coordinates
+
+ basegfx::B3DPoint aViewPoint; //observers position in world coordinates;
+ // is calculated by the transformation
+ bool bTfValid; // flag, if transformation is valid
+
+ public:
+ Viewport3D();
+
+ void SetVRP(const basegfx::B3DPoint& rNewVRP);
+ void SetVPN(const basegfx::B3DVector& rNewVPN);
+ void SetVUV(const basegfx::B3DVector& rNewVUV);
+ void SetPRP(const basegfx::B3DPoint& rNewPRP);
+
+ const basegfx::B3DPoint& GetVRP() const { return aVRP; }
+ const basegfx::B3DVector& GetVUV() const { return aVUV; }
+
+ void SetProjection(ProjectionType ePrj)
+ { eProjection = ePrj; bTfValid = false; }
+ ProjectionType GetProjection() const { return eProjection; }
+
+ void SetViewWindow(double fX, double fY, double fW, double fH);
+
+ void SetDeviceWindow(const tools::Rectangle& rRect);
+ const tools::Rectangle& GetDeviceWindow() const { return aDeviceRect; }
+
+ // returns observers position in world coordinates
+ const basegfx::B3DPoint& GetViewPoint();
+};
+
+#endif // INCLUDED_SVX_VIEWPT3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/weldeditview.hxx b/include/svx/weldeditview.hxx
new file mode 100644
index 000000000..004be7b60
--- /dev/null
+++ b/include/svx/weldeditview.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <sal/config.h>
+#include <svx/svxdllapi.h>
+#include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/outdev.hxx>
+
+class WeldEditAccessible;
+
+class SVX_DLLPUBLIC WeldEditView : public weld::CustomWidgetController, public EditViewCallbacks
+{
+public:
+ WeldEditView();
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual int GetSurroundingText(OUString& rSurrounding) override;
+ virtual bool DeleteSurroundingText(const Selection& rRange) override;
+
+ void SetText(const OUString& rStr);
+
+ OUString GetText() const;
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ void SetModifyHdl(const Link<LinkParamNone*, void>& rLink);
+
+ virtual EditView* GetEditView() const;
+ virtual EditEngine* GetEditEngine() const;
+
+ bool HasSelection() const;
+
+ void Delete();
+ void Cut();
+ void Copy();
+ void Paste();
+
+ virtual ~WeldEditView() override;
+
+protected:
+ bool m_bAcceptsTab;
+ // m_xDropTarget must outlive m_xEditView
+ css::uno::Reference<css::datatransfer::dnd::XDropTarget> m_xDropTarget;
+ std::unique_ptr<EditEngine> m_xEditEngine;
+ std::unique_ptr<EditView> m_xEditView;
+ rtl::Reference<WeldEditAccessible> m_xAccessible;
+
+ virtual void makeEditEngine();
+
+ void InitAccessible();
+
+ void DoPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
+
+public:
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual bool MouseMove(const MouseEvent& rMEvt) override;
+ virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
+ virtual bool KeyInput(const KeyEvent& rKEvt) override;
+ virtual bool Command(const CommandEvent& rCEvt) override;
+ virtual bool CanFocus() const;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void Resize() override;
+
+ virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard>
+ GetClipboard() const override;
+ virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget() override;
+
+ // Whether Tab will result in entering a tab or not
+ bool GetAcceptsTab() const { return m_bAcceptsTab; }
+
+ void SetAcceptsTab(bool bAcceptsTab) { m_bAcceptsTab = bAcceptsTab; }
+
+protected:
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
+
+ virtual void EditViewInvalidate(const tools::Rectangle& rRect) override { Invalidate(rRect); }
+
+ virtual void EditViewSelectionChange() override { Invalidate(); }
+
+ virtual OutputDevice& EditViewOutputDevice() const override
+ {
+ return GetDrawingArea()->get_ref_device();
+ }
+
+ virtual Point EditViewPointerPosPixel() const override;
+
+ virtual void EditViewInputContext(const InputContext& rInputContext) override
+ {
+ SetInputContext(rInputContext);
+ }
+
+ virtual void EditViewCursorRect(const tools::Rectangle& rRect, int nExtTextInputWidth) override
+ {
+ OutputDevice& rRefDevice = EditViewOutputDevice();
+ SetCursorRect(rRefDevice.LogicToPixel(rRect),
+ rRefDevice.LogicToPixel(Size(nExtTextInputWidth, 0)).Width());
+ }
+
+ virtual weld::Widget* EditViewPopupParent() const override { return GetDrawingArea(); }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xbitmap.hxx b/include/svx/xbitmap.hxx
new file mode 100644
index 000000000..0fff0a5ce
--- /dev/null
+++ b/include/svx/xbitmap.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XBITMAP_HXX
+#define INCLUDED_SVX_XBITMAP_HXX
+
+#include <memory>
+#include <tools/color.hxx>
+#include <vcl/GraphicObject.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC XOBitmap
+{
+private:
+ std::unique_ptr<GraphicObject> xGraphicObject;
+ std::unique_ptr<sal_uInt16[]> pPixelArray;
+ Color aPixelColor;
+ Color aBckgrColor;
+ bool bGraphicDirty;
+
+ const GraphicObject& GetGraphicObject() const;
+
+ XOBitmap(const XOBitmap& rXBmp) = delete;
+ XOBitmap& operator=(const XOBitmap& rXOBitmap) = delete;
+
+
+public:
+ XOBitmap( const BitmapEx& rBitmap );
+ ~XOBitmap();
+
+ void Bitmap2Array();
+ void Array2Bitmap();
+
+ void SetPixelColor( const Color& rColor ) { aPixelColor = rColor; bGraphicDirty = true; }
+ void SetBackgroundColor( const Color& rColor ) { aBckgrColor = rColor; bGraphicDirty = true; }
+
+ BitmapEx GetBitmap() const;
+ const Color& GetBackgroundColor() const { return aBckgrColor; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xbtmpit.hxx b/include/svx/xbtmpit.hxx
new file mode 100644
index 000000000..0882081fb
--- /dev/null
+++ b/include/svx/xbtmpit.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XBTMPIT_HXX
+#define INCLUDED_SVX_XBTMPIT_HXX
+
+#include <svx/svxdllapi.h>
+#include <svx/xdef.hxx>
+#include <svx/xit.hxx>
+#include <vcl/GraphicObject.hxx>
+
+class SdrModel;
+
+
+class SVXCORE_DLLPUBLIC XFillBitmapItem final : public NameOrIndex
+{
+private:
+ GraphicObject maGraphicObject;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ XFillBitmapItem() : NameOrIndex(XATTR_FILLBITMAP, -1 ) {}
+ XFillBitmapItem(const OUString& rName, const GraphicObject& rGraphicObject);
+ XFillBitmapItem( const GraphicObject& rGraphicObject );
+ XFillBitmapItem( const XFillBitmapItem& rItem );
+
+ virtual bool operator==( const SfxPoolItem& rItem ) const override;
+ // no idea why, but this item does not play nice with the sorting optimisation, get failures in sd_import_tests
+ virtual bool IsSortable() const override { return false; }
+ virtual XFillBitmapItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ const GraphicObject& GetGraphicObject() const { return maGraphicObject;}
+ bool isPattern() const;
+
+ static bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
+ std::unique_ptr<XFillBitmapItem> checkForUniqueItem( SdrModel* pModel ) const;
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xcolit.hxx b/include/svx/xcolit.hxx
new file mode 100644
index 000000000..5b882f9a9
--- /dev/null
+++ b/include/svx/xcolit.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XCOLIT_HXX
+#define INCLUDED_SVX_XCOLIT_HXX
+
+#include <tools/color.hxx>
+#include <editeng/colritem.hxx>
+
+#include <svx/svxdllapi.h>
+#include <svx/xit.hxx>
+
+class XColorList;
+
+
+
+class SVXCORE_DLLPUBLIC XColorItem : public NameOrIndex
+{
+ Color aColor;
+ SvxThemeColor maThemeColor;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ XColorItem() {}
+ XColorItem(TypedWhichId<XColorItem> nWhich, sal_Int32 nIndex, const Color& rTheColor);
+ XColorItem(TypedWhichId<XColorItem> nWhich, const Color& rTheColor);
+ XColorItem(TypedWhichId<XColorItem> nWhich, const OUString& rName, const Color& rTheColor);
+ XColorItem(const XColorItem& rItem);
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual bool operator==(const SfxPoolItem& rItem) const override;
+ virtual XColorItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ const Color& GetColorValue() const;
+ void SetColorValue(const Color& rNew) { aColor = rNew; Detach(); }
+
+ SvxThemeColor& GetThemeColor() { return maThemeColor; }
+ const SvxThemeColor& GetThemeColor() const { return maThemeColor; }
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xdash.hxx b/include/svx/xdash.hxx
new file mode 100644
index 000000000..e789830e2
--- /dev/null
+++ b/include/svx/xdash.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XDASH_HXX
+#define INCLUDED_SVX_XDASH_HXX
+
+
+
+
+#include <svx/svxdllapi.h>
+#include <com/sun/star/drawing/DashStyle.hpp>
+
+#include <vector>
+
+class SVXCORE_DLLPUBLIC XDash final
+{
+ css::drawing::DashStyle eDash;
+ sal_uInt16 nDots;
+ sal_uInt16 nDashes;
+ double nDotLen;
+ double nDashLen;
+ double nDistance;
+
+public:
+ XDash(css::drawing::DashStyle eDash = css::drawing::DashStyle_RECT,
+ sal_uInt16 nDots = 1, double nDotLen = 20,
+ sal_uInt16 nDashes = 1, double nDashLen = 20, double nDistance = 20);
+
+ bool operator==(const XDash& rDash) const;
+
+ void SetDashStyle(css::drawing::DashStyle eNewStyle) { eDash = eNewStyle; }
+ void SetDots(sal_uInt16 nNewDots) { nDots = nNewDots; }
+ void SetDotLen(double nNewDotLen) { nDotLen = nNewDotLen; }
+ void SetDashes(sal_uInt16 nNewDashes) { nDashes = nNewDashes; }
+ void SetDashLen(double nNewDashLen) { nDashLen = nNewDashLen; }
+ void SetDistance(double nNewDistance) { nDistance = nNewDistance; }
+
+ css::drawing::DashStyle GetDashStyle() const { return eDash; }
+ sal_uInt16 GetDots() const { return nDots; }
+ double GetDotLen() const { return nDotLen; }
+ sal_uInt16 GetDashes() const { return nDashes; }
+ double GetDashLen() const { return nDashLen; }
+ double GetDistance() const { return nDistance; }
+
+ // XDash is translated into an array of doubles which describe the lengths of the
+ // dashes, dots and empty passages. It returns the complete length of the full DashDot
+ // sequence and fills the given vetor of doubles accordingly (also resizing, so deleting it).
+ double CreateDotDashArray(::std::vector< double >& rDotDashArray, double fLineWidth) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xdef.hxx b/include/svx/xdef.hxx
new file mode 100644
index 000000000..906b566ca
--- /dev/null
+++ b/include/svx/xdef.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XDEF_HXX
+#define INCLUDED_SVX_XDEF_HXX
+
+
+#include <svl/typedwhich.hxx>
+
+/*************************************************************************
+|*
+|* Adding an attribute: Copy line, above which you want to add something,
+|* change the label and add it at the end of the following line, too
+|*
+\************************************************************************/
+
+class SfxMetricItem;
+class XFillAttrSetItem;
+class XFillBackgroundItem;
+class XFillBitmapItem;
+class XFillBmpPosItem;
+class XFillBmpPosOffsetXItem;
+class XFillBmpPosOffsetYItem;
+class XFillBmpSizeLogItem;
+class XFillBmpSizeYItem;
+class XFillBmpStretchItem;
+class XFillBmpTileItem;
+class XFillBmpTileOffsetXItem;
+class XFillBmpTileOffsetYItem;
+class XFillColorItem;
+class XFillFloatTransparenceItem;
+class XFillGradientItem;
+class XFillHatchItem;
+class XFillStyleItem;
+class XFillTransparenceItem;
+class XFillUseSlideBackgroundItem;
+class XFormTextAdjustItem;
+class XFormTextDistanceItem;
+class XFormTextHideFormItem;
+class XFormTextMirrorItem;
+class XFormTextOutlineItem;
+class XFormTextShadowColorItem;
+class XFormTextShadowItem;
+class XFormTextShadowTranspItem;
+class XFormTextShadowXValItem;
+class XFormTextShadowYValItem;
+class XFormTextStartItem;
+class XFormTextStyleItem;
+class XGradientStepCountItem;
+class XLineAttrSetItem;
+class XLineCapItem;
+class XLineColorItem;
+class XLineDashItem;
+class XLineEndCenterItem;
+class XLineEndItem;
+class XLineEndWidthItem;
+class XLineJointItem;
+class XLineStartCenterItem;
+class XLineStartItem;
+class XLineStartWidthItem;
+class XLineStyleItem;
+class XLineTransparenceItem;
+class XLineWidthItem;
+class XSecondaryFillColorItem;
+
+#define COL_DEFAULT_FONT ::Color(0xC9211E) // dark red 2
+#define COL_DEFAULT_FRAMELINE ::Color(0x2A6099) // blue
+#define COL_DEFAULT_HIGHLIGHT ::Color(0xFFFF00) // yellow
+#define COL_DEFAULT_SHAPE_FILLING ::Color(0x729fcf) // light blue 2
+#define COL_DEFAULT_SHAPE_STROKE ::Color(0x3465a4) // dark blue 1
+
+constexpr sal_uInt16 XATTR_START = 1000;
+
+constexpr sal_uInt16 XATTR_LINE_FIRST (XATTR_START); /* V3: 1000 V2: 1000 */
+constexpr TypedWhichId<XLineStyleItem> XATTR_LINESTYLE (XATTR_LINE_FIRST);
+constexpr TypedWhichId<XLineDashItem> XATTR_LINEDASH (XATTR_LINE_FIRST + 1); /* V3: 1001 V2: 1001 */
+constexpr TypedWhichId<XLineWidthItem> XATTR_LINEWIDTH (XATTR_LINE_FIRST + 2); /* V3: 1002 V2: 1002 */
+constexpr TypedWhichId<XLineColorItem> XATTR_LINECOLOR (XATTR_LINE_FIRST + 3); /* V3: 1003 V2: 1003 */
+constexpr TypedWhichId<XLineStartItem> XATTR_LINESTART (XATTR_LINE_FIRST + 4); /* V3: 1004 V2: 1004 */
+constexpr TypedWhichId<XLineEndItem> XATTR_LINEEND (XATTR_LINE_FIRST + 5); /* V3: 1005 V2: 1005 */
+constexpr TypedWhichId<XLineStartWidthItem> XATTR_LINESTARTWIDTH (XATTR_LINE_FIRST + 6); /* V3: 1006 V2: 1006 */
+constexpr TypedWhichId<XLineEndWidthItem> XATTR_LINEENDWIDTH (XATTR_LINE_FIRST + 7); /* V3: 1007 V2: 1007 */
+constexpr TypedWhichId<XLineStartCenterItem> XATTR_LINESTARTCENTER (XATTR_LINE_FIRST + 8); /* V3: 1008 V2: 1008 */
+constexpr TypedWhichId<XLineEndCenterItem> XATTR_LINEENDCENTER (XATTR_LINE_FIRST + 9); /* V3: 1009 V2: 1009 */
+constexpr TypedWhichId<XLineTransparenceItem> XATTR_LINETRANSPARENCE (XATTR_LINE_FIRST + 10); /* V3: 1010 V2: 1010 */
+constexpr TypedWhichId<XLineJointItem> XATTR_LINEJOINT (XATTR_LINE_FIRST + 11); /* V3: 1011 V2: 1011 */
+constexpr TypedWhichId<XLineCapItem> XATTR_LINECAP (XATTR_LINE_FIRST + 12); /* V3: 1012 */
+constexpr sal_uInt16 XATTR_LINE_LAST (XATTR_LINECAP);
+constexpr TypedWhichId<XLineAttrSetItem> XATTRSET_LINE (XATTR_LINE_LAST + 1); /* V3: 1017 V2: 1017 */
+
+constexpr sal_uInt16 XATTR_FILL_FIRST (XATTRSET_LINE + 1); /* V3: 1018 V2: 1018 */
+constexpr TypedWhichId<XFillStyleItem> XATTR_FILLSTYLE (XATTR_FILL_FIRST);
+constexpr TypedWhichId<XFillColorItem> XATTR_FILLCOLOR (XATTR_FILL_FIRST + 1); /* V3: 1019 V2: 1019 */
+constexpr TypedWhichId<XFillGradientItem> XATTR_FILLGRADIENT (XATTR_FILL_FIRST + 2); /* V3: 1020 V2: 1020 */
+constexpr TypedWhichId<XFillHatchItem> XATTR_FILLHATCH (XATTR_FILL_FIRST + 3); /* V3: 1021 V2: 1021 */
+constexpr TypedWhichId<XFillBitmapItem> XATTR_FILLBITMAP (XATTR_FILL_FIRST + 4); /* V3: 1022 V2: 1022 */
+constexpr TypedWhichId<XFillTransparenceItem> XATTR_FILLTRANSPARENCE (XATTR_FILL_FIRST + 5); /* V3: 1023 V2: 1023 */
+constexpr TypedWhichId<XGradientStepCountItem> XATTR_GRADIENTSTEPCOUNT (XATTR_FILL_FIRST + 6); /* V3: 1024 V2: 1024 */
+constexpr TypedWhichId<XFillBmpTileItem> XATTR_FILLBMP_TILE (XATTR_FILL_FIRST + 7); /* V3: 1025 V2: 1025 */
+constexpr TypedWhichId<XFillBmpPosItem> XATTR_FILLBMP_POS (XATTR_FILL_FIRST + 8); /* V3: 1026 V2: 1026 */
+constexpr TypedWhichId<SfxMetricItem> XATTR_FILLBMP_SIZEX (XATTR_FILL_FIRST + 9); /* V3: 1027 V2: 1027 */
+constexpr TypedWhichId<XFillBmpSizeYItem> XATTR_FILLBMP_SIZEY (XATTR_FILL_FIRST + 10); /* V3: 1028 V2: 1028 */
+constexpr TypedWhichId<XFillFloatTransparenceItem> XATTR_FILLFLOATTRANSPARENCE (XATTR_FILL_FIRST + 11); /* V3: 1029 V2: 1029 */
+constexpr TypedWhichId<XSecondaryFillColorItem> XATTR_SECONDARYFILLCOLOR (XATTR_FILL_FIRST + 12); /* V3: 1030 */
+constexpr TypedWhichId<XFillBmpSizeLogItem> XATTR_FILLBMP_SIZELOG (XATTR_FILL_FIRST + 13); /* V3: 1031 */
+constexpr TypedWhichId<XFillBmpTileOffsetXItem> XATTR_FILLBMP_TILEOFFSETX (XATTR_FILL_FIRST + 14); /* V3: 1032 */
+constexpr TypedWhichId<XFillBmpTileOffsetYItem> XATTR_FILLBMP_TILEOFFSETY (XATTR_FILL_FIRST + 15); /* V3: 1033 */
+constexpr TypedWhichId<XFillBmpStretchItem> XATTR_FILLBMP_STRETCH (XATTR_FILL_FIRST + 16); /* V3: 1034 */
+constexpr TypedWhichId<XFillBmpPosOffsetXItem> XATTR_FILLBMP_POSOFFSETX (XATTR_FILL_FIRST + 17); /* V3: 1041 */
+constexpr TypedWhichId<XFillBmpPosOffsetYItem> XATTR_FILLBMP_POSOFFSETY (XATTR_FILL_FIRST + 18); /* V3: 1042 */
+constexpr TypedWhichId<XFillBackgroundItem> XATTR_FILLBACKGROUND (XATTR_FILL_FIRST + 19); /* V3: 1043 */
+constexpr TypedWhichId<XFillUseSlideBackgroundItem> XATTR_FILLUSESLIDEBACKGROUND (XATTR_FILL_FIRST + 20);
+constexpr sal_uInt16 XATTR_FILL_LAST (XATTR_FILLUSESLIDEBACKGROUND);
+constexpr TypedWhichId<XFillAttrSetItem> XATTRSET_FILL (XATTR_FILL_LAST + 1); /* V3: 1047 V2: 1030 */
+
+constexpr sal_uInt16 XATTR_TEXT_FIRST (XATTRSET_FILL + 1);
+constexpr TypedWhichId<XFormTextStyleItem> XATTR_FORMTXTSTYLE (XATTR_TEXT_FIRST); /* V3: 1048 V2: 1031 */
+constexpr TypedWhichId<XFormTextAdjustItem> XATTR_FORMTXTADJUST (XATTR_TEXT_FIRST + 1); /* V3: 1049 V2: 1032 */
+constexpr TypedWhichId<XFormTextDistanceItem> XATTR_FORMTXTDISTANCE (XATTR_TEXT_FIRST + 2); /* V3: 1050 V2: 1033 */
+constexpr TypedWhichId<XFormTextStartItem> XATTR_FORMTXTSTART (XATTR_TEXT_FIRST + 3); /* V3: 1051 V2: 1034 */
+constexpr TypedWhichId<XFormTextMirrorItem> XATTR_FORMTXTMIRROR (XATTR_TEXT_FIRST + 4); /* V3: 1052 V2: 1035 */
+constexpr TypedWhichId<XFormTextOutlineItem> XATTR_FORMTXTOUTLINE (XATTR_TEXT_FIRST + 5); /* V3: 1053 V2: 1036 */
+constexpr TypedWhichId<XFormTextShadowItem> XATTR_FORMTXTSHADOW (XATTR_TEXT_FIRST + 6); /* V3: 1054 V2: 1037 */
+constexpr TypedWhichId<XFormTextShadowColorItem> XATTR_FORMTXTSHDWCOLOR (XATTR_TEXT_FIRST + 7); /* V3: 1055 V2: 1038 */
+constexpr TypedWhichId<XFormTextShadowXValItem> XATTR_FORMTXTSHDWXVAL (XATTR_TEXT_FIRST + 8); /* V3: 1056 V2: 1039 */
+constexpr TypedWhichId<XFormTextShadowYValItem> XATTR_FORMTXTSHDWYVAL (XATTR_TEXT_FIRST + 9); /* V3: 1057 V2: 1040 */
+constexpr TypedWhichId<XFormTextHideFormItem> XATTR_FORMTXTHIDEFORM (XATTR_TEXT_FIRST + 10); /* V3: 1059 V2: 1042 */
+constexpr TypedWhichId<XFormTextShadowTranspItem> XATTR_FORMTXTSHDWTRANSP (XATTR_TEXT_FIRST + 11); /* V3: 1060 V2: 1043 */
+constexpr sal_uInt16 XATTR_TEXT_LAST (XATTR_FORMTXTSHDWTRANSP);
+
+constexpr sal_uInt16 XATTR_END = XATTR_TEXT_LAST;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xenum.hxx b/include/svx/xenum.hxx
new file mode 100644
index 000000000..f3620bdfa
--- /dev/null
+++ b/include/svx/xenum.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XENUM_HXX
+#define INCLUDED_SVX_XENUM_HXX
+
+
+enum class XFormTextStyle { Rotate, Upright, SlantX, SlantY, NONE };
+enum class XFormTextAdjust { Left, Right, AutoSize, Center };
+enum class XFormTextShadow { NONE, Normal, Slant };
+
+
+#endif // INCLUDED_SVX_XENUM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xfillit0.hxx b/include/svx/xfillit0.hxx
new file mode 100644
index 000000000..9f7cf9079
--- /dev/null
+++ b/include/svx/xfillit0.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFILLIT0_HXX
+#define INCLUDED_SVX_XFILLIT0_HXX
+
+#include <svl/eitem.hxx>
+
+#include <svx/svxdllapi.h>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+
+
+
+class SVXCORE_DLLPUBLIC XFillStyleItem final : public SfxEnumItem<css::drawing::FillStyle>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ XFillStyleItem(css::drawing::FillStyle = css::drawing::FillStyle_SOLID);
+
+ virtual XFillStyleItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xfilluseslidebackgrounditem.hxx b/include/svx/xfilluseslidebackgrounditem.hxx
new file mode 100644
index 000000000..86317a903
--- /dev/null
+++ b/include/svx/xfilluseslidebackgrounditem.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+/** Item to enable slide background for filled objects */
+
+class SVXCORE_DLLPUBLIC XFillUseSlideBackgroundItem final : public SfxBoolItem
+{
+public:
+ XFillUseSlideBackgroundItem(bool bFill = false);
+
+ virtual XFillUseSlideBackgroundItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric,
+ MapUnit ePresMetric, OUString& rText,
+ const IntlWrapper&) const override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/svx/xflasit.hxx b/include/svx/xflasit.hxx
new file mode 100644
index 000000000..e3780a31d
--- /dev/null
+++ b/include/svx/xflasit.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLASIT_HXX
+#define INCLUDED_SVX_XFLASIT_HXX
+
+#include <sal/config.h>
+
+#include <svl/setitem.hxx>
+#include <svx/svxdllapi.h>
+
+// SetItem with all ItemSets of fill-attributes
+class SVXCORE_DLLPUBLIC XFillAttrSetItem final : public SfxSetItem
+{
+public:
+ XFillAttrSetItem(SfxItemSet&& pItemSet );
+ XFillAttrSetItem(SfxItemPool* pItemPool);
+ XFillAttrSetItem(const XFillAttrSetItem& rAttr);
+ XFillAttrSetItem(const XFillAttrSetItem& rAttr,
+ SfxItemPool* pItemPool);
+ virtual XFillAttrSetItem* Clone( SfxItemPool* pToPool = nullptr ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflbckit.hxx b/include/svx/xflbckit.hxx
new file mode 100644
index 000000000..59d4e940e
--- /dev/null
+++ b/include/svx/xflbckit.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLBCKIT_HXX
+#define INCLUDED_SVX_XFLBCKIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* Item to enable background for filled objects
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFillBackgroundItem final : public SfxBoolItem
+{
+public:
+ XFillBackgroundItem( bool bFill = false );
+
+ SVX_DLLPRIVATE virtual XFillBackgroundItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ SVX_DLLPRIVATE virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflbmpit.hxx b/include/svx/xflbmpit.hxx
new file mode 100644
index 000000000..ca7c739a7
--- /dev/null
+++ b/include/svx/xflbmpit.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLBMPIT_HXX
+#define INCLUDED_SVX_XFLBMPIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/rectenum.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC XFillBmpPosItem final : public SfxEnumItem<RectPoint>
+{
+public:
+ XFillBmpPosItem( RectPoint eRP = RectPoint::MM );
+
+ SVX_DLLPRIVATE virtual XFillBmpPosItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ SVX_DLLPRIVATE virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ SVX_DLLPRIVATE virtual sal_uInt16 GetValueCount() const override;
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflbmsli.hxx b/include/svx/xflbmsli.hxx
new file mode 100644
index 000000000..9fb283bab
--- /dev/null
+++ b/include/svx/xflbmsli.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLBMSLI_HXX
+#define INCLUDED_SVX_XFLBMSLI_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC XFillBmpSizeLogItem final : public SfxBoolItem
+{
+public:
+ XFillBmpSizeLogItem( bool bLog = true );
+
+ SVX_DLLPRIVATE virtual XFillBmpSizeLogItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ SVX_DLLPRIVATE virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflbmsxy.hxx b/include/svx/xflbmsxy.hxx
new file mode 100644
index 000000000..76611d3bd
--- /dev/null
+++ b/include/svx/xflbmsxy.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLBMSXY_HXX
+#define INCLUDED_SVX_XFLBMSXY_HXX
+
+#include <svl/metitem.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC XFillBmpSizeXItem final : public SfxMetricItem
+{
+public:
+ XFillBmpSizeXItem( tools::Long nSizeX = 0 );
+
+ SVX_DLLPRIVATE virtual XFillBmpSizeXItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ SVX_DLLPRIVATE virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ // This item records both metrical and percentage quotation (negative);
+ // We have to consider that.
+ SVX_DLLPRIVATE virtual bool HasMetrics() const override;
+};
+
+class SVXCORE_DLLPUBLIC XFillBmpSizeYItem final : public SfxMetricItem
+{
+public:
+ XFillBmpSizeYItem( tools::Long nSizeY = 0 );
+
+ SVX_DLLPRIVATE virtual XFillBmpSizeYItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ SVX_DLLPRIVATE virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ // This item records both metrical and percentage quotation (negative);
+ // We have to consider that.
+ SVX_DLLPRIVATE virtual bool HasMetrics() const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflbmtit.hxx b/include/svx/xflbmtit.hxx
new file mode 100644
index 000000000..ab92eca97
--- /dev/null
+++ b/include/svx/xflbmtit.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLBMTIT_HXX
+#define INCLUDED_SVX_XFLBMTIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC XFillBmpTileItem final : public SfxBoolItem
+{
+public:
+ XFillBmpTileItem( bool bTile = true );
+
+ virtual XFillBmpTileItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflboxy.hxx b/include/svx/xflboxy.hxx
new file mode 100644
index 000000000..54d354b52
--- /dev/null
+++ b/include/svx/xflboxy.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLBOXY_HXX
+#define INCLUDED_SVX_XFLBOXY_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC XFillBmpPosOffsetXItem final : public SfxUInt16Item
+{
+public:
+ XFillBmpPosOffsetXItem( sal_uInt16 nOffPosX = 0 );
+
+ SVX_DLLPRIVATE virtual XFillBmpPosOffsetXItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ SVX_DLLPRIVATE virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+class SVXCORE_DLLPUBLIC XFillBmpPosOffsetYItem final : public SfxUInt16Item
+{
+public:
+ XFillBmpPosOffsetYItem( sal_uInt16 nOffPosY = 0 );
+
+ SVX_DLLPRIVATE virtual XFillBmpPosOffsetYItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ SVX_DLLPRIVATE virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflbstit.hxx b/include/svx/xflbstit.hxx
new file mode 100644
index 000000000..3d3f3b28e
--- /dev/null
+++ b/include/svx/xflbstit.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLBSTIT_HXX
+#define INCLUDED_SVX_XFLBSTIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC XFillBmpStretchItem final : public SfxBoolItem
+{
+public:
+ XFillBmpStretchItem( bool bStretch = true );
+
+ virtual XFillBmpStretchItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflbtoxy.hxx b/include/svx/xflbtoxy.hxx
new file mode 100644
index 000000000..b561ab775
--- /dev/null
+++ b/include/svx/xflbtoxy.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLBTOXY_HXX
+#define INCLUDED_SVX_XFLBTOXY_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svxdllapi.h>
+
+class SVXCORE_DLLPUBLIC XFillBmpTileOffsetXItem final : public SfxUInt16Item
+{
+public:
+ XFillBmpTileOffsetXItem( sal_uInt16 nOffX = 0 );
+
+ SVX_DLLPRIVATE virtual XFillBmpTileOffsetXItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ SVX_DLLPRIVATE virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+class SVXCORE_DLLPUBLIC XFillBmpTileOffsetYItem final : public SfxUInt16Item
+{
+public:
+ XFillBmpTileOffsetYItem( sal_uInt16 nOffX = 0 );
+
+ SVX_DLLPRIVATE virtual XFillBmpTileOffsetYItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ SVX_DLLPRIVATE virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflclit.hxx b/include/svx/xflclit.hxx
new file mode 100644
index 000000000..df6b302d3
--- /dev/null
+++ b/include/svx/xflclit.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLCLIT_HXX
+#define INCLUDED_SVX_XFLCLIT_HXX
+
+#include <svx/xcolit.hxx>
+#include <svx/svxdllapi.h>
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Fuellattribute
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
+
+class SVXCORE_DLLPUBLIC XFillColorItem final : public XColorItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XFillColorItem() {}
+ XFillColorItem(sal_Int32 nIndex, const Color& rTheColor);
+ XFillColorItem(const OUString& rName, const Color& rTheColor);
+
+ virtual XFillColorItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflftrit.hxx b/include/svx/xflftrit.hxx
new file mode 100644
index 000000000..bd8a54a24
--- /dev/null
+++ b/include/svx/xflftrit.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLFTRIT_HXX
+#define INCLUDED_SVX_XFLFTRIT_HXX
+
+#include <svx/xflgrit.hxx>
+#include <svx/svxdllapi.h>
+#include <boost/property_tree/ptree_fwd.hpp>
+
+
+
+
+class SVXCORE_DLLPUBLIC XFillFloatTransparenceItem final : public XFillGradientItem
+{
+private:
+
+ bool bEnabled;
+
+public:
+
+ static SfxPoolItem* CreateDefault();
+ XFillFloatTransparenceItem();
+ XFillFloatTransparenceItem(const OUString& rName, const XGradient& rGradient, bool bEnable = true );
+ XFillFloatTransparenceItem( const XGradient& rTheGradient, bool bEnable = true );
+ XFillFloatTransparenceItem( const XFillFloatTransparenceItem& rItem );
+
+ virtual bool operator==( const SfxPoolItem& rItem ) const override;
+ virtual XFillFloatTransparenceItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric,
+ MapUnit ePresMetric, OUString &rText, const IntlWrapper& rIntlWrapper ) const override;
+
+ bool IsEnabled() const { return bEnabled; }
+ void SetEnabled( bool bEnable ) { bEnabled = bEnable; }
+
+ static bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
+ std::unique_ptr<XFillFloatTransparenceItem> checkForUniqueItem( SdrModel* pModel ) const;
+
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflgrit.hxx b/include/svx/xflgrit.hxx
new file mode 100644
index 000000000..0c02e44a8
--- /dev/null
+++ b/include/svx/xflgrit.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLGRIT_HXX
+#define INCLUDED_SVX_XFLGRIT_HXX
+
+#include <svx/xdef.hxx>
+#include <svx/xit.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/svxdllapi.h>
+
+class SdrModel;
+
+
+
+class SVXCORE_DLLPUBLIC XFillGradientItem : public NameOrIndex
+{
+ XGradient aGradient;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ XFillGradientItem() : NameOrIndex(XATTR_FILLGRADIENT, -1) {}
+ XFillGradientItem(sal_Int32 nIndex, const XGradient& rTheGradient);
+ XFillGradientItem(const OUString& rName, const XGradient& rTheGradient, TypedWhichId<XFillGradientItem> nWhich = XATTR_FILLGRADIENT);
+ XFillGradientItem(const XGradient& rTheGradient);
+ XFillGradientItem(const XFillGradientItem& rItem);
+
+ virtual bool operator==(const SfxPoolItem& rItem) const override;
+ virtual XFillGradientItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ const XGradient& GetGradientValue() const; // GetValue -> GetGradientValue
+ void SetGradientValue(const XGradient& rNew) { aGradient = rNew; Detach(); } // SetValue -> SetGradientValue
+
+ static bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
+ std::unique_ptr<XFillGradientItem> checkForUniqueItem( SdrModel* pModel ) const;
+
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflhtit.hxx b/include/svx/xflhtit.hxx
new file mode 100644
index 000000000..9eb880541
--- /dev/null
+++ b/include/svx/xflhtit.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLHTIT_HXX
+#define INCLUDED_SVX_XFLHTIT_HXX
+
+#include <svx/xdef.hxx>
+#include <svx/xit.hxx>
+#include <svx/xhatch.hxx>
+#include <svx/svxdllapi.h>
+
+class SdrModel;
+
+
+
+class SVXCORE_DLLPUBLIC XFillHatchItem final : public NameOrIndex
+{
+ XHatch aHatch;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ XFillHatchItem() : NameOrIndex(XATTR_FILLHATCH, -1) {}
+ XFillHatchItem(const OUString& rName, const XHatch& rTheHatch);
+ XFillHatchItem(const XHatch& rTheHatch);
+ XFillHatchItem(const XFillHatchItem& rItem);
+
+ virtual bool operator==(const SfxPoolItem& rItem) const override;
+ virtual XFillHatchItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ virtual bool HasMetrics() const override;
+ virtual void ScaleMetrics(tools::Long nMul, tools::Long nDiv) override;
+
+ const XHatch& GetHatchValue() const { return aHatch;} // GetValue -> GetHatchValue
+
+ static bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
+ std::unique_ptr<XFillHatchItem> checkForUniqueItem( SdrModel* pModel ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xfltrit.hxx b/include/svx/xfltrit.hxx
new file mode 100644
index 000000000..55128b495
--- /dev/null
+++ b/include/svx/xfltrit.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFLTRIT_HXX
+#define INCLUDED_SVX_XFLTRIT_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* transparency-Item for contents (Solid)
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFillTransparenceItem final : public SfxUInt16Item
+{
+public:
+ XFillTransparenceItem(sal_uInt16 nFillTransparence = 0);
+ virtual XFillTransparenceItem* Clone(SfxItemPool* pPool = nullptr) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xftadit.hxx b/include/svx/xftadit.hxx
new file mode 100644
index 000000000..27773a49d
--- /dev/null
+++ b/include/svx/xftadit.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFTADIT_HXX
+#define INCLUDED_SVX_XFTADIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/xenum.hxx>
+
+/*************************************************************************
+|*
+|* FormText-AdjustItem
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFormTextAdjustItem final : public SfxEnumItem<XFormTextAdjust>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ XFormTextAdjustItem(XFormTextAdjust = XFormTextAdjust::Center);
+ virtual XFormTextAdjustItem* Clone(SfxItemPool* pPool = nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+ // #FontWork#
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xftdiit.hxx b/include/svx/xftdiit.hxx
new file mode 100644
index 000000000..d77323e78
--- /dev/null
+++ b/include/svx/xftdiit.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFTDIIT_HXX
+#define INCLUDED_SVX_XFTDIIT_HXX
+
+#include <svl/metitem.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* FormText-DistanceItem
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFormTextDistanceItem final : public SfxMetricItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XFormTextDistanceItem(tools::Long nDist = 0);
+ virtual XFormTextDistanceItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xftmrit.hxx b/include/svx/xftmrit.hxx
new file mode 100644
index 000000000..3cac10212
--- /dev/null
+++ b/include/svx/xftmrit.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFTMRIT_HXX
+#define INCLUDED_SVX_XFTMRIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* FormText-MirrorItem
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFormTextMirrorItem final : public SfxBoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XFormTextMirrorItem(bool bMirror = false);
+ virtual XFormTextMirrorItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xftouit.hxx b/include/svx/xftouit.hxx
new file mode 100644
index 000000000..2225e3552
--- /dev/null
+++ b/include/svx/xftouit.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFTOUIT_HXX
+#define INCLUDED_SVX_XFTOUIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svl/poolitem.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* FormText-OutlineItem
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFormTextOutlineItem final : public SfxBoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ XFormTextOutlineItem(bool bOutline = false);
+ virtual XFormTextOutlineItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xftshcit.hxx b/include/svx/xftshcit.hxx
new file mode 100644
index 000000000..cfaccbfad
--- /dev/null
+++ b/include/svx/xftshcit.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFTSHCIT_HXX
+#define INCLUDED_SVX_XFTSHCIT_HXX
+
+#include <svx/xcolit.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* FormText-ShadowColorItem
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFormTextShadowColorItem final : public XColorItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XFormTextShadowColorItem() {}
+ XFormTextShadowColorItem(const OUString& rName, const Color& rTheColor);
+
+ virtual XFormTextShadowColorItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xftshit.hxx b/include/svx/xftshit.hxx
new file mode 100644
index 000000000..e951a6908
--- /dev/null
+++ b/include/svx/xftshit.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFTSHIT_HXX
+#define INCLUDED_SVX_XFTSHIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/xenum.hxx>
+
+/*************************************************************************
+|*
+|* FormText-ShadowItem
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFormTextShadowItem final : public SfxEnumItem<XFormTextShadow>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ XFormTextShadowItem(XFormTextShadow = XFormTextShadow::NONE);
+ virtual XFormTextShadowItem* Clone(SfxItemPool* pPool = nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+ // #FontWork#
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xftshxy.hxx b/include/svx/xftshxy.hxx
new file mode 100644
index 000000000..2e7cbe663
--- /dev/null
+++ b/include/svx/xftshxy.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFTSHXY_HXX
+#define INCLUDED_SVX_XFTSHXY_HXX
+
+#include <svl/metitem.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* FormText-ShadowXValItem
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFormTextShadowXValItem final : public SfxMetricItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ XFormTextShadowXValItem(tools::Long nVal = 0);
+ virtual XFormTextShadowXValItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+/*************************************************************************
+|*
+|* FormText-ShadowYValItem
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFormTextShadowYValItem final : public SfxMetricItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XFormTextShadowYValItem(tools::Long nVal = 0);
+ virtual XFormTextShadowYValItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xftstit.hxx b/include/svx/xftstit.hxx
new file mode 100644
index 000000000..bc9243968
--- /dev/null
+++ b/include/svx/xftstit.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XFTSTIT_HXX
+#define INCLUDED_SVX_XFTSTIT_HXX
+
+#include <svl/metitem.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* FormText-StartPositionItem
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFormTextStartItem final : public SfxMetricItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ XFormTextStartItem(tools::Long nStart = 0);
+ virtual XFormTextStartItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xgrad.hxx b/include/svx/xgrad.hxx
new file mode 100644
index 000000000..93a2f0065
--- /dev/null
+++ b/include/svx/xgrad.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XGRAD_HXX
+#define INCLUDED_SVX_XGRAD_HXX
+
+#include <tools/color.hxx>
+#include <tools/degree.hxx>
+#include <svx/svxdllapi.h>
+#include <com/sun/star/awt/GradientStyle.hpp>
+#include <boost/property_tree/ptree_fwd.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+
+class Gradient;
+
+class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC XGradient final
+{
+ css::awt::GradientStyle eStyle;
+ Color aStartColor;
+ Color aEndColor;
+ Degree10 nAngle;
+ sal_uInt16 nBorder;
+ sal_uInt16 nOfsX;
+ sal_uInt16 nOfsY;
+ sal_uInt16 nIntensStart;
+ sal_uInt16 nIntensEnd;
+ sal_uInt16 nStepCount;
+
+ static std::string GradientStyleToString(css::awt::GradientStyle eStyle);
+
+public:
+ XGradient();
+ XGradient( const Color& rStart, const Color& rEnd,
+ css::awt::GradientStyle eStyle = css::awt::GradientStyle_LINEAR, Degree10 nAngle = 0_deg10,
+ sal_uInt16 nXOfs = 50, sal_uInt16 nYOfs = 50, sal_uInt16 nBorder = 0,
+ sal_uInt16 nStartIntens = 100, sal_uInt16 nEndIntens = 100,
+ sal_uInt16 nSteps = 0 );
+
+ bool operator==(const XGradient& rGradient) const;
+
+ void SetGradientStyle(css::awt::GradientStyle eNewStyle) { eStyle = eNewStyle; }
+ void SetStartColor(const Color& rColor) { aStartColor = rColor; }
+ void SetEndColor(const Color& rColor) { aEndColor = rColor; }
+ void SetAngle(Degree10 nNewAngle) { nAngle = nNewAngle; }
+ void SetBorder(sal_uInt16 nNewBorder) { nBorder = nNewBorder; }
+ void SetXOffset(sal_uInt16 nNewOffset) { nOfsX = nNewOffset; }
+ void SetYOffset(sal_uInt16 nNewOffset) { nOfsY = nNewOffset; }
+ void SetStartIntens(sal_uInt16 nNewIntens) { nIntensStart = nNewIntens; }
+ void SetEndIntens(sal_uInt16 nNewIntens) { nIntensEnd = nNewIntens; }
+ void SetSteps(sal_uInt16 nSteps) { nStepCount = nSteps; }
+
+ css::awt::GradientStyle GetGradientStyle() const { return eStyle; }
+ const Color& GetStartColor() const { return aStartColor; }
+ const Color& GetEndColor() const { return aEndColor; }
+ Degree10 GetAngle() const { return nAngle; }
+ sal_uInt16 GetBorder() const { return nBorder; }
+ sal_uInt16 GetXOffset() const { return nOfsX; }
+ sal_uInt16 GetYOffset() const { return nOfsY; }
+ sal_uInt16 GetStartIntens() const { return nIntensStart; }
+ sal_uInt16 GetEndIntens() const { return nIntensEnd; }
+ sal_uInt16 GetSteps() const { return nStepCount; }
+
+ boost::property_tree::ptree dumpAsJSON() const;
+ static XGradient fromJSON(const OUString& rJSON);
+ css::awt::Gradient toGradientUNO() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xgrscit.hxx b/include/svx/xgrscit.hxx
new file mode 100644
index 000000000..92e0c099b
--- /dev/null
+++ b/include/svx/xgrscit.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XGRSCIT_HXX
+#define INCLUDED_SVX_XGRSCIT_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* Gradient step item for gradient fills
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XGradientStepCountItem final : public SfxUInt16Item
+{
+public:
+ XGradientStepCountItem( sal_uInt16 nStepCount = 0 );
+ virtual XGradientStepCountItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xhatch.hxx b/include/svx/xhatch.hxx
new file mode 100644
index 000000000..1553141e5
--- /dev/null
+++ b/include/svx/xhatch.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XHATCH_HXX
+#define INCLUDED_SVX_XHATCH_HXX
+
+#include <tools/color.hxx>
+#include <tools/degree.hxx>
+#include <tools/long.hxx>
+#include <svx/svxdllapi.h>
+#include <com/sun/star/drawing/HatchStyle.hpp>
+
+
+
+
+class SVXCORE_DLLPUBLIC XHatch final
+{
+ css::drawing::HatchStyle eStyle;
+ Color aColor;
+ tools::Long nDistance;
+ Degree10 nAngle;
+
+public:
+ XHatch() : eStyle(css::drawing::HatchStyle_SINGLE), nDistance(0), nAngle(0) {}
+ XHatch(const Color& rCol, css::drawing::HatchStyle eStyle = css::drawing::HatchStyle_SINGLE,
+ tools::Long nDistance = 20, Degree10 nAngle = 0_deg10);
+
+ bool operator==(const XHatch& rHatch) const;
+
+ void SetHatchStyle(css::drawing::HatchStyle eNewStyle) { eStyle = eNewStyle; }
+ void SetColor(const Color& rColor) { aColor = rColor; }
+ void SetDistance(tools::Long nNewDistance) { nDistance = nNewDistance; }
+ void SetAngle(Degree10 nNewAngle) { nAngle = nNewAngle; }
+
+ css::drawing::HatchStyle GetHatchStyle() const { return eStyle; }
+ const Color& GetColor() const { return aColor; }
+ tools::Long GetDistance() const { return nDistance; }
+ Degree10 GetAngle() const { return nAngle; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xit.hxx b/include/svx/xit.hxx
new file mode 100644
index 000000000..f6b19595a
--- /dev/null
+++ b/include/svx/xit.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XIT_HXX
+#define INCLUDED_SVX_XIT_HXX
+
+#include <svl/stritem.hxx>
+#include <svx/xtable.hxx>
+#include <svx/svxdllapi.h>
+#include <unotools/resmgr.hxx>
+
+/************************************************************************/
+
+class SfxItemPool;
+class NameOrIndex;
+
+typedef bool (*SvxCompareValueFunc)( const NameOrIndex* p1, const NameOrIndex* p2 );
+
+
+
+class SVXCORE_DLLPUBLIC NameOrIndex : public SfxStringItem
+{
+ sal_Int32 nPalIndex;
+
+protected:
+ void Detach() { nPalIndex = -1; }
+
+public:
+ NameOrIndex() { nPalIndex = -1; }
+ NameOrIndex(TypedWhichId<NameOrIndex> nWhich, sal_Int32 nIndex);
+ NameOrIndex(TypedWhichId<NameOrIndex> nWhich, const OUString& rName);
+ NameOrIndex(const NameOrIndex& rNameOrIndex);
+
+ virtual bool operator==(const SfxPoolItem& rItem) const override;
+ virtual NameOrIndex* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ OUString const & GetName() const { return GetValue(); }
+ void SetName(const OUString& rName) { SetValue(rName); }
+ bool IsIndex() const { return (nPalIndex >= 0); }
+ sal_Int32 GetPalIndex() const { return nPalIndex; }
+
+ /** this static checks if the given NameOrIndex item has a unique name for its value.
+ The returned String is a unique name for an item with this value in both given pools.
+ Argument pPool2 can be null.
+ If returned string equals NameOrIndex->GetName(), the name was already unique.
+ */
+ static OUString CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, SvxCompareValueFunc pCompareValueFunc, TranslateId pPrefixResId, const XPropertyListRef &pDefaults );
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlineit0.hxx b/include/svx/xlineit0.hxx
new file mode 100644
index 000000000..ab8e26561
--- /dev/null
+++ b/include/svx/xlineit0.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLINEIT0_HXX
+#define INCLUDED_SVX_XLINEIT0_HXX
+
+#include <svl/eitem.hxx>
+
+
+#include <svx/svxdllapi.h>
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+class SVXCORE_DLLPUBLIC XLineStyleItem final : public SfxEnumItem<css::drawing::LineStyle>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XLineStyleItem(css::drawing::LineStyle = css::drawing::LineStyle_SOLID);
+ virtual XLineStyleItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlinjoit.hxx b/include/svx/xlinjoit.hxx
new file mode 100644
index 000000000..b495ecf25
--- /dev/null
+++ b/include/svx/xlinjoit.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLINJOIT_HXX
+#define INCLUDED_SVX_XLINJOIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+#include <com/sun/star/drawing/LineJoint.hpp>
+
+
+
+
+class SVXCORE_DLLPUBLIC XLineJointItem final : public SfxEnumItem<css::drawing::LineJoint>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XLineJointItem( css::drawing::LineJoint eLineJoint = css::drawing::LineJoint_ROUND );
+
+ virtual XLineJointItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric, MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ virtual sal_uInt16 GetValueCount() const override;
+};
+
+#endif // INCLUDED_SVX_XLINJOIT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlnasit.hxx b/include/svx/xlnasit.hxx
new file mode 100644
index 000000000..e388c2965
--- /dev/null
+++ b/include/svx/xlnasit.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNASIT_HXX
+#define INCLUDED_SVX_XLNASIT_HXX
+
+#include <sal/config.h>
+
+#include <svl/setitem.hxx>
+#include <svx/svxdllapi.h>
+
+// SetItem with all ItemSets of line-attributes
+class SVXCORE_DLLPUBLIC XLineAttrSetItem final : public SfxSetItem
+{
+public:
+ XLineAttrSetItem(SfxItemSet&& pItemSet );
+ XLineAttrSetItem(SfxItemPool* pItemPool);
+ XLineAttrSetItem(const XLineAttrSetItem& rAttr);
+ XLineAttrSetItem(const XLineAttrSetItem& rAttr,
+ SfxItemPool* pItemPool);
+ virtual XLineAttrSetItem* Clone( SfxItemPool* pToPool = nullptr ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlncapit.hxx b/include/svx/xlncapit.hxx
new file mode 100644
index 000000000..7311d0d06
--- /dev/null
+++ b/include/svx/xlncapit.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNCAPIT_HXX
+#define INCLUDED_SVX_XLNCAPIT_HXX
+
+#include <svx/svxdllapi.h>
+#include <svl/eitem.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+
+
+
+
+class SVXCORE_DLLPUBLIC XLineCapItem final : public SfxEnumItem<css::drawing::LineCap>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XLineCapItem(css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT);
+
+ virtual XLineCapItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric, MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ css::drawing::LineCap GetValue() const;
+ virtual sal_uInt16 GetValueCount() const override;
+};
+
+#endif // INCLUDED_SVX_XLNCAPIT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlnclit.hxx b/include/svx/xlnclit.hxx
new file mode 100644
index 000000000..7de9bc8b6
--- /dev/null
+++ b/include/svx/xlnclit.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNCLIT_HXX
+#define INCLUDED_SVX_XLNCLIT_HXX
+
+#include <svx/xcolit.hxx>
+#include <svx/svxdllapi.h>
+
+
+
+class SVXCORE_DLLPUBLIC XLineColorItem final : public XColorItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XLineColorItem() {}
+ XLineColorItem(sal_Int32 nIndex, const Color& rTheColor);
+ XLineColorItem(const OUString& rName, const Color& rTheColor);
+
+ virtual XLineColorItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlndsit.hxx b/include/svx/xlndsit.hxx
new file mode 100644
index 000000000..04b40d41f
--- /dev/null
+++ b/include/svx/xlndsit.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNDSIT_HXX
+#define INCLUDED_SVX_XLNDSIT_HXX
+
+#include <svx/xdef.hxx>
+#include <svx/xit.hxx>
+
+#include <svx/xdash.hxx>
+#include <svx/svxdllapi.h>
+
+class SdrModel;
+
+
+
+class SVXCORE_DLLPUBLIC XLineDashItem final : public NameOrIndex
+{
+ XDash aDash;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ XLineDashItem() : NameOrIndex(XATTR_LINEDASH, -1) {}
+ XLineDashItem(const OUString& rName, const XDash& rTheDash);
+ XLineDashItem(const XDash& rTheDash);
+ XLineDashItem(const XLineDashItem& rItem);
+
+ virtual bool operator==(const SfxPoolItem& rItem) const override;
+ virtual XLineDashItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+ virtual bool HasMetrics() const override;
+ virtual void ScaleMetrics(tools::Long nMul, tools::Long nDiv) override;
+
+ const XDash& GetDashValue() const { return aDash;}
+ void SetDashValue(const XDash& rNew) { aDash = rNew; Detach(); } // SetValue -> SetDashValue
+
+ static bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
+ std::unique_ptr<XLineDashItem> checkForUniqueItem( SdrModel* pModel ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlnedcit.hxx b/include/svx/xlnedcit.hxx
new file mode 100644
index 000000000..fde707675
--- /dev/null
+++ b/include/svx/xlnedcit.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNEDCIT_HXX
+#define INCLUDED_SVX_XLNEDCIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+
+
+class SVXCORE_DLLPUBLIC XLineEndCenterItem final : public SfxBoolItem
+{
+public:
+ XLineEndCenterItem(bool bEndCenter = false);
+ virtual XLineEndCenterItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlnedit.hxx b/include/svx/xlnedit.hxx
new file mode 100644
index 000000000..9a43e14f3
--- /dev/null
+++ b/include/svx/xlnedit.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNEDIT_HXX
+#define INCLUDED_SVX_XLNEDIT_HXX
+
+#include <svx/xit.hxx>
+#include <svx/svxdllapi.h>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+class SdrModel;
+
+
+
+class SVXCORE_DLLPUBLIC XLineEndItem final : public NameOrIndex
+{
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ XLineEndItem(sal_Int32 nIndex = -1);
+ XLineEndItem(const OUString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon);
+ XLineEndItem(const basegfx::B2DPolyPolygon& rPolyPolygon);
+ XLineEndItem(const XLineEndItem& rItem);
+
+ virtual bool operator==(const SfxPoolItem& rItem) const override;
+ virtual XLineEndItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ const basegfx::B2DPolyPolygon& GetLineEndValue() const { return maPolyPolygon;}
+ void SetLineEndValue(const basegfx::B2DPolyPolygon& rPolyPolygon) { maPolyPolygon = rPolyPolygon; Detach(); }
+
+ std::unique_ptr<XLineEndItem> checkForUniqueItem( SdrModel* pModel ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlnedwit.hxx b/include/svx/xlnedwit.hxx
new file mode 100644
index 000000000..a049794f3
--- /dev/null
+++ b/include/svx/xlnedwit.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNEDWIT_HXX
+#define INCLUDED_SVX_XLNEDWIT_HXX
+
+#include <svl/metitem.hxx>
+#include <svx/svxdllapi.h>
+
+#define LINE_END_WIDTH_DEFAULT (200)
+
+
+
+
+class SVXCORE_DLLPUBLIC XLineEndWidthItem final : public SfxMetricItem
+{
+public:
+ XLineEndWidthItem(tools::Long nWidth = LINE_END_WIDTH_DEFAULT);
+ virtual XLineEndWidthItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlnstcit.hxx b/include/svx/xlnstcit.hxx
new file mode 100644
index 000000000..a48307cab
--- /dev/null
+++ b/include/svx/xlnstcit.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNSTCIT_HXX
+#define INCLUDED_SVX_XLNSTCIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+
+
+class SVXCORE_DLLPUBLIC XLineStartCenterItem final : public SfxBoolItem
+{
+public:
+ XLineStartCenterItem(bool bStartCenter = false);
+ virtual XLineStartCenterItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlnstit.hxx b/include/svx/xlnstit.hxx
new file mode 100644
index 000000000..859fdcbe7
--- /dev/null
+++ b/include/svx/xlnstit.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNSTIT_HXX
+#define INCLUDED_SVX_XLNSTIT_HXX
+
+#include <svx/xit.hxx>
+#include <svx/svxdllapi.h>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+class SdrModel;
+
+
+
+class SVXCORE_DLLPUBLIC XLineStartItem final : public NameOrIndex
+{
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ XLineStartItem(sal_Int32 nIndex = -1);
+ XLineStartItem(const OUString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon);
+ XLineStartItem(const basegfx::B2DPolyPolygon& rPolyPolygon);
+ XLineStartItem(const XLineStartItem& rItem);
+
+ virtual bool operator==(const SfxPoolItem& rItem) const override;
+ virtual XLineStartItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ const basegfx::B2DPolyPolygon& GetLineStartValue() const { return maPolyPolygon;}
+ void SetLineStartValue(const basegfx::B2DPolyPolygon& rPolyPolygon) { maPolyPolygon = rPolyPolygon; Detach(); }
+
+ std::unique_ptr<XLineStartItem> checkForUniqueItem( SdrModel* pModel ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlnstwit.hxx b/include/svx/xlnstwit.hxx
new file mode 100644
index 000000000..c6803e371
--- /dev/null
+++ b/include/svx/xlnstwit.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNSTWIT_HXX
+#define INCLUDED_SVX_XLNSTWIT_HXX
+
+#include <svl/metitem.hxx>
+#include <svx/svxdllapi.h>
+
+#define LINE_START_WIDTH_DEFAULT (200)
+
+
+
+class SVXCORE_DLLPUBLIC XLineStartWidthItem final : public SfxMetricItem
+{
+public:
+ XLineStartWidthItem(tools::Long nWidth = LINE_START_WIDTH_DEFAULT);
+ virtual XLineStartWidthItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlntrit.hxx b/include/svx/xlntrit.hxx
new file mode 100644
index 000000000..c7eca5815
--- /dev/null
+++ b/include/svx/xlntrit.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNTRIT_HXX
+#define INCLUDED_SVX_XLNTRIT_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* Transparency item for lines
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XLineTransparenceItem final : public SfxUInt16Item
+{
+public:
+ XLineTransparenceItem(sal_uInt16 nLineTransparence = 0);
+ virtual XLineTransparenceItem* Clone(SfxItemPool* pPool = nullptr) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xlnwtit.hxx b/include/svx/xlnwtit.hxx
new file mode 100644
index 000000000..21df71b8a
--- /dev/null
+++ b/include/svx/xlnwtit.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XLNWTIT_HXX
+#define INCLUDED_SVX_XLNWTIT_HXX
+
+#include <svl/metitem.hxx>
+#include <svx/svxdllapi.h>
+
+
+
+class SVXCORE_DLLPUBLIC XLineWidthItem final : public SfxMetricItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XLineWidthItem(tools::Long nWidth = 0);
+ virtual XLineWidthItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xmleohlp.hxx b/include/svx/xmleohlp.hxx
new file mode 100644
index 000000000..55682f16c
--- /dev/null
+++ b/include/svx/xmleohlp.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XMLEOHLP_HXX
+#define INCLUDED_SVX_XMLEOHLP_HXX
+
+#include <comphelper/compbase.hxx>
+#include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <svx/svxdllapi.h>
+#include <rtl/ref.hxx>
+#include <tools/stream.hxx>
+#include <map>
+#include <optional>
+
+enum class SvXMLEmbeddedObjectHelperMode
+{
+ Read, Write
+};
+
+namespace comphelper { class IEmbeddedHelper; }
+
+class SvGlobalName;
+class OutputStorageWrapper_Impl;
+
+
+class SVXCORE_DLLPUBLIC SvXMLEmbeddedObjectHelper final :
+ public comphelper::WeakComponentImplHelper< css::document::XEmbeddedObjectResolver, css::container::XNameAccess >
+{
+ OUString maCurContainerStorageName;
+
+
+ css::uno::Reference < css::embed::XStorage > mxRootStorage; // package
+ ::comphelper::IEmbeddedHelper* mpDocPersist;
+ css::uno::Reference < css::embed::XStorage > mxContainerStorage; // container sub package for
+ css::uno::Reference < css::embed::XStorage > mxTempStorage; // package
+ // objects
+ SvXMLEmbeddedObjectHelperMode meCreateMode;
+ std::optional<std::map< OUString, rtl::Reference<OutputStorageWrapper_Impl> >>
+ mxStreamMap;
+
+ SVX_DLLPRIVATE bool ImplGetStorageNames(
+ const OUString& rURLStr,
+ OUString& rContainerStorageName,
+ OUString& rObjectStorageName,
+ bool bInternalToExternal,
+ bool *pGraphicRepl=nullptr,
+ bool *pOasisFormat=nullptr ) const;
+
+ SVX_DLLPRIVATE css::uno::Reference < css::embed::XStorage > const & ImplGetContainerStorage(
+ const OUString& rStorageName );
+
+ SVX_DLLPRIVATE void ImplReadObject(
+ const OUString& rContainerStorageName,
+ OUString& rObjName,
+ const SvGlobalName *pClassId,
+ SvStream* pTemp );
+
+ SVX_DLLPRIVATE OUString ImplInsertEmbeddedObjectURL(
+ const OUString& rURLStr );
+
+ SVX_DLLPRIVATE css::uno::Reference< css::io::XInputStream > ImplGetReplacementImage(
+ const css::uno::Reference< css::embed::XEmbeddedObject >& xObj );
+
+ SvXMLEmbeddedObjectHelper();
+ virtual ~SvXMLEmbeddedObjectHelper() override;
+ void Init( const css::uno::Reference < css::embed::XStorage >&,
+ ::comphelper::IEmbeddedHelper& rDocPersist,
+ SvXMLEmbeddedObjectHelperMode eCreateMode );
+
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
+
+public:
+ SvXMLEmbeddedObjectHelper(
+ ::comphelper::IEmbeddedHelper& rDocPersist,
+ SvXMLEmbeddedObjectHelperMode eCreateMode );
+
+ static rtl::Reference<SvXMLEmbeddedObjectHelper> Create(
+ const css::uno::Reference < css::embed::XStorage >&,
+ ::comphelper::IEmbeddedHelper& rDocPersist,
+ SvXMLEmbeddedObjectHelperMode eCreateMode );
+ static rtl::Reference<SvXMLEmbeddedObjectHelper> Create(
+ ::comphelper::IEmbeddedHelper& rDocPersist,
+ SvXMLEmbeddedObjectHelperMode eCreateMode );
+
+ // XEmbeddedObjectResolver
+ virtual OUString SAL_CALL resolveEmbeddedObjectURL( const OUString& aURL ) override;
+
+ // XNameAccess
+ virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
+
+ // XNameAccess
+ virtual css::uno::Type SAL_CALL getElementType( ) override;
+ virtual sal_Bool SAL_CALL hasElements( ) override;
+
+
+ static void splitObjectURL(const OUString& aURLNoPar,
+ OUString& rContainerStorageName,
+ OUString& rObjectStorageName);
+};
+
+#endif // INCLUDED_SVX_XMLEOHLP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xmlexchg.hxx b/include/svx/xmlexchg.hxx
new file mode 100644
index 000000000..e03bdb4cf
--- /dev/null
+++ b/include/svx/xmlexchg.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XMLEXCHG_HXX
+#define INCLUDED_SVX_XMLEXCHG_HXX
+
+#include <rtl/ustring.hxx>
+#include <vcl/transfer.hxx>
+#include <svx/svxdllapi.h>
+
+namespace com::sun::star::beans {
+ class SAL_NO_VTABLE XPropertySet;
+}
+
+
+namespace svx
+{
+
+
+ //= OXFormsDescriptor
+
+
+ struct SVXCORE_DLLPUBLIC OXFormsDescriptor {
+
+ OUString szName;
+ OUString szServiceName;
+ css::uno::Reference< css::beans::XPropertySet > xPropSet;
+
+ OXFormsDescriptor() {}
+ OXFormsDescriptor( const OXFormsDescriptor &rhs ) { *this=rhs; }
+ OXFormsDescriptor &operator = ( const OXFormsDescriptor &rhs ) {
+ szName = rhs.szName;
+ szServiceName = rhs.szServiceName;
+ xPropSet = rhs.xPropSet;
+ return (*this);
+ }
+ };
+
+
+ //= OXFormsTransferable
+
+ class SVXCORE_DLLPUBLIC OXFormsTransferable final : public TransferDataContainer {
+
+ // TransferableHelper overridables
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+
+ OXFormsDescriptor m_aDescriptor;
+
+ public:
+
+ /** construct the transferable
+ */
+ OXFormsTransferable( const OXFormsDescriptor &rhs );
+
+ /** extracts an xform descriptor from the transferable given
+ */
+ static const OXFormsDescriptor &extractDescriptor( const TransferableDataHelper& _rData );
+ };
+
+
+}
+
+
+#endif // INCLUDED_SVX_XMLEXCHG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xmlgrhlp.hxx b/include/svx/xmlgrhlp.hxx
new file mode 100644
index 000000000..0e54e1cb1
--- /dev/null
+++ b/include/svx/xmlgrhlp.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XMLGRHLP_HXX
+#define INCLUDED_SVX_XMLGRHLP_HXX
+
+#include <comphelper/compbase.hxx>
+#include <vcl/graph.hxx>
+#include <rtl/ref.hxx>
+
+#include <string_view>
+#include <vector>
+#include <unordered_map>
+#include <utility>
+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
+#include <com/sun/star/document/XGraphicStorageHandler.hpp>
+#include <com/sun/star/document/XBinaryStreamResolver.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <svx/svxdllapi.h>
+
+enum class SvXMLGraphicHelperMode
+{
+ Read, Write
+};
+
+struct SvxGraphicHelperStream_Impl
+{
+ css::uno::Reference < css::embed::XStorage > xStorage;
+ css::uno::Reference < css::io::XStream > xStream;
+};
+
+class SVXCORE_DLLPUBLIC SvXMLGraphicHelper final :
+ public comphelper::WeakComponentImplHelper<css::document::XGraphicObjectResolver,
+ css::document::XGraphicStorageHandler,
+ css::document::XBinaryStreamResolver>
+{
+private:
+ css::uno::Reference < css::embed::XStorage > mxRootStorage;
+ OUString maCurStorageName;
+ std::vector< css::uno::Reference< css::io::XOutputStream > >
+ maGrfStms;
+
+ std::unordered_map<OUString, css::uno::Reference<css::graphic::XGraphic>> maGraphicObjects;
+ std::unordered_map<Graphic, std::pair<OUString, OUString>> maExportGraphics;
+
+ SvXMLGraphicHelperMode meCreateMode;
+ OUString maOutputMimeType;
+
+ SVX_DLLPRIVATE static bool ImplGetStreamNames( const OUString& rURLStr,
+ OUString& rPictureStorageName,
+ OUString& rPictureStreamName );
+ SVX_DLLPRIVATE css::uno::Reference < css::embed::XStorage >
+ ImplGetGraphicStorage( const OUString& rPictureStorageName );
+ SVX_DLLPRIVATE SvxGraphicHelperStream_Impl
+ ImplGetGraphicStream( const OUString& rPictureStorageName,
+ const OUString& rPictureStreamName );
+ SVX_DLLPRIVATE static OUString ImplGetGraphicMimeType( const OUString& rFileName );
+ SVX_DLLPRIVATE Graphic ImplReadGraphic( const OUString& rPictureStorageName,
+ const OUString& rPictureStreamName );
+
+ SvXMLGraphicHelper();
+ virtual ~SvXMLGraphicHelper() override;
+ void Init( const css::uno::Reference < css::embed::XStorage >& xXMLStorage,
+ SvXMLGraphicHelperMode eCreateMode,
+ const OUString& rGraphicMimeType = OUString() );
+
+ SVX_DLLPRIVATE OUString implSaveGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic,
+ OUString & rOutMimeType,
+ std::u16string_view rRequestName);
+
+public:
+ SvXMLGraphicHelper( SvXMLGraphicHelperMode eCreateMode );
+
+ static rtl::Reference<SvXMLGraphicHelper> Create( const css::uno::Reference < css::embed::XStorage >& rXMLStorage,
+ SvXMLGraphicHelperMode eCreateMode );
+ static rtl::Reference<SvXMLGraphicHelper> Create( SvXMLGraphicHelperMode eCreateMode,
+ const OUString& rMimeType = OUString() );
+
+public:
+
+ // XGraphicObjectResolver
+ virtual OUString SAL_CALL resolveGraphicObjectURL( const OUString& aURL ) override;
+
+ // XGraphicStorageHandler
+ virtual css::uno::Reference<css::graphic::XGraphic> SAL_CALL
+ loadGraphic(OUString const & aURL) override;
+
+ virtual css::uno::Reference<css::graphic::XGraphic> SAL_CALL
+ loadGraphicFromOutputStream(css::uno::Reference<css::io::XOutputStream> const & rxOutputStream) override;
+
+ virtual OUString SAL_CALL
+ saveGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic) override;
+
+ virtual OUString SAL_CALL
+ saveGraphicByName(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic, OUString & rOutSavedMimeType, OUString const & rRequestName) override;
+
+ virtual css::uno::Reference<css::io::XInputStream> SAL_CALL
+ createInputStream(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic) override;
+
+ // XBinaryStreamResolver
+ virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream( const OUString& rURL ) override;
+ virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL createOutputStream( ) override;
+ virtual OUString SAL_CALL resolveOutputStream( const css::uno::Reference< css::io::XOutputStream >& rxBinaryStream ) override;
+};
+
+namespace svx {
+ SVXCORE_DLLPUBLIC void DropUnusedNamedItems(css::uno::Reference<css::uno::XInterface> const& xModel);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xmlsecctrl.hxx b/include/svx/xmlsecctrl.hxx
new file mode 100644
index 000000000..b9019cf25
--- /dev/null
+++ b/include/svx/xmlsecctrl.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <sfx2/stbitem.hxx>
+#include <svx/svxdllapi.h>
+
+class SvxSizeItem;
+
+class SVX_DLLPUBLIC XmlSecStatusBarControl final : public SfxStatusBarControl
+{
+private:
+ struct XmlSecStatusBarControl_Impl;
+
+ std::unique_ptr<XmlSecStatusBarControl_Impl> mpImpl;
+
+public:
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ XmlSecStatusBarControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& _rStb );
+ virtual ~XmlSecStatusBarControl() override;
+
+ virtual void StateChangedAtStatusBarControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
+ virtual void Paint( const UserDrawEvent& rEvt ) override;
+ virtual void Command( const CommandEvent& rCEvt ) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xoutbmp.hxx b/include/svx/xoutbmp.hxx
new file mode 100644
index 000000000..0451fa479
--- /dev/null
+++ b/include/svx/xoutbmp.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XOUTBMP_HXX
+#define INCLUDED_SVX_XOUTBMP_HXX
+
+#include <vcl/graph.hxx>
+#include <vcl/errcode.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <svx/svxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <vcl/salctype.hxx>
+
+
+enum class XOutFlags {
+ NONE = 0x00000000,
+ MirrorHorz = 0x00000001,
+ MirrorVert = 0x00000010,
+ DontAddExtension = 0x00000008,
+ DontExpandFilename = 0x00010000,
+ UseGifIfPossible = 0x00020000,
+ UseGifIfSensible = 0x00040000,
+ UseNativeIfPossible = 0x00080000,
+};
+namespace o3tl {
+ template<> struct typed_flags<XOutFlags> : is_typed_flags<XOutFlags, 0x000f0019> {};
+}
+
+class GraphicFilter;
+class VirtualDevice;
+class INetURLObject;
+namespace tools {
+ class Polygon;
+}
+
+class SVXCORE_DLLPUBLIC XOutBitmap
+{
+public:
+
+ static Graphic MirrorGraphic( const Graphic& rGraphic, const BmpMirrorFlags nMirrorFlags );
+ static Animation MirrorAnimation( const Animation& rAnimation, bool bHMirr, bool bVMirr );
+ static ErrCode WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
+ const OUString& rFilterName, const XOutFlags nFlags,
+ const Size* pMtfSize_100TH_MM = nullptr,
+ const css::uno::Sequence< css::beans::PropertyValue >* pFilterData = nullptr);
+ static bool GraphicToBase64(const Graphic& rGraphic, OUString& rOUString,
+ bool bAddPrefix = true,
+ ConvertDataFormat aTargetFormat = ConvertDataFormat::Unknown);
+
+ static ErrCode ExportGraphic( const Graphic& rGraphic, const INetURLObject& rURL,
+ GraphicFilter& rFilter, const sal_uInt16 nFormat,
+ const css::uno::Sequence< css::beans::PropertyValue >* pFilterData );
+};
+
+#endif // INCLUDED_SVX_XOUTBMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xpoly.hxx b/include/svx/xpoly.hxx
new file mode 100644
index 000000000..23a87341d
--- /dev/null
+++ b/include/svx/xpoly.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_XPOLY_HXX
+#define INCLUDED_SVX_XPOLY_HXX
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <svx/svxdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <tools/poly.hxx>
+#include <tools/degree.hxx>
+
+class Point;
+namespace tools { class Rectangle; }
+class SvStream;
+namespace tools {
+ class Polygon;
+ class PolyPolygon;
+}
+class OutputDevice;
+
+#define XPOLYPOLY_APPEND 0xFFFF
+#define XPOLY_APPEND 0xFFFF
+
+
+// Class XPolygon has a point-array and a flag-array, which contains information about a particular point
+
+class ImpXPolygon;
+
+class SVXCORE_DLLPUBLIC XPolygon final
+{
+ o3tl::cow_wrapper< ImpXPolygon > pImpXPolygon;
+
+ // auxiliary functions for Bezier conversion
+ void SubdivideBezier(sal_uInt16 nPos, bool bCalcFirst, double fT);
+ void GenBezArc(const Point& rCenter, tools::Long nRx, tools::Long nRy,
+ tools::Long nXHdl, tools::Long nYHdl, Degree100 nStart, Degree100 nEnd,
+ sal_uInt16 nQuad, sal_uInt16 nFirst);
+ static bool CheckAngles(Degree100& nStart, Degree100 nEnd, Degree100& nA1, Degree100& nA2);
+
+public:
+ XPolygon( sal_uInt16 nSize=16 );
+ XPolygon( const XPolygon& );
+ XPolygon( XPolygon&& );
+ XPolygon( const tools::Polygon& rPoly );
+ XPolygon( const tools::Rectangle& rRect, tools::Long nRx = 0, tools::Long nRy = 0 );
+ XPolygon( const Point& rCenter, tools::Long nRx, tools::Long nRy,
+ Degree100 nStartAngle = 0_deg100, Degree100 nEndAngle = 36000_deg100,
+ bool bClose = true );
+
+ ~XPolygon();
+
+ sal_uInt16 GetSize() const;
+
+ void SetPointCount( sal_uInt16 nPoints );
+ sal_uInt16 GetPointCount() const;
+
+ void Insert( sal_uInt16 nPos, const Point& rPt, PolyFlags eFlags );
+ void Insert( sal_uInt16 nPos, const XPolygon& rXPoly );
+ void Remove( sal_uInt16 nPos, sal_uInt16 nCount );
+ void Move( tools::Long nHorzMove, tools::Long nVertMove );
+ tools::Rectangle GetBoundRect() const;
+
+ const Point& operator[]( sal_uInt16 nPos ) const;
+ Point& operator[]( sal_uInt16 nPos );
+ XPolygon& operator=( const XPolygon& );
+ XPolygon& operator=( XPolygon&& );
+ bool operator==( const XPolygon& rXPoly ) const;
+
+ PolyFlags GetFlags( sal_uInt16 nPos ) const;
+ void SetFlags( sal_uInt16 nPos, PolyFlags eFlags );
+ bool IsControl(sal_uInt16 nPos) const;
+ bool IsSmooth(sal_uInt16 nPos) const;
+
+ // distance between two points
+ double CalcDistance(sal_uInt16 nP1, sal_uInt16 nP2);
+
+ // Bezier conversion
+ void CalcSmoothJoin(sal_uInt16 nCenter, sal_uInt16 nDrag, sal_uInt16 nPnt);
+ void CalcTangent(sal_uInt16 nCenter, sal_uInt16 nPrev, sal_uInt16 nNext);
+ void PointsToBezier(sal_uInt16 nFirst);
+
+ // transformations
+ void Scale(double fSx, double fSy);
+ void Distort(const tools::Rectangle& rRefRect, const XPolygon& rDistortedRect);
+
+ // #116512# convert to basegfx::B2DPolygon and return
+ basegfx::B2DPolygon getB2DPolygon() const;
+
+ // #116512# constructor to convert from basegfx::B2DPolygon
+ // #i76339# made explicit
+ explicit XPolygon(const basegfx::B2DPolygon& rPolygon);
+};
+
+// Class XPolyPolygon; like PolyPolygon, composed of XPolygons instead of Polygons
+
+class ImpXPolyPolygon;
+
+class XPolyPolygon final
+{
+ o3tl::cow_wrapper< ImpXPolyPolygon > pImpXPolyPolygon;
+
+public:
+ XPolyPolygon();
+ XPolyPolygon( const XPolyPolygon& );
+ XPolyPolygon( XPolyPolygon&& );
+
+ ~XPolyPolygon();
+
+ void Insert( XPolygon&& rXPoly );
+ void Insert( const XPolyPolygon& rXPoly );
+ void Remove( sal_uInt16 nPos );
+ const XPolygon& GetObject( sal_uInt16 nPos ) const;
+
+ void Clear();
+ sal_uInt16 Count() const;
+
+ tools::Rectangle GetBoundRect() const;
+
+ const XPolygon& operator[]( sal_uInt16 nPos ) const
+ { return GetObject( nPos ); }
+ XPolygon& operator[]( sal_uInt16 nPos );
+
+ XPolyPolygon& operator=( const XPolyPolygon& );
+ XPolyPolygon& operator=( XPolyPolygon&& );
+
+ // transformations
+ void Distort(const tools::Rectangle& rRefRect, const XPolygon& rDistortedRect);
+
+ // #116512# convert to basegfx::B2DPolyPolygon and return
+ basegfx::B2DPolyPolygon getB2DPolyPolygon() const;
+
+ // #116512# constructor to convert from basegfx::B2DPolyPolygon
+ // #i76339# made explicit
+ explicit XPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon);
+};
+
+#endif // INCLUDED_SVX_XPOLY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xpool.hxx b/include/svx/xpool.hxx
new file mode 100644
index 000000000..e8fc6f5e7
--- /dev/null
+++ b/include/svx/xpool.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XPOOL_HXX
+#define INCLUDED_SVX_XPOOL_HXX
+
+#include <svl/itempool.hxx>
+#include <memory>
+
+/*************************************************************************
+|*
+|* Klassendeklaration
+|*
+\************************************************************************/
+
+class XOutdevItemPool : public SfxItemPool
+{
+protected:
+ std::vector<SfxPoolItem*>* mpLocalPoolDefaults;
+ std::unique_ptr<SfxItemInfo[]> mpLocalItemInfos;
+
+public:
+ XOutdevItemPool(SfxItemPool* pMaster);
+ XOutdevItemPool(const XOutdevItemPool& rPool);
+
+ virtual rtl::Reference<SfxItemPool> Clone() const override;
+
+protected:
+ virtual ~XOutdevItemPool() override;
+};
+
+#endif // INCLUDED_SVX_XPOOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xsflclit.hxx b/include/svx/xsflclit.hxx
new file mode 100644
index 000000000..f82f88d38
--- /dev/null
+++ b/include/svx/xsflclit.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XSFLCLIT_HXX
+#define INCLUDED_SVX_XSFLCLIT_HXX
+
+#include <svx/xcolit.hxx>
+
+class SVXCORE_DLLPUBLIC XSecondaryFillColorItem final : public XColorItem
+{
+public:
+ XSecondaryFillColorItem(const OUString& rName, const Color& rTheColor);
+
+ SVX_DLLPRIVATE virtual XSecondaryFillColorItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ SVX_DLLPRIVATE virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xtable.hxx b/include/svx/xtable.hxx
new file mode 100644
index 000000000..cb3a4cca4
--- /dev/null
+++ b/include/svx/xtable.hxx
@@ -0,0 +1,394 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_XTABLE_HXX
+#define INCLUDED_SVX_XTABLE_HXX
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <svx/xdash.hxx>
+#include <svx/xhatch.hxx>
+#include <svx/xgrad.hxx>
+
+#include <tools/color.hxx>
+
+#include <cppuhelper/weak.hxx>
+
+#include <svx/svxdllapi.h>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <vcl/GraphicObject.hxx>
+#include <svx/XPropertyEntry.hxx>
+
+#include <limits>
+#include <memory>
+
+class SVXCORE_DLLPUBLIC XColorEntry final : public XPropertyEntry
+{
+private:
+ Color aColor;
+
+public:
+ XColorEntry(const Color& rColor, const OUString& rName);
+
+ const Color& GetColor() const
+ {
+ return aColor;
+ }
+};
+
+class SVXCORE_DLLPUBLIC XLineEndEntry final : public XPropertyEntry
+{
+private:
+ basegfx::B2DPolyPolygon aB2DPolyPolygon;
+
+public:
+ XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const OUString& rName);
+ XLineEndEntry(const XLineEndEntry& rOther);
+
+ const basegfx::B2DPolyPolygon& GetLineEnd() const
+ {
+ return aB2DPolyPolygon;
+ }
+};
+
+class SVXCORE_DLLPUBLIC XDashEntry final : public XPropertyEntry
+{
+private:
+ XDash aDash;
+
+public:
+ XDashEntry(const XDash& rDash, const OUString& rName);
+ XDashEntry(const XDashEntry& rOther);
+
+ const XDash& GetDash() const
+ {
+ return aDash;
+ }
+};
+
+class SVXCORE_DLLPUBLIC XHatchEntry final : public XPropertyEntry
+{
+private:
+ XHatch aHatch;
+
+public:
+ XHatchEntry(const XHatch& rHatch, const OUString& rName);
+ XHatchEntry(const XHatchEntry& rOther);
+
+ const XHatch& GetHatch() const
+ {
+ return aHatch;
+ }
+};
+
+class SVXCORE_DLLPUBLIC XGradientEntry final : public XPropertyEntry
+{
+private:
+ XGradient aGradient;
+
+public:
+ XGradientEntry(const XGradient& rGradient, const OUString& rName);
+ XGradientEntry(const XGradientEntry& rOther);
+
+ const XGradient& GetGradient() const
+ {
+ return aGradient;
+ }
+};
+
+class SVXCORE_DLLPUBLIC XBitmapEntry final : public XPropertyEntry
+{
+private:
+ GraphicObject maGraphicObject;
+
+public:
+ XBitmapEntry(const GraphicObject& rGraphicObject, const OUString& rName);
+ XBitmapEntry(const XBitmapEntry& rOther);
+
+ const GraphicObject& GetGraphicObject() const
+ {
+ return maGraphicObject;
+ }
+};
+
+enum class XPropertyListType {
+ Unknown = -1,
+ Color,
+ LineEnd,
+ Dash,
+ Hatch,
+ Gradient,
+ Bitmap,
+ Pattern,
+ LAST = Pattern
+};
+
+typedef rtl::Reference< class XPropertyList > XPropertyListRef;
+
+class XDashList ; typedef rtl::Reference< class XDashList > XDashListRef;
+class XHatchList ; typedef rtl::Reference< class XHatchList > XHatchListRef;
+class XColorList ; typedef rtl::Reference< class XColorList > XColorListRef;
+class XBitmapList ; typedef rtl::Reference< class XBitmapList > XBitmapListRef;
+class XPatternList ; typedef rtl::Reference< class XPatternList > XPatternListRef;
+class XLineEndList ; typedef rtl::Reference< class XLineEndList > XLineEndListRef;
+class XGradientList ; typedef rtl::Reference< class XGradientList > XGradientListRef;
+
+class SVXCORE_DLLPUBLIC XPropertyList : public cppu::OWeakObject
+{
+protected:
+ XPropertyListType meType;
+ OUString maName; // not persistent
+ OUString maPath;
+ OUString maReferer;
+
+ std::vector< std::unique_ptr<XPropertyEntry> > maList;
+
+ bool mbListDirty;
+ bool mbEmbedInDocument;
+
+ XPropertyList(XPropertyListType t, const OUString& rPath, const OUString& rReferer);
+ bool isValidIdx(tools::Long nIndex) const;
+ virtual BitmapEx CreateBitmapForUI(tools::Long nIndex) = 0;
+
+public:
+ XPropertyList(const XPropertyList&) = delete;
+ XPropertyList& operator=(const XPropertyList&) = delete;
+ virtual ~XPropertyList() override;
+
+ XPropertyListType Type() const { return meType; }
+ tools::Long Count() const;
+
+ void Insert(std::unique_ptr<XPropertyEntry> pEntry, tools::Long nIndex = std::numeric_limits<tools::Long>::max());
+ void Replace(std::unique_ptr<XPropertyEntry> pEntry, tools::Long nIndex);
+ void Remove(tools::Long nIndex);
+
+ XPropertyEntry* Get(tools::Long nIndex) const;
+ tools::Long GetIndex(std::u16string_view rName) const;
+ BitmapEx GetUiBitmap(tools::Long nIndex) const;
+
+ const OUString& GetName() const { return maName; }
+ void SetName(const OUString& rString);
+
+ const OUString& GetPath() const { return maPath; }
+ void SetPath(const OUString& rString) { maPath = rString; }
+
+ void SetDirty(bool bDirty) { mbListDirty = bDirty; }
+
+ bool IsEmbedInDocument() const { return mbEmbedInDocument; }
+
+ static OUString GetDefaultExt(XPropertyListType t);
+ OUString GetDefaultExt() const { return GetDefaultExt(meType); }
+
+ virtual css::uno::Reference< css::container::XNameContainer >
+ createInstance() = 0;
+ bool Load();
+ bool LoadFrom(const css::uno::Reference<
+ css::embed::XStorage > &xStorage,
+ const OUString &rURL, const OUString &rReferer);
+ bool Save();
+ bool SaveTo (const css::uno::Reference<
+ css::embed::XStorage > &xStorage,
+ const OUString &rURL,
+ OUString *pOptName);
+ virtual bool Create() = 0;
+
+ // Factory method for sub-classes
+ static XPropertyListRef CreatePropertyList(XPropertyListType t,
+ const OUString& rPath,
+ const OUString& rReferer);
+ // as above but initializes name as expected
+ static XPropertyListRef CreatePropertyListFromURL(XPropertyListType t,
+ std::u16string_view rUrl);
+
+ // helper accessors
+ static inline XDashListRef AsDashList(
+ rtl::Reference<XPropertyList> const & plist);
+ static inline XHatchListRef AsHatchList(
+ rtl::Reference<XPropertyList> const & plist);
+ static inline XColorListRef AsColorList(
+ rtl::Reference<XPropertyList> const & plist);
+ static inline XBitmapListRef AsBitmapList(
+ rtl::Reference<XPropertyList> const & plist);
+ static inline XPatternListRef AsPatternList(
+ rtl::Reference<XPropertyList> const & plist);
+ static inline XLineEndListRef AsLineEndList(
+ rtl::Reference<XPropertyList> const & plist);
+ static inline XGradientListRef AsGradientList(
+ rtl::Reference<XPropertyList> const & plist);
+};
+
+class SVXCORE_DLLPUBLIC XColorList final : public XPropertyList
+{
+ virtual BitmapEx CreateBitmapForUI(tools::Long nIndex) override;
+
+public:
+ XColorList(const OUString& rPath, const OUString& rReferer)
+ : XPropertyList(XPropertyListType::Color, rPath, rReferer) {}
+
+ void Replace(tools::Long nIndex, std::unique_ptr<XColorEntry> pEntry);
+ XColorEntry* GetColor(tools::Long nIndex) const;
+ tools::Long GetIndexOfColor( const Color& rColor) const;
+ virtual css::uno::Reference< css::container::XNameContainer > createInstance() override;
+ virtual bool Create() override;
+
+ static XColorListRef CreateStdColorList();
+ static XColorListRef GetStdColorList(); // returns a singleton
+};
+
+class SVXCORE_DLLPUBLIC XLineEndList final : public XPropertyList
+{
+ virtual BitmapEx CreateBitmapForUI(tools::Long nIndex) override;
+
+public:
+ XLineEndList(const OUString& rPath, const OUString& rReferer);
+ virtual ~XLineEndList() override;
+
+ XLineEndEntry* GetLineEnd(tools::Long nIndex) const;
+
+ virtual css::uno::Reference< css::container::XNameContainer > createInstance() override;
+ virtual bool Create() override;
+};
+
+class SVXCORE_DLLPUBLIC XDashList final : public XPropertyList
+{
+private:
+ BitmapEx maBitmapSolidLine;
+ OUString maStringSolidLine;
+ OUString maStringNoLine;
+
+ static BitmapEx ImpCreateBitmapForXDash(const XDash* pDash);
+ virtual BitmapEx CreateBitmapForUI(tools::Long nIndex) override;
+
+public:
+ XDashList(const OUString& rPath, const OUString& rReferer);
+ virtual ~XDashList() override;
+
+ void Replace(std::unique_ptr<XDashEntry> pEntry, tools::Long nIndex);
+ XDashEntry* GetDash(tools::Long nIndex) const;
+
+ virtual css::uno::Reference< css::container::XNameContainer > createInstance() override;
+ virtual bool Create() override;
+
+ // Special call to get a bitmap for the solid line representation. It
+ // creates a bitmap fitting in size and style to the ones you get by
+ // using GetUiBitmap for existing entries.
+ BitmapEx const & GetBitmapForUISolidLine() const;
+
+ // Special calls to get the translated strings for the UI entry for no
+ // line style (XLINE_NONE) and solid line style (XLINE_SOLID) for dialogs
+ OUString const & GetStringForUiSolidLine() const;
+ OUString const & GetStringForUiNoLine() const;
+};
+
+class SVXCORE_DLLPUBLIC XHatchList final : public XPropertyList
+{
+private:
+ BitmapEx CreateBitmap(tools::Long nIndex, const Size& rSize) const;
+ virtual BitmapEx CreateBitmapForUI(tools::Long nIndex) override;
+public:
+ XHatchList(const OUString& rPath, const OUString& rReferer);
+ virtual ~XHatchList() override;
+
+ void Replace(std::unique_ptr<XHatchEntry> pEntry, tools::Long nIndex);
+ XHatchEntry* GetHatch(tools::Long nIndex) const;
+ BitmapEx GetBitmapForPreview(tools::Long nIndex, const Size& rSize);
+
+ virtual css::uno::Reference< css::container::XNameContainer > createInstance() override;
+ virtual bool Create() override;
+};
+
+class SVXCORE_DLLPUBLIC XGradientList final : public XPropertyList
+{
+private:
+ BitmapEx CreateBitmap(tools::Long nIndex, const Size& rSize) const;
+ virtual BitmapEx CreateBitmapForUI(tools::Long nIndex) override;
+
+public:
+ XGradientList(const OUString& rPath, const OUString& rReferer);
+ virtual ~XGradientList() override;
+
+ void Replace(std::unique_ptr<XGradientEntry> pEntry, tools::Long nIndex);
+ XGradientEntry* GetGradient(tools::Long nIndex) const;
+ BitmapEx GetBitmapForPreview(tools::Long nIndex, const Size& rSize);
+
+ virtual css::uno::Reference< css::container::XNameContainer > createInstance() override;
+ virtual bool Create() override;
+};
+
+class SVXCORE_DLLPUBLIC XBitmapList final : public XPropertyList
+{
+private:
+ BitmapEx CreateBitmap( tools::Long nIndex, const Size& rSize ) const;
+ virtual BitmapEx CreateBitmapForUI(tools::Long nIndex) override;
+
+public:
+ XBitmapList(const OUString& rPath, const OUString& rReferer)
+ : XPropertyList(XPropertyListType::Bitmap, rPath, rReferer) {}
+
+ XBitmapEntry* GetBitmap(tools::Long nIndex) const;
+ BitmapEx GetBitmapForPreview(tools::Long nIndex, const Size& rSize);
+
+ virtual css::uno::Reference< css::container::XNameContainer > createInstance() override;
+ virtual bool Create() override;
+};
+
+class SVXCORE_DLLPUBLIC XPatternList final : public XPropertyList
+{
+private:
+ BitmapEx CreateBitmap( tools::Long nIndex, const Size& rSize ) const;
+ virtual BitmapEx CreateBitmapForUI(tools::Long nIndex) override;
+
+public:
+ XPatternList(const OUString& rPath, const OUString& rReferer)
+ : XPropertyList(XPropertyListType::Pattern, rPath, rReferer) {}
+
+ XBitmapEntry* GetBitmap(tools::Long nIndex) const;
+ BitmapEx GetBitmapForPreview(tools::Long nIndex, const Size& rSize);
+
+ virtual css::uno::Reference< css::container::XNameContainer > createInstance() override;
+ virtual bool Create() override;
+};
+
+// FIXME: could add type checking too ...
+inline XDashListRef XPropertyList::AsDashList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XDashListRef( static_cast<XDashList *> (plist.get()) ); }
+inline XHatchListRef XPropertyList::AsHatchList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XHatchListRef( static_cast<XHatchList *> (plist.get()) ); }
+inline XColorListRef XPropertyList::AsColorList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XColorListRef( static_cast<XColorList *> (plist.get()) ); }
+inline XBitmapListRef XPropertyList::AsBitmapList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XBitmapListRef( static_cast<XBitmapList *> (plist.get()) ); }
+inline XPatternListRef XPropertyList::AsPatternList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XPatternListRef( static_cast<XPatternList *> (plist.get()) ); }
+inline XLineEndListRef XPropertyList::AsLineEndList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XLineEndListRef( static_cast<XLineEndList *> (plist.get()) ); }
+inline XGradientListRef XPropertyList::AsGradientList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XGradientListRef( static_cast<XGradientList *> (plist.get()) ); }
+
+#endif // INCLUDED_SVX_XTABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xtextit0.hxx b/include/svx/xtextit0.hxx
new file mode 100644
index 000000000..8d6db594d
--- /dev/null
+++ b/include/svx/xtextit0.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_XTEXTIT0_HXX
+#define INCLUDED_SVX_XTEXTIT0_HXX
+
+#include <svx/xenum.hxx>
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+/*************************************************************************
+|*
+|* FormText-StyleItem
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFormTextStyleItem final : public SfxEnumItem<XFormTextStyle>
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XFormTextStyleItem(XFormTextStyle = XFormTextStyle::NONE);
+ virtual XFormTextStyleItem* Clone(SfxItemPool* pPool = nullptr) const override;
+ virtual sal_uInt16 GetValueCount() const override;
+ // #FontWork#
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+/*************************************************************************
+|*
+|* FormText-HideFormItem
+|*
+\************************************************************************/
+
+class SVXCORE_DLLPUBLIC XFormTextHideFormItem final : public SfxBoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ XFormTextHideFormItem(bool bHide = false);
+ virtual XFormTextHideFormItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/zoom_def.hxx b/include/svx/zoom_def.hxx
new file mode 100644
index 000000000..1a98d929d
--- /dev/null
+++ b/include/svx/zoom_def.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+enum class ZoomButtonId
+{
+ NONE = 0x0000,
+ OPTIMAL = 0x0001,
+ PAGEWIDTH = 0x0002,
+ WHOLEPAGE = 0x0004,
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/zoomctrl.hxx b/include/svx/zoomctrl.hxx
new file mode 100644
index 000000000..0c64db1e5
--- /dev/null
+++ b/include/svx/zoomctrl.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_ZOOMCTRL_HXX
+#define INCLUDED_SVX_ZOOMCTRL_HXX
+
+#include <sfx2/stbitem.hxx>
+#include <svx/svxdllapi.h>
+#include <sfx2/zoomitem.hxx>
+#include <vcl/image.hxx>
+
+class SVX_DLLPUBLIC SvxZoomStatusBarControl : public SfxStatusBarControl
+{
+private:
+ sal_uInt16 nZoom;
+ SvxZoomEnableFlags nValueSet;
+
+public:
+ virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState) override;
+ virtual void Paint(const UserDrawEvent& rEvt) override;
+ virtual void Command(const CommandEvent& rCEvt) override;
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxZoomStatusBarControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb);
+
+private:
+ void ImplUpdateItemText();
+};
+
+class SVX_DLLPUBLIC SvxZoomPageStatusBarControl final : public SfxStatusBarControl
+{
+private:
+ Image maImage;
+
+public:
+ virtual void Paint(const UserDrawEvent& rEvt) override;
+ virtual bool MouseButtonDown(const MouseEvent& rEvt) override;
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxZoomPageStatusBarControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/zoomsliderctrl.hxx b/include/svx/zoomsliderctrl.hxx
new file mode 100644
index 000000000..ba300e261
--- /dev/null
+++ b/include/svx/zoomsliderctrl.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_ZOOMSLIDERCTRL_HXX
+#define INCLUDED_SVX_ZOOMSLIDERCTRL_HXX
+
+#include <sfx2/stbitem.hxx>
+#include <svx/svxdllapi.h>
+#include <memory>
+
+class SVX_DLLPUBLIC SvxZoomSliderControl final : public SfxStatusBarControl
+{
+private:
+
+ struct SvxZoomSliderControl_Impl;
+ std::unique_ptr<SvxZoomSliderControl_Impl> mxImpl;
+
+ sal_uInt16 Offset2Zoom( tools::Long nOffset ) const;
+ tools::Long Zoom2Offset( sal_uInt16 nZoom ) const;
+
+ void repaintAndExecute();
+ void forceRepaint() const;
+
+public:
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& _rStb );
+ virtual ~SvxZoomSliderControl() override;
+
+ virtual void StateChangedAtStatusBarControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
+ virtual void Paint( const UserDrawEvent& rEvt ) override;
+ virtual bool MouseButtonDown( const MouseEvent & ) override;
+ virtual bool MouseButtonUp( const MouseEvent & ) override;
+ virtual bool MouseMove( const MouseEvent & rEvt ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/zoomslideritem.hxx b/include/svx/zoomslideritem.hxx
new file mode 100644
index 000000000..919d7c026
--- /dev/null
+++ b/include/svx/zoomslideritem.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVX_ZOOMSLIDERITEM_HXX
+#define INCLUDED_SVX_ZOOMSLIDERITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svxids.hrc>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <svx/svxdllapi.h>
+
+
+class SVX_DLLPUBLIC SvxZoomSliderItem final : public SfxUInt16Item
+{
+ css::uno::Sequence < sal_Int32 > maValues;
+ sal_uInt16 mnMinZoom;
+ sal_uInt16 mnMaxZoom;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SvxZoomSliderItem( sal_uInt16 nCurrentZoom = 100, sal_uInt16 nMinZoom = 20, sal_uInt16 nMaxZoom = 600, TypedWhichId<SvxZoomSliderItem> nWhich = SID_ATTR_ZOOMSLIDER );
+
+ void AddSnappingPoint( sal_Int32 nNew );
+ const css::uno::Sequence < sal_Int32 >& GetSnappingPoints() const { return maValues;}
+ sal_uInt16 GetMinZoom() const {return mnMinZoom;}
+ sal_uInt16 GetMaxZoom() const {return mnMaxZoom;}
+
+ // "purely virtual methods" from the SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SvxZoomSliderItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/systools/win32/comtools.hxx b/include/systools/win32/comtools.hxx
new file mode 100644
index 000000000..b14184288
--- /dev/null
+++ b/include/systools/win32/comtools.hxx
@@ -0,0 +1,249 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <string>
+#include <string_view>
+#include <stdexcept>
+#include <type_traits>
+#include <utility>
+
+#include <prewin.h>
+#include <objbase.h>
+#include <postwin.h>
+
+namespace sal::systools
+{
+ /* Simple exception class for propagating COM errors */
+ class ComError : public std::runtime_error
+ {
+ public:
+ ComError(const std::string& message, HRESULT hr) :
+ std::runtime_error(message),
+ hr_(hr)
+ {}
+
+ HRESULT GetHresult() const { return hr_; }
+
+ private:
+ HRESULT hr_;
+ };
+
+ /* Convert failed HRESULT to thrown ComError */
+ inline void ThrowIfFailed(HRESULT hr, std::string_view msg)
+ {
+ if (FAILED(hr))
+ throw ComError(std::string(msg), hr);
+ }
+
+ /* A guard class to call CoInitializeEx/CoUninitialize in proper pairs
+ * See also: o3tl::safeCoInitializeEx doing dangerous re-initialization
+ */
+ class CoInitializeGuard
+ {
+ public:
+ enum class WhenFailed
+ {
+ NoThrow, // do not throw
+ Throw, // throw on failure
+ Abort, // std::abort on failure
+ };
+ explicit CoInitializeGuard(DWORD dwCoInit, bool failChangeMode = false,
+ WhenFailed whenFailed = WhenFailed::Throw)
+ {
+ HRESULT hr = ::CoInitializeEx(nullptr, dwCoInit);
+ if (whenFailed != WhenFailed::NoThrow && FAILED(hr)
+ && (failChangeMode || hr != RPC_E_CHANGED_MODE))
+ {
+ if (whenFailed == WhenFailed::Throw)
+ throw ComError("CoInitializeEx failed", hr);
+ else // if (whenFailed == Abort)
+ std::abort();
+ }
+ mbUninit = SUCCEEDED(hr);
+ }
+ CoInitializeGuard(const CoInitializeGuard&) = delete; // non-construction-copyable
+ void operator=(const CoInitializeGuard&) = delete; // non-copyable
+ ~CoInitializeGuard()
+ {
+ if (mbUninit)
+ ::CoUninitialize();
+ }
+
+ private:
+ bool mbUninit;
+ };
+
+ struct COM_QUERY_TAG {} constexpr COM_QUERY;
+ struct COM_QUERY_THROW_TAG {} constexpr COM_QUERY_THROW;
+ template <typename TAG>
+ constexpr bool is_COM_query_tag
+ = std::is_same_v<TAG, COM_QUERY_TAG> || std::is_same_v<TAG, COM_QUERY_THROW_TAG>;
+
+ /* A simple COM smart pointer template */
+ template <typename T>
+ class COMReference
+ {
+ public:
+ /* Explicitly controllable whether AddRef will be called or not */
+ COMReference(T* comptr = nullptr, bool bAddRef = true) :
+ com_ptr_(comptr)
+ {
+ if (bAddRef)
+ addRef(com_ptr_);
+ }
+
+ COMReference(const COMReference<T>& other) :
+ COMReference(other.com_ptr_)
+ {
+ }
+
+ COMReference(COMReference<T>&& other) :
+ COMReference(std::exchange(other.com_ptr_, nullptr), false)
+ {
+ }
+
+ // Query from IUnknown*, using COM_QUERY or COM_QUERY_THROW tags
+ template <typename T2, typename TAG>
+ COMReference(const COMReference<T2>& p, TAG t)
+ : COMReference(p.template QueryInterface<T>(t))
+ {
+ }
+
+ // Using CoCreateInstance
+ COMReference(REFCLSID clsid, IUnknown* pOuter = nullptr, DWORD nCtx = CLSCTX_ALL)
+ : com_ptr_(nullptr)
+ {
+ ThrowIfFailed(CoCreateInstance(clsid, pOuter, nCtx), "CoCreateInstance failed");
+ }
+
+ COMReference<T>& operator=(const COMReference<T>& other)
+ {
+ return operator=(other.com_ptr_);
+ }
+
+ COMReference<T>& operator=(COMReference<T>&& other)
+ {
+ if (com_ptr_ != other.com_ptr_)
+ {
+ clear();
+ std::swap(com_ptr_, other.com_ptr_);
+ }
+ return *this;
+ }
+
+ COMReference<T>& operator=(T* comptr)
+ {
+ assign(comptr);
+ return *this;
+ }
+
+ ~COMReference() { release(com_ptr_); }
+
+ template <typename T2, typename TAG, std::enable_if_t<is_COM_query_tag<TAG>, int> = 0>
+ COMReference<T2> QueryInterface(TAG) const
+ {
+ T2* ip = nullptr;
+ HRESULT hr = E_POINTER;
+ if (com_ptr_)
+ hr = com_ptr_->QueryInterface(&ip);
+
+ if constexpr (std::is_same_v<TAG, COM_QUERY_THROW_TAG>)
+ ThrowIfFailed(hr, "QueryInterface failed");
+
+ return { ip, false };
+ }
+
+ template <typename T2, typename TAG>
+ COMReference<T>& set(const COMReference<T2>& p, TAG t)
+ {
+ return operator=(p.template QueryInterface<T>(t));
+ }
+
+ HRESULT CoCreateInstance(REFCLSID clsid, IUnknown* pOuter = nullptr,
+ DWORD nCtx = CLSCTX_ALL)
+ {
+ T* ip;
+ HRESULT hr = ::CoCreateInstance(clsid, pOuter, nCtx, IID_PPV_ARGS(&ip));
+ if (SUCCEEDED(hr))
+ release(std::exchange(com_ptr_, ip));
+ return hr;
+ }
+
+ HRESULT CoGetClassObject(REFCLSID clsid, DWORD nCtx = CLSCTX_ALL)
+ {
+ T* ip;
+ HRESULT hr = ::CoGetClassObject(clsid, nCtx, nullptr, IID_PPV_ARGS(&ip));
+ if (SUCCEEDED(hr))
+ release(std::exchange(com_ptr_, ip));
+ return hr;
+ }
+
+ T* operator->() const { return com_ptr_; }
+
+ T& operator*() const { return *com_ptr_; }
+
+ /* Necessary for assigning com_ptr_ from functions like
+ CoCreateInstance which require a 'void**' */
+ T** operator&()
+ {
+ clear();
+ return &com_ptr_;
+ }
+
+ T* get() const { return com_ptr_; }
+ operator T* () const { return get(); }
+
+ void clear() { assign(nullptr); }
+
+ bool is() const { return (com_ptr_ != nullptr); }
+ operator bool() const { return is(); }
+
+ private:
+ static void addRef(T* ptr)
+ {
+ if (ptr)
+ ptr->AddRef();
+ }
+
+ static void release(T* ptr)
+ {
+ if (ptr)
+ ptr->Release();
+ }
+
+ void assign(T* ptr)
+ {
+ if (com_ptr_ == ptr)
+ return;
+ addRef(ptr);
+ release(std::exchange(com_ptr_, ptr));
+ }
+
+ T* com_ptr_;
+ };
+
+} // sal::systools
+
+/* Typedefs for some popular COM interfaces */
+typedef sal::systools::COMReference<IDataObject> IDataObjectPtr;
+typedef sal::systools::COMReference<IStream> IStreamPtr;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/systools/win32/oleauto.hxx b/include/systools/win32/oleauto.hxx
new file mode 100644
index 000000000..c01ac1225
--- /dev/null
+++ b/include/systools/win32/oleauto.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <cassert>
+#include <string_view>
+#include <utility>
+
+#include <prewin.h>
+#include <oleauto.h>
+#include <postwin.h>
+
+#include <o3tl/char16_t2wchar_t.hxx>
+
+namespace sal::systools
+{
+// BSTR safe wrapper
+class BStr
+{
+public:
+ BStr() = default;
+ BStr(std::u16string_view sv)
+ : m_Str(::SysAllocStringLen(o3tl::toW(sv.data()), sv.length()))
+ {
+ }
+ BStr(const BStr& src)
+ : BStr(std::u16string_view(src))
+ {
+ }
+ BStr(BStr&& src)
+ : m_Str(std::exchange(src.m_Str, nullptr))
+ {
+ }
+ ~BStr() { ::SysFreeString(m_Str); }
+ BStr& operator=(std::u16string_view sv)
+ {
+ ::SysFreeString(
+ std::exchange(m_Str, ::SysAllocStringLen(o3tl::toW(sv.data()), sv.length())));
+ return *this;
+ }
+ BStr& operator=(const BStr& src)
+ {
+ if (&src != this)
+ operator=(std::u16string_view(src));
+ return *this;
+ }
+ BStr& operator=(BStr&& src)
+ {
+ ::SysFreeString(std::exchange(m_Str, std::exchange(src.m_Str, nullptr)));
+ return *this;
+ }
+ operator std::u16string_view() const { return { o3tl::toU(m_Str), length() }; }
+ operator BSTR() const { return m_Str; }
+ BSTR* operator&()
+ {
+ assert(!m_Str);
+ return &m_Str;
+ }
+ UINT length() const { return ::SysStringLen(m_Str); }
+
+private:
+ BSTR m_Str = nullptr;
+};
+
+} // sal::systools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/systools/win32/qswin32.h b/include/systools/win32/qswin32.h
new file mode 100644
index 000000000..8bc7cac5e
--- /dev/null
+++ b/include/systools/win32/qswin32.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SYSTOOLS_WIN32_QSWIN32_H
+#define INCLUDED_SYSTOOLS_WIN32_QSWIN32_H
+
+#define QUICKSTART_CLASSNAME L"LO Listener Class"
+#define QUICKSTART_WINDOWNAME L"LO Listener Window"
+#define SHUTDOWN_QUICKSTART_MESSAGE L"LO KillTray"
+
+#endif // INCLUDED_SYSTOOLS_WIN32_QSWIN32_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/systools/win32/retry_if_failed.hxx b/include/systools/win32/retry_if_failed.hxx
new file mode 100644
index 000000000..1372843ab
--- /dev/null
+++ b/include/systools/win32/retry_if_failed.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <type_traits>
+#include <systools/win32/uwinapi.h>
+
+#pragma comment(lib, "Kernel32.lib") // for Sleep
+
+namespace sal::systools
+{
+// Some system calls (e.g., clipboard access functions) may fail first time, because the resource
+// may only be accessed by one process at a time. This function allows to retry failed call up to
+// specified number of times with a specified timeout (in ms), until the call succeeds or the limit
+// of attempts is exceeded.
+// Usage:
+// HRESULT hr = sal::systools::RetryIfFailed(10, 100, []{ return OleFlushClipboard(); });
+template <typename Func>
+std::enable_if_t<std::is_same_v<std::invoke_result_t<Func>, HRESULT>, HRESULT>
+RetryIfFailed(unsigned times, unsigned msTimeout, Func func)
+{
+ for (unsigned i = 0;; ++i)
+ {
+ if (HRESULT hr = func(); SUCCEEDED(hr) || i >= times)
+ return hr;
+ Sleep(msTimeout);
+ }
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/systools/win32/uwinapi.h b/include/systools/win32/uwinapi.h
new file mode 100644
index 000000000..501c9aa38
--- /dev/null
+++ b/include/systools/win32/uwinapi.h
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SYSTOOLS_WIN32_UWINAPI_H
+#define INCLUDED_SYSTOOLS_WIN32_UWINAPI_H
+
+#include <prewin.h>
+#include <postwin.h>
+
+#ifdef __cplusplus
+
+inline bool IsValidHandle(HANDLE handle)
+{
+ return handle != INVALID_HANDLE_VALUE && handle != nullptr;
+}
+
+#else /* __cplusplus */
+
+#define IsValidHandle(Handle) ((DWORD_PTR)(Handle) + 1 > 1)
+
+#endif /* __cplusplus */
+
+#endif // INCLUDED_SYSTOOLS_WIN32_UWINAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/beans/xpropertyset.hxx b/include/test/beans/xpropertyset.hxx
new file mode 100644
index 000000000..dbfac0a2e
--- /dev/null
+++ b/include/test/beans/xpropertyset.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_BEANS_XPROPERTYSET_HXX
+#define INCLUDED_TEST_BEANS_XPROPERTYSET_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+#include <set>
+#include <vector>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XPropertySet
+{
+public:
+ XPropertySet() {}
+
+ XPropertySet(const std::set<OUString> rIgnoreValue)
+ : m_IgnoreValue(rIgnoreValue)
+ {
+ }
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetPropertySetInfo();
+ void testSetPropertyValue();
+ void testGetPropertyValue();
+ void testPropertyChangeListener();
+ void testVetoableChangeListener();
+
+protected:
+ ~XPropertySet(){};
+ bool isPropertyValueChangeable(const OUString& rName);
+
+ virtual bool isPropertyIgnored(const OUString& rName);
+
+private:
+ void fillPropsToTest(const css::uno::Reference<css::beans::XPropertySetInfo>& xPropInfo);
+ static bool
+ getSinglePropertyValue(const css::uno::Reference<css::beans::XPropertySet>& xPropSet,
+ const OUString& rName);
+
+ struct OOO_DLLPUBLIC_TEST PropsToTest
+ {
+ std::vector<OUString> constrained;
+ std::vector<OUString> bound;
+ std::vector<OUString> normal;
+ std::vector<OUString> readonly;
+
+ bool initialized;
+
+ PropsToTest();
+ };
+
+ PropsToTest maPropsToTest;
+ std::set<OUString> m_IgnoreValue;
+};
+
+} // namespace apitest
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/bootstrapfixture.hxx b/include/test/bootstrapfixture.hxx
new file mode 100644
index 000000000..438bba58a
--- /dev/null
+++ b/include/test/bootstrapfixture.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <rtl/string.hxx>
+#include <tools/link.hxx>
+#include <vcl/salctype.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+
+#include <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <unotest/bootstrapfixturebase.hxx>
+#include <test/testdllapi.hxx>
+
+namespace test
+{
+enum ValidationFormat
+{
+ OOXML,
+ ODF,
+ MSBINARY
+};
+
+// Class to do lots of heavy-lifting UNO & environment
+// bootstrapping for unit tests, such that we can use
+// almost an entire LibreOffice during compile - so
+// that we can get pieces of code alone to beat them up.
+
+// NB. this class is instantiated multiple times during a
+// run of unit tests ...
+class OOO_DLLPUBLIC_TEST BootstrapFixture : public BootstrapFixtureBase
+{
+ bool m_bNeedUCB;
+ bool m_bAssertOnDialog;
+
+protected:
+ css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
+
+ // A convenience function to be used to conditionally exclude tests not behaving properly
+ // on UI scaling other than 1:1. Using this should be considered a temporary workaround,
+ // until a proper fix is implemented that either considers the DPI properly in the test, or
+ // makes the invariants that test uses independent of DPI.
+ static bool IsDefaultDPI();
+ static std::pair<double, double> getDPIScaling();
+
+public:
+ DECL_DLLPRIVATE_STATIC_LINK(BootstrapFixture, ImplInitFilterHdl, ConvertData&, bool);
+
+ BootstrapFixture(bool bAssertOnDialog = true, bool bNeedUCB = true);
+ virtual ~BootstrapFixture() override;
+
+ virtual void setUp() override;
+
+ void validate(const OUString& rURL, ValidationFormat) const;
+
+ // Allows to exclude tests dependent on color depth of the default virtual device
+ static sal_uInt16 getDefaultDeviceBitCount();
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/calc_unoapi_test.hxx b/include/test/calc_unoapi_test.hxx
new file mode 100644
index 000000000..58cb55c70
--- /dev/null
+++ b/include/test/calc_unoapi_test.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_CALC_UNOAPI_TEST_HXX
+#define INCLUDED_TEST_CALC_UNOAPI_TEST_HXX
+
+#include <test/unoapi_test.hxx>
+
+// basic uno api test class for calc
+
+class OOO_DLLPUBLIC_TEST CalcUnoApiTest : public UnoApiTest
+{
+public:
+ CalcUnoApiTest(const OUString& path);
+
+ virtual void setUp() override;
+ virtual void tearDown() override;
+
+private:
+ css::uno::Reference<css::uno::XInterface> m_xCalcComponent;
+};
+
+#endif // INCLUDED_TEST_CALC_UNOAPI_TEST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/callgrind.hxx b/include/test/callgrind.hxx
new file mode 100644
index 000000000..6a16fa831
--- /dev/null
+++ b/include/test/callgrind.hxx
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_CALLGRIND_HXX
+#define INCLUDED_TEST_CALLGRIND_HXX
+
+#include <sal/config.h>
+#include <test/testdllapi.hxx>
+
+void OOO_DLLPUBLIC_TEST callgrindStart();
+void OOO_DLLPUBLIC_TEST callgrindDump(const char* name);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/chart/xchartdata.hxx b/include/test/chart/xchartdata.hxx
new file mode 100644
index 000000000..315d727ed
--- /dev/null
+++ b/include/test/chart/xchartdata.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XChartData
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testChartDataChangeEventListener();
+ void testGetNotANumber();
+ void testIsNotANumber();
+
+protected:
+ ~XChartData() {}
+};
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/container/xchild.hxx b/include/test/container/xchild.hxx
new file mode 100644
index 000000000..60efed6fc
--- /dev/null
+++ b/include/test/container/xchild.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_TEST_CONTAINER_XCHILD_HXX
+#define INCLUDED_TEST_CONTAINER_XCHILD_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XChild
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetParent();
+
+protected:
+ ~XChild() {}
+};
+}
+
+#endif // INCLUDED_TEST_CONTAINER_XCHILD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/container/xelementaccess.hxx b/include/test/container/xelementaccess.hxx
new file mode 100644
index 000000000..95ee85162
--- /dev/null
+++ b/include/test/container/xelementaccess.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_CONTAINER_XELEMENTACCESS_HXX
+#define INCLUDED_TEST_CONTAINER_XELEMENTACCESS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Type.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XElementAccess
+{
+public:
+ XElementAccess(css::uno::Type const& rType)
+ : m_aType(rType)
+ {
+ }
+
+ void testGetElementType();
+ void testHasElements();
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+protected:
+ ~XElementAccess() {}
+
+private:
+ css::uno::Type m_aType;
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_CONTAINER_XELEMENTACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/container/xenumeration.hxx b/include/test/container/xenumeration.hxx
new file mode 100644
index 000000000..0d39a0dc9
--- /dev/null
+++ b/include/test/container/xenumeration.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_CONTAINER_XENUMERATION_HXX
+#define INCLUDED_TEST_CONTAINER_XENUMERATION_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XEnumeration
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testHasMoreElements();
+ void testNextElement();
+
+protected:
+ ~XEnumeration() {}
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_CONTAINER_XENUMERATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/container/xenumerationaccess.hxx b/include/test/container/xenumerationaccess.hxx
new file mode 100644
index 000000000..272172c8d
--- /dev/null
+++ b/include/test/container/xenumerationaccess.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_TEST_CONTAINER_XENUMERATIONACCESS_HXX
+#define INCLUDED_TEST_CONTAINER_XENUMERATIONACCESS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XEnumerationAccess
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testCreateEnumeration();
+
+protected:
+ ~XEnumerationAccess() {}
+};
+}
+
+#endif // INCLUDED_TEST_CONTAINER_XENUMERATIONACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/container/xindexaccess.hxx b/include/test/container/xindexaccess.hxx
new file mode 100644
index 000000000..64a34b8bf
--- /dev/null
+++ b/include/test/container/xindexaccess.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_CONTAINER_XINDEXACCESS_HXX
+#define INCLUDED_TEST_CONTAINER_XINDEXACCESS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XIndexAccess
+{
+public:
+ XIndexAccess(sal_Int32 nItems)
+ : m_nItems(nItems)
+ {
+ }
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ void testGetCount();
+ void testGetByIndex();
+ // will throw an exception and should fail if not
+ void testGetByIndexException();
+
+protected:
+ ~XIndexAccess() {}
+
+private:
+ sal_Int32 m_nItems;
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_CONTAINER_XINDEXACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/container/xnameaccess.hxx b/include/test/container/xnameaccess.hxx
new file mode 100644
index 000000000..960cf6782
--- /dev/null
+++ b/include/test/container/xnameaccess.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_CONTAINER_XNAMEACCESS_HXX
+#define INCLUDED_TEST_CONTAINER_XNAMEACCESS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XNameAccess
+{
+public:
+ XNameAccess(const OUString& rName)
+ : m_aName(rName)
+ {
+ }
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetByName();
+ void testGetElementNames();
+ void testHasByName();
+
+protected:
+ ~XNameAccess() {}
+
+private:
+ OUString const m_aName;
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_CONTAINER_XNAMEACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/container/xnamecontainer.hxx b/include/test/container/xnamecontainer.hxx
new file mode 100644
index 000000000..221ef2a44
--- /dev/null
+++ b/include/test/container/xnamecontainer.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_CONTAINER_XNAMECONTAINER_HXX
+#define INCLUDED_TEST_CONTAINER_XNAMECONTAINER_HXX
+
+#include <rtl/ustring.hxx>
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XNameContainer
+{
+public:
+ // removes default entry
+ XNameContainer()
+ : m_aName("XNameContainer")
+ {
+ }
+ // removes given entry
+ XNameContainer(const OUString& rNameToRemove)
+ : m_aName(rNameToRemove)
+ {
+ }
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual void setElement(const css::uno::Any& rElement) { m_aElement = rElement; }
+
+ void testInsertByName();
+ void testInsertByNameEmptyName();
+ void testInsertByNameDuplicate();
+ void testInsertByNameInvalidElement();
+ void testRemoveByName();
+ void testRemoveByNameEmptyName();
+ void testRemoveByNameNoneExistingElement();
+
+protected:
+ ~XNameContainer() {}
+
+private:
+ OUString m_aName;
+ css::uno::Any m_aElement;
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_CONTAINER_XNAMECONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/container/xnamed.hxx b/include/test/container/xnamed.hxx
new file mode 100644
index 000000000..ff4c4616d
--- /dev/null
+++ b/include/test/container/xnamed.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_CONTAINER_XNAMED_HXX
+#define INCLUDED_TEST_CONTAINER_XNAMED_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XNamed
+{
+public:
+ XNamed(const OUString& rTestName)
+ : m_aTestName(rTestName)
+ {
+ }
+
+ void testGetName();
+ void testSetName();
+ // special case, here name is equal to links URL
+ void testSetNameByScSheetLinkObj();
+ void testSetNameThrowsException();
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+protected:
+ ~XNamed() {}
+
+private:
+ OUString m_aTestName;
+};
+}
+
+#endif // INCLUDED_TEST_CONTAINER_XNAMED_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/container/xnamereplace.hxx b/include/test/container/xnamereplace.hxx
new file mode 100644
index 000000000..ecf2fac83
--- /dev/null
+++ b/include/test/container/xnamereplace.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_CONTAINER_XNAMEREPLACE_HXX
+#define INCLUDED_TEST_CONTAINER_XNAMEREPLACE_HXX
+
+#include <rtl/ustring.hxx>
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XNameReplace
+{
+public:
+ XNameReplace(const OUString& rName)
+ : m_aReplacementName(rName)
+ {
+ }
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ void testReplaceByName();
+
+ void setElement(const css::uno::Any& rElement) { m_aReplacementElement = rElement; }
+
+protected:
+ ~XNameReplace() {}
+
+private:
+ OUString m_aReplacementName;
+ css::uno::Any m_aReplacementElement;
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_CONTAINER_XNAMEREPLACE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/cppunitasserthelper.hxx b/include/test/cppunitasserthelper.hxx
new file mode 100644
index 000000000..b6703e255
--- /dev/null
+++ b/include/test/cppunitasserthelper.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_CPPUNITASSERTHELPER_HXX
+#define INCLUDED_TEST_CPPUNITASSERTHELPER_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+
+#include <cppunit/TestAssert.h>
+
+CPPUNIT_NS_BEGIN
+
+/** @brief Trait used by CPPUNIT_ASSERT* macros to compare com::sun::star:awt::Point.
+ *
+ * This specialization from @c struct @c assertion_traits<> helps to compare
+ * @see com::sun::star::awt::Point.
+ */
+template <> struct assertion_traits<css::awt::Point>
+{
+ static bool equal(const css::awt::Point& x, const css::awt::Point& y) { return x == y; }
+
+ static std::string toString(const css::awt::Point& x)
+ {
+ OStringStream ost;
+ ost << "Point: " << x.X << "." << x.Y << " (coordinate: X.Y)";
+ return ost.str();
+ }
+};
+
+/** @brief Trait used by CPPUNIT_ASSERT* macros to compare com::sun::star:awt::Size.
+ *
+ * This specialization from @c struct @c assertion_traits<> helps to compare
+ * @see com::sun::star::awt::Size.
+ */
+template <> struct assertion_traits<css::awt::Size>
+{
+ static bool equal(const css::awt::Size& x, const css::awt::Size& y) { return x == y; }
+
+ static std::string toString(const css::awt::Size& x)
+ {
+ OStringStream ost;
+ ost << "Size: " << x.Width << " x " << x.Height << " (Width x Height)";
+ return ost.str();
+ }
+};
+
+/** @brief Trait used by CPPUNIT_ASSERT* macros to compare com::sun::star::table::CellAddress.
+ *
+ * This specialization from @c struct @c assertion_traits<> helps to compare
+ * @see com::sun::star::table::CellAddress.
+ */
+template <> struct assertion_traits<css::table::CellAddress>
+{
+ static bool equal(const css::table::CellAddress& x, const css::table::CellAddress& y)
+ {
+ return x == y;
+ }
+
+ static std::string toString(const css::table::CellAddress& x)
+ {
+ OStringStream ost;
+ ost << "Sheet: " << x.Sheet << " Column: " << x.Column << " Row: " << x.Row;
+ return ost.str();
+ }
+};
+
+/** @brief Trait used by CPPUNIT_ASSERT* macros to compare com::sun::star::table::CellRangeAddress.
+ *
+ * This specialization from @c struct @c assertion_traits<> helps to compare
+ * @see com::sun::star::table::CellRangeAddress.
+ */
+template <> struct assertion_traits<css::table::CellRangeAddress>
+{
+ static bool equal(const css::table::CellRangeAddress& x, const css::table::CellRangeAddress& y)
+ {
+ return x == y;
+ }
+
+ static std::string toString(const css::table::CellRangeAddress& x)
+ {
+ OStringStream ost;
+ ost << "Sheet: " << x.Sheet << " StartColumn: " << x.StartColumn
+ << " StartRow: " << x.StartRow << " EndColumn: " << x.EndColumn
+ << " EndRow: " << x.EndRow;
+ return ost.str();
+ }
+};
+
+CPPUNIT_NS_END
+
+#endif // INCLUDED_TEST_CPPUNITASSERTHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/document/xactionlockable.hxx b/include/test/document/xactionlockable.hxx
new file mode 100644
index 000000000..c1a76373b
--- /dev/null
+++ b/include/test/document/xactionlockable.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_DOCUMENT_XACTIONLOCKABLE_HXX
+#define INCLUDED_TEST_DOCUMENT_XACTIONLOCKABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XActionLockable
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testAddRemoveActionLock();
+ void testSetResetActionLock();
+
+protected:
+ ~XActionLockable(){};
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_DOCUMENT_XACTIONLOCKABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/document/xembeddedobjectsupplier.hxx b/include/test/document/xembeddedobjectsupplier.hxx
new file mode 100644
index 000000000..b9caee190
--- /dev/null
+++ b/include/test/document/xembeddedobjectsupplier.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_DOCUMENT_XEMBEDDEDOBJECTSUPPLIER_HXX
+#define INCLUDED_TEST_DOCUMENT_XEMBEDDEDOBJECTSUPPLIER_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XEmbeddedObjectSupplier
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetEmbeddedObject();
+
+protected:
+ ~XEmbeddedObjectSupplier() {}
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_DOCUMENT_XEMBEDDEDOBJECTSUPPLIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/document/xlinktargetsupplier.hxx b/include/test/document/xlinktargetsupplier.hxx
new file mode 100644
index 000000000..de273f89b
--- /dev/null
+++ b/include/test/document/xlinktargetsupplier.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_TEST_DOCUMENT_XLINKTARGETSUPPLIER_HXX
+#define INCLUDED_TEST_DOCUMENT_XLINKTARGETSUPPLIER_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XLinkTargetSupplier
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetLinks();
+
+protected:
+ ~XLinkTargetSupplier() {}
+};
+}
+
+#endif // INCLUDED_TEST_DOCUMENT_XLINKTARGETSUPPLIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/drawing/captionshape.hxx b/include/test/drawing/captionshape.hxx
new file mode 100644
index 000000000..321de6e79
--- /dev/null
+++ b/include/test/drawing/captionshape.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_DRAWING_CAPTION_SHAPE_HXX
+#define INCLUDED_TEST_DRAWING_CAPTION_SHAPE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST CaptionShape
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testCaptionShapeProperties();
+
+protected:
+ ~CaptionShape() {}
+};
+}
+#endif // INCLUDED_TEST_DRAWING_CAPTION_SHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/drawing/xdrawpages.hxx b/include/test/drawing/xdrawpages.hxx
new file mode 100644
index 000000000..b6430df60
--- /dev/null
+++ b/include/test/drawing/xdrawpages.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_DRAWING_XDRAWPAGES_HXX
+#define INCLUDED_TEST_DRAWING_XDRAWPAGES_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XDrawPages
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ virtual void testInsertNewByIndex();
+ virtual void testRemove();
+
+protected:
+ ~XDrawPages() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_DRAWING_XDRAWPAGES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/drawing/xgluepointssupplier.hxx b/include/test/drawing/xgluepointssupplier.hxx
new file mode 100644
index 000000000..0dd8bf58a
--- /dev/null
+++ b/include/test/drawing/xgluepointssupplier.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XGluePointsSupplier
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetGluePoints();
+
+protected:
+ ~XGluePointsSupplier() {}
+};
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/drawing/xshape.hxx b/include/test/drawing/xshape.hxx
new file mode 100644
index 000000000..2e9c26c9d
--- /dev/null
+++ b/include/test/drawing/xshape.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XShape
+{
+public:
+ XShape() = default;
+ XShape(bool bObjSupportsPosition)
+ : m_bObjSupportsPosition(bObjSupportsPosition)
+ {
+ }
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetPosition();
+ void testGetSetSize();
+
+protected:
+ ~XShape() {}
+
+private:
+ bool const m_bObjSupportsPosition{ true };
+};
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/drawing/xshapedescriptor.hxx b/include/test/drawing/xshapedescriptor.hxx
new file mode 100644
index 000000000..2c99e7e9c
--- /dev/null
+++ b/include/test/drawing/xshapedescriptor.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XShapeDescriptor
+{
+public:
+ XShapeDescriptor(const OUString& rShapeType)
+ : m_aShapeType(rShapeType)
+ {
+ }
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetShapeType();
+
+protected:
+ ~XShapeDescriptor() {}
+
+private:
+ OUString const m_aShapeType;
+};
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/drawing/xshapegrouper.hxx b/include/test/drawing/xshapegrouper.hxx
new file mode 100644
index 000000000..1770d3f76
--- /dev/null
+++ b/include/test/drawing/xshapegrouper.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_DRAWING_XSHAPEGROUPER_HXX
+#define INCLUDED_TEST_DRAWING_XSHAPEGROUPER_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XShapeGrouper
+{
+public:
+ void setDrawPage(const css::uno::Reference<css::uno::XInterface>& r_xDrawPage)
+ {
+ m_xDrawPage = r_xDrawPage;
+ }
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGroup();
+ void testUngroup();
+
+protected:
+ ~XShapeGrouper() {}
+
+private:
+ css::uno::Reference<css::uno::XInterface> m_xDrawPage;
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_DRAWING_XSHAPEGROUPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/drawing/xshapes.hxx b/include/test/drawing/xshapes.hxx
new file mode 100644
index 000000000..f04131dc4
--- /dev/null
+++ b/include/test/drawing/xshapes.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_DRAWING_XSHAPES_HXX
+#define INCLUDED_TEST_DRAWING_XSHAPES_HXX
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XShapes
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ void setShape(const css::uno::Reference<css::drawing::XShape>& r_xShape)
+ {
+ m_xShape = r_xShape;
+ }
+
+ void testAddRemove();
+
+protected:
+ ~XShapes() {}
+
+private:
+ css::uno::Reference<css::drawing::XShape> m_xShape;
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_DRAWING_XSHAPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/helper/form.hxx b/include/test/helper/form.hxx
new file mode 100644
index 000000000..d3b80544d
--- /dev/null
+++ b/include/test/helper/form.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_HELPER_FORM_HXX
+#define INCLUDED_TEST_HELPER_FORM_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <sal/types.h>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+namespace helper
+{
+namespace form
+{
+/** @brief Create a XControlShape of kind "CommandButton".
+ *
+ * @param r_xComponent The document.
+ * @param nX The x-position of the shape.
+ * @param nY The y-position of the shape.
+ * @param nHeight The height of the shape.
+ * @param nWidth The width of the shape.
+ * @return The created XControlShape.
+ */
+css::uno::Reference<css::drawing::XControlShape> OOO_DLLPUBLIC_TEST createCommandButton(
+ const css::uno::Reference<css::lang::XComponent>& r_xComponent, const sal_Int32 nX,
+ const sal_Int32 nY, const sal_Int32 nHeight, const sal_Int32 nWidth);
+
+/** @brief Create a XControlShape
+ *
+ * @param r_xComponent The document.
+ * @param r_aKind The kind of the shape.
+ * @param nX The x-position of the shape.
+ * @param nY The y-position of the shape.
+ * @param nHeight The height of the shape.
+ * @param nWidth The width of the shape.
+ * @return The created XControlShape.
+ */
+css::uno::Reference<css::drawing::XControlShape> OOO_DLLPUBLIC_TEST createControlShape(
+ const css::uno::Reference<css::lang::XComponent>& r_xComponent, std::u16string_view r_aKind,
+ const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nHeight, const sal_Int32 nWidth);
+
+} // namespace form
+} // namespace helper
+} // namespace apitest
+
+#endif // INCLUDED_TEST_HELPER_FORM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/helper/shape.hxx b/include/test/helper/shape.hxx
new file mode 100644
index 000000000..dbf374521
--- /dev/null
+++ b/include/test/helper/shape.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_HELPER_SHAPE_HXX
+#define INCLUDED_TEST_HELPER_SHAPE_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <sal/types.h>
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest
+{
+namespace helper
+{
+namespace shape
+{
+/** @brief Create a XShape of kind "Ellipse".
+ *
+ * @param r_xComponent The document
+ * @param nX The x-position of the shape.
+ * @param nY The y-position of the shape.
+ * @param nHeight The height of the shape.
+ * @param nWidth The width of the shape.
+ * @return The created XShape.
+ */
+css::uno::Reference<css::drawing::XShape>
+ OOO_DLLPUBLIC_TEST createEllipse(const css::uno::Reference<css::lang::XComponent>& r_xComponent,
+ const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nWidth,
+ const sal_Int32 nHeight);
+
+/** @brief Create a XShape of kind "Line".
+ *
+ * @param r_xComponent The document
+ * @param nX The x-position of the shape.
+ * @param nY The y-position of the shape.
+ * @param nHeight The height of the shape.
+ * @param nWidth The width of the shape.
+ * @return The created XShape.
+ */
+css::uno::Reference<css::drawing::XShape>
+ OOO_DLLPUBLIC_TEST createLine(const css::uno::Reference<css::lang::XComponent>& r_xComponent,
+ const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nWidth,
+ const sal_Int32 nHeight);
+
+/** @brief Create a XShape of kind "Rectangle".
+ *
+ * @param r_xComponent The document
+ * @param nX The x-position of the shape.
+ * @param nY The y-position of the shape.
+ * @param nHeight The height of the shape.
+ * @param nWidth The width of the shape.
+ * @return The created XShape.
+ */
+css::uno::Reference<css::drawing::XShape> OOO_DLLPUBLIC_TEST
+createRectangle(const css::uno::Reference<css::lang::XComponent>& r_xComponent, const sal_Int32 nX,
+ const sal_Int32 nY, const sal_Int32 nWidth, const sal_Int32 nHeight);
+
+/** @brief Create a XShape.
+ *
+ * @param r_xComponent The document
+ * @param r_aKind The kind of shape.
+ * @param nX The x-position of the shape.
+ * @param nY The y-position of the shape.
+ * @param nHeight The height of the shape.
+ * @param nWidth The width of the shape.
+ * @return The created XShape.
+ */
+css::uno::Reference<css::drawing::XShape> OOO_DLLPUBLIC_TEST createShape(
+ const css::uno::Reference<css::lang::XComponent>& r_xComponent, std::u16string_view r_aKind,
+ const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nWidth, const sal_Int32 nHeight);
+
+} // namespace shape
+} // namespace helper
+} // namespace apitest
+
+#endif // INCLUDED_TEST_HELPER_SHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/helper/transferable.hxx b/include/test/helper/transferable.hxx
new file mode 100644
index 000000000..d0454bc6e
--- /dev/null
+++ b/include/test/helper/transferable.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <rtl/string.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+namespace helper
+{
+namespace transferable
+{
+OString OOO_DLLPUBLIC_TEST getTextSelection(
+ const css::uno::Reference<css::datatransfer::XTransferable>& xTransferable, OString mimeType);
+} // namespace transferable
+} // namespace helper
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/htmltesttools.hxx b/include/test/htmltesttools.hxx
new file mode 100644
index 000000000..154bb902d
--- /dev/null
+++ b/include/test/htmltesttools.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_HTMLTESTTOOLS_HXX
+#define INCLUDED_TEST_HTMLTESTTOOLS_HXX
+
+#include <sal/config.h>
+#include <test/testdllapi.hxx>
+#include <test/xmltesttools.hxx>
+
+#include <libxml/HTMLparser.h>
+#include <libxml/HTMLtree.h>
+
+#include <unotools/tempfile.hxx>
+
+using htmlDocUniquePtr = xmlDocUniquePtr;
+
+class OOO_DLLPUBLIC_TEST HtmlTestTools
+{
+protected:
+ static htmlDocUniquePtr parseHtml(utl::TempFile const& aTempFile);
+ static htmlDocUniquePtr parseHtmlStream(SvStream* pStream);
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/lang/xcomponent.hxx b/include/test/lang/xcomponent.hxx
new file mode 100644
index 000000000..9314749fb
--- /dev/null
+++ b/include/test/lang/xcomponent.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_LANG_XCOMPONENT_HXX
+#define INCLUDED_TEST_LANG_XCOMPONENT_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XComponent
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual void triggerDesktopTerminate() = 0;
+
+ void testAddEventListener();
+ void testRemoveEventListener();
+ void testDispose();
+ void testDisposedByDesktopTerminate();
+
+protected:
+ ~XComponent() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_LANG_XCOMPONENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/lang/xserviceinfo.hxx b/include/test/lang/xserviceinfo.hxx
new file mode 100644
index 000000000..14ce4eaaa
--- /dev/null
+++ b/include/test/lang/xserviceinfo.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_LANG_XSERVICEINFO_HXX
+#define INCLUDED_TEST_LANG_XSERVICEINFO_HXX
+
+#include <vector>
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XServiceInfo
+{
+public:
+ XServiceInfo(const OUString& rImplName, const OUString& rServiceName)
+ : m_aImplName(rImplName)
+ {
+ m_aServiceNames.push_back(rServiceName);
+ }
+ XServiceInfo(const OUString& rImplName, const std::vector<OUString> rServiceNames)
+ : m_aImplName(rImplName)
+ , m_aServiceNames(rServiceNames)
+ {
+ }
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetImplementationName();
+ void testGetSupportedServiceNames();
+ void testSupportsService();
+
+protected:
+ ~XServiceInfo() {}
+
+private:
+ OUString const m_aImplName;
+ std::vector<OUString> m_aServiceNames;
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_LANG_XSERVICEINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/lokcallback.hxx b/include/test/lokcallback.hxx
new file mode 100644
index 000000000..a3f383bce
--- /dev/null
+++ b/include/test/lokcallback.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+#include <test/testdllapi.hxx>
+#include <LibreOfficeKit/LibreOfficeKitTypes.h>
+#include <sfx2/lokcallback.hxx>
+#include <vcl/idle.hxx>
+
+#include <vector>
+
+/**
+A helper to convert SfxLokCallbackInterface to a LIbreOfficeKitCallback for tests.
+
+It reimplements the specialized callbacks and converts them to the generic type/payload
+callback.
+*/
+class OOO_DLLPUBLIC_TEST TestLokCallbackWrapper final : public SfxLokCallbackInterface, public Idle
+{
+public:
+ TestLokCallbackWrapper(LibreOfficeKitCallback callback, void* data);
+ /// Discard all possibly still held events.
+ void clear();
+ /// Set the view id of the associated SfxViewShell.
+ void setLOKViewId(int viewId) { m_viewId = viewId; }
+ virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) override;
+ virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload,
+ int nViewId) override;
+ virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect,
+ int nPart) override;
+ virtual void libreOfficeKitViewUpdatedCallback(int nType) override;
+ virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId,
+ int nSourceViewId) override;
+ virtual void Invoke() override;
+
+private:
+ void callCallback(int nType, const char* pPayload, int nViewId);
+ void startTimer();
+ void flushLOKData();
+ void discardUpdatedTypes(int nType, int nViewId);
+ LibreOfficeKitCallback m_callback;
+ void* m_data;
+ int m_viewId = -1; // the associated SfxViewShell
+ std::vector<int> m_updatedTypes; // value is type
+ struct PerViewIdData
+ {
+ int type;
+ int viewId;
+ int sourceViewId;
+ };
+ std::vector<PerViewIdData> m_updatedTypesPerViewId;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/screenshot_test.hxx b/include/test/screenshot_test.hxx
new file mode 100644
index 000000000..ae0a2a8c1
--- /dev/null
+++ b/include/test/screenshot_test.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SCREENSHOT_TEST_HXX
+#define INCLUDED_TEST_SCREENSHOT_TEST_HXX
+
+#include <sal/config.h>
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <osl/file.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/weld.hxx>
+#include <map>
+#include <string_view>
+
+class VclAbstractDialog;
+typedef std::map<OString, sal_uInt32> mapType;
+
+class OOO_DLLPUBLIC_TEST ScreenshotTest : public test::BootstrapFixture, public unotest::MacrosTest
+{
+private:
+ /// The current UI language
+ OUString maCurrentLanguage;
+
+ /// the set of known dialogs and their ID for usage in createDialogByID
+ mapType maKnownDialogs;
+
+ /// parent for non-dialog buildables
+ weld::GenericDialogController maParent;
+ std::unique_ptr<weld::Container> mxParentWidget;
+
+private:
+ /// helpers
+ void implSaveScreenshot(const BitmapEx& rScreenshot, const OString& rScreenshotId);
+ void saveScreenshot(VclAbstractDialog const& rDialog);
+ void saveScreenshot(weld::Window& rDialog);
+
+ /// helper method to create and dump a dialog based on Builder contents.
+ void dumpDialogToPath(weld::Builder& rDialog);
+
+ /// helper method to populate maKnownDialogs, called in setUp(). Needs to be
+ /// written and has to add entries to maKnownDialogs
+ virtual void registerKnownDialogsByID(mapType& rKnownDialogs) = 0;
+
+ /// dialog creation for known dialogs by ID. Has to be implemented for
+ /// each registered known dialog
+ virtual VclPtr<VclAbstractDialog> createDialogByID(sal_uInt32 nID) = 0;
+
+public:
+ ScreenshotTest();
+ virtual ~ScreenshotTest() override;
+
+ virtual void setUp() override;
+
+ /// Dialog creation for known dialogs by Name (path and UIXMLDescription, *.ui file).
+ /// This uses maKnownDialogs to check if known, and if so, calls createDialogByID
+ /// with the ID from the map
+ VclPtr<VclAbstractDialog> createDialogByName(const OString& rName);
+
+ /// version for AbstractDialogs, the ones created in AbstractDialogFactories
+ void dumpDialogToPath(VclAbstractDialog& rDialog);
+
+ /// fallback version for dialogs for which only the UXMLDescription is known.
+ /// This should be used with care - no active layouting will be done, only the
+ /// VclBuilder will be activated for layouting. Result can thus vary drastically
+ /// compared to the active dialog (can be compared with dialog previewer)
+ void dumpDialogToPath(std::string_view rUIXMLDescription);
+
+ /// helper to process all known dialogs
+ void processAllKnownDialogs();
+
+ /// helper to process an input file containing the UXMLDescriptions
+ /// of the dialogs to dump. It will internally try to detect and open
+ /// as known dialog first. If not successful, it will then use the
+ /// fallback version to dump the dialog.
+ /// The syntax of the input file is as follows:
+ /// - empty lines are allowed
+ /// - lines starting with '#' are treated as comment
+ /// - all other lines should contain a *.ui filename in the same
+ /// notation as in the dialog constructors(see code)
+ void processDialogBatchFile(std::u16string_view rFile);
+
+ /// const access to known dialogs
+ const mapType& getKnownDialogs() const { return maKnownDialogs; }
+};
+
+#endif // INCLUDED_TEST_SCREENSHOT_TEST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/cellarealink.hxx b/include/test/sheet/cellarealink.hxx
new file mode 100644
index 000000000..eb3a13547
--- /dev/null
+++ b/include/test/sheet/cellarealink.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_CELLAREALINK_HXX
+#define INCLUDED_TEST_SHEET_CELLAREALINK_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST CellAreaLink
+{
+public:
+ CellAreaLink(const OUString& rFileURL)
+ : m_aFileURL(rFileURL)
+ {
+ }
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testUrl();
+ void testFilter();
+ void testFilterOptions();
+ void testRefreshDelay();
+ void testRefreshPeriod();
+
+protected:
+ ~CellAreaLink() {}
+
+private:
+ OUString const m_aFileURL;
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_CELLAREALINK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/cellproperties.hxx b/include/test/sheet/cellproperties.hxx
new file mode 100644
index 000000000..aa5fe0f2c
--- /dev/null
+++ b/include/test/sheet/cellproperties.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_CELLPROPERTIES_HXX
+#define INCLUDED_TEST_SHEET_CELLPROPERTIES_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST CellProperties
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testVertJustify();
+ void testRotateReference();
+
+protected:
+ ~CellProperties() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_CELLPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/databaseimportdescriptor.hxx b/include/test/sheet/databaseimportdescriptor.hxx
new file mode 100644
index 000000000..14c9c6f29
--- /dev/null
+++ b/include/test/sheet/databaseimportdescriptor.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_DATABASEIMPORTDESCRIPTOR_HXX
+#define INCLUDED_TEST_SHEET_DATABASEIMPORTDESCRIPTOR_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST DatabaseImportDescriptor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXImportable() = 0;
+
+ void testDatabaseImportDescriptorProperties();
+
+protected:
+ ~DatabaseImportDescriptor() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_DATABASEIMPORTDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/databaserange.hxx b/include/test/sheet/databaserange.hxx
new file mode 100644
index 000000000..9aca2f5eb
--- /dev/null
+++ b/include/test/sheet/databaserange.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_DATABASERANGE_HXX
+#define INCLUDED_TEST_SHEET_DATABASERANGE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST DatabaseRange
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init(const OUString& rDBName) = 0;
+
+ void testMoveCells();
+ void testKeepFormats();
+ void testStripData();
+ void testAutoFilter();
+ void testUseFilterCriteriaSource();
+ void testFilterCriteriaSource();
+ void testRefreshPeriod();
+ void testFromSelection();
+ void testTokenIndex();
+ void testTotalsRow();
+ void testContainsHeader();
+
+protected:
+ ~DatabaseRange() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_DATABASERANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/datapilotfield.hxx b/include/test/sheet/datapilotfield.hxx
new file mode 100644
index 000000000..28e73d7a2
--- /dev/null
+++ b/include/test/sheet/datapilotfield.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_DATAPILOTFIELD_HXX
+#define INCLUDED_TEST_SHEET_DATAPILOTFIELD_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST DataPilotField
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSortInfo();
+ void testLayoutInfo();
+ void testAutoShowInfo();
+ void testReference();
+ void testIsGroupField();
+
+protected:
+ ~DataPilotField() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_DATAPILOTFIELD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/datapilotitem.hxx b/include/test/sheet/datapilotitem.hxx
new file mode 100644
index 000000000..bf711d3ba
--- /dev/null
+++ b/include/test/sheet/datapilotitem.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_DATAPILOTITEM_HXX
+#define INCLUDED_TEST_SHEET_DATAPILOTITEM_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST DataPilotItem
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testProperties();
+
+protected:
+ ~DataPilotItem() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_DATAPILOTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/documentsettings.hxx b/include/test/sheet/documentsettings.hxx
new file mode 100644
index 000000000..7de391f64
--- /dev/null
+++ b/include/test/sheet/documentsettings.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_DOCUMENTSETTINGS_HXX
+#define INCLUDED_TEST_SHEET_DOCUMENTSETTINGS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST DocumentSettings
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testDocumentSettingsProperties();
+
+protected:
+ ~DocumentSettings() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_DOCUMENTSETTINGS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/functiondescription.hxx b/include/test/sheet/functiondescription.hxx
new file mode 100644
index 000000000..bfe719bc5
--- /dev/null
+++ b/include/test/sheet/functiondescription.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_FUNCTIONDESCRIPTION_HXX
+#define INCLUDED_TEST_SHEET_FUNCTIONDESCRIPTION_HXX
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST FunctionDescription
+{
+public:
+ virtual css::uno::Sequence<css::beans::PropertyValue> init() = 0;
+
+ void testFunctionDescriptionProperties();
+
+protected:
+ ~FunctionDescription() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_FUNCTIONDESCRIPTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/globalsheetsettings.hxx b/include/test/sheet/globalsheetsettings.hxx
new file mode 100644
index 000000000..8ae2968de
--- /dev/null
+++ b/include/test/sheet/globalsheetsettings.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_GLOBALSHEETSETTINGS_HXX
+#define INCLUDED_TEST_SHEET_GLOBALSHEETSETTINGS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST GlobalSheetSettings
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGlobalSheetSettingsProperties();
+
+protected:
+ ~GlobalSheetSettings() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_GLOBALSHEETSETTINGS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/scenario.hxx b/include/test/sheet/scenario.hxx
new file mode 100644
index 000000000..3a3ec8d87
--- /dev/null
+++ b/include/test/sheet/scenario.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SCENARIO_HXX
+#define INCLUDED_TEST_SHEET_SCENARIO_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST Scenario
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> getScenarioSpreadsheet() = 0;
+
+ void testScenarioProperties();
+
+protected:
+ ~Scenario() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SCENARIO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/shape.hxx b/include/test/sheet/shape.hxx
new file mode 100644
index 000000000..ad2b7b765
--- /dev/null
+++ b/include/test/sheet/shape.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SHAPE_HXX
+#define INCLUDED_TEST_SHEET_SHAPE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST Shape
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXSheetDocument() = 0;
+
+ void testShapePropertiesAnchor();
+ void testShapePropertiesPosition();
+
+protected:
+ ~Shape() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/sheetcell.hxx b/include/test/sheet/sheetcell.hxx
new file mode 100644
index 000000000..a5d35cee1
--- /dev/null
+++ b/include/test/sheet/sheetcell.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SHEETCELL_HXX
+#define INCLUDED_TEST_SHEET_SHEETCELL_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST SheetCell
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSheetCellProperties();
+
+protected:
+ ~SheetCell() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SHEETCELL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/sheetcellrange.hxx b/include/test/sheet/sheetcellrange.hxx
new file mode 100644
index 000000000..d4c2b551a
--- /dev/null
+++ b/include/test/sheet/sheetcellrange.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SHEETCELLRANGE_HXX
+#define INCLUDED_TEST_SHEET_SHEETCELLRANGE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST SheetCellRange
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSheetCellRangeProperties();
+
+protected:
+ ~SheetCellRange() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SHEETCELLRANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/sheetcellranges.hxx b/include/test/sheet/sheetcellranges.hxx
new file mode 100644
index 000000000..f40b186fa
--- /dev/null
+++ b/include/test/sheet/sheetcellranges.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SHEETCELLRANGES_HXX
+#define INCLUDED_TEST_SHEET_SHEETCELLRANGES_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST SheetCellRanges
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSheetCellRangesProperties();
+
+protected:
+ ~SheetCellRanges() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SHEETCELLRANGES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/sheetfilterdescriptor.hxx b/include/test/sheet/sheetfilterdescriptor.hxx
new file mode 100644
index 000000000..919b84171
--- /dev/null
+++ b/include/test/sheet/sheetfilterdescriptor.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SHEETFILTERDESCRIPTOR_HXX
+#define INCLUDED_TEST_SHEET_SHEETFILTERDESCRIPTOR_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST SheetFilterDescriptor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSheetFilterDescriptorProperties();
+
+protected:
+ ~SheetFilterDescriptor() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SHEETFILTERDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/sheetlink.hxx b/include/test/sheet/sheetlink.hxx
new file mode 100644
index 000000000..0f9e033a8
--- /dev/null
+++ b/include/test/sheet/sheetlink.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SHEETLINK_HXX
+#define INCLUDED_TEST_SHEET_SHEETLINK_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST SheetLink
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSheetLinkProperties();
+
+protected:
+ ~SheetLink() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SHEETLINK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/sheetsortdescriptor2.hxx b/include/test/sheet/sheetsortdescriptor2.hxx
new file mode 100644
index 000000000..0f3c5713d
--- /dev/null
+++ b/include/test/sheet/sheetsortdescriptor2.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SHEETSORTDESCRIPTOR2_HXX
+#define INCLUDED_TEST_SHEET_SHEETSORTDESCRIPTOR2_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST SheetSortDescriptor2
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSheetSortDescriptor2Properties();
+
+protected:
+ ~SheetSortDescriptor2() {}
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_SHEETSORTDESCRIPTOR2_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/spreadsheet.hxx b/include/test/sheet/spreadsheet.hxx
new file mode 100644
index 000000000..597790a8e
--- /dev/null
+++ b/include/test/sheet/spreadsheet.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SPREADSHEET_HXX
+#define INCLUDED_TEST_SHEET_SPREADSHEET_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST Spreadsheet
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXSpreadsheetDocument() = 0;
+
+ void testSpreadsheetProperties();
+
+protected:
+ ~Spreadsheet() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SPREADSHEET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/spreadsheetdocumentsettings.hxx b/include/test/sheet/spreadsheetdocumentsettings.hxx
new file mode 100644
index 000000000..138554157
--- /dev/null
+++ b/include/test/sheet/spreadsheetdocumentsettings.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SPREADSHEETDOCUMENTSETTINGS_HXX
+#define INCLUDED_TEST_SHEET_SPREADSHEETDOCUMENTSETTINGS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST SpreadsheetDocumentSettings
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSpreadsheetDocumentSettingsProperties();
+
+protected:
+ ~SpreadsheetDocumentSettings() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SPREADSHEETDOCUMENTSETTINGS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/spreadsheetviewsettings.hxx b/include/test/sheet/spreadsheetviewsettings.hxx
new file mode 100644
index 000000000..135c95e5d
--- /dev/null
+++ b/include/test/sheet/spreadsheetviewsettings.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SPREADSHEETVIEWSETTINGS_HXX
+#define INCLUDED_TEST_SHEET_SPREADSHEETVIEWSETTINGS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST SpreadsheetViewSettings
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSpreadsheetViewSettingsProperties();
+
+protected:
+ ~SpreadsheetViewSettings() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SPREADSHEETVIEWSETTINGS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/subtotaldescriptor.hxx b/include/test/sheet/subtotaldescriptor.hxx
new file mode 100644
index 000000000..9b2c21f21
--- /dev/null
+++ b/include/test/sheet/subtotaldescriptor.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SUBTOTALDESCRIPTOR_HXX
+#define INCLUDED_TEST_SHEET_SUBTOTALDESCRIPTOR_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST SubTotalDescriptor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSubTotalDescriptorProperties();
+
+protected:
+ ~SubTotalDescriptor() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SUBTOTALDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/tableautoformat.hxx b/include/test/sheet/tableautoformat.hxx
new file mode 100644
index 000000000..3a04784a1
--- /dev/null
+++ b/include/test/sheet/tableautoformat.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_TABLEAUTOFORMAT_HXX
+#define INCLUDED_TEST_SHEET_TABLEAUTOFORMAT_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST TableAutoFormat
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testTableAutoFormatProperties();
+
+protected:
+ ~TableAutoFormat() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_TABLEAUTOFORMAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/tablevalidation.hxx b/include/test/sheet/tablevalidation.hxx
new file mode 100644
index 000000000..809745254
--- /dev/null
+++ b/include/test/sheet/tablevalidation.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_TABLEVALIDATION_HXX
+#define INCLUDED_TEST_SHEET_TABLEVALIDATION_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST TableValidation
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testTableValidationProperties();
+
+protected:
+ ~TableValidation() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_TABLEVALIDATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xactivationbroadcaster.hxx b/include/test/sheet/xactivationbroadcaster.hxx
new file mode 100644
index 000000000..5dc21edc0
--- /dev/null
+++ b/include/test/sheet/xactivationbroadcaster.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XACTIVATIONBROADCASTER_HXX
+#define INCLUDED_TEST_SHEET_XACTIVATIONBROADCASTER_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XActivationBroadcaster
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXSpreadsheet(const sal_Int16 nNumber = 0)
+ = 0;
+
+ void testAddRemoveActivationEventListener();
+
+protected:
+ ~XActivationBroadcaster() {}
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XACTIVATIONBROADCASTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xarealink.hxx b/include/test/sheet/xarealink.hxx
new file mode 100644
index 000000000..15a65f249
--- /dev/null
+++ b/include/test/sheet/xarealink.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XAREALINK_HXX
+#define INCLUDED_TEST_SHEET_XAREALINK_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XAreaLink
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual ~XAreaLink() {}
+
+ void testGetSourceArea();
+ void testSetSourceArea();
+ void testGetDestArea();
+ void testSetDestArea();
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XAREALINK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xarealinks.hxx b/include/test/sheet/xarealinks.hxx
new file mode 100644
index 000000000..1007c28e5
--- /dev/null
+++ b/include/test/sheet/xarealinks.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XAREALINKS_HXX
+#define INCLUDED_TEST_SHEET_XAREALINKS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XAreaLinks
+{
+public:
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+
+ void testInsertAtPosition();
+ void testRemoveByIndex();
+
+protected:
+ ~XAreaLinks(){}
+
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XAREALINKS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xarrayformularange.hxx b/include/test/sheet/xarrayformularange.hxx
new file mode 100644
index 000000000..2529b8153
--- /dev/null
+++ b/include/test/sheet/xarrayformularange.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XArrayFormulaRange
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXSpreadsheet() = 0;
+
+ void testGetSetArrayFormula();
+
+protected:
+ ~XArrayFormulaRange() {}
+};
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xcalculatable.hxx b/include/test/sheet/xcalculatable.hxx
new file mode 100644
index 000000000..94614768e
--- /dev/null
+++ b/include/test/sheet/xcalculatable.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCALCULATABLE_HXX
+#define INCLUDED_TEST_SHEET_XCALCULATABLE_HXX
+
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCalculatable
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Sequence<css::uno::Reference<css::table::XCell>> getXCells() = 0;
+
+ void testCalculate();
+ void testCalculateAll();
+ void testEnableAutomaticCalculation();
+
+protected:
+ ~XCalculatable() {}
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XCALCULATABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xcelladdressable.hxx b/include/test/sheet/xcelladdressable.hxx
new file mode 100644
index 000000000..506415a11
--- /dev/null
+++ b/include/test/sheet/xcelladdressable.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCELLADDRESSABLE_HXX
+#define INCLUDED_TEST_SHEET_XCELLADDRESSABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCellAddressable
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual ~XCellAddressable() {}
+
+ void testGetCellAddress();
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XCELLADDRESSABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xcellformatrangessupplier.hxx b/include/test/sheet/xcellformatrangessupplier.hxx
new file mode 100644
index 000000000..1f2f6d379
--- /dev/null
+++ b/include/test/sheet/xcellformatrangessupplier.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCELLFORMATRANGESSUPPLIER_HXX
+#define INCLUDED_TEST_SHEET_XCELLFORMATRANGESSUPPLIER_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCellFormatRangesSupplier
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetCellFormatRanges();
+
+protected:
+ ~XCellFormatRangesSupplier() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XCELLFORMATRANGESSUPPLIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xcellrangeaddressable.hxx b/include/test/sheet/xcellrangeaddressable.hxx
new file mode 100644
index 000000000..0819b34c1
--- /dev/null
+++ b/include/test/sheet/xcellrangeaddressable.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCELLRANGEADDRESSABLE_HXX
+#define INCLUDED_TEST_SHEET_XCELLRANGEADDRESSABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCellRangeAddressable
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetRangeAddress();
+
+protected:
+ ~XCellRangeAddressable() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XCELLRANGEADDRESSABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xcellrangedata.hxx b/include/test/sheet/xcellrangedata.hxx
new file mode 100644
index 000000000..0b6efef2e
--- /dev/null
+++ b/include/test/sheet/xcellrangedata.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCELLRANGEDATA_HXX
+#define INCLUDED_TEST_SHEET_XCELLRANGEDATA_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCellRangeData
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXCellRangeData() = 0;
+
+ void testGetDataArray();
+ void testSetDataArray();
+ void testGetDataArrayOnTableSheet();
+ void testSetDataArrayOnTableSheet();
+
+protected:
+ ~XCellRangeData() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XCELLRANGEDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xcellrangeformula.hxx b/include/test/sheet/xcellrangeformula.hxx
new file mode 100644
index 000000000..9fcc432c8
--- /dev/null
+++ b/include/test/sheet/xcellrangeformula.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCELLRANGEFORMULA_HXX
+#define INCLUDED_TEST_SHEET_XCELLRANGEFORMULA_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCellRangeFormula
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetFormulaArray();
+
+protected:
+ ~XCellRangeFormula() {}
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XCELLRANGEFORMULA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xcellrangemovement.hxx b/include/test/sheet/xcellrangemovement.hxx
new file mode 100644
index 000000000..a95fdf642
--- /dev/null
+++ b/include/test/sheet/xcellrangemovement.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCELLRANGEMOVEMENT_HXX
+#define INCLUDED_TEST_SHEET_XCELLRANGEMOVEMENT_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCellRangeMovement
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testInsertCells();
+ void testCopyRange();
+ void testMoveRange();
+ void testRemoveRange();
+
+protected:
+ ~XCellRangeMovement() {}
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XCELLRANGEMOVEMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xcellrangereferrer.hxx b/include/test/sheet/xcellrangereferrer.hxx
new file mode 100644
index 000000000..a2a659d17
--- /dev/null
+++ b/include/test/sheet/xcellrangereferrer.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCELLRANGEREFERRER_HXX
+#define INCLUDED_TEST_SHEET_XCELLRANGEREFERRER_HXX
+
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCellRangeReferrer
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void setCellRange(css::table::CellRangeAddress aCellRange) { m_aCellRange = aCellRange; }
+ const css::table::CellRangeAddress& getCellRange() const { return m_aCellRange; }
+ void testGetReferredCells();
+
+protected:
+ ~XCellRangeReferrer() {}
+
+private:
+ css::table::CellRangeAddress m_aCellRange;
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XCELLRANGEREFERRER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xcellrangesquery.hxx b/include/test/sheet/xcellrangesquery.hxx
new file mode 100644
index 000000000..ba275295a
--- /dev/null
+++ b/include/test/sheet/xcellrangesquery.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCELLRANGESQUERY_HXX
+#define INCLUDED_TEST_SHEET_XCELLRANGESQUERY_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCellRangesQuery
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ //Testcases
+ void testQueryColumnDifference();
+ void testQueryContentDifference();
+ void testQueryEmptyCells();
+ void testQueryFormulaCells();
+ void testQueryIntersection();
+ void testQueryRowDifference();
+ void testQueryVisibleCells();
+
+protected:
+ ~XCellRangesQuery() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XCELLRANGESQUERY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xcellseries.hxx b/include/test/sheet/xcellseries.hxx
new file mode 100644
index 000000000..d51d6d9e3
--- /dev/null
+++ b/include/test/sheet/xcellseries.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCELLSERIES_HXX
+#define INCLUDED_TEST_SHEET_XCELLSERIES_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XCellSeries
+{
+public:
+ XCellSeries(sal_Int32 aStartX, sal_Int32 aStartY) : maStartX(aStartX), maStartY(aStartY){}
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+ virtual ~XCellSeries(){}
+
+ void testFillAuto();
+ void testFillSeries();
+
+private:
+ sal_Int32 maStartX;
+ sal_Int32 maStartY;
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XCELLSERIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/include/test/sheet/xconsolidatable.hxx b/include/test/sheet/xconsolidatable.hxx
new file mode 100644
index 000000000..9edb59108
--- /dev/null
+++ b/include/test/sheet/xconsolidatable.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCONSOLIDATABLE_HXX
+#define INCLUDED_TEST_SHEET_XCONSOLIDATABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XConsolidatable
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testCreateConsolidationDescriptor();
+ void testConsolidate();
+
+protected:
+ ~XConsolidatable() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XCONSOLIDATABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xconsolidationdescriptor.hxx b/include/test/sheet/xconsolidationdescriptor.hxx
new file mode 100644
index 000000000..ff5fb5b82
--- /dev/null
+++ b/include/test/sheet/xconsolidationdescriptor.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XCONSOLIDATIONDESCRIPTOR_HXX
+#define INCLUDED_TEST_SHEET_XCONSOLIDATIONDESCRIPTOR_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XConsolidationDescriptor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetFunction();
+ void testSetFunction();
+ void testGetSources();
+ void testSetSources();
+ void testGetStartOutputPosition();
+ void testSetStartOutputPosition();
+ void testGetUseColumnHeaders();
+ void testSetUseColumnHeaders();
+ void testGetUseRowHeaders();
+ void testSetUseRowHeaders();
+ void testGetInsertLinks();
+ void testSetInsertLinks();
+
+protected:
+ ~XConsolidationDescriptor() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XCONSOLIDATIONDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xdatabaserange.hxx b/include/test/sheet/xdatabaserange.hxx
new file mode 100644
index 000000000..388b89d9a
--- /dev/null
+++ b/include/test/sheet/xdatabaserange.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDATABASERANGE_HXX
+#define INCLUDED_TEST_SHEET_XDATABASERANGE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XDatabaseRange
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init(const OUString& rDBName) = 0;
+
+ void testDataArea();
+ void testGetSortDescriptor();
+ void testGetSubtotalDescriptor();
+ void testGetImportDescriptor();
+ void testGetFilterDescriptor();
+ void testRefresh();
+
+protected:
+ ~XDatabaseRange() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XDATABASERANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xdatabaseranges.hxx b/include/test/sheet/xdatabaseranges.hxx
new file mode 100644
index 000000000..b42e6fcc9
--- /dev/null
+++ b/include/test/sheet/xdatabaseranges.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDATABASERANGES_HXX
+#define INCLUDED_TEST_SHEET_XDATABASERANGES_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XDatabaseRanges
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testAddRemoveDbRanges();
+
+protected:
+ ~XDatabaseRanges() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XDATABASERANGES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xdatapilotdescriptor.hxx b/include/test/sheet/xdatapilotdescriptor.hxx
new file mode 100644
index 000000000..9186b52eb
--- /dev/null
+++ b/include/test/sheet/xdatapilotdescriptor.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDATAPILOTDESCRIPTOR_HXX
+#define INCLUDED_TEST_SHEET_XDATAPILOTDESCRIPTOR_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
+
+#include <test/testdllapi.hxx>
+
+#include <vector>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XDataPilotDescriptor
+{
+public:
+ void testSourceRange();
+ void testTag();
+ void testGetFilterDescriptor();
+ void testGetDataPilotFields();
+ void testGetColumnFields();
+ void testGetRowFields();
+ void testGetPageFields();
+ void testGetDataFields();
+ void testGetHiddenFields();
+
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+
+protected:
+ ~XDataPilotDescriptor() {}
+
+private:
+ static void testGetDataPilotFields_Impl( css::uno::Reference< css::sheet::XDataPilotDescriptor > const & xDescr );
+
+ static void checkName( css::uno::Reference< css::container::XIndexAccess > const & xIndex, sal_Int32 nIndex );
+ static std::vector<OUString> maFieldNames;
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XDATAPILOTDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xdatapilotfield.hxx b/include/test/sheet/xdatapilotfield.hxx
new file mode 100644
index 000000000..6622b71bc
--- /dev/null
+++ b/include/test/sheet/xdatapilotfield.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDATAPILOTFIELD_HXX
+#define INCLUDED_TEST_SHEET_XDATAPILOTFIELD_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XDataPilotField
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetItems();
+
+protected:
+ ~XDataPilotField() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XDATAPILOTFIELD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xdatapilotfieldgrouping.hxx b/include/test/sheet/xdatapilotfieldgrouping.hxx
new file mode 100644
index 000000000..550857212
--- /dev/null
+++ b/include/test/sheet/xdatapilotfieldgrouping.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDATAPILOTFIELDGROUPING_HXX
+#define INCLUDED_TEST_SHEET_XDATAPILOTFIELDGROUPING_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XDataPilotFieldGrouping
+{
+public:
+ void testCreateNameGroup();
+ void testCreateDateGroup();
+
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+
+protected:
+ ~XDataPilotFieldGrouping() {}
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XDATAPILOTFIELDGROUPING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xdatapilottable.hxx b/include/test/sheet/xdatapilottable.hxx
new file mode 100644
index 000000000..05ba1e293
--- /dev/null
+++ b/include/test/sheet/xdatapilottable.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDATAPILOTTABLE_HXX
+#define INCLUDED_TEST_SHEET_XDATAPILOTTABLE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/table/XCell.hpp>
+#include <test/testdllapi.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XDataPilotTable
+{
+public:
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+ virtual ~XDataPilotTable();
+
+ void testGetOutputRange();
+ void testRefresh();
+
+protected:
+ css::uno::Reference< css::table::XCell > xCellForChange;
+ css::uno::Reference< css::table::XCell > xCellForCheck;
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XDATAPILOTTABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xdatapilottable2.hxx b/include/test/sheet/xdatapilottable2.hxx
new file mode 100644
index 000000000..a7ffde07d
--- /dev/null
+++ b/include/test/sheet/xdatapilottable2.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDATAPILOTTABLE2_HXX
+#define INCLUDED_TEST_SHEET_XDATAPILOTTABLE2_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/sheet/XDataPilotTable2.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/uno/Sequence.h>
+
+#include <test/testdllapi.hxx>
+
+#include <vector>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XDataPilotTable2
+{
+public:
+ void testGetPositionData();
+ void testGetDrillDownData();
+ void testGetOutputRangeByType();
+ void testInsertDrillDownSheet();
+ virtual ~XDataPilotTable2();
+
+ virtual css::uno::Reference< css::uno::XInterface > initDP2() = 0;
+ virtual css::uno::Reference< css::uno::XInterface > getSheets() = 0;
+
+protected:
+
+private:
+ static void checkDrillDownSheetContent(css::uno::Reference< css::sheet::XSpreadsheet > const & xSheet, const css::uno::Sequence< css::uno::Sequence < css::uno::Any > >& aData);
+
+ void getOutputRanges(css::uno::Reference< css::sheet::XDataPilotTable2 > const &);
+ void buildDataFields(css::uno::Reference< css::sheet::XDataPilotTable2 > const &);
+ void buildResultCells(css::uno::Reference< css::sheet::XDataPilotTable2 > const &);
+
+ std::vector< css::table::CellAddress > maResultCells;
+ std::vector< sal_Int32 > maDataFieldDims;
+ css::table::CellRangeAddress maRangeWhole;
+ css::table::CellRangeAddress maRangeTable;
+ css::table::CellRangeAddress maRangeResult;
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XDATAPILOTTABLE2_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xdatapilottables.hxx b/include/test/sheet/xdatapilottables.hxx
new file mode 100644
index 000000000..f1d367164
--- /dev/null
+++ b/include/test/sheet/xdatapilottables.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDATAPILOTTABLES_HXX
+#define INCLUDED_TEST_SHEET_XDATAPILOTTABLES_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XDataPilotTables
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXSpreadsheet() = 0;
+
+ void testXDataPilotTables();
+
+protected:
+ ~XDataPilotTables() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XDATAPILOTTABLES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xdatapilottablessupplier.hxx b/include/test/sheet/xdatapilottablessupplier.hxx
new file mode 100644
index 000000000..ca1e623b3
--- /dev/null
+++ b/include/test/sheet/xdatapilottablessupplier.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDATAPILOTTABLESSUPPLIER_HXX
+#define INCLUDED_TEST_SHEET_XDATAPILOTTABLESSUPPLIER_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XDataPilotTablesSupplier
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetDataPilotTables();
+
+protected:
+ ~XDataPilotTablesSupplier() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XDATAPILOTTABLESSUPPLIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xddelink.hxx b/include/test/sheet/xddelink.hxx
new file mode 100644
index 000000000..854462a0d
--- /dev/null
+++ b/include/test/sheet/xddelink.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDDELINK_HXX
+#define INCLUDED_TEST_SHEET_XDDELINK_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XDDELink
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetApplication();
+ void testGetItem();
+ void testGetTopic();
+
+protected:
+ explicit XDDELink(OUString const& rURL)
+ : m_URL(rURL)
+ {
+ }
+ ~XDDELink() {}
+
+ OUString const m_URL;
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XDDELINK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xddelinks.hxx b/include/test/sheet/xddelinks.hxx
new file mode 100644
index 000000000..8ceb07cdd
--- /dev/null
+++ b/include/test/sheet/xddelinks.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDDELINKS_HXX
+#define INCLUDED_TEST_SHEET_XDDELINKS_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XDDELinks
+{
+public:
+ XDDELinks(const OUString& rTopic)
+ : m_aTopic(rTopic)
+ {
+ }
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testAddDDELink();
+
+protected:
+ ~XDDELinks() {}
+
+private:
+ OUString const m_aTopic;
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XDDELINKS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xdocumentauditing.hxx b/include/test/sheet/xdocumentauditing.hxx
new file mode 100644
index 000000000..282db0226
--- /dev/null
+++ b/include/test/sheet/xdocumentauditing.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XDocumentAuditing
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXMSF() = 0;
+
+ void testRefreshArrows();
+
+protected:
+ ~XDocumentAuditing() {}
+
+private:
+ bool hasRightAmountOfShapes(const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage,
+ sal_Int32 nElementCount, sal_Int32 nShapes);
+ static void dispatch(const css::uno::Reference<css::frame::XFrame>& xFrame,
+ const css::uno::Sequence<css::beans::PropertyValue>& rArguments);
+ css::awt::Point m_Position;
+};
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xformulaquery.hxx b/include/test/sheet/xformulaquery.hxx
new file mode 100644
index 000000000..8382e961a
--- /dev/null
+++ b/include/test/sheet/xformulaquery.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XFORMULAQUERY_HXX
+#define INCLUDED_TEST_SHEET_XFORMULAQUERY_HXX
+
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XFormulaQuery
+{
+public:
+ XFormulaQuery(css::table::CellRangeAddress aCellRangeAddressDependents,
+ css::table::CellRangeAddress aCellRangeAddressPrecedents,
+ unsigned int nIdxDependents = 1, unsigned int nIdxPrecedents = 1)
+ : m_aCellRangeAddressDependents(aCellRangeAddressDependents)
+ , m_aCellRangeAddressPrecedents(aCellRangeAddressPrecedents)
+ , m_nIdxDependents(nIdxDependents)
+ , m_nIdxPrecedents(nIdxPrecedents)
+ {
+ }
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXSpreadsheet() = 0;
+ void setXCell(css::uno::Reference<css::table::XCell> xCell) { m_xCell = xCell; }
+ css::uno::Reference<css::table::XCell> const& getXCell() const { return m_xCell; }
+
+ void testQueryDependents();
+ void testQueryPrecedents();
+
+protected:
+ ~XFormulaQuery() {}
+
+private:
+ css::uno::Reference<css::table::XCell> m_xCell;
+ css::table::CellRangeAddress m_aCellRangeAddressDependents;
+ css::table::CellRangeAddress m_aCellRangeAddressPrecedents;
+ unsigned int m_nIdxDependents;
+ unsigned int m_nIdxPrecedents;
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XFORMULAQUERY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xfunctiondescriptions.hxx b/include/test/sheet/xfunctiondescriptions.hxx
new file mode 100644
index 000000000..ffffe3b59
--- /dev/null
+++ b/include/test/sheet/xfunctiondescriptions.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XFUNCTIONDESCRIPTIONS_HXX
+#define INCLUDED_TEST_SHEET_XFUNCTIONDESCRIPTIONS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XFunctionDescriptions
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetById();
+
+protected:
+ ~XFunctionDescriptions() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XFUNCTIONDESCRIPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xgoalseek.hxx b/include/test/sheet/xgoalseek.hxx
new file mode 100644
index 000000000..08eeae92a
--- /dev/null
+++ b/include/test/sheet/xgoalseek.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XGOALSEEK_HXX
+#define INCLUDED_TEST_SHEET_XGOALSEEK_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XGoalSeek
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSeekGoal();
+
+protected:
+ virtual ~XGoalSeek() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XGOALSEEK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xheaderfootercontent.hxx b/include/test/sheet/xheaderfootercontent.hxx
new file mode 100644
index 000000000..64d3fea46
--- /dev/null
+++ b/include/test/sheet/xheaderfootercontent.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XHEADERFOOTERCONTENT_HXX
+#define INCLUDED_TEST_SHEET_XHEADERFOOTERCONTENT_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XHeaderFooterContent
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetCenterText();
+ void testGetLeftText();
+ void testGetRightText();
+
+protected:
+ ~XHeaderFooterContent() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XHEADERFOOTERCONTENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xlabelrange.hxx b/include/test/sheet/xlabelrange.hxx
new file mode 100644
index 000000000..24d2f3a07
--- /dev/null
+++ b/include/test/sheet/xlabelrange.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XLABELRANGE_HXX
+#define INCLUDED_TEST_SHEET_XLABELRANGE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XLabelRange
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetDataArea();
+ void testGetSetLabelArea();
+
+protected:
+ ~XLabelRange() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XLABELRANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xlabelranges.hxx b/include/test/sheet/xlabelranges.hxx
new file mode 100644
index 000000000..820c031d7
--- /dev/null
+++ b/include/test/sheet/xlabelranges.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XLABELRANGES_HXX
+#define INCLUDED_TEST_SHEET_XLABELRANGES_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XLabelRanges
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testAddNew();
+ void testRemoveByIndex();
+
+protected:
+ ~XLabelRanges() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XLABELRANGES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xmultiformulatokens.hxx b/include/test/sheet/xmultiformulatokens.hxx
new file mode 100644
index 000000000..8f883a320
--- /dev/null
+++ b/include/test/sheet/xmultiformulatokens.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XMULTIFORMULATOKENS_HXX
+#define INCLUDED_TEST_SHEET_XMULTIFORMULATOKENS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XMultiFormulaTokens
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual void setUp() = 0;
+ virtual void tearDown() = 0;
+
+ void testGetCount();
+ void testGetSetTokens();
+
+protected:
+ ~XMultiFormulaTokens() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XMULTIFORMULATOKENS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xmultipleoperation.hxx b/include/test/sheet/xmultipleoperation.hxx
new file mode 100644
index 000000000..107902da1
--- /dev/null
+++ b/include/test/sheet/xmultipleoperation.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XMULTIPLEOPERATION_HXX
+#define INCLUDED_TEST_SHEET_XMULTIPLEOPERATION_HXX
+
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XMultipleOperation
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXSpreadsheet() = 0;
+
+ void testSetTableOperation();
+
+protected:
+ ~XMultipleOperation() {}
+
+private:
+ static void fillCells(css::uno::Reference<css::sheet::XSpreadsheet> const&);
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XMULTIPLEOPERATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xnamedrange.hxx b/include/test/sheet/xnamedrange.hxx
new file mode 100644
index 000000000..f088bf2ab
--- /dev/null
+++ b/include/test/sheet/xnamedrange.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XNAMEDRANGE_HXX
+#define INCLUDED_TEST_SHEET_XNAMEDRANGE_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/sheet/XNamedRange.hpp>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XNamedRange
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ // XNamedRange
+ void testGetContent();
+ void testSetContent();
+ void testGetType();
+ void testSetType();
+ void testGetReferencePosition();
+ void testSetReferencePosition();
+
+protected:
+ ~XNamedRange() {}
+
+ virtual css::uno::Reference<css::sheet::XNamedRange> getNamedRange(const OUString&) = 0;
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XNAMEDRANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xnamedranges.hxx b/include/test/sheet/xnamedranges.hxx
new file mode 100644
index 000000000..8d02773f8
--- /dev/null
+++ b/include/test/sheet/xnamedranges.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XNAMEDRANGES_HXX
+#define INCLUDED_TEST_SHEET_XNAMEDRANGES_HXX
+
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XNamedRanges
+{
+public:
+ // remove default entry
+ XNamedRanges()
+ : maNameToRemove("initial1")
+ {
+ }
+
+ // removes given entry
+ XNamedRanges(const OUString& rNameToRemove)
+ : maNameToRemove(rNameToRemove)
+ {
+ }
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXNamedRanges(sal_Int32 nSheet = 0) = 0;
+
+ // XNamedRanges
+ void testAddNewByName();
+ void testAddNewFromTitles();
+ void testRemoveByName();
+ void testOutputList();
+
+protected:
+ ~XNamedRanges(){};
+ css::uno::Reference<css::sheet::XSpreadsheet> xSheet;
+
+private:
+ OUString maNameToRemove;
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XNAMEDRANGES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xprintareas.hxx b/include/test/sheet/xprintareas.hxx
new file mode 100644
index 000000000..b3edbeb7d
--- /dev/null
+++ b/include/test/sheet/xprintareas.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XPRINTAREAS_HXX
+#define INCLUDED_TEST_SHEET_XPRINTAREAS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XPrintAreas
+{
+public:
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+
+ void testSetAndGetPrintTitleColumns(); //getter and setter in one test case
+ void testSetAndGetPrintTitleRows();
+
+ void testGetPrintAreas(); // returns a sequence containing all print areas of the sheet.
+ void testSetPrintAreas(); // sets the print areas of the sheet.
+ void testGetTitleColumns(); // returns the range that is specified as title columns range.
+ void testSetTitleColumns(); // specifies a range of columns as title columns range.
+ void testGetTitleRows(); // returns the range that is specified as title rows range.
+ void testSetTitleRows(); // specifies a range of rows as title rows range.
+
+protected:
+ ~XPrintAreas() {}
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XPRINTAREAS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xrecentfunctions.hxx b/include/test/sheet/xrecentfunctions.hxx
new file mode 100644
index 000000000..8f7ac55a2
--- /dev/null
+++ b/include/test/sheet/xrecentfunctions.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XRECENTFUNCTIONS_HXX
+#define INCLUDED_TEST_SHEET_XRECENTFUNCTIONS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XRecentFunctions
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetRecentFunctionIds();
+ void testSetRecentFunctionIds();
+ void testGetMaxRecentFunctions();
+
+protected:
+ ~XRecentFunctions() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XRECENTFUNCTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xscenario.hxx b/include/test/sheet/xscenario.hxx
new file mode 100644
index 000000000..8892d26c1
--- /dev/null
+++ b/include/test/sheet/xscenario.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSCENARIO_HXX
+#define INCLUDED_TEST_SHEET_XSCENARIO_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XScenario
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> getScenarioSpreadsheet() = 0;
+
+ void testScenario();
+
+protected:
+ ~XScenario() {}
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XSCENARIO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xscenarioenhanced.hxx b/include/test/sheet/xscenarioenhanced.hxx
new file mode 100644
index 000000000..ff5261f31
--- /dev/null
+++ b/include/test/sheet/xscenarioenhanced.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSCENARIOENHANCED_HXX
+#define INCLUDED_TEST_SHEET_XSCENARIOENHANCED_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XScenarioEnhanced
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> getScenarioSpreadsheet() = 0;
+
+ void testGetRanges();
+
+protected:
+ ~XScenarioEnhanced() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSCENARIOENHANCED_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xscenarios.hxx b/include/test/sheet/xscenarios.hxx
new file mode 100644
index 000000000..f890a5030
--- /dev/null
+++ b/include/test/sheet/xscenarios.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSCENARIOS_HXX
+#define INCLUDED_TEST_SHEET_XSCENARIOS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XScenarios
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testAddNewByName();
+ void testRemoveByName();
+
+protected:
+ ~XScenarios() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSCENARIOS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xscenariossupplier.hxx b/include/test/sheet/xscenariossupplier.hxx
new file mode 100644
index 000000000..e4a6eea11
--- /dev/null
+++ b/include/test/sheet/xscenariossupplier.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSCENARIOSSUPPLIER_HXX
+#define INCLUDED_TEST_SHEET_XSCENARIOSSUPPLIER_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XScenariosSupplier
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetScenarios();
+
+protected:
+ ~XScenariosSupplier() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSCENARIOSSUPPLIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsheetannotation.hxx b/include/test/sheet/xsheetannotation.hxx
new file mode 100644
index 000000000..0003d8b11
--- /dev/null
+++ b/include/test/sheet/xsheetannotation.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETANNOTATION_HXX
+#define INCLUDED_TEST_SHEET_XSHEETANNOTATION_HXX
+
+#include <com/sun/star/sheet/XSheetAnnotation.hpp>
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/table/CellAddress.hpp>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetAnnotation
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ // XSheetAnnotation
+ void testGetPosition();
+ void testGetAuthor();
+ void testGetDate();
+ void testGetIsVisible();
+ void testSetIsVisible();
+
+protected:
+ ~XSheetAnnotation() {}
+
+ virtual css::uno::Reference<css::sheet::XSheetAnnotation>
+ getAnnotation(css::table::CellAddress&) = 0;
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETANNOTATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetannotationanchor.hxx b/include/test/sheet/xsheetannotationanchor.hxx
new file mode 100644
index 000000000..a0c6fc58d
--- /dev/null
+++ b/include/test/sheet/xsheetannotationanchor.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETANNOTATIONANCHOR_HXX
+#define INCLUDED_TEST_SHEET_XSHEETANNOTATIONANCHOR_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetAnnotationAnchor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetAnnotation();
+
+protected:
+ ~XSheetAnnotationAnchor() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETANNOTATIONANCHOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsheetannotations.hxx b/include/test/sheet/xsheetannotations.hxx
new file mode 100644
index 000000000..f9b92968f
--- /dev/null
+++ b/include/test/sheet/xsheetannotations.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETANNOTATIONS_HXX
+#define INCLUDED_TEST_SHEET_XSHEETANNOTATIONS_HXX
+
+#include <com/sun/star/sheet/XSheetAnnotations.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+#include <tools/long.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XSheetAnnotations
+{
+public:
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+ virtual css::uno::Reference< css::sheet::XSheetAnnotations> getAnnotations(tools::Long nIndex) = 0;
+
+ // XSheetAnnotations
+ void testIndex();
+ void testInsertNew();
+ void testRemoveByIndex();
+ void testCount();
+
+protected:
+ ~XSheetAnnotations() {}
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETANNOTATIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetannotationshapesupplier.hxx b/include/test/sheet/xsheetannotationshapesupplier.hxx
new file mode 100644
index 000000000..72600c1aa
--- /dev/null
+++ b/include/test/sheet/xsheetannotationshapesupplier.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETANNOTATIONSHAPESUPPLIER_HXX
+#define INCLUDED_TEST_SHEET_XSHEETANNOTATIONSHAPESUPPLIER_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XSheetAnnotationShapeSupplier
+{
+public:
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+ virtual ~XSheetAnnotationShapeSupplier(){}
+
+ void testGetAnnotationShape();
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETANNOTATIONSHAPESUPPLIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetannotationssupplier.hxx b/include/test/sheet/xsheetannotationssupplier.hxx
new file mode 100644
index 000000000..cc9e008ec
--- /dev/null
+++ b/include/test/sheet/xsheetannotationssupplier.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETANNOTATIONSSUPPLIER_HXX
+#define INCLUDED_TEST_SHEET_XSHEETANNOTATIONSSUPPLIER_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetAnnotationsSupplier
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetAnnotations();
+
+protected:
+ ~XSheetAnnotationsSupplier() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETANNOTATIONSSUPPLIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsheetauditing.hxx b/include/test/sheet/xsheetauditing.hxx
new file mode 100644
index 000000000..44c1ddd5c
--- /dev/null
+++ b/include/test/sheet/xsheetauditing.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETAUDITING_HXX
+#define INCLUDED_TEST_SHEET_XSHEETAUDITING_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetAuditing
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testShowHideDependents();
+ void testShowHidePrecedents();
+ void testShowErrors();
+ void testShowInvalid();
+ void testClearArrows();
+
+protected:
+ ~XSheetAuditing() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETAUDITING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsheetcellcursor.hxx b/include/test/sheet/xsheetcellcursor.hxx
new file mode 100644
index 000000000..3686ac521
--- /dev/null
+++ b/include/test/sheet/xsheetcellcursor.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETCELLCURSOR_HXX
+#define INCLUDED_TEST_SHEET_XSHEETCELLCURSOR_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetCellCursor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testCollapseToCurrentArray();
+ void testCollapseToCurrentRegion();
+ void testCollapseToMergedArea();
+ void testCollapseToSize();
+ void testExpandToEntireColumns();
+ void testExpandToEntireRows();
+
+protected:
+ ~XSheetCellCursor() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETCELLCURSOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsheetcellrange.hxx b/include/test/sheet/xsheetcellrange.hxx
new file mode 100644
index 000000000..42ce2d094
--- /dev/null
+++ b/include/test/sheet/xsheetcellrange.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETCELLRANGE_HXX
+#define INCLUDED_TEST_SHEET_XSHEETCELLRANGE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetCellRange
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSpreadsheet();
+
+protected:
+ ~XSheetCellRange() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETCELLRANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetcellrangecontainer.hxx b/include/test/sheet/xsheetcellrangecontainer.hxx
new file mode 100644
index 000000000..734c2c4e2
--- /dev/null
+++ b/include/test/sheet/xsheetcellrangecontainer.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETCELLRANGECONTAINER_HXX
+#define INCLUDED_TEST_SHEET_XSHEETCELLRANGECONTAINER_HXX
+
+#include <com/sun/star/table/CellRangeAddress.hpp>
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetCellRangeContainer
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testAddRemoveRangeAddress();
+ void testAddRemoveRangeAddresses();
+
+protected:
+ ~XSheetCellRangeContainer() {}
+ static css::uno::Sequence<com::sun::star::table::CellRangeAddress> createCellRangeAddresses();
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETCELLRANGECONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetcellranges.hxx b/include/test/sheet/xsheetcellranges.hxx
new file mode 100644
index 000000000..4f21f446c
--- /dev/null
+++ b/include/test/sheet/xsheetcellranges.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETCELLRANGES_HXX
+#define INCLUDED_TEST_SHEET_XSHEETCELLRANGES_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetCellRanges
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetCells();
+ void testGetRangeAddresses();
+ void testGetRangeAddressesAsString();
+
+protected:
+ ~XSheetCellRanges() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETCELLRANGES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetcondition.hxx b/include/test/sheet/xsheetcondition.hxx
new file mode 100644
index 000000000..c69625f44
--- /dev/null
+++ b/include/test/sheet/xsheetcondition.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETCONDITION_HXX
+#define INCLUDED_TEST_SHEET_XSHEETCONDITION_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetCondition
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetFormula1();
+ void testGetSetFormula2();
+ void testGetSetOperator();
+ void testGetSetSourcePosition();
+
+protected:
+ ~XSheetCondition() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETCONDITION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetconditionalentries.hxx b/include/test/sheet/xsheetconditionalentries.hxx
new file mode 100644
index 000000000..673e7ceb1
--- /dev/null
+++ b/include/test/sheet/xsheetconditionalentries.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETCONDITIONALENTRIES_HXX
+#define INCLUDED_TEST_SHEET_XSHEETCONDITIONALENTRIES_HXX
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetConditionalEntries
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Sequence<com::sun::star::beans::PropertyValue>
+ createCondition(const sal_Int32 nr) = 0;
+
+ void testAddNew();
+ void testClear();
+ void testRemoveByIndex();
+
+protected:
+ ~XSheetConditionalEntries() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETCONDITIONALENTRIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetconditionalentry.hxx b/include/test/sheet/xsheetconditionalentry.hxx
new file mode 100644
index 000000000..d143f7843
--- /dev/null
+++ b/include/test/sheet/xsheetconditionalentry.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETCONDITIONALENTRY_HXX
+#define INCLUDED_TEST_SHEET_XSHEETCONDITIONALENTRY_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetConditionalEntry
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetStyleName();
+
+protected:
+ ~XSheetConditionalEntry() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETCONDITIONALENTRY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetfilterable.hxx b/include/test/sheet/xsheetfilterable.hxx
new file mode 100644
index 000000000..a46b10b07
--- /dev/null
+++ b/include/test/sheet/xsheetfilterable.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETFILTERABLE_HXX
+#define INCLUDED_TEST_SHEET_XSHEETFILTERABLE_HXX
+
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XSheetFilterable
+{
+public:
+ virtual css::uno::Reference< css::uno::XInterface > init() =0;
+ virtual css::uno::Reference< css::uno::XInterface > getXSpreadsheet() =0;
+
+ void testCreateFilterDescriptor();
+ void testFilter();
+
+protected:
+ ~XSheetFilterable() {}
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETFILTERABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetfilterableex.hxx b/include/test/sheet/xsheetfilterableex.hxx
new file mode 100644
index 000000000..71be889a3
--- /dev/null
+++ b/include/test/sheet/xsheetfilterableex.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETFILTERABLEEX_HXX
+#define INCLUDED_TEST_SHEET_XSHEETFILTERABLEEX_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetFilterableEx
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXSpreadsheet() = 0;
+
+ void testCreateFilterDescriptorByObject();
+
+protected:
+ ~XSheetFilterableEx() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETFILTERABLEEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsheetfilterdescriptor.hxx b/include/test/sheet/xsheetfilterdescriptor.hxx
new file mode 100644
index 000000000..65620f0f0
--- /dev/null
+++ b/include/test/sheet/xsheetfilterdescriptor.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETFILTERDESCRIPTOR_HXX
+#define INCLUDED_TEST_SHEET_XSHEETFILTERDESCRIPTOR_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetFilterDescriptor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetFilterFields();
+
+protected:
+ ~XSheetFilterDescriptor() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XSHEETFILTERDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsheetfilterdescriptor2.hxx b/include/test/sheet/xsheetfilterdescriptor2.hxx
new file mode 100644
index 000000000..7555c65cb
--- /dev/null
+++ b/include/test/sheet/xsheetfilterdescriptor2.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETFILTERDESCRIPTOR2_HXX
+#define INCLUDED_TEST_SHEET_XSHEETFILTERDESCRIPTOR2_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetFilterDescriptor2
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetFilterFields2();
+
+protected:
+ ~XSheetFilterDescriptor2() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XSHEETFILTERDESCRIPTOR2_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsheetfilterdescriptor3.hxx b/include/test/sheet/xsheetfilterdescriptor3.hxx
new file mode 100644
index 000000000..1d8f94087
--- /dev/null
+++ b/include/test/sheet/xsheetfilterdescriptor3.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETFILTERDESCRIPTOR3_HXX
+#define INCLUDED_TEST_SHEET_XSHEETFILTERDESCRIPTOR3_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetFilterDescriptor3
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetFilterFields3();
+
+protected:
+ ~XSheetFilterDescriptor3() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XSHEETFILTERDESCRIPTOR3_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsheetlinkable.hxx b/include/test/sheet/xsheetlinkable.hxx
new file mode 100644
index 000000000..fc239fb7b
--- /dev/null
+++ b/include/test/sheet/xsheetlinkable.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETLINKABLE_HXX
+#define INCLUDED_TEST_SHEET_XSHEETLINKABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetLinkable
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual OUString getFileURL() = 0;
+
+ void testSheetLinkable();
+
+protected:
+ ~XSheetLinkable() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETLINKABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetoperation.hxx b/include/test/sheet/xsheetoperation.hxx
new file mode 100644
index 000000000..ea436ce38
--- /dev/null
+++ b/include/test/sheet/xsheetoperation.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETOPERATION_HXX
+#define INCLUDED_TEST_SHEET_XSHEETOPERATION_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetOperation
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testComputeFunction();
+ void testClearContents();
+
+protected:
+ ~XSheetOperation() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETOPERATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetoutline.hxx b/include/test/sheet/xsheetoutline.hxx
new file mode 100644
index 000000000..0210e6214
--- /dev/null
+++ b/include/test/sheet/xsheetoutline.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETOUTLINE_HXX
+#define INCLUDED_TEST_SHEET_XSHEETOUTLINE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetOutline
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ // XSheetOutline
+ void testHideDetail();
+ void testShowDetail();
+ void testShowLevel();
+ void testUngroup();
+ void testGroup();
+ void testClearOutline();
+
+protected:
+ ~XSheetOutline() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETOUTLINE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xsheetpagebreak.hxx b/include/test/sheet/xsheetpagebreak.hxx
new file mode 100644
index 000000000..e7a47628d
--- /dev/null
+++ b/include/test/sheet/xsheetpagebreak.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETPAGEBREAK_HXX
+#define INCLUDED_TEST_SHEET_XSHEETPAGEBREAK_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSheetPageBreak
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetColumnPageBreaks();
+ void testGetRowPageBreaks();
+ void testRemoveAllManualPageBreaks();
+
+protected:
+ ~XSheetPageBreak() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETPAGEBREAK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xspreadsheet.hxx b/include/test/sheet/xspreadsheet.hxx
new file mode 100644
index 000000000..8033b8e55
--- /dev/null
+++ b/include/test/sheet/xspreadsheet.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSPREADSHEET_HXX
+#define INCLUDED_TEST_SHEET_XSPREADSHEET_HXX
+
+#include <test/testdllapi.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSpreadsheet
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testCreateCursor();
+ void testCreateCursorByRange();
+
+protected:
+ ~XSpreadsheet() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSPREADSHEET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xspreadsheetdocument.hxx b/include/test/sheet/xspreadsheetdocument.hxx
new file mode 100644
index 000000000..8f5662489
--- /dev/null
+++ b/include/test/sheet/xspreadsheetdocument.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSPREADSHEETDOCUMENT_HXX
+#define INCLUDED_TEST_SHEET_XSPREADSHEETDOCUMENT_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest {
+
+class XSpreadsheetDocument
+{
+public:
+ XSpreadsheetDocument(sal_Int32 nSheets) : mnSheets(nSheets) {}
+
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+
+ void testGetSheets();
+
+protected:
+ ~XSpreadsheetDocument() {}
+
+private:
+ sal_Int32 mnSheets;
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XSPREADSHEETDOCUMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xspreadsheets.hxx b/include/test/sheet/xspreadsheets.hxx
new file mode 100644
index 000000000..2ec471db6
--- /dev/null
+++ b/include/test/sheet/xspreadsheets.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSPREADSHEETS_HXX
+#define INCLUDED_TEST_SHEET_XSPREADSHEETS_HXX
+
+#include <test/testdllapi.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSpreadsheets
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual ~XSpreadsheets() {}
+
+ void testInsertNewByName();
+ void testInsertNewByNameBadName();
+ void testMoveByName();
+ void testCopyByName();
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSPREADSHEETS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xspreadsheets2.hxx b/include/test/sheet/xspreadsheets2.hxx
new file mode 100644
index 000000000..e96367d94
--- /dev/null
+++ b/include/test/sheet/xspreadsheets2.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSPREADSHEETS2_HXX
+#define INCLUDED_TEST_SHEET_XSPREADSHEETS2_HXX
+
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XNamedRanges.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XSpreadsheets2
+{
+public:
+ XSpreadsheets2();
+ virtual ~XSpreadsheets2();
+
+ // XSpreadsheets2
+ void testImportedSheetNameAndIndex();
+ void testImportString();
+ void testImportValue();
+ void testImportFormulaBasicMath();
+ void testImportFormulaWithNamedRange();
+ void testImportOverExistingNamedRange();
+ void testImportNamedRangeDefinedInSource();
+ void testImportNamedRangeRedefinedInSource();
+ void testImportNewNamedRange();
+ void testImportCellStyle();
+ void testLastAfterInsertCopy();
+
+ virtual css::uno::Reference< css::lang::XComponent > getComponent() = 0;
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+ virtual css::uno::Reference< css::lang::XComponent > loadFromDesktop(const OUString&) = 0;
+ virtual void createFileURL(const OUString&, OUString&) = 0;
+
+protected:
+ css::uno::Reference< css::sheet::XSpreadsheetDocument> xDocument;
+
+private:
+ css::uno::Reference< css::sheet::XSpreadsheetDocument> getDoc(const OUString&);
+ static css::uno::Reference< css::sheet::XNamedRanges> getNamedRanges(css::uno::Reference< css::sheet::XSpreadsheetDocument > const &);
+ void importSheetToCopy();
+ static bool isExternalReference(const OUString& aDestContent, std::u16string_view aSrcContent );
+
+ css::uno::Reference< css::sheet::XSpreadsheetDocument> xDestDoc;
+ css::uno::Reference< css::sheet::XSpreadsheet > xDestSheet;
+ css::uno::Reference< css::sheet::XSpreadsheet > xSrcSheet;
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XSPREADSHEETS2_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xspreadsheetview.hxx b/include/test/sheet/xspreadsheetview.hxx
new file mode 100644
index 000000000..144b54ac1
--- /dev/null
+++ b/include/test/sheet/xspreadsheetview.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSPREADSHEETVIEW_HXX
+#define INCLUDED_TEST_SHEET_XSPREADSHEETVIEW_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSpreadsheetView
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetActiveSheet();
+
+protected:
+ ~XSpreadsheetView() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XSPREADSHEETVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsubtotalcalculatable.hxx b/include/test/sheet/xsubtotalcalculatable.hxx
new file mode 100644
index 000000000..2160816d3
--- /dev/null
+++ b/include/test/sheet/xsubtotalcalculatable.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSUBTOTALCALCULATABLE_HXX
+#define INCLUDED_TEST_SHEET_XSUBTOTALCALCULATABLE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSubTotalCalculatable
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXSpreadsheet() = 0;
+
+ void testCreateSubTotalDescriptor();
+ void testApplyRemoveSubTotals();
+
+protected:
+ ~XSubTotalCalculatable() {}
+};
+}
+#endif // INCLUDED_TEST_SHEET_XSUBTOTALCALCULATABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsubtotaldescriptor.hxx b/include/test/sheet/xsubtotaldescriptor.hxx
new file mode 100644
index 000000000..dc570c181
--- /dev/null
+++ b/include/test/sheet/xsubtotaldescriptor.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSUBTOTALDESCRIPTOR_HXX
+#define INCLUDED_TEST_SHEET_XSUBTOTALDESCRIPTOR_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSubTotalDescriptor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testAddNew();
+ void testClear();
+
+protected:
+ ~XSubTotalDescriptor() {}
+};
+}
+#endif // INCLUDED_TEST_SHEET_XSUBTOTALDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xsubtotalfield.hxx b/include/test/sheet/xsubtotalfield.hxx
new file mode 100644
index 000000000..c5925ee6c
--- /dev/null
+++ b/include/test/sheet/xsubtotalfield.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSUBTOTALFIELD_HXX
+#define INCLUDED_TEST_SHEET_XSUBTOTALFIELD_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSubTotalField
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetGroupColumn();
+ void testGetSetTotalColumns();
+
+protected:
+ ~XSubTotalField() {}
+};
+}
+#endif // INCLUDED_TEST_SHEET_XSUBTOTALFIELD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xuniquecellformatrangessupplier.hxx b/include/test/sheet/xuniquecellformatrangessupplier.hxx
new file mode 100644
index 000000000..f3adcc216
--- /dev/null
+++ b/include/test/sheet/xuniquecellformatrangessupplier.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XUNIQUECELLFORMATRANGESSUPPLIER_HXX
+#define INCLUDED_TEST_SHEET_XUNIQUECELLFORMATRANGESSUPPLIER_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XUniqueCellFormatRangesSupplier
+{
+public:
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+
+ void testGetUniqueCellFormatRanges();
+
+protected:
+ ~XUniqueCellFormatRangesSupplier() {}
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XUNIQUECELLFORMATRANGESSUPPLIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xusedareacursor.hxx b/include/test/sheet/xusedareacursor.hxx
new file mode 100644
index 000000000..95b4fe402
--- /dev/null
+++ b/include/test/sheet/xusedareacursor.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XUSEDAREACURSOR_HXX
+#define INCLUDED_TEST_SHEET_XUSEDAREACURSOR_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XUsedAreaCursor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXSpreadsheet() = 0;
+ virtual ~XUsedAreaCursor() {}
+
+ void testGotoStartOfUsedArea();
+ void testGotoEndOfUsedArea();
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XUSEDAREACURSOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xviewfreezable.hxx b/include/test/sheet/xviewfreezable.hxx
new file mode 100644
index 000000000..642e2eaf0
--- /dev/null
+++ b/include/test/sheet/xviewfreezable.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XVIEWFREEZABLE_HXX
+#define INCLUDED_TEST_SHEET_XVIEWFREEZABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XViewFreezable
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual ~XViewFreezable() {}
+
+ void testFreeze();
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XVIEWFREEZABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/sheet/xviewpane.hxx b/include/test/sheet/xviewpane.hxx
new file mode 100644
index 000000000..ba0689bd2
--- /dev/null
+++ b/include/test/sheet/xviewpane.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XVIEWPANE_HXX
+#define INCLUDED_TEST_SHEET_XVIEWPANE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XViewPane
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testFirstVisibleColumn();
+ void testFirstVisibleRow();
+ void testVisibleRange();
+
+protected:
+ virtual ~XViewPane() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XVIEWPANE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/sheet/xviewsplitable.hxx b/include/test/sheet/xviewsplitable.hxx
new file mode 100644
index 000000000..36956d375
--- /dev/null
+++ b/include/test/sheet/xviewsplitable.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XVIEWSPLITABLE_HXX
+#define INCLUDED_TEST_SHEET_XVIEWSPLITABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XViewSplitable
+{
+
+public:
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+ virtual ~XViewSplitable(){}
+
+ void testSplit();
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XVIEWSPLITABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/style/xstyleloader.hxx b/include/test/style/xstyleloader.hxx
new file mode 100644
index 000000000..ca34a72cf
--- /dev/null
+++ b/include/test/style/xstyleloader.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_STYLE_XSTYLELOADER_HXX
+#define INCLUDED_TEST_STYLE_XSTYLELOADER_HXX
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <rtl/ustring.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XStyleLoader
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::sheet::XSpreadsheetDocument> getTargetDoc() = 0;
+ virtual css::uno::Reference<css::lang::XComponent> getSourceComponent() = 0;
+ virtual OUString getTestURL() = 0;
+
+ // XStyleLoader
+ void testLoadStylesFromURL();
+ void testLoadStylesFromStream();
+ // XStyleLoader2
+ void testLoadStylesFromDocument();
+
+private:
+ static void checkStyleProperties(
+ css::uno::Reference<css::style::XStyleFamiliesSupplier> const& xFamilySupplier);
+
+protected:
+ ~XStyleLoader() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_STYLE_XSTYLELOADER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/table/tablecolumn.hxx b/include/test/table/tablecolumn.hxx
new file mode 100644
index 000000000..a6ea3a01b
--- /dev/null
+++ b/include/test/table/tablecolumn.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST TableColumn
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ void setSpreadsheet(const css::uno::Reference<css::sheet::XSpreadsheet>& r_xSheet)
+ {
+ m_xSheet = r_xSheet;
+ }
+
+ void testTableColumnProperties();
+
+protected:
+ ~TableColumn() {}
+
+private:
+ css::uno::Reference<css::sheet::XSpreadsheet> m_xSheet;
+};
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/table/tablerow.hxx b/include/test/table/tablerow.hxx
new file mode 100644
index 000000000..150534bb2
--- /dev/null
+++ b/include/test/table/tablerow.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TABLE_TABLEROW_HXX
+#define INCLUDED_TEST_TABLE_TABLEROW_HXX
+
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST TableRow
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testTableRowProperties();
+
+protected:
+ ~TableRow() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_TABLE_TABLEROW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/table/xcell.hxx b/include/test/table/xcell.hxx
new file mode 100644
index 000000000..a0249aac9
--- /dev/null
+++ b/include/test/table/xcell.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_TEST_TABLE_XCELL_HXX
+#define INCLUDED_TEST_TABLE_XCELL_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCell
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetError();
+ void testGetType();
+ void testSetGetFormula();
+ void testSetGetValue();
+
+protected:
+ ~XCell() {}
+};
+}
+
+#endif // INCLUDED_TEST_TABLE_XCELL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/table/xcellcursor.hxx b/include/test/table/xcellcursor.hxx
new file mode 100644
index 000000000..0fb5c0622
--- /dev/null
+++ b/include/test/table/xcellcursor.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_TEST_TABLE_XCELLCURSOR_HXX
+#define INCLUDED_TEST_TABLE_XCELLCURSOR_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCellCursor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXSpreadsheet() = 0;
+
+ void testGoToNext();
+ void testGoToOffset();
+ void testGoToPrevious();
+ void testGoToStart();
+ void testGoToEnd();
+
+protected:
+ ~XCellCursor() {}
+};
+}
+
+#endif // INCLUDED_TEST_TABLE_XCELLCURSOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/table/xcellrange.hxx b/include/test/table/xcellrange.hxx
new file mode 100644
index 000000000..78f965e9d
--- /dev/null
+++ b/include/test/table/xcellrange.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TABLE_XCELLRANGE_HXX
+#define INCLUDED_TEST_TABLE_XCELLRANGE_HXX
+
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCellRange
+{
+public:
+ XCellRange()
+ : m_aRangeName("A1:A1")
+ {
+ }
+ XCellRange(const OUString& aRangeName)
+ : m_aRangeName(aRangeName)
+ {
+ }
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetCellByPosition();
+ void testGetCellRangeByName();
+ void testGetCellRangeByPosition();
+
+protected:
+ ~XCellRange() {}
+
+private:
+ OUString const m_aRangeName;
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_TABLE_XCELLRANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/table/xcolumnrowrange.hxx b/include/test/table/xcolumnrowrange.hxx
new file mode 100644
index 000000000..279a98847
--- /dev/null
+++ b/include/test/table/xcolumnrowrange.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_TEST_TABLE_XCOLUMNROWRANGE_HXX
+#define INCLUDED_TEST_TABLE_XCOLUMNROWRANGE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XColumnRowRange
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetColumns();
+ void testGetRows();
+
+protected:
+ ~XColumnRowRange() {}
+};
+}
+
+#endif // INCLUDED_TEST_TABLE_XCOLUMNROWRANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/table/xtablechart.hxx b/include/test/table/xtablechart.hxx
new file mode 100644
index 000000000..6c57bf3ac
--- /dev/null
+++ b/include/test/table/xtablechart.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TABLE_XTABLECHART_HXX
+#define INCLUDED_TEST_TABLE_XTABLECHART_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XTableChart
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetHasColumnHeaders();
+ void testGetSetHasRowHeaders();
+ void testGetSetRanges();
+
+protected:
+ ~XTableChart() {}
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_TABLE_XTABLECHART_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/table/xtablecharts.hxx b/include/test/table/xtablecharts.hxx
new file mode 100644
index 000000000..fa43e552e
--- /dev/null
+++ b/include/test/table/xtablecharts.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TABLE_XTABLECHARTS_HXX
+#define INCLUDED_TEST_TABLE_XTABLECHARTS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XTableCharts
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testAddNewRemoveByName();
+
+protected:
+ ~XTableCharts() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_TABLE_XTABLECHARTS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/table/xtablechartssupplier.hxx b/include/test/table/xtablechartssupplier.hxx
new file mode 100644
index 000000000..9e5d45dd0
--- /dev/null
+++ b/include/test/table/xtablechartssupplier.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_TEST_TABLE_XTABLECHARTSSUPPLIER_HXX
+#define INCLUDED_TEST_TABLE_XTABLECHARTSSUPPLIER_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XTableChartsSupplier
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetCharts();
+
+protected:
+ ~XTableChartsSupplier() {}
+};
+}
+
+#endif // INCLUDED_TEST_TABLE_XTABLECHARTSSUPPLIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/table/xtablecolumns.hxx b/include/test/table/xtablecolumns.hxx
new file mode 100644
index 000000000..957d344c5
--- /dev/null
+++ b/include/test/table/xtablecolumns.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TABLE_XTABLECOLUMNS_HXX
+#define INCLUDED_TEST_TABLE_XTABLECOLUMNS_HXX
+
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XTableColumns
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void setXSpreadsheet(const css::uno::Reference<css::sheet::XSpreadsheet>& r_xSheet)
+ {
+ m_xSheet = r_xSheet;
+ }
+
+ void testInsertByIndex();
+ void testInsertByIndexWithNegativeIndex();
+ // only use with ScTableColumnsObj
+ void testInsertByIndexWithNoColumn();
+ void testInsertByIndexWithOutOfBoundIndex();
+ void testRemoveByIndex();
+ void testRemoveByIndexWithNegativeIndex();
+ // only use with ScTableColumnsObj
+ void testRemoveByIndexWithNoColumn();
+ void testRemoveByIndexWithOutOfBoundIndex();
+
+protected:
+ ~XTableColumns() {}
+
+private:
+ css::uno::Reference<css::sheet::XSpreadsheet> m_xSheet;
+
+ static OUString getCellText(const css::uno::Reference<css::table::XCell>& r_xCell);
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_TABLE_XTABLECOLUMNS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/table/xtablerows.hxx b/include/test/table/xtablerows.hxx
new file mode 100644
index 000000000..ac874daac
--- /dev/null
+++ b/include/test/table/xtablerows.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TABLE_XTABLEROWS_HXX
+#define INCLUDED_TEST_TABLE_XTABLEROWS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XTableRows
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXCellRange() = 0;
+
+ virtual void testInsertByIndex();
+ virtual void testRemoveByIndex();
+
+protected:
+ ~XTableRows() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_TABLE_XTABLEROWS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/testdllapi.hxx b/include/test/testdllapi.hxx
new file mode 100644
index 000000000..c0a1eb029
--- /dev/null
+++ b/include/test/testdllapi.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TEST_TESTDLLAPI_HXX
+#define INCLUDED_TEST_TESTDLLAPI_HXX
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined OOO_DLLIMPLEMENTATION_TEST
+#define OOO_DLLPUBLIC_TEST SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_TEST SAL_DLLPUBLIC_IMPORT
+#endif
+
+#if defined OOO_DLLIMPLEMENTATION_TEST_SETUPVCL
+#define OOO_DLLPUBLIC_TEST_SETUPVCL SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_TEST_SETUPVCL SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/testinteractionhandler.hxx b/include/test/testinteractionhandler.hxx
new file mode 100644
index 000000000..1cfdec663
--- /dev/null
+++ b/include/test/testinteractionhandler.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TESTINTERACTIONHANDLER_HXX
+#define INCLUDED_TEST_TESTINTERACTIONHANDLER_HXX
+
+#include <sal/config.h>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/task/XInteractionHandler2.hpp>
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionPassword2.hpp>
+#include <com/sun/star/task/DocumentPasswordRequest2.hpp>
+#include <com/sun/star/task/DocumentMSPasswordRequest2.hpp>
+
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/supportsservice.hxx>
+
+class TestInteractionHandler : public cppu::WeakImplHelper<css::lang::XServiceInfo,
+ css::lang::XInitialization,
+ css::task::XInteractionHandler2>
+{
+ OUString msPassword;
+ bool mbPasswordRequested;
+
+ TestInteractionHandler(const TestInteractionHandler&) = delete;
+ TestInteractionHandler& operator=(const TestInteractionHandler&) = delete;
+
+public:
+ TestInteractionHandler(const OUString& sPassword)
+ : msPassword(sPassword)
+ , mbPasswordRequested(false)
+ {}
+
+ bool wasPasswordRequested()
+ {
+ return mbPasswordRequested;
+ }
+
+ virtual OUString SAL_CALL getImplementationName() override
+ {
+ return "com.sun.star.comp.uui.TestInteractionHandler";
+ }
+
+ virtual sal_Bool SAL_CALL supportsService(OUString const & rServiceName) override
+ {
+ return cppu::supportsService(this, rServiceName);
+ }
+
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
+ {
+ return { "com.sun.star.task.InteractionHandler",
+ // added to indicate support for configuration.backend.MergeRecoveryRequest
+ "com.sun.star.configuration.backend.InteractionHandler",
+ // for backwards compatibility
+ "com.sun.star.uui.InteractionHandler" };
+ }
+
+ virtual void SAL_CALL initialize(css::uno::Sequence<css::uno::Any> const & /*rArguments*/) override
+ {}
+
+ virtual void SAL_CALL handle(css::uno::Reference<css::task::XInteractionRequest> const & rRequest) override
+ {
+ handleInteractionRequest(rRequest);
+ }
+
+ virtual sal_Bool SAL_CALL handleInteractionRequest(const css::uno::Reference<css::task::XInteractionRequest>& rRequest) override
+ {
+ mbPasswordRequested = false;
+
+ css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> const &rContinuations = rRequest->getContinuations();
+ css::uno::Any const aRequest(rRequest->getRequest());
+
+ if (handlePasswordRequest(rContinuations, aRequest))
+ return true;
+
+ for (auto const & cont : rContinuations)
+ {
+ css::uno::Reference<css::task::XInteractionApprove> xApprove(cont, css::uno::UNO_QUERY);
+ if (xApprove.is())
+ xApprove->select();
+ }
+
+ return true;
+ }
+
+ bool handlePasswordRequest(const css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> &rContinuations,
+ const css::uno::Any& rRequest)
+ {
+ bool bPasswordRequestFound = false;
+ bool bIsRequestPasswordToModify = false;
+ css::task::PasswordRequestMode mode{};
+
+ css::task::DocumentPasswordRequest2 passwordRequest2;
+ if (rRequest >>= passwordRequest2)
+ {
+ bIsRequestPasswordToModify = passwordRequest2.IsRequestPasswordToModify;
+ mode = passwordRequest2.Mode;
+ bPasswordRequestFound = true;
+ }
+ css::task::DocumentMSPasswordRequest2 passwordMSRequest2;
+ if (rRequest >>= passwordMSRequest2)
+ {
+ bIsRequestPasswordToModify = passwordMSRequest2.IsRequestPasswordToModify;
+ mode = passwordMSRequest2.Mode;
+ bPasswordRequestFound = true;
+ }
+
+ if (!bPasswordRequestFound)
+ {
+ mbPasswordRequested = false;
+ return false;
+ }
+ mbPasswordRequested = true;
+
+ for (auto const & cont : rContinuations)
+ {
+ if (mode == css::task::PasswordRequestMode_PASSWORD_REENTER)
+ { // cancel re-enter of wrong password, to avoid infinite loop
+ css::uno::Reference<css::task::XInteractionAbort> const xAbort(cont, css::uno::UNO_QUERY);
+ if (xAbort.is())
+ xAbort->select();
+ }
+ else if (bIsRequestPasswordToModify)
+ {
+ css::uno::Reference<css::task::XInteractionPassword2> const xIPW2(cont, css::uno::UNO_QUERY);
+ xIPW2->setPasswordToModify(msPassword);
+ xIPW2->select();
+ }
+ else
+ {
+ css::uno::Reference<css::task::XInteractionPassword> const xIPW(cont, css::uno::UNO_QUERY);
+ if (xIPW.is())
+ {
+ xIPW->setPassword(msPassword);
+ xIPW->select();
+ }
+ }
+ }
+ return true;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/text/baseindex.hxx b/include/test/text/baseindex.hxx
new file mode 100644
index 000000000..7a523ed55
--- /dev/null
+++ b/include/test/text/baseindex.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TEXT_BASEINDEXTEST_HXX
+#define INCLUDED_TEST_TEXT_BASEINDEXTEST_HXX
+
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST BaseIndex
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual ~BaseIndex();
+ void testBaseIndexProperties();
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/text/textcontent.hxx b/include/test/text/textcontent.hxx
new file mode 100644
index 000000000..e6333d60e
--- /dev/null
+++ b/include/test/text/textcontent.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST TextContent
+{
+public:
+ TextContent(const css::text::TextContentAnchorType aExpectedTCAT,
+ const css::text::TextContentAnchorType aNewTCAT,
+ const css::text::WrapTextMode aExpectedWTM, const css::text::WrapTextMode aNewWTM)
+ : m_aExpectedTCAT(aExpectedTCAT)
+ , m_aNewTCAT(aNewTCAT)
+ , m_aExpectedWTM(aExpectedWTM)
+ , m_aNewWTM(aNewWTM)
+ {
+ }
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testTextContentProperties();
+
+protected:
+ ~TextContent() {}
+
+private:
+ css::text::TextContentAnchorType const m_aExpectedTCAT;
+ css::text::TextContentAnchorType const m_aNewTCAT;
+ css::text::WrapTextMode const m_aExpectedWTM;
+ css::text::WrapTextMode const m_aNewWTM;
+};
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/text/textdocumentindex.hxx b/include/test/text/textdocumentindex.hxx
new file mode 100644
index 000000000..92e827cfe
--- /dev/null
+++ b/include/test/text/textdocumentindex.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TEXT_DOCUMENTINDEXTEST_HXX
+#define INCLUDED_TEST_TEXT_DOCUMENTINDEXTEST_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST TextDocumentIndex
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual ~TextDocumentIndex();
+ void testDocumentIndexProperties();
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/text/textdocumentsettings.hxx b/include/test/text/textdocumentsettings.hxx
new file mode 100644
index 000000000..e7a28a2f1
--- /dev/null
+++ b/include/test/text/textdocumentsettings.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TEXT_TEXTDOCUMENTSETTINGS_HXX
+#define INCLUDED_TEST_TEXT_TEXTDOCUMENTSETTINGS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST TextDocumentSettings
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual ~TextDocumentSettings();
+ void testDocumentSettingsProperties();
+};
+} // end namespace apitest
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/text/textprintersettings.hxx b/include/test/text/textprintersettings.hxx
new file mode 100644
index 000000000..2ceac34b9
--- /dev/null
+++ b/include/test/text/textprintersettings.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TEXT_TEXTPRINTERSETTINGS_HXX
+#define INCLUDED_TEST_TEXT_TEXTPRINTERSETTINGS_HXX
+
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST TextPrinterSettings
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual ~TextPrinterSettings();
+ void testPrinterSettingsProperties();
+};
+} // end namespace apitest
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/text/textsettings.hxx b/include/test/text/textsettings.hxx
new file mode 100644
index 000000000..9566f21dc
--- /dev/null
+++ b/include/test/text/textsettings.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TEXT_TEXTSETTINGS_HXX
+#define INCLUDED_TEST_TEXT_TEXTSETTINGS_HXX
+
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST TextSettings
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual ~TextSettings();
+ void testSettingsProperties();
+};
+} // end namespace apitest
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/text/xdocumentindex.hxx b/include/test/text/xdocumentindex.hxx
new file mode 100644
index 000000000..4efdaeeec
--- /dev/null
+++ b/include/test/text/xdocumentindex.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TEST_XDOCUMENTINDEX_HXX
+#define INCLUDED_TEST_TEST_XDOCUMENTINDEX_HXX
+
+#include <com/sun/star/text/XTextDocument.hpp>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+/**
+ * Testing <code>com.sun.star.text.XDocumentIndex</code>
+ *
+ * @see com.sun.star.text.XDocumentIndex
+ */
+class OOO_DLLPUBLIC_TEST XDocumentIndex
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::text::XTextDocument> getTextDocument() = 0;
+ virtual ~XDocumentIndex();
+ void testUpdate();
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/text/xsimpletext.hxx b/include/test/text/xsimpletext.hxx
new file mode 100644
index 000000000..ec371ea21
--- /dev/null
+++ b/include/test/text/xsimpletext.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TEXT_XSIMPLETEXT_HXX
+#define INCLUDED_TEST_TEXT_XSIMPLETEXT_HXX
+
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSimpleText
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testCreateTextCursor();
+ void testCreateTextCursorByRange();
+ void testInsertString();
+ void testInsertControlCharacter();
+
+protected:
+ ~XSimpleText() {}
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/text/xtext.hxx b/include/test/text/xtext.hxx
new file mode 100644
index 000000000..537cfa21d
--- /dev/null
+++ b/include/test/text/xtext.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TEXT_XTEXT_HXX
+#define INCLUDED_TEST_TEXT_XTEXT_HXX
+
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/text/XTextContent.hpp>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XText
+{
+public:
+ virtual ~XText();
+
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::text::XTextContent> getTextContent() = 0;
+
+ void testInsertRemoveTextContent();
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/text/xtextcontent.hxx b/include/test/text/xtextcontent.hxx
new file mode 100644
index 000000000..f23852062
--- /dev/null
+++ b/include/test/text/xtextcontent.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TEXT_XTEXTCONTENT_HXX
+#define INCLUDED_TEST_TEXT_XTEXTCONTENT_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XTextContent
+{
+public:
+ virtual ~XTextContent() {}
+
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+ virtual css::uno::Reference< css::text::XTextRange > getTextRange() = 0;
+ virtual css::uno::Reference< css::text::XTextContent > getTextContent() = 0;
+ virtual bool isAttachSupported() = 0;
+
+ void testGetAnchor();
+ void testAttach();
+};
+
+}
+
+#endif // INCLUDED_TEST_TEXT_XTEXTCONTENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/text/xtextfield.hxx b/include/test/text/xtextfield.hxx
new file mode 100644
index 000000000..6d717b1ea
--- /dev/null
+++ b/include/test/text/xtextfield.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TEXT_XTEXTFIELD_HXX
+#define INCLUDED_TEST_TEXT_XTEXTFIELD_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XTextField
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetPresentation();
+ void testGetPresentationEmptyString();
+
+protected:
+ ~XTextField() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_TEXT_XTEXTFIELD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/text/xtextrange.hxx b/include/test/text/xtextrange.hxx
new file mode 100644
index 000000000..a986e7fae
--- /dev/null
+++ b/include/test/text/xtextrange.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_TEXT_XTEXTRANGE_HXX
+#define INCLUDED_TEST_TEXT_XTEXTRANGE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XTextRange
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetEnd();
+ void testGetSetString();
+ void testGetStart();
+ void testGetText();
+
+protected:
+ ~XTextRange() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_TEXT_XTEXTRANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/unoapi_property_testers.hxx b/include/test/unoapi_property_testers.hxx
new file mode 100644
index 000000000..4d83e8179
--- /dev/null
+++ b/include/test/unoapi_property_testers.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_INC_UNOAPIPROPERTYTESTERS_HXX
+#define INCLUDED_TEST_INC_UNOAPIPROPERTYTESTERS_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/Color.hpp>
+
+#include <sal/config.h>
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+/** @brief Tester for property type 'boolean' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ */
+void OOO_DLLPUBLIC_TEST testBooleanProperty(
+ css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, const OUString& name);
+
+/** @brief Tester for optional property type 'boolean' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * Pass the test also if the property doesn't exists (throws a com::sun::star::beans::UnknownPropertyException)
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ */
+void OOO_DLLPUBLIC_TEST testBooleanOptionalProperty(
+ css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, const OUString& name);
+
+/** @brief Tester for read-only property type 'boolean' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ */
+void OOO_DLLPUBLIC_TEST testBooleanReadonlyProperty(
+ css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, const OUString& name);
+
+/** @brief Tester for property type 'double' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param nValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST
+testDoubleProperty(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
+ const OUString& name, const double& dValue = 42.0);
+
+/** @brief Tester for read-only property type 'double' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param nValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST
+testDoubleReadonlyProperty(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
+ const OUString& name, const double& dValue = 42.0);
+
+/** @brief Tester for property type 'long' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param nValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST
+testLongProperty(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
+ const OUString& name, const sal_Int32& nValue = 42);
+
+/** @brief Tester for optional property type 'long' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param nValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST
+testLongOptionalProperty(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
+ const OUString& name, const sal_Int32& nValue = 42);
+
+/** @brief Tester for read-only property type 'long' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param nValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST
+testLongReadonlyProperty(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
+ const OUString& name, const sal_Int32& nValue = 42);
+
+/** @brief Tester for property type 'short' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param nValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST
+testShortProperty(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
+ const OUString& name, const sal_Int16& nValue = 42);
+
+/** @brief Tester for optional property type 'short' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param nValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST
+testShortOptionalProperty(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
+ const OUString& name, const sal_Int16& nValue = 42);
+
+/** @brief Tester for read-only property type 'short' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param nValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST
+testShortReadonlyProperty(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
+ const OUString& name, const sal_Int16& nValue = 42);
+
+/** @brief Tester for property type 'string' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param rValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST
+testStringProperty(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
+ const OUString& name, const OUString& rValue);
+
+/** @brief Tester for optional property type 'string' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * Pass the test also if the property doesn't exists (throws a com::sun::star::beans::UnknownPropertyException)
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param rValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST
+testStringOptionalProperty(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
+ const OUString& name, const OUString& rValue = OUString("StringValue"));
+
+/** @brief Tester for read-only property type 'string' of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param rValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST
+testStringReadonlyProperty(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
+ const OUString& name, const OUString& rValue);
+
+/** @brief Tester for property type com::sun::star::util::Color of a @see com::sun::star::beans::XPropertySet.
+ *
+ * @param xPropertySet The property set, which contains the property to test against.
+ * @param name Name of property to test.
+ * @param rValue Value to use when setting a new value.
+ */
+void OOO_DLLPUBLIC_TEST testColorProperty(
+ css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, const OUString& name,
+ const css::util::Color& rValue = css::util::Color(0x12345678));
+
+} // namespace apitest
+#endif // INCLUDED_TEST_INC_UNOAPIPROPERTYTESTERS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/unoapi_test.hxx b/include/test/unoapi_test.hxx
new file mode 100644
index 000000000..82f04cf46
--- /dev/null
+++ b/include/test/unoapi_test.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_UNOAPI_TEST_HXX
+#define INCLUDED_TEST_UNOAPI_TEST_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <osl/file.hxx>
+
+// basic uno api test class
+
+class OOO_DLLPUBLIC_TEST UnoApiTest : public test::BootstrapFixture, public unotest::MacrosTest
+{
+public:
+ UnoApiTest(const OUString& path);
+
+ void createFileURL(std::u16string_view aFileBase, OUString& rFilePath);
+
+ virtual void setUp() override;
+
+protected:
+ void closeDocument(css::uno::Reference<css::lang::XComponent> const& xDocument);
+
+private:
+ OUString m_aBaseString;
+};
+
+#endif // INCLUDED_TEST_UNOAPI_TEST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/util/searchdescriptor.hxx b/include/test/util/searchdescriptor.hxx
new file mode 100644
index 000000000..b2f5d5bd6
--- /dev/null
+++ b/include/test/util/searchdescriptor.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST SearchDescriptor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testSearchDescriptorProperties();
+
+protected:
+ ~SearchDescriptor() {}
+};
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/util/xindent.hxx b/include/test/util/xindent.hxx
new file mode 100644
index 000000000..bb3c0e5d3
--- /dev/null
+++ b/include/test/util/xindent.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_TEST_UTIL_XINDENT_HXX
+#define INCLUDED_TEST_UTIL_XINDENT_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XIndent
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testIncrementIndent();
+ void testDecrementIndent();
+
+protected:
+ ~XIndent() {}
+};
+}
+
+#endif // INCLUDED_TEST_UTIL_XINDENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/util/xmergeable.hxx b/include/test/util/xmergeable.hxx
new file mode 100644
index 000000000..9ed2d479b
--- /dev/null
+++ b/include/test/util/xmergeable.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_TEST_UTIL_XMERGEABLE_HXX
+#define INCLUDED_TEST_UTIL_XMERGEABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XMergeable
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetIsMergedMerge();
+
+protected:
+ ~XMergeable() {}
+};
+}
+
+#endif // INCLUDED_TEST_UTIL_XMERGEABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/util/xrefreshable.hxx b/include/test/util/xrefreshable.hxx
new file mode 100644
index 000000000..dd8230325
--- /dev/null
+++ b/include/test/util/xrefreshable.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_UTIL_XREFRESHABLE_HXX
+#define INCLUDED_TEST_UTIL_XREFRESHABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XRefreshable
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testRefreshListener();
+
+protected:
+ ~XRefreshable() {}
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_UTIL_XREFRESHABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/util/xreplaceable.hxx b/include/test/util/xreplaceable.hxx
new file mode 100644
index 000000000..9f33feeb5
--- /dev/null
+++ b/include/test/util/xreplaceable.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_UTIL_XREPLACEABLE_HXX
+#define INCLUDED_TEST_UTIL_XREPLACEABLE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XReplaceable
+{
+public:
+ XReplaceable( const OUString& rSearchString, const OUString& rReplaceString):
+ maSearchString(rSearchString), maReplaceString(rReplaceString) {}
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+
+ void testCreateReplaceDescriptor();
+ void testReplaceAll();
+
+protected:
+ ~XReplaceable() {}
+
+private:
+ OUString maSearchString;
+ OUString maReplaceString;
+};
+
+}
+
+#endif // INCLUDED_TEST_UTIL_XREPLACEABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/util/xreplacedescriptor.hxx b/include/test/util/xreplacedescriptor.hxx
new file mode 100644
index 000000000..878ee7126
--- /dev/null
+++ b/include/test/util/xreplacedescriptor.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XReplaceDescriptor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetReplaceString();
+
+protected:
+ ~XReplaceDescriptor() {}
+};
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/util/xsearchable.hxx b/include/test/util/xsearchable.hxx
new file mode 100644
index 000000000..9f45f051e
--- /dev/null
+++ b/include/test/util/xsearchable.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_UTIL_XSEARCHABLE_HXX
+#define INCLUDED_TEST_UTIL_XSEARCHABLE_HXX
+
+#include <test/testdllapi.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XSearchable
+{
+public:
+ XSearchable(const OUString& rString, sal_Int32 nCount) : maSearchString(rString), mnCount(nCount) {}
+ XSearchable() : maSearchString("SearchString"), mnCount(1) {}
+ virtual ~XSearchable();
+
+ void testFindFirst();
+ void testFindNext();
+ void testFindAll();
+
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+
+private:
+ OUString maSearchString;
+ sal_Int32 mnCount;
+};
+
+}
+
+#endif // INCLUDED_TEST_UTIL_XSEARCHABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/util/xsearchdescriptor.hxx b/include/test/util/xsearchdescriptor.hxx
new file mode 100644
index 000000000..1bad97375
--- /dev/null
+++ b/include/test/util/xsearchdescriptor.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XSearchDescriptor
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetSetSearchString();
+
+protected:
+ ~XSearchDescriptor() {}
+};
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/view/xcontrolaccess.hxx b/include/test/view/xcontrolaccess.hxx
new file mode 100644
index 000000000..b25cb169c
--- /dev/null
+++ b/include/test/view/xcontrolaccess.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_VIEW_XCONTROLACCESS_HXX
+#define INCLUDED_TEST_VIEW_XCONTROLACCESS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XControlAccess
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXComponent() = 0;
+
+ void testGetControl();
+
+protected:
+ ~XControlAccess() {}
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_VIEW_XCONTROLACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/view/xformlayeraccess.hxx b/include/test/view/xformlayeraccess.hxx
new file mode 100644
index 000000000..ddd2542ab
--- /dev/null
+++ b/include/test/view/xformlayeraccess.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_VIEW_XFORMLAYERACCESS_HXX
+#define INCLUDED_TEST_VIEW_XFORMLAYERACCESS_HXX
+
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XFormLayerAccess
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ void setForm(const css::uno::Reference<css::form::XForm>& r_xForm) { m_xForm = r_xForm; }
+
+ void testGetFormController();
+ void testIsFormDesignMode();
+ void testSetFormDesignMode();
+
+protected:
+ ~XFormLayerAccess() {}
+
+private:
+ css::uno::Reference<css::form::XForm> m_xForm;
+};
+
+} // namespace apitest
+
+#endif // INCLUDED_TEST_VIEW_XFORMLAYERACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/xmldiff.hxx b/include/test/xmldiff.hxx
new file mode 100644
index 000000000..5023bec35
--- /dev/null
+++ b/include/test/xmldiff.hxx
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_XMLDIFF_HXX
+#define INCLUDED_TEST_XMLDIFF_HXX
+
+#include <test/testdllapi.hxx>
+
+bool OOO_DLLPUBLIC_TEST
+doXMLDiff(const char* pFileName, const char* pContent, int size,
+ const char* pToleranceFileName);
+
+#endif // INCLUDED_TEST_XMLDIFF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/xmldocptr.hxx b/include/test/xmldocptr.hxx
new file mode 100644
index 000000000..bb41ddb9e
--- /dev/null
+++ b/include/test/xmldocptr.hxx
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <memory>
+#include <libxml/tree.h>
+
+struct xmlDocDeleter
+{
+ void operator()(xmlDoc* p) { xmlFreeDoc(p); }
+};
+using xmlDocUniquePtr = std::unique_ptr<xmlDoc, xmlDocDeleter>;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx
new file mode 100644
index 000000000..e37638fa6
--- /dev/null
+++ b/include/test/xmltesttools.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_XMLTESTTOOLS_HXX
+#define INCLUDED_TEST_XMLTESTTOOLS_HXX
+
+#include <sal/config.h>
+#include <test/testdllapi.hxx>
+
+#include <libxml/xmlwriter.h>
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+#include <libxml/parserInternals.h>
+
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/tempfile.hxx>
+#include <vcl/mtfxmldump.hxx>
+#include <test/xmldocptr.hxx>
+
+#include <cppunit/TestAssert.h>
+
+#include <string_view>
+#include <vector>
+
+class OOO_DLLPUBLIC_TEST XmlTestTools
+{
+public:
+ /// Return xmlDocPtr representation of the XML stream read from pStream.
+ static xmlDocUniquePtr parseXmlStream(SvStream* pStream);
+
+ static xmlDocUniquePtr dumpAndParse(MetafileXmlDump& rDumper, const GDIMetaFile& rGDIMetaFile);
+
+protected:
+ XmlTestTools();
+ virtual ~XmlTestTools();
+
+ static xmlDocUniquePtr parseXml(utl::TempFile const & aTempFile);
+
+ virtual void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx);
+
+ // Caller must call xmlXPathFreeObject:
+ xmlXPathObjectPtr getXPathNode(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath);
+ /**
+ * Same as the assertXPath(), but don't assert: return the string instead.
+ */
+ OUString getXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute);
+ /**
+ * Same as the assertXPathContent(), but don't assert: return the string instead.
+ */
+ OUString getXPathContent(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath);
+ /**
+ * Get the position of the child named rName of the parent node specified by rXPath.
+ * Useful for checking relative order of elements.
+ */
+ int getXPathPosition(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, std::string_view rChildName);
+ /**
+ * Get the number of the nodes returned by the rXPath.
+ */
+ int countXPathNodes(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath);
+ /**
+ * Assert that rXPath exists, and returns exactly one node.
+ */
+ void assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath);
+ /**
+ * Assert that rXPath exists, returns exactly one node, and the rXPath's attribute's value
+ * equals to the rExpected value.
+ */
+ void assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute,
+ const OUString& rExpectedValue);
+ void assertXPathAttrs(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath,
+ const std::vector<std::pair<OString, OUString>>& aPairVector);
+ /**
+ * Assert that rXPath exists, and returns exactly nNumberOfNodes nodes.
+ * Useful for checking that we do _not_ export some node (nNumberOfNodes == 0).
+ */
+ void assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfNodes);
+ /**
+ * Assert that rXPath exists, and its content equals rContent.
+ */
+ void assertXPathContent(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OUString& rContent);
+ /**
+ * Assert that rXPath exists and it has an rNSPrefix=rNSHref namespace definition.
+ */
+ void assertXPathNSDef(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, std::u16string_view rNSPrefix,
+ std::u16string_view rNSHref);
+ /**
+ * Assert that rXPath exists, and has exactly nNumberOfChildNodes child nodes.
+ * Useful for checking that we do have a no child nodes to a specific node (nNumberOfChildNodes == 0).
+ */
+ void assertXPathChildren(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfChildNodes);
+ /**
+ * Assert that rXPath exists, has exactly 1 result set nodes and does *not* have an attribute named rAttribute.
+ */
+ void assertXPathNoAttribute(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute);
+
+ static void registerODFNamespaces(xmlXPathContextPtr& pXmlXpathCtx);
+ static void registerOOXMLNamespaces(xmlXPathContextPtr& pXmlXpathCtx);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx
new file mode 100644
index 000000000..b1735f3f2
--- /dev/null
+++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX
+#define INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/accimplaccess.hxx>
+#include <comphelper/accessiblecomponenthelper.hxx>
+
+
+#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
+
+namespace com::sun::star::accessibility { class XAccessible; }
+
+namespace vcl { class Window; }
+class VCLXWindow;
+class VclWindowEvent;
+
+namespace utl {
+class AccessibleRelationSetHelper;
+class AccessibleStateSetHelper;
+}
+
+
+
+typedef ::cppu::ImplHelper1<
+ css::lang::XServiceInfo > VCLXAccessibleComponent_BASE;
+
+class TOOLKIT_DLLPUBLIC VCLXAccessibleComponent
+ :public comphelper::OAccessibleExtendedComponentHelper
+ ,public ::comphelper::OAccessibleImplementationAccess
+ ,public VCLXAccessibleComponent_BASE
+{
+private:
+ rtl::Reference<VCLXWindow> m_xVCLXWindow;
+ VclPtr<vcl::Window> m_xEventSource;
+
+ DECL_DLLPRIVATE_LINK( WindowEventListener, VclWindowEvent&, void );
+ DECL_DLLPRIVATE_LINK( WindowChildEventListener, VclWindowEvent&, void );
+ void DisconnectEvents();
+
+protected:
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent );
+
+public:
+ VCLXAccessibleComponent( VCLXWindow* pVCLXWindow );
+ virtual ~VCLXAccessibleComponent() override;
+
+ VCLXWindow* GetVCLXWindow() const;
+ vcl::Window* GetWindow() const;
+ template< class derived_type > derived_type* GetAs() const {
+ return static_cast< derived_type * >( GetWindow() ); }
+ template< class derived_type > derived_type* GetAsDynamic() const {
+ return dynamic_cast< derived_type * >( GetWindow() ); }
+
+ virtual void SAL_CALL disposing() override;
+
+ // css::uno::XInterface
+ DECLARE_XINTERFACE()
+ // css::lang::XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // css::accessibility::XAccessibleContext
+ sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
+ css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
+ css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
+ sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override;
+ sal_Int16 SAL_CALL getAccessibleRole( ) override;
+ OUString SAL_CALL getAccessibleDescription( ) override;
+ OUString SAL_CALL getAccessibleName( ) override;
+ OUString SAL_CALL getAccessibleId( ) override;
+ css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
+ css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
+ css::lang::Locale SAL_CALL getLocale( ) override;
+
+ // css::accessibility::XAccessibleComponent
+ css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
+ css::awt::Point SAL_CALL getLocationOnScreen( ) override;
+ void SAL_CALL grabFocus( ) override;
+ virtual sal_Int32 SAL_CALL getForeground( ) override;
+ virtual sal_Int32 SAL_CALL getBackground( ) override;
+
+ // css::accessibility::XAccessibleExtendedComponent
+ virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override;
+ virtual OUString SAL_CALL getTitledBorderText( ) override;
+ virtual OUString SAL_CALL getToolTipText( ) override;
+
+protected:
+ // base class overridables
+ css::awt::Rectangle implGetBounds( ) override;
+
+private:
+ /** we may be reparented (if external components use OAccessibleImplementationAccess base class),
+ so this method here returns the parent in the VCL world, in opposite to the parent
+ an external component gave us
+ @precond
+ the caller must ensure thread safety, i.e. our mutex must be locked
+ */
+ css::uno::Reference< css::accessibility::XAccessible >
+ getVclParent() const;
+};
+
+/* ----------------------------------------------------------
+ Accessibility only for the Window hierarchy!
+ Maybe derived classes must overwrite these Accessibility interfaces:
+
+ // XAccessibleContext:
+ sal_Int16 getAccessibleRole() => VCL Window::GetAccessibleRole()
+ OUString getAccessibleDescription() => VCL Window::GetAccessibleDescription
+ OUString getAccessibleName() => VCL Window::GetAccessibleText() => Most windows return Window::GetText()
+ OUString getAccessibleId() => VCL Window::get_id()
+ Reference< XAccessibleRelationSet > getAccessibleRelationSet()
+ Reference< XAccessibleStateSet > getAccessibleStateSet() => override FillAccessibleStateSet( ... )
+
+---------------------------------------------------------- */
+
+
+#endif // INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/awt/vclxdevice.hxx b/include/toolkit/awt/vclxdevice.hxx
new file mode 100644
index 000000000..c24b79be1
--- /dev/null
+++ b/include/toolkit/awt/vclxdevice.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_AWT_VCLXDEVICE_HXX
+#define INCLUDED_TOOLKIT_AWT_VCLXDEVICE_HXX
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/vclptr.hxx>
+
+#include <com/sun/star/awt/XUnitConversion.hpp>
+
+/// A UNO wrapper for the VCL OutputDevice
+class TOOLKIT_DLLPUBLIC VCLXDevice :
+ public cppu::WeakImplHelper<
+ css::awt::XDevice,
+ css::lang::XUnoTunnel,
+ css::awt::XUnitConversion>
+{
+ friend class VCLXGraphics;
+ friend class VCLXVirtualDevice;
+
+private:
+ VclPtr<OutputDevice> mpOutputDevice;
+
+public:
+ VCLXDevice();
+ virtual ~VCLXDevice() override;
+
+ void SetOutputDevice( const VclPtr<OutputDevice> &pOutDev ) { mpOutputDevice = pOutDev; }
+ const VclPtr<OutputDevice>& GetOutputDevice() const { return mpOutputDevice; }
+
+ // css::lang::XUnoTunnel
+ UNO3_GETIMPLEMENTATION_DECL(VCLXDevice)
+
+ // css::awt::XDevice,
+ css::uno::Reference< css::awt::XGraphics > SAL_CALL createGraphics( ) override;
+ css::uno::Reference< css::awt::XDevice > SAL_CALL createDevice( sal_Int32 nWidth, sal_Int32 nHeight ) override;
+ css::awt::DeviceInfo SAL_CALL getInfo() override;
+ css::uno::Sequence< css::awt::FontDescriptor > SAL_CALL getFontDescriptors( ) override;
+ css::uno::Reference< css::awt::XFont > SAL_CALL getFont( const css::awt::FontDescriptor& aDescriptor ) override;
+ css::uno::Reference< css::awt::XBitmap > SAL_CALL createBitmap( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight ) override;
+ css::uno::Reference< css::awt::XDisplayBitmap > SAL_CALL createDisplayBitmap( const css::uno::Reference< css::awt::XBitmap >& Bitmap ) override;
+
+ // css::awt::XUnitConversion
+ css::awt::Point SAL_CALL convertPointToLogic( const css::awt::Point& aPoint, ::sal_Int16 TargetUnit ) override;
+ css::awt::Point SAL_CALL convertPointToPixel( const css::awt::Point& aPoint, ::sal_Int16 SourceUnit ) override;
+ css::awt::Size SAL_CALL convertSizeToLogic( const css::awt::Size& aSize, ::sal_Int16 TargetUnit ) override;
+ css::awt::Size SAL_CALL convertSizeToPixel( const css::awt::Size& aSize, ::sal_Int16 SourceUnit ) override;
+
+
+};
+
+
+
+
+class VCLXVirtualDevice final : public VCLXDevice
+{
+public:
+ virtual ~VCLXVirtualDevice() override;
+
+ void SetVirtualDevice( VirtualDevice* pVDev ) { SetOutputDevice( pVDev ); }
+};
+
+
+#endif // INCLUDED_TOOLKIT_AWT_VCLXDEVICE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/awt/vclxfont.hxx b/include/toolkit/awt/vclxfont.hxx
new file mode 100644
index 000000000..efad4b590
--- /dev/null
+++ b/include/toolkit/awt/vclxfont.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX
+#define INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX
+
+#include <memory>
+#include <toolkit/dllapi.h>
+#include <com/sun/star/awt/XFont2.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <mutex>
+#include <vcl/font.hxx>
+
+namespace com::sun::star::awt { class XDevice; }
+
+class FontMetric;
+
+
+
+
+class TOOLKIT_DLLPUBLIC VCLXFont final :
+ public cppu::WeakImplHelper<
+ css::awt::XFont2,
+ css::lang::XUnoTunnel>
+{
+ std::mutex maMutex;
+ css::uno::Reference< css::awt::XDevice> mxDevice;
+ vcl::Font maFont;
+ std::unique_ptr<FontMetric>
+ mpFontMetric;
+
+ bool ImplAssertValidFontMetric();
+
+public:
+ VCLXFont();
+ virtual ~VCLXFont() override;
+
+ void Init( css::awt::XDevice& rxDev, const vcl::Font& rFont );
+ const vcl::Font& GetFont() const { return maFont; }
+
+ // css::lang::XUnoTunnel
+ UNO3_GETIMPLEMENTATION_DECL(VCLXFont)
+
+ // css::lang::XFont
+ css::awt::FontDescriptor SAL_CALL getFontDescriptor( ) override;
+ css::awt::SimpleFontMetric SAL_CALL getFontMetric( ) override;
+ sal_Int16 SAL_CALL getCharWidth( sal_Unicode c ) override;
+ css::uno::Sequence< sal_Int16 > SAL_CALL getCharWidths( sal_Unicode nFirst, sal_Unicode nLast ) override;
+ sal_Int32 SAL_CALL getStringWidth( const OUString& str ) override;
+ sal_Int32 SAL_CALL getStringWidthArray( const OUString& str, css::uno::Sequence< sal_Int32 >& rDXArray ) override;
+ void SAL_CALL getKernPairs( css::uno::Sequence< sal_Unicode >& rnChars1, css::uno::Sequence< sal_Unicode >& rnChars2, css::uno::Sequence< sal_Int16 >& rnKerns ) override;
+
+ // css::lang::XFont2
+ sal_Bool SAL_CALL hasGlyphs( const OUString& aText ) override;
+};
+
+
+#endif // INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/awt/vclxmenu.hxx b/include/toolkit/awt/vclxmenu.hxx
new file mode 100644
index 000000000..096c370bc
--- /dev/null
+++ b/include/toolkit/awt/vclxmenu.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_AWT_VCLXMENU_HXX
+#define INCLUDED_TOOLKIT_AWT_VCLXMENU_HXX
+
+#include <config_options.h>
+#include <toolkit/dllapi.h>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+#include <com/sun/star/awt/XMenuBar.hpp>
+#include <com/sun/star/awt/XPopupMenu.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/weak.hxx>
+#include <mutex>
+
+#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
+
+#include <vector>
+
+class Menu;
+class MenuBar;
+class PopupMenu;
+class VclMenuEvent;
+
+typedef ::std::vector<
+ css::uno::Reference< css::awt::XPopupMenu >
+> PopupMenuRefList;
+
+typedef void (*MenuUserDataReleaseFunction)(void*);
+
+class TOOLKIT_DLLPUBLIC VCLXMenu : public css::awt::XMenuBar,
+ public css::awt::XPopupMenu,
+ public css::lang::XServiceInfo,
+ public css::lang::XTypeProvider,
+ public css::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ std::mutex maMutex;
+ VclPtr<Menu> mpMenu;
+ MenuListenerMultiplexer maMenuListeners;
+ PopupMenuRefList maPopupMenuRefs;
+ sal_Int16 mnDefaultItem;
+
+protected:
+
+ DECL_DLLPRIVATE_LINK( MenuEventListener, VclMenuEvent&, void );
+
+ void ImplCreateMenu( bool bPopup );
+ void ImplAddListener();
+
+public:
+ VCLXMenu();
+ VCLXMenu( Menu* pMenu );
+ virtual ~VCLXMenu() override;
+
+
+ Menu* GetMenu() const { return mpMenu; }
+ bool IsPopupMenu() const;
+ void setUserValue(sal_uInt16 nItemId, void* nUserValue, MenuUserDataReleaseFunction aFunc);
+ void* getUserValue(sal_uInt16 nItemId);
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakObject::release(); }
+
+ // css::lang::XUnoTunnel
+ UNO3_GETIMPLEMENTATION_DECL(VCLXMenu)
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XMenu
+ virtual void SAL_CALL addMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) override;
+ virtual void SAL_CALL removeMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) override;
+ virtual void SAL_CALL insertItem( sal_Int16 nItemId, const OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) override;
+ virtual void SAL_CALL removeItem( sal_Int16 nPos, sal_Int16 nCount ) override;
+ virtual void SAL_CALL clear( ) override;
+ virtual sal_Int16 SAL_CALL getItemCount( ) override;
+ virtual sal_Int16 SAL_CALL getItemId( sal_Int16 nPos ) override;
+ virtual sal_Int16 SAL_CALL getItemPos( sal_Int16 nId ) override;
+ virtual css::awt::MenuItemType SAL_CALL getItemType( ::sal_Int16 nItemPos ) override;
+ virtual void SAL_CALL enableItem( sal_Int16 nItemId, sal_Bool bEnable ) override;
+ virtual sal_Bool SAL_CALL isItemEnabled( sal_Int16 nItemId ) override;
+ virtual void SAL_CALL hideDisabledEntries( sal_Bool bHide ) override;
+ virtual void SAL_CALL enableAutoMnemonics( sal_Bool bEnable ) override;
+ virtual void SAL_CALL setItemText( sal_Int16 nItemId, const OUString& aText ) override;
+ virtual OUString SAL_CALL getItemText( sal_Int16 nItemId ) override;
+ virtual void SAL_CALL setCommand( sal_Int16 nItemId, const OUString& aCommand ) override;
+ virtual OUString SAL_CALL getCommand( sal_Int16 nItemId ) override;
+ virtual void SAL_CALL setHelpCommand( sal_Int16 nItemId, const OUString& aHelp ) override;
+ virtual OUString SAL_CALL getHelpCommand( sal_Int16 nItemId ) override;
+ virtual void SAL_CALL setHelpText( ::sal_Int16 nItemId, const OUString& sHelpText ) override;
+ virtual OUString SAL_CALL getHelpText( ::sal_Int16 nItemId ) override;
+ virtual void SAL_CALL setTipHelpText( ::sal_Int16 nItemId, const OUString& sTipHelpText ) override;
+ virtual OUString SAL_CALL getTipHelpText( ::sal_Int16 nItemId ) override;
+
+ virtual sal_Bool SAL_CALL isPopupMenu( ) override;
+ virtual void SAL_CALL setPopupMenu( sal_Int16 nItemId, const css::uno::Reference< css::awt::XPopupMenu >& aPopupMenu ) override;
+ virtual css::uno::Reference< css::awt::XPopupMenu > SAL_CALL getPopupMenu( sal_Int16 nItemId ) override;
+
+ // css::awt::XPopupMenu
+ virtual void SAL_CALL insertSeparator( sal_Int16 nPos ) override;
+ virtual void SAL_CALL setDefaultItem( sal_Int16 nItemId ) override;
+ virtual sal_Int16 SAL_CALL getDefaultItem( ) override;
+ virtual void SAL_CALL checkItem( sal_Int16 nItemId, sal_Bool bCheck ) override;
+ virtual sal_Bool SAL_CALL isItemChecked( sal_Int16 nItemId ) override;
+ virtual ::sal_Int16 SAL_CALL execute( const css::uno::Reference< css::awt::XWindowPeer >& Parent, const css::awt::Rectangle& Position, ::sal_Int16 Direction ) override;
+ virtual sal_Bool SAL_CALL isInExecute( ) override;
+ virtual void SAL_CALL endExecute( ) override;
+ virtual void SAL_CALL setAcceleratorKeyEvent( ::sal_Int16 nItemId, const css::awt::KeyEvent& aKeyEvent ) override;
+ virtual css::awt::KeyEvent SAL_CALL getAcceleratorKeyEvent( ::sal_Int16 nItemId ) override;
+ virtual void SAL_CALL setItemImage( ::sal_Int16 nItemId, const css::uno::Reference< css::graphic::XGraphic >& xGraphic, sal_Bool bScale ) override;
+ virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getItemImage( ::sal_Int16 nItemId ) override;
+
+ // css::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+};
+
+class UNLESS_MERGELIBS(TOOLKIT_DLLPUBLIC) VCLXMenuBar final : public VCLXMenu
+{
+public:
+ VCLXMenuBar();
+ VCLXMenuBar( MenuBar* pMenuBar );
+};
+
+class TOOLKIT_DLLPUBLIC VCLXPopupMenu final : public VCLXMenu
+{
+public:
+ VCLXPopupMenu();
+ VCLXPopupMenu( PopupMenu* pPopMenu );
+};
+
+#endif // INCLUDED_TOOLKIT_AWT_VCLXMENU_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/awt/vclxwindow.hxx b/include/toolkit/awt/vclxwindow.hxx
new file mode 100644
index 000000000..9f3226ee6
--- /dev/null
+++ b/include/toolkit/awt/vclxwindow.hxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <toolkit/dllapi.h>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <vcl/vclptr.hxx>
+
+#include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XView.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/awt/XDockableWindow.hpp>
+#include <com/sun/star/awt/XStyleSettingsSupplier.hpp>
+
+#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/implbase.hxx>
+
+#include <tools/gen.hxx>
+#include <tools/link.hxx>
+
+#include <memory>
+#include <vector>
+#include <functional>
+
+namespace comphelper { template <class ListenerT> class OInterfaceContainerHelper3; }
+namespace com::sun::star::accessibility { class XAccessibleContext; }
+namespace com::sun::star::awt { class XTopWindowListener; }
+namespace com::sun::star::awt { class XVclContainerListener; }
+namespace vcl { class Window; }
+
+class VclWindowEvent;
+
+namespace toolkit
+{
+ class IAccessibleFactory;
+}
+
+
+class UnoPropertyArrayHelper;
+class VCLXWindowImpl;
+typedef cppu::ImplInheritanceHelper< VCLXDevice,
+ css::awt::XWindow2,
+ css::awt::XVclWindowPeer,
+ css::awt::XLayoutConstrains,
+ css::awt::XView,
+ css::awt::XDockableWindow,
+ css::accessibility::XAccessible,
+ css::lang::XEventListener,
+ css::beans::XPropertySetInfo,
+ css::awt::XStyleSettingsSupplier
+ > VCLXWindow_Base;
+
+class TOOLKIT_DLLPUBLIC VCLXWindow : public VCLXWindow_Base
+{
+private:
+ std::unique_ptr<VCLXWindowImpl> mpImpl;
+
+ UnoPropertyArrayHelper *GetPropHelper();
+
+protected:
+ Size ImplCalcWindowSize( const Size& rOutSz ) const;
+ DECL_DLLPRIVATE_LINK(WindowEventListener, VclWindowEvent&, void );
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+ void SetSynthesizingVCLEvent( bool b );
+ bool IsSynthesizingVCLEvent() const;
+
+ void SetSystemParent_Impl( const css::uno::Any& rHandle );
+
+ ::toolkit::IAccessibleFactory& getAccessibleFactory();
+
+ // helper ...
+ static void PushPropertyIds( std::vector< sal_uInt16 > &aIds, int nFirstId, ...);
+ // for use in controls/
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds,
+ bool bWithDefaults = false );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds );
+
+ ::comphelper::OInterfaceContainerHelper3<css::awt::XVclContainerListener>& GetContainerListeners();
+ ::comphelper::OInterfaceContainerHelper3<css::awt::XTopWindowListener>& GetTopWindowListeners();
+
+public:
+ typedef ::std::function<void ()> Callback;
+
+protected:
+ /** executes the given callback asynchronously
+
+ At the moment the callback is called, the Solar Mutex is not locked. In particular, this implies that
+ you cannot rely on |this| not being disposed. However, you *can* rely on |this| being still alive (i.e.
+ having a ref count > 0).
+
+ As a consequence, this can be used for doing listener notifications, using event multiplexers. Those multiplexers
+ care for the disposed state themself, and are alive as long as |this| is alive.
+ */
+ void ImplExecuteAsyncWithoutSolarLock(
+ const Callback& i_callback
+ );
+
+public:
+ VCLXWindow( bool bWithDefaultProps = false );
+ virtual ~VCLXWindow() override;
+
+ virtual void SetWindow( const VclPtr< vcl::Window > &pWindow );
+ template< class derived_type > derived_type* GetAs() const {
+ return static_cast< derived_type * >( GetWindow() ); }
+ template< class derived_type > derived_type* GetAsDynamic() const {
+ return dynamic_cast< derived_type * >( GetWindow() ); }
+ vcl::Window* GetWindow() const
+ {
+ auto p = GetOutputDevice().get();
+ return p ? p->GetOwnerWindow() : nullptr;
+ }
+
+ void suspendVclEventListening( );
+ void resumeVclEventListening( );
+
+ void notifyWindowRemoved( vcl::Window const & _rWindow );
+
+ bool IsDisposed() const;
+
+ // css::lang::XUnoTunnel
+ UNO3_GETIMPLEMENTATION_DECL(VCLXWindow)
+
+ // css::lang::XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // css::lang::XComponent
+ void SAL_CALL dispose( ) override;
+ void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& rxListener ) override;
+ void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& rxListener ) override;
+
+ // css::awt::XWindow
+ void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) override;
+ css::awt::Rectangle SAL_CALL getPosSize( ) override;
+ void SAL_CALL setVisible( sal_Bool Visible ) override;
+ void SAL_CALL setEnable( sal_Bool Enable ) override;
+ void SAL_CALL setFocus( ) override;
+ void SAL_CALL addWindowListener( const css::uno::Reference< css::awt::XWindowListener >& rrxListener ) override;
+ void SAL_CALL removeWindowListener( const css::uno::Reference< css::awt::XWindowListener >& rrxListener ) override;
+ void SAL_CALL addFocusListener( const css::uno::Reference< css::awt::XFocusListener >& rrxListener ) override;
+ void SAL_CALL removeFocusListener( const css::uno::Reference< css::awt::XFocusListener >& rrxListener ) override;
+ void SAL_CALL addKeyListener( const css::uno::Reference< css::awt::XKeyListener >& rrxListener ) override;
+ void SAL_CALL removeKeyListener( const css::uno::Reference< css::awt::XKeyListener >& rrxListener ) override;
+ void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& rrxListener ) override;
+ void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& rrxListener ) override;
+ void SAL_CALL addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& rrxListener ) override;
+ void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& rrxListener ) override;
+ void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& rrxListener ) override;
+ void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& rrxListener ) override;
+
+ // css::awt::XWindowPeer
+ css::uno::Reference< css::awt::XToolkit > SAL_CALL getToolkit( ) override;
+ void SAL_CALL setPointer( const css::uno::Reference< css::awt::XPointer >& Pointer ) override;
+ void SAL_CALL setBackground( sal_Int32 Color ) override;
+ void SAL_CALL invalidate( sal_Int16 Flags ) override;
+ void SAL_CALL invalidateRect( const css::awt::Rectangle& Rect, sal_Int16 Flags ) override;
+
+ // css::awt::XVclWindowPeer
+ sal_Bool SAL_CALL isChild( const css::uno::Reference< css::awt::XWindowPeer >& Peer ) override;
+ void SAL_CALL setDesignMode( sal_Bool bOn ) override;
+ sal_Bool SAL_CALL isDesignMode( ) override;
+ void SAL_CALL enableClipSiblings( sal_Bool bClip ) override;
+ void SAL_CALL setForeground( sal_Int32 Color ) override;
+ void SAL_CALL setControlFont( const css::awt::FontDescriptor& aFont ) override;
+ void SAL_CALL getStyles( sal_Int16 nType, css::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) override;
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
+
+ // css::awt::XView
+ sal_Bool SAL_CALL setGraphics( const css::uno::Reference< css::awt::XGraphics >& aDevice ) override;
+ css::uno::Reference< css::awt::XGraphics > SAL_CALL getGraphics( ) override;
+ css::awt::Size SAL_CALL getSize( ) override;
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) override;
+ void SAL_CALL setZoom( float fZoomX, float fZoomY ) override;
+
+ // css::accessibility::XAccessible
+ css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
+
+ // css::awt::XDockableWindow
+ void SAL_CALL addDockableWindowListener( const css::uno::Reference< css::awt::XDockableWindowListener >& xListener ) override;
+ void SAL_CALL removeDockableWindowListener( const css::uno::Reference< css::awt::XDockableWindowListener >& xListener ) override;
+ void SAL_CALL enableDocking( sal_Bool bEnable ) override;
+ sal_Bool SAL_CALL isFloating( ) override;
+ void SAL_CALL setFloatingMode( sal_Bool bFloating ) override;
+ void SAL_CALL lock( ) override;
+ void SAL_CALL unlock( ) override;
+ sal_Bool SAL_CALL isLocked( ) override;
+ void SAL_CALL startPopupMode( const css::awt::Rectangle& WindowRect ) override;
+ sal_Bool SAL_CALL isInPopupMode( ) override;
+
+ // css::awt::XWindow2
+ void SAL_CALL setOutputSize( const css::awt::Size& aSize ) override;
+ css::awt::Size SAL_CALL getOutputSize( ) override;
+ sal_Bool SAL_CALL isVisible( ) override;
+ sal_Bool SAL_CALL isActive( ) override;
+ sal_Bool SAL_CALL isEnabled( ) override;
+ sal_Bool SAL_CALL hasFocus( ) override;
+
+ // css::beans::XPropertySetInfo
+ css::uno::Sequence< css::beans::Property > SAL_CALL getProperties( ) override;
+ css::beans::Property SAL_CALL getPropertyByName( const OUString& aName ) override;
+ sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) override;
+
+ // XStyleSettingsSupplier
+ virtual css::uno::Reference< css::awt::XStyleSettings > SAL_CALL getStyleSettings() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx
new file mode 100644
index 000000000..e67f6b619
--- /dev/null
+++ b/include/toolkit/awt/vclxwindows.hxx
@@ -0,0 +1,743 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <toolkit/dllapi.h>
+
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/awt/XListBox.hpp>
+#include <com/sun/star/awt/XNumericField.hpp>
+#include <com/sun/star/awt/XScrollBar.hpp>
+#include <com/sun/star/awt/XTextEditField.hpp>
+#include <com/sun/star/awt/XSpinField.hpp>
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+#include <com/sun/star/awt/XButton.hpp>
+#include <com/sun/star/awt/XToggleButton.hpp>
+#include <com/sun/star/awt/XFixedHyperlink.hpp>
+#include <com/sun/star/awt/XFixedText.hpp>
+#include <com/sun/star/awt/XRadioButton.hpp>
+#include <com/sun/star/awt/XComboBox.hpp>
+#include <com/sun/star/awt/XCheckBox.hpp>
+#include <com/sun/star/awt/XItemListListener.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/weak.hxx>
+
+#include <svl/numuno.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+#include <vcl/image.hxx>
+
+// class VCLXGraphicControl
+// deriving from VCLXWindow, drawing the graphic which exists as "Graphic" at the model
+
+class VCLXGraphicControl : public VCLXWindow
+{
+private:
+ /// the image we currently display
+ Image maImage;
+
+protected:
+ const Image& GetImage() const { return maImage; }
+
+protected:
+ // css::awt::XWindow
+ void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) override;
+
+ // css::awt::VclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+protected:
+ /** forward our bitmap to our window
+ @precond
+ our mutex is locked
+ @precond
+ GetWindow is not <NULL/>
+ @see GetBitmap
+ */
+ virtual void ImplSetNewImage();
+
+public:
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+
+};
+
+
+// class VCLXButton
+
+typedef cppu::ImplInheritanceHelper< VCLXGraphicControl,
+ css::awt::XButton,
+ css::awt::XToggleButton
+ > VCLXButton_Base;
+class VCLXButton final : public VCLXButton_Base
+{
+private:
+ OUString maActionCommand;
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override;
+
+public:
+ VCLXButton();
+ virtual ~VCLXButton() override;
+
+ // css::lang::XComponent
+ void SAL_CALL dispose( ) override;
+
+ // css::awt::XButton
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL setLabel( const OUString& Label ) override;
+ void SAL_CALL setActionCommand( const OUString& Command ) override;
+
+ // css::awt::XToggleButton
+ // css::awt::XItemEventBroadcaster
+ void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override;
+
+ // css::awt::VclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+// class VCLXCheckBox
+
+class TOOLKIT_DLLPUBLIC VCLXCheckBox final : public css::awt::XCheckBox,
+ public css::awt::XButton,
+ public VCLXGraphicControl
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ OUString maActionCommand;
+ ItemListenerMultiplexer maItemListeners;
+
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override;
+
+public:
+ VCLXCheckBox();
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+
+ // css::lang::XComponent
+ void SAL_CALL dispose( ) override;
+
+ // css::awt::XCheckBox
+ void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ sal_Int16 SAL_CALL getState( ) override;
+ void SAL_CALL setState( sal_Int16 n ) override;
+ void SAL_CALL setLabel( const OUString& Label ) override;
+ void SAL_CALL enableTriState( sal_Bool b ) override;
+
+ // css::awt::XButton:
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL setActionCommand( const OUString& Command ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override;
+
+ // css::awt::VclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+
+// class VCLXRadioButton
+
+class TOOLKIT_DLLPUBLIC VCLXRadioButton final : public css::awt::XRadioButton,
+ public css::awt::XButton,
+ public VCLXGraphicControl
+{
+private:
+ ItemListenerMultiplexer maItemListeners;
+ ActionListenerMultiplexer maActionListeners;
+ OUString maActionCommand;
+
+ void ImplClickedOrToggled( bool bToggled );
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override;
+
+public:
+ VCLXRadioButton();
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::lang::XComponent
+ void SAL_CALL dispose( ) override;
+
+ // css::awt::XRadioButton
+ void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ sal_Bool SAL_CALL getState( ) override;
+ void SAL_CALL setState( sal_Bool b ) override;
+ void SAL_CALL setLabel( const OUString& Label ) override;
+
+ // css::awt::XButton:
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL setActionCommand( const OUString& Command ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override;
+
+ // css::awt::VclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+
+};
+
+// class VCLXFixedHyperlink
+class VCLXFixedHyperlink final :
+ public css::awt::XFixedHyperlink,
+ public VCLXWindow
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
+
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ CreateAccessibleContext() override;
+
+public:
+ VCLXFixedHyperlink();
+ virtual ~VCLXFixedHyperlink() override;
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakObject::release(); }
+
+ // css::lang::XComponent
+ void SAL_CALL dispose( ) override;
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XFixedHyperlink
+ void SAL_CALL setText( const OUString& Text ) override;
+ OUString SAL_CALL getText( ) override;
+ void SAL_CALL setURL( const OUString& URL ) override;
+ OUString SAL_CALL getURL( ) override;
+ void SAL_CALL setAlignment( sal_Int16 nAlign ) override;
+ sal_Int16 SAL_CALL getAlignment( ) override;
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override;
+
+ // css::awt::VclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+
+// class VCLXFixedText
+
+class VCLXFixedText final : public css::awt::XFixedText,
+ public VCLXWindow
+{
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override;
+
+public:
+ VCLXFixedText();
+ virtual ~VCLXFixedText() override;
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XFixedText
+ void SAL_CALL setText( const OUString& Text ) override;
+ OUString SAL_CALL getText( ) override;
+ void SAL_CALL setAlignment( sal_Int16 nAlign ) override;
+ sal_Int16 SAL_CALL getAlignment( ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+
+// class VCLXScrollBar
+
+class TOOLKIT_DLLPUBLIC VCLXScrollBar final : public css::awt::XScrollBar,
+ public VCLXWindow
+{
+private:
+ AdjustmentListenerMultiplexer maAdjustmentListeners;
+
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override;
+
+public:
+ VCLXScrollBar();
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+
+ // css::lang::XComponent
+ void SAL_CALL dispose( ) override;
+
+ // css::awt::XScrollbar
+ void SAL_CALL addAdjustmentListener( const css::uno::Reference< css::awt::XAdjustmentListener >& l ) override;
+ void SAL_CALL removeAdjustmentListener( const css::uno::Reference< css::awt::XAdjustmentListener >& l ) override;
+ void SAL_CALL setValue( sal_Int32 n ) override;
+ void SAL_CALL setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) override;
+ sal_Int32 SAL_CALL getValue( ) override;
+ void SAL_CALL setMaximum( sal_Int32 n ) override;
+ sal_Int32 SAL_CALL getMaximum( ) override;
+ void SAL_CALL setLineIncrement( sal_Int32 n ) override;
+ sal_Int32 SAL_CALL getLineIncrement( ) override;
+ void SAL_CALL setBlockIncrement( sal_Int32 n ) override;
+ sal_Int32 SAL_CALL getBlockIncrement( ) override;
+ void SAL_CALL setVisibleSize( sal_Int32 n ) override;
+ sal_Int32 SAL_CALL getVisibleSize( ) override;
+ void SAL_CALL setOrientation( sal_Int32 n ) override;
+ sal_Int32 SAL_CALL getOrientation( ) override;
+
+ // why isn't this part of the XScrollbar?
+ /// @throws css::uno::RuntimeException
+ void setMinimum( sal_Int32 n );
+ /// @throws css::uno::RuntimeException
+ sal_Int32 getMinimum( ) const;
+
+ // css::awt::VclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize() override;
+ /// @throws css::uno::RuntimeException
+ static css::awt::Size implGetMinimumSize( vcl::Window const * p );
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+
+// class VCLXEdit
+
+class SAL_DLLPUBLIC_RTTI VCLXEdit : public css::awt::XTextComponent,
+ public css::awt::XTextEditField,
+ public css::awt::XTextLayoutConstrains,
+ public VCLXWindow
+{
+private:
+ TextListenerMultiplexer maTextListeners;
+
+protected:
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override;
+
+
+public:
+ VCLXEdit();
+
+ TextListenerMultiplexer& GetTextListeners() { return maTextListeners; }
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+
+ // css::lang::XComponent
+ void SAL_CALL dispose( ) override;
+
+ // css::awt::XTextComponent
+ void SAL_CALL addTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override;
+ void SAL_CALL removeTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override;
+ void SAL_CALL setText( const OUString& aText ) override;
+ void SAL_CALL insertText( const css::awt::Selection& Sel, const OUString& Text ) override;
+ OUString SAL_CALL getText( ) override;
+ OUString SAL_CALL getSelectedText( ) override;
+ void SAL_CALL setSelection( const css::awt::Selection& aSelection ) override;
+ css::awt::Selection SAL_CALL getSelection( ) override;
+ sal_Bool SAL_CALL isEditable( ) override;
+ void SAL_CALL setEditable( sal_Bool bEditable ) override;
+ void SAL_CALL setMaxTextLen( sal_Int16 nLen ) override;
+ sal_Int16 SAL_CALL getMaxTextLen( ) override;
+
+ // css::awt::XTextEditField:
+ void SAL_CALL setEchoChar( sal_Unicode cEcho ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override;
+
+ // css::awt::XTextLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override;
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override;
+
+ // css::awt::VclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+
+// class VCLXSpinField
+class VCLXSpinField : public css::awt::XSpinField, public VCLXEdit
+{
+private:
+ SpinListenerMultiplexer maSpinListeners;
+
+protected:
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
+
+public:
+ VCLXSpinField();
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+
+ // css::awt::XSpinField
+ void SAL_CALL addSpinListener( const css::uno::Reference< css::awt::XSpinListener >& l ) override;
+ void SAL_CALL removeSpinListener( const css::uno::Reference< css::awt::XSpinListener >& l ) override;
+ void SAL_CALL up( ) override;
+ void SAL_CALL down( ) override;
+ void SAL_CALL first( ) override;
+ void SAL_CALL last( ) override;
+ void SAL_CALL enableRepeat( sal_Bool bRepeat ) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+class SVTXFormattedField : public VCLXSpinField
+{
+protected:
+ rtl::Reference<SvNumberFormatsSupplierObj> m_xCurrentSupplier;
+ bool bIsStandardSupplier;
+
+ sal_Int32 nKeyToSetDelayed;
+
+public:
+ SVTXFormattedField();
+ virtual ~SVTXFormattedField() override;
+
+ // css::awt::XVclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+protected:
+ void setFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier > & xSupplier);
+ sal_Int32 getFormatKey() const;
+ void setFormatKey(sal_Int32 nKey);
+
+ void SetValue(const css::uno::Any& rValue);
+ css::uno::Any GetValue() const;
+
+ void SetTreatAsNumber(bool bSet);
+ bool GetTreatAsNumber() const;
+
+ void SetDefaultValue(const css::uno::Any& rValue);
+ css::uno::Any GetDefaultValue() const;
+
+ void SetMinValue(const css::uno::Any& rValue);
+ css::uno::Any GetMinValue() const;
+
+ void SetMaxValue(const css::uno::Any& rValue);
+ css::uno::Any GetMaxValue() const;
+
+ void NotifyTextListeners();
+ css::uno::Any convertEffectiveValue(const css::uno::Any& rValue) const;
+
+ virtual void SetWindow( const VclPtr< vcl::Window > &_pWindow) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+class TOOLKIT_DLLPUBLIC SVTXNumericField final : public css::awt::XNumericField, public SVTXFormattedField
+{
+public:
+ SVTXNumericField();
+ virtual ~SVTXNumericField() override;
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { SVTXFormattedField::acquire(); }
+ void SAL_CALL release() noexcept override { SVTXFormattedField::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XNumericField
+ void SAL_CALL setValue( double Value ) override;
+ double SAL_CALL getValue( ) override;
+ void SAL_CALL setMin( double Value ) override;
+ double SAL_CALL getMin( ) override;
+ void SAL_CALL setMax( double Value ) override;
+ double SAL_CALL getMax( ) override;
+ void SAL_CALL setFirst( double Value ) override;
+ double SAL_CALL getFirst( ) override;
+ void SAL_CALL setLast( double Value ) override;
+ double SAL_CALL getLast( ) override;
+ void SAL_CALL setSpinSize( double Value ) override;
+ double SAL_CALL getSpinSize( ) override;
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override;
+ sal_Int16 SAL_CALL getDecimalDigits( ) override;
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) override;
+ sal_Bool SAL_CALL isStrictFormat( ) override;
+
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override;
+
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override;
+};
+
+// class VCLXListBox
+
+typedef cppu::ImplInheritanceHelper< VCLXWindow,
+ css::awt::XListBox,
+ css::awt::XTextLayoutConstrains,
+ css::awt::XItemListListener
+ > VCLXListBox_Base;
+class VCLXListBox final : public VCLXListBox_Base
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ CreateAccessibleContext() override;
+ void ImplCallItemListeners();
+
+public:
+ VCLXListBox();
+
+ // css::lang::XComponent
+ void SAL_CALL dispose( ) override;
+
+ // css::awt::XListBox
+ void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL addItem( const OUString& aItem, sal_Int16 nPos ) override;
+ void SAL_CALL addItems( const css::uno::Sequence< OUString >& aItems, sal_Int16 nPos ) override;
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) override;
+ sal_Int16 SAL_CALL getItemCount( ) override;
+ OUString SAL_CALL getItem( sal_Int16 nPos ) override;
+ css::uno::Sequence< OUString > SAL_CALL getItems( ) override;
+ sal_Int16 SAL_CALL getSelectedItemPos( ) override;
+ css::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos( ) override;
+ OUString SAL_CALL getSelectedItem( ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSelectedItems( ) override;
+ void SAL_CALL selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) override;
+ void SAL_CALL selectItemsPos( const css::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect ) override;
+ void SAL_CALL selectItem( const OUString& aItem, sal_Bool bSelect ) override;
+ sal_Bool SAL_CALL isMutipleMode( ) override;
+ void SAL_CALL setMultipleMode( sal_Bool bMulti ) override;
+ sal_Int16 SAL_CALL getDropDownLineCount( ) override;
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) override;
+ void SAL_CALL makeVisible( sal_Int16 nEntry ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override;
+
+ // css::awt::XTextLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override;
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override;
+
+ // css::awt::VclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL listItemRemoved( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL listItemModified( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL allItemsRemoved( const css::lang::EventObject& Event ) override;
+ virtual void SAL_CALL itemListChanged( const css::lang::EventObject& Event ) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& i_rEvent ) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+
+// class VCLXComboBox
+
+typedef cppu::ImplInheritanceHelper< VCLXEdit,
+ css::awt::XComboBox,
+ css::awt::XItemListListener
+ > VCLXComboBox_Base;
+class VCLXComboBox final : public VCLXComboBox_Base
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override;
+
+
+public:
+ VCLXComboBox();
+ virtual ~VCLXComboBox() override;
+
+ // css::lang::XComponent
+ void SAL_CALL dispose( ) override;
+
+ // css::awt::XComboBox
+ void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL addItem( const OUString& aItem, sal_Int16 nPos ) override;
+ void SAL_CALL addItems( const css::uno::Sequence< OUString >& aItems, sal_Int16 nPos ) override;
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) override;
+ sal_Int16 SAL_CALL getItemCount( ) override;
+ OUString SAL_CALL getItem( sal_Int16 nPos ) override;
+ css::uno::Sequence< OUString > SAL_CALL getItems( ) override;
+ sal_Int16 SAL_CALL getDropDownLineCount( ) override;
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override;
+
+ // css::awt::XTextLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override;
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override;
+
+ // css::awt::VclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL listItemRemoved( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL listItemModified( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL allItemsRemoved( const css::lang::EventObject& Event ) override;
+ virtual void SAL_CALL itemListChanged( const css::lang::EventObject& Event ) override;
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& i_rEvent ) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+// class VCLXToolBox
+class VCLXToolBox final : public VCLXWindow
+{
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ CreateAccessibleContext() override;
+
+public:
+ VCLXToolBox();
+ virtual ~VCLXToolBox() override;
+};
+
+class VCLXHeaderBar final : public VCLXWindow
+{
+public:
+ VCLXHeaderBar();
+ virtual ~VCLXHeaderBar() override;
+
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override;
+
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/controls/unocontrol.hxx b/include/toolkit/controls/unocontrol.hxx
new file mode 100644
index 000000000..cbde0b659
--- /dev/null
+++ b/include/toolkit/controls/unocontrol.hxx
@@ -0,0 +1,231 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_CONTROLS_UNOCONTROL_HXX
+#define INCLUDED_TOOLKIT_CONTROLS_UNOCONTROL_HXX
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/awt/XView.hpp>
+#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/awt/XUnitConversion.hpp>
+#include <com/sun/star/awt/XStyleSettingsSupplier.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <osl/mutex.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <tools/long.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/implbase9.hxx>
+#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <memory>
+
+
+struct UnoControlComponentInfos
+{
+ bool bVisible;
+ bool bEnable;
+ tools::Long nX, nY, nWidth, nHeight;
+ sal_uInt16 nFlags;
+ float nZoomX, nZoomY;
+
+ UnoControlComponentInfos()
+ {
+ bVisible = true;
+ bEnable = true;
+ nX = nY = nWidth = nHeight = 0;
+ nFlags = 0; // POSSIZE_POSSIZE;
+ nZoomX = nZoomY = 1.0f;
+ }
+};
+
+struct UnoControl_Data;
+
+
+typedef ::cppu::WeakAggImplHelper9 < css::awt::XControl
+ , css::awt::XWindow2
+ , css::awt::XView
+ , css::beans::XPropertiesChangeListener
+ , css::lang::XServiceInfo
+ , css::accessibility::XAccessible
+ , css::util::XModeChangeBroadcaster
+ , css::awt::XUnitConversion
+ , css::awt::XStyleSettingsSupplier
+ > UnoControl_Base;
+
+class TOOLKIT_DLLPUBLIC UnoControl : public UnoControl_Base
+{
+private:
+ ::osl::Mutex maMutex;
+
+ css::uno::Reference< css::awt::XWindowPeer > mxPeer;
+ css::uno::Reference< css::awt::XVclWindowPeer > mxVclWindowPeer; // just to avoid the query_interface thing
+
+protected:
+ EventListenerMultiplexer maDisposeListeners;
+ WindowListenerMultiplexer maWindowListeners;
+ FocusListenerMultiplexer maFocusListeners;
+ KeyListenerMultiplexer maKeyListeners;
+ MouseListenerMultiplexer maMouseListeners;
+ MouseMotionListenerMultiplexer maMouseMotionListeners;
+ PaintListenerMultiplexer maPaintListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::util::XModeChangeListener> maModeChangeListeners;
+
+ css::uno::Reference< css::uno::XInterface > mxContext;
+ css::uno::Reference< css::awt::XControlModel > mxModel;
+ css::uno::Reference< css::awt::XGraphics > mxGraphics;
+
+ css::uno::WeakReferenceHelper
+ maAccessibleContext; /// our most recent XAccessibleContext instance
+
+ bool mbDisposePeer;
+ bool mbRefreshingPeer;
+ bool mbCreatingPeer;
+ bool mbCreatingCompatiblePeer;
+ bool mbDesignMode;
+
+ UnoControlComponentInfos maComponentInfos;
+ std::unique_ptr<UnoControl_Data> mpData;
+
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+ css::uno::Reference< css::awt::XWindow > getParentPeer() const;
+ virtual void updateFromModel();
+ void peerCreated();
+ bool ImplCheckLocalize( OUString& _rPossiblyLocalizable );
+ css::uno::Reference< css::awt::XWindowPeer > ImplGetCompatiblePeer();
+ virtual void ImplSetPeerProperty( const OUString& rPropName, const css::uno::Any& rVal );
+ virtual void PrepareWindowDescriptor( css::awt::WindowDescriptor& rDesc );
+ virtual void ImplModelPropertiesChanged( const css::uno::Sequence< css::beans::PropertyChangeEvent >& rEvents );
+
+ void ImplLockPropertyChangeNotification( const OUString& rPropertyName, bool bLock );
+ void ImplLockPropertyChangeNotifications( const css::uno::Sequence< OUString >& rPropertyNames, bool bLock );
+
+ void DisposeAccessibleContext(css::uno::Reference<
+ css::lang::XComponent> const& xContext);
+
+ void setPeer( const css::uno::Reference< css::awt::XWindowPeer >& _xPeer)
+ {
+ mxPeer = _xPeer;
+ mxVclWindowPeer = css::uno::Reference< css::awt::XVclWindowPeer >(mxPeer,css::uno::UNO_QUERY); // just to avoid the query_interface thing
+ }
+
+ virtual bool requiresNewPeer( const OUString& _rPropertyName ) const;
+
+public:
+ UnoControl();
+ virtual ~UnoControl() override;
+
+ UnoControlComponentInfos& GetComponentInfos() { return maComponentInfos; }
+
+
+ virtual OUString GetComponentServiceName() const;
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::lang::XComponent
+ void SAL_CALL dispose( ) override;
+ void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
+ void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
+
+ // XEventListener
+ void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // css::awt::XWindow2
+ virtual void SAL_CALL setOutputSize( const css::awt::Size& aSize ) override;
+ virtual css::awt::Size SAL_CALL getOutputSize( ) override;
+ virtual sal_Bool SAL_CALL isVisible( ) override;
+ virtual sal_Bool SAL_CALL isActive( ) override;
+ virtual sal_Bool SAL_CALL isEnabled( ) override;
+ virtual sal_Bool SAL_CALL hasFocus( ) override;
+
+ // css::awt::XWindow
+ void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) override;
+ css::awt::Rectangle SAL_CALL getPosSize( ) override;
+ void SAL_CALL setVisible( sal_Bool Visible ) override;
+ void SAL_CALL setEnable( sal_Bool Enable ) override;
+ void SAL_CALL setFocus( ) override;
+ void SAL_CALL addWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override;
+ void SAL_CALL removeWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override;
+ void SAL_CALL addFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override;
+ void SAL_CALL removeFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override;
+ void SAL_CALL addKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override;
+ void SAL_CALL removeKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override;
+ void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override;
+ void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override;
+ void SAL_CALL addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override;
+ void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override;
+ void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override;
+ void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override;
+
+ // css::awt::XView
+ sal_Bool SAL_CALL setGraphics( const css::uno::Reference< css::awt::XGraphics >& aDevice ) override;
+ css::uno::Reference< css::awt::XGraphics > SAL_CALL getGraphics( ) override;
+ css::awt::Size SAL_CALL getSize( ) override;
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) override;
+ void SAL_CALL setZoom( float fZoomX, float fZoomY ) override;
+
+ // css::awt::XControl
+ void SAL_CALL setContext( const css::uno::Reference< css::uno::XInterface >& Context ) override;
+ css::uno::Reference< css::uno::XInterface > SAL_CALL getContext( ) override;
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+ css::uno::Reference< css::awt::XWindowPeer > SAL_CALL getPeer( ) override;
+ sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& Model ) override;
+ css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel( ) override;
+ css::uno::Reference< css::awt::XView > SAL_CALL getView( ) override;
+ void SAL_CALL setDesignMode( sal_Bool bOn ) override;
+ sal_Bool SAL_CALL isDesignMode( ) override;
+ sal_Bool SAL_CALL isTransparent( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName( ) override;
+ sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+
+ // XAccessible
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
+
+ // XModeChangeBroadcaster
+ virtual void SAL_CALL addModeChangeListener( const css::uno::Reference< css::util::XModeChangeListener >& _rxListener ) override;
+ virtual void SAL_CALL removeModeChangeListener( const css::uno::Reference< css::util::XModeChangeListener >& _rxListener ) override;
+ virtual void SAL_CALL addModeChangeApproveListener( const css::uno::Reference< css::util::XModeChangeApproveListener >& _rxListener ) override;
+ virtual void SAL_CALL removeModeChangeApproveListener( const css::uno::Reference< css::util::XModeChangeApproveListener >& _rxListener ) override;
+
+ // XUnitConversion
+ virtual css::awt::Point SAL_CALL convertPointToLogic( const css::awt::Point& Point, ::sal_Int16 TargetUnit ) override;
+ virtual css::awt::Point SAL_CALL convertPointToPixel( const css::awt::Point& aPoint, ::sal_Int16 SourceUnit ) override;
+ virtual css::awt::Size SAL_CALL convertSizeToLogic( const css::awt::Size& aSize, ::sal_Int16 TargetUnit ) override;
+ virtual css::awt::Size SAL_CALL convertSizeToPixel( const css::awt::Size& aSize, ::sal_Int16 SourceUnit ) override;
+
+ // XStyleSettingsSupplier
+ virtual css::uno::Reference< css::awt::XStyleSettings > SAL_CALL getStyleSettings() override;
+
+protected:
+ // css::beans::XPropertiesChangeListener
+ void SAL_CALL propertiesChange( const css::uno::Sequence< css::beans::PropertyChangeEvent >& evt ) override;
+};
+
+
+#endif // INCLUDED_TOOLKIT_CONTROLS_UNOCONTROL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/controls/unocontrolbase.hxx b/include/toolkit/controls/unocontrolbase.hxx
new file mode 100644
index 000000000..06e57067d
--- /dev/null
+++ b/include/toolkit/controls/unocontrolbase.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLBASE_HXX
+#define INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLBASE_HXX
+
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+
+#include <toolkit/controls/unocontrol.hxx>
+
+
+
+
+class UnoControlBase : public UnoControl
+{
+protected:
+ UnoControlBase() {}
+
+ bool ImplHasProperty( sal_uInt16 nProp );
+ bool ImplHasProperty( const OUString& aPropertyName );
+ void ImplSetPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue, bool bUpdateThis );
+ void ImplSetPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues, bool bUpdateThis );
+ css::uno::Any ImplGetPropertyValue( const OUString& aPropertyName ) const;
+
+ template <typename T> T ImplGetPropertyValuePOD( sal_uInt16 nProp );
+ template <typename T> T ImplGetPropertyValueClass( sal_uInt16 nProp );
+ bool ImplGetPropertyValue_BOOL( sal_uInt16 nProp );
+ sal_Int16 ImplGetPropertyValue_INT16( sal_uInt16 nProp );
+ sal_Int32 ImplGetPropertyValue_INT32( sal_uInt16 nProp );
+ double ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp );
+ OUString ImplGetPropertyValue_UString( sal_uInt16 nProp );
+ css::util::Date ImplGetPropertyValue_Date( sal_uInt16 nProp );
+ css::util::Time ImplGetPropertyValue_Time( sal_uInt16 nProp );
+
+ // XLayoutConstrains (only when the Control supporting it)
+ css::awt::Size Impl_getMinimumSize();
+ css::awt::Size Impl_getPreferredSize();
+ css::awt::Size Impl_calcAdjustedSize( const css::awt::Size& rNewSize );
+
+ // XTextLayoutConstrains (only when the Control supporting it)
+ css::awt::Size Impl_getMinimumSize( sal_Int16 nCols, sal_Int16 nLines );
+ void Impl_getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines );
+};
+
+
+#endif // INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/controls/unocontrolmodel.hxx b/include/toolkit/controls/unocontrolmodel.hxx
new file mode 100644
index 000000000..fb22dc3e4
--- /dev/null
+++ b/include/toolkit/controls/unocontrolmodel.hxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLMODEL_HXX
+#define INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLMODEL_HXX
+
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <cppuhelper/weakagg.hxx>
+
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include <comphelper/uno3.hxx>
+#include <rtl/ref.hxx>
+
+#include <vector>
+#include <map>
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+typedef std::map<sal_uInt16, css::uno::Any> ImplPropertyTable;
+
+
+
+
+typedef ::cppu::WeakAggImplHelper7 < css::awt::XControlModel
+ , css::beans::XPropertyState
+ , css::io::XPersistObject
+ , css::lang::XComponent
+ , css::lang::XServiceInfo
+ , css::lang::XUnoTunnel
+ , css::util::XCloneable
+ > UnoControlModel_Base;
+
+class UnoControlModel :public UnoControlModel_Base
+ ,public MutexAndBroadcastHelper
+ ,public ::cppu::OPropertySetHelper
+{
+private:
+ ImplPropertyTable maData;
+ EventListenerMultiplexer maDisposeListeners;
+
+protected:
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+protected:
+ void ImplRegisterProperty( sal_uInt16 nPropType );
+ void ImplRegisterProperties( const std::vector< sal_uInt16 > &rIds );
+ void ImplRegisterProperty( sal_uInt16 nPropId, const css::uno::Any& rDefault );
+ css::uno::Sequence<sal_Int32> ImplGetPropertyIds() const;
+ virtual css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ bool ImplHasProperty( sal_uInt16 nPropId ) const;
+
+ /** called before setting multiple properties, allows to care for property dependencies
+
+ <p>When multiple property values are set (e.g. XPropertySet::setPropertyValues), it may happen that some
+ of them are dependent. For this, derivees which know such dependencies can affect the order in which
+ the properties are internally really set.</p>
+ */
+ virtual void ImplNormalizePropertySequence(
+ const sal_Int32 _nCount, /// the number of entries in the arrays
+ sal_Int32* _pHandles, /// the handles of the properties to set
+ css::uno::Any* _pValues, /// the values of the properties to set
+ sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted
+ ) const;
+
+ /// ensures that two property values in a sequence have a certain order
+ static void ImplEnsureHandleOrder(
+ const sal_Int32 _nCount, /// number of entries in the array
+ sal_Int32* _pHandles, /// pointer to the handles
+ css::uno::Any* _pValues, /// pointer to the values
+ sal_Int32 _nFirstHandle, /// first handle, which should precede _nSecondHandle in the sequence
+ sal_Int32 _nSecondHandle /// second handle, which should supersede _nFirstHandle in the sequence
+ );
+
+ template<typename T> void UNO_CONTROL_MODEL_REGISTER_PROPERTIES() {
+ std::vector< sal_uInt16 > aIds;
+ T::ImplGetPropertyIds( aIds );
+ ImplRegisterProperties( aIds );
+ }
+
+protected:
+#ifdef _MSC_VER
+ UnoControlModel() //do not use! needed by MSVC at compile time to satisfy WeakAggImplHelper7
+ : UnoControlModel_Base()
+ , MutexAndBroadcastHelper()
+ , OPropertySetHelper( BrdcstHelper )
+ , maDisposeListeners( *this )
+ , m_xContext( css::uno::Reference< css::uno::XComponentContext >() )
+ {
+ assert(false);
+ }
+#endif
+
+public:
+ UnoControlModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlModel( const UnoControlModel& rModel );
+
+ virtual rtl::Reference<UnoControlModel> Clone() const = 0;
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return OWeakAggObject::queryInterface(rType); }
+ void SAL_CALL acquire() noexcept override;
+ void SAL_CALL release() noexcept override;
+
+ // css::uno::XAggregation
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+
+ // css::lang::XUnoTunnel
+ static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() noexcept;
+ sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) override;
+
+ // css::util::XCloneable
+ css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
+
+ // css::lang::XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // css::lang::XComponent
+ void SAL_CALL dispose( ) override;
+ void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
+ void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
+
+ // css::beans::XPropertyState
+ css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
+ css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
+ void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
+ css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+ void SAL_CALL write( const css::uno::Reference< css::io::XObjectOutputStream >& OutStream ) override;
+ void SAL_CALL read( const css::uno::Reference< css::io::XObjectInputStream >& InStream ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName( ) override;
+ sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // ::cppu::OPropertySetHelper
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override = 0;
+ sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any & rConvertedValue, css::uno::Any & rOldValue, sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+ using cppu::OPropertySetHelper::getFastPropertyValue;
+ void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override;
+
+ // override setValue methods to handle properties of FontDescriptor
+ // css::beans::XPropertySet
+ void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
+ // css::beans::XFastPropertySet
+ void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& aValue ) override;
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& PropertyNames, const css::uno::Sequence< css::uno::Any >& Values ) override;
+};
+
+#endif // INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLMODEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/controls/unocontrols.hxx b/include/toolkit/controls/unocontrols.hxx
new file mode 100644
index 000000000..121bdec42
--- /dev/null
+++ b/include/toolkit/controls/unocontrols.hxx
@@ -0,0 +1,1490 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLS_HXX
+#define INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLS_HXX
+
+#include <config_options.h>
+#include <toolkit/dllapi.h>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/awt/XTextListener.hpp>
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+#include <com/sun/star/awt/XButton.hpp>
+#include <com/sun/star/awt/XToggleButton.hpp>
+#include <com/sun/star/awt/XRadioButton.hpp>
+#include <com/sun/star/awt/XItemListener.hpp>
+#include <com/sun/star/awt/XCheckBox.hpp>
+#include <com/sun/star/awt/XFixedHyperlink.hpp>
+#include <com/sun/star/awt/XFixedText.hpp>
+#include <com/sun/star/awt/XListBox.hpp>
+#include <com/sun/star/awt/XComboBox.hpp>
+#include <com/sun/star/awt/XDateField.hpp>
+#include <com/sun/star/awt/XSpinField.hpp>
+#include <com/sun/star/awt/XTimeField.hpp>
+#include <com/sun/star/awt/XNumericField.hpp>
+#include <com/sun/star/awt/XCurrencyField.hpp>
+#include <com/sun/star/awt/XPatternField.hpp>
+#include <com/sun/star/awt/XProgressBar.hpp>
+#include <com/sun/star/awt/XItemList.hpp>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/uno3.hxx>
+#include <tools/gen.hxx>
+
+#include <memory>
+#include <vector>
+
+#include <optional>
+
+namespace com::sun::star::graphic { class XGraphic; }
+namespace com::sun::star::graphic { class XGraphicObject; }
+
+class ImageHelper
+{
+public:
+ // The routine will always attempt to return a valid XGraphic for the
+ // passed _rURL, additionally xOutGraphicObject will contain the
+ // associated XGraphicObject ( if url is valid for that ) and is set
+ // appropriately ( e.g. NULL if non GraphicObject scheme ) or a valid
+ // object if the rURL points to a valid object
+ static css::uno::Reference< css::graphic::XGraphic > getGraphicAndGraphicObjectFromURL_nothrow( css::uno::Reference< css::graphic::XGraphicObject >& xOutGraphicObject, const OUString& _rURL );
+ static css::uno::Reference< css::graphic::XGraphic > getGraphicFromURL_nothrow( const OUString& _rURL );
+
+};
+
+
+
+class UnoControlEditModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlEditModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlEditModel( const UnoControlEditModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlEditModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+typedef ::cppu::ImplHelper4 < css::awt::XTextComponent
+ , css::awt::XTextListener
+ , css::awt::XLayoutConstrains
+ , css::awt::XTextLayoutConstrains
+ > UnoEditControl_Base;
+class UNLESS_MERGELIBS(TOOLKIT_DLLPUBLIC) UnoEditControl :public UnoControlBase
+ ,public UnoEditControl_Base
+{
+private:
+ TextListenerMultiplexer maTextListeners;
+
+ // Not all fields derived from UnoEditCOntrol have the property "Text"
+ // They only support XTextComponent, so keep the text
+ // here, maybe there is no Peer when calling setText()...
+ OUString maText;
+ sal_uInt16 mnMaxTextLen;
+
+ bool mbSetTextInPeer;
+ bool mbSetMaxTextLenInPeer;
+ bool mbHasTextProperty;
+
+public:
+
+ UnoEditControl();
+ OUString GetComponentServiceName() const override;
+ TextListenerMultiplexer& GetTextListeners() { return maTextListeners; }
+
+ void ImplSetPeerProperty( const OUString& rPropName, const css::uno::Any& rVal ) override;
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+ void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoControlBase::disposing( Source ); }
+ void SAL_CALL dispose( ) override;
+
+ // disambiguate XInterface
+ DECLARE_XINTERFACE()
+
+ // XAggregation
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XTextListener
+ void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override;
+
+ // XTextComponent
+ void SAL_CALL addTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override;
+ void SAL_CALL removeTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override;
+ void SAL_CALL setText( const OUString& aText ) override;
+ void SAL_CALL insertText( const css::awt::Selection& Sel, const OUString& Text ) override;
+ OUString SAL_CALL getText( ) override;
+ OUString SAL_CALL getSelectedText( ) override;
+ void SAL_CALL setSelection( const css::awt::Selection& aSelection ) override;
+ css::awt::Selection SAL_CALL getSelection( ) override;
+ sal_Bool SAL_CALL isEditable( ) override;
+ void SAL_CALL setEditable( sal_Bool bEditable ) override;
+ void SAL_CALL setMaxTextLen( sal_Int16 nLen ) override;
+ sal_Int16 SAL_CALL getMaxTextLen( ) override;
+
+ // XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
+
+ // XTextLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override;
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override;
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName( ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel >& Model) override;
+};
+
+
+
+class UnoControlFileControlModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlFileControlModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlFileControlModel( const UnoControlFileControlModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlFileControlModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoFileControl final : public UnoEditControl
+{
+public:
+ UnoFileControl();
+ OUString GetComponentServiceName() const override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class GraphicControlModel : public UnoControlModel
+{
+private:
+ bool mbAdjustingImagePosition;
+ bool mbAdjustingGraphic;
+
+protected:
+ GraphicControlModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
+ :UnoControlModel( rxContext )
+ ,mbAdjustingImagePosition( false )
+ ,mbAdjustingGraphic( false )
+ {
+ }
+ GraphicControlModel( const GraphicControlModel& _rSource ) : UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
+
+ // ::cppu::OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+
+ // UnoControlModel
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+
+private:
+ GraphicControlModel& operator=( const GraphicControlModel& ) = delete;
+};
+
+
+
+class UnoControlButtonModel final : public GraphicControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlButtonModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlButtonModel( const UnoControlButtonModel& rModel ) : GraphicControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlButtonModel( *this ); }
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase
+ , css::awt::XButton
+ , css::awt::XToggleButton
+ , css::awt::XLayoutConstrains
+ , css::awt::XItemListener
+ > UnoButtonControl_Base;
+class UnoButtonControl final : public UnoButtonControl_Base
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+ OUString maActionCommand;
+
+public:
+
+ UnoButtonControl();
+ OUString GetComponentServiceName() const override;
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+ void SAL_CALL dispose( ) override;
+
+ // css::awt::XButton
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL setLabel( const OUString& Label ) override;
+ void SAL_CALL setActionCommand( const OUString& Command ) override;
+
+ // css::awt::XToggleButton
+ // css::awt::XItemEventBroadcaster
+ void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+
+ // css::lang::XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XItemListener
+ virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoControlImageControlModel final : public GraphicControlModel
+{
+private:
+ bool mbAdjustingImageScaleMode;
+
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlImageControlModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlImageControlModel( const UnoControlImageControlModel& rModel ) : GraphicControlModel( rModel ), mbAdjustingImageScaleMode( false ) { }
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlImageControlModel( *this ); }
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // ::cppu::OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+};
+
+
+
+typedef ::cppu::AggImplInheritanceHelper1 < UnoControlBase
+ , css::awt::XLayoutConstrains
+ > UnoImageControlControl_Base;
+class UnoImageControlControl final : public UnoImageControlControl_Base
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+
+public:
+
+ UnoImageControlControl();
+ OUString GetComponentServiceName() const override;
+
+ void SAL_CALL dispose( ) override;
+
+ // css::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoControlRadioButtonModel final : public GraphicControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlRadioButtonModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlRadioButtonModel( const UnoControlRadioButtonModel& rModel ) : GraphicControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlRadioButtonModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase
+ , css::awt::XButton
+ , css::awt::XRadioButton
+ , css::awt::XItemListener
+ , css::awt::XLayoutConstrains
+ > UnoRadioButtonControl_Base;
+class UnoRadioButtonControl final : public UnoRadioButtonControl_Base
+{
+private:
+ ItemListenerMultiplexer maItemListeners;
+ ActionListenerMultiplexer maActionListeners;
+ OUString maActionCommand;
+
+public:
+
+ UnoRadioButtonControl();
+ OUString GetComponentServiceName() const override;
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+ void SAL_CALL dispose( ) override;
+ void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoControlBase::disposing( Source ); }
+
+ // css::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) override;
+
+ // css::awt::XButton
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL setActionCommand( const OUString& Command ) override;
+
+ // css::awt::XRadioButton
+ void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ sal_Bool SAL_CALL getState( ) override;
+ void SAL_CALL setState( sal_Bool b ) override;
+ void SAL_CALL setLabel( const OUString& Label ) override;
+
+ // css::awt::XItemListener
+ void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoControlCheckBoxModel final : public GraphicControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlCheckBoxModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlCheckBoxModel( const UnoControlCheckBoxModel& rModel ) : GraphicControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlCheckBoxModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase
+ , css::awt::XButton
+ , css::awt::XCheckBox
+ , css::awt::XItemListener
+ , css::awt::XLayoutConstrains
+ > UnoCheckBoxControl_Base;
+class UnoCheckBoxControl final : public UnoCheckBoxControl_Base
+{
+private:
+ ItemListenerMultiplexer maItemListeners;
+ ActionListenerMultiplexer maActionListeners;
+ OUString maActionCommand;
+
+public:
+
+ UnoCheckBoxControl();
+ OUString GetComponentServiceName() const override;
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+ void SAL_CALL dispose( ) override;
+ void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoControlBase::disposing( Source ); }
+
+ // css::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) override;
+
+ // css::awt::XButton
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL setActionCommand( const OUString& Command ) override;
+
+ virtual void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ virtual void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+
+
+ sal_Int16 SAL_CALL getState( ) override;
+ void SAL_CALL setState( sal_Int16 n ) override;
+ void SAL_CALL setLabel( const OUString& Label ) override;
+ void SAL_CALL enableTriState( sal_Bool b ) override;
+
+ // css::awt::XItemListener
+ void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoControlFixedHyperlinkModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlFixedHyperlinkModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlFixedHyperlinkModel( const UnoControlFixedHyperlinkModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlFixedHyperlinkModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlFixedHyperlinkModel, UnoControlModel, "com.sun.star.awt.UnoControlFixedHyperlinkModel" )
+};
+
+
+
+class UnoFixedHyperlinkControl final : public UnoControlBase,
+ public css::awt::XFixedHyperlink,
+ public css::awt::XLayoutConstrains
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+
+public:
+ UnoFixedHyperlinkControl();
+
+ OUString GetComponentServiceName() const override;
+
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoControlBase::queryInterface(rType); }
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakAggObject::release(); }
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+ void SAL_CALL dispose( ) override;
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) override;
+
+ // css::awt::XFixedHyperlink
+ void SAL_CALL setText( const OUString& Text ) override;
+ OUString SAL_CALL getText( ) override;
+ void SAL_CALL setURL( const OUString& URL ) override;
+ OUString SAL_CALL getURL( ) override;
+ void SAL_CALL setAlignment( sal_Int16 nAlign ) override;
+ sal_Int16 SAL_CALL getAlignment( ) override;
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
+
+ // css::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoFixedHyperlinkControl, UnoControlBase, "com.sun.star.awt.UnoControlFixedHyperlink" )
+};
+
+
+
+class UnoControlFixedTextModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlFixedTextModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlFixedTextModel( const UnoControlFixedTextModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlFixedTextModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoFixedTextControl final : public UnoControlBase,
+ public css::awt::XFixedText,
+ public css::awt::XLayoutConstrains
+{
+public:
+ UnoFixedTextControl();
+ OUString GetComponentServiceName() const override;
+
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoControlBase::queryInterface(rType); }
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakAggObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) override;
+
+ // css::awt::XFixedText
+ void SAL_CALL setText( const OUString& Text ) override;
+ OUString SAL_CALL getText( ) override;
+ void SAL_CALL setAlignment( sal_Int16 nAlign ) override;
+ sal_Int16 SAL_CALL getAlignment( ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoControlGroupBoxModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlGroupBoxModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlGroupBoxModel( const UnoControlGroupBoxModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlGroupBoxModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoGroupBoxControl final : public UnoControlBase
+{
+public:
+ UnoGroupBoxControl();
+ OUString GetComponentServiceName() const override;
+
+ sal_Bool SAL_CALL isTransparent( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+struct UnoControlListBoxModel_Data;
+typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel
+ , css::awt::XItemList
+ > UnoControlListBoxModel_Base;
+class UnoControlListBoxModel : public UnoControlListBoxModel_Base
+{
+protected:
+ enum ConstructorMode
+ {
+ ConstructDefault,
+ ConstructWithoutProperties
+ };
+
+public:
+ UnoControlListBoxModel(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ ConstructorMode const i_mode = ConstructDefault
+ );
+ UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource );
+ virtual ~UnoControlListBoxModel() override;
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlListBoxModel( *this ); }
+
+ virtual void ImplNormalizePropertySequence(
+ const sal_Int32 _nCount, /// the number of entries in the arrays
+ sal_Int32* _pHandles, /// the handles of the properties to set
+ css::uno::Any* _pValues, /// the values of the properties to set
+ sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted
+ ) const override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName( ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // css::awt::XItemList
+ virtual ::sal_Int32 SAL_CALL getItemCount() override;
+ virtual void SAL_CALL insertItem( ::sal_Int32 Position, const OUString& ItemText, const OUString& ItemImageURL ) override;
+ virtual void SAL_CALL insertItemText( ::sal_Int32 Position, const OUString& ItemText ) override;
+ virtual void SAL_CALL insertItemImage( ::sal_Int32 Position, const OUString& ItemImageURL ) override;
+ virtual void SAL_CALL removeItem( ::sal_Int32 Position ) override;
+ virtual void SAL_CALL removeAllItems( ) override;
+ virtual void SAL_CALL setItemText( ::sal_Int32 Position, const OUString& ItemText ) override;
+ virtual void SAL_CALL setItemImage( ::sal_Int32 Position, const OUString& ItemImageURL ) override;
+ virtual void SAL_CALL setItemTextAndImage( ::sal_Int32 Position, const OUString& ItemText, const OUString& ItemImageURL ) override;
+ virtual void SAL_CALL setItemData( ::sal_Int32 Position, const css::uno::Any& DataValue ) override;
+ virtual OUString SAL_CALL getItemText( ::sal_Int32 Position ) override;
+ virtual OUString SAL_CALL getItemImage( ::sal_Int32 Position ) override;
+ virtual css::beans::Pair< OUString, OUString > SAL_CALL getItemTextAndImage( ::sal_Int32 Position ) override;
+ virtual css::uno::Any SAL_CALL getItemData( ::sal_Int32 Position ) override;
+ virtual css::uno::Sequence< css::beans::Pair< OUString, OUString > > SAL_CALL getAllItems( ) override;
+ virtual void SAL_CALL addItemListListener( const css::uno::Reference< css::awt::XItemListListener >& Listener ) override;
+ virtual void SAL_CALL removeItemListListener( const css::uno::Reference< css::awt::XItemListListener >& Listener ) override;
+
+ // OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+
+protected:
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+private:
+ void impl_notifyItemListEvent_nolck(
+ const sal_Int32 i_nItemPosition,
+ const ::std::optional< OUString >& i_rItemText,
+ const ::std::optional< OUString >& i_rItemImageURL,
+ void ( SAL_CALL css::awt::XItemListListener::*NotificationMethod )( const css::awt::ItemListEvent& )
+ );
+
+ void impl_handleInsert(
+ const sal_Int32 i_nItemPosition,
+ const ::std::optional< OUString >& i_rItemText,
+ const ::std::optional< OUString >& i_rItemImageURL,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_handleRemove(
+ const sal_Int32 i_nItemPosition,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_handleModify(
+ const sal_Int32 i_nItemPosition,
+ const ::std::optional< OUString >& i_rItemText,
+ const ::std::optional< OUString >& i_rItemImageURL,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_getStringItemList( ::std::vector< OUString >& o_rStringItems ) const;
+ void impl_setStringItemList_nolck( const ::std::vector< OUString >& i_rStringItems );
+
+protected:
+ std::unique_ptr<UnoControlListBoxModel_Data> m_xData;
+ ::comphelper::OInterfaceContainerHelper3<css::awt::XItemListListener> m_aItemListListeners;
+};
+
+
+
+typedef ::cppu::AggImplInheritanceHelper5 < UnoControlBase
+ , css::awt::XListBox
+ , css::awt::XItemListener
+ , css::awt::XLayoutConstrains
+ , css::awt::XTextLayoutConstrains
+ , css::awt::XItemListListener
+ > UnoListBoxControl_Base;
+class UnoListBoxControl final : public UnoListBoxControl_Base
+{
+public:
+ UnoListBoxControl();
+ OUString GetComponentServiceName() const override;
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+ void SAL_CALL dispose( ) override;
+ void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoControlBase::disposing( Source ); }
+
+ // css::awt::XListBox
+ void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL addItem( const OUString& aItem, sal_Int16 nPos ) override;
+ void SAL_CALL addItems( const css::uno::Sequence< OUString >& aItems, sal_Int16 nPos ) override;
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) override;
+ sal_Int16 SAL_CALL getItemCount( ) override;
+ OUString SAL_CALL getItem( sal_Int16 nPos ) override;
+ css::uno::Sequence< OUString > SAL_CALL getItems( ) override;
+ sal_Int16 SAL_CALL getSelectedItemPos( ) override;
+ css::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos( ) override;
+ OUString SAL_CALL getSelectedItem( ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSelectedItems( ) override;
+ void SAL_CALL selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) override;
+ void SAL_CALL selectItemsPos( const css::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect ) override;
+ void SAL_CALL selectItem( const OUString& aItem, sal_Bool bSelect ) override;
+ sal_Bool SAL_CALL isMutipleMode( ) override;
+ void SAL_CALL setMultipleMode( sal_Bool bMulti ) override;
+ sal_Int16 SAL_CALL getDropDownLineCount( ) override;
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) override;
+ void SAL_CALL makeVisible( sal_Int16 nEntry ) override;
+
+ // css::awt::XItemListener
+ void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override;
+
+ // css::awt::XLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( ) override;
+ css::awt::Size SAL_CALL getPreferredSize( ) override;
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
+
+ // css::awt::XTextLayoutConstrains
+ css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override;
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override;
+
+ // XUnoControl
+ sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel >& Model) override;
+
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL listItemRemoved( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL listItemModified( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL allItemsRemoved( const css::lang::EventObject& Event ) override;
+ virtual void SAL_CALL itemListChanged( const css::lang::EventObject& Event ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName( ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+private:
+ void ImplUpdateSelectedItemsProperty();
+ virtual void ImplSetPeerProperty( const OUString& rPropName, const css::uno::Any& rVal ) override;
+ virtual void updateFromModel() override;
+
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+};
+
+
+
+class UnoControlComboBoxModel final : public UnoControlListBoxModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlComboBoxModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlComboBoxModel( const UnoControlComboBoxModel& rModel ) : UnoControlListBoxModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlComboBoxModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ // OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName( ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+};
+
+
+
+class UnoComboBoxControl final : public UnoEditControl
+ , public css::awt::XComboBox
+ , public css::awt::XItemListener
+ , public css::awt::XItemListListener
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+public:
+
+ UnoComboBoxControl();
+ OUString GetComponentServiceName() const override;
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+ void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoEditControl::disposing( Source ); }
+ void SAL_CALL dispose( ) override;
+
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoEditControl::queryInterface(rType); }
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakAggObject::release(); }
+
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XComboBox
+ void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override;
+ void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
+ void SAL_CALL addItem( const OUString& aItem, sal_Int16 nPos ) override;
+ void SAL_CALL addItems( const css::uno::Sequence< OUString >& aItems, sal_Int16 nPos ) override;
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) override;
+ sal_Int16 SAL_CALL getItemCount( ) override;
+ OUString SAL_CALL getItem( sal_Int16 nPos ) override;
+ css::uno::Sequence< OUString > SAL_CALL getItems( ) override;
+ sal_Int16 SAL_CALL getDropDownLineCount( ) override;
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) override;
+
+ // XUnoControl
+ virtual sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel >& Model) override;
+
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL listItemRemoved( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL listItemModified( const css::awt::ItemListEvent& Event ) override;
+ virtual void SAL_CALL allItemsRemoved( const css::lang::EventObject& Event ) override;
+ virtual void SAL_CALL itemListChanged( const css::lang::EventObject& Event ) override;
+
+ // XItemListener
+ virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName( ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+private:
+ virtual void ImplSetPeerProperty( const OUString& rPropName, const css::uno::Any& rVal ) override;
+ virtual void updateFromModel() override;
+
+};
+
+
+
+class UnoSpinFieldControl : public UnoEditControl,
+ public css::awt::XSpinField
+{
+private:
+ SpinListenerMultiplexer maSpinListeners;
+ bool mbRepeat;
+
+public:
+ UnoSpinFieldControl();
+
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoEditControl::queryInterface(rType); }
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakAggObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+
+ // css::awt::XSpinField
+ void SAL_CALL addSpinListener( const css::uno::Reference< css::awt::XSpinListener >& l ) override;
+ void SAL_CALL removeSpinListener( const css::uno::Reference< css::awt::XSpinListener >& l ) override;
+ void SAL_CALL up() override;
+ void SAL_CALL down() override;
+ void SAL_CALL first() override;
+ void SAL_CALL last() override;
+ void SAL_CALL enableRepeat( sal_Bool bRepeat ) override;
+
+
+ // css::lang::XServiceInfo
+ // No service info, only base class for other fields.
+};
+
+
+
+class UnoControlDateFieldModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlDateFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlDateFieldModel( const UnoControlDateFieldModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlDateFieldModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoDateFieldControl final : public UnoSpinFieldControl,
+ public css::awt::XDateField
+{
+private:
+ css::util::Date mnFirst;
+ css::util::Date mnLast;
+ TriState mbLongFormat;
+public:
+ UnoDateFieldControl();
+ OUString GetComponentServiceName() const override;
+
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoSpinFieldControl::queryInterface(rType); }
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakAggObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+
+ // css::awt::XTextListener
+ void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override;
+
+ //XDateField
+ void SAL_CALL setDate( const css::util::Date& Date ) override;
+ css::util::Date SAL_CALL getDate( ) override;
+ void SAL_CALL setMin( const css::util::Date& Date ) override;
+ css::util::Date SAL_CALL getMin( ) override;
+ void SAL_CALL setMax( const css::util::Date& Date ) override;
+ css::util::Date SAL_CALL getMax( ) override;
+ void SAL_CALL setFirst( const css::util::Date& Date ) override;
+ css::util::Date SAL_CALL getFirst( ) override;
+ void SAL_CALL setLast( const css::util::Date& Date ) override;
+ css::util::Date SAL_CALL getLast( ) override;
+ void SAL_CALL setLongFormat( sal_Bool bLong ) override;
+ sal_Bool SAL_CALL isLongFormat( ) override;
+ void SAL_CALL setEmpty( ) override;
+ sal_Bool SAL_CALL isEmpty( ) override;
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) override;
+ sal_Bool SAL_CALL isStrictFormat( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoControlTimeFieldModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlTimeFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlTimeFieldModel( const UnoControlTimeFieldModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlTimeFieldModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoTimeFieldControl final : public UnoSpinFieldControl,
+ public css::awt::XTimeField
+{
+private:
+ css::util::Time mnFirst;
+ css::util::Time mnLast;
+
+public:
+ UnoTimeFieldControl();
+ OUString GetComponentServiceName() const override;
+
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoSpinFieldControl::queryInterface(rType); }
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakAggObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+
+ // css::awt::XTextListener
+ void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override;
+
+ //XTimeField
+ void SAL_CALL setTime( const css::util::Time& Time ) override;
+ css::util::Time SAL_CALL getTime( ) override;
+ void SAL_CALL setMin( const css::util::Time& Time ) override;
+ css::util::Time SAL_CALL getMin( ) override;
+ void SAL_CALL setMax( const css::util::Time& Time ) override;
+ css::util::Time SAL_CALL getMax( ) override;
+ void SAL_CALL setFirst( const css::util::Time& Time ) override;
+ css::util::Time SAL_CALL getFirst( ) override;
+ void SAL_CALL setLast( const css::util::Time& Time ) override;
+ css::util::Time SAL_CALL getLast( ) override;
+ void SAL_CALL setEmpty( ) override;
+ sal_Bool SAL_CALL isEmpty( ) override;
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) override;
+ sal_Bool SAL_CALL isStrictFormat( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoControlNumericFieldModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlNumericFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlNumericFieldModel( const UnoControlNumericFieldModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlNumericFieldModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoNumericFieldControl final : public UnoSpinFieldControl,
+ public css::awt::XNumericField
+{
+private:
+ double mnFirst;
+ double mnLast;
+
+public:
+ UnoNumericFieldControl();
+ OUString GetComponentServiceName() const override;
+
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoSpinFieldControl::queryInterface(rType); }
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakAggObject::release(); }
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XTextListener
+ void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override;
+
+ // css::awt::XNumericField
+ void SAL_CALL setValue( double Value ) override;
+ double SAL_CALL getValue( ) override;
+ void SAL_CALL setMin( double Value ) override;
+ double SAL_CALL getMin( ) override;
+ void SAL_CALL setMax( double Value ) override;
+ double SAL_CALL getMax( ) override;
+ void SAL_CALL setFirst( double Value ) override;
+ double SAL_CALL getFirst( ) override;
+ void SAL_CALL setLast( double Value ) override;
+ double SAL_CALL getLast( ) override;
+ void SAL_CALL setSpinSize( double Value ) override;
+ double SAL_CALL getSpinSize( ) override;
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override;
+ sal_Int16 SAL_CALL getDecimalDigits( ) override;
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) override;
+ sal_Bool SAL_CALL isStrictFormat( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoControlCurrencyFieldModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlCurrencyFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlCurrencyFieldModel( const UnoControlCurrencyFieldModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlCurrencyFieldModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoCurrencyFieldControl final : public UnoSpinFieldControl,
+ public css::awt::XCurrencyField
+{
+private:
+ double mnFirst;
+ double mnLast;
+
+public:
+ UnoCurrencyFieldControl();
+ OUString GetComponentServiceName() const override;
+
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoSpinFieldControl::queryInterface(rType); }
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakAggObject::release(); }
+
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XTextListener
+ void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override;
+
+ // css::awt::XCurrencyField
+ void SAL_CALL setValue( double Value ) override;
+ double SAL_CALL getValue( ) override;
+ void SAL_CALL setMin( double Value ) override;
+ double SAL_CALL getMin( ) override;
+ void SAL_CALL setMax( double Value ) override;
+ double SAL_CALL getMax( ) override;
+ void SAL_CALL setFirst( double Value ) override;
+ double SAL_CALL getFirst( ) override;
+ void SAL_CALL setLast( double Value ) override;
+ double SAL_CALL getLast( ) override;
+ void SAL_CALL setSpinSize( double Value ) override;
+ double SAL_CALL getSpinSize( ) override;
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override;
+ sal_Int16 SAL_CALL getDecimalDigits( ) override;
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) override;
+ sal_Bool SAL_CALL isStrictFormat( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoControlPatternFieldModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlPatternFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlPatternFieldModel( const UnoControlPatternFieldModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlPatternFieldModel( *this ); }
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoPatternFieldControl final : public UnoSpinFieldControl,
+ public css::awt::XPatternField
+{
+ void ImplSetPeerProperty( const OUString& rPropName, const css::uno::Any& rVal ) override;
+
+public:
+ UnoPatternFieldControl();
+ OUString GetComponentServiceName() const override;
+
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoSpinFieldControl::queryInterface(rType); }
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakAggObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XPatternField
+ void SAL_CALL setMasks( const OUString& EditMask, const OUString& LiteralMask ) override;
+ void SAL_CALL getMasks( OUString& EditMask, OUString& LiteralMask ) override;
+ void SAL_CALL setString( const OUString& Str ) override;
+ OUString SAL_CALL getString( ) override;
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) override;
+ sal_Bool SAL_CALL isStrictFormat( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoControlProgressBarModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlProgressBarModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlProgressBarModel( const UnoControlProgressBarModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlProgressBarModel( *this ); }
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoProgressBarControl final : public UnoControlBase,
+ public css::awt::XProgressBar
+{
+public:
+ UnoProgressBarControl();
+ OUString GetComponentServiceName() const override;
+
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoControlBase::queryInterface(rType); }
+ css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakAggObject::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XProgressBar
+ void SAL_CALL setForegroundColor( sal_Int32 nColor ) override;
+ void SAL_CALL setBackgroundColor( sal_Int32 nColor ) override;
+ void SAL_CALL setValue( sal_Int32 nValue ) override;
+ void SAL_CALL setRange( sal_Int32 nMin, sal_Int32 nMax ) override;
+ sal_Int32 SAL_CALL getValue() override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoControlFixedLineModel final : public UnoControlModel
+{
+ css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ UnoControlFixedLineModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ UnoControlFixedLineModel( const UnoControlFixedLineModel& rModel ) : UnoControlModel( rModel ) {}
+
+ rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlFixedLineModel( *this ); }
+
+ // css::beans::XMultiPropertySet
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // css::io::XPersistObject
+ OUString SAL_CALL getServiceName() override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+
+class UnoFixedLineControl final : public UnoControlBase
+{
+public:
+ UnoFixedLineControl();
+ OUString GetComponentServiceName() const override;
+
+ sal_Bool SAL_CALL isTransparent( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+
+#endif // INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/dllapi.h b/include/toolkit/dllapi.h
new file mode 100644
index 000000000..3b61a68c5
--- /dev/null
+++ b/include/toolkit/dllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_DLLAPI_H
+#define INCLUDED_TOOLKIT_DLLAPI_H
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined TOOLKIT_DLLIMPLEMENTATION
+#define TOOLKIT_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define TOOLKIT_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/helper/accessiblefactory.hxx b/include/toolkit/helper/accessiblefactory.hxx
new file mode 100644
index 000000000..bd7ae9097
--- /dev/null
+++ b/include/toolkit/helper/accessiblefactory.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_HELPER_ACCESSIBLEFACTORY_HXX
+#define INCLUDED_TOOLKIT_HELPER_ACCESSIBLEFACTORY_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+namespace com::sun::star::accessibility {
+ class XAccessible;
+ class XAccessibleContext;
+}
+class SVTXNumericField;
+class VCLXButton;
+class VCLXCheckBox;
+class VCLXRadioButton;
+class VCLXListBox;
+class VCLXFixedHyperlink;
+class VCLXFixedText;
+class VCLXScrollBar;
+class VCLXEdit;
+class VCLXComboBox;
+class VCLXToolBox;
+class VCLXHeaderBar;
+class VCLXWindow;
+class Menu;
+
+
+namespace toolkit
+{
+
+
+ /** a function which is able to create a factory for the standard Accessible/Context
+ components needed for standard toolkit controls
+
+ The returned pointer denotes an instance of the IAccessibleFactory, which has been acquired
+ <em>once</em>. The caller is responsible for holding this reference as long as it needs the
+ factory, and release it afterwards.
+ */
+ typedef void* (* GetStandardAccComponentFactory)( );
+
+
+ //= IAccessibleFactory
+
+ class IAccessibleFactory : public virtual salhelper::SimpleReferenceObject
+ {
+ public:
+ /** creates an accessible context for a button window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXButton* _pXWindow ) = 0;
+
+ /** creates an accessible context for a checkbox window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXCheckBox* _pXWindow ) = 0;
+
+ /** creates an accessible context for a radio button window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXRadioButton* _pXWindow ) = 0;
+
+ /** creates an accessible context for a listbox window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXListBox* _pXWindow ) = 0;
+
+ /** creates an accessible context for a fixed hyperlink window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXFixedHyperlink* _pXWindow ) = 0;
+
+ /** creates an accessible context for a fixed text window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXFixedText* _pXWindow ) = 0;
+
+ /** creates an accessible context for a scrollbar window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXScrollBar* _pXWindow ) = 0;
+
+ /** creates an accessible context for an edit window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXEdit* _pXWindow ) = 0;
+
+ /** creates an accessible context for a combo box window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXComboBox* _pXWindow ) = 0;
+
+ /** creates an accessible context for a toolbox window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXToolBox* _pXWindow ) = 0;
+
+ /** creates an accessible context for a headerbar window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXHeaderBar* _pXWindow ) = 0;
+
+ /** creates an accessible context for a numeric field
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( SVTXNumericField* _pXWindow ) = 0;
+
+ /** creates an accessible context for a generic window
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXWindow* _pXWindow ) = 0;
+
+ /** creates an accessible component for the given menu
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ createAccessible( Menu* _pMenu, bool _bIsMenuBar ) = 0;
+
+ protected:
+ virtual ~IAccessibleFactory() override {}
+ };
+
+
+} // namespace toolkit
+
+
+#endif // INCLUDED_TOOLKIT_HELPER_ACCESSIBLEFACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/helper/convert.hxx b/include/toolkit/helper/convert.hxx
new file mode 100644
index 000000000..3e4d23696
--- /dev/null
+++ b/include/toolkit/helper/convert.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_HELPER_CONVERT_HXX
+#define INCLUDED_TOOLKIT_HELPER_CONVERT_HXX
+
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/Point.hpp>
+
+#include <tools/gen.hxx>
+
+inline css::awt::Size AWTSize( const Size& rVCLSize )
+{
+ return css::awt::Size( rVCLSize.Width(), rVCLSize.Height() );
+}
+
+inline ::Size VCLSize( const css::awt::Size& rAWTSize )
+{
+ return ::Size( rAWTSize.Width, rAWTSize.Height );
+}
+
+inline css::awt::Point AWTPoint( const ::Point& rVCLPoint )
+{
+ return css::awt::Point( rVCLPoint.X(), rVCLPoint.Y() );
+}
+
+inline ::Point VCLPoint( const css::awt::Point& rAWTPoint )
+{
+ return ::Point( rAWTPoint.X, rAWTPoint.Y );
+}
+
+inline css::awt::Rectangle AWTRectangle( const ::tools::Rectangle& rVCLRect )
+{
+ return css::awt::Rectangle( rVCLRect.Left(), rVCLRect.Top(), rVCLRect.GetWidth(), rVCLRect.GetHeight() );
+}
+
+inline ::tools::Rectangle VCLRectangle( const css::awt::Rectangle& rAWTRect )
+{
+ return ::tools::Rectangle( ::Point( rAWTRect.X, rAWTRect.Y ), ::Size( rAWTRect.Width, rAWTRect.Height ) );
+}
+
+#endif // INCLUDED_TOOLKIT_HELPER_CONVERT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/helper/emptyfontdescriptor.hxx b/include/toolkit/helper/emptyfontdescriptor.hxx
new file mode 100644
index 000000000..77ac9a1d1
--- /dev/null
+++ b/include/toolkit/helper/emptyfontdescriptor.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+
+class EmptyFontDescriptor : public css::awt::FontDescriptor
+{
+public:
+ EmptyFontDescriptor()
+ {
+ // Not all enums are initialized correctly in FontDescriptor-CTOR because
+ // they are set to the first enum value, this is not always the default value.
+ Slant = css::awt::FontSlant_DONTKNOW;
+ Underline = css::awt::FontUnderline::DONTKNOW;
+ Strikeout = css::awt::FontStrikeout::DONTKNOW;
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/helper/formpdfexport.hxx b/include/toolkit/helper/formpdfexport.hxx
new file mode 100644
index 000000000..d1aa35ebf
--- /dev/null
+++ b/include/toolkit/helper/formpdfexport.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_HELPER_FORMPDFEXPORT_HXX
+#define INCLUDED_TOOLKIT_HELPER_FORMPDFEXPORT_HXX
+
+#include <toolkit/dllapi.h>
+
+#include <vcl/pdfwriter.hxx>
+
+#include <memory>
+
+namespace com::sun::star::awt { class XControl; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+
+namespace vcl
+{
+ class PDFExtOutDevData;
+}
+
+
+namespace toolkitform
+{
+
+
+ /** creates a PDF compatible control descriptor for the given control
+ */
+ std::unique_ptr<vcl::PDFWriter::AnyWidget> TOOLKIT_DLLPUBLIC describePDFControl(
+ const css::uno::Reference< css::awt::XControl >& _rxControl,
+ vcl::PDFExtOutDevData& i_pdfExportData
+ );
+
+
+} // namespace toolkitform
+
+
+#endif // INCLUDED_TOOLKIT_HELPER_FORMPDFEXPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/helper/listenermultiplexer.hxx b/include/toolkit/helper/listenermultiplexer.hxx
new file mode 100644
index 000000000..b562e9e28
--- /dev/null
+++ b/include/toolkit/helper/listenermultiplexer.hxx
@@ -0,0 +1,273 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX
+#define INCLUDED_TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX
+
+#include <config_options.h>
+#include <toolkit/dllapi.h>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/awt/XWindowListener.hpp>
+#include <com/sun/star/awt/XVclContainerListener.hpp>
+#include <com/sun/star/awt/XKeyListener.hpp>
+#include <com/sun/star/awt/XMouseListener.hpp>
+#include <com/sun/star/awt/XMouseMotionListener.hpp>
+#include <com/sun/star/awt/XPaintListener.hpp>
+#include <com/sun/star/awt/XTopWindowListener.hpp>
+#include <com/sun/star/awt/XTextListener.hpp>
+#include <com/sun/star/awt/XActionListener.hpp>
+#include <com/sun/star/awt/XItemListener.hpp>
+#include <com/sun/star/awt/XTabListener.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/awt/XSpinListener.hpp>
+#include <com/sun/star/awt/XAdjustmentListener.hpp>
+#include <com/sun/star/awt/XMenuListener.hpp>
+#include <com/sun/star/awt/tree/XTreeExpansionListener.hpp>
+#include <com/sun/star/awt/tree/XTreeEditListener.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/weak.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainerListener.hpp>
+
+// class ListenerMultiplexerBase
+
+template <class ListenerT>
+class UNLESS_MERGELIBS(TOOLKIT_DLLPUBLIC) ListenerMultiplexerBase : public cppu::BaseMutex,
+ public ::comphelper::OInterfaceContainerHelper3<ListenerT>,
+ public css::uno::XInterface
+{
+private:
+ ::cppu::OWeakObject& mrContext;
+
+protected:
+ ::cppu::OWeakObject& GetContext() { return mrContext; }
+
+public:
+ ListenerMultiplexerBase( ::cppu::OWeakObject& rSource )
+ : ::comphelper::OInterfaceContainerHelper3<ListenerT>(m_aMutex), mrContext(rSource)
+ {
+ }
+
+ virtual ~ListenerMultiplexerBase()
+ {
+ }
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface(const css::uno::Type & rType) override
+ {
+ return ::cppu::queryInterface(rType, static_cast<css::uno::XInterface*>(this));
+ }
+
+ void SAL_CALL acquire() noexcept override { mrContext.acquire(); }
+ void SAL_CALL release() noexcept override { mrContext.release(); }
+};
+
+// class EventListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( EventListenerMultiplexer, css::lang::XEventListener )
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class FocusListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( FocusListenerMultiplexer, css::awt::XFocusListener )
+ void SAL_CALL focusGained( const css::awt::FocusEvent& e ) override;
+ void SAL_CALL focusLost( const css::awt::FocusEvent& e ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class WindowListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( WindowListenerMultiplexer, css::awt::XWindowListener )
+ void SAL_CALL windowResized( const css::awt::WindowEvent& e ) override;
+ void SAL_CALL windowMoved( const css::awt::WindowEvent& e ) override;
+ void SAL_CALL windowShown( const css::lang::EventObject& e ) override;
+ void SAL_CALL windowHidden( const css::lang::EventObject& e ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class VclContainerListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( VclContainerListenerMultiplexer, css::awt::XVclContainerListener )
+ void SAL_CALL windowAdded( const css::awt::VclContainerEvent& e ) override;
+ void SAL_CALL windowRemoved( const css::awt::VclContainerEvent& e ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class KeyListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( KeyListenerMultiplexer, css::awt::XKeyListener )
+ void SAL_CALL keyPressed( const css::awt::KeyEvent& e ) override;
+ void SAL_CALL keyReleased( const css::awt::KeyEvent& e ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class MouseListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseListenerMultiplexer, css::awt::XMouseListener )
+ void SAL_CALL mousePressed( const css::awt::MouseEvent& e ) override;
+ void SAL_CALL mouseReleased( const css::awt::MouseEvent& e ) override;
+ void SAL_CALL mouseEntered( const css::awt::MouseEvent& e ) override;
+ void SAL_CALL mouseExited( const css::awt::MouseEvent& e ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class MouseMotionListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseMotionListenerMultiplexer, css::awt::XMouseMotionListener )
+ void SAL_CALL mouseDragged( const css::awt::MouseEvent& e ) override;
+ void SAL_CALL mouseMoved( const css::awt::MouseEvent& e ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class PaintListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( PaintListenerMultiplexer, css::awt::XPaintListener )
+ void SAL_CALL windowPaint( const css::awt::PaintEvent& e ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class TopWindowListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( TopWindowListenerMultiplexer, css::awt::XTopWindowListener )
+ void SAL_CALL windowOpened( const css::lang::EventObject& e ) override;
+ void SAL_CALL windowClosing( const css::lang::EventObject& e ) override;
+ void SAL_CALL windowClosed( const css::lang::EventObject& e ) override;
+ void SAL_CALL windowMinimized( const css::lang::EventObject& e ) override;
+ void SAL_CALL windowNormalized( const css::lang::EventObject& e ) override;
+ void SAL_CALL windowActivated( const css::lang::EventObject& e ) override;
+ void SAL_CALL windowDeactivated( const css::lang::EventObject& e ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class TextListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( TextListenerMultiplexer, css::awt::XTextListener )
+ void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class ActionListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( ActionListenerMultiplexer, css::awt::XActionListener )
+ void SAL_CALL actionPerformed( const css::awt::ActionEvent& rEvent ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class ItemListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( ItemListenerMultiplexer, css::awt::XItemListener )
+ void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class TabListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( TabListenerMultiplexer, css::awt::XTabListener )
+ void SAL_CALL inserted( ::sal_Int32 ID ) override;
+ void SAL_CALL removed( ::sal_Int32 ID ) override;
+ void SAL_CALL changed( ::sal_Int32 ID, const css::uno::Sequence< css::beans::NamedValue >& Properties ) override;
+ void SAL_CALL activated( ::sal_Int32 ID ) override;
+ void SAL_CALL deactivated( ::sal_Int32 ID ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class ContainerListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer, css::container::XContainerListener )
+ void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override;
+ void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override;
+ void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class SpinListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( SpinListenerMultiplexer, css::awt::XSpinListener )
+ void SAL_CALL up( const css::awt::SpinEvent& rEvent ) override;
+ void SAL_CALL down( const css::awt::SpinEvent& rEvent ) override;
+ void SAL_CALL first( const css::awt::SpinEvent& rEvent ) override;
+ void SAL_CALL last( const css::awt::SpinEvent& rEvent ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class AdjustmentListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( AdjustmentListenerMultiplexer, css::awt::XAdjustmentListener )
+ void SAL_CALL adjustmentValueChanged( const css::awt::AdjustmentEvent& rEvent ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class MenuListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer, css::awt::XMenuListener )
+ void SAL_CALL itemHighlighted( const css::awt::MenuEvent& rEvent ) override;
+ void SAL_CALL itemSelected( const css::awt::MenuEvent& rEvent ) override;
+ void SAL_CALL itemActivated( const css::awt::MenuEvent& rEvent ) override;
+ void SAL_CALL itemDeactivated( const css::awt::MenuEvent& rEvent ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class TreeSelectionListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( TreeSelectionListenerMultiplexer, css::view::XSelectionChangeListener )
+ virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class TreeExpansionListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( TreeExpansionListenerMultiplexer, css::awt::tree::XTreeExpansionListener )
+ virtual void SAL_CALL requestChildNodes( const css::awt::tree::TreeExpansionEvent& aEvent ) override;
+ virtual void SAL_CALL treeExpanding( const css::awt::tree::TreeExpansionEvent& aEvent ) override;
+ virtual void SAL_CALL treeCollapsing( const css::awt::tree::TreeExpansionEvent& aEvent ) override;
+ virtual void SAL_CALL treeExpanded( const css::awt::tree::TreeExpansionEvent& aEvent ) override;
+ virtual void SAL_CALL treeCollapsed( const css::awt::tree::TreeExpansionEvent& aEvent ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class TreeEditListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( TreeEditListenerMultiplexer, css::awt::tree::XTreeEditListener )
+ virtual void SAL_CALL nodeEditing( const css::uno::Reference< css::awt::tree::XTreeNode >& Node ) override;
+ virtual void SAL_CALL nodeEdited( const css::uno::Reference< css::awt::tree::XTreeNode >& Node, const OUString& NewText ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class SelectionListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, css::awt::grid::XGridSelectionListener )
+ void SAL_CALL selectionChanged( const css::awt::grid::GridSelectionEvent& aEvent ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+
+// class TabPageListenerMultiplexer
+
+DECL_LISTENERMULTIPLEXER_START( TabPageListenerMultiplexer, css::awt::tab::XTabPageContainerListener )
+ void SAL_CALL tabPageActivated( const css::awt::tab::TabPageActivatedEvent& aEvent ) override;
+DECL_LISTENERMULTIPLEXER_END
+
+#endif // INCLUDED_TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/helper/macros.hxx b/include/toolkit/helper/macros.hxx
new file mode 100644
index 000000000..225178c71
--- /dev/null
+++ b/include/toolkit/helper/macros.hxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_HELPER_MACROS_HXX
+#define INCLUDED_TOOLKIT_HELPER_MACROS_HXX
+
+#include <sal/log.hxx>
+#include <osl/diagnose.h>
+#include <tools/diagnose_ex.h>
+
+#define IMPL_IMPLEMENTATION_ID( ClassName ) \
+css::uno::Sequence< sal_Int8 > ClassName::getImplementationId() \
+{ \
+ return css::uno::Sequence<sal_Int8>(); \
+}
+
+
+#define DECL_LISTENERMULTIPLEXER_START( ClassName, InterfaceName ) \
+class ClassName final : public ListenerMultiplexerBase<InterfaceName>, public InterfaceName \
+{ \
+public: \
+ ClassName( ::cppu::OWeakObject& rSource ); \
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; \
+ void SAL_CALL acquire() noexcept override; \
+ void SAL_CALL release() noexcept override; \
+ void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+
+#define DECL_LISTENERMULTIPLEXER_START_DLLPUB( ClassName, InterfaceName ) \
+class TOOLKIT_DLLPUBLIC ClassName final : public ListenerMultiplexerBase<InterfaceName>, public InterfaceName \
+{ \
+public: \
+ ClassName( ::cppu::OWeakObject& rSource ); \
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; \
+ void SAL_CALL acquire() noexcept override; \
+ void SAL_CALL release() noexcept override; \
+ void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+
+#define DECL_LISTENERMULTIPLEXER_END \
+};
+
+
+#define IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ClassName, InterfaceName ) \
+ClassName::ClassName( ::cppu::OWeakObject& rSource ) \
+ : ListenerMultiplexerBase<InterfaceName>(rSource) \
+{ \
+} \
+void SAL_CALL ClassName::acquire() noexcept { ListenerMultiplexerBase::acquire(); } \
+void SAL_CALL ClassName::release() noexcept { ListenerMultiplexerBase::release(); } \
+css::uno::Any ClassName::queryInterface( const css::uno::Type & rType ) \
+{ \
+ css::uno::Any aRet = ::cppu::queryInterface( rType, \
+ (static_cast< css::lang::XEventListener* >(this)), \
+ (static_cast< InterfaceName* >(this)) ); \
+ return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType )); \
+} \
+void ClassName::disposing( const css::lang::EventObject& ) \
+{ \
+}
+
+
+#if OSL_DEBUG_LEVEL > 0
+ #define DISPLAY_EXCEPTION( ClassName, MethodName ) \
+ css::uno::Any ex( cppu::getCaughtException() ); \
+ SAL_WARN( "toolkit", #ClassName "::" #MethodName ": caught an exception! " << exceptionToString(ex));
+#else
+ #define DISPLAY_EXCEPTION( ClassName, MethodName )
+#endif
+
+#define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( ClassName, InterfaceName, MethodName, ParamType1 ) \
+{ \
+ ParamType1 aMulti( evt ); \
+ ::comphelper::OInterfaceIteratorHelper3 aIt(*this); \
+ while( aIt.hasMoreElements() ) \
+ { \
+ css::uno::Reference<InterfaceName> xListener(aIt.next()); \
+ try \
+ { \
+ xListener->MethodName( aMulti ); \
+ } \
+ catch(const css::lang::DisposedException& e) \
+ { \
+ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
+ if ( e.Context == xListener || !e.Context.is() ) \
+ aIt.remove(); \
+ } \
+ catch(const css::uno::RuntimeException&) \
+ { \
+ DISPLAY_EXCEPTION( ClassName, MethodName ) \
+ } \
+ } \
+}
+
+#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) \
+{ \
+ EventType aMulti( evt ); \
+ aMulti.Source = &GetContext(); \
+ ::comphelper::OInterfaceIteratorHelper3 aIt(*this); \
+ while( aIt.hasMoreElements() ) \
+ { \
+ css::uno::Reference<InterfaceName> xListener(aIt.next()); \
+ try \
+ { \
+ xListener->MethodName( aMulti ); \
+ } \
+ catch(const css::lang::DisposedException& e) \
+ { \
+ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
+ if ( e.Context == xListener || !e.Context.is() ) \
+ aIt.remove(); \
+ } \
+ catch(const css::uno::RuntimeException&) \
+ { \
+ DISPLAY_EXCEPTION( ClassName, MethodName ) \
+ } \
+ } \
+}
+
+#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( ClassName, InterfaceName, MethodName, EventType, Exception ) \
+void ClassName::MethodName( const EventType& evt ) \
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType )
+
+#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ClassName, InterfaceName, MethodName, EventType ) \
+void ClassName::MethodName( const EventType& evt ) \
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType )
+
+#define DECLIMPL_SERVICEINFO_DERIVED( ImplName, BaseClass, ServiceName ) \
+ OUString SAL_CALL getImplementationName( ) override { return "stardiv.Toolkit." #ImplName; } \
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override \
+ { \
+ css::uno::Sequence< OUString > aNames = BaseClass::getSupportedServiceNames( ); \
+ aNames.realloc( aNames.getLength() + 1 ); \
+ aNames.getArray()[ aNames.getLength() - 1 ] = ServiceName; \
+ return aNames; \
+ } \
+
+#endif // INCLUDED_TOOLKIT_HELPER_MACROS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/helper/mutexandbroadcasthelper.hxx b/include/toolkit/helper/mutexandbroadcasthelper.hxx
new file mode 100644
index 000000000..4cc98e6a9
--- /dev/null
+++ b/include/toolkit/helper/mutexandbroadcasthelper.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX
+#define INCLUDED_TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX
+
+#include <cppuhelper/interfacecontainer.h>
+
+
+// Helper class with Mutex and BroadcastHelper, because they must be
+// initialized before calling the OPropertySetHelper-CTOR
+
+class MutexAndBroadcastHelper
+{
+public:
+ MutexAndBroadcastHelper() : BrdcstHelper( Mutex ) {}
+
+ ::osl::Mutex Mutex;
+ ::cppu::OBroadcastHelper BrdcstHelper;
+
+ ::osl::Mutex& GetMutex() { return Mutex; }
+ ::cppu::OBroadcastHelper& GetBroadcastHelper() { return BrdcstHelper; }
+};
+
+#endif // _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/helper/property.hxx b/include/toolkit/helper/property.hxx
new file mode 100644
index 000000000..4a8fe2385
--- /dev/null
+++ b/include/toolkit/helper/property.hxx
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_HELPER_PROPERTY_HXX
+#define INCLUDED_TOOLKIT_HELPER_PROPERTY_HXX
+
+#include <toolkit/dllapi.h>
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::uno {
+ class Type;
+ class Any;
+}
+
+
+#define BASEPROPERTY_NOTFOUND 0
+
+#define BASEPROPERTY_TEXT 1 // OUString
+#define BASEPROPERTY_BACKGROUNDCOLOR 2 // sal_Int32
+#define BASEPROPERTY_FILLCOLOR 3 // sal_Int32
+#define BASEPROPERTY_TEXTCOLOR 4 // sal_Int32
+#define BASEPROPERTY_LINECOLOR 5 // sal_Int32
+#define BASEPROPERTY_BORDER 6 // sal_Int16
+#define BASEPROPERTY_ALIGN 7 // sal_Int16
+#define BASEPROPERTY_FONTDESCRIPTOR 8 // css::awt::FontDescriptor
+#define BASEPROPERTY_DROPDOWN 9 // sal_Bool
+#define BASEPROPERTY_MULTILINE 10 // sal_Bool
+#define BASEPROPERTY_STRINGITEMLIST 11 // UStringSequence
+#define BASEPROPERTY_HSCROLL 12 // sal_Bool
+#define BASEPROPERTY_VSCROLL 13 // sal_Bool
+#define BASEPROPERTY_TABSTOP 14 // sal_Bool
+#define BASEPROPERTY_STATE 15 // sal_Int16
+#define BASEPROPERTY_FONT_TYPE 16 // OLD: Font_Type
+#define BASEPROPERTY_FONT_SIZE 17 // OLD: Font_Size
+#define BASEPROPERTY_FONT_ATTRIBS 18 // OLD: Font_Attribs
+#define BASEPROPERTY_DEFAULTCONTROL 19 // OUString (ServiceName)
+#define BASEPROPERTY_LABEL 20 // OUString
+#define BASEPROPERTY_LINECOUNT 21 // sal_Int16
+#define BASEPROPERTY_EXTDATEFORMAT 22 // sal_Int16
+#define BASEPROPERTY_DATESHOWCENTURY 23 // sal_Bool
+#define BASEPROPERTY_EXTTIMEFORMAT 24 // sal_Int16
+#define BASEPROPERTY_NUMSHOWTHOUSANDSEP 25 // sal_Bool
+#define BASEPROPERTY_CURRENCYSYMBOL 26 // OUString
+#define BASEPROPERTY_SPIN 27 // sal_Bool
+#define BASEPROPERTY_STRICTFORMAT 28 // sal_Bool
+#define BASEPROPERTY_DECIMALACCURACY 29 // sal_Int16
+#define BASEPROPERTY_DATE 30 // css::util::Date
+#define BASEPROPERTY_DATEMIN 31 // css::util::Date
+#define BASEPROPERTY_DATEMAX 32 // css::util::Date
+#define BASEPROPERTY_TIME 33 // css::util::Time
+#define BASEPROPERTY_TIMEMIN 34 // css::util::Time
+#define BASEPROPERTY_TIMEMAX 35 // css::util::Time
+#define BASEPROPERTY_VALUE_INT32 36 // sal_Int32
+#define BASEPROPERTY_VALUEMIN_INT32 37 // sal_Int32
+#define BASEPROPERTY_VALUEMAX_INT32 38 // sal_Int32
+#define BASEPROPERTY_VALUESTEP_INT32 39 // sal_Int32
+#define BASEPROPERTY_EDITMASK 40 // OUString
+#define BASEPROPERTY_LITERALMASK 41 // OUString
+#define BASEPROPERTY_IMAGEURL 42 // OUString
+#define BASEPROPERTY_READONLY 43 // sal_Bool
+#define BASEPROPERTY_ENABLED 44 // sal_Bool
+#define BASEPROPERTY_PRINTABLE 45 // sal_Bool
+#define BASEPROPERTY_ECHOCHAR 46 // sal_Int16
+#define BASEPROPERTY_MAXTEXTLEN 47 // sal_Int16
+#define BASEPROPERTY_HARDLINEBREAKS 48 // sal_Int16
+#define BASEPROPERTY_AUTOCOMPLETE 49 // sal_Bool
+#define BASEPROPERTY_MULTISELECTION 50 // sal_Bool
+#define BASEPROPERTY_SELECTEDITEMS 51 // INT16Sequence
+#define BASEPROPERTY_VALUE_DOUBLE 52 // DOUBLE
+#define BASEPROPERTY_VALUEMIN_DOUBLE 53 // DOUBLE
+#define BASEPROPERTY_VALUEMAX_DOUBLE 54 // DOUBLE
+#define BASEPROPERTY_VALUESTEP_DOUBLE 55 // DOUBLE
+#define BASEPROPERTY_TRISTATE 56 // sal_Bool
+#define BASEPROPERTY_DEFAULTBUTTON 57 // sal_Bool
+#define BASEPROPERTY_HELPURL 58 // OUString
+#define BASEPROPERTY_AUTOTOGGLE 59 // sal_Bool
+//#define BASEPROPERTY_FOCUSSELECTIONHIDE 60 // sal_Bool
+#define BASEPROPERTY_FORMATKEY 61 // sal_Bool
+#define BASEPROPERTY_FORMATSSUPPLIER 62 // css::util::XNumberFormatsSupplier
+#define BASEPROPERTY_EFFECTIVE_VALUE 63 // Any (double or string)
+#define BASEPROPERTY_TREATASNUMBER 64 // sal_Bool
+#define BASEPROPERTY_EFFECTIVE_DEFAULT 65 // Any (double or string)
+#define BASEPROPERTY_EFFECTIVE_MIN 66 // Double
+#define BASEPROPERTY_EFFECTIVE_MAX 67 // Double
+#define BASEPROPERTY_CURSYM_POSITION 68 // sal_Bool
+#define BASEPROPERTY_TITLE 69 // OUString
+#define BASEPROPERTY_MOVEABLE 70 // sal_Bool
+#define BASEPROPERTY_CLOSEABLE 71 // sal_Bool
+#define BASEPROPERTY_SIZEABLE 72 // sal_Bool
+#define BASEPROPERTY_HELPTEXT 73 // OUString
+#define BASEPROPERTY_PROGRESSVALUE 74 // sal_Int32
+#define BASEPROPERTY_PROGRESSVALUE_MIN 75 // sal_Int32
+#define BASEPROPERTY_PROGRESSVALUE_MAX 76 // sal_Int32
+#define BASEPROPERTY_SCROLLVALUE 77 // sal_Int32
+#define BASEPROPERTY_SCROLLVALUE_MAX 78 // sal_Int32
+#define BASEPROPERTY_LINEINCREMENT 79 // sal_Int32
+#define BASEPROPERTY_BLOCKINCREMENT 80 // sal_Int32
+#define BASEPROPERTY_VISIBLESIZE 81 // sal_Int32
+#define BASEPROPERTY_ORIENTATION 82 // sal_Int32
+#define BASEPROPERTY_FONTRELIEF 83 // sal_Int16
+#define BASEPROPERTY_FONTEMPHASISMARK 84 // sal_Int16
+#define BASEPROPERTY_TEXTLINECOLOR 85 // sal_Int32
+#define BASEPROPERTY_IMAGEALIGN 86 // sal_Int16
+#define BASEPROPERTY_SCALEIMAGE 87 // sal_Bool
+#define BASEPROPERTY_PUSHBUTTONTYPE 88 // sal_Int16
+#define BASEPROPERTY_DISPLAYBACKGROUNDCOLOR 89 // sal_Int32
+#define BASEPROPERTY_AUTOMNEMONICS 90 // sal_Bool
+#define BASEPROPERTY_MOUSETRANSPARENT 91 // sal_Bool
+#define BASEPROPERTY_ACCESSIBLENAME 92 // OUString
+#define BASEPROPERTY_PLUGINPARENT 93 // sal_Int64
+#define BASEPROPERTY_SCROLLVALUE_MIN 94 // sal_Int32
+#define BASEPROPERTY_REPEAT_DELAY 95 // sal_Int32
+#define BASEPROPERTY_SYMBOL_COLOR 96 // sal_Int32
+#define BASEPROPERTY_SPINVALUE 97 // sal_Int32
+#define BASEPROPERTY_SPINVALUE_MIN 98 // sal_Int32
+#define BASEPROPERTY_SPINVALUE_MAX 99 // sal_Int32
+#define BASEPROPERTY_SPININCREMENT 100 // sal_Int32
+#define BASEPROPERTY_REPEAT 101 // sal_Bool
+#define BASEPROPERTY_ENFORCE_FORMAT 102 // sal_Bool
+#define BASEPROPERTY_LIVE_SCROLL 103 // sal_Bool
+#define BASEPROPERTY_LINE_END_FORMAT 104 // sal_Int16
+#define BASEPROPERTY_ACTIVATED 105 // sal Bool
+#define BASEPROPERTY_COMPLETE 106 // sal_Bool
+#define BASEPROPERTY_CURRENTITEMID 107 // sal_Int16
+#define BASEPROPERTY_TOGGLE 108 // sal_Bool
+#define BASEPROPERTY_FOCUSONCLICK 109 // sal_Bool
+#define BASEPROPERTY_HIDEINACTIVESELECTION 110 // sal_Bool
+#define BASEPROPERTY_VISUALEFFECT 111 // sal_Int16
+#define BASEPROPERTY_BORDERCOLOR 112 // sal_Int32
+#define BASEPROPERTY_IMAGEPOSITION 113 // sal_Int16
+#define BASEPROPERTY_NATIVE_WIDGET_LOOK 114 // sal_Bool
+#define BASEPROPERTY_VERTICALALIGN 115 // VerticalAlignment
+#define BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR 116 // sal_Int16
+#define BASEPROPERTY_GRAPHIC 117 // css.graphic.XGraphic
+#define BASEPROPERTY_STEP_TIME 118 // sal_Int32
+#define BASEPROPERTY_DECORATION 119 // sal_Bool
+#define BASEPROPERTY_PAINTTRANSPARENT 120 // sal_Bool
+#define BASEPROPERTY_AUTOHSCROLL 121 // sal_Bool
+#define BASEPROPERTY_AUTOVSCROLL 122 // sal_Bool
+#define BASEPROPERTY_DESKTOP_AS_PARENT 123 // sal_Bool
+#define BASEPROPERTY_TREE_START 124
+#define BASEPROPERTY_TREE_SELECTIONTYPE 124
+#define BASEPROPERTY_TREE_EDITABLE 125
+#define BASEPROPERTY_TREE_DATAMODEL 126
+#define BASEPROPERTY_TREE_ROOTDISPLAYED 127
+#define BASEPROPERTY_TREE_SHOWSHANDLES 128
+#define BASEPROPERTY_TREE_SHOWSROOTHANDLES 129
+#define BASEPROPERTY_ROW_HEIGHT 130
+#define BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING 131
+#define BASEPROPERTY_TREE_END 131
+#define BASEPROPERTY_DIALOGSOURCEURL 132
+#define BASEPROPERTY_NOLABEL 133 // OUString added for issue79712
+#define BASEPROPERTY_URL 134 // OUString
+#define BASEPROPERTY_UNIT 135 // ::awt::FieldUnit
+#define BASEPROPERTY_CUSTOMUNITTEXT 136 // OUString
+#define BASEPROPERTY_IMAGE_SCALE_MODE 137
+#define BASEPROPERTY_WRITING_MODE 138
+#define BASEPROPERTY_CONTEXT_WRITING_MODE 139
+#define BASEPROPERTY_GRID_SHOWROWHEADER 140
+#define BASEPROPERTY_GRID_SHOWCOLUMNHEADER 141
+#define BASEPROPERTY_GRID_DATAMODEL 142
+#define BASEPROPERTY_GRID_COLUMNMODEL 143
+#define BASEPROPERTY_GRID_SELECTIONMODE 144
+#define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool
+#define BASEPROPERTY_REFERENCE_DEVICE 146
+
+#define BASEPROPERTY_HIGHCONTRASTMODE 147
+#define BASEPROPERTY_GRID_HEADER_BACKGROUND 148
+#define BASEPROPERTY_GRID_HEADER_TEXT_COLOR 149
+#define BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS 150
+#define BASEPROPERTY_GRID_LINE_COLOR 151
+#define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152
+#define BASEPROPERTY_ITEM_SEPARATOR_POS 153
+#define BASEPROPERTY_GROUPNAME 154 // OUString
+#define BASEPROPERTY_MULTIPAGEVALUE 155 // sal_Int32
+#define BASEPROPERTY_USERFORMCONTAINEES 156 // css::container::XNameContainer
+#define BASEPROPERTY_AUTO_REPEAT 157
+#define BASEPROPERTY_ROW_HEADER_WIDTH 158
+#define BASEPROPERTY_COLUMN_HEADER_HEIGHT 159
+#define BASEPROPERTY_USE_GRID_LINES 160
+#define BASEPROPERTY_SCROLLWIDTH 161
+#define BASEPROPERTY_SCROLLHEIGHT 162
+#define BASEPROPERTY_SCROLLTOP 163
+#define BASEPROPERTY_SCROLLLEFT 164
+#define BASEPROPERTY_ACTIVE_SEL_BACKGROUND_COLOR 165
+#define BASEPROPERTY_INACTIVE_SEL_BACKGROUND_COLOR 166
+#define BASEPROPERTY_ACTIVE_SEL_TEXT_COLOR 167
+#define BASEPROPERTY_INACTIVE_SEL_TEXT_COLOR 168
+#define BASEPROPERTY_TYPEDITEMLIST 169 // AnySequence
+
+
+// These properties are not bound, they are always extracted from the BASEPROPERTY_FONTDESCRIPTOR property
+#define BASEPROPERTY_FONTDESCRIPTORPART_START 1000
+#define BASEPROPERTY_FONTDESCRIPTORPART_NAME 1000 // OUString, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME 1001 // OUString, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_FAMILY 1002 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_CHARSET 1003 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT 1004 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT 1005 // Float, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_SLANT 1006 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE 1007 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT 1008 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_WIDTH 1009 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_PITCH 1010 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH 1011 // Float, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION 1012 // Float, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_KERNING 1013 // sal_Bool, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE 1014 // sal_Bool, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_TYPE 1015 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_END 1015
+
+#define PROPERTY_ALIGN_LEFT 0
+#define PROPERTY_ALIGN_CENTER 1
+#define PROPERTY_ALIGN_RIGHT 2
+
+
+TOOLKIT_DLLPUBLIC sal_uInt16 GetPropertyId( const OUString& rPropertyName );
+const css::uno::Type* GetPropertyType( sal_uInt16 nPropertyId );
+const OUString& GetPropertyName( sal_uInt16 nPropertyId );
+sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId );
+sal_uInt16 GetPropertyOrderNr( sal_uInt16 nPropertyId );
+bool DoesDependOnOthers( sal_uInt16 nPropertyId );
+bool CompareProperties( const css::uno::Any& r1, const css::uno::Any& r2 );
+
+
+#endif // INCLUDED_TOOLKIT_HELPER_PROPERTY_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/toolkit/helper/vclunohelper.hxx b/include/toolkit/helper/vclunohelper.hxx
new file mode 100644
index 000000000..6066a8b72
--- /dev/null
+++ b/include/toolkit/helper/vclunohelper.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX
+#define INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/uno/Reference.h>
+
+#include <com/sun/star/awt/MouseEvent.hpp>
+
+#include <vcl/bitmapex.hxx>
+#include <vcl/font.hxx>
+#include <vcl/region.hxx>
+#include <tools/mapunit.hxx>
+#include <tools/fldunit.hxx>
+#include <tools/poly.hxx>
+
+
+namespace com::sun::star::uno { template <typename > class Sequence; }
+
+namespace com::sun::star::uno {
+ class XInterface;
+}
+
+namespace com::sun::star::awt {
+ class XBitmap;
+ class XWindow;
+ class XWindow2;
+ class XWindowPeer;
+ class XGraphics;
+ class XRegion;
+ class XDevice;
+ class XToolkit;
+ class XFont;
+ class XControlContainer;
+ struct Size;
+ struct Point;
+ struct SimpleFontMetric;
+ struct FontDescriptor;
+ struct Rectangle;
+ struct KeyEvent;
+}
+
+
+enum class PointerStyle;
+
+class FontMetric;
+class OutputDevice;
+class MouseEvent;
+class KeyEvent;
+
+class TOOLKIT_DLLPUBLIC VCLUnoHelper
+{
+public:
+ // Toolkit
+ static css::uno::Reference< css::awt::XToolkit> CreateToolkit();
+
+ // Bitmap
+ static BitmapEx GetBitmap( const css::uno::Reference< css::awt::XBitmap>& rxBitmap );
+ static css::uno::Reference< css::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap );
+ static css::uno::Reference< css::awt::XBitmap> CreateVCLXBitmap( const BitmapEx& rBitmap );
+
+ // Window
+ static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow );
+ static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow2 );
+ static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindowPeer );
+ static css::uno::Reference< css::awt::XWindow> GetInterface( vcl::Window* pWindow );
+
+ // OutputDevice
+ static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XDevice>& rxDevice );
+ static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XGraphics>& rxGraphics );
+
+ // Region
+ static vcl::Region GetRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion );
+
+ // Polygon
+ static tools::Polygon CreatePolygon( const css::uno::Sequence< sal_Int32 >& DataX, const css::uno::Sequence< sal_Int32 >& DataY );
+
+ /** convert Font to css::awt::FontDescriptor
+ @param rFont Font to be converted
+ @return the new FontDescriptor
+ */
+ static css::awt::FontDescriptor CreateFontDescriptor( const vcl::Font& rFont );
+ static vcl::Font CreateFont( const css::awt::FontDescriptor& rDescr, const vcl::Font& rInitFont );
+ static vcl::Font CreateFont( const css::uno::Reference< css::awt::XFont >& rxFont );
+ static css::awt::SimpleFontMetric CreateFontMetric( const FontMetric& rFontMetric );
+
+ // Rectangle
+ static bool IsZero(const css::awt::Rectangle& rRect);
+
+ static css::uno::Reference< css::awt::XControlContainer> CreateControlContainer( vcl::Window* pWindow );
+
+ // MapUnits
+ static MapUnit UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit );
+ static sal_Int32 VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit );
+
+
+ //= MeasurementUnitConversion
+
+ /** small helper to convert between MeasurementUnit and
+ FieldUnit
+ */
+ static sal_Int16 ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _rFieldToUNOValueFactor );
+ static FieldUnit ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor );
+
+ /// @throws css::lang::IllegalArgumentException
+ static MapUnit /* MapModeUnit */ ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit);
+
+ static ::Size /* VCLSize */ ConvertToVCLSize(css::awt::Size const& _aSize);
+ static css::awt::Size ConvertToAWTSize(::Size /* VCLSize */ const& _aSize);
+
+ static ::Point /* VCLPoint */ ConvertToVCLPoint(css::awt::Point const& _aPoint);
+ static css::awt::Point ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint);
+
+ static ::tools::Rectangle ConvertToVCLRect( css::awt::Rectangle const & _rRect );
+ static css::awt::Rectangle ConvertToAWTRect( ::tools::Rectangle const & _rRect );
+
+ static css::awt::MouseEvent
+ createMouseEvent(
+ const ::MouseEvent& _rVclEvent,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext
+ );
+
+ static ::MouseEvent createVCLMouseEvent( const css::awt::MouseEvent& _rAwtEvent );
+
+ static css::awt::KeyEvent
+ createKeyEvent(
+ const ::KeyEvent& _rVclEvent,
+ const css::uno::Reference< css::uno::XInterface >& _rxContext
+ );
+
+ static ::KeyEvent createVCLKeyEvent( const css::awt::KeyEvent& _rAwtEvent );
+
+ static ::PointerStyle getMousePointer(const css::uno::Reference<css::awt::XWindowPeer>& rWindowPeer);
+ static void setMousePointer(const css::uno::Reference<css::awt::XWindowPeer>& rWindowPeer, ::PointerStyle mousepointer);
+};
+
+#endif // INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/GenericTypeSerializer.hxx b/include/tools/GenericTypeSerializer.hxx
new file mode 100644
index 000000000..f67d92c84
--- /dev/null
+++ b/include/tools/GenericTypeSerializer.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_GENERICTYPESERIALIZER_HXX
+#define INCLUDED_TOOLS_GENERICTYPESERIALIZER_HXX
+
+#include <tools/toolsdllapi.h>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include <tools/stream.hxx>
+#include <tools/fract.hxx>
+
+namespace tools
+{
+class TOOLS_DLLPUBLIC GenericTypeSerializer
+{
+public:
+ SvStream& mrStream;
+
+ GenericTypeSerializer(SvStream& rStream)
+ : mrStream(rStream)
+ {
+ }
+
+ void readColor(Color& rColor);
+ void writeColor(const Color& rColor);
+
+ void readPoint(Point& rPoint);
+ void writePoint(const Point& rPoint);
+
+ void readSize(Size& rSize);
+ void writeSize(const Size& rSize);
+
+ void readRectangle(Rectangle& rRectangle);
+ void writeRectangle(const Rectangle& rRectangle);
+
+ void readFraction(Fraction& rFraction);
+ void writeFraction(Fraction const& rFraction);
+};
+
+} // end namespace tools
+
+#endif // INCLUDED_TOOLS_GENERICTYPESERIALIZER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/Guid.hxx b/include/tools/Guid.hxx
new file mode 100644
index 000000000..3922a3da9
--- /dev/null
+++ b/include/tools/Guid.hxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <array>
+#include <rtl/uuid.h>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <algorithm>
+#include <stdio.h>
+#include <cctype>
+
+namespace tools
+{
+class Guid
+{
+private:
+ typedef std::array<sal_uInt8, 16> GuidArrayType;
+
+ GuidArrayType maGuidArray;
+
+ static sal_uInt8 gethex(char nChar)
+ {
+ if (nChar >= '0' && nChar <= '9')
+ return nChar - '0';
+ else if (nChar >= 'a' && nChar <= 'f')
+ return nChar - 'a' + 10;
+ else if (nChar >= 'A' && nChar <= 'F')
+ return nChar - 'A' + 10;
+ else
+ return 0;
+ }
+
+ static sal_uInt8 covertHexChar(char high, char low)
+ {
+ return (gethex(high) << 4) + gethex(low);
+ }
+
+ void parse(std::string_view rString)
+ {
+ if (rString.size() != 38)
+ return;
+
+ if (rString[0] != '{' || rString[37] != '}' || rString[9] != '-' || rString[14] != '-'
+ || rString[19] != '-' || rString[24] != '-')
+ return;
+
+ for (size_t x = 1; x <= 8; x++)
+ if (!std::isxdigit(rString[x]))
+ return;
+ for (size_t x = 10; x <= 13; x++)
+ if (!std::isxdigit(rString[x]))
+ return;
+ for (size_t x = 15; x <= 18; x++)
+ if (!std::isxdigit(rString[x]))
+ return;
+ for (size_t x = 20; x <= 23; x++)
+ if (!std::isxdigit(rString[x]))
+ return;
+ for (size_t x = 25; x <= 36; x++)
+ if (!std::isxdigit(rString[x]))
+ return;
+
+ maGuidArray[0] = covertHexChar(rString[1], rString[2]);
+ maGuidArray[1] = covertHexChar(rString[3], rString[4]);
+ maGuidArray[2] = covertHexChar(rString[5], rString[6]);
+ maGuidArray[3] = covertHexChar(rString[7], rString[8]);
+
+ maGuidArray[4] = covertHexChar(rString[10], rString[11]);
+ maGuidArray[5] = covertHexChar(rString[12], rString[13]);
+
+ maGuidArray[6] = covertHexChar(rString[15], rString[16]);
+ maGuidArray[7] = covertHexChar(rString[17], rString[18]);
+
+ maGuidArray[8] = covertHexChar(rString[20], rString[21]);
+ maGuidArray[9] = covertHexChar(rString[22], rString[23]);
+
+ maGuidArray[10] = covertHexChar(rString[25], rString[26]);
+ maGuidArray[11] = covertHexChar(rString[27], rString[28]);
+ maGuidArray[12] = covertHexChar(rString[29], rString[30]);
+ maGuidArray[13] = covertHexChar(rString[31], rString[32]);
+ maGuidArray[14] = covertHexChar(rString[33], rString[34]);
+ maGuidArray[15] = covertHexChar(rString[35], rString[36]);
+ }
+
+public:
+ /// GenerateTag is used as a flag for generating the GUID
+ enum GenerateTag
+ {
+ Generate = 0
+ };
+
+ /// Constructor which generates the GUID
+ Guid(enum GenerateTag) { rtl_createUuid(maGuidArray.data(), nullptr, false); }
+
+ /// Default constructor which initializes the values to 0 (empty GUID)
+ Guid() { maGuidArray.fill(0); }
+
+ /// parse the GUID from the string
+ Guid(std::string_view rString)
+ {
+ maGuidArray.fill(0);
+ parse(rString);
+ }
+
+ /// set the GUID from an array
+ Guid(const sal_uInt8 aGuidArray[16])
+ {
+ std::copy(aGuidArray, aGuidArray + 16, maGuidArray.begin());
+ }
+
+ Guid(Guid&&) = delete;
+
+ Guid(Guid const& rOther) { *this = rOther; }
+
+ void operator=(Guid const& rOther) { std::copy(rOther.cbegin(), rOther.cend(), begin()); }
+
+ bool isEmpty() { return *std::max_element(maGuidArray.begin(), maGuidArray.end()) == 0; }
+
+ GuidArrayType::iterator begin() { return maGuidArray.begin(); }
+ GuidArrayType::iterator end() { return maGuidArray.end(); }
+ GuidArrayType::const_iterator cbegin() const { return maGuidArray.cbegin(); }
+ GuidArrayType::const_iterator cend() const { return maGuidArray.cend(); }
+
+ OString getString() const
+ {
+ char sBuffer[40];
+ snprintf(sBuffer, sizeof(sBuffer),
+ "{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+ maGuidArray[0], maGuidArray[1], maGuidArray[2], maGuidArray[3], maGuidArray[4],
+ maGuidArray[5], maGuidArray[6], maGuidArray[7], maGuidArray[8], maGuidArray[9],
+ maGuidArray[10], maGuidArray[11], maGuidArray[12], maGuidArray[13],
+ maGuidArray[14], maGuidArray[15]);
+
+ return OString(sBuffer);
+ }
+
+ OUString getOUString() { return OStringToOUString(getString(), RTL_TEXTENCODING_ASCII_US); }
+
+ bool operator==(Guid const& rCompare) const
+ {
+ return rtl_compareUuid(maGuidArray.data(), rCompare.maGuidArray.data()) == 0;
+ }
+
+ bool operator!=(Guid const& rCompare) const { return !(*this == rCompare); }
+};
+
+template <typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& rStream,
+ tools::Guid const& rGuid)
+{
+ OString aString = rGuid.getString();
+ rStream << "GUID" << aString.getStr();
+ return rStream;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/UnitConversion.hxx b/include/tools/UnitConversion.hxx
new file mode 100644
index 000000000..43237e051
--- /dev/null
+++ b/include/tools/UnitConversion.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <o3tl/unit_conversion.hxx>
+#include <sal/types.h>
+#include <tools/fldunit.hxx>
+#include <tools/fract.hxx>
+#include <tools/mapunit.hxx>
+
+constexpr o3tl::Length FieldToO3tlLength(FieldUnit eU, o3tl::Length ePixelValue = o3tl::Length::px)
+{
+ switch (eU)
+ {
+ case FieldUnit::MM:
+ return o3tl::Length::mm;
+ case FieldUnit::CM:
+ return o3tl::Length::cm;
+ case FieldUnit::M:
+ return o3tl::Length::m;
+ case FieldUnit::KM:
+ return o3tl::Length::km;
+ case FieldUnit::TWIP:
+ return o3tl::Length::twip;
+ case FieldUnit::POINT:
+ return o3tl::Length::pt;
+ case FieldUnit::PICA:
+ return o3tl::Length::pc;
+ case FieldUnit::INCH:
+ return o3tl::Length::in;
+ case FieldUnit::FOOT:
+ return o3tl::Length::ft;
+ case FieldUnit::MILE:
+ return o3tl::Length::mi;
+ case FieldUnit::CHAR:
+ return o3tl::Length::ch;
+ case FieldUnit::LINE:
+ return o3tl::Length::line;
+ case FieldUnit::MM_100TH:
+ return o3tl::Length::mm100;
+ case FieldUnit::PIXEL:
+ return ePixelValue;
+ default:
+ return o3tl::Length::invalid;
+ }
+}
+
+constexpr o3tl::Length MapToO3tlLength(MapUnit eU, o3tl::Length ePixelValue = o3tl::Length::px)
+{
+ switch (eU)
+ {
+ case MapUnit::Map100thMM:
+ return o3tl::Length::mm100;
+ case MapUnit::Map10thMM:
+ return o3tl::Length::mm10;
+ case MapUnit::MapMM:
+ return o3tl::Length::mm;
+ case MapUnit::MapCM:
+ return o3tl::Length::cm;
+ case MapUnit::Map1000thInch:
+ return o3tl::Length::in1000;
+ case MapUnit::Map100thInch:
+ return o3tl::Length::in100;
+ case MapUnit::Map10thInch:
+ return o3tl::Length::in10;
+ case MapUnit::MapInch:
+ return o3tl::Length::in;
+ case MapUnit::MapPoint:
+ return o3tl::Length::pt;
+ case MapUnit::MapTwip:
+ return o3tl::Length::twip;
+ case MapUnit::MapPixel:
+ return ePixelValue;
+ default:
+ return o3tl::Length::invalid;
+ }
+}
+
+inline Fraction conversionFract(o3tl::Length from, o3tl::Length to)
+{
+ const auto & [ mul, div ] = o3tl::getConversionMulDiv(from, to);
+ return { mul, div };
+}
+
+template <typename N> constexpr auto convertTwipToMm100(N n)
+{
+ return o3tl::convert(n, o3tl::Length::twip, o3tl::Length::mm100);
+}
+
+constexpr sal_Int64 sanitiseMm100ToTwip(sal_Int64 n)
+{
+ return o3tl::convertSaturate(n, o3tl::Length::mm100, o3tl::Length::twip);
+}
+
+template <typename N> constexpr auto convertPointToMm100(N n)
+{
+ return o3tl::convert(n, o3tl::Length::pt, o3tl::Length::mm100);
+}
+template <typename N> constexpr auto convertMm100ToPoint(N n)
+{
+ return o3tl::convert(n, o3tl::Length::mm100, o3tl::Length::pt);
+}
+
+// PPT's "master unit" (1/576 inch) <=> mm/100
+template <typename N> constexpr auto convertMasterUnitToMm100(N n)
+{
+ return o3tl::convert(n, o3tl::Length::master, o3tl::Length::mm100);
+}
+template <typename N> constexpr auto convertMm100ToMasterUnit(N n)
+{
+ return o3tl::convert(n, o3tl::Length::mm100, o3tl::Length::master);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/XmlWalker.hxx b/include/tools/XmlWalker.hxx
new file mode 100644
index 000000000..ba9d18e85
--- /dev/null
+++ b/include/tools/XmlWalker.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TOOLS_XMLWALKER_HXX
+#define INCLUDED_TOOLS_XMLWALKER_HXX
+
+#include <tools/toolsdllapi.h>
+#include <rtl/string.hxx>
+#include <memory>
+
+class SvStream;
+
+namespace tools
+{
+struct XmlWalkerImpl;
+
+/**
+ * XmlWalker main purpose is to make it easier for walking the
+ * parsed XML DOM tree.
+ *
+ * It hides all the libxml2 and C -isms and makes the usage more
+ * comfortable from LO developer point of view.
+ *
+ */
+class TOOLS_DLLPUBLIC XmlWalker final
+{
+private:
+ std::unique_ptr<XmlWalkerImpl> mpImpl;
+
+public:
+ XmlWalker();
+
+ ~XmlWalker();
+
+ bool open(SvStream* pStream);
+
+ OString name();
+ OString namespaceHref();
+ OString namespacePrefix();
+
+ OString content();
+ void children();
+ void parent();
+ void next();
+ bool isValid() const;
+ OString attribute(const OString& sName) const;
+};
+
+} // end tools namespace
+
+#endif // INCLUDED_TOOLS_XMLWRITER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/XmlWriter.hxx b/include/tools/XmlWriter.hxx
new file mode 100644
index 000000000..e8f6579b0
--- /dev/null
+++ b/include/tools/XmlWriter.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TOOLS_XMLWRITER_HXX
+#define INCLUDED_TOOLS_XMLWRITER_HXX
+
+#include <tools/toolsdllapi.h>
+#include <rtl/string.hxx>
+#include <memory>
+#include <string_view>
+#include <vector>
+
+class SvStream;
+
+namespace tools
+{
+struct XmlWriterImpl;
+
+/**
+ * XmlWriter writes a XML to a SvStream. It uses libxml2 for writing but hides
+ * all the internal libxml2 workings and uses types that are native for LO
+ * development.
+ *
+ * The codepage used for XML is always "utf-8" and the output is indented by
+ * default so it is easier to read.
+ *
+ */
+class TOOLS_DLLPUBLIC XmlWriter final
+{
+private:
+ std::unique_ptr<XmlWriterImpl> mpImpl;
+
+public:
+ XmlWriter(SvStream* pStream);
+
+ ~XmlWriter();
+
+ bool startDocument(sal_Int32 nIndent = 2, bool bWriteXmlHeader = true);
+ void endDocument();
+
+ void startElement(const OString& sName);
+ void startElement(const OString& sPrefix, const OString& sName, const OString& sNamespaceUri);
+ void endElement();
+
+ void attribute(const OString& sTagName, const OString& aValue);
+ void attribute(const OString& sTagName, std::u16string_view aValue);
+ void attribute(const OString& sTagName, sal_Int32 aNumber);
+ void attributeDouble(const OString& sTagName, double aNumber);
+ void attributeBase64(const OString& sTagName, std::vector<sal_uInt8> const& rValueInBytes);
+ void attributeBase64(const OString& sTagName, std::vector<char> const& rValueInBytes);
+
+ void content(const OString& sValue);
+ void content(std::u16string_view sValue);
+
+ void element(const OString& sName);
+};
+
+} // end tools namespace
+
+#endif // INCLUDED_TOOLS_XMLWRITER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/b3dtrans.hxx b/include/tools/b3dtrans.hxx
new file mode 100644
index 000000000..2f6752e08
--- /dev/null
+++ b/include/tools/b3dtrans.hxx
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLS_B3DTRANS_HXX
+#define INCLUDED_TOOLS_B3DTRANS_HXX
+
+#define ZBUFFER_DEPTH_RANGE (double(256L * 256L * 256L))
+
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <tools/gen.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <tools/toolsdllapi.h>
+
+/// Transformation sets for 3D output
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC B3dTransformationSet
+{
+private:
+ // Object Matrix Object -> World
+ basegfx::B3DHomMatrix maObjectTrans;
+ basegfx::B3DHomMatrix maInvObjectTrans;
+
+ // Orientation Matrix
+ basegfx::B3DHomMatrix maOrientation;
+ basegfx::B3DHomMatrix maInvOrientation;
+
+ // Projection Matrix
+ basegfx::B3DHomMatrix maProjection;
+ basegfx::B3DHomMatrix maInvProjection;
+
+ // Texture Matrices
+ basegfx::B2DHomMatrix maTexture;
+
+ // Parameters for ViewportTransformation
+ basegfx::B3DVector maScale;
+ basegfx::B3DVector maTranslate;
+
+ // ViewPlane DeviceRectangle (user-defined)
+ double mfLeftBound;
+ double mfRightBound;
+ double mfBottomBound;
+ double mfTopBound;
+
+ // Aspect ratio of 3D transformation (Y / X)
+ // default: 1:1 -> 1.0
+ // Disable with value 0.0
+ double mfRatio;
+
+ // Viewport area in logical coordinates
+ tools::Rectangle maViewportRectangle;
+ // Visible area within viewport
+ tools::Rectangle maVisibleRectangle;
+
+ // Actual coordinates as set by CalcViewport
+ // of visible viewport area (logical coordinates)
+ tools::Rectangle maSetBound;
+
+ // Flags
+ bool mbPerspective : 1;
+ bool mbProjectionValid : 1;
+
+public:
+ B3dTransformationSet();
+ virtual ~B3dTransformationSet();
+
+ B3dTransformationSet(B3dTransformationSet const &) = default;
+ B3dTransformationSet(B3dTransformationSet &&) = default;
+ B3dTransformationSet & operator =(B3dTransformationSet const &) = default;
+ B3dTransformationSet & operator =(B3dTransformationSet &&) = default;
+
+ void Reset();
+
+ /** Set the orientation
+
+ @param vVRP the View Reference Point (VRP)
+ @param vVPN the View Plane Normal (VPN)
+ @param vVUP the View Up Plane (VUP)
+ */
+ void SetOrientation(
+ const basegfx::B3DPoint& rVRP = basegfx::B3DPoint(0.0,0.0,1.0),
+ const basegfx::B3DVector& rVPN = basegfx::B3DVector(0.0,0.0,1.0),
+ const basegfx::B3DVector& rVUP = basegfx::B3DVector(0.0,1.0,0.0));
+
+ // Projection
+ void SetProjection(const basegfx::B3DHomMatrix& mProject);
+ const basegfx::B3DHomMatrix& GetProjection();
+
+ // Texture
+
+ // aspect ratio accessors and the defined method of keeping defined aspect ratio
+ double GetRatio() const { return mfRatio; }
+ void SetRatio(double fNew);
+
+ // Parameters of ViewportTransformation
+ void SetDeviceRectangle(double fL=-1.0, double fR=1.0,
+ double fB=-1.0, double fT=1.0);
+ double GetDeviceRectangleWidth() const { return mfRightBound - mfLeftBound; }
+
+ void SetPerspective(bool bNew);
+
+ void SetViewportRectangle(tools::Rectangle const & rRect, tools::Rectangle const & rVisible);
+ void SetViewportRectangle(tools::Rectangle const & rRect) { SetViewportRectangle(rRect, rRect); }
+
+ void CalcViewport();
+
+ // Direct accessors for miscellaneous transformations
+ basegfx::B3DPoint WorldToEyeCoor(const basegfx::B3DPoint& rVec);
+ basegfx::B3DPoint EyeToWorldCoor(const basegfx::B3DPoint& rVec);
+
+ static void Frustum(
+ basegfx::B3DHomMatrix& rTarget,
+ double fLeft = -1.0, double fRight = 1.0,
+ double fBottom = -1.0, double fTop = 1.0,
+ double fNear = 0.001, double fFar = 1.0);
+ static void Ortho(
+ basegfx::B3DHomMatrix& rTarget,
+ double fLeft = -1.0, double fRight = 1.0,
+ double fBottom = -1.0, double fTop = 1.0,
+ double fNear = 0.0, double fFar = 1.0);
+ static void Orientation(
+ basegfx::B3DHomMatrix& rTarget,
+ const basegfx::B3DPoint& aVRP = basegfx::B3DPoint(0.0,0.0,1.0),
+ basegfx::B3DVector aVPN = basegfx::B3DVector(0.0,0.0,1.0),
+ basegfx::B3DVector aVUP = basegfx::B3DVector(0.0,1.0,0.0));
+
+protected:
+ void PostSetObjectTrans();
+ void PostSetOrientation();
+ void PostSetProjection();
+
+ virtual void DeviceRectangleChange();
+};
+
+/** Viewport for B3D
+
+ Uses a simplified model, in which a point is described using a View
+ Reference Point (VRP).
+*/
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC B3dViewport : public B3dTransformationSet
+{
+private:
+ basegfx::B3DPoint aVRP; // View Reference Point
+ basegfx::B3DVector aVPN; // View Plane Normal
+ basegfx::B3DVector aVUV; // View Up Vector
+
+public:
+ B3dViewport();
+ virtual ~B3dViewport() override;
+
+ B3dViewport(B3dViewport const &) = default;
+ B3dViewport(B3dViewport &&) = default;
+ B3dViewport & operator =(B3dViewport const &) = default;
+ B3dViewport & operator =(B3dViewport &&) = default;
+
+ void SetVUV(const basegfx::B3DVector& rNewVUV);
+ void SetViewportValues(
+ const basegfx::B3DPoint& rNewVRP,
+ const basegfx::B3DVector& rNewVPN,
+ const basegfx::B3DVector& rNewVUV);
+
+ const basegfx::B3DPoint& GetVRP() const { return aVRP; }
+ const basegfx::B3DVector& GetVPN() const { return aVPN; }
+ const basegfx::B3DVector& GetVUV() const { return aVUV; }
+
+protected:
+ void CalcOrientation();
+};
+
+// B3D camera
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC B3dCamera final : public B3dViewport
+{
+public:
+ B3dCamera(
+ const basegfx::B3DPoint& rPos = basegfx::B3DPoint(0.0, 0.0, 1.0),
+ const basegfx::B3DVector& rLkAt = basegfx::B3DVector(0.0, 0.0, 0.0),
+ double fFocLen = 35.0, double fBnkAng = 0.0);
+ virtual ~B3dCamera() override;
+
+ B3dCamera(B3dCamera const &) = default;
+ B3dCamera(B3dCamera &&) = default;
+ B3dCamera & operator =(B3dCamera const &) = default;
+ B3dCamera & operator =(B3dCamera &&) = default;
+
+private:
+ void CalcNewViewportValues();
+ void CalcFocalLength();
+
+ virtual void DeviceRectangleChange() override;
+
+ basegfx::B3DPoint aPosition;
+ basegfx::B3DVector aLookAt;
+ double fFocalLength;
+ double fBankAngle;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/bigint.hxx b/include/tools/bigint.hxx
new file mode 100644
index 000000000..ae33a5e67
--- /dev/null
+++ b/include/tools/bigint.hxx
@@ -0,0 +1,253 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_BIGINT_HXX
+#define INCLUDED_TOOLS_BIGINT_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/toolsdllapi.h>
+#include <tools/long.hxx>
+
+#define MAX_DIGITS 8
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC BigInt
+{
+private:
+ // we only use one of these two fields at a time
+ union {
+ sal_Int32 nVal;
+ sal_uInt16 nNum[MAX_DIGITS];
+ };
+ sal_uInt8 nLen : 5; // current length, if 0, data is in nVal, otherwise data is in nNum
+ bool bIsNeg : 1; // Is Sign negative?
+
+ TOOLS_DLLPRIVATE void MakeBigInt(BigInt const &);
+ TOOLS_DLLPRIVATE void Normalize();
+ TOOLS_DLLPRIVATE void Mult(BigInt const &, sal_uInt16);
+ TOOLS_DLLPRIVATE void Div(sal_uInt16, sal_uInt16 &);
+ TOOLS_DLLPRIVATE bool IsLess(BigInt const &) const;
+ TOOLS_DLLPRIVATE void AddLong(BigInt &, BigInt &);
+ TOOLS_DLLPRIVATE void SubLong(BigInt &, BigInt &);
+ TOOLS_DLLPRIVATE void MultLong(BigInt const &, BigInt &) const;
+ TOOLS_DLLPRIVATE void DivLong(BigInt const &, BigInt &) const;
+ TOOLS_DLLPRIVATE void ModLong(BigInt const &, BigInt &) const;
+ TOOLS_DLLPRIVATE bool ABS_IsLess(BigInt const &) const;
+
+public:
+ BigInt()
+ : nVal(0)
+ , nLen(0)
+ , bIsNeg(false)
+ {
+ }
+
+ BigInt(sal_Int32 nValue)
+ : nVal(nValue)
+ , nLen(0)
+ , bIsNeg(false)
+ {
+ }
+
+#if SAL_TYPES_SIZEOFLONG == 4
+ BigInt(int nValue)
+ : nVal(nValue)
+ , nLen(0)
+ , bIsNeg(false)
+ {
+ }
+#endif
+
+ BigInt( double nVal );
+ BigInt( sal_uInt32 nVal );
+ BigInt( sal_Int64 nVal );
+ BigInt( const BigInt& rBigInt );
+ BigInt( std::u16string_view rString );
+
+ operator sal_Int16() const;
+ operator sal_uInt16() const;
+ operator sal_Int32() const;
+ operator sal_uInt32() const;
+ operator double() const;
+#if SAL_TYPES_SIZEOFPOINTER == 8
+ operator tools::Long() const;
+#endif
+
+ bool IsNeg() const;
+ bool IsZero() const;
+ bool IsLong() const { return nLen == 0; }
+
+ void Abs();
+
+ BigInt& operator =( const BigInt& rVal );
+ BigInt& operator +=( const BigInt& rVal );
+ BigInt& operator -=( const BigInt& rVal );
+ BigInt& operator *=( const BigInt& rVal );
+ BigInt& operator /=( const BigInt& rVal );
+ BigInt& operator %=( const BigInt& rVal );
+
+ BigInt& operator =( sal_Int32 nValue );
+
+ /* Scale and round value */
+ static tools::Long Scale(tools::Long nVal, tools::Long nMult, tools::Long nDiv);
+
+ friend inline BigInt operator +( const BigInt& rVal1, const BigInt& rVal2 );
+ friend inline BigInt operator -( const BigInt& rVal1, const BigInt& rVal2 );
+ friend inline BigInt operator *( const BigInt& rVal1, const BigInt& rVal2 );
+ friend inline BigInt operator /( const BigInt& rVal1, const BigInt& rVal2 );
+ friend inline BigInt operator %( const BigInt& rVal1, const BigInt& rVal2 );
+
+ TOOLS_DLLPUBLIC friend bool operator==( const BigInt& rVal1, const BigInt& rVal2 );
+ friend inline bool operator!=( const BigInt& rVal1, const BigInt& rVal2 );
+ TOOLS_DLLPUBLIC friend bool operator< ( const BigInt& rVal1, const BigInt& rVal2 );
+ friend inline bool operator> ( const BigInt& rVal1, const BigInt& rVal2 );
+ friend inline bool operator<=( const BigInt& rVal1, const BigInt& rVal2 );
+ friend inline bool operator>=( const BigInt& rVal1, const BigInt& rVal2 );
+
+ friend class Fraction;
+};
+
+inline BigInt::operator sal_Int16() const
+{
+ if ( nLen == 0 && nVal >= SAL_MIN_INT16 && nVal <= SAL_MAX_INT16 )
+ return static_cast<sal_Int16>(nVal);
+ assert(false && "out of range");
+ return 0;
+}
+
+inline BigInt::operator sal_uInt16() const
+{
+ if ( nLen == 0 && nVal >= 0 && nVal <= SAL_MAX_UINT16 )
+ return static_cast<sal_uInt16>(nVal);
+ assert(false && "out of range");
+ return 0;
+}
+
+inline BigInt::operator sal_Int32() const
+{
+ if (nLen == 0)
+ return nVal;
+ assert(false && "out of range");
+ return 0;
+}
+
+inline BigInt::operator sal_uInt32() const
+{
+ if ( nLen == 0 && nVal >= 0 )
+ return static_cast<sal_uInt32>(nVal);
+ assert(false && "out of range");
+ return 0;
+}
+
+#if SAL_TYPES_SIZEOFPOINTER == 8
+inline BigInt::operator tools::Long() const
+{
+ // Clamp to int32 since long is int32 on Windows.
+ if (nLen == 0)
+ return nVal;
+ assert(false && "out of range");
+ return 0;
+}
+#endif
+
+inline BigInt& BigInt::operator =( sal_Int32 nValue )
+{
+ nLen = 0;
+ nVal = nValue;
+
+ return *this;
+}
+
+inline bool BigInt::IsNeg() const
+{
+ if ( nLen == 0 )
+ return (nVal < 0);
+ else
+ return bIsNeg;
+}
+
+inline bool BigInt::IsZero() const
+{
+ if ( nLen != 0 )
+ return false;
+ else
+ return (nVal == 0);
+}
+
+inline void BigInt::Abs()
+{
+ if ( nLen != 0 )
+ bIsNeg = false;
+ else if ( nVal < 0 )
+ nVal = -nVal;
+}
+
+inline BigInt operator+( const BigInt &rVal1, const BigInt &rVal2 )
+{
+ BigInt aErg( rVal1 );
+ aErg += rVal2;
+ return aErg;
+}
+
+inline BigInt operator-( const BigInt &rVal1, const BigInt &rVal2 )
+{
+ BigInt aErg( rVal1 );
+ aErg -= rVal2;
+ return aErg;
+}
+
+inline BigInt operator*( const BigInt &rVal1, const BigInt &rVal2 )
+{
+ BigInt aErg( rVal1 );
+ aErg *= rVal2;
+ return aErg;
+}
+
+inline BigInt operator/( const BigInt &rVal1, const BigInt &rVal2 )
+{
+ BigInt aErg( rVal1 );
+ aErg /= rVal2;
+ return aErg;
+}
+
+inline BigInt operator%( const BigInt &rVal1, const BigInt &rVal2 )
+{
+ BigInt aErg( rVal1 );
+ aErg %= rVal2;
+ return aErg;
+}
+
+inline bool operator!=( const BigInt& rVal1, const BigInt& rVal2 )
+{
+ return !(rVal1 == rVal2);
+}
+
+inline bool operator>(const BigInt& rVal1, const BigInt& rVal2) { return rVal2 < rVal1; }
+
+inline bool operator<=( const BigInt& rVal1, const BigInt& rVal2 )
+{
+ return !( rVal1 > rVal2);
+}
+
+inline bool operator>=( const BigInt& rVal1, const BigInt& rVal2 )
+{
+ return !(rVal1 < rVal2);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/color.hxx b/include/tools/color.hxx
new file mode 100644
index 000000000..0d4990b63
--- /dev/null
+++ b/include/tools/color.hxx
@@ -0,0 +1,516 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_COLOR_HXX
+#define INCLUDED_TOOLS_COLOR_HXX
+
+#include <sal/types.h>
+#include <tools/toolsdllapi.h>
+#include <com/sun/star/uno/Any.hxx>
+#include <config_global.h>
+#include <basegfx/color/bcolor.hxx>
+#include <osl/endian.h>
+
+namespace color
+{
+
+constexpr sal_uInt32 extractRGB(sal_uInt32 nColorNumber)
+{
+ return nColorNumber & 0x00FFFFFF;
+}
+
+constexpr sal_uInt8 ColorChannelMerge(sal_uInt8 nDst, sal_uInt8 nSrc, sal_uInt8 nSrcTrans)
+{
+ return sal_uInt8(((sal_Int32(nDst) - nSrc) * nSrcTrans + ((nSrc << 8) | nDst)) >> 8);
+}
+
+}
+
+/** used to deliberately select the right constructor */
+enum ColorTransparencyTag { ColorTransparency = 0 };
+enum ColorAlphaTag { ColorAlpha = 0 };
+
+// Color
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Color
+{
+ union
+ {
+ sal_uInt32 mValue;
+ struct
+ {
+#ifdef OSL_BIGENDIAN
+ sal_uInt8 T;
+ sal_uInt8 R;
+ sal_uInt8 G;
+ sal_uInt8 B;
+#else
+ sal_uInt8 B;
+ sal_uInt8 G;
+ sal_uInt8 R;
+ sal_uInt8 T;
+#endif
+ };
+ };
+
+public:
+ constexpr Color()
+ : mValue(0) // black
+ {}
+
+#if HAVE_CPP_CONSTEVAL
+ consteval
+#else
+ constexpr
+#endif
+ Color(const sal_uInt32 nColor)
+ : mValue(nColor)
+ {
+ assert(nColor <= 0xffffff && "don't pass transparency to this constructor, use the Color(ColorTransparencyTag,...) or Color(ColorAlphaTag,...) constructor to make it explicit");
+ }
+
+ constexpr Color(enum ColorTransparencyTag, sal_uInt32 nColor)
+ : mValue(nColor)
+ {
+ }
+
+ constexpr Color(enum ColorAlphaTag, sal_uInt32 nColor)
+ : mValue((nColor & 0xffffff) | ((255 - (nColor >> 24)) << 24))
+ {
+ }
+
+ constexpr Color(enum ColorTransparencyTag, sal_uInt8 nTransparency, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ : mValue(sal_uInt32(nBlue) | (sal_uInt32(nGreen) << 8) | (sal_uInt32(nRed) << 16) | (sal_uInt32(nTransparency) << 24))
+ {}
+
+ constexpr Color(enum ColorAlphaTag, sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ : Color(ColorTransparency, 255 - nAlpha, nRed, nGreen, nBlue)
+ {}
+
+ constexpr Color(sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ : Color(ColorTransparency, 0, nRed, nGreen, nBlue)
+ {}
+
+ // constructor to create a tools-Color from ::basegfx::BColor
+ explicit Color(const basegfx::BColor& rBColor)
+ : Color(ColorTransparency, 0,
+ sal_uInt8(std::lround(rBColor.getRed() * 255.0)),
+ sal_uInt8(std::lround(rBColor.getGreen() * 255.0)),
+ sal_uInt8(std::lround(rBColor.getBlue() * 255.0)))
+ {}
+
+ /** Casts the color to corresponding uInt32.
+ * Primarily used when passing Color objects to UNO API
+ * @return corresponding sal_uInt32
+ */
+ constexpr explicit operator sal_uInt32() const
+ {
+ return mValue;
+ }
+
+ /** Casts the color to corresponding iInt32.
+ * If there is no transparency, will be positive.
+ * @return corresponding sal_Int32
+ */
+ constexpr explicit operator sal_Int32() const
+ {
+ return sal_Int32(mValue);
+ }
+
+ /* Basic RGBA operations */
+
+ /** Gets the red value.
+ * @return R
+ */
+ sal_uInt8 GetRed() const
+ {
+ return R;
+ }
+
+ /** Gets the green value.
+ * @return G
+ */
+ sal_uInt8 GetGreen() const
+ {
+ return G;
+ }
+
+ /** Gets the blue value.
+ * @return B
+ */
+ sal_uInt8 GetBlue() const
+ {
+ return B;
+ }
+
+ /** Gets the alpha value.
+ * @return A
+ */
+ sal_uInt8 GetAlpha() const
+ {
+ return 255 - T;
+ }
+
+ /** Is the color transparent?
+ */
+ bool IsTransparent() const
+ {
+ return GetAlpha() != 255;
+ }
+
+ /** Is the color fully transparent i.e. 100% transparency ?
+ */
+ bool IsFullyTransparent() const
+ {
+ return T == 255;
+ }
+
+ /** Sets the red value.
+ * @param nRed
+ */
+ void SetRed(sal_uInt8 nRed)
+ {
+ R = nRed;
+ }
+
+ /** Sets the green value.
+ * @param nGreen
+ */
+ void SetGreen(sal_uInt8 nGreen)
+ {
+ G = nGreen;
+ }
+
+ /** Sets the blue value.
+ * @param nBlue
+ */
+ void SetBlue(sal_uInt8 nBlue)
+ {
+ B = nBlue;
+ }
+
+ /** Sets the alpha value.
+ * @param nAlpha
+ */
+ void SetAlpha(sal_uInt8 nAlpha)
+ {
+ T = 255 - nAlpha;
+ }
+
+ /** Returns the same color but ignoring the transparency value.
+ * @return RGB version
+ */
+ Color GetRGBColor() const
+ {
+ return {R, G, B};
+ }
+
+ /* Comparison and operators */
+
+ /** Check if the color RGB value is equal than rColor.
+ * @param rColor
+ * @return is equal
+ */
+ bool IsRGBEqual( const Color& rColor ) const
+ {
+ return ( mValue & 0x00FFFFFF ) == ( rColor.mValue & 0x00FFFFFF );
+ }
+
+ /** Check if the color value is lower than aCompareColor.
+ * @param aCompareColor
+ * @return is lower
+ */
+ bool operator<(const Color& aCompareColor) const
+ {
+ return mValue < aCompareColor.mValue;
+ }
+
+ /** Check if the color value is greater than aCompareColor.
+ * @param aCompareColor
+ * @return is greater
+ */
+ bool operator>(const Color& aCompareColor) const
+ {
+ return mValue > aCompareColor.mValue;
+ }
+
+ /** Check if the color value is equal than rColor.
+ * @param rColor
+ * @return is equal
+ */
+ bool operator==(const Color& rColor) const
+ {
+ return mValue == rColor.mValue;
+ }
+
+ /** Check if the color value is unequal than rColor.
+ * @param rColor
+ * @return is unequal
+ */
+ bool operator!=(const Color& rColor) const
+ {
+ return mValue != rColor.mValue;
+ }
+
+ /** Gets the color error compared to another.
+ * It describes how different they are.
+ * It takes the abs of differences in parameters.
+ * @param rCompareColor
+ * @return error
+ */
+ sal_uInt16 GetColorError(const Color& rCompareColor) const
+ {
+ return static_cast<sal_uInt16>(
+ abs(static_cast<int>(GetBlue()) - rCompareColor.GetBlue()) +
+ abs(static_cast<int>(GetGreen()) - rCompareColor.GetGreen()) +
+ abs(static_cast<int>(GetRed()) - rCompareColor.GetRed()));
+ }
+
+ /* Light and contrast */
+
+ /** Gets the color luminance. It means perceived brightness.
+ * @return luminance
+ */
+ sal_uInt8 GetLuminance() const
+ {
+ return sal_uInt8((B * 29UL + G * 151UL + R * 76UL) >> 8);
+ }
+
+ /** Increases the color luminance by cLumInc.
+ * @param cLumInc
+ */
+ void IncreaseLuminance(sal_uInt8 cLumInc);
+
+ /** Decreases the color luminance by cLumDec.
+ * @param cLumDec
+ */
+ void DecreaseLuminance(sal_uInt8 cLumDec);
+
+ /** Decreases color contrast with white by cContDec.
+ * @param cContDec
+ */
+ void DecreaseContrast(sal_uInt8 cContDec);
+
+ /** Comparison with luminance thresholds.
+ * @return is dark
+ */
+ bool IsDark() const
+ {
+ // 62 is the number that means it also triggers on Ubuntu in dark mode
+ return GetLuminance() <= 62;
+ }
+
+ /** Comparison with luminance thresholds.
+ * @return is dark
+ */
+ bool IsBright() const
+ {
+ return GetLuminance() >= 245;
+ }
+
+ /* Color filters */
+
+ /**
+ * Apply tint or shade to a color.
+ *
+ * The input value is the percentage (in 100th of percent) of how much the
+ * color changes towards the black (shade) or white (tint). If the value
+ * is positive, the color is tinted, if the value is negative, the color is
+ * shaded.
+ **/
+ void ApplyTintOrShade(sal_Int16 n100thPercent);
+
+ /**
+ * Apply luminance offset and/or modulation.
+ *
+ * The input values are in percentages (in 100th percents). 100% modulation and 0% offset
+ * results in no change.
+ */
+ void ApplyLumModOff(sal_Int16 nMod, sal_Int16 nOff);
+
+ /** Inverts color. 1 and 0 are switched.
+ * Note that the result will be the complementary color.
+ * For example, if you have red, you will get cyan: FF0000 -> 00FFFF.
+ */
+ void Invert()
+ {
+ R = ~R;
+ G = ~G;
+ B = ~B;
+ }
+
+ /** Merges color with rMergeColor.
+ * Allows to get resulting color when superposing another.
+ * @param rMergeColor
+ * @param cTransparency
+ */
+ void Merge(const Color& rMergeColor, sal_uInt8 cTransparency)
+ {
+ R = color::ColorChannelMerge(R, rMergeColor.R, cTransparency);
+ G = color::ColorChannelMerge(G, rMergeColor.G, cTransparency);
+ B = color::ColorChannelMerge(B, rMergeColor.B, cTransparency);
+ }
+
+ /* Change of format */
+
+ /** Color space conversion tools
+ * The range for h/s/b is:
+ * - Hue: 0-360 degree
+ * - Saturation: 0-100%
+ * - Brightness: 0-100%
+ * @param nHue
+ * @param nSaturation
+ * @param nBrightness
+ * @return rgb color
+ */
+ static Color HSBtoRGB(sal_uInt16 nHue, sal_uInt16 nSaturation, sal_uInt16 nBrightness);
+
+ /** Converts a string into a color. Supports:
+ * #RRGGBB
+ * #rrggbb
+ * #RGB
+ * #rgb
+ * RRGGBB
+ * rrggbb
+ * RGB
+ * rgb
+ * If fails returns Color().
+ */
+ static Color STRtoRGB(std::u16string_view colorname);
+
+ /** Color space conversion tools
+ * @param nHue
+ * @param nSaturation
+ * @param nBrightness
+ */
+ void RGBtoHSB(sal_uInt16& nHue, sal_uInt16& nSaturation, sal_uInt16& nBrightness) const;
+
+ /* Return color as RGB hex string: rrggbb
+ * for example "00ff00" for green color
+ * @return hex string
+ */
+ OUString AsRGBHexString() const;
+
+ /* Return color as RGB hex string: RRGGBB
+ * for example "00FF00" for green color
+ * @return hex string
+ */
+ OUString AsRGBHEXString() const;
+
+ /* get ::basegfx::BColor from this color
+ * @return basegfx color
+ */
+ basegfx::BColor getBColor() const
+ {
+ return basegfx::BColor(R / 255.0, G / 255.0, B / 255.0);
+ }
+};
+
+// to reduce the noise when moving these into and out of Any
+inline bool operator >>=( const css::uno::Any & rAny, Color & value )
+{
+ sal_Int32 nTmp = {}; // spurious -Werror=maybe-uninitialized
+ if (!(rAny >>= nTmp))
+ return false;
+ value = Color(ColorTransparency, nTmp);
+ return true;
+}
+
+inline void operator <<=( css::uno::Any & rAny, Color value )
+{
+ rAny <<= sal_Int32(value);
+}
+
+namespace com::sun::star::uno {
+ template<> inline Any::Any(Color const & value): Any(sal_Int32(value)) {}
+}
+
+// Test compile time conversion of Color to sal_uInt32
+
+static_assert (sal_uInt32(Color(ColorTransparency, 0x00, 0x12, 0x34, 0x56)) == 0x00123456);
+static_assert (sal_uInt32(Color(0x12, 0x34, 0x56)) == 0x00123456);
+
+// Color types
+
+constexpr ::Color COL_TRANSPARENT ( ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF );
+constexpr ::Color COL_AUTO ( ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF );
+constexpr ::Color COL_BLACK ( 0x00, 0x00, 0x00 );
+constexpr ::Color COL_BLUE ( 0x00, 0x00, 0x80 );
+constexpr ::Color COL_GREEN ( 0x00, 0x80, 0x00 );
+constexpr ::Color COL_CYAN ( 0x00, 0x80, 0x80 );
+constexpr ::Color COL_RED ( 0x80, 0x00, 0x00 );
+constexpr ::Color COL_MAGENTA ( 0x80, 0x00, 0x80 );
+constexpr ::Color COL_BROWN ( 0x80, 0x80, 0x00 );
+constexpr ::Color COL_GRAY ( 0x80, 0x80, 0x80 );
+constexpr ::Color COL_GRAY3 ( 0xCC, 0xCC, 0xCC );
+constexpr ::Color COL_GRAY7 ( 0x66, 0x66, 0x66 );
+constexpr ::Color COL_LIGHTGRAY ( 0xC0, 0xC0, 0xC0 );
+constexpr ::Color COL_LIGHTBLUE ( 0x00, 0x00, 0xFF );
+constexpr ::Color COL_LIGHTGREEN ( 0x00, 0xFF, 0x00 );
+constexpr ::Color COL_LIGHTCYAN ( 0x00, 0xFF, 0xFF );
+constexpr ::Color COL_LIGHTRED ( 0xFF, 0x00, 0x00 );
+constexpr ::Color COL_LIGHTMAGENTA ( 0xFF, 0x00, 0xFF );
+constexpr ::Color COL_LIGHTGRAYBLUE ( 0xE0, 0xE0, 0xFF );
+constexpr ::Color COL_YELLOW ( 0xFF, 0xFF, 0x00 );
+constexpr ::Color COL_WHITE ( 0xFF, 0xFF, 0xFF );
+constexpr ::Color COL_AUTHOR1_DARK ( 0xC6, 0x92, 0x00 );
+constexpr ::Color COL_AUTHOR1_NORMAL ( 0xFF, 0xFF, 0x9E );
+constexpr ::Color COL_AUTHOR1_LIGHT ( 0xFF, 0xFF, 0xC3 );
+constexpr ::Color COL_AUTHOR2_DARK ( 0x06, 0x46, 0xA2 );
+constexpr ::Color COL_AUTHOR2_NORMAL ( 0xD8, 0xE8, 0xFF );
+constexpr ::Color COL_AUTHOR2_LIGHT ( 0xE9, 0xF2, 0xFF );
+constexpr ::Color COL_AUTHOR3_DARK ( 0x57, 0x9D, 0x1C );
+constexpr ::Color COL_AUTHOR3_NORMAL ( 0xDA, 0xF8, 0xC1 );
+constexpr ::Color COL_AUTHOR3_LIGHT ( 0xE2, 0xFA, 0xCF );
+constexpr ::Color COL_AUTHOR4_DARK ( 0x69, 0x2B, 0x9D );
+constexpr ::Color COL_AUTHOR4_NORMAL ( 0xE4, 0xD2, 0xF5 );
+constexpr ::Color COL_AUTHOR4_LIGHT ( 0xEF, 0xE4, 0xF8 );
+constexpr ::Color COL_AUTHOR5_DARK ( 0xC5, 0x00, 0x0B );
+constexpr ::Color COL_AUTHOR5_NORMAL ( 0xFE, 0xCD, 0xD0 );
+constexpr ::Color COL_AUTHOR5_LIGHT ( 0xFF, 0xE3, 0xE5 );
+constexpr ::Color COL_AUTHOR6_DARK ( 0x00, 0x80, 0x80 );
+constexpr ::Color COL_AUTHOR6_NORMAL ( 0xD2, 0xF6, 0xF6 );
+constexpr ::Color COL_AUTHOR6_LIGHT ( 0xE6, 0xFA, 0xFA );
+constexpr ::Color COL_AUTHOR7_DARK ( 0x8C, 0x84, 0x00 );
+constexpr ::Color COL_AUTHOR7_NORMAL ( 0xED, 0xFC, 0xA3 );
+constexpr ::Color COL_AUTHOR7_LIGHT ( 0xF2, 0xFE, 0xB5 );
+constexpr ::Color COL_AUTHOR8_DARK ( 0x35, 0x55, 0x6B );
+constexpr ::Color COL_AUTHOR8_NORMAL ( 0xD3, 0xDE, 0xE8 );
+constexpr ::Color COL_AUTHOR8_LIGHT ( 0xE2, 0xEA, 0xF1 );
+constexpr ::Color COL_AUTHOR9_DARK ( 0xD1, 0x76, 0x00 );
+constexpr ::Color COL_AUTHOR9_NORMAL ( 0xFF, 0xE2, 0xB9 );
+constexpr ::Color COL_AUTHOR9_LIGHT ( 0xFF, 0xE7, 0xC7 );
+constexpr ::Color COL_AUTHOR_TABLE_INS ( 0xE1, 0xF2, 0xFA );
+constexpr ::Color COL_AUTHOR_TABLE_DEL ( 0xFC, 0xE6, 0xF4 );
+
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator <<(std::basic_ostream<charT, traits>& rStream, const Color& rColor)
+{
+ std::ios_base::fmtflags nOrigFlags = rStream.flags();
+ rStream << "rgba[" << std::hex << std::setfill ('0')
+ << std::setw(2) << static_cast<int>(rColor.GetRed())
+ << std::setw(2) << static_cast<int>(rColor.GetGreen())
+ << std::setw(2) << static_cast<int>(rColor.GetBlue())
+ << std::setw(2) << static_cast<int>(rColor.GetAlpha()) << "]";
+ rStream.setf(nOrigFlags);
+ return rStream;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/config.hxx b/include/tools/config.hxx
new file mode 100644
index 000000000..3616d087c
--- /dev/null
+++ b/include/tools/config.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_CONFIG_HXX
+#define INCLUDED_TOOLS_CONFIG_HXX
+
+#include <tools/toolsdllapi.h>
+#include <rtl/ustring.hxx>
+#include <memory>
+
+struct ImplConfigData;
+struct ImplGroupData;
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Config
+{
+private:
+ OUString maFileName;
+ OString maGroupName;
+ std::unique_ptr<ImplConfigData> mpData;
+ ImplGroupData* mpActGroup;
+ sal_uInt32 mnDataUpdateId;
+
+ TOOLS_DLLPRIVATE bool ImplUpdateConfig() const;
+ TOOLS_DLLPRIVATE ImplGroupData* ImplGetGroup() const;
+
+public:
+ Config( const OUString& rFileName );
+ ~Config();
+
+ void SetGroup(const OString& rGroup);
+ const OString& GetGroup() const { return maGroupName; }
+ void DeleteGroup(std::string_view rGroup);
+ OString GetGroupName(sal_uInt16 nGroup) const;
+ sal_uInt16 GetGroupCount() const;
+ bool HasGroup(std::string_view rGroup) const;
+
+ OString ReadKey(const OString& rKey) const;
+ OString ReadKey(const OString& rKey, const OString& rDefault) const;
+ void WriteKey(const OString& rKey, const OString& rValue);
+ void DeleteKey(std::string_view rKey);
+ OString GetKeyName(sal_uInt16 nKey) const;
+ OString ReadKey(sal_uInt16 nKey) const;
+ sal_uInt16 GetKeyCount() const;
+
+ void Flush();
+
+private:
+ Config( const Config& rConfig ) = delete;
+ Config& operator = ( const Config& rConfig ) = delete;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/contnr.hxx b/include/tools/contnr.hxx
new file mode 100644
index 000000000..090be0dbe
--- /dev/null
+++ b/include/tools/contnr.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_CONTNR_HXX
+#define INCLUDED_TOOLS_CONTNR_HXX
+
+#include <sal/types.h>
+
+#define TREELIST_APPEND (SAL_MAX_UINT32)
+#define TREELIST_ENTRY_NOTFOUND (SAL_MAX_UINT32)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/cpuid.hxx b/include/tools/cpuid.hxx
new file mode 100644
index 000000000..4f309ff11
--- /dev/null
+++ b/include/tools/cpuid.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <sal/config.h>
+#include <tools/toolsdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <rtl/ustring.hxx>
+
+/*
+
+Do NOT include this header in source files compiled with CPU-specific code.
+TODO: For the header to be safe that way, it should be free of any templates
+or inline functions, otherwise their possibly emitted copies compiled
+with the CPU-specific instructions might be chosen by the linker as the copy
+to keep.
+
+Also see the note at the top of simdsupport.hxx .
+
+*/
+
+namespace cpuid {
+
+enum class InstructionSetFlags
+{
+ NONE = 0x00,
+ HYPER = 0x01,
+ SSE2 = 0x02,
+ SSSE3 = 0x04,
+ SSE41 = 0x08,
+ SSE42 = 0x10,
+ AVX = 0x20,
+ AVX2 = 0x40,
+ AVX512F = 0x80
+};
+
+} // end cpuid
+
+namespace o3tl {
+ template<> struct typed_flags<cpuid::InstructionSetFlags> : is_typed_flags<cpuid::InstructionSetFlags, 0x0ff> {};
+}
+
+namespace cpuid {
+
+/** Get supported instruction set flags determined at runtime by probing the CPU.
+ */
+TOOLS_DLLPUBLIC InstructionSetFlags getCpuInstructionSetFlags();
+
+/** Check if a certain instruction set is supported by the CPU at runtime.
+ */
+TOOLS_DLLPUBLIC bool isCpuInstructionSetSupported(InstructionSetFlags eInstructions);
+
+/** Returns a string of supported instructions.
+ */
+TOOLS_DLLPUBLIC OUString instructionSetSupportedString();
+
+/** Check if SSE2 is supported by the CPU
+ */
+inline bool hasSSE2()
+{
+ return isCpuInstructionSetSupported(InstructionSetFlags::SSE2);
+}
+
+/** Check if SSSE3 is supported by the CPU
+ */
+inline bool hasSSSE3()
+{
+ return isCpuInstructionSetSupported(InstructionSetFlags::SSSE3);
+}
+
+/** Check if AVX is supported by the CPU
+ */
+inline bool hasAVX()
+{
+ return isCpuInstructionSetSupported(InstructionSetFlags::AVX);
+}
+
+/** Check if AVX2 is supported by the CPU
+ */
+inline bool hasAVX2()
+{
+ return isCpuInstructionSetSupported(InstructionSetFlags::AVX2);
+}
+
+/** Check if AVX512F is supported by the CPU
+ */
+inline bool hasAVX512F()
+{
+ return isCpuInstructionSetSupported(InstructionSetFlags::AVX512F);
+}
+
+/** Check if Hyper Threading is supported
+ */
+inline bool hasHyperThreading()
+{
+ return isCpuInstructionSetSupported(InstructionSetFlags::HYPER);
+}
+
+} // end cpuid
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/date.hxx b/include/tools/date.hxx
new file mode 100644
index 000000000..6179d637e
--- /dev/null
+++ b/include/tools/date.hxx
@@ -0,0 +1,259 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_DATE_HXX
+#define INCLUDED_TOOLS_DATE_HXX
+
+#include <tools/toolsdllapi.h>
+
+#include <ostream>
+
+#include <com/sun/star/util/Date.hpp>
+
+namespace com::sun::star::util { struct DateTime; }
+
+enum DayOfWeek { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,
+ SATURDAY, SUNDAY };
+
+/** Represents a date in the proleptic Gregorian calendar.
+
+ Largest representable date is 32767-12-31 = 327671231
+
+ Smallest representable date is -32768-01-01 = -327680101
+
+ Due to possible conversions to css::util::Date, which has a short
+ Year member variable, these limits are fix.
+
+ Year value 0 is unused. The year before year 1 CE is year 1 BCE, which is
+ the traditional proleptic Gregorian calendar.
+
+ This is not how ISO 8601:2000 defines things (but ISO 8601:1998 Draft
+ Revision did), but it enables class Date to be used for writing XML files
+ as XML Schema Part 2 in D.3.2 No Year Zero says
+ "The year "0000" is an illegal year value.", see
+ https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#noYearZero
+ and furthermore the note for 3.2.7 dateTime
+ https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#dateTime
+
+ */
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Date
+{
+private:
+ sal_Int32 mnDate;
+ void setDateFromDMY( sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear );
+
+public:
+ enum DateInitSystem
+ {
+ SYSTEM
+ };
+
+ enum DateInitEmpty
+ {
+ EMPTY
+ };
+
+ explicit Date( DateInitEmpty ) : mnDate(0) {}
+ explicit Date( DateInitSystem );
+ explicit Date( sal_Int32 nDate ) : mnDate(nDate) {}
+ Date( const Date& rDate ) : mnDate(rDate.mnDate) {}
+
+ /** nDay and nMonth both must be <100, nYear must be != 0 */
+ Date( sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear )
+ { setDateFromDMY(nDay, nMonth, nYear); }
+
+ Date( const css::util::Date& rUDate )
+ {
+ setDateFromDMY(rUDate.Day, rUDate.Month, rUDate.Year);
+ }
+ Date( const css::util::DateTime& _rDateTime );
+
+ bool IsEmpty() const { return mnDate == 0; }
+
+ void SetDate( sal_Int32 nNewDate );
+ sal_Int32 GetDate() const { return mnDate; }
+ /** Type safe access for values that are guaranteed to be unsigned, like Date::SYSTEM. */
+ sal_uInt32 GetDateUnsigned() const { return static_cast<sal_uInt32>(mnDate < 0 ? -mnDate : mnDate); }
+ css::util::Date GetUNODate() const { return css::util::Date(GetDay(), GetMonth(), GetYear()); }
+
+ /** nNewDay must be <100 */
+ void SetDay( sal_uInt16 nNewDay );
+ /** nNewMonth must be <100 */
+ void SetMonth( sal_uInt16 nNewMonth );
+ /** nNewYear must be != 0 */
+ void SetYear( sal_Int16 nNewYear );
+
+ sal_uInt16 GetDay() const
+ {
+ return mnDate < 0 ?
+ static_cast<sal_uInt16>(-mnDate % 100) :
+ static_cast<sal_uInt16>( mnDate % 100);
+ }
+ sal_uInt16 GetMonth() const
+ {
+ return mnDate < 0 ?
+ static_cast<sal_uInt16>((-mnDate / 100) % 100) :
+ static_cast<sal_uInt16>(( mnDate / 100) % 100);
+ }
+ sal_Int16 GetYear() const { return static_cast<sal_Int16>(mnDate / 10000); }
+ /** Type safe access for values that are guaranteed to be unsigned, like Date::SYSTEM. */
+ sal_uInt16 GetYearUnsigned() const { return static_cast<sal_uInt16>((mnDate < 0 ? -mnDate : mnDate) / 10000); }
+ sal_Int16 GetNextYear() const { sal_Int16 nY = GetYear(); return nY == -1 ? 1 : nY + 1; }
+ sal_Int16 GetPrevYear() const { sal_Int16 nY = GetYear(); return nY == 1 ? -1 : nY - 1; }
+
+ /** Add years skipping year 0 and truncating at limits. If the original
+ date was on Feb-29 and the resulting date is not a leap year, the
+ result is adjusted to Feb-28.
+ */
+ void AddYears( sal_Int16 nAddYears );
+
+ /** Add months skipping year 0 and truncating at limits. If the original
+ date was on Feb-29 or day 31 and the resulting date is not a leap year
+ or a month with fewer days, the result is adjusted to Feb-28 or day 30.
+ */
+ void AddMonths( sal_Int32 nAddMonths );
+
+ /** Add days skipping year 0 and truncating at limits.
+ */
+ void AddDays( sal_Int32 nAddDays );
+
+ /** Obtain the day of the week for the date.
+
+ Internally normalizes a copy of values.
+ The result may be unexpected for a non-normalized invalid date like
+ Date(31,11,2000) or a sequence of aDate.SetDay(31); aDate.SetMonth(11);
+ */
+ DayOfWeek GetDayOfWeek() const;
+
+ /** Obtain the day of the year for the date.
+
+ Internally normalizes a copy of values.
+ The result may be unexpected for a non-normalized invalid date like
+ Date(31,11,2000) or a sequence of aDate.SetDay(31); aDate.SetMonth(11);
+ */
+ sal_uInt16 GetDayOfYear() const;
+
+ /** Obtain the week of the year for a date.
+
+ @param nMinimumNumberOfDaysInWeek
+ How many days of a week must reside in the first week of a year.
+
+ Internally normalizes a copy of values.
+ The result may be unexpected for a non-normalized invalid date like
+ Date(31,11,2000) or a sequence of aDate.SetDay(31); aDate.SetMonth(11);
+ */
+ sal_uInt16 GetWeekOfYear( DayOfWeek eStartDay = MONDAY,
+ sal_Int16 nMinimumNumberOfDaysInWeek = 4 ) const;
+
+ /** Obtain the number of days in the month of the year of the date.
+
+ Internally normalizes a copy of values.
+
+ The result may be unexpected for a non-normalized invalid date like
+ Date(31,11,2000) or a sequence of aDate.SetDay(31); aDate.SetMonth(11);
+
+ These would result in 31 as --11-31 rolls over to --12-01 and the
+ number of days in December is returned.
+
+ Instead, to obtain the value for the actual set use the static method
+ Date::GetDaysInMonth( aDate.GetMonth(), aDate.GetYear()) in such cases.
+ */
+ sal_uInt16 GetDaysInMonth() const;
+
+ sal_uInt16 GetDaysInYear() const { return (IsLeapYear()) ? 366 : 365; }
+ bool IsLeapYear() const;
+
+ /** If the represented date is valid (1<=month<=12, 1<=day<=(28,29,30,31)
+ depending on month/year) AND is of the Gregorian calendar (1582-10-15
+ <= date)
+ */
+ bool IsValidAndGregorian() const;
+
+ /** If the represented date is valid (1<=month<=12, 1<=day<=(28,29,30,31)
+ depending on month/year) */
+ bool IsValidDate() const;
+
+ // Returns true, if the date is the end of the month, false otherwise.
+ bool IsEndOfMonth() const;
+
+ /** Normalize date, invalid day or month values are adapted such that they
+ carry over to the next month or/and year, for example 1999-02-32
+ becomes 1999-03-04, 1999-13-01 becomes 2000-01-01, 1999-13-42 becomes
+ 2000-02-11. Truncates at -32768-01-01 or 32767-12-31, 0001-00-x will
+ yield the normalized value of -0001-12-x
+
+ This may be necessary after Date ctors or if the SetDate(), SetDay(),
+ SetMonth(), SetYear() methods set individual non-matching values.
+ Adding/subtracting to/from dates never produces invalid dates.
+ */
+ void Normalize();
+
+ bool IsBetween( const Date& rFrom, const Date& rTo ) const
+ { return ((mnDate >= rFrom.mnDate) &&
+ (mnDate <= rTo.mnDate)); }
+
+ bool operator ==( const Date& rDate ) const
+ { return (mnDate == rDate.mnDate); }
+ bool operator !=( const Date& rDate ) const
+ { return (mnDate != rDate.mnDate); }
+ bool operator >( const Date& rDate ) const
+ { return (mnDate > rDate.mnDate); }
+ bool operator <( const Date& rDate ) const
+ { return (mnDate < rDate.mnDate); }
+ bool operator >=( const Date& rDate ) const
+ { return (mnDate >= rDate.mnDate); }
+ bool operator <=( const Date& rDate ) const
+ { return (mnDate <= rDate.mnDate); }
+
+ Date& operator =( const Date& rDate )
+ { mnDate = rDate.mnDate; return *this; }
+ Date& operator =( const css::util::Date& rUDate )
+ { setDateFromDMY( rUDate.Day, rUDate.Month, rUDate.Year); return *this; }
+ Date& operator ++();
+ Date& operator --();
+
+ TOOLS_DLLPUBLIC friend Date operator +( const Date& rDate, sal_Int32 nDays );
+ TOOLS_DLLPUBLIC friend Date operator -( const Date& rDate, sal_Int32 nDays );
+ TOOLS_DLLPUBLIC friend sal_Int32 operator -( const Date& rDate1, const Date& rDate2 );
+
+ /** Obtain number of days in a month of a year.
+
+ Internally sanitizes nMonth to values 1 <= nMonth <= 12, does not
+ normalize values.
+ */
+ static sal_uInt16 GetDaysInMonth( sal_uInt16 nMonth, sal_Int16 nYear );
+
+ /// Internally normalizes values.
+ static sal_Int32 DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear );
+ /// Semantically identical to IsValidDate() member method.
+ static bool IsValidDate( sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear );
+ /// Semantically identical to IsEndOfMonth() member method.
+ static bool IsEndOfMonth(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear);
+ /// Semantically identical to Normalize() member method.
+ static bool Normalize( sal_uInt16 & rDay, sal_uInt16 & rMonth, sal_Int16 & rYear );
+
+ private:
+ /// An accelerated form of DateToDays on this date
+ sal_Int32 GetAsNormalizedDays() const;
+};
+
+TOOLS_DLLPUBLIC std::ostream& operator<<(std::ostream& os, const Date& rDate);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx
new file mode 100644
index 000000000..7b78b29bd
--- /dev/null
+++ b/include/tools/datetime.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_DATETIME_HXX
+#define INCLUDED_TOOLS_DATETIME_HXX
+
+#include <tools/toolsdllapi.h>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+
+#include <iomanip>
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC DateTime : public Date, public tools::Time
+{
+public:
+ enum DateTimeInitSystem
+ {
+ SYSTEM
+ };
+
+ enum DateTimeInitEmpty
+ {
+ EMPTY
+ };
+
+ explicit DateTime( DateTimeInitEmpty ) : Date( Date::EMPTY ), Time( Time::EMPTY ) {}
+ explicit DateTime( DateTimeInitSystem );
+ DateTime( const DateTime& rDateTime ) :
+ Date( rDateTime ), Time( rDateTime ) {}
+ DateTime( const Date& rDate ) : Date( rDate ), Time(0) {}
+ DateTime( const tools::Time& rTime ) : Date(0), Time( rTime ) {}
+ DateTime( const Date& rDate, const tools::Time& rTime ) :
+ Date( rDate ), Time( rTime ) {}
+ DateTime( const css::util::DateTime& rDateTime );
+
+ css::util::DateTime
+ GetUNODateTime() const
+ { return css::util::DateTime(GetNanoSec(), GetSec(), GetMin(), GetHour(),
+ GetDay(), GetMonth(), GetYear(), false); }
+
+ bool IsBetween( const DateTime& rFrom,
+ const DateTime& rTo ) const;
+
+ bool IsEqualIgnoreNanoSec( const DateTime& rDateTime ) const
+ {
+ if ( Date::operator!=( rDateTime ) )
+ return false;
+ return Time::IsEqualIgnoreNanoSec( rDateTime );
+ }
+
+ bool operator ==( const DateTime& rDateTime ) const
+ { return (Date::operator==( rDateTime ) &&
+ Time::operator==( rDateTime )); }
+ bool operator !=( const DateTime& rDateTime ) const
+ { return (Date::operator!=( rDateTime ) ||
+ Time::operator!=( rDateTime )); }
+ bool operator >( const DateTime& rDateTime ) const;
+ bool operator <( const DateTime& rDateTime ) const;
+ bool operator >=( const DateTime& rDateTime ) const;
+ bool operator <=( const DateTime& rDateTime ) const;
+
+ sal_Int64 GetSecFromDateTime( const Date& rDate ) const;
+
+ void ConvertToUTC() { *this -= Time::GetUTCOffset(); }
+ void ConvertToLocalTime() { *this += Time::GetUTCOffset(); }
+
+ void AddTime( double fTimeInDays );
+ DateTime& operator +=( const tools::Time& rTime );
+ DateTime& operator -=( const tools::Time& rTime );
+
+ TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, sal_Int32 nDays );
+ TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, sal_Int32 nDays );
+ TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, double fTimeInDays );
+ TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, double fTimeInDays )
+ { return operator+( rDateTime, -fTimeInDays ); }
+ TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, const tools::Time& rTime );
+ TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, const tools::Time& rTime );
+ TOOLS_DLLPUBLIC friend double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 );
+ TOOLS_DLLPUBLIC friend sal_Int64 operator -( const DateTime& rDateTime, const Date& rDate )
+ { return static_cast<const Date&>(rDateTime) - rDate; }
+
+ DateTime& operator =( const DateTime& rDateTime );
+ DateTime& operator =( const css::util::DateTime& rUDateTime );
+
+ void GetWin32FileDateTime( sal_uInt32 & rLower, sal_uInt32 & rUpper ) const;
+ static DateTime CreateFromWin32FileDateTime( sal_uInt32 rLower, sal_uInt32 rUpper );
+
+ /// Creates DateTime given a unix time, which is the number of seconds
+ /// elapsed since Jan 1st, 1970.
+ static DateTime CreateFromUnixTime( const double fSecondsSinceEpoch );
+};
+
+inline DateTime& DateTime::operator =( const DateTime& rDateTime )
+{
+ Date::operator=( rDateTime );
+ Time::operator=( rDateTime );
+ return *this;
+}
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const DateTime& datetime)
+{
+ return stream << datetime.GetYear() << '-' <<
+ std::setw(2) << std::setfill('0') << datetime.GetMonth() << '-' <<
+ std::setw(2) << std::setfill('0') << datetime.GetDay() << ' ' <<
+ std::setw(2) << std::setfill('0') << datetime.GetHour() << ':' <<
+ std::setw(2) << std::setfill('0') << datetime.GetMin() << ':' <<
+ std::setw(2) << std::setfill('0') << datetime.GetSec() << "." <<
+ std::setw(9) << std::setfill('0') << datetime.GetNanoSec();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/datetimeutils.hxx b/include/tools/datetimeutils.hxx
new file mode 100644
index 000000000..3df6229cb
--- /dev/null
+++ b/include/tools/datetimeutils.hxx
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TOOLS_DATETIMEUTILS_HXX
+#define INCLUDED_TOOLS_DATETIMEUTILS_HXX
+
+#include <tools/datetime.hxx>
+
+// This function converts a 'DateTime' object to an 'OString' object
+TOOLS_DLLPUBLIC OString DateTimeToOString(const DateTime& rDateTime);
+
+// This function converts a 'Date' object to an 'OString' object in ISO-8601 representation
+TOOLS_DLLPUBLIC OString DateToOString(const Date& rDate);
+
+// This function converts a 'Date' object to an 'OString' object in DD/MM/YYYY format
+TOOLS_DLLPUBLIC OString DateToDDMMYYYYOString(const Date& rDate);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/debug.hxx b/include/tools/debug.hxx
new file mode 100644
index 000000000..c72da4d06
--- /dev/null
+++ b/include/tools/debug.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_DEBUG_HXX
+#define INCLUDED_TOOLS_DEBUG_HXX
+
+#include <tools/toolsdllapi.h>
+
+#include <sal/detail/log.h>
+
+/** The facilities provided by this header are deprecated. True assertions
+ (that detect broken program logic) should use standard assert (which aborts
+ if an assertion fails, and is controlled by the standard NDEBUG macro).
+ Logging of warnings (e.g., about malformed input) should use the facilities
+ provided by sal/log.hxx.
+
+ Because the assertion macro (DBG_ASSERT) has been used for
+ true assertions as well as to log warnings, it maps to SAL_WARN instead of
+ standard assert.
+*/
+
+typedef void (*DbgTestSolarMutexProc)();
+
+TOOLS_DLLPUBLIC void DbgSetTestSolarMutex( DbgTestSolarMutexProc pParam );
+TOOLS_DLLPUBLIC void DbgTestSolarMutex();
+
+#ifndef NDEBUG
+// we want the solar mutex checking to be enabled in the assert-enabled builds that the QA people use
+
+#define DBG_TESTSOLARMUTEX() \
+do \
+{ \
+ DbgTestSolarMutex(); \
+} while(false)
+
+#else
+
+#define DBG_TESTSOLARMUTEX() ((void)0)
+
+#endif
+
+#define DBG_ASSERT( sCon, aError ) \
+ SAL_DETAIL_WARN_IF_FORMAT(!(sCon), "legacy.tools", "%s", aError)
+
+
+#endif // INCLUDED_TOOLS_DEBUG_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/degree.hxx b/include/tools/degree.hxx
new file mode 100644
index 000000000..560f9b115
--- /dev/null
+++ b/include/tools/degree.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <basegfx/numeric/ftools.hxx>
+#include <sal/types.h>
+#include <o3tl/strong_int.hxx>
+#include <o3tl/unit_conversion.hxx>
+#include <cstdlib>
+#include <math.h>
+#include <numeric>
+
+template <int N> struct FractionTag;
+// 1/Nth fraction of a degree
+template <typename I, int N> using Degree = o3tl::strong_int<I, FractionTag<N>>;
+
+template <typename I, int N> char (&NofDegree(Degree<I, N>))[N]; // helper
+// Nof<DegreeN> gives compile-time constant N, needed in templates
+template <class D> constexpr int Nof = sizeof(NofDegree(std::declval<D>()));
+
+/** tenths of a Degree, normally rotation */
+typedef Degree<sal_Int16, 10> Degree10;
+
+/** custom literal */
+constexpr Degree10 operator""_deg10(unsigned long long n) { return Degree10{ n }; }
+
+/** hundredths of a Degree, normally rotation */
+typedef Degree<sal_Int32, 100> Degree100;
+
+// Android has trouble calling the correct overload of std::abs
+#ifdef ANDROID
+inline Degree100 abs(Degree100 x) { return Degree100(std::abs(static_cast<int>(x.get()))); }
+#else
+inline Degree100 abs(Degree100 x) { return Degree100(std::abs(x.get())); }
+#endif
+
+/** custom literal */
+constexpr Degree100 operator""_deg100(unsigned long long n) { return Degree100{ n }; }
+
+/** conversion functions */
+
+template <class To, typename IofFrom, int NofFrom> inline To to(Degree<IofFrom, NofFrom> x)
+{
+ constexpr sal_Int64 m = Nof<To> / std::gcd(Nof<To>, NofFrom);
+ constexpr sal_Int64 d = NofFrom / std::gcd(Nof<To>, NofFrom);
+ return To{ o3tl::convert(x.get(), m, d) };
+}
+
+template <class D> inline double toRadians(D x) { return basegfx::deg2rad<Nof<D>>(x.get()); }
+template <class D> inline double toDegrees(D x) { return x.get() / static_cast<double>(Nof<D>); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/tools/diagnose_ex.h b/include/tools/diagnose_ex.h
new file mode 100644
index 000000000..cf25a9856
--- /dev/null
+++ b/include/tools/diagnose_ex.h
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_DIAGNOSE_EX_H
+#define INCLUDED_TOOLS_DIAGNOSE_EX_H
+
+#include <osl/diagnose.h>
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+
+#include <sal/log.hxx>
+#include <tools/toolsdllapi.h>
+#include <cppuhelper/exc_hlp.hxx>
+
+TOOLS_DLLPUBLIC void DbgUnhandledException(const css::uno::Any& caughtException,
+ const char* currentFunction, const char* fileAndLineNo,
+ const char* area, const char* explanatory = nullptr);
+
+//getCaughtException throws exceptions in never-going-to-happen situations which
+//floods coverity with warnings
+inline css::uno::Any DbgGetCaughtException()
+{
+#if defined(__COVERITY__)
+ try
+ {
+ return ::cppu::getCaughtException();
+ }
+ catch (...)
+ {
+ std::abort();
+ }
+#else
+ return ::cppu::getCaughtException();
+#endif
+}
+
+/** reports a caught UNO exception via OSL diagnostics
+
+ Note that whenever you use this, it might be an indicator that your error
+ handling is not correct...
+ This takes two optional parameters: area and explanatory
+*/
+#if defined SAL_LOG_WARN
+#define DBG_UNHANDLED_EXCEPTION_0_ARGS() \
+ DbgUnhandledException( DbgGetCaughtException(), __func__, SAL_DETAIL_WHERE );
+#define DBG_UNHANDLED_EXCEPTION_1_ARGS(area) \
+ DbgUnhandledException( DbgGetCaughtException(), __func__, SAL_DETAIL_WHERE, area );
+#define DBG_UNHANDLED_EXCEPTION_2_ARGS(area, explanatory) \
+ DbgUnhandledException( DbgGetCaughtException(), __func__, SAL_DETAIL_WHERE, area, explanatory );
+
+#define DBG_UNHANDLED_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
+#define DBG_UNHANDLED_FUNC_RECOMPOSER(argsWithParentheses) DBG_UNHANDLED_FUNC_CHOOSER argsWithParentheses
+#define DBG_UNHANDLED_CHOOSE_FROM_ARG_COUNT(...) DBG_UNHANDLED_FUNC_RECOMPOSER((__VA_ARGS__, DBG_UNHANDLED_EXCEPTION_2_ARGS, DBG_UNHANDLED_EXCEPTION_1_ARGS, DBG_UNHANDLED_EXCEPTION_0_ARGS, ))
+#define DBG_UNHANDLED_NO_ARG_EXPANDER() ,,DBG_UNHANDLED_EXCEPTION_0_ARGS
+#define DBG_UNHANDLED_MACRO_CHOOSER(...) DBG_UNHANDLED_CHOOSE_FROM_ARG_COUNT(DBG_UNHANDLED_NO_ARG_EXPANDER __VA_ARGS__ ())
+#define DBG_UNHANDLED_EXCEPTION(...) DBG_UNHANDLED_MACRO_CHOOSER(__VA_ARGS__)(__VA_ARGS__)
+#else // SAL_LOG_WARN
+#define DBG_UNHANDLED_EXCEPTION(...)
+#endif
+
+
+/** This macro asserts the given condition (in debug mode), and throws
+ an IllegalArgumentException afterwards.
+ */
+#define ENSURE_ARG_OR_THROW(c, m) if( !(c) ) { \
+ OSL_ENSURE(c, m); \
+ throw css::lang::IllegalArgumentException( \
+ __func__ \
+ + OUString::Concat(u",\n" m), \
+ css::uno::Reference< css::uno::XInterface >(), \
+ 0 ); }
+#define ENSURE_ARG_OR_THROW2(c, m, ifc, arg) if( !(c) ) { \
+ OSL_ENSURE(c, m); \
+ throw css::lang::IllegalArgumentException( \
+ __func__ \
+ + OUString::Concat(u",\n" m), \
+ ifc, \
+ arg ); }
+
+/** This macro asserts the given condition (in debug mode), and throws
+ a RuntimeException afterwards.
+ */
+#define ENSURE_OR_THROW(c, m) \
+ if( !(c) ){ \
+ OSL_ENSURE(c, m); \
+ throw css::uno::RuntimeException( \
+ __func__ + OUString::Concat(u",\n" m), \
+ css::uno::Reference< css::uno::XInterface >() ); }
+
+#define ENSURE_OR_THROW2(c, m, ifc) \
+ if( !(c) ) { \
+ OSL_ENSURE(c, m); \
+ throw css::uno::RuntimeException( \
+ __func__ + OUString::Concat(u",\n" m), \
+ ifc ); }
+
+/** This macro asserts the given condition (in debug mode), and
+ returns the given value afterwards.
+ */
+#define ENSURE_OR_RETURN(c, m, r) if( !(c) ) { \
+ OSL_ENSURE(c, m); \
+ return r; }
+
+/** This macro asserts the given condition (in debug mode), and
+ returns false afterwards.
+ */
+#define ENSURE_OR_RETURN_FALSE(c, m) \
+ ENSURE_OR_RETURN(c, m, false)
+
+/** This macro asserts the given condition (in debug mode), and
+ returns afterwards, without return value "void".
+ */
+#define ENSURE_OR_RETURN_VOID( c, m ) \
+ if( !(c) ) \
+ { \
+ OSL_ENSURE( c, m ); \
+ return; \
+ }
+
+/** Convert a caught exception to a string suitable for logging.
+*/
+TOOLS_DLLPUBLIC OString exceptionToString(css::uno::Any const & caughtEx);
+
+/**
+ Logs an message along with a nicely formatted version of the current exception.
+ This must be called as the FIRST thing in a catch block.
+*/
+#if defined SAL_LOG_WARN
+#define TOOLS_WARN_EXCEPTION(area, stream) \
+ do { \
+ css::uno::Any tools_warn_exception( DbgGetCaughtException() ); \
+ SAL_WARN(area, stream << " " << exceptionToString(tools_warn_exception)); \
+ } while (false)
+#else
+#define TOOLS_WARN_EXCEPTION(area, stream) \
+ do { \
+ SAL_WARN(area, stream); \
+ } while (false)
+#endif
+
+/**
+ Logs an message along with a nicely formatted version of the current exception.
+ This must be called as the FIRST thing in a catch block.
+*/
+#if defined SAL_LOG_WARN
+#define TOOLS_WARN_EXCEPTION_IF(cond, area, stream) \
+ do { \
+ css::uno::Any tools_warn_exception( DbgGetCaughtException() ); \
+ SAL_WARN_IF(cond, area, stream << " " << exceptionToString(tools_warn_exception)); \
+ } while (false)
+#else
+#define TOOLS_WARN_EXCEPTION_IF(cond, area, stream) \
+ do { \
+ SAL_WARN_IF(cond, area, stream); \
+ } while (false)
+#endif
+
+/**
+ Logs an message along with a nicely formatted version of the current exception.
+ This must be called as the FIRST thing in a catch block.
+*/
+#if defined SAL_LOG_INFO
+#define TOOLS_INFO_EXCEPTION(area, stream) \
+ do { \
+ css::uno::Any tools_warn_exception( DbgGetCaughtException() ); \
+ SAL_INFO(area, stream << " " << exceptionToString(tools_warn_exception)); \
+ } while (false)
+#else
+#define TOOLS_INFO_EXCEPTION(area, stream) \
+ do { \
+ SAL_INFO(area, stream); \
+ } while (false)
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/extendapplicationenvironment.hxx b/include/tools/extendapplicationenvironment.hxx
new file mode 100644
index 000000000..0ca8ceca4
--- /dev/null
+++ b/include/tools/extendapplicationenvironment.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_EXTENDAPPLICATIONENVIRONMENT_HXX
+#define INCLUDED_TOOLS_EXTENDAPPLICATIONENVIRONMENT_HXX
+
+#include <sal/config.h>
+#include <tools/toolsdllapi.h>
+
+namespace tools
+{
+// Extend the environment of the process in a platform specific way as necessary
+// for OOo-related applications; must be called first thing in main:
+TOOLS_DLLPUBLIC void extendApplicationEnvironment();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/fileutil.hxx b/include/tools/fileutil.hxx
new file mode 100644
index 000000000..d2ed87a6d
--- /dev/null
+++ b/include/tools/fileutil.hxx
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TOOLS_FILEUTIL_HXX
+#define INCLUDED_TOOLS_FILEUTIL_HXX
+
+#include <tools/toolsdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace tools
+{
+// Tests if the path is a UNC or local (drive-based) path that redirects to
+// a WebDAV resource (e.g., using redirectors on Windows).
+// Currently only implemented for Windows; on other platforms, returns false.
+TOOLS_DLLPUBLIC bool IsMappedWebDAVPath(const OUString& rURL, OUString* pRealURL = nullptr);
+}
+
+#endif // INCLUDED_TOOLS_FILEUTIL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/fix16.hxx b/include/tools/fix16.hxx
new file mode 100644
index 000000000..99de89b28
--- /dev/null
+++ b/include/tools/fix16.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * libfixmath is Copyright (c) 2011-2021 Flatmush <Flatmush@gmail.com>,
+ * Petteri Aimonen <Petteri.Aimonen@gmail.com>, & libfixmath AUTHORS
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#include <tools/toolsdllapi.h>
+#include <stdint.h>
+
+typedef int32_t fix16_t;
+
+/*! Multiplies the two given fix16_t's and returns the result.
+*/
+TOOLS_DLLPUBLIC fix16_t fix16_mul(fix16_t inArg0, fix16_t inArg1);
+
+/*! Divides the first given fix16_t by the second and returns the result.
+*/
+TOOLS_DLLPUBLIC fix16_t fix16_div(fix16_t inArg0, fix16_t inArg1);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/tools/fldunit.hxx b/include/tools/fldunit.hxx
new file mode 100644
index 000000000..a2838c32f
--- /dev/null
+++ b/include/tools/fldunit.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_FLDUNIT_HXX
+#define INCLUDED_TOOLS_FLDUNIT_HXX
+
+#include <sal/types.h>
+
+// Corresponds to offapi/com/sun/star/awt/FieldUnit.idl
+enum class FieldUnit : sal_uInt16
+{
+ NONE,
+ MM,
+ CM,
+ M,
+ KM,
+ TWIP,
+ POINT,
+ PICA,
+ INCH,
+ FOOT,
+ MILE,
+ CUSTOM,
+ PERCENT,
+ MM_100TH,
+ CHAR,
+ LINE,
+ PIXEL,
+ DEGREE,
+ SECOND,
+ MILLISECOND,
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/fontenum.hxx b/include/tools/fontenum.hxx
new file mode 100644
index 000000000..5fac8dfdb
--- /dev/null
+++ b/include/tools/fontenum.hxx
@@ -0,0 +1,457 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_FONTENUM_HXX
+#define INCLUDED_TOOLS_FONTENUM_HXX
+
+#include <sal/types.h>
+#include <sal/log.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <ostream>
+
+enum FontFamily { FAMILY_DONTKNOW, FAMILY_DECORATIVE, FAMILY_MODERN,
+ FAMILY_ROMAN, FAMILY_SCRIPT, FAMILY_SWISS, FAMILY_SYSTEM, FontFamily_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, FontFamily const& family)
+{
+ switch (family)
+ {
+ case FAMILY_DONTKNOW:
+ return stream << "unknown";
+
+ case FAMILY_DECORATIVE:
+ return stream << "decorative";
+
+ case FAMILY_MODERN:
+ return stream << "modern";
+
+ case FAMILY_ROMAN:
+ return stream << "roman";
+
+ case FAMILY_SCRIPT:
+ return stream << "script";
+
+ case FAMILY_SWISS:
+ return stream << "swiss";
+
+ case FAMILY_SYSTEM:
+ return stream << "system";
+
+ default:
+ SAL_WARN("vcl.gdi", "FontFamily out of bounds");
+ assert(false && "FontFamily out of bounds");
+ return stream << "unknown";
+ }
+}
+
+enum FontPitch { PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, FontPitch_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, FontPitch const& pitch)
+{
+ switch (pitch)
+ {
+ case PITCH_DONTKNOW:
+ return stream << "unknown";
+
+ case PITCH_FIXED:
+ return stream << "fixed";
+
+ case PITCH_VARIABLE:
+ return stream << "variable";
+
+ default:
+ SAL_WARN("vcl.gdi", "FontPitch out of bounds");
+ assert(false && "FontPitch out of bounds");
+ return stream << "unknown";
+ }
+}
+
+enum TextAlign { ALIGN_TOP, ALIGN_BASELINE, ALIGN_BOTTOM, TextAlign_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, TextAlign const& align)
+{
+ switch (align)
+ {
+ case ALIGN_TOP:
+ return stream << "top";
+
+ case ALIGN_BASELINE:
+ return stream << "baseline";
+
+ case ALIGN_BOTTOM:
+ return stream << "bottom";
+
+ default:
+ SAL_WARN("vcl.gdi", "TextAlign out of bounds");
+ assert(false && "TextAlign out of bounds");
+ return stream << "unknown";
+ }
+}
+
+enum FontWeight { WEIGHT_DONTKNOW, WEIGHT_THIN, WEIGHT_ULTRALIGHT,
+ WEIGHT_LIGHT, WEIGHT_SEMILIGHT, WEIGHT_NORMAL,
+ WEIGHT_MEDIUM, WEIGHT_SEMIBOLD, WEIGHT_BOLD,
+ WEIGHT_ULTRABOLD, WEIGHT_BLACK, FontWeight_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, FontWeight const& weight)
+{
+ switch (weight)
+ {
+ case WEIGHT_DONTKNOW:
+ return stream << "unknown";
+
+ case WEIGHT_THIN:
+ return stream << "thin";
+
+ case WEIGHT_ULTRALIGHT:
+ return stream << "ultralight";
+
+ case WEIGHT_LIGHT:
+ return stream << "light";
+
+ case WEIGHT_SEMILIGHT:
+ return stream << "semilight";
+
+ case WEIGHT_NORMAL:
+ return stream << "normal";
+
+ case WEIGHT_MEDIUM:
+ return stream << "medium";
+
+ case WEIGHT_SEMIBOLD:
+ return stream << "semibold";
+
+ case WEIGHT_BOLD:
+ return stream << "bold";
+
+ case WEIGHT_ULTRABOLD:
+ return stream << "ultrabold";
+
+ case WEIGHT_BLACK:
+ return stream << "black";
+
+ default:
+ SAL_WARN("vcl.gdi", "FontWeight out of bounds");
+ assert(false && "FontWeight out of bounds");
+ return stream << "unknown";
+ }
+}
+
+enum FontWidth { WIDTH_DONTKNOW, WIDTH_ULTRA_CONDENSED, WIDTH_EXTRA_CONDENSED,
+ WIDTH_CONDENSED, WIDTH_SEMI_CONDENSED, WIDTH_NORMAL,
+ WIDTH_SEMI_EXPANDED, WIDTH_EXPANDED, WIDTH_EXTRA_EXPANDED,
+ WIDTH_ULTRA_EXPANDED,
+ FontWidth_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, FontWidth const& width)
+{
+ switch (width)
+ {
+ case WIDTH_DONTKNOW:
+ return stream << "unknown";
+
+ case WIDTH_ULTRA_CONDENSED:
+ return stream << "ultra condensed";
+
+ case WIDTH_EXTRA_CONDENSED:
+ return stream << "extra ultra condensed";
+
+ case WIDTH_CONDENSED:
+ return stream << "condensed";
+
+ case WIDTH_SEMI_CONDENSED:
+ return stream << "semi condensed";
+
+ case WIDTH_NORMAL:
+ return stream << "normal";
+
+ case WIDTH_SEMI_EXPANDED:
+ return stream << "semi expanded";
+
+ case WIDTH_EXPANDED:
+ return stream << "expanded";
+
+ case WIDTH_EXTRA_EXPANDED:
+ return stream << "extra expanded";
+
+ case WIDTH_ULTRA_EXPANDED:
+ return stream << "ultra expanded";
+
+ default:
+ SAL_WARN("vcl.gdi", "FontWidth out of bounds");
+ assert(false && "FontWidth out of bounds");
+ return stream << "unknown";
+ }
+}
+
+enum FontItalic { ITALIC_NONE, ITALIC_OBLIQUE, ITALIC_NORMAL, ITALIC_DONTKNOW, FontItalic_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, FontItalic const& italic)
+{
+ switch (italic)
+ {
+ case ITALIC_DONTKNOW:
+ return stream << "unknown";
+
+ case ITALIC_OBLIQUE:
+ return stream << "oblique";
+
+ case ITALIC_NORMAL:
+ return stream << "normal";
+
+ case ITALIC_NONE:
+ return stream << "none";
+
+ default:
+ SAL_WARN("vcl.gdi", "FontItalic out of bounds");
+ assert(false && "FontItalic out of bounds");
+ return stream << "unknown";
+ }
+}
+
+enum FontLineStyle { LINESTYLE_NONE, LINESTYLE_SINGLE, LINESTYLE_DOUBLE,
+ LINESTYLE_DOTTED, LINESTYLE_DONTKNOW,
+ LINESTYLE_DASH, LINESTYLE_LONGDASH,
+ LINESTYLE_DASHDOT, LINESTYLE_DASHDOTDOT,
+ LINESTYLE_SMALLWAVE,
+ LINESTYLE_WAVE, LINESTYLE_DOUBLEWAVE,
+ LINESTYLE_BOLD, LINESTYLE_BOLDDOTTED,
+ LINESTYLE_BOLDDASH, LINESTYLE_BOLDLONGDASH,
+ LINESTYLE_BOLDDASHDOT, LINESTYLE_BOLDDASHDOTDOT,
+ LINESTYLE_BOLDWAVE,
+ FontLineStyle_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, FontLineStyle const& linestyle)
+{
+ switch (linestyle)
+ {
+ case LINESTYLE_NONE:
+ return stream << "none";
+
+ case LINESTYLE_SINGLE:
+ return stream << "single";
+
+ case LINESTYLE_DOUBLE:
+ return stream << "double";
+
+ case LINESTYLE_DOTTED:
+ return stream << "dotted";
+
+ case LINESTYLE_DONTKNOW:
+ return stream << "unknown";
+
+ case LINESTYLE_DASH:
+ return stream << "dash";
+
+ case LINESTYLE_LONGDASH:
+ return stream << "long dash";
+
+ case LINESTYLE_DASHDOT:
+ return stream << "dash dot";
+
+ case LINESTYLE_DASHDOTDOT:
+ return stream << "dash dot dot";
+
+ case LINESTYLE_SMALLWAVE:
+ return stream << "small wave";
+
+ case LINESTYLE_WAVE:
+ return stream << "wave";
+
+ case LINESTYLE_DOUBLEWAVE:
+ return stream << "double wave";
+
+ case LINESTYLE_BOLD:
+ return stream << "bold";
+
+ case LINESTYLE_BOLDDOTTED:
+ return stream << "bold dotted";
+
+ case LINESTYLE_BOLDDASH:
+ return stream << "bold dash";
+
+ case LINESTYLE_BOLDLONGDASH:
+ return stream << "bold long dash";
+
+ case LINESTYLE_BOLDDASHDOT:
+ return stream << "bold dash dot";
+
+ case LINESTYLE_BOLDDASHDOTDOT:
+ return stream << "bold dash dot dot";
+
+ case LINESTYLE_BOLDWAVE:
+ return stream << "bold wave";
+
+ default:
+ SAL_WARN("vcl.gdi", "FontLineStyle out of bounds");
+ assert(false && "FontLineStyle out of bounds");
+ return stream << "unknown";
+ }
+}
+
+enum FontStrikeout { STRIKEOUT_NONE, STRIKEOUT_SINGLE, STRIKEOUT_DOUBLE,
+ STRIKEOUT_DONTKNOW, STRIKEOUT_BOLD,
+ STRIKEOUT_SLASH, STRIKEOUT_X,
+ FontStrikeout_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, FontStrikeout const& strikeout)
+{
+ switch (strikeout)
+ {
+ case STRIKEOUT_NONE:
+ return stream << "none";
+
+ case STRIKEOUT_SINGLE:
+ return stream << "single";
+
+ case STRIKEOUT_DOUBLE:
+ return stream << "double";
+
+ case STRIKEOUT_DONTKNOW:
+ return stream << "unknown";
+
+ case STRIKEOUT_BOLD:
+ return stream << "bold";
+
+ case STRIKEOUT_SLASH:
+ return stream << "slash";
+
+ case STRIKEOUT_X:
+ return stream << "x";
+
+ default:
+ SAL_WARN("vcl.gdi", "FontStrikeout out of bounds");
+ assert(false && "FontStrikeout out of bounds");
+ return stream << "unknown";
+ }
+}
+
+enum class FontEmphasisMark {
+ NONE = 0x0000, // capitalisation to avoid conflict with X11 macro
+ Dot = 0x0001,
+ Circle = 0x0002,
+ Disc = 0x0003,
+ Accent = 0x0004,
+ Style = 0x000f,
+ PosAbove = 0x1000,
+ PosBelow = 0x2000
+};
+namespace o3tl
+{
+ template<> struct typed_flags<FontEmphasisMark> : is_typed_flags<FontEmphasisMark, 0x300f> {};
+}
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, FontEmphasisMark const& emphasismark)
+{
+ switch (emphasismark)
+ {
+ case FontEmphasisMark::NONE:
+ return stream << "none";
+
+ case FontEmphasisMark::Dot:
+ return stream << "Dot";
+
+ case FontEmphasisMark::Circle:
+ return stream << "Circle";
+
+ case FontEmphasisMark::Disc:
+ return stream << "Disc";
+
+ case FontEmphasisMark::Accent:
+ return stream << "Accent";
+
+ case FontEmphasisMark::Style:
+ return stream << "Style";
+
+ case FontEmphasisMark::PosAbove:
+ return stream << "PosAbove";
+
+ case FontEmphasisMark::PosBelow:
+ return stream << "PosBelow";
+
+ default:
+ SAL_WARN("vcl.gdi", "FontEmphasisMark out of bounds");
+ assert(false && "FontEmphasisMark out of bounds");
+ return stream << "unknown";
+ }
+}
+
+enum FontEmbeddedBitmap { EMBEDDEDBITMAP_DONTKNOW, EMBEDDEDBITMAP_FALSE, EMBEDDEDBITMAP_TRUE };
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, FontEmbeddedBitmap const& embeddedbitmap)
+{
+ switch (embeddedbitmap)
+ {
+ case EMBEDDEDBITMAP_DONTKNOW:
+ return stream << "unknown";
+
+ case EMBEDDEDBITMAP_FALSE:
+ return stream << "false";
+
+ case EMBEDDEDBITMAP_TRUE:
+ return stream << "true";
+ }
+
+ return stream << "unknown";
+}
+
+enum FontAntiAlias { ANTIALIAS_DONTKNOW, ANTIALIAS_FALSE, ANTIALIAS_TRUE };
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, FontAntiAlias const& antialias)
+{
+ switch (antialias)
+ {
+ case ANTIALIAS_DONTKNOW:
+ return stream << "unknown";
+
+ case ANTIALIAS_FALSE:
+ return stream << "false";
+
+ case ANTIALIAS_TRUE:
+ return stream << "true";
+ }
+
+ return stream << "unknown";
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/fract.hxx b/include/tools/fract.hxx
new file mode 100644
index 000000000..c844f8eed
--- /dev/null
+++ b/include/tools/fract.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_FRACT_HXX
+#define INCLUDED_TOOLS_FRACT_HXX
+
+#include <sal/types.h>
+#include <tools/toolsdllapi.h>
+#include <tools/long.hxx>
+#include <ostream>
+#include <type_traits>
+
+class SvStream;
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Fraction final
+{
+ /// these two fields form a boost::rational, but I didn't want to put more boost headers into the global space
+ sal_Int32 mnNumerator = 0;
+ sal_Int32 mnDenominator = 1;
+ bool mbValid = true;
+public:
+ Fraction() = default;
+ Fraction( const Fraction & rFrac ) = default;
+ Fraction( Fraction && rFrac ) = default;
+ explicit Fraction( double dVal );
+ Fraction( double nNum, double nDen );
+ Fraction( sal_Int64 nNum, sal_Int64 nDen );
+ // just to prevent ambiguity between the sal_Int64 and double constructors
+ template<typename T1, typename T2> Fraction(
+ T1 nNum, T2 nDen,
+ typename std::enable_if<std::is_integral<T1>::value && std::is_integral<T2>::value, int>::type = 0)
+ : Fraction( sal_Int64(nNum), sal_Int64(nDen) ) {}
+
+ bool IsValid() const { return mbValid; }
+
+ sal_Int32 GetNumerator() const;
+ sal_Int32 GetDenominator() const;
+
+ explicit operator sal_Int32() const;
+#if SAL_TYPES_SIZEOFPOINTER == 8
+ explicit operator ::tools::Long() const { return operator sal_Int32(); }
+#endif
+ explicit operator double() const;
+
+ Fraction& operator=( const Fraction& rfrFrac ) = default;
+ Fraction& operator=( Fraction&& rfrFrac ) = default;
+ Fraction& operator=( double v ) { return operator=(Fraction(v)); }
+
+ Fraction& operator+=( const Fraction& rfrFrac );
+ Fraction& operator-=( const Fraction& rfrFrac );
+ Fraction& operator*=( const Fraction& rfrFrac );
+ Fraction& operator/=( const Fraction& rfrFrac );
+ Fraction& operator+=( double v ) { return operator+=(Fraction(v)); }
+ Fraction& operator-=( double v ) { return operator-=(Fraction(v)); }
+ Fraction& operator*=( double v ) { return operator*=(Fraction(v)); }
+ Fraction& operator/=( double v ) { return operator/=(Fraction(v)); }
+
+ void ReduceInaccurate( unsigned nSignificantBits );
+
+ // Compute value usable as hash.
+ size_t GetHashValue() const;
+
+ TOOLS_DLLPUBLIC friend Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 );
+ TOOLS_DLLPUBLIC friend Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 );
+ TOOLS_DLLPUBLIC friend Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 );
+ TOOLS_DLLPUBLIC friend Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 );
+
+ TOOLS_DLLPUBLIC friend bool operator==( const Fraction& rVal1, const Fraction& rVal2 );
+ TOOLS_DLLPUBLIC friend bool operator!=( const Fraction& rVal1, const Fraction& rVal2 );
+ TOOLS_DLLPUBLIC friend bool operator< ( const Fraction& rVal1, const Fraction& rVal2 );
+ TOOLS_DLLPUBLIC friend bool operator> ( const Fraction& rVal1, const Fraction& rVal2 );
+ TOOLS_DLLPUBLIC friend bool operator<=( const Fraction& rVal1, const Fraction& rVal2 );
+ TOOLS_DLLPUBLIC friend bool operator>=( const Fraction& rVal1, const Fraction& rVal2 );
+};
+
+TOOLS_DLLPUBLIC Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 );
+TOOLS_DLLPUBLIC Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 );
+TOOLS_DLLPUBLIC Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 );
+TOOLS_DLLPUBLIC Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 );
+TOOLS_DLLPUBLIC bool operator !=( const Fraction& rVal1, const Fraction& rVal2 );
+TOOLS_DLLPUBLIC bool operator <=( const Fraction& rVal1, const Fraction& rVal2 );
+TOOLS_DLLPUBLIC bool operator >=( const Fraction& rVal1, const Fraction& rVal2 );
+
+inline Fraction operator+( double v1, const Fraction& rVal2 ) { return Fraction(v1) + rVal2; }
+inline Fraction operator-( double v1, const Fraction& rVal2 ) { return Fraction(v1) - rVal2; }
+inline Fraction operator*( double v1, const Fraction& rVal2 ) { return Fraction(v1) * rVal2; }
+inline Fraction operator/( double v1, const Fraction& rVal2 ) { return Fraction(v1) / rVal2; }
+
+inline Fraction operator+( const Fraction& rVal1, double v2 ) { return rVal1 + Fraction(v2); }
+inline Fraction operator-( const Fraction& rVal1, double v2 ) { return rVal1 - Fraction(v2); }
+inline Fraction operator*( const Fraction& rVal1, double v2 ) { return rVal1 * Fraction(v2); }
+inline Fraction operator/( const Fraction& rVal1, double v2 ) { return rVal1 / Fraction(v2); }
+
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & rStream, const Fraction& rFraction)
+{
+ rStream << "(" << rFraction.GetNumerator() << "/" << rFraction.GetDenominator() << ")";
+ return rStream;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
new file mode 100644
index 000000000..20da07cb9
--- /dev/null
+++ b/include/tools/gen.hxx
@@ -0,0 +1,793 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_GEN_HXX
+#define INCLUDED_TOOLS_GEN_HXX
+
+#include <tools/toolsdllapi.h>
+
+#include <tools/long.hxx>
+#include <tools/degree.hxx>
+#include <limits.h>
+#include <algorithm>
+#include <ostream>
+#include <config_options.h>
+#include <o3tl/unit_conversion.hxx>
+
+class SvStream;
+namespace rtl
+{
+ class OString;
+}
+
+enum TriState { TRISTATE_FALSE, TRISTATE_TRUE, TRISTATE_INDET };
+
+// Pair
+
+class SAL_WARN_UNUSED Pair
+{
+public:
+ constexpr Pair() : nA(0), nB(0) {}
+ constexpr Pair( tools::Long _nA, tools::Long _nB ) : nA(_nA), nB(_nB) {}
+
+ tools::Long A() const { return nA; }
+ tools::Long B() const { return nB; }
+
+ tools::Long& A() { return nA; }
+ tools::Long& B() { return nB; }
+
+ TOOLS_DLLPUBLIC rtl::OString toString() const;
+
+ // Compute value usable as hash.
+ TOOLS_DLLPUBLIC size_t GetHashValue() const;
+
+protected:
+ tools::Long nA;
+ tools::Long nB;
+};
+
+namespace tools::detail {
+
+// Used to implement operator == for subclasses of Pair:
+inline bool equal(Pair const & p1, Pair const & p2)
+{
+ return p1.A() == p2.A() && p1.B() == p2.B();
+}
+
+}
+
+// Point
+
+class Size;
+class SAL_WARN_UNUSED UNLESS_MERGELIBS(SAL_DLLPUBLIC_EXPORT) Point final : protected Pair
+{
+public:
+ constexpr Point() {}
+ constexpr Point( tools::Long nX, tools::Long nY ) : Pair( nX, nY ) {}
+
+ constexpr tools::Long X() const { return nA; }
+ constexpr tools::Long Y() const { return nB; }
+
+ void Move( tools::Long nHorzMove, tools::Long nVertMove );
+ void Move( Size const & s );
+ tools::Long AdjustX( tools::Long nHorzMove ) { nA += nHorzMove; return nA; }
+ tools::Long AdjustY( tools::Long nVertMove ) { nB += nVertMove; return nB; }
+
+ void RotateAround( tools::Long& rX, tools::Long& rY, Degree10 nOrientation ) const;
+ void RotateAround( Point&, Degree10 nOrientation ) const;
+
+ Point& operator += ( const Point& rPoint );
+ Point& operator -= ( const Point& rPoint );
+ Point& operator *= ( const tools::Long nVal );
+ Point& operator /= ( const tools::Long nVal );
+
+ friend inline Point operator+( const Point &rVal1, const Point &rVal2 );
+ friend inline Point operator-( const Point &rVal1, const Point &rVal2 );
+ friend inline Point operator*( const Point &rVal1, const tools::Long nVal2 );
+ friend inline Point operator/( const Point &rVal1, const tools::Long nVal2 );
+
+ constexpr tools::Long getX() const { return X(); }
+ constexpr tools::Long getY() const { return Y(); }
+ void setX(tools::Long nX) { nA = nX; }
+ void setY(tools::Long nY) { nB = nY; }
+
+ Pair const & toPair() const { return *this; }
+ Pair & toPair() { return *this; }
+
+ // Scales relative to 0,0
+ constexpr inline Point scale(sal_Int64 nMulX, sal_Int64 nDivX,
+ sal_Int64 nMulY, sal_Int64 nDivY) const;
+
+ using Pair::toString;
+ using Pair::GetHashValue;
+};
+
+inline void Point::Move( tools::Long nHorzMove, tools::Long nVertMove )
+{
+ nA += nHorzMove;
+ nB += nVertMove;
+}
+
+inline Point& Point::operator += ( const Point& rPoint )
+{
+ nA += rPoint.nA;
+ nB += rPoint.nB;
+ return *this;
+}
+
+inline Point& Point::operator -= ( const Point& rPoint )
+{
+ nA -= rPoint.nA;
+ nB -= rPoint.nB;
+ return *this;
+}
+
+inline Point& Point::operator *= ( const tools::Long nVal )
+{
+ nA *= nVal;
+ nB *= nVal;
+ return *this;
+}
+
+inline Point& Point::operator /= ( const tools::Long nVal )
+{
+ nA /= nVal;
+ nB /= nVal;
+ return *this;
+}
+
+inline Point operator+( const Point &rVal1, const Point &rVal2 )
+{
+ return Point( rVal1.nA+rVal2.nA, rVal1.nB+rVal2.nB );
+}
+
+inline Point operator-( const Point &rVal1, const Point &rVal2 )
+{
+ return Point( rVal1.nA-rVal2.nA, rVal1.nB-rVal2.nB );
+}
+
+inline Point operator*( const Point &rVal1, const tools::Long nVal2 )
+{
+ return Point( rVal1.nA*nVal2, rVal1.nB*nVal2 );
+}
+
+inline Point operator/( const Point &rVal1, const tools::Long nVal2 )
+{
+ return Point( rVal1.nA/nVal2, rVal1.nB/nVal2 );
+}
+
+inline bool operator ==(Point const & p1, Point const & p2)
+{
+ return tools::detail::equal(p1.toPair(), p2.toPair());
+}
+
+inline bool operator !=(Point const & p1, Point const & p2)
+{
+ return !(p1 == p2);
+}
+
+constexpr inline Point Point::scale(sal_Int64 nMulX, sal_Int64 nDivX, sal_Int64 nMulY, sal_Int64 nDivY) const
+{
+ return Point(o3tl::convert(getX(), nMulX, nDivX),
+ o3tl::convert(getY(), nMulY, nDivY));
+}
+
+namespace o3tl
+{
+
+constexpr Point convert(const Point& rPoint, o3tl::Length eFrom, o3tl::Length eTo)
+{
+ const auto [num, den] = o3tl::getConversionMulDiv(eFrom, eTo);
+ return rPoint.scale(num, den, num, den);
+}
+
+} // end o3tl
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const Point& point )
+{
+ return stream << point.X() << ',' << point.Y();
+}
+
+// Size
+
+class SAL_WARN_UNUSED Size final : protected Pair
+{
+public:
+ constexpr Size() {}
+ constexpr Size( tools::Long nWidth, tools::Long nHeight ) : Pair( nWidth, nHeight ) {}
+
+ constexpr tools::Long Width() const { return nA; }
+ constexpr tools::Long Height() const { return nB; }
+
+ tools::Long AdjustWidth( tools::Long n ) { nA += n; return nA; }
+ tools::Long AdjustHeight( tools::Long n ) { nB += n; return nB; }
+
+ constexpr tools::Long getWidth() const { return Width(); }
+ constexpr tools::Long getHeight() const { return Height(); }
+ void setWidth(tools::Long nWidth) { nA = nWidth; }
+ void setHeight(tools::Long nHeight) { nB = nHeight; }
+
+ bool IsEmpty() const { return nA <= 0 || nB <= 0; }
+
+ void extendBy(tools::Long x, tools::Long y)
+ {
+ nA += x;
+ nB += y;
+ }
+
+ Pair const & toPair() const { return *this; }
+ Pair & toPair() { return *this; }
+
+ using Pair::toString;
+ using Pair::GetHashValue;
+
+ Size& operator += ( const Size& rSize );
+ Size& operator -= ( const Size& rSize );
+ Size& operator *= ( const tools::Long nVal );
+ Size& operator /= ( const tools::Long nVal );
+
+ friend inline Size operator+( const Size &rVal1, const Size &rVal2 );
+ friend inline Size operator-( const Size &rVal1, const Size &rVal2 );
+ friend inline Size operator*( const Size &rVal1, const tools::Long nVal2 );
+ friend inline Size operator/( const Size &rVal1, const tools::Long nVal2 );
+
+ constexpr inline Size scale(sal_Int64 nMulX, sal_Int64 nDivX,
+ sal_Int64 nMulY, sal_Int64 nDivY) const;
+
+};
+
+inline bool operator ==(Size const & s1, Size const & s2)
+{
+ return tools::detail::equal(s1.toPair(), s2.toPair());
+}
+
+inline bool operator !=(Size const & s1, Size const & s2)
+{
+ return !(s1 == s2);
+}
+
+inline Size& Size::operator += ( const Size& rSize )
+{
+ nA += rSize.nA;
+ nB += rSize.nB;
+ return *this;
+}
+
+inline Size& Size::operator -= ( const Size& rSize )
+{
+ nA -= rSize.nA;
+ nB -= rSize.nB;
+ return *this;
+}
+
+inline Size& Size::operator *= ( const tools::Long nVal )
+{
+ nA *= nVal;
+ nB *= nVal;
+ return *this;
+}
+
+inline Size& Size::operator /= ( const tools::Long nVal )
+{
+ nA /= nVal;
+ nB /= nVal;
+ return *this;
+}
+
+inline Size operator+( const Size &rVal1, const Size &rVal2 )
+{
+ return Size( rVal1.nA+rVal2.nA, rVal1.nB+rVal2.nB );
+}
+
+inline Size operator-( const Size &rVal1, const Size &rVal2 )
+{
+ return Size( rVal1.nA-rVal2.nA, rVal1.nB-rVal2.nB );
+}
+
+inline Size operator*( const Size &rVal1, const tools::Long nVal2 )
+{
+ return Size( rVal1.nA*nVal2, rVal1.nB*nVal2 );
+}
+
+inline Size operator/( const Size &rVal1, const tools::Long nVal2 )
+{
+ return Size( rVal1.nA/nVal2, rVal1.nB/nVal2 );
+}
+
+constexpr inline Size Size::scale(sal_Int64 nMulX, sal_Int64 nDivX,
+ sal_Int64 nMulY, sal_Int64 nDivY) const
+{
+ return Size(o3tl::convert(Width(), nMulX, nDivX),
+ o3tl::convert(Height(), nMulY, nDivY));
+}
+
+namespace o3tl
+{
+
+constexpr Size convert(const Size& rSize, o3tl::Length eFrom, o3tl::Length eTo)
+{
+ const auto [num, den] = o3tl::getConversionMulDiv(eFrom, eTo);
+ return rSize.scale(num, den, num, den);
+}
+
+} // end o3tl
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const Size& size )
+{
+ return stream << size.Width() << 'x' << size.Height();
+}
+
+inline void Point::Move( Size const & s )
+{
+ AdjustX(s.Width());
+ AdjustY(s.Height());
+}
+
+// Range
+
+#define RANGE_MAX LONG_MAX
+
+class SAL_WARN_UNUSED Range final : protected Pair
+{
+public:
+ constexpr Range() {}
+ constexpr Range( tools::Long nMin, tools::Long nMax ) : Pair( nMin, nMax ) {}
+
+ tools::Long Min() const { return nA; }
+ tools::Long Max() const { return nB; }
+ tools::Long Len() const { return nB - nA + 1; }
+
+ tools::Long& Min() { return nA; }
+ tools::Long& Max() { return nB; }
+
+ bool Contains( tools::Long nIs ) const;
+
+ void Justify();
+
+ Pair const & toPair() const { return *this; }
+ Pair & toPair() { return *this; }
+
+ using Pair::toString;
+};
+
+inline bool Range::Contains( tools::Long nIs ) const
+{
+ return ((nA <= nIs) && (nIs <= nB ));
+}
+
+inline void Range::Justify()
+{
+ if ( nA > nB )
+ {
+ tools::Long nHelp = nA;
+ nA = nB;
+ nB = nHelp;
+ }
+}
+
+inline bool operator ==(Range const & r1, Range const & r2)
+{
+ return tools::detail::equal(r1.toPair(), r2.toPair());
+}
+
+inline bool operator !=(Range const & r1, Range const & r2)
+{
+ return !(r1 == r2);
+}
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const Range& range )
+{
+ return stream << range.Min() << '-' << range.Max();
+}
+
+// Selection
+
+#define SELECTION_MIN LONG_MIN
+#define SELECTION_MAX LONG_MAX
+
+class SAL_WARN_UNUSED Selection final : protected Pair
+{
+public:
+ Selection() {}
+ Selection( tools::Long nPos ) : Pair( nPos, nPos ) {}
+ Selection( tools::Long nMin, tools::Long nMax ) : Pair( nMin, nMax ) {}
+
+ tools::Long Min() const { return nA; }
+ tools::Long Max() const { return nB; }
+ tools::Long Len() const { return nB - nA; }
+
+ tools::Long& Min() { return nA; }
+ tools::Long& Max() { return nB; }
+
+ bool Contains( tools::Long nIs ) const;
+
+ void Justify();
+
+ bool operator !() const { return !Len(); }
+
+ tools::Long getMin() const { return Min(); }
+ void setMin(tools::Long nMin) { Min() = nMin; }
+ void setMax(tools::Long nMax) { Max() = nMax; }
+
+ Pair const & toPair() const { return *this; }
+ Pair & toPair() { return *this; }
+
+ using Pair::toString;
+};
+
+inline bool Selection::Contains( tools::Long nIs ) const
+{
+ return ((nA <= nIs) && (nIs < nB ));
+}
+
+inline void Selection::Justify()
+{
+ if ( nA > nB )
+ {
+ tools::Long nHelp = nA;
+ nA = nB;
+ nB = nHelp;
+ }
+}
+
+inline bool operator ==(Selection const & s1, Selection const & s2)
+{
+ return tools::detail::equal(s1.toPair(), s2.toPair());
+}
+
+inline bool operator !=(Selection const & s1, Selection const & s2)
+{
+ return !(s1 == s2);
+}
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const Selection& selection )
+{
+ return stream << selection.Min() << '-' << selection.Max();
+}
+// Rectangle
+
+#define RECT_MAX LONG_MAX
+#define RECT_MIN LONG_MIN
+
+/// Note: this class is a true marvel of engineering: because the author
+/// could not decide whether it's better to have a closed or half-open
+/// interval, they just implemented *both* in the same class!
+///
+/// If you have the misfortune of having to use this class, don't immediately
+/// despair but first take note that the uppercase GetWidth() / GetHeight()
+/// etc. methods interpret the interval as closed, while the lowercase
+/// getWidth() / getHeight() etc. methods interpret the interval as half-open.
+/// Ok, now is the time for despair.
+namespace tools
+{
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Rectangle final
+{
+ static constexpr short RECT_EMPTY = -32767;
+public:
+ constexpr Rectangle() = default;
+ constexpr Rectangle( const Point& rLT, const Point& rRB );
+ constexpr Rectangle( tools::Long nLeft, tools::Long nTop,
+ tools::Long nRight, tools::Long nBottom );
+ /// Constructs an empty Rectangle, with top/left at the specified params
+ constexpr Rectangle( tools::Long nLeft, tools::Long nTop );
+ constexpr Rectangle( const Point& rLT, const Size& rSize );
+
+ constexpr inline static Rectangle Justify(const Point& rLT, const Point& rRB);
+
+ constexpr tools::Long Left() const { return nLeft; }
+ constexpr tools::Long Right() const { return IsWidthEmpty() ? nLeft : nRight; }
+ constexpr tools::Long Top() const { return nTop; }
+ constexpr tools::Long Bottom() const { return IsHeightEmpty() ? nTop : nBottom; }
+
+ constexpr void SetLeft(tools::Long v) { nLeft = v; }
+ constexpr void SetRight(tools::Long v) { nRight = v; }
+ constexpr void SetTop(tools::Long v) { nTop = v; }
+ constexpr void SetBottom(tools::Long v) { nBottom = v; }
+
+ constexpr Point TopLeft() const { return { Left(), Top() }; }
+ constexpr Point TopRight() const { return { Right(), Top() }; }
+ constexpr Point TopCenter() const { return { (Left() + Right()) / 2, Top() }; }
+ constexpr Point BottomLeft() const { return { Left(), Bottom() }; }
+ constexpr Point BottomRight() const { return { Right(), Bottom() }; }
+ constexpr Point BottomCenter() const { return { (Left() + Right()) / 2, Bottom() }; }
+ constexpr Point LeftCenter() const { return { Left(), (Top() + Bottom()) / 2 }; }
+ constexpr Point RightCenter() const { return { Right(), (Top() + Bottom()) / 2 }; }
+ constexpr Point Center() const { return { (Left() + Right()) / 2, (Top() + Bottom()) / 2 }; }
+
+ /// Move the top and left edges by a delta, preserving width and height
+ inline void Move( tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta );
+ void Move( Size const & s ) { Move(s.Width(), s.Height()); }
+ tools::Long AdjustLeft( tools::Long nHorzMoveDelta ) { nLeft += nHorzMoveDelta; return nLeft; }
+ tools::Long AdjustRight( tools::Long nHorzMoveDelta );
+ tools::Long AdjustTop( tools::Long nVertMoveDelta ) { nTop += nVertMoveDelta; return nTop; }
+ tools::Long AdjustBottom( tools::Long nVertMoveDelta );
+ /// Set the left edge of the rectangle to x, preserving the width
+ inline void SetPosX(tools::Long x);
+ /// Set the top edge of the rectangle to y, preserving the height
+ inline void SetPosY(tools::Long y);
+ inline void SetPos( const Point& rPoint );
+ void SetSize( const Size& rSize );
+
+ constexpr Point GetPos() const { return TopLeft(); }
+ constexpr Size GetSize() const { return { GetWidth(), GetHeight() }; }
+
+ /// Returns the difference between right and left, assuming the range is inclusive.
+ constexpr inline tools::Long GetWidth() const;
+ /// Returns the difference between bottom and top, assuming the range is inclusive.
+ constexpr inline tools::Long GetHeight() const;
+
+ tools::Rectangle& Union( const tools::Rectangle& rRect );
+ tools::Rectangle& Intersection( const tools::Rectangle& rRect );
+ inline tools::Rectangle GetUnion( const tools::Rectangle& rRect ) const;
+ inline tools::Rectangle GetIntersection( const tools::Rectangle& rRect ) const;
+
+ void Justify();
+
+ bool Contains( const Point& rPOINT ) const;
+ bool Contains( const tools::Rectangle& rRect ) const;
+ bool Overlaps( const tools::Rectangle& rRect ) const;
+
+ void SetEmpty() { nRight = nBottom = RECT_EMPTY; }
+ void SetWidthEmpty() { nRight = RECT_EMPTY; }
+ void SetHeightEmpty() { nBottom = RECT_EMPTY; }
+ constexpr bool IsEmpty() const { return IsWidthEmpty() || IsHeightEmpty(); }
+ constexpr bool IsWidthEmpty() const { return nRight == RECT_EMPTY; }
+ constexpr bool IsHeightEmpty() const { return nBottom == RECT_EMPTY; }
+
+ inline bool operator == ( const tools::Rectangle& rRect ) const;
+ inline bool operator != ( const tools::Rectangle& rRect ) const;
+
+ inline tools::Rectangle& operator += ( const Point& rPt );
+ inline tools::Rectangle& operator -= ( const Point& rPt );
+
+ friend inline tools::Rectangle operator + ( const tools::Rectangle& rRect, const Point& rPt );
+ friend inline tools::Rectangle operator - ( const tools::Rectangle& rRect, const Point& rPt );
+
+ tools::Long getX() const { return nLeft; }
+ tools::Long getY() const { return nTop; }
+ /// Returns the difference between right and left, assuming the range includes one end, but not the other.
+ tools::Long getWidth() const { return Right() - Left(); }
+ /// Returns the difference between bottom and top, assuming the range includes one end, but not the other.
+ tools::Long getHeight() const { return Bottom() - Top(); }
+ void setWidth( tools::Long n ) { nRight = nLeft + n; }
+ void setHeight( tools::Long n ) { nBottom = nTop + n; }
+ /// Returns the string representation of the rectangle, format is "x, y, width, height".
+ rtl::OString toString() const;
+
+ /**
+ * Expands the rectangle in all directions by the input value.
+ */
+ void expand(tools::Long nExpandBy);
+ void shrink(tools::Long nShrinkBy);
+
+ /**
+ * Sanitizing variants for handling data from the outside
+ */
+ void SaturatingSetSize(const Size& rSize);
+ void SaturatingSetPosX(tools::Long x);
+ void SaturatingSetPosY(tools::Long y);
+
+ // Scales relative to 0,0
+ constexpr inline tools::Rectangle scale(sal_Int64 nMulX, sal_Int64 nDivX,
+ sal_Int64 nMulY, sal_Int64 nDivY) const;
+
+private:
+ tools::Long nLeft = 0;
+ tools::Long nTop = 0;
+ tools::Long nRight = RECT_EMPTY;
+ tools::Long nBottom = RECT_EMPTY;
+};
+}
+
+constexpr inline tools::Rectangle::Rectangle( const Point& rLT, const Point& rRB )
+ : Rectangle(rLT.X(), rLT.Y(), rRB.X(), rRB.Y())
+{}
+
+constexpr inline tools::Rectangle::Rectangle( tools::Long _nLeft, tools::Long _nTop,
+ tools::Long _nRight, tools::Long _nBottom )
+ : nLeft( _nLeft )
+ , nTop( _nTop )
+ , nRight( _nRight )
+ , nBottom( _nBottom )
+{}
+
+constexpr inline tools::Rectangle::Rectangle( tools::Long _nLeft, tools::Long _nTop )
+ : nLeft(_nLeft)
+ , nTop(_nTop)
+{}
+
+constexpr inline tools::Rectangle::Rectangle( const Point& rLT, const Size& rSize )
+ : nLeft( rLT.X())
+ , nTop( rLT.Y())
+ , nRight(rSize.Width() ? nLeft + (rSize.Width() + (rSize.Width() > 0 ? -1 : 1)) : RECT_EMPTY)
+ , nBottom(rSize.Height() ? nTop + (rSize.Height() + (rSize.Height() > 0 ? -1 : 1)) : RECT_EMPTY)
+{}
+
+constexpr inline tools::Rectangle tools::Rectangle::Justify(const Point& rLT, const Point& rRB)
+{
+ const std::pair<tools::Long, tools::Long> aLeftRight = std::minmax(rLT.X(), rRB.X());
+ const std::pair<tools::Long, tools::Long> aTopBottom = std::minmax(rLT.Y(), rRB.Y());
+ return { aLeftRight.first, aTopBottom.first, aLeftRight.second, aTopBottom.second };
+}
+
+inline void tools::Rectangle::Move( tools::Long nHorzMove, tools::Long nVertMove )
+{
+ nLeft += nHorzMove;
+ nTop += nVertMove;
+ if (!IsWidthEmpty())
+ nRight += nHorzMove;
+ if (!IsHeightEmpty())
+ nBottom += nVertMove;
+}
+
+inline void tools::Rectangle::SetPosX(tools::Long x)
+{
+ if (!IsWidthEmpty())
+ nRight += x - nLeft;
+ nLeft = x;
+}
+
+inline void tools::Rectangle::SetPosY(tools::Long y)
+{
+ if (!IsHeightEmpty())
+ nBottom += y - nTop;
+ nTop = y;
+}
+
+inline void tools::Rectangle::SetPos( const Point& rPoint )
+{
+ SetPosX(rPoint.X());
+ SetPosY(rPoint.Y());
+}
+
+constexpr inline tools::Long tools::Rectangle::GetWidth() const
+{
+ tools::Long n = 0;
+
+ if (!IsWidthEmpty())
+ {
+ n = nRight - nLeft;
+ if (n < 0)
+ n--;
+ else
+ n++;
+ }
+
+ return n;
+}
+
+constexpr inline tools::Long tools::Rectangle::GetHeight() const
+{
+ tools::Long n = 0;
+
+ if (!IsHeightEmpty())
+ {
+ n = nBottom - nTop;
+ if (n < 0)
+ n--;
+ else
+ n++;
+ }
+
+ return n;
+}
+
+inline tools::Rectangle tools::Rectangle::GetUnion( const tools::Rectangle& rRect ) const
+{
+ tools::Rectangle aTmpRect( *this );
+ return aTmpRect.Union( rRect );
+}
+
+inline tools::Rectangle tools::Rectangle::GetIntersection( const tools::Rectangle& rRect ) const
+{
+ tools::Rectangle aTmpRect( *this );
+ return aTmpRect.Intersection( rRect );
+}
+
+inline bool tools::Rectangle::operator == ( const tools::Rectangle& rRect ) const
+{
+ return (nLeft == rRect.nLeft ) &&
+ (nTop == rRect.nTop ) &&
+ (nRight == rRect.nRight ) &&
+ (nBottom == rRect.nBottom );
+}
+
+inline bool tools::Rectangle::operator != ( const tools::Rectangle& rRect ) const
+{
+ return (nLeft != rRect.nLeft ) ||
+ (nTop != rRect.nTop ) ||
+ (nRight != rRect.nRight ) ||
+ (nBottom != rRect.nBottom );
+}
+
+inline tools::Rectangle& tools::Rectangle::operator +=( const Point& rPt )
+{
+ Move(rPt.X(), rPt.Y());
+ return *this;
+}
+
+inline tools::Rectangle& tools::Rectangle::operator -= ( const Point& rPt )
+{
+ Move(-rPt.X(), -rPt.Y());
+ return *this;
+}
+
+namespace tools
+{
+inline Rectangle operator + ( const Rectangle& rRect, const Point& rPt )
+{
+ return Rectangle{ rRect }.operator+=(rPt);
+}
+
+inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt )
+{
+ return Rectangle{ rRect }.operator-=(rPt);
+}
+
+}
+
+constexpr inline tools::Rectangle tools::Rectangle::scale(sal_Int64 nMulX, sal_Int64 nDivX,
+ sal_Int64 nMulY, sal_Int64 nDivY) const
+{
+ // 1. Create an empty rectangle with correct left and top
+ tools::Rectangle aRect(o3tl::convert(Left(), nMulX, nDivX),
+ o3tl::convert(Top(), nMulY, nDivY));
+ // 2. If source has width/height, set respective right and bottom
+ if (!IsWidthEmpty())
+ aRect.SetRight(o3tl::convert(Right(), nMulX, nDivX));
+ if (!IsHeightEmpty())
+ aRect.SetBottom(o3tl::convert(Bottom(), nMulY, nDivY));
+ return aRect;
+}
+
+namespace o3tl
+{
+
+constexpr tools::Rectangle convert(const tools::Rectangle& rRectangle, o3tl::Length eFrom, o3tl::Length eTo)
+{
+ const auto [num, den] = o3tl::getConversionMulDiv(eFrom, eTo);
+ return rRectangle.scale(num, den, num, den);
+}
+
+} // end o3tl
+
+namespace tools
+{
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const tools::Rectangle& rectangle )
+{
+ if (rectangle.IsEmpty())
+ return stream << "EMPTY";
+ else
+ return stream << rectangle.GetWidth() << 'x' << rectangle.GetHeight()
+ << "@(" << rectangle.getX() << ',' << rectangle.getY() << ")";
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/globname.hxx b/include/tools/globname.hxx
new file mode 100644
index 000000000..50c3fc27b
--- /dev/null
+++ b/include/tools/globname.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_GLOBNAME_HXX
+#define INCLUDED_TOOLS_GLOBNAME_HXX
+
+#include <tools/toolsdllapi.h>
+#include <com/sun/star/uno/Sequence.hxx>
+
+struct SAL_WARN_UNUSED SvGUID
+{
+ sal_uInt32 Data1;
+ sal_uInt16 Data2;
+ sal_uInt16 Data3;
+ sal_uInt8 Data4[8];
+};
+
+class SvStream;
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC SvGlobalName
+{
+public:
+ SvGlobalName() = default;
+ SvGlobalName(const SvGlobalName& rObj) = default;
+
+ SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
+ sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
+ sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
+
+ // create SvGlobalName from a platform independent representation
+ SvGlobalName( const css::uno::Sequence< sal_Int8 >& aSeq );
+
+ SvGlobalName( const SvGUID & rId );
+
+ SvGlobalName & operator = ( const SvGlobalName & rObj ) = default;
+
+ TOOLS_DLLPUBLIC friend SvStream & operator >> ( SvStream &, SvGlobalName & );
+ TOOLS_DLLPUBLIC friend SvStream & WriteSvGlobalName( SvStream &, const SvGlobalName & );
+
+ bool operator < ( const SvGlobalName & rObj ) const;
+
+ bool operator == ( const SvGlobalName & rObj ) const;
+ bool operator != ( const SvGlobalName & rObj ) const
+ { return !(*this == rObj); }
+
+ void MakeFromMemory( void const * pData );
+ bool MakeId( std::u16string_view rId );
+ OUString GetHexName() const;
+
+ const SvGUID& GetCLSID() const { return m_aData; }
+
+ // platform independent representation of a "GlobalName"
+ // maybe transported remotely
+ css::uno::Sequence < sal_Int8 > GetByteSequence() const;
+
+private:
+ SvGUID m_aData = {};
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/helpers.hxx b/include/tools/helpers.hxx
new file mode 100644
index 000000000..5f61ba808
--- /dev/null
+++ b/include/tools/helpers.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <sal/config.h>
+#include <sal/types.h>
+#include <tools/long.hxx>
+#include <cassert>
+#include <limits>
+#include <type_traits>
+
+template<typename T>
+inline
+typename std::enable_if<
+ std::is_signed<T>::value || std::is_floating_point<T>::value, long >::type
+MinMax(T nVal, tools::Long nMin, tools::Long nMax)
+{
+ assert(nMin <= nMax);
+ if (nVal >= nMin)
+ {
+ if (nVal <= nMax)
+ return static_cast<tools::Long>(nVal);
+ else
+ return nMax;
+ }
+ else
+ {
+ return nMin;
+ }
+}
+
+template<typename T>
+inline
+typename std::enable_if<
+ std::is_unsigned<T>::value, long >::type
+MinMax(T nVal, tools::Long nMin, tools::Long nMax)
+{
+ assert(nMin <= nMax);
+ if (nMax < 0)
+ {
+ return nMax;
+ }
+ else
+ {
+ if (nMin < 0 || nVal >= static_cast<unsigned long>(nMin))
+ {
+ if (nVal <= static_cast<unsigned long>(nMax))
+ return static_cast<tools::Long>(nVal);
+ else
+ return nMax;
+ }
+ else
+ {
+ return nMin;
+ }
+ }
+}
+
+inline sal_uInt32 AlignedWidth4Bytes(sal_uInt32 nWidthBits)
+{
+ if (nWidthBits > SAL_MAX_UINT32 - 31)
+ nWidthBits = SAL_MAX_UINT32;
+ else
+ nWidthBits += 31;
+ return (nWidthBits >> 5) << 2;
+}
+
+inline tools::Long FRound( double fVal )
+{
+ return fVal > 0.0
+ ? fVal == double(std::numeric_limits<tools::Long>::max())
+ ? std::numeric_limits<tools::Long>::max() : static_cast<tools::Long>( fVal + 0.5 )
+ : static_cast<tools::Long>( fVal - 0.5 );
+}
+
+//valid range: (-180,180]
+template <typename T>
+[[nodiscard]] inline typename std::enable_if<std::is_signed<T>::value, T>::type
+NormAngle180(T angle)
+{
+ while (angle <= -180)
+ angle += 360;
+ while (angle > 180)
+ angle -= 360;
+ return angle;
+}
+
+//valid range: [0,360)
+template <typename T> [[nodiscard]] inline T NormAngle360(T angle)
+{
+ while (angle < 0)
+ angle += 360;
+ while (angle >= 360)
+ angle -= 360;
+ return angle;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/inetmime.hxx b/include/tools/inetmime.hxx
new file mode 100644
index 000000000..3c0fe30ff
--- /dev/null
+++ b/include/tools/inetmime.hxx
@@ -0,0 +1,241 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_INETMIME_HXX
+#define INCLUDED_TOOLS_INETMIME_HXX
+
+#include <tools/toolsdllapi.h>
+#include <rtl/character.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+
+#include <unordered_map>
+
+struct INetContentTypeParameter
+{
+ /** The optional character set specification (see RFC 2231), in US-ASCII
+ encoding and converted to lower case.
+ */
+ OString m_sCharset;
+
+ /** The optional language specification (see RFC 2231), in US-ASCII
+ encoding and converted to lower case.
+ */
+ OString m_sLanguage;
+
+ /** The attribute value. If the value is a quoted-string, it is
+ 'unpacked.' If a character set is specified, and the value can be
+ converted to Unicode, this is done. Also, if no character set is
+ specified, it is first tried to convert the value from UTF-8 encoding
+ to Unicode, and if that doesn't work (because the value is not in
+ UTF-8 encoding), it is converted from ISO-8859-1 encoding to Unicode
+ (which will always work). But if a character set is specified and the
+ value cannot be converted from that character set to Unicode, special
+ action is taken to produce a value that can possibly be transformed
+ back into its original form: Any 8-bit character from a non-encoded
+ part of the original value is directly converted to Unicode
+ (effectively handling it as if it was ISO-8859-1 encoded), and any
+ 8-bit character from an encoded part of the original value is mapped
+ to the range U+F800..U+F8FF at the top of the Corporate Use Subarea
+ within Unicode's Private Use Area (effectively adding 0xF800 to the
+ character's numeric value).
+ */
+ OUString m_sValue;
+
+ /** This is true if the value is successfully converted to Unicode, and
+ false if the value is a special mixture of ISO-LATIN-1 characters and
+ characters from Unicode's Private Use Area.
+ */
+ bool m_bConverted;
+};
+
+/** The key is the name of the attribute, in US-ASCII encoding and converted
+ to lower case. If a parameter value is split as described in RFC 2231,
+ there will only be one item for the complete parameter, with the attribute
+ name lacking any section suffix.
+ */
+typedef std::unordered_map<OString, INetContentTypeParameter>
+ INetContentTypeParameterList;
+
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC INetMIME
+{
+public:
+ /** Check for US-ASCII visible character.
+
+ @param nChar Some UCS-4 character.
+
+ @return True if nChar is a US-ASCII visible character (US-ASCII
+ 0x21--0x7E).
+ */
+ static inline bool isVisible(sal_uInt32 nChar);
+
+ /** Check whether some character is valid within an RFC 822 <atom>.
+
+ @param nChar Some UCS-4 character.
+
+ @return True if nChar is valid within an RFC 822 <atom> (US-ASCII
+ 'A'--'Z', 'a'--'z', '0'--'9', '!', '#', '$', '%', '&', ''', '*', '+',
+ '-', '/', '=', '?', '^', '_', '`', '{', '|', '}', or '~').
+ */
+ static bool isAtomChar(sal_uInt32 nChar);
+
+ /** Check whether some character is valid within an RFC 2060 <atom>.
+
+ @param nChar Some UCS-4 character.
+
+ @return True if nChar is valid within an RFC 2060 <atom> (US-ASCII
+ 'A'--'Z', 'a'--'z', '0'--'9', '!', '#', '$', '&', ''', '+', ',', '-',
+ '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', ']', '^', '_', '`',
+ '|', '}', or '~').
+ */
+ static bool isIMAPAtomChar(sal_uInt32 nChar);
+
+ /** Get the digit weight of a US-ASCII character.
+
+ @param nChar Some UCS-4 character.
+
+ @return If nChar is a US-ASCII (decimal) digit character (US-ASCII
+ '0'--'9'), return the corresponding weight (0--9); otherwise,
+ return -1.
+ */
+ static inline int getWeight(sal_uInt32 nChar);
+
+ /** Get the hexadecimal digit weight of a US-ASCII character.
+
+ @param nChar Some UCS-4 character.
+
+ @return If nChar is a US-ASCII hexadecimal digit character (US-ASCII
+ '0'--'9', 'A'--'F', or 'a'--'f'), return the corresponding weight
+ (0--15); otherwise, return -1.
+ */
+ static inline int getHexWeight(sal_uInt32 nChar);
+
+ /** Check two US-ASCII strings for equality, ignoring case.
+
+ @param pBegin1 Points to the start of the first string, must not be
+ null.
+
+ @param pEnd1 Points past the end of the first string, must be >=
+ pBegin1.
+
+ @param pString2 Points to the start of the null terminated second
+ string, must not be null.
+
+ @return True if the two strings are equal, ignoring the case of US-
+ ASCII alphabetic characters (US-ASCII 'A'--'Z' and 'a'--'z').
+ */
+ static bool equalIgnoreCase(const sal_Unicode * pBegin1,
+ const sal_Unicode * pEnd1,
+ const char * pString2);
+
+ static bool scanUnsigned(const sal_Unicode *& rBegin,
+ const sal_Unicode * pEnd, bool bLeadingZeroes,
+ sal_uInt32 & rValue);
+
+ /** Parse the body of an RFC 2045 Content-Type header field.
+
+ @param pBegin The range (that must be valid) from non-null pBegin,
+ inclusive. to non-null pEnd, exclusive, forms the body of the
+ Content-Type header field. It must be of the form
+
+ token "/" token *(";" token "=" (token / quoted-string))
+
+ with intervening linear white space and comments (cf. RFCs 822, 2045).
+ The RFC 2231 extensions are supported. The encoding of rMediaType
+ should be US-ASCII, but any Unicode values in the range U+0080..U+FFFF
+ are interpreted 'as appropriate.'
+
+ @param pType If not null, returns the type (the first of the above
+ tokens), in US-ASCII encoding and converted to lower case.
+
+ @param pSubType If not null, returns the sub-type (the second of the
+ above tokens), in US-ASCII encoding and converted to lower case.
+
+ @param pParameters If not null, returns the parameters as a list of
+ INetContentTypeParameters (the attributes are in US-ASCII encoding and
+ converted to lower case, the values are in Unicode encoding). If
+ null, only the syntax of the parameters is checked, but they are not
+ returned.
+
+ @return Null if the syntax of the field body is incorrect (i.e., does
+ not start with type and sub-type tokens). Otherwise, a pointer past the
+ longest valid input prefix. If null is returned, none of the output
+ parameters will be modified.
+ */
+ static sal_Unicode const * scanContentType(
+ std::u16string_view rStr,
+ OUString * pType = nullptr, OUString * pSubType = nullptr,
+ INetContentTypeParameterList * pParameters = nullptr);
+
+ static OUString decodeHeaderFieldBody(const OString& rBody);
+
+ /** Get the UTF-32 character at the head of a UTF-16 encoded string.
+
+ @param rBegin Points to the start of the UTF-16 encoded string, must
+ not be null. On exit, it points past the first UTF-32 character's
+ encoding.
+
+ @param pEnd Points past the end of the UTF-16 encoded string, must be
+ strictly greater than rBegin.
+
+ @return The UCS-4 character at the head of the UTF-16 encoded string.
+ If the string does not start with the UTF-16 encoding of a UCS-32
+ character, the first UTF-16 value is returned.
+ */
+ static inline sal_uInt32 getUTF32Character(const sal_Unicode *& rBegin,
+ const sal_Unicode * pEnd);
+};
+
+// static
+inline bool INetMIME::isVisible(sal_uInt32 nChar)
+{
+ return nChar >= '!' && nChar <= '~';
+}
+
+// static
+inline int INetMIME::getWeight(sal_uInt32 nChar)
+{
+ return rtl::isAsciiDigit(nChar) ? int(nChar - '0') : -1;
+}
+
+// static
+inline int INetMIME::getHexWeight(sal_uInt32 nChar)
+{
+ return rtl::isAsciiDigit(nChar) ? int(nChar - '0') :
+ nChar >= 'A' && nChar <= 'F' ? int(nChar - 'A' + 10) :
+ nChar >= 'a' && nChar <= 'f' ? int(nChar - 'a' + 10) : -1;
+}
+
+// static
+inline sal_uInt32 INetMIME::getUTF32Character(const sal_Unicode *& rBegin,
+ const sal_Unicode * pEnd)
+{
+ assert(rBegin && rBegin < pEnd &&
+ "INetMIME::getUTF32Character(): Bad sequence");
+ sal_uInt32 nUTF32 = *rBegin++;
+ if (rBegin < pEnd && rtl::isHighSurrogate(nUTF32) && rtl::isLowSurrogate(rBegin[0]))
+ nUTF32 = rtl::combineSurrogates(nUTF32, *rBegin++);
+ return nUTF32;
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/inetmsg.hxx b/include/tools/inetmsg.hxx
new file mode 100644
index 000000000..8617b0b91
--- /dev/null
+++ b/include/tools/inetmsg.hxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_INETMSG_HXX
+#define INCLUDED_TOOLS_INETMSG_HXX
+
+#include <tools/toolsdllapi.h>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/inetmime.hxx>
+#include <tools/stream.hxx>
+
+#include <string_view>
+#include <utility>
+#include <vector>
+#include <map>
+#include <memory>
+#include <config_options.h>
+
+class DateTime;
+
+class SAL_WARN_UNUSED INetMessageHeader
+{
+ OString m_aName;
+ OString m_aValue;
+
+public:
+ INetMessageHeader()
+ {}
+
+ INetMessageHeader(OString aName, OString aValue)
+ : m_aName (std::move(aName)), m_aValue (std::move(aValue))
+ {}
+
+ INetMessageHeader (
+ const INetMessageHeader& rHdr)
+ : m_aName (rHdr.m_aName), m_aValue (rHdr.m_aValue)
+ {}
+
+ INetMessageHeader& operator= (const INetMessageHeader& rHdr)
+ {
+ m_aName = rHdr.m_aName;
+ m_aValue = rHdr.m_aValue;
+ return *this;
+ }
+
+ const OString& GetName() const { return m_aName; }
+ const OString& GetValue() const { return m_aValue; }
+};
+
+enum class InetMessageMime
+{
+ VERSION = 0,
+ CONTENT_DISPOSITION = 1,
+ CONTENT_TYPE = 2,
+ CONTENT_TRANSFER_ENCODING = 3,
+ NUMHDR = 4,
+};
+
+class SAL_WARN_UNUSED UNLESS_MERGELIBS(TOOLS_DLLPUBLIC) INetMIMEMessage
+{
+ ::std::vector< std::unique_ptr<INetMessageHeader> >
+ m_aHeaderList;
+
+ SvLockBytesRef m_xDocLB;
+
+ ::std::map<InetMessageMime, sal_uInt32> m_nMIMEIndex;
+ INetMIMEMessage* pParent;
+ ::std::vector< std::unique_ptr<INetMIMEMessage> >
+ aChildren;
+ OString m_aBoundary;
+
+ OUString GetHeaderValue_Impl (
+ sal_uInt32 nIndex) const
+ {
+ if ( nIndex < m_aHeaderList.size() ) {
+ return INetMIME::decodeHeaderFieldBody(m_aHeaderList[ nIndex ]->GetValue());
+ } else {
+ return OUString();
+ }
+ }
+
+ void SetHeaderField_Impl (
+ const INetMessageHeader &rHeader, sal_uInt32 &rnIndex)
+ {
+ INetMessageHeader *p = new INetMessageHeader (rHeader);
+ if (m_aHeaderList.size() <= rnIndex)
+ {
+ rnIndex = m_aHeaderList.size();
+ m_aHeaderList.emplace_back( p );
+ }
+ else
+ {
+ m_aHeaderList[ rnIndex ].reset(p);
+ }
+ }
+
+ void SetHeaderField_Impl (
+ const OString &rName,
+ const OUString &rValue,
+ sal_uInt32 &rnIndex);
+
+ bool IsMessage() const
+ {
+ OUString aType (GetContentType());
+ return aType.matchIgnoreAsciiCase("message/");
+ }
+
+ INetMIMEMessage (const INetMIMEMessage& rMsg) = delete;
+ INetMIMEMessage& operator= (const INetMIMEMessage& rMsg) = delete;
+
+public:
+ INetMIMEMessage();
+ ~INetMIMEMessage();
+
+ sal_uInt32 GetHeaderCount() const { return m_aHeaderList.size(); }
+
+ INetMessageHeader GetHeaderField (sal_uInt32 nIndex) const
+ {
+ if ( nIndex < m_aHeaderList.size() ) {
+ return *m_aHeaderList[ nIndex ];
+ } else {
+ return INetMessageHeader();
+ }
+ }
+
+ SvLockBytes* GetDocumentLB() const { return m_xDocLB.get(); }
+ void SetDocumentLB (SvLockBytes *pDocLB) { m_xDocLB = pDocLB; }
+
+ static bool ParseDateField (
+ std::u16string_view rDateField, DateTime& rDateTime);
+
+ void SetMIMEVersion (const OUString& rVersion);
+ void SetContentDisposition (const OUString& rDisposition);
+ void SetContentType (const OUString& rType);
+ OUString GetContentType() const
+ {
+ return GetHeaderValue_Impl(
+ m_nMIMEIndex.at(InetMessageMime::CONTENT_TYPE));
+ }
+
+ void SetContentTransferEncoding (const OUString& rEncoding);
+
+ OUString GetDefaultContentType ();
+
+ // Message container methods.
+
+ bool IsContainer() const
+ {
+ return (IsMessage() || IsMultipart());
+ }
+ bool IsMultipart() const
+ {
+ OUString aType (GetContentType());
+ return aType.matchIgnoreAsciiCase("multipart/");
+ }
+
+ INetMIMEMessage* GetChild (sal_uInt32 nIndex) const
+ {
+ return ( nIndex < aChildren.size() ) ? aChildren[ nIndex ].get() : nullptr;
+ }
+ INetMIMEMessage* GetParent() const { return pParent; }
+
+ void EnableAttachMultipartFormDataChild();
+ void AttachChild( std::unique_ptr<INetMIMEMessage> pChildMsg );
+
+ const OString& GetMultipartBoundary() const { return m_aBoundary; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/inetstrm.hxx b/include/tools/inetstrm.hxx
new file mode 100644
index 000000000..50b0d25f4
--- /dev/null
+++ b/include/tools/inetstrm.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <tools/toolsdllapi.h>
+#include <tools/stream.hxx>
+#include <sal/types.h>
+#include <vector>
+#include <memory>
+#include <config_options.h>
+
+class INetMIMEMessage;
+
+class UNLESS_MERGELIBS(TOOLS_DLLPUBLIC) INetMIMEMessageStream
+{
+ INetMIMEMessage *pSourceMsg;
+ bool bHeaderGenerated;
+
+ std::vector<char> mvBuffer;
+ char *pRead;
+ char *pWrite;
+
+ std::unique_ptr<SvStream>
+ pMsgStrm;
+ SvMemoryStream maMsgBuffer;
+ char *pMsgRead;
+ char *pMsgWrite;
+
+ bool done;
+
+ sal_uInt32 nChildIndex;
+ std::unique_ptr<INetMIMEMessageStream> pChildStrm;
+
+ INetMIMEMessageStream (const INetMIMEMessageStream& rStrm) = delete;
+ INetMIMEMessageStream& operator= (const INetMIMEMessageStream& rStrm) = delete;
+
+ int GetHeaderLine(char *pData, sal_uInt32 nSize);
+ int GetBodyLine(char *pData, sal_uInt32 nSize);
+ int GetMsgLine(char *pData, sal_uInt32 nSize);
+
+public:
+ explicit INetMIMEMessageStream(INetMIMEMessage *pMsg, bool headerGenerated);
+ ~INetMIMEMessageStream();
+
+ int Read (char *pData, sal_uInt32 nSize);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/json_writer.hxx b/include/tools/json_writer.hxx
new file mode 100644
index 000000000..700e82b9a
--- /dev/null
+++ b/include/tools/json_writer.hxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <tools/toolsdllapi.h>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+#include <string>
+#include <string_view>
+#include <utility>
+
+/** Simple JSON encoder designed specifically for LibreOfficeKit purposes.
+ *
+ * (1) Minimal allocations/re-allocations/copying
+ * (2) Small/simple JSON documents
+ * (3) ascii property names
+ */
+namespace tools
+{
+class ScopedJsonWriterNode;
+class ScopedJsonWriterArray;
+class ScopedJsonWriterStruct;
+
+class TOOLS_DLLPUBLIC JsonWriter
+{
+ friend class ScopedJsonWriterNode;
+ friend class ScopedJsonWriterArray;
+ friend class ScopedJsonWriterStruct;
+
+ char* mpBuffer;
+ char* mPos;
+ int mSpaceAllocated;
+ int mStartNodeCount;
+ bool mbFirstFieldInNode;
+
+public:
+ JsonWriter();
+ ~JsonWriter();
+
+ [[nodiscard]] ScopedJsonWriterNode startNode(const char*);
+ [[nodiscard]] ScopedJsonWriterArray startArray(const char*);
+ [[nodiscard]] ScopedJsonWriterStruct startStruct();
+
+ void put(const char* pPropName, const OUString& rPropValue);
+ // Assumes utf-8 property value encoding
+ void put(const char* pPropName, std::string_view rPropValue);
+ void put(const char* pPropName, const char* pPropVal)
+ {
+ put(pPropName, std::string_view(pPropVal));
+ }
+
+ void put(const char* pPropName, sal_uInt16 nPropVal) { put(pPropName, sal_Int64(nPropVal)); }
+ void put(const char* pPropName, sal_Int16 nPropVal) { put(pPropName, sal_Int64(nPropVal)); }
+ void put(const char* pPropName, sal_Int32 nPropVal) { put(pPropName, sal_Int64(nPropVal)); }
+ void put(const char* pPropName, sal_uInt32 nPropVal) { put(pPropName, sal_Int64(nPropVal)); }
+ void put(const char* pPropName, sal_Int64);
+ void put(const char* pPropName, bool);
+ void put(const char* pPropName, double);
+
+ void putSimpleValue(const OUString& rPropValue);
+
+ /// This assumes that this data belongs at this point in the stream, and is valid, and properly encoded
+ void putRaw(std::string_view);
+
+ /** Hands ownership of the underlying storage buffer to the caller,
+ * after this no more document modifications may be written. */
+ char* extractData() { return extractDataImpl().first; }
+ OString extractAsOString();
+ std::string extractAsStdString();
+
+ /** returns true if the current JSON data matches the string */
+ bool isDataEquals(const std::string&) const;
+
+private:
+ void endNode();
+ void endArray();
+ void endStruct();
+ void addCommaBeforeField();
+ void writeEscapedOUString(const OUString& rPropVal);
+ std::pair<char*, int> extractDataImpl();
+ void ensureSpace(int noMoreBytesRequired);
+
+ // overflow validation in debug mode
+ static constexpr unsigned char JSON_WRITER_DEBUG_MARKER = 0xde;
+
+ inline void addValidationMark()
+ {
+#ifndef NDEBUG
+ *(mpBuffer + mSpaceAllocated - 1) = JSON_WRITER_DEBUG_MARKER;
+#endif
+ }
+
+ inline void validate()
+ {
+#ifndef NDEBUG
+ unsigned char c = *(mpBuffer + mSpaceAllocated - 1);
+ assert(c == JSON_WRITER_DEBUG_MARKER);
+#endif
+ }
+};
+
+/**
+ * Auto-closes the node.
+ */
+class ScopedJsonWriterNode
+{
+ friend class JsonWriter;
+
+ JsonWriter& mrWriter;
+
+ ScopedJsonWriterNode(JsonWriter& rWriter)
+ : mrWriter(rWriter)
+ {
+ }
+
+public:
+ ~ScopedJsonWriterNode() { mrWriter.endNode(); }
+};
+
+/**
+ * Auto-closes the node.
+ */
+class ScopedJsonWriterArray
+{
+ friend class JsonWriter;
+
+ JsonWriter& mrWriter;
+
+ ScopedJsonWriterArray(JsonWriter& rWriter)
+ : mrWriter(rWriter)
+ {
+ }
+
+public:
+ ~ScopedJsonWriterArray() { mrWriter.endArray(); }
+};
+
+/**
+ * Auto-closes the node.
+ */
+class ScopedJsonWriterStruct
+{
+ friend class JsonWriter;
+
+ JsonWriter& mrWriter;
+
+ ScopedJsonWriterStruct(JsonWriter& rWriter)
+ : mrWriter(rWriter)
+ {
+ }
+
+public:
+ ~ScopedJsonWriterStruct() { mrWriter.endStruct(); }
+};
+};
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/tools/line.hxx b/include/tools/line.hxx
new file mode 100644
index 000000000..97cf449fc
--- /dev/null
+++ b/include/tools/line.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_LINE_HXX
+#define INCLUDED_TOOLS_LINE_HXX
+
+#include <tools/toolsdllapi.h>
+#include <tools/gen.hxx>
+
+namespace tools
+{
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Line
+{
+private:
+ Point maStart;
+ Point maEnd;
+
+public:
+ Line( const Point& rStartPt, const Point& rEndPt ) : maStart( rStartPt ), maEnd( rEndPt ) {}
+
+ void SetStart( const Point& rStartPt ) { maStart = rStartPt; }
+ const Point& GetStart() const { return maStart; }
+
+ void SetEnd( const Point& rEndPt ) { maEnd = rEndPt; }
+ const Point& GetEnd() const { return maEnd; }
+
+ double GetLength() const;
+
+ bool Intersection( const tools::Line& rLine, double& rIntersectionX, double& rIntersectionY ) const;
+ bool Intersection( const tools::Line& rLine, Point& rIntersection ) const;
+
+ double GetDistance( const double& rPtX, const double& rPtY ) const;
+ double GetDistance( const Point& rPoint ) const { return GetDistance( rPoint.X(), rPoint.Y() ); }
+};
+
+} // namespace tools
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/lineend.hxx b/include/tools/lineend.hxx
new file mode 100644
index 000000000..165d8b549
--- /dev/null
+++ b/include/tools/lineend.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TOOLS_LINEEND_HXX
+#define INCLUDED_TOOLS_LINEEND_HXX
+
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/toolsdllapi.h>
+
+enum LineEnd { LINEEND_CR, LINEEND_LF, LINEEND_CRLF };
+
+inline LineEnd GetSystemLineEnd()
+{
+#if defined(_WIN32)
+ return LINEEND_CRLF;
+#else
+ return LINEEND_LF;
+#endif
+}
+
+TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd);
+TOOLS_DLLPUBLIC OUString convertLineEnd(const OUString &rIn, LineEnd eLineEnd);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/link.hxx b/include/tools/link.hxx
new file mode 100644
index 000000000..ec88bf953
--- /dev/null
+++ b/include/tools/link.hxx
@@ -0,0 +1,180 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLS_LINK_HXX
+#define INCLUDED_TOOLS_LINK_HXX
+
+#include <sal/config.h>
+
+#include <sal/macros.h>
+#include <sal/types.h>
+
+#define DECL_LINK(Member, ArgType, RetType) \
+ static RetType LinkStub##Member(void *, ArgType); \
+ RetType Member(ArgType)
+
+#define DECL_STATIC_LINK(Class, Member, ArgType, RetType) \
+ static RetType LinkStub##Member(void *, ArgType); \
+ static RetType Member(Class *, ArgType)
+
+#define DECL_DLLPRIVATE_LINK(Member, ArgType, RetType) \
+ SAL_DLLPRIVATE static RetType LinkStub##Member(void *, ArgType); \
+ SAL_DLLPRIVATE RetType Member(ArgType)
+
+#define DECL_DLLPRIVATE_STATIC_LINK(Class, Member, ArgType, RetType) \
+ SAL_DLLPRIVATE static RetType LinkStub##Member(void *, ArgType); \
+ SAL_DLLPRIVATE static RetType Member(Class *, ArgType)
+
+#define IMPL_LINK(Class, Member, ArgType, ArgName, RetType) \
+ RetType Class::LinkStub##Member(void * instance, ArgType data) { \
+ return static_cast<Class *>(instance)->Member(data); \
+ } \
+ RetType Class::Member(ArgType ArgName)
+
+#define IMPL_LINK_NOARG(Class, Member, ArgType, RetType) \
+ RetType Class::LinkStub##Member(void * instance, ArgType data) { \
+ return static_cast<Class *>(instance)->Member(data); \
+ } \
+ RetType Class::Member(SAL_UNUSED_PARAMETER ArgType)
+
+#define IMPL_STATIC_LINK( \
+ Class, Member, ArgType, ArgName, RetType) \
+ RetType Class::LinkStub##Member(void * instance, ArgType data) { \
+ return Member(static_cast<Class *>(instance), data); \
+ } \
+ RetType Class::Member(SAL_UNUSED_PARAMETER Class *, ArgType ArgName)
+
+#define IMPL_STATIC_LINK_NOARG( \
+ Class, Member, ArgType, RetType) \
+ RetType Class::LinkStub##Member(void * instance, ArgType data) { \
+ return Member(static_cast<Class *>(instance), data); \
+ } \
+ RetType Class::Member( \
+ SAL_UNUSED_PARAMETER Class *, SAL_UNUSED_PARAMETER ArgType)
+
+#ifdef DBG_UTIL
+#define LINK(Instance, Class, Member) ::tools::detail::makeLink( \
+ ::tools::detail::castTo<Class *>(Instance), &Class::LinkStub##Member, __FILE__, __LINE__, SAL_STRINGIFY(Class::LinkStub##Member))
+#else
+#define LINK(Instance, Class, Member) ::tools::detail::makeLink( \
+ ::tools::detail::castTo<Class *>(Instance), &Class::LinkStub##Member)
+#endif
+
+template<typename Arg, typename Ret>
+class SAL_WARN_UNUSED Link {
+public:
+ typedef Ret Stub(void *, Arg);
+
+#ifdef DBG_UTIL
+ Link()
+ : function_(nullptr)
+ , instance_(nullptr)
+ , file_("unknown")
+ , line_(0)
+ , target_("unknown")
+ {
+ }
+
+ Link(void* instance, Stub* function, const char* const file = "unknown", const int line = 0,
+ const char* const target = "unknown")
+ : function_(function)
+ , instance_(instance)
+ , file_(file)
+ , line_(line)
+ , target_(target)
+ {
+ }
+#else
+ Link(): function_(nullptr), instance_(nullptr) {}
+
+ Link(void * instance, Stub * function):
+ function_(function), instance_(instance) {}
+#endif
+
+ Ret Call(Arg data) const
+ { return function_ == nullptr ? Ret() : (*function_)(instance_, data); }
+
+ bool IsSet() const { return function_ != nullptr; }
+
+ bool operator !() const { return !IsSet(); }
+
+ bool operator <(Link const & other) const {
+ char* ptr1 = reinterpret_cast<char*>(function_);
+ char* ptr2 = reinterpret_cast<char*>(other.function_);
+ if (ptr1 < ptr2)
+ return true;
+ else if (ptr1 > ptr2)
+ return false;
+ else
+ return instance_ < other.instance_;
+ };
+
+ bool operator ==(Link const & other) const
+ { return function_ == other.function_ && instance_ == other.instance_; };
+
+ void *GetInstance() const { return instance_; }
+
+#ifdef DBG_UTIL
+ const char* getSourceFilename() const { return file_; }
+ int getSourceLineNumber() const { return line_; }
+ const char* getTargetName() const { return target_; }
+#endif
+
+private:
+ Stub * function_;
+ void * instance_;
+
+#ifdef DBG_UTIL
+ /// Support tracing link source and target.
+ /// When debugging async events, it's often critical
+ /// to find out not only where a link leads (i.e. the target
+ /// function), but also where it was created (file:line).
+ const char* file_;
+ int line_;
+ const char* target_;
+#endif
+};
+
+// Class used to indicate that the Call() parameter is not in use:
+class LinkParamNone { LinkParamNone() = delete; };
+
+namespace tools::detail {
+
+// Avoids loplugin:redundantcast in LINK macro, in the common case that Instance
+// is already of type Class * (instead of a derived type):
+template<typename To, typename From> To castTo(From from)
+{ return static_cast<To>(from); }
+
+#ifdef DBG_UTIL
+template<typename Arg, typename Ret>
+Link<Arg, Ret> makeLink(void * instance, Ret (* function)(void *, Arg), const char* file, int line, const char* target) {
+ return Link<Arg, Ret>(instance, function, file, line, target);
+}
+#else
+template<typename Arg, typename Ret>
+Link<Arg, Ret> makeLink(void * instance, Ret (* function)(void *, Arg)) {
+ return Link<Arg, Ret>(instance, function);
+}
+#endif
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/long.hxx b/include/tools/long.hxx
new file mode 100644
index 000000000..2388565df
--- /dev/null
+++ b/include/tools/long.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <sal/types.h>
+
+/**
+ * We have an unfortunate problem in that, on Windows (both 32 and 64-bit), long is always 32-bit.
+ * But on Linux (64-bit) long is 64-bit. Which leads to nasty situations where things that work
+ * on Linux, failed on Windows.
+ * So.....,
+ * (1) introduce a typedef that replaces (almost) all previous usage
+ * (2) on 64-bit Windows, this typedef is forced to 64-bit (32-bit platforms, including 32-bit Windows, are left alone)
+ * (3) fix fallout from (2)
+ *
+ * As a consequence of the above, it would be best, over the long term, to regard usage
+ * of tools::Long in the codebase as meaning "we're not sure what the ideal size of the datatype is",
+ * and where possible, replace it with a better datatype like sal_Int32/sal_Int64/etc.
+ *
+ * NOTE: If you change this, make sure HAVE_FEATURE_JUMBO_SHEETS matches this, as it requires at least 64bit tools::Long.
+ */
+namespace tools
+{
+#if defined _WIN64
+typedef sal_Int64 Long;
+typedef sal_uInt64 ULong;
+#else
+typedef long Long;
+typedef unsigned long ULong;
+#endif
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/tools/mapunit.hxx b/include/tools/mapunit.hxx
new file mode 100644
index 000000000..fcaa03bcd
--- /dev/null
+++ b/include/tools/mapunit.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLS_MAPUNIT_HXX
+#define INCLUDED_TOOLS_MAPUNIT_HXX
+
+enum class MapUnit
+{
+ Map100thMM, Map10thMM, MapMM, MapCM,
+ Map1000thInch, Map100thInch, Map10thInch, MapInch,
+ MapPoint, MapTwip,
+ MapPixel,
+ MapSysFont, MapAppFont,
+ MapRelative,
+ LAST = MapRelative,
+ LASTENUMDUMMY // used as an error return
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/multisel.hxx b/include/tools/multisel.hxx
new file mode 100644
index 000000000..ea7a1343f
--- /dev/null
+++ b/include/tools/multisel.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_MULTISEL_HXX
+#define INCLUDED_TOOLS_MULTISEL_HXX
+
+#include <tools/toolsdllapi.h>
+#include <tools/gen.hxx>
+#include <rtl/ustring.hxx>
+
+#include <cstddef>
+#include <vector>
+#include <o3tl/sorted_vector.hxx>
+
+#define SFX_ENDOFSELECTION (-1)
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC MultiSelection
+{
+private:
+ std::vector< Range >
+ aSels; // array of SV-selections
+ Range aTotRange; // total range of indexes
+ std::size_t nCurSubSel; // index in aSels of current selected index
+ sal_Int32 nCurIndex; // current selected entry
+ sal_Int32 nSelCount; // number of selected indexes
+ bool bCurValid; // are nCurIndex and nCurSubSel valid
+
+ TOOLS_DLLPRIVATE void ImplClear();
+ TOOLS_DLLPRIVATE std::size_t ImplFindSubSelection( sal_Int32 nIndex ) const;
+ TOOLS_DLLPRIVATE void ImplMergeSubSelections( sal_Int32 nPos1, std::size_t nPos2 );
+
+public:
+ MultiSelection();
+ MultiSelection( const MultiSelection& rOrig );
+ MultiSelection( const Range& rRange );
+ ~MultiSelection();
+
+ MultiSelection& operator= ( const MultiSelection& rOrig );
+
+ void SelectAll( bool bSelect = true );
+ bool Select( sal_Int32 nIndex, bool bSelect = true );
+ void Select( const Range& rIndexRange, bool bSelect = true );
+ bool IsSelected( sal_Int32 nIndex ) const;
+ bool IsAllSelected() const
+ { return nSelCount == aTotRange.Len(); }
+ sal_Int32 GetSelectCount() const { return nSelCount; }
+
+ void SetTotalRange( const Range& rTotRange );
+ void Insert( sal_Int32 nIndex, sal_Int32 nCount = 1 );
+ void Remove( sal_Int32 nIndex );
+ void Reset();
+
+ const Range& GetTotalRange() const { return aTotRange; }
+ sal_Int32 FirstSelected();
+ sal_Int32 LastSelected();
+ sal_Int32 NextSelected();
+
+ sal_Int32 GetRangeCount() const { return aSels.size(); }
+ const Range& GetRange( sal_Int32 nRange ) const { return aSels[nRange]; }
+};
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC StringRangeEnumerator
+{
+ struct Range
+ {
+ sal_Int32 nFirst;
+ sal_Int32 nLast;
+
+ Range( sal_Int32 i_nFirst, sal_Int32 i_nLast ) : nFirst( i_nFirst ), nLast( i_nLast ) {}
+ };
+ std::vector< StringRangeEnumerator::Range > maSequence;
+ sal_Int32 mnCount;
+ sal_Int32 mnMin;
+ sal_Int32 mnMax;
+ sal_Int32 mnOffset;
+ bool mbValidInput;
+
+ bool setRange( std::u16string_view i_rNewRange );
+ bool insertRange( sal_Int32 nFirst, sal_Int32 nLast, bool bSequence );
+ void insertJoinedRanges( const std::vector< sal_Int32 >& rNumbers );
+ bool checkValue( sal_Int32, const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues = nullptr ) const;
+public:
+ class TOOLS_DLLPUBLIC Iterator
+ {
+ const StringRangeEnumerator* pEnumerator;
+ const o3tl::sorted_vector< sal_Int32 >* pPossibleValues;
+ sal_Int32 nRangeIndex;
+ sal_Int32 nCurrent;
+
+ friend class StringRangeEnumerator;
+ Iterator( const StringRangeEnumerator* i_pEnum,
+ const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues,
+ sal_Int32 i_nRange,
+ sal_Int32 i_nCurrent )
+ : pEnumerator( i_pEnum ), pPossibleValues( i_pPossibleValues )
+ , nRangeIndex( i_nRange ), nCurrent( i_nCurrent ) {}
+
+ public:
+ Iterator& operator++();
+ sal_Int32 operator*() const { return nCurrent;}
+ bool operator==(const Iterator&) const;
+ bool operator!=(const Iterator& i_rComp) const
+ { return ! (*this == i_rComp); }
+ };
+
+ friend class StringRangeEnumerator::Iterator;
+
+ StringRangeEnumerator( std::u16string_view i_rInput,
+ sal_Int32 i_nMinNumber,
+ sal_Int32 i_nMaxNumber,
+ sal_Int32 i_nLogicalOffset = -1
+ );
+
+ sal_Int32 size() const { return mnCount; }
+ Iterator begin( const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues = nullptr ) const;
+ Iterator end( const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues = nullptr ) const;
+
+ bool hasValue( sal_Int32 nValue, const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues = nullptr ) const;
+
+ /**
+ i_rPageRange: the string to be changed into a sequence of numbers
+ valid format example "5-3,9,9,7-8" ; instead of ',' ';' or ' ' are allowed as well
+ o_rPageVector: the output sequence of numbers
+ i_nLogicalOffset: an offset to be applied to each number in the string before inserting it in the resulting sequence
+ example: a user enters page numbers from 1 to n (since that is logical)
+ of course usable page numbers in code would start from 0 and end at n-1
+ so the logical offset would be -1
+ i_nMinNumber: the minimum allowed number
+ i_nMaxNumber: the maximum allowed number
+
+ @returns: true if the input string was valid, o_rPageVector will contain the resulting sequence
+ false if the input string was invalid, o_rPageVector will contain
+ the sequence that parser is able to extract
+
+ behavior:
+ - only non-negative sequence numbers are allowed
+ - only non-negative values in the input string are allowed
+ - the string "-3" means the sequence i_nMinNumber to 3
+ - the string "3-" means the sequence 3 to i_nMaxNumber
+ - the string "-" means the sequence i_nMinNumber to i_nMaxNumber
+ - single number that doesn't fit in [i_nMinNumber,i_nMaxNumber] will be ignored
+ - range that doesn't fit in [i_nMinNumber,i_nMaxNumber] will be adjusted
+ */
+ static bool getRangesFromString( std::u16string_view i_rPageRange,
+ std::vector< sal_Int32 >& o_rPageVector,
+ sal_Int32 i_nMinNumber,
+ sal_Int32 i_nMaxNumber,
+ sal_Int32 i_nLogicalOffset = -1,
+ o3tl::sorted_vector< sal_Int32 > const * i_pPossibleValues = nullptr
+ );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/pathutils.hxx b/include/tools/pathutils.hxx
new file mode 100644
index 000000000..045ec4b96
--- /dev/null
+++ b/include/tools/pathutils.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_PATHUTILS_HXX
+#define INCLUDED_TOOLS_PATHUTILS_HXX
+
+#include <sal/config.h>
+
+#if defined(_WIN32)
+#include <cstddef>
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+// The compiled code is not part of the tl dynamic library, but is delivered as
+// pathutils-obj and pathutils-slo objects (it is linked into special
+// executables and dynamic libraries that do not link against OOo libraries):
+namespace tools
+{
+/** Determine the filename part of a path.
+ @param path
+ A non-NULL pointer to a null-terminated path.
+ @return
+ A pointer to the trailing filename part of the given path.
+*/
+WCHAR* filename(WCHAR* path);
+
+/** Concatenate two paths.
+
+ Either the first path is empty and the second path is an absolute path. Or
+ the first path is an absolute path that ends in a backslash and the second
+ path is a relative path. In the latter case, to avoid paths that grow too
+ long, leading .. segments of the second path are removed together with
+ trailing segments from the first path. This should not cause problems as long
+ as there are no symbolic links on Windows (as with symbolic links, x\y\.. and
+ x might denote different directories).
+
+ @param path
+ An output parameter taking the resulting path; must point at a valid
+ range of memory of size at least MAX_PATH. If NULL is returned, the
+ content is unspecified.
+ @param frontBegin, frontEnd
+ Forms a valid range [frontBegin .. frontEnd) of less than MAX_PATH size.
+ @param backBegin, backLength
+ Forms a valid range [backBegin .. backBegin + backLength) of less than
+ MAX_PATH size.
+ @return
+ A pointer to the terminating null character of the concatenation, or NULL
+ if a failure occurred.
+*/
+WCHAR* buildPath(WCHAR* path, WCHAR const* frontBegin, WCHAR const* frontEnd,
+ WCHAR const* backBegin, std::size_t backLength);
+}
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx
new file mode 100644
index 000000000..d9f2a4544
--- /dev/null
+++ b/include/tools/poly.hxx
@@ -0,0 +1,315 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_POLY_HXX
+#define INCLUDED_TOOLS_POLY_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/toolsdllapi.h>
+#include <tools/gen.hxx>
+#include <tools/degree.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <o3tl/cow_wrapper.hxx>
+
+#include <vector>
+
+#define POLY_APPEND (0xFFFF)
+#define POLYPOLY_APPEND (0xFFFF)
+
+enum class PolyOptimizeFlags {
+ NONE = 0x0000,
+ CLOSE = 0x0001,
+ NO_SAME = 0x0002,
+ EDGES = 0x0004,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<PolyOptimizeFlags> : is_typed_flags<PolyOptimizeFlags, 0x0007> {};
+}
+
+enum class PolyStyle
+{
+ Arc = 1,
+ Pie = 2,
+ Chord = 3
+};
+
+enum class PolyFlags : sal_uInt8
+{
+ Normal, // start-/endpoint of a curve or a line
+ Smooth, // smooth transition between curves
+ Control, // control handles of a Bezier curve
+ Symmetric // smooth and symmetrical transition between curves
+};
+
+class SvStream;
+class ImplPolygon;
+struct ImplPolyPolygon;
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DPolyPolygon;
+}
+
+namespace tools {
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Polygon
+{
+public:
+ typedef o3tl::cow_wrapper<ImplPolygon> ImplType;
+private:
+ ImplType mpImplPolygon;
+
+public:
+ static void ImplReduceEdges( tools::Polygon& rPoly, const double& rArea, sal_uInt16 nPercent );
+ void ImplRead( SvStream& rIStream );
+ void ImplWrite( SvStream& rOStream ) const;
+
+public:
+ Polygon();
+ Polygon( sal_uInt16 nSize );
+ Polygon( sal_uInt16 nPoints, const Point* pPtAry,
+ const PolyFlags* pFlagAry = nullptr );
+ Polygon( const tools::Rectangle& rRect );
+ Polygon( const tools::Rectangle& rRect,
+ sal_uInt32 nHorzRound, sal_uInt32 nVertRound );
+ Polygon( const Point& rCenter,
+ tools::Long nRadX, tools::Long nRadY );
+ Polygon( const tools::Rectangle& rBound,
+ const Point& rStart, const Point& rEnd,
+ PolyStyle ePolyStyle = PolyStyle::Arc,
+ const bool bClockWiseArcDirection = false);
+ Polygon( const Point& rBezPt1, const Point& rCtrlPt1,
+ const Point& rBezPt2, const Point& rCtrlPt2,
+ sal_uInt16 nPoints );
+
+ Polygon( const tools::Polygon& rPoly );
+ Polygon( tools::Polygon&& rPoly) noexcept;
+ ~Polygon();
+
+ void SetPoint( const Point& rPt, sal_uInt16 nPos );
+ const Point& GetPoint( sal_uInt16 nPos ) const;
+
+ void SetFlags( sal_uInt16 nPos, PolyFlags eFlags );
+ PolyFlags GetFlags( sal_uInt16 nPos ) const;
+ bool HasFlags() const;
+
+ bool IsRect() const;
+
+ void SetSize( sal_uInt16 nNewSize );
+ sal_uInt16 GetSize() const;
+
+ void Clear();
+
+ tools::Rectangle GetBoundRect() const;
+ bool Contains( const Point& rPt ) const;
+ double CalcDistance( sal_uInt16 nPt1, sal_uInt16 nPt2 ) const;
+ void Clip( const tools::Rectangle& rRect );
+ void Optimize( PolyOptimizeFlags nOptimizeFlags );
+
+ /** Adaptive subdivision of polygons with curves
+
+ This method adaptively subdivides bezier arcs within the
+ polygon to straight line segments and returns the resulting
+ polygon.
+
+ @param rResult
+ The resulting subdivided polygon
+
+ @param d
+ This parameter controls the amount of subdivision. The
+ original curve is guaranteed to not differ by more than this
+ amount per bezier segment from the subdivided
+ lines. Concretely, if the polygon is in device coordinates and
+ d equals 1.0, then the difference between the subdivided and
+ the original polygon is guaranteed to be smaller than one
+ pixel.
+ */
+ void AdaptiveSubdivide( tools::Polygon& rResult, const double d = 1.0 ) const;
+ static Polygon SubdivideBezier( const Polygon& rPoly );
+
+ void Move( tools::Long nHorzMove, tools::Long nVertMove );
+ void Translate( const Point& rTrans );
+ void Scale( double fScaleX, double fScaleY );
+ void Rotate( const Point& rCenter, double fSin, double fCos );
+ void Rotate( const Point& rCenter, Degree10 nAngle10 );
+
+ void Insert( sal_uInt16 nPos, const Point& rPt );
+ void Insert( sal_uInt16 nPos, const tools::Polygon& rPoly );
+
+ const Point& operator[]( sal_uInt16 nPos ) const { return GetPoint( nPos ); }
+ Point& operator[]( sal_uInt16 nPos );
+
+ tools::Polygon& operator=( const tools::Polygon& rPoly );
+ tools::Polygon& operator=( tools::Polygon&& rPoly ) noexcept;
+ bool operator==( const tools::Polygon& rPoly ) const;
+ bool operator!=( const tools::Polygon& rPoly ) const
+ { return !(Polygon::operator==( rPoly )); }
+ bool IsEqual( const tools::Polygon& rPoly ) const;
+
+ // streaming a Polygon does ignore PolyFlags, so use the Write Or Read
+ // method to take care of PolyFlags
+ TOOLS_DLLPUBLIC friend SvStream& ReadPolygon( SvStream& rIStream, tools::Polygon& rPoly );
+ TOOLS_DLLPUBLIC friend SvStream& WritePolygon( SvStream& rOStream, const tools::Polygon& rPoly );
+
+ void Read( SvStream& rIStream );
+ void Write( SvStream& rOStream ) const;
+
+ Point * GetPointAry();
+ const Point* GetConstPointAry() const;
+ const PolyFlags* GetConstFlagAry() const;
+
+ // convert to ::basegfx::B2DPolygon and return
+ ::basegfx::B2DPolygon getB2DPolygon() const;
+
+ // constructor to convert from ::basegfx::B2DPolygon
+ // #i76339# made explicit
+ explicit Polygon(const ::basegfx::B2DPolygon& rPolygon);
+};
+
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC PolyPolygon
+{
+private:
+ o3tl::cow_wrapper<ImplPolyPolygon> mpImplPolyPolygon;
+
+ enum class PolyClipOp {
+ INTERSECT,
+ UNION
+ };
+ TOOLS_DLLPRIVATE void ImplDoOperation( const tools::PolyPolygon& rPolyPoly, tools::PolyPolygon& rResult, PolyClipOp nOperation ) const;
+
+public:
+ PolyPolygon( sal_uInt16 nInitSize = 16 );
+ PolyPolygon( const tools::Polygon& rPoly );
+ PolyPolygon( const tools::PolyPolygon& rPolyPoly );
+ PolyPolygon( tools::PolyPolygon&& rPolyPoly ) noexcept;
+ ~PolyPolygon();
+
+ void Insert( const tools::Polygon& rPoly, sal_uInt16 nPos = POLYPOLY_APPEND );
+ void Remove( sal_uInt16 nPos );
+ void Replace( const Polygon& rPoly, sal_uInt16 nPos );
+ const tools::Polygon& GetObject( sal_uInt16 nPos ) const;
+
+ bool IsRect() const;
+
+ void Clear();
+
+ sal_uInt16 Count() const;
+ tools::Rectangle GetBoundRect() const;
+ void Clip( const tools::Rectangle& rRect );
+ void Optimize( PolyOptimizeFlags nOptimizeFlags );
+
+ /** Adaptive subdivision of polygons with curves
+
+ This method adaptively subdivides bezier arcs within the
+ polygon to straight line segments and returns the resulting
+ polygon.
+
+ @param rResult
+ The resulting subdivided polygon
+
+ If the polygon is in device coordinates, then the difference between the subdivided and
+ the original polygon is guaranteed to be smaller than one
+ pixel.
+ */
+ void AdaptiveSubdivide( tools::PolyPolygon& rResult ) const;
+ static tools::PolyPolygon SubdivideBezier( const tools::PolyPolygon& rPolyPoly );
+
+ void GetIntersection( const tools::PolyPolygon& rPolyPoly, tools::PolyPolygon& rResult ) const;
+ void GetUnion( const tools::PolyPolygon& rPolyPoly, tools::PolyPolygon& rResult ) const;
+
+ void Move( tools::Long nHorzMove, tools::Long nVertMove );
+ void Translate( const Point& rTrans );
+ void Scale( double fScaleX, double fScaleY );
+ void Rotate( const Point& rCenter, double fSin, double fCos );
+ void Rotate( const Point& rCenter, Degree10 nAngle10 );
+
+ const tools::Polygon& operator[]( sal_uInt16 nPos ) const { return GetObject( nPos ); }
+ tools::Polygon& operator[]( sal_uInt16 nPos );
+
+ tools::PolyPolygon& operator=( const tools::PolyPolygon& rPolyPoly );
+ tools::PolyPolygon& operator=( tools::PolyPolygon&& rPolyPoly ) noexcept;
+ bool operator==( const tools::PolyPolygon& rPolyPoly ) const;
+ bool operator!=( const tools::PolyPolygon& rPolyPoly ) const
+ { return !(PolyPolygon::operator==( rPolyPoly )); }
+
+ TOOLS_DLLPUBLIC friend SvStream& ReadPolyPolygon( SvStream& rIStream, tools::PolyPolygon& rPolyPoly );
+ TOOLS_DLLPUBLIC friend SvStream& WritePolyPolygon( SvStream& rOStream, const tools::PolyPolygon& rPolyPoly );
+
+ void Read( SvStream& rIStream );
+ void Write( SvStream& rOStream ) const;
+
+ // convert to ::basegfx::B2DPolyPolygon and return
+ ::basegfx::B2DPolyPolygon getB2DPolyPolygon() const;
+
+ // constructor to convert from ::basegfx::B2DPolyPolygon
+ // #i76339# made explicit
+ explicit PolyPolygon(const ::basegfx::B2DPolyPolygon& rPolyPolygon);
+};
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const Polygon& poly )
+{
+ stream << "<" << poly.GetSize() << ":";
+ for (sal_uInt16 i = 0; i < poly.GetSize(); i++)
+ {
+ if (i > 0)
+ stream << "--";
+ stream << poly.GetPoint(i);
+
+ OUString aFlag;
+ if (poly.GetFlags(i) == PolyFlags::Normal)
+ aFlag = "Normal";
+ else if (poly.GetFlags(i) == PolyFlags::Smooth)
+ aFlag = "Smooth";
+ else if (poly.GetFlags(i) == PolyFlags::Control)
+ aFlag = "Control";
+ else if (poly.GetFlags(i) == PolyFlags::Symmetric)
+ aFlag = "Symmetric";
+
+ stream << ";f=" << aFlag;
+ }
+ stream << ">";
+ return stream;
+}
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const PolyPolygon& poly )
+{
+ stream << "[" << poly.Count() << ":";
+ for (sal_uInt16 i = 0; i < poly.Count(); i++)
+ {
+ if (i > 0)
+ stream << ",";
+ stream << poly.GetObject(i);
+ }
+ stream << "]";
+ return stream;
+}
+
+} /* namespace tools */
+
+typedef std::vector< tools::PolyPolygon > PolyPolyVector;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx
new file mode 100644
index 000000000..3f245bf08
--- /dev/null
+++ b/include/tools/ref.hxx
@@ -0,0 +1,234 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_REF_HXX
+#define INCLUDED_TOOLS_REF_HXX
+
+#include <sal/config.h>
+#include <cassert>
+#include <tools/toolsdllapi.h>
+#include <utility>
+
+/**
+ This implements similar functionality to boost::intrusive_ptr
+*/
+
+namespace tools {
+
+/** T must be a class that extends SvRefBase */
+template<typename T> class SAL_DLLPUBLIC_RTTI SvRef final {
+public:
+ SvRef(): pObj(nullptr) {}
+
+ SvRef(SvRef&& rObj) noexcept
+ {
+ pObj = rObj.pObj;
+ rObj.pObj = nullptr;
+ }
+
+ SvRef(SvRef const & rObj): pObj(rObj.pObj)
+ {
+ if (pObj != nullptr) pObj->AddNextRef();
+ }
+
+ SvRef(T * pObjP): pObj(pObjP)
+ {
+ if (pObj != nullptr) pObj->AddFirstRef();
+ }
+
+ ~SvRef()
+ {
+ if (pObj != nullptr) pObj->ReleaseRef();
+ }
+
+ void clear()
+ {
+ if (pObj != nullptr) {
+ T * pRefObj = pObj;
+ pObj = nullptr;
+ pRefObj->ReleaseRef();
+ }
+ }
+
+ SvRef & operator =(SvRef const & rObj)
+ {
+ if (rObj.pObj != nullptr) {
+ rObj.pObj->AddNextRef();
+ }
+ T * pRefObj = pObj;
+ pObj = rObj.pObj;
+ if (pRefObj != nullptr) {
+ pRefObj->ReleaseRef();
+ }
+ return *this;
+ }
+
+ SvRef & operator =(SvRef && rObj)
+ {
+ if (pObj != nullptr) {
+ pObj->ReleaseRef();
+ }
+ pObj = rObj.pObj;
+ rObj.pObj = nullptr;
+ return *this;
+ }
+
+ bool is() const { return pObj != nullptr; }
+
+ explicit operator bool() const { return is(); }
+
+ T * get() const { return pObj; }
+
+ T * operator ->() const { assert(pObj != nullptr); return pObj; }
+
+ T & operator *() const { assert(pObj != nullptr); return *pObj; }
+
+ bool operator ==(const SvRef<T> &rhs) const { return pObj == rhs.pObj; }
+ bool operator !=(const SvRef<T> &rhs) const { return !(*this == rhs); }
+
+private:
+ T * pObj;
+};
+
+/**
+ * This implements similar functionality to std::make_shared.
+ */
+template<typename T, typename... Args>
+SvRef<T> make_ref(Args&& ... args)
+{
+ return SvRef<T>(new T(std::forward<Args>(args)...));
+}
+
+}
+
+/** Classes that want to be referenced-counted via SvRef<T>, should extend this base class */
+class TOOLS_DLLPUBLIC SvRefBase
+{
+ // work around a clang 3.5 optimization bug: if the bNoDelete is *first*
+ // it mis-compiles "if (--nRefCount == 0)" and never deletes any object
+ unsigned int nRefCount : 31;
+ // the only reason this is not bool is because MSVC cannot handle mixed type bitfields
+ unsigned int bNoDelete : 1;
+
+protected:
+ virtual ~SvRefBase() COVERITY_NOEXCEPT_FALSE;
+
+public:
+ SvRefBase() : nRefCount(0), bNoDelete(1) {}
+ SvRefBase(const SvRefBase &) : nRefCount(0), bNoDelete(1) {}
+
+ SvRefBase & operator=(const SvRefBase &) { return *this; }
+
+ void RestoreNoDelete()
+ { bNoDelete = 1; }
+
+ void AddNextRef()
+ {
+ assert( nRefCount < (1 << 30) && "Do not add refs to dead objects" );
+ ++nRefCount;
+ }
+
+ void AddFirstRef()
+ {
+ assert( nRefCount < (1 << 30) && "Do not add refs to dead objects" );
+ if( bNoDelete )
+ bNoDelete = 0;
+ ++nRefCount;
+ }
+
+ void ReleaseRef()
+ {
+ assert( nRefCount >= 1);
+ if( --nRefCount == 0 && !bNoDelete)
+ {
+ // I'm not sure about the original purpose of this line, but right now
+ // it serves the purpose that anything that attempts to do an AddRef()
+ // after an object is deleted will trip an assert.
+ nRefCount = 1 << 30;
+ delete this;
+ }
+ }
+
+ unsigned int GetRefCount() const
+ { return nRefCount; }
+};
+
+template<typename T>
+class SvCompatWeakBase;
+
+/** SvCompatWeakHdl acts as an intermediary between SvCompatWeakRef<T> and T.
+*/
+template<typename T>
+class SvCompatWeakHdl final : public SvRefBase
+{
+ friend class SvCompatWeakBase<T>;
+ T* _pObj;
+
+ SvCompatWeakHdl( T* pObj ) : _pObj( pObj ) {}
+
+public:
+ void ResetWeakBase( ) { _pObj = nullptr; }
+ T* GetObj() { return _pObj; }
+};
+
+/** We only have one place that extends this, in include/sfx2/frame.hxx, class SfxFrame.
+ Its function is to notify the SvCompatWeakHdl when an SfxFrame object is deleted.
+*/
+template<typename T>
+class SvCompatWeakBase
+{
+ tools::SvRef< SvCompatWeakHdl<T> > _xHdl;
+
+public:
+ /** Does not use initializer due to compiler warnings,
+ because the lifetime of the _xHdl object can exceed the lifetime of this class.
+ */
+ SvCompatWeakBase( T* pObj ) { _xHdl = new SvCompatWeakHdl<T>( pObj ); }
+
+ ~SvCompatWeakBase() { _xHdl->ResetWeakBase(); }
+
+ SvCompatWeakHdl<T>* GetHdl() { return _xHdl.get(); }
+};
+
+/** We only have one weak reference in LO, in include/sfx2/frame.hxx, class SfxFrameWeak.
+*/
+template<typename T>
+class SAL_WARN_UNUSED SvCompatWeakRef
+{
+ tools::SvRef< SvCompatWeakHdl<T> > _xHdl;
+public:
+ SvCompatWeakRef( ) {}
+ SvCompatWeakRef( T* pObj )
+ { if( pObj ) _xHdl = pObj->GetHdl(); }
+#if defined(__COVERITY__)
+ ~SvCompatWeakRef() COVERITY_NOEXCEPT_FALSE {}
+#endif
+ SvCompatWeakRef& operator = ( T * pObj )
+ { _xHdl = pObj ? pObj->GetHdl() : nullptr; return *this; }
+ bool is() const
+ { return _xHdl.is() && _xHdl->GetObj(); }
+ explicit operator bool() const { return is(); }
+ T* operator -> () const
+ { return _xHdl.is() ? _xHdl->GetObj() : nullptr; }
+ operator T* () const
+ { return _xHdl.is() ? _xHdl->GetObj() : nullptr; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/resary.hxx b/include/tools/resary.hxx
new file mode 100644
index 000000000..9573a9aff
--- /dev/null
+++ b/include/tools/resary.hxx
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_RESARY_HXX
+#define INCLUDED_TOOLS_RESARY_HXX
+
+#define RESARRAY_INDEX_NOTFOUND (0xffffffff)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/simd.hxx b/include/tools/simd.hxx
new file mode 100644
index 000000000..bdfdb8928
--- /dev/null
+++ b/include/tools/simd.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_TOOLS_SIMD_HXX
+#define INCLUDED_TOOLS_SIMD_HXX
+
+namespace simd
+{
+template <typename T, unsigned int N> inline bool isAligned(const T* pointer)
+{
+ return 0 == (uintptr_t(pointer) % N);
+}
+
+template <typename T> inline T roundDown(T value, unsigned int multiple)
+{
+ return value & ~(multiple - 1);
+}
+
+} // end namespace simd
+
+#endif // INCLUDED_TOOLS_SIMD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/simdsupport.hxx b/include/tools/simdsupport.hxx
new file mode 100644
index 000000000..fa8923bb0
--- /dev/null
+++ b/include/tools/simdsupport.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+// IMPORTANT: Having CPU-specific routines turned out to be a maintenance
+// problem, because of various problems such as compilers moving CPU-specific
+// code out of #ifdef code into static initialization or our code using C++
+// features that caused the compiler to emit code that used CPU-specific
+// instructions (even cpuid.hxx isn't safe, see the comment there).
+// The only safe usage is using CPU-specific code that's always available,
+// such as SSE2-specific code for x86_64. Do not use for anything else
+// unless you really know what you are doing (and you check git history
+// to learn from past problems).
+
+// Determine the compiler support for SIMD compiler intrinsics.
+// This changes from one compiled unit to the other, depending if
+// the support has been detected and if the compiled unit contains
+// code using intrinsics or not. So we have to (re)set them again
+// every time this file has been included.
+
+// In other words... DO NOT ADD "#pragma once" here
+
+#undef LO_SSE2_AVAILABLE
+#undef LO_SSSE3_AVAILABLE
+#undef LO_AVX_AVAILABLE
+#undef LO_AVX2_AVAILABLE
+#undef LO_AVX512F_AVAILABLE
+
+#if defined(_MSC_VER) // VISUAL STUDIO COMPILER
+
+// With MSVC using -arch is in fact not necessary for being able
+// to use CPU intrinsics, code using AVX512F intrinsics will compile
+// even if compiled with -arch:AVX, the -arch option really only affects
+// instructions generated for C/C++ code.
+#if defined(_M_X64) || defined(_M_X86)
+// As such, if we're building for X86 or X64, support for these is always available
+// with MSVC2019+.
+#define LO_SSE2_AVAILABLE
+#define LO_SSSE3_AVAILABLE
+#define LO_AVX_AVAILABLE
+#define LO_AVX2_AVAILABLE
+#define LO_AVX512F_AVAILABLE
+#include <intrin.h>
+#include <immintrin.h>
+#endif
+
+#else // compiler Clang and GCC
+
+#if defined(__SSE2__) || defined(__x86_64__) // SSE2 is required for X64
+#define LO_SSE2_AVAILABLE
+#include <emmintrin.h>
+#endif // defined(__SSE2__)
+
+#if defined(__SSSE3__)
+#define LO_SSSE3_AVAILABLE
+#include <tmmintrin.h>
+#endif // defined(__SSSE3__)
+
+#if defined(__AVX__)
+#define LO_AVX_AVAILABLE
+#include <immintrin.h>
+#endif // defined(__AVX__)
+
+#if defined(__AVX2__)
+#define LO_AVX2_AVAILABLE
+#include <immintrin.h>
+#endif // defined(__AVX2__)
+
+#if defined(__AVX512F__)
+#define LO_AVX512F_AVAILABLE
+#include <immintrin.h>
+#else
+#endif // defined(__AVX512F__)
+
+#endif // end compiler Clang and GCC
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/solar.h b/include/tools/solar.h
new file mode 100644
index 000000000..ae7c5288c
--- /dev/null
+++ b/include/tools/solar.h
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLS_SOLAR_H
+#define INCLUDED_TOOLS_SOLAR_H
+
+#include <sal/types.h>
+#include <osl/endian.h>
+
+/** Intermediate type to solve type clash with Windows headers.
+ Should be removed as soon as all code parts have been reviewed
+ and the correct type is known. Most of the times ULONG is meant
+ to be a 32-Bit unsigned integer type as sal_uInt32 is often
+ used for data exchange or for similar method args. */
+typedef sal_uIntPtr sal_uLong; /* Replaces type ULONG */
+
+// misc. macros to leverage platform and compiler differences
+
+// solar binary types
+
+/* Solar (portable) Binary (exchange) Type; OSI 6 subset
+ always little endian;
+ not necessarily aligned */
+
+typedef sal_uInt8 SVBT16[2];
+typedef sal_uInt8 SVBT32[4];
+typedef sal_uInt8 SVBT64[8];
+
+#ifdef __cplusplus
+
+inline sal_uInt16 SVBT16ToUInt16( const SVBT16 p ) { return static_cast<sal_uInt16>
+ (static_cast<sal_uInt16>(p[0])
+ + (static_cast<sal_uInt16>(p[1]) << 8)); }
+inline sal_Int16 SVBT16ToInt16( const SVBT16 p ) { return sal_Int16(SVBT16ToUInt16(p)); }
+inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return static_cast<sal_uInt32>
+ (static_cast<sal_uInt32>(p[0])
+ + (static_cast<sal_uInt32>(p[1]) << 8)
+ + (static_cast<sal_uInt32>(p[2]) << 16)
+ + (static_cast<sal_uInt32>(p[3]) << 24)); }
+#if defined OSL_LITENDIAN
+inline double SVBT64ToDouble( const SVBT64 p )
+{
+ double n;
+ reinterpret_cast<sal_uInt8*>(&n)[0] = p[0];
+ reinterpret_cast<sal_uInt8*>(&n)[1] = p[1];
+ reinterpret_cast<sal_uInt8*>(&n)[2] = p[2];
+ reinterpret_cast<sal_uInt8*>(&n)[3] = p[3];
+ reinterpret_cast<sal_uInt8*>(&n)[4] = p[4];
+ reinterpret_cast<sal_uInt8*>(&n)[5] = p[5];
+ reinterpret_cast<sal_uInt8*>(&n)[6] = p[6];
+ reinterpret_cast<sal_uInt8*>(&n)[7] = p[7];
+ return n;
+}
+#else
+inline double SVBT64ToDouble( const SVBT64 p ) { double n;
+ reinterpret_cast<sal_uInt8*>(&n)[0] = p[7];
+ reinterpret_cast<sal_uInt8*>(&n)[1] = p[6];
+ reinterpret_cast<sal_uInt8*>(&n)[2] = p[5];
+ reinterpret_cast<sal_uInt8*>(&n)[3] = p[4];
+ reinterpret_cast<sal_uInt8*>(&n)[4] = p[3];
+ reinterpret_cast<sal_uInt8*>(&n)[5] = p[2];
+ reinterpret_cast<sal_uInt8*>(&n)[6] = p[1];
+ reinterpret_cast<sal_uInt8*>(&n)[7] = p[0];
+ return n; }
+#endif
+
+inline void ShortToSVBT16( sal_uInt16 n, SVBT16 p )
+{
+ p[0] = static_cast<sal_uInt8>(n);
+ p[1] = static_cast<sal_uInt8>(n >> 8);
+}
+inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p )
+{
+ p[0] = static_cast<sal_uInt8>(n);
+ p[1] = static_cast<sal_uInt8>(n >> 8);
+ p[2] = static_cast<sal_uInt8>(n >> 16);
+ p[3] = static_cast<sal_uInt8>(n >> 24);
+}
+inline void Int32ToSVBT32 ( sal_Int32 n, SVBT32 p ) { UInt32ToSVBT32(sal_uInt32(n), p); }
+#if defined OSL_LITENDIAN
+inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = reinterpret_cast<sal_uInt8*>(&n)[0];
+ p[1] = reinterpret_cast<sal_uInt8*>(&n)[1];
+ p[2] = reinterpret_cast<sal_uInt8*>(&n)[2];
+ p[3] = reinterpret_cast<sal_uInt8*>(&n)[3];
+ p[4] = reinterpret_cast<sal_uInt8*>(&n)[4];
+ p[5] = reinterpret_cast<sal_uInt8*>(&n)[5];
+ p[6] = reinterpret_cast<sal_uInt8*>(&n)[6];
+ p[7] = reinterpret_cast<sal_uInt8*>(&n)[7]; }
+#else
+inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = reinterpret_cast<sal_uInt8*>(&n)[7];
+ p[1] = reinterpret_cast<sal_uInt8*>(&n)[6];
+ p[2] = reinterpret_cast<sal_uInt8*>(&n)[5];
+ p[3] = reinterpret_cast<sal_uInt8*>(&n)[4];
+ p[4] = reinterpret_cast<sal_uInt8*>(&n)[3];
+ p[5] = reinterpret_cast<sal_uInt8*>(&n)[2];
+ p[6] = reinterpret_cast<sal_uInt8*>(&n)[1];
+ p[7] = reinterpret_cast<sal_uInt8*>(&n)[0]; }
+#endif
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
new file mode 100644
index 000000000..39e8dc52f
--- /dev/null
+++ b/include/tools/stream.hxx
@@ -0,0 +1,682 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <config_options.h>
+#include <tools/toolsdllapi.h>
+#include <tools/lineend.hxx>
+#include <tools/long.hxx>
+#include <tools/ref.hxx>
+#include <vcl/errcode.hxx>
+#include <rtl/string.hxx>
+#include <rtl/strbuf.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <memory>
+#include <string_view>
+
+class StreamData;
+
+inline rtl_TextEncoding GetStoreCharSet( rtl_TextEncoding eEncoding )
+{
+ if ( eEncoding == RTL_TEXTENCODING_ISO_8859_1 )
+ return RTL_TEXTENCODING_MS_1252;
+ else
+ return eEncoding;
+}
+
+// StreamTypes
+
+// read, write, create,... options
+enum class StreamMode {
+ NONE = 0x0000,
+ READ = 0x0001, ///< allow read accesses
+ WRITE = 0x0002, ///< allow write accesses
+// file i/o
+ NOCREATE = 0x0004, ///< 1 == Don't create file
+ TRUNC = 0x0008, ///< Truncate _existing_ file to zero length
+ COPY_ON_SYMLINK = 0x0010, ///< copy-on-write for symlinks (Unix)
+ TEMPORARY = 0x0020, ///< temporary file attribute (Windows-only)
+// sharing options
+ SHARE_DENYNONE = 0x0100,
+ SHARE_DENYREAD = 0x0200, // overrides denynone
+ SHARE_DENYWRITE = 0x0400, // overrides denynone
+ SHARE_DENYALL = 0x0800, // overrides denyread,write,none
+// masks
+ READWRITE = READ | WRITE,
+ STD_READ = READ | SHARE_DENYNONE | NOCREATE,
+ STD_WRITE = WRITE | SHARE_DENYALL,
+ STD_READWRITE = READWRITE | SHARE_DENYALL
+};
+namespace o3tl
+{
+ template<> struct typed_flags<StreamMode> : is_typed_flags<StreamMode, 0x0f3f> {};
+}
+
+#define STREAM_SEEK_TO_BEGIN 0L
+#define STREAM_SEEK_TO_END SAL_MAX_UINT64
+
+enum class SvStreamEndian { BIG, LITTLE };
+
+enum class SvStreamCompressFlags {
+ NONE = 0x0000,
+ ZBITMAP = 0x0001,
+ NATIVE = 0x0010,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvStreamCompressFlags> : is_typed_flags<SvStreamCompressFlags, 0x0011> {};
+}
+
+class SvStream;
+
+typedef SvStream& (*SvStrPtr)( SvStream& );
+
+inline SvStream& operator<<( SvStream& rStr, SvStrPtr f );
+
+// SvLockBytes
+
+struct SvLockBytesStat
+{
+ std::size_t nSize;
+
+ SvLockBytesStat() : nSize(0) {}
+};
+
+class TOOLS_DLLPUBLIC SvLockBytes: public SvRefBase
+{
+ SvStream * m_pStream;
+ bool m_bOwner;
+ bool m_bSync;
+
+protected:
+ void close();
+
+public:
+
+ SvLockBytes() : m_pStream(nullptr), m_bOwner(false), m_bSync(false) {}
+
+ SvLockBytes(SvStream * pTheStream, bool bTheOwner = false) :
+ m_pStream(pTheStream), m_bOwner(bTheOwner), m_bSync(false) {}
+
+ virtual ~SvLockBytes() override { close(); }
+
+ const SvStream * GetStream() const { return m_pStream; }
+
+ void SetSynchronMode(bool bTheSync = true) { m_bSync = bTheSync; }
+ bool IsSynchronMode() const { return m_bSync; }
+
+ virtual ErrCode ReadAt(sal_uInt64 nPos, void * pBuffer, std::size_t nCount,
+ std::size_t * pRead) const;
+ virtual ErrCode WriteAt(sal_uInt64 nPos, const void * pBuffer, std::size_t nCount,
+ std::size_t * pWritten);
+
+ virtual ErrCode Flush() const;
+
+ virtual ErrCode SetSize(sal_uInt64 nSize);
+
+ virtual ErrCode Stat(SvLockBytesStat * pStat) const;
+};
+
+typedef tools::SvRef<SvLockBytes> SvLockBytesRef;
+
+// SvStream
+
+class TOOLS_DLLPUBLIC SvStream
+{
+private:
+ // LockBytes Interface
+ SvLockBytesRef m_xLockBytes; ///< Default implementation
+ sal_uInt64 m_nActPos;
+
+ // buffer management
+ std::unique_ptr<sal_uInt8[]>
+ m_pRWBuf; ///< Points to read/write buffer
+ sal_uInt8* m_pBufPos; ///< m_pRWBuf + m_nBufActualPos
+ sal_uInt16 m_nBufSize; ///< Allocated size of buffer
+ sal_uInt16 m_nBufActualLen; ///< Length of used segment of buffer
+ ///< = m_nBufSize, if EOF did not occur
+ sal_uInt16 m_nBufActualPos; ///< current position in buffer (0..m_nBufSize-1)
+ sal_uInt16 m_nBufFree; ///< number of free slots in buffer to IO of type eIOMode
+ bool m_isIoRead;
+ bool m_isIoWrite;
+
+ // Error codes, conversion, compression, ...
+ bool m_isDirty; ///< true: Stream != buffer content
+ bool m_isSwap;
+ bool m_isEof;
+ ErrCode m_nError;
+ SvStreamCompressFlags m_nCompressMode;
+ LineEnd m_eLineDelimiter;
+ rtl_TextEncoding m_eStreamCharSet;
+
+ // Encryption
+ OString m_aCryptMaskKey;// aCryptMaskKey.getLength != 0 -> Encryption used
+ unsigned char m_nCryptMask;
+
+ // Userdata
+ sal_Int32 m_nVersion; // for external use
+
+ SvStream ( const SvStream& rStream ) = delete;
+ SvStream& operator=( const SvStream& rStream ) = delete;
+
+protected:
+ sal_uInt64 m_nBufFilePos; ///< File position of pBuf[0]
+ StreamMode m_eStreamMode;
+ bool m_isWritable;
+
+ virtual std::size_t GetData( void* pData, std::size_t nSize );
+ virtual std::size_t PutData( const void* pData, std::size_t nSize );
+ virtual sal_uInt64 SeekPos( sal_uInt64 nPos );
+ virtual void FlushData();
+ virtual void SetSize(sal_uInt64 nSize);
+
+ SAL_DLLPRIVATE void ClearError();
+ SAL_DLLPRIVATE void ClearBuffer();
+
+ // encrypt and write in blocks
+ SAL_DLLPRIVATE std::size_t CryptAndWriteBuffer( const void* pStart, std::size_t nLen );
+ SAL_DLLPRIVATE void EncryptBuffer( void* pStart, std::size_t nLen ) const;
+
+public:
+ SvStream();
+ SvStream( SvLockBytes *pLockBytes);
+ virtual ~SvStream();
+
+ SvLockBytes* GetLockBytes() const { return m_xLockBytes.get(); }
+
+ ErrCode GetError() const { return m_nError.IgnoreWarning(); }
+ ErrCode const & GetErrorCode() const { return m_nError; }
+ void SetError( ErrCode nErrorCode );
+ virtual void ResetError();
+
+ void SetEndian( SvStreamEndian SvStreamEndian );
+ SvStreamEndian GetEndian() const;
+ /// returns status of endian swap flag
+ bool IsEndianSwap() const { return m_isSwap; }
+
+ void SetCompressMode( SvStreamCompressFlags nNewMode )
+ { m_nCompressMode = nNewMode; }
+ SvStreamCompressFlags GetCompressMode() const { return m_nCompressMode; }
+
+ void SetCryptMaskKey(const OString& rCryptMaskKey);
+
+ void SetStreamCharSet( rtl_TextEncoding eCharSet )
+ { m_eStreamCharSet = eCharSet; }
+ rtl_TextEncoding GetStreamCharSet() const { return m_eStreamCharSet; }
+
+ void SetLineDelimiter( LineEnd eLineEnd )
+ { m_eLineDelimiter = eLineEnd; }
+ LineEnd GetLineDelimiter() const { return m_eLineDelimiter; }
+
+ SvStream& ReadUInt16( sal_uInt16& rUInt16 );
+ SvStream& ReadUInt32( sal_uInt32& rUInt32 );
+ SvStream& ReadUInt64( sal_uInt64& rUInt64 );
+ SvStream& ReadInt16( sal_Int16& rInt16 );
+ SvStream& ReadInt32( sal_Int32& rInt32 );
+ SvStream& ReadInt64(sal_Int64 & rInt64);
+ SvStream& ReadSChar( signed char& rChar );
+ SvStream& ReadChar( char& rChar );
+ SvStream& ReadUChar( unsigned char& rChar );
+ SvStream& ReadUtf16( sal_Unicode& rUtf16 );
+ SvStream& ReadCharAsBool( bool& rBool );
+ SvStream& ReadFloat( float& rFloat );
+ SvStream& ReadDouble( double& rDouble );
+ SvStream& ReadStream( SvStream& rStream );
+
+ SvStream& WriteUInt16( sal_uInt16 nUInt16 );
+ SvStream& WriteUInt32( sal_uInt32 nUInt32 );
+ SvStream& WriteUInt64( sal_uInt64 nuInt64 );
+ SvStream& WriteInt16( sal_Int16 nInt16 );
+ SvStream& WriteInt32( sal_Int32 nInt32 );
+ SvStream& WriteInt64( sal_Int64 nInt64 );
+ SvStream& WriteUInt8( sal_uInt8 nuInt8 );
+ SvStream& WriteUnicode( sal_Unicode );
+ SvStream& WriteOString(std::string_view rStr)
+ { WriteBytes(rStr.data(), rStr.size()); return *this; }
+ SvStream& WriteStream( SvStream& rStream );
+ sal_uInt64 WriteStream( SvStream& rStream, sal_uInt64 nSize );
+
+ SvStream& WriteBool( bool b )
+ { return WriteUChar(static_cast<unsigned char>(b)); }
+ SvStream& WriteSChar( signed char nChar );
+ SvStream& WriteChar( char nChar );
+ SvStream& WriteUChar( unsigned char nChar );
+ SvStream& WriteFloat( float nFloat );
+ SvStream& WriteDouble( const double& rDouble );
+ SvStream& WriteCharPtr( const char* pBuf );
+
+ SvStream& WriteUInt32AsString( sal_uInt32 nUInt32 );
+ SvStream& WriteInt32AsString( sal_Int32 nInt32 );
+
+ std::size_t ReadBytes( void* pData, std::size_t nSize );
+ std::size_t WriteBytes( const void* pData, std::size_t nSize );
+ sal_uInt64 Seek( sal_uInt64 nPos );
+ sal_uInt64 SeekRel( sal_Int64 nPos );
+ sal_uInt64 Tell() const { return m_nBufFilePos + m_nBufActualPos; }
+ virtual sal_uInt64 TellEnd();
+ // length between current (Tell()) pos and end of stream
+ sal_uInt64 remainingSize();
+ /// If we have data in our internal buffers, write them out
+ void FlushBuffer();
+ /// Call FlushBuffer() and then call flush on the underlying OS stream
+ void Flush();
+ // next Tell() <= nSize
+ bool SetStreamSize( sal_uInt64 nSize );
+
+ /** Read a line of bytes.
+
+ @param nMaxBytesToRead
+ Maximum of bytes to read, if line is longer it will be
+ truncated.
+
+ @note NOTE that the default is one character less than STRING_MAXLEN to
+ prevent problems after conversion to String that may be lurking
+ in various places doing something like
+ @code
+ for (sal_uInt16 i=0; i < aString.Len(); ++i)
+ @endcode
+ causing endless loops ...
+ */
+ bool ReadLine( OStringBuffer& rStr, sal_Int32 nMaxBytesToRead = 0xFFFE );
+ bool ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead = 0xFFFE );
+ bool WriteLine( std::string_view rStr );
+
+ /** Read a line of bytes.
+
+ @param nMaxBytesToRead
+ Maximum of bytes to read, if line is longer it will be
+ truncated.
+
+ @note NOTE that the default is one character less than STRING_MAXLEN to
+ prevent problems after conversion to String that may be lurking
+ in various places doing something like
+ @code
+ for (sal_uInt16 i=0; i < aString.Len(); ++i)
+ @endcode
+ causing endless loops ...
+ */
+ bool ReadByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet,
+ sal_Int32 nMaxBytesToRead = 0xFFFE );
+ bool WriteByteStringLine( std::u16string_view rStr, rtl_TextEncoding eDestCharSet );
+
+ /// Switch to no endian swapping and write 0xfeff
+ void StartWritingUnicodeText();
+
+ /** If eReadBomCharSet==RTL_TEXTENCODING_DONTKNOW: read 16bit, if 0xfeff do
+ nothing (UTF-16), if 0xfffe switch endian swapping (UTF-16), if 0xefbb
+ or 0xbbef read another byte and check for UTF-8. If no UTF-* BOM was
+ detected put all read bytes back. This means that if 2 bytes were read
+ it was an UTF-16 BOM, if 3 bytes were read it was an UTF-8 BOM. There
+ is no UTF-7, UTF-32 or UTF-EBCDIC BOM detection!
+
+ If eReadBomCharSet!=RTL_TEXTENCODING_DONTKNOW: only read a BOM of that
+ encoding and switch endian swapping if UTF-16 and 0xfffe. */
+ void StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet );
+
+ /** Read a line of Unicode.
+
+ @param nMaxCodepointsToRead
+ Maximum of codepoints (UCS-2 or UTF-16 pairs, not bytes) to
+ read, if line is longer it will be truncated.
+ */
+ SAL_DLLPRIVATE bool ReadUniStringLine(OUString& rStr, sal_Int32 nMaxCodepointsToRead);
+ /** Read a 32bit length prefixed sequence of utf-16 if
+ eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise read a 16bit length
+ prefixed sequence of bytes and convert from eSrcCharSet */
+ OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet);
+ /** Write a 32bit length prefixed sequence of utf-16 if
+ eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise convert to eSrcCharSet
+ and write a 16bit length prefixed sequence of bytes */
+ SvStream& WriteUniOrByteString( std::u16string_view rStr, rtl_TextEncoding eDestCharSet );
+
+ /** Read a line of Unicode if eSrcCharSet==RTL_TEXTENCODING_UNICODE,
+ otherwise read a line of Bytecode and convert from eSrcCharSet
+
+ @param nMaxCodepointsToRead
+ Maximum of codepoints (2 bytes if Unicode, bytes if not
+ Unicode) to read, if line is longer it will be truncated.
+
+ @note NOTE that the default is one character less than STRING_MAXLEN to
+ prevent problems after conversion to String that may be lurking in
+ various places doing something like
+ @code
+ for (sal_uInt16 i=0; i < aString.Len(); ++i)
+ @endcode
+ causing endless loops ...
+ */
+ bool ReadUniOrByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet,
+ sal_Int32 nMaxCodepointsToRead = 0xFFFE );
+ /** Write a sequence of Unicode characters if
+ eDestCharSet==RTL_TEXTENCODING_UNICODE, otherwise write a sequence of
+ Bytecodes converted to eDestCharSet */
+ bool WriteUnicodeOrByteText(std::u16string_view rStr, rtl_TextEncoding eDestCharSet );
+ bool WriteUnicodeOrByteText(std::u16string_view rStr )
+ { return WriteUnicodeOrByteText( rStr, GetStreamCharSet() ); }
+
+ /** Write a Unicode character if eDestCharSet==RTL_TEXTENCODING_UNICODE,
+ otherwise write as Bytecode converted to eDestCharSet.
+
+ This may result in more than one byte being written if a multi byte
+ encoding (e.g. UTF7, UTF8) is chosen. */
+ bool WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet );
+ bool WriteUniOrByteChar( sal_Unicode ch )
+ { return WriteUniOrByteChar( ch, GetStreamCharSet() ); }
+
+ void SetBufferSize( sal_uInt16 m_nBufSize );
+ sal_uInt16 GetBufferSize() const { return m_nBufSize; }
+
+ void RefreshBuffer();
+
+ bool IsWritable() const { return m_isWritable; }
+ StreamMode GetStreamMode() const { return m_eStreamMode; }
+
+ sal_Int32 GetVersion() const { return m_nVersion; }
+ void SetVersion( sal_Int32 n ) { m_nVersion = n; }
+
+ friend SvStream& operator<<( SvStream& rStr, SvStrPtr f ); // for Manips
+
+ /// end of input seen during previous i/o operation
+ bool eof() const { return m_isEof; }
+
+ /// stream is broken
+ bool bad() const { return GetError() != ERRCODE_NONE; }
+
+ /** Get state
+
+ If the state is good() the previous i/o operation succeeded.
+
+ If the state is good(), the next input operation might succeed;
+ otherwise, it will fail.
+
+ Applying an input operation to a stream that is not in the good() state
+ is a null operation as far as the variable being read into is concerned.
+
+ If we try to read into a variable v and the operation fails, the value
+ of v should be unchanged,
+ */
+ bool good() const { return !(eof() || bad()); }
+
+private:
+ template <typename T> SvStream& ReadNumber(T& r);
+ template <typename T> SvStream& WriteNumber(T n);
+
+ template<typename T>
+ void readNumberWithoutSwap(T& rDataDest)
+ { readNumberWithoutSwap_(&rDataDest, sizeof(rDataDest)); }
+
+ SAL_DLLPRIVATE void readNumberWithoutSwap_(void * pDataDest, int nDataSize);
+
+ template<typename T>
+ void writeNumberWithoutSwap(T const & rDataSrc)
+ { writeNumberWithoutSwap_(&rDataSrc, sizeof(rDataSrc)); }
+
+ SAL_DLLPRIVATE void writeNumberWithoutSwap_(const void * pDataSrc, int nDataSize);
+};
+
+inline SvStream& operator<<( SvStream& rStr, SvStrPtr f )
+{
+ (*f)(rStr);
+ return rStr;
+}
+
+TOOLS_DLLPUBLIC SvStream& endl( SvStream& rStr );
+/// same as endl() but Unicode
+TOOLS_DLLPUBLIC SvStream& endlu( SvStream& rStr );
+/// call endlu() if m_eStreamCharSet==RTL_TEXTECODING_UNICODE otherwise endl()
+TOOLS_DLLPUBLIC SvStream& endlub( SvStream& rStr );
+
+/// Attempt to read nUnits 8bit units to an OString, returned OString's
+/// length is number of units successfully read
+TOOLS_DLLPUBLIC OString read_uInt8s_ToOString(SvStream& rStrm,
+ std::size_t nUnits);
+
+/// Attempt to read nUnits 8bit units to an OUString
+inline OUString read_uInt8s_ToOUString(SvStream& rStrm,
+ std::size_t nUnits, rtl_TextEncoding eEnc)
+{
+ return OStringToOUString(read_uInt8s_ToOString(rStrm, nUnits), eEnc);
+}
+
+/// Attempt to read nUnits 16bit units to an OUString, returned
+/// OUString's length is number of units successfully read
+TOOLS_DLLPUBLIC OUString read_uInt16s_ToOUString(SvStream& rStrm,
+ std::size_t nUnits);
+
+/// Attempt to read a pascal-style length (of type prefix) prefixed sequence of
+/// 16bit units to an OUString, returned OString's length is number of
+/// units successfully read.
+inline OUString read_uInt16_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm)
+{
+ sal_uInt16 nUnits = 0;
+ rStrm.ReadUInt16( nUnits );
+ return read_uInt16s_ToOUString(rStrm, nUnits);
+}
+
+inline OUString read_uInt32_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm)
+{
+ sal_uInt32 nUnits = 0;
+ rStrm.ReadUInt32( nUnits );
+ return read_uInt16s_ToOUString(rStrm, nUnits);
+}
+
+/// Attempt to write a prefixed sequence of nUnits 16bit units from an OUString,
+/// returned value is number of bytes written
+TOOLS_DLLPUBLIC std::size_t write_uInt16s_FromOUString(SvStream& rStrm,
+ std::u16string_view rStr, std::size_t nUnits);
+
+inline std::size_t write_uInt16s_FromOUString(SvStream& rStrm,
+ std::u16string_view rStr)
+{
+ return write_uInt16s_FromOUString(rStrm, rStr, rStr.size());
+}
+
+/// Attempt to write a pascal-style length (of type prefix) prefixed sequence
+/// of 16bit units from an OUString, returned value is number of bytes written
+/// (including byte-count of prefix)
+std::size_t write_uInt32_lenPrefixed_uInt16s_FromOUString(SvStream& rStrm,
+ std::u16string_view rStr);
+
+/// Attempt to write a pascal-style length (of type prefix) prefixed sequence
+/// of 16bit units from an OUString, returned value is number of bytes written
+/// (including byte-count of prefix)
+UNLESS_MERGELIBS(TOOLS_DLLPUBLIC) std::size_t write_uInt16_lenPrefixed_uInt16s_FromOUString(SvStream& rStrm,
+ std::u16string_view rStr);
+
+/// Attempt to read 8bit units to an OString until a zero terminator is
+/// encountered, returned OString's length is number of units *definitely*
+/// successfully read, check SvStream::good() to see if null terminator was
+/// successfully read
+TOOLS_DLLPUBLIC OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStrm);
+
+/// Attempt to read 8bit units assuming source encoding eEnc to an OUString
+/// until a zero terminator is encountered. Check SvStream::good() to see if
+/// null terminator was successfully read
+TOOLS_DLLPUBLIC OUString read_zeroTerminated_uInt8s_ToOUString(SvStream& rStrm, rtl_TextEncoding eEnc);
+
+/// Attempt to read a pascal-style length (of type prefix) prefixed sequence of
+/// 8bit units to an OString, returned OString's length is number of units
+/// successfully read.
+inline OString read_uInt32_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)
+{
+ sal_uInt32 nUnits = 0;
+ rStrm.ReadUInt32(nUnits);
+ return read_uInt8s_ToOString(rStrm, nUnits);
+}
+inline OString read_uInt16_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)
+{
+ sal_uInt16 nUnits = 0;
+ rStrm.ReadUInt16(nUnits);
+ return read_uInt8s_ToOString(rStrm, nUnits);
+}
+
+inline OString read_uInt8_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)
+{
+ sal_uInt8 nUnits = 0;
+ rStrm.ReadUChar(nUnits);
+ return read_uInt8s_ToOString(rStrm, nUnits);
+}
+
+inline OUString read_uInt16_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm,
+ rtl_TextEncoding eEnc)
+{
+ return OStringToOUString(read_uInt16_lenPrefixed_uInt8s_ToOString(rStrm), eEnc);
+}
+
+inline OUString read_uInt8_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm,
+ rtl_TextEncoding eEnc)
+{
+ return OStringToOUString(read_uInt8_lenPrefixed_uInt8s_ToOString(rStrm), eEnc);
+}
+
+/// Attempt to write a prefixed sequence of nUnits 8bit units from an OString,
+/// returned value is number of bytes written
+inline std::size_t write_uInt8s_FromOString(SvStream& rStrm, std::string_view rStr,
+ std::size_t nUnits)
+{
+ return rStrm.WriteBytes(rStr.data(), nUnits);
+}
+
+inline std::size_t write_uInt8s_FromOString(SvStream& rStrm, std::string_view rStr)
+{
+ return write_uInt8s_FromOString(rStrm, rStr, rStr.size());
+}
+
+/// Attempt to write a pascal-style length (of type prefix) prefixed
+/// sequence of units from a string-type, returned value is number of bytes
+/// written (including byte-count of prefix)
+TOOLS_DLLPUBLIC std::size_t write_uInt16_lenPrefixed_uInt8s_FromOString(SvStream& rStrm,
+ std::string_view rStr);
+
+/// Attempt to write a pascal-style length (of type prefix) prefixed sequence
+/// of 8bit units from an OUString, returned value is number of bytes written
+/// (including byte-count of prefix)
+inline std::size_t write_uInt16_lenPrefixed_uInt8s_FromOUString(SvStream& rStrm,
+ std::u16string_view rStr,
+ rtl_TextEncoding eEnc)
+{
+ return write_uInt16_lenPrefixed_uInt8s_FromOString(rStrm, OUStringToOString(rStr, eEnc));
+}
+
+[[nodiscard]] TOOLS_DLLPUBLIC bool checkSeek(SvStream &rSt, sal_uInt64 nOffset);
+
+namespace tools
+{
+/// Is rUrl a file:// URL with no contents?
+TOOLS_DLLPUBLIC bool isEmptyFileUrl(const OUString& rUrl);
+}
+
+// FileStream
+
+class TOOLS_DLLPUBLIC SvFileStream final : public SvStream
+{
+private:
+ std::unique_ptr<StreamData>
+ pInstanceData;
+ OUString aFilename;
+#if defined(_WIN32)
+ sal_uInt16 nLockCounter;
+#endif
+ bool bIsOpen;
+
+ SvFileStream (const SvFileStream&) = delete;
+ SvFileStream & operator= (const SvFileStream&) = delete;
+
+ bool LockFile();
+ void UnlockFile();
+
+ virtual std::size_t GetData( void* pData, std::size_t nSize ) override;
+ virtual std::size_t PutData( const void* pData, std::size_t nSize ) override;
+ virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) override;
+ virtual void SetSize( sal_uInt64 nSize ) override;
+ virtual void FlushData() override;
+
+public:
+ // Switches to Read StreamMode on failed attempt of Write opening
+ SvFileStream( const OUString& rFileName, StreamMode eOpenMode );
+ SvFileStream();
+ virtual ~SvFileStream() override;
+
+ virtual void ResetError() override;
+
+ void Open( const OUString& rFileName, StreamMode eOpenMode );
+ void Close();
+ bool IsOpen() const { return bIsOpen; }
+
+ const OUString& GetFileName() const { return aFilename; }
+};
+
+// MemoryStream
+
+class TOOLS_DLLPUBLIC SvMemoryStream : public SvStream
+{
+ SvMemoryStream (const SvMemoryStream&) = delete;
+ SvMemoryStream & operator= (const SvMemoryStream&) = delete;
+
+protected:
+ std::size_t nSize;
+ std::size_t nResize;
+ std::size_t nPos;
+ std::size_t nEndOfData;
+ sal_uInt8* pBuf;
+ bool bOwnsData;
+
+ virtual std::size_t GetData( void* pData, std::size_t nSize ) override;
+ virtual std::size_t PutData( const void* pData, std::size_t nSize ) override;
+ virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) override;
+ virtual void SetSize( sal_uInt64 nSize ) override;
+ virtual void FlushData() override;
+
+ /// AllocateMemory must update pBuf accordingly
+ /// - pBuf: Address of new block
+ void AllocateMemory( std::size_t nSize );
+
+ /// ReAllocateMemory must update the following variables:
+ /// - pBuf: Address of new block
+ /// - nEndOfData: Set to nNewSize-1 , if outside of block
+ /// Set to 0 , if new block size is 0 bytes
+ /// - nSize: New block size
+ /// - nPos: Set to 0 if position outside of block
+ bool ReAllocateMemory( tools::Long nDiff );
+
+ /// Is called when this stream allocated the buffer or the buffer is
+ /// resized. FreeMemory may need to NULLify handles in derived classes.
+ void FreeMemory();
+
+public:
+ SvMemoryStream( void* pBuf, std::size_t nSize, StreamMode eMode);
+ SvMemoryStream( std::size_t nInitSize=512, std::size_t nResize=64 );
+ virtual ~SvMemoryStream() override;
+
+ virtual void ResetError() override;
+
+ sal_uInt64 GetSize() { return TellEnd(); }
+ std::size_t GetEndOfData() const { return nEndOfData; }
+ const void* GetData() { FlushBuffer(); return pBuf; }
+
+ // return the buffer currently in use, and allocate a new buffer internally
+ void* SwitchBuffer();
+ // the buffer is not owned by this class
+ void SetBuffer( void* pBuf, std::size_t nSize, std::size_t nEOF );
+
+ void ObjectOwnsMemory( bool bOwn ) { bOwnsData = bOwn; }
+ void SetResizeOffset( std::size_t nNewResize ) { nResize = nNewResize; }
+ virtual sal_uInt64 TellEnd() override { FlushBuffer(); return nEndOfData; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/svborder.hxx b/include/tools/svborder.hxx
new file mode 100644
index 000000000..92f779cac
--- /dev/null
+++ b/include/tools/svborder.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLS_SVBORDER_HXX
+#define INCLUDED_TOOLS_SVBORDER_HXX
+
+#include <tools/toolsdllapi.h>
+#include <tools/long.hxx>
+
+namespace tools { class Rectangle; }
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC SvBorder
+{
+ tools::Long nTop, nRight, nBottom, nLeft;
+
+public:
+ SvBorder()
+ {
+ nTop = nRight = nBottom = nLeft = 0;
+ }
+ SvBorder( tools::Long nLeftP, tools::Long nTopP, tools::Long nRightP, tools::Long nBottomP )
+ {
+ nLeft = nLeftP;
+ nTop = nTopP;
+ nRight = nRightP;
+ nBottom = nBottomP;
+ }
+ bool operator == ( const SvBorder & rObj ) const
+ {
+ return nTop == rObj.nTop && nRight == rObj.nRight &&
+ nBottom == rObj.nBottom && nLeft == rObj.nLeft;
+ }
+ bool operator != ( const SvBorder & rObj ) const
+ { return !(*this == rObj); }
+ SvBorder & operator += ( const SvBorder & rBorder )
+ {
+ Left() += rBorder.Left();
+ Top() += rBorder.Top();
+ Right() += rBorder.Right();
+ Bottom() += rBorder.Bottom();
+ return *this;
+ }
+ tools::Long & Top() { return nTop; }
+ tools::Long & Right() { return nRight; }
+ tools::Long & Bottom() { return nBottom; }
+ tools::Long & Left() { return nLeft; }
+ tools::Long Top() const { return nTop; }
+ tools::Long Right() const { return nRight; }
+ tools::Long Bottom() const { return nBottom; }
+ tools::Long Left() const { return nLeft; }
+};
+
+TOOLS_DLLPUBLIC tools::Rectangle & operator += ( tools::Rectangle & rRect, const SvBorder & rBorder );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/svlibrary.h b/include/tools/svlibrary.h
new file mode 100644
index 000000000..df3f72031
--- /dev/null
+++ b/include/tools/svlibrary.h
@@ -0,0 +1,15 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SVLIBRARY
+#define SVLIBRARY(Base) SAL_MODULENAME(Base "lo")
+#include <osl/module.h>
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/tenccvt.hxx b/include/tools/tenccvt.hxx
new file mode 100644
index 000000000..1893c7355
--- /dev/null
+++ b/include/tools/tenccvt.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_TENCCVT_HXX
+#define INCLUDED_TOOLS_TENCCVT_HXX
+
+#include <rtl/textenc.h>
+#include <tools/toolsdllapi.h>
+
+// Functions for handling Import/Export
+
+/// return an encoding which has more defined Characters as the given
+/// encoding, but have the same definition for the defined characters
+/// e.g.: windows-1252 for iso-8859-1 or windows-1254 for iso-8859-9
+TOOLS_DLLPUBLIC rtl_TextEncoding GetExtendedCompatibilityTextEncoding(rtl_TextEncoding eEncoding);
+
+/// return an encoding which has more defined Characters as the given
+/// encoding. The encodings could be different.
+/// e.g.: windows-1251 for iso-8859-5
+TOOLS_DLLPUBLIC rtl_TextEncoding GetExtendedTextEncoding(rtl_TextEncoding eEncoding);
+
+/// if the given encoding is an multi-byte encoding (which allows more than
+/// one byte per char, e.g. UTF-8 or Shift-JIS), a one-byte encoding
+/// is returned (normally windows-1252).
+rtl_TextEncoding GetOneByteTextEncoding(rtl_TextEncoding eEncoding);
+
+TOOLS_DLLPUBLIC rtl_TextEncoding GetSOLoadTextEncoding(rtl_TextEncoding eEncoding);
+TOOLS_DLLPUBLIC rtl_TextEncoding GetSOStoreTextEncoding(rtl_TextEncoding eEncoding);
+
+/**
+ * Given a Unicode character, return a legacy Microsoft Encoding which
+ * supports it. Returns RTL_TEXTENCODING_DONTKNOW if there is
+ * no encoding which could support the character
+ *
+ * Useful as a utility to categorize unicode characters into the best fit
+ * windows charset range for exporting to ww6 & wmf or as a hint to non \u
+ * unicode token aware rtf readers
+ */
+TOOLS_DLLPUBLIC rtl_TextEncoding getBestMSEncodingByChar(sal_Unicode c);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/time.hxx b/include/tools/time.hxx
new file mode 100644
index 000000000..414b28f72
--- /dev/null
+++ b/include/tools/time.hxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_TIME_HXX
+#define INCLUDED_TOOLS_TIME_HXX
+
+#include <tools/toolsdllapi.h>
+#include <com/sun/star/util/Time.hpp>
+
+namespace com::sun::star::util { struct DateTime; }
+
+/**
+ @WARNING: This class can serve both as wall clock time and time duration, and
+ the mixing of these concepts leads to problems such as there being
+ 25 hours or 10 minus 20 seconds being (non-negative) 10 seconds.
+*/
+
+namespace tools {
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Time
+{
+private:
+ sal_Int64 nTime;
+ void init( sal_uInt32 nHour, sal_uInt32 nMin,
+ sal_uInt32 nSec, sal_uInt64 nNanoSec);
+
+public:
+ enum TimeInitSystem
+ {
+ SYSTEM
+ };
+
+ // temporary until all uses are inspected and resolved
+ enum TimeInitEmpty
+ {
+ EMPTY
+ };
+ static const sal_Int64 hourPerDay = 24;
+ static const sal_Int64 minutePerHour = 60;
+ static const sal_Int64 secondPerMinute = 60;
+ static const sal_Int64 nanoSecPerSec = 1000000000;
+ static const sal_Int64 nanoSecPerMinute = nanoSecPerSec * secondPerMinute;
+ static const sal_Int64 nanoSecPerHour = nanoSecPerSec * secondPerMinute * minutePerHour;
+ static const sal_Int64 nanoSecPerDay = nanoSecPerSec * secondPerMinute * minutePerHour * hourPerDay;
+ static const sal_Int64 secondPerHour = secondPerMinute * minutePerHour;
+ static const sal_Int64 secondPerDay = secondPerMinute * minutePerHour * hourPerDay;
+ static const sal_Int64 minutePerDay = minutePerHour * hourPerDay;
+ static const sal_Int64 nanoPerMicro = 1000;
+ static const sal_Int64 nanoPerMilli = 1000000;
+ static const sal_Int64 nanoPerCenti = 10000000;
+
+ explicit Time( TimeInitEmpty )
+ { nTime = 0; }
+ explicit Time( TimeInitSystem );
+ explicit Time( sal_Int64 _nTime ) { Time::nTime = _nTime; }
+ Time( const tools::Time& rTime );
+ Time( const css::util::Time& rTime );
+ explicit Time( const css::util::DateTime& rDateTime );
+ Time( sal_uInt32 nHour, sal_uInt32 nMin,
+ sal_uInt32 nSec = 0, sal_uInt64 nNanoSec = 0 );
+
+ void SetTime( sal_Int64 nNewTime ) { nTime = nNewTime; }
+ sal_Int64 GetTime() const { return nTime; }
+ css::util::Time GetUNOTime() const { return css::util::Time(GetNanoSec(),GetSec(),GetMin(),GetHour(),false); }
+
+ void SetHour( sal_uInt16 nNewHour );
+ void SetMin( sal_uInt16 nNewMin );
+ void SetSec( sal_uInt16 nNewSec );
+ void SetNanoSec( sal_uInt32 nNewNanoSec );
+ sal_uInt16 GetHour() const
+ { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime;
+ return static_cast<sal_uInt16>(nTempTime / SAL_CONST_UINT64(10000000000000)); }
+ sal_uInt16 GetMin() const
+ { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime;
+ return static_cast<sal_uInt16>((nTempTime / SAL_CONST_UINT64(100000000000)) % 100); }
+ sal_uInt16 GetSec() const
+ { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime;
+ return static_cast<sal_uInt16>((nTempTime / SAL_CONST_UINT64(1000000000)) % 100); }
+ sal_uInt32 GetNanoSec() const
+ { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime;
+ return static_cast<sal_uInt32>( nTempTime % SAL_CONST_UINT64(1000000000)); }
+
+ // TODO: consider removing GetMSFromTime and MakeTimeFromMS?
+ sal_Int32 GetMSFromTime() const;
+ void MakeTimeFromMS( sal_Int32 nMS );
+ sal_Int64 GetNSFromTime() const;
+ void MakeTimeFromNS( sal_Int64 nNS );
+
+ /// 12 hours == 0.5 days
+ double GetTimeInDays() const;
+
+ /** Get the wall clock time particles for a (date+)time value.
+
+ Does the necessary rounding and truncating to obtain hour, minute,
+ second and fraction of second from a double time value (time in days,
+ 0.5 == 12h) such that individual values are not rounded up, i.e.
+ x:59:59.999 does not yield x+1:0:0.00
+
+ A potential date component (fTimeInDays >= 1.0) is discarded.
+
+ @param nFractionDecimals
+ If > 0 fFractionOfSecond is truncated to that amount of
+ decimals.
+ Else fFractionOfSecond returns the full remainder of the
+ fractional second.
+ */
+ static void GetClock( double fTimeInDays,
+ sal_uInt16& nHour, sal_uInt16& nMinute, sal_uInt16& nSecond,
+ double& fFractionOfSecond, int nFractionDecimals );
+
+ bool IsEqualIgnoreNanoSec( const tools::Time& rTime ) const;
+
+ bool operator ==( const tools::Time& rTime ) const
+ { return (nTime == rTime.nTime); }
+ bool operator !=( const tools::Time& rTime ) const
+ { return (nTime != rTime.nTime); }
+ bool operator >( const tools::Time& rTime ) const
+ { return (nTime > rTime.nTime); }
+ bool operator <( const tools::Time& rTime ) const
+ { return (nTime < rTime.nTime); }
+ bool operator >=( const tools::Time& rTime ) const
+ { return (nTime >= rTime.nTime); }
+ bool operator <=( const tools::Time& rTime ) const
+ { return (nTime <= rTime.nTime); }
+
+ static Time GetUTCOffset();
+
+ /**
+ * Elapsed time in milliseconds (1e-3) since some unspecified starting point
+ *
+ * Convenience function, which just calls GetMonotonicTicks() / 1000.
+ */
+ static sal_uInt64 GetSystemTicks();
+
+ /**
+ * Elapsed time in microseconds (1e-6) since some unspecified starting point
+ *
+ * Uses the high-precision, monotonic time sources provided by the OS, if
+ * available. Don't try to relate it to the system time, and also it's long
+ * time accuracy is not the best.
+ *
+ * Currently used to measure the runtime of OpenCL shaders and to set a
+ * message creation timestamp to allow filtering of invalid timer messages.
+ *
+ * @return current system ticks in microseconds (1e-6s)
+ */
+ static sal_uInt64 GetMonotonicTicks();
+
+ tools::Time& operator =( const tools::Time& rTime );
+ Time operator -() const
+ { return Time( -nTime ); }
+ tools::Time& operator +=( const tools::Time& rTime );
+ tools::Time& operator -=( const tools::Time& rTime );
+ TOOLS_DLLPUBLIC friend Time operator +( const tools::Time& rTime1, const tools::Time& rTime2 );
+ TOOLS_DLLPUBLIC friend Time operator -( const tools::Time& rTime1, const tools::Time& rTime2 );
+};
+
+} /* namespace tools */
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/toolsdllapi.h b/include/tools/toolsdllapi.h
new file mode 100644
index 000000000..0ee778e6f
--- /dev/null
+++ b/include/tools/toolsdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLS_TOOLSDLLAPI_H
+#define INCLUDED_TOOLS_TOOLSDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(TOOLS_DLLIMPLEMENTATION)
+#define TOOLS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define TOOLS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define TOOLS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx
new file mode 100644
index 000000000..9d6820ddf
--- /dev/null
+++ b/include/tools/urlobj.hxx
@@ -0,0 +1,1312 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_URLOBJ_HXX
+#define INCLUDED_TOOLS_URLOBJ_HXX
+
+#include <tools/toolsdllapi.h>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/textenc.h>
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <memory>
+#include <string_view>
+
+class SvMemoryStream;
+
+namespace com::sun::star::util {
+ class XStringWidth;
+}
+
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+// Common URL prefixes for various schemes:
+inline constexpr OUStringLiteral INET_FTP_SCHEME = u"ftp://";
+inline constexpr OUStringLiteral INET_HTTP_SCHEME = u"http://";
+inline constexpr OUStringLiteral INET_HTTPS_SCHEME = u"https://";
+inline constexpr OUStringLiteral INET_FILE_SCHEME = u"file://";
+inline constexpr OUStringLiteral INET_MAILTO_SCHEME = u"mailto:";
+inline constexpr OUStringLiteral INET_HID_SCHEME = u"hid:";
+
+#define URL_PREFIX_PRIV_SOFFICE "private:"
+
+// Schemes:
+enum class INetProtocol
+{
+ NotValid,
+ Ftp,
+ Http,
+ File,
+ Mailto,
+ VndSunStarWebdav,
+ PrivSoffice,
+ VndSunStarHelp,
+ Https,
+ Slot,
+ Macro,
+ Javascript,
+ Data,
+ Cid,
+ VndSunStarHier,
+ Uno,
+ Component,
+ VndSunStarPkg,
+ Ldap,
+ Db,
+ VndSunStarCmd,
+ Telnet,
+ VndSunStarExpand,
+ VndSunStarTdoc,
+ Generic,
+ Smb,
+ Hid,
+ Sftp,
+ Cmis,
+ LAST = Cmis
+};
+
+/** The supported notations for file system paths.
+ */
+enum class FSysStyle
+{
+ /** VOS notation (e.g., "//server/dir/file").
+ */
+ Vos = 0x1,
+
+ /** Unix notation (e.g., "/dir/file").
+ */
+ Unix = 0x2,
+
+ /** DOS notation (e.g., "a:\dir\file" and "\\server\dir\file").
+ */
+ Dos = 0x4,
+
+ /** Detect the used notation.
+
+ @descr For the following descriptions, please note that
+ whereas FSYS_DEFAULT includes all style bits, combinations of only
+ a few style bits are also possible, and are also described.
+
+ @descr When used to translate a file system path to a file URL,
+ the subset of the following productions for which the appropriate
+ style bit is set are checked in order (using the conventions of
+ RFC 2234, RFC 2396, and RFC 2732; UCS4 stands for any UCS4
+ character):
+
+ Production T1 (VOS local; FSysStyle::Vos only):
+ "//." ["/" *UCS4]
+ becomes
+ "file:///" *UCS4
+
+ Production T2 (VOS host; FSysStyle::Vos only):
+ "//" [host] ["/" *UCS4]
+ becomes
+ "file://" host "/" *UCS4
+
+ Production T3 (UNC; FSysStyle::Dos only):
+ "\\" [host] ["\" *UCS4]
+ becomes
+ "file://" host "/" *UCS4
+ replacing "\" by "/" within <*UCS4>
+
+ Production T4 (Unix-like DOS; FSysStyle::Dos only):
+ ALPHA ":" ["/" *UCS4]
+ becomes
+ "file:///" ALPHA ":/" *UCS4
+ replacing "\" by "/" within <*UCS4>
+
+ Production T5 (DOS; FSysStyle::Dos only):
+ ALPHA ":" ["\" *UCS4]
+ becomes
+ "file:///" ALPHA ":/" *UCS4
+ replacing "\" by "/" within <*UCS4>
+
+ Production T6 (any):
+ *UCS4
+ becomes
+ "file:///" *UCS4
+ replacing the delimiter by "/" within <*UCS4>. The delimiter is
+ that character from the set { "/", "\" } which appears most
+ often in <*UCS4> (if FSysStyle::Unix is not among the style bits, "/"
+ is removed from the set; if FSysStyle::Dos is not among the style
+ bits, "\" is removed from the set). If two or more
+ characters appear the same number of times, the character
+ mentioned first in that set is chosen. If the first character
+ of <*UCS4> is the delimiter, that character is not copied.
+
+ @descr When used to translate a file URL to a file system path,
+ the following productions are checked in order (using the
+ conventions of RFC 2234, RFC 2396, and RFC 2732):
+
+ Production F1 (VOS; FSysStyle::Vos):
+ "file://" host "/" fpath ["#" fragment]
+ becomes
+ "//" host "/" fpath
+
+ Production F2 (DOS; FSysStyle::Dos):
+ "file:///" ALPHA ":" ["/" fpath] ["#" fragment]
+ becomes
+ ALPHA ":" ["\" fpath]
+ replacing "/" by "\" in <fpath>
+
+ Production F3 (Unix; FSysStyle::Unix):
+ "file:///" fpath ["#" fragment]
+ becomes
+ "/" fpath
+ */
+ Detect = Vos | Unix | Dos
+};
+namespace o3tl {
+ template<> struct typed_flags<FSysStyle> : is_typed_flags<FSysStyle, 0x07> {};
+}
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC INetURLObject
+{
+public:
+ // Get- and Set-Methods:
+
+ /** The way input strings that represent (parts of) URIs are interpreted
+ in set-methods.
+
+ @descr UTF-32 characters in the range 0x80--0x10FFFF are replaced by
+ sequences of escape sequences, representing the UTF-8 coded characters.
+
+ @descr Along with an EncodeMechanism parameter, the set-methods all
+ take an rtl_TextEncoding parameter, which is ignored unless the
+ EncodeMechanism is EncodeMechanism::WasEncoded.
+ */
+ enum class EncodeMechanism
+ {
+ /** All escape sequences that are already present are ignored, and are
+ interpreted as literal sequences of three characters.
+ */
+ All,
+
+ /** Sequences of escape sequences, that represent characters from the
+ specified character set and that can be converted to UTF-32
+ characters, are first decoded. If they have to be encoded, they
+ are converted to UTF-8 characters and are than translated into
+ (sequences of) escape sequences. Other escape sequences are
+ copied verbatim (but using upper case hex digits).
+ */
+ WasEncoded,
+
+ /** All escape sequences that are already present are copied verbatim
+ (but using upper case hex digits).
+ */
+ NotCanonical
+ };
+
+ /** The way strings that represent (parts of) URIs are returned from get-
+ methods.
+
+ @descr Along with a DecodeMechanism parameter, the get-methods all
+ take an rtl_TextEncoding parameter, which is ignored unless the
+ DecodeMechanism is DecodeMechanism::WithCharset or DecodeMechanism::Unambiguous.
+ */
+ enum class DecodeMechanism
+ {
+ /** The (part of the) URI is returned unchanged. Since URIs are
+ written using a subset of US-ASCII, the returned string is
+ guaranteed to contain only US-ASCII characters.
+ */
+ NONE,
+
+ /** All sequences of escape sequences that represent UTF-8 coded
+ UTF-32 characters with a numerical value greater than 0x7F, are
+ replaced by the respective UTF-16 characters. All other escape
+ sequences are not decoded.
+ */
+ ToIUri,
+
+ /** All (sequences of) escape sequences that represent characters from
+ the specified character set, and that can be converted to UTF-32,
+ are replaced by the respective UTF-16 characters. All other
+ escape sequences are not decoded.
+ */
+ WithCharset,
+
+ /** All (sequences of) escape sequences that represent characters from
+ the specified character set, that can be converted to UTF-32, and
+ that (in the case of ASCII characters) can safely be decoded
+ without altering the meaning of the (part of the) URI, are
+ replaced by the respective UTF-16 characters. All other escape
+ sequences are not decoded.
+ */
+ Unambiguous
+ };
+
+ // General Structure:
+
+ INetURLObject():
+ m_aAbsURIRef(256), m_eScheme(INetProtocol::NotValid), m_eSmartScheme(INetProtocol::Http) {}
+
+ bool HasError() const { return m_eScheme == INetProtocol::NotValid; }
+
+ OUString GetMainURL(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset
+ = RTL_TEXTENCODING_UTF8) const
+ { return decode(m_aAbsURIRef, eMechanism, eCharset); }
+
+ OUString GetURLNoPass(DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
+ const;
+
+ OUString GetURLNoMark(DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
+ const;
+
+ OUString
+ getAbbreviated(css::uno::Reference< css::util::XStringWidth > const & rStringWidth,
+ sal_Int32 nWidth,
+ DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
+ const;
+
+ bool operator ==(INetURLObject const & rObject) const;
+
+ bool operator !=(INetURLObject const & rObject) const
+ { return !(*this == rObject); }
+
+ // Strict Parsing:
+
+ inline explicit INetURLObject(
+ std::u16string_view rTheAbsURIRef,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+ inline bool SetURL(std::u16string_view rTheAbsURIRef,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+ bool ConcatData(INetProtocol eTheScheme, std::u16string_view rTheUser,
+ std::u16string_view rThePassword,
+ std::u16string_view rTheHost, sal_uInt32 nThePort,
+ std::u16string_view rThePath);
+
+ // Smart Parsing:
+
+ inline INetURLObject(std::u16string_view rTheAbsURIRef,
+ INetProtocol eTheSmartScheme,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ FSysStyle eStyle = FSysStyle::Detect);
+
+ void SetSmartProtocol(INetProtocol eTheSmartScheme)
+ { m_eSmartScheme = eTheSmartScheme; }
+
+ inline bool
+ SetSmartURL(std::u16string_view rTheAbsURIRef,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ FSysStyle eStyle = FSysStyle::Detect);
+
+ inline INetURLObject
+ smartRel2Abs(OUString const & rTheRelURIRef,
+ bool & rWasAbsolute,
+ bool bIgnoreFragment = false,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ bool bRelativeNonURIs = false,
+ FSysStyle eStyle = FSysStyle::Detect) const;
+
+ // Relative URLs:
+
+ inline bool
+ GetNewAbsURL(OUString const & rTheRelURIRef,
+ INetURLObject * pTheAbsURIRef)
+ const;
+
+ /** @descr If rTheRelURIRef cannot be converted to an absolute URL
+ (because of syntactic reasons), either rTheRelURIRef or an empty
+ string is returned: If all of the parameters eEncodeMechanism,
+ eDecodeMechanism and eCharset have their respective default values,
+ then rTheRelURIRef is returned unmodified; otherwise, an empty string
+ is returned.
+ */
+ static OUString
+ GetAbsURL(std::u16string_view rTheBaseURIRef,
+ OUString const & rTheRelURIRef,
+ EncodeMechanism eEncodeMechanism = EncodeMechanism::WasEncoded,
+ DecodeMechanism eDecodeMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+ static inline OUString
+ GetRelURL(std::u16string_view rTheBaseURIRef,
+ OUString const & rTheAbsURIRef,
+ EncodeMechanism eEncodeMechanism = EncodeMechanism::WasEncoded,
+ DecodeMechanism eDecodeMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ FSysStyle eStyle = FSysStyle::Detect);
+
+ // External URLs:
+
+ OUString getExternalURL() const;
+
+ static inline bool translateToExternal(std::u16string_view rTheIntURIRef,
+ OUString & rTheExtURIRef,
+ DecodeMechanism eDecodeMechanism
+ = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset
+ = RTL_TEXTENCODING_UTF8);
+
+ static inline bool translateToInternal(std::u16string_view rTheExtURIRef,
+ OUString & rTheIntURIRef,
+ DecodeMechanism eDecodeMechanism
+ = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset
+ = RTL_TEXTENCODING_UTF8);
+
+ // Scheme:
+
+ struct SchemeInfo;
+
+ INetProtocol GetProtocol() const { return m_eScheme; }
+
+ bool isSchemeEqualTo(INetProtocol scheme) const { return scheme == m_eScheme; }
+
+ bool isSchemeEqualTo(std::u16string_view scheme) const;
+
+ /** Check if the scheme is one of the WebDAV scheme
+ * we know about.
+ *
+ * @return true is one other scheme either public scheme or private scheme.
+ */
+ bool isAnyKnownWebDAVScheme() const;
+
+ /** Return the URL 'prefix' for a given scheme.
+
+ @param eTheScheme One of the supported URL schemes.
+
+ @return The 'prefix' of URLs of the given scheme.
+ */
+ static OUString GetScheme(INetProtocol eTheScheme);
+
+ /** Return the human-readable name for a given scheme.
+
+ @param eTheScheme One of the supported URL schemes.
+
+ @return The protocol name of URLs of the given scheme.
+ */
+ static const OUString & GetSchemeName(INetProtocol eTheScheme);
+
+ static INetProtocol CompareProtocolScheme(std::u16string_view aTheAbsURIRef);
+
+ // User Info:
+
+ bool HasUserData() const { return m_aUser.isPresent(); }
+
+ OUString GetUser(DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset
+ = RTL_TEXTENCODING_UTF8) const
+ { return decode(m_aUser, eMechanism, eCharset); }
+
+ OUString GetPass(DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset
+ = RTL_TEXTENCODING_UTF8) const
+ { return decode(m_aAuth, eMechanism, eCharset); }
+
+ bool SetUser(std::u16string_view rTheUser)
+ { return setUser(rTheUser, RTL_TEXTENCODING_UTF8); }
+
+ inline bool SetPass(std::u16string_view rThePassword);
+
+ inline bool SetUserAndPass(std::u16string_view rTheUser,
+ std::u16string_view rThePassword);
+
+ // Host and Port:
+
+ bool HasPort() const { return m_aPort.isPresent(); }
+
+ OUString GetHost(DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset
+ = RTL_TEXTENCODING_UTF8) const
+ { return decode(m_aHost, eMechanism, eCharset); }
+
+ OUString GetHostPort(DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) const;
+
+ sal_uInt32 GetPort() const;
+
+ bool SetHost(std::u16string_view rTheHost)
+ { return setHost(rTheHost, RTL_TEXTENCODING_UTF8); }
+
+ bool SetPort(sal_uInt32 nThePort);
+
+ // Path:
+
+ bool HasURLPath() const { return !m_aPath.isEmpty(); }
+
+ OUString GetURLPath(DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset
+ = RTL_TEXTENCODING_UTF8) const
+ { return decode(m_aPath, eMechanism, eCharset); }
+
+ bool SetURLPath(std::u16string_view rThePath,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
+ { return setPath(rThePath, eMechanism, eCharset); }
+
+ // Hierarchical Path:
+
+ /** A constant to address the last segment in various methods dealing with
+ hierarchical paths.
+
+ @descr It is often more efficient to address the last segment using
+ this constant, than to determine its ordinal value using
+ getSegmentCount().
+ */
+ enum { LAST_SEGMENT = -1 };
+
+ /** The number of segments in the hierarchical path.
+
+ @descr Using RFC 2396 and RFC 2234, a hierarchical path is of the
+ form
+
+ hierarchical-path = 1*("/" segment)
+
+ segment = name *(";" param)
+
+ name = [base ["." extension]]
+
+ base = 1*pchar
+
+ extension = *<any pchar except ".">
+
+ param = *pchar
+
+ @param bIgnoreFinalSlash If true, a final slash at the end of the
+ hierarchical path does not denote an empty segment, but is ignored.
+
+ @return The number of segments in the hierarchical path. If the path
+ is not hierarchical, 0 is returned.
+ */
+ sal_Int32 getSegmentCount(bool bIgnoreFinalSlash = true) const;
+
+ /** Remove a segment from the hierarchical path.
+
+ @param nIndex The non-negative index of the segment, or LAST_SEGMENT
+ if addressing the last segment.
+
+ @param bIgnoreFinalSlash If true, a final slash at the end of the
+ hierarchical path does not denote an empty segment, but is ignored.
+
+ @return True if the segment has successfully been removed (and the
+ resulting URI is still valid). If the path is not hierarchical, or
+ the specified segment does not exist, false is returned. If false is
+ returned, the object is not modified.
+ */
+ bool removeSegment(sal_Int32 nIndex = LAST_SEGMENT,
+ bool bIgnoreFinalSlash = true);
+
+ /** Insert a new segment into the hierarchical path.
+ A final slash at the end of the
+ hierarchical path does not denote an empty segment, but is ignored.
+
+ @param rTheName The name part of the new segment. The new segment
+ will contain no parameters.
+
+ @param bAppendFinalSlash If the new segment is appended at the end of
+ the hierarchical path, this parameter specifies whether to add a final
+ slash after it or not.
+
+ @param nIndex The non-negative index of the segment before which
+ to insert the new segment. LAST_SEGMENT or an nIndex that equals
+ getSegmentCount() inserts the new segment at the end of the
+ hierarchical path.
+
+ @param eMechanism See the general discussion for set-methods.
+
+ @param eCharset See the general discussion for set-methods.
+
+ @return True if the segment has successfully been inserted (and the
+ resulting URI is still valid). If the path is not hierarchical, or
+ the specified place to insert the new segment does not exist, false is
+ returned. If false is returned, the object is not modified.
+ */
+ bool insertName(std::u16string_view rTheName,
+ bool bAppendFinalSlash = false,
+ sal_Int32 nIndex = LAST_SEGMENT,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+ /** Get the name of a segment of the hierarchical path.
+
+ @param nIndex The non-negative index of the segment, or LAST_SEGMENT
+ if addressing the last segment.
+
+ @param bIgnoreFinalSlash If true, a final slash at the end of the
+ hierarchical path does not denote an empty segment, but is ignored.
+
+ @param eMechanism See the general discussion for get-methods.
+
+ @param eCharset See the general discussion for get-methods.
+
+ @return The name part of the specified segment. If the path is not
+ hierarchical, or the specified segment does not exits, an empty string
+ is returned.
+ */
+ OUString getName(sal_Int32 nIndex = LAST_SEGMENT,
+ bool bIgnoreFinalSlash = true,
+ DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
+ const;
+
+ /** Set the name of the last segment (preserving any parameters and any query or
+ fragment part).
+
+ @param rTheName The new name.
+
+ @param eMechanism See the general discussion for get-methods.
+
+ @param eCharset See the general discussion for get-methods.
+
+ @return True if the name has successfully been modified (and the
+ resulting URI is still valid). If the path is not hierarchical, or
+ a last segment does not exist, false is returned. If false is
+ returned, the object is not modified.
+ */
+ bool setName(std::u16string_view rTheName,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+ /** Get the base of the name of a segment.
+
+ @param nIndex The non-negative index of the segment, or LAST_SEGMENT
+ if addressing the last segment.
+
+ @param bIgnoreFinalSlash If true, a final slash at the end of the
+ hierarchical path does not denote an empty segment, but is ignored.
+
+ @param eMechanism See the general discussion for get-methods.
+
+ @param eCharset See the general discussion for get-methods.
+
+ @return The base part of the specified segment. If the path is
+ not hierarchical, or the specified segment does not exits, an empty
+ string is returned.
+ */
+ OUString getBase(sal_Int32 nIndex = LAST_SEGMENT,
+ bool bIgnoreFinalSlash = true,
+ DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
+ const;
+
+ /** Set the base of the name of a segment (preserving the extension).
+ A final slash at the end of the
+ hierarchical path does not denote an empty segment, but is ignored.
+
+ @param rTheBase The new base.
+
+ @param nIndex The non-negative index of the segment, or LAST_SEGMENT
+ if addressing the last segment.
+
+ @param eMechanism See the general discussion for set-methods.
+
+ @param eCharset See the general discussion for set-methods.
+
+ @return True if the base has successfully been modified (and the
+ resulting URI is still valid). If the path is not hierarchical, or
+ the specified segment does not exist, false is returned. If false is
+ returned, the object is not modified.
+ */
+ bool setBase(std::u16string_view rTheBase,
+ sal_Int32 nIndex = LAST_SEGMENT,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+ /** Determine whether the name of the last segment has an extension.
+
+ @return True if the name of the specified segment has an extension.
+ If the path is not hierarchical, or the specified segment does not
+ exist, false is returned.
+ */
+ bool hasExtension() const;
+
+ /** Get the extension of the name of a segment.
+
+ @param nIndex The non-negative index of the segment, or LAST_SEGMENT
+ if addressing the last segment.
+
+ @param bIgnoreFinalSlash If true, a final slash at the end of the
+ hierarchical path does not denote an empty segment, but is ignored.
+
+ @param eMechanism See the general discussion for get-methods.
+
+ @param eCharset See the general discussion for get-methods.
+
+ @return The extension part of the specified segment. If the path is
+ not hierarchical, or the specified segment does not exits, an empty
+ string is returned.
+ */
+ OUString getExtension(sal_Int32 nIndex = LAST_SEGMENT,
+ bool bIgnoreFinalSlash = true,
+ DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
+ const;
+
+ /** Set the extension of the name of a segment (replacing an already
+ existing extension).
+
+ @param rTheExtension The new extension.
+
+ @param nIndex The non-negative index of the segment, or LAST_SEGMENT
+ if addressing the last segment.
+
+ @param bIgnoreFinalSlash If true, a final slash at the end of the
+ hierarchical path does not denote an empty segment, but is ignored.
+
+ @param eCharset See the general discussion for set-methods.
+
+ @return True if the extension has successfully been modified (and the
+ resulting URI is still valid). If the path is not hierarchical, or
+ the specified segment does not exist, false is returned. If false is
+ returned, the object is not modified.
+ */
+ bool setExtension(std::u16string_view rTheExtension,
+ sal_Int32 nIndex = LAST_SEGMENT,
+ bool bIgnoreFinalSlash = true,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+ /** Remove the extension of the name of a segment.
+
+ @param nIndex The non-negative index of the segment, or LAST_SEGMENT
+ if addressing the last segment.
+
+ @param bIgnoreFinalSlash If true, a final slash at the end of the
+ hierarchical path does not denote an empty segment, but is ignored.
+
+ @return True if the extension has successfully been removed (and the
+ resulting URI is still valid), or if the name did not have an
+ extension. If the path is not hierarchical, or the specified segment
+ does not exist, false is returned. If false is returned, the object
+ is not modified.
+ */
+ bool removeExtension(sal_Int32 nIndex = LAST_SEGMENT,
+ bool bIgnoreFinalSlash = true);
+
+ /** Determine whether the hierarchical path ends in a final slash.
+
+ @return True if the hierarchical path ends in a final slash. If the
+ path is not hierarchical, false is returned.
+ */
+ bool hasFinalSlash() const;
+
+ /** Make the hierarchical path end in a final slash (if it does not
+ already do so).
+
+ @return True if a final slash has successfully been appended (and the
+ resulting URI is still valid), or if the hierarchical path already
+ ended in a final slash. If the path is not hierarchical, false is
+ returned. If false is returned, the object is not modified.
+ */
+ bool setFinalSlash();
+
+ /** Remove a final slash from the hierarchical path.
+
+ @return True if a final slash has successfully been removed (and the
+ resulting URI is still valid), or if the hierarchical path already did
+ not end in a final slash. If the path is not hierarchical, false is
+ returned. If false is returned, the object is not modified.
+ */
+ bool removeFinalSlash();
+
+ // Query:
+
+ bool HasParam() const { return m_aQuery.isPresent(); }
+
+ OUString GetParam(rtl_TextEncoding eCharset
+ = RTL_TEXTENCODING_UTF8) const
+ { return decode(m_aQuery, DecodeMechanism::NONE, eCharset); }
+
+ inline bool SetParam(std::u16string_view rTheQuery,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+ // Fragment:
+
+ bool HasMark() const { return m_aFragment.isPresent(); }
+
+ OUString GetMark(DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset
+ = RTL_TEXTENCODING_UTF8) const
+ { return decode(m_aFragment, eMechanism, eCharset); }
+
+ inline bool SetMark(std::u16string_view rTheFragment,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+ // File URLs:
+
+ /** Return the file system path represented by a file URL (ignoring any
+ fragment part).
+
+ @param eStyle The notation of the returned file system path.
+
+ @param pDelimiter Upon successful return, this parameter can return
+ the character that is the 'main' delimiter within the returned file
+ system path (e.g., "/" for Unix, "\" for DOS). This is
+ especially useful for routines that later try to shorten the returned
+ file system path at a 'good' position, e.g. to fit it into some
+ limited display space.
+
+ @return The file system path represented by this file URL. If this
+ file URL does not represent a file system path according to the
+ specified notation, or if this is not a file URL at all, an empty
+ string is returned.
+ */
+ OUString getFSysPath(FSysStyle eStyle, sal_Unicode * pDelimiter = nullptr)
+ const;
+
+ // Data URLs:
+ std::unique_ptr<SvMemoryStream> getData() const;
+
+ // Coding:
+
+ enum Part
+ {
+ PART_USER_PASSWORD = 0x00001,
+ PART_FPATH = 0x00008,
+ PART_AUTHORITY = 0x00010,
+ PART_REL_SEGMENT_EXTRA = 0x00020,
+ PART_URIC = 0x00040,
+ PART_HTTP_PATH = 0x00080,
+ PART_MESSAGE_ID_PATH = 0x00100,
+ PART_MAILTO = 0x00200,
+ PART_PATH_BEFORE_QUERY = 0x00400,
+ PART_PCHAR = 0x00800,
+ PART_VISIBLE = 0x01000,
+ PART_VISIBLE_NONSPECIAL = 0x02000,
+ PART_UNO_PARAM_VALUE = 0x04000,
+ PART_UNAMBIGUOUS = 0x08000,
+ PART_URIC_NO_SLASH = 0x10000,
+ PART_HTTP_QUERY = 0x20000, //TODO! unused?
+ };
+
+ enum class EscapeType
+ {
+ NONE,
+ Octet,
+ Utf32
+ };
+
+ /** Encode some text as part of a URI.
+
+ @param rText Some text (for its interpretation, see the general
+ discussion for set-methods).
+
+ @param ePart The part says which characters are 'forbidden' and must
+ be encoded (replaced by escape sequences). Characters outside the US-
+ ASCII range are always 'forbidden.'
+
+ @param eMechanism See the general discussion for set-methods.
+
+ @param eCharset See the general discussion for set-methods.
+
+ @return The text, encoded according to the given mechanism and
+ charset ('forbidden' characters replaced by escape sequences).
+ */
+ static OUString encode( std::u16string_view rText, Part ePart,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset
+ = RTL_TEXTENCODING_UTF8);
+
+
+ /** Decode some text.
+
+ @param rText Some (encoded) text.
+
+ @param eMechanism See the general discussion for get-methods.
+
+ @param eCharset See the general discussion for get-methods.
+
+ @return The text, decoded according to the given mechanism and
+ charset (escape sequences replaced by 'raw' characters).
+ */
+ static inline OUString decode(std::u16string_view rText,
+ DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset
+ = RTL_TEXTENCODING_UTF8);
+
+ static void appendUCS4Escape(OUStringBuffer & rTheText, sal_uInt32 nUCS4);
+
+ static void appendUCS4(OUStringBuffer & rTheText, sal_uInt32 nUCS4,
+ EscapeType eEscapeType, Part ePart,
+ rtl_TextEncoding eCharset, bool bKeepVisibleEscapes);
+
+ static sal_uInt32 getUTF32(sal_Unicode const *& rBegin,
+ sal_Unicode const * pEnd,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ EscapeType & rEscapeType);
+
+ // Specialized helpers:
+
+ static sal_uInt32 scanDomain(sal_Unicode const *& rBegin,
+ sal_Unicode const * pEnd,
+ bool bEager = true);
+
+ // OBSOLETE Hierarchical Path:
+
+ OUString GetPartBeforeLastName() const;
+
+ /** Get the last segment in the path.
+
+ @param eMechanism See the general discussion for get-methods.
+
+ @param eCharset See the general discussion for get-methods.
+
+ @return For a hierarchical URL, the last segment (everything after
+ the last unencoded '/'). Note that this last segment may be empty. If
+ the URL is not hierarchical, an empty string is returned.
+ */
+ OUString GetLastName(DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
+ const;
+
+ /** Get the 'extension' of the last segment in the path.
+
+ @return For a hierarchical URL, everything after the first unencoded
+ '.' in the last segment of the path. Note that this 'extension' may
+ be empty. If the URL is not hierarchical, or if the last segment does
+ not contain an unencoded '.', an empty string is returned.
+ */
+ OUString GetFileExtension() const;
+
+ bool Append(std::u16string_view rTheSegment,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+ void CutLastName();
+
+ // OBSOLETE File URLs:
+
+ OUString PathToFileName() const;
+
+ OUString GetFull() const;
+
+ OUString GetPath() const;
+
+ void SetBase(std::u16string_view rTheBase);
+
+ OUString GetBase() const;
+
+ void SetExtension(std::u16string_view rTheExtension);
+
+ OUString CutExtension();
+
+ static bool IsCaseSensitive() { return true; }
+
+ void changeScheme(INetProtocol eTargetScheme);
+
+private:
+ // General Structure:
+
+ class SAL_DLLPRIVATE SubString
+ {
+ sal_Int32 m_nBegin;
+ sal_Int32 m_nLength;
+
+ public:
+ explicit SubString(sal_Int32 nTheBegin = -1,
+ sal_Int32 nTheLength = 0):
+ m_nBegin(nTheBegin), m_nLength(nTheLength) {}
+
+ bool isPresent() const { return m_nBegin != -1; }
+
+ bool isEmpty() const { return m_nLength == 0; }
+
+ sal_Int32 getBegin() const { return m_nBegin; }
+
+ sal_Int32 getLength() const { return m_nLength; }
+
+ sal_Int32 getEnd() const { return m_nBegin + m_nLength; }
+
+ sal_Int32 clear();
+
+ sal_Int32 set(OUStringBuffer & rString,
+ std::u16string_view rSubString,
+ sal_Int32 nTheBegin);
+
+ sal_Int32 set(OUString & rString,
+ std::u16string_view rSubString);
+
+ sal_Int32 set(OUStringBuffer & rString,
+ std::u16string_view rSubString);
+
+ inline void operator +=(sal_Int32 nDelta);
+
+ int compare(SubString const & rOther,
+ OUStringBuffer const & rThisString,
+ OUStringBuffer const & rOtherString) const;
+ };
+
+ OUStringBuffer m_aAbsURIRef;
+ SubString m_aScheme;
+ SubString m_aUser;
+ SubString m_aAuth;
+ SubString m_aHost;
+ SubString m_aPort;
+ SubString m_aPath;
+ SubString m_aQuery;
+ SubString m_aFragment;
+ INetProtocol m_eScheme;
+ INetProtocol m_eSmartScheme;
+
+ TOOLS_DLLPRIVATE void setInvalid();
+
+ bool setAbsURIRef(
+ std::u16string_view rTheAbsURIRef,
+ EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bSmart,
+ FSysStyle eStyle);
+
+ // Relative URLs:
+
+ bool convertRelToAbs(
+ OUString const & rTheRelURIRef,
+ INetURLObject & rTheAbsURIRef, bool & rWasAbsolute,
+ EncodeMechanism eMechanism, rtl_TextEncoding eCharset,
+ bool bIgnoreFragment, bool bSmart, bool bRelativeNonURIs,
+ FSysStyle eStyle) const;
+
+ bool convertAbsToRel(
+ OUString const & rTheAbsURIRef,
+ OUString & rTheRelURIRef, EncodeMechanism eEncodeMechanism,
+ DecodeMechanism eDecodeMechanism, rtl_TextEncoding eCharset,
+ FSysStyle eStyle) const;
+
+ // External URLs:
+
+ static bool convertIntToExt(
+ std::u16string_view rTheIntURIRef,
+ OUString & rTheExtURIRef, DecodeMechanism eDecodeMechanism,
+ rtl_TextEncoding eCharset);
+
+ static bool convertExtToInt(
+ std::u16string_view rTheExtURIRef,
+ OUString & rTheIntURIRef, DecodeMechanism eDecodeMechanism,
+ rtl_TextEncoding eCharset);
+
+ // Scheme:
+
+ struct PrefixInfo;
+
+ TOOLS_DLLPRIVATE static inline SchemeInfo const & getSchemeInfo(
+ INetProtocol eTheScheme);
+
+ TOOLS_DLLPRIVATE inline SchemeInfo const & getSchemeInfo() const;
+
+ TOOLS_DLLPRIVATE static PrefixInfo const * getPrefix(
+ sal_Unicode const *& rBegin, sal_Unicode const * pEnd);
+
+ // Authority:
+
+ TOOLS_DLLPRIVATE sal_Int32 getAuthorityBegin() const;
+
+ TOOLS_DLLPRIVATE SubString getAuthority() const;
+
+ // User Info:
+
+ bool setUser(
+ std::u16string_view rTheUser,
+ rtl_TextEncoding eCharset);
+
+ bool clearPassword();
+
+ bool setPassword(
+ std::u16string_view rThePassword,
+ rtl_TextEncoding eCharset);
+
+ // Host and Port:
+
+ TOOLS_DLLPRIVATE static bool parseHost(
+ sal_Unicode const *& rBegin, sal_Unicode const * pEnd,
+ OUStringBuffer* pCanonic);
+
+ TOOLS_DLLPRIVATE static bool parseHostOrNetBiosName(
+ sal_Unicode const * pBegin, sal_Unicode const * pEnd,
+ EncodeMechanism eMechanism, rtl_TextEncoding eCharset,
+ bool bNetBiosName, OUStringBuffer* pCanonic);
+
+ bool setHost(
+ std::u16string_view rTheHost,
+ rtl_TextEncoding eCharset);
+
+ // Path:
+
+ TOOLS_DLLPRIVATE static bool parsePath(
+ INetProtocol eScheme, sal_Unicode const ** pBegin,
+ sal_Unicode const * pEnd, EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset, bool bSkippedInitialSlash,
+ sal_uInt32 nSegmentDelimiter, sal_uInt32 nAltSegmentDelimiter,
+ sal_uInt32 nQueryDelimiter, sal_uInt32 nFragmentDelimiter,
+ OUStringBuffer &rSynPath);
+
+ bool setPath(
+ std::u16string_view rThePath,
+ EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
+
+ // Hierarchical Path:
+
+ TOOLS_DLLPRIVATE bool checkHierarchical() const;
+
+ TOOLS_DLLPRIVATE SubString getSegment(
+ sal_Int32 nIndex, bool bIgnoreFinalSlash) const;
+
+ // Query:
+
+ void clearQuery();
+
+ bool setQuery(
+ std::u16string_view rTheQuery,
+ EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
+
+ // Fragment:
+
+ bool clearFragment();
+
+ bool setFragment(
+ std::u16string_view rTheMark,
+ EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
+
+ // FILE URLs:
+
+ TOOLS_DLLPRIVATE bool hasDosVolume(FSysStyle eStyle) const;
+
+ // Coding:
+
+ TOOLS_DLLPRIVATE static inline void appendEscape(
+ OUStringBuffer & rTheText, sal_uInt32 nOctet);
+
+ static void encodeText(
+ OUStringBuffer& rOutputBuffer,
+ sal_Unicode const * pBegin, sal_Unicode const * pEnd,
+ Part ePart, EncodeMechanism eMechanism, rtl_TextEncoding eCharset,
+ bool bKeepVisibleEscapes);
+
+ static inline void encodeText(
+ OUStringBuffer& rOutputBuffer,
+ std::u16string_view rTheText, Part ePart,
+ EncodeMechanism eMechanism, rtl_TextEncoding eCharset,
+ bool bKeepVisibleEscapes);
+
+ static OUString decode(
+ sal_Unicode const * pBegin, sal_Unicode const * pEnd,
+ DecodeMechanism, rtl_TextEncoding eCharset);
+
+ inline OUString decode(
+ SubString const & rSubString,
+ DecodeMechanism eMechanism, rtl_TextEncoding eCharset) const;
+
+ // Specialized helpers:
+
+ TOOLS_DLLPRIVATE static bool scanIPv6reference(
+ sal_Unicode const *& rBegin, sal_Unicode const * pEnd);
+};
+
+// static
+inline void INetURLObject::encodeText( OUStringBuffer& rOutputBuffer,
+ std::u16string_view rTheText,
+ Part ePart,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ bool bKeepVisibleEscapes)
+{
+ encodeText(rOutputBuffer,
+ rTheText.data(),
+ rTheText.data() + rTheText.size(), ePart,
+ eMechanism, eCharset, bKeepVisibleEscapes);
+}
+
+inline OUString INetURLObject::decode(SubString const & rSubString,
+ DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset) const
+{
+ return rSubString.isPresent() ?
+ decode(m_aAbsURIRef.getStr() + rSubString.getBegin(),
+ m_aAbsURIRef.getStr() + rSubString.getEnd(),
+ eMechanism, eCharset) :
+ OUString();
+}
+
+inline INetURLObject::INetURLObject(std::u16string_view rTheAbsURIRef,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset):
+ m_aAbsURIRef(rTheAbsURIRef.size() * 2), m_eScheme(INetProtocol::NotValid), m_eSmartScheme(INetProtocol::Http)
+{
+ setAbsURIRef(rTheAbsURIRef, eMechanism, eCharset, false,
+ FSysStyle(0));
+}
+
+inline bool INetURLObject::SetURL(std::u16string_view rTheAbsURIRef,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ return setAbsURIRef(rTheAbsURIRef, eMechanism, eCharset, false,
+ FSysStyle(0));
+}
+
+inline INetURLObject::INetURLObject(std::u16string_view rTheAbsURIRef,
+ INetProtocol eTheSmartScheme,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ FSysStyle eStyle):
+ m_eScheme(INetProtocol::NotValid), m_eSmartScheme(eTheSmartScheme)
+{
+ setAbsURIRef(rTheAbsURIRef, eMechanism, eCharset, true, eStyle);
+}
+
+inline bool INetURLObject::SetSmartURL(std::u16string_view rTheAbsURIRef,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ FSysStyle eStyle)
+{
+ return setAbsURIRef(rTheAbsURIRef, eMechanism, eCharset, true,
+ eStyle);
+}
+
+inline INetURLObject
+INetURLObject::smartRel2Abs(OUString const & rTheRelURIRef,
+ bool & rWasAbsolute,
+ bool bIgnoreFragment,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ bool bRelativeNonURIs,
+ FSysStyle eStyle) const
+{
+ INetURLObject aTheAbsURIRef;
+ convertRelToAbs(rTheRelURIRef, aTheAbsURIRef, rWasAbsolute,
+ eMechanism, eCharset, bIgnoreFragment, true,
+ bRelativeNonURIs, eStyle);
+ return aTheAbsURIRef;
+}
+
+inline bool INetURLObject::GetNewAbsURL(OUString const & rTheRelURIRef,
+ INetURLObject * pTheAbsURIRef)
+ const
+{
+ INetURLObject aTheAbsURIRef;
+ bool bWasAbsolute;
+ if (!convertRelToAbs(rTheRelURIRef, aTheAbsURIRef, bWasAbsolute,
+ EncodeMechanism::WasEncoded, RTL_TEXTENCODING_UTF8, false/*bIgnoreFragment*/, false, false,
+ FSysStyle::Detect))
+ return false;
+ if (pTheAbsURIRef)
+ *pTheAbsURIRef = aTheAbsURIRef;
+ return true;
+}
+
+// static
+inline OUString INetURLObject::GetRelURL(std::u16string_view rTheBaseURIRef,
+ OUString const & rTheAbsURIRef,
+ EncodeMechanism eEncodeMechanism,
+ DecodeMechanism eDecodeMechanism,
+ rtl_TextEncoding eCharset,
+ FSysStyle eStyle)
+{
+ OUString aTheRelURIRef;
+ INetURLObject(rTheBaseURIRef, eEncodeMechanism, eCharset).
+ convertAbsToRel(rTheAbsURIRef, aTheRelURIRef, eEncodeMechanism,
+ eDecodeMechanism, eCharset, eStyle);
+ return aTheRelURIRef;
+}
+
+// static
+inline bool INetURLObject::translateToExternal(std::u16string_view
+ rTheIntURIRef,
+ OUString & rTheExtURIRef,
+ DecodeMechanism
+ eDecodeMechanism,
+ rtl_TextEncoding eCharset)
+{
+ return convertIntToExt(rTheIntURIRef, rTheExtURIRef,
+ eDecodeMechanism, eCharset);
+}
+
+// static
+inline bool INetURLObject::translateToInternal(std::u16string_view
+ rTheExtURIRef,
+ OUString & rTheIntURIRef,
+ DecodeMechanism
+ eDecodeMechanism,
+ rtl_TextEncoding eCharset)
+{
+ return convertExtToInt(rTheExtURIRef, rTheIntURIRef,
+ eDecodeMechanism, eCharset);
+}
+
+inline bool INetURLObject::SetPass(std::u16string_view rThePassword)
+{
+ return rThePassword.empty() ?
+ clearPassword() :
+ setPassword(rThePassword, RTL_TEXTENCODING_UTF8);
+}
+
+inline bool INetURLObject::SetUserAndPass(std::u16string_view rTheUser,
+ std::u16string_view rThePassword)
+{
+ return setUser(rTheUser, RTL_TEXTENCODING_UTF8)
+ && (rThePassword.empty() ?
+ clearPassword() :
+ setPassword(rThePassword, RTL_TEXTENCODING_UTF8));
+}
+
+inline bool INetURLObject::SetParam(std::u16string_view rTheQuery,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ if (rTheQuery.empty())
+ {
+ clearQuery();
+ return false;
+ }
+ return setQuery(rTheQuery, eMechanism, eCharset);
+}
+
+inline bool INetURLObject::SetMark(std::u16string_view rTheFragment,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ return rTheFragment.empty() ?
+ clearFragment() :
+ setFragment(rTheFragment, eMechanism, eCharset);
+}
+
+// static
+inline OUString INetURLObject::encode(std::u16string_view rText, Part ePart,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ OUStringBuffer aBuf;
+ encodeText(aBuf, rText, ePart, eMechanism, eCharset, false);
+ return aBuf.makeStringAndClear();
+}
+
+// static
+inline OUString INetURLObject::decode(std::u16string_view rText,
+ DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ return decode(rText.data(), rText.data() + rText.size(),
+ eMechanism, eCharset);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/vcompat.hxx b/include/tools/vcompat.hxx
new file mode 100644
index 000000000..39cd0cd0b
--- /dev/null
+++ b/include/tools/vcompat.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_VCOMPAT_HXX
+#define INCLUDED_TOOLS_VCOMPAT_HXX
+
+#include <tools/toolsdllapi.h>
+
+inline sal_uInt32 COMPAT_FORMAT(char char1, char char2, char char3, char char4)
+{
+ return static_cast<sal_uInt32>(char1) | (static_cast<sal_uInt32>(char2) << 8)
+ | (static_cast<sal_uInt32>(char3) << 16) | (static_cast<sal_uInt32>(char4) << 24);
+};
+
+class SvStream;
+
+class TOOLS_DLLPUBLIC VersionCompatRead
+{
+ SvStream& mrRStm;
+ sal_uInt32 mnCompatPos;
+ sal_uInt32 mnTotalSize;
+ sal_uInt16 mnVersion;
+
+ VersionCompatRead(const VersionCompatRead&) = delete;
+ VersionCompatRead& operator=(const VersionCompatRead&) = delete;
+
+public:
+ VersionCompatRead(SvStream& rStm);
+ ~VersionCompatRead();
+
+ sal_uInt16 GetVersion() const { return mnVersion; }
+};
+
+class TOOLS_DLLPUBLIC VersionCompatWrite
+{
+ SvStream& mrWStm;
+ sal_uInt32 mnCompatPos;
+ sal_uInt32 mnTotalSize;
+
+ VersionCompatWrite(const VersionCompatWrite&) = delete;
+ VersionCompatWrite& operator=(const VersionCompatWrite&) = delete;
+
+public:
+ VersionCompatWrite(SvStream& rStm, sal_uInt16 nVersion = 1);
+ ~VersionCompatWrite();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/weakbase.h b/include/tools/weakbase.h
new file mode 100644
index 000000000..f5a79e635
--- /dev/null
+++ b/include/tools/weakbase.h
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_WEAKBASE_H
+#define INCLUDED_TOOLS_WEAKBASE_H
+
+#include <sal/types.h>
+#include <rtl/ref.hxx>
+#include <tools/toolsdllapi.h>
+
+/** the template classes in this header are helper to implement weak references
+ to implementation objects that are not refcounted.
+
+ THIS IS NOT THREADSAFE
+
+ Use this only to have 'safe' pointers to implementation objects that you
+ don't own but that you reference with a pointer.
+
+ Example:
+
+ class ImplClass : public tools::WeakBase< ImplClass >
+ {
+ ~ImplClass() { clearWeek(); } // not needed but safer, see method description
+ ...
+ };
+
+ class UserClass
+ {
+ tools::WeakReference< ImplClass > mxWeakRef;
+
+ UserClass( ImplClass* pObject ) : mxWeakRef( pObject ) {}
+
+ DoSomething()
+ {
+ if( mxWeakRef.is() )
+ mxWeakRef->DoSomethingMore();
+ }
+ };
+*/
+namespace tools
+{
+class WeakBase;
+
+/** private connection helper, do not use directly */
+struct WeakConnection
+{
+ sal_Int32 mnRefCount;
+ WeakBase* mpReference;
+
+ WeakConnection() : mnRefCount( 0 ), mpReference( nullptr ) {};
+ WeakConnection( WeakBase* pReference ) : mnRefCount( 0 ), mpReference( pReference ) {};
+ void acquire() { mnRefCount++; }
+ void release() { mnRefCount--; if( mnRefCount == 0 ) delete this; }
+};
+
+/** template implementation to hold a weak reference to an instance of type reference_type */
+template <class reference_type>
+class SAL_WARN_UNUSED WeakReference
+{
+public:
+ /** constructs an empty reference */
+ inline WeakReference();
+
+ /** constructs a reference with a pointer to a class derived from WeakBase */
+ inline WeakReference( reference_type* pReference );
+
+ /** constructs a reference from another reference */
+ inline WeakReference( const WeakReference< reference_type >& rWeakRef );
+
+ /** move a reference from another reference */
+ inline WeakReference( WeakReference< reference_type >&& rWeakRef );
+
+ /** returns true if the reference object is not null and still alive */
+ inline bool is() const;
+
+ /** returns true if the reference object is not null and still alive */
+ operator bool() const { return is(); }
+
+ /** returns the pointer to the reference object or null */
+ inline reference_type * get() const;
+
+ /** sets this reference to the given object or null */
+ inline void reset( reference_type* pReference );
+
+ /** resets this reference to null */
+ inline void reset();
+
+ /** returns the pointer to the reference object or null */
+ inline reference_type * operator->() const;
+
+ /** returns a ref to the reference object */
+ inline reference_type& operator*() const;
+
+ /** returns true if this instance references pReferenceObject */
+ inline bool operator== (const reference_type * pReferenceObject) const;
+
+ /** returns true if this instance and the given weakref reference the same object */
+ inline bool operator== (const WeakReference<reference_type> & handle) const;
+
+ /** only needed for using this class with stl containers */
+ inline bool operator!= (const WeakReference<reference_type> & handle) const;
+
+ /** only needed for using this class with stl containers */
+ inline bool operator< (const WeakReference<reference_type> & handle) const;
+
+ /** only needed for using this class with stl containers */
+ inline bool operator> (const WeakReference<reference_type> & handle) const;
+
+ /** the assignment operator */
+ inline WeakReference<reference_type>& operator= (const WeakReference<reference_type> & handle);
+
+ /** the move assignment operator */
+ inline WeakReference<reference_type>& operator= (WeakReference<reference_type> && handle);
+
+private:
+ rtl::Reference<WeakConnection> mpWeakConnection;
+};
+
+/** derive your implementation classes from this class if you want them to support weak references */
+class TOOLS_DLLPUBLIC WeakBase
+{
+ template<typename T> friend class WeakReference;
+
+public:
+ WeakBase() {}
+ virtual ~WeakBase();
+ /** clears the reference pointer in all living weak references for this instance.
+ Further created weak references will also be invalid.
+ You should call this method in the d'tor of your derived classes for an early
+ invalidate of all living weak references while your object is already inside
+ it d'tor.
+ */
+ inline void clearWeak();
+
+private:
+ inline WeakConnection* getWeakConnection();
+ rtl::Reference<WeakConnection> mpWeakConnection;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/weakbase.hxx b/include/tools/weakbase.hxx
new file mode 100644
index 000000000..ca6bdc37e
--- /dev/null
+++ b/include/tools/weakbase.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLS_WEAKBASE_HXX
+#define INCLUDED_TOOLS_WEAKBASE_HXX
+
+#include <tools/weakbase.h>
+
+/// see weakbase.h for documentation
+
+namespace tools
+{
+
+template< class reference_type >
+inline WeakReference< reference_type >::WeakReference()
+{
+ mpWeakConnection = new WeakConnection;
+}
+
+template< class reference_type >
+inline WeakReference< reference_type >::WeakReference( reference_type* pReference )
+{
+ reset( pReference );
+}
+
+template< class reference_type >
+inline WeakReference< reference_type >::WeakReference( const WeakReference< reference_type >& rWeakRef )
+{
+ mpWeakConnection = rWeakRef.mpWeakConnection;
+}
+
+template< class reference_type >
+inline WeakReference< reference_type >::WeakReference( WeakReference< reference_type >&& rWeakRef )
+{
+ mpWeakConnection = std::move(rWeakRef.mpWeakConnection);
+ rWeakRef.reset();
+}
+
+template< class reference_type >
+inline bool WeakReference< reference_type >::is() const
+{
+ return mpWeakConnection->mpReference != nullptr;
+}
+
+template< class reference_type >
+inline reference_type * WeakReference< reference_type >::get() const
+{
+ auto pWeakBase = mpWeakConnection->mpReference;
+ if (!pWeakBase)
+ return nullptr;
+ assert(dynamic_cast<reference_type *>(pWeakBase));
+ return static_cast<reference_type *>(pWeakBase);
+}
+
+template< class reference_type >
+inline void WeakReference< reference_type >::reset( reference_type* pReference )
+{
+ if( pReference )
+ mpWeakConnection = pReference->getWeakConnection();
+ else
+ reset();
+}
+
+template< class reference_type >
+inline void WeakReference< reference_type >::reset()
+{
+ mpWeakConnection = new WeakConnection;
+}
+
+template< class reference_type >
+inline reference_type * WeakReference< reference_type >::operator->() const
+{
+ return get();
+}
+
+template< class reference_type >
+inline reference_type& WeakReference< reference_type >::operator*() const
+{
+ return *get();
+}
+
+template< class reference_type >
+inline bool WeakReference< reference_type >::operator==(const reference_type * pReferenceObject) const
+{
+ return mpWeakConnection->mpReference == pReferenceObject;
+}
+
+template< class reference_type >
+inline bool WeakReference< reference_type >::operator==(const WeakReference<reference_type> & handle) const
+{
+ return mpWeakConnection == handle.mpWeakConnection;
+}
+
+template< class reference_type >
+inline bool WeakReference< reference_type >::operator!=(const WeakReference<reference_type> & handle) const
+{
+ return mpWeakConnection != handle.mpWeakConnection;
+}
+
+template< class reference_type >
+inline bool WeakReference< reference_type >::operator<(const WeakReference<reference_type> & handle) const
+{
+ return mpWeakConnection->mpReference < handle.mpWeakConnection->mpReference;
+}
+
+template< class reference_type >
+inline bool WeakReference< reference_type >::operator>(const WeakReference<reference_type> & handle) const
+{
+ return mpWeakConnection->mpReference > handle.mpWeakConnection->mpReference;
+}
+
+template< class reference_type >
+inline WeakReference<reference_type>& WeakReference<reference_type>::operator= (
+ const WeakReference<reference_type>& rReference)
+{
+ if (&rReference != this)
+ mpWeakConnection = rReference.mpWeakConnection;
+ return *this;
+}
+
+template< class reference_type >
+inline WeakReference<reference_type>& WeakReference<reference_type>::operator= (
+ WeakReference<reference_type>&& rReference)
+{
+ mpWeakConnection = std::move(rReference.mpWeakConnection);
+ return *this;
+}
+
+inline void WeakBase::clearWeak()
+{
+ if( mpWeakConnection.is() )
+ mpWeakConnection->mpReference = nullptr;
+}
+
+inline WeakConnection* WeakBase::getWeakConnection()
+{
+ if( !mpWeakConnection.is() )
+ mpWeakConnection = new WeakConnection( this );
+ return mpWeakConnection.get();
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/wintypes.hxx b/include/tools/wintypes.hxx
new file mode 100644
index 000000000..fcccd9a0d
--- /dev/null
+++ b/include/tools/wintypes.hxx
@@ -0,0 +1,265 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_WINTYPES_HXX
+#define INCLUDED_TOOLS_WINTYPES_HXX
+
+#include <sal/types.h>
+
+// Window-Types
+
+enum class WindowType : sal_uInt16
+{
+ NONE = 0,
+ FIRST = 0x0130, // 304
+ MESSBOX = FIRST, // 0
+ INFOBOX ,
+ WARNINGBOX ,
+ ERRORBOX ,
+ QUERYBOX ,
+ WINDOW ,
+ WORKWINDOW ,
+ CONTAINER ,
+ FLOATINGWINDOW ,
+ DIALOG ,
+ MODELESSDIALOG ,
+ CONTROL ,
+ PUSHBUTTON ,
+ OKBUTTON ,
+ CANCELBUTTON ,
+ HELPBUTTON ,
+ IMAGEBUTTON ,
+ MENUBUTTON ,
+ MOREBUTTON ,
+ SPINBUTTON ,
+ RADIOBUTTON ,
+ CHECKBOX ,
+ TRISTATEBOX ,
+ EDIT ,
+ MULTILINEEDIT ,
+ COMBOBOX ,
+ LISTBOX ,
+ MULTILISTBOX ,
+ FIXEDTEXT ,
+ FIXEDLINE ,
+ FIXEDBITMAP ,
+ FIXEDIMAGE ,
+ GROUPBOX ,
+ SCROLLBAR ,
+ SCROLLBARBOX ,
+ SPLITTER ,
+ SPLITWINDOW ,
+ SPINFIELD ,
+ PATTERNFIELD ,
+ METRICFIELD ,
+ FORMATTEDFIELD ,
+ CURRENCYFIELD ,
+ DATEFIELD ,
+ TIMEFIELD ,
+ PATTERNBOX ,
+ NUMERICBOX ,
+ METRICBOX ,
+ CURRENCYBOX ,
+ DATEBOX ,
+ TIMEBOX ,
+ LONGCURRENCYBOX ,
+ SCROLLWINDOW ,
+ TOOLBOX ,
+ DOCKINGWINDOW ,
+ STATUSBAR ,
+ TABPAGE ,
+ TABCONTROL ,
+ TABDIALOG ,
+ BORDERWINDOW ,
+ BUTTONDIALOG ,
+ SYSTEMCHILDWINDOW ,
+ SLIDER ,
+ MENUBARWINDOW ,
+ TREELISTBOX ,
+ HELPTEXTWINDOW ,
+ INTROWINDOW ,
+ LISTBOXWINDOW ,
+ DOCKINGAREA ,
+ RULER ,
+ HEADERBAR ,
+ VERTICALTABCONTROL ,
+ LAST = VERTICALTABCONTROL,
+ // only used in vclxtoolkit.cxx
+ TOOLKIT_FRAMEWINDOW = 0x1000,
+ TOOLKIT_SYSTEMCHILDWINDOW = 0x1001,
+};
+
+// Window-Bits
+
+typedef sal_Int64 WinBits;
+
+// Window-Bits for Window
+WinBits const WB_CLIPCHILDREN = 0x00000001;
+WinBits const WB_DIALOGCONTROL = 0x00000002;
+WinBits const WB_NODIALOGCONTROL = 0x00000004;
+WinBits const WB_BORDER = 0x00000008;
+WinBits const WB_NOBORDER = 0x00000010;
+WinBits const WB_SIZEABLE = 0x00000020;
+WinBits const WB_3DLOOK = 0x00000040;
+WinBits const WB_ALLOWMENUBAR = 0x00000080;
+
+// Window-Bits for SystemWindows
+WinBits const WB_MOVEABLE = 0x00000100;
+WinBits const WB_CLOSEABLE = 0x00000400;
+WinBits const WB_STANDALONE = 0x00000800;
+WinBits const WB_APP = 0x00001000;
+WinBits const WB_SYSTEMWINDOW = SAL_CONST_INT64(0x40000000);
+// warning: do not confuse WB_SYSTEMCHILDWINDOW with the SystemChildWindow class
+//
+// the SystemChildWindow class was there first and is a very specialized
+// system child window type for plugged applications. The SystemChildWindow class
+// explicitly should never use the WB_SYSTEMCHILDWINDOW WinBit
+//
+// WB_SYSTEMCHILDWINDOW on the other hand is to be used on system windows
+// which should be created as system child windows with (more or less)
+// normal event handling
+WinBits const WB_SYSTEMCHILDWINDOW = SAL_CONST_INT64(0x8000000000);
+WinBits const WB_SIZEMOVE = (WB_SIZEABLE | WB_MOVEABLE);
+
+// Standard-Window-Bits for ChildWindows
+WinBits const WB_TABSTOP = 0x00000100;
+WinBits const WB_NOTABSTOP = 0x00000200;
+WinBits const WB_GROUP = 0x00000400;
+WinBits const WB_NOGROUP = 0x00000800;
+WinBits const WB_HORZ = 0x00001000;
+WinBits const WB_VERT = 0x00002000;
+WinBits const WB_LEFT = 0x00004000;
+WinBits const WB_CENTER = 0x00008000;
+WinBits const WB_RIGHT = 0x00010000;
+WinBits const WB_TOP = 0x00020000;
+WinBits const WB_VCENTER = 0x00040000;
+WinBits const WB_BOTTOM = 0x00080000;
+WinBits const WB_DRAG = 0x00100000;
+WinBits const WB_SPIN = 0x00200000;
+WinBits const WB_REPEAT = 0x00400000;
+WinBits const WB_NOPOINTERFOCUS = 0x00800000;
+WinBits const WB_WORDBREAK = 0x01000000;
+WinBits const WB_NOLABEL = 0x02000000;
+WinBits const WB_SORT = 0x04000000;
+WinBits const WB_DROPDOWN = 0x08000000;
+WinBits const WB_HIDE = SAL_CONST_INT64(0x80000000);
+WinBits const WB_AUTOHSCROLL = SAL_CONST_INT64(0x10000000);
+WinBits const WB_DOCKABLE = SAL_CONST_INT64(0x20000000);
+WinBits const WB_AUTOVSCROLL = SAL_CONST_INT64(0x40000000);
+
+// #i93011# style bit for some child windows, that want their children checked for accelerators
+WinBits const WB_CHILDDLGCTRL = SAL_CONST_INT64(0x100000000000);
+
+// system floating window
+WinBits const WB_SYSTEMFLOATWIN = SAL_CONST_INT64(0x100000000);
+WinBits const WB_INTROWIN = SAL_CONST_INT64(0x200000000);
+WinBits const WB_NOSHADOW = SAL_CONST_INT64(0x400000000);
+WinBits const WB_TOOLTIPWIN = SAL_CONST_INT64(0x800000000);
+WinBits const WB_OWNERDRAWDECORATION = SAL_CONST_INT64(0x2000000000);
+WinBits const WB_DEFAULTWIN = SAL_CONST_INT64(0x4000000000);
+WinBits const WB_POPUP = SAL_CONST_INT64(0x20000000);
+
+WinBits const WB_HSCROLL = WB_HORZ;
+WinBits const WB_VSCROLL = WB_VERT;
+
+// Window-Bits for PushButtons
+WinBits const WB_DEFBUTTON = 0x10000000;
+WinBits const WB_NOLIGHTBORDER = 0x20000000;
+WinBits const WB_RECTSTYLE = 0x08000000;
+WinBits const WB_SMALLSTYLE = 0x04000000;
+WinBits const WB_TOGGLE = SAL_CONST_INT64(0x1000000000);
+WinBits const WB_BEVELBUTTON = SAL_CONST_INT64(0x2000000000);
+WinBits const WB_FLATBUTTON = SAL_CONST_INT64(0x4000000000);
+
+// Window-Bits for FixedText
+WinBits const WB_PATHELLIPSIS = 0x00100000;
+WinBits const WB_EXTRAOFFSET = 0x02000000;
+WinBits const WB_NOMULTILINE = 0x10000000;
+
+// Window-Bits for Edit
+WinBits const WB_READONLY = 0x02000000;
+WinBits const WB_NOHIDESELECTION = SAL_CONST_INT64(0x1000000000);
+
+// Window-Bits for MultiLineEdit
+WinBits const WB_IGNORETAB = 0x20000000;
+
+// Window-Bits for ListBox and MultiListBox
+WinBits const WB_SIMPLEMODE = 0x20000000;
+
+// Window-Bits for FixedBitmap
+WinBits const WB_SCALE = 0x08000000;
+
+// Window-Bits for ToolBox
+WinBits const WB_SCROLL = 0x02000000;
+
+// Window-Bits for SplitWindow
+WinBits const WB_NOSPLITDRAW = 0x01000000;
+
+// Standard-WinBits
+WinBits const WB_STDWORK = WB_SIZEMOVE | WB_CLOSEABLE;
+WinBits const WB_STDDOCKWIN = WB_DOCKABLE | WB_MOVEABLE | WB_CLOSEABLE;
+WinBits const WB_STDFLOATWIN = WB_SIZEMOVE | WB_CLOSEABLE;
+WinBits const WB_STDDIALOG = WB_MOVEABLE | WB_CLOSEABLE;
+WinBits const WB_STDMODELESS = WB_STDDIALOG;
+WinBits const WB_STDMODAL = WB_STDDIALOG;
+WinBits const WB_STDTABCONTROL = 0;
+WinBits const WB_STDPOPUP = WB_BORDER | WB_POPUP | WB_SYSTEMWINDOW | WB_3DLOOK | WB_DIALOGCONTROL;
+
+// For TreeListBox
+WinBits const WB_HASBUTTONS = SAL_CONST_INT64(0x000100000000);
+WinBits const WB_HASLINES = SAL_CONST_INT64(0x000200000000);
+WinBits const WB_HASLINESATROOT = SAL_CONST_INT64(0x000400000000);
+WinBits const WB_HASBUTTONSATROOT = SAL_CONST_INT64(0x000800000000);
+WinBits const WB_NOINITIALSELECTION = SAL_CONST_INT64(0x001000000000);
+WinBits const WB_HIDESELECTION = SAL_CONST_INT64(0x002000000000);
+// DO NOT USE: 0x008000000000, that's WB_SYSTEMCHILDWINDOW
+
+
+enum class WindowAlign { Left, Top, Right, Bottom };
+
+enum class ImageAlign { Left, Top, Right, Bottom,
+ LeftTop, LeftBottom, TopLeft,
+ TopRight, RightTop, RightBottom,
+ BottomLeft, BottomRight, Center };
+
+enum class SymbolAlign { LEFT, RIGHT };
+
+// ButtonDialog-Types
+
+enum class StandardButtonType
+{
+ OK = 0,
+ Cancel = 1,
+ Yes = 2,
+ No = 3,
+ Retry = 4,
+ Help = 5,
+ Close = 6,
+ More = 7,
+ Ignore = 8,
+ Abort = 9,
+ Less = 10,
+ Back = 11,
+ Next = 12,
+ Finish = 13,
+ Count = 14,
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/wldcrd.hxx b/include/tools/wldcrd.hxx
new file mode 100644
index 000000000..5c18ad20f
--- /dev/null
+++ b/include/tools/wldcrd.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_TOOLS_WLDCRD_HXX
+#define INCLUDED_TOOLS_WLDCRD_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <tools/toolsdllapi.h>
+#include <rtl/ustring.hxx>
+
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC WildCard
+{
+private:
+ OUString aWildString;
+ char cSepSymbol;
+
+ static bool ImpMatch( std::u16string_view aWild, std::u16string_view aStr );
+
+public:
+ WildCard()
+ : aWildString('*')
+ , cSepSymbol('\0')
+ {
+ }
+
+ WildCard(std::u16string_view rWildCard, const char cSeparator = '\0')
+ : aWildString(rWildCard)
+ , cSepSymbol(cSeparator)
+ {
+ }
+
+ const OUString & getGlob() const
+ {
+ return aWildString;
+ }
+
+ void setGlob(std::u16string_view rString)
+ {
+ aWildString = rString;
+ }
+
+ bool Matches( std::u16string_view rStr ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
new file mode 100644
index 000000000..745d44e91
--- /dev/null
+++ b/include/tools/zcodec.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_TOOLS_ZCODEC_HXX
+#define INCLUDED_TOOLS_ZCODEC_HXX
+
+#include <tools/toolsdllapi.h>
+#include <tools/long.hxx>
+#include <memory>
+
+#define ZCODEC_NO_COMPRESSION 0
+#define ZCODEC_DEFAULT_COMPRESSION 6
+
+class SvStream;
+
+// The overall client call protocol is one of:
+// * BeginCompression, Compress, EndCompression
+// * BeginCompression, Decompress, EndCompression
+// * BeginCompression, Write*, EndCompression
+// * BeginCompression, Read*, EndCompression
+// * BeginCompression, ReadAsynchron*, EndCompression
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC ZCodec
+{
+ enum State { STATE_INIT, STATE_DECOMPRESS, STATE_COMPRESS };
+ State meState;
+ bool mbStatus;
+ bool mbFinish;
+ std::unique_ptr<sal_uInt8[]> mpInBuf;
+ size_t mnInBufSize;
+ size_t mnInToRead;
+ SvStream* mpOStm;
+ std::unique_ptr<sal_uInt8[]> mpOutBuf;
+ size_t mnOutBufSize;
+
+ int mnCompressLevel;
+ bool mbGzLib;
+ void* mpsC_Stream;
+
+ void InitCompress();
+ void InitDecompress(SvStream & inStream);
+ void ImplWriteBack();
+
+public:
+ ZCodec( size_t nInBufSize = 32768, size_t nOutBufSize = 32768 );
+ ~ZCodec();
+ /**
+ * @brief Checks whether a stream is Z compressed
+ *
+ * @param rIStm the stream to check
+ */
+ static bool IsZCompressed( SvStream& rIStm );
+
+ void BeginCompression( int nCompressLevel = ZCODEC_DEFAULT_COMPRESSION, bool gzLib = false );
+ tools::Long EndCompression();
+
+ void Compress( SvStream& rIStm, SvStream& rOStm );
+ tools::Long Decompress( SvStream& rIStm, SvStream& rOStm );
+ bool AttemptDecompression( SvStream& rIStm, SvStream& rOStm );
+
+ void Write( SvStream& rOStm, const sal_uInt8* pData, sal_uInt32 nSize );
+ tools::Long Read( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/typelib/typeclass.h b/include/typelib/typeclass.h
new file mode 100644
index 000000000..387255e94
--- /dev/null
+++ b/include/typelib/typeclass.h
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_TYPELIB_TYPECLASS_H
+#define INCLUDED_TYPELIB_TYPECLASS_H
+
+#include "sal/types.h"
+
+/** This type class enum is binary compatible with the IDL enum com.sun.star.uno.TypeClass.
+*/
+typedef enum _typelib_TypeClass {
+ /** type class of void */
+ typelib_TypeClass_VOID = 0,
+ /** type class of char */
+ typelib_TypeClass_CHAR = 1,
+ /** type class of boolean */
+ typelib_TypeClass_BOOLEAN = 2,
+ /** type class of byte */
+ typelib_TypeClass_BYTE = 3,
+ /** type class of short */
+ typelib_TypeClass_SHORT = 4,
+ /** type class of unsigned short */
+ typelib_TypeClass_UNSIGNED_SHORT = 5,
+ /** type class of long */
+ typelib_TypeClass_LONG = 6,
+ /** type class of unsigned long */
+ typelib_TypeClass_UNSIGNED_LONG = 7,
+ /** type class of hyper */
+ typelib_TypeClass_HYPER = 8,
+ /** type class of unsigned hyper */
+ typelib_TypeClass_UNSIGNED_HYPER = 9,
+ /** type class of float */
+ typelib_TypeClass_FLOAT = 10,
+ /** type class of double */
+ typelib_TypeClass_DOUBLE = 11,
+ /** type class of string */
+ typelib_TypeClass_STRING = 12,
+ /** type class of type */
+ typelib_TypeClass_TYPE = 13,
+ /** type class of any */
+ typelib_TypeClass_ANY = 14,
+ /** type class of enum */
+ typelib_TypeClass_ENUM = 15,
+ /** type class of typedef */
+ typelib_TypeClass_TYPEDEF = 16,
+ /** type class of struct */
+ typelib_TypeClass_STRUCT = 17,
+ /** Deprecated, UNOIDL does not have a union concept.
+
+ @deprecated
+ */
+ typelib_TypeClass_UNION = 18,
+ /** type class of exception */
+ typelib_TypeClass_EXCEPTION = 19,
+ /** type class of sequence */
+ typelib_TypeClass_SEQUENCE = 20,
+ /** Deprecated, UNOIDL does not have an array concept.
+
+ @deprecated
+ */
+ typelib_TypeClass_ARRAY = 21,
+ /** type class of interface */
+ typelib_TypeClass_INTERFACE = 22,
+ /** type class of service (not implemented) */
+ typelib_TypeClass_SERVICE = 23,
+ /** type class of module (not implemented) */
+ typelib_TypeClass_MODULE = 24,
+ /** type class of interface method */
+ typelib_TypeClass_INTERFACE_METHOD = 25,
+ /** type class of interface attribute */
+ typelib_TypeClass_INTERFACE_ATTRIBUTE = 26,
+ /** type class of unknown type */
+ typelib_TypeClass_UNKNOWN = 27,
+ /** type class of properties */
+ typelib_TypeClass_PROPERTY = 28,
+ /** type class of constants */
+ typelib_TypeClass_CONSTANT = 29,
+ /** type class of constants groups */
+ typelib_TypeClass_CONSTANTS = 30,
+ /** type class of singletons */
+ typelib_TypeClass_SINGLETON = 31,
+ /** fixing enum size */
+ typelib_TypeClass_MAKE_FIXED_SIZE = SAL_MAX_ENUM
+} typelib_TypeClass;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/typelib/typedescription.h b/include/typelib/typedescription.h
new file mode 100644
index 000000000..a3e200d43
--- /dev/null
+++ b/include/typelib/typedescription.h
@@ -0,0 +1,1046 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_TYPELIB_TYPEDESCRIPTION_H
+#define INCLUDED_TYPELIB_TYPEDESCRIPTION_H
+
+#include "cppu/cppudllapi.h"
+#include "typelib/uik.h"
+#include "typelib/typeclass.h"
+#include "rtl/ustring.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct _typelib_TypeDescription;
+
+#if defined( _WIN32)
+#pragma pack(push, 8)
+#endif
+
+/** Holds a weak reference to a type description.
+*/
+typedef struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference
+{
+ /** reference count of type; don't ever modify this by yourself, use
+ typelib_typedescriptionreference_acquire() and typelib_typedescriptionreference_release()
+ */
+ sal_Int32 nRefCount;
+ /** number of static references of type, because of the fact that some types are needed
+ until program termination and are commonly held static.
+ */
+ sal_Int32 nStaticRefCount;
+ /** type class of type
+ */
+ typelib_TypeClass eTypeClass;
+ /** fully qualified name of type
+ */
+ rtl_uString * pTypeName;
+ /** pointer to full typedescription; this value is only valid if the type is never swapped out
+ */
+ struct _typelib_TypeDescription * pType;
+ /** pointer to optimize the runtime; not for public use
+ */
+ void * pUniqueIdentifier;
+ /** reserved for future use; 0 if not used
+ */
+ void * pReserved;
+} typelib_TypeDescriptionReference;
+
+/** Full type description of a type. Memory layout of this struct is identical to the
+ typelib_TypeDescriptionReference for the first six members.
+ So a typedescription can be used as type reference.
+*/
+typedef struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescription
+{
+ /** reference count; don't ever modify this by yourself, use
+ typelib_typedescription_acquire() and typelib_typedescription_release()
+ */
+ sal_Int32 nRefCount;
+ /** number of static references of type, because of the fact that some types are needed
+ until program termination and are commonly held static.
+ */
+ sal_Int32 nStaticRefCount;
+ /** type class of type
+ */
+ typelib_TypeClass eTypeClass;
+ /** fully qualified name of type
+ */
+ rtl_uString * pTypeName;
+ /** pointer to self to distinguish reference from description; for internal use only
+ */
+ struct _typelib_TypeDescription * pSelf;
+ /** pointer to optimize the runtime; not for public use
+ */
+ void * pUniqueIdentifier;
+ /** reserved for future use; 0 if not used
+ */
+ void * pReserved;
+
+ /** flag to determine whether the description is complete:
+ compound types lack of member names, enums lack of member types and names,
+ interfaces lack of members and table init.
+ Call typelib_typedescription_complete() if false.
+ */
+ sal_Bool bComplete;
+ /** size of type
+ */
+ sal_Int32 nSize;
+ /** alignment of type
+ */
+ sal_Int32 nAlignment;
+ /** pointer to weak reference
+ */
+ typelib_TypeDescriptionReference * pWeakRef;
+ /** determines, if type can be unloaded (and it is possible to reloaded it)
+ */
+ sal_Bool bOnDemand;
+} typelib_TypeDescription;
+
+/** Type description for exception types.
+*/
+typedef struct _typelib_CompoundTypeDescription
+{
+ /** inherits all members of typelib_TypeDescription
+ */
+ typelib_TypeDescription aBase;
+
+ /** pointer to base type description, else 0
+ */
+ struct _typelib_CompoundTypeDescription * pBaseTypeDescription;
+
+ /** number of members
+ */
+ sal_Int32 nMembers;
+ /** byte offsets of each member including the size the base type
+ */
+ sal_Int32 * pMemberOffsets;
+ /** members of the struct or exception
+ */
+ typelib_TypeDescriptionReference ** ppTypeRefs;
+ /** member names of the struct or exception
+ */
+ rtl_uString ** ppMemberNames;
+} typelib_CompoundTypeDescription;
+
+/**
+ Type description for struct types.
+
+ This is only used to represent plain struct types and instantiated
+ polymorphic struct types; there is no representation of polymorphic struct
+ type templates at this level.
+
+ @since UDK 3.2.0
+ */
+typedef struct _typelib_StructTypeDescription
+{
+ /**
+ Derived from typelib_CompoundTypeDescription.
+ */
+ typelib_CompoundTypeDescription aBase;
+
+ /**
+ Flags for direct members, specifying whether they are of parameterized
+ type (true) or explicit type (false).
+
+ For a plain struct type, this is a null pointer.
+ */
+ sal_Bool * pParameterizedTypes;
+} typelib_StructTypeDescription;
+
+/** Type description of a sequence.
+*/
+typedef struct _typelib_IndirectTypeDescription
+{
+ /** inherits all members of typelib_TypeDescription
+ */
+ typelib_TypeDescription aBase;
+
+ /** pointer to element type
+ */
+ typelib_TypeDescriptionReference * pType;
+} typelib_IndirectTypeDescription;
+
+/** Type description of an enum. The type class of this description is typelib_TypeClass_ENUM.
+*/
+typedef struct _typelib_EnumTypeDescription
+{
+ /** inherits all members of typelib_TypeDescription
+ */
+ typelib_TypeDescription aBase;
+
+ /** first value of the enum
+ */
+ sal_Int32 nDefaultEnumValue;
+ /** number of enum values
+ */
+ sal_Int32 nEnumValues;
+ /** names of enum values
+ */
+ rtl_uString ** ppEnumNames;
+ /** values of enum (corresponding to names in similar order)
+ */
+ sal_Int32 * pEnumValues;
+} typelib_EnumTypeDescription;
+
+/** Description of an interface method parameter.
+*/
+typedef struct _typelib_MethodParameter
+{
+ /** name of parameter
+ */
+ rtl_uString * pName;
+ /** type of parameter
+ */
+ typelib_TypeDescriptionReference * pTypeRef;
+ /** true: the call type of this parameter is [in] or [inout]
+ false: the call type of this parameter is [out]
+ */
+ sal_Bool bIn;
+ /** true: the call type of this parameter is [out] or [inout]
+ false: the call type of this parameter is [in]
+ */
+ sal_Bool bOut;
+} typelib_MethodParameter;
+
+/** Common base type description of typelib_InterfaceMethodTypeDescription and
+ typelib_InterfaceAttributeTypeDescription.
+*/
+typedef struct _typelib_InterfaceMemberTypeDescription
+{
+ /** inherits all members of typelib_TypeDescription
+ */
+ typelib_TypeDescription aBase;
+
+ /** position of member in the interface including the number of members of
+ any base interfaces
+ */
+ sal_Int32 nPosition;
+ /** name of member
+ */
+ rtl_uString * pMemberName;
+} typelib_InterfaceMemberTypeDescription;
+
+/** Type description of an interface method. The type class of this description is
+ typelib_TypeClass_INTERFACE_METHOD. The size and the alignment are 0.
+*/
+typedef struct _typelib_InterfaceMethodTypeDescription
+{
+ /** inherits all members of typelib_InterfaceMemberTypeDescription
+ */
+ typelib_InterfaceMemberTypeDescription aBase;
+
+ /** type of the return value
+ */
+ typelib_TypeDescriptionReference * pReturnTypeRef;
+ /** number of parameters
+ */
+ sal_Int32 nParams;
+ /** array of parameters
+ */
+ typelib_MethodParameter * pParams;
+ /** number of exceptions
+ */
+ sal_Int32 nExceptions;
+ /** array of exception types
+ */
+ typelib_TypeDescriptionReference ** ppExceptions;
+ /** determines whether method is declared oneway
+ */
+ sal_Bool bOneWay;
+
+ /** the interface description this method is a member of
+ */
+ struct _typelib_InterfaceTypeDescription * pInterface;
+ /** the inherited direct base method (null for a method that is not
+ inherited)
+
+ @since UDK 3.2.0
+ */
+ typelib_TypeDescriptionReference * pBaseRef;
+ /** if pBaseRef is null, the member position of this method within
+ pInterface, not counting members inherited from bases; if pBaseRef is
+ not null, the index of the direct base within pInterface from which this
+ method is inherited
+
+ @since UDK 3.2.0
+ */
+ sal_Int32 nIndex;
+} typelib_InterfaceMethodTypeDescription;
+
+/** The description of an interface attribute. The type class of this description is
+ typelib_TypeClass_INTERFACE_ATTRIBUTE. The size and the alignment are 0.
+*/
+typedef struct _typelib_InterfaceAttributeTypeDescription
+{
+ /** inherits all members of typelib_InterfaceMemberTypeDescription
+ */
+ typelib_InterfaceMemberTypeDescription aBase;
+
+ /** determines whether attribute is read only
+ */
+ sal_Bool bReadOnly;
+ /** type of the attribute
+ */
+ typelib_TypeDescriptionReference * pAttributeTypeRef;
+
+ /** the interface description this attribute is a member of
+ */
+ struct _typelib_InterfaceTypeDescription * pInterface;
+ /** the inherited direct base attribute (null for an attribute that is not
+ inherited)
+
+ @since UDK 3.2.0
+ */
+ typelib_TypeDescriptionReference * pBaseRef;
+ /** if pBaseRef is null, the member position of this attribute within
+ pInterface, not counting members inherited from bases; if pBaseRef is
+ not null, the index of the direct base within pInterface from which this
+ attribute is inherited
+
+ @since UDK 3.2.0
+ */
+ sal_Int32 nIndex;
+ /** number of getter exceptions
+
+ @since UDK 3.2.0
+ */
+ sal_Int32 nGetExceptions;
+ /** array of getter exception types
+
+ @since UDK 3.2.0
+ */
+ typelib_TypeDescriptionReference ** ppGetExceptions;
+ /** number of setter exceptions
+
+ @since UDK 3.2.0
+ */
+ sal_Int32 nSetExceptions;
+ /** array of setter exception types
+
+ @since UDK 3.2.0
+ */
+ typelib_TypeDescriptionReference ** ppSetExceptions;
+} typelib_InterfaceAttributeTypeDescription;
+
+/** Type description of an interface.
+
+ <p>Not all members are always initialized (not yet initialized members being
+ null); there are three levels:</p>
+ <ul>
+ <li>Minimally, only <code>aBase</code>,
+ <code>pBaseTypeDescription</code>, <code>aUik</code>,
+ <code>nBaseTypes</code>, and <code>ppBaseTypes</code> are initialized;
+ <code>aBase.bComplete</code> is false. This only happens when an
+ interface type description is created with
+ <code>typelib_static_mi_interface_type_init</code> or
+ <code>typelib_static_interface_type_init</code>.</li>
+
+ <li>At the next level, <code>nMembers</code>, <code>ppMembers</code>,
+ <code>nAllMembers</code>, <code>ppAllMembers</code> are also
+ initialized; <code>aBase.bComplete</code> is still false. This happens
+ when an interface type description is created with
+ <code>typelib_typedescription_newMIInterface</code> or
+ <code>typelib_typedescription_newInterface</code>.</li>
+
+ <li>At the final level, <code>pMapMemberIndexToFunctionIndex</code>,
+ <code>nMapFunctionIndexToMemberIndex</code>, and
+ <code>pMapFunctionIndexToMemberIndex</code> are also initialized;
+ <code>aBase.bComplete</code> is true. This happens after a call to
+ <code>typelib_typedescription_complete</code>.</li>
+ </ul>
+*/
+typedef struct SAL_DLLPUBLIC_RTTI _typelib_InterfaceTypeDescription
+{
+ /** inherits all members of typelib_TypeDescription
+ */
+ typelib_TypeDescription aBase;
+
+ /** pointer to base type description, else 0
+
+ @deprecated
+ use nBaseTypes and ppBaseTypes instead
+ */
+ struct _typelib_InterfaceTypeDescription * pBaseTypeDescription;
+ /** unique identifier of interface
+
+ @deprecated
+ should always contain all-zeros
+ */
+ typelib_Uik aUik;
+ /** number of members
+ */
+ sal_Int32 nMembers;
+ /** array of members; references attributes or methods
+ */
+ typelib_TypeDescriptionReference ** ppMembers;
+ /** number of members including members of base interface
+ */
+ sal_Int32 nAllMembers;
+ /** array of members including members of base interface; references attributes or methods
+ */
+ typelib_TypeDescriptionReference ** ppAllMembers;
+ /** array mapping index of the member description to an index doubling for read-write
+ attributes (called function index); size of array is nAllMembers
+ */
+ sal_Int32 * pMapMemberIndexToFunctionIndex;
+ /** number of members plus number of read-write attributes
+ */
+ sal_Int32 nMapFunctionIndexToMemberIndex;
+ /** array mapping function index to member index; size of array is nMapFunctionIndexToMemberIndex
+ */
+ sal_Int32 * pMapFunctionIndexToMemberIndex;
+ /** number of base types
+
+ @since UDK 3.2.0
+ */
+ sal_Int32 nBaseTypes;
+ /** array of base type descriptions
+
+ @since UDK 3.2.0
+ */
+ struct _typelib_InterfaceTypeDescription ** ppBaseTypes;
+} typelib_InterfaceTypeDescription;
+
+/** Init struct of compound members for typelib_typedescription_new().
+*/
+typedef struct _typelib_CompoundMember_Init
+{
+ /** type class of compound member
+ */
+ typelib_TypeClass eTypeClass;
+ /** name of type of compound member
+
+ For a member of an instantiated polymorphic struct type that is of
+ parameterized type, this will be a null pointer.
+ */
+ rtl_uString * pTypeName;
+ /** name of compound member
+ */
+ rtl_uString * pMemberName;
+} typelib_CompoundMember_Init;
+
+/**
+ Init struct of members for typelib_typedescription_newStruct().
+
+ @since UDK 3.2.0
+ */
+typedef struct _typelib_StructMember_Init
+{
+ /**
+ Derived from typelib_CompoundMember_Init;
+ */
+ typelib_CompoundMember_Init aBase;
+
+ /**
+ Flag specifying whether the member is of parameterized type (true) or
+ explicit type (false).
+ */
+ sal_Bool bParameterizedType;
+} typelib_StructMember_Init;
+
+/** Init struct of interface methods for typelib_typedescription_new().
+*/
+typedef struct _typelib_Parameter_Init
+{
+ /** type class of parameter
+ */
+ typelib_TypeClass eTypeClass;
+ /** name of parameter
+ */
+ rtl_uString * pTypeName;
+ /** name of parameter
+ */
+ rtl_uString * pParamName;
+ /** true, if parameter is [in] or [inout]
+ */
+ sal_Bool bIn;
+ /** true, if parameter is [out] or [inout]
+ */
+ sal_Bool bOut;
+} typelib_Parameter_Init;
+
+#if defined( _WIN32)
+#pragma pack(pop)
+#endif
+
+/** Creates an enum type description.
+
+ @param ppRet inout enum type description
+ @param pTypeName name of enum
+ @param nDefaultValue default enum value
+ @param nEnumValues number of enum values
+ @param ppEnumNames names of enum values
+ @param pEnumValues enum values
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newEnum(
+ typelib_TypeDescription ** ppRet,
+ rtl_uString * pTypeName,
+ sal_Int32 nDefaultValue,
+ sal_Int32 nEnumValues,
+ rtl_uString ** ppEnumNames,
+ sal_Int32 * pEnumValues )
+ SAL_THROW_EXTERN_C();
+
+/** Creates a new type description.
+
+ Since this function can only be used to create type descriptions for plain
+ struct types, not for instantiated polymorphic struct types, the function
+ typelib_typedescription_newStruct should be used instead for all struct
+ types.
+
+ @param ppRet inout type description
+ @param eTypeClass type class
+ @param pTypeName name of type
+ @param pType sequence: element type;
+ struct, Exception: base type;
+ @param nMembers number of members if struct, exception
+ @param pMembers array of members if struct, exception
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_new(
+ typelib_TypeDescription ** ppRet,
+ typelib_TypeClass eTypeClass,
+ rtl_uString * pTypeName,
+ typelib_TypeDescriptionReference * pType,
+ sal_Int32 nMembers,
+ typelib_CompoundMember_Init * pMembers )
+ SAL_THROW_EXTERN_C();
+
+/** Creates a new struct type description.
+
+ @param ppRet inout type description
+ @param pTypeName name of type
+ @param pType base type;
+ @param nMembers number of members
+ @param pMembers array of members
+
+ @since UDK 3.2.0
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newStruct(
+ typelib_TypeDescription ** ppRet,
+ rtl_uString * pTypeName,
+ typelib_TypeDescriptionReference * pType,
+ sal_Int32 nMembers,
+ typelib_StructMember_Init * pMembers )
+ SAL_THROW_EXTERN_C();
+
+/** Creates an interface type description.
+
+ @param ppRet inout interface type description
+ @param pTypeName the fully qualified name of the interface.
+ @param nUik1 uik part; deprecated and ignored, should always be 0
+ @param nUik2 uik part; deprecated and ignored, should always be 0
+ @param nUik3 uik part; deprecated and ignored, should always be 0
+ @param nUik4 uik part; deprecated and ignored, should always be 0
+ @param nUik5 uik part; deprecated and ignored, should always be 0
+ @param pBaseInterface base interface type, else 0
+ @param nMembers number of members
+ @param ppMembers members; attributes or methods
+
+ @deprecated
+ use typelib_typedescription_newMIInterface instead
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newInterface(
+ typelib_InterfaceTypeDescription ** ppRet,
+ rtl_uString * pTypeName,
+ sal_uInt32 nUik1, sal_uInt16 nUik2, sal_uInt16 nUik3, sal_uInt32 nUik4, sal_uInt32 nUik5,
+ typelib_TypeDescriptionReference * pBaseInterface,
+ sal_Int32 nMembers,
+ typelib_TypeDescriptionReference ** ppMembers )
+ SAL_THROW_EXTERN_C();
+
+/** Creates a multiple-inheritance interface type description.
+
+ @param ppRet inout interface type description
+ @param pTypeName the fully qualified name of the interface.
+ @param nUik1 uik part; deprecated and ignored, should always be 0
+ @param nUik2 uik part; deprecated and ignored, should always be 0
+ @param nUik3 uik part; deprecated and ignored, should always be 0
+ @param nUik4 uik part; deprecated and ignored, should always be 0
+ @param nUik5 uik part; deprecated and ignored, should always be 0
+ @param nBaseInterfaces number of base interface types
+ @param ppBaseInterfaces base interface types
+ @param nMembers number of members
+ @param ppMembers members; attributes or methods
+
+ @since UDK 3.2.0
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newMIInterface(
+ typelib_InterfaceTypeDescription ** ppRet,
+ rtl_uString * pTypeName,
+ sal_uInt32 nUik1, sal_uInt16 nUik2, sal_uInt16 nUik3, sal_uInt32 nUik4, sal_uInt32 nUik5,
+ sal_Int32 nBaseInterfaces,
+ typelib_TypeDescriptionReference ** ppBaseInterfaces,
+ sal_Int32 nMembers,
+ typelib_TypeDescriptionReference ** ppMembers )
+ SAL_THROW_EXTERN_C();
+
+/** Creates an interface method type description.
+
+ @param ppRet inout method type description
+ @param nAbsolutePosition position of member including all members of base interfaces
+ @param bOneWay determines whether method is declared oneway
+ @param pMethodName fully qualified name of method including interface name
+ @param eReturnTypeClass type class of return type
+ @param pReturnTypeName type name of the return type
+ @param nParams number of parameters
+ @param pParams parameter types
+ @param nExceptions number of exceptions
+ @param ppExceptionNames type names of exceptions
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newInterfaceMethod(
+ typelib_InterfaceMethodTypeDescription ** ppRet,
+ sal_Int32 nAbsolutePosition,
+ sal_Bool bOneWay,
+ rtl_uString * pMethodName,
+ typelib_TypeClass eReturnTypeClass,
+ rtl_uString * pReturnTypeName,
+ sal_Int32 nParams,
+ typelib_Parameter_Init * pParams,
+ sal_Int32 nExceptions,
+ rtl_uString ** ppExceptionNames )
+ SAL_THROW_EXTERN_C();
+
+/** Creates an interface attribute type description.
+
+ @param ppRet inout attribute type description
+ @param nAbsolutePosition position of this attribute including all members of base interfaces
+ @param pAttributeName fully qualified name of attribute including interface
+ name
+ @param eAttributeTypeClass type class of attribute type
+ @param pAttributeTypeName type name of attribute type
+ @param bReadOnly determines whether attribute is read-only
+
+ @deprecated
+ use typelib_typedescription_newExtendedInterfaceAttribute instead
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newInterfaceAttribute(
+ typelib_InterfaceAttributeTypeDescription ** ppRet,
+ sal_Int32 nAbsolutePosition,
+ rtl_uString * pAttributeName,
+ typelib_TypeClass eAttributeTypeClass,
+ rtl_uString * pAttributeTypeName,
+ sal_Bool bReadOnly )
+ SAL_THROW_EXTERN_C();
+
+/** Creates an extended interface attribute type description.
+
+ @param ppRet inout attribute type description
+ @param nAbsolutePosition position of this attribute including all members of
+ base interfaces
+ @param pAttributeName fully qualified name of attribute including interface
+ name
+ @param eAttributeTypeClass type class of attribute type
+ @param pAttributeTypeName type name of attribute type
+ @param bReadOnly determines whether attribute is read-only
+ @param nGetExceptions number of getter exceptions
+ @param ppGetExceptionNames type names of getter exceptions
+ @param nSetExceptions number of setter exceptions
+ @param ppSetExceptionNames type names of setter exceptions
+
+ @since UDK 3.2.0
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute(
+ typelib_InterfaceAttributeTypeDescription ** ppRet,
+ sal_Int32 nAbsolutePosition,
+ rtl_uString * pAttributeName,
+ typelib_TypeClass eAttributeTypeClass,
+ rtl_uString * pAttributeTypeName,
+ sal_Bool bReadOnly,
+ sal_Int32 nGetExceptions, rtl_uString ** ppGetExceptionNames,
+ sal_Int32 nSetExceptions, rtl_uString ** ppSetExceptionNames )
+ SAL_THROW_EXTERN_C();
+
+/** Increments reference count of given type description.
+
+ @param pDesc type description
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_acquire(
+ typelib_TypeDescription * pDesc )
+ SAL_THROW_EXTERN_C();
+
+/** Decrements reference count of given type. If reference count reaches 0, the type description
+ is deleted.
+
+ @param pDesc type description
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_release(
+ typelib_TypeDescription * pDesc )
+ SAL_THROW_EXTERN_C();
+
+/** Registers a type description and creates a type description reference. Type descriptions
+ will be registered automatically if they are provided via the callback chain.
+
+ @param ppNewDescription inout description to be registered;
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_register(
+ typelib_TypeDescription ** ppNewDescription )
+ SAL_THROW_EXTERN_C();
+
+/** Tests whether two types descriptions are equal, i.e. type class and names are equal.
+
+ @param p1 a type description
+ @param p2 another type description
+ @return true, if type descriptions are equal
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescription_equals(
+ const typelib_TypeDescription * p1, const typelib_TypeDescription * p2 )
+ SAL_THROW_EXTERN_C();
+
+/** Retrieves a type description via its fully qualified name.
+
+ @param ppRet inout type description; *ppRet is 0, if type description was not found
+ @param pName name demanded type description
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_getByName(
+ typelib_TypeDescription ** ppRet, rtl_uString * pName )
+ SAL_THROW_EXTERN_C();
+
+/** Sets size of type description cache.
+
+ @param nNewSize new size of cache
+
+ @deprecated Do not use, it does not have any effect.
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_setCacheSize(
+ sal_Int32 nNewSize )
+ SAL_THROW_EXTERN_C();
+
+/** Function pointer declaration of callback function get additional descriptions. Callbacks
+ must provide complete type descriptions (see typelib_typedescription_complete())!
+
+ @param pContext callback context
+ @param ppRet inout type description
+ @param pTypeName name of demanded type description
+*/
+typedef void (SAL_CALL * typelib_typedescription_Callback)(
+ void * pContext, typelib_TypeDescription ** ppRet, rtl_uString * pTypeName );
+
+/** Registers callback function providing additional type descriptions.
+
+ @param pContext callback context
+ @param pCallback callback function
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_registerCallback(
+ void * pContext, typelib_typedescription_Callback pCallback )
+ SAL_THROW_EXTERN_C();
+
+/** Revokes a previously registered callback function.
+
+ @param pContext callback context
+ @param pCallback registered callback function
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_revokeCallback(
+ void * pContext, typelib_typedescription_Callback pCallback )
+ SAL_THROW_EXTERN_C();
+
+
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+
+/** Creates a type description reference. This is a weak reference not holding the description.
+ If the description is already registered, the previous one is returned.
+
+ @param ppTDR inout type description reference
+ @param eTypeClass type class of type
+ @param pTypeName name of type
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_new(
+ typelib_TypeDescriptionReference ** ppTDR,
+ typelib_TypeClass eTypeClass,
+ rtl_uString * pTypeName )
+ SAL_THROW_EXTERN_C();
+
+/** Creates a type description reference. This is a weak reference not holding the description.
+ If the description is already registered, the previous one is returned.
+
+ @param ppTDR inout type description reference
+ @param eTypeClass type class of type
+ @param pTypeName ascii name of type
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_newByAsciiName(
+ typelib_TypeDescriptionReference ** ppTDR,
+ typelib_TypeClass eTypeClass,
+ const char * pTypeName )
+ SAL_THROW_EXTERN_C();
+
+/** Increments reference count of type description reference.
+
+ @param pRef type description reference
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_acquire(
+ typelib_TypeDescriptionReference * pRef )
+ SAL_THROW_EXTERN_C();
+
+/** Increments reference count of type description reference. If the reference count reaches 0,
+ then the reference is deleted.
+
+ @param pRef type description reference
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_release(
+ typelib_TypeDescriptionReference * pRef )
+ SAL_THROW_EXTERN_C();
+
+/** Retrieves the type description for a given reference. If it is not possible to resolve the
+ reference, null is returned.
+
+ @param[in,out] ppRet type description
+ @param[in] pRef type description reference
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_getDescription(
+ typelib_TypeDescription ** ppRet, typelib_TypeDescriptionReference * pRef )
+ SAL_THROW_EXTERN_C();
+
+/** Tests whether two types description references are equal, i.e. type class and names are equal.
+
+ @param p1 a type description reference
+ @param p2 another type description reference
+ @return true, if type description references are equal
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescriptionreference_equals(
+ const typelib_TypeDescriptionReference * p1, const typelib_TypeDescriptionReference * p2 )
+ SAL_THROW_EXTERN_C();
+
+/** Assigns a type.
+
+ @param ppDest destination type
+ @param pSource source type
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_assign(
+ typelib_TypeDescriptionReference ** ppDest,
+ typelib_TypeDescriptionReference * pSource )
+ SAL_THROW_EXTERN_C();
+
+/** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes
+ widening conversion (e.g., long assignable from short), as long as there is no data loss.
+
+ @param pAssignable type description of value to be assigned
+ @param pFrom type description of value
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescription_isAssignableFrom(
+ typelib_TypeDescription * pAssignable,
+ typelib_TypeDescription * pFrom )
+ SAL_THROW_EXTERN_C();
+
+/** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes
+ widening conversion (e.g., long assignable from short), as long as there is no data loss.
+
+ @param pAssignable type of value to be assigned
+ @param pFrom type of value
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescriptionreference_isAssignableFrom(
+ typelib_TypeDescriptionReference * pAssignable,
+ typelib_TypeDescriptionReference * pFrom )
+ SAL_THROW_EXTERN_C();
+
+/** Gets static type reference of standard types by type class.
+ ADDITIONAL OPT: provides Type com.sun.star.uno.Exception for typelib_TypeClass_EXCEPTION
+ and com.sun.star.uno.XInterface for typelib_TypeClass_INTERFACE.
+
+ Thread synchronizes on typelib mutex.
+
+ @param eTypeClass type class of basic type
+ @return pointer to type reference pointer
+*/
+CPPU_DLLPUBLIC typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
+ typelib_TypeClass eTypeClass )
+ SAL_THROW_EXTERN_C();
+
+/** Inits static type reference. Thread synchronizes on typelib init mutex.
+
+ @param ppRef pointer to type reference pointer
+ @param eTypeClass type class of type
+ @param pTypeName ascii name of type
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_static_type_init(
+ typelib_TypeDescriptionReference ** ppRef,
+ typelib_TypeClass eTypeClass, const char * pTypeName )
+ SAL_THROW_EXTERN_C();
+
+/** Inits static sequence type reference. Thread synchronizes on typelib init mutex.
+
+ @param ppRef pointer to type reference pointer
+ @param pElementType element type of sequence
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_static_sequence_type_init(
+ typelib_TypeDescriptionReference ** ppRef,
+ typelib_TypeDescriptionReference * pElementType )
+ SAL_THROW_EXTERN_C ();
+
+/** Inits incomplete static compound type reference. Thread synchronizes on typelib init mutex.
+
+ Since this function can only be used to create type descriptions for plain
+ struct types, not for instantiated polymorphic struct types, the function
+ typelib_static_struct_type_init should be used instead for all struct types.
+
+ @param ppRef pointer to type reference pointer
+ @param eTypeClass typelib_TypeClass_STRUCT or typelib_TypeClass_EXCEPTION
+ @param pTypeName name of type
+ @param pBaseType base type
+ @param nMembers number of members
+ @param ppMembers member types
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_static_compound_type_init(
+ typelib_TypeDescriptionReference ** ppRef,
+ typelib_TypeClass eTypeClass, const char * pTypeName,
+ typelib_TypeDescriptionReference * pBaseType,
+ sal_Int32 nMembers, typelib_TypeDescriptionReference ** ppMembers )
+ SAL_THROW_EXTERN_C();
+
+/** Inits incomplete static struct type reference.
+
+ Thread synchronizes on typelib init mutex.
+
+ @param ppRef pointer to type reference pointer
+ @param pTypeName name of type
+ @param pBaseType base type
+ @param nMembers number of members
+ @param ppMembers member types
+ @param pParameterizedTypes flags for direct members, specifying whether they
+ are of parameterized type (true) or explicit type (false); must be null
+ for a plain struct type
+
+ @since UDK 3.2.0
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_static_struct_type_init(
+ typelib_TypeDescriptionReference ** ppRef, const char * pTypeName,
+ typelib_TypeDescriptionReference * pBaseType,
+ sal_Int32 nMembers, typelib_TypeDescriptionReference ** ppMembers,
+ sal_Bool const * pParameterizedTypes )
+ SAL_THROW_EXTERN_C();
+
+/** Inits incomplete static interface type reference. Thread synchronizes on typelib init mutex.
+
+ @param ppRef pointer to type reference pointer
+ @param pTypeName name of interface
+ @param pBaseType base type
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_static_interface_type_init(
+ typelib_TypeDescriptionReference ** ppRef,
+ const char * pTypeName,
+ typelib_TypeDescriptionReference * pBaseType )
+ SAL_THROW_EXTERN_C();
+
+/** Inits incomplete static multiple-inheritance interface type reference.
+ Thread synchronizes on typelib init mutex.
+
+ @param ppRef pointer to type reference pointer
+ @param pTypeName name of interface
+ @param nBaseTypes number of base types
+ @param ppBaseTypes base types
+
+ @since UDK 3.2.0
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_static_mi_interface_type_init(
+ typelib_TypeDescriptionReference ** ppRef,
+ const char * pTypeName,
+ sal_Int32 nBaseTypes,
+ typelib_TypeDescriptionReference ** ppBaseTypes )
+ SAL_THROW_EXTERN_C();
+
+/** Inits incomplete static enum type reference. Thread synchronizes on typelib init mutex.
+
+ @param ppRef pointer to type reference pointer
+ @param pTypeName name of enum
+ @param nDefaultValue default enum value
+*/
+CPPU_DLLPUBLIC void SAL_CALL typelib_static_enum_type_init(
+ typelib_TypeDescriptionReference ** ppRef,
+ const char * pTypeName,
+ sal_Int32 nDefaultValue )
+ SAL_THROW_EXTERN_C();
+
+/** Completes a typedescription to be used for, e.g., marshalling values. COMPOUND,
+ INTERFACE and ENUM type descriptions may be partly initialized (see typelib_static_...(),
+ typelib_TypeDescription::bComplete). For interface type descriptions, this will also
+ init index tables.
+
+ @param ppTypeDescr [inout] type description to be completed (may be exchanged!)
+ @return true, if type description is complete
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescription_complete(
+ typelib_TypeDescription ** ppTypeDescr )
+ SAL_THROW_EXTERN_C();
+
+/// @cond INTERNAL
+
+/** Returns true, if the type description reference may lose the type description. Otherwise
+ pType is a valid pointer and cannot be discarded through the lifetime of this reference.
+ Remark: If the pWeakObj of the type is set too, you can avoid the call of
+ ...getDescription(...) and use the description directly. pWeakObj == 0 means, that the
+ description is not initialized.
+ @internal
+*/
+#if defined LIBO_INTERNAL_ONLY && defined __cplusplus
+constexpr
+#endif
+inline bool TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( _typelib_TypeClass eTypeClass )
+{
+ return (eTypeClass == typelib_TypeClass_INTERFACE_METHOD) ||
+ (eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE);
+}
+
+/** Gets a description from the reference. The description may not be locked by this call.
+ You must use the TYPELIB_DANGER_RELEASE macro to release the description fetched with
+ this macro.
+ @internal
+*/
+inline void TYPELIB_DANGER_GET( typelib_TypeDescription** ppMacroTypeDescr,
+ typelib_TypeDescriptionReference* pMacroTypeRef )
+{
+ if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pMacroTypeRef->eTypeClass ))
+ {
+ typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef );
+ }
+ else if (!pMacroTypeRef->pType || !pMacroTypeRef->pType->pWeakRef)
+ {
+ typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef );
+ if (*ppMacroTypeDescr)
+ typelib_typedescription_release( *ppMacroTypeDescr );
+ }
+ else
+ {
+ *ppMacroTypeDescr = pMacroTypeRef->pType;
+ }
+}
+
+/** Releases the description previous fetched by TYPELIB_DANGER_GET.
+ @internal
+*/
+inline void TYPELIB_DANGER_RELEASE( typelib_TypeDescription* pDescription )
+{
+ if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pDescription->eTypeClass ))
+ typelib_typedescription_release( pDescription );
+}
+
+/// @endcond
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/typelib/typedescription.hxx b/include/typelib/typedescription.hxx
new file mode 100644
index 000000000..9d749718b
--- /dev/null
+++ b/include/typelib/typedescription.hxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_TYPELIB_TYPEDESCRIPTION_HXX
+#define INCLUDED_TYPELIB_TYPEDESCRIPTION_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "rtl/alloc.h"
+#include "rtl/ustring.hxx"
+#include "com/sun/star/uno/Type.h"
+#include "typelib/typedescription.h"
+
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+/** C++ wrapper for typelib_TypeDescription.
+ Constructors by name, type, type description reference will get the full type description.
+
+ @see typelib_TypeDescription
+*/
+class TypeDescription
+{
+ /** C typelib type description
+ */
+ mutable typelib_TypeDescription * _pTypeDescr;
+
+public:
+ /// @cond INTERNAL
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new ( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete ( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new ( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete ( void *, void * )
+ {}
+ /// @endcond
+
+ /** Constructor:
+
+ @param pTypeDescr a type description
+ */
+ inline TypeDescription( typelib_TypeDescription * pTypeDescr = NULL );
+ /** Constructor:
+
+ @param pTypeDescrRef a type description reference
+ */
+ inline TypeDescription( typelib_TypeDescriptionReference * pTypeDescrRef );
+ /** Constructor:
+
+ @param rType a type
+ */
+ inline TypeDescription( const css::uno::Type & rType );
+ /** Copy constructor:
+
+ @param rDescr another TypeDescription
+ */
+ inline TypeDescription( const TypeDescription & rDescr );
+#if defined LIBO_INTERNAL_ONLY
+ TypeDescription(TypeDescription && other) noexcept : _pTypeDescr(other._pTypeDescr)
+ { other._pTypeDescr = nullptr; }
+#endif
+ /** Constructor:
+
+ @param pTypeName a type name
+ */
+ inline TypeDescription( rtl_uString * pTypeName );
+ /** Constructor:
+
+ @param rTypeName a type name
+ */
+ inline TypeDescription( const ::rtl::OUString & rTypeName );
+ /** Destructor: releases type description
+ */
+ inline ~TypeDescription();
+
+ /** Assignment operator: acquires given type description and releases a set one.
+
+ @param pTypeDescr another type description
+ @return this TypeDescription
+ */
+ inline TypeDescription & SAL_CALL operator = ( typelib_TypeDescription * pTypeDescr );
+ /** Assignment operator: acquires given type description and releases a set one.
+
+ @param rTypeDescr another type description
+ @return this TypeDescription
+ */
+ TypeDescription & SAL_CALL operator =( const TypeDescription & rTypeDescr )
+ { return this->operator =( rTypeDescr.get() ); }
+
+#if defined LIBO_INTERNAL_ONLY
+ TypeDescription & operator =(TypeDescription && other) noexcept {
+ if (_pTypeDescr != nullptr) {
+ typelib_typedescription_release(_pTypeDescr);
+ }
+ _pTypeDescr = other._pTypeDescr;
+ other._pTypeDescr = nullptr;
+ return *this;
+ }
+#endif
+
+ /** Tests whether two type descriptions are equal.
+
+ @param pTypeDescr another type description
+ @return true, if both type descriptions are equal, false otherwise
+ */
+ inline bool SAL_CALL equals( const typelib_TypeDescription * pTypeDescr ) const;
+ /** Tests whether two type descriptions are equal.
+
+ @param rTypeDescr another type description
+ @return true, if both type descriptions are equal, false otherwise
+ */
+ bool SAL_CALL equals( const TypeDescription & rTypeDescr ) const
+ { return equals( rTypeDescr._pTypeDescr ); }
+
+ /** Makes stored type description complete.
+ */
+ inline void SAL_CALL makeComplete() const;
+
+ /** Gets the UNacquired type description pointer.
+
+ @return stored pointer of type description
+ */
+ typelib_TypeDescription * SAL_CALL get() const
+ { return _pTypeDescr; }
+ /** Tests if a type description is set.
+
+ @return true, if a type description is set, false otherwise
+ */
+ bool SAL_CALL is() const
+ { return (_pTypeDescr != NULL); }
+};
+
+inline TypeDescription::TypeDescription( typelib_TypeDescription * pTypeDescr )
+ : _pTypeDescr( pTypeDescr )
+{
+ if (_pTypeDescr)
+ typelib_typedescription_acquire( _pTypeDescr );
+}
+
+inline TypeDescription::TypeDescription( typelib_TypeDescriptionReference * pTypeDescrRef )
+ : _pTypeDescr( NULL )
+{
+ if (pTypeDescrRef)
+ typelib_typedescriptionreference_getDescription( &_pTypeDescr, pTypeDescrRef );
+}
+
+inline TypeDescription::TypeDescription( const css::uno::Type & rType )
+ : _pTypeDescr( NULL )
+{
+ if (rType.getTypeLibType())
+ typelib_typedescriptionreference_getDescription( &_pTypeDescr, rType.getTypeLibType() );
+}
+
+inline TypeDescription::TypeDescription( const TypeDescription & rTypeDescr )
+ : _pTypeDescr( rTypeDescr._pTypeDescr )
+{
+ if (_pTypeDescr)
+ typelib_typedescription_acquire( _pTypeDescr );
+}
+
+inline TypeDescription::TypeDescription( rtl_uString * pTypeName )
+ : _pTypeDescr( NULL )
+{
+ typelib_typedescription_getByName( &_pTypeDescr , pTypeName );
+}
+
+inline TypeDescription::TypeDescription( const ::rtl::OUString & rTypeName )
+ : _pTypeDescr( NULL )
+{
+ typelib_typedescription_getByName( &_pTypeDescr , rTypeName.pData );
+}
+
+inline TypeDescription::~TypeDescription()
+{
+ if (_pTypeDescr)
+ typelib_typedescription_release( _pTypeDescr );
+}
+
+inline TypeDescription & TypeDescription::operator = ( typelib_TypeDescription * pTypeDescr )
+{
+ if (pTypeDescr)
+ typelib_typedescription_acquire( pTypeDescr );
+ if (_pTypeDescr)
+ typelib_typedescription_release( _pTypeDescr );
+ _pTypeDescr = pTypeDescr;
+ return *this;
+}
+
+inline bool TypeDescription::equals( const typelib_TypeDescription * pTypeDescr ) const
+{
+ return (_pTypeDescr && pTypeDescr &&
+ typelib_typedescription_equals( _pTypeDescr, pTypeDescr ));
+}
+
+inline void TypeDescription::makeComplete() const
+{
+ if (_pTypeDescr && !_pTypeDescr->bComplete)
+ ::typelib_typedescription_complete( &_pTypeDescr );
+}
+
+}
+}
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/typelib/uik.h b/include/typelib/uik.h
new file mode 100644
index 000000000..0094d1070
--- /dev/null
+++ b/include/typelib/uik.h
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_TYPELIB_UIK_H
+#define INCLUDED_TYPELIB_UIK_H
+
+#include "sal/types.h"
+
+#if defined(_WIN32)
+#pragma pack(push, 8)
+#endif
+
+/** Binary typelib uik struct. Internally not used anymore.
+
+ @deprecated
+*/
+typedef struct _typelib_Uik
+{
+ sal_uInt32 m_Data1;
+ sal_uInt16 m_Data2;
+ sal_uInt16 m_Data3;
+ sal_uInt32 m_Data4;
+ sal_uInt32 m_Data5;
+} typelib_Uik;
+
+#if defined(_WIN32)
+#pragma pack(pop)
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/activedatasink.hxx b/include/ucbhelper/activedatasink.hxx
new file mode 100644
index 000000000..391be2c91
--- /dev/null
+++ b/include/ucbhelper/activedatasink.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_ACTIVEDATASINK_HXX
+#define INCLUDED_UCBHELPER_ACTIVEDATASINK_HXX
+
+#include <config_options.h>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <cppuhelper/implbase.hxx>
+
+namespace ucbhelper
+{
+// workaround for incremental linking bugs in MSVC2015
+class SAL_DLLPUBLIC_TEMPLATE ActiveDataSink_Base
+ : public cppu::WeakImplHelper<css::io::XActiveDataSink>
+{
+};
+
+/**
+ * This class implements the interface css::io::XActiveDataSink.
+ * Instances of this class can be passed with the parameters of an
+ * "open" command.
+ */
+class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) ActiveDataSink final : public ActiveDataSink_Base
+{
+ css::uno::Reference<css::io::XInputStream> m_xStream;
+
+public:
+ // XActiveDataSink methods.
+ virtual void SAL_CALL
+ setInputStream(const css::uno::Reference<css::io::XInputStream>& aStream) override;
+
+ virtual css::uno::Reference<css::io::XInputStream> SAL_CALL getInputStream() override;
+};
+
+} /* namespace ucbhelper */
+
+#endif /* ! INCLUDED_UCBHELPER_ACTIVEDATASINK_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/authenticationfallback.hxx b/include/ucbhelper/authenticationfallback.hxx
new file mode 100644
index 000000000..a2634b060
--- /dev/null
+++ b/include/ucbhelper/authenticationfallback.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/interactionrequest.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+
+namespace ucbhelper {
+
+/**
+ * This class implements a simple authentication interaction request used
+ * when programmatically authentication cannot succeed.
+ *
+ * Read-only values : instructions, url
+ * Read-write values: code
+ */
+class UCBHELPER_DLLPUBLIC AuthenticationFallbackRequest final : public ucbhelper::InteractionRequest
+{
+private:
+ rtl::Reference< ucbhelper::InteractionAuthFallback > m_xAuthFallback;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rInstructions instructions to be followed by the user
+ * @param rURL contains a URL for which authentication is requested.
+ */
+ AuthenticationFallbackRequest( const OUString & rInstructions,
+ const OUString & rURL );
+
+ const rtl::Reference< ucbhelper::InteractionAuthFallback >&
+ getAuthFallbackInter( ) const { return m_xAuthFallback; }
+
+};
+
+} // namespace ucbhelper
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/cancelcommandexecution.hxx b/include/ucbhelper/cancelcommandexecution.hxx
new file mode 100644
index 000000000..85eba5d98
--- /dev/null
+++ b/include/ucbhelper/cancelcommandexecution.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_CANCELCOMMANDEXECUTION_HXX
+#define INCLUDED_UCBHELPER_CANCELCOMMANDEXECUTION_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/ucb/IOErrorCode.hpp>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star {
+ namespace uno { class Any; }
+ namespace ucb { class XCommandEnvironment; }
+ namespace ucb { class XCommandProcessor; }
+}
+
+namespace ucbhelper
+{
+
+
+/** Cancel the execution of a command by throwing the appropriate exception.
+ If an Interaction Handler is given with the command environment and the
+ handler handles the exception by selecting the supplied continuation,
+ then this function will put the original exception supplied into a
+ css::ucb::CommandFailedException and throw the
+ CommandFailedException. If no handler was given or the handler was not
+ able to handle the exception, then the given exception will be thrown
+ directly.
+
+ NOTE THAT THIS FUNCTION NEVER RETURNS! IT ALWAYS THROWS AN EXCEPTION!
+
+ @param rException is the exception describing the error to handle.
+
+ @param xEnv is the command environment that may contain an Interaction
+ Handler to use before throwing the appropriate exception.
+
+ @throws css::uno::Exception
+ */
+UCBHELPER_DLLPUBLIC void cancelCommandExecution( const css::uno::Any & rException,
+ const css::uno::Reference<
+ css::ucb::XCommandEnvironment > &
+ xEnv );
+
+/** Cancel the execution of a command by throwing the appropriate exception.
+ If an Interaction Handler is given with the command environment and the
+ handler handles the exception by selecting the supplied continuation,
+ then this function will put the original exception supplied into a
+ css::ucb::CommandFailedException and throw the
+ CommandFailedException. If no handler was given or the handler was not
+ able to handle the exception, then the given exception will be thrown
+ directly.
+
+ NOTE THAT THIS FUNCTION NEVER RETURNS! IT ALWAYS THROWS AN EXCEPTION!
+
+ @param eError is an IO error code.
+
+ @param rArgs is a sequence containing the arguments to pass along with
+ the exception. Each IO error code can be combined with one or
+ more additional arguments. Refer to com/sun/star/ucb/IOErroprCode.idl
+ for details.
+
+ @param xEnv is the command environment that may contain an Interaction
+ Handler to use before throwing the appropriate exception.
+
+ @param rMessage is a text containing additional error information.
+ Used as debugging aid only. Passed to the member 'Message' of the
+ uno::Exception thrown by this function.
+
+ @param xContext is the command processor executing the command to cancel.
+ Used as debugging aid only. Passed to the member 'Context' of the
+ uno::Exception thrown by this function.
+
+ @throws css::uno::Exception
+ */
+UCBHELPER_DLLPUBLIC void cancelCommandExecution( const css::ucb::IOErrorCode eError,
+ const css::uno::Sequence< css::uno::Any > & rArgs,
+ const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv,
+ const OUString & rMessage = OUString(),
+ const css::uno::Reference< css::ucb::XCommandProcessor > & xContext = nullptr );
+}
+
+#endif // INCLUDED_UCBHELPER_CANCELCOMMANDEXECUTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/commandenvironment.hxx b/include/ucbhelper/commandenvironment.hxx
new file mode 100644
index 000000000..efdc9ea66
--- /dev/null
+++ b/include/ucbhelper/commandenvironment.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_COMMANDENVIRONMENT_HXX
+#define INCLUDED_UCBHELPER_COMMANDENVIRONMENT_HXX
+
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <cppuhelper/implbase.hxx>
+#include <memory>
+
+namespace ucbhelper
+{
+struct CommandEnvironment_Impl;
+
+// workaround for incremental linking bugs in MSVC2015
+class SAL_DLLPUBLIC_TEMPLATE CommandEnvironment_Base
+ : public cppu::WeakImplHelper<css::ucb::XCommandEnvironment>
+{
+};
+
+/**
+ * This class implements the interface
+ * css::ucb::XCommandEnvironment. Instances of this class can
+ * be used to supply environments to commands executed by UCB contents.
+ */
+class UCBHELPER_DLLPUBLIC CommandEnvironment final : public CommandEnvironment_Base
+{
+ std::unique_ptr<CommandEnvironment_Impl> m_pImpl;
+
+private:
+ CommandEnvironment(const CommandEnvironment&) = delete;
+ CommandEnvironment& operator=(const CommandEnvironment&) = delete;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rxInteractionHandler is the implementation of an Interaction
+ * Handler or an empty reference.
+ * @param rxProgressHandler is the implementation of a Progress
+ * Handler or an empty reference.
+ */
+ CommandEnvironment(
+ const css::uno::Reference<css::task::XInteractionHandler>& rxInteractionHandler,
+ const css::uno::Reference<css::ucb::XProgressHandler>& rxProgressHandler);
+ /**
+ * Destructor.
+ */
+ virtual ~CommandEnvironment() override;
+
+ // XCommandEnvironment
+ virtual css::uno::Reference<css::task::XInteractionHandler>
+ SAL_CALL getInteractionHandler() override;
+
+ virtual css::uno::Reference<css::ucb::XProgressHandler> SAL_CALL getProgressHandler() override;
+};
+
+} /* namespace ucbhelper */
+
+#endif /* ! INCLUDED_UCBHELPER_COMMANDENVIRONMENT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/content.hxx b/include/ucbhelper/content.hxx
new file mode 100644
index 000000000..6f4a7b2d4
--- /dev/null
+++ b/include/ucbhelper/content.hxx
@@ -0,0 +1,680 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UCBHELPER_CONTENT_HXX
+#define INCLUDED_UCBHELPER_CONTENT_HXX
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::beans
+{
+class XPropertySetInfo;
+}
+
+namespace com::sun::star::io
+{
+class XActiveDataSink;
+class XOutputStream;
+class XInputStream;
+class XStream;
+}
+
+namespace com::sun::star::sdbc
+{
+class XResultSet;
+class XRow;
+}
+
+namespace com::sun::star::ucb
+{
+class XCommandEnvironment;
+class XCommandInfo;
+class XContent;
+class XDynamicResultSet;
+class XAnyCompareFactory;
+struct ContentInfo;
+struct NumberedSortingInfo;
+}
+
+namespace com::sun::star::uno
+{
+class XComponentContext;
+}
+
+namespace com::sun::star::uno
+{
+class Any;
+}
+
+namespace ucbhelper
+{
+/**
+ * These are the possible values for the parameter eMode of method
+ * ucbhelper::Content::createCursor.
+ */
+enum ResultSetInclude
+{
+ INCLUDE_FOLDERS_ONLY,
+ INCLUDE_DOCUMENTS_ONLY,
+ INCLUDE_FOLDERS_AND_DOCUMENTS
+};
+
+/**
+ * These are the possible values for the parameter eOperation of method
+ * ucbhelper::Content::insertNewContent.
+ */
+enum class InsertOperation
+{
+ Copy, // copy source data
+ Move, // move source data
+ Checkin // check-in source data
+};
+
+class Content_Impl;
+
+/**
+ * This class simplifies access to UCB contents by providing a more
+ * convenient API for frequently used functionality then the "raw"
+ * UCB-API does.
+ */
+class UCBHELPER_DLLPUBLIC Content final
+{
+ rtl::Reference<Content_Impl> m_xImpl;
+
+ /// @throws css::ucb::CommandAbortedException
+ /// @throws css::uno::RuntimeException,
+ /// @throws css::uno::Exception
+ css::uno::Any createCursorAny(const css::uno::Sequence<OUString>& rPropertyNames,
+ ResultSetInclude eMode);
+
+public:
+ /**
+ * Constructor.
+ */
+ Content();
+
+ /**
+ * Constructor.
+ *
+ * @param rURL is the URL of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ * @throws css::ucb::ContentCreationException
+ * @throws css::uno::RuntimeException
+ */
+ Content(const OUString& rURL, const css::uno::Reference<css::ucb::XCommandEnvironment>& rEnv,
+ const css::uno::Reference<css::uno::XComponentContext>& rCtx);
+ /**
+ * Constructor.
+ *
+ * @param rContent is the content object of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ * @throws css::ucb::ContentCreationException
+ * @throws css::uno::RuntimeException
+ */
+ Content(const css::uno::Reference<css::ucb::XContent>& rContent,
+ const css::uno::Reference<css::ucb::XCommandEnvironment>& rEnv,
+ const css::uno::Reference<css::uno::XComponentContext>& rCtx);
+ /**
+ * Copy Constructor.
+ *
+ * @param rContent is the content this content shall be a copy of.
+ */
+ Content(const Content& rOther);
+
+ /**
+ * Move constructor.
+ */
+ Content(Content&& rOther) noexcept;
+
+ /**
+ * Destructor.
+ */
+ ~Content();
+
+ /**
+ * Assignment operator.
+ *
+ * @param rContent is the content this content shall be a copy of.
+ */
+ Content& operator=(const Content& rOther);
+
+ /**
+ * Move assignment operator.
+ */
+ Content& operator=(Content&& rOther) noexcept;
+
+ /**
+ * Constructor. This method should be used, if the exception thrown
+ * by the direct ctors of this class are to 'expensive' for your
+ * application
+ *
+ * @param rURL is the URL of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ * @param rContent will be filled by this method with the content created.
+ * @return true, if the operation was successful - false, otherwise.
+ */
+ static bool create(const OUString& rURL,
+ const css::uno::Reference<css::ucb::XCommandEnvironment>& rEnv,
+ const css::uno::Reference<css::uno::XComponentContext>& rCtx,
+ Content& rContent);
+
+ // Direct access to UCB content.
+
+ /**
+ * This method provides access to the "native" UCB content interface(s).
+ * This is useful in case the convenience methods provided by this
+ * class are insufficient for your needs. You may obtain all interfaces
+ * supported by the underlying UCB content by calling this method and
+ * after that doing a queryInterface call.
+ *
+ * @return the XContent interface of the underlying UCB content.
+ */
+ css::uno::Reference<css::ucb::XContent> get() const;
+
+ // Object identity.
+
+ /**
+ * This method returns the URL of the content.
+ *
+ * @return the URL of the content.
+ */
+ const OUString& getURL() const;
+
+ // Command environment.
+
+ /**
+ * This method returns the environment to use when executing commands.
+ *
+ * @return the command environment.
+ */
+ const css::uno::Reference<css::ucb::XCommandEnvironment>& getCommandEnvironment() const;
+
+ /**
+ * This method sets a new command environment.
+ *
+ * @param xNewEnv is the new command environment.
+ */
+ void setCommandEnvironment(const css::uno::Reference<css::ucb::XCommandEnvironment>& xNewEnv);
+
+ // Access to supported commands/properties.
+
+ /**
+ * This methods provides access to meta data of the commands supported
+ * by this content.
+ *
+ * @return an XCommandInfo interface implementation, which can be used
+ * to obtain meta data of the commands supported by this content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::ucb::XCommandInfo> getCommands();
+ /**
+ * This methods provides access to meta data of the properties supported
+ * by this content.
+ *
+ * @return an XPropertSetInfo interface implementation, which can be used
+ * to obtain meta data of the properties supported by this content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::beans::XPropertySetInfo> getProperties();
+
+ // Access to property value(s).
+
+ /**
+ * This method can be used to read a single property value.
+ *
+ * @param rPropertyName is the name of the property for that the value
+ * shall be obtained.
+ * @return the property value.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Any getPropertyValue(const OUString& rPropertyName);
+ /**
+ * This method can be used to set a single property value.
+ *
+ * @param rPropertyName is the name of the property for that the
+ * value shall be set.
+ * @return an any containing:
+ * - No value indicates, that the property value was set
+ * successfully.
+ * - css::beans::UnknownPropertyException indicates,
+ * that the property is not known to the content implementation.
+ * - css::beans::IllegalTypeException indicates, that
+ * the data type of the property value is not acceptable.
+ * - css::lang::IllegalAccessException indicates, that
+ * the property is constant.
+ * - css::lang::IllegalArgumentException indicates,
+ * that the property value is not acceptable. For instance,
+ * setting an empty title may be illegal.
+ * - Any other exception derived from
+ * css::uno::Exception indicates, that the value was
+ * not set successfully. For example, this can be a
+ * com::sun:star::ucb::InteractiveAugmentedIOException
+ * transporting the error code
+ * css::ucb::IOErrorCode::ACCESS_DENIED.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Any setPropertyValue(const OUString& rPropertyName, const css::uno::Any& rValue);
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values shall be obtained.
+ * @return the property values.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Sequence<css::uno::Any>
+ getPropertyValues(const css::uno::Sequence<OUString>& rPropertyNames);
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values shall be obtained.
+ * @return the property values.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::sdbc::XRow>
+ getPropertyValuesInterface(const css::uno::Sequence<OUString>& rPropertyNames);
+
+ /**
+ * This method can be used to set multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that values shall be set.
+ * @return a sequence of any's which has exactly the same number
+ * of elements as the number of properties to set. Every
+ * sequence element contains the status for a property. The
+ * first sequence elements corresponds to the first element in
+ * the sequence of property names and so on.
+ *
+ * An any containing:
+ * - No value indicates, that the property value was set
+ * successfully.
+ * - css::beans::UnknownPropertyException indicates,
+ * that the property is not known to the content implementation.
+ * - css::beans::IllegalTypeException indicates, that
+ * the data type of the property value is not acceptable.
+ * - css::lang::IllegalAccessException indicates, that
+ * the property is constant.
+ * - css::lang::IllegalArgumentException indicates,
+ * that the property value is not acceptable. For instance,
+ * setting an empty title may be illegal.
+ * - Any other exception derived from
+ * css::uno::Exception indicates, that the value was
+ * not set successfully. For example, this can be a
+ * com::sun:star::ucb::InteractiveAugmentedIOException
+ * transporting the error code
+ * css::ucb::IOErrorCode::ACCESS_DENIED.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Sequence<css::uno::Any>
+ setPropertyValues(const css::uno::Sequence<OUString>& rPropertyNames,
+ const css::uno::Sequence<css::uno::Any>& rValues);
+
+ // General command execution.
+
+ /**
+ * This method can be used to execute any command supported by the
+ * content.
+ *
+ * @param rCommandName is the name of the command to execute.
+ * @param rCommandArgument is the argument for the command. Type and
+ * values of this parameter must correspond to the command
+ * specification.
+ * @return the result of the command according to its specification.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Any executeCommand(const OUString& rCommandName,
+ const css::uno::Any& rCommandArgument);
+
+ // Special commands.
+
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values should be accessible via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.ContentResultSet, which can be used to
+ * get access to the children of a content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::sdbc::XResultSet>
+ createCursor(const css::uno::Sequence<OUString>& rPropertyNames,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS);
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values should be accessible via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.DynamicResultSet, which can be used to
+ * get access to the children of a content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::ucb::XDynamicResultSet>
+ createDynamicCursor(const css::uno::Sequence<OUString>& rPropertyNames,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS);
+
+ /// @throws css::ucb::CommandAbortedException
+ /// @throws css::uno::RuntimeException
+ /// @throws css::uno::Exception
+ css::uno::Reference<css::sdbc::XResultSet>
+ createSortedCursor(const css::uno::Sequence<OUString>& rPropertyNames,
+ const css::uno::Sequence<css::ucb::NumberedSortingInfo>& rSortInfo,
+ const css::uno::Reference<css::ucb::XAnyCompareFactory>& rAnyCompareFactory,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS);
+
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @return an implementation of the interface XInputStream, which can
+ * be used to read the content's data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::io::XInputStream> openStream();
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ * The method requests opening without locking.
+ *
+ * @return an implementation of the interface XInputStream, which can
+ * be used to read the content's data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::io::XInputStream> openStreamNoLock();
+
+ /**
+ * This methods gives read/write access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @return an implementation of the interface XStream, which can
+ * be used to read/write the content's data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::io::XStream> openWriteableStream();
+ /**
+ * This methods gives read/write access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ * The method requests opening without locking.
+ *
+ * @return an implementation of the interface XStream, which can
+ * be used to read/write the content's data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Reference<css::io::XStream> openWriteableStreamNoLock();
+
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rSink is the implementation of an XActiveDataSink interface,
+ * which shall be used by the content to deliver the data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ bool openStream(const css::uno::Reference<css::io::XActiveDataSink>& rSink);
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rStream is the implementation of an XOutputStream interface,
+ * which shall be used by the content to deliver the data.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ bool openStream(const css::uno::Reference<css::io::XOutputStream>& rStream);
+ /**
+ * This methods gives write access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "insert" at the content.
+ *
+ * @param rStream is the implementation of an XInputStream interface,
+ * which contains the content data to write.
+ * @param bReplaceExisting specifies, whether any existing content data
+ * shall be overwritten.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ void writeStream(const css::uno::Reference<css::io::XInputStream>& rStream,
+ bool bReplaceExisting);
+
+ /**
+ * This method returns the different types of contents this content
+ * can create.
+ *
+ * @return the content types or an empty sequence if no contents can be
+ * created by this content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ css::uno::Sequence<css::ucb::ContentInfo> queryCreatableContentsInfo();
+
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a
+ * XCommandProcessor::execute( "createNewContent", ... );
+ * XCommandProcessor::execute( "setPropertyValues", ... );
+ * XCommandProcessor::execute( "insert", ... ); calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its content
+ * objects (See queryCreatableContentsInfo()).
+ * @param rPropertyNames is a sequence of names of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( committed ).
+ * The order of the names must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( committed ).
+ * The order of the values must correspond to the order of the
+ * property names.
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ bool insertNewContent(const OUString& rContentType,
+ const css::uno::Sequence<OUString>& rPropertyNames,
+ const css::uno::Sequence<css::uno::Any>& rPropertyValues,
+ Content& rNewContent);
+ /**
+ * This method creates, initializes and inserts (commits) a new content
+ * inside this (the target folder) content. For example, it can be used to
+ * create a new file system file.
+ * Internally this method does a
+ * XCommandProcessor::execute( "createNewContent", ... );
+ * XCommandProcessor::execute( "setPropertyValues", ... );
+ * XCommandProcessor::execute( "insert", ... ); calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its content
+ * objects (See queryCreatableContentsInfo()).
+ * @param rPropertyNames is a sequence of names of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( committed ).
+ * The order of the names must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( committed ).
+ * The order of the values must correspond to the order of the
+ * property names.
+ * @param rStream is a stream containing the content data for the new
+ * content (i.e. the content of a file to create)
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ bool insertNewContent(const OUString& rContentType,
+ const css::uno::Sequence<OUString>& rPropertyNames,
+ const css::uno::Sequence<css::uno::Any>& rPropertyValues,
+ const css::uno::Reference<css::io::XInputStream>& rStream,
+ Content& rNewContent);
+
+ /**
+ * This method transfers (copies/moves) a content. It creates a new
+ * resource inside this (the target folder) content.
+ * The implementation is able to do cross-provider transfers (like copying
+ * a file from the local file system to a directory located on an HTTP
+ * server).
+ * Internally this method executes the command "globalTransfer" at the UCB.
+ *
+ * @param rSourceContent is the content that contains the data for the
+ * new UCB content.
+ * @param eOperation defines what shall be done with the source data
+ * ( COPY, MOVE, LINK ).
+ * @param rTitle contains a title for the new content. If this is an empty
+ * string, the new content will have the same title as the source
+ * content.
+ * @param rNameClashAction describes how the implementation shall behave
+ * in case a content with a clashing name exists in the target
+ * folder.
+ * NameClash::ERROR will abort the operation, NameClash::OVERWRITE
+ * will overwrite the clashing content and all its data,
+ * NameClash::RENAME will generate and supply a non-clashing title.
+ * @see com/sun/star/ucb/NameClash.idl
+ * @param rMimeType contains the MIME type of the document to write.
+ * @param bMajorVersion tells to create a new major version for checkin operations
+ * @param rCommentVersion contains the comment to use for checkin operations
+ * @param rResultURL is a hacky way to get the update URL after the operation in
+ * case there was a change (introduced for the checkin operation)
+ * @param rDocumentId is the document Id ( in case of CMIS ).
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ void transferContent(const Content& rSourceContent, InsertOperation eOperation,
+ const OUString& rTitle, const sal_Int32 nNameClashAction,
+ const OUString& rMimeType = OUString(), bool bMajorVersion = false,
+ const OUString& rCommentVersion = OUString(),
+ OUString* pResultURL = nullptr,
+ const OUString& rDocumentId = OUString()) const;
+
+ /**
+ * This method lock the resource.
+ *
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ void lock();
+
+ /**
+ * This method unlock the resource.
+ *
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ void unlock();
+
+ // Required properties.
+
+ /**
+ * This method returns the value of the content's property "IsFolder".
+ *
+ * @return true, if the content is a folder ( it can contain other
+ * UCB contents). false, otherwise.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ bool isFolder();
+ /**
+ * This method returns the value of the content's property "IsDocument".
+ *
+ * @return true, if the content is a document ( it has a content stream ).
+ * false, otherwise.
+ * @throws css::ucb::CommandAbortedException
+ * @throws css::uno::RuntimeException
+ * @throws css::uno::Exception
+ */
+ bool isDocument();
+};
+
+} /* namespace ucbhelper */
+
+#endif /* ! INCLUDED_UCBHELPER_CONTENT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/contenthelper.hxx b/include/ucbhelper/contenthelper.hxx
new file mode 100644
index 000000000..3f269e475
--- /dev/null
+++ b/include/ucbhelper/contenthelper.hxx
@@ -0,0 +1,448 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_CONTENTHELPER_HXX
+#define INCLUDED_UCBHELPER_CONTENTHELPER_HXX
+
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
+#include <com/sun/star/ucb/XCommandInfoChangeNotifier.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/weak.hxx>
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <memory>
+
+namespace com::sun::star::ucb {
+ struct CommandInfo;
+ class XCommandEnvironment;
+ class XCommandInfo;
+ class XPersistentPropertySet;
+}
+
+namespace com::sun::star::beans {
+ struct Property;
+ class XPropertySetInfo;
+}
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace ucbhelper_impl { struct ContentImplHelper_Impl; }
+
+namespace ucbhelper
+{
+
+
+class ContentProviderImplHelper;
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.Content. Implementations derived from this class are
+ * objects provided by implementations derived from
+ * class ucb::ContentProviderImplHelper.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - all required interfaces for service css::ucb::Content
+ * - all required listener containers
+ * ( XComponent, XPropertiesChangeNotifier, XPropertySetInfoChangeNotifier,
+ * XCommandInfoChangeNotifier )
+ * - XPropertyContainer implementation ( persistence is implemented using
+ * service com.sun.star.ucb.Store )
+ * - complete XPropertySetInfo implementation ( including Additional Core
+ * Properties supplied via XPropertyContainer interface )
+ * -> protected method: getPropertySetInfo
+ * - complete XCommandInfo implementation
+ * -> protected method: getCommandInfo
+ */
+class UCBHELPER_DLLPUBLIC ContentImplHelper :
+ public cppu::OWeakObject,
+ public css::lang::XTypeProvider,
+ public css::lang::XServiceInfo,
+ public css::lang::XComponent,
+ public css::ucb::XContent,
+ public css::ucb::XCommandProcessor,
+ public css::beans::XPropertiesChangeNotifier,
+ public css::beans::XPropertyContainer,
+ public css::beans::XPropertySetInfoChangeNotifier,
+ public css::ucb::XCommandInfoChangeNotifier,
+ public css::container::XChild
+{
+ friend class PropertySetInfo;
+ friend class CommandProcessorInfo;
+
+ std::unique_ptr<ucbhelper_impl::ContentImplHelper_Impl> m_pImpl;
+
+protected:
+ osl::Mutex m_aMutex;
+ css::uno::Reference< css::uno::XComponentContext >
+ m_xContext;
+ css::uno::Reference< css::ucb::XContentIdentifier >
+ m_xIdentifier;
+ rtl::Reference< ContentProviderImplHelper >
+ m_xProvider;
+ sal_uInt32 m_nCommandId;
+
+private:
+ /**
+ * Your implementation of this method must return a sequence containing
+ * the meta data of the properties supported by the content.
+ * Note: If you wish to provide your own implementation of the interface
+ * XPropertyContainer ( completely override addContent and removeContent
+ * implementation of this base class in this case ), you can supply the
+ * meta data for your Additional Core Properties here to get a fully
+ * featured getPropertySetInfo method ( see below ).
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @return a sequence containing the property meta data.
+ */
+ UCBHELPER_DLLPRIVATE
+ virtual css::uno::Sequence< css::beans::Property >
+ getProperties( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) = 0;
+
+ /**
+ * Your implementation of this method must return a sequence containing
+ * the meta data of the commands supported by the content.
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @return a sequence containing the command meta data.
+ */
+ UCBHELPER_DLLPRIVATE
+ virtual css::uno::Sequence< css::ucb::CommandInfo >
+ getCommands( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) = 0;
+
+ /**
+ * The implementation of this method shall return the URL of the parent
+ * of your content.
+ *
+ * @return the URL of the parent content or an empty string.
+ * Note that not all contents must have one parent. There may
+ * be contents with no parent. In that case an empty string must
+ * be returned. If your content has more than one parent you may
+ * return the URL of one "preferred" parent or an empty string.
+ */
+ UCBHELPER_DLLPRIVATE virtual OUString getParentURL() = 0;
+
+protected:
+ /**
+ * This method returns complete meta data for the properties ( including
+ * Additional Core Properties supplied via XPropertyContainer interface )
+ * supported by the content. To implement the required command
+ * "getPropertySetInfo" simply return the return value of this method.
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @param bCache indicates, whether the implementation should use
+ * cached data, if exist.
+ * @return an XPropertySetInfo implementation object containing meta data
+ * for the properties supported by this content.
+ */
+ css::uno::Reference< css::beans::XPropertySetInfo >
+ getPropertySetInfo( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv,
+ bool bCache = true );
+
+ /**
+ * This method returns complete meta data for the commands supported by
+ * the content. To implement the required command "getCommandInfo" simply
+ * return the return value of this method.
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @param bCache indicates, whether the implementation should use
+ * cached data, if exist.
+ * @return an XCommandInfo implementation object containing meta data
+ * for the commands supported by this content.
+ */
+ css::uno::Reference< css::ucb::XCommandInfo >
+ getCommandInfo( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv,
+ bool bCache = true );
+
+ /**
+ * This method can be used to propagate changes of property values.
+ *
+ * @param evt is a sequence of property change events.
+ */
+ void notifyPropertiesChange(
+ const css::uno::Sequence< css::beans::PropertyChangeEvent >& evt ) const;
+
+ /**
+ * This method can be used to propagate changes of the propertyset
+ * info of your content (i.e. this happens if a new property is added
+ * to your content via its XPropertyContainer interface). This base class
+ * automatically generates events when the propertyset info changes. If
+ * you provide your own implementations of addproperty and removeProperty,
+ * then you must call "notifyPropertySetInfoChange" by yourself.
+ *
+ * @param evt is a sequence of property change events.
+ */
+ void notifyPropertySetInfoChange(
+ const css::beans::PropertySetInfoChangeEvent& evt ) const;
+
+ /**
+ * This method can be used to propagate content events.
+ *
+ * @param evt is a sequence of content events.
+ */
+ void notifyContentEvent(
+ const css::ucb::ContentEvent& evt ) const;
+
+ /**
+ * Use this method to announce the insertion of this content at
+ * the end of your implementation of the command "insert". The
+ * implementation of is method propagates a ContentEvent( INSERTED ).
+ */
+ void inserted();
+
+ /**
+ * Use this method to announce the destruction of this content at
+ * the end of your implementation of the command "delete". The
+ * implementation of is method propagates a ContentEvent( DELETED )
+ * and a ContentEvent( REMOVED ) at the parent of the deleted content,
+ * if a parent exists.
+ */
+ void deleted();
+
+ /**
+ * Use this method to change the identity of a content. The implementation
+ * of this method will replace the content identifier of the content and
+ * propagate the appropriate ContentEvent( EXCHANGED ).
+ *
+ * @param rNewId is the new content identifier for the content.
+ * @return a success indicator.
+ */
+ bool exchange( const css::uno::Reference< css::ucb::XContentIdentifier >& rNewId );
+
+ /**
+ * Use this method to get access to the Additional Core Properties of
+ * the content ( added using content's XPropertyContainer interface ).
+ * If you supply your own XPropertyContainer implementation, this method
+ * will always return an empty propertyset.
+ *
+ * @param bCreate indicates whether a new propertyset shall be created
+ * if it does not exist.
+ * @return the implementation of the service
+ * com.sun.star.ucb.PersistentPropertySet.
+ */
+ css::uno::Reference< css::ucb::XPersistentPropertySet >
+ getAdditionalPropertySet( bool bCreate );
+
+ /**
+ * This method renames the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * @param rOldKey is the old key of the propertyset.
+ * @param rNewKey is the new key for the propertyset.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool renameAdditionalPropertySet( const OUString& rOldKey,
+ const OUString& rNewKey );
+
+ /**
+ * This method copies the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * @param rSourceKey is the key of the source propertyset.
+ * @param rTargetKey is the key of the target propertyset.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool copyAdditionalPropertySet( const OUString& rSourceKey,
+ const OUString& rTargetKey );
+
+ /**
+ * This method removes the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * Propertysets for children described by rOldKey are removed too.
+ *
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool removeAdditionalPropertySet();
+
+public:
+ /**
+ * Constructor.
+ *
+ * Note that the implementation of this ctor registers itself at its
+ * content provider. The provider implementation inserts the content
+ * in a hash map. So it easily can be found and reused when the provider
+ * is asked for a content.
+ *
+ * @param rxContext is a Service Manager.
+ * @param rxProvider is the provider for the content.
+ * @param Identifier is the content identifier for the content.
+ */
+ ContentImplHelper(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const rtl::Reference< ContentProviderImplHelper >& rxProvider,
+ const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier );
+
+ /**
+ * Destructor.
+ *
+ * Note that the implementation of this dtor deregisters itself from its
+ * content provider. The provider implementation removes the content
+ * from a hash map.
+ */
+ virtual ~ContentImplHelper() override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { cppu::OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL
+ getImplementationName() override = 0;
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames() override = 0;
+
+ // XComponent
+ virtual void SAL_CALL
+ dispose() override;
+ virtual void SAL_CALL
+ addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+ virtual void SAL_CALL
+ removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+
+ // XContent
+ virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
+ getIdentifier() override;
+ virtual OUString SAL_CALL
+ getContentType() override = 0;
+ virtual void SAL_CALL
+ addContentEventListener(
+ const css::uno::Reference< css::ucb::XContentEventListener >& Listener ) override;
+ virtual void SAL_CALL
+ removeContentEventListener(
+ const css::uno::Reference< css::ucb::XContentEventListener >& Listener ) override;
+
+ // XCommandProcessor
+ virtual sal_Int32 SAL_CALL
+ createCommandIdentifier() override;
+ virtual css::uno::Any SAL_CALL
+ execute( const css::ucb::Command& aCommand,
+ sal_Int32 CommandId,
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& Environment ) override = 0;
+ virtual void SAL_CALL
+ abort( sal_Int32 CommandId ) override = 0;
+
+ // XPropertiesChangeNotifier
+ virtual void SAL_CALL
+ addPropertiesChangeListener(
+ const css::uno::Sequence< OUString >& PropertyNames,
+ const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) override;
+ virtual void SAL_CALL
+ removePropertiesChangeListener(
+ const css::uno::Sequence< OUString >& PropertyNames,
+ const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) override;
+
+ // XCommandInfoChangeNotifier
+ virtual void SAL_CALL
+ addCommandInfoChangeListener(
+ const css::uno::Reference< css::ucb::XCommandInfoChangeListener >& Listener ) override;
+ virtual void SAL_CALL
+ removeCommandInfoChangeListener(
+ const css::uno::Reference< css::ucb::XCommandInfoChangeListener >& Listener ) override;
+
+ // XPropertyContainer
+
+ /**
+ * This method adds a property to the content according to the interface
+ * specification. The properties will be stored using the service
+ * com.sun.star.ucb.Store.
+ *
+ * Note: You may provide your own implementation of this method, for
+ * instance, if your data source supports adding/removing of properties.
+ * Don't forget to return the meta data for these properties in your
+ * implementation of getPropertyInfoTable.
+ */
+ virtual void SAL_CALL
+ addProperty( const OUString& Name,
+ sal_Int16 Attributes,
+ const css::uno::Any& DefaultValue ) override;
+
+ /**
+ * This method removes a property from the content according to the
+ * interface specification. The properties will be stored using the
+ * service com.sun.star.ucb.Store.
+ *
+ * Note: You may provide your own implementation of this method, for
+ * instance, if your data source supports adding/removing of properties.
+ * Don't forget to return the meta data for these properties in your
+ * implementation of getPropertyInfoTable.
+ */
+ virtual void SAL_CALL
+ removeProperty( const OUString& Name ) override;
+
+ // XPropertySetInfoChangeNotifier
+ virtual void SAL_CALL
+ addPropertySetInfoChangeListener(
+ const css::uno::Reference< css::beans::XPropertySetInfoChangeListener >& Listener ) override;
+ virtual void SAL_CALL
+ removePropertySetInfoChangeListener(
+ const css::uno::Reference< css::beans::XPropertySetInfoChangeListener >& Listener ) override;
+
+ // XChild
+
+ /**
+ * This method returns the content representing the parent of a content,
+ * if such a parent exists. The implementation of this method uses your
+ * implementation of getParentURL.
+ */
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
+ getParent() override;
+
+ /**
+ * The implementation of this method always throws a NoSupportException.
+ */
+ virtual void SAL_CALL
+ setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
+
+
+ // Non-interface methods.
+
+
+ /**
+ * This method returns the provider of the content.
+ *
+ * @return the provider of the content.
+ */
+ const rtl::Reference< ContentProviderImplHelper >& getProvider() const
+ { return m_xProvider; }
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_CONTENTHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/contentidentifier.hxx b/include/ucbhelper/contentidentifier.hxx
new file mode 100644
index 000000000..9b538829f
--- /dev/null
+++ b/include/ucbhelper/contentidentifier.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_CONTENTIDENTIFIER_HXX
+#define INCLUDED_UCBHELPER_CONTENTIDENTIFIER_HXX
+
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/ucb/XContentIdentifier.hpp>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <memory>
+
+namespace ucbhelper
+{
+struct ContentIdentifier_Impl;
+
+/**
+ * This class implements a simple identifier object for UCB contents.
+ * It mainly stores and returns the URL as it was passed to the constructor -
+ * The only difference is that the URL scheme will be lower cased. This can
+ * be done, because URL schemes are never case sensitive.
+ */
+class UCBHELPER_DLLPUBLIC ContentIdentifier final
+ : public cppu::WeakImplHelper<css::ucb::XContentIdentifier>
+{
+public:
+ ContentIdentifier(const OUString& rURL);
+ virtual ~ContentIdentifier() override;
+
+ // XContentIdentifier
+ virtual OUString SAL_CALL getContentIdentifier() override;
+ virtual OUString SAL_CALL getContentProviderScheme() override;
+
+private:
+ std::unique_ptr<ContentIdentifier_Impl> m_pImpl;
+};
+
+} /* namespace ucbhelper */
+
+#endif /* ! INCLUDED_UCBHELPER_CONTENTIDENTIFIER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/fd_inputstream.hxx b/include/ucbhelper/fd_inputstream.hxx
new file mode 100644
index 000000000..ebef7dae7
--- /dev/null
+++ b/include/ucbhelper/fd_inputstream.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_FD_INPUTSTREAM_HXX
+#define INCLUDED_UCBHELPER_FD_INPUTSTREAM_HXX
+
+#include <osl/file.h>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace ucbhelper
+{
+ typedef cppu::WeakImplHelper<
+ css::io::XInputStream,
+ css::io::XSeekable > FdInputStream_Base;
+
+ /** Implements a seekable InputStream
+ * working on a buffer.
+ */
+ class UCBHELPER_DLLPUBLIC FdInputStream final
+ : protected cppu::BaseMutex,
+ public FdInputStream_Base
+ {
+ public:
+
+ /** Defines the storage kind found
+ * on which the inputstream acts.
+ */
+ FdInputStream(oslFileHandle tmpfl);
+
+ virtual ~FdInputStream() override;
+
+ virtual sal_Int32 SAL_CALL
+ readBytes(css::uno::Sequence< sal_Int8 >& aData,
+ sal_Int32 nBytesToRead) override;
+
+ virtual sal_Int32 SAL_CALL
+ readSomeBytes(css::uno::Sequence< sal_Int8 >& aData,
+ sal_Int32 nMaxBytesToRead ) override;
+
+ virtual void SAL_CALL
+ skipBytes(sal_Int32 nBytesToSkip) override;
+
+ virtual sal_Int32 SAL_CALL
+ available() override;
+
+ virtual void SAL_CALL
+ closeInput() override;
+
+
+ /** XSeekable
+ */
+
+ virtual void SAL_CALL
+ seek(sal_Int64 location) override;
+
+
+ virtual sal_Int64 SAL_CALL
+ getPosition() override;
+
+
+ virtual sal_Int64 SAL_CALL
+ getLength() override;
+
+ private:
+ oslFileHandle m_tmpfl;
+ sal_uInt64 m_nLength;
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/interactionrequest.hxx b/include/ucbhelper/interactionrequest.hxx
new file mode 100644
index 000000000..78fc31f7a
--- /dev/null
+++ b/include/ucbhelper/interactionrequest.hxx
@@ -0,0 +1,547 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX
+#define INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX
+
+#include <config_options.h>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionDisapprove.hpp>
+#include <com/sun/star/ucb/XInteractionAuthFallback.hpp>
+#include <com/sun/star/ucb/XInteractionReplaceExistingData.hpp>
+#include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <memory>
+
+namespace rtl { template <class reference_type> class Reference; }
+
+namespace ucbhelper {
+
+class InteractionContinuation;
+
+
+struct InteractionRequest_Impl;
+
+/**
+ * This class implements the interface XInteractionRequest. Instances can
+ * be passed directly to XInteractionHandler::handle(...). Each interaction
+ * request contains an exception describing the error and a number of
+ * interaction continuations describing the possible "answers" for the request.
+ * After the request was passed to XInteractionHandler::handle(...) the method
+ * getSelection() returns the continuation chosen by the interaction handler.
+ *
+ * The typical usage of this class would be:
+ *
+ * 1) Create exception object that shall be handled by the interaction handler.
+ * 2) Create InteractionRequest, supply exception as ctor parameter
+ * 3) Create continuations needed and add them to a sequence
+ * 4) Supply the continuations to the InteractionRequest by calling
+ * setContinuations(...)
+ *
+ * This class can also be used as base class for more specialized requests,
+ * like authentication requests.
+ */
+class UCBHELPER_DLLPUBLIC InteractionRequest :
+ public cppu::WeakImplHelper<css::task::XInteractionRequest>
+{
+ std::unique_ptr<InteractionRequest_Impl> m_pImpl;
+
+protected:
+ void setRequest( const css::uno::Any & rRequest );
+
+ InteractionRequest();
+ virtual ~InteractionRequest() override;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rRequest is the exception describing the error.
+ */
+ InteractionRequest( const css::uno::Any & rRequest );
+
+ /**
+ * This method sets the continuations for the request.
+ *
+ * @param rContinuations contains the possible continuations.
+ */
+ void setContinuations(
+ const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > & rContinuations );
+
+ // XInteractionRequest
+ virtual css::uno::Any SAL_CALL
+ getRequest() override;
+ virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL
+ getContinuations() override;
+
+ // Non-interface methods.
+
+ /**
+ * After passing this request to XInteractionHandler::handle, this method
+ * returns the continuation that was chosen by the interaction handler.
+ *
+ * @return the continuation chosen by an interaction handler or an empty
+ * reference, if the request was not (yet) handled.
+ */
+ rtl::Reference< InteractionContinuation > const & getSelection() const;
+
+ /**
+ * This method sets a continuation for the request. It also can be used
+ * to reset the continuation set by a previous XInteractionHandler::handle
+ * call in order to use this request object more than once.
+ *
+ * @param rxSelection is the interaction continuation to activate for
+ * the request or an empty reference in order to reset the
+ * current selection.
+ */
+ void
+ setSelection(
+ const rtl::Reference< InteractionContinuation > & rxSelection );
+};
+
+
+/**
+ * This class is the base for implementations of the interface
+ * XInteractionContinuation. Classes derived from this bas class work together
+ * with class InteractionRequest.
+ *
+ * Derived classes must implement their XInteractionContinuation::select()
+ * method the way that they simply call recordSelection() which is provided by
+ * this class.
+ */
+class UCBHELPER_DLLPUBLIC InteractionContinuation : public cppu::OWeakObject
+{
+ InteractionRequest* m_pRequest;
+
+protected:
+ /**
+ * This method marks this continuation as "selected" at the request it
+ * belongs to.
+ *
+ * Derived classes must implement their XInteractionContinuation::select()
+ * method the way that they call this method.
+ */
+ void recordSelection();
+ virtual ~InteractionContinuation() override;
+
+public:
+ InteractionContinuation( InteractionRequest * pRequest );
+};
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionAbort. Instances of this class can be passed
+ * along with an interaction request to indicate the possibility to abort
+ * the operation that caused the request.
+ */
+class UCBHELPER_DLLPUBLIC InteractionAbort final : public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::task::XInteractionAbort
+{
+public:
+ InteractionAbort( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+};
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionRetry. Instances of this class can be passed
+ * along with an interaction request to indicate the possibility to retry
+ * the operation that caused the request.
+ */
+class UCBHELPER_DLLPUBLIC InteractionRetry final : public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::task::XInteractionRetry
+{
+public:
+ InteractionRetry( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+};
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionApprove. Instances of this class can be passed
+ * along with an interaction request to indicate the possibility to approve
+ * the request.
+ */
+class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) InteractionApprove final : public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::task::XInteractionApprove
+{
+public:
+ InteractionApprove( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+};
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionDisapprove. Instances of this class can be passed
+ * along with an interaction request to indicate the possibility to disapprove
+ * the request.
+ */
+class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) InteractionDisapprove final : public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::task::XInteractionDisapprove
+{
+public:
+ InteractionDisapprove( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+};
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionSupplyAuthentication. Instances of this class can be
+ * passed along with an authentication interaction request to enable the
+ * interaction handler to supply the missing authentication data.
+ */
+class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) InteractionSupplyAuthentication final :
+ public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::ucb::XInteractionSupplyAuthentication2
+{
+ css::uno::Sequence< css::ucb::RememberAuthentication >
+ m_aRememberPasswordModes;
+ css::uno::Sequence< css::ucb::RememberAuthentication >
+ m_aRememberAccountModes;
+ OUString m_aRealm;
+ OUString m_aUserName;
+ OUString m_aPassword;
+ css::ucb::RememberAuthentication m_eRememberPasswordMode;
+ css::ucb::RememberAuthentication m_eDefaultRememberPasswordMode;
+ css::ucb::RememberAuthentication m_eDefaultRememberAccountMode;
+ bool m_bCanSetRealm : 1;
+ bool m_bCanSetUserName : 1;
+ bool m_bCanSetPassword : 1;
+ bool m_bCanSetAccount : 1;
+ bool m_bCanUseSystemCredentials : 1;
+ bool m_bUseSystemCredentials : 1;
+
+public:
+ /**
+ * Constructor.
+ *
+ * Note: The remember-authentication stuff is interesting only for
+ * clients implementing own password storage functionality.
+ *
+ * @param rxRequest is the interaction request that owns this continuation.
+ * @param bCanSetRealm indicates, whether the realm given with the
+ * authentication request is read-only.
+ * @param bCanSetUserName indicates, whether the username given with the
+ * authentication request is read-only.
+ * @param bCanSetPassword indicates, whether the password given with the
+ * authentication request is read-only.
+ * @param bCanSetAccount indicates, whether the account given with the
+ * authentication request is read-only.
+ * @param rRememberPasswordModes specifies the authentication-remember-
+ * modes for passwords supported by the requesting client.
+ * @param eDefaultRememberPasswordMode specifies the default
+ * authentication-remember-mode for passwords preferred by the
+ * requesting client.
+ * @param rRememberAccountModes specifies the authentication-remember-
+ * modes for accounts supported by the requesting client.
+ * @param eDefaultRememberAccountMode specifies the default
+ * authentication-remember-mode for accounts preferred by the
+ * requesting client.
+ * @param bCanUseSystemCredentials indicates whether issuer of the
+ * authentication request can obtain and use system credentials
+ * for authentication.
+ *
+ * @see css::ucb::AuthenticationRequest
+ * @see css::ucb::RememberAuthentication
+ */
+ inline InteractionSupplyAuthentication(
+ InteractionRequest * pRequest,
+ bool bCanSetRealm,
+ bool bCanSetUserName,
+ bool bCanSetPassword,
+ bool bCanSetAccount,
+ const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberPasswordModes,
+ const css::ucb::RememberAuthentication eDefaultRememberPasswordMode,
+ const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberAccountModes,
+ const css::ucb::RememberAuthentication eDefaultRememberAccountMode,
+ bool bCanUseSystemCredentials );
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+
+ // XInteractionSupplyAuthentication
+ virtual sal_Bool SAL_CALL
+ canSetRealm() override;
+ virtual void SAL_CALL
+ setRealm( const OUString& Realm ) override;
+
+ virtual sal_Bool SAL_CALL
+ canSetUserName() override;
+ virtual void SAL_CALL
+ setUserName( const OUString& UserName ) override;
+
+ virtual sal_Bool SAL_CALL
+ canSetPassword() override;
+ virtual void SAL_CALL
+ setPassword( const OUString& Password ) override;
+
+ virtual css::uno::Sequence<
+ css::ucb::RememberAuthentication > SAL_CALL
+ getRememberPasswordModes(
+ css::ucb::RememberAuthentication& Default ) override;
+ virtual void SAL_CALL
+ setRememberPassword( css::ucb::RememberAuthentication Remember ) override;
+
+ virtual sal_Bool SAL_CALL
+ canSetAccount() override;
+ virtual void SAL_CALL
+ setAccount( const OUString& Account ) override;
+
+ virtual css::uno::Sequence< css::ucb::RememberAuthentication > SAL_CALL
+ getRememberAccountModes(
+ css::ucb::RememberAuthentication& Default ) override;
+ virtual void SAL_CALL
+ setRememberAccount( css::ucb::RememberAuthentication Remember ) override;
+
+ // XInteractionSupplyAuthentication2
+ virtual sal_Bool SAL_CALL canUseSystemCredentials( sal_Bool& Default ) override;
+ virtual void SAL_CALL setUseSystemCredentials( sal_Bool UseSystemCredentials ) override;
+
+ // Non-interface methods.
+
+ /**
+ * This method returns the realm that was supplied by the interaction
+ * handler.
+ *
+ * @return the realm.
+ */
+ const OUString & getRealm() const { return m_aRealm; }
+
+ /**
+ * This method returns the username that was supplied by the interaction
+ * handler.
+ *
+ * @return the username.
+ */
+ const OUString & getUserName() const { return m_aUserName; }
+
+ /**
+ * This method returns the password that was supplied by the interaction
+ * handler.
+ *
+ * @return the password.
+ */
+ const OUString & getPassword() const { return m_aPassword; }
+
+ /**
+ * This method returns the authentication remember-mode for the password
+ * that was supplied by the interaction handler.
+ *
+ * @return the remember-mode for the password.
+ */
+ const css::ucb::RememberAuthentication &
+ getRememberPasswordMode() const { return m_eRememberPasswordMode; }
+
+ bool getUseSystemCredentials() const { return m_bUseSystemCredentials; }
+};
+
+
+
+inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
+ InteractionRequest * pRequest,
+ bool bCanSetRealm,
+ bool bCanSetUserName,
+ bool bCanSetPassword,
+ bool bCanSetAccount,
+ const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberPasswordModes,
+ const css::ucb::RememberAuthentication eDefaultRememberPasswordMode,
+ const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberAccountModes,
+ const css::ucb::RememberAuthentication eDefaultRememberAccountMode,
+ bool bCanUseSystemCredentials )
+: InteractionContinuation( pRequest ),
+ m_aRememberPasswordModes( rRememberPasswordModes ),
+ m_aRememberAccountModes( rRememberAccountModes ),
+ m_eRememberPasswordMode( eDefaultRememberPasswordMode ),
+ m_eDefaultRememberPasswordMode( eDefaultRememberPasswordMode ),
+ m_eDefaultRememberAccountMode( eDefaultRememberAccountMode ),
+ m_bCanSetRealm( bCanSetRealm ),
+ m_bCanSetUserName( bCanSetUserName ),
+ m_bCanSetPassword( bCanSetPassword ),
+ m_bCanSetAccount( bCanSetAccount ),
+ m_bCanUseSystemCredentials( bCanUseSystemCredentials ),
+ m_bUseSystemCredentials( false )
+{
+}
+
+
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionReplaceExistingData. Instances of this class can be
+ * passed along with an interaction request to indicate the possibility to
+ * replace existing data.
+ */
+class InteractionReplaceExistingData final :
+ public InteractionContinuation,
+ public css::lang::XTypeProvider,
+ public css::ucb::XInteractionReplaceExistingData
+{
+public:
+ InteractionReplaceExistingData( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL
+ getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() override;
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+};
+
+class UCBHELPER_DLLPUBLIC InteractionAuthFallback final :
+ public InteractionContinuation,
+ public css::ucb::XInteractionAuthFallback
+{
+ OUString m_aCode;
+
+public:
+ InteractionAuthFallback( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL
+ queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept override
+ { OWeakObject::release(); }
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select() override;
+
+ // XAuthFallback
+ virtual void SAL_CALL setCode( const OUString& code ) override;
+ /// @throws css::uno::RuntimeException
+ const OUString& getCode() const;
+
+
+};
+
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/interceptedinteraction.hxx b/include/ucbhelper/interceptedinteraction.hxx
new file mode 100644
index 000000000..78344c319
--- /dev/null
+++ b/include/ucbhelper/interceptedinteraction.hxx
@@ -0,0 +1,281 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_INTERCEPTEDINTERACTION_HXX
+#define INCLUDED_UCBHELPER_INTERCEPTEDINTERACTION_HXX
+
+#include <vector>
+
+#include <com/sun/star/task/XInteractionHandler.hpp>
+
+#include <cppuhelper/implbase.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::task { class XInteractionRequest; }
+
+
+namespace ucbhelper{
+
+
+/** @short it wraps any other interaction handler and intercept
+ its handle() requests.
+
+ @descr This class can be used as:
+ - instance if special interactions must be suppressed
+ only
+ - or as base class if interactions must be modified.
+ */
+// extra struct to work around MSVC linking issue
+struct InterceptedInteraction_Base : public ::cppu::WeakImplHelper< css::task::XInteractionHandler > {};
+
+class UCBHELPER_DLLPUBLIC InterceptedInteraction : public InterceptedInteraction_Base
+{
+
+ // types
+ public:
+
+ struct InterceptedRequest
+ {
+
+ /** @short marks an Handle as invalid.
+ */
+ static const sal_Int32 INVALID_HANDLE = -1;
+
+
+ /** @short contains the interaction request, which should be intercepted. */
+ css::uno::Any Request;
+
+
+ /** @short specify the fix continuation, which must be selected, if the
+ interaction could be intercepted successfully.
+ */
+ css::uno::Type Continuation;
+
+
+ /** @short it's a unique identifier, which must be managed by the outside code.
+
+ @descr If there is a derived class, which overwrites the InterceptedInteraction::intercepted()
+ method, it will be called with a reference to an InterceptedRequest struct.
+ Then it can use the handle to react without checking the request type again.
+ */
+ sal_Int32 Handle;
+
+
+ /** @short default ctor.
+
+ @descr Such constructed object can't be used really.
+ Might it will crash if it's used!
+ Don't forget to initialize all(!) members...
+ */
+ InterceptedRequest()
+ {
+ Handle = INVALID_HANDLE;
+ }
+ InterceptedRequest(css::uno::Any Request_, css::uno::Type Continuation_, sal_Int32 Handle_)
+ : Request(std::move(Request_)), Continuation(std::move(Continuation_)), Handle(Handle_)
+ {
+ }
+
+ };
+
+
+ /** @short represent the different states, which can occur
+ as result of an interception.
+
+ @see impl_interceptRequest()
+ */
+ enum EInterceptionState
+ {
+ /** none of the specified interceptions match the incoming request */
+ E_NOT_INTERCEPTED,
+ /** the request could be intercepted - but the specified continuation could not be located.
+ That's normally an error of the programmer. May be the interaction request does not use
+ the right set of continuations ... or the interception list contains the wrong continuation. */
+ E_NO_CONTINUATION_FOUND,
+ /** the request could be intercepted and the specified continuation could be selected successfully. */
+ E_INTERCEPTED
+ };
+
+
+ // member
+ protected:
+
+
+ /** @short reference to the intercepted interaction handler.
+
+ @descr NULL is allowed for this member!
+ All interaction will be aborted then ...
+ expecting th handle() was overwritten by
+ a derived class.
+ */
+ css::uno::Reference< css::task::XInteractionHandler > m_xInterceptedHandler;
+
+
+ /** @short these list contains the requests, which should be intercepted.
+ */
+ ::std::vector< InterceptedRequest > m_lInterceptions;
+
+
+ // native interface
+ public:
+
+
+ /** @short initialize a new instance with default values.
+ */
+ InterceptedInteraction();
+
+
+ /** @short initialize a new instance with the interaction handler,
+ which should be intercepted.
+
+ @attention If such interaction handler isn't set here,
+ all incoming requests will be aborted ...
+ if the right continuation is available!
+
+ @param xInterceptedHandler
+ the outside interaction handler, which should
+ be intercepted here.
+ */
+ void setInterceptedHandler(const css::uno::Reference< css::task::XInteractionHandler >& xInterceptedHandler);
+
+
+ /** @short set a new list of intercepted interactions.
+
+ @attention If the interface method handle() will be overwritten by
+ a derived class, the functionality behind these static list
+ can't be used.
+
+ @param lInterceptions
+ the list of intercepted requests.
+ */
+ void setInterceptions(::std::vector< InterceptedRequest >&& lInterceptions);
+
+
+ /** @short extract a requested continuation from the list of available ones.
+
+ @param lContinuations
+ the list of available continuations.
+
+ @param aType
+ is used to locate the right continuation,
+ by checking its interface type.
+
+ @return A valid reference to the continuation, if it could be located...
+ or an empty reference otherwise.
+ */
+ static css::uno::Reference< css::task::XInteractionContinuation > extractContinuation(
+ const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >& lContinuations,
+ const css::uno::Type& aType );
+
+
+ // usable for derived classes
+ protected:
+
+
+ /** @short can be overwritten by a derived class to handle interceptions
+ outside.
+
+ @descr This base implementation checks, if the request could be intercepted
+ successfully. Then this method intercepted() is called.
+ The default implementation returns "NOT_INTERCEPTED" every time.
+ So the method impl_interceptRequest() uses the right continuation automatically.
+
+ If this method was overwritten and something different "NO_INTERCEPTED"
+ is returned, the method impl_interceptRequest() will return immediately with
+ the result, which is returned by this intercepted() method.
+ Then the continuations must be selected inside the intercepted() call!
+
+ @param rRequest
+ it points to the intercepted request (means the item of the
+ set interception list). e.g. its "Handle" member can be used
+ to identify it and react very easy, without the need to check the
+ type of the exception ...
+
+ @param xOrgRequest
+ points to the original interaction, which was intercepted.
+ It provides access to the exception and the list of possible
+ continuations.
+
+ @return The result of this operation.
+ Note: If E_NOT_INTERCEPTED is returned the default handling of the base class
+ will be used automatically for this request!
+ */
+ virtual EInterceptionState intercepted(const InterceptedRequest& rRequest ,
+ const css::uno::Reference< css::task::XInteractionRequest >& xOrgRequest);
+
+
+ // uno interface
+ public:
+
+
+ /** @short implements the default handling of this class...
+ or can be overwritten by any derived class.
+
+ @descr If no further class is derived from this one
+ -> the default implementation is used. Then the
+ internal list of requests is used to handle different
+ interactions automatically.
+ (see impl_interceptRequest())
+
+ If this method was overwritten by a derived implementation
+ -> the new implementation has to do everything by itself.
+ Of course it can access all members/helpers and work with it.
+ But the default implementation is not used automatically then.
+
+ @param xRequest
+ the interaction request, which should be intercepted.
+ */
+ virtual void SAL_CALL handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest) override;
+
+
+ // helper
+ private:
+
+
+ /** @short implements the default handling:
+ - intercept or forward to internal handler.
+ */
+ UCBHELPER_DLLPRIVATE void impl_handleDefault(const css::uno::Reference< css::task::XInteractionRequest >& xRequest);
+
+
+ /** @short implements the interception of requests.
+
+ @descr The incoming request will be analyzed, if it match
+ any request of the m_lIntercepions list.
+ If an interception could be found, its continuation will be
+ searched and selected.
+
+ The method return the state of that operation.
+ But it doesn't call the intercepted and here set
+ interaction handler. That has to be done in the outside method.
+
+ @param xRequest
+ the interaction request, which should be intercepted.
+
+ @return A identifier, which indicates if the request was intercepted,
+ the continuation was found and selected... or not.
+ */
+ UCBHELPER_DLLPRIVATE EInterceptionState impl_interceptRequest(const css::uno::Reference< css::task::XInteractionRequest >& xRequest);
+};
+
+} // namespace ucbhelper
+
+#endif // INCLUDED_UCBHELPER_INTERCEPTEDINTERACTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/macros.hxx b/include/ucbhelper/macros.hxx
new file mode 100644
index 000000000..ecdbeef70
--- /dev/null
+++ b/include/ucbhelper/macros.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_MACROS_HXX
+#define INCLUDED_UCBHELPER_MACROS_HXX
+
+#include <sal/types.h>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+#define CPPU_TYPE( T ) cppu::UnoType<T>::get()
+#define CPPU_TYPE_REF( T ) CPPU_TYPE( T )
+
+// XTypeProvider impl. internals
+
+
+#define XTYPEPROVIDER_COMMON_IMPL( Class ) \
+css::uno::Sequence< sal_Int8 > SAL_CALL \
+Class::getImplementationId() \
+{ \
+ return css::uno::Sequence<sal_Int8>(); \
+}
+
+#define GETTYPES_IMPL_START( Class ) \
+css::uno::Sequence< css::uno::Type > SAL_CALL \
+Class::getTypes() \
+{ \
+ static cppu::OTypeCollection collection(
+
+
+#define GETTYPES_IMPL_END \
+ ); \
+ \
+ return collection.getTypes(); \
+}
+
+
+// XTypeProvider impl.
+
+
+// 2 interfaces supported
+#define XTYPEPROVIDER_IMPL_2( Class, I1,I2 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ) \
+GETTYPES_IMPL_END
+
+// 3 interfaces supported
+#define XTYPEPROVIDER_IMPL_3( Class, I1,I2,I3 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ) \
+GETTYPES_IMPL_END
+
+// 4 interfaces supported
+#define XTYPEPROVIDER_IMPL_4( Class, I1,I2,I3,I4 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ) \
+GETTYPES_IMPL_END
+
+// 5 interfaces supported
+#define XTYPEPROVIDER_IMPL_5( Class, I1,I2,I3,I4,I5 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ) \
+GETTYPES_IMPL_END
+
+// 9 interfaces supported
+#define XTYPEPROVIDER_IMPL_9( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ) \
+GETTYPES_IMPL_END
+
+// 10 interfaces supported
+#define XTYPEPROVIDER_IMPL_10( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ) \
+GETTYPES_IMPL_END
+
+// 11 interfaces supported
+#define XTYPEPROVIDER_IMPL_11( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ) \
+GETTYPES_IMPL_END
+
+#endif /* ! INCLUDED_UCBHELPER_MACROS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/propertyvalueset.hxx b/include/ucbhelper/propertyvalueset.hxx
new file mode 100644
index 000000000..ea088e910
--- /dev/null
+++ b/include/ucbhelper/propertyvalueset.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_PROPERTYVALUESET_HXX
+#define INCLUDED_UCBHELPER_PROPERTYVALUESET_HXX
+
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/beans/Property.hpp>
+#include <cppuhelper/implbase.hxx>
+
+#include <mutex>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <memory>
+
+namespace com::sun::star::script {
+ class XTypeConverter;
+}
+
+namespace com::sun::star::beans {
+ class XPropertySet;
+}
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+enum class PropsSet;
+namespace ucbhelper_impl { struct PropertyValue; }
+
+namespace ucbhelper {
+
+class PropertyValues;
+
+
+/**
+ * This class implements the interface XRow. After construction of a valueset
+ * the user can append properties ( incl. its values ) to the set. This class
+ * is useful when implementing the command "getPropertyValues", because the
+ * values to return can easily appended to a valueset object. That object can
+ * directly be returned by the implementation of the command.
+ */
+class UCBHELPER_DLLPUBLIC PropertyValueSet final :
+ public cppu::WeakImplHelper<
+ css::sdbc::XRow,
+ css::sdbc::XColumnLocate>
+{
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::script::XTypeConverter > m_xTypeConverter;
+ std::mutex m_aMutex;
+ std::unique_ptr<PropertyValues> m_pValues;
+ bool m_bWasNull;
+ bool m_bTriedToGetTypeConverter;
+
+private:
+ UCBHELPER_DLLPRIVATE const css::uno::Reference< css::script::XTypeConverter >&
+ getTypeConverter();
+
+ template <class T, T ucbhelper_impl::PropertyValue::*_member_name_>
+ T getValue(PropsSet nTypeName, sal_Int32 columnIndex);
+
+ template <class T, T ucbhelper_impl::PropertyValue::*_member_name_>
+ void appendValue(const OUString& rPropName, PropsSet nTypeName, const T& rValue);
+
+public:
+ PropertyValueSet(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ virtual ~PropertyValueSet() override;
+
+ // XRow
+ virtual sal_Bool SAL_CALL
+ wasNull() override;
+ virtual OUString SAL_CALL
+ getString( sal_Int32 columnIndex ) override;
+ virtual sal_Bool SAL_CALL
+ getBoolean( sal_Int32 columnIndex ) override;
+ virtual sal_Int8 SAL_CALL
+ getByte( sal_Int32 columnIndex ) override;
+ virtual sal_Int16 SAL_CALL
+ getShort( sal_Int32 columnIndex ) override;
+ virtual sal_Int32 SAL_CALL
+ getInt( sal_Int32 columnIndex ) override;
+ virtual sal_Int64 SAL_CALL
+ getLong( sal_Int32 columnIndex ) override;
+ virtual float SAL_CALL
+ getFloat( sal_Int32 columnIndex ) override;
+ virtual double SAL_CALL
+ getDouble( sal_Int32 columnIndex ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getBytes( sal_Int32 columnIndex ) override;
+ virtual css::util::Date SAL_CALL
+ getDate( sal_Int32 columnIndex ) override;
+ virtual css::util::Time SAL_CALL
+ getTime( sal_Int32 columnIndex ) override;
+ virtual css::util::DateTime SAL_CALL
+ getTimestamp( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::io::XInputStream > SAL_CALL
+ getBinaryStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::io::XInputStream > SAL_CALL
+ getCharacterStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Any SAL_CALL
+ getObject( sal_Int32 columnIndex,
+ const css::uno::Reference<
+ css::container::XNameAccess >& typeMap ) override;
+ virtual css::uno::Reference<
+ css::sdbc::XRef > SAL_CALL
+ getRef( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::sdbc::XBlob > SAL_CALL
+ getBlob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::sdbc::XClob > SAL_CALL
+ getClob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::sdbc::XArray > SAL_CALL
+ getArray( sal_Int32 columnIndex ) override;
+
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL
+ findColumn( const OUString& columnName ) override;
+
+
+ // Non-interface methods
+
+ void appendString( const OUString& rPropName, const OUString& rValue );
+ void appendString( const css::beans::Property& rProp, const OUString& rValue )
+ {
+ appendString( rProp.Name, rValue );
+ }
+
+ void appendBoolean( const OUString& rPropName, bool bValue );
+ void appendBoolean( const css::beans::Property& rProp, bool bValue )
+ {
+ appendBoolean( rProp.Name, bValue );
+ }
+
+ void appendLong( const OUString& rPropName, sal_Int64 nValue );
+ void appendLong( const css::beans::Property& rProp, sal_Int64 nValue )
+ {
+ appendLong( rProp.Name, nValue );
+ }
+
+ void appendTimestamp( const OUString& rPropName, const css::util::DateTime& rValue );
+ void appendTimestamp( const css::beans::Property& rProp, const css::util::DateTime& rValue )
+ {
+ appendTimestamp( rProp.Name, rValue );
+ }
+
+ void appendObject( const OUString& rPropName, const css::uno::Any& rValue );
+ void appendObject( const css::beans::Property& rProp, const css::uno::Any& rValue )
+ {
+ appendObject( rProp.Name, rValue );
+ }
+
+ void appendVoid( const OUString& rPropName );
+ void appendVoid( const css::beans::Property& rProp )
+ {
+ appendVoid( rProp.Name );
+ }
+
+ /**
+ * This method tries to append all property values contained in a
+ * property set to the value set.
+ *
+ * @param rSet is a property set containing the property values.
+ */
+ void appendPropertySet( const css::uno::Reference< css::beans::XPropertySet >& rSet );
+
+ /** This method tries to append a single property value contained in a
+ * property set to the value set.
+ *
+ * @param rSet is a property set containing the property values.
+ * @param rProperty is the property for that the value shall be obtained
+ * from the given property set.
+ * @return False, if the property value cannot be obtained from the
+ * given property pet. True, otherwise.
+ */
+ bool appendPropertySetValue(
+ const css::uno::Reference< css::beans::XPropertySet >& rSet,
+ const css::beans::Property& rProperty );
+};
+
+}
+
+#endif /* ! INCLUDED_UCBHELPER_PROPERTYVALUESET_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/providerhelper.hxx b/include/ucbhelper/providerhelper.hxx
new file mode 100644
index 000000000..550da6c0e
--- /dev/null
+++ b/include/ucbhelper/providerhelper.hxx
@@ -0,0 +1,246 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_PROVIDERHELPER_HXX
+#define INCLUDED_UCBHELPER_PROVIDERHELPER_HXX
+
+#include <vector>
+#include <memory>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase.hxx>
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+
+namespace com::sun::star::ucb {
+ class XPropertySetRegistry;
+ class XPersistentPropertySet;
+}
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace ucbhelper_impl { struct ContentProviderImplHelper_Impl; }
+
+namespace ucbhelper {
+
+
+class ContentImplHelper;
+typedef rtl::Reference< ContentImplHelper > ContentImplHelperRef;
+typedef std::vector< ContentImplHelperRef > ContentRefList;
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.ContentProvider. It provides contents derived from
+ * class ucb::ContentImplHelper.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - maintains a set of ContentImplHelper objects, which were created by
+ * the provider implementation. So there will be exactly one object for
+ * one Content Identifier.
+ * - Provides access to the Additional Core PropertySet of a content.
+ * ( These set contains the properties added to a content using its
+ * XPropertyContainer interface )
+ */
+class UCBHELPER_DLLPUBLIC ContentProviderImplHelper :
+ public cppu::WeakImplHelper<
+ css::lang::XServiceInfo,
+ css::ucb::XContentProvider>
+{
+ friend class ContentImplHelper;
+
+ std::unique_ptr<ucbhelper_impl::ContentProviderImplHelper_Impl> m_pImpl;
+
+protected:
+ osl::Mutex m_aMutex;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+private:
+ UCBHELPER_DLLPRIVATE void removeContent( ContentImplHelper* pContent );
+
+ UCBHELPER_DLLPRIVATE css::uno::Reference< css::ucb::XPropertySetRegistry >
+ getAdditionalPropertySetRegistry();
+
+ UCBHELPER_DLLPRIVATE void cleanupRegisteredContents();
+
+protected:
+ /**
+ * This method returns a content with the given id, if it already exists.
+ * Use this method in your "queryContent" implementation to ensure unique
+ * objects.
+ *
+ * @param Identifier is the content identifier, for that an existing
+ * content object is requested.
+ * @return the content with the given identifier, if it exists or 0, if it
+ * does not exist.
+ */
+ rtl::Reference< ContentImplHelper >
+ queryExistingContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier );
+
+ /**
+ * This method returns a content with the given URL, if it already exists.
+ *
+ * @param rURL is the URL ( content identifier string ), for that an
+ * existing content object is requested.
+ * @return the content with the given URL, if it exists or 0, if it
+ * does not exist.
+ */
+ rtl::Reference< ContentImplHelper >
+ queryExistingContent( const OUString& rURL );
+
+ /**
+ * This method registers a newly created content instance with the
+ * content provider. It should be called directly after creating a new
+ * content instance. The provider can reuse a registered instance upon
+ * subsequent requests for content instances with an identifier
+ * of a registered instance.
+ * Note that the provider does not hold a hard reference on the
+ * registered instance. If last external reference is gone, the provider
+ * will remove the instance from its inventory of known instances.
+ * Nothing will happen in case an already registered instance shall
+ * be registered more than once.
+ *
+ * @param the content instance that is to be registered.
+ */
+ void registerNewContent(
+ const css::uno::Reference< css::ucb::XContent > & xContent );
+
+public:
+
+
+ // Construction/Destruction
+
+
+ ContentProviderImplHelper(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ virtual ~ContentProviderImplHelper() override;
+
+
+ // XServiceInfo
+
+
+ virtual OUString SAL_CALL
+ getImplementationName() override = 0;
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames() override = 0;
+
+
+ // XContentProvider
+
+
+ /**
+ * This method returns a content with the requested id.
+ *
+ * The implementation should:
+ *
+ * - Check, whether the Identifier is valid ( URL syntax ).
+ * - Use queryExistingContent(...) to determine, whether there exists
+ * already a content with the given id.
+ * - Return the possibly existing content.Create and return a new
+ * content, otherwise
+ */
+ virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
+ queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override = 0;
+ virtual sal_Int32 SAL_CALL
+ compareContentIds( const css::uno::Reference< css::ucb::XContentIdentifier >& Id1,
+ const css::uno::Reference< css::ucb::XContentIdentifier >& Id2 ) override;
+
+
+ // Non-interface methods.
+
+
+ /**
+ * This method returns a mutex, which protects the content list of the
+ * provider. So you can prevent modifications of that list easily.
+ *
+ * @return the mutex.
+ */
+ osl::Mutex& getContentListMutex() { return m_aMutex; }
+
+ /**
+ * This method fills a list with all contents existing at calling time.
+ * Note: You may prevent modifications of the content list at any time
+ * by acquiring the content list mutex of the provider.
+ *
+ * @param rContents is the list to fill with the children.
+ */
+ void queryExistingContents( ContentRefList& rContents );
+
+ /**
+ * This method returns the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rKey is the key for the propertyset.
+ * @param bCreate is a flag indicating whether the propertyset shall
+ * be created in case it does not exist.
+ * @return the propertyset containing the Additional Core Properties.
+ */
+ css::uno::Reference< css::ucb::XPersistentPropertySet >
+ getAdditionalPropertySet( const OUString& rKey, bool bCreate );
+
+ /**
+ * This method renames the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rOldKey is the old key of the propertyset.
+ * @param rNewKey is the new key for the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be renamed, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool renameAdditionalPropertySet( const OUString& rOldKey,
+ const OUString& rNewKey,
+ bool bRecursive );
+
+ /**
+ * This method copies the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rSourceKey is the key of the source propertyset.
+ * @param rTargetKey is the key of the target propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rSourceKey shall be copied, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool copyAdditionalPropertySet( const OUString& rSourceKey,
+ const OUString& rTargetKey,
+ bool bRecursive );
+
+ /**
+ * This method removes the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rKey is the key of the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be removed, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ bool removeAdditionalPropertySet( const OUString& rKey,
+ bool bRecursive );
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_PROVIDERHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/proxydecider.hxx b/include/ucbhelper/proxydecider.hxx
new file mode 100644
index 000000000..9a1abad32
--- /dev/null
+++ b/include/ucbhelper/proxydecider.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_PROXYDECIDER_HXX
+#define INCLUDED_UCBHELPER_PROXYDECIDER_HXX
+
+#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+
+namespace ucbhelper
+{
+
+/**
+ * This struct describes a proxy server.
+ */
+struct InternetProxyServer
+{
+ /**
+ * The name of the proxy server.
+ */
+ OUString aName;
+
+ /**
+ * The port of the proxy server.
+ */
+ sal_Int32 nPort;
+
+ /**
+ * Constructor.
+ */
+ InternetProxyServer() : nPort( -1 ) {}
+};
+
+namespace proxydecider_impl { class InternetProxyDecider_Impl; }
+
+/**
+ * This class is able to decide whether and which internet proxy server is to
+ * be used to access a given URI.
+ *
+ * The implementation reads the internet proxy settings from Office
+ * configuration. It listens for configuration changes and adapts itself
+ * accordingly. Because configuration data can change during runtime clients
+ * should not cache results obtained from InternetProxyDecider instances. One
+ * instance should be kept to be queried multiple times instead.
+ */
+class UCBHELPER_DLLPUBLIC InternetProxyDecider
+{
+public:
+ /**
+ * Constructor.
+ *
+ * Note: Every instance should be held alive as long as possible because
+ * because construction is quite expensive.
+ *
+ * @param rxSMgr is a Service Manager.
+ */
+ InternetProxyDecider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+
+ /**
+ * Destructor.
+ */
+ ~InternetProxyDecider();
+
+ /**
+ * Informs whether a proxy server should be used.
+ *
+ * @param rProtocol contains the internet protocol to be used to
+ * access the server (i.e. "ftp", "http"). The protocol string
+ * is handled case-insensitive and must not be empty.
+ * @param rHost contains the name of the server that should be accessed.
+ * This parameter might be left empty. In this case the
+ * implementation will return whether a proxy is configured
+ * for the given protocol.
+ * @param nPort contains the port of the server that should be accessed.
+ * If host is not empty this parameter must always contain a valid
+ * port number, for instance the default port for the requested
+ * protocol(i.e. 80 or http).
+ * @return true if a proxy server should be used, false otherwise.
+ */
+ bool
+ shouldUseProxy( const OUString & rProtocol,
+ const OUString & rHost,
+ sal_Int32 nPort ) const;
+
+ /**
+ * Returns the proxy server to be used.
+ *
+ * @param rProtocol contains the internet protocol to be used to
+ * access the server (i.e. "ftp", "http"). The protocol string
+ * is handled case-insensitive and must not be empty.
+ * @param rHost contains the name of the server that should be accessed.
+ * This parameter might be left empty. In this case the
+ * implementation will return the proxy that is configured
+ * for the given protocol.
+ * @param nPort contains the port of the server that should be accessed.
+ * If host is not empty this parameter must always contain a valid
+ * port number, for instance the default port for the requested
+ * protocol(i.e. 80 or http).
+ * @return a InternetProxyServer struct. If member aName of the
+ * InternetProxyServer is empty no proxy server is to be used.
+ */
+ InternetProxyServer
+ getProxy( const OUString & rProtocol,
+ const OUString & rHost,
+ sal_Int32 nPort ) const;
+
+private:
+ rtl::Reference<proxydecider_impl::InternetProxyDecider_Impl> m_xImpl;
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_PROXYDECIDER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/registerucb.hxx b/include/ucbhelper/registerucb.hxx
new file mode 100644
index 000000000..1e103f927
--- /dev/null
+++ b/include/ucbhelper/registerucb.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_REGISTERUCB_HXX
+#define INCLUDED_UCBHELPER_REGISTERUCB_HXX
+
+#include <rtl/ustring.hxx>
+#include <vector>
+
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace com::sun::star {
+ namespace uno { class XComponentContext; }
+ namespace ucb { class XContentProviderManager; }
+}
+
+
+namespace ucbhelper {
+
+
+/** Information about a content provider, passed to
+ <method>configureUcb</method>.
+ */
+struct ContentProviderData
+{
+ /** The UNO service name to use to instantiate the content provider.
+
+ If it is the empty string, a null provider will be used (see the
+ documentation of the Provider argument to
+ com.sun.star.ucb.XContentProviderManager.registerContentProvider).
+ */
+ OUString ServiceName;
+
+ /** The URL template to use to instantiate the content provider.
+ */
+ OUString URLTemplate;
+
+ /** The arguments to use to instantiate the content provider.
+ */
+ OUString Arguments;
+};
+
+typedef std::vector< ContentProviderData > ContentProviderDataList;
+
+/** Register a content provider at a Universal Content Broker.
+
+ @param rManager A content provider manager (normally, this would be a
+ UCB). May be null, which is only useful if the content provider is an
+ XParameterizedContentProviders.
+
+ @param rServiceFactory A factory through which to obtain the required
+ services.
+
+ @param rName The service name of the content provider. If it is the empty
+ string, a null provider will be used (see the documentation of the Provider
+ argument to
+ com.sun.star.ucb.XContentProviderManager.registerContentProvider).
+
+ @param rArguments Any arguments to instantiate the content provider with.
+
+ @param rTemplate The URL template to register the content provider on.
+
+ @param pInfo If not null, this output parameter is filled with
+ information about the (attemptively) registered provider.
+
+ @throws css::uno::RuntimeException
+ */
+
+UCBHELPER_DLLPUBLIC bool registerAtUcb(
+ css::uno::Reference< css::ucb::XContentProviderManager > const & rManager,
+ css::uno::Reference< css::uno::XComponentContext > const & rxContext,
+ OUString const & rName,
+ OUString const & rArguments,
+ OUString const & rTemplate);
+
+}
+#endif // INCLUDED_UCBHELPER_REGISTERUCB_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/resultset.hxx b/include/ucbhelper/resultset.hxx
new file mode 100644
index 000000000..6790c3dd1
--- /dev/null
+++ b/include/ucbhelper/resultset.hxx
@@ -0,0 +1,435 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_RESULTSET_HXX
+#define INCLUDED_UCBHELPER_RESULTSET_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <memory>
+
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::ucb { class XCommandEnvironment; }
+
+namespace ucbhelper {
+
+
+inline constexpr OUStringLiteral RESULTSET_SERVICE_NAME = u"com.sun.star.ucb.ContentResultSet";
+
+
+class ResultSetDataSupplier;
+struct ResultSet_Impl;
+
+/**
+ * This is an implementation of the service com.sun.star.ucb.ContentResultSet.
+ * It can be used to implement the method XDynamicResultSet::getStaticResultSet,
+ * which needs to be implemented for instance to implement the command "open"
+ * at folder objects. This class uses a user supplied ResultSetDataSupplier
+ * object to request data on demand.
+ *
+ * @see ResultSetDataSupplier
+ */
+class UCBHELPER_DLLPUBLIC ResultSet final :
+ public cppu::WeakImplHelper<
+ css::lang::XServiceInfo,
+ css::lang::XComponent,
+ css::ucb::XContentAccess,
+ css::sdbc::XResultSet,
+ css::sdbc::XResultSetMetaDataSupplier,
+ css::sdbc::XRow,
+ css::sdbc::XCloseable,
+ css::beans::XPropertySet>
+{
+ std::unique_ptr<ResultSet_Impl> m_pImpl;
+
+public:
+ /**
+ * Construction.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProperties is a sequence of properties for that the resultset
+ * shall be able to obtain the values.
+ * @param rDataSupplier is a supplier for the resultset data.
+ */
+ ResultSet(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Sequence< css::beans::Property >& rProperties,
+ const rtl::Reference< ResultSetDataSupplier >& rDataSupplier );
+ /**
+ * Construction.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProperties is a sequence of properties for that the resultset
+ * shall be able to obtain the values.
+ * @param rDataSupplier is a supplier for the resultset data.
+ * @param rxEnv is the environment for interactions, progress propagation,
+ * ...
+ */
+ ResultSet(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Sequence< css::beans::Property >& rProperties,
+ const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& rxEnv );
+ virtual ~ResultSet() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XComponent
+ virtual void SAL_CALL
+ dispose() override;
+ virtual void SAL_CALL
+ addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+ virtual void SAL_CALL
+ removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+
+ // XContentAccess
+ virtual OUString SAL_CALL
+ queryContentIdentifierString() override;
+ virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
+ queryContentIdentifier() override;
+ virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
+ queryContent() override;
+
+ // XResultSetMetaDataSupplier
+ virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL
+ getMetaData() override;
+
+ // XResultSet
+ virtual sal_Bool SAL_CALL
+ next() override;
+ virtual sal_Bool SAL_CALL
+ isBeforeFirst() override;
+ virtual sal_Bool SAL_CALL
+ isAfterLast() override;
+ virtual sal_Bool SAL_CALL
+ isFirst() override;
+ virtual sal_Bool SAL_CALL
+ isLast() override;
+ virtual void SAL_CALL
+ beforeFirst() override;
+ virtual void SAL_CALL
+ afterLast() override;
+ virtual sal_Bool SAL_CALL
+ first() override;
+ virtual sal_Bool SAL_CALL
+ last() override;
+ virtual sal_Int32 SAL_CALL
+ getRow() override;
+ virtual sal_Bool SAL_CALL
+ absolute( sal_Int32 row ) override;
+ virtual sal_Bool SAL_CALL
+ relative( sal_Int32 rows ) override;
+ virtual sal_Bool SAL_CALL
+ previous() override;
+ virtual void SAL_CALL
+ refreshRow() override;
+ virtual sal_Bool SAL_CALL
+ rowUpdated() override;
+ virtual sal_Bool SAL_CALL
+ rowInserted() override;
+ virtual sal_Bool SAL_CALL
+ rowDeleted() override;
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
+ getStatement() override;
+
+ // XRow
+ virtual sal_Bool SAL_CALL
+ wasNull() override;
+ virtual OUString SAL_CALL
+ getString( sal_Int32 columnIndex ) override;
+ virtual sal_Bool SAL_CALL
+ getBoolean( sal_Int32 columnIndex ) override;
+ virtual sal_Int8 SAL_CALL
+ getByte( sal_Int32 columnIndex ) override;
+ virtual sal_Int16 SAL_CALL
+ getShort( sal_Int32 columnIndex ) override;
+ virtual sal_Int32 SAL_CALL
+ getInt( sal_Int32 columnIndex ) override;
+ virtual sal_Int64 SAL_CALL
+ getLong( sal_Int32 columnIndex ) override;
+ virtual float SAL_CALL
+ getFloat( sal_Int32 columnIndex ) override;
+ virtual double SAL_CALL
+ getDouble( sal_Int32 columnIndex ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL
+ getBytes( sal_Int32 columnIndex ) override;
+ virtual css::util::Date SAL_CALL
+ getDate( sal_Int32 columnIndex ) override;
+ virtual css::util::Time SAL_CALL
+ getTime( sal_Int32 columnIndex ) override;
+ virtual css::util::DateTime SAL_CALL
+ getTimestamp( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::io::XInputStream > SAL_CALL
+ getBinaryStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::io::XInputStream > SAL_CALL
+ getCharacterStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Any SAL_CALL
+ getObject( sal_Int32 columnIndex,
+ const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
+ virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL
+ getRef( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference<
+ css::sdbc::XBlob > SAL_CALL
+ getBlob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL
+ getClob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL
+ getArray( sal_Int32 columnIndex ) override;
+
+ // XCloseable
+ virtual void SAL_CALL
+ close() override;
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() override;
+ virtual void SAL_CALL
+ setPropertyValue( const OUString& aPropertyName,
+ const css::uno::Any& aValue ) override;
+ virtual css::uno::Any SAL_CALL
+ getPropertyValue( const OUString& PropertyName ) override;
+ virtual void SAL_CALL
+ addPropertyChangeListener( const OUString& aPropertyName,
+ const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
+ virtual void SAL_CALL
+ removePropertyChangeListener( const OUString& aPropertyName,
+ const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
+ virtual void SAL_CALL
+ addVetoableChangeListener( const OUString& PropertyName,
+ const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+ virtual void SAL_CALL
+ removeVetoableChangeListener( const OUString& PropertyName,
+ const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
+
+
+ // Non-interface methods.
+
+
+ /**
+ * This method propagates property value changes to all registered
+ * listeners.
+ *
+ * @param rEvt is a property change event.
+ */
+ void propertyChanged(
+ const css::beans::PropertyChangeEvent& rEvt ) const;
+
+ /**
+ * This method should be called by the data supplier for the result set
+ * to indicate that there were new data obtained from the data source.
+ *
+ * @param nOld is the old count of rows; must be non-negative.
+ * @param nnew is the new count of rows; must be non-negative.
+ */
+ void rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew );
+
+ /**
+ * This method should be called by the data supplier for the result set
+ * to indicate that there were all rows obtained from the data source.
+ */
+ void rowCountFinal();
+
+ /**
+ * This method returns a sequence containing all properties ( not the
+ * values! ) of the result set.
+ *
+ * @return a sequence of properties.
+ */
+ const css::uno::Sequence< css::beans::Property >&
+ getProperties() const;
+
+ /**
+ * This method returns the environment to use for interactions, progress
+ * propagation, ... It can by empty.
+ *
+ * @return an environment or an empty reference.
+ */
+ const css::uno::Reference< css::ucb::XCommandEnvironment >&
+ getEnvironment() const;
+};
+
+
+/**
+ * This is the base class for an object that supplies data to a result set
+ *
+ * @see ResultSet
+ */
+class ResultSetDataSupplier : public salhelper::SimpleReferenceObject
+{
+ friend class ResultSet;
+
+ // No ref, otherwise we get a cyclic reference between supplier and set!
+ // Will be set from ResultSet ctor.
+ ResultSet* m_pResultSet;
+
+public:
+ ResultSetDataSupplier() : m_pResultSet( nullptr ) {}
+
+ /**
+ * This method returns the resultset this supplier belongs to.
+ *
+ * @return the resultset for that the supplier supplies data.
+ */
+ rtl::Reference< ResultSet > getResultSet() const { return m_pResultSet; }
+
+ /**
+ * This method returns the identifier string of the content at the
+ * specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return the content's identifier string.
+ */
+ virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the identifier of the content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return the content's identifier.
+ */
+ virtual css::uno::Reference< css::ucb::XContentIdentifier >
+ queryContentIdentifier( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return the content.
+ */
+ virtual css::uno::Reference< css::ucb::XContent >
+ queryContent( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns whether there is a content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return true, if there is a content at the given index.
+ */
+ virtual bool getResult( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the total count of objects in the logical data array
+ * of the supplier. The implementation of this method may be very
+ * "expensive", because it can be necessary to obtain all data in order
+ * to determine the count. Therefore the ResultSet implementation calls
+ * it very seldom.
+ *
+ * @return the total count of objects; will always be non-negative.
+ */
+ virtual sal_uInt32 totalCount() = 0;
+
+ /**
+ * This method returns the count of objects obtained so far. There is no
+ * for the implementation to obtain all objects at once. It can obtain
+ * all data on demand.
+ *
+ * The implementation should call m_pResultSet->rowCountChanged(...)
+ * every time it has inserted a new entry in its logical result array.
+ *
+ * @return the count of objects obtained so far; will always be
+ * non-negative.
+ */
+ virtual sal_uInt32 currentCount() = 0;
+
+ /**
+ * This method returns whether the value returned by currentCount() is
+ * "final". This is the case, if that there was all data obtained by the
+ * supplier and the current count won't increase any more.
+ *
+ * The implementation should call m_pResultSet->rowCountFinal(...) if
+ * it has inserted all entries in its logical result array.
+ *
+ * @return true, if the value returned by currentCount() won't change
+ anymore.
+ */
+ virtual bool isCountFinal() = 0;
+
+ /**
+ * This method returns an object for accessing the property values at
+ * the specified index. The implementation may use the helper class
+ * ucb::PropertyValueSet to provide the return value.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return the object for accessing the property values.
+ */
+ virtual css::uno::Reference< css::sdbc::XRow >
+ queryPropertyValues( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method is called to instruct the supplier to release the (possibly
+ * present) property values at the given index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ */
+ virtual void releasePropertyValues( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method will be called by the resultset implementation in order
+ * to instruct the data supplier to release all resources it has
+ * allocated so far. In case the supplier is collecting data
+ * asynchronously, that process must be stopped.
+ */
+ virtual void close() = 0;
+
+ /**
+ * This method will be called by the resultset implementation in order
+ * check, whether an error has occurred while collecting data. The
+ * implementation of this method must throw an exception in that case.
+ *
+ * Note: An exception thrown to indicate an error must always be thrown
+ * by the thread that created the data supplier. If the supplier collects
+ * data asynchronously ( i.e. in a separate thread ) and an error
+ * occurs, throwing of the appropriate exception must be deferred
+ * until validate() is called by the ResultSet implementation from
+ * inside the main thread.
+ * In case data are obtained synchronously, the ResultSetException can
+ * be thrown directly.
+ *
+ * @exception ResultSetException thrown, if an error has occurred
+ */
+ virtual void validate() = 0;
+};
+
+}
+
+#endif /* ! INCLUDED_UCBHELPER_RESULTSET_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/resultsethelper.hxx b/include/ucbhelper/resultsethelper.hxx
new file mode 100644
index 000000000..486d07fe5
--- /dev/null
+++ b/include/ucbhelper/resultsethelper.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_RESULTSETHELPER_HXX
+#define INCLUDED_UCBHELPER_RESULTSETHELPER_HXX
+
+#include <memory>
+#include <mutex>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ucb/XDynamicResultSet.hpp>
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#include <comphelper/interfacecontainer4.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace cppu {
+ class OInterfaceContainerHelper;
+}
+
+namespace ucbhelper {
+
+
+inline constexpr OUStringLiteral DYNAMICRESULTSET_SERVICE_NAME = u"com.sun.star.ucb.DynamicResultSet";
+
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.DynamicResultSet, which is the result of the command
+ * "open" executed at a UCB folder content.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - all required interfaces for service css::ucb::DynamicResultSet
+ */
+class UCBHELPER_DLLPUBLIC ResultSetImplHelper :
+ public cppu::WeakImplHelper<
+ css::lang::XServiceInfo,
+ css::ucb::XDynamicResultSet>
+{
+ comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aDisposeEventListeners;
+ bool m_bStatic;
+ bool m_bInitDone;
+
+protected:
+ std::mutex m_aMutex;
+ css::ucb::OpenCommandArgument2 m_aCommand;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ // Resultset #1
+ css::uno::Reference< css::sdbc::XResultSet > m_xResultSet1;
+ // Resultset #2
+ css::uno::Reference< css::sdbc::XResultSet > m_xResultSet2;
+ // Resultset changes listener.
+ css::uno::Reference< css::ucb::XDynamicResultSetListener > m_xListener;
+
+private:
+ UCBHELPER_DLLPRIVATE void init( bool bStatic );
+
+ /**
+ * Your implementation of this method has to fill the protected member
+ * m_xResultSet1. This resultset must implement a complete static
+ * resultset ( service com.sun.star.ucb.ContentResultSet ). This method
+ * will be called at most once in the life of your implementation object.
+ * After this method was called, the type of this resultset will be
+ * "static". There is no way to change the type afterwards.
+ * If this method gets called the client wants to use your resultset
+ * exclusively statically. You may deploy this factum to optimize your
+ * implementation (i.e. "switch off" all changes detection code in
+ * your implementation).
+ * Note that you may use the class ucb::ResultSet to implement the
+ * static resultset, that is required here.
+ */
+ UCBHELPER_DLLPRIVATE virtual void initStatic() = 0;
+
+ /**
+ * Your implementation of this method has to fill the protected members
+ * m_xResultSet1 and m_xResultSet2 of this base class. Each of these
+ * resultsets must implement a complete static resultset
+ * ( service com.sun.star.ucb.ContentResultSet ). This method will be
+ * called at most once in the life of your implementation object.
+ * After this method was called, the type of this resultset will be
+ * "dynamic". There is no way to change the type afterwards.
+ * If this method gets called the client wants to use your resultset
+ * exclusively dynamically. This means, it is interested in getting
+ * notifications on changes of data of the resultset contents. ( These
+ * changes are to propagate by your implementation throw the member
+ * m_xListener of this base class ).
+ * If your implementation cannot detect changes of relevant data, you
+ * may fill m_xResultSet1 and m_xResultSet2 with the same static resultset
+ * implementation object. This normally will be the same instance you put
+ * into m_xResultSet1 when initStatic() is called.
+ */
+ UCBHELPER_DLLPRIVATE virtual void initDynamic() = 0;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rxContext is a Service Manager.
+ * @param rCommand is the parameter for the open command that produces
+ * this resultset.
+ */
+ ResultSetImplHelper(
+ const css::uno::Reference<
+ css::uno::XComponentContext >& rxContext,
+ const css::ucb::OpenCommandArgument2& rCommand );
+
+ /**
+ * Destructor.
+ */
+ virtual ~ResultSetImplHelper() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XComponent ( base class of XDynamicResultSet )
+ virtual void SAL_CALL
+ dispose() override;
+ virtual void SAL_CALL
+ addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+ virtual void SAL_CALL
+ removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
+
+ // XDynamicResultSet
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL
+ getStaticResultSet() override;
+ virtual void SAL_CALL
+ setListener( const css::uno::Reference< css::ucb::XDynamicResultSetListener >& Listener ) override;
+ virtual void SAL_CALL
+ connectToCache( const css::uno::Reference< css::ucb::XDynamicResultSet > & xCache ) override;
+
+ /**
+ * The implementation of this method always returns 0. Override this
+ * method, if necessary.
+ */
+ virtual sal_Int16 SAL_CALL
+ getCapabilities() override;
+
+};
+
+}
+
+#endif /* ! INCLUDED_UCBHELPER_RESULTSETHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/resultsetmetadata.hxx b/include/ucbhelper/resultsetmetadata.hxx
new file mode 100644
index 000000000..856c28a0a
--- /dev/null
+++ b/include/ucbhelper/resultsetmetadata.hxx
@@ -0,0 +1,341 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_RESULTSETMETADATA_HXX
+#define INCLUDED_UCBHELPER_RESULTSETMETADATA_HXX
+
+#include <vector>
+#include <memory>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star {
+ namespace beans { struct Property; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ucbhelper_impl {
+ struct ResultSetMetaData_Impl;
+}
+
+namespace ucbhelper
+{
+
+
+/**
+ * This is a structure that holds additional meta data for one column
+ * of a resultset. The default values set in the constructor should be a
+ * good guess for many UCB use cases.
+ */
+struct ResultSetColumnData
+{
+ /** @see ResultSetMetaData::isCaseSensitive */
+ bool isCaseSensitive;
+
+ inline ResultSetColumnData();
+};
+
+// Note: Never change the initial values! Implementations using this struct
+// may heavily depend on the behaviour of the default constructor.
+
+ResultSetColumnData::ResultSetColumnData()
+: isCaseSensitive( true )
+{
+}
+
+
+/**
+ * This is an implementation of the interface XResultSetMetaData. It can be
+ * used to implement the interface
+ * css::sdbc::XResultSetMetaDataSupplier, which is required for
+ * implementations of service com.sun.star.ucb.ContentResultSet.
+ */
+class UCBHELPER_DLLPUBLIC ResultSetMetaData final :
+ public cppu::WeakImplHelper<css::sdbc::XResultSetMetaData>
+{
+ std::unique_ptr<ucbhelper_impl::ResultSetMetaData_Impl> m_pImpl;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Sequence< css::beans::Property > m_aProps;
+
+public:
+
+ /**
+ * Constructor. ResultSet is readonly by default.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProps is a sequence of properties (partially) describing the
+ * columns of a resultset.
+ */
+ ResultSetMetaData(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Sequence< css::beans::Property >& rProps );
+
+ /**
+ * Constructor.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProps is a sequence of properties (partially) describing the
+ * columns of a resultset.
+ * @param rColumnData contains additional meta data for the columns of
+ * a resultset, which override the default values returned by the
+ * appropriate methods of this class. The length of rColumnData
+ * must be the same as length of rProps.
+ * rColumnData[ 0 ] corresponds to data in rProps[ 0 ],
+ * rColumnData[ 1 ] corresponds to data in rProps[ 1 ], ...
+ */
+ ResultSetMetaData(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Sequence< css::beans::Property >& rProps,
+ std::vector< ResultSetColumnData >&& rColumnData );
+
+ /**
+ * Destructor.
+ */
+ virtual ~ResultSetMetaData() override;
+
+ // XResultSetMetaData
+
+ /**
+ * Returns the number of columns of the resultset.
+ *
+ * @return the length of the property sequence.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnCount() override;
+ /**
+ * Checks whether column is automatically numbered, which makes it
+ * read-only.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if column is automatically numbered.
+ */
+ virtual sal_Bool SAL_CALL
+ isAutoIncrement( sal_Int32 column ) override;
+ /**
+ * Checks whether column is case sensitive.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if column is case sensitive.
+ */
+ virtual sal_Bool SAL_CALL
+ isCaseSensitive( sal_Int32 column ) override;
+ /**
+ * Checks whether the value stored in column can be used in a
+ * WHERE clause.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the column is searchable.
+ */
+ virtual sal_Bool SAL_CALL
+ isSearchable( sal_Int32 column ) override;
+ /**
+ * Checks whether column is a cash value.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the column is a cash value.
+ */
+ virtual sal_Bool SAL_CALL
+ isCurrency( sal_Int32 column ) override;
+ /**
+ * Checks whether a NULL can be stored in column.
+ *
+ * @see css::sdbc::ColumnValue
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return css::sdbc::ColumnValue::NULLABLE, if a NULL
+ * can be stored in the column.
+ */
+ virtual sal_Int32 SAL_CALL
+ isNullable( sal_Int32 column ) override;
+ /**
+ * Checks whether the value stored in column is a signed number.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the value stored in column is a signed number.
+ */
+ virtual sal_Bool SAL_CALL
+ isSigned( sal_Int32 column ) override;
+ /**
+ * Gets the normal maximum width in characters for column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the normal maximum width in characters for column.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnDisplaySize( sal_Int32 column ) override;
+ /**
+ * Gets the suggested column title for column, to be used in print-
+ * outs and displays.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the column label.
+ */
+ virtual OUString SAL_CALL
+ getColumnLabel( sal_Int32 column ) override;
+ /**
+ * Gets the name of column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the name of the property that corresponds to column.
+ */
+ virtual OUString SAL_CALL
+ getColumnName( sal_Int32 column ) override;
+ /**
+ * Gets the schema name for the table from which column of this
+ * result set was derived.
+ * Because this feature is not widely supported, the return value
+ * for many DBMSs will be an empty string.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the schema name of column or an empty string.
+ */
+ virtual OUString SAL_CALL
+ getSchemaName( sal_Int32 column ) override;
+ /**
+ * For number types, getprecision gets the number of decimal digits
+ * in column.
+ * For character types, it gets the maximum length in characters for
+ * column.
+ * For binary types, it gets the maximum length in bytes for column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the precision for the column.
+ */
+ virtual sal_Int32 SAL_CALL
+ getPrecision( sal_Int32 column ) override;
+ /**
+ * Gets the number of digits to the right of the decimal point for
+ * values in column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the scale of the column.
+ */
+ virtual sal_Int32 SAL_CALL
+ getScale( sal_Int32 column ) override;
+ /**
+ * Gets the name of the table from which column of this result set
+ * was derived or "" if there is none (for example, for a join).
+ * Because this feature is not widely supported, the return value
+ * for many DBMSs will be an empty string.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the table name for column or an empty string.
+ */
+ virtual OUString SAL_CALL
+ getTableName( sal_Int32 column ) override;
+ virtual OUString SAL_CALL
+ /**
+ * Gets the catalog name for the table from which column of this
+ * result set was derived.
+ * Because this feature is not widely supported, the return value
+ * for many DBMSs will be an empty string.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the catalog name for column or an empty string.
+ */
+ getCatalogName( sal_Int32 column ) override;
+ /**
+ * Gets the JDBC type for the value stored in column. ... The STRUCT
+ * and DISTINCT type codes are always returned for structured and
+ * distinct types, regardless of whether the value will be mapped
+ * according to the standard mapping or be a custom mapping.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the type of the property that corresponds to column - mapped
+ * from UNO-Type to SQL-Type.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnType( sal_Int32 column ) override;
+ /**
+ * Gets the type name used by this particular data source for the
+ * values stored in column. If the type code for the type of value
+ * stored in column is STRUCT, DISTINCT or JAVA_OBJECT, this method
+ * returns a fully-qualified SQL type name.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the column type name.
+ */
+ virtual OUString SAL_CALL
+ getColumnTypeName( sal_Int32 column ) override;
+ /**
+ * Indicates whether a column is definitely not writable.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the column is definitely not writable.
+ */
+ virtual sal_Bool SAL_CALL
+ isReadOnly( sal_Int32 column ) override;
+ /**
+ * Indicates whether it is possible for a write on the column to succeed.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if it is possible for a write to succeed.
+ */
+ virtual sal_Bool SAL_CALL
+ isWritable( sal_Int32 column ) override;
+ /**
+ * Indicates whether a write on the column will definitely succeed.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if a write on the column will definitely succeed.
+ */
+ virtual sal_Bool SAL_CALL
+ isDefinitelyWritable( sal_Int32 column ) override;
+ /**
+ * Returns the fully-qualified name of the service whose instances
+ * are manufactured if the method
+ * css::sdbc::ResultSet::getObject is called to retrieve a
+ * value from the column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the service name for column or an empty string, if no service
+ * is applicable.
+ */
+ virtual OUString SAL_CALL
+ getColumnServiceName( sal_Int32 column ) override;
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_RESULTSETMETADATA_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/simpleauthenticationrequest.hxx b/include/ucbhelper/simpleauthenticationrequest.hxx
new file mode 100644
index 000000000..69cb20ab8
--- /dev/null
+++ b/include/ucbhelper/simpleauthenticationrequest.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX
+#define INCLUDED_UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/interactionrequest.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::ucb {
+ class URLAuthenticationRequest;
+}
+
+namespace ucbhelper {
+
+/**
+ * This class implements a simple authentication interaction request.
+ * Instances can be passed directly to XInteractionHandler::handle(...). Each
+ * instance contains an AuthenticationRequest and three interaction
+ * continuations: "Abort", "Retry" and "SupplyAuthentication". The parameters
+ * for the AuthenticationRequest and the InteractionSupplyAuthentication
+ * objects are partly taken from constructors parameters and partly defaulted
+ * as follows:
+ *
+ * Read-only values : servername, realm
+ * Read-write values: username, password, account
+ * All remember-authentication values: RememberAuthentication_NO
+ *
+ * @see css::ucb::AuthenticationRequest
+ * @see css::ucb::RememberAuthentication
+ * @see InteractionAbort
+ * @see InteractionRetry
+ * @see InteractionSupplyAuthentication
+ */
+class UCBHELPER_DLLPUBLIC SimpleAuthenticationRequest final : public ucbhelper::InteractionRequest
+{
+ rtl::Reference<
+ ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier;
+
+private:
+ void initialize( const css::ucb::URLAuthenticationRequest & rRequest,
+ bool bCanSetRealm,
+ bool bCanSetUserName,
+ bool bCanSetPassword,
+ bool bCanSetAccount,
+ bool bAllowUseSystemCredentials,
+ bool bAllowSessionStoring );
+
+public:
+ /** Specification whether some entity (realm, username, password, account)
+ is either not applicable at all, has a fixed value, or is modifiable.
+ */
+ enum EntityType
+ {
+ ENTITY_NA,
+ ENTITY_FIXED,
+ ENTITY_MODIFY
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param rURL contains a URL for which authentication is requested.
+ * @param rServerName contains a server name.
+ * @param rRealm contains a realm, if applicable.
+ * @param rUserName contains a username, if available (for instance from
+ * a previous try).
+ * @param rPassword contains a password, if available (for instance from
+ * a previous try).
+ * @param bAllowUseSystemCredentials specifies if requesting client is
+ * able to obtain and use system credentials for authentication
+ */
+ SimpleAuthenticationRequest( const OUString & rURL,
+ const OUString & rServerName,
+ const OUString & rRealm,
+ const OUString & rUserName,
+ const OUString & rPassword,
+ bool bAllowUseSystemCredentials,
+ bool bAllowSessionStoring = true );
+
+
+ /**
+ * Constructor.
+ *
+ * @param rServerName contains a server name.
+ * @param eRealmType specifies whether a realm is applicable and
+ modifiable.
+ * @param rRealm contains a realm, if applicable.
+ * @param eUserNameType specifies whether a username is applicable and
+ modifiable.
+ * @param rUserName contains a username, if available (for instance from
+ * a previous try).
+ * @param ePasswordType specifies whether a password is applicable and
+ modifiable.
+ * @param rPassword contains a password, if available (for instance from
+ * a previous try).
+ */
+ SimpleAuthenticationRequest( const OUString & rURL,
+ const OUString & rServerName,
+ EntityType eRealmType,
+ const OUString & rRealm,
+ EntityType eUserNameType,
+ const OUString & rUserName,
+ EntityType ePasswordType,
+ const OUString & rPassword );
+
+ /**
+ * This method returns the supplier for the missing authentication data,
+ * that, for instance can be used to query the password supplied by the
+ * interaction handler.
+ *
+ * @return the supplier for the missing authentication data.
+ */
+ const rtl::Reference< ucbhelper::InteractionSupplyAuthentication > &
+ getAuthenticationSupplier() const { return m_xAuthSupplier; }
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/simplecertificatevalidationrequest.hxx b/include/ucbhelper/simplecertificatevalidationrequest.hxx
new file mode 100644
index 000000000..f839e0253
--- /dev/null
+++ b/include/ucbhelper/simplecertificatevalidationrequest.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_SIMPLECERTIFICATEVALIDATIONREQUEST_HXX
+#define INCLUDED_UCBHELPER_SIMPLECERTIFICATEVALIDATIONREQUEST_HXX
+
+#include <ucbhelper/interactionrequest.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace com::sun::star::security { class XCertificate; }
+
+
+namespace ucbhelper {
+
+/**
+ * This class implements a simple validation interaction request of a certificate.
+ * Instances can be passed directly to XInteractionHandler::handle(...). Each
+ * instance contains a CertificateValidationRequest and two interaction
+ * continuations: "Abort" and "Approved". The parameters
+ * for the CertificateValidationRequest object are partly taken from constructors parameters and partly defaulted
+ * as follows:
+ *
+ * Read-write values: certificateValidity, certificate
+ *
+ * @see css::ucb::CertificateValidationRequest
+ * @see InteractionApproved
+ * @see InteractionRetry
+ */
+class UCBHELPER_DLLPUBLIC SimpleCertificateValidationRequest final : public ucbhelper::InteractionRequest
+{
+public:
+ /**
+ * Constructor.
+ *
+ * @param lCertificateValidity contains a bitmask which validation error occur.
+ * @param pCertificate contains the server certificate.
+ */
+ SimpleCertificateValidationRequest( sal_Int32 lCertificateValidity,
+ const css::uno::Reference<css::security::XCertificate>& certificate,
+ const OUString & hostname );
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_SIMPLECERTIFICATEVALIDATIONREQUEST_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/simpleinteractionrequest.hxx b/include/ucbhelper/simpleinteractionrequest.hxx
new file mode 100644
index 000000000..256562022
--- /dev/null
+++ b/include/ucbhelper/simpleinteractionrequest.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
+#define INCLUDED_UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
+
+#include <ucbhelper/interactionrequest.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+/** These are the constants that can be passed to the constructor of class
+ * SimpleInteractionRequest and that are returned by method
+ * SimpleInteractionRequest::getResponse().
+ */
+
+enum class ContinuationFlags
+{
+ /** The request was not (yet) handled by the interaction handler. */
+ NONE = 0,
+ /** The interaction handler selected XInteractionAbort. */
+ Abort = 1,
+ /** The interaction handler selected XInteractionRetry. */
+ Retry = 2,
+ /** The interaction handler selected XInteractionApprove. */
+ Approve = 4,
+ /** The interaction handler selected XInteractionDisapprove. */
+ Disapprove = 8,
+};
+namespace o3tl
+{
+template <> struct typed_flags<ContinuationFlags> : is_typed_flags<ContinuationFlags, 0x0f>
+{
+};
+}
+
+namespace ucbhelper
+{
+/**
+ * This class implements a simple interaction request. The user must not deal
+ * with XInteractionContinuations directly, but can use constants that are
+ * mapped internally to the according objects. This class encapsulates the
+ * standard Interaction Continuations "Abort", "Retry", "Approve" and
+ * "Disapprove". Instances can be passed directly to
+ * XInteractionHandler::handle(...).
+ *
+ * @see InteractionRequest
+ * @see InteractionAbort
+ * @see InteractionRetry
+ * @see InteractionApprove
+ * @see InteractionDisapprove
+ */
+class UCBHELPER_DLLPUBLIC SimpleInteractionRequest final : public ucbhelper::InteractionRequest
+{
+public:
+ /**
+ * Constructor.
+ *
+ * @param rRequest is the exception describing the error.
+ * @param nContinuations contains the possible "answers" for the request.
+ * This can be any of the CONTINUATION_* constants combinations
+ * listed above.
+ */
+ SimpleInteractionRequest(const css::uno::Any& rRequest, const ContinuationFlags nContinuations);
+
+ /**
+ * After passing this request to XInteractionHandler::handle, this method
+ * returns the continuation that was chosen by the interaction handler.
+ *
+ * @return the continuation chosen by an interaction handler or
+ * ContinuationFlags::NONE, if the request was not (yet) handled.
+ */
+ ContinuationFlags getResponse() const;
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/simplenameclashresolverequest.hxx b/include/ucbhelper/simplenameclashresolverequest.hxx
new file mode 100644
index 000000000..f6826b43d
--- /dev/null
+++ b/include/ucbhelper/simplenameclashresolverequest.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_SIMPLENAMECLASHRESOLVEREQUEST_HXX
+#define INCLUDED_UCBHELPER_SIMPLENAMECLASHRESOLVEREQUEST_HXX
+
+#include <config_options.h>
+#include <rtl/ref.hxx>
+#include <ucbhelper/interactionrequest.hxx>
+#include <ucbhelper/ucbhelperdllapi.h>
+
+namespace ucbhelper
+{
+class InteractionSupplyName;
+
+/**
+ * This class implements a simple name clash resolve interaction request.
+ * Instances can be passed directly to XInteractionHandler::handle(...). Each
+ * instance contains a NameClashResolveRequest and two interaction
+ * continuations: "Abort" and "SupplyName". Another continuation
+ * ("ReplaceExistingData") may be supplied optionally.
+ *
+ * @see css::ucb::NameClashResolveRequest
+ * @see InteractionAbort
+ * @see InteractioneplaceExistingData
+ */
+class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) SimpleNameClashResolveRequest final
+ : public ucbhelper::InteractionRequest
+{
+ rtl::Reference<InteractionSupplyName> m_xNameSupplier;
+
+ virtual ~SimpleNameClashResolveRequest() override;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rTargetFolderURL contains the URL of the folder that contains
+ * the clashing resource.
+ * @param rClashingName contains the clashing name.
+ */
+ SimpleNameClashResolveRequest(const OUString& rTargetFolderURL, const OUString& rClashingName);
+ /**
+ * This method returns the new name that was supplied by the interaction
+ * handler.
+ *
+ * @return the new name, if supplied.
+ */
+ OUString const& getNewName() const;
+};
+
+} // namespace ucbhelper
+
+#endif /* ! INCLUDED_UCBHELPER_SIMPLENAMECLASHRESOLVEREQUEST_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/ucbhelper/ucbhelperdllapi.h b/include/ucbhelper/ucbhelperdllapi.h
new file mode 100644
index 000000000..739d76d0e
--- /dev/null
+++ b/include/ucbhelper/ucbhelperdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UCBHELPER_UCBHELPERDLLAPI_H
+#define INCLUDED_UCBHELPER_UCBHELPERDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(UCBHELPER_DLLIMPLEMENTATION)
+#define UCBHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define UCBHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define UCBHELPER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_UCBHELPER_UCBHELPERDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/Enterable.h b/include/uno/Enterable.h
new file mode 100644
index 000000000..f0323e681
--- /dev/null
+++ b/include/uno/Enterable.h
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_UNO_ENTERABLE_H
+#define INCLUDED_UNO_ENTERABLE_H
+
+#include "uno/environment.h"
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/** Generic function type declaration for entering an Environment.
+ (http://wiki.openoffice.org/wiki/Uno/Binary/Spec/Environment_Stack)
+
+ @param context
+ @since UDK 3.2.7
+*/
+typedef void uno_Enterable_enter (void * context);
+
+
+/** Generic function type declaration for leaving an Environment.
+ (http://wiki.openoffice.org/wiki/Uno/Binary/Spec/Environment_Stack)
+
+ @param context
+ @since UDK 3.2.7
+*/
+typedef void uno_Enterable_leave (void * context);
+
+
+/** Generic function type declaration for calling into an Environment.
+ (http://wiki.openoffice.org/wiki/Uno/Binary/Spec/Environment_Stack)
+
+ @param context
+ @param pCallee the function to be called
+ @param pParam the parameter pointer to be passed to the function
+ @since UDK 3.2.7
+*/
+typedef void uno_Enterable_callInto_v(void * context, uno_EnvCallee * pCallee, va_list * pParam);
+
+
+/** Generic function type declaration for calling out of an Environment.
+ (http://wiki.openoffice.org/wiki/Uno/Binary/Spec/Environment_Stack)
+
+ @param context
+ @param pCallee the function to be called
+ @param pParam the parameter pointer to be passed to the function
+ @since UDK 3.2.7
+*/
+typedef void uno_Enterable_callOut_v (void * context, uno_EnvCallee * pCallee, va_list * pParam);
+
+
+/** Generic function type declaration for checking if calling on managed object is
+ valid.
+ (http://wiki.openoffice.org/wiki/Uno/Binary/Spec/Environment_Stack)
+
+ @param context
+ @param ppReason the reason, in case calling is not valid
+ @return 0 == calling is not valid, 1 == calling is valid
+ @since UDK 3.2.7
+*/
+typedef int uno_Enterable_isValid_v (void * context, rtl_uString ** ppReason);
+
+
+/** A struct pReserved needs to point to, if implementing a purpose environment.
+ (http://wiki.openoffice.org/wiki/Uno/Binary/Spec/Environment_Stack)
+
+ @since UDK 3.2.7
+*/
+typedef struct
+{
+ uno_Enterable_enter * m_enter;
+ uno_Enterable_leave * m_leave;
+ uno_Enterable_callInto_v * m_callInto_v;
+ uno_Enterable_callOut_v * m_callOut_v;
+ uno_Enterable_isValid_v * m_isValid;
+}
+uno_Enterable;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/EnvDcp.h b/include/uno/EnvDcp.h
new file mode 100644
index 000000000..e181b61c1
--- /dev/null
+++ b/include/uno/EnvDcp.h
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_UNO_ENVDCP_H
+#define INCLUDED_UNO_ENVDCP_H
+
+#include "cppu/cppudllapi.h"
+#include "rtl/ustring.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** Get the OBI type part of an environment descriptor.
+ (http://wiki.openoffice.org/wiki/Uno/Binary/Spec/Environment_Descriptor)
+
+ @param pEnvDcp the Environment Descriptor
+ @param ppEnvTypeName the OBI type
+ @since UDK 3.2.7
+*/
+CPPU_DLLPUBLIC void uno_EnvDcp_getTypeName(rtl_uString const * pEnvDcp, rtl_uString ** ppEnvTypeName);
+
+
+/** Get the purpose part of an environment descriptor.
+ (http://wiki.openoffice.org/wiki/Uno/Binary/Spec/Environment_Descriptor)
+
+ @param pEnvDcp the Environment Descriptor
+ @param ppEnvPurpose the purpose
+ @since UDK 3.2.7
+*/
+CPPU_DLLPUBLIC void uno_EnvDcp_getPurpose (rtl_uString const * pEnvDcp, rtl_uString ** ppEnvPurpose);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/any2.h b/include/uno/any2.h
new file mode 100644
index 000000000..e5dbfea2b
--- /dev/null
+++ b/include/uno/any2.h
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_UNO_ANY2_H
+#define INCLUDED_UNO_ANY2_H
+
+#include "cppu/cppudllapi.h"
+#include "uno/data.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#if defined( _WIN32)
+#pragma pack(push, 8)
+#endif
+
+struct _typelib_TypeDescriptionReference;
+struct _typelib_TypeDescription;
+struct _uno_Mapping;
+
+/** This is the binary specification of a UNO any.
+*/
+typedef struct SAL_DLLPUBLIC_RTTI _uno_Any
+{
+ /** type of value
+ */
+ struct _typelib_TypeDescriptionReference * pType;
+ /** pointer to value; this may point to pReserved and thus the uno_Any is not anytime
+ mem-copyable! You may have to correct the pData pointer to pReserved. Otherwise you need
+ not, because the data is stored in heap space.
+ */
+ void * pData;
+ /** reserved space for storing value
+ */
+ void * pReserved;
+} uno_Any;
+
+#if defined( _WIN32)
+#pragma pack(pop)
+#endif
+
+/** Assign an any with a given value. Interfaces are acquired or released by the given callback
+ functions.
+
+ @param pDest pointer memory of destination any
+ @param pSource pointer to source value; defaults (0) to default constructed value
+ @param pTypeDescr type description of value; defaults (0) to void
+ @param acquire function called each time an interface needs to be acquired;
+ defaults (0) to uno
+ @param release function called each time an interface needs to be released;
+ defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_any_assign(
+ uno_Any * pDest, void * pSource,
+ struct _typelib_TypeDescription * pTypeDescr,
+ uno_AcquireFunc acquire, uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+/** Assign an any with a given value. Interfaces are acquired or released by the given callback
+ functions.
+
+ @param pDest pointer memory of destination any
+ @param pSource pointer to source value; defaults (0) to default constructed value
+ @param pType type description of value; defaults (0) to void
+ @param acquire function called each time an interface needs to be acquired;
+ defaults (0) to uno
+ @param release function called each time an interface needs to be released;
+ defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_type_any_assign(
+ uno_Any * pDest, void * pSource,
+ struct _typelib_TypeDescriptionReference * pType,
+ uno_AcquireFunc acquire, uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+
+/** Constructs an any with a given value. Interfaces are acquired by the given callback function.
+
+ @param pDest pointer memory of destination any
+ @param pSource pointer to source value; defaults (0) to default constructed value
+ @param pTypeDescr type description of value; defaults (0) to void
+ @param acquire function called each time an interface needs to be acquired;
+ defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_any_construct(
+ uno_Any * pDest, void * pSource,
+ struct _typelib_TypeDescription * pTypeDescr,
+ uno_AcquireFunc acquire )
+ SAL_THROW_EXTERN_C();
+/** Constructs an any with a given value. Interfaces are acquired by the given callback function.
+
+ @param pDest pointer memory of destination any
+ @param pSource pointer to source value; defaults (0) to default constructed value
+ @param pType type of value; defaults (0) to void
+ @param acquire function called each time an interface needs to be acquired;
+ defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_type_any_construct(
+ uno_Any * pDest, void * pSource,
+ struct _typelib_TypeDescriptionReference * pType,
+ uno_AcquireFunc acquire )
+ SAL_THROW_EXTERN_C();
+
+/** Constructs an any with a given value and converts/ maps interfaces.
+
+ @param pDest pointer memory of destination any
+ @param pSource pointer to source value; defaults (0) to default constructed value
+ @param pTypeDescr type description of value; defaults (0) to void
+ @param mapping mapping to convert/ map interfaces
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_any_constructAndConvert(
+ uno_Any * pDest, void * pSource,
+ struct _typelib_TypeDescription * pTypeDescr,
+ struct _uno_Mapping * mapping )
+ SAL_THROW_EXTERN_C();
+/** Constructs an any with a given value and converts/ maps interfaces.
+
+ @param pDest pointer memory of destination any
+ @param pSource pointer to source value; defaults (0) to default constructed value
+ @param pType type of value; defaults (0) to void
+ @param mapping mapping to convert/ map interfaces
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_type_any_constructAndConvert(
+ uno_Any * pDest, void * pSource,
+ struct _typelib_TypeDescriptionReference * pType,
+ struct _uno_Mapping * mapping )
+ SAL_THROW_EXTERN_C();
+
+/** Destructs an any.
+
+ @param pValue pointer to any
+ @param release function called each time an interface needs to be released;
+ defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_any_destruct(
+ uno_Any * pValue, uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+
+/** Sets value to void.
+
+ @param pValue pointer to any
+ @param release function called each time an interface needs to be released;
+ defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_any_clear(
+ uno_Any * pValue, uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/current_context.h b/include/uno/current_context.h
new file mode 100644
index 000000000..8e8095168
--- /dev/null
+++ b/include/uno/current_context.h
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_UNO_CURRENT_CONTEXT_H
+#define INCLUDED_UNO_CURRENT_CONTEXT_H
+
+#include "cppu/cppudllapi.h"
+#include "rtl/ustring.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** Gets the current task's context.
+ @attention
+ Don't spread the returned interface around to other threads. Every thread has its own
+ current context.
+
+ @param ppCurrentContext inout param current context of type com.sun.star.uno.XCurrentContext
+ @param pEnvDcp descriptor of returned interface's environment
+ @param pEnvContext context of returned interface's environment (commonly 0)
+ @return true, if context ref was transferred (even if null ref)
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_getCurrentContext(
+ void ** ppCurrentContext,
+ rtl_uString * pEnvDcp, void * pEnvContext )
+ SAL_THROW_EXTERN_C();
+
+/** Sets the current task's context.
+
+ @param pCurrentContext in param current context of type com.sun.star.uno.XCurrentContext
+ @param pEnvDcp descriptor of interface's environment
+ @param pEnvContext context of interface's environment (commonly 0)
+ @return true, if context ref was transferred (even if null ref)
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_setCurrentContext(
+ void * pCurrentContext,
+ rtl_uString * pEnvDcp, void * pEnvContext )
+ SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/current_context.hxx b/include/uno/current_context.hxx
new file mode 100644
index 000000000..dce03d9ee
--- /dev/null
+++ b/include/uno/current_context.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_UNO_CURRENT_CONTEXT_HXX
+#define INCLUDED_UNO_CURRENT_CONTEXT_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "uno/current_context.h"
+#include "uno/lbnames.h"
+
+#include "com/sun/star/uno/XCurrentContext.hpp"
+
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+/** Getting the current context.
+ @attention
+ Don't spread the returned interface around to other threads. Every thread has its own
+ current context.
+
+ @return current context or null ref, if none is set
+*/
+inline Reference< XCurrentContext > SAL_CALL getCurrentContext()
+{
+ Reference< XCurrentContext > xRet;
+ ::rtl::OUString aEnvTypeName( CPPU_CURRENT_LANGUAGE_BINDING_NAME );
+ ::uno_getCurrentContext( reinterpret_cast<void **>(&xRet), aEnvTypeName.pData, NULL );
+ return xRet;
+}
+/** Setting the current context.
+
+ @param xContext current context to be set
+ @return true, if context has been successfully set
+*/
+inline bool SAL_CALL setCurrentContext(
+ Reference< XCurrentContext > const & xContext )
+{
+ ::rtl::OUString aEnvTypeName( CPPU_CURRENT_LANGUAGE_BINDING_NAME );
+ return ::uno_setCurrentContext( xContext.get(), aEnvTypeName.pData, NULL );
+}
+
+/** Objects of this class are used for applying a current context until they are destructed, i.e.
+ the ctor of this class saves the previous and sets the given context while the dtor restores
+ the previous one upon destruction.
+*/
+class ContextLayer
+{
+ /** this C++ environment type name.
+ */
+ ::rtl::OUString m_aEnvTypeName;
+ /** previous context
+ */
+ Reference< XCurrentContext > m_xPreviousContext;
+
+public:
+ /** Constructor: Saves the previous context and sets the new (given) one.
+
+ @param xNewContext new context to be set
+ */
+ inline ContextLayer(
+ Reference< XCurrentContext > const & xNewContext = Reference< XCurrentContext >() );
+ /** Destructor: restores the previous context.
+ */
+ inline ~ContextLayer();
+
+ /** Gets the previously set context.
+
+ @return the previously set context
+ */
+ Reference< XCurrentContext > SAL_CALL getPreviousContext() const
+ { return m_xPreviousContext; }
+};
+
+inline ContextLayer::ContextLayer( Reference< XCurrentContext > const & xNewContext )
+ : m_aEnvTypeName( CPPU_CURRENT_LANGUAGE_BINDING_NAME )
+{
+ ::uno_getCurrentContext( reinterpret_cast<void **>(&m_xPreviousContext), m_aEnvTypeName.pData, NULL );
+ ::uno_setCurrentContext( xNewContext.get(), m_aEnvTypeName.pData, NULL );
+}
+
+inline ContextLayer::~ContextLayer()
+{
+ ::uno_setCurrentContext( m_xPreviousContext.get(), m_aEnvTypeName.pData, NULL );
+}
+
+}
+}
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/data.h b/include/uno/data.h
new file mode 100644
index 000000000..748b30d0a
--- /dev/null
+++ b/include/uno/data.h
@@ -0,0 +1,255 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_UNO_DATA_H
+#define INCLUDED_UNO_DATA_H
+
+#include "cppu/cppudllapi.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct _typelib_TypeDescriptionReference;
+struct _typelib_TypeDescription;
+struct _typelib_InterfaceTypeDescription;
+struct _uno_Mapping;
+
+/** Generic function pointer declaration to query for an interface.
+
+ @param pInterface interface
+ @param pType demanded interface type
+ @return interface pointer
+*/
+typedef void * (SAL_CALL * uno_QueryInterfaceFunc)(
+ void * pInterface, struct _typelib_TypeDescriptionReference * pType );
+/** Generic function pointer declaration to acquire an interface.
+
+ @param pInterface interface to be acquired
+*/
+typedef void (SAL_CALL * uno_AcquireFunc)(
+ void * pInterface );
+/** Generic function pointer declaration to release an interface.
+
+ @param pInterface interface to be release
+*/
+typedef void (SAL_CALL * uno_ReleaseFunc)(
+ void * pInterface );
+
+/** Tests if two values are equal. May compare different types (e.g., short to long).
+
+ @param pVal1 pointer to a value
+ @param pVal1TypeDescr type description of pVal1
+ @param pVal2 pointer to another value
+ @param pVal2TypeDescr type description of pVal2
+ @param queryInterface function called each time two interfaces are tested whether they belong
+ to the same object; defaults (0) to uno
+ @param release function to release queried interfaces; defaults (0) to uno
+ @return true if values are equal
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_equalData(
+ void * pVal1, struct _typelib_TypeDescription * pVal1TypeDescr,
+ void * pVal2, struct _typelib_TypeDescription * pVal2TypeDescr,
+ uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+/** Tests if two values are equal. May compare different types (e.g., short to long).
+
+ @param pVal1 pointer to a value
+ @param pVal1Type type of pVal1
+ @param pVal2 pointer to another value
+ @param pVal2Type type of pVal2
+ @param queryInterface function called each time two interfaces are tested whether they belong
+ to the same object; defaults (0) to uno
+ @param release function to release queried interfaces; defaults (0) to uno
+ @return true if values are equal
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_equalData(
+ void * pVal1, struct _typelib_TypeDescriptionReference * pVal1Type,
+ void * pVal2, struct _typelib_TypeDescriptionReference * pVal2Type,
+ uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+
+/** Copy construct memory with given value. The size of the destination value must be larger
+ or equal to the size of the source value.
+
+ @param pDest pointer to destination value memory
+ @param pSource pointer to source value
+ @param pTypeDescr type description of source
+ @param acquire function called each time an interface needs to be acquired;
+ defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_copyData(
+ void * pDest, void * pSource,
+ struct _typelib_TypeDescription * pTypeDescr, uno_AcquireFunc acquire )
+ SAL_THROW_EXTERN_C();
+/** Copy construct memory with given value. The size of the destination value must be larger
+ or equal to the size of the source value.
+
+ @param pDest pointer to destination value memory
+ @param pSource pointer to source value
+ @param pType type of source
+ @param acquire function called each time an interface needs to be acquired;
+ defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_type_copyData(
+ void * pDest, void * pSource,
+ struct _typelib_TypeDescriptionReference * pType, uno_AcquireFunc acquire )
+ SAL_THROW_EXTERN_C();
+
+/** Copy construct memory with given value. The size of the destination value must be larger
+ or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
+
+ @param pDest pointer to destination value memory
+ @param pSource pointer to source value
+ @param pTypeDescr type description of source
+ @param mapping mapping to convert/ map interfaces
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_copyAndConvertData(
+ void * pDest, void * pSource,
+ struct _typelib_TypeDescription * pTypeDescr, struct _uno_Mapping * mapping )
+ SAL_THROW_EXTERN_C();
+/** Copy construct memory with given value. The size of the destination value must be larger
+ or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
+
+ @param pDest pointer to destination value memory
+ @param pSource pointer to source value
+ @param pType type of source
+ @param mapping mapping to convert/ map interfaces
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_type_copyAndConvertData(
+ void * pDest, void * pSource,
+ struct _typelib_TypeDescriptionReference * pType, struct _uno_Mapping * mapping )
+ SAL_THROW_EXTERN_C();
+
+/** Destructs a given value; does NOT free its memory!
+
+ @param pValue value to be destructed
+ @param pTypeDescr type description of value
+ @param release function called each time an interface pointer needs to be released;
+ defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_destructData(
+ void * pValue, struct _typelib_TypeDescription * pTypeDescr, uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+/** Destructs a given value; does NOT free its memory!
+
+ @param pValue value to be destructed
+ @param pType type of value
+ @param release function called each time an interface pointer needs to be released;
+ defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_type_destructData(
+ void * pValue, struct _typelib_TypeDescriptionReference * pType, uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+
+/** Default constructs a value. All simple types are set to 0, enums are set to their default value.
+
+ @param pMem pointer to memory of value to be constructed
+ @param pTypeDescr type description of value to be constructed
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_constructData(
+ void * pMem, struct _typelib_TypeDescription * pTypeDescr )
+ SAL_THROW_EXTERN_C();
+/** Default constructs a value. All simple types are set to 0, enums are set to their default value.
+
+ @param pMem pointer to memory of value to be constructed
+ @param pType type of value to be constructed
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_type_constructData(
+ void * pMem, struct _typelib_TypeDescriptionReference * pType )
+ SAL_THROW_EXTERN_C();
+
+/** Assigns a destination value with a source value.
+ Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
+ Querying for demanded interface type is allowed.
+ Assignment from any value to a value of type Any and vice versa is allowed.
+
+ @param pDest pointer to destination value
+ @param pDestTypeDescr type description of destination value
+ @param pSource pointer to source value; if 0, then destination value will be assigned
+ to default value
+ @param pSourceTypeDescr type destination of source value
+ @param queryInterface function called each time an interface needs to be queried;
+ defaults (0) to uno
+ @param acquire function called each time an interface needs to be acquired;
+ defaults (0) to uno
+ @param release function called each time an interface needs to be released;
+ defaults (0) to uno
+ @return true if destination has been successfully assigned
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_assignData(
+ void * pDest, struct _typelib_TypeDescription * pDestTypeDescr,
+ void * pSource, struct _typelib_TypeDescription * pSourceTypeDescr,
+ uno_QueryInterfaceFunc queryInterface, uno_AcquireFunc acquire, uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+/** Assigns a destination value with a source value.
+ Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
+ Querying for demanded interface type is allowed.
+ Assignment from any value to a value of type Any and vice versa is allowed.
+
+ @param pDest pointer to destination value
+ @param pDestType type of destination value
+ @param pSource pointer to source value; if 0, then destination value will be assigned
+ to default value
+ @param pSourceType type of source value
+ @param queryInterface function called each time an interface needs to be queried;
+ defaults (0) to uno
+ @param acquire function called each time an interface needs to be acquired;
+ defaults (0) to uno
+ @param release function called each time an interface needs to be released;
+ defaults (0) to uno
+ @return true if destination has been successfully assigned
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_assignData(
+ void * pDest, struct _typelib_TypeDescriptionReference * pDestType,
+ void * pSource, struct _typelib_TypeDescriptionReference * pSourceType,
+ uno_QueryInterfaceFunc queryInterface, uno_AcquireFunc acquire, uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+
+/** Tests whether a value of given type is assignable from given value.
+ Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
+ Querying for demanded interface type is allowed.
+ Assignment from any value to a value of type Any and vice versa is allowed.
+
+ @param pAssignable type
+ @param pFrom pointer to value
+ @param pFromType type of value
+ @param queryInterface function called each time an interface needs to be queried;
+ defaults (0) to uno
+ @param release function called each time an interface needs to be released;
+ defaults (0) to uno
+ @return true if value is destination has been successfully assigned
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_isAssignableFromData(
+ struct _typelib_TypeDescriptionReference * pAssignable,
+ void * pFrom, struct _typelib_TypeDescriptionReference * pFromType,
+ uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/dispatcher.h b/include/uno/dispatcher.h
new file mode 100644
index 000000000..7de20d96f
--- /dev/null
+++ b/include/uno/dispatcher.h
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_UNO_DISPATCHER_H
+#define INCLUDED_UNO_DISPATCHER_H
+
+#include "sal/types.h"
+#include "uno/any2.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct _typelib_TypeDescription;
+struct _uno_Interface;
+
+/** Function pointer declaration for the binary C uno dispatch function. Any pure out or return
+ value will be constructed by the callee, iff no exception is signalled.
+ If an exception is signalled, the any *ppException is properly constructed by the callee,
+ otherwise the pointer *ppException is set to 0.
+ An attribute get call is indicated by a non-null return pointer.
+
+ @param pUnoI uno interface the call is performed on
+ @param pMemberType member type description of a method or attribute
+ @param pReturn pointer to return value memory;
+ pointer may be undefined if void method, null if attribute set call.
+ @param pArgs an array of pointers to arguments values.
+ (remark: the value of an interface reference stores a
+ uno_interface *, so you get it by *(uno_Interface **)pArgs[n])
+ @param ppException pointer to pointer to unconstructed any to signal an exception.
+*/
+typedef void (SAL_CALL * uno_DispatchMethod)(
+ struct _uno_Interface * pUnoI,
+ const struct _typelib_TypeDescription * pMemberType,
+ void * pReturn,
+ void * pArgs[],
+ uno_Any ** ppException );
+
+#if defined( _WIN32)
+#pragma pack(push, 8)
+#endif
+
+/** The binary C uno interface description.
+*/
+typedef struct SAL_DLLPUBLIC_RTTI _uno_Interface
+{
+ /** Acquires uno interface.
+
+ @param pInterface uno interface
+ */
+ void (SAL_CALL * acquire)( struct _uno_Interface * pInterface );
+ /** Releases uno interface.
+
+ @param pInterface uno interface
+ */
+ void (SAL_CALL * release)( struct _uno_Interface * pInterface );
+ /** dispatch function
+ */
+ uno_DispatchMethod pDispatcher;
+} uno_Interface;
+
+#if defined( _WIN32)
+#pragma pack(pop)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/dispatcher.hxx b/include/uno/dispatcher.hxx
new file mode 100644
index 000000000..1732be049
--- /dev/null
+++ b/include/uno/dispatcher.hxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_UNO_DISPATCHER_HXX
+#define INCLUDED_UNO_DISPATCHER_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "uno/dispatcher.h"
+
+/// @cond INTERNAL
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+/** C++ holder reference for binary C uno_Interface. Not for public use, may be
+ subject to changes.
+
+ @see uno_Interface
+ @attention
+ not for public use!
+*/
+class UnoInterfaceReference
+{
+public:
+ uno_Interface * m_pUnoI;
+
+ bool is() const
+ { return m_pUnoI != NULL; }
+
+ inline ~UnoInterfaceReference();
+ inline UnoInterfaceReference();
+ inline UnoInterfaceReference( uno_Interface * pUnoI, __sal_NoAcquire );
+ inline UnoInterfaceReference( uno_Interface * pUnoI );
+ inline UnoInterfaceReference( UnoInterfaceReference const & ref );
+
+#if defined LIBO_INTERNAL_ONLY
+ UnoInterfaceReference(UnoInterfaceReference && other) noexcept :
+ m_pUnoI(other.m_pUnoI)
+ { other.m_pUnoI = nullptr; }
+#endif
+
+ uno_Interface * get() const
+ { return m_pUnoI; }
+
+ inline UnoInterfaceReference & set(
+ uno_Interface * pUnoI );
+ inline UnoInterfaceReference & set(
+ uno_Interface * pUnoI, __sal_NoAcquire );
+ inline void clear();
+
+ UnoInterfaceReference & operator = (
+ UnoInterfaceReference const & ref )
+ { return set( ref.m_pUnoI ); }
+ UnoInterfaceReference & operator = (
+ uno_Interface * pUnoI )
+ { return set( pUnoI ); }
+
+#if defined LIBO_INTERNAL_ONLY
+ UnoInterfaceReference & operator =(UnoInterfaceReference && other) {
+ if (m_pUnoI != nullptr) {
+ (*m_pUnoI->release)(m_pUnoI);
+ }
+ m_pUnoI = other.m_pUnoI;
+ other.m_pUnoI = nullptr;
+ return *this;
+ }
+#endif
+
+ inline void dispatch(
+ struct _typelib_TypeDescription const * pMemberType,
+ void * pReturn, void * pArgs [], uno_Any ** ppException ) const;
+};
+
+
+inline UnoInterfaceReference::~UnoInterfaceReference()
+{
+ if (m_pUnoI != NULL)
+ (*m_pUnoI->release)( m_pUnoI );
+}
+
+
+inline UnoInterfaceReference::UnoInterfaceReference()
+ : m_pUnoI( NULL )
+{
+}
+
+
+inline UnoInterfaceReference::UnoInterfaceReference(
+ uno_Interface * pUnoI, __sal_NoAcquire )
+ : m_pUnoI( pUnoI )
+{
+}
+
+
+inline UnoInterfaceReference::UnoInterfaceReference( uno_Interface * pUnoI )
+ : m_pUnoI( pUnoI )
+{
+ if (m_pUnoI != NULL)
+ (*m_pUnoI->acquire)( m_pUnoI );
+}
+
+
+inline UnoInterfaceReference::UnoInterfaceReference(
+ UnoInterfaceReference const & ref )
+ : m_pUnoI( ref.m_pUnoI )
+{
+ if (m_pUnoI != NULL)
+ (*m_pUnoI->acquire)( m_pUnoI );
+}
+
+
+inline UnoInterfaceReference & UnoInterfaceReference::set(
+ uno_Interface * pUnoI )
+{
+ if (pUnoI != NULL)
+ (*pUnoI->acquire)( pUnoI );
+ if (m_pUnoI != NULL)
+ (*m_pUnoI->release)( m_pUnoI );
+ m_pUnoI = pUnoI;
+ return *this;
+}
+
+
+inline UnoInterfaceReference & UnoInterfaceReference::set(
+ uno_Interface * pUnoI, __sal_NoAcquire )
+{
+ if (m_pUnoI != NULL)
+ (*m_pUnoI->release)( m_pUnoI );
+ m_pUnoI = pUnoI;
+ return *this;
+}
+
+
+inline void UnoInterfaceReference::clear()
+{
+ if (m_pUnoI != NULL)
+ {
+ (*m_pUnoI->release)( m_pUnoI );
+ m_pUnoI = NULL;
+ }
+}
+
+
+inline void UnoInterfaceReference::dispatch(
+ struct _typelib_TypeDescription const * pMemberType,
+ void * pReturn, void * pArgs [], uno_Any ** ppException ) const
+{
+ (*m_pUnoI->pDispatcher)(
+ m_pUnoI, pMemberType, pReturn, pArgs, ppException );
+}
+
+}
+}
+}
+}
+
+/// @endcond
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/environment.h b/include/uno/environment.h
new file mode 100644
index 000000000..700d9c18e
--- /dev/null
+++ b/include/uno/environment.h
@@ -0,0 +1,389 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_UNO_ENVIRONMENT_H
+#define INCLUDED_UNO_ENVIRONMENT_H
+
+#include "cppu/cppudllapi.h"
+#include "rtl/ustring.h"
+
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct _uno_ExtEnvironment;
+struct _typelib_InterfaceTypeDescription;
+
+#if defined( _WIN32)
+#pragma pack(push, 8)
+#endif
+
+/** The binary specification of a UNO environment.
+*/
+typedef struct SAL_DLLPUBLIC_RTTI _uno_Environment
+{
+ /** reserved for future use (0 if not used)
+ */
+ void * pReserved;
+
+ /** type name of environment
+ */
+ rtl_uString * pTypeName;
+
+ /** free context pointer to be used for specific classes of environments (e.g., a jvm pointer)
+ */
+ void * pContext;
+
+ /** pointer to extended environment (interface registration functionality), if supported
+ */
+ struct _uno_ExtEnvironment * pExtEnv;
+
+ /** Acquires this environment.
+
+ @param pEnv this environment
+ */
+ void (SAL_CALL * acquire)( struct _uno_Environment * pEnv );
+
+ /** Releases this environment; last release of environment will revoke the environment from
+ runtime.
+
+ @param pEnv this environment
+ */
+ void (SAL_CALL * release)( struct _uno_Environment * pEnv );
+
+ /** Acquires this environment weakly. You can only harden a weakly held environment if it
+ is still acquired hard (acquire()).
+
+ @param pEnv this environment
+ */
+ void (SAL_CALL * acquireWeak)( struct _uno_Environment * pEnv );
+
+ /** Releases this environment weakly in correspondence to acquireWeak().
+
+ @param pEnv this environment
+ */
+ void (SAL_CALL * releaseWeak)( struct _uno_Environment * pEnv );
+
+ /** Makes hard reference out of weak referenced environment. You can only harden a weakly
+ held environment if it is still acquired hard (acquire()).
+
+ @param ppHardEnv inout hard referenced environment (has to be released via release())
+ @param pEnv environment (may be weak referenced)
+ */
+ void (SAL_CALL * harden)(
+ struct _uno_Environment ** ppHardEnv,
+ struct _uno_Environment * pEnv );
+
+ /** Call this function to EXPLICITLY dispose this environment (e.g., release all
+ interfaces). You may want to call this function before shutting down due to a runtime error.
+
+ @param pEnv this environment
+ */
+ void (SAL_CALL * dispose)( struct _uno_Environment * pEnv );
+
+ /* ===== the following part will be late initialized by a matching bridge ===== *
+ * ===== and is NOT for public use. ===== */
+
+ /** CALLBACK function pointer: Disposing callback function pointer that can be set to get
+ signalled before the environment is destroyed.
+
+ @param pEnv environment that is being disposed
+ */
+ void (SAL_CALL * environmentDisposing)( struct _uno_Environment * pEnv );
+} uno_Environment;
+
+/** Generic function pointer declaration to free a proxy object if it is not needed by the
+ environment anymore.
+ Any proxy object must register itself on first acquire() call and revoke itself on last
+ release() call. This can happen several times because the environment caches proxy objects
+ until the environment explicitly frees the proxy object calling this function.
+
+ @param pEnv environment
+ @param pProxy proxy pointer
+*/
+typedef void (SAL_CALL * uno_freeProxyFunc)( struct _uno_ExtEnvironment * pEnv, void * pProxy );
+
+/** Generic function pointer declaration to allocate memory. Used with getRegisteredInterfaces().
+
+ @param nBytes amount of memory in bytes
+ @return pointer to allocated memory
+*/
+typedef void * (SAL_CALL * uno_memAlloc)( sal_Size nBytes );
+
+/** The binary specification of a UNO environment supporting interface registration.
+*/
+typedef struct SAL_DLLPUBLIC_RTTI _uno_ExtEnvironment
+{
+ /** inherits all members of a uno_Environment
+ */
+ uno_Environment aBase;
+
+ /** Registers an interface of this environment.
+
+ @param pEnv this environment
+ @param ppInterface inout parameter of interface to be registered
+ @param pOId object id of interface
+ @param pTypeDescr type description of interface
+ */
+ void (SAL_CALL * registerInterface)(
+ struct _uno_ExtEnvironment * pEnv,
+ void ** ppInterface,
+ rtl_uString * pOId,
+ struct _typelib_InterfaceTypeDescription * pTypeDescr );
+
+ /** Registers a proxy interface of this environment that can be reanimated and is freed
+ explicitly by this environment.
+
+ @param pEnv this environment
+ @param ppInterface inout parameter of interface to be registered
+ @param freeProxy function to free proxy object
+ @param pOId object id of interface
+ @param pTypeDescr type description of interface
+ */
+ void (SAL_CALL * registerProxyInterface)(
+ struct _uno_ExtEnvironment * pEnv,
+ void ** ppProxy,
+ uno_freeProxyFunc freeProxy,
+ rtl_uString * pOId,
+ struct _typelib_InterfaceTypeDescription * pTypeDescr );
+
+ /** Revokes an interface from this environment. You have to revoke any interface that has
+ been registered via this method.
+
+ @param pEnv this environment
+ @param pInterface interface to be revoked
+ */
+ void (SAL_CALL * revokeInterface)(
+ struct _uno_ExtEnvironment * pEnv,
+ void * pInterface );
+
+ /** Provides the object id of a given interface.
+
+ @param ppOut inout oid
+ @param pInterface interface of object
+ */
+ void (SAL_CALL * getObjectIdentifier)(
+ struct _uno_ExtEnvironment * pEnv,
+ rtl_uString ** ppOId,
+ void * pInterface );
+
+ /** Retrieves an interface identified by its object id and type from this environment.
+ Interfaces are retrieved in the same order as they are registered.
+
+ @param pEnv this environment
+ @param ppInterface inout parameter for the registered interface; (0) if none was found
+ @param pOId object id of interface to be retrieved
+ @param pTypeDescr type description of interface to be retrieved
+ */
+ void (SAL_CALL * getRegisteredInterface)(
+ struct _uno_ExtEnvironment * pEnv,
+ void ** ppInterface,
+ rtl_uString * pOId,
+ struct _typelib_InterfaceTypeDescription * pTypeDescr );
+
+ /** Returns all currently registered interfaces of this environment. The memory block
+ allocated might be slightly larger than (*pnLen * sizeof(void *)).
+
+ @param pEnv this environment
+ @param pppInterfaces out param; pointer to array of interface pointers
+ @param pnLen out param; length of array
+ @param memAlloc function for allocating memory that is passed back
+ */
+ void (SAL_CALL * getRegisteredInterfaces)(
+ struct _uno_ExtEnvironment * pEnv,
+ void *** pppInterfaces,
+ sal_Int32 * pnLen,
+ uno_memAlloc memAlloc );
+
+ /* ===== the following part will be late initialized by a matching bridge ===== */
+
+ /** Computes an object id of the given interface; is called by the environment implementation.
+
+ @param pEnv corresponding environment
+ @param ppOId out param: computed id
+ @param pInterface an interface
+ */
+ void (SAL_CALL * computeObjectIdentifier)(
+ struct _uno_ExtEnvironment * pEnv,
+ rtl_uString ** ppOId, void * pInterface );
+
+ /** Function to acquire an interface.
+
+ @param pEnv corresponding environment
+ @param pInterface an interface
+ */
+ void (SAL_CALL * acquireInterface)(
+ struct _uno_ExtEnvironment * pEnv,
+ void * pInterface );
+
+ /** Function to release an interface.
+
+ @param pEnv corresponding environment
+ @param pInterface an interface
+ */
+ void (SAL_CALL * releaseInterface)(
+ struct _uno_ExtEnvironment * pEnv,
+ void * pInterface );
+
+} uno_ExtEnvironment;
+
+#if defined( _WIN32)
+#pragma pack(pop)
+#endif
+
+/** Function exported by some bridge library providing acquireInterface(), releaseInterface();
+ may set a disposing callback.
+
+ @param pEnv environment to be initialized
+*/
+typedef void (SAL_CALL * uno_initEnvironmentFunc)( uno_Environment * pEnv );
+#define UNO_INIT_ENVIRONMENT "uno_initEnvironment"
+
+#ifdef DISABLE_DYNLOADING
+/* We link statically and have just the C++ environment */
+void SAL_CALL CPPU_ENV_uno_initEnvironment( uno_Environment * Env )
+ SAL_THROW_EXTERN_C();
+
+/* We might also have the Java environment */
+void SAL_CALL java_uno_initEnvironment( uno_Environment * Env )
+ SAL_THROW_EXTERN_C();
+#endif
+
+/** Gets a specific environment. If the specified environment does not exist, then a default one
+ is created and registered. The environment revokes itself on last release() call.
+
+ @param ppEnv inout parameter of environment; given environment will be released
+ @param pEnvDcp descriptor of environment
+ @param pContext some context pointer (e.g., to distinguish java vm; set 0 if not needed)
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_getEnvironment(
+ uno_Environment ** ppEnv, rtl_uString * pEnvDcp, void * pContext )
+ SAL_THROW_EXTERN_C();
+
+/** Gets all specified environments. Caller has to release returned environments and free allocated
+ memory.
+
+ @param pppEnvs out param; pointer to array of environments
+ @param pnLen out param; length of array
+ @param memAlloc function for allocating memory that is passed back
+ @param pEnvDcp descriptor of environments; 0 defaults to all
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_getRegisteredEnvironments(
+ uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc,
+ rtl_uString * pEnvDcp )
+ SAL_THROW_EXTERN_C();
+
+/** Creates an environment. The new environment is anonymous (NOT publicly registered/ accessible).
+
+ @param ppEnv out parameter of environment; given environment will be released
+ @param pEnvDcp descriptor of environment
+ @param pContext context pointer (e.g., to distinguish java vm); set 0 if not needed
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_createEnvironment(
+ uno_Environment ** ppEnv, rtl_uString * pEnvDcp, void * pContext )
+ SAL_THROW_EXTERN_C();
+
+/** Dumps out environment information, i.e. registered interfaces.
+
+ @param stream output stream (FILE *)
+ @param pEnv environment to be dumped
+ @param pFilter if not null, filters output
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_dumpEnvironment(
+ void * stream, uno_Environment * pEnv, const char * pFilter )
+ SAL_THROW_EXTERN_C();
+/** Dumps out environment information, i.e. registered interfaces.
+
+ @param stream output stream (FILE *)
+ @param pEnvDcp descriptor of environment to be dumped
+ @param pFilter if not null, filters output
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_dumpEnvironmentByName(
+ void * stream, rtl_uString * pEnvDcp, const char * pFilter )
+ SAL_THROW_EXTERN_C();
+
+
+
+/** Returns the current Environment.
+ In case no Environment has explicitly been entered, a purpose free
+ default environment gets returned (e.g. the "uno" or "gcc3" Environment).
+
+ @param ppEnv inout parameter; a given environment will be released
+ @param pTypeName the optional type of the environment, falls back to "uno"
+ @since UDK 3.2.7
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl_uString * pTypeName)
+ SAL_THROW_EXTERN_C();
+
+/** Typedef for variable argument function.
+ */
+typedef void SAL_CALL uno_EnvCallee(va_list * pParam);
+
+/** Invoke the passed function in the given environment.
+
+ @param pEnv the target environment
+ @param pCallee the function to call
+ @param pParam the parameter pointer passed to the function
+ @since UDK 3.2.7
+ */
+CPPU_DLLPUBLIC void SAL_CALL uno_Environment_invoke_v(uno_Environment * pEnv, uno_EnvCallee * pCallee, va_list * pParam)
+ SAL_THROW_EXTERN_C();
+
+/** Invoke the passed function in the given environment.
+
+ @param pEnv the target environment
+ @param pCallee the function to call
+ @param ... the parameters passed to the function
+ @since UDK 3.2.7
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_Environment_invoke (uno_Environment * pEnv, uno_EnvCallee * pCallee, ...)
+ SAL_THROW_EXTERN_C();
+
+/** Enter an environment explicitly.
+
+ @param pEnv the environment to enter; NULL leaves all environments
+ @since UDK 3.2.7
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_Environment_enter(uno_Environment * pEnv)
+ SAL_THROW_EXTERN_C();
+
+/** Check if a particular environment is currently valid, so
+ that objects of that environment might be called.
+
+ @param pEnv the environment
+ @param pReason the reason, if it is not valid
+ @return 1 == valid, 0 == invalid
+ @since UDK 3.2.7
+*/
+CPPU_DLLPUBLIC int SAL_CALL uno_Environment_isValid(uno_Environment * pEnv, rtl_uString ** pReason)
+ SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/environment.hxx b/include/uno/environment.hxx
new file mode 100644
index 000000000..8a26e268d
--- /dev/null
+++ b/include/uno/environment.hxx
@@ -0,0 +1,290 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_UNO_ENVIRONMENT_HXX
+#define INCLUDED_UNO_ENVIRONMENT_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "rtl/alloc.h"
+#include "rtl/ustring.hxx"
+#include "uno/environment.h"
+
+#include "uno/lbnames.h"
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+/** C++ wrapper for binary C uno_Environment.
+
+ @see uno_Environment
+*/
+class Environment
+{
+ /** binary C uno_Environment
+ */
+ uno_Environment * _pEnv;
+
+public:
+ /** Returns the current Environment.
+
+ @param typeName the optional type of the Environment, falls back to "uno" in case being empty,
+ respectively to current C++ Environment.
+ @since UDK 3.2.7
+ */
+ inline static Environment getCurrent(rtl::OUString const & typeName = rtl::OUString(CPPU_CURRENT_LANGUAGE_BINDING_NAME));
+
+ /// @cond INTERNAL
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new ( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete ( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new ( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete ( void *, void * )
+ {}
+ /// @endcond
+
+ /** Constructor: acquires given environment
+
+ @param pEnv environment
+ */
+ inline Environment( uno_Environment * pEnv = NULL );
+
+ /** Gets a specific environment. If the specified environment does not exist, then a default one
+ is created and registered.
+
+ @param envDcp descriptor of the environment
+ @param pContext context pointer
+ */
+ inline explicit Environment( rtl::OUString const & envDcp, void * pContext = NULL );
+
+
+ /** Copy constructor: acquires given environment
+
+ @param rEnv another environment
+ */
+ inline Environment( const Environment & rEnv );
+
+#if defined LIBO_INTERNAL_ONLY
+ Environment(Environment && other) noexcept : _pEnv(other._pEnv)
+ { other._pEnv = nullptr; }
+#endif
+
+ /** Destructor: releases a set environment.
+ */
+ inline ~Environment();
+
+ /** Sets a given environment, i.e. acquires given one and releases a set one.
+
+ @param pEnv another environment
+ @return this environment
+ */
+ inline Environment & SAL_CALL operator = ( uno_Environment * pEnv );
+ /** Sets a given environment, i.e. acquires given one and releases a set one.
+
+ @param rEnv another environment
+ @return this environment
+ */
+ Environment & SAL_CALL operator = ( const Environment & rEnv )
+ { return operator = ( rEnv._pEnv ); }
+
+#if defined LIBO_INTERNAL_ONLY
+ Environment & operator =(Environment && other) {
+ if (_pEnv != nullptr) {
+ (*_pEnv->release)(_pEnv);
+ }
+ _pEnv = other._pEnv;
+ other._pEnv = nullptr;
+ return *this;
+ }
+#endif
+
+ /** Provides UNacquired pointer to the set C environment.
+
+ @return UNacquired pointer to the C environment struct
+ */
+ uno_Environment * SAL_CALL get() const
+ { return _pEnv; }
+
+ /** Gets type name of set environment.
+
+ @return type name of set environment
+ */
+ ::rtl::OUString SAL_CALL getTypeName() const
+ { return _pEnv->pTypeName; }
+
+ /** Gets free context pointer of set environment.
+
+ @return free context pointer of set environment
+ */
+ void * SAL_CALL getContext() const
+ { return _pEnv->pContext; }
+
+ /** Tests if an environment is set.
+
+ @return true, if an environment is set, false otherwise
+ */
+ bool SAL_CALL is() const
+ { return (_pEnv != NULL); }
+
+ /** Releases a set environment.
+ */
+ inline void SAL_CALL clear();
+
+ /** Invoke the passed function in this environment.
+
+ @param pCallee the function to call
+ @param pParam the parameter pointer to be passed to the function
+ @since UDK 3.2.7
+ */
+ inline void SAL_CALL invoke_v(uno_EnvCallee * pCallee, va_list * pParam) const;
+
+ /** Invoke the passed function in this environment.
+
+ @param pCallee the function to call
+ @param ... the parameters to be passed to the function
+ @since UDK 3.2.7
+ */
+ inline void SAL_CALL invoke(uno_EnvCallee * pCallee, ...) const;
+
+ /** Enter this environment explicitly.
+
+ @since UDK 3.2.7
+ */
+ inline void SAL_CALL enter() const;
+
+ /** Checks, if it is valid to currently call objects
+ belonging to this environment.
+
+ @since UDK 3.2.7
+ */
+ inline int SAL_CALL isValid(rtl::OUString * pReason) const;
+};
+
+inline Environment::Environment( uno_Environment * pEnv )
+ : _pEnv( pEnv )
+{
+ if (_pEnv)
+ (*_pEnv->acquire)( _pEnv );
+}
+
+inline Environment::Environment( rtl::OUString const & rEnvDcp, void * pContext )
+ : _pEnv(NULL)
+{
+ uno_getEnvironment(&_pEnv, rEnvDcp.pData, pContext);
+}
+
+inline Environment::Environment( const Environment & rEnv )
+ : _pEnv( rEnv._pEnv )
+{
+ if (_pEnv)
+ (*_pEnv->acquire)( _pEnv );
+}
+
+inline Environment::~Environment()
+{
+ if (_pEnv)
+ (*_pEnv->release)( _pEnv );
+}
+
+inline void Environment::clear()
+{
+ if (_pEnv)
+ {
+ (*_pEnv->release)( _pEnv );
+ _pEnv = NULL;
+ }
+}
+
+inline Environment & Environment::operator = ( uno_Environment * pEnv )
+{
+ if (pEnv != _pEnv)
+ {
+ if (pEnv)
+ (*pEnv->acquire)( pEnv );
+ if (_pEnv)
+ (*_pEnv->release)( _pEnv );
+ _pEnv = pEnv;
+ }
+ return *this;
+}
+
+inline void SAL_CALL Environment::invoke_v(uno_EnvCallee * pCallee, va_list * pParam) const
+{
+ if (_pEnv)
+ uno_Environment_invoke_v(_pEnv, pCallee, pParam);
+}
+
+inline void SAL_CALL Environment::invoke(uno_EnvCallee * pCallee, ...) const
+{
+ if (_pEnv)
+ {
+ va_list param;
+
+ va_start(param, pCallee);
+ uno_Environment_invoke_v(_pEnv, pCallee, &param);
+ va_end(param);
+ }
+
+}
+
+inline void SAL_CALL Environment::enter() const
+{
+ uno_Environment_enter(_pEnv);
+}
+
+inline int SAL_CALL Environment::isValid(rtl::OUString * pReason) const
+{
+ return uno_Environment_isValid(_pEnv, &pReason->pData);
+}
+
+inline Environment Environment::getCurrent(rtl::OUString const & typeName)
+{
+ Environment environment;
+
+ uno_Environment * pEnv = NULL;
+ uno_getCurrentEnvironment(&pEnv, typeName.pData);
+ environment = pEnv;
+ if (pEnv)
+ pEnv->release(pEnv);
+
+ return environment;
+}
+
+}
+}
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/lbnames.h b/include/uno/lbnames.h
new file mode 100644
index 000000000..56f9d9942
--- /dev/null
+++ b/include/uno/lbnames.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_UNO_LBNAMES_H
+#define INCLUDED_UNO_LBNAMES_H
+
+/* I assume "LB" means "Language Binding" */
+
+#include "sal/config.h"
+
+#include "sal/macros.h"
+
+#ifdef __cplusplus
+
+#ifdef CPPU_ENV
+
+/** Name for C++ compiler/ platform, e.g. "gcc3", "msci" */
+#define CPPU_CURRENT_LANGUAGE_BINDING_NAME SAL_STRINGIFY(CPPU_ENV)
+
+#else
+
+#error "No supported C++ compiler environment."
+provoking error here, because PP ignores #error
+
+#endif /* CPPU_ENV */
+
+#endif /* __cplusplus */
+
+/** Environment type name for binary C UNO. */
+#define UNO_LB_UNO "uno"
+/** Environment type name for Java 1.3.1 compatible virtual machine. */
+#define UNO_LB_JAVA "java"
+/** Environment type name for CLI (Common Language Infrastructure). */
+#define UNO_LB_CLI "cli"
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/mapping.h b/include/uno/mapping.h
new file mode 100644
index 000000000..44ea09596
--- /dev/null
+++ b/include/uno/mapping.h
@@ -0,0 +1,216 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_UNO_MAPPING_H
+#define INCLUDED_UNO_MAPPING_H
+
+#include "cppu/cppudllapi.h"
+#include "rtl/ustring.h"
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct _typelib_InterfaceTypeDescription;
+struct _uno_Mapping;
+struct _uno_Environment;
+
+/**
+ Function pointer declaration to acquire a UNO mapping.
+*/
+typedef void (SAL_CALL * uno_AcquireMappingFunc)(struct _uno_Mapping *);
+
+/**
+ Function pointer declaration to release a UNO mapping.
+*/
+typedef void (SAL_CALL * uno_ReleaseMappingFunc)(struct _uno_Mapping *);
+
+/** Function pointer declaration to map an interface from one environment to another.
+
+ @param pMapping mapping
+ @param ppOut [inout] destination interface; existing interfaces are released
+ @param pInterface source interface
+ @param pInterfaceTypeDescr type description of the interface
+*/
+typedef void (SAL_CALL * uno_MapInterfaceFunc)(
+ struct _uno_Mapping * pMapping,
+ void ** ppOut, void * pInterface,
+ struct _typelib_InterfaceTypeDescription * pInterfaceTypeDescr );
+
+
+#if defined( _WIN32)
+#pragma pack(push, 8)
+#endif
+
+/** This is the binary specification of a mapping.
+*/
+typedef struct SAL_DLLPUBLIC_RTTI _uno_Mapping
+{
+ /** Acquires mapping
+ */
+ uno_AcquireMappingFunc acquire;
+
+ /** Releases mapping. The last release may unload bridges.
+ */
+ uno_ReleaseMappingFunc release;
+
+ /** mapping function
+ */
+ uno_MapInterfaceFunc mapInterface;
+} uno_Mapping;
+
+#if defined( _WIN32)
+#pragma pack(pop)
+#endif
+
+/** Gets an interface mapping from one environment to another.
+
+ @param ppMapping [inout] mapping; existing mapping will be released
+ @param pFrom source environment
+ @param pTo destination environment
+ (interfaces resulting in mapInterface() call can be used
+ in this language environment)
+ @param pAddPurpose additional purpose of mapping (e.g., protocolling); defaults to 0 (none)
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_getMapping(
+ struct _uno_Mapping ** ppMapping,
+ struct _uno_Environment * pFrom,
+ struct _uno_Environment * pTo,
+ rtl_uString * pAddPurpose )
+ SAL_THROW_EXTERN_C();
+
+/** Callback function pointer declaration to get a mapping.
+
+ @param ppMapping inout mapping
+ @param pFrom source environment
+ @param pTo destination environment
+ @param pAddPurpose additional purpose
+*/
+typedef void (SAL_CALL * uno_getMappingFunc)(
+ struct _uno_Mapping ** ppMapping,
+ struct _uno_Environment * pFrom,
+ struct _uno_Environment * pTo,
+ rtl_uString * pAddPurpose );
+
+/** Registers a callback being called each time a mapping is demanded.
+
+ @param pCallback callback function
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_registerMappingCallback(
+ uno_getMappingFunc pCallback )
+ SAL_THROW_EXTERN_C();
+
+/** Revokes a mapping callback registration.
+
+ @param pCallback callback function
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_revokeMappingCallback(
+ uno_getMappingFunc pCallback )
+ SAL_THROW_EXTERN_C();
+
+/** Function pointer declaration to free a mapping.
+
+ @param pMapping mapping to be freed
+*/
+typedef void (SAL_CALL * uno_freeMappingFunc)( struct _uno_Mapping * pMapping );
+
+/** Registers a mapping. A mapping registers itself on first acquire and revokes itself on last
+ release. The given freeMapping function is called by the runtime to cleanup any resources.
+
+ @param ppMapping inout mapping to be registered
+ @param freeMapping called by runtime to delete mapping
+ @param pFrom source environment
+ @param pTo destination environment
+ @param pAddPurpose additional purpose string; defaults to 0
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_registerMapping(
+ struct _uno_Mapping ** ppMapping, uno_freeMappingFunc freeMapping,
+ struct _uno_Environment * pFrom, struct _uno_Environment * pTo, rtl_uString * pAddPurpose )
+ SAL_THROW_EXTERN_C();
+
+/** Revokes a mapping. A mapping registers itself on first acquire and revokes itself on last
+ release.
+
+ @param pMapping mapping to be revoked
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_revokeMapping(
+ struct _uno_Mapping * pMapping )
+ SAL_THROW_EXTERN_C();
+
+/** Gets an interface mapping from one language environment to another by corresponding environment
+ type names.
+
+ @param ppMapping [inout] mapping; existing mapping will be released
+ @param pFrom source environment type name
+ @param pTo destination environment type name
+ (interfaces resulting in mapInterface() call can be used
+ in this language environment)
+ @param pAddPurpose additional purpose of mapping (e.g., protocolling); defaults to 0 (none)
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_getMappingByName(
+ struct _uno_Mapping ** ppMapping,
+ rtl_uString * pFrom,
+ rtl_uString * pTo,
+ rtl_uString * pAddPurpose )
+ SAL_THROW_EXTERN_C();
+
+/* symbol exported by each language binding library */
+#define UNO_EXT_GETMAPPING "uno_ext_getMapping"
+
+/** Function pointer declaration to get a mapping from a loaded bridge. Bridges export a function
+ called uno_ext_getMapping() of this signature.
+
+ @param[in,out] ppMapping mapping; existing mapping will be released
+ @param[in] pFrom source environment
+ @param[in] pTo destination environment
+*/
+typedef void (SAL_CALL * uno_ext_getMappingFunc)(
+ struct _uno_Mapping ** ppMapping,
+ struct _uno_Environment * pFrom,
+ struct _uno_Environment * pTo );
+
+#ifdef DISABLE_DYNLOADING
+/* Static linking, this is the uno_ext_getMapping function in the C++/UNO bridge */
+void SAL_CALL CPPU_ENV_uno_ext_getMapping(
+ struct _uno_Mapping ** ppMapping,
+ struct _uno_Environment * pFrom,
+ struct _uno_Environment * pTo )
+ SAL_THROW_EXTERN_C();
+
+/* This is the uno_ext_getMapping function in the Java/UNO bridge */
+void SAL_CALL java_uno_ext_getMapping(
+ struct _uno_Mapping ** ppMapping,
+ struct _uno_Environment * pFrom,
+ struct _uno_Environment * pTo )
+ SAL_THROW_EXTERN_C();
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/mapping.hxx b/include/uno/mapping.hxx
new file mode 100644
index 000000000..5b8cf41be
--- /dev/null
+++ b/include/uno/mapping.hxx
@@ -0,0 +1,360 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_UNO_MAPPING_HXX
+#define INCLUDED_UNO_MAPPING_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "uno/lbnames.h"
+#include "rtl/alloc.h"
+#include "rtl/ustring.hxx"
+#include "osl/diagnose.h"
+#include "uno/mapping.h"
+#include "com/sun/star/uno/Type.hxx"
+#include "com/sun/star/uno/Reference.hxx"
+#include "cppu/unotype.hxx"
+#include "uno/environment.hxx"
+
+typedef struct _typelib_TypeDescription typelib_TypeDescription;
+typedef struct _typelib_InterfaceTypeDescription typelib_InterfaceTypeDescription;
+typedef struct _uno_Interface uno_Interface;
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+
+/** C++ wrapper for C uno_Mapping.
+
+ @see uno_Mapping
+*/
+class Mapping
+{
+ uno_Mapping * _pMapping;
+
+public:
+ // these are here to force memory de/allocation to sal lib.
+ /// @cond INTERNAL
+ static void * SAL_CALL operator new ( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete ( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ static void * SAL_CALL operator new ( size_t, void * pMem )
+ { return pMem; }
+ static void SAL_CALL operator delete ( void *, void * )
+ {}
+ /// @endcond
+
+ /** Holds a mapping from the specified source to the specified destination by environment
+ type names.
+
+ @param rFrom type name of source environment
+ @param rTo type name of destination environment
+ @param rAddPurpose additional purpose
+ */
+ inline Mapping(
+ const ::rtl::OUString & rFrom, const ::rtl::OUString & rTo,
+ const ::rtl::OUString & rAddPurpose = ::rtl::OUString() );
+
+ /** Holds a mapping from the specified source to the specified destination.
+
+ @param pFrom source environment
+ @param pTo destination environment
+ @param rAddPurpose additional purpose
+ */
+ inline Mapping(
+ uno_Environment * pFrom, uno_Environment * pTo,
+ const ::rtl::OUString & rAddPurpose = ::rtl::OUString() );
+
+ /** Holds a mapping from the specified source to the specified destination
+ environment.
+
+ @param rFrom source environment
+ @param rTo destination environment
+ @param rAddPurpose additional purpose
+ */
+ inline Mapping(const Environment & rFrom, const Environment & rTo,
+ const ::rtl::OUString & rAddPurpose = ::rtl::OUString() );
+
+ /** Constructor.
+
+ @param pMapping another mapping
+ */
+ inline Mapping( uno_Mapping * pMapping = NULL );
+
+ /** Copy constructor.
+
+ @param rMapping another mapping
+ */
+ inline Mapping( const Mapping & rMapping );
+
+#if defined LIBO_INTERNAL_ONLY
+ Mapping(Mapping && other) noexcept : _pMapping(other._pMapping)
+ { other._pMapping = nullptr; }
+#endif
+
+ /** Destructor.
+ */
+ inline ~Mapping();
+
+ /** Sets a given mapping.
+
+ @param pMapping another mapping
+ @return this mapping
+ */
+ inline Mapping & SAL_CALL operator = ( uno_Mapping * pMapping );
+ /** Sets a given mapping.
+
+ @param rMapping another mapping
+ @return this mapping
+ */
+ Mapping & SAL_CALL operator = ( const Mapping & rMapping )
+ { return operator = ( rMapping._pMapping ); }
+
+#if defined LIBO_INTERNAL_ONLY
+ Mapping & operator =(Mapping && other) noexcept {
+ if (_pMapping != nullptr) {
+ (*_pMapping->release)(_pMapping);
+ }
+ _pMapping = other._pMapping;
+ other._pMapping = nullptr;
+ return *this;
+ }
+#endif
+
+ /** Provides a pointer to the C mapping. The returned mapping is NOT acquired!
+
+ @return UNacquired C mapping
+ */
+ uno_Mapping * SAL_CALL get() const
+ { return _pMapping; }
+
+ /** Tests if a mapping is set.
+
+ @return true if a mapping is set
+ */
+ bool SAL_CALL is() const
+ { return (_pMapping != NULL); }
+
+ /** Releases a set mapping.
+ */
+ inline void SAL_CALL clear();
+
+ /** Maps an interface from one environment to another.
+
+ @param pInterface source interface
+ @param pTypeDescr type description of interface
+ @return mapped interface
+ */
+ inline void * SAL_CALL mapInterface( void * pInterface, typelib_InterfaceTypeDescription * pTypeDescr ) const;
+ /** Maps an interface from one environment to another.
+
+ @param pInterface source interface
+ @param pTypeDescr type description of interface
+ @return mapped interface
+ */
+ void * SAL_CALL mapInterface( void * pInterface, typelib_TypeDescription * pTypeDescr ) const
+ { return mapInterface( pInterface, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTypeDescr) ); }
+
+ /** Maps an interface from one environment to another.
+
+ @param pInterface source interface
+ @param rType type of interface
+ @return mapped interface
+ */
+ inline void * SAL_CALL mapInterface(
+ void * pInterface, const css::uno::Type & rType ) const;
+
+ /** Maps an interface from one environment to another.
+
+ @param ppOut inout mapped interface
+ @param pInterface source interface
+ @param pTypeDescr type description of interface
+ */
+ void SAL_CALL mapInterface( void ** ppOut, void * pInterface, typelib_InterfaceTypeDescription * pTypeDescr ) const
+ { (*_pMapping->mapInterface)( _pMapping, ppOut, pInterface, pTypeDescr ); }
+ /** Maps an interface from one environment to another.
+
+ @param ppOut inout mapped interface
+ @param pInterface source interface
+ @param pTypeDescr type description of interface
+ */
+ void SAL_CALL mapInterface( void ** ppOut, void * pInterface, typelib_TypeDescription * pTypeDescr ) const
+ { (*_pMapping->mapInterface)( _pMapping, ppOut, pInterface, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTypeDescr) ); }
+
+ /** Maps an interface from one environment to another.
+
+ @param ppOut inout mapped interface
+ @param pInterface source interface
+ @param rType type of interface to be mapped
+ */
+ inline void SAL_CALL mapInterface( void ** ppOut, void * pInterface, const css::uno::Type & rType ) const;
+};
+
+inline Mapping::Mapping(
+ const ::rtl::OUString & rFrom, const ::rtl::OUString & rTo, const ::rtl::OUString & rAddPurpose )
+ : _pMapping( NULL )
+{
+ uno_getMappingByName( &_pMapping, rFrom.pData, rTo.pData, rAddPurpose.pData );
+}
+
+inline Mapping::Mapping(
+ uno_Environment * pFrom, uno_Environment * pTo, const ::rtl::OUString & rAddPurpose )
+ : _pMapping( NULL )
+{
+ uno_getMapping( &_pMapping, pFrom, pTo, rAddPurpose.pData );
+}
+
+inline Mapping::Mapping(
+ const Environment & rFrom, const Environment & rTo, const ::rtl::OUString & rAddPurpose )
+ : _pMapping(NULL)
+{
+ uno_getMapping( &_pMapping, rFrom.get(), rTo.get(), rAddPurpose.pData );
+}
+
+inline Mapping::Mapping( uno_Mapping * pMapping )
+ : _pMapping( pMapping )
+{
+ if (_pMapping)
+ (*_pMapping->acquire)( _pMapping );
+}
+
+inline Mapping::Mapping( const Mapping & rMapping )
+ : _pMapping( rMapping._pMapping )
+{
+ if (_pMapping)
+ (*_pMapping->acquire)( _pMapping );
+}
+
+inline Mapping::~Mapping()
+{
+ if (_pMapping)
+ (*_pMapping->release)( _pMapping );
+}
+
+inline void Mapping::clear()
+{
+ if (_pMapping)
+ {
+ (*_pMapping->release)( _pMapping );
+ _pMapping = NULL;
+ }
+}
+
+inline Mapping & Mapping::operator = ( uno_Mapping * pMapping )
+{
+ if (pMapping)
+ (*pMapping->acquire)( pMapping );
+ if (_pMapping)
+ (*_pMapping->release)( _pMapping );
+ _pMapping = pMapping;
+ return *this;
+}
+
+inline void Mapping::mapInterface(
+ void ** ppOut, void * pInterface, const css::uno::Type & rType ) const
+{
+ typelib_TypeDescription * pTD = NULL;
+ TYPELIB_DANGER_GET( &pTD, rType.getTypeLibType() );
+ if (pTD)
+ {
+ (*_pMapping->mapInterface)( _pMapping, ppOut, pInterface, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) );
+ TYPELIB_DANGER_RELEASE( pTD );
+ }
+}
+
+inline void * Mapping::mapInterface(
+ void * pInterface, typelib_InterfaceTypeDescription * pTypeDescr ) const
+{
+ void * pOut = NULL;
+ (*_pMapping->mapInterface)( _pMapping, &pOut, pInterface, pTypeDescr );
+ return pOut;
+}
+
+inline void * Mapping::mapInterface(
+ void * pInterface, const css::uno::Type & rType ) const
+{
+ void * pOut = NULL;
+ mapInterface( &pOut, pInterface, rType );
+ return pOut;
+}
+
+/** Deprecated. This function DOES NOT WORK with Purpose Environments
+ (http://wiki.openoffice.org/wiki/Uno/Binary/Spec/Purpose Environments)
+
+ Maps a binary C UNO interface to be used in the currently used compiler environment.
+
+ @tparam C interface type
+ @param ppRet inout returned interface pointer
+ @param pUnoI binary C UNO interface
+ @return true if successful, false otherwise
+
+ @deprecated
+*/
+template< class C >
+SAL_DEPRECATED("use uno_Mapping")
+inline bool mapToCpp( Reference< C > * ppRet, uno_Interface * pUnoI )
+{
+ Mapping aMapping( UNO_LB_UNO, CPPU_CURRENT_LANGUAGE_BINDING_NAME );
+ OSL_ASSERT( aMapping.is() );
+ aMapping.mapInterface(
+ reinterpret_cast<void **>(ppRet), pUnoI, ::cppu::getTypeFavourUnsigned( ppRet ) );
+ return (0 != *ppRet);
+}
+/** Deprecated. This function DOES NOT WORK with Purpose Environments
+ (http://wiki.openoffice.org/wiki/Uno/Binary/Spec/Purpose Environments)
+
+ Maps a UNO interface of the currently used compiler environment to binary C UNO.
+
+ @tparam C interface type
+ @param ppRet inout returned interface pointer
+ @param x interface reference
+ @return true if successful, false otherwise
+
+ @deprecated
+*/
+template< class C >
+SAL_DEPRECATED("use uno_Mapping")
+inline bool mapToUno( uno_Interface ** ppRet, const Reference< C > & x )
+{
+ Mapping aMapping( CPPU_CURRENT_LANGUAGE_BINDING_NAME, UNO_LB_UNO );
+ OSL_ASSERT( aMapping.is() );
+ aMapping.mapInterface(
+ reinterpret_cast<void **>(ppRet), x.get(), ::cppu::getTypeFavourUnsigned( &x ) );
+ return (NULL != *ppRet);
+}
+
+}
+}
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/sequence2.h b/include/uno/sequence2.h
new file mode 100644
index 000000000..bf74a6170
--- /dev/null
+++ b/include/uno/sequence2.h
@@ -0,0 +1,199 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#ifndef INCLUDED_UNO_SEQUENCE2_H
+#define INCLUDED_UNO_SEQUENCE2_H
+
+#include "cppu/cppudllapi.h"
+#include "uno/data.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct _typelib_TypeDescriptionReference;
+struct _typelib_TypeDescription;
+typedef sal_Sequence uno_Sequence;
+
+/** Assigns a sequence.
+
+ @param ppDest destination sequence
+ @param pSource source sequence
+ @param pTypeDescr type description of the sequence and NOT of an element
+ @param release function called each time an interface needs to
+ be released; defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_sequence_assign(
+ uno_Sequence ** ppDest,
+ uno_Sequence * pSource,
+ struct _typelib_TypeDescription * pTypeDescr,
+ uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+/** Assigns a sequence.
+
+ @param ppDest destination sequence
+ @param pSource source sequence
+ @param pType type of the sequence and NOT of an element
+ @param release function called each time an interface needs to
+ be released; defaults (0) to uno
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_type_sequence_assign(
+ uno_Sequence ** ppDest,
+ uno_Sequence * pSource,
+ struct _typelib_TypeDescriptionReference * pType,
+ uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+
+/** Constructs a new sequence with given elements.
+
+ @param ppSequence out parameter sequence;
+ 0 if memory allocation has failed
+ @param pTypeDescr type description of the sequence and NOT of an
+ element
+ @param pElements if 0, then all elements are default constructed
+ @param len number of elements
+ @param acquire function called each time an interface needs to
+ be acquired; defaults (0) to uno
+ @return false, if memoray allocation has failed
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_construct(
+ uno_Sequence ** ppSequence,
+ struct _typelib_TypeDescription * pTypeDescr,
+ void * pElements, sal_Int32 len,
+ uno_AcquireFunc acquire )
+ SAL_THROW_EXTERN_C();
+/** Constructs a new sequence with given elements.
+
+ @param ppSequence out parameter sequence;
+ 0 if memory allocation has failed
+ @param pType type of the sequence and NOT of an element
+ @param pElements if 0, then all elements are default constructed
+ @param len number of elements
+ @param acquire function called each time an interface needs to
+ be acquired; defaults (0) to uno
+ @return false, if memoray allocation has failed
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_sequence_construct(
+ uno_Sequence ** ppSequence,
+ struct _typelib_TypeDescriptionReference * pType,
+ void * pElements, sal_Int32 len,
+ uno_AcquireFunc acquire )
+ SAL_THROW_EXTERN_C();
+
+/** Assures that the reference count of the given sequence is one.
+ Otherwise a new copy of the sequence is created with a reference count
+ of one.
+
+ @param ppSequence inout sequence
+ @param pTypeDescr type description of sequence
+ @param acquire function called each time an interface needs to
+ be acquired; defaults (0) to uno
+ @param release function called each time an interface needs to
+ be released; defaults (0) to uno
+ @return false, if memoray allocation has failed
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_reference2One(
+ uno_Sequence ** ppSequence,
+ struct _typelib_TypeDescription * pTypeDescr,
+ uno_AcquireFunc acquire,
+ uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+/** Assures that the reference count of the given sequence is one.
+ Otherwise a new copy of the sequence is created with a reference count
+ of one.
+
+ @param ppSequence inout sequence
+ @param pType type of sequence
+ @param acquire function called each time an interface needs to
+ be acquired; defaults (0) to uno
+ @param release function called each time an interface needs to
+ be released; defaults (0) to uno
+ @return false, if memoray allocation has failed
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_sequence_reference2One(
+ uno_Sequence ** ppSequence,
+ struct _typelib_TypeDescriptionReference * pType,
+ uno_AcquireFunc acquire,
+ uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+
+/** Reallocates length of a sequence. This truncates a sequence or enlarges
+ it default constructing appended elements.
+
+ @param ppSequence inout sequence
+ @param pTypeDescr type description of sequence
+ @param nSize new size of sequence
+ @param acquire function called each time an interface needs to
+ be acquired; defaults (0) to uno
+ @param release function called each time an interface needs to
+ be released; defaults (0) to uno
+ @return false, if memoray allocation has failed
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_realloc(
+ uno_Sequence ** ppSequence,
+ struct _typelib_TypeDescription * pTypeDescr,
+ sal_Int32 nSize,
+ uno_AcquireFunc acquire,
+ uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+/** Reallocates length of a sequence. This truncates a sequence or enlarges
+ it default constructing appended elements.
+
+ @param ppSequence inout sequence
+ @param pType type of sequence
+ @param nSize new size of sequence
+ @param acquire function called each time an interface needs to
+ be acquired; defaults (0) to uno
+ @param release function called each time an interface needs to
+ be released; defaults (0) to uno
+ @return false, if memoray allocation has failed
+*/
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_sequence_realloc(
+ uno_Sequence ** ppSequence,
+ struct _typelib_TypeDescriptionReference * pType,
+ sal_Int32 nSize,
+ uno_AcquireFunc acquire,
+ uno_ReleaseFunc release )
+ SAL_THROW_EXTERN_C();
+
+/** Destroy a sequence whose reference count has dropped to zero.
+
+ @param sequence must be non-null, sequence->nRefCount must be zero
+ @param type the type of the sequence, must be non-null
+ @param release function called each time an interface needs to be release,
+ must be non-null
+
+ @since LibreOffice 4.4
+*/
+CPPU_DLLPUBLIC void SAL_CALL uno_type_sequence_destroy(
+ uno_Sequence * sequence, struct _typelib_TypeDescriptionReference * type,
+ uno_ReleaseFunc release)
+ SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/uno/threadpool.h b/include/uno/threadpool.h
new file mode 100644
index 000000000..11264bd5a
--- /dev/null
+++ b/include/uno/threadpool.h
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+
+#ifndef INCLUDED_UNO_THREADPOOL_H
+#define INCLUDED_UNO_THREADPOOL_H
+
+#include "cppu/cppudllapi.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***
+ * Thread identifier administration.
+ ***/
+/**
+ Establishes an association between the current thread and the given thread identifier.
+ There can be only one association at a time. The association must be broken by
+ uno_releaseIdFromCurrentThread().
+ This method is in general called by a bridge, that wants to bind a remote threadId
+ to a new thread.
+
+ @param pThreadId a byte sequence, that contains the identifier of the current thread.
+ @return true, when the identifier was registered.
+ false, when the thread has already an identifier. The identifier was not
+ altered. ( This is in general a bug ).
+
+ @see uno_releaseIdFromCurrentThread()
+ */
+CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_bindIdToCurrentThread( sal_Sequence *pThreadId )
+ SAL_THROW_EXTERN_C();
+
+
+/**
+ Get the identifier of the current thread.
+ If no id has been bound for the thread before, a new one is generated and bound
+ to the thread.
+ For each call to uno_getIdOfCurrentThread(), a call to uno_releaseIdFromCurrentThread()
+ must be done.
+
+ @param ppThreadId [out] Contains the (acquired) ThreadId.
+ @see uno_releaseIdFromCurrentThread()
+ */
+CPPU_DLLPUBLIC void SAL_CALL uno_getIdOfCurrentThread( sal_Sequence **ppThreadId )
+ SAL_THROW_EXTERN_C();
+
+
+/**
+ If the internal refcount drops to zero, the association between threadId and
+ thread is broken.
+ */
+CPPU_DLLPUBLIC void SAL_CALL uno_releaseIdFromCurrentThread()
+ SAL_THROW_EXTERN_C();
+
+
+struct _uno_ThreadPool;
+typedef struct _uno_ThreadPool * uno_ThreadPool;
+
+/**
+ Creates a threadpool handle. Typically each remote bridge instances creates one
+ handle.
+ */
+CPPU_DLLPUBLIC uno_ThreadPool SAL_CALL
+uno_threadpool_create() SAL_THROW_EXTERN_C();
+
+
+/**
+ Makes the current thread known to the threadpool. This function must be
+ called, BEFORE uno_threadpool_enter() is called and BEFORE a job for this
+ thread is put into the threadpool (avoid a race between this thread and
+ an incoming request/reply).
+ For every call to uno_threadpool_attach, a corresponding call to
+ uno_threadpool_detach must be done.
+
+ @param hPool The bridge threadpool handle previously created by uno_threadpool_create.
+
+*/
+CPPU_DLLPUBLIC void SAL_CALL
+uno_threadpool_attach( uno_ThreadPool hPool ) SAL_THROW_EXTERN_C();
+
+/**
+ This method is called to wait for a reply of a previously sent request. This is a
+ blocking method. uno_threadpool_attach() must have been called before.
+
+ @param hPool the handle that was previously created by uno_threadpool_create().
+ @param ppJob [out] the pointer, that was given by uno_threadpool_putJob
+ 0, when uno_threadpool_dispose() was the reason to fall off from threadpool.
+ @see uno_threadpool_dispose()
+ **/
+CPPU_DLLPUBLIC void SAL_CALL
+uno_threadpool_enter( uno_ThreadPool hPool , void **ppJob )
+ SAL_THROW_EXTERN_C();
+
+/**
+ Detaches the current thread from the threadpool. Must be called for
+ every call to uno_threadpool_attach.
+ @param hPool the handle that was previously created by uno_threadpool_create().
+*/
+CPPU_DLLPUBLIC void SAL_CALL
+uno_threadpool_detach( uno_ThreadPool hPool ) SAL_THROW_EXTERN_C();
+
+/**
+ Puts a job into the pool. A job may either be a request or a reply
+ (replies have a 0 in the doRequest parameter). This function is non-blocking.
+
+ A request may either be synchronous or asynchronous.
+ If the request is synchronous, it is first looked up,
+ if there exists a handle with the given
+ identifier. If this is the case, the thread is woken up and the doRequest
+ function is called with the given pJob. If no handle exists,
+ a new thread is created and the given threadId is bound to the new thread.
+
+ If the request is asynchronous, it is put into the queue of asynchronous
+ requests for the current threadid. The requests are always executed in a new
+ thread, even if the thread with the given id is waiting in the pool. No id is bound
+ to the newly created thread. The responsibility is left to the bridge (if it
+ wishes to bind a name).
+
+ If pJob is a reply, there MUST be a thread with the given threadId waiting
+ for this reply.
+
+ @param hPool the handle that was previously created by uno_threadpool_create().
+ @param pThreadId The Id of the thread, that initialized this request. (In general a
+ remote threadid).
+ @param pJob The argument, that doRequest will get or that will be returned by
+ uno_threadpool_enter().
+ @param doRequest The function, that shall be called to execute the request.
+ 0 if pJob is a reply.
+ @param bIsOneway True, if the request is asynchronous. False, if it is synchronous.
+ Set to sal_False, if pJob is a reply.
+ */
+CPPU_DLLPUBLIC void SAL_CALL
+uno_threadpool_putJob(
+ uno_ThreadPool hPool,
+ sal_Sequence *pThreadId,
+ void *pJob,
+ void ( SAL_CALL * doRequest ) ( void *pThreadSpecificData ),
+ sal_Bool bIsOneway ) SAL_THROW_EXTERN_C();
+
+/**
+ All threads, that are waiting on the hPool handle, are forced out of the pool.
+ The threads waiting with uno_threadpool_enter() will return with *ppJob == 0
+
+ Later calls to uno_threadpool_enter() using the hPool handle will also
+ return immediately with *ppJob == 0.
+
+ @param hPool The handle to be disposed.
+
+ This function is called i.e. by a bridge, that is forced to dispose itself.
+ */
+CPPU_DLLPUBLIC void SAL_CALL
+uno_threadpool_dispose( uno_ThreadPool hPool ) SAL_THROW_EXTERN_C();
+
+
+/** Releases the previously with uno_threadpool_create() created handle.
+ The handle thus becomes invalid. It is an error to use the handle after
+ uno_threadpool_destroy().
+
+ A call to uno_threadpool_destroy can synchronously join on spawned worker
+ threads, so this function must never be called from such a worker thread.
+
+ @see uno_threadpool_create()
+ */
+CPPU_DLLPUBLIC void SAL_CALL
+uno_threadpool_destroy( uno_ThreadPool hPool ) SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_UNO_THREADPOOL_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unoidl/detail/dllapi.hxx b/include/unoidl/detail/dllapi.hxx
new file mode 100644
index 000000000..a0a0a45d4
--- /dev/null
+++ b/include/unoidl/detail/dllapi.hxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_UNOIDL_DETAIL_DLLAPI_HXX
+#define INCLUDED_UNOIDL_DETAIL_DLLAPI_HXX
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+#if defined LO_DLLIMPLEMENTATION_UNOIDL
+#define LO_DLLPUBLIC_UNOIDL SAL_DLLPUBLIC_EXPORT
+#else
+#define LO_DLLPUBLIC_UNOIDL SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unoidl/unoidl.hxx b/include/unoidl/unoidl.hxx
new file mode 100644
index 000000000..7791fcd41
--- /dev/null
+++ b/include/unoidl/unoidl.hxx
@@ -0,0 +1,715 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_UNOIDL_UNOIDL_HXX
+#define INCLUDED_UNOIDL_UNOIDL_HXX
+
+#include <sal/config.h>
+
+#include <cassert>
+#include <utility>
+#include <vector>
+
+#include <osl/mutex.hxx>
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <salhelper/simplereferenceobject.hxx>
+#include <unoidl/detail/dllapi.hxx>
+
+namespace unoidl {
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL NoSuchFileException final {
+public:
+ SAL_DLLPRIVATE NoSuchFileException(OUString uri): uri_(std::move(uri)) {}
+
+ SAL_DLLPRIVATE NoSuchFileException(NoSuchFileException const & other):
+ uri_(other.uri_) {}
+
+ SAL_DLLPRIVATE ~NoSuchFileException() noexcept;
+
+ const OUString& getUri() const { return uri_; }
+
+private:
+ NoSuchFileException& operator =(NoSuchFileException const &) = delete;
+
+ OUString uri_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL FileFormatException final {
+public:
+ SAL_DLLPRIVATE FileFormatException(
+ OUString uri, OUString detail):
+ uri_(std::move(uri)), detail_(std::move(detail))
+ {}
+
+ SAL_DLLPRIVATE FileFormatException(FileFormatException const & other):
+ uri_(other.uri_), detail_(other.detail_)
+ {}
+
+ SAL_DLLPRIVATE ~FileFormatException() noexcept;
+
+ const OUString& getUri() const { return uri_; }
+
+ const OUString& getDetail() const { return detail_; }
+
+private:
+ FileFormatException& operator =(FileFormatException const &) = delete;
+
+ OUString uri_;
+ OUString detail_;
+};
+
+struct AnnotatedReference {
+ AnnotatedReference(
+ OUString theName,
+ std::vector< OUString > && theAnnotations):
+ name(std::move(theName)), annotations(std::move(theAnnotations))
+ {}
+
+ OUString name;
+
+ std::vector< OUString > annotations;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL Entity: public salhelper::SimpleReferenceObject {
+public:
+ enum Sort {
+ SORT_MODULE, SORT_ENUM_TYPE, SORT_PLAIN_STRUCT_TYPE,
+ SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE, SORT_EXCEPTION_TYPE,
+ SORT_INTERFACE_TYPE, SORT_TYPEDEF, SORT_CONSTANT_GROUP,
+ SORT_SINGLE_INTERFACE_BASED_SERVICE, SORT_ACCUMULATION_BASED_SERVICE,
+ SORT_INTERFACE_BASED_SINGLETON, SORT_SERVICE_BASED_SINGLETON
+ };
+
+ Sort getSort() const { return sort_; }
+
+protected:
+ explicit SAL_DLLPRIVATE Entity(Sort sort): sort_(sort) {}
+
+ virtual SAL_DLLPRIVATE ~Entity() noexcept override;
+
+private:
+ Sort sort_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL MapCursor: public salhelper::SimpleReferenceObject {
+public:
+ // throws FileFormatException:
+ virtual rtl::Reference< Entity > getNext(OUString * name) = 0;
+
+protected:
+ SAL_DLLPRIVATE MapCursor() {}
+
+ virtual SAL_DLLPRIVATE ~MapCursor() noexcept override;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ModuleEntity: public Entity {
+public:
+ // throws FileFormatException:
+ virtual std::vector< OUString > getMemberNames() const = 0;
+
+ // throws FileFormatException:
+ virtual rtl::Reference< MapCursor > createCursor() const = 0;
+
+protected:
+ SAL_DLLPRIVATE ModuleEntity(): Entity(SORT_MODULE) {}
+
+ virtual SAL_DLLPRIVATE ~ModuleEntity() noexcept override;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL PublishableEntity: public Entity {
+public:
+ bool isPublished() const { return published_; }
+
+ std::vector< OUString > const & getAnnotations() const
+ { return annotations_; }
+
+protected:
+ SAL_DLLPRIVATE PublishableEntity(
+ Sort sort, bool published,
+ std::vector< OUString >&& annotations):
+ Entity(sort), published_(published), annotations_(std::move(annotations))
+ {}
+
+ virtual SAL_DLLPRIVATE ~PublishableEntity() noexcept override;
+
+private:
+ bool published_;
+
+ std::vector< OUString > annotations_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL EnumTypeEntity final : public PublishableEntity {
+public:
+ struct Member {
+ Member(
+ OUString theName, sal_Int32 theValue,
+ std::vector< OUString >&& theAnnotations):
+ name(std::move(theName)), value(theValue), annotations(std::move(theAnnotations))
+ {}
+
+ OUString name;
+
+ sal_Int32 value;
+
+ std::vector< OUString > annotations;
+ };
+
+ SAL_DLLPRIVATE EnumTypeEntity(
+ bool published, std::vector< Member >&& members,
+ std::vector< OUString >&& annotations):
+ PublishableEntity(SORT_ENUM_TYPE, published, std::move(annotations)),
+ members_(std::move(members))
+ { assert(!members_.empty()); }
+
+ std::vector< Member > const & getMembers() const { return members_; }
+
+private:
+ virtual SAL_DLLPRIVATE ~EnumTypeEntity() noexcept override;
+
+ std::vector< Member > members_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL PlainStructTypeEntity final : public PublishableEntity {
+public:
+ struct Member {
+ Member(OUString theName, OUString theType,
+ std::vector< OUString >&& theAnnotations):
+ name(std::move(theName)), type(std::move(theType)), annotations(std::move(theAnnotations))
+ {}
+
+ OUString name;
+
+ OUString type;
+
+ std::vector< OUString > annotations;
+ };
+
+ SAL_DLLPRIVATE PlainStructTypeEntity(
+ bool published, OUString directBase,
+ std::vector< Member >&& directMembers,
+ std::vector< OUString > && annotations):
+ PublishableEntity(SORT_PLAIN_STRUCT_TYPE, published, std::move(annotations)),
+ directBase_(std::move(directBase)), directMembers_(std::move(directMembers))
+ {}
+
+ const OUString& getDirectBase() const { return directBase_; }
+
+ std::vector< Member > const & getDirectMembers() const
+ { return directMembers_; }
+
+private:
+ virtual SAL_DLLPRIVATE ~PlainStructTypeEntity() noexcept override;
+
+ OUString directBase_;
+ std::vector< Member > directMembers_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL PolymorphicStructTypeTemplateEntity final :
+ public PublishableEntity
+{
+public:
+ struct Member {
+ Member(
+ OUString theName, OUString theType,
+ bool theParameterized,
+ std::vector< OUString >&& theAnnotations):
+ name(std::move(theName)), type(std::move(theType)), parameterized(theParameterized),
+ annotations(std::move(theAnnotations))
+ {}
+
+ OUString name;
+
+ OUString type;
+
+ bool parameterized;
+
+ std::vector< OUString > annotations;
+ };
+
+ SAL_DLLPRIVATE PolymorphicStructTypeTemplateEntity(
+ bool published, std::vector< OUString >&& typeParameters,
+ std::vector< Member >&& members,
+ std::vector< OUString >&& annotations):
+ PublishableEntity(
+ SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE, published, std::move(annotations)),
+ typeParameters_(std::move(typeParameters)), members_(std::move(members))
+ {}
+
+ std::vector< OUString > const & getTypeParameters() const
+ { return typeParameters_; }
+
+ std::vector< Member > const & getMembers() const { return members_; }
+
+private:
+ virtual SAL_DLLPRIVATE ~PolymorphicStructTypeTemplateEntity() noexcept override;
+
+ std::vector< OUString > typeParameters_;
+ std::vector< Member > members_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ExceptionTypeEntity final : public PublishableEntity {
+public:
+ struct Member {
+ Member(
+ OUString theName, OUString theType,
+ std::vector< OUString >&& theAnnotations):
+ name(std::move(theName)), type(std::move(theType)), annotations(std::move(theAnnotations))
+ {}
+
+ OUString name;
+
+ OUString type;
+
+ std::vector< OUString > annotations;
+ };
+
+ SAL_DLLPRIVATE ExceptionTypeEntity(
+ bool published, OUString directBase,
+ std::vector< Member >&& directMembers,
+ std::vector< OUString >&& annotations):
+ PublishableEntity(SORT_EXCEPTION_TYPE, published, std::move(annotations)),
+ directBase_(std::move(directBase)), directMembers_(std::move(directMembers))
+ {}
+
+ const OUString& getDirectBase() const { return directBase_; }
+
+ std::vector< Member > const & getDirectMembers() const
+ { return directMembers_; }
+
+private:
+ virtual SAL_DLLPRIVATE ~ExceptionTypeEntity() noexcept override;
+
+ OUString directBase_;
+ std::vector< Member > directMembers_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL InterfaceTypeEntity final : public PublishableEntity {
+public:
+ struct Attribute {
+ Attribute(
+ OUString theName, OUString theType,
+ bool theBound, bool theReadOnly,
+ std::vector< OUString >&& theGetExceptions,
+ std::vector< OUString >&& theSetExceptions,
+ std::vector< OUString >&& theAnnotations):
+ name(std::move(theName)), type(std::move(theType)), bound(theBound),
+ readOnly(theReadOnly), getExceptions(std::move(theGetExceptions)),
+ setExceptions(std::move(theSetExceptions)), annotations(std::move(theAnnotations))
+ { assert(!theReadOnly || setExceptions.empty()); }
+
+ OUString name;
+
+ OUString type;
+
+ bool bound;
+
+ bool readOnly;
+
+ std::vector< OUString > getExceptions;
+
+ std::vector< OUString > setExceptions;
+
+ std::vector< OUString > annotations;
+ };
+
+ struct Method {
+ struct Parameter {
+ enum Direction { DIRECTION_IN, DIRECTION_OUT, DIRECTION_IN_OUT };
+
+ Parameter(
+ OUString theName, OUString theType,
+ Direction theDirection):
+ name(std::move(theName)), type(std::move(theType)), direction(theDirection)
+ {}
+
+ OUString name;
+
+ OUString type;
+
+ Direction direction;
+ };
+
+ Method(
+ OUString theName, OUString theReturnType,
+ std::vector< Parameter >&& theParameters,
+ std::vector< OUString >&& theExceptions,
+ std::vector< OUString >&& theAnnotations):
+ name(std::move(theName)), returnType(std::move(theReturnType)), parameters(std::move(theParameters)),
+ exceptions(std::move(theExceptions)), annotations(std::move(theAnnotations))
+ {}
+
+ OUString name;
+
+ OUString returnType;
+
+ std::vector< Parameter > parameters;
+
+ std::vector< OUString > exceptions;
+
+ std::vector< OUString > annotations;
+ };
+
+ SAL_DLLPRIVATE InterfaceTypeEntity(
+ bool published,
+ std::vector< AnnotatedReference >&& directMandatoryBases,
+ std::vector< AnnotatedReference >&& directOptionalBases,
+ std::vector< Attribute >&& directAttributes,
+ std::vector< Method >&& directMethods,
+ std::vector< OUString >&& annotations):
+ PublishableEntity(SORT_INTERFACE_TYPE, published, std::move(annotations)),
+ directMandatoryBases_(std::move(directMandatoryBases)),
+ directOptionalBases_(std::move(directOptionalBases)),
+ directAttributes_(std::move(directAttributes)),
+ directMethods_(std::move(directMethods))
+ {}
+
+ std::vector< AnnotatedReference > const & getDirectMandatoryBases() const
+ { return directMandatoryBases_; }
+
+ std::vector< AnnotatedReference > const & getDirectOptionalBases() const
+ { return directOptionalBases_; }
+
+ std::vector< Attribute > const & getDirectAttributes() const
+ { return directAttributes_; }
+
+ std::vector< Method > const & getDirectMethods() const
+ { return directMethods_; }
+
+private:
+ virtual SAL_DLLPRIVATE ~InterfaceTypeEntity() noexcept override;
+
+ std::vector< AnnotatedReference > directMandatoryBases_;
+ std::vector< AnnotatedReference > directOptionalBases_;
+ std::vector< Attribute > directAttributes_;
+ std::vector< Method > directMethods_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL TypedefEntity final : public PublishableEntity {
+public:
+ SAL_DLLPRIVATE TypedefEntity(
+ bool published, OUString type,
+ std::vector< OUString >&& annotations):
+ PublishableEntity(SORT_TYPEDEF, published, std::move(annotations)), type_(std::move(type))
+ {}
+
+ const OUString& getType() const { return type_; }
+
+private:
+ virtual SAL_DLLPRIVATE ~TypedefEntity() noexcept override;
+
+ OUString type_;
+};
+
+struct SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ConstantValue {
+ enum Type {
+ TYPE_BOOLEAN, TYPE_BYTE, TYPE_SHORT, TYPE_UNSIGNED_SHORT, TYPE_LONG,
+ TYPE_UNSIGNED_LONG, TYPE_HYPER, TYPE_UNSIGNED_HYPER, TYPE_FLOAT,
+ TYPE_DOUBLE };
+
+ ConstantValue(bool value): type(TYPE_BOOLEAN), booleanValue(value) {}
+
+ ConstantValue(sal_Int8 value): type(TYPE_BYTE), byteValue(value) {}
+
+ ConstantValue(sal_Int16 value): type(TYPE_SHORT), shortValue(value) {}
+
+ ConstantValue(sal_uInt16 value):
+ type(TYPE_UNSIGNED_SHORT), unsignedShortValue(value)
+ {}
+
+ ConstantValue(sal_Int32 value): type(TYPE_LONG), longValue(value) {}
+
+ ConstantValue(sal_uInt32 value):
+ type(TYPE_UNSIGNED_LONG), unsignedLongValue(value)
+ {}
+
+ ConstantValue(sal_Int64 value): type(TYPE_HYPER), hyperValue(value) {}
+
+ ConstantValue(sal_uInt64 value):
+ type(TYPE_UNSIGNED_HYPER), unsignedHyperValue(value)
+ {}
+
+ ConstantValue(float value): type(TYPE_FLOAT), floatValue(value) {}
+
+ ConstantValue(double value): type(TYPE_DOUBLE), doubleValue(value) {}
+
+ Type type;
+
+ union {
+ bool booleanValue;
+ sal_Int8 byteValue;
+ sal_Int16 shortValue;
+ sal_uInt16 unsignedShortValue;
+ sal_Int32 longValue;
+ sal_uInt32 unsignedLongValue;
+ sal_Int64 hyperValue;
+ sal_uInt64 unsignedHyperValue;
+ float floatValue;
+ double doubleValue;
+ };
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ConstantGroupEntity final : public PublishableEntity {
+public:
+ struct Member {
+ Member(
+ OUString theName, ConstantValue const & theValue,
+ std::vector< OUString >&& theAnnotations):
+ name(std::move(theName)), value(theValue), annotations(std::move(theAnnotations))
+ {}
+
+ OUString name;
+
+ ConstantValue value;
+
+ std::vector< OUString > annotations;
+ };
+
+ SAL_DLLPRIVATE ConstantGroupEntity(
+ bool published, std::vector< Member >&& members,
+ std::vector< OUString >&& annotations):
+ PublishableEntity(SORT_CONSTANT_GROUP, published, std::move(annotations)),
+ members_(std::move(members))
+ {}
+
+ std::vector< Member > const & getMembers() const { return members_; }
+
+private:
+ virtual SAL_DLLPRIVATE ~ConstantGroupEntity() noexcept override;
+
+ std::vector< Member > members_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL SingleInterfaceBasedServiceEntity final :
+ public PublishableEntity
+{
+public:
+ struct Constructor {
+ struct Parameter {
+ Parameter(
+ OUString theName, OUString theType,
+ bool theRest):
+ name(std::move(theName)), type(std::move(theType)), rest(theRest)
+ {}
+
+ OUString name;
+
+ OUString type;
+
+ bool rest;
+ };
+
+ Constructor():
+ defaultConstructor(true) {}
+
+ Constructor(
+ OUString theName,
+ std::vector< Parameter >&& theParameters,
+ std::vector< OUString >&& theExceptions,
+ std::vector< OUString >&& theAnnotations):
+ name(std::move(theName)), parameters(std::move(theParameters)),
+ exceptions(std::move(theExceptions)),
+ annotations(std::move(theAnnotations)),
+ defaultConstructor(false)
+ {}
+
+ OUString name;
+
+ std::vector< Parameter > parameters;
+
+ std::vector< OUString > exceptions;
+
+ std::vector< OUString > annotations;
+
+ bool defaultConstructor;
+ };
+
+ SAL_DLLPRIVATE SingleInterfaceBasedServiceEntity(
+ bool published, OUString base,
+ std::vector< Constructor >&& constructors,
+ std::vector< OUString >&& annotations):
+ PublishableEntity(
+ SORT_SINGLE_INTERFACE_BASED_SERVICE, published, std::move(annotations)),
+ base_(std::move(base)), constructors_(std::move(constructors))
+ {}
+
+ const OUString& getBase() const { return base_; }
+
+ std::vector< Constructor > const & getConstructors() const
+ { return constructors_; }
+
+private:
+ virtual SAL_DLLPRIVATE ~SingleInterfaceBasedServiceEntity() noexcept override;
+
+ OUString base_;
+ std::vector< Constructor > constructors_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL AccumulationBasedServiceEntity final :
+ public PublishableEntity
+{
+public:
+ struct Property {
+ enum Attributes {
+ ATTRIBUTE_MAYBE_VOID = 0x001,
+ ATTRIBUTE_BOUND = 0x002,
+ ATTRIBUTE_CONSTRAINED = 0x004,
+ ATTRIBUTE_TRANSIENT = 0x008,
+ ATTRIBUTE_READ_ONLY = 0x010,
+ ATTRIBUTE_MAYBE_AMBIGUOUS = 0x020,
+ ATTRIBUTE_MAYBE_DEFAULT = 0x040,
+ ATTRIBUTE_REMOVABLE = 0x080,
+ ATTRIBUTE_OPTIONAL = 0x100
+ };
+
+ Property(
+ OUString theName, OUString theType,
+ Attributes theAttributes,
+ std::vector< OUString >&& theAnnotations):
+ name(std::move(theName)), type(std::move(theType)), attributes(theAttributes),
+ annotations(std::move(theAnnotations))
+ {}
+
+ OUString name;
+
+ OUString type;
+
+ Attributes attributes;
+
+ std::vector< OUString > annotations;
+ };
+
+ SAL_DLLPRIVATE AccumulationBasedServiceEntity(
+ bool published,
+ std::vector< AnnotatedReference >&& directMandatoryBaseServices,
+ std::vector< AnnotatedReference >&& directOptionalBaseServices,
+ std::vector< AnnotatedReference >&& directMandatoryBaseInterfaces,
+ std::vector< AnnotatedReference >&& directOptionalBaseInterfaces,
+ std::vector< Property >&& directProperties,
+ std::vector< OUString >&& annotations):
+ PublishableEntity(
+ SORT_ACCUMULATION_BASED_SERVICE, published, std::move(annotations)),
+ directMandatoryBaseServices_(std::move(directMandatoryBaseServices)),
+ directOptionalBaseServices_(std::move(directOptionalBaseServices)),
+ directMandatoryBaseInterfaces_(std::move(directMandatoryBaseInterfaces)),
+ directOptionalBaseInterfaces_(std::move(directOptionalBaseInterfaces)),
+ directProperties_(std::move(directProperties))
+ {}
+
+ std::vector< AnnotatedReference > const & getDirectMandatoryBaseServices()
+ const
+ { return directMandatoryBaseServices_; }
+
+ std::vector< AnnotatedReference > const & getDirectOptionalBaseServices()
+ const
+ { return directOptionalBaseServices_; }
+
+ std::vector< AnnotatedReference > const & getDirectMandatoryBaseInterfaces()
+ const
+ { return directMandatoryBaseInterfaces_; }
+
+ std::vector< AnnotatedReference > const & getDirectOptionalBaseInterfaces()
+ const
+ { return directOptionalBaseInterfaces_; }
+
+ std::vector< Property > const & getDirectProperties() const
+ { return directProperties_; }
+
+private:
+ virtual SAL_DLLPRIVATE ~AccumulationBasedServiceEntity() noexcept override;
+
+ std::vector< AnnotatedReference > directMandatoryBaseServices_;
+ std::vector< AnnotatedReference > directOptionalBaseServices_;
+ std::vector< AnnotatedReference > directMandatoryBaseInterfaces_;
+ std::vector< AnnotatedReference > directOptionalBaseInterfaces_;
+ std::vector< Property > directProperties_;
+};
+
+class LO_DLLPUBLIC_UNOIDL InterfaceBasedSingletonEntity final :
+ public PublishableEntity
+{
+public:
+ SAL_DLLPRIVATE InterfaceBasedSingletonEntity(
+ bool published, OUString base,
+ std::vector< OUString >&& annotations):
+ PublishableEntity(
+ SORT_INTERFACE_BASED_SINGLETON, published, std::move(annotations)),
+ base_(std::move(base))
+ {}
+
+ const OUString& getBase() const { return base_; }
+
+private:
+ virtual SAL_DLLPRIVATE ~InterfaceBasedSingletonEntity() noexcept override;
+
+ OUString base_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ServiceBasedSingletonEntity final : public PublishableEntity
+{
+public:
+ SAL_DLLPRIVATE ServiceBasedSingletonEntity(
+ bool published, OUString base,
+ std::vector< OUString >&& annotations):
+ PublishableEntity(SORT_SERVICE_BASED_SINGLETON, published, std::move(annotations)),
+ base_(std::move(base))
+ {}
+
+ const OUString& getBase() const { return base_; }
+
+private:
+ virtual SAL_DLLPRIVATE ~ServiceBasedSingletonEntity() noexcept override;
+
+ OUString base_;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL Provider: public salhelper::SimpleReferenceObject {
+public:
+ // throws FileFormatException:
+ virtual rtl::Reference< MapCursor > createRootCursor() const = 0;
+
+ // throws FileFormatException:
+ virtual rtl::Reference< Entity > findEntity(OUString const & name)
+ const = 0;
+
+protected:
+ SAL_DLLPRIVATE Provider() {}
+
+ virtual SAL_DLLPRIVATE ~Provider() noexcept override;
+};
+
+class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL Manager final : public salhelper::SimpleReferenceObject {
+public:
+ Manager() {}
+
+ // throws FileFormatException, NoSuchFileException:
+ rtl::Reference< Provider > addProvider(OUString const & uri);
+
+ // throws FileFormatException:
+ rtl::Reference< Entity > findEntity(OUString const & name) const;
+
+ // throws FileFormatException:
+ rtl::Reference< MapCursor > createCursor(OUString const & name) const;
+
+private:
+ virtual SAL_DLLPRIVATE ~Manager() noexcept override;
+
+ SAL_DLLPRIVATE rtl::Reference< Provider > loadProvider(
+ OUString const & uri);
+
+ mutable osl::Mutex mutex_;
+ std::vector< rtl::Reference< Provider > > providers_;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotest/bootstrapfixturebase.hxx b/include/unotest/bootstrapfixturebase.hxx
new file mode 100644
index 000000000..1a25e25d4
--- /dev/null
+++ b/include/unotest/bootstrapfixturebase.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_UNOTEST_BOOTSTRAPFIXTUREBASE_HXX
+#define INCLUDED_UNOTEST_BOOTSTRAPFIXTUREBASE_HXX
+
+#include <sal/config.h>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+
+#include <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <unotest/detail/unotestdllapi.hxx>
+#include <unotest/directories.hxx>
+
+// For cppunit < 1.15.0.
+#ifndef CPPUNIT_TEST_FIXTURE
+#define CPPUNIT_TEST_FIXTURE(TestClass, TestName) \
+ class TestName : public TestClass \
+ { \
+ public: \
+ void TestBody(); \
+ CPPUNIT_TEST_SUITE(TestName); \
+ CPPUNIT_TEST(TestBody); \
+ CPPUNIT_TEST_SUITE_END(); \
+ }; \
+ CPPUNIT_TEST_SUITE_REGISTRATION(TestName); \
+ void TestName::TestBody()
+#endif
+
+namespace test {
+
+// Class to do lots of heavy-lifting UNO & environment
+// bootstrapping for unit tests, such that we can use
+// almost an entire LibreOffice during compile - so
+// that we can get pieces of code alone to beat them up.
+
+// NB. this class is instantiated multiple times during a
+// run of unit tests ...
+class OOO_DLLPUBLIC_UNOTEST BootstrapFixtureBase : public CppUnit::TestFixture
+{
+protected:
+ Directories m_directories;
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ css::uno::Reference<css::lang::XMultiServiceFactory> m_xSFactory;
+ css::uno::Reference<css::lang::XMultiComponentFactory> m_xFactory;
+
+public:
+ BootstrapFixtureBase();
+ virtual ~BootstrapFixtureBase() override;
+
+ const css::uno::Reference<css::uno::XComponentContext>&
+ getComponentContext() const { return m_xContext; }
+ const css::uno::Reference<css::lang::XMultiServiceFactory>&
+ getMultiServiceFactory() const { return m_xSFactory; }
+
+ virtual void setUp() override;
+ virtual void tearDown() override;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotest/detail/unotestdllapi.hxx b/include/unotest/detail/unotestdllapi.hxx
new file mode 100644
index 000000000..b89013912
--- /dev/null
+++ b/include/unotest/detail/unotestdllapi.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTEST_DETAIL_UNOTESTDLLAPI_HXX
+#define INCLUDED_UNOTEST_DETAIL_UNOTESTDLLAPI_HXX
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined OOO_DLLIMPLEMENTATION_UNOTEST
+#define OOO_DLLPUBLIC_UNOTEST SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_UNOTEST SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotest/directories.hxx b/include/unotest/directories.hxx
new file mode 100644
index 000000000..efdcd93a6
--- /dev/null
+++ b/include/unotest/directories.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_UNOTEST_DIRECTORIES_HXX
+#define INCLUDED_UNOTEST_DIRECTORIES_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <rtl/ustring.hxx>
+#include <unotest/detail/unotestdllapi.hxx>
+
+namespace test
+{
+class OOO_DLLPUBLIC_UNOTEST Directories
+{
+private:
+ OUString m_aSrcRootURL;
+ OUString m_aSrcRootPath;
+ OUString m_aWorkdirRootURL;
+ OUString m_aWorkdirRootPath;
+
+public:
+ Directories();
+
+ const OUString& getSrcRootURL() const { return m_aSrcRootURL; }
+ const OUString& getSrcRootPath() const { return m_aSrcRootPath; }
+
+ // return a URL to a given path from the source directory
+ OUString getURLFromSrc(std::u16string_view rPath) const;
+
+ // return a Path to a given path from the source directory
+ OUString getPathFromSrc(std::u16string_view rPath) const;
+
+ // return a URL to a given path from the workdir directory
+ OUString getURLFromWorkdir(std::u16string_view rPath) const;
+
+ // return a Path to a given path from the workdir directory
+ OUString getPathFromWorkdir(std::u16string_view rPath) const;
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotest/filters-test.hxx b/include/unotest/filters-test.hxx
new file mode 100644
index 000000000..01570b786
--- /dev/null
+++ b/include/unotest/filters-test.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_UNOTEST_FILTERS_TEST_HXX
+#define INCLUDED_UNOTEST_FILTERS_TEST_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <comphelper/documentconstants.hxx>
+#include <rtl/ustring.hxx>
+#include <unotest/detail/unotestdllapi.hxx>
+#include <sot/formats.hxx>
+
+namespace test {
+
+enum filterStatus
+{
+ fail = 0,
+ pass = 1,
+ indeterminate = 2
+};
+
+/*
+ * NOTE, any files beginning with CVE-, BID- or EDB- will be assumed to be
+ * encrypted using arcfour with key 0x435645, this is to silence panicky
+ * virus/malware-checkers
+ *
+ * e.g. m[de]crypt --bare -a arcfour -o hex -k 435645 -s 3
+ */
+/* Implementation of Filters test */
+class OOO_DLLPUBLIC_UNOTEST FiltersTest
+{
+public:
+ void testDir(
+ //filter name
+ const OUString &rFilter,
+ //root dir of test files, must contain pass, fail, indeterminate
+ std::u16string_view rURL,
+ //additional filter data for SfxFilter
+ const OUString &rUserData = OUString(),
+ //SfxFilterFlags for SfxFilter
+ SfxFilterFlags nFilterFlags = SfxFilterFlags::IMPORT,
+ //Clipboard id for SfxFilter
+ SotClipboardFormatId nClipboardID = SotClipboardFormatId::NONE,
+ //additional filter version for SfxFilter
+ unsigned int nFilterVersion = 0,
+ //export or import?
+ bool bExport = false);
+
+ virtual bool load(
+ const OUString &rFilter,
+ const OUString &rURL,
+ const OUString &rUserData,
+ SfxFilterFlags nFilterFlags,
+ SotClipboardFormatId nClipboardID,
+ unsigned int nFilterVersion) = 0;
+
+ virtual bool save(
+ const OUString &/*rFilter*/,
+ const OUString &/*rURL*/,
+ const OUString &/*rUserData*/,
+ SfxFilterFlags /*nFilterFlags*/,
+ SotClipboardFormatId /*nClipboardID*/,
+ unsigned int /*nFilterVersion*/)
+ {
+ return true;
+ }
+
+protected:
+ ~FiltersTest() {}
+
+ void recursiveScan(
+ filterStatus nExpected,
+ const OUString &rFilter,
+ const OUString &rURL,
+ const OUString &rUserData,
+ SfxFilterFlags nFilterFlags,
+ SotClipboardFormatId nClipboardID,
+ unsigned int nFilterVersion,
+ bool bExport);
+};
+
+}
+
+#endif // INCLUDED_UNOTEST_FILTERS_TEST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotest/getargument.hxx b/include/unotest/getargument.hxx
new file mode 100644
index 000000000..08eee217a
--- /dev/null
+++ b/include/unotest/getargument.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <rtl/ustring.hxx>
+#include <unotest/detail/unotestdllapi.hxx>
+
+namespace test {
+
+// Obtain the value of an argument tunneled in via an "arg-<name>" bootstrap
+// variable:
+OOO_DLLPUBLIC_UNOTEST bool getArgument(
+ std::u16string_view name, OUString * value);
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotest/gettestargument.hxx b/include/unotest/gettestargument.hxx
new file mode 100644
index 000000000..3b6291725
--- /dev/null
+++ b/include/unotest/gettestargument.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTEST_GETTESTARGUMENT_HXX
+#define INCLUDED_UNOTEST_GETTESTARGUMENT_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <rtl/ustring.hxx>
+#include <unotest/detail/unotestdllapi.hxx>
+
+
+namespace test {
+
+// Obtain the value of a test argument (tunneled in via an "arg-testarg.<name>"
+// bootstrap variable):
+OOO_DLLPUBLIC_UNOTEST bool getTestArgument(
+ std::u16string_view name, OUString * value);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotest/macros_test.hxx b/include/unotest/macros_test.hxx
new file mode 100644
index 000000000..dc5ca20dd
--- /dev/null
+++ b/include/unotest/macros_test.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_UNOTEST_MACROS_TEST_HXX
+#define INCLUDED_UNOTEST_MACROS_TEST_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+#include <functional>
+#include <config_gpgme.h>
+#include <rtl/ustring.hxx>
+#include <unotest/detail/unotestdllapi.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XDesktop2.hpp>
+
+struct TestMacroInfo
+{
+ OUString sFileBaseName;
+ OUString sMacroUrl;
+};
+
+class BasicDLL;
+class SvStream;
+
+namespace test
+{
+class Directories;
+}
+namespace utl
+{
+class TempFile;
+}
+
+namespace com::sun::star::security
+{
+class XCertificate;
+}
+
+namespace unotest
+{
+class OOO_DLLPUBLIC_UNOTEST MacrosTest
+{
+public:
+ class Resetter
+ {
+ private:
+ std::function<void()> m_Func;
+
+ public:
+ Resetter(std::function<void()> const& rFunc)
+ : m_Func(rFunc)
+ {
+ }
+ ~Resetter()
+ {
+ try
+ {
+ m_Func();
+ }
+ catch (...) // has to be reliable
+ {
+ fprintf(stderr, "resetter failed with exception\n");
+ abort();
+ }
+ }
+ };
+
+ MacrosTest();
+ ~MacrosTest();
+
+ css::uno::Reference<css::lang::XComponent>
+ loadFromDesktop(const OUString& rURL, const OUString& rDocService = OUString(),
+ const css::uno::Sequence<css::beans::PropertyValue>& rExtra_args
+ = css::uno::Sequence<css::beans::PropertyValue>());
+
+ static void
+ dispatchCommand(const css::uno::Reference<css::lang::XComponent>& xComponent,
+ const OUString& rCommand,
+ const css::uno::Sequence<css::beans::PropertyValue>& rPropertyValues);
+
+ /// Opens rStreamName from rTempFile, assuming it's a ZIP storage.
+ static std::unique_ptr<SvStream> parseExportStream(const utl::TempFile& rTempFile,
+ const OUString& rStreamName);
+
+ void setUpNssGpg(const test::Directories& rDirectories, const OUString& rTestName);
+ void tearDownNssGpg();
+
+ static bool IsValid(const css::uno::Reference<css::security::XCertificate>& cert);
+ static css::uno::Reference<css::security::XCertificate> GetValidCertificate(
+ const css::uno::Sequence<css::uno::Reference<css::security::XCertificate>>& certs,
+ const css::uno::Sequence<css::beans::PropertyValue>& rFilterData = {});
+
+protected:
+ css::uno::Reference<css::frame::XDesktop2> mxDesktop;
+
+private:
+ std::unique_ptr<BasicDLL> mpDll;
+#if HAVE_GPGCONF_SOCKETDIR
+ OString m_gpgconfCommandPrefix;
+#endif
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotest/officeconnection.hxx b/include/unotest/officeconnection.hxx
new file mode 100644
index 000000000..553f24b3c
--- /dev/null
+++ b/include/unotest/officeconnection.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTEST_OFFICECONNECTION_HXX
+#define INCLUDED_UNOTEST_OFFICECONNECTION_HXX
+
+#include <sal/config.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <osl/process.h>
+#include <unotest/detail/unotestdllapi.hxx>
+
+namespace com::sun::star::uno {
+ class XComponentContext;
+}
+
+namespace test {
+
+// Start up and shut down an OOo instance (details about the OOo instance are
+// tunneled in via "arg-..." bootstrap variables):
+class OOO_DLLPUBLIC_UNOTEST OfficeConnection
+{
+ OfficeConnection(const OfficeConnection&) = delete;
+ OfficeConnection& operator=( const OfficeConnection& ) = delete;
+public:
+ OfficeConnection();
+ ~OfficeConnection();
+
+ void setUp();
+
+ void tearDown();
+
+ const css::uno::Reference< css::uno::XComponentContext >&
+ getComponentContext() const { return context_;}
+
+ // Must not be called before setUp or after tearDown:
+ bool isStillAlive() const;
+
+private:
+ oslProcess process_;
+ css::uno::Reference< css::uno::XComponentContext >
+ context_;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotest/toabsolutefileurl.hxx b/include/unotest/toabsolutefileurl.hxx
new file mode 100644
index 000000000..5bdb7b05e
--- /dev/null
+++ b/include/unotest/toabsolutefileurl.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTEST_TOABSOLUTEFILEURL_HXX
+#define INCLUDED_UNOTEST_TOABSOLUTEFILEURL_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <unotest/detail/unotestdllapi.hxx>
+
+
+namespace test {
+
+// Convert a pathname in system notation, potentially relative to the process's
+// current working directory, to an absolute file URL:
+OOO_DLLPUBLIC_UNOTEST OUString toAbsoluteFileUrl(
+ OUString const & relativePathname);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/VersionConfig.hxx b/include/unotools/VersionConfig.hxx
new file mode 100644
index 000000000..6142f5548
--- /dev/null
+++ b/include/unotools/VersionConfig.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+#pragma once
+
+#include <officecfg/Setup.hxx>
+#include <unotools/configmgr.hxx>
+#include <o3tl/string_view.hxx>
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+
+namespace utl
+{
+/** This method is called when there's a need to determine if the
+ * current version of LibreOffice has been upgraded to a newer one.
+
+ @param aUpdateVersion This variable is used to determine if
+ LibreOffice's previous version should be updated.
+ */
+static bool isProductVersionUpgraded(bool aUpdateVersion)
+{
+ OUString sSetupVersion = utl::ConfigManager::getProductVersion();
+ sal_Int32 iCurrent = o3tl::toInt32(o3tl::getToken(sSetupVersion, 0, '.')) * 10
+ + o3tl::toInt32(o3tl::getToken(sSetupVersion, 1, '.'));
+ OUString sLastVersion = officecfg::Setup::Product::ooSetupLastVersion::get().value_or("0.0");
+ sal_Int32 iLast = o3tl::toInt32(o3tl::getToken(sLastVersion, 0, '.')) * 10
+ + o3tl::toInt32(o3tl::getToken(sLastVersion, 1, '.'));
+ if (iCurrent > iLast)
+ {
+ if (aUpdateVersion)
+ { //update lastversion
+ try
+ {
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Setup::Product::ooSetupLastVersion::set(sSetupVersion, batch);
+ batch->commit();
+ }
+ catch (css::lang::IllegalArgumentException&)
+ { //If the value was readOnly.
+ SAL_WARN("desktop.updater", "Updating property ooSetupLastVersion to version "
+ << sSetupVersion
+ << " failed (read-only property?)");
+ }
+ }
+ return true;
+ }
+ return false;
+}
+}
diff --git a/include/unotools/ZipPackageHelper.hxx b/include/unotools/ZipPackageHelper.hxx
new file mode 100644
index 000000000..7ac35b801
--- /dev/null
+++ b/include/unotools/ZipPackageHelper.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_ZIPPACKAGEHELPER_HXX
+#define INCLUDED_UNOTOOLS_ZIPPACKAGEHELPER_HXX
+
+#include <unotools/unotoolsdllapi.h>
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+namespace com::sun::star::container { class XHierarchicalNameAccess; }
+namespace com::sun::star::lang { class XSingleServiceFactory; }
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace utl {
+
+class UNOTOOLS_DLLPUBLIC ZipPackageHelper
+{
+public:
+ ZipPackageHelper( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& sPackageURL);
+
+ void savePackage();
+
+ /// @throws css::uno::Exception
+ void addFile( css::uno::Reference< css::uno::XInterface > const & xRootFolder,
+ const OUString& rSourceFile );
+
+ /// @throws css::uno::Exception
+ css::uno::Reference< css::uno::XInterface > addFolder( css::uno::Reference< css::uno::XInterface > const & xRootFolder,
+ const OUString& rName );
+
+ void addFolderWithContent( css::uno::Reference< css::uno::XInterface > const & xRootFolder,
+ const OUString& rDirURL );
+
+ css::uno::Reference< css::uno::XInterface >& getRootFolder();
+
+private:
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ css::uno::Reference< css::container::XHierarchicalNameAccess > mxHNameAccess;
+ css::uno::Reference< css::lang::XSingleServiceFactory > mxFactory;
+ css::uno::Reference< css::uno::XInterface > mxRootFolder;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/accessiblerelationsethelper.hxx b/include/unotools/accessiblerelationsethelper.hxx
new file mode 100644
index 000000000..35277ae5b
--- /dev/null
+++ b/include/unotools/accessiblerelationsethelper.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_ACCESSIBLERELATIONSETHELPER_HXX
+#define INCLUDED_UNOTOOLS_ACCESSIBLERELATIONSETHELPER_HXX
+
+#include <unotools/unotoolsdllapi.h>
+
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <mutex>
+#include <vector>
+
+//= XAccessibleRelationSet helper classes
+
+//... namespace utl .......................................................
+namespace utl
+{
+/** @descr
+ This base class provides an implementation of the
+ <code>AccessibleRelationSet</code> service.
+*/
+class UNOTOOLS_DLLPUBLIC AccessibleRelationSetHelper final
+ : public cppu::WeakImplHelper<css::accessibility::XAccessibleRelationSet>
+{
+public:
+ //===== internal ========================================================
+ AccessibleRelationSetHelper();
+ AccessibleRelationSetHelper(const AccessibleRelationSetHelper& rHelper);
+
+private:
+ virtual ~AccessibleRelationSetHelper() override;
+
+public:
+ //===== XAccessibleRelationSet ==========================================
+
+ /** Returns the number of relations in this relation set.
+
+ @return
+ Returns the number of relations or zero if there are none.
+ */
+ virtual sal_Int32 SAL_CALL getRelationCount() override;
+
+ /** Returns the relation of this relation set that is specified by
+ the given index.
+
+ @param nIndex
+ This index specifies the relatio to return.
+
+ @return
+ For a valid index, i.e. inside the range 0 to the number of
+ relations minus one, the returned value is the requested
+ relation. If the index is invalid then the returned relation
+ has the type INVALID.
+
+ */
+ virtual css::accessibility::AccessibleRelation SAL_CALL getRelation(sal_Int32 nIndex) override;
+
+ /** Tests whether the relation set contains a relation matching the
+ specified key.
+
+ @param aRelationType
+ The type of relation to look for in this set of relations. This
+ has to be one of the constants of
+ AccessibleRelationType.
+
+ @return
+ Returns <TRUE/> if there is a (at least one) relation of the
+ given type and <FALSE/> if there is no such relation in the set.
+ */
+ virtual sal_Bool SAL_CALL containsRelation(sal_Int16 aRelationType) override;
+
+ /** Retrieve and return the relation with the given relation type.
+
+ @param aRelationType
+ The type of the relation to return. This has to be one of the
+ constants of AccessibleRelationType.
+
+ @return
+ If a relation with the given type could be found than (a copy
+ of) this relation is returned. Otherwise a relation with the
+ type INVALID is returned.
+ */
+ virtual css::accessibility::AccessibleRelation SAL_CALL
+ getRelationByType(sal_Int16 aRelationType) override;
+
+ /// @throws uno::RuntimeException
+ void AddRelation(const css::accessibility::AccessibleRelation& rRelation);
+
+ //===== XTypeProvider ===================================================
+
+ /** Returns a sequence of all supported interfaces.
+ */
+ virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
+
+ /** Returns an implementation id.
+ */
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
+
+private:
+ /// Mutex guarding this object.
+ std::mutex maMutex;
+ /// The implementation of this helper interface.
+ std::vector<css::accessibility::AccessibleRelation> maRelations;
+};
+}
+//... namespace utl .......................................................
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/accessiblestatesethelper.hxx b/include/unotools/accessiblestatesethelper.hxx
new file mode 100644
index 000000000..b1e5644f1
--- /dev/null
+++ b/include/unotools/accessiblestatesethelper.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_ACCESSIBLESTATESETHELPER_HXX
+#define INCLUDED_UNOTOOLS_ACCESSIBLESTATESETHELPER_HXX
+
+#include <unotools/unotoolsdllapi.h>
+
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <mutex>
+
+//= XAccessibleStateSet helper classes
+
+//... namespace utl .......................................................
+namespace utl
+{
+/** @descr
+ This base class provides an implementation of the
+ <code>AccessibleStateSet</code> service.
+*/
+class UNOTOOLS_DLLPUBLIC AccessibleStateSetHelper final
+ : public cppu::WeakImplHelper<css::accessibility::XAccessibleStateSet>
+{
+public:
+ //===== internal ========================================================
+
+ AccessibleStateSetHelper();
+ /** constructs an object with some states initially set
+
+ <p>This ctor is compatible with
+ <method scope="comphelper">OAccessibleImplementationAccess::implGetForeignControlledStates</method></p>
+
+ @param _nInitialStates
+ is a bit mask. Every bit 2^n means that the state number n (as got from the
+ AccessibleStateType constants) should be set initially.
+ */
+ AccessibleStateSetHelper(const sal_Int64 _nInitialStates);
+
+ AccessibleStateSetHelper(const AccessibleStateSetHelper& rHelper);
+
+private:
+ virtual ~AccessibleStateSetHelper() override;
+
+public:
+ //===== XAccessibleStateSet ==============================================
+
+ /** Checks whether the current state set is empty.
+
+ @return
+ Returns <TRUE/> if there is no state in this state set and
+ <FALSE/> if there is at least one state set in it.
+ */
+ virtual sal_Bool SAL_CALL isEmpty() override;
+
+ /** Checks if the given state is a member of the state set of this
+ object.
+
+ @param aState
+ The state for which to check membership. This has to be one of
+ the constants of AccessibleStateType.
+
+ @return
+ Returns <TRUE/> if the given state is a member of this object's
+ state set and <FALSE/> otherwise.
+ */
+ virtual sal_Bool SAL_CALL contains(sal_Int16 aState) override;
+
+ /** Checks if all of the given states are in this object's state
+ set.
+
+ @param aStateSet
+ This sequence of states is interpreted as set and every of its
+ members, duplicates are ignored, is checked for membership in
+ this object's state set. Each state has to be one of the
+ constants of AccessibleStateType.
+
+ @return
+ Returns <TRUE/> if all states of the given state set are members
+ of this object's state set. <FALSE/> is returned if at least
+ one of the states in the given state is not a member of this
+ object's state set.
+ */
+ virtual sal_Bool SAL_CALL containsAll(const css::uno::Sequence<sal_Int16>& rStateSet) override;
+
+ /** Returns a sequence of all states.
+ */
+ virtual css::uno::Sequence<sal_Int16> SAL_CALL getStates() override;
+
+ /** Adds a state to the set.
+
+ @throws css::uno::RuntimeException
+ */
+ void AddState(sal_Int16 aState);
+
+ /** Removes a state from the set if the set contains the state, otherwise nothing is done.
+
+ @throws css::uno::RuntimeException
+ */
+ void RemoveState(sal_Int16 aState);
+
+ //===== XTypeProvider ===================================================
+
+ /** Returns a sequence of all supported interfaces.
+ */
+ virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
+
+ /** Returns an implementation id.
+ */
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
+
+private:
+ /// Mutex guarding this object.
+ std::mutex maMutex;
+ /// The implementation of this helper interface.
+ sal_uInt64 maStates;
+};
+}
+//... namespace utl .......................................................
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/bootstrap.hxx b/include/unotools/bootstrap.hxx
new file mode 100644
index 000000000..3f8774140
--- /dev/null
+++ b/include/unotools/bootstrap.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_BOOTSTRAP_HXX
+#define INCLUDED_UNOTOOLS_BOOTSTRAP_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace utl
+{
+ /** provides configuration information needed for application startup.
+
+ This class handles the startup information for the office application.
+ It encapsulates knowledge of how to retrieve such information and how
+ to diagnose failures to retrieve required data.
+
+ */
+ class UNOTOOLS_DLLPUBLIC Bootstrap
+ {
+ // the static interface
+ public: // some common information items
+
+ /// retrieve the product key; defaults to executable name (without extension)
+ static OUString getProductKey();
+
+ /// retrieve the product key; uses the given default, if not found
+ static OUString getProductKey(OUString const& _sDefault);
+
+ /// retrieve the BUILDID information item; uses the given default, if not found
+ static OUString getBuildIdData(OUString const& _sDefault);
+
+ /// reload cached data
+ static void reloadData();
+
+ public: // retrieve path information about the installation location
+ enum PathStatus
+ {
+ PATH_EXISTS, // Success: Found a path to an existing file or directory
+ PATH_VALID, // Found a valid path, but the file or directory does not exist
+ DATA_INVALID, // Retrieved a string for this path, that is not a valid file url or system path
+ DATA_MISSING, // Could not retrieve any data for this path
+ DATA_UNKNOWN // No attempt to retrieve data for this path was made
+ };
+
+ /// get a file URL to the common base installation [${insturl}]
+ static PathStatus locateBaseInstallation(OUString& _rURL);
+
+ /// get a file URL to the user installation [${userurl}]
+ static PathStatus locateUserInstallation(OUString& _rURL);
+
+ /// get a file URL to the user data directory [default is ${userurl}/user]
+ static PathStatus locateUserData(OUString& _rURL);
+
+ // the next two items are mainly supported for diagnostic purposes. both items may be unused
+ /// get a file URL to the bootstrap INI file used [e.g. ${insturl}/program/bootraprc]
+ static PathStatus locateBootstrapFile(OUString& _rURL);
+ /// get a file URL to the version locator INI file used [e.g. ${SYSUSERCONFIG}/sversion.ini]
+ static PathStatus locateVersionFile(OUString& _rURL);
+
+ public: // evaluate the validity of the installation
+ /// high-level status of bootstrap success
+ enum Status
+ {
+ DATA_OK, /// user-dir and share-dir do exist, product key found or can be defaulted to exe-name
+ MISSING_USER_INSTALL, /// ${userurl} does not exist; or version-file cannot be found or is invalid
+ INVALID_USER_INSTALL, /// can locate ${userurl}, but user-dir is missing
+ INVALID_BASE_INSTALL /// other failure: e.g. cannot locate share-dir; bootstraprc missing or invalid; no product key
+ };
+
+ /// error code for detailed diagnostics of bootstrap failures
+ enum FailureCode
+ {
+ NO_FAILURE, /// bootstrap was successful
+ MISSING_INSTALL_DIRECTORY, /// the shared installation directory could not be located
+ MISSING_BOOTSTRAP_FILE, /// the bootstrap INI file could not be found or read
+ MISSING_BOOTSTRAP_FILE_ENTRY, /// the bootstrap INI is missing a required entry
+ INVALID_BOOTSTRAP_FILE_ENTRY, /// the bootstrap INI contains invalid data
+ MISSING_VERSION_FILE, /// the version locator INI file could not be found or read
+ MISSING_VERSION_FILE_ENTRY, /// the version locator INI has no entry for this version
+ INVALID_VERSION_FILE_ENTRY, /// the version locator INI entry is not a valid directory URL
+ MISSING_USER_DIRECTORY, /// the user installation directory does not exist
+ INVALID_BOOTSTRAP_DATA /// some bootstrap data was invalid in unexpected ways
+ };
+
+ /** Evaluates the status of the installation and returns a diagnostic
+ message and error code corresponding to this status
+ */
+ static Status checkBootstrapStatus(OUString& _rDiagnosticMessage, FailureCode& _rErrCode);
+
+ public:
+ /// get the working directory of the process
+ static bool getProcessWorkingDir(OUString &rUrl);
+
+ public:
+ // singleton impl-class
+ class UNOTOOLS_DLLPRIVATE Impl;
+ static const Impl& data(); // the data related to the bootstrap.ini file
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/calendarwrapper.hxx b/include/unotools/calendarwrapper.hxx
new file mode 100644
index 000000000..aa0bb345c
--- /dev/null
+++ b/include/unotools/calendarwrapper.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_CALENDARWRAPPER_HXX
+#define INCLUDED_UNOTOOLS_CALENDARWRAPPER_HXX
+
+#include <tools/datetime.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/i18n/Calendar2.hpp>
+#include <unotools/unotoolsdllapi.h>
+
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::i18n { class XCalendar4; }
+namespace com::sun::star::lang { struct Locale; }
+
+class UNOTOOLS_DLLPUBLIC CalendarWrapper
+{
+ css::uno::Reference< css::i18n::XCalendar4 > xC;
+
+ const DateTime aEpochStart; // 1Jan1970
+
+public:
+ CalendarWrapper(
+ const css::uno::Reference< css::uno::XComponentContext > & rxContext
+ );
+ ~CalendarWrapper();
+
+ // wrapper implementations of XCalendar
+
+ /** Load the default calendar of a locale.
+
+ This adds a bool bTimeZoneUTC parameter which is not part of the UNO API to
+ facilitate handling of non time zone aware data.
+
+ @param bTimeZoneUTC
+ Default <TRUE/>. If <FALSE/>, the system's timezone is assigned
+ to the calendar, including all DST quirks like not existing
+ times on DST transition dates when switching to/from DST. As
+ current implementations and number parser/formatter don't store
+ or convert or calculate with time zones it is safer to use UTC,
+ which is not DST afflicted, otherwise surprises are lurking
+ (for example tdf#92503).
+ */
+ void loadDefaultCalendar( const css::lang::Locale& rLocale, bool bTimeZoneUTC = true );
+ /// This adds a bTimeZoneUTC parameter which is not part of the API.
+ void loadCalendar( const OUString& rUniqueID, const css::lang::Locale& rLocale, bool bTimeZoneUTC = true );
+
+ /* XXX NOTE: the time zone taking UNO API functions are not implemented as
+ * wrapper interface as they are not necessary/used so far. These are:
+ void loadDefaultCalendarTZ( const css::lang::Locale& rLocale, const OUString& rTimeZone );
+ void loadCalendarTZ( const OUString& rUniqueID, const css::lang::Locale& rLocale, const OUString& rTimeZone );
+ */
+
+ css::uno::Sequence< OUString > getAllCalendars( const css::lang::Locale& rLocale ) const;
+ OUString getUniqueID() const;
+ /// set UTC date/time
+ void setDateTime( double fTimeInDays );
+ /// get UTC date/time
+ double getDateTime() const;
+
+ // For local setDateTime() and getDateTime() see further down at wrapper
+ // implementations of XCalendar4.
+
+ // wrapper implementations of XCalendar
+
+ void setValue( sal_Int16 nFieldIndex, sal_Int16 nValue );
+ bool isValid() const;
+ sal_Int16 getValue( sal_Int16 nFieldIndex ) const;
+ sal_Int16 getFirstDayOfWeek() const;
+ sal_Int16 getNumberOfMonthsInYear() const;
+ sal_Int16 getNumberOfDaysInWeek() const;
+ OUString getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType ) const;
+
+ // wrapper implementations of XExtendedCalendar
+
+ OUString getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) const;
+
+ // wrapper implementations of XCalendar3
+
+ css::i18n::Calendar2 getLoadedCalendar() const;
+ css::uno::Sequence< css::i18n::CalendarItem2 > getDays() const;
+ css::uno::Sequence< css::i18n::CalendarItem2 > getMonths() const;
+ css::uno::Sequence< css::i18n::CalendarItem2 > getGenitiveMonths() const;
+ css::uno::Sequence< css::i18n::CalendarItem2 > getPartitiveMonths() const;
+
+ // wrapper implementations of XCalendar4
+
+ /// set local date/time
+ void setLocalDateTime( double fTimeInDays );
+ /// get local date/time
+ double getLocalDateTime() const;
+
+ // convenience methods
+
+ /// get epoch start (should be 01Jan1970)
+ const DateTime& getEpochStart() const
+ { return aEpochStart; }
+
+ /// set a local (!) Gregorian DateTime
+ void setGregorianDateTime( const DateTime& rDateTime )
+ { setLocalDateTime( rDateTime - aEpochStart ); }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/caserotate.hxx b/include/unotools/caserotate.hxx
new file mode 100644
index 000000000..6e61785be
--- /dev/null
+++ b/include/unotools/caserotate.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_UNOTOOLS_CASEROTATE_HXX
+#define INCLUDED_UNOTOOLS_CASEROTATE_HXX
+
+#include <sal/config.h>
+#include <unotools/unotoolsdllapi.h>
+
+enum class TransliterationFlags;
+
+//TODO Use XCharacterClassification::getStringType to determine the current
+//(possibly mixed) case type and rotate to the next one
+
+class UNOTOOLS_DLLPUBLIC RotateTransliteration
+{
+private:
+ int nF3ShiftCounter;
+
+public:
+ RotateTransliteration()
+ : nF3ShiftCounter(0)
+ {
+ }
+ TransliterationFlags getNextMode();
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/charclass.hxx b/include/unotools/charclass.hxx
new file mode 100644
index 000000000..c76c7ae35
--- /dev/null
+++ b/include/unotools/charclass.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_CHARCLASS_HXX
+#define INCLUDED_UNOTOOLS_CHARCLASS_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <i18nlangtag/languagetag.hxx>
+#include <com/sun/star/i18n/DirectionProperty.hpp>
+#include <com/sun/star/i18n/KCharacterType.hpp>
+#include <com/sun/star/i18n/ParseResult.hpp>
+#include <com/sun/star/i18n/UnicodeScript.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::i18n { class XCharacterClassification; }
+
+const sal_Int32 nCharClassAlphaType =
+ css::i18n::KCharacterType::UPPER |
+ css::i18n::KCharacterType::LOWER |
+ css::i18n::KCharacterType::TITLE_CASE;
+
+const sal_Int32 nCharClassAlphaTypeMask =
+ nCharClassAlphaType |
+ css::i18n::KCharacterType::PRINTABLE |
+ css::i18n::KCharacterType::BASE_FORM;
+
+const sal_Int32 nCharClassLetterType =
+ nCharClassAlphaType |
+ css::i18n::KCharacterType::LETTER;
+
+const sal_Int32 nCharClassLetterTypeMask =
+ nCharClassAlphaTypeMask |
+ css::i18n::KCharacterType::LETTER;
+
+const sal_Int32 nCharClassNumericType =
+ css::i18n::KCharacterType::DIGIT;
+
+const sal_Int32 nCharClassNumericTypeMask =
+ nCharClassNumericType |
+ css::i18n::KCharacterType::PRINTABLE |
+ css::i18n::KCharacterType::BASE_FORM;
+
+class UNOTOOLS_DLLPUBLIC CharClass
+{
+ LanguageTag maLanguageTag;
+ css::uno::Reference< css::i18n::XCharacterClassification > xCC;
+
+ CharClass(const CharClass&) = delete;
+ CharClass& operator=(const CharClass&) = delete;
+
+public:
+ /// Preferred ctor with service manager specified
+ CharClass(
+ const css::uno::Reference< css::uno::XComponentContext > & rxContext,
+ LanguageTag aLanguageTag );
+
+ /// Deprecated ctor, tries to get a process service manager or to load the
+ /// library directly.
+ CharClass( LanguageTag aLanguageTag );
+
+ ~CharClass();
+
+ /// get current Locale
+ const LanguageTag& getLanguageTag() const;
+
+ /// isdigit() on ascii values of entire string
+ static bool isAsciiNumeric( std::u16string_view rStr );
+
+ /// isalpha() on ascii values of entire string
+ static bool isAsciiAlpha( std::u16string_view rStr );
+
+ /// whether type is pure numeric or not, e.g. return of getStringType
+ static bool isNumericType( sal_Int32 nType )
+ {
+ return ((nType & nCharClassNumericType) != 0) &&
+ ((nType & ~nCharClassNumericTypeMask) == 0);
+ }
+
+ /// whether type is pure alphanumeric or not, e.g. return of getStringType
+ static bool isAlphaNumericType( sal_Int32 nType )
+ {
+ return ((nType & (nCharClassAlphaType |
+ nCharClassNumericType)) != 0) &&
+ ((nType & ~(nCharClassAlphaTypeMask |
+ nCharClassNumericTypeMask)) == 0);
+ }
+
+ /// whether type is pure letter or not, e.g. return of getStringType
+ static bool isLetterType( sal_Int32 nType )
+ {
+ return ((nType & nCharClassLetterType) != 0) &&
+ ((nType & ~nCharClassLetterTypeMask) == 0);
+ }
+
+ /// whether type is pure letternumeric or not, e.g. return of getStringType
+ static bool isLetterNumericType( sal_Int32 nType )
+ {
+ return ((nType & (nCharClassLetterType |
+ nCharClassNumericType)) != 0) &&
+ ((nType & ~(nCharClassLetterTypeMask |
+ nCharClassNumericTypeMask)) == 0);
+ }
+
+ // Wrapper implementations of class CharacterClassification
+
+ OUString uppercase( const OUString& rStr, sal_Int32 nPos, sal_Int32 nCount ) const;
+ OUString lowercase( const OUString& rStr, sal_Int32 nPos, sal_Int32 nCount ) const;
+ OUString titlecase( const OUString& rStr, sal_Int32 nPos, sal_Int32 nCount ) const;
+
+ OUString uppercase( const OUString& _rStr ) const
+ {
+ return uppercase(_rStr, 0, _rStr.getLength());
+ }
+ OUString lowercase( const OUString& _rStr ) const
+ {
+ return lowercase(_rStr, 0, _rStr.getLength());
+ }
+ OUString titlecase( const OUString& _rStr ) const
+ {
+ return titlecase(_rStr, 0, _rStr.getLength());
+ }
+
+ sal_Int16 getType( const OUString& rStr, sal_Int32 nPos ) const;
+ css::i18n::DirectionProperty getCharacterDirection( const OUString& rStr, sal_Int32 nPos ) const;
+ css::i18n::UnicodeScript getScript( const OUString& rStr, sal_Int32 nPos ) const;
+ sal_Int32 getCharacterType( const OUString& rStr, sal_Int32 nPos ) const;
+ sal_Int32 getStringType( const OUString& rStr, sal_Int32 nPos, sal_Int32 nCount ) const;
+
+ css::i18n::ParseResult parseAnyToken(
+ const OUString& rStr,
+ sal_Int32 nPos,
+ sal_Int32 nStartCharFlags,
+ const OUString& userDefinedCharactersStart,
+ sal_Int32 nContCharFlags,
+ const OUString& userDefinedCharactersCont ) const;
+
+ css::i18n::ParseResult parsePredefinedToken(
+ sal_Int32 nTokenType,
+ const OUString& rStr,
+ sal_Int32 nPos,
+ sal_Int32 nStartCharFlags,
+ const OUString& userDefinedCharactersStart,
+ sal_Int32 nContCharFlags,
+ const OUString& userDefinedCharactersCont ) const;
+
+ // Functionality of class International methods
+
+ bool isAlpha( const OUString& rStr, sal_Int32 nPos ) const;
+ bool isLetter( const OUString& rStr, sal_Int32 nPos ) const;
+ bool isDigit( const OUString& rStr, sal_Int32 nPos ) const;
+ bool isAlphaNumeric( const OUString& rStr, sal_Int32 nPos ) const;
+ bool isLetterNumeric( const OUString& rStr, sal_Int32 nPos ) const;
+ bool isLetter( const OUString& rStr ) const;
+ bool isNumeric( const OUString& rStr ) const;
+ bool isLetterNumeric( const OUString& rStr ) const;
+
+private:
+
+ const css::lang::Locale & getMyLocale() const;
+};
+
+#endif // INCLUDED_UNOTOOLS_CHARCLASS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/closeveto.hxx b/include/unotools/closeveto.hxx
new file mode 100644
index 000000000..bcc56766f
--- /dev/null
+++ b/include/unotools/closeveto.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_CLOSEVETO_HXX
+#define INCLUDED_UNOTOOLS_CLOSEVETO_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/uno/Reference.hxx>
+#include <memory>
+
+namespace com::sun::star::uno { class XInterface; }
+
+namespace utl
+{
+
+ //= CloseVeto
+ struct CloseVeto_Data;
+ /** will add a XCloseListener to a given component, and veto its closing as long as the <code>CloseVeto</code>
+ instance is alive.
+
+ If closing has been requested and vetoed while the <code>CloseVeto</code> instance is alive, and the ownership
+ went to the <code>CloseVeto</code> instance, then it will close the component in its dtor.
+ */
+ class UNOTOOLS_DLLPUBLIC CloseVeto
+ {
+ public:
+ CloseVeto( const css::uno::Reference< css::uno::XInterface >& i_closeable,
+ bool bHasOwnership = false);
+ ~CloseVeto();
+
+ private:
+ std::unique_ptr< CloseVeto_Data > m_xData;
+ };
+
+} // namespace dbaui
+
+#endif // INCLUDED_UNOTOOLS_CLOSEVETO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/cmdoptions.hxx b/include/unotools/cmdoptions.hxx
new file mode 100644
index 000000000..bb3414f8f
--- /dev/null
+++ b/include/unotools/cmdoptions.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_CMDOPTIONS_HXX
+#define INCLUDED_UNOTOOLS_CMDOPTIONS_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+#include <memory>
+
+namespace com::sun::star::uno
+{
+template <typename> class Reference;
+}
+
+namespace com::sun::star::frame
+{
+class XFrame;
+}
+namespace osl
+{
+class Mutex;
+}
+
+/*-************************************************************************************************************
+ @descr The method GetList() returns a list of property values.
+ Use follow defines to separate values by names.
+**-***********************************************************************************************************/
+
+/*-************************************************************************************************************
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is necessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+**-***********************************************************************************************************/
+
+class SvtCommandOptions_Impl;
+
+/*-************************************************************************************************************
+ @short collect information about dynamic menus
+ @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard".
+ @devstatus ready to use
+**-***********************************************************************************************************/
+
+class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtCommandOptions final : public utl::detail::Options
+{
+ friend class SvtCommandOptions_Impl;
+
+public:
+ enum CmdOption
+ {
+ CMDOPTION_DISABLED,
+ CMDOPTION_NONE
+ };
+
+ SvtCommandOptions();
+ virtual ~SvtCommandOptions() override;
+
+ /*-****************************************************************************************************
+ @short return complete specified list
+ @descr Call it to get all entries of an dynamic menu.
+ We return a list of all nodes with its names and properties.
+ @param "eOption" select the list to retrieve.
+ @return A list of command strings is returned.
+
+ @onerror We return an empty list.
+ **-***************************************************************************************************/
+
+ bool HasEntries(CmdOption eOption) const;
+
+ /*-****************************************************************************************************
+ @short Lookup if a command URL is inside a given list
+ @descr Lookup if a command URL is inside a given lst
+ @param "eOption" select right command list
+ @param "aCommandURL" a command URL that is used for the look up
+ @return "sal_True" if the command is inside the list otherwise "sal_False"
+ **-***************************************************************************************************/
+
+ bool Lookup(CmdOption eOption, const OUString& aCommandURL) const;
+
+ /*-****************************************************************************************************
+ @short register an office frame, which must update its dispatches if
+ the underlying configuration was changed.
+
+ @descr To avoid using of "dead" frame objects or implementing
+ deregistration mechanism too, we use weak references to
+ the given frames.
+
+ @param "xFrame" points to the frame, which wishes to be
+ notified, if configuration was changed.
+ **-***************************************************************************************************/
+
+ void EstablishFrameCallback(const css::uno::Reference<css::frame::XFrame>& xFrame);
+
+private:
+ std::shared_ptr<SvtCommandOptions_Impl> m_pImpl;
+
+}; // class SvtCmdOptions
+
+#endif // INCLUDED_UNOTOOLS_CMDOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/collatorwrapper.hxx b/include/unotools/collatorwrapper.hxx
new file mode 100644
index 000000000..595d9ccf4
--- /dev/null
+++ b/include/unotools/collatorwrapper.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_COLLATORWRAPPER_HXX
+#define INCLUDED_UNOTOOLS_COLLATORWRAPPER_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace com::sun::star::uno {
+ class XComponentContext;
+}
+
+namespace com::sun::star::i18n { class XCollator; }
+namespace com::sun::star::lang { struct Locale; }
+
+class UNOTOOLS_DLLPUBLIC CollatorWrapper
+{
+ private:
+ css::uno::Reference< css::i18n::XCollator > mxInternationalCollator;
+
+ public:
+
+ CollatorWrapper (
+ const css::uno::Reference< css::uno::XComponentContext > &rxContext);
+
+ sal_Int32
+ compareString (
+ const OUString& s1, const OUString& s2) const;
+
+ css::uno::Sequence< OUString >
+ listCollatorAlgorithms (
+ const css::lang::Locale& rLocale) const;
+
+ sal_Int32
+ loadDefaultCollator (
+ const css::lang::Locale& rLocale, sal_Int32 nOption);
+
+ void
+ loadCollatorAlgorithm (
+ const OUString& rAlgorithm,
+ const css::lang::Locale& rLocale, sal_Int32 nOption);
+};
+
+#endif // INCLUDED_UNOTOOLS_COLLATORWRAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/compatibility.hxx b/include/unotools/compatibility.hxx
new file mode 100644
index 000000000..b929771b5
--- /dev/null
+++ b/include/unotools/compatibility.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_COMPATIBILITY_HXX
+#define INCLUDED_UNOTOOLS_COMPATIBILITY_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <unotools/options.hxx>
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+#include <memory>
+#include <vector>
+
+namespace osl { class Mutex; }
+
+/*-************************************************************************************************************
+ @descr Struct to hold information about one compatibility entry
+*//*-*************************************************************************************************************/
+class SvtCompatibilityEntry
+{
+ public:
+ /*-************************************************************************************************************
+ @descr The method SvtCompatibilityOptions::GetList() returns a list of property values.
+ Use follow enum class to separate values by names.
+ Sync it with sPropertyName in SvtCompatibilityEntry::getName()
+ *//*-*************************************************************************************************************/
+ enum class Index
+ {
+ /* Should be in the start. Do not remove it. */
+ Name,
+ Module,
+
+ /* Editable list of compatibility options. */
+ UsePrtMetrics,
+ AddSpacing,
+ AddSpacingAtPages,
+ UseOurTabStops,
+ NoExtLeading,
+ UseLineSpacing,
+ AddTableSpacing,
+ UseObjectPositioning,
+ UseOurTextWrapping,
+ ConsiderWrappingStyle,
+ ExpandWordSpace,
+ ProtectForm,
+ MsWordTrailingBlanks,
+ SubtractFlysAnchoredAtFlys,
+ EmptyDbFieldHidesPara,
+ /// special entry: optcomp.cxx converts the other values to
+ /// integers but not this one because it doesn't have its own
+ /// checkbox, so keep it at the end!
+ AddTableLineSpacing,
+
+ /* Should be at the end. Do not remove it. */
+ INVALID
+ };
+
+ SvtCompatibilityEntry();
+
+ static OUString getName( const Index rIdx );
+
+ static constexpr OUStringLiteral USER_ENTRY_NAME = u"_user";
+ static constexpr OUStringLiteral DEFAULT_ENTRY_NAME = u"_default";
+
+ static size_t getElementCount()
+ {
+ return static_cast<size_t>(Index::INVALID);
+ }
+
+ css::uno::Any getValue( const Index rIdx ) const
+ {
+ if ( static_cast<size_t>(rIdx) < getElementCount() )
+ {
+ return m_aPropertyValue[ static_cast<int>(rIdx) ];
+ } else
+ {
+ /* Wrong index. */
+ assert( false );
+ return css::uno::Any();
+ }
+ }
+
+ template<typename T>
+ T getValue( const Index rIdx ) const
+ {
+ T aValue = T();
+
+ if ( static_cast<size_t>(rIdx) < getElementCount() )
+ {
+ m_aPropertyValue[ static_cast<int>(rIdx) ] >>= aValue;
+ } else
+ {
+ /* Wrong index. */
+ assert( false );
+ }
+
+ return aValue;
+ }
+
+ void setValue( const Index rIdx, css::uno::Any const & rValue )
+ {
+ if ( static_cast<size_t>(rIdx) < getElementCount() )
+ {
+ m_aPropertyValue[ static_cast<int>(rIdx) ] = rValue;
+ } else
+ {
+ /* Wrong index. */
+ assert( false );
+ }
+ }
+
+ template<typename T>
+ void setValue( const Index rIdx, T rValue )
+ {
+ setValue(rIdx, css::uno::Any(rValue));
+ }
+
+ private:
+ std::vector<css::uno::Any> m_aPropertyValue;
+};
+
+/*-************************************************************************************************************
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is necessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+class SvtCompatibilityOptions_Impl;
+
+/*-************************************************************************************************************
+ @short collect information about dynamic menus
+ @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard".
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+class UNOTOOLS_DLLPUBLIC SvtCompatibilityOptions final : public utl::detail::Options
+{
+ public:
+ SvtCompatibilityOptions();
+ virtual ~SvtCompatibilityOptions() override;
+
+ /*-****************************************************************************************************
+ @short append a new item
+ @descr
+
+ @seealso method Clear()
+
+ @param "aItem" SvtCompatibilityEntry
+ *//*-*****************************************************************************************************/
+ void AppendItem( const SvtCompatibilityEntry& aItem );
+
+ /*-****************************************************************************************************
+ @short clear complete specified list
+ @descr Call this methods to clear the whole list.
+ *//*-*****************************************************************************************************/
+ void Clear();
+
+ void SetDefault( SvtCompatibilityEntry::Index rIdx, bool rValue );
+ bool GetDefault( SvtCompatibilityEntry::Index rIdx ) const;
+
+ /*-****************************************************************************************************
+ @short return complete specified list
+ @descr Call it to get all entries of compatibility options.
+ We return a list of all nodes with its names and properties.
+ @return A list of compatibility options is returned.
+
+ @onerror We return an empty list.
+ *//*-*****************************************************************************************************/
+ std::vector< SvtCompatibilityEntry > GetList() const;
+
+ private:
+ std::shared_ptr<SvtCompatibilityOptions_Impl> m_pImpl;
+
+ /*-****************************************************************************************************
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods aren't safe!
+ We create a static mutex only for one ime and use at different times.
+ @return A reference to a static mutex member.
+ *//*-*****************************************************************************************************/
+ UNOTOOLS_DLLPRIVATE static osl::Mutex& GetOwnStaticMutex();
+};
+
+#endif // INCLUDED_UNOTOOLS_COMPATIBILITY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/configitem.hxx b/include/unotools/configitem.hxx
new file mode 100644
index 000000000..7692bd3d6
--- /dev/null
+++ b/include/unotools/configitem.hxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_CONFIGITEM_HXX
+#define INCLUDED_UNOTOOLS_CONFIGITEM_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/Reference.h>
+#include <unotools/unotoolsdllapi.h>
+#include <unotools/options.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace com::sun::star {
+ namespace uno{
+ class Any;
+ }
+ namespace beans{
+ struct PropertyValue;
+ }
+ namespace container{
+ class XHierarchicalNameAccess;
+ }
+ namespace util{
+ class XChangesListener;
+ }
+}
+
+enum class ConfigItemMode
+{
+ NONE = 0x00,
+ AllLocales = 0x02,
+ ReleaseTree = 0x04,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<ConfigItemMode> : is_typed_flags<ConfigItemMode, 0x06> {};
+}
+
+namespace utl
+{
+
+ enum class ConfigNameFormat
+ {
+ LocalNode, // local node name, for use in XNameAccess etc. ("Item", "Q & A")
+ LocalPath, // one-level relative path, for use when building paths etc. ("Item", "Typ['Q &amp; A']")
+ };
+
+ class UNOTOOLS_DLLPUBLIC ConfigItem : public ConfigurationBroadcaster
+ {
+ friend class ConfigChangeListener_Impl;
+ friend class ConfigManager;
+
+ const OUString sSubTree;
+ css::uno::Reference< css::container::XHierarchicalNameAccess>
+ m_xHierarchyAccess;
+ css::uno::Reference< css::util::XChangesListener >
+ xChangeLstnr;
+ ConfigItemMode m_nMode;
+ bool m_bIsModified;
+ bool m_bEnableInternalNotification;
+ sal_Int16 m_nInValueChange;
+
+ void RemoveChangesListener();
+ void CallNotify(
+ const css::uno::Sequence<OUString>& aPropertyNames);
+
+ // In special mode ALL_LOCALES we must support reading/writing of localized cfg entries as Sequence< PropertyValue >.
+ // These methods are helper to convert given lists of names and Any-values.
+ // format: PropertyValue.Name = <locale as ISO string>
+ // PropertyValue.Value = <value; type depends from cfg entry!>
+ // e.g.
+ // LOCALIZED NODE
+ // "UIName"
+ // LOCALE VALUE
+ // "de" "Mein Name"
+ // "en-US" "my name"
+ static void impl_packLocalizedProperties ( const css::uno::Sequence< OUString >& lInNames ,
+ const css::uno::Sequence< css::uno::Any >& lInValues ,
+ css::uno::Sequence< css::uno::Any >& lOutValues );
+ static void impl_unpackLocalizedProperties (
+ const css::uno::Sequence< OUString >& lInNames ,
+ const css::uno::Sequence< css::uno::Any >& lInValues ,
+ css::uno::Sequence< OUString >& lOutNames ,
+ css::uno::Sequence< css::uno::Any >& lOutValues);
+
+ css::uno::Reference< css::container::XHierarchicalNameAccess>
+ GetTree();
+ /** writes the changed values into the sub tree.
+ Private and only called from non-virtual public Commit(). */
+ virtual void ImplCommit() = 0;
+
+ protected:
+ explicit ConfigItem(OUString aSubTree,
+ ConfigItemMode nMode = ConfigItemMode::NONE);
+
+ void SetModified (); // mark item as modified
+ void ClearModified(); // reset state after commit!
+
+ css::uno::Sequence< css::uno::Any>
+ GetProperties(const css::uno::Sequence< OUString >& rNames);
+
+ css::uno::Sequence< sal_Bool >
+ GetReadOnlyStates(const css::uno::Sequence< OUString >& rNames);
+
+ bool PutProperties(
+ const css::uno::Sequence< OUString >& rNames,
+ const css::uno::Sequence< css::uno::Any>& rValues);
+
+ /** enables notifications about changes on selected sub nodes/values
+
+ Before calling this method a second time for a possibly changed node/value set,
+ you must disable the current notifications by calling DisableNotification.
+
+ @see Notify
+ @see DisableNotification
+ */
+ bool EnableNotification(const css::uno::Sequence< OUString >& rNames,
+ bool bEnableInternalNotification = false);
+ /** disables notifications about changes on sub nodes/values, which previously had
+ been enabled with EnableNotification
+ @see Notify
+ @see EnableNotification
+ */
+ void DisableNotification();
+
+ //returns all members of a node in a specific format
+ css::uno::Sequence< OUString >
+ GetNodeNames(const OUString& rNode);
+ //returns all members of a node in a specific format
+ css::uno::Sequence< OUString >
+ GetNodeNames(const OUString& rNode, ConfigNameFormat eFormat);
+ // remove all members of a set
+ bool ClearNodeSet(const OUString& rNode);
+ // remove selected members of a set
+ bool ClearNodeElements(const OUString& rNode,
+ css::uno::Sequence< OUString > const & rElements);
+ // change or add members to a set
+ bool SetSetProperties(const OUString& rNode, const css::uno::Sequence< css::beans::PropertyValue >& rValues);
+ // remove, change or add members of a set
+ bool ReplaceSetProperties(const OUString& rNode, const css::uno::Sequence< css::beans::PropertyValue >& rValues);
+ // add a new node without setting any properties
+ bool AddNode(const OUString& rNode, const OUString& rNewNode);
+
+ public:
+ virtual ~ConfigItem() override;
+
+ ConfigItem(ConfigItem const &) = default;
+ ConfigItem(ConfigItem &&) = default;
+ ConfigItem & operator =(ConfigItem const &) = delete; // due to const sSubTree
+ ConfigItem & operator =(ConfigItem &&) = delete; // due to const sSubTree
+
+ /** is called from the ConfigManager before application ends of from the
+ PropertyChangeListener if the sub tree broadcasts changes. */
+ virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames)=0;
+
+ const OUString& GetSubTreeName() const {return sSubTree;}
+
+ bool IsModified() const { return m_bIsModified;}
+
+ void Commit();
+
+ ConfigItemMode GetMode() const { return m_nMode;}
+
+ //returns all members of a node in a specific format
+ static css::uno::Sequence< OUString > GetNodeNames(
+ css::uno::Reference<css::container::XHierarchicalNameAccess> const & xHierarchyAccess,
+ const OUString& rNode, ConfigNameFormat eFormat);
+ static css::uno::Sequence< css::uno::Any> GetProperties(
+ css::uno::Reference<css::container::XHierarchicalNameAccess> const & xHierarchyAccess,
+ const css::uno::Sequence< OUString >& rNames,
+ bool bAllLocales);
+ static bool PutProperties(
+ css::uno::Reference<css::container::XHierarchicalNameAccess> const & xHierarchyAccess,
+ const css::uno::Sequence< OUString >& rNames,
+ const css::uno::Sequence< css::uno::Any>& rValues,
+ bool bAllLocales);
+ // remove all members of a set
+ static bool ClearNodeSet(
+ css::uno::Reference<css::container::XHierarchicalNameAccess> const & xHierarchyAccess,
+ const OUString& rNode);
+ // remove, change or add members of a set
+ static bool ReplaceSetProperties(
+ css::uno::Reference<css::container::XHierarchicalNameAccess> const & xHierarchyAccess,
+ const OUString& rNode,
+ const css::uno::Sequence< css::beans::PropertyValue >& rValues,
+ bool bAllLocales);
+ // change or add members to a set
+ static bool SetSetProperties(
+ css::uno::Reference<css::container::XHierarchicalNameAccess> const & xHierarchyAccess,
+ const OUString& rNode,
+ const css::uno::Sequence< css::beans::PropertyValue >& rValues);
+ };
+}//namespace utl
+#endif // INCLUDED_UNOTOOLS_CONFIGITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/configmgr.hxx b/include/unotools/configmgr.hxx
new file mode 100644
index 000000000..e8d42a28f
--- /dev/null
+++ b/include/unotools/configmgr.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_CONFIGMGR_HXX
+#define INCLUDED_UNOTOOLS_CONFIGMGR_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <sal/types.h>
+#include <unotools/unotoolsdllapi.h>
+
+namespace com::sun::star::container {
+ class XHierarchicalNameAccess;
+}
+namespace utl { class ConfigItem; }
+
+namespace utl {
+
+class UNOTOOLS_DLLPUBLIC ConfigManager {
+public:
+ static OUString getAboutBoxProductVersion();
+
+ static OUString getAboutBoxProductVersionSuffix();
+
+ static OUString getDefaultCurrency();
+
+ static OUString getUILocale();
+
+ static OUString getWorkLocale();
+
+ static OUString getProductExtension();
+
+ static OUString getProductName();
+
+ static OUString getProductVersion();
+
+ static OUString getVendor();
+
+ static void storeConfigItems();
+
+ SAL_DLLPRIVATE static ConfigManager & getConfigManager();
+
+ SAL_DLLPRIVATE static css::uno::Reference< css::container::XHierarchicalNameAccess>
+ acquireTree(utl::ConfigItem const & item);
+
+ static css::uno::Reference< css::container::XHierarchicalNameAccess>
+ acquireTree(std::u16string_view rSubTreeName);
+
+ SAL_DLLPRIVATE ConfigManager();
+
+ SAL_DLLPRIVATE ~ConfigManager();
+
+ SAL_DLLPRIVATE css::uno::Reference< css::container::XHierarchicalNameAccess >
+ addConfigItem(utl::ConfigItem & item);
+
+ SAL_DLLPRIVATE void removeConfigItem(utl::ConfigItem & item);
+
+ SAL_DLLPRIVATE void registerConfigItem(utl::ConfigItem * item);
+
+ // Avoid using the config layer and rely on defaults which is only useful
+ // for special test tool targets (typically fuzzing) where start-up speed
+ // is of the essence
+#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
+ static constexpr bool IsFuzzing() { return true; }
+#else
+ static bool IsFuzzing();
+#endif
+ static void EnableFuzzing();
+
+private:
+
+ ConfigManager(const ConfigManager&) = delete;
+ ConfigManager& operator=(const ConfigManager&) = delete;
+
+ void doStoreConfigItems();
+
+ std::vector< ConfigItem * > items_;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/confignode.hxx b/include/unotools/confignode.hxx
new file mode 100644
index 000000000..f334aa149
--- /dev/null
+++ b/include/unotools/confignode.hxx
@@ -0,0 +1,272 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_CONFIGNODE_HXX
+#define INCLUDED_UNOTOOLS_CONFIGNODE_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <unotools/eventlisteneradapter.hxx>
+
+namespace com::sun::star::container { class XHierarchicalNameAccess; }
+namespace com::sun::star::container { class XNameAccess; }
+namespace com::sun::star::container { class XNameContainer; }
+namespace com::sun::star::container { class XNameReplace; }
+namespace com::sun::star::lang { class XMultiServiceFactory; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::util { class XChangesBatch; }
+
+namespace utl
+{
+
+ /** a small wrapper around a configuration node.<p/>
+ Nodes in the terminology used herein are <em>inner</em> nodes of a configuration
+ tree, which means <em>no leafs</em>.
+ */
+ class UNOTOOLS_DLLPUBLIC OConfigurationNode : public ::utl::OEventListenerAdapter
+ {
+ private:
+ css::uno::Reference< css::container::XHierarchicalNameAccess >
+ m_xHierarchyAccess; /// accessing children grandchildren (mandatory interface of our UNO object)
+ css::uno::Reference< css::container::XNameAccess >
+ m_xDirectAccess; /// accessing children (mandatory interface of our UNO object)
+ css::uno::Reference< css::container::XNameReplace >
+ m_xReplaceAccess; /// replacing child values
+ css::uno::Reference< css::container::XNameContainer >
+ m_xContainerAccess; /// modifying set nodes (optional interface of our UNO object)
+ bool m_bEscapeNames; /// escape names before accessing children ?
+
+ OConfigurationNode insertNode(const OUString& _rName,const css::uno::Reference< css::uno::XInterface >& _xNode) const noexcept;
+
+ protected:
+ /// constructs a node object with an interface representing a node
+ OConfigurationNode(
+ const css::uno::Reference< css::uno::XInterface >& _rxNode
+ );
+
+ const css::uno::Reference< css::container::XNameAccess >&
+ getUNONode() const { return m_xDirectAccess; }
+
+ public:
+ /// constructs an empty and invalid node object
+ OConfigurationNode() :m_bEscapeNames(false) { }
+ /// copy ctor
+ OConfigurationNode(const OConfigurationNode& _rSource);
+ /// move ctor
+ OConfigurationNode(OConfigurationNode&& _rSource);
+
+ /// assignment
+ OConfigurationNode& operator=(const OConfigurationNode& _rSource);
+ OConfigurationNode& operator=(OConfigurationNode&& _rSource);
+
+ /// returns the local name of the node
+ OUString getLocalName() const;
+
+ /** open a sub node
+ @param _rPath access path of the to-be-opened sub node. May be a hierarchical path.
+ */
+ OConfigurationNode openNode(const OUString& _rPath) const noexcept;
+
+ OConfigurationNode openNode( const char* _pAsciiPath ) const
+ {
+ return openNode( OUString::createFromAscii( _pAsciiPath ) );
+ }
+
+ /** create a new child node
+
+ If the object represents a set node, this method may be used to create a new child. For non-set-nodes, the
+ method will fail.<br/>
+ Unless the respective operations on the pure configuration API, the to-be-created node immediately
+ becomes a part of its hierarchy, no explicit insertion is necessary.
+ @param _rName name for the new child. Must be level-1-depth.
+ */
+ OConfigurationNode createNode(const OUString& _rName) const noexcept;
+
+ /** remove an existent child nod
+
+ If the object represents a set node, this method may be used to delete an existent child. For non-set-nodes,
+ the method will fail.
+ */
+ bool removeNode(const OUString& _rName) const noexcept;
+
+ /** retrieves the content of a descendant
+
+ the returned value may contain anything from an interface (if <arg>_rPath</arg> refers to inner node of
+ the configuration tree) to any explicit value (e.g. string, integer) or even void.<br/>
+ Unfortunately, this implies that if a void value is returned, you won't have a clue if this means
+ "the path does not exist" (besides the assertion made :), or if the value is really void.
+ */
+ css::uno::Any getNodeValue(const OUString& _rPath) const noexcept;
+
+ css::uno::Any getNodeValue( const char* _pAsciiPath ) const
+ {
+ return getNodeValue( OUString::createFromAscii( _pAsciiPath ) );
+ }
+
+ /** write a node value<p/>
+ The value given is written into the node specified by the given relative path.<br/>
+ In opposite to <method>getNodeValue</method>, _rName must refer to a leaf in the configuration tree, not an inner
+ node.
+ @return sal_True if and only if the write was successful.
+ */
+ bool setNodeValue(const OUString& _rPath, const css::uno::Any& _rValue) const noexcept;
+
+ bool setNodeValue( const char* _pAsciiPath, const css::uno::Any& _rValue ) const
+ {
+ return setNodeValue( OUString::createFromAscii( _pAsciiPath ), _rValue );
+ }
+
+ /// return the names of the existing children
+ css::uno::Sequence< OUString >
+ getNodeNames() const noexcept;
+
+ /// invalidate the object
+ virtual void clear() noexcept;
+
+ // meta information about the node
+
+ /// checks whether or not the object represents a set node.
+ bool isSetNode() const;
+
+ /// checks whether or not a direct child with a given name exists
+ bool hasByName(const OUString& _rName) const noexcept;
+
+ /// checks whether or not a descendent (no matter if direct or indirect) with the given name exists
+ bool hasByHierarchicalName( const OUString& _rName ) const noexcept;
+
+ /// check if the objects represents a valid configuration node
+ bool isValid() const { return m_xHierarchyAccess.is(); }
+
+ /// check whether the object is read-only of updatable
+ bool isReadonly() const { return !m_xReplaceAccess.is(); }
+
+ protected:
+ // OEventListenerAdapter
+ virtual void _disposing( const css::lang::EventObject& _rSource ) override;
+
+ protected:
+ enum NAMEORIGIN
+ {
+ NO_CONFIGURATION, /// the name came from a configuration node
+ NO_CALLER /// the name came from a client of this class
+ };
+ OUString normalizeName(const OUString& _rName, NAMEORIGIN _eOrigin) const;
+ };
+
+ //= OConfigurationTreeRoot
+
+ /** a specialized version of an OConfigurationNode, representing the root
+ of a configuration sub tree<p/>
+ Only this class is able to commit any changes made any any OConfigurationNode
+ objects.
+ */
+ class UNOTOOLS_DLLPUBLIC OConfigurationTreeRoot final : public OConfigurationNode
+ {
+ css::uno::Reference< css::util::XChangesBatch >
+ m_xCommitter;
+ /** ctor for a readonly node
+ */
+ OConfigurationTreeRoot(
+ const css::uno::Reference< css::uno::XInterface >& _rxRootNode
+ );
+
+ public:
+ /// modes to use when creating a top-level node object
+ enum CREATION_MODE
+ {
+ /// open the node (i.e. sub tree) for read access only
+ CM_READONLY,
+ /// open the node (i.e. sub tree) for read and write access, fall back to read-only if write access is not possible
+ CM_UPDATABLE
+ };
+
+ public:
+ /** default ctor<p/>
+ The object constructed here is invalid (i.e. <method>isValid</method> will return sal_False).
+ */
+ OConfigurationTreeRoot() {}
+
+ /** creates a configuration tree for the given path in the given mode
+ */
+ OConfigurationTreeRoot(
+ const css::uno::Reference<css::uno::XComponentContext> & i_rContext,
+ const OUString& i_rNodePath,
+ const bool i_bUpdatable
+ );
+
+ /** open a new top-level configuration node
+
+ opens a new node which is the root if an own configuration sub tree. This is what "top level" means: The
+ node does not have a parent. It does not mean that the node represents a module tree (like org.openoffice.Office.Writer
+ or such).<br/>
+ In opposite to <method>createWithServiceFactory</method>, createWithProvider expects a configuration provider
+ to work with.
+
+ @param _rxConfProvider configuration provider to use when retrieving the node.
+ @param _rPath path to the node the object should represent
+ @param _nDepth depth for node retrieval
+ @param _eMode specifies which privileges should be applied when retrieving the node
+
+ @see createWithServiceFactory
+ */
+ static OConfigurationTreeRoot createWithProvider(
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxConfProvider,
+ const OUString& _rPath,
+ sal_Int32 _nDepth,
+ CREATION_MODE _eMode
+ );
+
+ /** open a new top-level configuration node<p/>
+ opens a new node which is the root if an own configuration sub tree. This is what "top level" means: The
+ node does not have a parent. It does not mean that the node represents a module tree (like org.openoffice.Office.Writer
+ or such).<br/>
+ In opposite to <method>createWithProvider</method>, createWithProvider expects a service factory. This factory
+ is used to create a configuration provider, and this provider is used to retrieve the node
+ @see createWithProvider
+ @param _rxContext service factory to use to create the configuration provider.
+ @param _rPath path to the node the object should represent
+ @param _nDepth depth for node retrieval
+ @param _eMode specifies which privileges should be applied when retrieving the node
+ */
+ static OConfigurationTreeRoot createWithComponentContext(const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_UPDATABLE);
+
+ /** tolerant version of the <member>createWithServiceFactory</member>
+
+ <p>No assertions are thrown in case of a failure to initialize the configuration service, but once
+ the configuration could be initialized, errors in the creation of the specific node (e.g. because the
+ given node path does not exist) are still asserted.</p>
+ */
+ static OConfigurationTreeRoot tryCreateWithComponentContext( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_UPDATABLE );
+
+ /** commit all changes made on the subtree the object is the root for<p/>
+ All changes made on any OConfigurationNode object retrieved (maybe indirect) from this root
+ object are committed when calling this method.
+ @return sal_True if and only if the commit was successful
+ */
+ bool commit() const noexcept;
+
+ /// invalidate the object
+ virtual void clear() noexcept override;
+ };
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_CONFIGNODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/configpaths.hxx b/include/unotools/configpaths.hxx
new file mode 100644
index 000000000..119733a47
--- /dev/null
+++ b/include/unotools/configpaths.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_CONFIGPATHS_HXX
+#define INCLUDED_UNOTOOLS_CONFIGPATHS_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace utl
+{
+
+ /** extract the local nodename and the parent nodepath
+ from a configuration path.
+
+ @param _sInPath
+ A configuration path that is not an empty or root path.<BR/>
+ If this is not a valid configuration path, it is interpreted as
+ local name of a node.
+
+ @param _rsOutPath
+ On exit: The configuration path obtained by dropping
+ the last level off <var>_sInPath</var>.<BR/>
+ If <var>_sInPath</var> could not be parsed as a valid
+ configuration path, this is set to an empty string.
+
+ @param _rsLocalName
+ On exit: The plain (non-escaped) name of the node identified by
+ <var>_sInPath</var>. <BR/>
+ If <var>_sInPath</var> could not be parsed as a valid
+ configuration path, this is set to <var>_sInPath</var>.
+
+ @returns
+ <TRUE/>, if a parent path could be set
+ <FALSE/>, if the path was a one-level path or an invalid path
+
+ */
+ UNOTOOLS_DLLPUBLIC bool splitLastFromConfigurationPath(OUString const& _sInPath,
+ OUString& _rsOutPath,
+ OUString& _rsLocalName);
+
+ /** extract the first nodename from a configuration path.
+
+ @param _sInPath
+ A relative configuration path that is not empty.<BR/>
+ If this is not a valid configuration path, it is interpreted as
+ a single name of a node.
+
+ @param _sOutPath
+ If non-null, contains the remainder of the path upon return.
+
+ @returns
+ The plain (non-escaped) name of the node that is the first step
+ when traversing <var>_sInPath</var>.<BR/>
+ If <var>_sInPath</var> could not be parsed as a valid
+ configuration path, it is returned unaltered.
+
+ */
+ UNOTOOLS_DLLPUBLIC OUString extractFirstFromConfigurationPath(
+ OUString const& _sInPath, OUString* _sOutPath = nullptr);
+
+ /** check whether a path is to a nested node with respect to a parent path.
+
+ @param _sNestedPath
+ A configuration path that maybe points to a descendant of the node
+ identified by <var>_sPrefixPath</var>, with both paths starting
+ from the same node (or both being absolute).
+
+ @param _sPrefixPath
+ A configuration path.<BR/>
+ If this path is absolute, <var>_sNestedPath</var> should be absolute;
+ If this path is relative, <var>_sNestedPath</var> should be relative;
+ If this path is empty, <var>_sNestedPath</var> may start with a '/',
+ which is disregarded.
+
+ @returns
+ <TRUE/>, if <var>_sPrefixPath</var> is a prefix of <var>_sNestedPath</var>;
+ <FALSE/> otherwise.<BR/>
+ If both paths are equal <TRUE/> is returned.
+
+ */
+ bool isPrefixOfConfigurationPath(std::u16string_view _sNestedPath,
+ std::u16string_view _sPrefixPath);
+
+ /** get the relative path to a nested node with respect to a parent path.
+
+ @param _sNestedPath
+ A configuration path that points to a descendant of the node
+ identified by <var>_sPrefixPath</var>, with both paths starting
+ from the same node (or both being absolute).
+
+ @param _sPrefixPath
+ A configuration path.<BR/>
+ If this path is absolute, <var>_sNestedPath</var> must be absolute;
+ If this path is relative, <var>_sNestedPath</var> must be relative;
+ If this path is empty, <var>_sNestedPath</var> may start with a '/',
+ which is stripped.
+
+ @returns
+ The remaining relative path from the target of <var>_sPrefixPath</var>
+ to the target of <var>_sNestedPath</var>.<BR/>
+ If <var>_sPrefixPath</var> is not a prefix of <var>_sNestedPath</var>,
+ <var>_sNestedPath</var> is returned unaltered.
+
+ */
+ UNOTOOLS_DLLPUBLIC OUString dropPrefixFromConfigurationPath(OUString const& _sNestedPath,
+ std::u16string_view _sPrefixPath);
+
+ /** Create a one-level relative configuration path from a set element name
+ without a known set element type.
+
+ @param _sElementName
+ An arbitrary string that is to be interpreted as
+ name of a configuration set element.
+
+ @returns
+ A one-level relative path to the element, of the form
+ "*['<Name>']", where <Name> is properly escaped.
+
+ */
+ UNOTOOLS_DLLPUBLIC OUString wrapConfigurationElementName(std::u16string_view _sElementName);
+
+ /** Create a one-level relative configuration path from a set element name
+ and a known set element type.
+
+ @param _sElementName
+ An arbitrary string that is to be interpreted as
+ name of a configuration set element.
+
+ @param _sTypeName
+ An string identifying the type of the element. Usually this is be
+ the name of the element-template of the set.<BR/>
+
+ @returns
+ A one-level relative path to the element, of the form
+ "<Type>['<Name>']", where <Name> is properly escaped.
+
+ */
+ OUString wrapConfigurationElementName(std::u16string_view _sElementName,
+ OUString const& _sTypeName);
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_CONFIGPATHS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/configvaluecontainer.hxx b/include/unotools/configvaluecontainer.hxx
new file mode 100644
index 000000000..c4447fca2
--- /dev/null
+++ b/include/unotools/configvaluecontainer.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_CONFIGVALUECONTAINER_HXX
+#define INCLUDED_UNOTOOLS_CONFIGVALUECONTAINER_HXX
+
+#include <config_options.h>
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/uno/Type.hxx>
+#include <memory>
+
+
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace osl { class Mutex; }
+
+namespace utl
+{
+
+ struct OConfigurationValueContainerImpl;
+ struct NodeValueAccessor;
+
+ //= OConfigurationValueContainer
+
+ /** allows simple access to static configuration structures.
+
+ <p>The basic idea of this class is that it's clients (usually derived classes) simply register an
+ address in memory and a node path, and upon explicit request, the configuration value and the memory
+ are synchronized.<br/>
+ This means that when calling <method>read</method>, the current configuration values are copied into
+ the memory registered for them, and upon calling <method>write</method> the current values in memory
+ are set in the configuration nodes.</p>
+
+ <p>This way, the usage of this class is pretty straight forward: derive your own class, spend some members
+ to it, and bind these members to configuration node (usually done in the ctor of the derived class).<br/>
+ In the dtor, simply call <method>write</method> and <method>commit</method>.</p>
+
+ <p>There is no auto-commit mechanism in the dtor: In the usual scenario, when you derive from this class
+ and bind some members of your derived class to config nodes, this means that your members will be destroyed
+ before your base class' dtor is called, so accessing the memory during such a theoretical auto-commit would
+ yield undefined behaviour.</p>
+ */
+ class UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) OConfigurationValueContainer
+ {
+ private:
+ std::unique_ptr<OConfigurationValueContainerImpl> m_pImpl;
+
+ protected:
+
+ // construction/destruction
+
+ /** constructs the object
+
+ @param _rxORB
+ specifies the service factory which should be used to access the configuration
+ @param _rAccessSafety
+ As this class is intended to manipulate objects it does not hold itself (see the various
+ registerXXX methods), it needs to guard these access for multi threading safety.<br/>
+ The mutex given here is locked whenever such an access occurs.
+ @param _pConfigLocation
+ is an ASCII string describing the configurations node path
+ @param _nAccessFlags
+ specifies different aspects of the configuration aspect to be created, e.g. it's update mode etc.<br/>
+ See the CVC_xxx constants for what you can use here.
+ @param _nLevels
+ specifies the number of levels to access under the node given by <arg>_pConfigLocation</arg>
+ */
+ OConfigurationValueContainer(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
+ ::osl::Mutex& _rAccessSafety,
+ const char* _pConfigLocation,
+ const sal_Int32 _nLevels
+ );
+
+ /// dtor
+ ~OConfigurationValueContainer();
+
+ // registering data containers
+
+ /** registers a data accessor of an arbitrary type.
+
+ <p>Usually, in your derived class you simply add a member of the correct type of the configuration
+ value, and then call this method with the address of this member.</p>
+
+ @param _pRelativePathAscii
+ is a relative (ASCII) path of the node which should be "mirrored" into the accessor.
+ @param _pContainer
+ points to the accessors location in memory. Usually, this is simply an address of your derived class
+ @param _rValueType
+ is the type of your accessor. This type must be supported by the configuration.
+ */
+ void registerExchangeLocation(
+ const char* _pRelativePathAscii,
+ void* _pContainer,
+ const css::uno::Type& _rValueType
+ );
+
+ public:
+ /** reads the configuration data
+
+ <p>The current values of the nodes bound (using the registerXXX methods) is copied into their
+ respective exchange locations.</p>
+
+ <p>Please note that any changes done to your exchange locations are overridden with the current config
+ values.</p>
+
+ @see write
+ */
+ void read( );
+
+ /** commits any changes done
+
+ <p>Note that calling <method>write</method>(<sal_True/) is the same as calling <method>commit</method>(<TRUE/>).</p>
+
+ The current values in the exchange locations are written to the configuration nodes
+ before the changes are committed.<br/>
+
+ @precond
+ The access must have been created for update access
+ */
+ void commit();
+
+ private:
+ /// implements the ctors
+ void implConstruct(
+ const OUString& _rConfigLocation,
+ const sal_Int32 _nLevels
+ );
+
+ /// registers a value container
+ void implRegisterExchangeLocation( const NodeValueAccessor& _rAccessor );
+ };
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_CONFIGVALUECONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/datetime.hxx b/include/unotools/datetime.hxx
new file mode 100644
index 000000000..368ffcb39
--- /dev/null
+++ b/include/unotools/datetime.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_UNOTOOLS_DATETIME_HXX
+#define INCLUDED_UNOTOOLS_DATETIME_HXX
+
+//= conversions UNO3.TimeClass <-> Tools.TimeClass (Date/Time/DateTime)
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::util { struct Date; }
+namespace com::sun::star::util { struct DateTime; }
+namespace com::sun::star::util { struct Time; }
+
+class Date;
+class DateTime;
+class LocaleDataWrapper;
+
+namespace utl
+{
+ UNOTOOLS_DLLPUBLIC const LocaleDataWrapper& GetLocaleData();
+ UNOTOOLS_DLLPUBLIC DateTime GetDateTime(const css::util::DateTime& _rDT);
+ UNOTOOLS_DLLPUBLIC OUString GetDateTimeString(const css::util::DateTime& _rDT);
+ UNOTOOLS_DLLPUBLIC OUString GetDateTimeString(sal_Int32 _nDate, sal_Int32 _nTime);
+ UNOTOOLS_DLLPUBLIC OUString GetDateString(const css::util::DateTime& _rDT);
+
+ UNOTOOLS_DLLPUBLIC void typeConvert(const Date& _rDate, css::util::Date& _rOut);
+ UNOTOOLS_DLLPUBLIC void typeConvert(const css::util::Date& _rDate, Date& _rOut);
+
+ UNOTOOLS_DLLPUBLIC void typeConvert(const DateTime& _rDateTime, css::util::DateTime& _rOut);
+ UNOTOOLS_DLLPUBLIC void typeConvert(const css::util::DateTime& _rDateTime, DateTime& _rOut);
+
+ UNOTOOLS_DLLPUBLIC OUString toISO8601(const css::util::DateTime& _rDateTime);
+ UNOTOOLS_DLLPUBLIC bool ISO8601parseDateTime(std::u16string_view i_rIn, css::util::DateTime& o_rDateTime);
+ UNOTOOLS_DLLPUBLIC bool ISO8601parseDate(std::u16string_view i_rIn, css::util::Date& o_rDate);
+ UNOTOOLS_DLLPUBLIC bool ISO8601parseTime(std::u16string_view i_rIn, css::util::Time& o_Time);
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_DATETIME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/defaultencoding.hxx b/include/unotools/defaultencoding.hxx
new file mode 100644
index 000000000..8cde4bccb
--- /dev/null
+++ b/include/unotools/defaultencoding.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_UNOTOOLS_DEFAULTENCODING_HXX
+#define INCLUDED_UNOTOOLS_DEFAULTENCODING_HXX
+
+#include <sal/config.h>
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+
+/** Determines which locale should be used by default in filters when importing non-unicode strings.
+This value should be used when the file does not explicitly define encoding of 8-bit strings. It is
+defined by officecfg::Office::Linguistic::General::DefaultLocale, or when it's not set,
+officecfg::Setup::L10N::ooSetupSystemLocale, and is typically mapped to a corresponding Windows
+codepage by filters.
+
+@return
+A BCP-47 language tag string.
+*/
+UNOTOOLS_DLLPUBLIC OUString utl_getLocaleForGlobalDefaultEncoding();
+
+#endif // INCLUDED_UNOTOOLS_DEFAULTENCODING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/defaultoptions.hxx b/include/unotools/defaultoptions.hxx
new file mode 100644
index 000000000..dfa07fb5e
--- /dev/null
+++ b/include/unotools/defaultoptions.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+#include <unotools/pathoptions.hxx>
+
+namespace SvtDefaultOptions
+{
+UNOTOOLS_DLLPUBLIC OUString GetDefaultPath(SvtPathOptions::Paths nId);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/desktopterminationobserver.hxx b/include/unotools/desktopterminationobserver.hxx
new file mode 100644
index 000000000..0d230d357
--- /dev/null
+++ b/include/unotools/desktopterminationobserver.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_DESKTOPTERMINATIONOBSERVER_HXX
+#define INCLUDED_UNOTOOLS_DESKTOPTERMINATIONOBSERVER_HXX
+
+#include <config_options.h>
+#include <unotools/unotoolsdllapi.h>
+
+namespace utl
+{
+
+ //= ITerminationListener
+
+ /** non-UNO version of the com.sun.star.frame::XTerminateListener
+ */
+ class ITerminationListener
+ {
+ public:
+ virtual bool queryTermination() const = 0;
+ virtual void notifyTermination() = 0;
+
+ protected:
+ ~ITerminationListener() {}
+ };
+
+ //= DesktopTerminationObserver
+
+ /** a class which allows non-UNO components to observe the desktop (aka application)
+ for its shutdown
+ */
+ namespace DesktopTerminationObserver
+ {
+ /** registers a listener which should be notified when the desktop terminates
+ (which means the application is shutting down)
+ */
+ UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) void registerTerminationListener( ITerminationListener* _pListener );
+
+ /** revokes a termination listener
+ */
+ UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) void revokeTerminationListener( ITerminationListener const * _pListener );
+ }
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_DESKTOPTERMINATIONOBSERVER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/digitgroupingiterator.hxx b/include/unotools/digitgroupingiterator.hxx
new file mode 100644
index 000000000..7206f72f1
--- /dev/null
+++ b/include/unotools/digitgroupingiterator.hxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_DIGITGROUPINGITERATOR_HXX
+#define INCLUDED_UNOTOOLS_DIGITGROUPINGITERATOR_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <sal/log.hxx>
+
+namespace utl {
+
+/** Iterator to be used with a digit grouping as obtained through
+ LocaleDataWrapper::getDigitGrouping().
+
+ The iterator advances over the digit groupings, returning the number of
+ digits per group. If the last group was encountered the iterator will
+ always return the last grouping.
+
+ Grouping values are sanitized to be >= 0, even if originally signed
+ sal_Int32.
+
+ Usage example with a string buffer containing a decimal representation of
+ an integer number. Note that of course this loop could be optimized to not
+ count single characters but hunks of groups instead using the get() method,
+ this is just for illustrating usage. Anyway, for double values it is highly
+ more efficient to use ::rtl::math::doubleToString() and pass the grouping
+ sequence, instead of using this iterator and inserting characters into
+ strings.
+
+ DigitGroupingIterator aGrouping(...)
+ sal_Int32 nCount = 0;
+ sal_Int32 n = aBuffer.getLength();
+ // >1 because we don't want to insert a separator if there is no leading digit.
+ while (n-- > 1)
+ {
+ if (++nCount >= aGrouping.getPos())
+ {
+ aBuffer.insert( n, cSeparator);
+ nGroupDigits = aGrouping.advance();
+ }
+ }
+
+ */
+
+class DigitGroupingIterator
+{
+ const css::uno::Sequence< sal_Int32 > maGroupings;
+
+ sal_Int32 mnGroup; // current active grouping
+ sal_Int32 mnDigits; // current active digits per group
+ sal_Int32 mnNextPos; // position (in digits) of next grouping
+
+ void setInfinite()
+ {
+ mnGroup = maGroupings.getLength();
+ }
+
+ bool isInfinite() const
+ {
+ return mnGroup >= maGroupings.getLength();
+ }
+
+ sal_Int32 getGrouping() const
+ {
+ if (mnGroup < maGroupings.getLength())
+ {
+ sal_Int32 n = maGroupings[mnGroup];
+ SAL_WARN_IF( n < 0, "unotools.i18n", "DigitGroupingIterator::getGrouping: negative grouping");
+ if (n < 0)
+ n = 0; // sanitize ...
+ return n;
+ }
+ return 0;
+ }
+
+ void setPos()
+ {
+ // someone might be playing jokes on us, so check for overflow
+ if (mnNextPos <= SAL_MAX_INT32 - mnDigits)
+ mnNextPos += mnDigits;
+ }
+
+ void setDigits()
+ {
+ sal_Int32 nPrev = mnDigits;
+ mnDigits = getGrouping();
+ if (!mnDigits)
+ {
+ mnDigits = nPrev;
+ setInfinite();
+ }
+ setPos();
+ }
+
+ void initGrouping()
+ {
+ mnDigits = 3; // just in case of constructed with empty grouping
+ mnGroup = 0;
+ mnNextPos = 0;
+ setDigits();
+ }
+
+ DigitGroupingIterator( const DigitGroupingIterator & ) = delete;
+ DigitGroupingIterator & operator=( const DigitGroupingIterator & ) = delete;
+
+public:
+
+ explicit DigitGroupingIterator( const css::uno::Sequence< sal_Int32 > & rGroupings )
+ : maGroupings( rGroupings)
+ {
+ initGrouping();
+ }
+
+ /** Advance iterator to next grouping. */
+ DigitGroupingIterator & advance()
+ {
+ if (isInfinite())
+ setPos();
+ else
+ {
+ ++mnGroup;
+ setDigits();
+ }
+ return *this;
+ }
+
+ /** Obtain current grouping. Always > 0. */
+ sal_Int32 get() const
+ {
+ return mnDigits;
+ }
+
+ /** The next position (in integer digits) from the right where to insert a
+ group separator. */
+ sal_Int32 getPos() const
+ {
+ return mnNextPos;
+ }
+
+ /** Reset iterator to start again from the right beginning. */
+ void reset()
+ {
+ initGrouping();
+ }
+
+ /** Create a sequence of bool values containing positions where to add a
+ separator when iterating forward over a string and copying digit per
+ digit. For example, for grouping in thousands and nIntegerDigits==7 the
+ sequence returned would be {1,0,0,1,0,0,0} so the caller would add a
+ separator after the 1st and the 4th digit. */
+ static css::uno::Sequence< sal_Bool > createForwardSequence(
+ sal_Int32 nIntegerDigits,
+ const css::uno::Sequence< sal_Int32 > & rGroupings )
+ {
+ if (nIntegerDigits <= 0)
+ return css::uno::Sequence< sal_Bool >();
+ DigitGroupingIterator aIterator( rGroupings);
+ css::uno::Sequence< sal_Bool > aSeq( nIntegerDigits);
+ sal_Bool* pArr = aSeq.getArray();
+ for (sal_Int32 j = 0; --nIntegerDigits >= 0; ++j)
+ {
+ if (j == aIterator.getPos())
+ {
+ pArr[nIntegerDigits] = true;
+ aIterator.advance();
+ }
+ else
+ pArr[nIntegerDigits] = false;
+ }
+ return aSeq;
+ }
+};
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_DIGITGROUPINGITERATOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/docinfohelper.hxx b/include/unotools/docinfohelper.hxx
new file mode 100644
index 000000000..d6323cc9b
--- /dev/null
+++ b/include/unotools/docinfohelper.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace utl
+{
+class UNOTOOLS_DLLPUBLIC DocInfoHelper
+{
+public:
+ static OUString GetGeneratorString();
+};
+
+} // namespace utl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/dynamicmenuoptions.hxx b/include/unotools/dynamicmenuoptions.hxx
new file mode 100644
index 000000000..b046f7dbd
--- /dev/null
+++ b/include/unotools/dynamicmenuoptions.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_DYNAMICMENUOPTIONS_HXX
+#define INCLUDED_UNOTOOLS_DYNAMICMENUOPTIONS_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+
+/*-****************************************************************************************************************
+ @descr struct to hold information about one menu entry.
+****************************************************************************************************************-*/
+struct SvtDynMenuEntry
+{
+ OUString sURL;
+ OUString sTitle;
+ OUString sImageIdentifier;
+ OUString sTargetName;
+};
+
+/*-************************************************************************************************************
+ @descr You can use these enum values to specify right menu if you call our interface methods.
+*//*-*************************************************************************************************************/
+enum class EDynamicMenuType
+{
+ NewMenu = 0,
+ WizardMenu = 1
+};
+
+
+/*-************************************************************************************************************
+ @short collect information about dynamic menus
+ @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard".
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+namespace SvtDynamicMenuOptions
+{
+
+ /*-****************************************************************************************************
+ @short return complete specified list
+ @descr Call it to get all entries of an dynamic menu.
+ We return a list of all nodes with its names and properties.
+ @param "eMenu" select right menu.
+ @return A list of menu items is returned.
+
+ @onerror We return an empty list.
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPUBLIC std::vector< SvtDynMenuEntry > GetMenu( EDynamicMenuType eMenu );
+
+
+}; // namespace SvtDynamicMenuOptions
+
+#endif // INCLUDED_UNOTOOLS_DYNAMICMENUOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/eventcfg.hxx b/include/unotools/eventcfg.hxx
new file mode 100644
index 000000000..7ddca4a96
--- /dev/null
+++ b/include/unotools/eventcfg.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_EVENTCFG_HXX
+#define INCLUDED_UNOTOOLS_EVENTCFG_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <cppuhelper/implbase.hxx>
+
+enum class GlobalEventId
+{
+ STARTAPP,
+ CLOSEAPP,
+ DOCCREATED,
+ CREATEDOC,
+ LOADFINISHED,
+ OPENDOC,
+ PREPARECLOSEDOC,
+ CLOSEDOC,
+ SAVEDOC,
+ SAVEDOCDONE,
+ SAVEDOCFAILED,
+ SAVEASDOC,
+ SAVEASDOCDONE,
+ SAVEASDOCFAILED,
+ SAVETODOC,
+ SAVETODOCDONE,
+ SAVETODOCFAILED,
+ ACTIVATEDOC,
+ DEACTIVATEDOC,
+ PRINTDOC,
+ VIEWCREATED,
+ PREPARECLOSEVIEW,
+ CLOSEVIEW,
+ MODIFYCHANGED,
+ TITLECHANGED,
+ VISAREACHANGED,
+ MODECHANGED,
+ STORAGECHANGED,
+ LAST = STORAGECHANGED
+};
+
+class GlobalEventConfig_Impl;
+
+class UNOTOOLS_DLLPUBLIC GlobalEventConfig final :
+ public cppu::WeakImplHelper< css::document::XEventsSupplier, css::container::XNameReplace >
+{
+ public:
+ GlobalEventConfig( );
+ virtual ~GlobalEventConfig( ) override;
+
+ css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents( ) override;
+ void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override;
+ css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
+ css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
+ sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
+ css::uno::Type SAL_CALL getElementType( ) override;
+ sal_Bool SAL_CALL hasElements( ) override;
+ static OUString GetEventName( GlobalEventId nID );
+
+ css::uno::Sequence < css::beans::PropertyValue > getByName2( const OUString& aName );
+
+ private:
+ static GlobalEventConfig_Impl* m_pImpl;
+ static sal_Int32 m_nRefCount;
+};
+
+#endif // INCLUDED_UNOTOOLS_EVENTCFG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/eventlisteneradapter.hxx b/include/unotools/eventlisteneradapter.hxx
new file mode 100644
index 000000000..92fbe212c
--- /dev/null
+++ b/include/unotools/eventlisteneradapter.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_EVENTLISTENERADAPTER_HXX
+#define INCLUDED_UNOTOOLS_EVENTLISTENERADAPTER_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <memory>
+
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace com::sun::star::lang { class XComponent; }
+
+namespace utl
+{
+
+ struct OEventListenerAdapterImpl;
+
+ //= OEventListenerAdapter
+
+ /** base class for non-UNO dispose listeners
+ */
+ class UNOTOOLS_DLLPUBLIC OEventListenerAdapter
+ {
+ friend class OEventListenerImpl;
+
+ private:
+ OEventListenerAdapter( const OEventListenerAdapter& _rSource ) = delete;
+ const OEventListenerAdapter& operator=( const OEventListenerAdapter& _rSource ) = delete;
+
+ protected:
+ std::unique_ptr<OEventListenerAdapterImpl> m_pImpl;
+
+ protected:
+ OEventListenerAdapter();
+ virtual ~OEventListenerAdapter();
+
+ void startComponentListening( const css::uno::Reference< css::lang::XComponent >& _rxComp );
+ void stopComponentListening( const css::uno::Reference< css::lang::XComponent >& _rxComp );
+ void stopAllComponentListening( );
+
+ virtual void _disposing( const css::lang::EventObject& _rSource ) = 0;
+ };
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_EVENTLISTENERADAPTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/extendedsecurityoptions.hxx b/include/unotools/extendedsecurityoptions.hxx
new file mode 100644
index 000000000..4a2b493e8
--- /dev/null
+++ b/include/unotools/extendedsecurityoptions.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+namespace SvtExtendedSecurityOptions
+{
+ // Must be zero based!
+ enum OpenHyperlinkMode
+ {
+ OPEN_NEVER = 0,
+ OPEN_WITHSECURITYCHECK,
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/fltrcfg.hxx b/include/unotools/fltrcfg.hxx
new file mode 100644
index 000000000..bac46c03c
--- /dev/null
+++ b/include/unotools/fltrcfg.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_FLTRCFG_HXX
+#define INCLUDED_UNOTOOLS_FLTRCFG_HXX
+
+#include <o3tl/deleter.hxx>
+#include <unotools/unotoolsdllapi.h>
+#include <unotools/configitem.hxx>
+#include <memory>
+
+struct SvtFilterOptions_Impl;
+class UNOTOOLS_DLLPUBLIC SvtFilterOptions final : public utl::ConfigItem
+{
+private:
+ std::unique_ptr<SvtFilterOptions_Impl, o3tl::default_delete<SvtFilterOptions_Impl>> pImpl;
+
+ virtual void ImplCommit() override;
+
+public:
+ SvtFilterOptions();
+ virtual ~SvtFilterOptions() override;
+
+ virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames) override;
+ void Load();
+
+ void SetLoadWordBasicCode( bool bFlag );
+ bool IsLoadWordBasicCode() const;
+ void SetLoadWordBasicExecutable( bool bFlag );
+ bool IsLoadWordBasicExecutable() const;
+ void SetLoadWordBasicStorage( bool bFlag );
+ bool IsLoadWordBasicStorage() const;
+
+ void SetLoadExcelBasicCode( bool bFlag );
+ bool IsLoadExcelBasicCode() const;
+ void SetLoadExcelBasicExecutable( bool bFlag );
+ bool IsLoadExcelBasicExecutable() const;
+ void SetLoadExcelBasicStorage( bool bFlag );
+ bool IsLoadExcelBasicStorage() const;
+
+ void SetLoadPPointBasicCode( bool bFlag );
+ bool IsLoadPPointBasicCode() const;
+ void SetLoadPPointBasicStorage( bool bFlag );
+ bool IsLoadPPointBasicStorage() const;
+
+ bool IsMathType2Math() const;
+ void SetMathType2Math( bool bFlag );
+ bool IsMath2MathType() const;
+ void SetMath2MathType( bool bFlag );
+
+ bool IsWinWord2Writer() const;
+ void SetWinWord2Writer( bool bFlag );
+ bool IsWriter2WinWord() const;
+ void SetWriter2WinWord( bool bFlag );
+
+ bool IsUseEnhancedFields() const;
+
+ bool IsExcel2Calc() const;
+ void SetExcel2Calc( bool bFlag );
+ bool IsCalc2Excel() const;
+ void SetCalc2Excel( bool bFlag );
+
+ bool IsPowerPoint2Impress() const;
+ void SetPowerPoint2Impress( bool bFlag );
+ bool IsImpress2PowerPoint() const;
+ void SetImpress2PowerPoint( bool bFlag );
+
+ bool IsSmartArt2Shape() const;
+ void SetSmartArt2Shape( bool bFlag );
+
+ bool IsEnablePPTPreview() const;
+ bool IsEnableCalcPreview() const;
+ bool IsEnableWordPreview() const;
+
+ bool IsCharBackground2Highlighting() const;
+ bool IsCharBackground2Shading() const;
+ void SetCharBackground2Highlighting();
+ void SetCharBackground2Shading();
+
+ bool IsMSOLockFileCreationIsEnabled() const;
+ void EnableMSOLockFileCreation(bool bEnable);
+
+ bool IsVisio2Draw() const;
+ void SetVisio2Draw(bool bFlag);
+
+ static SvtFilterOptions& Get();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/fontcfg.hxx b/include/unotools/fontcfg.hxx
new file mode 100644
index 000000000..1f77d4845
--- /dev/null
+++ b/include/unotools/fontcfg.hxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_FONTCFG_HXX
+#define INCLUDED_UNOTOOLS_FONTCFG_HXX
+
+#include <config_options.h>
+#include <unotools/unotoolsdllapi.h>
+#include <tools/fontenum.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <i18nlangtag/languagetag.hxx>
+
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+namespace com::sun::star::container { class XNameAccess; }
+namespace com::sun::star::lang { class XMultiServiceFactory; }
+
+enum class DefaultFontType;
+
+// If you think the below concept of classifying a font (typeface) as possibly being one or several
+// of "Default", "Standard", and "Normal", etc, is madness, you are probably right. On the other
+// hand we have in officecfg/registry/data/org/openoffice/VCL.xcu carefully (or not) assigned to
+// each font mentioned in that file what its attributes are, so it is quite possible that touching
+// this would cause a regression that nobody would notice until after many years.
+
+// Note that the bit flags must match the entries in the pAttribNames array in
+// unotools/source/config/fontcfg.cxx.
+
+enum class ImplFontAttrs : sal_uInt32
+{
+ None = 0x00000000,
+ Default = 0x00000001, ///< Default-Font like Andale Sans UI, Palace Script, Albany, Thorndale, Cumberland, ...
+ Standard = 0x00000002, ///< Standard-Font like Arial, Times, Courier, ...
+ Normal = 0x00000004, ///< Normal Font for writing text like Arial, Verdana, Arial Narrow, Trebuchet, Times, Courier, ...
+ Symbol = 0x00000008, ///< Font with symbols
+ Fixed = 0x00000010,
+ SansSerif = 0x00000020,
+ Serif = 0x00000040,
+ Decorative = 0x00000080, ///< Readable and normally used for drawings
+ Special = 0x00000100, ///< Very special design
+ Italic = 0x00000200,
+ Titling = 0x00000400, ///< Only uppercase characters
+ Capitals = 0x00000800, ///< Only uppercase characters, but lowercase characters smaller as the uppercase characters
+ CJK = 0x00001000,
+ CJK_JP = 0x00002000,
+ CJK_SC = 0x00004000,
+ CJK_TC = 0x00008000,
+ CJK_KR = 0x00010000,
+ CTL = 0x00020000,
+ NoneLatin = 0x00040000,
+ Full = 0x00080000, ///< Font with normally all characters
+ Outline = 0x00100000,
+ Shadow = 0x00200000,
+ Rounded = 0x00400000,
+ Typewriter = 0x00800000, ///< Like a typewriter: Courier, ...
+ Script = 0x01000000, ///< Handwriting or Script
+ Handwriting = 0x02000000, ///< More Handwriting with normal letters
+ Chancery = 0x04000000, ///< Like Zapf Chancery
+ Comic = 0x08000000, ///< Like Comic Sans MS
+ BrushScript = 0x10000000, ///< More Script
+ Gothic = 0x20000000,
+ Schoolbook = 0x40000000,
+ OtherStyle = 0x80000000, ///< OldStyle, ... so negative points
+ CJK_AllLang = CJK_JP | CJK_SC | CJK_TC | CJK_KR,
+ AllScript = Script | Handwriting | Chancery | Comic | BrushScript,
+ AllSubscript = Handwriting | Chancery | Comic | BrushScript,
+ AllSerifStyle = AllScript | SansSerif | Serif | Fixed | Italic | Gothic | Schoolbook | Shadow | Outline,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ImplFontAttrs> : is_typed_flags<ImplFontAttrs, 0xffffffff> {};
+}
+
+
+namespace utl
+{
+
+class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration
+{
+ css::uno::Reference< css::lang::XMultiServiceFactory >
+ m_xConfigProvider;
+ css::uno::Reference< css::container::XNameAccess >
+ m_xConfigAccess;
+
+ struct LocaleAccess
+ {
+ // the real string used in the configuration
+ // used to get rid of upper/lower case problems
+ OUString aConfigLocaleString;
+ // xAccess is mutable to be able to be filled on demand
+ mutable css::uno::Reference< css::container::XNameAccess > xAccess;
+ };
+
+ std::unordered_map< OUString, LocaleAccess > m_aConfig;
+
+ OUString tryLocale( const OUString& rBcp47, const OUString& rType ) const;
+
+ public:
+ DefaultFontConfiguration();
+ ~DefaultFontConfiguration();
+
+ static DefaultFontConfiguration& get();
+
+ OUString getDefaultFont( const LanguageTag& rLanguageTag, DefaultFontType nType ) const;
+ OUString getUserInterfaceFont( const LanguageTag& rLanguageTag ) const;
+};
+
+struct UNOTOOLS_DLLPUBLIC FontNameAttr
+{
+ OUString Name;
+ ::std::vector< OUString > Substitutions;
+ ::std::vector< OUString > MSSubstitutions;
+ FontWeight Weight;
+ FontWidth Width;
+ ImplFontAttrs Type;
+};
+
+class UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) FontSubstConfiguration
+{
+private:
+ css::uno::Reference< css::lang::XMultiServiceFactory >
+ m_xConfigProvider;
+ css::uno::Reference< css::container::XNameAccess >
+ m_xConfigAccess;
+ struct LocaleSubst
+ {
+ OUString aConfigLocaleString;
+ mutable bool bConfigRead;
+ // note: aSubstAttributes must be sorted alphabetically by Name
+ // searches on the substitutes are done with Name as key, where
+ // a minimal match is sufficient (that is e.g. "Thorndale" will match
+ // "Thorndale BlaBlub"). Also names must be lower case.
+ mutable std::vector< FontNameAttr > aSubstAttributes;
+
+ LocaleSubst() : bConfigRead( false ) {}
+ };
+ std::unordered_map< OUString, LocaleSubst > m_aSubst;
+ typedef std::unordered_set< OUString > UniqueSubstHash;
+ mutable UniqueSubstHash maSubstHash;
+ LanguageTag maLanguageTag;
+
+ void fillSubstVector( const css::uno::Reference< css::container::XNameAccess >& rFont,
+ const OUString& rType,
+ std::vector< OUString >& rSubstVector ) const;
+ FontWeight getSubstWeight( const css::uno::Reference< css::container::XNameAccess >& rFont,
+ const OUString& rType ) const;
+ FontWidth getSubstWidth( const css::uno::Reference< css::container::XNameAccess >& rFont,
+ const OUString& rType ) const;
+ ImplFontAttrs getSubstType( const css::uno::Reference< css::container::XNameAccess >& rFont,
+ const OUString& rType ) const;
+ void readLocaleSubst( const OUString& rBcp47 ) const;
+public:
+ FontSubstConfiguration();
+ ~FontSubstConfiguration();
+
+ static FontSubstConfiguration& get();
+
+ const FontNameAttr* getSubstInfo( const OUString& rFontName ) const;
+ static void getMapName( const OUString& rOrgName, OUString& rShortName, OUString& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ImplFontAttrs& rType );
+};
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_FONTCFG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/fontcvt.hxx b/include/unotools/fontcvt.hxx
new file mode 100644
index 000000000..979183746
--- /dev/null
+++ b/include/unotools/fontcvt.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_FONTCVT_HXX
+#define INCLUDED_UNOTOOLS_FONTCVT_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+
+
+enum class FontToSubsFontFlags
+{
+ IMPORT = 0x01,
+ EXPORT = 0x02
+};
+
+typedef void* FontToSubsFontConverter;
+UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( std::u16string_view rFontName, FontToSubsFontFlags nFlags );
+UNOTOOLS_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c );
+UNOTOOLS_DLLPUBLIC OUString GetFontToSubsFontName( FontToSubsFontConverter hConverter );
+
+
+class UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont
+{
+public:
+ // Returns the name of the best windows symbol font which this char can be
+ // mapped to. Sets rChar to the correct position for that font. If no
+ // match found, then no name is returned, and rChar is unchanged. If you
+ // want to convert a string, you don't want to use this.
+ virtual OUString ConvertChar(sal_Unicode &rChar) = 0;
+
+ virtual ~StarSymbolToMSMultiFont() {}
+};
+
+
+// The converter will allow somewhat dubious mappings to the windows symbols fonts,
+// that are nevertheless recognizably similar. Even in this mode there will be characters that fail.
+// The users of this might want to make a distinction between failed characters
+// which were inside and those outside the unicode private area.
+UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont();
+
+#endif // INCLUDED_UNOTOOLS_FONTCVT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/fontdefs.hxx b/include/unotools/fontdefs.hxx
new file mode 100644
index 000000000..aff10c860
--- /dev/null
+++ b/include/unotools/fontdefs.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_FONTDEFS_HXX
+#define INCLUDED_UNOTOOLS_FONTDEFS_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <unotools/unotoolsdllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <config_options.h>
+
+enum class SubsFontFlags
+{
+ ONLYONE = 0x01,
+ MS = 0x02
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<SubsFontFlags> : is_typed_flags<SubsFontFlags, 0x03> {};
+}
+
+UNOTOOLS_DLLPUBLIC OUString GetSubsFontName( std::u16string_view rName, SubsFontFlags nFlags );
+
+UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) void AddTokenFontName( OUString& rName, std::u16string_view rNewToken );
+
+
+class UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) ConvertChar
+{
+public:
+ const sal_Unicode* mpCvtTab;
+ const char* mpSubsFontName;
+ sal_Unicode (*mpCvtFunc)( sal_Unicode );
+ sal_Unicode RecodeChar( sal_Unicode c ) const;
+ void RecodeString( OUString& rStra, sal_Int32 nIndex, sal_Int32 nLen ) const;
+ static const ConvertChar* GetRecodeData( std::u16string_view rOrgFontName, std::u16string_view rMapFontName );
+};
+
+
+enum class DefaultFontType
+{
+ SANS_UNICODE = 1,
+ SANS = 2,
+ SERIF = 3,
+ FIXED = 4,
+ SYMBOL = 5,
+ UI_SANS = 1000,
+ UI_FIXED = 1001,
+ LATIN_TEXT = 2000,
+ LATIN_PRESENTATION = 2001,
+ LATIN_SPREADSHEET = 2002,
+ LATIN_HEADING = 2003,
+ LATIN_DISPLAY = 2004,
+ LATIN_FIXED = 2005,
+ CJK_TEXT = 3000,
+ CJK_PRESENTATION = 3001,
+ CJK_SPREADSHEET = 3002,
+ CJK_HEADING = 3003,
+ CJK_DISPLAY = 3004,
+ CTL_TEXT = 4000,
+ CTL_PRESENTATION = 4001,
+ CTL_SPREADSHEET = 4002,
+ CTL_HEADING = 4003,
+ CTL_DISPLAY = 4004,
+};
+
+UNOTOOLS_DLLPUBLIC std::u16string_view GetNextFontToken( std::u16string_view rTokenStr, sal_Int32& rIndex );
+UNOTOOLS_DLLPUBLIC OUString GetEnglishSearchFontName( std::u16string_view rName );
+
+/** Strip any "script font suffix" from the font name
+
+ Related: fdo#49271 RTF files often contain weird-ass
+ Win 3.1/Win95 style fontnames which attempt to put the
+ charset encoding into the filename
+ http://www.webcenter.ru/~kazarn/eng/fonts_ttf.htm
+*/
+UNOTOOLS_DLLPUBLIC OUString StripScriptFromName(const OUString& rName);
+
+/** Determine if the font is the special Star|Open Symbol font
+
+ @param rFontName
+ The FontName to test for being Star|Open Symbol
+
+ @return true if this is Star|Open Symbol
+*/
+// FIXME It's quite possible that code using this should instead check for RTL_TEXTENCODING_SYMBOL.
+UNOTOOLS_DLLPUBLIC bool IsStarSymbol(std::u16string_view rFontName);
+
+#endif // INCLUDED_UNOTOOLS_FONTDEFS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/historyoptions.hxx b/include/unotools/historyoptions.hxx
new file mode 100644
index 000000000..1f743e062
--- /dev/null
+++ b/include/unotools/historyoptions.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <optional>
+
+/// You can use these enum values to specify right history if you call our interface methods.
+enum class EHistoryType
+{
+ PickList,
+ HelpBookmarks
+};
+
+/** Collect information about history features.
+
+ Interface methods to get and set value of config key "org.openoffice.Office.Common/History/..."
+
+ key "PickList": The last used documents displayed in the file menu.
+ key "History": The last opened documents general.
+*/
+namespace SvtHistoryOptions
+{
+
+ /** Clear complete specified list.
+
+ @param eHistory select right history.
+ */
+ UNOTOOLS_DLLPUBLIC void Clear(EHistoryType eHistory);
+
+ /** Return the complete specified history list.
+
+ @param eHistory select right history.
+ @return A list of history items is returned.
+ */
+ struct HistoryItem
+ {
+ OUString sURL;
+ OUString sFilter;
+ OUString sTitle;
+ OUString sPassword;
+ OUString sThumbnail;
+ bool isReadOnly = false;
+ };
+ UNOTOOLS_DLLPUBLIC std::vector< HistoryItem > GetList(EHistoryType eHistory);
+
+ /** Append a new item to the specified list.
+
+ The oldest entry is deleted automatically when the size reaches the maximum.
+
+ @param eHistory select right history.
+ @param sURL URL to save in history
+ @param sFilter filter name to save in history
+ @param sTitle document title to save in history
+ */
+ UNOTOOLS_DLLPUBLIC void AppendItem(EHistoryType eHistory,
+ const OUString& sURL, const OUString& sFilter, const OUString& sTitle,
+ const std::optional<OUString>& sThumbnail, std::optional<bool> oIsReadOnly);
+
+ /** Delete item from the specified list.
+ */
+ UNOTOOLS_DLLPUBLIC void DeleteItem(EHistoryType eHistory, const OUString& sURL);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/intlwrapper.hxx b/include/unotools/intlwrapper.hxx
new file mode 100644
index 000000000..e86346a95
--- /dev/null
+++ b/include/unotools/intlwrapper.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_INTLWRAPPER_HXX
+#define INCLUDED_UNOTOOLS_INTLWRAPPER_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/uno/Reference.h>
+
+#include <i18nlangtag/languagetag.hxx>
+#include <memory>
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+class CollatorWrapper;
+class LocaleDataWrapper;
+
+/**
+ A wrapper of I18N wrappers. Using this is more expensive than using some
+ single wrapper classes so use it only if you must pass a single pointer
+ without knowing in advance what is needed, e.g. for
+ SfxPoolItem::GetPresentation(). Remember that this wrapper was only created
+ for convenience to bypass some oddities, if possible don't use it. <p>
+
+ Implemented are only the const get...() methods of the wrappers, which are
+ loaded on demand, for consistency reasons no change of locale is possible.
+ Only default calendar and default collator are supported. <p>
+
+ One exception though is the calendar wrapper: to be able to set a value and
+ retrieve calendar values it is not const, so methods using this should
+ reset the calendar to the previous value if it isn't sure where the
+ IntlWrapper did come from. <p>
+ */
+class UNOTOOLS_DLLPUBLIC IntlWrapper
+{
+private:
+ LanguageTag maLanguageTag;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ std::unique_ptr<LocaleDataWrapper> pLocaleData;
+ std::unique_ptr<CollatorWrapper> pCollator;
+ std::unique_ptr<CollatorWrapper> pCaseCollator;
+
+ void ImplNewLocaleData() const;
+ void ImplNewCollator( bool bCaseSensitive ) const;
+
+public:
+ IntlWrapper(LanguageTag aLanguageTag);
+ ~IntlWrapper();
+
+ const LocaleDataWrapper* getLocaleData() const
+ {
+ if ( !pLocaleData )
+ ImplNewLocaleData();
+ return pLocaleData.get();
+ }
+ /// case insensitive collator, simple IGNORE_CASE
+ const CollatorWrapper* getCollator() const
+ {
+ if ( !pCollator )
+ ImplNewCollator( false );
+ return pCollator.get();
+ }
+ /// case sensitive collator
+ const CollatorWrapper* getCaseCollator() const
+ {
+ if ( !pCaseCollator )
+ ImplNewCollator( true );
+ return pCaseCollator.get();
+ }
+};
+
+#endif // INCLUDED_UNOTOOLS_INTLWRAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/itemholderbase.hxx b/include/unotools/itemholderbase.hxx
new file mode 100644
index 000000000..9ce013162
--- /dev/null
+++ b/include/unotools/itemholderbase.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_ITEMHOLDERBASE_HXX
+#define INCLUDED_UNOTOOLS_ITEMHOLDERBASE_HXX
+
+#include <memory>
+#include <unotools/options.hxx>
+
+enum class EItem
+{
+ AccessibilityOptions , // 2
+
+ CmdOptions ,
+ ColorConfig , // 2
+ Compatibility ,
+ CTLOptions , // 2
+
+ EventConfig ,
+
+ LinguConfig ,
+
+ MiscOptions ,
+ ModuleOptions ,
+
+ PathOptions ,
+
+ SysLocaleOptions , // 2
+
+ UserOptions , // 2
+};
+
+struct TItemInfo
+{
+ TItemInfo()
+ : eItem(EItem::UserOptions)
+ {
+ }
+
+ TItemInfo(TItemInfo&& other) noexcept
+ : pItem(std::move(other.pItem))
+ , eItem(other.eItem)
+ {
+ }
+
+ std::unique_ptr<utl::detail::Options> pItem;
+ EItem eItem;
+};
+
+#endif // INCLUDED_UNOTOOLS_ITEMHOLDERBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/lingucfg.hxx b/include/unotools/lingucfg.hxx
new file mode 100644
index 000000000..b4a0b824e
--- /dev/null
+++ b/include/unotools/lingucfg.hxx
@@ -0,0 +1,209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_LINGUCFG_HXX
+#define INCLUDED_UNOTOOLS_LINGUCFG_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Any.h>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+#include <i18nlangtag/lang.h>
+#include <vector>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::util { class XChangesBatch; }
+
+class SvtLinguConfigItem;
+
+struct UNOTOOLS_DLLPUBLIC SvtLinguOptions
+{
+ css::uno::Sequence< OUString > aActiveDics;
+ css::uno::Sequence< OUString > aActiveConvDics;
+
+ bool bROActiveDics;
+ bool bROActiveConvDics;
+
+ // Hyphenator service specific options
+ sal_Int16 nHyphMinLeading,
+ nHyphMinTrailing,
+ nHyphMinWordLength;
+
+ bool bROHyphMinLeading,
+ bROHyphMinTrailing,
+ bROHyphMinWordLength;
+
+ // misc options (non-service specific)
+ LanguageType nDefaultLanguage;
+ LanguageType nDefaultLanguage_CJK;
+ LanguageType nDefaultLanguage_CTL;
+
+ bool bRODefaultLanguage;
+ bool bRODefaultLanguage_CJK;
+ bool bRODefaultLanguage_CTL;
+
+ // spelling options (non-service specific)
+ bool bIsSpellSpecial;
+ bool bIsSpellAuto;
+ bool bIsSpellReverse;
+
+ bool bROIsSpellSpecial;
+ bool bROIsSpellAuto;
+ bool bROIsSpellReverse;
+
+ // hyphenation options (non-service specific)
+ bool bIsHyphSpecial;
+ bool bIsHyphAuto;
+
+ bool bROIsHyphSpecial;
+ bool bROIsHyphAuto;
+
+ // common to SpellChecker, Hyphenator and Thesaurus service
+ bool bIsUseDictionaryList;
+ bool bIsIgnoreControlCharacters;
+
+ bool bROIsUseDictionaryList;
+ bool bROIsIgnoreControlCharacters;
+
+ // SpellChecker service specific options
+ bool bIsSpellWithDigits,
+ bIsSpellUpperCase,
+ bIsSpellCapitalization;
+
+ bool bROIsSpellWithDigits,
+ bROIsSpellUpperCase,
+ bROIsSpellCapitalization;
+
+ // text conversion specific options
+ bool bIsIgnorePostPositionalWord;
+ bool bIsAutoCloseDialog;
+ bool bIsShowEntriesRecentlyUsedFirst;
+ bool bIsAutoReplaceUniqueEntries;
+ bool bIsDirectionToSimplified;
+ bool bIsUseCharacterVariants;
+ bool bIsTranslateCommonTerms;
+ bool bIsReverseMapping;
+
+ bool bROIsIgnorePostPositionalWord;
+ bool bROIsAutoCloseDialog;
+ bool bROIsShowEntriesRecentlyUsedFirst;
+ bool bROIsAutoReplaceUniqueEntries;
+ bool bROIsDirectionToSimplified;
+ bool bROIsUseCharacterVariants;
+ bool bROIsTranslateCommonTerms;
+ bool bROIsReverseMapping;
+
+ // check value need to determine if the configuration needs to be updated
+ // or not (used for a quick check if data files have been changed/added
+ // or deleted
+ sal_Int32 nDataFilesChangedCheckValue;
+ bool bRODataFilesChangedCheckValue;
+
+ bool bIsGrammarAuto;
+ bool bIsGrammarInteractive;
+
+ bool bROIsGrammarAuto;
+ bool bROIsGrammarInteractive;
+
+ SvtLinguOptions();
+};
+
+struct UNOTOOLS_DLLPUBLIC SvtLinguConfigDictionaryEntry
+{
+ // the URL's pointing to the location of the files the dictionary consists of
+ css::uno::Sequence< OUString > aLocations;
+ // the name of the dictionary format implement
+ OUString aFormatName;
+ // the list of languages (ISO names) the dictionary can be used for
+ css::uno::Sequence< OUString > aLocaleNames;
+};
+
+class UNOTOOLS_DLLPUBLIC SvtLinguConfig final : public utl::detail::Options
+{
+ // returns static object
+ UNOTOOLS_DLLPRIVATE static SvtLinguConfigItem & GetConfigItem();
+
+ // configuration update access for the 'Linguistic' main node
+ mutable css::uno::Reference< css::util::XChangesBatch > m_xMainUpdateAccess;
+
+ css::uno::Reference< css::util::XChangesBatch > const & GetMainUpdateAccess() const;
+
+ OUString GetVendorImageUrl_Impl( const OUString &rServiceImplName, const OUString &rImageName ) const;
+
+ SvtLinguConfig( const SvtLinguConfig & ) = delete;
+ SvtLinguConfig & operator = ( const SvtLinguConfig & ) = delete;
+
+public:
+ SvtLinguConfig();
+ virtual ~SvtLinguConfig() override;
+
+ // borrowed from utl::ConfigItem
+
+ css::uno::Sequence< OUString >
+ GetNodeNames( const OUString &rNode ) const;
+
+ css::uno::Sequence< css::uno::Any >
+ GetProperties(
+ const css::uno::Sequence< OUString > &rNames ) const;
+
+ bool
+ ReplaceSetProperties(
+ const OUString &rNode,
+ const css::uno::Sequence< css::beans::PropertyValue >& rValues );
+
+ css::uno::Any
+ GetProperty( std::u16string_view rPropertyName ) const;
+ css::uno::Any
+ GetProperty( sal_Int32 nPropertyHandle ) const;
+
+ bool SetProperty( std::u16string_view rPropertyName,
+ const css::uno::Any &rValue );
+ bool SetProperty( sal_Int32 nPropertyHandle,
+ const css::uno::Any &rValue );
+
+ void GetOptions( SvtLinguOptions &rOptions ) const;
+
+ bool IsReadOnly( std::u16string_view rPropertyName ) const;
+
+ //!
+ //! the following functions work on the 'ServiceManager' sub node of the
+ //! linguistic configuration only
+ //!
+ bool GetElementNamesFor( const OUString &rNodeName, css::uno::Sequence< OUString > &rElementNames ) const;
+
+ bool GetSupportedDictionaryFormatsFor( const OUString &rSetName, const OUString &rSetEntry, css::uno::Sequence< OUString > &rFormatList ) const;
+
+ bool GetDictionaryEntry( const OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry ) const;
+
+ css::uno::Sequence< OUString > GetDisabledDictionaries() const;
+
+ std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat( std::u16string_view rFormatName ) const;
+
+ // functions returning file URLs to the respective images (if found) and empty string otherwise
+ OUString GetSpellAndGrammarContextSuggestionImage( const OUString &rServiceImplName ) const;
+ OUString GetSpellAndGrammarContextDictionaryImage( const OUString &rServiceImplName ) const;
+ OUString GetSynonymsContextImage( const OUString &rServiceImplName ) const;
+
+ bool HasGrammarChecker() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/linguprops.hxx b/include/unotools/linguprops.hxx
new file mode 100644
index 000000000..971c02804
--- /dev/null
+++ b/include/unotools/linguprops.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <rtl/ustring.hxx>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
+// UNO property names for general options
+inline constexpr OUStringLiteral UPN_IS_GERMAN_PRE_REFORM = u"IsGermanPreReform"; /*! deprecated #i91949 !*/
+inline constexpr OUStringLiteral UPN_IS_USE_DICTIONARY_LIST = u"IsUseDictionaryList";
+inline constexpr OUStringLiteral UPN_IS_IGNORE_CONTROL_CHARACTERS = u"IsIgnoreControlCharacters";
+inline constexpr OUStringLiteral UPN_ACTIVE_DICTIONARIES = u"ActiveDictionaries";
+
+// UNO property names for SpellChecker
+inline constexpr OUStringLiteral UPN_IS_SPELL_UPPER_CASE = u"IsSpellUpperCase";
+inline constexpr OUStringLiteral UPN_IS_SPELL_WITH_DIGITS = u"IsSpellWithDigits";
+inline constexpr OUStringLiteral UPN_IS_SPELL_CAPITALIZATION = u"IsSpellCapitalization";
+
+// UNO property names for Hyphenator
+inline constexpr OUStringLiteral UPN_HYPH_MIN_LEADING = u"HyphMinLeading";
+inline constexpr OUStringLiteral UPN_HYPH_MIN_TRAILING = u"HyphMinTrailing";
+inline constexpr OUStringLiteral UPN_HYPH_MIN_WORD_LENGTH = u"HyphMinWordLength";
+inline constexpr OUStringLiteral UPN_HYPH_NO_CAPS = u"HyphNoCaps";
+inline constexpr OUStringLiteral UPN_HYPH_NO_LAST_WORD = u"HyphNoLastWord";
+inline constexpr OUStringLiteral UPN_HYPH_ZONE = u"HyphZone";
+
+// UNO property names for Lingu
+// (those not covered by the SpellChecker and Hyphenator
+// properties and more likely to be used in other modules only)
+inline constexpr OUStringLiteral UPN_DEFAULT_LANGUAGE = u"DefaultLanguage";
+inline constexpr OUStringLiteral UPN_DEFAULT_LOCALE = u"DefaultLocale";
+inline constexpr OUStringLiteral UPN_DEFAULT_LOCALE_CJK = u"DefaultLocale_CJK";
+inline constexpr OUStringLiteral UPN_DEFAULT_LOCALE_CTL = u"DefaultLocale_CTL";
+inline constexpr OUStringLiteral UPN_IS_HYPH_AUTO = u"IsHyphAuto";
+inline constexpr OUStringLiteral UPN_IS_HYPH_SPECIAL = u"IsHyphSpecial";
+inline constexpr OUStringLiteral UPN_IS_SPELL_AUTO = u"IsSpellAuto";
+inline constexpr OUStringLiteral UPN_IS_SPELL_HIDE = u"IsSpellHide"; /*! deprecated #i91949 !*/
+inline constexpr OUStringLiteral UPN_IS_SPELL_IN_ALL_LANGUAGES = u"IsSpellInAllLanguages"; /*! deprecated #i91949 !*/
+inline constexpr OUStringLiteral UPN_IS_SPELL_SPECIAL = u"IsSpellSpecial";
+inline constexpr OUStringLiteral UPN_IS_WRAP_REVERSE = u"IsWrapReverse";
+inline constexpr OUStringLiteral UPN_DATA_FILES_CHANGED_CHECK_VALUE = u"DataFilesChangedCheckValue";
+
+// UNO property names for text conversion options
+inline constexpr OUStringLiteral UPN_ACTIVE_CONVERSION_DICTIONARIES = u"ActiveConversionDictionaries";
+inline constexpr OUStringLiteral UPN_IS_IGNORE_POST_POSITIONAL_WORD = u"IsIgnorePostPositionalWord";
+inline constexpr OUStringLiteral UPN_IS_AUTO_CLOSE_DIALOG = u"IsAutoCloseDialog";
+inline constexpr OUStringLiteral UPN_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST = u"IsShowEntriesRecentlyUsedFirst";
+inline constexpr OUStringLiteral UPN_IS_AUTO_REPLACE_UNIQUE_ENTRIES = u"IsAutoReplaceUniqueEntries";
+inline constexpr OUStringLiteral UPN_IS_DIRECTION_TO_SIMPLIFIED = u"IsDirectionToSimplified";
+inline constexpr OUStringLiteral UPN_IS_USE_CHARACTER_VARIANTS = u"IsUseCharacterVariants";
+inline constexpr OUStringLiteral UPN_IS_TRANSLATE_COMMON_TERMS = u"IsTranslateCommonTerms";
+inline constexpr OUStringLiteral UPN_IS_REVERSE_MAPPING = u"IsReverseMapping";
+
+inline constexpr OUStringLiteral UPN_IS_GRAMMAR_AUTO = u"IsAutoGrammarCheck";
+inline constexpr OUStringLiteral UPN_IS_GRAMMAR_INTERACTIVE = u"IsInteractiveGrammarCheck";
+
+// uno property handles
+#define UPH_IS_GERMAN_PRE_REFORM 0
+#define UPH_IS_USE_DICTIONARY_LIST 1
+#define UPH_IS_IGNORE_CONTROL_CHARACTERS 2
+#define UPH_IS_SPELL_UPPER_CASE 3
+#define UPH_IS_SPELL_WITH_DIGITS 4
+#define UPH_IS_SPELL_CAPITALIZATION 5
+#define UPH_HYPH_MIN_LEADING 6
+#define UPH_HYPH_MIN_TRAILING 7
+#define UPH_HYPH_MIN_WORD_LENGTH 8
+#define UPH_DEFAULT_LOCALE 9
+#define UPH_IS_SPELL_AUTO 10
+#define UPH_IS_SPELL_HIDE 11
+#define UPH_IS_SPELL_IN_ALL_LANGUAGES 12
+#define UPH_IS_SPELL_SPECIAL 13
+#define UPH_IS_HYPH_AUTO 14
+#define UPH_IS_HYPH_SPECIAL 15
+#define UPH_IS_WRAP_REVERSE 16
+#define UPH_DATA_FILES_CHANGED_CHECK_VALUE 17
+#define UPH_DEFAULT_LANGUAGE 21
+#define UPH_DEFAULT_LOCALE_CJK 22
+#define UPH_DEFAULT_LOCALE_CTL 23
+#define UPH_ACTIVE_DICTIONARIES 24
+#define UPH_ACTIVE_CONVERSION_DICTIONARIES 25
+#define UPH_IS_IGNORE_POST_POSITIONAL_WORD 26
+#define UPH_IS_AUTO_CLOSE_DIALOG 27
+#define UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST 28
+#define UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES 29
+#define UPH_IS_DIRECTION_TO_SIMPLIFIED 30
+#define UPH_IS_USE_CHARACTER_VARIANTS 31
+#define UPH_IS_TRANSLATE_COMMON_TERMS 32
+#define UPH_IS_REVERSE_MAPPING 33
+#define UPH_IS_GRAMMAR_AUTO 34
+#define UPH_IS_GRAMMAR_INTERACTIVE 35
+#define UPH_HYPH_NO_CAPS 36
+#define UPH_HYPH_NO_LAST_WORD 37
+#define UPH_HYPH_ZONE 38
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx
new file mode 100644
index 000000000..5fbdcd078
--- /dev/null
+++ b/include/unotools/localedatawrapper.hxx
@@ -0,0 +1,394 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_LOCALEDATAWRAPPER_HXX
+#define INCLUDED_UNOTOOLS_LOCALEDATAWRAPPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/i18n/LocaleItem.hpp>
+#include <com/sun/star/i18n/LocaleDataItem2.hpp>
+#include <com/sun/star/i18n/LanguageCountryInfo.hpp>
+#include <com/sun/star/i18n/ForbiddenCharacters.hpp>
+#include <com/sun/star/i18n/reservedWords.hpp>
+#include <rtl/ustring.hxx>
+#include <rtl/math.h>
+#include <i18nlangtag/languagetag.hxx>
+#include <unotools/unotoolsdllapi.h>
+#include <memory>
+#include <string_view>
+
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::i18n { class XLocaleData5; }
+namespace com::sun::star::i18n { struct Calendar2; }
+namespace com::sun::star::i18n { struct Currency2; }
+namespace com::sun::star::i18n { struct FormatElement; }
+namespace com::sun::star::i18n { struct CalendarItem2; }
+
+class Date;
+namespace tools { class Time; }
+class CalendarWrapper;
+
+enum class DateOrder {
+ Invalid = -1,
+ MDY = 0,
+ DMY,
+ YMD,
+};
+
+enum class LongDateOrder {
+ Invalid = -1,
+ MDY = 0,
+ DMY,
+ YMD,
+ YDM
+};
+
+enum class MeasurementSystem {
+ Metric,
+ US
+};
+
+/**
+ * This class can be accessed without locking because we load
+ * all of the data in the constructor.
+ */
+class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
+{
+ static sal_uInt8 nLocaleDataChecking; // 0:=dontknow, 1:=yes, 2:=no
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::i18n::XLocaleData5 > xLD;
+ LanguageTag maLanguageTag;
+ std::shared_ptr< css::i18n::Calendar2 > xDefaultCalendar;
+ std::shared_ptr< css::i18n::Calendar2 > xSecondaryCalendar;
+ css::i18n::LocaleDataItem2 aLocaleDataItem;
+ css::uno::Sequence< OUString > aDateAcceptancePatterns;
+ css::uno::Sequence< sal_Int32 > aGrouping;
+ // cached items
+ OUString aLocaleItem[css::i18n::LocaleItem::COUNT2];
+ std::vector<OUString> aReservedWords;
+ OUString aCurrSymbol;
+ OUString aCurrBankSymbol;
+ DateOrder nDateOrder;
+ LongDateOrder nLongDateOrder;
+ sal_uInt16 nCurrPositiveFormat;
+ sal_uInt16 nCurrNegativeFormat;
+ sal_uInt16 nCurrDigits;
+
+ void loadData();
+ void loadDateAcceptancePatterns(const std::vector<OUString> & rOverrideDateAcceptancePatterns);
+
+ const OUString& getOneLocaleItem( sal_Int16 nItem ) const;
+
+ const OUString& getOneReservedWord( sal_Int16 nWord ) const;
+
+ void loadCurrencyFormats();
+
+ void scanCurrFormatImpl( std::u16string_view rCode,
+ sal_Int32 nStart, sal_Int32& nSign,
+ sal_Int32& nPar, sal_Int32& nNum,
+ sal_Int32& nBlank, sal_Int32& nSym ) const;
+
+ void loadDateOrders();
+ LongDateOrder scanDateOrderImpl( std::u16string_view rCode ) const;
+
+ void ImplAddFormatNum( rtl::OUStringBuffer& rBuf,
+ sal_Int64 nNumber, sal_uInt16 nDecimals,
+ bool bUseThousandSep, bool bTrailingZeros ) const;
+
+ void loadDigitGrouping();
+
+public:
+ LocaleDataWrapper(
+ const css::uno::Reference< css::uno::XComponentContext > & rxContext,
+ LanguageTag aLanguageTag
+ );
+ /**
+ @param rOverrideDateAcceptancePatterns Override locale's date acceptance patterns.
+ An empty sequence resets the patterns to the locale's pattern sequence.
+ */
+ LocaleDataWrapper(
+ LanguageTag aLanguageTag,
+ const std::vector<OUString> & rOverrideDateAcceptancePatterns = {}
+ );
+ ~LocaleDataWrapper();
+
+ /** Get the service factory, meant to be able to create a CalendarWrapper
+ from a LocaleDataWrapper. Note that the service factory may be
+ non-existent if this LocaleDataWrapper was created without one and
+ lives "on the grassland". The CalendarWrapper ctor can handle that
+ though. */
+ const css::uno::Reference<
+ css::uno::XComponentContext > & getComponentContext()
+ const { return m_xContext; }
+
+ /// get current requested Locale
+ const LanguageTag& getLanguageTag() const;
+
+ /// get current loaded Locale, which might differ from the requested Locale
+ LanguageTag getLoadedLanguageTag() const;
+
+ // Wrapper implementations of service LocaleData
+
+ css::i18n::LanguageCountryInfo getLanguageCountryInfo() const;
+ /// NOTE: this wraps XLocaleData5::getLocaleItem2() in fact.
+ const css::i18n::LocaleDataItem2& getLocaleItem() const;
+ /// NOTE: this wraps XLocaleData3::getAllCalendars2() in fact.
+ css::uno::Sequence< css::i18n::Calendar2 > getAllCalendars() const;
+ /// NOTE: this wraps XLocaleData2::getAllCurrencies2() in fact.
+ css::uno::Sequence< css::i18n::Currency2 > getAllCurrencies() const;
+ css::uno::Sequence< css::i18n::FormatElement > getAllFormats() const;
+ css::i18n::ForbiddenCharacters getForbiddenCharacters() const;
+ const css::uno::Sequence< css::lang::Locale > & getAllInstalledLocaleNames() const;
+ const css::uno::Sequence< OUString > & getDateAcceptancePatterns() const;
+
+
+ /// same as the wrapper implementation but static
+ static const css::uno::Sequence< css::lang::Locale > & getInstalledLocaleNames();
+
+ /** Get LanguageTypes for all installed locales which are unambiguous
+ convertible back and forth between locale ISO strings and MS-LCID
+ LanguageType. Upon the first time the function is called when
+ locale data checking is enabled, messages are shown for locales not
+ matching, excluding already known problems.
+ (e.g. used in number formatter dialog init)
+ */
+ static const std::vector< LanguageType > & getInstalledLanguageTypes();
+
+ /// maps the LocaleData string to the International enum
+ MeasurementSystem mapMeasurementStringToEnum( std::u16string_view rMS ) const;
+
+ /// Convenience method to obtain the default calendar.
+ const std::shared_ptr< css::i18n::Calendar2 >& getDefaultCalendar() const;
+
+ /// Convenience method to obtain the day names of the default calendar.
+ css::uno::Sequence< css::i18n::CalendarItem2 > const & getDefaultCalendarDays() const;
+
+ /// Convenience method to obtain the month names of the default calendar.
+ css::uno::Sequence< css::i18n::CalendarItem2 > const & getDefaultCalendarMonths() const;
+
+ /** If the secondary calendar, if any, is of the name passed AND number
+ formats using it usually use the E or EE keyword (EC|EEC). */
+ bool doesSecondaryCalendarUseEC( std::u16string_view rName ) const;
+
+ /** Obtain digit grouping. The usually known grouping by thousands (#,###)
+ is actually only one of possible groupings. Another one, for example,
+ used in India is group by 3 and then by 2 indefinitely (#,##,###). The
+ integer sequence returned here specifies grouping from right to left
+ (!), with a 0 entry designating the end of rules and the previous value
+ to be repeated indefinitely. Hence the sequence {3,0} specifies the
+ usual grouping by thousands, whereas the sequence {3,2,0} specifies
+ Indian grouping. The sal_Int32* getConstArray() can be passed directly
+ to the ::rtl::math::doubleToString() methods as argument for the
+ pGroups parameter. */
+ const css::uno::Sequence< sal_Int32 >& getDigitGrouping() const;
+
+ // Functionality of class International methods, LocaleItem
+
+ const OUString& getDateSep() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::DATE_SEPARATOR ); }
+ const OUString& getNumThousandSep() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::THOUSAND_SEPARATOR ); }
+ const OUString& getNumDecimalSep() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::DECIMAL_SEPARATOR ); }
+ const OUString& getNumDecimalSepAlt() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::DECIMAL_SEPARATOR_ALTERNATIVE ); }
+ const OUString& getTimeSep() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::TIME_SEPARATOR ); }
+ const OUString& getTime100SecSep() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::TIME_100SEC_SEPARATOR ); }
+ const OUString& getListSep() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::LIST_SEPARATOR ); }
+ const OUString& getQuotationMarkStart() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::SINGLE_QUOTATION_START ); }
+ const OUString& getQuotationMarkEnd() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::SINGLE_QUOTATION_END ); }
+ const OUString& getDoubleQuotationMarkStart() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::DOUBLE_QUOTATION_START ); }
+ const OUString& getDoubleQuotationMarkEnd() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::DOUBLE_QUOTATION_END ); }
+ MeasurementSystem getMeasurementSystemEnum() const
+ { return mapMeasurementStringToEnum( getOneLocaleItem( css::i18n::LocaleItem::MEASUREMENT_SYSTEM ) ); }
+ const OUString& getTimeAM() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::TIME_AM ); }
+ const OUString& getTimePM() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::TIME_PM ); }
+ const OUString& getLongDateDayOfWeekSep() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::LONG_DATE_DAY_OF_WEEK_SEPARATOR ); }
+ const OUString& getLongDateDaySep() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::LONG_DATE_DAY_SEPARATOR ); }
+ const OUString& getLongDateMonthSep() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::LONG_DATE_MONTH_SEPARATOR ); }
+ const OUString& getLongDateYearSep() const
+ { return getOneLocaleItem( css::i18n::LocaleItem::LONG_DATE_YEAR_SEPARATOR ); }
+
+ /** A wrapper around rtl::math::stringToDouble() using the locale dependent
+ decimal separator, group separator, and if needed decimal separator
+ alternative.
+
+ The decimal separator is tried first, if the conversion does not match
+ the entire string then the decimal separator alternative is tried if it
+ occurs in the string and was the reason to stop.
+
+ Leading blanks are skipped, trailing blanks are not skipped. The number
+ is parsed up to the first non-floating point number character, same as
+ rtl::math::stringToDouble() does. The caller is responsible for proper
+ error checking and end comparison.
+
+ @param aString
+ The string to parse as floating point number.
+ @param bUseGroupSep
+ Whether group separator is used/accepted during parsing.
+ @param pStatus
+ Pointer to receive the conversion status as in
+ rtl::math::stringToDouble().
+ @param pParseEnd
+ Pointer to receive the parse end (exclusive) as in
+ rtl::math::stringToDouble().
+ @return The floating point number as parsed.
+ */
+ double stringToDouble( std::u16string_view aString, bool bUseGroupSep,
+ rtl_math_ConversionStatus* pStatus, sal_Int32* pParseEnd ) const;
+
+ /** A wrapper around rtl_math_uStringToDouble() using the locale dependent
+ decimal separator, group separator, and if needed decimal separator
+ alternative.
+
+ The decimal separator is tried first, if the conversion does not match
+ the entire string then the decimal separator alternative is tried if it
+ occurs in the string and was the reason to stop.
+
+ Leading blanks are skipped, trailing blanks are not skipped. The number
+ is parsed up to the first non-floating point number character, same as
+ rtl_math_uStringToDouble() does. The caller is responsible for proper
+ error checking and end comparison.
+
+ @param pBegin
+ The string position to start parsing a floating point number.
+ @param pEnd
+ The string position to stop parsing, exclusive.
+ @param bUseGroupSep
+ Whether group separator is used/accepted during parsing.
+ @param pStatus
+ Pointer to receive the conversion status as in
+ rtl_math_uStringToDouble().
+ @param pParseEnd
+ Pointer to receive the parse end (exclusive) as in
+ rtl_math_uStringToDouble().
+ @return The floating point number as parsed.
+ */
+ double stringToDouble( const sal_Unicode* pBegin, const sal_Unicode* pEnd, bool bUseGroupSep,
+ rtl_math_ConversionStatus* pStatus, const sal_Unicode** ppParseEnd ) const;
+
+ // currency
+ const OUString& getCurrSymbol() const;
+ const OUString& getCurrBankSymbol() const;
+ sal_uInt16 getCurrPositiveFormat() const;
+ sal_uInt16 getCurrNegativeFormat() const;
+ sal_uInt16 getCurrDigits() const;
+
+ // simple date and time formatting
+ DateOrder getDateOrder() const;
+ LongDateOrder getLongDateOrder() const;
+ /// only numerical values of Gregorian calendar
+ OUString getDate( const Date& rDate ) const;
+ OUString getTime( const tools::Time& rTime, bool bSec = true,
+ bool b100Sec = false ) const;
+ OUString getDuration( const tools::Time& rTime,
+ bool bSec = true, bool b100Sec = false ) const;
+
+ /** Simple number formatting
+ @param nNumber
+ value * 10**nDecimals
+ @param bTrailingZeros
+ </sal_True> := always display trailing zeros in
+ decimal places, even if integer value.
+ </sal_False> := trailing zeros are only displayed
+ if the value is not an integer value.
+ */
+ OUString getNum( sal_Int64 nNumber, sal_uInt16 nDecimals,
+ bool bUseThousandSep = true,
+ bool bTrailingZeros = true ) const;
+
+ /// "Secure" currency formatted string.
+ OUString getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
+ std::u16string_view rCurrencySymbol,
+ bool bUseThousandSep = true ) const;
+
+ // dummy returns, to be implemented
+ sal_Unicode getCurrZeroChar() const
+ { return '0'; }
+ static bool isNumLeadingZero()
+ { return true; }
+ /// standard decimal places
+ static sal_uInt16 getNumDigits()
+ { return 2; }
+ static bool isNumTrailingZeros()
+ { return true; }
+
+ // reserved words
+
+ const OUString& getTrueWord() const
+ { return getOneReservedWord( css::i18n::reservedWords::TRUE_WORD ); }
+ const OUString& getFalseWord() const
+ { return getOneReservedWord( css::i18n::reservedWords::FALSE_WORD ); }
+ const OUString& getAboveWord() const
+ { return getOneReservedWord( css::i18n::reservedWords::ABOVE_WORD ); }
+ const OUString& getBelowWord() const
+ { return getOneReservedWord( css::i18n::reservedWords::BELOW_WORD ); }
+ /// return a quarter abbreviation string matching nQuarter (0..3) => "Q1" .. "Q2"
+ const OUString& getQuarterAbbreviation( sal_Int16 nQuarter ) const
+ { return getOneReservedWord( css::i18n::reservedWords::QUARTER1_ABBREVIATION + nQuarter ); }
+
+ /** Return whether locale data checks are enabled.
+ Checks are enabled if the environment variable
+ OOO_ENABLE_LOCALE_DATA_CHECKS is set to 'Y' or 'Yes' (or any other
+ string starting with 'Y') or '1'.
+ Also used in conjunction with the number formatter. */
+ static bool areChecksEnabled()
+ {
+ if (nLocaleDataChecking == 0)
+ evaluateLocaleDataChecking();
+ return nLocaleDataChecking == 1;
+ }
+
+ /** Append locale info to string, used with locale data checking.
+ A string similar to "de_DE requested\n en_US loaded" is appended. */
+ OUString appendLocaleInfo(std::u16string_view rDebugMsg) const;
+
+ /** Output a message during locale data checking. The (UTF-8) string is
+ written to stderr and in a non-product build or if DBG_UTIL is enabled
+ also raised as an assertion message box. */
+ static void outputCheckMessage( std::u16string_view rMsg );
+ static void outputCheckMessage( const char* pStr);
+
+ LocaleDataWrapper(const LocaleDataWrapper&) = delete;
+ LocaleDataWrapper& operator=(const LocaleDataWrapper&) = delete;
+
+private:
+
+ const css::lang::Locale & getMyLocale() const;
+
+ static void evaluateLocaleDataChecking();
+};
+
+#endif // INCLUDED_UNOTOOLS_LOCALEDATAWRAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/localfilehelper.hxx b/include/unotools/localfilehelper.hxx
new file mode 100644
index 000000000..e96b5a571
--- /dev/null
+++ b/include/unotools/localfilehelper.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_LOCALFILEHELPER_HXX
+#define INCLUDED_UNOTOOLS_LOCALFILEHELPER_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <unotools/unotoolsdllapi.h>
+
+#include <rtl/ustring.hxx>
+
+namespace utl
+{
+ class UNOTOOLS_DLLPUBLIC LocalFileHelper
+ {
+ public:
+ static css::uno::Sequence< OUString >
+ GetFolderContents( const OUString& rFolder, bool bFolder );
+ };
+
+ /// recursively remove directory and all contents
+ UNOTOOLS_DLLPUBLIC void removeTree(OUString const & url);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/mediadescriptor.hxx b/include/unotools/mediadescriptor.hxx
new file mode 100644
index 000000000..92728fa51
--- /dev/null
+++ b/include/unotools/mediadescriptor.hxx
@@ -0,0 +1,339 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_MEDIADESCRIPTOR_HXX
+#define INCLUDED_UNOTOOLS_MEDIADESCRIPTOR_HXX
+
+#include <sal/config.h>
+
+#include <vector>
+
+#include <comphelper/docpasswordrequest.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/unotoolsdllapi.h>
+
+namespace com::sun::star::io {
+ class XInputStream;
+}
+namespace comphelper { class IDocPasswordVerifier; }
+
+namespace utl {
+
+/** @short can be used to work with a css::document::MediaDescriptor
+ struct.
+
+ @descr It wraps an unordered_map around the Sequence< css::beans::PropertyValue >, which
+ represent the MediaDescriptor item.
+ Further this helper defines often used functions (as e.g. open of the required streams,
+ consistent checks etcpp.) and it defines all usable property names.
+
+ @attention This class isn't threadsafe and must be guarded from outside!
+ */
+class UNOTOOLS_DLLPUBLIC MediaDescriptor : public comphelper::SequenceAsHashMap
+{
+ public:
+
+ /** @short these methods can be used to get the different property names
+ as static const OUString values.
+
+ @descr Because definition and declaration of static const class members
+ does not work as expected under windows (under unix it works as well)
+ these way must be used :-(
+ */
+ static constexpr OUStringLiteral PROP_ABORTED = u"Aborted";
+ static constexpr OUStringLiteral PROP_ASTEMPLATE = u"AsTemplate";
+ static constexpr OUStringLiteral PROP_COMPONENTDATA = u"ComponentData";
+ static constexpr OUStringLiteral PROP_DOCUMENTSERVICE = u"DocumentService";
+ static constexpr OUStringLiteral PROP_ENCRYPTIONDATA = u"EncryptionData";
+ static constexpr OUStringLiteral PROP_FILENAME = u"FileName";
+ static constexpr OUStringLiteral PROP_FILTERNAME = u"FilterName";
+ static constexpr OUStringLiteral PROP_FILTERPROVIDER = u"FilterProvider";
+ static constexpr OUStringLiteral PROP_FILTEROPTIONS = u"FilterOptions";
+ static constexpr OUStringLiteral PROP_FRAME = u"Frame";
+ static constexpr OUStringLiteral PROP_FRAMENAME = u"FrameName";
+ static constexpr OUStringLiteral PROP_HIDDEN = u"Hidden";
+ static constexpr OUStringLiteral PROP_INPUTSTREAM = u"InputStream";
+ static constexpr OUStringLiteral PROP_INTERACTIONHANDLER = u"InteractionHandler";
+ static constexpr OUStringLiteral PROP_AUTHENTICATIONHANDLER = u"AuthenticationHandler";
+ static constexpr OUStringLiteral PROP_JUMPMARK = u"JumpMark";
+ static constexpr OUStringLiteral PROP_MACROEXECUTIONMODE = u"MacroExecutionMode";
+ static constexpr OUStringLiteral PROP_MEDIATYPE = u"MediaType";
+ static constexpr OUStringLiteral PROP_MINIMIZED = u"Minimized";
+ static constexpr OUStringLiteral PROP_NOAUTOSAVE = u"NoAutoSave";
+ static constexpr OUStringLiteral PROP_OPENNEWVIEW = u"OpenNewView";
+ static constexpr OUStringLiteral PROP_OUTPUTSTREAM = u"OutputStream";
+ static constexpr OUStringLiteral PROP_PASSWORD = u"Password";
+ static constexpr OUStringLiteral PROP_POSTDATA = u"PostData";
+ static constexpr OUStringLiteral PROP_PREVIEW = u"Preview";
+ static constexpr OUStringLiteral PROP_READONLY = u"ReadOnly";
+ static constexpr OUStringLiteral PROP_REFERRER = u"Referer";
+ static constexpr OUStringLiteral PROP_REPLACEABLE = u"Replaceable";
+ static constexpr OUStringLiteral PROP_SALVAGEDFILE = u"SalvagedFile";
+ static constexpr OUStringLiteral PROP_STATUSINDICATOR = u"StatusIndicator";
+ static constexpr OUStringLiteral PROP_STREAM = u"Stream";
+ static constexpr OUStringLiteral PROP_STREAMFOROUTPUT = u"StreamForOutput";
+ static constexpr OUStringLiteral PROP_TEMPLATENAME = u"TemplateName";
+ static constexpr OUStringLiteral PROP_TITLE = u"Title";
+ static constexpr OUStringLiteral PROP_TYPENAME = u"TypeName";
+ static constexpr OUStringLiteral PROP_UCBCONTENT = u"UCBContent";
+ static constexpr OUStringLiteral PROP_UPDATEDOCMODE = u"UpdateDocMode";
+ static constexpr OUStringLiteral PROP_URL = u"URL";
+ static constexpr OUStringLiteral PROP_VERSION = u"Version";
+ static constexpr OUStringLiteral PROP_DOCUMENTTITLE = u"DocumentTitle";
+ static constexpr OUStringLiteral PROP_MODEL = u"Model";
+ static constexpr OUStringLiteral PROP_VIEWONLY = u"ViewOnly";
+ static constexpr OUStringLiteral PROP_DOCUMENTBASEURL = u"DocumentBaseURL";
+ static constexpr OUStringLiteral PROP_SUGGESTEDSAVEASNAME = u"SuggestedSaveAsName";
+ static constexpr OUStringLiteral PROP_AUTOSAVEEVENT = u"AutoSaveEvent";
+
+ // interface
+ public:
+
+ /** @short these ctors do nothing - excepting that they forward
+ the given parameters to the base class ctors.
+
+ @descr The ctors must be overwritten to resolve conflicts with
+ the default ctors of the compiler :-(.
+ */
+ MediaDescriptor();
+ MediaDescriptor(const css::uno::Sequence< css::beans::PropertyValue >& lSource);
+
+ /** @short it checks if the descriptor already has a valid
+ InputStream item and creates a new one, if not.
+
+ @descr This method uses the current items of this MediaDescriptor,
+ to open the stream (as e.g. URL, ReadOnly, PostData etcpp.).
+ It creates a seekable stream and put it into the descriptor.
+
+ A might existing InteractionHandler will be used automatically,
+ to solve problems!
+
+ In case of local file the system file locking is used.
+
+ @return TRUE, if the stream was already part of the descriptor or could
+ be created as new item. FALSE otherwise.
+ */
+ bool addInputStream();
+
+ /** @short it checks if the descriptor already has a valid
+ InputStream item and creates a new one, if not.
+
+ @descr This method uses the current items of this MediaDescriptor,
+ to open the stream (as e.g. URL, ReadOnly, PostData etcpp.).
+ It creates a seekable stream and put it into the descriptor.
+
+ A might existing InteractionHandler will be used automatically,
+ to solve problems!
+
+ In case of local file the system file locking is used based on
+ configuration settings.
+
+ @return TRUE, if the stream was already part of the descriptor or could
+ be created as new item. FALSE otherwise.
+ */
+ bool addInputStreamOwnLock();
+
+ /** @short it checks if the descriptor describes a readonly stream.
+
+ @descr The descriptor itself isn't changed doing so.
+ It's only checked if the stream seems to be based
+ of a real readonly file.
+
+ @Attention
+ We don't check the property "ReadOnly" here. Because
+ this property can be set from outside and overwrites
+ the readonly state of the stream.
+ If e.g. the stream could be opened read/write ...
+ but "ReadOnly" property is set to TRUE, this means:
+ show a readonly UI on top of this read/write stream.
+
+ @return TRUE, if the stream must be interpreted as readonly ...
+ FALSE otherwise.
+ */
+ bool isStreamReadOnly() const;
+
+ /** Returns a value from the sequence contained in the property
+ 'ComponentData' of this media descriptor.
+
+ @descr The property 'ComponentData' should be empty, or should
+ contain a value of type sequence<com.sun.star.beans.NamedValue>
+ or sequence<com.sun.star.beans.PropertyValue>.
+
+ @return The value with the specified name, if existing in the
+ sequence of the 'ComponentData' property, otherwise an empty
+ Any.
+ */
+ css::uno::Any getComponentDataEntry(
+ const OUString& rName ) const;
+
+ /** Inserts a value into the sequence contained in the property
+ 'ComponentData' of the media descriptor.
+
+ @descr The property 'ComponentData' should be empty, or should
+ contain a value of type sequence<com.sun.star.beans.NamedValue>
+ or sequence<com.sun.star.beans.PropertyValue>. The passed value
+ will be inserted into the sequence, or, if already existing,
+ will be overwritten.
+
+ @param rName The name of the value to be inserted into the
+ sequence of the 'ComponentData' property.
+
+ @param rValue The value to be inserted into the sequence of the
+ 'ComponentData' property.
+ */
+ void setComponentDataEntry(
+ const OUString& rName,
+ const css::uno::Any& rValue );
+
+ /** Removes a value from the sequence contained in the property
+ 'ComponentData' of the media descriptor.
+
+ @descr The property 'ComponentData' should be empty, or should
+ contain a value of type sequence<com.sun.star.beans.NamedValue>
+ or sequence<com.sun.star.beans.PropertyValue>. The value with
+ the passed name will be removed from the sequence, if existing.
+
+ @param rName The name of the value to be removed from the sequence
+ of the 'ComponentData' property.
+ */
+ void clearComponentDataEntry(
+ const OUString& rName );
+
+ /** This helper function tries to find a password for the document
+ described by this media descriptor.
+
+ First, the list of default passwords will be tried if provided. This
+ is needed by import filters for external file formats that have to
+ check a predefined password in some cases without asking the user
+ for a password. Every password is checked using the passed password
+ verifier.
+
+ If not successful, this media descriptor is asked for a password,
+ that has been set e.g. by an API call to load a document. If
+ existing, the password is checked using the passed password
+ verifier.
+
+ If still not successful, the interaction handler contained in this
+ media descriptor is used to request a password from the user. This
+ will be repeated until the passed password verifier validates the
+ entered password, or if the user chooses to cancel password input.
+
+ If a valid password (that is not contained in the passed list of
+ default passwords) was found, it will be inserted into the
+ "Password" property of this descriptor.
+
+ @param rVerifier
+ The password verifier used to check every processed password.
+
+ @param eRequestType
+ The password request type that will be passed to the
+ DocPasswordRequest object created internally. See
+ docpasswordrequest.hxx for more details.
+
+ @param pDefaultPasswords
+ If not null, contains default passwords that will be tried before a
+ password will be requested from the media descriptor or the user.
+
+ @return
+ If not empty, contains the password that has been validated by the
+ passed password verifier. If empty, no valid password has been
+ found, or the user has chosen to cancel password input.
+ */
+ css::uno::Sequence< css::beans::NamedValue > requestAndVerifyDocPassword(
+ comphelper::IDocPasswordVerifier& rVerifier,
+ comphelper::DocPasswordRequestType eRequestType,
+ const ::std::vector< OUString >* pDefaultPasswords );
+
+ // helper
+ private:
+
+ /** @short tries to open a stream by using the given PostData stream.
+
+ @descr The stream is used directly ...
+
+ The MediaDescriptor itself is changed inside this method.
+ Means: the stream is added internal and not returned by a value.
+
+ @param _rxPostData
+ the PostData stream.
+
+ @return TRUE if the stream could be added successfully.
+ Note: If FALSE is returned, the error was already handled inside!
+
+ @throw [css::uno::RuntimeException]
+ if the MediaDescriptor seems to be invalid!
+
+ @throw [css::lang::IllegalArgumentException]
+ if the given PostData stream is <NULL/>.
+ */
+ SAL_DLLPRIVATE bool impl_openStreamWithPostData(
+ const css::uno::Reference< css::io::XInputStream >& _rxPostData
+ );
+
+ /** @short tries to open a stream by using the given URL.
+
+ @descr First it tries to open the content in r/w mode (if its
+ allowed to do so). Only in case it's not allowed or it failed
+ the stream will be tried to open in readonly mode.
+
+ The MediaDescriptor itself is changed inside this method.
+ Means: the stream is added internal and not returned by a value.
+
+ @param sURL
+ the URL for open.
+
+ @param bLockFile
+ specifies whether the file should be locked
+
+ @return TRUE if the stream could be added successfully.
+ Note: If FALSE is returned, the error was already handled inside!
+
+ @throw [css::uno::RuntimeException]
+ if the MediaDescriptor seems to be invalid!
+ */
+ SAL_DLLPRIVATE bool impl_openStreamWithURL(
+ const OUString& sURL,
+ bool bLockFile
+ );
+
+ /** @short it checks if the descriptor already has a valid
+ InputStream item and creates a new one, if not.
+
+ @descr This method uses the current items of this MediaDescriptor,
+ to open the stream (as e.g. URL, ReadOnly, PostData etcpp.).
+ It creates a seekable stream and put it into the descriptor.
+
+ A might existing InteractionHandler will be used automatically,
+ to solve problems!
+
+ @param bLockFile
+ specifies whether the file should be locked
+
+ @return TRUE, if the stream was already part of the descriptor or could
+ be created as new item. FALSE otherwise.
+ */
+ SAL_DLLPRIVATE bool impl_addInputStream( bool bLockFile );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/moduleoptions.hxx b/include/unotools/moduleoptions.hxx
new file mode 100644
index 000000000..8aa9860ce
--- /dev/null
+++ b/include/unotools/moduleoptions.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_MODULEOPTIONS_HXX
+#define INCLUDED_UNOTOOLS_MODULEOPTIONS_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <unotools/options.hxx>
+#include <memory>
+
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::beans { struct PropertyValue; }
+
+/*-************************************************************************************************************
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is necessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+class SvtModuleOptions_Impl;
+
+/*-************************************************************************************************************
+ @short collect information about installation state of modules
+ @descr Use these class to get installation state of different office modules like writer, calc etc
+ Further you can ask for additional information; e.g. name of standard template file, which
+ should be used by corresponding module; or short/long name of these module factory.
+ @devstatus ready to use
+ @threadsafe yes
+*//*-*************************************************************************************************************/
+class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtModuleOptions final : public utl::detail::Options
+{
+ public:
+
+ enum class EModule
+ {
+ WRITER = 0,
+ CALC = 1,
+ DRAW = 2,
+ IMPRESS = 3,
+ MATH = 4,
+ CHART = 5,
+ STARTMODULE = 6,
+ BASIC = 7,
+ DATABASE = 8,
+ WEB = 9,
+ GLOBAL = 10
+ };
+
+ /*ATTENTION:
+ If you change these enum ... don't forget to change reading/writing and order of configuration values too!
+ See "SvtModuleOptions_Impl::impl_GetSetNames()" and his ctor for further information.
+ */
+ enum class EFactory
+ {
+ UNKNOWN_FACTORY = -1,
+ WRITER = 0,
+ WRITERWEB = 1,
+ WRITERGLOBAL = 2,
+ CALC = 3,
+ DRAW = 4,
+ IMPRESS = 5,
+ MATH = 6,
+ CHART = 7,
+ STARTMODULE = 8,
+ DATABASE = 9,
+ BASIC = 10,
+ LAST = BASIC
+ };
+
+ public:
+ SvtModuleOptions();
+ virtual ~SvtModuleOptions() override;
+
+ bool IsModuleInstalled ( EModule eModule ) const;
+ OUString GetModuleName ( EModule eModule ) const;
+ const OUString & GetFactoryName ( EFactory eFactory ) const;
+ OUString GetFactoryStandardTemplate( EFactory eFactory ) const;
+ OUString GetFactoryEmptyDocumentURL( EFactory eFactory ) const;
+ OUString GetFactoryDefaultFilter ( EFactory eFactory ) const;
+ bool IsDefaultFilterReadonly ( EFactory eFactory ) const;
+ sal_Int32 GetFactoryIcon ( EFactory eFactory ) const;
+ static bool ClassifyFactoryByName ( std::u16string_view sName ,
+ EFactory& eFactory );
+ void SetFactoryStandardTemplate( EFactory eFactory ,
+ const OUString& sTemplate );
+ void SetFactoryDefaultFilter ( EFactory eFactory ,
+ const OUString& sFilter );
+
+ /** @short return the corresponding application ID for the given
+ document service name.
+ */
+ static EFactory ClassifyFactoryByServiceName(std::u16string_view sName);
+
+ /** @short return the corresponding application ID for the given
+ short name.
+ */
+ static EFactory ClassifyFactoryByShortName(std::u16string_view sName);
+
+ /** @short return the corresponding application ID for the given properties.
+
+ @descr Because this search base on filters currently (till we have a better solution)
+ a result is not guaranteed every time. May a filter does not exists for the specified
+ content (but a FrameLoader which is not bound to any application!) ... or
+ the given properties describe a stream (and we make no deep detection inside here!).
+
+ @attention The module BASIC can't be detected here. Because it does not
+ has an own URL schema.
+
+ @param sURL
+ the complete URL!
+
+ @param lMediaDescriptor
+ additional information
+
+ @return A suitable enum value. See EFactory above.
+ */
+ static EFactory ClassifyFactoryByURL(const OUString& sURL ,
+ const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor);
+
+ /** @short return the corresponding application ID for the given properties.
+
+ @descr Here we try to use the list of supported service names of the given model
+ to find out the right application module.
+
+ @attention The module BASIC can't be detected here. Because it does not
+ support any model/ctrl/view paradigm.
+
+ @param xModel
+ the document model
+
+ @return A suitable enum value. See EFactory above.
+ */
+ static EFactory ClassifyFactoryByModel(const css::uno::Reference< css::frame::XModel >& xModel);
+
+ static OUString GetFactoryShortName(EFactory eFactory);
+
+ OUString GetDefaultModuleName() const;
+
+ bool IsMath () const;
+ bool IsChart () const;
+ bool IsCalc () const;
+ bool IsDraw () const;
+ bool IsWriter () const;
+ bool IsImpress () const;
+ static bool IsBasicIDE () { return true; }
+ bool IsDataBase () const;
+
+ css::uno::Sequence < OUString > GetAllServiceNames();
+
+ private:
+ std::shared_ptr<SvtModuleOptions_Impl> m_pImpl;
+
+}; // class SvtModuleOptions
+
+#endif // INCLUDED_UNOTOOLS_MODULEOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/nativenumberwrapper.hxx b/include/unotools/nativenumberwrapper.hxx
new file mode 100644
index 000000000..9f632f1f6
--- /dev/null
+++ b/include/unotools/nativenumberwrapper.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_NATIVENUMBERWRAPPER_HXX
+#define INCLUDED_UNOTOOLS_NATIVENUMBERWRAPPER_HXX
+
+#include <config_options.h>
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/i18n/NativeNumberXmlAttributes.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::i18n { class XNativeNumberSupplier2; }
+
+class UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) NativeNumberWrapper
+{
+ css::uno::Reference< css::i18n::XNativeNumberSupplier2 > xNNS;
+ NativeNumberWrapper( const NativeNumberWrapper& ) = delete;
+ NativeNumberWrapper& operator=( const NativeNumberWrapper& ) = delete;
+
+public:
+ NativeNumberWrapper(
+ const css::uno::Reference< css::uno::XComponentContext > & rxContext
+ );
+
+ ~NativeNumberWrapper();
+
+ // Wrapper implementations of XNativeNumberSupplier
+
+ OUString getNativeNumberString(
+ const OUString& rNumberString,
+ const css::lang::Locale& rLocale,
+ sal_Int16 nNativeNumberMode) const;
+
+ OUString getNativeNumberStringParams(
+ const OUString& rNumberString,
+ const css::lang::Locale& rLocale,
+ sal_Int16 nNativeNumberMode,
+ const OUString& rNativeNumberParams) const;
+
+ css::i18n::NativeNumberXmlAttributes convertToXmlAttributes(
+ const css::lang::Locale& rLocale,
+ sal_Int16 nNativeNumberMode ) const;
+
+ sal_Int16 convertFromXmlAttributes(
+ const css::i18n::NativeNumberXmlAttributes& rAttr ) const;
+
+};
+
+#endif // INCLUDED_UNOTOOLS_NATIVENUMBERWRAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/options.hxx b/include/unotools/options.hxx
new file mode 100644
index 000000000..4e0206ace
--- /dev/null
+++ b/include/unotools/options.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_OPTIONS_HXX
+#define INCLUDED_UNOTOOLS_OPTIONS_HXX
+
+#include <sal/config.h>
+#include <unotools/unotoolsdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <vector>
+#include <memory>
+
+// bits for broadcasting hints of changes in ConfigurationListener::ConfigurationChanged, may be combined
+enum class ConfigurationHints {
+ NONE = 0x0000,
+ Locale = 0x0001,
+ Currency = 0x0002,
+ UiLocale = 0x0004,
+ DecSep = 0x0008,
+ DatePatterns = 0x0010,
+ IgnoreLang = 0x0020,
+ CtlSettingsChanged = 0x2000,
+};
+namespace o3tl {
+ template<> struct typed_flags<ConfigurationHints> : is_typed_flags<ConfigurationHints, 0x203f> {};
+}
+
+/*
+ The class utl::detail::Options provides a kind of multiplexer. It implements a ConfigurationListener
+ that is usually registered at a ConfigItem class. At the same time it implements a ConfigurationBroadcaster
+ that allows further ("external") listeners to register.
+ Once the class deriving from Options is notified about
+ configuration changes by the ConfigItem if its content has been changed by calling some of its methods,
+ a call of the Options::NotifyListeners() method will send out notifications to all external listeners.
+*/
+
+namespace utl {
+
+ class ConfigurationBroadcaster;
+
+ // interface for configuration listener
+ class UNOTOOLS_DLLPUBLIC ConfigurationListener
+ {
+ public:
+ virtual ~ConfigurationListener();
+
+ virtual void ConfigurationChanged( ConfigurationBroadcaster* p, ConfigurationHints nHint ) = 0;
+ };
+ typedef ::std::vector< ConfigurationListener* > IMPL_ConfigurationListenerList;
+
+ // complete broadcasting implementation
+ class UNOTOOLS_DLLPUBLIC ConfigurationBroadcaster
+ {
+ std::unique_ptr<IMPL_ConfigurationListenerList> mpList;
+ sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0
+ ConfigurationHints m_nBlockedHint;
+
+ public:
+ void AddListener( utl::ConfigurationListener* pListener );
+ void RemoveListener( utl::ConfigurationListener const * pListener );
+
+ // notify listeners; nHint is an implementation detail of the particular class deriving from ConfigurationBroadcaster
+ void NotifyListeners( ConfigurationHints nHint );
+ ConfigurationBroadcaster();
+ ConfigurationBroadcaster(ConfigurationBroadcaster const & );
+ virtual ~ConfigurationBroadcaster();
+ ConfigurationBroadcaster & operator =(ConfigurationBroadcaster const & other);
+ virtual void BlockBroadcasts( bool bBlock );
+ };
+
+namespace detail {
+
+// A base class for the various option classes supported by
+// unotools/source/config/itemholderbase.hxx (which must be public, as it is
+// shared between unotools, svl and svt)
+// It also provides an implementation for a Configuration Listener and inherits a broadcaster implementation
+
+class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC Options
+ : public utl::ConfigurationBroadcaster, public utl::ConfigurationListener
+{
+public:
+ Options();
+
+ virtual ~Options() override = 0;
+
+private:
+ Options(Options const &) = delete;
+ Options& operator =(Options const &) = delete;
+
+protected:
+ virtual void ConfigurationChanged( ::utl::ConfigurationBroadcaster* p, ConfigurationHints nHint ) override;
+};
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/optionsdlg.hxx b/include/unotools/optionsdlg.hxx
new file mode 100644
index 000000000..4e0d78245
--- /dev/null
+++ b/include/unotools/optionsdlg.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/config.h>
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+#include <unordered_map>
+#include <string_view>
+
+// Loads the dialog options from config
+class UNOTOOLS_DLLPUBLIC SvtOptionsDialogOptions
+{
+public:
+
+ typedef std::unordered_map< OUString, bool > OptionNodeList;
+
+ SvtOptionsDialogOptions();
+
+ bool IsGroupHidden ( std::u16string_view _rGroup ) const;
+ bool IsPageHidden ( std::u16string_view _rPage,
+ std::u16string_view _rGroup ) const;
+ bool IsOptionHidden ( std::u16string_view _rOption,
+ std::u16string_view _rPage,
+ std::u16string_view _rGroup ) const;
+private:
+ bool IsHidden( const OUString& _rPath ) const;
+
+ OptionNodeList m_aOptionNodeList;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/pathoptions.hxx b/include/unotools/pathoptions.hxx
new file mode 100644
index 000000000..6388a54bc
--- /dev/null
+++ b/include/unotools/pathoptions.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_PATHOPTIONS_HXX
+#define INCLUDED_UNOTOOLS_PATHOPTIONS_HXX
+
+#include <rtl/ustring.hxx>
+#include <unotools/unotoolsdllapi.h>
+#include <unotools/options.hxx>
+
+#define SVT_SEARCHPATH_DELIMITER ';'
+
+class SvtPathOptions_Impl;
+
+/*! Handle various defined paths
+
+ All path functions return URLs!
+*/
+class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtPathOptions final : public utl::detail::Options
+{
+private:
+ std::shared_ptr<SvtPathOptions_Impl> pImpl;
+
+public:
+
+ enum class Paths : sal_uInt16
+ {
+ AddIn,
+ AutoCorrect,
+ AutoText,
+ Backup,
+ Basic,
+ Bitmap,
+ Config,
+ Dictionary,
+ Favorites,
+ Filter,
+ Gallery,
+ Graphic,
+ Help,
+ IconSet,
+ Linguistic,
+ Module,
+ Palette,
+ Plugin,
+ Storage,
+ Temp,
+ Template,
+ UserConfig,
+ Work,
+ Classification,
+ UIConfig,
+ Fingerprint,
+ NumberText,
+ LAST // should always be the last element
+ };
+
+
+ SvtPathOptions();
+ virtual ~SvtPathOptions() override;
+
+ // get the paths, not const because of using a mutex
+ const OUString& GetAddinPath() const;
+ const OUString& GetAutoCorrectPath() const;
+ const OUString& GetAutoTextPath() const;
+ const OUString& GetBackupPath() const;
+ const OUString& GetBasicPath() const;
+ const OUString& GetBitmapPath() const;
+ const OUString& GetConfigPath() const;
+ const OUString& GetDictionaryPath() const;
+ const OUString& GetFavoritesPath() const;
+ const OUString& GetFilterPath() const;
+ const OUString& GetGalleryPath() const;
+ const OUString& GetGraphicPath() const;
+ const OUString& GetHelpPath() const;
+ const OUString& GetLinguisticPath() const;
+ const OUString& GetModulePath() const;
+ const OUString& GetIconsetPath() const;
+ const OUString& GetPalettePath() const;
+ const OUString& GetPluginPath() const;
+ const OUString& GetStoragePath() const;
+ const OUString& GetTempPath() const;
+ const OUString& GetTemplatePath() const;
+ const OUString& GetUserConfigPath() const;
+ const OUString& GetWorkPath() const;
+ const OUString& GetFingerprintPath() const;
+ const OUString& GetNumbertextPath() const;
+ const OUString& GetClassificationPath() const;
+
+ // set the paths
+ void SetAddinPath( const OUString& rPath );
+ void SetAutoCorrectPath( const OUString& rPath );
+ void SetAutoTextPath( const OUString& rPath );
+ void SetBackupPath( const OUString& rPath );
+ void SetBasicPath( const OUString& rPath );
+ void SetBitmapPath( const OUString& rPath );
+ void SetConfigPath( const OUString& rPath );
+ void SetDictionaryPath( const OUString& rPath );
+ void SetFavoritesPath( const OUString& rPath );
+ void SetFilterPath( const OUString& rPath );
+ void SetGalleryPath( const OUString& rPath );
+ void SetGraphicPath( const OUString& rPath );
+ void SetHelpPath( const OUString& rPath );
+ void SetLinguisticPath( const OUString& rPath );
+ void SetModulePath( const OUString& rPath );
+ void SetPalettePath( const OUString& rPath );
+ void SetPluginPath( const OUString& rPath );
+ void SetStoragePath( const OUString& rPath );
+ void SetTempPath( const OUString& rPath );
+ void SetTemplatePath( const OUString& rPath );
+ void SetUserConfigPath( const OUString& rPath );
+ void SetWorkPath( const OUString& rPath );
+
+ OUString SubstituteVariable( const OUString& rVar ) const;
+ OUString ExpandMacros( const OUString& rPath ) const;
+ OUString UseVariable( const OUString& rVar ) const;
+ bool SearchFile( OUString& rIniFile, Paths ePath = Paths::UserConfig );
+};
+
+#endif // INCLUDED_UNOTOOLS_PATHOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/progresshandlerwrap.hxx b/include/unotools/progresshandlerwrap.hxx
new file mode 100644
index 000000000..4fcfd36da
--- /dev/null
+++ b/include/unotools/progresshandlerwrap.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_PROGRESSHANDLERWRAP_HXX
+#define INCLUDED_UNOTOOLS_PROGRESSHANDLERWRAP_HXX
+
+#include <config_options.h>
+#include <unotools/unotoolsdllapi.h>
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/ucb/XProgressHandler.hpp>
+
+namespace com::sun::star::task
+{
+class XStatusIndicator;
+}
+
+namespace utl
+{
+class UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) ProgressHandlerWrap final
+ : public ::cppu::WeakImplHelper<css::ucb::XProgressHandler>
+{
+ css::uno::Reference<css::task::XStatusIndicator> m_xStatusIndicator;
+
+public:
+ ProgressHandlerWrap(css::uno::Reference<css::task::XStatusIndicator> xSI);
+
+ // XProgressHandler
+ virtual void SAL_CALL push(const css::uno::Any& Status) override;
+ virtual void SAL_CALL update(const css::uno::Any& Status) override;
+ virtual void SAL_CALL pop() override;
+};
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_PROGRESSHANDLERWRAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/resmgr.hxx b/include/unotools/resmgr.hxx
new file mode 100644
index 000000000..142ec2de5
--- /dev/null
+++ b/include/unotools/resmgr.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_RESMGR_HXX
+#define INCLUDED_UNOTOOLS_RESMGR_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <unotools/syslocale.hxx>
+#include <rtl/ustring.hxx>
+#include <string_view>
+
+class LanguageTag;
+
+typedef OUString (*ResHookProc)(const OUString& rStr);
+
+struct UNOTOOLS_DLLPUBLIC TranslateId
+{
+ const char* mpContext;
+ const char* mpId;
+
+ inline constexpr TranslateId()
+ : mpContext(nullptr), mpId(nullptr) {}
+ inline constexpr TranslateId(const char* pContext, const char* pId)
+ : mpContext(pContext), mpId(pId) {}
+
+ inline operator bool() const { return mpId != nullptr; }
+
+ bool operator==(const TranslateId& other) const;
+ inline bool operator!=(const TranslateId& other) const { return !operator==(other); }
+};
+
+struct UNOTOOLS_DLLPUBLIC TranslateNId
+{
+ const char* mpContext;
+ const char* mpSingular;
+ const char* mpPlural;
+
+ inline TranslateNId()
+ : mpContext(nullptr), mpSingular(nullptr), mpPlural(nullptr) {}
+ inline TranslateNId(const char* pContext, const char* pSingular, const char* pPlural)
+ : mpContext(pContext), mpSingular(pSingular), mpPlural(pPlural) {}
+
+ inline operator bool() const { return mpContext != nullptr; }
+
+ bool operator==(const TranslateNId& other) const;
+ inline bool operator!=(const TranslateNId& other) const { return !operator==(other); }
+};
+
+namespace Translate
+{
+ UNOTOOLS_DLLPUBLIC std::locale Create(std::string_view aPrefixName, const LanguageTag& rLocale = SvtSysLocale().GetUILanguageTag());
+ UNOTOOLS_DLLPUBLIC OUString get(TranslateId sContextAndId, const std::locale &loc);
+ UNOTOOLS_DLLPUBLIC OUString nget(TranslateNId aContextSingularPlural, int n, const std::locale &loc);
+ UNOTOOLS_DLLPUBLIC void SetReadStringHook( ResHookProc pProc );
+ UNOTOOLS_DLLPUBLIC ResHookProc GetReadStringHook();
+ UNOTOOLS_DLLPUBLIC OUString ExpandVariables(const OUString& rString);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
new file mode 100644
index 000000000..9cd636761
--- /dev/null
+++ b/include/unotools/saveopt.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_SAVEOPT_HXX
+#define INCLUDED_UNOTOOLS_SAVEOPT_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <memory>
+
+namespace comphelper { class ConfigurationChanges; }
+
+namespace SvtSaveOptions
+{
+ /** Keep enum values sorted that a less or greater compare maps to older
+ and newer versions.
+ Do not change values, they are stored in the configuration.
+ ODFVER_LATEST designates the "current greatest and latest".
+ When adding a new value or ODFVER_LATEST designates a new real version
+ (plus extensions) adjust the mapping in
+ SvtSaveOptions::GetODFSaneDefaultVersion().
+ */
+ enum ODFDefaultVersion
+ {
+ ODFVER_UNKNOWN = 0, // unknown - very dubious, avoid using
+ ODFVER_010 = 1, // ODF 1.0
+ ODFVER_011 = 2, // ODF 1.1
+ DO_NOT_USE = 3, // Do not use this, only here for compatibility with pre OOo 3.2 configuration
+ ODFVER_012 = 4, // ODF 1.2
+ ODFVER_012_EXT_COMPAT = 8, // ODF 1.2 extended, but with compatibility fallbacks
+ ODFVER_012_EXTENDED = 9, // ODF 1.2 extended
+ ODFVER_013 = 10, // ODF 1.3
+
+ ODFVER_LATEST = SAL_MAX_ENUM, // ODF latest version with enhancements
+ };
+
+ /// Enums that allow a sane comparison of versions, without LATEST.
+ enum ODFSaneDefaultVersion
+ {
+ ODFSVER_EXTENDED = 1, ///< bit designating extensions are allowed
+ ODFSVER_010 = 2, ///< ODF 1.0
+ ODFSVER_011 = 4, ///< ODF 1.1
+ ODFSVER_012 = 6, ///< ODF 1.2
+ ODFSVER_012_EXT_COMPAT = 9, ///< ODF 1.2 extended, but with compatibility fallbacks
+ ODFSVER_012_EXTENDED = 11, ///< ODF 1.2 extended
+ ODFSVER_013 = 12, ///< ODF 1.3
+ ODFSVER_013_EXTENDED = 13, ///< ODF 1.3 extended
+ ODFSVER_FUTURE_EXTENDED = 1000 | ODFSVER_EXTENDED, ///< current extension, unknown future ODF version
+
+ // The latest defined standard. Adapt when a new one is published.
+ ODFSVER_LATEST = ODFSVER_013, ///< @internal DO NOT USE in comparisons
+ ODFSVER_LATEST_EXTENDED = ODFSVER_013_EXTENDED ///< @internal DO NOT USE in comparisons
+ };
+
+};
+
+UNOTOOLS_DLLPUBLIC void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion );
+UNOTOOLS_DLLPUBLIC void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion, const std::shared_ptr<comphelper::ConfigurationChanges>& );
+
+UNOTOOLS_DLLPUBLIC SvtSaveOptions::ODFDefaultVersion GetODFDefaultVersion();
+UNOTOOLS_DLLPUBLIC SvtSaveOptions::ODFSaneDefaultVersion GetODFSaneDefaultVersion();
+
+/** gets a sane default from the currently configured default */
+UNOTOOLS_DLLPUBLIC SvtSaveOptions::ODFSaneDefaultVersion GetODFSaneDefaultVersion(SvtSaveOptions::ODFDefaultVersion eDefaultVersion);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/searchopt.hxx b/include/unotools/searchopt.hxx
new file mode 100644
index 000000000..6b4321909
--- /dev/null
+++ b/include/unotools/searchopt.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_SEARCHOPT_HXX
+#define INCLUDED_UNOTOOLS_SEARCHOPT_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <memory>
+
+class SvtSearchOptions_Impl;
+enum class TransliterationFlags;
+
+class UNOTOOLS_DLLPUBLIC SvtSearchOptions
+{
+ std::unique_ptr<SvtSearchOptions_Impl> pImpl;
+
+ SvtSearchOptions( const SvtSearchOptions & ) = delete;
+ SvtSearchOptions & operator = ( const SvtSearchOptions & ) = delete;
+
+public:
+ SvtSearchOptions();
+ ~SvtSearchOptions();
+
+ void Commit();
+
+ TransliterationFlags GetTransliterationFlags() const;
+
+ // General Options
+
+ bool IsWholeWordsOnly() const;
+ bool IsBackwards() const;
+ bool IsUseRegularExpression() const;
+ bool IsUseWildcard() const;
+ bool IsSimilaritySearch() const;
+ bool IsUseAsianOptions() const;
+ bool IsMatchCase() const; // also Japanese search option
+ bool IsSearchFormatted() const;
+ bool IsNotes() const;
+
+ void SetWholeWordsOnly( bool bVal );
+ void SetBackwards( bool bVal );
+ void SetUseRegularExpression( bool bVal );
+ void SetUseWildcard( bool bVal );
+ void SetSearchForStyles( bool bVal );
+ void SetSimilaritySearch( bool bVal );
+ void SetUseAsianOptions( bool bVal );
+ void SetMatchCase( bool bVal ); // also Japanese search option
+ void SetSearchFormatted( bool bVal );
+ void SetNotes( bool bVal);
+
+ // Japanese search options
+
+ bool IsMatchFullHalfWidthForms() const;
+ bool IsMatchHiraganaKatakana() const;
+ bool IsMatchContractions() const;
+ bool IsMatchMinusDashChoon() const;
+ bool IsMatchRepeatCharMarks() const;
+ bool IsMatchVariantFormKanji() const;
+ bool IsMatchOldKanaForms() const;
+ bool IsMatchDiziDuzu() const;
+ bool IsMatchBavaHafa() const;
+ bool IsMatchTsithichiDhizi() const;
+ bool IsMatchHyuiyuByuvyu() const;
+ bool IsMatchSesheZeje() const;
+ bool IsMatchIaiya() const;
+ bool IsMatchKiku() const;
+ bool IsIgnorePunctuation() const;
+ bool IsIgnoreWhitespace() const;
+ bool IsIgnoreProlongedSoundMark() const;
+ bool IsIgnoreMiddleDot() const;
+ bool IsIgnoreDiacritics_CTL() const;
+ bool IsIgnoreKashida_CTL() const;
+
+ void SetMatchFullHalfWidthForms( bool bVal );
+ void SetMatchHiraganaKatakana( bool bVal );
+ void SetMatchContractions( bool bVal );
+ void SetMatchMinusDashChoon( bool bVal );
+ void SetMatchRepeatCharMarks( bool bVal );
+ void SetMatchVariantFormKanji( bool bVal );
+ void SetMatchOldKanaForms( bool bVal );
+ void SetMatchDiziDuzu( bool bVal );
+ void SetMatchBavaHafa( bool bVal );
+ void SetMatchTsithichiDhizi( bool bVal );
+ void SetMatchHyuiyuByuvyu( bool bVal );
+ void SetMatchSesheZeje( bool bVal );
+ void SetMatchIaiya( bool bVal );
+ void SetMatchKiku( bool bVal );
+ void SetIgnorePunctuation( bool bVal );
+ void SetIgnoreWhitespace( bool bVal );
+ void SetIgnoreProlongedSoundMark( bool bVal );
+ void SetIgnoreMiddleDot( bool bVal );
+ void SetIgnoreDiacritics_CTL( bool bVal );
+ void SetIgnoreKashida_CTL( bool bVal );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/securityoptions.hxx b/include/unotools/securityoptions.hxx
new file mode 100644
index 000000000..0cae239c1
--- /dev/null
+++ b/include/unotools/securityoptions.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <unotools/unotoolsdllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <unordered_map>
+
+/*-************************************************************************************************************
+ @short collect information about security features
+ @ATTENTION This class is partially threadsafe.
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+namespace SvtSecurityOptions
+{
+ enum class EOption
+ {
+ SecureUrls,
+ DocWarnSaveOrSend,
+ DocWarnSigning,
+ DocWarnPrint,
+ DocWarnCreatePdf,
+ DocWarnRemovePersonalInfo,
+ DocWarnRecommendPassword,
+ MacroSecLevel,
+ MacroTrustedAuthors,
+ CtrlClickHyperlink,
+ BlockUntrustedRefererLinks
+ };
+
+ struct Certificate
+ {
+ OUString SubjectName;
+ OUString SerialNumber;
+ OUString RawData;
+
+ bool operator==(const Certificate& other) const
+ {
+ return SubjectName == other.SubjectName && SerialNumber == other.SerialNumber && RawData == other.RawData;
+ }
+ };
+
+
+ /*-****************************************************************************************************
+ @short returns readonly state
+ @descr It can be called to get information about the readonly state of a provided item.
+ @param "eOption", specify, which item is queried
+ @return <TRUE/> if item is readonly; <FALSE/> otherwise
+
+ @onerror No error should occur!
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPUBLIC bool IsReadOnly( EOption eOption );
+
+ /*-****************************************************************************************************
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/Security/Scripting/SecureURL"
+ @descr These value displays the list of all trustworthy URLs.
+ zB.: file:/ => All scripts from the local file system including a LAN;
+ private:explorer => Scripts from the Explorer;
+ private:help => Scripts in the help system;
+ private:newmenu => Scripts that are executed by the commands File-New and AutoPilot;
+ private:schedule => Scripts of the scheduler;
+ private:searchfolder => Scripts of the searchfolder;
+ private:user => Scripts that are entered in the URL field.
+ @param "seqURLList", new values to set it in configuration.
+ @return The values which represent current state of internal variable.
+
+ @onerror No error should occur!
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPUBLIC std::vector< OUString > GetSecureURLs();
+ UNOTOOLS_DLLPUBLIC void SetSecureURLs( std::vector< OUString >&& seqURLList );
+
+ /*-****************************************************************************************************
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/Security/Scripting/StarOfficeBasic"
+ @descr These value determines how StarOffice Basic scripts should be handled.
+ It exist 3 different modes:
+ 0 = never execute
+ 1 = from list
+ 2 = always execute
+
+ @ATTENTION These methods don't check for valid or invalid values!
+ Our configuration server can do it ... but these implementation don't get any notifications
+ about wrong commits ...!
+ => If you set an invalid value - nothing will be changed. The information will lost.
+
+ @seealso enum EBasicSecurityMode
+
+ @param "eMode" to set new mode ... Value must defined as an enum of type EBasicSecurityMode!
+ @return An enum value, which present current mode.
+
+ @onerror No error should occur!
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPUBLIC sal_Int32 GetMacroSecurityLevel();
+ UNOTOOLS_DLLPUBLIC void SetMacroSecurityLevel( sal_Int32 _nLevel );
+
+ UNOTOOLS_DLLPUBLIC bool IsMacroDisabled();
+
+ /**
+ Check whether the given uri is either no dangerous macro-execution
+ URI at all or else the given referer is a trusted source.
+ */
+ UNOTOOLS_DLLPUBLIC bool isSecureMacroUri(OUString const & uri, OUString const & referer);
+
+ /**
+ Check whether the given referer URI is untrusted, and links
+ originating from it should not be accessed.
+ */
+ UNOTOOLS_DLLPUBLIC bool isUntrustedReferer(OUString const & referer);
+
+ /**
+ Check whether the given uri is a trusted location.
+ */
+ UNOTOOLS_DLLPUBLIC bool isTrustedLocationUri(OUString const & uri);
+
+ UNOTOOLS_DLLPUBLIC bool isTrustedLocationUriForUpdatingLinks(OUString const & uri);
+
+ UNOTOOLS_DLLPUBLIC std::vector< Certificate > GetTrustedAuthors();
+ UNOTOOLS_DLLPUBLIC void SetTrustedAuthors( const std::vector< Certificate >& rAuthors );
+
+ // for bool options only!
+ UNOTOOLS_DLLPUBLIC bool IsOptionSet ( EOption eOption );
+ UNOTOOLS_DLLPUBLIC void SetOption ( EOption eOption, bool bValue );
+
+} // namespace SvtSecurityOptions
+
+// map personal info strings, e.g. authors to 1, 2, 3... for removing personal info
+
+class UNOTOOLS_DLLPUBLIC SvtSecurityMapPersonalInfo
+{
+ std::unordered_map< OUString, size_t > aInfoIDs;
+public:
+ size_t GetInfoID( const OUString sPersonalInfo );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/sharedunocomponent.hxx b/include/unotools/sharedunocomponent.hxx
new file mode 100644
index 000000000..8acc64b1f
--- /dev/null
+++ b/include/unotools/sharedunocomponent.hxx
@@ -0,0 +1,269 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_SHAREDUNOCOMPONENT_HXX
+#define INCLUDED_UNOTOOLS_SHAREDUNOCOMPONENT_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ref.hxx>
+#include <memory>
+
+namespace com::sun::star {
+ namespace lang {
+ class XComponent;
+ }
+}
+
+namespace utl
+{
+
+ //= DisposableComponent
+
+ /** is a class which controls lifetime of a UNO component via ->XComponent::dispose
+
+ You'll usually never use this class directly, but only as parameter for a
+ ->SharedUNOComponent class.
+ */
+ class UNOTOOLS_DLLPUBLIC DisposableComponent
+ {
+ css::uno::Reference< css::lang::XComponent > m_xComponent;
+
+ public:
+ /** constructs a ->DisposableComponent instance
+
+ @param _rxComponent
+ the component whose life time should be controlled by the instance. Must not be <NULL/>.
+ */
+ DisposableComponent( const css::uno::Reference< css::uno::XInterface >& _rxComponent );
+
+ /** disposes the component represented by the instance
+
+ The component is queried for ->XComponent(which <em>must</em> be supported),
+ and ->XComponent::dispose is invoked. A failure of this invocation (e.g. a thrown
+ exception) is silenced in release builds, and reported in debug builds.
+ */
+ ~DisposableComponent();
+
+ private:
+ DisposableComponent( const DisposableComponent& ) = delete;
+ DisposableComponent& operator=( const DisposableComponent& ) = delete;
+ };
+
+ //= CloseableComponent
+
+ class CloseableComponentImpl;
+ /** is a class which controls lifetime of a UNO component via ->XCloseable::close
+
+ You'll usually never use this class directly, but only as parameter for a
+ ->SharedUNOComponent class.
+ */
+ class UNOTOOLS_DLLPUBLIC CloseableComponent
+ {
+ private:
+ /** Our IMPL class.
+ */
+ ::rtl::Reference< CloseableComponentImpl > m_pImpl;
+
+ public:
+ /** constructs a ->CloseableComponent instance
+
+ @param _rxComponent
+ the component whose life time should be controlled by the instance. Must not be <NULL/>.
+ */
+ CloseableComponent( const css::uno::Reference< css::uno::XInterface >& _rxComponent );
+
+ /** destroys resources associated with this instance, and disposes the component
+
+ The component is queried for ->XCloseable (which <em>must</em> be supported),
+ and ->XCloseable::close is invoked, with delivering the ownership.
+ If the invocation fails with a ->CloseVetoException, this is ignored, since in
+ this case the vetoing instance took the ownership.
+
+ Any other failure will be reported in a debug version via assertion mechanisms,
+ and silenced in release builds.
+ */
+ ~CloseableComponent();
+
+ private:
+ CloseableComponent( const CloseableComponent& ) = delete;
+ CloseableComponent& operator=( const CloseableComponent& ) = delete;
+ };
+
+ //= SharedUNOComponent
+
+ /** is a helper class for sharing ownership of a UNO component
+
+ If you need to share a UNO component, which normally needs a dedicated owner,
+ and is lifetime controlled by an explicit disposal action (not necessarily ->XComponent::dispose,
+ but <em>any</em> explicit method call, after which the object is considered
+ to be disposed), between different classes, ->SharedUNOComponent is what you need.
+
+ Instead of passing around a <code>Reference&lt; XFoo &gt;</code>, and bothering
+ with ownership and disposal, you just use a <code>SharedUNOComponent&lt; XFoo &gt;</code>.
+ This instance can be passed around, including copying, and in nearly all respects behaves
+ like the original <code>Reference&lt; XFoo &gt;</code>. However, when the last
+ ->SharedUNOComponent referencing a certain <code>Reference&lt; XFoo &gt;</code> dies, it
+ will automatically get rid of the object held by this reference.
+
+ @param INTERFACE
+ the UNO interface type as which the component should be held
+
+ @param COMPONENT_HOLDER
+ a class which can be used to represent and dispose a UNO component.
+ The class must support (maybe explicit only) construction from a
+ <code>Reference&lt; INTERFACE &gt;</code>, and destruction. Upon destruction,
+ the class must dispose (by any suitable means) the component instance it was
+ constructed with.
+ */
+ template < class INTERFACE, class COMPONENT = DisposableComponent >
+ class SharedUNOComponent
+ {
+ private:
+ typedef COMPONENT Component;
+
+ private:
+ std::shared_ptr<Component> m_xComponent;
+ css::uno::Reference< INTERFACE > m_xTypedComponent;
+
+ public:
+ enum AssignmentMode
+ {
+ TakeOwnership,
+ NoTakeOwnership
+ };
+
+ public:
+ SharedUNOComponent()
+ {
+ }
+
+ explicit SharedUNOComponent( const css::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode eMode = TakeOwnership )
+ {
+ reset( _rxComponent, eMode );
+ }
+
+ SharedUNOComponent( const css::uno::BaseReference & _rRef, css::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ set( _rRef, _queryThrow );
+ }
+
+// SharedUNOComponent& operator=( const css::uno::Reference< INTERFACE >& _rxComponent );
+ // This operator is intentionally not implemented. There is no canonic ownership after this operator
+ // would have been applied: Should the SharedUNOComponent have the ownership of the component,
+ // or shouldn't it? Hard to guess, and probably wrong in 50 percent of all cases, anyway. So,
+ // instead of tempting clients of this class to use such a dangerous operator, we do
+ // not offer it at all. If you need to assign a Reference< INTERFACE > to your SharedUNOComponent,
+ // use the ->reset method.
+
+ /** assigns a new component, and releases the old one
+ */
+ void reset( const css::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode _eMode = TakeOwnership );
+
+ inline bool set( const css::uno::BaseReference& _rRef, css::uno::UnoReference_Query _query );
+
+ inline void set( const css::uno::BaseReference & _rRef, css::uno::UnoReference_QueryThrow _queryThrow );
+
+ inline void set( const css::uno::Reference< INTERFACE >& _rRef, css::uno::UnoReference_SetThrow _setThrow );
+ inline void set( const SharedUNOComponent& _rComp, css::uno::UnoReference_SetThrow _setThrow );
+
+ INTERFACE* SAL_CALL operator->() const;
+
+ operator const css::uno::Reference< INTERFACE >&() const
+ {
+ return m_xTypedComponent;
+ }
+
+ const css::uno::Reference< INTERFACE >& getTyped() const
+ {
+ return m_xTypedComponent;
+ }
+
+ bool is() const
+ {
+ return m_xTypedComponent.is();
+ }
+
+ void clear()
+ {
+ m_xComponent.reset();
+ m_xTypedComponent.clear();
+ }
+ };
+
+ template < class INTERFACE, class COMPONENT >
+ INTERFACE* SAL_CALL SharedUNOComponent< INTERFACE, COMPONENT >::operator->() const
+ {
+ return m_xTypedComponent.operator->();
+ }
+
+ // assignments
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::reset( const css::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode _eMode )
+ {
+ m_xComponent.reset(_eMode == TakeOwnership ? new COMPONENT( _rxComponent ) : nullptr);
+ m_xTypedComponent = _rxComponent;
+ }
+
+ // comparison operators
+
+ template < class INTERFACE, class COMPONENT >
+ bool operator==( const SharedUNOComponent< INTERFACE, COMPONENT >& _rLHS, const css::uno::Reference< INTERFACE >& _rRHS )
+ {
+ return _rLHS.getTyped() == _rRHS;
+ }
+
+ template < class INTERFACE, class COMPONENT >
+ inline css::uno::Any SAL_CALL makeAny( const SharedUNOComponent< INTERFACE, COMPONENT >& value )
+ {
+ return css::uno::Any( value.getTyped() );
+ }
+
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const css::uno::BaseReference & _rRef, css::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ reset( css::uno::Reference< INTERFACE >( _rRef, _queryThrow ), TakeOwnership );
+ }
+
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const css::uno::Reference< INTERFACE >& _rRef, css::uno::UnoReference_SetThrow _setThrow )
+ {
+ reset( css::uno::Reference< INTERFACE >( _rRef, _setThrow ), TakeOwnership );
+ }
+
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const SharedUNOComponent& _rComp, css::uno::UnoReference_SetThrow _setThrow )
+ {
+ *this = _rComp;
+ // provoke an exception in case the component is NULL
+ m_xTypedComponent.set( m_xTypedComponent, _setThrow );
+ }
+
+ template < class INTERFACE, class COMPONENT >
+ bool SharedUNOComponent< INTERFACE, COMPONENT >::set( const css::uno::BaseReference& _rRef, css::uno::UnoReference_Query _query )
+ {
+ reset( css::uno::Reference< INTERFACE >( _rRef, _query ) );
+ return is();
+ }
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_SHAREDUNOCOMPONENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/streamhelper.hxx b/include/unotools/streamhelper.hxx
new file mode 100644
index 000000000..a727869bf
--- /dev/null
+++ b/include/unotools/streamhelper.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_STREAMHELPER_HXX
+#define INCLUDED_UNOTOOLS_STREAMHELPER_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <tools/stream.hxx>
+#include <mutex>
+#include <utility>
+
+namespace utl
+{
+
+/**
+ * The helper implementation for a using input streams based on SvLockBytes.
+ */
+class UNOTOOLS_DLLPUBLIC OInputStreamHelper final : public cppu::WeakImplHelper<css::io::XInputStream, css::io::XSeekable>
+{
+ std::mutex m_aMutex;
+ SvLockBytesRef m_xLockBytes;
+ sal_uInt64 m_nActPos;
+ sal_Int32 m_nAvailable; // this is typically the chunk(buffer) size
+
+public:
+ OInputStreamHelper(SvLockBytesRef _xLockBytes,
+ sal_uInt32 _nAvailable)
+ :m_xLockBytes(std::move(_xLockBytes))
+ ,m_nActPos(0)
+ ,m_nAvailable(_nAvailable){}
+
+// css::io::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) override;
+ virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) override;
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
+ virtual sal_Int32 SAL_CALL available( ) override;
+ virtual void SAL_CALL closeInput( ) override;
+
+ virtual void SAL_CALL seek( sal_Int64 location ) override;
+ virtual sal_Int64 SAL_CALL getPosition( ) override;
+ virtual sal_Int64 SAL_CALL getLength( ) override;
+
+ // workaround for Ubuntu 18.04 / Fedora 31 (Coverity VM) build with std::mutex; must not be inline!
+ virtual void SAL_CALL acquire() SAL_NOEXCEPT override;
+};
+
+} // namespace utl
+
+#endif // _UNOTOOLS_STREAM_WRAPPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/streamwrap.hxx b/include/unotools/streamwrap.hxx
new file mode 100644
index 000000000..dc4c51807
--- /dev/null
+++ b/include/unotools/streamwrap.hxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_STREAMWRAP_HXX
+#define INCLUDED_UNOTOOLS_STREAMWRAP_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/XTruncate.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/bytereader.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <memory>
+#include <mutex>
+
+class SvStream;
+
+namespace utl
+{
+
+// workaround for incremental linking bugs in MSVC2015
+class SAL_DLLPUBLIC_TEMPLATE OInputStreamWrapper_Base : public cppu::WeakImplHelper< css::io::XInputStream, css::lang::XUnoTunnel > {};
+
+/// helper class for wrapping an SvStream into a com.sun.star.io::XInputStream
+class UNOTOOLS_DLLPUBLIC OInputStreamWrapper : public OInputStreamWrapper_Base, public comphelper::ByteReader
+{
+protected:
+ std::mutex m_aMutex;
+ SvStream* m_pSvStream;
+ bool m_bSvStreamOwner : 1;
+ OInputStreamWrapper()
+ { m_pSvStream = nullptr; m_bSvStreamOwner = false; }
+ void SetStream(SvStream* _pStream, bool bOwner )
+ { m_pSvStream = _pStream; m_bSvStreamOwner = bOwner; }
+
+public:
+ OInputStreamWrapper(SvStream& _rStream);
+ OInputStreamWrapper(SvStream* pStream, bool bOwner=false);
+ OInputStreamWrapper(std::unique_ptr<SvStream> pStream);
+ virtual ~OInputStreamWrapper() override;
+
+// css::io::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) override;
+ virtual sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) override;
+ virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override;
+ virtual sal_Int32 SAL_CALL available() override;
+ virtual void SAL_CALL closeInput() override;
+
+// css::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& _rIdentifier ) override;
+
+// utl::ByteReader
+ virtual sal_Int32 readSomeBytes( sal_Int8* aData, sal_Int32 nMaxBytesToRead ) final override;
+
+protected:
+ /// throws a NotConnectedException if the object is not connected anymore
+ void checkConnected() const;
+ /// throws an exception according to the error flag of m_pSvStream
+ void checkError() const;
+};
+
+//= OSeekableInputStreamWrapper
+
+/** helper class for wrapping an SvStream into a com.sun.star.io::XInputStream
+ which is seekable (i.e. supports the com.sun.star.io::XSeekable interface).
+*/
+class UNOTOOLS_DLLPUBLIC OSeekableInputStreamWrapper
+ : public cppu::ImplInheritanceHelper< OInputStreamWrapper, css::io::XSeekable >
+{
+protected:
+ OSeekableInputStreamWrapper() {}
+ ~OSeekableInputStreamWrapper() override;
+
+public:
+ OSeekableInputStreamWrapper(SvStream& _rStream);
+ OSeekableInputStreamWrapper(SvStream* _pStream, bool _bOwner = false);
+
+ // XSeekable
+ virtual void SAL_CALL seek( sal_Int64 _nLocation ) override;
+ virtual sal_Int64 SAL_CALL getPosition( ) override;
+ virtual sal_Int64 SAL_CALL getLength( ) override;
+};
+
+//= OOutputStreamWrapper
+
+class OOutputStreamWrapper : public cppu::WeakImplHelper<css::io::XOutputStream>
+{
+public:
+ UNOTOOLS_DLLPUBLIC OOutputStreamWrapper(SvStream& _rStream);
+
+protected:
+ virtual ~OOutputStreamWrapper() override;
+
+// css::io::XOutputStream
+ virtual void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 >& aData) override;
+ virtual void SAL_CALL flush() override;
+ virtual void SAL_CALL closeOutput() override;
+
+ /// throws an exception according to the error flag of m_pSvStream
+ void checkError() const;
+
+ // TODO: thread safety!
+ SvStream& rStream;
+};
+
+//= OSeekableOutputStreamWrapper
+
+typedef ::cppu::ImplHelper1 < css::io::XSeekable
+ > OSeekableOutputStreamWrapper_Base;
+/** helper class for wrapping an SvStream into a com.sun.star.io::XOutputStream
+ which is seekable (i.e. supports the com.sun.star.io::XSeekable interface).
+*/
+class UNOTOOLS_DLLPUBLIC OSeekableOutputStreamWrapper final
+ :public OOutputStreamWrapper
+ ,public OSeekableOutputStreamWrapper_Base
+{
+public:
+ OSeekableOutputStreamWrapper(SvStream& _rStream);
+
+private:
+ virtual ~OSeekableOutputStreamWrapper() override;
+
+ // disambiguate XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& _rType ) override;
+ virtual void SAL_CALL acquire( ) noexcept override
+ { OOutputStreamWrapper::acquire(); }
+ virtual void SAL_CALL release( ) noexcept override
+ { OOutputStreamWrapper::release(); }
+
+ // XSeekable
+ virtual void SAL_CALL seek( sal_Int64 _nLocation ) override;
+ virtual sal_Int64 SAL_CALL getPosition( ) override;
+ virtual sal_Int64 SAL_CALL getLength( ) override;
+};
+
+class UNOTOOLS_DLLPUBLIC OStreamWrapper final
+ : public cppu::ImplInheritanceHelper<OSeekableInputStreamWrapper,
+ css::io::XStream,
+ css::io::XOutputStream,
+ css::io::XTruncate>
+{
+ ~OStreamWrapper() override;
+
+public:
+ OStreamWrapper(SvStream& _rStream);
+ OStreamWrapper(std::unique_ptr<SvStream> _rStream);
+
+// css::io::XStream
+ virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream( ) override;
+ virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL getOutputStream( ) override;
+
+// css::io::XOutputStream
+ virtual void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 >& aData) override;
+ virtual void SAL_CALL flush() override;
+ virtual void SAL_CALL closeOutput() override;
+ virtual void SAL_CALL truncate() override;
+};
+
+}
+// namespace utl
+
+#endif // INCLUDED_UNOTOOLS_STREAMWRAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/syslocale.hxx b/include/unotools/syslocale.hxx
new file mode 100644
index 000000000..e5bc9dd85
--- /dev/null
+++ b/include/unotools/syslocale.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_SYSLOCALE_HXX
+#define INCLUDED_UNOTOOLS_SYSLOCALE_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/textenc.h>
+
+#include <memory>
+
+class CharClass;
+class LanguageTag;
+class LocaleDataWrapper;
+class SvtSysLocale_Impl;
+class SvtSysLocaleOptions;
+
+/**
+ SvtSysLocale provides a refcounted single instance of an application wide
+ LocaleDataWrapper and <type>CharClass</type> which always
+ follow the locale as it is currently configured by the user. You may use
+ it anywhere to access the locale data elements like decimal separator and
+ simple date formatting and so on. Constructing and destructing a
+ SvtSysLocale is not expensive as long as there is at least one instance
+ left.
+ */
+class UNOTOOLS_DLLPUBLIC SvtSysLocale
+{
+ friend class SvtSysLocale_Impl; // access to mutex
+
+ std::shared_ptr<SvtSysLocale_Impl> pImpl;
+
+public:
+ SvtSysLocale();
+ ~SvtSysLocale();
+
+ const LocaleDataWrapper& GetLocaleData() const;
+ const CharClass& GetCharClass() const;
+
+ /** It is safe to store the pointers locally and use them AS LONG AS THE
+ INSTANCE OF SvtSysLocale LIVES!
+ It is a faster access but be sure what you do!
+ */
+ SvtSysLocaleOptions& GetOptions() const;
+ const LanguageTag& GetLanguageTag() const;
+ const LanguageTag& GetUILanguageTag() const;
+
+ /** Get the best MIME encoding matching the system locale, or if that isn't
+ determinable one that matches the UI locale, or UTF8 if everything else
+ fails.
+ */
+ static rtl_TextEncoding GetBestMimeEncoding();
+};
+
+#endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/syslocaleoptions.hxx b/include/unotools/syslocaleoptions.hxx
new file mode 100644
index 000000000..5f5e57540
--- /dev/null
+++ b/include/unotools/syslocaleoptions.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_SYSLOCALEOPTIONS_HXX
+#define INCLUDED_UNOTOOLS_SYSLOCALEOPTIONS_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <i18nlangtag/lang.h>
+#include <i18nlangtag/languagetag.hxx>
+#include <unotools/options.hxx>
+
+class SvtSysLocaleOptions_Impl;
+class LinkParamNone;
+template <typename Arg, typename Ret> class Link;
+
+class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtSysLocaleOptions final : public utl::detail::Options
+{
+ std::shared_ptr<SvtSysLocaleOptions_Impl> pImpl;
+
+ virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* p, ConfigurationHints nHint ) override;
+
+public:
+
+ enum class EOption
+ {
+ Locale,
+ Currency,
+ DatePatterns
+ };
+ SvtSysLocaleOptions();
+ virtual ~SvtSysLocaleOptions() override;
+
+ // ConfigItem methods
+
+ bool IsModified() const;
+ void Commit();
+
+ /** Add a listener to react on config changes
+ which are broadcasted in a SfxSimpleHint
+ @return
+ <TRUE/> if added
+ <FALSE/> if not added
+ */
+
+ /** Block broadcasts and accumulate hints. This may be useful if, for
+ example, the locale and currency are changed and the currency was
+ empty before, since changing the locale with an empty currency does
+ also broadcast a change hint for the currency which would result in
+ two currency changes broadcasted.
+
+ @param bBlock
+ <TRUE/>: broadcasts are blocked until reversed.
+ <FALSE/>: broadcasts are not blocked anymore. Pending hints are
+ broadcasted if no other instance blocks the broadcast.
+
+ @ATTENTION
+ All SvtSysLocaleOptions instances point to exactly one refcounted
+ internal representation instance and broadcast blocks are counted.
+ Thus if you issue a BlockBroadcasts(true) you MUST issue a matching
+ BlockBroadcasts(false) or otherwise pending hints would never be
+ broadcasted again.
+ */
+ virtual void BlockBroadcasts( bool bBlock ) override;
+
+ // config value access methods
+
+ /// The config string may be empty to denote the SYSTEM locale
+ void SetLocaleConfigString( const OUString& rStr );
+ /** Get locale set, not resolved to the real locale. */
+ LanguageTag GetLanguageTag() const;
+ /** Get locale set, always resolved to the real locale. */
+ const LanguageTag& GetRealLanguageTag() const;
+
+ /// The config string may be empty to denote the SYSTEM locale
+ void SetUILocaleConfigString( const OUString& rStr );
+ /** Get UI locale set, always resolved to the real locale. */
+ const LanguageTag& GetRealUILanguageTag() const;
+
+ /// The config string may be empty to denote the default currency of the locale
+ const OUString& GetCurrencyConfigString() const;
+ void SetCurrencyConfigString( const OUString& rStr );
+
+ /** The config string may be empty to denote the default
+ DateAcceptancePatterns of the locale */
+ const OUString& GetDatePatternsConfigString() const;
+ void SetDatePatternsConfigString( const OUString& rStr );
+
+ // determine whether the decimal separator defined in the keyboard layout is used
+ // or the one appropriate to the locale
+ bool IsDecimalSeparatorAsLocale() const;
+ void SetDecimalSeparatorAsLocale( bool bSet);
+
+ // determine whether to ignore changes to the system keyboard/locale/language when
+ // determining the language for newly entered text
+ bool IsIgnoreLanguageChange() const;
+ void SetIgnoreLanguageChange( bool bSet);
+
+ // convenience methods
+
+ /// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string
+ static void GetCurrencyAbbrevAndLanguage(
+ OUString& rAbbrev,
+ LanguageType& eLang,
+ const OUString& rConfigString );
+
+ /// Create an USD-en-US or EUR-de-DE string
+ static OUString CreateCurrencyConfigString(
+ const OUString& rAbbrev,
+ LanguageType eLang );
+
+ void GetCurrencyAbbrevAndLanguage(
+ OUString& rAbbrev,
+ LanguageType& eLang ) const
+ {
+ GetCurrencyAbbrevAndLanguage( rAbbrev,
+ eLang, GetCurrencyConfigString() );
+ }
+
+ /** Set a link to a method to be called whenever the default currency
+ changes. This can be only one method, and normally it is the static
+ link method which calls SvNumberFormatter::SetDefaultSystemCurrency().
+ This is needed because the number formatter isn't part of the svl light
+ library, otherwise we could call SetDefaultSystemCurrency() directly.
+ */
+ static void SetCurrencyChangeLink( const Link<LinkParamNone*,void>& rLink );
+ static const Link<LinkParamNone*,void>& GetCurrencyChangeLink();
+
+ /** return the readonly state of the queried option. */
+ bool IsReadOnly( EOption eOption ) const;
+};
+
+#endif // INCLUDED_UNOTOOLS_SYSLOCALEOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/tempfile.hxx b/include/unotools/tempfile.hxx
new file mode 100644
index 000000000..b7f691abb
--- /dev/null
+++ b/include/unotools/tempfile.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_TEMPFILE_HXX
+#define INCLUDED_UNOTOOLS_TEMPFILE_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <tools/stream.hxx>
+#include <memory>
+
+namespace utl
+{
+
+/**
+ The class TempFile gives access to temporary files in the local file system. Sometimes they are needed because a 3rd party
+ code has a file name based interface, or some file access has to be done locally without transferring tons of bytes to or
+ from a remote system.
+ Creating a UCB content on a TempFile is only possible if a UCP for the local file system is present.
+ TempFiles can always be accessed by SvFileStreams or Sot/SvStorages using the "physical" file name ( not the URL, because
+ this may be a non-file URL, see below ), but if a UCB content can be created, it is also possible to take the URL and use
+ the UCB helper classes for streams. For convenience use UcbStreamHelper.
+ A Tempfile always has a "physical" file name ( a file name in the local computers host notation ) but it has a
+ "UCB compatible" URL only if a UCP for the local file system exists. This URL may have its own URL scheme
+ ( not necessarily "file://" ! ). The TempFile class methods take this into account, but other simple conversions like
+ the osl functions do not.
+ So it is a potential error to convert between the filename and the URL of a TempFile object using functions or methods
+ outside this class.
+*/
+
+class UNOTOOLS_DLLPUBLIC TempFile
+{
+ OUString aName;
+ std::unique_ptr<SvStream>
+ pStream;
+ bool bIsDirectory;
+ bool bKillingFileEnabled;
+
+public:
+ /**
+ Create a temporary file or directory, in the default tempfile folder or if possible in a given folder.
+ This given folder ( the "parent" parameter ( if not NULL ) ) must be a "UCB compatible" URL.
+ The temporary object is created in the local file system, even if there is no UCB that can access it.
+ If the given folder is part of the local file system, the TempFile is created in this folder.
+ */
+ TempFile( const OUString* pParent=nullptr, bool bDirectory=false );
+
+ /**
+ Same as above; additionally the name starts with some given characters followed by a counter ( example:
+ rLeadingChars="abc" means "abc0","abc1" and so on, depending on existing files in the folder ).
+ The extension string may be f.e. ".txt" or "", if no extension string is given, ".tmp" is used
+ @param _bStartWithZero If set to false names will be generated like "abc","abc0","abc1"
+ @param bCreateParentDirs If rLeadingChars contains a slash, this will create the required
+ parent directories.
+ */
+ TempFile( std::u16string_view rLeadingChars, bool _bStartWithZero=true, const OUString* pExtension=nullptr,
+ const OUString* pParent=nullptr, bool bCreateParentDirs=false );
+
+ TempFile(TempFile && other) noexcept;
+
+ /**
+ TempFile will be removed from disk in dtor if EnableKillingFile(true) was called before.
+ Temporary directories will be removed recursively in that case.
+ */
+ ~TempFile();
+
+ /**
+ Returns sal_True if it has a valid file name.
+ */
+ bool IsValid() const;
+
+ /**
+ Returns the URL of the tempfile object.
+ If you want to have the system path file name, use the GetFileName() method of this object
+ */
+ OUString const & GetURL() const;
+
+ /**
+ Returns the system path name of the tempfile in host notation
+ If you want to have the URL, use the GetURL() method of this object.
+ */
+ OUString GetFileName() const;
+
+ /**
+ Returns a stream to the tempfiles data; the stream is owned by the tempfile object, so you have to keep this
+ alive as long as you want to use the stream. If the TempFile object is destroyed, it also destroys the
+ stream object, the underlying file is only deleted if EnableKillingFile(true) has been called before!
+ */
+ SvStream* GetStream( StreamMode eMode );
+
+ /**
+ Let the TempFile object close and destroy the owned stream object if any.
+ */
+ void CloseStream();
+
+ /**
+ If enabled the file will be removed from disk when the dtor is called ( default is not enabled )
+ */
+ void EnableKillingFile( bool bEnable=true )
+ { bKillingFileEnabled = bEnable; }
+
+ /**
+ Only create a "physical" file name for a temporary file that would be valid at that moment.
+ Should only be used for 3rd party code with a file name interface that wants to create the file by itself.
+ If you want to convert file name into a URL, always use class LocalFileHelper, but never use any
+ conversion functions of osl.
+ */
+ static OUString CreateTempName();
+
+ /**
+ The TempNameBaseDirectory is a subfolder in the folder that is passed as a "physical" file name in the
+ SetTempNameBaseDirectory method.
+ This subfolder will be used if a TempFile or TempName is created without a parent name or a parent name
+ that does not belong to the local file system.
+ The caller of the SetTempNameBase is responsible for deleting this folder and all temporary files in it.
+ The return value of both methods is the complete "physical" name of the tempname base folder.
+ It is not a URL because all URLs must be "UCB compatible", so there may be no suitable URL at all.
+ */
+ static OUString SetTempNameBaseDirectory( const OUString &rBaseName );
+
+ // Return the URL of the temp directory (the one set with SetTempNameBaseDirectory or the
+ // default tempfile folder):
+ static OUString GetTempNameBaseDirectory();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/textsearch.hxx b/include/unotools/textsearch.hxx
new file mode 100644
index 000000000..140200fec
--- /dev/null
+++ b/include/unotools/textsearch.hxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_TEXTSEARCH_HXX
+#define INCLUDED_UNOTOOLS_TEXTSEARCH_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <i18nlangtag/lang.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+#include <ostream>
+
+class CharClass;
+
+namespace com::sun::star::lang { struct Locale; }
+namespace com::sun::star::util { class XTextSearch2; }
+namespace com::sun::star::util { struct SearchResult; }
+namespace i18nutil {
+ struct SearchOptions;
+ struct SearchOptions2;
+}
+enum class TransliterationFlags;
+
+namespace utl
+{
+
+// Utility class for searching
+class UNOTOOLS_DLLPUBLIC SearchParam
+{
+public:
+ enum class SearchType { Normal, Regexp, Wildcard, Unknown = -1 };
+
+ /** Convert configuration and document boolean settings to SearchType.
+ If bWildcard is true it takes precedence over rbRegExp.
+ @param rbRegExp
+ If true and bWildcard is also true, rbRegExp is set to false to
+ adapt the caller's settings.
+ */
+ static SearchType ConvertToSearchType( bool bWildcard, bool & rbRegExp )
+ {
+ if (bWildcard)
+ {
+ if (rbRegExp)
+ rbRegExp = false;
+ return SearchType::Wildcard;
+ }
+ return rbRegExp ? SearchType::Regexp : SearchType::Normal;
+ }
+
+ /** Convert SearchType to configuration and document boolean settings.
+ */
+ static void ConvertToBool( const SearchType eSearchType, bool& rbWildcard, bool& rbRegExp )
+ {
+ switch (eSearchType)
+ {
+ case SearchType::Wildcard:
+ rbWildcard = true;
+ rbRegExp = false;
+ break;
+ case SearchType::Regexp:
+ rbWildcard = false;
+ rbRegExp = true;
+ break;
+ default:
+ rbWildcard = false;
+ rbRegExp = false;
+ break;
+ }
+ }
+
+private:
+ OUString sSrchStr; // the search string
+
+ SearchType m_eSrchType; // search normal/regular/LevDist
+
+ sal_uInt32 m_cWildEscChar; // wildcard escape character
+
+ bool m_bCaseSense : 1;
+ bool m_bWildMatchSel : 1; // wildcard pattern must match entire selection
+
+public:
+ SearchParam( const OUString &rText,
+ SearchType eSrchType,
+ bool bCaseSensitive = true,
+ sal_uInt32 cWildEscChar = '\\',
+ bool bWildMatchSel = false );
+
+ SearchParam( const SearchParam& );
+
+ ~SearchParam();
+
+ const OUString& GetSrchStr() const { return sSrchStr; }
+ SearchType GetSrchType() const { return m_eSrchType; }
+
+ bool IsCaseSensitive() const { return m_bCaseSense; }
+ bool IsWildMatchSel() const { return m_bWildMatchSel; }
+
+ // signed return for API use
+ sal_Int32 GetWildEscChar() const { return static_cast<sal_Int32>(m_cWildEscChar); }
+};
+
+// For use in SAL_DEBUG etc. Output format not guaranteed to be stable.
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, traits> & stream, const SearchParam::SearchType& eType)
+{
+ switch (eType)
+ {
+ case SearchParam::SearchType::Normal:
+ stream << "N";
+ break;
+ case SearchParam::SearchType::Regexp:
+ stream << "RE";
+ break;
+ case SearchParam::SearchType::Wildcard:
+ stream << "WC";
+ break;
+ case SearchParam::SearchType::Unknown:
+ stream << "UNK";
+ break;
+ default:
+ stream << static_cast<int>(eType) << '?';
+ break;
+ }
+
+ return stream;
+}
+
+// Utility class for searching a substring in a string.
+// The following metrics are supported
+// - ordinary text (Bayer/Moore)
+// - regular expressions
+// - weighted Levenshtein distance
+// - wildcards '*' and '?'
+
+// This class allows forward and backward searching!
+
+class UNOTOOLS_DLLPUBLIC TextSearch
+{
+ static css::uno::Reference< css::util::XTextSearch2 >
+ getXTextSearch( const i18nutil::SearchOptions2& rPara );
+
+ css::uno::Reference < css::util::XTextSearch2 >
+ xTextSearch;
+
+ void Init( const SearchParam & rParam,
+ const css::lang::Locale& rLocale );
+
+public:
+ // rText is the string being searched for
+ // this first two CTORs are deprecated!
+ TextSearch( const SearchParam & rPara, LanguageType nLanguage );
+ TextSearch( const SearchParam & rPara, const CharClass& rCClass );
+
+ TextSearch( const i18nutil::SearchOptions2& rPara );
+ ~TextSearch();
+
+ /* search in the (selected) text the search string:
+ rScrTxt - the text, in which we search
+ pStart - start position for the search
+ pEnd - end position for the search
+
+ RETURN values == true: something is found
+ - pStart start pos of the found text,
+ - pEnd end pos of the found text,
+ - pSrchResult - the search result with all found
+ positions. Is only filled with more positions
+ if the regular expression handles groups.
+
+ == false: nothing found, pStart, pEnd unchanged.
+
+ Definitions: start pos always inclusive, end pos always exclusive!
+ The position must always in the right direction!
+ search forward: start <= end
+ search backward: end <= start
+ */
+ bool SearchForward( const OUString &rStr,
+ sal_Int32* pStart, sal_Int32* pEnd,
+ css::util::SearchResult* pRes = nullptr );
+ /**
+ * @brief searchForward Search forward beginning from the start to the end
+ * of the given text
+ * @param rStr The text in which we search
+ * @return True if the search term is found in the text
+ */
+ bool searchForward( const OUString &rStr );
+ bool SearchBackward( const OUString &rStr,
+ sal_Int32* pStart, sal_Int32* pEnd,
+ css::util::SearchResult* pRes = nullptr );
+
+ void SetLocale( const i18nutil::SearchOptions2& rOpt,
+ const css::lang::Locale& rLocale );
+
+ /* replace back references in the replace string by the sub expressions from the search result */
+ void ReplaceBackReferences( OUString& rReplaceStr, std::u16string_view rStr, const css::util::SearchResult& rResult ) const;
+
+ /** Upgrade SearchOptions to SearchOptions2 for places that don't handle
+ SearchOptions2 yet. Better fix your module if you want to support
+ wildcard search.
+ */
+ static i18nutil::SearchOptions2 UpgradeToSearchOptions2( const i18nutil::SearchOptions& rOptions );
+
+};
+
+} // namespace utl
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/transliterationwrapper.hxx b/include/unotools/transliterationwrapper.hxx
new file mode 100644
index 000000000..138c1e8d1
--- /dev/null
+++ b/include/unotools/transliterationwrapper.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
+#define INCLUDED_UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+#include <i18nlangtag/languagetag.hxx>
+#include <i18nlangtag/lang.h>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::uno { template <typename > class Sequence; }
+namespace com::sun::star::i18n { class XExtendedTransliteration; }
+namespace com::sun::star::uno { class XComponentContext; }
+enum class TransliterationFlags;
+
+namespace utl
+{
+
+class UNOTOOLS_DLLPUBLIC TransliterationWrapper
+{
+ css::uno::Reference< css::i18n::XExtendedTransliteration > xTrans;
+ LanguageTag aLanguageTag;
+ TransliterationFlags nType;
+ mutable bool bFirstCall;
+
+ TransliterationWrapper( const TransliterationWrapper& ) = delete;
+ TransliterationWrapper& operator=( const TransliterationWrapper& ) = delete;
+
+ void loadModuleImpl() const;
+ void setLanguageLocaleImpl( LanguageType nLang );
+
+public:
+ TransliterationWrapper( const css::uno::Reference< css::uno::XComponentContext > & rxContext,
+ TransliterationFlags nType );
+
+ ~TransliterationWrapper();
+
+ TransliterationFlags getType() const { return nType; }
+
+ bool needLanguageForTheMode() const;
+
+ /** set a new language and load the corresponding transliteration module if
+ needed for the mode set with nType in the ctor */
+ void loadModuleIfNeeded( LanguageType nLang );
+
+ /** Load the transliteration module specified by rModuleName, which has to
+ be the UNO service implementation name that is expanded to the full UNO
+ service implementation name, for example, "NumToCharKanjiShort_ja_JP"
+ expands to
+ "com.sun.star.i18n.Transliteration.NumToCharKanjiShort_ja_JP".
+ @ATTENTION!
+ This method ignores the mode type set with the constructor and
+ interferes with the loadModuleIfNeeded() method and the transliterate()
+ method that gets a LanguageType passed as parameter. Using one of
+ those may load a different module and overwrite this setting. Only the
+ transliterate() method that takes no LanguageType parameter may be used
+ for a specific module loaded with this method. */
+ void loadModuleByImplName( const OUString& rModuleName, LanguageType nLang );
+
+ /** This transliteration method corresponds with the loadModuleByImplName()
+ method. It relies on a module being loaded and does not try load one.
+ If for any reason the string can't be transliterated the original
+ string is returned. */
+ OUString transliterate( const OUString& rStr,
+ sal_Int32 nStart, sal_Int32 nLen ) const;
+
+ // Wrapper implementations of class Transliteration
+ OUString transliterate( const OUString& rStr, LanguageType nLanguage,
+ sal_Int32 nStart, sal_Int32 nLen,
+ css::uno::Sequence <sal_Int32>* pOffset );
+
+ /** If two strings are equal per this transliteration.
+ Returns the number of matched code points in any case, even if strings
+ are not equal, for example:
+ equals( "a", 0, 1, nMatch1, "aaa", 0, 3, nMatch2 )
+ returns false and nMatch:=1 and nMatch2:=1
+ equals( "aab", 0, 3, nMatch1, "aaa", 0, 3, nMatch2 )
+ returns false and nMatch:=2 and nMatch2:=2
+ */
+ bool equals(
+ const OUString& rStr1, sal_Int32 nPos1, sal_Int32 nCount1, sal_Int32& nMatch1,
+ const OUString& rStr2, sal_Int32 nPos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) const;
+
+ sal_Int32 compareString( const OUString& rStr1, const OUString& rStr2 ) const;
+
+ // helpers
+
+ /** If two strings are really equal as per this translation, and not just
+ one string is matching the start of the other. Use this method instead
+ of compareString()==0 because it is much faster.
+ */
+ bool isEqual( const OUString& rStr1, const OUString& rStr2 ) const;
+
+ /** If string rStr1 matches the start of string rStr2, i.e. "a" in "aaa"
+ */
+ bool isMatch( const OUString& rStr1, const OUString& rStr2 ) const;
+
+};
+
+} // namespace utl
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/ucbhelper.hxx b/include/unotools/ucbhelper.hxx
new file mode 100644
index 000000000..76168e1f7
--- /dev/null
+++ b/include/unotools/ucbhelper.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_UCBHELPER_HXX
+#define INCLUDED_UNOTOOLS_UCBHELPER_HXX
+
+#include <sal/config.h>
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star {
+ namespace uno {
+ class Any;
+ class XComponentContext;
+ }
+ namespace ucb{
+ class XCommandEnvironment;
+ }
+}
+namespace ucbhelper { class Content; }
+
+namespace utl::UCBContentHelper {
+
+UNOTOOLS_DLLPUBLIC bool IsDocument(OUString const & url);
+
+UNOTOOLS_DLLPUBLIC bool IsFolder(OUString const & url);
+
+/// @param title must not be null
+/// @return true iff title has been set (i.e., if obtaining the "Title" property
+/// of the given content yields a non-void value without raising a
+/// non-RuntimeException; RuntimeExceptions are passed through)
+UNOTOOLS_DLLPUBLIC bool GetTitle(
+ OUString const & url, OUString * title);
+
+UNOTOOLS_DLLPUBLIC bool Kill(OUString const & url);
+
+UNOTOOLS_DLLPUBLIC css::uno::Any GetProperty(
+ OUString const & url, OUString const & property);
+
+UNOTOOLS_DLLPUBLIC bool MakeFolder(
+ ucbhelper::Content & parent, OUString const & title,
+ ucbhelper::Content & result);
+
+/// like mkdir -p
+UNOTOOLS_DLLPUBLIC bool ensureFolder(
+ const css::uno::Reference< css::uno::XComponentContext >& xCtx,
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv,
+ std::u16string_view rFolder, ucbhelper::Content & result) noexcept;
+
+UNOTOOLS_DLLPUBLIC bool IsYounger(
+ OUString const & younger, OUString const & older);
+
+UNOTOOLS_DLLPUBLIC bool Exists(OUString const & url);
+
+UNOTOOLS_DLLPUBLIC bool IsSubPath(
+ OUString const & parent, OUString const & child);
+
+UNOTOOLS_DLLPUBLIC bool EqualURLs(
+ OUString const & url1, OUString const & url2);
+
+/**
+* Returns a default XCommandEnvironment to be used
+* when creating a ucbhelper::Content.
+*
+* Due to the way the WebDAV UCP provider works, an interaction handler
+* is always needed:
+* 1) to activate the credential dialog or to provide the cached credentials
+* whenever the server requests them;
+*
+* 2) in case of ssl connection (https) to activate the dialog to show the
+* certificate if said certificate looks wrong or dubious.
+*
+* This helper provides the XCommandEnvironment with an interaction
+* handler that intercepts:
+* 1) css::ucb::AuthenticationRequest()
+* 2) css::ucb::CertificateValidationRequest()
+* 3) css::ucb::InteractiveIOException()
+* 4) css::ucb::UnsupportedDataSinkException()
+*
+* Exception 1) and 2) will be passed to the UI handler, e.g. shown to
+* the user for interaction.
+*
+* Exception 3) and 4) will be have a default 'Abort' result.
+* See comphelper::StillReadWriteInteraction for details.
+* comphelper::StillReadWriteInteraction was introduced in
+* commit bbe51f039dffca2506ea542feb78571b6358b981.
+*/
+UNOTOOLS_DLLPUBLIC
+ css::uno::Reference< css::ucb::XCommandEnvironment > getDefaultCommandEnvironment();
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/ucbstreamhelper.hxx b/include/unotools/ucbstreamhelper.hxx
new file mode 100644
index 000000000..69bae538b
--- /dev/null
+++ b/include/unotools/ucbstreamhelper.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_UCBSTREAMHELPER_HXX
+#define INCLUDED_UNOTOOLS_UCBSTREAMHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <unotools/unotoolsdllapi.h>
+
+#include <tools/stream.hxx>
+#include <memory>
+
+namespace com::sun::star::io
+ {
+ class XStream;
+ class XInputStream;
+ }
+
+namespace com::sun::star::awt { class XWindow; }
+
+namespace utl
+{
+ class UNOTOOLS_DLLPUBLIC UcbStreamHelper
+ {
+ public:
+ static std::unique_ptr<SvStream> CreateStream(const OUString& rFileName, StreamMode eOpenMode, css::uno::Reference<css::awt::XWindow> xParentWin = nullptr);
+ static std::unique_ptr<SvStream> CreateStream(const OUString& rFileName, StreamMode eOpenMode,
+ bool bFileExists, css::uno::Reference<css::awt::XWindow> xParentWin = nullptr);
+ static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream );
+ static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XStream >& xStream );
+ static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream, bool bCloseStream );
+ static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XStream >& xStream, bool bCloseStream );
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/unotoolsdllapi.h b/include/unotools/unotoolsdllapi.h
new file mode 100644
index 000000000..86864b3f0
--- /dev/null
+++ b/include/unotools/unotoolsdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_UNOTOOLS_UNOTOOLSDLLAPI_H
+#define INCLUDED_UNOTOOLS_UNOTOOLSDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(UNOTOOLS_DLLIMPLEMENTATION)
+#define UNOTOOLS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define UNOTOOLS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define UNOTOOLS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_UNOTOOLS_UNOTOOLSDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/useroptions.hxx b/include/unotools/useroptions.hxx
new file mode 100644
index 000000000..d21482dcc
--- /dev/null
+++ b/include/unotools/useroptions.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_USEROPTIONS_HXX
+#define INCLUDED_UNOTOOLS_USEROPTIONS_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+#include <memory>
+
+namespace osl { class Mutex; }
+
+// define ----------------------------------------------------------------
+enum class UserOptToken
+{
+ City = 0,
+ Company = 1,
+ Country = 2,
+ Email = 3,
+ Fax = 4,
+ FirstName = 5,
+ LastName = 6,
+ Position = 7,
+ State = 8,
+ Street = 9,
+ TelephoneHome = 10,
+ TelephoneWork = 11,
+ Title = 12,
+ ID = 13,
+ Zip = 14,
+ FathersName = 15,
+ Apartment = 16,
+ SigningKey = 17,
+ EncryptionKey = 18,
+ EncryptToSelf = 19,
+ LAST = EncryptToSelf,
+};
+
+// class SvtUserOptions --------------------------------------------------
+
+class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtUserOptions final : public utl::detail::Options
+{
+public:
+ SvtUserOptions ();
+ virtual ~SvtUserOptions () override;
+
+ // get the address token
+ OUString GetCompany () const;
+ OUString GetFirstName () const;
+ OUString GetLastName () const;
+ OUString GetID () const;
+ OUString GetStreet () const;
+ OUString GetCity () const;
+ OUString GetState () const;
+ OUString GetZip () const;
+ OUString GetCountry () const;
+ OUString GetPosition () const;
+ OUString GetTitle () const;
+ OUString GetTelephoneHome () const;
+ OUString GetTelephoneWork () const;
+ OUString GetFax () const;
+ OUString GetEmail () const;
+ OUString GetSigningKey () const;
+ OUString GetEncryptionKey () const;
+ bool GetEncryptToSelf () const;
+
+ OUString GetFullName () const;
+
+ bool IsTokenReadonly (UserOptToken nToken) const;
+ OUString GetToken (UserOptToken nToken) const;
+ void SetToken (UserOptToken nToken, OUString const& rNewToken);
+ void SetBoolValue (UserOptToken nToken, bool bNewValue);
+
+private:
+ class SAL_DLLPRIVATE Impl;
+ std::shared_ptr<Impl> xImpl;
+ static std::weak_ptr<Impl> xSharedImpl;
+private:
+ class SAL_DLLPRIVATE ChangeListener;
+};
+
+#endif // INCLUDED_UNOTOOLS_USEROPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/viewoptions.hxx b/include/unotools/viewoptions.hxx
new file mode 100644
index 000000000..273e38817
--- /dev/null
+++ b/include/unotools/viewoptions.hxx
@@ -0,0 +1,223 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_UNOTOOLS_VIEWOPTIONS_HXX
+#define INCLUDED_UNOTOOLS_VIEWOPTIONS_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::beans { struct NamedValue; }
+namespace com::sun::star::container { class XNameAccess; }
+
+/*-************************************************************************************************************
+ @descr Use these enum values to specify right list in configuration in which your view data are saved.
+*//*-*************************************************************************************************************/
+
+enum class EViewType
+{
+ Dialog = 0,
+ TabDialog = 1,
+ TabPage = 2,
+ Window = 3
+};
+
+/*-************************************************************************************************************
+ @short collect information about view features
+ @descr We support different basetypes of views like dialogs, tab-dialogs, tab-pages and normal windows.
+ You must specify your basetype by using right enum value and must give us a valid name for your
+ subkey in registry! We support some fix features for some bastypes and user data as string for all!
+ see also configuration package "org.openoffice.Office.Views/..." for further information.
+
+ template of configuration:
+ DialogType
+ /WindowState [string]
+ /UserData [set of any scalar types]
+ TabDialogType
+ /WindowState [string]
+ /UserData [set of any scalar types]
+ /PageID [int]
+ TabPageType
+ /WindowState [string]
+ /UserData [set of any scalar types]
+ WindowType
+ /WindowState [string]
+ /UserData [set of any scalar types]
+ /Visible [boolean]
+
+ structure of configuration:
+
+ org.openoffice.Office.Views [package]
+ /Dialogs [set]
+ /Dialog_FileOpen [DialogType]
+ /Dialog_ImportGraphics [DialogType]
+ ...
+ /Dialog_<YourName> [DialogType]
+
+ /TabDialogs [set]
+ /TabDialog_001 [TabDialogType]
+ /TabDialog_Blubber [TabDialogType]
+ ...
+ /TabDialog_<YourName> [TabDialogType]
+
+ /TabPages [set]
+ /TabPage_XXX [TabPageType]
+ /TabPage_Date [TabPageType]
+ ...
+ /TabPage_<YourName> [TabPageType]
+
+ /Windows [set]
+ /Window_User [WindowType]
+ /Window_Options [WindowType]
+ ...
+ /Window_<YourName> [WindowType]
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtViewOptions final
+{
+
+ // public methods
+
+ public:
+
+ // constructor / destructor
+
+ /*-****************************************************************************************************
+ @short standard constructor and destructor
+ @descr This will de-/initialize an instance with default values.
+ You must give us the basic type of your view and a name which specify right entry
+ in dynamical configuration list. If entry not exist, we create a new one!
+
+ @seealso enum EViewType
+
+ @param "eType" specify type of your view and is used to use right data container!
+ @param "sViewName" specify the name of your view and is the key name in data list too.
+ @onerror An assertion is thrown in debug version. Otherwise we do nothing!
+ *//*-*****************************************************************************************************/
+
+ SvtViewOptions( EViewType eType, OUString sViewName );
+
+ // interface
+
+ /*-****************************************************************************************************
+ @short use it to get information about existing entries in configuration
+ @descr The methods to set/get the position or size will create a new entry automatically if
+ it not already exist and work with default values!
+ If this a problem for you - you MUST call these method before and
+ you must make up your own mind about that.
+ @onerror No error should occur.
+ *//*-*****************************************************************************************************/
+
+ bool Exists() const;
+
+ /*-****************************************************************************************************
+ @short use it to delete an entry of dynamic view set
+ @descr You can use this method to delete an existing node in configuration.
+ But if you call a Set- or Get- method again on this instance
+ the item is created again! If you do nothing after this call
+ your view will die relay in configuration...
+
+ @seealso method Exist()
+ *//*-*****************************************************************************************************/
+
+ void Delete();
+
+ /*-****************************************************************************************************
+ @short use it to set/get the window state of your view
+ @descr These value describe position/size and some other states of a window.
+ Use it with right vcl methods directly. Normally it's not necessary to
+ parse given string!
+
+ @seealso vcl methods
+ *//*-*****************************************************************************************************/
+
+ OUString GetWindowState( ) const;
+ void SetWindowState( const OUString& sState );
+
+ /*-****************************************************************************************************
+ @short use it to set/get the page number which was the last active one
+ @descr It's only supported for: - tab-dialogs
+ If you call it for other ones you will get an assertion in debug version.
+ In a product version we do nothing!
+ @onerror An assertion is thrown in debug version. Otherwise we do nothing!
+ *//*-*****************************************************************************************************/
+
+ OString GetPageID() const;
+ void SetPageID(std::string_view rID);
+
+ /*-****************************************************************************************************
+ @short use it to set/get the visual state of a window
+ @descr It's only supported for: - windows
+ If you call it for other ones you will get an assertion in debug version.
+ In a product version we do nothing!
+ @onerror An assertion is thrown in debug version. Otherwise we do nothing!
+ *//*-*****************************************************************************************************/
+
+ bool IsVisible ( ) const;
+ void SetVisible( bool bState );
+
+ /** Return true if the "Visible" property actually has a non-nil value
+
+ (IsVisible will somewhat arbitrarily return false if the property is
+ nil.)
+ */
+ bool HasVisible() const;
+
+ /*-****************************************************************************************************
+ @short use it to set/get the extended user data (consisting of a set of named scalar values)
+ @descr It's supported for ALL types!
+ Every view can handle its own user defined data set.
+ @onerror In the non-product version, an assertion is made. In a product version, errors are silently ignored.
+ *//*-*****************************************************************************************************/
+ css::uno::Sequence< css::beans::NamedValue > GetUserData( ) const;
+ void SetUserData( const css::uno::Sequence< css::beans::NamedValue >& lData );
+
+ /*-****************************************************************************************************
+ @short use it to set/get ONE special user data item directly
+ @descr Normally you can work on full user data list by using "Set/GetUserData()".
+ With this function you have an access on special list entries directly without any
+ @onerror In the non-product version, an assertion is made. In a product version, errors are silently ignored.
+ *//*-*****************************************************************************************************/
+
+ css::uno::Any GetUserItem( const OUString& sName ) const;
+ void SetUserItem( const OUString& sName ,
+ const css::uno::Any& aValue );
+
+ private:
+ enum State { STATE_NONE, STATE_FALSE, STATE_TRUE };
+
+ css::uno::Reference< css::uno::XInterface > impl_getSetNode( const OUString& sNode ,
+ bool bCreateIfMissing) const;
+ State GetVisible() const;
+
+ /// specify which list of views in configuration is used! This can't be a static value!!!
+ /// ... because we need this value to work with right static data container.
+ EViewType m_eViewType;
+ OUString m_sViewName;
+
+ OUString m_sListName;
+ css::uno::Reference< css::container::XNameAccess > m_xRoot;
+ css::uno::Reference< css::container::XNameAccess > m_xSet;
+}; // class SvtViewOptions
+
+#endif // INCLUDED_UNOTOOLS_VIEWOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/weakref.hxx b/include/unotools/weakref.hxx
new file mode 100644
index 000000000..104737404
--- /dev/null
+++ b/include/unotools/weakref.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*
+ * This file is part of LibreOffice published API.
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/weak.hxx>
+#include <rtl/ref.hxx>
+
+namespace cppu
+{
+class OWeakObject;
+}
+
+namespace unotools
+{
+/** The WeakReference<> holds a weak reference to an object.
+
+ That object must implement the css::uno::XWeak interface.
+
+ The WeakReference itself is *not* thread safe, just as
+ Reference itself isn't, but the implementation of the listeners etc.
+ behind it *is* thread-safe, so multiple threads can have their own
+ WeakReferences to the same XWeak object.
+
+ @tparam interface_type type of interface
+*/
+template <class interface_type>
+class SAL_WARN_UNUSED WeakReference : public com::sun::star::uno::WeakReferenceHelper
+{
+public:
+ /** Default ctor. Creates an empty weak reference.
+ */
+ WeakReference()
+ : WeakReferenceHelper()
+ {
+ }
+
+ /** Copy ctor. Initialize this reference with a hard reference.
+
+ @param rRef another hard ref
+ */
+ WeakReference(const rtl::Reference<interface_type>& rRef)
+ : WeakReferenceHelper(rRef)
+ {
+ }
+
+ /** Copy ctor. Initialize this reference with a hard reference.
+
+ @param rRef another hard ref
+ */
+ WeakReference(interface_type& rRef)
+ : WeakReferenceHelper(&rRef)
+ {
+ }
+
+ /** Copy ctor. Initialize this reference with a hard reference.
+
+ @param rRef another hard ref
+ */
+ WeakReference(interface_type* pRef)
+ : WeakReferenceHelper(
+ css::uno::Reference<css::uno::XWeak>(static_cast<cppu::OWeakObject*>(pRef)))
+ {
+ }
+
+ /** Releases this reference and takes over hard reference xInt.
+ If the implementation behind xInt does not support XWeak
+ or XInt is null, then this reference is null.
+
+ @param xInt another hard reference
+ */
+ WeakReference& operator=(const rtl::Reference<interface_type>& xInt)
+ {
+ WeakReferenceHelper::operator=(xInt);
+ return *this;
+ }
+
+ WeakReference& operator=(rtl::Reference<interface_type>&& xInt)
+ {
+ WeakReferenceHelper::operator=(std::move(xInt));
+ return *this;
+ }
+
+ WeakReference& operator=(interface_type* pInt)
+ {
+ WeakReferenceHelper::operator=(
+ css::uno::Reference<css::uno::XWeak>(static_cast<::cppu::OWeakObject*>(pInt)));
+ return *this;
+ }
+
+ /** Gets a hard reference to the object.
+
+ @return hard reference or null, if the weakly referenced interface has gone
+ */
+ rtl::Reference<interface_type> SAL_CALL get() const
+ {
+ css::uno::Reference<css::uno::XInterface> xInterface = WeakReferenceHelper::get();
+ return dynamic_cast<interface_type*>(xInterface.get());
+ }
+
+ /** Gets a hard reference to the object.
+
+ @return hard reference or null, if the weakly referenced interface has gone
+ */
+ operator ::rtl::Reference<interface_type>() const { return get(); }
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/wincodepage.hxx b/include/unotools/wincodepage.hxx
new file mode 100644
index 000000000..4ec808e5c
--- /dev/null
+++ b/include/unotools/wincodepage.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_UNOTOOLS_WINCODEPAGE_HXX
+#define INCLUDED_UNOTOOLS_WINCODEPAGE_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+
+/** Map from an ISO-639 language code (and optionally ISO-3166 country/region code)
+to a text encoding of corresponding Windows ANSI or OEM codepage.
+
+@param sLanguage
+Any language-country string. Must not be null.
+
+@param bOEM
+If true, OEM codepage is returned, otherwise ANSI.
+
+@return
+The corresponding rtl_TextEncoding value.
+If no mapping is found, RTL_TEXTENCODING_IBM_850 is returned when bOEM is true,
+RTL_TEXTENCODING_MS_1252 otherwise.
+*/
+UNOTOOLS_DLLPUBLIC rtl_TextEncoding utl_getWinTextEncodingFromLangStr(
+ const OUString& sLanguage, bool bOEM = false);
+
+#endif // INCLUDED_UNOTOOLS_WINCODEPAGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbaaccesshelper.hxx b/include/vbahelper/vbaaccesshelper.hxx
new file mode 100644
index 000000000..36f24d3a4
--- /dev/null
+++ b/include/vbahelper/vbaaccesshelper.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBAACCESSHELPER_HXX
+#define INCLUDED_VBAHELPER_VBAACCESSHELPER_HXX
+
+#include <memory>
+
+#include <basic/basmgr.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <osl/diagnose.h>
+//#define VBAHELPER_DLLIMPLEMENTATION
+#include <rtl/ustring.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+
+namespace ooo::vba
+{
+
+ inline css::uno::Reference< css::lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell const * pShell )
+ {
+ css::uno::Any aUnoVar;
+ if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) )
+ throw css::lang::IllegalArgumentException();
+ css::uno::Reference< css::lang::XMultiServiceFactory > xVBAFactory( aUnoVar, css::uno::UNO_QUERY_THROW );
+ return xVBAFactory;
+ }
+
+ /// @throws css::uno::Exception
+ inline css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell const * pShell, const char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs )
+ {
+ OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" );
+ OUString sVarName( OUString::createFromAscii( _pAsciiName ) );
+ css::uno::Reference< css::uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs );
+ return xIf;
+ }
+
+
+ inline bool isAlienDoc( SfxObjectShell const & rDocShell, const char* pMimeType )
+ {
+ bool bRes( false );
+ const SfxMedium *pMedium = rDocShell.GetMedium();
+ std::shared_ptr<const SfxFilter> pFilt = pMedium ? pMedium->GetFilter() : nullptr;
+ if ( pFilt && pFilt->IsAlienFormat() )
+ bRes = pFilt->GetMimeType().equalsAscii( pMimeType );
+ return bRes;
+ }
+ inline bool isAlienExcelDoc( SfxObjectShell const & rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); }
+ //VBAHELPER_DLLPRIVATE inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
+ // word seems to return an erroneous mime type :-/ "application/msword" not consistent with the excel one
+ inline bool isAlienWordDoc( SfxObjectShell const & rDocShell ) { return isAlienDoc( rDocShell, "application/msword" ); }
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbaapplicationbase.hxx b/include/vbahelper/vbaapplicationbase.hxx
new file mode 100644
index 000000000..24bac8204
--- /dev/null
+++ b/include/vbahelper/vbaapplicationbase.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBAAPPLICATIONBASE_HXX
+#define INCLUDED_VBAHELPER_VBAAPPLICATIONBASE_HXX
+
+#include <exception>
+#include <memory>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <ooo/vba/XApplicationBase.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
+
+namespace com::sun::star {
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+typedef InheritedHelperInterfaceWeakImpl< ov::XApplicationBase > ApplicationBase_BASE;
+
+struct VbaApplicationBase_Impl;
+
+class VBAHELPER_DLLPUBLIC VbaApplicationBase : public ApplicationBase_BASE
+{
+ std::unique_ptr<VbaApplicationBase_Impl> m_pImpl;
+
+protected:
+ VbaApplicationBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ virtual ~VbaApplicationBase() override;
+
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() = 0;
+public:
+ // XHelperInterface ( parent is itself )
+ virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) override { return this; }
+
+ virtual sal_Bool SAL_CALL getScreenUpdating() override;
+ virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) override;
+ virtual sal_Bool SAL_CALL getDisplayStatusBar() override;
+ virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) override;
+ virtual sal_Bool SAL_CALL getInteractive() override;
+ virtual void SAL_CALL setInteractive( sal_Bool bInteractive ) override;
+ virtual sal_Bool SAL_CALL getVisible() override;
+ virtual void SAL_CALL setVisible( sal_Bool bVisible ) override;
+ virtual OUString SAL_CALL getCaption() override;
+ virtual void SAL_CALL setCaption( const OUString& sCaption ) override;
+ virtual void SAL_CALL OnKey( const OUString& Key, const css::uno::Any& Procedure ) override;
+ virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) override;
+ virtual OUString SAL_CALL getVersion() override;
+ virtual css::uno::Any SAL_CALL getVBE() override;
+
+ virtual css::uno::Any SAL_CALL Run( const OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) override;
+ virtual void SAL_CALL OnTime( const css::uno::Any& aEarliestTime, const OUString& aFunction, const css::uno::Any& aLatestTime, const css::uno::Any& aSchedule ) override;
+ virtual float SAL_CALL CentimetersToPoints( float Centimeters ) override;
+ virtual void SAL_CALL Undo() override;
+ virtual void SAL_CALL Quit() override;
+
+ // XHelperInterface
+ virtual OUString getServiceImplName() override;
+ virtual css::uno::Sequence<OUString> getServiceNames() override;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbacollectionimpl.hxx b/include/vbahelper/vbacollectionimpl.hxx
new file mode 100644
index 000000000..7b3af3e55
--- /dev/null
+++ b/include/vbahelper/vbacollectionimpl.hxx
@@ -0,0 +1,354 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VBAHELPER_VBACOLLECTIONIMPL_HXX
+#define INCLUDED_VBAHELPER_VBACOLLECTIONIMPL_HXX
+
+#include <exception>
+#include <vector>
+
+#include <com/sun/star/container/NoSuchElementException.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/WrappedTargetException.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/uno/TypeClass.hpp>
+#include <cppu/unotype.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <ooo/vba/XCollection.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
+
+namespace com::sun::star {
+ namespace container { class XEnumerationAccess; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class XHelperInterface;
+}
+
+typedef ::cppu::WeakImplHelper< css::container::XEnumeration > EnumerationHelper_BASE;
+
+
+/** A wrapper that holds a com.sun.star.container.XIndexAccess and provides a
+ com.sun.star.container.XEnumeration.
+
+ Can be used to provide an enumeration from an index container that contains
+ completely constructed/initialized VBA implementation objects. CANNOT be
+ used to provide an enumeration from an index container with other objects
+ (e.g. UNO objects) where construction of the VBA objects is needed first.
+ */
+class VBAHELPER_DLLPUBLIC SimpleIndexAccessToEnumeration final : public EnumerationHelper_BASE
+{
+public:
+ /// @throws css::uno::RuntimeException
+ explicit SimpleIndexAccessToEnumeration(
+ const css::uno::Reference< css::container::XIndexAccess >& rxIndexAccess ) :
+ mxIndexAccess( rxIndexAccess ), mnIndex( 0 ) {}
+
+ virtual sal_Bool SAL_CALL hasMoreElements() override
+ {
+ return mnIndex < mxIndexAccess->getCount();
+ }
+
+ virtual css::uno::Any SAL_CALL nextElement() override
+ {
+ if( !hasMoreElements() )
+ throw css::container::NoSuchElementException();
+ return mxIndexAccess->getByIndex( mnIndex++ );
+ }
+
+private:
+ css::uno::Reference< css::container::XIndexAccess > mxIndexAccess;
+ sal_Int32 mnIndex;
+};
+
+
+/** A wrapper that holds a com.sun.star.container.XEnumeration or a
+ com.sun.star.container.XIndexAccess and provides an enumeration of VBA objects.
+
+ The method createCollectionObject() needs to be implemented by the derived
+ class. This class can be used to convert an enumeration or an index container
+ containing UNO objects to an enumeration providing the related VBA objects.
+ */
+class VBAHELPER_DLLPUBLIC SimpleEnumerationBase : public EnumerationHelper_BASE
+{
+public:
+ /// @throws css::uno::RuntimeException
+ explicit SimpleEnumerationBase(
+ const css::uno::Reference< css::container::XIndexAccess >& rxIndexAccess ) :
+ mxEnumeration( new SimpleIndexAccessToEnumeration( rxIndexAccess ) ) {}
+
+ virtual sal_Bool SAL_CALL hasMoreElements() override
+ {
+ return mxEnumeration->hasMoreElements();
+ }
+
+ virtual css::uno::Any SAL_CALL nextElement() override
+ {
+ return createCollectionObject( mxEnumeration->nextElement() );
+ }
+
+ /** Derived classes implement creation of a VBA implementation object from
+ the passed container element. */
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& rSource ) = 0;
+
+private:
+ css::uno::Reference< css::container::XEnumeration > mxEnumeration;
+};
+
+
+// deprecated, use SimpleEnumerationBase instead!
+class VBAHELPER_DLLPUBLIC EnumerationHelperImpl : public EnumerationHelper_BASE
+{
+protected:
+ css::uno::WeakReference< ov::XHelperInterface > m_xParent;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::container::XEnumeration > m_xEnumeration;
+public:
+ /// @throws css::uno::RuntimeException
+ EnumerationHelperImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration ) { }
+ virtual sal_Bool SAL_CALL hasMoreElements( ) override { return m_xEnumeration->hasMoreElements(); }
+};
+
+// a wrapper class for a providing a XIndexAccess, XNameAccess, XEnumerationAccess impl based on providing a vector of interfaces
+// only requirement is the object needs to implement XName
+
+
+template< typename OneIfc >
+class XNamedObjectCollectionHelper final : public ::cppu::WeakImplHelper< css::container::XNameAccess,
+ css::container::XIndexAccess,
+ css::container::XEnumerationAccess >
+{
+public:
+typedef std::vector< css::uno::Reference< OneIfc > > XNamedVec;
+private:
+
+ class XNamedEnumerationHelper final : public EnumerationHelper_BASE
+ {
+ XNamedVec mXNamedVec;
+ typename XNamedVec::iterator mIt;
+ public:
+ XNamedEnumerationHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), mIt( mXNamedVec.begin() ) {}
+
+ virtual sal_Bool SAL_CALL hasMoreElements( ) override
+ {
+ return ( mIt != mXNamedVec.end() );
+ }
+
+ virtual css::uno::Any SAL_CALL nextElement( ) override
+ {
+ if ( hasMoreElements() )
+ return css::uno::Any( *mIt++ );
+ throw css::container::NoSuchElementException();
+ }
+ };
+
+ XNamedVec mXNamedVec;
+ typename XNamedVec::iterator cachePos;
+public:
+ XNamedObjectCollectionHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), cachePos(mXNamedVec.begin()) {}
+ // XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType( ) override { return cppu::UnoType< OneIfc >::get(); }
+ virtual sal_Bool SAL_CALL hasElements( ) override { return ( mXNamedVec.size() > 0 ); }
+ // XNameAccess
+ virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override
+ {
+ if ( !hasByName(aName) )
+ throw css::container::NoSuchElementException();
+ return css::uno::Any( *cachePos );
+ }
+ virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override
+ {
+ css::uno::Sequence< OUString > sNames( mXNamedVec.size() );
+ OUString* pString = sNames.getArray();
+ typename XNamedVec::iterator it = mXNamedVec.begin();
+ typename XNamedVec::iterator it_end = mXNamedVec.end();
+
+ for ( ; it != it_end; ++it, ++pString )
+ {
+ css::uno::Reference< css::container::XNamed > xName( *it, css::uno::UNO_QUERY_THROW );
+ *pString = xName->getName();
+ }
+ return sNames;
+ }
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override
+ {
+ cachePos = mXNamedVec.begin();
+ typename XNamedVec::iterator it_end = mXNamedVec.end();
+ for ( ; cachePos != it_end; ++cachePos )
+ {
+ css::uno::Reference< css::container::XNamed > xName( *cachePos, css::uno::UNO_QUERY_THROW );
+ if ( aName == xName->getName() )
+ break;
+ }
+ return ( cachePos != it_end );
+ }
+
+ // XElementAccess
+ virtual ::sal_Int32 SAL_CALL getCount( ) override { return mXNamedVec.size(); }
+ virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override
+ {
+ if ( Index < 0 || Index >= getCount() )
+ throw css::lang::IndexOutOfBoundsException();
+
+ return css::uno::Any( mXNamedVec[ Index ] );
+
+ }
+ // XEnumerationAccess
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override
+ {
+ return new XNamedEnumerationHelper( mXNamedVec );
+ }
+};
+
+// including a HelperInterface implementation
+template< typename... Ifc >
+class SAL_DLLPUBLIC_RTTI ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc... >
+{
+typedef InheritedHelperInterfaceImpl< Ifc... > BaseColBase;
+protected:
+ css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
+ css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
+ bool mbIgnoreCase;
+
+ /// @throws css::uno::RuntimeException
+ virtual css::uno::Any getItemByStringIndex( const OUString& sIndex )
+ {
+ if ( !m_xNameAccess.is() )
+ throw css::uno::RuntimeException("ScVbaCollectionBase string index access not supported by this object" );
+
+ if( mbIgnoreCase )
+ {
+ const css::uno::Sequence< OUString > sElementNames = m_xNameAccess->getElementNames();
+ for( const OUString& rName : sElementNames )
+ {
+ if( rName.equalsIgnoreAsciiCase( sIndex ) )
+ {
+ return createCollectionObject( m_xNameAccess->getByName( rName ) );
+ }
+ }
+ }
+ return createCollectionObject( m_xNameAccess->getByName( sIndex ) );
+ }
+
+ /// @throws css::uno::RuntimeException
+ /// @throws css::lang::IndexOutOfBoundsException
+ virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex )
+ {
+ if ( !m_xIndexAccess.is() )
+ throw css::uno::RuntimeException("ScVbaCollectionBase numeric index access not supported by this object" );
+ if ( nIndex <= 0 )
+ {
+ throw css::lang::IndexOutOfBoundsException(
+ "index is 0 or negative" );
+ }
+ // need to adjust for vba index ( for which first element is 1 )
+ return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) );
+ }
+
+ void UpdateCollectionIndex( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess )
+ {
+ css::uno::Reference< css::container::XNameAccess > xNameAccess( xIndexAccess, css::uno::UNO_QUERY_THROW );
+ m_xIndexAccess = xIndexAccess;
+ m_xNameAccess = xNameAccess;
+ }
+
+public:
+ ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, bool bIgnoreCase = false ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ), mbIgnoreCase( bIgnoreCase ) { m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
+
+ //XCollection
+ virtual ::sal_Int32 SAL_CALL getCount() override
+ {
+ return m_xIndexAccess->getCount();
+ }
+
+ virtual css::uno::Any SAL_CALL Item(const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/) override
+ {
+ if ( Index1.getValueTypeClass() != css::uno::TypeClass_STRING )
+ {
+ sal_Int32 nIndex = 0;
+
+ if ( !( Index1 >>= nIndex ) )
+ {
+ throw css::lang::IndexOutOfBoundsException( "Couldn't convert index to Int32" );
+ }
+ return getItemByIntIndex( nIndex );
+ }
+ OUString aStringSheet;
+
+ Index1 >>= aStringSheet;
+ return getItemByStringIndex( aStringSheet );
+ }
+
+ // XDefaultMethod
+ OUString SAL_CALL getDefaultMethodName( ) override
+ {
+ return "Item";
+ }
+ // XEnumerationAccess
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override = 0;
+
+ // XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType() override = 0;
+ // XElementAccess
+ virtual sal_Bool SAL_CALL hasElements() override
+ {
+ return ( m_xIndexAccess->getCount() > 0 );
+ }
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0;
+
+};
+
+typedef ScVbaCollectionBase< ::cppu::WeakImplHelper<ov::XCollection> > CollImplBase;
+// compatible with the old collections ( pre XHelperInterface base class ) ( some internal objects still use this )
+class VBAHELPER_DLLPUBLIC ScVbaCollectionBaseImpl : public CollImplBase
+{
+public:
+ /// @throws css::uno::RuntimeException
+ ScVbaCollectionBaseImpl( const css::uno::Reference< ov::XHelperInterface > & xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : CollImplBase( xParent, xContext, xIndexAccess){}
+
+};
+
+template < typename... Ifc > // where Ifc must implement XCollectionTest
+class SAL_DLLPUBLIC_RTTI CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper< Ifc... > >
+{
+typedef ScVbaCollectionBase< ::cppu::WeakImplHelper< Ifc... > > ImplBase;
+
+public:
+ /// @throws css::uno::RuntimeException
+ CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, bool bIgnoreCase = false ) : ImplBase( xParent, xContext, xIndexAccess, bIgnoreCase ) {}
+};
+
+
+#endif //SC_VBA_COLLECTION_IMPL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbadialogbase.hxx b/include/vbahelper/vbadialogbase.hxx
new file mode 100644
index 000000000..3125e5da2
--- /dev/null
+++ b/include/vbahelper/vbadialogbase.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBADIALOGBASE_HXX
+#define INCLUDED_VBAHELPER_VBADIALOGBASE_HXX
+
+#include <exception>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <ooo/vba/XDialogBase.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
+
+namespace com::sun::star {
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class XDialogBase;
+ class XHelperInterface;
+}
+
+typedef InheritedHelperInterfaceWeakImpl< ov::XDialogBase > VbaDialogBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaDialogBase : public VbaDialogBase_BASE
+{
+protected:
+ sal_Int32 mnIndex;
+ css::uno::Reference< css::frame::XModel > m_xModel;
+public:
+ VbaDialogBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nIndex ):VbaDialogBase_BASE( xParent, xContext ), mnIndex( nIndex ), m_xModel( xModel ) {}
+
+ // Methods
+ virtual void SAL_CALL Show() override;
+ virtual OUString mapIndexToName( sal_Int32 nIndex ) = 0;
+};
+
+#endif // INCLUDED_VBAHELPER_VBADIALOGBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbadialogsbase.hxx b/include/vbahelper/vbadialogsbase.hxx
new file mode 100644
index 000000000..9b04b40cf
--- /dev/null
+++ b/include/vbahelper/vbadialogsbase.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBADIALOGSBASE_HXX
+#define INCLUDED_VBAHELPER_VBADIALOGSBASE_HXX
+
+#include <exception>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <ooo/vba/XDialogsBase.hpp>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
+
+namespace com::sun::star {
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class XDialogsBase;
+ class XHelperInterface;
+}
+
+typedef InheritedHelperInterfaceWeakImpl< ov::XDialogsBase > VbaDialogsBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaDialogsBase : public VbaDialogsBase_BASE
+{
+protected:
+ css::uno::Reference< css::frame::XModel > m_xModel;
+public:
+ VbaDialogsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel ): VbaDialogsBase_BASE( xParent, xContext ), m_xModel( xModel ) {}
+
+ // XCollection
+ virtual ::sal_Int32 SAL_CALL getCount() override;
+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) override;
+};
+
+#endif // INCLUDED_VBAHELPER_VBADIALOGSBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbadllapi.h b/include/vbahelper/vbadllapi.h
new file mode 100644
index 000000000..c70630266
--- /dev/null
+++ b/include/vbahelper/vbadllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VBAHELPER_VBADLLAPI_H
+#define INCLUDED_VBAHELPER_VBADLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(VBAHELPER_DLLIMPLEMENTATION)
+#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define VBAHELPER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_VBAHELPER_VBADLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbadocumentbase.hxx b/include/vbahelper/vbadocumentbase.hxx
new file mode 100644
index 000000000..60a0bbed9
--- /dev/null
+++ b/include/vbahelper/vbadocumentbase.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBADOCUMENTBASE_HXX
+#define INCLUDED_VBAHELPER_VBADOCUMENTBASE_HXX
+
+#include <exception>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <ooo/vba/XDocumentBase.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
+
+namespace com::sun::star {
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class XDocumentBase;
+ class XHelperInterface;
+}
+
+typedef InheritedHelperInterfaceWeakImpl< ooo::vba::XDocumentBase > VbaDocumentBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaDocumentBase : public VbaDocumentBase_BASE
+{
+protected:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::uno::XInterface > mxVBProject;
+protected:
+ const css::uno::Reference< css::frame::XModel >& getModel() const { return mxModel; }
+public:
+ VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ css::uno::Reference< css::frame::XModel > const & xModel );
+ VbaDocumentBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
+
+ // Attributes
+ virtual OUString SAL_CALL getName() override;
+ virtual OUString SAL_CALL getPath() override;
+ virtual OUString SAL_CALL getFullName() override;
+ virtual sal_Bool SAL_CALL getSaved() override;
+ virtual void SAL_CALL setSaved( sal_Bool bSave ) override;
+ virtual css::uno::Any SAL_CALL getVBProject() override;
+
+ // Methods
+ virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges,
+ const css::uno::Any &aFileName,
+ const css::uno::Any &bRouteWorkbook ) override;
+ /// @throws css::uno::RuntimeException
+ virtual void SAL_CALL Protect( const css::uno::Any &aPassword );
+ virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) override;
+ virtual void SAL_CALL Save() override;
+ virtual void SAL_CALL Activate() override;
+
+ // XHelperInterface
+ virtual OUString getServiceImplName() override;
+ virtual css::uno::Sequence<OUString> getServiceNames() override;
+
+ static OUString getNameFromModel( const css::uno::Reference< css::frame::XModel >& xModel );
+};
+
+#endif // INCLUDED_VBAHELPER_VBADOCUMENTBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbadocumentsbase.hxx b/include/vbahelper/vbadocumentsbase.hxx
new file mode 100644
index 000000000..3f8acd3e7
--- /dev/null
+++ b/include/vbahelper/vbadocumentsbase.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBADOCUMENTSBASE_HXX
+#define INCLUDED_VBAHELPER_VBADOCUMENTSBASE_HXX
+
+#include <exception>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <ooo/vba/XDocumentsBase.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+
+namespace com::sun::star {
+ namespace beans { struct PropertyValue; }
+ namespace container { class XEnumeration; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class XDocumentsBase;
+ class XHelperInterface;
+}
+
+typedef CollTestImplHelper< ooo::vba::XDocumentsBase > VbaDocumentsBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaDocumentsBase : public VbaDocumentsBase_BASE
+{
+public:
+ enum DOCUMENT_TYPE
+ {
+ WORD_DOCUMENT = 1,
+ EXCEL_DOCUMENT
+ };
+
+private:
+ DOCUMENT_TYPE meDocType;
+
+public:
+ /// @throws css::uno::RuntimeException
+ VbaDocumentsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, DOCUMENT_TYPE eDocType );
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() override = 0;
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override = 0;
+
+ // VbaDocumentsBase_BASE
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) override = 0;
+
+protected:
+ /// @throws css::uno::RuntimeException
+ css::uno::Any createDocument();
+ /// @throws css::uno::RuntimeException
+ css::uno::Any openDocument( const OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps );
+};
+
+#endif /* SC_ INCLUDED_VBAHELPER_VBADOCUMENTSBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbaeventshelperbase.hxx b/include/vbahelper/vbaeventshelperbase.hxx
new file mode 100644
index 000000000..0126db442
--- /dev/null
+++ b/include/vbahelper/vbaeventshelperbase.hxx
@@ -0,0 +1,228 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VBAHELPER_VBAEVENTSHELPERBASE_HXX
+#define INCLUDED_VBAHELPER_VBAEVENTSHELPERBASE_HXX
+
+#include <deque>
+#include <map>
+#include <unordered_map>
+
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+
+namespace com::sun::star {
+ namespace document { struct EventObject; }
+ namespace frame { class XModel; }
+ namespace script::vba { class XVBAModuleInfo; }
+ namespace uno { class XComponentContext; }
+ namespace util { struct ChangesEvent; }
+}
+
+class SfxObjectShell;
+
+typedef ::cppu::WeakImplHelper<
+ css::script::vba::XVBAEventProcessor,
+ css::document::XEventListener,
+ css::util::XChangesListener,
+ css::lang::XServiceInfo > VbaEventsHelperBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaEventsHelperBase : public VbaEventsHelperBase_BASE
+{
+public:
+ VbaEventsHelperBase(
+ const css::uno::Sequence< css::uno::Any >& rArgs );
+ virtual ~VbaEventsHelperBase() override;
+
+ // script::vba::XVBAEventProcessor
+ virtual sal_Bool SAL_CALL hasVbaEventHandler( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) override;
+ virtual sal_Bool SAL_CALL processVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) override;
+
+ // document::XEventListener
+ virtual void SAL_CALL notifyEvent( const css::document::EventObject& rEvent ) override;
+
+ // util::XChangesListener
+ virtual void SAL_CALL changesOccurred( const css::util::ChangesEvent& rEvent ) override;
+
+ // lang::XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& rEvent ) override;
+
+ sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
+
+ // little helpers ---------------------------------------------------------
+
+ /** Helper to execute event handlers without throwing any exceptions. */
+ void processVbaEventNoThrow( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs );
+
+ /** @throws css::lang::IllegalArgumentException if the passed sequence does not contain a value at the specified index. */
+ static void checkArgument( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex )
+ { if( (nIndex < 0) || (nIndex >= rArgs.getLength()) ) throw css::lang::IllegalArgumentException(); }
+
+ /** @throws css::lang::IllegalArgumentException if the passed sequence does not contain a value of a specific at the specified index. */
+ template< typename Type >
+ static void checkArgumentType( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex )
+ { checkArgument( rArgs, nIndex ); if( !rArgs[ nIndex ].has< Type >() ) throw css::lang::IllegalArgumentException(); }
+
+protected:
+
+
+ struct EventHandlerInfo
+ {
+ sal_Int32 mnEventId;
+ sal_Int32 mnModuleType;
+ OUString maMacroName;
+ sal_Int32 mnCancelIndex;
+ css::uno::Any maUserData;
+ };
+
+ /** Registers a supported event handler.
+
+ @param nEventId Event identifier from com.sun.star.script.vba.VBAEventId.
+ @param nModuleType Type of the module containing the event handler.
+ @param pcMacroName Name of the associated VBA event handler macro.
+ @param nCancelIndex 0-based index of Cancel parameter, or -1.
+ @param rUserData User data for free usage in derived implementations. */
+ void registerEventHandler(
+ sal_Int32 nEventId,
+ sal_Int32 nModuleType,
+ const char* pcMacroName,
+ sal_Int32 nCancelIndex = -1,
+ const css::uno::Any& rUserData = css::uno::Any() );
+
+
+ struct EventQueueEntry
+ {
+ sal_Int32 mnEventId;
+ css::uno::Sequence< css::uno::Any > maArgs;
+ /*implicit*/ EventQueueEntry( sal_Int32 nEventId ) : mnEventId( nEventId ) {}
+ EventQueueEntry( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) : mnEventId( nEventId ), maArgs( rArgs ) {}
+ };
+ typedef ::std::deque< EventQueueEntry > EventQueue;
+
+ /** Derived classes do additional preparations and return whether the
+ event handler has to be called.
+
+ @throws css::uno::RuntimeException
+ */
+ virtual bool implPrepareEvent(
+ EventQueue& rEventQueue,
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) = 0;
+
+ /** Derived classes have to return the argument list for the specified VBA event handler.
+
+ @throws css::lang::IllegalArgumentException
+ @throws css::uno::RuntimeException
+ */
+ virtual css::uno::Sequence< css::uno::Any > implBuildArgumentList(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) = 0;
+
+ /** Derived classes may do additional postprocessing. Called even if the
+ event handler does not exist, or if an error occurred during execution.
+
+ @throws css::uno::RuntimeException
+ */
+ virtual void implPostProcessEvent(
+ EventQueue& rEventQueue,
+ const EventHandlerInfo& rInfo,
+ bool bCancel ) = 0;
+
+ /** Derived classes have to return the name of the Basic document module.
+
+ @throws css::lang::IllegalArgumentException
+ @throws css::uno::RuntimeException
+ */
+ virtual OUString implGetDocumentModuleName(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) const = 0;
+
+private:
+ typedef ::std::map< sal_Int32, OUString > ModulePathMap;
+
+ /** Starts listening at the document model. */
+ void startListening();
+ /** Stops listening at the document model. */
+ void stopListening();
+
+ /** Returns the event handler info struct for the specified event, or throws.
+
+
+ @throws css::lang::IllegalArgumentException
+ */
+ const EventHandlerInfo& getEventHandlerInfo( sal_Int32 nEventId ) const;
+
+ /** Searches the event handler in the document and returns its full script path.
+
+
+ @throws css::lang::IllegalArgumentException
+ @throws css::uno::RuntimeException
+ */
+ OUString getEventHandlerPath(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs );
+
+ /** On first call, accesses the Basic library containing the VBA source code.
+
+ @throws css::uno::RuntimeException
+ */
+ void ensureVBALibrary();
+
+ /** Returns the type of the Basic module with the specified name.
+
+ @throws css::uno::RuntimeException
+ */
+ sal_Int32 getModuleType( const OUString& rModuleName );
+
+ /** Updates the map containing paths to event handlers for a Basic module.
+
+ @throws css::uno::RuntimeException
+ */
+ ModulePathMap& updateModulePathMap( const OUString& rModuleName );
+
+protected:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ SfxObjectShell* mpShell;
+
+private:
+ typedef std::map< sal_Int32, EventHandlerInfo > EventHandlerInfoMap;
+ typedef std::unordered_map< OUString, ModulePathMap > EventHandlerPathMap;
+
+ EventHandlerInfoMap maEventInfos;
+ EventHandlerPathMap maEventPaths;
+ css::uno::Reference< css::script::vba::XVBAModuleInfo > mxModuleInfos;
+ OUString maLibraryName;
+ bool mbDisposed;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbafontbase.hxx b/include/vbahelper/vbafontbase.hxx
new file mode 100644
index 000000000..732a67bc1
--- /dev/null
+++ b/include/vbahelper/vbafontbase.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBAFONTBASE_HXX
+#define INCLUDED_VBAHELPER_VBAFONTBASE_HXX
+
+#include <exception>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <ooo/vba/XFontBase.hpp>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
+
+namespace com::sun::star {
+ namespace beans { class XPropertySet; }
+ namespace container { class XIndexAccess; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class XHelperInterface;
+}
+
+typedef InheritedHelperInterfaceWeakImpl< ov::XFontBase > VbaFontBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaFontBase : public VbaFontBase_BASE
+{
+protected:
+ css::uno::Reference< css::beans::XPropertySet > mxFont;
+ css::uno::Reference< css::container::XIndexAccess > mxPalette;
+ bool mbFormControl;
+
+public:
+ // use local constants there is no need to expose these constants
+ // externally. Looking at the Format->Character dialog it seem that
+ // these may in fact even be calculated. Leave hardcoded for now
+ // #FIXME #TBD investigate the code for dialog mentioned above
+
+ // The font baseline is not specified.
+ static const short NORMAL = 0;
+
+ // specifies a superscripted.
+ static const short SUPERSCRIPT = 33;
+
+ // specifies a subscripted.
+ static const short SUBSCRIPT = -33;
+
+ // specifies a height of superscripted font
+ static const sal_Int8 SUPERSCRIPTHEIGHT = 58;
+
+ // specifies a height of subscripted font
+ static const sal_Int8 SUBSCRIPTHEIGHT = 58;
+
+ // specifies a height of normal font
+ static const short NORMALHEIGHT = 100;
+
+ /// @throws css::uno::RuntimeException
+ VbaFontBase(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::container::XIndexAccess >& xPalette,
+ const css::uno::Reference< css::beans::XPropertySet >& xPropertySet,
+ bool bFormControl = false );
+ virtual ~VbaFontBase() override;// {}
+
+ // Attributes
+ virtual css::uno::Any SAL_CALL getSize() override;
+ virtual void SAL_CALL setSize( const css::uno::Any& _size ) override;
+ virtual css::uno::Any SAL_CALL getColorIndex() override;
+ virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) override;
+ virtual css::uno::Any SAL_CALL getBold() override;
+ virtual void SAL_CALL setBold( const css::uno::Any& _bold ) override;
+ virtual css::uno::Any SAL_CALL getUnderline() override = 0;
+ virtual void SAL_CALL setUnderline( const css::uno::Any& _underline ) override = 0;
+ virtual css::uno::Any SAL_CALL getStrikethrough() override;
+ virtual void SAL_CALL setStrikethrough( const css::uno::Any& _strikethrough ) override;
+ virtual css::uno::Any SAL_CALL getShadow() override;
+ virtual void SAL_CALL setShadow( const css::uno::Any& _shadow ) override;
+ virtual css::uno::Any SAL_CALL getItalic() override;
+ virtual void SAL_CALL setItalic( const css::uno::Any& _italic ) override;
+ virtual css::uno::Any SAL_CALL getSubscript() override;
+ virtual void SAL_CALL setSubscript( const css::uno::Any& _subscript ) override;
+ virtual css::uno::Any SAL_CALL getSuperscript() override;
+ virtual void SAL_CALL setSuperscript( const css::uno::Any& _superscript ) override;
+ virtual css::uno::Any SAL_CALL getName() override;
+ virtual void SAL_CALL setName( const css::uno::Any& _name ) override;
+ virtual css::uno::Any SAL_CALL getColor() override ;
+ virtual void SAL_CALL setColor( const css::uno::Any& _color ) override ;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbaglobalbase.hxx b/include/vbahelper/vbaglobalbase.hxx
new file mode 100644
index 000000000..6cd5edb72
--- /dev/null
+++ b/include/vbahelper/vbaglobalbase.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBAGLOBALBASE_HXX
+#define INCLUDED_VBAHELPER_VBAGLOBALBASE_HXX
+
+#include <exception>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <ooo/vba/XGlobalsBase.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
+
+namespace com::sun::star {
+ namespace beans { struct PropertyValue; }
+ namespace uno { class XComponentContext; }
+ namespace uno { class XInterface; }
+}
+
+namespace ooo::vba {
+ class XHelperInterface;
+}
+
+typedef InheritedHelperInterfaceWeakImpl< ov::XGlobalsBase > Globals_BASE;
+class VBAHELPER_DLLPUBLIC VbaGlobalsBase : public Globals_BASE
+{
+ const OUString msDocCtxName;
+protected:
+ bool hasServiceName( const OUString& serviceName );
+ void init( const css::uno::Sequence< css::beans::PropertyValue >& aInitArgs );
+
+public:
+ VbaGlobalsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const OUString& sDocCtxName );
+ virtual ~VbaGlobalsBase() override;
+ // XMultiServiceFactory
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) override;
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const OUString& ServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames( ) override;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbahelper.hxx b/include/vbahelper/vbahelper.hxx
new file mode 100644
index 000000000..fd4549cf9
--- /dev/null
+++ b/include/vbahelper/vbahelper.hxx
@@ -0,0 +1,281 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBAHELPER_HXX
+#define INCLUDED_VBAHELPER_VBAHELPER_HXX
+
+#include <memory>
+#include <string_view>
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/color.hxx>
+#include <vbahelper/vbadllapi.h>
+#include <vcl/ptrstyle.hxx>
+#include <vcl/errcode.hxx>
+
+namespace com::sun::star {
+ namespace awt { class XControl; }
+ namespace awt { class XDevice; }
+ namespace awt { class XUnitConversion; }
+ namespace awt { class XWindow; }
+ namespace beans { class XIntrospectionAccess; }
+ namespace beans { class XPropertySet; }
+ namespace beans { struct PropertyValue; }
+ namespace drawing { class XShape; }
+ namespace frame { class XModel; }
+ namespace script { class XTypeConverter; }
+ namespace uno { class Exception; }
+ namespace uno { class XComponentContext; }
+}
+
+class SfxObjectShell;
+class SfxViewFrame;
+class SfxViewShell;
+
+namespace ooo::vba
+ {
+ /// @throws css::lang::IllegalArgumentException
+ template < class T >
+ css::uno::Reference< T > getXSomethingFromArgs( css::uno::Sequence< css::uno::Any > const & args, sal_Int32 nPos, bool bCanBeNull = true )
+ {
+ if ( args.getLength() < ( nPos + 1) )
+ throw css::lang::IllegalArgumentException();
+ css::uno::Reference< T > aSomething( args[ nPos ], css::uno::UNO_QUERY );
+ if ( !bCanBeNull && !aSomething.is() )
+ throw css::lang::IllegalArgumentException();
+ return aSomething;
+ }
+
+ class XHelperInterface;
+
+ /** Returns the VBA document implementation object representing the passed UNO document model. */
+ VBAHELPER_DLLPUBLIC css::uno::Reference< XHelperInterface > getVBADocument( const css::uno::Reference< css::frame::XModel >& xModel );
+ VBAHELPER_DLLPUBLIC css::uno::Reference< XHelperInterface > getUnoDocModule( std::u16string_view aModName, SfxObjectShell const * pShell );
+ /// @throws css::uno::RuntimeException
+ VBAHELPER_DLLPUBLIC SfxObjectShell* getSfxObjShell( const css::uno::Reference< css::frame::XModel >& xModel );
+
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::frame::XModel > getCurrentDoc( const OUString& sKey );
+ /// @throws css::uno::RuntimeException
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getThisExcelDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ /// @throws css::uno::RuntimeException
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getThisWordDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ /// @throws css::uno::RuntimeException
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ /// @throws css::uno::RuntimeException
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+
+ /// @throws css::uno::RuntimeException
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject );
+ /// @throws css::uno::RuntimeException
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > const & getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+
+ VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const OUString& aUrl );
+ VBAHELPER_DLLPUBLIC void dispatchRequests (const css::uno::Reference< css::frame::XModel>& xModel, const OUString & aUrl, const css::uno::Sequence< css::beans::PropertyValue >& sProps );
+ VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell const * pView, sal_uInt16 nSlot );
+ VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 );
+ inline sal_Int32 OORGBToXLRGB( ::Color n ) { return OORGBToXLRGB(sal_Int32(n)); }
+ VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 );
+ VBAHELPER_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& );
+ VBAHELPER_DLLPUBLIC css::uno::Any XLRGBToOORGB( const css::uno::Any& );
+ // provide a NULL object that can be passed as variant so that
+ // the object when passed to IsNull will return true. aNULL
+ // contains an empty object reference
+ VBAHELPER_DLLPUBLIC const css::uno::Any& aNULL();
+ VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell const * pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, bool bSelection );
+ VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell const * );
+ VBAHELPER_DLLPUBLIC void WaitUntilPreviewIsClosed( SfxViewFrame* );
+
+ /** Extracts a boolean value from the passed Any, which may contain a Boolean or an integer or floating-point value.
+ @throws css::uno::RuntimeException if the Any is empty or contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC bool extractBoolFromAny( const css::uno::Any& rAny );
+
+ /** Extracts a string from the passed Any, which may contain a Boolean, a value, or a string.
+ @throws css::uno::RuntimeException if the Any is empty or contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC OUString extractStringFromAny( const css::uno::Any& rAny, bool bUppercaseBool = false );
+ /** Extracts a string from the passed Any, which may contain a Boolean, a value, or a string.
+ Returns rDefault, if rAny is empty.
+ @throws css::uno::RuntimeException if the Any contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC OUString extractStringFromAny( const css::uno::Any& rAny, const OUString& rDefault, bool bUppercaseBool );
+
+ /// @throws css::uno::RuntimeException
+ VBAHELPER_DLLPUBLIC OUString getAnyAsString( const css::uno::Any& pvargItem );
+ VBAHELPER_DLLPUBLIC OUString VBAToRegexp(const OUString &rIn); // needs to be in a uno service ( already this code is duplicated in basic )
+ VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( const css::uno::Reference< css::awt::XDevice >& xDevice, bool bVertical);
+ VBAHELPER_DLLPUBLIC double PointsToPixels( const css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, bool bVertical);
+ VBAHELPER_DLLPUBLIC double PixelsToPoints( const css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, bool bVertical);
+ VBAHELPER_DLLPUBLIC sal_Int32 PointsToHmm( double fPoints );
+ VBAHELPER_DLLPUBLIC double HmmToPoints( sal_Int32 nHmm );
+ VBAHELPER_DLLPUBLIC PointerStyle getPointerStyle( const css::uno::Reference< css::frame::XModel >& );
+ VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, PointerStyle nPointer, bool bOverWrite );
+ /// @throws css::uno::RuntimeException
+ VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue );
+ VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const OUString& aName );
+ VBAHELPER_DLLPUBLIC bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const OUString& aName, const css::uno::Any& aValue );
+ VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const OUString& aName, const css::uno::Any& aValue );
+
+class VBAHELPER_DLLPUBLIC Millimeter
+{
+//Factor to translate between points and hundredths of millimeters:
+private:
+ double m_nMillimeter;
+
+public:
+ Millimeter();
+
+ Millimeter(double mm);
+
+ void setInPoints(double points) ;
+ double getInHundredthsOfOneMillimeter() const;
+ static sal_Int32 getInHundredthsOfOneMillimeter(double points);
+ static double getInPoints(int _hmm);
+};
+
+class VBAHELPER_DLLPUBLIC AbstractGeometryAttributes // probably should replace the ShapeHelper below
+{
+public:
+ virtual ~AbstractGeometryAttributes() {}
+ virtual double getLeft() const = 0;
+ virtual void setLeft( double ) = 0;
+ virtual double getTop() const = 0;
+ virtual void setTop( double ) = 0;
+ virtual double getHeight() const = 0;
+ virtual void setHeight( double ) = 0;
+ virtual double getWidth() const = 0;
+ virtual void setWidth( double ) = 0;
+
+ virtual double getInnerHeight() const { return 0.0; }
+ virtual void setInnerHeight( double ) {}
+ virtual double getInnerWidth() const { return 0.0; }
+ virtual void setInnerWidth( double ) {}
+ virtual double getOffsetX() const { return 0.0; }
+ virtual double getOffsetY() const { return 0.0; }
+};
+
+class VBAHELPER_DLLPUBLIC ShapeHelper
+{
+ css::uno::Reference< css::drawing::XShape > xShape;
+public:
+ /// @throws css::script::BasicErrorException
+ /// @throws css::uno::RuntimeException
+ ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape);
+
+ double getHeight() const;
+ void setHeight(double _fheight);
+ double getWidth() const;
+ void setWidth(double _fWidth);
+ double getLeft() const;
+ void setLeft(double _fLeft);
+ double getTop() const;
+ void setTop(double _fTop);
+};
+
+class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes final : public AbstractGeometryAttributes
+{
+ std::unique_ptr< ShapeHelper > m_pShapeHelper;
+public:
+ ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::drawing::XShape >& xShape );
+ virtual double getLeft() const override;
+ virtual void setLeft( double nLeft ) override;
+ virtual double getTop() const override;
+ virtual void setTop( double nTop ) override;
+ virtual double getHeight() const override;
+ virtual void setHeight( double nHeight ) override;
+ virtual double getWidth() const override;
+ virtual void setWidth( double nWidth) override;
+ virtual ~ConcreteXShapeGeometryAttributes() override;
+};
+
+#define VBA_LEFT "PositionX"
+#define VBA_TOP "PositionY"
+
+class VBAHELPER_DLLPUBLIC UserFormGeometryHelper final : public AbstractGeometryAttributes
+{
+public:
+ UserFormGeometryHelper(
+ const css::uno::Reference< css::awt::XControl >& xControl,
+ double fOffsetX, double fOffsetY );
+ virtual double getLeft() const override;
+ virtual void setLeft( double fLeft ) override;
+ virtual double getTop() const override;
+ virtual void setTop( double fTop ) override;
+ virtual double getWidth() const override;
+ virtual void setWidth( double fWidth ) override;
+ virtual double getHeight() const override;
+ virtual void setHeight( double fHeight ) override;
+ virtual double getInnerWidth() const override;
+ virtual void setInnerWidth( double fWidth ) override;
+ virtual double getInnerHeight() const override;
+ virtual void setInnerHeight( double fHeight ) override;
+ virtual double getOffsetX() const override;
+ virtual double getOffsetY() const override;
+
+private:
+ double implGetPos( bool bPosY ) const;
+ void implSetPos( double fPos, bool bPosY );
+ double implGetSize( bool bHeight, bool bOuter ) const;
+ void implSetSize( double fSize, bool bHeight, bool bOuter );
+
+private:
+ css::uno::Reference< css::awt::XWindow > mxWindow;
+ css::uno::Reference< css::beans::XPropertySet > mxModelProps;
+ css::uno::Reference< css::awt::XUnitConversion > mxUnitConv;
+ double mfOffsetX;
+ double mfOffsetY;
+ bool mbDialog;
+};
+
+class VBAHELPER_DLLPUBLIC ContainerUtilities
+{
+
+public:
+ static OUString getUniqueName( const css::uno::Sequence< OUString >& _slist, const OUString& _sElementName, std::u16string_view _sSuffixSeparator);
+ static OUString getUniqueName( const css::uno::Sequence< OUString >& _slist, const OUString& _sElementName, std::u16string_view _sSuffixSeparator, sal_Int32 _nStartSuffix );
+
+ static sal_Int32 FieldInList( const css::uno::Sequence< OUString >& SearchList, const OUString& SearchString );
+};
+
+// really just a place holder to ease the porting pain
+class VBAHELPER_DLLPUBLIC DebugHelper
+{
+public:
+ /// @throws css::script::BasicErrorException
+ static void basicexception( const css::uno::Exception& ex, ErrCode err, std::u16string_view /*additionalArgument*/ );
+
+ /// @throws css::script::BasicErrorException
+ static void basicexception( ErrCode err, std::u16string_view additionalArgument );
+
+ /// @throws css::script::BasicErrorException
+ static void basicexception( const css::uno::Exception& ex );
+
+ /// @throws css::script::BasicErrorException
+ static void runtimeexception( ErrCode err );
+};
+
+} // ooo::vba
+
+namespace ov = ooo::vba;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbahelperinterface.hxx b/include/vbahelper/vbahelperinterface.hxx
new file mode 100644
index 000000000..c7fb615b1
--- /dev/null
+++ b/include/vbahelper/vbahelperinterface.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBAHELPERINTERFACE_HXX
+#define INCLUDED_VBAHELPER_VBAHELPERINTERFACE_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <ooo/vba/XHelperInterface.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbahelper.hxx>
+
+// use this class when you have an object like
+// interface XAnInterface which contains XHelperInterface in its inheritance hierarchy
+// interface XAnInterface
+// {
+// interface XHelperInterface;
+// [attribute, string] name;
+// }
+// or
+// interface XAnInterface : XHelperInterface;
+// {
+// [attribute, string] name;
+// }
+//
+// then this class can provide a default implementation of XHelperInterface,
+// you can use it like this
+// typedef InheritedHelperInterfaceImpl< XAnInterface > > AnInterfaceImpl_BASE;
+// class AnInterfaceImpl : public AnInterfaceImpl_BASE
+// {
+// public:
+// AnInterface( const Reference< HelperInterface >& xParent ) : AnInterfaceImpl_BASE( xParent ) {}
+// // implement XAnInterface methods only, no need to implement the XHelperInterface
+// // methods
+// virtual void setName( const OUString& );
+// virtual OUString getName();
+// }
+//
+
+template< typename... Ifc >
+class SAL_DLLPUBLIC_TEMPLATE InheritedHelperInterfaceImpl : public Ifc...
+{
+protected:
+ css::uno::WeakReference< ov::XHelperInterface > mxParent;
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+public:
+ InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {}
+ virtual OUString getServiceImplName() = 0;
+ virtual css::uno::Sequence<OUString> getServiceNames() = 0;
+
+ // XHelperInterface Methods
+ virtual ::sal_Int32 SAL_CALL getCreator() override
+ {
+ return 0x53756E4F;
+ }
+ virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) override { return mxParent; }
+
+ virtual css::uno::Any SAL_CALL Application( ) override {
+ // The application could certainly be passed around in the context - seems
+ // to make sense
+ css::uno::Reference< css::container::XNameAccess > xNameAccess( mxContext, css::uno::UNO_QUERY_THROW );
+ return xNameAccess->getByName( "Application" );
+ }
+
+ // XServiceInfo Methods
+ virtual OUString SAL_CALL getImplementationName( ) override { return getServiceImplName(); }
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override
+ {
+ css::uno::Sequence< OUString > sServices = getSupportedServiceNames();
+ const OUString* pStart = sServices.getConstArray();
+ const OUString* pEnd = pStart + sServices.getLength();
+ for ( ; pStart != pEnd ; ++pStart )
+ if ( *pStart == ServiceName )
+ return true;
+ return false;
+ }
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override
+ {
+ css::uno::Sequence< OUString > aNames = getServiceNames();
+ return aNames;
+ }
+ };
+
+template <typename... Ifc >
+class SAL_DLLPUBLIC_TEMPLATE InheritedHelperInterfaceWeakImpl : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper< Ifc... > >
+{
+ typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper< Ifc... > > Base;
+public:
+ InheritedHelperInterfaceWeakImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
+};
+
+
+/** Helper macro to declare the methods 'getServiceImplName()' and
+ 'getServiceNames()' of the 'ooo.vba.XHelperInterface' interface in a class
+ declaration.
+ */
+#define VBAHELPER_DECL_XHELPERINTERFACE \
+ virtual OUString getServiceImplName() override; \
+ virtual css::uno::Sequence< OUString > getServiceNames() override;
+
+
+/** Helper macro to implement the methods 'getServiceImplName()' and
+ 'getServiceNames()' of the 'ooo.vba.XHelperInterface' interface. Will
+ return the class name as service implementation name.
+ */
+#define VBAHELPER_IMPL_XHELPERINTERFACE( classname, servicename ) \
+OUString classname::getServiceImplName() \
+{ \
+ return #classname; \
+} \
+css::uno::Sequence< OUString > classname::getServiceNames() \
+{ \
+ static const css::uno::Sequence< OUString > saServiceNames { servicename }; \
+ return saServiceNames; \
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbapagesetupbase.hxx b/include/vbahelper/vbapagesetupbase.hxx
new file mode 100644
index 000000000..c1b466836
--- /dev/null
+++ b/include/vbahelper/vbapagesetupbase.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBAPAGESETUPBASE_HXX
+#define INCLUDED_VBAHELPER_VBAPAGESETUPBASE_HXX
+
+#include <exception>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <ooo/vba/XPageSetupBase.hpp>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
+
+namespace com::sun::star {
+ namespace beans { class XPropertySet; }
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class XHelperInterface;
+}
+
+typedef InheritedHelperInterfaceWeakImpl< ooo::vba::XPageSetupBase > VbaPageSetupBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaPageSetupBase : public VbaPageSetupBase_BASE
+{
+protected:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::beans::XPropertySet > mxPageProps;
+ sal_Int32 mnOrientLandscape;
+ sal_Int32 mnOrientPortrait;
+
+ /// @throws css::uno::RuntimeException
+ VbaPageSetupBase( const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext );
+public:
+
+ // Attribute
+ virtual double SAL_CALL getTopMargin() override;
+ virtual void SAL_CALL setTopMargin( double margin ) override;
+ virtual double SAL_CALL getBottomMargin() override;
+ virtual void SAL_CALL setBottomMargin( double margin ) override;
+ virtual double SAL_CALL getRightMargin() override;
+ virtual void SAL_CALL setRightMargin( double margin ) override;
+ virtual double SAL_CALL getLeftMargin() override;
+ virtual void SAL_CALL setLeftMargin( double margin ) override;
+ /// @throws css::uno::RuntimeException
+ virtual double SAL_CALL getHeaderMargin();
+ /// @throws css::uno::RuntimeException
+ virtual void SAL_CALL setHeaderMargin( double margin );
+ /// @throws css::uno::RuntimeException
+ virtual double SAL_CALL getFooterMargin();
+ /// @throws css::uno::RuntimeException
+ virtual void SAL_CALL setFooterMargin( double margin );
+ virtual sal_Int32 SAL_CALL getOrientation() override;
+ virtual void SAL_CALL setOrientation( sal_Int32 orientation ) override;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbapropvalue.hxx b/include/vbahelper/vbapropvalue.hxx
new file mode 100644
index 000000000..ee6443f08
--- /dev/null
+++ b/include/vbahelper/vbapropvalue.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef SC_VBA_PROPVALULE_HXX
+#define SC_VBA_PROPVALULE_HXX
+
+#include <exception>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <ooo/vba/XPropValue.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+
+class VBAHELPER_DLLPUBLIC PropListener
+{
+public:
+ virtual void setValueEvent( const css::uno::Any& value ) = 0;
+ virtual css::uno::Any getValueEvent() = 0;
+
+protected:
+ ~PropListener() {}
+};
+
+
+class VBAHELPER_DLLPUBLIC ScVbaPropValue final : public ::cppu::WeakImplHelper< ov::XPropValue >
+{
+ PropListener* m_pListener;
+public:
+ ScVbaPropValue( PropListener* pListener );
+
+ // Attributes
+ virtual css::uno::Any SAL_CALL getValue() override;
+ virtual void SAL_CALL setValue( const css::uno::Any& _value ) override;
+
+ OUString SAL_CALL getDefaultPropertyName() override { return "Value"; }
+
+};
+#endif //SC_VBA_PROPVALULE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbareturntypes.hxx b/include/vbahelper/vbareturntypes.hxx
new file mode 100644
index 000000000..96bb168ab
--- /dev/null
+++ b/include/vbahelper/vbareturntypes.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBARETURNTYPES_HXX
+#define INCLUDED_VBAHELPER_VBARETURNTYPES_HXX
+
+#include <com/sun/star/script/XDefaultProperty.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <ooo/vba/msforms/XReturnInteger.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbahelper.hxx>
+
+namespace ooo::vba
+ {
+ template< typename T1, typename T2 >
+ class DefaultReturnHelper : public ::cppu::WeakImplHelper< T2, css::script::XDefaultProperty >
+ {
+ T1 mnValue;
+ public:
+ DefaultReturnHelper( const T1& nValue ) : mnValue( nValue ) {}
+ virtual void SAL_CALL setValue( T1 nValue ) override { mnValue = nValue; }
+ virtual T1 SAL_CALL getValue() override { return mnValue; }
+ OUString SAL_CALL getDefaultPropertyName( ) override { return "Value"; }
+ };
+
+ typedef DefaultReturnHelper< sal_Int32, ov::msforms::XReturnInteger > ReturnInteger_BASE;
+ class ReturnInteger final : public ReturnInteger_BASE
+ {
+ public:
+ ReturnInteger( sal_Int32 nValue ) : ReturnInteger_BASE( nValue ){}
+ };
+
+} // ooo::vba
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbashape.hxx b/include/vbahelper/vbashape.hxx
new file mode 100644
index 000000000..d6a79968b
--- /dev/null
+++ b/include/vbahelper/vbashape.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBASHAPE_HXX
+#define INCLUDED_VBAHELPER_VBASHAPE_HXX
+
+#include <exception>
+#include <memory>
+
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <ooo/vba/msforms/XShape.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
+
+namespace com::sun::star {
+ namespace beans { class XPropertySet; }
+ namespace drawing { class XShape; }
+ namespace drawing { class XShapes; }
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class ShapeHelper;
+ class XHelperInterface;
+ namespace msforms { class XFillFormat; }
+ namespace msforms { class XLineFormat; }
+ namespace msforms { class XPictureFormat; }
+}
+
+typedef ::cppu::WeakImplHelper< ov::msforms::XShape, css::lang::XEventListener > ListeningShape;
+
+typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE;
+
+class VBAHELPER_DLLPUBLIC ScVbaShape : public ScVbaShape_BASE
+{
+protected:
+ std::unique_ptr< ov::ShapeHelper > m_pShapeHelper;
+ css::uno::Reference< css::drawing::XShape > m_xShape;
+ css::uno::Reference< css::drawing::XShapes > m_xShapes;
+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
+ sal_Int32 m_nType;
+ css::uno::Reference< css::frame::XModel > m_xModel;
+ void addListeners();
+ /// @throws css::uno::RuntimeException
+ void removeShapeListener();
+ /// @throws css::uno::RuntimeException
+ void removeShapesListener();
+ virtual OUString getServiceImplName() override;
+ virtual css::uno::Sequence<OUString> getServiceNames() override;
+public:
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::uno::RuntimeException
+ ScVbaShape( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::drawing::XShapes >& xShapes, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nType );
+ virtual ~ScVbaShape() override;
+
+ /// @throws css::uno::RuntimeException
+ static sal_Int32 getType( const css::uno::Reference< css::drawing::XShape >& rShape );
+
+ static sal_Int32 getAutoShapeType( const css::uno::Reference< css::drawing::XShape >& rShape );
+
+ // Attributes
+ virtual OUString SAL_CALL getName() override;
+ virtual void SAL_CALL setName( const OUString& _name ) override;
+ virtual OUString SAL_CALL getAlternativeText() override;
+ virtual void SAL_CALL setAlternativeText( const OUString& _name ) override;
+ virtual double SAL_CALL getHeight() override;
+ virtual void SAL_CALL setHeight(double _height) override;
+ virtual double SAL_CALL getWidth() override;
+ virtual void SAL_CALL setWidth(double _width) override;
+ virtual double SAL_CALL getLeft() override;
+ virtual void SAL_CALL setLeft( double _left ) override;
+ virtual double SAL_CALL getTop() override;
+ virtual void SAL_CALL setTop( double _top ) override;
+ virtual sal_Bool SAL_CALL getVisible() override;
+ virtual void SAL_CALL setVisible( sal_Bool _visible ) override;
+ virtual sal_Int32 SAL_CALL getZOrderPosition() override;
+ virtual sal_Int32 SAL_CALL getType() override;
+ virtual double SAL_CALL getRotation() override;
+ virtual void SAL_CALL setRotation( double _rotation ) override;
+ virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() override;
+ virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() override;
+ virtual css::uno::Reference< ov::msforms::XPictureFormat > SAL_CALL getPictureFormat() override;
+ virtual sal_Bool SAL_CALL getLockAspectRatio() override;
+ virtual void SAL_CALL setLockAspectRatio( sal_Bool _lockaspectratio ) override;
+ virtual sal_Bool SAL_CALL getLockAnchor() override;
+ virtual void SAL_CALL setLockAnchor( sal_Bool _lockanchor ) override;
+ virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() override;
+ virtual void SAL_CALL setRelativeHorizontalPosition(::sal_Int32 _relativehorizontalposition) override;
+ virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() override;
+ virtual void SAL_CALL setRelativeVerticalPosition(::sal_Int32 _relativeverticalposition) override;
+
+ // Methods
+ virtual css::uno::Any SAL_CALL TextFrame( ) override;
+ virtual css::uno::Any SAL_CALL WrapFormat( ) override;
+ virtual void SAL_CALL Delete() override;
+ virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) override;
+ virtual void SAL_CALL IncrementRotation( double Increment ) override;
+ virtual void SAL_CALL IncrementLeft( double Increment ) override;
+ virtual void SAL_CALL IncrementTop( double Increment ) override;
+ virtual void SAL_CALL ScaleHeight( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) override;
+ virtual void SAL_CALL ScaleWidth( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) override;
+ // Replace??
+ virtual void SAL_CALL Select( const css::uno::Any& Replace ) override;
+ virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) override;
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) override;
+};
+#endif // INCLUDED_VBAHELPER_VBASHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbashaperange.hxx b/include/vbahelper/vbashaperange.hxx
new file mode 100644
index 000000000..54a052cac
--- /dev/null
+++ b/include/vbahelper/vbashaperange.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBASHAPERANGE_HXX
+#define INCLUDED_VBAHELPER_VBASHAPERANGE_HXX
+
+#include <exception>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <ooo/vba/msforms/XShapeRange.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+
+namespace com::sun::star {
+ namespace container { class XEnumeration; }
+ namespace container { class XIndexAccess; }
+ namespace drawing { class XDrawPage; }
+ namespace drawing { class XShapes; }
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class XHelperInterface;
+ namespace msforms { class XFillFormat; }
+ namespace msforms { class XLineFormat; }
+ namespace msforms { class XShape; }
+}
+
+typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE;
+
+class VBAHELPER_DLLPUBLIC ScVbaShapeRange final : public ScVbaShapeRange_BASE
+{
+private:
+ css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage;
+ css::uno::Reference< css::drawing::XShapes > m_xShapes;
+ css::uno::Reference< css::frame::XModel > m_xModel;
+ virtual OUString getServiceImplName() override;
+ virtual css::uno::Sequence<OUString> getServiceNames() override;
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::drawing::XShapes > const & getShapes() ;
+public:
+ ScVbaShapeRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xShapes, const css::uno::Reference< css::drawing::XDrawPage>& xDrawShape, const css::uno::Reference< css::frame::XModel >& xModel );
+
+ // Methods
+ virtual void SAL_CALL Select( ) override;
+ virtual css::uno::Reference< ::ooo::vba::msforms::XShape > SAL_CALL Group() override;
+ virtual void SAL_CALL IncrementRotation( double Increment ) override;
+ virtual void SAL_CALL IncrementLeft( double Increment ) override ;
+ virtual void SAL_CALL IncrementTop( double Increment ) override;
+ virtual OUString SAL_CALL getName() override;
+ virtual void SAL_CALL setName( const OUString& _name ) override;
+ virtual double SAL_CALL getHeight() override;
+ virtual void SAL_CALL setHeight( double _height ) override;
+ virtual double SAL_CALL getWidth() override;
+ virtual void SAL_CALL setWidth( double _width ) override;
+ virtual double SAL_CALL getLeft() override;
+ virtual void SAL_CALL setLeft( double _left ) override;
+ virtual double SAL_CALL getTop() override;
+ virtual void SAL_CALL setTop( double _top ) override;
+ virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() override;
+ virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() override;
+ virtual sal_Bool SAL_CALL getLockAspectRatio() override;
+ virtual void SAL_CALL setLockAspectRatio( sal_Bool _lockaspectratio ) override;
+ virtual sal_Bool SAL_CALL getLockAnchor() override;
+ virtual void SAL_CALL setLockAnchor( sal_Bool _lockanchor ) override;
+ virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() override;
+ virtual void SAL_CALL setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) override;
+ virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() override;
+ virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) override;
+ virtual css::uno::Any SAL_CALL TextFrame( ) override;
+ virtual css::uno::Any SAL_CALL WrapFormat( ) override;
+ virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) override;
+ //XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() override;
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override;
+ // ScVbaCollectionBaseImpl
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) override;
+};
+
+#endif // INCLUDED_VBAHELPER_VBASHAPERANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbashapes.hxx b/include/vbahelper/vbashapes.hxx
new file mode 100644
index 000000000..16d40566a
--- /dev/null
+++ b/include/vbahelper/vbashapes.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBASHAPES_HXX
+#define INCLUDED_VBAHELPER_VBASHAPES_HXX
+
+#include <exception>
+#include <string_view>
+
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <ooo/vba/msforms/XShapes.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+
+namespace com::sun::star {
+ namespace container { class XEnumeration; }
+ namespace container { class XIndexAccess; }
+ namespace drawing { class XDrawPage; }
+ namespace drawing { class XShape; }
+ namespace drawing { class XShapes; }
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class XHelperInterface;
+ namespace msforms { class XShapeRange; }
+}
+
+typedef CollTestImplHelper< ov::msforms::XShapes > ScVbaShapes_BASE;
+
+class VBAHELPER_DLLPUBLIC ScVbaShapes final : public ScVbaShapes_BASE
+{
+private:
+ css::uno::Reference< css::drawing::XShapes > m_xShapes;
+ css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage;
+ sal_Int32 m_nNewShapeCount;
+ void initBaseCollection();
+ css::uno::Reference< css::frame::XModel > m_xModel;
+ virtual OUString getServiceImplName() override;
+ virtual css::uno::Sequence<OUString> getServiceNames() override;
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::container::XIndexAccess > getShapesByArrayIndices( const css::uno::Any& Index );
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::drawing::XShape > createShape( const OUString& service );
+ /// @throws css::uno::RuntimeException
+ css::uno::Any AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight );
+ /// @throws css::uno::RuntimeException
+ css::uno::Any AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight );
+ /// @throws css::uno::RuntimeException
+ css::uno::Any AddTextboxInWriter( sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight );
+ OUString createName( std::u16string_view sName );
+ //TODO helperapi using a writer document
+ //css::awt::Point calculateTopLeftMargin( css::uno::Reference< ov::XHelperInterface > xDocument );
+
+public:
+ ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xShapes, const css::uno::Reference< css::frame::XModel >& xModel );
+ /// @throws css::uno::RuntimeException
+ static void setDefaultShapeProperties( const css::uno::Reference< css::drawing::XShape >& xShape );
+ static void setShape_NameProperty( const css::uno::Reference< css::drawing::XShape >& xShape, const OUString& sName );
+ //XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() override;
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override;
+
+ virtual void SAL_CALL SelectAll() override;
+ //helper::calc
+ virtual css::uno::Any SAL_CALL AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) override;
+ virtual css::uno::Any SAL_CALL AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) override;
+ virtual css::uno::Any SAL_CALL AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) override;
+ virtual css::uno::Reference< ov::msforms::XShapeRange > SAL_CALL Range( const css::uno::Any& shapes ) override;
+ // ScVbaCollectionBaseImpl
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) override;
+};
+
+#endif // INCLUDED_VBAHELPER_VBASHAPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbatextframe.hxx b/include/vbahelper/vbatextframe.hxx
new file mode 100644
index 000000000..a93c511a8
--- /dev/null
+++ b/include/vbahelper/vbatextframe.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VBAHELPER_VBATEXTFRAME_HXX
+#define INCLUDED_VBAHELPER_VBATEXTFRAME_HXX
+
+#include <exception>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <ooo/vba/msforms/XTextFrame.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
+
+namespace com::sun::star {
+ namespace beans { class XPropertySet; }
+ namespace drawing { class XShape; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class XHelperInterface;
+}
+
+typedef InheritedHelperInterfaceWeakImpl< ov::msforms::XTextFrame > VbaTextFrame_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaTextFrame : public VbaTextFrame_BASE
+{
+protected:
+ css::uno::Reference< css::drawing::XShape > m_xShape;
+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
+protected:
+ virtual OUString getServiceImplName() override;
+ virtual css::uno::Sequence<OUString> getServiceNames() override;
+ void setAsMSObehavior();
+ sal_Int32 getMargin( const OUString& sMarginType );
+ void setMargin( const OUString& sMarginType, float fMargin );
+public:
+ VbaTextFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext , css::uno::Reference< css::drawing::XShape > const & xShape);
+ // Attributes
+ virtual sal_Bool SAL_CALL getAutoSize() override;
+ virtual void SAL_CALL setAutoSize( sal_Bool _autosize ) override;
+ virtual float SAL_CALL getMarginBottom() override;
+ virtual void SAL_CALL setMarginBottom( float _marginbottom ) override;
+ virtual float SAL_CALL getMarginTop() override;
+ virtual void SAL_CALL setMarginTop( float _margintop ) override;
+ virtual float SAL_CALL getMarginLeft() override;
+ virtual void SAL_CALL setMarginLeft( float _marginleft ) override;
+ virtual float SAL_CALL getMarginRight() override;
+ virtual void SAL_CALL setMarginRight( float _marginright ) override;
+
+ // Methods
+ virtual css::uno::Any SAL_CALL Characters( ) override;
+
+};
+
+#endif//SC_ INCLUDED_VBAHELPER_VBATEXTFRAME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vbahelper/vbawindowbase.hxx b/include/vbahelper/vbawindowbase.hxx
new file mode 100644
index 000000000..bf2c6460c
--- /dev/null
+++ b/include/vbahelper/vbawindowbase.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VBAHELPER_VBAWINDOWBASE_HXX
+#define INCLUDED_VBAHELPER_VBAWINDOWBASE_HXX
+
+#include <exception>
+
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <ooo/vba/XWindowBase.hpp>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
+
+namespace com::sun::star {
+ namespace awt { class XWindow2; }
+ namespace awt { class XWindow; }
+ namespace frame { class XController; }
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace ooo::vba {
+ class XHelperInterface;
+}
+
+typedef InheritedHelperInterfaceWeakImpl< ov::XWindowBase > WindowBaseImpl_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaWindowBase : public WindowBaseImpl_BASE
+{
+public:
+ /// @throws css::uno::RuntimeException
+ VbaWindowBase(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ const css::uno::Reference< css::frame::XController >& xController );
+ /// @throws css::uno::RuntimeException
+ VbaWindowBase(
+ css::uno::Sequence< css::uno::Any > const& aArgs,
+ css::uno::Reference< css::uno::XComponentContext > const& xContext );
+
+ // XWindowBase
+ virtual sal_Int32 SAL_CALL getHeight() override ;
+ virtual void SAL_CALL setHeight( sal_Int32 _height ) override ;
+ virtual sal_Int32 SAL_CALL getLeft() override ;
+ virtual void SAL_CALL setLeft( sal_Int32 _left ) override ;
+ virtual sal_Int32 SAL_CALL getTop() override ;
+ virtual void SAL_CALL setTop( sal_Int32 _top ) override ;
+ virtual sal_Bool SAL_CALL getVisible() override;
+ virtual void SAL_CALL setVisible( sal_Bool _visible ) override;
+ virtual sal_Int32 SAL_CALL getWidth() override ;
+ virtual void SAL_CALL setWidth( sal_Int32 _width ) override ;
+
+ // XHelperInterface
+ virtual OUString getServiceImplName() override;
+ virtual css::uno::Sequence<OUString> getServiceNames() override;
+
+protected:
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::frame::XController > getController() const;
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::awt::XWindow > getWindow() const;
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::awt::XWindow2 > getWindow2() const;
+
+ css::uno::Reference< css::frame::XModel > m_xModel;
+
+private:
+ /// @throws css::uno::RuntimeException
+ void construct( const css::uno::Reference< css::frame::XController >& xController );
+
+ css::uno::WeakReference< css::frame::XController > m_xController;
+ css::uno::WeakReference< css::awt::XWindow > m_xWindow;
+};
+
+#endif // INCLUDED_VBAHELPER_VBAWINDOWBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/AccessibleBrowseBoxObjType.hxx b/include/vcl/AccessibleBrowseBoxObjType.hxx
new file mode 100644
index 000000000..481c41435
--- /dev/null
+++ b/include/vcl/AccessibleBrowseBoxObjType.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+/** This enumeration contains a constant for each kind of accessible object of
+ a BrowseBox. */
+enum class AccessibleBrowseBoxObjType
+{
+ BrowseBox, /// The BrowseBox itself.
+ Table, /// The data table.
+ RowHeaderBar, /// The row header bar ("handle column").
+ ColumnHeaderBar, /// The horizontal column header bar.
+ TableCell, /// A cell of the data table.
+ RowHeaderCell, /// A cell of the row header bar.
+ ColumnHeaderCell, /// A cell of the column header bar.
+ CheckBoxCell /// A cell with a checkbox.
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BinaryDataContainer.hxx b/include/vcl/BinaryDataContainer.hxx
new file mode 100644
index 000000000..b7421e987
--- /dev/null
+++ b/include/vcl/BinaryDataContainer.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <vector>
+#include <memory>
+
+/** Container for the binary data, whose responsibility is to manage the
+ * make it as simple as possible to manage the binary data. The binary
+ * data can be anything, but typically it is a in-memory data from
+ * files (i.e. files of graphic formats).
+ */
+class VCL_DLLPUBLIC BinaryDataContainer final
+{
+private:
+ // the binary data
+ std::shared_ptr<std::vector<sal_uInt8>> mpData;
+
+public:
+ BinaryDataContainer();
+ BinaryDataContainer(const sal_uInt8* pData, size_t nSize);
+ BinaryDataContainer(std::unique_ptr<std::vector<sal_uInt8>> rData);
+
+ BinaryDataContainer(const BinaryDataContainer& rBinaryDataContainer)
+ : mpData(rBinaryDataContainer.mpData)
+ {
+ }
+
+ BinaryDataContainer(BinaryDataContainer&& rBinaryDataContainer) noexcept
+ : mpData(std::move(rBinaryDataContainer.mpData))
+ {
+ }
+
+ BinaryDataContainer& operator=(const BinaryDataContainer& rBinaryDataContainer)
+ {
+ mpData = rBinaryDataContainer.mpData;
+ return *this;
+ }
+
+ BinaryDataContainer& operator=(BinaryDataContainer&& rBinaryDataContainer) noexcept
+ {
+ mpData = std::move(rBinaryDataContainer.mpData);
+ return *this;
+ }
+
+ size_t getSize() const { return mpData ? mpData->size() : 0; }
+ bool isEmpty() const { return !mpData || mpData->empty(); }
+ const sal_uInt8* getData() const { return mpData ? mpData->data() : nullptr; }
+
+ size_t calculateHash() const;
+
+ auto cbegin() const { return mpData->cbegin(); }
+
+ auto cend() const { return mpData->cend(); }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BinaryDataContainerTools.hxx b/include/vcl/BinaryDataContainerTools.hxx
new file mode 100644
index 000000000..3d50379a8
--- /dev/null
+++ b/include/vcl/BinaryDataContainerTools.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <vcl/BinaryDataContainer.hxx>
+#include <com/sun/star/util/XBinaryDataContainer.hpp>
+
+namespace vcl
+{
+VCL_DLLPUBLIC BinaryDataContainer convertUnoBinaryDataContainer(
+ css::uno::Reference<css::util::XBinaryDataContainer> const& rxBinaryDataContainer);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapAccessMode.hxx b/include/vcl/BitmapAccessMode.hxx
new file mode 100644
index 000000000..66cc2b56b
--- /dev/null
+++ b/include/vcl/BitmapAccessMode.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_BITMAPACCESSMODE_HXX
+#define INCLUDED_VCL_BITMAPACCESSMODE_HXX
+
+enum class BitmapAccessMode
+{
+ Info,
+ Read,
+ Write
+};
+
+#endif // INCLUDED_VCL_BITMAPACCESSMODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapAlphaClampFilter.hxx b/include/vcl/BitmapAlphaClampFilter.hxx
new file mode 100644
index 000000000..6926c3274
--- /dev/null
+++ b/include/vcl/BitmapAlphaClampFilter.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_INCLUDE_VCL_BITMAPALPHACLAMPFILTER_HXX
+#define INCLUDED_INCLUDE_VCL_BITMAPALPHACLAMPFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+/** If the alpha is beyond a certain threshold, make it fully transparent
+ */
+class VCL_DLLPUBLIC BitmapAlphaClampFilter final : public BitmapFilter
+{
+public:
+ BitmapAlphaClampFilter(sal_uInt8 cThreshold)
+ : mcThreshold(cThreshold)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ sal_uInt8 mcThreshold;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapBasicMorphologyFilter.hxx b/include/vcl/BitmapBasicMorphologyFilter.hxx
new file mode 100644
index 000000000..055e1e14e
--- /dev/null
+++ b/include/vcl/BitmapBasicMorphologyFilter.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPBASICMORPHOLOGYFILTER_HXX
+#define INCLUDED_VCL_BITMAPBASICMORPHOLOGYFILTER_HXX
+
+#include <vcl/bitmap.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/BitmapFilter.hxx>
+
+enum class BasicMorphologyOp
+{
+ erode,
+ dilate
+};
+
+/* Black is foreground, white is background */
+class VCL_DLLPUBLIC BitmapBasicMorphologyFilter : public BitmapFilter
+{
+public:
+ BitmapBasicMorphologyFilter(BasicMorphologyOp op, sal_Int32 nRadius);
+ BitmapBasicMorphologyFilter(BasicMorphologyOp op, sal_Int32 nRadius, sal_uInt8 nValueOutside);
+ virtual ~BitmapBasicMorphologyFilter();
+
+ virtual BitmapEx execute(BitmapEx const& rBitmap) const override;
+
+private:
+ Bitmap filter(Bitmap const& rBitmap) const;
+
+ BasicMorphologyOp m_eOp;
+ sal_Int32 m_nRadius;
+ sal_uInt8 m_nValueOutside = 0;
+ bool m_bUseValueOutside = false;
+};
+
+class BitmapErodeFilter final : public BitmapBasicMorphologyFilter
+{
+public:
+ BitmapErodeFilter(sal_Int32 nRadius)
+ : BitmapBasicMorphologyFilter(BasicMorphologyOp::erode, nRadius)
+ {
+ }
+ BitmapErodeFilter(sal_Int32 nRadius, sal_uInt8 nValueOutside)
+ : BitmapBasicMorphologyFilter(BasicMorphologyOp::erode, nRadius, nValueOutside)
+ {
+ }
+};
+
+class BitmapDilateFilter final : public BitmapBasicMorphologyFilter
+{
+public:
+ BitmapDilateFilter(sal_Int32 nRadius)
+ : BitmapBasicMorphologyFilter(BasicMorphologyOp::dilate, nRadius)
+ {
+ }
+ BitmapDilateFilter(sal_Int32 nRadius, sal_uInt8 nValueOutside)
+ : BitmapBasicMorphologyFilter(BasicMorphologyOp::dilate, nRadius, nValueOutside)
+ {
+ }
+};
+
+#endif // INCLUDED_VCL_BITMAPBASICMORPHOLOGYFILTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapBuffer.hxx b/include/vcl/BitmapBuffer.hxx
new file mode 100644
index 000000000..54efeea5e
--- /dev/null
+++ b/include/vcl/BitmapBuffer.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_BITMAPBUFFER_HXX
+#define INCLUDED_VCL_BITMAPBUFFER_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+#include <optional>
+
+#include <vcl/dllapi.h>
+#include <vcl/BitmapPalette.hxx>
+#include <vcl/ColorMask.hxx>
+#include <vcl/Scanline.hxx>
+#include <tools/long.hxx>
+
+struct SalTwoRect;
+
+struct VCL_DLLPUBLIC BitmapBuffer
+{
+ tools::Long mnWidth;
+ tools::Long mnHeight;
+ tools::Long mnScanlineSize;
+ BitmapPalette maPalette;
+ sal_uInt8* mpBits;
+ ScanlineFormat mnFormat;
+ ColorMask maColorMask;
+ sal_uInt16 mnBitCount;
+};
+
+VCL_DLLPUBLIC std::unique_ptr<BitmapBuffer> StretchAndConvert(
+ const BitmapBuffer& rSrcBuffer, const SalTwoRect& rTwoRect,
+ ScanlineFormat nDstBitmapFormat, std::optional<BitmapPalette> pDstPal = std::nullopt, const ColorMask* pDstMask = nullptr );
+
+#endif // INCLUDED_VCL_BITMAPBUFFER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapColor.hxx b/include/vcl/BitmapColor.hxx
new file mode 100644
index 000000000..b5364b4d1
--- /dev/null
+++ b/include/vcl/BitmapColor.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_BITMAPCOLOR_HXX
+#define INCLUDED_VCL_BITMAPCOLOR_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/color.hxx>
+
+class VCL_DLLPUBLIC BitmapColor final : public Color
+{
+public:
+ inline BitmapColor();
+ constexpr BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue );
+ constexpr BitmapColor( ColorTransparencyTag, sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cTransparency );
+ constexpr BitmapColor( ColorAlphaTag, sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha );
+
+ inline BitmapColor( const Color& rColor );
+ explicit inline BitmapColor( sal_uInt8 cIndex );
+
+ inline sal_uInt8 GetIndex() const;
+ inline void SetIndex( sal_uInt8 cIndex );
+};
+
+inline BitmapColor::BitmapColor()
+{
+}
+
+inline BitmapColor::BitmapColor( const Color& rColor )
+ : Color(rColor)
+{
+}
+
+constexpr BitmapColor::BitmapColor(sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue)
+ : Color(cRed, cGreen, cBlue)
+{
+}
+
+constexpr BitmapColor::BitmapColor(ColorTransparencyTag, sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cTransparency)
+ : Color(ColorTransparency, cTransparency, cRed, cGreen, cBlue)
+{
+}
+
+constexpr BitmapColor::BitmapColor(ColorAlphaTag, sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha)
+ : Color(ColorAlpha, cAlpha, cRed, cGreen, cBlue)
+{
+}
+
+inline BitmapColor::BitmapColor( sal_uInt8 cIndex )
+{
+ SetIndex(cIndex);
+}
+
+inline sal_uInt8 BitmapColor::GetIndex() const
+{
+ return GetBlue();
+}
+
+inline void BitmapColor::SetIndex( sal_uInt8 cIndex )
+{
+ SetBlue(cIndex);
+}
+
+#endif // INCLUDED_VCL_BITMAPCOLOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapColorQuantizationFilter.hxx b/include/vcl/BitmapColorQuantizationFilter.hxx
new file mode 100644
index 000000000..266a384a3
--- /dev/null
+++ b/include/vcl/BitmapColorQuantizationFilter.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_INCLUDE_VCL_BITMAPCOLORQUANTIZATIONFILTER_HXX
+#define INCLUDED_INCLUDE_VCL_BITMAPCOLORQUANTIZATIONFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class VCL_DLLPUBLIC BitmapColorQuantizationFilter final : public BitmapFilter
+{
+public:
+ /** Reduce number of colors for the bitmap using the POPULAR algorithm
+
+ @param nNewColorCount
+ Maximal number of bitmap colors after the reduce operation
+ */
+ BitmapColorQuantizationFilter(sal_uInt16 nNewColorCount)
+ : mnNewColorCount(nNewColorCount)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ sal_uInt16 mnNewColorCount;
+
+ struct PopularColorCount
+ {
+ sal_uInt32 mnIndex;
+ sal_uInt32 mnCount;
+ };
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapConvolutionMatrixFilter.hxx b/include/vcl/BitmapConvolutionMatrixFilter.hxx
new file mode 100644
index 000000000..a504ff0ee
--- /dev/null
+++ b/include/vcl/BitmapConvolutionMatrixFilter.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPCONVOLUTIONMATRIXFILTER_HXX
+#define INCLUDED_VCL_BITMAPCONVOLUTIONMATRIXFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class BitmapEx;
+
+/** Filter image based on a 3x3 convolution matrix
+ */
+class VCL_DLLPUBLIC BitmapConvolutionMatrixFilter : public BitmapFilter
+{
+public:
+ BitmapConvolutionMatrixFilter(const sal_Int32 (&rMatrix)[9])
+ : mrMatrix(rMatrix)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ const sal_Int32 (&mrMatrix)[9];
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapDuoToneFilter.hxx b/include/vcl/BitmapDuoToneFilter.hxx
new file mode 100644
index 000000000..27ade1cb2
--- /dev/null
+++ b/include/vcl/BitmapDuoToneFilter.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPDUOTONEFILTER_HXX
+#define INCLUDED_VCL_BITMAPDUOTONEFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class BitmapEx;
+
+class BitmapDuoToneFilter final : public BitmapFilter
+{
+public:
+ BitmapDuoToneFilter(Color nColorOne, Color nColorTwo)
+ : mnColorOne(nColorOne)
+ , mnColorTwo(nColorTwo)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ Color mnColorOne;
+ Color mnColorTwo;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapEmbossGreyFilter.hxx b/include/vcl/BitmapEmbossGreyFilter.hxx
new file mode 100644
index 000000000..2f1d309e0
--- /dev/null
+++ b/include/vcl/BitmapEmbossGreyFilter.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPEMBOSSGREYFILTER_HXX
+#define INCLUDED_VCL_BITMAPEMBOSSGREYFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class BitmapEx;
+
+class VCL_DLLPUBLIC BitmapEmbossGreyFilter final : public BitmapFilter
+{
+public:
+ BitmapEmbossGreyFilter(sal_uInt16 nAzimuthAngle100, sal_uInt16 nElevationAngle100)
+ : mnAzimuthAngle100(nAzimuthAngle100)
+ , mnElevationAngle100(nElevationAngle100)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ sal_uInt16 mnAzimuthAngle100;
+ sal_uInt16 mnElevationAngle100;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapFilter.hxx b/include/vcl/BitmapFilter.hxx
new file mode 100644
index 000000000..c19d83b2d
--- /dev/null
+++ b/include/vcl/BitmapFilter.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPFILTER_HXX
+#define INCLUDED_VCL_BITMAPFILTER_HXX
+
+#include <vcl/bitmapex.hxx>
+#include <functional>
+
+class Animation;
+
+namespace vcl::bitmap
+{
+// Generates strip ranges and run the input function with the start and
+// end as parameters. The additional parameter bLast denotes if the
+// iteration is the last one.
+//
+// Example:
+// first = 0, last = 100, STRIP_SIZE = 32
+// this will generate:
+// [0, 31, false], [32, 63, false], [64, 95, false], [96, 100, true]
+template <int STRIP_SIZE>
+void generateStripRanges(
+ tools::Long nFirst, tools::Long nLast,
+ std::function<void(tools::Long const nStart, tools::Long const nEnd, bool const bLast)>
+ aFunction)
+{
+ tools::Long nStart = nFirst;
+ for (; nStart < nLast - STRIP_SIZE; nStart += STRIP_SIZE)
+ {
+ tools::Long nEnd = nStart + STRIP_SIZE - 1;
+ aFunction(nStart, nEnd, false);
+ }
+ aFunction(nStart, nLast, true);
+}
+
+} // end vcl::bitmap
+
+class VCL_DLLPUBLIC BitmapFilter
+{
+public:
+ BitmapFilter();
+ virtual ~BitmapFilter();
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const = 0;
+
+ static bool Filter(BitmapEx& rBmpEx, BitmapFilter const& rFilter);
+ static bool Filter(Animation& rBmpEx, BitmapFilter const& rFilter);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapFilterStackBlur.hxx b/include/vcl/BitmapFilterStackBlur.hxx
new file mode 100644
index 000000000..2fdb78b0b
--- /dev/null
+++ b/include/vcl/BitmapFilterStackBlur.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPFILTERSTACKBLUR_HXX
+#define INCLUDED_VCL_BITMAPFILTERSTACKBLUR_HXX
+
+#include <vcl/bitmap.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/BitmapFilter.hxx>
+
+class VCL_DLLPUBLIC BitmapFilterStackBlur final : public BitmapFilter
+{
+ sal_Int32 mnRadius;
+
+public:
+ BitmapFilterStackBlur(sal_Int32 nRadius);
+ virtual ~BitmapFilterStackBlur();
+
+ virtual BitmapEx execute(BitmapEx const& rBitmap) const override;
+
+ Bitmap filter(Bitmap const& rBitmap) const;
+};
+
+#endif // INCLUDED_VCL_BITMAPFILTERSTACKBLUR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapGaussianSeparableBlurFilter.hxx b/include/vcl/BitmapGaussianSeparableBlurFilter.hxx
new file mode 100644
index 000000000..72b3fdb81
--- /dev/null
+++ b/include/vcl/BitmapGaussianSeparableBlurFilter.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPGAUSSIANSEPARABLEBLURFILTER_HXX
+#define INCLUDED_VCL_BITMAPGAUSSIANSEPARABLEBLURFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+#include <vector>
+
+class BitmapEx;
+
+class BitmapGaussianSeparableBlurFilter final : public BitmapFilter
+{
+public:
+ BitmapGaussianSeparableBlurFilter(double fRadius)
+ : mfRadius(fRadius)
+ {
+ }
+
+ /** Separable Gaussian Blur filter and accepts a blur radius
+ as a parameter so the user can change the strength of the blur.
+ Radius of 1.0 is 3 * standard deviation of gauss function.
+
+ Separable Blur implementation uses 2x separable 1D convolution
+ to process the image.
+ */
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ double mfRadius;
+
+ static bool convolutionPass(const Bitmap& rBitmap, Bitmap& aNewBitmap,
+ BitmapReadAccess const* pReadAcc, int aNumberOfContributions,
+ const double* pWeights, int const* pPixels, const int* pCount);
+
+ static std::vector<double> makeBlurKernel(const double radius, int& rows);
+ static void blurContributions(const int aSize, const int aNumberOfContributions,
+ const std::vector<double>& rBlurVector,
+ std::vector<double>& rWeights, std::vector<int>& rPixels,
+ std::vector<int>& rCounts);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapInfoAccess.hxx b/include/vcl/BitmapInfoAccess.hxx
new file mode 100644
index 000000000..c0ef7fb5b
--- /dev/null
+++ b/include/vcl/BitmapInfoAccess.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_BITMAPINFOACCESS_HXX
+#define INCLUDED_VCL_BITMAPINFOACCESS_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/bitmap.hxx>
+#include <vcl/Scanline.hxx>
+#include <vcl/BitmapBuffer.hxx>
+#include <vcl/BitmapColor.hxx>
+#include <vcl/BitmapAccessMode.hxx>
+
+bool Bitmap32IsPreMultipled();
+
+typedef BitmapColor (*FncGetPixel)(ConstScanline pScanline, tools::Long nX, const ColorMask& rMask);
+typedef void (*FncSetPixel)(Scanline pScanline, tools::Long nX, const BitmapColor& rBitmapColor,
+ const ColorMask& rMask);
+
+class VCL_DLLPUBLIC BitmapInfoAccess
+{
+ friend class BitmapReadAccess;
+
+public:
+ BitmapInfoAccess(Bitmap& rBitmap, BitmapAccessMode nMode = BitmapAccessMode::Info);
+ virtual ~BitmapInfoAccess();
+
+ bool operator!() const { return mpBuffer == nullptr; }
+
+ tools::Long Width() const { return mpBuffer ? mpBuffer->mnWidth : 0L; }
+
+ tools::Long Height() const { return mpBuffer ? mpBuffer->mnHeight : 0L; }
+
+ bool IsTopDown() const
+ {
+ assert(mpBuffer && "Access is not valid!");
+
+ return mpBuffer && (mpBuffer->mnFormat & ScanlineFormat::TopDown);
+ }
+
+ bool IsBottomUp() const { return !IsTopDown(); }
+
+ ScanlineFormat GetScanlineFormat() const
+ {
+ assert(mpBuffer && "Access is not valid!");
+
+ return mpBuffer ? RemoveScanline(mpBuffer->mnFormat) : ScanlineFormat::NONE;
+ }
+
+ sal_uInt32 GetScanlineSize() const
+ {
+ assert(mpBuffer && "Access is not valid!");
+
+ return mpBuffer ? mpBuffer->mnScanlineSize : 0;
+ }
+
+ sal_uInt16 GetBitCount() const
+ {
+ assert(mpBuffer && "Access is not valid!");
+
+ return mpBuffer ? mpBuffer->mnBitCount : 0;
+ }
+
+ BitmapColor GetBestMatchingColor(const BitmapColor& rBitmapColor) const
+ {
+ if (HasPalette())
+ return BitmapColor(static_cast<sal_uInt8>(GetBestPaletteIndex(rBitmapColor)));
+ else
+ return rBitmapColor;
+ }
+
+ bool HasPalette() const
+ {
+ const BitmapBuffer* pBuffer = mpBuffer;
+
+ assert(pBuffer && "Access is not valid!");
+
+ return pBuffer && !!pBuffer->maPalette;
+ }
+
+ const BitmapPalette& GetPalette() const
+ {
+ const BitmapBuffer* pBuffer = mpBuffer;
+
+ assert(pBuffer && "Access is not valid!");
+
+ return pBuffer->maPalette;
+ }
+
+ sal_uInt16 GetPaletteEntryCount() const
+ {
+ const BitmapBuffer* pBuffer = mpBuffer;
+
+ assert(HasPalette() && "Bitmap has no palette!");
+
+ return HasPalette() ? pBuffer->maPalette.GetEntryCount() : 0;
+ }
+
+ const BitmapColor& GetPaletteColor(sal_uInt16 nColor) const
+ {
+ const BitmapBuffer* pBuffer = mpBuffer;
+ assert(pBuffer && "Access is not valid!");
+ assert(HasPalette() && "Bitmap has no palette!");
+
+ return pBuffer->maPalette[nColor];
+ }
+
+ sal_uInt16 GetBestPaletteIndex(const BitmapColor& rBitmapColor) const;
+
+ const ColorMask& GetColorMask() const
+ {
+ const BitmapBuffer* pBuffer = mpBuffer;
+
+ assert(pBuffer && "Access is not valid!");
+
+ return pBuffer->maColorMask;
+ }
+
+private:
+ BitmapInfoAccess(const BitmapInfoAccess&) = delete;
+ BitmapInfoAccess& operator=(const BitmapInfoAccess&) = delete;
+
+protected:
+ Bitmap maBitmap;
+ BitmapBuffer* mpBuffer;
+ ColorMask maColorMask;
+ BitmapAccessMode mnAccessMode;
+};
+
+#endif // INCLUDED_VCL_BITMAPINFOACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapMedianFilter.hxx b/include/vcl/BitmapMedianFilter.hxx
new file mode 100644
index 000000000..941ba0dae
--- /dev/null
+++ b/include/vcl/BitmapMedianFilter.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPMEDIANFILTER_HXX
+#define INCLUDED_VCL_BITMAPMEDIANFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class BitmapEx;
+
+class VCL_DLLPUBLIC BitmapMedianFilter final : public BitmapFilter
+{
+public:
+ BitmapMedianFilter() {}
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapMonochromeFilter.hxx b/include/vcl/BitmapMonochromeFilter.hxx
new file mode 100644
index 000000000..81a505e1f
--- /dev/null
+++ b/include/vcl/BitmapMonochromeFilter.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_INCLUDE_VCL_BITMAPMONOCHROMEFILTER_HXX
+#define INCLUDED_INCLUDE_VCL_BITMAPMONOCHROMEFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class VCL_DLLPUBLIC BitmapMonochromeFilter final : public BitmapFilter
+{
+public:
+ /** Convert to 2 color bitmap.
+
+ Converts to a 2 color indexed bitmap - note that we don't change to black
+ and white monochrome, but we pick the closest color to black and white in
+ the bitmap.
+
+ @param cThreshold
+ Luminance value that determines whether the colour should be black (or
+ closest color to black) or white (or closest color to white).
+
+ */
+ BitmapMonochromeFilter(sal_uInt8 cThreshold)
+ : mcThreshold(cThreshold)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ sal_uInt8 mcThreshold;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapMosaicFilter.hxx b/include/vcl/BitmapMosaicFilter.hxx
new file mode 100644
index 000000000..92a5afda4
--- /dev/null
+++ b/include/vcl/BitmapMosaicFilter.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPMOSAICFILTER_HXX
+#define INCLUDED_VCL_BITMAPMOSAICFILTER_HXX
+
+#include <sal/config.h>
+
+#include <algorithm>
+
+#include <vcl/BitmapFilter.hxx>
+
+class BitmapEx;
+
+class VCL_DLLPUBLIC BitmapMosaicFilter final : public BitmapFilter
+{
+public:
+ BitmapMosaicFilter(sal_Int32 nTileWidth, sal_Int32 nTileHeight)
+ : mnTileWidth(std::max(nTileWidth, sal_Int32(1)))
+ , mnTileHeight(std::max(nTileHeight, sal_Int32(1)))
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ sal_Int32 mnTileWidth;
+ sal_Int32 mnTileHeight;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapPalette.hxx b/include/vcl/BitmapPalette.hxx
new file mode 100644
index 000000000..d470dfbb5
--- /dev/null
+++ b/include/vcl/BitmapPalette.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <vcl/BitmapColor.hxx>
+#include <vcl/checksum.hxx>
+#include <o3tl/cow_wrapper.hxx>
+
+class ImplBitmapPalette;
+
+class VCL_DLLPUBLIC BitmapPalette
+{
+ friend class SalBitmap;
+ friend class BitmapAccess;
+
+public:
+
+ SAL_DLLPRIVATE const BitmapColor* ImplGetColorBuffer() const;
+
+ SAL_DLLPRIVATE BitmapColor* ImplGetColorBuffer();
+
+ BitmapChecksum GetChecksum() const;
+
+ BitmapPalette();
+ BitmapPalette( const BitmapPalette& );
+ BitmapPalette( BitmapPalette&& ) noexcept;
+ BitmapPalette(std::initializer_list<BitmapColor> aBitmapColor);
+ explicit BitmapPalette(sal_uInt16 nCount);
+ ~BitmapPalette();
+
+ BitmapPalette& operator=( const BitmapPalette& );
+ BitmapPalette& operator=( BitmapPalette&& ) noexcept;
+
+ bool operator==( const BitmapPalette& rBitmapPalette ) const;
+ bool operator!=(const BitmapPalette& rBitmapPalette) const
+ {
+ return !( *this == rBitmapPalette );
+ }
+ bool operator!() const;
+
+ sal_uInt16 GetEntryCount() const;
+ void SetEntryCount(sal_uInt16 nCount);
+
+ const BitmapColor& operator[](sal_uInt16 nIndex) const;
+ BitmapColor& operator[](sal_uInt16 nIndex);
+
+ sal_uInt16 GetBestIndex(const BitmapColor& rCol) const;
+
+ /// Returns true if the palette is 8-bit grey palette.
+ bool IsGreyPalette8Bit() const;
+ /// Returns true if the palette is a grey palette (may not be 8-bit).
+ bool IsGreyPaletteAny() const;
+
+ typedef o3tl::cow_wrapper< ImplBitmapPalette > ImplType;
+
+private:
+ ImplType mpImpl;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapPopArtFilter.hxx b/include/vcl/BitmapPopArtFilter.hxx
new file mode 100644
index 000000000..e5733f733
--- /dev/null
+++ b/include/vcl/BitmapPopArtFilter.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPPOPARTILTER_HXX
+#define INCLUDED_VCL_BITMAPPOPARTILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class VCL_DLLPUBLIC BitmapPopArtFilter final : public BitmapFilter
+{
+public:
+ BitmapPopArtFilter() {}
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ struct PopArtEntry
+ {
+ sal_uInt32 mnIndex;
+ sal_uInt32 mnCount;
+ };
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapReadAccess.hxx b/include/vcl/BitmapReadAccess.hxx
new file mode 100644
index 000000000..76d1cddbe
--- /dev/null
+++ b/include/vcl/BitmapReadAccess.hxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_BITMAPREADACCESS_HXX
+#define INCLUDED_VCL_BITMAPREADACCESS_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/bitmap.hxx>
+#include <vcl/Scanline.hxx>
+#include <vcl/BitmapBuffer.hxx>
+#include <vcl/BitmapColor.hxx>
+#include <vcl/BitmapAccessMode.hxx>
+#include <vcl/BitmapInfoAccess.hxx>
+
+class SAL_DLLPUBLIC_RTTI BitmapReadAccess : public BitmapInfoAccess
+{
+ friend class BitmapWriteAccess;
+
+public:
+ VCL_DLLPUBLIC BitmapReadAccess(Bitmap& rBitmap,
+ BitmapAccessMode nMode = BitmapAccessMode::Read);
+ VCL_DLLPUBLIC virtual ~BitmapReadAccess() override;
+
+ Scanline GetBuffer() const
+ {
+ assert(mpBuffer && "Access is not valid!");
+
+ return mpBuffer ? mpBuffer->mpBits : nullptr;
+ }
+
+ Scanline GetScanline(tools::Long nY) const
+ {
+ assert(mpBuffer && "Access is not valid!");
+ assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
+
+ if (mpBuffer->mnFormat & ScanlineFormat::TopDown)
+ {
+ return mpBuffer->mpBits + (nY * mpBuffer->mnScanlineSize);
+ }
+ return mpBuffer->mpBits + ((mpBuffer->mnHeight - 1 - nY) * mpBuffer->mnScanlineSize);
+ }
+
+ BitmapColor GetPixelFromData(const sal_uInt8* pData, tools::Long nX) const
+ {
+ assert(pData && "Access is not valid!");
+
+ return mFncGetPixel(pData, nX, maColorMask);
+ }
+
+ sal_uInt8 GetIndexFromData(const sal_uInt8* pData, tools::Long nX) const
+ {
+ return GetPixelFromData(pData, nX).GetIndex();
+ }
+
+ void SetPixelOnData(sal_uInt8* pData, tools::Long nX, const BitmapColor& rBitmapColor)
+ {
+ assert(pData && "Access is not valid!");
+
+ mFncSetPixel(pData, nX, rBitmapColor, maColorMask);
+ }
+
+ BitmapColor GetPixel(tools::Long nY, tools::Long nX) const
+ {
+ assert(mpBuffer && "Access is not valid!");
+ assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!");
+ assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
+
+ return mFncGetPixel(GetScanline(nY), nX, maColorMask);
+ }
+
+ BitmapColor GetPixel(const Point& point) const { return GetPixel(point.Y(), point.X()); }
+
+ BitmapColor GetColor(tools::Long nY, tools::Long nX) const
+ {
+ if (HasPalette())
+ {
+ const BitmapBuffer* pBuffer = mpBuffer;
+ return pBuffer->maPalette[GetPixelIndex(nY, nX)];
+ }
+ else
+ return GetPixel(nY, nX);
+ }
+
+ BitmapColor GetColor(const Point& point) const { return GetColor(point.Y(), point.X()); }
+
+ sal_uInt8 GetPixelIndex(tools::Long nY, tools::Long nX) const
+ {
+ return GetPixel(nY, nX).GetIndex();
+ }
+
+ sal_uInt8 GetPixelIndex(const Point& point) const
+ {
+ return GetPixelIndex(point.Y(), point.X());
+ }
+
+ /** Get the interpolated color at coordinates fY, fX; if outside, return rFallback */
+ BitmapColor GetInterpolatedColorWithFallback(double fY, double fX,
+ const BitmapColor& rFallback) const;
+
+ /** Get the color at coordinates fY, fX; if outside, return rFallback. Automatically does the correct
+ inside/outside checks, e.g. static_cast< sal_uInt32 >(-0.25) *is* 0, not -1 and has to be outside */
+ BitmapColor GetColorWithFallback(double fY, double fX, const BitmapColor& rFallback) const;
+
+private:
+ BitmapReadAccess(const BitmapReadAccess&) = delete;
+ BitmapReadAccess& operator=(const BitmapReadAccess&) = delete;
+
+protected:
+ FncGetPixel mFncGetPixel;
+ FncSetPixel mFncSetPixel;
+
+public:
+ BitmapBuffer* ImplGetBitmapBuffer() const { return mpBuffer; }
+
+ static BitmapColor GetPixelForN1BitMsbPal(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN1BitLsbPal(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN8BitPal(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN24BitTcBgr(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN24BitTcRgb(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN32BitTcAbgr(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN32BitTcXbgr(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN32BitTcArgb(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN32BitTcXrgb(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN32BitTcBgra(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN32BitTcBgrx(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN32BitTcRgba(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN32BitTcRgbx(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+ static BitmapColor GetPixelForN32BitTcMask(ConstScanline pScanline, tools::Long nX,
+ const ColorMask& rMask);
+
+ static void SetPixelForN1BitMsbPal(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN1BitLsbPal(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN8BitPal(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN24BitTcBgr(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN24BitTcRgb(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN32BitTcAbgr(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN32BitTcXbgr(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN32BitTcArgb(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN32BitTcXrgb(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN32BitTcBgra(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN32BitTcBgrx(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN32BitTcRgba(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN32BitTcRgbx(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelForN32BitTcMask(Scanline pScanline, tools::Long nX,
+ const BitmapColor& rBitmapColor, const ColorMask& rMask);
+
+ static FncGetPixel GetPixelFunction(ScanlineFormat nFormat);
+ static FncSetPixel SetPixelFunction(ScanlineFormat nFormat);
+};
+
+#endif // INCLUDED_VCL_BITMAPREADACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapSeparableUnsharpenFilter.hxx b/include/vcl/BitmapSeparableUnsharpenFilter.hxx
new file mode 100644
index 000000000..69dcfe3bf
--- /dev/null
+++ b/include/vcl/BitmapSeparableUnsharpenFilter.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPSEPARABLEUNSHARPENFILTER_HXX
+#define INCLUDED_VCL_BITMAPSEPARABLEUNSHARPENFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class BitmapEx;
+
+/** Separable Unsharpen Mask filter is actually a subtracted blurred
+ image from the original image.
+ */
+class BitmapSeparableUnsharpenFilter final : public BitmapFilter
+{
+public:
+ BitmapSeparableUnsharpenFilter(double fRadius)
+ : mfRadius(fRadius)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ double mfRadius;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapSepiaFilter.hxx b/include/vcl/BitmapSepiaFilter.hxx
new file mode 100644
index 000000000..3121987ed
--- /dev/null
+++ b/include/vcl/BitmapSepiaFilter.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPSEPIAFILTER_HXX
+#define INCLUDED_VCL_BITMAPSEPIAFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class BitmapEx;
+
+class VCL_DLLPUBLIC BitmapSepiaFilter final : public BitmapFilter
+{
+public:
+ BitmapSepiaFilter(double nSepiaPercent)
+ {
+ // clamp value to 100%
+ if (nSepiaPercent <= 100)
+ mnSepiaPercent = nSepiaPercent;
+ else
+ mnSepiaPercent = 100;
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ sal_uInt16 mnSepiaPercent;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapShadowFilter.hxx b/include/vcl/BitmapShadowFilter.hxx
new file mode 100644
index 000000000..d4a3207a1
--- /dev/null
+++ b/include/vcl/BitmapShadowFilter.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/BitmapFilter.hxx>
+
+/** If the alpha is beyond a certain threshold, make it fully transparent
+ */
+class VCL_DLLPUBLIC BitmapShadowFilter final : public BitmapFilter
+{
+public:
+ BitmapShadowFilter(Color aShadowColor)
+ : maShadowColor(aShadowColor)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ Color maShadowColor;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapSharpenFilter.hxx b/include/vcl/BitmapSharpenFilter.hxx
new file mode 100644
index 000000000..079e1d418
--- /dev/null
+++ b/include/vcl/BitmapSharpenFilter.hxx
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPSHARPENFILTER_HXX
+#define INCLUDED_VCL_BITMAPSHARPENFILTER_HXX
+
+#include <vcl/BitmapConvolutionMatrixFilter.hxx>
+
+class VCL_DLLPUBLIC BitmapSharpenFilter final : public BitmapConvolutionMatrixFilter
+{
+public:
+ BitmapSharpenFilter();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapSimpleColorQuantizationFilter.hxx b/include/vcl/BitmapSimpleColorQuantizationFilter.hxx
new file mode 100644
index 000000000..7e306e051
--- /dev/null
+++ b/include/vcl/BitmapSimpleColorQuantizationFilter.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_INCLUDE_VCL_BITMAPSIMPLECOLORQUANTIZATIONFILTER_HXX
+#define INCLUDED_INCLUDE_VCL_BITMAPSIMPLECOLORQUANTIZATIONFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class VCL_DLLPUBLIC BitmapSimpleColorQuantizationFilter final : public BitmapFilter
+{
+public:
+ /** Reduce number of colors for the bitmap using the POPULAR algorithm
+
+ @param nNewColorCount
+ Maximal number of bitmap colors after the reduce operation
+ */
+ BitmapSimpleColorQuantizationFilter(sal_uInt16 nNewColorCount)
+ : mnNewColorCount(nNewColorCount)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ sal_uInt16 mnNewColorCount;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapSmoothenFilter.hxx b/include/vcl/BitmapSmoothenFilter.hxx
new file mode 100644
index 000000000..1a002c960
--- /dev/null
+++ b/include/vcl/BitmapSmoothenFilter.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPSMOOTHENFILTER_HXX
+#define INCLUDED_VCL_BITMAPSMOOTHENFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class BitmapEx;
+
+class VCL_DLLPUBLIC BitmapSmoothenFilter final : public BitmapFilter
+{
+public:
+ BitmapSmoothenFilter(double fRadius)
+ : mfRadius(fRadius)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ double mfRadius;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapSobelGreyFilter.hxx b/include/vcl/BitmapSobelGreyFilter.hxx
new file mode 100644
index 000000000..31e56bf5a
--- /dev/null
+++ b/include/vcl/BitmapSobelGreyFilter.hxx
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPSOBELGREYILTER_HXX
+#define INCLUDED_VCL_BITMAPSOBELGREYILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class VCL_DLLPUBLIC BitmapSobelGreyFilter final : public BitmapFilter
+{
+public:
+ BitmapSobelGreyFilter() {}
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapSolarizeFilter.hxx b/include/vcl/BitmapSolarizeFilter.hxx
new file mode 100644
index 000000000..f3e36e10f
--- /dev/null
+++ b/include/vcl/BitmapSolarizeFilter.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_BITMAPSOLARIZEFILTER_HXX
+#define INCLUDED_VCL_BITMAPSOLARIZEFILTER_HXX
+
+#include <vcl/BitmapFilter.hxx>
+
+class BitmapEx;
+
+class VCL_DLLPUBLIC BitmapSolarizeFilter final : public BitmapFilter
+{
+public:
+ BitmapSolarizeFilter(double cSolarGreyThreshold)
+ : mcSolarGreyThreshold(cSolarGreyThreshold)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ sal_uInt8 mcSolarGreyThreshold;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx
new file mode 100644
index 000000000..36ccd707a
--- /dev/null
+++ b/include/vcl/BitmapTools.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_BITMAP_TOOLS_HXX
+#define INCLUDED_VCL_BITMAP_TOOLS_HXX
+
+#include <config_cairo_canvas.h>
+#include <config_wasm_strip.h>
+
+#include <vcl/bitmapex.hxx>
+#include <vcl/ImageTree.hxx>
+#if ENABLE_CAIRO_CANVAS
+#include <vcl/cairo.hxx>
+#endif
+#include <basegfx/range/b2drectangle.hxx>
+#include <array>
+#include <vcl/RawBitmap.hxx>
+
+class SvStream;
+namespace basegfx { class B2DHomMatrix; }
+namespace com::sun::star::geometry { struct IntegerRectangle2D; }
+
+namespace vcl::bitmap {
+
+#if !ENABLE_WASM_STRIP_PREMULTIPLY
+typedef std::array<std::array<sal_uInt8, 256>, 256> lookup_table;
+
+VCL_DLLPUBLIC lookup_table const & get_premultiply_table();
+VCL_DLLPUBLIC lookup_table const & get_unpremultiply_table();
+#endif
+
+sal_uInt8 unpremultiply(sal_uInt8 c, sal_uInt8 a);
+sal_uInt8 premultiply(sal_uInt8 c, sal_uInt8 a);
+
+BitmapEx VCL_DLLPUBLIC loadFromName(const OUString& rFileName, const ImageLoadFlags eFlags = ImageLoadFlags::NONE);
+
+void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, double fScaleFactor);
+
+/** Copy block of image data into the bitmap.
+ Assumes that the Bitmap has been constructed with the desired size.
+
+ @param pData
+ The block of data to copy
+ @param nStride
+ The number of bytes in a scanline, must be >= (width * bitcount / 8)
+*/
+BitmapEx VCL_DLLPUBLIC CreateFromData(sal_uInt8 const *pData,
+ sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride,
+ vcl::PixelFormat ePixelFormat,
+ bool bReversColors = false, bool bReverseAlpha = false);
+
+BitmapEx VCL_DLLPUBLIC CreateFromData( RawBitmap && data );
+
+#if ENABLE_CAIRO_CANVAS
+VCL_DLLPUBLIC BitmapEx* CreateFromCairoSurface(Size size, cairo_surface_t* pSurface);
+#endif
+
+VCL_DLLPUBLIC BitmapEx CanvasTransformBitmap( const BitmapEx& rBitmap,
+ const ::basegfx::B2DHomMatrix& rTransform,
+ ::basegfx::B2DRectangle const & rDestRect,
+ ::basegfx::B2DHomMatrix const & rLocalTransform );
+
+VCL_DLLPUBLIC void DrawAlphaBitmapAndAlphaGradient(BitmapEx & rBitmapEx, bool bFixedTransparence, float fTransparence, AlphaMask & rNewMask);
+
+VCL_DLLPUBLIC void DrawAndClipBitmap(const Point& rPos, const Size& rSize, const BitmapEx& rBitmap, BitmapEx & aBmpEx, basegfx::B2DPolyPolygon const & rClipPath);
+
+VCL_DLLPUBLIC css::uno::Sequence< sal_Int8 > GetMaskDIB(BitmapEx const & aBmpEx);
+
+/**
+ * @param data will be filled with alpha data, if xBitmap is alpha/transparent image
+ * @param bHasAlpha will be set to true if resulting surface has alpha
+ **/
+VCL_DLLPUBLIC void CanvasCairoExtractBitmapData( BitmapEx const & rBmpEx, Bitmap & rBitmap, unsigned char*& data, bool& bHasAlpha, tools::Long& rnWidth, tools::Long& rnHeight );
+
+VCL_DLLPUBLIC css::uno::Sequence< sal_Int8 > CanvasExtractBitmapData(BitmapEx const & rBitmapEx, const css::geometry::IntegerRectangle2D& rect);
+
+// helper to construct historical 8x8 bitmaps with two colors
+
+BitmapEx VCL_DLLPUBLIC createHistorical8x8FromArray(std::array<sal_uInt8,64> const & pArray, Color aColorPix, Color aColorBack);
+bool VCL_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, Color& o_rBack, Color& o_rFront);
+
+VCL_DLLPUBLIC bool convertBitmap32To24Plus8(BitmapEx const & rInput, BitmapEx & rResult);
+
+/** Retrieve downsampled and cropped bitmap
+
+ Takes destination size in twips units.
+
+ @attention This method ignores negative rDstSz values, thus
+ mirroring must happen outside this method (e.g. in DrawBitmap)
+ */
+VCL_DLLPUBLIC Bitmap GetDownsampledBitmap(Size const& rDstSizeTwip, Point const& rSrcPt, Size const& rSrcSz,
+ Bitmap const& rBmp, tools::Long nMaxBmpDPIX, tools::Long nMaxBmpDPIY);
+
+} // end vcl::bitmap
+
+#endif // INCLUDED_VCL_BITMAP_TOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/ColorMask.hxx b/include/vcl/ColorMask.hxx
new file mode 100644
index 000000000..7610aa87e
--- /dev/null
+++ b/include/vcl/ColorMask.hxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_COLORMASK_HXX
+#define INCLUDED_VCL_COLORMASK_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/BitmapColor.hxx>
+
+#define MASK_TO_COLOR( d_nVal, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS, d_Col ) \
+const sal_uInt8 _def_cR = static_cast<sal_uInt8>( d_RS < 0 ? ( (d_nVal) & d_RM ) << -d_RS : ( (d_nVal) & d_RM ) >> d_RS ); \
+const sal_uInt8 _def_cG = static_cast<sal_uInt8>( d_GS < 0 ? ( (d_nVal) & d_GM ) << -d_GS : ( (d_nVal) & d_GM ) >> d_GS ); \
+const sal_uInt8 _def_cB = static_cast<sal_uInt8>( d_BS < 0 ? ( (d_nVal) & d_BM ) << -d_BS : ( (d_nVal) & d_BM ) >> d_BS ); \
+d_Col = BitmapColor( static_cast<sal_uInt8>( _def_cR | ( ( _def_cR & maR.mnOr ) >> maR.mnOrShift ) ), \
+ static_cast<sal_uInt8>( _def_cG | ( ( _def_cG & maG.mnOr ) >> maG.mnOrShift ) ), \
+ static_cast<sal_uInt8>( _def_cB | ( ( _def_cB & maB.mnOr ) >> maB.mnOrShift ) ) );
+
+
+#define COLOR_TO_MASK( d_rCol, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS, d_ALPHA ) \
+( ( ( ( d_RS < 0 ) ? ( static_cast<sal_uInt32>((d_rCol).GetRed()) >> -d_RS ) : \
+ ( static_cast<sal_uInt32>((d_rCol).GetRed()) << d_RS ) ) & d_RM ) | \
+ ( ( ( d_GS < 0 ) ? ( static_cast<sal_uInt32>((d_rCol).GetGreen()) >> -d_GS ) : \
+ ( static_cast<sal_uInt32>((d_rCol).GetGreen()) << d_GS ) ) & d_GM ) | \
+ ( ( ( d_BS < 0 ) ? ( static_cast<sal_uInt32>((d_rCol).GetBlue()) >> -d_BS ) : \
+ ( static_cast<sal_uInt32>((d_rCol).GetBlue()) << d_BS ) ) & d_BM ) | \
+ d_ALPHA )
+
+
+struct VCL_DLLPUBLIC ColorMaskElement
+{
+ sal_uInt32 mnMask;
+ int mnShift;
+ int mnOrShift;
+ sal_uInt8 mnOr;
+ explicit ColorMaskElement(sal_uInt32 nMask = 0)
+ : mnMask(nMask)
+ , mnShift(0)
+ , mnOrShift(0)
+ , mnOr(0)
+ {
+ }
+ bool CalcMaskShift()
+ {
+ if (mnMask == 0)
+ return true;
+
+ // from which bit starts the mask?
+ int nShift = 31;
+
+ while( nShift >= 0 && !( mnMask & ( 1 << nShift ) ) )
+ --nShift;
+
+ mnShift = nShift - 7;
+ int nLen = 0;
+
+ // XXX determine number of bits set => walk right until null
+ while( nShift >= 0 && ( mnMask & ( 1 << nShift ) ) )
+ {
+ nShift--;
+ nLen++;
+ }
+
+ if (nLen > 8) // mask length must be 8 bits or less
+ return false;
+
+ mnOrShift = 8 - nLen;
+ mnOr = static_cast<sal_uInt8>( ( 0xFF >> nLen ) << mnOrShift );
+
+ return true;
+ }
+};
+
+class VCL_DLLPUBLIC ColorMask
+{
+ ColorMaskElement maR;
+ ColorMaskElement maG;
+ ColorMaskElement maB;
+
+public:
+
+ ColorMask(const ColorMaskElement& rRedMask = ColorMaskElement(),
+ const ColorMaskElement& rGreenMask = ColorMaskElement(),
+ const ColorMaskElement& rBlueMask = ColorMaskElement())
+ : maR(rRedMask)
+ , maG(rGreenMask)
+ , maB(rBlueMask)
+ {
+ }
+
+ inline sal_uInt32 GetRedMask() const;
+ inline sal_uInt32 GetGreenMask() const;
+ inline sal_uInt32 GetBlueMask() const;
+
+ inline void GetColorFor16BitMSB( BitmapColor& rColor, const sal_uInt8* pPixel ) const;
+ inline void SetColorFor16BitMSB( const BitmapColor& rColor, sal_uInt8* pPixel ) const;
+ inline void GetColorFor16BitLSB( BitmapColor& rColor, const sal_uInt8* pPixel ) const;
+ inline void SetColorFor16BitLSB( const BitmapColor& rColor, sal_uInt8* pPixel ) const;
+
+ inline void GetColorFor32Bit( BitmapColor& rColor, const sal_uInt8* pPixel ) const;
+ inline void GetColorAndAlphaFor32Bit( BitmapColor& rColor, sal_uInt8& rAlpha, const sal_uInt8* pPixel ) const;
+ inline void SetColorFor32Bit( const BitmapColor& rColor, sal_uInt8* pPixel ) const;
+};
+
+inline sal_uInt32 ColorMask::GetRedMask() const
+{
+ return maR.mnMask;
+}
+
+inline sal_uInt32 ColorMask::GetGreenMask() const
+{
+ return maG.mnMask;
+}
+
+inline sal_uInt32 ColorMask::GetBlueMask() const
+{
+ return maB.mnMask;
+}
+
+inline void ColorMask::GetColorFor16BitMSB( BitmapColor& rColor, const sal_uInt8* pPixel ) const
+{
+ const sal_uInt32 nVal = pPixel[ 1 ] | ( static_cast<sal_uInt32>(pPixel[ 0 ]) << 8 );
+
+ MASK_TO_COLOR( nVal, maR.mnMask, maG.mnMask, maB.mnMask, maR.mnShift, maG.mnShift, maB.mnShift, rColor );
+}
+
+inline void ColorMask::SetColorFor16BitMSB( const BitmapColor& rColor, sal_uInt8* pPixel ) const
+{
+ const sal_uInt16 nVal = static_cast<sal_uInt16>(COLOR_TO_MASK( rColor, maR.mnMask, maG.mnMask, maB.mnMask, maR.mnShift, maG.mnShift, maB.mnShift, 0/*nAlphaChannel*/ ));
+
+ pPixel[ 0 ] = static_cast<sal_uInt8>(nVal >> 8);
+ pPixel[ 1 ] = static_cast<sal_uInt8>(nVal);
+}
+
+inline void ColorMask::GetColorFor16BitLSB( BitmapColor& rColor, const sal_uInt8* pPixel ) const
+{
+ const sal_uInt32 nVal = pPixel[ 0 ] | ( static_cast<sal_uInt32>(pPixel[ 1 ]) << 8 );
+
+ MASK_TO_COLOR( nVal, maR.mnMask, maG.mnMask, maB.mnMask, maR.mnShift, maG.mnShift, maB.mnShift, rColor );
+}
+
+inline void ColorMask::SetColorFor16BitLSB( const BitmapColor& rColor, sal_uInt8* pPixel ) const
+{
+ const sal_uInt16 nVal = static_cast<sal_uInt16>(COLOR_TO_MASK( rColor, maR.mnMask, maG.mnMask, maB.mnMask, maR.mnShift, maG.mnShift, maB.mnShift, 0/*nAlphaChannel*/ ));
+
+ pPixel[ 0 ] = static_cast<sal_uInt8>(nVal);
+ pPixel[ 1 ] = static_cast<sal_uInt8>(nVal >> 8);
+}
+
+inline void ColorMask::GetColorFor32Bit( BitmapColor& rColor, const sal_uInt8* pPixel ) const
+{
+ const sal_uInt32 nVal = static_cast<sal_uInt32>(pPixel[ 0 ]) | ( static_cast<sal_uInt32>(pPixel[ 1 ]) << 8 ) |
+ ( static_cast<sal_uInt32>(pPixel[ 2 ]) << 16 ) | ( static_cast<sal_uInt32>(pPixel[ 3 ]) << 24 );
+
+ MASK_TO_COLOR( nVal, maR.mnMask, maG.mnMask, maB.mnMask, maR.mnShift, maG.mnShift, maB.mnShift, rColor );
+}
+
+inline void ColorMask::GetColorAndAlphaFor32Bit( BitmapColor& rColor, sal_uInt8& rAlpha, const sal_uInt8* pPixel ) const
+{
+ const sal_uInt32 nVal = static_cast<sal_uInt32>(pPixel[ 0 ]) | ( static_cast<sal_uInt32>(pPixel[ 1 ]) << 8 ) |
+ ( static_cast<sal_uInt32>(pPixel[ 2 ]) << 16 ) | ( static_cast<sal_uInt32>(pPixel[ 3 ]) << 24 );
+ rAlpha = static_cast<sal_uInt8>(nVal >> 24);
+
+ MASK_TO_COLOR( nVal, maR.mnMask, maG.mnMask, maB.mnMask, maR.mnShift, maG.mnShift, maB.mnShift, rColor );
+}
+
+inline void ColorMask::SetColorFor32Bit( const BitmapColor& rColor, sal_uInt8* pPixel ) const
+{
+ const sal_uInt32 nVal = COLOR_TO_MASK( rColor, maR.mnMask, maG.mnMask, maB.mnMask, maR.mnShift, maG.mnShift, maB.mnShift, 0/*nAlphaChannel*/ );
+ pPixel[ 0 ] = static_cast<sal_uInt8>(nVal);
+ pPixel[ 1 ] = static_cast<sal_uInt8>( nVal >> 8 );
+ pPixel[ 2 ] = static_cast<sal_uInt8>( nVal >> 16 );
+ pPixel[ 3 ] = static_cast<sal_uInt8>( nVal >> 24 );
+}
+
+#endif // INCLUDED_VCL_COLORMASK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/EnumContext.hxx b/include/vcl/EnumContext.hxx
new file mode 100644
index 000000000..9d82e72ad
--- /dev/null
+++ b/include/vcl/EnumContext.hxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_ENUMCONTEXT_HXX
+#define INCLUDED_VCL_ENUMCONTEXT_HXX
+
+#include <vcl/dllapi.h>
+
+#include <rtl/ustring.hxx>
+
+
+namespace vcl {
+
+class VCL_DLLPUBLIC EnumContext
+{
+public:
+ enum class Application
+ {
+ Writer,
+ WriterGlobal,
+ WriterWeb,
+ WriterXML,
+ WriterForm,
+ WriterReport,
+ Calc,
+ Chart,
+ Draw,
+ Impress,
+ Formula,
+ Base,
+
+ // For your convenience to avoid duplicate code in the common
+ // case that Draw and Impress use identical context configurations.
+ DrawImpress,
+
+ // Also for your convenience for the different variants of Writer documents.
+ WriterVariants,
+
+ // Used only by deck or panel descriptors. Matches any
+ // application.
+ Any,
+
+ // Use this only in special circumstances. One might be the
+ // wish to disable a deck or panel during debugging.
+ NONE,
+
+ LAST = Application::NONE
+ };
+ enum class Context
+ {
+ ThreeDObject,
+ Annotation,
+ Auditing,
+ Axis,
+ Cell,
+ Chart,
+ ChartElements,
+ Draw,
+ DrawFontwork,
+ DrawLine,
+ DrawPage,
+ DrawText,
+ EditCell,
+ ErrorBar,
+ Form,
+ Frame,
+ Graphic,
+ Grid,
+ HandoutPage,
+ MasterPage,
+ Math,
+ Media,
+ MultiObject,
+ NotesPage,
+ OLE,
+ OutlineText,
+ Pivot,
+ Printpreview,
+ Series,
+ SlidesorterPage,
+ Table,
+ Text,
+ TextObject,
+ Trendline,
+ Sparkline,
+
+ // Default context of an application. Do we need this?
+ Default,
+
+ // Used only by deck or panel descriptors. Matches any context.
+ Any,
+
+ // Special context name that is only used when a deck would
+ // otherwise be empty.
+ Empty,
+
+ Unknown,
+
+ LAST = Unknown
+ };
+
+ EnumContext();
+ EnumContext (
+ const Application eApplication,
+ const Context eContext);
+
+ /** This variant of the GetCombinedContext() method treats some
+ application names as identical to each other. Replacements
+ made are:
+ Draw or Impress -> DrawImpress
+ Writer or WriterWeb -> WriterAndWeb
+ Use the Application::DrawImpress or Application::WriterAndWeb values in the CombinedEnumContext macro.
+ */
+ sal_Int32 GetCombinedContext_DI() const;
+
+ Application GetApplication_DI() const;
+
+ bool operator == (const EnumContext& rOther) const;
+ bool operator != (const EnumContext& rOther) const;
+
+ /** When two contexts are matched against each other, then
+ application or context name may have the wildcard value 'any'.
+ In order to prefer matches without wildcards over matches with
+ wildcards we introduce an integer evaluation for matches.
+ */
+ const static sal_Int32 NoMatch;
+
+ static Application GetApplicationEnum (const OUString& rsApplicationName);
+ static const OUString& GetApplicationName (const Application eApplication);
+
+ static Context GetContextEnum (const OUString& rsContextName);
+ static const OUString& GetContextName (const Context eContext);
+
+private:
+ Application meApplication;
+ Context meContext;
+
+ static void ProvideApplicationContainers();
+ static void ProvideContextContainers();
+ static void AddEntry (const OUString& rsName, const Application eApplication);
+ static void AddEntry (const OUString& rsName, const Context eContext);
+};
+
+
+#define CombinedEnumContext(a,e) ((static_cast<sal_uInt16>(::vcl::EnumContext::a)<<16)\
+ | static_cast<sal_uInt16>(::vcl::EnumContext::e))
+
+} // end of namespace vcl
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/FilterConfigItem.hxx b/include/vcl/FilterConfigItem.hxx
new file mode 100644
index 000000000..45692fedb
--- /dev/null
+++ b/include/vcl/FilterConfigItem.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_VCL_FILTERCONFIGITEM_HXX
+#define INCLUDED_VCL_FILTERCONFIGITEM_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <vcl/dllapi.h>
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::task { class XStatusIndicator; }
+namespace com::sun::star::uno { class Any; }
+namespace com::sun::star::uno { class XInterface; }
+
+class VCL_DLLPUBLIC FilterConfigItem
+{
+ css::uno::Reference< css::uno::XInterface > xUpdatableView;
+ css::uno::Reference< css::beans::XPropertySet > xPropSet;
+ css::uno::Sequence< css::beans::PropertyValue > aFilterData;
+
+ bool bModified;
+
+ static bool ImplGetPropertyValue( css::uno::Any& rAny,
+ const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
+ const OUString& rPropName );
+
+ void ImpInitTree( std::u16string_view rTree );
+
+
+ static const css::beans::PropertyValue* GetPropertyValue(
+ const css::uno::Sequence< css::beans::PropertyValue >& rPropSeq,
+ const OUString& rName );
+ static bool WritePropertyValue(
+ css::uno::Sequence< css::beans::PropertyValue >& rPropSeq,
+ const css::beans::PropertyValue& rPropValue );
+
+public:
+
+ FilterConfigItem( std::u16string_view rSubTree );
+ FilterConfigItem( css::uno::Sequence< css::beans::PropertyValue > const * pFilterData );
+ FilterConfigItem( std::u16string_view rSubTree, css::uno::Sequence< css::beans::PropertyValue > const * pFilterData );
+ /// Writes config in destructor
+ ~FilterConfigItem();
+ /// Writes config and sets unmodified state again.
+ void WriteModifiedConfig();
+
+ // all read methods are trying to return values in following order:
+ // 1. FilterData PropertySequence
+ // 2. configuration
+ // 3. given default
+ bool ReadBool( const OUString& rKey, bool bDefault );
+ sal_Int32 ReadInt32( const OUString& rKey, sal_Int32 nDefault );
+ OUString
+ ReadString( const OUString& rKey, const OUString& rDefault );
+
+ // try to store to configuration
+ // and always stores into the FilterData sequence
+ void WriteBool( const OUString& rKey, bool bValue );
+ void WriteInt32( const OUString& rKey, sal_Int32 nValue );
+
+ const css::uno::Sequence< css::beans::PropertyValue >& GetFilterData() const { return aFilterData;}
+
+ // GetStatusIndicator is returning the "StatusIndicator" property of the FilterData sequence
+ css::uno::Reference< css::task::XStatusIndicator > GetStatusIndicator() const;
+};
+
+#endif // INCLUDED_VCL_FILTERCONFIGITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GestureEvent.hxx b/include/vcl/GestureEvent.hxx
new file mode 100644
index 000000000..7b6f25719
--- /dev/null
+++ b/include/vcl/GestureEvent.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_GESTUREEVENT_HXX
+#define INCLUDED_VCL_GESTUREEVENT_HXX
+
+#include <vcl/dllapi.h>
+
+enum class GestureEventType
+{
+ PanningBegin,
+ PanningUpdate,
+ PanningEnd
+};
+
+enum class PanningOrientation
+{
+ Horizontal,
+ Vertical
+};
+
+class VCL_DLLPUBLIC GestureEvent
+{
+public:
+ sal_Int32 mnX;
+ sal_Int32 mnY;
+ GestureEventType meEventType;
+
+ sal_Int32 mnOffset;
+ PanningOrientation meOrientation;
+
+ GestureEvent()
+ : mnX(0)
+ , mnY(0)
+ , meEventType(GestureEventType::PanningBegin)
+ , mnOffset(0)
+ , meOrientation(PanningOrientation::Horizontal)
+ {
+ }
+
+ GestureEvent(sal_Int32 nX, sal_Int32 nY, GestureEventType eEventType, sal_Int32 nOffset,
+ PanningOrientation eOrientation)
+ : mnX(nX)
+ , mnY(nY)
+ , meEventType(eEventType)
+ , mnOffset(nOffset)
+ , meOrientation(eOrientation)
+ {
+ }
+};
+
+#endif // INCLUDED_VCL_GESTUREEVENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicAttributes.hxx b/include/vcl/GraphicAttributes.hxx
new file mode 100644
index 000000000..442158cda
--- /dev/null
+++ b/include/vcl/GraphicAttributes.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <tools/degree.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/bitmap.hxx>
+
+enum class GraphicDrawMode
+{
+ Standard = 0,
+ Greys = 1,
+ Mono = 2,
+ Watermark = 3
+};
+
+class VCL_DLLPUBLIC GraphicAttr
+{
+private:
+ double mfGamma;
+ tools::Long mnLeftCrop;
+ tools::Long mnTopCrop;
+ tools::Long mnRightCrop;
+ tools::Long mnBottomCrop;
+ BmpMirrorFlags mnMirrFlags;
+ GraphicDrawMode meDrawMode;
+ Degree10 mnRotate10;
+ short mnContPercent;
+ short mnLumPercent;
+ short mnRPercent;
+ short mnGPercent;
+ short mnBPercent;
+ sal_uInt8 mcAlpha;
+ bool mbInvert;
+
+public:
+ GraphicAttr()
+ : mfGamma(1.0)
+ , mnLeftCrop(0)
+ , mnTopCrop(0)
+ , mnRightCrop(0)
+ , mnBottomCrop(0)
+ , mnMirrFlags(BmpMirrorFlags::NONE)
+ , meDrawMode(GraphicDrawMode::Standard)
+ , mnRotate10(0)
+ , mnContPercent(0)
+ , mnLumPercent(0)
+ , mnRPercent(0)
+ , mnGPercent(0)
+ , mnBPercent(0)
+ , mcAlpha(255)
+ , mbInvert(false)
+ {
+ }
+
+ bool operator==(const GraphicAttr& rAttr) const
+ {
+ return mfGamma == rAttr.mfGamma && mnMirrFlags == rAttr.mnMirrFlags
+ && mnLeftCrop == rAttr.mnLeftCrop && mnTopCrop == rAttr.mnTopCrop
+ && mnRightCrop == rAttr.mnRightCrop && mnBottomCrop == rAttr.mnBottomCrop
+ && mnRotate10 == rAttr.mnRotate10 && mnContPercent == rAttr.mnContPercent
+ && mnLumPercent == rAttr.mnLumPercent && mnRPercent == rAttr.mnRPercent
+ && mnGPercent == rAttr.mnGPercent && mnBPercent == rAttr.mnBPercent
+ && mbInvert == rAttr.mbInvert && mcAlpha == rAttr.mcAlpha
+ && meDrawMode == rAttr.meDrawMode;
+ }
+
+ bool operator!=(const GraphicAttr& rAttr) const { return !(*this == rAttr); }
+
+ void SetDrawMode(GraphicDrawMode eDrawMode) { meDrawMode = eDrawMode; }
+ GraphicDrawMode GetDrawMode() const { return meDrawMode; }
+
+ void SetMirrorFlags(BmpMirrorFlags nMirrFlags) { mnMirrFlags = nMirrFlags; }
+ BmpMirrorFlags GetMirrorFlags() const { return mnMirrFlags; }
+
+ void SetCrop(tools::Long nLeft_100TH_MM, tools::Long nTop_100TH_MM, tools::Long nRight_100TH_MM,
+ tools::Long nBottom_100TH_MM)
+ {
+ mnLeftCrop = nLeft_100TH_MM;
+ mnTopCrop = nTop_100TH_MM;
+ mnRightCrop = nRight_100TH_MM;
+ mnBottomCrop = nBottom_100TH_MM;
+ }
+ tools::Long GetLeftCrop() const { return mnLeftCrop; }
+ tools::Long GetTopCrop() const { return mnTopCrop; }
+ tools::Long GetRightCrop() const { return mnRightCrop; }
+ tools::Long GetBottomCrop() const { return mnBottomCrop; }
+
+ void SetRotation(Degree10 nRotate10) { mnRotate10 = nRotate10; }
+ Degree10 GetRotation() const { return mnRotate10; }
+
+ void SetLuminance(short nLuminancePercent) { mnLumPercent = nLuminancePercent; }
+ short GetLuminance() const { return mnLumPercent; }
+
+ void SetContrast(short nContrastPercent) { mnContPercent = nContrastPercent; }
+ short GetContrast() const { return mnContPercent; }
+
+ void SetChannelR(short nChannelRPercent) { mnRPercent = nChannelRPercent; }
+ short GetChannelR() const { return mnRPercent; }
+
+ void SetChannelG(short nChannelGPercent) { mnGPercent = nChannelGPercent; }
+ short GetChannelG() const { return mnGPercent; }
+
+ void SetChannelB(short nChannelBPercent) { mnBPercent = nChannelBPercent; }
+ short GetChannelB() const { return mnBPercent; }
+
+ void SetGamma(double fGamma) { mfGamma = fGamma; }
+ double GetGamma() const { return mfGamma; }
+
+ void SetInvert(bool bInvert) { mbInvert = bInvert; }
+ bool IsInvert() const { return mbInvert; }
+
+ void SetAlpha(sal_uInt8 cAlpha) { mcAlpha = cAlpha; }
+ sal_uInt8 GetAlpha() const { return mcAlpha; }
+
+ bool IsSpecialDrawMode() const { return (meDrawMode != GraphicDrawMode::Standard); }
+ bool IsMirrored() const { return mnMirrFlags != BmpMirrorFlags::NONE; }
+ bool IsCropped() const
+ {
+ return (mnLeftCrop != 0 || mnTopCrop != 0 || mnRightCrop != 0 || mnBottomCrop != 0);
+ }
+ bool IsRotated() const { return ((mnRotate10 % 3600_deg10) != 0_deg10); }
+ bool IsTransparent() const { return (mcAlpha < 255); }
+ bool IsAdjusted() const
+ {
+ return (mnLumPercent != 0 || mnContPercent != 0 || mnRPercent != 0 || mnGPercent != 0
+ || mnBPercent != 0 || mfGamma != 1.0 || mbInvert);
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicExternalLink.hxx b/include/vcl/GraphicExternalLink.hxx
new file mode 100644
index 000000000..ab9f2a69f
--- /dev/null
+++ b/include/vcl/GraphicExternalLink.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_GRAPHIC_EXTERNAL_LINK_HXX
+#define INCLUDED_VCL_GRAPHIC_EXTERNAL_LINK_HXX
+
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+
+class VCL_DLLPUBLIC GraphicExternalLink
+{
+public:
+ OUString msURL;
+
+ GraphicExternalLink() {}
+
+ GraphicExternalLink(OUString const& rURL)
+ : msURL(rURL)
+ {
+ }
+};
+
+#endif // INCLUDED_VCL_GRAPHIC_EXTERNAL_LINK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicLoader.hxx b/include/vcl/GraphicLoader.hxx
new file mode 100644
index 000000000..d99c54731
--- /dev/null
+++ b/include/vcl/GraphicLoader.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_GRAPHIC_LOADER_HXX
+#define INCLUDED_VCL_GRAPHIC_LOADER_HXX
+
+#include <vcl/graph.hxx>
+
+namespace weld
+{
+class Window;
+}
+
+namespace vcl::graphic
+{
+Graphic VCL_DLLPUBLIC loadFromURL(OUString const& rURL, weld::Window* pParentWin = nullptr);
+} // end vcl::graphic
+
+#endif // INCLUDED_VCL_GRAPHIC_TOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicNativeMetadata.hxx b/include/vcl/GraphicNativeMetadata.hxx
new file mode 100644
index 000000000..7ef2adee8
--- /dev/null
+++ b/include/vcl/GraphicNativeMetadata.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vcl/graph.hxx>
+#include <tools/stream.hxx>
+#include <tools/degree.hxx>
+
+class VCL_DLLPUBLIC GraphicNativeMetadata final
+{
+ Degree10 mRotation;
+
+public:
+ GraphicNativeMetadata();
+
+ bool read(Graphic const& rGraphic);
+ bool read(SvStream& rStream);
+
+ // counter-clock-wise rotation 10ths of a degree
+ Degree10 getRotation() const { return mRotation; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx
new file mode 100644
index 000000000..2f82aa158
--- /dev/null
+++ b/include/vcl/GraphicNativeTransform.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <tools/degree.hxx>
+#include <vcl/dllapi.h>
+
+#include <string_view>
+
+class Graphic;
+
+class VCL_DLLPUBLIC GraphicNativeTransform final
+{
+ Graphic& mrGraphic;
+
+ bool rotateBitmapOnly(Degree10 aRotation);
+ void rotateJPEG(Degree10 aRotation);
+ bool rotateGeneric(Degree10 aRotation, std::u16string_view aType);
+
+public:
+ GraphicNativeTransform(Graphic& rGraphic);
+
+ void rotate(Degree10 aRotation);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicObject.hxx b/include/vcl/GraphicObject.hxx
new file mode 100644
index 000000000..7ebaa274e
--- /dev/null
+++ b/include/vcl/GraphicObject.hxx
@@ -0,0 +1,302 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <string_view>
+#include <vcl/graph.hxx>
+#include <vcl/dllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <vcl/GraphicAttributes.hxx>
+
+namespace com::sun::star::graphic { class XGraphic; }
+
+// Adjustment defines
+enum class GraphicAdjustmentFlags
+{
+ NONE = 0x00,
+ DRAWMODE = 0x01,
+ COLORS = 0x02,
+ MIRROR = 0x04,
+ ROTATE = 0x08,
+ TRANSPARENCY = 0x10,
+ ALL = 0x1f,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<GraphicAdjustmentFlags> : is_typed_flags<GraphicAdjustmentFlags, 0x1f> {};
+}
+
+class VirtualDevice;
+struct GrfSimpleCacheObj;
+struct ImplTileInfo;
+
+class VCL_DLLPUBLIC GraphicObject
+{
+ friend class SdrGrafObj;
+
+private:
+ Graphic maGraphic;
+ GraphicAttr maAttr;
+ OUString maUserData;
+ std::unique_ptr<GrfSimpleCacheObj> mxSimpleCache;
+
+ bool VCL_DLLPRIVATE ImplGetCropParams(
+ const OutputDevice& rOut,
+ Point& rPt,
+ Size& rSz,
+ const GraphicAttr* pAttr,
+ tools::PolyPolygon& rClipPolyPoly,
+ bool& bRectClipRegion
+ ) const;
+
+ /** Render a given number of tiles in an optimized way
+
+ This method recursively subdivides the tile rendering problem
+ in smaller parts, i.e. rendering output size x with few tiles
+ of size y, which in turn are generated from the original
+ bitmap in a recursive fashion. The subdivision size can be
+ controlled by the exponent argument, which specifies the
+ minimal number of smaller tiles used in one recursion
+ step. The resulting tile size is given as the integer number
+ of repetitions of the original bitmap along x and y. As the
+ exponent need not necessarily divide these numbers without
+ remainder, the repetition counts are effectively converted to
+ base-exponent numbers, where each place denotes the number of
+ times the corresponding tile size is rendered.
+
+ @param rVDev
+ Virtual device to render everything into
+
+ @param nNumTilesX
+ Number of original tiles to generate in x direction
+
+ @param nNumTilesY
+ Number of original tiles to generate in y direction
+
+ @param rTileSizePixel
+ Size in pixel of the original tile bitmap to render it in
+
+ @param pAttr
+ Graphic attributes to be used for rendering
+
+ @param nFlags
+ Graphic flags to be used for rendering
+
+ @param rCurrPos
+ Current output point for this recursion level (should start with (0,0))
+
+ @return true, if everything was successfully rendered.
+ */
+ bool VCL_DLLPRIVATE ImplRenderTempTile(
+ VirtualDevice& rVDev,
+ int nNumTilesX,
+ int nNumTilesY,
+ const Size& rTileSizePixel,
+ const GraphicAttr* pAttr
+ );
+
+ /// internally called by ImplRenderTempTile()
+ bool VCL_DLLPRIVATE ImplRenderTileRecursive(
+ VirtualDevice& rVDev,
+ int nExponent,
+ int nMSBFactor,
+ int nNumOrigTilesX,
+ int nNumOrigTilesY,
+ int nRemainderTilesX,
+ int nRemainderTilesY,
+ const Size& rTileSizePixel,
+ const GraphicAttr* pAttr,
+ ImplTileInfo& rTileInfo
+ );
+
+ bool VCL_DLLPRIVATE ImplDrawTiled(
+ OutputDevice& rOut,
+ const tools::Rectangle& rArea,
+ const Size& rSizePixel,
+ const Size& rOffset,
+ const GraphicAttr* pAttr,
+ int nTileCacheSize1D
+ );
+
+ bool VCL_DLLPRIVATE ImplDrawTiled(
+ OutputDevice& rOut,
+ const Point& rPos,
+ int nNumTilesX,
+ int nNumTilesY,
+ const Size& rTileSize,
+ const GraphicAttr* pAttr
+ ) const;
+
+ void VCL_DLLPRIVATE ImplTransformBitmap(
+ BitmapEx& rBmpEx,
+ const GraphicAttr& rAttr,
+ const Size& rCropLeftTop,
+ const Size& rCropRightBottom,
+ const tools::Rectangle& rCropRect,
+ const Size& rDstSize,
+ bool bEnlarge
+ ) const;
+
+public:
+ GraphicObject();
+ GraphicObject( const Graphic& rGraphic );
+ GraphicObject( const GraphicObject& rCacheObj );
+ ~GraphicObject();
+
+ GraphicObject& operator=( const GraphicObject& rCacheObj );
+ bool operator==( const GraphicObject& rCacheObj ) const;
+ bool operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); }
+
+ const Graphic& GetGraphic() const;
+ void SetGraphic( const Graphic& rGraphic);
+
+ /** Get graphic transformed according to given attributes
+
+ This method returns a Graphic transformed, cropped and scaled
+ to the given parameters, ready to be rendered to printer or
+ display. The returned graphic has the same visual appearance
+ as if it had been drawn via GraphicObject::Draw() to a
+ specific output device.
+
+ @param rDestSize
+ Desired output size in logical coordinates. The mapmode to
+ interpret these logical coordinates in is given by the second
+ parameter, rDestMap.
+
+ @param rDestMap
+ Mapmode the output should be interpreted in. This is used to
+ interpret rDestSize, to set the appropriate PrefMapMode on the
+ returned Graphic, and to deal correctly with metafile graphics.
+
+ @param rAttr
+ Graphic attributes used to transform the graphic. This
+ includes cropping, rotation, mirroring, and various color
+ adjustment parameters.
+
+ @return the readily transformed Graphic
+ */
+ Graphic GetTransformedGraphic(
+ const Size& rDestSize,
+ const MapMode& rDestMap,
+ const GraphicAttr& rAttr
+ ) const;
+ Graphic GetTransformedGraphic( const GraphicAttr* pAttr ) const; // TODO: Change to Impl
+
+ void SetAttr( const GraphicAttr& rAttr );
+ const GraphicAttr& GetAttr() const { return maAttr; }
+
+ bool HasUserData() const { return !maUserData.isEmpty(); }
+ void SetUserData();
+ void SetUserData( const OUString& rUserData );
+ const OUString& GetUserData() const { return maUserData; }
+
+ OString GetUniqueID() const;
+
+ GraphicType GetType() const;
+ Size GetPrefSize() const;
+ MapMode GetPrefMapMode() const;
+ bool IsTransparent() const;
+ bool IsAnimated() const;
+ bool IsEPS() const;
+
+ bool Draw(OutputDevice& rOut,
+ const Point& rPt,
+ const Size& rSz,
+ const GraphicAttr* pAttr = nullptr) const;
+
+ /** Draw the graphic repeatedly into the given output rectangle
+
+ @param pOut
+ OutputDevice where the rendering should take place
+
+ @param rArea
+ The output area that is filled with tiled instances of this graphic
+
+ @param rSize
+ The actual size of a single tile
+
+ @param rOffset
+ Offset from the left, top position of rArea, where to start
+ the tiling. The upper left corner of the graphic tilings will
+ virtually start at this position. Concretely, only that many
+ tiles are drawn to completely fill the given output area.
+
+ @param nFlags
+ Optional rendering flags
+
+ @param nTileCacheSize1D
+ Optional dimension of the generated cache tiles. The pOut sees
+ a number of tile draws, which have approximately
+ nTileCacheSize1D times nTileCacheSize1D bitmap sizes if the
+ tile bitmap is smaller. Otherwise, the tile is drawn as
+ is. This is useful if e.g. you want only a few, very large
+ bitmap drawings appear on the outdev.
+ */
+ void DrawTiled(
+ OutputDevice& rOut,
+ const tools::Rectangle& rArea,
+ const Size& rSize,
+ const Size& rOffset,
+ int nTileCacheSize1D=128
+ );
+
+ bool StartAnimation(
+ OutputDevice& rOut,
+ const Point& rPt,
+ const Size& rSz,
+ tools::Long nExtraData = 0,
+ OutputDevice* pFirstFrameOutDev = nullptr
+ );
+
+ void StopAnimation( const OutputDevice* pOut = nullptr, tools::Long nExtraData = 0 );
+
+ static bool isGraphicObjectUniqueIdURL(std::u16string_view rURL);
+
+ // create CropScaling information
+ // fWidth, fHeight: object size
+ // f*Crop: crop values relative to original bitmap size
+ basegfx::B2DVector calculateCropScaling(
+ double fWidth,
+ double fHeight,
+ double fLeftCrop,
+ double fTopCrop,
+ double fRightCrop,
+ double fBottomCrop) const;
+};
+
+namespace vcl::graphic
+{
+
+// Will search an object ( e.g. a control ) for any 'ImageURL' or 'Graphic'
+// properties and return graphics from the properties in a vector. ImageURL
+// will be loaded from the URL.
+//
+// Note: this implementation will cater for XNameContainer objects and deep inspect any containers
+// if they exist
+
+VCL_DLLPUBLIC void SearchForGraphics(css::uno::Reference<css::uno::XInterface> const & rxInterface,
+ std::vector<css::uno::Reference<css::graphic::XGraphic>> & raGraphicList);
+
+
+} // end namespace vcl::graphic
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/IContext.hxx b/include/vcl/IContext.hxx
new file mode 100644
index 000000000..d595d8771
--- /dev/null
+++ b/include/vcl/IContext.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/EnumContext.hxx>
+#include <vector>
+
+#include <algorithm>
+
+namespace vcl
+{
+class VCL_DLLPUBLIC IContext
+{
+protected:
+ IContext() { maContext.push_back(vcl::EnumContext::Context::Any); }
+
+public:
+ void SetContext(std::vector<vcl::EnumContext::Context>&& aContext)
+ {
+ maContext = std::move(aContext);
+ }
+
+ bool HasContext(const vcl::EnumContext::Context eContext) const
+ {
+ auto aFind = std::find(maContext.begin(), maContext.end(), eContext);
+ if (aFind == maContext.end())
+ return false;
+ return true;
+ }
+
+private:
+ std::vector<vcl::EnumContext::Context> maContext;
+};
+
+} // namespace vcl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx
new file mode 100644
index 000000000..68a573574
--- /dev/null
+++ b/include/vcl/IDialogRenderable.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_IDIALOGRENDERABLE_HXX
+#define INCLUDED_VCL_IDIALOGRENDERABLE_HXX
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+
+#include <rtl/ustring.hxx>
+
+#include <vector>
+
+class SfxItemSet;
+
+namespace vcl
+{
+
+typedef std::pair<const OString, const OString> LOKPayloadItem;
+
+typedef sal_uInt32 LOKWindowId;
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) ILibreOfficeKitNotifier
+{
+public:
+ virtual ~ILibreOfficeKitNotifier();
+
+ /// Callbacks
+ virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId,
+ const OUString& rAction,
+ const std::vector<LOKPayloadItem>& rPayload = std::vector<LOKPayloadItem>()) const = 0;
+
+ virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const = 0;
+};
+
+} // namespace vcl
+
+#endif // INCLUDED_VCL_IDIALOGRENDERABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
new file mode 100644
index 000000000..1bddde538
--- /dev/null
+++ b/include/vcl/ITiledRenderable.hxx
@@ -0,0 +1,348 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <tools/gen.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/ptrstyle.hxx>
+#include <vcl/vclptr.hxx>
+#include <map>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <basegfx/range/b2drange.hxx>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::datatransfer::clipboard { class XClipboard; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+namespace vcl { class Window; }
+namespace tools { class JsonWriter; }
+
+class VirtualDevice;
+
+namespace vcl
+{
+ /*
+ * Map directly to css cursor styles to avoid further mapping in the client.
+ * Gtk (via gdk_cursor_new_from_name) also supports the same css cursor styles.
+ *
+ * This was created partially with help of the mappings in gtkdata.cxx.
+ * The list is incomplete as some cursor style simply aren't supported
+ * by css, it might turn out to be worth mapping some of these missing cursors
+ * to available cursors?
+ */
+ extern const std::map <PointerStyle, OString> gaLOKPointerMap;
+
+
+class VCL_DLLPUBLIC ITiledRenderable
+{
+public:
+
+ typedef std::map<OUString, OUString> StringMap;
+
+ virtual ~ITiledRenderable();
+
+ /**
+ * Paint a tile to a given VirtualDevice.
+ *
+ * Output parameters are measured in pixels, tile parameters are in
+ * twips.
+ */
+ virtual void paintTile( VirtualDevice &rDevice,
+ int nOutputWidth,
+ int nOutputHeight,
+ int nTilePosX,
+ int nTilePosY,
+ tools::Long nTileWidth,
+ tools::Long nTileHeight ) = 0;
+
+ /**
+ * Get the document size in twips.
+ */
+ virtual Size getDocumentSize() = 0;
+
+ /**
+ * Set the document "part", i.e. slide for a slideshow, and
+ * tab for a spreadsheet.
+ * bool bAllowChangeFocus - used to not disturb other users while editing when
+ * setPart is used for tile rendering only
+ */
+ virtual void setPart( int /*nPart*/, bool /*bAllowChangeFocus*/ = true ) {}
+
+ /**
+ * Get the number of parts -- see setPart for further details.
+ */
+ virtual int getParts()
+ {
+ return 1;
+ }
+
+ /**
+ * Get the currently displayed/selected part -- see setPart for further
+ * details.
+ */
+ virtual int getPart()
+ {
+ return 0;
+ }
+
+ /**
+ * Get the name of the currently displayed part, i.e. sheet in a spreadsheet
+ * or slide in a presentation.
+ */
+ virtual OUString getPartName(int)
+ {
+ return OUString();
+ }
+
+ /**
+ * Get the vcl::Window for the document being edited
+ */
+ virtual VclPtr<vcl::Window> getDocWindow() = 0;
+
+ /**
+ * Get the hash of the currently displayed part, i.e. sheet in a spreadsheet
+ * or slide in a presentation.
+ */
+ virtual OUString getPartHash(int nPart) = 0;
+
+ /// @see lok::Document::setPartMode().
+ virtual void setPartMode(int) {}
+
+ /**
+ * Setup various document properties that are needed for the document to
+ * be renderable via tiled rendering.
+ */
+ virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) = 0;
+
+ /**
+ * Posts a keyboard event on the document.
+ *
+ * @see lok::Document::postKeyEvent().
+ */
+ virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) = 0;
+
+ /**
+ * Posts a mouse event on the document.
+ *
+ * @see lok::Document::postMouseEvent().
+ */
+ virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) = 0;
+
+ /**
+ * Sets the start or end of a text selection.
+ *
+ * @see lok::Document::setTextSelection().
+ */
+ virtual void setTextSelection(int nType, int nX, int nY) = 0;
+
+ /**
+ * Gets the selection as a transferable for later processing
+ */
+ virtual css::uno::Reference<css::datatransfer::XTransferable> getSelection() = 0;
+
+ /**
+ * Adjusts the graphic selection.
+ *
+ * @see lok::Document::setGraphicSelection().
+ */
+ virtual void setGraphicSelection(int nType, int nX, int nY) = 0;
+
+ /**
+ * @see lok::Document::resetSelection().
+ */
+ virtual void resetSelection() = 0;
+
+ /**
+ * @see lok::Document::getPartPageRectangles().
+ */
+ virtual OUString getPartPageRectangles()
+ {
+ return OUString();
+ }
+
+ /**
+ * Get position and content of row/column headers of Calc documents.
+ *
+ * @param rRectangle - if not empty, then limit the output only to the area of this rectangle
+ * @return a JSON describing position/content of rows/columns
+ */
+ virtual void getRowColumnHeaders(const tools::Rectangle& /*rRectangle*/, tools::JsonWriter& /*rJsonWriter*/)
+ {
+ }
+
+ /**
+ * Generates a serialization of the active (Calc document) sheet's geometry data.
+ *
+ * @param bColumns - if true, the column widths/hidden/filtered/groups data
+ * are included depending on the settings of the flags bSizes, bHidden,
+ * bFiltered and bGroups.
+ * @param bRows - if true, the row heights/hidden/filtered/groups data
+ * are included depending on the settings of the flags bSizes, bHidden,
+ * bFiltered and bGroups.
+ * @bSizes - if true, the column-widths and/or row-heights data (represented as a list of spans)
+ * are included depending on the settings of the flags bColumns and bRows.
+ * @bHidden - if true, the hidden columns and/or rows data (represented as a list of spans)
+ * are included depending on the settings of the flags bColumns and bRows.
+ * @bFiltered - if true, the filtered columns and/or rows data (represented as a list of spans)
+ * are included depending on the settings of the flags bColumns and bRows.
+ * @bGroups - if true, the column grouping and/or row grouping data
+ * are included depending on the settings of the flags bColumns and bRows.
+ * @return serialization of the active sheet's geometry data as OString.
+ */
+ virtual OString getSheetGeometryData(bool /*bColumns*/, bool /*bRows*/, bool /*bSizes*/,
+ bool /*bHidden*/, bool /*bFiltered*/, bool /*bGroups*/)
+ {
+ return "";
+ }
+
+ /**
+ * Get position and size of cell cursor in Calc - as JSON in the
+ * current' views' co-ordinate system.
+ * (This could maybe also be used for tables in Writer/Impress in future?)
+ */
+ virtual void getCellCursor(tools::JsonWriter& /*rJsonWriter*/)
+ {
+ }
+
+ virtual PointerStyle getPointer() = 0;
+
+ /// Sets the clipboard of the component.
+ virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) = 0;
+
+ /// If the current contents of the clipboard is something we can paste.
+ virtual bool isMimeTypeSupported() = 0;
+
+ /**
+ * Save the client's view so that we can compute the right zoom level
+ * for the mouse events.
+ * @param nTilePixelWidth - tile width in pixels
+ * @param nTilePixelHeight - tile height in pixels
+ * @param nTileTwipWidth - tile width in twips
+ * @param nTileTwipHeight - tile height in twips
+ */
+ virtual void setClientZoom(int /*nTilePixelWidth*/,
+ int /*nTilePixelHeight*/,
+ int /*nTileTwipWidth*/,
+ int /*nTileTwipHeight*/)
+ {}
+
+ /// @see lok::Document::setClientVisibleArea().
+ virtual void setClientVisibleArea(const tools::Rectangle& /*rRectangle*/)
+ {
+ }
+
+ /**
+ * Show/Hide a single row/column header outline for Calc documents.
+ *
+ * @param bColumn - if we are dealing with a column or row group
+ * @param nLevel - the level to which the group belongs
+ * @param nIndex - the group entry index
+ * @param bHidden - the new group state (collapsed/expanded)
+ */
+ virtual void setOutlineState(bool /*bColumn*/, int /*nLevel*/, int /*nIndex*/, bool /*bHidden*/)
+ {
+ return;
+ }
+
+ /// Implementation for
+ /// lok::Document::getCommandValues(".uno:AcceptTrackedChanges") when there
+ /// is no matching UNO API.
+ virtual void getTrackedChanges(tools::JsonWriter&)
+ {
+ }
+
+ /// Implementation for
+ /// lok::Document::getCommandValues(".uno:TrackedChangeAuthors").
+ virtual void getTrackedChangeAuthors(tools::JsonWriter& /*rJsonWriter*/)
+ {
+ }
+
+ /// Implementation for
+ /// lok::Document::getCommandValues(".uno:ViewAnnotations");
+ virtual void getPostIts(tools::JsonWriter& /*rJsonWriter*/)
+ {
+ }
+
+ /// Implementation for
+ /// lok::Document::getCommandValues(".uno:ViewAnnotationsPosition");
+ virtual void getPostItsPos(tools::JsonWriter& /*rJsonWriter*/)
+ {
+ }
+
+ /// Implementation for
+ /// lok::Document::getCommandValues(".uno:RulerState");
+ virtual void getRulerState(tools::JsonWriter& /*rJsonWriter*/)
+ {
+ }
+
+ /*
+ * Used for sheets in spreadsheet documents,
+ * and slides in presentation documents.
+ */
+ virtual OUString getPartInfo(int /*nPart*/)
+ {
+ return OUString();
+ }
+
+ /**
+ * Select/Unselect a document "part", i.e. slide for a slideshow, and
+ * tab for a spreadsheet(?).
+ * nSelect: 0 to deselect, 1 to select, and 2 to toggle.
+ */
+ virtual void selectPart(int /*nPart*/, int /*nSelect*/) {}
+
+ /**
+ * Move selected pages/slides to a new position.
+ * nPosition: the new position to move to.
+ * bDuplicate: to copy (true), or to move (false).
+ */
+ virtual void moveSelectedParts(int /*nPosition*/, bool /*bDuplicate*/) {}
+
+ /// @see lok::Document::completeFunction().
+ virtual void completeFunction(const OUString& /*rFunctionName*/)
+ {
+ }
+
+ /**
+ * It can happen that the underlying implementation is being disposed, but
+ * somebody is trying to access the data...
+ */
+ virtual bool isDisposed() const
+ {
+ return false;
+ }
+
+ /**
+ * Execute a form field event in the document.
+ * E.g. select an item from a drop down field's list.
+ */
+ virtual void executeFromFieldEvent(const StringMap&)
+ {
+ }
+
+ /**
+ * Returns the rectangles of the input search result JSON
+ */
+ virtual std::vector<basegfx::B2DRange> getSearchResultRectangles(const char* /*pPayload*/)
+ {
+ return std::vector<basegfx::B2DRange>();
+ }
+
+ /**
+ * Execute a content control event in the document.
+ * E.g. select a list item from a drop down content control.
+ */
+ virtual void executeContentControlEvent(const StringMap&) {}
+};
+} // namespace vcl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/IconThemeInfo.hxx b/include/vcl/IconThemeInfo.hxx
new file mode 100644
index 000000000..0ac2b7dc2
--- /dev/null
+++ b/include/vcl/IconThemeInfo.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_ICONTHEMEINFO_HXX
+#define INCLUDED_VCL_ICONTHEMEINFO_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/gen.hxx>
+#include <rtl/ustring.hxx>
+
+#include <vector>
+
+// forward declaration of unit test classes. Required for friend relationship.
+class IconThemeInfoTest;
+class IconThemeSelectorTest;
+class IconThemeScannerTest;
+
+namespace vcl
+{
+/** This class provides information about an icon theme.
+ */
+class VCL_DLLPUBLIC IconThemeInfo
+{
+public:
+ /** The name of the icon theme to use for high contrast mode */
+ static constexpr OUStringLiteral HIGH_CONTRAST_ID_BRIGHT = u"sifr";
+ static constexpr OUStringLiteral HIGH_CONTRAST_ID_DARK = u"sifr_dark";
+
+ /** Construct an IconThemeInfo from the URL to a file.
+ * This method will throw a std::runtime_error if the URL cannot be properly parsed.
+ * Check the URL with UrlCanBeParsed() first.
+ */
+ IconThemeInfo(const OUString& urlToFile);
+
+ const OUString& GetDisplayName() const { return mDisplayName; }
+
+ const OUString& GetThemeId() const { return mThemeId; }
+
+ const OUString& GetUrlToFile() const { return mUrlToFile; }
+
+ /** Obtain the icon size by theme name.
+ * @internal
+ * It is not clear where this information belongs to. The sizes were hard-coded before they moved here.
+ * Maybe there is a way to determine the sizes from the icon theme packages.
+ */
+ static Size SizeByThemeName(std::u16string_view);
+
+ /** Check whether an IconThemeInfo can be constructed from a URL */
+ static bool UrlCanBeParsed(std::u16string_view url);
+
+ /** Find an icon theme by its id in a vector.
+ * Throws a runtime_error if the theme is not contained in the vector
+ */
+ static const vcl::IconThemeInfo&
+ FindIconThemeById(const std::vector<vcl::IconThemeInfo>& themes, const OUString& themeId);
+
+ /** Check whether a theme with a specified id is in a vector of IconThemeInfo */
+ static bool IconThemeIsInVector(const std::vector<vcl::IconThemeInfo>& themes,
+ const OUString& themeId);
+
+private:
+ /** private constructor for testing purposes only */
+ IconThemeInfo();
+
+ /** Determine the icon theme name from the filename
+ * If the name has an underscore, the name is taken from the first underscore to the last dot,
+ * e.g., images_oxygen.zip becomes oxygen
+ * If the name does not have an underscore in it, the whole name until the last dot is returned,
+ * e.g. default.zip becomes default
+ */
+ static OUString FileNameToThemeId(std::u16string_view);
+
+ /** Creates the display name for the given id of a file.
+ * Currently, we only uppercase the id.
+ */
+ static OUString ThemeIdToDisplayName(const OUString&);
+
+ /** The name which is presented to the user */
+ OUString mDisplayName;
+ /** The theme id. This id is used in ... to determine the file name */
+ OUString mThemeId;
+ /** The url to the icon theme package */
+ OUString mUrlToFile;
+
+ friend class ::IconThemeInfoTest;
+ friend class ::IconThemeScannerTest;
+ friend class ::IconThemeSelectorTest;
+};
+
+} // namespace vcl
+
+#endif // INCLUDED_VCL_ICONTHEMEINFO_HXX
diff --git a/include/vcl/ImageTree.hxx b/include/vcl/ImageTree.hxx
new file mode 100644
index 000000000..4de20d74e
--- /dev/null
+++ b/include/vcl/ImageTree.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_INCLUDE_VCL_IMAGETREE_HXX
+#define INCLUDED_INCLUDE_VCL_IMAGETREE_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+
+enum class ImageLoadFlags : sal_uInt16
+{
+ NONE = 0,
+ IgnoreScalingFactor = 1,
+ IgnoreDarkTheme = 2,
+};
+
+namespace o3tl {
+template<> struct typed_flags<ImageLoadFlags>: is_typed_flags<ImageLoadFlags, 0x3> {};
+}
+
+namespace com::sun::star::container {
+ class XNameAccess;
+}
+
+namespace com::sun::star::io {
+ class XInputStream;
+}
+
+class ImplImageTree;
+class BitmapEx;
+class SvMemoryStream;
+
+class ImageTree
+{
+private:
+ std::unique_ptr<ImplImageTree> mpImplImageTree;
+
+public:
+ ImageTree();
+
+ VCL_DLLPUBLIC static ImageTree & get();
+
+ VCL_DLLPUBLIC OUString getImageUrl(
+ OUString const & name, OUString const & style, OUString const & lang);
+
+ VCL_DLLPUBLIC std::shared_ptr<SvMemoryStream> getImageStream(
+ OUString const & rName, OUString const & rStyle, OUString const & rLang);
+
+ VCL_DLLPUBLIC css::uno::Reference<css::io::XInputStream> getImageXInputStream(OUString const & rName,
+ OUString const & rStyle, OUString const & rLang);
+
+ VCL_DLLPUBLIC bool loadImage(
+ OUString const & name, OUString const & style,
+ BitmapEx & bitmap, bool localized,
+ const ImageLoadFlags eFlags = ImageLoadFlags::NONE);
+
+ VCL_DLLPUBLIC bool loadImage(
+ OUString const & name, OUString const & style,
+ BitmapEx & bitmap, bool localized,
+ sal_Int32 nScalePercentage,
+ const ImageLoadFlags eFlags = ImageLoadFlags::NONE);
+
+ VCL_DLLPUBLIC css::uno::Reference<css::container::XNameAccess> const & getNameAccess();
+
+
+ /** a crude form of life cycle control (called from DeInitVCL; otherwise,
+ * if the ImplImageTree singleton were destroyed during exit that would
+ * be too late for the destructors of the bitmaps in maIconCache)*/
+ VCL_DLLPUBLIC void shutdown();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/InterimItemWindow.hxx b/include/vcl/InterimItemWindow.hxx
new file mode 100644
index 000000000..4cf4dd4eb
--- /dev/null
+++ b/include/vcl/InterimItemWindow.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <vcl/ctrl.hxx>
+#include <vcl/idle.hxx>
+#include <vcl/weld.hxx>
+
+class VCL_DLLPUBLIC InterimItemWindow : public Control
+{
+public:
+ virtual ~InterimItemWindow() override;
+ virtual void dispose() override;
+
+ virtual void Resize() override;
+ virtual Size GetOptimalSize() const override;
+ // throw away cached size request of child so GetOptimalSize will
+ // fetch it anew
+ void InvalidateChildSizeCache();
+ virtual void StateChanged(StateChangedType nStateChange) override;
+ virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
+ virtual void GetFocus() override;
+
+ bool ControlHasFocus() const;
+
+ virtual void Draw(OutputDevice* pDevice, const Point& rPos,
+ SystemTextColorFlags nFlags) override;
+
+protected:
+ // bAllowCycleFocusOut of true allows focus to be moved out of the Control
+ // via tab key into a parent window or sibling window, false means focus
+ // remains inside the InterimItemWindow and cycles back to the first child
+ // of this control on reaching pass the last child. This is suitable when
+ // the Control is the toplevel control and has no siblings or parent
+ InterimItemWindow(vcl::Window* pParent, const OUString& rUIXMLDescription, const OString& rID,
+ bool bAllowCycleFocusOut = true, sal_uInt64 nLOKWindowId = 0);
+
+ void InitControlBase(weld::Widget* pWidget);
+
+ // pass keystrokes from our child window through this to handle focus changes correctly
+ // returns true if keystroke is consumed
+ bool ChildKeyInput(const KeyEvent& rKEvt);
+
+ virtual void Layout();
+
+ // unclip a "SysObj" which is a native window element hosted in a vcl::Window
+ // if the SysObj is logically "visible" in the vcl::Window::IsVisible sense but
+ // is partially or wholly clipped out due to being overlapped or scrolled out
+ // of view. The clip state is flagged as dirty after this and vcl will restore
+ // the clip state the next time it evaluates the clip status
+ void UnclipVisibleSysObj();
+
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ VclPtr<vcl::Window> m_xVclContentArea;
+ std::unique_ptr<weld::Container> m_xContainer;
+ weld::Widget* m_pWidget;
+
+private:
+ Idle m_aLayoutIdle;
+
+ void StartIdleLayout();
+
+ DECL_DLLPRIVATE_LINK(DoLayout, Timer*, void);
+
+ virtual void ImplPaintToDevice(::OutputDevice* pTargetOutDev, const Point& rPos) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/NotebookbarContextControl.hxx b/include/vcl/NotebookbarContextControl.hxx
new file mode 100644
index 000000000..adb6178e5
--- /dev/null
+++ b/include/vcl/NotebookbarContextControl.hxx
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_NOTEBOOKBARCONTEXTCONTROL_HXX
+#define INCLUDED_VCL_NOTEBOOKBARCONTEXTCONTROL_HXX
+
+#include <vcl/EnumContext.hxx>
+
+class NotebookbarContextControl
+{
+public:
+ virtual ~NotebookbarContextControl() {}
+ virtual void SetContext(vcl::EnumContext::Context eContext) = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/PrinterSupport.hxx b/include/vcl/PrinterSupport.hxx
new file mode 100644
index 000000000..bde01fa19
--- /dev/null
+++ b/include/vcl/PrinterSupport.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_PRINTERSUPPORT_HXX
+#define INCLUDED_VCL_PRINTERSUPPORT_HXX
+
+enum class PrinterSupport
+{
+ SetOrientation,
+ SetPaperSize,
+ SetPaper,
+ CollateCopy,
+ SetupDialog
+};
+
+#endif // INCLUDED_VCL_PRINTERSUPPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/QueueInfo.hxx b/include/vcl/QueueInfo.hxx
new file mode 100644
index 000000000..a011e125e
--- /dev/null
+++ b/include/vcl/QueueInfo.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_QUEUEINFO_HXX
+#define INCLUDED_VCL_QUEUEINFO_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <vcl/dllapi.h>
+#include <vcl/prntypes.hxx>
+
+class Printer;
+
+class VCL_DLLPUBLIC QueueInfo
+{
+ friend class Printer;
+
+private:
+ OUString maPrinterName;
+ OUString maDriver;
+ OUString maLocation;
+ OUString maComment;
+ PrintQueueFlags mnStatus;
+ sal_uInt32 mnJobs;
+
+public:
+ QueueInfo();
+
+ const OUString& GetPrinterName() const;
+ const OUString& GetDriver() const;
+ const OUString& GetLocation() const;
+ const OUString& GetComment() const;
+ PrintQueueFlags GetStatus() const;
+ sal_uInt32 GetJobs() const;
+};
+
+#endif // INCLUDED_VCL_QUEUEINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/RawBitmap.hxx b/include/vcl/RawBitmap.hxx
new file mode 100644
index 000000000..12c924dbb
--- /dev/null
+++ b/include/vcl/RawBitmap.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <o3tl/safeint.hxx>
+#include <vcl/BitmapColor.hxx>
+#include <vcl/bitmapex.hxx>
+
+namespace vcl::bitmap
+{
+/**
+ * Intended to be used to feed into CreateFromData to create a BitmapEx. RGB data format.
+ */
+class VCL_DLLPUBLIC RawBitmap
+{
+ friend BitmapEx VCL_DLLPUBLIC CreateFromData(RawBitmap&& rawBitmap);
+ std::unique_ptr<sal_uInt8[]> mpData;
+ Size maSize;
+ sal_uInt8 mnBitCount;
+
+public:
+ RawBitmap(Size const& rSize, sal_uInt8 nBitCount)
+ : maSize(rSize)
+ , mnBitCount(nBitCount)
+ {
+ assert(nBitCount == 24 || nBitCount == 32);
+ if (rSize.getWidth() > std::numeric_limits<sal_Int32>::max() || rSize.getWidth() < 0)
+ throw std::bad_alloc();
+ if (rSize.getHeight() > std::numeric_limits<sal_Int32>::max() || rSize.getHeight() < 0)
+ throw std::bad_alloc();
+ sal_Int32 nRowSize, nDataSize;
+ if (o3tl::checked_multiply<sal_Int32>(rSize.getWidth(), nBitCount / 8, nRowSize)
+ || o3tl::checked_multiply<sal_Int32>(nRowSize, rSize.getHeight(), nDataSize)
+ || nDataSize < 0)
+ {
+ throw std::bad_alloc();
+ }
+ mpData.reset(new sal_uInt8[nDataSize]);
+ }
+ void SetPixel(tools::Long nY, tools::Long nX, Color nColor)
+ {
+ tools::Long p = (nY * maSize.getWidth() + nX) * (mnBitCount / 8);
+ mpData[p++] = nColor.GetRed();
+ mpData[p++] = nColor.GetGreen();
+ mpData[p++] = nColor.GetBlue();
+ if (mnBitCount == 32)
+ mpData[p] = nColor.GetAlpha();
+ }
+ void SetAlpha(tools::Long nY, tools::Long nX, sal_uInt8 nAlpha)
+ {
+ assert(mnBitCount == 32);
+ tools::Long p = (nY * maSize.getWidth() + nX) * (mnBitCount / 8) + 3;
+ mpData[p] = nAlpha;
+ }
+ Color GetPixel(tools::Long nY, tools::Long nX) const
+ {
+ tools::Long p = (nY * maSize.getWidth() + nX) * mnBitCount / 8;
+ if (mnBitCount == 24)
+ return Color(mpData[p], mpData[p + 1], mpData[p + 2]);
+ else
+ return Color(ColorAlpha, mpData[p + 3], mpData[p], mpData[p + 1], mpData[p + 2]);
+ }
+ // so we don't accidentally leave any code in that uses palette color indexes
+ void SetPixel(tools::Long nY, tools::Long nX, BitmapColor nColor) = delete;
+ tools::Long Height() const { return maSize.Height(); }
+ tools::Long Width() const { return maSize.Width(); }
+ sal_uInt8 GetBitCount() const { return mnBitCount; }
+};
+
+} // end vcl::bitmap
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/Scanline.hxx b/include/vcl/Scanline.hxx
new file mode 100644
index 000000000..be33bc232
--- /dev/null
+++ b/include/vcl/Scanline.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SCANLINE_HXX
+#define INCLUDED_VCL_SCANLINE_HXX
+
+#include <o3tl/typed_flags_set.hxx>
+#include <sal/types.h>
+
+typedef sal_uInt8* Scanline;
+typedef const sal_uInt8* ConstScanline;
+
+enum class ScanlineFormat {
+ NONE = 0x00000000,
+
+ N1BitMsbPal = 0x00000001,
+ N1BitLsbPal = 0x00000002,
+
+ N8BitPal = 0x00000010,
+
+ N24BitTcBgr = 0x00000100,
+ N24BitTcRgb = 0x00000200,
+
+ N32BitTcAbgr = 0x00000800,
+ N32BitTcArgb = 0x00001000,
+ N32BitTcBgra = 0x00002000,
+ N32BitTcRgba = 0x00004000,
+ N32BitTcMask = 0x00008000,
+
+ TopDown = 0x00010000 // scanline adjustment
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<ScanlineFormat> : is_typed_flags<ScanlineFormat, 0x0001fb13> {};
+}
+
+inline ScanlineFormat RemoveScanline(ScanlineFormat nFormat)
+{
+ return nFormat & ~ScanlineFormat::TopDown;
+}
+
+#endif // INCLUDED_VCL_SCANLINE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/TaskStopwatch.hxx b/include/vcl/TaskStopwatch.hxx
new file mode 100644
index 000000000..b27b3a316
--- /dev/null
+++ b/include/vcl/TaskStopwatch.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_TASK_STOPWATCH_HXX
+#define INCLUDED_VCL_TASK_STOPWATCH_HXX
+
+#include <tools/time.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/inputtypes.hxx>
+#include <vcl/svapp.hxx>
+
+/**
+ * Helper class primary used to track time of long running iterating tasks.
+ *
+ * Normally it should be sufficient to instantiate the watch object before
+ * starting the iteration and query continueIter() at the end of each.
+ *
+ * Called Stopwatch, because there is already a Timer class in the Scheduler.
+ *
+ * TODO: merge into the general Scheduler, so this can also be used to track
+ * Task runtimes in a more general way.
+ * TODO: handle fast iterations, where continueIter is called multiple times
+ * per tick, by counting the iterations per tick and use that for approximation.
+ **/
+class VCL_DLLPUBLIC TaskStopwatch
+{
+ static constexpr VclInputFlags eDefaultInputStop = VCL_INPUT_ANY & ~VclInputFlags::TIMER;
+ static constexpr unsigned int nDefaultTimeSlice = 50;
+ static unsigned int m_nTimeSlice;
+
+ sal_uInt64 m_nStartTicks;
+ sal_uInt64 m_nIterStartTicks;
+ bool m_bConsiderLastIterTime;
+ VclInputFlags m_eInputStop;
+
+ bool nextIter()
+ {
+ sal_uInt64 nCurTicks = tools::Time::GetSystemTicks();
+ // handle system ticks wrap as exceeded time slice
+ if (nCurTicks < m_nStartTicks)
+ return false;
+
+ if (m_bConsiderLastIterTime)
+ {
+ // based on the last iter runtime, we don't expect to finish in time
+ // m_nTimeSlice < (nCurTicks - m_nStartTicks) + (nCurTicks - m_nIterStartTicks)
+ if (m_nTimeSlice < 2 * nCurTicks - m_nIterStartTicks - m_nStartTicks)
+ return false;
+ }
+ // time slice exceeded
+ else if (m_nTimeSlice < nCurTicks - m_nStartTicks)
+ return false;
+
+ m_nIterStartTicks = nCurTicks;
+
+ return !Application::AnyInput(m_eInputStop);
+ }
+
+public:
+ /**
+ * Per default the watch considers the last iter time when asking for an
+ * other iteration, so considers Scheduler::acceptableTaskTime as a
+ * maximum value.
+ *
+ * If you already know your iter time vary in a large range, consider
+ * setting bConciderLastIterTime to false, so Scheduler::acceptableTaskTime
+ * will be used as a minimum time slot.
+ **/
+ TaskStopwatch(bool bConciderLastIterTime = true)
+ : m_nStartTicks(tools::Time::GetSystemTicks())
+ , m_nIterStartTicks(m_nStartTicks)
+ , m_bConsiderLastIterTime(bConciderLastIterTime)
+ , m_eInputStop(eDefaultInputStop)
+ {
+ }
+
+ /**
+ * Returns true, if another iteration will probably pass in the time slot
+ **/
+ bool continueIter() { return nextIter(); }
+
+ /**
+ * Reset the stopwatch
+ **/
+ void reset()
+ {
+ m_nStartTicks = tools::Time::GetSystemTicks();
+ m_nIterStartTicks = m_nStartTicks;
+ }
+
+ /**
+ * Sets the input events, which should also "exceed" the stopwatch.
+ *
+ * Per default this ignores the VclInputFlags::TIMER.
+ */
+ void setInputStop(VclInputFlags eInputStop = eDefaultInputStop) { m_eInputStop = eInputStop; }
+ VclInputFlags inputStop() const { return m_eInputStop; }
+
+ /**
+ * Sets the time considered the acceptable maximum for a task to run
+ *
+ * This is an orientation for long time background jobs to yield to
+ * the scheduler, so Idle task don't starve each other too much.
+ **/
+ static unsigned int timeSlice() { return m_nTimeSlice; }
+ static void setTimeSlice(unsigned int nTimeSlice) { m_nTimeSlice = nTimeSlice; }
+};
+
+#endif // INCLUDED_VCL_TASK_STOPWATCH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/TypeSerializer.hxx b/include/vcl/TypeSerializer.hxx
new file mode 100644
index 000000000..e85b25b1c
--- /dev/null
+++ b/include/vcl/TypeSerializer.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_INC_TYPESERIALIZER_HXX
+#define INCLUDED_VCL_INC_TYPESERIALIZER_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/GenericTypeSerializer.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/gfxlink.hxx>
+#include <vcl/graph.hxx>
+
+constexpr sal_uInt32 createMagic(char char1, char char2, char char3, char char4)
+{
+ return (static_cast<sal_uInt32>(char1) << 24) | (static_cast<sal_uInt32>(char2) << 16)
+ | (static_cast<sal_uInt32>(char3) << 8) | (static_cast<sal_uInt32>(char4) << 0);
+}
+
+constexpr sal_uInt32 constSvgMagic = createMagic('s', 'v', 'g', '0');
+constexpr sal_uInt32 constWmfMagic = createMagic('w', 'm', 'f', '0');
+constexpr sal_uInt32 constEmfMagic = createMagic('e', 'm', 'f', '0');
+constexpr sal_uInt32 constPdfMagic = createMagic('p', 'd', 'f', '0');
+
+class VCL_DLLPUBLIC TypeSerializer : public tools::GenericTypeSerializer
+{
+public:
+ TypeSerializer(SvStream& rStream);
+
+ void readGradient(Gradient& rGradient);
+ void writeGradient(const Gradient& rGradient);
+
+ void readGfxLink(GfxLink& rGfxLink);
+ void writeGfxLink(const GfxLink& rGfxLink);
+
+ void readGraphic(Graphic& rGraphic);
+ void writeGraphic(const Graphic& rGraphic);
+
+ void readMapMode(MapMode& rMapMode);
+ void writeMapMode(MapMode const& rMapMode);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/VectorGraphicSearch.hxx b/include/vcl/VectorGraphicSearch.hxx
new file mode 100644
index 000000000..4601a1f5a
--- /dev/null
+++ b/include/vcl/VectorGraphicSearch.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/graph.hxx>
+#include <vcl/vectorgraphicdata.hxx>
+#include <vcl/dllapi.h>
+
+#include <basegfx/range/b2drectangle.hxx>
+#include <basegfx/vector/b2dsize.hxx>
+
+#include <memory>
+
+enum class SearchStartPosition
+{
+ Begin,
+ End
+};
+
+struct VCL_DLLPUBLIC VectorGraphicSearchOptions final
+{
+ SearchStartPosition meStartPosition;
+ bool mbMatchCase;
+ bool mbMatchWholeWord;
+
+ VectorGraphicSearchOptions()
+ : meStartPosition(SearchStartPosition::Begin)
+ , mbMatchCase(false)
+ , mbMatchWholeWord(false)
+ {
+ }
+
+ VectorGraphicSearchOptions(SearchStartPosition eStartPosition, bool bMatchCase,
+ bool bMatchWholeWord)
+ : meStartPosition(eStartPosition)
+ , mbMatchCase(bMatchCase)
+ , mbMatchWholeWord(bMatchWholeWord)
+ {
+ }
+};
+
+class VCL_DLLPUBLIC VectorGraphicSearch final
+{
+private:
+ class Implementation;
+ std::unique_ptr<Implementation> mpImplementation;
+ Graphic maGraphic;
+
+ bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData);
+
+public:
+ VectorGraphicSearch(Graphic const& rGraphic);
+ ~VectorGraphicSearch();
+ bool search(OUString const& rSearchString,
+ VectorGraphicSearchOptions const& rOptions = VectorGraphicSearchOptions());
+ basegfx::B2DSize pageSize();
+ bool next();
+ bool previous();
+ int index();
+ std::vector<basegfx::B2DRectangle> getTextRectangles();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/WeldedTabbedNotebookbar.hxx b/include/vcl/WeldedTabbedNotebookbar.hxx
new file mode 100644
index 000000000..073902f2d
--- /dev/null
+++ b/include/vcl/WeldedTabbedNotebookbar.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_NOTEBOOKBAR_WRITERTABBEDNOTEBOOKBAR_HXX
+#define INCLUDED_SFX2_NOTEBOOKBAR_WRITERTABBEDNOTEBOOKBAR_HXX
+
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <vcl/weld.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+
+/**
+ * Welded wrapper for NotebookBar used for online
+*/
+class VCL_DLLPUBLIC WeldedTabbedNotebookbar
+{
+ std::unique_ptr<weld::Builder> m_xBuilder;
+
+ std::unique_ptr<weld::Container> m_xContainer;
+
+public:
+ WeldedTabbedNotebookbar(const VclPtr<vcl::Window>& pContainerWindow,
+ const OUString& rUIFilePath,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ sal_uInt64 nWindowId);
+};
+
+#endif // INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx
new file mode 100644
index 000000000..79b2b32a9
--- /dev/null
+++ b/include/vcl/abstdlg.hxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_ABSTDLG_HXX
+#define INCLUDED_VCL_ABSTDLG_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/vclptr.hxx>
+#include <vcl/vclreferencebase.hxx>
+#include <vector>
+#include <functional>
+#include <memory>
+
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+
+namespace com::sun::star::frame { class XModel; }
+
+class Dialog;
+class BitmapEx;
+class SdrObjGroup;
+namespace weld
+{
+ class Dialog;
+ class DialogController;
+ class Window;
+}
+
+/**
+* Some things multiple-inherit from VclAbstractDialog and OutputDevice,
+* so we need to use virtual inheritance to keep the referencing counting
+* OK.
+*/
+class VCL_DLLPUBLIC VclAbstractDialog : public virtual VclReferenceBase
+{
+protected:
+ virtual ~VclAbstractDialog() override;
+public:
+ virtual short Execute() = 0;
+
+ struct AsyncContext {
+ // for the case where the owner is the dialog itself, and the dialog is an unwelded VclPtr based dialog
+ VclPtr<VclReferenceBase> mxOwner;
+ // for the case where the dialog is welded, and owned by a DialogController
+ std::shared_ptr<weld::DialogController> mxOwnerDialogController;
+ // for the case where the dialog is welded, and is running async without a DialogController
+ std::shared_ptr<weld::Dialog> mxOwnerSelf;
+ std::function<void(sal_Int32)> maEndDialogFn;
+ bool isSet() const { return !!maEndDialogFn; }
+ };
+
+ bool StartExecuteAsync(const std::function<void(sal_Int32)> &rEndDialogFn)
+ {
+ AsyncContext aCtx;
+ aCtx.mxOwner = this;
+ aCtx.maEndDialogFn = rEndDialogFn;
+ return StartExecuteAsync(aCtx);
+ }
+
+ /// Commence execution of a modal dialog.
+ virtual bool StartExecuteAsync(AsyncContext &);
+
+ // Screenshot interface
+ virtual std::vector<OString> getAllPageUIXMLDescriptions() const;
+ virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription);
+ virtual BitmapEx createScreenshot() const;
+ virtual OString GetScreenshotId() const { return OString(); };
+};
+
+class VCL_DLLPUBLIC VclAbstractTerminatedDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~VclAbstractTerminatedDialog() override = default;
+public:
+ virtual void EndDialog(sal_Int32 nResult) = 0;
+};
+
+class VCL_DLLPUBLIC AbstractPasswordToOpenModifyDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractPasswordToOpenModifyDialog() override = default;
+public:
+ virtual OUString GetPasswordToOpen() const = 0;
+ virtual OUString GetPasswordToModify() const = 0;
+ virtual bool IsRecommendToOpenReadonly() const = 0;
+};
+
+class VCL_DLLPUBLIC AbstractScreenshotAnnotationDlg : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractScreenshotAnnotationDlg() override = default;
+};
+
+class VCL_DLLPUBLIC AbstractSignatureLineDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSignatureLineDialog() override = default;
+};
+
+class VCL_DLLPUBLIC AbstractSignSignatureLineDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractSignSignatureLineDialog() override = default;
+};
+
+class VCL_DLLPUBLIC AbstractQrCodeGenDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractQrCodeGenDialog() override = default;
+};
+
+class VCL_DLLPUBLIC AbstractAdditionsDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractAdditionsDialog() override = default;
+};
+
+/** Edit Diagram dialog */
+class VCL_DLLPUBLIC AbstractDiagramDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractDiagramDialog() override = default;
+};
+
+class VCL_DLLPUBLIC VclAbstractDialogFactory
+{
+public:
+ virtual ~VclAbstractDialogFactory(); // needed for export of vtable
+ static VclAbstractDialogFactory* Create();
+ // The Id is an implementation detail of the factory
+ virtual VclPtr<VclAbstractDialog> CreateVclDialog(weld::Window* pParent, sal_uInt32 nId) = 0;
+
+ // creates instance of PasswordToOpenModifyDialog from cui
+ virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) = 0;
+
+ // creates instance of SignatureDialog from cui
+ virtual VclPtr<AbstractSignatureLineDialog>
+ CreateSignatureLineDialog(weld::Window* pParent,
+ const css::uno::Reference<css::frame::XModel> xModel,
+ bool bEditExisting)
+ = 0;
+
+ // creates instance of SignSignatureDialog from cui
+ virtual VclPtr<AbstractSignSignatureLineDialog>
+ CreateSignSignatureLineDialog(weld::Window* pParent,
+ const css::uno::Reference<css::frame::XModel> xModel)
+ = 0;
+
+ // creates instance of QrCodeDialog from cui
+ virtual VclPtr<AbstractQrCodeGenDialog>
+ CreateQrCodeGenDialog(weld::Window* pParent,
+ const css::uno::Reference<css::frame::XModel> xModel,
+ bool bEditExisting)
+ = 0;
+
+ // creates instance of ScreenshotAnnotationDlg from cui
+ virtual VclPtr<AbstractScreenshotAnnotationDlg> CreateScreenshotAnnotationDlg(
+ weld::Dialog& rParentDialog) = 0;
+
+ // create additions dialog
+ virtual VclPtr<AbstractAdditionsDialog>
+ CreateAdditionsDialog(weld::Window* pParent, const OUString& sAdditionsTag) = 0;
+
+ virtual VclPtr<AbstractDiagramDialog> CreateDiagramDialog(
+ weld::Window* pParent,
+ SdrObjGroup& rDiagram) = 0;
+
+#ifdef _WIN32
+ virtual VclPtr<VclAbstractDialog>
+ CreateFileExtCheckDialog(weld::Window* _pParent, const OUString& sTitle, const OUString& sMsg)
+ = 0;
+#endif
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/accessiblefactory.hxx b/include/vcl/accessiblefactory.hxx
new file mode 100644
index 000000000..a13e4dabc
--- /dev/null
+++ b/include/vcl/accessiblefactory.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_ACCESSIBLEFACTORY_HXX
+#define INCLUDED_VCL_ACCESSIBLEFACTORY_HXX
+
+#include <vcl/AccessibleBrowseBoxObjType.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <salhelper/simplereferenceobject.hxx>
+#include <tools/gen.hxx>
+
+namespace com::sun::star {
+ namespace accessibility {
+ class XAccessible;
+ class XAccessibleContext;
+ }
+ namespace awt {
+ class XWindow;
+ }
+}
+
+namespace vcl { class IAccessibleBrowseBox; }
+namespace vcl { class IAccessibleTabListBox; }
+namespace vcl { class IAccessibleTableProvider; }
+
+class SvHeaderTabListBox;
+class SvtIconChoiceCtrl;
+class TabBar;
+class SvTreeListBox;
+class VCLXWindow;
+class TextEngine;
+class TextView;
+
+namespace vcl
+{
+ namespace table
+ {
+ class IAccessibleTable;
+ class IAccessibleTableControl;
+ }
+
+ /** a function which is able to create a factory for the standard Accessible/Context
+ components needed for standard toolkit controls
+
+ The returned pointer denotes an instance of the IAccessibleFactory, which has been acquired
+ <em>once</em>. The caller is responsible for holding this reference as long as it needs the
+ factory, and release it afterwards.
+ */
+ typedef void* (* GetSvtAccessibilityComponentFactory)( );
+
+
+ //= IAccessibleFactory
+
+ class IAccessibleFactory : public virtual ::salhelper::SimpleReferenceObject
+ {
+ public:
+ virtual vcl::IAccessibleTabListBox*
+ createAccessibleTabListBox(
+ const css::uno::Reference< css::accessibility::XAccessible >& rxParent,
+ SvHeaderTabListBox& rBox
+ ) const = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ createAccessibleTreeListBox(
+ SvTreeListBox& _rListBox,
+ const css::uno::Reference< css::accessibility::XAccessible >& _xParent
+ ) const = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ createAccessibleIconView(
+ SvTreeListBox& _rListBox,
+ const css::uno::Reference< css::accessibility::XAccessible >& _xParent
+ ) const = 0;
+ virtual vcl::IAccessibleBrowseBox*
+ createAccessibleBrowseBox(
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxParent,
+ vcl::IAccessibleTableProvider& _rBrowseBox
+ ) const = 0;
+ virtual table::IAccessibleTableControl*
+ createAccessibleTableControl(
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxParent,
+ table::IAccessibleTable& _rTable
+ ) const = 0;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ createAccessibleIconChoiceCtrl(
+ SvtIconChoiceCtrl& _rIconCtrl,
+ const css::uno::Reference< css::accessibility::XAccessible >& _xParent
+ ) const = 0;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ createAccessibleTabBar(
+ TabBar& _rTabBar
+ ) const = 0;
+
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext >
+ createAccessibleTextWindowContext(
+ VCLXWindow* pVclXWindow, TextEngine& rEngine, TextView& rView
+ ) const = 0;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ createAccessibleBrowseBoxHeaderBar(
+ const css::uno::Reference< css::accessibility::XAccessible >& rxParent,
+ vcl::IAccessibleTableProvider& _rOwningTable,
+ AccessibleBrowseBoxObjType _eObjType
+ ) const = 0;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ createAccessibleBrowseBoxTableCell(
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxParent,
+ vcl::IAccessibleTableProvider& _rBrowseBox,
+ const css::uno::Reference< css::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowId,
+ sal_uInt16 _nColId,
+ sal_Int32 _nOffset
+ ) const = 0;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ createAccessibleBrowseBoxHeaderCell(
+ sal_Int32 _nColumnRowId,
+ const css::uno::Reference< css::accessibility::XAccessible >& rxParent,
+ vcl::IAccessibleTableProvider& _rBrowseBox,
+ const css::uno::Reference< css::awt::XWindow >& _xFocusWindow,
+ AccessibleBrowseBoxObjType _eObjType
+ ) const = 0;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ createAccessibleCheckBoxCell(
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxParent,
+ vcl::IAccessibleTableProvider& _rBrowseBox,
+ const css::uno::Reference< css::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos,
+ const TriState& _eState,
+ bool _bIsTriState
+ ) const = 0;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ createEditBrowseBoxTableCellAccess(
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxParent,
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxControlAccessible,
+ const css::uno::Reference< css::awt::XWindow >& _rxFocusWindow,
+ vcl::IAccessibleTableProvider& _rBrowseBox,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos
+ ) const = 0;
+
+ protected:
+ virtual ~IAccessibleFactory() override {}
+ };
+
+} // namespace vcl
+
+
+#endif // INCLUDED_VCL_ACCESSIBLEFACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/accessibletable.hxx b/include/vcl/accessibletable.hxx
new file mode 100644
index 000000000..3e3cd2fcb
--- /dev/null
+++ b/include/vcl/accessibletable.hxx
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_ACCESSIBLETABLE_HXX
+#define INCLUDED_VCL_ACCESSIBLETABLE_HXX
+
+#include <tools/gen.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::accessibility { class XAccessible; }
+namespace utl { class AccessibleStateSetHelper; }
+namespace vcl { class Window; }
+
+namespace vcl::table
+{
+
+typedef sal_Int32 RowPos;
+
+enum AccessibleTableControlObjType
+{
+ TCTYPE_GRIDCONTROL, /// The GridControl itself.
+ TCTYPE_TABLE, /// The data table.
+ TCTYPE_ROWHEADERBAR, /// The row header bar.
+ TCTYPE_COLUMNHEADERBAR, /// The horizontal column header bar.
+ TCTYPE_TABLECELL, /// A cell of the data table.
+ TCTYPE_ROWHEADERCELL, /// A cell of the row header bar.
+ TCTYPE_COLUMNHEADERCELL, /// A cell of the column header bar.
+};
+
+
+/** This abstract class provides methods to implement an accessible table object.
+*/
+class IAccessibleTable
+{
+public:
+ /** @return The position of the current row. */
+ virtual sal_Int32 GetCurrentRow() const = 0;
+ /** @return The position of the current column. */
+ virtual sal_Int32 GetCurrentColumn() const = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex )= 0;
+ virtual OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const= 0;
+ virtual void GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow )= 0;
+ virtual bool HasColHeader() = 0;
+ virtual bool HasRowHeader() = 0;
+
+ /** return the description of the specified object.
+ @param eObjType
+ The type to ask for
+ @return
+ The description of the specified object.
+ */
+ virtual OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType) const= 0;
+
+ /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
+ the accessible object), depending on the specified object type. */
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet,
+ AccessibleTableControlObjType eObjType ) const= 0;
+
+ // Window
+ virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const = 0;
+ virtual void GrabFocus()= 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible()= 0;
+ virtual vcl::Window* GetAccessibleParentWindow() const= 0;
+ virtual vcl::Window* GetWindowInstance()= 0;
+ virtual sal_Int32 GetAccessibleControlCount() const = 0;
+ virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )= 0;
+ virtual sal_Int32 GetRowCount() const= 0;
+ virtual sal_Int32 GetColumnCount() const= 0;
+ virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )= 0;
+ virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar ) = 0;
+ virtual tools::Rectangle calcHeaderCellRect( bool _bColHeader, sal_Int32 _nPos ) = 0;
+ virtual tools::Rectangle calcTableRect() = 0;
+ virtual tools::Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos ) = 0;
+ virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)= 0;
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)= 0;
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const= 0;
+ virtual OUString GetRowName(sal_Int32 _nIndex) const = 0;
+ virtual OUString GetColumnName( sal_Int32 _nIndex ) const = 0;
+ virtual OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
+
+ virtual sal_Int32 GetSelectedRowCount() const = 0;
+ virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const = 0;
+ virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const = 0;
+ virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ) = 0;
+ virtual void SelectAllRows( bool const i_select ) = 0;
+
+protected:
+ ~IAccessibleTable() {}
+};
+
+
+/** interface for an implementation of a table control's Accessible component
+*/
+class IAccessibleTableControl
+{
+public:
+ /** returns the XAccessible object itself
+
+ The reference returned here can be used to control the life time of the
+ IAccessibleTableImplementation object.
+
+ The returned reference is guaranteed to not be <NULL/>.
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getMyself() = 0;
+
+ /** disposes the accessible implementation, so that it becomes defunc
+ */
+ virtual void DisposeAccessImpl() = 0;
+
+ /** checks whether the accessible implementation, and its context, are still alive
+ @return <TRUE/>, if the object is not disposed or disposing.
+ */
+ virtual bool isAlive() const = 0;
+
+ /** commits the event at all listeners of the cell
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ virtual void commitCellEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue
+ ) = 0;
+ /** commits the event at all listeners of the table
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ virtual void commitTableEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue
+ ) = 0;
+
+ ///** Commits an event to all listeners. */
+ virtual void commitEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue
+ ) = 0;
+
+protected:
+ ~IAccessibleTableControl() {}
+};
+
+} // namespace vcl::table
+
+#endif // INCLUDED_VCL_ACCESSIBLETABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/accessibletableprovider.hxx b/include/vcl/accessibletableprovider.hxx
new file mode 100644
index 000000000..cf7a0d097
--- /dev/null
+++ b/include/vcl/accessibletableprovider.hxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_ACCESSIBLETABLEPROVIDER_HXX
+#define INCLUDED_VCL_ACCESSIBLETABLEPROVIDER_HXX
+
+#include <vcl/AccessibleBrowseBoxObjType.hxx>
+#include <vcl/window.hxx>
+
+namespace com::sun::star::accessibility { class XAccessible; }
+namespace utl { class AccessibleStateSetHelper; }
+
+namespace vcl
+{
+
+#define OFFSET_DEFAULT (sal_Int32(-1))
+#define OFFSET_NONE (sal_Int32(0))
+
+enum AccessibleTableChildIndex
+{
+ /** Child index of the column header bar (first row). Exists always. */
+ BBINDEX_COLUMNHEADERBAR = 0,
+ /** Child index of the row header bar ("handle column"). Exists always. */
+ BBINDEX_ROWHEADERBAR = 1,
+ /** Child index of the data table. */
+ BBINDEX_TABLE = 2,
+ /** Child index of the first additional control. */
+ BBINDEX_FIRSTCONTROL = 3
+};
+
+
+/** This abstract class provides methods to implement an accessible table object.
+*/
+class IAccessibleTableProvider
+{
+public:
+ /** @return The count of the rows. */
+ virtual sal_Int32 GetRowCount() const = 0;
+ /** @return The count of the columns. */
+ virtual sal_uInt16 GetColumnCount() const = 0;
+
+ /** @return The position of the current row. */
+ virtual sal_Int32 GetCurrRow() const = 0;
+ /** @return The position of the current column. */
+ virtual sal_uInt16 GetCurrColumn() const = 0;
+
+ /** @return The description of a row.
+ @param _nRow The row which description is in demand. */
+ virtual OUString GetRowDescription( sal_Int32 _nRow ) const = 0;
+ /** @return The description of a column.
+ @param _nColumn The column which description is in demand. */
+ virtual OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0;
+
+ /** @return <TRUE/>, if the object has a row header. */
+ virtual bool HasRowHeader() const = 0; //GetColumnId
+ virtual bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0;
+
+ virtual void SetNoSelection() = 0;
+ virtual void SelectAll() = 0;
+ virtual void SelectRow( sal_Int32 _nRow, bool _bSelect = true, bool bExpand = true ) = 0;
+ virtual void SelectColumn( sal_uInt16 _nColumnPos, bool _bSelect = true ) = 0;
+ virtual sal_Int32 GetSelectedRowCount() const = 0;
+ virtual sal_Int32 GetSelectedColumnCount() const = 0;
+ /** @return <TRUE/>, if the row is selected. */
+ virtual bool IsRowSelected( sal_Int32 _nRow ) const = 0;
+ virtual bool IsColumnSelected( sal_Int32 _nColumnPos ) const = 0;
+ virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const = 0;
+ virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const = 0;
+
+ /** @return <TRUE/>, if the cell is visible. */
+ virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0;
+ virtual OUString GetAccessibleCellText( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0;
+
+ virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) = 0;
+ virtual tools::Rectangle calcTableRect( bool _bOnScreen = true ) = 0;
+ virtual tools::Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumnPos, bool _bIsHeader, bool _bOnScreen = true ) = 0;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) = 0;
+
+ virtual sal_Int32 GetAccessibleControlCount() const = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) = 0;
+ virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) = 0;
+
+ virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) = 0;
+ virtual bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) = 0;
+ virtual bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) = 0;
+
+ virtual OUString GetAccessibleObjectName( AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const = 0;
+ virtual OUString GetAccessibleObjectDescription( AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const = 0;
+
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, AccessibleBrowseBoxObjType _eType ) const = 0;
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0;
+ virtual void GrabTableFocus() = 0;
+
+ // OutputDevice
+ virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) = 0;
+
+ // Window
+ virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const = 0;
+ virtual void GrabFocus() = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() = 0;
+ virtual vcl::Window* GetAccessibleParentWindow() const = 0;
+ virtual vcl::Window* GetWindowInstance() = 0;
+
+ virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) = 0;
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) = 0;
+
+protected:
+ ~IAccessibleTableProvider() {}
+};
+
+
+/** interface for an implementation of a table control's Accessible component
+*/
+class IAccessibleTabListBox
+{
+public:
+ /** returns the XAccessible object itself
+
+ The reference returned here can be used to control the life time of the
+ IAccessibleTableImplementation object.
+
+ The returned reference is guaranteed to not be <NULL/>.
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getMyself() = 0;
+
+ /** returns the accessible object for the column header bar
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getHeaderBar() = 0;
+
+protected:
+ ~IAccessibleTabListBox() {}
+};
+
+/** interface for an implementation of a browse box's Accessible component
+*/
+class IAccessibleBrowseBox
+{
+public:
+ /** returns the XAccessible object itself
+
+ The reference returned here can be used to control the life time of the
+ IAccessibleTableImplementation object.
+
+ The returned reference is guaranteed to not be <NULL/>.
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getMyself() = 0;
+
+ /** disposes the accessible implementation, so that it becomes defunc
+ */
+ virtual void dispose() = 0;
+
+ /** checks whether the accessible implementation, and its context, are still alive
+ @return <TRUE/>, if the object is not disposed or disposing.
+ */
+ virtual bool isAlive() const = 0;
+
+ /** returns the accessible object for the row or the column header bar
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getHeaderBar( AccessibleBrowseBoxObjType _eObjType ) = 0;
+
+ /** returns the accessible object for the table representation
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getTable() = 0;
+
+ /** commits the event at all listeners of the column/row header bar
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ virtual void commitHeaderBarEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue,
+ bool _bColumnHeaderBar
+ ) = 0;
+
+ /** commits the event at all listeners of the table
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ virtual void commitTableEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue
+ ) = 0;
+
+ /** Commits an event to all listeners. */
+ virtual void commitEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue
+ ) = 0;
+
+protected:
+ ~IAccessibleBrowseBox() {}
+};
+
+} // namespace vcl
+
+#endif // INCLUDED_VCL_ACCESSIBLETABLEPROVIDER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx
new file mode 100644
index 000000000..1078ce06f
--- /dev/null
+++ b/include/vcl/alpha.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_ALPHA_HXX
+#define INCLUDED_VCL_ALPHA_HXX
+
+#include <sal/config.h>
+
+#include <utility>
+
+#include <vcl/dllapi.h>
+#include <vcl/bitmap.hxx>
+
+class BitmapEx;
+
+class VCL_DLLPUBLIC AlphaMask final : public Bitmap
+{
+public:
+
+ AlphaMask();
+ explicit AlphaMask( const Bitmap& rBitmap );
+ AlphaMask( const AlphaMask& rAlphaMask );
+ AlphaMask( AlphaMask&& rAlphaMask );
+ explicit AlphaMask( const Size& rSizePixel, const sal_uInt8* pEraseTransparency = nullptr );
+ virtual ~AlphaMask() override;
+
+ AlphaMask& operator=( const Bitmap& rBitmap );
+ AlphaMask& operator=( const AlphaMask& rAlphaMask ) { return static_cast<AlphaMask&>( Bitmap::operator=( rAlphaMask ) ); }
+ AlphaMask& operator=( AlphaMask&& rAlphaMask ) noexcept { return static_cast<AlphaMask&>( Bitmap::operator=( std::move(rAlphaMask) ) ); }
+ bool operator==( const AlphaMask& rAlphaMask ) const { return Bitmap::operator==(rAlphaMask); }
+ bool operator!=( const AlphaMask& rAlphaMask ) const { return Bitmap::operator!=(rAlphaMask); }
+
+ Bitmap const & GetBitmap() const;
+
+ void Erase( sal_uInt8 cTransparency );
+ void BlendWith(const Bitmap& rOther);
+
+ BitmapReadAccess* AcquireAlphaReadAccess() { return Bitmap::AcquireReadAccess(); }
+ BitmapWriteAccess* AcquireAlphaWriteAccess() { return Bitmap::AcquireWriteAccess(); }
+
+ void ReleaseAccess( BitmapReadAccess* pAccess );
+
+ typedef vcl::ScopedBitmapAccess<BitmapReadAccess, AlphaMask, &AlphaMask::AcquireAlphaReadAccess> ScopedReadAccess;
+
+ using Bitmap::IsEmpty;
+
+private:
+ friend class BitmapEx;
+ friend class ::OutputDevice;
+ friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& rIStm, bool bFileHeader, bool bMSOFormat);
+
+ SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const;
+ SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap );
+
+};
+
+#endif // INCLUDED_VCL_ALPHA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/animate/Animation.hxx b/include/vcl/animate/Animation.hxx
new file mode 100644
index 000000000..94cefee2e
--- /dev/null
+++ b/include/vcl/animate/Animation.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_ANIMATE_ANIMATION_HXX
+#define INCLUDED_VCL_ANIMATE_ANIMATION_HXX
+
+#include <tools/solar.h>
+#include <vcl/dllapi.h>
+#include <vcl/timer.hxx>
+#include <vcl/animate/AnimationBitmap.hxx>
+
+#define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
+
+class ImplAnimView;
+
+class VCL_DLLPUBLIC Animation
+{
+public:
+ Animation();
+ Animation(const Animation& rAnimation);
+ ~Animation();
+
+ Animation& operator=(const Animation& rAnimation);
+ bool operator==(const Animation& rAnimation) const;
+ bool operator!=(const Animation& rAnimation) const { return !(*this == rAnimation); }
+
+ void Clear();
+
+ bool Start(OutputDevice& rOutDev, const Point& rDestPt, const Size& rDestSz,
+ tools::Long nExtraData, OutputDevice* pFirstFrameOutDev);
+
+ void Stop(const OutputDevice* pOutDev = nullptr, tools::Long nExtraData = 0);
+
+ void Draw(OutputDevice& rOutDev, const Point& rDestPt) const;
+ void Draw(OutputDevice& rOutDev, const Point& rDestPt, const Size& rDestSz) const;
+
+ bool IsInAnimation() const { return mbIsInAnimation; }
+ bool IsTransparent() const;
+
+ const Size& GetDisplaySizePixel() const { return maGlobalSize; }
+ void SetDisplaySizePixel(const Size& rSize) { maGlobalSize = rSize; }
+
+ const BitmapEx& GetBitmapEx() const { return maBitmapEx; }
+ void SetBitmapEx(const BitmapEx& rBmpEx) { maBitmapEx = rBmpEx; }
+
+ sal_uInt32 GetLoopCount() const { return mnLoopCount; }
+ void SetLoopCount(const sal_uInt32 nLoopCount);
+ void ResetLoopCount();
+
+ void SetNotifyHdl(const Link<Animation*, void>& rLink) { maNotifyLink = rLink; }
+ const Link<Animation*, void>& GetNotifyHdl() const { return maNotifyLink; }
+
+ std::vector<std::unique_ptr<AnimationBitmap>>& GetAnimationFrames() { return maList; }
+ size_t Count() const { return maList.size(); }
+ bool Insert(const AnimationBitmap& rAnimationBitmap);
+ const AnimationBitmap& Get(sal_uInt16 nAnimation) const;
+ void Replace(const AnimationBitmap& rNewAnimationBmp, sal_uInt16 nAnimation);
+
+ sal_uLong GetSizeBytes() const;
+ BitmapChecksum GetChecksum() const;
+
+public:
+ void Convert(BmpConversion eConversion);
+ bool ReduceColors(sal_uInt16 nNewColorCount);
+
+ bool Invert();
+ void Mirror(BmpMirrorFlags nMirrorFlags);
+ void Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent,
+ short nChannelGPercent, short nChannelBPercent, double fGamma = 1.0,
+ bool bInvert = false);
+
+ friend SvStream& ReadAnimation(SvStream& rIStream, Animation& rAnimation);
+ friend SvStream& WriteAnimation(SvStream& rOStream, const Animation& rAnimation);
+
+public:
+ SAL_DLLPRIVATE static void ImplIncAnimCount() { mnAnimCount++; }
+ SAL_DLLPRIVATE static void ImplDecAnimCount() { mnAnimCount--; }
+ SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnPos; }
+
+private:
+ SAL_DLLPRIVATE static sal_uLong mnAnimCount;
+
+ std::vector<std::unique_ptr<AnimationBitmap>> maList;
+ std::vector<std::unique_ptr<ImplAnimView>> maViewList;
+
+ Link<Animation*, void> maNotifyLink;
+ BitmapEx maBitmapEx;
+ Timer maTimer;
+ Size maGlobalSize;
+ sal_uInt32 mnLoopCount;
+ sal_uInt32 mnLoops;
+ size_t mnPos;
+ bool mbIsInAnimation;
+ bool mbLoopTerminated;
+
+ SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
+ DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
+};
+
+#endif // INCLUDED_VCL_ANIMATE_ANIMATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/animate/AnimationBitmap.hxx b/include/vcl/animate/AnimationBitmap.hxx
new file mode 100644
index 000000000..d06f820f8
--- /dev/null
+++ b/include/vcl/animate/AnimationBitmap.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_ANIMATE_ANIMATIONBITMAP_HXX
+#define INCLUDED_VCL_ANIMATE_ANIMATIONBITMAP_HXX
+
+#include <vcl/bitmapex.hxx>
+
+enum class Disposal
+{
+ Not,
+ Back,
+ Previous
+};
+
+struct AnimationBitmap
+{
+ BitmapEx maBitmapEx;
+ Point maPositionPixel;
+ Size maSizePixel;
+ tools::Long mnWait;
+ Disposal meDisposal;
+ bool mbUserInput;
+
+ AnimationBitmap()
+ : mnWait(0)
+ , meDisposal(Disposal::Not)
+ , mbUserInput(false)
+ {
+ }
+
+ AnimationBitmap(const BitmapEx& rBitmapEx, const Point& rPositionPixel, const Size& rSizePixel,
+ tools::Long nWait = 0, Disposal eDisposal = Disposal::Not)
+ : maBitmapEx(rBitmapEx)
+ , maPositionPixel(rPositionPixel)
+ , maSizePixel(rSizePixel)
+ , mnWait(nWait)
+ , meDisposal(eDisposal)
+ , mbUserInput(false)
+ {
+ }
+
+ bool operator==(const AnimationBitmap& rAnimationBitmap) const
+ {
+ return (rAnimationBitmap.maBitmapEx == maBitmapEx
+ && rAnimationBitmap.maPositionPixel == maPositionPixel
+ && rAnimationBitmap.maSizePixel == maSizePixel && rAnimationBitmap.mnWait == mnWait
+ && rAnimationBitmap.meDisposal == meDisposal
+ && rAnimationBitmap.mbUserInput == mbUserInput);
+ }
+
+ bool operator!=(const AnimationBitmap& rAnimationBitmap) const
+ {
+ return !(*this == rAnimationBitmap);
+ }
+
+ BitmapChecksum GetChecksum() const;
+};
+
+#endif // INCLUDED_VCL_ANIMATE_ANIMATIONBITMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
new file mode 100644
index 000000000..d27ffdaa8
--- /dev/null
+++ b/include/vcl/bitmap.hxx
@@ -0,0 +1,570 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_BITMAP_HXX
+#define INCLUDED_VCL_BITMAP_HXX
+
+#include <tools/degree.hxx>
+#include <vcl/checksum.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/mapmod.hxx>
+#include <vcl/region.hxx>
+#include <vcl/scopedbitmapaccess.hxx>
+#include <vcl/bitmap/BitmapTypes.hxx>
+
+#include <o3tl/typed_flags_set.hxx>
+
+#include <memory>
+
+#define GAMMA( _def_cVal, _def_InvGamma ) (static_cast<sal_uInt8>(MinMax(FRound(pow( _def_cVal/255.0,_def_InvGamma)*255.0),0,255)))
+
+class Color;
+
+template <typename Arg, typename Ret> class Link;
+
+enum class BmpMirrorFlags
+{
+ NONE = 0x00,
+ Horizontal = 0x01,
+ Vertical = 0x02,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<BmpMirrorFlags> : is_typed_flags<BmpMirrorFlags, 0x03> {};
+}
+
+enum class BmpScaleFlag
+{
+// Try to preferably use these.
+ Default,
+ Fast,
+ BestQuality,
+// Specific algorithms, use only if you really need to (mainly used for tests)
+ NearestNeighbor,
+ Interpolate, // fast, integer bilinear
+ Lanczos,
+ BiCubic,
+ BiLinear
+};
+
+#define BMP_COL_TRANS Color( 252, 3, 251 )
+
+enum class BmpConversion
+{
+ NNONE,
+ N1BitThreshold,
+ N8BitGreys,
+ N8BitColors,
+ N24Bit,
+ N32Bit,
+ N8BitTrans,
+ N8BitNoConversion // make 8bit without color conversion (e.g. take the red channel)
+};
+
+class BitmapInfoAccess;
+class BitmapReadAccess;
+class BitmapWriteAccess;
+class BitmapPalette;
+class GDIMetaFile;
+class AlphaMask;
+class OutputDevice;
+class SalBitmap;
+
+struct BitmapSystemData
+{
+ #if defined(_WIN32)
+ void* pDIB; // device independent byte buffer
+ #elif defined( MACOSX ) || defined( IOS )
+ // Nothing needed, apparently
+ #else
+ void* aPixmap;
+ #endif
+ int mnWidth;
+ int mnHeight;
+};
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC Bitmap
+{
+public:
+
+ Bitmap();
+ Bitmap( const Bitmap& rBitmap );
+ Bitmap( const Size& rSizePixel, vcl::PixelFormat ePixelFormat, const BitmapPalette* pPal = nullptr );
+ explicit Bitmap( std::shared_ptr<SalBitmap> const & xSalBitmap );
+ virtual ~Bitmap();
+
+ Bitmap& operator=( const Bitmap& rBitmap );
+ Bitmap& operator=( Bitmap&& rBitmap ) noexcept;
+ bool operator==( const Bitmap& rBitmap ) const;
+ bool operator!=( const Bitmap& rBitmap ) const { return !operator==(rBitmap); }
+
+ inline bool IsEmpty() const;
+ void SetEmpty();
+
+ inline const MapMode& GetPrefMapMode() const;
+ inline void SetPrefMapMode( const MapMode& rMapMode );
+
+ inline const Size& GetPrefSize() const;
+ inline void SetPrefSize( const Size& rSize );
+
+ Size GetSizePixel() const;
+
+ vcl::PixelFormat getPixelFormat() const;
+ inline sal_Int64 GetSizeBytes() const;
+ bool HasGreyPalette8Bit() const;
+ bool HasGreyPaletteAny() const;
+ /** get system dependent bitmap data
+
+ @param rData
+ The system dependent BitmapSystemData structure to be filled
+
+ @return true if the bitmap has a valid system object (e.g. not empty)
+ */
+ bool GetSystemData( BitmapSystemData& rData ) const;
+
+ BitmapChecksum GetChecksum() const;
+
+ Bitmap CreateDisplayBitmap( OutputDevice* pDisplay ) const;
+
+ static const BitmapPalette&
+ GetGreyPalette( int nEntries );
+
+public:
+
+ /** Convert bitmap format
+
+ @param eConversion
+ The format this bitmap should be converted to.
+
+ @return true the conversion was completed successfully.
+ */
+ bool Convert( BmpConversion eConversion );
+
+ /** Apply a Floyd dither algorithm to the bitmap
+
+ This method dithers the bitmap inplace, i.e. a true color
+ bitmap is converted to a paletted bitmap, reducing the color
+ deviation by error diffusion.
+
+ */
+ bool Dither();
+
+ /** Crop the bitmap
+
+ @param rRectPixel
+ A rectangle specifying the crop amounts on all four sides of
+ the bitmap. If the upper left corner of the bitmap is assigned
+ (0,0), then this method cuts out the given rectangle from the
+ bitmap. Note that the rectangle is clipped to the bitmap's
+ dimension, i.e. negative left,top rectangle coordinates or
+ exceeding width or height is ignored.
+
+ @return true cropping was performed successfully. If
+ nothing had to be cropped, because e.g. the crop rectangle
+ included the bitmap, false is returned, too!
+ */
+ bool Crop( const tools::Rectangle& rRectPixel );
+
+ /** Expand the bitmap by pixel padding
+
+ @param nDX
+ Number of pixel to pad at the right border of the bitmap
+
+ @param nDY
+ Number of scanlines to pad at the bottom border of the bitmap
+
+ @param pInitColor
+ Color to use for padded pixel
+
+ @return true, if padding was performed successfully. false is
+ not only returned when the operation failed, but also if
+ nothing had to be done, e.g. because nDX and nDY were zero.
+ */
+ bool Expand(
+ sal_Int32 nDX, sal_Int32 nDY,
+ const Color* pInitColor = nullptr );
+
+ /** Copy a rectangular area from another bitmap
+
+ @param rRectDst
+ Destination rectangle in this bitmap. This is clipped to the
+ bitmap dimensions.
+
+ @param rRectSrc
+ Source rectangle in pBmpSrc. This is clipped to the source
+ bitmap dimensions. Note further that no scaling takes place
+ during this copy operation, i.e. only the minimum of source
+ and destination rectangle's width and height are used.
+
+ @param pBmpSrc
+ The source bitmap to copy from. If this argument is NULL, or
+ equal to the object this method is called on, copying takes
+ place within the same bitmap.
+
+ @return true, if the operation completed successfully. false
+ is not only returned when the operation failed, but also if
+ nothing had to be done, e.g. because one of the rectangles are
+ empty.
+ */
+ bool CopyPixel(
+ const tools::Rectangle& rRectDst,
+ const tools::Rectangle& rRectSrc,
+ const Bitmap* pBmpSrc = nullptr );
+
+ bool CopyPixel_AlphaOptimized(
+ const tools::Rectangle& rRectDst,
+ const tools::Rectangle& rRectSrc,
+ const Bitmap* pBmpSrc );
+
+ /** Perform boolean OR operation with another bitmap
+
+ @param rMask
+ The mask bitmap in the selected combine operation
+
+ @return true, if the operation was completed successfully.
+ */
+ bool CombineOr( const Bitmap& rMask );
+
+ /** Alpha-blend the given bitmap against a specified uniform
+ background color.
+
+ @attention This method might convert paletted bitmaps to
+ truecolor, to be able to represent every necessary color. Note
+ that during alpha blending, lots of colors not originally
+ included in the bitmap can be generated.
+
+ @param rAlpha
+ Alpha mask to blend with
+
+ @param rBackgroundColor
+ Background color to use for every pixel during alpha blending
+
+ @return true, if blending was successful, false otherwise
+ */
+ bool Blend(
+ const AlphaMask& rAlpha,
+ const Color& rBackgroundColor );
+
+ /** Fill the entire bitmap with the given color
+
+ @param rFillColor
+ Color value to use for filling
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Erase( const Color& rFillColor );
+
+ /** Perform the Invert operation on every pixel
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Invert();
+
+ /** Mirror the bitmap
+
+ @param nMirrorFlags
+ About which axis (horizontal, vertical, or both) to mirror
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Mirror( BmpMirrorFlags nMirrorFlags );
+
+ /** Scale the bitmap
+
+ @param rNewSize
+ The resulting size of the scaled bitmap
+
+ @param nScaleFlag
+ The algorithm to be used for scaling
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Scale( const Size& rNewSize, BmpScaleFlag nScaleFlag = BmpScaleFlag::Default );
+
+ /** Scale the bitmap
+
+ @param rScaleX
+ The scale factor in x direction.
+
+ @param rScaleY
+ The scale factor in y direction.
+
+ @param nScaleFlag
+ Method of scaling - it is recommended that either BmpScaleFlag::Default or BmpScaleFlag::BestQuality be used.
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag = BmpScaleFlag::Default );
+
+ /**
+ Returns true if bitmap scaling is considered to be fast.
+
+ Currently this returns true if OpenGL is used for scaling, otherwise false (CPU scaling is slower).
+
+ @since 4.5
+ */
+ static bool HasFastScale();
+
+ // Adapt the BitCount of rNew to BitCount of total, including grey or color palette
+ // Can be used to create alpha/mask bitmaps after their processing in 24bit
+ void AdaptBitCount(Bitmap& rNew) const;
+
+ /** Rotate bitmap by the specified angle
+
+ @param nAngle10
+ The rotation angle in tenth of a degree. The bitmap is always rotated around its center.
+
+ @param rFillColor
+ The color to use for filling blank areas. During rotation, the
+ bitmap is enlarged such that the whole rotation result fits
+ in. The empty spaces around that rotated original bitmap are
+ then filled with this color.
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Rotate( Degree10 nAngle10, const Color& rFillColor );
+
+ /** Create on-off mask from bitmap
+
+ This method creates a bitmask from the bitmap, where every
+ pixel that equals rTransColor is set transparent, the rest
+ opaque.
+
+ @param rTransColor
+ Color value where the bitmask should be transparent
+
+ @param nTol
+ Tolerance value. Specifies the maximal difference between
+ rTransColor and the individual pixel values, such that the
+ corresponding pixel is still regarded as transparent.
+
+ @return the resulting bitmask.
+ */
+ Bitmap CreateMask( const Color& rTransColor, sal_uInt8 nTol = 0 ) const;
+
+ /** Create region of similar colors in a given rectangle
+
+ @param rColor
+ All pixel which have this color are included in the calculated region
+
+ @param rRect
+ The rectangle within which matching pixel are looked for. This
+ rectangle is always clipped to the bitmap dimensions.
+
+ @return the generated region.
+ */
+ vcl::Region CreateRegion( const Color& rColor, const tools::Rectangle& rRect ) const;
+
+ /** Replace all pixel where the given mask is on with the specified color
+
+ @param rMask
+ Mask specifying which pixel should be replaced
+
+ @param rReplaceColor
+ Color to be placed in all changed pixel
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Replace( const Bitmap& rMask, const Color& rReplaceColor );
+
+ /** Merge bitmap with given background color according to specified alpha mask
+
+ @param rAlpha
+ Alpha mask specifying the amount of background color to merge in
+
+ @param rMergeColor
+ Background color to be used for merging
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Replace( const AlphaMask& rAlpha, const Color& rMergeColor );
+
+ /** Replace all pixel having the search color with the specified color
+
+ @param rSearchColor
+ Color specifying which pixel should be replaced
+
+ @param rReplaceColor
+ Color to be placed in all changed pixel
+
+ @param nTol
+ Tolerance value. Specifies the maximal difference between
+ rSearchColor and the individual pixel values, such that the
+ corresponding pixel is still regarded a match.
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol = 0 );
+
+ /** Replace all pixel having one the search colors with the corresponding replace color
+
+ @param pSearchColors
+ Array of colors specifying which pixel should be replaced
+
+ @param rReplaceColors
+ Array of colors to be placed in all changed pixel
+
+ @param nColorCount
+ Size of the aforementioned color arrays
+
+ @param pTols
+ Tolerance value. Specifies the maximal difference between
+ pSearchColor colors and the individual pixel values, such that
+ the corresponding pixel is still regarded a match.
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Replace(
+ const Color* pSearchColors,
+ const Color* rReplaceColors,
+ size_t nColorCount,
+ sal_uInt8 const * pTols );
+
+ /** Convert the bitmap to a meta file
+
+ This works by putting continuous areas of the same color into
+ polygons painted in this color, by tracing the area's bounding
+ line.
+
+ @param rMtf
+ The resulting meta file
+
+ @param cReduce
+ If non-null, minimal size of bound rects for individual polygons. Smaller ones are ignored.
+
+ @param pProgress
+ A callback for showing the progress of the vectorization
+ */
+ void Vectorize(
+ GDIMetaFile& rMtf,
+ sal_uInt8 cReduce,
+ const Link<tools::Long,void>* pProgress );
+
+ /** Change various global color characteristics
+
+ @param nLuminancePercent
+ Percent of luminance change, valid range [-100,100]. Values outside this range are clipped to the valid range.
+
+ @param nContrastPercent
+ Percent of contrast change, valid range [-100,100]. Values outside this range are clipped to the valid range.
+
+ @param nChannelRPercent
+ Percent of red channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
+
+ @param nChannelGPercent
+ Percent of green channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
+
+ @param nChannelBPercent
+ Percent of blue channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
+
+ @param fGamma
+ Exponent of the gamma function applied to the bitmap. The
+ value 1.0 results in no change, the valid range is
+ (0.0,10.0]. Values outside this range are regarded as 1.0.
+
+ @param bInvert
+ If true, invert the channel values with the logical 'not' operator
+
+ @param msoBrightness
+ Use the same formula for brightness as used by MSOffice.
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Adjust(
+ short nLuminancePercent,
+ short nContrastPercent = 0,
+ short nChannelRPercent = 0,
+ short nChannelGPercent = 0,
+ short nChannelBPercent = 0,
+ double fGamma = 1.0,
+ bool bInvert = false,
+ bool msoBrightness = false );
+
+public:
+ /** ReassignWithSize and recalculate bitmap.
+
+ ReassignWithSizes the bitmap, and recalculates the bitmap size based on the new bitmap.
+
+ @param rBitmap Bitmap to reassign and use for size calculation
+ */
+ SAL_DLLPRIVATE void ReassignWithSize(const Bitmap& rBitmap);
+
+ SAL_DLLPRIVATE void ImplMakeUnique();
+ const std::shared_ptr<SalBitmap>& ImplGetSalBitmap() const { return mxSalBmp; }
+ SAL_DLLPRIVATE void ImplSetSalBitmap( const std::shared_ptr<SalBitmap>& xImpBmp );
+
+ SAL_DLLPRIVATE bool ImplMakeGreyscales();
+
+public:
+
+ BitmapInfoAccess* AcquireInfoAccess();
+ BitmapReadAccess* AcquireReadAccess();
+ BitmapWriteAccess* AcquireWriteAccess();
+ static void ReleaseAccess( BitmapInfoAccess* pAccess );
+
+ typedef vcl::ScopedBitmapAccess<BitmapReadAccess, Bitmap, &Bitmap::AcquireReadAccess> ScopedReadAccess;
+ typedef vcl::ScopedBitmapAccess<BitmapInfoAccess, Bitmap, &Bitmap::AcquireInfoAccess> ScopedInfoAccess;
+
+private:
+ SAL_DLLPRIVATE bool ImplConvertUp(vcl::PixelFormat ePixelFormat, Color const* pExtColor = nullptr);
+ SAL_DLLPRIVATE bool ImplConvertDown8BPP(Color const* pExtColor = nullptr);
+
+private:
+ std::shared_ptr<SalBitmap> mxSalBmp;
+ MapMode maPrefMapMode;
+ Size maPrefSize;
+};
+
+inline bool Bitmap::IsEmpty() const
+{
+ return( mxSalBmp == nullptr );
+}
+
+inline const MapMode& Bitmap::GetPrefMapMode() const
+{
+ return maPrefMapMode;
+}
+
+inline void Bitmap::SetPrefMapMode( const MapMode& rMapMode )
+{
+ maPrefMapMode = rMapMode;
+}
+
+inline const Size& Bitmap::GetPrefSize() const
+{
+ return maPrefSize;
+}
+
+inline void Bitmap::SetPrefSize( const Size& rSize )
+{
+ maPrefSize = rSize;
+}
+
+inline sal_Int64 Bitmap::GetSizeBytes() const
+{
+ const auto aSizePixel = GetSizePixel();
+ const sal_Int64 aBitCount = vcl::pixelFormatBitCount(getPixelFormat());
+ sal_Int64 aSizeInBytes = (aSizePixel.Width() * aSizePixel.Height() * aBitCount) / 8;
+ return aSizeInBytes;
+}
+
+#endif // INCLUDED_VCL_BITMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/bitmap/BitmapTypes.hxx b/include/vcl/bitmap/BitmapTypes.hxx
new file mode 100644
index 000000000..10d0f5332
--- /dev/null
+++ b/include/vcl/bitmap/BitmapTypes.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <cassert>
+
+namespace vcl
+{
+/** Pixel format of the bitmap in bits per pixel */
+enum class PixelFormat
+{
+ INVALID = 0,
+ N1_BPP = 1,
+ N8_BPP = 8,
+ N24_BPP = 24,
+ N32_BPP = 32
+};
+
+/** Is it a pixel format that forces creation of a palette */
+constexpr bool isPalettePixelFormat(PixelFormat ePixelFormat)
+{
+ assert(ePixelFormat != PixelFormat::INVALID);
+ return sal_uInt16(ePixelFormat) <= 8;
+}
+
+constexpr sal_uInt16 pixelFormatBitCount(PixelFormat ePixelFormat)
+{
+ return sal_uInt16(ePixelFormat);
+}
+
+constexpr sal_Int64 numberOfColors(PixelFormat ePixelFormat)
+{
+ return sal_Int64(1) << sal_Int64(ePixelFormat);
+}
+
+constexpr PixelFormat bitDepthToPixelFormat(sal_uInt16 nBitDepth)
+{
+ switch (nBitDepth)
+ {
+ case 1:
+ return PixelFormat::N1_BPP;
+ case 4:
+ assert(false);
+ break;
+ case 8:
+ return PixelFormat::N8_BPP;
+ case 24:
+ return PixelFormat::N24_BPP;
+ case 32:
+ return PixelFormat::N32_BPP;
+ default:
+ break;
+ }
+ return PixelFormat::INVALID;
+}
+
+} // end namespace vcl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
new file mode 100644
index 000000000..f847c9f6d
--- /dev/null
+++ b/include/vcl/bitmapex.hxx
@@ -0,0 +1,512 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_BITMAPEX_HXX
+#define INCLUDED_VCL_BITMAPEX_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/alpha.hxx>
+#include <vcl/Scanline.hxx>
+#include <tools/color.hxx>
+#include <tools/degree.hxx>
+
+#include <sal/types.h>
+
+namespace com::sun::star::rendering {
+ class XBitmapCanvas;
+}
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace basegfx { class BColorModifierStack; }
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC BitmapEx
+{
+public:
+
+ BitmapEx();
+ explicit BitmapEx( const OUString& rIconName );
+ BitmapEx( const BitmapEx& rBitmapEx );
+ BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize );
+ BitmapEx(Size aSize, vcl::PixelFormat ePixelFormat);
+ explicit BitmapEx( const Bitmap& rBmp );
+ BitmapEx( const Bitmap& rBmp, const Bitmap& rMask );
+ BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask );
+ BitmapEx( const Bitmap& rBmp, const Color& rTransparentColor );
+
+ BitmapEx& operator=( const BitmapEx& rBitmapEx );
+ BitmapEx& operator=( const Bitmap& rBitmap ) { return operator=(BitmapEx(rBitmap)); }
+ bool operator==( const BitmapEx& rBitmapEx ) const;
+ bool operator!=( const BitmapEx& rBitmapEx ) const { return !(*this==rBitmapEx); }
+
+ bool IsEmpty() const;
+ void SetEmpty();
+ void Clear();
+
+ void Draw( OutputDevice* pOutDev,
+ const Point& rDestPt ) const;
+ void Draw( OutputDevice* pOutDev,
+ const Point& rDestPt, const Size& rDestSize ) const;
+
+ Bitmap GetBitmap( Color aTransparentReplaceColor ) const;
+ /// Gives direct access to the contained bitmap.
+ const Bitmap& GetBitmap() const;
+
+ bool IsAlpha() const;
+ AlphaMask GetAlpha() const;
+
+ const Size& GetSizePixel() const { return maBitmapSize; }
+ void SetSizePixel(const Size& rNewSize);
+
+ const Size& GetPrefSize() const { return maBitmap.GetPrefSize(); }
+ void SetPrefSize( const Size& rPrefSize ) { maBitmap.SetPrefSize( rPrefSize ); }
+
+ const MapMode& GetPrefMapMode() const { return maBitmap.GetPrefMapMode(); }
+ void SetPrefMapMode( const MapMode& rPrefMapMode ) { maBitmap.SetPrefMapMode( rPrefMapMode ); }
+
+ vcl::PixelFormat getPixelFormat() const
+ {
+ return maBitmap.getPixelFormat();
+ }
+
+ sal_Int64 GetSizeBytes() const;
+ BitmapChecksum GetChecksum() const;
+
+ /** Convert bitmap format
+
+ @param eConversion
+ The format this bitmap should be converted to.
+
+ @return true, if the conversion was completed successfully.
+ */
+ bool Convert( BmpConversion eConversion );
+
+ /** Crop the bitmap
+
+ @param rRectPixel
+ A rectangle specifying the crop amounts on all four sides of
+ the bitmap. If the upper left corner of the bitmap is assigned
+ (0,0), then this method cuts out the given rectangle from the
+ bitmap. Note that the rectangle is clipped to the bitmap's
+ dimension, i.e. negative left,top rectangle coordinates or
+ exceeding width or height is ignored.
+
+ @return true, if cropping was performed successfully. If
+ nothing had to be cropped, because e.g. the crop rectangle
+ included the bitmap, false is returned, too!
+ */
+ bool Crop( const tools::Rectangle& rRectPixel );
+
+ /** Expand the bitmap by pixel padding
+
+ @param nDX
+ Number of pixel to pad at the right border of the bitmap
+
+ @param nDY
+ Number of scanlines to pad at the bottom border of the bitmap
+
+ @param bExpandTransparent
+ Whether to expand the transparency color or not.
+ */
+ void Expand(
+ sal_Int32 nDX, sal_Int32 nDY,
+ bool bExpandTransparent = false );
+
+ /** Copy a rectangular area from another bitmap
+
+ @param rRectDst
+ Destination rectangle in this bitmap. This is clipped to the
+ bitmap dimensions.
+
+ @param rRectSrc
+ Source rectangle in pBmpSrc. This is clipped to the source
+ bitmap dimensions. Note further that no scaling takes place
+ during this copy operation, i.e. only the minimum of source
+ and destination rectangle's width and height are used.
+
+ @param pBmpExSrc
+ The source bitmap to copy from. If this argument is NULL, or
+ equal to the object this method is called on, copying takes
+ place within the same bitmap.
+
+ @return true, if the operation completed successfully. false
+ is not only returned when the operation failed, but also if
+ nothing had to be done, e.g. because one of the rectangles are
+ empty.
+ */
+ bool CopyPixel(
+ const tools::Rectangle& rRectDst,
+ const tools::Rectangle& rRectSrc,
+ const BitmapEx* pBmpExSrc );
+
+ /** Fill the entire bitmap with the given color
+
+ @param rFillColor
+ Color value to use for filling. Set the transparency part of
+ the color to fill the mask.
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Erase( const Color& rFillColor );
+
+ /** Perform the Invert operation on every pixel
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Invert();
+
+ /** Mirror the bitmap
+
+ @param nMirrorFlags
+ About which axis (horizontal, vertical, or both) to mirror
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Mirror( BmpMirrorFlags nMirrorFlags );
+
+ /** Scale the bitmap
+
+ @param rNewSize
+ The resulting size of the scaled bitmap
+
+ @param nScaleFlag
+ The algorithm to be used for scaling
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Scale(
+ const Size& rNewSize,
+ BmpScaleFlag nScaleFlag = BmpScaleFlag::Default );
+
+ /** Scale the bitmap
+
+ @param rScaleX
+ The scale factor in x direction.
+
+ @param rScaleY
+ The scale factor in y direction.
+
+ @param nScaleFlag
+ The algorithm to be used for scaling
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Scale(
+ const double& rScaleX,
+ const double& rScaleY,
+ BmpScaleFlag nScaleFlag = BmpScaleFlag::Default );
+
+ /** Rotate bitmap by the specified angle
+
+ @param nAngle10
+ The rotation angle in tenth of a degree. The bitmap is always rotated around its center.
+
+ @param rFillColor
+ The color to use for filling blank areas. During rotation, the
+ bitmap is enlarged such that the whole rotation result fits
+ in. The empty spaces around that rotated original bitmap are
+ then filled with this color.
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Rotate(
+ Degree10 nAngle10,
+ const Color& rFillColor );
+
+ /** Replace all pixel having the search color with the specified color
+
+ @param rSearchColor
+ Color specifying which pixel should be replaced
+
+ @param rReplaceColor
+ Color to be placed in all changed pixel
+ */
+ void Replace(
+ const Color& rSearchColor,
+ const Color& rReplaceColor );
+
+ /** Replace all pixel having the search color with the specified color
+
+ @param rSearchColor
+ Color specifying which pixel should be replaced
+
+ @param rReplaceColor
+ Color to be placed in all changed pixel
+
+ @param nTolerance
+ Tolerance value. Specifies the maximal difference between
+ rSearchColor and the individual pixel values, such that the
+ corresponding pixel is still regarded a match.
+ */
+ void Replace(
+ const Color& rSearchColor,
+ const Color& rReplaceColor,
+ sal_uInt8 nTolerance );
+
+ /** Replace all pixel having one the search colors with the corresponding replace color
+
+ @param pSearchColors
+ Array of colors specifying which pixel should be replaced
+
+ @param pReplaceColors
+ Array of colors to be placed in all changed pixel
+
+ @param nColorCount
+ Size of the aforementioned color arrays
+
+ @param pTols
+ Tolerance value. Specifies the maximal difference between
+ pSearchColor colors and the individual pixel values, such that
+ the corresponding pixel is still regarded a match.
+ */
+ void Replace(
+ const Color* pSearchColors,
+ const Color* pReplaceColors,
+ size_t nColorCount );
+
+ /** Replace all pixel having one the search colors with the corresponding replace color
+
+ @param pSearchColors
+ Array of colors specifying which pixel should be replaced
+
+ @param rReplaceColors
+ Array of colors to be placed in all changed pixel
+
+ @param nColorCount
+ Size of the aforementioned color arrays
+
+ @param pTols
+ Tolerance value. Specifies the maximal difference between
+ pSearchColor colors and the individual pixel values, such that
+ the corresponding pixel is still regarded a match.
+
+ @return true, if the operation was completed successfully.
+ */
+ void Replace(
+ const Color* pSearchColors,
+ const Color* pReplaceColors,
+ size_t nColorCount,
+ sal_uInt8 const * pTols );
+
+ /** Replace transparency with given color.
+ */
+ void ReplaceTransparency( const Color& rColor );
+
+ /** Get contours in image */
+ tools::Polygon GetContour( bool bContourEdgeDetect, const tools::Rectangle* pWorkRect );
+
+ /** Change various global color characteristics
+
+ @param nLuminancePercent
+ Percent of luminance change, valid range [-100,100]. Values outside this range are clipped to the valid range.
+
+ @param nContrastPercent
+ Percent of contrast change, valid range [-100,100]. Values outside this range are clipped to the valid range.
+
+ @param nChannelRPercent
+ Percent of red channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
+
+ @param nChannelGPercent
+ Percent of green channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
+
+ @param nChannelBPercent
+ Percent of blue channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
+
+ @param fGamma
+ Exponent of the gamma function applied to the bitmap. The
+ value 1.0 results in no change, the valid range is
+ (0.0,10.0]. Values outside this range are regarded as 1.0.
+
+ @param bInvert
+ If true, invert the channel values with the logical 'not' operator
+
+ @param msoBrightness
+ Use the same formula for brightness as used by MSOffice.
+
+ @return true, if the operation was completed successfully.
+ */
+ bool Adjust(
+ short nLuminancePercent,
+ short nContrastPercent,
+ short nChannelRPercent,
+ short nChannelGPercent,
+ short nChannelBPercent,
+ double fGamma = 1.0,
+ bool bInvert = false,
+ bool msoBrightness = false );
+
+ /** Get alpha at given position
+
+ @param nX
+ integer X-Position in Bitmap
+
+ @param nY
+ integer Y-Position in Bitmap
+
+ @return alpha value in the range of [0 .. 255] where
+ 0 is fully transparent, 255 is not transparent
+ */
+ sal_uInt8 GetAlpha(
+ sal_Int32 nX,
+ sal_Int32 nY) const;
+
+ /** Get pixel color (including alpha) at given position
+
+ @param nX
+ integer X-Position in Bitmap
+
+ @param nY
+ integer Y-Position in Bitmap
+ */
+ ::Color GetPixelColor(
+ sal_Int32 nX,
+ sal_Int32 nY) const;
+
+ /** Create transformed Bitmap
+
+ @param fWidth
+ The target width in pixels
+
+ @param fHeight
+ The target height in pixels
+
+ @param rTransformation
+ The back transformation for each pixel in (0 .. fWidth),(0 .. fHeight) to
+ local pixel coordinates
+ */
+ [[nodiscard]]
+ BitmapEx TransformBitmapEx(
+ double fWidth,
+ double fHeight,
+ const basegfx::B2DHomMatrix& rTransformation) const;
+
+ /** Create transformed Bitmap
+
+ @param rTransformation
+ The transformation from unit coordinates to the unit range
+
+ @param rVisibleRange
+ The relative visible range in unit coordinates, relative to (0,0,1,1) which
+ defines the whole target area
+
+ @param fMaximumArea
+ A limitation for the maximum size of pixels to use for the result
+
+ The target size of the result bitmap is defined by transforming the given
+ rTargetRange with the given rTransformation; the area of the result is
+ linearly scaled to not exceed the given fMaximumArea
+
+ @return The transformed bitmap
+ */
+ [[nodiscard]]
+ BitmapEx getTransformed(
+ const basegfx::B2DHomMatrix& rTransformation,
+ const basegfx::B2DRange& rVisibleRange,
+ double fMaximumArea) const;
+
+ /** Create ColorStack-modified version of this BitmapEx
+
+ @param rBColorModifierStack
+ A ColrModifierStack which defines how each pixel has to be modified
+ */
+ [[nodiscard]]
+ BitmapEx ModifyBitmapEx( const basegfx::BColorModifierStack& rBColorModifierStack) const;
+
+ [[nodiscard]]
+ static BitmapEx AutoScaleBitmap( BitmapEx const & aBitmap, const tools::Long aStandardSize );
+
+ /// populate from a canvas implementation
+ bool Create(
+ const css::uno::Reference< css::rendering::XBitmapCanvas > &xBitmapCanvas,
+ const Size &rSize );
+
+ void setAlphaFrom( sal_uInt8 cIndexFrom, sal_Int8 nAlphaTo );
+
+ void AdjustTransparency( sal_uInt8 cTrans );
+
+ void CombineMaskOr(Color maskColor, sal_uInt8 nTol);
+
+ /**
+ * Retrieves the color model data we need for the XImageConsumer stuff.
+ */
+ void GetColorModel(css::uno::Sequence< sal_Int32 >& rRGBPalette,
+ sal_uInt32& rnRedMask, sal_uInt32& rnGreenMask, sal_uInt32& rnBlueMask, sal_uInt32& rnAlphaMask, sal_uInt32& rnTransparencyIndex,
+ sal_uInt32& rnWidth, sal_uInt32& rnHeight, sal_uInt8& rnBitCount);
+
+ SAL_DLLPRIVATE std::shared_ptr<SalBitmap> const & ImplGetBitmapSalBitmap() const { return maBitmap.ImplGetSalBitmap(); }
+
+
+private:
+ friend class ImpGraphic;
+ friend class OutputDevice;
+ friend bool VCL_DLLPUBLIC WriteDIBBitmapEx(const BitmapEx& rSource, SvStream& rOStm);
+ friend bool VCL_DLLPUBLIC ReadRawDIB(BitmapEx& rTarget, const unsigned char* pBuf,
+ const ScanlineFormat nFormat,
+ const int nHeight,
+ const int nStride);
+
+ void loadFromIconTheme( const OUString& rIconName );
+
+ Bitmap maBitmap;
+ Bitmap maAlphaMask;
+ Size maBitmapSize;
+};
+
+
+/** Create a blend frame as BitmapEx
+
+ @param nAlpha
+ The blend value defines how strong the frame will be blended with the
+ existing content, 255 == full coverage, 0 == no frame will be drawn
+
+ @param aColorTopLeft, aColorBottomRight
+ The colors defining the frame. These colors are linearly interpolated from
+ aColorTopLeft and aColorBottomRight using the width and height of the area
+
+ @param rSize
+ The size of the frame in pixels
+ */
+BitmapEx VCL_DLLPUBLIC createBlendFrame(
+ const Size& rSize,
+ sal_uInt8 nAlpha,
+ Color aColorTopLeft,
+ Color aColorBottomRight);
+
+
+/** Create a blend frame as BitmapEx
+
+ @param nAlpha
+ The blend value defines how strong the frame will be blended with the
+ existing content, 255 == full coverage, 0 == no frame will be drawn
+
+ @param aColorTopLeft, aColorBottomRight, aColorTopRight, aColorBottomLeft
+ The colors defining the frame.
+
+ @param rSize
+ The size of the frame in pixels
+ */
+BitmapEx createBlendFrame(
+ const Size& rSize,
+ sal_uInt8 nAlpha,
+ Color aColorTopLeft,
+ Color aColorTopRight,
+ Color aColorBottomRight,
+ Color aColorBottomLeft);
+
+#endif // INCLUDED_VCL_BITMAPEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
new file mode 100644
index 000000000..ddae54a1d
--- /dev/null
+++ b/include/vcl/builder.hxx
@@ -0,0 +1,450 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_BUILDER_HXX
+#define INCLUDED_VCL_BUILDER_HXX
+
+#include <typeinfo>
+#include <sal/log.hxx>
+#include <unotools/resmgr.hxx>
+#include <tools/fldunit.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/window.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/toolboxid.hxx>
+#include <tools/wintypes.hxx>
+#include <vcl/EnumContext.hxx>
+
+#include <memory>
+#include <map>
+#include <string_view>
+#include <vector>
+#ifdef check
+# //some problem with MacOSX and a check define
+# undef check
+#endif
+
+class Button;
+class ComboBox;
+class FormattedField;
+class ListBox;
+class Menu;
+class MessageDialog;
+class NumericFormatter;
+class PopupMenu;
+class SalInstanceBuilder;
+class ScreenshotTest;
+class ScrollBar;
+class SvTabListBox;
+class Slider;
+class DateField;
+class TimeField;
+class ToolBox;
+class VclExpander;
+class VclMultiLineEdit;
+struct NotebookBarAddonsItem;
+namespace xmlreader { class XmlReader; }
+namespace com::sun::star::frame { class XFrame; }
+
+struct ComboBoxTextItem
+{
+ OUString m_sItem;
+ OString m_sId;
+ ComboBoxTextItem(const OUString& rItem, const OString& rId)
+ : m_sItem(rItem)
+ , m_sId(rId)
+ {
+ }
+};
+
+/// Creates a hierarchy of vcl::Windows (widgets) from a .ui file for dialogs, sidebar, etc.
+class VCL_DLLPUBLIC VclBuilder
+{
+public:
+ typedef std::map<OString, OUString> stringmap;
+ typedef std::map<OString, std::pair<OString, OString>> accelmap;
+ /// These functions create a new widget with parent pParent and return it in rRet
+ typedef void (*customMakeWidget)(VclPtr<vcl::Window> &rRet, const VclPtr<vcl::Window> &pParent, stringmap &rVec);
+
+public:
+ VclBuilder(vcl::Window* pParent, const OUString& sUIRootDir, const OUString& sUIFile,
+ const OString& sID = OString(),
+ const css::uno::Reference<css::frame::XFrame>& rFrame
+ = css::uno::Reference<css::frame::XFrame>(),
+ bool bLegacy = true,
+ const NotebookBarAddonsItem* pNotebookBarAddonsItem = nullptr);
+ ~VclBuilder();
+ ///releases references and disposes all children.
+ void disposeBuilder();
+ //sID must exist and be of type T
+ template <typename T> T* get(VclPtr<T>& ret, const OString& sID);
+
+ //sID may not exist, but must be of type T if it does
+ template <typename T = vcl::Window> T* get(const OString& sID);
+
+ vcl::Window* get_widget_root();
+
+ //sID may not exist
+ PopupMenu* get_menu(std::string_view sID);
+
+ //release ownership of pWindow, i.e. don't delete it
+ void drop_ownership(const vcl::Window *pWindow);
+
+ //see m_aDeferredProperties, you need this for toplevel dialogs
+ //which build themselves from their ctor. The properties on
+ //the top level are stored in m_aDeferredProperties and need
+ //to be applied post ctor
+ void setDeferredProperties();
+
+ /// return UI-File name (without '.ui')
+ const OString& getUIFile() const
+ {
+ return m_sHelpRoot;
+ }
+
+ static SymbolType mapStockToSymbol(std::u16string_view icon_name);
+
+private:
+ VclBuilder(const VclBuilder&) = delete;
+ VclBuilder& operator=(const VclBuilder&) = delete;
+
+ // owner for ListBox/ComboBox UserData
+ std::vector<std::unique_ptr<OUString>> m_aUserData;
+
+ //If the toplevel window has any properties which need to be set on it,
+ //but the toplevel is the owner of the builder, then its ctor
+ //has not been completed during the building, so properties for it
+ //are collected here and need to be set afterwards, e.g. during
+ //Show or Execute
+ stringmap m_aDeferredProperties;
+
+ std::unique_ptr<NotebookBarAddonsItem> m_pNotebookBarAddonsItem;
+
+ struct PackingData
+ {
+ bool m_bVerticalOrient;
+ sal_Int32 m_nPosition;
+ PackingData(bool bVerticalOrient = false)
+ : m_bVerticalOrient(bVerticalOrient)
+ , m_nPosition(-1)
+ {
+ }
+ };
+
+ struct WinAndId
+ {
+ OString m_sID;
+ VclPtr<vcl::Window> m_pWindow;
+ PackingData m_aPackingData;
+ WinAndId(const OString &rId, vcl::Window *pWindow, bool bVertical)
+ : m_sID(rId)
+ , m_pWindow(pWindow)
+ , m_aPackingData(bVertical)
+ {
+ }
+ };
+ std::vector<WinAndId> m_aChildren;
+
+ struct MenuAndId
+ {
+ OString m_sID;
+ VclPtr<Menu> m_pMenu;
+ MenuAndId(const OString &rId, Menu *pMenu);
+ };
+ std::vector<MenuAndId> m_aMenus;
+
+ struct StringPair
+ {
+ OString m_sID;
+ OString m_sValue;
+ StringPair(const OString &rId, const OString &rValue)
+ : m_sID(rId)
+ , m_sValue(rValue)
+ {
+ }
+ };
+
+ struct UStringPair
+ {
+ OString m_sID;
+ OUString m_sValue;
+ UStringPair(const OString &rId, const OUString &rValue)
+ : m_sID(rId)
+ , m_sValue(rValue)
+ {
+ }
+ };
+
+ typedef StringPair RadioButtonGroupMap;
+
+ struct ButtonImageWidgetMap
+ {
+ OString m_sID;
+ OUString m_sValue;
+ bool m_bRadio;
+ ButtonImageWidgetMap(const OString &rId, const OUString &rValue, bool bRadio)
+ : m_sID(rId)
+ , m_sValue(rValue)
+ , m_bRadio(bRadio)
+ {
+ }
+ };
+
+ typedef UStringPair TextBufferMap;
+ typedef UStringPair WidgetAdjustmentMap;
+ typedef UStringPair ButtonMenuMap;
+ typedef UStringPair MnemonicWidgetMap;
+
+ struct ComboBoxModelMap
+ {
+ OString m_sID;
+ OUString m_sValue;
+ sal_Int32 m_nActiveId;
+ ComboBoxModelMap(const OString &rId, const OUString &rValue, sal_Int32 nActiveId)
+ : m_sID(rId)
+ , m_sValue(rValue)
+ , m_nActiveId(nActiveId)
+ {
+ }
+ };
+
+ struct ListStore
+ {
+ typedef std::vector<OUString> row;
+ std::vector<row> m_aEntries;
+ };
+
+ const ListStore* get_model_by_name(const OString& sID) const;
+ void mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
+ void mungeModel(ComboBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
+ void mungeModel(SvTabListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
+
+ typedef stringmap TextBuffer;
+ const TextBuffer* get_buffer_by_name(const OString& sID) const;
+
+ static void mungeTextBuffer(VclMultiLineEdit &rTarget, const TextBuffer &rTextBuffer);
+
+ typedef stringmap Adjustment;
+ const Adjustment* get_adjustment_by_name(const OString& sID) const;
+
+ static void mungeAdjustment(NumericFormatter &rTarget, const Adjustment &rAdjustment);
+ static void mungeAdjustment(FormattedField &rTarget, const Adjustment &rAdjustment);
+ static void mungeAdjustment(ScrollBar &rTarget, const Adjustment &rAdjustment);
+ static void mungeAdjustment(Slider &rTarget, const Adjustment &rAdjustment);
+
+ typedef std::map<OString, int> ImageSizeMap;
+
+ struct SizeGroup
+ {
+ std::vector<OString> m_aWidgets;
+ stringmap m_aProperties;
+ SizeGroup() {}
+ };
+
+
+ struct ParserState
+ {
+ std::locale m_aResLocale;
+
+ std::vector<RadioButtonGroupMap> m_aGroupMaps;
+
+ std::vector<ComboBoxModelMap> m_aModelMaps;
+ std::map<OString, ListStore> m_aModels;
+
+ std::vector<TextBufferMap> m_aTextBufferMaps;
+ std::map<OString, TextBuffer> m_aTextBuffers;
+
+ std::vector<WidgetAdjustmentMap> m_aNumericFormatterAdjustmentMaps;
+ std::vector<WidgetAdjustmentMap> m_aFormattedFormatterAdjustmentMaps;
+ std::vector<WidgetAdjustmentMap> m_aScrollAdjustmentMaps;
+ std::vector<WidgetAdjustmentMap> m_aSliderAdjustmentMaps;
+
+ std::map<OString, Adjustment> m_aAdjustments;
+
+ std::vector<ButtonImageWidgetMap> m_aButtonImageWidgetMaps;
+ ImageSizeMap m_aImageSizeMap;
+
+ std::vector<ButtonMenuMap> m_aButtonMenuMaps;
+
+ std::map<VclPtr<vcl::Window>, VclPtr<vcl::Window>> m_aRedundantParentWidgets;
+
+ std::vector<SizeGroup> m_aSizeGroups;
+
+ std::map<VclPtr<vcl::Window>, stringmap> m_aAtkInfo;
+
+ std::vector<MnemonicWidgetMap> m_aMnemonicWidgetMaps;
+
+ std::vector< VclPtr<VclExpander> > m_aExpanderWidgets;
+
+ std::vector< VclPtr<MessageDialog> > m_aMessageDialogs;
+
+ ToolBoxItemId m_nLastToolbarId;
+
+ sal_uInt16 m_nLastMenuItemId;
+
+ ParserState();
+ };
+
+ OString m_sID;
+ OString m_sHelpRoot;
+ ResHookProc m_pStringReplace;
+ VclPtr<vcl::Window> m_pParent;
+ bool m_bToplevelHasDeferredInit;
+ bool m_bToplevelHasDeferredProperties;
+ bool m_bToplevelParentFound;
+ bool m_bLegacy;
+ std::unique_ptr<ParserState> m_pParserState;
+
+ vcl::Window *get_by_name(std::string_view sID);
+ void delete_by_name(const OString& sID);
+
+ class sortIntoBestTabTraversalOrder
+ {
+ public:
+ sortIntoBestTabTraversalOrder(VclBuilder *pBuilder)
+ : m_pBuilder(pBuilder) {}
+
+ bool operator()(const vcl::Window *pA, const vcl::Window *pB) const;
+
+ private:
+ VclBuilder *m_pBuilder;
+ };
+
+ /// XFrame to be able to extract labels and other properties of the UNO commands (like of .uno:Bold).
+ css::uno::Reference<css::frame::XFrame> m_xFrame;
+
+private:
+ VclPtr<vcl::Window> insertObject(vcl::Window *pParent,
+ const OString &rClass, const OString &rID,
+ stringmap &rProps, stringmap &rPangoAttributes,
+ stringmap &rAtkProps);
+
+ VclPtr<vcl::Window> makeObject(vcl::Window *pParent,
+ const OString &rClass, const OString &rID,
+ stringmap &rVec);
+
+ void connectNumericFormatterAdjustment(const OString &id, const OUString &rAdjustment);
+ void connectFormattedFormatterAdjustment(const OString &id, const OUString &rAdjustment);
+
+ static int getImageSize(const stringmap &rMap);
+
+ void extractGroup(const OString &id, stringmap &rVec);
+ void extractModel(const OString &id, stringmap &rVec);
+ void extractBuffer(const OString &id, stringmap &rVec);
+ static bool extractAdjustmentToMap(const OString &id, stringmap &rVec, std::vector<WidgetAdjustmentMap>& rAdjustmentMap);
+ void extractButtonImage(const OString &id, stringmap &rMap, bool bRadio);
+ void extractMnemonicWidget(const OString &id, stringmap &rMap);
+
+ // either pParent or pAtkProps must be set, pParent for a child of a widget, pAtkProps for
+ // collecting the atk info for a GtkMenuItem
+ void handleChild(vcl::Window *pParent, stringmap *pAtkProps, xmlreader::XmlReader &reader);
+ VclPtr<vcl::Window> handleObject(vcl::Window *pParent, stringmap *pAtkProps, xmlreader::XmlReader &reader);
+ void handlePacking(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader);
+ static std::vector<vcl::EnumContext::Context> handleStyle(xmlreader::XmlReader &reader, int &nPriority);
+ static OString getStyleClass(xmlreader::XmlReader &reader);
+ void applyPackingProperty(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader);
+ void collectProperty(xmlreader::XmlReader &reader, stringmap &rVec) const;
+ static void collectPangoAttribute(xmlreader::XmlReader &reader, stringmap &rMap);
+ static void collectAtkRelationAttribute(xmlreader::XmlReader &reader, stringmap &rMap);
+ static void collectAtkRoleAttribute(xmlreader::XmlReader &reader, stringmap &rMap);
+ static void collectAccelerator(xmlreader::XmlReader &reader, accelmap &rMap);
+
+ void insertMenuObject(
+ Menu *pParent,
+ PopupMenu *pSubMenu,
+ const OString &rClass,
+ const OString &rID,
+ stringmap &rProps,
+ stringmap &rAtkProps,
+ accelmap &rAccels);
+
+ void handleMenuChild(Menu *pParent, xmlreader::XmlReader &reader);
+ void handleMenuObject(Menu *pParent, xmlreader::XmlReader &reader);
+
+ void handleListStore(xmlreader::XmlReader &reader, const OString &rID, std::string_view rClass);
+ void handleRow(xmlreader::XmlReader &reader, const OString &rID);
+ void handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &reader);
+ VclPtr<Menu> handleMenu(xmlreader::XmlReader &reader, const OString &rID, bool bMenuBar);
+ std::vector<ComboBoxTextItem> handleItems(xmlreader::XmlReader &reader) const;
+
+ void handleSizeGroup(xmlreader::XmlReader &reader);
+
+ stringmap handleAtkObject(xmlreader::XmlReader &reader) const;
+
+ static void applyAtkProperties(vcl::Window *pWindow, const stringmap& rProperties);
+
+ void handleActionWidget(xmlreader::XmlReader &reader);
+
+ PackingData get_window_packing_data(const vcl::Window *pWindow) const;
+ void set_window_packing_position(const vcl::Window *pWindow, sal_Int32 nPosition);
+
+ static vcl::Window* prepareWidgetOwnScrolling(vcl::Window *pParent, WinBits &rWinStyle);
+ void cleanupWidgetOwnScrolling(vcl::Window *pScrollParent, vcl::Window *pWindow, stringmap &rMap);
+
+ void set_response(std::string_view sID, short nResponse);
+
+ OString get_by_window(const vcl::Window *pWindow) const;
+ void delete_by_window(vcl::Window *pWindow);
+};
+
+namespace BuilderUtils
+{
+ //apply the properties of rProps to pWindow
+ VCL_DLLPUBLIC void set_properties(vcl::Window *pWindow, const VclBuilder::stringmap &rProps);
+
+ //Convert _ gtk markup to ~ vcl markup
+ VCL_DLLPUBLIC OUString convertMnemonicMarkup(std::u16string_view rIn);
+
+ VCL_DLLPUBLIC OUString extractCustomProperty(VclBuilder::stringmap &rMap);
+
+ VCL_DLLPUBLIC bool extractDropdown(VclBuilder::stringmap &rMap);
+
+ //add a default value of 25 width-chars to a map if width-chars not set
+ VCL_DLLPUBLIC void ensureDefaultWidthChars(VclBuilder::stringmap &rMap);
+
+ //Helpers to retrofit all the existing code to the builder
+ VCL_DLLPUBLIC void reorderWithinParent(std::vector< vcl::Window*>& rChilds, bool bIsButtonBox);
+ VCL_DLLPUBLIC void reorderWithinParent(vcl::Window &rWindow, sal_uInt16 nNewPosition);
+
+ //Convert an accessibility role name to accessibility role number
+ VCL_DLLPUBLIC sal_Int16 getRoleFromName(const OString& roleName);
+}
+
+template <typename T>
+inline T* VclBuilder::get(VclPtr<T>& ret, const OString& sID)
+{
+ vcl::Window *w = get_by_name(sID);
+ SAL_WARN_IF(!w, "vcl.layout", "widget \"" << sID << "\" not found in .ui");
+ SAL_WARN_IF(!dynamic_cast<T*>(w),
+ "vcl.layout", ".ui widget \"" << sID << "\" needs to correspond to vcl type " << typeid(T).name());
+ assert(w);
+ assert(dynamic_cast<T*>(w));
+ ret = static_cast<T*>(w);
+ return ret.get();
+}
+
+//sID may not exist, but must be of type T if it does
+template <typename T>
+inline T* VclBuilder::get(const OString& sID)
+{
+ vcl::Window *w = get_by_name(sID);
+ SAL_WARN_IF(w && !dynamic_cast<T*>(w),
+ "vcl.layout", ".ui widget \"" << sID << "\" needs to correspond to vcl type " << typeid(T).name());
+ assert(!w || dynamic_cast<T*>(w));
+ return static_cast<T*>(w);
+}
+
+/*
+ * @return true if rValue is "True", "true", "1", etc.
+ */
+VCL_DLLPUBLIC bool toBool(std::u16string_view rValue);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/builderfactory.hxx b/include/vcl/builderfactory.hxx
new file mode 100644
index 000000000..c6b1b0ccf
--- /dev/null
+++ b/include/vcl/builderfactory.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_BUILDER_FACTORY_HXX
+#define INCLUDED_VCL_BUILDER_FACTORY_HXX
+
+#include <vcl/vclptr.hxx>
+#include <vcl/builder.hxx>
+
+#define VCL_BUILDER_FACTORY(typeName) \
+ extern "C" SAL_DLLPUBLIC_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
+ { \
+ static_assert(std::is_same_v<std::remove_pointer_t<VclBuilder::customMakeWidget>, \
+ decltype(make##typeName)>); \
+ (void)rMap; \
+ rRet = VclPtr<typeName>::Create(pParent); \
+ }
+
+#define VCL_BUILDER_FACTORY_ARGS(typeName,arg1) \
+ extern "C" SAL_DLLPUBLIC_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
+ { \
+ static_assert(std::is_same_v<std::remove_pointer_t<VclBuilder::customMakeWidget>, \
+ decltype(make##typeName)>); \
+ (void)rMap; \
+ rRet = VclPtr<typeName>::Create(pParent,arg1); \
+ }
+
+#define VCL_BUILDER_FACTORY_CONSTRUCTOR(typeName,arg2) \
+ extern "C" SAL_DLLPUBLIC_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
+ { \
+ static_assert(std::is_same_v<std::remove_pointer_t<VclBuilder::customMakeWidget>, \
+ decltype(make##typeName)>); \
+ OUString sBorder = BuilderUtils::extractCustomProperty(rMap); \
+ WinBits wb = arg2; \
+ if (!sBorder.isEmpty()) \
+ wb |= WB_BORDER; \
+ rRet = VclPtr<typeName>::Create(pParent,wb); \
+ }
+
+#define VCL_BUILDER_FACTORY_EXTERN(typeName) \
+ extern "C" void make##typeName(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/builderpage.hxx b/include/vcl/builderpage.hxx
new file mode 100644
index 000000000..e77cf47c4
--- /dev/null
+++ b/include/vcl/builderpage.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_BUILDERPAGE_HXX
+#define INCLUDED_VCL_BUILDERPAGE_HXX
+
+#include <vcl/weld.hxx>
+
+class VCL_DLLPUBLIC BuilderPage
+{
+public:
+ BuilderPage(weld::Widget* pParent, weld::DialogController* pController,
+ const OUString& rUIXMLDescription, const OString& rID, bool bIsMobile = false);
+ virtual ~BuilderPage() COVERITY_NOEXCEPT_FALSE;
+
+ /* The title of the page, in an Assistant the dialog may append this page title to the
+ dialog title.
+
+ While in a Dialog hosting a single Page it may use the title as
+ the dialog title.
+ */
+ void SetPageTitle(const OUString& rPageTitle) { m_aPageTitle = rPageTitle; }
+ const OUString& GetPageTitle() const { return m_aPageTitle; }
+
+ // In a Notebook or Assistant the controller typically calls Activate on entering
+ // this page, and Deactivate on leaving
+ virtual void Activate();
+ virtual void Deactivate();
+
+ void SetHelpId(const OString& rHelpId) { m_xContainer->set_help_id(rHelpId); }
+ OString GetHelpId() const { return m_xContainer->get_help_id(); }
+
+protected:
+ weld::DialogController* m_pDialogController;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+
+private:
+ OUString m_aPageTitle;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/cairo.hxx b/include/vcl/cairo.hxx
new file mode 100644
index 000000000..87d820ab8
--- /dev/null
+++ b/include/vcl/cairo.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_CAIRO_HXX
+#define INCLUDED_VCL_CAIRO_HXX
+
+#include <sal/config.h>
+#include <vcl/vclptr.hxx>
+#include <memory>
+
+typedef struct _cairo_surface cairo_surface_t;
+typedef struct _cairo cairo_t;
+
+class VirtualDevice;
+
+namespace cairo {
+
+ typedef std::shared_ptr<cairo_surface_t> CairoSurfaceSharedPtr;
+ typedef std::shared_ptr<cairo_t> CairoSharedPtr;
+ struct Surface;
+ typedef std::shared_ptr<Surface> SurfaceSharedPtr;
+
+ /** Cairo surface interface
+
+ For each cairo-supported platform, there's an implementation of
+ this interface
+ */
+ struct Surface
+ {
+ public:
+ virtual ~Surface() {}
+
+ // Query methods
+ virtual CairoSharedPtr getCairo() const = 0;
+ virtual CairoSurfaceSharedPtr getCairoSurface() const = 0;
+ virtual SurfaceSharedPtr getSimilar(int cairo_content_type, int width, int height) const = 0;
+
+ /// factory for VirDev on this surface
+ virtual VclPtr<VirtualDevice> createVirtualDevice() const = 0;
+
+ /// Resize the surface (possibly destroying content), only possible for X11 typically
+ /// so on failure caller must create a new surface instead
+ virtual bool Resize( int /*width*/, int /*height*/ ) { return false; }
+
+ /// Flush all pending output to surface
+ virtual void flush() const = 0;
+ };
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/canvastools.hxx b/include/vcl/canvastools.hxx
new file mode 100644
index 000000000..5a46886e5
--- /dev/null
+++ b/include/vcl/canvastools.hxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_CANVASTOOLS_HXX
+#define INCLUDED_VCL_CANVASTOOLS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/range/b2irectangle.hxx>
+
+#include <vcl/dllapi.h>
+
+class Point;
+class Size;
+namespace tools { class Rectangle; }
+class BitmapEx;
+class Color;
+
+namespace basegfx
+{
+ class B2DVector;
+ class B2DPoint;
+ class B2DRange;
+ class B2IPoint;
+ class B2IRange;
+}
+
+namespace com::sun::star::geometry
+{
+ struct RealSize2D;
+ struct IntegerPoint2D;
+ struct IntegerSize2D;
+ struct IntegerRectangle2D;
+}
+
+namespace com::sun::star::rendering
+{
+ class XBitmap;
+ class XIntegerReadOnlyBitmap;
+}
+
+namespace com::sun::star::rendering { class XColorSpace; }
+
+namespace vcl::unotools
+{
+ // Bitmap conversions
+
+
+ /** Create an XBitmap from VCL BitmapEx
+ */
+ css::uno::Reference< css::rendering::XBitmap >
+ VCL_DLLPUBLIC xBitmapFromBitmapEx( const ::BitmapEx& inputBitmap );
+
+ /** Create a BitmapEx from an XBitmap
+ */
+ ::BitmapEx VCL_DLLPUBLIC bitmapExFromXBitmap( const css::uno::Reference< css::rendering::XIntegerReadOnlyBitmap >& xInputBitmap );
+
+ // Color conversions (vcl/tools Color <-> canvas standard color space)
+
+
+ /** Create a device-specific color sequence from VCL/Tools color
+
+ Note that this method assumes a color space equivalent to
+ the one returned from createStandardColorSpace()
+ */
+ css::uno::Sequence< double >
+ VCL_DLLPUBLIC colorToStdColorSpaceSequence( const Color& rColor );
+
+ /** Convert color to device color sequence
+
+ @param rColor
+ Color to convert
+
+ @param xColorSpace
+ Color space to convert into
+ */
+ css::uno::Sequence< double >
+ VCL_DLLPUBLIC colorToDoubleSequence( const Color& rColor,
+ const css::uno::Reference< css::rendering::XColorSpace >& xColorSpace );
+
+ /** Convert from standard device color space to VCL/Tools color
+
+ Note that this method assumes a color space equivalent to
+ the one returned from createStandardColorSpace()
+ */
+ Color VCL_DLLPUBLIC stdColorSpaceSequenceToColor(
+ const css::uno::Sequence< double >& rColor );
+
+ /** Convert color to device color sequence
+
+ @param rColor
+ Color sequence to convert from
+
+ @param xColorSpace
+ Color space to convert from
+ */
+ Color VCL_DLLPUBLIC doubleSequenceToColor( const css::uno::Sequence< double >& rColor,
+ const css::uno::Reference< css::rendering::XColorSpace >& xColorSpace );
+
+ /// Convert [0,1] double value to [0,255] int
+ inline sal_Int8 toByteColor( double val )
+ {
+ return sal::static_int_cast<sal_Int8>(
+ basegfx::fround(val*255.0));
+ }
+
+ /// Convert [0,255] int value to [0,1] double value
+ inline double toDoubleColor( sal_uInt8 val )
+ {
+ return val / 255.0;
+ }
+
+ /// Create a standard color space suitable for VCL RGB color
+ css::uno::Reference< css::rendering::XColorSpace> VCL_DLLPUBLIC createStandardColorSpace();
+
+ // Geometry conversions (vcl/tools <-> x)
+
+
+ // geometry::Real
+ css::geometry::RealSize2D VCL_DLLPUBLIC size2DFromSize( const Size& );
+
+ Size VCL_DLLPUBLIC sizeFromRealSize2D( const css::geometry::RealSize2D& );
+
+ // geometry::Integer
+ css::geometry::IntegerSize2D VCL_DLLPUBLIC integerSize2DFromSize( const Size& );
+
+ Size VCL_DLLPUBLIC sizeFromIntegerSize2D( const css::geometry::IntegerSize2D& );
+ Point VCL_DLLPUBLIC pointFromIntegerPoint2D( const css::geometry::IntegerPoint2D& );
+ tools::Rectangle VCL_DLLPUBLIC rectangleFromIntegerRectangle2D( const css::geometry::IntegerRectangle2D& );
+
+ // basegfx::B2D
+ Size VCL_DLLPUBLIC sizeFromB2DSize( const basegfx::B2DVector& );
+ Point VCL_DLLPUBLIC pointFromB2DPoint( const basegfx::B2DPoint& );
+ tools::Rectangle VCL_DLLPUBLIC rectangleFromB2DRectangle( const basegfx::B2DRange& );
+
+ basegfx::B2DVector VCL_DLLPUBLIC b2DSizeFromSize( const Size& );
+ basegfx::B2DPoint VCL_DLLPUBLIC b2DPointFromPoint( const Point& );
+ basegfx::B2DRange VCL_DLLPUBLIC b2DRectangleFromRectangle( const tools::Rectangle& );
+
+ // basegfx::B2I
+ Point VCL_DLLPUBLIC pointFromB2IPoint( const basegfx::B2IPoint& );
+ tools::Rectangle VCL_DLLPUBLIC rectangleFromB2IRectangle( const basegfx::B2IRange& );
+ basegfx::B2IPoint VCL_DLLPUBLIC b2IPointFromPoint(const Point&);
+ basegfx::B2IRectangle VCL_DLLPUBLIC b2IRectangleFromRectangle(const tools::Rectangle&);
+
+}
+
+#endif // INCLUDED_VCL_CANVASTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/checksum.hxx b/include/vcl/checksum.hxx
new file mode 100644
index 000000000..34d8ed77a
--- /dev/null
+++ b/include/vcl/checksum.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef INCLUDED_VCL_INC_CHECKSUM_HXX
+#define INCLUDED_VCL_INC_CHECKSUM_HXX
+
+#include <sal/config.h>
+#include <sal/types.h>
+#include <vcl/dllapi.h>
+
+#define BITMAP_CHECKSUM_SIZE 8
+
+typedef sal_uInt64 BitmapChecksum;
+typedef sal_uInt8 BitmapChecksumOctetArray[BITMAP_CHECKSUM_SIZE];
+
+template< sal_uInt8 N = 0 >
+inline void BCToBCOA( BitmapChecksum n, BitmapChecksumOctetArray p )
+{
+ p[N] = static_cast<sal_uInt8>(n >> ( 8 * N ));
+ return BCToBCOA< N + 1 >( n, p );
+}
+
+template<>
+inline void BCToBCOA< BITMAP_CHECKSUM_SIZE >( BitmapChecksum, BitmapChecksumOctetArray )
+{
+ return;
+}
+
+extern "C" {
+
+/*========================================================================
+ *
+ * vcl_crc64 interface.
+ *
+ *======================================================================*/
+/** Evaluate CRC64 over given data.
+
+ This function evaluates the CRC polynomial 0xEDB88320.
+
+ @param Crc [in] CRC64 over previous data or zero.
+ @param Data [in] data buffer.
+ @param DatLen [in] data buffer length.
+ @return new CRC64 value.
+ */
+VCL_DLLPUBLIC sal_uInt64 vcl_crc64 (
+ sal_uInt64 Crc,
+ const void *Data, sal_uInt32 DatLen
+) SAL_THROW_EXTERN_C();
+
+
+const sal_uInt64* vcl_get_crc64_table();
+
+}
+
+inline BitmapChecksum vcl_get_checksum (
+ BitmapChecksum Checksum,
+ const void *Data,
+ sal_uInt32 DatLen
+)
+{
+ return static_cast<BitmapChecksum>(vcl_crc64( Checksum, Data, DatLen ));
+}
+
+
+#endif // INCLUDED_VCL_INC_CHECKSUM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx
new file mode 100644
index 000000000..a22f751d6
--- /dev/null
+++ b/include/vcl/commandevent.hxx
@@ -0,0 +1,354 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_COMMANDEVENT_HXX
+#define INCLUDED_VCL_COMMANDEVENT_HXX
+
+#include <memory>
+#include <tools/gen.hxx>
+#include <tools/solar.h>
+#include <vcl/dllapi.h>
+#include <vcl/keycodes.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/GestureEvent.hxx>
+
+class CommandExtTextInputData;
+class CommandWheelData;
+class CommandScrollData;
+class CommandModKeyData;
+class CommandDialogData;
+class CommandMediaData;
+class CommandSelectionChangeData;
+class CommandSwipeData;
+class CommandLongPressData;
+class CommandGestureData;
+
+enum class CommandEventId;
+
+enum class ExtTextInputAttr {
+ NONE = 0x0000,
+ GrayWaveline = 0x0010,
+ Underline = 0x0020,
+ BoldUnderline = 0x0040,
+ DottedUnderline = 0x0080,
+ DashDotUnderline = 0x0100,
+ DoubleUnderline = 0x0200,
+ Highlight = 0x0400,
+ RedText = 0x0800,
+ HalfToneText = 0x1000
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ExtTextInputAttr> : is_typed_flags<ExtTextInputAttr, 0x1ff0> {};
+}
+
+#define EXTTEXTINPUT_CURSOR_INVISIBLE (sal_uInt16(0x0001))
+#define EXTTEXTINPUT_CURSOR_OVERWRITE (sal_uInt16(0x0002))
+
+
+class VCL_DLLPUBLIC CommandEvent
+{
+private:
+ Point maPos;
+ void* mpData;
+ CommandEventId mnCommand;
+ bool mbMouseEvent;
+
+public:
+ CommandEvent();
+ CommandEvent( const Point& rMousePos, CommandEventId nCmd,
+ bool bMEvt = false, const void* pCmdData = nullptr );
+
+ CommandEventId GetCommand() const { return mnCommand; }
+ const Point& GetMousePosPixel() const { return maPos; }
+ bool IsMouseEvent() const { return mbMouseEvent; }
+ void* GetEventData() const { return mpData; }
+
+ const CommandExtTextInputData* GetExtTextInputData() const;
+ const CommandWheelData* GetWheelData() const;
+ const CommandScrollData* GetAutoScrollData() const;
+ const CommandModKeyData* GetModKeyData() const;
+ const CommandDialogData* GetDialogData() const;
+ CommandMediaData* GetMediaData() const;
+ const CommandSelectionChangeData* GetSelectionChangeData() const;
+ const CommandSwipeData* GetSwipeData() const;
+ const CommandLongPressData* GetLongPressData() const;
+ const CommandGestureData* GetGestureData() const;
+};
+
+class VCL_DLLPUBLIC CommandExtTextInputData
+{
+private:
+ OUString maText;
+ std::unique_ptr<ExtTextInputAttr[]> mpTextAttr;
+ sal_Int32 mnCursorPos;
+ sal_uInt16 mnCursorFlags;
+ bool mbOnlyCursor;
+
+public:
+ CommandExtTextInputData( const OUString& rText,
+ const ExtTextInputAttr* pTextAttr,
+ sal_Int32 nCursorPos,
+ sal_uInt16 nCursorFlags,
+ bool bOnlyCursor );
+ CommandExtTextInputData( const CommandExtTextInputData& rData );
+ ~CommandExtTextInputData();
+
+ const OUString& GetText() const { return maText; }
+ const ExtTextInputAttr* GetTextAttr() const { return mpTextAttr.get(); }
+
+ sal_Int32 GetCursorPos() const { return mnCursorPos; }
+ bool IsCursorVisible() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_INVISIBLE) == 0; }
+ bool IsCursorOverwrite() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_OVERWRITE) != 0; }
+ bool IsOnlyCursorChanged() const { return mbOnlyCursor; }
+};
+
+class VCL_DLLPUBLIC CommandInputContextData
+{
+};
+
+enum class CommandWheelMode
+{
+ NONE = 0,
+ SCROLL = 1,
+ ZOOM = 2,
+ DATAZOOM = 3
+};
+
+// Magic value used in mnLines field in CommandWheelData
+#define COMMAND_WHEEL_PAGESCROLL (sal_uLong(0xFFFFFFFF))
+
+class VCL_DLLPUBLIC CommandWheelData
+{
+private:
+ tools::Long mnDelta;
+ tools::Long mnNotchDelta;
+ double mnLines;
+ CommandWheelMode mnWheelMode;
+ sal_uInt16 mnCode;
+ bool mbHorz;
+ bool mbDeltaIsPixel;
+
+public:
+ CommandWheelData();
+ CommandWheelData( tools::Long nWheelDelta, tools::Long nWheelNotchDelta,
+ double nScrollLines,
+ CommandWheelMode nWheelMode, sal_uInt16 nKeyModifier,
+ bool bHorz, bool bDeltaIsPixel = false );
+
+ tools::Long GetDelta() const { return mnDelta; }
+ tools::Long GetNotchDelta() const { return mnNotchDelta; }
+ double GetScrollLines() const { return mnLines; }
+ bool IsHorz() const { return mbHorz; }
+ bool IsDeltaPixel() const { return mbDeltaIsPixel; }
+
+ CommandWheelMode GetMode() const { return mnWheelMode; }
+
+ sal_uInt16 GetModifier() const
+ { return (mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); }
+ bool IsShift() const
+ { return ((mnCode & KEY_SHIFT) != 0); }
+ bool IsMod1() const
+ { return ((mnCode & KEY_MOD1) != 0); }
+ bool IsMod2() const
+ { return ((mnCode & KEY_MOD2) != 0); }
+};
+
+class CommandScrollData
+{
+private:
+ tools::Long mnDeltaX;
+ tools::Long mnDeltaY;
+
+public:
+ CommandScrollData( tools::Long nDeltaX, tools::Long nDeltaY );
+
+ tools::Long GetDeltaX() const { return mnDeltaX; }
+ tools::Long GetDeltaY() const { return mnDeltaY; }
+};
+
+class CommandModKeyData
+{
+private:
+ bool mbDown;
+ ModKeyFlags mnCode;
+
+public:
+ CommandModKeyData( ModKeyFlags nCode, bool bDown );
+
+ bool IsDown() const { return mbDown; }
+ bool IsMod1() const { return bool(mnCode & ModKeyFlags::Mod1Msk); }
+ bool IsMod2() const { return bool(mnCode & ModKeyFlags::Mod2Msk); }
+ bool IsLeftShift() const { return bool(mnCode & ModKeyFlags::LeftShift); }
+ bool IsRightShift() const { return bool(mnCode & ModKeyFlags::RightShift); }
+};
+
+enum class ShowDialogId
+{
+ Preferences = 1,
+ About = 2,
+};
+
+class VCL_DLLPUBLIC CommandDialogData
+{
+ ShowDialogId m_nDialogId;
+public:
+ CommandDialogData( ShowDialogId nDialogId )
+ : m_nDialogId( nDialogId )
+ {}
+
+ ShowDialogId GetDialogId() const { return m_nDialogId; }
+};
+
+// Media Commands
+enum class MediaCommand
+{
+ ChannelDown = 1, // Decrement the channel value, for example, for a TV or radio tuner.
+ ChannelUp = 2, // Increment the channel value, for example, for a TV or radio tuner.
+ NextTrack = 3, // Go to next media track/slide.
+ Pause = 4, // Pause. If already paused, take no further action. This is a direct PAUSE command that has no state.
+ Play = 5, // Begin playing at the current position. If already paused, it will resume. This is a direct PLAY command that has no state.
+ PlayPause = 6, // Play or pause playback.
+ PreviousTrack = 7, // Go to previous media track/slide.
+ Record = 8, // Begin recording the current stream.
+ Rewind = 9,// Go backward in a stream at a higher rate of speed.
+ Stop = 10,// Stop playback.
+ MicOnOffToggle = 11,// Toggle the microphone.
+ MicrophoneVolumeDown = 12,// Increase microphone volume.
+ MicrophoneVolumeMute = 13,// Mute the microphone.
+ MicrophoneVolumeUp = 14,// Decrease microphone volume.
+ VolumeDown = 15,// Lower the volume.
+ VolumeMute = 16,// Mute the volume.
+ VolumeUp = 17,// Raise the volume.
+ Menu = 18,// Button Menu pressed.
+ PlayHold = 20,// Button Play (long) pressed.
+ NextTrackHold = 21,// Button Right holding pressed.
+};
+
+class VCL_DLLPUBLIC CommandMediaData
+{
+ MediaCommand m_nMediaId;
+ bool m_bPassThroughToOS;
+public:
+ CommandMediaData(MediaCommand nMediaId)
+ : m_nMediaId(nMediaId)
+ , m_bPassThroughToOS(true)
+ {
+ }
+ MediaCommand GetMediaId() const { return m_nMediaId; }
+ void SetPassThroughToOS(bool bPassThroughToOS) { m_bPassThroughToOS = bPassThroughToOS; }
+ bool GetPassThroughToOS() const { return m_bPassThroughToOS; }
+};
+
+class CommandSelectionChangeData
+{
+private:
+ sal_uLong mnStart;
+ sal_uLong mnEnd;
+
+public:
+ CommandSelectionChangeData( sal_uLong nStart, sal_uLong nEnd );
+
+ sal_uLong GetStart() const { return mnStart; }
+ sal_uLong GetEnd() const { return mnEnd; }
+};
+
+class VCL_DLLPUBLIC CommandSwipeData
+{
+ double mnVelocityX;
+public:
+ CommandSwipeData()
+ : mnVelocityX(0)
+ {
+ }
+ CommandSwipeData(double nVelocityX)
+ : mnVelocityX(nVelocityX)
+ {
+ }
+ double getVelocityX() const { return mnVelocityX; }
+};
+
+
+class VCL_DLLPUBLIC CommandLongPressData
+{
+ double mnX;
+ double mnY;
+public:
+ CommandLongPressData()
+ : mnX(0)
+ , mnY(0)
+ {
+ }
+ CommandLongPressData(double nX, double nY)
+ : mnX(nX)
+ , mnY(nY)
+ {
+ }
+ double getX() const { return mnX; }
+ double getY() const { return mnY; }
+};
+
+class VCL_DLLPUBLIC CommandGestureData
+{
+public:
+ double const mfX;
+ double const mfY;
+ double const mfOffset;
+ GestureEventType const meEventType;
+ PanningOrientation const meOrientation;
+
+ CommandGestureData(double fX, double fY, GestureEventType eEventType, double fOffset, PanningOrientation eOrientation)
+ : mfX(fX)
+ , mfY(fY)
+ , mfOffset(fOffset)
+ , meEventType(eEventType)
+ , meOrientation(eOrientation)
+ {}
+};
+
+enum class CommandEventId
+{
+ NONE = 0,
+ ContextMenu = 1,
+ StartDrag = 2,
+ Wheel = 3,
+ StartAutoScroll = 4,
+ AutoScroll = 5,
+ StartExtTextInput = 7,
+ ExtTextInput = 8,
+ EndExtTextInput = 9,
+ InputContextChange = 10,
+ CursorPos = 11,
+ PasteSelection = 12,
+ ModKeyChange = 13,
+ InputLanguageChange = 15,
+ ShowDialog = 16,
+ Media = 17,
+ SelectionChange = 18,
+ PrepareReconversion = 19,
+ QueryCharPosition = 20,
+ Swipe = 21,
+ LongPress = 22,
+ Gesture = 23,
+};
+
+#endif // INCLUDED_VCL_COMMANDEVENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/commandinfoprovider.hxx b/include/vcl/commandinfoprovider.hxx
new file mode 100644
index 000000000..016e53f79
--- /dev/null
+++ b/include/vcl/commandinfoprovider.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_COMMANDINFOPROVIDER_HXX
+#define INCLUDED_VCL_COMMANDINFOPROVIDER_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/image.hxx>
+#include <vcl/keycod.hxx>
+
+namespace com::sun::star::frame { class XFrame; }
+namespace com::sun::star::beans { struct PropertyValue; }
+
+namespace vcl::CommandInfoProvider {
+
+ /** Return a label for the given command.
+ @param rsCommandName
+ The command name is expected to start with .uno:
+ @param rsModuleName
+ The current application module.
+ @return
+ The command properties.
+ */
+ VCL_DLLPUBLIC css::uno::Sequence<css::beans::PropertyValue> GetCommandProperties(const OUString& rsCommandName, const OUString& rsModuleName);
+
+ /** Return a label for the given command.
+ @param rProperties
+ The properties from GetCommandProperties.
+ @return
+ The command label.
+ */
+ VCL_DLLPUBLIC OUString GetLabelForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties);
+
+ VCL_DLLPUBLIC OUString GetMenuLabelForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties);
+
+ VCL_DLLPUBLIC OUString GetPopupLabelForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties);
+
+ VCL_DLLPUBLIC OUString GetTooltipLabelForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties);
+
+ /** Return a tooltip for the given command. Falls back to label if command has no tooltip.
+ @param rsCommandName
+ The command name is expected to start with .uno:
+ @param rProperties
+ The properties from GetCommandProperties.
+ @param rxFrame
+ The frame is used to identify the module and document.
+ @return
+ The returned label contains the keyboard accelerator, if
+ one is defined and bIncludeShortcut is true.
+ */
+ VCL_DLLPUBLIC OUString GetTooltipForCommand (
+ const OUString& rsCommandName,
+ const css::uno::Sequence<css::beans::PropertyValue>& rProperties,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
+ /** Returns the shortcut for a command in human-readable form */
+ VCL_DLLPUBLIC OUString GetCommandShortcut (const OUString& rCommandName,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
+ VCL_DLLPUBLIC KeyCode GetCommandKeyCodeShortcut (const OUString& rCommandName,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
+ VCL_DLLPUBLIC OUString GetRealCommandForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties);
+
+ VCL_DLLPUBLIC css::uno::Reference<css::graphic::XGraphic> GetXGraphicForCommand(
+ const OUString& rsCommandName,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ vcl::ImageType eImageType = vcl::ImageType::Small);
+
+ VCL_DLLPUBLIC Image GetImageForCommand(
+ const OUString& rsCommandName,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ vcl::ImageType eImageType = vcl::ImageType::Small);
+
+ VCL_DLLPUBLIC sal_Int32 GetPropertiesForCommand(
+ const OUString& rsCommandName,
+ const OUString& rsModuleName);
+
+ VCL_DLLPUBLIC bool IsRotated(const OUString& rsCommandName, const OUString& rsModuleName);
+ VCL_DLLPUBLIC bool IsMirrored(const OUString& rsCommandName, const OUString& rsModuleName);
+
+ /** Returns whether the command is experimental. */
+ VCL_DLLPUBLIC bool IsExperimental(
+ const OUString& rsCommandName,
+ const OUString& rModuleName);
+
+ VCL_DLLPUBLIC OUString GetModuleIdentifier(const css::uno::Reference<css::frame::XFrame>& rxFrame);
+}
+
+#endif // INCLUDED_VCL_COMMANDINFOPROVIDER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
new file mode 100644
index 000000000..a6797cc73
--- /dev/null
+++ b/include/vcl/ctrl.hxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_CTRL_HXX
+#define INCLUDED_VCL_CTRL_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/link.hxx>
+#include <tools/gen.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/window.hxx>
+#include <optional>
+#include <vector>
+
+// forward
+class StyleSettings;
+class Control;
+
+namespace vcl
+{
+
+struct VCL_DLLPUBLIC ControlLayoutData
+{
+ // contains the string really displayed
+ // there must be exactly one bounding rectangle in m_aUnicodeBoundRects
+ // for every character in m_aDisplayText
+ OUString m_aDisplayText;
+ // the bounding rectangle of every character
+ // where one character may consist of many glyphs
+ std::vector< tools::Rectangle > m_aUnicodeBoundRects;
+ // start indices of lines
+ std::vector< tools::Long > m_aLineIndices;
+ // notify parent control on destruction
+ VclPtr<const Control> m_pParent;
+
+ ControlLayoutData();
+ ~ControlLayoutData();
+
+ tools::Rectangle GetCharacterBounds( tools::Long nIndex ) const;
+ // returns the character index for corresponding to rPoint (in control coordinates)
+ // -1 is returned if no character is at that point
+ tools::Long GetIndexForPoint( const Point& rPoint ) const;
+ // returns the number of lines in the result of GetDisplayText()
+ tools::Long GetLineCount() const;
+ // returns the interval [start,end] of line nLine
+ // returns [-1,-1] for an invalid line
+ ::Pair GetLineStartEnd( tools::Long nLine ) const;
+ /** ToRelativeLineIndex changes a layout data index to a count relative to its line.
+
+ This is equivalent to getting the line start/end pairs with
+ GetLineStartEnd until the index lies within [start,end] of a line
+
+ @param nIndex
+ the absolute index inside the display text to be changed to a relative index
+
+ @returns
+ the relative index inside the displayed line or -1 if the absolute index does
+ not match any line
+ */
+ tools::Long ToRelativeLineIndex( tools::Long nIndex ) const;
+};
+
+} // namespace vcl
+
+class VCL_DLLPUBLIC Control : public vcl::Window
+{
+protected:
+ mutable std::optional<vcl::ControlLayoutData> mxLayoutData;
+ VclPtr<OutputDevice> mpReferenceDevice;
+
+private:
+ bool mbHasControlFocus;
+ bool mbShowAccelerator;
+ Link<Control&,void> maLoseFocusHdl;
+
+ SAL_DLLPRIVATE void ImplInitControlData();
+
+ Control (const Control &) = delete;
+ Control & operator= (const Control &) = delete;
+
+protected:
+ Control( WindowType nType );
+ virtual void FillLayoutData() const;
+
+ // helper method for composite controls
+ void AppendLayoutData( const Control& rSubControl ) const;
+
+ /// creates the mpData->mpLayoutData structure
+ void CreateLayoutData() const;
+ /// determines whether we currently have layout data
+ bool HasLayoutData() const;
+
+ /** this calls both our event listeners, and a specified handler
+
+ If the Control instance is destroyed during any of those calls, the
+ method properly handles this (in particular, it doesn't crash :)
+
+ @param nEvent
+ the event to notify to our event listeners
+ @param callHandler
+ the lambda function that calls the handler
+ @return
+ if the Control instance has been destroyed in any of the call
+ */
+ bool ImplCallEventListenersAndHandler(
+ VclEventId nEvent, std::function<void()> const & callHandler
+ );
+
+ void CallEventListeners( VclEventId nEvent, void* pData = nullptr );
+
+ /** draws the given text onto the given device
+
+ If no reference device is set, the draw request will simply be forwarded to OutputDevice::DrawText. Otherwise,
+ the text will be rendered according to the metrics at the reference device.
+
+ return will contain the result of a GetTextRect call (either directly
+ at the target device, or taking the reference device into account) when
+ returning.
+ */
+ tools::Rectangle DrawControlText( OutputDevice& _rTargetDevice, const tools::Rectangle& _rRect,
+ const OUString& _rStr, DrawTextFlags _nStyle,
+ std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText,
+ const Size* i_pDeviceSize = nullptr ) const;
+
+ tools::Rectangle GetControlTextRect( OutputDevice& _rTargetDevice, const tools::Rectangle & rRect,
+ const OUString& _rStr, DrawTextFlags _nStyle,
+ Size* o_pDeviceSize = nullptr ) const;
+
+ virtual const vcl::Font&
+ GetCanonicalFont( const StyleSettings& _rStyle ) const;
+ virtual const Color&
+ GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
+
+ void ImplInitSettings();
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+
+public:
+ SAL_DLLPRIVATE void ImplClearLayoutData() const;
+ /** draws a frame around the give rectangle, onto the given device
+
+ only to be used from within the Window::Draw method of your sub class.
+
+ The frame is always drawn with a single line (without 3D effects). In addition, any mono
+ color set at the control's settings is respected. Yet more additionally, if we're living
+ in a themed desktop, this theming is ignored.
+
+ Note that this makes sense, since the *only known* clients of Window::Draw
+ are form controls, when printed or print-previewed. For form controls embedded in office documents,
+ you don't want to have the theme look.
+
+ @param pDev
+ the device to draw onto
+ @param rRect
+ the rect for drawing the frame. Upon returning from the call, the rect will be inflated
+ by the space occupied by the drawn pixels.
+ */
+ SAL_DLLPRIVATE void ImplDrawFrame( OutputDevice* pDev, tools::Rectangle& rRect );
+
+public:
+ explicit Control( vcl::Window* pParent, WinBits nWinStyle = 0 );
+ virtual ~Control() override;
+ virtual void dispose() override;
+
+ virtual void EnableRTL ( bool bEnable = true ) override;
+
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual void Resize() override;
+
+ // invalidates layout data
+ virtual void SetText( const OUString& rStr ) override;
+ // gets the displayed text
+ virtual OUString GetDisplayText() const override;
+ // returns the bounding box for the character at index nIndex (in control coordinates)
+ tools::Rectangle GetCharacterBounds( tools::Long nIndex ) const;
+ // returns the character index for corresponding to rPoint (in control coordinates)
+ // -1 is returned if no character is at that point
+ tools::Long GetIndexForPoint( const Point& rPoint ) const;
+ // returns the interval [start,end] of line nLine
+ // returns [-1,-1] for an invalid line
+ Pair GetLineStartEnd( tools::Long nLine ) const;
+ /** ToRelativeLineIndex changes a layout data index to a count relative to its line.
+
+ This is equivalent to getting the line start/end pairs with
+ GetLineStartEnd() until the index lies within [start,end] of a line
+
+ @param nIndex
+ the absolute index inside the display text to be changed to a relative index
+
+ @returns
+ the relative index inside the displayed line or -1 if the absolute index does
+ not match any line
+ */
+ tools::Long ToRelativeLineIndex( tools::Long nIndex ) const;
+
+ void SetLoseFocusHdl( const Link<Control&,void>& rLink ) { maLoseFocusHdl = rLink; }
+
+ /** determines whether the control currently has the focus
+ */
+ bool HasControlFocus() const { return mbHasControlFocus; }
+
+ void SetLayoutDataParent( const Control* pParent ) const;
+
+ virtual Size GetOptimalSize() const override;
+
+ /** sets a reference device used for rendering control text
+ @see DrawControlText
+ */
+ void SetReferenceDevice( OutputDevice* _referenceDevice );
+ OutputDevice* GetReferenceDevice() const;
+
+ vcl::Font GetUnzoomedControlPointFont() const;
+ void SetShowAccelerator (bool val);
+
+ void LogicMouseButtonDown(const MouseEvent& rMouseEvent) override;
+ void LogicMouseButtonUp(const MouseEvent& rMouseEvent) override;
+ void LogicMouseMove(const MouseEvent& rMouseEvent) override;
+};
+
+#endif // INCLUDED_VCL_CTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/cursor.hxx b/include/vcl/cursor.hxx
new file mode 100644
index 000000000..b6adf4926
--- /dev/null
+++ b/include/vcl/cursor.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_CURSOR_HXX
+#define INCLUDED_VCL_CURSOR_HXX
+
+#include <tools/gen.hxx>
+#include <tools/link.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/vclptr.hxx>
+#include <rtl/ustring.hxx>
+#include <memory>
+
+class Timer;
+struct ImplCursorData;
+class OutputDevice;
+namespace vcl { class Window; }
+
+// Cursor styles
+#define CURSOR_SHADOW (sal_uInt16(0x0001))
+
+enum class CursorDirection
+{
+ NONE, LTR, RTL
+};
+
+namespace vcl
+{
+
+class VCL_DLLPUBLIC Cursor
+{
+private:
+ std::unique_ptr<ImplCursorData> mpData;
+ VclPtr<vcl::Window> mpWindow; // only for shadow cursor
+ Size maSize;
+ Point maPos;
+ Degree10 mnOrientation;
+ sal_uInt16 mnStyle;
+ bool mbVisible;
+ CursorDirection mnDirection;
+
+public:
+ SAL_DLLPRIVATE void ImplDraw();
+ DECL_DLLPRIVATE_LINK( ImplTimerHdl, Timer*, void );
+ SAL_DLLPRIVATE void ImplShow();
+ SAL_DLLPRIVATE void ImplHide();
+ SAL_DLLPRIVATE void ImplResume( bool bRestore = false );
+ SAL_DLLPRIVATE bool ImplSuspend();
+ SAL_DLLPRIVATE void ImplNew();
+
+public:
+ Cursor();
+ Cursor( const Cursor& rCursor );
+ ~Cursor();
+
+ void SetStyle( sal_uInt16 nStyle );
+ sal_uInt16 GetStyle() const { return mnStyle; }
+
+ void Show();
+ void Hide();
+ bool IsVisible() const { return mbVisible; }
+
+ void SetWindow( vcl::Window* pWindow );
+
+ void SetPos( const Point& rNewPos );
+ const Point& GetPos() const { return maPos; }
+
+ void SetSize( const Size& rNewSize );
+ const Size& GetSize() const { return maSize; }
+ void SetWidth( tools::Long nNewWidth );
+ tools::Long GetWidth() const { return maSize.Width(); }
+ tools::Long GetHeight() const { return maSize.Height(); }
+
+ void SetOrientation( Degree10 nOrientation = 0_deg10 );
+
+ void SetDirection( CursorDirection nDirection = CursorDirection::NONE );
+
+ Cursor& operator=( const Cursor& rCursor );
+ bool operator==( const Cursor& rCursor ) const;
+ bool operator!=( const Cursor& rCursor ) const
+ { return !(Cursor::operator==( rCursor )); }
+
+ void DrawToDevice(OutputDevice& rRenderContext);
+
+private:
+ void LOKNotify( vcl::Window* pWindow, const OUString& rAction );
+ bool ImplPrepForDraw(const OutputDevice* pDevice, ImplCursorData& rData);
+ void ImplRestore();
+ void ImplDoShow( bool bDrawDirect, bool bRestore );
+ bool ImplDoHide( bool bStop );
+};
+
+} // namespace vcl
+
+#endif // INCLUDED_VCL_CURSOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx
new file mode 100644
index 000000000..e37555b36
--- /dev/null
+++ b/include/vcl/customweld.hxx
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_CUSTOMWELD_HXX
+#define INCLUDED_VCL_CUSTOMWELD_HXX
+
+#include <vcl/weld.hxx>
+
+class InputContext;
+
+namespace weld
+{
+class VCL_DLLPUBLIC CustomWidgetController
+{
+private:
+ Size m_aSize;
+ weld::DrawingArea* m_pDrawingArea;
+ DECL_LINK(DragBeginHdl, weld::DrawingArea&, bool);
+
+public:
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible()
+ {
+ return css::uno::Reference<css::accessibility::XAccessible>();
+ }
+ // rRect is in Logical units rather than Pixels
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) = 0;
+ virtual void Resize() {}
+ virtual bool MouseButtonDown(const MouseEvent&) { return false; }
+ virtual bool MouseMove(const MouseEvent&) { return false; }
+ virtual bool MouseButtonUp(const MouseEvent&) { return false; }
+ virtual void GetFocus() {}
+ virtual void LoseFocus() {}
+ virtual void StyleUpdated() { Invalidate(); }
+ virtual bool Command(const CommandEvent&) { return false; }
+ virtual bool KeyInput(const KeyEvent&) { return false; }
+ virtual tools::Rectangle GetFocusRect() { return tools::Rectangle(); }
+ virtual FactoryFunction GetUITestFactory() const { return nullptr; }
+ virtual OUString RequestHelp(tools::Rectangle&) { return OUString(); }
+ virtual OUString GetHelpText() const { return m_pDrawingArea->get_tooltip_text(); }
+ Size const& GetOutputSizePixel() const { return m_aSize; }
+ void SetOutputSizePixel(const Size& rSize) { m_aSize = rSize; }
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) { m_pDrawingArea = pDrawingArea; }
+ weld::DrawingArea* GetDrawingArea() const { return m_pDrawingArea; }
+ void Invalidate()
+ {
+ if (!m_pDrawingArea)
+ return;
+ m_pDrawingArea->queue_draw();
+ }
+ static bool IsUpdateMode() { return true; }
+ void Invalidate(const tools::Rectangle& rRect)
+ {
+ if (!m_pDrawingArea)
+ return;
+ m_pDrawingArea->queue_draw_area(rRect.Left(), rRect.Top(), rRect.GetWidth(),
+ rRect.GetHeight());
+ }
+ virtual void Show() { m_pDrawingArea->show(); }
+ virtual void Hide() { m_pDrawingArea->hide(); }
+ void GrabFocus() { m_pDrawingArea->grab_focus(); }
+ bool HasFocus() const { return m_pDrawingArea->has_focus(); }
+ bool HasChildFocus() const { return m_pDrawingArea->has_child_focus(); }
+ bool IsVisible() const { return m_pDrawingArea->get_visible(); }
+ bool IsReallyVisible() const { return m_pDrawingArea->is_visible(); }
+ bool IsEnabled() const { return m_pDrawingArea->get_sensitive(); }
+ void Enable() const { m_pDrawingArea->set_sensitive(true); }
+ void Disable() const { m_pDrawingArea->set_sensitive(false); }
+ bool IsActive() const { return m_pDrawingArea->is_active(); }
+ int GetTextHeight() const { return m_pDrawingArea->get_text_height(); }
+ int GetTextWidth(const OUString& rText) const
+ {
+ return m_pDrawingArea->get_pixel_size(rText).Width();
+ }
+ OUString GetAccessibleName() const { return m_pDrawingArea->get_accessible_name(); }
+ OUString GetAccessibleDescription() const
+ {
+ return m_pDrawingArea->get_accessible_description();
+ }
+ void CaptureMouse() { m_pDrawingArea->grab_add(); }
+ bool IsMouseCaptured() const { return m_pDrawingArea->has_grab(); }
+ Point GetPointerPosPixel() const { return m_pDrawingArea->get_pointer_position(); }
+ void EnableRTL(bool bEnable) { m_pDrawingArea->set_direction(bEnable); }
+ bool IsRTLEnabled() const { return m_pDrawingArea->get_direction(); }
+ void ReleaseMouse() { m_pDrawingArea->grab_remove(); }
+ void SetPointer(PointerStyle ePointerStyle) { m_pDrawingArea->set_cursor(ePointerStyle); }
+ void SetHelpId(const OString& rHelpId) { m_pDrawingArea->set_help_id(rHelpId); }
+ void SetAccessibleName(const OUString& rName) { m_pDrawingArea->set_accessible_name(rName); }
+ void SetInputContext(const InputContext& rInputContext)
+ {
+ m_pDrawingArea->set_input_context(rInputContext);
+ }
+ void SetCursorRect(const tools::Rectangle& rCursorRect, int nExtTextInputWidth)
+ {
+ m_pDrawingArea->im_context_set_cursor_location(rCursorRect, nExtTextInputWidth);
+ }
+ virtual int GetSurroundingText(OUString& /*rSurrounding*/) { return -1; }
+ virtual bool DeleteSurroundingText(const Selection& /*rRange*/) { return false; }
+ css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget()
+ {
+ return m_pDrawingArea->get_drop_target();
+ }
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const
+ {
+ return m_pDrawingArea->get_clipboard();
+ }
+ void SetDragDataTransferrable(rtl::Reference<TransferDataContainer>& rTransferrable,
+ sal_uInt8 eDNDConstants)
+ {
+ m_pDrawingArea->enable_drag_source(rTransferrable, eDNDConstants);
+ m_pDrawingArea->connect_drag_begin(LINK(this, CustomWidgetController, DragBeginHdl));
+ }
+ // return true to disallow drag, false to allow
+ virtual bool StartDrag() { return false; }
+ void set_size_request(int nWidth, int nHeight)
+ {
+ m_pDrawingArea->set_size_request(nWidth, nHeight);
+ }
+ void queue_resize()
+ {
+ if (!m_pDrawingArea)
+ return;
+ m_pDrawingArea->queue_resize();
+ }
+ CustomWidgetController()
+ : m_pDrawingArea(nullptr)
+ {
+ }
+ virtual ~CustomWidgetController();
+
+ CustomWidgetController(CustomWidgetController const&) = default;
+ CustomWidgetController(CustomWidgetController&&) = default;
+ CustomWidgetController& operator=(CustomWidgetController const&) = default;
+ CustomWidgetController& operator=(CustomWidgetController&&) = default;
+};
+
+class VCL_DLLPUBLIC CustomWeld final
+{
+private:
+ weld::CustomWidgetController& m_rWidgetController;
+ std::unique_ptr<weld::DrawingArea> m_xDrawingArea;
+
+ DECL_DLLPRIVATE_LINK(DoResize, const Size& rSize, void);
+ DECL_DLLPRIVATE_LINK(DoPaint, weld::DrawingArea::draw_args, void);
+ DECL_DLLPRIVATE_LINK(DoMouseButtonDown, const MouseEvent&, bool);
+ DECL_DLLPRIVATE_LINK(DoMouseMove, const MouseEvent&, bool);
+ DECL_DLLPRIVATE_LINK(DoMouseButtonUp, const MouseEvent&, bool);
+ DECL_DLLPRIVATE_LINK(DoGetFocus, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(DoLoseFocus, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(DoKeyPress, const KeyEvent&, bool);
+ DECL_DLLPRIVATE_LINK(DoFocusRect, weld::Widget&, tools::Rectangle);
+ DECL_DLLPRIVATE_LINK(DoCommand, const CommandEvent&, bool);
+ DECL_DLLPRIVATE_LINK(DoStyleUpdated, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(DoRequestHelp, tools::Rectangle&, OUString);
+ DECL_DLLPRIVATE_LINK(DoGetSurrounding, OUString&, int);
+ DECL_DLLPRIVATE_LINK(DoDeleteSurrounding, const Selection&, bool);
+
+public:
+ CustomWeld(weld::Builder& rBuilder, const OString& rDrawingId,
+ CustomWidgetController& rWidgetController);
+ void queue_draw() { m_xDrawingArea->queue_draw(); }
+ void queue_draw_area(int x, int y, int width, int height)
+ {
+ m_xDrawingArea->queue_draw_area(x, y, width, height);
+ }
+ void set_size_request(int nWidth, int nHeight)
+ {
+ m_xDrawingArea->set_size_request(nWidth, nHeight);
+ }
+ void show() { m_xDrawingArea->show(); }
+ void hide() { m_xDrawingArea->hide(); }
+ void set_margin_top(int nMargin) { m_xDrawingArea->set_margin_top(nMargin); }
+ void set_margin_bottom(int nMargin) { m_xDrawingArea->set_margin_bottom(nMargin); }
+ void set_sensitive(bool bSensitive) { m_xDrawingArea->set_sensitive(bSensitive); }
+ bool get_sensitive() const { return m_xDrawingArea->get_sensitive(); }
+ bool get_visible() const { return m_xDrawingArea->get_visible(); }
+ void set_visible(bool bVisible) { m_xDrawingArea->set_visible(bVisible); }
+ void set_grid_left_attach(int nAttach) { m_xDrawingArea->set_grid_left_attach(nAttach); }
+ int get_grid_left_attach() const { return m_xDrawingArea->get_grid_left_attach(); }
+ void set_help_id(const OString& rHelpId) { m_xDrawingArea->set_help_id(rHelpId); }
+ void set_tooltip_text(const OUString& rTip) { m_xDrawingArea->set_tooltip_text(rTip); }
+};
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/cvtgrf.hxx b/include/vcl/cvtgrf.hxx
new file mode 100644
index 000000000..f3d2024e8
--- /dev/null
+++ b/include/vcl/cvtgrf.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_CVTGRF_HXX
+#define INCLUDED_VCL_CVTGRF_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/link.hxx>
+#include <vcl/salctype.hxx>
+#include <vcl/errcode.hxx>
+
+
+class Graphic;
+
+class VCL_DLLPUBLIC GraphicConverter
+{
+private:
+
+ Link<ConvertData&,bool> maFilterHdl;
+
+public:
+
+ GraphicConverter();
+
+ static ErrCode Import( SvStream& rIStm, Graphic& rGraphic, ConvertDataFormat nFormat = ConvertDataFormat::Unknown );
+ static ErrCode Export( SvStream& rOStm, const Graphic& rGraphic, ConvertDataFormat nFormat );
+
+ void SetFilterHdl( const Link<ConvertData&,bool>& rLink ) { maFilterHdl = rLink; }
+ const Link<ConvertData&,bool>& GetFilterHdl() const { return maFilterHdl; }
+};
+
+#endif // INCLUDED_VCL_CVTGRF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/decoview.hxx b/include/vcl/decoview.hxx
new file mode 100644
index 000000000..4ab2fe70d
--- /dev/null
+++ b/include/vcl/decoview.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_DECOVIEW_HXX
+#define INCLUDED_VCL_DECOVIEW_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/outdev.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/vclenum.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace tools { class Rectangle; }
+class Point;
+class Color;
+
+// Flags for DrawSymbol()
+enum class DrawSymbolFlags
+{
+ NONE = 0x0000,
+ Mono = 0x0001,
+ Disable = 0x0002,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<DrawSymbolFlags> : is_typed_flags<DrawSymbolFlags, 0x03> {};
+}
+
+// Flags for DrawHighlightFrame()
+enum class DrawHighlightFrameStyle
+{
+ In = 1,
+ Out = 2,
+};
+
+// Flags for DrawButton()
+enum class DrawButtonFlags
+{
+ NONE = 0x0000,
+ Default = 0x0001,
+ NoLightBorder = 0x0002,
+ Pressed = 0x0004,
+ Checked = 0x0008,
+ DontKnow = 0x0010,
+ Mono = 0x0020,
+ Disabled = 0x0040,
+ Highlight = 0x0100,
+ Flat = 0x0200,
+ NoLeftLightBorder = 0x1000
+};
+namespace o3tl
+{
+ template<> struct typed_flags<DrawButtonFlags> : is_typed_flags<DrawButtonFlags, 0x137f> {};
+}
+
+class VCL_DLLPUBLIC DecorationView
+{
+private:
+ VclPtr<OutputDevice> mpOutDev;
+
+public:
+ DecorationView(OutputDevice* pOutDev);
+
+ void DrawSymbol( const tools::Rectangle& rRect, SymbolType eType,
+ const Color& rColor, DrawSymbolFlags nStyle = DrawSymbolFlags::NONE );
+ void DrawFrame( const tools::Rectangle& rRect,
+ const Color& rLeftTopColor,
+ const Color& rRightBottomColor );
+ void DrawHighlightFrame( const tools::Rectangle& rRect,
+ DrawHighlightFrameStyle nStyle );
+ tools::Rectangle DrawFrame( const tools::Rectangle& rRect, DrawFrameStyle nStyle = DrawFrameStyle::Out, DrawFrameFlags nFlags = DrawFrameFlags::NONE );
+ tools::Rectangle DrawButton( const tools::Rectangle& rRect, DrawButtonFlags nStyle );
+ void DrawSeparator( const Point& rStart, const Point& rStop, bool bVertical = true );
+ void DrawHandle(const tools::Rectangle& rRectangle);
+};
+
+#endif // INCLUDED_VCL_DECOVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/devicecoordinate.hxx b/include/vcl/devicecoordinate.hxx
new file mode 100644
index 000000000..215f0ca74
--- /dev/null
+++ b/include/vcl/devicecoordinate.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <config_vcl.h>
+
+#include <basegfx/point/b2dpoint.hxx>
+typedef basegfx::B2DPoint DevicePoint;
+
+#if VCL_FLOAT_DEVICE_PIXEL
+
+typedef double DeviceCoordinate;
+
+#else /* !VCL_FLOAT_DEVICE_PIXEL */
+
+typedef sal_Int32 DeviceCoordinate;
+
+#endif /* ! Carpet Cushion */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/dialoghelper.hxx b/include/vcl/dialoghelper.hxx
new file mode 100644
index 000000000..eedc6d37a
--- /dev/null
+++ b/include/vcl/dialoghelper.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <vcl/dllapi.h>
+
+namespace vcl
+{
+class Window;
+
+/* cancel dialogs that are a child of pParent
+ this is used by com.sun.star.embed.DocumentCloser which itself is only used by
+ extensions/source/activex/SOActiveX.cxx see extensions/source/activex/README.txt
+ possibly dubious if this actually works as expected
+*/
+VCL_DLLPUBLIC void EndAllDialogs(vcl::Window const* pParent);
+
+/* returns true if a vcl PopupMenu is executing. Uses of this outside of vcl/toolkit
+ are possibly dubious.
+*/
+VCL_DLLPUBLIC bool IsInPopupMenuExecute();
+
+/* for LibreOffice kit */
+VCL_DLLPUBLIC void EnableDialogInput(vcl::Window* pDialog);
+VCL_DLLPUBLIC void CloseTopLevel(vcl::Window* pDialog);
+/// Pre-loads all modules containing UI information
+VCL_DLLPUBLIC void VclBuilderPreload();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/dibtools.hxx b/include/vcl/dibtools.hxx
new file mode 100644
index 000000000..6064491f8
--- /dev/null
+++ b/include/vcl/dibtools.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_DIBTOOLS_HXX
+#define INCLUDED_VCL_DIBTOOLS_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/Scanline.hxx>
+
+// predefines
+
+class SvStream;
+class BitmapEx;
+class Bitmap;
+class AlphaMask;
+
+// - Compression defines
+
+#define COMPRESS_NONE ( 0 )
+#define RLE_8 ( 1 )
+#define RLE_4 ( 2 )
+#define BITFIELDS ( 3UL )
+#define ZCOMPRESS ( ('S'|('D'<<8UL)) | 0x01000000UL ) /* == 'SD01' (binary) */
+
+bool VCL_DLLPUBLIC ReadDIB( // ReadDIB(rBitmap, rIStm, true);
+ Bitmap& rTarget,
+ SvStream& rIStm,
+ bool bFileHeader,
+ bool bMSOFormat=false);
+
+bool VCL_DLLPUBLIC ReadDIBBitmapEx(
+ BitmapEx& rTarget,
+ SvStream& rIStm,
+ bool bFileHeader = true,
+ bool bMSOFormat = false);
+
+bool VCL_DLLPUBLIC ReadDIBV5(
+ Bitmap& rTarget,
+ AlphaMask& rTargetAlpha,
+ SvStream& rIStm);
+
+bool VCL_DLLPUBLIC ReadRawDIB(
+ BitmapEx& rTarget,
+ const unsigned char* pBuf,
+ const ScanlineFormat nFormat,
+ const int nHeight,
+ const int nStride);
+
+
+bool VCL_DLLPUBLIC WriteDIB(
+ const Bitmap& rSource,
+ SvStream& rOStm,
+ bool bCompressed,
+ bool bFileHeader);
+
+// compressed, with file header
+bool VCL_DLLPUBLIC WriteDIB(
+ const BitmapEx& rSource,
+ SvStream& rOStm,
+ bool bCompressed = true);
+
+bool VCL_DLLPUBLIC WriteDIBBitmapEx(
+ const BitmapEx& rSource,
+ SvStream& rOStm);
+
+// needed in emfio for emf/wmf migration
+sal_uInt32 VCL_DLLPUBLIC getDIBV5HeaderSize();
+
+#endif // INCLUDED_VCL_DIBTOOLS_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/dllapi.h b/include/vcl/dllapi.h
new file mode 100644
index 000000000..ccfd5e3b8
--- /dev/null
+++ b/include/vcl/dllapi.h
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_DLLAPI_H
+#define INCLUDED_VCL_DLLAPI_H
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined VCL_DLLIMPLEMENTATION
+#define VCL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define VCL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define VCL_DLLPRIVATE SAL_DLLPRIVATE
+
+#if defined DLLIMPLEMENTATION_UITEST
+#define UITEST_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define UITEST_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#if (defined UNX && !defined MACOS) || defined _WIN32
+#define VCL_PLUGIN_PUBLIC VCL_DLLPUBLIC
+#else
+#define VCL_PLUGIN_PUBLIC SAL_DLLPRIVATE
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/dndhelp.hxx b/include/vcl/dndhelp.hxx
new file mode 100644
index 000000000..511f2f453
--- /dev/null
+++ b/include/vcl/dndhelp.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_DNDHELP_HXX
+#define INCLUDED_VCL_DNDHELP_HXX
+
+#include <vcl/dllapi.h>
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp>
+#include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp>
+#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
+
+namespace com::sun::star::datatransfer::dnd {
+ struct DragGestureEvent;
+ struct DragSourceDragEvent;
+ struct DragSourceDropEvent;
+ struct DragSourceEvent;
+ struct DropTargetDragEvent;
+ struct DropTargetDragEnterEvent;
+ struct DropTargetDropEvent;
+ struct DropTargetEvent;
+}
+
+namespace vcl::unohelper
+{
+
+class VCL_DLLPUBLIC DragAndDropClient
+{
+public:
+ virtual ~DragAndDropClient() COVERITY_NOEXCEPT_FALSE;
+
+ // css::datatransfer::dnd::XDragGestureListener
+ /// @throws css::uno::RuntimeException
+ virtual void dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& dge );
+
+ // css::datatransfer::dnd::XDragSourceListener
+ /// @throws css::uno::RuntimeException
+ virtual void dragDropEnd(const css::datatransfer::dnd::DragSourceDropEvent& dsde );
+
+ // css::datatransfer::dnd::XDropTargetListener
+ /// @throws css::uno::RuntimeException
+ virtual void drop( const css::datatransfer::dnd::DropTargetDropEvent& dtde );
+ /// @throws css::uno::RuntimeException
+ virtual void dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee );
+ /// @throws css::uno::RuntimeException
+ virtual void dragExit( const css::datatransfer::dnd::DropTargetEvent& dte );
+ /// @throws css::uno::RuntimeException
+ virtual void dragOver( const css::datatransfer::dnd::DropTargetDragEvent& dtde );
+};
+
+class DragAndDropWrapper final :
+ public css::datatransfer::dnd::XDragGestureListener,
+ public css::datatransfer::dnd::XDragSourceListener,
+ public css::datatransfer::dnd::XDropTargetListener,
+ public ::cppu::OWeakObject
+{
+private:
+ DragAndDropClient* mpClient;
+
+public:
+ VCL_DLLPUBLIC DragAndDropWrapper( DragAndDropClient* pClient );
+ virtual ~DragAndDropWrapper() override;
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakObject::release(); }
+
+ // css::lang::XEventListener
+ void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // css::datatransfer::dnd::XDragGestureListener
+ void SAL_CALL dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& dge ) override;
+
+ // css::datatransfer::dnd::XDragSourceListener
+ void SAL_CALL dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent& dsde ) override;
+ void SAL_CALL dragEnter( const css::datatransfer::dnd::DragSourceDragEvent& dsde ) override;
+ void SAL_CALL dragExit( const css::datatransfer::dnd::DragSourceEvent& dse ) override;
+ void SAL_CALL dragOver( const css::datatransfer::dnd::DragSourceDragEvent& dsde ) override;
+ void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DragSourceDragEvent& dsde ) override;
+
+ // css::datatransfer::dnd::XDropTargetListener
+ void SAL_CALL drop( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) override;
+ void SAL_CALL dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) override;
+ void SAL_CALL dragExit( const css::datatransfer::dnd::DropTargetEvent& dte ) override;
+ void SAL_CALL dragOver( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
+ void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
+};
+
+} // namespace vcl::unohelper
+
+#endif // INCLUDED_VCL_DNDHELP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/dockingarea.hxx b/include/vcl/dockingarea.hxx
new file mode 100644
index 000000000..40ffd2852
--- /dev/null
+++ b/include/vcl/dockingarea.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_DOCKINGAREA_HXX
+#define INCLUDED_VCL_DOCKINGAREA_HXX
+
+#include <config_options.h>
+#include <vcl/window.hxx>
+#include <memory>
+
+// A simple container for docked toolbars
+// - its main purpose is theming support
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DockingAreaWindow final : public vcl::Window
+{
+ class SAL_DLLPRIVATE ImplData;
+
+private:
+ std::unique_ptr<ImplData> mpImplData;
+
+ DockingAreaWindow (const DockingAreaWindow &) = delete;
+ DockingAreaWindow & operator= (const DockingAreaWindow &) = delete;
+
+public:
+ explicit DockingAreaWindow( vcl::Window* pParent );
+ virtual ~DockingAreaWindow() override;
+ virtual void dispose() override;
+
+ void SetAlign( WindowAlign eNewAlign );
+ WindowAlign GetAlign() const;
+ bool IsHorizontal() const;
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+
+};
+
+#endif // INCLUDED_VCL_DOCKINGAREA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx
new file mode 100644
index 000000000..e6ce2b308
--- /dev/null
+++ b/include/vcl/dockwin.hxx
@@ -0,0 +1,255 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <vcl/syswin.hxx>
+#include <o3tl/deleter.hxx>
+#include <memory>
+#include <vector>
+
+class ToolBox;
+class FloatingWindow;
+enum class FloatWinPopupFlags;
+
+// data to be sent with docking events
+struct DockingData
+{
+ Point maMousePos; // in
+ tools::Rectangle maTrackRect; // in/out
+ bool mbFloating; // out
+
+ DockingData( const Point& rPt, const tools::Rectangle& rRect, bool b) :
+ maMousePos( rPt ), maTrackRect( rRect ), mbFloating( b )
+ {};
+};
+
+struct EndDockingData
+{
+ tools::Rectangle maWindowRect; // in
+ bool mbFloating; // in
+ bool mbCancelled; // in
+
+ EndDockingData( const tools::Rectangle& rRect, bool b, bool bCancelled ) :
+ maWindowRect( rRect ), mbFloating( b ), mbCancelled( bCancelled )
+ {};
+};
+
+struct EndPopupModeData
+{
+ Point maFloatingPos; // in
+ bool mbTearoff; // in
+
+ EndPopupModeData( const Point& rPos, bool bTearoff ) :
+ maFloatingPos( rPos ), mbTearoff( bTearoff )
+ {};
+};
+
+class ImplDockingWindowWrapper;
+
+class VCL_DLLPUBLIC DockingManager
+{
+ std::vector<std::unique_ptr<ImplDockingWindowWrapper, o3tl::default_delete<ImplDockingWindowWrapper>>> mvDockingWindows;
+
+public:
+ DockingManager();
+ ~DockingManager();
+
+ DockingManager& operator=( DockingManager const & ) = delete; // MSVC2015 workaround
+ DockingManager( DockingManager const & ) = delete; // MSVC2015 workaround
+
+ void AddWindow( const vcl::Window *pWin );
+ void RemoveWindow( const vcl::Window *pWin );
+
+ ImplDockingWindowWrapper* GetDockingWindowWrapper( const vcl::Window *pWin );
+ bool IsDockable( const vcl::Window *pWin );
+
+ bool IsFloating( const vcl::Window *pWin );
+ void SetFloatingMode( const vcl::Window *pWin, bool bFloating );
+ SystemWindow* GetFloatingWindow(const vcl::Window *pWin);
+
+ void Lock( const vcl::Window *pWin );
+ void Unlock( const vcl::Window *pWin );
+ bool IsLocked( const vcl::Window *pWin );
+
+ void StartPopupMode( const vcl::Window *pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags );
+ void StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWin );
+ void StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWin, FloatWinPopupFlags nPopupModeFlags );
+
+ void SetPopupModeEndHdl( const vcl::Window *pWindow, const Link<FloatingWindow*,void>& rLink );
+
+ bool IsInPopupMode( const vcl::Window *pWin );
+ void EndPopupMode( const vcl::Window *pWin );
+
+ // required because those methods are not virtual in Window (!!!) and must
+ // be available from the toolkit
+ void SetPosSizePixel( vcl::Window const *pWin, tools::Long nX, tools::Long nY,
+ tools::Long nWidth, tools::Long nHeight,
+ PosSizeFlags nFlags );
+ tools::Rectangle GetPosSizePixel( const vcl::Window *pWin );
+};
+
+
+class VCL_DLLPUBLIC DockingWindow
+ : public vcl::Window
+ , public VclBuilderContainer
+{
+ class SAL_DLLPRIVATE ImplData;
+private:
+ VclPtr<FloatingWindow> mpFloatWin;
+ VclPtr<vcl::Window> mpOldBorderWin;
+ std::unique_ptr<ImplData> mpImplData;
+ Point maFloatPos;
+ Point maDockPos;
+ Point maMouseOff;
+ Size maMinOutSize;
+ tools::Long mnTrackX;
+ tools::Long mnTrackY;
+ tools::Long mnTrackWidth;
+ tools::Long mnTrackHeight;
+ sal_Int32 mnDockLeft;
+ sal_Int32 mnDockTop;
+ sal_Int32 mnDockRight;
+ sal_Int32 mnDockBottom;
+ WinBits mnFloatBits;
+ Idle maLayoutIdle;
+ bool mbDockCanceled:1,
+ mbDockable:1,
+ mbDocking:1,
+ mbDragFull:1,
+ mbLastFloatMode:1,
+ mbStartFloat:1,
+ mbDockBtn:1,
+ mbHideBtn:1,
+ mbIsCalculatingInitialLayoutSize:1;
+
+protected:
+ bool mbIsDeferredInit;
+ VclPtr<vcl::Window> mpDialogParent;
+private:
+
+ SAL_DLLPRIVATE void ImplInitDockingWindowData();
+ SAL_DLLPRIVATE void setPosSizeOnContainee();
+ DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, Timer*, void );
+
+ DockingWindow (const DockingWindow &) = delete;
+ DockingWindow & operator= (const DockingWindow &) = delete;
+
+protected:
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE void ImplInitSettings();
+
+ SAL_DLLPRIVATE void DoInitialLayout();
+
+ void loadUI(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
+ const css::uno::Reference<css::frame::XFrame> &rFrame);
+
+public:
+ bool isLayoutEnabled() const;
+ void setOptimalLayoutSize();
+
+ //FIXME: is it okay to make this public?
+ void ImplStartDocking( const Point& rPos );
+ SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDeferredInit; }
+ virtual void doDeferredInit(WinBits nBits);
+protected:
+ DockingWindow( WindowType nType, const char* pIdleDebugName = "vcl::DockingWindow maLayoutIdle");
+public:
+ DockingWindow(vcl::Window* pParent, WinBits nStyle, const char* pIdleDebugName = "vcl::DockingWindow maLayoutIdle");
+ DockingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
+ const char* pIdleDebugName = "vcl::DockingWindow maLayoutIdle",
+ const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
+ virtual ~DockingWindow() override;
+ virtual void dispose() override;
+
+ virtual void StartDocking();
+ virtual bool Docking( const Point& rPos, tools::Rectangle& rRect );
+ virtual void EndDocking( const tools::Rectangle& rRect, bool bFloatMode );
+ virtual bool PrepareToggleFloatingMode();
+ virtual void ToggleFloatingMode();
+
+ virtual void Resizing( Size& rSize );
+ virtual bool Close();
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ void SetMinOutputSizePixel( const Size& rSize );
+ const Size& GetMinOutputSizePixel() const;
+
+ void SetMaxOutputSizePixel( const Size& rSize );
+
+ bool IsDocking() const { return mbDocking; }
+ bool IsDockable() const { return mbDockable; }
+ bool IsDockingCanceled() const { return mbDockCanceled; }
+
+ void SetFloatingMode( bool bFloatMode );
+ bool IsFloatingMode() const;
+ SystemWindow* GetFloatingWindow() const;
+
+ void SetFloatingPos( const Point& rNewPos );
+ Point GetFloatingPos() const;
+
+ void SetFloatStyle( WinBits nWinStyle );
+ WinBits GetFloatStyle() const;
+
+ virtual void setPosSizePixel( tools::Long nX, tools::Long nY,
+ tools::Long nWidth, tools::Long nHeight,
+ PosSizeFlags nFlags = PosSizeFlags::All ) override;
+
+ Point GetPosPixel() const override;
+ Size GetSizePixel() const override;
+ void SetOutputSizePixel( const Size& rNewSize ) override;
+ Size GetOutputSizePixel() const;
+
+ virtual void SetText( const OUString& rStr ) override;
+ virtual OUString GetText() const override;
+ virtual Size GetOptimalSize() const override;
+ virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
+};
+
+class VCL_DLLPUBLIC DropdownDockingWindow : public DockingWindow
+{
+protected:
+ VclPtr<vcl::Window> m_xBox;
+public:
+ DropdownDockingWindow(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>(),
+ bool bTearable = false);
+ virtual ~DropdownDockingWindow() override;
+ virtual void dispose() override;
+};
+
+class VCL_DLLPUBLIC ResizableDockingWindow : public DockingWindow
+{
+protected:
+ VclPtr<vcl::Window> m_xBox;
+public:
+ ResizableDockingWindow(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
+ void InvalidateChildSizeCache();
+ ResizableDockingWindow(vcl::Window* pParent, WinBits nStyle);
+ virtual ~ResizableDockingWindow() override;
+ virtual void dispose() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/embeddedfontshelper.hxx b/include/vcl/embeddedfontshelper.hxx
new file mode 100644
index 000000000..4802c13a2
--- /dev/null
+++ b/include/vcl/embeddedfontshelper.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_EMBEDDEDFONTSHELPER_HXX
+#define INCLUDED_VCL_EMBEDDEDFONTSHELPER_HXX
+
+#include <vcl/dllapi.h>
+
+#include <rtl/ustring.hxx>
+#include <tools/fontenum.hxx>
+#include <tools/long.hxx>
+
+#include <string_view>
+#include <vector>
+
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+/**
+ Helper functions for handling embedded fonts in documents.
+
+*/
+class VCL_DLLPUBLIC EmbeddedFontsHelper
+{
+private:
+ std::vector<std::pair<OUString, OUString>> m_aAccumulatedFonts;
+
+ /**
+ Adds the given font to the list of known fonts. The font is used only until application
+ exit.
+
+ @param fontName name of the font (e.g. 'Times New Roman')
+ @param fileUrl URL of the font file
+ */
+ static void activateFont( const OUString& fontName, const OUString& fileUrl );
+
+public:
+ /// Specification of what kind of operation is allowed when embedding a font
+ enum class FontRights
+ {
+ ViewingAllowed, ///< Font may be embedded for viewing the document (but not editing)
+ EditingAllowed ///< Font may be embedded for editing document (implies viewing)
+ };
+
+ /**
+ Returns URL for a font file for the given font, or empty if it does not exist.
+ */
+ static OUString fontFileUrl(
+ std::u16string_view familyName, FontFamily family, FontItalic italic,
+ FontWeight weight, FontPitch pitch, FontRights rights );
+
+ /**
+ Reads a font from the input stream, saves it to a temporary font file and adds it to the list of
+ fonts that activateFonts will activate.
+ @param stream stream of font data
+ @param fontName name of the font (e.g. 'Times New Roman')
+ @param extra additional text to use for name (e.g. to distinguish regular from bold, italic,...), "?" for unique
+ @param key key to xor the data with, from the start until the key's length (not repeated)
+ @param eot whether the data is compressed in Embedded OpenType format
+ */
+ bool addEmbeddedFont( const css::uno::Reference< css::io::XInputStream >& stream,
+ const OUString& fontName, const char* extra,
+ std::vector< unsigned char > const & key, bool eot = false);
+
+ /**
+ Returns a URL for a file where to store contents of a given temporary font.
+ The file may or not may not exist yet, and will be cleaned up automatically as appropriate.
+ Use activateTemporaryFont() to actually enable usage of the font.
+
+ @param fontName name of the font (e.g. 'Times New Roman')
+ @param extra additional text to use for name (e.g. to distinguish regular from bold, italic,...), "?" for unique
+ */
+ static OUString fileUrlForTemporaryFont( const OUString& fontName, const char* extra );
+
+ /**
+ Adds the accumulated fonts to the list of known fonts. The fonts are used only until application
+ exit.
+ */
+ void activateFonts();
+
+ /**
+ Returns if the restrictions specified in the font (if present) allow embedding
+ the font for a particular purpose.
+ @param data font data
+ @param size size of the font data
+ @param rights type of operation to be allowed for the font
+ */
+ static bool sufficientTTFRights( const void* data, tools::Long size, FontRights rights );
+
+ /**
+ Removes all temporary fonts in the path used by fileUrlForTemporaryFont().
+ @internal
+ */
+ static void clearTemporaryFontFiles();
+
+ ~EmbeddedFontsHelper() COVERITY_NOEXCEPT_FALSE
+ {
+ activateFonts();
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/errcode.hxx b/include/vcl/errcode.hxx
new file mode 100644
index 000000000..e43b6b65d
--- /dev/null
+++ b/include/vcl/errcode.hxx
@@ -0,0 +1,279 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_ERRCODE_HXX
+#define INCLUDED_VCL_ERRCODE_HXX
+
+#include <rtl/ustring.hxx>
+#include <vcl/dllapi.h>
+#include <ostream>
+
+/*
+
+01234567012345670123456701234567
+|| || || || |
+Warning || || |
+ | || || || |
+ Dynamic || || |
+ | || || |
+ Subsystemarea| || |
+ | || |
+ | || |
+ | || |
+ Class| |
+ | |
+ | |
+ | |
+ Code
+*/
+
+#define ERRCODE_ERROR_MASK 0x3fffffffUL
+#define ERRCODE_WARNING_MASK 0x80000000UL
+
+#define ERRCODE_CLASS_SHIFT 8
+#define ERRCODE_AREA_SHIFT 13
+#define ERRCODE_DYNAMIC_SHIFT 26
+
+#define ERRCODE_CLASS_MASK (31UL << ERRCODE_CLASS_SHIFT)
+
+#define ERRCODE_DYNAMIC_COUNT 31UL
+#define ERRCODE_DYNAMIC_MASK (31UL << ERRCODE_DYNAMIC_SHIFT)
+
+enum class ErrCodeArea;
+enum class ErrCodeClass;
+
+enum class WarningFlag { Yes };
+
+class SAL_WARN_UNUSED ErrCode final
+{
+public:
+ explicit constexpr ErrCode(WarningFlag, ErrCodeArea nArea, ErrCodeClass nClass, sal_uInt16 nCode)
+ : m_value(ERRCODE_WARNING_MASK | (sal_uInt32(nArea) << ERRCODE_AREA_SHIFT) | (sal_uInt32(nClass) << ERRCODE_CLASS_SHIFT) | nCode)
+ {
+ assert(nCode <= 0xff && "code out of range");
+ }
+ explicit constexpr ErrCode(ErrCodeArea nArea, ErrCodeClass nClass, sal_uInt16 nCode)
+ : m_value((sal_uInt32(nArea) << ERRCODE_AREA_SHIFT) | (sal_uInt32(nClass) << ERRCODE_CLASS_SHIFT) | nCode)
+ {
+ assert(nCode <= 0xff && "code out of range");
+ }
+ explicit constexpr ErrCode(ErrCodeArea nArea, sal_uInt16 nClassAndCode)
+ : m_value((sal_uInt32(nArea) << ERRCODE_AREA_SHIFT) | nClassAndCode) {}
+ explicit constexpr ErrCode(sal_uInt32 nValue)
+ : m_value(nValue) {}
+ constexpr ErrCode()
+ : m_value(0) {}
+
+ explicit operator sal_uInt32() const { return m_value; }
+ explicit operator bool() const { return m_value != 0; }
+
+ bool operator<(ErrCode const & other) const { return m_value < other.m_value; }
+ bool operator<=(ErrCode const & other) const { return m_value <= other.m_value; }
+ bool operator>(ErrCode const & other) const { return m_value > other.m_value; }
+ bool operator>=(ErrCode const & other) const { return m_value >= other.m_value; }
+ bool operator==(ErrCode const & other) const { return m_value == other.m_value; }
+ bool operator!=(ErrCode const & other) const { return m_value != other.m_value; }
+
+ /** convert to ERRCODE_NONE if it's a warning, else return the error */
+ ErrCode IgnoreWarning() const {
+ return (m_value & ERRCODE_WARNING_MASK)
+ ? ErrCode(0)
+ : ErrCode(static_cast<sal_uInt32>(m_value & ERRCODE_ERROR_MASK));
+ }
+
+ bool IsWarning() const {
+ return m_value & ERRCODE_WARNING_MASK;
+ }
+
+ ErrCode MakeWarning() const {
+ return ErrCode(m_value | ERRCODE_WARNING_MASK);
+ }
+
+ bool IsError() const {
+ return m_value && !IsWarning();
+ }
+
+ bool IsDynamic() const {
+ return m_value & ERRCODE_DYNAMIC_MASK;
+ }
+
+ sal_uInt32 GetDynamic() const {
+ return (m_value & ERRCODE_DYNAMIC_MASK) >> ERRCODE_DYNAMIC_SHIFT;
+ }
+
+ ErrCode StripDynamic() const {
+ return ErrCode(m_value & ~ERRCODE_DYNAMIC_MASK);
+ }
+
+ constexpr ErrCode StripWarningAndDynamic() const {
+ return ErrCode(m_value & ~(ERRCODE_DYNAMIC_MASK | ERRCODE_WARNING_MASK));
+ }
+
+ constexpr ErrCodeArea GetArea() const {
+ return static_cast<ErrCodeArea>((m_value >> ERRCODE_AREA_SHIFT) & 0x01fff);
+ }
+
+ constexpr ErrCodeClass GetClass() const {
+ return static_cast<ErrCodeClass>((m_value >> ERRCODE_CLASS_SHIFT) & 0x1f);
+ }
+
+ constexpr sal_uInt8 GetCode() const {
+ return static_cast<sal_uInt8>(m_value & 0xff);
+ }
+
+ OUString toHexString() const {
+ return "0x" + OUString::number(m_value, 16);
+ }
+
+ template <typename... Args> bool anyOf(Args... args) const
+ {
+ static_assert(sizeof...(args) > 0);
+ return (... || (*this == args));
+ }
+
+private:
+ sal_uInt32 m_value;
+};
+
+VCL_DLLPUBLIC std::ostream& operator<<(std::ostream& os, const ErrCode& err);
+
+enum class ErrCodeArea {
+ Io = 0 ,
+ Sfx = 2 ,
+ Inet = 3 ,
+ Vcl = 4 ,
+ Svx = 8 ,
+ So = 9 ,
+ Sbx = 10,
+ Uui = 13,
+ Sc = 32,
+ Sd = 40,
+ Sw = 56,
+};
+
+enum class ErrCodeClass {
+ NONE = 0,
+ Abort = 1,
+ General = 2,
+ NotExists = 3,
+ AlreadyExists = 4,
+ Access = 5,
+ Path = 6,
+ Locking = 7,
+ Parameter = 8,
+ Space = 9,
+ NotSupported = 10,
+ Read = 11,
+ Write = 12,
+ Unknown = 13,
+ Version = 14,
+ Format = 15,
+ Create = 16,
+ Import = 17,
+ Export = 18,
+ So = 20,
+ Sbx = 21,
+ Runtime = 22,
+ Compiler = 23
+};
+
+#define ERRCODE_NONE ErrCode(0)
+
+#define ERRCODE_IO_MISPLACEDCHAR ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 1 )
+#define ERRCODE_IO_NOTEXISTS ErrCode( ErrCodeArea::Io, ErrCodeClass::NotExists, 2 )
+#define ERRCODE_IO_ALREADYEXISTS ErrCode( ErrCodeArea::Io, ErrCodeClass::AlreadyExists, 3 )
+#define ERRCODE_IO_NOTADIRECTORY ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 4 )
+#define ERRCODE_IO_NOTAFILE ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 5 )
+#define ERRCODE_IO_INVALIDDEVICE ErrCode( ErrCodeArea::Io, ErrCodeClass::Path, 6 )
+#define ERRCODE_IO_ACCESSDENIED ErrCode( ErrCodeArea::Io, ErrCodeClass::Access, 7 )
+#define ERRCODE_IO_LOCKVIOLATION ErrCode( ErrCodeArea::Io, ErrCodeClass::Locking, 8 )
+#define ERRCODE_IO_OUTOFSPACE ErrCode( ErrCodeArea::Io, ErrCodeClass::Space, 9 )
+#define ERRCODE_IO_ISWILDCARD ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 11 )
+#define ERRCODE_IO_NOTSUPPORTED ErrCode( ErrCodeArea::Io, ErrCodeClass::NotSupported, 12 )
+#define ERRCODE_IO_GENERAL ErrCode( ErrCodeArea::Io, ErrCodeClass::General, 13 )
+#define ERRCODE_IO_TOOMANYOPENFILES ErrCode( ErrCodeArea::Io, ErrCodeClass::Space, 14 )
+#define ERRCODE_IO_CANTREAD ErrCode( ErrCodeArea::Io, ErrCodeClass::Read, 15 )
+#define ERRCODE_IO_CANTWRITE ErrCode( ErrCodeArea::Io, ErrCodeClass::Write, 16 )
+#define ERRCODE_IO_OUTOFMEMORY ErrCode( ErrCodeArea::Io, ErrCodeClass::Space, 17 )
+#define ERRCODE_IO_CANTSEEK ErrCode( ErrCodeArea::Io, ErrCodeClass::General, 18 )
+#define ERRCODE_IO_CANTTELL ErrCode( ErrCodeArea::Io, ErrCodeClass::General, 19 )
+#define ERRCODE_IO_WRONGVERSION ErrCode( ErrCodeArea::Io, ErrCodeClass::Version, 20 )
+#define ERRCODE_IO_WRONGFORMAT ErrCode( ErrCodeArea::Io, ErrCodeClass::Format, 21 )
+#define ERRCODE_IO_INVALIDCHAR ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 22 )
+#define ERRCODE_IO_UNKNOWN ErrCode( ErrCodeArea::Io, ErrCodeClass::Unknown, 23 )
+#define ERRCODE_IO_INVALIDACCESS ErrCode( ErrCodeArea::Io, ErrCodeClass::Access, 24 )
+#define ERRCODE_IO_CANTCREATE ErrCode( ErrCodeArea::Io, ErrCodeClass::Create, 25 )
+#define ERRCODE_IO_INVALIDPARAMETER ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 26 )
+#define ERRCODE_IO_ABORT ErrCode( ErrCodeArea::Io, ErrCodeClass::Abort, 27 )
+#define ERRCODE_IO_NOTEXISTSPATH ErrCode( ErrCodeArea::Io, ErrCodeClass::NotExists, 28 )
+#define ERRCODE_IO_PENDING ErrCode( ErrCodeArea::Io, ErrCodeClass::NotExists, 29 )
+#define ERRCODE_IO_RECURSIVE ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 30 )
+#define ERRCODE_IO_NAMETOOLONG ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 31 )
+#define ERRCODE_IO_INVALIDLENGTH ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 32 )
+#define ERRCODE_IO_CURRENTDIR ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 33 )
+#define ERRCODE_IO_NOTSAMEDEVICE ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 34 )
+#define ERRCODE_IO_DEVICENOTREADY ErrCode( ErrCodeArea::Io, ErrCodeClass::Read, 35 )
+#define ERRCODE_IO_BADCRC ErrCode( ErrCodeArea::Io, ErrCodeClass::Read, 36 )
+#define ERRCODE_IO_WRITEPROTECTED ErrCode( ErrCodeArea::Io, ErrCodeClass::Access, 37 )
+#define ERRCODE_IO_BROKENPACKAGE ErrCode( ErrCodeArea::Io, ErrCodeClass::Format, 38 )
+#define ERRCODE_IO_NOTSTORABLEINBINARYFORMAT ErrCode( ErrCodeArea::Io, ErrCodeClass::Format, 39 )
+#define ERRCODE_IO_FILTERDISABLED ErrCode( ErrCodeArea::Io, ErrCodeClass::Format, 40 )
+
+// StreamErrorCodes
+
+#define SVSTREAM_GENERALERROR ERRCODE_IO_GENERAL
+#define SVSTREAM_FILE_NOT_FOUND ERRCODE_IO_NOTEXISTS
+#define SVSTREAM_PATH_NOT_FOUND ERRCODE_IO_NOTEXISTSPATH
+#define SVSTREAM_TOO_MANY_OPEN_FILES ERRCODE_IO_TOOMANYOPENFILES
+#define SVSTREAM_ACCESS_DENIED ERRCODE_IO_ACCESSDENIED
+#define SVSTREAM_SHARING_VIOLATION ERRCODE_IO_LOCKVIOLATION
+#define SVSTREAM_LOCKING_VIOLATION ERRCODE_IO_LOCKVIOLATION
+#define SVSTREAM_SHARE_BUFF_EXCEEDED ERRCODE_IO_LOCKVIOLATION
+
+#define SVSTREAM_INVALID_ACCESS ERRCODE_IO_INVALIDACCESS
+#define SVSTREAM_INVALID_HANDLE ERRCODE_IO_GENERAL
+#define SVSTREAM_CANNOT_MAKE ERRCODE_IO_CANTCREATE
+#define SVSTREAM_INVALID_PARAMETER ERRCODE_IO_INVALIDPARAMETER
+
+#define SVSTREAM_READ_ERROR ERRCODE_IO_CANTREAD
+#define SVSTREAM_WRITE_ERROR ERRCODE_IO_CANTWRITE
+#define SVSTREAM_SEEK_ERROR ERRCODE_IO_CANTSEEK
+
+#define SVSTREAM_OUTOFMEMORY ERRCODE_IO_OUTOFMEMORY
+
+#define SVSTREAM_FILEFORMAT_ERROR ERRCODE_IO_WRONGFORMAT
+#define SVSTREAM_WRONGVERSION ERRCODE_IO_WRONGVERSION
+
+#define SVSTREAM_DISK_FULL ERRCODE_IO_OUTOFSPACE
+
+#define PRINTER_ABORT ERRCODE_IO_ABORT
+#define PRINTER_GENERALERROR ERRCODE_IO_GENERAL
+
+#define ERRCODE_ABORT ERRCODE_IO_ABORT
+
+#define ERRCODE_INET_NAME_RESOLVE ErrCode(ErrCodeArea::Inet, ErrCodeClass::Read, 1)
+#define ERRCODE_INET_CONNECT ErrCode(ErrCodeArea::Inet, ErrCodeClass::Read, 2)
+#define ERRCODE_INET_READ ErrCode(ErrCodeArea::Inet, ErrCodeClass::Read, 3)
+#define ERRCODE_INET_WRITE ErrCode(ErrCodeArea::Inet, ErrCodeClass::Write, 4)
+#define ERRCODE_INET_GENERAL ErrCode(ErrCodeArea::Inet, ErrCodeClass::Write, 5)
+#define ERRCODE_INET_OFFLINE ErrCode(ErrCodeArea::Inet, ErrCodeClass::Read, 6)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/errinf.hxx b/include/vcl/errinf.hxx
new file mode 100644
index 000000000..670c085cf
--- /dev/null
+++ b/include/vcl/errinf.hxx
@@ -0,0 +1,229 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_ERRINF_HXX
+#define INCLUDED_VCL_ERRINF_HXX
+
+#include <rtl/ustring.hxx>
+#include <vcl/errcode.hxx>
+#include <vcl/dllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <vector>
+#include <memory>
+
+#include <limits.h>
+
+namespace weld { class Window; }
+
+class ErrorHandler;
+class ErrorContext;
+class ErrorInfo;
+class DynamicErrorInfo;
+class ImplDynamicErrorInfo;
+enum class DialogMask;
+
+class VCL_DLLPUBLIC ErrorStringFactory
+{
+public:
+ static bool CreateString(const ErrorInfo*, OUString&);
+};
+
+typedef void (* DisplayFnPtr)();
+
+typedef DialogMask WindowDisplayErrorFunc(
+ weld::Window*, DialogMask eMask, const OUString &rErr, const OUString &rAction);
+
+typedef void BasicDisplayErrorFunc(
+ const OUString &rErr, const OUString &rAction);
+
+class VCL_DLLPUBLIC ErrorRegistry
+{
+ friend class ErrorHandler;
+ friend class ErrorContext;
+ friend class ErrorStringFactory;
+ friend class ImplDynamicErrorInfo;
+
+public:
+ ErrorRegistry();
+
+ static void RegisterDisplay(BasicDisplayErrorFunc*);
+ static void RegisterDisplay(WindowDisplayErrorFunc*);
+
+ static void SetLock(bool bLock);
+ static bool GetLock();
+
+ static void Reset();
+
+private:
+ DisplayFnPtr pDsp;
+ bool bIsWindowDsp;
+
+ bool m_bLock;
+
+ sal_uInt16 nNextError;
+
+ std::vector<ErrorHandler*> errorHandlers;
+ std::vector<ErrorContext*> contexts;
+
+ DynamicErrorInfo* ppDynErrInfo[ERRCODE_DYNAMIC_COUNT];
+};
+
+enum class DialogMask
+{
+ NONE = 0x0000,
+ ButtonsOk = 0x0001,
+ ButtonsCancel = 0x0002,
+ ButtonsRetry = 0x0004,
+ ButtonsNo = 0x0008,
+ ButtonsYes = 0x0010,
+ ButtonsYesNo = 0x0018,
+
+ ButtonDefaultsOk = 0x0100,
+ ButtonDefaultsCancel = 0x0200,
+ ButtonDefaultsYes = 0x0300,
+ ButtonDefaultsNo = 0x0400,
+
+ MessageError = 0x1000,
+ MessageWarning = 0x2000,
+ MessageInfo = 0x3000,
+
+ MAX = USHRT_MAX,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<DialogMask> : is_typed_flags<DialogMask, 0xffff> {};
+}
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC ErrorHandler
+{
+ friend class ErrorStringFactory;
+
+public:
+ ErrorHandler();
+ virtual ~ErrorHandler();
+
+ /** Handles an error.
+
+ If nFlags is not set, the DynamicErrorInfo flags or the
+ resource flags will be used. Thus the order is:
+
+ 1. nFlags,
+ 2. Resource Flags
+ 3. Dynamic Flags
+ 4. Default ButtonsOk, MessageError
+
+ @param nErrCodeId error id
+ @param pParent parent window the error dialog will be modal for. nullptr for unrecommended "pick default"
+ @param nFlags error flags.
+
+ @return what sort of dialog to use, with what buttons
+ */
+ static DialogMask HandleError(ErrCode nId, weld::Window* pParent = nullptr, DialogMask nMask = DialogMask::MAX);
+ static bool GetErrorString(ErrCode nId, OUString& rStr);
+
+protected:
+ virtual bool CreateString(const ErrorInfo*, OUString &) const = 0;
+
+};
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC ErrorInfo
+{
+public:
+ ErrorInfo(ErrCode nArgUserId) :
+ nUserId(nArgUserId) {}
+ virtual ~ErrorInfo();
+
+ ErrCode const & GetErrorCode() const { return nUserId; }
+
+ static std::unique_ptr<ErrorInfo> GetErrorInfo(ErrCode);
+
+private:
+ ErrCode nUserId;
+};
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC DynamicErrorInfo : public ErrorInfo
+{
+ friend class ImplDynamicErrorInfo;
+
+public:
+ DynamicErrorInfo(ErrCode nUserId, DialogMask nMask);
+ virtual ~DynamicErrorInfo() override;
+
+ operator ErrCode() const;
+ DialogMask GetDialogMask() const;
+
+private:
+ std::unique_ptr<ImplDynamicErrorInfo> pImpl;
+
+};
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC StringErrorInfo final : public DynamicErrorInfo
+{
+public:
+ StringErrorInfo(ErrCode nUserId,
+ const OUString& aStringP,
+ DialogMask nMask = DialogMask::NONE);
+
+ const OUString& GetErrorString() const { return aString; }
+
+private:
+ OUString aString;
+
+};
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC TwoStringErrorInfo final : public DynamicErrorInfo
+{
+public:
+ TwoStringErrorInfo(ErrCode nUserID, const OUString & rTheArg1,
+ const OUString & rTheArg2, DialogMask nMask):
+ DynamicErrorInfo(nUserID, nMask), aArg1(rTheArg1), aArg2(rTheArg2) {}
+
+ const OUString& GetArg1() const { return aArg1; }
+ const OUString& GetArg2() const { return aArg2; }
+
+private:
+ OUString aArg1;
+ OUString aArg2;
+
+};
+
+struct ImplErrorContext;
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC ErrorContext
+{
+ friend class ErrorHandler;
+
+public:
+ ErrorContext(weld::Window *pWin);
+ virtual ~ErrorContext();
+
+ virtual bool GetString(ErrCode nErrId, OUString& rCtxStr) = 0;
+ weld::Window* GetParent();
+
+ static ErrorContext* GetContext();
+
+private:
+ std::unique_ptr<ImplErrorContext> pImpl;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx
new file mode 100644
index 000000000..32ff5bcfa
--- /dev/null
+++ b/include/vcl/event.hxx
@@ -0,0 +1,387 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_EVENT_HXX
+#define INCLUDED_VCL_EVENT_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/gen.hxx>
+#include <vcl/keycod.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/outdev.hxx>
+#include <optional>
+
+class CommandEvent;
+
+enum class TextDirectionality {
+ LeftToRight_TopToBottom,
+ RightToLeft_TopToBottom,
+ TopToBottom_RightToLeft,
+ BottomToTop_LeftToRight
+};
+
+namespace vcl {
+ class Window;
+}
+
+class VCL_DLLPUBLIC KeyEvent
+{
+private:
+ vcl::KeyCode maKeyCode;
+ sal_uInt16 mnRepeat;
+ sal_Unicode mnCharCode;
+
+public:
+ KeyEvent();
+ KeyEvent( sal_Unicode nChar, const vcl::KeyCode& rKeyCode,
+ sal_uInt16 nRepeat = 0 );
+
+ sal_Unicode GetCharCode() const { return mnCharCode; }
+ const vcl::KeyCode& GetKeyCode() const { return maKeyCode; }
+ sal_uInt16 GetRepeat() const { return mnRepeat; }
+
+ KeyEvent LogicalTextDirectionality (TextDirectionality eMode) const;
+};
+
+inline KeyEvent::KeyEvent()
+{
+ mnCharCode = 0;
+ mnRepeat = 0;
+}
+
+inline KeyEvent::KeyEvent( sal_Unicode nChar, const vcl::KeyCode& rKeyCode,
+ sal_uInt16 nRepeat ) :
+ maKeyCode( rKeyCode )
+
+{
+ mnCharCode = nChar;
+ mnRepeat = nRepeat;
+}
+
+
+enum class MouseEventModifiers
+{
+ NONE = 0,
+ // mouse move modifiers
+ SIMPLEMOVE = 0x0001,
+ DRAGMOVE = 0x0002,
+ DRAGCOPY = 0x0004,
+ ENTERWINDOW = 0x0010,
+ LEAVEWINDOW = 0x0020,
+ SYNTHETIC = 0x0040,
+ MODIFIERCHANGED = 0x0080,
+ // mouse up/down-button modifiers
+ SIMPLECLICK = 0x0100,
+ SELECT = 0x0200,
+ MULTISELECT = 0x0400,
+ RANGESELECT = 0x0800
+};
+namespace o3tl
+{
+ template<> struct typed_flags<MouseEventModifiers> : is_typed_flags<MouseEventModifiers, 0xff7> {};
+}
+
+// Mouse buttons
+#define MOUSE_LEFT (sal_uInt16(0x0001))
+#define MOUSE_MIDDLE (sal_uInt16(0x0002))
+#define MOUSE_RIGHT (sal_uInt16(0x0004))
+
+class VCL_DLLPUBLIC MouseEvent
+{
+private:
+ Point maPos;
+ MouseEventModifiers mnMode;
+ sal_uInt16 mnClicks;
+ sal_uInt16 mnCode;
+
+ // Set, if the document relative logic position are available
+ std::optional<Point> maLogicPosition;
+
+public:
+ explicit MouseEvent();
+ explicit MouseEvent( const Point& rPos, sal_uInt16 nClicks = 1,
+ MouseEventModifiers nMode = MouseEventModifiers::NONE, sal_uInt16 nButtons = 0,
+ sal_uInt16 nModifier = 0 );
+
+ const Point& GetPosPixel() const { return maPos; }
+ MouseEventModifiers GetMode() const { return mnMode; }
+
+ sal_uInt16 GetClicks() const { return mnClicks; }
+
+ void setLogicPosition(Point aLogicPosition)
+ {
+ maLogicPosition = aLogicPosition;
+ }
+
+ const std::optional<Point> & getLogicPosition() const
+ {
+ return maLogicPosition;
+ }
+
+ bool IsEnterWindow() const
+ { return bool(mnMode & MouseEventModifiers::ENTERWINDOW); }
+ bool IsLeaveWindow() const
+ { return bool(mnMode & MouseEventModifiers::LEAVEWINDOW); }
+ bool IsSynthetic() const
+ { return bool(mnMode & MouseEventModifiers::SYNTHETIC); }
+ bool IsModifierChanged() const
+ { return bool(mnMode & MouseEventModifiers::MODIFIERCHANGED); }
+
+ sal_uInt16 GetButtons() const
+ { return (mnCode & (MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT)); }
+ bool IsLeft() const
+ { return ((mnCode & MOUSE_LEFT) != 0); }
+ bool IsMiddle() const
+ { return ((mnCode & MOUSE_MIDDLE) != 0); }
+ bool IsRight() const
+ { return ((mnCode & MOUSE_RIGHT) != 0); }
+
+ sal_uInt16 GetModifier() const
+ { return (mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); }
+ bool IsShift() const
+ { return ((mnCode & KEY_SHIFT) != 0); }
+ bool IsMod1() const
+ { return ((mnCode & KEY_MOD1) != 0); }
+ bool IsMod2() const
+ { return ((mnCode & KEY_MOD2) != 0); }
+ bool IsMod3() const
+ { return ((mnCode & KEY_MOD3) != 0); }
+};
+
+inline MouseEvent::MouseEvent()
+{
+ mnMode = MouseEventModifiers::NONE;
+ mnClicks = 0;
+ mnCode = 0;
+}
+
+inline MouseEvent::MouseEvent( const Point& rPos, sal_uInt16 nClicks,
+ MouseEventModifiers nMode,
+ sal_uInt16 nButtons, sal_uInt16 nModifier ) :
+ maPos( rPos )
+{
+ mnClicks = nClicks;
+ mnMode = nMode;
+ mnCode = nButtons | nModifier;
+}
+
+enum class HelpEventMode
+{
+ NONE = 0x0000,
+ CONTEXT = 0x0001,
+ BALLOON = 0x0002,
+ QUICK = 0x0004
+};
+namespace o3tl
+{
+ template<> struct typed_flags<HelpEventMode> : is_typed_flags<HelpEventMode, 0x07> {};
+}
+
+class VCL_DLLPUBLIC HelpEvent
+{
+private:
+ Point maPos;
+ HelpEventMode mnMode;
+ bool mbKeyboardActivated;
+
+public:
+ explicit HelpEvent( const Point& rMousePos, HelpEventMode nHelpMode );
+
+ const Point& GetMousePosPixel() const { return maPos; }
+ HelpEventMode GetMode() const { return mnMode; }
+ bool KeyboardActivated() const { return mbKeyboardActivated; }
+ void SetKeyboardActivated( bool bKeyboard ) { mbKeyboardActivated = bKeyboard; }
+};
+
+inline HelpEvent::HelpEvent( const Point& rMousePos, HelpEventMode nHelpMode ) :
+ maPos( rMousePos )
+{
+ mnMode = nHelpMode;
+ mbKeyboardActivated = false;
+}
+
+/// Event to pass information for UserDraw() handling eg. in comboboxes.
+class VCL_DLLPUBLIC UserDrawEvent
+{
+private:
+ /// RenderContext to which we should draw - can be a VirtualDevice or anything.
+ VclPtr<vcl::RenderContext> mpRenderContext;
+
+ tools::Rectangle maOutRect;
+ sal_uInt16 mnItemId;
+ bool mbSelected;
+
+public:
+ UserDrawEvent(vcl::RenderContext* pRenderContext,
+ const tools::Rectangle& rOutRect, sal_uInt16 nId, bool bSelected = false)
+ : mpRenderContext(pRenderContext)
+ , maOutRect( rOutRect )
+ , mnItemId(nId)
+ , mbSelected(bSelected)
+ {
+ }
+
+ vcl::RenderContext* GetRenderContext() const { return mpRenderContext; }
+ const tools::Rectangle& GetRect() const { return maOutRect; }
+ sal_uInt16 GetItemId() const { return mnItemId; }
+ bool IsSelected() const { return mbSelected; }
+};
+
+class VCL_DLLPUBLIC TrackingEvent
+{
+private:
+ MouseEvent maMEvt;
+ TrackingEventFlags mnFlags;
+
+public:
+ explicit TrackingEvent( const MouseEvent&,
+ TrackingEventFlags nTrackFlags = TrackingEventFlags::NONE );
+
+ const MouseEvent& GetMouseEvent() const { return maMEvt; }
+
+ bool IsTrackingRepeat() const
+ { return bool(mnFlags & TrackingEventFlags::Repeat); }
+ bool IsTrackingEnded() const
+ { return bool(mnFlags & TrackingEventFlags::End); }
+ bool IsTrackingCanceled() const
+ { return bool(mnFlags & TrackingEventFlags::Cancel); }
+};
+
+inline TrackingEvent::TrackingEvent( const MouseEvent& rMEvt,
+ TrackingEventFlags nTrackFlags ) :
+ maMEvt( rMEvt )
+{
+ mnFlags = nTrackFlags;
+}
+
+
+enum class MouseNotifyEvent
+{
+ NONE = 0,
+ MOUSEBUTTONDOWN = 1,
+ MOUSEBUTTONUP = 2,
+ MOUSEMOVE = 3,
+ KEYINPUT = 4,
+ KEYUP = 5,
+ GETFOCUS = 6,
+ LOSEFOCUS = 7,
+ COMMAND = 8
+};
+
+class VCL_DLLPUBLIC NotifyEvent
+{
+private:
+ VclPtr<vcl::Window> mpWindow;
+ void* mpData;
+ MouseNotifyEvent mnEventType;
+
+public:
+ NotifyEvent( MouseNotifyEvent nEventType,
+ vcl::Window* pWindow,
+ const void* pEvent = nullptr );
+ ~NotifyEvent();
+ // Avoid implicitly defined copy constructors/assignments for the
+ // DLLPUBLIC class (they may require forward-declared classes used
+ // internally to be defined in places using NotifyEvent)
+ NotifyEvent(const NotifyEvent&) = delete;
+ NotifyEvent(NotifyEvent&&) = delete;
+ NotifyEvent& operator=(const NotifyEvent&) = delete;
+ NotifyEvent& operator=(NotifyEvent&&) = delete;
+
+ MouseNotifyEvent GetType() const { return mnEventType; }
+ vcl::Window* GetWindow() const { return mpWindow; }
+ void* GetData() const { return mpData; }
+ const KeyEvent* GetKeyEvent() const;
+ const MouseEvent* GetMouseEvent() const;
+ const CommandEvent* GetCommandEvent() const;
+};
+
+inline const KeyEvent* NotifyEvent::GetKeyEvent() const
+{
+ if ( (mnEventType == MouseNotifyEvent::KEYINPUT) || (mnEventType == MouseNotifyEvent::KEYUP) )
+ return static_cast<const KeyEvent*>(mpData);
+ else
+ return nullptr;
+}
+
+inline const MouseEvent* NotifyEvent::GetMouseEvent() const
+{
+ if ( (mnEventType >= MouseNotifyEvent::MOUSEBUTTONDOWN) && (mnEventType <= MouseNotifyEvent::MOUSEMOVE) )
+ return static_cast<const MouseEvent*>(mpData);
+ else
+ return nullptr;
+}
+
+inline const CommandEvent* NotifyEvent::GetCommandEvent() const
+{
+ if ( mnEventType == MouseNotifyEvent::COMMAND )
+ return static_cast<const CommandEvent*>(mpData);
+ else
+ return nullptr;
+}
+
+
+enum class DataChangedEventType {
+ NONE = 0,
+ SETTINGS = 1,
+ DISPLAY = 2,
+ FONTS = 4,
+ PRINTER = 5,
+ FONTSUBSTITUTION = 6
+};
+
+class VCL_DLLPUBLIC DataChangedEvent
+{
+private:
+ void* mpData;
+ AllSettingsFlags mnFlags;
+ DataChangedEventType mnType;
+
+public:
+ explicit DataChangedEvent( DataChangedEventType nType,
+ const void* pData = nullptr,
+ AllSettingsFlags nFlags = AllSettingsFlags::NONE );
+
+ DataChangedEventType GetType() const { return mnType; }
+ AllSettingsFlags GetFlags() const { return mnFlags; }
+
+ const AllSettings* GetOldSettings() const;
+};
+
+inline DataChangedEvent::DataChangedEvent( DataChangedEventType nType,
+ const void* pData,
+ AllSettingsFlags nChangeFlags )
+{
+ mpData = const_cast<void*>(pData);
+ mnFlags = nChangeFlags;
+ mnType = nType;
+}
+
+inline const AllSettings* DataChangedEvent::GetOldSettings() const
+{
+ if ( mnType == DataChangedEventType::SETTINGS )
+ return static_cast<const AllSettings*>(mpData);
+ else
+ return nullptr;
+}
+
+#endif // INCLUDED_VCL_EVENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/evntpost.hxx b/include/vcl/evntpost.hxx
new file mode 100644
index 000000000..ca6be18a6
--- /dev/null
+++ b/include/vcl/evntpost.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_EVNTPOST_HXX
+#define INCLUDED_VCL_EVNTPOST_HXX
+
+#include <config_options.h>
+#include <tools/link.hxx>
+#include <vcl/dllapi.h>
+
+struct ImplSVEvent;
+
+namespace vcl
+{
+ class UNLESS_MERGELIBS(VCL_DLLPUBLIC) EventPoster
+ {
+ ImplSVEvent * m_nId;
+ Link<LinkParamNone*,void> m_aLink;
+
+ DECL_DLLPRIVATE_LINK( DoEvent_Impl, void*, void );
+
+ public:
+ EventPoster( const Link<LinkParamNone*,void>& rLink );
+ ~EventPoster();
+ void Post();
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/exceptiontypes.hxx b/include/vcl/exceptiontypes.hxx
new file mode 100644
index 000000000..b0e63a982
--- /dev/null
+++ b/include/vcl/exceptiontypes.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_EXCEPTIONTYPES_HXX
+#define INCLUDED_VCL_EXCEPTIONTYPES_HXX
+
+enum class ExceptionCategory
+{
+ NONE,
+ System,
+ UserInterface
+};
+
+#endif // INCLUDED_VCL_EXCEPTIONTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/extoutdevdata.hxx b/include/vcl/extoutdevdata.hxx
new file mode 100644
index 000000000..537414435
--- /dev/null
+++ b/include/vcl/extoutdevdata.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_EXTOUTDEVDATA_HXX
+#define INCLUDED_VCL_EXTOUTDEVDATA_HXX
+
+#include <vcl/dllapi.h>
+
+namespace vcl
+{
+class VCL_DLLPUBLIC ExtOutDevData
+{
+public:
+ virtual ~ExtOutDevData();
+};
+}
+
+#endif // INCLUDED_VCL_EXTOUTDEVDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/fieldvalues.hxx b/include/vcl/fieldvalues.hxx
new file mode 100644
index 000000000..999f3e5fa
--- /dev/null
+++ b/include/vcl/fieldvalues.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_FIELDVALUES_HXX
+#define INCLUDED_VCL_FIELDVALUES_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <tools/fldunit.hxx>
+#include <tools/mapunit.hxx>
+
+class LocaleDataWrapper;
+
+namespace vcl
+{
+VCL_DLLPUBLIC FieldUnit EnglishStringToMetric(std::string_view rEnglishMetricString);
+
+VCL_DLLPUBLIC bool TextToValue(const OUString& rStr, double& rValue, sal_Int64 nBaseValue,
+ sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper,
+ FieldUnit eUnit);
+
+VCL_DLLPUBLIC sal_Int64 ConvertValue(sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
+ FieldUnit eInUnit, FieldUnit eOutUnit);
+VCL_DLLPUBLIC sal_Int64 ConvertValue(sal_Int64 nValue, sal_uInt16 nDecDigits, MapUnit eInUnit,
+ FieldUnit eOutUnit);
+
+// for backwards compatibility
+// caution: conversion to double loses precision
+VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
+ FieldUnit eInUnit, FieldUnit eOutUnit);
+VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_uInt16 nDecDigits, FieldUnit eInUnit,
+ MapUnit eOutUnit);
+VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_uInt16 nDecDigits, MapUnit eInUnit,
+ FieldUnit eOutUnit);
+
+// for backwards compatibility
+// caution: conversion to double loses precision
+inline double ConvertDoubleValue(sal_Int64 nValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits,
+ FieldUnit eInUnit, FieldUnit eOutUnit)
+{
+ return ConvertDoubleValue(static_cast<double>(nValue), nBaseValue, nDecDigits, eInUnit,
+ eOutUnit);
+}
+
+inline double ConvertDoubleValue(sal_Int64 nValue, sal_uInt16 nDecDigits, FieldUnit eInUnit,
+ MapUnit eOutUnit)
+{
+ return ConvertDoubleValue(static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit);
+}
+
+inline double ConvertDoubleValue(sal_Int64 nValue, sal_uInt16 nDecDigits, MapUnit eInUnit,
+ FieldUnit eOutUnit)
+{
+ return ConvertDoubleValue(static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit);
+}
+}
+
+#endif // INCLUDED_VCL_FIELDVALUES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/fileregistration.hxx b/include/vcl/fileregistration.hxx
new file mode 100644
index 000000000..68a0f26a8
--- /dev/null
+++ b/include/vcl/fileregistration.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <vcl/dllapi.h>
+
+namespace weld
+{
+class Window;
+}
+
+namespace vcl::fileregistration
+{
+VCL_DLLPUBLIC void LaunchRegistrationUI();
+
+VCL_DLLPUBLIC void CheckFileExtRegistration(weld::Window* pDialogParent);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
new file mode 100644
index 000000000..3a4d0d83f
--- /dev/null
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <memory>
+
+#include <com/sun/star/util/DateTime.hpp>
+
+#include <vcl/dllapi.h>
+#include <basegfx/vector/b2dsize.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include <vcl/checksum.hxx>
+#include <vcl/Scanline.hxx>
+#include <vcl/pdf/PDFAnnotationSubType.hxx>
+#include <vcl/pdf/PDFPageObjectType.hxx>
+#include <vcl/pdf/PDFSegmentType.hxx>
+#include <vcl/pdf/PDFBitmapType.hxx>
+#include <vcl/pdf/PDFObjectType.hxx>
+#include <vcl/pdf/PDFTextRenderMode.hxx>
+#include <vcl/pdf/PDFFillMode.hxx>
+#include <vcl/pdf/PDFFindFlags.hxx>
+#include <vcl/pdf/PDFErrorType.hxx>
+
+class SvMemoryStream;
+
+namespace vcl::pdf
+{
+inline constexpr OStringLiteral constDictionaryKeyTitle = "T";
+inline constexpr OStringLiteral constDictionaryKeyContents = "Contents";
+inline constexpr OStringLiteral constDictionaryKeyPopup = "Popup";
+inline constexpr OStringLiteral constDictionaryKeyModificationDate = "M";
+inline constexpr OStringLiteral constDictionaryKeyInteriorColor = "IC";
+
+class PDFiumBitmap;
+class PDFiumDocument;
+class PDFiumPageObject;
+
+class VCL_DLLPUBLIC PDFium
+{
+public:
+ virtual ~PDFium() = default;
+
+ virtual const OUString& getLastError() const = 0;
+
+ virtual std::unique_ptr<PDFiumDocument> openDocument(const void* pData, int nSize,
+ const OString& rPassword)
+ = 0;
+ virtual PDFErrorType getLastErrorCode() = 0;
+ virtual std::unique_ptr<PDFiumBitmap> createBitmap(int nWidth, int nHeight, int nAlpha) = 0;
+};
+
+class PDFiumPage;
+
+class VCL_DLLPUBLIC PDFiumBitmap
+{
+public:
+ virtual ~PDFiumBitmap() = default;
+ virtual void fillRect(int left, int top, int width, int height, sal_uInt32 nColor) = 0;
+ virtual void renderPageBitmap(PDFiumDocument* pDoc, PDFiumPage* pPage, int nStartX, int nStartY,
+ int nSizeX, int nSizeY)
+ = 0;
+ virtual ConstScanline getBuffer() = 0;
+ virtual int getStride() = 0;
+ virtual int getWidth() = 0;
+ virtual int getHeight() = 0;
+ virtual PDFBitmapType getFormat() = 0;
+};
+
+class VCL_DLLPUBLIC PDFiumAnnotation
+{
+public:
+ virtual ~PDFiumAnnotation() = default;
+ virtual PDFAnnotationSubType getSubType() = 0;
+ virtual basegfx::B2DRectangle getRectangle() = 0;
+ virtual bool hasKey(OString const& rKey) = 0;
+ virtual PDFObjectType getValueType(OString const& rKey) = 0;
+ virtual OUString getString(OString const& rKey) = 0;
+ virtual std::unique_ptr<PDFiumAnnotation> getLinked(OString const& rKey) = 0;
+ virtual int getObjectCount() = 0;
+ virtual std::unique_ptr<PDFiumPageObject> getObject(int nIndex) = 0;
+ virtual std::vector<std::vector<basegfx::B2DPoint>> getInkStrokes() = 0;
+ virtual std::vector<basegfx::B2DPoint> getVertices() = 0;
+ virtual Color getColor() = 0;
+ virtual Color getInteriorColor() = 0;
+ virtual float getBorderWidth() = 0;
+ virtual basegfx::B2DSize getBorderCornerRadius() = 0;
+ virtual size_t getAttachmentPointsCount() = 0;
+ virtual std::vector<basegfx::B2DPoint> getAttachmentPoints(size_t nIndex) = 0;
+ virtual std::vector<basegfx::B2DPoint> getLineGeometry() = 0;
+};
+
+class PDFiumTextPage;
+
+class VCL_DLLPUBLIC PDFiumPathSegment
+{
+public:
+ virtual ~PDFiumPathSegment() = default;
+ virtual basegfx::B2DPoint getPoint() const = 0;
+ virtual bool isClosed() const = 0;
+ virtual PDFSegmentType getType() const = 0;
+};
+
+class VCL_DLLPUBLIC PDFiumPageObject
+{
+public:
+ virtual ~PDFiumPageObject() = default;
+
+ virtual PDFPageObjectType getType() = 0;
+ virtual OUString getText(std::unique_ptr<PDFiumTextPage> const& pTextPage) = 0;
+
+ virtual int getFormObjectCount() = 0;
+ virtual std::unique_ptr<PDFiumPageObject> getFormObject(int nIndex) = 0;
+
+ virtual basegfx::B2DHomMatrix getMatrix() = 0;
+ virtual basegfx::B2DRectangle getBounds() = 0;
+ virtual double getFontSize() = 0;
+ virtual OUString getFontName() = 0;
+ virtual PDFTextRenderMode getTextRenderMode() = 0;
+ virtual Color getFillColor() = 0;
+ virtual Color getStrokeColor() = 0;
+ virtual double getStrokeWidth() = 0;
+ // Path
+ virtual int getPathSegmentCount() = 0;
+ virtual std::unique_ptr<PDFiumPathSegment> getPathSegment(int index) = 0;
+ virtual Size getImageSize(PDFiumPage& rPage) = 0;
+ virtual std::unique_ptr<PDFiumBitmap> getImageBitmap() = 0;
+ virtual bool getDrawMode(PDFFillMode& eFillMode, bool& bStroke) = 0;
+};
+
+class VCL_DLLPUBLIC PDFiumSearchHandle
+{
+public:
+ virtual ~PDFiumSearchHandle() = default;
+
+ virtual bool findNext() = 0;
+ virtual bool findPrev() = 0;
+ virtual int getSearchResultIndex() = 0;
+ virtual int getSearchCount() = 0;
+};
+
+class VCL_DLLPUBLIC PDFiumTextPage
+{
+public:
+ virtual ~PDFiumTextPage() = default;
+
+ virtual int countChars() = 0;
+ virtual unsigned int getUnicode(int index) = 0;
+ virtual std::unique_ptr<PDFiumSearchHandle>
+ findStart(const OUString& rFindWhat, PDFFindFlags nFlags, sal_Int32 nStartIndex) = 0;
+
+ /// Returned rect is no longer upside down and is in mm100.
+ virtual basegfx::B2DRectangle getCharBox(int nIndex, double fPageHeight) = 0;
+};
+
+class VCL_DLLPUBLIC PDFiumPage
+{
+public:
+ virtual ~PDFiumPage() = default;
+
+ virtual int getObjectCount() = 0;
+ virtual std::unique_ptr<PDFiumPageObject> getObject(int nIndex) = 0;
+
+ virtual int getAnnotationCount() = 0;
+ virtual int getAnnotationIndex(std::unique_ptr<PDFiumAnnotation> const& rAnnotation) = 0;
+
+ virtual std::unique_ptr<PDFiumAnnotation> getAnnotation(int nIndex) = 0;
+
+ virtual std::unique_ptr<PDFiumTextPage> getTextPage() = 0;
+
+ /// Get bitmap checksum of the page, without annotations/commenting.
+ virtual BitmapChecksum getChecksum(int nMDPPerm) = 0;
+
+ virtual double getWidth() = 0;
+ virtual double getHeight() = 0;
+
+ virtual bool hasTransparency() = 0;
+
+ virtual bool hasLinks() = 0;
+};
+
+/// Represents one digital signature, as exposed by PDFium.
+class VCL_DLLPUBLIC PDFiumSignature
+{
+public:
+ virtual ~PDFiumSignature() = default;
+
+ virtual std::vector<int> getByteRange() = 0;
+ virtual int getDocMDPPermission() = 0;
+ virtual std::vector<unsigned char> getContents() = 0;
+ virtual OString getSubFilter() = 0;
+ virtual OUString getReason() = 0;
+ virtual css::util::DateTime getTime() = 0;
+};
+
+class VCL_DLLPUBLIC PDFiumDocument
+{
+public:
+ virtual ~PDFiumDocument() = default;
+
+ // Page size in points
+ virtual basegfx::B2DSize getPageSize(int nIndex) = 0;
+ virtual int getPageCount() = 0;
+ virtual int getSignatureCount() = 0;
+ virtual int getFileVersion() = 0;
+ virtual bool saveWithVersion(SvMemoryStream& rStream, int nFileVersion) = 0;
+
+ virtual std::unique_ptr<PDFiumPage> openPage(int nIndex) = 0;
+ virtual std::unique_ptr<PDFiumSignature> getSignature(int nIndex) = 0;
+ virtual std::vector<unsigned int> getTrailerEnds() = 0;
+};
+
+struct VCL_DLLPUBLIC PDFiumLibrary final
+{
+ static std::shared_ptr<PDFium>& get();
+};
+
+// Tools
+
+VCL_DLLPUBLIC OUString convertPdfDateToISO8601(OUString const& rInput);
+
+} // namespace vcl::pdf
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/filter/PngImageReader.hxx b/include/vcl/filter/PngImageReader.hxx
new file mode 100644
index 000000000..bbb5b7c8d
--- /dev/null
+++ b/include/vcl/filter/PngImageReader.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_FILTER_PNGIMAGEREADER_HXX
+#define INCLUDED_VCL_FILTER_PNGIMAGEREADER_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+
+#include <vcl/dllapi.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::task
+{
+class XStatusIndicator;
+}
+
+class BitmapEx;
+class SvStream;
+
+namespace vcl
+{
+class VCL_DLLPUBLIC PngImageReader
+{
+ SvStream& mrStream;
+ css::uno::Reference<css::task::XStatusIndicator> mxStatusIndicator;
+
+public:
+ PngImageReader(SvStream& rStream);
+
+ // Returns true if image was successfully read without errors.
+ // A usable bitmap may be returned even if there were errors (e.g. incomplete image).
+ bool read(BitmapEx& rBitmap);
+ // Returns a bitmap without indicating if there were errors.
+ BitmapEx read();
+
+ // Returns the contents of the msOG chunk (containing a Gif image), if it exists.
+ // Does not change position in the stream.
+ static std::unique_ptr<sal_uInt8[]> getMicrosoftGifChunk(SvStream& rStream,
+ sal_Int32* chunkSize = nullptr);
+};
+
+} // namespace vcl
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx
new file mode 100644
index 000000000..d16a775e3
--- /dev/null
+++ b/include/vcl/filter/SvmReader.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vcl/gdimtf.hxx>
+
+class SvStream;
+
+class VCL_DLLPUBLIC SvmReader
+{
+private:
+ SvStream& mrStream;
+
+ void ReadColor(::Color& rColor);
+
+public:
+ SvmReader(SvStream& rIStm);
+
+ SvStream& Read(GDIMetaFile& rMetaFile, ImplMetaReadData* pData = nullptr);
+ rtl::Reference<MetaAction> MetaActionHandler(ImplMetaReadData* pData);
+ rtl::Reference<MetaAction> LineColorHandler();
+ rtl::Reference<MetaAction> FillColorHandler();
+ rtl::Reference<MetaAction> RectHandler();
+ rtl::Reference<MetaAction> PointHandler();
+ rtl::Reference<MetaAction> PixelHandler();
+ rtl::Reference<MetaAction> LineHandler();
+ rtl::Reference<MetaAction> RoundRectHandler();
+ rtl::Reference<MetaAction> EllipseHandler();
+ rtl::Reference<MetaAction> ArcHandler();
+ rtl::Reference<MetaAction> PieHandler();
+ rtl::Reference<MetaAction> ChordHandler();
+ rtl::Reference<MetaAction> PolyLineHandler();
+ rtl::Reference<MetaAction> PolygonHandler();
+ rtl::Reference<MetaAction> PolyPolygonHandler();
+ rtl::Reference<MetaAction> TextHandler(const ImplMetaReadData* pData);
+ rtl::Reference<MetaAction> TextArrayHandler(const ImplMetaReadData* pData);
+ rtl::Reference<MetaAction> StretchTextHandler(const ImplMetaReadData* pData);
+ rtl::Reference<MetaAction> TextRectHandler(const ImplMetaReadData* pData);
+ rtl::Reference<MetaAction> TextLineHandler();
+ rtl::Reference<MetaAction> BmpHandler();
+ rtl::Reference<MetaAction> BmpScaleHandler();
+ rtl::Reference<MetaAction> BmpScalePartHandler();
+ rtl::Reference<MetaAction> BmpExHandler();
+ rtl::Reference<MetaAction> BmpExScaleHandler();
+ rtl::Reference<MetaAction> BmpExScalePartHandler();
+ rtl::Reference<MetaAction> MaskHandler();
+ rtl::Reference<MetaAction> MaskScaleHandler();
+ rtl::Reference<MetaAction> MaskScalePartHandler();
+ rtl::Reference<MetaAction> GradientHandler();
+ rtl::Reference<MetaAction> GradientExHandler();
+ rtl::Reference<MetaAction> HatchHandler();
+ rtl::Reference<MetaAction> WallpaperHandler();
+ rtl::Reference<MetaAction> ClipRegionHandler();
+ rtl::Reference<MetaAction> ISectRectClipRegionHandler();
+ rtl::Reference<MetaAction> ISectRegionClipRegionHandler();
+ rtl::Reference<MetaAction> MoveClipRegionHandler();
+ rtl::Reference<MetaAction> TextColorHandler();
+ rtl::Reference<MetaAction> TextFillColorHandler();
+ rtl::Reference<MetaAction> TextLineColorHandler();
+ rtl::Reference<MetaAction> OverlineColorHandler();
+ rtl::Reference<MetaAction> TextAlignHandler();
+ rtl::Reference<MetaAction> MapModeHandler();
+ rtl::Reference<MetaAction> FontHandler(ImplMetaReadData* pData);
+ rtl::Reference<MetaAction> PushHandler();
+ rtl::Reference<MetaAction> PopHandler();
+ rtl::Reference<MetaAction> RasterOpHandler();
+ rtl::Reference<MetaAction> TransparentHandler();
+ rtl::Reference<MetaAction> FloatTransparentHandler(ImplMetaReadData* pData);
+ rtl::Reference<MetaAction> EPSHandler();
+ rtl::Reference<MetaAction> RefPointHandler();
+ rtl::Reference<MetaAction> CommentHandler();
+ rtl::Reference<MetaAction> LayoutModeHandler();
+ rtl::Reference<MetaAction> TextLanguageHandler();
+ static rtl::Reference<MetaAction> DefaultHandler();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/filter/SvmWriter.hxx b/include/vcl/filter/SvmWriter.hxx
new file mode 100644
index 000000000..ef8cf8c52
--- /dev/null
+++ b/include/vcl/filter/SvmWriter.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vcl/gdimtf.hxx>
+#include <vcl/metaact.hxx>
+
+class SvStream;
+
+class VCL_DLLPUBLIC SvmWriter
+{
+private:
+ SvStream& mrStream;
+
+ void WriteColor(::Color aColor);
+
+public:
+ SvmWriter(SvStream& rIStm);
+
+ SvStream& Write(const GDIMetaFile& rMetaFile);
+ static BitmapChecksum GetChecksum(const GDIMetaFile& rMetaFile);
+ void MetaActionHandler(MetaAction* pAction, ImplMetaWriteData* pData);
+ void ActionHandler(const MetaAction* pAction);
+ void PixelHandler(const MetaPixelAction* pAction);
+ void PointHandler(const MetaPointAction* pAction);
+ void LineHandler(const MetaLineAction* pAction);
+ void RectHandler(const MetaRectAction* pAction);
+ void RoundRectHandler(const MetaRoundRectAction* pAction);
+ void EllipseHandler(const MetaEllipseAction* pAction);
+ void ArcHandler(const MetaArcAction* pAction);
+ void PieHandler(const MetaPieAction* pAction);
+ void ChordHandler(const MetaChordAction* pAction);
+ void PolyLineHandler(const MetaPolyLineAction* pAction);
+ void PolygonHandler(const MetaPolygonAction* pAction);
+ void PolyPolygonHandler(const MetaPolyPolygonAction* pAction);
+ void TextHandler(const MetaTextAction* pAction, const ImplMetaWriteData* pData);
+ void TextArrayHandler(const MetaTextArrayAction* pAction, const ImplMetaWriteData* pData);
+ void StretchTextHandler(const MetaStretchTextAction* pAction, const ImplMetaWriteData* pData);
+ void TextRectHandler(const MetaTextRectAction* pAction, const ImplMetaWriteData* pData);
+ void TextLineHandler(const MetaTextLineAction* pAction);
+ void BmpHandler(const MetaBmpAction* pAction);
+ void BmpScaleHandler(const MetaBmpScaleAction* pAction);
+ void BmpScalePartHandler(const MetaBmpScalePartAction* pAction);
+ void BmpExHandler(const MetaBmpExAction* pAction);
+ void BmpExScaleHandler(const MetaBmpExScaleAction* pAction);
+ void BmpExScalePartHandler(const MetaBmpExScalePartAction* pAction);
+ void MaskHandler(const MetaMaskAction* pAction);
+ void MaskScaleHandler(const MetaMaskScaleAction* pAction);
+ void MaskScalePartHandler(const MetaMaskScalePartAction* pAction);
+ void GradientHandler(const MetaGradientAction* pAction);
+ void GradientExHandler(const MetaGradientExAction* pAction);
+ void HatchHandler(const MetaHatchAction* pAction);
+ void WallpaperHandler(const MetaWallpaperAction* pAction);
+ void ClipRegionHandler(const MetaClipRegionAction* pAction);
+ void ISectRectClipRegionHandler(const MetaISectRectClipRegionAction* pAction);
+ void ISectRegionClipRegionHandler(const MetaISectRegionClipRegionAction* pAction);
+ void MoveClipRegionHandler(const MetaMoveClipRegionAction* pAction);
+ void LineColorHandler(const MetaLineColorAction* pAction);
+ void FillColorHandler(const MetaFillColorAction* pAction);
+ void TextColorHandler(const MetaTextColorAction* pAction);
+ void TextFillColorHandler(const MetaTextFillColorAction* pAction);
+ void TextLineColorHandler(const MetaTextLineColorAction* pAction);
+ void OverlineColorHandler(const MetaOverlineColorAction* pAction);
+ void TextAlignHandler(const MetaTextAlignAction* pAction);
+ void MapModeHandler(const MetaMapModeAction* pAction);
+ void FontHandler(const MetaFontAction* pAction, ImplMetaWriteData* pData);
+ void PushHandler(const MetaPushAction* pAction);
+ void PopHandler(const MetaPopAction* pAction);
+ void RasterOpHandler(const MetaRasterOpAction* pAction);
+ void TransparentHandler(const MetaTransparentAction* pAction);
+ void FloatTransparentHandler(const MetaFloatTransparentAction* pAction);
+ void EPSHandler(const MetaEPSAction* pAction);
+ void RefPointHandler(const MetaRefPointAction* pAction);
+ void CommentHandler(const MetaCommentAction* pAction);
+ void LayoutModeHandler(const MetaLayoutModeAction* pAction);
+ void TextLanguageHandler(const MetaTextLanguageAction* pAction);
+};
diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx
new file mode 100644
index 000000000..fbe0be89c
--- /dev/null
+++ b/include/vcl/filter/pdfdocument.hxx
@@ -0,0 +1,645 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_FILTER_PDFDOCUMENT_HXX
+#define INCLUDED_VCL_FILTER_PDFDOCUMENT_HXX
+
+#include <memory>
+#include <map>
+#include <vector>
+
+#include <tools/stream.hxx>
+#include <vcl/dllapi.h>
+#include <rtl/strbuf.hxx>
+
+#include <vcl/filter/pdfobjectcontainer.hxx>
+
+namespace com::sun::star::security
+{
+class XCertificate;
+}
+
+namespace com::sun::star::uno
+{
+template <class interface_type> class Reference;
+}
+
+namespace tools
+{
+class Rectangle;
+}
+
+namespace vcl::filter
+{
+class PDFTrailerElement;
+class PDFReferenceElement;
+class PDFDocument;
+class PDFDictionaryElement;
+class PDFArrayElement;
+class PDFStreamElement;
+class PDFNumberElement;
+
+/// A byte range in a PDF file.
+class VCL_DLLPUBLIC PDFElement
+{
+ bool m_bVisiting = false;
+ bool m_bParsing = false;
+
+public:
+ PDFElement() = default;
+ virtual bool Read(SvStream& rStream) = 0;
+ virtual ~PDFElement() = default;
+ void setVisiting(bool bVisiting) { m_bVisiting = bVisiting; }
+ bool alreadyVisiting() const { return m_bVisiting; }
+ void setParsing(bool bParsing) { m_bParsing = bParsing; }
+ bool alreadyParsing() const { return m_bParsing; }
+
+ virtual void writeString(OStringBuffer& rBuffer) = 0;
+};
+
+/// Indirect object: something with a unique ID.
+class VCL_DLLPUBLIC PDFObjectElement final : public PDFElement
+{
+ /// The document owning this element.
+ PDFDocument& m_rDoc;
+ double m_fObjectValue;
+ double m_fGenerationValue;
+ /// If set, the object contains this number element (outside any dictionary/array).
+ PDFNumberElement* m_pNumberElement;
+ /// Position after the '<<' token.
+ sal_uInt64 m_nDictionaryOffset;
+ /// Length of the dictionary buffer till (before) the '>>' token.
+ sal_uInt64 m_nDictionaryLength;
+ PDFDictionaryElement* m_pDictionaryElement;
+ /// Position after the '[' token, if m_pArrayElement is set.
+ sal_uInt64 m_nArrayOffset;
+ /// Length of the array buffer till (before) the ']' token.
+ sal_uInt64 m_nArrayLength;
+ /// The contained direct array, if any.
+ PDFArrayElement* m_pArrayElement;
+ /// The stream of this object, used when this is an object stream.
+ PDFStreamElement* m_pStreamElement;
+ /// Objects of an object stream.
+ std::vector<std::unique_ptr<PDFObjectElement>> m_aStoredElements;
+ /// Elements of an object in an object stream.
+ std::vector<std::unique_ptr<PDFElement>> m_aElements;
+ /// Uncompressed buffer of an object in an object stream.
+ std::unique_ptr<SvMemoryStream> m_pStreamBuffer;
+ /// List of all reference elements inside this object's dictionary and
+ /// nested dictionaries.
+ std::vector<PDFReferenceElement*> m_aDictionaryReferences;
+
+ bool m_bParsed;
+
+ void parseIfNecessary();
+
+public:
+ PDFObjectElement(PDFDocument& rDoc, double fObjectValue, double fGenerationValue);
+ bool Read(SvStream& rStream) override;
+ PDFElement* Lookup(const OString& rDictionaryKey);
+ PDFObjectElement* LookupObject(const OString& rDictionaryKey);
+ double GetObjectValue() const;
+ void SetDictionaryOffset(sal_uInt64 nDictionaryOffset);
+ sal_uInt64 GetDictionaryOffset();
+ void SetDictionaryLength(sal_uInt64 nDictionaryLength);
+ sal_uInt64 GetDictionaryLength();
+ PDFDictionaryElement* GetDictionary();
+ void SetDictionary(PDFDictionaryElement* pDictionaryElement);
+ void SetNumberElement(PDFNumberElement* pNumberElement);
+ PDFNumberElement* GetNumberElement() const;
+ /// Get access to the parsed key-value items from the object dictionary.
+ const std::map<OString, PDFElement*>& GetDictionaryItems();
+ const std::vector<PDFReferenceElement*>& GetDictionaryReferences() const;
+ void AddDictionaryReference(PDFReferenceElement* pReference);
+ void SetArray(PDFArrayElement* pArrayElement);
+ void SetStream(PDFStreamElement* pStreamElement);
+ /// Access to the stream of the object, if it has any.
+ PDFStreamElement* GetStream() const;
+ void SetArrayOffset(sal_uInt64 nArrayOffset);
+ sal_uInt64 GetArrayOffset() const;
+ void SetArrayLength(sal_uInt64 nArrayLength);
+ sal_uInt64 GetArrayLength() const;
+ PDFArrayElement* GetArray();
+ /// Parse objects stored in this object stream.
+ void ParseStoredObjects();
+ std::vector<std::unique_ptr<PDFElement>>& GetStoredElements();
+ SvMemoryStream* GetStreamBuffer() const;
+ void SetStreamBuffer(std::unique_ptr<SvMemoryStream>& pStreamBuffer);
+ PDFDocument& GetDocument();
+
+ void writeString(OStringBuffer& /*rBuffer*/) override { assert(false && "not implemented"); }
+};
+
+/// Array object: a list.
+class VCL_DLLPUBLIC PDFArrayElement final : public PDFElement
+{
+ std::vector<PDFElement*> m_aElements;
+ /// The object that contains this array.
+ PDFObjectElement* m_pObject;
+
+public:
+ PDFArrayElement(PDFObjectElement* pObject);
+ bool Read(SvStream& rStream) override;
+ void PushBack(PDFElement* pElement);
+ const std::vector<PDFElement*>& GetElements() const;
+ PDFElement* GetElement(size_t nIndex) const { return m_aElements[nIndex]; }
+
+ void writeString(OStringBuffer& rBuffer) override
+ {
+ rBuffer.append("[ ");
+ for (auto& rElement : m_aElements)
+ {
+ rElement->writeString(rBuffer);
+ rBuffer.append(" ");
+ }
+ rBuffer.append("]");
+ }
+};
+
+/// Reference object: something with a unique ID.
+class VCL_DLLPUBLIC PDFReferenceElement final : public PDFElement
+{
+ PDFDocument& m_rDoc;
+ int m_fObjectValue;
+ int m_fGenerationValue;
+ /// Location after the 'R' token.
+ sal_uInt64 m_nOffset = 0;
+ /// The element providing the object number.
+ PDFNumberElement& m_rObject;
+
+public:
+ PDFReferenceElement(PDFDocument& rDoc, PDFNumberElement& rObject,
+ PDFNumberElement const& rGeneration);
+ bool Read(SvStream& rStream) override;
+ /// Assuming the reference points to a number object, return its value.
+ double LookupNumber(SvStream& rStream) const;
+ /// Lookup referenced object, without assuming anything about its contents.
+ PDFObjectElement* LookupObject();
+ int GetObjectValue() const;
+ int GetGenerationValue() const;
+ sal_uInt64 GetOffset() const;
+ PDFNumberElement& GetObjectElement() const;
+
+ void writeString(OStringBuffer& rBuffer) override
+ {
+ rBuffer.append(sal_Int32(GetObjectValue()));
+ rBuffer.append(' ');
+ rBuffer.append(sal_Int32(GetGenerationValue()));
+ rBuffer.append(" R");
+ }
+};
+
+/// Stream object: a byte array with a known length.
+class VCL_DLLPUBLIC PDFStreamElement final : public PDFElement
+{
+ size_t m_nLength;
+ sal_uInt64 m_nOffset;
+ /// The byte array itself.
+ SvMemoryStream m_aMemory;
+
+public:
+ explicit PDFStreamElement(size_t nLength);
+ bool Read(SvStream& rStream) override;
+ sal_uInt64 GetOffset() const;
+ SvMemoryStream& GetMemory();
+
+ void writeString(OStringBuffer& rBuffer) override
+ {
+ rBuffer.append("stream\n");
+ rBuffer.append(static_cast<const char*>(m_aMemory.GetData()), m_aMemory.GetSize());
+ rBuffer.append("\nendstream\n");
+ }
+};
+
+/// Name object: a key string.
+class VCL_DLLPUBLIC PDFNameElement final : public PDFElement
+{
+ OString m_aValue;
+ /// Offset after the '/' token.
+ sal_uInt64 m_nLocation = 0;
+
+public:
+ PDFNameElement();
+ bool Read(SvStream& rStream) override;
+ void SetValue(const OString& rValue) { m_aValue = rValue; }
+ const OString& GetValue() const;
+ sal_uInt64 GetLocation() const;
+ sal_uInt64 GetLength() const { return m_aValue.getLength(); }
+
+ void writeString(OStringBuffer& rBuffer) override
+ {
+ rBuffer.append("/");
+ rBuffer.append(m_aValue);
+ }
+};
+
+/// Dictionary object: a set key-value pairs.
+class VCL_DLLPUBLIC PDFDictionaryElement final : public PDFElement
+{
+ /// Key-value pairs when the dictionary is a nested value.
+ std::map<OString, PDFElement*> m_aItems;
+ /// Offset after the '<<' token.
+ sal_uInt64 m_nLocation = 0;
+ /// Position after the '/' token.
+ std::map<OString, sal_uInt64> m_aDictionaryKeyOffset;
+ /// Length of the dictionary key and value, till (before) the next token.
+ std::map<OString, sal_uInt64> m_aDictionaryKeyValueLength;
+
+public:
+ PDFDictionaryElement();
+ bool Read(SvStream& rStream) override;
+
+ static PDFElement* Lookup(const std::map<OString, PDFElement*>& rDictionary,
+ const OString& rKey);
+ void SetKeyOffset(const OString& rKey, sal_uInt64 nOffset);
+ sal_uInt64 GetKeyOffset(const OString& rKey) const;
+ void SetKeyValueLength(const OString& rKey, sal_uInt64 nLength);
+ sal_uInt64 GetKeyValueLength(const OString& rKey) const;
+ const std::map<OString, PDFElement*>& GetItems() const;
+ /// Looks up an object which is only referenced in this dictionary.
+ PDFObjectElement* LookupObject(const OString& rDictionaryKey);
+ /// Looks up an element which is contained in this dictionary.
+ PDFElement* LookupElement(const OString& rDictionaryKey);
+ sal_uInt64 GetLocation() const { return m_nLocation; }
+ void insert(OString const& rKey, PDFElement* pPDFElement)
+ {
+ m_aItems.emplace(rKey, pPDFElement);
+ }
+
+ void writeString(OStringBuffer& rBuffer) override
+ {
+ rBuffer.append("<< ");
+ for (auto& rPair : m_aItems)
+ {
+ rBuffer.append("/");
+ rBuffer.append(rPair.first);
+ rBuffer.append(" ");
+ rPair.second->writeString(rBuffer);
+ rBuffer.append(" ");
+ }
+ rBuffer.append(">>");
+ }
+};
+
+enum class TokenizeMode
+{
+ /// Full file.
+ END_OF_STREAM,
+ /// Till the first %%EOF token.
+ EOF_TOKEN,
+ /// Till the end of the current object.
+ END_OF_OBJECT,
+ /// Same as END_OF_OBJECT, but for object streams (no endobj keyword).
+ STORED_OBJECT
+};
+
+/// The type column of an entry in a cross-reference stream.
+enum class XRefEntryType
+{
+ /// xref "f" or xref stream "0".
+ FREE,
+ /// xref "n" or xref stream "1".
+ NOT_COMPRESSED,
+ /// xref stream "2".
+ COMPRESSED
+};
+
+/// An entry in a cross-reference stream.
+class XRefEntry
+{
+ XRefEntryType m_eType = XRefEntryType::NOT_COMPRESSED;
+ /**
+ * Non-compressed: The byte offset of the object, starting from the
+ * beginning of the file.
+ * Compressed: The object number of the object stream in which this object is
+ * stored.
+ */
+ sal_uInt64 m_nOffset = 0;
+ /// Are changed as part of an incremental update?.
+ bool m_bDirty = false;
+
+public:
+ XRefEntry();
+
+ void SetType(XRefEntryType eType) { m_eType = eType; }
+
+ XRefEntryType GetType() const { return m_eType; }
+
+ void SetOffset(sal_uInt64 nOffset) { m_nOffset = nOffset; }
+
+ sal_uInt64 GetOffset() const { return m_nOffset; }
+
+ void SetDirty(bool bDirty) { m_bDirty = bDirty; }
+
+ bool GetDirty() const { return m_bDirty; }
+};
+
+/// Hex string: in <AABB> form.
+class VCL_DLLPUBLIC PDFHexStringElement final : public PDFElement
+{
+ OString m_aValue;
+
+public:
+ bool Read(SvStream& rStream) override;
+ const OString& GetValue() const;
+
+ void writeString(OStringBuffer& rBuffer) override
+ {
+ rBuffer.append("<");
+ rBuffer.append(m_aValue);
+ rBuffer.append(">");
+ }
+};
+
+/// Literal string: in (asdf) form.
+class VCL_DLLPUBLIC PDFLiteralStringElement final : public PDFElement
+{
+ OString m_aValue;
+
+public:
+ bool Read(SvStream& rStream) override;
+ const OString& GetValue() const;
+
+ void writeString(OStringBuffer& rBuffer) override
+ {
+ rBuffer.append("(");
+ rBuffer.append(m_aValue);
+ rBuffer.append(")");
+ }
+};
+
+/// Numbering object: an integer or a real.
+class VCL_DLLPUBLIC PDFNumberElement final : public PDFElement
+{
+ /// Input file start location.
+ sal_uInt64 m_nOffset = 0;
+ /// Input file token length.
+ sal_uInt64 m_nLength = 0;
+ double m_fValue = 0;
+
+public:
+ PDFNumberElement();
+ bool Read(SvStream& rStream) override;
+ double GetValue() const;
+ void SetValue(double fValue) { m_fValue = fValue; }
+
+ sal_uInt64 GetLocation() const;
+ sal_uInt64 GetLength() const;
+
+ void writeString(OStringBuffer& rBuffer) override { rBuffer.append(m_fValue); }
+};
+
+/// A one-liner comment.
+class VCL_DLLPUBLIC PDFCommentElement final : public PDFElement
+{
+ PDFDocument& m_rDoc;
+ OString m_aComment;
+
+public:
+ explicit PDFCommentElement(PDFDocument& rDoc);
+ bool Read(SvStream& rStream) override;
+ void writeString(OStringBuffer& /*rBuffer*/) override {}
+};
+
+/// End of a dictionary: '>>'.
+class VCL_DLLPUBLIC PDFEndDictionaryElement final : public PDFElement
+{
+ /// Offset before the '>>' token.
+ sal_uInt64 m_nLocation = 0;
+
+public:
+ PDFEndDictionaryElement();
+ bool Read(SvStream& rStream) override;
+ sal_uInt64 GetLocation() const;
+
+ void writeString(OStringBuffer& /*rBuffer*/) override {}
+};
+
+/// End of a stream: 'endstream' keyword.
+class VCL_DLLPUBLIC PDFEndStreamElement final : public PDFElement
+{
+public:
+ bool Read(SvStream& rStream) override;
+
+ void writeString(OStringBuffer& /*rBuffer*/) override {}
+};
+
+/// End of an object: 'endobj' keyword.
+class VCL_DLLPUBLIC PDFEndObjectElement final : public PDFElement
+{
+public:
+ bool Read(SvStream& rStream) override;
+
+ void writeString(OStringBuffer& /*rBuffer*/) override {}
+};
+
+/// End of an array: ']'.
+class VCL_DLLPUBLIC PDFEndArrayElement final : public PDFElement
+{
+ /// Location before the ']' token.
+ sal_uInt64 m_nOffset = 0;
+
+public:
+ PDFEndArrayElement();
+ bool Read(SvStream& rStream) override;
+ sal_uInt64 GetOffset() const;
+
+ void writeString(OStringBuffer& /*rBuffer*/) override {}
+};
+
+/// Boolean object: a 'true' or a 'false'.
+class VCL_DLLPUBLIC PDFBooleanElement final : public PDFElement
+{
+ bool m_aValue;
+
+public:
+ explicit PDFBooleanElement(bool bValue)
+ : m_aValue(bValue)
+ {
+ }
+
+ bool Read(SvStream& rStream) override;
+
+ void writeString(OStringBuffer& rBuffer) override
+ {
+ rBuffer.append(m_aValue ? "true" : "false");
+ }
+};
+
+/// Null object: the 'null' singleton.
+class VCL_DLLPUBLIC PDFNullElement final : public PDFElement
+{
+public:
+ bool Read(SvStream& rStream) override;
+
+ void writeString(OStringBuffer& rBuffer) override { rBuffer.append("null"); }
+};
+
+/**
+ * In-memory representation of an on-disk PDF document.
+ *
+ * The PDF element list is not meant to be saved back to disk, but some
+ * elements remember their source offset / length, and based on that it's
+ * possible to modify the input file.
+ */
+class VCL_DLLPUBLIC PDFDocument final : public PDFObjectContainer
+{
+ /// This vector owns all elements.
+ std::vector<std::unique_ptr<PDFElement>> m_aElements;
+ /// Object ID <-> object offset map.
+ std::map<size_t, XRefEntry> m_aXRef;
+ /// Object offset <-> Object pointer map.
+ std::map<size_t, PDFObjectElement*> m_aOffsetObjects;
+ /// Object ID <-> Object pointer map.
+ std::map<size_t, PDFObjectElement*> m_aIDObjects;
+ /// List of xref offsets we know.
+ std::vector<size_t> m_aStartXRefs;
+ /// Offsets of trailers, from latest to oldest.
+ std::vector<size_t> m_aTrailerOffsets;
+ /// Trailer offset <-> Trailer pointer map.
+ std::map<size_t, PDFTrailerElement*> m_aOffsetTrailers;
+ /// List of EOF offsets we know.
+ std::vector<size_t> m_aEOFs;
+ PDFTrailerElement* m_pTrailer = nullptr;
+ /// When m_pTrailer is nullptr, this can still have a dictionary.
+ PDFObjectElement* m_pXRefStream = nullptr;
+ /// All editing takes place in this buffer, if it happens.
+ SvMemoryStream m_aEditBuffer;
+
+ /// Signature line in PDF format, to be consumed by the next Sign() invocation.
+ std::vector<sal_Int8> m_aSignatureLine;
+
+ /// 0-based page number where m_aSignatureLine should be placed.
+ size_t m_nSignaturePage = 0;
+
+ /// Suggest a minimal, yet free signature ID to use for the next signature.
+ sal_uInt32 GetNextSignature();
+ /// Write the signature object as part of signing.
+ sal_Int32 WriteSignatureObject(const OUString& rDescription, bool bAdES,
+ sal_uInt64& rLastByteRangeOffset, sal_Int64& rContentOffset);
+ /// Write the appearance object as part of signing.
+ sal_Int32 WriteAppearanceObject(tools::Rectangle& rSignatureRectangle);
+ /// Write the annot object as part of signing.
+ sal_Int32 WriteAnnotObject(PDFObjectElement const& rFirstPage, sal_Int32 nSignatureId,
+ sal_Int32 nAppearanceId,
+ const tools::Rectangle& rSignatureRectangle);
+ /// Write the updated Page object as part of signing.
+ bool WritePageObject(PDFObjectElement& rFirstPage, sal_Int32 nAnnotId);
+ /// Write the updated Catalog object as part of signing.
+ bool WriteCatalogObject(sal_Int32 nAnnotId, PDFReferenceElement*& pRoot);
+ /// Write the updated cross-references as part of signing.
+ void WriteXRef(sal_uInt64 nXRefOffset, PDFReferenceElement const* pRoot);
+
+public:
+ PDFDocument();
+ virtual ~PDFDocument();
+ PDFDocument& operator=(const PDFDocument&) = delete;
+ PDFDocument(const PDFDocument&) = delete;
+ /// @name Low-level functions, to be used by PDFElement subclasses.
+ //@{
+ /// Decode a hex dump.
+ static std::vector<unsigned char> DecodeHexString(PDFHexStringElement const* pElement);
+ static OUString DecodeHexStringUTF16BE(PDFHexStringElement const& rElement);
+ static OString ReadKeyword(SvStream& rStream);
+ static size_t FindStartXRef(SvStream& rStream);
+ void ReadXRef(SvStream& rStream);
+ void ReadXRefStream(SvStream& rStream);
+ static void SkipWhitespace(SvStream& rStream);
+ /// Instead of all whitespace, just skip CR and NL characters.
+ static void SkipLineBreaks(SvStream& rStream);
+ size_t GetObjectOffset(size_t nIndex) const;
+ const std::vector<std::unique_ptr<PDFElement>>& GetElements() const;
+ std::vector<PDFObjectElement*> GetPages();
+ PDFObjectElement* GetCatalog();
+ /// Remember the end location of an EOF token.
+ void PushBackEOF(size_t nOffset);
+ /// Look up object based on object number, possibly by parsing object streams.
+ PDFObjectElement* LookupObject(size_t nObjectNumber);
+ /// Access to the input document, even after the input stream is gone.
+ SvMemoryStream& GetEditBuffer();
+ /// Tokenize elements from current offset.
+ bool Tokenize(SvStream& rStream, TokenizeMode eMode,
+ std::vector<std::unique_ptr<PDFElement>>& rElements,
+ PDFObjectElement* pObjectElement);
+ /// Register an object (owned directly or indirectly by m_aElements) as a provider for a given ID.
+ void SetIDObject(size_t nID, PDFObjectElement* pObject);
+ //@}
+
+ /// @name High-level functions, to be used by others.
+ //@{
+ /// Read elements from the start of the stream till its end.
+ bool Read(SvStream& rStream);
+ /// Calls Read() first and if it fails it tries to fixup and then retry.
+ bool ReadWithPossibleFixup(SvStream& rStream);
+ void SetSignatureLine(std::vector<sal_Int8>&& rSignatureLine);
+ void SetSignaturePage(size_t nPage);
+ /// Sign the read document with xCertificate in the edit buffer.
+ bool Sign(const css::uno::Reference<css::security::XCertificate>& xCertificate,
+ const OUString& rDescription, bool bAdES);
+ /// Serializes the contents of the edit buffer.
+ bool Write(SvStream& rStream);
+ /// Get a list of signatures embedded into this document.
+ std::vector<PDFObjectElement*> GetSignatureWidgets();
+ /// Remove the nth signature from read document in the edit buffer.
+ bool RemoveSignature(size_t nPosition);
+ //@}
+
+ /// See vcl::PDFObjectContainer::createObject().
+ sal_Int32 createObject() override;
+ /// See vcl::PDFObjectContainer::updateObject().
+ bool updateObject(sal_Int32 n) override;
+ /// See vcl::PDFObjectContainer::writeBuffer().
+ bool writeBuffer(const void* pBuffer, sal_uInt64 nBytes) override;
+ void checkAndEnableStreamEncryption(sal_Int32 /*nObject*/) override {}
+ void disableStreamEncryption() override {}
+};
+
+/// The trailer singleton is at the end of the doc.
+class VCL_DLLPUBLIC PDFTrailerElement final : public PDFElement
+{
+ PDFDocument& m_rDoc;
+ PDFDictionaryElement* m_pDictionaryElement;
+ /// Location of the end of the trailer token.
+ sal_uInt64 m_nOffset = 0;
+
+public:
+ explicit PDFTrailerElement(PDFDocument& rDoc);
+ bool Read(SvStream& rStream) override;
+ PDFElement* Lookup(const OString& rDictionaryKey);
+ sal_uInt64 GetLocation() const;
+
+ void SetDictionary(PDFDictionaryElement* pDictionaryElement)
+ {
+ m_pDictionaryElement = pDictionaryElement;
+ }
+
+ PDFDictionaryElement* GetDictionary() { return m_pDictionaryElement; }
+
+ void writeString(OStringBuffer& /*rBuffer*/) override { assert(false && "not implemented"); }
+};
+
+class VCL_DLLPUBLIC PDFObjectParser final
+{
+ const std::vector<std::unique_ptr<PDFElement>>& mrElements;
+
+public:
+ PDFObjectParser(std::vector<std::unique_ptr<PDFElement>> const& rElements)
+ : mrElements(rElements)
+ {
+ }
+
+ size_t parse(PDFElement* pParsingElement, size_t nStartIndex = 0, int nCurrentDepth = 0);
+};
+
+} // namespace vcl::filter
+
+#endif // INCLUDED_VCL_FILTER_PDFDOCUMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/filter/pdfobjectcontainer.hxx b/include/vcl/filter/pdfobjectcontainer.hxx
new file mode 100644
index 000000000..f6614f09e
--- /dev/null
+++ b/include/vcl/filter/pdfobjectcontainer.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/types.h>
+
+namespace vcl
+{
+/// Allows creating, updating and writing PDF objects in a container.
+class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI PDFObjectContainer
+{
+public:
+ /* adds an entry to m_aObjects and returns its index+1,
+ * sets the offset to ~0
+ */
+ virtual sal_Int32 createObject() = 0;
+ /* sets the offset of object n to the current position of output file+1
+ */
+ virtual bool updateObject(sal_Int32 n) = 0;
+
+ // Write pBuffer to the end of the output.
+ virtual bool writeBuffer(const void* pBuffer, sal_uInt64 nBytes) = 0;
+
+ virtual void checkAndEnableStreamEncryption(sal_Int32 nObject) = 0;
+
+ virtual void disableStreamEncryption() = 0;
+
+protected:
+ ~PDFObjectContainer() noexcept = default;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/fntstyle.hxx b/include/vcl/fntstyle.hxx
new file mode 100644
index 000000000..03814c262
--- /dev/null
+++ b/include/vcl/fntstyle.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_FNTSTYLE_HXX
+#define INCLUDED_VCL_FNTSTYLE_HXX
+
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+
+enum class FontRelief { NONE, Embossed, Engraved, FontRelief_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
+
+enum class FontKerning
+{
+ NONE = 0x00,
+ FontSpecific = 0x01,
+ Asian = 0x02,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<FontKerning> : is_typed_flags<FontKerning, 0x03> {};
+}
+
+#endif // INCLUDED_VCL_FNTSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
new file mode 100644
index 000000000..9f910688d
--- /dev/null
+++ b/include/vcl/font.hxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_FONT_HXX
+#define INCLUDED_VCL_FONT_HXX
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vcl/dllapi.h>
+#include <tools/color.hxx>
+#include <tools/fontenum.hxx>
+#include <tools/long.hxx>
+#include <tools/degree.hxx>
+#include <i18nlangtag/lang.h>
+#include <vcl/fntstyle.hxx>
+#include <o3tl/cow_wrapper.hxx>
+
+class Size;
+class LanguageTag;
+class SvStream;
+
+class ImplFont;
+class FontAttributes;
+namespace vcl { class Font; }
+// need to first declare these outside the vcl namespace, or the friend declarations won't work right
+VCL_DLLPUBLIC SvStream& ReadFont( SvStream& rIStm, vcl::Font& );
+VCL_DLLPUBLIC SvStream& WriteFont( SvStream& rOStm, const vcl::Font& );
+
+namespace vcl {
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC Font
+{
+public:
+ explicit Font();
+ Font( const Font& ); // TODO make me explicit
+ Font( Font&& ) noexcept;
+ explicit Font( const OUString& rFamilyName, const Size& );
+ explicit Font( const OUString& rFamilyName, const OUString& rStyleName, const Size& );
+ explicit Font( FontFamily eFamily, const Size& );
+ virtual ~Font();
+
+ const OUString& GetFamilyName() const;
+ FontFamily GetFamilyType();
+ FontFamily GetFamilyType() const;
+ const OUString& GetStyleName() const;
+
+ FontWeight GetWeight();
+ FontWeight GetWeight() const;
+ FontItalic GetItalic();
+ FontItalic GetItalic() const;
+ FontPitch GetPitch();
+ FontPitch GetPitch() const;
+ FontWidth GetWidthType();
+ FontWidth GetWidthType() const;
+ TextAlign GetAlignment() const;
+ rtl_TextEncoding GetCharSet() const;
+
+ bool IsSymbolFont() const;
+
+ void SetFamilyName( const OUString& rFamilyName );
+ void SetStyleName( const OUString& rStyleName );
+ void SetFamily( FontFamily );
+
+ void SetPitch( FontPitch ePitch );
+ void SetItalic( FontItalic );
+ void SetWeight( FontWeight );
+ void SetWidthType( FontWidth );
+ void SetAlignment( TextAlign );
+ void SetCharSet( rtl_TextEncoding );
+
+ void SetSymbolFlag( bool );
+
+ // Device dependent functions
+ int GetQuality() const;
+
+ void SetQuality(int);
+ void IncreaseQualityBy(int);
+ void DecreaseQualityBy(int);
+
+ // setting the color on the font is obsolete, the only remaining
+ // valid use is for keeping backward compatibility with old MetaFiles
+ const Color& GetColor() const;
+ const Color& GetFillColor() const;
+
+ bool IsTransparent() const;
+
+ void SetColor( const Color& );
+ void SetFillColor( const Color& );
+
+ void SetTransparent( bool bTransparent );
+
+ void SetFontSize( const Size& );
+ const Size& GetFontSize() const;
+ void SetFontHeight( tools::Long nHeight );
+ tools::Long GetFontHeight() const;
+ void SetAverageFontWidth( tools::Long nWidth );
+ tools::Long GetAverageFontWidth() const;
+
+ // tdf#127471 for corrections on EMF/WMF we need the AvgFontWidth in Windows-specific notation
+ tools::Long GetOrCalculateAverageFontWidth() const;
+
+ // Prefer LanguageTag over LanguageType
+ void SetLanguageTag( const LanguageTag & );
+ const LanguageTag& GetLanguageTag() const;
+ void SetCJKContextLanguageTag( const LanguageTag& );
+ const LanguageTag& GetCJKContextLanguageTag() const;
+ void SetLanguage( LanguageType );
+ LanguageType GetLanguage() const;
+ void SetCJKContextLanguage( LanguageType );
+ LanguageType GetCJKContextLanguage() const;
+
+ void SetOrientation( Degree10 nLineOrientation );
+ Degree10 GetOrientation() const;
+ void SetVertical( bool bVertical );
+ bool IsVertical() const;
+ void SetKerning( FontKerning nKerning );
+ FontKerning GetKerning() const;
+ bool IsKerning() const;
+
+ void SetOutline( bool bOutline );
+ bool IsOutline() const;
+ void SetShadow( bool bShadow );
+ bool IsShadow() const;
+ void SetRelief( FontRelief );
+ FontRelief GetRelief() const;
+ void SetUnderline( FontLineStyle );
+ FontLineStyle GetUnderline() const;
+ void SetOverline( FontLineStyle );
+ FontLineStyle GetOverline() const;
+ void SetStrikeout( FontStrikeout );
+ FontStrikeout GetStrikeout() const;
+ void SetEmphasisMark( FontEmphasisMark );
+ FontEmphasisMark GetEmphasisMark() const;
+ void SetWordLineMode( bool bWordLine );
+ bool IsWordLineMode() const;
+
+ void Merge( const Font& rFont );
+ void GetFontAttributes( FontAttributes& rAttrs ) const;
+
+ Font& operator=( const Font& );
+ Font& operator=( Font&& ) noexcept;
+ bool operator==( const Font& ) const;
+ bool operator!=( const Font& rFont ) const
+ { return !(Font::operator==( rFont )); }
+ bool IsSameInstance( const Font& ) const;
+ bool EqualIgnoreColor( const Font& ) const;
+
+ // Compute value usable as hash.
+ size_t GetHashValue() const;
+ size_t GetHashValueIgnoreColor() const;
+
+ friend VCL_DLLPUBLIC SvStream& ::ReadFont( SvStream& rIStm, vcl::Font& );
+ friend VCL_DLLPUBLIC SvStream& ::WriteFont( SvStream& rOStm, const vcl::Font& );
+
+ static Font identifyFont( const void* pBuffer, sal_uInt32 nLen );
+
+ typedef o3tl::cow_wrapper< ImplFont > ImplType;
+
+ inline bool IsUnderlineAbove() const;
+
+private:
+ ImplType mpImplFont;
+};
+
+inline bool Font::IsUnderlineAbove() const
+{
+ if (!IsVertical())
+ return false;
+ // the underline is right for Japanese only
+ return (LANGUAGE_JAPANESE == GetLanguage()) ||
+ (LANGUAGE_JAPANESE == GetCJKContextLanguage());
+}
+
+}
+
+#endif // _VCL_FONT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/font/Feature.hxx b/include/vcl/font/Feature.hxx
new file mode 100644
index 000000000..3026f105f
--- /dev/null
+++ b/include/vcl/font/Feature.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_FONT_FEATURE_HXX
+#define INCLUDED_VCL_FONT_FEATURE_HXX
+
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <unotools/resmgr.hxx>
+#include <vector>
+
+namespace vcl::font
+{
+constexpr uint32_t featureCode(const char sFeature[4])
+{
+ return static_cast<uint32_t>(sFeature[0]) << 24U | static_cast<uint32_t>(sFeature[1]) << 16U
+ | static_cast<uint32_t>(sFeature[2]) << 8U | static_cast<uint32_t>(sFeature[3]);
+}
+
+VCL_DLLPUBLIC OUString featureCodeAsString(uint32_t nFeature);
+
+enum class FeatureParameterType
+{
+ BOOL,
+ ENUM
+};
+
+enum class FeatureType
+{
+ OpenType,
+ Graphite
+};
+
+struct VCL_DLLPUBLIC FeatureParameter
+{
+private:
+ uint32_t m_nCode;
+ OUString m_sDescription;
+ TranslateId m_pDescriptionID;
+
+public:
+ FeatureParameter(uint32_t nCode, OUString aDescription);
+ FeatureParameter(uint32_t nCode, TranslateId pDescriptionID);
+
+ uint32_t getCode() const;
+ OUString getDescription() const;
+};
+
+class VCL_DLLPUBLIC FeatureDefinition
+{
+private:
+ OUString m_sDescription;
+ TranslateId m_pDescriptionID;
+ OUString m_sNumericPart;
+ uint32_t m_nCode;
+ uint32_t m_nDefault;
+ FeatureParameterType m_eType;
+ // the index of the parameter defines the enum value, string is the description
+ std::vector<FeatureParameter> m_aEnumParameters;
+
+public:
+ FeatureDefinition();
+ FeatureDefinition(uint32_t nCode, OUString const& rDescription,
+ FeatureParameterType eType = FeatureParameterType::BOOL,
+ std::vector<FeatureParameter>&& rEnumParameters
+ = std::vector<FeatureParameter>{},
+ uint32_t nDefault = 0);
+ FeatureDefinition(uint32_t nCode, TranslateId pDescriptionID,
+ OUString const& rNumericPart = OUString());
+ FeatureDefinition(uint32_t nCode, TranslateId pDescriptionID,
+ std::vector<FeatureParameter> aEnumParameters);
+
+ const std::vector<FeatureParameter>& getEnumParameters() const;
+ uint32_t getCode() const;
+ OUString getDescription() const;
+ FeatureParameterType getType() const;
+ uint32_t getDefault() const;
+
+ operator bool() const;
+};
+
+struct VCL_DLLPUBLIC FeatureID
+{
+ uint32_t m_aFeatureCode;
+ uint32_t m_aScriptCode;
+ uint32_t m_aLanguageCode;
+};
+
+struct Feature
+{
+ Feature();
+ Feature(FeatureID const& rID, FeatureType eType);
+
+ FeatureID m_aID;
+ FeatureType m_eType;
+ FeatureDefinition m_aDefinition;
+};
+
+// This is basically duplicates hb_feature_t to avoid including HarfBuzz
+// headers here, so the member types should remain compatible.
+struct FeatureSetting
+{
+ FeatureSetting(OString feature);
+
+ uint32_t m_nTag;
+ uint32_t m_nValue;
+ unsigned int m_nStart;
+ unsigned int m_nEnd;
+};
+
+} // namespace vcl::font
+
+#endif // INCLUDED_VCL_FONT_FEATURE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/font/FeatureParser.hxx b/include/vcl/font/FeatureParser.hxx
new file mode 100644
index 000000000..93fe6eabe
--- /dev/null
+++ b/include/vcl/font/FeatureParser.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_FONT_FEATUREPASER_HXX
+#define INCLUDED_VCL_FONT_FEATUREPASER_HXX
+
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <unordered_map>
+
+#include <vcl/font/Feature.hxx>
+
+namespace vcl::font
+{
+// These must not conflict with font name lists which use ; and ,
+constexpr const char FeaturePrefix = ':';
+constexpr const char FeatureSeparator = '&';
+
+VCL_DLLPUBLIC OUString trimFontNameFeatures(OUString const& rFontName);
+
+class VCL_DLLPUBLIC FeatureParser
+{
+private:
+ OUString m_sLanguage;
+ std::vector<FeatureSetting> m_aFeatures;
+
+public:
+ FeatureParser(std::u16string_view sFontName);
+
+ OUString const& getLanguage() const { return m_sLanguage; }
+
+ std::vector<FeatureSetting> const& getFeatures() const { return m_aFeatures; }
+
+ std::unordered_map<uint32_t, uint32_t> getFeaturesMap() const;
+};
+
+} // namespace vcl::font
+
+#endif // INCLUDED_VCL_FONT_FEATUREPASER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/fontcapabilities.hxx b/include/vcl/fontcapabilities.hxx
new file mode 100644
index 000000000..9698be7a5
--- /dev/null
+++ b/include/vcl/fontcapabilities.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_FONTCAPABILITIES_HXX
+#define INCLUDED_VCL_FONTCAPABILITIES_HXX
+
+#include <optional>
+#include <bitset>
+
+//See OS/2 table, i.e. http://www.microsoft.com/typography/otspec/os2.htm#ur
+namespace vcl
+{
+ namespace UnicodeCoverage
+ {
+ enum UnicodeCoverageEnum
+ {
+ BASIC_LATIN = 0,
+ LATIN_1_SUPPLEMENT = 1,
+ LATIN_EXTENDED_A = 2,
+ LATIN_EXTENDED_B = 3,
+ IPA_EXTENSIONS = 4,
+ SPACING_MODIFIER_LETTERS = 5,
+ COMBINING_DIACRITICAL_MARKS = 6,
+ GREEK_AND_COPTIC = 7,
+ COPTIC = 8,
+ CYRILLIC = 9,
+ ARMENIAN = 10,
+ HEBREW = 11,
+ VAI = 12,
+ ARABIC = 13,
+ NKO = 14,
+ DEVANAGARI = 15,
+ BENGALI = 16,
+ GURMUKHI = 17,
+ GUJARATI = 18,
+ ODIA = 19,
+ TAMIL = 20,
+ TELUGU = 21,
+ KANNADA = 22,
+ MALAYALAM = 23,
+ THAI = 24,
+ LAO = 25,
+ GEORGIAN = 26,
+ BALINESE = 27,
+ HANGUL_JAMO = 28,
+ LATIN_EXTENDED_ADDITIONAL = 29,
+ GREEK_EXTENDED = 30,
+ GENERAL_PUNCTUATION = 31,
+ SUPERSCRIPTS_AND_SUBSCRIPTS = 32,
+ CURRENCY_SYMBOLS = 33,
+ COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS = 34,
+ LETTERLIKE_SYMBOLS = 35,
+ NUMBER_FORMS = 36,
+ ARROWS = 37,
+ MATHEMATICAL_OPERATORS = 38,
+ MISCELLANEOUS_TECHNICAL = 39,
+ CONTROL_PICTURES = 40,
+ OPTICAL_CHARACTER_RECOGNITION = 41,
+ ENCLOSED_ALPHANUMERICS = 42,
+ BOX_DRAWING = 43,
+ BLOCK_ELEMENTS = 44,
+ GEOMETRIC_SHAPES = 45,
+ MISCELLANEOUS_SYMBOLS = 46,
+ DINGBATS = 47,
+ CJK_SYMBOLS_AND_PUNCTUATION = 48,
+ HIRAGANA = 49,
+ KATAKANA = 50,
+ BOPOMOFO = 51,
+ HANGUL_COMPATIBILITY_JAMO = 52,
+ PHAGS_PA = 53,
+ ENCLOSED_CJK_LETTERS_AND_MONTHS = 54,
+ CJK_COMPATIBILITY = 55,
+ HANGUL_SYLLABLES = 56,
+ NONPLANE_0 = 57,
+ PHOENICIAN = 58,
+ CJK_UNIFIED_IDEOGRAPHS = 59,
+ PRIVATE_USE_AREA_PLANE_0 = 60,
+ CJK_STROKES = 61,
+ ALPHABETIC_PRESENTATION_FORMS = 62,
+ ARABIC_PRESENTATION_FORMS_A = 63,
+ COMBINING_HALF_MARKS = 64,
+ VERTICAL_FORMS = 65,
+ SMALL_FORM_VARIANTS = 66,
+ ARABIC_PRESENTATION_FORMS_B = 67,
+ HALFWIDTH_AND_FULLWIDTH_FORMS = 68,
+ SPECIALS = 69,
+ TIBETAN = 70,
+ SYRIAC = 71,
+ THAANA = 72,
+ SINHALA = 73,
+ MYANMAR = 74,
+ ETHIOPIC = 75,
+ CHEROKEE = 76,
+ UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS = 77,
+ OGHAM = 78,
+ RUNIC = 79,
+ KHMER = 80,
+ MONGOLIAN = 81,
+ BRAILLE_PATTERNS = 82,
+ YI_SYLLABLES = 83,
+ TAGALOG = 84,
+ OLD_ITALIC = 85,
+ GOTHIC = 86,
+ DESERET = 87,
+ BYZANTINE_MUSICAL_SYMBOLS = 88,
+ MATHEMATICAL_ALPHANUMERIC_SYMBOLS = 89,
+ PRIVATE_USE_PLANE_15 = 90,
+ VARIATION_SELECTORS = 91,
+ TAGS = 92,
+ LIMBU = 93,
+ TAI_LE = 94,
+ NEW_TAI_LUE = 95,
+ BUGINESE = 96,
+ GLAGOLITIC = 97,
+ TIFINAGH = 98,
+ YIJING_HEXAGRAM_SYMBOLS = 99,
+ SYLOTI_NAGRI = 100,
+ LINEAR_B_SYLLABARY = 101,
+ ANCIENT_GREEK_NUMBERS = 102,
+ UGARITIC = 103,
+ OLD_PERSIAN = 104,
+ SHAVIAN = 105,
+ OSMANYA = 106,
+ CYPRIOT_SYLLABARY = 107,
+ KHAROSHTHI = 108,
+ TAI_XUAN_JING_SYMBOLS = 109,
+ CUNEIFORM = 110,
+ COUNTING_ROD_NUMERALS = 111,
+ SUNDANESE = 112,
+ LEPCHA = 113,
+ OL_CHIKI = 114,
+ SAURASHTRA = 115,
+ KAYAH_LI = 116,
+ REJANG = 117,
+ CHAM = 118,
+ ANCIENT_SYMBOLS = 119,
+ PHAISTOS_DISC = 120,
+ CARIAN = 121,
+ DOMINO_TILES = 122,
+ RESERVED1 = 123,
+ RESERVED2 = 124,
+ RESERVED3 = 125,
+ RESERVED4 = 126,
+ RESERVED5 = 127,
+ MAX_UC_ENUM = 128
+ };
+ };
+
+ namespace CodePageCoverage
+ {
+ enum CodePageCoverageEnum
+ {
+ CP1252 = 0,
+ CP1250 = 1,
+ CP1251 = 2,
+ CP1253 = 3,
+ CP1254 = 4,
+ CP1255 = 5,
+ CP1256 = 6,
+ CP1257 = 7,
+ CP1258 = 8,
+ CP874 = 16,
+ CP932 = 17,
+ CP936 = 18,
+ CP949 = 19,
+ CP950 = 20,
+ CP1361 = 21,
+ CP869 = 48,
+ CP866 = 49,
+ CP865 = 50,
+ CP864 = 51,
+ CP863 = 52,
+ CP862 = 53,
+ CP861 = 54,
+ CP860 = 55,
+ CP857 = 56,
+ CP855 = 57,
+ CP852 = 58,
+ CP775 = 59,
+ CP737 = 60,
+ CP780 = 61,
+ CP850 = 62,
+ CP437 = 63,
+ MAX_CP_ENUM = 64
+ };
+ };
+
+ struct FontCapabilities
+ {
+ std::optional<std::bitset<UnicodeCoverage::MAX_UC_ENUM>> oUnicodeRange;
+ std::optional<std::bitset<CodePageCoverage::MAX_CP_ENUM>> oCodePageRange;
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/fontcharmap.hxx b/include/vcl/fontcharmap.hxx
new file mode 100644
index 000000000..ade1da6e7
--- /dev/null
+++ b/include/vcl/fontcharmap.hxx
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FONTCHARMAP_HXX
+#define INCLUDED_FONTCHARMAP_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/vclenum.hxx>
+#include <tools/ref.hxx>
+
+class ImplFontCharMap;
+class CmapResult;
+class FontCharMap;
+class OutputDevice;
+
+typedef tools::SvRef<ImplFontCharMap> ImplFontCharMapRef;
+typedef tools::SvRef<FontCharMap> FontCharMapRef;
+
+class VCL_DLLPUBLIC FontCharMap final : public SvRefBase
+{
+public:
+ /** A new FontCharMap is created based on a "default" map, which includes
+ all codepoints in the Unicode BMP range, including surrogates.
+ **/
+ FontCharMap();
+
+ /** A new FontCharMap is created based on the CmapResult
+ */
+ FontCharMap( const CmapResult& rCR );
+
+ virtual ~FontCharMap() override;
+
+ /** Get the default font character map
+
+ @returns the default font character map.
+ */
+ static FontCharMapRef GetDefaultMap( bool bSymbols );
+
+ /** Determines if the font character map is the "default". The default map
+ includes all codepoints in the Unicode BMP range, including surrogates.
+
+ @returns true if default map, false if not default map.
+ */
+ bool IsDefaultMap() const;
+
+ /** Does the font character map include the UCS4 character?
+
+ @returns true if character exists in font character map, false is not.
+ */
+ bool HasChar( sal_UCS4 ) const;
+
+ /** Returns the number of chars supported by the font, which
+ are inside the unicode range from cMin to cMax (inclusive).
+
+ @param cMin Lowest codepoint in range to be counted
+ @param cMax Highest codepoint in range to be counted
+
+ @returns number of characters in the font charmap between the two
+ codepoints.
+ */
+ int CountCharsInRange( sal_UCS4 cMin, sal_UCS4 cMax ) const;
+
+ /** Get the number of characters in the font character map.
+
+ @returns number of characters in the font character map.
+ */
+ int GetCharCount() const;
+
+ /** Get the first character in the font character map.
+
+ @returns first character in the font character map.
+ */
+ sal_UCS4 GetFirstChar() const;
+
+ /** Get the last character in the font character map.
+
+ @returns last character in the font character map.
+ */
+ sal_UCS4 GetLastChar() const;
+
+ /** Get the next character in the font character map. This is important
+ because character maps (e.g. the default map which holds the characters
+ in the BMP plane) can have discontiguous ranges.
+
+ @param cChar Character from which to find next character
+
+ @returns next character in the font character map.
+ */
+ sal_UCS4 GetNextChar( sal_UCS4 cChar ) const;
+
+ /** Get the previous character in the font character map. This is important
+ because character maps (e.g. the default map which holds the characters
+ in the BMP plane) can have discontiguous ranges.
+
+ @param cChar Character from which to find previous character
+
+ @returns previous character in the font character map.
+ */
+ sal_UCS4 GetPrevChar( sal_UCS4 cChar ) const;
+
+ /** Get the index of a particular character in the font character map. The
+ index is different from the codepoint, because font character maps can
+
+ determine the index.
+
+ @param cChar Character used to find index number
+
+ @returns Index of character in font character map.
+ */
+ int GetIndexFromChar( sal_UCS4 cChar ) const;
+
+ /** Get the character at a particular index in the font character map. The
+ index is different from the codepoint, because font character maps can
+
+ determine the character.
+
+ @param nCharIndex Index used to find the character
+
+ @returns Character in font character map.
+ */
+ sal_UCS4 GetCharFromIndex( int nCharIndex ) const;
+
+ int GetGlyphIndex( sal_UCS4 ) const;
+
+ bool isSymbolic() const;
+
+private:
+ ImplFontCharMapRef mpImplFontCharMap;
+
+ friend class ::OutputDevice;
+
+ int findRangeIndex( sal_UCS4 ) const;
+
+ FontCharMap( ImplFontCharMapRef const & pIFCMap );
+
+ // prevent assignment and copy construction
+ FontCharMap( const FontCharMap& ) = delete;
+ void operator=( const FontCharMap& ) = delete;
+};
+
+// CmapResult is a normalized version of the many CMAP formats
+class VCL_PLUGIN_PUBLIC CmapResult
+{
+public:
+ explicit CmapResult( bool bSymbolic = false,
+ const sal_UCS4* pRangeCodes = nullptr, int nRangeCount = 0 );
+
+ const sal_UCS4* mpRangeCodes;
+ const int* mpStartGlyphs;
+ const sal_uInt16* mpGlyphIds;
+ int mnRangeCount;
+ bool mbSymbolic;
+ bool mbRecoded;
+};
+
+#endif // INCLUDED_FONTCHARMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/formatter.hxx b/include/vcl/formatter.hxx
new file mode 100644
index 000000000..2049d1e12
--- /dev/null
+++ b/include/vcl/formatter.hxx
@@ -0,0 +1,316 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <config_options.h>
+#include <i18nlangtag/lang.h>
+#include <tools/link.hxx>
+#include <tools/solar.h>
+#include <vcl/settings.hxx>
+#include <map>
+#include <memory>
+#include <string_view>
+
+class SvNumberFormatter;
+
+namespace validation
+{
+ // the states of our automat.
+ enum State
+ {
+ START, // at the very start of the string
+ NUM_START, // the very start of the number
+
+ DIGIT_PRE_COMMA, // some pre-comma digits are read, perhaps including some thousand separators
+
+ DIGIT_POST_COMMA, // reading digits after the comma
+ EXPONENT_START, // at the very start of the exponent value
+ // (means: not including the "e" which denotes the exponent)
+ EXPONENT_DIGIT, // currently reading the digits of the exponent
+
+ END // reached the end of the string
+ };
+
+ // a row in the transition table (means the set of states to be reached from a given state)
+ typedef ::std::map< sal_Unicode, State > StateTransitions;
+
+ // a single transition
+ typedef StateTransitions::value_type Transition;
+
+ // the complete transition table
+ typedef ::std::map< State, StateTransitions > TransitionTable;
+
+ // the validator class
+ class NumberValidator
+ {
+ private:
+ TransitionTable m_aTransitions;
+
+ public:
+ NumberValidator( const sal_Unicode _cThSep, const sal_Unicode _cDecSep );
+
+ bool isValidNumericFragment( std::u16string_view _rText );
+
+ private:
+ bool implValidateNormalized( const OUString& _rText );
+ };
+}
+
+enum class FORMAT_CHANGE_TYPE
+{
+ KEYONLY = 0x00, // only a new key was set
+ FORMATTER = 0x01, // a new formatter was set, usually implies a change of the key, too
+ PRECISION = 0x02, // a new precision was set
+ THOUSANDSSEP = 0x03, // the thousands separator setting changed
+ CURRENCY_SYMBOL = 0x10,
+ CURRSYM_POSITION = 0x20,
+};
+
+class VCL_DLLPUBLIC Formatter
+{
+public:
+ // A SvNumberFormatter is very expensive (regarding time and space), it is a Singleton
+ class StaticFormatter
+ {
+ static SvNumberFormatter* s_cFormatter;
+ static sal_uLong s_nReferences;
+ public:
+ StaticFormatter();
+ ~StaticFormatter();
+
+ operator SvNumberFormatter* () const { return GetFormatter(); }
+ UNLESS_MERGELIBS(VCL_DLLPUBLIC) static SvNumberFormatter* GetFormatter();
+ };
+
+protected:
+ OUString m_sLastValidText;
+ // Has nothing to do with the current value. It is the last text, which was valid at input (checked by CheckText,
+ // not yet through formatter)
+ Selection m_aLastSelection;
+
+ double m_dMinValue;
+ double m_dMaxValue;
+ bool m_bHasMin : 1;
+ bool m_bHasMax : 1;
+
+ bool m_bWrapOnLimits : 1;
+ bool m_bStrictFormat : 1;
+
+ bool m_bEnableEmptyField : 1;
+ bool m_bAutoColor : 1;
+ bool m_bEnableNaN : 1;
+ bool m_bDisableRemainderFactor : 1;
+ enum valueState { valueDirty, valueString, valueDouble };
+ valueState m_ValueState;
+ double m_dCurrentValue;
+ double m_dDefaultValue;
+
+ sal_uLong m_nFormatKey;
+ SvNumberFormatter* m_pFormatter;
+ StaticFormatter m_aStaticFormatter;
+
+ double m_dSpinSize;
+ double m_dSpinFirst;
+ double m_dSpinLast;
+
+ // There is a difference, when text formatting is enabled, if LostFocus formats the current String and displays it,
+ // or if a double is created from the String and then
+ bool m_bTreatAsNumber;
+ // And with the following members we can use it for formatted text output as well ...
+ OUString m_sCurrentTextValue;
+ OUString m_sDefaultText;
+
+ // The last color from the Formatter at the last output operation (not we would use it, but you can get it)
+ const Color* m_pLastOutputColor;
+
+ bool m_bUseInputStringForFormatting;
+
+ Link<sal_Int64*, TriState> m_aInputHdl;
+ Link<LinkParamNone*, bool> m_aOutputHdl;
+
+public:
+ Formatter();
+ virtual ~Formatter();
+
+ void SetFieldText(const OUString& rText, const Selection& rNewSelection);
+
+ virtual Selection GetEntrySelection() const = 0;
+ virtual OUString GetEntryText() const = 0;
+ virtual SelectionOptions GetEntrySelectionOptions() const = 0;
+ virtual void SetEntryText(const OUString& rText, const Selection& rSel) = 0;
+ virtual void SetEntryTextColor(const Color* pColor) = 0;
+ virtual void FieldModified() = 0;
+
+ // Min-/Max-management
+ bool HasMinValue() const { return m_bHasMin; }
+ virtual void ClearMinValue() { m_bHasMin = false; }
+ virtual void SetMinValue(double dMin);
+ double GetMinValue() const { return m_dMinValue; }
+
+ bool HasMaxValue() const { return m_bHasMax; }
+ virtual void ClearMaxValue() { m_bHasMax = false; }
+ virtual void SetMaxValue(double dMax);
+ double GetMaxValue() const { return m_dMaxValue; }
+
+ // Current value
+ void SetValue(double dVal);
+ double GetValue();
+ // The default implementation uses a formatter, if available
+
+ void SetTextValue(const OUString& rText);
+ // The String is transformed to a double (with a formatter) and SetValue is called afterwards
+
+ bool IsEmptyFieldEnabled() const { return m_bEnableEmptyField; }
+ void EnableEmptyField(bool bEnable);
+ // If disabled, the value will be reset to the last valid value on leave
+
+ void SetDefaultValue(double dDefault) { m_dDefaultValue = dDefault; m_ValueState = valueDirty; }
+ // If the current String is invalid, GetValue() returns this value
+ double GetDefaultValue() const { return m_dDefaultValue; }
+
+ void SetLastSelection(const Selection& rSelection) { m_aLastSelection = rSelection; }
+
+ // Settings for the format
+ sal_uLong GetFormatKey() const { return m_nFormatKey; }
+ void SetFormatKey(sal_uLong nFormatKey);
+
+ SvNumberFormatter* GetOrCreateFormatter() const { return m_pFormatter ? m_pFormatter : const_cast<Formatter*>(this)->CreateFormatter(); }
+
+ SvNumberFormatter* GetFormatter() const { return m_pFormatter; }
+ void SetFormatter(SvNumberFormatter* pFormatter, bool bResetFormat = true);
+ // If bResetFormat is sal_False, the old format is tried to be kept. (expensive, if it is no default format, available in all formatters)
+ // If sal_True, the new FormatKey is set to zero
+
+ bool GetThousandsSep() const;
+ void SetThousandsSep(bool _bUseSeparator);
+ // the is no check if the current format is numeric, so be cautious when calling these functions
+
+ void DisableRemainderFactor();
+ bool GetDisableRemainderFactor() const { return m_bDisableRemainderFactor; }
+
+ void SetWrapOnLimits(bool bWrapOnLimits) { m_bWrapOnLimits = bWrapOnLimits; }
+
+ sal_uInt16 GetDecimalDigits() const;
+ void SetDecimalDigits(sal_uInt16 _nPrecision);
+ // There is no check if the current format is numeric, so be cautious when calling these functions
+
+ SvNumberFormatter* StandardFormatter() { return m_aStaticFormatter; }
+ // If no new Formatter is created explicitly, this can be used in SetFormatter...
+
+ OUString GetFormat(LanguageType& eLang) const;
+ bool SetFormat(const OUString& rFormatString, LanguageType eLang);
+ // sal_False, if the FormatString could not be set (and very probably is invalid)
+ // This Object is shared via all instances, so be careful!
+
+ bool IsStrictFormat() const { return m_bStrictFormat; }
+ void SetStrictFormat(bool bEnable) { m_bStrictFormat = bEnable; }
+ // Check format during input
+
+ virtual void SetSpinSize(double dStep) { m_dSpinSize = dStep; }
+ double GetSpinSize() const { return m_dSpinSize; }
+
+ void SetSpinFirst(double dFirst) { m_dSpinFirst = dFirst; }
+ double GetSpinFirst() const { return m_dSpinFirst; }
+
+ void SetSpinLast(double dLast) { m_dSpinLast = dLast; }
+ double GetSpinLast() const { return m_dSpinLast; }
+
+ bool TreatingAsNumber() const { return m_bTreatAsNumber; }
+ void TreatAsNumber(bool bDoSo) { m_bTreatAsNumber = bDoSo; }
+
+ void SetInputHdl(const Link<sal_Int64*,TriState>& rLink) { m_aInputHdl = rLink; }
+ void SetOutputHdl(const Link<LinkParamNone*, bool>& rLink) { m_aOutputHdl = rLink; }
+public:
+
+ //The following methods are interesting, if m_bTreatAsNumber is set to sal_False
+ //If someone does not care about all the double handling and just wants to print the text formatted.
+ //(((The text will be formatted, using the Formatter, and then set)
+ void SetTextFormatted(const OUString& rText);
+ OUString const & GetTextValue() const;
+
+ void SetDefaultText(const OUString& rDefault) { m_sDefaultText = rDefault; }
+ const OUString& GetDefaultText() const { return m_sDefaultText; }
+
+ // The last colour from the Formatter's last output operation. Output operations get triggered by:
+ // SetValue, SetTextValue, SetTextFormatted, also indirectly via SetMin - / -MaxValue
+ const Color* GetLastOutputColor() const { return m_pLastOutputColor; }
+
+ /** reformats the current text. Interesting if the user entered some text in an "input format", and
+ this should be formatted in the "output format" (which may differ, e.g. by additional numeric
+ digits or such).
+ */
+ void Commit();
+
+ // enable automatic coloring. if set to sal_True, and the format the field is working with for any current value
+ // says that it has to be painted in a special color (e.g. a format where negative numbers should be printed
+ // red), the text is painted with that color automatically.
+ // The color used is the same as returned by GetLastOutputColor()
+ void SetAutoColor(bool _bAutomatic);
+
+ /** enables handling of not-a-number value.
+
+ When this is set to <FALSE/> (the default), then invalid inputs (i.e. text which cannot be
+ interpreted, according to the current formatting) will be handled as if the default value
+ has been entered. GetValue the will return this default value.
+
+ When set to <TRUE/>, then GetValue will return NaN (not a number, see <method scope="rtl::math">isNan</method>)
+ when the current input is invalid.
+
+ Note that setting this to <TRUE/> implies that upon leaving the control, the input
+ will *not* be corrected to a valid value. For example, if the user enters "foo" in the
+ control, and then tabs out of it, the text "foo" will persist, and GetValue will
+ return NaN in subsequent calls.
+ */
+ void EnableNotANumber( bool _bEnable );
+
+ /** When being set to true, the strings in the field are formatted using the
+ InputLine format. That's also what you get in Calc when you edit a cell
+ using F2
+ */
+ void UseInputStringForFormatting();
+ bool IsUsingInputStringForFormatting() const { return m_bUseInputStringForFormatting;}
+
+ void Modify(bool makeValueDirty = true);
+
+ void EntryLostFocus();
+
+ void ReFormat();
+
+ // any aspect of the current format has changed
+ virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat);
+
+protected:
+
+ // Override CheckText for input-time checks
+ virtual bool CheckText(const OUString&) const { return true; }
+
+ void ImplSetTextImpl(const OUString& rNew, Selection const * pNewSel);
+ void ImplSetValue(double dValue, bool bForce);
+ bool ImplGetValue(double& dNewVal);
+
+ void ImplSetFormatKey(sal_uLong nFormatKey);
+ // SetFormatKey without FormatChanged notification
+
+ SvNumberFormatter* CreateFormatter() { SetFormatter(StandardFormatter()); return m_pFormatter; }
+
+ virtual void UpdateCurrentValue(double dCurrentValue) { m_dCurrentValue = dCurrentValue; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/gdimetafiletools.hxx b/include/vcl/gdimetafiletools.hxx
new file mode 100644
index 000000000..665683dd2
--- /dev/null
+++ b/include/vcl/gdimetafiletools.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_GDIMETAFILETOOLS_HXX
+#define INCLUDED_VCL_GDIMETAFILETOOLS_HXX
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+
+class GDIMetaFile;
+
+// #i121267# Added tooling to be able to support old exporters which are based on
+// metafiles as graphic content, but do not implement using the contained clip
+// regions.
+// The given metafile will internally clip it's graphic content against the
+// included clip regions so that it is safe to ignore clip actions there. This
+// is not done completely, but implemented and extended as needed (on demand)
+// since all this is a workaround; the better and long term solution will be to
+// reimplement these im/exports to use primitives and not metafiles as base
+// information.
+
+void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource);
+
+// Allow to check if a Metafile contains clipping or not
+
+bool usesClipActions(const GDIMetaFile& rSource);
+
+// hook to access metafile members in classes of modules above vcl. Currently
+// used in MetafilePrimitive2D to be able to access the local Metafile member
+// e.g. from vcl module
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetafileAccessor
+{
+public:
+ virtual void accessMetafile(GDIMetaFile& rTargetMetafile) const = 0;
+ virtual ~MetafileAccessor();
+};
+
+#endif // INCLUDED_VCL_GDIMETAFILETOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
new file mode 100644
index 000000000..f86376754
--- /dev/null
+++ b/include/vcl/gdimtf.hxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_GDIMTF_HXX
+#define INCLUDED_VCL_GDIMTF_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/gen.hxx>
+#include <tools/solar.h>
+#include <vcl/mapmod.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/vclptr.hxx>
+#include <vector>
+
+class OutputDevice;
+class MetaAction;
+class SvStream;
+class Color;
+class BitmapEx;
+namespace tools {
+ class Polygon;
+ class PolyPolygon;
+}
+class Gradient;
+struct ImplMetaReadData;
+
+#define GDI_METAFILE_END (size_t(0xFFFFFFFF))
+
+enum class MtfConversion
+{
+ N1BitThreshold,
+ N8BitGreys
+};
+
+
+typedef Color (*ColorExchangeFnc)( const Color& rColor, const void* pColParam );
+typedef BitmapEx (*BmpExchangeFnc)( const BitmapEx& rBmpEx, const void* pBmpParam );
+
+class VCL_DLLPUBLIC GDIMetaFile final
+{
+private:
+ ::std::vector< rtl::Reference<MetaAction> > m_aList;
+ size_t m_nCurrentActionElement;
+
+ MapMode m_aPrefMapMode;
+ Size m_aPrefSize;
+ GDIMetaFile* m_pPrev;
+ GDIMetaFile* m_pNext;
+ VclPtr<OutputDevice> m_pOutDev;
+ bool m_bPause;
+ bool m_bRecord;
+ bool m_bUseCanvas;
+
+
+ SAL_DLLPRIVATE static Color ImplColAdjustFnc( const Color& rColor, const void* pColParam );
+ SAL_DLLPRIVATE static BitmapEx ImplBmpAdjustFnc( const BitmapEx& rBmpEx, const void* pBmpParam );
+
+ SAL_DLLPRIVATE static Color ImplColConvertFnc( const Color& rColor, const void* pColParam );
+ SAL_DLLPRIVATE static BitmapEx ImplBmpConvertFnc( const BitmapEx& rBmpEx, const void* pBmpParam );
+
+ SAL_DLLPRIVATE static Color ImplColMonoFnc( const Color& rColor, const void* pColParam );
+ SAL_DLLPRIVATE static BitmapEx ImplBmpMonoFnc( const BitmapEx& rBmpEx, const void* pBmpParam );
+
+ SAL_DLLPRIVATE static Color ImplColReplaceFnc( const Color& rColor, const void* pColParam );
+ SAL_DLLPRIVATE static BitmapEx ImplBmpReplaceFnc( const BitmapEx& rBmpEx, const void* pBmpParam );
+
+ SAL_DLLPRIVATE void ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pColParam,
+ BmpExchangeFnc pFncBmp, const void* pBmpParam );
+
+ SAL_DLLPRIVATE static Point ImplGetRotatedPoint( const Point& rPt, const Point& rRotatePt,
+ const Size& rOffset, double fSin, double fCos );
+ SAL_DLLPRIVATE static tools::Polygon ImplGetRotatedPolygon( const tools::Polygon& rPoly, const Point& rRotatePt,
+ const Size& rOffset, double fSin, double fCos );
+ SAL_DLLPRIVATE static tools::PolyPolygon ImplGetRotatedPolyPolygon( const tools::PolyPolygon& rPoly, const Point& rRotatePt,
+ const Size& rOffset, double fSin, double fCos );
+ SAL_DLLPRIVATE static void ImplAddGradientEx( GDIMetaFile& rMtf,
+ const OutputDevice& rMapDev,
+ const tools::PolyPolygon& rPolyPoly,
+ const Gradient& rGrad );
+
+ SAL_DLLPRIVATE bool ImplPlayWithRenderer(OutputDevice& rOut, const Point& rPos, Size rLogicDestSize);
+
+ void Linker( OutputDevice* pOut, bool bLink );
+
+public:
+ GDIMetaFile();
+ GDIMetaFile( const GDIMetaFile& rMtf );
+ ~GDIMetaFile();
+
+ GDIMetaFile& operator=( const GDIMetaFile& rMtf );
+ bool operator==( const GDIMetaFile& rMtf ) const;
+ bool operator!=( const GDIMetaFile& rMtf ) const { return !( *this == rMtf ); }
+
+ void Clear();
+ void Mirror( BmpMirrorFlags nMirrorFlags );
+ void Move( tools::Long nX, tools::Long nY );
+ // additional Move method getting specifics how to handle MapMode( MapUnit::MapPixel )
+ void Move( tools::Long nX, tools::Long nY, tools::Long nDPIX, tools::Long nDPIY );
+ void Scale( double fScaleX, double fScaleY );
+ void Scale( const Fraction& rScaleX, const Fraction& rScaleY );
+ void Rotate( Degree10 nAngle10 );
+ void Clip( const tools::Rectangle& );
+ bool HasTransparentActions() const;
+
+ /* get the bound rect of the contained actions
+ * caveats:
+ * - clip actions will limit the contained actions,
+ * but the current clipregion of the passed OutputDevice will not
+ * - coordinates of actions will be transformed to preferred mapmode
+ * - the returned rectangle is relative to the preferred mapmode of the metafile
+ */
+ tools::Rectangle GetBoundRect( OutputDevice& i_rReference ) const;
+
+ void Adjust( short nLuminancePercent, short nContrastPercent,
+ short nChannelRPercent = 0, short nChannelGPercent = 0,
+ short nChannelBPercent = 0, double fGamma = 1.0,
+ bool bInvert = false, bool msoBrightness = false );
+
+ void Convert( MtfConversion eConversion );
+ void ReplaceColors( const Color* pSearchColors, const Color* rReplaceColors,
+ sal_uLong nColorCount );
+
+ GDIMetaFile GetMonochromeMtf( const Color& rCol ) const;
+
+ void Record( OutputDevice* pOutDev );
+ bool IsRecord() const { return m_bRecord; }
+
+ void Play(GDIMetaFile& rMtf);
+ void Play(OutputDevice& rOutDev, size_t nPos = GDI_METAFILE_END);
+ void Play(OutputDevice& rOutDev, const Point& rPos, const Size& rSize);
+
+ void Pause( bool bPause );
+ bool IsPause() const { return m_bPause; }
+
+ void Stop();
+
+ void WindStart();
+ void WindPrev();
+
+ size_t GetActionSize() const;
+
+ void AddAction(const rtl::Reference<MetaAction>& pAction);
+ void AddAction(const rtl::Reference<MetaAction>& pAction, size_t nPos);
+ void push_back(const rtl::Reference<MetaAction>& pAction);
+ /**
+ * @param pAction takes ownership
+ * @param nAction the action to replace
+ */
+ void ReplaceAction( rtl::Reference<MetaAction> pAction, size_t nAction );
+
+ MetaAction* FirstAction();
+ MetaAction* NextAction();
+ MetaAction* GetAction( size_t nAction ) const;
+ MetaAction* GetCurAction() const { return GetAction( m_nCurrentActionElement ); }
+
+ const Size& GetPrefSize() const { return m_aPrefSize; }
+ void SetPrefSize( const Size& rSize ) { m_aPrefSize = rSize; }
+
+ const MapMode& GetPrefMapMode() const { return m_aPrefMapMode; }
+ void SetPrefMapMode( const MapMode& rMapMode ) { m_aPrefMapMode = rMapMode; }
+
+
+ sal_uLong GetSizeBytes() const;
+
+ /// Creates an antialiased thumbnail
+ bool CreateThumbnail(BitmapEx& rBitmapEx,
+ BmpConversion nColorConversion = BmpConversion::N24Bit,
+ BmpScaleFlag nScaleFlag = BmpScaleFlag::BestQuality) const;
+
+ void UseCanvas( bool _bUseCanvas );
+ bool GetUseCanvas() const { return m_bUseCanvas; }
+
+ /// Dumps the meta actions as XML in metafile.xml.
+ void dumpAsXml(const char* pFileName = nullptr) const;
+};
+
+#endif // INCLUDED_VCL_GDIMTF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx
new file mode 100644
index 000000000..30228f339
--- /dev/null
+++ b/include/vcl/gfxlink.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_GFXLINK_HXX
+#define INCLUDED_VCL_GFXLINK_HXX
+
+#include <tools/gen.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/mapmod.hxx>
+#include <vcl/BinaryDataContainer.hxx>
+#include <memory>
+
+class SvStream;
+
+/** GfxLink graphic types that are supported by GfxLink.
+ *
+ * It is important that the numbers for native types stay the same, because
+ * they are used in serialization to MTF.
+ */
+enum class GfxLinkType
+{
+ NONE = 0,
+ EpsBuffer = 1,
+ NativeGif = 2,
+ NativeJpg = 3,
+ NativePng = 4,
+ NativeTif = 5,
+ NativeWmf = 6,
+ NativeMet = 7,
+ NativePct = 8,
+ NativeSvg = 9,
+ NativeMov = 10,
+ NativeBmp = 11,
+ NativePdf = 12,
+ NativeWebp = 13, // If a new type is added, make sure to change NativeLast too
+
+ // Alias for when the first native type starts and last native
+ // type ends.
+ NativeFirst = NativeGif,
+ NativeLast = NativeWebp,
+};
+
+class Graphic;
+
+class VCL_DLLPUBLIC GfxLink
+{
+private:
+ GfxLinkType meType;
+ sal_uInt32 mnUserId;
+ BinaryDataContainer maDataContainer;
+ mutable size_t maHash;
+ MapMode maPrefMapMode;
+ Size maPrefSize;
+ bool mbPrefMapModeValid;
+ bool mbPrefSizeValid;
+
+public:
+ GfxLink();
+ explicit GfxLink(std::unique_ptr<sal_uInt8[]> pBuf, sal_uInt32 nBufSize, GfxLinkType nType);
+ explicit GfxLink(BinaryDataContainer const & rDataConainer, GfxLinkType nType);
+
+ bool operator==( const GfxLink& ) const;
+
+ GfxLinkType GetType() const { return meType;}
+
+ size_t GetHash() const;
+
+ void SetUserId( sal_uInt32 nUserId ) { mnUserId = nUserId; }
+ sal_uInt32 GetUserId() const { return mnUserId; }
+
+ sal_uInt32 GetDataSize() const { return maDataContainer.getSize(); }
+ const sal_uInt8* GetData() const;
+
+ const BinaryDataContainer& getDataContainer() const
+ {
+ return maDataContainer;
+ }
+
+ const Size& GetPrefSize() const { return maPrefSize;}
+ void SetPrefSize( const Size& rPrefSize );
+ bool IsPrefSizeValid() const { return mbPrefSizeValid;}
+
+ const MapMode& GetPrefMapMode() const { return maPrefMapMode;}
+ void SetPrefMapMode( const MapMode& rPrefMapMode );
+ bool IsPrefMapModeValid() const { return mbPrefMapModeValid;}
+
+ bool IsNative() const;
+
+ bool LoadNative( Graphic& rGraphic ) const;
+
+ bool ExportNative( SvStream& rOStream ) const;
+
+ bool IsEMF() const; // WMF & EMF stored under the same type (NativeWmf)
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/glyphitem.hxx b/include/vcl/glyphitem.hxx
new file mode 100644
index 000000000..23ae5a877
--- /dev/null
+++ b/include/vcl/glyphitem.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_GLYPHITEM_HXX
+#define INCLUDED_VCL_GLYPHITEM_HXX
+
+#include <sal/types.h>
+#include <vcl/dllapi.h>
+
+#include <vector>
+#include <memory>
+
+class SalLayoutGlyphsImpl;
+
+class VCL_DLLPUBLIC SalLayoutGlyphs final
+{
+ std::unique_ptr<SalLayoutGlyphsImpl> m_pImpl;
+ // Extra items are in a dynamically allocated vector in order to save memory.
+ // The usual case should be that this stays unused (it should be only used
+ // when font fallback takes place).
+ std::unique_ptr<std::vector<std::unique_ptr<SalLayoutGlyphsImpl>>> m_pExtraImpls;
+
+public:
+ SalLayoutGlyphs();
+ SalLayoutGlyphs(const SalLayoutGlyphs&) = delete;
+ SalLayoutGlyphs(SalLayoutGlyphs&&) noexcept;
+ ~SalLayoutGlyphs();
+
+ SalLayoutGlyphs& operator=(const SalLayoutGlyphs&) = delete;
+ SalLayoutGlyphs& operator=(SalLayoutGlyphs&&) noexcept;
+
+ SalLayoutGlyphsImpl* Impl(unsigned int nLevel) const;
+ void AppendImpl(SalLayoutGlyphsImpl* pImpl);
+
+ bool IsValid() const;
+ void Invalidate();
+};
+
+#endif // INCLUDED_VCL_GLYPHITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
new file mode 100644
index 000000000..ed48f8c34
--- /dev/null
+++ b/include/vcl/glyphitemcache.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_GLYPHITEMCACHE_HXX
+#define INCLUDED_VCL_GLYPHITEMCACHE_HXX
+
+#include <sal/types.h>
+#include <vcl/dllapi.h>
+
+#include <o3tl/lru_map.hxx>
+#include <o3tl/hash_combine.hxx>
+#include <vcl/glyphitem.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/vclptr.hxx>
+#include <tools/gen.hxx>
+
+#include <optional>
+
+/**
+A cache for SalLayoutGlyphs objects.
+
+Allows caching for OutputDevice::DrawText() and similar calls. Pass the text and the output device
+for the call to OutputDevice::ImplLayout(). Items are cached per output device and its font.
+If something more changes, call clear().
+*/
+class VCL_DLLPUBLIC SalLayoutGlyphsCache final
+{
+public:
+ // NOTE: The lifetime of the returned value is guaranteed only until the next call
+ // to any function in this class.
+ const SalLayoutGlyphs* GetLayoutGlyphs(VclPtr<const OutputDevice> outputDevice,
+ const OUString& text,
+ const vcl::text::TextLayoutCache* layoutCache = nullptr)
+ {
+ return GetLayoutGlyphs(outputDevice, text, 0, text.getLength(), 0, layoutCache);
+ }
+ const SalLayoutGlyphs* GetLayoutGlyphs(VclPtr<const OutputDevice> outputDevice,
+ const OUString& text, sal_Int32 nIndex, sal_Int32 nLen,
+ tools::Long nLogicWidth = 0,
+ const vcl::text::TextLayoutCache* layoutCache = nullptr);
+ void clear();
+
+ static SalLayoutGlyphsCache* self();
+ SalLayoutGlyphsCache(int size) // needs to be public for vcl::DeleteOnDeinit
+ : mCachedGlyphs(size)
+ {
+ }
+
+private:
+ struct CachedGlyphsKey
+ {
+ OUString text;
+ sal_Int32 index;
+ sal_Int32 len;
+ tools::Long logicWidth;
+ FontMetric fontMetric;
+ double fontScaleX;
+ double fontScaleY;
+ MapMode mapMode;
+ bool rtl;
+ bool artificialItalic;
+ bool artificialBold;
+ vcl::text::ComplexTextLayoutFlags layoutMode;
+ LanguageType digitLanguage;
+ size_t hashValue;
+ CachedGlyphsKey(const VclPtr<const OutputDevice>& dev, const OUString& t, sal_Int32 i,
+ sal_Int32 l, tools::Long w);
+ bool operator==(const CachedGlyphsKey& other) const;
+ };
+ struct CachedGlyphsHash
+ {
+ size_t operator()(const CachedGlyphsKey& key) const { return key.hashValue; }
+ };
+ struct GlyphsCost
+ {
+ size_t operator()(const SalLayoutGlyphs&) const;
+ };
+ typedef o3tl::lru_map<CachedGlyphsKey, SalLayoutGlyphs, CachedGlyphsHash,
+ std::equal_to<CachedGlyphsKey>, GlyphsCost>
+ GlyphsCache;
+ GlyphsCache mCachedGlyphs;
+ // Last temporary glyphs returned (pointer is returned, so the object needs to be kept somewhere).
+ std::optional<CachedGlyphsKey> mLastTemporaryKey;
+ SalLayoutGlyphs mLastTemporaryGlyphs;
+ // If set, info about the last call which wanted a substring of the full text.
+ std::optional<CachedGlyphsKey> mLastSubstringKey;
+
+ SalLayoutGlyphsCache(const SalLayoutGlyphsCache&) = delete;
+ SalLayoutGlyphsCache& operator=(const SalLayoutGlyphsCache&) = delete;
+};
+
+#endif // INCLUDED_VCL_GLYPHITEMCACHE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/gradient.hxx b/include/vcl/gradient.hxx
new file mode 100644
index 000000000..f7c2bd2ec
--- /dev/null
+++ b/include/vcl/gradient.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_GRADIENT_HXX
+#define INCLUDED_VCL_GRADIENT_HXX
+
+#include <sal/types.h>
+#include <tools/color.hxx>
+#include <tools/degree.hxx>
+#include <tools/long.hxx>
+#include <o3tl/cow_wrapper.hxx>
+
+#include <vcl/dllapi.h>
+#include <vcl/vclenum.hxx>
+
+namespace tools { class Rectangle; }
+
+class Point;
+class SvStream;
+class GDIMetaFile;
+
+class VCL_DLLPUBLIC Gradient
+{
+private:
+ class Impl;
+ ::o3tl::cow_wrapper<Impl> mpImplGradient;
+
+public:
+ Gradient();
+ Gradient( const Gradient& rGradient );
+ Gradient( Gradient&& rGradient );
+ Gradient( GradientStyle eStyle,
+ const Color& rStartColor,
+ const Color& rEndColor );
+ ~Gradient();
+
+ void SetStyle( GradientStyle eStyle );
+ GradientStyle GetStyle() const;
+
+ void SetStartColor( const Color& rColor );
+ const Color& GetStartColor() const;
+ void SetEndColor( const Color& rColor );
+ const Color& GetEndColor() const;
+ void MakeGrayscale();
+
+ void SetAngle( Degree10 nAngle );
+ Degree10 GetAngle() const;
+
+ void SetBorder( sal_uInt16 nBorder );
+ sal_uInt16 GetBorder() const;
+ void SetOfsX( sal_uInt16 nOfsX );
+ sal_uInt16 GetOfsX() const;
+ void SetOfsY( sal_uInt16 nOfsY );
+ sal_uInt16 GetOfsY() const;
+
+ void SetStartIntensity( sal_uInt16 nIntens );
+ sal_uInt16 GetStartIntensity() const;
+ void SetEndIntensity( sal_uInt16 nIntens );
+ sal_uInt16 GetEndIntensity() const;
+
+ void SetSteps( sal_uInt16 nSteps );
+ sal_uInt16 GetSteps() const;
+
+ void GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle &rBoundRect, Point& rCenter ) const;
+
+ void AddGradientActions(tools::Rectangle const& rRect, GDIMetaFile& rMetaFile);
+
+ Gradient& operator=( const Gradient& rGradient );
+ Gradient& operator=( Gradient&& rGradient );
+ bool operator==( const Gradient& rGradient ) const;
+ bool operator!=( const Gradient& rGradient ) const
+ { return !(Gradient::operator==( rGradient )); }
+
+private:
+ tools::Long GetMetafileSteps(tools::Rectangle const& rRect) const;
+
+ void DrawComplexGradientToMetafile(tools::Rectangle const& rRect, GDIMetaFile& rMetaFile) const;
+ void DrawLinearGradientToMetafile(tools::Rectangle const& rRect, GDIMetaFile& rMetaFile) const;
+};
+
+#endif // INCLUDED_VCL_GRADIENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
new file mode 100644
index 000000000..c97ee23d4
--- /dev/null
+++ b/include/vcl/graph.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <vcl/dllapi.h>
+#include <tools/solar.h>
+#include <rtl/ustring.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/animate/Animation.hxx>
+#include <vcl/gfxlink.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <vcl/vectorgraphicdata.hxx>
+#include <basegfx/vector/b2dsize.hxx>
+#include <vcl/GraphicExternalLink.hxx>
+
+enum class GraphicType
+{
+ NONE,
+ Bitmap,
+ GdiMetafile,
+ Default
+};
+
+namespace com::sun::star::graphic { class XGraphic; }
+namespace vcl { class Font; }
+
+class Bitmap;
+class GDIMetaFile;
+class SvStream;
+class ImpGraphic;
+class OutputDevice;
+class GraphicReader;
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC GraphicConversionParameters
+{
+private:
+ Size maSizePixel; // default is (0,0)
+
+ bool mbUnlimitedSize : 1; // default is false
+ bool mbAntiAliase : 1; // default is false
+ bool mbSnapHorVerLines : 1; // default is false
+
+public:
+ GraphicConversionParameters(
+ const Size& rSizePixel = Size(),
+ bool bUnlimitedSize = false,
+ bool bAntiAliase = false,
+ bool bSnapHorVerLines = false)
+ : maSizePixel(rSizePixel),
+ mbUnlimitedSize(bUnlimitedSize),
+ mbAntiAliase(bAntiAliase),
+ mbSnapHorVerLines(bSnapHorVerLines)
+ {
+ }
+
+ // data read access
+ const Size& getSizePixel() const { return maSizePixel; }
+ bool getUnlimitedSize() const { return mbUnlimitedSize; }
+ bool getAntiAliase() const { return mbAntiAliase; }
+ bool getSnapHorVerLines() const { return mbSnapHorVerLines; }
+};
+
+class Image;
+class VCL_DLLPUBLIC Graphic
+{
+private:
+ std::shared_ptr<ImpGraphic> mxImpGraphic;
+ SAL_DLLPRIVATE void ImplTestRefCount();
+
+public:
+ SAL_DLLPRIVATE ImpGraphic* ImplGetImpGraphic() const { return mxImpGraphic.get(); }
+
+ Graphic();
+ Graphic(std::shared_ptr<GfxLink> const & rGfxLink, sal_Int32 nPageIndex = 0);
+ Graphic( const GraphicExternalLink& rGraphicLink );
+ Graphic( const Graphic& rGraphic );
+ Graphic( Graphic&& rGraphic ) noexcept;
+ Graphic( const Image& rImage );
+ Graphic( const BitmapEx& rBmpEx );
+ Graphic( const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr );
+ Graphic( const Animation& rAnimation );
+ Graphic( const GDIMetaFile& rMtf );
+ Graphic( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic );
+
+ Graphic& operator=( const Graphic& rGraphic );
+ Graphic& operator=( Graphic&& rGraphic ) noexcept;
+ bool operator==( const Graphic& rGraphic ) const;
+ bool operator!=( const Graphic& rGraphic ) const;
+
+ bool IsNone() const;
+
+ void Clear();
+
+ GraphicType GetType() const;
+ void SetDefaultType();
+ bool IsSupportedGraphic() const;
+
+ bool IsTransparent() const;
+ bool IsAlpha() const;
+ bool IsAnimated() const;
+ bool IsEPS() const;
+
+ bool isAvailable() const;
+ bool makeAvailable();
+
+ // #i102089# Access of Bitmap potentially will have to rasterconvert the Graphic
+ // if it is a MetaFile. To be able to control this conversion it is necessary to
+ // allow giving parameters which control AntiAliasing and LineSnapping of the
+ // MetaFile when played. Defaults will use a no-AAed, not snapped conversion as
+ // before.
+ BitmapEx GetBitmapEx(const GraphicConversionParameters& rParameters = GraphicConversionParameters()) const;
+ /// Gives direct access to the contained BitmapEx.
+ const BitmapEx& GetBitmapExRef() const;
+
+ Animation GetAnimation() const;
+ const GDIMetaFile& GetGDIMetaFile() const;
+
+ css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const;
+
+ Size GetPrefSize() const;
+ void SetPrefSize( const Size& rPrefSize );
+
+ MapMode GetPrefMapMode() const;
+ void SetPrefMapMode( const MapMode& rPrefMapMode );
+
+ basegfx::B2DSize GetPPI() const;
+
+ Size GetSizePixel( const OutputDevice* pRefDevice = nullptr ) const;
+
+ sal_uLong GetSizeBytes() const;
+
+ void Draw(OutputDevice& rOutDev, const Point& rDestPt) const;
+ void Draw(OutputDevice& rOutDev, const Point& rDestPt,
+ const Size& rDestSize) const;
+ static void DrawEx(OutputDevice& rOutDev, const OUString& rText,
+ vcl::Font& rFont, const BitmapEx& rBitmap,
+ const Point& rDestPt, const Size& rDestSize);
+
+ void StartAnimation(OutputDevice& rOutDev,
+ const Point& rDestPt,
+ const Size& rDestSize,
+ tools::Long nExtraData = 0,
+ OutputDevice* pFirstFrameOutDev = nullptr);
+ void StopAnimation( const OutputDevice* pOutputDevice,
+ tools::Long nExtraData );
+
+ void SetAnimationNotifyHdl( const Link<Animation*,void>& rLink );
+ Link<Animation*,void> GetAnimationNotifyHdl() const;
+
+ sal_uInt32 GetAnimationLoopCount() const;
+
+ BitmapChecksum GetChecksum() const;
+
+ OUString getOriginURL() const;
+ void setOriginURL(OUString const & rOriginURL);
+
+ OString getUniqueID() const;
+
+ std::shared_ptr<GraphicReader>& GetReaderContext();
+ void SetReaderContext( const std::shared_ptr<GraphicReader> &pReader );
+ void SetDummyContext(bool value);
+ bool IsDummyContext() const;
+
+ void SetGfxLink(const std::shared_ptr<GfxLink>& rGfxLink);
+ const std::shared_ptr<GfxLink> & GetSharedGfxLink() const;
+ GfxLink GetGfxLink() const;
+ bool IsGfxLink() const;
+
+ const std::shared_ptr<VectorGraphicData>& getVectorGraphicData() const;
+
+ /// Get the page number of the multi-page source this Graphic is rendered from.
+ sal_Int32 getPageNumber() const;
+
+ static const css::uno::Sequence<sal_Int8> & getUnoTunnelId();
+};
+
+namespace std {
+
+template <>
+struct hash<Graphic>
+{
+ std::size_t operator()(Graphic const & rGraphic) const
+ {
+ return static_cast<std::size_t>(rGraphic.GetChecksum());
+ }
+};
+
+} // end namespace std
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
new file mode 100644
index 000000000..0e0351dc4
--- /dev/null
+++ b/include/vcl/graphicfilter.hxx
@@ -0,0 +1,392 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_GRAPHICFILTER_HXX
+#define INCLUDED_VCL_GRAPHICFILTER_HXX
+
+#include <tools/gen.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/graph.hxx>
+#include <vcl/errcode.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <memory>
+#include <optional>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+class INetURLObject;
+
+class FilterConfigCache;
+class SvStream;
+struct WmfExternal;
+struct ConvertData;
+
+#define ERRCODE_GRFILTER_OPENERROR ErrCode(ErrCodeArea::Vcl, ErrCodeClass::General, 1)
+#define ERRCODE_GRFILTER_IOERROR ErrCode(ErrCodeArea::Vcl, ErrCodeClass::General, 2)
+#define ERRCODE_GRFILTER_FORMATERROR ErrCode(ErrCodeArea::Vcl, ErrCodeClass::General, 3)
+#define ERRCODE_GRFILTER_VERSIONERROR ErrCode(ErrCodeArea::Vcl, ErrCodeClass::General, 4)
+#define ERRCODE_GRFILTER_FILTERERROR ErrCode(ErrCodeArea::Vcl, ErrCodeClass::General, 5)
+#define ERRCODE_GRFILTER_TOOBIG ErrCode(ErrCodeArea::Vcl, ErrCodeClass::General, 7)
+
+#define GRFILTER_OUTHINT_GREY 1
+
+#define GRFILTER_FORMAT_NOTFOUND (sal_uInt16(0xFFFF))
+#define GRFILTER_FORMAT_DONTKNOW (sal_uInt16(0xFFFF))
+
+enum class GraphicFilterImportFlags
+{
+ NONE = 0x000,
+ SetLogsizeForJpeg = 0x001,
+ DontSetLogsizeForJpeg = 0x002,
+ /// Only create a bitmap, do not read pixel data.
+ OnlyCreateBitmap = 0x020,
+ /// Read pixel data into an existing bitmap.
+ UseExistingBitmap = 0x040,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<GraphicFilterImportFlags> : is_typed_flags<GraphicFilterImportFlags, 0x0063> {};
+}
+
+#define IMP_BMP "SVBMP"
+#define IMP_MOV "SVMOV"
+#define IMP_SVMETAFILE "SVMETAFILE"
+#define IMP_WMF "SVWMF"
+#define IMP_EMF "SVEMF"
+#define IMP_GIF "SVIGIF"
+#define IMP_PNG "SVIPNG"
+#define IMP_JPEG "SVIJPEG"
+#define IMP_XBM "SVIXBM"
+#define IMP_XPM "SVIXPM"
+#define IMP_SVG "SVISVG"
+#define IMP_PDF "SVIPDF"
+#define IMP_TIFF "SVTIFF"
+#define IMP_TGA "SVTGA"
+#define IMP_PICT "SVPICT"
+#define IMP_MET "SVMET"
+#define IMP_RAS "SVRAS"
+#define IMP_PCX "SVPCX"
+#define IMP_EPS "SVIEPS"
+#define IMP_PSD "SVPSD"
+#define IMP_PCD "SVPCD"
+#define IMP_PBM "SVPBM"
+#define IMP_DXF "SVDXF"
+#define IMP_WEBP "SVIWEBP"
+
+#define EXP_BMP "SVBMP"
+#define EXP_SVMETAFILE "SVMETAFILE"
+#define EXP_WMF "SVWMF"
+#define EXP_EMF "SVEMF"
+#define EXP_JPEG "SVEJPEG"
+#define EXP_SVG "SVESVG"
+#define EXP_PDF "SVEPDF"
+#define EXP_PNG "SVEPNG"
+#define EXP_TIFF "SVTIFF"
+#define EXP_EPS "SVEEPS"
+#define EXP_GIF "SVEGIF"
+#define EXP_WEBP "SVEWEBP"
+
+
+inline constexpr OUStringLiteral BMP_SHORTNAME = u"BMP";
+inline constexpr OUStringLiteral GIF_SHORTNAME = u"GIF";
+inline constexpr OUStringLiteral JPG_SHORTNAME = u"JPG";
+inline constexpr OUStringLiteral MET_SHORTNAME = u"MET";
+inline constexpr OUStringLiteral PCT_SHORTNAME = u"PCT";
+inline constexpr OUStringLiteral PNG_SHORTNAME = u"PNG";
+inline constexpr OUStringLiteral SVM_SHORTNAME = u"SVM";
+inline constexpr OUStringLiteral TIF_SHORTNAME = u"TIF";
+inline constexpr OUStringLiteral WMF_SHORTNAME = u"WMF";
+inline constexpr OUStringLiteral EMF_SHORTNAME = u"EMF";
+inline constexpr OUStringLiteral SVG_SHORTNAME = u"SVG";
+inline constexpr OUStringLiteral PDF_SHORTNAME = u"PDF";
+inline constexpr OUStringLiteral WEBP_SHORTNAME = u"WEBP";
+
+// Info class for all supported file formats
+
+enum class GraphicFileFormat
+{
+ NOT = 0x0000,
+ BMP = 0x0001,
+ GIF = 0x0002,
+ JPG = 0x0003,
+ PCD = 0x0004,
+ PCX = 0x0005,
+ PNG = 0x0006,
+ TIF = 0x0007,
+ XBM = 0x0008,
+ XPM = 0x0009,
+ PBM = 0x000a,
+ PGM = 0x000b,
+ PPM = 0x000c,
+ RAS = 0x000d,
+ TGA = 0x000e,
+ PSD = 0x000f,
+ EPS = 0x0010,
+ WEBP = 0x0011,
+ DXF = 0x00f1,
+ MET = 0x00f2,
+ PCT = 0x00f3,
+ // retired SGF = 0x00f4,
+ SVM = 0x00f5,
+ WMF = 0x00f6,
+ // retired SGV = 0x00f7,
+ EMF = 0x00f8,
+ SVG = 0x00f9
+};
+
+
+class VCL_DLLPUBLIC GraphicDescriptor final
+{
+ SvStream* pFileStm;
+
+ OUString aPathExt;
+ Size aPixSize;
+ Size aLogSize;
+ std::optional<Size> maPreferredLogSize;
+ std::optional<MapMode> maPreferredMapMode;
+ sal_uInt16 nBitsPerPixel;
+ sal_uInt16 nPlanes;
+ GraphicFileFormat nFormat;
+ bool bOwnStream;
+ sal_uInt8 mnNumberOfImageComponents;
+ bool bIsTransparent;
+ bool bIsAlpha;
+
+ void ImpConstruct();
+
+ bool ImpDetectBMP( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectGIF( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectJPG( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectPCD( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectPCX( SvStream& rStm );
+ bool ImpDetectPNG( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectTIF( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectXBM( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectXPM( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectPBM( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectPGM( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectPPM( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectRAS( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectTGA( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectPSD( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectEPS( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectWEBP( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectDXF( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectMET( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectPCT( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectSVM( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectWMF( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectEMF( SvStream& rStm, bool bExtendedInfo );
+ bool ImpDetectSVG( SvStream& rStm, bool bExtendedInfo );
+ GraphicDescriptor( const GraphicDescriptor& ) = delete;
+ GraphicDescriptor& operator=( const GraphicDescriptor& ) = delete;
+
+public:
+
+ /** Ctor to set a filename
+
+ Detect() must be called to identify the file
+ If the file has no unique header (Mtf's), the format
+ is determined from the extension */
+ GraphicDescriptor( const INetURLObject& rPath );
+
+ /** Ctor using a stream
+
+ Detect() must be called to identify the file
+ As some formats (Mtf's) do not have a unique header, it makes sense
+ to supply the file name (incl. ext.), so that the format can be
+ derived from the extension */
+ GraphicDescriptor( SvStream& rInStream, const OUString* pPath );
+
+ ~GraphicDescriptor();
+
+ /** starts the detection
+
+ if bExtendedInfo == true the file header is used to derive
+ as many properties as possible (size, color, etc.) */
+ bool Detect( bool bExtendedInfo = false );
+
+ /** @return the file format, GraphicFileFormat::NOT if no format was recognized */
+ GraphicFileFormat GetFileFormat() const { return nFormat; }
+
+ /** @return graphic size in pixels or 0 size */
+ const Size& GetSizePixel() const { return aPixSize; }
+
+ /** @return the logical graphic size in 1/100mm or 0 size */
+ const Size& GetSize_100TH_MM() const { return aLogSize; }
+
+ /**
+ * Returns the logic size, according to the map mode available via GetPreferredMapMode(). Prefer
+ * this size over GetSize_100TH_MM().
+ */
+ const std::optional<Size>& GetPreferredLogSize() const { return maPreferredLogSize; }
+
+ /**
+ * If available, this returns the map mode the graphic prefers, which may be other than pixel or
+ * 100th mm. Prefer this map mode over just assuming MapUnit::Map100thMM.
+ */
+ const std::optional<MapMode>& GetPreferredMapMode() const { return maPreferredMapMode; }
+
+ /** @return bits/pixel or 0 **/
+ sal_uInt16 GetBitsPerPixel() const { return nBitsPerPixel; }
+
+ /** @return number of color channels */
+ sal_uInt8 GetNumberOfImageComponents() const { return mnNumberOfImageComponents; }
+
+ /** @return whether image supports transparency */
+ bool IsTransparent() const { return bIsTransparent; }
+
+ /** @return whether image supports alpha values for translucent colours */
+ bool IsAlpha() const { return bIsAlpha; }
+
+ /** @return filter number that is needed by the GraphFilter to read this format */
+ static OUString GetImportFormatShortName( GraphicFileFormat nFormat );
+};
+
+/** Class to import and export graphic formats. */
+class VCL_DLLPUBLIC GraphicFilter
+{
+public:
+ GraphicFilter( bool bUseConfig = true );
+ ~GraphicFilter();
+
+ sal_uInt16 GetImportFormatCount() const;
+ sal_uInt16 GetImportFormatNumber( std::u16string_view rFormatName );
+ sal_uInt16 GetImportFormatNumberForShortName( std::u16string_view rShortName );
+ sal_uInt16 GetImportFormatNumberForTypeName( std::u16string_view rType );
+ OUString GetImportFormatName( sal_uInt16 nFormat );
+ OUString GetImportFormatTypeName( sal_uInt16 nFormat );
+#ifdef _WIN32
+ OUString GetImportFormatMediaType( sal_uInt16 nFormat );
+#endif
+ OUString GetImportFormatShortName( sal_uInt16 nFormat );
+ OUString GetImportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry );
+
+ sal_uInt16 GetExportFormatCount() const;
+ sal_uInt16 GetExportFormatNumber( std::u16string_view rFormatName );
+ sal_uInt16 GetExportFormatNumberForMediaType( std::u16string_view rShortName );
+ sal_uInt16 GetExportFormatNumberForShortName( std::u16string_view rShortName );
+ OUString GetExportInternalFilterName( sal_uInt16 nFormat );
+ sal_uInt16 GetExportFormatNumberForTypeName( std::u16string_view rType );
+ OUString GetExportFormatName( sal_uInt16 nFormat );
+ OUString GetExportFormatMediaType( sal_uInt16 nFormat );
+ OUString GetExportFormatShortName( sal_uInt16 nFormat );
+ OUString GetExportWildcard( sal_uInt16 nFormat );
+ bool IsExportPixelFormat( sal_uInt16 nFormat );
+
+ ErrCode ExportGraphic( const Graphic& rGraphic, const INetURLObject& rPath,
+ sal_uInt16 nFormat,
+ const css::uno::Sequence< css::beans::PropertyValue >* pFilterData = nullptr );
+ ErrCode ExportGraphic( const Graphic& rGraphic, std::u16string_view rPath,
+ SvStream& rOStm, sal_uInt16 nFormat,
+ const css::uno::Sequence< css::beans::PropertyValue >* pFilterData = nullptr );
+
+ ErrCode CanImportGraphic( const INetURLObject& rPath,
+ sal_uInt16 nFormat,
+ sal_uInt16 * pDeterminedFormat);
+
+ ErrCode ImportGraphic( Graphic& rGraphic, const INetURLObject& rPath,
+ sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW,
+ sal_uInt16 * pDeterminedFormat = nullptr, GraphicFilterImportFlags nImportFlags = GraphicFilterImportFlags::NONE );
+
+ ErrCode CanImportGraphic( std::u16string_view rPath, SvStream& rStream,
+ sal_uInt16 nFormat,
+ sal_uInt16 * pDeterminedFormat);
+
+ ErrCode ImportGraphic( Graphic& rGraphic, std::u16string_view rPath,
+ SvStream& rStream,
+ sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW,
+ sal_uInt16 * pDeterminedFormat = nullptr, GraphicFilterImportFlags nImportFlags = GraphicFilterImportFlags::NONE );
+
+ /// Imports multiple graphics.
+ ///
+ /// The resulting graphic is added to rGraphics on success, nullptr is added on failure.
+ void ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGraphics, std::vector< std::unique_ptr<SvStream> > vStreams);
+
+ /**
+ Tries to ensure all Graphic objects are available (Graphic::isAvailable()). Only an optimization, may
+ not process all items.
+ */
+ void MakeGraphicsAvailableThreaded(std::vector< Graphic* >& rGraphics);
+
+ // Setting sizeLimit limits how much will be read from the stream.
+ Graphic ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 sizeLimit = 0, const Size* pSizeHint = nullptr);
+
+ const ErrCode& GetLastError() const { return *mxErrorEx;}
+ void ResetLastError();
+
+ Link<ConvertData&,bool> GetFilterCallback() const;
+ static GraphicFilter& GetGraphicFilter();
+ static ErrCode LoadGraphic( const OUString& rPath, const OUString& rFilter,
+ Graphic& rGraphic,
+ GraphicFilter* pFilter = nullptr,
+ sal_uInt16* pDeterminedFormat = nullptr );
+
+ ErrCode compressAsPNG(const Graphic& rGraphic, SvStream& rOutputStream);
+
+ static ErrCode readGIF(SvStream& rStream, Graphic& rGraphic, GfxLinkType& rLinkType);
+ static ErrCode readPNG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType,
+ std::unique_ptr<sal_uInt8[]> & rpGraphicContent, sal_Int32& rGraphicContentSize);
+ static ErrCode readJPEG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType,
+ GraphicFilterImportFlags nImportFlags);
+ static ErrCode readSVG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType,
+ std::unique_ptr<sal_uInt8[]> & rpGraphicContent, sal_Int32& rGraphicContentSize);
+ static ErrCode readXBM(SvStream & rStream, Graphic & rGraphic);
+ static ErrCode readXPM(SvStream & rStream, Graphic & rGraphic);
+
+ static ErrCode readWMF_EMF(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, VectorGraphicDataType eType);
+ static ErrCode readWMF(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
+ static ErrCode readEMF(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
+
+ static ErrCode readPDF(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
+ static ErrCode readTIFF(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
+ static ErrCode readWithTypeSerializer(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, std::u16string_view aFilterName);
+ static ErrCode readBMP(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
+ static ErrCode readTGA(SvStream & rStream, Graphic & rGraphic);
+ static ErrCode readPICT(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
+ static ErrCode readMET(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
+ static ErrCode readRAS(SvStream & rStream, Graphic & rGraphic);
+ static ErrCode readPCX(SvStream & rStream, Graphic & rGraphic);
+ static ErrCode readEPS(SvStream & rStream, Graphic & rGraphic);
+ static ErrCode readPSD(SvStream & rStream, Graphic & rGraphic);
+ static ErrCode readPCD(SvStream & rStream, Graphic & rGraphic);
+ static ErrCode readPBM(SvStream & rStream, Graphic & rGraphic);
+ static ErrCode readDXF(SvStream & rStream, Graphic & rGraphic);
+ static ErrCode readWEBP(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
+
+private:
+ OUString aFilterPath;
+ FilterConfigCache* pConfig;
+
+ void ImplInit();
+ ErrCode ImplSetError( ErrCode nError, const SvStream* pStm = nullptr );
+ ErrCode ImpTestOrFindFormat( std::u16string_view rPath, SvStream& rStream, sal_uInt16& rFormat );
+
+ DECL_DLLPRIVATE_LINK( FilterCallback, ConvertData&, bool );
+
+ /** Information about errors during the GraphicFilter operation. */
+ std::optional<ErrCode> mxErrorEx;
+ bool bUseConfig;
+};
+
+#endif // INCLUDED_VCL_GRAPHICFILTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/graphictools.hxx b/include/vcl/graphictools.hxx
new file mode 100644
index 000000000..932df413c
--- /dev/null
+++ b/include/vcl/graphictools.hxx
@@ -0,0 +1,369 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_GRAPHICTOOLS_HXX
+#define INCLUDED_VCL_GRAPHICTOOLS_HXX
+
+#include <vcl/dllapi.h>
+#include <sal/types.h>
+#include <tools/color.hxx>
+#include <tools/poly.hxx>
+#include <vcl/graph.hxx>
+
+#include <vector>
+
+class SvStream;
+
+/** Encapsulates geometry and associated attributes of a graphical 'pen stroke'
+
+ @attention Widespread use is deprecated. See declarations above
+ for the way to go. Especially the copied enums from svx/xenum.hxx
+ are troublesome.
+
+ Use this class to store geometry and attributes of a graphical
+ 'pen stroke', such as pen width, dashing etc. The geometry is the
+ so-called 'path' along which the stroke is traced, with the given
+ pen width. The cap type determines how the open ends of the path
+ should be drawn. If the geometry consists of more than one
+ segment, the join type determines in which way the segments are
+ joined.
+ */
+class VCL_DLLPUBLIC SvtGraphicStroke
+{
+public:
+ /// Style for open stroke ends
+ enum CapType
+ {
+ /// No additional cap
+ capButt=0,
+ /// Half-round cap at the line end, the center lying at the end point
+ capRound,
+ /// Half-square cap at the line end, the center lying at the end point
+ capSquare
+ };
+ /// Style for joins of individual stroke segments
+ enum JoinType
+ {
+ /// Extend segment edges, until they cross
+ joinMiter=0,
+ /// Connect segments by a filled round arc
+ joinRound,
+ /// Connect segments by a direct straight line
+ joinBevel,
+ /// Perform no join, leads to visible gaps between thick line segments
+ joinNone
+ };
+ typedef ::std::vector< double > DashArray;
+
+ SvtGraphicStroke();
+ /** All in one constructor
+
+ See accessor method descriptions for argument description
+ */
+ SvtGraphicStroke( const tools::Polygon& rPath,
+ const tools::PolyPolygon& rStartArrow,
+ const tools::PolyPolygon& rEndArrow,
+ double fTransparency,
+ double fStrokeWidth,
+ CapType aCap,
+ JoinType aJoin,
+ double fMiterLimit,
+ DashArray&& rDashArray ); // TODO: Dash array offset (position where to start, see PS)
+
+ // accessors
+ /// Query path to stroke
+ void getPath ( tools::Polygon& ) const;
+ /** Get the polygon that is put at the start of the line
+
+ The polygon is in a special normalized position: the center of
+ the stroked path will meet the given polygon at (0,0) from
+ negative y values. Thus, an arrow would have its baseline on
+ the x axis, going upwards to positive y values. Furthermore,
+ the polygon is also scaled in a special way: the width of the
+ joining stroke is defined to be
+ SvtGraphicStroke::normalizedArrowWidth (0x10000), i.e. ranging
+ from x=-0x8000 to x=0x8000. So, if the arrow does have this
+ width, it has to fit every stroke with every stroke width
+ exactly.
+ */
+ void getStartArrow ( tools::PolyPolygon& ) const;
+ /** Get the polygon that is put at the end of the line
+
+ The polygon is in a special normalized position, and already
+ scaled to the desired size: the center of the stroked path
+ will meet the given polygon at (0,0) from negative y
+ values. Thus, an arrow would have its baseline on the x axis,
+ going upwards to positive y values. Furthermore, the polygon
+ is also scaled in a special way: the width of the joining
+ stroke is defined to be SvtGraphicStroke::normalizedArrowWidth
+ (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. So, if the
+ arrow does have this width, it has to fit every stroke with
+ every stroke width exactly.
+ */
+ void getEndArrow ( tools::PolyPolygon& ) const;
+ /** Get stroke transparency
+
+ @return the transparency, ranging from 0.0 (opaque) to 1.0 (fully translucent)
+ */
+ double getTransparency () const { return mfTransparency;}
+ /// Get width of the stroke
+ double getStrokeWidth () const { return mfStrokeWidth;}
+ /// Get the style in which open stroke ends are drawn
+ CapType getCapType () const { return maCapType;}
+ /// Get the style in which the stroke segments are joined
+ JoinType getJoinType () const { return maJoinType;}
+ /// Get the maximum length of mitered joins
+ double getMiterLimit () const { return mfMiterLimit;}
+ /// Get an array of "on" and "off" lengths for stroke dashing
+ void getDashArray ( DashArray& ) const;
+
+ // mutators
+ /// Set path to stroke
+ void setPath ( const tools::Polygon& );
+ /** Set the polygon that is put at the start of the line
+
+ The polygon has to be in a special normalized position, and
+ already scaled to the desired size: the center of the stroked
+ path will meet the given polygon at (0,0) from negative y
+ values. Thus, an arrow would have its baseline on the x axis,
+ going upwards to positive y values. Furthermore, the polygon
+ also has to be scaled appropriately: the width of the joining
+ stroke is defined to be SvtGraphicStroke::normalizedArrowWidth
+ (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. If your
+ arrow does have this width, it will fit every stroke with
+ every stroke width exactly.
+ */
+ void setStartArrow ( const tools::PolyPolygon& );
+ /** Set the polygon that is put at the end of the line
+
+ The polygon has to be in a special normalized position, and
+ already scaled to the desired size: the center of the stroked
+ path will meet the given polygon at (0,0) from negative y
+ values. Thus, an arrow would have its baseline on the x axis,
+ going upwards to positive y values. Furthermore, the polygon
+ also has to be scaled appropriately: the width of the joining
+ stroke is defined to be SvtGraphicStroke::normalizedArrowWidth
+ (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. If your
+ arrow does have this width, it will fit every stroke with
+ every stroke width exactly.
+ */
+ void setEndArrow ( const tools::PolyPolygon& );
+ /// Affine scaling in both X and Y dimensions
+ void scale ( double fScaleX, double fScaleY );
+
+private:
+ // friends
+ VCL_DLLPUBLIC friend SvStream& WriteSvtGraphicStroke( SvStream& rOStm, const SvtGraphicStroke& rClass );
+ VCL_DLLPUBLIC friend SvStream& ReadSvtGraphicStroke( SvStream& rIStm, SvtGraphicStroke& rClass );
+
+ tools::Polygon maPath;
+ tools::PolyPolygon maStartArrow;
+ tools::PolyPolygon maEndArrow;
+ double mfTransparency;
+ double mfStrokeWidth;
+ CapType maCapType;
+ JoinType maJoinType;
+ double mfMiterLimit;
+ DashArray maDashArray;
+};
+
+/** Encapsulates geometry and associated attributes of a filled area
+
+ @attention Widespread use is deprecated. See declarations above
+ for the way to go. Especially the copied enums from svx/xenum.hxx
+ is troublesome.
+
+ Use this class to store geometry and attributes of a filled area,
+ such as fill color, transparency, texture or hatch. The geometry
+ is the so-called 'path', whose inner area will get filled
+ according to the attributes set. If the path is intersecting, or
+ one part of the path is lying fully within another part, then the
+ fill rule determines which parts are filled and which are not.
+ */
+class VCL_DLLPUBLIC SvtGraphicFill
+{
+public:
+ /// Type of fill algorithm used
+ enum FillRule
+ {
+ /** Non-zero winding rule
+
+ Fill shape scanline-wise. Starting at the left, determine
+ the winding number as follows: every segment crossed that
+ runs counter-clockwise adds one to the winding number,
+ every segment crossed that runs clockwise subtracts
+ one. The part of the scanline where the winding number is
+ non-zero gets filled.
+ */
+ fillNonZero=0,
+ /** Even-odd fill rule
+
+ Fill shape scanline-wise. Starting at the left, count the
+ number of segments crossed. If this number is odd, the
+ part of the scanline is filled, otherwise not.
+ */
+ fillEvenOdd
+ };
+ /// Type of filling used
+ enum FillType
+ {
+ /// Fill with a specified solid color
+ fillSolid=0,
+ /// Fill with the specified gradient
+ fillGradient,
+ /// Fill with the specified hatch
+ fillHatch,
+ /// Fill with the specified texture (a Graphic object)
+ fillTexture
+ };
+ /// Type of hatching used
+ enum HatchType
+ {
+ /// horizontal parallel lines, one unit apart
+ hatchSingle=0,
+ /// horizontal and vertical orthogonally crossing lines, one unit apart
+ hatchDouble,
+ /// three crossing lines, like HatchType::hatchDouble, but
+ /// with an additional diagonal line, rising to the upper
+ /// right corner. The first diagonal line goes through the
+ /// upper left corner, the other are each spaced a unit apart.
+ hatchTriple
+ };
+ /// Type of gradient used
+ enum class GradientType {Linear, Radial, Rectangular};
+ /// Special values for gradient step count
+ enum { gradientStepsInfinite=0 };
+ /** Homogeneous 2D transformation matrix
+
+ This is a 2x3 matrix representing an affine transformation on
+ the R^2, in the usual C/C++ row major form. It is structured as follows:
+ <pre>
+ a b t_x
+ c d t_y
+ 0 0 1
+ </pre>
+ where the lowest line is not stored in the matrix, since it is
+ constant. Variables t_x and t_y contain translational
+ components, a to d rotation, scale and shear (for details,
+ look up your favorite linear algebra/computer graphics book).
+ */
+ struct VCL_DLLPUBLIC Transform
+ {
+ enum { MatrixSize=6 };
+ Transform();
+ double matrix[MatrixSize];
+ };
+
+ SvtGraphicFill();
+ /** All in one constructor
+
+ See accessor method descriptions for argument description
+ */
+ SvtGraphicFill( const tools::PolyPolygon& rPath,
+ Color aFillColor,
+ double fTransparency,
+ FillRule aFillRule,
+ FillType aFillType, // TODO: Multitexturing
+ const Transform& aFillTransform,
+ bool bTiling,
+ HatchType aHatchType, // TODO: vector of directions and start points
+ Color aHatchColor,
+ GradientType aGradientType, // TODO: Transparent gradients (orthogonal to normal ones)
+ Color aGradient1stColor, // TODO: vector of colors and offsets
+ Color aGradient2ndColor,
+ sal_Int32 aGradientStepCount, // numbers of steps to render the gradient. gradientStepsInfinite means infinitely many.
+ const Graphic& aFillGraphic );
+
+ // accessors
+ /// Query path to fill
+ void getPath ( tools::PolyPolygon& ) const;
+ /// Get color used for solid fills
+ const Color& getFillColor () const { return maFillColor;}
+ /** Get stroke transparency
+
+ @return the transparency, ranging from 0.0 (opaque) to 1.0 (fully translucent)
+ */
+ double getTransparency () const { return mfTransparency;}
+ /// Get fill rule used
+ FillRule getFillRule () const { return maFillRule;}
+ /** Get fill type used
+
+ Currently, only one of the fill types can be used
+ simultaneously. If you specify e.g. FillRule::fillGradient,
+ hatching, texture and solid fill color are ignored.
+ */
+ FillType getFillType () const { return maFillType;}
+ /** Get transformation applied to hatch, gradient or texture during fill
+
+ A fill operation generally starts at the top left position of
+ the object's bounding box. At that position (if tiling is on,
+ also all successive positions), the specified fill graphic is
+ rendered, after applying the fill transformation to it. For
+ example, if the fill transformation contains a translation,
+ the fill graphic is rendered at the object's bounding box's
+ top left corner plus the translation components.
+
+ */
+ void getTransform ( Transform& ) const;
+
+ /** Query state of texture tiling
+
+ @return true, if texture is tiled, false, if output only once.
+ */
+ bool isTiling () const { return mbTiling;}
+ /// Get type of gradient used
+ GradientType getGradientType () const { return maGradientType;}
+
+ /** Get the texture graphic used
+
+ The Graphic object returned is used to fill the geometry, if
+ the FillType is fillTexture. The Graphic object is always
+ assumed to be of size 1x1, the transformation is used to scale
+ it to the appropriate size.
+ */
+ void getGraphic ( Graphic& ) const;
+
+ // mutators
+ /// Set path to fill
+ void setPath ( const tools::PolyPolygon& rPath );
+
+private:
+ // friends
+ VCL_DLLPUBLIC friend SvStream& WriteSvtGraphicFill( SvStream& rOStm, const SvtGraphicFill& rClass );
+ VCL_DLLPUBLIC friend SvStream& ReadSvtGraphicFill( SvStream& rIStm, SvtGraphicFill& rClass );
+
+ tools::PolyPolygon maPath;
+ Color maFillColor;
+ double mfTransparency;
+ FillRule maFillRule;
+ FillType maFillType;
+ Transform maFillTransform;
+ bool mbTiling;
+ HatchType maHatchType;
+ Color maHatchColor;
+ GradientType maGradientType;
+ Color maGradient1stColor;
+ Color maGradient2ndColor;
+ sal_Int32 maGradientStepCount;
+ Graphic maFillGraphic;
+};
+
+#endif // INCLUDED_VCL_GRAPHICTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/hatch.hxx b/include/vcl/hatch.hxx
new file mode 100644
index 000000000..713f22b95
--- /dev/null
+++ b/include/vcl/hatch.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_HATCH_HXX
+#define INCLUDED_VCL_HATCH_HXX
+
+#include <tools/color.hxx>
+#include <tools/long.hxx>
+#include <tools/degree.hxx>
+#include <vcl/dllapi.h>
+
+#include <vcl/vclenum.hxx>
+#include <o3tl/cow_wrapper.hxx>
+
+
+class SvStream;
+
+struct ImplHatch
+{
+ Color maColor;
+ HatchStyle meStyle;
+ tools::Long mnDistance;
+ Degree10 mnAngle;
+
+ ImplHatch();
+
+ bool operator==( const ImplHatch& rImplHatch ) const;
+};
+
+class VCL_DLLPUBLIC Hatch
+{
+public:
+
+ Hatch();
+ Hatch( const Hatch& rHatch );
+ Hatch( HatchStyle eStyle, const Color& rHatchColor, tools::Long nDistance, Degree10 nAngle10 );
+ ~Hatch();
+
+ Hatch& operator=( const Hatch& rHatch );
+ bool operator==( const Hatch& rHatch ) const;
+ bool operator!=( const Hatch& rHatch ) const { return !(Hatch::operator==( rHatch ) ); }
+
+ HatchStyle GetStyle() const { return mpImplHatch->meStyle; }
+
+ void SetColor( const Color& rColor );
+ const Color& GetColor() const { return mpImplHatch->maColor; }
+
+ void SetDistance( tools::Long nDistance );
+ tools::Long GetDistance() const { return mpImplHatch->mnDistance; }
+
+ void SetAngle( Degree10 nAngle10 );
+ Degree10 GetAngle() const { return mpImplHatch->mnAngle; }
+
+ friend SvStream& ReadHatch( SvStream& rIStm, Hatch& rHatch );
+ friend SvStream& WriteHatch( SvStream& rOStm, const Hatch& rHatch );
+
+private:
+ o3tl::cow_wrapper< ImplHatch > mpImplHatch;
+};
+
+#endif // INCLUDED_VCL_HATCH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/headbar.hxx b/include/vcl/headbar.hxx
new file mode 100644
index 000000000..1f9fc429a
--- /dev/null
+++ b/include/vcl/headbar.hxx
@@ -0,0 +1,319 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_HEADBAR_HXX
+#define INCLUDED_VCL_HEADBAR_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/link.hxx>
+#include <vcl/window.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <memory>
+
+/*************************************************************************
+
+Description
+============
+
+class HeaderBar
+
+This class serves for displaying a header bar. A header bar can display
+texts, images or both of them. The items can be changed in size, dragged or
+clicked at. In many cases, it makes, for example, sense to use this control
+in combination with a SvTabListBox.
+
+--------------------------------------------------------------------------
+
+WinBits
+
+WB_BORDER a border is drawn in the top and in the bottom
+WB_BOTTOMBORDER a border is drawn in the bottom
+WB_BUTTONSTYLE The items look like buttons, otherwise they are flat.
+WB_3DLOOK 3D look
+WB_DRAG items can be dragged
+WB_STDHEADERBAR WB_BUTTONSTYLE | WB_BOTTOMBORDER
+
+--------------------------------------------------------------------------
+
+ItemBits
+
+HeaderBarItemBits::LEFT content is displayed in the item left-justified
+HeaderBarItemBits::CENTER content is displayed in the item centred
+HeaderBarItemBits::RIGHT content is displayed in the item right-justified
+HeaderBarItemBits::TOP content is displayed in the item at the upper border
+HeaderBarItemBits::VCENTER content is displayed in the item vertically centred
+HeaderBarItemBits::BOTTOM content is displayed in the item at the bottom border
+HeaderBarItemBits::LEFTIMAGE in case of text and image, the image is displayed left of the text
+HeaderBarItemBits::RIGHTIMAGE in case of text and image, the image is displayed right of the text
+HeaderBarItemBits::FIXED item cannot be changed in size
+HeaderBarItemBits::FIXEDPOS item cannot be moved
+HeaderBarItemBits::CLICKABLE item is clickable
+ (select handler is only called on MouseButtonUp)
+HeaderBarItemBits::FLAT item is displayed in a flat way, even if WB_BUTTONSTYLE is set
+HeaderBarItemBits::DOWNARROW An arrow pointing downwards is displayed behind the text,
+ which should, for example, be shown, when after this item,
+ a corresponding list is sorted in descending order.
+ The status of the arrow can be set/reset with SetItemBits().
+HeaderBarItemBits::UPARROW An arrow pointing upwards is displayed behind the text,
+ which should, for example, be shown, when after this item,
+ a corresponding list is sorted in ascending order.
+ The status of the arrow can be set/reset with SetItemBits().
+HeaderBarItemBits::USERDRAW For this item, the UserDraw handler is called as well.
+HeaderBarItemBits::STDSTYLE (HeaderBarItemBits::LEFT | HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::CLICKABLE)
+
+--------------------------------------------------------------------------
+
+Handler
+
+Select() Is called, when the item is clicked. If HeaderBarItemBits::CLICKABLE
+ is set in the item and not HeaderBarItemBits::FLAT, the handler is only
+ called in the MouseButtonUp handler, when the mouse has been
+ released over the item. In this case, the Select handler
+ behaves like it does with a ToolBox button.
+DoubleClick() This handler is called, when an item is double-clicked.
+ Whether the item or the separator has been clicked, can
+ be determined by IsItemMode(). Normally, when a separator
+ is double-clicked, the optimal column width should be
+ calculated and should be set.
+StartDrag() This handler is called, when dragging is started resp.
+ an item has been clicked. At the latest in this handler,
+ the size of the size-line should be set with
+ SetDragSize(), if IsItemMode() returns false.
+Drag() This handler is called, when dragging is taking place.
+ If no size is set with SetDragSize(), this handler can
+ be used to draw the line in the neighbouring window by
+ oneself. The current dragging position can be requested
+ with GetDragPos(). In every case, IsItemMode()
+ should be checked to find out whether a separator is
+ dragged as well.
+EndDrag() This handler is called, when a dragging process has been
+ stopped. If GetCurItemId() returns 0 in the EndDrag handler,
+ the drag process was aborted. If this is not the case and
+ IsItemMode() returns false, the new size of the dragged
+ item should be requested using GetItemSize() and it
+ should be taken over in the corresponding control.
+ If IsItemMode() returns true, GetCurItemId()
+ returns an Id and IsItemDrag() returns true, this
+ item has been dragged. In this case, the new position
+ should be requested using GetItemPos() and the data
+ in the corresponding control should be adapted.
+ Otherwise, the position to which the item has been dragged
+ could also be requested with GetItemDragPos().
+
+Further methods that are important for the handler.
+
+GetCurItemId() Returns the id of the item, for which the handler has
+ currently been called. Only returns a valid id in the
+ handlers Select(), DoubleClick(), StartDrag(),
+ Drag() and EndDrag(). In the EndDrag handler,
+ this method returns the id of the dragged item or 0,
+ if the drag process has been aborted.
+GetItemDragPos() Returns the position, at which an item has been moved.
+ HEADERBAR_ITEM_NOTFOUND is returned, if the process
+ has been aborted or no ItemDrag is active.
+IsItemMode() This method can be used to determine whether the
+ handler has been called for an item or a separator.
+ true - handler was called for the item
+ false - handler was called for the separator
+IsItemDrag() This method can be used to determine whether an item
+ has been dragged or selected.
+ true - item is dragged
+ false - item is selected
+SetDragSize() This method is used to set the size of the separating
+ line that is drawn by the control. It should be
+ equivalent to the height of the neighbouring window.
+ The height of the HeaderBar is added automatically.
+
+--------------------------------------------------------------------------
+
+Further methods
+
+SetOffset() This method sets the offset, from which on the
+ items are shown. This is needed when the
+ corresponding window is scrolled.
+CalcWindowSizePixel() This method can be used to calculate the height
+ of the window, so that the content of the item
+ can be displayed.
+
+--------------------------------------------------------------------------
+
+Tips and tricks:
+
+1) ContextMenu
+If a context sensitive PopupMenu should be shown, the command
+handler must be overlaid. Using GetItemId() and when passing the
+mouse position, it can be determined whether the mouse click has been
+carried out over an item resp. over which item the mouse click has been
+carried out.
+
+2) last item
+If ButtonStyle has been set, it looks better, if an empty item is
+set at the end which takes up the remaining space.
+In order to do that, you can insert an item with an empty string and
+pass HEADERBAR_FULLSIZE as size. For such an item, you should not set
+HeaderBarItemBits::CLICKABLE, but HeaderBarItemBits::FIXEDPOS.
+
+*************************************************************************/
+
+class ImplHeadItem;
+
+#define WB_BOTTOMBORDER (WinBits(0x0400))
+#define WB_BUTTONSTYLE (WinBits(0x0800))
+#define WB_STDHEADERBAR (WB_BUTTONSTYLE | WB_BOTTOMBORDER)
+
+enum class HeaderBarItemBits
+{
+ NONE = 0x0000,
+ LEFT = 0x0001,
+ CENTER = 0x0002,
+ RIGHT = 0x0004,
+ LEFTIMAGE = 0x0010,
+ RIGHTIMAGE = 0x0020,
+ CLICKABLE = 0x0400,
+ FLAT = 0x0800,
+ DOWNARROW = 0x1000,
+ UPARROW = 0x2000,
+ STDSTYLE = LEFT | LEFTIMAGE | CLICKABLE,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<HeaderBarItemBits> : is_typed_flags<HeaderBarItemBits, 0x3c37> {};
+}
+
+#define HEADERBAR_APPEND (sal_uInt16(0xFFFF))
+#define HEADERBAR_ITEM_NOTFOUND (sal_uInt16(0xFFFF))
+#define HEADERBAR_FULLSIZE (tools::Long(1000000000))
+
+class VCL_DLLPUBLIC HeaderBar : public vcl::Window
+{
+private:
+ std::vector<std::unique_ptr<ImplHeadItem>> mvItemList;
+ tools::Long mnBorderOff1;
+ tools::Long mnBorderOff2;
+ tools::Long mnOffset;
+ tools::Long mnDX;
+ tools::Long mnDY;
+ tools::Long mnDragSize;
+ tools::Long mnStartPos;
+ tools::Long mnDragPos;
+ tools::Long mnMouseOff;
+ sal_uInt16 mnCurItemId;
+ sal_uInt16 mnItemDragPos;
+ bool mbDragable;
+ bool mbDrag;
+ bool mbItemDrag;
+ bool mbOutDrag;
+ bool mbButtonStyle;
+ bool mbItemMode;
+ Link<HeaderBar*,void> maStartDragHdl;
+ Link<HeaderBar*,void> maEndDragHdl;
+ Link<HeaderBar*,void> maSelectHdl;
+ Link<HeaderBar*,void> maCreateAccessibleHdl;
+
+ css::uno::Reference< css::accessibility::XAccessible >
+ mxAccessible;
+
+ using Window::ImplInit;
+ VCL_DLLPRIVATE void ImplInit( WinBits nWinStyle );
+ VCL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
+ VCL_DLLPRIVATE tools::Long ImplGetItemPos( sal_uInt16 nPos ) const;
+ VCL_DLLPRIVATE tools::Rectangle ImplGetItemRect( sal_uInt16 nPos ) const;
+ VCL_DLLPRIVATE sal_uInt16 ImplDoHitTest( const Point& rPos, tools::Long& nMouseOff, sal_uInt16& nPos ) const;
+ VCL_DLLPRIVATE void ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos );
+ VCL_DLLPRIVATE void ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHigh,
+ const tools::Rectangle& rItemRect, const tools::Rectangle* pRect);
+ VCL_DLLPRIVATE void ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHigh,
+ const tools::Rectangle* pRect);
+ VCL_DLLPRIVATE void ImplUpdate( sal_uInt16 nPos,
+ bool bEnd = false );
+ VCL_DLLPRIVATE void ImplStartDrag( const Point& rPos, bool bCommand );
+ VCL_DLLPRIVATE void ImplDrag( const Point& rPos );
+ VCL_DLLPRIVATE void ImplEndDrag( bool bCancel );
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+
+public:
+ HeaderBar( vcl::Window* pParent, WinBits nWinBits );
+ virtual ~HeaderBar() override;
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos,SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual void Command( const CommandEvent& rCEvt ) override;
+ virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual Size GetOptimalSize() const override;
+
+ virtual void EndDrag();
+ virtual void Select();
+ virtual void DoubleClick();
+
+ void InsertItem( sal_uInt16 nItemId, const OUString& rText,
+ tools::Long nSize, HeaderBarItemBits nBits = HeaderBarItemBits::STDSTYLE,
+ sal_uInt16 nPos = HEADERBAR_APPEND );
+ void RemoveItem( sal_uInt16 nItemId );
+ void MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos );
+ void Clear();
+
+ void SetOffset( tools::Long nNewOffset );
+ void SetDragSize( tools::Long nNewSize ) { mnDragSize = nNewSize; }
+
+ sal_uInt16 GetItemCount() const;
+ sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const;
+ sal_uInt16 GetItemId( sal_uInt16 nPos ) const;
+ sal_uInt16 GetItemId( const Point& rPos ) const;
+ tools::Rectangle GetItemRect( sal_uInt16 nItemId ) const;
+ sal_uInt16 GetCurItemId() const { return mnCurItemId; }
+ bool IsItemMode() const { return mbItemMode; }
+
+ void SetItemSize( sal_uInt16 nItemId, tools::Long nNewSize );
+ tools::Long GetItemSize( sal_uInt16 nItemId ) const;
+ void SetItemBits( sal_uInt16 nItemId, HeaderBarItemBits nNewBits );
+ HeaderBarItemBits GetItemBits( sal_uInt16 nItemId ) const;
+
+ void SetItemText( sal_uInt16 nItemId, const OUString& rText );
+ OUString GetItemText( sal_uInt16 nItemId ) const;
+
+ OUString GetHelpText( sal_uInt16 nItemId ) const;
+
+ Size CalcWindowSizePixel() const;
+
+ using Window::SetHelpId;
+
+ void SetStartDragHdl( const Link<HeaderBar*,void>& rLink ) { maStartDragHdl = rLink; }
+ void SetEndDragHdl( const Link<HeaderBar*,void>& rLink ) { maEndDragHdl = rLink; }
+ void SetSelectHdl( const Link<HeaderBar*,void>& rLink ) { maSelectHdl = rLink; }
+ void SetCreateAccessibleHdl( const Link<HeaderBar*,void>& rLink ) { maCreateAccessibleHdl = rLink; }
+
+ bool IsDragable() const { return mbDragable; }
+
+ /** Creates and returns the accessible object of the header bar. */
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+ void SetAccessible( const css::uno::Reference< css::accessibility::XAccessible >& );
+};
+
+#endif // INCLUDED_VCL_HEADBAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/help.hxx b/include/vcl/help.hxx
new file mode 100644
index 000000000..7dc848a42
--- /dev/null
+++ b/include/vcl/help.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_HELP_HXX
+#define INCLUDED_VCL_HELP_HXX
+
+#include <rtl/ustring.hxx>
+#include <vcl/dllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+class Point;
+namespace tools { class Rectangle; }
+namespace vcl { class Window; }
+
+
+enum class QuickHelpFlags
+{
+ NONE = 0x0000,
+ Left = 0x0001,
+ Center = 0x0002,
+ Right = 0x0004,
+ Top = 0x0008,
+ VCenter = 0x0010,
+ Bottom = 0x0020,
+ NoAutoPos = Left | Center | Right | Top | VCenter | Bottom,
+ CtrlText = 0x0040,
+/// force balloon-style in ShowPopover and ShowQuickHelp
+ TipStyleBalloon = 0x0100,
+ NoEvadePointer = 0x0200,
+ BiDiRtl = 0x0400,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<QuickHelpFlags> : is_typed_flags<QuickHelpFlags, 0x77f> {};
+}
+
+#define OOO_HELP_INDEX ".help:index"
+
+namespace weld
+{
+ class Widget;
+}
+
+class VCL_DLLPUBLIC Help
+{
+public:
+ Help();
+ virtual ~Help();
+
+ virtual bool Start(const OUString& rHelpId, weld::Widget* pWidget = nullptr);
+ virtual void SearchKeyword( const OUString& rKeyWord );
+ virtual OUString GetHelpText(const OUString& aHelpURL, const weld::Widget* pWidget);
+
+ virtual bool Start(const OUString& rHelpId, const vcl::Window* pWindow);
+ virtual OUString GetHelpText(const OUString& aHelpURL, const vcl::Window* pWindow);
+
+ static void EnableContextHelp();
+ static void DisableContextHelp();
+ static bool IsContextHelpEnabled();
+
+ static void EnableExtHelp();
+ static void DisableExtHelp();
+ static bool IsExtHelpEnabled();
+ static bool StartExtHelp();
+ static bool EndExtHelp();
+
+ static void EnableBalloonHelp();
+ static void DisableBalloonHelp();
+ static bool IsBalloonHelpEnabled();
+ static void ShowBalloon( vcl::Window* pParent,
+ const Point& rScreenPos,
+ const tools::Rectangle&,
+ const OUString& rHelpText );
+
+ static void EnableQuickHelp();
+ static void DisableQuickHelp();
+ static bool IsQuickHelpEnabled();
+ static void ShowQuickHelp( vcl::Window* pParent,
+ const tools::Rectangle& rScreenRect,
+ const OUString& rHelpText,
+ QuickHelpFlags nStyle = QuickHelpFlags::NONE );
+
+ static void HideBalloonAndQuickHelp();
+
+ static void* ShowPopover(vcl::Window* pParent,
+ const tools::Rectangle& rScreenRect,
+ const OUString& rText,
+ QuickHelpFlags nStyle);
+ static void UpdatePopover(void* nId,
+ vcl::Window* pParent,
+ const tools::Rectangle& rScreenRect,
+ const OUString& rText);
+ static void HidePopover(vcl::Window const * pParent, void* nId);
+};
+
+#endif // INCLUDED_VCL_HELP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/i18nhelp.hxx b/include/vcl/i18nhelp.hxx
new file mode 100644
index 000000000..e5368da08
--- /dev/null
+++ b/include/vcl/i18nhelp.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_I18NHELP_HXX
+#define INCLUDED_VCL_I18NHELP_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <i18nlangtag/languagetag.hxx>
+#include <mutex>
+#include <rtl/ustring.hxx>
+#include <tools/long.hxx>
+#include <vcl/dllapi.h>
+#include <memory>
+
+namespace com::sun::star::uno {
+ class XComponentContext;
+}
+namespace utl {
+ class TransliterationWrapper;
+}
+class LocaleDataWrapper;
+
+namespace vcl
+{
+
+class VCL_DLLPUBLIC I18nHelper
+{
+ mutable std::mutex maMutex;
+ LanguageTag maLanguageTag;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ std::unique_ptr<LocaleDataWrapper> mpLocaleDataWrapper;
+ std::unique_ptr<utl::TransliterationWrapper> mpTransliterationWrapper;
+
+ bool mbTransliterateIgnoreCase;
+
+ SAL_DLLPRIVATE void ImplDestroyWrappers();
+
+ SAL_DLLPRIVATE utl::TransliterationWrapper& ImplGetTransliterationWrapper() const;
+ SAL_DLLPRIVATE LocaleDataWrapper& ImplGetLocaleDataWrapper() const;
+
+public:
+
+ I18nHelper( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const LanguageTag& rLanguageTag );
+ ~I18nHelper();
+
+ sal_Int32 CompareString( const OUString& rStr1, const OUString& rStr2 ) const;
+
+ bool MatchString( const OUString& rStr1, const OUString& rStr2 ) const;
+ bool MatchMnemonic( std::u16string_view rString, sal_Unicode cMnemonicChar ) const;
+
+ OUString GetNum( tools::Long nNumber, sal_uInt16 nDecimals, bool bUseThousandSep = true, bool bTrailingZeros = true ) const;
+
+ static OUString filterFormattingChars( const OUString& );
+};
+
+} // namespace vcl
+
+#endif // INCLUDED_VCL_I18NHELP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx
new file mode 100644
index 000000000..d5162efcb
--- /dev/null
+++ b/include/vcl/idle.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_IDLE_HXX
+#define INCLUDED_VCL_IDLE_HXX
+
+#include <vcl/timer.hxx>
+
+/**
+ * An idle is a timer to be scheduled immediately.
+ *
+ * It's - more or less - just a convenience class.
+ *
+ * Note: Despite the name, the timer is not necessarily invoked when idle.
+ * Use an idle priority such as TaskPriority::DEFAULT_IDLE to actually
+ * invoke the timer only when idle.
+ */
+class VCL_DLLPUBLIC Idle : public Timer
+{
+private:
+ // Delete all timeout specific functions, we don't want in an Idle
+ void SetTimeout( sal_uInt64 nTimeoutMs ) = delete;
+ sal_uInt64 GetTimeout() const = delete;
+
+protected:
+ virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nTimeNow ) const override;
+
+ Idle( bool bAuto, const char *pDebugName );
+
+public:
+ Idle( const char *pDebugName );
+
+ virtual void Start(bool bStartTimer = true) override;
+};
+
+/**
+ * An auto-idle is long running task processing small chunks of data, which
+ * is re-scheduled multiple times.
+ *
+ * Remember to stop the Idle when finished, as it would otherwise busy loop the CPU!
+ *
+ * It probably makes sense to re-implement ReadyForSchedule and UpdateMinPeriod,
+ * in case there is a quick check and it can otherwise sleep.
+ */
+class VCL_DLLPUBLIC AutoIdle : public Idle
+{
+public:
+ AutoIdle( const char *pDebugName );
+};
+
+
+#endif // INCLUDED_VCL_IDLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/image.hxx b/include/vcl/image.hxx
new file mode 100644
index 000000000..6c130bf4c
--- /dev/null
+++ b/include/vcl/image.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_IMAGE_HXX
+#define INCLUDED_VCL_IMAGE_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/gen.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/outdev.hxx>
+
+#include <memory>
+
+class ImplImage;
+
+namespace com::sun::star::graphic { class XGraphic; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+
+#define IMAGELIST_IMAGE_NOTFOUND (sal_uInt16(0xFFFF))
+
+enum class StockImage { Yes };
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC Image
+{
+ friend class ::OutputDevice;
+public:
+ Image();
+ explicit Image(BitmapEx const & rBitmapEx);
+ explicit Image(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic);
+ explicit Image(OUString const & rPNGFileUrl);
+ explicit Image(StockImage, OUString const & rPNGFilePath);
+
+ Size GetSizePixel() const;
+ BitmapEx GetBitmapEx() const;
+
+ bool operator!() const
+ {
+ return !mpImplData;
+ }
+ bool operator==(const Image& rImage) const;
+ bool operator!=(const Image& rImage) const
+ {
+ return !(Image::operator==(rImage));
+ }
+
+ OUString GetStock() const;
+
+ void Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize = nullptr);
+
+private:
+
+ std::shared_ptr<ImplImage> mpImplData;
+
+ SAL_DLLPRIVATE void ImplInit(BitmapEx const & rBmpEx);
+};
+
+#endif // INCLUDED_VCL_IMAGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/imap.hxx b/include/vcl/imap.hxx
new file mode 100644
index 000000000..062392003
--- /dev/null
+++ b/include/vcl/imap.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_IMAP_HXX
+#define INCLUDED_VCL_IMAP_HXX
+
+#include <vcl/imapobj.hxx>
+#include <vcl/dllapi.h>
+#include <tools/stream.hxx>
+#include <tools/solar.h>
+#include <memory>
+#include <vector>
+
+class Point;
+class Size;
+class Fraction;
+class IMapObject;
+
+class VCL_DLLPUBLIC ImageMap final
+{
+private:
+
+ std::vector<std::unique_ptr<IMapObject>> maList;
+ OUString aName;
+
+ // binary saving/loading
+ void ImpWriteImageMap( SvStream& rOStm ) const ;
+ void ImpReadImageMap( SvStream& rIStm, size_t nCount );
+
+ // Import/Export
+ void ImpWriteCERN( SvStream& rOStm ) const;
+ void ImpWriteNCSA( SvStream& rOStm ) const;
+ void ImpReadCERN( SvStream& rOStm );
+ void ImpReadNCSA( SvStream& rOStm );
+
+ void ImpReadCERNLine( std::string_view rLine );
+ static Point ImpReadCERNCoords( const char** ppStr );
+ static tools::Long ImpReadCERNRadius( const char** ppStr );
+ static OUString ImpReadCERNURL( const char** ppStr );
+
+ void ImpReadNCSALine( std::string_view rLine );
+ static OUString ImpReadNCSAURL( const char** ppStr );
+ static Point ImpReadNCSACoords( const char** ppStr );
+
+ static IMapFormat ImpDetectFormat( SvStream& rIStm );
+
+public:
+
+ ImageMap() {};
+ ImageMap( const OUString& rName );
+ ImageMap( const ImageMap& rImageMap );
+
+ // all IMapObjects are destroyed in the destructor
+ ~ImageMap();
+
+ ImageMap& operator=( const ImageMap& rImageMap );
+
+ // comparison (everything is checked for equality)
+ bool operator==( const ImageMap& rImageMap );
+ bool operator!=( const ImageMap& rImageMap );
+
+ // a new IMap object is inserted at the end of the Map
+ void InsertIMapObject( const IMapObject& rIMapObject );
+ void InsertIMapObject( std::unique_ptr<IMapObject> rIMapObject );
+
+ // access to the single ImapObjects; the objects may
+ // not be destroyed from outside
+ IMapObject* GetIMapObject( size_t nPos ) const
+ {
+ return ( nPos < maList.size() ) ? maList[ nPos ].get() : nullptr;
+ }
+
+ // returns the object which was hit first or NULL;
+ // size and position values are in 1/100mm;
+ // rTotalSize is the original size of the image
+ // rDisplaySize is the current size;
+ // rRelPoint relates to the display size and the upper left
+ // corner of the image
+ IMapObject* GetHitIMapObject( const Size& rOriginalSize,
+ const Size& rDisplaySize,
+ const Point& rRelHitPoint,
+ sal_uLong nFlags = 0 );
+
+ // returns the total amount of IMap objects
+ size_t GetIMapObjectCount() const { return maList.size(); }
+
+ // deletes all internal objects
+ void ClearImageMap();
+
+ const OUString& GetName() const { return aName; }
+ void SetName( const OUString& rName ) { aName = rName; }
+
+ // scales all objects of the ImageMap according to the given factor
+ void Scale( const Fraction& rFractX, const Fraction& rFracY );
+
+ // Import/Export
+ void Write ( SvStream& rOStm ) const;
+ void Read( SvStream& rIStm );
+
+ void Write( SvStream& rOStm, IMapFormat nFormat ) const;
+ sal_uLong Read( SvStream& rIStm, IMapFormat nFormat );
+};
+
+class IMapCompat
+{
+ SvStream* pRWStm;
+ sal_uInt64 nCompatPos;
+ sal_uInt64 nTotalSize;
+ StreamMode nStmMode;
+
+ IMapCompat( const IMapCompat& ) = delete;
+ IMapCompat& operator=( const IMapCompat& ) { return *this; }
+
+public:
+
+ IMapCompat( SvStream& rStm, const StreamMode nStreamMode );
+ ~IMapCompat();
+};
+
+#endif // INCLUDED_VCL_IMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/imapcirc.hxx b/include/vcl/imapcirc.hxx
new file mode 100644
index 000000000..4fc5808af
--- /dev/null
+++ b/include/vcl/imapcirc.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_IMAPCIRC_HXX
+#define INCLUDED_VCL_IMAPCIRC_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/gen.hxx>
+#include <vcl/imapobj.hxx>
+
+class Fraction;
+
+class VCL_DLLPUBLIC IMapCircleObject final : public IMapObject
+{
+ Point aCenter;
+ sal_Int32 nRadius;
+
+ void ImpConstruct( const Point& rCenter, sal_Int32 nRad, bool bPixel );
+
+ // binary import/export
+ virtual void WriteIMapObject( SvStream& rOStm ) const override;
+ virtual void ReadIMapObject( SvStream& rIStm ) override;
+
+public:
+
+ IMapCircleObject() : nRadius(0) {}
+ IMapCircleObject( const Point& rCenter, sal_Int32 nRad,
+ const OUString& rURL,
+ const OUString& rAltText,
+ const OUString& rDesc,
+ const OUString& rTarget,
+ const OUString& rName,
+ bool bActive = true,
+ bool bPixelCoords = true );
+
+ virtual IMapObjectType GetType() const override;
+ virtual bool IsHit( const Point& rPoint ) const override;
+
+ Point GetCenter( bool bPixelCoords = true ) const;
+ sal_Int32 GetRadius( bool bPixelCoords = true ) const;
+
+ void Scale( const Fraction& rFractX, const Fraction& rFracY );
+
+ using IMapObject::IsEqual;
+ bool IsEqual( const IMapCircleObject& rEqObj ) const;
+
+ // import/export
+ void WriteCERN( SvStream& rOStm ) const;
+ void WriteNCSA( SvStream& rOStm ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/imapobj.hxx b/include/vcl/imapobj.hxx
new file mode 100644
index 000000000..54498a65c
--- /dev/null
+++ b/include/vcl/imapobj.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_IMAPOBJ_HXX
+#define INCLUDED_VCL_IMAPOBJ_HXX
+
+#include <svl/macitem.hxx>
+#include <rtl/strbuf.hxx>
+
+class Point;
+class SvStream;
+
+enum class IMapObjectType
+{
+ Rectangle = 1,
+ Circle = 2,
+ Polygon = 3
+};
+
+#define IMAP_OBJ_VERSION (sal_uInt16(0x0005))
+#define IMAGE_MAP_VERSION (sal_uInt16(0x0001))
+
+#define IMAPMAGIC "SDIMAP"
+
+#define IMAP_MIRROR_HORZ 0x00000001L
+#define IMAP_MIRROR_VERT 0x00000002L
+
+enum class IMapFormat
+{
+ Binary = 1,
+ CERN = 2,
+ NCSA = 3,
+ Detect = 15,
+};
+
+#define IMAP_ERR_OK 0x00000000L
+#define IMAP_ERR_FORMAT 0x00000001L
+
+class IMapObject
+{
+ friend class ImageMap;
+
+ OUString aURL;
+ OUString aAltText;
+ OUString aDesc;
+ OUString aTarget;
+ OUString aName;
+ SvxMacroTableDtor aEventList;
+ bool bActive;
+
+protected:
+ sal_uInt16 nReadVersion;
+
+ // binary import/export
+ virtual void WriteIMapObject( SvStream& rOStm ) const = 0;
+ virtual void ReadIMapObject( SvStream& rIStm ) = 0;
+
+ // helper methods
+ static void AppendCERNCoords(OStringBuffer& rBuf, const Point& rPoint100);
+ void AppendCERNURL(OStringBuffer& rBuf) const;
+ static void AppendNCSACoords(OStringBuffer& rBuf, const Point& rPoint100);
+ void AppendNCSAURL(OStringBuffer&rBuf) const;
+
+public:
+
+ IMapObject();
+ IMapObject( const OUString& rURL,
+ const OUString& rAltText,
+ const OUString& rDesc,
+ const OUString& rTarget,
+ const OUString& rName,
+ bool bActive );
+ virtual ~IMapObject() {};
+
+ IMapObject(IMapObject const &) = default;
+ IMapObject(IMapObject &&) = default;
+ IMapObject & operator =(IMapObject const &) = default;
+ IMapObject & operator =(IMapObject &&) = default;
+
+ virtual IMapObjectType GetType() const = 0;
+ virtual bool IsHit( const Point& rPoint ) const = 0;
+
+ void Write ( SvStream& rOStm ) const;
+ void Read( SvStream& rIStm );
+
+ const OUString& GetURL() const { return aURL; }
+ void SetURL( const OUString& rURL ) { aURL = rURL; }
+
+ const OUString& GetAltText() const { return aAltText; }
+ void SetAltText( const OUString& rAltText) { aAltText = rAltText; }
+
+ const OUString& GetDesc() const { return aDesc; }
+ void SetDesc( const OUString& rDesc ) { aDesc = rDesc; }
+
+ const OUString& GetTarget() const { return aTarget; }
+ void SetTarget( const OUString& rTarget ) { aTarget = rTarget; }
+
+ const OUString& GetName() const { return aName; }
+ void SetName( const OUString& rName ) { aName = rName; }
+
+ bool IsActive() const { return bActive; }
+ void SetActive( bool bSetActive ) { bActive = bSetActive; }
+
+ bool IsEqual( const IMapObject& rEqObj ) const;
+
+ // IMap-Events
+ const SvxMacroTableDtor& GetMacroTable() const { return aEventList;}
+ void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aEventList = rTbl; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/imappoly.hxx b/include/vcl/imappoly.hxx
new file mode 100644
index 000000000..5a9e80c27
--- /dev/null
+++ b/include/vcl/imappoly.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_IMAPPOLY_HXX
+#define INCLUDED_VCL_IMAPPOLY_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/imapobj.hxx>
+#include <tools/poly.hxx>
+
+class Fraction;
+
+class VCL_DLLPUBLIC IMapPolygonObject final : public IMapObject
+{
+ tools::Polygon aPoly;
+ tools::Rectangle aEllipse;
+ bool bEllipse;
+
+ VCL_DLLPRIVATE void ImpConstruct( const tools::Polygon& rPoly, bool bPixel );
+
+ // binary import/export
+ virtual void WriteIMapObject( SvStream& rOStm ) const override;
+ virtual void ReadIMapObject( SvStream& rIStm ) override;
+
+public:
+ IMapPolygonObject() : bEllipse(false) {}
+ IMapPolygonObject( const tools::Polygon& rPoly,
+ const OUString& rURL,
+ const OUString& rAltText,
+ const OUString& rDesc,
+ const OUString& rTarget,
+ const OUString& rName,
+ bool bActive = true,
+ bool bPixelCoords = true );
+
+ virtual IMapObjectType GetType() const override;
+ virtual bool IsHit( const Point& rPoint ) const override;
+
+ tools::Polygon GetPolygon( bool bPixelCoords = true ) const;
+
+ bool HasExtraEllipse() const { return bEllipse; }
+ const tools::Rectangle& GetExtraEllipse() const { return aEllipse; }
+ void SetExtraEllipse( const tools::Rectangle& rEllipse );
+
+ void Scale( const Fraction& rFractX, const Fraction& rFracY );
+
+ using IMapObject::IsEqual;
+ bool IsEqual( const IMapPolygonObject& rEqObj );
+
+ // import/export
+ void WriteCERN( SvStream& rOStm ) const;
+ void WriteNCSA( SvStream& rOStm ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/imaprect.hxx b/include/vcl/imaprect.hxx
new file mode 100644
index 000000000..6637bb771
--- /dev/null
+++ b/include/vcl/imaprect.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_IMAPRECT_HXX
+#define INCLUDED_VCL_IMAPRECT_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/imapobj.hxx>
+#include <tools/gen.hxx>
+
+class Fraction;
+
+class VCL_DLLPUBLIC IMapRectangleObject final : public IMapObject
+{
+ tools::Rectangle aRect;
+
+ VCL_DLLPRIVATE void ImpConstruct( const tools::Rectangle& rRect, bool bPixel );
+
+ // binary import/export
+ virtual void WriteIMapObject( SvStream& rOStm ) const override;
+ virtual void ReadIMapObject( SvStream& rIStm ) override;
+
+public:
+
+ IMapRectangleObject() {};
+ IMapRectangleObject( const tools::Rectangle& rRect,
+ const OUString& rURL,
+ const OUString& rAltText,
+ const OUString& rDesc,
+ const OUString& rTarget,
+ const OUString& rName,
+ bool bActive = true,
+ bool bPixelCoords = true );
+
+ virtual IMapObjectType GetType() const override;
+ virtual bool IsHit( const Point& rPoint ) const override;
+
+ tools::Rectangle GetRectangle( bool bPixelCoords = true ) const;
+
+ void Scale( const Fraction& rFractX, const Fraction& rFracY );
+
+ using IMapObject::IsEqual;
+ bool IsEqual( const IMapRectangleObject& rEqObj ) const;
+
+ // import/export
+ void WriteCERN( SvStream& rOStm ) const;
+ void WriteNCSA( SvStream& rOStm ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/inetimg.hxx b/include/vcl/inetimg.hxx
new file mode 100644
index 000000000..64d64c122
--- /dev/null
+++ b/include/vcl/inetimg.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_INETIMG_HXX
+#define INCLUDED_VCL_INETIMG_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/gen.hxx>
+#include <sot/formats.hxx>
+
+
+class INetImage
+{
+ OUString aImageURL;
+ OUString aTargetURL;
+ OUString aTargetFrame;
+ Size aSizePixel;
+
+public:
+ INetImage(
+ const OUString& rImageURL,
+ const OUString& rTargetURL,
+ const OUString& rTargetFrame )
+ : aImageURL( rImageURL ),
+ aTargetURL( rTargetURL ),
+ aTargetFrame( rTargetFrame )
+ {}
+ INetImage()
+ {}
+
+ const OUString& GetImageURL() const { return aImageURL; }
+ const OUString& GetTargetURL() const { return aTargetURL; }
+ const OUString& GetTargetFrame() const { return aTargetFrame; }
+
+ // import/export
+ void Write( SvStream& rOStm, SotClipboardFormatId nFormat ) const;
+ bool Read( SvStream& rIStm, SotClipboardFormatId nFormat );
+};
+
+#endif // INCLUDED_VCL_INETIMG_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/inputctx.hxx b/include/vcl/inputctx.hxx
new file mode 100644
index 000000000..25d057b91
--- /dev/null
+++ b/include/vcl/inputctx.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_INPUTCTX_HXX
+#define INCLUDED_VCL_INPUTCTX_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/font.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+
+enum class InputContextFlags
+{
+ NONE = 0x0000,
+ Text = 0x0001,
+ ExtText = 0x0002
+};
+namespace o3tl
+{
+ template<> struct typed_flags<InputContextFlags> : is_typed_flags<InputContextFlags, 0x0003> {};
+}
+
+
+class VCL_DLLPUBLIC InputContext
+{
+private:
+ vcl::Font maFont;
+ InputContextFlags mnOptions;
+
+public:
+ InputContext() { mnOptions = InputContextFlags::NONE; }
+ InputContext( const InputContext& rInputContext ) :
+ maFont( rInputContext.maFont )
+ { mnOptions = rInputContext.mnOptions; }
+ InputContext( const vcl::Font& rFont, InputContextFlags nOptions = InputContextFlags::NONE ) :
+ maFont( rFont )
+ { mnOptions = nOptions; }
+
+ const vcl::Font& GetFont() const { return maFont; }
+
+ void SetOptions( InputContextFlags nOptions ) { mnOptions = nOptions; }
+ InputContextFlags GetOptions() const { return mnOptions; }
+
+ InputContext& operator=( const InputContext& rInputContext );
+ bool operator==( const InputContext& rInputContext ) const;
+ bool operator!=( const InputContext& rInputContext ) const
+ { return !(InputContext::operator==( rInputContext )); }
+};
+
+inline InputContext& InputContext::operator=( const InputContext& rInputContext )
+{
+ maFont = rInputContext.maFont;
+ mnOptions = rInputContext.mnOptions;
+ return *this;
+}
+
+inline bool InputContext::operator==( const InputContext& rInputContext ) const
+{
+ return ((mnOptions == rInputContext.mnOptions) &&
+ (maFont == rInputContext.maFont));
+}
+
+#endif // INCLUDED_VCL_INPUTCTX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/inputtypes.hxx b/include/vcl/inputtypes.hxx
new file mode 100644
index 000000000..c5805084b
--- /dev/null
+++ b/include/vcl/inputtypes.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_INPUTTYPES_HXX
+#define INCLUDED_VCL_INPUTTYPES_HXX
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class VclInputFlags {
+ NONE = 0x0000,
+ MOUSE = 0x0001,
+ KEYBOARD = 0x0002,
+ PAINT = 0x0004,
+ TIMER = 0x0008,
+ OTHER = 0x0010,
+ APPEVENT = 0x0020,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<VclInputFlags> : is_typed_flags<VclInputFlags, 0x003f> {};
+}
+
+#define VCL_INPUT_ANY (VclInputFlags::MOUSE | VclInputFlags::KEYBOARD | VclInputFlags::PAINT | VclInputFlags::TIMER | VclInputFlags::OTHER | VclInputFlags::APPEVENT)
+
+#endif // INCLUDED_VCL_INPUTTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/introwin.hxx b/include/vcl/introwin.hxx
new file mode 100644
index 000000000..8d7d709e4
--- /dev/null
+++ b/include/vcl/introwin.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_INTROWIN_HXX
+#define INCLUDED_VCL_INTROWIN_HXX
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/wrkwin.hxx>
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) IntroWindow : public WorkWindow
+{
+private:
+ SAL_DLLPRIVATE void ImplInitIntroWindowData();
+
+public:
+ IntroWindow();
+ virtual ~IntroWindow() override;
+ virtual void dispose() override;
+};
+
+#endif // INCLUDED_VCL_INTROWIN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/jobset.hxx b/include/vcl/jobset.hxx
new file mode 100644
index 000000000..ff7b5dfb6
--- /dev/null
+++ b/include/vcl/jobset.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_JOBSET_HXX
+#define INCLUDED_VCL_JOBSET_HXX
+
+#include <rtl/ustring.hxx>
+#include <vcl/dllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+class SvStream;
+class ImplJobSetup;
+
+class VCL_DLLPUBLIC JobSetup
+{
+ friend class Printer;
+
+public:
+ JobSetup();
+ JobSetup( const JobSetup& rJob );
+ ~JobSetup();
+
+ JobSetup& operator=( const JobSetup& rJob );
+ JobSetup& operator=( JobSetup&& rJob );
+
+ bool operator==( const JobSetup& rJobSetup ) const;
+ bool operator!=( const JobSetup& rJobSetup ) const
+ { return !(JobSetup::operator==( rJobSetup )); }
+
+ SAL_DLLPRIVATE ImplJobSetup& ImplGetData();
+ SAL_DLLPRIVATE const ImplJobSetup& ImplGetConstData() const;
+
+ OUString const & GetPrinterName() const;
+ bool IsDefault() const;
+
+ friend VCL_DLLPUBLIC SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup );
+ friend VCL_DLLPUBLIC SvStream& WriteJobSetup( SvStream& rOStream, const JobSetup& rJobSetup );
+
+ typedef o3tl::cow_wrapper< ImplJobSetup > ImplType;
+
+private:
+ ImplType mpData;
+};
+
+#endif // INCLUDED_VCL_JOBSET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx
new file mode 100644
index 000000000..6e388a6a3
--- /dev/null
+++ b/include/vcl/jsdialog/executor.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <vcl/uitest/uiobject.hxx>
+#include <vcl/weld.hxx>
+#include <unordered_map>
+
+class LOKTrigger
+{
+public:
+ static void trigger_changed(weld::TextView& rView) { rView.signal_changed(); }
+
+ static void trigger_changed(weld::Entry& rEdit) { rEdit.signal_changed(); }
+
+ static void trigger_changed(weld::ComboBox& rComboBox) { rComboBox.signal_changed(); }
+
+ static void trigger_changed(weld::TreeView& rTreeView) { rTreeView.signal_changed(); }
+
+ static void trigger_changed(weld::IconView& rIconView) { rIconView.signal_selection_changed(); }
+
+ static void trigger_toggled(weld::Toggleable& rButton) { rButton.signal_toggled(); }
+
+ static void trigger_row_activated(weld::TreeView& rTreeView)
+ {
+ rTreeView.signal_row_activated();
+ }
+
+ static void trigger_item_activated(weld::IconView& rIconView)
+ {
+ rIconView.signal_item_activated();
+ }
+
+ static void trigger_clicked(weld::Toolbar& rToolbar, const OString& rIdent)
+ {
+ rToolbar.signal_clicked(rIdent);
+ }
+
+ static void trigger_clicked(weld::Button& rButton) { rButton.signal_clicked(); }
+
+ static void trigger_click(weld::DrawingArea& rDrawingArea, const Point& rPos)
+ {
+ rDrawingArea.click(rPos);
+ }
+
+ static void trigger_value_changed(weld::SpinButton& rSpinButton)
+ {
+ rSpinButton.signal_value_changed();
+ }
+
+ static void trigger_closed(weld::Popover& rPopover) { rPopover.popdown(); }
+
+ static void trigger_key_press(weld::Widget& rWidget, const KeyEvent& rEvent)
+ {
+ rWidget.m_aKeyPressHdl.Call(rEvent);
+ }
+
+ static void trigger_key_release(weld::Widget& rWidget, const KeyEvent& rEvent)
+ {
+ rWidget.m_aKeyReleaseHdl.Call(rEvent);
+ }
+
+ static void command(weld::DrawingArea& rArea, const CommandEvent& rCmd)
+ {
+ rArea.m_aCommandHdl.Call(rCmd);
+ }
+};
+
+namespace jsdialog
+{
+// type used to store key-value pairs to put in the generated messages
+typedef std::unordered_map<std::string, OUString> ActionDataMap;
+
+/// execute action on a widget
+VCL_DLLPUBLIC bool ExecuteAction(const std::string& nWindowId, const OString& rWidget,
+ StringMap& rData);
+/// send full update message to the client
+VCL_DLLPUBLIC void SendFullUpdate(const std::string& nWindowId, const OString& rWidget);
+/// send action message to the client
+VCL_DLLPUBLIC void SendAction(const std::string& nWindowId, const OString& rWidget,
+ std::unique_ptr<ActionDataMap> pData);
+VCL_DLLPUBLIC StringMap jsonToStringMap(const char* pJSON);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/keycod.hxx b/include/vcl/keycod.hxx
new file mode 100644
index 000000000..68841ef85
--- /dev/null
+++ b/include/vcl/keycod.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_KEYCOD_HXX
+#define INCLUDED_VCL_KEYCOD_HXX
+
+#include <rtl/ustring.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/keycodes.hxx>
+
+enum class KeyFuncType : sal_Int32 { DONTKNOW,
+ CUT, COPY, PASTE, UNDO,
+ REDO, DELETE };
+
+namespace vcl
+{
+
+class VCL_DLLPUBLIC KeyCode
+{
+private:
+ sal_uInt16 nKeyCodeAndModifiers;
+ KeyFuncType eFunc;
+
+public:
+ KeyCode() { nKeyCodeAndModifiers = 0; eFunc = KeyFuncType::DONTKNOW; }
+ KeyCode( sal_uInt16 nKey, sal_uInt16 nModifier = 0 );
+ KeyCode( sal_uInt16 nKey, bool bShift, bool bMod1, bool bMod2, bool bMod3 );
+ KeyCode( KeyFuncType eFunction );
+
+ sal_uInt16 GetFullCode() const { return nKeyCodeAndModifiers; }
+ KeyFuncType GetFullFunction() const { return eFunc; }
+
+ sal_uInt16 GetCode() const
+ { return (nKeyCodeAndModifiers & KEY_CODE_MASK); }
+
+ sal_uInt16 GetModifier() const
+ { return (nKeyCodeAndModifiers & KEY_MODIFIERS_MASK); }
+ bool IsShift() const
+ { return ((nKeyCodeAndModifiers & KEY_SHIFT) != 0); }
+ bool IsMod1() const
+ { return ((nKeyCodeAndModifiers & KEY_MOD1) != 0); }
+ bool IsMod2() const
+ { return ((nKeyCodeAndModifiers & KEY_MOD2) != 0); }
+ bool IsMod3() const
+ { return ((nKeyCodeAndModifiers & KEY_MOD3) != 0); }
+ sal_uInt16 GetGroup() const
+ { return (nKeyCodeAndModifiers & KEYGROUP_TYPE); }
+
+ OUString GetName() const;
+
+ bool IsFunction() const
+ { return (eFunc != KeyFuncType::DONTKNOW); }
+
+ KeyFuncType GetFunction() const;
+
+ bool operator ==( const KeyCode& rKeyCode ) const;
+ bool operator !=( const KeyCode& rKeyCode ) const;
+};
+
+} // namespace vcl
+
+inline vcl::KeyCode::KeyCode( sal_uInt16 nKey, sal_uInt16 nModifier )
+{
+ nKeyCodeAndModifiers = nKey | nModifier;
+ eFunc = KeyFuncType::DONTKNOW;
+}
+
+inline vcl::KeyCode::KeyCode( sal_uInt16 nKey, bool bShift, bool bMod1, bool bMod2, bool bMod3 )
+{
+ nKeyCodeAndModifiers = nKey;
+ if( bShift )
+ nKeyCodeAndModifiers |= KEY_SHIFT;
+ if( bMod1 )
+ nKeyCodeAndModifiers |= KEY_MOD1;
+ if( bMod2 )
+ nKeyCodeAndModifiers |= KEY_MOD2;
+ if( bMod3 )
+ nKeyCodeAndModifiers |= KEY_MOD3;
+ eFunc = KeyFuncType::DONTKNOW;
+}
+
+inline bool vcl::KeyCode::operator ==( const vcl::KeyCode& rKeyCode ) const
+{
+ if ( (eFunc == KeyFuncType::DONTKNOW) && (rKeyCode.eFunc == KeyFuncType::DONTKNOW) )
+ return (nKeyCodeAndModifiers == rKeyCode.nKeyCodeAndModifiers);
+ else
+ return (GetFunction() == rKeyCode.GetFunction());
+}
+
+inline bool vcl::KeyCode::operator !=( const vcl::KeyCode& rKeyCode ) const
+{
+ if ( (eFunc == KeyFuncType::DONTKNOW) && (rKeyCode.eFunc == KeyFuncType::DONTKNOW) )
+ return (nKeyCodeAndModifiers != rKeyCode.nKeyCodeAndModifiers);
+ else
+ return (GetFunction() != rKeyCode.GetFunction());
+}
+
+#endif // INCLUDED_VCL_KEYCOD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/keycodes.hxx b/include/vcl/keycodes.hxx
new file mode 100644
index 000000000..e68f176ff
--- /dev/null
+++ b/include/vcl/keycodes.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_KEYCODES_HXX
+#define INCLUDED_VCL_KEYCODES_HXX
+
+#include <com/sun/star/awt/Key.hpp>
+#include <com/sun/star/awt/KeyGroup.hpp>
+#include <o3tl/typed_flags_set.hxx>
+
+constexpr sal_uInt16 KEY_CODE_MASK = 0x0FFF;
+
+// Modifier keys
+constexpr sal_uInt16 KEY_SHIFT = 0x1000;
+constexpr sal_uInt16 KEY_MOD1 = 0x2000;
+constexpr sal_uInt16 KEY_MOD2 = 0x4000;
+constexpr sal_uInt16 KEY_MOD3 = 0x8000;
+constexpr sal_uInt16 KEY_MODIFIERS_MASK = 0xF000;
+
+// Key groups
+constexpr sal_uInt16 KEYGROUP_NUM = css::awt::KeyGroup::NUM;
+constexpr sal_uInt16 KEYGROUP_ALPHA = css::awt::KeyGroup::ALPHA;
+constexpr sal_uInt16 KEYGROUP_FKEYS = css::awt::KeyGroup::FKEYS;
+constexpr sal_uInt16 KEYGROUP_CURSOR = css::awt::KeyGroup::CURSOR;
+constexpr sal_uInt16 KEYGROUP_MISC = css::awt::KeyGroup::MISC;
+constexpr sal_uInt16 KEYGROUP_TYPE = css::awt::KeyGroup::TYPE;
+
+// Key codes
+constexpr sal_uInt16 KEY_0 = css::awt::Key::NUM0;
+constexpr sal_uInt16 KEY_1 = css::awt::Key::NUM1;
+constexpr sal_uInt16 KEY_2 = css::awt::Key::NUM2;
+constexpr sal_uInt16 KEY_3 = css::awt::Key::NUM3;
+constexpr sal_uInt16 KEY_4 = css::awt::Key::NUM4;
+constexpr sal_uInt16 KEY_5 = css::awt::Key::NUM5;
+constexpr sal_uInt16 KEY_6 = css::awt::Key::NUM6;
+constexpr sal_uInt16 KEY_7 = css::awt::Key::NUM7;
+constexpr sal_uInt16 KEY_8 = css::awt::Key::NUM8;
+constexpr sal_uInt16 KEY_9 = css::awt::Key::NUM9;
+
+constexpr sal_uInt16 KEY_A = css::awt::Key::A;
+constexpr sal_uInt16 KEY_B = css::awt::Key::B;
+constexpr sal_uInt16 KEY_C = css::awt::Key::C;
+constexpr sal_uInt16 KEY_D = css::awt::Key::D;
+constexpr sal_uInt16 KEY_E = css::awt::Key::E;
+constexpr sal_uInt16 KEY_F = css::awt::Key::F;
+constexpr sal_uInt16 KEY_G = css::awt::Key::G;
+constexpr sal_uInt16 KEY_H = css::awt::Key::H;
+constexpr sal_uInt16 KEY_I = css::awt::Key::I;
+constexpr sal_uInt16 KEY_J = css::awt::Key::J;
+constexpr sal_uInt16 KEY_K = css::awt::Key::K;
+constexpr sal_uInt16 KEY_L = css::awt::Key::L;
+constexpr sal_uInt16 KEY_M = css::awt::Key::M;
+constexpr sal_uInt16 KEY_N = css::awt::Key::N;
+constexpr sal_uInt16 KEY_O = css::awt::Key::O;
+constexpr sal_uInt16 KEY_P = css::awt::Key::P;
+constexpr sal_uInt16 KEY_Q = css::awt::Key::Q;
+constexpr sal_uInt16 KEY_R = css::awt::Key::R;
+constexpr sal_uInt16 KEY_S = css::awt::Key::S;
+constexpr sal_uInt16 KEY_T = css::awt::Key::T;
+constexpr sal_uInt16 KEY_U = css::awt::Key::U;
+constexpr sal_uInt16 KEY_V = css::awt::Key::V;
+constexpr sal_uInt16 KEY_W = css::awt::Key::W;
+constexpr sal_uInt16 KEY_X = css::awt::Key::X;
+constexpr sal_uInt16 KEY_Y = css::awt::Key::Y;
+constexpr sal_uInt16 KEY_Z = css::awt::Key::Z;
+
+constexpr sal_uInt16 KEY_F1 = css::awt::Key::F1;
+constexpr sal_uInt16 KEY_F2 = css::awt::Key::F2;
+constexpr sal_uInt16 KEY_F3 = css::awt::Key::F3;
+constexpr sal_uInt16 KEY_F4 = css::awt::Key::F4;
+constexpr sal_uInt16 KEY_F5 = css::awt::Key::F5;
+constexpr sal_uInt16 KEY_F6 = css::awt::Key::F6;
+constexpr sal_uInt16 KEY_F7 = css::awt::Key::F7;
+constexpr sal_uInt16 KEY_F8 = css::awt::Key::F8;
+constexpr sal_uInt16 KEY_F9 = css::awt::Key::F9;
+constexpr sal_uInt16 KEY_F10 = css::awt::Key::F10;
+constexpr sal_uInt16 KEY_F11 = css::awt::Key::F11;
+constexpr sal_uInt16 KEY_F12 = css::awt::Key::F12;
+constexpr sal_uInt16 KEY_F13 = css::awt::Key::F13;
+constexpr sal_uInt16 KEY_F14 = css::awt::Key::F14;
+constexpr sal_uInt16 KEY_F15 = css::awt::Key::F15;
+constexpr sal_uInt16 KEY_F16 = css::awt::Key::F16;
+constexpr sal_uInt16 KEY_F17 = css::awt::Key::F17;
+constexpr sal_uInt16 KEY_F18 = css::awt::Key::F18;
+constexpr sal_uInt16 KEY_F19 = css::awt::Key::F19;
+constexpr sal_uInt16 KEY_F20 = css::awt::Key::F20;
+constexpr sal_uInt16 KEY_F21 = css::awt::Key::F21;
+constexpr sal_uInt16 KEY_F22 = css::awt::Key::F22;
+constexpr sal_uInt16 KEY_F23 = css::awt::Key::F23;
+constexpr sal_uInt16 KEY_F24 = css::awt::Key::F24;
+constexpr sal_uInt16 KEY_F25 = css::awt::Key::F25;
+constexpr sal_uInt16 KEY_F26 = css::awt::Key::F26;
+
+constexpr sal_uInt16 KEY_DOWN = css::awt::Key::DOWN;
+constexpr sal_uInt16 KEY_UP = css::awt::Key::UP;
+constexpr sal_uInt16 KEY_LEFT = css::awt::Key::LEFT;
+constexpr sal_uInt16 KEY_RIGHT = css::awt::Key::RIGHT;
+constexpr sal_uInt16 KEY_HOME = css::awt::Key::HOME;
+constexpr sal_uInt16 KEY_END = css::awt::Key::END;
+constexpr sal_uInt16 KEY_PAGEUP = css::awt::Key::PAGEUP;
+constexpr sal_uInt16 KEY_PAGEDOWN = css::awt::Key::PAGEDOWN;
+
+constexpr sal_uInt16 KEY_RETURN = css::awt::Key::RETURN;
+constexpr sal_uInt16 KEY_ESCAPE = css::awt::Key::ESCAPE;
+constexpr sal_uInt16 KEY_TAB = css::awt::Key::TAB;
+constexpr sal_uInt16 KEY_BACKSPACE = css::awt::Key::BACKSPACE;
+constexpr sal_uInt16 KEY_SPACE = css::awt::Key::SPACE;
+constexpr sal_uInt16 KEY_INSERT = css::awt::Key::INSERT;
+constexpr sal_uInt16 KEY_DELETE = css::awt::Key::DELETE;
+
+constexpr sal_uInt16 KEY_ADD = css::awt::Key::ADD;
+constexpr sal_uInt16 KEY_SUBTRACT = css::awt::Key::SUBTRACT;
+constexpr sal_uInt16 KEY_MULTIPLY = css::awt::Key::MULTIPLY;
+constexpr sal_uInt16 KEY_DIVIDE = css::awt::Key::DIVIDE;
+constexpr sal_uInt16 KEY_POINT = css::awt::Key::POINT;
+constexpr sal_uInt16 KEY_COMMA = css::awt::Key::COMMA;
+constexpr sal_uInt16 KEY_LESS = css::awt::Key::LESS;
+constexpr sal_uInt16 KEY_GREATER = css::awt::Key::GREATER;
+constexpr sal_uInt16 KEY_EQUAL = css::awt::Key::EQUAL;
+
+constexpr sal_uInt16 KEY_OPEN = css::awt::Key::OPEN;
+constexpr sal_uInt16 KEY_CUT = css::awt::Key::CUT;
+constexpr sal_uInt16 KEY_COPY = css::awt::Key::COPY;
+constexpr sal_uInt16 KEY_PASTE = css::awt::Key::PASTE;
+constexpr sal_uInt16 KEY_UNDO = css::awt::Key::UNDO;
+constexpr sal_uInt16 KEY_REPEAT = css::awt::Key::REPEAT;
+constexpr sal_uInt16 KEY_FIND = css::awt::Key::FIND;
+constexpr sal_uInt16 KEY_PROPERTIES = css::awt::Key::PROPERTIES;
+constexpr sal_uInt16 KEY_FRONT = css::awt::Key::FRONT;
+constexpr sal_uInt16 KEY_CONTEXTMENU = css::awt::Key::CONTEXTMENU;
+constexpr sal_uInt16 KEY_MENU = css::awt::Key::MENU;
+constexpr sal_uInt16 KEY_HELP = css::awt::Key::HELP;
+constexpr sal_uInt16 KEY_HANGUL_HANJA = css::awt::Key::HANGUL_HANJA;
+constexpr sal_uInt16 KEY_DECIMAL = css::awt::Key::DECIMAL;
+constexpr sal_uInt16 KEY_TILDE = css::awt::Key::TILDE;
+constexpr sal_uInt16 KEY_QUOTELEFT = css::awt::Key::QUOTELEFT;
+constexpr sal_uInt16 KEY_BRACKETLEFT = css::awt::Key::BRACKETLEFT;
+constexpr sal_uInt16 KEY_BRACKETRIGHT = css::awt::Key::BRACKETRIGHT;
+constexpr sal_uInt16 KEY_SEMICOLON = css::awt::Key::SEMICOLON;
+constexpr sal_uInt16 KEY_QUOTERIGHT = css::awt::Key::QUOTERIGHT;
+
+constexpr sal_uInt16 KEY_CAPSLOCK = css::awt::Key::CAPSLOCK;
+constexpr sal_uInt16 KEY_NUMLOCK = css::awt::Key::NUMLOCK;
+constexpr sal_uInt16 KEY_SCROLLLOCK = css::awt::Key::SCROLLLOCK;
+
+// extended Modifier-Keys (only used for modkey events)
+enum class ModKeyFlags
+{
+ NONE = 0x0000,
+ LeftShift = 0x0001,
+ RightShift = 0x0002,
+ LeftMod1 = 0x0004,
+ RightMod1 = 0x0008,
+ LeftMod2 = 0x0010,
+ RightMod2 = 0x0020,
+ LeftMod3 = 0x0040,
+ RightMod3 = 0x0080,
+ Mod1Msk = LeftMod1 | RightMod1, // should be Mod1Mask, but that conflicts with a X.h macro grrrr
+ Mod2Msk = LeftMod2 | RightMod2,
+};
+namespace o3tl
+{
+template <> struct typed_flags<ModKeyFlags> : is_typed_flags<ModKeyFlags, 0x00ff>
+{
+};
+}
+
+enum class KeyIndicatorState
+{
+ NONE = 0x0000,
+ CAPSLOCK = 0x0001,
+ NUMLOCK = 0x0002,
+ SCROLLLOCK = 0x0004
+};
+namespace o3tl
+{
+template <> struct typed_flags<KeyIndicatorState> : is_typed_flags<KeyIndicatorState, 0x0007>
+{
+};
+}
+
+#endif // INCLUDED_VCL_KEYCODES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
new file mode 100644
index 000000000..2296f8097
--- /dev/null
+++ b/include/vcl/layout.hxx
@@ -0,0 +1,842 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_LAYOUT_HXX
+#define INCLUDED_VCL_LAYOUT_HXX
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/ctrl.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/event.hxx>
+#include <vcl/transfer.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/IContext.hxx>
+#include <vcl/commandevent.hxx>
+#include <set>
+
+class HelpEvent;
+class ScrollBar;
+class ScrollBarBox;
+class Splitter;
+
+class VCL_DLLPUBLIC VclContainer : public vcl::Window,
+ public vcl::IContext
+{
+public:
+ VclContainer(vcl::Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN);
+
+ //These take into account the external margins of the rWindow widget
+ //while GetOptimalSize/get_preferred_size and SetPosSizePixel are
+ //oblivious to them
+ static Size getLayoutRequisition(const vcl::Window &rWindow);
+ static void setLayoutPosSize(vcl::Window &rWindow, const Point &rPos, const Size &rSize);
+
+ //applies the allocation pos and size onto rWindow via setLayoutPosSize taking into account
+ //the rWindows alignment desires within that allocation
+ static void setLayoutAllocation(vcl::Window &rWindow, const Point &rPos, const Size &rSize);
+
+ virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
+protected:
+ //these are the two that need to be implemented by
+ //containers, figure out how much space you want...
+ virtual Size calculateRequisition() const = 0;
+ //..and decide what to do when set to this size
+ virtual void setAllocation(const Size &rAllocation) = 0;
+
+ virtual sal_uInt16 getDefaultAccessibleRole() const override;
+
+ // support for screenshot context menu
+ virtual void Command(const CommandEvent& rCEvt) override;
+
+public:
+ //you don't want to override these
+ virtual Size GetOptimalSize() const override;
+ virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize) override;
+ virtual void SetPosPixel(const Point& rAllocPos) override;
+ virtual void SetSizePixel(const Size& rAllocation) override;
+private:
+ bool m_bLayoutDirty;
+};
+
+class VCL_DLLPUBLIC VclBox : public VclContainer
+{
+protected:
+ bool m_bHomogeneous;
+ bool m_bVerticalContainer;
+ int m_nSpacing;
+public:
+ VclBox(vcl::Window *pParent, bool bHomogeneous, int nSpacing)
+ : VclContainer(pParent)
+ , m_bHomogeneous(bHomogeneous)
+ , m_bVerticalContainer(false)
+ , m_nSpacing(nSpacing)
+ {
+ }
+ void set_spacing(int nSpacing)
+ {
+ m_nSpacing = nSpacing;
+ }
+ int get_spacing() const
+ {
+ return m_nSpacing;
+ }
+ void set_homogeneous(bool bHomogeneous)
+ {
+ m_bHomogeneous = bHomogeneous;
+ }
+ bool get_orientation() const
+ {
+ return m_bVerticalContainer;
+ }
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+protected:
+ virtual sal_uInt16 getDefaultAccessibleRole() const override;
+ void accumulateMaxes(const Size &rChildSize, Size &rSize) const;
+ Size finalizeMaxes(const Size &rSize, sal_uInt16 nVisibleChildren) const;
+
+ virtual Size calculateRequisition() const override;
+ virtual void setAllocation(const Size &rAllocation) override;
+
+ virtual tools::Long getPrimaryDimension(const Size &rSize) const = 0;
+ virtual void setPrimaryDimension(Size &rSize, tools::Long) const = 0;
+ virtual tools::Long getPrimaryCoordinate(const Point &rPos) const = 0;
+ virtual void setPrimaryCoordinate(Point &rPos, tools::Long) const = 0;
+ virtual tools::Long getSecondaryDimension(const Size &rSize) const = 0;
+ virtual void setSecondaryDimension(Size &rSize, tools::Long) const = 0;
+
+ virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const = 0;
+};
+
+class VCL_DLLPUBLIC VclVBox : public VclBox
+{
+public:
+ VclVBox(vcl::Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
+ : VclBox(pParent, bHomogeneous, nSpacing)
+ {
+ m_bVerticalContainer = true;
+ }
+protected:
+ virtual tools::Long getPrimaryDimension(const Size &rSize) const override
+ {
+ return rSize.getHeight();
+ }
+ virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
+ {
+ rSize.setHeight(nHeight);
+ }
+ virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
+ {
+ return rPos.getY();
+ }
+ virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
+ {
+ rPos.setY(nPos);
+ }
+ virtual tools::Long getSecondaryDimension(const Size &rSize) const override
+ {
+ return rSize.getWidth();
+ }
+ virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
+ {
+ rSize.setWidth(nWidth);
+ }
+ virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
+ {
+ return rWindow.get_expand() || rWindow.get_vexpand();
+ }
+};
+
+class VCL_DLLPUBLIC VclHBox : public VclBox
+{
+public:
+ VclHBox(vcl::Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
+ : VclBox(pParent, bHomogeneous, nSpacing)
+ {
+ m_bVerticalContainer = false;
+ }
+protected:
+ virtual tools::Long getPrimaryDimension(const Size &rSize) const override
+ {
+ return rSize.getWidth();
+ }
+ virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
+ {
+ rSize.setWidth(nWidth);
+ }
+ virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
+ {
+ return rPos.getX();
+ }
+ virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
+ {
+ rPos.setX(nPos);
+ }
+ virtual tools::Long getSecondaryDimension(const Size &rSize) const override
+ {
+ return rSize.getHeight();
+ }
+ virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
+ {
+ rSize.setHeight(nHeight);
+ }
+ virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
+ {
+ return rWindow.get_expand() || rWindow.get_hexpand();
+ }
+};
+
+enum class VclButtonBoxStyle
+{
+ Default,
+ Spread,
+ Edge,
+ Start,
+ End,
+ Center
+};
+
+class VCL_DLLPUBLIC VclButtonBox : public VclBox
+{
+public:
+ VclButtonBox(vcl::Window *pParent)
+ : VclBox(pParent, false, Application::GetSettings().GetStyleSettings().GetDialogStyle().button_spacing)
+ , m_eLayoutStyle(VclButtonBoxStyle::Default)
+ {
+ }
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+protected:
+ virtual Size calculateRequisition() const override;
+ virtual void setAllocation(const Size &rAllocation) override;
+ Size addSpacing(const Size &rSize, sal_uInt16 nVisibleChildren) const;
+private:
+ VclButtonBoxStyle m_eLayoutStyle;
+ struct Requisition
+ {
+ std::vector<tools::Long> m_aMainGroupDimensions;
+ std::vector<tools::Long> m_aSubGroupDimensions;
+ Size m_aMainGroupSize;
+ Size m_aSubGroupSize;
+ };
+ Requisition calculatePrimarySecondaryRequisitions() const;
+ Size addReqGroups(const VclButtonBox::Requisition &rReq) const;
+};
+
+class VCL_DLLPUBLIC VclVButtonBox : public VclButtonBox
+{
+public:
+ VclVButtonBox(vcl::Window *pParent)
+ : VclButtonBox(pParent)
+ {
+ m_bVerticalContainer = true;
+ }
+protected:
+ virtual tools::Long getPrimaryDimension(const Size &rSize) const override
+ {
+ return rSize.getHeight();
+ }
+ virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
+ {
+ rSize.setHeight(nHeight);
+ }
+ virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
+ {
+ return rPos.getY();
+ }
+ virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
+ {
+ rPos.setY(nPos);
+ }
+ virtual tools::Long getSecondaryDimension(const Size &rSize) const override
+ {
+ return rSize.getWidth();
+ }
+ virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
+ {
+ rSize.setWidth(nWidth);
+ }
+ virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
+ {
+ return rWindow.get_expand() || rWindow.get_vexpand();
+ }
+};
+
+class VCL_DLLPUBLIC VclHButtonBox final : public VclButtonBox
+{
+public:
+ VclHButtonBox(vcl::Window *pParent)
+ : VclButtonBox(pParent)
+ {
+ m_bVerticalContainer = false;
+ }
+private:
+ virtual tools::Long getPrimaryDimension(const Size &rSize) const override
+ {
+ return rSize.getWidth();
+ }
+ virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
+ {
+ rSize.setWidth(nWidth);
+ }
+ virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
+ {
+ return rPos.getX();
+ }
+ virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
+ {
+ rPos.setX(nPos);
+ }
+ virtual tools::Long getSecondaryDimension(const Size &rSize) const override
+ {
+ return rSize.getHeight();
+ }
+ virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
+ {
+ rSize.setHeight(nHeight);
+ }
+ virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
+ {
+ return rWindow.get_expand() || rWindow.get_hexpand();
+ }
+};
+
+class VCL_DLLPUBLIC VclGrid final : public VclContainer
+{
+private:
+ bool m_bRowHomogeneous;
+ bool m_bColumnHomogeneous;
+ int m_nRowSpacing;
+ int m_nColumnSpacing;
+
+public:
+ struct Value
+ {
+ tools::Long m_nValue;
+ bool m_bExpand;
+ Value() : m_nValue(0), m_bExpand(false) {}
+ };
+private:
+
+ Size calculateRequisitionForSpacings(sal_Int32 nRowSpacing, sal_Int32 nColSpacing) const;
+ virtual Size calculateRequisition() const override;
+ virtual void setAllocation(const Size &rAllocation) override;
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+public:
+ VclGrid(vcl::Window *pParent)
+ : VclContainer(pParent)
+ , m_bRowHomogeneous(false), m_bColumnHomogeneous(false)
+ , m_nRowSpacing(0), m_nColumnSpacing(0)
+ {
+ }
+ bool get_row_homogeneous() const
+ {
+ return m_bRowHomogeneous;
+ }
+ bool get_column_homogeneous() const
+ {
+ return m_bColumnHomogeneous;
+ }
+ void set_row_spacing(int nSpacing)
+ {
+ m_nRowSpacing = nSpacing;
+ }
+ void set_column_spacing(int nSpacing)
+ {
+ m_nColumnSpacing = nSpacing;
+ }
+ int get_row_spacing() const
+ {
+ return m_nRowSpacing;
+ }
+ int get_column_spacing() const
+ {
+ return m_nColumnSpacing;
+ }
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) VclBin : public VclContainer
+{
+public:
+ VclBin(vcl::Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN)
+ : VclContainer(pParent, nStyle)
+ {
+ }
+ virtual vcl::Window *get_child();
+ virtual const vcl::Window *get_child() const;
+ virtual Size calculateRequisition() const override;
+ virtual void setAllocation(const Size &rAllocation) override;
+};
+
+class VclPaned : public VclContainer
+{
+protected:
+ VclPtr<Splitter> m_pSplitter;
+ tools::Long m_nPosition;
+
+ VclPaned(vcl::Window *pParent, bool bVertical);
+public:
+ virtual ~VclPaned() override;
+ virtual void dispose() override;
+ tools::Long get_position() const { return m_nPosition; }
+ virtual void set_position(tools::Long nPosition) { m_nPosition = nPosition; }
+};
+
+class VclVPaned final : public VclPaned
+{
+private:
+ DECL_LINK(SplitHdl, Splitter*, void);
+ void arrange(const Size& rAllocation, tools::Long nFirstHeight, tools::Long nSecondHeight);
+
+public:
+ VclVPaned(vcl::Window *pParent);
+ virtual ~VclVPaned() override;
+ virtual Size calculateRequisition() const override;
+ virtual void setAllocation(const Size &rAllocation) override;
+ virtual void set_position(tools::Long nPosition) override;
+};
+
+class VclHPaned final : public VclPaned
+{
+private:
+ DECL_LINK(SplitHdl, Splitter*, void);
+ void arrange(const Size& rAllocation, tools::Long nFirstHeight, tools::Long nSecondHeight);
+
+public:
+ VclHPaned(vcl::Window *pParent);
+ virtual ~VclHPaned() override;
+ virtual Size calculateRequisition() const override;
+ virtual void setAllocation(const Size &rAllocation) override;
+ virtual void set_position(tools::Long nPosition) override;
+};
+
+class VclFrame final : public VclBin
+{
+private:
+ VclPtr<vcl::Window> m_pLabel;
+private:
+ friend class VclBuilder;
+ void designate_label(vcl::Window *pWindow);
+ DECL_LINK(WindowEventListener, VclWindowEvent&, void);
+public:
+ VclFrame(vcl::Window *pParent)
+ : VclBin(pParent)
+ , m_pLabel(nullptr)
+ {
+ }
+ virtual ~VclFrame() override;
+ virtual void dispose() override;
+ void set_label(const OUString &rLabel);
+ OUString get_label() const;
+ virtual vcl::Window *get_child() override;
+ virtual const vcl::Window *get_child() const override;
+ vcl::Window *get_label_widget();
+ const vcl::Window *get_label_widget() const;
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+private:
+ virtual Size calculateRequisition() const override;
+ virtual void setAllocation(const Size &rAllocation) override;
+ virtual OUString getDefaultAccessibleName() const override;
+};
+
+class DisclosureButton;
+class CheckBox;
+
+class VclExpander final : public VclBin
+{
+public:
+ VclExpander(vcl::Window *pParent);
+ virtual ~VclExpander() override;
+ virtual void dispose() override;
+ virtual vcl::Window *get_child() override;
+ virtual const vcl::Window *get_child() const override;
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+ bool get_expanded() const;
+ void set_expanded(bool bExpanded);
+ void set_label(const OUString& rLabel);
+ OUString get_label() const;
+ vcl::Window *get_label_widget();
+ const vcl::Window *get_label_widget() const;
+ virtual void StateChanged(StateChangedType nType) override;
+ void SetExpandedHdl( const Link<VclExpander&,void>& rLink ) { maExpandedHdl = rLink; }
+ virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
+ virtual FactoryFunction GetUITestFactory() const override;
+private:
+ virtual Size calculateRequisition() const override;
+ virtual void setAllocation(const Size &rAllocation) override;
+ bool m_bResizeTopLevel;
+ VclPtr<DisclosureButton> m_pDisclosureButton;
+ Link<VclExpander&,void> maExpandedHdl;
+ DECL_LINK(ClickHdl, CheckBox&, void);
+};
+
+class VclScrolledWindow final : public VclBin
+{
+public:
+ VclScrolledWindow(vcl::Window *pParent );
+ virtual ~VclScrolledWindow() override;
+ virtual void dispose() override;
+ virtual vcl::Window *get_child() override;
+ virtual const vcl::Window *get_child() const override;
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ bool HasVisibleBorder() const { return m_eDrawFrameStyle != DrawFrameStyle::NONE; }
+ ScrollBar& getVertScrollBar() { return *m_pVScroll; }
+ ScrollBar& getHorzScrollBar() { return *m_pHScroll; }
+ Size getVisibleChildSize() const;
+ //set to true to disable the built-in scrolling callbacks to allow the user
+ //to override it
+ void setUserManagedScrolling(bool bUserManagedScrolling) { m_bUserManagedScrolling = bUserManagedScrolling;}
+ void doSetAllocation(const Size &rAllocation, bool bRetryOnFailure);
+private:
+ virtual Size calculateRequisition() const override;
+ virtual void setAllocation(const Size &rAllocation) override;
+ int CalcBorderWidth() const;
+ DECL_LINK(ScrollBarHdl, ScrollBar*, void);
+ void InitScrollBars(const Size &rRequest);
+ virtual bool EventNotify(NotifyEvent& rNEvt) override;
+ bool m_bUserManagedScrolling;
+ tools::Long m_nBorderWidth;
+ DrawFrameStyle m_eDrawFrameStyle;
+ DrawFrameFlags m_eDrawFrameFlags;
+ VclPtr<ScrollBar> m_pVScroll;
+ VclPtr<ScrollBar> m_pHScroll;
+ VclPtr<ScrollBarBox> m_aScrollBarBox;
+};
+
+class VclViewport final : public VclBin
+{
+public:
+ VclViewport(vcl::Window *pParent)
+ : VclBin(pParent, WB_HIDE | WB_CLIPCHILDREN)
+ , m_bInitialAllocation(true)
+ {
+ }
+private:
+ virtual void setAllocation(const Size &rAllocation) override;
+ bool m_bInitialAllocation;
+};
+
+//Enforces that its children are always the same size as itself.
+//Intercepts any Commands intended for its children.
+//
+//by default the Commands are discarded, inherit from this
+//and implement "Command" to get them
+class VclEventBox final : public VclBin
+{
+private:
+ //Any Commands an EventBoxHelper receives are forwarded to its parent
+ //The VclEventBox ensures that m_aEventBoxHelper is the
+ //first child and is transparent, but covers the rest of the children
+ class EventBoxHelper final : public vcl::Window
+ {
+ public:
+ EventBoxHelper(vcl::Window* pParent)
+ : Window(pParent, 0)
+ {
+ SetSizePixel(pParent->GetSizePixel());
+ EnableChildTransparentMode();
+ SetPaintTransparent(true);
+ SetBackground();
+ }
+ virtual void Command(const CommandEvent& rCEvt) override
+ {
+ GetParent()->Command(rCEvt);
+ }
+ };
+
+ VclPtr<EventBoxHelper> m_aEventBoxHelper;
+ virtual void dispose() override;
+ virtual ~VclEventBox() override;
+public:
+ VclEventBox(vcl::Window* pParent)
+ : VclBin(pParent)
+ , m_aEventBoxHelper(VclPtr<EventBoxHelper>::Create(this))
+ {
+ m_aEventBoxHelper->Show();
+ }
+ virtual vcl::Window *get_child() override;
+ virtual const vcl::Window *get_child() const override;
+ virtual Size calculateRequisition() const override;
+ virtual void setAllocation(const Size &rAllocation) override;
+
+ virtual void Command(const CommandEvent& rCEvt) override;
+};
+
+class VclSizeGroup
+{
+private:
+ std::set< VclPtr<vcl::Window> > m_aWindows;
+ bool m_bIgnoreHidden;
+ VclSizeGroupMode m_eMode;
+
+ void trigger_queue_resize();
+public:
+ VclSizeGroup()
+ : m_bIgnoreHidden(false)
+ , m_eMode(VclSizeGroupMode::Horizontal)
+ {
+ }
+ void insert(vcl::Window *pWindow)
+ {
+ m_aWindows.insert(VclPtr<vcl::Window>(pWindow));
+ }
+ void erase(vcl::Window *pWindow)
+ {
+ m_aWindows.erase(VclPtr<vcl::Window>(pWindow));
+ }
+ const std::set< VclPtr<vcl::Window> >& get_widgets() const
+ {
+ return m_aWindows;
+ }
+ std::set< VclPtr<vcl::Window> >& get_widgets()
+ {
+ return m_aWindows;
+ }
+ void set_ignore_hidden(bool bIgnoreHidden);
+ bool get_ignore_hidden() const
+ {
+ return m_bIgnoreHidden;
+ }
+ void set_mode(VclSizeGroupMode eMode);
+ VclSizeGroupMode get_mode() const
+ {
+ return m_eMode;
+ }
+ void set_property(const OString &rKey, const OUString &rValue);
+};
+
+class VCL_DLLPUBLIC VclDrawingArea final : public Control
+ , public DragSourceHelper
+{
+private:
+ FactoryFunction m_pFactoryFunction;
+ void* m_pUserData;
+ rtl::Reference<TransferDataContainer> m_xTransferHelper;
+ sal_Int8 m_nDragAction;
+ Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void> m_aPaintHdl;
+ Link<const Size&, void> m_aResizeHdl;
+ Link<const MouseEvent&, bool> m_aMousePressHdl;
+ Link<const MouseEvent&, bool> m_aMouseMotionHdl;
+ Link<const MouseEvent&, bool> m_aMouseReleaseHdl;
+ Link<const KeyEvent&, bool> m_aKeyPressHdl;
+ Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
+ Link<VclDrawingArea&, void> m_aStyleUpdatedHdl;
+ Link<const CommandEvent&, bool> m_aCommandHdl;
+ Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl;
+ Link<OUString&, int> m_aGetSurroundingHdl;
+ Link<const Selection&, bool> m_aDeleteSurroundingHdl;
+ Link<VclDrawingArea*, bool> m_aStartDragHdl;
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
+ {
+ m_aPaintHdl.Call(std::pair<vcl::RenderContext&, const tools::Rectangle&>(rRenderContext, rRect));
+ }
+ virtual void Resize() override
+ {
+ m_aResizeHdl.Call(GetOutputSizePixel());
+ }
+ virtual void MouseMove(const MouseEvent& rMEvt) override
+ {
+ if (!m_aMouseMotionHdl.Call(rMEvt))
+ Control::MouseMove(rMEvt);
+ }
+ virtual void KeyInput(const KeyEvent& rKEvt) override
+ {
+ if (!m_aKeyPressHdl.Call(rKEvt))
+ Control::KeyInput(rKEvt);
+
+ }
+ virtual void KeyUp(const KeyEvent& rKEvt) override
+ {
+ if (!m_aKeyReleaseHdl.Call(rKEvt))
+ Control::KeyUp(rKEvt);
+ }
+ virtual void StateChanged(StateChangedType nType) override
+ {
+ Control::StateChanged(nType);
+ if (nType == StateChangedType::ControlForeground || nType == StateChangedType::ControlBackground)
+ {
+ m_aStyleUpdatedHdl.Call(*this);
+ Invalidate();
+ }
+ }
+ virtual void DataChanged(const DataChangedEvent& rDCEvt) override
+ {
+ Control::DataChanged(rDCEvt);
+ if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
+ {
+ m_aStyleUpdatedHdl.Call(*this);
+ Invalidate();
+ }
+ }
+ virtual void Command(const CommandEvent& rEvent) override
+ {
+ if (m_aCommandHdl.Call(rEvent))
+ return;
+ Control::Command(rEvent);
+ }
+ virtual void RequestHelp(const HelpEvent& rHelpEvent) override;
+ virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override;
+ virtual FactoryFunction GetUITestFactory() const override;
+
+public:
+ VclDrawingArea(vcl::Window *pParent, WinBits nStyle)
+ : Control(pParent, nStyle)
+ , DragSourceHelper(this)
+ , m_pFactoryFunction(nullptr)
+ , m_pUserData(nullptr)
+ , m_nDragAction(0)
+ {
+ SetBackground();
+ }
+ virtual void MouseButtonDown(const MouseEvent& rMEvt) override
+ {
+ if (!m_aMousePressHdl.Call(rMEvt))
+ Control::MouseButtonDown(rMEvt);
+ }
+ virtual void MouseButtonUp(const MouseEvent& rMEvt) override
+ {
+ if (!m_aMouseReleaseHdl.Call(rMEvt))
+ Control::MouseButtonUp(rMEvt);
+ }
+ virtual OUString GetSurroundingText() const override;
+ virtual Selection GetSurroundingTextSelection() const override;
+ virtual bool DeleteSurroundingText(const Selection& rSelection) override;
+ void SetUITestFactory(FactoryFunction pFactoryFunction, void* pUserData)
+ {
+ m_pFactoryFunction = pFactoryFunction;
+ m_pUserData = pUserData;
+ }
+ void* GetUserData() const
+ {
+ return m_pUserData;
+ }
+ void SetPaintHdl(const Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>& rLink)
+ {
+ m_aPaintHdl = rLink;
+ }
+ void SetResizeHdl(const Link<const Size&, void>& rLink)
+ {
+ m_aResizeHdl = rLink;
+ }
+ void SetMousePressHdl(const Link<const MouseEvent&, bool>& rLink)
+ {
+ m_aMousePressHdl = rLink;
+ }
+ void SetMouseMoveHdl(const Link<const MouseEvent&, bool>& rLink)
+ {
+ m_aMouseMotionHdl = rLink;
+ }
+ void SetMouseReleaseHdl(const Link<const MouseEvent&, bool>& rLink)
+ {
+ m_aMouseReleaseHdl = rLink;
+ }
+ void SetKeyPressHdl(const Link<const KeyEvent&, bool>& rLink)
+ {
+ m_aKeyPressHdl = rLink;
+ }
+ void SetKeyReleaseHdl(const Link<const KeyEvent&, bool>& rLink)
+ {
+ m_aKeyReleaseHdl = rLink;
+ }
+ void SetStyleUpdatedHdl(const Link<VclDrawingArea&, void>& rLink)
+ {
+ m_aStyleUpdatedHdl = rLink;
+ }
+ void SetCommandHdl(const Link<const CommandEvent&, bool>& rLink)
+ {
+ m_aCommandHdl = rLink;
+ }
+ void SetQueryTooltipHdl(const Link<tools::Rectangle&, OUString>& rLink)
+ {
+ m_aQueryTooltipHdl = rLink;
+ }
+ void SetGetSurroundingHdl(const Link<OUString&, int>& rLink)
+ {
+ m_aGetSurroundingHdl = rLink;
+ }
+ void SetDeleteSurroundingHdl(const Link<const Selection&, bool>& rLink)
+ {
+ m_aDeleteSurroundingHdl = rLink;
+ }
+ void SetStartDragHdl(const Link<VclDrawingArea*, bool>& rLink)
+ {
+ m_aStartDragHdl = rLink;
+ }
+ void SetDragHelper(const rtl::Reference<TransferDataContainer>& rHelper, sal_uInt8 eDNDConstants)
+ {
+ m_xTransferHelper = rHelper;
+ m_nDragAction = eDNDConstants;
+ }
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+};
+
+//Get first window of a pTopLevel window as
+//if any intermediate layout widgets didn't exist
+//i.e. acts like pChild = pChild->GetWindow(GetWindowType::FirstChild);
+//in a flat hierarchy where dialogs only have one layer
+//of children
+vcl::Window* firstLogicalChildOfParent(const vcl::Window *pTopLevel);
+
+//Get last window of a pTopLevel window as
+//if any intermediate layout widgets didn't exist
+//i.e. acts like pChild = pChild->GetWindow(GetWindowType::LastChild);
+//in a flat hierarchy where dialogs only have one layer
+//of children
+vcl::Window* lastLogicalChildOfParent(const vcl::Window *pTopLevel);
+
+//Get next window after pChild of a pTopLevel window as
+//if any intermediate layout widgets didn't exist
+//i.e. acts like pChild = pChild->GetWindow(GetWindowType::Next);
+//in a flat hierarchy where dialogs only have one layer
+//of children
+vcl::Window* nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
+
+//Get previous window before pChild of a pTopLevel window as
+//if any intermediate layout widgets didn't exist
+//i.e. acts like pChild = pChild->GetWindow(GetWindowType::Prev);
+//in a flat hierarchy where dialogs only have one layer
+//of children
+vcl::Window* prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
+
+//Returns true is the Window has a single child which is a container
+VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow);
+
+inline bool isContainerWindow(const vcl::Window &rWindow)
+{
+ WindowType eType = rWindow.GetType();
+ return eType == WindowType::CONTAINER || eType == WindowType::SCROLLWINDOW ||
+ (eType == WindowType::DOCKINGWINDOW && ::isLayoutEnabled(&rWindow));
+}
+
+inline bool isContainerWindow(const vcl::Window *pWindow)
+{
+ return pWindow && isContainerWindow(*pWindow);
+}
+
+// retro-fitting utilities
+
+//Get a Size which is large enough to contain all children with
+//an equal amount of space at top left and bottom right
+Size getLegacyBestSizeForChildren(const vcl::Window &rWindow);
+
+//Get first parent which is not a layout widget
+vcl::Window* getNonLayoutParent(vcl::Window *pParent);
+
+//Sort ok/cancel etc buttons in platform order
+void sort_native_button_order(const VclBox& rContainer);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/lazydelete.hxx b/include/vcl/lazydelete.hxx
new file mode 100644
index 000000000..397bde883
--- /dev/null
+++ b/include/vcl/lazydelete.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_LAZYDELETE_HXX
+#define INCLUDED_VCL_LAZYDELETE_HXX
+
+#include <vcl/dllapi.h>
+
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <optional>
+
+namespace vcl
+{
+ /*
+ You may not access vcl objects after DeInitVCL has been called this includes their destruction
+ therefore disallowing the existence of static vcl object like e.g. a static BitmapEx
+ To work around this use DeleteOnDeinit<BitmapEx> which will allow you to have a static object container,
+ that will have its contents destroyed on DeinitVCL. The single drawback is that you need to check on the
+ container object whether it still contains content before actually accessing it.
+
+ caveat: when constructing a vcl object, you certainly want to ensure that InitVCL has run already.
+ However this is not necessarily the case when using a class static member or a file level static variable.
+ In these cases make judicious use of the set() method of DeleteOnDeinit, but beware of the changing
+ ownership.
+
+ example use case: use a lazy initialized on call BitmapEx in a paint method. Of course a paint method
+ would not normally be called after DeInitVCL anyway, so the check might not be necessary in a
+ Window::Paint implementation, but always checking is a good idea.
+
+ SomeWindow::Paint()
+ {
+ static vcl::DeleteOnDeinit< BitmapEx > aBmp( new BitmapEx( ... ) );
+
+ if( aBmp.get() ) // check whether DeInitVCL has been called already
+ DrawBitmapEx( Point( 10, 10 ), *aBmp );
+ }
+ */
+
+ class VCL_DLLPUBLIC DeleteOnDeinitBase
+ {
+ public:
+ static void SAL_DLLPRIVATE ImplDeleteOnDeInit();
+ virtual ~DeleteOnDeinitBase();
+ protected:
+ static void addDeinitContainer( DeleteOnDeinitBase* i_pContainer );
+
+ virtual void doCleanup() = 0;
+ };
+
+ enum class DeleteOnDeinitFlag { Empty };
+
+ template < typename T >
+ class DeleteOnDeinit final : public DeleteOnDeinitBase
+ {
+ std::optional<T> m_pT;
+ virtual void doCleanup() override { m_pT.reset(); }
+ public:
+ template <class... Args >
+ DeleteOnDeinit(Args&&... args )
+ {
+ m_pT.emplace(args...);
+ addDeinitContainer( this );
+ }
+ DeleteOnDeinit(DeleteOnDeinitFlag)
+ {
+ addDeinitContainer( this );
+ }
+
+ // get contents
+ T* get() { return m_pT ? &*m_pT : nullptr; }
+
+ // set contents, returning old contents
+ // ownership is transferred !
+ template <class... Args >
+ std::optional<T> set(Args&&... args)
+ {
+ auto pOld = std::move(m_pT);
+ m_pT.emplace(args...);
+ return pOld;
+ }
+ };
+
+ /** Similar to DeleteOnDeinit, the DeleteUnoReferenceOnDeinit
+ template class makes sure that a static UNO object is disposed
+ and released at the right time.
+
+ Use like
+ static DeleteUnoReferenceOnDeinit<lang::XMultiServiceFactory>
+ xStaticFactory (\<create factory object>);
+ Reference<lang::XMultiServiceFactory> xFactory (xStaticFactory.get());
+ if (xFactory.is())
+ \<do something with xFactory>
+ */
+ template <typename I>
+ class DeleteUnoReferenceOnDeinit final : public vcl::DeleteOnDeinitBase
+ {
+ css::uno::Reference<I> m_xI;
+ virtual void doCleanup() override { set(nullptr); }
+ public:
+ DeleteUnoReferenceOnDeinit(const css::uno::Reference<I>& r_xI ) : m_xI( r_xI ) {
+ addDeinitContainer( this ); }
+
+ css::uno::Reference<I> get() { return m_xI; }
+
+ void set (const css::uno::Reference<I>& r_xNew )
+ {
+ css::uno::Reference< css::lang::XComponent> xComponent (m_xI, css::uno::UNO_QUERY);
+ m_xI = r_xNew;
+ if (xComponent.is()) try
+ {
+ xComponent->dispose();
+ }
+ catch( css::uno::Exception& )
+ {
+ }
+ }
+ };
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/lineinfo.hxx b/include/vcl/lineinfo.hxx
new file mode 100644
index 000000000..064435995
--- /dev/null
+++ b/include/vcl/lineinfo.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_LINEINFO_HXX
+#define INCLUDED_VCL_LINEINFO_HXX
+
+#include <sal/types.h>
+#include <vcl/dllapi.h>
+#include <vcl/vclenum.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+#include <vector>
+
+class SvStream;
+namespace basegfx { class B2DPolyPolygon; }
+
+struct ImplLineInfo
+{
+ double mnWidth;
+ double mnDashLen;
+ double mnDotLen;
+ double mnDistance;
+
+ basegfx::B2DLineJoin meLineJoin;
+ css::drawing::LineCap meLineCap;
+ LineStyle meStyle;
+
+ sal_uInt16 mnDashCount;
+ sal_uInt16 mnDotCount;
+
+ ImplLineInfo();
+
+ bool operator==( const ImplLineInfo& ) const;
+};
+
+
+class VCL_DLLPUBLIC LineInfo
+{
+public:
+ LineInfo( LineStyle eLineStyle = LineStyle::Solid, double nWidth = 0 );
+ LineInfo( const LineInfo& rLineInfo );
+ LineInfo( LineInfo&& rLineInfo );
+ ~LineInfo();
+
+ LineInfo& operator=( const LineInfo& rLineInfo );
+ LineInfo& operator=( LineInfo&& rLineInfo );
+ bool operator==( const LineInfo& rLineInfo ) const;
+ bool operator!=( const LineInfo& rLineInfo ) const { return !(LineInfo::operator==( rLineInfo ) ); }
+
+ void SetStyle( LineStyle eStyle );
+ LineStyle GetStyle() const { return mpImplLineInfo->meStyle; }
+
+ void SetWidth( double nWidth );
+ double GetWidth() const { return mpImplLineInfo->mnWidth; }
+
+ void SetDashCount( sal_uInt16 nDashCount );
+ sal_uInt16 GetDashCount() const { return mpImplLineInfo->mnDashCount; }
+
+ void SetDashLen( double nDashLen );
+ double GetDashLen() const { return mpImplLineInfo->mnDashLen; }
+
+ void SetDotCount( sal_uInt16 nDotCount );
+ sal_uInt16 GetDotCount() const { return mpImplLineInfo->mnDotCount; }
+
+ void SetDotLen( double nDotLen );
+ double GetDotLen() const { return mpImplLineInfo->mnDotLen; }
+
+ void SetDistance( double nDistance );
+ double GetDistance() const { return mpImplLineInfo->mnDistance; }
+
+ /// Get an array of "on" and "off" lengths for stroke dashing
+ std::vector< double > GetDotDashArray() const;
+
+ void SetLineJoin(basegfx::B2DLineJoin eLineJoin);
+ basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; }
+
+ void SetLineCap(css::drawing::LineCap eLineCap);
+ css::drawing::LineCap GetLineCap() const { return mpImplLineInfo->meLineCap; }
+
+ bool IsDefault() const;
+
+ friend SvStream& ReadLineInfo( SvStream& rIStm, LineInfo& rLineInfo );
+ friend SvStream& WriteLineInfo( SvStream& rOStm, const LineInfo& rLineInfo );
+
+ // helper to get decomposed polygon data with the LineInfo applied. The source
+ // hairline polygon is given in io_rLinePolyPolygon. Both given polygons may
+ // contain results; e.g. when no fat line but DashDot is defined, the result will
+ // be in io_rLinePolyPolygon while o_rFillPolyPolygon will be empty. When fat line
+ // is defined, it will be vice-versa. If none is defined, io_rLinePolyPolygon will
+ // not be changed (but o_rFillPolyPolygon will be freed)
+ void applyToB2DPolyPolygon(
+ basegfx::B2DPolyPolygon& io_rLinePolyPolygon,
+ basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const;
+
+private:
+ o3tl::cow_wrapper< ImplLineInfo > mpImplLineInfo;
+};
+
+#endif // INCLUDED_VCL_LINEINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/locktoplevels.hxx b/include/vcl/locktoplevels.hxx
new file mode 100644
index 000000000..9d0bf5f39
--- /dev/null
+++ b/include/vcl/locktoplevels.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <memory>
+
+namespace weld
+{
+class Widget;
+}
+
+struct TopLevelWindowLockerImpl;
+
+class VCL_DLLPUBLIC TopLevelWindowLocker
+{
+private:
+ std::unique_ptr<TopLevelWindowLockerImpl> m_xImpl;
+
+public:
+ TopLevelWindowLocker();
+ ~TopLevelWindowLocker();
+
+ // lock all toplevels, except the argument
+ void incBusy(const weld::Widget* pIgnore);
+ // unlock previous lock
+ void decBusy();
+ bool isBusy() const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/lok.hxx b/include/vcl/lok.hxx
new file mode 100644
index 000000000..108f46def
--- /dev/null
+++ b/include/vcl/lok.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_LOK_HXX
+#define INCLUDED_VCL_LOK_HXX
+
+#include <sal/config.h>
+#include <vcl/dllapi.h>
+#include <LibreOfficeKit/LibreOfficeKitTypes.h>
+
+namespace vcl::lok
+{
+bool VCL_DLLPUBLIC isUnipoll();
+void VCL_DLLPUBLIC registerPollCallbacks(LibreOfficeKitPollCallback pPollCallback,
+ LibreOfficeKitWakeCallback pWakeCallback, void* pData);
+void VCL_DLLPUBLIC unregisterPollCallbacks();
+
+// Called to tell VCL that the number of document views has changed, so that VCL
+// can adjust e.g. sizes of bitmap caches to scale well with larger number of users.
+void VCL_DLLPUBLIC numberOfViewsChanged(int count);
+}
+
+#endif // INCLUDE_VCL_LOK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/mapmod.hxx b/include/vcl/mapmod.hxx
new file mode 100644
index 000000000..f3c937a5f
--- /dev/null
+++ b/include/vcl/mapmod.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_MAPMOD_HXX
+#define INCLUDED_VCL_MAPMOD_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/mapunit.hxx>
+#include <o3tl/cow_wrapper.hxx>
+
+#include <ostream>
+
+class Point;
+class Fraction;
+class SvStream;
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC MapMode
+{
+ friend class OutputDevice;
+
+public:
+ struct SAL_DLLPRIVATE ImplMapMode;
+
+ MapMode();
+ MapMode( const MapMode& rMapMode );
+ explicit MapMode( MapUnit eUnit );
+ MapMode( MapUnit eUnit, const Point& rLogicOrg,
+ const Fraction& rScaleX, const Fraction& rScaleY );
+ ~MapMode();
+
+ void SetMapUnit( MapUnit eUnit );
+ MapUnit GetMapUnit() const;
+
+ void SetOrigin( const Point& rOrigin );
+ const Point& GetOrigin() const;
+
+ void SetScaleX( const Fraction& rScaleX );
+ const Fraction& GetScaleX() const;
+ void SetScaleY( const Fraction& rScaleY );
+ const Fraction& GetScaleY() const;
+
+ MapMode& operator=( const MapMode& rMapMode );
+ MapMode& operator=( MapMode&& rMapMode );
+ bool operator==( const MapMode& rMapMode ) const;
+ bool operator!=( const MapMode& rMapMode ) const
+ {
+ return !(MapMode::operator==( rMapMode ));
+ }
+ bool IsDefault() const;
+
+ // Compute value usable as hash.
+ size_t GetHashValue() const;
+
+ // tdf#117984 needs to be thread-safe due to being used e.g. in Bitmaps
+ // vcl::ScopedBitmapAccess in parallelized 3D renderer
+ typedef o3tl::cow_wrapper< ImplMapMode, o3tl::ThreadSafeRefCountingPolicy > ImplType;
+
+ // If only the map unit is set.
+ bool IsSimple() const;
+
+private:
+ ImplType mpImplMapMode;
+};
+
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & rStream, const MapMode& rMode)
+{
+ rStream << "MapMode(" << static_cast<unsigned>(rMode.GetMapUnit()) << ",(" << rMode.GetScaleX() << "," << rMode.GetScaleY() << ")@(" << rMode.GetOrigin() << "))";
+ return rStream;
+}
+
+bool TooLargeScaleForMapMode(const Fraction& rScale, int nDPI);
+
+#endif // INCLUDED_VCL_MAPMOD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
new file mode 100644
index 000000000..54df7ee66
--- /dev/null
+++ b/include/vcl/menu.hxx
@@ -0,0 +1,539 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_MENU_HXX
+#define INCLUDED_VCL_MENU_HXX
+
+#include <memory>
+#include <string_view>
+
+#include <vcl/vclenum.hxx>
+#include <tools/link.hxx>
+#include <tools/long.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/keycod.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/vclreferencebase.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <list>
+
+class OutputDevice;
+struct ImplSVEvent;
+struct MenuItemData;
+class Point;
+class Size;
+namespace tools { class Rectangle; }
+class Menu;
+class MenuItemList;
+class Image;
+class PopupMenu;
+class KeyEvent;
+class MenuFloatingWindow;
+class SalMenu;
+class MenuBarWindow;
+class VclMenuEvent;
+struct SystemMenuData;
+enum class FloatWinPopupFlags;
+enum class VclEventId;
+
+namespace com::sun::star::awt { class XPopupMenu; }
+namespace com::sun::star::accessibility { class XAccessible; }
+
+namespace vcl
+{
+class Window;
+struct MenuLayoutData;
+typedef OutputDevice RenderContext; // same as in include/vcl/outdev.hxx
+class ILibreOfficeKitNotifier;
+}
+
+constexpr sal_uInt16 MENU_APPEND = 0xFFFF;
+constexpr sal_uInt16 MENU_ITEM_NOTFOUND = 0xFFFF;
+
+// Must match the definitions in css::awt::PopupMenuDirection.idl
+enum class PopupMenuFlags
+{
+ NONE = 0x0000,
+ ExecuteDown = 0x0001,
+ ExecuteUp = 0x0002,
+ ExecuteRight = 0x0008,
+ NoMouseUpClose = 0x0010,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<PopupMenuFlags> : is_typed_flags<PopupMenuFlags, 0x001b> {};
+}
+
+enum class MenuFlags
+{
+ NONE = 0x0000,
+ NoAutoMnemonics = 0x0001,
+ HideDisabledEntries = 0x0002,
+ // overrides default hiding of disabled entries in popup menus
+ AlwaysShowDisabledEntries = 0x0004,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<MenuFlags> : is_typed_flags<MenuFlags, 0x0007> {};
+}
+
+/// Invalid menu item id
+constexpr auto ITEMPOS_INVALID = 0xFFFF;
+
+struct ImplMenuDelData
+{
+ ImplMenuDelData* mpNext;
+ VclPtr<const Menu> mpMenu;
+
+ explicit ImplMenuDelData( const Menu* );
+ ~ImplMenuDelData();
+
+ bool isDeleted() const { return mpMenu == nullptr; }
+};
+
+typedef void (*MenuUserDataReleaseFunction)(void*);
+
+class VCL_DLLPUBLIC Menu : public VclReferenceBase
+{
+ friend class MenuBar;
+ friend class MenuBarWindow;
+ friend class MenuButton;
+ friend class MenuFloatingWindow;
+ friend class PopupMenu;
+ friend class SystemWindow;
+ friend struct ImplMenuDelData;
+private:
+ ImplMenuDelData* mpFirstDel;
+ std::unique_ptr<MenuItemList> pItemList; // list with MenuItems
+ VclPtr<Menu> pStartedFrom;
+ VclPtr<vcl::Window> pWindow;
+
+ Link<Menu*, bool> aActivateHdl; // Active-Handler
+ Link<Menu*, bool> aDeactivateHdl; // Deactivate-Handler
+ Link<Menu*, bool> aSelectHdl; // Select-Handler
+
+ std::list<Link<VclMenuEvent&,void> > maEventListeners;
+
+ OUString maID;
+
+ OUString aTitleText; // PopupMenu text
+ sal_uInt16 nTitleHeight;
+
+ ImplSVEvent* nEventId;
+ sal_uInt16 mnHighlightedItemPos; // for native menus: keeps track of the highlighted item
+ MenuFlags nMenuFlags;
+ sal_uInt16 nSelectedId;
+ OString sSelectedIdent;
+
+ // for output:
+ sal_uInt16 nImgOrChkPos;
+ sal_uInt16 nTextPos;
+
+ bool bCanceled : 1; ///< Terminated during a callback
+ bool bInCallback : 1; ///< In Activate/Deactivate
+ bool bKilled : 1; ///< Killed
+
+ css::uno::Reference<css::accessibility::XAccessible > mxAccessible;
+ mutable std::unique_ptr<vcl::MenuLayoutData> mpLayoutData;
+ std::unique_ptr<SalMenu> mpSalMenu;
+
+protected:
+ SAL_DLLPRIVATE Menu* ImplGetStartMenu();
+ SAL_DLLPRIVATE Menu* ImplFindSelectMenu();
+ SAL_DLLPRIVATE Menu* ImplFindMenu( sal_uInt16 nId );
+ SAL_DLLPRIVATE Size ImplCalcSize( vcl::Window* pWin );
+ SAL_DLLPRIVATE bool ImplIsVisible( sal_uInt16 nPos ) const;
+ SAL_DLLPRIVATE bool ImplCurrentlyHiddenOnGUI(sal_uInt16 nPos) const;
+ SAL_DLLPRIVATE bool ImplIsSelectable( sal_uInt16 nPos ) const;
+ SAL_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const;
+ SAL_DLLPRIVATE sal_uInt16 ImplGetFirstVisible() const;
+ SAL_DLLPRIVATE sal_uInt16 ImplGetPrevVisible( sal_uInt16 nPos ) const;
+ SAL_DLLPRIVATE sal_uInt16 ImplGetNextVisible( sal_uInt16 nPos ) const;
+ SAL_DLLPRIVATE void ImplPaint(vcl::RenderContext& rRenderContext, Size const & rSize,
+ sal_uInt16 nBorder, tools::Long nOffY = 0, MenuItemData const * pThisDataOnly = nullptr,
+ bool bHighlighted = false, bool bLayout = false, bool bRollover = false ) const;
+ SAL_DLLPRIVATE void ImplPaintMenuTitle(vcl::RenderContext&, const tools::Rectangle& rRect) const;
+ SAL_DLLPRIVATE void ImplSelect();
+ SAL_DLLPRIVATE void ImplCallHighlight( sal_uInt16 nHighlightItem );
+ SAL_DLLPRIVATE void ImplCallEventListeners( VclEventId nEvent, sal_uInt16 nPos );
+ DECL_DLLPRIVATE_LINK(ImplCallSelect, void*, void );
+
+ SAL_DLLPRIVATE void ImplFillLayoutData() const;
+ SAL_DLLPRIVATE SalMenu* ImplGetSalMenu() { return mpSalMenu.get(); }
+ SAL_DLLPRIVATE OUString ImplGetHelpText( sal_uInt16 nItemId ) const;
+
+ // returns native check and option menu symbol height in rCheckHeight and rRadioHeight
+ // return value is maximum width and height of checkboxes and radiobuttons
+ SAL_DLLPRIVATE Size ImplGetNativeCheckAndRadioSize(vcl::RenderContext const & rRenderContext, tools::Long& rCheckHeight, tools::Long& rRadioHeight) const;
+
+ // returns native submenu arrow size and spacing from right border
+ // return value is whether it's supported natively
+ SAL_DLLPRIVATE static bool ImplGetNativeSubmenuArrowSize(vcl::RenderContext const & rRenderContext, Size& rArrowSize, tools::Long& rArrowSpacing);
+
+ SAL_DLLPRIVATE void ImplAddDel( ImplMenuDelData &rDel );
+ SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel );
+
+ SAL_DLLPRIVATE MenuItemData* NbcInsertItem(sal_uInt16 nId, MenuItemBits nBits,
+ const OUString& rStr, Menu* pMenu,
+ size_t nPos, const OString &rIdent);
+
+ /// Close the 'pStartedFrom' menu window.
+ virtual void ClosePopup(Menu* pMenu) = 0;
+
+ /// Forward the KeyInput call to the MenuBar.
+ virtual void MenuBarKeyInput(const KeyEvent& rEvent);
+
+public:
+ SAL_DLLPRIVATE void ImplKillLayoutData() const;
+
+ SAL_DLLPRIVATE vcl::Window* ImplGetWindow() const { return pWindow; }
+#if defined(MACOSX)
+ void ImplSelectWithStart( Menu* pStartMenu = nullptr );
+#endif
+
+protected:
+
+ /** The Menu constructor is protected.
+
+ The callers are supposed to instantiate either PopupMenu or MenuBar, but
+ not a Menu directly.
+ */
+ Menu();
+
+public:
+ virtual ~Menu() override;
+ virtual void dispose() override;
+
+ void Activate();
+ void Deactivate();
+ void Select();
+
+ void InsertItem(sal_uInt16 nItemId, const OUString& rStr,
+ MenuItemBits nItemBits = MenuItemBits::NONE,
+ const OString &rIdent = OString(),
+ sal_uInt16 nPos = MENU_APPEND);
+ void InsertItem(sal_uInt16 nItemId, const Image& rImage,
+ MenuItemBits nItemBits = MenuItemBits::NONE,
+ const OString &rIdent = OString(),
+ sal_uInt16 nPos = MENU_APPEND);
+ void InsertItem(sal_uInt16 nItemId,
+ const OUString& rString, const Image& rImage,
+ MenuItemBits nItemBits = MenuItemBits::NONE,
+ const OString &rIdent = OString(),
+ sal_uInt16 nPos = MENU_APPEND);
+ void InsertSeparator(const OString &rIdent = OString(), sal_uInt16 nPos = MENU_APPEND);
+ void RemoveItem( sal_uInt16 nPos );
+ void Clear();
+
+ void CreateAutoMnemonics();
+
+ void SetMenuFlags( MenuFlags nFlags ) { nMenuFlags = nFlags; }
+ MenuFlags GetMenuFlags() const { return nMenuFlags; }
+
+ sal_uInt16 GetItemCount() const;
+ sal_uInt16 GetItemId(sal_uInt16 nPos) const;
+ sal_uInt16 GetItemId(std::string_view rIdent) const;
+ sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const;
+ OString GetItemIdent(sal_uInt16 nItemId) const;
+ MenuItemType GetItemType( sal_uInt16 nPos ) const;
+ sal_uInt16 GetCurItemId() const { return nSelectedId;}
+ OString const & GetCurItemIdent() const { return sSelectedIdent; }
+ void SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits );
+ MenuItemBits GetItemBits( sal_uInt16 nItemId ) const;
+
+ void SetUserValue(sal_uInt16 nItemId, void* nUserValue, MenuUserDataReleaseFunction aFunc=nullptr);
+ void* GetUserValue(sal_uInt16 nItemId) const;
+
+ void SetPopupMenu( sal_uInt16 nItemId, PopupMenu* pMenu );
+ PopupMenu* GetPopupMenu( sal_uInt16 nItemId ) const;
+
+ void SetAccelKey( sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode );
+ vcl::KeyCode GetAccelKey( sal_uInt16 nItemId ) const;
+
+ void CheckItem( sal_uInt16 nItemId, bool bCheck = true );
+ void CheckItem( std::string_view rIdent, bool bCheck = true );
+ bool IsItemChecked( sal_uInt16 nItemId ) const;
+
+ virtual void SelectItem(sal_uInt16 nItemId) = 0;
+
+ void EnableItem( sal_uInt16 nItemId, bool bEnable = true );
+ void EnableItem(std::string_view rIdent, bool bEnable = true)
+ {
+ EnableItem(GetItemId(rIdent), bEnable);
+ }
+ bool IsItemEnabled( sal_uInt16 nItemId ) const;
+
+ void ShowItem( sal_uInt16 nItemId, bool bVisible = true );
+ void HideItem( sal_uInt16 nItemId ) { ShowItem( nItemId, false ); }
+
+ bool IsItemPosVisible( sal_uInt16 nItemPos ) const;
+ bool IsMenuVisible() const;
+ virtual bool IsMenuBar() const = 0;
+
+ void RemoveDisabledEntries( bool bRemoveEmptyPopups = false );
+
+ void UpdateNativeMenu();
+
+ void SetItemText( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetItemText( sal_uInt16 nItemId ) const;
+
+ void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
+ Image GetItemImage( sal_uInt16 nItemId ) const;
+
+ void SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand );
+ OUString GetItemCommand( sal_uInt16 nItemId ) const;
+
+ void SetHelpText( sal_uInt16 nItemId, const OUString& rString );
+ OUString GetHelpText( sal_uInt16 nItemId ) const;
+
+ void SetTipHelpText( sal_uInt16 nItemId, const OUString& rString );
+ OUString GetTipHelpText( sal_uInt16 nItemId ) const;
+
+ void SetHelpCommand( sal_uInt16 nItemId, const OUString& rString );
+ OUString GetHelpCommand( sal_uInt16 nItemId ) const;
+
+ void SetHelpId( sal_uInt16 nItemId, const OString& rHelpId );
+ OString GetHelpId( sal_uInt16 nItemId ) const;
+
+ void SetActivateHdl( const Link<Menu *, bool>& rLink )
+ {
+ aActivateHdl = rLink;
+ }
+
+ void SetDeactivateHdl( const Link<Menu *, bool>& rLink )
+ {
+ aDeactivateHdl = rLink;
+ }
+
+ void SetSelectHdl( const Link<Menu*,bool>& rLink )
+ {
+ aSelectHdl = rLink;
+ }
+
+ sal_uInt16 GetTitleHeight() const
+ {
+ return nTitleHeight;
+ }
+
+ void AddEventListener( const Link<VclMenuEvent&,void>& rEventListener );
+ void RemoveEventListener( const Link<VclMenuEvent&,void>& rEventListener );
+
+ Menu& operator =( const Menu& rMenu );
+
+ // for menu functions
+ MenuItemList* GetItemList() const
+ {
+ return pItemList.get();
+ }
+
+ // returns the system's menu handle if native menus are supported
+ // pData must point to a SystemMenuData structure
+ void GetSystemMenuData( SystemMenuData* pData ) const;
+
+ // accessibility helpers
+
+ // returns the bounding box for the character at index nIndex
+ // where nIndex is relative to the starting index of the item
+ // with id nItemId (in coordinates of the displaying window)
+ tools::Rectangle GetCharacterBounds( sal_uInt16 nItemId, tools::Long nIndex ) const;
+ // -1 is returned if no character is at that point
+ // if an index is found the corresponding item id is filled in (else 0)
+ tools::Long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const;
+ // returns the bounding rectangle for an item at pos nItemPos
+ tools::Rectangle GetBoundingRectangle( sal_uInt16 nItemPos ) const;
+
+ css::uno::Reference<css::accessibility::XAccessible> GetAccessible();
+ void SetAccessible(const css::uno::Reference<css::accessibility::XAccessible >& rxAccessible);
+
+ // gets the activation key of the specified item
+ KeyEvent GetActivationKey( sal_uInt16 nItemId ) const;
+
+ vcl::Window* GetWindow() const { return pWindow; }
+
+ void SetAccessibleName( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetAccessibleName( sal_uInt16 nItemId ) const;
+
+ void SetAccessibleDescription( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetAccessibleDescription( sal_uInt16 nItemId ) const;
+
+ // returns whether the item a position nItemPos is highlighted or not.
+ bool IsHighlighted( sal_uInt16 nItemPos ) const;
+
+ void HighlightItem( sal_uInt16 nItemPos );
+ void DeHighlight() { HighlightItem( 0xFFFF ); } // MENUITEMPOS_INVALID
+
+ bool HandleMenuCommandEvent(Menu *pMenu, sal_uInt16 nEventId) const;
+ bool HandleMenuActivateEvent(Menu *pMenu) const;
+ bool HandleMenuDeActivateEvent(Menu *pMenu) const;
+
+ /**
+ * Sets an ID.
+ */
+ void set_id(const OUString& rID) { maID = rID; }
+
+ /**
+ * Get the ID of the window.
+ */
+ const OUString& get_id() const { return maID; }
+};
+
+struct MenuBarButtonCallbackArg
+{
+ sal_uInt16 nId; // Id of the button
+ bool bHighlight; // highlight on/off
+};
+
+class VCL_DLLPUBLIC MenuBar final : public Menu
+{
+ Link<void*,void> maCloseHdl;
+ bool mbCloseBtnVisible : 1;
+ bool mbFloatBtnVisible : 1;
+ bool mbHideBtnVisible : 1;
+ bool mbDisplayable : 1;
+
+ friend class Application;
+ friend class Menu;
+ friend class MenuBarWindow;
+ friend class MenuFloatingWindow;
+ friend class SystemWindow;
+
+ SAL_DLLPRIVATE static VclPtr<vcl::Window> ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu);
+ SAL_DLLPRIVATE static void ImplDestroy(MenuBar* pMenu, bool bDelete);
+ SAL_DLLPRIVATE bool ImplHandleKeyEvent(const KeyEvent& rKEvent);
+
+ /// Return the MenuBarWindow.
+ MenuBarWindow* getMenuBarWindow();
+
+public:
+ MenuBar();
+ MenuBar( const MenuBar& rMenu );
+ virtual ~MenuBar() override;
+ virtual void dispose() override;
+
+ MenuBar& operator =( const MenuBar& rMenu );
+
+ virtual bool IsMenuBar() const override { return true; }
+
+ /// Close the 'pStartedFrom' menu window.
+ virtual void ClosePopup(Menu* pMenu) override;
+
+ /// Forward the KeyInput call to the MenuBar.
+ virtual void MenuBarKeyInput(const KeyEvent& rEvent) override;
+
+ void ShowCloseButton( bool bShow );
+ bool HasCloseButton() const { return mbCloseBtnVisible; }
+ bool HasFloatButton() const { return mbFloatBtnVisible; }
+ bool HasHideButton() const { return mbHideBtnVisible; }
+ void ShowButtons( bool bClose, bool bFloat, bool bHide );
+
+ virtual void SelectItem(sal_uInt16 nId) override;
+ bool HandleMenuHighlightEvent(Menu *pMenu, sal_uInt16 nEventId) const;
+ bool HandleMenuButtonEvent(sal_uInt16 nEventId);
+
+ void SetCloseButtonClickHdl( const Link<void*,void>& rLink ) { maCloseHdl = rLink; }
+ const Link<void*,void>& GetCloseButtonClickHdl() const { return maCloseHdl; }
+
+ // - by default a menubar is displayable
+ // - if a menubar is not displayable, its MenuBarWindow will never be shown
+ // and it will be hidden if it was visible before
+ // - note: if a menubar is displayable, this does not necessarily mean that it is currently visible
+ void SetDisplayable( bool bDisplayable );
+ bool IsDisplayable() const { return mbDisplayable; }
+
+ // add an arbitrary button to the menubar (will appear next to closer)
+ // passed link will be call with a MenuBarButtonCallbackArg on press
+ // passed string will be set as tooltip
+ sal_uInt16 AddMenuBarButton( const Image&, const Link<MenuBarButtonCallbackArg&,bool>&, const OUString& );
+ // set the highlight link for additional button with ID nId
+ // highlight link will be called with a MenuBarButtonHighlightArg
+ // the bHighlight member of that struct shall contain the new state
+ void SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<MenuBarButtonCallbackArg&,bool>& );
+ // returns the rectangle occupied by the additional button named nId
+ // coordinates are relative to the systemwindow the menubar is attached to
+ // if the menubar is unattached an empty rectangle is returned
+ tools::Rectangle GetMenuBarButtonRectPixel( sal_uInt16 nId );
+ void RemoveMenuBarButton( sal_uInt16 nId );
+ void LayoutChanged();
+ // get the height of the menubar, return the native menubar height if that is active or the vcl
+ // one if not
+ int GetMenuBarHeight() const;
+};
+
+inline MenuBar& MenuBar::operator=( const MenuBar& rMenu )
+{
+ Menu::operator=(rMenu);
+ return *this;
+}
+
+class VCL_DLLPUBLIC PopupMenu final : public Menu
+{
+ friend class Menu;
+ friend class MenuFloatingWindow;
+ friend class MenuBarWindow;
+ friend struct MenuItemData;
+
+private:
+ SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const;
+ SAL_DLLPRIVATE sal_uInt16 ImplExecute( const VclPtr<vcl::Window>& pW, const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom, bool bPreSelectFirst );
+ SAL_DLLPRIVATE void ImplFlushPendingSelect();
+ SAL_DLLPRIVATE tools::Long ImplCalcHeight( sal_uInt16 nEntries ) const;
+ SAL_DLLPRIVATE sal_uInt16 ImplCalcVisEntries( tools::Long nMaxHeight, sal_uInt16 nStartEntry, sal_uInt16* pLastVisible = nullptr ) const;
+
+public:
+ PopupMenu();
+ PopupMenu( const PopupMenu& rMenu );
+ virtual ~PopupMenu() override;
+
+ virtual bool IsMenuBar() const override { return false; }
+
+ /// Close the 'pStartedFrom' menu window.
+ virtual void ClosePopup(Menu* pMenu) override;
+
+ void SetText( const OUString& rTitle )
+ {
+ aTitleText = rTitle;
+ }
+
+ sal_uInt16 Execute( vcl::Window* pWindow, const Point& rPopupPos );
+ sal_uInt16 Execute( vcl::Window* pWindow, const tools::Rectangle& rRect, PopupMenuFlags nFlags = PopupMenuFlags::NONE );
+
+ // for the TestTool
+ void EndExecute();
+ virtual void SelectItem(sal_uInt16 nId) override;
+ void SetSelectedEntry( sal_uInt16 nId ); // for use by native submenu only
+
+ css::uno::Reference<css::awt::XPopupMenu> CreateMenuInterface();
+
+ static PopupMenu* GetActivePopupMenu();
+
+ PopupMenu& operator=( const PopupMenu& rMenu );
+};
+
+inline PopupMenu& PopupMenu::operator=( const PopupMenu& rMenu )
+{
+ Menu::operator=( rMenu );
+ return *this;
+}
+
+#endif // INCLUDED_VCL_MENU_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/menubarupdateicon.hxx b/include/vcl/menubarupdateicon.hxx
new file mode 100644
index 000000000..f9b2932aa
--- /dev/null
+++ b/include/vcl/menubarupdateicon.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <tools/link.hxx>
+#include <vcl/idle.hxx>
+#include <vcl/image.hxx>
+
+class BubbleWindow;
+class MenuBar;
+class SystemWindow;
+class VclSimpleEvent;
+class VclWindowEvent;
+struct MenuBarButtonCallbackArg;
+
+class VCL_DLLPUBLIC MenuBarUpdateIconManager
+{
+private:
+ OUString maBubbleTitle;
+ OUString maBubbleText;
+ Image maBubbleImage;
+ VclPtr<BubbleWindow> mpBubbleWin;
+ VclPtr<SystemWindow> mpIconSysWin;
+ VclPtr<MenuBar> mpIconMBar;
+
+ Link<VclWindowEvent&, void> maWindowEventHdl;
+ Link<VclSimpleEvent&, void> maApplicationEventHdl;
+ Link<LinkParamNone*, void> maClickHdl;
+
+ Timer maTimeoutTimer;
+ Idle maWaitIdle;
+
+ sal_uInt16 mnIconID;
+
+ bool mbShowMenuIcon;
+ bool mbShowBubble;
+ bool mbBubbleChanged;
+
+ DECL_DLLPRIVATE_LINK(UserEventHdl, void*, void);
+ DECL_DLLPRIVATE_LINK(TimeOutHdl, Timer*, void);
+ DECL_DLLPRIVATE_LINK(WindowEventHdl, VclWindowEvent&, void);
+ DECL_DLLPRIVATE_LINK(ApplicationEventHdl, VclSimpleEvent&, void);
+ DECL_DLLPRIVATE_LINK(WaitTimeOutHdl, Timer*, void);
+ DECL_DLLPRIVATE_LINK(ClickHdl, MenuBarButtonCallbackArg&, bool);
+ DECL_DLLPRIVATE_LINK(HighlightHdl, MenuBarButtonCallbackArg&, bool);
+
+ VclPtr<BubbleWindow> GetBubbleWindow();
+ void SetBubbleChanged();
+
+public:
+ MenuBarUpdateIconManager();
+ ~MenuBarUpdateIconManager();
+
+ void SetShowMenuIcon(bool bShowMenuIcon);
+ void SetShowBubble(bool bShowBubble);
+ void SetBubbleImage(const Image& rImage);
+ void SetBubbleTitle(const OUString& rTitle);
+ void SetBubbleText(const OUString& rText);
+
+ void SetClickHdl(const Link<LinkParamNone*, void>& rHdl) { maClickHdl = rHdl; }
+
+ bool GetShowMenuIcon() const { return mbShowMenuIcon; }
+ bool GetShowBubble() const { return mbShowBubble; }
+ const OUString& GetBubbleTitle() const { return maBubbleTitle; }
+ const OUString& GetBubbleText() const { return maBubbleText; }
+
+ void RemoveBubbleWindow(bool bRemoveIcon);
+
+ void AddMenuBarIcon(SystemWindow* pSysWin, bool bAddEventHdl);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
new file mode 100644
index 000000000..3ac267aae
--- /dev/null
+++ b/include/vcl/metaact.hxx
@@ -0,0 +1,1752 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_METAACT_HXX
+#define INCLUDED_VCL_METAACT_HXX
+
+#include <sal/config.h>
+
+#include <config_options.h>
+
+#include <o3tl/span.hxx>
+#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <tools/poly.hxx>
+
+#include <vcl/dllapi.h>
+#include <vcl/rendercontext/State.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/font.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/gfxlink.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/hatch.hxx>
+#include <vcl/lineinfo.hxx>
+#include <vcl/metaactiontypes.hxx>
+#include <vcl/region.hxx>
+#include <vcl/rendercontext/RasterOp.hxx>
+#include <vcl/wall.hxx>
+
+#include <memory>
+
+class OutputDevice;
+class SvStream;
+enum class DrawTextFlags;
+
+struct ImplMetaReadData
+{
+ rtl_TextEncoding meActualCharSet;
+ int mnParseDepth;
+
+ ImplMetaReadData()
+ : meActualCharSet(RTL_TEXTENCODING_ASCII_US)
+ , mnParseDepth(0)
+ {}
+};
+
+struct ImplMetaWriteData
+{
+ rtl_TextEncoding meActualCharSet;
+
+ ImplMetaWriteData() :
+ meActualCharSet( RTL_TEXTENCODING_ASCII_US )
+ {}
+};
+
+class VCL_DLLPUBLIC MetaAction : public salhelper::SimpleReferenceObject
+{
+private:
+ MetaActionType mnType;
+
+protected:
+ virtual ~MetaAction() override;
+
+public:
+ MetaAction();
+ explicit MetaAction( MetaActionType nType );
+ MetaAction( MetaAction const & );
+
+ virtual void Execute( OutputDevice* pOut );
+
+ oslInterlockedCount GetRefCount() const { return m_nCount; }
+
+ virtual rtl::Reference<MetaAction> Clone() const;
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove );
+ virtual void Scale( double fScaleX, double fScaleY );
+
+ MetaActionType GetType() const { return mnType; }
+ /** \#i10613# Extracted from Printer::GetPreparedMetaFile. Returns true
+ if given action requires special transparency handling
+ */
+ virtual bool IsTransparent() const { return false; }
+};
+
+class VCL_DLLPUBLIC MetaPixelAction final : public MetaAction
+{
+private:
+ Point maPt;
+ Color maColor;
+
+public:
+ MetaPixelAction();
+ MetaPixelAction(MetaPixelAction const &) = default;
+ MetaPixelAction(MetaPixelAction &&) = default;
+ MetaPixelAction & operator =(MetaPixelAction const &) = delete; // due to MetaAction
+ MetaPixelAction & operator =(MetaPixelAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaPixelAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaPixelAction( const Point& rPt, const Color& rColor );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Point& GetPoint() const { return maPt; }
+ const Color& GetColor() const { return maColor; }
+ void SetPoint(const Point& rPt) { maPt = rPt; }
+ void SetColor(Color rColor) { maColor = rColor; }
+};
+
+class VCL_DLLPUBLIC MetaPointAction final : public MetaAction
+{
+private:
+ Point maPt;
+
+public:
+ MetaPointAction();
+ MetaPointAction(MetaPointAction const &) = default;
+ MetaPointAction(MetaPointAction &&) = default;
+ MetaPointAction & operator =(MetaPointAction const &) = delete; // due to MetaAction
+ MetaPointAction & operator =(MetaPointAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaPointAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaPointAction( const Point& );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Point& GetPoint() const { return maPt; }
+ void SetPoint(const Point& rPt) { maPt = rPt; }
+};
+
+class VCL_DLLPUBLIC MetaLineAction final : public MetaAction
+{
+private:
+
+ LineInfo maLineInfo;
+ Point maStartPt;
+ Point maEndPt;
+
+public:
+ MetaLineAction();
+ MetaLineAction(MetaLineAction const &) = default;
+ MetaLineAction(MetaLineAction &&) = default;
+ MetaLineAction & operator =(MetaLineAction const &) = delete; // due to MetaAction
+ MetaLineAction & operator =(MetaLineAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaLineAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaLineAction( const Point& rStart, const Point& rEnd );
+ MetaLineAction( const Point& rStart, const Point& rEnd,
+ const LineInfo& rLineInfo );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Point& GetStartPoint() const { return maStartPt; }
+ const Point& GetEndPoint() const { return maEndPt; }
+ const LineInfo& GetLineInfo() const { return maLineInfo; }
+ void SetStartPoint(const Point& rPoint) { maStartPt = rPoint; }
+ void SetEndPoint(const Point& rPoint) { maEndPt = rPoint; }
+ void SetLineInfo(const LineInfo& rLineInfo) { maLineInfo = rLineInfo; }
+};
+
+class VCL_DLLPUBLIC MetaRectAction final : public MetaAction
+{
+private:
+
+ tools::Rectangle maRect;
+
+public:
+ MetaRectAction();
+ MetaRectAction(MetaRectAction const &) = default;
+ MetaRectAction(MetaRectAction &&) = default;
+ MetaRectAction & operator =(MetaRectAction const &) = delete; // due to MetaAction
+ MetaRectAction & operator =(MetaRectAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaRectAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaRectAction( const tools::Rectangle& );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Rectangle& GetRect() const { return maRect; }
+ void SetRect(const tools::Rectangle& rRect) { maRect = rRect; }
+};
+
+class VCL_DLLPUBLIC MetaRoundRectAction final : public MetaAction
+{
+private:
+
+ tools::Rectangle maRect;
+ sal_uInt32 mnHorzRound;
+ sal_uInt32 mnVertRound;
+
+public:
+ MetaRoundRectAction();
+ MetaRoundRectAction(MetaRoundRectAction const &) = default;
+ MetaRoundRectAction(MetaRoundRectAction &&) = default;
+ MetaRoundRectAction & operator =(MetaRoundRectAction const &) = delete; // due to MetaAction
+ MetaRoundRectAction & operator =(MetaRoundRectAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaRoundRectAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaRoundRectAction( const tools::Rectangle& rRect,
+ sal_uInt32 nHorzRound, sal_uInt32 nVertRound );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Rectangle& GetRect() const { return maRect; }
+ sal_uInt32 GetHorzRound() const { return mnHorzRound; }
+ sal_uInt32 GetVertRound() const { return mnVertRound; }
+ void SetRect(const tools::Rectangle& rRect) { maRect = rRect; }
+ void SetHorzRound(sal_uInt32 rHorzRound) { mnHorzRound = rHorzRound; }
+ void SetVertRound(sal_uInt32 rVertRound) { mnVertRound = rVertRound; }
+};
+
+class VCL_DLLPUBLIC MetaEllipseAction final : public MetaAction
+{
+private:
+
+ tools::Rectangle maRect;
+
+public:
+ MetaEllipseAction();
+ MetaEllipseAction(MetaEllipseAction const &) = default;
+ MetaEllipseAction(MetaEllipseAction &&) = default;
+ MetaEllipseAction & operator =(MetaEllipseAction const &) = delete; // due to MetaAction
+ MetaEllipseAction & operator =(MetaEllipseAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaEllipseAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaEllipseAction( const tools::Rectangle& );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Rectangle& GetRect() const { return maRect; }
+ void SetRect(const tools::Rectangle& rRect) { maRect = rRect; }
+};
+
+class VCL_DLLPUBLIC MetaArcAction final : public MetaAction
+{
+private:
+
+ tools::Rectangle maRect;
+ Point maStartPt;
+ Point maEndPt;
+
+public:
+ MetaArcAction();
+ MetaArcAction(MetaArcAction const &) = default;
+ MetaArcAction(MetaArcAction &&) = default;
+ MetaArcAction & operator =(MetaArcAction const &) = delete; // due to MetaAction
+ MetaArcAction & operator =(MetaArcAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaArcAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaArcAction( const tools::Rectangle& rRect,
+ const Point& rStart, const Point& rEnd );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Rectangle& GetRect() const { return maRect; }
+ const Point& GetStartPoint() const { return maStartPt; }
+ const Point& GetEndPoint() const { return maEndPt; }
+ void SetRect(const tools::Rectangle& rRect) { maRect = rRect; }
+ void SetStartPoint(const Point& rPoint) { maStartPt = rPoint; }
+ void SetEndPoint(const Point& rPoint) { maEndPt = rPoint; }
+};
+
+class VCL_DLLPUBLIC MetaPieAction final : public MetaAction
+{
+private:
+
+ tools::Rectangle maRect;
+ Point maStartPt;
+ Point maEndPt;
+
+public:
+ MetaPieAction();
+ MetaPieAction(MetaPieAction const &) = default;
+ MetaPieAction(MetaPieAction &&) = default;
+ MetaPieAction & operator =(MetaPieAction const &) = delete; // due to MetaAction
+ MetaPieAction & operator =(MetaPieAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaPieAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaPieAction( const tools::Rectangle& rRect,
+ const Point& rStart, const Point& rEnd );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Rectangle& GetRect() const { return maRect; }
+ const Point& GetStartPoint() const { return maStartPt; }
+ const Point& GetEndPoint() const { return maEndPt; }
+ void SetRect(const tools::Rectangle& rRect) { maRect = rRect; }
+ void SetStartPoint(const Point& rPoint) { maStartPt = rPoint; }
+ void SetEndPoint(const Point& rPoint) { maEndPt = rPoint; }
+};
+
+class VCL_DLLPUBLIC MetaChordAction final : public MetaAction
+{
+private:
+
+ tools::Rectangle maRect;
+ Point maStartPt;
+ Point maEndPt;
+
+public:
+ MetaChordAction();
+ MetaChordAction(MetaChordAction const &) = default;
+ MetaChordAction(MetaChordAction &&) = default;
+ MetaChordAction & operator =(MetaChordAction const &) = delete; // due to MetaAction
+ MetaChordAction & operator =(MetaChordAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaChordAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaChordAction( const tools::Rectangle& rRect,
+ const Point& rStart, const Point& rEnd );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Rectangle& GetRect() const { return maRect; }
+ const Point& GetStartPoint() const { return maStartPt; }
+ const Point& GetEndPoint() const { return maEndPt; }
+ void SetRect(const tools::Rectangle& rRect) { maRect = rRect; }
+ void SetStartPoint(const Point& rPoint) { maStartPt = rPoint; }
+ void SetEndPoint(const Point& rPoint) { maEndPt = rPoint; }
+};
+
+class VCL_DLLPUBLIC MetaPolyLineAction final : public MetaAction
+{
+private:
+
+ LineInfo maLineInfo;
+ tools::Polygon maPoly;
+
+public:
+ MetaPolyLineAction();
+ MetaPolyLineAction(MetaPolyLineAction const &) = default;
+ MetaPolyLineAction(MetaPolyLineAction &&) = default;
+ MetaPolyLineAction & operator =(MetaPolyLineAction const &) = delete; // due to MetaAction
+ MetaPolyLineAction & operator =(MetaPolyLineAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaPolyLineAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaPolyLineAction( const tools::Polygon& );
+ explicit MetaPolyLineAction( const tools::Polygon&, const LineInfo& );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Polygon& GetPolygon() const { return maPoly; }
+ const LineInfo& GetLineInfo() const { return maLineInfo; }
+ void SetLineInfo(const LineInfo& rLineInfo) { maLineInfo = rLineInfo; }
+ void SetPolygon(const tools::Polygon& rPoly) { maPoly = rPoly; }
+};
+
+class VCL_DLLPUBLIC MetaPolygonAction final : public MetaAction
+{
+private:
+
+ tools::Polygon maPoly;
+
+public:
+ MetaPolygonAction();
+ MetaPolygonAction(MetaPolygonAction const &) = default;
+ MetaPolygonAction(MetaPolygonAction &&) = default;
+ MetaPolygonAction & operator =(MetaPolygonAction const &) = delete; // due to MetaAction
+ MetaPolygonAction & operator =(MetaPolygonAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaPolygonAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaPolygonAction( const tools::Polygon& );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Polygon& GetPolygon() const { return maPoly; }
+ void SetPolygon(const tools::Polygon& rPoly) { maPoly = rPoly; }
+};
+
+class VCL_DLLPUBLIC MetaPolyPolygonAction final : public MetaAction
+{
+private:
+
+ tools::PolyPolygon maPolyPoly;
+
+public:
+ MetaPolyPolygonAction();
+ MetaPolyPolygonAction(MetaPolyPolygonAction const &) = default;
+ MetaPolyPolygonAction(MetaPolyPolygonAction &&) = default;
+ MetaPolyPolygonAction & operator =(MetaPolyPolygonAction const &) = delete; // due to MetaAction
+ MetaPolyPolygonAction & operator =(MetaPolyPolygonAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaPolyPolygonAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaPolyPolygonAction( const tools::PolyPolygon& );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::PolyPolygon& GetPolyPolygon() const { return maPolyPoly; }
+ void SetPolyPolygon(const tools::PolyPolygon& rPolyPoly) { maPolyPoly = rPolyPoly; }
+};
+
+class SAL_DLLPUBLIC_RTTI MetaTextAction final : public MetaAction
+{
+private:
+
+ Point maPt;
+ OUString maStr;
+ sal_Int32 mnIndex;
+ sal_Int32 mnLen;
+
+public:
+ MetaTextAction();
+ MetaTextAction(MetaTextAction const &) = default;
+ MetaTextAction(MetaTextAction &&) = default;
+ MetaTextAction & operator =(MetaTextAction const &) = delete; // due to MetaAction
+ MetaTextAction & operator =(MetaTextAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaTextAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaTextAction( const Point& rPt, const OUString& rStr,
+ sal_Int32 nIndex, sal_Int32 nLen );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Point& GetPoint() const { return maPt; }
+ const OUString& GetText() const { return maStr; }
+ sal_Int32 GetIndex() const { return mnIndex; }
+ sal_Int32 GetLen() const { return mnLen; }
+ void SetPoint(const Point& rPt) { maPt = rPt; }
+ void SetText(const OUString& rStr) { maStr = rStr; }
+ void SetIndex(sal_Int32 rIndex) { mnIndex = rIndex; }
+ void SetLen(sal_Int32 rLen) { mnLen = rLen; }
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaTextArrayAction final : public MetaAction
+{
+private:
+
+ Point maStartPt;
+ OUString maStr;
+ std::vector<sal_Int32> maDXAry;
+ sal_Int32 mnIndex;
+ sal_Int32 mnLen;
+
+ virtual ~MetaTextArrayAction() override;
+
+public:
+ MetaTextArrayAction();
+ MetaTextArrayAction( const MetaTextArrayAction& rAction );
+ MetaTextArrayAction( const Point& rStartPt, const OUString& rStr,
+ const std::vector<sal_Int32>& rDXAry, sal_Int32 nIndex,
+ sal_Int32 nLen );
+ MetaTextArrayAction( const Point& rStartPt, const OUString& rStr,
+ o3tl::span<const sal_Int32> pDXAry, sal_Int32 nIndex,
+ sal_Int32 nLen );
+
+ virtual void Execute( OutputDevice* pOut ) override;
+
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Point& GetPoint() const { return maStartPt; }
+ const OUString& GetText() const { return maStr; }
+ sal_Int32 GetIndex() const { return mnIndex; }
+ sal_Int32 GetLen() const { return mnLen; }
+ const std::vector<sal_Int32> & GetDXArray() const { return maDXAry; }
+ void SetPoint(const Point& rPt) { maStartPt = rPt; }
+ void SetText(const OUString& rStr) { maStr = rStr; }
+ void SetIndex(sal_Int32 rIndex) { mnIndex = rIndex; }
+ void SetLen(sal_Int32 rLen) { mnLen = rLen; }
+ void SetDXArray(std::vector<sal_Int32> aArray);
+};
+
+class SAL_DLLPUBLIC_RTTI MetaStretchTextAction final : public MetaAction
+{
+private:
+
+ Point maPt;
+ OUString maStr;
+ sal_uInt32 mnWidth;
+ sal_Int32 mnIndex;
+ sal_Int32 mnLen;
+
+public:
+ MetaStretchTextAction();
+ MetaStretchTextAction(MetaStretchTextAction const &) = default;
+ MetaStretchTextAction(MetaStretchTextAction &&) = default;
+ MetaStretchTextAction & operator =(MetaStretchTextAction const &) = delete; // due to MetaAction
+ MetaStretchTextAction & operator =(MetaStretchTextAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaStretchTextAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaStretchTextAction( const Point& rPt, sal_uInt32 nWidth,
+ const OUString& rStr,
+ sal_Int32 nIndex, sal_Int32 nLen );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Point& GetPoint() const { return maPt; }
+ const OUString& GetText() const { return maStr; }
+ sal_uInt32 GetWidth() const { return mnWidth; }
+ sal_Int32 GetIndex() const { return mnIndex; }
+ sal_Int32 GetLen() const { return mnLen; }
+ void SetPoint(const Point& rPt) { maPt = rPt; }
+ void SetText(const OUString& rStr) { maStr = rStr; }
+ void SetWidth(sal_uInt32 rWidth) { mnWidth = rWidth; }
+ void SetIndex(sal_uInt32 rIndex) { mnIndex = rIndex; }
+ void SetLen(sal_uInt32 rLen) { mnLen = rLen; }
+};
+
+class SAL_DLLPUBLIC_RTTI MetaTextRectAction final : public MetaAction
+{
+private:
+
+ tools::Rectangle maRect;
+ OUString maStr;
+ DrawTextFlags mnStyle;
+
+public:
+ MetaTextRectAction();
+ MetaTextRectAction(MetaTextRectAction const &) = default;
+ MetaTextRectAction(MetaTextRectAction &&) = default;
+ MetaTextRectAction & operator =(MetaTextRectAction const &) = delete; // due to MetaAction
+ MetaTextRectAction & operator =(MetaTextRectAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaTextRectAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaTextRectAction( const tools::Rectangle& rRect,
+ const OUString& rStr, DrawTextFlags nStyle );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Rectangle& GetRect() const { return maRect; }
+ const OUString& GetText() const { return maStr; }
+ DrawTextFlags GetStyle() const { return mnStyle; }
+ void SetRect(const tools::Rectangle& rRect) { maRect = rRect; }
+ void SetText(const OUString& rStr) { maStr = rStr; }
+ void SetStyle(DrawTextFlags rStyle) { mnStyle = rStyle; }
+};
+
+class SAL_DLLPUBLIC_RTTI MetaTextLineAction final : public MetaAction
+{
+private:
+
+ Point maPos;
+ tools::Long mnWidth;
+ FontStrikeout meStrikeout;
+ FontLineStyle meUnderline;
+ FontLineStyle meOverline;
+
+public:
+ MetaTextLineAction();
+ MetaTextLineAction(MetaTextLineAction const &) = default;
+ MetaTextLineAction(MetaTextLineAction &&) = default;
+ MetaTextLineAction & operator =(MetaTextLineAction const &) = delete; // due to MetaAction
+ MetaTextLineAction & operator =(MetaTextLineAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaTextLineAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaTextLineAction( const Point& rPos, tools::Long nWidth,
+ FontStrikeout eStrikeout,
+ FontLineStyle eUnderline,
+ FontLineStyle eOverline );
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Point& GetStartPoint() const { return maPos; }
+ tools::Long GetWidth() const { return mnWidth; }
+ FontStrikeout GetStrikeout() const { return meStrikeout; }
+ FontLineStyle GetUnderline() const { return meUnderline; }
+ FontLineStyle GetOverline() const { return meOverline; }
+ void SetStartPoint(const Point& rPos) { maPos = rPos; }
+ void SetWidth(tools::Long rWidth) { mnWidth = rWidth; }
+ void SetStrikeout(FontStrikeout eStrikeout) { meStrikeout = eStrikeout; }
+ void SetUnderline(FontLineStyle eUnderline) { meUnderline = eUnderline; }
+ void SetOverline(FontLineStyle eOverline) { meOverline = eOverline; }
+};
+
+class VCL_DLLPUBLIC MetaBmpAction final : public MetaAction
+{
+private:
+
+ Bitmap maBmp;
+ Point maPt;
+
+public:
+ MetaBmpAction();
+ MetaBmpAction(MetaBmpAction const &) = default;
+ MetaBmpAction(MetaBmpAction &&) = default;
+ MetaBmpAction & operator =(MetaBmpAction const &) = delete; // due to MetaAction
+ MetaBmpAction & operator =(MetaBmpAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaBmpAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaBmpAction( const Point& rPt, const Bitmap& rBmp );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Bitmap& GetBitmap() const { return maBmp; }
+ const Point& GetPoint() const { return maPt; }
+ void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; }
+ void SetPoint(const Point& rPt) { maPt = rPt; }
+};
+
+class VCL_DLLPUBLIC MetaBmpScaleAction final : public MetaAction
+{
+private:
+
+ Bitmap maBmp;
+ Point maPt;
+ Size maSz;
+
+public:
+ MetaBmpScaleAction();
+ MetaBmpScaleAction(MetaBmpScaleAction const &) = default;
+ MetaBmpScaleAction(MetaBmpScaleAction &&) = default;
+ MetaBmpScaleAction & operator =(MetaBmpScaleAction const &) = delete; // due to MetaAction
+ MetaBmpScaleAction & operator =(MetaBmpScaleAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaBmpScaleAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaBmpScaleAction( const Point& rPt, const Size& rSz,
+ const Bitmap& rBmp );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Bitmap& GetBitmap() const { return maBmp; }
+ const Point& GetPoint() const { return maPt; }
+ const Size& GetSize() const { return maSz; }
+ void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; }
+ void SetPoint(const Point& rPt) { maPt = rPt; }
+ void SetSize(const Size& rSz) { maSz = rSz; }
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaBmpScalePartAction final : public MetaAction
+{
+private:
+
+ Bitmap maBmp;
+ Point maDstPt;
+ Size maDstSz;
+ Point maSrcPt;
+ Size maSrcSz;
+
+public:
+ MetaBmpScalePartAction();
+ MetaBmpScalePartAction(MetaBmpScalePartAction const &) = default;
+ MetaBmpScalePartAction(MetaBmpScalePartAction &&) = default;
+ MetaBmpScalePartAction & operator =(MetaBmpScalePartAction const &) = delete; // due to MetaAction
+ MetaBmpScalePartAction & operator =(MetaBmpScalePartAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaBmpScalePartAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaBmpScalePartAction( const Point& rDstPt, const Size& rDstSz,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Bitmap& rBmp );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Bitmap& GetBitmap() const { return maBmp; }
+ const Point& GetDestPoint() const { return maDstPt; }
+ const Size& GetDestSize() const { return maDstSz; }
+ const Point& GetSrcPoint() const { return maSrcPt; }
+ const Size& GetSrcSize() const { return maSrcSz; }
+ void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; }
+ void SetDestPoint(const Point& rPt) { maDstPt = rPt; }
+ void SetDestSize(const Size& rSz) { maDstSz = rSz; }
+ void SetSrcPoint(const Point& rPt) { maSrcPt = rPt; }
+ void SetSrcSize(const Size& rSz) { maSrcSz = rSz; }
+};
+
+class VCL_DLLPUBLIC MetaBmpExAction final : public MetaAction
+{
+private:
+
+ BitmapEx maBmpEx;
+ Point maPt;
+
+public:
+ MetaBmpExAction();
+ MetaBmpExAction(MetaBmpExAction const &) = default;
+ MetaBmpExAction(MetaBmpExAction &&) = default;
+ MetaBmpExAction & operator =(MetaBmpExAction const &) = delete; // due to MetaAction
+ MetaBmpExAction & operator =(MetaBmpExAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaBmpExAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaBmpExAction( const Point& rPt, const BitmapEx& rBmpEx );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const BitmapEx& GetBitmapEx() const { return maBmpEx; }
+ const Point& GetPoint() const { return maPt; }
+ void SetBitmapEx(BitmapEx rBmpEx) { maBmpEx = rBmpEx; }
+ void SetPoint(const Point& rPt) { maPt = rPt; }
+ bool IsTransparent() const override { return GetBitmapEx().IsAlpha(); }
+};
+
+class VCL_DLLPUBLIC MetaBmpExScaleAction final : public MetaAction
+{
+private:
+
+ BitmapEx maBmpEx;
+ Point maPt;
+ Size maSz;
+
+public:
+ MetaBmpExScaleAction();
+ MetaBmpExScaleAction(MetaBmpExScaleAction const &) = default;
+ MetaBmpExScaleAction(MetaBmpExScaleAction &&) = default;
+ MetaBmpExScaleAction & operator =(MetaBmpExScaleAction const &) = delete; // due to MetaAction
+ MetaBmpExScaleAction & operator =(MetaBmpExScaleAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaBmpExScaleAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaBmpExScaleAction( const Point& rPt, const Size& rSz,
+ const BitmapEx& rBmpEx ) ;
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const BitmapEx& GetBitmapEx() const { return maBmpEx; }
+ const Point& GetPoint() const { return maPt; }
+ const Size& GetSize() const { return maSz; }
+ void SetBitmapEx(const BitmapEx& rBmpEx) { maBmpEx = rBmpEx; }
+ void SetPoint(const Point& rPt) { maPt = rPt; }
+ void SetSize(const Size& rSz) { maSz = rSz; }
+ bool IsTransparent() const override { return GetBitmapEx().IsAlpha(); }
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaBmpExScalePartAction final : public MetaAction
+{
+private:
+
+ BitmapEx maBmpEx;
+ Point maDstPt;
+ Size maDstSz;
+ Point maSrcPt;
+ Size maSrcSz;
+
+public:
+ MetaBmpExScalePartAction();
+ MetaBmpExScalePartAction(MetaBmpExScalePartAction const &) = default;
+ MetaBmpExScalePartAction(MetaBmpExScalePartAction &&) = default;
+ MetaBmpExScalePartAction & operator =(MetaBmpExScalePartAction const &) = delete; // due to MetaAction
+ MetaBmpExScalePartAction & operator =(MetaBmpExScalePartAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaBmpExScalePartAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaBmpExScalePartAction( const Point& rDstPt, const Size& rDstSz,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const BitmapEx& rBmpEx );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const BitmapEx& GetBitmapEx() const { return maBmpEx; }
+ const Point& GetDestPoint() const { return maDstPt; }
+ const Size& GetDestSize() const { return maDstSz; }
+ const Point& GetSrcPoint() const { return maSrcPt; }
+ const Size& GetSrcSize() const { return maSrcSz; }
+ void SetBitmapEx(const BitmapEx& rBmpEx) { maBmpEx = rBmpEx; }
+ void SetDestPoint(const Point& rDstPt) { maDstPt = rDstPt; }
+ void SetDestSize(const Size& rDstSz) { maDstSz = rDstSz; }
+ void SetSrcPoint(const Point& rSrcPt) { maSrcPt = rSrcPt; }
+ void SetSrcSize(const Size& rSrcSz) { maSrcSz = rSrcSz; }
+ bool IsTransparent() const override { return GetBitmapEx().IsAlpha(); }
+};
+
+class SAL_DLLPUBLIC_RTTI MetaMaskAction final : public MetaAction
+{
+private:
+
+ Bitmap maBmp;
+ Color maColor;
+ Point maPt;
+
+public:
+ MetaMaskAction();
+ MetaMaskAction(MetaMaskAction const &) = default;
+ MetaMaskAction(MetaMaskAction &&) = default;
+ MetaMaskAction & operator =(MetaMaskAction const &) = delete; // due to MetaAction
+ MetaMaskAction & operator =(MetaMaskAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaMaskAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaMaskAction( const Point& rPt,
+ const Bitmap& rBmp,
+ const Color& rColor );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Bitmap& GetBitmap() const { return maBmp; }
+ const Color& GetColor() const { return maColor; }
+ const Point& GetPoint() const { return maPt; }
+ void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; }
+ void SetPoint(const Point& rPt) { maPt = rPt; }
+};
+
+class SAL_DLLPUBLIC_RTTI MetaMaskScaleAction final : public MetaAction
+{
+private:
+
+ Bitmap maBmp;
+ Color maColor;
+ Point maPt;
+ Size maSz;
+
+public:
+ MetaMaskScaleAction();
+ MetaMaskScaleAction(MetaMaskScaleAction const &) = default;
+ MetaMaskScaleAction(MetaMaskScaleAction &&) = default;
+ MetaMaskScaleAction & operator =(MetaMaskScaleAction const &) = delete; // due to MetaAction
+ MetaMaskScaleAction & operator =(MetaMaskScaleAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaMaskScaleAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaMaskScaleAction( const Point& rPt, const Size& rSz,
+ const Bitmap& rBmp,
+ const Color& rColor );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Bitmap& GetBitmap() const { return maBmp; }
+ const Color& GetColor() const { return maColor; }
+ const Point& GetPoint() const { return maPt; }
+ const Size& GetSize() const { return maSz; }
+ void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; }
+ void SetPoint(const Point& rPt) { maPt = rPt; }
+ void SetSize(const Size& rSz) { maSz = rSz; }
+};
+
+class SAL_DLLPUBLIC_RTTI MetaMaskScalePartAction final : public MetaAction
+{
+private:
+
+ Bitmap maBmp;
+ Color maColor;
+ Point maDstPt;
+ Size maDstSz;
+ Point maSrcPt;
+ Size maSrcSz;
+
+public:
+ MetaMaskScalePartAction();
+ MetaMaskScalePartAction(MetaMaskScalePartAction const &) = default;
+ MetaMaskScalePartAction(MetaMaskScalePartAction &&) = default;
+ MetaMaskScalePartAction & operator =(MetaMaskScalePartAction const &) = delete; // due to MetaAction
+ MetaMaskScalePartAction & operator =(MetaMaskScalePartAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaMaskScalePartAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaMaskScalePartAction( const Point& rDstPt, const Size& rDstSz,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Bitmap& rBmp,
+ const Color& rColor );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const Bitmap& GetBitmap() const { return maBmp; }
+ const Color& GetColor() const { return maColor; }
+ const Point& GetDestPoint() const { return maDstPt; }
+ const Size& GetDestSize() const { return maDstSz; }
+ const Point& GetSrcPoint() const { return maSrcPt; }
+ const Size& GetSrcSize() const { return maSrcSz; }
+ void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; }
+ void SetColor(Color rColor) { maColor = rColor; }
+ void SetDestPoint(const Point& rPt) { maDstPt = rPt; }
+ void SetDestSize(const Size& rSz) { maDstSz = rSz; }
+ void SetSrcPoint(const Point& rPt) { maSrcPt = rPt; }
+ void SetSrcSize(const Size& rSz) { maSrcSz = rSz; }
+};
+
+class SAL_DLLPUBLIC_RTTI MetaGradientAction final : public MetaAction
+{
+private:
+
+ tools::Rectangle maRect;
+ Gradient maGradient;
+
+public:
+ MetaGradientAction();
+ MetaGradientAction(MetaGradientAction const &) = default;
+ MetaGradientAction(MetaGradientAction &&) = default;
+ MetaGradientAction & operator =(MetaGradientAction const &) = delete; // due to MetaAction
+ MetaGradientAction & operator =(MetaGradientAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaGradientAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaGradientAction( const tools::Rectangle& rRect, const Gradient& rGradient );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Rectangle& GetRect() const { return maRect; }
+ const Gradient& GetGradient() const { return maGradient; }
+ void SetGradient(const Gradient& rGradient) { maGradient = rGradient; }
+ void SetRect(const tools::Rectangle& rRect) { maRect = rRect; }
+};
+
+class VCL_DLLPUBLIC MetaGradientExAction final : public MetaAction
+{
+private:
+
+ tools::PolyPolygon maPolyPoly;
+ Gradient maGradient;
+
+public:
+ MetaGradientExAction();
+ MetaGradientExAction(MetaGradientExAction const &) = default;
+ MetaGradientExAction(MetaGradientExAction &&) = default;
+ MetaGradientExAction & operator =(MetaGradientExAction const &) = delete; // due to MetaAction
+ MetaGradientExAction & operator =(MetaGradientExAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaGradientExAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaGradientExAction( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::PolyPolygon& GetPolyPolygon() const { return maPolyPoly; }
+ const Gradient& GetGradient() const { return maGradient; }
+ void SetPolyPolygon(const tools::PolyPolygon& rPolyPoly) { maPolyPoly = rPolyPoly; }
+ void SetGradient(const Gradient& rGradient) { maGradient = rGradient; }
+};
+
+class SAL_DLLPUBLIC_RTTI MetaHatchAction final : public MetaAction
+{
+private:
+
+ tools::PolyPolygon maPolyPoly;
+ Hatch maHatch;
+
+public:
+ MetaHatchAction();
+ MetaHatchAction(MetaHatchAction const &) = default;
+ MetaHatchAction(MetaHatchAction &&) = default;
+ MetaHatchAction & operator =(MetaHatchAction const &) = delete; // due to MetaAction
+ MetaHatchAction & operator =(MetaHatchAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaHatchAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaHatchAction( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::PolyPolygon& GetPolyPolygon() const { return maPolyPoly; }
+ const Hatch& GetHatch() const { return maHatch; }
+ void SetPolyPolygon(const tools::PolyPolygon& rPolyPoly) { maPolyPoly = rPolyPoly; }
+ void SetHatch(const Hatch& rHatch) { maHatch = rHatch; }
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaWallpaperAction final : public MetaAction
+{
+private:
+
+ tools::Rectangle maRect;
+ Wallpaper maWallpaper;
+
+public:
+ MetaWallpaperAction();
+ MetaWallpaperAction(MetaWallpaperAction const &) = default;
+ MetaWallpaperAction(MetaWallpaperAction &&) = default;
+ MetaWallpaperAction & operator =(MetaWallpaperAction const &) = delete; // due to MetaAction
+ MetaWallpaperAction & operator =(MetaWallpaperAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaWallpaperAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaWallpaperAction( const tools::Rectangle& rRect,
+ const Wallpaper& rPaper );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Rectangle& GetRect() const { return maRect; }
+ const Wallpaper& GetWallpaper() const { return maWallpaper; }
+ void SetWallpaper(const Wallpaper& rWallpaper) { maWallpaper = rWallpaper; }
+};
+
+class VCL_DLLPUBLIC MetaClipRegionAction final : public MetaAction
+{
+private:
+
+ vcl::Region maRegion;
+ bool mbClip;
+
+public:
+ MetaClipRegionAction();
+ MetaClipRegionAction(MetaClipRegionAction const &) = default;
+ MetaClipRegionAction(MetaClipRegionAction &&) = default;
+ MetaClipRegionAction & operator =(MetaClipRegionAction const &) = delete; // due to MetaAction
+ MetaClipRegionAction & operator =(MetaClipRegionAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaClipRegionAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaClipRegionAction( const vcl::Region& rRegion, bool bClip );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const vcl::Region& GetRegion() const { return maRegion; }
+ bool IsClipping() const { return mbClip; }
+ void SetRegion(const vcl::Region& rRegion) { maRegion = rRegion; }
+ void SetClipping(bool bClip) { mbClip = bClip; }
+};
+
+class VCL_DLLPUBLIC MetaISectRectClipRegionAction final : public MetaAction
+{
+private:
+
+ tools::Rectangle maRect;
+
+public:
+ MetaISectRectClipRegionAction();
+ MetaISectRectClipRegionAction(MetaISectRectClipRegionAction const &) = default;
+ MetaISectRectClipRegionAction(MetaISectRectClipRegionAction &&) = default;
+ MetaISectRectClipRegionAction & operator =(MetaISectRectClipRegionAction const &) = delete; // due to MetaAction
+ MetaISectRectClipRegionAction & operator =(MetaISectRectClipRegionAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaISectRectClipRegionAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaISectRectClipRegionAction( const tools::Rectangle& );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::Rectangle& GetRect() const { return maRect; }
+ void SetRect(const tools::Rectangle& rRect) { maRect = rRect; }
+};
+
+class VCL_DLLPUBLIC MetaISectRegionClipRegionAction final : public MetaAction
+{
+private:
+
+ vcl::Region maRegion;
+
+public:
+ MetaISectRegionClipRegionAction();
+ MetaISectRegionClipRegionAction(MetaISectRegionClipRegionAction const &) = default;
+ MetaISectRegionClipRegionAction(MetaISectRegionClipRegionAction &&) = default;
+ MetaISectRegionClipRegionAction & operator =(MetaISectRegionClipRegionAction const &) = delete; // due to MetaAction
+ MetaISectRegionClipRegionAction & operator =(MetaISectRegionClipRegionAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaISectRegionClipRegionAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaISectRegionClipRegionAction( const vcl::Region& );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const vcl::Region& GetRegion() const { return maRegion; }
+ void SetRegion(const vcl::Region& rRegion) { maRegion = rRegion; }
+};
+
+class VCL_DLLPUBLIC MetaMoveClipRegionAction final : public MetaAction
+{
+private:
+
+ tools::Long mnHorzMove;
+ tools::Long mnVertMove;
+
+public:
+ MetaMoveClipRegionAction();
+ MetaMoveClipRegionAction(MetaMoveClipRegionAction const &) = default;
+ MetaMoveClipRegionAction(MetaMoveClipRegionAction &&) = default;
+ MetaMoveClipRegionAction & operator =(MetaMoveClipRegionAction const &) = delete; // due to MetaAction
+ MetaMoveClipRegionAction & operator =(MetaMoveClipRegionAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaMoveClipRegionAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaMoveClipRegionAction( tools::Long nHorzMove, tools::Long nVertMove );
+
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ tools::Long GetHorzMove() const { return mnHorzMove; }
+ tools::Long GetVertMove() const { return mnVertMove; }
+ void SetHorzMove(tools::Long nHorzMove) { mnHorzMove = nHorzMove; }
+ void SetVertMove(tools::Long nVertMove) { mnVertMove = nVertMove; }
+};
+
+class VCL_DLLPUBLIC MetaLineColorAction final : public MetaAction
+{
+private:
+
+ Color maColor;
+ bool mbSet;
+
+public:
+ MetaLineColorAction();
+ MetaLineColorAction(MetaLineColorAction const &) = default;
+ MetaLineColorAction(MetaLineColorAction &&) = default;
+ MetaLineColorAction & operator =(MetaLineColorAction const &) = delete; // due to MetaAction
+ MetaLineColorAction & operator =(MetaLineColorAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaLineColorAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaLineColorAction( const Color& rColor, bool bSet );
+
+ const Color& GetColor() const { return maColor; }
+ bool IsSetting() const { return mbSet; }
+ void SetColor(const Color& rColor) { maColor = rColor; }
+ void SetSetting(bool rSet) { mbSet = rSet; }
+};
+
+class VCL_DLLPUBLIC MetaFillColorAction final : public MetaAction
+{
+private:
+
+ Color maColor;
+ bool mbSet;
+
+public:
+ MetaFillColorAction();
+ MetaFillColorAction(MetaFillColorAction const &) = default;
+ MetaFillColorAction(MetaFillColorAction &&) = default;
+ MetaFillColorAction & operator =(MetaFillColorAction const &) = delete; // due to MetaAction
+ MetaFillColorAction & operator =(MetaFillColorAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaFillColorAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaFillColorAction( const Color& rColor, bool bSet );
+
+ const Color& GetColor() const { return maColor; }
+ bool IsSetting() const { return mbSet; }
+ void SetSetting(bool rSet) { mbSet = rSet; }
+ void SetColor(Color rColor) { maColor = rColor; }
+
+};
+
+class VCL_DLLPUBLIC MetaTextColorAction final : public MetaAction
+{
+private:
+
+ Color maColor;
+
+public:
+ MetaTextColorAction();
+ MetaTextColorAction(MetaTextColorAction const &) = default;
+ MetaTextColorAction(MetaTextColorAction &&) = default;
+ MetaTextColorAction & operator =(MetaTextColorAction const &) = delete; // due to MetaAction
+ MetaTextColorAction & operator =(MetaTextColorAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaTextColorAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaTextColorAction( const Color& );
+
+ const Color& GetColor() const { return maColor; }
+ void SetColor(Color rColor) { maColor = rColor; }
+};
+
+class VCL_DLLPUBLIC MetaTextFillColorAction final : public MetaAction
+{
+private:
+
+ Color maColor;
+ bool mbSet;
+
+public:
+ MetaTextFillColorAction();
+ MetaTextFillColorAction(MetaTextFillColorAction const &) = default;
+ MetaTextFillColorAction(MetaTextFillColorAction &&) = default;
+ MetaTextFillColorAction & operator =(MetaTextFillColorAction const &) = delete; // due to MetaAction
+ MetaTextFillColorAction & operator =(MetaTextFillColorAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaTextFillColorAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaTextFillColorAction( const Color& rColor, bool bSet );
+
+ const Color& GetColor() const { return maColor; }
+ void SetColor(Color rColor) { maColor = rColor; }
+ void SetSetting(bool bSet) { mbSet = bSet; }
+ bool IsSetting() const { return mbSet; }
+
+};
+
+class VCL_DLLPUBLIC MetaTextLineColorAction final : public MetaAction
+{
+private:
+
+ Color maColor;
+ bool mbSet;
+
+public:
+ MetaTextLineColorAction();
+ MetaTextLineColorAction(MetaTextLineColorAction const &) = default;
+ MetaTextLineColorAction(MetaTextLineColorAction &&) = default;
+ MetaTextLineColorAction & operator =(MetaTextLineColorAction const &) = delete; // due to MetaAction
+ MetaTextLineColorAction & operator =(MetaTextLineColorAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaTextLineColorAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaTextLineColorAction( const Color& rColor, bool bSet );
+
+ const Color& GetColor() const { return maColor; }
+ void SetColor(const Color& rColor) { maColor = rColor; }
+ void SetSetting(bool bSet) { mbSet = bSet; }
+ bool IsSetting() const { return mbSet; }
+};
+
+class VCL_DLLPUBLIC MetaOverlineColorAction final : public MetaAction
+{
+private:
+
+ Color maColor;
+ bool mbSet;
+
+public:
+ MetaOverlineColorAction();
+ MetaOverlineColorAction(MetaOverlineColorAction const &) = default;
+ MetaOverlineColorAction(MetaOverlineColorAction &&) = default;
+ MetaOverlineColorAction & operator =(MetaOverlineColorAction const &) = delete; // due to MetaAction
+ MetaOverlineColorAction & operator =(MetaOverlineColorAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaOverlineColorAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaOverlineColorAction( const Color& rColor, bool bSet );
+
+ const Color& GetColor() const { return maColor; }
+ void SetColor(const Color& rColor) { maColor = rColor; }
+ void SetSetting(bool bSet) { mbSet = bSet; }
+ bool IsSetting() const { return mbSet; }
+};
+
+class VCL_DLLPUBLIC MetaTextAlignAction final : public MetaAction
+{
+private:
+
+ TextAlign maAlign;
+
+public:
+ MetaTextAlignAction();
+ MetaTextAlignAction(MetaTextAlignAction const &) = default;
+ MetaTextAlignAction(MetaTextAlignAction &&) = default;
+ MetaTextAlignAction & operator =(MetaTextAlignAction const &) = delete; // due to MetaAction
+ MetaTextAlignAction & operator =(MetaTextAlignAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaTextAlignAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaTextAlignAction( TextAlign eAlign );
+
+ TextAlign GetTextAlign() const { return maAlign; }
+ void SetTextAlign(TextAlign eAlign) { maAlign = eAlign; }
+};
+
+class VCL_DLLPUBLIC MetaMapModeAction final : public MetaAction
+{
+private:
+
+ MapMode maMapMode;
+
+public:
+ MetaMapModeAction();
+ MetaMapModeAction(MetaMapModeAction const &) = default;
+ MetaMapModeAction(MetaMapModeAction &&) = default;
+ MetaMapModeAction & operator =(MetaMapModeAction const &) = delete; // due to MetaAction
+ MetaMapModeAction & operator =(MetaMapModeAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaMapModeAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaMapModeAction( const MapMode& );
+
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const MapMode& GetMapMode() const { return maMapMode; }
+ void SetMapMode(const MapMode& rMapMode) { maMapMode = rMapMode; }
+};
+
+// tdf#127471 decl for friend below
+namespace emfio { class ScaledFontDetectCorrectHelper; }
+
+class VCL_DLLPUBLIC MetaFontAction final : public MetaAction
+{
+private:
+
+ vcl::Font maFont;
+
+ // tdf#127471 for import correction of own wrong written EMF/WMF files allow correction
+ // of FontScale after import. Only from there, so use a friend here and keep the method private
+ friend class emfio::ScaledFontDetectCorrectHelper;
+ void correctFontScale(tools::Long nNewFontScale) { maFont.SetAverageFontWidth(nNewFontScale); }
+
+public:
+ MetaFontAction();
+ MetaFontAction(MetaFontAction const &) = default;
+ MetaFontAction(MetaFontAction &&) = default;
+ MetaFontAction & operator =(MetaFontAction const &) = delete; // due to MetaAction
+ MetaFontAction & operator =(MetaFontAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaFontAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaFontAction( const vcl::Font& );
+
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const vcl::Font& GetFont() const { return maFont; }
+ void SetFont(const vcl::Font& rFont) { maFont = rFont; }
+
+};
+
+class VCL_DLLPUBLIC MetaPushAction final : public MetaAction
+{
+private:
+
+ vcl::PushFlags mnFlags;
+
+public:
+ MetaPushAction();
+ MetaPushAction(MetaPushAction const &) = default;
+ MetaPushAction(MetaPushAction &&) = default;
+ MetaPushAction & operator =(MetaPushAction const &) = delete; // due to MetaAction
+ MetaPushAction & operator =(MetaPushAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaPushAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaPushAction( vcl::PushFlags nFlags );
+
+ vcl::PushFlags GetFlags() const { return mnFlags; }
+ void SetPushFlags(const vcl::PushFlags nFlags) { mnFlags = nFlags; }
+};
+
+class VCL_DLLPUBLIC MetaPopAction final : public MetaAction
+{
+public:
+
+ MetaPopAction();
+ MetaPopAction(MetaPopAction const &) = default;
+ MetaPopAction(MetaPopAction &&) = default;
+ MetaPopAction & operator =(MetaPopAction const &) = delete; // due to MetaAction
+ MetaPopAction & operator =(MetaPopAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaPopAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+};
+
+class VCL_DLLPUBLIC MetaRasterOpAction final : public MetaAction
+{
+private:
+
+ RasterOp meRasterOp;
+
+public:
+ MetaRasterOpAction();
+ MetaRasterOpAction(MetaRasterOpAction const &) = default;
+ MetaRasterOpAction(MetaRasterOpAction &&) = default;
+ MetaRasterOpAction & operator =(MetaRasterOpAction const &) = delete; // due to MetaAction
+ MetaRasterOpAction & operator =(MetaRasterOpAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaRasterOpAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaRasterOpAction( RasterOp eRasterOp );
+
+ RasterOp GetRasterOp() const { return meRasterOp; }
+ void SetRasterOp(const RasterOp eRasterOp) { meRasterOp = eRasterOp; }
+};
+
+class SAL_DLLPUBLIC_RTTI MetaTransparentAction final : public MetaAction
+{
+private:
+
+ tools::PolyPolygon maPolyPoly;
+ sal_uInt16 mnTransPercent;
+
+public:
+ MetaTransparentAction();
+ MetaTransparentAction(MetaTransparentAction const &) = default;
+ MetaTransparentAction(MetaTransparentAction &&) = default;
+ MetaTransparentAction & operator =(MetaTransparentAction const &) = delete; // due to MetaAction
+ MetaTransparentAction & operator =(MetaTransparentAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaTransparentAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaTransparentAction( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransPercent );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const tools::PolyPolygon& GetPolyPolygon() const { return maPolyPoly; }
+ sal_uInt16 GetTransparence() const { return mnTransPercent; }
+ void SetPolyPolygon(const tools::PolyPolygon& rPolyPoly) { maPolyPoly = rPolyPoly; }
+ void SetTransparence(const sal_uInt16 nTransPercent) { mnTransPercent = nTransPercent; }
+
+ bool IsTransparent() const override { return true; }
+};
+
+class SAL_DLLPUBLIC_RTTI MetaFloatTransparentAction final : public MetaAction
+{
+private:
+
+ GDIMetaFile maMtf;
+ Point maPoint;
+ Size maSize;
+ Gradient maGradient;
+
+public:
+ MetaFloatTransparentAction();
+ MetaFloatTransparentAction(MetaFloatTransparentAction const &) = default;
+ MetaFloatTransparentAction(MetaFloatTransparentAction &&) = default;
+ MetaFloatTransparentAction & operator =(MetaFloatTransparentAction const &) = delete; // due to MetaAction
+ MetaFloatTransparentAction & operator =(MetaFloatTransparentAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaFloatTransparentAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaFloatTransparentAction( const GDIMetaFile& rMtf, const Point& rPos,
+ const Size& rSize, const Gradient& rGradient );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const GDIMetaFile& GetGDIMetaFile() const { return maMtf; }
+ const Point& GetPoint() const { return maPoint; }
+ const Size& GetSize() const { return maSize; }
+ const Gradient& GetGradient() const { return maGradient; }
+ void SetGDIMetaFile(const GDIMetaFile &rMtf) { maMtf = rMtf; }
+ void SetPoint(const Point& rPoint) { maPoint = rPoint; }
+ void SetSize(const Size& rSize) { maSize = rSize; }
+ void SetGradient(const Gradient& rGradient) { maGradient = rGradient; }
+ bool IsTransparent() const override { return true; }
+};
+
+class VCL_DLLPUBLIC MetaEPSAction final : public MetaAction
+{
+private:
+
+ GfxLink maGfxLink;
+ GDIMetaFile maSubst;
+ Point maPoint;
+ Size maSize;
+
+public:
+ MetaEPSAction();
+ MetaEPSAction(MetaEPSAction const &) = default;
+ MetaEPSAction(MetaEPSAction &&) = default;
+ MetaEPSAction & operator =(MetaEPSAction const &) = delete; // due to MetaAction
+ MetaEPSAction & operator =(MetaEPSAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaEPSAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaEPSAction( const Point& rPoint, const Size& rSize,
+ const GfxLink& rGfxLink, const GDIMetaFile& rSubst );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ const GfxLink& GetLink() const { return maGfxLink; }
+ const GDIMetaFile& GetSubstitute() const { return maSubst; }
+ const Point& GetPoint() const { return maPoint; }
+ const Size& GetSize() const { return maSize; }
+ void SetLink(const GfxLink& rGfxLink) { maGfxLink = rGfxLink; }
+ void SetSubstitute(const GDIMetaFile& rSubst) { maSubst = rSubst; }
+ void SetPoint(const Point& rPoint) { maPoint = rPoint; }
+ void SetSize(const Size& rSize) { maSize = rSize; }
+};
+
+class VCL_DLLPUBLIC MetaRefPointAction final : public MetaAction
+{
+private:
+
+ Point maRefPoint;
+ bool mbSet;
+
+public:
+ MetaRefPointAction();
+ MetaRefPointAction(MetaRefPointAction const &) = default;
+ MetaRefPointAction(MetaRefPointAction &&) = default;
+ MetaRefPointAction & operator =(MetaRefPointAction const &) = delete; // due to MetaAction
+ MetaRefPointAction & operator =(MetaRefPointAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaRefPointAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ MetaRefPointAction( const Point& rRefPoint, bool bSet );
+
+ const Point& GetRefPoint() const { return maRefPoint; }
+ void SetRefPoint(const Point& rRefPoint) { maRefPoint = rRefPoint; }
+ void SetSetting(const bool bSet) { mbSet = bSet; }
+ bool IsSetting() const { return mbSet; }
+};
+
+class VCL_DLLPUBLIC MetaCommentAction final : public MetaAction
+{
+private:
+
+ OString maComment;
+ sal_Int32 mnValue;
+ sal_uInt32 mnDataSize;
+ std::unique_ptr<sal_uInt8[]>
+ mpData;
+
+ SAL_DLLPRIVATE void ImplInitDynamicData( const sal_uInt8* pData, sal_uInt32 nDataSize );
+
+private:
+ virtual ~MetaCommentAction() override;
+
+public:
+ explicit MetaCommentAction();
+ explicit MetaCommentAction( const MetaCommentAction& rAct );
+ explicit MetaCommentAction( const OString& rComment, sal_Int32 nValue = 0, const sal_uInt8* pData = nullptr, sal_uInt32 nDataSize = 0 );
+
+ virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
+ virtual void Scale( double fScaleX, double fScaleY ) override;
+
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ const OString& GetComment() const { return maComment; }
+ sal_Int32 GetValue() const { return mnValue; }
+ sal_uInt32 GetDataSize() const { return mnDataSize; }
+ const sal_uInt8* GetData() const { return mpData.get(); }
+ void SetComment(const OString& rComment) { maComment = rComment; }
+ void SetValue(const sal_Int32 nValue) { mnValue = nValue; }
+ void SetDataSize(const sal_Int32 nDataSize) { mnDataSize = nDataSize; }
+ void SetData(const sal_uInt8* pData, const sal_uInt32 nDataSize) { ImplInitDynamicData(pData, nDataSize); }
+};
+
+class VCL_DLLPUBLIC MetaLayoutModeAction final : public MetaAction
+{
+private:
+
+ vcl::text::ComplexTextLayoutFlags mnLayoutMode;
+
+public:
+ MetaLayoutModeAction();
+ MetaLayoutModeAction(MetaLayoutModeAction const &) = default;
+ MetaLayoutModeAction(MetaLayoutModeAction &&) = default;
+ MetaLayoutModeAction & operator =(MetaLayoutModeAction const &) = delete; // due to MetaAction
+ MetaLayoutModeAction & operator =(MetaLayoutModeAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaLayoutModeAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaLayoutModeAction( vcl::text::ComplexTextLayoutFlags nLayoutMode );
+
+ vcl::text::ComplexTextLayoutFlags GetLayoutMode() const { return mnLayoutMode; }
+ void SetLayoutMode(const vcl::text::ComplexTextLayoutFlags nLayoutMode) { mnLayoutMode = nLayoutMode; }
+};
+
+class VCL_DLLPUBLIC MetaTextLanguageAction final : public MetaAction
+{
+private:
+
+ LanguageType meTextLanguage;
+
+public:
+ MetaTextLanguageAction();
+ MetaTextLanguageAction(MetaTextLanguageAction const &) = default;
+ MetaTextLanguageAction(MetaTextLanguageAction &&) = default;
+ MetaTextLanguageAction & operator =(MetaTextLanguageAction const &) = delete; // due to MetaAction
+ MetaTextLanguageAction & operator =(MetaTextLanguageAction &&) = delete; // due to MetaAction
+private:
+ virtual ~MetaTextLanguageAction() override;
+public:
+ virtual void Execute( OutputDevice* pOut ) override;
+ virtual rtl::Reference<MetaAction> Clone() const override;
+
+ explicit MetaTextLanguageAction( LanguageType );
+
+ LanguageType GetTextLanguage() const { return meTextLanguage; }
+ void SetTextLanguage(const LanguageType eTextLanguage) { meTextLanguage = eTextLanguage; }
+};
+
+#endif // INCLUDED_VCL_METAACT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metaactiontypes.hxx b/include/vcl/metaactiontypes.hxx
new file mode 100644
index 000000000..5a8a70cae
--- /dev/null
+++ b/include/vcl/metaactiontypes.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF), under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_METAACTIONTYPES_HXX
+#define INCLUDED_VCL_METAACTIONTYPES_HXX
+
+enum class MetaActionType
+{
+ NONE = 0,
+ PIXEL = 100,
+ POINT = 101,
+ LINE = 102,
+ RECT = 103,
+ ROUNDRECT = 104,
+ ELLIPSE = 105,
+ ARC = 106,
+ PIE = 107,
+ CHORD = 108,
+ POLYLINE = 109,
+ POLYGON = 110,
+ POLYPOLYGON = 111,
+ TEXT = 112,
+ TEXTARRAY = 113,
+ STRETCHTEXT = 114,
+ TEXTRECT = 115,
+ BMP = 116,
+ BMPSCALE = 117,
+ BMPSCALEPART = 118,
+ BMPEX = 119,
+ BMPEXSCALE = 120,
+ BMPEXSCALEPART = 121,
+ MASK = 122,
+ MASKSCALE = 123,
+ MASKSCALEPART = 124,
+ GRADIENT = 125,
+ HATCH = 126,
+ WALLPAPER = 127,
+ CLIPREGION = 128,
+ ISECTRECTCLIPREGION = 129,
+ ISECTREGIONCLIPREGION = 130,
+ MOVECLIPREGION = 131,
+ LINECOLOR = 132,
+ FILLCOLOR = 133,
+ TEXTCOLOR = 134,
+ TEXTFILLCOLOR = 135,
+ TEXTALIGN = 136,
+ MAPMODE = 137,
+ FONT = 138,
+ PUSH = 139,
+ POP = 140,
+ RASTEROP = 141,
+ Transparent = 142,
+ EPS = 143,
+ REFPOINT = 144,
+ TEXTLINECOLOR = 145,
+ TEXTLINE = 146,
+ FLOATTRANSPARENT = 147,
+ GRADIENTEX = 148,
+ LAYOUTMODE = 149,
+ TEXTLANGUAGE = 150,
+ OVERLINECOLOR = 151,
+
+ COMMENT = 512,
+ LAST = COMMENT
+};
+
+#endif // INCLUDED_VCL_METAACTIONTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx
new file mode 100644
index 000000000..1e03232d7
--- /dev/null
+++ b/include/vcl/metric.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <tools/ref.hxx>
+#include <tools/gen.hxx>
+
+#include <vcl/dllapi.h>
+#include <vcl/font.hxx>
+
+class FontCharMap;
+namespace vcl::font { class PhysicalFontFace; }
+
+typedef tools::SvRef<FontCharMap> FontCharMapRef;
+
+class VCL_DLLPUBLIC FontMetric : public vcl::Font
+{
+public:
+ explicit FontMetric();
+ FontMetric( const FontMetric& ); // TODO make this explicit
+ FontMetric(vcl::font::PhysicalFontFace const& rFace);
+ ~FontMetric() override;
+
+ tools::Long GetAscent() const { return mnAscent; }
+ tools::Long GetDescent() const { return mnDescent; }
+ tools::Long GetInternalLeading() const { return mnIntLeading; }
+ tools::Long GetExternalLeading() const { return mnExtLeading; }
+ tools::Long GetLineHeight() const { return mnLineHeight; } // TODO this is ascent + descnt
+ tools::Long GetSlant() const { return mnSlant; }
+ tools::Long GetBulletOffset() const { return mnBulletOffset; }
+ tools::Long GetHangingBaseline() const { return mnHangingBaseline; }
+
+ void SetAscent( tools::Long nAscent ) { mnAscent = nAscent; }
+ void SetDescent( tools::Long nDescent ) { mnDescent = nDescent; }
+ void SetExternalLeading( tools::Long nExtLeading ) { mnExtLeading = nExtLeading; }
+ void SetInternalLeading( tools::Long nIntLeading ) { mnIntLeading = nIntLeading; }
+ void SetLineHeight( tools::Long nHeight ) { mnLineHeight = nHeight; } // TODO this is ascent + descent
+ void SetSlant( tools::Long nSlant ) { mnSlant = nSlant; }
+ void SetBulletOffset( tools::Long nOffset ) { mnBulletOffset = nOffset; }
+ void SetHangingBaseline( tools::Long nBaseline ) { mnHangingBaseline = nBaseline; }
+
+ bool IsFullstopCentered() const { return mbFullstopCentered; }
+
+ void SetFullstopCenteredFlag( bool bCentered ) { mbFullstopCentered = bCentered; }
+
+ using Font::operator=;
+ FontMetric& operator=( const FontMetric& rMetric );
+ FontMetric& operator=( FontMetric&& rMetric );
+ bool operator==( const FontMetric& rMetric ) const;
+ bool operator!=( const FontMetric& rMetric ) const
+ { return !operator==( rMetric ); }
+
+ bool EqualIgnoreColor( const FontMetric& ) const;
+
+ // Compute value usable as hash.
+ size_t GetHashValueIgnoreColor() const;
+
+private:
+ bool EqualNoBase( const FontMetric& ) const;
+ size_t GetHashValueNoBase() const;
+ tools::Long mnAscent; // Ascent
+ tools::Long mnDescent; // Descent
+ tools::Long mnIntLeading; // Internal Leading
+ tools::Long mnExtLeading; // External Leading
+ tools::Long mnLineHeight; // Ascent+Descent+EmphasisMark
+ tools::Long mnSlant; // Slant
+ tools::Long mnBulletOffset; // Offset for non-printing character
+ tools::Long mnHangingBaseline; // Offset from Romn baseline to hanging baseline.
+
+ bool mbFullstopCentered;
+};
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const FontMetric& rMetric )
+{
+ stream << "{"
+ << "name=" << "\"" << rMetric.GetFamilyName() << "\""
+ << ",size=(" << rMetric.GetFontSize().Width() << "," << rMetric.GetFontSize().Height() << ")"
+ << ",ascent=" << rMetric.GetAscent()
+ << ",descent=" << rMetric.GetDescent()
+ << ",intLeading=" << rMetric.GetInternalLeading()
+ << ",extLeading=" << rMetric.GetExternalLeading()
+ << ",lineHeight=" << rMetric.GetLineHeight()
+ << ",slant=" << rMetric.GetSlant()
+ << "}";
+ return stream;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/mnemonic.hxx b/include/vcl/mnemonic.hxx
new file mode 100644
index 000000000..23ea1d1e6
--- /dev/null
+++ b/include/vcl/mnemonic.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_MNEMONIC_HXX
+#define INCLUDED_VCL_MNEMONIC_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <rtl/ustring.hxx>
+#include <vcl/dllapi.h>
+
+namespace com::sun::star::i18n { class XCharacterClassification; }
+
+// Mnemonic Chars, which we want support
+// Latin 0-9
+#define MNEMONIC_RANGE_1_START 0x30
+#define MNEMONIC_RANGE_1_END 0x39
+// Latin a-z
+#define MNEMONIC_RANGE_2_START 0x61
+#define MNEMONIC_RANGE_2_END 0x7A
+// Cyrillic
+#define MNEMONIC_RANGE_3_START 0x0430
+#define MNEMONIC_RANGE_3_END 0x044F
+// Greek
+#define MNEMONIC_RANGE_4_START 0x03B1
+#define MNEMONIC_RANGE_4_END 0x03CB
+#define MNEMONIC_RANGES 4
+#define MAX_MNEMONICS ((MNEMONIC_RANGE_1_END-MNEMONIC_RANGE_1_START+1)+\
+ (MNEMONIC_RANGE_2_END-MNEMONIC_RANGE_2_START+1)+\
+ (MNEMONIC_RANGE_3_END-MNEMONIC_RANGE_3_START+1)+\
+ (MNEMONIC_RANGE_4_END-MNEMONIC_RANGE_4_START+1))
+
+#define MNEMONIC_CHAR u'~'
+#define MNEMONIC_INDEX_NOTFOUND (sal_uInt16(0xFFFF))
+
+
+class VCL_DLLPUBLIC MnemonicGenerator
+{
+ sal_Unicode m_cMnemonic;
+ // 0 == Mnemonic; >0 == count of characters
+ sal_uInt8 maMnemonics[MAX_MNEMONICS];
+ css::uno::Reference< css::i18n::XCharacterClassification > mxCharClass;
+
+ SAL_DLLPRIVATE static sal_uInt16 ImplGetMnemonicIndex( sal_Unicode c );
+ SAL_DLLPRIVATE sal_Unicode ImplFindMnemonic( const OUString& rKey );
+
+public:
+ MnemonicGenerator(sal_Unicode cMnemonic = MNEMONIC_CHAR);
+
+ void RegisterMnemonic( const OUString& rKey );
+ [[nodiscard]] OUString CreateMnemonic(const OUString& rKey);
+ css::uno::Reference< css::i18n::XCharacterClassification > const & GetCharClass();
+
+ // returns a string where all '~'-characters and CJK mnemonics of the form (~A) are completely removed
+ static OUString EraseAllMnemonicChars( const OUString& rStr );
+};
+
+#endif // INCLUDED_VCL_MNEMONIC_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/mtfxmldump.hxx b/include/vcl/mtfxmldump.hxx
new file mode 100644
index 000000000..9970ea8a0
--- /dev/null
+++ b/include/vcl/mtfxmldump.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_MTFXMLDUMP_HXX
+#define INCLUDED_VCL_MTFXMLDUMP_HXX
+
+#include <sal/config.h>
+#include <vcl/dllapi.h>
+#include <vcl/metaactiontypes.hxx>
+#include <o3tl/enumarray.hxx>
+
+namespace tools
+{
+class XmlWriter;
+}
+class GDIMetaFile;
+class SvStream;
+
+enum class MetaActionType;
+
+/**
+ * Class that is used for testing of the decomposition into shapes. Used like
+ * this:
+ *
+ * std::shared_ptr<GDIMetaFile> xMetaFile = xDocShRef->GetPreviewMetaFile();
+ * MetafileXmlDump dumper;
+ * xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile);
+ * CPPUNIT_ASSERT(pXmlDoc);
+ *
+ * assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]", "x", "2093");
+ *
+ * To see the dump to be able to create the assertXPath() call, use:
+ *
+ * xMetaFile->dumpAsXml();
+ *
+ * and check the output in /tmp/metafile.xml
+ */
+class VCL_DLLPUBLIC MetafileXmlDump final
+{
+ o3tl::enumarray<MetaActionType, bool> maFilter;
+
+ void writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& rWriter);
+
+public:
+ MetafileXmlDump();
+
+ void filterActionType(const MetaActionType nActionType, bool bShouldFilter);
+ void filterAllActionTypes();
+
+ /** The actual result that will be used for testing.
+ */
+ void dump(const GDIMetaFile& rMetaFile, SvStream& rStream);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/naturalsort.hxx b/include/vcl/naturalsort.hxx
new file mode 100644
index 000000000..1883bb357
--- /dev/null
+++ b/include/vcl/naturalsort.hxx
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace vcl
+{
+VCL_DLLPUBLIC sal_Int32 NaturalSortCompare(const OUString& rA, const OUString& rB);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/notebookbar/NotebookBarAddonsMerger.hxx b/include/vcl/notebookbar/NotebookBarAddonsMerger.hxx
new file mode 100644
index 000000000..87c843620
--- /dev/null
+++ b/include/vcl/notebookbar/NotebookBarAddonsMerger.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_NOTEBOOKBARADDONSMERGER_HXX
+#define INCLUDED_VCL_NOTEBOOKBARADDONSMERGER_HXX
+
+#include <vcl/builder.hxx>
+#include <vcl/window.hxx>
+#include <vcl/image.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include <vector>
+
+class Menu;
+
+struct NotebookBarAddonsItem
+{
+ std::vector<Image> aImageValues;
+ std::vector<css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>>> aAddonValues;
+};
+
+struct AddonNotebookBarItem
+{
+ OUString sCommandURL;
+ OUString sLabel;
+ OUString sTarget;
+ OUString sContext;
+ OUString sControlType;
+ sal_uInt16 nWidth;
+ OUString sStyle;
+};
+
+namespace NotebookBarAddonsMerger
+{
+void MergeNotebookBarAddons(vcl::Window* pParent, const VclBuilder::customMakeWidget& pFunction,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ const NotebookBarAddonsItem& aNotebookBarAddonsItem,
+ VclBuilder::stringmap& rVec);
+void MergeNotebookBarMenuAddons(Menu* pPopupMenu, sal_Int16 nItemId, const OString& sItemIdName,
+ NotebookBarAddonsItem& aNotebookBarAddonsItem);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/notebookbar/notebookbar.hxx b/include/vcl/notebookbar/notebookbar.hxx
new file mode 100644
index 000000000..635bea058
--- /dev/null
+++ b/include/vcl/notebookbar/notebookbar.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/syswin.hxx>
+#include <vcl/ctrl.hxx>
+#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx>
+#include <vcl/settings.hxx>
+#include <set>
+#include <vector>
+
+namespace com::sun::star::ui { class XContextChangeEventListener; }
+
+class NotebookbarContextControl;
+class SystemWindow;
+class SfxViewShell;
+
+/// This implements Widget Layout-based notebook-like menu bar.
+class VCL_DLLPUBLIC NotebookBar final : public Control, public VclBuilderContainer
+{
+friend class NotebookBarContextChangeEventListener;
+public:
+ NotebookBar(Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ const NotebookBarAddonsItem& aNotebookBarAddonsItem);
+ virtual ~NotebookBar() override;
+ virtual void dispose() override;
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual Size GetOptimalSize() const override;
+ virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) override;
+ virtual void Resize() override;
+
+ void SetSystemWindow(SystemWindow* pSystemWindow);
+
+ void StateChanged(const StateChangedType nStateChange ) override;
+
+ void DataChanged(const DataChangedEvent& rDCEvt) override;
+
+ void ControlListenerForCurrentController(bool bListen);
+ void StopListeningAllControllers();
+
+ bool IsWelded() const { return m_bIsWelded; }
+ VclPtr<vcl::Window>& GetMainContainer() { return m_xVclContentArea; }
+ const OUString & GetUIFilePath() const { return m_sUIXMLDescription; }
+ void SetDisposeCallback(const Link<const SfxViewShell*, void> rDisposeCallback, const SfxViewShell* pViewShell);
+
+private:
+ VclPtr<SystemWindow> m_pSystemWindow;
+ css::uno::Reference<css::ui::XContextChangeEventListener> m_pEventListener;
+ std::set<css::uno::Reference<css::frame::XController>> m_alisteningControllers;
+ std::vector<NotebookbarContextControl*> m_pContextContainers;
+ css::uno::Reference<css::frame::XFrame> mxFrame;
+ const SfxViewShell* m_pViewShell;
+
+ VclPtr<vcl::Window> m_xVclContentArea;
+ bool m_bIsWelded;
+ OUString m_sUIXMLDescription;
+ Link<const SfxViewShell*, void> m_rDisposeLink;
+
+ AllSettings DefaultSettings;
+ AllSettings PersonaSettings;
+
+ void UpdateBackground();
+
+ void UpdateDefaultSettings();
+ void UpdatePersonaSettings();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/oldprintadaptor.hxx b/include/vcl/oldprintadaptor.hxx
new file mode 100644
index 000000000..3b74b0d76
--- /dev/null
+++ b/include/vcl/oldprintadaptor.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_OLDPRINTADAPTOR_HXX
+#define INCLUDED_VCL_OLDPRINTADAPTOR_HXX
+
+#include <config_options.h>
+#include <memory>
+#include <vcl/print.hxx>
+
+namespace weld
+{
+ class Window;
+}
+
+namespace vcl
+{
+ struct ImplOldStyleAdaptorData;
+ class UNLESS_MERGELIBS(VCL_DLLPUBLIC) OldStylePrintAdaptor final : public PrinterController
+ {
+ std::unique_ptr<ImplOldStyleAdaptorData> mpData;
+ public:
+ OldStylePrintAdaptor(const VclPtr<Printer>&, weld::Window*);
+ virtual ~OldStylePrintAdaptor() override;
+
+ void StartPage();
+ void EndPage();
+
+ virtual int getPageCount() const override;
+ virtual css::uno::Sequence< css::beans::PropertyValue > getPageParameters( int i_nPage ) const override;
+ virtual void printPage( int i_nPage ) const override;
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
new file mode 100644
index 000000000..428df1266
--- /dev/null
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <vcl/sysdata.hxx>
+#include <vcl/vclptr.hxx>
+#include <rtl/ref.hxx>
+
+class Point;
+class Size;
+class SystemChildWindow;
+namespace vcl { class Window; }
+
+/// Holds the information of our new child window
+struct VCL_DLLPUBLIC GLWindow
+{
+ unsigned int Width;
+ unsigned int Height;
+ bool bMultiSampleSupported;
+
+ GLWindow()
+ : Width(0)
+ , Height(0)
+ , bMultiSampleSupported(false)
+ {
+ }
+
+ virtual bool Synchronize(bool bOnoff) const;
+
+ virtual ~GLWindow();
+};
+
+class VCL_DLLPUBLIC OpenGLContext
+{
+ friend class OpenGLTests;
+protected:
+ OpenGLContext();
+public:
+ static rtl::Reference<OpenGLContext> Create();
+ virtual ~OpenGLContext();
+
+ // Avoid implicitly defined copy constructors/assignments for the DLLPUBLIC class (they may
+ // require forward-declared classes used internally to be defined in places using OpenGLContext)
+ OpenGLContext(const OpenGLContext&) = delete;
+ OpenGLContext(OpenGLContext&&) = delete;
+ OpenGLContext& operator=(const OpenGLContext&) = delete;
+ OpenGLContext& operator=(OpenGLContext&&) = delete;
+
+ void acquire() { mnRefCount++; }
+ void release() { if ( --mnRefCount == 0 ) delete this; }
+ void dispose();
+
+ void requestLegacyContext();
+
+ bool init(vcl::Window* pParent);
+
+ void reset();
+
+ /// Is this GL context the current context ?
+ virtual bool isCurrent();
+ /// Is any GL context the current context ?
+ virtual bool isAnyCurrent();
+ /// release bound resources from the current context
+ static void clearCurrent();
+ /// release contexts etc. before (potentially) allowing another thread run.
+ static void prepareForYield();
+ /// Is there a current GL context ?
+ static bool hasCurrent();
+
+ /// make this GL context current - so it is implicit in subsequent GL calls
+ virtual void makeCurrent();
+ /// Put this GL context to the end of the context list.
+ void registerAsCurrent();
+ /// reset the GL context so this context is not implicit in subsequent GL calls.
+ virtual void resetCurrent();
+ /// unbind the GL_FRAMEBUFFER to its default state, needed for gtk3
+ virtual void restoreDefaultFramebuffer();
+ virtual void swapBuffers();
+ virtual void sync();
+ void show();
+
+ void setWinPosAndSize(const Point &rPos, const Size& rSize);
+ virtual const GLWindow& getOpenGLWindow() const = 0;
+
+ SystemChildWindow* getChildWindow();
+ const SystemChildWindow* getChildWindow() const;
+
+ bool isInitialized() const
+ {
+ return mbInitialized;
+ }
+
+ virtual SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext);
+
+private:
+ virtual void initWindow();
+ virtual void destroyCurrentContext();
+ virtual void adjustToNewSize();
+
+protected:
+ bool InitGL();
+ static void InitGLDebugging();
+ static void InitChildWindow(SystemChildWindow *pChildWindow);
+ static void BuffersSwapped();
+ virtual GLWindow& getModifiableOpenGLWindow() = 0;
+ virtual bool ImplInit();
+
+ VclPtr<vcl::Window> m_xWindow;
+ VclPtr<vcl::Window> mpWindow; //points to m_pWindow or the parent window, don't delete it
+ VclPtr<SystemChildWindow> m_pChildWindow;
+ bool mbInitialized;
+ int mnRefCount;
+ bool mbRequestLegacyContext;
+
+public:
+
+ // Don't hold references to ourselves:
+ OpenGLContext *mpPrevContext;
+ OpenGLContext *mpNextContext;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
new file mode 100644
index 000000000..45383bd6f
--- /dev/null
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_OPENGL_OPENGLHELPER_HXX
+#define INCLUDED_VCL_OPENGL_OPENGLHELPER_HXX
+
+#include <epoxy/gl.h>
+#include <sal/detail/log.h>
+#include <vcl/dllapi.h>
+#include <vcl/bitmapex.hxx>
+
+#include <rtl/ustring.hxx>
+#include <sstream>
+#include <string_view>
+
+/// Helper to do a SAL_INFO as well as a GL log.
+#define VCL_GL_INFO(stream) \
+ do { \
+ if (SAL_DETAIL_ENABLE_LOG_INFO) \
+ { \
+ ::std::ostringstream detail_stream; \
+ detail_stream << stream; \
+ OpenGLHelper::debugMsgStream(detail_stream); \
+ } \
+ } while (false)
+
+/// Helper to do a SAL_WARN as well as a GL log.
+#define VCL_GL_WARN(stream) \
+ do { \
+ if (SAL_DETAIL_ENABLE_LOG_INFO) \
+ { \
+ ::std::ostringstream detail_stream; \
+ detail_stream << stream; \
+ OpenGLHelper::debugMsgStreamWarn(detail_stream); \
+ } \
+ } while (false)
+
+// All member functions static and VCL_DLLPUBLIC. Basically a glorified namespace.
+struct VCL_DLLPUBLIC OpenGLHelper
+{
+ OpenGLHelper() = delete; // Should not be instantiated
+
+public:
+
+#if defined _WIN32
+ static OString GetDigest(const OUString& rVertexShaderName, const OUString& rFragmentShaderName, std::string_view preamble );
+#endif
+
+ static GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName, const OUString& rGeometryShaderName, std::string_view preamble, std::string_view rDigest );
+ static GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName, std::string_view preamble, std::string_view rDigest );
+ static GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName, const OUString& rGeometryShaderName);
+ static GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName);
+
+ /**
+ * The caller is responsible for allocating the memory for the buffer before calling
+ * this method. The buffer size is assumed to be 4*width*height and the format
+ * to be OptimalBufferFormat().
+ **/
+ static BitmapEx ConvertBufferToBitmapEx(const sal_uInt8* const pBuffer, tools::Long nWidth, tools::Long nHeight);
+ /**
+ * Returns the optimal buffer format for OpenGL (GL_BGRA or GL_RGBA).
+ **/
+ static GLenum OptimalBufferFormat();
+ static void renderToFile(tools::Long nWidth, tools::Long nHeight, const OUString& rFileName);
+
+ static const char* GLErrorString(GLenum errorCode);
+
+ /**
+ * The caller is responsible for deleting the buffer objects identified by
+ * nFramebufferId, nRenderbufferDepthId and nRenderbufferColorId.
+ * This create a buffer for rendering to texture and should be freed with
+ * glDeleteTextures.
+ *
+ * @param nWidth Width of frame
+ * @param nHeight Height of frame
+ * @param nFramebufferId FrameBuffer ID
+ * @param nRenderbufferDepthId RenderBuffer's depth ID
+ * @param nRenderbufferColorId RenderBuffer's color ID
+ */
+ static void createFramebuffer(tools::Long nWidth, tools::Long nHeight, GLuint& nFramebufferId,
+ GLuint& nRenderbufferDepthId, GLuint& nRenderbufferColorId);
+
+ /// Get OpenGL version (needs a context)
+ static float getGLVersion();
+
+ static void checkGLError(const char* aFile, size_t nLine);
+
+ /**
+ * Insert a glDebugMessage into the queue - helpful for debugging
+ * with apitrace to annotate the output and correlate it with code.
+ */
+#if defined __GNUC__
+ __attribute__ ((format (printf, 2, 3)))
+#endif
+ static void debugMsgPrint(const int nType, const char *pFormat, ...);
+ static void debugMsgStream(std::ostringstream const &pStream);
+ static void debugMsgStreamWarn(std::ostringstream const &pStream);
+
+ /**
+ * checks if the device/driver pair is on our OpenGL denylist
+ */
+ static bool isDeviceDenylisted();
+
+ /**
+ * checks if the system supports all features that are necessary for the OpenGL support
+ */
+ static bool supportsOpenGL();
+};
+
+#ifdef SAL_LOG_WARN
+#define CHECK_GL_ERROR() OpenGLHelper::checkGLError(__FILE__, __LINE__)
+#else
+#define CHECK_GL_ERROR() do { } while (false)
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/opengl/OpenGLWrapper.hxx b/include/vcl/opengl/OpenGLWrapper.hxx
new file mode 100644
index 000000000..3711b3fd4
--- /dev/null
+++ b/include/vcl/opengl/OpenGLWrapper.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+// Fully wrapped methods that have no exotic GL header deps.
+
+#ifndef INCLUDED_VCL_OPENGL_OPENGLWRAPPER_HXX
+#define INCLUDED_VCL_OPENGL_OPENGLWRAPPER_HXX
+
+#include <config_features.h>
+#include <vcl/dllapi.h>
+
+// All member functions static and VCL_DLLPUBLIC. Basically a glorified namespace.
+struct VCL_DLLPUBLIC OpenGLWrapper
+{
+ OpenGLWrapper() = delete; // Should not be instantiated
+
+#if HAVE_FEATURE_UI
+ /**
+ * Returns the number of times OpenGL buffers have been swapped.
+ */
+ static sal_Int64 getBufferSwapCounter();
+#endif
+};
+
+#endif // INCLUDED_VCL_OPENGL_OPENGLWRAPPER_HXX
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
new file mode 100644
index 000000000..ea14e3d01
--- /dev/null
+++ b/include/vcl/outdev.hxx
@@ -0,0 +1,1930 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <o3tl/span.hxx>
+#include <tools/gen.hxx>
+#include <tools/ref.hxx>
+#include <tools/solar.h>
+#include <tools/color.hxx>
+#include <tools/poly.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/cairo.hxx>
+#include <vcl/devicecoordinate.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/font.hxx>
+#include <vcl/region.hxx>
+#include <vcl/rendercontext/AddFontSubstituteFlags.hxx>
+#include <vcl/rendercontext/AntialiasingFlags.hxx>
+#include <vcl/rendercontext/SystemTextColorFlags.hxx>
+#include <vcl/rendercontext/DrawGridFlags.hxx>
+#include <vcl/rendercontext/DrawImageFlags.hxx>
+#include <vcl/rendercontext/DrawModeFlags.hxx>
+#include <vcl/rendercontext/DrawTextFlags.hxx>
+#include <vcl/rendercontext/GetDefaultFontFlags.hxx>
+#include <vcl/rendercontext/ImplMapRes.hxx>
+#include <vcl/rendercontext/InvertFlags.hxx>
+#include <vcl/rendercontext/RasterOp.hxx>
+#include <vcl/rendercontext/SalLayoutFlags.hxx>
+#include <vcl/rendercontext/State.hxx>
+#include <vcl/mapmod.hxx>
+#include <vcl/wall.hxx>
+#include <vcl/metaactiontypes.hxx>
+#include <vcl/salnativewidgets.hxx>
+#include <vcl/vclreferencebase.hxx>
+
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+#include <unotools/fontdefs.hxx>
+#include <cppuhelper/weakref.hxx>
+
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/awt/DeviceInfo.hpp>
+
+#include <memory>
+#include <string_view>
+#include <vector>
+
+struct ImplOutDevData;
+class LogicalFontInstance;
+struct SystemGraphicsData;
+class ImplFontCache;
+class ImplMultiTextLineInfo;
+class SalGraphics;
+class Gradient;
+class Hatch;
+class AllSettings;
+class BitmapReadAccess;
+class BitmapEx;
+class Image;
+class TextRectInfo;
+class FontMetric;
+class GDIMetaFile;
+class GfxLink;
+namespace tools {
+ class Line;
+}
+class LineInfo;
+class AlphaMask;
+class FontCharMap;
+class SalLayout;
+class VirtualDevice;
+struct SalTwoRect;
+class Printer;
+class VCLXGraphics;
+class OutDevStateStack;
+class SalLayoutGlyphs;
+
+namespace vcl
+{
+ class ExtOutDevData;
+ class ITextLayout;
+ struct FontCapabilities;
+ class Window;
+ class WindowOutputDevice;
+ namespace font {
+ struct Feature;
+ class PhysicalFontCollection;
+ class PhysicalFontFaceCollection;
+ }
+
+ namespace text {
+ class ImplLayoutArgs;
+ class TextLayoutCache;
+ }
+}
+
+namespace basegfx {
+ class B2DHomMatrix;
+ class B2DPolygon;
+ class B2IVector;
+ typedef B2IVector B2ISize;
+}
+
+namespace com::sun::star::awt {
+ class XGraphics;
+}
+
+namespace com::sun::star::rendering {
+ class XCanvas;
+ class XSpriteCanvas;
+}
+namespace com::sun::star::linguistic2 {
+ class XHyphenator;
+}
+namespace com::sun::star::i18n {
+ class XBreakIterator;
+}
+
+#if defined UNX
+#define GLYPH_FONT_HEIGHT 128
+#else
+#define GLYPH_FONT_HEIGHT 256
+#endif
+
+// OutputDevice-Types
+
+enum OutDevType { OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV, OUTDEV_PDF };
+
+enum class OutDevViewType { DontKnow, PrintPreview, SlideShow };
+
+// OutputDevice
+
+typedef tools::SvRef<FontCharMap> FontCharMapRef;
+
+BmpMirrorFlags AdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix );
+void AdjustTwoRect( SalTwoRect& rTwoRect, const tools::Rectangle& rValidSrcRect );
+
+class OutputDevice;
+
+namespace vcl {
+ typedef OutputDevice RenderContext;
+}
+
+VCL_DLLPUBLIC void InvertFocusRect(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
+
+typedef struct _cairo_surface cairo_surface_t;
+
+/**
+* Some things multiple-inherit from VclAbstractDialog and OutputDevice,
+* so we need to use virtual inheritance to keep the referencing counting
+* OK.
+*/
+class SAL_WARN_UNUSED VCL_DLLPUBLIC OutputDevice : public virtual VclReferenceBase
+{
+ friend class Printer;
+ friend class VirtualDevice;
+ friend class vcl::Window;
+ friend class vcl::WindowOutputDevice;
+ friend class WorkWindow;
+ friend void ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, tools::Long nNewHeight );
+
+private:
+ OutputDevice(const OutputDevice&) = delete;
+ OutputDevice& operator=(const OutputDevice&) = delete;
+
+ mutable SalGraphics* mpGraphics; ///< Graphics context to draw on
+ mutable VclPtr<OutputDevice> mpPrevGraphics; ///< Previous output device in list
+ mutable VclPtr<OutputDevice> mpNextGraphics; ///< Next output device in list
+ GDIMetaFile* mpMetaFile;
+ mutable rtl::Reference<LogicalFontInstance> mpFontInstance;
+ mutable std::unique_ptr<vcl::font::PhysicalFontFaceCollection> mpFontFaceCollection;
+ std::vector<vcl::State> maOutDevStateStack;
+ std::unique_ptr<ImplOutDevData> mpOutDevData;
+ std::vector< VCLXGraphics* >* mpUnoGraphicsList;
+ vcl::ExtOutDevData* mpExtOutDevData;
+ // The canvas interface for this output device. Is persistent after the first GetCanvas() call
+ mutable css::uno::WeakReference< css::rendering::XCanvas > mxCanvas;
+
+ // TEMP TEMP TEMP
+ VclPtr<VirtualDevice> mpAlphaVDev;
+
+ /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
+ tools::Long mnOutOffOrigX;
+ /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
+ tools::Long mnOutOffLogicX;
+ /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
+ tools::Long mnOutOffOrigY;
+ /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
+ tools::Long mnOutOffLogicY;
+ /// Output offset for device output in pixel (pseudo window offset within window system's frames)
+ tools::Long mnOutOffX;
+ /// Output offset for device output in pixel (pseudo window offset within window system's frames)
+ tools::Long mnOutOffY;
+ tools::Long mnOutWidth;
+ tools::Long mnOutHeight;
+ sal_Int32 mnDPIX;
+ sal_Int32 mnDPIY;
+ sal_Int32 mnDPIScalePercentage; ///< For HiDPI displays, we want to draw elements for a percentage larger
+ /// font specific text alignment offsets in pixel units
+ mutable tools::Long mnTextOffX;
+ mutable tools::Long mnTextOffY;
+ mutable tools::Long mnEmphasisAscent;
+ mutable tools::Long mnEmphasisDescent;
+ DrawModeFlags mnDrawMode;
+ vcl::text::ComplexTextLayoutFlags mnTextLayoutMode;
+ ImplMapRes maMapRes;
+ const OutDevType meOutDevType;
+ OutDevViewType meOutDevViewType;
+ vcl::Region maRegion; // contains the clip region, see SetClipRegion(...)
+ Color maLineColor;
+ Color maFillColor;
+ vcl::Font maFont;
+ Color maTextColor;
+ Color maTextLineColor;
+ Color maOverlineColor;
+ RasterOp meRasterOp;
+ Wallpaper maBackground;
+ std::unique_ptr<AllSettings> mxSettings;
+ MapMode maMapMode;
+ Point maRefPoint;
+ AntialiasingFlags mnAntialiasing;
+ LanguageType meTextLanguage;
+ bool mbTextRenderModeForResolutionIndependentLayout;
+
+ mutable bool mbMap : 1;
+ mutable bool mbClipRegion : 1;
+ mutable bool mbBackground : 1;
+ mutable bool mbOutput : 1;
+ mutable bool mbDevOutput : 1;
+ mutable bool mbOutputClipped : 1;
+ mutable bool mbLineColor : 1;
+ mutable bool mbFillColor : 1;
+ mutable bool mbInitLineColor : 1;
+ mutable bool mbInitFillColor : 1;
+ mutable bool mbInitFont : 1;
+ mutable bool mbInitTextColor : 1;
+ mutable bool mbInitClipRegion : 1;
+ mutable bool mbClipRegionSet : 1;
+ mutable bool mbNewFont : 1;
+ mutable bool mbTextLines : 1;
+ mutable bool mbTextSpecial : 1;
+ mutable bool mbRefPoint : 1;
+ mutable bool mbEnableRTL : 1;
+
+protected:
+ mutable std::shared_ptr<vcl::font::PhysicalFontCollection> mxFontCollection;
+ mutable std::shared_ptr<ImplFontCache> mxFontCache;
+
+ /** @name Initialization and accessor functions
+ */
+ ///@{
+
+protected:
+ OutputDevice(OutDevType eOutDevType);
+ virtual ~OutputDevice() override;
+ virtual void dispose() override;
+
+public:
+
+ /** Get the graphic context that the output device uses to draw on.
+
+ If no graphics device exists, then initialize it.
+
+ @returns SalGraphics instance.
+ */
+ SalGraphics const *GetGraphics() const;
+ SalGraphics* GetGraphics();
+
+ void SetConnectMetaFile( GDIMetaFile* pMtf );
+ GDIMetaFile* GetConnectMetaFile() const { return mpMetaFile; }
+
+ virtual void SetSettings( const AllSettings& rSettings );
+ const AllSettings& GetSettings() const { return *mxSettings; }
+
+ SystemGraphicsData GetSystemGfxData() const;
+ OUString GetRenderBackendName() const;
+
+ // Used by the canvas module. Despite the name it does not always return true if Cairo is supported.
+ bool SupportsCairo() const;
+ /// Create Surface from given cairo surface
+ cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const;
+ /// Create surface with given dimensions
+ cairo::SurfaceSharedPtr CreateSurface(int x, int y, int width, int height) const;
+ /// Create Surface for given bitmap data
+ cairo::SurfaceSharedPtr CreateBitmapSurface(const BitmapSystemData& rData, const Size& rSize) const;
+ /// Return native handle for underlying surface
+ css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const;
+ css::uno::Any GetSystemGfxDataAny() const;
+
+ void SetRefPoint();
+ void SetRefPoint( const Point& rRefPoint );
+ const Point& GetRefPoint() const { return maRefPoint; }
+ bool IsRefPoint() const { return mbRefPoint; }
+
+ virtual bool IsScreenComp() const { return true; }
+
+ virtual sal_uInt16 GetBitCount() const;
+
+ Size GetOutputSizePixel() const
+ { return Size( mnOutWidth, mnOutHeight ); }
+ tools::Long GetOutputWidthPixel() const { return mnOutWidth; }
+ tools::Long GetOutputHeightPixel() const { return mnOutHeight; }
+ tools::Long GetOutOffXPixel() const { return mnOutOffX; }
+ tools::Long GetOutOffYPixel() const { return mnOutOffY; }
+ void SetOutOffXPixel(tools::Long nOutOffX);
+ void SetOutOffYPixel(tools::Long nOutOffY);
+ Point GetOutputOffPixel() const
+ { return Point( mnOutOffX, mnOutOffY ); }
+ tools::Rectangle GetOutputRectPixel() const
+ { return tools::Rectangle(GetOutputOffPixel(), GetOutputSizePixel() ); }
+
+ Size GetOutputSize() const
+ { return PixelToLogic( GetOutputSizePixel() ); }
+
+ css::uno::Reference< css::awt::XGraphics >
+ CreateUnoGraphics();
+ std::vector< VCLXGraphics* > *GetUnoGraphicsList() const { return mpUnoGraphicsList; }
+ std::vector< VCLXGraphics* > *CreateUnoGraphicsList();
+
+ virtual size_t GetSyncCount() const { return 0xffffffff; }
+
+ /// request XCanvas render interface
+ css::uno::Reference< css::rendering::XCanvas > GetCanvas() const;
+ /// request XSpriteCanvas render interface
+ css::uno::Reference< css::rendering::XSpriteCanvas > GetSpriteCanvas() const;
+
+protected:
+
+ /** Acquire a graphics device that the output device uses to draw on.
+
+ There is an LRU of OutputDevices that is used to get the graphics. The
+ actual creation of a SalGraphics instance is done via the SalFrame
+ implementation.
+
+ However, the SalFrame instance will only return a valid SalGraphics
+ instance if it is not in use or there wasn't one in the first place. When
+ this happens, AcquireGraphics finds the least recently used OutputDevice
+ in a different frame and "steals" it (releases it then starts using it).
+
+ If there are no frames to steal an OutputDevice's SalGraphics instance from
+ then it blocks until the graphics is released.
+
+ Once it has acquired a graphics instance, then we add the OutputDevice to
+ the LRU.
+
+ @returns true if was able to initialize the graphics device, false otherwise.
+ */
+ virtual bool AcquireGraphics() const = 0;
+
+ /** Release the graphics device, and remove it from the graphics device
+ list.
+
+ @param bRelease Determines whether to release the fonts of the
+ physically released graphics device.
+ */
+ virtual void ReleaseGraphics( bool bRelease = true ) = 0;
+ ///@}
+
+
+ /** @name Helper functions
+ */
+ ///@{
+
+public:
+
+ /** Get the output device's DPI x-axis value.
+
+ @returns x-axis DPI value
+ */
+ SAL_DLLPRIVATE sal_Int32 GetDPIX() const { return mnDPIX; }
+
+ /** Get the output device's DPI y-axis value.
+
+ @returns y-axis DPI value
+ */
+ SAL_DLLPRIVATE sal_Int32 GetDPIY() const { return mnDPIY; }
+
+ SAL_DLLPRIVATE void SetDPIX( sal_Int32 nDPIX ) { mnDPIX = nDPIX; }
+ SAL_DLLPRIVATE void SetDPIY( sal_Int32 nDPIY ) { mnDPIY = nDPIY; }
+
+ float GetDPIScaleFactor() const
+ {
+ return mnDPIScalePercentage / 100.0f;
+ }
+
+ sal_Int32 GetDPIScalePercentage() const
+ {
+ return mnDPIScalePercentage;
+ }
+
+ OutDevType GetOutDevType() const { return meOutDevType; }
+ virtual bool IsVirtual() const;
+
+ /** Query an OutputDevice to see whether it supports a specific operation
+
+ @returns true if operation supported, else false
+ */
+ bool SupportsOperation( OutDevSupportType ) const;
+
+ void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; }
+ vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; }
+
+ ///@}
+
+public:
+ virtual Size GetButtonBorderSize() { return Size(1, 1); };
+ virtual Color GetMonochromeButtonColor() { return COL_WHITE; }
+
+ /** @name Direct OutputDevice drawing functions
+ */
+ ///@{
+
+public:
+ virtual void Flush() {}
+
+ virtual void DrawOutDev(
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPt, const Size& rSrcSize );
+
+ virtual void DrawOutDev(
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPt, const Size& rSrcSize,
+ const OutputDevice& rOutDev );
+
+ virtual void CopyArea(
+ const Point& rDestPt,
+ const Point& rSrcPt, const Size& rSrcSize,
+ bool bWindowInvalidate = false );
+
+protected:
+
+ virtual void CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate);
+
+ virtual tools::Rectangle GetBackgroundComponentBounds() const;
+
+ virtual const OutputDevice* DrawOutDevDirectCheck(const OutputDevice& rSrcDev) const;
+
+ virtual void DrawOutDevDirectProcess(const OutputDevice& rSrcDev, SalTwoRect& rPosAry, SalGraphics* pSrcGraphics);
+
+ SAL_DLLPRIVATE void drawOutDevDirect(const OutputDevice& rSrcDev, SalTwoRect& rPosAry);
+
+ SAL_DLLPRIVATE bool is_double_buffered_window() const;
+
+ virtual css::uno::Reference< css::rendering::XCanvas > ImplGetCanvas( bool bSpriteCanvas ) const;
+ SAL_DLLPRIVATE void ImplDisposeCanvas();
+
+private:
+
+ // not implemented; to detect misuses of DrawOutDev(...OutputDevice&);
+ SAL_DLLPRIVATE void DrawOutDev( const Point&, const Size&, const Point&, const Size&, const Printer&) = delete;
+ ///@}
+
+
+ /** @name OutputDevice state functions
+ */
+ ///@{
+
+public:
+
+ void Push( vcl::PushFlags nFlags = vcl::PushFlags::ALL );
+ void Pop();
+ void ClearStack();
+
+ void EnableOutput( bool bEnable = true );
+ bool IsOutputEnabled() const { return mbOutput; }
+ bool IsDeviceOutputNecessary() const { return (mbOutput && mbDevOutput); }
+
+ void SetAntialiasing( AntialiasingFlags nMode );
+ AntialiasingFlags GetAntialiasing() const { return mnAntialiasing; }
+
+ // Render glyphs with a mode suitable for rendering of resolution-independent layout positions.
+ void SetTextRenderModeForResolutionIndependentLayout(bool bMode);
+ bool GetTextRenderModeForResolutionIndependentLayout() const { return mbTextRenderModeForResolutionIndependentLayout; }
+
+ void SetDrawMode( DrawModeFlags nDrawMode );
+ DrawModeFlags GetDrawMode() const { return mnDrawMode; }
+
+ void SetLayoutMode( vcl::text::ComplexTextLayoutFlags nTextLayoutMode );
+ vcl::text::ComplexTextLayoutFlags GetLayoutMode() const { return mnTextLayoutMode; }
+
+ void SetDigitLanguage( LanguageType );
+ LanguageType GetDigitLanguage() const { return meTextLanguage; }
+
+ void SetRasterOp( RasterOp eRasterOp );
+ RasterOp GetRasterOp() const { return meRasterOp; }
+
+ /**
+ If this OutputDevice is used for displaying a Print Preview
+ the OutDevViewType should be set to 'OutDevViewType::PrintPreview'.
+
+ A View can then make painting decisions dependent on this OutDevViewType.
+ E.g. text colors need to be handled differently, dependent on whether it's a PrintPreview or not. (see #106611# for more)
+ */
+ void SetOutDevViewType( OutDevViewType eOutDevViewType ) { meOutDevViewType=eOutDevViewType; }
+ OutDevViewType GetOutDevViewType() const { return meOutDevViewType; }
+
+ void SetLineColor();
+ void SetLineColor( const Color& rColor );
+ const Color& GetLineColor() const { return maLineColor; }
+ bool IsLineColor() const { return mbLineColor; }
+
+ void SetFillColor();
+ void SetFillColor( const Color& rColor );
+ const Color& GetFillColor() const { return maFillColor; }
+ bool IsFillColor() const { return mbFillColor; }
+
+ void SetBackground();
+ void SetBackground( const Wallpaper& rBackground );
+ virtual void SaveBackground(VirtualDevice& rSaveDevice,
+ const Point& rPos, const Size& rSize, const Size& rBackgroundSize) const;
+
+ const Wallpaper& GetBackground() const { return maBackground; }
+ virtual Color GetBackgroundColor() const;
+ virtual Color GetReadableFontColor(const Color& rFontColor, const Color& rBgColor) const;
+ bool IsBackground() const { return mbBackground; }
+
+ void SetFont( const vcl::Font& rNewFont );
+ const vcl::Font& GetFont() const { return maFont; }
+
+protected:
+
+ virtual void ImplReleaseFonts();
+
+private:
+
+ SAL_DLLPRIVATE void InitLineColor();
+
+ SAL_DLLPRIVATE void InitFillColor();
+
+ ///@}
+
+
+ /** @name Clipping functions
+ */
+ ///@{
+
+public:
+
+ vcl::Region GetClipRegion() const;
+ void SetClipRegion();
+ void SetClipRegion( const vcl::Region& rRegion );
+ bool SelectClipRegion( const vcl::Region&, SalGraphics* pGraphics = nullptr );
+
+ bool IsClipRegion() const { return mbClipRegion; }
+
+ void MoveClipRegion( tools::Long nHorzMove, tools::Long nVertMove );
+ void IntersectClipRegion( const tools::Rectangle& rRect );
+ void IntersectClipRegion( const vcl::Region& rRegion );
+
+ virtual vcl::Region GetActiveClipRegion() const;
+ virtual vcl::Region GetOutputBoundsClipRegion() const;
+
+protected:
+
+ virtual void InitClipRegion();
+
+ /** Perform actual rect clip against outdev dimensions, to generate
+ empty clips whenever one of the values is completely off the device.
+
+ @param aRegion region to be clipped to the device dimensions
+ @returns region clipped to the device bounds
+ **/
+ virtual vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const;
+ virtual void ClipToPaintRegion ( tools::Rectangle& rDstRect );
+
+private:
+
+ SAL_DLLPRIVATE void SetDeviceClipRegion( const vcl::Region* pRegion );
+ ///@}
+
+public:
+ virtual void DrawBorder(tools::Rectangle aBorderRect);
+
+
+ /** @name Pixel functions
+ */
+ ///@{
+
+public:
+
+ void DrawPixel( const Point& rPt );
+ void DrawPixel( const Point& rPt, const Color& rColor );
+
+ Color GetPixel( const Point& rPt ) const;
+ ///@}
+
+
+ /** @name Rectangle functions
+ */
+ ///@{
+
+public:
+
+ void DrawRect( const tools::Rectangle& rRect );
+ void DrawRect( const tools::Rectangle& rRect,
+ sal_uLong nHorzRount, sal_uLong nVertRound );
+
+ /// Fill the given rectangle with checkered rectangles of size nLen x nLen using the colors aStart and aEnd
+ void DrawCheckered(
+ const Point& rPos,
+ const Size& rSize,
+ sal_uInt32 nLen = 8,
+ Color aStart = COL_WHITE,
+ Color aEnd = COL_BLACK);
+
+ void DrawGrid( const tools::Rectangle& rRect, const Size& rDist, DrawGridFlags nFlags );
+
+ ///@}
+
+ /** @name Invert functions
+ */
+ ///@{
+public:
+ void Invert( const tools::Rectangle& rRect, InvertFlags nFlags = InvertFlags::NONE );
+ void Invert( const tools::Polygon& rPoly, InvertFlags nFlags = InvertFlags::NONE );
+ ///@}
+
+ /** @name Line functions
+ */
+ ///@{
+
+public:
+
+ void DrawLine( const Point& rStartPt, const Point& rEndPt );
+
+ void DrawLine( const Point& rStartPt, const Point& rEndPt,
+ const LineInfo& rLineInfo );
+
+protected:
+ virtual void DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint);
+
+private:
+
+ /** Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area)
+ */
+ SAL_DLLPRIVATE void drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const LineInfo& rInfo );
+ ///@}
+
+
+ /** @name Polyline functions
+ */
+ ///@{
+
+public:
+
+ /** Render the given polygon as a line stroke
+
+ The given polygon is stroked with the current LineColor, start
+ and end point are not automatically connected
+
+ @see DrawPolygon
+ @see DrawPolyPolygon
+ */
+ void DrawPolyLine( const tools::Polygon& rPoly );
+
+ void DrawPolyLine(
+ const basegfx::B2DPolygon&,
+ double fLineWidth = 0.0,
+ basegfx::B2DLineJoin eLineJoin = basegfx::B2DLineJoin::Round,
+ css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT,
+ double fMiterMinimumAngle = basegfx::deg2rad(15.0));
+
+ /** Render the given polygon as a line stroke
+
+ The given polygon is stroked with the current LineColor, start
+ and end point are not automatically connected. The line is
+ rendered according to the specified LineInfo, e.g. supplying a
+ dash pattern, or a line thickness.
+
+ @see DrawPolygon
+ @see DrawPolyPolygon
+ */
+ void DrawPolyLine( const tools::Polygon& rPoly,
+ const LineInfo& rLineInfo );
+
+ // #i101491#
+ // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool.
+ bool DrawPolyLineDirect(
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const basegfx::B2DPolygon& rB2DPolygon,
+ double fLineWidth = 0.0,
+ double fTransparency = 0.0,
+ const std::vector< double >* = nullptr, // MM01
+ basegfx::B2DLineJoin eLineJoin = basegfx::B2DLineJoin::NONE,
+ css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT,
+ double fMiterMinimumAngle = basegfx::deg2rad(15.0));
+
+private:
+
+ // #i101491#
+ // Helper which holds the old line geometry creation and is extended to use AA when
+ // switched on. Advantage is that line geometry is only temporarily used for paint
+ SAL_DLLPRIVATE void drawPolyLine(const tools::Polygon& rPoly, const LineInfo& rLineInfo);
+
+ ///@}
+
+ bool DrawPolyLineDirectInternal(
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const basegfx::B2DPolygon& rB2DPolygon,
+ double fLineWidth = 0.0,
+ double fTransparency = 0.0,
+ const std::vector< double >* = nullptr, // MM01
+ basegfx::B2DLineJoin eLineJoin = basegfx::B2DLineJoin::NONE,
+ css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT,
+ double fMiterMinimumAngle = basegfx::deg2rad(15.0));
+
+ /** @name Polygon functions
+ */
+ ///@{
+
+public:
+
+ /** Render the given polygon
+
+ The given polygon is stroked with the current LineColor, and
+ filled with the current FillColor. If one of these colors are
+ transparent, the corresponding stroke or fill stays
+ invisible. Start and end point of the polygon are
+ automatically connected.
+
+ @see DrawPolyLine
+ */
+ void DrawPolygon( const tools::Polygon& rPoly );
+ void DrawPolygon( const basegfx::B2DPolygon& );
+
+ /** Render the given poly-polygon
+
+ The given poly-polygon is stroked with the current LineColor,
+ and filled with the current FillColor. If one of these colors
+ are transparent, the corresponding stroke or fill stays
+ invisible. Start and end points of the contained polygons are
+ automatically connected.
+
+ @see DrawPolyLine
+ */
+ void DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly );
+ void DrawPolyPolygon( const basegfx::B2DPolyPolygon& );
+
+private:
+
+ SAL_DLLPRIVATE void ImplDrawPolygon( const tools::Polygon& rPoly, const tools::PolyPolygon* pClipPolyPoly = nullptr );
+ SAL_DLLPRIVATE void ImplDrawPolyPolygon( const tools::PolyPolygon& rPolyPoly, const tools::PolyPolygon* pClipPolyPoly );
+ SAL_DLLPRIVATE void ImplDrawPolyPolygon( sal_uInt16 nPoly, const tools::PolyPolygon& rPolyPoly );
+ // #i101491#
+ // Helper who implements the DrawPolyPolygon functionality for basegfx::B2DPolyPolygon
+ // without MetaFile processing
+ SAL_DLLPRIVATE void ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPolygon& rB2DPolyPoly);
+ ///@}
+
+ SAL_DLLPRIVATE void ImplDrawWaveLineBezier(tools::Long nStartX, tools::Long nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long nWaveHeight, double fOrientation, tools::Long nLineWidth);
+
+
+ /** @name Curved shape functions
+ */
+ ///@{
+
+public:
+
+ void DrawEllipse( const tools::Rectangle& rRect );
+
+ void DrawArc(
+ const tools::Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt );
+
+ void DrawPie(
+ const tools::Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt );
+
+ void DrawChord(
+ const tools::Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt );
+
+ ///@}
+
+
+ /** @name Gradient functions
+ */
+ ///@{
+
+public:
+ void DrawGradient( const tools::Rectangle& rRect, const Gradient& rGradient );
+ void DrawGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient );
+
+protected:
+
+ virtual bool UsePolyPolygonForComplexGradient() = 0;
+
+ virtual tools::Long GetGradientStepCount( tools::Long nMinRect );
+
+private:
+
+ SAL_DLLPRIVATE void DrawLinearGradient( const tools::Rectangle& rRect, const Gradient& rGradient, const tools::PolyPolygon* pClipPolyPoly );
+ SAL_DLLPRIVATE void DrawComplexGradient( const tools::Rectangle& rRect, const Gradient& rGradient, const tools::PolyPolygon* pClipPolyPoly );
+ SAL_DLLPRIVATE void DrawGradientToMetafile( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient );
+ SAL_DLLPRIVATE tools::Long GetGradientSteps(Gradient const& rGradient, tools::Rectangle const& rRect);
+ SAL_DLLPRIVATE Color GetSingleColorGradientFill();
+ ///@}
+
+
+ /** @name Hatch functions
+ */
+ ///@{
+
+public:
+
+#ifdef _MSC_VER
+ void DrawHatch( const tools::PolyPolygon& rPolyPoly, const ::Hatch& rHatch );
+ void AddHatchActions( const tools::PolyPolygon& rPolyPoly,
+ const ::Hatch& rHatch,
+ GDIMetaFile& rMtf );
+#else
+ void DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch );
+ void AddHatchActions( const tools::PolyPolygon& rPolyPoly,
+ const Hatch& rHatch,
+ GDIMetaFile& rMtf );
+#endif
+
+ void DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch, bool bMtf );
+
+private:
+
+ SAL_DLLPRIVATE void CalcHatchValues( const tools::Rectangle& rRect, tools::Long nDist, Degree10 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 );
+ SAL_DLLPRIVATE void DrawHatchLine( const tools::Line& rLine, const tools::PolyPolygon& rPolyPoly, Point* pPtBuffer, bool bMtf );
+ ///@}
+
+
+ /** @name Wallpaper functions
+ */
+ ///@{
+
+public:
+ void DrawWallpaper( const tools::Rectangle& rRect, const Wallpaper& rWallpaper );
+
+ void Erase();
+ void Erase(const tools::Rectangle& rRect);
+
+protected:
+ void DrawGradientWallpaper( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const Wallpaper& rWallpaper );
+
+private:
+ SAL_DLLPRIVATE void DrawWallpaper( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const Wallpaper& rWallpaper );
+ SAL_DLLPRIVATE void DrawColorWallpaper( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const Wallpaper& rWallpaper );
+ SAL_DLLPRIVATE void DrawBitmapWallpaper( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const Wallpaper& rWallpaper );
+ ///@}
+
+
+ /** @name Text functions
+ */
+ ///@{
+
+public:
+
+ void DrawText( const Point& rStartPt, const OUString& rStr,
+ sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
+ std::vector< tools::Rectangle >* pVector = nullptr, OUString* pDisplayText = nullptr,
+ const SalLayoutGlyphs* pLayoutCache = nullptr );
+
+ void DrawText( const tools::Rectangle& rRect,
+ const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::NONE,
+ std::vector< tools::Rectangle >* pVector = nullptr, OUString* pDisplayText = nullptr,
+ vcl::ITextLayout* _pTextLayout = nullptr );
+
+ static void ImplDrawText( OutputDevice& rTargetDevice, const tools::Rectangle& rRect,
+ const OUString& rOrigStr, DrawTextFlags nStyle,
+ std::vector< tools::Rectangle >* pVector, OUString* pDisplayText, vcl::ITextLayout& _rLayout );
+
+ void ImplDrawText( SalLayout& );
+
+ void ImplDrawTextBackground( const SalLayout& );
+
+ void DrawCtrlText( const Point& rPos, const OUString& rStr,
+ sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
+ DrawTextFlags nStyle = DrawTextFlags::Mnemonic, std::vector< tools::Rectangle >* pVector = nullptr, OUString* pDisplayText = nullptr,
+ const SalLayoutGlyphs* pGlyphs = nullptr);
+
+ void DrawTextLine( const Point& rPos, tools::Long nWidth,
+ FontStrikeout eStrikeout,
+ FontLineStyle eUnderline,
+ FontLineStyle eOverline,
+ bool bUnderlineAbove = false );
+
+ void ImplDrawTextLine( tools::Long nBaseX, tools::Long nX, tools::Long nY, DeviceCoordinate nWidth,
+ FontStrikeout eStrikeout, FontLineStyle eUnderline,
+ FontLineStyle eOverline, bool bUnderlineAbove );
+
+ void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontLineStyle eUnderline,
+ FontLineStyle eOverline, bool bWordLine, bool bUnderlineAbove );
+
+ void DrawWaveLine( const Point& rStartPos, const Point& rEndPos, tools::Long nLineWidth = 1, tools::Long nWaveHeight = 3);
+
+ bool ImplDrawRotateText( SalLayout& );
+
+ tools::Rectangle GetTextRect( const tools::Rectangle& rRect,
+ const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::WordBreak,
+ TextRectInfo* pInfo = nullptr,
+ const vcl::ITextLayout* _pTextLayout = nullptr ) const;
+
+ /** Return the exact bounding rectangle of rStr.
+
+ The text is then drawn exactly from rRect.TopLeft() to
+ rRect.BottomRight(), don't assume that rRect.TopLeft() is [0, 0].
+
+ Please note that you don't always want to use GetTextBoundRect(); in
+ many cases you actually want to use GetTextHeight(), because
+ GetTextBoundRect() gives you the exact bounding rectangle regardless
+ what is the baseline of the text.
+
+ Code snippet to get just exactly the text (no filling around that) as
+ a bitmap via a VirtualDevice (regardless what is the baseline):
+
+ <code>
+ VirtualDevice aDevice;
+ vcl::Font aFont = aDevice.GetFont();
+ aFont.SetSize(Size(0, 96));
+ aFont.SetColor(COL_BLACK);
+ aDevice.SetFont(aFont);
+ aDevice.Erase();
+
+ tools::Rectangle aRect;
+ aDevice.GetTextBoundRect(aRect, aText);
+ aDevice.SetOutputSize(Size(aRect.Right() + 1, aRect.Bottom() + 1));
+ aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
+ aDevice.DrawText(Point(0,0), aText);
+
+ // exactly only the text, regardless of the baseline
+ Bitmap aBitmap(aDevice.GetBitmap(aRect.TopLeft(), aRect.GetSize()));
+ </code>
+
+ Code snippet to get the text as a bitmap via a Virtual device that
+ contains even the filling so that the baseline is always preserved
+ (ie. the text will not jump up and down according to whether it
+ contains 'y' or not etc.)
+
+ <code>
+ VirtualDevice aDevice;
+ // + the appropriate font / device setup, see above
+
+ aDevice.SetOutputSize(Size(aDevice.GetTextWidth(aText), aDevice.GetTextHeight()));
+ aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
+ aDevice.DrawText(Point(0,0), aText);
+
+ // bitmap that contains even the space around the text,
+ // that means, preserves the baseline etc.
+ Bitmap aBitmap(aDevice.GetBitmap(Point(0, 0), aDevice.GetOutputSize()));
+ </code>
+ */
+ bool GetTextBoundRect( tools::Rectangle& rRect,
+ const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
+ sal_uLong nLayoutWidth = 0, o3tl::span<const sal_Int32> pDXArray = {},
+ const SalLayoutGlyphs* pGlyphs = nullptr ) const;
+
+ tools::Rectangle ImplGetTextBoundRect( const SalLayout& ) const;
+
+ bool GetTextOutline( tools::PolyPolygon&,
+ const OUString& rStr ) const;
+
+ bool GetTextOutlines( PolyPolyVector&,
+ const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0,
+ sal_Int32 nLen = -1,
+ sal_uLong nLayoutWidth = 0, o3tl::span<const sal_Int32> pDXArray = {} ) const;
+
+ bool GetTextOutlines( basegfx::B2DPolyPolygonVector &rVector,
+ const OUString& rStr, sal_Int32 nBase, sal_Int32 nIndex = 0,
+ sal_Int32 nLen = -1,
+ sal_uLong nLayoutWidth = 0, o3tl::span<const sal_Int32> pDXArray = {} ) const;
+
+
+ OUString GetEllipsisString( const OUString& rStr, tools::Long nMaxWidth,
+ DrawTextFlags nStyle = DrawTextFlags::EndEllipsis ) const;
+
+ tools::Long GetCtrlTextWidth( const OUString& rStr,
+ const SalLayoutGlyphs* pLayoutCache = nullptr ) const;
+
+ static OUString GetNonMnemonicString( const OUString& rStr, sal_Int32& rMnemonicPos );
+
+ static OUString GetNonMnemonicString( const OUString& rStr )
+ { sal_Int32 nDummy; return GetNonMnemonicString( rStr, nDummy ); }
+
+ /** Generate MetaTextActions for the text rect
+
+ This method splits up the text rect into multiple
+ MetaTextActions, one for each line of text. This is comparable
+ to AddGradientActions(), which splits up a gradient into its
+ constituent polygons. Parameter semantics fully compatible to
+ DrawText().
+ */
+ void AddTextRectActions( const tools::Rectangle& rRect,
+ const OUString& rOrigStr,
+ DrawTextFlags nStyle,
+ GDIMetaFile& rMtf );
+
+ void SetTextColor( const Color& rColor );
+ virtual void SetSystemTextColor(SystemTextColorFlags nFlags, bool bEnabled);
+ const Color& GetTextColor() const { return maTextColor; }
+
+ void SetTextFillColor();
+ void SetTextFillColor( const Color& rColor );
+ Color GetTextFillColor() const;
+ bool IsTextFillColor() const { return !maFont.IsTransparent(); }
+
+ void SetTextLineColor();
+ void SetTextLineColor( const Color& rColor );
+ const Color& GetTextLineColor() const { return maTextLineColor; }
+ bool IsTextLineColor() const { return !maTextLineColor.IsTransparent(); }
+
+ void SetOverlineColor();
+ void SetOverlineColor( const Color& rColor );
+ const Color& GetOverlineColor() const { return maOverlineColor; }
+ bool IsOverlineColor() const { return !maOverlineColor.IsTransparent(); }
+
+ void SetTextAlign( TextAlign eAlign );
+ TextAlign GetTextAlign() const { return maFont.GetAlignment(); }
+
+ /** Width of the text.
+
+ See also GetTextBoundRect() for more explanation + code examples.
+ */
+ tools::Long GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
+ vcl::text::TextLayoutCache const* = nullptr,
+ SalLayoutGlyphs const*const pLayoutCache = nullptr) const;
+
+ /** Height where any character of the current font fits; in logic coordinates.
+
+ See also GetTextBoundRect() for more explanation + code examples.
+ */
+ tools::Long GetTextHeight() const;
+ float approximate_digit_width() const;
+
+ void DrawTextArray( const Point& rStartPt, const OUString& rStr,
+ o3tl::span<const sal_Int32> pDXAry,
+ sal_Int32 nIndex = 0,
+ sal_Int32 nLen = -1,
+ SalLayoutFlags flags = SalLayoutFlags::NONE,
+ const SalLayoutGlyphs* pLayoutCache = nullptr);
+ tools::Long GetTextArray( const OUString& rStr, std::vector<sal_Int32>* pDXAry,
+ sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
+ vcl::text::TextLayoutCache const* = nullptr,
+ SalLayoutGlyphs const*const pLayoutCache = nullptr) const;
+
+ void GetCaretPositions( const OUString&, sal_Int32* pCaretXArray,
+ sal_Int32 nIndex, sal_Int32 nLen,
+ const SalLayoutGlyphs* pGlyphs = nullptr ) const;
+ void DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
+ const OUString& rStr,
+ sal_Int32 nIndex = 0, sal_Int32 nLen = -1);
+ sal_Int32 GetTextBreak( const OUString& rStr, tools::Long nTextWidth,
+ sal_Int32 nIndex, sal_Int32 nLen = -1,
+ tools::Long nCharExtra = 0,
+ vcl::text::TextLayoutCache const* = nullptr,
+ const SalLayoutGlyphs* pGlyphs = nullptr) const;
+ sal_Int32 GetTextBreak( const OUString& rStr, tools::Long nTextWidth,
+ sal_Unicode nExtraChar, sal_Int32& rExtraCharPos,
+ sal_Int32 nIndex, sal_Int32 nLen,
+ tools::Long nCharExtra,
+ vcl::text::TextLayoutCache const* = nullptr,
+ const SalLayoutGlyphs* pGlyphs = nullptr) const;
+ static std::shared_ptr<const vcl::text::TextLayoutCache> CreateTextLayoutCache(OUString const&);
+
+ SAL_DLLPRIVATE SalLayoutFlags GetBiDiLayoutFlags( std::u16string_view rStr,
+ const sal_Int32 nMinIndex,
+ const sal_Int32 nEndIndex ) const;
+
+protected:
+ SAL_DLLPRIVATE void ImplInitTextLineSize();
+ SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
+ static
+ SAL_DLLPRIVATE tools::Long ImplGetTextLines( const tools::Rectangle& rRect, tools::Long nTextHeight, ImplMultiTextLineInfo& rLineInfo, tools::Long nWidth, const OUString& rStr, DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout );
+ static
+ SAL_DLLPRIVATE sal_Int32 ImplBreakLinesWithIterator(const tools::Long nWidth, const OUString& rStr, const vcl::ITextLayout& _rLayout,
+ const css::uno::Reference<css::linguistic2::XHyphenator>& xHyph,
+ const css::uno::Reference<css::i18n::XBreakIterator>& xBI,
+ const bool bHyphenate,
+ const sal_Int32 nPos, sal_Int32 nBreakPos);
+ static
+ SAL_DLLPRIVATE sal_Int32 ImplBreakLinesSimple( const tools::Long nWidth, const OUString& rStr,
+ const vcl::ITextLayout& _rLayout, const sal_Int32 nPos, sal_Int32 nBreakPos, tools::Long& nLineWidth );
+ SAL_DLLPRIVATE float approximate_char_width() const;
+
+ virtual bool shouldDrawWavePixelAsRect(tools::Long nLineWidth) const;
+ virtual void SetWaveLineColors(Color const& rColor, tools::Long nLineWidth);
+ virtual Size GetWaveLineSize(tools::Long nLineWidth) const;
+
+private:
+ SAL_DLLPRIVATE void ImplInitTextColor();
+
+ SAL_DLLPRIVATE void ImplDrawTextDirect( SalLayout&, bool bTextLines);
+ SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& );
+ SAL_DLLPRIVATE void ImplDrawTextRect( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight );
+
+ SAL_DLLPRIVATE void ImplDrawWavePixel( tools::Long nOriginX, tools::Long nOriginY, tools::Long nCurX, tools::Long nCurY, tools::Long nWidth, Degree10 nOrientation, SalGraphics* pGraphics, const OutputDevice& rOutDev, tools::Long nPixWidth, tools::Long nPixHeight );
+
+ SAL_DLLPRIVATE void ImplDrawWaveLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nStartX, tools::Long nStartY, tools::Long nWidth, tools::Long nHeight, tools::Long nLineWidth, Degree10 nOrientation, const Color& rColor );
+ SAL_DLLPRIVATE void ImplDrawWaveTextLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove );
+ SAL_DLLPRIVATE void ImplDrawStraightTextLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove );
+ SAL_DLLPRIVATE void ImplDrawStrikeoutLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, FontStrikeout eStrikeout, Color aColor );
+ SAL_DLLPRIVATE void ImplDrawStrikeoutChar( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, FontStrikeout eStrikeout, Color aColor );
+ SAL_DLLPRIVATE void ImplDrawMnemonicLine( tools::Long nX, tools::Long nY, tools::Long nWidth );
+
+ SAL_DLLPRIVATE bool AttemptOLEFontScaleFix(vcl::Font& rFont, tools::Long nHeight) const;
+
+ ///@}
+
+
+ /** @name Font functions
+ */
+ ///@{
+
+public:
+
+ FontMetric GetFontMetricFromCollection( int nDevFontIndex ) const;
+ int GetFontFaceCollectionCount() const;
+
+ bool IsFontAvailable( std::u16string_view rFontName ) const;
+
+ bool AddTempDevFont( const OUString& rFileURL, const OUString& rFontName );
+ void RefreshFontData( const bool bNewFontLists );
+
+ FontMetric GetFontMetric() const;
+ FontMetric GetFontMetric( const vcl::Font& rFont ) const;
+
+ bool GetFontCharMap( FontCharMapRef& rxFontCharMap ) const;
+ bool GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities ) const;
+
+ bool GetFontFeatures(std::vector<vcl::font::Feature>& rFontFeatures) const;
+
+ SAL_DLLPRIVATE void ImplGetEmphasisMark( tools::PolyPolygon& rPolyPoly, bool& rPolyLine, tools::Rectangle& rRect1, tools::Rectangle& rRect2,
+ tools::Long& rYOff, tools::Long& rWidth, FontEmphasisMark eEmphasis, tools::Long nHeight );
+ SAL_DLLPRIVATE static FontEmphasisMark
+ ImplGetEmphasisMarkStyle( const vcl::Font& rFont );
+
+ bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex,
+ int nLen, std::vector< tools::Rectangle >& rVector ) const;
+
+ sal_Int32 HasGlyphs( const vcl::Font& rFont, const OUString& rStr,
+ sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
+
+ tools::Long GetMinKashida() const;
+
+ // i60594
+ // validate kashida positions against the current font
+ // returns count of invalid kashida positions
+ sal_Int32 ValidateKashidas( const OUString& rTxt, sal_Int32 nIdx, sal_Int32 nLen,
+ sal_Int32 nKashCount, // number of suggested kashida positions (in)
+ const sal_Int32* pKashidaPos, // suggested kashida positions (in)
+ sal_Int32* pKashidaPosDropped // invalid kashida positions (out)
+ ) const;
+
+ static void BeginFontSubstitution();
+ static void EndFontSubstitution();
+ static void AddFontSubstitute( const OUString& rFontName,
+ const OUString& rReplaceFontName,
+ AddFontSubstituteFlags nFlags );
+ static void RemoveFontsSubstitute();
+
+ static vcl::Font GetDefaultFont( DefaultFontType nType,
+ LanguageType eLang,
+ GetDefaultFontFlags nFlags,
+ const OutputDevice* pOutDev = nullptr );
+
+ SAL_DLLPRIVATE void ImplInitFontList() const;
+ SAL_DLLPRIVATE void ImplUpdateFontData();
+
+ //drop font data for all outputdevices.
+ //If bNewFontLists is true then empty lists of system fonts
+ static void ImplClearAllFontData( bool bNewFontLists );
+ //fetch font data for all outputdevices
+ //If bNewFontLists is true then fetch lists of system fonts
+ static void ImplRefreshAllFontData( bool bNewFontLists );
+ //drop and fetch font data for all outputdevices
+ //If bNewFontLists is true then drop and refetch lists of system fonts
+ SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists );
+
+ SAL_DLLPRIVATE const LogicalFontInstance* GetFontInstance() const;
+
+protected:
+ SAL_DLLPRIVATE tools::Long GetEmphasisAscent() const { return mnEmphasisAscent; }
+ SAL_DLLPRIVATE tools::Long GetEmphasisDescent() const { return mnEmphasisDescent; }
+
+ SAL_DLLPRIVATE bool InitFont() const;
+ virtual void SetFontOrientation( LogicalFontInstance* const pFontInstance ) const;
+ virtual tools::Long GetFontExtLeading() const;
+
+ virtual void ImplClearFontData(bool bNewFontLists);
+ virtual void ImplRefreshFontData(bool bNewFontLists);
+ void ReleaseFontCache();
+ void ReleaseFontCollection();
+ void SetFontCollectionFromSVData();
+ void ResetNewFontCache();
+
+ virtual bool ImplNewFont() const;
+
+private:
+
+ typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
+
+ SAL_DLLPRIVATE static void ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl, bool bNewFontLists );
+
+ static
+ SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const OUString& rStr,
+ tools::Long nMaxWidth, DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout );
+
+ SAL_DLLPRIVATE void ImplDrawEmphasisMark( tools::Long nBaseX, tools::Long nX, tools::Long nY, const tools::PolyPolygon& rPolyPoly, bool bPolyLine, const tools::Rectangle& rRect1, const tools::Rectangle& rRect2 );
+ SAL_DLLPRIVATE void ImplDrawEmphasisMarks( SalLayout& );
+ ///@}
+
+
+ /** @name Layout functions
+ */
+ ///@{
+
+public:
+
+ // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI
+ SAL_DLLPRIVATE bool ImplIsAntiparallel() const ;
+ SAL_DLLPRIVATE void ReMirror( Point &rPoint ) const;
+ SAL_DLLPRIVATE void ReMirror( tools::Rectangle &rRect ) const;
+ SAL_DLLPRIVATE void ReMirror( vcl::Region &rRegion ) const;
+ SAL_DLLPRIVATE bool ImplIsRecordLayout() const;
+ virtual bool HasMirroredGraphics() const;
+ std::unique_ptr<SalLayout>
+ ImplLayout( const OUString&, sal_Int32 nIndex, sal_Int32 nLen,
+ const Point& rLogicPos = Point(0,0), tools::Long nLogicWidth=0,
+ o3tl::span<const sal_Int32> pLogicDXArray={}, SalLayoutFlags flags = SalLayoutFlags::NONE,
+ vcl::text::TextLayoutCache const* = nullptr,
+ const SalLayoutGlyphs* pGlyphs = nullptr) const;
+
+ SAL_DLLPRIVATE vcl::text::ImplLayoutArgs ImplPrepareLayoutArgs( OUString&, const sal_Int32 nIndex, const sal_Int32 nLen,
+ DeviceCoordinate nPixelWidth,
+ SalLayoutFlags flags = SalLayoutFlags::NONE,
+ vcl::text::TextLayoutCache const* = nullptr) const;
+ SAL_DLLPRIVATE std::unique_ptr<SalLayout>
+ ImplGlyphFallbackLayout( std::unique_ptr<SalLayout>,
+ vcl::text::ImplLayoutArgs&,
+ const SalLayoutGlyphs* ) const;
+ SAL_DLLPRIVATE std::unique_ptr<SalLayout>
+ getFallbackLayout(
+ LogicalFontInstance* pLogicalFont, int nFallbackLevel,
+ vcl::text::ImplLayoutArgs& rLayoutArgs, const SalLayoutGlyphs* ) const;
+
+ /*
+ These functions allow collecting information on how fonts are mapped when used, such as what
+ replacements are used when a requested font is missing or which fonts are used as fallbacks
+ when a font doesn't provide all necessary glyphs.
+ After StartTrackingFontMappingUse() is called, VCL starts collecting font usage for all
+ text layout calls, FinishTrackingFontMappingUse() will stop collecting and providing
+ the collected information.
+ Each item is a mapping from a requested font to a list of actually used fonts and the number
+ of times this mapping was done.
+ */
+ struct FontMappingUseItem
+ {
+ OUString mOriginalFont;
+ std::vector<OUString> mUsedFonts;
+ int mCount;
+ };
+ typedef std::vector<FontMappingUseItem> FontMappingUseData;
+ static void StartTrackingFontMappingUse();
+ static FontMappingUseData FinishTrackingFontMappingUse();
+
+ // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphicsLayout
+ virtual void EnableRTL( bool bEnable = true);
+ bool IsRTLEnabled() const { return mbEnableRTL; }
+
+ bool GetTextIsRTL( const OUString&, sal_Int32 nIndex, sal_Int32 nLen ) const;
+
+ ///@}
+
+
+ /** @name Bitmap functions
+ */
+ ///@{
+
+public:
+ void DrawBitmap(
+ const Point& rDestPt,
+ const Bitmap& rBitmap );
+
+ void DrawBitmap(
+ const Point& rDestPt,
+ const Size& rDestSize,
+ const Bitmap& rBitmap );
+
+ void DrawBitmap(
+ const Point& rDestPt,
+ const Size& rDestSize,
+ const Point& rSrcPtPixel,
+ const Size& rSrcSizePixel,
+ const Bitmap& rBitmap);
+
+ void DrawBitmap(
+ const Point& rDestPt,
+ const Size& rDestSize,
+ const Point& rSrcPtPixel,
+ const Size& rSrcSizePixel,
+ const Bitmap& rBitmap,
+ MetaActionType nAction );
+
+ void DrawBitmapEx(
+ const Point& rDestPt,
+ const BitmapEx& rBitmapEx );
+
+
+ void DrawBitmapEx(
+ const Point& rDestPt,
+ const Size& rDestSize,
+ const BitmapEx& rBitmapEx );
+
+ void DrawBitmapEx(
+ const Point& rDestPt,
+ const Size& rDestSize,
+ const Point& rSrcPtPixel,
+ const Size& rSrcSizePixel,
+ const BitmapEx& rBitmapEx);
+
+ void DrawBitmapEx(
+ const Point& rDestPt,
+ const Size& rDestSize,
+ const Point& rSrcPtPixel,
+ const Size& rSrcSizePixel,
+ const BitmapEx& rBitmapEx,
+ MetaActionType nAction );
+
+ /** @overload
+ virtual void DrawImage(
+ const Point& rPos,
+ const Size& rSize,
+ const Image& rImage,
+ sal_uInt16 nStyle = 0)
+ */
+ void DrawImage(
+ const Point& rPos,
+ const Image& rImage,
+ DrawImageFlags nStyle = DrawImageFlags::NONE );
+
+ void DrawImage(
+ const Point& rPos,
+ const Size& rSize,
+ const Image& rImage,
+ DrawImageFlags nStyle = DrawImageFlags::NONE );
+
+
+ virtual Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const;
+
+ /** Query extended bitmap (with alpha channel, if available).
+ */
+ BitmapEx GetBitmapEx( const Point& rSrcPt, const Size& rSize ) const;
+
+
+ /** Draw BitmapEx transformed
+
+ @param rTransformation
+ The transformation describing the target positioning of the given bitmap. Transforming
+ the unit object coordinates (0, 0, 1, 1) with this matrix is the transformation to
+ discrete coordinates
+
+ @param rBitmapEx
+ The BitmapEx to be painted
+
+ @param fAlpha
+ Optional additional alpha to use for drawing (0 to 1, 1 being no change).
+ */
+ void DrawTransformedBitmapEx(
+ const basegfx::B2DHomMatrix& rTransformation,
+ const BitmapEx& rBitmapEx,
+ double fAlpha = 1.0);
+
+ /** Return true if DrawTransformedBitmapEx() is fast.
+
+ @since 7.2
+ */
+ bool HasFastDrawTransformedBitmap() const;
+
+protected:
+
+ virtual void DrawDeviceBitmapEx(
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel,
+ BitmapEx& rBitmapEx );
+
+ virtual bool CanSubsampleBitmap() const { return true; }
+
+ /** Transform and draw a bitmap directly
+
+ @param aFullTransform The B2DHomMatrix used for the transformation
+ @param rBitmapEx Reference to the bitmap to be transformed and drawn
+
+ @return true if it was able to draw the bitmap, false if not
+ */
+ virtual bool DrawTransformBitmapExDirect(
+ const basegfx::B2DHomMatrix& aFullTransform,
+ const BitmapEx& rBitmapEx,
+ double fAlpha = 1.0);
+
+ /** Transform and reduce the area that needs to be drawn of the bitmap and return the new
+ visible range and the maximum area.
+
+
+ @param aFullTransform B2DHomMatrix used for transformation
+ @param aVisibleRange The new visible area of the bitmap
+ @param fMaximumArea The maximum area of the bitmap
+
+ @returns true if there is an area to be drawn, otherwise nothing is left to be drawn
+ so return false
+ */
+ virtual bool TransformAndReduceBitmapExToTargetRange(
+ const basegfx::B2DHomMatrix& aFullTransform,
+ basegfx::B2DRange &aVisibleRange,
+ double &fMaximumArea);
+
+private:
+
+ SAL_DLLPRIVATE void DrawDeviceAlphaBitmap(
+ const Bitmap& rBmp,
+ const AlphaMask& rAlpha,
+ const Point& rDestPt,
+ const Size& rDestSize,
+ const Point& rSrcPtPixel,
+ const Size& rSrcSizePixel );
+
+ SAL_DLLPRIVATE void DrawDeviceAlphaBitmapSlowPath(
+ const Bitmap& rBitmap, const AlphaMask& rAlpha,
+ tools::Rectangle aDstRect, tools::Rectangle aBmpRect,
+ Size const & aOutSz, Point const & aOutPt);
+
+
+ SAL_DLLPRIVATE void BlendBitmap(
+ const SalTwoRect& rPosAry,
+ const Bitmap& rBmp );
+
+ SAL_DLLPRIVATE Bitmap BlendBitmap(
+ Bitmap& aBmp,
+ BitmapReadAccess const * pP,
+ BitmapReadAccess const * pA,
+ const sal_Int32 nOffY,
+ const sal_Int32 nDstHeight,
+ const sal_Int32 nOffX,
+ const sal_Int32 nDstWidth,
+ const tools::Rectangle& aBmpRect,
+ const Size& aOutSz,
+ const bool bHMirr,
+ const bool bVMirr,
+ const sal_Int32* pMapX,
+ const sal_Int32* pMapY );
+
+ SAL_DLLPRIVATE Bitmap BlendBitmapWithAlpha(
+ Bitmap& aBmp,
+ BitmapReadAccess const * pP,
+ BitmapReadAccess const * pA,
+ const tools::Rectangle& aDstRect,
+ const sal_Int32 nOffY,
+ const sal_Int32 nDstHeight,
+ const sal_Int32 nOffX,
+ const sal_Int32 nDstWidth,
+ const sal_Int32* pMapX,
+ const sal_Int32* pMapY );
+
+ ///@}
+
+
+ /** @name Transparency functions
+ */
+ ///@{
+
+public:
+
+ /** helper method removing transparencies from a metafile (e.g. for printing)
+
+ @returns
+ true: transparencies were removed
+ false: output metafile is unchanged input metafile
+
+ @attention this is a member method, so current state can influence the result !
+ @attention the output metafile is prepared in pixel mode for the currentOutputDevice
+ state. It can not be moved or rotated reliably anymore.
+ */
+ bool RemoveTransparenciesFromMetaFile(
+ const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
+ tools::Long nMaxBmpDPIX, tools::Long nMaxBmpDPIY,
+ bool bReduceTransparency,
+ bool bTransparencyAutoMode,
+ bool bDownsampleBitmaps,
+ const Color& rBackground = COL_TRANSPARENT );
+
+ void DrawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
+
+ void DrawTransparent(
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const basegfx::B2DPolyPolygon& rB2DPolyPoly,
+ double fTransparency);
+
+ void DrawTransparent(
+ const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
+ const Gradient& rTransparenceGradient );
+
+protected:
+
+ virtual void EmulateDrawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
+
+ virtual void ClipAndDrawGradientMetafile ( const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly );
+
+private:
+
+ SAL_DLLPRIVATE bool DrawTransparentNatively( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
+ ///@}
+
+
+ /** @name Mask functions
+ */
+ ///@{
+
+public:
+
+ void DrawMask( const Point& rDestPt,
+ const Bitmap& rBitmap, const Color& rMaskColor );
+
+ void DrawMask( const Point& rDestPt, const Size& rDestSize,
+ const Bitmap& rBitmap, const Color& rMaskColor );
+
+ void DrawMask( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel,
+ const Bitmap& rBitmap, const Color& rMaskColor);
+
+ void DrawMask( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel,
+ const Bitmap& rBitmap, const Color& rMaskColor,
+ MetaActionType nAction );
+
+protected:
+
+ virtual void DrawDeviceMask (
+ const Bitmap& rMask, const Color& rMaskColor,
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel );
+ ///@}
+
+
+ /** @name Map functions
+ */
+ ///@{
+
+public:
+
+ void EnableMapMode( bool bEnable = true );
+ bool IsMapModeEnabled() const { return mbMap; }
+
+ void SetMapMode();
+ void SetMapMode( const MapMode& rNewMapMode );
+ void SetRelativeMapMode( const MapMode& rNewMapMode );
+ virtual void SetMetafileMapMode(const MapMode& rNewMapMode, bool bIsRecord);
+ const MapMode& GetMapMode() const { return maMapMode; }
+
+protected:
+ virtual void ImplInitMapModeObjects();
+
+public:
+ // #i75163#
+ basegfx::B2DHomMatrix GetViewTransformation() const;
+ basegfx::B2DHomMatrix GetInverseViewTransformation() const;
+
+ basegfx::B2DHomMatrix GetViewTransformation( const MapMode& rMapMode ) const;
+ basegfx::B2DHomMatrix GetInverseViewTransformation( const MapMode& rMapMode ) const;
+
+
+ /** Set an offset in pixel
+
+ This method offsets every drawing operation that converts its
+ coordinates to pixel by the given value. Normally, the effect
+ can be achieved by setting a MapMode with a different
+ origin. Unfortunately, this origin is in logical coordinates
+ and can lead to rounding errors (see #102532# for details).
+
+ @attention This offset is only applied when converting to
+ pixel, i.e. some output modes such as metafile recordings
+ might be completely unaffected by this method! Use with
+ care. Furthermore, if the OutputDevice's MapMode is the
+ default (that's MapUnit::MapPixel), then any pixel offset set is
+ ignored also. This might be unintuitive for cases, but would
+ have been far more fragile to implement. What's more, the
+ reason why the pixel offset was introduced (avoiding rounding
+ errors) does not apply for MapUnit::MapPixel, because one can always
+ use the MapMode origin then.
+
+ @param rOffset
+ The offset in pixel
+ */
+ void SetPixelOffset( const Size& rOffset );
+
+ /** Get the offset in pixel
+
+ @see OutputDevice::SetPixelOffset for details
+
+ @return the current offset in pixel
+ */
+ SAL_WARN_UNUSED_RESULT Size GetPixelOffset() const { return Size(mnOutOffOrigX, mnOutOffOrigY);}
+
+ SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point& rLogicPt) const;
+ SAL_WARN_UNUSED_RESULT Size LogicToPixel(const Size& rLogicSize) const;
+ SAL_WARN_UNUSED_RESULT tools::Rectangle LogicToPixel(const tools::Rectangle& rLogicRect) const;
+ SAL_WARN_UNUSED_RESULT tools::Polygon LogicToPixel(const tools::Polygon& rLogicPoly) const;
+ SAL_WARN_UNUSED_RESULT tools::PolyPolygon LogicToPixel(const tools::PolyPolygon& rLogicPolyPoly) const;
+ SAL_WARN_UNUSED_RESULT basegfx::B2DPolyPolygon LogicToPixel(const basegfx::B2DPolyPolygon& rLogicPolyPoly) const;
+ SAL_WARN_UNUSED_RESULT vcl::Region LogicToPixel(const vcl::Region& rLogicRegion)const;
+ SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point& rLogicPt, const MapMode& rMapMode) const;
+ SAL_WARN_UNUSED_RESULT Size LogicToPixel(const Size& rLogicSize, const MapMode& rMapMode) const;
+ SAL_WARN_UNUSED_RESULT tools::Rectangle LogicToPixel(const tools::Rectangle& rLogicRect,
+ const MapMode& rMapMode) const;
+ SAL_WARN_UNUSED_RESULT tools::Polygon LogicToPixel(const tools::Polygon& rLogicPoly,
+ const MapMode& rMapMode) const;
+ SAL_WARN_UNUSED_RESULT basegfx::B2DPolyPolygon LogicToPixel(const basegfx::B2DPolyPolygon& rLogicPolyPoly,
+ const MapMode& rMapMode) const;
+
+ SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point& rDevicePt) const;
+ SAL_WARN_UNUSED_RESULT Size PixelToLogic(const Size& rDeviceSize) const;
+ SAL_WARN_UNUSED_RESULT tools::Rectangle PixelToLogic(const tools::Rectangle& rDeviceRect) const;
+ SAL_WARN_UNUSED_RESULT tools::Polygon PixelToLogic(const tools::Polygon& rDevicePoly) const;
+ SAL_WARN_UNUSED_RESULT tools::PolyPolygon PixelToLogic(const tools::PolyPolygon& rDevicePolyPoly) const;
+ SAL_WARN_UNUSED_RESULT basegfx::B2DPolyPolygon PixelToLogic(const basegfx::B2DPolyPolygon& rDevicePolyPoly) const;
+ SAL_WARN_UNUSED_RESULT vcl::Region PixelToLogic(const vcl::Region& rDeviceRegion) const;
+ SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point& rDevicePt, const MapMode& rMapMode) const;
+ SAL_WARN_UNUSED_RESULT Size PixelToLogic(const Size& rDeviceSize, const MapMode& rMapMode) const;
+ SAL_WARN_UNUSED_RESULT tools::Rectangle PixelToLogic(const tools::Rectangle& rDeviceRect,
+ const MapMode& rMapMode) const;
+ SAL_WARN_UNUSED_RESULT tools::Polygon PixelToLogic(const tools::Polygon& rDevicePoly,
+ const MapMode& rMapMode) const;
+ SAL_WARN_UNUSED_RESULT basegfx::B2DPolygon PixelToLogic(const basegfx::B2DPolygon& rDevicePoly,
+ const MapMode& rMapMode) const;
+ SAL_WARN_UNUSED_RESULT basegfx::B2DPolyPolygon PixelToLogic(const basegfx::B2DPolyPolygon& rDevicePolyPoly,
+ const MapMode& rMapMode) const;
+
+ SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point& rPtSource,
+ const MapMode* pMapModeSource,
+ const MapMode* pMapModeDest) const;
+ SAL_WARN_UNUSED_RESULT Size LogicToLogic(const Size& rSzSource,
+ const MapMode* pMapModeSource,
+ const MapMode* pMapModeDest) const;
+ SAL_WARN_UNUSED_RESULT tools::Rectangle LogicToLogic(const tools::Rectangle& rRectSource,
+ const MapMode* pMapModeSource,
+ const MapMode* pMapModeDest) const;
+ SAL_WARN_UNUSED_RESULT static Point LogicToLogic(const Point& rPtSource,
+ const MapMode& rMapModeSource,
+ const MapMode& rMapModeDest);
+ SAL_WARN_UNUSED_RESULT static Size LogicToLogic(const Size& rSzSource,
+ const MapMode& rMapModeSource,
+ const MapMode& rMapModeDest);
+ SAL_WARN_UNUSED_RESULT static tools::Rectangle LogicToLogic(const tools::Rectangle& rRectSource,
+ const MapMode& rMapModeSource,
+ const MapMode& rMapModeDest);
+ SAL_WARN_UNUSED_RESULT static tools::Long LogicToLogic(tools::Long nLongSource,
+ MapUnit eUnitSource,
+ MapUnit eUnitDest);
+
+ SAL_WARN_UNUSED_RESULT static basegfx::B2DPolygon LogicToLogic(const basegfx::B2DPolygon& rPoly,
+ const MapMode& rMapModeSource,
+ const MapMode& rMapModeDest);
+
+ // create a mapping transformation from rMapModeSource to rMapModeDest (the above methods
+ // for B2DPoly/Polygons use this internally anyway to transform the B2DPolygon)
+ SAL_WARN_UNUSED_RESULT static basegfx::B2DHomMatrix LogicToLogic(const MapMode& rMapModeSource,
+ const MapMode& rMapModeDest);
+
+ /** Convert a logical rectangle to a rectangle in physical device pixel units.
+
+ @param rLogicRect Const reference to a rectangle in logical units
+
+ @returns Rectangle based on physical device pixel coordinates and units.
+ */
+ SAL_DLLPRIVATE tools::Rectangle ImplLogicToDevicePixel( const tools::Rectangle& rLogicRect ) const;
+
+ /** Convert a logical point to a physical point on the device.
+
+ @param rLogicPt Const reference to a point in logical units.
+
+ @returns Physical point on the device.
+ */
+ SAL_DLLPRIVATE Point ImplLogicToDevicePixel( const Point& rLogicPt ) const;
+ SAL_DLLPRIVATE DevicePoint ImplLogicToDeviceFontCoordinate(const Point& rLogicPt) const;
+
+ /** Convert a logical width to a width in units of device pixels.
+
+ To get the number of device pixels, it must calculate the X-DPI of the device and
+ the map scaling factor. If there is no mapping, then it just returns the
+ width as nothing more needs to be done.
+
+ @param nWidth Logical width
+
+ @returns Width in units of device pixels.
+ */
+ SAL_DLLPRIVATE tools::Long ImplLogicWidthToDevicePixel( tools::Long nWidth ) const;
+ SAL_DLLPRIVATE double ImplLogicWidthToDeviceFontWidth(tools::Long nWidth) const;
+
+ SAL_DLLPRIVATE DeviceCoordinate LogicWidthToDeviceCoordinate( tools::Long nWidth ) const;
+
+ /** Convert a logical X coordinate to a device pixel's X coordinate.
+
+ To get the device's X coordinate, it must calculate the mapping offset
+ coordinate X position (if there is one - if not then it just adds
+ the pseudo-window offset to the logical X coordinate), the X-DPI of
+ the device and the mapping's X scaling factor.
+
+ @param nX Logical X coordinate
+
+ @returns Device's X pixel coordinate
+ */
+ SAL_DLLPRIVATE tools::Long ImplLogicXToDevicePixel( tools::Long nX ) const;
+
+ /** Convert a logical Y coordinate to a device pixel's Y coordinate.
+
+ To get the device's Y coordinate, it must calculate the mapping offset
+ coordinate Y position (if there is one - if not then it just adds
+ the pseudo-window offset to the logical Y coordinate), the Y-DPI of
+ the device and the mapping's Y scaling factor.
+
+ @param nY Logical Y coordinate
+
+ @returns Device's Y pixel coordinate
+ */
+ SAL_DLLPRIVATE tools::Long ImplLogicYToDevicePixel( tools::Long nY ) const;
+
+ /** Convert a logical height to a height in units of device pixels.
+
+ To get the number of device pixels, it must calculate the Y-DPI of the device and
+ the map scaling factor. If there is no mapping, then it just returns the
+ height as nothing more needs to be done.
+
+ @param nHeight Logical height
+
+ @returns Height in units of device pixels.
+ */
+ SAL_DLLPRIVATE tools::Long ImplLogicHeightToDevicePixel( tools::Long nHeight ) const;
+
+ /** Convert device pixels to a width in logical units.
+
+ To get the logical width, it must calculate the X-DPI of the device and the
+ map scaling factor.
+
+ @param nWidth Width in device pixels
+
+ @returns Width in logical units.
+ */
+ SAL_DLLPRIVATE tools::Long ImplDevicePixelToLogicWidth( tools::Long nWidth ) const;
+
+ /** Convert device pixels to a height in logical units.
+
+ To get the logical height, it must calculate the Y-DPI of the device and the
+ map scaling factor.
+
+ @param nHeight Height in device pixels
+
+ @returns Height in logical units.
+ */
+ SAL_DLLPRIVATE tools::Long ImplDevicePixelToLogicHeight( tools::Long nHeight ) const;
+
+ /** Convert logical height to device pixels, with exact sub-pixel value.
+
+ To get the \em exact pixel height, it must calculate the Y-DPI of the device and the
+ map scaling factor.
+
+ @param fLogicHeight Exact height in logical units.
+
+ @returns Exact height in pixels - returns as a float to provide for subpixel value.
+ */
+ SAL_DLLPRIVATE float ImplFloatLogicHeightToDevicePixel( float fLogicHeight ) const;
+
+ /** Convert a logical size to the size on the physical device.
+
+ @param rLogicSize Const reference to a size in logical units
+
+ @returns Physical size on the device.
+ */
+ SAL_DLLPRIVATE Size ImplLogicToDevicePixel( const Size& rLogicSize ) const;
+
+ /** Convert a rectangle in physical pixel units to a rectangle in physical pixel units and coords.
+
+ @param rPixelRect Const reference to rectangle in logical units and coords.
+
+ @returns Rectangle based on logical coordinates and units.
+ */
+ SAL_DLLPRIVATE tools::Rectangle ImplDevicePixelToLogic( const tools::Rectangle& rPixelRect ) const;
+
+ /** Convert a logical polygon to a polygon in physical device pixel units.
+
+ @param rLogicPoly Const reference to a polygon in logical units
+
+ @returns Polygon based on physical device pixel coordinates and units.
+ */
+ SAL_DLLPRIVATE tools::Polygon ImplLogicToDevicePixel( const tools::Polygon& rLogicPoly ) const;
+
+ /** Convert a logical B2DPolygon to a B2DPolygon in physical device pixel units.
+
+ @param rLogicSize Const reference to a B2DPolygon in logical units
+
+ @returns B2DPolyPolygon based on physical device pixel coordinates and units.
+ */
+ SAL_DLLPRIVATE ::basegfx::B2DPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolygon& rLogicPoly ) const;
+
+ /** Convert a logical polypolygon to a polypolygon in physical device pixel units.
+
+ @param rLogicPolyPoly Const reference to a polypolygon in logical units
+
+ @returns Polypolygon based on physical device pixel coordinates and units.
+ */
+ SAL_DLLPRIVATE tools::PolyPolygon ImplLogicToDevicePixel( const tools::PolyPolygon& rLogicPolyPoly ) const;
+
+ /** Convert a line in logical units to a line in physical device pixel units.
+
+ @param rLineInfo Const reference to a line in logical units
+
+ @returns Line based on physical device pixel coordinates and units.
+ */
+ SAL_DLLPRIVATE LineInfo ImplLogicToDevicePixel( const LineInfo& rLineInfo ) const;
+
+ /** Convert a region in pixel units to a region in device pixel units and coords.
+
+ @param rRegion Const reference to region.
+
+ @returns vcl::Region based on device pixel coordinates and units.
+ */
+ SAL_DLLPRIVATE vcl::Region ImplPixelToDevicePixel( const vcl::Region& rRegion ) const;
+
+ /** Invalidate the view transformation.
+
+ @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
+ */
+ SAL_DLLPRIVATE void ImplInvalidateViewTransform();
+
+ /** Get device transformation.
+
+ @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
+ */
+ SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const;
+ ///@}
+
+
+ /** @name Native Widget Rendering functions
+
+ These all just call through to the private mpGraphics functions of the same name.
+ */
+ ///@{
+
+public:
+
+ /** Determine if native widgets can be enabled
+ */
+ virtual bool CanEnableNativeWidget() const { return false; }
+
+ /** Query the platform layer for control support
+ */
+ bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
+
+ /** Query the native control to determine if it was acted upon
+ */
+ bool HitTestNativeScrollbar(
+ ControlPart nPart,
+ const tools::Rectangle& rControlRegion,
+ const Point& aPos,
+ bool& rIsInside ) const;
+
+ /** Request rendering of a particular control and/or part
+ */
+ bool DrawNativeControl(
+ ControlType nType,
+ ControlPart nPart,
+ const tools::Rectangle& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ const OUString& aCaption,
+ const Color& rBackgroundColor = COL_AUTO );
+
+ /** Query the native control's actual drawing region (including adornment)
+ */
+ bool GetNativeControlRegion(
+ ControlType nType,
+ ControlPart nPart,
+ const tools::Rectangle& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ tools::Rectangle &rNativeBoundingRegion,
+ tools::Rectangle &rNativeContentRegion ) const;
+ ///@}
+
+ /** @name EPS functions
+ */
+ ///@{
+
+public:
+
+ /** @returns boolean value to see if EPS could be painted directly.
+ Theoretically, handing over a matrix would be needed to handle
+ painting rotated EPS files (e.g. contained in Metafiles). This
+ would then need to be supported for Mac and PS printers, but
+ that's too much for now, wrote \#i107046# for this */
+ bool DrawEPS(
+ const Point& rPt, const Size& rSz,
+ const GfxLink& rGfxLink, GDIMetaFile* pSubst = nullptr );
+ ///@}
+
+public:
+ virtual css::awt::DeviceInfo GetDeviceInfo() const;
+
+ /** Get the vcl::Window that this OutputDevice belongs to, if any */
+ virtual vcl::Window* GetOwnerWindow() const { return nullptr; }
+
+protected:
+ css::awt::DeviceInfo GetCommonDeviceInfo(Size const& aDevSize) const;
+
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/outdev/ScopedStates.hxx b/include/vcl/outdev/ScopedStates.hxx
new file mode 100644
index 000000000..7542cfeed
--- /dev/null
+++ b/include/vcl/outdev/ScopedStates.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_SCOPEDSTATES_HXX
+#define INCLUDED_VCL_SCOPEDSTATES_HXX
+
+#include <vcl/outdev.hxx>
+
+namespace vcl
+{
+class ScopedAntialiasing
+{
+private:
+ OutputDevice& m_rOutputDevice;
+ AntialiasingFlags m_nPreviousAAState;
+
+public:
+ ScopedAntialiasing(OutputDevice& rOutputDevice, bool bAAState)
+ : m_rOutputDevice(rOutputDevice)
+ , m_nPreviousAAState(m_rOutputDevice.GetAntialiasing())
+ {
+ if (bAAState)
+ rOutputDevice.SetAntialiasing(m_nPreviousAAState | AntialiasingFlags::Enable);
+ else
+ rOutputDevice.SetAntialiasing(m_nPreviousAAState & ~AntialiasingFlags::Enable);
+ }
+
+ ~ScopedAntialiasing() { m_rOutputDevice.SetAntialiasing(m_nPreviousAAState); }
+};
+}
+
+#endif // INCLUDED_VCL_SCOPEDSTATES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdf/PDFAnnotationMarker.hxx b/include/vcl/pdf/PDFAnnotationMarker.hxx
new file mode 100644
index 000000000..c4be54d69
--- /dev/null
+++ b/include/vcl/pdf/PDFAnnotationMarker.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <tools/color.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+
+namespace vcl::pdf
+{
+struct VCL_DLLPUBLIC PDFAnnotationMarker
+{
+ PDFAnnotationMarker()
+ : mnWidth(0.0f)
+ , maFillColor(COL_TRANSPARENT)
+ {
+ }
+
+ float mnWidth;
+ Color maFillColor;
+};
+
+struct VCL_DLLPUBLIC PDFAnnotationMarkerCircle : public PDFAnnotationMarker
+{
+};
+
+struct VCL_DLLPUBLIC PDFAnnotationMarkerSquare : public PDFAnnotationMarker
+{
+};
+
+struct VCL_DLLPUBLIC PDFAnnotationMarkerInk : public PDFAnnotationMarker
+{
+ std::vector<basegfx::B2DPolygon> maStrokes;
+};
+
+struct VCL_DLLPUBLIC PDFAnnotationMarkerPolygon : public PDFAnnotationMarker
+{
+ basegfx::B2DPolygon maPolygon;
+};
+
+struct VCL_DLLPUBLIC PDFAnnotationMarkerLine : public PDFAnnotationMarker
+{
+ basegfx::B2DPoint maLineStart;
+ basegfx::B2DPoint maLineEnd;
+};
+
+enum class PDFTextMarkerType
+{
+ Highlight,
+ Underline,
+ Squiggly,
+ StrikeOut
+};
+
+struct VCL_DLLPUBLIC PDFAnnotationMarkerHighlight : public PDFAnnotationMarker
+{
+ std::vector<basegfx::B2DPolygon> maQuads;
+ PDFTextMarkerType meTextMarkerType;
+
+ PDFAnnotationMarkerHighlight(PDFTextMarkerType eTextMarkerType)
+ : meTextMarkerType(eTextMarkerType)
+ {
+ }
+};
+
+} // namespace vcl::pdf
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdf/PDFAnnotationSubType.hxx b/include/vcl/pdf/PDFAnnotationSubType.hxx
new file mode 100644
index 000000000..749100e36
--- /dev/null
+++ b/include/vcl/pdf/PDFAnnotationSubType.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+namespace vcl::pdf
+{
+enum class PDFAnnotationSubType
+{
+ Unknown = 0,
+ Text = 1,
+ Link = 2,
+ FreeText = 3,
+ Line = 4,
+ Square = 5,
+ Circle = 6,
+ Polygon = 7,
+ Polyline = 8,
+ Highlight = 9,
+ Underline = 10,
+ Squiggly = 11,
+ Strikeout = 12,
+ Stamp = 13,
+ Caret = 14,
+ Ink = 15,
+ Popup = 16,
+ FileAttachment = 17,
+ Sound = 18,
+ Movie = 19,
+ Widget = 20,
+ Screen = 21,
+ Printermark = 22,
+ Trapnet = 23,
+ Watermark = 24,
+ Threed = 25,
+ Richmedia = 26,
+ XFAWidget = 27,
+ Redact = 28
+};
+
+} // namespace vcl::pdf
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdf/PDFBitmapType.hxx b/include/vcl/pdf/PDFBitmapType.hxx
new file mode 100644
index 000000000..fe5921276
--- /dev/null
+++ b/include/vcl/pdf/PDFBitmapType.hxx
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+namespace vcl::pdf
+{
+enum class PDFBitmapType
+{
+ Unknown = 0,
+ Gray = 1,
+ BGR = 2,
+ BGRx = 3,
+ BGRA = 4,
+};
+
+} // namespace vcl::pdf
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdf/PDFErrorType.hxx b/include/vcl/pdf/PDFErrorType.hxx
new file mode 100644
index 000000000..82cee9e5e
--- /dev/null
+++ b/include/vcl/pdf/PDFErrorType.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+namespace vcl::pdf
+{
+enum class PDFErrorType
+{
+ Success = 0,
+ Unknown = 1,
+ File = 2,
+ Format = 3,
+ Password = 4,
+ Security = 5,
+ Page = 6,
+};
+
+} // namespace vcl::pdf
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdf/PDFFillMode.hxx b/include/vcl/pdf/PDFFillMode.hxx
new file mode 100644
index 000000000..e5bc71f0d
--- /dev/null
+++ b/include/vcl/pdf/PDFFillMode.hxx
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+namespace vcl::pdf
+{
+enum class PDFFillMode
+{
+ None = 0,
+ Alternate = 1,
+ Winding = 2,
+};
+
+} // namespace vcl::pdf
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdf/PDFFindFlags.hxx b/include/vcl/pdf/PDFFindFlags.hxx
new file mode 100644
index 000000000..3ad8c77e3
--- /dev/null
+++ b/include/vcl/pdf/PDFFindFlags.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <o3tl/typed_flags_set.hxx>
+#include <sal/types.h>
+
+namespace vcl::pdf
+{
+enum class PDFFindFlags : sal_uInt32
+{
+ MatchCase = 0x00000001,
+ MatchWholeWord = 0x00000002,
+ Consecutive = 0x00000004,
+};
+
+} // namespace vcl::pdf
+
+namespace o3tl
+{
+template <>
+struct typed_flags<vcl::pdf::PDFFindFlags> : is_typed_flags<vcl::pdf::PDFFindFlags, 0x00000007>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdf/PDFObjectType.hxx b/include/vcl/pdf/PDFObjectType.hxx
new file mode 100644
index 000000000..c3ee6c752
--- /dev/null
+++ b/include/vcl/pdf/PDFObjectType.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+namespace vcl::pdf
+{
+enum class PDFObjectType
+{
+ Unknown = 0,
+ Boolean = 1,
+ Number = 2,
+ String = 3,
+ Name = 4,
+ Array = 5,
+ Dictionary = 6,
+ Stream = 7,
+ Nullobj = 8,
+ Reference = 9
+};
+
+} // namespace vcl::pdf
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdf/PDFPageObjectType.hxx b/include/vcl/pdf/PDFPageObjectType.hxx
new file mode 100644
index 000000000..68e763e64
--- /dev/null
+++ b/include/vcl/pdf/PDFPageObjectType.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+namespace vcl::pdf
+{
+enum class PDFPageObjectType
+{
+ Unknown = 0,
+ Text = 1,
+ Path = 2,
+ Image = 3,
+ Shading = 4,
+ Form = 5
+};
+
+} // namespace vcl::pdf
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdf/PDFSegmentType.hxx b/include/vcl/pdf/PDFSegmentType.hxx
new file mode 100644
index 000000000..98f74482e
--- /dev/null
+++ b/include/vcl/pdf/PDFSegmentType.hxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+namespace vcl::pdf
+{
+enum class PDFSegmentType
+{
+ Unknown = -1,
+ Lineto = 0,
+ Bezierto = 1,
+ Moveto = 2,
+};
+
+} // namespace vcl::pdf
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdf/PDFTextRenderMode.hxx b/include/vcl/pdf/PDFTextRenderMode.hxx
new file mode 100644
index 000000000..366a080fb
--- /dev/null
+++ b/include/vcl/pdf/PDFTextRenderMode.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+namespace vcl::pdf
+{
+enum class PDFTextRenderMode
+{
+ Unknown = -1,
+ Fill = 0,
+ Stroke = 1,
+ FillStroke = 2,
+ Invisible = 3,
+ FillClip = 4,
+ StrokeClip = 5,
+ FillStrokeClip = 6,
+ Clip = 7
+};
+
+} // namespace vcl::pdf
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
new file mode 100644
index 000000000..45cb71682
--- /dev/null
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -0,0 +1,488 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_PDFEXTOUTDEVDATA_HXX
+#define INCLUDED_VCL_PDFEXTOUTDEVDATA_HXX
+
+#include <vcl/dllapi.h>
+
+#include <vcl/pdfwriter.hxx>
+#include <vcl/extoutdevdata.hxx>
+#include <vector>
+#include <memory>
+
+class Graphic;
+class GDIMetaFile;
+
+namespace vcl
+{
+
+/*
+ A PDFExtOutDevBookmarkEntry is being created by the EditEngine if
+ a bookmark URL has been parsed. The Application is requested to take
+ care of each bookmark entry by emptying out the bookmark vector.
+*/
+struct PDFExtOutDevBookmarkEntry
+{
+ /** ID of the link pointing to the bookmark, or -1 if the entry denotes a destination instead of a link.
+ */
+ sal_Int32 nLinkId;
+
+ /** ID of the named destination denoted by the bookmark, or -1 if the entry denotes a link instead of a named destination.
+ */
+ sal_Int32 nDestId;
+
+ /** link target name, respectively destination name
+ */
+ OUString aBookmark;
+
+ PDFExtOutDevBookmarkEntry()
+ :nLinkId( -1 )
+ ,nDestId( -1 )
+ {
+ }
+};
+
+/*
+ Class that is being set at the OutputDevice allowing the
+ application to send enhanced PDF commands like CreateLink
+*/
+struct PageSyncData;
+struct GlobalSyncData;
+class VCL_DLLPUBLIC PDFExtOutDevData final : public ExtOutDevData
+{
+
+ const OutputDevice& mrOutDev;
+
+ bool mbTaggedPDF;
+ bool mbExportNotes;
+ bool mbExportNotesPages;
+ bool mbTransitionEffects;
+ bool mbUseLosslessCompression;
+ bool mbReduceImageResolution;
+ bool mbExportFormFields;
+ bool mbExportBookmarks;
+ bool mbExportHiddenSlides;
+ bool mbSinglePageSheets;
+ bool mbExportNDests; //i56629
+ sal_Int32 mnPage;
+ sal_Int32 mnCompressionQuality;
+ css::lang::Locale maDocLocale;
+
+ std::unique_ptr<PageSyncData> mpPageSyncData;
+ std::unique_ptr<GlobalSyncData> mpGlobalSyncData;
+
+ std::vector< PDFExtOutDevBookmarkEntry > maBookmarks;
+ std::vector<OUString> maChapterNames;
+
+public:
+
+ PDFExtOutDevData( const OutputDevice& rOutDev );
+ virtual ~PDFExtOutDevData() override;
+
+ bool PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAction, const GDIMetaFile& rMtf );
+ void ResetSyncData();
+
+ void PlayGlobalActions( PDFWriter& rWriter );
+
+ bool GetIsExportNotes() const { return mbExportNotes;}
+ void SetIsExportNotes( const bool bExportNotes );
+
+ bool GetIsExportNotesPages() const { return mbExportNotesPages;}
+ void SetIsExportNotesPages( const bool bExportNotesPages );
+
+ bool GetIsExportTaggedPDF() const { return mbTaggedPDF;}
+ void SetIsExportTaggedPDF( const bool bTaggedPDF );
+
+ bool GetIsExportTransitionEffects() const { return mbTransitionEffects;}
+ void SetIsExportTransitionEffects( const bool bTransitionalEffects );
+
+ bool GetIsExportFormFields() const { return mbExportFormFields;}
+ void SetIsExportFormFields( const bool bExportFormFields );
+
+ bool GetIsExportBookmarks() const { return mbExportBookmarks;}
+ void SetIsExportBookmarks( const bool bExportBookmarks );
+
+ bool GetIsExportHiddenSlides() const { return mbExportHiddenSlides;}
+ void SetIsExportHiddenSlides( const bool bExportHiddenSlides );
+
+ void SetIsSinglePageSheets( const bool bSinglePageSheets );
+
+ bool GetIsExportNamedDestinations() const { return mbExportNDests;} //i56629
+ void SetIsExportNamedDestinations( const bool bExportNDests ); //i56629
+
+ // PageNumber, Compression is being set by the PDFExport
+ sal_Int32 GetCurrentPageNumber() const { return mnPage;}
+ void SetCurrentPageNumber( const sal_Int32 nPage );
+
+ bool GetIsLosslessCompression() const { return mbUseLosslessCompression;}
+ void SetIsLosslessCompression( const bool bLosslessCompression );
+
+ void SetCompressionQuality( const sal_Int32 nQuality );
+
+ bool GetIsReduceImageResolution() const { return mbReduceImageResolution;}
+ void SetIsReduceImageResolution( const bool bReduceImageResolution );
+
+ const css::lang::Locale& GetDocumentLocale() const { return maDocLocale;}
+ void SetDocumentLocale( const css::lang::Locale& rLoc );
+
+ std::vector< PDFExtOutDevBookmarkEntry >& GetBookmarks() { return maBookmarks;}
+ const std::vector<OUString>& GetChapterNames() const { return maChapterNames; }
+
+ const Graphic& GetCurrentGraphic() const;
+
+ /** Start a new group of render output
+
+ Use this method to group render output.
+ */
+ void BeginGroup();
+
+ /** End render output
+
+ This method ends grouped render output, that can be
+ represented by a GfxLink. This is typically used for
+ external graphic files, such as JPEGs, EPS files etc.
+ The BeginGroup/EndGroup calls must exactly enclose the
+ relevant OutputDevice calls issued to render the
+ graphic the normal way.
+
+ @param rGraphic
+ The link to the original graphic
+
+ @param nTransparency
+ Eight bit transparency value, with 0 denoting full opacity,
+ and 255 full transparency.
+
+ @param rOutputRect
+ The output rectangle of the graphic.
+
+ @param rVisibleOutputRect
+ The visible part of the output. This might be less than
+ rOutputRect, e.g. for cropped graphics.
+ */
+ void EndGroup( const Graphic& rGraphic,
+ sal_uInt8 nTransparency,
+ const tools::Rectangle& rOutputRect,
+ const tools::Rectangle& rVisibleOutputRect );
+
+ /// Detect if stream is compressed enough to avoid de-compress / scale & re-compress
+ bool HasAdequateCompression( const Graphic &rGraphic,
+ const tools::Rectangle &rOutputRect,
+ const tools::Rectangle &rVisibleOutputRect ) const;
+
+//--->i56629
+ /** Create a new named destination to be used in a link to this document from another PDF document
+ (see PDF spec 1.4, 8.2.1)
+
+ @param sDestName
+ the name this destination will be addressed with from others PDF document
+
+ @param rRect
+ target rectangle on page to be displayed if dest is jumped to
+
+ @param nPageNr
+ number of page the dest is on (as returned by NewPage)
+ or -1 in which case the current page is used
+
+ @returns
+ the destination id (to be used in SetLinkDest) or
+ -1 if page id does not exist
+ */
+ sal_Int32 CreateNamedDest( const OUString& sDestName, const tools::Rectangle& rRect, sal_Int32 nPageNr = -1 );
+
+ /** registers a destination for which a destination ID needs to be known immediately, instead of later on setting it via
+ SetLinkDest.
+
+ This is used in contexts where a destination is referenced by means other than a link.
+
+ Later in the export process, a call to DescribeRegisteredDest must be made, providing the information about
+ the destination.
+
+ @return
+ the unique Id of the destination
+ */
+ sal_Int32 RegisterDest();
+
+ /** provides detailed information about a destination range which previously has been registered using RegisterDest.
+ */
+ void DescribeRegisteredDest( sal_Int32 nDestId, const tools::Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType = PDFWriter::DestAreaType::XYZ );
+
+//<---i56629
+
+ /** Create a new destination to be used in a link
+
+ @param rRect
+ target rectangle on page to be displayed if dest is jumped to
+
+ @param nPageNr
+ number of page the dest is on (as returned by NewPage)
+ or -1 in which case the current page is used
+
+ @param eType
+ what dest type to use
+
+ @returns
+ the destination id (to be used in SetLinkDest) or
+ -1 if page id does not exist
+ */
+ sal_Int32 CreateDest( const tools::Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::DestAreaType::XYZ );
+ /** Create a new link on a page
+
+ @param rRect
+ active rectangle of the link (that is the area that has to be
+ hit to activate the link)
+
+ @param nPageNr
+ number of page the link is on (as returned by NewPage)
+ or -1 in which case the current page is used
+
+ @param rAltText
+ Alt text for the link
+
+ @returns
+ the link id (to be used in SetLinkDest, SetLinkURL) or
+ -1 if page id does not exist
+ */
+ sal_Int32 CreateLink(const tools::Rectangle& rRect, OUString const& rAltText, sal_Int32 nPageNr = -1);
+
+ /// Create a Screen annotation.
+ sal_Int32 CreateScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr);
+
+ /** Set the destination for a link
+ <p>will change a URL type link to a dest link if necessary</p>
+
+ @param nLinkId
+ the link to be changed
+
+ @param nDestId
+ the dest the link shall point to
+ */
+ void SetLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId );
+ /** Set the URL for a link
+ <p>will change a dest type link to a URL type link if necessary</p>
+ @param nLinkId
+ the link to be changed
+
+ @param rURL
+ the URL the link shall point to.
+ there will be no error checking or any kind of
+ conversion done to this parameter execept this:
+ it will be output as 7bit Ascii. The URL
+ will appear literally in the PDF file produced
+ */
+ void SetLinkURL( sal_Int32 nLinkId, const OUString& rURL );
+
+ /// Set URL for a linked Screen annotation.
+ void SetScreenURL(sal_Int32 nScreenId, const OUString& rURL);
+ /// Set URL for an embedded Screen annotation.
+ void SetScreenStream(sal_Int32 nScreenId, const OUString& rURL);
+
+ /** Create a new outline item
+
+ @param nParent
+ declares the parent of the new item in the outline hierarchy.
+ An invalid value will result in a new toplevel item.
+
+ @param rText
+ sets the title text of the item
+
+ @param nDestID
+ declares which Dest (created with CreateDest) the outline item
+ will point to
+
+ @returns
+ the outline item id of the new item
+ */
+ sal_Int32 CreateOutlineItem( sal_Int32 nParent, const OUString& rText, sal_Int32 nDestID );
+
+ /** Create a new note on a page
+
+ @param rRect
+ active rectangle of the note (that is the area that has to be
+ hit to popup the annotation)
+
+ @param rNote
+ specifies the contents of the note
+
+ @param nPageNr
+ number of page the note is on (as returned by NewPage)
+ or -1 in which case the current page is used
+ */
+ void CreateNote( const tools::Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 );
+
+ /** begin a new logical structure element
+
+ BeginStructureElement/EndStructureElement calls build the logical structure
+ of the PDF - the basis for tagged PDF. Structural elements are implemented
+ using marked content tags. Each structural element can contain sub elements
+ (e.g. a section can contain a heading and a paragraph). The structure hierarchy
+ is build automatically from the Begin/EndStructureElement calls.
+
+ A structural element need not be contained on one page; e.g. paragraphs often
+ run from one page to the next. In this case the corresponding EndStructureElement
+ must be called while drawing the next page.
+
+ BeginStructureElement and EndStructureElement must be called only after
+ PDFWriter::NewPage has been called and before
+ PDFWriter::Emit gets called. The current page
+ number is an implicit context parameter for Begin/EndStructureElement.
+
+ For pagination artifacts that are not part of the logical structure
+ of the document (like header, footer or page number) the special
+ StructElement NonStructElement exists. To place content
+ outside of the structure tree simply call
+ BeginStructureElement( NonStructElement ) then draw your
+ content and then call EndStructureElement(). Any children
+ of a NonStructElement will not be part of the structure as well.
+
+ @param eType
+ denotes what kind of element to begin (e.g. a heading or paragraph)
+
+ @param rAlias
+ the specified alias will be used as structure tag. Also an entry in the PDF's
+ role map will be created mapping alias to regular structure type.
+
+ @returns
+ the id of the newly created structural element
+ */
+ sal_Int32 BeginStructureElement( PDFWriter::StructElement eType, const OUString& rAlias = OUString() );
+ /** end a logical structure element
+
+ @see BeginStructureElement
+ */
+ void EndStructureElement();
+ /** set the current structure element
+
+ <p>
+ For different purposes it may be useful to paint a structure element's
+ content discontinuously. In that case an already existing structure element
+ can be appended to by using SetCurrentStructureElement. The
+ referenced structure element becomes the current structure element with
+ all consequences: all following structure elements are appended as children
+ of the current element.
+ </p>
+
+ @param nElement
+ the id of the new current structure element
+
+ @returns
+ True if the current structure element could be set successfully
+ False if the current structure element could not be changed
+ (e.g. if the passed element id is invalid)
+ */
+ bool SetCurrentStructureElement( sal_Int32 nElement );
+ /** get the current structure element id
+
+ @returns
+ the id of the current structure element
+ */
+ sal_Int32 GetCurrentStructureElement() const;
+
+ /** set a structure attribute on the current structural element
+
+ SetStructureAttribute sets an attribute of the current structural element to a
+ new value. A consistency check is performed before actually setting the value;
+ if the check fails, the function returns False and the attribute remains
+ unchanged.
+
+ @param eAttr
+ denotes what attribute to change
+
+ @param eVal
+ the value to set the attribute to
+ */
+ void SetStructureAttribute( PDFWriter::StructAttribute eAttr, PDFWriter::StructAttributeValue eVal );
+ /** set a structure attribute on the current structural element
+
+ SetStructureAttributeNumerical sets an attribute of the current structural element
+ to a new numerical value. A consistency check is performed before actually setting
+ the value; if the check fails, the function returns False and the attribute
+ remains unchanged.
+
+ @param eAttr
+ denotes what attribute to change
+
+ @param nValue
+ the value to set the attribute to
+ */
+ void SetStructureAttributeNumerical( PDFWriter::StructAttribute eAttr, sal_Int32 nValue );
+ /** set the bounding box of a structural element
+
+ SetStructureBoundingBox sets the BBox attribute to a new value. Since the BBox
+ attribute can only be applied to Table, Figure,
+ Form and Formula elements, a call of this function
+ for other element types will be ignored and the BBox attribute not be set.
+
+ @param rRect
+ the new bounding box for the structural element
+ */
+ void SetStructureBoundingBox( const tools::Rectangle& rRect );
+
+ /** set the ActualText attribute of a structural element
+
+ ActualText contains the Unicode text without layout artifacts that is shown by
+ a structural element. For example if a line is ended prematurely with a break in
+ a word and continued on the next line (e.g. "happen-<newline>stance") the
+ corresponding ActualText would contain the unbroken line (e.g. "happenstance").
+
+ @param rText
+ contains the complete logical text the structural element displays.
+ */
+ void SetActualText( const OUString& rText );
+
+ /** set the Alt attribute of a strutural element
+
+ Alt is s replacement text describing the contents of a structural element. This
+ is mainly used by accessibility applications; e.g. a screen reader would read
+ the Alt replacement text for an image to a visually impaired user.
+
+ @param rText
+ contains the replacement text for the structural element
+ */
+ void SetAlternateText( const OUString& rText );
+
+ /** Sets the transitional effect to be applied when the current page gets shown.
+
+ @param eType
+ the kind of effect to be used; use Regular to disable transitional effects
+ for this page
+
+ @param nMilliSec
+ the duration of the transitional effect in milliseconds;
+ set 0 to disable transitional effects
+ */
+ void SetPageTransition( PDFWriter::PageTransition eType, sal_uInt32 nMilliSec );
+
+ /** create a new form control
+
+ This function creates a new form control in the PDF and sets its various
+ properties. Do not pass an actual AnyWidget as rControlType
+ will be cast to the type described by the type member.
+
+ @param rControlType
+ a descendant of AnyWidget determining the control's properties
+ */
+ void CreateControl( const PDFWriter::AnyWidget& rControlType );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdfread.hxx b/include/vcl/pdfread.hxx
new file mode 100644
index 000000000..72508a548
--- /dev/null
+++ b/include/vcl/pdfread.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX
+#define INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX
+
+#include <vector>
+#include <tools/gen.hxx>
+#include <tools/stream.hxx>
+#include <tools/color.hxx>
+#include <vcl/graph.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+
+#include <vcl/pdf/PDFAnnotationSubType.hxx>
+#include <vcl/pdf/PDFAnnotationMarker.hxx>
+
+namespace com::sun::star::uno
+{
+template <typename> class Sequence;
+}
+class Bitmap;
+
+namespace vcl
+{
+/// Fills the rBitmaps vector with rendered pages.
+VCL_DLLPUBLIC size_t RenderPDFBitmaps(const void* pBuffer, int nSize,
+ std::vector<BitmapEx>& rBitmaps, size_t nFirstPage = 0,
+ int nPages = 1, const basegfx::B2DTuple* pSizeHint = nullptr);
+
+/// Imports a PDF stream as a VectorGraphicData.
+VCL_DLLPUBLIC bool
+importPdfVectorGraphicData(SvStream& rStream,
+ std::shared_ptr<VectorGraphicData>& rVectorGraphicData);
+
+/// Imports a PDF stream into rGraphic.
+VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic);
+
+// When inserting a PDF file as an image or pasting PDF data from the clipboard, at least on a
+// Retina iMac, the resulting rendered image does not look sharp without this surprisingly large
+// extra scaling factor. Exact reasons unknown. And it isn't enough to have it be just 2 (which is
+// the actual Retina factor on my iMac). Possibly the fuzziness is related to what Pdfium uses to
+// render text.
+
+// Also, look at CountDPIScaleFactor() in vcl/source/window/window.cxx. The GetDPIScaleFactor() API
+// lies on macOS even more than it does on other platforms, it claims that the DPI scale factor is
+// always 1. But in fact most Macs nowadays have a HiDPI ("Retina") display. But we can't just "fix"
+// things by making GetDPIScaleFactor() always return 2 on macOS, even if that wouldn't be any more
+// wrong, because that then causes other regressions that I have no time to look into now.
+
+#ifdef MACOSX
+constexpr int PDF_INSERT_MAGIC_SCALE_FACTOR = 8;
+#else
+constexpr int PDF_INSERT_MAGIC_SCALE_FACTOR = 1;
+#endif
+
+struct PDFGraphicAnnotation
+{
+ OUString maAuthor;
+ OUString maText;
+
+ basegfx::B2DRectangle maRectangle; // In HMM
+ css::util::DateTime maDateTime;
+
+ Color maColor;
+
+ pdf::PDFAnnotationSubType meSubType;
+ std::shared_ptr<pdf::PDFAnnotationMarker> mpMarker;
+};
+
+class PDFGraphicResult
+{
+ Graphic maGraphic;
+ // Size in HMM
+ Size maSize;
+
+ std::vector<PDFGraphicAnnotation> maAnnotations;
+
+public:
+ PDFGraphicResult(Graphic aGraphic, Size const& rSize,
+ std::vector<PDFGraphicAnnotation> aAnnotations)
+ : maGraphic(std::move(aGraphic))
+ , maSize(rSize)
+ , maAnnotations(std::move(aAnnotations))
+ {
+ }
+
+ const Graphic& GetGraphic() const { return maGraphic; }
+ const Size& GetSize() const { return maSize; }
+ const std::vector<PDFGraphicAnnotation>& GetAnnotations() const { return maAnnotations; }
+};
+
+/// Import PDF as Graphic images (1 per page), but not loaded yet.
+/// Returns the number of pages read.
+VCL_DLLPUBLIC size_t ImportPDFUnloaded(const OUString& rURL,
+ std::vector<PDFGraphicResult>& rGraphics);
+}
+
+#endif // INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
new file mode 100644
index 000000000..2122a4503
--- /dev/null
+++ b/include/vcl/pdfwriter.hxx
@@ -0,0 +1,1227 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_PDFWRITER_HXX
+#define INCLUDED_VCL_PDFWRITER_HXX
+
+#include <config_options.h>
+#include <sal/types.h>
+
+#include <tools/gen.hxx>
+#include <tools/color.hxx>
+#include <rtl/strbuf.hxx>
+
+#include <vcl/dllapi.h>
+#include <vcl/font.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/graph.hxx>
+
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+
+#include <memory>
+#include <vector>
+#include <set>
+
+namespace com::sun::star::beans { class XMaterialHolder; }
+namespace com::sun::star::io { class XOutputStream; }
+namespace com::sun::star::security { class XCertificate; }
+
+class GDIMetaFile;
+class MapMode;
+class LineInfo;
+namespace tools {
+ class Polygon;
+ class PolyPolygon;
+}
+class Bitmap;
+class BitmapEx;
+class Gradient;
+class Hatch;
+class Wallpaper;
+
+namespace vcl
+{
+
+class PDFExtOutDevData;
+class PDFWriterImpl;
+
+struct PDFNote
+{
+ OUString Title; // optional title for the popup containing the note
+ OUString Contents; // contents of the note
+ css::util::DateTime maModificationDate;
+};
+
+class VCL_DLLPUBLIC PDFOutputStream
+{
+ public:
+ virtual ~PDFOutputStream();
+ virtual void write( const css::uno::Reference< css::io::XOutputStream >& xStream ) = 0;
+};
+
+class VCL_DLLPUBLIC PDFWriter
+{
+ ScopedVclPtr<PDFWriterImpl> xImplementation;
+
+ PDFWriter(const PDFWriter&) = delete;
+ PDFWriter& operator=(const PDFWriter&) = delete;
+
+public:
+ // extended line info
+ enum CapType { capButt, capRound, capSquare };
+ enum JoinType { joinMiter, joinRound, joinBevel };
+ struct ExtLineInfo
+ {
+ double m_fLineWidth;
+ double m_fTransparency;
+ CapType m_eCap;
+ JoinType m_eJoin;
+ double m_fMiterLimit;
+ std::vector< double > m_aDashArray;
+
+ ExtLineInfo() : m_fLineWidth( 0.0 ),
+ m_fTransparency( 0.0 ),
+ m_eCap( capButt ),
+ m_eJoin( joinMiter ),
+ m_fMiterLimit( 10.0 )
+ {}
+ };
+
+ enum class Orientation { Portrait, Inherit };
+
+ // in case the below enum is added PDF_1_6 PDF_1_7, please add them just after PDF_1_5
+ enum class PDFVersion { PDF_1_2, PDF_1_3, PDF_1_4, PDF_1_5, PDF_1_6, PDF_A_1, PDF_A_2, PDF_A_3 };//i59651, PDF/A-1b & -1a, only -1b implemented for now
+ // for the meaning of DestAreaType please look at PDF Reference Manual
+ // version 1.4 section 8.2.1, page 475
+ enum class DestAreaType { XYZ, FitRectangle };
+
+ // for a definition of structural element types please refer to
+ // PDF Reference, 3rd ed. section 9.7.4
+ enum StructElement
+ {
+ // special element to place outside the structure hierarchy
+ NonStructElement,
+ // Grouping elements
+ Document, Part, Article, Section, Division, BlockQuote,
+ Caption, TOC, TOCI, Index,
+
+ // block level elements
+ Paragraph, Heading, H1, H2, H3, H4, H5, H6,
+ List, ListItem, LILabel, LIBody,
+ Table, TableRow, TableHeader, TableData,
+
+ // inline level elements
+ Span, Quote, Note, Reference, BibEntry, Code, Link,
+
+ // illustration elements
+ Figure, Formula, Form
+ };
+
+ enum StructAttribute
+ {
+ Placement, WritingMode, SpaceBefore, SpaceAfter, StartIndent, EndIndent,
+ TextIndent, TextAlign, Width, Height, BlockAlign, InlineAlign,
+ LineHeight, BaselineShift, TextDecorationType, ListNumbering,
+ RowSpan, ColSpan, Scope,
+
+ // link destination is an artificial attribute that sets
+ // the link annotation ID of a Link element
+ // further note: since structure attributes can only be
+ // set during content creation, but links can be
+ // created after the fact, it is possible to set
+ // an arbitrary id as structure attribute here. In this
+ // case the arbitrary id has to be passed again when the
+ // actual link annotation is created via SetLinkPropertyID
+ LinkAnnotation,
+ // Language currently sets a LanguageType (see i18nlangtag/lang.h)
+ // which will be internally changed to a corresponding locale
+ Language
+ };
+
+ enum StructAttributeValue
+ {
+ Invalid,
+ NONE,
+ // Placement
+ Block, Inline, Before, After, Start, End,
+ // WritingMode
+ LrTb, RlTb, TbRl,
+ // TextAlign
+ Center, Justify,
+ // Width, Height,
+ Auto,
+ // BlockAlign
+ Middle,
+ // LineHeight
+ Normal,
+ // TextDecorationType
+ Underline, Overline, LineThrough,
+ // Scope
+ Row, Column, Both,
+ // ListNumbering
+ Disc, Circle, Square, Decimal, UpperRoman, LowerRoman, UpperAlpha, LowerAlpha
+ };
+
+ enum class PageTransition
+ {
+ Regular,
+ SplitHorizontalInward, SplitHorizontalOutward,
+ SplitVerticalInward, SplitVerticalOutward,
+ BlindsHorizontal, BlindsVertical,
+ BoxInward, BoxOutward,
+ WipeLeftToRight, WipeBottomToTop, WipeRightToLeft, WipeTopToBottom,
+ Dissolve
+ };
+
+ enum WidgetType
+ {
+ PushButton, RadioButton, CheckBox, Edit, ListBox, ComboBox, Hierarchy,
+ Signature
+ };
+
+ enum FormatType
+ {
+ Text, Number, Time, Date
+ };
+
+ enum ErrorCode
+ {
+ // transparent object occurred and was draw opaque because
+ // PDF/A does not allow transparency
+ Warning_Transparency_Omitted_PDFA,
+
+ // transparent object occurred but is only supported since
+ // PDF 1.4
+ Warning_Transparency_Omitted_PDF13,
+
+ // a form action was exported that is not suitable for PDF/A
+ // the action was skipped
+ Warning_FormAction_Omitted_PDFA,
+
+ // transparent objects were converted to a bitmap in order
+ // to removetransparencies from the output
+ Warning_Transparency_Converted,
+
+ // signature generation failed
+ Error_Signature_Failed,
+ };
+
+ struct UNLESS_MERGELIBS(VCL_DLLPUBLIC) AnyWidget
+ {
+ WidgetType Type; // primitive RTTI
+ public:
+ OUString Name; // a distinct name to identify the control
+ OUString Description;// descriptive text for the control (e.g. for tool tip)
+ OUString Text; // user text to appear on the control
+ DrawTextFlags TextStyle; // style flags
+ bool ReadOnly;
+ tools::Rectangle Location; // describes the area filled by the control
+ bool Border; // true: widget should have a border, false: no border
+ Color BorderColor;// COL_TRANSPARENT and Border=true means get color from application settings
+ bool Background; // true: widget shall draw its background, false: no background
+ Color BackgroundColor; // COL_TRANSPARENT and Background=true means get color from application settings
+ vcl::Font TextFont; // an empty font will be replaced by the
+ // appropriate font from the user settings
+ Color TextColor; // COL_TRANSPARENT will be replaced by the appropriate color from application settings
+ sal_Int32 TabOrder; // lowest number is first in tab order
+
+ /* style flags for text are those for OutputDevice::DrawText
+ allowed values are:
+ DrawTextFlags::Left, DrawTextFlags::Center, DrawTextFlags::Right, DrawTextFlags::Top,
+ DrawTextFlags::VCenter, DrawTextFlags::Bottom,
+ DrawTextFlags::MultiLine, DrawTextFlags::WordBreak
+
+ if TextStyle is 0, then each control will fill in default values
+ */
+
+ // note: the Name member comprises the field name of the resulting
+ // PDF field names need to be globally unique. Therefore if any
+ // Widget with an already used name is created, the name will be
+ // made unique by adding an underscore ('_') and an ascending number
+ // to the name.
+
+ AnyWidget( WidgetType eType ) :
+ Type( eType ),
+ TextStyle( DrawTextFlags::NONE ),
+ ReadOnly( false ),
+ Border( false ),
+ BorderColor( COL_TRANSPARENT ),
+ Background( false ),
+ BackgroundColor( COL_TRANSPARENT ),
+ TextColor( COL_TRANSPARENT ),
+ TabOrder( -1 )
+ {}
+ virtual ~AnyWidget();
+
+ WidgetType getType() const { return Type; }
+
+ virtual std::shared_ptr<AnyWidget> Clone() const = 0;
+
+ protected:
+ // note that this equals the default compiler-generated copy-ctor, but we want to have it
+ // protected, to only allow sub classes to access it
+ AnyWidget( const AnyWidget& rSource )
+ :Type( rSource.Type )
+ ,Name( rSource.Name )
+ ,Description( rSource.Description )
+ ,Text( rSource.Text )
+ ,TextStyle( rSource.TextStyle )
+ ,ReadOnly( rSource.ReadOnly )
+ ,Location( rSource.Location )
+ ,Border( rSource.Border )
+ ,BorderColor( rSource.BorderColor )
+ ,Background( rSource.Background )
+ ,BackgroundColor( rSource.BackgroundColor )
+ ,TextFont( rSource.TextFont )
+ ,TextColor( rSource.TextColor )
+ ,TabOrder( rSource.TabOrder )
+ {
+ }
+ AnyWidget& operator=( const AnyWidget& ); // never implemented
+ };
+
+ struct PushButtonWidget final : public AnyWidget
+ {
+ /* If Dest is set to a valid link destination,
+ Then pressing the button will act as a goto
+ action within the document.
+
+ Else:
+ An empty URL means this button will reset the form.
+
+ If URL is not empty and Submit is set, then the URL
+ contained will be set as the URL to submit the
+ form to. In this case the submit method will be
+ either GET if SubmitGet is true or POST if
+ SubmitGet is false.
+
+ If URL is not empty and Submit is clear, then
+ the URL contained will be interpreted as a
+ hyperlink to be executed on pushing the button.
+
+ There will be no error checking or any kind of
+ conversion done to the URL parameter execept this:
+ it will be output as 7bit Ascii. The URL
+ will appear literally in the PDF file produced
+ */
+ sal_Int32 Dest;
+ OUString URL;
+ bool Submit;
+ bool SubmitGet;
+
+ PushButtonWidget()
+ : AnyWidget( vcl::PDFWriter::PushButton ),
+ Dest( -1 ), Submit( false ), SubmitGet( false )
+ {}
+
+ virtual std::shared_ptr<AnyWidget> Clone() const override
+ {
+ return std::make_shared<PushButtonWidget>( *this );
+ }
+ };
+
+ struct CheckBoxWidget final : public AnyWidget
+ {
+ bool Checked;
+ OUString OnValue; // the value of the checkbox if it is selected
+ OUString OffValue; // the value of the checkbox if it is not selected
+
+ CheckBoxWidget()
+ : AnyWidget( vcl::PDFWriter::CheckBox ),
+ Checked( false )
+ {}
+
+ virtual std::shared_ptr<AnyWidget> Clone() const override
+ {
+ return std::make_shared<CheckBoxWidget>( *this );
+ }
+ };
+
+ struct RadioButtonWidget final : public AnyWidget
+ {
+ bool Selected;
+ sal_Int32 RadioGroup;
+ OUString OnValue; // the value of the radio button if it is selected
+ OUString OffValue; // the value of the radio button if it is not selected
+
+ RadioButtonWidget()
+ : AnyWidget( vcl::PDFWriter::RadioButton ),
+ Selected( false ),
+ RadioGroup( 0 )
+ {}
+
+ virtual std::shared_ptr<AnyWidget> Clone() const override
+ {
+ return std::make_shared<RadioButtonWidget>( *this );
+ }
+ // radio buttons having the same RadioGroup id comprise one
+ // logical radio button group, that is at most one of the RadioButtons
+ // in a group can be checked at any time
+ //
+ // note: a PDF radio button field consists of a named field
+ // containing unnamed checkbox child fields. The name of the
+ // radio button field is taken from the first RadioButtonWidget created
+ // in the group
+ };
+
+ struct EditWidget final : public AnyWidget
+ {
+ bool MultiLine; // whether multiple lines are allowed
+ bool Password; // visible echo off
+ bool FileSelect; // field is a file selector
+ sal_Int32 MaxLen; // maximum field length in characters, 0 means unlimited
+ FormatType Format;
+ OUString CurrencySymbol;
+ sal_Int32 DecimalAccuracy;
+ bool PrependCurrencySymbol;
+ OUString TimeFormat;
+ OUString DateFormat;
+
+ EditWidget()
+ : AnyWidget( vcl::PDFWriter::Edit ),
+ MultiLine( false ),
+ Password( false ),
+ FileSelect( false ),
+ MaxLen( 0 ),
+ Format( FormatType::Text ),
+ DecimalAccuracy ( 0 ),
+ PrependCurrencySymbol( false )
+ {}
+
+ virtual std::shared_ptr<AnyWidget> Clone() const override
+ {
+ return std::make_shared<EditWidget>( *this );
+ }
+ };
+
+ struct ListBoxWidget final : public AnyWidget
+ {
+ bool DropDown;
+ bool MultiSelect;
+ std::vector<OUString> Entries;
+ std::vector<sal_Int32> SelectedEntries;
+ // if MultiSelect is false only the first entry of SelectedEntries
+ // will be taken into account. the same is implicit for PDF < 1.4
+ // since multiselect is a 1.4+ feature
+
+ ListBoxWidget()
+ : AnyWidget( vcl::PDFWriter::ListBox ),
+ DropDown( false ),
+ MultiSelect( false )
+ {}
+
+ virtual std::shared_ptr<AnyWidget> Clone() const override
+ {
+ return std::make_shared<ListBoxWidget>( *this );
+ }
+ };
+
+ // note: PDF only supports dropdown comboboxes
+ struct ComboBoxWidget final : public AnyWidget
+ {
+ std::vector<OUString> Entries;
+ // set the current value in AnyWidget::Text
+
+ ComboBoxWidget()
+ : AnyWidget( vcl::PDFWriter::ComboBox )
+ {}
+
+ virtual std::shared_ptr<AnyWidget> Clone() const override
+ {
+ return std::make_shared<ComboBoxWidget>( *this );
+ }
+ };
+
+ struct SignatureWidget final : public AnyWidget
+ {
+ SignatureWidget()
+ : AnyWidget( vcl::PDFWriter::Signature )
+ {}
+
+ virtual std::shared_ptr<AnyWidget> Clone() const override
+ {
+ return std::make_shared<SignatureWidget>( *this );
+ }
+ };
+
+ enum ExportDataFormat { HTML, XML, FDF, PDF };
+// see 3.6.1 of PDF 1.4 ref for details, used for 8.1 PDF v 1.4 ref also
+// These emuns are treated as integer while reading/writing to configuration
+ enum PDFViewerPageMode
+ {
+ ModeDefault,
+ UseOutlines,
+ UseThumbs
+ };
+// These emuns are treated as integer while reading/writing to configuration
+ enum PDFViewerAction
+ {
+ ActionDefault,
+ FitInWindow,
+ FitWidth,
+ FitVisible,
+ ActionZoom
+ };
+// These enums are treated as integer while reading/writing to configuration
+ enum PDFPageLayout
+ {
+ DefaultLayout,
+ SinglePage,
+ Continuous,
+ ContinuousFacing
+ };
+
+ // These emuns are treated as integer while reading/writing to configuration
+ //what default action to generate in a PDF hyperlink to external document/site
+ enum PDFLinkDefaultAction
+ {
+ URIAction,
+ URIActionDestination,
+ LaunchAction
+ };
+
+/*
+The following structure describes the permissions used in PDF security
+ */
+ struct PDFEncryptionProperties
+ {
+
+ //for both 40 and 128 bit security, see 3.5.2 PDF v 1.4 table 3.15, v 1.5 and v 1.6 table 3.20.
+ bool CanPrintTheDocument;
+ bool CanModifyTheContent;
+ bool CanCopyOrExtract;
+ bool CanAddOrModify;
+ //for revision 3 (bit 128 security) only
+ bool CanFillInteractive;
+ bool CanExtractForAccessibility;
+ bool CanAssemble;
+ bool CanPrintFull;
+
+ // encryption will only happen if EncryptionKey is not empty
+ // EncryptionKey is actually a construct out of OValue, UValue and DocumentIdentifier
+ // if these do not match, behavior is undefined, most likely an invalid PDF will be produced
+ // OValue, UValue, EncryptionKey and DocumentIdentifier can be computed from
+ // PDFDocInfo, Owner password and User password used the InitEncryption method which
+ // implements the algorithms described in the PDF reference chapter 3.5: Encryption
+ std::vector<sal_uInt8> OValue;
+ std::vector<sal_uInt8> UValue;
+ std::vector<sal_uInt8> EncryptionKey;
+ std::vector<sal_uInt8> DocumentIdentifier;
+
+ //permission default set for 128 bit, accessibility only
+ PDFEncryptionProperties() :
+ CanPrintTheDocument ( false ),
+ CanModifyTheContent ( false ),
+ CanCopyOrExtract ( false ),
+ CanAddOrModify ( false ),
+ CanFillInteractive ( false ),
+ CanExtractForAccessibility ( true ),
+ CanAssemble ( false ),
+ CanPrintFull ( false )
+ {}
+
+
+ bool Encrypt() const
+ { return ! OValue.empty() && ! UValue.empty() && ! DocumentIdentifier.empty(); }
+ };
+
+ struct PDFDocInfo
+ {
+ OUString Title; // document title
+ OUString Author; // document author
+ OUString Subject; // subject
+ OUString Keywords; // keywords
+ OUString Creator; // application that created the original document
+ OUString Producer; // OpenOffice
+ };
+
+ enum ColorMode
+ {
+ DrawColor, DrawGreyscale
+ };
+
+ struct PDFWriterContext
+ {
+ /* must be a valid file: URL usable by osl */
+ OUString URL;
+ /* the URL of the document being exported, used for relative links*/
+ OUString BaseURL;
+ /*if relative to file system should be formed*/
+ bool RelFsys;//i56629, i49415?, i64585?
+ /*the action to set the PDF hyperlink to*/
+ PDFWriter::PDFLinkDefaultAction DefaultLinkAction;
+ //convert the .od? target file type in a link to a .pdf type
+ //this is examined before doing anything else
+ bool ConvertOOoTargetToPDFTarget;
+ //when the file type is .pdf, force the GoToR action
+ bool ForcePDFAction;
+
+ /* decides the PDF language level to be produced */
+ PDFVersion Version;
+
+ /* PDF/UA compliance */
+ bool UniversalAccessibilityCompliance;
+
+ /* valid for PDF >= 1.4
+ causes the MarkInfo entry in the document catalog to be set
+ */
+ bool Tagged;
+ /* determines in which format a form
+ will be submitted.
+ */
+ PDFWriter::ExportDataFormat SubmitFormat;
+ bool AllowDuplicateFieldNames;
+ /* the following data members are used to customize the PDF viewer
+ preferences
+ */
+ /* see 3.6.1 PDF v 1.4 ref*/
+ PDFWriter::PDFViewerPageMode PDFDocumentMode;
+ PDFWriter::PDFViewerAction PDFDocumentAction;
+ // in percent, valid only if PDFDocumentAction == ActionZoom
+ sal_Int32 Zoom;
+
+ /* see 8.6 PDF v 1.4 ref
+ specifies whether to hide the viewer tool
+ bars when the document is active.
+ */
+ bool HideViewerToolbar;
+ bool HideViewerMenubar;
+ bool HideViewerWindowControls;
+ bool FitWindow;
+ bool OpenInFullScreenMode;
+ bool CenterWindow;
+ bool DisplayPDFDocumentTitle;
+ PDFPageLayout PageLayout;
+ bool FirstPageLeft;
+ // initially visible page in viewer (starting with 0 for first page)
+ sal_Int32 InitialPage;
+ sal_Int32 OpenBookmarkLevels; // -1 means all levels
+
+ PDFWriter::PDFEncryptionProperties Encryption;
+ PDFWriter::PDFDocInfo DocumentInfo;
+
+ bool SignPDF;
+ OUString SignLocation;
+ OUString SignPassword;
+ OUString SignReason;
+ OUString SignContact;
+ css::lang::Locale DocumentLocale; // defines the document default language
+ sal_uInt32 DPIx, DPIy; // how to handle MapMode( MapUnit::MapPixel )
+ // 0 here specifies a default handling
+ PDFWriter::ColorMode ColorMode;
+ css::uno::Reference< css::security::XCertificate> SignCertificate;
+ OUString SignTSA;
+ /// Use reference XObject markup for PDF images.
+ bool UseReferenceXObject;
+
+ PDFWriterContext() :
+ RelFsys( false ), //i56629, i49415?, i64585?
+ DefaultLinkAction( PDFWriter::URIAction ),
+ ConvertOOoTargetToPDFTarget( false ),
+ ForcePDFAction( false ),
+ Version( PDFWriter::PDFVersion::PDF_1_6 ),
+ UniversalAccessibilityCompliance( false ),
+ Tagged( false ),
+ SubmitFormat( PDFWriter::FDF ),
+ AllowDuplicateFieldNames( false ),
+ PDFDocumentMode( PDFWriter::ModeDefault ),
+ PDFDocumentAction( PDFWriter::ActionDefault ),
+ Zoom( 100 ),
+ HideViewerToolbar( false ),
+ HideViewerMenubar( false ),
+ HideViewerWindowControls( false ),
+ FitWindow( false ),
+ OpenInFullScreenMode( false ),
+ CenterWindow( false ),
+ DisplayPDFDocumentTitle( true ),
+ PageLayout( PDFWriter::DefaultLayout ),
+ FirstPageLeft( false ),
+ InitialPage( 1 ),
+ OpenBookmarkLevels( -1 ),
+ SignPDF( false ),
+ DPIx( 0 ),
+ DPIy( 0 ),
+ ColorMode( PDFWriter::DrawColor ),
+ UseReferenceXObject( false )
+ {}
+ };
+
+ PDFWriter( const PDFWriterContext& rContext, const css::uno::Reference< css::beans::XMaterialHolder >& );
+ ~PDFWriter();
+
+ /** Returns an OutputDevice for formatting
+ This Output device is guaranteed to use the same
+ font metrics as the resulting PDF file.
+
+ @returns
+ the reference output device
+ */
+ OutputDevice* GetReferenceDevice();
+
+ /** Creates a new page to fill
+ If width and height are not set the page size
+ is inherited from the page tree
+ other effects:
+ resets the graphics state: MapMode, Font
+ Colors and other state information MUST
+ be set again or are undefined.
+ */
+ void NewPage( double nPageWidth, double nPageHeight, Orientation eOrientation = Orientation::Inherit );
+ /** Play a metafile like an outputdevice would do
+ */
+ struct PlayMetafileContext
+ {
+ int m_nMaxImageResolution;
+ bool m_bOnlyLosslessCompression;
+ int m_nJPEGQuality;
+ bool m_bTransparenciesWereRemoved;
+
+ PlayMetafileContext()
+ : m_nMaxImageResolution( 0 )
+ , m_bOnlyLosslessCompression( false )
+ , m_nJPEGQuality( 90 )
+ , m_bTransparenciesWereRemoved( false )
+ {}
+
+ };
+ void PlayMetafile( const GDIMetaFile&, const PlayMetafileContext&, vcl::PDFExtOutDevData* pDevDat = nullptr );
+
+ /* sets the document locale originally passed with the context to a new value
+ * only affects the output if used before calling Emit.
+ */
+ void SetDocumentLocale( const css::lang::Locale& rDocLocale );
+
+ /* finishes the file */
+ bool Emit();
+
+ /*
+ * Get a list of errors that occurred during processing
+ * this should enable the producer to give feedback about
+ * any anomalies that might have occurred
+ */
+ std::set< ErrorCode > const & GetErrors() const;
+
+ // uses 128bit encryption
+ static css::uno::Reference< css::beans::XMaterialHolder >
+ InitEncryption( const OUString& i_rOwnerPassword,
+ const OUString& i_rUserPassword
+ );
+
+ /* functions for graphics state */
+ /* flag values: see vcl/outdev.hxx */
+ void Push( PushFlags nFlags = PushFlags::ALL );
+ void Pop();
+
+ void SetClipRegion();
+ void SetClipRegion( const basegfx::B2DPolyPolygon& rRegion );
+ void MoveClipRegion( tools::Long nHorzMove, tools::Long nVertMove );
+ void IntersectClipRegion( const tools::Rectangle& rRect );
+ void IntersectClipRegion( const basegfx::B2DPolyPolygon& rRegion );
+
+ void SetLayoutMode( vcl::text::ComplexTextLayoutFlags nMode );
+ void SetDigitLanguage( LanguageType eLang );
+
+ void SetLineColor( const Color& rColor );
+ void SetLineColor() { SetLineColor( COL_TRANSPARENT ); }
+
+ void SetFillColor( const Color& rColor );
+ void SetFillColor() { SetFillColor( COL_TRANSPARENT ); }
+
+ void SetFont( const vcl::Font& rNewFont );
+ void SetTextColor( const Color& rColor );
+ void SetTextFillColor();
+ void SetTextFillColor( const Color& rColor );
+
+ void SetTextLineColor();
+ void SetTextLineColor( const Color& rColor );
+ void SetOverlineColor();
+ void SetOverlineColor( const Color& rColor );
+ void SetTextAlign( ::TextAlign eAlign );
+
+ void SetMapMode( const MapMode& rNewMapMode );
+
+
+ /* actual drawing functions */
+ void DrawText( const Point& rPos, const OUString& rText );
+
+ void DrawTextLine( const Point& rPos, tools::Long nWidth,
+ FontStrikeout eStrikeout,
+ FontLineStyle eUnderline,
+ FontLineStyle eOverline );
+ void DrawTextArray( const Point& rStartPt, const OUString& rStr,
+ o3tl::span<const sal_Int32> pDXAry,
+ sal_Int32 nIndex,
+ sal_Int32 nLen );
+ void DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
+ const OUString& rStr,
+ sal_Int32 nIndex, sal_Int32 nLen );
+ void DrawText( const tools::Rectangle& rRect,
+ const OUString& rStr, DrawTextFlags nStyle );
+
+ void DrawPixel( const Point& rPt, const Color& rColor );
+ void DrawPixel( const Point& rPt )
+ { DrawPixel( rPt, COL_TRANSPARENT ); }
+
+ void DrawLine( const Point& rStartPt, const Point& rEndPt );
+ void DrawLine( const Point& rStartPt, const Point& rEndPt,
+ const LineInfo& rLineInfo );
+ void DrawPolyLine( const tools::Polygon& rPoly );
+ void DrawPolyLine( const tools::Polygon& rPoly,
+ const LineInfo& rLineInfo );
+ void DrawPolyLine( const tools::Polygon& rPoly, const ExtLineInfo& rInfo );
+ void DrawPolygon( const tools::Polygon& rPoly );
+ void DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly );
+ void DrawRect( const tools::Rectangle& rRect );
+ void DrawRect( const tools::Rectangle& rRect,
+ sal_uLong nHorzRount, sal_uLong nVertRound );
+ void DrawEllipse( const tools::Rectangle& rRect );
+ void DrawArc( const tools::Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt );
+ void DrawPie( const tools::Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt );
+ void DrawChord( const tools::Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt );
+
+ void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
+ const Bitmap& rBitmap, const Graphic& rGraphic );
+
+ void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
+ const BitmapEx& rBitmapEx );
+
+ void DrawGradient( const tools::Rectangle& rRect, const Gradient& rGradient );
+ void DrawGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient );
+
+ void DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch );
+
+ void DrawWallpaper( const tools::Rectangle& rRect, const Wallpaper& rWallpaper );
+ void DrawTransparent( const tools::PolyPolygon& rPolyPoly,
+ sal_uInt16 nTransparencePercent );
+
+ /** Start a transparency group
+
+ Drawing operations can be grouped together to acquire a common transparency
+ behaviour; after calling BeginTransparencyGroup all drawing
+ operations will be grouped together into a transparent object.
+
+ The transparency behaviour is set with one of the EndTransparencyGroup
+ calls and can be either a constant transparency factor or a transparent
+ soft mask in form of an 8 bit gray scale bitmap.
+
+ It is permissible to nest transparency group.
+
+ Transparency groups MUST NOT span multiple pages
+
+ Transparency is a feature introduced in PDF1.4, so transparency group
+ will be ignored if the produced PDF has a lower version. The drawing
+ operations will be emitted normally.
+ */
+ void BeginTransparencyGroup();
+
+ /** End a transparency group with constant transparency factor
+
+ This ends a transparency group and inserts it on the current page. The
+ coordinates of the group result out of the grouped drawing operations.
+
+ @param rBoundRect
+ The bounding rectangle of the group
+
+ @param nTransparencePercent
+ The transparency factor
+ */
+ void EndTransparencyGroup( const tools::Rectangle& rBoundRect, sal_uInt16 nTransparencePercent );
+
+ /** Insert a JPG encoded image (optionally with mask)
+
+ @param rJPGData
+ a Stream containing the encoded image
+
+ @param bIsTrueColor
+ true: jpeg is 24 bit true color, false: jpeg is 8 bit greyscale
+
+ @param rSrcSizePixel
+ size in pixel of the image
+
+ @param rTargetArea
+ where to put the image
+
+ @param rMask
+ optional mask; if not empty it must have
+ the same pixel size as the image and
+ be either 1 bit black&white or 8 bit grey
+ */
+ void DrawJPGBitmap( SvStream& rJPGData, bool bIsTrueColor, const Size& rSrcSizePixel, const tools::Rectangle& rTargetArea, const AlphaMask& rAlphaMask, const Graphic& rGraphic );
+
+ /** Create a new named destination to be used in a link from another PDF document
+
+ @param sDestName
+ the name (label) of the bookmark, to be used to jump to
+
+ @param rRect
+ target rectangle on page to be displayed if dest is jumped to
+
+ @param nPageNr
+ number of page the dest is on (as returned by NewPage)
+ or -1 in which case the current page is used
+
+ @param eType
+ what dest type to use
+
+ @returns
+ the destination id (to be used in SetLinkDest) or
+ -1 if page id does not exist
+ */
+ sal_Int32 CreateNamedDest( const OUString& sDestName, const tools::Rectangle& rRect, sal_Int32 nPageNr, DestAreaType eType );
+ /** Create a new destination to be used in a link
+
+ @param rRect
+ target rectangle on page to be displayed if dest is jumped to
+
+ @param nPageNr
+ number of page the dest is on (as returned by NewPage)
+ or -1 in which case the current page is used
+
+ @param eType
+ what dest type to use
+
+ @returns
+ the destination id (to be used in SetLinkDest) or
+ -1 if page id does not exist
+ */
+ sal_Int32 CreateDest( const tools::Rectangle& rRect, sal_Int32 nPageNr, DestAreaType eType );
+ /** Create a new link on a page
+
+ @param rRect
+ active rectangle of the link (that is the area that has to be
+ hit to activate the link)
+
+ @param nPageNr
+ number of page the link is on (as returned by NewPage)
+ or -1 in which case the current page is used
+
+ @returns
+ the link id (to be used in SetLinkDest, SetLinkURL) or
+ -1 if page id does not exist
+ */
+ sal_Int32 CreateLink(const tools::Rectangle& rRect, sal_Int32 nPageNr, OUString const& rAltText);
+
+ /// Creates a screen annotation.
+ sal_Int32 CreateScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr);
+
+ /** creates a destination which is not intended to be referred to by a link, but by a public destination Id.
+
+ Form widgets, for instance, might refer to a destination, without ever actually creating a source link to
+ point to this destination. In such cases, a public destination Id will be assigned to the form widget,
+ and later on, the concrete destination data for this public Id will be registered using RegisterDestReference.
+
+ @param nDestId
+ destination ID
+
+ @param rRect
+ target rectangle on page to be displayed if dest is jumped to
+
+ @param nPageNr
+ number of page the dest is on (as returned by NewPage)
+ or -1 in which case the current page is used
+
+ @param eType
+ what dest type to use
+
+ @returns
+ the internal destination Id.
+ */
+ sal_Int32 RegisterDestReference( sal_Int32 nDestId, const tools::Rectangle& rRect, sal_Int32 nPageNr, DestAreaType eType );
+
+
+ /** Set the destination for a link
+ will change a URL type link to a dest link if necessary
+
+ @param nLinkId
+ the link to be changed
+
+ @param nDestId
+ the dest the link shall point to
+ */
+ void SetLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId );
+ /** Set the URL for a link
+ will change a dest type link to a URL type link if necessary
+ @param nLinkId
+ the link to be changed
+
+ @param rURL
+ the URL the link shall point to.
+ The URL will be parsed (and corrected) by the com.sun.star.util.URLTransformer
+ service; the result will then appear literally in the PDF file produced
+ */
+ void SetLinkURL( sal_Int32 nLinkId, const OUString& rURL );
+
+ /// Sets the URL of a linked screen annotation.
+ void SetScreenURL(sal_Int32 nScreenId, const OUString& rURL);
+ /// Sets the URL of an embedded screen annotation.
+ void SetScreenStream(sal_Int32 nScreenId, const OUString& rURL);
+
+ /** Resolve link in logical structure
+
+ If a link is created after the corresponding visual appearance was drawn
+ it is not possible to set the link id as a property attribute to the
+ link structure item that should be created in tagged PDF around the
+ visual appearance of a link.
+
+ For this reason an arbitrary id can be given to
+ SetStructureAttributeNumerical at the time the text for
+ the link is drawn. To resolve this arbitrary id again when the actual
+ link annotation is created use SetLinkPropertyID. When Emit
+ finally gets called all LinkAnnotation type structure attributes
+ will be replaced with the correct link id.
+
+ CAUTION: this technique must be used either for all or none of the links
+ in a document since the link id space and arbitrary property id space
+ could overlap and it would be impossible to resolve whether a Link
+ structure attribute value was arbitrary or already a real id.
+
+ @param nLinkId
+ the link to be mapped
+
+ @param nPropertyID
+ the arbitrary id set in a Link structure element to address
+ the link with real id nLinkId
+ */
+ void SetLinkPropertyID( sal_Int32 nLinkId, sal_Int32 nPropertyID );
+ /** Create a new outline item
+
+ @param nParent
+ declares the parent of the new item in the outline hierarchy.
+ An invalid value will result in a new toplevel item.
+
+ @param rText
+ sets the title text of the item
+
+ @param nDestID
+ declares which Dest (created with CreateDest) the outline item
+ will point to
+
+ @returns
+ the outline item id of the new item
+ */
+ sal_Int32 CreateOutlineItem( sal_Int32 nParent, std::u16string_view rText, sal_Int32 nDestID );
+
+ /** Create a new note on a page
+
+ @param rRect
+ active rectangle of the note (that is the area that has to be
+ hit to popup the annotation)
+
+ @param rNote
+ specifies the contents of the note
+
+ @param nPageNr
+ number of page the note is on (as returned by NewPage)
+ or -1 in which case the current page is used
+ */
+ void CreateNote( const tools::Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr );
+
+ /** begin a new logical structure element
+
+ BeginStructureElement/EndStructureElement calls build the logical structure
+ of the PDF - the basis for tagged PDF. Structural elements are implemented
+ using marked content tags. Each structural element can contain sub elements
+ (e.g. a section can contain a heading and a paragraph). The structure hierarchy
+ is build automatically from the Begin/EndStructureElement calls.
+
+ A structural element need not be contained on one page; e.g. paragraphs often
+ run from one page to the next. In this case the corresponding EndStructureElement
+ must be called while drawing the next page.
+
+ BeginStructureElement and EndStructureElement must be called only after
+ PDFWriter::NewPage has been called and before PDFWriter::Emit gets called. The
+ current page number is an implicit context parameter for Begin/EndStructureElement.
+
+ For pagination artifacts that are not part of the logical structure
+ of the document (like header, footer or page number) the special
+ StructElement NonStructElement exists. To place content
+ outside of the structure tree simply call
+ BeginStructureElement( NonStructElement ) then draw your
+ content and then call EndStructureElement(). All children
+ of a NonStructElement will not be part of the structure.
+ Nonetheless if you add a child structural element to a
+ NonStructElement you will still have to call
+ EndStructureElement for it. Best think of the structure
+ tree as a stack.
+
+ Note: there is always one structural element in existence without having
+ called BeginStructureElement; this is the root of the structure
+ tree (called StructTreeRoot). The StructTreeRoot has always the id 0.
+
+ @param eType
+ denotes what kind of element to begin (e.g. a heading or paragraph)
+
+ @param rAlias
+ the specified alias will be used as structure tag. Also an entry in the PDF's
+ role map will be created mapping alias to regular structure type.
+
+ @returns
+ the new structure element's id for use in SetCurrentStructureElement
+ */
+ sal_Int32 BeginStructureElement( enum StructElement eType, const OUString& rAlias );
+ /** end the current logical structure element
+
+ Close the current structure element. The current element's
+ parent becomes the current structure element again.
+
+ @see BeginStructureElement
+ */
+ void EndStructureElement();
+ /** set the current structure element
+
+ For different purposes it may be useful to paint a structure element's
+ content discontinuously. In that case an already existing structure element
+ can be appended to by using SetCurrentStructureElement. The
+ referenced structure element becomes the current structure element with
+ all consequences: all following structure elements are appended as children
+ of the current element.
+
+ @param nElement
+ the id of the new current structure element
+ */
+ void SetCurrentStructureElement( sal_Int32 nElement );
+
+ /** set a structure attribute on the current structural element
+
+ SetStructureAttribute sets an attribute of the current structural element to a
+ new value. A consistency check is performed before actually setting the value;
+ if the check fails, the function returns False and the attribute remains
+ unchanged.
+
+ @param eAttr
+ denotes what attribute to change
+
+ @param eVal
+ the value to set the attribute to
+ */
+ void SetStructureAttribute( enum StructAttribute eAttr, enum StructAttributeValue eVal );
+ /** set a structure attribute on the current structural element
+
+ SetStructureAttributeNumerical sets an attribute of the current structural element
+ to a new numerical value. A consistency check is performed before actually setting
+ the value; if the check fails, the function returns False and the attribute
+ remains unchanged.
+
+ @param eAttr
+ denotes what attribute to change
+
+ @param nValue
+ the value to set the attribute to
+ */
+ void SetStructureAttributeNumerical( enum StructAttribute eAttr, sal_Int32 nValue );
+ /** set the bounding box of a structural element
+
+ SetStructureBoundingBox sets the BBox attribute to a new value. Since the BBox
+ attribute can only be applied to Table, Figure,
+ Form and Formula elements, a call of this function
+ for other element types will be ignored and the BBox attribute not be set.
+
+ @param rRect
+ the new bounding box for the structural element
+ */
+ void SetStructureBoundingBox( const tools::Rectangle& rRect );
+
+ /** set the ActualText attribute of a structural element
+
+ ActualText contains the Unicode text without layout artifacts that is shown by
+ a structural element. For example if a line is ended prematurely with a break in
+ a word and continued on the next line (e.g. "happen-<newline>stance") the
+ corresponding ActualText would contain the unbroken line (e.g. "happenstance").
+
+ @param rText
+ contains the complete logical text the structural element displays.
+ */
+ void SetActualText( const OUString& rText );
+
+ /** set the Alt attribute of a strutural element
+
+ Alt is s replacement text describing the contents of a structural element. This
+ is mainly used by accessibility applications; e.g. a screen reader would read
+ the Alt replacement text for an image to a visually impaired user.
+
+ @param rText
+ contains the replacement text for the structural element
+ */
+ void SetAlternateText( const OUString& rText );
+
+ /** Sets the transitional effect to be applied when the current page gets shown.
+
+ @param eType
+ the kind of effect to be used; use Regular to disable transitional effects
+ for this page
+
+ @param nMilliSec
+ the duration of the transitional effect in milliseconds;
+ set 0 to disable transitional effects
+
+ @param nPageNr
+ the page number to apply the effect to; -1 denotes the current page
+ */
+ void SetPageTransition( PageTransition eType, sal_uInt32 nMilliSec, sal_Int32 nPageNr );
+
+ /** create a new form control
+
+ This function creates a new form control in the PDF and sets its various
+ properties. Do not pass an actual AnyWidget as rControlType
+ will be cast to the type described by the type member.
+
+ @param rControlType
+ a descendant of AnyWidget determining the control's properties
+
+ @returns
+ the new control's id for reference purposes
+ */
+ sal_Int32 CreateControl( const AnyWidget& rControlType );
+
+ /** Inserts an additional stream to the PDF file
+
+ This function adds an arbitrary stream to the produced PDF file. May be called
+ any time before Emit(). The stream will be written during
+ Emit by calling the PDFOutputStream Object's write
+ method. After the call the PDFOutputStream will be deleted.
+
+ All additional streams and their mimetypes will be entered into an array
+ in the trailer dictionary.
+
+ @param rMimeType
+ the mimetype of the stream
+
+ @param pStream
+ the interface to the additional stream
+
+ */
+ void AddStream( const OUString& rMimeType, PDFOutputStream* pStream );
+
+ /// Write rString as a PDF hex string into rBuffer.
+ static void AppendUnicodeTextString(const OUString& rString, OStringBuffer& rBuffer);
+
+ /// Get current date/time in PDF D:YYYYMMDDHHMMSS form.
+ static OString GetDateTime();
+};
+
+VCL_DLLPUBLIC void escapeStringXML( const OUString& rStr, OUString &rValue);
+
+}
+
+#endif // INCLUDED_VCL_PDFWRITER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/pngwrite.hxx b/include/vcl/pngwrite.hxx
new file mode 100644
index 000000000..de2b1c6e1
--- /dev/null
+++ b/include/vcl/pngwrite.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_PNGWRITE_HXX
+#define INCLUDED_VCL_PNGWRITE_HXX
+
+#include <vcl/dllapi.h>
+#include <memory>
+#include <vector>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+
+class BitmapEx;
+class SvStream;
+
+namespace vcl
+{
+ class PNGWriterImpl;
+
+ class VCL_DLLPUBLIC PNGWriter
+ {
+ const std::unique_ptr<PNGWriterImpl> mpImpl;
+
+ public:
+
+ explicit PNGWriter(const BitmapEx&, const css::uno::Sequence<css::beans::PropertyValue>* pFilterData = nullptr);
+ ~PNGWriter();
+
+ bool Write(SvStream& rStream);
+
+ // additional method to be able to modify all chunk before they are stored
+ struct ChunkData
+ {
+ sal_uInt32 nType;
+ std::vector<sal_uInt8> aData;
+ };
+ std::vector<vcl::PNGWriter::ChunkData>& GetChunks();
+ };
+}
+
+#endif // INCLUDED_VCL_PNGWRITE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
new file mode 100644
index 000000000..e919b8ee2
--- /dev/null
+++ b/include/vcl/print.hxx
@@ -0,0 +1,615 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_PRINT_HXX
+#define INCLUDED_VCL_PRINT_HXX
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <tools/gen.hxx>
+#include <tools/long.hxx>
+#include <i18nutil/paper.hxx>
+
+#include <vcl/dllapi.h>
+#include <vcl/PrinterSupport.hxx>
+#include <vcl/errcode.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/prntypes.hxx>
+#include <vcl/region.hxx>
+#include <vcl/jobset.hxx>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/view/PrintableState.hpp>
+
+#include <memory>
+#include <unordered_map>
+
+class GDIMetaFile;
+class SalInfoPrinter;
+struct SalPrinterQueueInfo;
+class QueueInfo;
+class SalPrinter;
+class VirtualDevice;
+enum class SalPrinterError;
+
+namespace vcl {
+ class PrinterController;
+
+ namespace printer {
+ class Options;
+ }
+}
+
+namespace weld { class Window; }
+
+class VCL_DLLPUBLIC Printer : public OutputDevice
+{
+ friend class ::OutputDevice;
+
+private:
+ SalInfoPrinter* mpInfoPrinter;
+ std::unique_ptr<SalPrinter> mpPrinter;
+ SalGraphics* mpJobGraphics;
+ VclPtr<Printer> mpPrev;
+ VclPtr<Printer> mpNext;
+ VclPtr<VirtualDevice> mpDisplayDev;
+ std::unique_ptr<vcl::printer::Options> mpPrinterOptions;
+ OUString maPrinterName;
+ OUString maDriver;
+ OUString maPrintFile;
+ JobSetup maJobSetup;
+ Point maPageOffset;
+ Size maPaperSize;
+ ErrCode mnError;
+ sal_uInt16 mnPageQueueSize;
+ sal_uInt16 mnCopyCount;
+ bool mbDefPrinter;
+ bool mbPrinting;
+ bool mbJobActive;
+ bool mbCollateCopy;
+ bool mbPrintFile;
+ bool mbInPrintPage;
+ bool mbNewJobSetup;
+ bool mbSinglePrintJobs;
+
+ VCL_DLLPRIVATE void ImplInitData();
+ VCL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo );
+ VCL_DLLPRIVATE void ImplInitDisplay();
+ VCL_DLLPRIVATE static SalPrinterQueueInfo*
+ ImplGetQueueInfo( const OUString& rPrinterName, const OUString* pDriver );
+ VCL_DLLPRIVATE void ImplUpdatePageData();
+ VCL_DLLPRIVATE void ImplUpdateFontList();
+ VCL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup& );
+
+ VCL_DLLPRIVATE bool StartJob( const OUString& rJobName, std::shared_ptr<vcl::PrinterController> const & );
+
+ static VCL_DLLPRIVATE ErrCode
+ ImplSalPrinterErrorCodeToVCL( SalPrinterError nError );
+
+ SAL_DLLPRIVATE void ImplPrintTransparent (
+ const Bitmap& rBmp, const Bitmap& rMask,
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel );
+
+private:
+ VCL_DLLPRIVATE void EndJob();
+ Printer( const Printer& rPrinter ) = delete;
+ Printer& operator =( const Printer& rPrinter ) = delete;
+
+public:
+ VCL_DLLPRIVATE void ImplStartPage();
+ VCL_DLLPRIVATE void ImplEndPage();
+
+protected:
+ virtual bool AcquireGraphics() const override;
+ virtual void ReleaseGraphics( bool bRelease = true ) override;
+ void ImplReleaseGraphics(bool bRelease = true);
+ virtual void ImplReleaseFonts() override;
+
+ virtual tools::Long GetGradientStepCount( tools::Long nMinRect ) override;
+ virtual bool UsePolyPolygonForComplexGradient() override;
+ virtual void ClipAndDrawGradientMetafile ( const Gradient &rGradient,
+ const tools::PolyPolygon &rPolyPoly ) override;
+
+ bool CanSubsampleBitmap() const override { return false; }
+ vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const override;
+
+public:
+ void SetSystemTextColor(SystemTextColorFlags, bool) override;
+ void DrawGradientEx( OutputDevice* pOut, const tools::Rectangle& rRect,
+ const Gradient& rGradient );
+ virtual Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const override;
+ virtual Size GetButtonBorderSize() override;
+ virtual Color GetMonochromeButtonColor() override { return COL_LIGHTGRAY; }
+
+ bool IsScreenComp() const override { return false; }
+
+ void DrawBorder(tools::Rectangle aBorderRect) override
+ {
+ SetLineColor(COL_BLACK);
+ DrawRect(aBorderRect);
+ }
+
+ css::awt::DeviceInfo GetDeviceInfo() const override;
+
+protected:
+ virtual void DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel) override;
+
+ bool DrawTransformBitmapExDirect( const basegfx::B2DHomMatrix& aFullTransform,
+ const BitmapEx& rBitmapEx, double fAlpha = 1.0) override;
+
+ bool TransformAndReduceBitmapExToTargetRange( const basegfx::B2DHomMatrix& aFullTransform,
+ basegfx::B2DRange &aVisibleRange, double &fMaximumArea) override;
+
+ void DrawDeviceBitmapEx( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel,
+ BitmapEx& rBitmapEx ) override;
+
+ virtual void EmulateDrawTransparent( const tools::PolyPolygon& rPolyPoly,
+ sal_uInt16 nTransparencePercent ) override;
+
+ virtual void SetFontOrientation( LogicalFontInstance* const pFontInstance ) const override;
+
+ bool shouldDrawWavePixelAsRect(tools::Long) const override { return true; }
+ void SetWaveLineColors(Color const& rColor, tools::Long) override;
+ Size GetWaveLineSize(tools::Long nLineWidth) const override;
+
+public:
+ Printer();
+ Printer( const JobSetup& rJobSetup );
+ Printer( const QueueInfo& rQueueInfo );
+ Printer( const OUString& rPrinterName );
+ virtual ~Printer() override;
+ virtual void dispose() override;
+
+ virtual void SetMetafileMapMode(const MapMode& rNewMapMode, bool) override { SetMapMode(rNewMapMode); }
+
+ static const std::vector< OUString >&
+ GetPrinterQueues();
+ static const QueueInfo* GetQueueInfo( const OUString& rPrinterName, bool bStatusUpdate );
+ static OUString GetDefaultPrinterName();
+
+ const OUString& GetName() const { return maPrinterName; }
+ const OUString& GetDriverName() const { return maDriver; }
+ bool IsDefPrinter() const { return mbDefPrinter; }
+ bool IsDisplayPrinter() const { return mpDisplayDev != nullptr; }
+ bool IsValid() const { return !IsDisplayPrinter(); }
+
+ sal_uInt32 GetCapabilities( PrinterCapType nType ) const;
+ bool HasSupport( PrinterSupport eFeature ) const;
+
+ bool SetJobSetup( const JobSetup& rSetup );
+ const JobSetup& GetJobSetup() const { return maJobSetup; }
+
+ bool Setup(weld::Window* pWindow,
+ PrinterSetupMode eMode = PrinterSetupMode::DocumentGlobal);
+ bool SetPrinterProps( const Printer* pPrinter );
+
+ Color GetBackgroundColor() const override { return COL_WHITE; }
+ Color GetReadableFontColor(const Color&, const Color&) const override { return COL_BLACK; }
+
+ /** SetPrinterOptions is used internally only now
+
+ in earlier times it was used only to set the options loaded directly from the configuration
+ in SfxPrinter::InitJob, this is now handled internally
+ should the need arise to set the printer options outside vcl, also a method would have to be devised
+ to not override these again internally
+ */
+ VCL_DLLPRIVATE void SetPrinterOptions( const vcl::printer::Options& rOptions );
+ const vcl::printer::Options& GetPrinterOptions() const { return( *mpPrinterOptions ); }
+
+ bool SetOrientation( Orientation eOrient );
+ Orientation GetOrientation() const;
+ void SetDuplexMode( DuplexMode );
+ DuplexMode GetDuplexMode() const;
+
+ bool SetPaperBin( sal_uInt16 nPaperBin );
+ sal_uInt16 GetPaperBin() const;
+ void SetPaper( Paper ePaper );
+ bool SetPaperSizeUser( const Size& rSize );
+ /** @return The paper format of the printer's current "jobsetup". Note that if PAPER_USER the actual size can be anything. */
+ Paper GetPaper() const;
+ /** @return Size of the paper of the printer's current "jobsetup". */
+ Size GetSizeOfPaper() const;
+ static OUString GetPaperName( Paper ePaper );
+
+ /** @return Number of available paper formats */
+ int GetPaperInfoCount() const;
+
+ /** @return Info about paper format nPaper */
+ const PaperInfo& GetPaperInfo( int nPaper ) const;
+ sal_uInt16 GetPaperBinCount() const;
+ OUString GetPaperBinName( sal_uInt16 nPaperBin ) const;
+
+ bool GetPrinterSettingsPreferred() const;
+ void SetPrinterSettingsPreferred( bool bPaperSizeFromSetup );
+
+ const Size& GetPaperSizePixel() const { return maPaperSize; }
+ Size GetPaperSize() const { return PixelToLogic( maPaperSize ); }
+ Size GetPaperSize( int nPaper ) const;
+ const Point& GetPageOffsetPixel() const { return maPageOffset; }
+ Point GetPageOffset() const { return PixelToLogic( maPageOffset ); }
+
+ void SetCopyCount( sal_uInt16 nCopy, bool bCollate );
+ sal_uInt16 GetCopyCount() const { return mnCopyCount; }
+ bool IsCollateCopy() const { return mbCollateCopy; }
+ void SetSinglePrintJobs(bool bSinglePrintJobs) { mbSinglePrintJobs = bSinglePrintJobs; }
+ bool IsSinglePrintJobs() const { return mbSinglePrintJobs; }
+
+ bool IsPrinting() const { return mbPrinting; }
+
+ bool IsJobActive() const { return mbJobActive; }
+
+ /** Checks the printer list and updates it necessary
+
+ sends a DataChanged event of type DataChangedEventType::PRINTER if the printer list changed
+ */
+ static void updatePrinters();
+
+ /** Execute a print job
+
+ starts a print job asynchronously that is will return
+ */
+ static void PrintJob( const std::shared_ptr<vcl::PrinterController>& i_pController,
+ const JobSetup& i_rInitSetup );
+
+ virtual bool HasMirroredGraphics() const override;
+
+ virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPt, const Size& rSrcSize ) override;
+
+ virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPt, const Size& rSrcSize,
+ const OutputDevice& rOutDev ) override;
+
+ virtual void CopyArea( const Point& rDestPt, const Point& rSrcPt,
+ const Size& rSrcSize, bool bWindowInvalidate = false ) override;
+
+ virtual tools::Rectangle GetBackgroundComponentBounds() const override;
+
+ // These 3 together are more modular PrintJob(), allowing printing more documents as one print job
+ // by repeated calls to ExecutePrintJob(). Used by mailmerge.
+ static bool PreparePrintJob( std::shared_ptr<vcl::PrinterController> i_pController,
+ const JobSetup& i_rInitSetup );
+ static bool ExecutePrintJob(const std::shared_ptr<vcl::PrinterController>& i_pController);
+ static void FinishPrintJob( const std::shared_ptr<vcl::PrinterController>& i_pController );
+
+ /** Implementation detail of PrintJob being asynchronous
+
+ not exported, not usable outside vcl
+ */
+ static void VCL_DLLPRIVATE ImplPrintJob( const std::shared_ptr<vcl::PrinterController>& i_pController,
+ const JobSetup& i_rInitSetup );
+};
+
+namespace vcl
+{
+class ImplPrinterControllerData;
+
+enum class NupOrderType
+{
+ LRTB, TBLR, TBRL, RLTB
+};
+
+class VCL_DLLPUBLIC PrinterController
+{
+ std::unique_ptr<ImplPrinterControllerData>
+ mpImplData;
+protected:
+ PrinterController(const VclPtr<Printer>&, weld::Window* pDialogParent);
+public:
+ struct MultiPageSetup
+ {
+ // all metrics in 100th mm
+ int nRows;
+ int nColumns;
+ Size aPaperSize;
+ tools::Long nLeftMargin;
+ tools::Long nTopMargin;
+ tools::Long nRightMargin;
+ tools::Long nBottomMargin;
+ tools::Long nHorizontalSpacing;
+ tools::Long nVerticalSpacing;
+ bool bDrawBorder;
+ NupOrderType nOrder;
+
+ MultiPageSetup()
+ : nRows( 1 ), nColumns( 1 ), aPaperSize( 21000, 29700 )
+ , nLeftMargin( 0 ), nTopMargin( 0 )
+ , nRightMargin( 0 ), nBottomMargin( 0 )
+ , nHorizontalSpacing( 0 ), nVerticalSpacing( 0 )
+ , bDrawBorder( false )
+ , nOrder( NupOrderType::LRTB ) {}
+ };
+
+ struct PageSize
+ {
+ /// In 100th mm
+ Size aSize;
+
+ /// Full paper, not only imageable area is printed
+ bool bFullPaper;
+
+ PageSize( const Size& i_rSize = Size( 21000, 29700 ),
+ bool i_bFullPaper = false)
+ : aSize( i_rSize ), bFullPaper( i_bFullPaper ) {}
+ };
+
+ virtual ~PrinterController();
+
+ const VclPtr<Printer>& getPrinter() const;
+ weld::Window* getWindow() const;
+
+ /** For implementations: get current job properties as changed by e.g. print dialog
+
+ this gets the current set of properties initially told to Printer::PrintJob
+
+ For convenience a second sequence will be merged in to get a combined sequence.
+ In case of duplicate property names, the value of i_MergeList wins.
+ */
+ css::uno::Sequence< css::beans::PropertyValue >
+ getJobProperties(const css::uno::Sequence< css::beans::PropertyValue >& i_rMergeList ) const;
+
+ /// Get the PropertyValue of a Property
+ css::beans::PropertyValue* getValue( const OUString& i_rPropertyName );
+ const css::beans::PropertyValue* getValue( const OUString& i_rPropertyName ) const;
+
+ /** Get a bool property
+
+ in case the property is unknown or not convertible to bool, i_bFallback is returned
+ */
+ bool getBoolProperty( const OUString& i_rPropertyName, bool i_bFallback ) const;
+
+ /** Get an int property
+
+ in case the property is unknown or not convertible to bool, i_nFallback is returned
+ */
+ sal_Int32 getIntProperty( const OUString& i_rPropertyName, sal_Int32 i_nFallback ) const;
+
+ /// Set a property value - can also be used to add another UI property
+ void setValue( const OUString& i_rPropertyName, const css::uno::Any& i_rValue );
+ void setValue( const css::beans::PropertyValue& i_rValue );
+
+ /** @return The currently active UI options. These are the same that were passed to setUIOptions. */
+ const css::uno::Sequence< css::beans::PropertyValue >&
+ getUIOptions() const;
+
+ /** Set possible UI options.
+
+ should only be done once before passing the PrinterListener to Printer::PrintJob
+ */
+ void setUIOptions( const css::uno::Sequence< css::beans::PropertyValue >& );
+
+ /// Enable/disable an option; this can be used to implement dialog logic.
+ bool isUIOptionEnabled( const OUString& rPropName ) const;
+ bool isUIChoiceEnabled( const OUString& rPropName, sal_Int32 nChoice ) const;
+
+ /** MakeEnabled will change the property rPropName depends on to the value
+
+ that makes rPropName enabled. If the dependency itself is also disabled,
+ no action will be performed.
+
+ @return The property name rPropName depends on or an empty string if no change was made.
+ */
+ OUString makeEnabled( const OUString& rPropName );
+
+ /// App must override this
+ virtual int getPageCount() const = 0;
+
+ /** Get the page parameters
+
+ namely the jobsetup that should be active for the page
+ (describing among others the physical page size) and the "page size". In writer
+ case this would probably be the same as the JobSetup since writer sets the page size
+ draw/impress for example print their page on the paper set on the printer,
+ possibly adjusting the page size to fit. That means the page size can be different from
+ the paper size.
+
+ App must override this
+
+ @return Page size in 1/100th mm
+ */
+ virtual css::uno::Sequence< css::beans::PropertyValue >
+ getPageParameters( int i_nPage ) const = 0;
+ /// App must override this
+ virtual void printPage(int i_nPage) const = 0;
+
+ /// Will be called after a possible dialog has been shown and the real printjob starts
+ virtual void jobStarted();
+ virtual void jobFinished( css::view::PrintableState );
+
+ css::view::PrintableState getJobState() const;
+
+ void abortJob();
+
+ bool isShowDialogs() const;
+ bool isDirectPrint() const;
+
+ void dialogsParentClosing();
+
+ // implementation details, not usable outside vcl
+ // don't use outside vcl. Some of these are exported for
+ // the benefit of vcl's plugins.
+ // Still: DO NOT USE OUTSIDE VCL
+ int getFilteredPageCount() const;
+ VCL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf,
+ bool i_bMayUseCache = false );
+ PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf,
+ bool i_bMayUseCache = false );
+ void printFilteredPage( int i_nPage );
+ VCL_DLLPRIVATE void setPrinter( const VclPtr<Printer>& );
+ void createProgressDialog();
+ bool isProgressCanceled() const;
+ VCL_DLLPRIVATE void setMultipage( const MultiPageSetup& );
+ VCL_DLLPRIVATE const MultiPageSetup&
+ getMultipage() const;
+ void setLastPage( bool i_bLastPage );
+ VCL_DLLPRIVATE void setReversePrint( bool i_bReverse );
+ VCL_DLLPRIVATE void setPapersizeFromSetup( bool i_bPapersizeFromSetup );
+ VCL_DLLPRIVATE bool getPapersizeFromSetup() const;
+ VCL_DLLPRIVATE void setPaperSizeFromUser( Size i_aUserSize );
+ VCL_DLLPRIVATE void setOrientationFromUser( Orientation eOrientation, bool set );
+ void setPrinterModified( bool i_bPapersizeFromSetup );
+ bool getPrinterModified() const;
+ VCL_DLLPRIVATE void pushPropertiesToPrinter();
+ VCL_DLLPRIVATE void resetPaperToLastConfigured();
+ void setJobState( css::view::PrintableState );
+ VCL_DLLPRIVATE void setupPrinter( weld::Window* i_pDlgParent );
+
+ VCL_DLLPRIVATE int getPageCountProtected() const;
+ VCL_DLLPRIVATE css::uno::Sequence< css::beans::PropertyValue >
+ getPageParametersProtected( int i_nPage ) const;
+
+ VCL_DLLPRIVATE DrawModeFlags removeTransparencies( GDIMetaFile const & i_rIn, GDIMetaFile& o_rOut );
+ VCL_DLLPRIVATE void resetPrinterOptions( bool i_bFileOutput );
+};
+
+class VCL_DLLPUBLIC PrinterOptionsHelper
+{
+protected:
+ std::unordered_map< OUString, css::uno::Any >
+ m_aPropertyMap;
+ std::vector< css::beans::PropertyValue >
+ m_aUIProperties;
+
+public:
+
+ /// Create without ui properties
+ PrinterOptionsHelper() {}
+
+ /** Process a new set of properties
+
+ merges changed properties and returns "true" if any occurred
+ */
+ bool processProperties( const css::uno::Sequence< css::beans::PropertyValue >& i_rNewProp );
+
+ /** Append to a sequence of property values the ui property sequence passed at creation
+
+ as the "ExtraPrintUIOptions" property. if that sequence was empty, no "ExtraPrintUIOptions" property
+ will be appended.
+ */
+ void appendPrintUIOptions( css::uno::Sequence< css::beans::PropertyValue >& io_rProps ) const;
+
+ /** @return An empty Any for not existing properties */
+ css::uno::Any getValue( const OUString& i_rPropertyName ) const;
+
+ bool getBoolValue( const OUString& i_rPropertyName, bool i_bDefault ) const;
+ // convenience for fixed strings
+ bool getBoolValue( const char* i_pPropName, bool i_bDefault = false ) const
+ { return getBoolValue( OUString::createFromAscii( i_pPropName ), i_bDefault ); }
+
+ sal_Int64 getIntValue( const OUString& i_rPropertyName, sal_Int64 i_nDefault ) const;
+ // convenience for fixed strings
+ sal_Int64 getIntValue( const char* i_pPropName, sal_Int64 i_nDefault ) const
+ { return getIntValue( OUString::createFromAscii( i_pPropName ), i_nDefault ); }
+
+ OUString getStringValue( const OUString& i_rPropertyName ) const;
+ // convenience for fixed strings
+ OUString getStringValue( const char* i_pPropName ) const
+ { return getStringValue( OUString::createFromAscii( i_pPropName ) ); }
+
+ // helper functions for user to create a single control
+ struct UIControlOptions
+ {
+ OUString maDependsOnName;
+ OUString maGroupHint;
+ std::vector< css::beans::PropertyValue >
+ maAddProps;
+ sal_Int32 mnDependsOnEntry;
+ bool mbAttachToDependency;
+ bool mbInternalOnly;
+ bool mbEnabled;
+
+ UIControlOptions( const OUString& i_rDependsOnName = OUString(),
+ sal_Int32 i_nDependsOnEntry = -1, bool i_bAttachToDependency = false)
+ : maDependsOnName( i_rDependsOnName )
+ , mnDependsOnEntry( i_nDependsOnEntry )
+ , mbAttachToDependency( i_bAttachToDependency )
+ , mbInternalOnly( false )
+ , mbEnabled( true ) {}
+ };
+
+ // note: in the following helper functions HelpIds are expected as an OUString
+ // the normal HelpId form is OString (byte string instead of UTF16 string)
+ // this is because the whole interface is base on UNO properties; in fact the structures
+ // are passed over UNO interfaces. UNO does not know a byte string, hence the string is
+ // transported via UTF16 strings.
+
+ /// Show general control
+ static css::uno::Any setUIControlOpt( const css::uno::Sequence< OUString >& i_rIDs, const OUString& i_rTitle,
+ const css::uno::Sequence< OUString >& i_rHelpId, const OUString& i_rType,
+ const css::beans::PropertyValue* i_pValue = nullptr,
+ const UIControlOptions& i_rControlOptions = UIControlOptions());
+
+ /// Show and set the title of a TagPage of id i_rID
+ static css::uno::Any setGroupControlOpt( const OUString& i_rID, const OUString& i_rTitle,
+ const OUString& i_rHelpId);
+
+ /// Show and set the label of a VclFrame of id i_rID
+ static css::uno::Any setSubgroupControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId,
+ const UIControlOptions& i_rControlOptions = UIControlOptions());
+
+ /// Show a bool option as a checkbox
+ static css::uno::Any setBoolControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId,
+ const OUString& i_rProperty, bool i_bValue,
+ const UIControlOptions& i_rControlOptions = UIControlOptions());
+
+ /// Show a set of choices in a list box
+ static css::uno::Any setChoiceListControlOpt( const OUString& i_rID, const OUString& i_rTitle,
+ const css::uno::Sequence< OUString >& i_rHelpId, const OUString& i_rProperty,
+ const css::uno::Sequence< OUString >& i_rChoices, sal_Int32 i_nValue,
+ const css::uno::Sequence< sal_Bool >& i_rDisabledChoices = css::uno::Sequence< sal_Bool >(),
+ const UIControlOptions& i_rControlOptions = UIControlOptions());
+
+ /// Show a set of choices as radio buttons
+ static css::uno::Any setChoiceRadiosControlOpt( const css::uno::Sequence< OUString >& i_rIDs,
+ const OUString& i_rTitle, const css::uno::Sequence< OUString >& i_rHelpId,
+ const OUString& i_rProperty, const css::uno::Sequence< OUString >& i_rChoices,
+ sal_Int32 i_nValue,
+ const css::uno::Sequence< sal_Bool >& i_rDisabledChoices = css::uno::Sequence< sal_Bool >(),
+ const UIControlOptions& i_rControlOptions = UIControlOptions());
+
+ /** Show an integer range (e.g. a spin field)
+
+ note: max value < min value means do not apply min/max values
+ */
+ static css::uno::Any setRangeControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId,
+ const OUString& i_rProperty, sal_Int32 i_nValue, sal_Int32 i_nMinValue,
+ sal_Int32 i_nMaxValue, const UIControlOptions& i_rControlOptions);
+
+ /** Show a string field
+
+ note: max value < min value means do not apply min/max values
+ */
+ static css::uno::Any setEditControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId,
+ const OUString& i_rProperty, const OUString& i_rValue,
+ const UIControlOptions& i_rControlOptions);
+}; // class PrinterOptionsHelper
+
+} // namespace vcl
+
+
+#endif // INCLUDED_VCL_PRINT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/printer/Options.hxx b/include/vcl/printer/Options.hxx
new file mode 100644
index 000000000..3899fd313
--- /dev/null
+++ b/include/vcl/printer/Options.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <config_options.h>
+
+#include <sal/types.h>
+
+#include <vcl/dllapi.h>
+
+namespace vcl::printer
+{
+enum class TransparencyMode
+{
+ Auto = 0,
+ NONE = 1
+};
+
+enum class GradientMode
+{
+ Stripes = 0,
+ Color = 1
+};
+
+enum class BitmapMode
+{
+ Optimal = 0,
+ Normal = 1,
+ Resolution = 2
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) Options
+{
+private:
+ bool mbReduceTransparency = false;
+ TransparencyMode meReducedTransparencyMode = TransparencyMode::Auto;
+ bool mbReduceGradients = false;
+ GradientMode meReducedGradientsMode = GradientMode::Stripes;
+ sal_uInt16 mnReducedGradientStepCount = 64;
+ bool mbReduceBitmaps = false;
+ BitmapMode meReducedBitmapMode = BitmapMode::Normal;
+ sal_uInt16 mnReducedBitmapResolution = 200;
+ bool mbReducedBitmapsIncludeTransparency = true;
+ bool mbConvertToGreyscales = false;
+ bool mbPDFAsStandardPrintJobFormat = false;
+
+public:
+ Options() = default;
+
+ bool IsReduceTransparency() const { return mbReduceTransparency; }
+ void SetReduceTransparency(bool bSet) { mbReduceTransparency = bSet; }
+
+ TransparencyMode GetReducedTransparencyMode() const { return meReducedTransparencyMode; }
+ void SetReducedTransparencyMode(TransparencyMode eMode) { meReducedTransparencyMode = eMode; }
+
+ bool IsReduceGradients() const { return mbReduceGradients; }
+ void SetReduceGradients(bool bSet) { mbReduceGradients = bSet; }
+
+ GradientMode GetReducedGradientMode() const { return meReducedGradientsMode; }
+ void SetReducedGradientMode(GradientMode eMode) { meReducedGradientsMode = eMode; }
+
+ sal_uInt16 GetReducedGradientStepCount() const { return mnReducedGradientStepCount; }
+ void SetReducedGradientStepCount(sal_uInt16 nStepCount)
+ {
+ mnReducedGradientStepCount = nStepCount;
+ }
+
+ bool IsReduceBitmaps() const { return mbReduceBitmaps; }
+ void SetReduceBitmaps(bool bSet) { mbReduceBitmaps = bSet; }
+
+ BitmapMode GetReducedBitmapMode() const { return meReducedBitmapMode; }
+ void SetReducedBitmapMode(BitmapMode eMode) { meReducedBitmapMode = eMode; }
+
+ sal_uInt16 GetReducedBitmapResolution() const { return mnReducedBitmapResolution; }
+ void SetReducedBitmapResolution(sal_uInt16 nResolution)
+ {
+ mnReducedBitmapResolution = nResolution;
+ }
+
+ bool IsReducedBitmapIncludesTransparency() const { return mbReducedBitmapsIncludeTransparency; }
+ void SetReducedBitmapIncludesTransparency(bool bSet)
+ {
+ mbReducedBitmapsIncludeTransparency = bSet;
+ }
+
+ bool IsConvertToGreyscales() const { return mbConvertToGreyscales; }
+ void SetConvertToGreyscales(bool bSet) { mbConvertToGreyscales = bSet; }
+
+ bool IsPDFAsStandardPrintJobFormat() const { return mbPDFAsStandardPrintJobFormat; }
+ void SetPDFAsStandardPrintJobFormat(bool bSet) { mbPDFAsStandardPrintJobFormat = bSet; }
+
+ /** Read printer options from configuration
+
+ parameter decides whether the set for
+ print "to printer" or "to file" should be read.
+ */
+ void ReadFromConfig(bool bFile);
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/prntypes.hxx b/include/vcl/prntypes.hxx
new file mode 100644
index 000000000..fab6a1bf6
--- /dev/null
+++ b/include/vcl/prntypes.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_PRNTYPES_HXX
+#define INCLUDED_VCL_PRNTYPES_HXX
+
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+
+
+// appears to be a copy of css::view::DuplexMode
+enum class DuplexMode { Unknown, Off, LongEdge, ShortEdge };
+
+
+enum class Orientation { Portrait, Landscape };
+
+
+enum class PrintQueueFlags
+{
+ NONE = 0x00000000,
+ Ready = 0x00000001,
+ Paused = 0x00000002,
+ PendingDeletion = 0x00000004,
+ Busy = 0x00000008,
+ Initializing = 0x00000010,
+ Waiting = 0x00000020,
+ WarmingUp = 0x00000040,
+ Processing = 0x00000080,
+ Printing = 0x00000100,
+ Offline = 0x00000200,
+ Error = 0x00000400,
+ StatusUnknown = 0x00000800,
+ PaperJam = 0x00001000,
+ PaperOut = 0x00002000,
+ ManualFeed = 0x00004000,
+ PaperProblem = 0x00008000,
+ IOActive = 0x00010000,
+ OutputBinFull = 0x00020000,
+ TonerLow = 0x00040000,
+ NoToner = 0x00080000,
+ PagePunt = 0x00100000,
+ UserIntervention = 0x00200000,
+ OutOfMemory = 0x00400000,
+ DoorOpen = 0x00800000,
+ PowerSave = 0x01000000,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<PrintQueueFlags> : is_typed_flags<PrintQueueFlags, 0x01ffffff> {};
+}
+
+constexpr inline sal_uInt32 QUEUE_JOBS_DONTKNOW = 0xFFFFFFFF;
+
+
+enum class PrinterCapType
+{
+ SupportDialog = 1,
+ Copies = 2,
+ CollateCopies = 3,
+ SetOrientation = 4,
+ SetPaperSize = 6,
+ SetPaper = 7,
+ Fax = 8,
+ PDF = 9,
+ ExternalDialog = 10,
+ UsePullModel = 12,
+};
+
+enum class PrinterSetupMode
+{
+ SingleJob = 0,
+ DocumentGlobal = 1
+};
+
+#endif // INCLUDED_VCL_PRNTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/ptrstyle.hxx b/include/vcl/ptrstyle.hxx
new file mode 100644
index 000000000..fa45246a8
--- /dev/null
+++ b/include/vcl/ptrstyle.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_PTRSTYLE_HXX
+#define INCLUDED_VCL_PTRSTYLE_HXX
+
+#include <com/sun/star/awt/SystemPointer.hpp>
+
+enum class PointerStyle
+{
+ Arrow = css::awt::SystemPointer::ARROW,
+ Null = css::awt::SystemPointer::INVISIBLE,
+ Wait = css::awt::SystemPointer::WAIT,
+ Text = css::awt::SystemPointer::TEXT,
+ Help = css::awt::SystemPointer::HELP,
+ Cross = css::awt::SystemPointer::CROSS,
+ Move = css::awt::SystemPointer::MOVE,
+ NSize = css::awt::SystemPointer::NSIZE,
+ SSize = css::awt::SystemPointer::SSIZE,
+ WSize = css::awt::SystemPointer::WSIZE,
+ ESize = css::awt::SystemPointer::ESIZE,
+ NWSize = css::awt::SystemPointer::NWSIZE,
+ NESize = css::awt::SystemPointer::NESIZE,
+ SWSize = css::awt::SystemPointer::SWSIZE,
+ SESize = css::awt::SystemPointer::SESIZE,
+ WindowNSize = css::awt::SystemPointer::WINDOW_NSIZE,
+ WindowSSize = css::awt::SystemPointer::WINDOW_SSIZE,
+ WindowWSize = css::awt::SystemPointer::WINDOW_WSIZE,
+ WindowESize = css::awt::SystemPointer::WINDOW_ESIZE,
+ WindowNWSize = css::awt::SystemPointer::WINDOW_NWSIZE,
+ WindowNESize = css::awt::SystemPointer::WINDOW_NESIZE,
+ WindowSWSize = css::awt::SystemPointer::WINDOW_SWSIZE,
+ WindowSESize = css::awt::SystemPointer::WINDOW_SESIZE,
+ HSplit = css::awt::SystemPointer::HSPLIT,
+ VSplit = css::awt::SystemPointer::VSPLIT,
+ HSizeBar = css::awt::SystemPointer::HSIZEBAR,
+ VSizeBar = css::awt::SystemPointer::VSIZEBAR,
+ Hand = css::awt::SystemPointer::HAND,
+ RefHand = css::awt::SystemPointer::REFHAND,
+ Pen = css::awt::SystemPointer::PEN,
+ Magnify = css::awt::SystemPointer::MAGNIFY,
+ Fill = css::awt::SystemPointer::FILL,
+ Rotate = css::awt::SystemPointer::ROTATE,
+ HShear = css::awt::SystemPointer::HSHEAR,
+ VShear = css::awt::SystemPointer::VSHEAR,
+ Mirror = css::awt::SystemPointer::MIRROR,
+ Crook = css::awt::SystemPointer::CROOK,
+ Crop = css::awt::SystemPointer::CROP,
+ MovePoint = css::awt::SystemPointer::MOVEPOINT,
+ MoveBezierWeight = css::awt::SystemPointer::MOVEBEZIERWEIGHT,
+ MoveData = css::awt::SystemPointer::MOVEDATA,
+ CopyData = css::awt::SystemPointer::COPYDATA,
+ LinkData = css::awt::SystemPointer::LINKDATA,
+ MoveDataLink = css::awt::SystemPointer::MOVEDATALINK,
+ CopyDataLink = css::awt::SystemPointer::COPYDATALINK,
+ MoveFile = css::awt::SystemPointer::MOVEFILE,
+ CopyFile = css::awt::SystemPointer::COPYFILE,
+ LinkFile = css::awt::SystemPointer::LINKFILE,
+ MoveFileLink = css::awt::SystemPointer::MOVEFILELINK,
+ CopyFileLink = css::awt::SystemPointer::COPYFILELINK,
+ MoveFiles = css::awt::SystemPointer::MOVEFILES,
+ CopyFiles = css::awt::SystemPointer::COPYFILES,
+ NotAllowed = css::awt::SystemPointer::NOTALLOWED,
+ DrawLine = css::awt::SystemPointer::DRAW_LINE,
+ DrawRect = css::awt::SystemPointer::DRAW_RECT,
+ DrawPolygon = css::awt::SystemPointer::DRAW_POLYGON,
+ DrawBezier = css::awt::SystemPointer::DRAW_BEZIER,
+ DrawArc = css::awt::SystemPointer::DRAW_ARC,
+ DrawPie = css::awt::SystemPointer::DRAW_PIE,
+ DrawCircleCut = css::awt::SystemPointer::DRAW_CIRCLECUT,
+ DrawEllipse = css::awt::SystemPointer::DRAW_ELLIPSE,
+ DrawFreehand = css::awt::SystemPointer::DRAW_FREEHAND,
+ DrawConnect = css::awt::SystemPointer::DRAW_CONNECT,
+ DrawText = css::awt::SystemPointer::DRAW_TEXT,
+ DrawCaption = css::awt::SystemPointer::DRAW_CAPTION,
+ Chart = css::awt::SystemPointer::CHART,
+ Detective = css::awt::SystemPointer::DETECTIVE,
+ PivotCol = css::awt::SystemPointer::PIVOT_COL,
+ PivotRow = css::awt::SystemPointer::PIVOT_ROW,
+ PivotField = css::awt::SystemPointer::PIVOT_FIELD,
+ Chain = css::awt::SystemPointer::CHAIN,
+ ChainNotAllowed = css::awt::SystemPointer::CHAIN_NOTALLOWED,
+ AutoScrollN,
+ AutoScrollS,
+ AutoScrollW,
+ AutoScrollE,
+ AutoScrollNW,
+ AutoScrollNE,
+ AutoScrollSW,
+ AutoScrollSE,
+ AutoScrollNS,
+ AutoScrollWE,
+ AutoScrollNSWE,
+ TextVertical,
+ PivotDelete,
+ TabSelectS,
+ TabSelectE,
+ TabSelectSE,
+ TabSelectW,
+ TabSelectSW,
+ HideWhitespace,
+ ShowWhitespace,
+ FatCross,
+ LAST = FatCross,
+};
+
+#endif // INCLUDED_VCL_PTRSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/quickselectionengine.hxx b/include/vcl/quickselectionengine.hxx
new file mode 100644
index 000000000..87e1d09a9
--- /dev/null
+++ b/include/vcl/quickselectionengine.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_QUICKSELECTIONENGINE_HXX
+#define INCLUDED_VCL_QUICKSELECTIONENGINE_HXX
+
+#include <rtl/ustring.hxx>
+#include <vcl/dllapi.h>
+#include <memory>
+
+class KeyEvent;
+
+
+namespace vcl
+{
+
+
+ typedef const void* StringEntryIdentifier;
+
+
+ //= ISearchableStringList
+
+ // TODO: consolidate this with vcl::IMnemonicEntryList
+ class SAL_NO_VTABLE VCL_DLLPUBLIC ISearchableStringList
+ {
+ public:
+ /** returns the current entry in the list of searchable strings.
+
+ Search operations will start with this entry.
+ */
+ virtual StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const = 0;
+
+ /** returns the next entry in the list.
+
+ The implementation is expected to wrap around. That is, if the given entry denotes the last
+ entry in the list, then NextEntry should return the first entry.
+ */
+ virtual StringEntryIdentifier NextEntry( StringEntryIdentifier _currentEntry, OUString& _out_entryText ) const = 0;
+
+ /** selects a given entry
+ */
+ virtual void SelectEntry( StringEntryIdentifier _entry ) = 0;
+
+ protected:
+ ~ISearchableStringList() {}
+ };
+
+
+ //= QuickSelectionEngine
+
+ struct QuickSelectionEngine_Data;
+ class VCL_DLLPUBLIC QuickSelectionEngine
+ {
+ public:
+ QuickSelectionEngine( ISearchableStringList& _entryList );
+ ~QuickSelectionEngine();
+
+ bool HandleKeyEvent( const KeyEvent& _rKEvt );
+ void Reset();
+
+ private:
+ ::std::unique_ptr< QuickSelectionEngine_Data > m_pData;
+
+ private:
+ QuickSelectionEngine( const QuickSelectionEngine& ) = delete;
+ QuickSelectionEngine& operator=( const QuickSelectionEngine& ) = delete;
+ };
+
+
+} // namespace vcl
+
+
+#endif // INCLUDED_VCL_QUICKSELECTIONENGINE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/region.hxx b/include/vcl/region.hxx
new file mode 100644
index 000000000..8d5004c18
--- /dev/null
+++ b/include/vcl/region.hxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_REGION_HXX
+#define INCLUDED_VCL_REGION_HXX
+
+#include <tools/gen.hxx>
+#include <tools/poly.hxx>
+#include <vcl/dllapi.h>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <memory>
+#include <optional>
+
+class RegionBand;
+
+namespace vcl { class Window; }
+class OutputDevice;
+class Bitmap;
+
+typedef std::vector< tools::Rectangle > RectangleVector;
+
+namespace vcl {
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC Region
+{
+private:
+ friend class ::OutputDevice;
+ friend class ::vcl::Window;
+ friend class ::Bitmap;
+
+ // possible contents
+ std::optional< basegfx::B2DPolyPolygon >
+ mpB2DPolyPolygon;
+ std::optional< tools::PolyPolygon >
+ mpPolyPolygon;
+ std::shared_ptr< RegionBand >
+ mpRegionBand;
+
+ bool mbIsNull : 1;
+
+ // helpers
+ SAL_DLLPRIVATE void ImplCreatePolyPolyRegion( const tools::PolyPolygon& rPolyPoly );
+ SAL_DLLPRIVATE void ImplCreatePolyPolyRegion( const basegfx::B2DPolyPolygon& rPolyPoly );
+
+ SAL_DLLPRIVATE tools::PolyPolygon ImplCreatePolyPolygonFromRegionBand() const;
+ SAL_DLLPRIVATE basegfx::B2DPolyPolygon ImplCreateB2DPolyPolygonFromRegionBand() const;
+
+public:
+
+ explicit Region(bool bIsNull = false); // default creates empty region, with true a null region is created
+ explicit Region(const tools::Rectangle& rRect);
+ explicit Region(const tools::Polygon& rPolygon);
+ explicit Region(const tools::PolyPolygon& rPolyPoly);
+ explicit Region(const basegfx::B2DPolyPolygon&);
+ Region(const vcl::Region& rRegion);
+ Region(vcl::Region&& rRegion) noexcept;
+ ~Region();
+
+ // direct access to contents
+ const std::optional<basegfx::B2DPolyPolygon>& getB2DPolyPolygon() const { return mpB2DPolyPolygon; }
+ const std::optional<tools::PolyPolygon>& getPolyPolygon() const { return mpPolyPolygon; }
+ const RegionBand* getRegionBand() const { return mpRegionBand.get(); }
+
+ // access with converters, the asked data will be created from the most
+ // valuable data, buffered and returned
+ tools::PolyPolygon GetAsPolyPolygon() const;
+ basegfx::B2DPolyPolygon GetAsB2DPolyPolygon() const;
+ const RegionBand* GetAsRegionBand() const;
+
+ // manipulators
+ void Move( tools::Long nHorzMove, tools::Long nVertMove );
+ void Scale( double fScaleX, double fScaleY );
+ void Union( const tools::Rectangle& rRegion );
+ void Intersect( const tools::Rectangle& rRegion );
+ void Exclude( const tools::Rectangle& rRegion );
+ void XOr( const tools::Rectangle& rRegion );
+ void Union( const vcl::Region& rRegion );
+ void Intersect( const vcl::Region& rRegion );
+ void Exclude( const vcl::Region& rRegion );
+ bool XOr( const vcl::Region& rRegion );
+
+ bool IsEmpty() const;
+ bool IsNull() const { return mbIsNull;}
+
+ void SetEmpty();
+ void SetNull();
+
+ bool IsRectangle() const;
+
+ tools::Rectangle GetBoundRect() const;
+ bool HasPolyPolygonOrB2DPolyPolygon() const { return (getB2DPolyPolygon() || getPolyPolygon()); }
+ void GetRegionRectangles(RectangleVector& rTarget) const;
+
+ bool Contains( const Point& rPoint ) const;
+ bool Overlaps( const tools::Rectangle& rRect ) const;
+
+ vcl::Region& operator=( const vcl::Region& rRegion );
+ vcl::Region& operator=( vcl::Region&& rRegion ) noexcept;
+ vcl::Region& operator=( const tools::Rectangle& rRect );
+
+ bool operator==( const vcl::Region& rRegion ) const;
+ bool operator!=( const vcl::Region& rRegion ) const { return !(Region::operator==( rRegion )); }
+
+ friend VCL_DLLPUBLIC SvStream& ReadRegion( SvStream& rIStm, vcl::Region& rRegion );
+ friend VCL_DLLPUBLIC SvStream& WriteRegion( SvStream& rOStm, const vcl::Region& rRegion );
+
+ /* workaround: faster conversion for PolyPolygons
+ * if half of the Polygons contained in rPolyPoly are actually
+ * rectangles, then the returned vcl::Region will be constructed by
+ * XOr'ing the contained Polygons together; in the case of
+ * only Rectangles this can be up to eight times faster than
+ * Region( const tools::PolyPolygon& ).
+ * Caution: this is only useful if the vcl::Region is known to be
+ * changed to rectangles; e.g. if being set as clip region
+ */
+ static vcl::Region GetRegionFromPolyPolygon( const tools::PolyPolygon& rPolyPoly );
+};
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const Region& rRegion)
+{
+ if (rRegion.IsEmpty())
+ return stream << "EMPTY";
+ if (rRegion.getB2DPolyPolygon())
+ return stream << "B2DPolyPolygon("
+ << *rRegion.getB2DPolyPolygon()
+ << ")";
+ if (rRegion.getPolyPolygon())
+ return stream << "PolyPolygon("
+ << *rRegion.getPolyPolygon()
+ << ")";
+ if (rRegion.getRegionBand())
+ { // inlined because RegionBand is private to vcl
+ stream << "RegionBand(";
+ RectangleVector rects;
+ rRegion.GetRegionRectangles(rects);
+ if (rects.empty())
+ stream << "EMPTY";
+ for (size_t i = 0; i < rects.size(); ++i)
+ stream << "[" << i << "] " << rects[i];
+ stream << ")";
+ }
+ return stream;
+}
+
+} /* namespace vcl */
+
+#endif // INCLUDED_VCL_REGION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/rendercontext/AddFontSubstituteFlags.hxx b/include/vcl/rendercontext/AddFontSubstituteFlags.hxx
new file mode 100644
index 000000000..d2cb90a28
--- /dev/null
+++ b/include/vcl/rendercontext/AddFontSubstituteFlags.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class AddFontSubstituteFlags
+{
+ NONE = 0x00,
+ ALWAYS = 0x01,
+ ScreenOnly = 0x02,
+};
+namespace o3tl
+{
+template <>
+struct typed_flags<AddFontSubstituteFlags> : is_typed_flags<AddFontSubstituteFlags, 0x03>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/rendercontext/AntialiasingFlags.hxx b/include/vcl/rendercontext/AntialiasingFlags.hxx
new file mode 100644
index 000000000..98ce2e882
--- /dev/null
+++ b/include/vcl/rendercontext/AntialiasingFlags.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class AntialiasingFlags
+{
+ NONE = 0x0000,
+ DisableText = 0x0001,
+ Enable = 0x0002,
+ PixelSnapHairline = 0x0004,
+};
+namespace o3tl
+{
+template <> struct typed_flags<AntialiasingFlags> : is_typed_flags<AntialiasingFlags, 0x07>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/rendercontext/DrawGridFlags.hxx b/include/vcl/rendercontext/DrawGridFlags.hxx
new file mode 100644
index 000000000..4d783e780
--- /dev/null
+++ b/include/vcl/rendercontext/DrawGridFlags.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class DrawGridFlags
+{
+ NONE = 0x0000,
+ Dots = 0x0001,
+ HorzLines = 0x0002,
+ VertLines = 0x0004
+};
+namespace o3tl
+{
+template <> struct typed_flags<DrawGridFlags> : is_typed_flags<DrawGridFlags, 0x0007>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/rendercontext/DrawImageFlags.hxx b/include/vcl/rendercontext/DrawImageFlags.hxx
new file mode 100644
index 000000000..014b552de
--- /dev/null
+++ b/include/vcl/rendercontext/DrawImageFlags.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <o3tl/typed_flags_set.hxx>
+
+// Flags for DrawImage(), these must match the definitions in css::awt::ImageDrawMode
+enum class DrawImageFlags
+{
+ NONE = 0x0000,
+ Disable = 0x0001,
+ Highlight = 0x0002,
+ Deactive = 0x0004,
+ ColorTransform = 0x0008,
+ SemiTransparent = 0x0010,
+};
+namespace o3tl
+{
+template <> struct typed_flags<DrawImageFlags> : is_typed_flags<DrawImageFlags, 0x001f>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/rendercontext/DrawModeFlags.hxx b/include/vcl/rendercontext/DrawModeFlags.hxx
new file mode 100644
index 000000000..edfa27626
--- /dev/null
+++ b/include/vcl/rendercontext/DrawModeFlags.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+
+enum class DrawModeFlags : sal_uInt32
+{
+ Default = 0x00000000,
+ BlackLine = 0x00000001,
+ BlackFill = 0x00000002,
+ BlackText = 0x00000004,
+ BlackBitmap = 0x00000008,
+ BlackGradient = 0x00000010,
+ GrayLine = 0x00000020,
+ GrayFill = 0x00000040,
+ GrayText = 0x00000080,
+ GrayBitmap = 0x00000100,
+ GrayGradient = 0x00000200,
+ NoFill = 0x00000400,
+ WhiteLine = 0x00000800,
+ WhiteFill = 0x00001000,
+ WhiteText = 0x00002000,
+ WhiteBitmap = 0x00004000,
+ WhiteGradient = 0x00008000,
+ SettingsLine = 0x00010000,
+ SettingsFill = 0x00020000,
+ SettingsText = 0x00040000,
+ SettingsGradient = 0x00080000,
+ NoTransparency = 0x00100000,
+};
+namespace o3tl
+{
+template <> struct typed_flags<DrawModeFlags> : is_typed_flags<DrawModeFlags, 0x1fffff>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/rendercontext/DrawTextFlags.hxx b/include/vcl/rendercontext/DrawTextFlags.hxx
new file mode 100644
index 000000000..e393bcd2c
--- /dev/null
+++ b/include/vcl/rendercontext/DrawTextFlags.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class DrawTextFlags
+{
+ NONE = 0x00000000,
+ Disable = 0x00000001,
+ Mnemonic = 0x00000002,
+ Mono = 0x00000004,
+ Clip = 0x00000008,
+ Left = 0x00000010,
+ Center = 0x00000020,
+ Right = 0x00000040,
+ Top = 0x00000080,
+ VCenter = 0x00000100,
+ Bottom = 0x00000200,
+ EndEllipsis = 0x00000400,
+ PathEllipsis = 0x00000800,
+ MultiLine = 0x00001000,
+ WordBreak = 0x00002000,
+ NewsEllipsis = 0x00004000,
+ WordBreakHyphenation = 0x00008000 | WordBreak,
+ CenterEllipsis = 0x00010000,
+ HideMnemonic = 0x00020000,
+};
+namespace o3tl
+{
+template <> struct typed_flags<DrawTextFlags> : is_typed_flags<DrawTextFlags, 0x3ffff>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/rendercontext/GetDefaultFontFlags.hxx b/include/vcl/rendercontext/GetDefaultFontFlags.hxx
new file mode 100644
index 000000000..a100e2f2f
--- /dev/null
+++ b/include/vcl/rendercontext/GetDefaultFontFlags.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class GetDefaultFontFlags
+{
+ NONE = 0x0000,
+ OnlyOne = 0x0001,
+};
+namespace o3tl
+{
+template <> struct typed_flags<GetDefaultFontFlags> : is_typed_flags<GetDefaultFontFlags, 0x01>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/rendercontext/ImplMapRes.hxx b/include/vcl/rendercontext/ImplMapRes.hxx
new file mode 100644
index 000000000..7a88a15af
--- /dev/null
+++ b/include/vcl/rendercontext/ImplMapRes.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <tools/long.hxx>
+
+struct ImplMapRes
+{
+ ImplMapRes() = default;
+
+ tools::Long mnMapOfsX = 0; ///< Offset in X direction
+ tools::Long mnMapOfsY = 0; ///< Offset in Y direction
+ tools::Long mnMapScNumX = 1; ///< Scaling factor - numerator in X direction
+ tools::Long mnMapScNumY = 1; ///< Scaling factor - numerator in Y direction
+ tools::Long mnMapScDenomX = 1; ///< Scaling factor - denominator in X direction
+ tools::Long mnMapScDenomY = 1; ///< Scaling factor - denominator in Y direction
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/rendercontext/InvertFlags.hxx b/include/vcl/rendercontext/InvertFlags.hxx
new file mode 100644
index 000000000..86fe96fd4
--- /dev/null
+++ b/include/vcl/rendercontext/InvertFlags.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class InvertFlags
+{
+ NONE = 0x0000,
+ N50 = 0x0001,
+ TrackFrame = 0x0002
+};
+namespace o3tl
+{
+template <> struct typed_flags<InvertFlags> : is_typed_flags<InvertFlags, 0x0003>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/rendercontext/RasterOp.hxx b/include/vcl/rendercontext/RasterOp.hxx
new file mode 100644
index 000000000..44b2a6c03
--- /dev/null
+++ b/include/vcl/rendercontext/RasterOp.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+enum class RasterOp
+{
+ OverPaint,
+ Xor,
+ N0,
+ N1,
+ Invert
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/rendercontext/SalLayoutFlags.hxx b/include/vcl/rendercontext/SalLayoutFlags.hxx
new file mode 100644
index 000000000..68c26cadb
--- /dev/null
+++ b/include/vcl/rendercontext/SalLayoutFlags.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class SalLayoutFlags
+{
+ NONE = 0x0000,
+ BiDiRtl = 0x0001,
+ BiDiStrong = 0x0002,
+ RightAlign = 0x0004,
+ DisableKerning = 0x0010,
+ KerningAsian = 0x0020,
+ Vertical = 0x0040,
+ KashidaJustification = 0x0800,
+ ForFallback = 0x2000,
+ GlyphItemsOnly = 0x4000,
+};
+namespace o3tl
+{
+template <> struct typed_flags<SalLayoutFlags> : is_typed_flags<SalLayoutFlags, 0x6877>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/rendercontext/State.hxx b/include/vcl/rendercontext/State.hxx
new file mode 100644
index 000000000..a433dbd8f
--- /dev/null
+++ b/include/vcl/rendercontext/State.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include <tools/fontenum.hxx>
+#include <i18nlangtag/lang.h>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <vcl/rendercontext/RasterOp.hxx>
+#include <vcl/font.hxx>
+#include <vcl/mapmod.hxx>
+#include <vcl/region.hxx>
+
+#include <memory>
+#include <optional>
+
+namespace vcl
+{
+// Flags for OutputDevice::Push() and State
+enum class PushFlags
+{
+ NONE = 0x0000,
+ LINECOLOR = 0x0001,
+ FILLCOLOR = 0x0002,
+ FONT = 0x0004,
+ TEXTCOLOR = 0x0008,
+ MAPMODE = 0x0010,
+ CLIPREGION = 0x0020,
+ RASTEROP = 0x0040,
+ TEXTFILLCOLOR = 0x0080,
+ TEXTALIGN = 0x0100,
+ REFPOINT = 0x0200,
+ TEXTLINECOLOR = 0x0400,
+ TEXTLAYOUTMODE = 0x0800,
+ TEXTLANGUAGE = 0x1000,
+ OVERLINECOLOR = 0x2000,
+ ALL = 0xFFFF
+};
+}
+
+namespace o3tl
+{
+template <> struct typed_flags<vcl::PushFlags> : is_typed_flags<vcl::PushFlags, 0xFFFF>
+{
+};
+}
+#define PUSH_ALLFONT \
+ (vcl::PushFlags::TEXTCOLOR | vcl::PushFlags::TEXTFILLCOLOR | vcl::PushFlags::TEXTLINECOLOR \
+ | vcl::PushFlags::OVERLINECOLOR | vcl::PushFlags::TEXTALIGN | vcl::PushFlags::TEXTLAYOUTMODE \
+ | vcl::PushFlags::TEXTLANGUAGE | vcl::PushFlags::FONT)
+
+namespace vcl::text
+{
+// Layout flags for Complex Text Layout
+// These are flag values, i.e they can be combined
+enum class ComplexTextLayoutFlags
+{
+ Default = 0x0000,
+ BiDiRtl = 0x0001,
+ BiDiStrong = 0x0002,
+ TextOriginLeft = 0x0004,
+ TextOriginRight = 0x0008
+};
+}
+
+namespace o3tl
+{
+template <>
+struct typed_flags<vcl::text::ComplexTextLayoutFlags>
+ : is_typed_flags<vcl::text::ComplexTextLayoutFlags, 0x000f>
+{
+};
+}
+
+namespace vcl
+{
+struct State
+{
+ State() = default;
+ State(State&&) = default;
+
+ std::unique_ptr<vcl::Region> mpClipRegion;
+ std::optional<MapMode> mpMapMode;
+ std::optional<vcl::Font> mpFont;
+ std::optional<Point> mpRefPoint;
+ std::optional<Color> mpLineColor;
+ std::optional<Color> mpFillColor;
+ std::optional<Color> mpTextColor;
+ std::optional<Color> mpTextFillColor;
+ std::optional<Color> mpTextLineColor;
+ std::optional<Color> mpOverlineColor;
+ TextAlign meTextAlign = ALIGN_TOP;
+ RasterOp meRasterOp = RasterOp::OverPaint;
+ text::ComplexTextLayoutFlags mnTextLayoutMode = text::ComplexTextLayoutFlags::Default;
+ LanguageType meTextLanguage = LANGUAGE_SYSTEM;
+ PushFlags mnFlags = PushFlags::NONE;
+ bool mbMapActive = false;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/rendercontext/SystemTextColorFlags.hxx b/include/vcl/rendercontext/SystemTextColorFlags.hxx
new file mode 100644
index 000000000..459c21945
--- /dev/null
+++ b/include/vcl/rendercontext/SystemTextColorFlags.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class SystemTextColorFlags
+{
+ NONE = 0x0000,
+ Mono = 0x0001,
+ NoControls = 0x0004,
+};
+namespace o3tl
+{
+template <> struct typed_flags<SystemTextColorFlags> : is_typed_flags<SystemTextColorFlags, 0x0005>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/roadmapwizard.hxx b/include/vcl/roadmapwizard.hxx
new file mode 100644
index 000000000..6a55bacad
--- /dev/null
+++ b/include/vcl/roadmapwizard.hxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_ROADMAPWIZARD_HXX
+#define INCLUDED_VCL_ROADMAPWIZARD_HXX
+
+#include <memory>
+#include <vcl/dllapi.h>
+#include <vcl/wizardmachine.hxx>
+
+namespace vcl
+{
+ struct RoadmapWizardImpl;
+
+ namespace RoadmapWizardTypes
+ {
+ typedef sal_Int16 PathId;
+ typedef ::std::vector< WizardTypes::WizardState > WizardPath;
+ };
+
+ //= RoadmapWizard
+
+ /** is - no, not a wizard for a roadmap, but the base class for wizards
+ <em>supporting</em> a roadmap.
+
+ The basic new concept introduced is a <em>path</em>:<br/>
+ A <em>path</em> is a sequence of states, which are to be executed in a linear order.
+ Elements in the path can be skipped, depending on choices the user makes.
+
+ In the most simple wizards, you will have only one path consisting of <code>n</code> elements,
+ which are to be visited successively.
+
+ In a slightly more complex wizard, you will have one linear path, were certain
+ steps might be skipped due to user input. For instance, the user may decide to not specify
+ certain aspects of the to-be-created object (e.g. by unchecking a check box),
+ and the wizard then will simply disable the step which corresponds to this step.
+
+ In a yet more advanced wizards, you will have several paths of length <code>n1</code> and
+ <code>n2</code>, which share at least the first <code>k</code> states (where <code>k</code>
+ is at least 1), and an arbitrary number of other states.
+ */
+ class VCL_DLLPUBLIC RoadmapWizardMachine : public vcl::WizardMachine
+ {
+ private:
+ std::unique_ptr<RoadmapWizardImpl> m_pImpl;
+
+ public:
+ RoadmapWizardMachine(weld::Window* _pParent);
+ virtual ~RoadmapWizardMachine( ) override;
+
+ void SetRoadmapHelpId( const OString& _rId );
+
+ // returns whether a given state is enabled
+ bool isStateEnabled(WizardTypes::WizardState nState) const;
+
+ // WizardDialog overridables
+ virtual bool canAdvance() const override;
+ virtual void updateTravelUI() override;
+
+ protected:
+ /** declares a valid path in the wizard
+
+ The very first path which is declared is automatically activated.
+
+ Note that all paths which are declared must have the very first state in
+ common. Also note that due to a restriction of the very base class (WizardDialog),
+ this common first state must be 0.
+
+ You cannot declare new paths once the wizard started, so it's recommended that
+ you do all declarations within your derivee's constructor.
+
+ @see activatePath
+
+ @param _nId
+ the unique id you wish to give this path. This id can later on be used
+ to refer to the path which you just declared
+ */
+ void declarePath( RoadmapWizardTypes::PathId _nPathId, const RoadmapWizardTypes::WizardPath& _lWizardStates);
+
+ /** activates a path which has previously been declared with <member>declarePath</member>
+
+ You can only activate paths which share the first <code>k</code> states with the path
+ which is previously active (if any), where <code>k</code> is the index of the
+ current state within the current path.
+
+ <example>
+ Say you have paths, <code>(0,1,2,5)</code> and <code>(0,1,4,5)</code>. This means that after
+ step <code>1</code>, you either continue with state <code>2</code> or state <code>4</code>,
+ and after this, you finish in state <code>5</code>.<br/>
+ Now if the first path is active, and your current state is <code>1</code>, then you can
+ easily switch to the second path, since both paths start with <code>(0,1)</code>.<br/>
+ However, if your current state is <code>2</code>, then you can not switch to the second
+ path anymore.
+ </example>
+
+ @param _nPathId
+ the id of the path. The path must have been declared (under this id) with
+ <member>declarePath</member> before it can be activated.
+
+ @param _bDecideForIt
+ If <TRUE/>, the path will be completely activated, even if it is a conflicting path
+ (i.e. there is another path which shares the first <code>k</code> states with
+ the to-be-activated path.)<br/>
+ If <FALSE/>, then the new path is checked for conflicts with other paths. If such
+ conflicts exists, the path is not completely activated, but only up to the point
+ where it does <em>not</em> conflict.<br/>
+ With the paths in the example above, if you activate the second path (when both are
+ already declared), then only steps <code>0</code> and <code>1</code> are activated,
+ since they are common to both paths.
+ */
+ void activatePath( RoadmapWizardTypes::PathId _nPathId, bool _bDecideForIt = false );
+
+ /** determine the next state to travel from the given one
+
+ This method (which is declared in WizardMachine and overwritten here)
+ ensures that traveling happens along the active path.
+
+ @see activatePath
+ */
+ virtual WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const override;
+
+ /** en- or disables a state
+
+ In the wizard's roadmap, states to travel to can be freely chosen. To prevent
+ users from selecting a state which is currently not available, you can declare this
+ state as being disabled.
+
+ A situation where you need this may be when you have a checkbox which, when checked
+ by the user, enables a page with additional settings. As long as this checkbox is
+ not checked, the respective state would be disabled.
+
+ Note that in theory, you can declare multiple paths, instead of disabling states.
+ For instance, if you have a path where one state can be potentially disabled, then
+ you could declare a second path, which does not contain this state. However, the
+ disadvantage is that then, not the complete path would be visible in the roadmap,
+ but only all steps up to the point where the both paths diverge.<br/>
+ Another disadvantage is that the number of needed paths grows exponentially with
+ the number of states which can be potentially disabled.
+
+ @see declarePath
+ */
+ void enableState(WizardTypes::WizardState nState, bool _bEnable = true);
+
+ /** returns true if and only if the given state is known in at least one declared path
+ */
+ bool knowsState(WizardTypes::WizardState nState) const;
+
+ // WizardMachine overriables
+ virtual void enterState(WizardTypes::WizardState nState) override;
+
+ /** returns a human readable name for a given state
+
+ There is a default implementation for this method, which returns the display name
+ as given in a call to describeState. If there is no description for the given state,
+ this is worth an assertion in a non-product build, and then an empty string is
+ returned.
+ */
+ virtual OUString getStateDisplayName(WizardTypes::WizardState nState) const;
+
+ private:
+ DECL_DLLPRIVATE_LINK( OnRoadmapItemSelected, const OString&, bool );
+
+ /** updates the roadmap control to show the given path, as far as possible
+ (modulo conflicts with other paths)
+ */
+ VCL_DLLPRIVATE void implUpdateRoadmap( );
+ };
+} // namespace vcl
+
+
+#endif // OOO_ INCLUDED_VCL_ROADMAPWIZARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/salctype.hxx b/include/vcl/salctype.hxx
new file mode 100644
index 000000000..71f256b19
--- /dev/null
+++ b/include/vcl/salctype.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SALCTYPE_HXX
+#define INCLUDED_VCL_SALCTYPE_HXX
+
+#include <sal/config.h>
+
+#include <vcl/graph.hxx>
+
+enum class ConvertDataFormat
+{
+ Unknown,
+ BMP,
+ GIF,
+ JPG,
+ MET,
+ PCT,
+ PNG,
+ SVM,
+ TIF,
+ WMF,
+ EMF,
+ SVG,
+ WEBP
+};
+
+class SvStream;
+
+struct ConvertData
+{
+public:
+
+ Graphic maGraphic;
+ SvStream& mrStm;
+ ConvertDataFormat mnFormat;
+
+ ConvertData( const Graphic& rGraphic, SvStream& rStm, ConvertDataFormat nFormat ) :
+ maGraphic( rGraphic ), mrStm( rStm ), mnFormat( nFormat ) {}
+};
+
+typedef sal_uLong (*SALGRFCVTPROC)( void* pInst,
+ ConvertDataFormat nInFormat, void* pInBuffer, sal_uLong nInBufSize,
+ ConvertDataFormat nOutFormat, void** ppOutBuffer );
+
+#endif // INCLUDED_VCL_SALCTYPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx
new file mode 100644
index 000000000..a6559d68d
--- /dev/null
+++ b/include/vcl/salgtype.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SALGTYPE_HXX
+#define INCLUDED_VCL_SALGTYPE_HXX
+
+#include <o3tl/typed_flags_set.hxx>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include <ostream>
+
+enum class DeviceFormat {
+ NONE = -1,
+ DEFAULT = 0,
+#ifdef IOS
+ GRAYSCALE = 8
+#endif
+ };
+
+constexpr ::Color SALCOLOR_NONE ( ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF );
+
+struct SalTwoRect
+{
+ tools::Long mnSrcX;
+ tools::Long mnSrcY;
+ tools::Long mnSrcWidth;
+ tools::Long mnSrcHeight;
+ tools::Long mnDestX;
+ tools::Long mnDestY;
+ tools::Long mnDestWidth;
+ tools::Long mnDestHeight;
+
+ SalTwoRect(tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight,
+ tools::Long nDestX, tools::Long nDestY, tools::Long nDestWidth, tools::Long nDestHeight)
+ : mnSrcX(nSrcX), mnSrcY(nSrcY), mnSrcWidth(nSrcWidth), mnSrcHeight(nSrcHeight)
+ , mnDestX(nDestX), mnDestY(nDestY), mnDestWidth(nDestWidth), mnDestHeight(nDestHeight)
+ {
+ }
+};
+
+template <typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream,
+ const SalTwoRect& rPosAry)
+{
+ tools::Rectangle aSrcRect(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcX + rPosAry.mnSrcWidth,
+ rPosAry.mnSrcY + rPosAry.mnSrcHeight);
+ tools::Rectangle aDestRect(rPosAry.mnDestX, rPosAry.mnDestY,
+ rPosAry.mnDestX + rPosAry.mnDestWidth,
+ rPosAry.mnDestY + rPosAry.mnDestHeight);
+ stream << aSrcRect << " => " << aDestRect;
+ return stream;
+}
+
+enum class SalROPColor {
+ N0, N1, Invert
+};
+
+enum class SalInvert {
+ NONE = 0x00,
+ N50 = 0x01,
+ TrackFrame = 0x02
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SalInvert> : is_typed_flags<SalInvert, 0x03> {};
+}
+
+#endif // INCLUDED_VCL_SALGTYPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
new file mode 100644
index 000000000..057e05aac
--- /dev/null
+++ b/include/vcl/salnativewidgets.hxx
@@ -0,0 +1,520 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SALNATIVEWIDGETS_HXX
+#define INCLUDED_VCL_SALNATIVEWIDGETS_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/gen.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+/* Control Types:
+ *
+ * Specify the overall, whole control
+ * type (as opposed to parts of the
+ * control if it were composite).
+ */
+
+enum class ControlType {
+// for use in general purpose ImplControlValue
+ Generic = 0,
+// Normal PushButton/Command Button
+ Pushbutton = 1,
+// Normal single radio button
+ Radiobutton = 2,
+// Normal single checkbox
+ Checkbox = 10,
+// Combobox, i.e. a ListBox
+// that allows data entry by user
+ Combobox = 20,
+// Control that allows text entry
+ Editbox = 30,
+// Control that allows text entry, but without the usual border
+// Has to be handled separately, because this one cannot handle
+// ControlPart::HasBackgroundTexture, which is drawn in the edit box'es
+// border window.
+ EditboxNoBorder = 31,
+// Control that allows text entry
+// ( some systems distinguish between single and multi line edit boxes )
+ MultilineEditbox = 32,
+// Control that pops up a menu,
+// but does NOT allow data entry
+ Listbox = 35,
+// An edit field together with two little
+// buttons on the side (aka spin field)
+ Spinbox = 40,
+// Two standalone spin buttons
+// without an edit field
+ SpinButtons = 45,
+// A single tab
+ TabItem = 50,
+// The border around a tab area,
+// but without the tabs themselves.
+// May have a gap at the top for
+// the active tab
+ TabPane = 55,
+// The background to the tab area
+ TabHeader = 56,
+// Background of a Tab Pane
+ TabBody = 57,
+// Normal scrollbar, including
+// all parts like slider, buttons
+ Scrollbar = 60,
+ Slider = 65,
+// A separator line
+ Fixedline = 80,
+// A toolbar control with buttons and a grip
+ Toolbar = 100,
+// The menubar
+ Menubar = 120,
+// popup menu
+ MenuPopup = 121,
+ Progress = 131,
+// Progress bar for the intro window
+// (aka splash screen), in case some
+// wants native progress bar in the
+// application but not for the splash
+// screen (used in desktop/)
+ IntroProgress = 132,
+// tool tips
+ Tooltip = 140,
+// to draw the implemented theme
+ WindowBackground = 150,
+//to draw border of frames natively
+ Frame = 160,
+// for nodes in listviews
+// used in svtools/source/contnr/svtreebx.cxx
+ ListNode = 170,
+// nets between elements of listviews
+// with nodes
+ ListNet = 171,
+// for list headers
+ ListHeader = 172,
+};
+
+
+/* Control Parts:
+ *
+ * Uniquely identify a part of a control,
+ * for example the slider of a scroll bar.
+ */
+
+enum class ControlPart
+{
+ NONE = 0,
+ Entire = 1,
+ ListboxWindow = 5, // the static listbox window containing the list
+ Button = 100,
+ ButtonUp = 101,
+ ButtonDown = 102, // Also for ComboBoxes/ListBoxes
+ ButtonLeft = 103,
+ ButtonRight = 104,
+ AllButtons = 105,
+ SeparatorHorz = 106,
+ SeparatorVert = 107,
+ TrackHorzLeft = 200,
+ TrackVertUpper = 201,
+ TrackHorzRight = 202,
+ TrackVertLower = 203,
+ TrackHorzArea = 204,
+ TrackVertArea = 205,
+ Arrow = 220,
+ ThumbHorz = 210, // Also used as toolbar grip
+ ThumbVert = 211, // Also used as toolbar grip
+ MenuItem = 250,
+ MenuItemCheckMark = 251,
+ MenuItemRadioMark = 252,
+ Separator = 253,
+ SubmenuArrow = 254,
+
+/* #i77549#
+ HACK: for scrollbars in case of thumb rect, page up and page down rect we
+ abuse the HitTestNativeScrollbar interface. All theming engines but aqua
+ are actually able to draw the thumb according to our internal representation.
+ However aqua draws a little outside. The canonical way would be to enhance the
+ HitTestNativeScrollbar passing a ScrollbarValue additionally so all necessary
+ information is available in the call.
+ .
+ However since there is only this one small exception we will deviate a little and
+ instead pass the respective rect as control region to allow for a small correction.
+
+ So all places using HitTestNativeScrollbar on ControlPart::ThumbHorz, ControlPart::ThumbVert,
+ ControlPart::TrackHorzLeft, ControlPart::TrackHorzRight, ControlPart::TrackVertUpper, ControlPart::TrackVertLower
+ do not use the control rectangle as region but the actual part rectangle, making
+ only small deviations feasible.
+*/
+
+/** The edit field part of a control, e.g. of the combo box.
+
+ Currently used just for combo boxes and just for GetNativeControlRegion().
+ It is valid only if GetNativeControlRegion() supports ControlPart::ButtonDown as
+ well.
+*/
+ SubEdit = 300,
+
+// For controls that require the entire background
+// to be drawn first, and then other pieces over top.
+// (GTK+ scrollbars for example). Control region passed
+// in to draw this part is expected to be the entire
+// area of the control.
+// A control may respond to one or both.
+ DrawBackgroundHorz = 1000,
+ DrawBackgroundVert = 1001,
+
+// GTK+ also draws tabs right->left since there is a
+// hardcoded 2 pixel overlap between adjacent tabs
+ TabsDrawRtl = 3000,
+
+// Qt doesn't have a separate header to draw
+ TabPaneWithHeader = 3001,
+
+// For themes that do not want to have the focus
+// rectangle part drawn by VCL but take care of the
+// whole inner control part by themselves
+// eg, listboxes or comboboxes or spinbuttons
+ HasBackgroundTexture = 4000,
+
+// For scrollbars that have 3 buttons (most KDE themes)
+ HasThreeButtons = 5000,
+
+ BackgroundWindow = 6000,
+ BackgroundDialog = 6001,
+
+//to draw natively the border of frames
+ Border = 7000,
+
+//to draw natively the focus rects
+ Focus = 8000
+};
+
+/* Control State:
+ *
+ * Specify how a particular part of the control
+ * is to be drawn. Constants are bitwise OR-ed
+ * together to compose a final drawing state.
+ * A _disabled_ state is assumed by the drawing
+ * functions until an ENABLED or HIDDEN is passed
+ * in the ControlState.
+ */
+enum class ControlState {
+ NONE = 0,
+ ENABLED = 0x0001,
+ FOCUSED = 0x0002,
+ PRESSED = 0x0004,
+ ROLLOVER = 0x0008,
+ DEFAULT = 0x0020,
+ SELECTED = 0x0040
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ControlState> : is_typed_flags<ControlState, 0x006f> {};
+}
+
+/* ButtonValue:
+ *
+ * Identifies the tri-state value options
+ * that buttons allow
+ */
+
+enum class ButtonValue {
+ DontKnow,
+ On,
+ Off,
+ Mixed
+};
+
+/* ImplControlValue:
+ *
+ * Generic value container for all control parts.
+ */
+
+class VCL_DLLPUBLIC ImplControlValue
+{
+ friend class SalFrame;
+
+ private:
+ ControlType mType;
+ ButtonValue mTristate; // Tristate value: on, off, mixed
+ tools::Long mNumber; // numeric value
+ protected:
+ ImplControlValue( ControlType i_eType, tools::Long i_nNumber )
+ : mType( i_eType )
+ , mTristate( ButtonValue::DontKnow )
+ , mNumber( i_nNumber )
+ {}
+
+ public:
+ explicit ImplControlValue( ButtonValue nTristate )
+ : mType( ControlType::Generic ), mTristate(nTristate), mNumber(0) {}
+ explicit ImplControlValue( tools::Long nNumeric )
+ : mType( ControlType::Generic ), mTristate(ButtonValue::DontKnow), mNumber( nNumeric) {}
+ ImplControlValue()
+ : mType( ControlType::Generic ), mTristate(ButtonValue::DontKnow), mNumber(0) {}
+
+ virtual ~ImplControlValue();
+
+ ImplControlValue(ImplControlValue const &) = default;
+ ImplControlValue(ImplControlValue &&) = default;
+ ImplControlValue & operator =(ImplControlValue const &) = delete; // due to const mType
+ ImplControlValue & operator =(ImplControlValue &&) = delete; // due to const mType
+
+ virtual ImplControlValue* clone() const;
+
+ ControlType getType() const { return mType; }
+
+ ButtonValue getTristateVal() const { return mTristate; }
+ void setTristateVal( ButtonValue nTristate ) { mTristate = nTristate; }
+
+ tools::Long getNumericVal() const { return mNumber; }
+ void setNumericVal( tools::Long nNumeric ) { mNumber = nNumeric; }
+};
+
+/* ScrollbarValue:
+ *
+ * Value container for scrollbars.
+ */
+class SAL_DLLPUBLIC_RTTI ScrollbarValue final : public ImplControlValue
+{
+ public:
+ tools::Long mnMin;
+ tools::Long mnMax;
+ tools::Long mnCur;
+ tools::Long mnVisibleSize;
+ tools::Rectangle maThumbRect;
+ tools::Rectangle maButton1Rect;
+ tools::Rectangle maButton2Rect;
+ ControlState mnButton1State;
+ ControlState mnButton2State;
+ ControlState mnThumbState;
+
+ ScrollbarValue()
+ : ImplControlValue( ControlType::Scrollbar, 0 )
+ {
+ mnMin = 0; mnMax = 0; mnCur = 0; mnVisibleSize = 0;
+ mnButton1State = ControlState::NONE; mnButton2State = ControlState::NONE;
+ mnThumbState = ControlState::NONE;
+ };
+ virtual ~ScrollbarValue() override;
+ virtual ScrollbarValue* clone() const override;
+
+ ScrollbarValue(ScrollbarValue const &) = default;
+ ScrollbarValue(ScrollbarValue &&) = default;
+ ScrollbarValue & operator =(ScrollbarValue const &) = delete; // due to ImplControlValue
+ ScrollbarValue & operator =(ScrollbarValue &&) = delete; // due to ImplControlValue
+};
+
+class SAL_DLLPUBLIC_RTTI SliderValue final : public ImplControlValue
+{
+ public:
+ tools::Long mnMin;
+ tools::Long mnMax;
+ tools::Long mnCur;
+ tools::Rectangle maThumbRect;
+ ControlState mnThumbState;
+
+ SliderValue()
+ : ImplControlValue( ControlType::Slider, 0 )
+ , mnMin( 0 ), mnMax( 0 ), mnCur( 0 ), mnThumbState( ControlState::NONE )
+ {}
+ virtual ~SliderValue() override;
+ virtual SliderValue* clone() const override;
+
+ SliderValue(SliderValue const &) = default;
+ SliderValue(SliderValue &&) = default;
+ SliderValue & operator =(SliderValue const &) = delete; // due to ImplControlValue
+ SliderValue & operator =(SliderValue &&) = delete; // due to ImplControlValue
+};
+
+class VCL_DLLPUBLIC TabPaneValue final : public ImplControlValue
+{
+public:
+ tools::Rectangle m_aTabHeaderRect;
+ tools::Rectangle m_aSelectedTabRect;
+ // increased tab size, so it'll overlab the frame rect when drawing
+ // static value, as there is currently no sane way to return additional data
+ static int m_nOverlap;
+
+ TabPaneValue(const tools::Rectangle &rTabHeaderRect, const tools::Rectangle &rSelectedTabRect)
+ : ImplControlValue(ControlType::TabPane, 0)
+ , m_aTabHeaderRect(rTabHeaderRect)
+ , m_aSelectedTabRect(rSelectedTabRect)
+ {
+ }
+ TabPaneValue* clone() const override;
+
+ TabPaneValue(TabPaneValue const &) = default;
+ TabPaneValue(TabPaneValue &&) = default;
+ TabPaneValue & operator =(TabPaneValue const &) = delete;
+ TabPaneValue & operator =(TabPaneValue &&) = delete;
+};
+
+/* TabitemValue:
+ *
+ * Value container for tabitems.
+ */
+
+/* TABITEM constants are OR-ed together */
+enum class TabitemFlags
+{
+ NONE = 0x00,
+ LeftAligned = 0x01, // the tabitem is aligned with the left border of the TabControl
+ RightAligned = 0x02, // the tabitem is aligned with the right border of the TabControl
+ FirstInGroup = 0x04, // the tabitem is the first in group of tabitems
+ LastInGroup = 0x08, // the tabitem is the last in group of tabitems
+};
+namespace o3tl
+{
+ template<> struct typed_flags<TabitemFlags> : is_typed_flags<TabitemFlags, 0x0f> {};
+}
+
+class SAL_DLLPUBLIC_RTTI TabitemValue final : public ImplControlValue
+{
+ public:
+ TabitemFlags mnAlignment;
+ tools::Rectangle maContentRect;
+
+ TabitemValue(const tools::Rectangle &rContentRect)
+ : ImplControlValue( ControlType::TabItem, 0 )
+ , mnAlignment(TabitemFlags::NONE)
+ , maContentRect(rContentRect)
+ {
+ }
+ virtual ~TabitemValue() override;
+ virtual TabitemValue* clone() const override;
+
+ TabitemValue(TabitemValue const &) = default;
+ TabitemValue(TabitemValue &&) = default;
+ TabitemValue & operator =(TabitemValue const &) = delete; // due to ImplControlValue
+ TabitemValue & operator =(TabitemValue &&) = delete; // due to ImplControlValue
+
+ bool isLeftAligned() const { return bool(mnAlignment & TabitemFlags::LeftAligned); }
+ bool isRightAligned() const { return bool(mnAlignment & TabitemFlags::RightAligned); }
+ bool isBothAligned() const { return isLeftAligned() && isRightAligned(); }
+ bool isNotAligned() const { return !(mnAlignment & (TabitemFlags::LeftAligned | TabitemFlags::RightAligned)); }
+ bool isFirst() const { return bool(mnAlignment & TabitemFlags::FirstInGroup); }
+ bool isLast() const { return bool(mnAlignment & TabitemFlags::LastInGroup); }
+ const tools::Rectangle& getContentRect() const { return maContentRect; }
+};
+
+/* SpinbuttonValue:
+ *
+ * Value container for spinbuttons to paint both buttons at once.
+ * Note: the other parameters of DrawNativeControl will have no meaning
+ * all parameters for spinbuttons are carried here
+ */
+class SAL_DLLPUBLIC_RTTI SpinbuttonValue final : public ImplControlValue
+{
+ public:
+ tools::Rectangle maUpperRect;
+ tools::Rectangle maLowerRect;
+ ControlState mnUpperState;
+ ControlState mnLowerState;
+ ControlPart mnUpperPart;
+ ControlPart mnLowerPart;
+
+ SpinbuttonValue()
+ : ImplControlValue( ControlType::SpinButtons, 0 )
+ , mnUpperState(ControlState::NONE)
+ , mnLowerState(ControlState::NONE)
+ , mnUpperPart(ControlPart::NONE)
+ , mnLowerPart(ControlPart::NONE)
+ {
+ }
+
+ virtual ~SpinbuttonValue() override;
+ virtual SpinbuttonValue* clone() const override;
+
+ SpinbuttonValue(SpinbuttonValue const &) = default;
+ SpinbuttonValue(SpinbuttonValue &&) = default;
+ SpinbuttonValue & operator =(SpinbuttonValue const &) = delete; // due to ImplControlValue
+ SpinbuttonValue & operator =(SpinbuttonValue &&) = delete; // due to ImplControlValue
+};
+
+/* MenubarValue:
+ *
+ * Value container for menubars specifying height of adjacent docking area
+ */
+class MenubarValue final : public ImplControlValue
+{
+public:
+ MenubarValue() : ImplControlValue( ControlType::Menubar, 0 )
+ { maTopDockingAreaHeight=0; }
+ virtual ~MenubarValue() override;
+ virtual MenubarValue* clone() const override;
+ MenubarValue(MenubarValue const &) = default;
+ MenubarValue(MenubarValue &&) = default;
+ MenubarValue & operator =(MenubarValue const &) = delete; // due to ImplControlValue
+ MenubarValue & operator =(MenubarValue &&) = delete; // due to ImplControlValue
+ int maTopDockingAreaHeight;
+};
+
+/* MenupopupValue:
+ *
+ * Value container for menu items; specifies the rectangle for the whole item which
+ * may be useful when drawing parts with a smaller rectangle.
+ */
+class SAL_DLLPUBLIC_RTTI MenupopupValue final : public ImplControlValue
+{
+public:
+ MenupopupValue( tools::Long i_nGutterWidth, const tools::Rectangle& i_rItemRect )
+ : ImplControlValue( ControlType::MenuPopup, i_nGutterWidth )
+ , maItemRect( i_rItemRect )
+ {}
+ virtual ~MenupopupValue() override;
+ virtual MenupopupValue* clone() const override;
+ MenupopupValue(MenupopupValue const &) = default;
+ MenupopupValue(MenupopupValue &&) = default;
+ MenupopupValue & operator =(MenupopupValue const &) = delete; // due to ImplControlValue
+ MenupopupValue & operator =(MenupopupValue &&) = delete; // due to ImplControlValue
+ tools::Rectangle maItemRect;
+};
+
+/* PushButtonValue:
+ *
+ * Value container for pushbuttons specifying additional drawing hints
+ */
+class VCL_DLLPUBLIC PushButtonValue final : public ImplControlValue
+{
+public:
+ PushButtonValue()
+ : ImplControlValue( ControlType::Pushbutton, 0 )
+ , mbBevelButton(false)
+ , mbSingleLine(true)
+ , mbIsAction(false)
+ , m_bFlatButton(false)
+ {}
+
+ virtual ~PushButtonValue() override;
+ virtual PushButtonValue* clone() const override;
+
+ PushButtonValue(PushButtonValue const &) = default;
+ PushButtonValue(PushButtonValue &&) = default;
+ PushButtonValue & operator =(PushButtonValue const &) = delete; // due to ImplControlValue
+ PushButtonValue & operator =(PushButtonValue &&) = delete; // due to ImplControlValue
+
+ bool mbBevelButton:1; // only used on OSX
+ bool mbSingleLine:1; // only used on OSX
+ bool mbIsAction:1;
+ bool m_bFlatButton:1;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
new file mode 100644
index 000000000..1b6340413
--- /dev/null
+++ b/include/vcl/scheduler.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SCHEDULER_HXX
+#define INCLUDED_VCL_SCHEDULER_HXX
+
+#include <vcl/dllapi.h>
+
+struct ImplSchedulerContext;
+
+class VCL_DLLPUBLIC Scheduler final
+{
+ friend class SchedulerGuard;
+ friend class Task;
+ Scheduler() = delete;
+
+ static inline void UpdateSystemTimer( ImplSchedulerContext &rSchedCtx,
+ sal_uInt64 nMinPeriod,
+ bool bForce, sal_uInt64 nTime );
+
+ static void ImplStartTimer ( sal_uInt64 nMS, bool bForce, sal_uInt64 nTime );
+
+ static void Lock();
+ static void Unlock();
+
+public:
+ static constexpr sal_uInt64 ImmediateTimeoutMs = 0;
+ static constexpr sal_uInt64 InfiniteTimeoutMs = SAL_MAX_UINT64;
+
+ static void ImplDeInitScheduler();
+
+ /**
+ * System timer callback function, which processes one LO task
+ *
+ * Will restart the system timer, so it will process further tasks at the right time.
+ **/
+ static void CallbackTaskScheduling();
+
+ /**
+ * Process all events until none is pending
+ *
+ * This can busy-lock, if some task or system event always generates new
+ * events when being processed. Most time it's called in unit tests to
+ * process all pending events. Internally it just calls
+ * Application::Reschedule( true ) until it fails.
+ *
+ * @see Application::Reschedule
+ */
+ static void ProcessEventsToIdle();
+
+ /**
+ * Wakes up the scheduler
+ *
+ * This doesn't handle any events! It just ensures the Scheduler is run as
+ * soon as possible by forcing the Scheduler timer to fire.
+ *
+ * Can be used for complex UpdateMinPeriod function, where the task is
+ * actually active but not ready and we want to skip the Task::Start()
+ * queue append for faster reaction.
+ */
+ static void Wakeup();
+
+ /// Control the deterministic mode. In this mode, two subsequent runs of
+ /// LibreOffice fire about the same amount idles.
+ static void SetDeterministicMode(bool bDeterministic);
+ /// Return the current state of deterministic mode.
+ static bool GetDeterministicMode();
+};
+
+#endif // INCLUDED_VCL_SCHEDULER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/scopedbitmapaccess.hxx b/include/vcl/scopedbitmapaccess.hxx
new file mode 100644
index 000000000..b06618091
--- /dev/null
+++ b/include/vcl/scopedbitmapaccess.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SCOPEDBITMAPACCESS_HXX
+#define INCLUDED_VCL_SCOPEDBITMAPACCESS_HXX
+
+#include <sal/types.h>
+
+namespace vcl
+{
+
+/** This template handles BitmapAccess the RAII way.
+
+ Please don't use directly, but through the ready-made typedefs
+ ScopedReadAccess and ScopedWriteAccess in classes Bitmap and
+ AlphaMask.
+
+ Use as follows:
+ Bitmap aBitmap;
+ Bitmap::ScopedReadAccess pReadAccess( aBitmap );
+ pReadAccess->SetPixel()...
+
+ Bitmap aBitmap2;
+ BitmapScopedWriteAccess pWriteAccess( bCond ? aBitmap2.AcquireWriteAccess() : 0, aBitmap2 );
+ if ( pWriteAccess )...
+
+ @attention for practical reasons, ScopedBitmapAccess stores a
+ reference to the provided bitmap, thus, make sure that the bitmap
+ specified at construction time lives at least as long as the
+ ScopedBitmapAccess.
+ */
+template < class Access, class Bitmap, Access* (Bitmap::* Acquire)() > class ScopedBitmapAccess
+{
+public:
+ explicit ScopedBitmapAccess( Bitmap& rBitmap ) :
+ mpAccess( nullptr ),
+ mpBitmap( &rBitmap )
+ {
+ mpAccess = (mpBitmap->*Acquire)();
+ }
+
+ ScopedBitmapAccess( Access* pAccess, Bitmap& rBitmap ) :
+ mpAccess( pAccess ),
+ mpBitmap( &rBitmap )
+ {
+ }
+
+ ScopedBitmapAccess( ) :
+ mpAccess( nullptr ),
+ mpBitmap( nullptr )
+ {
+ }
+
+ // Move semantics
+ ScopedBitmapAccess &operator=(ScopedBitmapAccess&&other)
+ {
+ mpAccess=other.mpAccess;
+ mpBitmap=other.mpBitmap;
+ other.mpAccess = nullptr;
+ other.mpBitmap = nullptr;
+ return *this;
+ }
+
+ // Disable copy from lvalue.
+ ScopedBitmapAccess(const ScopedBitmapAccess&) = delete;
+ ScopedBitmapAccess &operator=(const ScopedBitmapAccess&) = delete;
+
+ ~ScopedBitmapAccess() COVERITY_NOEXCEPT_FALSE
+ {
+ if (mpAccess)
+ mpBitmap->ReleaseAccess( mpAccess );
+ }
+
+ void reset()
+ {
+ if (mpAccess)
+ {
+ mpBitmap->ReleaseAccess( mpAccess );
+ mpAccess = nullptr;
+ }
+ }
+
+ bool operator!() const { return !mpAccess; }
+ explicit operator bool() const
+ {
+ return mpAccess;
+ }
+
+ Access* get() { return mpAccess; }
+ const Access* get() const { return mpAccess; }
+
+ Access* operator->() { return mpAccess; }
+ const Access* operator->() const { return mpAccess; }
+
+ Access& operator*() { return *mpAccess; }
+ const Access& operator*() const { return *mpAccess; }
+
+private:
+ Access* mpAccess;
+ Bitmap* mpBitmap;
+};
+
+}
+
+#endif // INCLUDED_VCL_SCOPEDBITMAPACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/scrbar.hxx b/include/vcl/scrbar.hxx
new file mode 100644
index 000000000..77cbbb657
--- /dev/null
+++ b/include/vcl/scrbar.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SCRBAR_HXX
+#define INCLUDED_VCL_SCRBAR_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/ctrl.hxx>
+#include <memory>
+
+
+enum class ScrollType
+{
+ DontKnow,
+ LineUp, LineDown,
+ PageUp, PageDown,
+ Drag
+};
+
+
+struct ImplScrollBarData;
+
+class VCL_DLLPUBLIC ScrollBar : public Control
+{
+private:
+ tools::Rectangle maBtn1Rect;
+ tools::Rectangle maBtn2Rect;
+ tools::Rectangle maPage1Rect;
+ tools::Rectangle maPage2Rect;
+ tools::Rectangle maThumbRect;
+ tools::Rectangle maTrackRect;
+ std::unique_ptr<ImplScrollBarData> mpData;
+ tools::Long mnStartPos;
+ tools::Long mnMouseOff;
+ tools::Long mnThumbPixRange;
+ tools::Long mnThumbPixPos;
+ tools::Long mnThumbPixSize;
+ tools::Long mnMinRange;
+ tools::Long mnMaxRange;
+ tools::Long mnThumbPos;
+ tools::Long mnVisibleSize;
+ tools::Long mnLineSize;
+ tools::Long mnPageSize;
+ tools::Long mnDelta;
+ sal_uInt16 mnStateFlags;
+ ScrollType meScrollType;
+ bool mbCalcSize;
+ bool mbFullDrag;
+ Link<ScrollBar*,void> maScrollHdl;
+ Link<ScrollBar*,void> maEndScrollHdl;
+
+ SAL_DLLPRIVATE tools::Rectangle* ImplFindPartRect( const Point& rPt );
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE void ImplInitStyle( WinBits nStyle );
+ SAL_DLLPRIVATE void ImplUpdateRects( bool bUpdate = true );
+ SAL_DLLPRIVATE tools::Long ImplCalcThumbPos( tools::Long nPixPos ) const;
+ SAL_DLLPRIVATE tools::Long ImplCalcThumbPosPix( tools::Long nPos ) const;
+ SAL_DLLPRIVATE void ImplCalc( bool bUpdate = true );
+ SAL_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext);
+ using Window::ImplScroll;
+ SAL_DLLPRIVATE tools::Long ImplScroll( tools::Long nNewPos, bool bCallEndScroll );
+ SAL_DLLPRIVATE tools::Long ImplDoAction( bool bCallEndScroll );
+ SAL_DLLPRIVATE void ImplDoMouseAction( const Point& rPos, bool bCallAction = true );
+ SAL_DLLPRIVATE void ImplInvert();
+ SAL_DLLPRIVATE bool ImplDrawNative(vcl::RenderContext& rRenderContext, sal_uInt16 SystemTextColorFlags);
+ SAL_DLLPRIVATE void ImplDragThumb( const Point& rMousePos );
+ SAL_DLLPRIVATE Size getCurrentCalcSize() const;
+ DECL_DLLPRIVATE_LINK( ImplAutoTimerHdl, Timer*, void );
+
+public:
+ explicit ScrollBar( vcl::Window* pParent, WinBits nStyle = WB_VERT );
+ virtual ~ScrollBar() override;
+ virtual void dispose() override;
+
+ virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual void Tracking(const TrackingEvent& rTEvt) override;
+ virtual void KeyInput(const KeyEvent& rKEvt) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void Draw(OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags) override;
+ virtual void Move() override;
+ virtual void Resize() override;
+ virtual void StateChanged(StateChangedType nType) override;
+ virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
+ virtual bool PreNotify(NotifyEvent& rNEvt) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+
+ using Window::Scroll;
+ void Scroll();
+ virtual void EndScroll();
+
+ tools::Long DoScroll( tools::Long nNewPos );
+ tools::Long DoScrollAction( ScrollType eScrollType );
+
+ void EnableDrag() { mbFullDrag = true; }
+
+ void SetRangeMin( tools::Long nNewRange );
+ tools::Long GetRangeMin() const { return mnMinRange; }
+ void SetRangeMax( tools::Long nNewRange );
+ tools::Long GetRangeMax() const { return mnMaxRange; }
+ void SetRange( const Range& rRange );
+ Range GetRange() const { return Range( GetRangeMin(), GetRangeMax() ); }
+ void SetThumbPos( tools::Long nThumbPos );
+ tools::Long GetThumbPos() const { return mnThumbPos; }
+ void SetLineSize( tools::Long nNewSize ) { mnLineSize = nNewSize; }
+ tools::Long GetLineSize() const { return mnLineSize; }
+ void SetPageSize( tools::Long nNewSize ) { mnPageSize = nNewSize; }
+ tools::Long GetPageSize() const { return mnPageSize; }
+ void SetVisibleSize( tools::Long nNewSize );
+ tools::Long GetVisibleSize() const { return mnVisibleSize; }
+
+ tools::Long GetDelta() const { return mnDelta; }
+ ScrollType GetType() const { return meScrollType; }
+
+ void SetScrollHdl( const Link<ScrollBar*,void>& rLink ) { maScrollHdl = rLink; }
+ const Link<ScrollBar*,void>& GetScrollHdl() const { return maScrollHdl; }
+ void SetEndScrollHdl( const Link<ScrollBar*,void>& rLink ) { maEndScrollHdl = rLink; }
+
+ virtual Size GetOptimalSize() const override;
+};
+
+
+class VCL_DLLPUBLIC ScrollBarBox final : public vcl::Window
+{
+private:
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+
+public:
+ explicit ScrollBarBox( vcl::Window* pParent, WinBits nStyle = 0 );
+
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+};
+
+#endif // INCLUDED_VCL_SCRBAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/seleng.hxx b/include/vcl/seleng.hxx
new file mode 100644
index 000000000..580ae7417
--- /dev/null
+++ b/include/vcl/seleng.hxx
@@ -0,0 +1,240 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SELENG_HXX
+#define INCLUDED_VCL_SELENG_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/timer.hxx>
+#include <vcl/event.hxx>
+#include <vcl/vclenum.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+class CommandEvent;
+
+namespace vcl {
+ class Window;
+}
+
+// Timerticks
+#define SELENG_DRAGDROP_TIMEOUT 400
+#define SELENG_AUTOREPEAT_INTERVAL 50
+#define SELENG_AUTOREPEAT_INTERVAL_MIN 25
+#define SELENG_AUTOREPEAT_INTERVAL_MAX 300
+
+class VCL_DLLPUBLIC FunctionSet
+{
+public:
+ virtual ~FunctionSet() = 0;
+
+ virtual void BeginDrag() = 0;
+
+ virtual void CreateAnchor() = 0; // Anker-Pos := Cursor-Pos
+ virtual void DestroyAnchor() = 0;
+
+ // move cursor, at the same time match cursor position to the selection
+ // starting at anchor. true == Ok
+ virtual void SetCursorAtPoint( const Point& rPointPixel,
+ bool bDontSelectAtCursor = false ) = 0;
+
+ virtual bool IsSelectionAtPoint( const Point& rPointPixel ) = 0;
+ virtual void DeselectAtPoint( const Point& rPointPixel ) = 0;
+ // delete anchor & deselect all
+ virtual void DeselectAll() = 0;
+};
+
+
+enum class SelectionEngineFlags {
+ DRG_ENAB = 0x0001,
+ IN_SEL = 0x0002,
+ IN_ADD = 0x0004,
+ ADD_ALW = 0x0008,
+ HAS_ANCH = 0x0020,
+ CMDEVT = 0x0040,
+ WAIT_UPEVT = 0x0080,
+ EXPANDONMOVE = 0x0100,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SelectionEngineFlags> : is_typed_flags<SelectionEngineFlags, 0x01ef> {};
+}
+
+class VCL_DLLPUBLIC SelectionEngine
+{
+private:
+ FunctionSet* pFunctionSet;
+ VclPtr<vcl::Window> pWin;
+ tools::Rectangle aArea;
+ Timer aWTimer; // generate fake mouse moves
+ MouseEvent aLastMove;
+ SelectionMode eSelMode;
+ sal_uLong nUpdateInterval;
+ sal_uInt16 nLockedMods;
+ SelectionEngineFlags nFlags;
+ DECL_DLLPRIVATE_LINK( ImpWatchDog, Timer*, void );
+
+ inline bool ShouldDeselect( bool bModifierKey1 ) const;
+ // determines to deselect or not when Ctrl-key is pressed on CursorPosChanging
+public:
+
+ SelectionEngine( vcl::Window* pWindow,
+ FunctionSet* pFunctions = nullptr );
+ ~SelectionEngine();
+ // Avoid implicitly defined copy constructors/assignments for the
+ // DLLPUBLIC class (they may require forward-declared classes used
+ // internally to be defined in places using SelectionEngine)
+ SelectionEngine(const SelectionEngine&) = delete;
+ SelectionEngine(SelectionEngine&&) = delete;
+ SelectionEngine& operator=(const SelectionEngine&) = delete;
+ SelectionEngine& operator=(SelectionEngine&&) = delete;
+
+ // true: Event was processed by Selection Engine
+ bool SelMouseButtonDown( const MouseEvent& rMEvt );
+ bool SelMouseButtonUp( const MouseEvent& rMEvt );
+ bool SelMouseMove( const MouseEvent& rMEvt );
+ //SelMouseButtonDown captures mouse events, SelMouseButtonUp
+ //releases the capture. If you need to release the mouse
+ //capture after SelMouseButtonDown but before
+ //SelMouseButtonUp, e.g. to allow events to go to a
+ //context menu via "Command" which is delivered after
+ //mouse down but before mouse up, then use this
+ void ReleaseMouse();
+ void CaptureMouse();
+
+ // Keyboard
+ void CursorPosChanging( bool bShift, bool bMod1 );
+
+ // is needed to generate a Move event via a Timer
+ // when the mouse is outside the area
+ void SetVisibleArea( const tools::Rectangle& rNewArea )
+ { aArea = rNewArea; }
+
+ void SetAddMode( bool);
+ bool IsAddMode() const;
+
+ void AddAlways( bool bOn );
+ bool IsAlwaysAdding() const;
+
+ void EnableDrag( bool bOn );
+
+ void SetSelectionMode( SelectionMode eMode );
+ SelectionMode GetSelectionMode() const { return eSelMode; }
+
+ void SetFunctionSet( FunctionSet* pFuncs )
+ { pFunctionSet = pFuncs; }
+ const FunctionSet* GetFunctionSet() const { return pFunctionSet; }
+
+ const Point& GetMousePosPixel() const
+ { return aLastMove.GetPosPixel(); }
+ const MouseEvent& GetMouseEvent() const { return aLastMove; }
+
+ void SetWindow( vcl::Window*);
+ vcl::Window* GetWindow() const { return pWin; }
+
+ void LockModifiers( sal_uInt16 nModifiers )
+ { nLockedMods = nModifiers; }
+ sal_uInt16 GetLockedModifiers() const { return nLockedMods; }
+
+ bool IsInSelection() const;
+ void Reset();
+
+ bool Command(const CommandEvent& rCEvt);
+
+ bool HasAnchor() const;
+ void SetAnchor( bool bAnchor );
+
+ void SetUpdateInterval( sal_uLong nInterval );
+
+ // is switched on in the Ctor
+ void ExpandSelectionOnMouseMove( bool bExpand = true )
+ {
+ if( bExpand )
+ nFlags |= SelectionEngineFlags::EXPANDONMOVE;
+ else
+ nFlags &= ~SelectionEngineFlags::EXPANDONMOVE;
+ }
+};
+
+inline bool SelectionEngine::IsAddMode() const
+{
+ if ( nFlags & (SelectionEngineFlags::IN_ADD | SelectionEngineFlags::ADD_ALW) )
+ return true;
+ else
+ return false;
+}
+
+inline void SelectionEngine::SetAddMode( bool bNewMode )
+{
+ if ( bNewMode )
+ nFlags |= SelectionEngineFlags::IN_ADD;
+ else
+ nFlags &= ~SelectionEngineFlags::IN_ADD;
+}
+
+inline void SelectionEngine::EnableDrag( bool bOn )
+{
+ if ( bOn )
+ nFlags |= SelectionEngineFlags::DRG_ENAB;
+ else
+ nFlags &= ~SelectionEngineFlags::DRG_ENAB;
+}
+
+inline void SelectionEngine::AddAlways( bool bOn )
+{
+ if( bOn )
+ nFlags |= SelectionEngineFlags::ADD_ALW;
+ else
+ nFlags &= ~SelectionEngineFlags::ADD_ALW;
+}
+
+inline bool SelectionEngine::IsAlwaysAdding() const
+{
+ if ( nFlags & SelectionEngineFlags::ADD_ALW )
+ return true;
+ else
+ return false;
+}
+
+inline bool SelectionEngine::IsInSelection() const
+{
+ if ( nFlags & SelectionEngineFlags::IN_SEL )
+ return true;
+ else
+ return false;
+}
+
+inline bool SelectionEngine::HasAnchor() const
+{
+ if ( nFlags & SelectionEngineFlags::HAS_ANCH )
+ return true;
+ else
+ return false;
+}
+
+inline void SelectionEngine::SetAnchor( bool bAnchor )
+{
+ if ( bAnchor )
+ nFlags |= SelectionEngineFlags::HAS_ANCH;
+ else
+ nFlags &= ~SelectionEngineFlags::HAS_ANCH;
+}
+
+#endif // INCLUDED_VCL_SELENG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
new file mode 100644
index 000000000..679515081
--- /dev/null
+++ b/include/vcl/settings.hxx
@@ -0,0 +1,726 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SETTINGS_HXX
+#define INCLUDED_VCL_SETTINGS_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <memory>
+#include <vector>
+
+#include <optional>
+
+class BitmapEx;
+class LanguageTag;
+class SvtSysLocale;
+
+class LocaleDataWrapper;
+struct ImplMouseData;
+struct ImplMiscData;
+struct ImplHelpData;
+struct ImplStyleData;
+struct ImplAllSettingsData;
+enum class ConfigurationHints;
+
+namespace vcl {
+ class Font;
+ class I18nHelper;
+ class IconThemeInfo;
+}
+
+
+enum class MouseSettingsOptions
+{
+ NONE = 0x00,
+ AutoCenterPos = 0x02,
+ AutoDefBtnPos = 0x04,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<MouseSettingsOptions> : is_typed_flags<MouseSettingsOptions, 0x06> {};
+}
+
+enum class MouseFollowFlags
+{
+ Menu = 0x0001,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<MouseFollowFlags> : is_typed_flags<MouseFollowFlags, 0x01> {};
+}
+
+enum class MouseMiddleButtonAction
+{
+ Nothing, AutoScroll, PasteSelection
+};
+
+enum class MouseWheelBehaviour
+{
+ Disable, FocusOnly, ALWAYS
+};
+
+class VCL_DLLPUBLIC MouseSettings
+{
+private:
+ void CopyData();
+ std::shared_ptr<ImplMouseData> mxData;
+
+public:
+ MouseSettings();
+
+ void SetOptions( MouseSettingsOptions nOptions );
+ MouseSettingsOptions GetOptions() const;
+
+ void SetDoubleClickTime( sal_uInt64 nDoubleClkTime );
+ sal_uInt64 GetDoubleClickTime() const;
+
+ void SetDoubleClickWidth( sal_Int32 nDoubleClkWidth );
+ sal_Int32 GetDoubleClickWidth() const;
+
+ void SetDoubleClickHeight( sal_Int32 nDoubleClkHeight );
+ sal_Int32 GetDoubleClickHeight() const;
+
+ void SetStartDragWidth( sal_Int32 nDragWidth );
+ sal_Int32 GetStartDragWidth() const;
+
+ void SetStartDragHeight( sal_Int32 nDragHeight );
+ sal_Int32 GetStartDragHeight() const;
+
+ static sal_uInt16 GetStartDragCode();
+
+ static sal_uInt16 GetContextMenuCode();
+
+ static sal_uInt16 GetContextMenuClicks();
+
+ static sal_Int32 GetScrollRepeat();
+
+ static sal_Int32 GetButtonStartRepeat();
+
+ void SetButtonRepeat( sal_Int32 nRepeat );
+ sal_Int32 GetButtonRepeat() const;
+
+ static sal_Int32 GetActionDelay();
+
+ void SetMenuDelay( sal_Int32 nDelay );
+ sal_Int32 GetMenuDelay() const;
+
+ void SetFollow( MouseFollowFlags nFollow );
+ MouseFollowFlags GetFollow() const;
+
+ void SetMiddleButtonAction( MouseMiddleButtonAction nAction );
+ MouseMiddleButtonAction GetMiddleButtonAction() const;
+
+ void SetWheelBehavior( MouseWheelBehaviour nBehavior );
+ MouseWheelBehaviour GetWheelBehavior() const;
+
+ bool operator ==( const MouseSettings& rSet ) const;
+ bool operator !=( const MouseSettings& rSet ) const;
+};
+
+struct DialogStyle
+{
+ int content_area_border;
+ int button_spacing;
+ int action_area_border;
+ DialogStyle()
+ : content_area_border(2)
+ , button_spacing(6)
+ , action_area_border(5)
+ {}
+};
+
+enum class StyleSettingsOptions
+{
+ NONE = 0x0000,
+ Mono = 0x0001,
+ NoMnemonics = 0x0002,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<StyleSettingsOptions> : is_typed_flags<StyleSettingsOptions, 0x0003> {};
+}
+
+enum class DragFullOptions
+{
+ NONE = 0x0000,
+ WindowMove = 0x0001,
+ WindowSize = 0x0002,
+ Docking = 0x0010,
+ Split = 0x0020,
+ Scroll = 0x0040,
+ All = WindowMove | WindowSize | Docking | Split | Scroll,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<DragFullOptions> : is_typed_flags<DragFullOptions, 0x0073> {};
+}
+
+enum class SelectionOptions
+{
+ NONE = 0x0000,
+ ShowFirst = 0x0004,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SelectionOptions> : is_typed_flags<SelectionOptions, 0x0004> {};
+}
+
+enum class DisplayOptions
+{
+ NONE = 0x0000,
+ AADisable = 0x0001,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<DisplayOptions> : is_typed_flags<DisplayOptions, 0x0001> {};
+}
+
+enum class ToolbarIconSize
+{
+ Unknown = 0,
+ Small = 1, // unused
+ Large = 2,
+ Size32 = 3,
+};
+
+#define STYLE_CURSOR_NOBLINKTIME SAL_MAX_UINT64
+
+class VCL_DLLPUBLIC StyleSettings
+{
+ void CopyData();
+
+private:
+ std::shared_ptr<ImplStyleData> mxData;
+
+public:
+ StyleSettings();
+
+ void Set3DColors( const Color& rColor );
+
+ void SetFaceColor( const Color& rColor );
+ const Color& GetFaceColor() const;
+
+ Color GetFaceGradientColor() const;
+
+ Color GetSeparatorColor() const;
+
+ void SetCheckedColor( const Color& rColor );
+ void SetCheckedColorSpecialCase( );
+ const Color& GetCheckedColor() const;
+
+ void SetLightColor( const Color& rColor );
+ const Color& GetLightColor() const;
+
+ void SetLightBorderColor( const Color& rColor );
+ const Color& GetLightBorderColor() const;
+
+ void SetShadowColor( const Color& rColor );
+ const Color& GetShadowColor() const;
+
+ void SetDarkShadowColor( const Color& rColor );
+ const Color& GetDarkShadowColor() const;
+
+ void SetDefaultButtonTextColor( const Color& rColor );
+ const Color& GetDefaultButtonTextColor() const;
+
+ void SetButtonTextColor( const Color& rColor );
+ const Color& GetButtonTextColor() const;
+
+ void SetDefaultActionButtonTextColor( const Color& rColor );
+ const Color& GetDefaultActionButtonTextColor() const;
+
+ void SetActionButtonTextColor( const Color& rColor );
+ const Color& GetActionButtonTextColor() const;
+
+ void SetFlatButtonTextColor( const Color& rColor );
+ const Color& GetFlatButtonTextColor() const;
+
+ void SetDefaultButtonRolloverTextColor( const Color& rColor );
+ const Color& GetDefaultButtonRolloverTextColor() const;
+
+ void SetButtonRolloverTextColor( const Color& rColor );
+ const Color& GetButtonRolloverTextColor() const;
+
+ void SetDefaultActionButtonRolloverTextColor( const Color& rColor );
+ const Color& GetDefaultActionButtonRolloverTextColor() const;
+
+ void SetActionButtonRolloverTextColor( const Color& rColor );
+ const Color& GetActionButtonRolloverTextColor() const;
+
+ void SetFlatButtonRolloverTextColor( const Color& rColor );
+ const Color& GetFlatButtonRolloverTextColor() const;
+
+ void SetDefaultButtonPressedRolloverTextColor( const Color& rColor );
+ const Color& GetDefaultButtonPressedRolloverTextColor() const;
+
+ void SetButtonPressedRolloverTextColor( const Color& rColor );
+ const Color& GetButtonPressedRolloverTextColor() const;
+
+ void SetDefaultActionButtonPressedRolloverTextColor( const Color& rColor );
+ const Color& GetDefaultActionButtonPressedRolloverTextColor() const;
+
+ void SetActionButtonPressedRolloverTextColor( const Color& rColor );
+ const Color& GetActionButtonPressedRolloverTextColor() const;
+
+ void SetFlatButtonPressedRolloverTextColor( const Color& rColor );
+ const Color& GetFlatButtonPressedRolloverTextColor() const;
+
+ void SetRadioCheckTextColor( const Color& rColor );
+ const Color& GetRadioCheckTextColor() const;
+
+ void SetGroupTextColor( const Color& rColor );
+ const Color& GetGroupTextColor() const;
+
+ void SetLabelTextColor( const Color& rColor );
+ const Color& GetLabelTextColor() const;
+
+ void SetWindowColor( const Color& rColor );
+ const Color& GetWindowColor() const;
+
+ void SetWindowTextColor( const Color& rColor );
+ const Color& GetWindowTextColor() const;
+
+ void SetDialogColor( const Color& rColor );
+ const Color& GetDialogColor() const;
+
+ void SetDialogTextColor( const Color& rColor );
+ const Color& GetDialogTextColor() const;
+
+ void SetWorkspaceColor( const Color& rColor );
+ const Color& GetWorkspaceColor() const;
+
+ void SetFieldColor( const Color& rColor );
+ const Color& GetFieldColor() const;
+
+ void SetFieldTextColor( const Color& rColor );
+ const Color& GetFieldTextColor() const;
+
+ void SetFieldRolloverTextColor( const Color& rColor );
+ const Color& GetFieldRolloverTextColor() const;
+
+ void SetActiveColor( const Color& rColor );
+ const Color& GetActiveColor() const;
+
+ void SetActiveTextColor( const Color& rColor );
+ const Color& GetActiveTextColor() const;
+
+ void SetActiveBorderColor( const Color& rColor );
+ const Color& GetActiveBorderColor() const;
+
+ void SetDeactiveColor( const Color& rColor );
+ const Color& GetDeactiveColor() const;
+
+ void SetDeactiveTextColor( const Color& rColor );
+ const Color& GetDeactiveTextColor() const;
+
+ void SetDeactiveBorderColor( const Color& rColor );
+ const Color& GetDeactiveBorderColor() const;
+
+ void SetHighlightColor( const Color& rColor );
+ const Color& GetHighlightColor() const;
+
+ void SetHighlightTextColor( const Color& rColor );
+ const Color& GetHighlightTextColor() const;
+
+ void SetDisableColor( const Color& rColor );
+ const Color& GetDisableColor() const;
+
+ void SetWarningColor( const Color& rColor );
+ const Color& GetWarningColor() const;
+
+ void SetHelpColor( const Color& rColor );
+ const Color& GetHelpColor() const;
+
+ void SetHelpTextColor( const Color& rColor );
+ const Color& GetHelpTextColor() const;
+
+ void SetMenuColor( const Color& rColor );
+ const Color& GetMenuColor() const;
+
+ void SetMenuBarColor( const Color& rColor );
+ const Color& GetMenuBarColor() const;
+
+ void SetMenuBarRolloverColor( const Color& rColor );
+ const Color& GetMenuBarRolloverColor() const;
+
+ void SetMenuBorderColor( const Color& rColor );
+ const Color& GetMenuBorderColor() const;
+
+ void SetMenuTextColor( const Color& rColor );
+ const Color& GetMenuTextColor() const;
+
+ void SetMenuBarTextColor( const Color& rColor );
+ const Color& GetMenuBarTextColor() const;
+
+ void SetMenuBarRolloverTextColor( const Color& rColor );
+ const Color& GetMenuBarRolloverTextColor() const;
+
+ void SetMenuBarHighlightTextColor( const Color& rColor );
+ const Color& GetMenuBarHighlightTextColor() const;
+
+ void SetMenuHighlightColor( const Color& rColor );
+ const Color& GetMenuHighlightColor() const;
+
+ void SetMenuHighlightTextColor( const Color& rColor );
+ const Color& GetMenuHighlightTextColor() const;
+
+ void SetTabTextColor( const Color& rColor );
+ const Color& GetTabTextColor() const;
+
+ void SetTabRolloverTextColor( const Color& rColor );
+ const Color& GetTabRolloverTextColor() const;
+
+ void SetTabHighlightTextColor( const Color& rColor );
+ const Color& GetTabHighlightTextColor() const;
+
+ void SetToolTextColor( const Color& rColor );
+ const Color& GetToolTextColor() const;
+
+ void SetLinkColor( const Color& rColor );
+ const Color& GetLinkColor() const;
+
+ void SetVisitedLinkColor( const Color& rColor );
+ const Color& GetVisitedLinkColor() const;
+
+ void SetMonoColor( const Color& rColor );
+ const Color& GetMonoColor() const;
+
+ void SetActiveTabColor( const Color& rColor );
+ const Color& GetActiveTabColor() const;
+
+ void SetInactiveTabColor( const Color& rColor );
+ const Color& GetInactiveTabColor() const;
+
+ void SetAlternatingRowColor(const Color& rColor);
+ const Color& GetAlternatingRowColor() const;
+
+ void SetHighContrastMode(bool bHighContrast );
+ bool GetHighContrastMode() const;
+
+ void SetUseSystemUIFonts( bool bUseSystemUIFonts );
+ bool GetUseSystemUIFonts() const;
+
+ void SetUseFontAAFromSystem(bool bUseFontAAFromSystem);
+ bool GetUseFontAAFromSystem() const;
+
+ void SetUseFlatBorders( bool bUseFlatBorders );
+ bool GetUseFlatBorders() const;
+
+ void SetUseFlatMenus( bool bUseFlatMenus );
+ bool GetUseFlatMenus() const;
+
+ void SetUseImagesInMenus( TriState eUseImagesInMenus );
+ bool GetUseImagesInMenus() const;
+
+ void SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus );
+ bool GetPreferredUseImagesInMenus() const;
+
+ void SetSkipDisabledInMenus( bool bSkipDisabledInMenus );
+ bool GetSkipDisabledInMenus() const;
+
+ void SetHideDisabledMenuItems( bool bHideDisabledMenuItems );
+ bool GetHideDisabledMenuItems() const;
+
+ void SetContextMenuShortcuts( TriState eContextMenuShortcuts );
+ bool GetContextMenuShortcuts() const;
+
+ void SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts );
+ bool GetPreferredContextMenuShortcuts() const;
+
+ void SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider );
+ bool GetPrimaryButtonWarpsSlider() const;
+
+ void SetAppFont( const vcl::Font& rFont );
+ const vcl::Font& GetAppFont() const;
+
+ void SetHelpFont( const vcl::Font& rFont );
+ const vcl::Font& GetHelpFont() const;
+
+ void SetTitleFont( const vcl::Font& rFont );
+ const vcl::Font& GetTitleFont() const;
+
+ void SetFloatTitleFont( const vcl::Font& rFont );
+ const vcl::Font& GetFloatTitleFont() const;
+
+ void SetMenuFont( const vcl::Font& rFont );
+ const vcl::Font& GetMenuFont() const;
+
+ void SetToolFont( const vcl::Font& rFont );
+ const vcl::Font& GetToolFont() const;
+
+ void SetGroupFont( const vcl::Font& rFont );
+ const vcl::Font& GetGroupFont() const;
+
+ void SetLabelFont( const vcl::Font& rFont );
+ const vcl::Font& GetLabelFont() const;
+
+ void SetRadioCheckFont( const vcl::Font& rFont );
+ const vcl::Font& GetRadioCheckFont() const;
+
+ void SetPushButtonFont( const vcl::Font& rFont );
+ const vcl::Font& GetPushButtonFont() const;
+
+ void SetFieldFont( const vcl::Font& rFont );
+ const vcl::Font& GetFieldFont() const;
+
+ void SetIconFont( const vcl::Font& rFont );
+ const vcl::Font& GetIconFont() const;
+
+ void SetTabFont( const vcl::Font& rFont );
+ const vcl::Font& GetTabFont() const;
+
+ static sal_Int32 GetBorderSize();
+
+ void SetTitleHeight( sal_Int32 nSize );
+ sal_Int32 GetTitleHeight() const;
+
+ void SetFloatTitleHeight( sal_Int32 nSize );
+ sal_Int32 GetFloatTitleHeight() const;
+
+ void SetScrollBarSize( sal_Int32 nSize );
+ sal_Int32 GetScrollBarSize() const;
+
+ void SetMinThumbSize( sal_Int32 nSize );
+ sal_Int32 GetMinThumbSize() const;
+
+ void SetSpinSize( sal_Int32 nSize );
+ sal_Int32 GetSpinSize() const;
+
+ static sal_Int32 GetSplitSize();
+
+ void SetCursorSize( sal_Int32 nSize );
+ sal_Int32 GetCursorSize() const;
+
+ void SetCursorBlinkTime( sal_uInt64 nBlinkTime );
+ sal_uInt64 GetCursorBlinkTime() const;
+
+ void SetDragFullOptions( DragFullOptions nOptions );
+ DragFullOptions GetDragFullOptions() const;
+
+ void SetSelectionOptions( SelectionOptions nOptions );
+ SelectionOptions GetSelectionOptions() const;
+
+ void SetDisplayOptions( DisplayOptions nOptions );
+ DisplayOptions GetDisplayOptions() const;
+
+ void SetAntialiasingMinPixelHeight( sal_Int32 nMinPixel );
+ sal_Int32 GetAntialiasingMinPixelHeight() const;
+
+ void SetOptions( StyleSettingsOptions nOptions );
+ StyleSettingsOptions GetOptions() const;
+
+ void SetAutoMnemonic( bool bAutoMnemonic );
+ bool GetAutoMnemonic() const;
+
+ static bool GetDockingFloatsSupported();
+
+ void SetFontColor( const Color& rColor );
+ const Color& GetFontColor() const;
+
+ void SetToolbarIconSize( ToolbarIconSize nSize );
+ ToolbarIconSize GetToolbarIconSize() const;
+ Size GetToolbarIconSizePixel() const;
+
+ /** Set the icon theme to use. */
+ void SetIconTheme(const OUString&);
+
+ /** Determine which icon theme should be used.
+ *
+ * This might not be the same as the one which has been set with SetIconTheme(),
+ * e.g., if high contrast mode is enabled.
+ *
+ * (for the detailed logic @see vcl::IconThemeSelector)
+ */
+ OUString DetermineIconTheme() const;
+
+ /** Obtain the list of icon themes which were found in the config folder
+ * @see vcl::IconThemeScanner for more details.
+ */
+ std::vector<vcl::IconThemeInfo> const & GetInstalledIconThemes() const;
+
+ /** Obtain the name of the icon theme which will be chosen automatically for the desktop environment.
+ * This method will only return icon themes which were actually found on the system.
+ */
+ OUString GetAutomaticallyChosenIconTheme() const;
+
+ /** Set a preferred icon theme.
+ * This theme will be preferred in GetAutomaticallyChosenIconTheme()
+ */
+ void SetPreferredIconTheme(const OUString&, bool bDarkIconTheme = false);
+
+ const DialogStyle& GetDialogStyle() const;
+
+ BitmapEx const & GetPersonaHeader() const;
+
+ BitmapEx const & GetPersonaFooter() const;
+
+ const std::optional<Color>& GetPersonaMenuBarTextColor() const;
+
+ // global switch to allow EdgeBlenging; currently possible for ValueSet and ListBox
+ // when activated there using Get/SetEdgeBlending; default is true
+ void SetEdgeBlending(sal_uInt16 nCount);
+ sal_uInt16 GetEdgeBlending() const;
+
+ // TopLeft (default Color(0xC0, 0xC0, 0xC0)) and BottomRight (default Color(0x40, 0x40, 0x40))
+ // default colors for EdgeBlending
+ const Color& GetEdgeBlendingTopLeftColor() const;
+ const Color& GetEdgeBlendingBottomRightColor() const;
+
+ // maximum line count for ListBox control; to use this, call AdaptDropDownLineCountToMaximum() at the
+ // ListBox after it's ItemCount has changed/got filled. Default is 25. If more Items exist, a scrollbar
+ // will be used
+ void SetListBoxMaximumLineCount(sal_uInt16 nCount);
+ sal_uInt16 GetListBoxMaximumLineCount() const;
+
+ // maximum column count for the ColorValueSet control. Default is 12 and this is optimized for the
+ // color scheme which has 12-color aligned layout for the part taken over from Symphony. Do
+ // only change this if you know what you are doing.
+ void SetColorValueSetColumnCount(sal_uInt16 nCount);
+ sal_uInt16 GetColorValueSetColumnCount() const;
+
+ void SetListBoxPreviewDefaultLogicSize(Size const & rSize);
+ const Size& GetListBoxPreviewDefaultPixelSize() const;
+
+ // the default LineWidth for ListBox UI previews (LineStyle, LineDash, LineStartEnd). Default is 1.
+ static sal_uInt16 GetListBoxPreviewDefaultLineWidth();
+
+ // defines if previews which contain potentially transparent objects (e.g. the dash/line/LineStartEnd previews and others)
+ // use the default transparent visualization background (checkered background) as it has got standard in graphic programs nowadays
+ void SetPreviewUsesCheckeredBackground(bool bNew);
+ bool GetPreviewUsesCheckeredBackground() const;
+
+ void SetStandardStyles();
+
+ bool operator ==( const StyleSettings& rSet ) const;
+ bool operator !=( const StyleSettings& rSet ) const;
+
+ // Batch setters used by various backends
+ void BatchSetBackgrounds( const Color &aBackColor,
+ bool bCheckedColorSpecialCase = true );
+ void BatchSetFonts( const vcl::Font& aAppFont,
+ const vcl::Font& aLabelFont );
+};
+
+
+class VCL_DLLPUBLIC MiscSettings
+{
+ std::shared_ptr<ImplMiscData> mxData;
+
+public:
+ MiscSettings();
+
+#ifdef _WIN32
+ void SetEnableATToolSupport( bool bEnable );
+#endif
+ bool GetEnableATToolSupport() const;
+ bool GetDisablePrinting() const;
+ void SetEnableLocalizedDecimalSep( bool bEnable );
+ bool GetEnableLocalizedDecimalSep() const;
+
+ bool operator ==( const MiscSettings& rSet ) const;
+ bool operator !=( const MiscSettings& rSet ) const;
+};
+
+
+class VCL_DLLPUBLIC HelpSettings
+{
+ std::shared_ptr<ImplHelpData> mxData;
+
+public:
+ HelpSettings();
+
+ static sal_Int32 GetTipDelay();
+ void SetTipTimeout( sal_Int32 nTipTimeout );
+ sal_Int32 GetTipTimeout() const;
+ static sal_Int32 GetBalloonDelay();
+
+ bool operator ==( const HelpSettings& rSet ) const;
+ bool operator !=( const HelpSettings& rSet ) const;
+};
+
+
+enum class AllSettingsFlags {
+ NONE = 0x0000,
+ MOUSE = 0x0001,
+ STYLE = 0x0002,
+ MISC = 0x0004,
+ LOCALE = 0x0020,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<AllSettingsFlags> : is_typed_flags<AllSettingsFlags, 0x0027> {};
+}
+
+class VCL_DLLPUBLIC AllSettings
+{
+private:
+ void CopyData();
+
+ std::shared_ptr<ImplAllSettingsData> mxData;
+
+public:
+ AllSettings();
+
+ void SetMouseSettings( const MouseSettings& rSet );
+ const MouseSettings& GetMouseSettings() const;
+
+ void SetStyleSettings( const StyleSettings& rSet );
+ const StyleSettings& GetStyleSettings() const;
+
+ void SetMiscSettings( const MiscSettings& rSet );
+ const MiscSettings& GetMiscSettings() const;
+
+ IF_MERGELIBS(SAL_DLLPRIVATE)
+ void SetHelpSettings( const HelpSettings& rSet );
+ IF_MERGELIBS(SAL_DLLPRIVATE)
+ const HelpSettings& GetHelpSettings() const;
+
+ void SetLanguageTag(const OUString& rLanguage, bool bCanonicalize);
+ void SetLanguageTag( const LanguageTag& rLanguageTag );
+ const LanguageTag& GetLanguageTag() const;
+ const LanguageTag& GetUILanguageTag() const;
+ static bool GetLayoutRTL(); // returns true if UI language requires right-to-left Text Layout
+ static bool GetMathLayoutRTL(); // returns true if UI language requires right-to-left Math Layout
+ static OUString GetUIRootDir();
+ const LocaleDataWrapper& GetLocaleDataWrapper() const;
+ const LocaleDataWrapper& GetUILocaleDataWrapper() const;
+ IF_MERGELIBS(SAL_DLLPRIVATE)
+ const LocaleDataWrapper& GetNeutralLocaleDataWrapper() const;
+ const vcl::I18nHelper& GetLocaleI18nHelper() const;
+ const vcl::I18nHelper& GetUILocaleI18nHelper() const;
+
+ SAL_DLLPRIVATE static AllSettingsFlags GetWindowUpdate()
+ { return AllSettingsFlags::MOUSE | AllSettingsFlags::STYLE | AllSettingsFlags::MISC | AllSettingsFlags::LOCALE; }
+
+ AllSettingsFlags Update( AllSettingsFlags nFlags, const AllSettings& rSettings );
+ SAL_DLLPRIVATE AllSettingsFlags GetChangeFlags( const AllSettings& rSettings ) const;
+
+ bool operator ==( const AllSettings& rSet ) const;
+ bool operator !=( const AllSettings& rSet ) const;
+ SAL_DLLPRIVATE static void LocaleSettingsChanged( ConfigurationHints nHint );
+ SAL_DLLPRIVATE SvtSysLocale& GetSysLocale();
+};
+
+#endif // INCLUDED_VCL_SETTINGS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/skia/SkiaHelper.hxx b/include/vcl/skia/SkiaHelper.hxx
new file mode 100644
index 000000000..128c758fa
--- /dev/null
+++ b/include/vcl/skia/SkiaHelper.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_SKIA_SKIAHELPER_HXX
+#define INCLUDED_VCL_SKIA_SKIAHELPER_HXX
+
+#include <vcl/dllapi.h>
+
+#include <config_features.h>
+
+namespace SkiaHelper
+{
+VCL_DLLPUBLIC bool isVCLSkiaEnabled();
+
+#if HAVE_FEATURE_SKIA
+
+// Which Skia backend to use.
+enum RenderMethod
+{
+ RenderRaster,
+ RenderVulkan,
+ RenderMetal
+};
+
+VCL_DLLPUBLIC RenderMethod renderMethodToUse();
+
+// Clean up before exit.
+VCL_DLLPUBLIC void cleanup();
+
+#endif // HAVE_FEATURE_SKIA
+
+} // namespace
+
+#endif // INCLUDED_VCL_SKIA_SKIAHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/sound.hxx b/include/vcl/sound.hxx
new file mode 100644
index 000000000..77398a3ef
--- /dev/null
+++ b/include/vcl/sound.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+
+class VCL_DLLPUBLIC Sound
+{
+public:
+ static void Beep();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/specialchars.hxx b/include/vcl/specialchars.hxx
new file mode 100644
index 000000000..5a7fe8cd3
--- /dev/null
+++ b/include/vcl/specialchars.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SPECIAL_CHARS_HXX
+#define INCLUDED_VCL_SPECIAL_CHARS_HXX
+
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace vcl
+{
+class Font;
+}
+
+namespace weld
+{
+class Widget;
+}
+
+typedef OUString (*FncGetSpecialChars)(weld::Widget* pWin, const vcl::Font& rFont);
+
+namespace vcl
+{
+void VCL_DLLPUBLIC SetGetSpecialCharsFunction(FncGetSpecialChars fn);
+FncGetSpecialChars VCL_DLLPUBLIC GetGetSpecialCharsFunction();
+};
+
+#endif // INCLUDED_VCL_SPECIAL_CHARS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/split.hxx b/include/vcl/split.hxx
new file mode 100644
index 000000000..4d8624c49
--- /dev/null
+++ b/include/vcl/split.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SPLIT_HXX
+#define INCLUDED_VCL_SPLIT_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/keycod.hxx>
+#include <vcl/window.hxx>
+
+#define SPLITTER_DEFAULTSTEPSIZE 0xFFFF
+
+class VCL_DLLPUBLIC Splitter : public vcl::Window
+{
+private:
+ VclPtr<vcl::Window> mpRefWin;
+ tools::Long mnSplitPos;
+ tools::Long mnLastSplitPos;
+ tools::Long mnStartSplitPos;
+ Point maDragPos;
+ tools::Rectangle maDragRect;
+ bool mbHorzSplit;
+ bool mbDragFull;
+ bool mbKbdSplitting;
+ bool mbInKeyEvent;
+ tools::Long mnKeyboardStepSize;
+ Link<Splitter*,void> maStartSplitHdl;
+ Link<Splitter*,void> maSplitHdl;
+ Link<Splitter*,void> maEndSplitHdl;
+
+ SAL_DLLPRIVATE void ImplDrawSplitter();
+ SAL_DLLPRIVATE void ImplSplitMousePos( Point& rPos );
+ SAL_DLLPRIVATE void ImplStartKbdSplitting();
+ SAL_DLLPRIVATE void ImplKbdTracking( vcl::KeyCode aKeyCode );
+ SAL_DLLPRIVATE bool ImplSplitterActive();
+ SAL_DLLPRIVATE Splitter* ImplFindSibling();
+ SAL_DLLPRIVATE void ImplRestoreSplitter();
+ SAL_DLLPRIVATE void ImplInitHorVer(bool bNew);
+
+ Splitter (const Splitter &) = delete;
+ Splitter& operator= (const Splitter &) = delete;
+
+protected:
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nWinStyle );
+
+public:
+ explicit Splitter( vcl::Window* pParent, WinBits nStyle = WB_VSCROLL );
+ virtual ~Splitter() override;
+ virtual void dispose() override;
+
+ void StartSplit();
+ void EndSplit();
+ void Split();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rPaintRect ) override;
+ virtual Size GetOptimalSize() const override;
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ void StartDrag();
+
+ void SetDragRectPixel( const tools::Rectangle& rDragRect,
+ vcl::Window* pRefWin = nullptr );
+
+ void SetSplitPosPixel( tools::Long nPos );
+ tools::Long GetSplitPosPixel() const { return mnSplitPos; }
+
+ bool IsHorizontal() const { return mbHorzSplit; }
+ void SetHorizontal(bool bNew);
+
+ // set the stepsize of the splitter for cursor movement
+ // the default is 10% of the reference window's width/height
+ void SetKeyboardStepSize( tools::Long nStepSize );
+
+ void SetStartSplitHdl( const Link<Splitter*,void>& rLink ) { maStartSplitHdl = rLink; }
+ void SetSplitHdl( const Link<Splitter*,void>& rLink ) { maSplitHdl = rLink; }
+ void SetEndSplitHdl( const Link<Splitter*,void>& rLink ) { maEndSplitHdl = rLink; }
+};
+
+#endif // INCLUDED_VCL_SPLIT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/splitwin.hxx b/include/vcl/splitwin.hxx
new file mode 100644
index 000000000..903bd56e7
--- /dev/null
+++ b/include/vcl/splitwin.hxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SPLITWIN_HXX
+#define INCLUDED_VCL_SPLITWIN_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/dockwin.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+class ImplSplitSet;
+
+enum class SplitWindowItemFlags
+{
+ NONE = 0x0000,
+ Fixed = 0x0001,
+ RelativeSize = 0x0002,
+ PercentSize = 0x0004,
+ ColSet = 0x0008,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SplitWindowItemFlags> : is_typed_flags<SplitWindowItemFlags, 0x0f> {};
+}
+
+#define SPLITWINDOW_APPEND (sal_uInt16(0xFFFF))
+#define SPLITWINDOW_ITEM_NOTFOUND (sal_uInt16(0xFFFF))
+
+#define SPLITWIN_SPLITSIZE 4
+#define SPLITWIN_SPLITSIZEEXLN 7
+
+class VCL_DLLPUBLIC SplitWindow : public DockingWindow
+{
+private:
+ std::unique_ptr<ImplSplitSet> mpMainSet;
+ ImplSplitSet* mpBaseSet;
+ ImplSplitSet* mpSplitSet;
+ std::unique_ptr<tools::Long[]> mpLastSizes;
+ tools::Rectangle maDragRect;
+ tools::Long mnDX;
+ tools::Long mnDY;
+ tools::Long mnLeftBorder;
+ tools::Long mnTopBorder;
+ tools::Long mnRightBorder;
+ tools::Long mnBottomBorder;
+ tools::Long mnMaxSize;
+ tools::Long mnMouseOff;
+ tools::Long mnMStartPos;
+ tools::Long mnMSplitPos;
+ WinBits mnWinStyle;
+ WindowAlign meAlign;
+ sal_uInt16 mnSplitTest;
+ sal_uInt16 mnSplitPos;
+ sal_uInt16 mnMouseModifier;
+ bool mbDragFull:1,
+ mbHorz:1,
+ mbBottomRight:1,
+ mbCalc:1,
+ mbRecalc:1,
+ mbInvalidate:1,
+ mbFadeIn:1,
+ mbFadeOut:1,
+ mbFadeInDown:1,
+ mbFadeOutDown:1,
+ mbFadeInPressed:1,
+ mbFadeOutPressed:1,
+ mbFadeNoButtonMode:1;
+ Link<SplitWindow*,void> maSplitHdl;
+
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE void ImplInitSettings();
+ SAL_DLLPRIVATE void ImplCalcLayout();
+ SAL_DLLPRIVATE void ImplUpdate();
+ SAL_DLLPRIVATE void ImplSetWindowSize( tools::Long nDelta );
+ SAL_DLLPRIVATE void ImplSplitMousePos( Point& rMousePos );
+ SAL_DLLPRIVATE void ImplGetButtonRect( tools::Rectangle& rRect, bool bTest ) const;
+ SAL_DLLPRIVATE void ImplGetFadeInRect( tools::Rectangle& rRect, bool bTest = false ) const;
+ SAL_DLLPRIVATE void ImplGetFadeOutRect( tools::Rectangle& rRect ) const;
+ SAL_DLLPRIVATE void ImplDrawFadeIn(vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE void ImplDrawFadeOut(vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE void ImplNewAlign();
+ SAL_DLLPRIVATE void ImplDrawGrip(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, bool bHorz, bool bLeft);
+ SAL_DLLPRIVATE void ImplStartSplit( const MouseEvent& rMEvt );
+
+ SAL_DLLPRIVATE void ImplDrawBorder(vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE void ImplDrawBorderLine(vcl::RenderContext& rRenderContext);
+ static SAL_DLLPRIVATE void ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool bHide,
+ bool bRows );
+ static SAL_DLLPRIVATE sal_uInt16 ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
+ tools::Long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos,
+ bool bRows );
+ static SAL_DLLPRIVATE sal_uInt16 ImplTestSplit( const SplitWindow* pWindow, const Point& rPos,
+ tools::Long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos );
+ SAL_DLLPRIVATE void ImplDrawSplitTracking(const Point& rPos);
+
+ SplitWindow (const SplitWindow &) = delete;
+ SplitWindow & operator= (const SplitWindow &) = delete;
+public:
+ SplitWindow( vcl::Window* pParent, WinBits nStyle = 0 );
+ virtual ~SplitWindow() override;
+ virtual void dispose() override;
+
+ virtual void StartSplit();
+ virtual void Split();
+ virtual void SplitResize();
+ virtual void FadeIn();
+ virtual void FadeOut();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+ virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+
+ void InsertItem( sal_uInt16 nId, vcl::Window* pWindow, tools::Long nSize,
+ sal_uInt16 nPos, sal_uInt16 nIntoSetId,
+ SplitWindowItemFlags nBits );
+ void InsertItem( sal_uInt16 nId, tools::Long nSize,
+ sal_uInt16 nPos, sal_uInt16 nIntoSetId,
+ SplitWindowItemFlags nBits );
+ void RemoveItem( sal_uInt16 nId );
+
+ void SplitItem( sal_uInt16 nId, tools::Long nNewSize,
+ bool bPropSmall,
+ bool bPropGreat );
+ void SetItemSize( sal_uInt16 nId, tools::Long nNewSize );
+ tools::Long GetItemSize( sal_uInt16 nId ) const;
+ /** Set a range that limits the (variable part of the) size with an
+ upper and a lower bound (both are valid values themselves.)
+ @param nId
+ Id of the item for which the size limits are set.
+ @param rRange
+ Values of -1 define missing bounds, thus setting a range (-1,-1)
+ (the default) removes the size limit.
+ */
+ void SetItemSizeRange (sal_uInt16 nId, const Range& rRange);
+ /** Return the current size limits for the specified item.
+ */
+ tools::Long GetItemSize( sal_uInt16 nId, SplitWindowItemFlags nBits ) const;
+ sal_uInt16 GetSet( sal_uInt16 nId ) const;
+ sal_uInt16 GetItemId( vcl::Window* pWindow ) const;
+ sal_uInt16 GetItemId( const Point& rPos ) const;
+ sal_uInt16 GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId = 0 ) const;
+ sal_uInt16 GetItemId( sal_uInt16 nPos ) const;
+ sal_uInt16 GetItemCount( sal_uInt16 nSetId = 0 ) const;
+ bool IsItemValid( sal_uInt16 nId ) const;
+
+ void SetAlign( WindowAlign eNewAlign );
+ WindowAlign GetAlign() const { return meAlign; }
+ bool IsHorizontal() const { return mbHorz; }
+
+ void SetMaxSizePixel( tools::Long nNewMaxSize ) { mnMaxSize = nNewMaxSize; }
+
+ Size CalcLayoutSizePixel( const Size& aNewSize );
+
+ void ShowFadeInHideButton();
+ void ShowFadeOutButton();
+ tools::Long GetFadeInSize() const;
+ bool IsFadeNoButtonMode() const { return mbFadeNoButtonMode; }
+
+ void SetSplitHdl( const Link<SplitWindow*,void>& rLink ) { maSplitHdl = rLink; }
+};
+
+#endif // INCLUDED_VCL_SPLITWIN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/status.hxx b/include/vcl/status.hxx
new file mode 100644
index 000000000..91a6ed643
--- /dev/null
+++ b/include/vcl/status.hxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_STATUS_HXX
+#define INCLUDED_VCL_STATUS_HXX
+
+#include <tools/solar.h>
+#include <vcl/dllapi.h>
+#include <vcl/window.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <memory>
+#include <vector>
+
+class DataChangedEvent;
+class HelpEvent;
+class MouseEvent;
+class UserDrawEvent;
+struct ImplStatusItem;
+
+void DrawProgress(vcl::Window* pWindow, vcl::RenderContext& rRenderContext, const Point& rPos,
+ tools::Long nOffset, tools::Long nPrgsWidth, tools::Long nPrgsHeight,
+ sal_uInt16 nPercent1, sal_uInt16 nPercent2, sal_uInt16 nPercentCount,
+ const tools::Rectangle& rFramePosSize);
+
+
+enum class StatusBarItemBits {
+ NONE = 0x0000,
+ Left = 0x0001,
+ Center = 0x0002,
+ Right = 0x0004,
+ In = 0x0008,
+ Out = 0x0010,
+ Flat = 0x0020,
+ AutoSize = 0x0040,
+ UserDraw = 0x0080,
+ Mandatory = 0x0100,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<StatusBarItemBits> : is_typed_flags<StatusBarItemBits, 0x01ff> {};
+}
+
+#define STATUSBAR_APPEND (sal_uInt16(0xFFFF))
+#define STATUSBAR_ITEM_NOTFOUND (sal_uInt16(0xFFFF))
+#define STATUSBAR_OFFSET (tools::Long(5))
+
+
+class VCL_DLLPUBLIC StatusBar : public vcl::Window
+{
+ class SAL_DLLPRIVATE ImplData;
+private:
+ std::vector<std::unique_ptr<ImplStatusItem>> mvItemList;
+ std::unique_ptr<ImplData> mpImplData;
+ OUString maPrgsTxt;
+ Point maPrgsTxtPos;
+ tools::Rectangle maPrgsFrameRect;
+ tools::Long mnPrgsSize;
+ tools::Long mnItemsWidth;
+ tools::Long mnDX;
+ tools::Long mnDY;
+ tools::Long mnCalcHeight;
+ tools::Long mnTextY;
+ sal_uInt16 mnCurItemId;
+ sal_uInt16 mnPercent;
+ sal_uInt16 mnPercentCount;
+ sal_uInt32 mnLastProgressPaint_ms;
+ bool mbFormat;
+ bool mbProgressMode;
+ bool mbInUserDraw;
+ bool mbAdjustHiDPI;
+ Link<StatusBar*,void> maClickHdl;
+ Link<StatusBar*,void> maDoubleClickHdl;
+
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE void ImplInitSettings();
+ SAL_DLLPRIVATE void ImplFormat();
+ SAL_DLLPRIVATE bool ImplIsItemUpdate() const;
+
+ SAL_DLLPRIVATE void ImplDrawText(vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE void ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen,
+ sal_uInt16 nPos);
+ SAL_DLLPRIVATE void ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt16 nNewPerc);
+ SAL_DLLPRIVATE void ImplCalcProgressRect();
+ SAL_DLLPRIVATE tools::Rectangle ImplGetItemRectPos( sal_uInt16 nPos ) const;
+ SAL_DLLPRIVATE sal_uInt16 ImplGetFirstVisiblePos() const;
+
+protected:
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+
+public:
+ StatusBar( vcl::Window* pParent,
+ WinBits nWinStyle = WB_BORDER | WB_RIGHT );
+ virtual ~StatusBar() override;
+ virtual void dispose() override;
+
+ void AdjustItemWidthsForHiDPI();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+ virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ void Click();
+ void DoubleClick();
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ void InsertItem( sal_uInt16 nItemId, sal_uLong nWidth,
+ StatusBarItemBits nBits = StatusBarItemBits::Center | StatusBarItemBits::In,
+ tools::Long nOffset = STATUSBAR_OFFSET,
+ sal_uInt16 nPos = STATUSBAR_APPEND );
+ void RemoveItem( sal_uInt16 nItemId );
+
+ void ShowItem( sal_uInt16 nItemId );
+ void HideItem( sal_uInt16 nItemId );
+ bool IsItemVisible( sal_uInt16 nItemId ) const;
+
+ void RedrawItem( sal_uInt16 nItemId );
+
+ void Clear();
+
+ sal_uInt16 GetItemCount() const;
+ sal_uInt16 GetItemId( sal_uInt16 nPos ) const;
+ sal_uInt16 GetItemId( const Point& rPos ) const;
+ sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const;
+ tools::Rectangle GetItemRect( sal_uInt16 nItemId ) const;
+ Point GetItemTextPos( sal_uInt16 nItemId ) const;
+ sal_uInt16 GetCurItemId() const { return mnCurItemId; }
+
+ sal_uLong GetItemWidth( sal_uInt16 nItemId ) const;
+ StatusBarItemBits GetItemBits( sal_uInt16 nItemId ) const;
+
+ tools::Long GetItemOffset( sal_uInt16 nItemId ) const;
+
+ /// @param nCharsWidth, if not -1, overrides the normal width calculation
+ void SetItemText( sal_uInt16 nItemId, const OUString& rText, int nCharsWidth = -1 );
+ const OUString& GetItemText( sal_uInt16 nItemId ) const;
+
+ void SetItemData( sal_uInt16 nItemId, void* pNewData );
+ void* GetItemData( sal_uInt16 nItemId ) const;
+
+ void SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand );
+ OUString GetItemCommand( sal_uInt16 nItemId );
+
+ void SetHelpText( sal_uInt16 nItemId, const OUString& rText );
+ const OUString& GetHelpText( sal_uInt16 nItemId ) const;
+
+ using Window::SetQuickHelpText;
+ void SetQuickHelpText( sal_uInt16 nItemId, const OUString& rText );
+ using Window::GetQuickHelpText;
+ const OUString& GetQuickHelpText( sal_uInt16 nItemId ) const;
+
+ void SetHelpId( sal_uInt16 nItemId, const OString& rHelpId );
+
+ void StartProgressMode( const OUString& rText );
+ void SetProgressValue( sal_uInt16 nPercent );
+ void EndProgressMode();
+ bool IsProgressMode() const { return mbProgressMode; }
+
+ void SetText( const OUString& rText ) override;
+
+ Size CalcWindowSizePixel() const;
+
+ void SetClickHdl( const Link<StatusBar*,void>& rLink ) { maClickHdl = rLink; }
+ void SetDoubleClickHdl( const Link<StatusBar*,void>& rLink ) { maDoubleClickHdl = rLink; }
+
+ using Window::SetAccessibleName;
+ void SetAccessibleName( sal_uInt16 nItemId, const OUString& rName );
+ using Window::GetAccessibleName;
+ const OUString& GetAccessibleName( sal_uInt16 nItemId ) const;
+};
+
+#endif // INCLUDED_VCL_STATUS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/stdtext.hxx b/include/vcl/stdtext.hxx
new file mode 100644
index 000000000..c77e5ebfc
--- /dev/null
+++ b/include/vcl/stdtext.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_STDTEXT_HXX
+#define INCLUDED_VCL_STDTEXT_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <rtl/ustring.hxx>
+#include <tools/wintypes.hxx>
+#include <vcl/dllapi.h>
+
+class Image;
+namespace weld { class Widget; }
+
+void VCL_DLLPUBLIC ShowServiceNotAvailableError(weld::Widget* pParent, std::u16string_view rServiceName, bool bError);
+
+OUString VCL_DLLPUBLIC GetStandardText(StandardButtonType eButton);
+
+VCL_DLLPUBLIC Image const & GetStandardInfoBoxImage();
+VCL_DLLPUBLIC OUString GetStandardInfoBoxText();
+
+VCL_DLLPUBLIC Image const & GetStandardWarningBoxImage();
+VCL_DLLPUBLIC OUString GetStandardWarningBoxText();
+
+VCL_DLLPUBLIC Image const & GetStandardErrorBoxImage();
+VCL_DLLPUBLIC OUString GetStandardErrorBoxText();
+
+VCL_DLLPUBLIC Image const & GetStandardQueryBoxImage();
+VCL_DLLPUBLIC OUString GetStandardQueryBoxText();
+
+
+#endif // INCLUDED_VCL_STDTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
new file mode 100644
index 000000000..22164ed78
--- /dev/null
+++ b/include/vcl/svapp.hxx
@@ -0,0 +1,1482 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SVAPP_HXX
+#define INCLUDED_VCL_SVAPP_HXX
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#include <cassert>
+#include <vector>
+
+#include <comphelper/solarmutex.hxx>
+#include <LibreOfficeKit/LibreOfficeKitTypes.h>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+#include <osl/thread.h>
+#include <tools/gen.hxx>
+#include <tools/link.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/IDialogRenderable.hxx>
+#include <vcl/inputtypes.hxx>
+#include <vcl/exceptiontypes.hxx>
+#include <vcl/vclevent.hxx>
+#include <vcl/vclenum.hxx>
+#include <i18nlangtag/lang.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+
+class BitmapEx;
+namespace weld
+{
+ class Builder;
+ class MessageDialog;
+ class Widget;
+ class Window;
+}
+class LocaleDataWrapper;
+class AllSettings;
+class DataChangedEvent;
+class Accelerator;
+class Help;
+class OutputDevice;
+namespace vcl { class Window; }
+namespace vcl { class KeyCode; }
+class NotifyEvent;
+class KeyEvent;
+class MouseEvent;
+class GestureEvent;
+struct ImplSVEvent;
+struct ConvertData;
+
+namespace com::sun::star::uno {
+ class XComponentContext;
+}
+namespace com::sun::star::ui::dialogs {
+ class XFilePicker2;
+ class XFolderPicker2;
+}
+namespace com::sun::star::awt {
+ class XToolkit;
+ class XDisplayConnection;
+ class XWindow;
+}
+
+// helper needed by SalLayout implementations as well as svx/source/dialog/svxbmpnumbalueset.cxx
+VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 );
+VCL_DLLPUBLIC sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType );
+
+enum class SystemWindowFlags {
+ NOAUTOMODE = 0x0001,
+ DIALOG = 0x0002
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SystemWindowFlags> : is_typed_flags<SystemWindowFlags, 0x03> {};
+}
+
+typedef long (*VCLEventHookProc)( NotifyEvent& rEvt, void* pData );
+
+/** An application can be notified of a number of different events:
+ - Type::Accept - listen for connection to the application (a connection
+ string is passed via the event)
+ - Type::Unaccept - stops listening for a connection to the app (determined by
+ a connection string passed via the event)
+ - Type::Appear - brings the app to the front (i.e. makes it "appear")
+ - Type::Version - display the app version
+ - Type::Help - opens a help topic (help topic passed as string)
+ - Type::OpenHELP_URL - opens a help URL (URL passed as a string)
+ - Type::ShowDialog - shows a dialog (dialog passed as a string)
+ - Type::Open - opens a document or group of documents (documents passed
+ as an array of strings)
+ - Type::Print - print a document or group of documents (documents passed
+ as an array of strings
+ - Type::PrivateDoShutdown - shutdown the app
+*/
+
+class VCL_DLLPUBLIC ApplicationEvent
+{
+public:
+ enum class Type {
+ Accept, ///< Listen for connections
+ Appear, ///< Make application appear
+ Open, ///< Open a document
+ OpenHelpUrl, ///< Open a help URL
+ Print, ///< Print document
+ PrivateDoShutdown, ///< Shutdown application
+ QuickStart, ///< Start QuickStart
+ ShowDialog, ///< Show a dialog
+ Unaccept ///< Stop listening for connections
+ };
+
+ /** Explicit constructor for ApplicationEvent.
+
+ @attention Type::Appear, Type::PrivateDoShutdown and
+ Type::QuickStart are the \em only events that don't need to include
+ a data string with the event. No other events should use this
+ constructor!
+ */
+ explicit ApplicationEvent(Type type): aEvent(type)
+ {
+ assert(type == Type::Appear || type == Type::PrivateDoShutdown || type == Type::QuickStart);
+ }
+
+ /** Constructor for ApplicationEvent, accepts a string for the data
+ associated with the event.
+
+ @attention Type::Accept, Type::OpenHelpUrl, Type::ShowDialog
+ and Type::Unaccept are the \em only events that accept a single
+ string as event data. No other events should use this constructor!
+ */
+ ApplicationEvent(Type type, OUString const & data): aEvent(type)
+ {
+ assert(
+ type == Type::Accept || type == Type::OpenHelpUrl
+ || type == Type::ShowDialog || type == Type::Unaccept);
+ aData.push_back(data);
+ }
+
+ /** Constructor for ApplicationEvent, accepts an array of strings for
+ the data associated with the event.
+
+ @attention Type::Open and Type::Print can apply to multiple documents,
+ and are the \em only events that accept an array of strings. No other
+ events should use this constructor.
+ */
+ ApplicationEvent(Type type, std::vector<OUString>&& data):
+ aEvent(type), aData(std::move(data))
+ {
+ assert(type == Type::Open || type == Type::Print);
+ }
+
+ /** Get the type of event.
+
+ @returns The type of event.
+ */
+ Type GetEvent() const
+ {
+ return aEvent;
+ }
+
+ /** Gets the application event's data string.
+
+ @attention The \em only events that need a single string Type::Accept,
+ Type::OpenHelpUrl, Type::ShowDialog and Type::Unaccept
+
+ @returns The event's data string.
+ */
+ OUString const & GetStringData() const
+ {
+ assert(
+ aEvent == Type::Accept
+ || aEvent == Type::OpenHelpUrl || aEvent == Type::ShowDialog
+ || aEvent == Type::Unaccept);
+ assert(aData.size() == 1);
+ return aData[0];
+ }
+
+ /** Gets the event's array of strings.
+
+ @attention The \em only events that need an array of strings
+ are Type::Open and Type::Print.
+ */
+ std::vector<OUString> const & GetStringsData() const
+ {
+ assert(aEvent == Type::Open || aEvent == Type::Print);
+ return aData;
+ }
+
+private:
+ Type aEvent;
+ std::vector<OUString> aData;
+};
+
+enum class DialogCancelMode {
+ Off, ///< do not automatically cancel dialogs
+ Silent, ///< silently cancel any dialogs
+ LOKSilent, ///< silently cancel any dialogs (LOK case)
+ Fatal ///< cancel any dialogs by std::abort
+};
+
+/**
+ @brief Base class used mainly for the LibreOffice Desktop class.
+
+ The Application class is a base class mainly used by the Desktop
+ class. It is really meant to be subclassed, and the Main() function
+ should be overridden. Many of the ImplSVData members should be
+ moved to this class.
+
+ The reason Application exists is because the VCL used to be a
+ standalone framework, long since abandoned by anything other than
+ our application.
+
+ @see Desktop, ImplSVData
+ */
+class VCL_DLLPUBLIC Application : public vcl::ILibreOfficeKitNotifier
+{
+public:
+ /** @name Initialization
+ The following functions perform initialization and deinitialization
+ of the application.
+ */
+ ///@{
+
+ /** Default constructor for Application class.
+
+ Initializes the LibreOffice global instance data structure if needed,
+ and then sets itself to be the Application class. Also initializes any
+ platform specific data structures.
+
+ @attention The initialization of the application itself is done in Init()
+ */
+ Application();
+
+ /** Virtual destructor for Application class.
+
+ Deinitializes the LibreOffice global instance data structure, then
+ deinitializes any platform specific data structures.
+ */
+ virtual ~Application();
+
+ /** Initialize the application itself.
+
+ @attention Note that the global data structures and platform specific
+ initialization is done in the constructor.
+
+ @see InitFinished, DeInit
+ */
+ virtual void Init();
+
+ /** Finish initialization of the application.
+
+ @see Init, DeInit
+ */
+ virtual void InitFinished();
+
+ /** Deinitialized the application itself.
+
+ @attention Note that the global data structures and platform specific
+ deinitialization is done in the destructor.
+
+ @see Init, InitFinished
+ */
+ virtual void DeInit();
+
+ ///@}
+
+ /** @brief Pure virtual entrypoint to the application.
+
+ Main() is the pure virtual entrypoint to your application. You
+ inherit your class from Application and subclass this function to
+ implement an application.
+
+ The Main() function does not pass in command line parameters,
+ you must use the functions GetCommandLineParamCount() and
+ GetCommandLineParam() to get these values as these are platform
+ independent ways of getting the command line (use GetAppFileName()
+ to get the invoked executable filename).
+
+ Once in this function, you create windows, etc. then call on
+ Execute() to start the application's main event loop.
+
+ An example code snippet follows (it won't compile, this just gives the
+ general flavour of the framework and is adapted from an old HelloWorld
+ example program that Star Division used to provide as part of their
+ library).
+
+ \code{.cpp}
+ class TheApplication : public Application
+ {
+ public:
+ virtual void Main();
+ };
+
+ class TheWindow : public WorkWindow
+ {
+ public:
+ TheWindow(vcl::Window *parent, WinBits windowStyle) :
+ WorkWindow(parent, windowStyle) {}
+
+ virtual void Paint(const Rectangle &);
+ };
+
+ void TheWindow::Paint(const Rectangle&)
+ {
+ DrawText(Point(100,100), String("Hello World!"));
+ }
+
+ void TheApplication::Main()
+ {
+ TheWindow aWindow(NULL, WB_APP | WB_STDWORK);
+ aWindow.Show();
+ Execute();
+ }
+
+ TheApplication anApplication;
+ \endcode
+
+ Some examples in the source tree can be found here:
+
+ vcl/workben/svdem.cxx
+
+ This is an example of how to use the Application and WorkWindow. Unfortunately, it
+ no longer compiles.
+
+ vcl/fpicker/test/svdem.cxx
+ */
+ virtual int Main();
+
+ /** Exit from the application
+
+ @returns true if exited successfully, false if not able to fully exit
+ */
+ virtual bool QueryExit();
+
+ virtual void Shutdown();
+
+ /** @name Change Notification Functions
+
+ Functions that notify when changes occur in the application.
+ */
+ ///@{
+
+ /** Notify all windows that the application has changed data.
+
+ @param rDCEvt Reference to a DataChangedEvent object
+
+ @see DataChanged
+ */
+ static void NotifyAllWindows( DataChangedEvent& rDCEvt );
+
+ ///@}
+
+ /** @name Command Line Processing
+
+ Command line processing is done via the following functions. They
+ give the number of parameters, the parameters themselves and a way
+ to get the name of the invoking application.
+ */
+
+ ///@{
+
+ /** Gets the number of command line parameters passed to the application
+
+ @return sal_uInt16 - the number of parameters
+
+ @see GetCommandLineParam, GetAppFileName
+ */
+ static sal_uInt16 GetCommandLineParamCount();
+
+ /** Gets a particular command line parameter
+
+ @param nParam The index of the parameter to return.
+
+ @return The command line parameter as an OUString
+
+ @see GetCommandLineParamCount, GetAppFileName
+ */
+ static OUString GetCommandLineParam( sal_uInt16 nParam );
+
+ /** Get the name of the file used to start the application
+
+ @return The filename as an OUString
+
+ @see GetCommandLineParamCount, GetCommandLineParam
+ */
+ static OUString GetAppFileName();
+
+ ///@}
+
+ /** @name Error Handling
+
+ \em Very rudimentary error handling is done by these
+ functions.
+
+ @{
+ */
+
+ /** Handles an error.
+
+ @param nCategory The error category, see include/vcl/exceptiontypes.hxx
+
+ @see Abort
+ */
+ virtual void Exception( ExceptionCategory nCategory );
+
+ /** Ends the program prematurely with an error message.
+
+ If the \code --norestore \endcode command line argument is given (assuming
+ this process is run by developers who are interested in cores,
+ vs. end users who are not) then it does a coredump.
+
+ @param rErrorText The error message to report.
+
+ @see Exception
+ */
+ static void Abort( const OUString& rErrorText );
+
+ ///@}
+
+ /** @name Event Loop Functions
+
+ Functions that handle the LibreOffice main event loop are here,
+ including a global lock called the Solar Mutex.
+ */
+ ///@{
+
+ /** Run the main event processing loop until it is quit by Quit().
+
+ @see Quit, Reschedule, Yield, EndYield, GetSolarMutex,
+ IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
+ */
+ static void Execute();
+
+ /** Quit the program
+
+ @see Execute, Reschedule, Yield, EndYield, GetSolarMutex,
+ IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
+ */
+ static void Quit();
+
+ /** Has Quit() been called?
+ */
+ static bool IsQuit();
+
+ /** Attempt to process current pending event(s)
+
+ It doesn't sleep if no events are available for processing.
+ This doesn't process any events generated after invoking the function.
+ So in contrast to Scheduler::ProcessEventsToIdle, this cannot become
+ busy-locked by an event-generating event in the event queue.
+
+ @param bHandleAllCurrentEvents If set to true, then try to process all
+ the current events. If set to false, then only process one event.
+ Defaults to false.
+
+ @returns true if any event was processed.
+
+ @see Yield, Scheduler::ProcessEventsToIdle
+ */
+ static bool Reschedule( bool bHandleAllCurrentEvents = false );
+
+ /** Process the next event.
+
+ It sleeps if no event is available for processing and just returns
+ if an event was processed.
+
+ @see Execute, Quit, Reschedule, EndYield, GetSolarMutex,
+ IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
+ */
+ static void Yield();
+
+ /**
+
+ @see Execute, Quit, Reschedule, Yield, GetSolarMutex,
+ IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
+ */
+ static void EndYield();
+
+ /** @brief Get the Solar Mutex for this thread.
+
+ Get the Solar Mutex that prevents other threads from accessing VCL
+ concurrently.
+
+ @returns SolarMutex reference
+
+ @see Execute, Quit, Reschedule, Yield, EndYield,
+ IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
+ */
+ static comphelper::SolarMutex& GetSolarMutex();
+
+ /** Queries whether we are in main thread.
+
+ @returns true if we are in main thread, false if not
+
+ @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
+ ReleaseSolarMutex, AcquireSolarMutex,
+ */
+ static bool IsMainThread();
+
+ /** @brief Release Solar Mutex(es) for this thread
+
+ Release the Solar Mutex(es) that prevents other threads from accessing
+ VCL concurrently.
+
+ @returns The number of mutexes that were acquired by this thread.
+
+ @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
+ IsMainThread, AcquireSolarMutex,
+ */
+ static sal_uInt32 ReleaseSolarMutex();
+
+ /** @brief Acquire Solar Mutex(es) for this thread.
+
+ Acquire the Solar Mutex(es) that prevents other threads from accessing
+ VCL concurrently.
+
+ @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
+ IsMainThread, ReleaseSolarMutex,
+ */
+ static void AcquireSolarMutex( sal_uInt32 nCount );
+
+ /** Queries whether the application is in "main", i.e. not yet in
+ the event loop
+
+ @returns true if in main, false if not in main
+
+ @see IsInExecute, IsInModalMode
+ */
+ static bool IsInMain();
+
+ /** Queries whether the application is in the event loop
+
+ @returns true if in the event loop, false if not
+
+ @see IsInMain, IsInModalMode
+ */
+ static bool IsInExecute();
+
+ /** Queries whether application has a modal dialog active.
+
+ @returns true if a modal dialog is active, false if not
+
+ @see IsInMain, IsInExecute
+ */
+ static bool IsInModalMode();
+
+ /** Return how many events are being dispatched.
+
+ @returns the number of events currently being dispatched
+ */
+ static sal_uInt16 GetDispatchLevel();
+
+ /** Determine if there are any pending input events.
+
+ @param nType input identifier, defined in include/vcl/inputtypes.hxx
+ The default is VCL_INPUT_ANY.
+
+ @returns true if there are pending events, false if not.
+
+ @see GetLastInputInterval
+ */
+ static bool AnyInput( VclInputFlags nType = VCL_INPUT_ANY );
+
+ /** The interval from the last time that input was received.
+
+ @returns system ticks - last input time
+
+ @see AnyInput
+ */
+ static sal_uInt64 GetLastInputInterval();
+
+ ///@}
+
+ /* Determines if the UI is captured.
+
+ The UI is considered captured if a system dialog is open (e.g. printer setup),
+ a floating window, menu or toolbox dropdown is open, or a window has been
+ captured by the mouse.
+
+ @returns true if UI is captured, false if not
+ */
+ static bool IsUICaptured();
+
+ /** @name Settings
+
+ The following functions set system settings (e.g. tab color, etc.). There are functions
+ that set settings objects, and functions that set and get the actual system settings for
+ the application.
+ */
+ ///@{
+
+ /** Sets user settings in settings object to override system settings
+
+ The system settings that can be overridden are:
+ - window dragging options (on or off, including live scrolling!)
+ - style settings (e.g. checkbox color, border color, 3D colors,
+ button rollover colors, etc.)
+ - mouse settings
+ - menu options, including the mouse follows the menu and whether menu
+ icons are used
+
+ @param rSettings Reference to the settings object to change.
+
+ @see MergeSystemSettings, SetSettings, GetSettings
+ */
+ virtual void OverrideSystemSettings( AllSettings& rSettings );
+
+ /** Set the settings object to the platform/desktop environment system
+ settings.
+
+ @param rSettings Reference to the settings object to change.
+
+ @see OverrideSystemSettings, SetSettings, GetSettings
+ */
+ static void MergeSystemSettings( AllSettings& rSettings );
+
+ /** Sets the application's settings and notifies all windows of the
+ change.
+
+ @param rSettings const reference to settings object used to
+ change the application's settings.
+
+ @see OverrideSystemSettings, MergeSystemSettings, GetSettings
+ */
+ static void SetSettings( const AllSettings& rSettings );
+
+ /** Gets the application's settings. If the application hasn't initialized
+ it's settings, then it does so (lazy initialization).
+
+ @returns AllSettings instance that contains the current settings of the
+ application.
+
+ @see OverrideSystemSettings, MergeSystemSettings, SetSettings
+ */
+ static const AllSettings& GetSettings();
+
+ /** Get the application's locale data wrapper.
+
+ @returns reference to a LocaleDataWrapper object
+ */
+ static const LocaleDataWrapper& GetAppLocaleDataWrapper();
+
+ ///@}
+
+ /** @name Event Listeners/Handlers
+
+ A set of event listeners and callers. Note that in this code there is
+ platform specific functions - namely for zoom and scroll events.
+ */
+ ///@{
+
+
+ /** Add a VCL event listener to the application. If no event listener exists,
+ then initialize the application's event listener with a new one, then add
+ the event listener.
+
+ @param rEventListener Const reference to the event listener to add.
+
+ @see RemoveEventListener, AddKeyListener, RemoveKeyListener
+ */
+ static void AddEventListener( const Link<VclSimpleEvent&,void>& rEventListener );
+
+ /** Remove a VCL event listener from the application.
+
+ @param rEventListener Const reference to the event listener to be removed
+
+ @see AddEventListener, AddKeyListener, RemoveKeyListener
+ */
+ static void RemoveEventListener( const Link<VclSimpleEvent&,void>& rEventListener );
+
+ /** Add a keypress listener to the application. If keypress listener exists,
+ then initialize the application's keypress event listener with a new one, then
+ add the keypress listener.
+
+ @param rKeyListener Const reference to the keypress event listener to add
+
+ @see AddEventListener, RemoveEventListener, RemoveKeyListener
+ */
+ static void AddKeyListener( const Link<VclWindowEvent&,bool>& rKeyListener );
+
+ /** Remove a keypress listener from the application.
+
+ @param rKeyListener Const reference to the keypress event listener to be removed
+
+ @see AddEventListener, RemoveEventListener, AddKeyListener
+ */
+ static void RemoveKeyListener( const Link<VclWindowEvent&,bool>& rKeyListener );
+
+ /** Send event to all VCL application event listeners
+
+ @param pWin Pointer to window to send event
+ @param pData Pointer to data to send with event
+
+ @see ImplCallEventListeners(VclSimpleEvent* pEvent)
+ */
+ static void ImplCallEventListenersApplicationDataChanged( void* pData );
+
+ /** Send event to all VCL application event listeners
+
+ @param rEvent Reference to VclSimpleEvent
+
+ @see ImplCallEventListeners(sal_uLong nEvent, Windows* pWin, void* pData);
+ */
+ static void ImplCallEventListeners( VclSimpleEvent& rEvent );
+
+ /** Handle keypress event
+
+ @param nEvent Event ID for keypress
+ @param pWin Pointer to window that receives the event
+ @param pKeyEvent Received key event
+
+ @see PostKeyEvent
+ */
+ static bool HandleKey( VclEventId nEvent, vcl::Window *pWin, KeyEvent* pKeyEvent );
+
+ /** Send keypress event
+
+ @param nEvent Event ID for keypress
+ @param pWin Pointer to window to which the event is sent
+ @param pKeyEvent Key event to send
+
+ @see HandleKey
+ */
+ static ImplSVEvent * PostKeyEvent( VclEventId nEvent, vcl::Window *pWin, KeyEvent const * pKeyEvent );
+
+
+ static bool LOKHandleMouseEvent( VclEventId nEvent, vcl::Window *pWin, const MouseEvent* pEvent );
+
+ /** Send mouse event
+
+ @param nEvent Event ID for mouse event
+ @param pWin Pointer to window to which the event is sent
+ @param pMouseEvent Mouse event to send
+ */
+ static ImplSVEvent * PostMouseEvent( VclEventId nEvent, vcl::Window *pWin, MouseEvent const * pMouseEvent );
+
+ static ImplSVEvent* PostGestureEvent(VclEventId nEvent, vcl::Window* pWin, GestureEvent const * pGestureEvent);
+
+ /** Remove mouse and keypress events from a window... any also zoom and scroll events
+ if the platform supports it.
+
+ @param pWin Window to remove events from
+
+ @see HandleKey, PostKeyEvent, PostMouseEvent
+ */
+ static void RemoveMouseAndKeyEvents( vcl::Window *pWin );
+
+ /** Post a user event to the default window.
+
+ User events allow for the deferral of work to later in the main-loop - at idle.
+
+ Execution of the deferred work is thread-safe which means all the tasks are executed
+ serially, so no thread-safety locks between tasks are necessary.
+
+ @param rLink Link to event callback function
+ @param pCaller Pointer to data sent to the event by the caller. Optional.
+ @param bReferenceLink If true - hold a VclPtr<> reference on the Link's instance.
+ Taking the reference is guarded by a SolarMutexGuard.
+
+ @return the event ID used to post the event.
+ */
+ static ImplSVEvent * PostUserEvent( const Link<void*,void>& rLink, void* pCaller = nullptr,
+ bool bReferenceLink = false );
+
+ /** Remove user event based on event ID
+
+ @param nUserEvent User event to remove
+ */
+ static void RemoveUserEvent( ImplSVEvent * nUserEvent );
+
+ /*** Get the DisplayConnection.
+
+ It is a reference to XDisplayConnection, which allows toolkits to send display
+ events to the application.
+
+ @returns UNO reference to an object that implements the css:awt:XDisplayConnection
+ interface.
+ */
+ static css::uno::Reference< css::awt::XDisplayConnection > GetDisplayConnection();
+
+ /** @deprecated AppEvent is used only in the Desktop class now. However, it is
+ intended to notify the application that an event has occurred. It was in oldsv.cxx,
+ but is still needed by a number of functions.
+
+ @param rAppEvent const reference to ApplicationEvent event
+ */
+ virtual void AppEvent( const ApplicationEvent& rAppEvent );
+
+ ///@}
+
+ /** @name Application Window Functions
+
+ Functions that deal with the application's windows
+ */
+ ///@{
+
+ /** Get the currently focused window.
+
+ @returns Pointer to focused window.
+
+ @see GetDefaultDevice
+ */
+ static vcl::Window* GetFocusWindow();
+
+ /** Get the default "device" (in this case the default window).
+
+ @returns Pointer to an OutputDevice. However, it is a Window object -
+ Window class subclasses OutputDevice.
+
+ @see GetFocusWindow
+ */
+ static OutputDevice* GetDefaultDevice();
+
+ /** Get the first top-level window of the application.
+
+ @returns Pointer to top-level window (a Window object)
+
+ @see GetNextTopLevelWindow, GetTopWindowCount, GetTopWindow,
+ GetActiveTopWindow
+ */
+ static vcl::Window* GetFirstTopLevelWindow();
+
+ /** Get the next top level window.
+
+ @param pWindow Pointer to Window object you wish to get the next
+ window from.
+
+ @returns Pointer to next top window.
+ */
+ static vcl::Window* GetNextTopLevelWindow( vcl::Window const * pWindow );
+
+ /** Return the number of top-level windows being used by the application
+
+ @returns the number of top-level windows
+
+ @see GetFirstTopLevelWindow, GetNextTopLevelWindow, GetTopWindow,
+ GetActiveTopWindow
+
+ */
+ static tools::Long GetTopWindowCount();
+
+ /** Get the nth top window.
+
+ @remark Top windows are actually implemented in a one-way linked list.
+ This iterates through top level windows n times.
+
+ @param nIndex The index of the top-level window
+
+ @returns The nth top-level window of the application
+
+ @see GetFirstTopLevelWindow, GetNextTopLevelWindow, GetTopWindowCount,
+ GetActiveTopWindow
+ */
+ static vcl::Window* GetTopWindow( tools::Long nIndex );
+
+ /** Get the "active" top window.
+
+ An "active" top window is one that has a child window that has the
+ application's focus.
+
+ @returns the active top window
+
+ @see GetFirstTopLevelWindow, GetNextTopLevelWindow, GetTopWindowCount,
+ GetTopWindow
+ */
+ static vcl::Window* GetActiveTopWindow();
+
+ ///@}
+
+ /** Set the application's name.
+
+ @param rUniqueName What to set the application name to
+
+ @see GetAppName
+ */
+ static void SetAppName( const OUString& rUniqueName );
+
+
+ /** @name Application Name, Branding
+ */
+ ///@{
+
+ /** Get the application's name.
+
+ @returns The application name.
+ */
+ static OUString GetAppName();
+
+ /**
+ * Get the OS version based on the OS specific implementation.
+ *
+ * @return OUString version string or "-" in case of problems
+ */
+ static OUString GetOSVersion();
+
+ /** Get useful OS, Hardware and configuration information,
+ * cf. Help->About, and User-Agent
+ * bSelection = 0 to return all info, 1 for environment only,
+ * and 2 for VCL/render related infos
+ */
+ static OUString GetHWOSConfInfo(const int bSelection = 0, bool bLocalize = true);
+
+ /** Load a localized branding PNG file as a bitmap.
+
+ @param pName Name of the bitmap to load.
+ @param rBitmap Reference to BitmapEx object to load PNG into
+
+ @returns true if the PNG could be loaded, otherwise returns false.
+ */
+ static bool LoadBrandBitmap (const char* pName, BitmapEx &rBitmap);
+
+ ///@}
+
+ /** @name Display and Screen
+ */
+ ///@{
+
+ /** Set the default name of the application for message dialogs and printing.
+
+ @param rDisplayName const reference to string to set the Display name to.
+
+ @see GetDisplayName
+ */
+ static void SetDisplayName( const OUString& rDisplayName );
+
+ /** Get the default name of the application for message dialogs and printing.
+
+ @returns The display name of the application.
+ */
+ static OUString GetDisplayName();
+
+ /** Get the toolkit's name. e.g. gtk3
+
+ @returns The toolkit name.
+ */
+ static OUString GetToolkitName();
+
+ /** Get the number of screens available for the display.
+
+ @returns The number of screens available.
+
+ @see GetScreenPosSizePixel
+ */
+ static unsigned int GetScreenCount();
+
+ /** Get a screen's rectangular area.
+
+ @param nScreen The number of the screen requested.
+
+ @returns The area of the screen in a Rectangle object.
+
+ @see GetScreenCount
+ */
+ static tools::Rectangle GetScreenPosSizePixel( unsigned int nScreen );
+
+ /** Determines if the screens that make up a display are separate or
+ form one large display area.
+
+ @returns true when screens form up one large display area windows can be
+ moved between single screens (e.g. Xserver with Xinerama, Windows)
+ and false when different screens are separate and windows cannot be moved
+ between them (e.g. Xserver with multiple screens)
+
+ @see GetBestScreen, GetDisplayBuiltInScreen
+ */
+ static bool IsUnifiedDisplay();
+
+ /** Get the "best" screen.
+
+ @returns If IsUnifiedDisplay() == true the return value will be
+ nearest screen of the target rectangle.
+
+ In case of IsUnifiedDisplay() == false the return value
+ will always be GetDisplayDefaultScreen().
+
+ @see IsUnifiedDisplay, GetDisplayBuiltInScreen
+ */
+ SAL_DLLPRIVATE static unsigned int GetBestScreen( const tools::Rectangle& );
+
+ /** Get the built-in screen.
+
+ @return
+ This returns the LCD screen number for a laptop, or the primary
+ external VGA display for a desktop machine - it is where a presenter
+ console should be rendered if there are other (non-built-in) screens
+ present.
+
+ @see IsUnifiedDisplay, GetBestScreen
+ */
+ static unsigned int GetDisplayBuiltInScreen();
+
+ /** Get the display's external screen.
+
+ Practically, this means - Get the screen we should run a presentation on.
+
+ @returns 0 or 1 currently, will fallback to the first available screen if
+ there are more than one external screens. May be changed in the future.
+ */
+ static unsigned int GetDisplayExternalScreen();
+
+ ///@}
+
+ /** @name Accelerators and Mnemonics
+
+ Accelerators allow a user to hold down Ctrl+key (or CMD+key on macOS)
+ combination to gain quick access to functionality.
+
+ Mnemonics are underline letters in things like menus and dialog boxes
+ that allow a user to type in the letter to activate the menu or option.
+ */
+ ///@{
+
+ /** Insert accelerator
+
+ @param pAccel Pointer to an Accelerator object to insert
+
+ @returns true if successful, false if otherwise
+
+ @see RemoveAccel
+ */
+ static bool InsertAccel( Accelerator* pAccel );
+
+ /** Remove accelerator
+
+ @param pAccel Pointer to Accelerator object to remove
+
+ @see InsertAccel
+ */
+ static void RemoveAccel( Accelerator const * pAccel );
+
+ /** Get the number of reserved key codes used by the application.
+
+ @returns number of reserved key codes
+
+ @see GetReservedKeyCode
+ */
+ static size_t GetReservedKeyCodeCount();
+
+ /** Get the reserved key code.
+
+ @param i The keycode number to retrieve
+
+ @returns Const pointer to a KeyCode object
+
+ @see GetReservedKeyCodeCount
+ */
+ static const vcl::KeyCode* GetReservedKeyCode( size_t i );
+
+ ///@}
+
+ /** @name Application Help
+
+ Deals with the help system, and "auto-help", where a user hovers a mouse above
+ a UI element and a tooltip with an explanation pops up.
+ */
+ ///@{
+
+ /** Sets up help
+
+ @param pHelp Pointer to a Help object (optional, can by NULL)
+
+ @see GetHelp
+ */
+ static void SetHelp( Help* pHelp = nullptr );
+
+ /** Gets the application's help
+
+ @returns Pointer to application's help object. Note that the application may
+ not have a help object, so it might return NULL.
+
+ @see SetHelp
+ */
+ static Help* GetHelp();
+
+ ///@}
+
+ /** @name Dialogs
+
+ @remark "Dialog cancel mode" tells a headless install whether to
+ cancel dialogs when they appear. See the DialogCancelMode
+ enumerator.
+ */
+ ///@{
+
+ /** Get the default parent window for dialog boxes.
+
+ @remark This is almost always a terrible method to use to get a parent
+ for a dialog, try hard to instead pass a specific parent window
+ to dialogs.
+
+ GetDefDialogParent does all sorts of things to try and find a useful
+ parent window for dialogs. It first uses the topmost parent of the
+ active window to avoid using floating windows or other dialog boxes.
+ If there are no active windows, then it will take a random stab and
+ choose the first visible top window. Otherwise, it defaults to
+ the desktop.
+
+ @returns Pointer to the default window.
+ */
+ static weld::Window* GetDefDialogParent();
+
+
+ /** Gets the dialog cancel mode for headless environments.
+
+ @return DialogCancelMode value
+
+ @see SetDialogCancelMode, IsDialogCancelEnabled
+ */
+ static DialogCancelMode GetDialogCancelMode();
+
+ /** Sets the dialog cancel mode for headless environments.
+
+ This should be private, but XFrameImpl needs to access it and current
+ baseline gcc doesn't support forward definition of anonymous classes.
+ You probably should use EnableHeadlessMode instead.
+
+ @param mode DialogCancel mode value
+
+ @see GetDialogCancelMode, IsDialogCancelEnabled, EnableHeadlessMode
+ */
+ static void SetDialogCancelMode( DialogCancelMode mode );
+
+ /** Determines if dialog cancel mode is enabled.
+
+ @returns True if dialog cancel mode is enabled, false if disabled.
+
+ @see GetDialogCancelMode, SetDialogCancelMode
+ */
+ static bool IsDialogCancelEnabled();
+
+
+ /** Make a dialog box a system window or not.
+
+ @param nMode Can be either: SystemWindowFlags::NOAUTOMODE (0x0001) or
+ SystemWindowFlags::DIALOG (0x0002)
+
+ @see GetSystemWindowMode
+ */
+ static void SetSystemWindowMode( SystemWindowFlags nMode );
+
+ /** Get the system window mode of dialogs.
+
+ @returns SystemWindowFlags::NOAUTOMODE (0x0001) or SystemWindowFlags::DIALOG (0x0002)
+
+ @see SetSystemWindowMode
+ */
+ static SystemWindowFlags GetSystemWindowMode();
+
+ ///@}
+
+ /** @name VCL Toolkit and UNO Wrapper
+
+ The VCL Toolkit implements the UNO XToolkit interface, which specifies a
+ factory interface for the window toolkit. It is similar to the abstract window
+ toolkit (AWT) in Java.
+
+ */
+ ///@{
+
+ /** Gets the VCL toolkit.
+
+ @attention The global service manager has to be created before getting the toolkit!
+
+ @returns UNO reference to VCL toolkit
+ */
+ static css::uno::Reference< css::awt::XToolkit > GetVCLToolkit();
+
+ ///@}
+
+
+ /*** @name Graphic Filters
+ */
+ ///@{
+
+ /** Setup a new graphics filter
+
+ @param rLink Const reference to a Link object, which the filter calls upon.
+
+ @see GetFilterHdl
+ */
+ static void SetFilterHdl( const Link<ConvertData&,bool>& rLink );
+
+ ///@}
+
+ /** @name Headless Mode
+ */
+
+ /** Enables headless mode.
+
+ @param dialogsAreFatal Set to true if a dialog ends the session, false if not.
+ */
+ static void EnableHeadlessMode( bool dialogsAreFatal );
+
+ /** Determines if headless mode is enabled
+
+ @return True if headless mode is enabled, false if not.
+ */
+ static bool IsHeadlessModeEnabled();
+
+ /** Enable Console Only mode
+
+ Convenience function to enable headless and bitmap rendering.
+ */
+ static void EnableConsoleOnly();
+
+ /** Enable software-only bitmap rendering
+ */
+ static void EnableBitmapRendering();
+
+ /** Determines if bitmap rendering is enabled
+
+ @return True if bitmap rendering is enabled.
+ */
+ static bool IsBitmapRendering();
+
+ ///@}
+
+ /** @name Event Testing Mode
+ */
+
+ /** Enables event testing mode.
+
+ */
+ static void EnableEventTestingMode();
+
+ /** Determines if event testing mode is enabled
+
+ @return True if event testing mode is enabled, false if not.
+ */
+ static bool IsEventTestingModeEnabled();
+
+ /** Set safe mode to enabled */
+ static void EnableSafeMode();
+
+ /** Determines if safe mode is enabled */
+ static bool IsSafeModeEnabled();
+
+ ///@}
+
+ /** Get the desktop environment the process is currently running in
+
+ @returns String representing the desktop environment
+ */
+ static const OUString& GetDesktopEnvironment();
+
+ /*** @name Platform Functionality
+ */
+ ///@{
+
+ /** Add a file to the system shells recent document list if there is any.
+ This function may have no effect under Unix because there is no standard
+ API among the different desktop managers.
+
+ @param rFileUrl The file url of the document.
+
+ @param rMimeType The mime content type of the document specified by aFileUrl.
+ If an empty string will be provided "application/octet-stream"
+ will be used.
+
+ @param rDocumentService The app (or "document service") you will be adding the file to
+ e.g. com.sun.star.text.TextDocument
+ */
+ static void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService);
+
+ /*** Show a native error messagebox
+
+ @param sTitle Title of error messagebox
+
+ @param sMessage Message displayed in messagebox
+ */
+ static void ShowNativeErrorBox(const OUString& sTitle ,
+ const OUString& sMessage);
+
+ /** Update main thread identifier */
+ static void UpdateMainThread();
+
+ /** Do we have a native / system file selector available?
+
+ @returns True if native file selector is available, false otherwise.
+ */
+ static bool hasNativeFileSelection();
+
+ /** Create a platform specific file picker, if one is available, otherwise return an
+ empty reference.
+
+ @param rServiceManager Const reference to a UNO component context (service manager).
+
+ @returns File picker if available, otherwise an empty reference.
+ */
+ static css::uno::Reference< css::ui::dialogs::XFilePicker2 >
+ createFilePicker( const css::uno::Reference< css::uno::XComponentContext >& rServiceManager );
+
+ /** Create a platform specific folder picker, if one is available, otherwise return an
+ empty reference
+
+ @param rServiceManager Const reference to a UNO component context (service manager).
+
+ @returns Folder picker if available, otherwise an empty reference.
+ */
+ static css::uno::Reference< css::ui::dialogs::XFolderPicker2 >
+ createFolderPicker( const css::uno::Reference< css::uno::XComponentContext >& rServiceManager );
+
+ /** Cancel all open dialogs
+ */
+ static void EndAllDialogs();
+
+ /** Cancel all open popups
+ */
+ static void EndAllPopups();
+
+ /** Returns true, if the VCL plugin runs on the system event loop.
+ *
+ * AKA the VCL plugin can't handle nested event loops, like WASM or mobile.
+ */
+ static bool IsOnSystemEventLoop();
+
+ ///@}
+
+ // For vclbootstrapprotector:
+ static void setDeInitHook(Link<LinkParamNone*,void> const & hook);
+
+ static std::unique_ptr<weld::Builder> CreateBuilder(weld::Widget* pParent, const OUString &rUIFile, bool bMobile = false, sal_uInt64 nLOKWindowId = 0);
+ // For the duration of vcl parent windows
+ static std::unique_ptr<weld::Builder> CreateInterimBuilder(vcl::Window* pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId = 0);
+
+ static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType,
+ VclButtonsType eButtonType, const OUString& rPrimaryMessage,
+ bool bMobile = false);
+
+ static weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow);
+
+ // ILibreOfficeKitNotifier
+ void* m_pCallbackData;
+ LibreOfficeKitCallback m_pCallback;
+
+ virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId,
+ const OUString& rAction,
+ const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) const override;
+ virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const override;
+
+private:
+ DECL_DLLPRIVATE_STATIC_LINK( Application, PostEventHandler, void*, void );
+};
+
+class SolarMutexGuard
+ : public osl::Guard<comphelper::SolarMutex>
+{
+public:
+ SolarMutexGuard()
+ : osl::Guard<comphelper::SolarMutex>( Application::GetSolarMutex() ) {}
+};
+
+class SolarMutexClearableGuard
+ : public osl::ClearableGuard<comphelper::SolarMutex>
+{
+public:
+ SolarMutexClearableGuard()
+ : osl::ClearableGuard<comphelper::SolarMutex>( Application::GetSolarMutex() ) {}
+};
+
+class SolarMutexResettableGuard
+ : public osl::ResettableGuard<comphelper::SolarMutex>
+{
+public:
+ SolarMutexResettableGuard()
+ : osl::ResettableGuard<comphelper::SolarMutex>( Application::GetSolarMutex() ) {}
+};
+
+namespace vcl
+{
+
+/** guard class that uses tryToAcquire() and has isAcquired() to check
+ */
+class SolarMutexTryAndBuyGuard
+{
+private:
+ bool m_isAcquired;
+#ifdef DBG_UTIL
+ bool m_isChecked;
+#endif
+ comphelper::SolarMutex& m_rSolarMutex;
+
+ SolarMutexTryAndBuyGuard(const SolarMutexTryAndBuyGuard&) = delete;
+ SolarMutexTryAndBuyGuard& operator=(const SolarMutexTryAndBuyGuard&) = delete;
+
+public:
+
+ SolarMutexTryAndBuyGuard()
+ : m_isAcquired(false)
+#ifdef DBG_UTIL
+ , m_isChecked(false)
+#endif
+ , m_rSolarMutex(Application::GetSolarMutex())
+
+ {
+ m_isAcquired = m_rSolarMutex.tryToAcquire();
+ }
+
+ ~SolarMutexTryAndBuyGuard()
+ {
+#ifdef DBG_UTIL
+ assert(m_isChecked);
+#endif
+ if (m_isAcquired)
+ m_rSolarMutex.release();
+ }
+
+ bool isAcquired()
+ {
+#ifdef DBG_UTIL
+ m_isChecked = true;
+#endif
+ return m_isAcquired;
+ }
+};
+
+} // namespace vcl
+
+/**
+ A helper class that calls Application::ReleaseSolarMutex() in its constructor
+ and restores the mutex in its destructor.
+*/
+class SolarMutexReleaser
+{
+ const sal_uInt32 mnReleased;
+public:
+ SolarMutexReleaser(): mnReleased(Application::ReleaseSolarMutex()) {}
+ ~SolarMutexReleaser() { Application::AcquireSolarMutex( mnReleased ); }
+};
+
+VCL_DLLPUBLIC Application* GetpApp();
+
+// returns true if vcl is already initialized
+VCL_DLLPUBLIC bool IsVCLInit();
+// returns true if vcl successfully initializes or was already initialized
+VCL_DLLPUBLIC bool InitVCL();
+VCL_DLLPUBLIC void DeInitVCL();
+
+VCL_DLLPUBLIC bool InitAccessBridge();
+
+// only allowed to call, if no thread is running. You must call JoinMainLoopThread to free all memory.
+VCL_DLLPUBLIC void CreateMainLoopThread( oslWorkerFunction pWorker, void * pThreadData );
+VCL_DLLPUBLIC void JoinMainLoopThread();
+
+/// The following are to manage per-view (frame) help data.
+struct ImplSVHelpData;
+VCL_DLLPUBLIC ImplSVHelpData* CreateSVHelpData();
+VCL_DLLPUBLIC void DestroySVHelpData(ImplSVHelpData*);
+VCL_DLLPUBLIC void SetSVHelpData(ImplSVHelpData*);
+
+/// The following are to manage per-view (frame) window data.
+struct ImplSVWinData;
+VCL_DLLPUBLIC ImplSVWinData* CreateSVWinData();
+VCL_DLLPUBLIC void DestroySVWinData(ImplSVWinData*);
+VCL_DLLPUBLIC void SetSVWinData(ImplSVWinData*);
+
+inline void Application::EndYield()
+{
+ PostUserEvent( Link<void*,void>() );
+}
+
+#endif // _APP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/svmain.hxx b/include/vcl/svmain.hxx
new file mode 100644
index 000000000..ca6010784
--- /dev/null
+++ b/include/vcl/svmain.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SVMAIN_HXX
+#define INCLUDED_VCL_SVMAIN_HXX
+
+#include <sal/config.h>
+#include <vcl/dllapi.h>
+
+// #i47888# allow for alternative initialization as required for e.g. MacOSX
+VCL_DLLPUBLIC int ImplSVMain();
+
+VCL_DLLPUBLIC int SVMain();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/svtaccessiblefactory.hxx b/include/vcl/svtaccessiblefactory.hxx
new file mode 100644
index 000000000..14bcc6532
--- /dev/null
+++ b/include/vcl/svtaccessiblefactory.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_INCLUDE_VCL_SVTACCESSIBLEFACTORY_HXX
+#define INCLUDED_INCLUDE_VCL_SVTACCESSIBLEFACTORY_HXX
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+
+namespace vcl { class IAccessibleFactory; }
+
+namespace vcl
+{
+ /** a client for the accessibility implementations which have been outsourced
+ from the main vcl/svtools libraries
+
+ All instances of this class share a reference to a common IAccessibleFactory
+ instance, which is used for creating all kind of Accessibility related
+ components.
+
+ When the AccessibleFactoryAccess goes away, also this factory goes away, and the respective
+ library is unloaded.
+
+ This class is not thread-safe.
+ */
+ class UNLESS_MERGELIBS(VCL_DLLPUBLIC) AccessibleFactoryAccess
+ {
+ private:
+ bool m_bInitialized;
+
+ public:
+ AccessibleFactoryAccess();
+
+ IAccessibleFactory& getFactory();
+
+ private:
+ void ensureInitialized();
+ };
+} // namespace svt
+
+#endif // INCLUDED_INCLUDE_VCL_SVTACCESSIBLEFACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/syschild.hxx b/include/vcl/syschild.hxx
new file mode 100644
index 000000000..11d85b029
--- /dev/null
+++ b/include/vcl/syschild.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SYSCHILD_HXX
+#define INCLUDED_VCL_SYSCHILD_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/window.hxx>
+
+struct SystemEnvData;
+struct SystemWindowData;
+
+class VCL_DLLPUBLIC SystemChildWindow : public vcl::Window
+{
+private:
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInitSysChild( vcl::Window* pParent, WinBits nStyle, SystemWindowData *pData, bool bShow = false );
+
+ // Copy assignment is forbidden and not implemented.
+ SystemChildWindow (const SystemChildWindow &) = delete;
+ SystemChildWindow & operator= (const SystemChildWindow &) = delete;
+
+public:
+ explicit SystemChildWindow( vcl::Window* pParent, WinBits nStyle );
+ // create a SystemChildWindow using the given SystemWindowData
+ explicit SystemChildWindow( vcl::Window* pParent, WinBits nStyle, SystemWindowData *pData, bool bShow = true );
+ virtual ~SystemChildWindow() override;
+ virtual Size GetOptimalSize() const override;
+ virtual void dispose() override;
+
+ virtual const SystemEnvData* GetSystemData() const override;
+
+ // per default systemchildwindows erase their background for better plugin support
+ // however, this might not always be required
+ void EnableEraseBackground( bool bEnable );
+ void SetForwardKey( bool bEnable );
+ //To avoid annoying flashing under X entering and leaving slides with opengl effects set the leaving
+ //bitmap as the background pixmap of the opengl child window and the entering bitmap as the background
+ //pixmap of the non-opengl parent window. If any expose events occur around the start and end of
+ //the transition then those windows are default filled by X with the desired start/end image so there's
+ //no visible flash
+ void SetLeaveEnterBackgrounds(const css::uno::Sequence<css::uno::Any>& rLeaveArgs, const css::uno::Sequence<css::uno::Any>& rEnterArgs);
+ // return the platform specific handle/id of this window;
+ sal_IntPtr GetParentWindowHandle() const;
+
+ void* CreateGStreamerSink();
+};
+
+#endif // INCLUDED_VCL_SYSCHILD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
new file mode 100644
index 000000000..07ddea45d
--- /dev/null
+++ b/include/vcl/sysdata.hxx
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_SYSDATA_HXX
+#define INCLUDED_VCL_SYSDATA_HXX
+
+#include <sal/types.h>
+#include <vcl/dllapi.h>
+
+class SalFrame;
+
+#ifdef MACOSX
+// predeclare the native classes to avoid header/include problems
+typedef struct CGContext *CGContextRef;
+typedef struct CGLayer *CGLayerRef;
+typedef const struct __CTFont * CTFontRef;
+#ifdef __OBJC__
+@class NSView;
+#else
+class NSView;
+#endif
+#endif
+
+#ifdef IOS
+typedef const struct __CTFont * CTFontRef;
+typedef struct CGContext *CGContextRef;
+#endif
+
+#if defined(_WIN32)
+#include <prewin.h>
+#include <windef.h>
+#include <postwin.h>
+#endif
+
+struct VCL_DLLPUBLIC SystemEnvData
+{
+ enum class Toolkit { Invalid, Gen, Gtk, Qt };
+ Toolkit toolkit; // the toolkit in use
+#if defined(_WIN32)
+ HWND hWnd; // the window hwnd
+#elif defined( MACOSX )
+ NSView* mpNSView; // the cocoa (NSView *) implementing this object
+ bool mbOpenGL; // use an OpenGL providing NSView
+#elif defined( ANDROID )
+ // Nothing
+#elif defined( IOS )
+ // Nothing
+#elif defined( UNX )
+ enum class Platform { Invalid, Wayland, Xcb, WASM };
+
+ void* pDisplay; // the relevant display connection
+ SalFrame* pSalFrame; // contains a salframe, if object has one
+ void* pWidget; // the corresponding widget
+ void* pVisual; // the visual in use
+ int nScreen; // the current screen of the window
+ // note: this is a "long" in Xlib *but* in the protocol it's only 32-bit
+ // however, the GTK3 vclplug wants to store pointers in here!
+ sal_IntPtr aShellWindow; // the window of the frame's shell
+ Platform platform; // the windowing system in use
+private:
+ sal_uIntPtr aWindow; // the window of the object
+public:
+
+ void SetWindowHandle(sal_uIntPtr nWindow)
+ {
+ aWindow = nWindow;
+ }
+
+ // SalFrame can be any SalFrame, just needed to determine which backend to use
+ // to resolve the window handle
+ sal_uIntPtr GetWindowHandle(const SalFrame* pReference) const;
+
+#endif
+
+ SystemEnvData()
+ : toolkit(Toolkit::Invalid)
+#if defined(_WIN32)
+ , hWnd(nullptr)
+#elif defined( MACOSX )
+ , mpNSView(nullptr)
+ , mbOpenGL(false)
+#elif defined( ANDROID )
+#elif defined( IOS )
+#elif defined( UNX )
+ , pDisplay(nullptr)
+ , pSalFrame(nullptr)
+ , pWidget(nullptr)
+ , pVisual(nullptr)
+ , nScreen(0)
+ , aShellWindow(0)
+ , platform(Platform::Invalid)
+ , aWindow(0)
+#endif
+ {
+ }
+};
+
+struct SystemParentData
+{
+ sal_uInt32 nSize; // size in bytes of this structure
+#if defined(_WIN32)
+ HWND hWnd; // the window hwnd
+#elif defined( MACOSX )
+ NSView* pView; // the cocoa (NSView *) implementing this object
+#elif defined( ANDROID )
+ // Nothing
+#elif defined( IOS )
+ // Nothing
+#elif defined( UNX )
+ sal_uIntPtr aWindow; // the window of the object
+ bool bXEmbedSupport:1; // decides whether the object in question
+ // should support the XEmbed protocol
+#endif
+};
+
+struct SystemMenuData
+{
+#if defined(_WIN32)
+ HMENU hMenu; // the menu handle of the menu bar
+#else
+ // Nothing
+#endif
+};
+
+struct SystemGraphicsData
+{
+ sal_uInt32 nSize; // size in bytes of this structure
+#if defined(_WIN32)
+ HDC hDC; // handle to a device context
+ HWND hWnd; // optional handle to a window
+#elif defined( MACOSX )
+ CGContextRef rCGContext; // CoreGraphics graphic context
+#elif defined( ANDROID )
+ // Nothing
+#elif defined( IOS )
+ CGContextRef rCGContext; // CoreGraphics graphic context
+#elif defined( UNX )
+ void* pDisplay; // the relevant display connection
+ sal_uIntPtr hDrawable; // a drawable
+ void* pVisual; // the visual in use
+ int nScreen; // the current screen of the drawable
+ void* pXRenderFormat; // render format for drawable
+ void* pSurface; // the cairo surface when using svp-based backends
+#endif
+ SystemGraphicsData()
+ : nSize( sizeof( SystemGraphicsData ) )
+#if defined(_WIN32)
+ , hDC( nullptr )
+ , hWnd( nullptr )
+#elif defined( MACOSX )
+ , rCGContext( nullptr )
+#elif defined( ANDROID )
+ // Nothing
+#elif defined( IOS )
+ , rCGContext( NULL )
+#elif defined( UNX )
+ , pDisplay( nullptr )
+ , hDrawable( 0 )
+ , pVisual( nullptr )
+ , nScreen( 0 )
+ , pXRenderFormat( nullptr )
+ , pSurface( nullptr )
+#endif
+ { }
+};
+
+struct SystemWindowData
+{
+#if defined(_WIN32) // meaningless on Windows
+#elif defined( MACOSX )
+ bool bOpenGL; // create an OpenGL providing NSView
+ bool bLegacy; // create a 2.1 legacy context, only valid if bOpenGL == true
+#elif defined( ANDROID )
+ // Nothing
+#elif defined( IOS )
+ // Nothing
+#elif defined( UNX )
+ void* pVisual; // the visual to be used
+ bool bClipUsingNativeWidget; // default is false, true will attempt to clip the childwindow with a native widget
+#endif
+};
+
+#endif // INCLUDED_VCL_SYSDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
new file mode 100644
index 000000000..24f41331e
--- /dev/null
+++ b/include/vcl/syswin.hxx
@@ -0,0 +1,249 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <vcl/idle.hxx>
+#include <vcl/vclenum.hxx>
+#include <vcl/window.hxx>
+#include <vcl/windowstate.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <memory>
+
+class SalInstanceBuilder;
+class ScreenshotTest;
+class MenuBar;
+class MnemonicGenerator;
+class NotebookBar;
+class TaskPaneList;
+class VclBuilder;
+struct NotebookBarAddonsItem;
+
+#define ICON_LO_DEFAULT 1
+#define ICON_TEXT_DOCUMENT 2
+#define ICON_SPREADSHEET_DOCUMENT 4
+#define ICON_DRAWING_DOCUMENT 6
+#define ICON_PRESENTATION_DOCUMENT 8
+#define ICON_TEMPLATE 11
+#define ICON_DATABASE_DOCUMENT 12
+#define ICON_MATH_DOCUMENT 13
+#define ICON_MACROLIBRARY 1
+
+enum class MenuBarMode
+{
+ Normal, Hide
+};
+
+enum class TitleButton
+{
+ Docking = 1,
+ Hide = 2,
+ Menu = 4,
+};
+
+//helper baseclass to ease retro fitting dialogs/tabpages that load a resource
+//to load a .ui file instead
+//
+//vcl requires the Window Children of a Parent Window to be destroyed before
+//the Parent Window. VclBuilderContainer owns the VclBuilder which owns the
+//Children Window. So the VclBuilderContainer dtor must be called before
+//the Parent Window dtor.
+//
+//i.e. class Dialog : public SystemWindow, public VclBuilderContainer
+//not class Dialog : public VclBuilderContainer, public SystemWindow
+//
+//With the new 'dispose' framework, it is necessary to force the builder
+//dispose before the Window dispose; so a Dialog::dispose() method would
+//finish: disposeBuilder(); SystemWindow::dispose() to capture this ordering.
+
+class VCL_DLLPUBLIC VclBuilderContainer
+{
+public:
+ VclBuilderContainer();
+ virtual ~VclBuilderContainer();
+ void disposeBuilder();
+
+ void setDeferredProperties();
+
+protected:
+ std::unique_ptr<VclBuilder> m_pUIBuilder;
+
+ friend class ::SalInstanceBuilder;
+ friend class ::ScreenshotTest;
+};
+
+class VCL_DLLPUBLIC SystemWindow
+ : public vcl::Window
+ , public VclBuilderContainer
+{
+ friend class WorkWindow;
+ class ImplData;
+
+private:
+ VclPtr<MenuBar> mpMenuBar;
+ Size maMinOutSize;
+ bool mbDockBtn;
+ bool mbHideBtn;
+ bool mbSysChild;
+ bool mbIsCalculatingInitialLayoutSize;
+ bool mbInitialLayoutSizeCalculated;
+ bool mbPaintComplete;
+ MenuBarMode mnMenuBarMode;
+ sal_uInt16 mnIcon;
+ std::unique_ptr<ImplData> mpImplData;
+ Idle maLayoutIdle;
+ OUString maNotebookBarUIFile;
+protected:
+ bool mbIsDeferredInit;
+ VclPtr<vcl::Window> mpDialogParent;
+public:
+ using Window::ImplIsInTaskPaneList;
+ SAL_DLLPRIVATE bool ImplIsInTaskPaneList( vcl::Window* pWin );
+ SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDeferredInit; }
+
+private:
+ SAL_DLLPRIVATE void ImplMoveToScreen( tools::Long& io_rX, tools::Long& io_rY, tools::Long i_nWidth, tools::Long i_nHeight, vcl::Window const * i_pConfigureWin );
+ SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
+ DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, Timer*, void );
+
+ // try to extract content and return as Bitmap. To do that reliably, a Yield-loop
+ // like in Execute() has to be executed and it is necessary to detect when the
+ // paint is finished
+ virtual void PrePaint(vcl::RenderContext& rRenderContext) override;
+ virtual void PostPaint(vcl::RenderContext& rRenderContext) override;
+
+ // ensureRepaint - triggers Application::Yield until the dialog is
+ // completely repainted. Sometimes needed for dialogs showing progress
+ // during actions
+ SAL_DLLPRIVATE void ensureRepaint();
+
+protected:
+ // Single argument ctors shall be explicit.
+ explicit SystemWindow(WindowType nType, const char* pIdleDebugName);
+ void loadUI(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
+
+ void SetWindowStateData( const WindowStateData& rData );
+
+ virtual void settingOptimalLayoutSize(Window *pBox);
+
+ SAL_DLLPRIVATE void DoInitialLayout();
+
+public:
+ virtual ~SystemWindow() override;
+ virtual void dispose() override;
+
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+
+ virtual bool Close();
+ virtual void TitleButtonClick( TitleButton nButton );
+ virtual void Resizing( Size& rSize );
+ virtual void Resize() override;
+ virtual Size GetOptimalSize() const override;
+ virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
+ bool isLayoutEnabled() const;
+ void setOptimalLayoutSize(bool bAllowWindowShrink);
+ bool isCalculatingInitialLayoutSize() const { return mbIsCalculatingInitialLayoutSize; }
+
+ void SetIcon( sal_uInt16 nIcon );
+ sal_uInt16 GetIcon() const { return mnIcon; }
+ // for systems like MacOSX which can display the URL a document is loaded from
+ // separately from the window title
+ void SetRepresentedURL( const OUString& );
+
+ void ShowTitleButton( TitleButton nButton, bool bVisible );
+ bool IsTitleButtonVisible( TitleButton nButton ) const;
+
+ void SetMinOutputSizePixel( const Size& rSize );
+ const Size& GetMinOutputSizePixel() const { return maMinOutSize; }
+ void SetMaxOutputSizePixel( const Size& rSize );
+ const Size& GetMaxOutputSizePixel() const;
+
+ void SetWindowState(std::string_view rStr);
+ OString GetWindowState(WindowStateMask nMask = WindowStateMask::All) const;
+
+ void SetMenuBar(MenuBar* pMenuBar);
+ MenuBar* GetMenuBar() const { return mpMenuBar; }
+ void SetMenuBarMode( MenuBarMode nMode );
+ void CollectMenuBarMnemonics(MnemonicGenerator& rMnemonicGenerator) const;
+ int GetMenuBarHeight() const;
+
+ void SetNotebookBar(const OUString& rUIXMLDescription,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ const NotebookBarAddonsItem& aNotebookBarAddonsItem,
+ bool bReloadNotebookbar = false);
+
+ void CloseNotebookBar();
+ VclPtr<NotebookBar> const & GetNotebookBar() const;
+
+ TaskPaneList* GetTaskPaneList();
+ void GetWindowStateData( WindowStateData& rData ) const;
+
+ virtual void SetText( const OUString& rStr ) override;
+ virtual OUString GetText() const override;
+
+ /**
+ Returns the screen number the window is on
+
+ The Display Screen number is counted the same way that
+ <code>Application::GetScreenPosSizePixel</code>
+ and of course <code>SystemWindow::SetScreenNumber</code>
+ are counted in.
+
+ In case the window is positioned on multiple screens the
+ screen number returned will be of the screen containing the
+ upper left pixel of the frame area (that is of the client
+ area on system decorated windows, or the frame area of
+ undecorated resp. owner decorated windows.
+
+ @returns the screen number
+
+ @see SystemWindow::SetScreenNumber
+ */
+ unsigned int GetScreenNumber() const;
+ /**
+ Move the Window to a new screen. The same rules for
+ positioning apply as in <code>SystemWindow::GetScreenNumber</code>
+
+ The Display Screen number is counted the same way that
+ <code>Application::GetScreenPosSizePixel</code>
+ and of course <code>SystemWindow::GetScreenNumber</code>
+ are counted in.
+
+ @see GetScreenNumber
+ */
+ void SetScreenNumber( unsigned int nNewScreen );
+
+ void SetApplicationID( const OUString &rApplicationID );
+
+ bool UpdatePositionData();
+
+ void SetCloseHdl(const Link<SystemWindow&,void>& rLink);
+ const Link<SystemWindow&,void>& GetCloseHdl() const;
+
+ SAL_DLLPRIVATE bool hasPendingLayout() const { return maLayoutIdle.IsActive(); }
+
+ virtual void doDeferredInit(WinBits nBits);
+
+ // Screenshot interface
+ VclPtr<VirtualDevice> createScreenshot();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
new file mode 100644
index 000000000..40fdd54f2
--- /dev/null
+++ b/include/vcl/tabctrl.hxx
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_TABCTRL_HXX
+#define INCLUDED_VCL_TABCTRL_HXX
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/ctrl.hxx>
+#include <vcl/EnumContext.hxx>
+#include <vcl/NotebookbarContextControl.hxx>
+
+class ImplTabItem;
+struct ImplTabCtrlData;
+class TabPage;
+class Button;
+class PushButton;
+class ListBox;
+class ToolBox;
+
+#ifndef TAB_APPEND
+#define TAB_APPEND (sal_uInt16(0xFFFF))
+#define TAB_PAGE_NOTFOUND (sal_uInt16(0xFFFF))
+#endif /* !TAB_APPEND */
+
+#define TAB_OFFSET 3
+#define TAB_TABOFFSET_X 3
+#define TAB_TABOFFSET_Y 3
+#define TAB_EXTRASPACE_X 6
+#define TAB_BORDER_LEFT 1
+#define TAB_BORDER_TOP 1
+#define TAB_BORDER_RIGHT 2
+#define TAB_BORDER_BOTTOM 2
+
+class VCL_DLLPUBLIC TabControl : public Control
+{
+protected:
+ std::unique_ptr<ImplTabCtrlData> mpTabCtrlData;
+ tools::Long mnLastWidth;
+ tools::Long mnLastHeight;
+ sal_uInt16 mnActPageId;
+ sal_uInt16 mnCurPageId;
+ bool mbFormat;
+ bool mbShowTabs;
+ bool mbRestoreHelpId;
+ bool mbSmallInvalidate;
+ bool mbLayoutDirty;
+ Link<TabControl*,void> maActivateHdl;
+ Link<TabControl*,bool> maDeactivateHdl;
+
+ using Control::ImplInitSettings;
+ SAL_DLLPRIVATE void ImplInitSettings( bool bBackground );
+ SAL_DLLPRIVATE ImplTabItem* ImplGetItem( sal_uInt16 nId ) const;
+ SAL_DLLPRIVATE ImplTabItem* ImplGetItem(const Point& rPt) const;
+ SAL_DLLPRIVATE Size ImplGetItemSize( ImplTabItem* pItem, tools::Long nMaxWidth );
+ SAL_DLLPRIVATE tools::Rectangle ImplGetTabRect( sal_uInt16 nPos, tools::Long nWidth = -1, tools::Long nHeight = -1 );
+ SAL_DLLPRIVATE tools::Rectangle ImplGetTabRect(const ImplTabItem*, tools::Long nWidth, tools::Long nHeight);
+ SAL_DLLPRIVATE void ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId );
+ SAL_DLLPRIVATE bool ImplPosCurTabPage();
+ virtual void ImplActivateTabPage( bool bNext );
+ SAL_DLLPRIVATE void ImplShowFocus();
+ SAL_DLLPRIVATE void ImplDrawItem(vcl::RenderContext& rRenderContext, ImplTabItem const * pItem,
+ const tools::Rectangle& rCurRect, bool bFirstInGroup,
+ bool bLastInGroup);
+ SAL_DLLPRIVATE void ImplFreeLayoutData();
+ SAL_DLLPRIVATE bool ImplHandleKeyEvent( const KeyEvent& rKeyEvent );
+
+ DECL_DLLPRIVATE_LINK( ImplListBoxSelectHdl, ListBox&, void );
+ DECL_DLLPRIVATE_LINK( ImplWindowEventListener, VclWindowEvent&, void );
+
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+
+ virtual void FillLayoutData() const override;
+ virtual const vcl::Font& GetCanonicalFont( const StyleSettings& _rStyle ) const override;
+ virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const override;
+ virtual bool ImplPlaceTabs( tools::Long nWidth );
+ SAL_DLLPRIVATE Size ImplCalculateRequisition(sal_uInt16& nHeaderHeight) const;
+
+public:
+ TabControl( vcl::Window* pParent,
+ WinBits nStyle = WB_STDTABCONTROL );
+ virtual ~TabControl() override;
+ virtual void dispose() override;
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+ virtual void Command( const CommandEvent& rCEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+
+ void ActivatePage();
+ bool DeactivatePage();
+
+ virtual Size GetOptimalSize() const override;
+
+ void SetTabPageSizePixel( const Size& rSize );
+
+ void InsertPage( sal_uInt16 nPageId, const OUString& rText,
+ sal_uInt16 nPos = TAB_APPEND );
+ void RemovePage( sal_uInt16 nPageId );
+
+ void SetPageEnabled(sal_uInt16 nPageId, bool bEnable = true);
+ void SetPageVisible(sal_uInt16 nPageId, bool bVisible = true);
+
+ sal_uInt16 GetPagePos( sal_uInt16 nPageId ) const;
+ sal_uInt16 GetPageCount() const;
+ sal_uInt16 GetPageId( sal_uInt16 nPos ) const;
+ sal_uInt16 GetPageId(const Point& rPos) const;
+ sal_uInt16 GetPageId( const OString& rName ) const;
+
+ void SetCurPageId(sal_uInt16 nPageId);
+ sal_uInt16 GetCurPageId() const;
+
+ void SelectTabPage( sal_uInt16 nPageId );
+
+ void SetTabPage(sal_uInt16 nPageId, TabPage* pPage);
+ TabPage* GetTabPage( sal_uInt16 nPageId ) const;
+
+ void SetPageText( sal_uInt16 nPageId, const OUString& rText );
+ OUString const & GetPageText( sal_uInt16 nPageId ) const;
+
+ void SetHelpText( sal_uInt16 nPageId, const OUString& rText );
+ const OUString& GetHelpText( sal_uInt16 nPageId ) const;
+
+ void SetPageName( sal_uInt16 nPageId, const OString& rName ) const;
+ OString GetPageName( sal_uInt16 nPageId ) const;
+
+ void SetAccessibleName( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetAccessibleName( sal_uInt16 nItemId ) const;
+
+ void SetAccessibleDescription( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetAccessibleDescription( sal_uInt16 nItemId ) const;
+
+ void SetPageImage( sal_uInt16 nPageId, const Image& rImage );
+
+ using Control::SetHelpId;
+ using Control::GetHelpId;
+
+ void SetActivatePageHdl( const Link<TabControl*,void>& rLink ) { maActivateHdl = rLink; }
+ void SetDeactivatePageHdl( const Link<TabControl*, bool>& rLink ) { maDeactivateHdl = rLink; }
+
+ // returns (control relative) bounding rectangle for the
+ // character at index nIndex relative to the text of page nPageId
+ using Control::GetCharacterBounds;
+ tools::Rectangle GetCharacterBounds( sal_uInt16 nPageId, tools::Long nIndex ) const;
+
+ // returns the index relative to the text of page nPageId (also returned)
+ // at position rPoint (control relative)
+ using Control::GetIndexForPoint;
+ tools::Long GetIndexForPoint( const Point& rPoint, sal_uInt16& rPageId ) const;
+
+ // returns the rectangle of the tab for page nPageId
+ tools::Rectangle GetTabBounds( sal_uInt16 nPageId ) const;
+
+ virtual void SetPosPixel(const Point& rPos) override;
+ virtual void SetSizePixel(const Size& rNewSize) override;
+ virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize) override;
+
+ virtual Size calculateRequisition() const;
+ void setAllocation(const Size &rAllocation);
+
+ std::vector<sal_uInt16> GetPageIDs() const;
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
+
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+};
+
+class NotebookBar;
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) NotebookbarTabControlBase : public TabControl,
+ public NotebookbarContextControl
+{
+public:
+ NotebookbarTabControlBase( vcl::Window* pParent );
+ ~NotebookbarTabControlBase() override;
+ void dispose() override;
+
+ void SetContext( vcl::EnumContext::Context eContext ) override;
+ void SetIconClickHdl( Link<NotebookBar*, void> aHdl );
+ void SetToolBox( ToolBox* pToolBox );
+ ToolBox* GetToolBox() { return m_pShortcuts; }
+ Control* GetOpenMenu();
+
+ virtual Size calculateRequisition() const override;
+ static sal_uInt16 GetHeaderHeight();
+
+protected:
+ virtual bool ImplPlaceTabs( tools::Long nWidth ) override;
+ virtual void ImplActivateTabPage( bool bNext ) override;
+
+private:
+ bool bLastContextWasSupported;
+ vcl::EnumContext::Context eLastContext;
+ Link<NotebookBar*,void> m_aIconClickHdl;
+ static sal_uInt16 m_nHeaderHeight;
+ VclPtr<ToolBox> m_pShortcuts;
+ VclPtr<PushButton> m_pOpenMenu;
+ DECL_DLLPRIVATE_LINK(OpenMenu, Button*, void);
+};
+
+#endif // INCLUDED_VCL_TABCTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/tabpage.hxx b/include/vcl/tabpage.hxx
new file mode 100644
index 000000000..e06c4c1a7
--- /dev/null
+++ b/include/vcl/tabpage.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_TABPAGE_HXX
+#define INCLUDED_VCL_TABPAGE_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/window.hxx>
+#include <vcl/IContext.hxx>
+
+class ScrollBar;
+
+class VCL_DLLPUBLIC TabPage final
+ : public vcl::Window
+ , public vcl::IContext
+{
+private:
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE void ImplInitSettings();
+ void lcl_Scroll( tools::Long nX, tools::Long nY );
+ DECL_DLLPRIVATE_LINK( ScrollBarHdl, ScrollBar*, void );
+
+ VclPtr<ScrollBar> m_pVScroll;
+ VclPtr<ScrollBar> m_pHScroll;
+ Size maScrollArea;
+ bool mbHasHoriBar;
+ bool mbHasVertBar;
+ Point mnScrollPos;
+ tools::Long mnScrWidth;
+
+public:
+ explicit TabPage( vcl::Window* pParent, WinBits nStyle = 0 );
+ virtual ~TabPage() override;
+ virtual void dispose() override;
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ //To-Do, consider inheriting from VclContainer
+ virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize) override;
+ virtual void SetPosPixel(const Point& rNewPos) override;
+ virtual void SetSizePixel(const Size& rNewSize) override;
+ virtual Size GetOptimalSize() const override;
+
+ // for scrollable tabpage
+ virtual void Resize() override;
+
+ void SetScrollWidth( tools::Long nWidth );
+ void SetScrollHeight( tools::Long nHeight );
+ void SetScrollLeft( tools::Long nLeft );
+ void SetScrollTop( tools::Long Top );
+ void ResetScrollBars();
+};
+
+#endif // INCLUDED_VCL_TABPAGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/task.hxx b/include/vcl/task.hxx
new file mode 100644
index 000000000..5ed8cde7f
--- /dev/null
+++ b/include/vcl/task.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_TASK_HXX
+#define INCLUDED_VCL_TASK_HXX
+
+#include <vcl/dllapi.h>
+
+struct ImplSchedulerData;
+
+enum class TaskPriority
+{
+ HIGHEST, ///< These events should run very fast!
+ DEFAULT, ///< Default priority used, e.g. the default timer priority
+ // Input from the OS event queue is processed before HIGH_IDLE tasks.
+ HIGH_IDLE, ///< Important idle events to be run before processing drawing events
+ RESIZE, ///< Resize runs before repaint, so we won't paint twice
+ REPAINT, ///< All repaint events should go in here
+ POST_PAINT, ///< Everything running directly after painting
+ DEFAULT_IDLE, ///< Default idle priority
+ LOWEST ///< Low, very idle cleanup tasks
+};
+
+#define PRIO_COUNT (static_cast<int>(TaskPriority::LOWEST) + 1)
+
+class VCL_DLLPUBLIC Task
+{
+ friend class Scheduler;
+ friend struct ImplSchedulerData;
+
+ ImplSchedulerData *mpSchedulerData; ///< Pointer to the element in scheduler list
+ const char *mpDebugName; ///< Useful for debugging
+ TaskPriority mePriority; ///< Task priority
+ bool mbActive; ///< Currently in the scheduler
+ bool mbStatic; ///< Is a static object
+
+protected:
+ static void StartTimer( sal_uInt64 nMS );
+
+ const ImplSchedulerData* GetSchedulerData() const { return mpSchedulerData; }
+
+ virtual void SetDeletionFlags();
+
+ /**
+ * How long (in MS) until the Task is ready to be dispatched?
+ *
+ * Simply return Scheduler::ImmediateTimeoutMs if you're ready, like an
+ * Idle. If you have to return Scheduler::InfiniteTimeoutMs, you probably
+ * need another mechanism to wake up the Scheduler or rely on other
+ * Tasks to be scheduled, or simply use a polling Timer.
+ *
+ * @param nTimeNow the current time
+ * @return the sleep time of the Task to become ready
+ */
+ virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nTimeNow ) const = 0;
+
+public:
+ Task( const char *pDebugName );
+ Task( const Task& rTask );
+ virtual ~Task() COVERITY_NOEXCEPT_FALSE;
+ Task& operator=( const Task& rTask );
+
+ void SetPriority(TaskPriority ePriority);
+ TaskPriority GetPriority() const { return mePriority; }
+
+ const char *GetDebugName() const { return mpDebugName; }
+
+ // Call handler
+ virtual void Invoke() = 0;
+
+ /**
+ * Schedules the task for execution
+ *
+ * If the timer is already active, it's reset!
+ * Check with Task::IsActive() to prevent reset.
+ *
+ * If you unset bStartTimer, the Task must call Task::StartTimer(...) to be correctly scheduled!
+ * Otherwise it might just be picked up when the Scheduler runs the next time.
+ *
+ * @param bStartTimer if false, don't schedule the Task by calling Task::StartTimer(0).
+ */
+ virtual void Start(bool bStartTimer = true);
+ void Stop();
+
+ bool IsActive() const { return mbActive; }
+
+ /**
+ * This function must be called for static tasks, so the Task destructor
+ * ignores the scheduler mutex, as it may not be available anymore.
+ * The cleanup is still correct, as it has already happened in
+ * DeInitScheduler call well before the static destructor calls.
+ */
+ void SetStatic() { mbStatic = true; }
+ bool IsStatic() const { return mbStatic; }
+};
+
+#endif // INCLUDED_VCL_TASK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/taskpanelist.hxx b/include/vcl/taskpanelist.hxx
new file mode 100644
index 000000000..c055882e7
--- /dev/null
+++ b/include/vcl/taskpanelist.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_TASKPANELIST_HXX
+#define INCLUDED_VCL_TASKPANELIST_HXX
+
+#include <vcl/dllapi.h>
+
+#include <vector>
+#include <vcl/keycod.hxx>
+#include <vcl/vclptr.hxx>
+
+class KeyEvent;
+
+namespace vcl { class Window; }
+
+class VCL_DLLPUBLIC TaskPaneList
+{
+ ::std::vector< VclPtr<vcl::Window> > mTaskPanes;
+ vcl::Window *FindNextFloat( vcl::Window *pWindow, bool bForward );
+ vcl::Window *FindNextSplitter( vcl::Window *pWindow );
+
+public:
+ bool IsInList( vcl::Window *pWindow );
+
+public:
+ TaskPaneList();
+ ~TaskPaneList();
+
+ void AddWindow( vcl::Window *pWindow );
+ void RemoveWindow( vcl::Window *pWindow );
+ bool HandleKeyEvent(const KeyEvent& rKeyEvent);
+ static bool IsCycleKey(const vcl::KeyCode& rKeyCode);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/test/GraphicsRenderTests.hxx b/include/vcl/test/GraphicsRenderTests.hxx
new file mode 100644
index 000000000..014f0d71e
--- /dev/null
+++ b/include/vcl/test/GraphicsRenderTests.hxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+#pragma once
+
+#include <vcl/bitmap.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/test/TestResult.hxx>
+
+#include <vector>
+
+class VCL_PLUGIN_PUBLIC VclTestResult
+{
+ OUString m_aTestName;
+ //For storing the result of the test.
+ OUString m_aTestStatus;
+ //For storing the resultant bitmap correspondingly to the test.
+ Bitmap m_aResultantBitmap;
+
+public:
+ VclTestResult(OUString atestName, OUString atestStatus, Bitmap atestBitmap)
+ : m_aTestName(atestName)
+ , m_aTestStatus(atestStatus)
+ , m_aResultantBitmap(atestBitmap)
+ {
+ }
+ const OUString& getTestName() const { return m_aTestName; }
+ OUString getStatus(bool bLocalize = false);
+ const Bitmap& getBitmap() const { return m_aResultantBitmap; }
+};
+
+class VCL_PLUGIN_PUBLIC GraphicsRenderTests
+{
+ bool m_aStoreResultantBitmap;
+
+ //For storing the test's info
+ std::vector<VclTestResult> m_aTestResult;
+ //For storing the current graphics Backend in use.
+ OUString m_aCurGraphicsBackend;
+ //Location where the results should be stored.
+ OUString m_aUserInstallPath;
+
+ void testDrawRectWithRectangle();
+ void testDrawRectWithPixel();
+ void testDrawRectWithLine();
+ void testDrawRectWithPolygon();
+ void testDrawRectWithPolyLine();
+ void testDrawRectWithPolyLineB2D();
+ void testDrawRectWithPolyPolygon();
+ void testDrawRectWithPolyPolygonB2D();
+ void testDrawRectAAWithRectangle();
+ void testDrawRectAAWithPixel();
+ void testDrawRectAAWithLine();
+ void testDrawRectAAWithPolygon();
+ void testDrawRectAAWithPolyLine();
+ void testDrawRectAAWithPolyLineB2D();
+ void testDrawRectAAWithPolyPolygon();
+ void testDrawRectAAWithPolyPolygonB2D();
+ void testDrawFilledRectWithRectangle();
+ void testDrawFilledRectWithPolygon();
+ void testDrawFilledRectWithPolyPolygon();
+ void testDrawFilledRectWithPolyPolygon2D();
+ void testDrawDiamondWithPolygon();
+ void testDrawDiamondWithLine();
+ void testDrawDiamondWithPolyline();
+ void testDrawDiamondWithPolylineB2D();
+ void testDrawInvertWithRectangle();
+ void testDrawInvertN50WithRectangle();
+ void testDrawInvertTrackFrameWithRectangle();
+ void testDrawDropShapeWithPolyline();
+ void testDrawDropShapeAAWithPolyline();
+ void testDrawBezierWithPolylineB2D();
+ void testDrawBezierAAWithPolylineB2D();
+ void testDrawDropShapeWithPolygon();
+ void testDrawDropShapeAAWithPolygon();
+ void testDrawBitmap24bpp();
+ void testDrawTransformedBitmap24bpp();
+ void testComplexDrawTransformedBitmap24bpp();
+ void testDrawBitmapExWithAlpha24bpp();
+ void testDrawMask24bpp();
+ void testDrawBlend24bpp();
+ void testDrawBitmap32bpp();
+ void testDrawTransformedBitmap32bpp();
+ void testDrawBitmapExWithAlpha32bpp();
+ void testDrawMask32bpp();
+ void testDrawBlend32bpp();
+ void testDrawBitmap8bppGreyScale();
+ void testDrawTransformedBitmap8bppGreyScale();
+ void testDrawXor();
+ void testClipRectangle();
+ void testClipPolygon();
+ void testClipPolyPolygon();
+ void testClipB2DPolyPolygon();
+ void testDrawOutDev();
+ void testDrawOutDevScaledClipped();
+ void testDrawOutDevSelf();
+ void testDashedLine();
+ void testLinearGradient();
+ void testLinearGradientAngled();
+ void testLinearGradientBorder();
+ void testLinearGradientIntensity();
+ void testLinearGradientSteps();
+ void testAxialGradient();
+ void testRadialGradient();
+ void testRadialGradientOfs();
+ void testLineJoinBevel();
+ void testLineJoinRound();
+ void testLineJoinMiter();
+ void testLineJoinNone();
+ void testLineCapRound();
+ void testLineCapSquare();
+ void testLineCapButt();
+ void testHalfEllipseWithPolyLine();
+ void testHalfEllipseAAWithPolyLine();
+ void testHalfEllipseWithPolyLineB2D();
+ void testHalfEllipseAAWithPolyLineB2D();
+ void testHalfEllipseWithPolygon();
+ void testHalfEllipseAAWithPolygon();
+ void testClosedBezierWithPolyline();
+ void testClosedBezierWithPolygon();
+ void testFilledAsymmetricalDropShape();
+ void testTextDrawing();
+ void testEvenOddRuleInIntersectingRectsWithPolyPolygon();
+ void testEvenOddRuleInIntersectingRectsWithPolyPolygonB2D();
+ void testDrawRectangleOnSize1028WithRect();
+ void testDrawRectangleOnSize4096WithRect();
+ void testDrawRectangleOnSize1028WithPixel();
+ void testDrawRectangleOnSize4096WithPixel();
+ void testDrawRectangleOnSize1028WithLine();
+ void testDrawRectangleOnSize4096WithLine();
+ void testDrawRectangleOnSize1028WithPolygon();
+ void testDrawRectangleOnSize4096WithPolygon();
+ void testDrawRectangleOnSize1028WithPolyLine();
+ void testDrawRectangleOnSize4096WithPolyLine();
+ void testDrawRectangleOnSize1028WithPolyLineB2D();
+ void testDrawRectangleOnSize4096WithPolyLineB2D();
+ void testDrawRectangleOnSize1028WithPolyPolygon();
+ void testDrawRectangleOnSize4096WithPolyPolygon();
+ void testDrawRectangleOnSize1028WithPolyPolygonB2D();
+ void testDrawRectangleOnSize4096WithPolygonPolygonB2D();
+ void testDrawOpenPolygonWithPolyLine();
+ void testDrawOpenPolygonWithPolyLineB2D();
+ void testDrawOpenPolygonWithPolygon();
+ void testDrawOpenPolygonWithPolyPolygon();
+ void testDrawOpenPolygonWithPolyPolygonB2D();
+ void testDrawOpenBezierWithPolyLine();
+ void testDrawOpenBezierWithPolyLineB2D();
+ static OUString returnTestStatus(vcl::test::TestResult const result);
+ void runALLTests();
+ void appendTestResult(OUString aTestName, OUString aTestStatus, Bitmap aTestBitmap = Bitmap());
+
+public:
+ std::vector<VclTestResult>& getTestResults();
+ OUString getResultString(bool bLocalize = false);
+ void run(bool storeResultBitmap = false);
+
+ GraphicsRenderTests()
+ : m_aStoreResultantBitmap(false)
+ {
+ }
+};
diff --git a/include/vcl/test/TestResult.hxx b/include/vcl/test/TestResult.hxx
new file mode 100644
index 000000000..c64d4e88b
--- /dev/null
+++ b/include/vcl/test/TestResult.hxx
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+/** Rendering test result.
+ *
+ * Test either "Passed", "Failed" or "PassedWithQuirks" which means
+ * the test passed but at least one rendering quirk was detected.
+ */
+namespace vcl::test
+{
+enum class TestResult
+{
+ Failed,
+ PassedWithQuirks,
+ Passed
+};
+}
diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx
new file mode 100644
index 000000000..907a6fdd8
--- /dev/null
+++ b/include/vcl/textdata.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_TEXTDATA_HXX
+#define INCLUDED_VCL_TEXTDATA_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <svl/hint.hxx>
+#include <vcl/dllapi.h>
+#include <memory>
+
+enum class ExtTextInputAttr;
+
+// for Notify, if all paragraphs were deleted
+#define TEXT_PARA_ALL SAL_MAX_UINT32
+#define TEXT_INDEX_ALL SAL_MAX_INT32
+
+class TextPaM
+{
+private:
+ sal_uInt32 mnPara;
+ sal_Int32 mnIndex;
+
+public:
+ TextPaM() : mnPara(0), mnIndex(0) {}
+ TextPaM( sal_uInt32 nPara, sal_Int32 nIndex ) : mnPara(nPara), mnIndex(nIndex) {}
+
+ sal_uInt32 GetPara() const { return mnPara; }
+ sal_uInt32& GetPara() { return mnPara; }
+
+ sal_Int32 GetIndex() const { return mnIndex; }
+ sal_Int32& GetIndex() { return mnIndex; }
+
+ inline bool operator == ( const TextPaM& rPaM ) const;
+ inline bool operator != ( const TextPaM& rPaM ) const;
+ inline bool operator < ( const TextPaM& rPaM ) const;
+ inline bool operator > ( const TextPaM& rPaM ) const;
+};
+
+inline bool TextPaM::operator == ( const TextPaM& rPaM ) const
+{
+ return ( mnPara == rPaM.mnPara ) && ( mnIndex == rPaM.mnIndex );
+}
+
+inline bool TextPaM::operator != ( const TextPaM& rPaM ) const
+{
+ return !( *this == rPaM );
+}
+
+inline bool TextPaM::operator < ( const TextPaM& rPaM ) const
+{
+ return ( mnPara < rPaM.mnPara ) ||
+ ( ( mnPara == rPaM.mnPara ) && mnIndex < rPaM.mnIndex );
+}
+
+inline bool TextPaM::operator > ( const TextPaM& rPaM ) const
+{
+ return ( mnPara > rPaM.mnPara ) ||
+ ( ( mnPara == rPaM.mnPara ) && mnIndex > rPaM.mnIndex );
+}
+
+class VCL_DLLPUBLIC TextSelection
+{
+private:
+ TextPaM maStartPaM;
+ TextPaM maEndPaM;
+
+public:
+ TextSelection();
+ TextSelection( const TextPaM& rPaM );
+ TextSelection( const TextPaM& rStart, const TextPaM& rEnd );
+
+ const TextPaM& GetStart() const { return maStartPaM; }
+ TextPaM& GetStart() { return maStartPaM; }
+
+ const TextPaM& GetEnd() const { return maEndPaM; }
+ TextPaM& GetEnd() { return maEndPaM; }
+
+ void Justify();
+
+ bool HasRange() const { return maStartPaM != maEndPaM; }
+
+ inline bool operator == ( const TextSelection& rSel ) const;
+ inline bool operator != ( const TextSelection& rSel ) const;
+};
+
+inline bool TextSelection::operator == ( const TextSelection& rSel ) const
+{
+ return ( ( maStartPaM == rSel.maStartPaM ) && ( maEndPaM == rSel.maEndPaM ) );
+}
+
+inline bool TextSelection::operator != ( const TextSelection& rSel ) const
+{
+ return !( *this == rSel );
+}
+
+class VCL_DLLPUBLIC TextHint : public SfxHint
+{
+private:
+ sal_Int32 mnValue;
+
+public:
+ TextHint( SfxHintId nId );
+ TextHint( SfxHintId nId, sal_Int32 nValue );
+
+ sal_Int32 GetValue() const { return mnValue; }
+};
+
+struct TEIMEInfos
+{
+ OUString aOldTextAfterStartPos;
+ std::unique_ptr<ExtTextInputAttr[]> pAttribs;
+ TextPaM aPos;
+ sal_Int32 nLen;
+ bool bWasCursorOverwrite;
+
+ TEIMEInfos(const TextPaM& rPos, const OUString& rOldTextAfterStartPos);
+ ~TEIMEInfos();
+
+ void CopyAttribs(const ExtTextInputAttr* pA, sal_Int32 nL);
+ void DestroyAttribs();
+};
+
+#endif // INCLUDED_VCL_TEXTDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
new file mode 100644
index 000000000..1dbbd5ba1
--- /dev/null
+++ b/include/vcl/texteng.hxx
@@ -0,0 +1,302 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_TEXTENG_HXX
+#define INCLUDED_VCL_TEXTENG_HXX
+
+#include <memory>
+#include <sal/config.h>
+
+#include <cstddef>
+#include <vector>
+
+#include <vcl/dllapi.h>
+#include <vcl/vclptr.hxx>
+#include <rtl/ustring.hxx>
+#include <svl/SfxBroadcaster.hxx>
+#include <tools/lineend.hxx>
+#include <tools/link.hxx>
+#include <tools/gen.hxx>
+#include <tools/color.hxx>
+#include <vcl/font.hxx>
+#include <vcl/vclenum.hxx>
+
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+class TextDoc;
+class TextView;
+class TextPaM;
+class TextSelection;
+class TEParaPortions;
+class TextAttrib;
+class TextCharAttrib;
+class TextUndo;
+class TextUndoManager;
+class IdleFormatter;
+class TextNode;
+class OutputDevice;
+class KeyEvent;
+class Timer;
+class SfxUndoManager;
+class TextLine;
+struct TEIMEInfos;
+
+namespace com::sun::star::i18n {
+ class XBreakIterator;
+ class XExtendedInputSequenceChecker;
+}
+
+class LocaleDataWrapper;
+
+typedef std::vector<TextView*> TextViews;
+
+class VCL_DLLPUBLIC TextEngine : public SfxBroadcaster
+{
+ friend class TextView;
+ friend class TextSelFunctionSet;
+ friend class ExtTextEngine;
+
+ friend class TextUndo;
+ friend class TextUndoManager;
+ friend class TextUndoDelPara;
+ friend class TextUndoConnectParas;
+ friend class TextUndoSplitPara;
+ friend class TextUndoInsertChars;
+ friend class TextUndoRemoveChars;
+
+ std::unique_ptr<TextDoc> mpDoc;
+ std::unique_ptr<TEParaPortions> mpTEParaPortions;
+ VclPtr<OutputDevice> mpRefDev;
+
+ std::unique_ptr<TextViews> mpViews;
+ TextView* mpActiveView;
+
+ std::unique_ptr<TextUndoManager> mpUndoManager;
+
+ std::unique_ptr<IdleFormatter> mpIdleFormatter;
+
+ std::unique_ptr<TEIMEInfos> mpIMEInfos;
+
+ css::lang::Locale maLocale;
+ css::uno::Reference< css::i18n::XBreakIterator > mxBreakIterator;
+ css::uno::Reference < css::i18n::XExtendedInputSequenceChecker > mxISC;
+
+ tools::Rectangle maInvalidRect;
+
+ std::unique_ptr<LocaleDataWrapper> mpLocaleDataWrapper;
+
+ vcl::Font maFont;
+ Color maTextColor;
+
+ sal_Int32 mnMaxTextLen;
+ tools::Long mnMaxTextWidth;
+ tools::Long mnCharHeight;
+ tools::Long mnCurTextWidth;
+ tools::Long mnCurTextHeight;
+ tools::Long mnDefTab;
+
+ TxtAlign meAlign;
+
+ bool mbIsFormatting : 1; // semaphore for the Hook's
+ bool mbFormatted : 1;
+ bool mbUpdate : 1;
+ bool mbModified : 1;
+ bool mbUndoEnabled : 1;
+ bool mbIsInUndo : 1;
+ bool mbDowning : 1;
+ bool mbRightToLeft : 1;
+ bool mbHasMultiLineParas : 1;
+
+ void CursorMoved( sal_uInt32 nNode );
+ void TextModified();
+
+ void ImpInitDoc();
+ void ImpRemoveText();
+ TextPaM ImpDeleteText( const TextSelection& rSel );
+ TextPaM ImpInsertText( const TextSelection& rSel, sal_Unicode c, bool bOverwrite = false );
+ TextPaM ImpInsertText( const TextSelection& rSel, const OUString& rText );
+ TextPaM ImpInsertParaBreak( const TextSelection& rTextSelection );
+ TextPaM ImpInsertParaBreak( const TextPaM& rPaM );
+ void ImpRemoveChars( const TextPaM& rPaM, sal_Int32 nChars );
+ TextPaM ImpConnectParagraphs( sal_uInt32 nLeft, sal_uInt32 nRight );
+ void ImpRemoveParagraph( sal_uInt32 nPara );
+ void ImpInitWritingDirections( sal_uInt32 nPara );
+ LocaleDataWrapper* ImpGetLocaleDataWrapper();
+
+ // to remain compatible in the minor release we copy the above ImpInsertText
+ // function and add the extra parameter we need but make sure this function
+ // gets not exported. First and second parameter swapped to have a different signature.
+ SAL_DLLPRIVATE TextPaM ImpInsertText( sal_Unicode c, const TextSelection& rSel, bool bOverwrite, bool bIsUserInput = false );
+ // some other new functions needed that must not be exported to remain compatible
+ SAL_DLLPRIVATE css::uno::Reference< css::i18n::XExtendedInputSequenceChecker > const & GetInputSequenceChecker();
+ SAL_DLLPRIVATE bool IsInputSequenceCheckingRequired( sal_Unicode c, const TextSelection& rCurSel ) const;
+
+ // broadcast or adjust selections
+ void ImpParagraphInserted( sal_uInt32 nPara );
+ void ImpParagraphRemoved( sal_uInt32 nPara );
+ void ImpCharsRemoved( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32 nChars );
+ void ImpCharsInserted( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32 nChars );
+
+ DECL_DLLPRIVATE_LINK( IdleFormatHdl, Timer *, void );
+ void CheckIdleFormatter();
+ void IdleFormatAndUpdate( TextView* pCurView, sal_uInt16 nMaxTimerRestarts = 5 );
+
+ bool CreateLines( sal_uInt32 nPara );
+ void CreateAndInsertEmptyLine( sal_uInt32 nPara );
+ void ImpBreakLine( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nPortionStart, tools::Long nRemainingWidth );
+ std::size_t SplitTextPortion( sal_uInt32 nPara, sal_Int32 nPos );
+ void CreateTextPortions( sal_uInt32 nPara, sal_Int32 nStartPos );
+ void RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_Int32 nNewChars );
+ void SeekCursor( sal_uInt32 nNode, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev );
+
+ void FormatDoc();
+ void FormatFullDoc();
+ void FormatAndUpdate( TextView* pCurView = nullptr );
+ bool IsFormatting() const { return mbIsFormatting; }
+ void UpdateViews( TextView* pCurView = nullptr );
+
+ void ImpPaint( OutputDevice* pOut, const Point& rStartPos, tools::Rectangle const* pPaintArea, TextSelection const* pSelection = nullptr );
+
+ bool IsFormatted() const { return mbFormatted; }
+
+ sal_Int32 GetCharPos( sal_uInt32 nPara, std::vector<TextLine>::size_type nLine, tools::Long nDocPosX );
+ tools::Rectangle GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bPreferPortionStart = false );
+ sal_Int32 ImpFindIndex( sal_uInt32 nPortion, const Point& rPosInPara );
+ tools::Long ImpGetPortionXOffset( sal_uInt32 nPara, TextLine const * pLine, std::size_t nTextPortion );
+ tools::Long ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart = false );
+ tools::Long ImpGetOutputOffset( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, sal_Int32 nIndex2 );
+ bool ImpGetRightToLeft( sal_uInt32 nPara, sal_Int32 nPos );
+ static void ImpInitLayoutMode( OutputDevice* pOutDev );
+ TxtAlign ImpGetAlign() const;
+
+ tools::Long CalcTextHeight() const;
+ tools::Long CalcParaHeight( sal_uInt32 nParagraph ) const;
+ tools::Long CalcTextWidth( sal_uInt32 nPara );
+ tools::Long CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_Int32 nPortionLen);
+ Range GetInvalidYOffsets( sal_uInt32 nPortion );
+
+ // for Undo/Redo
+ void InsertContent( std::unique_ptr<TextNode> pNode, sal_uInt32 nPara );
+ TextPaM SplitContent( sal_uInt32 nNode, sal_Int32 nSepPos );
+ TextPaM ConnectContents( sal_uInt32 nLeftNode );
+
+ // adjust PaM's and selections that were transferred to the API to a valid range
+ void ValidateSelection( TextSelection& rSel ) const;
+ void ValidatePaM( TextPaM& rPaM ) const;
+
+public:
+ TextEngine();
+ virtual ~TextEngine() override;
+ TextEngine( const TextEngine& ) = delete;
+ TextEngine& operator=( const TextEngine& ) = delete;
+
+ void SetText( const OUString& rStr );
+ OUString GetText( LineEnd aSeparator = LINEEND_LF ) const;
+ OUString GetText( const TextSelection& rSel, LineEnd aSeparator = LINEEND_LF ) const;
+ OUString GetTextLines( LineEnd aSeparator = LINEEND_LF ) const;
+ void ReplaceText(const TextSelection& rSel, const OUString& rText);
+
+ sal_Int32 GetTextLen() const;
+ sal_Int32 GetTextLen( const TextSelection& rSel ) const;
+
+ void SetFont( const vcl::Font& rFont );
+ const vcl::Font& GetFont() const { return maFont; }
+
+ void SetLeftMargin( sal_uInt16 n );
+
+ void SetUpdateMode( bool bUpdate );
+ bool GetUpdateMode() const { return mbUpdate; }
+
+ sal_uInt16 GetViewCount() const;
+ TextView* GetView( sal_uInt16 nView ) const;
+ void InsertView( TextView* pTextView );
+ void RemoveView( TextView* pTextView );
+ TextView* GetActiveView() const { return mpActiveView;}
+ void SetActiveView( TextView* pView );
+
+ void SetMaxTextLen( sal_Int32 nLen );
+ sal_Int32 GetMaxTextLen() const { return mnMaxTextLen; }
+
+ void SetMaxTextWidth( tools::Long nWidth );
+ tools::Long GetMaxTextWidth() const { return mnMaxTextWidth; }
+
+ tools::Long GetTextHeight() const;
+ tools::Long CalcTextWidth();
+ tools::Long GetCharHeight() const { return mnCharHeight; }
+
+ sal_uInt32 GetParagraphCount() const;
+ OUString GetText( sal_uInt32 nParagraph ) const;
+ sal_Int32 GetTextLen( sal_uInt32 nParagraph ) const;
+ tools::Long GetTextHeight( sal_uInt32 nParagraph ) const;
+
+ void GetTextPortionRange(const TextPaM& rPaM, sal_Int32& nStart, sal_Int32& nEnd);
+
+ sal_uInt16 GetLineCount( sal_uInt32 nParagraph ) const;
+ sal_Int32 GetLineLen( sal_uInt32 nParagraph, sal_uInt16 nLine ) const;
+
+ void SetRightToLeft( bool bR2L );
+ bool IsRightToLeft() const { return mbRightToLeft; }
+
+ bool HasUndoManager() const { return mpUndoManager != nullptr; }
+ SfxUndoManager& GetUndoManager();
+ void UndoActionStart( sal_uInt16 nId = 0 );
+ void UndoActionEnd();
+ void InsertUndo( std::unique_ptr<TextUndo> pUndo, bool bTryMerge = false );
+ bool IsInUndo() const { return mbIsInUndo; }
+ void SetIsInUndo( bool bInUndo ) { mbIsInUndo = bInUndo; }
+ void ResetUndo();
+
+ void EnableUndo( bool bEnable );
+ bool IsUndoEnabled() const { return mbUndoEnabled; }
+
+ void SetModified( bool bModified ) { mbModified = bModified; }
+ bool IsModified() const { return mbModified; }
+
+ bool Read( SvStream& rInput, const TextSelection* pSel = nullptr );
+
+ void Write( SvStream& rOutput );
+
+ TextPaM GetPaM( const Point& rDocPos );
+ tools::Rectangle PaMtoEditCursor( const TextPaM& rPaM, bool bSpecial = false );
+ OUString GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord = nullptr, TextPaM* pEndOfWord = nullptr );
+
+ const TextAttrib* FindAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const;
+ const TextCharAttrib* FindCharAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const;
+
+ void RemoveAttribs( sal_uInt32 nPara );
+ void SetAttrib( const TextAttrib& rAttr, sal_uInt32 nPara, sal_Int32 nStart, sal_Int32 nEnd );
+
+ TxtAlign GetTextAlign() const { return meAlign; }
+ void SetTextAlign( TxtAlign eAlign );
+
+ void Draw( OutputDevice* pDev, const Point& rPos );
+
+ void SetLocale( const css::lang::Locale& rLocale );
+ css::lang::Locale const & GetLocale();
+ css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIterator();
+
+ static bool DoesKeyChangeText( const KeyEvent& rKeyEvent );
+ static bool IsSimpleCharInput( const KeyEvent& rKeyEvent );
+
+ const Color& GetTextColor() const { return maTextColor; }
+};
+
+#endif // INCLUDED_VCL_TEXTENG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/textfilter.hxx b/include/vcl/textfilter.hxx
new file mode 100644
index 000000000..603daafd9
--- /dev/null
+++ b/include/vcl/textfilter.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_VCL_TEXTFILTER_HXX
+#define INCLUDED_VCL_TEXTFILTER_HXX
+
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+
+class VCL_DLLPUBLIC TextFilter
+{
+private:
+ OUString sForbiddenChars;
+
+public:
+ void SetForbiddenChars(const OUString& rSet) { sForbiddenChars = rSet; }
+
+ virtual OUString filter(const OUString& rText);
+
+ TextFilter(const OUString& rForbiddenChars = OUString(" "));
+ virtual ~TextFilter();
+};
+
+#endif // INCLUDED_VCL_TEXTFILTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/textrectinfo.hxx b/include/vcl/textrectinfo.hxx
new file mode 100644
index 000000000..2c212922f
--- /dev/null
+++ b/include/vcl/textrectinfo.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_TEXTRECTINFO_HXX
+#define INCLUDED_VCL_TEXTRECTINFO_HXX
+
+#include <sal/config.h>
+
+#include <tools/long.hxx>
+#include <vcl/dllapi.h>
+class OutputDevice;
+
+class VCL_DLLPUBLIC TextRectInfo
+{
+ friend class ::OutputDevice;
+
+private:
+ tools::Long mnMaxWidth;
+ sal_uInt16 mnLineCount;
+ bool mbEllipsis;
+
+public:
+ TextRectInfo();
+
+ tools::Long GetMaxLineWidth() const { return mnMaxWidth; }
+ bool IsEllipses() const { return mbEllipsis; }
+
+ bool operator ==( const TextRectInfo& rInfo ) const
+ { return ((mnMaxWidth == rInfo.mnMaxWidth) &&
+ (mnLineCount == rInfo.mnLineCount) &&
+ (mbEllipsis == rInfo.mbEllipsis)); }
+ bool operator !=( const TextRectInfo& rInfo ) const
+ { return !(TextRectInfo::operator==( rInfo )); }
+};
+
+inline TextRectInfo::TextRectInfo()
+{
+ mnMaxWidth = 0;
+ mnLineCount = 0;
+ mbEllipsis = false;
+}
+
+#endif // INCLUDED_VCL_TEXTRECTINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/textview.hxx b/include/vcl/textview.hxx
new file mode 100644
index 000000000..29bc302d4
--- /dev/null
+++ b/include/vcl/textview.hxx
@@ -0,0 +1,229 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_TEXTVIEW_HXX
+#define INCLUDED_VCL_TEXTVIEW_HXX
+
+#include <config_options.h>
+#include <tools/gen.hxx>
+#include <tools/lineend.hxx>
+#include <tools/stream.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/dndhelp.hxx>
+#include <vcl/textdata.hxx>
+#include <vcl/outdev.hxx>
+#include <memory>
+
+class TextEngine;
+
+class KeyEvent;
+class MouseEvent;
+class CommandEvent;
+namespace vcl { class Window; }
+
+namespace com::sun::star::datatransfer::clipboard {
+ class XClipboard;
+}
+namespace i18nutil {
+ struct SearchOptions;
+}
+
+
+struct ImpTextView;
+class ExtTextEngine;
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) TETextDataObject final : public css::datatransfer::XTransferable,
+ public ::cppu::OWeakObject
+
+{
+private:
+ OUString maText;
+ SvMemoryStream maHTMLStream;
+
+public:
+ explicit TETextDataObject( const OUString& rText );
+
+ SvMemoryStream& GetHTMLStream() { return maHTMLStream; }
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakObject::release(); }
+
+ // css::datatransfer::XTransferable
+ css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) override;
+ css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) override;
+ sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor ) override;
+};
+
+
+class VCL_DLLPUBLIC TextView final : public vcl::unohelper::DragAndDropClient
+{
+ friend class TextEngine;
+ friend class TextUndo;
+ friend class TextUndoManager;
+ friend class TextSelFunctionSet;
+
+ std::unique_ptr<ImpTextView> mpImpl;
+
+ TextView( const TextView& ) = delete;
+ TextView& operator=( const TextView& ) = delete;
+
+ bool ImpIndentBlock( bool bRight );
+ void ShowSelection();
+ void HideSelection();
+ void ShowSelection( const TextSelection& rSel );
+ void ImpShowHideSelection( const TextSelection* pRange = nullptr );
+
+ TextSelection const & ImpMoveCursor( const KeyEvent& rKeyEvent );
+ TextPaM ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode );
+ bool IsInSelection( const TextPaM& rPaM ) const;
+
+ void ImpPaint(vcl::RenderContext& rRenderContext, const Point& rStartPos, tools::Rectangle const* pPaintArea, TextSelection const* pSelection);
+ void ImpPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
+ void ImpShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bEndKey );
+ void ImpSetSelection( const TextSelection& rSelection );
+ Point ImpGetOutputStartPos( const Point& rStartDocPos ) const;
+
+ void ImpHideDDCursor();
+ void ImpShowDDCursor();
+
+ bool ImplTruncateNewText( OUString& rNewText ) const;
+ bool ImplCheckTextLen( const OUString& rNewText ) const;
+
+ // DragAndDropClient
+ virtual void dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& dge ) override;
+ virtual void dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent& dsde ) override;
+ virtual void drop( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) override;
+ virtual void dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) override;
+ virtual void dragExit( const css::datatransfer::dnd::DropTargetEvent& dte ) override;
+ virtual void dragOver( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
+
+ using DragAndDropClient::dragEnter;
+ using DragAndDropClient::dragExit;
+ using DragAndDropClient::dragOver;
+
+public:
+ TextView( ExtTextEngine* pEng, vcl::Window* pWindow );
+ virtual ~TextView() override;
+
+ TextEngine* GetTextEngine() const;
+ vcl::Window* GetWindow() const;
+
+ void Invalidate();
+ void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll );
+
+ void ShowCursor( bool bGotoCursor = true, bool bForceVisCursor = true );
+ void HideCursor();
+
+ void EnableCursor( bool bEnable );
+ bool IsCursorEnabled() const;
+
+ const TextSelection& GetSelection() const;
+ TextSelection& GetSelection();
+ void SetSelection( const TextSelection& rNewSel );
+ void SetSelection( const TextSelection& rNewSel, bool bGotoCursor );
+ bool HasSelection() const;
+
+ OUString GetSelected() const;
+ OUString GetSelected( LineEnd aSeparator ) const;
+ void DeleteSelected();
+
+ void InsertText( const OUString& rNew );
+
+ bool KeyInput( const KeyEvent& rKeyEvent );
+ void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
+ void MouseButtonUp( const MouseEvent& rMouseEvent );
+ void MouseButtonDown( const MouseEvent& rMouseEvent );
+ void MouseMove( const MouseEvent& rMouseEvent );
+ void Command( const CommandEvent& rCEvt );
+
+ void Cut();
+ void Copy();
+ void Paste();
+
+ void Copy( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard );
+ void Paste( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard );
+
+ void Undo();
+ void Redo();
+
+ void Read( SvStream& rInput );
+
+ void SetStartDocPos( const Point& rPos );
+ const Point& GetStartDocPos() const;
+
+ Point GetDocPos( const Point& rWindowPos ) const;
+ Point GetWindowPos( const Point& rDocPos ) const;
+
+ void SetInsertMode( bool bInsert );
+ bool IsInsertMode() const;
+
+ void SetAutoIndentMode( bool bAutoIndent );
+
+ void SetReadOnly( bool bReadOnly );
+ bool IsReadOnly() const;
+
+ void SetAutoScroll( bool bAutoScroll );
+ bool IsAutoScroll() const;
+
+ void SetCursorAtPoint( const Point& rPointPixel );
+ bool IsSelectionAtPoint( const Point& rPointPixel );
+
+ void SetPaintSelection( bool bPaint);
+
+ // Moved in here from the protected part.
+ // For 'SvtXECTextCursor' (TL). Possibly needs to be solved again differently.
+ TextPaM PageUp( const TextPaM& rPaM );
+ TextPaM PageDown( const TextPaM& rPaM );
+ TextPaM CursorUp( const TextPaM& rPaM );
+ TextPaM CursorDown( const TextPaM& rPaM );
+ TextPaM CursorLeft( const TextPaM& rPaM, sal_uInt16 nCharacterIteratorMode );
+ TextPaM CursorRight( const TextPaM& rPaM, sal_uInt16 nCharacterIteratorMode );
+ TextPaM CursorFirstWord( const TextPaM& rPaM );
+ TextPaM CursorWordLeft( const TextPaM& rPaM );
+ TextPaM CursorWordRight( const TextPaM& rPaM );
+ TextPaM CursorStartOfLine( const TextPaM& rPaM );
+ TextPaM CursorEndOfLine( const TextPaM& rPaM );
+ static TextPaM CursorStartOfParagraph( const TextPaM& rPaM );
+ TextPaM CursorEndOfParagraph( const TextPaM& rPaM );
+ static TextPaM CursorStartOfDoc();
+ TextPaM CursorEndOfDoc();
+
+ /**
+ Returns the number in paragraph of the line in which the cursor is blinking
+ if enabled, -1 otherwise.
+ */
+ sal_Int32 GetLineNumberOfCursorInSelection() const;
+
+ void MatchGroup();
+
+ // tdf#49482: Moves the start of the PaM to the center of the textview
+ void CenterPaM( const TextPaM& rPaM );
+
+ bool Search( const i18nutil::SearchOptions& rSearchOptions, bool bForward );
+ sal_uInt16 Replace( const i18nutil::SearchOptions& rSearchOptions, bool bAll, bool bForward );
+
+ bool IndentBlock();
+ bool UnindentBlock();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/threadex.hxx b/include/vcl/threadex.hxx
new file mode 100644
index 000000000..af2978ce3
--- /dev/null
+++ b/include/vcl/threadex.hxx
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_THREADEX_HXX
+#define INCLUDED_VCL_THREADEX_HXX
+
+#include <osl/conditn.hxx>
+#include <tools/link.hxx>
+#include <vcl/dllapi.h>
+
+#include <optional>
+#include <memory>
+
+namespace vcl
+{
+ class VCL_DLLPUBLIC SolarThreadExecutor
+ {
+ osl::Condition m_aStart;
+ osl::Condition m_aFinish;
+ bool m_bTimeout;
+
+ DECL_DLLPRIVATE_LINK( worker, void*, void );
+
+ public:
+ SolarThreadExecutor();
+ virtual ~SolarThreadExecutor();
+
+ virtual void doIt() = 0;
+ void execute();
+ };
+
+namespace solarthread {
+
+/// @internal
+namespace detail {
+
+template <typename FuncT, typename ResultT>
+class GenericSolarThreadExecutor final : public SolarThreadExecutor
+{
+public:
+ static ResultT exec( FuncT const& func )
+ {
+ typedef GenericSolarThreadExecutor<FuncT, ResultT> ExecutorT;
+ ::std::unique_ptr<ExecutorT> const pExecutor( new ExecutorT(func) );
+ pExecutor->execute();
+ if (pExecutor->m_exc)
+ std::rethrow_exception(pExecutor->m_exc);
+ return *pExecutor->m_result;
+ }
+
+private:
+ explicit GenericSolarThreadExecutor( FuncT const& func )
+ : m_func(func), m_result() {}
+
+ virtual void doIt() override
+ {
+ try {
+ m_result = m_func();
+ }
+ catch (...) {
+ m_exc = std::current_exception();
+ }
+ }
+
+ std::exception_ptr m_exc;
+#ifdef _MSC_VER
+ FuncT m_func; // "const" and std::bind() results in Error C3848 expression would lose const-volatile qualifiers
+#else
+ FuncT const m_func;
+#endif
+ // using std::optional here omits the need that ResultT is default
+ // constructable:
+ ::std::optional<ResultT> m_result;
+};
+
+template <typename FuncT>
+class GenericSolarThreadExecutor<FuncT, void> final : public SolarThreadExecutor
+{
+public:
+ static void exec( FuncT const& func )
+ {
+ typedef GenericSolarThreadExecutor<FuncT, void> ExecutorT;
+ ::std::unique_ptr<ExecutorT> const pExecutor( new ExecutorT(func) );
+ pExecutor->execute();
+ if (pExecutor->m_exc)
+ std::rethrow_exception(pExecutor->m_exc);
+ }
+
+private:
+ explicit GenericSolarThreadExecutor( FuncT const& func )
+ : m_func(func) {}
+
+ virtual void doIt() override
+ {
+ try {
+ m_func();
+ }
+ catch (...) {
+ m_exc = std::current_exception();
+ }
+ }
+
+ std::exception_ptr m_exc;
+ FuncT const m_func;
+};
+
+} // namespace detail
+
+
+/** This function will execute the passed functor synchronously in the
+ solar thread, thus the calling thread will (eventually) be blocked until
+ the functor has been called.
+ Any exception that came up calling the functor in the solar thread
+ will be caught and rethrown in the calling thread.
+ The result type of this function needs to be default constructable.
+ Please keep in mind not to pass addresses to stack variables
+ (e.g. for out parameters) to foreign threads, use inout_by_ref()
+ for this purpose. For in parameters, this may not affect you, because
+ the functor object is copy constructed into free store. This way
+ you must not use \verbatim std::cref()/std::ref() \endverbatim or similar
+ for objects on your thread's stack.
+ Use inout_by_ref() or inout_by_ptr() for this purpose, e.g.
+
+ \code{.cpp}
+ using namespace vcl::solarthread;
+
+ long n = 3;
+ // calling foo( long & r ):
+ syncExecute( std::bind( &foo, inout_by_ref(n) ) );
+ // calling foo( long * p ):
+ syncExecute( std::bind( &foo, inout_by_ptr(&n) ) );
+
+ char const* pc = "default";
+ // calling foo( char const** ppc ):
+ syncExecute( std::bind( &foo, inout_by_ptr(&pc) ) );
+ // calling foo( char const*& rpc ):
+ syncExecute( std::bind( &foo, inout_by_ref(pc) ) );
+ \endcode
+
+ @tpl ResultT result type, defaults to FuncT::result_type to seamlessly
+ support mem_fn and bind
+ @tpl FuncT functor type, let your compiler deduce this type
+ @param func functor object to be executed in solar thread
+ @return return value of functor
+*/
+template <typename FuncT>
+inline auto syncExecute(FuncT const& func) -> decltype(func())
+{
+ return detail::GenericSolarThreadExecutor<
+ FuncT, decltype(func())>::exec(func);
+}
+
+} // namespace solarthread
+} // namespace vcl
+
+#endif // INCLUDED_VCL_THREADEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx
new file mode 100644
index 000000000..89cc623a1
--- /dev/null
+++ b/include/vcl/timer.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_TIMER_HXX
+#define INCLUDED_VCL_TIMER_HXX
+
+#include <tools/link.hxx>
+#include <vcl/task.hxx>
+
+class VCL_DLLPUBLIC Timer : public Task
+{
+ Link<Timer *, void> maInvokeHandler; ///< Callback Link
+ sal_uInt64 mnTimeout;
+ const bool mbAuto;
+
+protected:
+ virtual void SetDeletionFlags() override;
+ virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nTimeNow ) const override;
+
+ Timer( bool bAuto, const char *pDebugName );
+
+public:
+ Timer( const char *pDebugName );
+ Timer( const Timer& rTimer );
+ virtual ~Timer() override;
+ Timer& operator=( const Timer& rTimer );
+
+ /**
+ * Calls the maInvokeHandler with the parameter this.
+ */
+ virtual void Invoke() override;
+ /**
+ * Calls the maInvokeHandler with the parameter.
+ *
+ * Convenience Invoke function, mainly used to call with nullptr.
+ *
+ * @param arg parameter for the Link::Call function
+ */
+ void Invoke( Timer *arg );
+ void SetInvokeHandler( const Link<Timer *, void>& rLink ) { maInvokeHandler = rLink; }
+ void ClearInvokeHandler() { SetInvokeHandler( Link<Timer *, void>() ); }
+
+ void SetTimeout( sal_uInt64 nTimeoutMs );
+ sal_uInt64 GetTimeout() const { return mnTimeout; }
+ virtual void Start(bool bStartTimer = true) override;
+};
+
+/// An auto-timer is a multi-shot timer re-emitting itself at
+/// interval until destroyed or stopped.
+class VCL_DLLPUBLIC AutoTimer : public Timer
+{
+public:
+ AutoTimer( const char *pDebugName );
+};
+
+/// Value suitable as a timeout user input into an EditBox to an expensive update
+#define EDIT_UPDATEDATA_TIMEOUT 350
+
+#endif // INCLUDED_VCL_TIMER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
new file mode 100644
index 000000000..dda33ff02
--- /dev/null
+++ b/include/vcl/toolbox.hxx
@@ -0,0 +1,537 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_TOOLBOX_HXX
+#define INCLUDED_VCL_TOOLBOX_HXX
+
+#include <vcl/vclenum.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/dockwin.hxx>
+#include <vcl/image.hxx>
+#include <vcl/keycod.hxx>
+#include <vcl/toolboxid.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <tools/degree.hxx>
+
+#include <limits>
+#include <memory>
+#include <vector>
+
+namespace com::sun::star::frame { class XFrame; }
+namespace com::sun::star::frame { struct FeatureStateEvent; }
+template <class T> class VclStatusListener;
+
+class Timer;
+struct ImplToolItem;
+struct ImplToolBoxPrivateData;
+class PopupMenu;
+class VclMenuEvent;
+class StyleSettings;
+
+// item ids in the custom menu may not exceed this constant
+constexpr sal_uInt16 TOOLBOX_MENUITEM_START = 0x1000;
+
+// defines for the menubutton
+enum class ToolBoxMenuType {
+ NONE = 0x0000, // no menu at all, scrolling by spin buttons
+ ClippedItems = 0x0001, // menu will contain "more" indicator
+ Customize = 0x0002 // menu will contain "customization" and "more" indicator
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ToolBoxMenuType> : is_typed_flags<ToolBoxMenuType, 0x0003> {};
+}
+
+enum class ToolBoxLayoutMode
+{
+ Normal, // traditional layout, items are centered in the toolbar
+ Locked // horizontal positions of all items remain unchanged,
+ // vertical positions of items smaller than first item are aligned to first item's vertical center,
+ // vertical positions of items larger than first item remain unchanged
+};
+
+// Position of the text when icon and text are painted
+enum class ToolBoxTextPosition { Right, Bottom };
+
+class Idle;
+
+/// A toolbar: contains all those icons, typically below the menu bar.
+class VCL_DLLPUBLIC ToolBox : public DockingWindow
+{
+ friend class FloatingWindow;
+ friend class ImplTBDragMgr;
+
+public:
+ using ImplToolItems = std::vector<ImplToolItem>;
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ void SetCurItemId( ToolBoxItemId CurID ) { mnCurItemId=CurID; }
+
+ static constexpr auto APPEND
+ = std::numeric_limits<ImplToolItems::size_type>::max();
+
+ static constexpr auto ITEM_NOTFOUND
+ = std::numeric_limits<ImplToolItems::size_type>::max();
+
+private:
+ struct ImplToolSize
+ {
+ tools::Long mnWidth;
+ tools::Long mnHeight;
+ ImplToolItems::size_type mnLines;
+ };
+
+ std::unique_ptr<ImplToolBoxPrivateData> mpData;
+ std::vector<ImplToolSize> maFloatSizes;
+ std::unique_ptr<Idle> mpIdle;
+ tools::Rectangle maUpperRect;
+ tools::Rectangle maLowerRect;
+ tools::Rectangle maPaintRect;
+ VclPtr<FloatingWindow> mpFloatWin;
+ tools::Long mnDX;
+ tools::Long mnDY;
+ tools::Long mnMaxItemWidth; // max item width
+ tools::Long mnMaxItemHeight; // max item height (for standard items)
+ tools::Long mnWinHeight; // max window height (for window items)
+ tools::Long mnLeftBorder; // inner border
+ tools::Long mnTopBorder;
+ tools::Long mnRightBorder;
+ tools::Long mnBottomBorder;
+ tools::Long mnLastResizeDY;
+ tools::Long mnActivateCount;
+ Degree10 mnImagesRotationAngle;
+ ToolBoxItemId mnLastFocusItemId;
+ ToolBoxItemId mnHighItemId;
+ ToolBoxItemId mnCurItemId;
+ ToolBoxItemId mnDownItemId;
+ ImplToolItems::size_type mnCurPos;
+ ImplToolItems::size_type mnLines; // total number of toolbox lines
+ ImplToolItems::size_type mnCurLine; // the currently visible line
+ ImplToolItems::size_type mnCurLines; // number of lines due to line breaking
+ ImplToolItems::size_type mnVisLines; // number of visible lines (for scrolling)
+ ImplToolItems::size_type mnFloatLines; // number of lines during floating mode
+ ImplToolItems::size_type mnDockLines;
+ sal_uInt16 mnMouseModifier;
+ bool mbDrag:1,
+ mbUpper:1,
+ mbLower:1,
+ mbIn:1,
+ mbCalc:1,
+ mbFormat:1,
+ mbFullPaint:1,
+ mbHorz:1,
+ mbScroll:1,
+ mbLastFloatMode:1,
+ mbCustomize:1,
+ mbDragging:1,
+ mbIsKeyEvent:1,
+ mbChangingHighlight:1,
+ mbImagesMirrored:1,
+ mbLineSpacing:1,
+ mbIsArranged:1;
+ WindowAlign meAlign;
+ WindowAlign meDockAlign;
+ ButtonType meButtonType;
+ PointerStyle meLastStyle;
+ WinBits mnWinStyle;
+ ToolBoxLayoutMode meLayoutMode;
+ ToolBoxTextPosition meTextPosition;
+ Link<ToolBox *, void> maClickHdl;
+ Link<ToolBox *, void> maDoubleClickHdl;
+ Link<ToolBox *, void> maActivateHdl;
+ Link<ToolBox *, void> maDeactivateHdl;
+ Link<ToolBox *, void> maSelectHdl;
+ Link<ToolBox *, void> maMenuButtonHdl;
+ Link<StateChangedType const *, void> maStateChangedHandler;
+ Link<DataChangedEvent const *, void> maDataChangedHandler;
+ /** StatusListener. Notifies about rotated images etc */
+ rtl::Reference<VclStatusListener<ToolBox>> mpStatusListener;
+
+public:
+ using Window::ImplInit;
+private:
+ SAL_DLLPRIVATE void InvalidateItem(ImplToolItems::size_type nPosition);
+ SAL_DLLPRIVATE void InvalidateSpin(bool bInvalidateUpper = true,
+ bool bInvalidateLower = true);
+ SAL_DLLPRIVATE void InvalidateMenuButton();
+
+ SAL_DLLPRIVATE void ImplInitToolBoxData();
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ using DockingWindow::ImplInitSettings;
+ SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
+ SAL_DLLPRIVATE ImplToolItem* ImplGetItem( ToolBoxItemId nId ) const;
+ SAL_DLLPRIVATE bool ImplCalcItem();
+ SAL_DLLPRIVATE ImplToolItems::size_type ImplCalcBreaks( tools::Long nWidth, sal_Int32* pMaxLineWidth, bool bCalcHorz ) const;
+ SAL_DLLPRIVATE void ImplFormat( bool bResize = false );
+ SAL_DLLPRIVATE void ImplDrawSpin(vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE void ImplDrawSeparator(vcl::RenderContext& rRenderContext, ImplToolItems::size_type nPos, const tools::Rectangle& rRect);
+ SAL_DLLPRIVATE void ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::size_type nPos, sal_uInt16 nHighlight );
+ using Window::ImplInvalidate;
+ SAL_DLLPRIVATE void ImplInvalidate( bool bNewCalc = false, bool bFullPaint = false );
+ SAL_DLLPRIVATE void ImplUpdateItem( ImplToolItems::size_type nIndex = ITEM_NOTFOUND );
+ SAL_DLLPRIVATE bool ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat = false );
+ SAL_DLLPRIVATE bool ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel = false );
+ SAL_DLLPRIVATE void ImplChangeHighlight( ImplToolItem const * pItem, bool bNoGrabFocus = false );
+ SAL_DLLPRIVATE bool ImplChangeHighlightUpDn( bool bUp, bool bNoCycle = false );
+ SAL_DLLPRIVATE ImplToolItems::size_type ImplGetItemLine( ImplToolItem const * pCurrentItem );
+ SAL_DLLPRIVATE ImplToolItem* ImplGetFirstValidItem( ImplToolItems::size_type nLine );
+ SAL_DLLPRIVATE bool ImplOpenItem( vcl::KeyCode aKeyCode );
+ SAL_DLLPRIVATE bool ImplActivateItem( vcl::KeyCode aKeyCode );
+ SAL_DLLPRIVATE void ImplShowFocus();
+ SAL_DLLPRIVATE void ImplHideFocus();
+ SAL_DLLPRIVATE void ImplUpdateInputEnable();
+ SAL_DLLPRIVATE void ImplFillLayoutData();
+ SAL_DLLPRIVATE bool ImplHasClippedItems();
+ SAL_DLLPRIVATE Point ImplGetPopupPosition( const tools::Rectangle& rRect ) const;
+ SAL_DLLPRIVATE bool ImplIsFloatingMode() const;
+ SAL_DLLPRIVATE bool ImplIsInPopupMode() const;
+ SAL_DLLPRIVATE const OUString& ImplGetHelpText( ToolBoxItemId nItemId ) const;
+ SAL_DLLPRIVATE Size ImplGetOptimalFloatingSize();
+ SAL_DLLPRIVATE bool ImplHasExternalMenubutton() const;
+ SAL_DLLPRIVATE void ImplDrawFloatwinBorder(vcl::RenderContext& rRenderContext, ImplToolItem const * pItem );
+
+ DECL_DLLPRIVATE_LINK( ImplUpdateHdl, Timer*, void );
+ DECL_DLLPRIVATE_LINK( ImplCustomMenuListener, VclMenuEvent&, void );
+ DECL_DLLPRIVATE_LINK( ImplDropdownLongClickHdl, Timer*, void );
+
+ ToolBox (const ToolBox &) = delete;
+ ToolBox& operator= (const ToolBox &) = delete;
+
+public:
+ SAL_DLLPRIVATE void ImplFloatControl( bool bStart, FloatingWindow* pWindow );
+
+ SAL_DLLPRIVATE int ImplGetDragWidth() const;
+ static SAL_DLLPRIVATE int ImplGetDragWidth( const vcl::RenderContext& rRenderContext,
+ bool bHorz );
+ static SAL_DLLPRIVATE int ImplGetDragWidth( const vcl::Window& rWindow,
+ bool bHorz );
+ SAL_DLLPRIVATE void ImplUpdateDragArea() const;
+ SAL_DLLPRIVATE void ImplCalcBorder( WindowAlign eAlign, tools::Long& rLeft, tools::Long& rTop,
+ tools::Long& rRight, tools::Long& rBottom ) const;
+ SAL_DLLPRIVATE void ImplCheckUpdate();
+ static SAL_DLLPRIVATE void ImplDrawGrip(vcl::RenderContext& rRenderContext,
+ const tools::Rectangle &aDragArea, int nDragWidth,
+ WindowAlign eAlign, bool bHorz);
+
+ SAL_DLLPRIVATE void ImplDrawGrip(vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE void ImplDrawGradientBackground(vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE bool ImplDrawNativeBackground(vcl::RenderContext& rRenderContext) const;
+ SAL_DLLPRIVATE void ImplDrawTransparentBackground(const vcl::Region &rRegion);
+ SAL_DLLPRIVATE static void ImplDrawConstantBackground(vcl::RenderContext& rRenderContext, const vcl::Region &rRegion, bool bIsInPopupMode);
+ SAL_DLLPRIVATE void ImplDrawBackground(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect);
+
+ SAL_DLLPRIVATE void ImplErase(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect, bool bHighlight, bool bHasOpenPopup = false );
+
+ SAL_DLLPRIVATE void ImplDrawBorder(vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE const ImplToolItem *ImplGetFirstClippedItem() const;
+ SAL_DLLPRIVATE Size ImplCalcSize( ImplToolItems::size_type nCalcLines, sal_uInt16 nCalcMode = 0 );
+ SAL_DLLPRIVATE void ImplCalcFloatSizes();
+ SAL_DLLPRIVATE Size ImplCalcFloatSize( ImplToolItems::size_type& rLines );
+ SAL_DLLPRIVATE void ImplCalcMinMaxFloatSize( Size& rMinSize, Size& rMaxSize );
+ SAL_DLLPRIVATE void ImplSetMinMaxFloatSize();
+ SAL_DLLPRIVATE ImplToolItems::size_type ImplCalcLines( tools::Long nToolSize ) const;
+ SAL_DLLPRIVATE sal_uInt16 ImplTestLineSize( const Point& rPos ) const;
+ SAL_DLLPRIVATE void ImplLineSizing( const Point& rPos, tools::Rectangle& rRect, sal_uInt16 nLineMode );
+ SAL_DLLPRIVATE static ImplToolItems::size_type ImplFindItemPos( const ImplToolItem* pItem, const ImplToolItems& rList );
+ SAL_DLLPRIVATE void ImplDrawMenuButton(vcl::RenderContext& rRenderContext, bool bHighlight);
+ SAL_DLLPRIVATE void ImplDrawButton(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bEnabled, bool bIsWindow);
+ SAL_DLLPRIVATE ImplToolItems::size_type ImplCountLineBreaks() const;
+ SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData.get(); }
+
+ SAL_DLLPRIVATE void ApplyBackgroundSettings(vcl::RenderContext&, const StyleSettings&);
+ SAL_DLLPRIVATE void ApplyForegroundSettings(vcl::RenderContext&, const StyleSettings&);
+
+protected:
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+
+public:
+ ToolBox(vcl::Window* pParent, WinBits nStyle = 0);
+ ToolBox(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
+ const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
+ virtual ~ToolBox() override;
+ virtual void dispose() override;
+
+ virtual void Click();
+ void DoubleClick();
+ virtual void Activate() override;
+ virtual void Deactivate() override;
+ void Highlight();
+ virtual void Select();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+ virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void Command( const CommandEvent& rCEvt ) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual void LoseFocus() override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+
+ virtual void ToggleFloatingMode() override;
+ virtual void StartDocking() override;
+ virtual bool Docking( const Point& rPos, tools::Rectangle& rRect ) override;
+ virtual void EndDocking( const tools::Rectangle& rRect, bool bFloatMode ) override;
+ virtual void Resizing( Size& rSize ) override;
+ virtual Size GetOptimalSize() const override;
+ virtual void doDeferredInit(WinBits nBits) override;
+ virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
+
+ /// Insert a command (like '.uno:Save').
+ virtual void InsertItem( const OUString& rCommand,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ ToolBoxItemBits nBits,
+ const Size& rRequestedSize,
+ ImplToolItems::size_type nPos = APPEND );
+ void InsertItem( ToolBoxItemId nItemId, const Image& rImage,
+ ToolBoxItemBits nBits = ToolBoxItemBits::NONE,
+ ImplToolItems::size_type nPos = APPEND );
+ void InsertItem( ToolBoxItemId nItemId, const Image& rImage,
+ const OUString& rText,
+ ToolBoxItemBits nBits = ToolBoxItemBits::NONE,
+ ImplToolItems::size_type nPos = APPEND );
+ void InsertItem( ToolBoxItemId nItemId, const OUString& rText,
+ ToolBoxItemBits nBits = ToolBoxItemBits::NONE,
+ ImplToolItems::size_type nPos = APPEND );
+ void InsertWindow( ToolBoxItemId nItemId, vcl::Window* pWindow,
+ ToolBoxItemBits nBits = ToolBoxItemBits::NONE,
+ ImplToolItems::size_type nPos = APPEND );
+ void InsertSpace();
+ void InsertSeparator( ImplToolItems::size_type nPos = APPEND, sal_uInt16 nPixSize = 0 );
+ void InsertBreak( ImplToolItems::size_type nPos = APPEND );
+ void RemoveItem( ImplToolItems::size_type nPos );
+ void CopyItem( const ToolBox& rToolBox, ToolBoxItemId nItemId );
+ void Clear();
+
+ void SetButtonType( ButtonType eNewType );
+ ButtonType GetButtonType() const { return meButtonType; }
+
+ // sets a fixed button size (small, large or dontcare (==autosize))
+ void SetToolboxButtonSize( ToolBoxButtonSize eSize );
+ ToolBoxButtonSize GetToolboxButtonSize() const;
+ vcl::ImageType GetImageSize() const;
+
+ void SetAlign( WindowAlign eNewAlign = WindowAlign::Top );
+ WindowAlign GetAlign() const { return meAlign; }
+ bool IsHorizontal() const { return mbHorz; }
+
+ void SetLineCount( ImplToolItems::size_type nNewLines );
+ void ShowLine( bool bNext );
+
+ ImplToolItems::size_type GetItemCount() const;
+ ToolBoxItemType GetItemType( ImplToolItems::size_type nPos ) const;
+ ImplToolItems::size_type GetItemPos( ToolBoxItemId nItemId ) const;
+ ImplToolItems::size_type GetItemPos( const Point& rPos ) const;
+ ToolBoxItemId GetItemId( ImplToolItems::size_type nPos ) const;
+ ToolBoxItemId GetItemId( const Point& rPos ) const;
+ /// Map the command name (like .uno:Save) back to item id.
+ ToolBoxItemId GetItemId( const OUString& rCommand ) const;
+ tools::Rectangle GetItemRect( ToolBoxItemId nItemId );
+ tools::Rectangle GetItemPosRect( ImplToolItems::size_type nPos );
+ tools::Rectangle const & GetOverflowRect() const;
+
+ /// Returns size of the bitmap / text that is inside this toolbox item.
+ Size GetItemContentSize( ToolBoxItemId nItemId );
+
+ ToolBoxItemId GetCurItemId() const { return mnCurItemId; }
+ ToolBoxItemId GetDownItemId() const { return mnDownItemId; }
+ sal_uInt16 GetModifier() const { return mnMouseModifier; }
+
+ void SetItemBits( ToolBoxItemId nItemId, ToolBoxItemBits nBits );
+ ToolBoxItemBits GetItemBits( ToolBoxItemId nItemId ) const;
+
+ void SetItemExpand( ToolBoxItemId nItemId, bool bExpand );
+ // e.g. a label used as an itemwindow
+ void SetItemWindowNonInteractive(ToolBoxItemId nItemId, bool bNonInteractive);
+
+
+ void SetItemData( ToolBoxItemId nItemId, void* pNewData );
+ void* GetItemData( ToolBoxItemId nItemId ) const;
+ void SetItemImage( ToolBoxItemId nItemId, const Image& rImage );
+ Image GetItemImage( ToolBoxItemId nItemId ) const;
+ void SetItemImageAngle( ToolBoxItemId nItemId, Degree10 nAngle10 );
+ void SetItemImageMirrorMode( ToolBoxItemId nItemId, bool bMirror );
+ void SetItemText( ToolBoxItemId nItemId, const OUString& rText );
+ const OUString& GetItemText( ToolBoxItemId nItemId ) const;
+ void SetItemWindow( ToolBoxItemId nItemId, vcl::Window* pNewWindow );
+ vcl::Window* GetItemWindow( ToolBoxItemId nItemId ) const;
+ ToolBoxItemId GetHighlightItemId() const { return mnHighItemId; }
+
+ void EndSelection();
+
+ void SetItemDown( ToolBoxItemId nItemId, bool bDown );
+
+ void SetItemState( ToolBoxItemId nItemId, TriState eState );
+ TriState GetItemState( ToolBoxItemId nItemId ) const;
+
+ void CheckItem( ToolBoxItemId nItemId, bool bCheck = true );
+ bool IsItemChecked( ToolBoxItemId nItemId ) const;
+
+ void EnableItem( ToolBoxItemId nItemId, bool bEnable = true );
+ bool IsItemEnabled( ToolBoxItemId nItemId ) const;
+
+ void TriggerItem( ToolBoxItemId nItemId );
+
+ /// Shows or hides items.
+ void ShowItem(ToolBoxItemId nItemId, bool bVisible = true);
+
+ /// Convenience method to hide items (via ShowItem).
+ void HideItem(ToolBoxItemId nItemId) { ShowItem( nItemId, false ); }
+
+ bool IsItemClipped( ToolBoxItemId nItemId ) const;
+ bool IsItemVisible( ToolBoxItemId nItemId ) const;
+ bool IsItemReallyVisible( ToolBoxItemId nItemId ) const;
+
+ void SetItemCommand( ToolBoxItemId nItemId, const OUString& rCommand );
+ OUString GetItemCommand( ToolBoxItemId nItemId ) const;
+
+ using Window::SetQuickHelpText;
+ void SetQuickHelpText( ToolBoxItemId nItemId, const OUString& rText );
+ using Window::GetQuickHelpText;
+ OUString GetQuickHelpText( ToolBoxItemId nItemId ) const;
+
+ void SetHelpText( ToolBoxItemId nItemId, const OUString& rText );
+ const OUString& GetHelpText( ToolBoxItemId nItemId ) const;
+
+ void SetHelpId( ToolBoxItemId nItemId, const OString& rHelpId );
+
+ // window size according to current alignment, floating state and number of lines
+ Size CalcWindowSizePixel();
+ // window size according to current alignment, floating state and a given number of lines
+ Size CalcWindowSizePixel( ImplToolItems::size_type nCalcLines );
+ // window size according to current floating state and a given number of lines and a given alignment
+ Size CalcWindowSizePixel( ImplToolItems::size_type nCalcLines, WindowAlign eAlign );
+ // floating window size according to number of lines (uses the number of line breaks)
+ Size CalcFloatingWindowSizePixel();
+ // floating window size with a given number of lines
+ Size CalcFloatingWindowSizePixel( ImplToolItems::size_type nCalcLines );
+ // automatic window size for popup mode
+ Size CalcPopupWindowSizePixel();
+
+ // computes the smallest useful size when docked, ie with the first item visible only (+drag area and menu button)
+ Size CalcMinimumWindowSizePixel();
+
+ ImplToolItems::size_type GetFloatingLines() const;
+
+ void SetStyle( WinBits nNewStyle );
+ WinBits GetStyle() const { return mnWinStyle; }
+
+ // enable/disable undocking
+ void Lock( bool bLock );
+ // read configuration to determine locking behaviour
+ static bool AlwaysLocked();
+
+ void EnableCustomize( bool bEnable = true );
+ bool IsCustomize() const { return mbCustomize; }
+
+ using DockingWindow::SetHelpText;
+ using DockingWindow::GetHelpText;
+ using DockingWindow::SetHelpId;
+ using DockingWindow::GetHelpId;
+
+ void SetClickHdl( const Link<ToolBox *, void>& rLink ) { maClickHdl = rLink; }
+ void SetDoubleClickHdl( const Link<ToolBox *, void>& rLink ) { maDoubleClickHdl = rLink; }
+ void SetDropdownClickHdl( const Link<ToolBox *, void>& rLink );
+ void SetActivateHdl( const Link<ToolBox *, void>& rLink ) { maActivateHdl = rLink; }
+ void SetDeactivateHdl( const Link<ToolBox *, void>& rLink ) { maDeactivateHdl = rLink; }
+ void SetSelectHdl( const Link<ToolBox *, void>& rLink ) { maSelectHdl = rLink; }
+ void SetStateChangedHdl( const Link<StateChangedType const *, void>& aLink ) { maStateChangedHandler = aLink; }
+ void SetDataChangedHdl( const Link<DataChangedEvent const *, void>& aLink ) { maDataChangedHandler = aLink; }
+ void SetMenuButtonHdl( const Link<ToolBox *, void>& rLink ) { maMenuButtonHdl = rLink; }
+
+ // support for custom menu (eg for configuration)
+ // note: this menu will also be used to display currently
+ // clipped toolbox items, so you should only touch
+ // items that you added by yourself
+ // the private toolbox items will only use item ids starting from TOOLBOX_MENUITEM_START
+ // to allow for customization of the menu the corresponding handler is called
+ // when the menu button was clicked and before the menu is executed
+ void SetMenuType( ToolBoxMenuType aType = ToolBoxMenuType::Customize );
+ ToolBoxMenuType GetMenuType() const;
+ bool IsMenuEnabled() const;
+ PopupMenu* GetMenu() const;
+ void UpdateCustomMenu();
+ void SetMenuExecuteHdl( const Link<ToolBox *, void>& rLink );
+
+ // open custommenu
+ void ExecuteCustomMenu( const tools::Rectangle& rRect = tools::Rectangle() );
+
+ // allow Click Handler to distinguish between mouse and key input
+ bool IsKeyEvent() const { return mbIsKeyEvent; }
+
+ // allows framework to set/query the planned popupmode
+ bool WillUsePopupMode() const;
+ void WillUsePopupMode( bool b);
+
+ // accessibility helpers
+
+ // gets the displayed text
+ OUString GetDisplayText() const override;
+ // returns the bounding box for the character at index nIndex
+ // where nIndex is relative to the starting index of the item
+ // with id nItemId (in coordinates of the displaying window)
+ tools::Rectangle GetCharacterBounds( ToolBoxItemId nItemId, tools::Long nIndex );
+ // -1 is returned if no character is at that point
+ // if an index is found the corresponding item id is filled in (else 0)
+ tools::Long GetIndexForPoint( const Point& rPoint, ToolBoxItemId& rItemID );
+
+ static Size GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize);
+ Size GetDefaultImageSize() const;
+ void ChangeHighlight( ImplToolItems::size_type nPos );
+
+
+ void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout );
+ void statusChanged(const css::frame::FeatureStateEvent& rEvent);
+
+ void SetToolBoxTextPosition( ToolBoxTextPosition ePosition );
+
+ void SetLineSpacing(bool b) { mbLineSpacing = b; }
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+};
+
+inline void ToolBox::CheckItem( ToolBoxItemId nItemId, bool bCheck )
+{
+ SetItemState( nItemId, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE );
+}
+
+inline bool ToolBox::IsItemChecked( ToolBoxItemId nItemId ) const
+{
+ return (GetItemState( nItemId ) == TRISTATE_TRUE);
+}
+
+inline Size ToolBox::CalcWindowSizePixel()
+{
+ return CalcWindowSizePixel( mnLines );
+}
+
+inline ToolBox::ImplToolItems::size_type ToolBox::GetFloatingLines() const
+{
+ return mnFloatLines;
+}
+
+#endif // INCLUDED_VCL_TOOLBOX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolboxid.hxx b/include/vcl/toolboxid.hxx
new file mode 100644
index 000000000..009a10d74
--- /dev/null
+++ b/include/vcl/toolboxid.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <o3tl/strong_int.hxx>
+
+typedef o3tl::strong_int<sal_uInt16, struct ToolBoxItemIdTag> ToolBoxItemId;
+namespace std
+{
+template <> struct hash<ToolBoxItemId>
+{
+ std::size_t operator()(ToolBoxItemId const& s) const { return std::size_t(sal_uInt16(s)); }
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/toolkit/README b/include/vcl/toolkit/README
new file mode 100644
index 000000000..889f0b20a
--- /dev/null
+++ b/include/vcl/toolkit/README
@@ -0,0 +1,2 @@
+These are includes which are now only used by the toolkit module, which exposes
+them via uno. Don't use these in any new code.
diff --git a/include/vcl/toolkit/button.hxx b/include/vcl/toolkit/button.hxx
new file mode 100644
index 000000000..e894f9e28
--- /dev/null
+++ b/include/vcl/toolkit/button.hxx
@@ -0,0 +1,507 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <vcl/dllapi.h>
+#include <vcl/image.hxx>
+#include <vcl/ctrl.hxx>
+#include <vcl/vclenum.hxx>
+#include <memory>
+#include <vector>
+
+namespace com::sun::star::frame { struct FeatureStateEvent; }
+template <class T> class VclPtr;
+
+class Color;
+class ImplCommonButtonData;
+enum class DrawButtonFlags;
+
+class VCL_DLLPUBLIC Button : public Control
+{
+private:
+ std::unique_ptr<ImplCommonButtonData> mpButtonData;
+ Link<Button*,void> maClickHdl;
+
+ /// Command URL (like .uno:Save) in case the button should handle it.
+ OUString maCommand;
+
+ Button (const Button &) = delete;
+ Button & operator= (const Button &) = delete;
+public:
+ SAL_DLLPRIVATE DrawTextFlags ImplGetTextStyle( WinBits nWinStyle, SystemTextColorFlags nSystemTextColorFlags ) const;
+ SAL_DLLPRIVATE void ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos, Size& rSize,
+ sal_Int32 nImageSep,
+ DrawTextFlags nTextStyle, tools::Rectangle *pSymbolRect=nullptr, bool bAddImageSep = false );
+ SAL_DLLPRIVATE void ImplSetFocusRect( const tools::Rectangle &rFocusRect );
+ SAL_DLLPRIVATE const tools::Rectangle& ImplGetFocusRect() const;
+ SAL_DLLPRIVATE void ImplSetSymbolAlign( SymbolAlign eAlign );
+ /// The x-coordinate of the vertical separator line, use in MenuButton subclass only.
+ SAL_DLLPRIVATE tools::Long ImplGetSeparatorX() const;
+ SAL_DLLPRIVATE void ImplSetSeparatorX( tools::Long nX );
+
+protected:
+ explicit Button( WindowType nType );
+
+ // for drawing RadioButton or CheckButton that has Text and/or Image
+ SAL_DLLPRIVATE void ImplDrawRadioCheck(OutputDevice* pDev, WinBits nWinStyle, SystemTextColorFlags nSystemTextColorFlags,
+ const Point& rPos, const Size& rSize,
+ const Size& rImageSize, tools::Rectangle& rStateRect,
+ tools::Rectangle& rMouseRect);
+ SAL_DLLPRIVATE tools::Long ImplGetImageToTextDistance() const;
+
+public:
+ virtual ~Button() override;
+ virtual void dispose() override;
+
+ virtual void Click();
+
+ void SetClickHdl( const Link<Button*,void>& rLink ) { maClickHdl = rLink; }
+ const Link<Button*,void>& GetClickHdl() const { return maClickHdl; }
+
+ /// Setup handler for UNO commands so that commands like .uno:Something are handled automagically by this button.
+ void SetCommandHandler(const OUString& aCommand);
+ OUString const & GetCommand() const { return maCommand; }
+
+ void SetModeImage( const Image& rImage );
+ Image const & GetModeImage( ) const;
+ bool HasImage() const;
+ void SetImageAlign( ImageAlign eAlign );
+ ImageAlign GetImageAlign() const;
+ DrawButtonFlags GetButtonState() const;
+ DrawButtonFlags& GetButtonState();
+
+ /// Set an image to use as the complete render view of a custom button,
+ /// instead of the usual contents of a button
+ void SetCustomButtonImage( const Image& rImage );
+ Image const & GetCustomButtonImage() const;
+
+ bool IsSmallSymbol() const;
+ void SetSmallSymbol();
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+
+ /// Sets the button state according to the FeatureStateEvent emitted by a Uno state change.
+ virtual void statusChanged(const css::frame::FeatureStateEvent& rEvent);
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+
+protected:
+
+ /// Handler for click, in case we want the button to handle uno commands (.uno:Something).
+ DECL_DLLPRIVATE_STATIC_LINK(Button, dispatchCommandHandler, Button*, void);
+};
+
+enum class PushButtonDropdownStyle
+{
+ NONE = 0x0000,
+ MenuButton = 0x0002, //visual down arrow
+ SplitMenuButton = 0x0003, //visual down arrow and separator line
+};
+
+class VCL_DLLPUBLIC PushButton : public Button
+{
+public:
+ SAL_DLLPRIVATE void ImplSetDefButton( bool bSet );
+ SAL_DLLPRIVATE void ImplDrawPushButtonFrame(vcl::RenderContext& rRenderContext, tools::Rectangle& rRect, DrawButtonFlags nStyle);
+ SAL_DLLPRIVATE static bool ImplHitTestPushButton(vcl::Window const * pDev, const Point& rPos);
+ SAL_DLLPRIVATE bool ImplIsDefButton() const;
+
+ explicit PushButton( vcl::Window* pParent, WinBits nStyle = 0 );
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void KeyUp( const KeyEvent& rKEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+
+ void Toggle();
+
+ void SetSymbol( SymbolType eSymbol );
+ SymbolType GetSymbol() const { return meSymbol; }
+ void SetSymbolAlign( SymbolAlign eAlign );
+
+ void SetDropDown( PushButtonDropdownStyle nStyle );
+
+ void SetState( TriState eState );
+ TriState GetState() const { return meState; }
+ virtual void statusChanged(const css::frame::FeatureStateEvent& rEvent) override;
+
+ void Check( bool bCheck = true );
+ bool IsChecked() const;
+
+ void SetPressed( bool bPressed );
+ bool IsPressed() const { return mbPressed; }
+
+ void EndSelection();
+
+ Size CalcMinimumSize() const;
+ virtual Size GetOptimalSize() const override;
+
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+ virtual void ShowFocus(const tools::Rectangle& rRect) override;
+
+ void setAction(bool bIsAction)
+ {
+ mbIsAction = bIsAction;
+ }
+
+ bool isAction() const
+ {
+ return mbIsAction;
+ }
+
+ void DumpAsPropertyTree(tools::JsonWriter&) override;
+
+protected:
+ PushButtonDropdownStyle mnDDStyle;
+ bool mbIsActive;
+
+ SAL_DLLPRIVATE void ImplInitPushButtonData();
+ SAL_DLLPRIVATE static WinBits ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nStyle );
+ SAL_DLLPRIVATE void ImplInitSettings( bool bBackground );
+ SAL_DLLPRIVATE void ImplDrawPushButtonContent(OutputDevice* pDev, SystemTextColorFlags nSystemTextColorFlags,
+ const tools::Rectangle& rRect, bool bMenuBtnSep,
+ DrawButtonFlags nButtonFlags);
+ SAL_DLLPRIVATE void ImplDrawPushButton(vcl::RenderContext& rRenderContext);
+ using Button::ImplGetTextStyle;
+ SAL_DLLPRIVATE DrawTextFlags ImplGetTextStyle( SystemTextColorFlags nSystemTextColorFlags ) const;
+ SAL_DLLPRIVATE bool IsSymbol() const { return ( (meSymbol != SymbolType::DONTKNOW) && (meSymbol != SymbolType::IMAGE) ); }
+
+ PushButton( const PushButton & ) = delete;
+ PushButton& operator=( const PushButton & )
+ = delete;
+
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+
+ explicit PushButton( WindowType nType );
+
+ virtual void FillLayoutData() const override;
+ virtual const vcl::Font&
+ GetCanonicalFont( const StyleSettings& _rStyle ) const override;
+ virtual const Color&
+ GetCanonicalTextColor( const StyleSettings& _rStyle ) const override;
+
+private:
+ SymbolType meSymbol;
+ TriState meState;
+ bool mbPressed;
+ bool mbIsAction;
+};
+
+inline void PushButton::Check( bool bCheck )
+{
+ SetState( bCheck ? TRISTATE_TRUE : TRISTATE_FALSE );
+}
+
+inline bool PushButton::IsChecked() const
+{
+ return (GetState() == TRISTATE_TRUE);
+}
+
+class VCL_DLLPUBLIC OKButton final : public PushButton
+{
+private:
+ using PushButton::ImplInit;
+
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+
+ OKButton (const OKButton &) = delete;
+ OKButton & operator= (const OKButton &) = delete;
+
+public:
+ explicit OKButton( vcl::Window* pParent, WinBits nStyle = WB_DEFBUTTON );
+
+ virtual void Click() override;
+};
+
+class VCL_DLLPUBLIC CancelButton : public PushButton
+{
+protected:
+ using PushButton::ImplInit;
+private:
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+
+ CancelButton (const CancelButton &) = delete;
+ CancelButton & operator= (const CancelButton &) = delete;
+
+public:
+ explicit CancelButton( vcl::Window* pParent, WinBits nStyle = 0 );
+
+ virtual void Click() override;
+};
+
+class CloseButton final : public CancelButton
+{
+public:
+ explicit CloseButton(vcl::Window* pParent);
+};
+
+class VCL_DLLPUBLIC HelpButton final : public PushButton
+{
+private:
+ using PushButton::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+
+ HelpButton( const HelpButton & ) = delete;
+ HelpButton & operator= ( const HelpButton & ) = delete;
+
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+
+public:
+ explicit HelpButton( vcl::Window* pParent, WinBits nStyle = 0 );
+
+ virtual void Click() override;
+};
+
+class VCL_DLLPUBLIC CheckBox : public Button
+{
+private:
+ tools::Rectangle maStateRect;
+ tools::Rectangle maMouseRect;
+ TriState meState;
+ bool mbTriState;
+ Link<CheckBox&,void> maToggleHdl;
+ SAL_DLLPRIVATE void ImplInitCheckBoxData();
+ SAL_DLLPRIVATE static WinBits ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nStyle );
+ SAL_DLLPRIVATE void ImplInitSettings( bool bBackground );
+ SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, SystemTextColorFlags nSystemTextColorFlags,
+ const Point& rPos, const Size& rSize,
+ const Size& rImageSize, tools::Rectangle& rStateRect,
+ tools::Rectangle& rMouseRect );
+ SAL_DLLPRIVATE void ImplDrawCheckBox(vcl::RenderContext& rRenderContext );
+ SAL_DLLPRIVATE Size ImplGetCheckImageSize() const;
+
+ CheckBox(const CheckBox &) = delete;
+ CheckBox& operator= (const CheckBox &) = delete;
+
+protected:
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ virtual void FillLayoutData() const override;
+ virtual const vcl::Font& GetCanonicalFont( const StyleSettings& _rStyle ) const override;
+ virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const override;
+ void ImplAdjustNWFSizes() override;
+
+ virtual void ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE const tools::Rectangle& GetStateRect() const { return maStateRect; }
+ SAL_DLLPRIVATE const tools::Rectangle& GetMouseRect() const { return maMouseRect; }
+
+public:
+ SAL_DLLPRIVATE void ImplCheck();
+public:
+ explicit CheckBox( vcl::Window* pParent, WinBits nStyle = 0 );
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void KeyUp( const KeyEvent& rKEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+
+ void Toggle();
+
+ void SetState( TriState eState );
+ TriState GetState() const { return meState; }
+
+ void Check( bool bCheck = true )
+ {
+ SetState( bCheck ? TRISTATE_TRUE : TRISTATE_FALSE );
+ }
+
+ bool IsChecked() const
+ {
+ return (GetState() == TRISTATE_TRUE);
+ }
+
+ void EnableTriState( bool bTriState = true );
+ bool IsTriStateEnabled() const { return mbTriState; }
+
+ static Image GetCheckImage( const AllSettings& rSettings, DrawButtonFlags nFlags );
+
+ Size CalcMinimumSize( tools::Long nMaxWidth = 0 ) const;
+ virtual Size GetOptimalSize() const override;
+
+ void SetToggleHdl( const Link<CheckBox&,void>& rLink ) { maToggleHdl = rLink; }
+
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+ virtual void ShowFocus(const tools::Rectangle& rRect) override;
+
+ /// Button has additional stuff that we need to dump too.
+ void DumpAsPropertyTree(tools::JsonWriter&) override;
+
+ virtual FactoryFunction GetUITestFactory() const override;
+};
+
+class VCL_DLLPUBLIC RadioButton : public Button
+{
+private:
+ friend class VclBuilder;
+
+ std::shared_ptr< std::vector< VclPtr< RadioButton > > > m_xGroup;
+ tools::Rectangle maStateRect;
+ tools::Rectangle maMouseRect;
+ Image maImage;
+ bool mbChecked;
+ bool mbRadioCheck;
+ bool mbStateChanged;
+ bool mbUsesExplicitGroup;
+ Link<RadioButton&,void> maToggleHdl;
+ SAL_DLLPRIVATE void ImplInitRadioButtonData();
+ SAL_DLLPRIVATE WinBits ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nStyle ) const;
+ SAL_DLLPRIVATE void ImplInitSettings( bool bBackground );
+ SAL_DLLPRIVATE void ImplDrawRadioButtonState(vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, SystemTextColorFlags nSystemTextColorFlags,
+ const Point& rPos, const Size& rSize,
+ const Size& rImageSize, tools::Rectangle& rStateRect,
+ tools::Rectangle& rMouseRect );
+ SAL_DLLPRIVATE void ImplDrawRadioButton(vcl::RenderContext& rRenderContext );
+ SAL_DLLPRIVATE void ImplUncheckAllOther();
+ SAL_DLLPRIVATE Size ImplGetRadioImageSize() const;
+
+ RadioButton(const RadioButton &) = delete;
+ RadioButton& operator= (const RadioButton &) = delete;
+
+protected:
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+
+public:
+ SAL_DLLPRIVATE void ImplCallClick( bool bGrabFocus = false, GetFocusFlags nFocusFlags = GetFocusFlags::NONE );
+
+protected:
+ virtual void FillLayoutData() const override;
+ virtual const vcl::Font&
+ GetCanonicalFont( const StyleSettings& _rStyle ) const override;
+ virtual const Color&
+ GetCanonicalTextColor( const StyleSettings& _rStyle ) const override;
+ void ImplAdjustNWFSizes() override;
+
+public:
+ /*
+ bUsesExplicitGroup of true means that group() is used to set what radiobuttons are part of a group
+ while false means that contiguous radiobuttons are considered part of a group where WB_GROUP designates
+ the start of the group and all contiguous radiobuttons without WB_GROUP set form the rest of the group.
+
+ true is fairly straightforward, false leads to trick situations and is the legacy case
+ */
+ explicit RadioButton(vcl::Window* pParent, bool bUsesExplicitGroup, WinBits nWinStyle);
+ virtual ~RadioButton() override;
+ virtual void dispose() override;
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void KeyUp( const KeyEvent& rKEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+
+ void Toggle();
+
+ bool IsStateChanged() const { return mbStateChanged; }
+
+ void EnableRadioCheck( bool bRadioCheck ) { mbRadioCheck = bRadioCheck; }
+ bool IsRadioCheckEnabled() const { return mbRadioCheck; }
+
+ void SetModeRadioImage( const Image& rImage );
+
+ void SetState( bool bCheck );
+ void Check( bool bCheck = true );
+ bool IsChecked() const { return mbChecked; }
+
+ static Image GetRadioImage( const AllSettings& rSettings, DrawButtonFlags nFlags );
+
+ Size CalcMinimumSize( tools::Long nMaxWidth = 0 ) const;
+ virtual Size GetOptimalSize() const override;
+
+ void SetToggleHdl( const Link<RadioButton&,void>& rLink ) { maToggleHdl = rLink; }
+
+ /** GetRadioButtonGroup returns a list of pointers to <code>RadioButton</code>s in the same group.
+
+ The pointers in the returned list are valid at the time call returns. However rescheduling
+ or giving up the SolarMutex may mean events get executed that lead to the pointers getting
+ invalid.
+
+ @param bIncludeThis
+ defines whether <code>this</code> is contained in the returned list
+
+ @return
+ on return contains the <code>RadioButton</code>s
+ in the same group as this <code>RadioButton</code>.
+ */
+ std::vector<VclPtr<RadioButton> > GetRadioButtonGroup(bool bIncludeThis = true) const;
+
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+
+ /*
+ * Group this RadioButton with another
+ */
+ void group(RadioButton &rOther);
+ virtual void ShowFocus(const tools::Rectangle& rRect) override;
+
+ /// Button has additional stuff that we need to dump too.
+ void DumpAsPropertyTree(tools::JsonWriter&) override;
+
+ virtual FactoryFunction GetUITestFactory() const override;
+};
+
+class VCL_DLLPUBLIC ImageButton final : public PushButton
+{
+private:
+ using PushButton::ImplInitStyle;
+
+ SAL_DLLPRIVATE void ImplInitStyle();
+
+ ImageButton( const ImageButton & ) = delete;
+ ImageButton & operator= ( const ImageButton & ) = delete;
+
+public:
+ ImageButton( vcl::Window* pParent, WinBits nStyle = 0 );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/calendar.hxx b/include/vcl/toolkit/calendar.hxx
new file mode 100644
index 000000000..a1a1cd901
--- /dev/null
+++ b/include/vcl/toolkit/calendar.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+
+#include <vcl/toolkit/field.hxx>
+#include <vcl/weld.hxx>
+
+class FloatingWindow;
+struct ImplCFieldFloatWin;
+
+/*************************************************************************
+
+Description
+============
+
+class CalendarField
+
+This class is a DateField with which one can select a date via a DropDownButton
+and the CalendarControl.
+
+--------------------------------------------------------------------------
+
+WinBits
+
+See DateField
+
+The preferences for the CalendarControl can be set via SetCalendarStyle().
+
+--------------------------------------------------------------------------
+
+With EnableToday()/EnableNone() we can enable a TodayButton and a NoneButton.
+
+--------------------------------------------------------------------------
+
+Because we only take over the start date into the field, we should query
+with GetCalendar() in the SelectHandler and with GetSelectDateCount()/GetSelectDate()
+the selected range. We then can e.g. take over that value to another field.
+
+--------------------------------------------------------------------------
+
+If a derived Calendar should be used, we can override the CreateCalendar()
+method in CalendarField and create an own calendar there ourselves.
+
+*************************************************************************/
+
+
+class VCL_DLLPUBLIC CalendarField final : public DateField
+{
+private:
+ VclPtr<ImplCFieldFloatWin> mpFloatWin;
+ weld::Button* mpTodayBtn;
+ weld::Button* mpNoneBtn;
+ bool mbToday;
+ bool mbNone;
+
+ DECL_DLLPRIVATE_LINK( ImplSelectHdl, weld::Calendar&, void );
+ DECL_DLLPRIVATE_LINK( ImplClickHdl, weld::Button&, void );
+ DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, FloatingWindow*, void );
+
+public:
+ CalendarField( vcl::Window* pParent, WinBits nWinStyle );
+ virtual ~CalendarField() override;
+ virtual void dispose() override;
+
+ virtual bool ShowDropDown( bool bShow ) override;
+
+ void EnableToday() { mbToday = true; }
+ void EnableNone() { mbNone = true; }
+
+private:
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/combobox.hxx b/include/vcl/toolkit/combobox.hxx
new file mode 100644
index 000000000..bdc415744
--- /dev/null
+++ b/include/vcl/toolkit/combobox.hxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <memory>
+#include <vcl/dllapi.h>
+#include <vcl/toolkit/edit.hxx>
+
+#define COMBOBOX_APPEND (SAL_MAX_INT32)
+#define COMBOBOX_ENTRY_NOTFOUND (SAL_MAX_INT32)
+#define COMBOBOX_MAX_ENTRIES (SAL_MAX_INT32 - 1)
+
+class ImplListBoxWindow;
+class UserDrawEvent;
+
+/// A widget used to choose from a list of items and which has an entry.
+class VCL_DLLPUBLIC ComboBox : public Edit
+{
+private:
+ struct SAL_DLLPRIVATE Impl;
+ std::unique_ptr<Impl> m_pImpl;
+
+protected:
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
+ SAL_DLLPRIVATE void ImplCalcEditHeight();
+ SAL_DLLPRIVATE tools::Long getMaxWidthScrollBarAndDownButton() const;
+
+protected:
+ bool IsDropDownBox() const;
+
+ virtual void FillLayoutData() const override;
+
+public:
+ explicit ComboBox( vcl::Window* pParent, WinBits nStyle = 0 );
+ virtual ~ComboBox() override;
+ virtual void dispose() override;
+
+ virtual void Draw( OutputDevice* pDev, const Point& rPos,SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ void Select();
+ void DoubleClick();
+
+ virtual void Modify() override;
+
+ virtual const Wallpaper& GetDisplayBackground() const override;
+
+ virtual void setPosSizePixel( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags = PosSizeFlags::All ) override;
+
+ tools::Rectangle GetDropDownPosSizePixel() const;
+
+ void AdaptDropDownLineCountToMaximum();
+ void SetDropDownLineCount( sal_uInt16 nLines );
+ sal_uInt16 GetDropDownLineCount() const;
+
+ void EnableAutoSize( bool bAuto );
+ bool IsAutoSizeEnabled() const;
+
+ virtual void SetText( const OUString& rStr ) override;
+ virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) override;
+
+ sal_Int32 InsertEntry(const OUString& rStr, sal_Int32 nPos = COMBOBOX_APPEND);
+ sal_Int32 InsertEntryWithImage( const OUString& rStr, const Image& rImage, sal_Int32 nPos = COMBOBOX_APPEND );
+
+ void RemoveEntryAt(sal_Int32 nPos);
+
+ void Clear();
+ sal_Int32 GetEntryPos( std::u16string_view rStr ) const;
+ Image GetEntryImage( sal_Int32 nPos ) const;
+ OUString GetEntry( sal_Int32 nPos ) const;
+ sal_Int32 GetEntryCount() const;
+
+ bool IsTravelSelect() const;
+ bool IsInDropDown() const;
+ void ToggleDropDown();
+
+ void SetUserItemSize( const Size& rSz );
+ void EnableUserDraw( bool bUserDraw );
+ bool IsUserDrawEnabled() const;
+
+ void DrawEntry( const UserDrawEvent& rEvt );
+ void SetBorderStyle( WindowBorderStyle nBorderStyle );
+
+ /**
+ * Adds a new separator at the given position n.
+ */
+ void AddSeparator( sal_Int32 n );
+
+ void EnableAutocomplete( bool bEnable, bool bMatchCase = false );
+ bool IsAutocompleteEnabled() const;
+
+ bool IsMultiSelectionEnabled() const;
+
+ void SetSelectHdl(const Link<ComboBox&,void>& rLink);
+ void SetEntryActivateHdl(const Link<Edit&,bool>& rLink);
+ void SetUserDrawHdl(const Link<UserDrawEvent*, void>& rLink);
+
+ Size CalcMinimumSize() const override;
+ virtual Size GetOptimalSize() const override;
+ Size CalcAdjustedSize( const Size& rPrefSize ) const;
+ Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
+ void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
+
+ void SetMRUEntries( std::u16string_view rEntries );
+ OUString GetMRUEntries() const;
+ void SetMaxMRUCount( sal_Int32 n );
+ sal_Int32 GetMaxMRUCount() const;
+ void SetEntryData( sal_Int32 nPos, void* pNewData );
+ void* GetEntryData( sal_Int32 nPos ) const;
+
+ sal_Int32 GetTopEntry() const;
+
+ sal_uInt16 GetDisplayLineCount() const;
+
+ sal_Int32 GetSelectedEntryCount() const;
+ sal_Int32 GetSelectedEntryPos( sal_Int32 nSelIndex = 0 ) const;
+ bool IsEntryPosSelected( sal_Int32 nPos ) const;
+ void SelectEntryPos( sal_Int32 nPos, bool bSelect = true );
+ void SetNoSelection();
+ tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const;
+
+ // determine if Select was called due to typing or cursoring in the
+ // combobox, as opposed to something selected from the menu or via some
+ // other route. e.g. the toolbar fontsize combobox wants to immediately
+ // change size only if something is picked from the combobox menu, other
+ // changes don't auto-apply until the user presses return
+ bool IsModifyByKeyboard() const;
+
+ // determine if Edit::Modify was called due to the ComboBox changing the edit area
+ // itself
+ bool IsSyntheticModify() const;
+
+
+ /** checks whether a certain point lies within the bounds of
+ a list item and returns the item as well as the character position
+ the point is at.
+
+ <p>If the point is inside an item the item pos is put into <code>rPos</code> and
+ the item-relative character index is returned. If the point is not inside
+ an item -1 is returned and rPos is unchanged.</p>
+
+ @param rPoint
+ tells the point for which an item is requested.
+
+ @param rPos
+ gets the item at the specified point <code>rPoint</code>
+
+ @returns
+ the item-relative character index at point <code>rPos</code> or -1
+ if no item is at that point.
+ */
+ using Control::GetIndexForPoint;
+ tools::Long GetIndexForPoint( const Point& rPoint, sal_Int32 & rPos ) const;
+
+ void setMaxWidthChars(sal_Int32 nWidth);
+
+ void SetWidthInChars(sal_Int32 nWidthInChars);
+
+ tools::Long GetDropDownEntryHeight() const;
+
+ // the drop down window container
+ ImplListBoxWindow* GetMainWindow() const;
+
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/dialog.hxx b/include/vcl/toolkit/dialog.hxx
new file mode 100644
index 000000000..31326106c
--- /dev/null
+++ b/include/vcl/toolkit/dialog.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <memory>
+#include <string_view>
+
+#include <vcl/dllapi.h>
+#include <vcl/syswin.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/abstdlg.hxx>
+
+struct DialogImpl;
+class Button;
+class PushButton;
+class VclBox;
+class VclButtonBox;
+
+class VCL_DLLPUBLIC Dialog : public SystemWindow
+{
+public:
+ enum class InitFlag
+ {
+ /** Use given parent or get a default one using GetDefaultParent(...) */
+ Default,
+
+ /** No Parent */
+ NoParent
+ };
+
+private:
+ std::unique_ptr<DialogImpl> mpDialogImpl;
+ tools::Long mnMousePositioned;
+ bool mbInExecute;
+ bool mbInSyncExecute;
+ bool mbInClose;
+ bool mbModalMode;
+ InitFlag mnInitFlag; // used for deferred init
+
+ VclPtr<VclButtonBox> mpActionArea;
+ VclPtr<VclBox> mpContentArea;
+
+ SAL_DLLPRIVATE void RemoveFromDlgList();
+ SAL_DLLPRIVATE void ImplInitDialogData();
+ SAL_DLLPRIVATE void ImplInitSettings();
+ SAL_DLLPRIVATE VclPtr<vcl::Window> AddBorderWindow(vcl::Window* pParent, WinBits nBits);
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+
+ SAL_DLLPRIVATE Dialog (const Dialog &) = delete;
+ SAL_DLLPRIVATE Dialog & operator= (const Dialog &) = delete;
+
+ DECL_DLLPRIVATE_LINK(ImplAsyncCloseHdl, void*, void);
+ DECL_DLLPRIVATE_LINK(ResponseHdl, Button*, void);
+
+ // get the default parent for a dialog as is done in standard initialization
+ SAL_DLLPRIVATE static vcl::Window* GetDefaultParent(WinBits nStyle);
+
+protected:
+ void ImplInitDialog( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag = InitFlag::Default );
+
+ /// Find and set the LOK notifier according to the pParent.
+ void ImplLOKNotifier(vcl::Window* pParent);
+
+public:
+ SAL_DLLPRIVATE bool IsInClose() const { return mbInClose; }
+ virtual void doDeferredInit(WinBits nBits) override;
+ SAL_DLLPRIVATE void disposeOwnedButtons();
+
+ SAL_DLLPRIVATE static vcl::Window* GetDefDialogParent();
+
+protected:
+ explicit Dialog( WindowType nType );
+ explicit Dialog( vcl::Window* pParent, std::u16string_view rID, const OUString& rUIXMLDescription);
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void settingOptimalLayoutSize(Window *pBox) override;
+
+protected:
+ friend class VclBuilder;
+ friend class SalInstanceBuilder;
+ void set_action_area(VclButtonBox* pBox);
+ void set_content_area(VclBox* pBox);
+
+public:
+ explicit Dialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG, InitFlag eFlag = InitFlag::Default );
+ virtual ~Dialog() override;
+ virtual void dispose() override;
+
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual void Command( const CommandEvent& rCEvt ) override;
+ virtual void PixelInvalidate(const tools::Rectangle* pRectangle) override;
+
+ virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+ VclButtonBox* get_action_area() { return mpActionArea; }
+ VclBox* get_content_area() { return mpContentArea; }
+
+ virtual bool Close() override;
+
+ short Execute();
+ bool IsInExecute() const { return mbInExecute; }
+ // Return true when dialog is synchronously executed (calling ::Execute())
+ bool IsInSyncExecute() const { return mbInSyncExecute; };
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+private:
+ bool ImplStartExecute();
+ static void ImplEndExecuteModal();
+ void ImplSetModalInputMode(bool bModal);
+
+ vcl::Window* GetFirstControlForFocus();
+public:
+
+ /// Commence execution of a modal dialog, disposes owner on failure
+ bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx);
+
+ // Dialog::Execute replacement API
+
+
+ void EndDialog( tools::Long nResult = RET_CANCEL );
+
+ void GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
+ sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
+
+ void SetModalInputMode( bool bModal );
+ bool IsModalInputMode() const { return mbModalMode; }
+
+ void GrabFocusToFirstControl();
+ virtual void Resize() override;
+
+ void Activate() override;
+
+ void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink);
+ void SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink);
+ void SetLOKTunnelingState(bool bEnabled);
+
+ void add_button(PushButton* pButton, int nResponse, bool bTransferOwnership);
+ void set_default_response(int nResponse);
+ int get_default_response() const;
+ vcl::Window* get_widget_for_response(int nResponse);
+
+ void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/edit.hxx b/include/vcl/toolkit/edit.hxx
new file mode 100644
index 000000000..6cba93604
--- /dev/null
+++ b/include/vcl/toolkit/edit.hxx
@@ -0,0 +1,249 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <vcl/ctrl.hxx>
+#include <vcl/textfilter.hxx>
+
+#include <memory>
+
+#include <rtl/ustrbuf.hxx>
+#include <o3tl/deleter.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/dndhelp.hxx>
+#include <vcl/vclptr.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+namespace com::sun::star::i18n {
+ class XBreakIterator;
+ class XExtendedInputSequenceChecker;
+}
+namespace weld {
+ class Widget;
+}
+
+class PopupMenu;
+class VclBuilder;
+struct DDInfo;
+struct Impl_IMEInfos;
+
+#define EDIT_NOLIMIT SAL_MAX_INT32
+
+class Timer;
+
+class VCL_DLLPUBLIC Edit : public Control, public vcl::unohelper::DragAndDropClient
+{
+private:
+ VclPtr<Edit> mpSubEdit;
+ TextFilter* mpFilterText;
+ std::unique_ptr<DDInfo, o3tl::default_delete<DDInfo>> mpDDInfo;
+ std::unique_ptr<Impl_IMEInfos> mpIMEInfos;
+ OUStringBuffer maText;
+ OUString maPlaceholderText;
+ OUString maSaveValue;
+ OUString maUndoText;
+ tools::Long mnXOffset;
+ Selection maSelection;
+ sal_uInt16 mnAlign;
+ sal_Int32 mnMaxTextLen;
+ sal_Int32 mnWidthInChars;
+ sal_Int32 mnMaxWidthChars;
+ sal_Unicode mcEchoChar;
+ bool mbInternModified:1,
+ mbReadOnly:1,
+ mbInsertMode:1,
+ mbClickedInSelection:1,
+ mbIsSubEdit:1,
+ mbActivePopup:1,
+ mbForceControlBackground:1,
+ mbPassword;
+ Link<Edit&,void> maModifyHdl;
+ Link<Edit&,void> maAutocompleteHdl;
+ Link<Edit&,bool> maActivateHdl;
+ std::unique_ptr<VclBuilder> mpUIBuilder;
+
+ css::uno::Reference<css::i18n::XBreakIterator> mxBreakIterator;
+ css::uno::Reference<css::i18n::XExtendedInputSequenceChecker> mxISC;
+
+ SAL_DLLPRIVATE bool ImplTruncateToMaxLen( OUString&, sal_Int32 nSelectionLen ) const;
+ SAL_DLLPRIVATE void ImplInitEditData();
+ SAL_DLLPRIVATE OUString ImplGetText() const;
+ SAL_DLLPRIVATE void ImplRepaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRectangle);
+ SAL_DLLPRIVATE void ImplInvalidateOrRepaint();
+ SAL_DLLPRIVATE void ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uInt8 nMode );
+ SAL_DLLPRIVATE void ImplSetText( const OUString& rStr, const Selection* pNewSelection );
+ SAL_DLLPRIVATE void ImplInsertText( const OUString& rStr, const Selection* pNewSelection = nullptr, bool bIsUserInput = false );
+ SAL_DLLPRIVATE static OUString ImplGetValidString( const OUString& rString );
+ SAL_DLLPRIVATE void ImplClearBackground(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRectangle, tools::Long nXStart, tools::Long nXEnd);
+ SAL_DLLPRIVATE void ImplPaintBorder(vcl::RenderContext const & rRenderContext);
+ SAL_DLLPRIVATE void ImplShowCursor( bool bOnlyIfVisible = true );
+ SAL_DLLPRIVATE void ImplAlign();
+ SAL_DLLPRIVATE void ImplAlignAndPaint();
+ SAL_DLLPRIVATE sal_Int32 ImplGetCharPos( const Point& rWindowPos ) const;
+ SAL_DLLPRIVATE void ImplSetCursorPos( sal_Int32 nChar, bool bSelect );
+ SAL_DLLPRIVATE void ImplShowDDCursor();
+ SAL_DLLPRIVATE void ImplHideDDCursor();
+ SAL_DLLPRIVATE bool ImplHandleKeyEvent( const KeyEvent& rKEvt );
+ SAL_DLLPRIVATE void ImplCopyToSelectionClipboard();
+ SAL_DLLPRIVATE void ImplCopy(css::uno::Reference<css::datatransfer::clipboard::XClipboard> const & rxClipboard);
+ SAL_DLLPRIVATE void ImplPaste(css::uno::Reference<css::datatransfer::clipboard::XClipboard> const & rxClipboard);
+ SAL_DLLPRIVATE tools::Long ImplGetTextYPosition() const;
+ SAL_DLLPRIVATE css::uno::Reference<css::i18n::XExtendedInputSequenceChecker> const& ImplGetInputSequenceChecker();
+ SAL_DLLPRIVATE css::uno::Reference<css::i18n::XBreakIterator> const& ImplGetBreakIterator();
+ SAL_DLLPRIVATE void filterText();
+
+protected:
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
+ SAL_DLLPRIVATE void ImplSetSelection( const Selection& rSelection, bool bPaint = true );
+ SAL_DLLPRIVATE ControlType ImplGetNativeControlType() const;
+ SAL_DLLPRIVATE tools::Long ImplGetExtraXOffset() const;
+ SAL_DLLPRIVATE tools::Long ImplGetExtraYOffset() const;
+ static SAL_DLLPRIVATE void ImplInvalidateOutermostBorder( vcl::Window* pWin );
+
+ css::uno::Reference<css::datatransfer::dnd::XDragSourceListener > mxDnDListener;
+
+ // DragAndDropClient
+ using vcl::unohelper::DragAndDropClient::dragEnter;
+ using vcl::unohelper::DragAndDropClient::dragExit;
+ using vcl::unohelper::DragAndDropClient::dragOver;
+ virtual void dragGestureRecognized(const css::datatransfer::dnd::DragGestureEvent& dge) override;
+ virtual void dragDropEnd(const css::datatransfer::dnd::DragSourceDropEvent& dsde) override;
+ virtual void drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde) override;
+ virtual void dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee) override;
+ virtual void dragExit(const css::datatransfer::dnd::DropTargetEvent& dte) override;
+ virtual void dragOver(const css::datatransfer::dnd::DropTargetDragEvent& dtde) override;
+
+protected:
+ Edit(WindowType nType);
+ virtual void FillLayoutData() const override;
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+public:
+ // public because needed in button.cxx
+ SAL_DLLPRIVATE bool ImplUseNativeBorder(vcl::RenderContext const & rRenderContext, WinBits nStyle) const;
+
+ Edit( vcl::Window* pParent, WinBits nStyle = WB_BORDER );
+ virtual ~Edit() override;
+ virtual void dispose() override;
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+ virtual void Command( const CommandEvent& rCEvt ) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual void Modify();
+
+ static bool IsCharInput( const KeyEvent& rKEvt );
+
+ virtual void SetModifyFlag();
+
+ void SetEchoChar( sal_Unicode c );
+ sal_Unicode GetEchoChar() const { return mcEchoChar; }
+
+ virtual void SetReadOnly( bool bReadOnly = true );
+ virtual bool IsReadOnly() const { return mbReadOnly; }
+
+ void SetInsertMode( bool bInsert );
+ bool IsInsertMode() const;
+
+ virtual void SetMaxTextLen( sal_Int32 nMaxLen );
+ virtual sal_Int32 GetMaxTextLen() const { return mnMaxTextLen; }
+
+ void SetWidthInChars(sal_Int32 nWidthInChars);
+ sal_Int32 GetWidthInChars() const { return mnWidthInChars; }
+
+ void setMaxWidthChars(sal_Int32 nWidth);
+
+ virtual void SetSelection( const Selection& rSelection );
+ virtual const Selection& GetSelection() const;
+
+ virtual void ReplaceSelected( const OUString& rStr );
+ virtual void DeleteSelected();
+ virtual OUString GetSelected() const;
+
+ virtual void Cut();
+ virtual void Copy();
+ virtual void Paste();
+ void Undo();
+
+ virtual void SetText( const OUString& rStr ) override;
+ virtual void SetText( const OUString& rStr, const Selection& rNewSelection );
+ virtual OUString GetText() const override;
+
+ void SetCursorAtLast();
+
+ void SetPlaceholderText( const OUString& rStr );
+
+ void SaveValue() { maSaveValue = GetText(); }
+ const OUString& GetSavedValue() const { return maSaveValue; }
+
+ virtual void SetModifyHdl( const Link<Edit&,void>& rLink ) { maModifyHdl = rLink; }
+ virtual const Link<Edit&,void>& GetModifyHdl() const { return maModifyHdl; }
+
+ void SetActivateHdl(const Link<Edit&,bool>& rLink) { maActivateHdl = rLink; }
+
+ void SetSubEdit( Edit* pEdit );
+ Edit* GetSubEdit() const { return mpSubEdit; }
+
+ void SetAutocompleteHdl( const Link<Edit&,void>& rLink ) { maAutocompleteHdl = rLink; }
+ const Link<Edit&,void>& GetAutocompleteHdl() const { return maAutocompleteHdl; }
+
+ virtual Size CalcMinimumSize() const;
+ virtual Size CalcMinimumSizeForText(const OUString &rString) const;
+ virtual Size GetOptimalSize() const override;
+ virtual Size CalcSize(sal_Int32 nChars) const;
+ sal_Int32 GetMaxVisChars() const;
+
+ // shows a warning box saying "text too long, truncated"
+ static void ShowTruncationWarning(weld::Widget* pParent);
+
+ VclPtr<PopupMenu> CreatePopupMenu();
+
+ virtual OUString GetSurroundingText() const override;
+ virtual Selection GetSurroundingTextSelection() const override;
+ virtual bool DeleteSurroundingText(const Selection& rSelection) override;
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+
+ void SetTextFilter(TextFilter* pFilter) { mpFilterText = pFilter; }
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ void SetForceControlBackground(bool b) { mbForceControlBackground = b; }
+
+ bool IsPassword() const { return mbPassword; }
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/field.hxx b/include/vcl/toolkit/field.hxx
new file mode 100644
index 000000000..086a9d5f1
--- /dev/null
+++ b/include/vcl/toolkit/field.hxx
@@ -0,0 +1,627 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <config_options.h>
+#include <tools/date.hxx>
+#include <tools/fldunit.hxx>
+#include <tools/time.hxx>
+#include <vcl/toolkit/combobox.hxx>
+#include <vcl/toolkit/spinfld.hxx>
+#include <vcl/formatter.hxx>
+
+namespace com::sun::star::lang { struct Locale; }
+
+class CalendarWrapper;
+class LocaleDataWrapper;
+class LanguageTag;
+
+class VCL_DLLPUBLIC FormatterBase
+{
+private:
+ VclPtr<Edit> mpField;
+ mutable std::unique_ptr<LocaleDataWrapper>
+ mpLocaleDataWrapper;
+ bool mbReformat;
+ bool mbStrictFormat;
+ bool mbEmptyFieldValue;
+ bool mbEmptyFieldValueEnabled;
+
+protected:
+ SAL_DLLPRIVATE void ImplSetText( const OUString& rText, Selection const * pNewSel = nullptr );
+ SAL_DLLPRIVATE bool ImplGetEmptyFieldValue() const { return mbEmptyFieldValue; }
+
+ void SetEmptyFieldValueData( bool bValue ) { mbEmptyFieldValue = bValue; }
+
+ SAL_DLLPRIVATE LocaleDataWrapper& ImplGetLocaleDataWrapper() const;
+ /** reset the LocaleDataWrapper when the language tag changes */
+ SAL_DLLPRIVATE void ImplResetLocaleDataWrapper() const;
+
+ Edit* GetField() const { return mpField; }
+ void ClearField() { mpField.clear(); }
+
+public:
+ explicit FormatterBase(Edit* pField);
+ virtual ~FormatterBase();
+
+ const LocaleDataWrapper& GetLocaleDataWrapper() const;
+
+ bool MustBeReformatted() const { return mbReformat; }
+ void MarkToBeReformatted( bool b ) { mbReformat = b; }
+
+ void SetStrictFormat( bool bStrict );
+ bool IsStrictFormat() const { return mbStrictFormat; }
+
+ virtual void Reformat();
+ virtual void ReformatAll();
+
+ const css::lang::Locale& GetLocale() const;
+ const LanguageTag& GetLanguageTag() const;
+
+ void SetEmptyFieldValue();
+ bool IsEmptyFieldValue() const;
+
+ void EnableEmptyFieldValue( bool bEnable ) { mbEmptyFieldValueEnabled = bEnable; }
+ bool IsEmptyFieldValueEnabled() const { return mbEmptyFieldValueEnabled; }
+};
+
+class VCL_DLLPUBLIC NumericFormatter : public FormatterBase
+{
+public:
+ virtual ~NumericFormatter() override;
+
+ virtual void Reformat() override;
+
+ void SetMin( sal_Int64 nNewMin );
+ sal_Int64 GetMin() const { return mnMin; }
+ void SetMax( sal_Int64 nNewMax );
+ sal_Int64 GetMax() const { return mnMax; }
+
+ sal_Int64 ClipAgainstMinMax(sal_Int64 nValue) const;
+
+ void SetFirst( sal_Int64 nNewFirst ) { mnFirst = nNewFirst; }
+ sal_Int64 GetFirst() const { return mnFirst; }
+ void SetLast( sal_Int64 nNewLast ) { mnLast = nNewLast; }
+ sal_Int64 GetLast() const { return mnLast; }
+ void SetSpinSize( sal_Int64 nNewSize ) { mnSpinSize = nNewSize; }
+ sal_Int64 GetSpinSize() const { return mnSpinSize; }
+
+ void SetDecimalDigits( sal_uInt16 nDigits );
+ sal_uInt16 GetDecimalDigits() const { return mnDecimalDigits;}
+
+ void SetUseThousandSep( bool b );
+ bool IsUseThousandSep() const { return mbThousandSep; }
+
+ void SetUserValue( sal_Int64 nNewValue );
+ virtual void SetValue( sal_Int64 nNewValue );
+ sal_Int64 GetValue() const;
+ virtual OUString CreateFieldText( sal_Int64 nValue ) const;
+
+ sal_Int64 Normalize( sal_Int64 nValue ) const;
+ sal_Int64 Denormalize( sal_Int64 nValue ) const;
+
+ OUString GetValueString() const;
+ void SetValueFromString(const OUString& rStr);
+
+protected:
+ sal_Int64 mnLastValue;
+ sal_Int64 mnMin;
+ sal_Int64 mnMax;
+ bool mbFormatting;
+
+ // the members below are used in all derivatives of NumericFormatter
+ // not in NumericFormatter itself.
+ sal_Int64 mnSpinSize;
+ sal_Int64 mnFirst;
+ sal_Int64 mnLast;
+
+ NumericFormatter(Edit* pEdit);
+
+ void FieldUp();
+ void FieldDown();
+ void FieldFirst();
+ void FieldLast();
+ void FormatValue(Selection const * pNewSelection = nullptr);
+
+ SAL_DLLPRIVATE void ImplNumericReformat();
+ SAL_DLLPRIVATE void ImplNewFieldValue( sal_Int64 nNewValue );
+ SAL_DLLPRIVATE void ImplSetUserValue( sal_Int64 nNewValue, Selection const * pNewSelection = nullptr );
+
+ virtual sal_Int64 GetValueFromString(const OUString& rStr) const;
+
+private:
+ sal_uInt16 mnDecimalDigits;
+ bool mbThousandSep;
+
+};
+
+class VCL_DLLPUBLIC MetricFormatter : public NumericFormatter
+{
+public:
+ virtual ~MetricFormatter() override;
+
+ virtual void Reformat() override;
+
+ virtual void SetUnit( FieldUnit meUnit );
+ FieldUnit GetUnit() const { return meUnit; }
+ void SetCustomUnitText( const OUString& rStr );
+ const OUString& GetCustomUnitText() const { return maCustomUnitText; }
+
+ using NumericFormatter::SetMax;
+ void SetMax( sal_Int64 nNewMax, FieldUnit eInUnit );
+ using NumericFormatter::GetMax;
+ sal_Int64 GetMax( FieldUnit eOutUnit ) const;
+ using NumericFormatter::SetMin;
+ void SetMin( sal_Int64 nNewMin, FieldUnit eInUnit );
+ using NumericFormatter::GetMin;
+ sal_Int64 GetMin( FieldUnit eOutUnit ) const;
+
+ void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit );
+ virtual void SetValue( sal_Int64 nValue ) override;
+ using NumericFormatter::SetUserValue;
+ void SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit );
+ using NumericFormatter::GetValue;
+ sal_Int64 GetValue( FieldUnit eOutUnit ) const;
+ virtual OUString CreateFieldText( sal_Int64 nValue ) const override;
+ sal_Int64 GetCorrectedValue( FieldUnit eOutUnit ) const;
+
+protected:
+ FieldUnit meUnit;
+
+ MetricFormatter(Edit* pEdit);
+
+ SAL_DLLPRIVATE void ImplMetricReformat( const OUString& rStr, double& rValue, OUString& rOutStr );
+
+ virtual sal_Int64 GetValueFromString(const OUString& rStr) const override;
+ sal_Int64 GetValueFromStringUnit(const OUString& rStr, FieldUnit eOutUnit) const;
+
+private:
+ OUString maCustomUnitText;
+};
+
+class VCL_DLLPUBLIC MetricField final : public SpinField, public MetricFormatter
+{
+public:
+ explicit MetricField( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual Size CalcMinimumSize() const override;
+
+ virtual void Modify() override;
+
+ virtual void Up() override;
+ virtual void Down() override;
+ virtual void First() override;
+ virtual void Last() override;
+
+ virtual void SetUnit( FieldUnit meUnit ) override;
+
+ void SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit );
+ sal_Int64 GetFirst( FieldUnit eOutUnit ) const;
+ void SetLast( sal_Int64 nNewLast, FieldUnit eInUnit );
+ sal_Int64 GetLast( FieldUnit eOutUnit ) const;
+
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+ virtual void dispose() override;
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+ virtual FactoryFunction GetUITestFactory() const override;
+};
+
+class VCL_DLLPUBLIC MetricBox final : public ComboBox, public MetricFormatter
+{
+public:
+ explicit MetricBox( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual Size CalcMinimumSize() const override;
+
+ virtual void Modify() override;
+
+ virtual void ReformatAll() override;
+
+ // Needed, because GetValue() with nPos hide these functions
+ using MetricFormatter::GetValue;
+
+ virtual void dispose() override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyFormatter : public NumericFormatter
+{
+protected:
+ CurrencyFormatter(Edit* pEdit);
+ SAL_DLLPRIVATE void ImplCurrencyReformat( const OUString& rStr, OUString& rOutStr );
+ virtual sal_Int64 GetValueFromString(const OUString& rStr) const override;
+
+public:
+ virtual ~CurrencyFormatter() override;
+
+ virtual void Reformat() override;
+
+ virtual void SetValue( sal_Int64 nNewValue ) override;
+ virtual OUString CreateFieldText( sal_Int64 nValue ) const override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyField final : public SpinField, public CurrencyFormatter
+{
+public:
+ CurrencyField( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual void Modify() override;
+
+ virtual void Up() override;
+ virtual void Down() override;
+ virtual void First() override;
+ virtual void Last() override;
+ virtual void dispose() override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) TimeFormatter : public FormatterBase
+{
+private:
+ tools::Time maLastTime;
+ tools::Time maMin;
+ tools::Time maMax;
+ TimeFieldFormat meFormat;
+ TimeFormat mnTimeFormat;
+ bool mbDuration;
+ bool mbEnforceValidValue;
+
+protected:
+ tools::Time maFieldTime;
+
+ TimeFormatter(Edit* pEdit);
+
+ SAL_DLLPRIVATE void ImplTimeReformat( std::u16string_view rStr, OUString& rOutStr );
+ SAL_DLLPRIVATE void ImplNewFieldValue( const tools::Time& rTime );
+ SAL_DLLPRIVATE void ImplSetUserTime( const tools::Time& rNewTime, Selection const * pNewSelection = nullptr );
+ SAL_DLLPRIVATE bool ImplAllowMalformedInput() const;
+
+public:
+ static OUString FormatTime(const tools::Time& rNewTime, TimeFieldFormat eFormat, TimeFormat eHourFormat, bool bDuration, const LocaleDataWrapper& rLocaleData);
+ static bool TextToTime(std::u16string_view rStr, tools::Time& rTime, TimeFieldFormat eFormat, bool bDuration, const LocaleDataWrapper& rLocaleDataWrapper, bool _bSkipInvalidCharacters = true);
+ static int GetTimeArea(TimeFieldFormat eFormat, std::u16string_view rText, int nCursor,
+ const LocaleDataWrapper& rLocaleDataWrapper);
+ static tools::Time SpinTime(bool bUp, const tools::Time& rTime, TimeFieldFormat eFormat,
+ bool bDuration, std::u16string_view rText, int nCursor,
+ const LocaleDataWrapper& rLocaleDataWrapper);
+
+ virtual ~TimeFormatter() override;
+
+ virtual void Reformat() override;
+ virtual void ReformatAll() override;
+
+ void SetMin( const tools::Time& rNewMin );
+ const tools::Time& GetMin() const { return maMin; }
+ void SetMax( const tools::Time& rNewMax );
+ const tools::Time& GetMax() const { return maMax; }
+
+ void SetTimeFormat( TimeFormat eNewFormat );
+ TimeFormat GetTimeFormat() const { return mnTimeFormat;}
+
+ void SetFormat( TimeFieldFormat eNewFormat );
+ TimeFieldFormat GetFormat() const { return meFormat; }
+
+ void SetDuration( bool mbDuration );
+ bool IsDuration() const { return mbDuration; }
+
+ void SetTime( const tools::Time& rNewTime );
+ void SetUserTime( const tools::Time& rNewTime );
+ tools::Time GetTime() const;
+ void SetEmptyTime() { FormatterBase::SetEmptyFieldValue(); }
+ bool IsEmptyTime() const { return FormatterBase::IsEmptyFieldValue(); }
+
+ /** enables or disables the enforcement of valid values
+
+ If this is set to true (which is the default), then GetTime will always return a valid
+ time, no matter whether the current text can really be interpreted as time. (Note: this
+ is the compatible behavior).
+
+ If this is set to false, the GetTime will return GetInvalidTime, in case the current text
+ cannot be interpreted as time.
+
+ In addition, if this is set to false, the text in the field will <em>not</em> be corrected
+ when the control loses the focus - instead, the invalid input will be preserved.
+ */
+ void EnforceValidValue( bool _bEnforce ) { mbEnforceValidValue = _bEnforce; }
+ bool IsEnforceValidValue( ) const { return mbEnforceValidValue; }
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) TimeField final : public SpinField, public TimeFormatter
+{
+private:
+ tools::Time maFirst;
+ tools::Time maLast;
+
+ SAL_DLLPRIVATE void ImplTimeSpinArea( bool bUp );
+
+public:
+ explicit TimeField( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual void Modify() override;
+
+ virtual void Up() override;
+ virtual void Down() override;
+ virtual void First() override;
+ virtual void Last() override;
+
+ void SetFirst( const tools::Time& rNewFirst ) { maFirst = rNewFirst; }
+ const tools::Time& GetFirst() const { return maFirst; }
+ void SetLast( const tools::Time& rNewLast ) { maLast = rNewLast; }
+ const tools::Time& GetLast() const { return maLast; }
+
+ void SetExtFormat( ExtTimeFieldFormat eFormat );
+ virtual void dispose() override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DateFormatter : public FormatterBase
+{
+private:
+ Formatter::StaticFormatter maStaticFormatter;
+ std::unique_ptr<CalendarWrapper> mxCalendarWrapper;
+ Date maFieldDate;
+ Date maLastDate;
+ Date maMin;
+ Date maMax;
+ bool mbLongFormat;
+ bool mbShowDateCentury;
+ ExtDateFieldFormat mnExtDateFormat;
+ bool mbEnforceValidValue;
+
+protected:
+ DateFormatter(Edit* pEdit);
+
+ SAL_DLLPRIVATE const Date& ImplGetFieldDate() const { return maFieldDate; }
+ SAL_DLLPRIVATE void ImplDateReformat( const OUString& rStr, OUString& rOutStr );
+ SAL_DLLPRIVATE void ImplSetUserDate( const Date& rNewDate,
+ Selection const * pNewSelection = nullptr );
+ SAL_DLLPRIVATE OUString ImplGetDateAsText( const Date& rDate ) const;
+ SAL_DLLPRIVATE void ImplNewFieldValue( const Date& rDate );
+ CalendarWrapper& GetCalendarWrapper() const;
+
+ SAL_DLLPRIVATE bool ImplAllowMalformedInput() const;
+
+public:
+ static OUString FormatDate(const Date& rNewDate, ExtDateFieldFormat eFormat, const LocaleDataWrapper& rLocaleData, const Formatter::StaticFormatter& rStaticFormatter);
+ static bool TextToDate(const OUString& rStr, Date& rTime, ExtDateFieldFormat eFormat, const LocaleDataWrapper& rLocaleDataWrapper, const CalendarWrapper& rCalendarWrapper);
+ static int GetDateArea(ExtDateFieldFormat& eFormat, std::u16string_view rText, int nCursor, const LocaleDataWrapper& rLocaleDataWrapper);
+
+ virtual ~DateFormatter() override;
+
+ virtual void Reformat() override;
+ virtual void ReformatAll() override;
+
+ void SetExtDateFormat( ExtDateFieldFormat eFormat );
+ ExtDateFieldFormat GetExtDateFormat( bool bResolveSystemFormat = false ) const;
+
+ void SetMin( const Date& rNewMin );
+ const Date& GetMin() const { return maMin; }
+
+ void SetMax( const Date& rNewMax );
+ const Date& GetMax() const { return maMax; }
+
+
+ // MT: Remove these methods too, ExtDateFormat should be enough!
+ // What should happen if using DDMMYYYY, but ShowCentury=false?
+
+ void SetLongFormat( bool bLong );
+ bool IsLongFormat() const { return mbLongFormat; }
+ void SetShowDateCentury( bool bShowCentury );
+ bool IsShowDateCentury() const { return mbShowDateCentury; }
+
+
+ void SetDate( const Date& rNewDate );
+ Date GetDate() const;
+ void SetEmptyDate();
+ bool IsEmptyDate() const;
+
+ void ResetLastDate() { maLastDate = Date( Date::EMPTY ); }
+
+ static void ExpandCentury( Date& rDate );
+ static void ExpandCentury( Date& rDate, sal_uInt16 nTwoDigitYearStart );
+
+ /** enables or disables the enforcement of valid values
+
+ If this is set to true (which is the default), then GetDate will always return a valid
+ date, no matter whether the current text can really be interpreted as date. (Note: this
+ is the compatible behavior).
+
+ If this is set to false, the GetDate will return GetInvalidDate, in case the current text
+ cannot be interpreted as date.
+
+ In addition, if this is set to false, the text in the field will \em not be corrected
+ when the control loses the focus - instead, the invalid input will be preserved.
+ */
+ void EnforceValidValue( bool _bEnforce ) { mbEnforceValidValue = _bEnforce; }
+ bool IsEnforceValidValue( ) const { return mbEnforceValidValue; }
+};
+
+class SAL_DLLPUBLIC_RTTI DateField : public SpinField, public DateFormatter
+{
+private:
+ Date maFirst;
+ Date maLast;
+
+protected:
+ void ImplDateSpinArea( bool bUp );
+
+public:
+ explicit DateField( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual void Modify() override;
+
+ virtual void Up() override;
+ virtual void Down() override;
+ virtual void First() override;
+ virtual void Last() override;
+
+ void SetFirst( const Date& rNewFirst ) { maFirst = rNewFirst; }
+ const Date& GetFirst() const { return maFirst; }
+ void SetLast( const Date& rNewLast ) { maLast = rNewLast; }
+ const Date& GetLast() const { return maLast; }
+ virtual void dispose() override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) NumericBox final : public ComboBox, public NumericFormatter
+{
+ SAL_DLLPRIVATE void ImplNumericReformat( const OUString& rStr, sal_Int64& rValue, OUString& rOutStr );
+public:
+ explicit NumericBox( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual Size CalcMinimumSize() const override;
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual void Modify() override;
+
+ virtual void ReformatAll() override;
+
+ virtual void dispose() override;
+};
+
+#define PATTERN_FORMAT_EMPTYLITERALS (sal_uInt16(0x0001))
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) PatternFormatter : public FormatterBase
+{
+private:
+ OString m_aEditMask;
+ OUString maLiteralMask;
+ bool mbSameMask;
+ bool mbInPattKeyInput;
+
+protected:
+ PatternFormatter(Edit* pEdit);
+
+ SAL_DLLPRIVATE bool ImplIsSameMask() const { return mbSameMask; }
+ SAL_DLLPRIVATE bool& ImplGetInPattKeyInput() { return mbInPattKeyInput; }
+
+public:
+ virtual ~PatternFormatter() override;
+
+ virtual void Reformat() override;
+
+ void SetMask(const OString& rEditMask, const OUString& rLiteralMask );
+ const OString& GetEditMask() const { return m_aEditMask; }
+ const OUString& GetLiteralMask() const { return maLiteralMask; }
+
+ void SetString( const OUString& rStr );
+ OUString GetString() const;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) PatternField final : public SpinField, public PatternFormatter
+{
+public:
+ explicit PatternField( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void Modify() override;
+ virtual void dispose() override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) PatternBox final : public ComboBox, public PatternFormatter
+{
+public:
+ PatternBox( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+
+ virtual void Modify() override;
+
+ virtual void ReformatAll() override;
+ virtual void dispose() override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyBox final : public ComboBox, public CurrencyFormatter
+{
+public:
+ explicit CurrencyBox( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual void Modify() override;
+
+ virtual void ReformatAll() override;
+
+ virtual void dispose() override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DateBox final : public ComboBox, public DateFormatter
+{
+public:
+ explicit DateBox( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual void Modify() override;
+
+ virtual void ReformatAll() override;
+ virtual void dispose() override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) TimeBox final : public ComboBox, public TimeFormatter
+{
+public:
+ explicit TimeBox( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual void Modify() override;
+
+ virtual void ReformatAll() override;
+ virtual void dispose() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/fixed.hxx b/include/vcl/toolkit/fixed.hxx
new file mode 100644
index 000000000..238d1cbdf
--- /dev/null
+++ b/include/vcl/toolkit/fixed.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <vcl/dllapi.h>
+#include <vcl/toolkit/edit.hxx>
+#include <vcl/ctrl.hxx>
+#include <vcl/image.hxx>
+
+class VCL_DLLPUBLIC FixedText : public Control
+{
+private:
+ sal_Int32 m_nMaxWidthChars;
+ sal_Int32 m_nMinWidthChars;
+ VclPtr<vcl::Window> m_pMnemonicWindow;
+
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
+ SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, SystemTextColorFlags nSystemTextColorFlags,
+ const Point& rPos, const Size& rSize, bool bFillLayout = false ) const;
+public:
+ SAL_DLLPRIVATE static DrawTextFlags ImplGetTextStyle( WinBits nWinBits );
+protected:
+ virtual void FillLayoutData() const override;
+ virtual const vcl::Font&
+ GetCanonicalFont( const StyleSettings& _rStyle ) const override;
+ virtual const Color&
+ GetCanonicalTextColor( const StyleSettings& _rStyle ) const override;
+
+ virtual vcl::Window* getAccessibleRelationLabelFor() const override;
+
+public:
+ explicit FixedText( vcl::Window* pParent, WinBits nStyle = 0 );
+ virtual ~FixedText() override;
+ virtual void dispose() override;
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ void setMaxWidthChars(sal_Int32 nWidth);
+ void setMinWidthChars(sal_Int32 nWidth);
+ static Size CalcMinimumTextSize(Control const* pControl, tools::Long nMaxWidth = 0x7fffffff);
+ static Size getTextDimensions(Control const *pControl, const OUString &rTxt, tools::Long nMaxWidth);
+ Size CalcMinimumSize(tools::Long nMaxWidth = 0x7fffffff) const;
+ virtual Size GetOptimalSize() const override;
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+ void set_mnemonic_widget(vcl::Window *pWindow);
+ vcl::Window* get_mnemonic_widget() const { return m_pMnemonicWindow; }
+};
+
+class SelectableFixedText final : public Edit
+{
+public:
+ explicit SelectableFixedText( vcl::Window* pParent, WinBits nStyle );
+
+ virtual void LoseFocus() override;
+ virtual void ApplySettings(vcl::RenderContext&) override;
+ virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
+};
+
+class VCL_DLLPUBLIC FixedLine final : public Control
+{
+private:
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
+ SAL_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext);
+
+ virtual void FillLayoutData() const override;
+ virtual const vcl::Font&
+ GetCanonicalFont( const StyleSettings& _rStyle ) const override;
+ virtual const Color&
+ GetCanonicalTextColor( const StyleSettings& _rStyle ) const override;
+
+public:
+ explicit FixedLine( vcl::Window* pParent, WinBits nStyle = WB_HORZ );
+
+ virtual void ApplySettings(vcl::RenderContext&) override;
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual Size GetOptimalSize() const override;
+ virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
+};
+
+class VCL_DLLPUBLIC FixedBitmap final : public Control
+{
+private:
+ BitmapEx maBitmap;
+
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
+ SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, const Point& rPos, const Size& rSize );
+
+public:
+ explicit FixedBitmap( vcl::Window* pParent, WinBits nStyle = 0 );
+
+ virtual void ApplySettings(vcl::RenderContext&) override;
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ void SetBitmap( const BitmapEx& rBitmap );
+};
+
+class VCL_DLLPUBLIC FixedImage : public Control
+{
+private:
+ Image maImage;
+
+private:
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
+
+protected:
+ SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev,
+ const Point& rPos, const Size& rSize );
+public:
+ explicit FixedImage( vcl::Window* pParent, WinBits nStyle = 0 );
+
+ virtual void ApplySettings(vcl::RenderContext&) override;
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual Size GetOptimalSize() const override;
+
+ void SetImage( const Image& rImage );
+ const Image& GetImage() const { return maImage; }
+
+ const Image& GetModeImage( ) const { return maImage;}
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+
+ static Image loadThemeImage(const OUString &rFileName);
+
+ void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/fixedhyper.hxx b/include/vcl/toolkit/fixedhyper.hxx
new file mode 100644
index 000000000..6abfa0ac3
--- /dev/null
+++ b/include/vcl/toolkit/fixedhyper.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/toolkit/fixed.hxx>
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) FixedHyperlink final : public FixedText
+{
+private:
+ tools::Long m_nTextLen;
+ PointerStyle m_aOldPointer;
+ Link<FixedHyperlink&,void> m_aClickHdl;
+ OUString m_sURL;
+
+ /** initializes the font (link color and underline).
+
+ Called by the Ctors.
+ */
+ void Initialize();
+
+ /** is position X position hitting text */
+ SAL_DLLPRIVATE bool ImplIsOverText(Point rPosition) const;
+
+ DECL_DLLPRIVATE_LINK(HandleClick, FixedHyperlink&, void);
+
+ /** overwrites Window::MouseMove().
+
+ Changes the pointer only over the text.
+ */
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+
+ /** overwrites Window::MouseButtonUp().
+
+ Calls the set link if the mouse is over the text.
+ */
+ virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
+
+ /** overwrites Window::RequestHelp().
+
+ Shows tooltip only if the mouse is over the text.
+ */
+ virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+
+public:
+ /** ctors
+
+ With WinBits.
+ */
+ FixedHyperlink( vcl::Window* pParent, WinBits nWinStyle = 0 );
+
+ /** overwrites Window::GetFocus().
+
+ Changes the color of the text and shows a focus rectangle.
+ */
+ virtual void GetFocus() override;
+
+ /** overwrites Window::LoseFocus().
+
+ Changes the color of the text and hides the focus rectangle.
+ */
+ virtual void LoseFocus() override;
+
+ /** overwrites Window::KeyInput().
+
+ KEY_RETURN and KEY_SPACE calls the link handler.
+ */
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+
+
+ /** sets m_aClickHdl with rLink.
+
+ m_aClickHdl is called if the text is clicked.
+ */
+ void SetClickHdl( const Link<FixedHyperlink&,void>& rLink ) { m_aClickHdl = rLink; }
+ const Link<FixedHyperlink&,void>& GetClickHdl() const { return m_aClickHdl; }
+
+ // ::FixedHyperbaseLink
+
+ /** sets the URL of the hyperlink and uses it as tooltip. */
+ void SetURL(const OUString& rNewURL);
+
+ /** returns the URL of the hyperlink.
+
+ @return
+ m_sURL
+ */
+ const OUString& GetURL() const { return m_sURL;}
+
+ /** sets new text and recalculates the text length. */
+ virtual void SetText(const OUString& rNewDescription) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/floatwin.hxx b/include/vcl/toolkit/floatwin.hxx
new file mode 100644
index 000000000..6799ac884
--- /dev/null
+++ b/include/vcl/toolkit/floatwin.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <vcl/dllapi.h>
+#include <vcl/syswin.hxx>
+#include <memory>
+#include <o3tl/typed_flags_set.hxx>
+
+class ToolBox;
+
+enum class FloatWinPopupEndFlags
+{
+ NONE = 0x00,
+ Cancel = 0x01,
+ TearOff = 0x02,
+ DontCallHdl = 0x04,
+ CloseAll = 0x08,
+ NoCloseChildren = 0x10,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<FloatWinPopupEndFlags> : is_typed_flags<FloatWinPopupEndFlags, 0x1f> {};
+}
+
+enum class FloatWinTitleType
+{
+ Unknown = 0,
+ Normal = 1,
+ TearOff = 2,
+ Popup = 3,
+ NONE = 4,
+};
+
+class VCL_DLLPUBLIC FloatingWindow : public SystemWindow
+{
+ class SAL_DLLPRIVATE ImplData;
+private:
+ VclPtr<FloatingWindow> mpNextFloat;
+ VclPtr<vcl::Window> mpFirstPopupModeWin;
+ VclPtr<vcl::Window> mxPrevFocusWin;
+ std::unique_ptr<ImplData> mpImplData;
+ tools::Rectangle maFloatRect;
+ ImplSVEvent * mnPostId;
+ FloatWinPopupFlags mnPopupModeFlags;
+ FloatWinTitleType mnTitle;
+ FloatWinTitleType mnOldTitle;
+ bool mbInPopupMode;
+ bool mbPopupMode;
+ bool mbPopupModeCanceled;
+ bool mbPopupModeTearOff;
+ bool mbMouseDown;
+ bool mbGrabFocus; // act as key input window, although focus is not set
+ bool mbInCleanUp;
+ Link<FloatingWindow*,void> maPopupModeEndHdl;
+
+ SAL_DLLPRIVATE void ImplCallPopupModeEnd();
+ DECL_DLLPRIVATE_LINK( ImplEndPopupModeHdl, void*, void );
+
+ FloatingWindow (const FloatingWindow &) = delete;
+ FloatingWindow & operator= (const FloatingWindow &) = delete;
+
+protected:
+ SAL_DLLPRIVATE void ImplInitFloating( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE void ImplInitSettings();
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+
+public:
+ SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( vcl::Window* pReference, const Point& rPos, bool& rbHitTestInsideRect );
+ SAL_DLLPRIVATE FloatingWindow* ImplFindLastLevelFloat();
+ SAL_DLLPRIVATE bool ImplIsFloatPopupModeWindow( const vcl::Window* pWindow );
+ SAL_DLLPRIVATE void ImplSetMouseDown() { mbMouseDown = true; }
+ SAL_DLLPRIVATE bool ImplIsMouseDown() const { return mbMouseDown; }
+ static Point ImplCalcPos(vcl::Window* pWindow,
+ const tools::Rectangle& rRect, FloatWinPopupFlags nFlags,
+ sal_uInt16& rArrangeIndex, Point* pLOKTwipsPos = nullptr);
+ static Point ImplConvertToAbsPos(vcl::Window* pReference, const Point& rPos);
+ static tools::Rectangle ImplConvertToAbsPos(vcl::Window* pReference, const tools::Rectangle& rRect);
+ static tools::Rectangle ImplConvertToRelPos(vcl::Window* pReference, const tools::Rectangle& rRect);
+ SAL_DLLPRIVATE void ImplEndPopupMode( FloatWinPopupEndFlags nFlags, const VclPtr<vcl::Window>& xFocusId );
+ SAL_DLLPRIVATE tools::Rectangle& ImplGetItemEdgeClipRect();
+ SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
+ virtual void doDeferredInit(WinBits nBits) override;
+ void PixelInvalidate(const tools::Rectangle* pRectangle) override;
+
+public:
+ explicit FloatingWindow(vcl::Window* pParent, WinBits nStyle);
+ explicit FloatingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
+ const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
+ virtual ~FloatingWindow() override;
+ virtual void dispose() override;
+
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual void PopupModeEnd();
+
+ void SetTitleType( FloatWinTitleType nTitle );
+ FloatWinTitleType GetTitleType() const { return mnTitle; }
+
+ void StartPopupMode( const tools::Rectangle& rRect, FloatWinPopupFlags nFlags );
+ void StartPopupMode( ToolBox* pBox, FloatWinPopupFlags nFlags );
+ void EndPopupMode( FloatWinPopupEndFlags nFlags = FloatWinPopupEndFlags::NONE );
+ void AddPopupModeWindow( vcl::Window* pWindow );
+ FloatWinPopupFlags GetPopupModeFlags() const { return mnPopupModeFlags; }
+ void SetPopupModeFlags( FloatWinPopupFlags nFlags ) { mnPopupModeFlags = nFlags; }
+ bool IsInPopupMode() const { return mbPopupMode; }
+ bool IsInCleanUp() const { return mbInCleanUp; }
+ bool IsPopupModeCanceled() const { return mbPopupModeCanceled; }
+ bool IsPopupModeTearOff() const { return mbPopupModeTearOff; }
+
+ void SetPopupModeEndHdl( const Link<FloatingWindow*,void>& rLink ) { maPopupModeEndHdl = rLink; }
+
+ bool GrabsFocus() const { return mbGrabFocus; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/fmtfield.hxx b/include/vcl/toolkit/fmtfield.hxx
new file mode 100644
index 000000000..56992ddb4
--- /dev/null
+++ b/include/vcl/toolkit/fmtfield.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <vcl/formatter.hxx>
+#include <vcl/toolkit/spinfld.hxx>
+
+class VCL_DLLPUBLIC FormattedField : public SpinField
+{
+public:
+ FormattedField(vcl::Window* pParent, WinBits nStyle);
+
+ virtual void dispose() override;
+
+ // Spin-Handling
+ virtual void Up() override;
+ virtual void Down() override;
+ // Default Implementation: +/- default spin size to the double value
+ virtual void First() override;
+ virtual void Last() override;
+ // Default Implementation: Current double is set to the first or last value
+
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+public:
+ virtual void SetText( const OUString& rStr ) override;
+ virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) override;
+
+ void SetValueFromString(const OUString& rStr); // currently used by online
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ Formatter& GetFormatter();
+ void SetFormatter(Formatter* pFormatter);
+
+protected:
+ std::unique_ptr<Formatter> m_xOwnFormatter;
+ Formatter* m_pFormatter;
+
+ virtual bool EventNotify(NotifyEvent& rNEvt) override;
+ virtual void Modify() override;
+
+ bool PreNotify(NotifyEvent& rNEvt) override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DoubleNumericField final : public FormattedField
+{
+public:
+ DoubleNumericField(vcl::Window* pParent, WinBits nStyle);
+
+ virtual ~DoubleNumericField() override;
+
+ validation::NumberValidator& GetNumberValidator() { return *m_pNumberValidator; }
+ void ResetConformanceTester();
+
+private:
+
+ std::unique_ptr<validation::NumberValidator> m_pNumberValidator;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DoubleCurrencyField final : public FormattedField
+{
+public:
+ DoubleCurrencyField(vcl::Window* pParent, WinBits nStyle);
+
+ const OUString& getCurrencySymbol() const { return m_sCurrencySymbol; }
+ void setCurrencySymbol(const OUString& rSymbol);
+
+ bool getPrependCurrSym() const { return m_bPrependCurrSym; }
+ void setPrependCurrSym(bool _bPrepend);
+
+ void UpdateCurrencyFormat();
+private:
+ OUString m_sCurrencySymbol;
+ bool m_bPrependCurrSym;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/group.hxx b/include/vcl/toolkit/group.hxx
new file mode 100644
index 000000000..81e595ec2
--- /dev/null
+++ b/include/vcl/toolkit/group.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/ctrl.hxx>
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) GroupBox final : public Control
+{
+private:
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
+ SAL_DLLPRIVATE void ImplInitSettings( bool bBackground );
+ SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, SystemTextColorFlags nSystemTextColorFlags,
+ const Point& rPos, const Size& rSize, bool bLayout = false );
+
+ virtual void FillLayoutData() const override;
+ virtual const vcl::Font&
+ GetCanonicalFont( const StyleSettings& _rStyle ) const override;
+ virtual const Color&
+ GetCanonicalTextColor( const StyleSettings& _rStyle ) const override;
+
+public:
+ explicit GroupBox( vcl::Window* pParent, WinBits nStyle );
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/imgctrl.hxx b/include/vcl/toolkit/imgctrl.hxx
new file mode 100644
index 000000000..20b1863a0
--- /dev/null
+++ b/include/vcl/toolkit/imgctrl.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/toolkit/fixed.hxx>
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) ImageControl : public FixedImage
+{
+private:
+ ::sal_Int16 mnScaleMode;
+
+public:
+ ImageControl( vcl::Window* pParent, WinBits nStyle );
+
+ // set/get the scale mode. This is one of the css.awt.ImageScaleMode constants
+ void SetScaleMode( const ::sal_Int16 _nMode );
+ ::sal_Int16 GetScaleMode() const { return mnScaleMode; }
+
+ virtual void Resize() override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos,SystemTextColorFlags nFlags ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+
+protected:
+ void ImplDraw( OutputDevice& rDev, const Point& rPos, const Size& rSize ) const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/ivctrl.hxx b/include/vcl/toolkit/ivctrl.hxx
new file mode 100644
index 000000000..502d16d09
--- /dev/null
+++ b/include/vcl/toolkit/ivctrl.hxx
@@ -0,0 +1,259 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <memory>
+#include <vcl/dllapi.h>
+#include <vcl/ctrl.hxx>
+#include <tools/link.hxx>
+#include <vcl/image.hxx>
+#include <o3tl/deleter.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+class SvxIconChoiceCtrl_Impl;
+
+enum class SvxIconViewFlags
+{
+ NONE = 0x0000,
+ POS_LOCKED = 0x0001,
+ SELECTED = 0x0002,
+ FOCUSED = 0x0004,
+ POS_MOVED = 0x0008, // Moved by Drag and Drop, but not logged
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvxIconViewFlags> : is_typed_flags<SvxIconViewFlags, 0x000f> {};
+}
+
+enum class SvxIconChoiceCtrlTextMode
+{
+ Full = 1, // Enlarge BoundRect southwards
+ Short // Shorten with "..."
+};
+
+enum class SvxIconChoiceCtrlPositionMode
+{
+ Free, // Free pixel-perfect positioning
+ AutoArrange, // Auto arrange
+};
+
+class SvxIconChoiceCtrlEntry
+{
+ Image aImage;
+
+ OUString aText;
+ OUString aQuickHelpText;
+
+ friend class SvxIconChoiceCtrl_Impl;
+ friend class IcnCursor_Impl;
+ friend class EntryList_Impl;
+ friend class IcnGridMap_Impl;
+
+ tools::Rectangle aRect; // Bounding-Rectangle of the entry
+ tools::Rectangle aGridRect; // Only valid in Grid-mode
+ sal_Int32 nPos;
+
+ /*
+ The insert position in the Insertlist is equal to the (sort) order stated at the Insert
+ (-> Order of the anchors in the anchors-list!). In "AutoArrange" mode the visible order
+ can differ. The entries will be linked because of this.
+ */
+ SvxIconChoiceCtrlEntry* pblink; // backward (linker neighbour)
+ SvxIconChoiceCtrlEntry* pflink; // forward (rechter neighbour)
+
+ SvxIconChoiceCtrlTextMode eTextMode;
+ sal_uInt16 nX,nY; // for keyboard control
+ SvxIconViewFlags nFlags;
+
+ void ClearFlags( SvxIconViewFlags nMask ) { nFlags &= ~nMask; }
+ void SetFlags( SvxIconViewFlags nMask ) { nFlags |= nMask; }
+ void AssignFlags( SvxIconViewFlags _nFlags ) { nFlags = _nFlags; }
+
+ // set left neighbour (A <-> B ==> A <-> this <-> B)
+ void SetBacklink( SvxIconChoiceCtrlEntry* pA )
+ {
+ pA->pflink->pblink = this; // X <- B
+ this->pflink = pA->pflink; // X -> B
+ this->pblink = pA; // A <- X
+ pA->pflink = this; // A -> X
+ }
+ // Unlink (A <-> this <-> B ==> A <-> B)
+ void Unlink()
+ {
+ this->pblink->pflink = this->pflink;
+ this->pflink->pblink = this->pblink;
+ this->pflink = nullptr;
+ this->pblink = nullptr;
+ }
+
+public:
+ SvxIconChoiceCtrlEntry( const OUString& rText, const Image& rImage );
+
+ const Image& GetImage () const { return aImage; }
+ void SetText ( const OUString& rText ) { aText = rText; }
+ const OUString& GetText () const { return aText; }
+ OUString VCL_DLLPUBLIC GetDisplayText() const;
+ void SetQuickHelpText( const OUString& rText ) { aQuickHelpText = rText; }
+ const OUString& GetQuickHelpText() const { return aQuickHelpText; }
+
+ SvxIconChoiceCtrlTextMode GetTextMode() const { return eTextMode; }
+ SvxIconViewFlags GetFlags() const { return nFlags; }
+ bool IsSelected() const { return bool(nFlags & SvxIconViewFlags::SELECTED); }
+ bool IsFocused() const { return bool(nFlags & SvxIconViewFlags::FOCUSED); }
+ bool IsPosLocked() const { return bool(nFlags & SvxIconViewFlags::POS_LOCKED); }
+};
+
+class SvxIconChoiceCtrlColumnInfo
+{
+ tools::Long nWidth;
+
+public:
+ SvxIconChoiceCtrlColumnInfo() :
+ nWidth( 100 ) {}
+ SvxIconChoiceCtrlColumnInfo( const SvxIconChoiceCtrlColumnInfo& );
+
+ void SetWidth( tools::Long nWd ) { nWidth = nWd; }
+ tools::Long GetWidth() const { return nWidth; }
+};
+
+
+/*
+ Window-Bits:
+ WB_ICON // Text beneath the icon
+ WB_SMALL_ICON // Text right to the icon, position does not mind
+ WB_DETAILS // Text right to the icon, limited positioning
+ WB_BORDER
+ WB_NOHIDESELECTION // Draw selection inactively, if not focused.
+ WB_NOHSCROLL
+ WB_NOVSCROLL
+ WB_NOSELECTION
+ WB_SMART_ARRANGE // Keep Visible-Area at arrange
+ WB_ALIGN_TOP // Align line vy line LTR
+ WB_ALIGN_LEFT // Align columns from top to bottom
+ WB_NODRAGSELECTION // No selection with tracking rectangle
+ WB_NOCOLUMNHEADER // No Headerbar in Details view (Headerbar not implemented)
+ WB_NOPOINTERFOCUS // No GrabFocus at MouseButtonDown
+ WB_HIGHLIGHTFRAME // The entry beneath the mouse will be highlighted
+ WB_NOASYNCSELECTHDL // Do not collect events -> Selection handlers will be called synchronously
+*/
+
+#define WB_ICON WB_RECTSTYLE
+#define WB_SMALLICON WB_SMALLSTYLE
+#define WB_DETAILS WB_VCENTER
+#define WB_NOHSCROLL WB_SPIN
+#define WB_NOVSCROLL WB_DRAG
+#define WB_NOSELECTION WB_REPEAT
+#define WB_NODRAGSELECTION WB_PATHELLIPSIS
+#define WB_SMART_ARRANGE 0x01000000 // used to be WB_PASSWORD
+#define WB_ALIGN_TOP WB_TOP
+#define WB_ALIGN_LEFT WB_LEFT
+#define WB_NOCOLUMNHEADER WB_CENTER
+#define WB_HIGHLIGHTFRAME WB_IGNORETAB
+#define WB_NOASYNCSELECTHDL WB_NOLABEL
+
+class MnemonicGenerator;
+
+class VCL_DLLPUBLIC SvtIconChoiceCtrl final : public Control
+{
+ friend class SvxIconChoiceCtrl_Impl;
+
+ Link<SvtIconChoiceCtrl*,void> _aClickIconHdl;
+ std::unique_ptr<SvxIconChoiceCtrl_Impl, o3tl::default_delete<SvxIconChoiceCtrl_Impl>> _pImpl;
+
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void Command( const CommandEvent& rCEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ virtual void Resize() override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ void ClickIcon();
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+ static void DrawEntryImage(
+ SvxIconChoiceCtrlEntry const * pEntry,
+ const Point& rPos,
+ OutputDevice& rDev );
+
+ static OUString GetEntryText( SvxIconChoiceCtrlEntry const * pEntry );
+
+ virtual void FillLayoutData() const override;
+
+ void CallImplEventListeners(VclEventId nEvent, void* pData);
+
+public:
+
+ SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle );
+ virtual ~SvtIconChoiceCtrl() override;
+ virtual void dispose() override;
+
+ WinBits GetStyle() const;
+ void SetSelectionMode(SelectionMode eMode);
+
+ void SetFont( const vcl::Font& rFont );
+ void SetPointFont( const vcl::Font& rFont );
+
+ void SetClickHdl( const Link<SvtIconChoiceCtrl*,void>& rLink ) { _aClickIconHdl = rLink; }
+
+ using Window::SetBackground;
+ void SetBackground( const Wallpaper& rWallpaper );
+
+ void ArrangeIcons();
+
+
+ SvxIconChoiceCtrlEntry* InsertEntry( const OUString& rText,
+ const Image& rImage);
+
+ void RemoveEntry(sal_Int32 nEntryListPos);
+
+ bool DoKeyInput( const KeyEvent& rKEvt );
+
+ sal_Int32 GetEntryCount() const;
+ SvxIconChoiceCtrlEntry* GetEntry( sal_Int32 nPos ) const;
+ sal_Int32 GetEntryListPos( SvxIconChoiceCtrlEntry const * pEntry ) const;
+ using Window::SetCursor;
+ void SetCursor( SvxIconChoiceCtrlEntry* pEntry );
+ SvxIconChoiceCtrlEntry* GetCursor() const;
+
+ // sal_uLong is the position of the selected element in the list
+ SvxIconChoiceCtrlEntry* GetSelectedEntry() const;
+
+#ifdef DBG_UTIL
+ void SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry );
+#endif
+
+ tools::Rectangle GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const;
+ tools::Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const;
+
+ void SetNoSelection();
+
+ // ACCESSIBILITY ==========================================================
+
+ /** Creates and returns the accessible object of the Box. */
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/longcurr.hxx b/include/vcl/toolkit/longcurr.hxx
new file mode 100644
index 000000000..3206f3980
--- /dev/null
+++ b/include/vcl/toolkit/longcurr.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <tools/bigint.hxx>
+#include <vcl/toolkit/field.hxx>
+
+class LocaleDataWrapper;
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) LongCurrencyFormatter : public FormatterBase
+{
+public:
+ virtual ~LongCurrencyFormatter() override;
+
+ virtual void Reformat() override;
+ virtual void ReformatAll() override;
+
+ OUString const & GetCurrencySymbol() const;
+
+ void SetDecimalDigits( sal_uInt16 nDigits );
+ sal_uInt16 GetDecimalDigits() const { return mnDecimalDigits;}
+ void SetValue(const BigInt& rNewValue);
+ void SetUserValue( BigInt nNewValue );
+ BigInt GetValue() const;
+
+protected:
+ BigInt mnLastValue;
+ BigInt mnMin;
+ BigInt mnMax;
+
+ LongCurrencyFormatter(Edit* pEdit);
+private:
+ friend bool ImplLongCurrencyReformat( const OUString&, BigInt const &, BigInt const &, sal_uInt16, const LocaleDataWrapper&, OUString&, LongCurrencyFormatter const & );
+ SAL_DLLPRIVATE void ImpInit();
+
+ sal_uInt16 mnDecimalDigits;
+
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) LongCurrencyBox final : public ComboBox, public LongCurrencyFormatter
+{
+public:
+ LongCurrencyBox( vcl::Window* pParent, WinBits nWinStyle );
+
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+
+ void Modify() override;
+ void ReformatAll() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/lstbox.hxx b/include/vcl/toolkit/lstbox.hxx
new file mode 100644
index 000000000..e3bcc1297
--- /dev/null
+++ b/include/vcl/toolkit/lstbox.hxx
@@ -0,0 +1,266 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/ctrl.hxx>
+
+class DataChangedEvent;
+class NotifyEvent;
+class UserDrawEvent;
+
+#define LISTBOX_APPEND (SAL_MAX_INT32)
+#define LISTBOX_ENTRY_NOTFOUND (SAL_MAX_INT32)
+#define LISTBOX_MAX_ENTRIES (SAL_MAX_INT32 - 1)
+
+// the following defines can be used for the SetEntryFlags()
+// and GetEntryFlags() methods
+
+// !! Do not use these flags for user data as they are reserved !!
+// !! to change the internal behaviour of the ListBox implementation !!
+// !! for specific entries. !!
+
+enum class ListBoxEntryFlags
+{
+ NONE = 0x0000,
+/** this flag disables a selection of an entry completely. It is not
+ possible to select such entries either from the user interface
+ nor from the ListBox methods. Cursor traveling is handled correctly.
+ This flag can be used to add titles to a ListBox.
+*/
+ DisableSelection = 0x0001,
+
+/** this flag can be used to make an entry multiline capable
+ A normal entry is single line and will therefore be clipped
+ at the right listbox border. Setting this flag enables
+ word breaks for the entry text.
+*/
+ MultiLine = 0x0002,
+
+/** this flags lets the item be drawn disabled (e.g. in grey text)
+ usage only guaranteed with ListBoxEntryFlags::DisableSelection
+*/
+ DrawDisabled = 0x0004,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ListBoxEntryFlags> : is_typed_flags<ListBoxEntryFlags, 0x0007> {};
+}
+
+class Image;
+class ImplListBox;
+class ImplListBoxFloatingWindow;
+class ImplBtn;
+class ImplWin;
+class ImplListBoxWindow;
+
+/// A widget used to choose from a list of items and which has no entry.
+class VCL_DLLPUBLIC ListBox : public Control
+{
+private:
+ VclPtr<ImplListBox> mpImplLB;
+ VclPtr<ImplListBoxFloatingWindow> mpFloatWin;
+ VclPtr<ImplWin> mpImplWin;
+ VclPtr<ImplBtn> mpBtn;
+ sal_uInt16 mnDDHeight;
+ sal_Int32 m_nMaxWidthChars;
+ Link<ListBox&,void> maSelectHdl;
+ sal_uInt16 mnLineCount;
+
+ bool mbDDAutoSize : 1;
+
+private:
+ SAL_DLLPRIVATE void ImplInitListBoxData();
+
+ DECL_DLLPRIVATE_LINK( ImplSelectHdl, LinkParamNone*, void );
+ DECL_DLLPRIVATE_LINK( ImplScrollHdl, ImplListBox*, void );
+ DECL_DLLPRIVATE_LINK( ImplCancelHdl, LinkParamNone*, void );
+ DECL_DLLPRIVATE_LINK( ImplDoubleClickHdl, ImplListBoxWindow*, void );
+ DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, FloatingWindow*, void );
+ DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, sal_Int32, void );
+ DECL_DLLPRIVATE_LINK( ImplFocusHdl, sal_Int32, void );
+ DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl, LinkParamNone*, void );
+
+ DECL_DLLPRIVATE_LINK( ImplClickBtnHdl, void*, void );
+
+protected:
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
+ bool IsDropDownBox() const { return mpFloatWin != nullptr; }
+
+protected:
+ explicit ListBox( WindowType nType );
+
+ virtual void FillLayoutData() const override;
+
+public:
+ explicit ListBox( vcl::Window* pParent, WinBits nStyle = WB_BORDER );
+ virtual ~ListBox() override;
+ virtual void dispose() override;
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ void Select();
+ void DoubleClick();
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+
+ virtual const Wallpaper& GetDisplayBackground() const override;
+
+ virtual void setPosSizePixel( tools::Long nX, tools::Long nY,
+ tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags = PosSizeFlags::All ) override;
+
+ tools::Rectangle GetDropDownPosSizePixel() const;
+
+ void AdaptDropDownLineCountToMaximum();
+ void SetDropDownLineCount( sal_uInt16 nLines );
+ sal_uInt16 GetDropDownLineCount() const;
+
+ void EnableAutoSize( bool bAuto );
+ bool IsAutoSizeEnabled() const { return mbDDAutoSize; }
+
+ sal_Int32 InsertEntry( const OUString& rStr, sal_Int32 nPos = LISTBOX_APPEND );
+ sal_Int32 InsertEntry( const OUString& rStr, const Image& rImage, sal_Int32 nPos = LISTBOX_APPEND );
+ void RemoveEntry( sal_Int32 nPos );
+
+ void Clear();
+
+ sal_Int32 GetEntryPos( std::u16string_view rStr ) const;
+ Image GetEntryImage( sal_Int32 nPos ) const;
+ OUString GetEntry( sal_Int32 nPos ) const;
+ sal_Int32 GetEntryCount() const;
+
+ void SelectEntry( std::u16string_view rStr, bool bSelect = true );
+ void SelectEntryPos( sal_Int32 nPos, bool bSelect = true );
+ void SelectEntriesPos( const std::vector<sal_Int32>& rPositions, bool bSelect = true );
+
+ sal_Int32 GetSelectedEntryCount() const;
+ OUString GetSelectedEntry( sal_Int32 nSelIndex = 0 ) const;
+ sal_Int32 GetSelectedEntryPos( sal_Int32 nSelIndex = 0 ) const;
+
+ bool IsEntryPosSelected( sal_Int32 nPos ) const;
+ void SetNoSelection();
+
+ void SetEntryData( sal_Int32 nPos, void* pNewData );
+ void* GetEntryData( sal_Int32 nPos ) const;
+
+ /** this methods stores a combination of flags from the
+ ListBoxEntryFlags::* defines at the given entry.
+ See description of the possible ListBoxEntryFlags::* flags
+ for details.
+ Do not use these flags for user data as they are reserved
+ to change the internal behaviour of the ListBox implementation
+ for specific entries.
+ */
+ void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
+
+ void SetTopEntry( sal_Int32 nPos );
+ sal_Int32 GetTopEntry() const;
+
+ /**
+ * Removes existing separators, and sets the position of the
+ * one and only separator.
+ */
+ void SetSeparatorPos( sal_Int32 n );
+ /**
+ * Gets the position of the separator which was added first.
+ * Returns LISTBOX_ENTRY_NOTFOUND if there is no separator.
+ */
+ sal_Int32 GetSeparatorPos() const;
+
+ /**
+ * Adds a new separator at the given position n.
+ */
+ void AddSeparator( sal_Int32 n );
+
+ bool IsTravelSelect() const;
+ bool IsInDropDown() const;
+ void ToggleDropDown();
+
+ void EnableMultiSelection( bool bMulti );
+ bool IsMultiSelectionEnabled() const;
+
+ void SetReadOnly( bool bReadOnly = true );
+ bool IsReadOnly() const;
+
+ tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const;
+
+ void SetSelectHdl( const Link<ListBox&,void>& rLink ) { maSelectHdl = rLink; }
+
+ Size CalcSubEditSize() const; //size of area inside lstbox, i.e. no scrollbar/dropdown
+ Size CalcMinimumSize() const; //size of lstbox area, i.e. including scrollbar/dropdown
+ virtual Size GetOptimalSize() const override;
+ Size CalcAdjustedSize( const Size& rPrefSize ) const;
+ Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
+ void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
+
+ sal_uInt16 GetDisplayLineCount() const;
+
+ /** checks whether a certain point lies within the bounds of
+ a listbox item and returns the item as well as the character position
+ the point is at.
+
+ <p>If the point is inside an item the item pos is put into <code>rPos</code> and
+ the item-relative character index is returned. If the point is not inside
+ an item -1 is returned and rPos is unchanged.</p>
+
+ @param rPoint
+ tells the point for which an item is requested.
+
+ @param rPos
+ gets the item at the specified point <code>rPoint</code>
+
+ @returns
+ the item-relative character index at point <code>rPos</code> or -1
+ if no item is at that point.
+ */
+ using Control::GetIndexForPoint;
+ tools::Long GetIndexForPoint( const Point& rPoint, sal_Int32 & rPos ) const;
+
+ void setMaxWidthChars(sal_Int32 nWidth);
+
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MultiListBox final : public ListBox
+{
+public:
+ explicit MultiListBox( vcl::Window* pParent, WinBits nStyle );
+
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/menubtn.hxx b/include/vcl/toolkit/menubtn.hxx
new file mode 100644
index 000000000..ca77a48c9
--- /dev/null
+++ b/include/vcl/toolkit/menubtn.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/toolkit/button.hxx>
+#include <vcl/dllapi.h>
+#include <memory>
+
+class Timer;
+class PopupMenu;
+
+class VCL_DLLPUBLIC MenuButton : public PushButton
+{
+private:
+ friend class VclBuilder;
+
+ std::unique_ptr<Timer> mpMenuTimer;
+ VclPtr<PopupMenu> mpMenu;
+ VclPtr<Window> mpFloatingWindow;
+ OString msCurItemIdent;
+ sal_uInt16 mnCurItemId;
+ bool mbDelayMenu;
+ bool mbStartingMenu;
+ Link<MenuButton*,void> maActivateHdl;
+ Link<MenuButton*,void> maSelectHdl;
+
+ DECL_DLLPRIVATE_LINK( ImplMenuTimeoutHdl, Timer*, void );
+
+ MenuButton( const MenuButton & ) = delete;
+ MenuButton& operator=( const MenuButton & ) = delete;
+
+protected:
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+
+public:
+ explicit MenuButton( vcl::Window* pParent, WinBits nStyle = 0 );
+ virtual ~MenuButton() override;
+ virtual void dispose() override;
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+
+ virtual void Activate() override;
+ void Select();
+
+ void ExecuteMenu();
+ bool InPopupMode() const;
+ void CancelMenu();
+
+ //if false then the whole button launches the menu
+ //if true, then the button has a separator
+ //where the right portion launches the menu immediately
+ //where the left portion activates the underlying Button handlers
+ //before launching the menu in an idle, allowing it to be cancelled
+ //before being shown
+ void SetDelayMenu(bool bDelay) { mbDelayMenu = bDelay; }
+
+ void SetPopupMenu(PopupMenu* pNewMenu);
+ PopupMenu* GetPopupMenu() const { return mpMenu; }
+
+ void SetPopover(Window* pWindow);
+ Window* GetPopover() { return mpFloatingWindow.get(); }
+
+ OString const & GetCurItemIdent() const { return msCurItemIdent; }
+
+ void SetActivateHdl( const Link<MenuButton *, void>& rLink ) { maActivateHdl = rLink; }
+ void SetSelectHdl( const Link<MenuButton *, void>& rLink ) { maSelectHdl = rLink; }
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ void SetCurItemId();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/morebtn.hxx b/include/vcl/toolkit/morebtn.hxx
new file mode 100644
index 000000000..ca2a4b21d
--- /dev/null
+++ b/include/vcl/toolkit/morebtn.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/toolkit/button.hxx>
+#include <memory>
+
+struct ImplMoreButtonData;
+
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MoreButton final : public PushButton
+{
+ std::unique_ptr<ImplMoreButtonData> mpMBData;
+ bool mbState;
+
+ MoreButton( const MoreButton & ) = delete;
+ MoreButton& operator=( const MoreButton & ) = delete;
+ SAL_DLLPRIVATE void ShowState();
+
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+
+public:
+ explicit MoreButton( vcl::Window* pParent, WinBits nStyle );
+ virtual ~MoreButton() override;
+ virtual void dispose() override;
+
+ void Click() override;
+
+ using PushButton::SetState;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/prgsbar.hxx b/include/vcl/toolkit/prgsbar.hxx
new file mode 100644
index 000000000..dd9423178
--- /dev/null
+++ b/include/vcl/toolkit/prgsbar.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/window.hxx>
+
+/*************************************************************************
+ *
+ * class ProgressBar
+ *
+ * this class is used to display the ProgressBar
+ *
+ * -----------------------------------------------------------------------
+ *
+ * WinBits
+ *
+ * WB_BORDER border around the window
+ * WB_3DLOOK 3D representation
+ *
+ * -----------------------------------------------------------------------
+ *
+ * Methods
+ *
+ * Use SetValue() to set a percentage between 0 and 100. A value larger
+ * than 100 will cause the last rectangle to start flashing
+ *
+ ************************************************************************/
+
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) ProgressBar final : public vcl::Window
+{
+private:
+ Point maPos;
+ tools::Long mnPrgsWidth;
+ tools::Long mnPrgsHeight;
+ sal_uInt16 mnPercent;
+ sal_uInt16 mnPercentCount;
+ bool mbCalcNew;
+
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit();
+ SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
+ SAL_DLLPRIVATE void ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt16 nNewPerc);
+
+public:
+ ProgressBar( vcl::Window* pParent, WinBits nWinBits );
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual Size GetOptimalSize() const override;
+
+ void SetValue( sal_uInt16 nNewPercent );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/roadmap.hxx b/include/vcl/toolkit/roadmap.hxx
new file mode 100644
index 000000000..ef1cec250
--- /dev/null
+++ b/include/vcl/toolkit/roadmap.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/ctrl.hxx>
+#include <vcl/toolkit/imgctrl.hxx>
+#include <memory>
+
+class Bitmap;
+
+namespace vcl
+{
+
+struct RoadmapTypes
+{
+public:
+ typedef sal_Int16 ItemId;
+ typedef sal_Int32 ItemIndex;
+};
+
+class HyperLabel;
+class RoadmapImpl;
+class RoadmapItem;
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) ORoadmap final : public Control, public RoadmapTypes
+{
+public:
+ ORoadmap( vcl::Window* _pParent, WinBits _nWinStyle );
+ virtual ~ORoadmap( ) override;
+ virtual void dispose() override;
+
+ void SetRoadmapBitmap( const BitmapEx& maBitmap );
+
+ void EnableRoadmapItem( ItemId _nItemId, bool _bEnable );
+
+ void ChangeRoadmapItemLabel( ItemId _nID, const OUString& sLabel );
+ void ChangeRoadmapItemID( ItemId _nID, ItemId NewID );
+
+ void SetRoadmapInteractive( bool _bInteractive );
+ bool IsRoadmapInteractive() const;
+
+ void SetRoadmapComplete( bool _bComplete );
+ bool IsRoadmapComplete() const;
+
+ ItemIndex GetItemCount() const;
+ ItemId GetItemID( ItemIndex _nIndex ) const;
+
+ void InsertRoadmapItem( ItemIndex Index, const OUString& RoadmapItem, ItemId _nUniqueId, bool _bEnabled );
+ void ReplaceRoadmapItem( ItemIndex Index, const OUString& RoadmapItem, ItemId _nUniqueId, bool _bEnabled );
+ void DeleteRoadmapItem( ItemIndex _nIndex );
+
+ ItemId GetCurrentRoadmapItemID() const;
+ bool SelectRoadmapItemByID(ItemId nItemID, bool bGrabFocus = true);
+
+ void SetItemSelectHdl( const Link<LinkParamNone*,void>& _rHdl );
+ Link<LinkParamNone*,void> const & GetItemSelectHdl( ) const;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual void GetFocus() override;
+ virtual void ApplySettings( vcl::RenderContext& rRenderContext ) override;
+
+private:
+ bool PreNotify( NotifyEvent& rNEvt ) override;
+
+ /// called when an item has been selected by any means
+ void Select();
+
+ DECL_DLLPRIVATE_LINK(ImplClickHdl, HyperLabel*, void);
+
+ RoadmapItem* GetByIndex( ItemIndex _nItemIndex );
+ const RoadmapItem* GetByIndex( ItemIndex _nItemIndex ) const;
+
+ RoadmapItem* GetByID( ItemId _nID );
+ const RoadmapItem* GetByID( ItemId _nID ) const;
+ RoadmapItem* GetPreviousHyperLabel( ItemIndex Index);
+
+ void DrawHeadline(vcl::RenderContext& rRenderContext);
+ void DeselectOldRoadmapItems();
+ ItemId GetNextAvailableItemId( ItemIndex NewIndex );
+ ItemId GetPreviousAvailableItemId( ItemIndex NewIndex );
+ RoadmapItem* GetByPointer(vcl::Window const * pWindow);
+ RoadmapItem* InsertHyperLabel( ItemIndex Index, const OUString& _aStr, ItemId RMID, bool _bEnabled, bool _bIncomplete );
+ void UpdatefollowingHyperLabels( ItemIndex Index );
+
+ // Window overridables
+ void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& _rRect) override;
+ void implInit(vcl::RenderContext& rRenderContext);
+
+ std::unique_ptr<RoadmapImpl> m_pImpl;
+};
+
+} // namespace vcl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/spin.hxx b/include/vcl/toolkit/spin.hxx
new file mode 100644
index 000000000..bc1e14109
--- /dev/null
+++ b/include/vcl/toolkit/spin.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/ctrl.hxx>
+#include <vcl/timer.hxx>
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) SpinButton final : public Control
+{
+private:
+ AutoTimer maRepeatTimer;
+ tools::Rectangle maUpperRect;
+ tools::Rectangle maLowerRect;
+ tools::Rectangle maFocusRect;
+ bool mbRepeat : 1;
+ bool mbUpperIn : 1;
+ bool mbLowerIn : 1;
+ bool mbInitialUp : 1;
+ bool mbInitialDown : 1;
+ bool mbHorz : 1;
+ bool mbUpperIsFocused : 1;
+ tools::Long mnMinRange;
+ tools::Long mnMaxRange;
+ tools::Long mnValue;
+ tools::Long mnValueStep;
+
+ SAL_DLLPRIVATE tools::Rectangle* ImplFindPartRect( const Point& rPt );
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+ DECL_DLLPRIVATE_LINK( ImplTimeout, Timer*, void );
+
+public:
+ explicit SpinButton( vcl::Window* pParent, WinBits nStyle );
+
+ void Up();
+ void Down();
+
+ virtual void Resize() override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+
+ void SetRangeMin( tools::Long nNewRange );
+ tools::Long GetRangeMin() const { return mnMinRange; }
+ void SetRangeMax( tools::Long nNewRange );
+ tools::Long GetRangeMax() const { return mnMaxRange; }
+ void SetRange( const Range& rRange );
+ void SetValue( tools::Long nValue );
+ tools::Long GetValue() const { return mnValue; }
+ void SetValueStep( tools::Long nNewStep ) { mnValueStep = nNewStep; }
+ tools::Long GetValueStep() const { return mnValueStep; }
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+
+private:
+ // moves the focus to the upper or lower rect. Return sal_True if the focus rect actually changed.
+ SAL_DLLPRIVATE bool ImplMoveFocus( bool _bUpper );
+ SAL_DLLPRIVATE void ImplCalcFocusRect( bool _bUpper );
+
+ SAL_DLLPRIVATE bool ImplIsUpperEnabled( ) const
+ {
+ return mnValue + mnValueStep <= mnMaxRange;
+ }
+ SAL_DLLPRIVATE bool ImplIsLowerEnabled( ) const
+ {
+ return mnValue >= mnMinRange + mnValueStep;
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/spinfld.hxx b/include/vcl/toolkit/spinfld.hxx
new file mode 100644
index 000000000..d82348bd4
--- /dev/null
+++ b/include/vcl/toolkit/spinfld.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <vcl/dllapi.h>
+#include <vcl/toolkit/edit.hxx>
+#include <vcl/timer.hxx>
+
+class VCL_DLLPUBLIC SpinField : public Edit
+{
+public:
+ explicit SpinField( vcl::Window* pParent, WinBits nWinStyle, WindowType nType = WindowType::SPINFIELD );
+ virtual ~SpinField() override;
+ virtual void dispose() override;
+
+ virtual bool ShowDropDown( bool bShow );
+
+ virtual void Up();
+ virtual void Down();
+ virtual void First();
+ virtual void Last();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Draw( OutputDevice* pDev, const Point& rPos,SystemTextColorFlags nFlags ) override;
+ virtual void Resize() override;
+ virtual void StateChanged( StateChangedType nType ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+
+ void SetUpHdl( const Link<SpinField&,void>& rLink ) { maUpHdlLink = rLink; }
+ void SetDownHdl( const Link<SpinField&,void>& rLink ) { maDownHdlLink = rLink; }
+
+ virtual Size CalcMinimumSize() const override;
+ virtual Size CalcMinimumSizeForText(const OUString &rString) const override;
+ virtual Size GetOptimalSize() const override;
+ virtual Size CalcSize(sal_Int32 nChars) const override;
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ SAL_DLLPRIVATE void SetUpperEnabled(bool bEnabled);
+ SAL_DLLPRIVATE void SetLowerEnabled(bool bEnabled);
+ SAL_DLLPRIVATE bool IsUpperEnabled() const { return mbUpperEnabled; }
+ SAL_DLLPRIVATE bool IsLowerEnabled() const { return mbLowerEnabled; }
+
+protected:
+ tools::Rectangle maUpperRect;
+ tools::Rectangle maLowerRect;
+ tools::Rectangle maDropDownRect; // not yet attached ...
+
+ using Window::ImplInit;
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
+
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+
+ void EndDropDown();
+
+ virtual void FillLayoutData() const override;
+ tools::Rectangle * ImplFindPartRect( const Point& rPt );
+
+private:
+ DECL_DLLPRIVATE_LINK( ImplTimeout, Timer*, void );
+ SAL_DLLPRIVATE void ImplInitSpinFieldData();
+ SAL_DLLPRIVATE void ImplCalcButtonAreas( const OutputDevice* pDev, const Size& rOutSz, tools::Rectangle& rDDArea, tools::Rectangle& rSpinUpArea, tools::Rectangle& rSpinDownArea );
+
+ VclPtr<Edit> mpEdit;
+ AutoTimer maRepeatTimer;
+ Link<SpinField&,void> maUpHdlLink;
+ Link<SpinField&,void> maDownHdlLink;
+ bool mbRepeat:1,
+ mbSpin:1,
+ mbInitialUp:1,
+ mbInitialDown:1,
+ mbUpperIn:1,
+ mbLowerIn:1,
+ mbInDropDown:1,
+ mbUpperEnabled:1,
+ mbLowerEnabled:1;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/svlbitm.hxx b/include/vcl/toolkit/svlbitm.hxx
new file mode 100644
index 000000000..f02c4125a
--- /dev/null
+++ b/include/vcl/toolkit/svlbitm.hxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <memory>
+#include <vcl/dllapi.h>
+#include <tools/link.hxx>
+#include <vcl/image.hxx>
+#include <vcl/toolkit/treelistbox.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+class SvTreeListEntry;
+class SvLBoxButton;
+
+
+enum class SvBmp
+{
+ UNCHECKED = 0,
+ CHECKED = 1,
+ TRISTATE = 2,
+ HIUNCHECKED = 3,
+ HICHECKED = 4,
+ HITRISTATE = 5
+};
+
+enum class SvItemStateFlags
+{
+ NONE = 0x00,
+ UNCHECKED = 0x01,
+ CHECKED = 0x02,
+ TRISTATE = 0x04,
+ HILIGHTED = 0x08
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvItemStateFlags> : is_typed_flags<SvItemStateFlags, 0x0f> {};
+}
+
+struct SvLBoxButtonData_Impl;
+
+class SvLBoxButtonData
+{
+private:
+ Link<SvLBoxButtonData*,void> aLink;
+ tools::Long nWidth;
+ tools::Long nHeight;
+ std::unique_ptr<SvLBoxButtonData_Impl> pImpl;
+ bool bDataOk;
+ std::vector<Image> aBmps; // indices s. constants BMP_...
+
+ void SetWidthAndHeight();
+ void InitData( bool _bRadioBtn, const Control* pControlForSettings );
+public:
+ // include creating default images (CheckBox or RadioButton)
+ SvLBoxButtonData( const Control* pControlForSettings, bool _bRadioBtn );
+
+ ~SvLBoxButtonData();
+
+ static SvBmp GetIndex( SvItemStateFlags nItemState );
+ tools::Long Width();
+ tools::Long Height();
+ void SetLink( const Link<SvLBoxButtonData*,void>& rLink) { aLink=rLink; }
+ bool IsRadio() const;
+ // as buttons are not derived from LinkHdl
+ void CallLink();
+
+ void StoreButtonState(SvTreeListEntry* pActEntry, SvLBoxButton* pActBox);
+ static SvButtonState ConvertToButtonState( SvItemStateFlags nItemFlags );
+
+ SvTreeListEntry* GetActEntry() const;
+ SvLBoxButton* GetActBox() const;
+
+ void SetImage(SvBmp nIndex, const Image& aImage) { aBmps[static_cast<int>(nIndex)] = aImage; }
+ Image& GetImage(SvBmp nIndex) { return aBmps[static_cast<int>(nIndex)]; }
+
+ void SetDefaultImages( const Control* pControlForSettings );
+ // set images according to the color scheme of the Control
+ // pControlForSettings == NULL: settings are taken from Application
+ bool HasDefaultImages() const;
+};
+
+// **********************************************************************
+
+class VCL_DLLPUBLIC SvLBoxString : public SvLBoxItem
+{
+private:
+ bool mbEmphasized;
+ bool mbCustom;
+ double mfAlign;
+protected:
+ OUString maText;
+
+public:
+ SvLBoxString(const OUString& rText);
+ SvLBoxString();
+ virtual ~SvLBoxString() override;
+
+ virtual SvLBoxItemType GetType() const override;
+ virtual void InitViewData(SvTreeListBox* pView,
+ SvTreeListEntry* pEntry,
+ SvViewDataItem* pViewData = nullptr) override;
+
+ virtual int CalcWidth(const SvTreeListBox* pView) const override;
+
+ void Align(double fAlign) { mfAlign = fAlign; }
+
+ void Emphasize(bool bEmphasize) { mbEmphasized = bEmphasize; }
+ bool IsEmphasized() const { return mbEmphasized; }
+
+ void SetCustomRender() { mbCustom = true; }
+
+ const OUString& GetText() const
+ {
+ return maText;
+ }
+ void SetText(const OUString& rText)
+ {
+ maText = rText;
+ }
+
+ virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev,
+ vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView,
+ const SvTreeListEntry& rEntry) override;
+
+ virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const override;
+};
+
+class SvLBoxButton final : public SvLBoxItem
+{
+ bool isVis;
+ SvLBoxButtonData* pData;
+ SvItemStateFlags nItemFlags;
+
+ static void ImplAdjustBoxSize( Size& io_rCtrlSize, ControlType i_eType, vcl::RenderContext const & pRenderContext);
+public:
+ // An SvLBoxButton can be of two different kinds: an
+ // enabled checkbox (the normal kind), or a static image
+ // (see SV_BMP_STATICIMAGE; nFlags are effectively ignored
+ // for that kind).
+ SvLBoxButton( SvLBoxButtonData* pBData );
+ SvLBoxButton();
+ virtual ~SvLBoxButton() override;
+ virtual void InitViewData(SvTreeListBox* pView,
+ SvTreeListEntry* pEntry,
+ SvViewDataItem* pViewData = nullptr) override;
+
+ virtual SvLBoxItemType GetType() const override;
+ void ClickHdl( SvTreeListEntry* );
+
+ virtual void Paint(const Point& rPos,
+ SvTreeListBox& rOutDev,
+ vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView,
+ const SvTreeListEntry& rEntry) override;
+
+ virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const override;
+
+ SvItemStateFlags GetButtonFlags() const
+ {
+ return nItemFlags;
+ }
+ bool IsStateChecked() const
+ {
+ return bool(nItemFlags & SvItemStateFlags::CHECKED);
+ }
+ bool IsStateUnchecked() const
+ {
+ return bool(nItemFlags & SvItemStateFlags::UNCHECKED);
+ }
+ bool IsStateTristate() const
+ {
+ return bool(nItemFlags & SvItemStateFlags::TRISTATE);
+ }
+ bool IsStateHilighted() const
+ {
+ return bool(nItemFlags & SvItemStateFlags::HILIGHTED);
+ }
+ void SetStateChecked();
+ void SetStateUnchecked();
+ void SetStateTristate();
+ void SetStateHilighted(bool bHilight);
+};
+
+inline void SvLBoxButton::SetStateChecked()
+{
+ nItemFlags &= SvItemStateFlags::HILIGHTED;
+ nItemFlags |= SvItemStateFlags::CHECKED;
+}
+
+inline void SvLBoxButton::SetStateUnchecked()
+{
+ nItemFlags &= SvItemStateFlags::HILIGHTED;
+ nItemFlags |= SvItemStateFlags::UNCHECKED;
+}
+inline void SvLBoxButton::SetStateTristate()
+{
+ nItemFlags &= SvItemStateFlags::HILIGHTED;
+ nItemFlags |= SvItemStateFlags::TRISTATE;
+}
+inline void SvLBoxButton::SetStateHilighted( bool bHilight )
+{
+ if ( bHilight )
+ nItemFlags |= SvItemStateFlags::HILIGHTED;
+ else
+ nItemFlags &= ~SvItemStateFlags::HILIGHTED;
+}
+
+struct SvLBoxContextBmp_Impl;
+
+class VCL_DLLPUBLIC SvLBoxContextBmp : public SvLBoxItem
+{
+ std::unique_ptr<SvLBoxContextBmp_Impl> m_pImpl;
+public:
+ SvLBoxContextBmp(const Image& aBmp1,
+ const Image& aBmp2,
+ bool bExpanded);
+ SvLBoxContextBmp();
+ virtual ~SvLBoxContextBmp() override;
+
+ virtual SvLBoxItemType GetType() const override;
+ virtual void InitViewData(SvTreeListBox* pView,
+ SvTreeListEntry* pEntry,
+ SvViewDataItem* pViewData = nullptr) override;
+ virtual void Paint(const Point& rPos,
+ SvTreeListBox& rOutDev,
+ vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView,
+ const SvTreeListEntry& rEntry) override;
+
+ virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const override;
+
+ void SetModeImages(const Image& rBitmap1, const Image& rBitmap2);
+
+ inline void SetBitmap1(const Image& rImage);
+ inline void SetBitmap2(const Image& rImage);
+ inline const Image& GetBitmap1() const;
+ inline const Image& GetBitmap2() const;
+
+private:
+ Image& implGetImageStore(bool bFirst);
+};
+
+inline void SvLBoxContextBmp::SetBitmap1(const Image& _rImage)
+{
+ implGetImageStore(true) = _rImage;
+}
+
+inline void SvLBoxContextBmp::SetBitmap2(const Image& _rImage)
+{
+ implGetImageStore(false) = _rImage;
+}
+
+inline const Image& SvLBoxContextBmp::GetBitmap1() const
+{
+ Image& rImage = const_cast<SvLBoxContextBmp*>(this)->implGetImageStore(true);
+ return rImage;
+}
+
+inline const Image& SvLBoxContextBmp::GetBitmap2() const
+{
+ Image& rImage = const_cast<SvLBoxContextBmp*>(this)->implGetImageStore(false);
+ return rImage;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx
new file mode 100644
index 000000000..5d54cb1a0
--- /dev/null
+++ b/include/vcl/toolkit/svtabbx.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <vcl/dllapi.h>
+#include <vcl/toolkit/treelistbox.hxx>
+#include <vcl/accessibletableprovider.hxx>
+
+#include <tools/debug.hxx>
+
+#include <memory>
+#include <vector>
+
+enum class SvTabJustify
+{
+ AdjustRight = static_cast<int>(SvLBoxTabFlags::ADJUST_RIGHT),
+ AdjustLeft = static_cast<int>(SvLBoxTabFlags::ADJUST_LEFT),
+ AdjustCenter = static_cast<int>(SvLBoxTabFlags::ADJUST_CENTER)
+};
+
+class VCL_DLLPUBLIC SvTabListBox : public SvTreeListBox
+{
+private:
+ std::vector<SvLBoxTab> mvTabList;
+ OUString aCurEntry;
+
+protected:
+ static std::u16string_view GetToken( std::u16string_view sStr, sal_Int32 &nIndex );
+
+ virtual void SetTabs() override;
+ virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&) override;
+
+ OUString GetTabEntryText( sal_uInt32 nPos, sal_uInt16 nCol ) const;
+ SvTreeListEntry* GetEntryOnPos( sal_uInt32 _nEntryPos ) const;
+ SvTreeListEntry* GetChildOnPos( SvTreeListEntry* _pParent, sal_uInt32 _nEntryPos, sal_uInt32& _rPos ) const;
+
+public:
+ SvTabListBox( vcl::Window* pParent, WinBits );
+ virtual ~SvTabListBox() override;
+ virtual void dispose() override;
+ void SetTabs(sal_uInt16 nTabs, tools::Long const pTabPositions[], MapUnit = MapUnit::MapAppFont);
+ using SvTreeListBox::GetTab;
+ tools::Long GetLogicTab( sal_uInt16 nTab );
+
+ virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = nullptr,
+ bool bChildrenOnDemand = false,
+ sal_uInt32 nPos=TREELIST_APPEND, void* pUserData = nullptr ) override;
+
+ virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
+ sal_uInt32 nPos, sal_uInt16 nCol, void* pUserData = nullptr );
+
+ virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const override;
+ static OUString GetEntryText( const SvTreeListEntry*, sal_uInt16 nCol );
+ OUString GetEntryText( sal_uInt32 nPos, sal_uInt16 nCol = 0xffff ) const;
+ using SvTreeListBox::SetEntryText;
+ OUString GetCellText( sal_uInt32 nPos, sal_uInt16 nCol ) const;
+ sal_uInt32 GetEntryPos( const SvTreeListEntry* pEntry ) const;
+
+ void SetTabJustify( sal_uInt16 nTab, SvTabJustify );
+ void SetTabEditable( sal_uInt16 nTab, bool bEditable );
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
+};
+
+// class SvHeaderTabListBox ---------------------------------------------------
+
+class HeaderBar;
+namespace vcl {
+ struct SvHeaderTabListBoxImpl;
+}
+
+class VCL_DLLPUBLIC SvHeaderTabListBox : public SvTabListBox, public vcl::IAccessibleTableProvider
+{
+private:
+ typedef ::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren;
+
+ bool m_bFirstPaint;
+ std::unique_ptr<::vcl::SvHeaderTabListBoxImpl> m_pImpl;
+ ::vcl::IAccessibleTabListBox* m_pAccessible;
+ AccessibleChildren m_aAccessibleChildren;
+
+ DECL_DLLPRIVATE_LINK( ScrollHdl_Impl, SvTreeListBox*, void );
+ DECL_DLLPRIVATE_LINK( CreateAccessibleHdl_Impl, HeaderBar*, void );
+
+ void RecalculateAccessibleChildren();
+
+public:
+ SvHeaderTabListBox( vcl::Window* pParent, WinBits nBits );
+ virtual ~SvHeaderTabListBox() override;
+ virtual void dispose() override;
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
+
+ void InitHeaderBar(HeaderBar* pHeaderBar);
+ HeaderBar* GetHeaderBar();
+ static bool IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol );
+
+ virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
+ sal_uInt32 nPos, sal_uInt16 nCol, void* pUserData = nullptr ) override;
+ virtual sal_uInt32 Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uInt32 nPos=TREELIST_APPEND) override;
+ virtual sal_uInt32 Insert( SvTreeListEntry* pEntry, sal_uInt32 nRootPos = TREELIST_APPEND ) override;
+
+ // Accessible -------------------------------------------------------------
+
+ bool IsCellCheckBox( sal_Int32 _nRow, sal_uInt16 _nColumn, TriState& _rState ) const;
+
+ /** @return The count of the rows. */
+ virtual sal_Int32 GetRowCount() const override;
+ /** @return The count of the columns. */
+ virtual sal_uInt16 GetColumnCount() const override;
+
+ /** @return The position of the current row. */
+ virtual sal_Int32 GetCurrRow() const override;
+ /** @return The position of the current column. */
+ virtual sal_uInt16 GetCurrColumn() const override;
+
+ /** @return The description of a row.
+ @param _nRow The row which description is in demand. */
+ virtual OUString GetRowDescription( sal_Int32 _nRow ) const override;
+ /** @return The description of a column.
+ @param _nColumn The column which description is in demand. */
+ virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const override;
+
+ /** @return <TRUE/>, if the object has a row header. */
+ virtual bool HasRowHeader() const override; //GetColumnId
+ /** @return <TRUE/>, if the object can focus a cell. */
+ virtual bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
+
+ virtual void SetNoSelection() override;
+ using SvTabListBox::SelectAll;
+ virtual void SelectAll() override;
+ virtual void SelectRow( sal_Int32 _nRow, bool _bSelect = true, bool bExpand = true ) override;
+ virtual void SelectColumn( sal_uInt16 _nColumn, bool _bSelect = true ) override;
+ virtual sal_Int32 GetSelectedRowCount() const override;
+ virtual sal_Int32 GetSelectedColumnCount() const override;
+ /** @return <TRUE/>, if the row is selected. */
+ virtual bool IsRowSelected( sal_Int32 _nRow ) const override;
+ virtual bool IsColumnSelected( sal_Int32 _nColumn ) const override;
+ virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const override;
+ virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const override;
+
+ /** @return <TRUE/>, if the cell is visible. */
+ virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
+ virtual OUString GetAccessibleCellText( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const override;
+
+ virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) override;
+ virtual tools::Rectangle calcTableRect( bool _bOnScreen = true ) override;
+ virtual tools::Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen = true ) override;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) override;
+
+ virtual sal_Int32 GetAccessibleControlCount() const override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) override;
+ virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) override;
+
+ virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) override;
+ virtual bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) override;
+ virtual bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) override;
+
+ virtual OUString GetAccessibleObjectName( AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override;
+ virtual OUString GetAccessibleObjectDescription( AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override;
+ virtual vcl::Window* GetWindowInstance() override;
+
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, AccessibleBrowseBoxObjType _eType ) const override;
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
+ virtual void GrabTableFocus() override;
+
+ // OutputDevice
+ virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) override;
+
+ // Window
+ virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const override;
+ virtual void GrabFocus() override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;
+ /** Creates and returns the accessible object of the whole BrowseBox. */
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+ virtual vcl::Window* GetAccessibleParentWindow() const override;
+
+ virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override;
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override;
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/tabdlg.hxx b/include/vcl/toolkit/tabdlg.hxx
new file mode 100644
index 000000000..48fab3174
--- /dev/null
+++ b/include/vcl/toolkit/tabdlg.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/toolkit/dialog.hxx>
+
+class FixedLine;
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) TabDialog final : public Dialog
+{
+private:
+ VclPtr<FixedLine> mpFixedLine;
+ bool mbPosControls;
+
+ SAL_DLLPRIVATE void ImplInitTabDialogData();
+ SAL_DLLPRIVATE void ImplPosControls();
+
+public:
+ TabDialog( vcl::Window* pParent, WinBits nStyle );
+ virtual ~TabDialog() override;
+ virtual void dispose() override;
+
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/throbber.hxx b/include/vcl/toolkit/throbber.hxx
new file mode 100644
index 000000000..ff1240074
--- /dev/null
+++ b/include/vcl/toolkit/throbber.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <vcl/toolkit/imgctrl.hxx>
+#include <vcl/timer.hxx>
+
+#include <vector>
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) Throbber final : public ImageControl
+{
+public:
+ enum class ImageSet
+ {
+ /// default images, 16x16 pixels
+ N16px,
+ /// default images, 32x32 pixels
+ N32px,
+ /// default images, 64x64 pixels
+ N64px,
+ };
+
+public:
+ Throbber(vcl::Window* i_parentWindow, WinBits i_style);
+ virtual ~Throbber() override;
+ virtual void dispose() override;
+
+ // Properties
+ void setStepTime( sal_Int32 nStepTime ) { mnStepTime = nStepTime; }
+ sal_Int32 getStepTime() const { return mnStepTime; }
+
+ void setRepeat( bool bRepeat ) { mbRepeat = bRepeat; }
+ bool getRepeat() const { return mbRepeat; }
+
+ // animation control
+ void start();
+ void stop();
+ bool isRunning() const;
+
+ void setImageList( ::std::vector< Image > && i_images );
+
+ // default images
+ static ::std::vector< OUString >
+ getDefaultImageURLs( const ImageSet i_imageSet );
+
+private:
+ // Window overridables
+ virtual void Resize() override;
+
+ SAL_DLLPRIVATE void initImages();
+
+ ::std::vector< Image > maImageList;
+
+ bool mbRepeat;
+ sal_Int32 mnStepTime;
+ sal_Int32 mnCurStep;
+ AutoTimer maWaitTimer;
+
+ DECL_DLLPRIVATE_LINK( TimeOutHdl, Timer*, void );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/treelist.hxx b/include/vcl/toolkit/treelist.hxx
new file mode 100644
index 000000000..d4c6da101
--- /dev/null
+++ b/include/vcl/toolkit/treelist.hxx
@@ -0,0 +1,296 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <vcl/dllapi.h>
+#include <vcl/toolkit/treelistentries.hxx>
+
+#include <tools/link.hxx>
+#include <tools/contnr.hxx>
+
+#include <memory>
+
+enum class SvListAction
+{
+ INSERTED = 1,
+ REMOVING = 2,
+ REMOVED = 3,
+ MOVING = 4,
+ MOVED = 5,
+ CLEARING = 6,
+ INSERTED_TREE = 7,
+ INVALIDATE_ENTRY = 8,
+ RESORTING = 9,
+ RESORTED = 10,
+ CLEARED = 11
+};
+
+class SvTreeListEntry;
+class SvListView;
+class SvViewDataEntry;
+
+enum class SvSortMode { Ascending, Descending, None };
+
+// For the return values of Sortlink:
+// See International::Compare( pLeft, pRight )
+// ( Compare(a,b) ==> b.Compare(a) ==> strcmp(a,b) )
+struct SvSortData
+{
+ const SvTreeListEntry* pLeft;
+ const SvTreeListEntry* pRight;
+};
+
+class VCL_DLLPUBLIC SvTreeList final
+{
+ friend class SvListView;
+
+ SvListView& mrOwnerListView;
+ sal_uInt32 nEntryCount;
+
+ Link<SvTreeListEntry*, SvTreeListEntry*> aCloneLink;
+ Link<const SvSortData&, sal_Int32> aCompareLink;
+ SvSortMode eSortMode;
+
+ bool bAbsPositionsValid;
+
+ bool mbEnableInvalidate;
+
+ SvTreeListEntry* FirstVisible() const { return First(); }
+ SvTreeListEntry* NextVisible( const SvListView*,SvTreeListEntry* pEntry, sal_uInt16* pDepth=nullptr ) const;
+ SvTreeListEntry* PrevVisible( const SvListView*,SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* LastVisible( const SvListView* ) const;
+ SvTreeListEntry* NextVisible( const SvListView*,SvTreeListEntry* pEntry, sal_uInt16& rDelta ) const;
+ SvTreeListEntry* PrevVisible( const SvListView*,SvTreeListEntry* pEntry, sal_uInt16& rDelta ) const;
+
+ bool IsEntryVisible( const SvListView*,SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* GetEntryAtVisPos( const SvListView*, sal_uInt32 nVisPos ) const;
+ sal_uInt32 GetVisiblePos( const SvListView*,SvTreeListEntry const * pEntry ) const;
+ sal_uInt32 GetVisibleCount( SvListView* ) const;
+ sal_uInt32 GetVisibleChildCount( const SvListView*,SvTreeListEntry* pParent ) const;
+
+ SvTreeListEntry* FirstSelected( const SvListView*) const;
+ SvTreeListEntry* NextSelected( const SvListView*,SvTreeListEntry* pEntry ) const;
+
+ sal_uInt32 GetChildSelectionCount( const SvListView*,SvTreeListEntry* pParent ) const;
+
+ VCL_DLLPRIVATE void SetAbsolutePositions();
+
+ VCL_DLLPRIVATE void CloneChildren(
+ SvTreeListEntries& rDst, sal_uInt32& rCloneCount, SvTreeListEntries& rSrc, SvTreeListEntry& rNewParent) const;
+
+ /**
+ * Invalidate the cached position data to have them re-generated before
+ * the next access.
+ */
+ VCL_DLLPRIVATE static void SetListPositions( SvTreeListEntries& rEntries );
+
+ // rPos is not changed for SortModeNone
+ VCL_DLLPRIVATE void GetInsertionPos(
+ SvTreeListEntry const * pEntry,
+ SvTreeListEntry* pParent,
+ sal_uInt32& rPos
+ );
+
+ VCL_DLLPRIVATE void ResortChildren( SvTreeListEntry* pParent );
+
+ SvTreeList(const SvTreeList&) = delete;
+ SvTreeList& operator= (const SvTreeList&) = delete;
+
+ std::unique_ptr<SvTreeListEntry> pRootItem;
+
+public:
+
+ SvTreeList() = delete;
+ SvTreeList(SvListView&);
+ ~SvTreeList();
+
+ void Broadcast(
+ SvListAction nActionId,
+ SvTreeListEntry* pEntry1=nullptr,
+ SvTreeListEntry* pEntry2=nullptr,
+ sal_uInt32 nPos=0
+ );
+
+ void EnableInvalidate( bool bEnable );
+ bool IsEnableInvalidate() const { return mbEnableInvalidate; }
+
+ // Notify all Listeners
+ void InvalidateEntry( SvTreeListEntry* );
+
+ sal_uInt32 GetEntryCount() const { return nEntryCount; }
+ SvTreeListEntry* First() const;
+ SvTreeListEntry* Next( SvTreeListEntry* pEntry, sal_uInt16* pDepth=nullptr ) const;
+ SvTreeListEntry* Prev( SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* Last() const;
+
+ SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const;
+
+ sal_uInt32 Insert( SvTreeListEntry* pEntry,SvTreeListEntry* pPar,sal_uInt32 nPos = TREELIST_APPEND);
+ sal_uInt32 Insert( SvTreeListEntry* pEntry,sal_uInt32 nRootPos = TREELIST_APPEND )
+ { return Insert(pEntry, pRootItem.get(), nRootPos ); }
+
+ void InsertTree( SvTreeListEntry* pTree, SvTreeListEntry* pTargetParent, sal_uInt32 nListPos );
+
+ // Entries need to be in the same Model!
+ void Move( SvTreeListEntry* pSource, SvTreeListEntry* pTarget );
+
+ // Creates ChildList if needed
+ sal_uInt32 Move( SvTreeListEntry* pSource, SvTreeListEntry* pTargetParent, sal_uInt32 nListPos);
+ sal_uInt32 Copy( SvTreeListEntry* pSource, SvTreeListEntry* pTargetParent, sal_uInt32 nListPos);
+
+ bool Remove( const SvTreeListEntry* pEntry );
+ void Clear();
+
+ bool IsChild(const SvTreeListEntry* pParent, const SvTreeListEntry* pChild) const;
+ SvTreeListEntry* GetEntry( SvTreeListEntry* pParent, sal_uInt32 nPos ) const;
+ SvTreeListEntry* GetEntry( sal_uInt32 nRootPos ) const;
+ SvTreeListEntry* GetEntryAtAbsPos( sal_uInt32 nAbsPos ) const;
+
+ const SvTreeListEntry* GetParent( const SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* GetParent( SvTreeListEntry* pEntry );
+
+ SvTreeListEntry* GetRootLevelParent( SvTreeListEntry* pEntry ) const;
+ const SvTreeListEntries& GetChildList( SvTreeListEntry* pParent ) const;
+ SvTreeListEntries& GetChildList( SvTreeListEntry* pParent );
+
+ sal_uInt32 GetAbsPos( const SvTreeListEntry* pEntry ) const;
+ static sal_uInt32 GetRelPos( const SvTreeListEntry* pChild );
+
+ sal_uInt32 GetChildCount( const SvTreeListEntry* pParent ) const;
+ sal_uInt16 GetDepth( const SvTreeListEntry* pEntry ) const;
+ bool IsAtRootDepth( const SvTreeListEntry* pEntry ) const;
+
+ // The Model calls the Clone Link to clone Entries.
+ // Thus we do not need to derive from the Model if we derive from SvTreeListEntry.
+ // The Handler needs to return a SvTreeListEntry*
+ SvTreeListEntry* Clone( SvTreeListEntry* pEntry, sal_uInt32& nCloneCount ) const;
+ void SetCloneLink( const Link<SvTreeListEntry*,SvTreeListEntry*>& rLink )
+ { aCloneLink=rLink; }
+
+ const Link<SvTreeListEntry*,SvTreeListEntry*>& GetCloneLink() const
+ { return aCloneLink; }
+
+ SvTreeListEntry* CloneEntry( SvTreeListEntry* pSource ) const; // Calls the Clone Link
+
+ void SetSortMode( SvSortMode eMode ) { eSortMode = eMode; }
+ SvSortMode GetSortMode() const { return eSortMode; }
+ sal_Int32 Compare(const SvTreeListEntry* pLeft, const SvTreeListEntry* pRight) const;
+ void SetCompareHdl( const Link<const SvSortData&, sal_Int32>& rLink ) { aCompareLink = rLink; }
+ void Resort();
+};
+
+class VCL_DLLPUBLIC SvListView
+{
+ friend class SvTreeList;
+
+ struct SAL_DLLPRIVATE Impl;
+ std::unique_ptr<Impl> m_pImpl;
+
+protected:
+ std::unique_ptr<SvTreeList> pModel;
+
+ void ExpandListEntry( SvTreeListEntry* pParent );
+ void CollapseListEntry( SvTreeListEntry* pParent );
+ bool SelectListEntry( SvTreeListEntry* pEntry, bool bSelect );
+
+public:
+ SvListView(); // Sets the Model to 0
+ void dispose();
+ virtual ~SvListView();
+ void Clear();
+ virtual void ModelNotification(
+ SvListAction nActionId,
+ SvTreeListEntry* pEntry1,
+ SvTreeListEntry* pEntry2,
+ sal_uInt32 nPos
+ );
+
+ sal_uInt32 GetVisibleCount() const
+ { return pModel->GetVisibleCount( const_cast<SvListView*>(this) ); }
+
+ SvTreeListEntry* FirstVisible() const
+ { return pModel->FirstVisible(); }
+
+ SvTreeListEntry* NextVisible( SvTreeListEntry* pEntry ) const
+ { return pModel->NextVisible(this,pEntry); }
+
+ SvTreeListEntry* PrevVisible( SvTreeListEntry* pEntry ) const
+ { return pModel->PrevVisible(this,pEntry); }
+
+ SvTreeListEntry* LastVisible() const
+ { return pModel->LastVisible(this); }
+
+ SvTreeListEntry* NextVisible( SvTreeListEntry* pEntry, sal_uInt16& rDelta ) const
+ { return pModel->NextVisible(this,pEntry,rDelta); }
+
+ SvTreeListEntry* PrevVisible( SvTreeListEntry* pEntry, sal_uInt16& rDelta ) const
+ { return pModel->PrevVisible(this,pEntry,rDelta); }
+
+ sal_uInt32 GetSelectionCount() const;
+
+ SvTreeListEntry* FirstSelected() const
+ { return pModel->FirstSelected(this); }
+
+ SvTreeListEntry* NextSelected( SvTreeListEntry* pEntry ) const
+ { return pModel->NextSelected(this,pEntry); }
+
+ SvTreeListEntry* GetEntryAtAbsPos( sal_uInt32 nAbsPos ) const
+ { return pModel->GetEntryAtAbsPos(nAbsPos); }
+
+ SvTreeListEntry* GetEntryAtVisPos( sal_uInt32 nVisPos ) const
+ { return pModel->GetEntryAtVisPos(this,nVisPos); }
+
+ sal_uInt32 GetAbsPos( SvTreeListEntry const * pEntry ) const
+ { return pModel->GetAbsPos(pEntry); }
+
+ sal_uInt32 GetVisiblePos( SvTreeListEntry const * pEntry ) const
+ { return pModel->GetVisiblePos(this,pEntry); }
+
+ sal_uInt32 GetVisibleChildCount(SvTreeListEntry* pParent ) const
+ { return pModel->GetVisibleChildCount(this,pParent); }
+
+ bool IsEntryVisible( SvTreeListEntry* pEntry ) const
+ { return pModel->IsEntryVisible(this,pEntry); }
+
+ bool IsExpanded( SvTreeListEntry* pEntry ) const;
+ bool IsAllExpanded( SvTreeListEntry* pEntry) const;
+ bool IsSelected(const SvTreeListEntry* pEntry) const;
+ void SetEntryFocus( SvTreeListEntry* pEntry, bool bFocus );
+ const SvViewDataEntry* GetViewData( const SvTreeListEntry* pEntry ) const;
+ SvViewDataEntry* GetViewData( SvTreeListEntry* pEntry );
+ bool HasViewData() const;
+
+ virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry );
+
+ virtual void ModelHasCleared();
+ virtual void ModelHasInserted( SvTreeListEntry* pEntry );
+ virtual void ModelHasInsertedTree( SvTreeListEntry* pEntry );
+ virtual void ModelIsMoving( SvTreeListEntry* pSource );
+ virtual void ModelHasMoved( SvTreeListEntry* pSource );
+ virtual void ModelIsRemoving( SvTreeListEntry* pEntry );
+ virtual void ModelHasRemoved( SvTreeListEntry* pEntry );
+ virtual void ModelHasEntryInvalidated( SvTreeListEntry* pEntry );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/treelistbox.hxx b/include/vcl/toolkit/treelistbox.hxx
new file mode 100644
index 000000000..9ae148a94
--- /dev/null
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -0,0 +1,690 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <vcl/dllapi.h>
+
+#include <deque>
+#include <memory>
+#include <vector>
+
+#include <vcl/ctrl.hxx>
+#include <vcl/quickselectionengine.hxx>
+#include <vcl/image.hxx>
+#include <tools/gen.hxx>
+#include <tools/contnr.hxx>
+#include <vcl/toolkit/treelist.hxx>
+#include <vcl/transfer.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+class SvTreeListBox;
+class SvTreeListEntry;
+struct SvViewDataItem;
+class SvViewDataEntry;
+class SvInplaceEdit2;
+class SvLBoxString;
+class SvImpLBox;
+class SvLBoxButtonData;
+class Timer;
+class Edit;
+
+namespace utl {
+ class AccessibleStateSetHelper;
+}
+
+enum class SvButtonState { Unchecked, Checked, Tristate };
+
+// *********************************************************************
+// *************************** Tabulators ******************************
+// *********************************************************************
+
+enum class SvLBoxTabFlags
+{
+ NONE = 0x0000,
+ DYNAMIC = 0x0001, // Item's output column changes according to the Child Depth
+ ADJUST_RIGHT = 0x0002, // Item's right margin at the tabulator
+ ADJUST_LEFT = 0x0004, // Left margin
+ ADJUST_CENTER = 0x0008, // Center the item at the tabulator
+
+ SHOW_SELECTION = 0x0010, // Visualize selection state
+ // Item needs to be able to return the surrounding polygon (D'n'D cursor)
+ EDITABLE = 0x0020, // Item editable at the tabulator
+ FORCE = 0x0040, // Switch off the default calculation of the first tabulator
+ // (on which Abo Tabpage/Extras/Option/Customize, etc. rely on)
+ // The first tab's position corresponds precisely to the Flags set
+ // and column widths
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvLBoxTabFlags> : is_typed_flags<SvLBoxTabFlags, 0x007f> {};
+}
+
+#define SV_TAB_BORDER 8
+
+#define SV_ENTRYHEIGHTOFFS_PIXEL 2
+
+enum class SvTreeFlags
+{
+ CHKBTN = 0x01,
+ USESEL = 0x02,
+ MANINS = 0x04,
+ RECALCTABS = 0x08,
+ FIXEDHEIGHT = 0x10,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvTreeFlags> : is_typed_flags<SvTreeFlags, 0x1f> {};
+}
+
+enum class SvLBoxItemType {String, Button, ContextBmp};
+
+class SvLBoxTab
+{
+ tools::Long nPos;
+public:
+ SvLBoxTab();
+ SvLBoxTab( tools::Long nPos, SvLBoxTabFlags nFlags );
+ SvLBoxTab( const SvLBoxTab& );
+
+ SvLBoxTabFlags nFlags;
+
+ bool IsDynamic() const { return bool(nFlags & SvLBoxTabFlags::DYNAMIC); }
+ void SetPos( tools::Long nNewPos) { nPos = nNewPos; }
+ tools::Long GetPos() const { return nPos; }
+ tools::Long CalcOffset( tools::Long nItemLength, tools::Long nTabWidth );
+ bool IsEditable() const { return bool(nFlags & SvLBoxTabFlags::EDITABLE); }
+};
+
+class VCL_DLLPUBLIC SvLBoxItem
+{
+protected:
+ bool mbDisabled;
+
+public:
+ SvLBoxItem();
+ virtual ~SvLBoxItem();
+ virtual SvLBoxItemType GetType() const = 0;
+ virtual int CalcWidth(const SvTreeListBox* pView) const;
+ int GetWidth(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
+ int GetWidth(const SvTreeListBox* pView, const SvViewDataEntry* pData, sal_uInt16 nItemPos) const;
+ int GetHeight(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
+ static int GetHeight(const SvViewDataEntry* pData, sal_uInt16 nItemPos);
+ void Enable(bool bEnabled) { mbDisabled = !bEnabled; }
+
+ virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) = 0;
+
+ virtual void InitViewData(SvTreeListBox* pView, SvTreeListEntry* pEntry,
+ // If != 0: this Pointer must be used!
+ // If == 0: it needs to be retrieved via the View
+ SvViewDataItem* pViewData = nullptr) = 0;
+ // View-dependent data is not cloned
+ virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const = 0;
+};
+
+enum class DragDropMode
+{
+ NONE = 0x0000,
+ CTRL_MOVE = 0x0001,
+ APP_COPY = 0x0004,
+ // Entries may be dropped via the uppermost Entry
+ // The DropTarget is 0 in that case
+ ENABLE_TOP = 0x0010,
+ ALL = 0x0015,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<DragDropMode> : is_typed_flags<DragDropMode, 0x0015> {};
+}
+
+enum class SvTreeListBoxFlags
+{
+ NONE = 0x0000,
+ IN_EDT = 0x0001,
+ EDT_ENABLED = 0x0002,
+ TARGEMPH_VIS = 0x0004,
+ EDTEND_CALLED = 0x0008,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvTreeListBoxFlags> : is_typed_flags<SvTreeListBoxFlags, 0x000f> {};
+}
+
+struct SvTreeListBoxImpl;
+
+typedef std::pair<vcl::RenderContext&, const SvTreeListEntry&> svtree_measure_args;
+typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, const SvTreeListEntry&> svtree_render_args;
+
+class VCL_DLLPUBLIC SvTreeListBox
+ :public Control
+ ,public SvListView
+ ,public DropTargetHelper
+ ,public DragSourceHelper
+ ,public vcl::ISearchableStringList
+{
+ friend class SvImpLBox;
+ friend class SvLBoxString;
+ friend class IconViewImpl;
+ friend class TreeControlPeer;
+ friend class SalInstanceIconView;
+ friend class SalInstanceTreeView;
+ friend class SalInstanceEntryTreeView;
+
+ std::unique_ptr<SvTreeListBoxImpl> mpImpl;
+ Link<SvTreeListBox*,void> aScrolledHdl;
+ Link<SvTreeListBox*,void> aExpandedHdl;
+ Link<SvTreeListBox*,bool> aExpandingHdl;
+ Link<SvTreeListBox*,void> aSelectHdl;
+ Link<SvTreeListBox*,void> aDeselectHdl;
+ Link<const CommandEvent&, bool> aPopupMenuHdl;
+ Link<const HelpEvent&, bool> aTooltipHdl;
+ Link<svtree_render_args, void> aCustomRenderHdl;
+ Link<svtree_measure_args, Size> aCustomMeasureHdl;
+
+ Image aPrevInsertedExpBmp;
+ Image aPrevInsertedColBmp;
+ Image aCurInsertedExpBmp;
+ Image aCurInsertedColBmp;
+
+ short nContextBmpWidthMax;
+ short nEntryHeightOffs;
+ short nIndent;
+ short nFocusWidth;
+ sal_uInt16 nFirstSelTab;
+ sal_uInt16 nLastSelTab;
+ tools::Long mnCheckboxItemWidth;
+ bool mbContextBmpExpanded;
+ bool mbAlternatingRowColors;
+ bool mbUpdateAlternatingRows;
+ bool mbQuickSearch; // Enables type-ahead search in the check list box.
+ bool mbActivateOnSingleClick; // Make single click "activate" a row like a double-click normally does
+ bool mbHoverSelection; // Make mouse over a row "select" a row like a single-click normally does
+ bool mbSelectingByHover; // true during "Select" if it was due to hover
+ sal_Int8 mnClicksToToggle; // 0 == Click on a row not toggle its checkbox.
+ // 1 == Every click on row toggle its checkbox.
+ // 2 == First click select, second click toggle.
+
+ SvTreeListEntry* pHdlEntry;
+
+ DragDropMode nDragDropMode;
+ DragDropMode nOldDragMode;
+ SelectionMode eSelMode;
+ sal_Int32 nMinWidthInChars;
+
+ sal_Int8 mnDragAction;
+
+ SvTreeListEntry* pEdEntry;
+ SvLBoxItem* pEdItem;
+
+ rtl::Reference<TransferDataContainer> m_xTransferHelper;
+
+protected:
+ std::unique_ptr<SvImpLBox> pImpl;
+ short nColumns;
+ short nEntryHeight;
+ short nEntryWidth;
+ bool mbCenterAndClipText;
+
+ Link<SvTreeListBox*,bool> aDoubleClickHdl;
+ SvTreeListEntry* pTargetEntry;
+ SvLBoxButtonData* pCheckButtonData;
+ std::vector<std::unique_ptr<SvLBoxTab>> aTabs;
+ SvTreeFlags nTreeFlags;
+ SvTreeListBoxFlags nImpFlags;
+ // Move/CopySelection: Position of the current Entry in SelectionList
+ sal_uInt16 nCurEntrySelPos;
+
+private:
+ DECL_DLLPRIVATE_LINK( CheckButtonClick, SvLBoxButtonData *, void );
+ DECL_DLLPRIVATE_LINK( TextEditEndedHdl_Impl, SvInplaceEdit2&, void );
+ // Handler that is called by TreeList to clone an Entry
+ DECL_DLLPRIVATE_LINK( CloneHdl_Impl, SvTreeListEntry*, SvTreeListEntry* );
+
+ // Handler and methods for Drag - finished handler.
+ // The Handle retrieved by GetDragFinishedHdl can be set on the
+ // TransferDataContainer. This link is a callback for the DragFinished
+ // call. The AddBox method is called from the GetDragFinishedHdl() and the
+ // remove is called in the link callback and in the dtor. So it can't be
+ // called for a deleted object.
+ VCL_DLLPRIVATE static void AddBoxToDDList_Impl( const SvTreeListBox& rB );
+ VCL_DLLPRIVATE static void RemoveBoxFromDDList_Impl( const SvTreeListBox& rB );
+ DECL_DLLPRIVATE_LINK( DragFinishHdl_Impl, sal_Int8, void );
+
+ // after a checkbox entry is inserted, use this to get its width to support
+ // autowidth for the 1st checkbox column
+ VCL_DLLPRIVATE void CheckBoxInserted(SvTreeListEntry* pEntry);
+
+ VCL_DLLPRIVATE void DrawCustomEntry(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, const SvTreeListEntry& rEntry);
+ VCL_DLLPRIVATE Size MeasureCustomEntry(vcl::RenderContext& rRenderContext, const SvTreeListEntry& rEntry) const;
+
+ /** Handles the given key event.
+
+ At the moment this merely does typeahead if typeahead is enabled.
+
+ @return
+ <TRUE/> if the event has been consumed, <FALSE/> otherwise.
+ */
+ VCL_DLLPRIVATE bool HandleKeyInput(const KeyEvent& rKEvt);
+
+ void UnsetDropTarget();
+
+protected:
+
+ bool CheckDragAndDropMode( SvTreeListBox const * pSource, sal_Int8 );
+ void ImplShowTargetEmphasis( SvTreeListEntry* pEntry, bool bShow);
+ void EnableSelectionAsDropTarget( bool bEnable = true );
+ // Standard impl returns 0; derived classes which support D'n'D must override
+ using Window::GetDropTarget;
+ virtual SvTreeListEntry* GetDropTarget( const Point& );
+
+ // Invalidate children on enable/disable
+ virtual void StateChanged( StateChangedType eType ) override;
+
+ virtual sal_uInt32 Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uInt32 nPos=TREELIST_APPEND);
+ virtual sal_uInt32 Insert( SvTreeListEntry* pEntry,sal_uInt32 nRootPos = TREELIST_APPEND );
+
+ // In-place editing
+ std::unique_ptr<SvInplaceEdit2> pEdCtrl;
+ void EditText( const OUString&, const tools::Rectangle&,const Selection&);
+ void CancelTextEditing();
+
+ // InitViewData is called right after CreateViewData
+ // The Entry is has not yet been added to the View in InitViewData!
+ virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry ) override;
+ // Calls InitViewData for all Items
+ void RecalcViewData();
+
+ // Handler and methods for Drag - finished handler. This link can be set
+ // to the TransferDataContainer. The AddBox/RemoveBox methods must be
+ // called before the StartDrag call.
+ // The Remove will be called from the handler, which then calls DragFinish.
+ // The Remove is also called in the DTOR of the SvTreeListBox -
+ // so it can't be called for a deleted object.
+ Link<sal_Int8,void> GetDragFinishedHdl() const;
+
+ // For asynchronous D'n'D
+ sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, SvTreeListBox* pSourceView );
+
+ void OnCurrentEntryChanged();
+
+ // ISearchableStringList
+ virtual vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const override;
+ virtual vcl::StringEntryIdentifier NextEntry( vcl::StringEntryIdentifier _currentEntry, OUString& _out_entryText ) const override;
+ virtual void SelectEntry( vcl::StringEntryIdentifier _entry ) override;
+
+public:
+
+ SvTreeListBox( vcl::Window* pParent, WinBits nWinStyle=0 );
+ virtual ~SvTreeListBox() override;
+ virtual void dispose() override;
+
+ SvTreeList* GetModel() const
+ {
+ return pModel.get();
+ }
+
+ sal_uInt32 GetEntryCount() const
+ {
+ return pModel ? pModel->GetEntryCount() : 0;
+ }
+ SvTreeListEntry* First() const
+ {
+ return pModel ? pModel->First() : nullptr;
+ }
+ SvTreeListEntry* Next( SvTreeListEntry* pEntry ) const
+ {
+ return pModel->Next(pEntry);
+ }
+ SvTreeListEntry* Prev( SvTreeListEntry* pEntry ) const
+ {
+ return pModel->Prev(pEntry);
+ }
+ SvTreeListEntry* Last() const
+ {
+ return pModel ? pModel->Last() : nullptr;
+ }
+
+ SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const;
+
+ bool CopySelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget );
+ bool MoveSelectionCopyFallbackPossible( SvTreeListBox* pSource, SvTreeListEntry* pTarget, bool bAllowCopyFallback );
+ void RemoveSelection();
+ /**
+ * Removes the entry along with all of its descendants
+ */
+ void RemoveEntry(SvTreeListEntry const * pEntry);
+
+ DragDropMode GetDragDropMode() const { return nDragDropMode; }
+ SelectionMode GetSelectionMode() const { return eSelMode; }
+
+ // pParent == 0 -> Root level
+ SvTreeListEntry* GetEntry( SvTreeListEntry* pParent, sal_uInt32 nPos ) const;
+ SvTreeListEntry* GetEntry( sal_uInt32 nRootPos ) const;
+
+ SvTreeListEntry* GetEntryFromPath( const ::std::deque< sal_Int32 >& _rPath ) const;
+ void FillEntryPath( SvTreeListEntry* pEntry, ::std::deque< sal_Int32 >& _rPath ) const;
+
+ using Window::GetParent;
+ SvTreeListEntry* GetParent( SvTreeListEntry* pEntry ) const;
+
+ using Window::GetChildCount;
+ sal_uInt32 GetChildCount( SvTreeListEntry const * pParent ) const;
+ sal_uInt32 GetLevelChildCount( SvTreeListEntry* pParent ) const;
+
+ SvViewDataEntry* GetViewDataEntry( SvTreeListEntry const * pEntry ) const;
+ SvViewDataItem* GetViewDataItem(SvTreeListEntry const *, SvLBoxItem const *);
+ const SvViewDataItem* GetViewDataItem(const SvTreeListEntry*, const SvLBoxItem*) const;
+
+ bool IsInplaceEditingEnabled() const { return bool(nImpFlags & SvTreeListBoxFlags::EDT_ENABLED); }
+ bool IsEditingActive() const { return bool(nImpFlags & SvTreeListBoxFlags::IN_EDT); }
+ void EndEditing( bool bCancel = false );
+
+ void Clear();
+
+ bool TextCenterAndClipEnabled() const { return mbCenterAndClipText; }
+
+ void SetSelectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aSelectHdl=rNewHdl; }
+ void SetDeselectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aDeselectHdl=rNewHdl; }
+ void SetDoubleClickHdl(const Link<SvTreeListBox*,bool>& rNewHdl) {aDoubleClickHdl=rNewHdl;}
+ void SetExpandingHdl(const Link<SvTreeListBox*,bool>& rNewHdl){aExpandingHdl=rNewHdl;}
+ void SetExpandedHdl(const Link<SvTreeListBox*,void>& rNewHdl){aExpandedHdl=rNewHdl;}
+ void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink) { aPopupMenuHdl = rLink; }
+ void SetTooltipHdl(const Link<const HelpEvent&, bool>& rLink) { aTooltipHdl = rLink; }
+ void SetCustomRenderHdl(const Link<svtree_render_args, void>& rLink) { aCustomRenderHdl = rLink; }
+ void SetCustomMeasureHdl(const Link<svtree_measure_args, Size>& rLink) { aCustomMeasureHdl = rLink; }
+
+ void ExpandedHdl();
+ bool ExpandingHdl();
+ void SelectHdl();
+ void DeselectHdl();
+ bool DoubleClickHdl();
+ SvTreeListEntry* GetHdlEntry() const { return pHdlEntry; }
+
+ // Is called for an Entry that gets expanded with the Flag
+ // ENTRYFLAG_CHILDREN_ON_DEMAND set.
+ virtual void RequestingChildren( SvTreeListEntry* pParent );
+
+ // Drag & Drop
+ // New D'n'D API
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
+ virtual DragDropMode NotifyStartDrag();
+ virtual void DragFinished( sal_Int8 nDropAction );
+
+ SvTreeListEntry* CloneEntry( SvTreeListEntry* pSource );
+
+ // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
+ TriState NotifyMoving(
+ SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
+ const SvTreeListEntry* pEntry, // Entry to be moved from GetSourceListBox()->GetModel()
+ SvTreeListEntry*& rpNewParent, // New TargetParent
+ sal_uInt32& rNewChildPos); // The TargetParent's position in Childlist
+
+ // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
+ TriState NotifyCopying(
+ SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
+ const SvTreeListEntry* pEntry, // Entry to be copied from GetSourceListBox()->GetModel()
+ SvTreeListEntry*& rpNewParent, // New TargetParent
+ sal_uInt32& rNewChildPos); // The TargetParent's position in Childlist
+
+ // ACCESSIBILITY ==========================================================
+
+ /** Creates and returns the accessible object of the Box. */
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+
+ /** Fills the StateSet of one entry. */
+ void FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, ::utl::AccessibleStateSetHelper& rStateSet ) const;
+
+ virtual OUString GetEntryAccessibleDescription(SvTreeListEntry* pEntry) const;
+
+ /** Calculate and return the bounding rectangle of an entry.
+ @param pEntry
+ The entry.
+ @return The bounding rectangle of an entry. */
+ tools::Rectangle GetBoundingRect(const SvTreeListEntry* pEntry);
+
+ SvTreeFlags GetTreeFlags() const {return nTreeFlags;}
+
+ static OUString SearchEntryTextWithHeadTitle(SvTreeListEntry* pEntry);
+
+ void set_min_width_in_chars(sal_Int32 nChars);
+
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+
+ VCL_DLLPRIVATE void SetCollapsedNodeBmp( const Image& );
+ VCL_DLLPRIVATE void SetExpandedNodeBmp( const Image& );
+ VCL_DLLPRIVATE Image const & GetExpandedNodeBmp( ) const;
+
+protected:
+
+ virtual void CalcEntryHeight(SvTreeListEntry const* pEntry);
+ void AdjustEntryHeight( const Image& rBmp );
+ VCL_DLLPRIVATE void AdjustEntryHeight();
+
+ VCL_DLLPRIVATE void ImpEntryInserted( SvTreeListEntry* pEntry );
+ VCL_DLLPRIVATE void PaintEntry1( SvTreeListEntry&, tools::Long nLine, vcl::RenderContext& rRenderContext );
+
+ VCL_DLLPRIVATE void InitTreeView();
+ VCL_DLLPRIVATE SvLBoxItem* GetItem_Impl( SvTreeListEntry*, tools::Long nX, SvLBoxTab** ppTab );
+ VCL_DLLPRIVATE void ImplInitStyle();
+
+ void SetupDragOrigin();
+ void EditItemText( SvTreeListEntry* pEntry, SvLBoxString* pItem,
+ const Selection& );
+ void EditedText(const OUString&);
+
+ // Recalculate all tabs depending on TreeListStyle and Bitmap sizes
+ // Is called automatically when inserting/changing Bitmaps, changing the Model etc.
+ virtual void SetTabs();
+ void AddTab( tools::Long nPos, SvLBoxTabFlags nFlags );
+ sal_uInt16 TabCount() const { return aTabs.size(); }
+ SvLBoxTab* GetFirstDynamicTab() const;
+ SvLBoxTab* GetFirstDynamicTab( sal_uInt16& rTabPos ) const;
+ SvLBoxTab* GetFirstTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
+ void GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
+ SvLBoxTab* GetTab( SvTreeListEntry const *, SvLBoxItem const * ) const;
+ void ClearTabList();
+
+ virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&);
+
+ void NotifyScrolled();
+ void SetScrolledHdl( const Link<SvTreeListBox*,void>& rLink ) { aScrolledHdl = rLink; }
+ tools::Long GetXOffset() const { return GetMapMode().GetOrigin().X(); }
+
+ virtual void Command( const CommandEvent& rCEvt ) override;
+
+ virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ void InitSettings();
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+
+ void CallImplEventListeners(VclEventId nEvent, void* pData);
+
+ void ImplEditEntry( SvTreeListEntry* pEntry );
+
+ void AdjustEntryHeightAndRecalc();
+
+ // true if rPos is over the SvTreeListBox body, i.e. not over a
+ // scrollbar
+ VCL_DLLPRIVATE bool PosOverBody(const Point& rPos) const;
+public:
+
+ void SetNoAutoCurEntry( bool b );
+
+ void EnableCheckButton( SvLBoxButtonData* );
+ void SetCheckButtonData( SvLBoxButtonData* );
+
+ /** Returns the default image which clients should use for expanded nodes, to have a consistent user
+ interface experience in the whole product.
+ */
+ static const Image& GetDefaultExpandedNodeImage( );
+
+ /** Returns the default image which clients should use for expanded nodes, to have a consistent user
+ interface experience in the whole product.
+ */
+ static const Image& GetDefaultCollapsedNodeImage( );
+
+ /** Sets default bitmaps for collapsed and expanded nodes.
+ */
+ void SetNodeDefaultImages();
+
+ virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = nullptr,
+ bool bChildrenOnDemand = false,
+ sal_uInt32 nPos=TREELIST_APPEND, void* pUserData = nullptr);
+
+ const Image& GetDefaultExpandedEntryBmp( ) const;
+ const Image& GetDefaultCollapsedEntryBmp( ) const;
+
+ void SetDefaultExpandedEntryBmp( const Image& rBmp );
+ void SetDefaultCollapsedEntryBmp( const Image& rBmp );
+
+ void SetCheckButtonState( SvTreeListEntry*, SvButtonState );
+ SvButtonState GetCheckButtonState( SvTreeListEntry* ) const;
+
+ void SetEntryText(SvTreeListEntry*, const OUString& );
+ void SetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
+ void SetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
+
+ virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const;
+ static const Image& GetExpandedEntryBmp(const SvTreeListEntry* _pEntry );
+ static const Image& GetCollapsedEntryBmp(const SvTreeListEntry* _pEntry );
+
+ void CheckButtonHdl();
+
+ void SetSublistOpenWithLeftRight(); // open/close sublist with cursor left/right
+
+ void EnableInplaceEditing( bool bEnable );
+ // Edits the Entry's first StringItem, 0 == Cursor
+ void EditEntry( SvTreeListEntry* pEntry );
+ virtual bool EditingEntry( SvTreeListEntry* pEntry );
+ virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText );
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void Resize() override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ void SetUpdateMode( bool );
+
+ virtual void ModelHasCleared() override;
+ virtual void ModelHasInserted( SvTreeListEntry* pEntry ) override;
+ virtual void ModelHasInsertedTree( SvTreeListEntry* pEntry ) override;
+ virtual void ModelIsMoving(SvTreeListEntry* pSource ) override;
+ virtual void ModelHasMoved(SvTreeListEntry* pSource ) override;
+ virtual void ModelIsRemoving( SvTreeListEntry* pEntry ) override;
+ virtual void ModelHasRemoved( SvTreeListEntry* pEntry ) override;
+ void ModelHasEntryInvalidated( SvTreeListEntry* pEntry ) override;
+
+ void ScrollOutputArea( short nDeltaEntries );
+
+ short GetColumnsCount() const { return nColumns; }
+ short GetEntryHeight() const { return nEntryHeight; }
+ void SetEntryHeight( short nHeight );
+ short GetEntryWidth() const { return nEntryWidth; }
+ void SetEntryWidth( short nWidth );
+ Size GetOutputSizePixel() const;
+ short GetIndent() const { return nIndent; }
+ void SetSpaceBetweenEntries( short nSpace );
+ Point GetEntryPosition(const SvTreeListEntry*) const;
+ void MakeVisible( SvTreeListEntry* pEntry );
+ void MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop );
+
+ void SetFont( const vcl::Font& rFont );
+
+ SvTreeListEntry* GetEntry( const Point& rPos, bool bHit = false ) const;
+
+ virtual tools::Rectangle GetFocusRect(const SvTreeListEntry*, tools::Long nLine );
+ // Respects indentation
+ sal_IntPtr GetTabPos(const SvTreeListEntry*, const SvLBoxTab*) const;
+ void InvalidateEntry( SvTreeListEntry* );
+ SvLBoxItem* GetItem( SvTreeListEntry*, tools::Long nX, SvLBoxTab** ppTab);
+ SvLBoxItem* GetItem( SvTreeListEntry*, tools::Long nX );
+ std::pair<tools::Long, tools::Long> GetItemPos(SvTreeListEntry* pEntry, sal_uInt16 nTabIdx);
+
+ void SetDragDropMode( DragDropMode );
+ void SetSelectionMode( SelectionMode );
+
+ bool Expand( SvTreeListEntry* pParent );
+ bool Collapse( SvTreeListEntry* pParent );
+ bool Select( SvTreeListEntry* pEntry, bool bSelect=true );
+ sal_uInt32 SelectChildren( SvTreeListEntry* pParent, bool bSelect );
+ void SelectAll( bool bSelect );
+
+ void SetCurEntry( SvTreeListEntry* _pEntry );
+ SvTreeListEntry* GetCurEntry() const;
+
+ using Window::Invalidate;
+ virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE) override;
+ virtual void Invalidate( const tools::Rectangle&, InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
+
+ void SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 nLastTab=0xffff);
+
+ sal_Int32 DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText);
+
+ DECL_DLLPRIVATE_LINK( DefaultCompare, const SvSortData&, sal_Int32 );
+ virtual void ModelNotification( SvListAction nActionId, SvTreeListEntry* pEntry1,
+ SvTreeListEntry* pEntry2, sal_uInt32 nPos ) override;
+
+ SvTreeListEntry* GetFirstEntryInView() const;
+ SvTreeListEntry* GetNextEntryInView(SvTreeListEntry*) const;
+ void ScrollToAbsPos( tools::Long nPos );
+
+ tools::Long getPreferredDimensions(std::vector<tools::Long> &rWidths) const;
+
+ virtual Size GetOptimalSize() const override;
+
+ void SetAlternatingRowColors( const bool bEnable );
+
+ // Enables type-ahead search in the check list box.
+ void SetQuickSearch(bool bEnable) { mbQuickSearch = bEnable; }
+
+ // Make single click "activate" a row like a double-click normally does
+ void SetActivateOnSingleClick(bool bEnable) { mbActivateOnSingleClick = bEnable; }
+ bool GetActivateOnSingleClick() const { return mbActivateOnSingleClick; }
+
+ // Make mouse over a row "select" a row like a single-click normally does
+ void SetHoverSelection(bool bEnable) { mbHoverSelection = bEnable; }
+ bool GetHoverSelection() const { return mbHoverSelection; }
+
+ // only true during Select if the Select is due to a Hover
+ bool IsSelectDueToHover() const { return mbSelectingByHover; }
+
+ // Set when clicks toggle the checkbox of the row.
+ void SetClicksToToggle(sal_Int8 nCount) { mnClicksToToggle = nCount; }
+
+ void SetForceMakeVisible(bool bEnable);
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ void SetDragHelper(const rtl::Reference<TransferDataContainer>& rHelper, sal_uInt8 eDNDConstants);
+
+ virtual void EnableRTL(bool bEnable = true) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/treelistentries.hxx b/include/vcl/toolkit/treelistentries.hxx
new file mode 100644
index 000000000..fdd86dbfa
--- /dev/null
+++ b/include/vcl/toolkit/treelistentries.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) \
+ && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <vector>
+#include <memory>
+
+class SvTreeListEntry;
+typedef std::vector<std::unique_ptr<SvTreeListEntry>> SvTreeListEntries;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/treelistentry.hxx b/include/vcl/toolkit/treelistentry.hxx
new file mode 100644
index 000000000..7a35e8e0b
--- /dev/null
+++ b/include/vcl/toolkit/treelistentry.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <vcl/dllapi.h>
+#include <tools/color.hxx>
+#include <vcl/toolkit/treelistbox.hxx>
+#include <vcl/toolkit/treelistentries.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <optional>
+#include <vector>
+#include <memory>
+
+// flags related to the model
+enum class SvTLEntryFlags
+{
+ NONE = 0x0000,
+ CHILDREN_ON_DEMAND = 0x0001,
+ DISABLE_DROP = 0x0002,
+ // is set if RequestingChildren has not set any children
+ NO_NODEBMP = 0x0004,
+ // is set if this is a separator line
+ IS_SEPARATOR = 0x0008,
+ // entry had or has children
+ HAD_CHILDREN = 0x0010,
+ SEMITRANSPARENT = 0x8000, // draw semi-transparent entry bitmaps
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvTLEntryFlags> : is_typed_flags<SvTLEntryFlags, 0x801f> {};
+}
+
+class VCL_DLLPUBLIC SvTreeListEntry
+{
+ friend class SvTreeList;
+ friend class SvListView;
+ friend class SvTreeListBox;
+
+ typedef std::vector<std::unique_ptr<SvLBoxItem>> ItemsType;
+
+ SvTreeListEntry* pParent;
+ SvTreeListEntries m_Children;
+ sal_uInt32 nAbsPos;
+ sal_uInt32 nListPos;
+ sal_uInt32 mnExtraIndent;
+ ItemsType m_Items;
+ void* pUserData;
+ SvTLEntryFlags nEntryFlags;
+ Color maBackColor;
+ std::optional<Color> mxTextColor;
+
+private:
+ void ClearChildren();
+ void SetListPositions();
+ void InvalidateChildrensListPositions();
+
+ SvTreeListEntry(const SvTreeListEntry& r) = delete;
+ void operator=(SvTreeListEntry const&) = delete;
+
+public:
+ static const size_t ITEM_NOT_FOUND = SAL_MAX_SIZE;
+
+ SvTreeListEntry();
+ virtual ~SvTreeListEntry();
+
+ bool HasChildren() const;
+ bool HasChildListPos() const;
+ sal_uInt32 GetChildListPos() const;
+
+ SvTreeListEntries& GetChildEntries() { return m_Children; }
+ const SvTreeListEntries& GetChildEntries() const { return m_Children; }
+
+ void Clone(SvTreeListEntry* pSource);
+
+ size_t ItemCount() const;
+
+ // MAY ONLY BE CALLED IF THE ENTRY HAS NOT YET BEEN INSERTED INTO
+ // THE MODEL, AS OTHERWISE NO VIEW-DEPENDENT DATA ARE ALLOCATED
+ // FOR THE ITEM!
+ void AddItem(std::unique_ptr<SvLBoxItem> pItem);
+ void ReplaceItem(std::unique_ptr<SvLBoxItem> pNewItem, size_t nPos);
+ const SvLBoxItem& GetItem( size_t nPos ) const;
+ SvLBoxItem& GetItem( size_t nPos );
+ const SvLBoxItem* GetFirstItem(SvLBoxItemType eType) const;
+ SvLBoxItem* GetFirstItem(SvLBoxItemType eType);
+ size_t GetPos( const SvLBoxItem* pItem ) const;
+ void* GetUserData() const { return pUserData;}
+ void SetUserData( void* pPtr );
+ void EnableChildrenOnDemand( bool bEnable=true );
+ bool HasChildrenOnDemand() const;
+
+ SvTLEntryFlags GetFlags() const { return nEntryFlags;}
+ void SetFlags( SvTLEntryFlags nFlags );
+
+ void SetBackColor( const Color& rColor ) { maBackColor = rColor; }
+ const Color& GetBackColor() const { return maBackColor; }
+
+ void SetTextColor( std::optional<Color> xColor ) { mxTextColor = xColor; }
+ std::optional<Color> const & GetTextColor() const { return mxTextColor; }
+
+ void SetExtraIndent(sal_uInt32 nExtraIndent) { mnExtraIndent = nExtraIndent; }
+ sal_uInt32 GetExtraIndent() const { return mnExtraIndent; }
+
+ SvTreeListEntry* NextSibling() const;
+ SvTreeListEntry* PrevSibling() const;
+ SvTreeListEntry* LastSibling() const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/unowrap.hxx b/include/vcl/toolkit/unowrap.hxx
new file mode 100644
index 000000000..edaeb9dc9
--- /dev/null
+++ b/include/vcl/toolkit/unowrap.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <config_options.h>
+#include <com/sun/star/uno/Reference.h>
+#include <vcl/dllapi.h>
+#include <vcl/vclptr.hxx>
+
+namespace vcl { class Window; }
+class Menu;
+class OutputDevice;
+class PopupMenu;
+namespace com::sun::star::awt {
+ class XGraphics;
+ class XPopupMenu;
+ class XToolkit;
+ class XWindow;
+ class XWindowPeer;
+}
+namespace com::sun::star::accessibility {
+ class XAccessible;
+}
+
+class VCL_DLLPUBLIC UnoWrapperBase
+{
+public:
+ virtual void Destroy() = 0;
+
+ // Toolkit
+ virtual css::uno::Reference< css::awt::XToolkit > GetVCLToolkit() = 0;
+
+ // Graphics
+ virtual css::uno::Reference< css::awt::XGraphics > CreateGraphics( OutputDevice* pOutDev ) = 0;
+ virtual void ReleaseAllGraphics( OutputDevice* pOutDev ) = 0;
+
+ // Window
+ virtual css::uno::Reference<css::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow ) = 0;
+ virtual void SetWindowInterface( vcl::Window* pWindow, const css::uno::Reference< css::awt::XWindowPeer > & xIFace ) = 0;
+ virtual VclPtr<vcl::Window> GetWindow(const css::uno::Reference<css::awt::XWindow>& rxWindow) = 0;
+
+ // PopupMenu
+ virtual css::uno::Reference<css::awt::XPopupMenu> CreateMenuInterface( PopupMenu* pPopupMenu ) = 0;
+
+ virtual void WindowDestroyed( vcl::Window* pWindow ) = 0;
+
+ // Accessibility
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ CreateAccessible( Menu* pMenu, bool bIsMenuBar ) = 0;
+
+ /** Get the application's UNO wrapper object.
+
+ Note that this static function will only ever try to create UNO wrapper object once, and
+ if it fails then it will not ever try again, even if the function is called multiple times.
+
+ @param bCreateIfNotExists Create the UNO wrapper object if it doesn't exist when true.
+
+ @return UNO wrapper object.
+ */
+ static UnoWrapperBase* GetUnoWrapper( bool bCreateIfNotExists = true );
+
+ /** Sets the application's UNO Wrapper object.
+
+ @param pWrapper Pointer to UNO wrapper object.
+ */
+ static void SetUnoWrapper( UnoWrapperBase* pWrapper );
+
+protected:
+ ~UnoWrapperBase() {}
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/vclmedit.hxx b/include/vcl/toolkit/vclmedit.hxx
new file mode 100644
index 000000000..3a7c4e274
--- /dev/null
+++ b/include/vcl/toolkit/vclmedit.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <tools/lineend.hxx>
+#include <tools/wintypes.hxx>
+#include <vcl/toolkit/edit.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/timer.hxx>
+#include <memory>
+
+class ImpVclMEdit;
+class ExtTextEngine;
+class TextView;
+
+class TextWindow final : public vcl::Window
+{
+private:
+ VclPtr<Edit> mxParent;
+ std::unique_ptr<ExtTextEngine> mpExtTextEngine;
+ std::unique_ptr<TextView> mpExtTextView;
+
+ bool mbInMBDown;
+ bool mbFocusSelectionHide;
+ bool mbIgnoreTab;
+ bool mbActivePopup;
+ bool mbSelectOnTab;
+
+public:
+ explicit TextWindow(Edit* pParent);
+ virtual ~TextWindow() override;
+ virtual void dispose() override;
+
+ ExtTextEngine* GetTextEngine() const { return mpExtTextEngine.get(); }
+ TextView* GetTextView() const { return mpExtTextView.get(); }
+
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual void KeyInput( const KeyEvent& rKEvent ) override;
+
+ virtual void Command( const CommandEvent& rCEvt ) override;
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void Resize() override;
+
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+
+ void SetAutoFocusHide( bool bAutoHide ) { mbFocusSelectionHide = bAutoHide; }
+
+ void SetIgnoreTab( bool bIgnore ) { mbIgnoreTab = bIgnore; }
+
+ void DisableSelectionOnFocus() { mbSelectOnTab = false; }
+};
+
+class VCL_DLLPUBLIC VclMultiLineEdit : public Edit
+{
+ friend class VCLXAccessibleEdit;
+
+private:
+ std::unique_ptr<ImpVclMEdit> pImpVclMEdit;
+
+ Link<Edit&,void> aModifyHdlLink;
+
+protected:
+
+ void StateChanged( StateChangedType nType ) override;
+ void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ using Control::ImplInitSettings;
+ void ImplInitSettings( bool bBackground );
+ static WinBits ImplInitStyle( WinBits nStyle );
+
+ TextView* GetTextView() const;
+ ExtTextEngine* GetTextEngine() const;
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+public:
+ VclMultiLineEdit( vcl::Window* pParent,
+ WinBits nWinStyle );
+ virtual ~VclMultiLineEdit() override;
+ virtual void dispose() override;
+
+ void SelectionChanged();
+ void CaretChanged();
+ virtual void Modify() override;
+
+ virtual void SetModifyFlag() override;
+
+ virtual void SetReadOnly( bool bReadOnly = true ) override;
+ virtual bool IsReadOnly() const override;
+
+ void EnableFocusSelectionHide( bool bHide );
+
+ virtual void SetMaxTextLen(sal_Int32 nMaxLen) override;
+ virtual sal_Int32 GetMaxTextLen() const override;
+
+ void SetMaxTextWidth(tools::Long nMaxWidth);
+
+ virtual void SetSelection( const Selection& rSelection ) override;
+ virtual const Selection& GetSelection() const override;
+
+ virtual void ReplaceSelected( const OUString& rStr ) override;
+ virtual void DeleteSelected() override;
+ virtual OUString GetSelected() const override;
+ OUString GetSelected( LineEnd aSeparator ) const;
+
+ bool CanUp() const;
+ bool CanDown() const;
+
+ virtual void Cut() override;
+ virtual void Copy() override;
+ virtual void Paste() override;
+
+ virtual void SetText( const OUString& rStr ) override;
+ virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) override
+ { SetText( rStr ); SetSelection( rNewSelection ); }
+ OUString GetText() const override;
+ OUString GetText( LineEnd aSeparator ) const;
+ OUString GetTextLines( LineEnd aSeparator ) const;
+
+ void SetModifyHdl( const Link<Edit&,void>& rLink ) override { aModifyHdlLink = rLink; }
+ const Link<Edit&,void>& GetModifyHdl() const override { return aModifyHdlLink; }
+
+ virtual void Resize() override;
+ virtual void GetFocus() override;
+
+ virtual Size CalcMinimumSize() const override;
+ Size CalcAdjustedSize( const Size& rPrefSize ) const;
+ Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
+ void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
+
+ void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
+
+ void DisableSelectionOnFocus();
+
+ void EnableCursor( bool bEnable );
+
+ ScrollBar& GetVScrollBar() const;
+
+ TextWindow* GetTextWindow();
+
+ virtual FactoryFunction GetUITestFactory() const override;
+
+ virtual bool set_property(const OString &rKey, const OUString &rValue) override;
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/toolkit/viewdataentry.hxx b/include/vcl/toolkit/viewdataentry.hxx
new file mode 100644
index 000000000..b34a8e3ef
--- /dev/null
+++ b/include/vcl/toolkit/viewdataentry.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
+#error "don't use this in new code"
+#endif
+
+#include <sal/types.h>
+#include <vector>
+
+class SvTreeListBox;
+
+struct SvViewDataItem
+{
+ int mnWidth = 0;
+ int mnHeight = 0;
+};
+
+/**
+ * View-dependent data for a tree list entry created in the virtual function
+ * SvTreeListBox::CreateViewData(). The item array contains the same number
+ * of items as that of the items in its corresponding tree list entry.
+ *
+ * When an entry is selected, it is logically selected and visually
+ * highlighted. When an entry is only highlighted, it looks visually
+ * highlighted, but not logically selected.
+ */
+class SvViewDataEntry
+{
+ friend class SvTreeList;
+
+ std::vector<SvViewDataItem> maItems;
+ sal_uInt32 nVisPos;
+ bool mbSelected:1;
+ bool mbHighlighted:1;
+ bool mbExpanded:1;
+ bool mbFocused:1;
+ bool mbSelectable:1;
+ bool mbDragTarget:1;
+
+public:
+ SvViewDataEntry();
+ SvViewDataEntry( const SvViewDataEntry& );
+ ~SvViewDataEntry();
+
+ bool IsSelected() const { return mbSelected;}
+ bool IsHighlighted() const { return mbHighlighted;}
+ bool IsExpanded() const { return mbExpanded;}
+ bool HasFocus() const { return mbFocused;}
+ bool IsSelectable() const { return mbSelectable;}
+ bool IsDragTarget() const { return mbDragTarget;}
+ void SetFocus( bool bFocus );
+ void SetSelected( bool bSelected );
+ void SetExpanded( bool bExpanded );
+ void SetSelectable( bool bSelectable );
+ void SetDragTarget( bool bDragTarget )
+ {
+ mbDragTarget = bDragTarget;
+ }
+
+ void Init(size_t nSize);
+
+ const SvViewDataItem& GetItem(size_t nPos) const;
+ SvViewDataItem& GetItem(size_t nPos);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx
new file mode 100644
index 000000000..58b43426e
--- /dev/null
+++ b/include/vcl/transfer.hxx
@@ -0,0 +1,521 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_TRANSFER_HXX
+#define INCLUDED_VCL_TRANSFER_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/globname.hxx>
+#include <tools/gen.hxx>
+#include <tools/solar.h>
+#include <sot/formats.hxx>
+#include <sot/exchange.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/datatransfer/XTransferable2.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
+#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
+#include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp>
+#include <com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp>
+#include <com/sun/star/datatransfer/dnd/DropTargetDropEvent.hpp>
+#include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp>
+#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <memory>
+#include <mutex>
+
+namespace com::sun::star::datatransfer::dnd { class XDragGestureRecognizer; }
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::datatransfer::dnd { class XDropTarget; }
+
+namespace tools { template <typename T> class SvRef; }
+template <typename Arg, typename Ret> class Link;
+
+class BitmapEx;
+class GDIMetaFile;
+class Graphic;
+class ImageMap;
+class INetBookmark;
+class INetImage;
+class FileList;
+class SotStorageStream;
+class SotTempStream;
+namespace vcl { class Window; }
+
+// Drag&Drop defines
+
+#define DND_ACTION_NONE css::datatransfer::dnd::DNDConstants::ACTION_NONE
+#define DND_ACTION_COPY css::datatransfer::dnd::DNDConstants::ACTION_COPY
+#define DND_ACTION_MOVE css::datatransfer::dnd::DNDConstants::ACTION_MOVE
+#define DND_ACTION_COPYMOVE css::datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE
+#define DND_ACTION_LINK css::datatransfer::dnd::DNDConstants::ACTION_LINK
+
+#define DND_POINTER_NONE 0
+#define DND_IMAGE_NONE 0
+
+struct TransferableObjectDescriptor
+{
+ SvGlobalName maClassName;
+ sal_uInt16 mnViewAspect;
+ Point maDragStartPos;
+ Size maSize;
+ OUString maTypeName;
+ OUString maDisplayName;
+
+ TransferableObjectDescriptor()
+ : mnViewAspect(css::embed::Aspects::MSOLE_CONTENT)
+ {}
+
+ VCL_DLLPUBLIC friend SvStream& WriteTransferableObjectDescriptor( SvStream& rOStm, const TransferableObjectDescriptor& rObjDesc );
+};
+
+struct AcceptDropEvent
+{
+ Point maPosPixel;
+ const css::datatransfer::dnd::DropTargetDragEvent maDragEvent;
+ sal_Int8 mnAction;
+ bool mbLeaving;
+ bool mbDefault;
+
+ AcceptDropEvent() :
+ mnAction( DND_ACTION_NONE ),
+ mbLeaving( false ),
+ mbDefault( false ) {}
+
+ AcceptDropEvent( sal_Int8 nAction,
+ const Point& rPosPixel,
+ const css::datatransfer::dnd::DropTargetDragEvent& rDragEvent ) :
+ maPosPixel( rPosPixel ),
+ maDragEvent( rDragEvent ),
+ mnAction( nAction ),
+ mbLeaving( false ),
+ mbDefault( false ) {}
+};
+
+struct ExecuteDropEvent
+{
+ Point maPosPixel;
+ const css::datatransfer::dnd::DropTargetDropEvent maDropEvent;
+ sal_Int8 mnAction;
+ bool mbDefault;
+
+ ExecuteDropEvent( sal_Int8 nAction,
+ const Point& rPosPixel,
+ const css::datatransfer::dnd::DropTargetDropEvent& rDropEvent ) :
+ maPosPixel( rPosPixel ),
+ maDropEvent( rDropEvent ),
+ mnAction( nAction ),
+ mbDefault( false ) {}
+};
+
+class VCL_DLLPUBLIC TransferableHelper : public cppu::WeakImplHelper< css::datatransfer::XTransferable2,
+ css::datatransfer::clipboard::XClipboardOwner,
+ css::datatransfer::dnd::XDragSourceListener,
+ css::lang::XUnoTunnel >
+{
+private:
+
+ // nested class to implement the XTerminateListener interface
+ class VCL_DLLPRIVATE TerminateListener final : public cppu::WeakImplHelper< css::frame::XTerminateListener, css::lang::XServiceInfo >
+ {
+ private:
+
+ TransferableHelper& mrParent;
+
+ private:
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const css::lang::EventObject& aEvent ) override;
+ virtual void SAL_CALL notifyTermination( const css::lang::EventObject& aEvent ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ public:
+
+ TerminateListener( TransferableHelper& rDropTargetHelper );
+ virtual ~TerminateListener() override;
+ };
+
+ friend class TransferableHelper::TerminateListener;
+
+private:
+
+ css::uno::Any maAny;
+ OUString maLastFormat;
+ mutable css::uno::Reference< css::datatransfer::clipboard::XClipboard > mxClipboard;
+ css::uno::Reference< css::frame::XTerminateListener > mxTerminateListener;
+ DataFlavorExVector maFormats;
+ std::unique_ptr<TransferableObjectDescriptor> mxObjDesc;
+
+protected:
+ ~TransferableHelper();
+
+ const css::uno::Reference< css::datatransfer::clipboard::XClipboard >&
+ getOwnClipboard() const { return mxClipboard; }
+
+public:
+
+ // XTransferable
+ virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() override;
+ virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& rFlavor ) override;
+
+ // Transferable2
+ virtual css::uno::Any SAL_CALL getTransferData2(
+ const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+ virtual sal_Bool SAL_CALL isComplex() override;
+
+private:
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XDragSourceListener
+ virtual void SAL_CALL dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent& dsde ) override;
+ virtual void SAL_CALL dragEnter( const css::datatransfer::dnd::DragSourceDragEvent& dsde ) override;
+ virtual void SAL_CALL dragExit( const css::datatransfer::dnd::DragSourceEvent& dse ) override;
+ virtual void SAL_CALL dragOver( const css::datatransfer::dnd::DragSourceDragEvent& dsde ) override;
+ virtual void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DragSourceDragEvent& dsde ) override;
+
+ // XClipboardOwner
+ virtual void SAL_CALL lostOwnership( const css::uno::Reference< css::datatransfer::clipboard::XClipboard >& xClipboard, const css::uno::Reference< css::datatransfer::XTransferable >& xTrans ) override;
+
+protected:
+ // derivees need to access lostOwnership in case hey override it
+ // on windows, changing the access rights to a method gives unresolved externals, so we introduce
+ // this impl-method here 'til the next incompatible update
+ void implCallOwnLostOwnership(
+ const css::uno::Reference< css::datatransfer::clipboard::XClipboard >& _rxClipboard,
+ const css::uno::Reference< css::datatransfer::XTransferable >& _rxTrans
+ )
+ {
+ TransferableHelper::lostOwnership( _rxClipboard, _rxTrans );
+ }
+
+
+private:
+
+ VCL_DLLPRIVATE void ImplFlush();
+
+protected:
+
+ void AddFormat( SotClipboardFormatId nFormat );
+ void AddFormat( const css::datatransfer::DataFlavor& rFlavor );
+ void RemoveFormat( SotClipboardFormatId nFormat );
+ void RemoveFormat( const css::datatransfer::DataFlavor& rFlavor );
+ bool HasFormat( SotClipboardFormatId nFormat );
+ void ClearFormats();
+
+ bool SetAny( const css::uno::Any& rAny );
+ bool SetString( const OUString& rString );
+ bool SetBitmapEx( const BitmapEx& rBitmap, const css::datatransfer::DataFlavor& rFlavor );
+ bool SetGDIMetaFile( const GDIMetaFile& rMtf );
+ bool SetGraphic( const Graphic& rGraphic );
+ bool SetImageMap( const ImageMap& rIMap );
+ bool SetTransferableObjectDescriptor( const TransferableObjectDescriptor& rDesc );
+ bool SetINetBookmark( const INetBookmark& rBmk, const css::datatransfer::DataFlavor& rFlavor );
+ bool SetINetImage( const INetImage& rINtImg, const css::datatransfer::DataFlavor& rFlavor );
+ bool SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor );
+
+protected:
+
+ virtual void AddSupportedFormats() = 0;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) = 0;
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor );
+ virtual void DragFinished( sal_Int8 nDropAction );
+ virtual void ObjectReleased();
+
+ void CopyToSelection(const css::uno::Reference<css::datatransfer::clipboard::XClipboard> &rClipboard) const;
+public:
+
+ void PrepareOLE( const TransferableObjectDescriptor& rObjDesc );
+
+ void CopyToClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard> &rClipboard) const;
+
+ // convenience versions of the above which extract the XClipboard from the pWindow
+ void CopyToClipboard( vcl::Window *pWindow ) const;
+ void CopyToPrimarySelection() const;
+
+ void StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions );
+
+ static void ClearPrimarySelection();
+
+ static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+public:
+
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override;
+};
+
+struct TransferableDataHelper_Impl;
+
+class VCL_DLLPUBLIC TransferableDataHelper final
+{
+ friend class DropTargetHelper;
+
+ css::uno::Reference< css::datatransfer::XTransferable > mxTransfer;
+ css::uno::Reference< css::datatransfer::clipboard::XClipboard > mxClipboard;
+ DataFlavorExVector maFormats;
+ std::unique_ptr<TransferableObjectDescriptor> mxObjDesc;
+ std::unique_ptr<TransferableDataHelper_Impl> mxImpl;
+
+ void InitFormats();
+
+public:
+
+ static void FillDataFlavorExVector( const css::uno::Sequence< css::datatransfer::DataFlavor >& rDataFlavorSeq,
+ DataFlavorExVector& rDataFlavorExVector );
+
+ TransferableDataHelper();
+ TransferableDataHelper( const TransferableDataHelper& rDataHelper );
+ TransferableDataHelper( TransferableDataHelper&& rDataHelper ) noexcept;
+ TransferableDataHelper( const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable );
+ ~TransferableDataHelper();
+
+ TransferableDataHelper& operator=( const TransferableDataHelper& rDataHelper );
+ TransferableDataHelper& operator=( TransferableDataHelper&& rDataHelper );
+
+ const css::uno::Reference< css::datatransfer::XTransferable >& GetTransferable() const { return mxTransfer; }
+ css::uno::Reference< css::datatransfer::XTransferable > GetXTransferable() const;
+
+ bool HasFormat( SotClipboardFormatId nFormat ) const;
+ bool HasFormat( const css::datatransfer::DataFlavor& rFlavor ) const;
+
+ sal_uInt32 GetFormatCount() const;
+
+ SotClipboardFormatId GetFormat( sal_uInt32 nFormat ) const;
+ css::datatransfer::DataFlavor GetFormatDataFlavor( sal_uInt32 nFormat ) const;
+
+ const DataFlavorExVector& GetDataFlavorExVector() const {return maFormats; }
+
+ bool StartClipboardListening( );
+ void StopClipboardListening( );
+
+ void Rebind( const css::uno::Reference< css::datatransfer::XTransferable >& _rxNewData );
+
+ css::uno::Any GetAny( SotClipboardFormatId nFormat, const OUString& rDestDoc ) const;
+ css::uno::Any GetAny( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) const;
+
+ bool GetString( SotClipboardFormatId nFormat, OUString& rStr ) const;
+ bool GetString( const css::datatransfer::DataFlavor& rFlavor, OUString& rStr ) const;
+
+ bool GetBitmapEx( SotClipboardFormatId nFormat, BitmapEx& rBmp ) const;
+ bool GetBitmapEx( const css::datatransfer::DataFlavor& rFlavor, BitmapEx& rBmp ) const;
+
+ /** Return as GDI metafile.
+
+ @param nMaxAction Allows you to limit the amount of actions; defaults to 0 which means no limit.
+
+ When you eg. Ctrl+a in Excel, you can get the entire sheet as
+ metafile, with over 3 million (!) actions; which is just too large for
+ any reasonable handling - and you need to set a limit.
+ */
+ bool GetGDIMetaFile( SotClipboardFormatId nFormat, GDIMetaFile& rMtf, size_t nMaxActions = 0 ) const;
+ bool GetGDIMetaFile( const css::datatransfer::DataFlavor& rFlavor, GDIMetaFile& rMtf ) const;
+
+ bool GetGraphic( SotClipboardFormatId nFormat, Graphic& rGraphic ) const;
+ bool GetGraphic( const css::datatransfer::DataFlavor& rFlavor, Graphic& rGraphic ) const;
+
+ bool GetImageMap( SotClipboardFormatId nFormat, ImageMap& rIMap ) const;
+ bool GetImageMap( const css::datatransfer::DataFlavor& rFlavor, ImageMap& rImap ) const;
+
+ bool GetTransferableObjectDescriptor( SotClipboardFormatId nFormat, TransferableObjectDescriptor& rDesc );
+ bool GetTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc );
+
+ bool GetINetBookmark( SotClipboardFormatId nFormat, INetBookmark& rBmk ) const;
+ bool GetINetBookmark( const css::datatransfer::DataFlavor& rFlavor, INetBookmark& rBmk ) const;
+
+ bool GetINetImage( SotClipboardFormatId nFormat, INetImage& rINtImg ) const;
+ bool GetINetImage( const css::datatransfer::DataFlavor& rFlavor, INetImage& rINtImg ) const;
+
+ bool GetFileList( SotClipboardFormatId nFormat, FileList& rFileList ) const;
+ bool GetFileList( FileList& rFileList ) const;
+
+ css::uno::Sequence<sal_Int8> GetSequence( SotClipboardFormatId nFormat, const OUString& rDestDoc ) const;
+ css::uno::Sequence<sal_Int8> GetSequence( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) const;
+
+ bool GetSotStorageStream( SotClipboardFormatId nFormat, tools::SvRef<SotTempStream>& rStreamRef ) const;
+ bool GetSotStorageStream( const css::datatransfer::DataFlavor& rFlavor, tools::SvRef<SotTempStream>& rStreamRef ) const;
+
+ css::uno::Reference<css::io::XInputStream> GetInputStream( SotClipboardFormatId nFormat, const OUString& rDestDoc ) const;
+ css::uno::Reference<css::io::XInputStream> GetInputStream( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) const;
+
+ static TransferableDataHelper CreateFromClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& rClipboard);
+ static TransferableDataHelper CreateFromSystemClipboard( vcl::Window * pWindow );
+ static TransferableDataHelper CreateFromPrimarySelection();
+ static bool IsEqual( const css::datatransfer::DataFlavor& rInternalFlavor,
+ const css::datatransfer::DataFlavor& rRequestFlavor );
+};
+
+class VCL_DLLPUBLIC DragSourceHelper
+{
+private:
+
+ // nested class to implement the XDragGestureListener interface
+ class SAL_DLLPRIVATE DragGestureListener final : public cppu::WeakImplHelper< css::datatransfer::dnd::XDragGestureListener >
+ {
+ private:
+
+ DragSourceHelper& mrParent;
+
+ private:
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XDragGestureListener
+ virtual void SAL_CALL dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& rDGE ) override;
+
+ public:
+
+ DragGestureListener( DragSourceHelper& rDragSourceHelper );
+ virtual ~DragGestureListener() override;
+ };
+
+ friend class DragSourceHelper::DragGestureListener;
+
+private:
+ std::mutex maMutex;
+ css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > mxDragGestureRecognizer;
+
+ css::uno::Reference< css::datatransfer::dnd::XDragGestureListener > mxDragGestureListener;
+
+ DragSourceHelper& operator=( const DragSourceHelper& rDragSourceHelper ) = delete;
+ bool operator==( const DragSourceHelper& rDragSourceHelper ) const = delete;
+
+public:
+
+ // to be overridden by the application
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ DragSourceHelper( vcl::Window* pWindow );
+ void dispose();
+ virtual ~DragSourceHelper();
+};
+
+class VCL_DLLPUBLIC DropTargetHelper
+{
+private:
+
+ // nested class to implement the XDropTargetListener interface
+ class SAL_DLLPRIVATE DropTargetListener final : public cppu::WeakImplHelper< css::datatransfer::dnd::XDropTargetListener >
+ {
+ private:
+
+ DropTargetHelper& mrParent;
+ std::unique_ptr<AcceptDropEvent> mpLastDragOverEvent;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XDropTargetListener
+ virtual void SAL_CALL drop( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) override;
+ virtual void SAL_CALL dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) override;
+ virtual void SAL_CALL dragExit( const css::datatransfer::dnd::DropTargetEvent& dte ) override;
+ virtual void SAL_CALL dragOver( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
+ virtual void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
+
+ public:
+
+ DropTargetListener( DropTargetHelper& rDropTargetHelper );
+ virtual ~DropTargetListener() override;
+ };
+
+ friend class DropTargetHelper::DropTargetListener;
+
+private:
+ std::mutex maMutex;
+ css::uno::Reference< css::datatransfer::dnd::XDropTarget > mxDropTarget;
+
+ css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > mxDropTargetListener;
+ DataFlavorExVector maFormats;
+
+ DropTargetHelper() = delete;
+ DropTargetHelper& operator=( const DropTargetHelper& rDropTargetHelper ) = delete;
+ bool operator==( const DropTargetHelper& rDropTargetHelper ) const = delete;
+
+ void ImplConstruct();
+
+ // called by our own implementation of XDropTargetListener (DropTargetListener instance)
+ void ImplBeginDrag( const css::uno::Sequence< css::datatransfer::DataFlavor >& rSupportedDataFlavors );
+ void ImplEndDrag();
+
+public:
+
+ // to be overridden by the application
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ DropTargetHelper( vcl::Window* pWindow );
+ DropTargetHelper( const css::uno::Reference< css::datatransfer::dnd::XDropTarget >& rxDropTarget );
+
+ void dispose();
+ virtual ~DropTargetHelper();
+
+ // typically called by the application in ::AcceptDrop and ::ExecuteDrop and (see above)
+ bool IsDropFormatSupported(SotClipboardFormatId nFormat) const;
+
+ const DataFlavorExVector& GetDataFlavorExVector() const {return maFormats; }
+
+};
+
+struct TransferDataContainer_Impl;
+
+class VCL_DLLPUBLIC TransferDataContainer : public TransferableHelper
+{
+ std::unique_ptr<TransferDataContainer_Impl> pImpl;
+
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+
+public:
+
+ TransferDataContainer();
+ virtual ~TransferDataContainer() override;
+
+ void CopyINetBookmark( const INetBookmark& rBkmk );
+ void CopyString( const OUString& rStr );
+ void CopyString( SotClipboardFormatId nFmt, const OUString& rStr );
+
+ void CopyByteString( SotClipboardFormatId nFormatId, const OString& rStr );
+ void CopyAnyData( SotClipboardFormatId nFormatId, const char* pData, sal_uLong nLen );
+
+ bool HasAnyData() const;
+
+ using TransferableHelper::StartDrag;
+ void StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions,
+ const Link<sal_Int8,void>& rCallback );
+ virtual void DragFinished( sal_Int8 nDropAction ) override;
+};
+
+css::uno::Reference<css::datatransfer::clipboard::XClipboard> VCL_DLLPUBLIC GetSystemClipboard();
+css::uno::Reference<css::datatransfer::clipboard::XClipboard> VCL_DLLPUBLIC GetSystemPrimarySelection();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/txtattr.hxx b/include/vcl/txtattr.hxx
new file mode 100644
index 000000000..186fbe1ad
--- /dev/null
+++ b/include/vcl/txtattr.hxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_TXTATTR_HXX
+#define INCLUDED_VCL_TXTATTR_HXX
+
+#include <tools/color.hxx>
+#include <tools/debug.hxx>
+#include <tools/fontenum.hxx>
+#include <vcl/dllapi.h>
+#include <memory>
+
+namespace vcl { class Font; }
+
+#define TEXTATTR_FONTCOLOR 1
+#define TEXTATTR_FONTWEIGHT 3
+
+#define TEXTATTR_USER_START 1000 //start id for user defined text attributes
+#define TEXTATTR_PROTECTED 4
+
+
+class VCL_DLLPUBLIC TextAttrib
+{
+private:
+ sal_uInt16 const mnWhich;
+
+protected:
+ TextAttrib( sal_uInt16 nWhich ) : mnWhich(nWhich) {}
+ TextAttrib( const TextAttrib& ) = default;
+
+public:
+
+ virtual ~TextAttrib();
+
+ sal_uInt16 Which() const { return mnWhich; }
+ virtual void SetFont( vcl::Font& rFont ) const = 0;
+ virtual std::unique_ptr<TextAttrib> Clone() const = 0;
+
+ virtual bool operator==( const TextAttrib& rAttr ) const = 0;
+ bool operator!=( const TextAttrib& rAttr ) const
+ { return !(*this == rAttr ); }
+};
+
+
+class VCL_DLLPUBLIC TextAttribFontColor final : public TextAttrib
+{
+private:
+ Color maColor;
+
+public:
+ TextAttribFontColor( const Color& rColor );
+
+ const Color& GetColor() const { return maColor; }
+
+ virtual void SetFont( vcl::Font& rFont ) const override;
+ virtual std::unique_ptr<TextAttrib> Clone() const override;
+ virtual bool operator==( const TextAttrib& rAttr ) const override;
+
+};
+
+class VCL_DLLPUBLIC TextAttribFontWeight final : public TextAttrib
+{
+private:
+ FontWeight meWeight;
+
+public:
+ TextAttribFontWeight( FontWeight eWeight );
+
+ virtual void SetFont( vcl::Font& rFont ) const override;
+ virtual std::unique_ptr<TextAttrib> Clone() const override;
+ virtual bool operator==( const TextAttrib& rAttr ) const override;
+
+ FontWeight getFontWeight() const { return meWeight; }
+};
+
+class TextAttribProtect final : public TextAttrib
+{
+public:
+ TextAttribProtect();
+
+ virtual void SetFont( vcl::Font& rFont ) const override;
+ virtual std::unique_ptr<TextAttrib> Clone() const override;
+ virtual bool operator==( const TextAttrib& rAttr ) const override;
+
+};
+
+
+class TextCharAttrib
+{
+private:
+ std::unique_ptr<TextAttrib>
+ mpAttr;
+ sal_Int32 mnStart;
+ sal_Int32 mnEnd;
+
+public:
+ TextCharAttrib( const TextAttrib& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
+ TextCharAttrib( const TextCharAttrib& rTextCharAttrib );
+
+ const TextAttrib& GetAttr() const { return *mpAttr; }
+
+ sal_uInt16 Which() const { return mpAttr->Which(); }
+
+ sal_Int32 GetStart() const { return mnStart; }
+ void SetStart(sal_Int32 n) { mnStart = n; }
+
+ sal_Int32 GetEnd() const { return mnEnd; }
+ void SetEnd(sal_Int32 n) { mnEnd = n; }
+
+ inline sal_Int32 GetLen() const;
+
+ inline void MoveForward( sal_Int32 nDiff );
+ inline void MoveBackward( sal_Int32 nDiff );
+
+ inline void Expand( sal_Int32 nDiff );
+ inline void Collaps( sal_Int32 nDiff );
+
+ inline bool IsIn( sal_Int32 nIndex ) const;
+ inline bool IsInside( sal_Int32 nIndex ) const;
+ inline bool IsEmpty() const;
+
+};
+
+inline sal_Int32 TextCharAttrib::GetLen() const
+{
+ DBG_ASSERT( mnEnd >= mnStart, "TextCharAttrib: nEnd < nStart!" );
+ return mnEnd-mnStart;
+}
+
+inline void TextCharAttrib::MoveForward( sal_Int32 nDiff )
+{
+ DBG_ASSERT( nDiff <= SAL_MAX_INT32-mnEnd, "TextCharAttrib: MoveForward?!" );
+ mnStart = mnStart + nDiff;
+ mnEnd = mnEnd + nDiff;
+}
+
+inline void TextCharAttrib::MoveBackward( sal_Int32 nDiff )
+{
+ DBG_ASSERT( mnStart >= nDiff, "TextCharAttrib: MoveBackward?!" );
+ mnStart = mnStart - nDiff;
+ mnEnd = mnEnd - nDiff;
+}
+
+inline void TextCharAttrib::Expand( sal_Int32 nDiff )
+{
+ DBG_ASSERT( nDiff <= SAL_MAX_INT32-mnEnd, "TextCharAttrib: Expand?!" );
+ mnEnd = mnEnd + nDiff;
+}
+
+inline void TextCharAttrib::Collaps( sal_Int32 nDiff )
+{
+ DBG_ASSERT( mnEnd-mnStart >= nDiff, "TextCharAttrib: Collaps?!" );
+ mnEnd = mnEnd - nDiff;
+}
+
+inline bool TextCharAttrib::IsIn( sal_Int32 nIndex ) const
+{
+ return ( ( mnStart <= nIndex ) && ( mnEnd >= nIndex ) );
+}
+
+inline bool TextCharAttrib::IsInside( sal_Int32 nIndex ) const
+{
+ return ( ( mnStart < nIndex ) && ( mnEnd > nIndex ) );
+}
+
+inline bool TextCharAttrib::IsEmpty() const
+{
+ return mnStart == mnEnd;
+}
+
+#endif // INCLUDED_VCL_TXTATTR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/uitest/eventdescription.hxx b/include/vcl/uitest/eventdescription.hxx
new file mode 100644
index 000000000..47bf9e117
--- /dev/null
+++ b/include/vcl/uitest/eventdescription.hxx
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_UITEST_EVENTDESCRIPTION_HXX
+#define INCLUDED_VCL_UITEST_EVENTDESCRIPTION_HXX
+
+#include <rtl/ustring.hxx>
+#include <map>
+
+struct EventDescription
+{
+ OUString aKeyWord, aAction, aID, aParent;
+ std::map<OUString, OUString> aParameters;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/uitest/factory.hxx b/include/vcl/uitest/factory.hxx
new file mode 100644
index 000000000..e51427876
--- /dev/null
+++ b/include/vcl/uitest/factory.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_UITEST_FACTORY_HXX
+#define INCLUDED_VCL_UITEST_FACTORY_HXX
+
+#include <memory>
+#include <functional>
+
+namespace vcl
+{
+class Window;
+}
+
+class UIObject;
+
+typedef std::function<std::unique_ptr<UIObject>(vcl::Window*)> FactoryFunction;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/uitest/formattedfielduiobject.hxx b/include/vcl/uitest/formattedfielduiobject.hxx
new file mode 100644
index 000000000..0bbc95c75
--- /dev/null
+++ b/include/vcl/uitest/formattedfielduiobject.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_UITEST_FORMATTEDFIELDUIOBJECT_HXX
+#define INCLUDED_VCL_UITEST_FORMATTEDFIELDUIOBJECT_HXX
+
+#include <vcl/uitest/uiobject.hxx>
+
+class FormattedField;
+
+class FormattedFieldUIObject final : public SpinFieldUIObject
+{
+ VclPtr<FormattedField> mxFormattedField;
+
+public:
+ FormattedFieldUIObject(const VclPtr<FormattedField>& xEdit);
+ virtual ~FormattedFieldUIObject() override;
+
+ virtual void execute(const OUString& rAction, const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+private:
+ virtual OUString get_name() const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/uitest/logger.hxx b/include/vcl/uitest/logger.hxx
new file mode 100644
index 000000000..c810b7eb7
--- /dev/null
+++ b/include/vcl/uitest/logger.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_UITEST_LOGGER_HXX
+#define INCLUDED_VCL_UITEST_LOGGER_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <vcl/dllapi.h>
+
+#include <tools/stream.hxx>
+#include <vcl/vclevent.hxx>
+
+namespace com::sun::star::beans
+{
+struct PropertyValue;
+}
+namespace com::sun::star::uno
+{
+template <class E> class Sequence;
+}
+struct EventDescription;
+class Control;
+class KeyEvent;
+
+class UITEST_DLLPUBLIC UITestLogger
+{
+private:
+ SvFileStream maStream;
+
+ bool mbValid;
+
+ OUString app_name;
+
+public:
+ UITestLogger();
+
+ void logCommand(std::u16string_view rAction,
+ const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
+
+ void logAction(VclPtr<Control> const& xUIElement, VclEventId nEvent);
+
+ void logAction(vcl::Window* const& xUIWin, VclEventId nEvent);
+
+ void log(std::u16string_view rString);
+
+ void logKeyInput(VclPtr<vcl::Window> const& xUIElement, const KeyEvent& rEvent);
+
+ void logEvent(const EventDescription& rDescription);
+
+ static UITestLogger& getInstance();
+
+ void setAppName(OUString name) { app_name = name; }
+
+ const OUString& getAppName() const { return app_name; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/uitest/metricfielduiobject.hxx b/include/vcl/uitest/metricfielduiobject.hxx
new file mode 100644
index 000000000..f45da7723
--- /dev/null
+++ b/include/vcl/uitest/metricfielduiobject.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_UITEST_METRICFIELDUIOBJECT_HXX
+#define INCLUDED_VCL_UITEST_METRICFIELDUIOBJECT_HXX
+
+#include <vcl/uitest/uiobject.hxx>
+
+class MetricField;
+
+class MetricFieldUIObject final : public SpinFieldUIObject
+{
+ VclPtr<MetricField> mxMetricField;
+
+public:
+ MetricFieldUIObject(const VclPtr<MetricField>& xEdit);
+ virtual ~MetricFieldUIObject() override;
+
+ virtual void execute(const OUString& rAction, const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+private:
+ virtual OUString get_name() const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
new file mode 100644
index 000000000..c9a932ec6
--- /dev/null
+++ b/include/vcl/uitest/uiobject.hxx
@@ -0,0 +1,589 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_UITEST_UIOBJECT_HXX
+#define INCLUDED_VCL_UITEST_UIOBJECT_HXX
+
+#include <rtl/ustring.hxx>
+#include <map>
+#include <memory>
+
+#include <vcl/vclevent.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/window.hxx>
+
+#include <set>
+
+class Button;
+class CheckBox;
+class ComboBox;
+class Dialog;
+class Edit;
+class IconView;
+class ListBox;
+class RadioButton;
+class TabControl;
+class TabPage;
+class SvTreeListBox;
+class SvTreeListEntry;
+class SpinButton;
+class SpinField;
+class VerticalTabControl;
+class VclExpander;
+class VclDrawingArea;
+class VclMultiLineEdit;
+class MenuButton;
+class ToolBox;
+namespace vcl { class Window; }
+namespace weld { class CustomWidgetController; }
+
+typedef std::map<OUString, OUString> StringMap;
+
+/**
+ * This class wraps a UI object like vcl::Window and provides
+ * an interface for the UI testing.
+ *
+ * This class should only have virtual methods.
+ */
+class UITEST_DLLPUBLIC UIObject
+{
+ UIObject(UIObject const &) = delete;
+ UIObject& operator =(UIObject const &) = delete;
+
+public:
+ UIObject() = default;
+
+ virtual ~UIObject();
+
+ /**
+ * Returns the state of the wrapped UI object as a
+ * string key value map.
+ */
+ virtual StringMap get_state();
+
+ /**
+ * Executes an action on the wrapped UI object,
+ * possibly with some additional parameters
+ */
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters);
+
+ /**
+ * Returns the type of the UIObject. Additional information might
+ * be available through UIObject::get_state().
+ */
+ virtual OUString get_type() const;
+
+ /**
+ * Returns the child of the current UIObject with the corresponding id.
+ * If no object with that id is being found returns a nullptr.
+ *
+ */
+ virtual std::unique_ptr<UIObject> get_child(const OUString& rID);
+
+ /**
+ * Returns a set containing all descendants of the object.
+ */
+ virtual std::set<OUString> get_children() const;
+
+ /**
+ * Currently an internal method to dump the state of the current UIObject as represented by get_state().
+ *
+ * This method should not be exposed to the outside world.
+ *
+ */
+ virtual OUString dumpState() const;
+
+ /**
+ * Currently an internal method to dump the parent-child relationship starting from the current top focus window.
+ *
+ * This method should not be exposed to the outside world.
+ *
+ */
+ virtual OUString dumpHierarchy() const;
+
+ /**
+ * Gets the corresponding Action string for the event.
+ */
+ virtual OUString get_action(VclEventId nEvent) const;
+};
+
+class UITEST_DLLPUBLIC WindowUIObject : public UIObject
+{
+ VclPtr<vcl::Window> mxWindow;
+
+public:
+
+ WindowUIObject(const VclPtr<vcl::Window>& xWindow);
+
+ virtual StringMap get_state() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual OUString get_type() const override;
+
+ virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override;
+
+ std::unique_ptr<UIObject> get_visible_child(const OUString& rID);
+
+ virtual std::set<OUString> get_children() const override;
+
+ virtual OUString dumpState() const override;
+
+ virtual OUString dumpHierarchy() const override;
+
+ virtual OUString get_action(VclEventId nEvent) const override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+protected:
+
+ virtual OUString get_name() const;
+
+};
+
+// TODO: moggi: what about push buttons?
+class ButtonUIObject final : public WindowUIObject
+{
+ VclPtr<Button> mxButton;
+public:
+
+ ButtonUIObject(const VclPtr<Button>& xButton);
+ virtual ~ButtonUIObject() override;
+
+ virtual StringMap get_state() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual OUString get_action(VclEventId nEvent) const override;
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class DialogUIObject final : public WindowUIObject
+{
+ VclPtr<Dialog> mxDialog;
+
+public:
+
+ DialogUIObject(const VclPtr<Dialog>& xDialog);
+ virtual ~DialogUIObject() override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class EditUIObject : public WindowUIObject
+{
+ VclPtr<Edit> mxEdit;
+
+public:
+
+ EditUIObject(const VclPtr<Edit>& xEdit);
+ virtual ~EditUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual OUString get_action(VclEventId nEvent) const override;
+
+protected:
+
+ virtual OUString get_name() const override;
+};
+
+class MultiLineEditUIObject final : public WindowUIObject
+{
+ VclPtr<VclMultiLineEdit> mxEdit;
+
+public:
+
+ MultiLineEditUIObject(const VclPtr<VclMultiLineEdit>& xEdit);
+ virtual ~MultiLineEditUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class ExpanderUIObject : public WindowUIObject
+{
+ VclPtr<VclExpander> mxExpander;
+
+public:
+
+ ExpanderUIObject(const VclPtr<VclExpander>& xExpander);
+ virtual ~ExpanderUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+private:
+
+ virtual OUString get_name() const override;
+};
+
+
+// TODO: moggi: maybe let it inherit from the button case
+class CheckBoxUIObject final : public WindowUIObject
+{
+private:
+ VclPtr<CheckBox> mxCheckBox;
+
+public:
+ CheckBoxUIObject(const VclPtr<CheckBox>& xCheckbox);
+ virtual ~CheckBoxUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual OUString get_action(VclEventId nEvent) const override;
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class RadioButtonUIObject final : public WindowUIObject
+{
+private:
+ VclPtr<RadioButton> mxRadioButton;
+
+public:
+ RadioButtonUIObject(const VclPtr<RadioButton>& xCheckbox);
+ virtual ~RadioButtonUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual OUString get_action(VclEventId nEvent) const override;
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class TabPageUIObject final : public WindowUIObject
+{
+private:
+ VclPtr<TabPage> mxTabPage;
+public:
+ TabPageUIObject(const VclPtr<TabPage>& xTabPage);
+ virtual ~TabPageUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class ListBoxUIObject final : public WindowUIObject
+{
+private:
+ VclPtr<ListBox> mxListBox;
+
+public:
+
+ ListBoxUIObject(const VclPtr<ListBox>& xListBox);
+ virtual ~ListBoxUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual OUString get_action(VclEventId nEvent) const override;
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+// TODO: moggi: should it inherit from EditUIObject?
+class ComboBoxUIObject final : public WindowUIObject
+{
+private:
+ VclPtr<ComboBox> mxComboBox;
+
+public:
+
+ ComboBoxUIObject(const VclPtr<ComboBox>& xListBox);
+ virtual ~ComboBoxUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual OUString get_action(VclEventId nEvent) const override;
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class SpinUIObject final : public WindowUIObject
+{
+private:
+ VclPtr<SpinButton> mxSpinButton;
+
+public:
+
+ SpinUIObject(const VclPtr<SpinButton>& xSpinButton);
+ virtual ~SpinUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual OUString get_action(VclEventId nEvent) const override;
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class SpinFieldUIObject : public EditUIObject
+{
+ VclPtr<SpinField> mxSpinField;
+
+public:
+
+ SpinFieldUIObject(const VclPtr<SpinField>& xEdit);
+ virtual ~SpinFieldUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual OUString get_action(VclEventId nEvent) const override;
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class TabControlUIObject final : public WindowUIObject
+{
+private:
+ VclPtr<TabControl> mxTabControl;
+
+public:
+
+ TabControlUIObject(const VclPtr<TabControl>& mxTabControl);
+ virtual ~TabControlUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual OUString get_action(VclEventId nEvent) const override;
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class VerticalTabControlUIObject final : public WindowUIObject
+{
+private:
+ VclPtr<VerticalTabControl> mxTabControl;
+
+public:
+
+ VerticalTabControlUIObject(const VclPtr<VerticalTabControl>& mxTabControl);
+ virtual ~VerticalTabControlUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class TreeListUIObject : public WindowUIObject
+{
+public:
+ TreeListUIObject(const VclPtr<SvTreeListBox>& xTreeList);
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override;
+
+ virtual std::set<OUString> get_children() const override;
+
+protected:
+
+ virtual OUString get_name() const override;
+
+ VclPtr<SvTreeListBox> mxTreeList;
+};
+
+class TreeListEntryUIObject final : public UIObject
+{
+public:
+
+ TreeListEntryUIObject(const VclPtr<SvTreeListBox>& xTreeList, SvTreeListEntry* pEntry);
+
+ virtual StringMap get_state() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override;
+
+ virtual std::set<OUString> get_children() const override;
+
+ virtual OUString get_type() const override;
+
+private:
+
+ VclPtr<SvTreeListBox> mxTreeList;
+
+ SvTreeListEntry* const mpEntry;
+};
+
+class IconViewUIObject final : public TreeListUIObject
+{
+public:
+ IconViewUIObject(const VclPtr<SvTreeListBox>& xIconView);
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class ToolBoxUIObject final : public WindowUIObject
+{
+private:
+ VclPtr<ToolBox> mxToolBox;
+
+public:
+
+ ToolBoxUIObject(const VclPtr<ToolBox>& mxToolBox);
+ virtual ~ToolBoxUIObject() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+ virtual OUString get_action(VclEventId nEvent) const override;
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class MenuButtonUIObject final : public WindowUIObject
+{
+ VclPtr<MenuButton> mxMenuButton;
+
+public:
+
+ MenuButtonUIObject(const VclPtr<MenuButton>& xMenuButton);
+ virtual ~MenuButtonUIObject() override;
+
+ virtual StringMap get_state() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
+class UITEST_DLLPUBLIC DrawingAreaUIObject : public WindowUIObject
+{
+private:
+ VclPtr<VclDrawingArea> mxDrawingArea;
+protected:
+ weld::CustomWidgetController* mpController;
+public:
+ DrawingAreaUIObject(const VclPtr<vcl::Window>& rDrawingArea);
+ virtual ~DrawingAreaUIObject() override;
+ virtual void execute(const OUString& rAction, const StringMap& rParameters) override;
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/uitest/uitest.hxx b/include/vcl/uitest/uitest.hxx
new file mode 100644
index 000000000..53bdded59
--- /dev/null
+++ b/include/vcl/uitest/uitest.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_UITEST_UITEST_HXX
+#define INCLUDED_VCL_UITEST_UITEST_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <memory>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+
+class UIObject;
+
+class UITest
+{
+public:
+
+ static bool executeCommand(const OUString& rCommand);
+
+ static bool executeCommandWithParameters(const OUString& rCommand,
+ const css::uno::Sequence< css::beans::PropertyValue >& rArgs);
+
+ static bool executeDialog(const OUString& rCommand);
+
+ static std::unique_ptr<UIObject> getFocusTopWindow();
+
+ static std::unique_ptr<UIObject> getFloatWindow();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/unohelp.hxx b/include/vcl/unohelp.hxx
new file mode 100644
index 000000000..c7b9dcc06
--- /dev/null
+++ b/include/vcl/unohelp.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_UNOHELP_HXX
+#define INCLUDED_VCL_UNOHELP_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <tools/fontenum.hxx>
+#include <vcl/dllapi.h>
+
+namespace com::sun::star::i18n {
+ class XBreakIterator;
+ class XCharacterClassification;
+}
+namespace com::sun::star::accessibility {
+ struct AccessibleEventObject;
+}
+
+namespace vcl::unohelper
+{
+VCL_DLLPUBLIC css::uno::Reference < css::i18n::XBreakIterator > CreateBreakIterator();
+css::uno::Reference < css::i18n::XCharacterClassification> CreateCharacterClassification();
+VCL_DLLPUBLIC float ConvertFontWidth( FontWidth eWidth );
+VCL_DLLPUBLIC FontWidth ConvertFontWidth( float f );
+VCL_DLLPUBLIC float ConvertFontWeight( FontWeight eWeight );
+VCL_DLLPUBLIC FontWeight ConvertFontWeight( float f );
+VCL_DLLPUBLIC css::awt::FontSlant ConvertFontSlant( FontItalic eWeight );
+VCL_DLLPUBLIC FontItalic ConvertFontSlant( css::awt::FontSlant );
+} // namespace vcl::unohelper
+
+#endif // INCLUDED_VCL_UNOHELP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/unohelp2.hxx b/include/vcl/unohelp2.hxx
new file mode 100644
index 000000000..978c31ecf
--- /dev/null
+++ b/include/vcl/unohelp2.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_UNOHELP2_HXX
+#define INCLUDED_VCL_UNOHELP2_HXX
+
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <cppuhelper/weak.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/IDialogRenderable.hxx>
+
+namespace com::sun::star::datatransfer::clipboard {
+ class XClipboard;
+}
+
+namespace vcl::unohelper {
+
+ class VCL_DLLPUBLIC TextDataObject final :
+ public css::datatransfer::XTransferable,
+ public ::cppu::OWeakObject
+ {
+ private:
+ OUString maText;
+
+ public:
+ TextDataObject( const OUString& rText );
+ virtual ~TextDataObject() override;
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); }
+ void SAL_CALL release() noexcept override { OWeakObject::release(); }
+
+ // css::datatransfer::XTransferable
+ css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) override;
+ css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) override;
+ sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor ) override;
+
+ /// copies a given string to a given clipboard
+ static void CopyStringTo(
+ const OUString& rContent,
+ const css::uno::Reference< css::datatransfer::clipboard::XClipboard >& rxClipboard,
+ const vcl::ILibreOfficeKitNotifier* pNotifier = nullptr
+ );
+ };
+
+} // namespace vcl::unohelper
+
+#endif // INCLUDED_VCL_UNOHELP2_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx
new file mode 100644
index 000000000..6e0359fa2
--- /dev/null
+++ b/include/vcl/vclenum.hxx
@@ -0,0 +1,418 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_VCLENUM_HXX
+#define INCLUDED_VCL_VCLENUM_HXX
+
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+
+enum class SelectionMode { NONE, Single, Range, Multiple };
+
+enum class TimeFieldFormat : sal_Int32 { F_NONE, F_SEC, F_SEC_CS };
+
+enum class MenuItemType { DONTKNOW, STRING, IMAGE, STRINGIMAGE, SEPARATOR };
+
+enum class MenuItemBits : sal_Int16
+{
+ NONE = 0x0000,
+ CHECKABLE = 0x0001,
+ RADIOCHECK = 0x0002,
+ AUTOCHECK = 0x0004,
+ HELP = 0x0010,
+ POPUPSELECT = 0x0020,
+ // These have been said to be a preliminary (sic) solution since 2007
+ NOSELECT = 0x0040,
+ ICON = 0x0080,
+ TEXT = 0x0100,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<MenuItemBits> : is_typed_flags<MenuItemBits, 0x1f7> {};
+}
+
+enum class ToolBoxItemBits
+{
+ NONE = 0x0000,
+ CHECKABLE = 0x0001,
+ RADIOCHECK = 0x0002,
+ AUTOCHECK = 0x0004,
+ LEFT = 0x0008,
+ AUTOSIZE = 0x0010,
+ DROPDOWN = 0x0020,
+ REPEAT = 0x0040,
+ DROPDOWNONLY = 0x00a0, // 0x0080 | DROPDOWN
+ TEXT_ONLY = 0x0100,
+ ICON_ONLY = 0x0200
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ToolBoxItemBits> : is_typed_flags<ToolBoxItemBits, 0x3ff> {};
+}
+
+enum class ToolBoxItemType { DONTKNOW, BUTTON, SPACE, SEPARATOR, BREAK };
+
+enum class ButtonType { SYMBOLONLY, TEXT, SYMBOLTEXT };
+
+enum class SymbolType : sal_uInt16
+{
+ DONTKNOW = 0,
+ IMAGE = 1,
+ ARROW_UP = 2,
+ ARROW_DOWN = 3,
+ ARROW_LEFT = 4,
+ ARROW_RIGHT = 5,
+ SPIN_UP = 6,
+ SPIN_DOWN = 7,
+ SPIN_LEFT = 8,
+ SPIN_RIGHT = 9,
+ FIRST = 10,
+ LAST = 11,
+ PREV = 12,
+ NEXT = 13,
+ PAGEUP = 14,
+ PAGEDOWN = 15,
+ PLAY = 16,
+ STOP = 19,
+ CLOSE = 25,
+ CHECKMARK = 28,
+ RADIOCHECKMARK = 29,
+ FLOAT = 31,
+ DOCK = 32,
+ HIDE = 33,
+ HELP = 34,
+ PLUS = 35,
+ MENU = SymbolType::SPIN_DOWN
+};
+
+
+// Border styles for SetBorder()
+enum class WindowBorderStyle : sal_Int16
+{
+ NONE = 0x0000,
+ NORMAL = 0x0001,
+ MONO = 0x0002,
+ MENU = 0x0010,
+ NWF = 0x0020,
+ NOBORDER = 0x1000,
+ REMOVEBORDER = 0x2000
+};
+namespace o3tl
+{
+ template<> struct typed_flags<WindowBorderStyle> : is_typed_flags<WindowBorderStyle, 0x3033> {};
+}
+
+enum class WindowStateMask {
+ NONE = 0x0000,
+ X = 0x0001,
+ Y = 0x0002,
+ Width = 0x0004,
+ Height = 0x0008,
+ State = 0x0010,
+ Minimized = 0x0020,
+ MaximizedX = 0x0100,
+ MaximizedY = 0x0200,
+ MaximizedWidth = 0x0400,
+ MaximizedHeight = 0x0800,
+ Pos = X | Y,
+ Size = Width | Height,
+ All = X | Y | Width | Height | MaximizedX | MaximizedY | MaximizedWidth | MaximizedHeight | State | Minimized
+};
+namespace o3tl
+{
+ template<> struct typed_flags<WindowStateMask> : is_typed_flags<WindowStateMask, 0x0f3f> {};
+}
+
+enum class TimeFormat
+{
+ Hour12, Hour24
+};
+
+enum class ExtTimeFieldFormat
+{
+ /** the first 4 of these are only used by base/dbaccess */
+ Short24H, Long24H,
+ Short12H, Long12H,
+ ShortDuration, LongDuration
+};
+
+enum class ExtDateFieldFormat
+{
+ SystemShort, SystemShortYY, SystemShortYYYY,
+ SystemLong,
+ ShortDDMMYY, ShortMMDDYY, ShortYYMMDD,
+ ShortDDMMYYYY, ShortMMDDYYYY, ShortYYYYMMDD,
+ ShortYYMMDD_DIN5008, ShortYYYYMMDD_DIN5008,
+ FORCE_EQUAL_SIZE=SAL_MAX_ENUM
+};
+
+// this appears to be a direct copy of css::awt::GradientStyle
+enum class GradientStyle
+{
+ Linear = 0,
+ Axial = 1,
+ Radial = 2,
+ Elliptical = 3,
+ Square = 4,
+ Rect = 5,
+ FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+enum class HatchStyle
+{
+ Single = 0,
+ Double = 1,
+ Triple = 2,
+ FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+enum class LineStyle
+{
+ NONE = 0,
+ Solid = 1,
+ Dash = 2,
+ FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+typedef sal_uInt32 sal_UCS4; // TODO: this should be moved to rtl
+
+enum class OutDevSupportType { TransparentRect, B2DDraw };
+
+struct ItalicMatrix
+{
+ double xx, xy, yx, yy;
+ ItalicMatrix() : xx(1), xy(0), yx(0), yy(1) {}
+};
+
+inline bool operator ==(const ItalicMatrix& a, const ItalicMatrix& b)
+{
+ return a.xx == b.xx && a.xy == b.xy && a.yx == b.yx && a.yy == b.yy;
+}
+
+inline bool operator !=(const ItalicMatrix& a, const ItalicMatrix& b)
+{
+ return !(a == b);
+}
+
+enum class VclAlign
+{
+ Fill,
+ Start,
+ End,
+ Center
+};
+
+enum class VclPackType
+{
+ Start = 0,
+ End = 1,
+ LAST = End
+};
+
+// Return Values from Dialog::Execute
+//!!! in case of changes adjust /basic/source/runtime/methods.cxx msgbox
+
+enum VclResponseType
+{
+ RET_CANCEL = 0,
+ RET_OK = 1,
+ RET_YES = 2,
+ RET_NO = 3,
+ RET_RETRY = 4,
+ RET_IGNORE = 5,
+ RET_CLOSE = 7,
+ RET_HELP = 10
+};
+
+enum class VclButtonsType
+{
+ NONE,
+ Ok,
+ Close,
+ Cancel,
+ YesNo,
+ OkCancel
+};
+
+enum class VclMessageType
+{
+ Info,
+ Warning,
+ Question,
+ Error,
+ Other
+};
+
+enum class VclSizeGroupMode
+{
+ NONE,
+ Horizontal,
+ Vertical,
+ Both
+};
+
+enum class VclPolicyType
+{
+ ALWAYS,
+ AUTOMATIC,
+ NEVER
+};
+
+enum class WizardButtonFlags : sal_Int16
+{
+ NONE = 0x0000,
+ NEXT = 0x0001,
+ PREVIOUS = 0x0002,
+ FINISH = 0x0004,
+ CANCEL = 0x0008,
+ HELP = 0x0010,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<WizardButtonFlags> : is_typed_flags<WizardButtonFlags, 0x001f> {};
+}
+
+// small, large, size32 force an exact toolbox size for proper alignment
+// DontCare will let the toolbox decide about its size
+enum class ToolBoxButtonSize
+{
+ DontCare,
+ Small,
+ Large,
+ Size32,
+};
+
+enum class WindowStateState {
+ NONE = 0x0000,
+ Normal = 0x0001,
+ Minimized = 0x0002,
+ Maximized = 0x0004,
+ // Rollup is no longer used, but retained because WindowStateState is serialized
+ // from/to strings describing window state that are stored in a users config
+ Rollup = 0x0008,
+ MaximizedHorz = 0x0010,
+ MaximizedVert = 0x0020,
+ FullScreen = 0x0040,
+ SystemMask = 0xffff
+};
+namespace o3tl
+{
+ template<> struct typed_flags<WindowStateState> : is_typed_flags<WindowStateState, 0xffff> {};
+}
+
+namespace vcl
+{
+ // The exact sizes of the icons in each size grouping are not necessarily
+ // the exact size indicated by the name, but the upper limit of their size.
+ // e.g. many Size26 icons are often 24x24px and only some 26x26px
+ enum class ImageType
+ {
+ Size16,
+ Size26,
+ Size32,
+ Small = Size16,
+ LAST = Size32,
+ };
+}
+
+enum class DrawFrameStyle
+{
+ NONE = 0x0000,
+ In = 0x0001,
+ Out = 0x0002,
+ Group = 0x0003,
+ DoubleIn = 0x0004,
+ DoubleOut = 0x0005,
+ NWF = 0x0006,
+};
+
+// Flags for DrawFrame()
+enum class DrawFrameFlags
+{
+ NONE = 0x0000,
+ Menu = 0x0010,
+ WindowBorder = 0x0020,
+ BorderWindowBorder = 0x0040,
+ Mono = 0x1000,
+ NoDraw = 0x8000,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<DrawFrameFlags> : is_typed_flags<DrawFrameFlags, 0x9070> {};
+}
+
+enum class TxtAlign
+{
+ Left,
+ Center,
+ Right
+};
+
+enum class FloatWinPopupFlags
+{
+ NONE = 0x000000,
+ AllowTearOff = 0x000001,
+ Down = 0x000002,
+ Up = 0x000004,
+ Left = 0x000008,
+ Right = 0x000010,
+ NoKeyClose = 0x000020,
+ AllMouseButtonClose = 0x000040,
+ NoAppFocusClose = 0x000080,
+ NewLevel = 0x000100,
+ NoMouseUpClose = 0x000200,
+ GrabFocus = 0x000400,
+ NoHorzPlacement = 0x000800,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<FloatWinPopupFlags> : is_typed_flags<FloatWinPopupFlags, 0x0fff> {};
+}
+
+// Flags for Window::Show()
+enum class ShowFlags
+{
+ NONE = 0x0000,
+ NoFocusChange = 0x0002,
+ NoActivate = 0x0004,
+ ForegroundTask = 0x0008,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ShowFlags> : is_typed_flags<ShowFlags, 0x000e> {};
+}
+
+enum class TrackingEventFlags
+{
+ NONE = 0x0000,
+ Cancel = 0x0001,
+ Key = 0x0002,
+ Focus = 0x0004,
+ Repeat = 0x0100,
+ End = 0x1000,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<TrackingEventFlags> : is_typed_flags<TrackingEventFlags, 0x1107> {};
+}
+
+#endif // INCLUDED_VCL_VCLENUM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/vclevent.hxx b/include/vcl/vclevent.hxx
new file mode 100644
index 000000000..a0a11c6a0
--- /dev/null
+++ b/include/vcl/vclevent.hxx
@@ -0,0 +1,220 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_VCLEVENT_HXX
+#define INCLUDED_VCL_VCLEVENT_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/vclptr.hxx>
+
+class Menu;
+
+namespace com::sun::star::accessibility {
+ class XAccessible;
+}
+
+namespace vcl
+{
+ class Window;
+}
+
+enum class VclEventId
+{
+ NONE,
+ ApplicationDataChanged, // pData = DataChangedEvent*
+ ButtonClick,
+ CheckboxToggle,
+ ComboboxDeselect,
+ ComboboxDoubleClick,
+ ComboboxItemAdded, // pData = itempos
+ ComboboxItemRemoved, // pData = itempos, -1=All
+ ComboboxSelect,
+ ComboboxSetText,
+ ControlGetFocus,
+ ControlLoseFocus,
+ DropdownClose,
+ DropdownOpen,
+ DropdownPreOpen,
+ DropdownSelect,
+ EditCaretChanged,
+ EditModify,
+ EditSelectionChanged,
+ ExtTextInput,
+ EndExtTextInput,
+ ItemCollapsed,
+ ItemExpanded,
+ ListboxDoubleClick,
+ ListboxFocus,
+ ListboxItemAdded, // pData = itempos
+ ListboxItemRemoved, // pData = itempos, -1=All
+ ListboxScrolled,
+ ListboxSelect,
+ ListboxTreeFocus,
+ ListboxTreeSelect,
+ MenuAccessibleNameChanged,
+ MenuActivate,
+ MenuDeactivate,
+ MenuDehighlight,
+ MenuDisable,
+ MenuEnable,
+ MenuHide,
+ MenuHighlight,
+ MenuInsertItem,
+ MenuItemChecked,
+ MenuItemTextChanged,
+ MenuItemUnchecked,
+ MenuRemoveItem,
+ MenuSelect,
+ MenuShow,
+ MenuSubmenuActivate,
+ MenuSubmenuChanged,
+ MenuSubmenuDeactivate,
+ ObjectDying,
+ PushbuttonToggle,
+ RadiobuttonToggle,
+ RoadmapItemSelected,
+ ScrollbarEndScroll,
+ ScrollbarScroll,
+ SpinbuttonDown,
+ SpinbuttonUp,
+ SpinfieldDown,
+ SpinfieldFirst,
+ SpinfieldLast,
+ SpinfieldUp,
+ StatusbarAllItemsRemoved,
+ StatusbarDrawItem, // pData = itemid
+ StatusbarHideItem, // pData = itemid
+ StatusbarItemAdded, // pData = itemid
+ StatusbarItemRemoved, // pData = itemid
+ StatusbarNameChanged, // pData = itemid
+ StatusbarShowItem, // pData = itemid
+ TabbarPageActivated, // pData = pageid
+ TabbarPageDeactivated, // pData = pageid
+ TabbarPageInserted, // pData = pageid
+ TabbarPageMoved, // pData = Pair( pagepos_old, pagepos_new )
+ TabbarPageRemoved, // pData = pageid
+ TabbarPageSelected, // pData = pageid
+ TabbarPageTextChanged, // pData = pageid
+ TableRowSelect,
+ TabpageActivate, // pData = pageid
+ TabpageDeactivate, // pData = pageid
+ TabpageInserted, // pData = pageid
+ TabpagePageTextChanged, // pData = pageid
+ TabpageRemoved, // pData = pageid
+ TabpageRemovedAll,
+ ToolboxActivate,
+ ToolboxAllItemsChanged,
+ ToolboxButtonStateChanged, // pData = itempos
+ ToolboxClick,
+ ToolboxDeactivate,
+ ToolboxDoubleClick,
+ ToolboxFormatChanged, // request new layout
+ ToolboxHighlight,
+ ToolboxHighlightOff, // pData = itempos
+ ToolboxItemAdded, // pData = itempos
+ ToolboxItemDisabled, // pData = itempos
+ ToolboxItemEnabled, // pData = itempos
+ ToolboxItemRemoved, // pData = itempos
+ ToolboxItemTextChanged, // pData = itempos
+ ToolboxItemUpdated,
+ ToolboxItemWindowChanged,
+ ToolboxSelect,
+ WindowActivate,
+ WindowChildDestroyed, // pData = vcl::Window*
+ WindowClose,
+ WindowCommand, // pData = CommandEvent*
+ WindowDataChanged, // pData = DataChangedEvent*
+ WindowDeactivate, // pData = vcl::Window* = pPrevActiveWindow
+ WindowDisabled,
+ WindowDocking,
+ WindowEnabled,
+ WindowEndDocking, // pData = EndDockingData
+ WindowEndPopupMode, // pData = EndPopupModeData
+ WindowFrameTitleChanged,// pData = OUString* = oldTitle
+ WindowGetFocus,
+ WindowHide,
+ WindowKeyInput, // pData = KeyEvent*
+ WindowKeyUp, // pData = KeyEvent*
+ WindowLoseFocus,
+ WindowMenubarAdded, // pData = pMenuBar
+ WindowMenubarRemoved, // pData = pMenuBar
+ WindowMinimize,
+ WindowMouseButtonDown, // pData = MouseEvent*
+ WindowMouseButtonUp, // pData = MouseEvent*
+ WindowMouseMove, // pData = MouseEvent*
+ WindowMove,
+ WindowNormalize,
+ WindowPaint, // pData = Rectangle*
+ WindowPrepareToggleFloating, // pData = bool
+ WindowResize,
+ WindowShow,
+ WindowStartDocking, // pData = DockingData
+ WindowToggleFloating,
+ WindowGestureEvent,
+};
+
+class VCL_DLLPUBLIC VclSimpleEvent
+{
+private:
+ VclEventId nId;
+
+ VclSimpleEvent(VclSimpleEvent const &) = delete;
+ VclSimpleEvent& operator =(VclSimpleEvent const &) = delete;
+
+public:
+ VclSimpleEvent( VclEventId n ) { nId = n; }
+ virtual ~VclSimpleEvent() {}
+
+ VclEventId GetId() const { return nId; }
+};
+
+class VCL_DLLPUBLIC VclWindowEvent final : public VclSimpleEvent
+{
+private:
+ VclPtr<vcl::Window> pWindow;
+ void* pData;
+
+public:
+ VclWindowEvent( vcl::Window* pWin, VclEventId n, void* pDat );
+ virtual ~VclWindowEvent() override;
+
+ vcl::Window* GetWindow() const { return pWindow; }
+ void* GetData() const { return pData; }
+};
+
+class VCL_DLLPUBLIC VclMenuEvent final : public VclSimpleEvent
+{
+private:
+ VclPtr<Menu> pMenu;
+ sal_uInt16 mnPos;
+
+ VclMenuEvent(VclMenuEvent const &) = delete;
+ VclMenuEvent& operator =(VclMenuEvent const &) = delete;
+
+public:
+ VclMenuEvent( Menu* pM, VclEventId n, sal_uInt16 nPos );
+ virtual ~VclMenuEvent() override;
+
+ Menu* GetMenu() const;
+ sal_uInt16 GetItemPos() const { return mnPos; }
+};
+
+#endif // INCLUDED_VCL_VCLEVENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
new file mode 100644
index 000000000..0fa25116e
--- /dev/null
+++ b/include/vcl/vcllayout.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <tools/gen.hxx>
+#include <tools/degree.hxx>
+
+#include <vcl/devicecoordinate.hxx>
+#include <vcl/glyphitem.hxx>
+#include <vcl/dllapi.h>
+
+class LogicalFontInstance;
+namespace vcl::text { class ImplLayoutArgs; }
+namespace vcl::font { class PhysicalFontFace; }
+class SalGraphics;
+class GlyphItem;
+
+// all positions/widths are in font units
+// one exception: drawposition is in pixel units
+
+// Unfortunately there is little documentation to help implementors of
+// new classes derived from SalLayout ("layout engines"), and the code
+// and data structures are far from obvious.
+
+// For instance, I *think* the important virtual functions in the
+// layout engines are called in this order:
+
+// * InitFont()
+// * LayoutText()
+// * AdjustLayout(), any number of times (but presumably
+// usually not at all or just once)
+// * Optionally, DrawText()
+
+// Functions that just return information like GetTexWidth() and
+// FillDXArray() are called after LayoutText() and before DrawText().
+
+// Another important questions is which parts of an ImplLayoutArgs can
+// be changed by callers between LayoutText() and AdjustLayout()
+// calls. It probably makes sense only if one assumes that the "string
+// related inputs" part are not changed after LayoutText().
+
+// But why use the same ImplLayoutArgs structure as parameter for both
+// LayoutText() and AdjustLayout() in the first place? And why
+// duplicate some of the fields in both SalLayout and ImplLayoutArgs
+// (mnMinCharPos, mnEndCharPos, mnLayoutFlags==mnFlags,
+// mnOrientation)? Lost in history...
+
+class VCL_DLLPUBLIC SalLayout
+{
+public:
+ virtual ~SalLayout();
+ // used by upper layers
+ DevicePoint& DrawBase() { return maDrawBase; }
+ const DevicePoint& DrawBase() const { return maDrawBase; }
+ Point& DrawOffset() { return maDrawOffset; }
+ const Point& DrawOffset() const { return maDrawOffset; }
+ DevicePoint GetDrawPosition( const DevicePoint& rRelative = DevicePoint(0,0) ) const;
+
+ virtual bool LayoutText( vcl::text::ImplLayoutArgs&, const SalLayoutGlyphsImpl* ) = 0; // first step of layouting
+ virtual void AdjustLayout( vcl::text::ImplLayoutArgs& ); // adjusting after fallback etc.
+ virtual void InitFont() const {}
+ virtual void DrawText( SalGraphics& ) const = 0;
+
+ Degree10 GetOrientation() const { return mnOrientation; }
+
+ void SetTextRenderModeForResolutionIndependentLayout(bool bTextRenderModeForResolutionIndependentLayout)
+ {
+ mbTextRenderModeForResolutionIndependentLayout = bTextRenderModeForResolutionIndependentLayout;
+ }
+
+ // methods using string indexing
+ virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const = 0;
+ virtual DeviceCoordinate FillDXArray( std::vector<DeviceCoordinate>* pDXArray ) const = 0;
+ virtual DeviceCoordinate GetTextWidth() const { return FillDXArray( nullptr ); }
+ virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const = 0;
+ virtual bool IsKashidaPosValid ( int /*nCharPos*/ ) const { return true; } // i60594
+
+ // methods using glyph indexing
+ virtual bool GetNextGlyph(const GlyphItem** pGlyph, DevicePoint& rPos, int& nStart,
+ const LogicalFontInstance** ppGlyphFont = nullptr,
+ const vcl::font::PhysicalFontFace** pFallbackFont = nullptr) const = 0;
+ virtual bool GetOutline(basegfx::B2DPolyPolygonVector&) const;
+ bool GetBoundRect(tools::Rectangle&) const;
+
+ virtual SalLayoutGlyphs GetGlyphs() const;
+
+protected:
+ // used by layout engines
+ SalLayout();
+
+private:
+ SalLayout(const SalLayout&) = delete;
+ SalLayout& operator=(const SalLayout&) = delete;
+
+protected:
+ int mnMinCharPos;
+ int mnEndCharPos;
+
+ Degree10 mnOrientation;
+
+ mutable Point maDrawOffset;
+ DevicePoint maDrawBase;
+
+ bool mbTextRenderModeForResolutionIndependentLayout;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/vclmain.hxx b/include/vcl/vclmain.hxx
new file mode 100644
index 000000000..6572d6d30
--- /dev/null
+++ b/include/vcl/vclmain.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_VCLMAIN_HXX
+#define INCLUDED_VCL_VCLMAIN_HXX
+
+#include <sal/config.h>
+
+#ifdef DBG_UTIL
+#include <vcl/dllapi.h>
+#endif
+
+namespace vclmain
+{
+// Function called from vclmain's implementation of main, needs to be
+// implemented by the application and needs to instantiate a (static, derived)
+// instance of Application (where the Application constructor takes care to link
+// that instance to ImplSVData.mpApp):
+void createApplication();
+#ifdef DBG_UTIL
+VCL_DLLPUBLIC bool isAlive();
+#endif
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx
new file mode 100644
index 000000000..3775034ff
--- /dev/null
+++ b/include/vcl/vclptr.hxx
@@ -0,0 +1,442 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_PTR_HXX
+#define INCLUDED_VCL_PTR_HXX
+
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
+
+#include <utility>
+#include <type_traits>
+
+#ifdef DBG_UTIL
+#ifndef _WIN32
+#include <vcl/vclmain.hxx>
+#endif
+#endif
+
+class VclReferenceBase;
+
+namespace vcl::detail {
+
+template<typename>
+constexpr bool isIncompleteOrDerivedFromVclReferenceBase(...) { return true; }
+
+template<typename T> constexpr bool isIncompleteOrDerivedFromVclReferenceBase(
+ int (*)[sizeof(T)])
+{ return std::is_base_of<VclReferenceBase, T>::value; }
+
+} // namespace vcl::detail
+
+/**
+ * A thin wrapper around rtl::Reference to implement the acquire and dispose semantics we want for references to vcl::Window subclasses.
+ *
+ * For more details on the design please see vcl/README.lifecycle
+ *
+ * @param reference_type must be a subclass of vcl::Window
+ */
+template <class reference_type>
+class VclPtr
+{
+ static_assert(
+ vcl::detail::isIncompleteOrDerivedFromVclReferenceBase<reference_type>(
+ nullptr),
+ "template argument type must be derived from VclReferenceBase");
+
+ ::rtl::Reference<reference_type> m_rInnerRef;
+
+public:
+ /** Constructor...
+ */
+ VclPtr()
+ : m_rInnerRef()
+ {}
+
+ /** Constructor...
+ */
+ VclPtr (reference_type * pBody)
+ : m_rInnerRef(pBody)
+ {}
+
+ /** Constructor... that doesn't take a ref.
+ */
+ VclPtr (reference_type * pBody, __sal_NoAcquire)
+ : m_rInnerRef(pBody, SAL_NO_ACQUIRE)
+ {}
+
+ /** Up-casting conversion constructor: Copies interface reference.
+
+ Does not work for up-casts to ambiguous bases. For the special case of
+ up-casting to Reference< XInterface >, see the corresponding conversion
+ operator.
+
+ @param rRef another reference
+ */
+ template< class derived_type >
+ VclPtr(
+ const VclPtr< derived_type > & rRef,
+ typename std::enable_if<
+ std::is_base_of<reference_type, derived_type>::value, int>::type
+ = 0 )
+ : m_rInnerRef( static_cast<reference_type*>(rRef) )
+ {
+ }
+
+#if defined(DBG_UTIL) && !defined(_WIN32)
+ ~VclPtr()
+ {
+ assert(m_rInnerRef.get() == nullptr || vclmain::isAlive());
+ // We can be one of the intermediate counts, but if we are the last
+ // VclPtr keeping this object alive, then something forgot to call dispose().
+ assert((!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1)
+ && "someone forgot to call dispose()");
+ }
+ VclPtr(VclPtr const &) = default;
+ VclPtr(VclPtr &&) = default;
+ VclPtr & operator =(VclPtr const &) = default;
+ VclPtr & operator =(VclPtr &&) = default;
+#endif
+
+ /**
+ * A construction helper for VclPtr. Since VclPtr types are created
+ * with a reference-count of one - to help fit into the existing
+ * code-flow; this helps us to construct them easily.
+ *
+ * For more details on the design please see vcl/README.lifecycle
+ *
+ * @tparam reference_type must be a subclass of vcl::Window
+ */
+ template<typename... Arg> [[nodiscard]] static VclPtr< reference_type > Create(Arg &&... arg)
+ {
+ return VclPtr< reference_type >( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE );
+ }
+
+ /** Probably most common used: handle->someBodyOp().
+ */
+ reference_type * operator->() const
+ {
+ return m_rInnerRef.get();
+ }
+
+ /** Get the body. Can be used instead of operator->().
+ I.e. handle->someBodyOp() and handle.get()->someBodyOp()
+ are the same.
+ */
+ reference_type * get() const
+ {
+ return m_rInnerRef.get();
+ }
+
+ void set(reference_type *pBody)
+ {
+ m_rInnerRef.set(pBody);
+ }
+
+ void reset(reference_type *pBody)
+ {
+ m_rInnerRef.set(pBody);
+ }
+
+ /** Up-casting copy assignment operator.
+
+ Does not work for up-casts to ambiguous bases.
+
+ @param rRef another reference
+ */
+ template<typename derived_type>
+ typename std::enable_if<
+ std::is_base_of<reference_type, derived_type>::value,
+ VclPtr &>::type
+ operator =(VclPtr<derived_type> const & rRef)
+ {
+ m_rInnerRef.set(rRef.get());
+ return *this;
+ }
+
+ VclPtr & operator =(reference_type * pBody)
+ {
+ m_rInnerRef.set(pBody);
+ return *this;
+ }
+
+ operator reference_type * () const
+ {
+ return m_rInnerRef.get();
+ }
+
+ explicit operator bool () const
+ {
+ return m_rInnerRef.get() != nullptr;
+ }
+
+ void clear()
+ {
+ m_rInnerRef.clear();
+ }
+
+ void reset()
+ {
+ m_rInnerRef.clear();
+ }
+
+ void disposeAndClear()
+ {
+ // hold it alive for the lifetime of this method
+ ::rtl::Reference<reference_type> aTmp(m_rInnerRef);
+ m_rInnerRef.clear(); // we should use some 'swap' method ideally ;-)
+ if (aTmp.get()) {
+ aTmp->disposeOnce();
+ }
+ }
+
+ /** Needed to place VclPtr's into STL collection.
+ */
+ bool operator< (const VclPtr<reference_type> & handle) const
+ {
+ return (m_rInnerRef < handle.m_rInnerRef);
+ }
+}; // class VclPtr
+
+template<typename T1, typename T2>
+inline bool operator ==(VclPtr<T1> const & p1, VclPtr<T2> const & p2) {
+ return p1.get() == p2.get();
+}
+
+template<typename T> inline bool operator ==(VclPtr<T> const & p1, T const * p2)
+{
+ return p1.get() == p2;
+}
+
+template<typename T> inline bool operator ==(VclPtr<T> const & p1, T * p2) {
+ return p1.get() == p2;
+}
+
+template<typename T> inline bool operator ==(T const * p1, VclPtr<T> const & p2)
+{
+ return p1 == p2.get();
+}
+
+template<typename T> inline bool operator ==(T * p1, VclPtr<T> const & p2) {
+ return p1 == p2.get();
+}
+
+template<typename T1, typename T2>
+inline bool operator !=(VclPtr<T1> const & p1, VclPtr<T2> const & p2) {
+ return !(p1 == p2);
+}
+
+template<typename T> inline bool operator !=(VclPtr<T> const & p1, T const * p2)
+{
+ return !(p1 == p2);
+}
+
+template<typename T> inline bool operator !=(VclPtr<T> const & p1, T * p2) {
+ return !(p1 == p2);
+}
+
+template<typename T> inline bool operator !=(T const * p1, VclPtr<T> const & p2)
+{
+ return !(p1 == p2);
+}
+
+template<typename T> inline bool operator !=(T * p1, VclPtr<T> const & p2) {
+ return !(p1 == p2);
+}
+
+/**
+ * A construction helper for a temporary VclPtr. Since VclPtr types
+ * are created with a reference-count of one - to help fit into
+ * the existing code-flow; this helps us to construct them easily.
+ * see also VclPtr::Create and ScopedVclPtr
+ *
+ * For more details on the design please see vcl/README.lifecycle
+ *
+ * @param reference_type must be a subclass of vcl::Window
+ */
+template <class reference_type>
+class SAL_WARN_UNUSED VclPtrInstance final : public VclPtr<reference_type>
+{
+public:
+ template<typename... Arg> VclPtrInstance(Arg &&... arg)
+ : VclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE )
+ {
+ }
+
+ /**
+ * Override and disallow this, to prevent people accidentally calling it and actually
+ * getting VclPtr::Create and getting a naked VclPtr<> instance
+ */
+ template<typename... Arg> static VclPtrInstance< reference_type > Create(Arg &&... ) = delete;
+};
+
+template <class reference_type>
+class ScopedVclPtr : public VclPtr<reference_type>
+{
+public:
+ /** Constructor...
+ */
+ ScopedVclPtr()
+ : VclPtr<reference_type>()
+ {}
+
+ /** Constructor
+ */
+ ScopedVclPtr (reference_type * pBody)
+ : VclPtr<reference_type>(pBody)
+ {}
+
+ /** Copy constructor...
+ */
+ ScopedVclPtr (const VclPtr<reference_type> & handle)
+ : VclPtr<reference_type>(handle)
+ {}
+
+ /**
+ Assignment that releases the last reference.
+ */
+ void disposeAndReset(reference_type *pBody)
+ {
+ if (pBody != this->get()) {
+ VclPtr<reference_type>::disposeAndClear();
+ VclPtr<reference_type>::set(pBody);
+ }
+ }
+
+ /**
+ Assignment that releases the last reference.
+ */
+ ScopedVclPtr<reference_type>& operator = (reference_type * pBody)
+ {
+ disposeAndReset(pBody);
+ return *this;
+ }
+
+ /** Up-casting conversion constructor: Copies interface reference.
+
+ Does not work for up-casts to ambiguous bases. For the special case of
+ up-casting to Reference< XInterface >, see the corresponding conversion
+ operator.
+
+ @param rRef another reference
+ */
+ template< class derived_type >
+ ScopedVclPtr(
+ const VclPtr< derived_type > & rRef,
+ typename std::enable_if<
+ std::is_base_of<reference_type, derived_type>::value, int>::type
+ = 0 )
+ : VclPtr<reference_type>( rRef )
+ {
+ }
+
+ /** Up-casting assignment operator.
+
+ Does not work for up-casts to ambiguous bases.
+
+ @param rRef another VclPtr
+ */
+ template<typename derived_type>
+ typename std::enable_if<
+ std::is_base_of<reference_type, derived_type>::value,
+ ScopedVclPtr &>::type
+ operator =(VclPtr<derived_type> const & rRef)
+ {
+ disposeAndReset(rRef.get());
+ return *this;
+ }
+
+ /**
+ * Override and disallow this, to prevent people accidentally calling it and actually
+ * getting VclPtr::Create and getting a naked VclPtr<> instance
+ */
+ template<typename... Arg> static ScopedVclPtr< reference_type > Create(Arg &&... ) = delete;
+
+ ~ScopedVclPtr()
+ {
+ VclPtr<reference_type>::disposeAndClear();
+ assert(VclPtr<reference_type>::get() == nullptr); // make sure there are no lingering references
+ }
+
+private:
+ // Most likely we don't want this default copy-constructor.
+ ScopedVclPtr (const ScopedVclPtr<reference_type> &) = delete;
+ // And certainly we don't want a default assignment operator.
+ ScopedVclPtr<reference_type>& operator = (const ScopedVclPtr<reference_type> &) = delete;
+ // And disallow reset as that doesn't call disposeAndClear on the original reference
+ void reset() = delete;
+ void reset(reference_type *pBody) = delete;
+
+protected:
+ ScopedVclPtr (reference_type * pBody, __sal_NoAcquire)
+ : VclPtr<reference_type>(pBody, SAL_NO_ACQUIRE)
+ {}
+};
+
+/**
+ * A construction helper for ScopedVclPtr. Since VclPtr types are created
+ * with a reference-count of one - to help fit into the existing
+ * code-flow; this helps us to construct them easily.
+ *
+ * For more details on the design please see vcl/README.lifecycle
+ *
+ * @param reference_type must be a subclass of vcl::Window
+ */
+#if defined _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4521) // " multiple copy constructors specified"
+#endif
+template <class reference_type>
+class SAL_WARN_UNUSED ScopedVclPtrInstance final : public ScopedVclPtr<reference_type>
+{
+public:
+ template<typename... Arg> ScopedVclPtrInstance(Arg &&... arg)
+ : ScopedVclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE )
+ {
+ }
+
+ /**
+ * Override and disallow this, to prevent people accidentally calling it and actually
+ * getting VclPtr::Create and getting a naked VclPtr<> instance
+ */
+ template<typename... Arg> static ScopedVclPtrInstance< reference_type > Create(Arg &&...) = delete;
+
+private:
+ // Prevent the above perfect forwarding ctor from hijacking (accidental)
+ // attempts at ScopedVclPtrInstance copy construction (where the hijacking
+ // would typically lead to somewhat obscure error messages); both non-const
+ // and const variants are needed here, as the ScopedVclPtr base class has a
+ // const--variant copy ctor, so the implicitly declared copy ctor for
+ // ScopedVclPtrInstance would also be the const variant, so non-const copy
+ // construction attempts would be hijacked by the perfect forwarding ctor;
+ // but if we only declared a non-const variant here, the const variant would
+ // no longer be implicitly declared (as there would already be an explicitly
+ // declared copy ctor), so const copy construction attempts would then be
+ // hijacked by the perfect forwarding ctor:
+ ScopedVclPtrInstance(ScopedVclPtrInstance &) = delete;
+ ScopedVclPtrInstance(ScopedVclPtrInstance const &) = delete;
+};
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+#endif // INCLUDED_VCL_PTR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/vclreferencebase.hxx b/include/vcl/vclreferencebase.hxx
new file mode 100644
index 000000000..2ba39026a
--- /dev/null
+++ b/include/vcl/vclreferencebase.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_Reference_HXX
+#define INCLUDED_VCL_Reference_HXX
+
+#include <vcl/dllapi.h>
+#include <osl/interlck.h>
+
+class VclBuilder;
+
+class VCL_DLLPUBLIC VclReferenceBase
+{
+ mutable oslInterlockedCount mnRefCnt;
+
+ template<typename T> friend class VclPtr;
+ friend class ::VclBuilder; // needed by ::delete_by_window(vcl::Window *pWindow)
+
+public:
+ void acquire() const
+ {
+ osl_atomic_increment(&mnRefCnt);
+ }
+
+ void release() const
+ {
+ if (osl_atomic_decrement(&mnRefCnt) == 0)
+ delete this;
+ }
+#ifdef DBG_UTIL
+#ifndef _WIN32
+ sal_Int32 getRefCount() const { return mnRefCnt; }
+#endif
+#endif
+
+
+private:
+ VclReferenceBase(const VclReferenceBase&) = delete;
+ VclReferenceBase& operator=(const VclReferenceBase&) = delete;
+
+ bool mbDisposed : 1;
+
+protected:
+ VclReferenceBase();
+ virtual ~VclReferenceBase();
+
+ // This is only supposed to be called from disposeOnce
+ virtual void dispose();
+
+public:
+ // This is normally supposed to be called from VclPtr::disposeAndClear
+ void disposeOnce();
+
+ bool isDisposed() const { return mbDisposed; }
+
+};
+#endif
diff --git a/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx
new file mode 100644
index 000000000..465690c56
--- /dev/null
+++ b/include/vcl/vectorgraphicdata.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_VECTORGRAPHICDATA_HXX
+#define INCLUDED_VCL_VECTORGRAPHICDATA_HXX
+
+#include <basegfx/range/b2drange.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/BinaryDataContainer.hxx>
+#include <rtl/ustring.hxx>
+#include <deque>
+#include <memory>
+#include <algorithm>
+#include <optional>
+
+namespace com::sun::star::graphic { class XPrimitive2D; }
+
+typedef css::uno::Sequence<sal_Int8> VectorGraphicDataArray;
+
+
+// helper to convert any Primitive2DSequence to a good quality BitmapEx,
+// using default parameters and graphic::XPrimitive2DRenderer
+
+BitmapEx VCL_DLLPUBLIC convertPrimitive2DSequenceToBitmapEx(
+ const std::deque< css::uno::Reference< css::graphic::XPrimitive2D > >& rSequence,
+ const basegfx::B2DRange& rTargetRange,
+ const sal_uInt32 nMaximumQuadraticPixels = 500000,
+ const o3tl::Length eTargetUnit = o3tl::Length::mm100,
+ const std::optional<Size>& rTargetDPI = std::nullopt);
+
+
+enum class VectorGraphicDataType
+{
+ Svg = 0,
+ Emf = 1,
+ Wmf = 2,
+ Pdf = 3
+};
+
+class VCL_DLLPUBLIC VectorGraphicData
+{
+private:
+ // the file and length
+ BinaryDataContainer maDataContainer;
+
+ // on demand created content
+ bool mbSequenceCreated;
+ basegfx::B2DRange maRange;
+ std::deque< css::uno::Reference< css::graphic::XPrimitive2D > > maSequence;
+ BitmapEx maReplacement;
+ size_t mNestedBitmapSize;
+ VectorGraphicDataType meType;
+
+ /// If the vector format has more pages this denotes which page to render
+ sal_Int32 mnPageIndex;
+
+ /// Useful for PDF, which is vector-based, but still rendered to a bitmap.
+ basegfx::B2DTuple maSizeHint;
+
+ bool mbEnableEMFPlus = true;
+
+ // on demand creators
+ void ensurePdfReplacement();
+ void ensureReplacement();
+ void ensureSequenceAndRange();
+
+ VectorGraphicData(const VectorGraphicData&) = delete;
+ VectorGraphicData& operator=(const VectorGraphicData&) = delete;
+
+public:
+ VectorGraphicData(const OUString& rPath, VectorGraphicDataType eVectorDataType);
+ VectorGraphicData(
+ const BinaryDataContainer& rDataContainer,
+ VectorGraphicDataType eVectorDataType,
+ sal_Int32 nPageIndex = -1);
+ ~VectorGraphicData();
+
+ /// compare op
+ bool operator==(const VectorGraphicData& rCandidate) const;
+
+ /// data read
+ const BinaryDataContainer& getBinaryDataContainer() const
+ {
+ return maDataContainer;
+ }
+
+ enum class State { UNPARSED, PARSED };
+ std::pair<State, size_t> getSizeBytes() const;
+
+ const VectorGraphicDataType& getType() const { return meType; }
+
+ /// data read and evtl. on demand creation
+ const basegfx::B2DRange& getRange() const;
+ const std::deque<css::uno::Reference<css::graphic::XPrimitive2D>>& getPrimitive2DSequence() const;
+ const BitmapEx& getReplacement() const;
+ BitmapChecksum GetChecksum() const;
+
+ sal_Int32 getPageIndex() const
+ {
+ return std::max(sal_Int32(0), mnPageIndex);
+ }
+
+ void setPageIndex(sal_Int32 nPageIndex)
+ {
+ mnPageIndex = nPageIndex;
+ }
+
+ void setSizeHint(const basegfx::B2DTuple& rSizeHint)
+ {
+ maSizeHint = rSizeHint;
+ }
+
+ const basegfx::B2DTuple& getSizeHint() const { return maSizeHint; }
+
+ void setEnableEMFPlus(bool bEnableEMFPlus) { mbEnableEMFPlus = bEnableEMFPlus; }
+
+ bool isPrimitiveSequenceCreated() const { return mbSequenceCreated; }
+};
+
+#endif // INCLUDED_VCL_VECTORGRAPHICDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx
new file mode 100644
index 000000000..b611e7f8a
--- /dev/null
+++ b/include/vcl/virdev.hxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_VIRDEV_HXX
+#define INCLUDED_VCL_VIRDEV_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/outdev.hxx>
+#include <vcl/salgtype.hxx>
+#include <memory>
+
+class SalVirtualDevice;
+struct SystemGraphicsData;
+typedef struct _cairo_surface cairo_surface_t;
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC VirtualDevice : public OutputDevice
+{
+ friend class Application;
+ friend class ::OutputDevice;
+ friend class Printer;
+ friend cairo_surface_t* get_underlying_cairo_surface(const VirtualDevice&);
+public:
+ // reference device modes for different compatibility levels
+ enum class RefDevMode { NONE = 0,
+ Dpi600 = 1, // 600 dpi
+ MSO1 = 3,
+ PDF1 = 4,
+ Custom = 5
+ };
+
+private:
+ std::unique_ptr<SalVirtualDevice> mpVirDev;
+ VclPtr<VirtualDevice> mpPrev;
+ VclPtr<VirtualDevice> mpNext;
+ sal_uInt16 mnBitCount;
+ bool mbScreenComp;
+ const DeviceFormat meFormat;
+ const DeviceFormat meAlphaFormat;
+ RefDevMode meRefDevMode;
+ bool mbForceZeroExtleadBug;
+
+ SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, tools::Long nDX, tools::Long nDY, const SystemGraphicsData *pData = nullptr );
+ SAL_DLLPRIVATE bool InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
+ sal_uInt8* pBuffer );
+ SAL_DLLPRIVATE bool ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
+ sal_uInt8* pBuffer );
+
+ VirtualDevice (const VirtualDevice &) = delete;
+ VirtualDevice & operator= (const VirtualDevice &) = delete;
+
+ /** Used for alpha VDev, to set areas to opaque
+
+ @since \#i32109#
+ */
+ SAL_DLLPRIVATE void ImplFillOpaqueRectangle( const tools::Rectangle& rRect );
+
+protected:
+ virtual bool AcquireGraphics() const override;
+ virtual void ReleaseGraphics( bool bRelease = true ) override;
+
+ /** Create a virtual device of size 1x1
+
+ @param pCompDev
+ The generated vdev will be compatible to this device.
+ If it's the nullptr, it uses Application::GetDefaultDevice().
+
+ @param eFormat
+ Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
+ indicate: take default screen depth.
+
+ @param eAlphaFormat
+ Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
+ indicate: take default screen depth.
+
+ @param eOutDevType
+ This real virtual output device type.
+ */
+ explicit VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat,
+ DeviceFormat eAlphaFormat, OutDevType eOutDevType);
+
+public:
+
+ /** Create a virtual device of size 1x1
+
+ @param eFormat
+ Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
+ indicate: take default screen depth.
+
+ @param eAlphaFormat
+ Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
+ indicate: take default screen depth.
+ */
+ explicit VirtualDevice(DeviceFormat eFormat = DeviceFormat::DEFAULT, DeviceFormat eAlphaFormat = DeviceFormat::NONE)
+ : VirtualDevice(nullptr, eFormat, eAlphaFormat, OUTDEV_VIRDEV) {}
+
+ /** Create a virtual device of size 1x1
+
+ @param rCompDev
+ The generated vdev will be compatible to this device.
+
+ @param eFormat
+ Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
+ indicate: take default screen depth.
+ */
+ explicit VirtualDevice(const OutputDevice& rCompDev,
+ DeviceFormat eFormat = DeviceFormat::DEFAULT)
+ : VirtualDevice(&rCompDev, eFormat, DeviceFormat::NONE, OUTDEV_VIRDEV) {}
+
+ /** Create a virtual device of size 1x1 with alpha channel
+
+ @param rCompDev
+ The generated vdev will be compatible to this device.
+
+ @param eFormat
+ Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
+ indicate: take default screen depth.
+
+ @param eAlphaFormat
+ Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
+ indicate: take default screen depth.
+ */
+ explicit VirtualDevice(const OutputDevice& rCompDev,
+ DeviceFormat eFormat, DeviceFormat eAlphaFormat)
+ : VirtualDevice(&rCompDev, eFormat, eAlphaFormat, OUTDEV_VIRDEV) {}
+
+ /** Create a virtual device using an existing system dependent device or graphics context
+ Any rendering will happen directly on the context and not on any intermediate bitmap.
+ Note: This might not be supported on all platforms !
+ */
+ explicit VirtualDevice(const SystemGraphicsData& rData, const Size &rSize,
+ DeviceFormat eFormat);
+
+ virtual ~VirtualDevice() override;
+ virtual void dispose() override;
+
+ bool CanEnableNativeWidget() const override;
+
+ virtual void EnableRTL( bool bEnable = true ) override;
+
+ bool SetOutputSizePixel( const Size& rNewSize, bool bErase = true );
+ bool SetOutputSizePixelScaleOffsetAndLOKBuffer( const Size& rNewSize,
+ const Fraction& rScale,
+ const Point& rNewOffset,
+ sal_uInt8* pBuffer);
+
+ bool SetOutputSize( const Size& rNewSize )
+ { return SetOutputSizePixel( LogicToPixel( rNewSize ) ); }
+
+ void SetReferenceDevice( RefDevMode );
+
+ void Compat_ZeroExtleadBug(); // enable workaround for #i60495#
+
+ void SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
+
+ virtual sal_uInt16 GetBitCount() const override;
+
+ bool IsVirtual() const override;
+
+ bool IsScreenComp() const override { return mbScreenComp; }
+
+private:
+ SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
+
+protected:
+ virtual bool UsePolyPolygonForComplexGradient() override;
+
+ virtual tools::Long GetFontExtLeading() const override;
+
+};
+
+#endif // INCLUDED_VCL_VIRDEV_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/wall.hxx b/include/vcl/wall.hxx
new file mode 100644
index 000000000..474d2afe5
--- /dev/null
+++ b/include/vcl/wall.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_WALL_HXX
+#define INCLUDED_VCL_WALL_HXX
+
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/dllapi.h>
+#include <optional>
+
+class Gradient;
+class BitmapEx;
+class ImplWallpaper;
+
+enum class WallpaperStyle
+{
+ NONE,
+ Tile,
+ Center,
+ Scale,
+ TopLeft,
+ Top,
+ TopRight,
+ Left,
+ Right,
+ BottomLeft,
+ Bottom,
+ BottomRight,
+ ApplicationGradient // defines a gradient that internally covers the whole application
+ // and uses a color derived from the face color
+};
+
+class VCL_DLLPUBLIC Wallpaper
+{
+public:
+ SAL_DLLPRIVATE void ImplSetCachedBitmap( const BitmapEx& rBmp ) const;
+ SAL_DLLPRIVATE const BitmapEx* ImplGetCachedBitmap() const;
+ SAL_DLLPRIVATE void ImplReleaseCachedBitmap() const;
+
+private:
+ SAL_DLLPRIVATE static Gradient ImplGetApplicationGradient();
+
+public:
+ Wallpaper();
+ Wallpaper( const Wallpaper& rWallpaper );
+ Wallpaper( Wallpaper&& rWallpaper );
+ Wallpaper( const Color& rColor );
+ explicit Wallpaper( const BitmapEx& rBmpEx );
+ ~Wallpaper();
+
+ void SetColor( const Color& rColor );
+ const Color& GetColor() const { return maColor; }
+
+ void SetStyle( WallpaperStyle eStyle );
+ WallpaperStyle GetStyle() const { return meStyle; }
+
+ void SetBitmap( const BitmapEx& rBitmap );
+ const BitmapEx & GetBitmap() const;
+ bool IsBitmap() const;
+
+ void SetGradient( const Gradient& rGradient );
+ Gradient GetGradient() const;
+ bool IsGradient() const;
+
+ void SetRect( const tools::Rectangle& rRect ) { maRect = rRect; }
+ const tools::Rectangle & GetRect() const { return maRect; }
+ bool IsRect() const;
+
+ bool IsFixed() const;
+ bool IsScrollable() const;
+
+ Wallpaper& operator=( const Wallpaper& rWallpaper );
+ Wallpaper& operator=( Wallpaper&& rWallpaper );
+
+ bool operator==( const Wallpaper& rWallpaper ) const;
+ bool operator!=( const Wallpaper& rWallpaper ) const
+ { return !(Wallpaper::operator==( rWallpaper )); }
+
+ bool IsEmpty() const
+ {
+ return GetStyle() == WallpaperStyle::NONE && GetColor() == COL_TRANSPARENT &&
+ !IsBitmap() && !IsGradient() && !IsRect();
+ }
+
+ friend SvStream& ReadWallpaper( SvStream& rIStm, Wallpaper& rWallpaper );
+ friend SvStream& WriteWallpaper( SvStream& rOStm, const Wallpaper& rWallpaper );
+private:
+ tools::Rectangle maRect;
+ BitmapEx maBitmap;
+ mutable BitmapEx maCache;
+ std::optional<Gradient> mpGradient;
+ Color maColor;
+ WallpaperStyle meStyle;
+};
+
+#endif // INCLUDED_VCL_WALL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
new file mode 100644
index 000000000..34f22ac57
--- /dev/null
+++ b/include/vcl/weld.hxx
@@ -0,0 +1,2637 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_WELD_HXX
+#define INCLUDED_VCL_WELD_HXX
+
+#include <basegfx/range/b2irange.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+#include <tools/date.hxx>
+#include <tools/fldunit.hxx>
+#include <tools/gen.hxx>
+#include <tools/link.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/vclenum.hxx>
+#include <vcl/font.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/uitest/factory.hxx>
+
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+#include <assert.h>
+#include <memory>
+#include <vector>
+
+namespace com::sun::star::awt
+{
+class XWindow;
+}
+namespace com::sun::star::datatransfer::clipboard
+{
+class XClipboard;
+}
+namespace com::sun::star::datatransfer::dnd
+{
+class XDropTarget;
+}
+namespace com::sun::star::graphic
+{
+class XGraphic;
+}
+typedef css::uno::Reference<css::accessibility::XAccessible> a11yref;
+typedef css::uno::Reference<css::accessibility::XAccessibleRelationSet> a11yrelationset;
+enum class PointerStyle;
+class CommandEvent;
+class Formatter;
+class InputContext;
+class KeyEvent;
+class MouseEvent;
+class SvNumberFormatter;
+class TransferDataContainer;
+class OutputDevice;
+class VirtualDevice;
+struct SystemEnvData;
+
+namespace vcl
+{
+class ILibreOfficeKitNotifier;
+typedef OutputDevice RenderContext;
+}
+namespace tools
+{
+class JsonWriter;
+}
+
+class LOKTrigger;
+
+namespace weld
+{
+class Container;
+class DialogController;
+
+class VCL_DLLPUBLIC Widget
+{
+ friend class ::LOKTrigger;
+
+protected:
+ Link<Widget&, void> m_aFocusInHdl;
+ Link<Widget&, void> m_aFocusOutHdl;
+ Link<Widget&, bool> m_aMnemonicActivateHdl;
+ Link<const Size&, void> m_aSizeAllocateHdl;
+ Link<const KeyEvent&, bool> m_aKeyPressHdl;
+ Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
+ Link<const MouseEvent&, bool> m_aMousePressHdl;
+ Link<const MouseEvent&, bool> m_aMouseMotionHdl;
+ Link<const MouseEvent&, bool> m_aMouseReleaseHdl;
+
+public:
+ virtual void set_sensitive(bool sensitive) = 0;
+ virtual bool get_sensitive() const = 0;
+
+ /* visibility */
+
+ virtual void show() = 0;
+ virtual void hide() = 0;
+
+ // This function simply calls show() or hide() but is convenient when the
+ // visibility depends on some condition
+ virtual void set_visible(bool visible)
+ {
+ if (visible)
+ show();
+ else
+ hide();
+ }
+
+ // return if this widget's visibility is true
+ virtual bool get_visible() const = 0;
+
+ // return if this widget's visibility and that of all its parents is true
+ virtual bool is_visible() const = 0;
+
+ /* focus */
+
+ // sets if this widget can own the keyboard focus
+ virtual void set_can_focus(bool bCanFocus) = 0;
+
+ // causes this widget to have the keyboard focus
+ virtual void grab_focus() = 0;
+
+ // returns if this widget has the keyboard focus
+ virtual bool has_focus() const = 0;
+
+ // if the widget that has focus is a child, which includes toplevel popup
+ // children, of this widget. So an Entry with an active popup (or dialog)
+ // has has_child_focus of true, but has_focus of false, while its popup is
+ // shown
+ virtual bool has_child_focus() const = 0;
+
+ // return if this widget has the keyboard focus within the active window
+ // TODO: review if this has any practical difference from has_focus()
+ virtual bool is_active() const = 0;
+
+ /* size */
+ virtual void set_size_request(int nWidth, int nHeight) = 0;
+ virtual Size get_size_request() const = 0;
+ virtual Size get_preferred_size() const = 0;
+
+ /* measure */
+ virtual float get_approximate_digit_width() const = 0;
+ virtual int get_text_height() const = 0;
+ virtual Size get_pixel_size(const OUString& rText) const = 0;
+
+ // The name of the widget in the GtkBuilder UI definition used to construct it.
+ virtual OString get_buildable_name() const = 0;
+ /*
+ Typically there is no need to change the buildable name at runtime, changing
+ the id in .ui file itself is preferred.
+
+ But for ui-testing purposes it can sometimes be useful to rename
+ different widgets, that were loaded from the same .ui, to unique names
+ in order to distinguish between them
+ */
+ virtual void set_buildable_name(const OString& rName) = 0;
+
+ /*
+ The help id of the widget used to identify help for this widget.
+
+ By default the help id of a widget is a path-like sequence of (load-time)
+ buildable-names from the widgets UI definition ancestor to this widget,
+ e.g. grandparent/parent/widget.
+
+ The default can be overwritten with set_help_id
+ */
+ virtual OString get_help_id() const = 0;
+ virtual void set_help_id(const OString& rName) = 0;
+
+ virtual void set_grid_left_attach(int nAttach) = 0;
+ virtual int get_grid_left_attach() const = 0;
+ virtual void set_grid_width(int nCols) = 0;
+ virtual void set_grid_top_attach(int nAttach) = 0;
+ virtual int get_grid_top_attach() const = 0;
+
+ virtual void set_hexpand(bool bExpand) = 0;
+ virtual bool get_hexpand() const = 0;
+ virtual void set_vexpand(bool bExpand) = 0;
+ virtual bool get_vexpand() const = 0;
+
+ virtual void set_margin_top(int nMargin) = 0;
+ virtual void set_margin_bottom(int nMargin) = 0;
+ virtual void set_margin_start(int nMargin) = 0;
+ virtual void set_margin_end(int nMargin) = 0;
+
+ virtual int get_margin_top() const = 0;
+ virtual int get_margin_bottom() const = 0;
+ virtual int get_margin_start() const = 0;
+ virtual int get_margin_end() const = 0;
+
+ /*
+ * Report the extents of this widget relative to the rRelative target widget.
+ *
+ * To succeed, both widgets must be realized, and must share a common toplevel.
+ *
+ * returns false if the relative extents could not be determined, e.g. if
+ * either widget was not realized, or there was no common ancestor.
+ * Otherwise true.
+ */
+ virtual bool get_extents_relative_to(const Widget& rRelative, int& x, int& y, int& width,
+ int& height) const = 0;
+
+ virtual void set_accessible_name(const OUString& rName) = 0;
+ virtual void set_accessible_description(const OUString& rDescription) = 0;
+ virtual OUString get_accessible_name() const = 0;
+
+ virtual OUString get_accessible_description() const = 0;
+
+ // After this call this widget is only accessibility labelled by pLabel and
+ // pLabel only accessibility labels this widget
+ virtual void set_accessible_relation_labeled_by(weld::Widget* pLabel) = 0;
+
+ virtual void set_tooltip_text(const OUString& rTip) = 0;
+ virtual OUString get_tooltip_text() const = 0;
+
+ virtual void connect_focus_in(const Link<Widget&, void>& rLink)
+ {
+ assert(!m_aFocusInHdl.IsSet() || !rLink.IsSet());
+ m_aFocusInHdl = rLink;
+ }
+
+ virtual void connect_focus_out(const Link<Widget&, void>& rLink)
+ {
+ assert(!m_aFocusOutHdl.IsSet() || !rLink.IsSet());
+ m_aFocusOutHdl = rLink;
+ }
+
+ // rLink is called when the mnemonic for the Widget is called.
+ // If rLink returns true the Widget will not automatically gain
+ // focus as normally occurs
+ virtual void connect_mnemonic_activate(const Link<Widget&, bool>& rLink)
+ {
+ assert(!m_aMnemonicActivateHdl.IsSet() || !rLink.IsSet());
+ m_aMnemonicActivateHdl = rLink;
+ }
+
+ virtual void connect_size_allocate(const Link<const Size&, void>& rLink)
+ {
+ assert(!m_aSizeAllocateHdl.IsSet() || !rLink.IsSet());
+ m_aSizeAllocateHdl = rLink;
+ }
+
+ virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink)
+ {
+ assert(!m_aKeyPressHdl.IsSet() || !rLink.IsSet());
+ m_aKeyPressHdl = rLink;
+ }
+
+ virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink)
+ {
+ assert(!m_aKeyReleaseHdl.IsSet() || !rLink.IsSet());
+ m_aKeyReleaseHdl = rLink;
+ }
+
+ virtual void connect_mouse_press(const Link<const MouseEvent&, bool>& rLink)
+ {
+ assert(!m_aMousePressHdl.IsSet() || !rLink.IsSet());
+ m_aMousePressHdl = rLink;
+ }
+
+ virtual void connect_mouse_move(const Link<const MouseEvent&, bool>& rLink)
+ {
+ assert(!m_aMouseMotionHdl.IsSet() || !rLink.IsSet());
+ m_aMouseMotionHdl = rLink;
+ }
+
+ virtual void connect_mouse_release(const Link<const MouseEvent&, bool>& rLink)
+ {
+ assert(!m_aMouseReleaseHdl.IsSet() || !rLink.IsSet());
+ m_aMouseReleaseHdl = rLink;
+ }
+
+ virtual void grab_add() = 0;
+ virtual bool has_grab() const = 0;
+ virtual void grab_remove() = 0;
+
+ // font size is in points, not pixels, e.g. see Window::[G]etPointFont
+ virtual vcl::Font get_font() = 0;
+
+ //true for rtl, false otherwise
+ virtual bool get_direction() const = 0;
+ virtual void set_direction(bool bRTL) = 0;
+
+ /* Increases the freeze count on widget.
+
+ If the freeze count is non-zero, emission of the widget's notifications
+ is stopped. The notifications are queued until the freeze count is
+ decreased to zero. Duplicate notifications may be squashed together.
+ */
+ virtual void freeze() = 0;
+
+ /* Reverts the effect of a previous call to freeze.
+
+ The freeze count is decreased on the widget and when it reaches zero,
+ queued notifications are emitted.
+ */
+ virtual void thaw() = 0;
+
+ /* push/pop busy mouse cursor state
+
+ bBusy of true to push a busy state onto the stack and false
+ to pop it off, calls to this should balance.
+
+ see weld::WaitObject */
+ virtual void set_busy_cursor(bool bBusy) = 0;
+
+ virtual void queue_resize() = 0;
+
+ virtual std::unique_ptr<Container> weld_parent() const = 0;
+
+ //iterate upwards through the hierarchy starting at this widgets parent,
+ //calling func with their helpid until func returns true or we run out of
+ //parents
+ virtual void help_hierarchy_foreach(const std::function<bool(const OString&)>& func) = 0;
+
+ virtual OUString strip_mnemonic(const OUString& rLabel) const = 0;
+
+ virtual VclPtr<VirtualDevice> create_virtual_device() const = 0;
+
+ //do something transient to attract the attention of the user to the widget
+ virtual void call_attention_to() = 0;
+
+ //make this widget look like a page in a notebook
+ virtual void set_stack_background() = 0;
+ //make this widget look like it has a highlighted background
+ virtual void set_highlight_background() = 0;
+ //make this widget suitable as parent for a title
+ virtual void set_title_background() = 0;
+ //make this widget suitable for use in a toolbar
+ virtual void set_toolbar_background() = 0;
+ //trying to use a custom color for a background is generally a bad idea. If your need
+ //fits one of the above categories then that's a somewhat better choice
+ virtual void set_background(const Color& rBackColor) = 0;
+
+ virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() = 0;
+ virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard> get_clipboard() const = 0;
+
+ virtual void connect_get_property_tree(const Link<tools::JsonWriter&, void>& rLink) = 0;
+ virtual void get_property_tree(tools::JsonWriter& rJsonWriter) = 0;
+
+ // render the widget to an output device
+ virtual void draw(OutputDevice& rOutput, const Point& rPos, const Size& rSizePixel) = 0;
+
+ virtual ~Widget() {}
+};
+
+class VCL_DLLPUBLIC Container : virtual public Widget
+{
+protected:
+ Link<Container&, void> m_aContainerFocusChangedHdl;
+
+ void signal_container_focus_changed() { m_aContainerFocusChangedHdl.Call(*this); }
+
+public:
+ // remove and add in one go
+ virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) = 0;
+ // create an XWindow as a child of this container. The XWindow is
+ // suitable to contain css::awt::XControl items
+ virtual css::uno::Reference<css::awt::XWindow> CreateChildFrame() = 0;
+ // rLink is called when the focus transitions from a widget outside the container
+ // to a widget inside the container or vice versa
+ virtual void connect_container_focus_changed(const Link<Container&, void>& rLink)
+ {
+ m_aContainerFocusChangedHdl = rLink;
+ }
+ // causes a child of the container to have the keyboard focus
+ virtual void child_grab_focus() = 0;
+};
+
+class VCL_DLLPUBLIC Box : virtual public Container
+{
+public:
+ // Moves child to a new position in the list of children
+ virtual void reorder_child(weld::Widget* pWidget, int position) = 0;
+ // Sort ok/cancel etc buttons in platform order
+ virtual void sort_native_button_order() = 0;
+};
+
+class VCL_DLLPUBLIC Paned : virtual public Container
+{
+public:
+ // set pixel position of divider
+ virtual void set_position(int nPos) = 0;
+ // get pixel position of divider
+ virtual int get_position() const = 0;
+};
+
+class VCL_DLLPUBLIC ScrolledWindow : virtual public Container
+{
+protected:
+ Link<ScrolledWindow&, void> m_aVChangeHdl;
+ Link<ScrolledWindow&, void> m_aHChangeHdl;
+
+ void signal_vadjustment_changed() { m_aVChangeHdl.Call(*this); }
+ void signal_hadjustment_changed() { m_aHChangeHdl.Call(*this); }
+
+public:
+ virtual void hadjustment_configure(int value, int lower, int upper, int step_increment,
+ int page_increment, int page_size)
+ = 0;
+ virtual int hadjustment_get_value() const = 0;
+ virtual void hadjustment_set_value(int value) = 0;
+ virtual int hadjustment_get_upper() const = 0;
+ virtual void hadjustment_set_upper(int upper) = 0;
+ virtual int hadjustment_get_page_size() const = 0;
+ virtual void hadjustment_set_page_size(int size) = 0;
+ virtual void hadjustment_set_page_increment(int size) = 0;
+ virtual void hadjustment_set_step_increment(int size) = 0;
+ virtual void set_hpolicy(VclPolicyType eHPolicy) = 0;
+ virtual VclPolicyType get_hpolicy() const = 0;
+ void connect_hadjustment_changed(const Link<ScrolledWindow&, void>& rLink)
+ {
+ m_aHChangeHdl = rLink;
+ }
+
+ virtual void vadjustment_configure(int value, int lower, int upper, int step_increment,
+ int page_increment, int page_size)
+ = 0;
+ virtual int vadjustment_get_value() const = 0;
+ virtual void vadjustment_set_value(int value) = 0;
+ virtual int vadjustment_get_upper() const = 0;
+ virtual void vadjustment_set_upper(int upper) = 0;
+ virtual int vadjustment_get_page_size() const = 0;
+ virtual void vadjustment_set_page_size(int size) = 0;
+ virtual void vadjustment_set_page_increment(int size) = 0;
+ virtual void vadjustment_set_step_increment(int size) = 0;
+ virtual int vadjustment_get_lower() const = 0;
+ virtual void vadjustment_set_lower(int upper) = 0;
+ virtual void set_vpolicy(VclPolicyType eVPolicy) = 0;
+ virtual VclPolicyType get_vpolicy() const = 0;
+ void connect_vadjustment_changed(const Link<ScrolledWindow&, void>& rLink)
+ {
+ m_aVChangeHdl = rLink;
+ }
+ virtual int get_scroll_thickness() const = 0;
+ virtual void set_scroll_thickness(int nThickness) = 0;
+
+ //trying to use custom color for a scrollbar is generally a bad idea.
+ virtual void customize_scrollbars(const Color& rBackgroundColor, const Color& rShadowColor,
+ const Color& rFaceColor)
+ = 0;
+};
+
+class Label;
+
+class VCL_DLLPUBLIC Frame : virtual public Container
+{
+public:
+ virtual void set_label(const OUString& rText) = 0;
+ virtual OUString get_label() const = 0;
+ virtual std::unique_ptr<Label> weld_label_widget() const = 0;
+};
+
+class VCL_DLLPUBLIC Notebook : virtual public Widget
+{
+protected:
+ Link<const OString&, bool> m_aLeavePageHdl;
+ Link<const OString&, void> m_aEnterPageHdl;
+
+public:
+ virtual int get_current_page() const = 0;
+ virtual int get_page_index(const OString& rIdent) const = 0;
+ virtual OString get_page_ident(int nPage) const = 0;
+ virtual OString get_current_page_ident() const = 0;
+ virtual void set_current_page(int nPage) = 0;
+ virtual void set_current_page(const OString& rIdent) = 0;
+ virtual void remove_page(const OString& rIdent) = 0;
+ virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) = 0;
+ void append_page(const OString& rIdent, const OUString& rLabel)
+ {
+ insert_page(rIdent, rLabel, -1);
+ }
+ virtual void set_tab_label_text(const OString& rIdent, const OUString& rLabel) = 0;
+ virtual OUString get_tab_label_text(const OString& rIdent) const = 0;
+ virtual void set_show_tabs(bool bShow) = 0;
+ virtual int get_n_pages() const = 0;
+ virtual weld::Container* get_page(const OString& rIdent) const = 0;
+
+ void connect_leave_page(const Link<const OString&, bool>& rLink) { m_aLeavePageHdl = rLink; }
+ void connect_enter_page(const Link<const OString&, void>& rLink) { m_aEnterPageHdl = rLink; }
+};
+
+class VCL_DLLPUBLIC ScreenShotEntry
+{
+public:
+ ScreenShotEntry(const OString& rHelpId, const basegfx::B2IRange& rB2IRange)
+ : msHelpId(rHelpId)
+ , maB2IRange(rB2IRange)
+ {
+ }
+
+ const basegfx::B2IRange& getB2IRange() const { return maB2IRange; }
+
+ const OString& GetHelpId() const { return msHelpId; }
+
+private:
+ OString msHelpId;
+ basegfx::B2IRange maB2IRange;
+};
+
+typedef std::vector<ScreenShotEntry> ScreenShotCollection;
+
+class VCL_DLLPUBLIC Window : virtual public Container
+{
+protected:
+ Link<Widget&, bool> m_aHelpRequestHdl;
+
+public:
+ virtual void set_title(const OUString& rTitle) = 0;
+ virtual OUString get_title() const = 0;
+ virtual void window_move(int x, int y) = 0;
+ virtual void set_modal(bool bModal) = 0;
+ virtual bool get_modal() const = 0;
+ virtual bool get_resizable() const = 0;
+ virtual Size get_size() const = 0;
+ virtual Point get_position() const = 0;
+ virtual tools::Rectangle get_monitor_workarea() const = 0;
+ // center window on is parent
+ //
+ // bTrackGeometryRequests set to true tries to ensure the window will end
+ // up still centered on its parent windows final size, taking into account
+ // that there may currently be pending geometry requests for the parent not
+ // yet processed by the underlying toolkit
+ //
+ // for e.g gtk this will means the window is always centered even when
+ // resized, calling set_centered_on_parent with false will turn this
+ // off again.
+ virtual void set_centered_on_parent(bool bTrackGeometryRequests) = 0;
+ // returns whether the widget that has focus is within this Window
+ // (its very possible to move this to weld::Container if that becomes
+ // desirable)
+ virtual bool has_toplevel_focus() const = 0;
+ virtual void present() = 0;
+
+ // with pOld of null, automatically find the old default widget and unset
+ // it, otherwise use as hint to the old default
+ virtual void change_default_widget(weld::Widget* pOld, weld::Widget* pNew) = 0;
+ virtual bool is_default_widget(const weld::Widget* pCandidate) const = 0;
+
+ virtual void set_window_state(const OString& rStr) = 0;
+ virtual OString get_window_state(WindowStateMask nMask) const = 0;
+
+ virtual css::uno::Reference<css::awt::XWindow> GetXWindow() = 0;
+
+ void connect_help(const Link<Widget&, bool>& rLink) { m_aHelpRequestHdl = rLink; }
+
+ virtual SystemEnvData get_system_data() const = 0;
+
+ virtual void resize_to_request() = 0;
+
+ // collect positions of widgets and their help ids for screenshot purposes
+ virtual ScreenShotCollection collect_screenshot_data() = 0;
+
+ // render the widget to an output device
+ virtual VclPtr<VirtualDevice> screenshot() = 0;
+};
+
+class VCL_DLLPUBLIC WaitObject
+{
+private:
+ weld::Widget* m_pWindow;
+
+public:
+ WaitObject(weld::Widget* pWindow)
+ : m_pWindow(pWindow)
+ {
+ if (m_pWindow)
+ m_pWindow->set_busy_cursor(true);
+ }
+ ~WaitObject()
+ {
+ if (m_pWindow)
+ m_pWindow->set_busy_cursor(false);
+ }
+};
+
+class Button;
+
+class VCL_DLLPUBLIC Dialog : virtual public Window
+{
+private:
+ friend DialogController;
+ virtual bool runAsync(std::shared_ptr<DialogController>,
+ const std::function<void(sal_Int32)>& func)
+ = 0;
+
+public:
+ virtual int run() = 0;
+ // Run async without a controller
+ // @param self - must point to this, to enforce that the dialog was created/held by a shared_ptr
+ virtual bool runAsync(std::shared_ptr<Dialog> const& rxSelf,
+ const std::function<void(sal_Int32)>& func)
+ = 0;
+ virtual void response(int response) = 0;
+ virtual void add_button(const OUString& rText, int response, const OString& rHelpId = OString())
+ = 0;
+ virtual void set_default_response(int response) = 0;
+ virtual Button* weld_widget_for_response(int response) = 0;
+ virtual Container* weld_content_area() = 0;
+
+ // shrink the dialog down to shown just these widgets
+ virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) = 0;
+ // undo previous dialog collapse
+ virtual void undo_collapse() = 0;
+
+ virtual void SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink)
+ = 0;
+};
+
+class VCL_DLLPUBLIC MessageDialog : virtual public Dialog
+{
+public:
+ virtual void set_primary_text(const OUString& rText) = 0;
+ virtual OUString get_primary_text() const = 0;
+ virtual void set_secondary_text(const OUString& rText) = 0;
+ virtual OUString get_secondary_text() const = 0;
+ virtual Container* weld_message_area() = 0;
+};
+
+class VCL_DLLPUBLIC Assistant : virtual public Dialog
+{
+protected:
+ Link<const OString&, bool> m_aJumpPageHdl;
+
+ bool signal_jump_page(const OString& rIdent) { return m_aJumpPageHdl.Call(rIdent); }
+
+public:
+ virtual int get_current_page() const = 0;
+ virtual int get_n_pages() const = 0;
+ virtual OString get_page_ident(int nPage) const = 0;
+ virtual OString get_current_page_ident() const = 0;
+ virtual void set_current_page(int nPage) = 0;
+ virtual void set_current_page(const OString& rIdent) = 0;
+ // move the page rIdent to position nIndex
+ virtual void set_page_index(const OString& rIdent, int nIndex) = 0;
+ virtual void set_page_title(const OString& rIdent, const OUString& rTitle) = 0;
+ virtual OUString get_page_title(const OString& rIdent) const = 0;
+ virtual void set_page_sensitive(const OString& rIdent, bool bSensitive) = 0;
+ virtual weld::Container* append_page(const OString& rIdent) = 0;
+
+ virtual void set_page_side_help_id(const OString& rHelpId) = 0;
+
+ void connect_jump_page(const Link<const OString&, bool>& rLink) { m_aJumpPageHdl = rLink; }
+};
+
+inline OUString toId(const void* pValue)
+{
+ return OUString::number(reinterpret_cast<sal_uInt64>(pValue));
+}
+
+template <typename T> T fromId(const OUString& rValue)
+{
+ return reinterpret_cast<T>(rValue.toUInt64());
+}
+
+struct VCL_DLLPUBLIC ComboBoxEntry
+{
+ OUString sString;
+ OUString sId;
+ OUString sImage;
+ ComboBoxEntry(const OUString& rString)
+ : sString(rString)
+ {
+ }
+ ComboBoxEntry(const OUString& rString, const OUString& rId)
+ : sString(rString)
+ , sId(rId)
+ {
+ }
+ ComboBoxEntry(const OUString& rString, const OUString& rId, const OUString& rImage)
+ : sString(rString)
+ , sId(rId)
+ , sImage(rImage)
+ {
+ }
+};
+
+enum class EntryMessageType
+{
+ Normal,
+ Warning,
+ Error,
+};
+
+class Menu;
+
+/// A widget used to choose from a list of items.
+class VCL_DLLPUBLIC ComboBox : virtual public Widget
+{
+private:
+ OUString m_sSavedValue;
+ std::vector<OUString> m_aSavedValues;
+
+public:
+ // OUString is the id of the row, it may be null to measure the height of a generic line
+ typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, bool, const OUString&>
+ render_args;
+
+protected:
+ Link<ComboBox&, void> m_aChangeHdl;
+ Link<ComboBox&, void> m_aPopupToggledHdl;
+ Link<ComboBox&, bool> m_aEntryActivateHdl;
+ Link<OUString&, bool> m_aEntryInsertTextHdl;
+
+ friend class ::LOKTrigger;
+
+ void signal_changed() { m_aChangeHdl.Call(*this); }
+
+ virtual void signal_popup_toggled() { m_aPopupToggledHdl.Call(*this); }
+
+ Link<render_args, void> m_aRenderHdl;
+ void signal_custom_render(vcl::RenderContext& rDevice, const tools::Rectangle& rRect,
+ bool bSelected, const OUString& rId)
+ {
+ m_aRenderHdl.Call(render_args(rDevice, rRect, bSelected, rId));
+ }
+
+ Link<vcl::RenderContext&, Size> m_aGetSizeHdl;
+ Size signal_custom_get_size(vcl::RenderContext& rDevice) { return m_aGetSizeHdl.Call(rDevice); }
+
+public:
+ virtual void insert(int pos, const OUString& rStr, const OUString* pId,
+ const OUString* pIconName, VirtualDevice* pImageSurface)
+ = 0;
+ virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems, bool bKeepExisting)
+ = 0;
+ void insert_text(int pos, const OUString& rStr)
+ {
+ insert(pos, rStr, nullptr, nullptr, nullptr);
+ }
+ void append_text(const OUString& rStr) { insert(-1, rStr, nullptr, nullptr, nullptr); }
+ void append(const OUString& rId, const OUString& rStr)
+ {
+ insert(-1, rStr, &rId, nullptr, nullptr);
+ }
+ void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
+ {
+ insert(-1, rStr, &rId, &rImage, nullptr);
+ }
+ void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage)
+ {
+ insert(-1, rStr, &rId, nullptr, &rImage);
+ }
+ void append(int pos, const OUString& rId, const OUString& rStr)
+ {
+ insert(pos, rStr, &rId, nullptr, nullptr);
+ }
+ virtual void insert_separator(int pos, const OUString& rId) = 0;
+ void append_separator(const OUString& rId) { insert_separator(-1, rId); }
+
+ virtual int get_count() const = 0;
+ virtual void make_sorted() = 0;
+ virtual void clear() = 0;
+
+ //by index
+ virtual int get_active() const = 0;
+ virtual void set_active(int pos) = 0;
+ virtual void remove(int pos) = 0;
+
+ //by text
+ virtual OUString get_active_text() const = 0;
+ void set_active_text(const OUString& rStr) { set_active(find_text(rStr)); }
+ virtual OUString get_text(int pos) const = 0;
+ virtual int find_text(const OUString& rStr) const = 0;
+ void remove_text(const OUString& rText) { remove(find_text(rText)); }
+
+ //by id
+ virtual OUString get_active_id() const = 0;
+ virtual void set_active_id(const OUString& rStr) = 0;
+ virtual OUString get_id(int pos) const = 0;
+ virtual void set_id(int row, const OUString& rId) = 0;
+ virtual int find_id(const OUString& rId) const = 0;
+ void remove_id(const OUString& rId) { remove(find_id(rId)); }
+
+ /* m_aChangeHdl is called when the active item is changed. The can be due
+ to the user selecting a different item from the list or while typing
+ into the entry of a combo box with an entry.
+
+ Use changed_by_direct_pick() to discover whether an item was actually explicitly
+ selected, e.g. from the menu.
+ */
+ void connect_changed(const Link<ComboBox&, void>& rLink) { m_aChangeHdl = rLink; }
+
+ virtual bool changed_by_direct_pick() const = 0;
+
+ virtual void connect_popup_toggled(const Link<ComboBox&, void>& rLink)
+ {
+ m_aPopupToggledHdl = rLink;
+ }
+
+ //entry related
+ virtual bool has_entry() const = 0;
+ virtual void set_entry_message_type(EntryMessageType eType) = 0;
+ virtual void set_entry_text(const OUString& rStr) = 0;
+ virtual void set_entry_width_chars(int nChars) = 0;
+ virtual void set_entry_max_length(int nChars) = 0;
+ virtual void select_entry_region(int nStartPos, int nEndPos) = 0;
+ virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) = 0;
+ virtual void set_entry_completion(bool bEnable, bool bCaseSensitive = false) = 0;
+ virtual void set_entry_placeholder_text(const OUString& rText) = 0;
+ virtual void set_entry_editable(bool bEditable) = 0;
+ virtual void cut_entry_clipboard() = 0;
+ virtual void copy_entry_clipboard() = 0;
+ virtual void paste_entry_clipboard() = 0;
+
+ // font size is in points, not pixels, e.g. see Window::[G]etPointFont
+ virtual void set_font(const vcl::Font& rFont) = 0;
+
+ // font size is in points, not pixels, e.g. see Window::[G]etPointFont
+ virtual void set_entry_font(const vcl::Font& rFont) = 0;
+ virtual vcl::Font get_entry_font() = 0;
+
+ virtual bool get_popup_shown() const = 0;
+
+ void connect_entry_insert_text(const Link<OUString&, bool>& rLink)
+ {
+ m_aEntryInsertTextHdl = rLink;
+ }
+
+ // callback returns true to indicated no further processing of activate wanted
+ void connect_entry_activate(const Link<ComboBox&, bool>& rLink) { m_aEntryActivateHdl = rLink; }
+
+ void save_value() { m_sSavedValue = get_active_text(); }
+
+ void save_values_by_id(const OUString& rId)
+ {
+ m_aSavedValues.push_back(get_text(find_id(rId)));
+ }
+
+ OUString const& get_saved_value() const { return m_sSavedValue; }
+ OUString const& get_saved_values(int pos) const { return m_aSavedValues[pos]; }
+ bool get_value_changed_from_saved() const { return m_sSavedValue != get_active_text(); }
+ bool get_values_changed_from_saved() const
+ {
+ return !m_aSavedValues.empty()
+ && std::find(m_aSavedValues.begin(), m_aSavedValues.end(), get_active_text())
+ == m_aSavedValues.end();
+ }
+
+ void removeSavedValues() { m_aSavedValues.clear(); }
+
+ // for custom rendering a row
+ void connect_custom_get_size(const Link<vcl::RenderContext&, Size>& rLink)
+ {
+ m_aGetSizeHdl = rLink;
+ }
+ void connect_custom_render(const Link<render_args, void>& rLink) { m_aRenderHdl = rLink; }
+ // call set_custom_renderer after setting custom callbacks
+ virtual void set_custom_renderer(bool bOn) = 0;
+ // create a virtual device compatible with the device passed in render_args wrt alpha
+ virtual VclPtr<VirtualDevice> create_render_virtual_device() const = 0;
+ // set a sub menu for a entry, only works with custom rendering
+ virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) = 0;
+ // get the width needed to show the menu launcher in a custom row
+ virtual int get_menu_button_width() const = 0;
+
+ // for mru support
+ virtual int get_max_mru_count() const = 0;
+ virtual void set_max_mru_count(int nCount) = 0;
+ virtual OUString get_mru_entries() const = 0;
+ virtual void set_mru_entries(const OUString& rEntries) = 0;
+};
+
+enum class ColumnToggleType
+{
+ Check,
+ Radio
+};
+
+class VCL_DLLPUBLIC TreeIter
+{
+private:
+ TreeIter(const TreeIter&) = delete;
+ TreeIter& operator=(const TreeIter&) = delete;
+
+public:
+ TreeIter() {}
+ virtual bool equal(const TreeIter& rOther) const = 0;
+ virtual ~TreeIter() {}
+};
+
+/* Model column indexes are considered to begin at 0, but with special columns
+ before index 0. A expander image column (and an additional optional toggle
+ button column when enable_toggle_buttons is used). Column index -1 is
+ reserved to access those columns.
+*/
+class VCL_DLLPUBLIC TreeView : virtual public Widget
+{
+ friend class ::LOKTrigger;
+
+public:
+ typedef std::pair<const TreeIter&, int> iter_col;
+ typedef std::pair<const TreeIter&, OUString> iter_string;
+ // OUString is the id of the row, it may be null to measure the height of a generic line
+ typedef std::pair<vcl::RenderContext&, const OUString&> get_size_args;
+ typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, bool, const OUString&>
+ render_args;
+
+private:
+ OUString m_sSavedValue;
+
+protected:
+ Link<TreeView&, void> m_aChangeHdl;
+ Link<TreeView&, bool> m_aRowActivatedHdl;
+ Link<int, void> m_aColumnClickedHdl;
+ Link<const iter_col&, void> m_aRadioToggleHdl;
+ Link<const TreeIter&, bool> m_aEditingStartedHdl;
+ Link<const iter_string&, bool> m_aEditingDoneHdl;
+ // if handler returns false, the expansion of the row is refused
+ Link<const TreeIter&, bool> m_aExpandingHdl;
+ // if handler returns false, the collapse of the row is refused
+ Link<const TreeIter&, bool> m_aCollapsingHdl;
+ Link<TreeView&, void> m_aVisibleRangeChangedHdl;
+ Link<TreeView&, void> m_aModelChangedHdl;
+ // if handler returns true, then menu has been show and event is consumed
+ Link<const CommandEvent&, bool> m_aPopupMenuHdl;
+ // if handler returns true, drag is disallowed, consumer can change bool
+ // arg to false to disable the treeview default dnd icon
+ Link<bool&, bool> m_aDragBeginHdl;
+ std::function<int(const weld::TreeIter&, const weld::TreeIter&)> m_aCustomSort;
+
+protected:
+ void signal_changed() { m_aChangeHdl.Call(*this); }
+ bool signal_row_activated() { return m_aRowActivatedHdl.Call(*this); }
+ void signal_column_clicked(int nColumn) { m_aColumnClickedHdl.Call(nColumn); }
+ bool signal_expanding(const TreeIter& rIter)
+ {
+ return !m_aExpandingHdl.IsSet() || m_aExpandingHdl.Call(rIter);
+ }
+ bool signal_collapsing(const TreeIter& rIter)
+ {
+ return !m_aCollapsingHdl.IsSet() || m_aCollapsingHdl.Call(rIter);
+ }
+ void signal_visible_range_changed() { m_aVisibleRangeChangedHdl.Call(*this); }
+ void signal_model_changed() { m_aModelChangedHdl.Call(*this); }
+
+ void signal_toggled(const iter_col& rIterCol) { m_aRadioToggleHdl.Call(rIterCol); }
+
+ bool signal_editing_started(const TreeIter& rIter) { return m_aEditingStartedHdl.Call(rIter); }
+
+ bool signal_editing_done(const iter_string& rIterText)
+ {
+ return m_aEditingDoneHdl.Call(rIterText);
+ }
+
+ Link<const TreeIter&, OUString> m_aQueryTooltipHdl;
+ OUString signal_query_tooltip(const TreeIter& rIter) { return m_aQueryTooltipHdl.Call(rIter); }
+
+ Link<render_args, void> m_aRenderHdl;
+ void signal_custom_render(vcl::RenderContext& rDevice, const tools::Rectangle& rRect,
+ bool bSelected, const OUString& rId)
+ {
+ m_aRenderHdl.Call(render_args(rDevice, rRect, bSelected, rId));
+ }
+
+ Link<get_size_args, Size> m_aGetSizeHdl;
+ Size signal_custom_get_size(vcl::RenderContext& rDevice, const OUString& rId)
+ {
+ return m_aGetSizeHdl.Call(get_size_args(rDevice, rId));
+ }
+
+public:
+ virtual void connect_query_tooltip(const Link<const TreeIter&, OUString>& rLink)
+ {
+ assert(!m_aQueryTooltipHdl.IsSet() || !rLink.IsSet());
+ m_aQueryTooltipHdl = rLink;
+ }
+
+ // see 'expanding on-demand node details' for bChildrenOnDemand of true
+ virtual void insert(const TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
+ const OUString* pIconName, VirtualDevice* pImageSurface,
+ bool bChildrenOnDemand, TreeIter* pRet)
+ = 0;
+
+ void insert(int nRow, TreeIter* pRet = nullptr)
+ {
+ insert(nullptr, nRow, nullptr, nullptr, nullptr, nullptr, false, pRet);
+ }
+
+ void append(TreeIter* pRet = nullptr) { insert(-1, pRet); }
+
+ void insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName,
+ VirtualDevice* pImageSurface)
+ {
+ insert(nullptr, pos, &rStr, pId, pIconName, pImageSurface, false, nullptr);
+ }
+ void insert_text(int pos, const OUString& rStr)
+ {
+ insert(nullptr, pos, &rStr, nullptr, nullptr, nullptr, false, nullptr);
+ }
+ void append_text(const OUString& rStr)
+ {
+ insert(nullptr, -1, &rStr, nullptr, nullptr, nullptr, false, nullptr);
+ }
+ void append(const OUString& rId, const OUString& rStr)
+ {
+ insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, false, nullptr);
+ }
+ void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
+ {
+ insert(nullptr, -1, &rStr, &rId, &rImage, nullptr, false, nullptr);
+ }
+ void append(const TreeIter* pParent, const OUString& rStr)
+ {
+ insert(pParent, -1, &rStr, nullptr, nullptr, nullptr, false, nullptr);
+ }
+
+ virtual void insert_separator(int pos, const OUString& rId) = 0;
+ void append_separator(const OUString& rId) { insert_separator(-1, rId); }
+
+ void connect_changed(const Link<TreeView&, void>& rLink) { m_aChangeHdl = rLink; }
+
+ /* A row is "activated" when the user double clicks a treeview row. It may
+ also be emitted when a row is selected and Space or Enter is pressed.
+
+ a return of "true" means the activation has been handled, a "false" propagates
+ the activation to the default handler which expands/collapses the row, if possible.
+ */
+ void connect_row_activated(const Link<TreeView&, bool>& rLink) { m_aRowActivatedHdl = rLink; }
+
+ // Argument is a pair of iter, col describing the toggled node
+ void connect_toggled(const Link<const iter_col&, void>& rLink) { m_aRadioToggleHdl = rLink; }
+
+ void connect_column_clicked(const Link<int, void>& rLink) { m_aColumnClickedHdl = rLink; }
+ void connect_model_changed(const Link<TreeView&, void>& rLink) { m_aModelChangedHdl = rLink; }
+
+ virtual OUString get_selected_text() const = 0;
+ virtual OUString get_selected_id() const = 0;
+
+ // call before inserting any content and connecting to toggle signals,
+ // an pre-inserted checkbutton column will exist at the start of every row
+ // inserted after this call which can be accessed with col index -1
+ virtual void enable_toggle_buttons(ColumnToggleType eType) = 0;
+
+ virtual void set_clicks_to_toggle(int nToggleBehavior) = 0;
+
+ //by index
+ virtual int get_selected_index() const = 0;
+ //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
+ virtual void select(int pos) = 0;
+ virtual void unselect(int pos) = 0;
+ virtual void remove(int pos) = 0;
+ // col index -1 gets the first text column
+ virtual OUString get_text(int row, int col = -1) const = 0;
+ // col index -1 sets the first text column
+ virtual void set_text(int row, const OUString& rText, int col = -1) = 0;
+ // col index -1 sets the first text column
+ virtual void set_sensitive(int row, bool bSensitive, int col = -1) = 0;
+ virtual void set_id(int row, const OUString& rId) = 0;
+ // col index -1 sets the expander toggle, enable_toggle_buttons must have been called to create that column
+ virtual void set_toggle(int row, TriState eState, int col = -1) = 0;
+ // col index -1 gets the expander toggle, enable_toggle_buttons must have been called to create that column
+ virtual TriState get_toggle(int row, int col = -1) const = 0;
+ // col index -1 sets the expander image
+ virtual void set_image(int row, const OUString& rImage, int col = -1) = 0;
+ // col index -1 sets the expander image
+ virtual void set_image(int row, VirtualDevice& rImage, int col = -1) = 0;
+ // col index -1 sets the expander image
+ virtual void set_image(int row, const css::uno::Reference<css::graphic::XGraphic>& rImage,
+ int col = -1)
+ = 0;
+ virtual void set_text_emphasis(int row, bool bOn, int col) = 0;
+ virtual bool get_text_emphasis(int row, int col) const = 0;
+ virtual void set_text_align(int row, double fAlign, int col) = 0;
+ virtual void swap(int pos1, int pos2) = 0;
+ virtual std::vector<int> get_selected_rows() const = 0;
+ virtual void set_font_color(int pos, const Color& rColor) = 0;
+ // scroll to make 'row' visible, this will also expand all parent rows of 'row' as necessary to
+ // make 'row' visible
+ virtual void scroll_to_row(int row) = 0;
+ virtual bool is_selected(int pos) const = 0;
+ virtual int get_cursor_index() const = 0;
+ virtual void set_cursor(int pos) = 0;
+
+ //by text
+ virtual int find_text(const OUString& rText) const = 0;
+ //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
+ void select_text(const OUString& rText) { select(find_text(rText)); }
+ void remove_text(const OUString& rText) { remove(find_text(rText)); }
+ std::vector<OUString> get_selected_rows_text() const
+ {
+ std::vector<int> aRows(get_selected_rows());
+ std::vector<OUString> aRet;
+ aRet.reserve(aRows.size());
+ for (auto a : aRows)
+ aRet.push_back(get_text(a));
+ return aRet;
+ }
+
+ //by id
+ virtual OUString get_id(int pos) const = 0;
+ virtual int find_id(const OUString& rId) const = 0;
+ //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
+ void select_id(const OUString& rId) { select(find_id(rId)); }
+ void remove_id(const OUString& rText) { remove(find_id(rText)); }
+
+ //via iter
+ virtual std::unique_ptr<TreeIter> make_iterator(const TreeIter* pOrig = nullptr) const = 0;
+ virtual void copy_iterator(const TreeIter& rSource, TreeIter& rDest) const = 0;
+ virtual bool get_selected(TreeIter* pIter) const = 0;
+ virtual bool get_cursor(TreeIter* pIter) const = 0;
+ virtual void set_cursor(const TreeIter& rIter) = 0;
+ virtual bool get_iter_first(TreeIter& rIter) const = 0;
+ // set iter to point to next node at the current level
+ virtual bool iter_next_sibling(TreeIter& rIter) const = 0;
+ // set iter to point to previous node at the current level
+ virtual bool iter_previous_sibling(TreeIter& rIter) const = 0;
+ // set iter to point to next node, depth first, then sibling
+ virtual bool iter_next(TreeIter& rIter) const = 0;
+ // set iter to point to previous node, sibling first then depth
+ virtual bool iter_previous(TreeIter& rIter) const = 0;
+ // set iter to point to first child node
+ virtual bool iter_children(TreeIter& rIter) const = 0;
+ bool iter_nth_sibling(TreeIter& rIter, int nChild) const
+ {
+ bool bRet = true;
+ for (int i = 0; i < nChild && bRet; ++i)
+ bRet = iter_next_sibling(rIter);
+ return bRet;
+ }
+ bool iter_nth_child(TreeIter& rIter, int nChild) const
+ {
+ if (!iter_children(rIter))
+ return false;
+ return iter_nth_sibling(rIter, nChild);
+ }
+ virtual bool iter_parent(TreeIter& rIter) const = 0;
+ virtual int get_iter_depth(const TreeIter& rIter) const = 0;
+ virtual int get_iter_index_in_parent(const TreeIter& rIter) const = 0;
+ /* Compares two paths. If a appears before b in a tree, then -1 is returned.
+ If b appears before a , then 1 is returned. If the two nodes are equal,
+ then 0 is returned.
+ */
+ virtual int iter_compare(const TreeIter& a, const TreeIter& b) const = 0;
+ virtual bool iter_has_child(const TreeIter& rIter) const = 0;
+ // returns the number of direct children rIter has
+ virtual int iter_n_children(const TreeIter& rIter) const = 0;
+ virtual void remove(const TreeIter& rIter) = 0;
+ //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
+ virtual void select(const TreeIter& rIter) = 0;
+ virtual void unselect(const TreeIter& rIter) = 0;
+ //visually indent this row as if it was at get_iter_depth() + nIndentLevel
+ virtual void set_extra_row_indent(const TreeIter& rIter, int nIndentLevel) = 0;
+ // col index -1 sets the first text column
+ virtual void set_text(const TreeIter& rIter, const OUString& rStr, int col = -1) = 0;
+ // col index -1 sets the first text column
+ virtual void set_sensitive(const TreeIter& rIter, bool bSensitive, int col = -1) = 0;
+ virtual void set_text_emphasis(const TreeIter& rIter, bool bOn, int col) = 0;
+ virtual bool get_text_emphasis(const TreeIter& rIter, int col) const = 0;
+ virtual void set_text_align(const TreeIter& rIter, double fAlign, int col) = 0;
+ // col index -1 sets the expander toggle, enable_toggle_buttons must have been called to create that column
+ virtual void set_toggle(const TreeIter& rIter, TriState bOn, int col = -1) = 0;
+ // col index -1 gets the expander toggle, enable_toggle_buttons must have been called to create that column
+ virtual TriState get_toggle(const TreeIter& rIter, int col = -1) const = 0;
+ // col index -1 gets the first text column
+ virtual OUString get_text(const TreeIter& rIter, int col = -1) const = 0;
+ virtual void set_id(const TreeIter& rIter, const OUString& rId) = 0;
+ virtual OUString get_id(const TreeIter& rIter) const = 0;
+ // col index -1 sets the expander image
+ virtual void set_image(const TreeIter& rIter, const OUString& rImage, int col = -1) = 0;
+ // col index -1 sets the expander image
+ virtual void set_image(const TreeIter& rIter, VirtualDevice& rImage, int col = -1) = 0;
+ // col index -1 sets the expander image
+ virtual void set_image(const TreeIter& rIter,
+ const css::uno::Reference<css::graphic::XGraphic>& rImage, int col = -1)
+ = 0;
+ virtual void set_font_color(const TreeIter& rIter, const Color& rColor) = 0;
+ // scroll to make rIter visible, this will also expand all parent rows of rIter as necessary to
+ // make rIter visible
+ virtual void scroll_to_row(const TreeIter& rIter) = 0;
+ virtual bool is_selected(const TreeIter& rIter) const = 0;
+
+ virtual void move_subtree(TreeIter& rNode, const TreeIter* pNewParent, int nIndexInNewParent)
+ = 0;
+
+ // call func on each element until func returns true or we run out of elements
+ virtual void all_foreach(const std::function<bool(TreeIter&)>& func) = 0;
+ // call func on each selected element until func returns true or we run out of elements
+ virtual void selected_foreach(const std::function<bool(TreeIter&)>& func) = 0;
+ // call func on each visible element until func returns true or we run out of elements
+ virtual void visible_foreach(const std::function<bool(TreeIter&)>& func) = 0;
+ // clear the children of pParent (whole tree if nullptr),
+ // then add nSourceCount rows under pParent, call func on each row
+ // inserted with an arg of the index that this row will be when bulk insert
+ // ends.
+ //
+ // this enables inserting the entries backwards in models where that is faster,
+ //
+ // pFixedWidths is optional, when present each matching entry col text
+ // width will not be measured, and the fixed width used instead. Use
+ // sparingly because wider text than the fixed width is clipped and cannot
+ // be scrolled into view horizontally.
+ virtual void bulk_insert_for_each(int nSourceCount,
+ const std::function<void(TreeIter&, int nSourceIndex)>& func,
+ const weld::TreeIter* pParent = nullptr,
+ const std::vector<int>* pFixedWidths = nullptr)
+ = 0;
+
+ /* expanding on-demand node details
+
+ When a node is added with children-on-demand (typically via 'insert' with
+ bChildrenOnDemand of true), then initially in reality the
+ children-on-demand node is given a 'placeholder' child entry to indicate
+ the load-on-demand state.
+
+ The 'placeholder' needs to be there for the expander indicator to be
+ drawn/shown even when there are no "real" entries yet. This child doesn't
+ exist for the purposes of any of the iterator methods, e.g. iter_has_child
+ on an on-demand node which hasn't been expanded yet is false. Likewise the
+ rest of the iterator methods skip over or otherwise ignore that node.
+
+ Normal usage is the user clicks on the expander, the expansion mechanism
+ removes the 'placeholder' entry (set_children_on_demand(false)) and calls
+ any installed expanding-callback (installable via connect_expanding) which
+ has the opportunity to populate the node with children.
+
+ If you decide to directly populate the children of an on-demand node
+ outside of the expanding-callback then you also need to explicitly remove
+ the 'placeholder' with set_children_on_demand(false) otherwise the treeview
+ is in an inconsistent state. */
+
+ virtual bool get_row_expanded(const TreeIter& rIter) const = 0;
+ // expand row will first trigger the callback set via connect_expanding before expanding
+ virtual void expand_row(const TreeIter& rIter) = 0;
+ // collapse row will first trigger the callback set via connect_collapsing before collapsing
+ virtual void collapse_row(const TreeIter& rIter) = 0;
+ // set the empty node to appear as if it has children, true is equivalent
+ // to 'insert' with a bChildrenOnDemand of true. See notes above.
+ virtual void set_children_on_demand(const TreeIter& rIter, bool bChildrenOnDemand) = 0;
+ // return if the node is configured to be populated on-demand
+ virtual bool get_children_on_demand(const TreeIter& rIter) const = 0;
+ // set if the expanders are shown or not
+ virtual void set_show_expanders(bool bShow) = 0;
+
+ void connect_expanding(const Link<const TreeIter&, bool>& rLink) { m_aExpandingHdl = rLink; }
+ void connect_collapsing(const Link<const TreeIter&, bool>& rLink) { m_aCollapsingHdl = rLink; }
+
+ // rStartLink returns true to allow editing, false to disallow
+ // rEndLink returns true to accept the edit, false to reject
+ virtual void connect_editing(const Link<const TreeIter&, bool>& rStartLink,
+ const Link<const iter_string&, bool>& rEndLink)
+ {
+ assert(rStartLink.IsSet() == rEndLink.IsSet() && "should be both on or both off");
+ m_aEditingStartedHdl = rStartLink;
+ m_aEditingDoneHdl = rEndLink;
+ }
+
+ virtual void start_editing(const weld::TreeIter& rEntry) = 0;
+ virtual void end_editing() = 0;
+
+ virtual void connect_visible_range_changed(const Link<TreeView&, void>& rLink)
+ {
+ assert(!m_aVisibleRangeChangedHdl.IsSet() || !rLink.IsSet());
+ m_aVisibleRangeChangedHdl = rLink;
+ }
+
+ virtual void connect_popup_menu(const Link<const CommandEvent&, bool>& rLink)
+ {
+ m_aPopupMenuHdl = rLink;
+ }
+
+ virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rTransferrable,
+ sal_uInt8 eDNDConstants)
+ = 0;
+
+ void connect_drag_begin(const Link<bool&, bool>& rLink) { m_aDragBeginHdl = rLink; }
+
+ //all of them. Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
+ void select_all() { unselect(-1); }
+ void unselect_all() { select(-1); }
+
+ // return the number of toplevel nodes
+ virtual int n_children() const = 0;
+
+ // afterwards, entries will be in default ascending sort order
+ virtual void make_sorted() = 0;
+ virtual void make_unsorted() = 0;
+ virtual bool get_sort_order() const = 0;
+ virtual void set_sort_order(bool bAscending) = 0;
+
+ // TRUE ascending, FALSE, descending, INDET, neither (off)
+ virtual void set_sort_indicator(TriState eState, int nColumn) = 0;
+ virtual TriState get_sort_indicator(int nColumn) const = 0;
+
+ virtual int get_sort_column() const = 0;
+ virtual void set_sort_column(int nColumn) = 0;
+
+ virtual void
+ set_sort_func(const std::function<int(const weld::TreeIter&, const weld::TreeIter&)>& func)
+ {
+ m_aCustomSort = func;
+ }
+
+ virtual void clear() = 0;
+ virtual int get_height_rows(int nRows) const = 0;
+
+ virtual void columns_autosize() = 0;
+ virtual void set_column_fixed_widths(const std::vector<int>& rWidths) = 0;
+ virtual void set_column_editables(const std::vector<bool>& rEditables) = 0;
+ virtual int get_column_width(int nCol) const = 0;
+ virtual void set_centered_column(int nCol) = 0;
+ virtual OUString get_column_title(int nColumn) const = 0;
+ virtual void set_column_title(int nColumn, const OUString& rTitle) = 0;
+
+ int get_checkbox_column_width() const { return get_approximate_digit_width() * 3 + 6; }
+
+ virtual void set_selection_mode(SelectionMode eMode) = 0;
+ virtual int count_selected_rows() const = 0;
+ // remove the selected nodes
+ virtual void remove_selection() = 0;
+
+ // only meaningful is call this from a "changed" callback, true if the change
+ // was due to mouse hovering over the entry
+ virtual bool changed_by_hover() const = 0;
+
+ virtual void vadjustment_set_value(int value) = 0;
+ virtual int vadjustment_get_value() const = 0;
+
+ void save_value() { m_sSavedValue = get_selected_text(); }
+ OUString const& get_saved_value() const { return m_sSavedValue; }
+ bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); }
+
+ // for custom rendering a cell
+ void connect_custom_get_size(const Link<get_size_args, Size>& rLink) { m_aGetSizeHdl = rLink; }
+ void connect_custom_render(const Link<render_args, void>& rLink) { m_aRenderHdl = rLink; }
+ // call set_column_custom_renderer after setting custom callbacks
+ virtual void set_column_custom_renderer(int nColumn, bool bEnable) = 0;
+ // redraw all rows, typically only useful with custom rendering to redraw due to external
+ // state change
+ virtual void queue_draw() = 0;
+
+ /* with bDnDMode false simply return the row under the point
+ *
+ * with bDnDMode true:
+ * a) return the row which should be dropped on, which may
+ * be different from the row the mouse is over in some backends where
+ * positioning the mouse on the bottom half of a row indicates to drop
+ * after the row
+ * b) dnd highlight the dest row
+ */
+ virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult, bool bDnDMode) = 0;
+ virtual void unset_drag_dest_row() = 0;
+ virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const = 0;
+ // for dragging and dropping between TreeViews, return the active source
+ virtual TreeView* get_drag_source() const = 0;
+
+ using Widget::set_sensitive;
+};
+
+class VCL_DLLPUBLIC IconView : virtual public Widget
+{
+ friend class ::LOKTrigger;
+
+private:
+ OUString m_sSavedValue;
+
+protected:
+ Link<IconView&, void> m_aSelectionChangeHdl;
+ Link<IconView&, bool> m_aItemActivatedHdl;
+ Link<const CommandEvent&, bool> m_aCommandHdl;
+ Link<const TreeIter&, OUString> m_aQueryTooltipHdl;
+
+ void signal_selection_changed() { m_aSelectionChangeHdl.Call(*this); }
+ bool signal_item_activated() { return m_aItemActivatedHdl.Call(*this); }
+ OUString signal_query_tooltip(const TreeIter& rIter) const
+ {
+ return m_aQueryTooltipHdl.Call(rIter);
+ }
+
+public:
+ virtual int get_item_width() const = 0;
+ virtual void set_item_width(int width) = 0;
+
+ virtual void insert(int pos, const OUString* pStr, const OUString* pId,
+ const OUString* pIconName, TreeIter* pRet)
+ = 0;
+
+ virtual void insert(int pos, const OUString* pStr, const OUString* pId,
+ const VirtualDevice* pIcon, TreeIter* pRet)
+ = 0;
+
+ virtual void insert_separator(int pos, const OUString* pId) = 0;
+
+ void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
+ {
+ insert(-1, &rStr, &rId, &rImage, nullptr);
+ }
+
+ void append(const OUString& rId, const OUString& rStr, const VirtualDevice* pImage)
+ {
+ insert(-1, &rStr, &rId, pImage, nullptr);
+ }
+
+ void append_separator(const OUString& rId) { insert_separator(-1, &rId); }
+
+ void connect_selection_changed(const Link<IconView&, void>& rLink)
+ {
+ m_aSelectionChangeHdl = rLink;
+ }
+
+ /* A row is "activated" when the user double clicks a treeview row. It may
+ also be emitted when a row is selected and Space or Enter is pressed.
+
+ a return of "true" means the activation has been handled, a "false" propagates
+ the activation to the default handler which expands/collapses the row, if possible.
+ */
+ void connect_item_activated(const Link<IconView&, bool>& rLink) { m_aItemActivatedHdl = rLink; }
+
+ void connect_command(const Link<const CommandEvent&, bool>& rLink) { m_aCommandHdl = rLink; }
+
+ virtual void connect_query_tooltip(const Link<const TreeIter&, OUString>& rLink)
+ {
+ m_aQueryTooltipHdl = rLink;
+ }
+
+ virtual OUString get_selected_id() const = 0;
+
+ virtual void clear() = 0;
+
+ virtual int count_selected_items() const = 0;
+
+ virtual OUString get_selected_text() const = 0;
+
+ //by index. Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
+ virtual void select(int pos) = 0;
+ virtual void unselect(int pos) = 0;
+
+ //via iter
+ virtual std::unique_ptr<TreeIter> make_iterator(const TreeIter* pOrig = nullptr) const = 0;
+ virtual bool get_selected(TreeIter* pIter) const = 0;
+ virtual bool get_cursor(TreeIter* pIter) const = 0;
+ virtual void set_cursor(const TreeIter& rIter) = 0;
+ virtual bool get_iter_first(TreeIter& rIter) const = 0;
+ virtual OUString get_id(const TreeIter& rIter) const = 0;
+ virtual void scroll_to_item(const TreeIter& rIter) = 0;
+
+ // call func on each selected element until func returns true or we run out of elements
+ virtual void selected_foreach(const std::function<bool(TreeIter&)>& func) = 0;
+
+ //all of them. Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
+ void select_all() { unselect(-1); }
+ void unselect_all() { select(-1); }
+
+ // return the number of toplevel nodes
+ virtual int n_children() const = 0;
+
+ void save_value() { m_sSavedValue = get_selected_text(); }
+ OUString const& get_saved_value() const { return m_sSavedValue; }
+ bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); }
+};
+
+class VCL_DLLPUBLIC Button : virtual public Widget
+{
+ friend class ::LOKTrigger;
+
+protected:
+ Link<Button&, void> m_aClickHdl;
+
+ void signal_clicked() { m_aClickHdl.Call(*this); }
+
+public:
+ virtual void set_label(const OUString& rText) = 0;
+ // pDevice, the image for the button, or nullptr to unset
+ virtual void set_image(VirtualDevice* pDevice) = 0;
+ virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) = 0;
+ virtual void set_from_icon_name(const OUString& rIconName) = 0;
+ virtual OUString get_label() const = 0;
+ void clicked() { signal_clicked(); }
+
+ // font size is in points, not pixels, e.g. see Window::[G]etPointFont
+ virtual void set_font(const vcl::Font& rFont) = 0;
+
+ /* Sometimes, a widget should behave like a button (activate on click,
+ accept keyboard focus, etc), but look entirely different.
+
+ pDevice, the custom look to use, or nullptr to unset.
+
+ Typically doing this is ill advised. Consider using
+ set_accessible_name if you do. */
+ virtual void set_custom_button(VirtualDevice* pDevice) = 0;
+
+ void connect_clicked(const Link<Button&, void>& rLink) { m_aClickHdl = rLink; }
+};
+
+class VCL_DLLPUBLIC Toggleable : virtual public Widget
+{
+ friend class ::LOKTrigger;
+
+protected:
+ Link<Toggleable&, void> m_aToggleHdl;
+ TriState m_eSavedValue = TRISTATE_FALSE;
+
+ void signal_toggled() { m_aToggleHdl.Call(*this); }
+
+public:
+ virtual void set_active(bool active) = 0;
+ virtual bool get_active() const = 0;
+
+ virtual void set_inconsistent(bool inconsistent) = 0;
+ virtual bool get_inconsistent() const = 0;
+
+ TriState get_state() const
+ {
+ if (get_inconsistent())
+ return TRISTATE_INDET;
+ else if (get_active())
+ return TRISTATE_TRUE;
+ return TRISTATE_FALSE;
+ }
+
+ void set_state(TriState eState)
+ {
+ switch (eState)
+ {
+ case TRISTATE_INDET:
+ set_inconsistent(true);
+ break;
+ case TRISTATE_TRUE:
+ set_inconsistent(false);
+ set_active(true);
+ break;
+ case TRISTATE_FALSE:
+ set_inconsistent(false);
+ set_active(false);
+ break;
+ }
+ }
+
+ void save_state() { m_eSavedValue = get_state(); }
+ TriState get_saved_state() const { return m_eSavedValue; }
+ bool get_state_changed_from_saved() const { return m_eSavedValue != get_state(); }
+
+ virtual void connect_toggled(const Link<Toggleable&, void>& rLink) { m_aToggleHdl = rLink; }
+};
+
+class VCL_DLLPUBLIC ToggleButton : virtual public Button, virtual public Toggleable
+{
+ friend class ::LOKTrigger;
+};
+
+struct VCL_DLLPUBLIC TriStateEnabled
+{
+ TriState eState;
+ bool bTriStateEnabled;
+ TriStateEnabled()
+ : eState(TRISTATE_INDET)
+ , bTriStateEnabled(true)
+ {
+ }
+ void ButtonToggled(Toggleable& rToggle);
+};
+
+class VCL_DLLPUBLIC MenuButton : virtual public ToggleButton
+{
+protected:
+ Link<const OString&, void> m_aSelectHdl;
+
+ void signal_selected(const OString& rIdent) { m_aSelectHdl.Call(rIdent); }
+
+public:
+ void connect_selected(const Link<const OString&, void>& rLink) { m_aSelectHdl = rLink; }
+
+ virtual void insert_item(int pos, const OUString& rId, const OUString& rStr,
+ const OUString* pIconName, VirtualDevice* pImageSurface,
+ TriState eCheckRadioFalse)
+ = 0;
+ void append_item(const OUString& rId, const OUString& rStr)
+ {
+ insert_item(-1, rId, rStr, nullptr, nullptr, TRISTATE_INDET);
+ }
+ void append_item_check(const OUString& rId, const OUString& rStr)
+ {
+ insert_item(-1, rId, rStr, nullptr, nullptr, TRISTATE_TRUE);
+ }
+ void append_item_radio(const OUString& rId, const OUString& rStr)
+ {
+ insert_item(-1, rId, rStr, nullptr, nullptr, TRISTATE_FALSE);
+ }
+ void append_item(const OUString& rId, const OUString& rStr, const OUString& rImage)
+ {
+ insert_item(-1, rId, rStr, &rImage, nullptr, TRISTATE_INDET);
+ }
+ void append_item(const OUString& rId, const OUString& rStr, VirtualDevice& rImage)
+ {
+ insert_item(-1, rId, rStr, nullptr, &rImage, TRISTATE_INDET);
+ }
+ virtual void insert_separator(int pos, const OUString& rId) = 0;
+ void append_separator(const OUString& rId) { insert_separator(-1, rId); }
+ virtual void remove_item(const OString& rId) = 0;
+ virtual void clear() = 0;
+ virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) = 0;
+ virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
+ virtual void set_item_label(const OString& rIdent, const OUString& rLabel) = 0;
+ virtual OUString get_item_label(const OString& rIdent) const = 0;
+ virtual void set_item_visible(const OString& rIdent, bool bVisible) = 0;
+
+ virtual void set_popover(weld::Widget* pPopover) = 0;
+};
+
+// Similar to a MenuButton except it is split into two parts, a toggle
+// button at the start and a menubutton at the end
+class VCL_DLLPUBLIC MenuToggleButton : virtual public MenuButton
+{
+};
+
+class VCL_DLLPUBLIC CheckButton : virtual public Toggleable
+{
+public:
+ virtual void set_label(const OUString& rText) = 0;
+ virtual OUString get_label() const = 0;
+ virtual void set_label_wrap(bool wrap) = 0;
+};
+
+class VCL_DLLPUBLIC RadioButton : virtual public CheckButton
+{
+};
+
+class VCL_DLLPUBLIC LinkButton : virtual public Widget
+{
+protected:
+ Link<LinkButton&, bool> m_aActivateLinkHdl;
+
+ bool signal_activate_link() { return m_aActivateLinkHdl.Call(*this); }
+
+public:
+ virtual void set_label(const OUString& rText) = 0;
+ virtual OUString get_label() const = 0;
+ virtual void set_uri(const OUString& rUri) = 0;
+ virtual OUString get_uri() const = 0;
+
+ void connect_activate_link(const Link<LinkButton&, bool>& rLink) { m_aActivateLinkHdl = rLink; }
+};
+
+class VCL_DLLPUBLIC Scale : virtual public Widget
+{
+protected:
+ Link<Scale&, void> m_aValueChangedHdl;
+
+ void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
+
+public:
+ virtual void set_value(int value) = 0;
+ virtual int get_value() const = 0;
+ virtual void set_range(int min, int max) = 0;
+
+ virtual void set_increments(int step, int page) = 0;
+ virtual void get_increments(int& step, int& page) const = 0;
+
+ void connect_value_changed(const Link<Scale&, void>& rLink) { m_aValueChangedHdl = rLink; }
+};
+
+class VCL_DLLPUBLIC Spinner : virtual public Widget
+{
+public:
+ virtual void start() = 0;
+ virtual void stop() = 0;
+};
+
+class VCL_DLLPUBLIC ProgressBar : virtual public Widget
+{
+public:
+ //0-100
+ virtual void set_percentage(int value) = 0;
+ virtual OUString get_text() const = 0;
+ virtual void set_text(const OUString& rText) = 0;
+};
+
+class VCL_DLLPUBLIC Entry : virtual public Widget
+{
+private:
+ OUString m_sSavedValue;
+
+protected:
+ Link<Entry&, void> m_aChangeHdl;
+ Link<OUString&, bool> m_aInsertTextHdl;
+ Link<Entry&, void> m_aCursorPositionHdl;
+ Link<Entry&, bool> m_aActivateHdl;
+
+ friend class ::LOKTrigger;
+
+ void signal_changed() { m_aChangeHdl.Call(*this); }
+ void signal_cursor_position() { m_aCursorPositionHdl.Call(*this); }
+
+public:
+ virtual void set_text(const OUString& rText) = 0;
+ virtual OUString get_text() const = 0;
+ virtual void set_width_chars(int nChars) = 0;
+ virtual int get_width_chars() const = 0;
+ // The maximum length of the entry. Use 0 for no maximum
+ virtual void set_max_length(int nChars) = 0;
+ // nEndPos can be -1 in order to select all text
+ virtual void select_region(int nStartPos, int nEndPos) = 0;
+ // returns true if the selection has nonzero length
+ virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0;
+ virtual void replace_selection(const OUString& rText) = 0;
+ // nCursorPos can be -1 to set to the end
+ virtual void set_position(int nCursorPos) = 0;
+ virtual int get_position() const = 0;
+ virtual void set_editable(bool bEditable) = 0;
+ virtual bool get_editable() const = 0;
+ virtual void set_message_type(EntryMessageType eType) = 0;
+ virtual void set_placeholder_text(const OUString& rText) = 0;
+
+ virtual void set_overwrite_mode(bool bOn) = 0;
+ virtual bool get_overwrite_mode() const = 0;
+
+ // font size is in points, not pixels, e.g. see Window::[G]etPointFont
+ virtual void set_font(const vcl::Font& rFont) = 0;
+
+ /*
+ If you want to set a warning or error state, see set_message_type
+ instead where, if the toolkit supports it, a specific warning/error
+ indicator is shown.
+
+ This explicit text color method exists to support rendering the
+ SvNumberformat color feature.
+ */
+ virtual void set_font_color(const Color& rColor) = 0;
+
+ virtual void connect_changed(const Link<Entry&, void>& rLink) { m_aChangeHdl = rLink; }
+ void connect_insert_text(const Link<OUString&, bool>& rLink) { m_aInsertTextHdl = rLink; }
+ // callback returns true to indicated no further processing of activate wanted
+ void connect_activate(const Link<Entry&, bool>& rLink) { m_aActivateHdl = rLink; }
+ virtual void connect_cursor_position(const Link<Entry&, void>& rLink)
+ {
+ m_aCursorPositionHdl = rLink;
+ }
+
+ virtual void cut_clipboard() = 0;
+ virtual void copy_clipboard() = 0;
+ virtual void paste_clipboard() = 0;
+
+ virtual void set_alignment(TxtAlign eXAlign) = 0;
+
+ void save_value() { m_sSavedValue = get_text(); }
+ OUString const& get_saved_value() const { return m_sSavedValue; }
+ bool get_value_changed_from_saved() const { return m_sSavedValue != get_text(); }
+};
+
+class VCL_DLLPUBLIC SpinButton : virtual public Entry
+{
+ friend class ::LOKTrigger;
+
+protected:
+ Link<SpinButton&, void> m_aValueChangedHdl;
+ Link<SpinButton&, void> m_aOutputHdl;
+ Link<int*, bool> m_aInputHdl;
+
+ void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
+
+ bool signal_output()
+ {
+ if (!m_aOutputHdl.IsSet())
+ return false;
+ m_aOutputHdl.Call(*this);
+ return true;
+ }
+
+ TriState signal_input(int* result)
+ {
+ if (!m_aInputHdl.IsSet())
+ return TRISTATE_INDET;
+ return m_aInputHdl.Call(result) ? TRISTATE_TRUE : TRISTATE_FALSE;
+ }
+
+public:
+ virtual void set_value(sal_Int64 value) = 0;
+ virtual sal_Int64 get_value() const = 0;
+ virtual void set_range(sal_Int64 min, sal_Int64 max) = 0;
+ virtual void get_range(sal_Int64& min, sal_Int64& max) const = 0;
+ void set_min(sal_Int64 min)
+ {
+ sal_Int64 dummy, max;
+ get_range(dummy, max);
+ set_range(min, max);
+ }
+ void set_max(sal_Int64 max)
+ {
+ sal_Int64 min, dummy;
+ get_range(min, dummy);
+ set_range(min, max);
+ }
+ sal_Int64 get_min() const
+ {
+ sal_Int64 min, dummy;
+ get_range(min, dummy);
+ return min;
+ }
+ sal_Int64 get_max() const
+ {
+ sal_Int64 dummy, max;
+ get_range(dummy, max);
+ return max;
+ }
+ virtual void set_increments(int step, int page) = 0;
+ virtual void get_increments(int& step, int& page) const = 0;
+ virtual void set_digits(unsigned int digits) = 0;
+ virtual unsigned int get_digits() const = 0;
+
+ void connect_value_changed(const Link<SpinButton&, void>& rLink) { m_aValueChangedHdl = rLink; }
+
+ void connect_output(const Link<SpinButton&, void>& rLink) { m_aOutputHdl = rLink; }
+ void connect_input(const Link<int*, bool>& rLink) { m_aInputHdl = rLink; }
+
+ sal_Int64 normalize(sal_Int64 nValue) const { return (nValue * Power10(get_digits())); }
+
+ sal_Int64 denormalize(sal_Int64 nValue) const;
+
+ static unsigned int Power10(unsigned int n);
+};
+
+class EntryFormatter;
+
+// Similar to a SpinButton, but input and output formatting and range/value
+// are managed by a more complex Formatter which can support doubles.
+class VCL_DLLPUBLIC FormattedSpinButton : virtual public Entry
+{
+protected:
+ Link<FormattedSpinButton&, void> m_aValueChangedHdl;
+
+ void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
+
+public:
+ virtual Formatter& GetFormatter() = 0;
+ // does not take ownership, and so must be deregistered if pFormatter
+ // is destroyed
+ virtual void SetFormatter(weld::EntryFormatter* pFormatter) = 0;
+
+ void connect_value_changed(const Link<FormattedSpinButton&, void>& rLink)
+ {
+ m_aValueChangedHdl = rLink;
+ }
+
+private:
+ friend class EntryFormatter;
+ virtual void sync_range_from_formatter() = 0;
+ virtual void sync_value_from_formatter() = 0;
+ virtual void sync_increments_from_formatter() = 0;
+};
+
+class VCL_DLLPUBLIC Image : virtual public Widget
+{
+public:
+ virtual void set_from_icon_name(const OUString& rIconName) = 0;
+ virtual void set_image(VirtualDevice* pDevice) = 0;
+ virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) = 0;
+};
+
+class VCL_DLLPUBLIC Calendar : virtual public Widget
+{
+protected:
+ Link<Calendar&, void> m_aSelectedHdl;
+ Link<Calendar&, void> m_aActivatedHdl;
+
+ void signal_selected() { m_aSelectedHdl.Call(*this); }
+ void signal_activated() { m_aActivatedHdl.Call(*this); }
+
+public:
+ void connect_selected(const Link<Calendar&, void>& rLink) { m_aSelectedHdl = rLink; }
+ void connect_activated(const Link<Calendar&, void>& rLink) { m_aActivatedHdl = rLink; }
+
+ virtual void set_date(const Date& rDate) = 0;
+ virtual Date get_date() const = 0;
+};
+
+// an entry + treeview pair, where the entry autocompletes from the
+// treeview list, and selecting something in the list sets the
+// entry to that text, i.e. a visually exploded ComboBox
+class VCL_DLLPUBLIC EntryTreeView : virtual public ComboBox
+{
+private:
+ DECL_DLLPRIVATE_LINK(ClickHdl, weld::TreeView&, void);
+ DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
+ void EntryModifyHdl(const weld::Entry& rEntry);
+
+protected:
+ std::unique_ptr<Entry> m_xEntry;
+ std::unique_ptr<TreeView> m_xTreeView;
+
+public:
+ EntryTreeView(std::unique_ptr<Entry> xEntry, std::unique_ptr<TreeView> xTreeView);
+
+ virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems,
+ bool bKeepExisting) override
+ {
+ m_xTreeView->freeze();
+ if (!bKeepExisting)
+ m_xTreeView->clear();
+ for (const auto& rItem : rItems)
+ {
+ m_xTreeView->insert(-1, rItem.sString, rItem.sId.isEmpty() ? nullptr : &rItem.sId,
+ rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr);
+ }
+ m_xTreeView->thaw();
+ }
+
+ virtual void insert(int pos, const OUString& rStr, const OUString* pId,
+ const OUString* pIconName, VirtualDevice* pImageSurface) override
+ {
+ m_xTreeView->insert(pos, rStr, pId, pIconName, pImageSurface);
+ }
+
+ virtual int get_count() const override { return m_xTreeView->n_children(); }
+ virtual void clear() override { m_xTreeView->clear(); }
+
+ //by index
+ virtual int get_active() const override { return m_xTreeView->get_selected_index(); }
+ virtual void set_active(int pos) override
+ {
+ m_xTreeView->set_cursor(pos);
+ m_xTreeView->select(pos);
+ m_xEntry->set_text(m_xTreeView->get_selected_text());
+ }
+ virtual void remove(int pos) override { m_xTreeView->remove(pos); }
+
+ //by text
+ virtual OUString get_active_text() const override { return m_xEntry->get_text(); }
+ virtual OUString get_text(int pos) const override { return m_xTreeView->get_text(pos); }
+ virtual int find_text(const OUString& rStr) const override
+ {
+ return m_xTreeView->find_text(rStr);
+ }
+
+ //by id
+ virtual OUString get_active_id() const override { return m_xTreeView->get_selected_id(); }
+ virtual void set_active_id(const OUString& rStr) override
+ {
+ m_xTreeView->select_id(rStr);
+ m_xEntry->set_text(m_xTreeView->get_selected_text());
+ }
+ virtual OUString get_id(int pos) const override { return m_xTreeView->get_id(pos); }
+ virtual void set_id(int pos, const OUString& rId) override { m_xTreeView->set_id(pos, rId); }
+ virtual int find_id(const OUString& rId) const override { return m_xTreeView->find_id(rId); }
+
+ //entry related
+ virtual bool has_entry() const override { return true; }
+ virtual void set_entry_message_type(EntryMessageType eType) override
+ {
+ m_xEntry->set_message_type(eType);
+ }
+ virtual void set_entry_text(const OUString& rStr) override { m_xEntry->set_text(rStr); }
+ virtual void set_entry_width_chars(int nChars) override { m_xEntry->set_width_chars(nChars); }
+ virtual void set_entry_max_length(int nChars) override { m_xEntry->set_max_length(nChars); }
+ virtual void select_entry_region(int nStartPos, int nEndPos) override
+ {
+ m_xEntry->select_region(nStartPos, nEndPos);
+ }
+ //if no text was selected, both rStartPos and rEndPos will be identical
+ //and false will be returned
+ virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override
+ {
+ return m_xEntry->get_selection_bounds(rStartPos, rEndPos);
+ }
+ void connect_row_activated(const Link<TreeView&, bool>& rLink)
+ {
+ m_xTreeView->connect_row_activated(rLink);
+ }
+
+ virtual bool get_popup_shown() const override { return false; }
+
+ void set_height_request_by_rows(int nRows);
+};
+
+class VCL_DLLPUBLIC MetricSpinButton final
+{
+ FieldUnit m_eSrcUnit;
+ std::unique_ptr<weld::SpinButton> m_xSpinButton;
+ Link<MetricSpinButton&, void> m_aValueChangedHdl;
+
+ DECL_LINK(spin_button_value_changed, weld::SpinButton&, void);
+ DECL_LINK(spin_button_output, weld::SpinButton&, void);
+ DECL_LINK(spin_button_input, int* result, bool);
+
+ void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
+
+ sal_Int64 ConvertValue(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit) const;
+ OUString format_number(sal_Int64 nValue) const;
+ void update_width_chars();
+
+public:
+ MetricSpinButton(std::unique_ptr<SpinButton> pSpinButton, FieldUnit eSrcUnit)
+ : m_eSrcUnit(eSrcUnit)
+ , m_xSpinButton(std::move(pSpinButton))
+ {
+ update_width_chars();
+ m_xSpinButton->connect_output(LINK(this, MetricSpinButton, spin_button_output));
+ m_xSpinButton->connect_input(LINK(this, MetricSpinButton, spin_button_input));
+ m_xSpinButton->connect_value_changed(
+ LINK(this, MetricSpinButton, spin_button_value_changed));
+ spin_button_output(*m_xSpinButton);
+ }
+
+ static OUString MetricToString(FieldUnit rUnit);
+
+ FieldUnit get_unit() const { return m_eSrcUnit; }
+
+ void set_unit(FieldUnit eUnit);
+
+ sal_Int64 convert_value_to(sal_Int64 nValue, FieldUnit eValueUnit) const
+ {
+ return ConvertValue(nValue, m_eSrcUnit, eValueUnit);
+ }
+
+ sal_Int64 convert_value_from(sal_Int64 nValue, FieldUnit eValueUnit) const
+ {
+ return ConvertValue(nValue, eValueUnit, m_eSrcUnit);
+ }
+
+ void set_value(sal_Int64 nValue, FieldUnit eValueUnit)
+ {
+ m_xSpinButton->set_value(convert_value_from(nValue, eValueUnit));
+ }
+
+ sal_Int64 get_value(FieldUnit eDestUnit) const
+ {
+ return convert_value_to(m_xSpinButton->get_value(), eDestUnit);
+ }
+
+ // typically you only need to call this if set_text (e.g. with "") was
+ // previously called to display some arbitrary text instead of the
+ // formatted value and now you want to show it as formatted again
+ void reformat() { spin_button_output(*m_xSpinButton); }
+
+ void set_range(sal_Int64 min, sal_Int64 max, FieldUnit eValueUnit)
+ {
+ min = convert_value_from(min, eValueUnit);
+ max = convert_value_from(max, eValueUnit);
+ m_xSpinButton->set_range(min, max);
+ update_width_chars();
+ }
+
+ void get_range(sal_Int64& min, sal_Int64& max, FieldUnit eDestUnit) const
+ {
+ m_xSpinButton->get_range(min, max);
+ min = convert_value_to(min, eDestUnit);
+ max = convert_value_to(max, eDestUnit);
+ }
+
+ void set_min(sal_Int64 min, FieldUnit eValueUnit)
+ {
+ sal_Int64 dummy, max;
+ get_range(dummy, max, eValueUnit);
+ set_range(min, max, eValueUnit);
+ }
+
+ void set_max(sal_Int64 max, FieldUnit eValueUnit)
+ {
+ sal_Int64 min, dummy;
+ get_range(min, dummy, eValueUnit);
+ set_range(min, max, eValueUnit);
+ }
+
+ sal_Int64 get_min(FieldUnit eValueUnit) const
+ {
+ sal_Int64 min, dummy;
+ get_range(min, dummy, eValueUnit);
+ return min;
+ }
+
+ sal_Int64 get_max(FieldUnit eValueUnit) const
+ {
+ sal_Int64 dummy, max;
+ get_range(dummy, max, eValueUnit);
+ return max;
+ }
+
+ void set_increments(int step, int page, FieldUnit eValueUnit)
+ {
+ step = convert_value_from(step, eValueUnit);
+ page = convert_value_from(page, eValueUnit);
+ m_xSpinButton->set_increments(step, page);
+ }
+
+ void get_increments(int& step, int& page, FieldUnit eDestUnit) const
+ {
+ m_xSpinButton->get_increments(step, page);
+ step = convert_value_to(step, eDestUnit);
+ page = convert_value_to(page, eDestUnit);
+ }
+
+ void connect_value_changed(const Link<MetricSpinButton&, void>& rLink)
+ {
+ m_aValueChangedHdl = rLink;
+ }
+
+ sal_Int64 normalize(sal_Int64 nValue) const { return m_xSpinButton->normalize(nValue); }
+ sal_Int64 denormalize(sal_Int64 nValue) const { return m_xSpinButton->denormalize(nValue); }
+ void set_sensitive(bool sensitive) { m_xSpinButton->set_sensitive(sensitive); }
+ bool get_sensitive() const { return m_xSpinButton->get_sensitive(); }
+ bool get_visible() const { return m_xSpinButton->get_visible(); }
+ void grab_focus() { m_xSpinButton->grab_focus(); }
+ bool has_focus() const { return m_xSpinButton->has_focus(); }
+ void show() { m_xSpinButton->show(); }
+ void set_visible(bool bShow) { m_xSpinButton->set_visible(bShow); }
+ void hide() { m_xSpinButton->hide(); }
+ void set_digits(unsigned int digits);
+ void set_accessible_name(const OUString& rName) { m_xSpinButton->set_accessible_name(rName); }
+ unsigned int get_digits() const { return m_xSpinButton->get_digits(); }
+ void save_value() { m_xSpinButton->save_value(); }
+ bool get_value_changed_from_saved() const
+ {
+ return m_xSpinButton->get_value_changed_from_saved();
+ }
+ void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
+ OUString get_text() const { return m_xSpinButton->get_text(); }
+ void set_size_request(int nWidth, int nHeight)
+ {
+ m_xSpinButton->set_size_request(nWidth, nHeight);
+ }
+ Size get_size_request() const { return m_xSpinButton->get_size_request(); }
+ Size get_preferred_size() const { return m_xSpinButton->get_preferred_size(); }
+ void connect_focus_in(const Link<Widget&, void>& rLink)
+ {
+ m_xSpinButton->connect_focus_in(rLink);
+ }
+ void connect_focus_out(const Link<Widget&, void>& rLink)
+ {
+ m_xSpinButton->connect_focus_out(rLink);
+ }
+ OString get_buildable_name() const { return m_xSpinButton->get_buildable_name(); }
+ void set_help_id(const OString& rName) { m_xSpinButton->set_help_id(rName); }
+ void set_position(int nCursorPos) { m_xSpinButton->set_position(nCursorPos); }
+ // set the width of the underlying widget in characters, this setting is
+ // invalidated when changing the units, range or digits, so to have effect
+ // must come after changing those values
+ void set_width_chars(int nChars) { m_xSpinButton->set_width_chars(nChars); }
+ int get_width_chars() const { return m_xSpinButton->get_width_chars(); }
+ weld::SpinButton& get_widget() { return *m_xSpinButton; }
+};
+
+enum class LabelType
+{
+ Normal,
+ Warning,
+ Error,
+ Title, // this is intended to be used against the background set by set_title_background
+};
+
+class VCL_DLLPUBLIC Label : virtual public Widget
+{
+public:
+ virtual void set_label(const OUString& rText) = 0;
+ virtual OUString get_label() const = 0;
+ virtual void set_mnemonic_widget(Widget* pTarget) = 0;
+ // font size is in points, not pixels, e.g. see Window::[G]etPointFont
+ virtual void set_font(const vcl::Font& rFont) = 0;
+ virtual void set_label_type(LabelType eType) = 0;
+ /*
+ If you want to set a warning or error state, see set_label_type
+ instead.
+ */
+ virtual void set_font_color(const Color& rColor) = 0;
+};
+
+class VCL_DLLPUBLIC TextView : virtual public Widget
+{
+ friend class ::LOKTrigger;
+
+private:
+ OUString m_sSavedValue;
+
+protected:
+ Link<TextView&, void> m_aChangeHdl;
+ Link<TextView&, void> m_aVChangeHdl;
+ Link<TextView&, void> m_aCursorPositionHdl;
+
+ void signal_changed() { m_aChangeHdl.Call(*this); }
+ void signal_cursor_position() { m_aCursorPositionHdl.Call(*this); }
+ void signal_vadjustment_changed() { m_aVChangeHdl.Call(*this); }
+
+public:
+ virtual void set_text(const OUString& rText) = 0;
+ virtual OUString get_text() const = 0;
+ // if nStartPos or nEndPos is -1 the max available text pos will be used
+ virtual void select_region(int nStartPos, int nEndPos) = 0;
+ // returns true if the selection has nonzero length
+ virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0;
+ virtual void replace_selection(const OUString& rText) = 0;
+ virtual void set_editable(bool bEditable) = 0;
+ virtual bool get_editable() const = 0;
+ virtual void set_monospace(bool bMonospace) = 0;
+ // The maximum length of the entry. Use 0 for no maximum
+ virtual void set_max_length(int nChars) = 0;
+ int get_height_rows(int nRows) const
+ {
+ //can improve this if needed
+ return get_text_height() * nRows;
+ }
+
+ // font size is in points, not pixels, e.g. see Window::[G]etPointFont
+ virtual void set_font(const vcl::Font& rFont) = 0;
+
+ /*
+ Typically you want to avoid the temptation of customizing
+ font colors
+ */
+ virtual void set_font_color(const Color& rColor) = 0;
+
+ void save_value() { m_sSavedValue = get_text(); }
+ bool get_value_changed_from_saved() const { return m_sSavedValue != get_text(); }
+
+ void connect_changed(const Link<TextView&, void>& rLink) { m_aChangeHdl = rLink; }
+ virtual void connect_cursor_position(const Link<TextView&, void>& rLink)
+ {
+ m_aCursorPositionHdl = rLink;
+ }
+
+ // returns true if pressing up would move the cursor
+ // doesn't matter if that move is to a previous line or to the start of the
+ // current line just so long as the cursor would move
+ virtual bool can_move_cursor_with_up() const = 0;
+
+ // returns true if pressing down would move the cursor
+ // doesn't matter if that move is to a next line or to the end of the
+ // current line just so long as the cursor would move
+ virtual bool can_move_cursor_with_down() const = 0;
+
+ virtual void cut_clipboard() = 0;
+ virtual void copy_clipboard() = 0;
+ virtual void paste_clipboard() = 0;
+
+ virtual void set_alignment(TxtAlign eXAlign) = 0;
+
+ virtual int vadjustment_get_value() const = 0;
+ virtual int vadjustment_get_upper() const = 0;
+ virtual int vadjustment_get_lower() const = 0;
+ virtual int vadjustment_get_page_size() const = 0;
+ virtual void vadjustment_set_value(int value) = 0;
+ void connect_vadjustment_changed(const Link<TextView&, void>& rLink) { m_aVChangeHdl = rLink; }
+};
+
+class VCL_DLLPUBLIC Expander : virtual public Widget
+{
+protected:
+ Link<Expander&, void> m_aExpandedHdl;
+
+ void signal_expanded() { m_aExpandedHdl.Call(*this); }
+
+public:
+ virtual void set_label(const OUString& rText) = 0;
+ virtual OUString get_label() const = 0;
+ virtual bool get_expanded() const = 0;
+ virtual void set_expanded(bool bExpand) = 0;
+
+ void connect_expanded(const Link<Expander&, void>& rLink) { m_aExpandedHdl = rLink; }
+};
+
+class VCL_DLLPUBLIC DrawingArea : virtual public Widget
+{
+public:
+ typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> draw_args;
+
+protected:
+ Link<draw_args, void> m_aDrawHdl;
+ Link<Widget&, void> m_aStyleUpdatedHdl;
+ Link<const CommandEvent&, bool> m_aCommandHdl;
+ Link<Widget&, tools::Rectangle> m_aGetFocusRectHdl;
+ Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl;
+ // if handler returns true, drag is disallowed
+ Link<DrawingArea&, bool> m_aDragBeginHdl;
+ // return position of cursor, fill OUString& with surrounding text
+ Link<OUString&, int> m_aGetSurroundingHdl;
+ // attempt to delete the range, return true if successful
+ Link<const Selection&, bool> m_aDeleteSurroundingHdl;
+
+ OUString signal_query_tooltip(tools::Rectangle& rHelpArea)
+ {
+ return m_aQueryTooltipHdl.Call(rHelpArea);
+ }
+
+ int signal_im_context_get_surrounding(OUString& rSurroundingText)
+ {
+ if (!m_aGetSurroundingHdl.IsSet())
+ return -1;
+ return m_aGetSurroundingHdl.Call(rSurroundingText);
+ }
+
+ bool signal_im_context_delete_surrounding(const Selection& rRange)
+ {
+ return m_aDeleteSurroundingHdl.Call(rRange);
+ }
+
+public:
+ void connect_draw(const Link<draw_args, void>& rLink) { m_aDrawHdl = rLink; }
+ void connect_style_updated(const Link<Widget&, void>& rLink) { m_aStyleUpdatedHdl = rLink; }
+ void connect_command(const Link<const CommandEvent&, bool>& rLink) { m_aCommandHdl = rLink; }
+ void connect_focus_rect(const Link<Widget&, tools::Rectangle>& rLink)
+ {
+ m_aGetFocusRectHdl = rLink;
+ }
+ void connect_query_tooltip(const Link<tools::Rectangle&, OUString>& rLink)
+ {
+ m_aQueryTooltipHdl = rLink;
+ }
+ void connect_drag_begin(const Link<DrawingArea&, bool>& rLink) { m_aDragBeginHdl = rLink; }
+ void connect_im_context_get_surrounding(const Link<OUString&, int>& rLink)
+ {
+ m_aGetSurroundingHdl = rLink;
+ }
+ void connect_im_context_delete_surrounding(const Link<const Selection&, bool>& rLink)
+ {
+ m_aDeleteSurroundingHdl = rLink;
+ }
+ virtual void queue_draw() = 0;
+ virtual void queue_draw_area(int x, int y, int width, int height) = 0;
+
+ virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rTransferrable,
+ sal_uInt8 eDNDConstants)
+ = 0;
+
+ virtual void set_cursor(PointerStyle ePointerStyle) = 0;
+
+ virtual Point get_pointer_position() const = 0;
+
+ virtual void set_input_context(const InputContext& rInputContext) = 0;
+ virtual void im_context_set_cursor_location(const tools::Rectangle& rCursorRect,
+ int nExtTextInputWidth)
+ = 0;
+
+ // use return here just to generate matching VirtualDevices
+ virtual OutputDevice& get_ref_device() = 0;
+
+ virtual a11yref get_accessible_parent() = 0;
+ virtual a11yrelationset get_accessible_relation_set() = 0;
+ virtual Point get_accessible_location_on_screen() = 0;
+
+private:
+ friend class ::LOKTrigger;
+
+ virtual void click(const Point& rPos) = 0;
+};
+
+enum class Placement
+{
+ Under,
+ End
+};
+
+class VCL_DLLPUBLIC Menu
+{
+protected:
+ Link<const OString&, void> m_aActivateHdl;
+
+ void signal_activate(const OString& rIdent) { m_aActivateHdl.Call(rIdent); }
+
+public:
+ virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect,
+ Placement ePlace = Placement::Under)
+ = 0;
+
+ void connect_activate(const Link<const OString&, void>& rLink) { m_aActivateHdl = rLink; }
+
+ virtual void set_sensitive(const OString& rIdent, bool bSensitive) = 0;
+ virtual bool get_sensitive(const OString& rIdent) const = 0;
+ virtual void set_label(const OString& rIdent, const OUString& rLabel) = 0;
+ virtual OUString get_label(const OString& rIdent) const = 0;
+ virtual void set_active(const OString& rIdent, bool bActive) = 0;
+ virtual bool get_active(const OString& rIdent) const = 0;
+ virtual void set_visible(const OString& rIdent, bool bVisible) = 0;
+
+ virtual void insert(int pos, const OUString& rId, const OUString& rStr,
+ const OUString* pIconName, VirtualDevice* pImageSurface,
+ const css::uno::Reference<css::graphic::XGraphic>& rImage,
+ TriState eCheckRadioFalse)
+ = 0;
+
+ virtual void remove(const OString& rId) = 0;
+
+ virtual void clear() = 0;
+
+ virtual void insert_separator(int pos, const OUString& rId) = 0;
+ void append_separator(const OUString& rId) { insert_separator(-1, rId); }
+
+ void append(const OUString& rId, const OUString& rStr)
+ {
+ insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_INDET);
+ }
+ void append_check(const OUString& rId, const OUString& rStr)
+ {
+ insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_TRUE);
+ }
+ void append_radio(const OUString& rId, const OUString& rStr)
+ {
+ insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_FALSE);
+ }
+ void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
+ {
+ insert(-1, rId, rStr, &rImage, nullptr, nullptr, TRISTATE_INDET);
+ }
+ void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage)
+ {
+ insert(-1, rId, rStr, nullptr, &rImage, nullptr, TRISTATE_INDET);
+ }
+
+ // return the number of toplevel nodes
+ virtual int n_children() const = 0;
+
+ virtual OString get_id(int pos) const = 0;
+
+ virtual ~Menu() {}
+};
+
+class VCL_DLLPUBLIC Popover : virtual public Container
+{
+ friend class ::LOKTrigger;
+
+private:
+ Link<weld::Popover&, void> m_aCloseHdl;
+
+protected:
+ void signal_closed() { m_aCloseHdl.Call(*this); }
+
+public:
+ virtual void popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect,
+ Placement ePlace = Placement::Under)
+ = 0;
+ virtual void popdown() = 0;
+
+ virtual void resize_to_request() = 0;
+
+ void connect_closed(const Link<weld::Popover&, void>& rLink) { m_aCloseHdl = rLink; }
+};
+
+class VCL_DLLPUBLIC Toolbar : virtual public Widget
+{
+protected:
+ Link<const OString&, void> m_aClickHdl;
+ Link<const OString&, void> m_aToggleMenuHdl;
+
+ friend class ::LOKTrigger;
+
+ void signal_clicked(const OString& rIdent) { m_aClickHdl.Call(rIdent); }
+ void signal_toggle_menu(const OString& rIdent) { m_aToggleMenuHdl.Call(rIdent); }
+
+public:
+ virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) = 0;
+ virtual bool get_item_sensitive(const OString& rIdent) const = 0;
+ virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
+ virtual bool get_item_active(const OString& rIdent) const = 0;
+ virtual void set_menu_item_active(const OString& rIdent, bool bActive) = 0;
+ virtual bool get_menu_item_active(const OString& rIdent) const = 0;
+ virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) = 0;
+ virtual void set_item_popover(const OString& rIdent, weld::Widget* pPopover) = 0;
+ virtual void set_item_visible(const OString& rIdent, bool bVisible) = 0;
+ virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) = 0;
+ virtual bool get_item_visible(const OString& rIdent) const = 0;
+ virtual void set_item_label(const OString& rIdent, const OUString& rLabel) = 0;
+ virtual OUString get_item_label(const OString& rIdent) const = 0;
+ virtual void set_item_tooltip_text(const OString& rIdent, const OUString& rTip) = 0;
+ virtual OUString get_item_tooltip_text(const OString& rIdent) const = 0;
+ virtual void set_item_icon_name(const OString& rIdent, const OUString& rIconName) = 0;
+ virtual void set_item_image(const OString& rIdent,
+ const css::uno::Reference<css::graphic::XGraphic>& rIcon)
+ = 0;
+ virtual void set_item_image(const OString& rIdent, VirtualDevice* pDevice) = 0;
+
+ virtual void insert_item(int pos, const OUString& rId) = 0;
+ virtual void insert_separator(int pos, const OUString& rId) = 0;
+ void append_separator(const OUString& rId) { insert_separator(-1, rId); }
+
+ virtual int get_n_items() const = 0;
+ virtual OString get_item_ident(int nIndex) const = 0;
+ virtual void set_item_ident(int nIndex, const OString& rIdent) = 0;
+ virtual void set_item_label(int nIndex, const OUString& rLabel) = 0;
+ virtual void set_item_image(int nIndex,
+ const css::uno::Reference<css::graphic::XGraphic>& rIcon)
+ = 0;
+ virtual void set_item_tooltip_text(int nIndex, const OUString& rTip) = 0;
+
+ virtual vcl::ImageType get_icon_size() const = 0;
+ virtual void set_icon_size(vcl::ImageType eType) = 0;
+
+ // return what modifiers are held
+ virtual sal_uInt16 get_modifier_state() const = 0;
+
+ // This function returns the position a new item should be inserted if dnd
+ // is dropped at rPoint
+ virtual int get_drop_index(const Point& rPoint) const = 0;
+
+ void connect_clicked(const Link<const OString&, void>& rLink) { m_aClickHdl = rLink; }
+ void connect_menu_toggled(const Link<const OString&, void>& rLink) { m_aToggleMenuHdl = rLink; }
+};
+
+class VCL_DLLPUBLIC SizeGroup
+{
+public:
+ virtual void add_widget(weld::Widget* pWidget) = 0;
+ // the default mode is VclSizeGroupMode::Horizontal
+ virtual void set_mode(VclSizeGroupMode eMode) = 0;
+ virtual ~SizeGroup() {}
+};
+
+class VCL_DLLPUBLIC Builder
+{
+public:
+ virtual std::unique_ptr<MessageDialog> weld_message_dialog(const OString& id) = 0;
+ virtual std::unique_ptr<Dialog> weld_dialog(const OString& id) = 0;
+ virtual std::unique_ptr<Assistant> weld_assistant(const OString& id) = 0;
+ virtual std::unique_ptr<Widget> weld_widget(const OString& id) = 0;
+ virtual std::unique_ptr<Container> weld_container(const OString& id) = 0;
+ virtual std::unique_ptr<Box> weld_box(const OString& id) = 0;
+ virtual std::unique_ptr<Paned> weld_paned(const OString& id) = 0;
+ virtual std::unique_ptr<Button> weld_button(const OString& id) = 0;
+ virtual std::unique_ptr<MenuButton> weld_menu_button(const OString& id) = 0;
+ virtual std::unique_ptr<MenuToggleButton> weld_menu_toggle_button(const OString& id) = 0;
+ virtual std::unique_ptr<Frame> weld_frame(const OString& id) = 0;
+ /* bUserManagedScrolling of true means that the automatic scrolling of the window is disabled
+ and the owner must specifically listen to adjustment changes and react appropriately to them.
+ */
+ virtual std::unique_ptr<ScrolledWindow> weld_scrolled_window(const OString& id,
+ bool bUserManagedScrolling = false)
+ = 0;
+ virtual std::unique_ptr<Notebook> weld_notebook(const OString& id) = 0;
+ virtual std::unique_ptr<ToggleButton> weld_toggle_button(const OString& id) = 0;
+ virtual std::unique_ptr<RadioButton> weld_radio_button(const OString& id) = 0;
+ virtual std::unique_ptr<CheckButton> weld_check_button(const OString& id) = 0;
+ virtual std::unique_ptr<LinkButton> weld_link_button(const OString& id) = 0;
+ virtual std::unique_ptr<SpinButton> weld_spin_button(const OString& id) = 0;
+ virtual std::unique_ptr<MetricSpinButton> weld_metric_spin_button(const OString& id,
+ FieldUnit eUnit)
+ = 0;
+ virtual std::unique_ptr<FormattedSpinButton> weld_formatted_spin_button(const OString& id) = 0;
+ virtual std::unique_ptr<ComboBox> weld_combo_box(const OString& id) = 0;
+ virtual std::unique_ptr<TreeView> weld_tree_view(const OString& id) = 0;
+ virtual std::unique_ptr<IconView> weld_icon_view(const OString& id) = 0;
+ virtual std::unique_ptr<Label> weld_label(const OString& id) = 0;
+ virtual std::unique_ptr<TextView> weld_text_view(const OString& id) = 0;
+ virtual std::unique_ptr<Expander> weld_expander(const OString& id) = 0;
+ virtual std::unique_ptr<Entry> weld_entry(const OString& id) = 0;
+ virtual std::unique_ptr<Scale> weld_scale(const OString& id) = 0;
+ virtual std::unique_ptr<ProgressBar> weld_progress_bar(const OString& id) = 0;
+ virtual std::unique_ptr<Spinner> weld_spinner(const OString& id) = 0;
+ virtual std::unique_ptr<Image> weld_image(const OString& id) = 0;
+ virtual std::unique_ptr<Calendar> weld_calendar(const OString& id) = 0;
+ virtual std::unique_ptr<DrawingArea>
+ weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
+ FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = nullptr)
+ = 0;
+ virtual std::unique_ptr<EntryTreeView> weld_entry_tree_view(const OString& containerid,
+ const OString& entryid,
+ const OString& treeviewid)
+ = 0;
+ virtual std::unique_ptr<Menu> weld_menu(const OString& id) = 0;
+ virtual std::unique_ptr<Popover> weld_popover(const OString& id) = 0;
+ virtual std::unique_ptr<Toolbar> weld_toolbar(const OString& id) = 0;
+ virtual std::unique_ptr<SizeGroup> create_size_group() = 0;
+ /* return a Dialog suitable to take a screenshot of containing the contents of the .ui file.
+
+ If the toplevel element is a dialog, that will be returned
+ If the toplevel is not a dialog, a dialog will be created and the contents of the .ui
+ inserted into it
+ */
+ virtual std::unique_ptr<Window> create_screenshot_window() = 0;
+ virtual ~Builder() {}
+};
+
+class VCL_DLLPUBLIC DialogController : public std::enable_shared_from_this<DialogController>
+{
+public:
+ virtual Dialog* getDialog() = 0;
+ const Dialog* getConstDialog() const
+ {
+ return const_cast<DialogController*>(this)->getDialog();
+ }
+ virtual short run() { return getDialog()->run(); }
+ static bool runAsync(const std::shared_ptr<DialogController>& rController,
+ const std::function<void(sal_Int32)>&);
+ void set_title(const OUString& rTitle) { getDialog()->set_title(rTitle); }
+ OUString get_title() const { return getConstDialog()->get_title(); }
+ void set_help_id(const OString& rHelpId) { getDialog()->set_help_id(rHelpId); }
+ OString get_help_id() const { return getConstDialog()->get_help_id(); }
+ void response(int nResponse) { getDialog()->response(nResponse); }
+ virtual ~DialogController() COVERITY_NOEXCEPT_FALSE;
+};
+
+class VCL_DLLPUBLIC GenericDialogController : public DialogController
+{
+protected:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::shared_ptr<weld::Dialog> m_xDialog;
+
+public:
+ GenericDialogController(weld::Widget* pParent, const OUString& rUIFile,
+ const OString& rDialogId, bool bMobile = false);
+ virtual Dialog* getDialog() override;
+ virtual ~GenericDialogController() COVERITY_NOEXCEPT_FALSE override;
+};
+
+class VCL_DLLPUBLIC MessageDialogController : public DialogController
+{
+protected:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::MessageDialog> m_xDialog;
+ std::unique_ptr<weld::Container> m_xContentArea;
+ std::unique_ptr<weld::Widget> m_xRelocate;
+ std::unique_ptr<weld::Container> m_xOrigParent;
+
+public:
+ /* @param rRelocateId - optional argument of the name of a widget in the .ui file
+ which should be relocated into the content area of the dialog.
+
+ e.g. a checkbox for a "Never show this again" option.
+
+ This results in the named widget relocating to the same container
+ as the messages. This enables aligning the extra widget with the
+ message labels in the content area container which doesn't
+ explicitly exist in the ui description, but is only implied.
+ */
+ MessageDialogController(weld::Widget* pParent, const OUString& rUIFile,
+ const OString& rDialogId, const OString& rRelocateId = OString());
+ virtual Dialog* getDialog() override;
+ virtual ~MessageDialogController() override;
+ void set_primary_text(const OUString& rText) { m_xDialog->set_primary_text(rText); }
+ OUString get_primary_text() const { return m_xDialog->get_primary_text(); }
+ void set_default_response(int nResponse) { m_xDialog->set_default_response(nResponse); }
+};
+
+class VCL_DLLPUBLIC AssistantController : public DialogController
+{
+protected:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Assistant> m_xAssistant;
+
+public:
+ AssistantController(weld::Widget* pParent, const OUString& rUIFile, const OString& rDialogId);
+ virtual Dialog* getDialog() override;
+ virtual ~AssistantController() override;
+};
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/weldutils.hxx b/include/vcl/weldutils.hxx
new file mode 100644
index 000000000..07fc5eb2d
--- /dev/null
+++ b/include/vcl/weldutils.hxx
@@ -0,0 +1,471 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_WELDUTILS_HXX
+#define INCLUDED_VCL_WELDUTILS_HXX
+
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/interfacecontainer4.hxx>
+#include <comphelper/compbase.hxx>
+#include <tools/time.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/formatter.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/transfer.hxx>
+#include <vcl/weld.hxx>
+
+class CalendarWrapper;
+
+namespace vcl
+{
+class Window;
+}
+
+namespace weld
+{
+typedef comphelper::WeakComponentImplHelper<css::awt::XWindow> TransportAsXWindow_Base;
+
+class VCL_DLLPUBLIC TransportAsXWindow : public TransportAsXWindow_Base
+{
+private:
+ weld::Widget* m_pWeldWidget;
+ weld::Builder* m_pWeldWidgetBuilder;
+
+ comphelper::OInterfaceContainerHelper4<css::awt::XWindowListener> m_aWindowListeners;
+ comphelper::OInterfaceContainerHelper4<css::awt::XKeyListener> m_aKeyListeners;
+ comphelper::OInterfaceContainerHelper4<css::awt::XFocusListener> m_aFocusListeners;
+ comphelper::OInterfaceContainerHelper4<css::awt::XMouseListener> m_aMouseListeners;
+ comphelper::OInterfaceContainerHelper4<css::awt::XMouseMotionListener> m_aMotionListeners;
+ comphelper::OInterfaceContainerHelper4<css::awt::XPaintListener> m_aPaintListeners;
+
+public:
+ TransportAsXWindow(weld::Widget* pWeldWidget, weld::Builder* pWeldWidgetBuilder = nullptr)
+ : m_pWeldWidget(pWeldWidget)
+ , m_pWeldWidgetBuilder(pWeldWidgetBuilder)
+ {
+ }
+
+ weld::Widget* getWidget() const { return m_pWeldWidget; }
+
+ weld::Builder* getBuilder() const { return m_pWeldWidgetBuilder; }
+
+ virtual void clear()
+ {
+ m_pWeldWidget = nullptr;
+ m_pWeldWidgetBuilder = nullptr;
+ }
+
+ // css::awt::XWindow
+ void SAL_CALL setPosSize(sal_Int32, sal_Int32, sal_Int32, sal_Int32, sal_Int16) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ css::awt::Rectangle SAL_CALL getPosSize() override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL setVisible(sal_Bool bVisible) override { m_pWeldWidget->set_visible(bVisible); }
+
+ void SAL_CALL setEnable(sal_Bool bSensitive) override
+ {
+ m_pWeldWidget->set_sensitive(bSensitive);
+ }
+
+ void SAL_CALL setFocus() override { m_pWeldWidget->grab_focus(); }
+
+ void SAL_CALL
+ addWindowListener(const css::uno::Reference<css::awt::XWindowListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aWindowListeners.addInterface(g, rListener);
+ }
+
+ void SAL_CALL
+ removeWindowListener(const css::uno::Reference<css::awt::XWindowListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aWindowListeners.removeInterface(g, rListener);
+ }
+
+ void SAL_CALL
+ addFocusListener(const css::uno::Reference<css::awt::XFocusListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aFocusListeners.addInterface(g, rListener);
+ }
+
+ void SAL_CALL
+ removeFocusListener(const css::uno::Reference<css::awt::XFocusListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aFocusListeners.removeInterface(g, rListener);
+ }
+
+ void SAL_CALL
+ addKeyListener(const css::uno::Reference<css::awt::XKeyListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aKeyListeners.addInterface(g, rListener);
+ }
+
+ void SAL_CALL
+ removeKeyListener(const css::uno::Reference<css::awt::XKeyListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aKeyListeners.removeInterface(g, rListener);
+ }
+
+ void SAL_CALL
+ addMouseListener(const css::uno::Reference<css::awt::XMouseListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aMouseListeners.addInterface(g, rListener);
+ }
+
+ void SAL_CALL
+ removeMouseListener(const css::uno::Reference<css::awt::XMouseListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aMouseListeners.removeInterface(g, rListener);
+ }
+
+ void SAL_CALL addMouseMotionListener(
+ const css::uno::Reference<css::awt::XMouseMotionListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aMotionListeners.addInterface(g, rListener);
+ }
+
+ void SAL_CALL removeMouseMotionListener(
+ const css::uno::Reference<css::awt::XMouseMotionListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aMotionListeners.removeInterface(g, rListener);
+ }
+
+ void SAL_CALL
+ addPaintListener(const css::uno::Reference<css::awt::XPaintListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aPaintListeners.addInterface(g, rListener);
+ }
+
+ void SAL_CALL
+ removePaintListener(const css::uno::Reference<css::awt::XPaintListener>& rListener) override
+ {
+ std::unique_lock g(m_aMutex);
+ m_aPaintListeners.removeInterface(g, rListener);
+ }
+};
+
+// don't export to avoid duplicate WeakImplHelper definitions with MSVC
+class SAL_DLLPUBLIC_TEMPLATE WidgetStatusListener_Base
+ : public cppu::WeakImplHelper<css::frame::XStatusListener>
+{
+};
+
+class VCL_DLLPUBLIC WidgetStatusListener final : public WidgetStatusListener_Base
+{
+public:
+ WidgetStatusListener(weld::Widget* widget, const OUString& rCommand);
+
+private:
+ weld::Widget* mWidget; /** The widget on which actions are performed */
+
+ /** Dispatcher. Need to keep a reference to it as long as this StatusListener exists. */
+ css::uno::Reference<css::frame::XDispatch> mxDispatch;
+ css::util::URL maCommandURL;
+ css::uno::Reference<css::frame::XFrame> mxFrame;
+
+public:
+ SAL_DLLPRIVATE void SAL_CALL
+ statusChanged(const css::frame::FeatureStateEvent& rEvent) override;
+
+ SAL_DLLPRIVATE void SAL_CALL disposing(const css::lang::EventObject& /*Source*/) override;
+
+ const css::uno::Reference<css::frame::XFrame>& getFrame() const { return mxFrame; }
+
+ void startListening();
+
+ void dispose();
+};
+
+class VCL_DLLPUBLIC EntryFormatter : public Formatter
+{
+public:
+ EntryFormatter(weld::Entry& rEntry);
+ EntryFormatter(weld::FormattedSpinButton& rSpinButton);
+
+ weld::Entry& get_widget() { return m_rEntry; }
+
+ // public Formatter overrides, drives interactions with the Entry
+ SAL_DLLPRIVATE virtual Selection GetEntrySelection() const override;
+ SAL_DLLPRIVATE virtual OUString GetEntryText() const override;
+ SAL_DLLPRIVATE virtual void SetEntryText(const OUString& rText, const Selection& rSel) override;
+ SAL_DLLPRIVATE virtual void SetEntryTextColor(const Color* pColor) override;
+ SAL_DLLPRIVATE virtual SelectionOptions GetEntrySelectionOptions() const override;
+ SAL_DLLPRIVATE virtual void FieldModified() override;
+
+ // public Formatter overrides, drives optional SpinButton settings
+ SAL_DLLPRIVATE virtual void ClearMinValue() override;
+ SAL_DLLPRIVATE virtual void SetMinValue(double dMin) override;
+ SAL_DLLPRIVATE virtual void ClearMaxValue() override;
+ SAL_DLLPRIVATE virtual void SetMaxValue(double dMin) override;
+
+ SAL_DLLPRIVATE virtual void SetSpinSize(double dStep) override;
+
+ void SetEntrySelectionOptions(SelectionOptions eOptions) { m_eOptions = eOptions; }
+
+ /* EntryFormatter will set listeners to "changed" and "focus-out" of the
+ Entry so users that want to add their own listeners to those must set
+ them through this formatter and not directly on that entry.
+
+ If EntryFormatter is used with a weld::FormattedSpinButton this is
+ handled transparently by the FormattedSpinButton for the user and the
+ handlers can be set on the FormattedSpinButton
+ */
+ void connect_changed(const Link<weld::Entry&, void>& rLink) { m_aModifyHdl = rLink; }
+ void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_aFocusOutHdl = rLink; }
+
+ SAL_DLLPRIVATE virtual ~EntryFormatter() override;
+
+private:
+ weld::Entry& m_rEntry;
+ weld::FormattedSpinButton* m_pSpinButton;
+ Link<weld::Entry&, void> m_aModifyHdl;
+ Link<weld::Widget&, void> m_aFocusOutHdl;
+ SelectionOptions m_eOptions;
+ DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
+ DECL_DLLPRIVATE_LINK(FocusOutHdl, weld::Widget&, void);
+ SAL_DLLPRIVATE void Init();
+
+ // private Formatter overrides
+ SAL_DLLPRIVATE virtual void UpdateCurrentValue(double dCurrentValue) override;
+};
+
+class VCL_DLLPUBLIC DoubleNumericFormatter final : public EntryFormatter
+{
+public:
+ DoubleNumericFormatter(weld::Entry& rEntry);
+ DoubleNumericFormatter(weld::FormattedSpinButton& rSpinButton);
+
+ SAL_DLLPRIVATE virtual ~DoubleNumericFormatter() override;
+
+private:
+ SAL_DLLPRIVATE virtual bool CheckText(const OUString& sText) const override;
+
+ SAL_DLLPRIVATE virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat) override;
+ SAL_DLLPRIVATE void ResetConformanceTester();
+
+ std::unique_ptr<validation::NumberValidator> m_pNumberValidator;
+};
+
+class VCL_DLLPUBLIC LongCurrencyFormatter final : public EntryFormatter
+{
+public:
+ LongCurrencyFormatter(weld::Entry& rEntry);
+ LongCurrencyFormatter(weld::FormattedSpinButton& rSpinButton);
+
+ void SetUseThousandSep(bool b);
+ void SetCurrencySymbol(const OUString& rStr);
+
+ SAL_DLLPRIVATE virtual ~LongCurrencyFormatter() override;
+
+private:
+ DECL_DLLPRIVATE_LINK(FormatOutputHdl, LinkParamNone*, bool);
+ DECL_DLLPRIVATE_LINK(ParseInputHdl, sal_Int64*, TriState);
+
+ SAL_DLLPRIVATE void Init();
+
+ OUString m_aCurrencySymbol;
+ bool m_bThousandSep;
+};
+
+class VCL_DLLPUBLIC TimeFormatter final : public EntryFormatter
+{
+public:
+ TimeFormatter(weld::Entry& rEntry);
+ TimeFormatter(weld::FormattedSpinButton& rSpinButton);
+
+ void SetExtFormat(ExtTimeFieldFormat eFormat);
+ void SetDuration(bool bDuration);
+ void SetTimeFormat(TimeFieldFormat eTimeFormat);
+
+ void SetMin(const tools::Time& rNewMin);
+ void SetMax(const tools::Time& rNewMax);
+
+ void SetTime(const tools::Time& rNewTime);
+ tools::Time GetTime();
+
+ virtual ~TimeFormatter() override;
+
+private:
+ DECL_DLLPRIVATE_LINK(FormatOutputHdl, LinkParamNone*, bool);
+ DECL_DLLPRIVATE_LINK(ParseInputHdl, sal_Int64*, TriState);
+ DECL_DLLPRIVATE_LINK(CursorChangedHdl, weld::Entry&, void);
+
+ SAL_DLLPRIVATE void Init();
+
+ SAL_DLLPRIVATE static tools::Time ConvertValue(int nValue);
+ SAL_DLLPRIVATE static int ConvertValue(const tools::Time& rTime);
+
+ SAL_DLLPRIVATE OUString FormatNumber(int nValue) const;
+
+ TimeFieldFormat m_eFormat;
+ TimeFormat m_eTimeFormat;
+ bool m_bDuration;
+};
+
+class VCL_DLLPUBLIC DateFormatter final : public EntryFormatter
+{
+public:
+ DateFormatter(weld::Entry& rEntry);
+
+ void SetMin(const Date& rNewMin);
+ void SetMax(const Date& rNewMax);
+
+ void SetDate(const Date& rNewDate);
+ Date GetDate();
+
+ void SetExtDateFormat(ExtDateFieldFormat eFormat);
+ void SetShowDateCentury(bool bShowCentury);
+
+ virtual ~DateFormatter() override;
+
+private:
+ DECL_DLLPRIVATE_LINK(FormatOutputHdl, LinkParamNone*, bool);
+ DECL_DLLPRIVATE_LINK(ParseInputHdl, sal_Int64*, TriState);
+ DECL_DLLPRIVATE_LINK(CursorChangedHdl, weld::Entry&, void);
+
+ SAL_DLLPRIVATE void Init();
+ SAL_DLLPRIVATE CalendarWrapper& GetCalendarWrapper() const;
+
+ SAL_DLLPRIVATE OUString FormatNumber(int nValue) const;
+
+ ExtDateFieldFormat m_eFormat;
+ mutable std::unique_ptr<CalendarWrapper> m_xCalendarWrapper;
+};
+
+class VCL_DLLPUBLIC PatternFormatter final
+{
+public:
+ PatternFormatter(weld::Entry& rEntry);
+ ~PatternFormatter();
+
+ weld::Entry& get_widget() { return m_rEntry; }
+
+ void SetMask(const OString& rEditMask, const OUString& rLiteralMask);
+ void SetStrictFormat(bool bStrict);
+ void ReformatAll();
+
+ /* PatternFormatter will set listeners to "changed", "focus-out", "focus-in"
+ and "key-press" of the Entry so users that want to add their own listeners
+ to those must set them through this formatter and not directly on that entry.
+ */
+ void connect_changed(const Link<weld::Entry&, void>& rLink) { m_aModifyHdl = rLink; }
+ void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_aFocusOutHdl = rLink; }
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink) { m_aFocusInHdl = rLink; }
+ void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_aKeyPressHdl = rLink; }
+
+ SAL_DLLPRIVATE void Modify();
+
+private:
+ weld::Entry& m_rEntry;
+ Link<weld::Entry&, void> m_aModifyHdl;
+ Link<weld::Widget&, void> m_aFocusInHdl;
+ Link<weld::Widget&, void> m_aFocusOutHdl;
+ Link<const KeyEvent&, bool> m_aKeyPressHdl;
+ bool m_bStrictFormat;
+ bool m_bSameMask;
+ bool m_bReformat;
+ bool m_bInPattKeyInput;
+ OString m_aEditMask;
+ OUString m_aLiteralMask;
+
+ SAL_DLLPRIVATE void EntryGainFocus();
+ SAL_DLLPRIVATE void EntryLostFocus();
+ DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
+ DECL_DLLPRIVATE_LINK(FocusInHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(FocusOutHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool);
+};
+
+class VCL_DLLPUBLIC ButtonPressRepeater final
+ : public std::enable_shared_from_this<ButtonPressRepeater>
+{
+private:
+ weld::Button& m_rButton;
+ AutoTimer m_aRepeat;
+ const Link<Button&, void> m_aLink;
+ const Link<const CommandEvent&, void> m_aContextLink;
+ bool m_bModKey;
+
+ DECL_DLLPRIVATE_LINK(MousePressHdl, const MouseEvent&, bool);
+ DECL_DLLPRIVATE_LINK(MouseReleaseHdl, const MouseEvent&, bool);
+ DECL_DLLPRIVATE_LINK(RepeatTimerHdl, Timer*, void);
+
+public:
+ ButtonPressRepeater(weld::Button& rButton, const Link<Button&, void>& rLink,
+ const Link<const CommandEvent&, void>& rContextLink
+ = Link<const CommandEvent&, void>());
+ void Stop() { m_aRepeat.Stop(); }
+ bool IsModKeyPressed() const { return m_bModKey; }
+};
+
+/*
+ If a TreeView is used as a list, rather than a tree, and DnD should just
+ reorder rows, then this can be used to implement that.
+
+ Because the TreeView doesn't want or need subnodes, the drop target can be
+ simply visually indicated as being between rows (the issue of a final drop
+ location of a child of the drop target doesn't arise), and the meaning of
+ what a drop before or after the last row should do is unambiguous.
+*/
+class VCL_DLLPUBLIC ReorderingDropTarget : public DropTargetHelper
+{
+protected:
+ weld::TreeView& m_rTreeView;
+ virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override;
+ virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override;
+
+public:
+ ReorderingDropTarget(weld::TreeView& rTreeView);
+};
+
+// get the row the iterator is on
+VCL_DLLPUBLIC size_t GetAbsPos(const weld::TreeView& rTreeView, const weld::TreeIter& rIter);
+
+// an entry is visible if all parents are expanded
+VCL_DLLPUBLIC bool IsEntryVisible(const weld::TreeView& rTreeView, const weld::TreeIter& rIter);
+
+// A Parent's Children are turned into Children of the Parent which comes next in hierarchy
+VCL_DLLPUBLIC void RemoveParentKeepChildren(weld::TreeView& rTreeView,
+ const weld::TreeIter& rParent);
+
+// return the min height of a weld::Entry
+VCL_DLLPUBLIC int GetMinimumEditHeight();
+
+// return the weld::Window of the SalFrame rOutWin is in, and convert rRect
+// from relative to rOutWin to relative to that weld::Window suitable for use
+// with popup_at_rect
+VCL_DLLPUBLIC weld::Window* GetPopupParent(vcl::Window& rOutWin, tools::Rectangle& rRect);
+
+// Use Application::GetDefaultDevice to set the PointFont rFont to the OutputDevice
+VCL_DLLPUBLIC void SetPointFont(OutputDevice& rDevice, const vcl::Font& rFont);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
new file mode 100644
index 000000000..5ad39489f
--- /dev/null
+++ b/include/vcl/window.hxx
@@ -0,0 +1,1586 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_WINDOW_HXX
+#define INCLUDED_VCL_WINDOW_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/outdev.hxx>
+#include <tools/link.hxx>
+#include <tools/wintypes.hxx>
+#include <vcl/vclenum.hxx>
+#include <vcl/keycodes.hxx>
+#include <vcl/region.hxx>
+#include <vcl/uitest/factory.hxx>
+#include <vcl/IDialogRenderable.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <memory>
+
+class VirtualDevice;
+struct ImplSVEvent;
+struct ImplWinData;
+struct ImplFrameData;
+struct ImplCalcToTopData;
+struct SystemEnvData;
+struct SystemParentData;
+class ImplBorderWindow;
+class Timer;
+class DockingManager;
+class ScrollBar;
+class FixedText;
+class MouseEvent;
+class KeyEvent;
+class CommandEvent;
+class TrackingEvent;
+class HelpEvent;
+class DataChangedEvent;
+class VclSimpleEvent;
+class NotifyEvent;
+class SystemWindow;
+class SalFrame;
+class MenuFloatingWindow;
+class VCLXWindow;
+class VclWindowEvent;
+class AllSettings;
+class InputContext;
+class VclEventListeners;
+enum class ImplPaintFlags;
+enum class VclEventId;
+enum class PointerStyle;
+
+namespace com::sun::star {
+ namespace accessibility {
+ struct AccessibleRelation;
+ class XAccessible;
+ }
+ namespace rendering {
+ class XCanvas;
+ class XSpriteCanvas;
+ }
+ namespace awt {
+ class XWindowPeer;
+ }
+ namespace uno {
+ class Any;
+ }
+ namespace datatransfer::clipboard {
+ class XClipboard;
+ }
+ namespace datatransfer::dnd {
+ class XDragGestureRecognizer;
+ class XDragSource;
+ class XDropTarget;
+ }
+}
+
+namespace vcl {
+ struct ControlLayoutData;
+}
+
+namespace svt { class PopupWindowControllerImpl; }
+
+namespace weld { class Window; }
+
+template<class T> class VclPtr;
+namespace tools { class JsonWriter; }
+
+// Type for GetWindow()
+enum class GetWindowType
+{
+ Parent = 0,
+ FirstChild = 1,
+ LastChild = 2,
+ Prev = 3,
+ Next = 4,
+ FirstOverlap = 5,
+ Overlap = 7,
+ ParentOverlap = 8,
+ Client = 9,
+ RealParent = 10,
+ Frame = 11,
+ Border = 12,
+ FirstTopWindowChild = 13,
+ NextTopWindowSibling = 16,
+};
+
+// Flags for setPosSizePixel()
+// These must match the definitions in css::awt::PosSize
+enum class PosSizeFlags
+{
+ NONE = 0x0000,
+ X = 0x0001,
+ Y = 0x0002,
+ Width = 0x0004,
+ Height = 0x0008,
+ Pos = X | Y,
+ Size = Width | Height,
+ PosSize = Pos | Size,
+ All = PosSize,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<PosSizeFlags> : is_typed_flags<PosSizeFlags, 0x000f> {};
+}
+
+// Flags for SetZOrder()
+enum class ZOrderFlags
+{
+ NONE = 0x0000,
+ Before = 0x0001,
+ Behind = 0x0002,
+ First = 0x0004,
+ Last = 0x0008,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ZOrderFlags> : is_typed_flags<ZOrderFlags, 0x000f> {};
+}
+
+// Activate-Flags
+enum class ActivateModeFlags
+{
+ NONE = 0,
+ GrabFocus = 0x0001,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ActivateModeFlags> : is_typed_flags<ActivateModeFlags, 0x0001> {};
+}
+
+// ToTop-Flags
+enum class ToTopFlags
+{
+ NONE = 0x0000,
+ RestoreWhenMin = 0x0001,
+ ForegroundTask = 0x0002,
+ NoGrabFocus = 0x0004,
+ GrabFocusOnly = 0x0008,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ToTopFlags> : is_typed_flags<ToTopFlags, 0x000f> {};
+}
+
+// Flags for Invalidate
+// must match css::awt::InvalidateStyle
+enum class InvalidateFlags
+{
+ NONE = 0x0000,
+ /** The child windows are invalidated, too. */
+ Children = 0x0001,
+ /** The child windows are not invalidated. */
+ NoChildren = 0x0002,
+ /** The invalidated area is painted with the background color/pattern. */
+ NoErase = 0x0004,
+ /** The invalidated area is updated immediately. */
+ Update = 0x0008,
+ /** The parent window is invalidated, too. */
+ Transparent = 0x0010,
+ /** The parent window is not invalidated. */
+ NoTransparent = 0x0020,
+ /** The area is invalidated regardless of overlapping child windows. */
+ NoClipChildren = 0x4000,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<InvalidateFlags> : is_typed_flags<InvalidateFlags, 0x403f> {};
+}
+
+// Flags for Validate
+enum class ValidateFlags
+{
+ NONE = 0x0000,
+ Children = 0x0001,
+ NoChildren = 0x0002
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ValidateFlags> : is_typed_flags<ValidateFlags, 0x0003> {};
+}
+
+// Flags for Scroll
+enum class ScrollFlags
+{
+ NONE = 0x0000,
+ Clip = 0x0001,
+ Children = 0x0002,
+ NoChildren = 0x0004,
+ UseClipRegion = 0x0008,
+ Update = 0x0010,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ScrollFlags> : is_typed_flags<ScrollFlags, 0x001f> {};
+}
+
+// Flags for ParentClipMode
+enum class ParentClipMode
+{
+ NONE = 0x0000,
+ Clip = 0x0001,
+ NoClip = 0x0002,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ParentClipMode> : is_typed_flags<ParentClipMode, 0x0003> {};
+}
+
+// Flags for ShowTracking()
+enum class ShowTrackFlags {
+ NONE = 0x0000,
+ Small = 0x0001,
+ Big = 0x0002,
+ Split = 0x0003,
+ Object = 0x0004,
+ StyleMask = 0x000F,
+ TrackWindow = 0x1000,
+ Clip = 0x2000,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ShowTrackFlags> : is_typed_flags<ShowTrackFlags, 0x300f> {};
+}
+
+// Flags for StartTracking()
+enum class StartTrackingFlags
+{
+ NONE = 0x0001,
+ KeyMod = 0x0002,
+ ScrollRepeat = 0x0004,
+ ButtonRepeat = 0x0008,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<StartTrackingFlags> : is_typed_flags<StartTrackingFlags, 0x000f> {};
+}
+
+// Flags for StartAutoScroll()
+enum class StartAutoScrollFlags
+{
+ NONE = 0x0000,
+ Vert = 0x0001,
+ Horz = 0x0002,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<StartAutoScrollFlags> : is_typed_flags<StartAutoScrollFlags, 0x0003> {};
+}
+
+// Flags for StateChanged()
+enum class StateChangedType : sal_uInt16
+{
+ InitShow = 1,
+ Visible = 2,
+ UpdateMode = 3,
+ Enable = 4,
+ Text = 5,
+ Data = 7,
+ State = 8,
+ Style = 9,
+ Zoom = 10,
+ ControlFont = 13,
+ ControlForeground = 14,
+ ControlBackground = 15,
+ ReadOnly = 16,
+ Mirroring = 18,
+ Layout = 19,
+ ControlFocus = 20
+};
+
+// GetFocusFlags
+// must match constants in css:awt::FocusChangeReason
+enum class GetFocusFlags
+{
+ NONE = 0x0000,
+ Tab = 0x0001,
+ CURSOR = 0x0002, // avoid name-clash with X11 #define
+ Mnemonic = 0x0004,
+ F6 = 0x0008,
+ Forward = 0x0010,
+ Backward = 0x0020,
+ Around = 0x0040,
+ UniqueMnemonic = 0x0100,
+ Init = 0x0200,
+ FloatWinPopupModeEndCancel = 0x0400,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<GetFocusFlags> : is_typed_flags<GetFocusFlags, 0x077f> {};
+}
+
+// DialogControl-Flags
+enum class DialogControlFlags
+{
+ NONE = 0x0000,
+ Return = 0x0001,
+ WantFocus = 0x0002,
+ FloatWinPopupModeEndCancel = 0x0004,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<DialogControlFlags> : is_typed_flags<DialogControlFlags, 0x0007> {};
+}
+
+// EndExtTextInput() Flags
+enum class EndExtTextInputFlags
+{
+ NONE = 0x0000,
+ Complete = 0x0001
+};
+namespace o3tl
+{
+ template<> struct typed_flags<EndExtTextInputFlags> : is_typed_flags<EndExtTextInputFlags, 0x0001> {};
+}
+
+#define IMPL_MINSIZE_BUTTON_WIDTH 70
+#define IMPL_MINSIZE_BUTTON_HEIGHT 22
+#define IMPL_EXTRA_BUTTON_WIDTH 18
+#define IMPL_EXTRA_BUTTON_HEIGHT 10
+#define IMPL_SEP_BUTTON_X 5
+#define IMPL_SEP_BUTTON_Y 5
+#define IMPL_MINSIZE_MSGBOX_WIDTH 150
+#define IMPL_DIALOG_OFFSET 5
+#define IMPL_DIALOG_BAR_OFFSET 3
+#define IMPL_MSGBOX_OFFSET_EXTRA_X 0
+#define IMPL_MSGBOX_OFFSET_EXTRA_Y 2
+#define IMPL_SEP_MSGBOX_IMAGE 8
+
+// ImplGetDlgWindow()
+enum class GetDlgWindowType
+{
+ Prev, Next, First
+};
+
+
+#ifdef DBG_UTIL
+const char* ImplDbgCheckWindow( const void* pObj );
+#endif
+
+namespace vcl { class Window; }
+namespace vcl { class Cursor; }
+namespace vcl { class WindowOutputDevice; }
+class Dialog;
+class Edit;
+class WindowImpl;
+class PaintHelper;
+class VclSizeGroup;
+class Application;
+class WorkWindow;
+class MessBox;
+class MessageDialog;
+class DockingWindow;
+class FloatingWindow;
+class GroupBox;
+class PushButton;
+class RadioButton;
+class SalInstanceWidget;
+class SystemChildWindow;
+class ImplDockingWindowWrapper;
+class ImplPopupFloatWin;
+class LifecycleTest;
+
+
+enum class WindowHitTest {
+ NONE = 0x0000,
+ Inside = 0x0001,
+ Transparent = 0x0002
+};
+namespace o3tl {
+ template<> struct typed_flags<WindowHitTest> : is_typed_flags<WindowHitTest, 0x0003> {};
+};
+
+
+enum class WindowExtendedStyle {
+ NONE = 0x0000,
+ Document = 0x0001,
+ DocModified = 0x0002,
+ /**
+ * This is a frame window that is requested to be hidden (not just "not yet
+ * shown").
+ */
+ DocHidden = 0x0004,
+};
+namespace o3tl {
+ template<> struct typed_flags<WindowExtendedStyle> : is_typed_flags<WindowExtendedStyle, 0x0007> {};
+};
+
+namespace vcl {
+
+class RenderTools
+{
+public:
+ // transparent background for selected or checked items in toolboxes etc.
+ // + selection Color with a text color complementing the selection background
+ // + rounded edge
+ static void DrawSelectionBackground(vcl::RenderContext& rRenderContext, vcl::Window const & rWindow,
+ const tools::Rectangle& rRect, sal_uInt16 nHighlight,
+ bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly,
+ Color* pSelectionTextColor = nullptr, tools::Long nCornerRadius = 0,
+ Color const * pPaintColor = nullptr);
+};
+
+class VCL_DLLPUBLIC Window : public virtual VclReferenceBase
+{
+ friend class ::vcl::Cursor;
+ friend class ::vcl::WindowOutputDevice;
+ friend class ::OutputDevice;
+ friend class ::Application;
+ friend class ::SystemWindow;
+ friend class ::WorkWindow;
+ friend class ::Dialog;
+ friend class ::Edit;
+ friend class ::MessBox;
+ friend class ::MessageDialog;
+ friend class ::DockingWindow;
+ friend class ::FloatingWindow;
+ friend class ::GroupBox;
+ friend class ::PushButton;
+ friend class ::RadioButton;
+ friend class ::SalInstanceWidget;
+ friend class ::SystemChildWindow;
+ friend class ::ImplBorderWindow;
+ friend class ::PaintHelper;
+ friend class ::LifecycleTest;
+ friend class ::VclEventListeners;
+
+ // TODO: improve missing functionality
+ // only required because of SetFloatingMode()
+ friend class ::ImplDockingWindowWrapper;
+ friend class ::ImplPopupFloatWin;
+ friend class ::MenuFloatingWindow;
+
+ friend class ::svt::PopupWindowControllerImpl;
+
+private:
+ // NOTE: to remove many dependencies of other modules
+ // to this central file, all members are now hidden
+ // in the WindowImpl class and all inline functions
+ // were removed.
+ // (WindowImpl is a pImpl pattern)
+
+ // Please do *not* add new members or inline functions to class Window,
+ // but use class WindowImpl instead
+
+ std::unique_ptr<WindowImpl> mpWindowImpl;
+
+#ifdef DBG_UTIL
+ friend const char* ::ImplDbgCheckWindow( const void* pObj );
+#endif
+
+public:
+
+ DECL_DLLPRIVATE_LINK( ImplHandlePaintHdl, Timer*, void );
+ DECL_DLLPRIVATE_LINK( ImplGenerateMouseMoveHdl, void*, void );
+ DECL_DLLPRIVATE_LINK( ImplTrackTimerHdl, Timer*, void );
+ DECL_DLLPRIVATE_LINK( ImplAsyncFocusHdl, void*, void );
+ DECL_DLLPRIVATE_LINK( ImplHandleResizeTimerHdl, Timer*, void );
+
+
+ SAL_DLLPRIVATE static void ImplInitAppFontData( vcl::Window const * pWindow );
+
+ SAL_DLLPRIVATE vcl::Window* ImplGetFrameWindow() const;
+ weld::Window* GetFrameWeld() const;
+ vcl::Window* GetFrameWindow() const;
+ SalFrame* ImplGetFrame() const;
+ SAL_DLLPRIVATE ImplFrameData* ImplGetFrameData();
+
+ vcl::Window* ImplGetWindow() const; ///< if this is a proxy return the client, otherwise itself
+ SAL_DLLPRIVATE ImplWinData* ImplGetWinData() const;
+ SAL_DLLPRIVATE vcl::Window* ImplGetClientWindow() const;
+ SAL_DLLPRIVATE vcl::Window* ImplGetDlgWindow( sal_uInt16 n, GetDlgWindowType nType, sal_uInt16 nStart = 0, sal_uInt16 nEnd = 0xFFFF, sal_uInt16* pIndex = nullptr );
+ SAL_DLLPRIVATE vcl::Window* ImplGetParent() const;
+ SAL_DLLPRIVATE vcl::Window* ImplFindWindow( const Point& rFramePos );
+
+ SAL_DLLPRIVATE void ImplInvalidateFrameRegion( const vcl::Region* pRegion, InvalidateFlags nFlags );
+ SAL_DLLPRIVATE void ImplInvalidateOverlapFrameRegion( const vcl::Region& rRegion );
+
+ SAL_DLLPRIVATE bool ImplSetClipFlag( bool bSysObjOnlySmaller = false );
+
+ SAL_DLLPRIVATE bool ImplIsWindowOrChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
+ SAL_DLLPRIVATE bool ImplIsChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
+ SAL_DLLPRIVATE bool ImplIsFloatingWindow() const;
+ SAL_DLLPRIVATE bool ImplIsPushButton() const;
+ SAL_DLLPRIVATE bool ImplIsSplitter() const;
+ SAL_DLLPRIVATE bool ImplIsOverlapWindow() const;
+
+ SAL_DLLPRIVATE void ImplIsInTaskPaneList( bool mbIsInTaskList );
+
+ SAL_DLLPRIVATE WindowImpl* ImplGetWindowImpl() const { return mpWindowImpl.get(); }
+
+ SAL_DLLPRIVATE Point ImplFrameToOutput( const Point& rPos );
+
+ SAL_DLLPRIVATE void ImplGrabFocus( GetFocusFlags nFlags );
+ SAL_DLLPRIVATE void ImplGrabFocusToDocument( GetFocusFlags nFlags );
+ SAL_DLLPRIVATE void ImplInvertFocus( const tools::Rectangle& rRect );
+
+ SAL_DLLPRIVATE PointerStyle ImplGetMousePointer() const;
+ SAL_DLLPRIVATE void ImplCallMouseMove( sal_uInt16 nMouseCode, bool bModChanged = false );
+ SAL_DLLPRIVATE void ImplGenerateMouseMove();
+
+ SAL_DLLPRIVATE void ImplNotifyKeyMouseCommandEventListeners( NotifyEvent& rNEvt );
+ SAL_DLLPRIVATE void ImplNotifyIconifiedState( bool bIconified );
+
+ SAL_DLLPRIVATE void ImplUpdateAll();
+
+ SAL_DLLPRIVATE void ImplControlFocus( GetFocusFlags nFlags = GetFocusFlags::NONE );
+
+ SAL_DLLPRIVATE void ImplMirrorFramePos( Point &pt ) const;
+
+ SAL_DLLPRIVATE void ImplPosSizeWindow( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags );
+
+ SAL_DLLPRIVATE void ImplCallResize();
+ SAL_DLLPRIVATE void ImplCallMove();
+
+ // These methods call the relevant virtual method when not in/post dispose
+ SAL_DLLPRIVATE void CompatGetFocus();
+ SAL_DLLPRIVATE void CompatLoseFocus();
+ SAL_DLLPRIVATE void CompatStateChanged( StateChangedType nStateChange );
+ SAL_DLLPRIVATE void CompatDataChanged( const DataChangedEvent& rDCEvt );
+ SAL_DLLPRIVATE bool CompatPreNotify( NotifyEvent& rNEvt );
+ SAL_DLLPRIVATE bool CompatNotify( NotifyEvent& rNEvt );
+
+ void IncModalCount();
+ void DecModalCount();
+
+ SAL_DLLPRIVATE static void ImplCalcSymbolRect( tools::Rectangle& rRect );
+
+protected:
+
+ /** This is intended to be used to clear any locally held references to other Window-subclass objects */
+ virtual void dispose() override;
+
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData );
+
+ SAL_DLLPRIVATE Point ImplOutputToFrame( const Point& rPos );
+
+ SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion( const vcl::Region& rRegion );
+ SAL_DLLPRIVATE void ImplValidateFrameRegion( const vcl::Region* rRegion, ValidateFlags nFlags );
+ SAL_DLLPRIVATE void ImplValidate();
+ SAL_DLLPRIVATE void ImplMoveInvalidateRegion( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren );
+ SAL_DLLPRIVATE void ImplMoveAllInvalidateRegions( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren );
+
+ SAL_DLLPRIVATE vcl::Window* ImplGetBorderWindow() const;
+
+ SAL_DLLPRIVATE void ImplInvalidate( const vcl::Region* rRegion, InvalidateFlags nFlags );
+
+ virtual WindowHitTest ImplHitTest( const Point& rFramePos );
+
+ SAL_DLLPRIVATE void ImplSetMouseTransparent( bool bTransparent );
+
+ SAL_DLLPRIVATE void ImplScroll( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags );
+
+ SAL_DLLPRIVATE bool ImplSetClipFlagChildren( bool bSysObjOnlySmaller );
+ SAL_DLLPRIVATE bool ImplSetClipFlagOverlapWindows( bool bSysObjOnlySmaller = false );
+
+ SAL_DLLPRIVATE void PushPaintHelper(PaintHelper* pHelper, vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE void PopPaintHelper(PaintHelper const * pHelper);
+
+private:
+
+ SAL_DLLPRIVATE void ImplSetFrameParent( const vcl::Window* pParent );
+
+ SAL_DLLPRIVATE void ImplInsertWindow( vcl::Window* pParent );
+ SAL_DLLPRIVATE void ImplRemoveWindow( bool bRemoveFrameData );
+
+ SAL_DLLPRIVATE SalGraphics* ImplGetFrameGraphics() const;
+
+ SAL_DLLPRIVATE static void ImplCallFocusChangeActivate( vcl::Window* pNewOverlapWindow, vcl::Window* pOldOverlapWindow );
+ SAL_DLLPRIVATE vcl::Window* ImplGetFirstOverlapWindow();
+ SAL_DLLPRIVATE const vcl::Window* ImplGetFirstOverlapWindow() const;
+
+ SAL_DLLPRIVATE bool ImplIsRealParentPath( const vcl::Window* pWindow ) const;
+
+ SAL_DLLPRIVATE bool ImplTestMousePointerSet();
+
+ SAL_DLLPRIVATE void ImplResetReallyVisible();
+ SAL_DLLPRIVATE void ImplSetReallyVisible();
+
+ SAL_DLLPRIVATE void ImplCallInitShow();
+
+ SAL_DLLPRIVATE void ImplInitResolutionSettings();
+
+ SAL_DLLPRIVATE void ImplPointToLogic(vcl::RenderContext const & rRenderContext, vcl::Font& rFont) const;
+ SAL_DLLPRIVATE void ImplLogicToPoint(vcl::RenderContext const & rRenderContext, vcl::Font& rFont) const;
+
+ SAL_DLLPRIVATE bool ImplSysObjClip( const vcl::Region* pOldRegion );
+ SAL_DLLPRIVATE void ImplUpdateSysObjChildrenClip();
+ SAL_DLLPRIVATE void ImplUpdateSysObjOverlapsClip();
+ SAL_DLLPRIVATE void ImplUpdateSysObjClip();
+
+ SAL_DLLPRIVATE void ImplIntersectWindowClipRegion( vcl::Region& rRegion );
+ SAL_DLLPRIVATE void ImplIntersectWindowRegion( vcl::Region& rRegion );
+ SAL_DLLPRIVATE void ImplExcludeWindowRegion( vcl::Region& rRegion );
+ SAL_DLLPRIVATE void ImplExcludeOverlapWindows( vcl::Region& rRegion ) const;
+ SAL_DLLPRIVATE void ImplExcludeOverlapWindows2( vcl::Region& rRegion );
+
+ SAL_DLLPRIVATE void ImplClipBoundaries( vcl::Region& rRegion, bool bThis, bool bOverlaps );
+ SAL_DLLPRIVATE bool ImplClipChildren( vcl::Region& rRegion ) const;
+ SAL_DLLPRIVATE void ImplClipAllChildren( vcl::Region& rRegion ) const;
+ SAL_DLLPRIVATE void ImplClipSiblings( vcl::Region& rRegion ) const;
+
+ SAL_DLLPRIVATE void ImplInitWinClipRegion();
+ SAL_DLLPRIVATE void ImplInitWinChildClipRegion();
+ SAL_DLLPRIVATE vcl::Region& ImplGetWinChildClipRegion();
+
+ SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows( const vcl::Region& rInterRegion, vcl::Region& rRegion ) const;
+ SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows2( const vcl::Region& rInterRegion, vcl::Region& rRegion );
+ SAL_DLLPRIVATE void ImplCalcOverlapRegionOverlaps( const vcl::Region& rInterRegion, vcl::Region& rRegion ) const;
+ SAL_DLLPRIVATE void ImplCalcOverlapRegion( const tools::Rectangle& rSourceRect, vcl::Region& rRegion,
+ bool bChildren, bool bSiblings );
+
+ /** Invoke the actual painting.
+
+ This function is kind of recursive - it may be called from the
+ PaintHelper destructor; and on the other hand it creates PaintHelper
+ that (when destructed) calls other ImplCallPaint()'s.
+ */
+ SAL_DLLPRIVATE void ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlags);
+
+ SAL_DLLPRIVATE void ImplCallOverlapPaint();
+
+ SAL_DLLPRIVATE void ImplUpdateWindowPtr( vcl::Window* pWindow );
+ SAL_DLLPRIVATE void ImplUpdateWindowPtr();
+ SAL_DLLPRIVATE void ImplUpdateOverlapWindowPtr( bool bNewFrame );
+
+ SAL_DLLPRIVATE bool ImplUpdatePos();
+ SAL_DLLPRIVATE void ImplUpdateSysObjPos();
+
+ SAL_DLLPRIVATE void ImplUpdateGlobalSettings( AllSettings& rSettings, bool bCallHdl = true ) const;
+
+ SAL_DLLPRIVATE void ImplToBottomChild();
+
+ SAL_DLLPRIVATE void ImplCalcToTop( ImplCalcToTopData* pPrevData );
+ SAL_DLLPRIVATE void ImplToTop( ToTopFlags nFlags );
+ SAL_DLLPRIVATE void ImplStartToTop( ToTopFlags nFlags );
+ SAL_DLLPRIVATE void ImplFocusToTop( ToTopFlags nFlags, bool bReallyVisible );
+
+ SAL_DLLPRIVATE void ImplShowAllOverlaps();
+ SAL_DLLPRIVATE void ImplHideAllOverlaps();
+
+ SAL_DLLPRIVATE bool ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput );
+ SAL_DLLPRIVATE bool ImplHasDlgCtrl() const;
+ SAL_DLLPRIVATE void ImplDlgCtrlNextWindow();
+ SAL_DLLPRIVATE void ImplDlgCtrlFocusChanged( vcl::Window* pWindow, bool bGetFocus );
+ SAL_DLLPRIVATE vcl::Window* ImplFindDlgCtrlWindow( vcl::Window* pWindow );
+
+ SAL_DLLPRIVATE static void ImplNewInputContext();
+
+ SAL_DLLPRIVATE void ImplCallActivateListeners(vcl::Window*);
+ SAL_DLLPRIVATE void ImplCallDeactivateListeners(vcl::Window*);
+
+ SAL_DLLPRIVATE static void ImplHandleScroll(ScrollBar* pHScrl, double nX, ScrollBar* pVScrl, double nY);
+
+ SAL_DLLPRIVATE tools::Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) const;
+ SAL_DLLPRIVATE tools::Rectangle ImplUnmirroredAbsoluteScreenToOutputPixel( const tools::Rectangle& rRect ) const;
+ SAL_DLLPRIVATE tools::Long ImplGetUnmirroredOutOffX();
+
+ // retrieves the list of owner draw decorated windows for this window hierarchy
+ SAL_DLLPRIVATE ::std::vector<VclPtr<vcl::Window> >& ImplGetOwnerDrawList();
+
+ SAL_DLLPRIVATE vcl::Window* ImplGetTopmostFrameWindow();
+
+ SAL_DLLPRIVATE tools::Rectangle ImplGetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const;
+
+ SAL_DLLPRIVATE bool ImplStopDnd();
+ SAL_DLLPRIVATE void ImplStartDnd();
+
+ virtual void ImplPaintToDevice( ::OutputDevice* pTargetOutDev, const Point& rPos );
+
+protected:
+ // Single argument ctors shall be explicit.
+ explicit Window( WindowType nType );
+
+ void SetCompoundControl( bool bCompound );
+
+ void CallEventListeners( VclEventId nEvent, void* pData = nullptr );
+
+ // FIXME: this is a hack to workaround missing layout functionality
+ virtual void ImplAdjustNWFSizes();
+
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext);
+
+public:
+ // Single argument ctors shall be explicit.
+ explicit Window( vcl::Window* pParent, WinBits nStyle = 0 );
+
+ virtual ~Window() override;
+
+ ::OutputDevice const* GetOutDev() const;
+ ::OutputDevice* GetOutDev();
+
+ Color GetBackgroundColor() const;
+ const Wallpaper & GetBackground() const;
+ bool IsBackground() const;
+ const MapMode& GetMapMode() const;
+ void SetBackground();
+ void SetBackground( const Wallpaper& rBackground );
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void KeyUp( const KeyEvent& rKEvt );
+ virtual void PrePaint(vcl::RenderContext& rRenderContext);
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
+ virtual void PostPaint(vcl::RenderContext& rRenderContext);
+
+ void Erase(vcl::RenderContext& rRenderContext);
+
+ virtual void Draw( ::OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags );
+ virtual void Move();
+ virtual void Resize();
+ virtual void Activate();
+ virtual void Deactivate();
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void Tracking( const TrackingEvent& rTEvt );
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual bool PreNotify( NotifyEvent& rNEvt );
+ virtual bool EventNotify( NotifyEvent& rNEvt );
+
+ void AddEventListener( const Link<VclWindowEvent&,void>& rEventListener );
+ void RemoveEventListener( const Link<VclWindowEvent&,void>& rEventListener );
+ void AddChildEventListener( const Link<VclWindowEvent&,void>& rEventListener );
+ void RemoveChildEventListener( const Link<VclWindowEvent&,void>& rEventListener );
+
+ ImplSVEvent * PostUserEvent( const Link<void*,void>& rLink, void* pCaller = nullptr, bool bReferenceLink = false );
+ void RemoveUserEvent( ImplSVEvent * nUserEvent );
+
+ // returns the input language used for the last key stroke
+ // may be LANGUAGE_DONTKNOW if not supported by the OS
+ LanguageType GetInputLanguage() const;
+
+ void SetStyle( WinBits nStyle );
+ WinBits GetStyle() const;
+ WinBits GetPrevStyle() const;
+ void SetExtendedStyle( WindowExtendedStyle nExtendedStyle );
+ WindowExtendedStyle GetExtendedStyle() const;
+ void SetType( WindowType nType );
+ WindowType GetType() const;
+ bool IsSystemWindow() const;
+ bool IsDockingWindow() const;
+ bool IsDialog() const;
+ bool IsMenuFloatingWindow() const;
+ bool IsToolbarFloatingWindow() const;
+ bool IsTopWindow() const;
+ SystemWindow* GetSystemWindow() const;
+
+ /// Can the widget derived from this Window do the double-buffering via RenderContext properly?
+ bool SupportsDoubleBuffering() const;
+ /// Enable/disable double-buffering of the frame window and all its children.
+ void RequestDoubleBuffering(bool bRequest);
+
+ void EnableAllResize();
+
+ void SetBorderStyle( WindowBorderStyle nBorderStyle );
+ WindowBorderStyle GetBorderStyle() const;
+ void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
+ sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
+ Size CalcWindowSize( const Size& rOutSz ) const;
+ Size CalcOutputSize( const Size& rWinSz ) const;
+ tools::Long CalcTitleWidth() const;
+
+ void EnableClipSiblings( bool bClipSiblings = true );
+
+ void EnableChildTransparentMode( bool bEnable = true );
+ bool IsChildTransparentModeEnabled() const;
+
+ void SetMouseTransparent( bool bTransparent );
+ bool IsMouseTransparent() const;
+ void SetPaintTransparent( bool bTransparent );
+ bool IsPaintTransparent() const;
+ void SetDialogControlStart( bool bStart );
+ bool IsDialogControlStart() const;
+ void SetDialogControlFlags( DialogControlFlags nFlags );
+ DialogControlFlags GetDialogControlFlags() const;
+
+ struct PointerState
+ {
+ sal_Int32 mnState; // the button state
+ Point maPos; // mouse position in output coordinates
+ };
+ PointerState GetPointerState();
+ bool IsMouseOver() const;
+
+ void SetInputContext( const InputContext& rInputContext );
+ const InputContext& GetInputContext() const;
+ void PostExtTextInputEvent(VclEventId nType, const OUString& rText);
+ void EndExtTextInput();
+ void SetCursorRect( const tools::Rectangle* pRect = nullptr, tools::Long nExtTextInputWidth = 0 );
+ const tools::Rectangle* GetCursorRect() const;
+ tools::Long GetCursorExtTextInputWidth() const;
+
+ void SetCompositionCharRect( const tools::Rectangle* pRect, tools::Long nCompositionLength, bool bVertical = false );
+
+ void UpdateSettings( const AllSettings& rSettings, bool bChild = false );
+ void NotifyAllChildren( DataChangedEvent& rDCEvt );
+
+ void SetPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont);
+ vcl::Font GetPointFont(vcl::RenderContext const & rRenderContext) const;
+ void SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont);
+ tools::Long GetDrawPixel( ::OutputDevice const * pDev, tools::Long nPixels ) const;
+ vcl::Font GetDrawPixelFont( ::OutputDevice const * pDev ) const;
+
+ void SetControlFont();
+ void SetControlFont( const vcl::Font& rFont );
+ vcl::Font GetControlFont() const;
+ bool IsControlFont() const;
+ void ApplyControlFont(vcl::RenderContext& rRenderContext, const vcl::Font& rDefaultFont);
+
+ void SetControlForeground();
+ void SetControlForeground(const Color& rColor);
+ const Color& GetControlForeground() const;
+ bool IsControlForeground() const;
+ void ApplyControlForeground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor);
+
+ void SetControlBackground();
+ void SetControlBackground( const Color& rColor );
+ const Color& GetControlBackground() const;
+ bool IsControlBackground() const;
+ void ApplyControlBackground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor);
+
+ void SetParentClipMode( ParentClipMode nMode = ParentClipMode::NONE );
+ ParentClipMode GetParentClipMode() const;
+
+ void SetWindowRegionPixel();
+ void SetWindowRegionPixel( const vcl::Region& rRegion );
+ vcl::Region GetWindowClipRegionPixel() const;
+ vcl::Region GetPaintRegion() const;
+ bool IsInPaint() const;
+ // while IsInPaint returns true ExpandPaintClipRegion adds the
+ // submitted region to the paint clip region so you can
+ // paint additional parts of your window if necessary
+ void ExpandPaintClipRegion( const vcl::Region& rRegion );
+
+ void SetParent( vcl::Window* pNewParent );
+ vcl::Window* GetParent() const;
+ // return the dialog we are contained in or NULL if un-contained
+ Dialog* GetParentDialog() const;
+ bool IsAncestorOf( const vcl::Window& rWindow ) const;
+
+ void Show( bool bVisible = true, ShowFlags nFlags = ShowFlags::NONE );
+ void Hide() { Show( false ); }
+ bool IsVisible() const;
+ bool IsReallyVisible() const;
+ bool IsReallyShown() const;
+ bool IsInInitShow() const;
+
+ void Enable( bool bEnable = true, bool bChild = true );
+ void Disable( bool bChild = true ) { Enable( false, bChild ); }
+ bool IsEnabled() const;
+
+ void EnableInput( bool bEnable = true, bool bChild = true );
+ void EnableInput( bool bEnable, const vcl::Window* pExcludeWindow );
+ bool IsInputEnabled() const;
+
+ /** Override <code>EnableInput</code>. This can be necessary due to other people
+ using EnableInput for whole window hierarchies.
+
+ @param bAlways
+ sets always enabled flag
+
+ @param bChild
+ if true children are recursively set to AlwaysEnableInput
+ */
+ void AlwaysEnableInput( bool bAlways, bool bChild = true );
+
+ /** returns the current AlwaysEnableInput state
+ @return
+ true if window is in AlwaysEnableInput state
+ */
+ bool IsAlwaysEnableInput() const;
+
+ /** A window is in modal mode if one of its children or subchildren
+ is a running modal window (a modal dialog)
+
+ @returns sal_True if a child or subchild is a running modal window
+ */
+ bool IsInModalMode() const;
+
+ void SetActivateMode( ActivateModeFlags nMode );
+ ActivateModeFlags GetActivateMode() const;
+
+ void ToTop( ToTopFlags nFlags = ToTopFlags::NONE );
+ void SetZOrder( vcl::Window* pRefWindow, ZOrderFlags nFlags );
+ void EnableAlwaysOnTop( bool bEnable = true );
+ bool IsAlwaysOnTopEnabled() const;
+
+ virtual void setPosSizePixel( tools::Long nX, tools::Long nY,
+ tools::Long nWidth, tools::Long nHeight,
+ PosSizeFlags nFlags = PosSizeFlags::All );
+ virtual void SetPosPixel( const Point& rNewPos );
+ virtual Point GetPosPixel() const;
+ virtual void SetSizePixel( const Size& rNewSize );
+ virtual Size GetSizePixel() const;
+ virtual void SetPosSizePixel( const Point& rNewPos,
+ const Size& rNewSize );
+ virtual void SetOutputSizePixel( const Size& rNewSize );
+ bool IsDefaultPos() const;
+ bool IsDefaultSize() const;
+ Point GetOffsetPixelFrom(const vcl::Window& rWindow) const;
+
+ // those conversion routines might deliver different results during UI mirroring
+ Point OutputToScreenPixel( const Point& rPos ) const;
+ Point ScreenToOutputPixel( const Point& rPos ) const;
+ // the normalized screen methods work independent from UI mirroring
+ Point OutputToNormalizedScreenPixel( const Point& rPos ) const;
+ Point NormalizedScreenToOutputPixel( const Point& rPos ) const;
+ Point OutputToAbsoluteScreenPixel( const Point& rPos ) const;
+ Point AbsoluteScreenToOutputPixel( const Point& rPos ) const;
+ tools::Rectangle GetDesktopRectPixel() const;
+ // window extents including border and decoration
+ tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const;
+
+ bool IsScrollable() const;
+ virtual void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll,
+ ScrollFlags nFlags = ScrollFlags::NONE );
+ void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll,
+ const tools::Rectangle& rRect, ScrollFlags nFlags = ScrollFlags::NONE );
+ virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE );
+ virtual void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE );
+ virtual void Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE );
+ /**
+ * Notification about some rectangle of the output device got invalidated.Used for the main
+ * document window.
+ *
+ * @param pRectangle If 0, that means the whole area, otherwise the area in logic coordinates.
+ */
+ virtual void LogicInvalidate(const tools::Rectangle* pRectangle);
+
+ /**
+ * Notification about some rectangle of the output device got invalidated. Used for the
+ * dialogs and floating windows (e.g. context menu, popup).
+ *
+ * @param pRectangle If 0, that means the whole area, otherwise the area in pixel coordinates.
+ */
+ virtual void PixelInvalidate(const tools::Rectangle* pRectangle);
+ void Validate();
+ bool HasPaintEvent() const;
+ void PaintImmediately();
+
+ // toggles new docking support, enabled via toolkit
+ void EnableDocking( bool bEnable = true );
+ // retrieves the single dockingmanager instance
+ static DockingManager* GetDockingManager();
+
+ void EnablePaint( bool bEnable );
+ bool IsPaintEnabled() const;
+ void SetUpdateMode( bool bUpdate );
+ bool IsUpdateMode() const;
+ void SetParentUpdateMode( bool bUpdate );
+
+ void GrabFocus();
+ bool HasFocus() const;
+ bool HasChildPathFocus( bool bSystemWindow = false ) const;
+ bool IsActive() const;
+ bool HasActiveChildFrame() const;
+ GetFocusFlags GetGetFocusFlags() const;
+ void GrabFocusToDocument();
+ VclPtr<vcl::Window> GetFocusedWindow() const;
+
+ /**
+ * Set this when you need to act as if the window has focus even if it
+ * doesn't. This is necessary for implementing tab stops inside floating
+ * windows, but floating windows don't get focus from the system.
+ */
+ void SetFakeFocus( bool bFocus );
+
+ bool IsCompoundControl() const;
+
+ static VclPtr<vcl::Window> SaveFocus();
+ static void EndSaveFocus(const VclPtr<vcl::Window>& xFocusWin);
+
+ void LocalStartDrag();
+ void CaptureMouse();
+ void ReleaseMouse();
+ bool IsMouseCaptured() const;
+
+ void SetPointer( PointerStyle );
+ PointerStyle GetPointer() const;
+ void EnableChildPointerOverwrite( bool bOverwrite );
+ void SetPointerPosPixel( const Point& rPos );
+ Point GetPointerPosPixel();
+ Point GetLastPointerPosPixel();
+ /// Similar to SetPointerPosPixel(), but sets the frame data's last mouse position instead.
+ void SetLastMousePos(const Point& rPos);
+ void ShowPointer( bool bVisible );
+ void EnterWait();
+ void LeaveWait();
+ bool IsWait() const;
+
+ void SetCursor( vcl::Cursor* pCursor );
+ vcl::Cursor* GetCursor() const;
+
+ void SetZoom( const Fraction& rZoom );
+ const Fraction& GetZoom() const;
+ bool IsZoom() const;
+ tools::Long CalcZoom( tools::Long n ) const;
+
+ virtual void SetText( const OUString& rStr );
+ virtual OUString GetText() const;
+ // return the actual text displayed
+ // this may have e.g. accelerators removed or portions
+ // replaced by ellipses
+ virtual OUString GetDisplayText() const;
+ // gets the visible background color. for transparent windows
+ // this may be the parent's background color; for controls
+ // this may be a child's background color (e.g. ListBox)
+ virtual const Wallpaper& GetDisplayBackground() const;
+
+ void SetHelpText( const OUString& rHelpText );
+ const OUString& GetHelpText() const;
+
+ void SetQuickHelpText( const OUString& rHelpText );
+ const OUString& GetQuickHelpText() const;
+
+ void SetHelpId( const OString& );
+ const OString& GetHelpId() const;
+
+ sal_uInt16 GetChildCount() const;
+ vcl::Window* GetChild( sal_uInt16 nChild ) const;
+ vcl::Window* GetWindow( GetWindowType nType ) const;
+ bool IsChild( const vcl::Window* pWindow ) const;
+ bool IsWindowOrChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
+
+ /// Add all children to rAllChildren recursively.
+ SAL_DLLPRIVATE void CollectChildren(::std::vector<vcl::Window *>& rAllChildren );
+
+ virtual void ShowFocus(const tools::Rectangle& rRect);
+ void HideFocus();
+
+ // transparent background for selected or checked items in toolboxes etc.
+ void DrawSelectionBackground( const tools::Rectangle& rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder );
+
+ void ShowTracking( const tools::Rectangle& rRect,
+ ShowTrackFlags nFlags = ShowTrackFlags::Small );
+ void HideTracking();
+ void InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlags );
+
+ void StartTracking( StartTrackingFlags nFlags = StartTrackingFlags::NONE );
+ void EndTracking( TrackingEventFlags nFlags = TrackingEventFlags::NONE );
+ bool IsTracking() const;
+
+ void StartAutoScroll( StartAutoScrollFlags nFlags );
+ void EndAutoScroll();
+
+ bool HandleScrollCommand( const CommandEvent& rCmd,
+ ScrollBar* pHScrl,
+ ScrollBar* pVScrl );
+
+ virtual const SystemEnvData* GetSystemData() const;
+
+ // API to set/query the component interfaces
+ virtual css::uno::Reference< css::awt::XWindowPeer >
+ GetComponentInterface( bool bCreate = true );
+
+ void SetComponentInterface( css::uno::Reference< css::awt::XWindowPeer > const & xIFace );
+
+ void SetUseFrameData(bool bUseFrameData);
+
+ /// Interface to register for dialog / window tunneling.
+ void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier, bool bParent = false);
+ const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() const;
+ vcl::LOKWindowId GetLOKWindowId() const;
+
+ /// Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set.
+ VclPtr<vcl::Window> GetParentWithLOKNotifier();
+
+ /// Indicate that LOK is not going to use this dialog any more.
+ void ReleaseLOKNotifier();
+
+ /// Find an existing Window based on the LOKWindowId.
+ static VclPtr<vcl::Window> FindLOKWindow(vcl::LOKWindowId nWindowId);
+
+ /// check if LOK Window container is empty
+ static bool IsLOKWindowsEmpty();
+
+ /// Dumps itself and potentially its children to a property tree, to be written easily to JSON.
+ virtual void DumpAsPropertyTree(tools::JsonWriter&);
+
+ /// Same as MouseButtonDown(), but coordinates are in logic unit. used for LOK
+ virtual void LogicMouseButtonDown(const MouseEvent&) {};
+ /// Same as MouseButtonUp(), but coordinates are in logic unit. used for LOK
+ virtual void LogicMouseButtonUp(const MouseEvent&) {};
+ /// Same as MouseMove(), but coordinates are in logic unit. used for LOK
+ virtual void LogicMouseMove(const MouseEvent&) {};
+
+ /** @name Accessibility
+ */
+ ///@{
+public:
+
+ css::uno::Reference< css::accessibility::XAccessible >
+ GetAccessible( bool bCreate = true );
+
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ CreateAccessible();
+
+ void SetAccessible( const css::uno::Reference< css::accessibility::XAccessible >& );
+
+ vcl::Window* GetAccessibleParentWindow() const;
+ sal_uInt16 GetAccessibleChildWindowCount();
+ vcl::Window* GetAccessibleChildWindow( sal_uInt16 n );
+
+ void SetAccessibleRole( sal_uInt16 nRole );
+ sal_uInt16 GetAccessibleRole() const;
+
+ void SetAccessibleName( const OUString& rName );
+ OUString GetAccessibleName() const;
+
+ void SetAccessibleDescription( const OUString& rDescr );
+ OUString GetAccessibleDescription() const;
+
+ void SetAccessibleRelationLabeledBy( vcl::Window* pLabeledBy );
+ vcl::Window* GetAccessibleRelationLabeledBy() const;
+
+ void SetAccessibleRelationLabelFor( vcl::Window* pLabelFor );
+ vcl::Window* GetAccessibleRelationLabelFor() const;
+
+ vcl::Window* GetAccessibleRelationMemberOf() const;
+
+ // to avoid sending accessibility events in cases like closing dialogs
+ // by default checks complete parent path
+ bool IsAccessibilityEventsSuppressed( bool bTraverseParentPath = true );
+ void SetAccessibilityEventsSuppressed(bool bSuppressed);
+
+ KeyEvent GetActivationKey() const;
+
+protected:
+
+ // These eventually are supposed to go when everything is converted to .ui
+ SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationMemberOf() const;
+ SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
+ SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabelFor() const;
+
+ // Let Label override the code part of GetAccessibleRelationLabelFor
+ virtual vcl::Window* getAccessibleRelationLabelFor() const;
+ virtual sal_uInt16 getDefaultAccessibleRole() const;
+ virtual OUString getDefaultAccessibleName() const;
+
+ /*
+ * Advisory Sizing - what is a good size for this widget
+ *
+ * Retrieves the preferred size of a widget ignoring
+ * "width-request" and "height-request" properties.
+ *
+ * Implement this in sub-classes to tell layout
+ * the preferred widget size.
+ *
+ * Use get_preferred_size to retrieve this value
+ * cached and mediated via height and width requests
+ */
+ virtual Size GetOptimalSize() const;
+ /// clear OptimalSize cache
+ void InvalidateSizeCache();
+private:
+
+ SAL_DLLPRIVATE bool ImplIsAccessibleCandidate() const;
+ SAL_DLLPRIVATE bool ImplIsAccessibleNativeFrame() const;
+ ///@}
+
+ /*
+ * Retrieves the preferred size of a widget taking
+ * into account the "width-request" and "height-request" properties.
+ *
+ * Overrides the result of GetOptimalSize to honor the
+ * width-request and height-request properties.
+ *
+ * So the same as get_ungrouped_preferred_size except
+ * it ignores groups. A building block of get_preferred_size
+ * that access the size cache
+ *
+ * @see get_preferred_size
+ */
+ Size get_ungrouped_preferred_size() const;
+public:
+ /* records all DrawText operations within the passed rectangle;
+ * a synchronous paint is sent to achieve this
+ */
+ void RecordLayoutData( vcl::ControlLayoutData* pLayout, const tools::Rectangle& rRect );
+
+ // set and retrieve for Toolkit
+ VCLXWindow* GetWindowPeer() const;
+ void SetWindowPeer( css::uno::Reference< css::awt::XWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow );
+
+ // remember if it was generated by Toolkit
+ bool IsCreatedWithToolkit() const;
+ void SetCreatedWithToolkit( bool b );
+
+ // Drag and Drop interfaces
+ css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget();
+ css::uno::Reference< css::datatransfer::dnd::XDragSource > GetDragSource();
+ css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > GetDragGestureRecognizer();
+
+ // Clipboard/Selection interfaces
+ css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard();
+ /// Sets a custom clipboard for the window's frame, instead of creating it on-demand using css::datatransfer::clipboard::SystemClipboard.
+ void SetClipboard(css::uno::Reference<css::datatransfer::clipboard::XClipboard> const & xClipboard);
+
+ /*
+ * Widgets call this to inform their owner container that the widget wants
+ * to renegotiate its size. Should be called when a widget has a new size
+ * request. e.g. a FixedText Control gets a new label.
+ *
+ * akin to gtk_widget_queue_resize
+ */
+ virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout);
+
+ /*
+ * Sets the "height-request" property
+ *
+ * Override for height request of the widget, or -1 if natural request
+ * should be used.
+ *
+ * @see get_preferred_size, set_width_request
+ */
+ void set_height_request(sal_Int32 nHeightRequest);
+ sal_Int32 get_height_request() const;
+
+ /*
+ * Sets the "width-request" property
+ *
+ * Override for width request of the widget, or -1 if natural request
+ * should be used.
+ *
+ * @see get_preferred_size, set_height_request
+ */
+ void set_width_request(sal_Int32 nWidthRequest);
+ sal_Int32 get_width_request() const;
+
+ /*
+ * Retrieves the preferred size of a widget taking
+ * into account the "width-request" and "height-request" properties.
+ *
+ * Overrides the result of GetOptimalSize to honor the
+ * width-request and height-request properties.
+ *
+ * @see GetOptimalSize
+ *
+ * akin to gtk_widget_get_preferred_size
+ */
+ Size get_preferred_size() const;
+
+ /*
+ * How to horizontally align this widget
+ */
+ VclAlign get_halign() const;
+ void set_halign(VclAlign eAlign);
+
+ /*
+ * How to vertically align this widget
+ */
+ VclAlign get_valign() const;
+ void set_valign(VclAlign eAlign);
+
+ /*
+ * Whether the widget would like to use any available extra horizontal
+ * space.
+ */
+ bool get_hexpand() const;
+ void set_hexpand(bool bExpand);
+
+ /*
+ * Whether the widget would like to use any available extra vertical
+ * space.
+ */
+ bool get_vexpand() const;
+ void set_vexpand(bool bExpand);
+
+ /*
+ * Whether the widget would like to use any available extra space.
+ */
+ bool get_expand() const;
+ void set_expand(bool bExpand);
+
+ /*
+ * Whether the widget should receive extra space when the parent grows
+ */
+ bool get_fill() const;
+ void set_fill(bool bFill);
+
+ void set_border_width(sal_Int32 nBorderWidth);
+ sal_Int32 get_border_width() const;
+
+ void set_margin_start(sal_Int32 nWidth);
+ sal_Int32 get_margin_start() const;
+
+ void set_margin_end(sal_Int32 nWidth);
+ sal_Int32 get_margin_end() const;
+
+ void set_margin_top(sal_Int32 nWidth);
+ sal_Int32 get_margin_top() const;
+
+ void set_margin_bottom(sal_Int32 nWidth);
+ sal_Int32 get_margin_bottom() const;
+
+ /*
+ * How the widget is packed with reference to the start or end of the parent
+ */
+ VclPackType get_pack_type() const;
+ void set_pack_type(VclPackType ePackType);
+
+ /*
+ * The extra space to put between the widget and its neighbors
+ */
+ sal_Int32 get_padding() const;
+ void set_padding(sal_Int32 nPadding);
+
+ /*
+ * The number of columns that the widget spans
+ */
+ sal_Int32 get_grid_width() const;
+ void set_grid_width(sal_Int32 nCols);
+
+ /*
+ * The column number to attach the left side of the widget to
+ */
+ sal_Int32 get_grid_left_attach() const;
+ void set_grid_left_attach(sal_Int32 nAttach);
+
+ /*
+ * The number of row that the widget spans
+ */
+ sal_Int32 get_grid_height() const;
+ void set_grid_height(sal_Int32 nRows);
+
+ /*
+ * The row number to attach the top side of the widget to
+ */
+ sal_Int32 get_grid_top_attach() const;
+ void set_grid_top_attach(sal_Int32 nAttach);
+
+ /*
+ * If true this child appears in a secondary layout group of children
+ * e.g. help buttons in a buttonbox
+ */
+ bool get_secondary() const;
+ void set_secondary(bool bSecondary);
+
+ /*
+ * If true this child is exempted from homogeneous sizing
+ * e.g. special button in a buttonbox
+ */
+ bool get_non_homogeneous() const;
+ void set_non_homogeneous(bool bNonHomogeneous);
+
+ /*
+ * Sets a widget property
+ *
+ * @return false if property is unknown
+ */
+ virtual bool set_property(const OString &rKey, const OUString &rValue);
+
+ /*
+ * Sets a font attribute
+ *
+ * @return false if attribute is unknown
+ */
+ bool set_font_attribute(const OString &rKey, std::u16string_view rValue);
+
+ /*
+ * Adds this widget to the xGroup VclSizeGroup
+ *
+ */
+ void add_to_size_group(const std::shared_ptr<VclSizeGroup>& xGroup);
+ void remove_from_all_size_groups();
+
+ /*
+ * add/remove mnemonic label
+ */
+ void add_mnemonic_label(FixedText *pLabel);
+ void remove_mnemonic_label(FixedText *pLabel);
+ const std::vector<VclPtr<FixedText> >& list_mnemonic_labels() const;
+
+ /*
+ * Move this widget to be the nNewPosition'd child of its parent
+ */
+ void reorderWithinParent(sal_uInt16 nNewPosition);
+
+ /**
+ * Sets an ID.
+ */
+ void set_id(const OUString& rID);
+
+ /**
+ * Get the ID of the window.
+ */
+ const OUString& get_id() const;
+
+
+ // Native Widget Rendering functions
+
+
+ // form controls must never use native widgets, this can be toggled here
+ void EnableNativeWidget( bool bEnable = true );
+ bool IsNativeWidgetEnabled() const;
+
+ // a helper method for a Control's Draw method
+ void PaintToDevice( ::OutputDevice* pDevice, const Point& rPos );
+
+ // Keyboard access functions
+
+ /** Query the states of keyboard indicators - Caps Lock, Num Lock and
+ Scroll Lock. Use the following mask to retrieve the state of each
+ indicator:
+
+ KeyIndicatorState::CAPS_LOCK
+ KeyIndicatorState::NUM_LOCK
+ KeyIndicatorState::SCROLL_LOCK
+ */
+ KeyIndicatorState GetIndicatorState() const;
+
+ void SimulateKeyPress( sal_uInt16 nKeyCode ) const;
+
+ virtual OUString GetSurroundingText() const;
+ virtual Selection GetSurroundingTextSelection() const;
+ virtual bool DeleteSurroundingText(const Selection& rSelection);
+
+ virtual FactoryFunction GetUITestFactory() const;
+
+ virtual bool IsChart() const { return false; }
+ virtual bool IsStarMath() const { return false; }
+
+ void SetHelpHdl(const Link<vcl::Window&, bool>& rLink);
+ void SetMnemonicActivateHdl(const Link<vcl::Window&, bool>& rLink);
+ void SetModalHierarchyHdl(const Link<bool, void>& rLink);
+ void SetDumpAsPropertyTreeHdl(const Link<tools::JsonWriter&, void>& rLink);
+
+ Size GetOutputSizePixel() const;
+ tools::Rectangle GetOutputRectPixel() const;
+
+ Point LogicToPixel( const Point& rLogicPt ) const;
+ Size LogicToPixel( const Size& rLogicSize ) const;
+ tools::Rectangle LogicToPixel( const tools::Rectangle& rLogicRect ) const;
+ vcl::Region LogicToPixel( const vcl::Region& rLogicRegion )const;
+ Point LogicToPixel( const Point& rLogicPt,
+ const MapMode& rMapMode ) const;
+ Size LogicToPixel( const Size& rLogicSize,
+ const MapMode& rMapMode ) const;
+ tools::Rectangle LogicToPixel( const tools::Rectangle& rLogicRect,
+ const MapMode& rMapMode ) const;
+
+ Point PixelToLogic( const Point& rDevicePt ) const;
+ Size PixelToLogic( const Size& rDeviceSize ) const;
+ tools::Rectangle PixelToLogic( const tools::Rectangle& rDeviceRect ) const;
+ tools::PolyPolygon PixelToLogic( const tools::PolyPolygon& rDevicePolyPoly ) const;
+ vcl::Region PixelToLogic( const vcl::Region& rDeviceRegion ) const;
+ Point PixelToLogic( const Point& rDevicePt,
+ const MapMode& rMapMode ) const;
+ Size PixelToLogic( const Size& rDeviceSize,
+ const MapMode& rMapMode ) const;
+ tools::Rectangle PixelToLogic( const tools::Rectangle& rDeviceRect,
+ const MapMode& rMapMode ) const;
+
+ Size LogicToLogic( const Size& rSzSource,
+ const MapMode* pMapModeSource,
+ const MapMode* pMapModeDest ) const;
+
+ const AllSettings& GetSettings() const;
+ void SetSettings( const AllSettings& rSettings );
+ void SetSettings( const AllSettings& rSettings, bool bChild );
+
+ tools::Rectangle GetTextRect( const tools::Rectangle& rRect,
+ const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::WordBreak,
+ TextRectInfo* pInfo = nullptr,
+ const vcl::ITextLayout* _pTextLayout = nullptr ) const;
+ float GetDPIScaleFactor() const;
+ tools::Long GetOutOffXPixel() const;
+ tools::Long GetOutOffYPixel() const;
+
+ void EnableMapMode( bool bEnable = true );
+ bool IsMapModeEnabled() const;
+ void SetMapMode();
+ void SetMapMode( const MapMode& rNewMapMode );
+
+ // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphicsLayout
+ virtual void EnableRTL( bool bEnable = true);
+ bool IsRTLEnabled() const;
+
+ void SetFont( const vcl::Font& rNewFont );
+ const vcl::Font& GetFont() const;
+
+ /** Width of the text.
+
+ See also GetTextBoundRect() for more explanation + code examples.
+ */
+ tools::Long GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
+ vcl::text::TextLayoutCache const* = nullptr,
+ SalLayoutGlyphs const*const pLayoutCache = nullptr) const;
+
+ /** Height where any character of the current font fits; in logic coordinates.
+
+ See also GetTextBoundRect() for more explanation + code examples.
+ */
+ tools::Long GetTextHeight() const;
+ float approximate_digit_width() const;
+
+ void SetTextColor( const Color& rColor );
+ const Color& GetTextColor() const;
+
+ void SetTextFillColor();
+ void SetTextFillColor( const Color& rColor );
+ Color GetTextFillColor() const;
+ bool IsTextFillColor() const;
+
+ void SetTextLineColor();
+ void SetTextLineColor( const Color& rColor );
+ const Color& GetTextLineColor() const;
+ bool IsTextLineColor() const;
+
+ void SetOverlineColor();
+ void SetOverlineColor( const Color& rColor );
+ const Color& GetOverlineColor() const;
+ bool IsOverlineColor() const;
+
+ void SetTextAlign( TextAlign eAlign );
+ TextAlign GetTextAlign() const;
+
+ /** Query the platform layer for control support
+ */
+ bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
+
+ static OUString GetNonMnemonicString(const OUString& rStr) { return OutputDevice::GetNonMnemonicString(rStr); }
+
+ /** Query the native control's actual drawing region (including adornment)
+ */
+ bool GetNativeControlRegion(
+ ControlType nType,
+ ControlPart nPart,
+ const tools::Rectangle& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ tools::Rectangle &rNativeBoundingRegion,
+ tools::Rectangle &rNativeContentRegion ) const;
+protected:
+ SAL_DLLPRIVATE float approximate_char_width() const;
+private:
+ SAL_DLLPRIVATE void ImplEnableRTL(bool bEnable);
+};
+
+}
+
+#endif // INCLUDED_VCL_WINDOW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/windowstate.hxx b/include/vcl/windowstate.hxx
new file mode 100644
index 000000000..dcf0f4e9a
--- /dev/null
+++ b/include/vcl/windowstate.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_WINDOWSTATE_HXX
+#define INCLUDED_VCL_WINDOWSTATE_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/vclenum.hxx>
+#include <rtl/string.hxx>
+
+class VCL_PLUGIN_PUBLIC WindowStateData
+{
+private:
+ WindowStateMask mnValidMask;
+ int mnX;
+ int mnY;
+ unsigned int mnWidth;
+ unsigned int mnHeight;
+ int mnMaximizedX;
+ int mnMaximizedY;
+ unsigned int mnMaximizedWidth;
+ unsigned int mnMaximizedHeight;
+ WindowStateState mnState;
+
+public:
+ WindowStateData()
+ : mnValidMask(WindowStateMask::NONE)
+ , mnX(0)
+ , mnY(0)
+ , mnWidth(0)
+ , mnHeight(0)
+ , mnMaximizedX(0)
+ , mnMaximizedY(0)
+ , mnMaximizedWidth(0)
+ , mnMaximizedHeight(0)
+ , mnState(WindowStateState::NONE)
+ {
+ }
+
+ void SetMask(WindowStateMask nValidMask) { mnValidMask = nValidMask; }
+ WindowStateMask GetMask() const { return mnValidMask; }
+
+ void SetX(int nX) { mnX = nX; }
+ int GetX() const { return mnX; }
+ void SetY(int nY) { mnY = nY; }
+ int GetY() const { return mnY; }
+ void SetWidth(unsigned int nWidth) { mnWidth = nWidth; }
+ unsigned int GetWidth() const { return mnWidth; }
+ void SetHeight(unsigned int nHeight) { mnHeight = nHeight; }
+ unsigned int GetHeight() const { return mnHeight; }
+ void SetState(WindowStateState nState) { mnState = nState; }
+ WindowStateState GetState() const { return mnState; }
+ void SetMaximizedX(int nRX) { mnMaximizedX = nRX; }
+ int GetMaximizedX() const { return mnMaximizedX; }
+ void SetMaximizedY(int nRY) { mnMaximizedY = nRY; }
+ int GetMaximizedY() const { return mnMaximizedY; }
+ void SetMaximizedWidth(unsigned int nRWidth) { mnMaximizedWidth = nRWidth; }
+ unsigned int GetMaximizedWidth() const { return mnMaximizedWidth; }
+ void SetMaximizedHeight(unsigned int nRHeight) { mnMaximizedHeight = nRHeight; }
+ unsigned int GetMaximizedHeight() const { return mnMaximizedHeight; }
+
+ OString ToStr() const;
+};
+
+#endif // INCLUDED_VCL_WINDOWSTATE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/winscheduler.hxx b/include/vcl/winscheduler.hxx
new file mode 100644
index 000000000..a984b4544
--- /dev/null
+++ b/include/vcl/winscheduler.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_WINSCHEDULER_HXX
+#define INCLUDED_VCL_WINSCHEDULER_HXX
+
+#ifndef _WIN32
+#error This header is just usable on Windows
+#else
+
+#include <vcl/dllapi.h>
+
+struct VCL_DLLPUBLIC WinScheduler final
+{
+ /// Hack for Windows native dialogs, which run the main loop, so we can't
+ /// use the direct processing shortcut.
+ static void SetForceRealTimer();
+
+ // Posting a dummy messages might be needed to ensure that main loop eventually returns from
+ // GetMessage ("wakes up") in modes without a visible window. This, e.g., might be needed to
+ // let main thread recheck a condition set from another thread.
+ static void PostDummyMessage();
+};
+
+#endif // _WIN32
+#endif // INCLUDED_VCL_WINSCHEDULER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/wizardmachine.hxx b/include/vcl/wizardmachine.hxx
new file mode 100644
index 000000000..a2ce93663
--- /dev/null
+++ b/include/vcl/wizardmachine.hxx
@@ -0,0 +1,356 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_WIZARDMACHINE_HXX
+#define INCLUDED_VCL_WIZARDMACHINE_HXX
+
+#include <memory>
+#include <vcl/dllapi.h>
+#include <vcl/builderpage.hxx>
+
+namespace weld {
+ class Builder;
+ class Container;
+}
+
+struct WizPageData;
+struct ImplWizButtonData;
+
+// wizard states
+#define WZS_INVALID_STATE (::vcl::WizardTypes::WizardState(-1))
+
+namespace vcl
+{
+ //= WizardTypes
+ namespace WizardTypes
+ {
+ typedef sal_Int16 WizardState;
+ enum CommitPageReason
+ {
+ eTravelForward, // traveling forward (maybe with skipping pages)
+ eTravelBackward, // traveling backward (maybe with skipping pages)
+ eFinish, // the wizard is about to be finished
+ eValidate // the data should be validated only, no traveling will happen
+ };
+ };
+
+ class SAL_NO_VTABLE IWizardPageController
+ {
+ public:
+
+ // This methods behave somewhat different than ActivatePage/DeactivatePage
+ // The latter are handled by the base class itself whenever changing the pages is in the offing,
+ // i.e., when it's already decided which page is the next.
+ // We may have situations where the next page depends on the state of the current, which needs
+ // to be committed for this.
+ // So initializePage and commitPage are designated to initializing/committing data on the page.
+ virtual void initializePage() = 0;
+ virtual bool commitPage( WizardTypes::CommitPageReason _eReason ) = 0;
+
+ /** determines whether or not it is allowed to advance to a next page
+
+ You should make this dependent on the current state of the page only, not on
+ states on other pages of the whole dialog.
+
+ The default implementation always returns <TRUE/>.
+ */
+ virtual bool canAdvance() const = 0;
+
+ protected:
+ ~IWizardPageController() {}
+ };
+
+ //= OWizardPage
+ class VCL_DLLPUBLIC OWizardPage : public BuilderPage, public IWizardPageController
+ {
+ public:
+ OWizardPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID);
+ virtual ~OWizardPage() override;
+
+ // IWizardPageController overridables
+ virtual void initializePage() override;
+ virtual bool commitPage( WizardTypes::CommitPageReason _eReason ) override;
+ virtual bool canAdvance() const override;
+
+ protected:
+ // BuilderPage overridables
+ virtual void Activate() override;
+
+ /** updates the travel-related UI elements of the OWizardMachine we live in (if any)
+
+ If the parent of the tab page is an OWizardMachine, then updateTravelUI at this instance
+ is called. Otherwise, nothing happens.
+ */
+ void updateDialogTravelUI();
+ };
+
+ //= OWizardMachine
+ struct WizardMachineImplData;
+ /** implements some kind of finite automata, where the states of the automata exactly correlate
+ with tab pages.
+
+ That is, the machine can have up to n states, where at each point in time exactly one state is
+ the current one. A state being current is represented as one of n tab pages being displayed
+ currently.
+
+ The class handles the UI for traveling between the states (e.g. it administrates the <em>Next</em> and
+ <em>Previous</em> buttons which you usually find in a wizard.
+
+ Derived classes have to implement the travel logic by overriding <member>determineNextState</member>,
+ which has to determine the state which follows the current state. Since this may depend
+ on the actual data presented in the wizard (e.g. checkboxes checked, or something like this),
+ they can implement non-linear traveling this way.
+ */
+ class VCL_DLLPUBLIC WizardMachine : public weld::AssistantController
+ {
+ protected:
+ BuilderPage* m_pCurTabPage;
+ private:
+ WizardTypes::WizardState m_nCurState;
+ WizPageData* m_pFirstPage;
+
+ protected:
+ std::unique_ptr<weld::Button> m_xFinish;
+ std::unique_ptr<weld::Button> m_xCancel;
+ std::unique_ptr<weld::Button> m_xNextPage;
+ std::unique_ptr<weld::Button> m_xPrevPage;
+ std::unique_ptr<weld::Button> m_xHelp;
+
+ private:
+ // hold members in this structure to allow keeping compatible when members are added
+ std::unique_ptr<WizardMachineImplData> m_pImpl;
+
+ public:
+ WizardMachine(weld::Window* _pParent, WizardButtonFlags _nButtonFlags );
+ virtual ~WizardMachine() override;
+
+ bool Finish(short nResult = RET_CANCEL);
+ bool ShowPage(WizardTypes::WizardState nState);
+
+ bool ShowNextPage();
+ bool ShowPrevPage();
+
+ void AddPage( std::unique_ptr<BuilderPage> xPage );
+ void RemovePage( const BuilderPage* pPage );
+ void SetPage( WizardTypes::WizardState nLevel, std::unique_ptr<BuilderPage> xPage );
+ BuilderPage* GetPage( WizardTypes::WizardState eState ) const;
+
+ /// enable (or disable) buttons
+ void enableButtons(WizardButtonFlags _nWizardButtonFlags, bool _bEnable);
+ /// set the default style for a button
+ void defaultButton(WizardButtonFlags _nWizardButtonFlags);
+ /// set the default style for a button
+ void defaultButton(weld::Button* _pNewDefButton);
+
+ /// set the base of the title to use - the title of the current page is appended
+ void setTitleBase(const OUString& _rTitleBase);
+
+ /// determines whether there is a next state to which we can advance
+ virtual bool canAdvance() const;
+
+ /** updates the user interface which deals with traveling in the wizard
+
+ The default implementation simply checks whether both the current page and the wizard
+ itself allow to advance to the next state (<code>canAdvance</code>), and enables the "Next"
+ button if and only if this is the case.
+ */
+ virtual void updateTravelUI();
+
+ protected:
+ virtual void ActivatePage();
+ virtual bool DeactivatePage();
+
+ // our own overridables
+
+ /// to override to create new pages
+ virtual std::unique_ptr<BuilderPage> createPage(WizardTypes::WizardState _nState) = 0;
+
+ /// will be called when a new page is about to be displayed
+ virtual void enterState(WizardTypes::WizardState _nState);
+
+ /** will be called when the current state is about to be left for the given reason
+
+ The base implementation in this class will simply call <member>OWizardPage::commitPage</member>
+ for the current page, and return whatever this call returns.
+
+ @param _eReason
+ The reason why the state is to be left.
+ @return
+ <TRUE/> if and only if the page is allowed to be left
+ */
+ virtual bool prepareLeaveCurrentState( WizardTypes::CommitPageReason eReason );
+
+ /** will be called when the given state is left
+
+ This is the very last possibility for derived classes to veto the deactivation
+ of a page.
+
+ @todo Normally, we would not need the return value here - derived classes now have
+ the possibility to veto page deactivations in <member>prepareLeaveCurrentState</member>. However,
+ changing this return type is too incompatible at the moment ...
+
+ @return
+ <TRUE/> if and only if the page is allowed to be left
+ */
+ virtual bool leaveState(WizardTypes::WizardState nState);
+
+ /** determine the next state to travel from the given one
+
+ The default behaviour is linear traveling, overwrite this to change it
+
+ Return WZS_INVALID_STATE to prevent traveling.
+ */
+ virtual WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const;
+
+ /** called when the finish button is pressed
+ <p>By default, only the base class' Finish method (which is not virtual) is called</p>
+ */
+ virtual bool onFinish();
+
+ /// travel to the next state
+ bool travelNext();
+
+ /// travel to the previous state
+ bool travelPrevious();
+
+ /** enables the automatic enabled/disabled state of the "Next" button
+
+ If this is <TRUE/>, then upon entering a new state, the "Next" button will automatically be
+ enabled if and only if determineNextState does not return WZS_INVALID_STATE.
+ */
+ void enableAutomaticNextButtonState();
+ bool isAutomaticNextButtonStateEnabled() const;
+
+ /** removes a page from the history. Should be called when the page is being disabled
+ */
+ void removePageFromHistory(WizardTypes::WizardState nToRemove);
+
+ /** skip a state
+
+ The method behaves as if from the current state, <arg>_nSteps</arg> <method>travelNext</method>s were
+ called, but without actually creating or displaying the \EDntermediate pages. Only the
+ (<arg>_nSteps</arg> + 1)th page is created.
+
+ The skipped states appear in the state history, so <method>travelPrevious</method> will make use of them.
+
+ A very essential precondition for using this method is that your <method>determineNextState</method>
+ method is able to determine the next state without actually having the page of the current state.
+
+ @see skipUntil
+ @see skipBackwardUntil
+ */
+ void skip();
+
+ /** skips one or more states, until a given state is reached
+
+ The method behaves as if from the current state, <method>travelNext</method>s were called
+ successively, until <arg>_nTargetState</arg> is reached, but without actually creating or
+ displaying the \EDntermediate pages.
+
+ The skipped states appear in the state history, so <method>travelPrevious</method> will make use of them.
+
+ @return
+ <TRUE/> if and only if traveling was successful
+
+ @see skip
+ @see skipBackwardUntil
+ */
+ bool skipUntil(WizardTypes::WizardState nTargetState);
+
+ /** moves back one or more states, until a given state is reached
+
+ This method allows traveling backwards more than one state without actually showing the intermediate
+ states.
+
+ For instance, if you want to travel two steps backward at a time, you could used
+ two travelPrevious calls, but this would <em>show</em> both pages, which is not necessary,
+ since you're interested in the target page only. Using <member>skipBackwardUntil</member> relieves
+ you of this.
+
+ @return
+ <TRUE/> if and only if traveling was successful
+
+ @see skipUntil
+ @see skip
+ */
+ bool skipBackwardUntil(WizardTypes::WizardState nTargetState);
+
+ /** returns the current state of the machine
+
+ Vulgo, this is the identifier of the current tab page :)
+ */
+ WizardTypes::WizardState getCurrentState() const { return m_nCurState; }
+
+ virtual IWizardPageController* getPageController(BuilderPage* pCurrentPage) const;
+
+ /** retrieves a copy of the state history, i.e. all states we already visited
+ */
+ void getStateHistory(std::vector<WizardTypes::WizardState>& out_rHistory);
+
+ public:
+ class AccessGuard
+ {
+ friend class WizardTravelSuspension;
+ private:
+ AccessGuard() { }
+ };
+
+ void suspendTraveling( AccessGuard );
+ void resumeTraveling( AccessGuard );
+ bool isTravelingSuspended() const;
+
+ protected:
+ BuilderPage* GetOrCreatePage(const WizardTypes::WizardState i_nState);
+
+ private:
+ DECL_DLLPRIVATE_LINK(OnNextPage, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(OnPrevPage, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(OnFinish, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(OnCancel, weld::Button&, void);
+
+ VCL_DLLPRIVATE void implUpdateTitle();
+ VCL_DLLPRIVATE void implConstruct( const WizardButtonFlags _nButtonFlags );
+ };
+
+
+ /// helper class to temporarily suspend any traveling in the wizard
+ class WizardTravelSuspension
+ {
+ public:
+ WizardTravelSuspension(WizardMachine& rWizard)
+ : m_pWizard(&rWizard)
+ {
+ m_pWizard->suspendTraveling(WizardMachine::AccessGuard());
+ }
+
+ ~WizardTravelSuspension()
+ {
+ m_pWizard->resumeTraveling(WizardMachine::AccessGuard());
+ }
+
+ private:
+ WizardMachine* m_pWizard;
+ };
+} // namespace vcl
+
+#define WIZARDDIALOG_BUTTON_STDOFFSET_X 6
+#define WIZARDDIALOG_BUTTON_SMALLSTDOFFSET_X 3
+
+#endif // INCLUDED_VCL_WIZARDMACHINE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/wmf.hxx b/include/vcl/wmf.hxx
new file mode 100644
index 000000000..4acc21465
--- /dev/null
+++ b/include/vcl/wmf.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_WMF_HXX
+#define INCLUDED_VCL_WMF_HXX
+
+#include <vcl/dllapi.h>
+
+class FilterConfigItem;
+class GDIMetaFile;
+class SvStream;
+class Graphic;
+
+VCL_DLLPUBLIC bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF );
+
+VCL_DLLPUBLIC bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem const * pConfigItem, bool bPlaceable = true );
+VCL_DLLPUBLIC bool ConvertGraphicToWMF( const Graphic & rGraphic, SvStream & rTargetStream, FilterConfigItem const * pConfigItem, bool bPlaceable = true );
+
+bool ConvertGDIMetaFileToEMF(const GDIMetaFile & rMTF, SvStream & rTargetStream);
+
+VCL_DLLPUBLIC bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/wmfexternal.hxx b/include/vcl/wmfexternal.hxx
new file mode 100644
index 000000000..fcff240a5
--- /dev/null
+++ b/include/vcl/wmfexternal.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_WMFEXTERNAL_HXX
+#define INCLUDED_VCL_WMFEXTERNAL_HXX
+
+#include <vcl/dllapi.h>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace com::sun::star::beans
+{
+struct PropertyValue;
+}
+
+struct VCL_DLLPUBLIC WmfExternal
+{
+ sal_uInt16 xExt;
+ sal_uInt16 yExt;
+
+ /** One of the following values:
+ <ul>
+ <li>MM_TEXT</li>
+ <li>MM_LOMETRIC</li>
+ <li>MM_HIMETRIC</li>
+ <li>MM_LOENGLISH</li>
+ <li>MM_HIENGLISH</li>
+ <li>MM_TWIPS</li>
+ <li>MM_ISOTROPIC</li>
+ <li>MM_ANISOTROPIC</li>
+ </ul>
+ If this value is 0, then no external mapmode has been defined,
+ the internal one should then be used.
+ */
+ sal_uInt16 mapMode;
+
+ WmfExternal();
+ css::uno::Sequence<css::beans::PropertyValue> getSequence() const;
+ bool setSequence(const css::uno::Sequence<css::beans::PropertyValue>& rSequence);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/wrkwin.hxx b/include/vcl/wrkwin.hxx
new file mode 100644
index 000000000..dfc6cc1b3
--- /dev/null
+++ b/include/vcl/wrkwin.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_WRKWIN_HXX
+#define INCLUDED_VCL_WRKWIN_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/syswin.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace com::sun::star::uno { class Any; }
+struct SystemParentData;
+
+
+// Presentation Flags
+enum class PresentationFlags
+{
+ NONE = 0x0000,
+ HideAllApps = 0x0001,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<PresentationFlags> : is_typed_flags<PresentationFlags, 0x0001> {};
+}
+
+
+class VCL_DLLPUBLIC WorkWindow : public SystemWindow
+{
+private:
+ PresentationFlags mnPresentationFlags;
+ bool mbPresentationMode:1,
+ mbPresentationVisible:1,
+ mbPresentationFull:1,
+ mbFullScreenMode:1;
+
+ SAL_DLLPRIVATE void ImplInitWorkWindowData();
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, const css::uno::Any& aSystemWorkWindowToken );
+
+private:
+ WorkWindow( const WorkWindow& rWin ) = delete;
+ WorkWindow& operator =( const WorkWindow& rWin ) = delete;
+
+protected:
+ explicit WorkWindow( WindowType nType );
+ SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData = nullptr );
+ SAL_DLLPRIVATE void ImplSetFrameState( WindowStateState aFrameState );
+
+public:
+ explicit WorkWindow( vcl::Window* pParent, WinBits nStyle = WB_STDWORK );
+ explicit WorkWindow( vcl::Window* pParent, const css::uno::Any& aSystemWorkWindowToken, WinBits nStyle = WB_STDWORK );
+ explicit WorkWindow( SystemParentData* pParent ); // Not in the REMOTE-Version
+ virtual ~WorkWindow() override;
+ virtual void dispose() override;
+
+ virtual bool Close() override;
+
+ void ShowFullScreenMode( bool bFullScreenMode,
+ sal_Int32 nDisplayScreen );
+ /**
+ @overload void ShowFullScreenMode(bool bFullScreenMode, sal_Int32 nDisplayScreen)
+ */
+ void ShowFullScreenMode( bool bFullScreenMode );
+ bool IsFullScreenMode() const { return mbFullScreenMode; }
+
+ void StartPresentationMode( bool bPresentation,
+ PresentationFlags nFlags,
+ sal_Int32 nDisplayScreen );
+ /**
+ @overload void StartPresentationMode( PresentationFlags nFlags, sal_uInt32 nDisplayScreen)
+ */
+ void StartPresentationMode( PresentationFlags nFlags );
+ bool IsPresentationMode() const { return mbPresentationMode; }
+
+ bool IsMinimized() const;
+
+ void SetPluginParent( SystemParentData* pParent );
+
+ void Minimize();
+ void Restore();
+
+ void Maximize( bool bMaximize = true );
+ bool IsMaximized() const;
+};
+
+#endif // INCLUDED_VCL_WRKWIN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/xtextedt.hxx b/include/vcl/xtextedt.hxx
new file mode 100644
index 000000000..d9e06ddd8
--- /dev/null
+++ b/include/vcl/xtextedt.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_VCL_XTEXTEDT_HXX
+#define INCLUDED_VCL_XTEXTEDT_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/texteng.hxx>
+
+namespace i18nutil { struct SearchOptions; }
+
+class VCL_DLLPUBLIC ExtTextEngine final : public TextEngine
+{
+public:
+ ExtTextEngine();
+ virtual ~ExtTextEngine() override;
+
+ TextSelection MatchGroup( const TextPaM& rCursor ) const;
+ bool Search( TextSelection& rSel, const i18nutil::SearchOptions& rSearchOptions, bool bForward = true ) const;
+};
+
+#endif // INCLUDED_VCL_XTEXTEDT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/version.hrc b/include/version.hrc
new file mode 100644
index 000000000..787e7ca18
--- /dev/null
+++ b/include/version.hrc
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <config_version.h>
+
+#define VERSION LIBO_VERSION_MAJOR
+#define SUBVERSION LIBO_VERSION_MINOR
+#define MICROVERSION LIBO_VERSION_MICRO
+#define VER_YEARRANGE 2000-LIBO_THIS_YEAR
+
+#include <winver.h>
+
+#ifndef PPSX
+#define PPSX(s) #s
+#endif
+#ifndef PPS
+#define PPS(s) PPSX(s)
+#endif
+
+#define VER_LEVEL VERSION.SUBVERSION.MICROVERSION.VERVARIANT
+
+#define VERC(a) Copyright \251 a by
+
+#define S_CRIGHT PPS(VERC(VER_YEARRANGE))
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/DashStyle.hxx b/include/xmloff/DashStyle.hxx
new file mode 100644
index 000000000..c27234124
--- /dev/null
+++ b/include/xmloff/DashStyle.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_DASHSTYLE_HXX
+#define INCLUDED_XMLOFF_DASHSTYLE_HXX
+
+#include <rtl/ustring.hxx>
+#include <xmloff/dllapi.h>
+
+class SvXMLImport;
+class SvXMLExport;
+namespace com::sun::star {
+ namespace uno { template<class A> class Reference; }
+ namespace xml::sax { class XFastAttributeList; }
+ namespace uno { class Any; }
+}
+
+
+class XMLOFF_DLLPUBLIC XMLDashStyleImport
+{
+ SvXMLImport& rImport;
+
+public:
+ XMLDashStyleImport( SvXMLImport& rImport );
+
+ void importXML(
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ css::uno::Any& rValue,
+ OUString& rStrName );
+};
+
+
+class XMLOFF_DLLPUBLIC XMLDashStyleExport
+{
+ SvXMLExport& rExport;
+
+public:
+ XMLDashStyleExport( SvXMLExport& rExport );
+
+ void exportXML( const OUString& rStrName,
+ const css::uno::Any& rValue );
+};
+
+#endif // INCLUDED_XMLOFF_DASHSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/DocumentSettingsContext.hxx b/include/xmloff/DocumentSettingsContext.hxx
new file mode 100644
index 000000000..130da3814
--- /dev/null
+++ b/include/xmloff/DocumentSettingsContext.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_DOCUMENTSETTINGSCONTEXT_HXX
+#define INCLUDED_XMLOFF_DOCUMENTSETTINGSCONTEXT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <xmloff/xmlictxt.hxx>
+
+#include <vector>
+
+struct XMLDocumentSettingsContext_Data;
+
+class XMLOFF_DLLPUBLIC XMLDocumentSettingsContext final : public SvXMLImportContext
+{
+ struct SettingsGroup
+ {
+ OUString sGroupName;
+ css::uno::Any aSettings;
+ };
+ css::uno::Any maViewProps;
+ css::uno::Any maConfigProps;
+ ::std::vector< SettingsGroup > maDocSpecificSettings;
+
+public:
+ XMLDocumentSettingsContext(SvXMLImport& rImport);
+ virtual ~XMLDocumentSettingsContext() override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+
+ virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
+
+private:
+ XMLDocumentSettingsContext( const XMLDocumentSettingsContext& ) = delete;
+ XMLDocumentSettingsContext& operator=( const XMLDocumentSettingsContext& ) = delete;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/EnumPropertyHdl.hxx b/include/xmloff/EnumPropertyHdl.hxx
new file mode 100644
index 000000000..7256dd69f
--- /dev/null
+++ b/include/xmloff/EnumPropertyHdl.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_ENUMPROPERTYHDL_HXX
+#define INCLUDED_XMLOFF_ENUMPROPERTYHDL_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+#include <cppu/unotype.hxx>
+
+template <typename EnumT> struct SvXMLEnumMapEntry;
+
+/**
+ PropertyHandler for a generic xml enumeration type:
+*/
+class XMLOFF_DLLPUBLIC XMLEnumPropertyHdl : public XMLPropertyHandler
+{
+private:
+ const SvXMLEnumMapEntry<sal_uInt16>* mpEnumMap;
+ const css::uno::Type & mrType;
+
+public:
+ template<typename EnumT>
+ XMLEnumPropertyHdl( const SvXMLEnumMapEntry<EnumT>* pEnumMap)
+ : mpEnumMap( reinterpret_cast<const SvXMLEnumMapEntry<sal_uInt16>*>(pEnumMap) ), mrType( ::cppu::UnoType<EnumT>::get() ) {}
+ virtual ~XMLEnumPropertyHdl() override;
+
+ virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
+ virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
+};
+
+#endif // INCLUDED_XMLOFF_ENUMPROPERTYHDL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/GradientStyle.hxx b/include/xmloff/GradientStyle.hxx
new file mode 100644
index 000000000..db946279a
--- /dev/null
+++ b/include/xmloff/GradientStyle.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_GRADIENTSTYLE_HXX
+#define INCLUDED_XMLOFF_GRADIENTSTYLE_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+
+class SvXMLImport;
+class SvXMLExport;
+namespace com::sun::star {
+ namespace uno { template<class A> class Reference; }
+ namespace xml::sax { class XFastAttributeList; }
+ namespace uno { class Any; }
+}
+
+
+class XMLOFF_DLLPUBLIC XMLGradientStyleImport
+{
+ SvXMLImport& rImport;
+
+public:
+ XMLGradientStyleImport( SvXMLImport& rImport );
+
+ void importXML(
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ css::uno::Any& rValue,
+ OUString& rStrName );
+};
+
+
+class XMLOFF_DLLPUBLIC XMLGradientStyleExport
+{
+ SvXMLExport& rExport;
+
+public:
+ XMLGradientStyleExport( SvXMLExport& rExport );
+
+ void exportXML(
+ const OUString& rStrName,
+ const css::uno::Any& rValue );
+};
+
+#endif // INCLUDED_XMLOFF_GRADIENTSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/HatchStyle.hxx b/include/xmloff/HatchStyle.hxx
new file mode 100644
index 000000000..9ded654e5
--- /dev/null
+++ b/include/xmloff/HatchStyle.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_HATCHSTYLE_HXX
+#define INCLUDED_XMLOFF_HATCHSTYLE_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+
+class SvXMLImport;
+class SvXMLExport;
+namespace com::sun::star {
+ namespace uno { template<class A> class Reference; }
+ namespace xml::sax { class XFastAttributeList; }
+ namespace uno { class Any; }
+}
+
+
+class XMLOFF_DLLPUBLIC XMLHatchStyleImport
+{
+ SvXMLImport& rImport;
+
+public:
+ XMLHatchStyleImport( SvXMLImport& rImport );
+
+ void importXML(
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
+ css::uno::Any& rValue,
+ OUString& rStrName );
+};
+
+class XMLOFF_DLLPUBLIC XMLHatchStyleExport
+{
+ SvXMLExport& rExport;
+
+public:
+ XMLHatchStyleExport( SvXMLExport& rExport );
+
+ void exportXML( const OUString& rStrName, const css::uno::Any& rValue );
+};
+
+#endif // _XMLOFF_HATCHELEMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/ImageStyle.hxx b/include/xmloff/ImageStyle.hxx
new file mode 100644
index 000000000..15b1a845a
--- /dev/null
+++ b/include/xmloff/ImageStyle.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_IMAGESTYLE_HXX
+#define INCLUDED_XMLOFF_IMAGESTYLE_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::uno { class Any; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace com::sun::star::xml::sax { class XFastAttributeList; }
+
+class SvXMLExport;
+class SvXMLImport;
+
+namespace XMLImageStyle
+{
+
+XMLOFF_DLLPUBLIC void exportXML(OUString const & rStrName, css::uno::Any const & rValue, SvXMLExport& rExport);
+XMLOFF_DLLPUBLIC bool importXML(css::uno::Reference<css::xml::sax::XFastAttributeList> const & xAttrList,
+ css::uno::Any& rValue, OUString& rStrName, SvXMLImport& rImport);
+
+}
+
+#endif // INCLUDED_XMLOFF_IMAGESTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/MarkerStyle.hxx b/include/xmloff/MarkerStyle.hxx
new file mode 100644
index 000000000..ce1ae3080
--- /dev/null
+++ b/include/xmloff/MarkerStyle.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_MARKERSTYLE_HXX
+#define INCLUDED_XMLOFF_MARKERSTYLE_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+
+class SvXMLImport;
+class SvXMLExport;
+namespace com::sun::star {
+ namespace uno { template<class A> class Reference; }
+ namespace xml::sax { class XFastAttributeList; }
+ namespace uno { class Any; }
+}
+
+
+class XMLOFF_DLLPUBLIC XMLMarkerStyleImport
+{
+ SvXMLImport& rImport;
+
+public:
+ XMLMarkerStyleImport( SvXMLImport& rImport );
+
+ void importXML(
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ css::uno::Any& rValue,
+ OUString& rStrName );
+};
+
+class XMLOFF_DLLPUBLIC XMLMarkerStyleExport
+{
+ SvXMLExport& rExport;
+
+public:
+ XMLMarkerStyleExport( SvXMLExport& rExport );
+
+ void exportXML(
+ const OUString& rStrName,
+ const css::uno::Any& rValue );
+};
+
+#endif // INCLUDED_XMLOFF_MARKERSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/NamedBoolPropertyHdl.hxx b/include/xmloff/NamedBoolPropertyHdl.hxx
new file mode 100644
index 000000000..b5fba6722
--- /dev/null
+++ b/include/xmloff/NamedBoolPropertyHdl.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_NAMEDBOOLPROPERTYHDL_HXX
+#define INCLUDED_XMLOFF_NAMEDBOOLPROPERTYHDL_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+
+/**
+ PropertyHandler for a named xml bool type:
+*/
+class XMLOFF_DLLPUBLIC XMLNamedBoolPropertyHdl final : public XMLPropertyHandler
+{
+private:
+ const OUString maTrueStr;
+ const OUString maFalseStr;
+
+public:
+ XMLNamedBoolPropertyHdl( const OUString& rTrueStr, const OUString& rFalseStr ) : maTrueStr( rTrueStr ), maFalseStr( rFalseStr ) {}
+
+ XMLNamedBoolPropertyHdl(
+ ::xmloff::token::XMLTokenEnum eTrue,
+ ::xmloff::token::XMLTokenEnum eFalse
+ ) :
+ maTrueStr( ::xmloff::token::GetXMLToken( eTrue ) ),
+ maFalseStr( ::xmloff::token::GetXMLToken( eFalse ) )
+ {}
+
+ virtual ~XMLNamedBoolPropertyHdl() override;
+
+ virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
+ virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
+};
+
+#endif // INCLUDED_XMLOFF_NAMEDBOOLPROPERTYHDL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/ProgressBarHelper.hxx b/include/xmloff/ProgressBarHelper.hxx
new file mode 100644
index 000000000..7fe92ab9b
--- /dev/null
+++ b/include/xmloff/ProgressBarHelper.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_PROGRESSBARHELPER_HXX
+#define INCLUDED_XMLOFF_PROGRESSBARHELPER_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+
+inline constexpr OUStringLiteral XML_PROGRESSRANGE = u"ProgressRange";
+inline constexpr OUStringLiteral XML_PROGRESSMAX = u"ProgressMax";
+inline constexpr OUStringLiteral XML_PROGRESSCURRENT = u"ProgressCurrent";
+inline constexpr OUStringLiteral XML_PROGRESSREPEAT = u"ProgressRepeat";
+
+class XMLOFF_DLLPUBLIC ProgressBarHelper
+{
+ css::uno::Reference < css::task::XStatusIndicator > xStatusIndicator;
+ sal_Int32 nRange;
+ sal_Int32 nReference;
+ sal_Int32 nValue;
+ double fOldPercent;
+ bool bStrict;
+ // #96469#; if the value goes over the Range the progressbar starts again
+ bool bRepeat;
+
+#ifdef DBG_UTIL
+ bool bFailure;
+#endif
+public:
+ ProgressBarHelper(const css::uno::Reference < css::task::XStatusIndicator>& xStatusIndicator,
+ const bool bStrict);
+ ~ProgressBarHelper();
+
+ void SetRange(sal_Int32 nVal) { nRange = nVal; }
+ void SetReference(sal_Int32 nVal) { nReference = nVal; }
+ void SetValue(sal_Int32 nValue);
+ void SetRepeat(bool bValue) { bRepeat = bValue; }
+ void Increment(sal_Int32 nInc = 1) { SetValue( nValue+nInc ); }
+ void End() { if (xStatusIndicator.is()) xStatusIndicator->end(); }
+
+ // set the new reference and returns the new value which gives the
+ // Progress Bar the same position as before
+ void ChangeReference(sal_Int32 nNewReference);
+
+ sal_Int32 GetReference() const { return nReference; }
+ sal_Int32 GetValue() const { return nValue; }
+ bool GetRepeat() const { return bRepeat; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/SchXMLExportHelper.hxx b/include/xmloff/SchXMLExportHelper.hxx
new file mode 100644
index 000000000..6043a03ea
--- /dev/null
+++ b/include/xmloff/SchXMLExportHelper.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_SCHXMLEXPORTHELPER_HXX
+#define INCLUDED_XMLOFF_SCHXMLEXPORTHELPER_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+#include <memory>
+
+class SvXMLAutoStylePoolP;
+class SvXMLExport;
+class SchXMLExportHelper_Impl;
+
+/** With this class you can export a <chart:chart> element containing
+ its data as <table:table> element or without internal table. In
+ the latter case you have to provide a table address mapper if the
+ cell addressing set at the document is not in XML format.
+ */
+class XMLOFF_DLLPUBLIC SchXMLExportHelper final : public salhelper::SimpleReferenceObject
+{
+public:
+ SchXMLExportHelper(SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool);
+
+ virtual ~SchXMLExportHelper() override;
+
+ /// returns the string corresponding to the current FileFormat CLSID for Chart
+ const OUString& getChartCLSID() const;
+
+ void SetSourceShellID(const OUString& rShellID);
+ void SetDestinationShellID(const OUString& rShellID);
+
+private:
+ SchXMLExportHelper(SchXMLExportHelper const&) = delete;
+ SchXMLExportHelper& operator=(SchXMLExportHelper const&) = delete;
+
+private:
+ std::unique_ptr<SchXMLExportHelper_Impl> m_pImpl;
+ friend class SchXMLExport;
+};
+
+#endif // INCLUDED_XMLOFF_SCHXMLEXPORTHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/SchXMLImportHelper.hxx b/include/xmloff/SchXMLImportHelper.hxx
new file mode 100644
index 000000000..446b07387
--- /dev/null
+++ b/include/xmloff/SchXMLImportHelper.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
+#define INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <xmloff/dllapi.h>
+#include <xmloff/families.hxx>
+
+namespace com::sun::star::chart { class XChartDocument; }
+namespace com::sun::star::beans { class XPropertySet; }
+
+namespace com::sun::star {
+ namespace frame {
+ class XModel;
+ }
+ namespace xml {
+ namespace sax {
+ class XAttributeList;
+ }
+ }
+ namespace chart2 {
+ class XChartDocument;
+ class XDataSeries;
+ }
+}
+
+class SvXMLStylesContext;
+class SvXMLImportContext;
+class SvXMLImport;
+
+
+/** With this class you can import a <chart:chart> element containing
+ its data as <table:table> element or without internal table. In
+ the latter case you have to provide a table address mapper that
+ converts table addresses in XML format to the appropriate application
+ format.
+ */
+class SchXMLImportHelper final : public salhelper::SimpleReferenceObject
+{
+private:
+ css::uno::Reference< css::chart::XChartDocument > mxChartDoc;
+ SvXMLStylesContext* mpAutoStyles;
+
+public:
+
+ SchXMLImportHelper();
+
+ /** get the context for reading the <chart:chart> element with subelements.
+ The result is stored in the XModel given if it also implements
+ XChartDocument
+ */
+ SvXMLImportContext* CreateChartContext(
+ SvXMLImport& rImport,
+ const css::uno::Reference< css::frame::XModel >& rChartModel );
+
+ /** set the auto-style context that will be used to retrieve auto-styles
+ used inside the following <chart:chart> element to parse
+ */
+ void SetAutoStylesContext( SvXMLStylesContext* pAutoStyles ) { mpAutoStyles = pAutoStyles; }
+ SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStyles; }
+
+ /// Fill in the autostyle.
+ void FillAutoStyle(const OUString& rAutoStyleName, const css::uno::Reference<css::beans::XPropertySet>& rProp);
+
+ const css::uno::Reference< css::chart::XChartDocument >& GetChartDocument() const
+ { return mxChartDoc; }
+
+ static XmlStyleFamily GetChartFamilyID() { return XmlStyleFamily::SCH_CHART_ID; }
+
+ /** @param bPushLastChartType If </sal_False>, in case a new chart type has to
+ be added (because it does not exist yet), it is appended at the
+ end of the chart-type container. When </sal_True>, a new chart type
+ is added at one position before the last one, i.e. the formerly
+ last chart type is pushed back, so that it remains the last one.
+
+ This is needed when the global chart type is set to type A, but
+ the first series has type B. Then B should appear before A (done
+ by passing true). Once a series of type A has been read,
+ following new chart types are again be added at the end (by
+ passing false).
+ */
+ static css::uno::Reference< css::chart2::XDataSeries > GetNewDataSeries(
+ const css::uno::Reference< css::chart2::XChartDocument > & xDoc,
+ sal_Int32 nCoordinateSystemIndex,
+ const OUString & rChartTypeName,
+ bool bPushLastChartType );
+
+ static void DeleteDataSeries(
+ const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+ const css::uno::Reference< css::chart2::XChartDocument > & xDoc );
+};
+
+XMLOFF_DLLPUBLIC void setDataProvider(css::uno::Reference<css::chart2::XChartDocument> const & xChartDoc, OUString const & sDataPilotSource);
+
+#endif // INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/SchXMLSeriesHelper.hxx b/include/xmloff/SchXMLSeriesHelper.hxx
new file mode 100644
index 000000000..78c729306
--- /dev/null
+++ b/include/xmloff/SchXMLSeriesHelper.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_SCHXMLSERIESHELPER_HXX
+#define INCLUDED_XMLOFF_SCHXMLSERIESHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <xmloff/dllapi.h>
+
+#include <vector>
+#include <map>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::chart2 { class XDataSeries; }
+namespace com::sun::star::chart2 { class XDiagram; }
+namespace com::sun::star::frame { class XModel; }
+
+class XMLOFF_DLLPUBLIC SchXMLSeriesHelper
+{
+public:
+ static ::std::vector< css::uno::Reference< css::chart2::XDataSeries > >
+ getDataSeriesFromDiagram(
+ const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
+ static ::std::map< css::uno::Reference< css::chart2::XDataSeries >, sal_Int32 >
+ getDataSeriesIndexMapFromDiagram(
+ const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
+
+ static bool isCandleStickSeries(
+ const css::uno::Reference< css::chart2::XDataSeries >& xSeries
+ , const css::uno::Reference< css::frame::XModel >& xChartModel );
+
+ static css::uno::Reference< css::beans::XPropertySet > createOldAPISeriesPropertySet(
+ const css::uno::Reference< css::chart2::XDataSeries >& xSeries
+ , const css::uno::Reference< css::frame::XModel >& xChartModel );
+
+ static css::uno::Reference< css::beans::XPropertySet > createOldAPIDataPointPropertySet(
+ const css::uno::Reference< css::chart2::XDataSeries >& xSeries
+ , sal_Int32 nPointIndex
+ , const css::uno::Reference< css::frame::XModel >& xChartModel );
+};
+
+// INCLUDED_XMLOFF_SCHXMLSERIESHELPER_HXX
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/SettingsExportHelper.hxx b/include/xmloff/SettingsExportHelper.hxx
new file mode 100644
index 000000000..0ee9f3ea4
--- /dev/null
+++ b/include/xmloff/SettingsExportHelper.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_SETTINGSEXPORTHELPER_HXX
+#define INCLUDED_XMLOFF_SETTINGSEXPORTHELPER_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <xmloff/dllapi.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::formula { struct SymbolDescriptor; }
+namespace com::sun::star::util { class XStringSubstitution; }
+
+namespace com
+{
+ namespace sun::star {
+ namespace container { class XNameAccess; class XIndexAccess; }
+ namespace util { struct DateTime; }
+ }
+}
+
+namespace xmloff
+{
+ class XMLSettingsExportContext;
+}
+
+class XMLOFF_DLLPUBLIC XMLSettingsExportHelper
+{
+ ::xmloff::XMLSettingsExportContext& m_rContext;
+
+ css::uno::Reference< css::util::XStringSubstitution > mxStringSubstitution;
+
+ void ManipulateSetting( css::uno::Any& rAny, std::u16string_view rName ) const;
+
+ void CallTypeFunction(const css::uno::Any& rAny,
+ const OUString& rName) const;
+
+ void exportBool(const bool bValue, const OUString& rName) const;
+ static void exportByte();
+ void exportShort(const sal_Int16 nValue, const OUString& rName) const;
+ void exportInt(const sal_Int32 nValue, const OUString& rName) const;
+ void exportLong(const sal_Int64 nValue, const OUString& rName) const;
+ void exportDouble(const double fValue, const OUString& rName) const;
+ void exportString(const OUString& sValue, const OUString& rName) const;
+ void exportDateTime(const css::util::DateTime& aValue, const OUString& rName) const;
+ void exportSequencePropertyValue(
+ const css::uno::Sequence<css::beans::PropertyValue>& aProps,
+ const OUString& rName) const;
+ void exportbase64Binary(
+ const css::uno::Sequence<sal_Int8>& aProps,
+ const OUString& rName) const;
+ void exportMapEntry(const css::uno::Any& rAny,
+ const OUString& rName,
+ const bool bNameAccess) const;
+ void exportNameAccess(
+ const css::uno::Reference<css::container::XNameAccess>& rNamed,
+ const OUString& rName) const;
+ void exportIndexAccess(
+ const css::uno::Reference<css::container::XIndexAccess>& rIndexed,
+ const OUString& rName) const;
+
+ void exportSymbolDescriptors(
+ const css::uno::Sequence < css::formula::SymbolDescriptor > &rProps,
+ const OUString& rName) const;
+ void exportForbiddenCharacters(
+ const css::uno::Any &rAny,
+ const OUString& rName) const;
+
+public:
+ XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext );
+ ~XMLSettingsExportHelper();
+
+ void exportAllSettings(
+ const css::uno::Sequence<css::beans::PropertyValue>& aProps,
+ const OUString& rName) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/SinglePropertySetInfoCache.hxx b/include/xmloff/SinglePropertySetInfoCache.hxx
new file mode 100644
index 000000000..0377c46bb
--- /dev/null
+++ b/include/xmloff/SinglePropertySetInfoCache.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_SINGLEPROPERTYSETINFOCACHE_HXX
+#define INCLUDED_XMLOFF_SINGLEPROPERTYSETINFOCACHE_HXX
+
+#include <sal/config.h>
+
+#include <map>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::beans { class XPropertySetInfo; }
+
+class SinglePropertySetInfoCache
+{
+ typedef std::map<css::uno::Reference<css::beans::XPropertySetInfo>, bool>
+ Map;
+
+ OUString sName;
+ Map map_;
+
+public:
+
+ inline SinglePropertySetInfoCache( const OUString& rName );
+
+ bool hasProperty(
+ const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
+ css::uno::Reference< css::beans::XPropertySetInfo >& rPropSetInfo );
+
+ inline bool hasProperty(
+ const css::uno::Reference< css::beans::XPropertySet>& rPropSet );
+};
+
+inline SinglePropertySetInfoCache::SinglePropertySetInfoCache(
+ const OUString& rName ) :
+ sName( rName )
+{
+}
+
+inline bool SinglePropertySetInfoCache::hasProperty(
+ const css::uno::Reference< css::beans::XPropertySet>& rPropSet )
+{
+ css::uno::Reference< css::beans::XPropertySetInfo > xInfo;
+ return hasProperty( rPropSet, xInfo );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLBase64ImportContext.hxx b/include/xmloff/XMLBase64ImportContext.hxx
new file mode 100644
index 000000000..e2b62abea
--- /dev/null
+++ b/include/xmloff/XMLBase64ImportContext.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLBASE64IMPORTCONTEXT_HXX
+#define INCLUDED_XMLOFF_XMLBASE64IMPORTCONTEXT_HXX
+
+#include <sal/config.h>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/dllapi.h>
+#include <xmloff/xmlictxt.hxx>
+
+namespace com::sun::star::xml::sax { class XAttributeList; }
+namespace com::sun::star::io { class XOutputStream; }
+
+class XMLOFF_DLLPUBLIC XMLBase64ImportContext final : public SvXMLImportContext
+{
+ css::uno::Reference< css::io::XOutputStream > xOut;
+ OUStringBuffer maCharBuffer;
+
+public:
+
+ XMLBase64ImportContext( SvXMLImport& rImport,
+ const css::uno::Reference< css::io::XOutputStream >& rOut );
+
+ virtual ~XMLBase64ImportContext() override;
+
+ virtual void SAL_CALL endFastElement(sal_Int32) override;
+ virtual void SAL_CALL characters( const OUString& rChars ) override;
+};
+
+#endif // INCLUDED_XMLOFF_XMLBASE64IMPORTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLCharContext.hxx b/include/xmloff/XMLCharContext.hxx
new file mode 100644
index 000000000..dd63a83fc
--- /dev/null
+++ b/include/xmloff/XMLCharContext.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_XMLCHARCONTEXT_HXX
+#define INCLUDED_XMLOFF_XMLCHARCONTEXT_HXX
+
+#include <xmloff/dllapi.h>
+#include <xmloff/xmlictxt.hxx>
+
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+class XMLOFF_DLLPUBLIC XMLCharContext : public SvXMLImportContext
+{
+ XMLCharContext(const XMLCharContext&) = delete;
+ void operator =(const XMLCharContext&) = delete;
+ sal_Int16 m_nControl;
+protected:
+ sal_uInt16 m_nCount;
+ sal_Unicode m_c;
+public:
+
+ XMLCharContext(
+ SvXMLImport& rImport,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
+ sal_Unicode c,
+ bool bCount );
+ XMLCharContext(
+ SvXMLImport& rImport,
+ sal_Int16 nControl );
+
+ virtual ~XMLCharContext() override;
+
+ // EndElement is called before a context will be destructed, but
+ // after an elements context has been parsed. It may be used for actions
+ // that require virtual methods. The default is to do nothing.
+ virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
+
+ virtual void InsertControlCharacter(sal_Int16 _nControl);
+ virtual void InsertString(const OUString& _sString);
+};
+
+#endif // INCLUDED_XMLOFF_XMLCHARCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLConstantsPropertyHandler.hxx b/include/xmloff/XMLConstantsPropertyHandler.hxx
new file mode 100644
index 000000000..5db0aa63f
--- /dev/null
+++ b/include/xmloff/XMLConstantsPropertyHandler.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX
+#define INCLUDED_XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <xmloff/xmlprhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+
+template<typename EnumT>
+struct SvXMLEnumMapEntry;
+
+
+/** Abstract base-class for different XML-types. Derivations of this class
+ knows how to compare, im/export a special XML-type
+*/
+class XMLOFF_DLLPUBLIC XMLConstantsPropertyHandler: public XMLPropertyHandler
+{
+ const SvXMLEnumMapEntry<sal_uInt16> *pMap;
+ const enum ::xmloff::token::XMLTokenEnum eDefault;
+
+public:
+ template<typename EnumT>
+ XMLConstantsPropertyHandler( const SvXMLEnumMapEntry<EnumT> *pM,
+ enum ::xmloff::token::XMLTokenEnum eDflt)
+ : pMap(reinterpret_cast<const SvXMLEnumMapEntry<sal_uInt16>*>(pM)), eDefault(eDflt) {}
+
+ // Just needed for virtual destruction
+ virtual ~XMLConstantsPropertyHandler() override;
+
+ /// Imports the given value in case of the given XML-data-type
+ virtual bool importXML(
+ const OUString& rStrImpValue,
+ css::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const override;
+
+ /// Exports the given value in case of the given XML-data-type
+ virtual bool exportXML(
+ OUString& rStrExpValue,
+ const css::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const override;
+};
+
+#endif // INCLUDED_XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLDrawingPageStyleContext.hxx b/include/xmloff/XMLDrawingPageStyleContext.hxx
new file mode 100644
index 000000000..9ef8d060b
--- /dev/null
+++ b/include/xmloff/XMLDrawingPageStyleContext.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <xmloff/prstylei.hxx>
+#include <xmloff/xmlimppr.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/dllapi.h>
+
+class XMLOFF_DLLPUBLIC XMLDrawingPageStyleContext : public XMLPropStyleContext
+{
+public:
+ XMLDrawingPageStyleContext(SvXMLImport& rImport, SvXMLStylesContext& rStyles,
+ ContextID_Index_Pair const pContextIDs[],
+ XmlStyleFamily const pFamilies[]);
+
+ virtual void
+ FillPropertySet(css::uno::Reference<css::beans::XPropertySet> const& rPropSet) override;
+
+private:
+ std::unique_ptr<ContextID_Index_Pair[]> m_pContextIDs;
+ XmlStyleFamily const* const m_pFamilies;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLEventExport.hxx b/include/xmloff/XMLEventExport.hxx
new file mode 100644
index 000000000..ad83390b6
--- /dev/null
+++ b/include/xmloff/XMLEventExport.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLEVENTEXPORT_HXX
+#define INCLUDED_XMLOFF_XMLEVENTEXPORT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <xmloff/xmlevent.hxx>
+
+#include <map>
+#include <memory>
+
+class SvXMLExport;
+namespace com::sun::star {
+ namespace document { class XEventsSupplier; }
+ namespace container { class XNameReplace; }
+ namespace container { class XNameAccess; }
+ namespace beans { struct PropertyValue; }
+}
+
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+
+typedef ::std::map< OUString, std::unique_ptr<XMLEventExportHandler> > HandlerMap;
+typedef ::std::map< OUString, XMLEventName > NameMap;
+
+/**
+ * Export instances of EventsSupplier services. To use this class you
+ * must fulfill two conditions:
+ *
+ * 1) provide a translation from the API event names to XML event
+ * names
+ * 2) Register XMLEventExportHandler instances for all script types
+ * that you would like to export.
+ *
+ * The Export()-Methods all have a bUseWhitespace parameter that
+ * causes the exported elements to be surrounded by whitespace, which
+ * in turn causes the elements to be indented properly. By default,
+ * whitespace is used, but it may not be called for in all cases (e.g
+ * events attached to hyperlink within a paragraph.)
+ */
+class XMLOFF_DLLPUBLIC XMLEventExport
+{
+ SvXMLExport& rExport;
+
+ HandlerMap aHandlerMap;
+ NameMap aNameTranslationMap;
+
+ bool bExtNamespace;
+
+public:
+ XMLEventExport(SvXMLExport& rExport);
+ ~XMLEventExport();
+
+ XMLEventExport& operator=( XMLEventExport const & ) = delete; // MSVC2017 workaround
+ XMLEventExport( XMLEventExport const & ) = delete; // MSVC2017 workaround
+
+ /// register an EventExportHandler for a particular script type
+ ///
+ /// The handlers will be deleted when the object is destroyed, hence
+ /// no pointers to a handler registered with AddHandler() should be
+ /// held by anyone.
+ void AddHandler( const OUString& rName,
+ std::unique_ptr<XMLEventExportHandler> pHandler );
+
+ /// register additional event names
+ void AddTranslationTable( const XMLEventNameTranslation* pTransTable );
+
+ /// export the events (calls EventExport::Export(Reference<XNameAccess>) )
+ void Export( css::uno::Reference<css::document::XEventsSupplier> const & xAccess,
+ bool bUseWhitespace = true);
+
+ /// export the events (calls EventExport::Export(Reference<XNameAccess>) )
+ void Export( css::uno::Reference<css::container::XNameReplace> const & xAccess,
+ bool bUseWhitespace = true);
+
+ /// export the events (writes <office:events> element)
+ void Export( css::uno::Reference<css::container::XNameAccess> const & xAccess,
+ bool bUseWhitespace = true);
+
+ /// export the events, but write <officeooo:events> element
+ /// (for new file format additions)
+ void ExportExt( css::uno::Reference<css::container::XNameAccess> const & xAccess);
+
+ /// export a single event (writes <office:events> element)
+ void ExportSingleEvent(
+ const css::uno::Sequence<css::beans::PropertyValue>& rEventValues,
+ const OUString& rApiEventName,
+ bool bUseWhitespace = true );
+
+private:
+
+ /// export one event (start container-element if necessary)
+ SAL_DLLPRIVATE void ExportEvent(
+ const css::uno::Sequence<css::beans::PropertyValue>& rEventValues,
+ const XMLEventName& rXmlEventName,
+ bool bUseWhitespace,
+ bool& rExported);
+
+ /// export the start element
+ SAL_DLLPRIVATE void StartElement(bool bUseWhitespace);
+
+ /// export the end element
+ SAL_DLLPRIVATE void EndElement(bool bUseWhitespace);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLEventsImportContext.hxx b/include/xmloff/XMLEventsImportContext.hxx
new file mode 100644
index 000000000..dc03d91a6
--- /dev/null
+++ b/include/xmloff/XMLEventsImportContext.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX
+#define INCLUDED_XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <com/sun/star/uno/Reference.hxx>
+#include <xmloff/xmlictxt.hxx>
+
+#include <vector>
+
+namespace com::sun::star {
+ namespace xml::sax { class XAttributeList; }
+ namespace beans { struct PropertyValue; }
+ namespace container { class XNameReplace; }
+ namespace document { class XEventsSupplier; }
+}
+
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+typedef ::std::pair<
+ OUString,
+ css::uno::Sequence<css::beans::PropertyValue> > EventNameValuesPair;
+
+/**
+ * Import <script:events> element.
+ *
+ * The import context usually sets the events immediately at the event
+ * XNameReplace. If none was given on construction, it operates in
+ * delayed mode: All events are collected and may then be set
+ * with the setEvents() method.
+ */
+class XMLOFF_DLLPUBLIC XMLEventsImportContext : public SvXMLImportContext
+{
+ // the event XNameReplace; may be empty
+ css::uno::Reference<css::container::XNameReplace> xEvents;
+
+protected:
+ // if no XNameReplace is given, use this vector to collect events
+ std::vector< EventNameValuesPair > aCollectEvents;
+
+public:
+
+ XMLEventsImportContext(SvXMLImport& rImport);
+
+ XMLEventsImportContext(
+ SvXMLImport& rImport,
+ const css::uno::Reference<css::document::XEventsSupplier> & xEventsSupplier);
+
+ XMLEventsImportContext(
+ SvXMLImport& rImport,
+ const css::uno::Reference<css::container::XNameReplace> & xNameRepl);
+
+ virtual ~XMLEventsImportContext() override;
+
+ void AddEventValues(
+ const OUString& rEventName,
+ const css::uno::Sequence<css::beans::PropertyValue> & rValues);
+
+ /// if the import operates in delayed mode, you can use this method
+ /// to set all events that have been read on the XEventsSupplier
+ void SetEvents(
+ const css::uno::Reference<css::document::XEventsSupplier> & xEventsSupplier);
+
+ /// if the import operates in delayed mode, you can use this method
+ /// to set all events that have been read on the XNameReplace
+ void SetEvents(
+ const css::uno::Reference<css::container::XNameReplace> & xNameRepl);
+
+ /// if the import operates in delayed mode, you can use this method
+ /// to obtain the value sequence for a specific event
+ void GetEventSequence(
+ const OUString& rName,
+ css::uno::Sequence<css::beans::PropertyValue> & rSequence );
+
+protected:
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLFilterServiceNames.h b/include/xmloff/XMLFilterServiceNames.h
new file mode 100644
index 000000000..31549345b
--- /dev/null
+++ b/include/xmloff/XMLFilterServiceNames.h
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <rtl/ustring.hxx>
+
+inline constexpr OUStringLiteral XML_IMPORT_FILTER_WRITER = u"com.sun.star.comp.Writer.XMLOasisImporter";
+inline constexpr OUStringLiteral XML_IMPORT_FILTER_CALC = u"com.sun.star.comp.Calc.XMLOasisImporter";
+inline constexpr OUStringLiteral XML_IMPORT_FILTER_DRAW = u"com.sun.star.comp.Draw.XMLOasisImporter";
+inline constexpr OUStringLiteral XML_IMPORT_FILTER_IMPRESS = u"com.sun.star.comp.Impress.XMLOasisImporter";
+inline constexpr OUStringLiteral XML_IMPORT_FILTER_MATH = u"com.sun.star.comp.Math.XMLImporter";
+inline constexpr OUStringLiteral XML_IMPORT_FILTER_CHART = u"com.sun.star.comp.Chart.XMLOasisImporter";
+
+inline constexpr OUStringLiteral XML_EXPORT_FILTER_WRITER = u"com.sun.star.comp.Writer.XMLOasisExporter";
+inline constexpr OUStringLiteral XML_EXPORT_FILTER_CALC = u"com.sun.star.comp.Calc.XMLOasisExporter";
+inline constexpr OUStringLiteral XML_EXPORT_FILTER_DRAW = u"com.sun.star.comp.Draw.XMLOasisExporter";
+inline constexpr OUStringLiteral XML_EXPORT_FILTER_IMPRESS = u"com.sun.star.comp.Impress.XMLOasisExporter";
+inline constexpr OUStringLiteral XML_EXPORT_FILTER_MATH = u"com.sun.star.comp.Math.XMLExporter";
+inline constexpr OUStringLiteral XML_EXPORT_FILTER_CHART = u"com.sun.star.comp.Chart.XMLOasisExporter";
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLFontAutoStylePool.hxx b/include/xmloff/XMLFontAutoStylePool.hxx
new file mode 100644
index 000000000..2354bcf8c
--- /dev/null
+++ b/include/xmloff/XMLFontAutoStylePool.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX
+#define INCLUDED_XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <tools/fontenum.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <set>
+#include <unordered_set>
+#include <unordered_map>
+#include <memory>
+
+class XMLFontAutoStylePool_Impl;
+class SvXMLExport;
+
+class XMLOFF_DLLPUBLIC XMLFontAutoStylePool : public salhelper::SimpleReferenceObject
+{
+private:
+ SvXMLExport& rExport;
+
+ std::unique_ptr<XMLFontAutoStylePool_Impl> m_pFontAutoStylePool;
+ std::set<OUString> m_aNames;
+ bool m_bTryToEmbedFonts;
+ std::unordered_map<OString, OUString> m_aEmbeddedFontFiles;
+
+ OUString embedFontFile(OUString const & rFileUrl, OUString const & rFamilyName);
+
+ std::unordered_set<OUString> getUsedFontList();
+
+protected:
+ bool m_bEmbedUsedOnly;
+ bool m_bEmbedLatinScript;
+ bool m_bEmbedAsianScript;
+ bool m_bEmbedComplexScript;
+
+ SvXMLExport& GetExport() { return rExport; }
+
+public:
+ XMLFontAutoStylePool( SvXMLExport& rExport, bool tryToEmbedFonts = false );
+ virtual ~XMLFontAutoStylePool() override;
+
+ OUString Add(
+ const OUString& rFamilyName,
+ const OUString& rStyleName,
+ FontFamily nFamily,
+ FontPitch nPitch,
+ rtl_TextEncoding eEnc );
+
+ OUString Find(
+ const OUString& rFamilyName,
+ const OUString& rStyleName,
+ FontFamily nFamily,
+ FontPitch nPitch,
+ rtl_TextEncoding eEnc )const;
+
+ void exportXML();
+
+ void setEmbedOnlyUsedFonts(bool bEmbedUsedOnly)
+ {
+ m_bEmbedUsedOnly = bEmbedUsedOnly;
+ }
+ void setEmbedFontScripts(bool bEmbedLatinScript, bool bEmbedAsianScript, bool bEmbedComplexScript)
+ {
+ m_bEmbedLatinScript = bEmbedLatinScript;
+ m_bEmbedAsianScript = bEmbedAsianScript;
+ m_bEmbedComplexScript = bEmbedComplexScript;
+ }
+};
+
+#endif // INCLUDED_XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLFontStylesContext.hxx b/include/xmloff/XMLFontStylesContext.hxx
new file mode 100644
index 000000000..6768ca43b
--- /dev/null
+++ b/include/xmloff/XMLFontStylesContext.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_XMLFONTSTYLESCONTEXT_HXX
+#define INCLUDED_XMLOFF_XMLFONTSTYLESCONTEXT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+
+#include <memory>
+#include <vector>
+
+#include <xmloff/xmlstyle.hxx>
+
+struct XMLPropertyState;
+class XMLFontFamilyNamePropHdl;
+class XMLFontFamilyPropHdl;
+class XMLFontPitchPropHdl;
+class XMLFontEncodingPropHdl;
+
+class XMLOFF_DLLPUBLIC XMLFontStylesContext final : public SvXMLStylesContext
+{
+ std::unique_ptr<XMLFontFamilyNamePropHdl> pFamilyNameHdl;
+ std::unique_ptr<XMLFontFamilyPropHdl> pFamilyHdl;
+ std::unique_ptr<XMLFontPitchPropHdl> pPitchHdl;
+ std::unique_ptr<XMLFontEncodingPropHdl> pEncHdl;
+
+ rtl_TextEncoding eDfltEncoding;
+
+ using SvXMLStylesContext::CreateStyleChildContext;
+ virtual SvXMLStyleContext *CreateStyleChildContext( sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
+
+public:
+
+ XMLFontStylesContext( SvXMLImport& rImport, rtl_TextEncoding eDfltEnc );
+
+ ~XMLFontStylesContext() override;
+
+ bool FillProperties( const OUString& rName,
+ ::std::vector< XMLPropertyState > &rProps,
+ sal_Int32 nFamilyNameIdx,
+ sal_Int32 nStyleNameIdx,
+ sal_Int32 nFamilyIdx,
+ sal_Int32 nPitchIdx,
+ sal_Int32 nCharsetIdx ) const;
+
+ rtl_TextEncoding GetDfltCharset() const { return eDfltEncoding; }
+
+ XMLFontFamilyNamePropHdl& GetFamilyNameHdl() const { return *pFamilyNameHdl; }
+ XMLFontFamilyPropHdl& GetFamilyHdl() const { return *pFamilyHdl; }
+ XMLFontPitchPropHdl& GetPitchHdl() const { return *pPitchHdl; }
+ XMLFontEncodingPropHdl& GetEncodingHdl() const { return *pEncHdl; }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLGraphicsDefaultStyle.hxx b/include/xmloff/XMLGraphicsDefaultStyle.hxx
new file mode 100644
index 000000000..58f2f0f1a
--- /dev/null
+++ b/include/xmloff/XMLGraphicsDefaultStyle.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLGRAPHICSDEFAULTSTYLE_HXX
+#define INCLUDED_XMLOFF_XMLGRAPHICSDEFAULTSTYLE_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <xmloff/prstylei.hxx>
+
+class XMLOFF_DLLPUBLIC XMLGraphicsDefaultStyle final : public XMLPropStyleContext
+{
+public:
+ XMLGraphicsDefaultStyle(SvXMLImport& rImport, SvXMLStylesContext& rStyles);
+
+ virtual ~XMLGraphicsDefaultStyle() override;
+
+ virtual css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& AttrList) override;
+
+ // This method is called for every default style
+ virtual void SetDefaults() override;
+};
+
+#endif // INCLUDED_XMLOFF_XMLGRAPHICSDEFAULTSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLPageExport.hxx b/include/xmloff/XMLPageExport.hxx
new file mode 100644
index 000000000..4553c9b61
--- /dev/null
+++ b/include/xmloff/XMLPageExport.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLPAGEEXPORT_HXX
+#define INCLUDED_XMLOFF_XMLPAGEEXPORT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star {
+ namespace style { class XStyle; }
+ namespace container { class XNameAccess;}
+ namespace beans { class XPropertySet; }
+}
+
+class SvXMLExport;
+class XMLPropertyHandlerFactory;
+class XMLPropertySetMapper;
+class SvXMLExportPropertyMapper;
+
+
+struct XMLPageExportNameEntry
+{
+ OUString sPageMasterName;
+ OUString sDrawingPageStyleName;
+ OUString sStyleName;
+};
+
+
+class XMLOFF_DLLPUBLIC XMLPageExport : public salhelper::SimpleReferenceObject
+{
+ SvXMLExport& rExport;
+
+ css::uno::Reference< css::container::XNameAccess > xPageStyles;
+
+ ::std::vector< XMLPageExportNameEntry > aNameVector;
+
+ rtl::Reference < XMLPropertyHandlerFactory > xPageMasterPropHdlFactory;
+ rtl::Reference < XMLPropertySetMapper > xPageMasterPropSetMapper;
+ rtl::Reference < SvXMLExportPropertyMapper > xPageMasterExportPropMapper;
+ rtl::Reference<XMLPropertySetMapper> m_xPageMasterDrawingPagePropSetMapper;
+ rtl::Reference<SvXMLExportPropertyMapper> m_xPageMasterDrawingPageExportPropMapper;
+
+protected:
+
+ SvXMLExport& GetExport() { return rExport; }
+
+ void collectPageMasterAutoStyle(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ XMLPageExportNameEntry & rEntry);
+
+ virtual void exportMasterPageContent(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ bool bAutoStyles );
+
+ bool exportStyle(
+ const css::uno::Reference< css::style::XStyle >& rStyle,
+ bool bAutoStyles );
+
+ void exportStyles( bool bUsed, bool bAutoStyles );
+
+public:
+ XMLPageExport( SvXMLExport& rExp );
+ virtual ~XMLPageExport() override;
+
+ void collectAutoStyles( bool bUsed ) { exportStyles( bUsed, true ); }
+ void exportAutoStyles();
+ void exportMasterStyles( bool bUsed ) { exportStyles( bUsed, false ); }
+
+ //text grid enhancement for better CJK support
+ void exportDefaultStyle();
+};
+
+#endif // INCLUDED_XMLOFF_XMLPAGEEXPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLSettingsExportContext.hxx b/include/xmloff/XMLSettingsExportContext.hxx
new file mode 100644
index 000000000..1daf35ada
--- /dev/null
+++ b/include/xmloff/XMLSettingsExportContext.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLSETTINGSEXPORTCONTEXT_HXX
+#define INCLUDED_XMLOFF_XMLSETTINGSEXPORTCONTEXT_HXX
+
+#include <xmloff/xmltoken.hxx>
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+
+namespace xmloff
+{
+
+
+ //= XMLExporter
+
+ class SAL_NO_VTABLE XMLSettingsExportContext
+ {
+ public:
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
+ const OUString& i_rValue ) = 0;
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
+ enum ::xmloff::token::XMLTokenEnum i_eValue ) = 0;
+
+ virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName ) = 0;
+ virtual void EndElement( const bool i_bIgnoreWhitespace ) = 0;
+
+ virtual void Characters( const OUString& i_rCharacters ) = 0;
+
+ virtual css::uno::Reference< css::uno::XComponentContext >
+ GetComponentContext() const = 0;
+
+ protected:
+ ~XMLSettingsExportContext() {}
+ };
+
+
+} // namespace xmloff
+
+
+#endif // INCLUDED_XMLOFF_XMLSETTINGSEXPORTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLShapeStyleContext.hxx b/include/xmloff/XMLShapeStyleContext.hxx
new file mode 100644
index 000000000..59b7c91e6
--- /dev/null
+++ b/include/xmloff/XMLShapeStyleContext.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLSHAPESTYLECONTEXT_HXX
+#define INCLUDED_XMLOFF_XMLSHAPESTYLECONTEXT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <xmloff/prstylei.hxx>
+
+class SvXMLImport;
+
+
+// style:style context
+
+class XMLOFF_DLLPUBLIC XMLShapeStyleContext: public XMLPropStyleContext
+{
+ OUString m_sControlDataStyleName;
+ bool m_bIsNumRuleAlreadyConverted;
+
+protected:
+ OUString m_sListStyleName;
+
+ virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) override;
+public:
+
+ XMLShapeStyleContext(
+ SvXMLImport& rImport,
+ SvXMLStylesContext& rStyles,
+ XmlStyleFamily nFamily);
+ virtual ~XMLShapeStyleContext() override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+
+ virtual void Finish( bool bOverwrite ) override;
+
+ virtual void FillPropertySet(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override;
+};
+
+#endif // INCLUDED_XMLOFF_XMLSHAPESTYLECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLTextListAutoStylePool.hxx b/include/xmloff/XMLTextListAutoStylePool.hxx
new file mode 100644
index 000000000..6237cda70
--- /dev/null
+++ b/include/xmloff/XMLTextListAutoStylePool.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX
+#define INCLUDED_XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <memory>
+#include <set>
+
+namespace com::sun::star::container { class XIndexReplace; }
+namespace com::sun::star::ucb { class XAnyCompare; }
+
+
+class XMLTextListAutoStylePool_Impl;
+typedef std::set<OUString> XMLTextListAutoStylePoolNames_Impl;
+class XMLTextListAutoStylePoolEntry_Impl;
+class SvXMLExport;
+
+class XMLOFF_DLLPUBLIC XMLTextListAutoStylePool
+{
+ SvXMLExport& rExport;
+
+ OUString sPrefix;
+
+ std::unique_ptr<XMLTextListAutoStylePool_Impl> pPool;
+ XMLTextListAutoStylePoolNames_Impl m_aNames;
+ sal_uInt32 nName;
+
+ /** this is an optional NumRule compare component for applications where
+ the NumRules don't have names */
+ css::uno::Reference< css::ucb::XAnyCompare > mxNumRuleCompare;
+
+ SAL_DLLPRIVATE sal_uInt32 Find( const XMLTextListAutoStylePoolEntry_Impl* pEntry )
+ const;
+public:
+
+ XMLTextListAutoStylePool( SvXMLExport& rExport );
+ ~XMLTextListAutoStylePool();
+
+ void RegisterName( const OUString& rName );
+
+ OUString Add(
+ const css::uno::Reference< css::container::XIndexReplace > & rNumRules );
+
+ OUString Find(
+ const css::uno::Reference< css::container::XIndexReplace > & rNumRules ) const;
+ OUString Find( const OUString& rInternalName ) const;
+
+ void exportXML() const;
+};
+
+
+#endif // INCLUDED_XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLTextMasterPageContext.hxx b/include/xmloff/XMLTextMasterPageContext.hxx
new file mode 100644
index 000000000..d39159890
--- /dev/null
+++ b/include/xmloff/XMLTextMasterPageContext.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_XMLTEXTMASTERPAGECONTEXT_HXX
+#define INCLUDED_XMLOFF_XMLTEXTMASTERPAGECONTEXT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+
+#include <xmloff/xmlstyle.hxx>
+
+namespace com::sun::star {
+ namespace style { class XStyle; }
+}
+
+class XMLOFF_DLLPUBLIC XMLTextMasterPageContext : public SvXMLStyleContext
+{
+ OUString sFollow;
+ OUString sPageMasterName;
+ OUString m_sDrawingPageStyle;
+
+ css::uno::Reference < css::style::XStyle > xStyle;
+
+ bool bInsertHeader;
+ bool bInsertFooter;
+ bool bInsertHeaderLeft;
+ bool bInsertFooterLeft;
+ bool bInsertHeaderFirst;
+ bool bInsertFooterFirst;
+ bool bHeaderInserted;
+ bool bFooterInserted;
+
+ SAL_DLLPRIVATE css::uno::Reference< css::style::XStyle > Create();
+protected:
+ const css::uno::Reference< css::style::XStyle >& GetStyle() const { return xStyle; }
+public:
+
+
+ XMLTextMasterPageContext( SvXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
+ bool bOverwrite );
+ virtual ~XMLTextMasterPageContext() override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+
+ virtual SvXMLImportContext *CreateHeaderFooterContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
+ const bool bFooter,
+ const bool bLeft,
+ const bool bFirst );
+
+ virtual void Finish( bool bOverwrite ) override;
+};
+
+struct ContextID_Index_Pair;
+
+XMLOFF_DLLPUBLIC extern ContextID_Index_Pair const g_MasterPageContextIDs[];
+XMLOFF_DLLPUBLIC extern XmlStyleFamily const g_MasterPageFamilies[];
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLTextMasterPageExport.hxx b/include/xmloff/XMLTextMasterPageExport.hxx
new file mode 100644
index 000000000..57f02ec88
--- /dev/null
+++ b/include/xmloff/XMLTextMasterPageExport.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX
+#define INCLUDED_XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <xmloff/XMLPageExport.hxx>
+
+namespace com::sun::star {
+ namespace text { class XText; }
+}
+
+class XMLOFF_DLLPUBLIC XMLTextMasterPageExport : public XMLPageExport
+{
+protected:
+
+ virtual void exportHeaderFooterContent(
+ const css::uno::Reference< css::text::XText >& rText,
+ bool bAutoStyles, bool bExportParagraph = true );
+
+ virtual void exportMasterPageContent(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ bool bAutoStyles ) override;
+
+public:
+ XMLTextMasterPageExport( SvXMLExport& rExp );
+ virtual ~XMLTextMasterPageExport() override;
+};
+
+#endif // INCLUDED_XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLTextMasterStylesContext.hxx b/include/xmloff/XMLTextMasterStylesContext.hxx
new file mode 100644
index 000000000..ab1942b31
--- /dev/null
+++ b/include/xmloff/XMLTextMasterStylesContext.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLTEXTMASTERSTYLESCONTEXT_HXX
+#define INCLUDED_XMLOFF_XMLTEXTMASTERSTYLESCONTEXT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <xmloff/xmlstyle.hxx>
+
+class XMLOFF_DLLPUBLIC XMLTextMasterStylesContext : public SvXMLStylesContext
+{
+protected:
+ virtual SvXMLStyleContext* CreateStyleChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList) override;
+
+ virtual bool InsertStyleFamily(XmlStyleFamily nFamily) const override;
+
+public:
+ XMLTextMasterStylesContext(SvXMLImport& rImport);
+
+ virtual ~XMLTextMasterStylesContext() override;
+};
+
+#endif // _XMLOFF_XMLTEXTMASTERSTYLECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLTextShapeImportHelper.hxx b/include/xmloff/XMLTextShapeImportHelper.hxx
new file mode 100644
index 000000000..f02e566af
--- /dev/null
+++ b/include/xmloff/XMLTextShapeImportHelper.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLTEXTSHAPEIMPORTHELPER_HXX
+#define INCLUDED_XMLOFF_XMLTEXTSHAPEIMPORTHELPER_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <xmloff/shapeimport.hxx>
+
+class XMLOFF_DLLPUBLIC XMLTextShapeImportHelper : public XMLShapeImportHelper
+{
+ SvXMLImport& rImport;
+
+public:
+
+ XMLTextShapeImportHelper( SvXMLImport& rImp );
+ virtual ~XMLTextShapeImportHelper() override;
+
+ virtual void addShape(
+ css::uno::Reference< css::drawing::XShape >& rShape,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ css::uno::Reference< css::drawing::XShapes >& rShapes ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLTextShapeStyleContext.hxx b/include/xmloff/XMLTextShapeStyleContext.hxx
new file mode 100644
index 000000000..43cd9807a
--- /dev/null
+++ b/include/xmloff/XMLTextShapeStyleContext.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_XMLTEXTSHAPESTYLECONTEXT_HXX
+#define INCLUDED_XMLOFF_XMLTEXTSHAPESTYLECONTEXT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <xmloff/XMLShapeStyleContext.hxx>
+#include <xmloff/XMLEventsImportContext.hxx>
+
+class XMLOFF_DLLPUBLIC XMLTextShapeStyleContext final : public XMLShapeStyleContext
+{
+ bool bAutoUpdate : 1;
+
+ rtl::Reference<XMLEventsImportContext> xEventContext;
+
+ virtual void SetAttribute( sal_Int32 nElement,
+ const OUString& rValue ) override;
+
+public:
+
+
+ XMLTextShapeStyleContext( SvXMLImport& rImport,
+ SvXMLStylesContext& rStyles, XmlStyleFamily nFamily );
+ virtual ~XMLTextShapeStyleContext() override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+
+ virtual void CreateAndInsert( bool bOverwrite ) override;
+
+ virtual void Finish( bool bOverwrite ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLTextTableContext.hxx b/include/xmloff/XMLTextTableContext.hxx
new file mode 100644
index 000000000..032d3b7e7
--- /dev/null
+++ b/include/xmloff/XMLTextTableContext.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLTEXTTABLECONTEXT_HXX
+#define INCLUDED_XMLOFF_XMLTEXTTABLECONTEXT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <xmloff/xmlictxt.hxx>
+
+class XMLOFF_DLLPUBLIC XMLTextTableContext : public SvXMLImportContext
+{
+public:
+ XMLTextTableContext( SvXMLImport& rImport );
+ virtual ~XMLTextTableContext() override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/animationexport.hxx b/include/xmloff/animationexport.hxx
new file mode 100644
index 000000000..421be60cc
--- /dev/null
+++ b/include/xmloff/animationexport.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_ANIMATIONEXPORT_HXX
+#define INCLUDED_XMLOFF_ANIMATIONEXPORT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+
+#include <salhelper/simplereferenceobject.hxx>
+#include <memory>
+
+namespace com::sun::star::animations { class XAnimationNode; }
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+class SvXMLExport;
+
+namespace xmloff
+{
+class AnimationsExporterImpl;
+
+class XMLOFF_DLLPUBLIC AnimationsExporter final : public salhelper::SimpleReferenceObject
+{
+ std::unique_ptr<AnimationsExporterImpl> mpImpl;
+
+public:
+ AnimationsExporter( SvXMLExport& rExport, const css::uno::Reference< css::beans::XPropertySet >& xPageProps );
+ SAL_DLLPRIVATE virtual ~AnimationsExporter() override;
+
+ void prepare( const css::uno::Reference< css::animations::XAnimationNode >& xRootNode );
+ void exportAnimations( const css::uno::Reference< css::animations::XAnimationNode >& xRootNode );
+};
+
+}
+
+#endif // INCLUDED_XMLOFF_ANIMATIONEXPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/animexp.hxx b/include/xmloff/animexp.hxx
new file mode 100644
index 000000000..286cb21d3
--- /dev/null
+++ b/include/xmloff/animexp.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_ANIMEXP_HXX
+#define INCLUDED_XMLOFF_ANIMEXP_HXX
+
+#include <salhelper/simplereferenceobject.hxx>
+#include <memory>
+
+namespace com::sun::star::drawing
+{
+class XShape;
+}
+namespace com::sun::star::uno
+{
+template <typename> class Reference;
+}
+
+class AnimExpImpl;
+class SvXMLExport;
+class XMLShapeExport;
+
+class XMLAnimationsExporter final : public salhelper::SimpleReferenceObject
+{
+ std::unique_ptr<AnimExpImpl> mpImpl;
+
+public:
+ XMLAnimationsExporter();
+ virtual ~XMLAnimationsExporter() override;
+
+ static void prepare(const css::uno::Reference<css::drawing::XShape>& xShape);
+ void collect(const css::uno::Reference<css::drawing::XShape>& xShape, SvXMLExport& rExport);
+ void exportAnimations(SvXMLExport& rExport);
+};
+
+#endif // INCLUDED_XMLOFF_ANIMEXP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/attrlist.hxx b/include/xmloff/attrlist.hxx
new file mode 100644
index 000000000..7f4fef2b9
--- /dev/null
+++ b/include/xmloff/attrlist.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_ATTRLIST_HXX
+#define INCLUDED_XMLOFF_ATTRLIST_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <vector>
+
+class XMLOFF_DLLPUBLIC SvXMLAttributeList final : public ::cppu::WeakImplHelper<
+ css::xml::sax::XAttributeList,
+ css::util::XCloneable,
+ css::lang::XUnoTunnel>
+{
+ struct SvXMLTagAttribute_Impl
+ {
+ OUString sName;
+ OUString sValue;
+ };
+ std::vector<SvXMLTagAttribute_Impl> vecAttribute;
+public:
+ SvXMLAttributeList();
+ SvXMLAttributeList( const SvXMLAttributeList& );
+ SvXMLAttributeList( const css::uno::Reference<
+ css::xml::sax::XAttributeList> & rAttrList );
+ virtual ~SvXMLAttributeList() override;
+
+ // XUnoTunnel
+ UNO3_GETIMPLEMENTATION_DECL(SvXMLAttributeList)
+
+ // css::xml::sax::XAttributeList
+ virtual sal_Int16 SAL_CALL getLength() override;
+ virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) override;
+ virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) override;
+ virtual OUString SAL_CALL getTypeByName(const OUString& aName) override;
+ virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) override;
+ virtual OUString SAL_CALL getValueByName(const OUString& aName) override;
+
+ // css::util::XCloneable
+ virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
+
+ // methods that are not contained in any interface
+ void AddAttribute( const OUString &sName , const OUString &sValue );
+ void Clear();
+ void RemoveAttribute( const OUString& sName );
+ void AppendAttributeList( const css::uno::Reference< css::xml::sax::XAttributeList > & );
+ void SetValueByIndex( sal_Int16 i, const OUString& rValue );
+ void RemoveAttributeByIndex( sal_Int16 i );
+ void RenameAttributeByIndex( sal_Int16 i, const OUString& rNewName );
+ sal_Int16 GetIndexByName( const OUString& rName ) const;
+};
+
+
+#endif // INCLUDED_XMLOFF_ATTRLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/autolayout.hxx b/include/xmloff/autolayout.hxx
new file mode 100644
index 000000000..2f1898a47
--- /dev/null
+++ b/include/xmloff/autolayout.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_AUTOLAYOUT_HXX
+#define INCLUDED_XMLOFF_AUTOLAYOUT_HXX
+
+enum AutoLayout
+{
+ // new layouts with enum/text/chart/org/clip merged to content
+ AUTOLAYOUT_START = 0,
+ AUTOLAYOUT_TITLE = 0, ///< Title Slide
+ AUTOLAYOUT_TITLE_CONTENT = 1, ///< Title, Content
+ AUTOLAYOUT_CHART = 2,
+ AUTOLAYOUT_TITLE_2CONTENT = 3, ///< Title and 2 Content
+ AUTOLAYOUT_TEXTCHART = 4,
+ AUTOLAYOUT_ORG = 5,
+ AUTOLAYOUT_TEXTCLIP = 6,
+ AUTOLAYOUT_CHARTTEXT = 7,
+ AUTOLAYOUT_TAB = 8,
+ AUTOLAYOUT_CLIPTEXT = 9,
+ AUTOLAYOUT_TEXTOBJ = 10,
+ AUTOLAYOUT_OBJ = 11,
+ AUTOLAYOUT_TITLE_CONTENT_2CONTENT = 12, ///< Title, Content and 2 Content
+ AUTOLAYOUT_OBJTEXT = 13,
+ AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT = 14, ///< Title, Content over Content
+ AUTOLAYOUT_TITLE_2CONTENT_CONTENT = 15, ///< Title, 2 Content and Content
+ AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT = 16,///< Title, 2 Content over Content
+ AUTOLAYOUT_TEXTOVEROBJ = 17,
+ AUTOLAYOUT_TITLE_4CONTENT = 18, ///< Title, 4 Content
+ AUTOLAYOUT_TITLE_ONLY = 19, ///< Title Only
+ AUTOLAYOUT_NONE = 20, ///< Blank Slide
+ AUTOLAYOUT_NOTES = 21,
+ AUTOLAYOUT_HANDOUT1 = 22,
+ AUTOLAYOUT_HANDOUT2 = 23,
+ AUTOLAYOUT_HANDOUT3 = 24,
+ AUTOLAYOUT_HANDOUT4 = 25,
+ AUTOLAYOUT_HANDOUT6 = 26,
+ AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT = 27, ///< Vertical Title, Vertical Content over Vertical Content
+ AUTOLAYOUT_VTITLE_VCONTENT = 28, ///< Vertical Title, Vertical Content over Vertical Content
+ AUTOLAYOUT_TITLE_VCONTENT = 29, ///< Title, Vertical Content
+ AUTOLAYOUT_TITLE_2VTEXT = 30, ///< Title, 2 Vertical Content
+ AUTOLAYOUT_HANDOUT9 = 31,
+ AUTOLAYOUT_ONLY_TEXT = 32, ///< Centered Text
+ AUTOLAYOUT_4CLIPART = 33,
+ AUTOLAYOUT_TITLE_6CONTENT = 34, ///< Title, 6 Content
+ AUTOLAYOUT_END
+};
+
+#endif // INCLUDED_XMLOFF_AUTOLAYOUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/contextid.hxx b/include/xmloff/contextid.hxx
new file mode 100644
index 000000000..654641f32
--- /dev/null
+++ b/include/xmloff/contextid.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_CONTEXTID_HXX
+#define INCLUDED_XMLOFF_CONTEXTID_HXX
+
+/** These defines determine the unique ids for XML style-context-id's
+ used in the SvXMLAutoStylePoolP.
+ */
+
+#define XML_SC_CTF_START 0x00001000
+#define XML_SD_CTF_START 0x00002000
+#define XML_TEXT_CTF_START 0x00003000
+#define XML_SCH_CTF_START 0x00004000
+#define XML_PM_CTF_START 0x00005000 // page master
+#define XML_FORM_CTF_START 0x00006000
+#define XML_DB_CTF_START 0x00007000
+
+
+#define CTF_SD_CONTROL_SHAPE_DATA_STYLE ( XML_SD_CTF_START + 1 )
+#define CTF_SD_NUMBERINGRULES_NAME ( XML_SD_CTF_START + 2 )
+#define CTF_SD_SHAPE_PARA_ADJUST ( XML_SD_CTF_START + 3 )
+
+#define CTF_FORMS_DATA_STYLE ( XML_FORM_CTF_START + 0 )
+
+#endif // INCLUDED_XMLOFF_CONTEXTID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/controlpropertyhdl.hxx b/include/xmloff/controlpropertyhdl.hxx
new file mode 100644
index 000000000..ce8a2da13
--- /dev/null
+++ b/include/xmloff/controlpropertyhdl.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_CONTROLPROPERTYHDL_HXX
+#define INCLUDED_XMLOFF_CONTROLPROPERTYHDL_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+
+#include <xmloff/dllapi.h>
+#include <xmloff/prhdlfac.hxx>
+#include <rtl/ustring.hxx>
+#include <xmloff/XMLConstantsPropertyHandler.hxx>
+#include <xmloff/NamedBoolPropertyHdl.hxx>
+
+namespace xmloff
+{
+
+
+ //= ORotationAngleHandler
+
+ class XMLOFF_DLLPUBLIC ORotationAngleHandler final : public XMLPropertyHandler
+ {
+ public:
+ SAL_DLLPRIVATE ORotationAngleHandler();
+
+ SAL_DLLPRIVATE virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
+ SAL_DLLPRIVATE virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
+ };
+
+
+ //= OFontWidthHandler
+
+ class XMLOFF_DLLPUBLIC OFontWidthHandler final : public XMLPropertyHandler
+ {
+ public:
+ SAL_DLLPRIVATE OFontWidthHandler();
+
+ SAL_DLLPRIVATE virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
+ SAL_DLLPRIVATE virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
+ };
+
+
+ //= OControlBorderHandlerBase
+
+ class XMLOFF_DLLPUBLIC OControlBorderHandler final : public XMLPropertyHandler
+ {
+ public:
+ enum BorderFacet
+ {
+ STYLE,
+ COLOR
+ };
+
+ SAL_DLLPRIVATE OControlBorderHandler( const BorderFacet _eFacet );
+
+ SAL_DLLPRIVATE virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
+ SAL_DLLPRIVATE virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
+
+ private:
+ BorderFacet m_eFacet;
+ };
+
+
+ //= OControlTextEmphasisHandler
+
+ class OControlTextEmphasisHandler final : public XMLPropertyHandler
+ {
+ public:
+ OControlTextEmphasisHandler();
+
+ virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
+ virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
+ };
+
+
+ //= ImageScaleModeHandler
+
+ class XMLOFF_DLLPUBLIC ImageScaleModeHandler final : public XMLConstantsPropertyHandler
+ {
+ public:
+ ImageScaleModeHandler();
+ };
+
+
+ //= OControlPropertyHandlerFactory
+
+ class XMLOFF_DLLPUBLIC OControlPropertyHandlerFactory : public XMLPropertyHandlerFactory
+ {
+ mutable std::unique_ptr<XMLConstantsPropertyHandler> m_pTextAlignHandler;
+ mutable std::unique_ptr<OControlBorderHandler> m_pControlBorderStyleHandler;
+ mutable std::unique_ptr<OControlBorderHandler> m_pControlBorderColorHandler;
+ mutable std::unique_ptr<ORotationAngleHandler> m_pRotationAngleHandler;
+ mutable std::unique_ptr<OFontWidthHandler> m_pFontWidthHandler;
+ mutable std::unique_ptr<XMLConstantsPropertyHandler> m_pFontEmphasisHandler;
+ mutable std::unique_ptr<XMLConstantsPropertyHandler> m_pFontReliefHandler;
+ mutable std::unique_ptr<XMLNamedBoolPropertyHdl> m_pTextLineModeHandler;
+
+ public:
+ OControlPropertyHandlerFactory();
+
+ virtual const XMLPropertyHandler* GetPropertyHandler(sal_Int32 _nType) const override;
+ };
+
+
+} // namespace xmloff
+
+
+#endif // INCLUDED_XMLOFF_CONTROLPROPERTYHDL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/dllapi.h b/include/xmloff/dllapi.h
new file mode 100644
index 000000000..9e5fd13ca
--- /dev/null
+++ b/include/xmloff/dllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_DLLAPI_H
+#define INCLUDED_XMLOFF_DLLAPI_H
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined XMLOFF_DLLIMPLEMENTATION
+#define XMLOFF_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define XMLOFF_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/families.hxx b/include/xmloff/families.hxx
new file mode 100644
index 000000000..bc2e315c0
--- /dev/null
+++ b/include/xmloff/families.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_FAMILIES_HXX
+#define INCLUDED_XMLOFF_FAMILIES_HXX
+
+#include <rtl/ustring.hxx>
+
+/** These defines determine the unique ids for XML style-families
+ used in the SvXMLAutoStylePoolP.
+ */
+
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_PAGE_MASTER_NAME = u"page-layout";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_PAGE_MASTER_PREFIX = u"pm";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME = u"table";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX = u"ta";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME = u"table-column";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX = u"co";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME = u"table-row";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX = u"ro";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME = u"table-cell";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX = u"ce";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_NAME = u"graphic";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX = u"gr";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_PRESENTATION_NAME = u"presentation";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX = u"pr";
+#define XML_STYLE_FAMILY_SD_POOL_NAME u"default"
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME = u"drawing-page";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX = u"dp";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_SCH_CHART_NAME = u"chart";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_SCH_CHART_PREFIX = u"ch";
+inline constexpr OUStringLiteral XML_STYLE_FAMILY_CONTROL_PREFIX = u"ctrl";
+
+enum class XmlStyleFamily
+{
+// Misc (Pool)
+// reserved: 0..99
+ DATA_STYLE = 0,
+ PAGE_MASTER = 1,
+ MASTER_PAGE = 2,
+
+// Text
+// reserved: 100..199
+ TEXT_PARAGRAPH = 100,
+ TEXT_TEXT = 101,
+ TEXT_LIST = 102,
+ TEXT_OUTLINE = 103,
+ TEXT_FOOTNOTECONFIG = 105,
+ TEXT_ENDNOTECONFIG = 106,
+ TEXT_SECTION = 107,
+ TEXT_FRAME = 108, // export only
+ TEXT_RUBY = 109,
+ TEXT_BIBLIOGRAPHYCONFIG = 110,
+ TEXT_LINENUMBERINGCONFIG = 111,
+
+// Table
+// reserved: 200..299
+ TABLE_TABLE = 200,
+ TABLE_COLUMN = 202,
+ TABLE_ROW = 203,
+ TABLE_CELL = 204,
+ TABLE_TEMPLATE_ID = 205,
+
+// Impress/Draw
+// reserved: 300..399
+ SD_GRAPHICS_ID = 300,
+
+ SD_PRESENTATION_ID = 301,
+// families for derived from SvXMLStyleContext
+ SD_PAGEMASTERCONTEXT_ID = 302,
+ SD_PAGEMASTERSTYLECONTEXT_ID = 306,
+ SD_PRESENTATIONPAGELAYOUT_ID = 303,
+// family for draw pool
+ SD_POOL_ID = 304,
+// family for presentation drawpage properties
+ SD_DRAWINGPAGE_ID = 305,
+
+ SD_GRADIENT_ID = 306,
+ SD_HATCH_ID = 307,
+ SD_FILL_IMAGE_ID = 308,
+ SD_MARKER_ID = 309,
+ SD_STROKE_DASH_ID = 310,
+
+// Chart
+// reserved: 400..499
+ SCH_CHART_ID = 400,
+
+// Math
+// reserved: 500..599
+
+
+// Forms/Controls
+// reserved 600..649
+ CONTROL_ID = 600,
+
+};
+
+#endif // INCLUDED_XMLOFF_FAMILIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/formlayerexport.hxx b/include/xmloff/formlayerexport.hxx
new file mode 100644
index 000000000..823e99875
--- /dev/null
+++ b/include/xmloff/formlayerexport.hxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_FORMLAYEREXPORT_HXX
+#define INCLUDED_XMLOFF_FORMLAYEREXPORT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <memory>
+
+namespace com::sun::star::awt {
+ class XControlModel;
+}
+
+namespace com::sun::star::drawing { class XDrawPage; }
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+class SvXMLExport;
+
+namespace xmloff
+{
+
+
+ class OFormLayerXMLExport_Impl;
+ class OFormsRootExport;
+
+
+ //= OFormLayerXMLExport
+
+ /** provides functionality for exporting a complete form layer.
+ */
+ class XMLOFF_DLLPUBLIC OFormLayerXMLExport final
+ :public ::salhelper::SimpleReferenceObject
+ {
+ // impl class
+ std::unique_ptr<OFormLayerXMLExport_Impl> m_pImpl;
+
+ SAL_DLLPRIVATE virtual ~OFormLayerXMLExport() override;
+
+ public:
+ SAL_DLLPRIVATE OFormLayerXMLExport(SvXMLExport& _rContext);
+
+ /** initializes some internal structures for fast access to the given page
+
+ <p>This method has to be called before you use getControlId for controls on the given page.
+ This way a performance optimization can be done for faster access to the control ids</p>
+
+ @return
+ <TRUE/> if the page has been examined before. If <FALSE/> is returned, this is a serious error.
+
+ @see getControlId
+ @see examineForms
+ */
+ bool seekPage(
+ const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage);
+
+ /** get the id for the given control
+
+ <p>The page the control belongs to must have been examined and sought to.</p>
+
+ @param _rxControl
+ the control which's id should be retrieved. Must not be <NULL/>.
+
+ @see examineForms
+ @see seekPage
+
+ */
+ SAL_DLLPRIVATE OUString getControlId(
+ const css::uno::Reference< css::beans::XPropertySet >& _rxControl);
+
+ /** retrieves the style name for the control's number style.
+
+ <p>For performance reasons, this method is allowed to be called for any controls, even those which
+ do not have a number style. In this case, an empty string is returned.</p>
+
+ @param _rxControl
+ the control which's id should be retrieved. Must not be <NULL/>.
+
+ @see examineForms
+ @see seekPage
+ */
+ SAL_DLLPRIVATE OUString getControlNumberStyle(
+ const css::uno::Reference< css::beans::XPropertySet >& _rxControl );
+
+ /** examines the forms collection given.
+
+ <p>This method will collect all form layer related data of the given draw page</p>
+
+ @param _rxDrawPage
+ the draw page to examine. The object will be queried for a com.sun.star.form::XFormsSupplier
+ interface to obtain the forms container.
+ */
+ void examineForms(const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage);
+
+ /** exports the structure of a form layer
+
+ <p>This method does not export styles (e.g. font properties of the controls), or any references
+ external instances may have to the control models contained in the form layer (e.g. uno control
+ shapes in the drawing layer may have such references)</p>
+
+ <p>No top level element describing the whole collection is inserted. I.e. if within your document, you
+ expect the forms collection to be stored like
+ <listing>
+ &lt;Forms&gt;
+ ... // all the forms stuff here
+ &lt;/Forms&gt;
+ </listing>
+ you have to start the Forms element yourself.</p>
+
+ @param _rxDrawPage
+ the draw page to examine. The object will be queried for a com.sun.star.form::XFormsSupplier
+ interface to obtain the forms container.
+ */
+ void exportForms(const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage);
+
+ /** exports the XForms model data
+ */
+ void exportXForms() const;
+
+ /** determines whether the given page contains logical forms
+ */
+ static bool pageContainsForms( const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage );
+
+ /** determines whether the given page contains XForm instances
+ */
+ bool documentContainsXForms() const;
+
+ /** exports the automatic controls number styles
+ */
+ SAL_DLLPRIVATE void exportAutoControlNumberStyles();
+
+ /** exports the auto-styles collected during the examineForms calls
+ */
+ void exportAutoStyles();
+
+ /** exclude the given control (model) from export.
+
+ <p>If your document contains form controls which are not to be exported for whatever reason,
+ you need to announce the models of these controls (can be retrieved from XControlShape::getControl)
+ to the form layer exporter.<br/>
+ Of course you have to do this before calling <member>exportForms</member></p>
+ */
+ SAL_DLLPRIVATE void excludeFromExport( const css::uno::Reference< css::awt::XControlModel >& _rxControl );
+ };
+
+
+ //= OOfficeFormsExport
+
+ /// export helper for the office::forms element
+ class XMLOFF_DLLPUBLIC OOfficeFormsExport
+ {
+ private:
+ std::unique_ptr<OFormsRootExport> m_pImpl;
+
+ public:
+ OOfficeFormsExport( SvXMLExport& _rExp );
+ ~OOfficeFormsExport();
+ };
+
+
+} // namespace xmloff
+
+
+#endif // INCLUDED_XMLOFF_FORMLAYEREXPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/formlayerimport.hxx b/include/xmloff/formlayerimport.hxx
new file mode 100644
index 000000000..ae9c5ed7e
--- /dev/null
+++ b/include/xmloff/formlayerimport.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_FORMLAYERIMPORT_HXX
+#define INCLUDED_XMLOFF_FORMLAYERIMPORT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <com/sun/star/uno/Reference.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <memory>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::drawing { class XDrawPage; }
+namespace com::sun::star::xml::sax { class XAttributeList; }
+namespace com::sun::star::xml::sax { class XFastAttributeList; }
+
+class SvXMLImport;
+class SvXMLImportContext;
+class SvXMLStylesContext;
+
+
+namespace xmloff
+{
+
+
+ //= OFormLayerXMLImport
+
+ class OFormLayerXMLImport_Impl;
+ /** allows you to import a &lt;form:form&gt; element
+ */
+ class XMLOFF_DLLPUBLIC OFormLayerXMLImport final
+ :public ::salhelper::SimpleReferenceObject
+ {
+ std::unique_ptr<OFormLayerXMLImport_Impl> m_pImpl;
+
+ public:
+ SAL_DLLPRIVATE OFormLayerXMLImport(SvXMLImport& _rImporter);
+ SAL_DLLPRIVATE virtual ~OFormLayerXMLImport() override;
+
+ /** start importing the forms of the given page
+
+ <p>starting the import of a new page (by using this method) invalidates the current page position.</p>
+
+ @see endPage
+ */
+ void startPage(
+ const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage);
+
+ /** creates an import context for the office:forms element
+ */
+ static SvXMLImportContext* createOfficeFormsContext(
+ SvXMLImport& _rImport);
+
+ /** create an SvXMLImportContext instance which is able to import the &lt;form:form&gt;
+ element.
+
+ <p>You must have called <method>startPage</method> before you can create such an import context.</p>
+
+ @see startPage
+ @see endPage
+ */
+ SAL_DLLPRIVATE SvXMLImportContext* createContext(
+ const sal_Int32 _nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttribs);
+
+ /** lookup a control given by id.
+
+ <p>The control must be part of the page which is currently being imported.</p>
+
+ <p>(And, of course, the control must have been imported already at the moment you call this.)</p>
+
+ @see startPage
+ */
+ SAL_DLLPRIVATE css::uno::Reference< css::beans::XPropertySet >
+ lookupControl(const OUString& _rId);
+
+ /** end importing the forms of the current page
+
+ <p>You must call this method if you want the import to be finished correctly. Without calling
+ it, you will lose information.</p>
+
+ @see startPage
+ */
+ void endPage();
+
+ /** announces the auto-style context to the form importer
+ */
+ SAL_DLLPRIVATE void setAutoStyleContext(SvXMLStylesContext* _pNewContext);
+
+ /** sets the given number style on the given control
+ @param _rxControlModel
+ the control model which's style is to be set
+ @param _rControlNumberStyleName
+ the style name for the control's number style
+ */
+ SAL_DLLPRIVATE void applyControlNumberStyle(
+ const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel,
+ const OUString& _rControlNumberStyleName
+ );
+
+ /** to be called when the document has been completely imported
+
+ <p>For some documents (currently: only some spreadsheet documents) it's necessary
+ do to a post processing, since not all information from the file can be processed
+ if the document is not completed, yet.</p>
+ */
+ SAL_DLLPRIVATE void documentDone( );
+ };
+
+
+} // namespace xmloff
+
+
+#endif // INCLUDED_XMLOFF_FORMLAYERIMPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/i18nmap.hxx b/include/xmloff/i18nmap.hxx
new file mode 100644
index 000000000..c3921281f
--- /dev/null
+++ b/include/xmloff/i18nmap.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_I18NMAP_HXX
+#define INCLUDED_XMLOFF_I18NMAP_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <map>
+
+class SvI18NMapEntry_Key
+{
+ sal_uInt16 nKind;
+ OUString aName;
+public:
+ SvI18NMapEntry_Key( sal_uInt16 nKnd, const OUString& rName ) :
+ nKind( nKnd ),
+ aName( rName )
+ {
+ }
+
+ bool operator<( const SvI18NMapEntry_Key& r ) const
+ {
+ return nKind < r.nKind ||
+ ( nKind == r.nKind &&
+ aName < r.aName);
+ }
+};
+
+typedef std::map<SvI18NMapEntry_Key, OUString> SvI18NMap_Impl;
+
+class XMLOFF_DLLPUBLIC SvI18NMap
+{
+ SvI18NMap_Impl m_aMap;
+
+public:
+ // Add a name mapping
+ void Add( sal_uInt16 nKind, const OUString& rName,
+ const OUString& rNewName );
+
+ // Return a mapped name. If the name could not be found, return the
+ // original name.
+ const OUString& Get( sal_uInt16 nKind,
+ const OUString& rName ) const;
+};
+
+#endif // INCLUDED_XMLOFF_I18NMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/languagetagodf.hxx b/include/xmloff/languagetagodf.hxx
new file mode 100644
index 000000000..be687b7a8
--- /dev/null
+++ b/include/xmloff/languagetagodf.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_XMLOFF_LANGUAGETAGODF_HXX
+#define INCLUDED_XMLOFF_LANGUAGETAGODF_HXX
+
+#include <sal/config.h>
+#include <rtl/ustring.hxx>
+#include <i18nlangtag/languagetag.hxx>
+
+/** Helper to gather the single language tag relevant attributes during reading
+ ODF and form a resulting LanguageTag when done.
+
+ For example fo:language, fo:script, fo:country, style:rfc-language-tag
+ */
+struct LanguageTagODF
+{
+ OUString maRfcLanguageTag;
+ OUString maLanguage;
+ OUString maScript;
+ OUString maCountry;
+
+ bool isEmpty() const { return maRfcLanguageTag.isEmpty() &&
+ maLanguage.isEmpty() && maScript.isEmpty() && maCountry.isEmpty(); }
+
+ /** Best call this only once per instance, it recreates a LanguageTag
+ instance on every call.
+ */
+ LanguageTag getLanguageTag() const { return LanguageTag( maRfcLanguageTag, maLanguage, maScript, maCountry); }
+};
+
+#endif // INCLUDED_XMLOFF_LANGUAGETAGODF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/maptype.hxx b/include/xmloff/maptype.hxx
new file mode 100644
index 000000000..a4b105b65
--- /dev/null
+++ b/include/xmloff/maptype.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_MAPTYPE_HXX
+#define INCLUDED_XMLOFF_MAPTYPE_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <unotools/saveopt.hxx>
+
+
+/** Represents a property with its API-name, its XML-name and the type of
+ its value.
+*/
+struct XMLPropertyMapEntry
+{
+ const char* msApiName; /// Property-Name
+ sal_Int32 nApiNameLength; /// length of property name
+ enum ::xmloff::token::XMLTokenEnum meXMLName; /// XML-Name
+ sal_uInt16 mnNameSpace; /** declares the Namespace in which this
+ property exists */
+
+ /**
+ * The lowest 14 bits specify the basic XML type of the property value, of
+ * which the 11th bit specifies the application type. The basic type has
+ * the 11th bit off and the 14th bit on. For the most part, the lower 14
+ * bits are used as a single value.
+ *
+ * <p>The next 4 bits specify the family type of the property value. This
+ * can be one of the following:</p>
+ *
+ * <ul>
+ * <li>XML_TYPE_PROP_GRAPHIC</li>
+ * <li>XML_TYPE_PROP_DRAWING_PAGE</li>
+ * <li>XML_TYPE_PROP_PAGE_LAYOUT</li>
+ * <li>XML_TYPE_PROP_HEADER_FOOTER</li>
+ * <li>XML_TYPE_PROP_TEXT</li>
+ * <li>XML_TYPE_PROP_PARAGRAPH</li>
+ * <li>XML_TYPE_PROP_RUBY</li>
+ * <li>XML_TYPE_PROP_SECTION</li>
+ * <li>XML_TYPE_PROP_TABLE</li>
+ * <li>XML_TYPE_PROP_TABLE_COLUMN</li>
+ * <li>XML_TYPE_PROP_TABLE_ROW</li>
+ * <li>XML_TYPE_PROP_TABLE_CELL</li>
+ * <li>XML_TYPE_PROP_LIST_LEVEL</li>
+ * <li>XML_TYPE_PROP_CHART</li>
+ * </ul>
+ *
+ * <p>The next 2 bits are not used.</p>
+ *
+ * <p>The last 12 bits specify additional rules on how to special-case the
+ * value during import and export. This value may be a combination of the
+ * following flags:</p>
+ *
+ * <ul>
+ * <li>MID_FLAG_PROPERTY_MAY_THROW</li>
+ * <li>MID_FLAG_DEFAULT_ITEM_EXPORT</li>
+ * <li>MID_FLAG_MUST_EXIST</li>
+ * <li>MID_FLAG_MERGE_ATTRIBUTE</li>
+ * <li>MID_FLAG_MERGE_PROPERTY</li>
+ * <li>MID_FLAG_MULTI_PROPERTY</li>
+ * <li>MID_FLAG_ELEMENT_ITEM_IMPORT</li>
+ * <li>MID_FLAG_ELEMENT_ITEM_EXPORT</li>
+ * <li>MID_FLAG_SPECIAL_ITEM_IMPORT</li>
+ * <li>MID_FLAG_SPECIAL_ITEM_EXPORT</li>
+ * <li>MID_FLAG_NO_PROPERTY_IMPORT</li>
+ * <li>MID_FLAG_NO_PROPERTY_EXPORT</li>
+ * </ul>
+ */
+ sal_uInt32 mnType;
+
+ sal_Int16 mnContextId; /// User defined id for context filtering
+ /** no export to standard namespace when the used ODF version is lower than this;
+ no export to extension namespace when the used ODF version is at least this
+ */
+ SvtSaveOptions::ODFSaneDefaultVersion mnEarliestODFVersionForExport;
+
+ /** Flag to specify whether entry is only used during import.
+
+ Allows to handle more than one Namespace/XML-Name to Property-Name
+ mapping, i.e. for extensions. If several entries for the same
+ Property-Name exist, all except one must have this flag set.
+ */
+ bool mbImportOnly;
+
+ template< std::size_t N >
+ XMLPropertyMapEntry(
+ const char (&sApiName)[N],
+ sal_uInt16 nNameSpace,
+ enum ::xmloff::token::XMLTokenEnum eXMLName,
+ sal_uInt32 nType,
+ sal_Int16 nContextId,
+ SvtSaveOptions::ODFSaneDefaultVersion nEarliestODFVersionForExport,
+ bool bImportOnly)
+ :
+ msApiName(sApiName),
+ nApiNameLength(N-1),
+ meXMLName(eXMLName), mnNameSpace(nNameSpace), mnType(nType),
+ mnContextId(nContextId), mnEarliestODFVersionForExport(nEarliestODFVersionForExport),
+ mbImportOnly(bImportOnly)
+ {}
+ XMLPropertyMapEntry(
+ std::nullptr_t ,
+ sal_uInt16 nNameSpace,
+ enum ::xmloff::token::XMLTokenEnum eXMLName,
+ sal_uInt32 nType,
+ sal_Int16 nContextId,
+ SvtSaveOptions::ODFSaneDefaultVersion nEarliestODFVersionForExport,
+ bool bImportOnly)
+ :
+ msApiName(nullptr),
+ nApiNameLength(0),
+ meXMLName(eXMLName), mnNameSpace(nNameSpace), mnType(nType),
+ mnContextId(nContextId), mnEarliestODFVersionForExport(nEarliestODFVersionForExport),
+ mbImportOnly(bImportOnly)
+ {}
+};
+
+
+/** Smart struct to transport an Any with an index to the appropriate
+ property-name
+*/
+struct XMLPropertyState
+{
+ sal_Int32 mnIndex;
+ css::uno::Any maValue;
+
+ XMLPropertyState( sal_Int32 nIndex )
+ : mnIndex( nIndex ) {}
+ XMLPropertyState( sal_Int32 nIndex, const css::uno::Any& rValue )
+ : mnIndex( nIndex ), maValue( rValue ) {}
+};
+
+#endif // INCLUDED_XMLOFF_MAPTYPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/namespacemap.hxx b/include/xmloff/namespacemap.hxx
new file mode 100644
index 000000000..51e741fb8
--- /dev/null
+++ b/include/xmloff/namespacemap.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_NMSPMAP_HXX
+#define INCLUDED_XMLOFF_NMSPMAP_HXX
+
+#include <sal/config.h>
+
+#include <unordered_map>
+#include <utility>
+
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+#include <limits.h>
+
+const sal_uInt16 XML_NAMESPACE_XMLNS = USHRT_MAX-2;
+const sal_uInt16 XML_NAMESPACE_NONE = USHRT_MAX-1;
+const sal_uInt16 XML_NAMESPACE_UNKNOWN = USHRT_MAX;
+const sal_uInt16 XML_NAMESPACE_UNKNOWN_FLAG = 0x8000;
+
+class NameSpaceEntry final
+{
+public:
+ // sName refers to the full namespace name
+ OUString sName;
+ // sPrefix is the prefix used to declare a given item to be from a given namespace
+ OUString sPrefix;
+ // nKey is the unique identifier of a namespace
+ sal_uInt16 nKey;
+
+ bool operator==(NameSpaceEntry const & rhs) const
+ {
+ return sName == rhs.sName && sPrefix == rhs.sPrefix && nKey == rhs.nKey;
+ }
+};
+
+class KeyToNameSpaceMapEntry final
+{
+public:
+ // sName refers to the full namespace name
+ OUString sName;
+ // sPrefix is the prefix used to declare a given item to be from a given namespace
+ OUString sPrefix;
+};
+
+typedef ::std::pair < sal_uInt16, OUString > QNamePair;
+
+struct QNamePairHash
+{
+ size_t operator()( const QNamePair &r1 ) const
+ {
+ size_t hash = 17;
+ hash = hash * 37 + r1.first;
+ hash = hash * 37 + r1.second.hashCode();
+ return hash;
+ }
+};
+
+typedef std::unordered_map < QNamePair, OUString, QNamePairHash > QNameCache;
+typedef std::unordered_map < OUString, NameSpaceEntry > NameSpaceHash;
+typedef std::unordered_map < sal_uInt16, KeyToNameSpaceMapEntry > KeyToNameSpaceMap;
+
+class XMLOFF_DLLPUBLIC SvXMLNamespaceMap
+{
+ OUString sXMLNS;
+
+ NameSpaceHash aNameHash;
+ mutable NameSpaceHash aNameCache;
+ KeyToNameSpaceMap maKeyToNamespaceMap;
+ mutable QNameCache aQNameCache;
+ SAL_DLLPRIVATE sal_uInt16 Add_( const OUString& rPrefix, const OUString &rName, sal_uInt16 nKey );
+
+public:
+
+ SvXMLNamespaceMap();
+ ~SvXMLNamespaceMap();
+
+ SvXMLNamespaceMap( const SvXMLNamespaceMap& );
+
+ SvXMLNamespaceMap& operator =( const SvXMLNamespaceMap& rCmp );
+ bool operator ==( const SvXMLNamespaceMap& rCmp ) const;
+
+ sal_uInt16 Add( const OUString& rPrefix,
+ const OUString& rName,
+ sal_uInt16 nKey = XML_NAMESPACE_UNKNOWN );
+ sal_uInt16 AddIfKnown( const OUString& rPrefix,
+ const OUString& rName );
+
+ sal_uInt16 GetKeyByName( const OUString& rName ) const;
+ const OUString& GetNameByKey( sal_uInt16 nKey ) const;
+
+ sal_uInt16 GetKeyByPrefix( const OUString& rPrefix ) const;
+ const OUString& GetPrefixByKey( sal_uInt16 nKey ) const;
+
+ OUString GetQNameByKey( sal_uInt16 nKey,
+ const OUString& rLocalName,
+ bool bCache = true) const;
+
+ OUString GetAttrNameByKey( sal_uInt16 nKey ) const;
+
+ enum class QNameMode { AttrNameCached, AttrValue };
+ sal_uInt16 GetKeyByQName(const OUString& rQName,
+ OUString *pPrefix,
+ OUString *pLocalName,
+ OUString *pNamespace,
+ QNameMode eMode) const;
+
+ sal_uInt16 GetKeyByAttrValueQName(const OUString& rAttrName,
+ OUString *pLocalName) const;
+
+ sal_uInt16 GetFirstKey() const;
+ sal_uInt16 GetNextKey( sal_uInt16 nOldKey ) const;
+
+ /* Give access to all namespace definitions, including multiple entries
+ for the same key (needed for saving sheets separately in Calc).
+ This might be replaced by a better interface later. */
+ const NameSpaceHash& GetAllEntries() const { return aNameHash; }
+
+ void Clear();
+
+ static bool NormalizeOasisURN( OUString& rName );
+ static bool NormalizeW3URI( OUString& rName );
+ static bool NormalizeURI( OUString& rName );
+
+/* deprecated */ void AddAtIndex( const OUString& rPrefix,
+ const OUString& rName, sal_uInt16 nKey );
+/* deprecated */ static sal_uInt16 GetIndexByKey( sal_uInt16 nKey );
+/* deprecated */ sal_uInt16 GetIndexByPrefix( const OUString& rPrefix ) const;
+/* deprecated */ sal_uInt16 GetFirstIndex() const;
+/* deprecated */ sal_uInt16 GetNextIndex( sal_uInt16 nOldIdx ) const;
+/* deprecated */ const OUString& GetPrefixByIndex( sal_uInt16 nIdx ) const;
+/* deprecated */ const OUString& GetNameByIndex( sal_uInt16 nIdx ) const;
+/* deprecated */ OUString GetAttrNameByIndex( sal_uInt16 nIdx ) const;
+ sal_uInt16 GetKeyByAttrName( const OUString& rAttrName,
+ OUString *pPrefix,
+ OUString *pLocalName,
+ OUString *pNamespace ) const;
+/* deprecated */ sal_uInt16 GetKeyByAttrName( const OUString& rAttrName,
+ OUString *pLocalName = nullptr ) const;
+};
+
+#endif // INCLUDED_XMLOFF_NMSPMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/numehelp.hxx b/include/xmloff/numehelp.hxx
new file mode 100644
index 000000000..41d2ddaf2
--- /dev/null
+++ b/include/xmloff/numehelp.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_NUMEHELP_HXX
+#define INCLUDED_XMLOFF_NUMEHELP_HXX
+
+#include <sal/config.h>
+#include <xmloff/xmlnamespace.hxx>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <set>
+#include <string_view>
+
+namespace com::sun::star::util { class XNumberFormats; }
+namespace com::sun::star::util { class XNumberFormatsSupplier; }
+
+class SvXMLExport;
+
+struct XMLNumberFormat
+{
+ OUString sCurrency;
+ sal_Int32 nNumberFormat;
+ sal_Int16 nType;
+ bool bIsStandard : 1;
+
+ XMLNumberFormat(sal_Int32 nTempFormat)
+ : nNumberFormat(nTempFormat)
+ , nType(0)
+ , bIsStandard(false)
+ {
+ }
+};
+
+struct LessNumberFormat
+{
+ bool operator() (const XMLNumberFormat& rValue1, const XMLNumberFormat& rValue2) const
+ {
+ return rValue1.nNumberFormat < rValue2.nNumberFormat;
+ }
+};
+
+typedef std::set<XMLNumberFormat, LessNumberFormat> XMLNumberFormatSet;
+
+class XMLOFF_DLLPUBLIC XMLNumberFormatAttributesExportHelper
+{
+ css::uno::Reference< css::util::XNumberFormats > xNumberFormats;
+ SvXMLExport* pExport;
+ const OUString sAttrValue;
+ const OUString sAttrDateValue;
+ const OUString sAttrTimeValue;
+ const OUString sAttrBooleanValue;
+ const OUString sAttrStringValue;
+ const OUString sAttrCurrency;
+ XMLNumberFormatSet aNumberFormats;
+public:
+ XMLNumberFormatAttributesExportHelper(css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier);
+ XMLNumberFormatAttributesExportHelper(css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier,
+ SvXMLExport& rExport );
+ ~XMLNumberFormatAttributesExportHelper();
+
+ sal_Int16 GetCellType(const sal_Int32 nNumberFormat, OUString& sCurrency, bool& bIsStandard);
+ static void WriteAttributes(SvXMLExport& rXMLExport,
+ const sal_Int16 nTypeKey,
+ const double& rValue,
+ const OUString& rCurrencySymbol,
+ bool bExportValue);
+ static bool GetCurrencySymbol(const sal_Int32 nNumberFormat, OUString& rCurrencySymbol,
+ css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier);
+ static sal_Int16 GetCellType(const sal_Int32 nNumberFormat, bool& bIsStandard,
+ css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier);
+ static void SetNumberFormatAttributes(SvXMLExport& rXMLExport,
+ const sal_Int32 nNumberFormat,
+ const double& rValue,
+ bool bExportValue = true);
+ static void SetNumberFormatAttributes(SvXMLExport& rXMLExport,
+ const OUString& rValue,
+ std::u16string_view rCharacters,
+ bool bExportValue,
+ bool bExportTypeAttribute = true);
+
+ bool GetCurrencySymbol(const sal_Int32 nNumberFormat, OUString& rCurrencySymbol);
+ sal_Int16 GetCellType(const sal_Int32 nNumberFormat, bool& bIsStandard);
+ void WriteAttributes(const sal_Int16 nTypeKey,
+ const double& rValue,
+ const OUString& rCurrencySymbol,
+ bool bExportValue, sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE);
+ void SetNumberFormatAttributes(const sal_Int32 nNumberFormat,
+ const double& rValue,
+ bool bExportValue = true,
+ sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE, bool bExportCurrencySymbol = true);
+ void SetNumberFormatAttributes(const OUString& rValue,
+ std::u16string_view rCharacters,
+ bool bExportValue = true,
+ sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/odffields.hxx b/include/xmloff/odffields.hxx
new file mode 100644
index 000000000..8dd75e038
--- /dev/null
+++ b/include/xmloff/odffields.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_ODFFIELDS_HXX
+#define INCLUDED_XMLOFF_ODFFIELDS_HXX
+
+#include <rtl/ustring.hxx>
+
+inline constexpr OUStringLiteral ODF_FORMTEXT = u"vnd.oasis.opendocument.field.FORMTEXT";
+#define ODF_FORMFIELD_DEFAULT_LENGTH 5
+
+inline constexpr OUStringLiteral ODF_FORMCHECKBOX = u"vnd.oasis.opendocument.field.FORMCHECKBOX";
+inline constexpr OUStringLiteral ODF_FORMCHECKBOX_HELPTEXT = u"Checkbox_HelpText";
+inline constexpr OUStringLiteral ODF_FORMCHECKBOX_NAME = u"Checkbox_Name";
+inline constexpr OUStringLiteral ODF_FORMCHECKBOX_RESULT = u"Checkbox_Checked";
+
+inline constexpr OUStringLiteral ODF_FORMDROPDOWN = u"vnd.oasis.opendocument.field.FORMDROPDOWN";
+inline constexpr OUStringLiteral ODF_FORMDROPDOWN_LISTENTRY = u"Dropdown_ListEntry";
+inline constexpr OUStringLiteral ODF_FORMDROPDOWN_RESULT = u"Dropdown_Selected";
+#define ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT 25
+
+inline constexpr OUStringLiteral ODF_FORMDATE = u"vnd.oasis.opendocument.field.FORMDATE";
+inline constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT
+ = u"DateField_DateFormat"; // e.g. "MM.DD.YY";
+inline constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT_LANGUAGE
+ = u"DateField_DateFormat_Language"; // e.g. "en-US", "hu-HU";
+inline constexpr OUStringLiteral ODF_FORMDATE_CURRENTDATE
+ = u"DateField_CurrentDate"; // date string in a specific format
+inline constexpr OUStringLiteral ODF_FORMDATE_CURRENTDATE_FORMAT = u"YYYY-MM-DD"; // Coming from MSO
+#define ODF_FORMDATE_CURRENTDATE_LANGUAGE LANGUAGE_ENGLISH_US
+
+#define ODF_TOC "vnd.oasis.opendocument.field.TOC"
+
+#define ODF_HYPERLINK "vnd.oasis.opendocument.field.HYPERLINK"
+
+#define ODF_PAGEREF "vnd.oasis.opendocument.field.PAGEREF"
+
+inline constexpr OUStringLiteral ODF_UNHANDLED = u"vnd.oasis.opendocument.field.UNHANDLED";
+inline constexpr OUStringLiteral ODF_OLE_PARAM = u"vnd.oasis.opendocument.field.ole";
+inline constexpr OUStringLiteral ODF_ID_PARAM = u"vnd.oasis.opendocument.field.id";
+inline constexpr OUStringLiteral ODF_CODE_PARAM = u"vnd.oasis.opendocument.field.code";
+
+#endif // INCLUDED_XMLOFF_ODFFIELDS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/prhdlfac.hxx b/include/xmloff/prhdlfac.hxx
new file mode 100644
index 000000000..e9eb038da
--- /dev/null
+++ b/include/xmloff/prhdlfac.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_PRHDLFAC_HXX
+#define INCLUDED_XMLOFF_PRHDLFAC_HXX
+
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+
+#include <salhelper/simplereferenceobject.hxx>
+#include <memory>
+
+class XMLPropertyHandler;
+
+/**
+ This class is a base-class to create XMLPropertyHandler.
+ It creates PropertyHandler for given XML-types and store
+ them in an internal cache. They'll be deleted at destruction-
+ time.
+ For create your own PropertyHandler for specific XML-types
+ you have to override the virtual method GetPropertyHandler
+ ( see below ).
+*/
+class XMLOFF_DLLPUBLIC XMLPropertyHandlerFactory : public salhelper::SimpleReferenceObject
+{
+ struct Impl;
+ std::unique_ptr<Impl> mpImpl;
+
+ XMLPropertyHandlerFactory(const XMLPropertyHandlerFactory&) = delete;
+ XMLPropertyHandlerFactory& operator=(const XMLPropertyHandlerFactory&) = delete;
+
+public:
+ XMLPropertyHandlerFactory();
+ virtual ~XMLPropertyHandlerFactory() override;
+
+ /**
+ This method retrieves a PropertyHandler for the given XML-type.
+ To extend this method for more XML-types override this method
+ like the example below. If you call the method of the base-class
+ you get propertyhandler for basic-XML-types ( e.g. for color, percent, ... ).
+ After that you could create your new XML-types. After creating a new type
+ you have to put the pointer into the cache via the method
+ PutHdlCache( sal_Int32 , XMLPropertyHandler* ).
+
+ virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const
+ {
+ XMLPropertyHandler* pHdl = XMLPropertyHandlerFactory::GetPropertyHandler( nType );
+
+ if( !pHdl )
+ {
+ switch( nType )
+ {
+ case XML_TYPE_XYZ :
+ pHdl = new XML_xyz_PropHdl;
+ break;
+ case ...
+ :
+ :
+ }
+
+ if( pHdl )
+ PutHdlCache( nType, pHdl );
+ }
+
+ return pHdl;
+ }
+ */
+ virtual const XMLPropertyHandler* GetPropertyHandler(sal_Int32 nType) const;
+
+ /** helper method to statically create a property handler; this will not
+ * use the handler cache. This method should only be called in special
+ * circumstances; calling GetPropertyHandler is almost always
+ * preferable. */
+ static std::unique_ptr<XMLPropertyHandler> CreatePropertyHandler(sal_Int32 nType);
+
+protected:
+ /** Retrieves a PropertyHandler from the internal cache */
+ const XMLPropertyHandler* GetHdlCache(sal_Int32 nType) const;
+ /** Puts a PropertyHandler into the internal cache */
+ void PutHdlCache(sal_Int32 nType, const XMLPropertyHandler* pHdl) const;
+
+private:
+ /** Retrieves ( creates if necessary ) PropertyHandler for
+ basic XML-types */
+ SAL_DLLPRIVATE const XMLPropertyHandler* GetBasicHandler(sal_Int32 nType) const;
+};
+
+#endif // INCLUDED_XMLOFF_PRHDLFAC_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/prstylei.hxx b/include/xmloff/prstylei.hxx
new file mode 100644
index 000000000..98df0c4ea
--- /dev/null
+++ b/include/xmloff/prstylei.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_PRSTYLEI_HXX
+#define INCLUDED_XMLOFF_PRSTYLEI_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <vector>
+#include <xmloff/xmlstyle.hxx>
+
+#include <unordered_set>
+
+struct XMLPropertyState;
+
+namespace com::sun::star {
+ namespace beans { class XPropertySet; }
+}
+
+namespace com::sun::star::style { class XStyle; }
+
+typedef std::unordered_set<OUString> OldFillStyleDefinitionSet;
+
+class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext
+{
+private:
+ ::std::vector< XMLPropertyState > maProperties;
+ css::uno::Reference < css::style::XStyle > mxStyle;
+ rtl::Reference<SvXMLStylesContext> mxStyles;
+
+ XMLPropStyleContext(XMLPropStyleContext const &) = delete;
+ XMLPropStyleContext& operator =(XMLPropStyleContext const &) = delete;
+
+public:
+
+ // Helper to check if the local maProperties contains the given
+ // FillStyle tag and if the FillStyle there is different from FillStyle_NONE
+ bool doNewDrawingLayerFillStyleDefinitionsExist(
+ const OUString& rFillStyleTag) const;
+
+protected:
+
+ // Helper which will deactivate all old fill definitions (identified by
+ // the given OldFillStyleDefinitionSet) in the local maProperties. Deactivation
+ // is done setting the index to -1. It returns true when actually old fill
+ // definitions existed and were deactivated
+ void deactivateOldFillStyleDefinitions(
+ const OldFillStyleDefinitionSet& rHashSetOfTags);
+
+ // Helper to translate new DrawingLayer FillStyle values which are name-based
+ // from ODF internal name to style display names which can be found in the current
+ // document model (using NameOrIndex Items). The change is executed on the internal
+ // maProperties. The return value is true when actually names were changed
+ void translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames();
+
+ // provider for often used sets
+ static const OldFillStyleDefinitionSet& getStandardSet();
+ static const OldFillStyleDefinitionSet& getHeaderSet();
+ static const OldFillStyleDefinitionSet& getFooterSet();
+
+ virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) override;
+ SvXMLStylesContext *GetStyles() { return mxStyles.get(); }
+ ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; }
+
+ // Override this method to create a new style. It's called by
+ // CreateInsert to create a style if a style with the requested family and
+ // name couldn't be found.
+ virtual css::uno::Reference< css::style::XStyle > Create();
+
+public:
+
+
+ XMLPropStyleContext( SvXMLImport& rImport,
+ SvXMLStylesContext& rStyles, XmlStyleFamily nFamily,
+ bool bDefaultStyle=false );
+ virtual ~XMLPropStyleContext() override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+
+ virtual void FillPropertySet(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet );
+
+ virtual bool isEmptyDataStyleName() { return false; };
+
+ const SvXMLStylesContext *GetStyles() const { return static_cast<const SvXMLStylesContext *>(mxStyles.get()); }
+ const ::std::vector< XMLPropertyState > & GetProperties() const { return maProperties; }
+
+ const css::uno::Reference< css::style::XStyle >&
+ GetStyle() const { return mxStyle; }
+ void SetStyle(
+ const css::uno::Reference< css::style::XStyle >& xStl) { mxStyle = xStl; }
+
+ virtual void SetDefaults() override;
+
+ virtual void CreateAndInsert( bool bOverwrite ) override;
+ virtual void Finish( bool bOverwrite ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/settingsstore.hxx b/include/xmloff/settingsstore.hxx
new file mode 100644
index 000000000..ba5526f72
--- /dev/null
+++ b/include/xmloff/settingsstore.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+// Simple interface to allow serialization of document settings
+
+#ifndef INCLUDED_XMLOFF_SETTINGSSTORE_HXX
+#define INCLUDED_XMLOFF_SETTINGSSTORE_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+// Scans list of properties for certain URL properties that could refer
+// to internal objects, and initializes from these.
+class SAL_DLLPUBLIC_RTTI DocumentSettingsSerializer {
+public:
+ // Import objects and update properties (eliding URLs)
+ virtual css::uno::Sequence<css::beans::PropertyValue>
+ filterStreamsFromStorage(
+ OUString const & referer,
+ const css::uno::Reference< css::embed::XStorage > &xStorage,
+ const css::uno::Sequence<css::beans::PropertyValue>& aConfigProps ) = 0;
+ // Export objects and update properties with relative URLs into this storage
+ virtual css::uno::Sequence<css::beans::PropertyValue>
+ filterStreamsToStorage(
+ const css::uno::Reference< css::embed::XStorage > &xStorage,
+ const css::uno::Sequence<css::beans::PropertyValue>& aConfigProps ) = 0;
+
+protected:
+ ~DocumentSettingsSerializer() {}
+};
+
+#endif // INCLUDED_XMLOFF_SETTINGSSTORE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/shapeexport.hxx b/include/xmloff/shapeexport.hxx
new file mode 100644
index 000000000..add92acf4
--- /dev/null
+++ b/include/xmloff/shapeexport.hxx
@@ -0,0 +1,311 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_SHAPEEXPORT_HXX
+#define INCLUDED_XMLOFF_SHAPEEXPORT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+#include <functional>
+#include <map>
+#include <xmloff/animexp.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/txtparae.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace com::sun::star::awt { struct Point; }
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::drawing { class XShape; }
+namespace com::sun::star::drawing { class XShapes; }
+
+class XMLTableExport;
+class SvXMLAttributeList;
+class XMLPropertyHandlerFactory;
+
+// shape export features are bits used for the nFeature
+// parameter of XMLShapeExport::exportShape
+enum class XMLShapeExportFlags {
+ NONE = 0,
+ X = 0x0001,
+ Y = 0x0002,
+ POSITION = 0x0003,
+ WIDTH = 0x0004,
+ HEIGHT = 0x0008,
+ SIZE = WIDTH | HEIGHT,
+// When setting the flag below no ignorableWhiteSpace will be called around
+// the drawing object elements
+ NO_WS = 0x0020,
+// When setting the flag below a callout shape is exported as office:annotation
+ ANNOTATION = 0x0040,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<XMLShapeExportFlags> : is_typed_flags<XMLShapeExportFlags, 0x6f> {};
+}
+
+#define SEF_DEFAULT XMLShapeExportFlags::POSITION|XMLShapeExportFlags::SIZE
+
+enum XmlShapeType
+{
+ XmlShapeTypeUnknown, // not known
+
+ XmlShapeTypeDrawRectangleShape, // "com.sun.star.drawing.RectangleShape"
+ XmlShapeTypeDrawEllipseShape, // "com.sun.star.drawing.EllipseShape"
+ XmlShapeTypeDrawControlShape, // "com.sun.star.drawing.ControlShape"
+ XmlShapeTypeDrawConnectorShape, // "com.sun.star.drawing.ConnectorShape"
+ XmlShapeTypeDrawMeasureShape, // "com.sun.star.drawing.MeasureShape"
+ XmlShapeTypeDrawLineShape, // "com.sun.star.drawing.LineShape"
+ XmlShapeTypeDrawPolyPolygonShape, // "com.sun.star.drawing.PolyPolygonShape"
+ XmlShapeTypeDrawPolyLineShape, // "com.sun.star.drawing.PolyLineShape"
+ XmlShapeTypeDrawOpenBezierShape, // "com.sun.star.drawing.OpenBezierShape"
+ XmlShapeTypeDrawClosedBezierShape, // "com.sun.star.drawing.ClosedBezierShape"
+ XmlShapeTypeDrawGraphicObjectShape, // "com.sun.star.drawing.GraphicObjectShape"
+ XmlShapeTypeDrawGroupShape, // "com.sun.star.drawing.GroupShape"
+ XmlShapeTypeDrawTextShape, // "com.sun.star.drawing.TextShape"
+ XmlShapeTypeDrawOLE2Shape, // "com.sun.star.drawing.OLE2Shape"
+ XmlShapeTypeDrawChartShape, // embedded com.sun.star.chart
+ XmlShapeTypeDrawSheetShape, // embedded com.sun.star.sheet
+ XmlShapeTypeDrawPageShape, // "com.sun.star.drawing.PageShape"
+ XmlShapeTypeDrawFrameShape, // "com.sun.star.drawing.FrameShape"
+ XmlShapeTypeDrawCaptionShape, // "com.sun.star.drawing.CaptionShape"
+ XmlShapeTypeDrawAppletShape, // "com.sun.star.drawing.AppletShape"
+ XmlShapeTypeDrawPluginShape, // "com.sun.star.drawing.PlugginShape"
+
+ XmlShapeTypeDraw3DSceneObject, // "com.sun.star.drawing.Shape3DSceneObject"
+ XmlShapeTypeDraw3DCubeObject, // "com.sun.star.drawing.Shape3DCubeObject"
+ XmlShapeTypeDraw3DSphereObject, // "com.sun.star.drawing.Shape3DSphereObject"
+ XmlShapeTypeDraw3DLatheObject, // "com.sun.star.drawing.Shape3DLatheObject"
+ XmlShapeTypeDraw3DExtrudeObject, // "com.sun.star.drawing.Shape3DExtrudeObject"
+
+ XmlShapeTypePresTitleTextShape, // "com.sun.star.presentation.TitleTextShape"
+ XmlShapeTypePresOutlinerShape, // "com.sun.star.presentation.OutlinerShape"
+ XmlShapeTypePresSubtitleShape, // "com.sun.star.presentation.SubtitleShape"
+ XmlShapeTypePresGraphicObjectShape, // "com.sun.star.presentation.GraphicObjectShape"
+ XmlShapeTypePresPageShape, // "com.sun.star.presentation.PageShape"
+ XmlShapeTypePresOLE2Shape, // "com.sun.star.presentation.OLE2Shape"
+ XmlShapeTypePresChartShape, // "com.sun.star.presentation.ChartShape"
+ XmlShapeTypePresSheetShape, // "com.sun.star.presentation.CalcShape"
+ XmlShapeTypePresTableShape, // "com.sun.star.presentation.TableShape"
+ XmlShapeTypePresOrgChartShape, // "com.sun.star.presentation.OrgChartShape"
+ XmlShapeTypePresNotesShape, // "com.sun.star.presentation.NotesShape"
+ XmlShapeTypeHandoutShape, // "com.sun.star.presentation.HandoutShape"
+
+ XmlShapeTypePresHeaderShape, // "com.sun.star.presentation.HeaderShape"
+ XmlShapeTypePresFooterShape, // "com.sun.star.presentation.FooterShape"
+ XmlShapeTypePresSlideNumberShape, // "com.sun.star.presentation.SlideNumberShape"
+ XmlShapeTypePresDateTimeShape, // "com.sun.star.presentation.DateTimeShape"
+
+ XmlShapeTypeDrawCustomShape, // "com.sun.star.drawing.CustomShape"
+ XmlShapeTypeDrawMediaShape, // "com.sun.star.drawing.MediaShape"
+ XmlShapeTypePresMediaShape, // "com.sun.star.presentation.MediaShape"
+
+ XmlShapeTypeDrawTableShape, // "com.sun.star.drawing.TableShape"
+
+ XmlShapeTypeNotYetSet
+};
+
+/** caches style and type info after a collectShapeAutostyle for later use in exportShape */
+struct ImplXMLShapeExportInfo
+{
+ OUString msStyleName;
+ OUString msTextStyleName;
+ XmlStyleFamily mnFamily;
+ XmlShapeType meShapeType;
+
+ css::uno::Reference< css::drawing::XShape > xCustomShapeReplacement;
+
+ ImplXMLShapeExportInfo() : mnFamily( XmlStyleFamily::SD_GRAPHICS_ID ), meShapeType( XmlShapeTypeNotYetSet ) {}
+};
+
+/** a vector for shape style and type cache information */
+typedef std::vector< ImplXMLShapeExportInfo > ImplXMLShapeExportInfoVector;
+
+/** a map to store all cache data for already collected XShapes */
+typedef std::map< css::uno::Reference < css::drawing::XShapes >, ImplXMLShapeExportInfoVector > ShapesInfos;
+
+class SvXMLExport;
+class SvXMLExportPropertyMapper;
+
+namespace basegfx
+{
+ class B2DTuple;
+ class B2DHomMatrix;
+}
+
+class XMLOFF_DLLPUBLIC XMLShapeExport : public salhelper::SimpleReferenceObject
+{
+private:
+
+ SvXMLExport& mrExport;
+ rtl::Reference< SvXMLExportPropertyMapper > mxPropertySetMapper;
+ rtl::Reference< XMLAnimationsExporter > mxAnimationsExporter;
+ ShapesInfos maShapesInfos;
+ ShapesInfos::iterator maCurrentShapesIter;
+ bool mbExportLayer;
+ OUString msPresentationStylePrefix;
+
+ // #88546# possibility to switch progress bar handling on/off
+ bool mbHandleProgressBar;
+
+ rtl::Reference< XMLTableExport > mxShapeTableExport;
+
+protected:
+ SvXMLExport& GetExport() { return mrExport; }
+ const SvXMLExport& GetExport() const { return mrExport; }
+private:
+
+ SAL_DLLPRIVATE const rtl::Reference< SvXMLExportPropertyMapper >& GetPropertySetMapper() const { return mxPropertySetMapper; }
+
+ OUStringBuffer msBuffer;
+
+ SAL_DLLPRIVATE void ImpCalcShapeType(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType& eShapeType);
+
+ SAL_DLLPRIVATE void ImpExportNewTrans(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint);
+ SAL_DLLPRIVATE void ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix, const css::uno::Reference< css::beans::XPropertySet >& xPropSet);
+ SAL_DLLPRIVATE static void ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMat, ::basegfx::B2DTuple& rTRScale, double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, css::awt::Point* pRefPoint);
+ SAL_DLLPRIVATE void ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple const & rTRScale, double fTRShear, double fTRRotate, ::basegfx::B2DTuple const & rTRTranslate, const XMLShapeExportFlags nFeatures);
+ SAL_DLLPRIVATE bool ImpExportPresentationAttributes( const css::uno::Reference< css::beans::XPropertySet >& xPropSet, const OUString& rClass );
+ SAL_DLLPRIVATE void ImpExportText( const css::uno::Reference< css::drawing::XShape >& xShape, TextPNS eExtensionNS = TextPNS::ODF );
+ SAL_DLLPRIVATE void ImpExportEvents( const css::uno::Reference< css::drawing::XShape >& xShape );
+ SAL_DLLPRIVATE void ImpExportDescription( const css::uno::Reference< css::drawing::XShape >& xShape ); // #i68101#
+ SAL_DLLPRIVATE void ImpExportGluePoints( const css::uno::Reference< css::drawing::XShape >& xShape );
+ SAL_DLLPRIVATE void ImpExportSignatureLine(const css::uno::Reference<css::drawing::XShape>& xShape);
+ SAL_DLLPRIVATE void ImpExportQRCode(const css::uno::Reference<css::drawing::XShape>& xShape);
+
+ // single shape exporters
+ SAL_DLLPRIVATE void ImpExportGroupShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExport3DSceneShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportRectangleShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportLineShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportEllipseShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportPolygonShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportTextBoxShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportGraphicObjectShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportChartShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr, SvXMLAttributeList* pAttrList = nullptr );
+ SAL_DLLPRIVATE void ImpExportControlShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportConnectorShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportMeasureShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point const * pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportOLE2Shape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr, SvXMLAttributeList* pAttrList = nullptr );
+ SAL_DLLPRIVATE void ImpExportPageShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportCaptionShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExport3DShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType );
+ SAL_DLLPRIVATE void ImpExportFrameShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportPluginShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportAppletShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportCustomShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportMediaShape( const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+ SAL_DLLPRIVATE void ImpExportTableShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr );
+public:
+ XMLShapeExport(SvXMLExport& rExp, SvXMLExportPropertyMapper *pExtMapper=nullptr );
+ virtual ~XMLShapeExport() override;
+
+ // This method collects all automatic styles for the given XShape
+ void collectShapeAutoStyles(
+ const css::uno::Reference < css::drawing::XShape >& xShape);
+
+ // This method exports the given XShape
+ void exportShape(
+ const css::uno::Reference < css::drawing::XShape >& xShape,
+ XMLShapeExportFlags nFeatures = SEF_DEFAULT,
+ css::awt::Point* pRefPoint = nullptr,
+ SvXMLAttributeList* pAttrList = nullptr
+ );
+
+ // This method collects all automatic styles for the shapes inside the given XShapes collection
+ void collectShapesAutoStyles(
+ const css::uno::Reference < css::drawing::XShapes >& xShapes);
+
+ // This method exports all XShape inside the given XShapes collection
+ void exportShapes(
+ const css::uno::Reference < css::drawing::XShapes >& xShapes,
+ XMLShapeExportFlags nFeatures = SEF_DEFAULT,
+ css::awt::Point* pRefPoint = nullptr
+ );
+
+ /** initializes some internal structures for fast access to the given XShapes collection
+
+ <p>This method has to be called before you use exportShape or collectShapeAutoStyles.
+ It is automatically called if you use collectShapesAutoStyles and exportShapes.
+
+ @see collectShapeAutoStyles
+ @see exportShape
+ @see collectShapesAutoStyles
+ @see exportShapes
+ */
+ void seekShapes(
+ const css::uno::Reference< css::drawing::XShapes >& xShapes ) noexcept;
+
+ void exportAutoStyles();
+
+ /** sets a new reference to an XMLAnimationExporter.
+ If this is a non NULL reference, the animation information from all shapes given to exportShape()
+ from now on are collected.
+ */
+ void setAnimationsExporter( rtl::Reference< XMLAnimationsExporter > const & xAnimExport ) { mxAnimationsExporter = xAnimExport; }
+
+ /** returns the last set XMLAnimationExport */
+ const rtl::Reference< XMLAnimationsExporter >& getAnimationsExporter() const { return mxAnimationsExporter; }
+
+ /// returns the export property mapper for external chaining
+ static SvXMLExportPropertyMapper* CreateShapePropMapper( SvXMLExport& rExport );
+
+ void enableLayerExport() { mbExportLayer = true; }
+
+ /** defines if the export should increment the progress bar or not */
+ void enableHandleProgressBar() { mbHandleProgressBar = true; }
+ bool IsHandleProgressBarEnabled() const { return mbHandleProgressBar; }
+
+ void setPresentationStylePrefix( const OUString& rPrefix ) { msPresentationStylePrefix = rPrefix; }
+
+ /** helper for chart that adds all attributes of a 3d scene element to the export */
+ void export3DSceneAttributes( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
+
+ /** helper for chart that exports all lamps from the propertyset */
+ void export3DLamps( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
+
+ /** sj: replacing CustomShapes with standard objects that are also supported in OpenOffice.org format */
+ css::uno::Reference < css::drawing::XShape > checkForCustomShapeReplacement(
+ const css::uno::Reference < css::drawing::XShape >& );
+
+ /** helper to export the style for graphic defaults */
+ void ExportGraphicDefaults();
+
+ /** is called before a shape element for the given XShape is exported */
+ virtual void onExport( const css::uno::Reference < css::drawing::XShape >& xShape );
+
+ const rtl::Reference< XMLTableExport >& GetShapeTableExport();
+};
+
+namespace xmloff {
+
+XMLOFF_DLLPUBLIC void FixZOrder(
+ css::uno::Reference<css::drawing::XShapes> const& xShapes,
+ std::function<unsigned int (css::uno::Reference<css::beans::XPropertySet> const&)> const& rGetLayer);
+
+} // namespace xmloff
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/shapeimport.hxx b/include/xmloff/shapeimport.hxx
new file mode 100644
index 000000000..12cb9f8fd
--- /dev/null
+++ b/include/xmloff/shapeimport.hxx
@@ -0,0 +1,263 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_SHAPEIMPORT_HXX
+#define INCLUDED_XMLOFF_SHAPEIMPORT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <salhelper/simplereferenceobject.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <sax/fastattribs.hxx>
+
+#include <basegfx/vector/b3dvector.hxx>
+#include <vector>
+#include <memory>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::drawing { class XShape; }
+namespace com::sun::star::drawing { class XShapes; }
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::xml::sax { class XAttributeList; }
+
+class SvXMLImport;
+class SvXMLTokenMap;
+class SvXMLStylesContext;
+class XMLSdPropHdlFactory;
+class SvXMLImportPropertyMapper;
+class XMLTableImport;
+
+// dr3d:3dlight context
+
+class SdXML3DLightContext final : public SvXMLImportContext
+{
+ // local parameters which need to be read
+ sal_Int32 maDiffuseColor;
+ ::basegfx::B3DVector maDirection;
+ bool mbEnabled;
+ bool mbSpecular;
+
+public:
+ SdXML3DLightContext(
+ SvXMLImport& rImport,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
+ virtual ~SdXML3DLightContext() override;
+
+ sal_Int32 GetDiffuseColor() const { return maDiffuseColor; }
+ const ::basegfx::B3DVector& GetDirection() const { return maDirection; }
+ bool GetEnabled() const { return mbEnabled; }
+};
+
+
+class SdXML3DSceneAttributesHelper
+{
+protected:
+ SvXMLImport& mrImport;
+
+ // list for local light contexts
+ ::std::vector< rtl::Reference< SdXML3DLightContext > >
+ maList;
+
+ // local parameters which need to be read
+ css::drawing::HomogenMatrix mxHomMat;
+ bool mbSetTransform;
+
+ css::drawing::ProjectionMode mxPrjMode;
+ sal_Int32 mnDistance;
+ sal_Int32 mnFocalLength;
+ sal_Int32 mnShadowSlant;
+ css::drawing::ShadeMode mxShadeMode;
+ sal_Int32 maAmbientColor;
+ bool mbLightingMode;
+
+ ::basegfx::B3DVector maVRP;
+ ::basegfx::B3DVector maVPN;
+ ::basegfx::B3DVector maVUP;
+ bool mbVRPUsed;
+
+public:
+ SdXML3DSceneAttributesHelper( SvXMLImport& rImporter );
+
+ /** creates a 3d light context and adds it to the internal list for later processing */
+ SvXMLImportContext * create3DLightContext( const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
+
+ /** this should be called for each scene attribute */
+ void processSceneAttribute( const sax_fastparser::FastAttributeList::FastAttributeIter & aIter );
+
+ /** this sets the scene attributes at this propertyset */
+ void setSceneAttributes( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
+};
+
+
+class SvXMLShapeContext : public SvXMLImportContext
+{
+protected:
+ css::uno::Reference< css::drawing::XShape > mxShape;
+ bool mbTemporaryShape;
+ OUString msHyperlink;
+
+public:
+ SvXMLShapeContext( SvXMLImport& rImp, bool bTemporaryShape ) : SvXMLImportContext( rImp ), mbTemporaryShape(bTemporaryShape) {}
+
+
+ const css::uno::Reference< css::drawing::XShape >& getShape() const { return mxShape; }
+
+ void setHyperlink( const OUString& rHyperlink );
+};
+
+
+struct XMLShapeImportHelperImpl;
+struct XMLShapeImportPageContextImpl;
+struct SdXMLEventContextData;
+
+class XMLOFF_DLLPUBLIC XMLShapeImportHelper : public salhelper::SimpleReferenceObject
+{
+ std::unique_ptr<XMLShapeImportHelperImpl> mpImpl;
+
+ std::shared_ptr<XMLShapeImportPageContextImpl> mpPageContext;
+
+ // PropertySetMappers and factory
+ rtl::Reference<XMLSdPropHdlFactory> mpSdPropHdlFactory;
+ rtl::Reference<SvXMLImportPropertyMapper> mpPropertySetMapper;
+ rtl::Reference<SvXMLImportPropertyMapper> mpPresPagePropsMapper;
+
+ // contexts for Style and AutoStyle import
+ rtl::Reference<SvXMLStylesContext> mxStylesContext;
+ rtl::Reference<SvXMLStylesContext> mxAutoStylesContext;
+
+ rtl::Reference< XMLTableImport > mxShapeTableImport;
+
+protected:
+ SvXMLImport& mrImporter;
+
+public:
+ XMLShapeImportHelper( SvXMLImport& rImporter,
+ const css::uno::Reference< css::frame::XModel>& rModel,
+ SvXMLImportPropertyMapper *pExtMapper=nullptr );
+
+ virtual ~XMLShapeImportHelper() override;
+
+ static SvXMLShapeContext* CreateGroupChildContext(
+ SvXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ css::uno::Reference< css::drawing::XShapes > const & rShapes,
+ bool bTemporaryShape = false);
+
+ static SvXMLShapeContext* CreateFrameChildContext(
+ SvXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ css::uno::Reference< css::drawing::XShapes > const & rShapes,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xFrameAttrList);
+ static css::uno::Reference< css::xml::sax::XFastContextHandler > CreateFrameChildContext(
+ SvXMLImportContext *pThisContext, sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList );
+
+ static SvXMLShapeContext* Create3DSceneChildContext(
+ SvXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ css::uno::Reference< css::drawing::XShapes > const & rShapes);
+
+ // Styles and AutoStyles contexts
+ SvXMLStylesContext* GetStylesContext() const { return mxStylesContext.get(); }
+ void SetStylesContext(SvXMLStylesContext* pNew);
+ SvXMLStylesContext* GetAutoStylesContext() const { return mxAutoStylesContext.get(); }
+ void SetAutoStylesContext(SvXMLStylesContext* pNew);
+
+ // get factories and mappers
+ SvXMLImportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper.get(); }
+ SvXMLImportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper.get(); }
+
+ // this function is called whenever the implementation classes like to add this new
+ // shape to the given XShapes.
+ virtual void addShape(
+ css::uno::Reference< css::drawing::XShape >& rShape,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ css::uno::Reference< css::drawing::XShapes >& rShapes);
+
+ // this function is called whenever the implementation classes have finished importing
+ // a shape to the given XShapes. The shape is already inserted into its XShapes and
+ // all properties and styles are set.
+ virtual void finishShape(
+ css::uno::Reference< css::drawing::XShape >& rShape,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ css::uno::Reference< css::drawing::XShapes >& rShapes);
+
+ // tdf#127791 help function for group shape events
+ void addShapeEvents(SdXMLEventContextData& rData);
+
+ // helper functions processing groups after their component shapes are collected
+ // e.g. for z-order sorting or adding events to the group
+ void pushGroupForPostProcessing( css::uno::Reference< css::drawing::XShapes >& rShapes );
+ void popGroupAndPostProcess();
+
+ void shapeWithZIndexAdded( css::uno::Reference< css::drawing::XShape > const & rShape,
+ sal_Int32 nZIndex );
+ /// Updates the z-order of other shapes to be consistent again, needed due
+ /// to the removal of rShape.
+ void shapeRemoved(const css::uno::Reference<css::drawing::XShape>& rShape);
+
+ void addShapeConnection( css::uno::Reference< css::drawing::XShape > const & rConnectorShape,
+ bool bStart,
+ const OUString& rDestShapeId,
+ sal_Int32 nDestGlueId );
+
+ /** adds a mapping for a gluepoint identifier from an xml file to the identifier created after inserting
+ the new gluepoint into the core. The saved mappings can be retrieved by getGluePointId() */
+ void addGluePointMapping( css::uno::Reference< css::drawing::XShape > const & xShape,
+ sal_Int32 nSourceId, sal_Int32 nDestinnationId );
+
+ /** moves all current DestinationId's for rXShape by n */
+ void moveGluePointMapping( const css::uno::Reference< css::drawing::XShape >& xShape, const sal_Int32 n );
+
+ /** retrieves a mapping for a gluepoint identifier from the current xml file to the identifier created after
+ inserting the new gluepoint into the core. The mapping must be initialized first with addGluePointMapping() */
+ sal_Int32 getGluePointId( const css::uno::Reference< css::drawing::XShape >& xShape, sal_Int32 nSourceId );
+
+ /** this method must be calling before the first shape is imported for the given page.
+ Calls to this method can be nested */
+ void startPage( css::uno::Reference< css::drawing::XShapes > const & rShapes );
+
+ /** this method must be calling after the last shape is imported for the given page
+ Calls to this method can be nested */
+ void endPage( css::uno::Reference< css::drawing::XShapes > const & rShapes );
+
+ void restoreConnections();
+
+ /** creates a property mapper for external chaining */
+ static SvXMLImportPropertyMapper* CreateShapePropMapper(
+ const css::uno::Reference< css::frame::XModel>& rModel, SvXMLImport& rImport );
+
+ /** defines if the import should increment the progress bar or not */
+ void enableHandleProgressBar();
+ bool IsHandleProgressBarEnabled() const;
+
+ /** queries the capability of the current model to create presentation shapes */
+ bool IsPresentationShapesSupported() const;
+
+ XMLSdPropHdlFactory* GetSdPropHdlFactory() const { return mpSdPropHdlFactory.get(); }
+
+ const rtl::Reference< XMLTableImport >& GetShapeTableImport();
+};
+
+#endif // INCLUDED_XMLOFF_SHAPEIMPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/styleexp.hxx b/include/xmloff/styleexp.hxx
new file mode 100644
index 000000000..4cd11971c
--- /dev/null
+++ b/include/xmloff/styleexp.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_STYLEEXP_HXX
+#define INCLUDED_XMLOFF_STYLEEXP_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+
+#include <salhelper/simplereferenceobject.hxx>
+
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace rtl { template <class reference_type> class Reference; }
+
+namespace com::sun::star
+{
+ namespace style
+ {
+ class XStyle;
+ }
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace container
+ {
+ class XNameAccess;
+ }
+
+}
+
+class SvXMLExportPropertyMapper;
+class SvXMLAutoStylePoolP;
+class SvXMLExport;
+enum class XmlStyleFamily;
+
+class XMLOFF_DLLPUBLIC XMLStyleExport : public salhelper::SimpleReferenceObject
+{
+ SvXMLExport& rExport;
+ SvXMLAutoStylePoolP *pAutoStylePool;
+
+protected:
+ SvXMLExport& GetExport() { return rExport; }
+ const SvXMLExport& GetExport() const { return rExport; }
+
+ bool exportStyle(
+ const css::uno::Reference< css::style::XStyle > & rStyle,
+ const OUString& rXMLFamily,
+ const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper,
+ const css::uno::Reference< css::container::XNameAccess > & xStyles,
+ const OUString* pPrefix );
+
+ virtual void exportStyleAttributes(
+ const css::uno::Reference< css::style::XStyle > & rStyle );
+
+ virtual void exportStyleContent(
+ const css::uno::Reference< css::style::XStyle > & rStyle );
+public:
+ XMLStyleExport(
+ SvXMLExport& rExp,
+ SvXMLAutoStylePoolP *pAutoStyleP=nullptr );
+ virtual ~XMLStyleExport() override;
+
+// void exportStyleFamily(
+// const OUString& rFamily, const OUString& rXMLFamily,
+// const rtl::Reference < XMLPropertySetMapper >& rPropMapper,
+// bool bUsed, sal_uInt16 nFamily = 0,
+// const OUString* pPrefix = 0);
+
+// void exportStyleFamily(
+// const char *pFamily, const OUString& rXMLFamily,
+// const rtl::Reference < XMLPropertySetMapper >& rPropMapper,
+// bool bUsed, sal_uInt16 nFamily = 0,
+// const OUString* pPrefix = 0);
+
+ void exportDefaultStyle(
+ const css::uno::Reference< css::beans::XPropertySet > & xPropSet,
+ const OUString& rXMLFamily,
+ const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper );
+
+ void exportStyleFamily(
+ const OUString& rFamily, const OUString& rXMLFamily,
+ const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper,
+ bool bUsed, XmlStyleFamily nFamily,
+ const OUString* pPrefix = nullptr);
+
+ void exportStyleFamily(
+ const char *pFamily, const OUString& rXMLFamily,
+ const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper,
+ bool bUsed, XmlStyleFamily nFamily,
+ const OUString* pPrefix = nullptr);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/table/XMLTableExport.hxx b/include/xmloff/table/XMLTableExport.hxx
new file mode 100644
index 000000000..dfdb08d73
--- /dev/null
+++ b/include/xmloff/table/XMLTableExport.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_TABLE_XMLTABLEEXPORT_HXX
+#define INCLUDED_XMLOFF_TABLE_XMLTABLEEXPORT_HXX
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/table/XColumnRowRange.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+
+#include <rtl/ref.hxx>
+
+#include <xmloff/dllapi.h>
+#include <salhelper/simplereferenceobject.hxx>
+#include <xmloff/prhdlfac.hxx>
+#include <xmloff/xmlexppr.hxx>
+#include <xmloff/styleexp.hxx>
+
+class SvXMLExport;
+class SvXMLExportPropertyMapper;
+
+typedef std::map< const css::uno::Reference< css::uno::XInterface >, OUString > TableStyleMap;
+
+struct XMLTableInfo
+{
+ TableStyleMap maColumnStyleMap;
+ TableStyleMap maRowStyleMap;
+ TableStyleMap maCellStyleMap;
+ std::vector< OUString > maDefaultRowCellStyles;
+};
+
+class XMLOFF_DLLPUBLIC XMLTableExport final : public salhelper::SimpleReferenceObject
+{
+public:
+ XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExportPropertyMapper >& xCellExportPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef );
+ virtual ~XMLTableExport() override;
+
+ // This method collects all automatic styles for the given table
+ void collectTableAutoStyles(const css::uno::Reference < css::table::XColumnRowRange >& xColumnRowRange);
+
+ // This method exports the given table
+ void exportTable(const css::uno::Reference < css::table::XColumnRowRange >& xColumnRowRange);
+
+ // export the styles from the cell style family
+ void exportTableStyles();
+
+ // Export the collected automatic styles
+ void exportAutoStyles();
+
+private:
+ void exportTableTemplates();
+
+ SvXMLExport& mrExport;
+ rtl::Reference< SvXMLExportPropertyMapper > mxCellExportPropertySetMapper;
+ rtl::Reference< SvXMLExportPropertyMapper > mxRowExportPropertySetMapper;
+ rtl::Reference< SvXMLExportPropertyMapper > mxColumnExportPropertySetMapper;
+ std::map< const css::uno::Reference< css::table::XColumnRowRange >, std::shared_ptr< XMLTableInfo > >
+ maTableInfoMap;
+ bool mbExportTables;
+ bool mbWriter;
+
+ SvXMLExport& GetExport() { return mrExport; }
+ const SvXMLExport& GetExport() const { return mrExport; }
+
+ SAL_DLLPRIVATE void ImpExportText( const css::uno::Reference < css::table::XCell >& xCell );
+
+ void ExportCell( const css::uno::Reference < css::table::XCell >& xCell, const std::shared_ptr< XMLTableInfo >& pTableInfo, std::u16string_view sDefaultCellStyle );
+ void ExportTableColumns( const css::uno::Reference < css::container::XIndexAccess >& xtableColumns, const std::shared_ptr< XMLTableInfo >& pTableInfo );
+
+};
+
+class XMLOFF_DLLPUBLIC XMLCellStyleExport final : public XMLStyleExport
+{
+ using XMLStyleExport::XMLStyleExport;
+ virtual void exportStyleAttributes(const css::uno::Reference<css::style::XStyle>& rStyle) override;
+ virtual void exportStyleContent(const css::uno::Reference<css::style::XStyle>& rStyle) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/table/XMLTableImport.hxx b/include/xmloff/table/XMLTableImport.hxx
new file mode 100644
index 000000000..c0f702b5c
--- /dev/null
+++ b/include/xmloff/table/XMLTableImport.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_TABLE_XMLTABLEIMPORT_HXX
+#define INCLUDED_XMLOFF_TABLE_XMLTABLEIMPORT_HXX
+
+#include <com/sun/star/table/XColumnRowRange.hpp>
+
+#include <xmloff/dllapi.h>
+#include <xmloff/xmlictxt.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <xmloff/xmlimppr.hxx>
+#include <xmloff/prhdlfac.hxx>
+
+#include <rtl/ref.hxx>
+
+#include <map>
+#include <memory>
+
+class SvXMLStyleContext;
+
+typedef std::map< OUString, OUString > XMLTableTemplate;
+typedef std::map < OUString, std::shared_ptr< XMLTableTemplate > > XMLTableTemplateMap;
+
+class XMLOFF_DLLPUBLIC XMLTableImport final : public salhelper::SimpleReferenceObject
+{
+ friend class XMLTableImportContext;
+
+public:
+ XMLTableImport( SvXMLImport& rImport, const rtl::Reference< XMLPropertySetMapper >& xCellPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef );
+ virtual ~XMLTableImport() override;
+
+ SvXMLImportContext* CreateTableContext( css::uno::Reference< css::table::XColumnRowRange > const & xColumnRowRange );
+
+ SvXMLStyleContext* CreateTableTemplateContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList );
+
+ const rtl::Reference< SvXMLImportPropertyMapper >& GetCellImportPropertySetMapper() const { return mxCellImportPropertySetMapper; }
+ const rtl::Reference< SvXMLImportPropertyMapper >& GetRowImportPropertySetMapper() const { return mxRowImportPropertySetMapper; }
+ const rtl::Reference< SvXMLImportPropertyMapper >& GetColumnImportPropertySetMapper() const { return mxColumnImportPropertySetMapper; }
+
+ void addTableTemplate( const OUString& rsStyleName, XMLTableTemplate& xTableTemplate );
+ /// Inserts to the doc template with given name.
+ void insertTabletemplate( const OUString& rsStyleName, bool bOverwrite);
+ /// Inserts all table templates.
+ void finishStyles();
+
+private:
+ SvXMLImport& mrImport;
+ rtl::Reference< SvXMLImportPropertyMapper > mxCellImportPropertySetMapper;
+ rtl::Reference< SvXMLImportPropertyMapper > mxRowImportPropertySetMapper;
+ rtl::Reference< SvXMLImportPropertyMapper > mxColumnImportPropertySetMapper;
+
+ XMLTableTemplateMap maTableTemplates;
+};
+
+#endif // INCLUDED_XMLOFF_TABLE_XMLTABLEIMPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
new file mode 100644
index 000000000..0124bc8eb
--- /dev/null
+++ b/include/xmloff/txtimp.hxx
@@ -0,0 +1,443 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_TXTIMP_HXX
+#define INCLUDED_XMLOFF_TXTIMP_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <map>
+#include <memory>
+
+#include <salhelper/simplereferenceobject.hxx>
+
+class XMLTextListsHelper;
+class SvXMLImportContext;
+class SvXMLTokenMap;
+class SvXMLImportPropertyMapper;
+class SvXMLImport;
+class SvXMLStylesContext;
+class SvxXMLListStyleContext;
+class XMLPropStyleContext;
+class SvI18NMap;
+template<class A> class XMLPropertyBackpatcher;
+class XMLEventsImportContext;
+
+namespace xmloff {
+ struct ParsedRDFaAttributes;
+}
+
+namespace com::sun::star {
+namespace text {
+ class XText;
+ class XTextCursor;
+ class XTextRange;
+ class XTextContent;
+ class XFormField;
+}
+namespace frame { class XModel; }
+namespace container { class XNameContainer; class XIndexReplace; }
+namespace beans { class XPropertySet; }
+namespace xml::sax { class XAttributeList; }
+namespace xml::sax { class XFastAttributeList; }
+namespace util { struct DateTime; }
+}
+
+namespace rtl { template <class reference_type> class Reference; }
+
+enum XMLTextType
+{
+ Body,
+ Cell,
+ Shape,
+ TextBox,
+ HeaderFooter,
+ Section,
+ Footnote,
+ ChangedRegion
+};
+
+/// variable type (for XMLSetVarFieldImportContext)
+enum VarType
+{
+ VarTypeSimple,
+ VarTypeUserField,
+ VarTypeSequence
+ // see following NOTE!
+};
+
+// NOTE: these values must be distinct from any in "enum VarType" because they
+// are used as keys to SvI18NMap::Add()
+#define XML_TEXT_RENAME_TYPE_FRAME 10
+#define XML_TEXT_RENAME_TYPE_TABLE 20
+
+class XMLOFF_DLLPUBLIC XMLTextImportHelper : public salhelper::SimpleReferenceObject
+{
+private:
+ XMLTextImportHelper(const XMLTextImportHelper&) = delete;
+ XMLTextImportHelper& operator=(const XMLTextImportHelper&) = delete;
+
+ struct Impl;
+ std::unique_ptr<Impl> m_xImpl;
+ /// ugly, but implementation of this is in XMLPropertyBackpatcher.cxx
+ struct BackpatcherImpl;
+ std::shared_ptr<BackpatcherImpl> m_xBackpatcherImpl;
+ static std::shared_ptr<BackpatcherImpl> MakeBackpatcherImpl();
+
+protected:
+ virtual SvXMLImportContext *CreateTableChildContext(
+ SvXMLImport& rImport,
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList );
+
+ // access, lazy initialization and destruction of backpatchers
+ // Code is implemented in XMLPropertyBackpatcher.cxx
+ inline XMLPropertyBackpatcher<sal_Int16>& GetFootnoteBP();
+ inline XMLPropertyBackpatcher<sal_Int16>& GetSequenceIdBP();
+ inline XMLPropertyBackpatcher< OUString> & GetSequenceNameBP();
+
+public:
+
+ XMLTextImportHelper(
+ css::uno::Reference< css::frame::XModel > const& rModel,
+ SvXMLImport& rImport,
+ bool const bInsertMode = false, bool const bStylesOnlyMode = false,
+ bool const bProgress = false, bool const bBlockMode = false,
+ bool const bOrganizerMode = false);
+
+ virtual ~XMLTextImportHelper() override;
+
+ void dispose();
+
+ void SetCursor(
+ const css::uno::Reference< css::text::XTextCursor >& rCursor );
+ void ResetCursor();
+
+ void SetAutoStyles( SvXMLStylesContext *pStyles );
+
+ SvXMLImportContext *CreateTextChildContext(
+ SvXMLImport& rImport,
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
+ XMLTextType eType = XMLTextType::Shape );
+
+ css::uno::Reference< css::text::XText > & GetText();
+ css::uno::Reference< css::text::XTextCursor > & GetCursor();
+ css::uno::Reference< css::text::XTextRange > & GetCursorAsRange();
+
+ bool IsInsertMode() const;
+ bool IsStylesOnlyMode() const;
+ bool IsBlockMode() const;
+ bool IsOrganizerMode() const;
+ bool IsProgress() const;
+
+ OUString ConvertStarFonts( const OUString& rChars,
+ const OUString& rStyleName,
+ sal_uInt8& rFlags,
+ bool bPara,
+ SvXMLImport& rImport ) const;
+ // insert a string without special whitespace processing enabled
+ void InsertString( const OUString& rChars );
+ // insert a string with special whitespace processing enabled
+ void InsertString( const OUString& rChars,
+ bool& rIgnoreLeadingSpace );
+ // Delete current paragraph
+ void DeleteParagraph();
+
+ void InsertControlCharacter( sal_Int16 nControl );
+ void InsertTextContent( css::uno::Reference< css::text::XTextContent > const & xContent);
+
+ // Add parameter <bOutlineLevelAttrFound> (#i73509#)
+ // Add parameter <bSetListAttrs> in order to suppress the handling of the list attributes (#i80724#)
+ OUString SetStyleAndAttrs(
+ SvXMLImport const & rImport,
+ const css::uno::Reference< css::text::XTextCursor >& rCursor,
+ const OUString& rStyleName,
+ bool bPara,
+ bool bOutlineLevelAttrFound = false,
+ sal_Int8 nOutlineLevel = -1,
+ bool bSetListAttrs = true,
+ bool bOutlineContentVisible = true);
+
+ /** Find a suitable name for the given outline level.
+ * If rStyleName is empty, change it to a previously used or default style
+ * name for that level. Otherwise, leave rStyleName unmodified.
+ */
+ // Adjust 2nd parameter (#i69629#)
+ void FindOutlineStyleName( OUString& rStyleName,
+ sal_Int8 nOutlineLevel );
+
+ // Change method name to reflect change of data structure (#i69629#)
+ void AddOutlineStyleCandidate( const sal_Int8 nOutlineLevel,
+ const OUString& rStyleName );
+
+ void SetOutlineStyles( bool bSetEmpty );
+
+ void SetHyperlink(
+ SvXMLImport const & rImport,
+ const css::uno::Reference< css::text::XTextCursor >& rCursor,
+ const OUString& rHRef,
+ const OUString& rName,
+ const OUString& rTargetFrameName,
+ const OUString& rStyleName,
+ const OUString& rVisitedStyleName,
+ XMLEventsImportContext* pEvents);
+ void SetRuby(
+ SvXMLImport const & rImport,
+ const css::uno::Reference< css::text::XTextCursor >& rCursor,
+ const OUString& rStyleName,
+ const OUString& rTextStyleName,
+ const OUString& rText );
+
+ /// return key appropriate for use with NumberFormat property
+ /// return -1 if style is not found
+ /// (may return whether data style uses the system language)
+ sal_Int32 GetDataStyleKey( const OUString& sStyleName,
+ bool* pIsSystemLanguage = nullptr );
+
+ const SvxXMLListStyleContext *FindAutoListStyle(
+ const OUString& rName ) const;
+ XMLPropStyleContext *FindAutoFrameStyle(
+ const OUString& rName ) const;
+ XMLPropStyleContext* FindSectionStyle(
+ const OUString& rName ) const;
+ XMLPropStyleContext* FindPageMaster(
+ const OUString& rName ) const;
+ XMLPropStyleContext* FindDrawingPage(OUString const& rName) const;
+
+ const css::uno::Reference< css::container::XNameContainer> & GetParaStyles() const;
+
+ const css::uno::Reference< css::container::XNameContainer> & GetTextStyles() const;
+
+ const css::uno::Reference< css::container::XNameContainer> &
+ GetNumberingStyles() const;
+
+ const css::uno::Reference< css::container::XNameContainer> & GetFrameStyles() const;
+
+ const css::uno::Reference< css::container::XNameContainer> & GetPageStyles() const;
+
+ const css::uno::Reference< css::container::XNameContainer> & GetCellStyles() const;
+
+ const css::uno::Reference< css::container::XIndexReplace > &
+ GetChapterNumbering() const;
+
+ bool HasFrameByName( const OUString& rName ) const;
+
+ bool IsDuplicateFrame(const OUString& sName, sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight) const;
+ void StoreLastImportedFrameName(const OUString& rName);
+ void ClearLastImportedTextFrameName();
+
+ void ConnectFrameChains( const OUString& rFrmName,
+ const OUString& rNextFrmName,
+ const css::uno::Reference< css::beans::XPropertySet >& rFrmPropSet );
+
+ rtl::Reference< SvXMLImportPropertyMapper > const&
+ GetParaImportPropertySetMapper() const;
+ rtl::Reference< SvXMLImportPropertyMapper > const&
+ GetTextImportPropertySetMapper() const;
+ rtl::Reference< SvXMLImportPropertyMapper > const&
+ GetSectionImportPropertySetMapper() const;
+ rtl::Reference< SvXMLImportPropertyMapper > const&
+ GetRubyImportPropertySetMapper() const;
+
+ static SvXMLImportPropertyMapper *CreateShapeExtPropMapper(SvXMLImport&);
+ static SvXMLImportPropertyMapper *CreateParaExtPropMapper(SvXMLImport&);
+ static SvXMLImportPropertyMapper* CreateParaDefaultExtPropMapper(SvXMLImport&);
+ static SvXMLImportPropertyMapper* CreateTableDefaultExtPropMapper(SvXMLImport&);
+ static SvXMLImportPropertyMapper* CreateTableRowDefaultExtPropMapper(SvXMLImport&);
+ static SvXMLImportPropertyMapper* CreateTableCellExtPropMapper(SvXMLImport&);
+ static SvXMLImportPropertyMapper* CreateDrawingPageExtPropMapper(SvXMLImport&);
+
+ SvI18NMap& GetRenameMap();
+
+ /// save the start of a range reference
+ void InsertBookmarkStartRange(
+ const OUString & sName,
+ const css::uno::Reference< css::text::XTextRange> & rRange,
+ OUString const& i_rXmlId,
+ std::shared_ptr< ::xmloff::ParsedRDFaAttributes > &
+ i_rpRDFaAttributes);
+
+ /// process the start of a range reference
+ bool FindAndRemoveBookmarkStartRange(
+ const OUString & sName,
+ css::uno::Reference< css::text::XTextRange> & o_rRange,
+ OUString & o_rXmlId,
+ std::shared_ptr< ::xmloff::ParsedRDFaAttributes > & o_rpRDFaAttributes);
+
+ void pushFieldCtx( const OUString& name, const OUString& type );
+ css::uno::Reference<css::text::XFormField> popFieldCtx();
+ void addFieldParam( const OUString& name, const OUString& value );
+ void setCurrentFieldParamsTo(css::uno::Reference< css::text::XFormField> const &xFormField);
+ ::std::pair<OUString, OUString> getCurrentFieldType() const;
+ css::uno::Reference<css::text::XTextRange> getCurrentFieldStart() const;
+ bool hasCurrentFieldSeparator() const;
+ bool hasCurrentFieldCtx() const;
+
+
+ /// insert new footnote ID.
+ /// Also fixup open references from the backpatch list to this ID.
+ // Code is implemented in XMLPropertyBackpatcher.cxx
+ void InsertFootnoteID(const OUString& sXMLId, sal_Int16 nAPIId);
+
+ /// set the proper footnote reference ID,
+ /// or put into backpatch list if ID is unknown
+ // Code is implemented in XMLPropertyBackpatcher.cxx
+ void ProcessFootnoteReference(
+ const OUString& sXMLId,
+ const css::uno::Reference< css::beans::XPropertySet> & xPropSet);
+
+ /// insert new sequence ID
+ /// Also fixup open references from backpatch list to this ID.
+ // Code is implemented in XMLPropertyBackpatcher.cxx
+ void InsertSequenceID(const OUString& sXMLId,
+ const OUString& sName,
+ sal_Int16 nAPIId);
+
+ /// set sequence ID or insert into backpatch list
+ // Code is implemented in XMLPropertyBackpatcher.cxx
+ void ProcessSequenceReference(
+ const OUString& sXMLId,
+ const css::uno::Reference< css::beans::XPropertySet> & xPropSet);
+
+ bool IsInFrame() const;
+ virtual bool IsInHeaderFooter() const;
+
+ virtual css::uno::Reference< css::beans::XPropertySet>
+ createAndInsertOLEObject( SvXMLImport& rImport,
+ const OUString& rHRef,
+ const OUString &rStyleName,
+ const OUString &rTblName,
+ sal_Int32 nWidth, sal_Int32 nHeight );
+
+ virtual css::uno::Reference< css::beans::XPropertySet>
+ createAndInsertOOoLink( SvXMLImport& rImport,
+ const OUString& rHRef,
+ const OUString &rStyleName,
+ const OUString &rTblName,
+ sal_Int32 nWidth, sal_Int32 nHeight );
+
+ virtual css::uno::Reference< css::beans::XPropertySet>
+ createAndInsertApplet(
+ const OUString &rName,
+ const OUString &rCode,
+ bool bMayScript,
+ const OUString& rHRef,
+ sal_Int32 nWidth, sal_Int32 nHeight );
+
+ virtual css::uno::Reference< css::beans::XPropertySet>
+ createAndInsertPlugin(
+ const OUString &rMimeType,
+ const OUString& rHRef,
+ sal_Int32 nWidth, sal_Int32 nHeight );
+
+ virtual css::uno::Reference< css::beans::XPropertySet>
+ createAndInsertFloatingFrame(
+ const OUString &rName,
+ const OUString &rHRef,
+ const OUString &rStyleName,
+ sal_Int32 nWidth, sal_Int32 nHeight );
+
+ virtual void endAppletOrPlugin(
+ const css::uno::Reference< css::beans::XPropertySet> &rPropSet,
+ ::std::map < const OUString, OUString > &rParamMap );
+
+ // applet helper methods
+ // implemented in sw/filter/xml/txtparai.hxx
+
+ // redlining helper methods
+ // (to be implemented in sw/filter/xml/txtparai.hxx)
+
+ virtual void RedlineAdd(
+ /// redline type (insert, del,... )
+ const OUString& rType,
+ /// use to identify this redline
+ const OUString& rId,
+ /// name of the author
+ const OUString& rAuthor,
+ /// redline comment
+ const OUString& rComment,
+ /// date+time
+ const css::util::DateTime& rDateTime,
+ /// merge last paras
+ bool bMergeLastParagraph);
+
+ virtual css::uno::Reference< css::text::XTextCursor> RedlineCreateText(
+ /// needed to get the document
+ css::uno::Reference< css::text::XTextCursor > & rOldCursor,
+ /// ID used to RedlineAdd() call
+ const OUString& rId);
+
+ virtual void RedlineSetCursor(
+ /// ID used to RedlineAdd() call
+ const OUString& rId,
+ /// start or end Cursor
+ bool bStart,
+ /// range is not within <text:p>
+ bool bIsOutsideOfParagraph);
+
+ virtual void RedlineAdjustStartNodeCursor();
+ virtual void SetShowChanges( bool bShowChanges );
+ virtual void SetRecordChanges( bool bRecordChanges );
+ virtual void SetChangesProtectionKey(
+ const css::uno::Sequence<sal_Int8> & rProtectionKey );
+
+ /// get the last open redline ID
+ OUString const & GetOpenRedlineId() const;
+ /// modify the last open redline ID
+ void SetOpenRedlineId( OUString const & rId);
+ /// reset the last open redline ID
+ void ResetOpenRedlineId();
+
+ /** redlining : Setter to remember the fact we are inside/outside
+ * a <text:deletion> element (deleted redline section) */
+ void SetInsideDeleteContext(bool const bNew);
+ /** redlining : Getter to know if we are inside
+ * a <text:deletion> element (deleted redline section) */
+ bool IsInsideDeleteContext() const;
+
+ SvXMLImport & GetXMLImport();
+
+ XMLTextListsHelper & GetTextListHelper();
+
+ // forwards to TextListHelper; these are used in many places
+ /// push a list context on the list context stack
+ void PushListContext();
+ /// pop the list context stack
+ void PopListContext();
+
+ void SetCellParaStyleDefault(OUString const& rNewValue);
+ OUString const& GetCellParaStyleDefault() const;
+
+ void AddCrossRefHeadingMapping(OUString const& rFrom, OUString const& rTo);
+ void MapCrossRefHeadingFieldsHorribly();
+
+ void setBookmarkAttributes(OUString const& bookmark, bool hidden, OUString const& condition);
+ bool getBookmarkHidden(OUString const& bookmark) const;
+ const OUString& getBookmarkCondition(OUString const& bookmark) const;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/txtimppr.hxx b/include/xmloff/txtimppr.hxx
new file mode 100644
index 000000000..860c86961
--- /dev/null
+++ b/include/xmloff/txtimppr.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_TXTIMPPR_HXX
+#define INCLUDED_XMLOFF_TXTIMPPR_HXX
+
+#include <xmloff/dllapi.h>
+#include <xmloff/xmlimppr.hxx>
+#include <optional>
+
+class XMLOFF_DLLPUBLIC XMLTextImportPropertyMapper final : public SvXMLImportPropertyMapper
+{
+ sal_Int32 nSizeTypeIndex;
+ sal_Int32 nWidthTypeIndex;
+
+ static void FontFinished(
+ XMLPropertyState *pFontFamilyNameState,
+ XMLPropertyState *pFontStyleNameState,
+ XMLPropertyState *pFontFamilyState,
+ XMLPropertyState *pFontPitchState,
+ XMLPropertyState *pFontCharsetState );
+
+ void FontDefaultsCheck(
+ XMLPropertyState const * pFontFamilyName,
+ XMLPropertyState const * pFontStyleName,
+ XMLPropertyState const * pFontFamily,
+ XMLPropertyState const * pFontPitch,
+ XMLPropertyState const * pFontCharSet,
+ std::optional<XMLPropertyState>* ppNewFontStyleName,
+ std::optional<XMLPropertyState>* ppNewFontFamily,
+ std::optional<XMLPropertyState>* ppNewFontPitch,
+ std::optional<XMLPropertyState>* ppNewFontCharSet ) const;
+
+ virtual bool handleSpecialItem(
+ XMLPropertyState& rProperty,
+ ::std::vector< XMLPropertyState >& rProperties,
+ const OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const override;
+public:
+ XMLTextImportPropertyMapper(
+ const rtl::Reference< XMLPropertySetMapper >& rMapper,
+ SvXMLImport& rImport );
+ virtual ~XMLTextImportPropertyMapper() override;
+
+ /** This method is called when all attributes have benn processed. It may be used to remove items that are incomplete */
+ virtual void finished(
+ ::std::vector< XMLPropertyState >& rProperties,
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override;
+};
+
+#endif // INCLUDED_XMLOFF_TXTIMPPR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx
new file mode 100644
index 000000000..e474a9c5b
--- /dev/null
+++ b/include/xmloff/txtparae.hxx
@@ -0,0 +1,582 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_TXTPARAE_HXX
+#define INCLUDED_XMLOFF_TXTPARAE_HXX
+
+#include <sal/config.h>
+#include <rtl/ref.hxx>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <xmloff/styleexp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/SinglePropertySetInfoCache.hxx>
+#include <xmloff/XMLTextListAutoStylePool.hxx>
+#include <o3tl/span.hxx>
+#include <memory>
+#include <vector>
+
+class XMLTextListsHelper;
+class SvXMLExport;
+class SvXMLAutoStylePoolP;
+class XMLTextFieldExport;
+class XMLTextNumRuleInfo;
+class XMLSectionExport;
+class XMLIndexMarkExport;
+class XMLRedlineExport;
+struct XMLPropertyState;
+class MultiPropertySetHelper;
+enum class XMLShapeExportFlags;
+class SvXMLExportPropertyMapper;
+
+namespace com::sun::star
+{
+ namespace beans { class XPropertySet; class XPropertyState;
+ class XPropertySetInfo; }
+ namespace container { class XEnumeration; class XIndexAccess; class XNameReplace; }
+ namespace text { class XTextContent; class XTextRange; class XText;
+ class XFootnote; class XTextFrame; class XTextSection;
+ class XTextField; }
+}
+
+namespace xmloff
+{
+ class OFormLayerXMLExport;
+ class BoundFrameSets;
+
+}
+
+namespace basegfx
+{
+ class B2DPoint;
+}
+
+enum class TextPNS
+{
+ ODF,
+ EXTENSION
+};
+
+class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport
+{
+ struct Impl;
+ std::unique_ptr<Impl> m_xImpl;
+
+// SvXMLExport& rExport;
+ SvXMLAutoStylePoolP& rAutoStylePool;
+ rtl::Reference < SvXMLExportPropertyMapper > xParaPropMapper;
+ rtl::Reference < SvXMLExportPropertyMapper > xTextPropMapper;
+ rtl::Reference < SvXMLExportPropertyMapper > xFramePropMapper;
+ rtl::Reference < SvXMLExportPropertyMapper > xAutoFramePropMapper;
+ rtl::Reference < SvXMLExportPropertyMapper > xSectionPropMapper;
+ rtl::Reference < SvXMLExportPropertyMapper > xRubyPropMapper;
+
+ const ::std::unique_ptr< ::xmloff::BoundFrameSets > pBoundFrameSets;
+ std::unique_ptr<XMLTextFieldExport> pFieldExport;
+ std::vector<OUString> maListElements;
+ XMLTextListAutoStylePool maListAutoPool;
+ std::unique_ptr<XMLSectionExport> pSectionExport;
+ std::unique_ptr<XMLIndexMarkExport> pIndexMarkExport;
+
+ /// may be NULL (if no redlines should be exported; e.g. in block mode)
+ std::unique_ptr<XMLRedlineExport> pRedlineExport;
+
+ bool bProgress;
+
+ bool bBlock;
+
+ // keep track of open rubies
+ OUString sOpenRubyText;
+ OUString sOpenRubyCharStyle;
+ bool bOpenRuby;
+
+ XMLTextListsHelper* mpTextListsHelper;
+ ::std::vector< std::unique_ptr<XMLTextListsHelper> > maTextListsHelperStack;
+
+ bool mbCollected;
+
+ enum class FrameType { Text, Graphic, Embedded, Shape };
+public:
+
+ enum FieldmarkType { NONE, TEXT, CHECK }; // Used for simulating fieldmarks in OpenDocument 1.n Strict (for n <= 2). CHECK currently ignored.
+
+
+ void exportTextRangeSpan(
+ const css::uno::Reference< css::text::XTextRange > & rTextRange,
+ css::uno::Reference< css::beans::XPropertySet > const & xPropSet,
+ css::uno::Reference < css::beans::XPropertySetInfo > & xPropSetInfo,
+ const bool bIsUICharStyle,
+ const bool bHasAutoStyle,
+ const OUString& sStyle,
+ bool& rPrevCharIsSpace,
+ FieldmarkType& openFieldMark);
+
+private:
+
+ // Implement Title/Description Elements UI (#i73249#)
+ static constexpr OUStringLiteral gsAnchorCharStyleName = u"AnchorCharStyleName";
+ static constexpr OUStringLiteral gsBeginNotice = u"BeginNotice";
+ static constexpr OUStringLiteral gsCategory = u"Category";
+ static constexpr OUStringLiteral gsCharStyleName = u"CharStyleName";
+ static constexpr OUStringLiteral gsCharStyleNames = u"CharStyleNames";
+ static constexpr OUStringLiteral gsEndNotice = u"EndNotice";
+ static constexpr OUStringLiteral gsFootnote = u"Footnote";
+ static constexpr OUStringLiteral gsFootnoteCounting = u"FootnoteCounting";
+ static constexpr OUStringLiteral gsNumberingType = u"NumberingType";
+ static constexpr OUStringLiteral gsPageDescName = u"PageDescName";
+ static constexpr OUStringLiteral gsPageStyleName = u"PageStyleName";
+ static constexpr OUStringLiteral gsParaStyleName = u"ParaStyleName";
+ static constexpr OUStringLiteral gsPositionEndOfDoc = u"PositionEndOfDoc";
+ static constexpr OUStringLiteral gsPrefix = u"Prefix";
+ static constexpr OUStringLiteral gsReferenceId = u"ReferenceId";
+ static constexpr OUStringLiteral gsStartAt = u"StartAt";
+ static constexpr OUStringLiteral gsSuffix = u"Suffix";
+ static constexpr OUStringLiteral gsTextEndnoteService = u"com.sun.star.text.Endnote";
+ static constexpr OUStringLiteral gsTextSection = u"TextSection";
+
+protected:
+ static constexpr OUStringLiteral gsFrameStyleName = u"FrameStyleName";
+ SinglePropertySetInfoCache aCharStyleNamesPropInfoCache;
+
+ SvXMLAutoStylePoolP& GetAutoStylePool() { return rAutoStylePool; }
+ const SvXMLAutoStylePoolP& GetAutoStylePool() const { return rAutoStylePool; }
+
+public:
+ const rtl::Reference < SvXMLExportPropertyMapper >& GetParaPropMapper() const
+ {
+ return xParaPropMapper;
+ }
+
+ const rtl::Reference < SvXMLExportPropertyMapper >& GetTextPropMapper() const
+ {
+ return xTextPropMapper;
+ }
+
+ const rtl::Reference < SvXMLExportPropertyMapper >& GetAutoFramePropMapper() const
+ {
+ return xAutoFramePropMapper;
+ }
+ const rtl::Reference < SvXMLExportPropertyMapper >& GetSectionPropMapper() const
+ {
+ return xSectionPropMapper;
+ }
+ const rtl::Reference < SvXMLExportPropertyMapper >& GetRubyPropMapper() const
+ {
+ return xRubyPropMapper;
+ }
+
+ OUString FindTextStyle(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ bool& rbHasCharStyle,
+ bool& rbHasAutoStyle,
+ const XMLPropertyState** pAddState = nullptr) const;
+
+ void exportTextRangeEnumeration(
+ const css::uno::Reference< css::container::XEnumeration > & rRangeEnum,
+ bool bAutoStyles, bool bProgress, bool & rPrevCharIsSpace);
+
+protected:
+
+ XMLShapeExportFlags addTextFrameAttributes(
+ const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
+ bool bShape,
+ basegfx::B2DPoint* pCenter = nullptr,
+ OUString *pMinHeightValue = nullptr,
+ OUString *pMinWidthValue = nullptr );
+
+ virtual void exportStyleAttributes(
+ const css::uno::Reference< css::style::XStyle > & rStyle ) override;
+
+ void exportPageFrames( bool bProgress );
+ void exportFrameFrames( bool bAutoStyles, bool bProgress,
+ const css::uno::Reference< css::text::XTextFrame > *pParentTxtFrame );
+
+ void exportNumStyles( bool bUsed );
+
+ void exportText(
+ const css::uno::Reference <
+ css::text::XText > & rText,
+ bool bAutoStyles, bool bProgress, bool bExportParagraph, TextPNS eExtensionNS = TextPNS::ODF );
+
+ void exportText(
+ const css::uno::Reference< css::text::XText > & rText,
+ const css::uno::Reference< css::text::XTextSection > & rBaseSection,
+ bool bAutoStyles, bool bProgress, bool bExportParagraph );
+
+ void exportTextContentEnumeration(
+ const css::uno::Reference< css::container::XEnumeration > & rContentEnum,
+ bool bAutoStyles,
+ const css::uno::Reference< css::text::XTextSection > & rBaseSection,
+ bool bProgress,
+ bool bExportParagraph = true,
+ const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet = nullptr,
+ TextPNS eExtensionNS = TextPNS::ODF);
+ void exportParagraph(
+ const css::uno::Reference< css::text::XTextContent > & rTextContent,
+ bool bAutoStyles, bool bProgress,
+ bool bExportParagraph,
+ MultiPropertySetHelper& rPropSetHelper,
+ TextPNS eExtensionNS);
+
+ virtual void exportTable(
+ const css::uno::Reference< css::text::XTextContent > & rTextContent,
+ bool bAutoStyles, bool bProgress );
+
+ void exportTextField(
+ const css::uno::Reference< css::text::XTextRange > & rTextRange,
+ bool bAutoStyles, bool bProgress, bool * pPrevCharIsSpace);
+
+ void exportTextField(
+ const css::uno::Reference< css::text::XTextField> & xTextField,
+ const bool bAutoStyles, const bool bProgress,
+ const bool bRecursive, bool * pPrevCharIsSpace);
+
+ void exportAnyTextFrame(
+ const css::uno::Reference< css::text::XTextContent > & rTextContent,
+ FrameType eTxpe,
+ bool bAutoStyles, bool bProgress, bool bExportContent,
+ const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet );
+ void _exportTextFrame(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ const css::uno::Reference< css::beans::XPropertySetInfo > & rPropSetInfo,
+ bool bProgress );
+ inline void exportTextFrame(
+ const css::uno::Reference< css::text::XTextContent > & rTextContent,
+ bool bAutoStyles, bool bProgress, bool bExportContent,
+ const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet = nullptr );
+ inline void exportShape(
+ const css::uno::Reference< css::text::XTextContent > & rTextContent,
+ bool bAutoStyles,
+ const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet = nullptr );
+
+ void exportContour(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ const css::uno::Reference< css::beans::XPropertySetInfo > & rPropSetInfo );
+ void _exportTextGraphic(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ const css::uno::Reference< css::beans::XPropertySetInfo > & rPropSetInfo );
+ inline void exportTextGraphic(
+ const css::uno::Reference< css::text::XTextContent > & rTextContent,
+ bool bAutoStyles,
+ const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet = nullptr );
+
+ virtual void _collectTextEmbeddedAutoStyles(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet );
+ virtual void _exportTextEmbedded(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ const css::uno::Reference< css::beans::XPropertySetInfo > & rPropSetInfo );
+ inline void exportTextEmbedded(
+ const css::uno::Reference< css::text::XTextContent > & rTextContent,
+ bool bAutoStyles,
+ const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet = nullptr );
+
+ /// export a footnote and styles
+ void exportTextFootnote(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ const OUString& sString,
+ bool bAutoStyles, bool bProgress );
+
+ /// helper for exportTextFootnote
+ void exportTextFootnoteHelper(
+ const css::uno::Reference< css::text::XFootnote > & rPropSet,
+ const css::uno::Reference< css::text::XText> & rText,
+ const OUString& sString,
+ bool bAutoStyles,
+ bool bIsEndnote, bool bProgress );
+
+ /// export footnote and endnote configuration elements
+ void exportTextFootnoteConfiguration();
+
+ void exportTextFootnoteConfigurationHelper(
+ const css::uno::Reference< css::beans::XPropertySet> & rFootnoteSupplier,
+ bool bIsEndnote);
+
+ void exportTextMark(
+ const css::uno::Reference< css::beans::XPropertySet> & xPropSet,
+ const OUString& rProperty,
+ const enum ::xmloff::token::XMLTokenEnum pElements[],
+ bool bAutoStyles);
+
+ void exportSoftPageBreak();
+
+ void exportTextLineBreak(const css::uno::Reference<css::beans::XPropertySet>& xPropSet);
+
+ void exportTextRange(
+ const css::uno::Reference< css::text::XTextRange > & rTextRange,
+ bool bAutoStyles,
+ bool& rPrevCharWasSpace,
+ FieldmarkType& openFieldmarkType );
+
+ void exportListChange( const XMLTextNumRuleInfo& rPrvInfo,
+ const XMLTextNumRuleInfo& rNextInfo );
+
+ /// check if current section or current list has changed;
+ /// calls exportListChange as appropriate
+ void exportListAndSectionChange(
+ css::uno::Reference< css::text::XTextSection > & rOldSection,
+ const css::uno::Reference< css::text::XTextSection > & rNewSection,
+ const XMLTextNumRuleInfo& rOldList,
+ const XMLTextNumRuleInfo& rNewList,
+ bool bAutoStyles );
+
+ /// overload for exportListAndSectionChange;
+ /// takes new content rather than new section.
+ void exportListAndSectionChange(
+ css::uno::Reference< css::text::XTextSection > & rOldSection,
+ const css::uno::Reference< css::text::XTextContent > & rNewContent,
+ const XMLTextNumRuleInfo& rOldList,
+ const XMLTextNumRuleInfo& rNewList,
+ bool bAutoStyles );
+ void exportListAndSectionChange(
+ css::uno::Reference< css::text::XTextSection > & rOldSection,
+ MultiPropertySetHelper& rPropSetHelper,
+ sal_Int16 nTextSectionId,
+ const css::uno::Reference< css::text::XTextContent > & rNewContent,
+ const XMLTextNumRuleInfo& rOldList,
+ const XMLTextNumRuleInfo& rNewList,
+ bool bAutoStyles );
+
+ /// export a ruby
+ void exportRuby(
+ const css::uno::Reference< css::beans::XPropertySet> & rPortionPropSet,
+ bool bAutoStyles );
+
+ /// export a text:meta
+ void exportMeta(
+ const css::uno::Reference< css::beans::XPropertySet> & i_xPortion,
+ bool i_bAutoStyles, bool i_isProgress, bool & rPrevCharIsSpace);
+
+ /// Exports a <loext:content-control> element.
+ void ExportContentControl(const css::uno::Reference<css::beans::XPropertySet>& xPortion,
+ bool bAutoStyles, bool isProgress, bool& rPrevCharIsSpace);
+
+ bool isAutoStylesCollected() const { return mbCollected; }
+
+ virtual void exportTableAutoStyles();
+
+public:
+
+ XMLTextParagraphExport(
+ SvXMLExport& rExp,
+ SvXMLAutoStylePoolP & rASP
+ );
+ virtual ~XMLTextParagraphExport() override;
+
+ /// add autostyle for specified family
+ void Add(
+ XmlStyleFamily nFamily,
+ MultiPropertySetHelper& rPropSetHelper,
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet );
+ void Add(
+ XmlStyleFamily nFamily,
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ o3tl::span<const XMLPropertyState> aAddStates = {}, bool bDontSeek = false );
+
+ /// find style name for specified family and parent
+ OUString Find(
+ XmlStyleFamily nFamily,
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ const OUString& rParent,
+ const o3tl::span<const XMLPropertyState> aAddStates = {} ) const;
+
+ static SvXMLExportPropertyMapper *CreateShapeExtPropMapper(
+ SvXMLExport& rExport );
+ static SvXMLExportPropertyMapper *CreateCharExtPropMapper(
+ SvXMLExport& rExport);
+ static SvXMLExportPropertyMapper *CreateParaExtPropMapper(
+ SvXMLExport& rExport);
+ static SvXMLExportPropertyMapper *CreateParaDefaultExtPropMapper(
+ SvXMLExport& rExport);
+
+ // This methods exports all (or all used) styles
+ void exportTextStyles( bool bUsed, bool bProg );
+
+ /// This method exports (text field) declarations etc.
+ void exportTextDeclarations();
+
+ /// export the (text field) declarations for a particular XText
+ void exportTextDeclarations(
+ const css::uno::Reference< css::text::XText > & rText );
+
+ /// export all declarations
+ void exportUsedDeclarations();
+
+ /// Export the list of change information (enclosed by <tracked-changes>)
+ /// (or the necessary automatic styles)
+ void exportTrackedChanges(bool bAutoStyle);
+
+ /// Export the list of change information (enclosed by <tracked-changes>)
+ /// (or the necessary automatic styles)
+ void exportTrackedChanges(const css::uno::Reference< css::text::XText > & rText,
+ bool bAutoStyle );
+
+ /// Record tracked changes for this particular XText
+ /// (empty reference stop recording)
+ /// This should be used if tracked changes for e.g. footers are to
+ /// be exported separately via the exportTrackedChanges(bool,
+ /// Reference<XText>) method.
+ void recordTrackedChangesForXText(
+ const css::uno::Reference< css::text::XText > & rText );
+
+
+ /// Stop recording tracked changes.
+ /// This is the same as calling recordTrackedChanges(...) with an
+ /// empty reference.
+ void recordTrackedChangesNoXText();
+
+
+ // This method exports the given OUString
+ void exportCharacterData(
+ const OUString& rText,
+ bool& rPrevCharWasSpace);
+
+ // This method collects all automatic styles for the given XText
+ void collectTextAutoStyles(
+ const css::uno::Reference< css::text::XText > & rText,
+ bool bIsProgress = false,
+ bool bExportParagraph = true )
+ {
+ exportText( rText, true, bIsProgress, bExportParagraph );
+ }
+
+ void collectTextAutoStyles(
+ const css::uno::Reference< css::text::XText > & rText,
+ const css::uno::Reference< css::text::XTextSection > & rBaseSection,
+ bool bIsProgress )
+ {
+ exportText( rText, rBaseSection, true, bIsProgress, true/*bExportParagraph*/ );
+ }
+
+ // It the model implements the xAutoStylesSupplier interface, the automatic
+ // styles can exported without iterating over the text portions
+ void collectTextAutoStylesOptimized( bool bIsProgress );
+
+ // This method exports all automatic styles that have been collected.
+ void exportTextAutoStyles();
+
+ void exportEvents( const css::uno::Reference< css::beans::XPropertySet > & rPropSet );
+
+ // Implement Title/Description Elements UI (#i73249#)
+ void exportTitleAndDescription( const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ const css::uno::Reference< css::beans::XPropertySetInfo > & rPropSetInfo );
+
+ // This method exports the given XText
+ void exportText(
+ const css::uno::Reference< css::text::XText > & rText,
+ bool bIsProgress = false,
+ bool bExportParagraph = true, TextPNS eExtensionNS = TextPNS::ODF)
+ {
+ exportText( rText, false, bIsProgress, bExportParagraph, eExtensionNS );
+ }
+
+ void exportText(
+ const css::uno::Reference< css::text::XText > & rText,
+ const css::uno::Reference< css::text::XTextSection > & rBaseSection,
+ bool bIsProgress)
+ {
+ exportText( rText, rBaseSection, false, bIsProgress, true/*bExportParagraph*/ );
+ }
+
+ void exportFramesBoundToPage( bool bIsProgress )
+ {
+ exportPageFrames( bIsProgress );
+ }
+ inline const XMLTextListAutoStylePool& GetListAutoStylePool() const;
+
+ void SetBlockMode( bool bSet ) { bBlock = bSet; }
+ bool IsBlockMode() const { return bBlock; }
+
+
+ const rtl::Reference < SvXMLExportPropertyMapper >& GetParagraphPropertyMapper() const
+ {
+ return xParaPropMapper;
+ }
+
+
+ /** exclude form controls which are in mute sections.
+ *
+ * This method is necessary to prevent the form layer export from exporting
+ * control models whose controls are not represented in the document. To
+ * achieve this, this method iterates over all shapes, checks to see if
+ * they are control shapes, and if so, whether they should be exported or
+ * not. If not, the form layer export will be notified accordingly.
+ *
+ * The reason this method is located here is that it needs to access the
+ * XMLSectionExport, which is only available here.
+ */
+ void PreventExportOfControlsInMuteSections(
+ const css::uno::Reference< css::container::XIndexAccess> & rShapes,
+ const rtl::Reference<xmloff::OFormLayerXMLExport>& xFormExport );
+
+ SinglePropertySetInfoCache& GetCharStyleNamesPropInfoCache() { return aCharStyleNamesPropInfoCache; }
+
+ void PushNewTextListsHelper();
+
+ void PopTextListsHelper();
+
+private:
+ XMLTextParagraphExport(XMLTextParagraphExport const &) = delete;
+};
+
+inline const XMLTextListAutoStylePool&
+ XMLTextParagraphExport::GetListAutoStylePool() const
+{
+ return maListAutoPool;
+}
+
+inline void XMLTextParagraphExport::exportTextFrame(
+ const css::uno::Reference< css::text::XTextContent > & rTextContent,
+ bool bAutoStyles, bool bIsProgress, bool bExportContent,
+ const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet)
+{
+ exportAnyTextFrame( rTextContent, FrameType::Text, bAutoStyles, bIsProgress,
+ bExportContent, pRangePropSet );
+}
+
+inline void XMLTextParagraphExport::exportTextGraphic(
+ const css::uno::Reference< css::text::XTextContent > & rTextContent,
+ bool bAutoStyles,
+ const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet )
+{
+ exportAnyTextFrame( rTextContent, FrameType::Graphic, bAutoStyles, false,
+ true, pRangePropSet );
+}
+
+inline void XMLTextParagraphExport::exportTextEmbedded(
+ const css::uno::Reference< css::text::XTextContent > & rTextContent,
+ bool bAutoStyles,
+ const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet )
+{
+ exportAnyTextFrame( rTextContent, FrameType::Embedded, bAutoStyles, false,
+ true, pRangePropSet );
+}
+
+inline void XMLTextParagraphExport::exportShape(
+ const css::uno::Reference< css::text::XTextContent > & rTextContent,
+ bool bAutoStyles,
+ const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet )
+{
+ exportAnyTextFrame( rTextContent, FrameType::Shape, bAutoStyles, false,
+ true, pRangePropSet );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/txtprmap.hxx b/include/xmloff/txtprmap.hxx
new file mode 100644
index 000000000..37c0d7a9f
--- /dev/null
+++ b/include/xmloff/txtprmap.hxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_TXTPRMAP_HXX
+#define INCLUDED_XMLOFF_TXTPRMAP_HXX
+
+#include <xmloff/contextid.hxx>
+#include <xmloff/xmlprmap.hxx>
+
+#define CTF_CHARHEIGHT (XML_TEXT_CTF_START + 1)
+#define CTF_CHARHEIGHT_REL (XML_TEXT_CTF_START + 2)
+#define CTF_PARALEFTMARGIN (XML_TEXT_CTF_START + 3)
+#define CTF_PARALEFTMARGIN_REL (XML_TEXT_CTF_START + 4)
+#define CTF_PARARIGHTMARGIN (XML_TEXT_CTF_START + 5)
+#define CTF_PARARIGHTMARGIN_REL (XML_TEXT_CTF_START + 6)
+#define CTF_PARAFIRSTLINE (XML_TEXT_CTF_START + 7)
+#define CTF_PARAFIRSTLINE_REL (XML_TEXT_CTF_START + 8)
+#define CTF_PARATOPMARGIN (XML_TEXT_CTF_START + 9)
+#define CTF_PARATOPMARGIN_REL (XML_TEXT_CTF_START + 10)
+#define CTF_PARABOTTOMMARGIN (XML_TEXT_CTF_START + 11)
+#define CTF_PARABOTTOMMARGIN_REL (XML_TEXT_CTF_START + 12)
+#define CTF_ALLBORDERWIDTH (XML_TEXT_CTF_START + 13)
+#define CTF_LEFTBORDERWIDTH (XML_TEXT_CTF_START + 14)
+#define CTF_RIGHTBORDERWIDTH (XML_TEXT_CTF_START + 15)
+#define CTF_TOPBORDERWIDTH (XML_TEXT_CTF_START + 16)
+#define CTF_BOTTOMBORDERWIDTH (XML_TEXT_CTF_START + 17)
+#define CTF_ALLBORDERDISTANCE (XML_TEXT_CTF_START + 18)
+#define CTF_LEFTBORDERDISTANCE (XML_TEXT_CTF_START + 19)
+#define CTF_RIGHTBORDERDISTANCE (XML_TEXT_CTF_START + 20)
+#define CTF_TOPBORDERDISTANCE (XML_TEXT_CTF_START + 21)
+#define CTF_BOTTOMBORDERDISTANCE (XML_TEXT_CTF_START + 22)
+#define CTF_ALLBORDER (XML_TEXT_CTF_START + 23)
+#define CTF_LEFTBORDER (XML_TEXT_CTF_START + 24)
+#define CTF_RIGHTBORDER (XML_TEXT_CTF_START + 25)
+#define CTF_TOPBORDER (XML_TEXT_CTF_START + 26)
+#define CTF_BOTTOMBORDER (XML_TEXT_CTF_START + 27)
+#define CTF_DROPCAPWHOLEWORD (XML_TEXT_CTF_START + 28)
+#define CTF_DROPCAPFORMAT (XML_TEXT_CTF_START + 29)
+#define CTF_DROPCAPCHARSTYLE (XML_TEXT_CTF_START + 30)
+#define CTF_TABSTOP (XML_TEXT_CTF_START + 31)
+#define CTF_NUMBERINGSTYLENAME (XML_TEXT_CTF_START + 32)
+#define CTF_OLDTEXTBACKGROUND (XML_TEXT_CTF_START + 33)
+#define CTF_FONTFAMILYNAME (XML_TEXT_CTF_START + 34)
+#define CTF_FONTSTYLENAME (XML_TEXT_CTF_START + 35)
+#define CTF_FONTFAMILY (XML_TEXT_CTF_START + 36)
+#define CTF_FONTPITCH (XML_TEXT_CTF_START + 37)
+#define CTF_FONTCHARSET (XML_TEXT_CTF_START + 38)
+#define CTF_TEXTWRITINGMODE (XML_TEXT_CTF_START + 39)
+#define CTF_SYNCHEIGHT_MIN (XML_TEXT_CTF_START + 40)
+#define CTF_FRAMEHEIGHT_ABS (XML_TEXT_CTF_START + 41)
+#define CTF_FRAMEHEIGHT_REL (XML_TEXT_CTF_START + 42)
+#define CTF_FRAMEHEIGHT_MIN_ABS (XML_TEXT_CTF_START + 43)
+#define CTF_FRAMEHEIGHT_MIN_REL (XML_TEXT_CTF_START + 44)
+#define CTF_SIZETYPE (XML_TEXT_CTF_START + 45)
+#define CTF_SYNCHEIGHT (XML_TEXT_CTF_START + 46)
+#define CTF_WRAP (XML_TEXT_CTF_START + 47)
+#define CTF_WRAP_CONTOUR (XML_TEXT_CTF_START + 48)
+#define CTF_WRAP_CONTOUR_MODE (XML_TEXT_CTF_START + 49)
+#define CTF_WRAP_PARAGRAPH_ONLY (XML_TEXT_CTF_START + 50)
+#define CTF_ANCHORTYPE (XML_TEXT_CTF_START + 51)
+#define CTF_ANCHORPAGENUMBER (XML_TEXT_CTF_START + 52)
+#define CTF_TEXTCOLUMNS (XML_TEXT_CTF_START + 53)
+#define CTF_HORIZONTALPOS (XML_TEXT_CTF_START + 54)
+#define CTF_HORIZONTALPOS_MIRRORED (XML_TEXT_CTF_START + 55)
+#define CTF_HORIZONTALREL (XML_TEXT_CTF_START + 56)
+#define CTF_HORIZONTALREL_FRAME (XML_TEXT_CTF_START + 57)
+#define CTF_HORIZONTALMIRROR (XML_TEXT_CTF_START + 58)
+#define CTF_VERTICALPOS (XML_TEXT_CTF_START + 59)
+#define CTF_VERTICALREL (XML_TEXT_CTF_START + 60)
+#define CTF_VERTICALREL_PAGE (XML_TEXT_CTF_START + 61)
+#define CTF_VERTICALREL_FRAME (XML_TEXT_CTF_START + 62)
+#define CTF_VERTICALREL_ASCHAR (XML_TEXT_CTF_START + 63)
+#define CTF_PAGEDESCNAME (XML_TEXT_CTF_START + 64)
+#define CTF_BACKGROUND_URL (XML_TEXT_CTF_START + 66)
+#define CTF_BACKGROUND_POS (XML_TEXT_CTF_START + 67)
+#define CTF_BACKGROUND_FILTER (XML_TEXT_CTF_START + 68)
+#define CTF_CHARHEIGHT_DIFF (XML_TEXT_CTF_START + 69)
+#define CTF_FONTNAME (XML_TEXT_CTF_START + 70)
+#define CTF_FONTNAME_CJK (XML_TEXT_CTF_START + 71)
+#define CTF_FONTFAMILYNAME_CJK (XML_TEXT_CTF_START + 72)
+#define CTF_FONTSTYLENAME_CJK (XML_TEXT_CTF_START + 73)
+#define CTF_FONTFAMILY_CJK (XML_TEXT_CTF_START + 74)
+#define CTF_FONTPITCH_CJK (XML_TEXT_CTF_START + 75)
+#define CTF_FONTCHARSET_CJK (XML_TEXT_CTF_START + 76)
+#define CTF_CHARHEIGHT_CJK (XML_TEXT_CTF_START + 77)
+#define CTF_CHARHEIGHT_REL_CJK (XML_TEXT_CTF_START + 78)
+#define CTF_CHARHEIGHT_DIFF_CJK (XML_TEXT_CTF_START + 79)
+#define CTF_FONTNAME_CTL (XML_TEXT_CTF_START + 80)
+#define CTF_FONTFAMILYNAME_CTL (XML_TEXT_CTF_START + 81)
+#define CTF_FONTSTYLENAME_CTL (XML_TEXT_CTF_START + 82)
+#define CTF_FONTFAMILY_CTL (XML_TEXT_CTF_START + 83)
+#define CTF_FONTPITCH_CTL (XML_TEXT_CTF_START + 84)
+#define CTF_FONTCHARSET_CTL (XML_TEXT_CTF_START + 85)
+#define CTF_CHARHEIGHT_CTL (XML_TEXT_CTF_START + 86)
+#define CTF_CHARHEIGHT_REL_CTL (XML_TEXT_CTF_START + 87)
+#define CTF_CHARHEIGHT_DIFF_CTL (XML_TEXT_CTF_START + 88)
+#define CTF_UNDERLINE (XML_TEXT_CTF_START + 89)
+#define CTF_UNDERLINE_COLOR (XML_TEXT_CTF_START + 90)
+#define CTF_UNDERLINE_HASCOLOR (XML_TEXT_CTF_START + 91)
+#define CTF_SECTION_FOOTNOTE_END (XML_TEXT_CTF_START + 92)
+#define CTF_SECTION_FOOTNOTE_NUM_RESTART (XML_TEXT_CTF_START + 93)
+#define CTF_SECTION_FOOTNOTE_NUM_RESTART_AT (XML_TEXT_CTF_START + 94)
+#define CTF_SECTION_FOOTNOTE_NUM_TYPE (XML_TEXT_CTF_START + 95)
+#define CTF_SECTION_FOOTNOTE_NUM_PREFIX (XML_TEXT_CTF_START + 96)
+#define CTF_SECTION_FOOTNOTE_NUM_SUFFIX (XML_TEXT_CTF_START + 97)
+#define CTF_SECTION_FOOTNOTE_NUM_OWN (XML_TEXT_CTF_START + 98)
+#define CTF_SECTION_ENDNOTE_END (XML_TEXT_CTF_START + 99)
+#define CTF_SECTION_ENDNOTE_NUM_RESTART (XML_TEXT_CTF_START + 100)
+#define CTF_SECTION_ENDNOTE_NUM_RESTART_AT (XML_TEXT_CTF_START + 101)
+#define CTF_SECTION_ENDNOTE_NUM_TYPE (XML_TEXT_CTF_START + 102)
+#define CTF_SECTION_ENDNOTE_NUM_PREFIX (XML_TEXT_CTF_START + 103)
+#define CTF_SECTION_ENDNOTE_NUM_SUFFIX (XML_TEXT_CTF_START + 104)
+#define CTF_SECTION_ENDNOTE_NUM_OWN (XML_TEXT_CTF_START + 105)
+#define CTF_PAGE_FOOTNOTE (XML_TEXT_CTF_START + 106)
+#define CTF_FRAME_DISPLAY_SCROLLBAR (XML_TEXT_CTF_START + 107)
+#define CTF_FRAME_DISPLAY_BORDER (XML_TEXT_CTF_START + 108)
+#define CTF_FRAME_MARGIN_HORI (XML_TEXT_CTF_START + 109)
+#define CTF_FRAME_MARGIN_VERT (XML_TEXT_CTF_START + 110)
+#define CTF_COMBINED_CHARACTERS_FIELD (XML_TEXT_CTF_START + 111)
+#define CTF_OLE_VIS_AREA_TOP (XML_TEXT_CTF_START + 112)
+#define CTF_OLE_VIS_AREA_LEFT (XML_TEXT_CTF_START + 113)
+#define CTF_OLE_VIS_AREA_WIDTH (XML_TEXT_CTF_START + 114)
+#define CTF_OLE_VIS_AREA_HEIGHT (XML_TEXT_CTF_START + 115)
+#define CTF_OLE_DRAW_ASPECT (XML_TEXT_CTF_START + 116)
+#define CTF_HYPERLINK_URL (XML_TEXT_CTF_START + 117)
+#define CTF_CHAR_STYLE_NAME (XML_TEXT_CTF_START + 118)
+#define CTF_VERTICALPOS_ATCHAR (XML_TEXT_CTF_START + 119)
+#define CTF_BACKGROUND_TRANSPARENCY (XML_TEXT_CTF_START + 120)
+#define CTF_BACKGROUND_TRANSPARENT (XML_TEXT_CTF_START + 121)
+#define CTF_KEEP_TOGETHER (XML_TEXT_CTF_START + 122)
+#define CTF_FRAMEWIDTH_ABS (XML_TEXT_CTF_START + 123)
+#define CTF_FRAMEWIDTH_MIN_ABS (XML_TEXT_CTF_START + 124)
+#define CTF_FRAMEWIDTH_MIN_REL (XML_TEXT_CTF_START + 125)
+#define CTF_FRAMEWIDTH_REL (XML_TEXT_CTF_START + 126)
+#define CTF_FRAMEWIDTH_TYPE (XML_TEXT_CTF_START + 127)
+#define CTF_BORDER_MODEL (XML_TEXT_CTF_START + 128)
+/* Define CTF ids for positioning properties of
+ shapes, because on export to OpenOffice.org file format these have to
+ be handled special, if shape isn't anchored as-character. (#i28749#)
+*/
+#define CTF_SHAPE_HORIZONTALPOS (XML_TEXT_CTF_START + 129)
+#define CTF_SHAPE_HORIZONTALPOS_MIRRORED (XML_TEXT_CTF_START + 130)
+#define CTF_SHAPE_HORIZONTALREL (XML_TEXT_CTF_START + 131)
+#define CTF_SHAPE_HORIZONTALREL_FRAME (XML_TEXT_CTF_START + 132)
+#define CTF_SHAPE_HORIZONTALMIRROR (XML_TEXT_CTF_START + 133)
+#define CTF_SHAPE_VERTICALPOS (XML_TEXT_CTF_START + 134)
+#define CTF_SHAPE_VERTICALPOS_ATCHAR (XML_TEXT_CTF_START + 135)
+#define CTF_SHAPE_VERTICALREL (XML_TEXT_CTF_START + 136)
+#define CTF_SHAPE_VERTICALREL_PAGE (XML_TEXT_CTF_START + 137)
+#define CTF_SHAPE_VERTICALREL_FRAME (XML_TEXT_CTF_START + 138)
+#define CTF_PARA_ADJUSTLAST (XML_TEXT_CTF_START + 139)
+#define CTF_DEFAULT_OUTLINE_LEVEL (XML_TEXT_CTF_START + 140)
+#define CTF_OLD_FLOW_WITH_TEXT (XML_TEXT_CTF_START + 141)
+#define CTF_ISNUMBERING (XML_TEXT_CTF_START + 142)
+#define CTF_TEXT_DISPLAY (XML_TEXT_CTF_START + 143)
+#define CTF_TEXT_CLIP (XML_TEXT_CTF_START + 144)
+#define CTF_TEXT_CLIP11 (XML_TEXT_CTF_START + 145)
+#define CTF_PARAMARGINALL (XML_TEXT_CTF_START + 146)
+#define CTF_PARAMARGINALL_REL (XML_TEXT_CTF_START + 147)
+#define CTF_MARGINALL (XML_TEXT_CTF_START + 148)
+#define CTF_MARGINLEFT (XML_TEXT_CTF_START + 149)
+#define CTF_MARGINRIGHT (XML_TEXT_CTF_START + 150)
+#define CTF_MARGINTOP (XML_TEXT_CTF_START + 151)
+#define CTF_MARGINBOTTOM (XML_TEXT_CTF_START + 152)
+/* CTF ids for character border to avoid interference between
+ paragraph and character attributes */
+#define CTF_CHARALLBORDERWIDTH (XML_TEXT_CTF_START + 153)
+#define CTF_CHARLEFTBORDERWIDTH (XML_TEXT_CTF_START + 154)
+#define CTF_CHARRIGHTBORDERWIDTH (XML_TEXT_CTF_START + 155)
+#define CTF_CHARTOPBORDERWIDTH (XML_TEXT_CTF_START + 156)
+#define CTF_CHARBOTTOMBORDERWIDTH (XML_TEXT_CTF_START + 157)
+#define CTF_CHARALLBORDERDISTANCE (XML_TEXT_CTF_START + 158)
+#define CTF_CHARLEFTBORDERDISTANCE (XML_TEXT_CTF_START + 159)
+#define CTF_CHARRIGHTBORDERDISTANCE (XML_TEXT_CTF_START + 160)
+#define CTF_CHARTOPBORDERDISTANCE (XML_TEXT_CTF_START + 161)
+#define CTF_CHARBOTTOMBORDERDISTANCE (XML_TEXT_CTF_START + 162)
+#define CTF_CHARALLBORDER (XML_TEXT_CTF_START + 163)
+#define CTF_CHARLEFTBORDER (XML_TEXT_CTF_START + 164)
+#define CTF_CHARRIGHTBORDER (XML_TEXT_CTF_START + 165)
+#define CTF_CHARTOPBORDER (XML_TEXT_CTF_START + 166)
+#define CTF_CHARBOTTOMBORDER (XML_TEXT_CTF_START + 167)
+#define CTF_RELWIDTHREL (XML_TEXT_CTF_START + 168)
+#define CTF_RELHEIGHTREL (XML_TEXT_CTF_START + 169)
+#define CTF_CHAR_BACKGROUND (XML_TEXT_CTF_START + 170)
+#define CTF_CHAR_BACKGROUND_TRANSPARENCY (XML_TEXT_CTF_START + 171)
+#define CTF_CHAR_HIGHLIGHT (XML_TEXT_CTF_START + 172)
+#define CTF_FILLSTYLE (XML_TEXT_CTF_START + 173)
+#define CTF_FILLCOLOR (XML_TEXT_CTF_START + 174)
+#define CTF_PAGENUMBEROFFSET (XML_TEXT_CTF_START + 175)
+
+
+enum class TextPropMap {
+ TEXT = 0,
+ PARA = 1,
+ FRAME = 2,
+ AUTO_FRAME = 3,
+ SECTION = 4,
+ SHAPE = 5,
+ RUBY = 6,
+ SHAPE_PARA = 7,
+ TEXT_ADDITIONAL_DEFAULTS = 8,
+ TABLE_DEFAULTS = 9,
+ TABLE_ROW_DEFAULTS = 10,
+ CELL = 11
+};
+
+class XMLOFF_DLLPUBLIC XMLTextPropertySetMapper final : public XMLPropertySetMapper
+{
+public:
+ XMLTextPropertySetMapper( TextPropMap nType, bool bForExport );
+ virtual ~XMLTextPropertySetMapper() override;
+
+ static const XMLPropertyMapEntry* getPropertyMapForType( TextPropMap _nType );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/txtstyli.hxx b/include/xmloff/txtstyli.hxx
new file mode 100644
index 000000000..aa5627c0e
--- /dev/null
+++ b/include/xmloff/txtstyli.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_TXTSTYLI_HXX
+#define INCLUDED_XMLOFF_TXTSTYLI_HXX
+
+#include <sal/config.h>
+
+#include <optional>
+
+#include <xmloff/dllapi.h>
+#include <xmloff/prstylei.hxx>
+
+class XMLEventsImportContext;
+
+class XMLOFF_DLLPUBLIC XMLTextStyleContext : public XMLPropStyleContext
+{
+ OUString m_sListStyleName;
+ OUString m_sCategoryVal;
+ OUString m_sDropCapTextStyleName;
+ OUString m_sMasterPageName;
+ OUString m_sDataStyleName; // for grid columns only
+
+ sal_Int8 m_nOutlineLevel;
+
+ bool m_isAutoUpdate : 1;
+ bool m_bHasMasterPageName : 1;
+
+ bool m_bHasCombinedCharactersLetter : 1;
+
+ // Introduce import of empty list style (#i69523#)
+ bool m_bListStyleSet : 1;
+
+ rtl::Reference<XMLEventsImportContext> m_xEventContext;
+
+ /// Reads <style:style style:list-level="...">.
+ std::optional<sal_Int16> m_aListLevel;
+
+protected:
+
+ virtual void SetAttribute( sal_Int32 nElement,
+ const OUString& rValue ) override;
+
+public:
+
+ XMLTextStyleContext( SvXMLImport& rImport,
+ SvXMLStylesContext& rStyles, XmlStyleFamily nFamily,
+ bool bDefaultStyle = false );
+ ~XMLTextStyleContext() override;
+
+ XMLTextStyleContext(const XMLTextStyleContext &) = delete;
+ XMLTextStyleContext operator=(const XMLTextStyleContext &) = delete;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+
+ const OUString& GetListStyle() const { return m_sListStyleName; }
+ // XML import: reconstruction of assignment of paragraph style to outline levels (#i69629#)
+ bool IsListStyleSet() const
+ {
+ return m_bListStyleSet;
+ }
+
+ const OUString& GetMasterPageName() const { return m_sMasterPageName; }
+ bool HasMasterPageName() const { return m_bHasMasterPageName; }
+ const OUString& GetDropCapStyleName() const { return m_sDropCapTextStyleName; }
+ const OUString& GetDataStyleName() const { return m_sDataStyleName; }
+
+ virtual void CreateAndInsert( bool bOverwrite ) override;
+ virtual void Finish( bool bOverwrite ) override;
+ virtual void SetDefaults() override;
+
+ // override FillPropertySet, so we can get at the combined characters
+ virtual void FillPropertySet(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override;
+
+ bool HasCombinedCharactersLetter() const
+ { return m_bHasCombinedCharactersLetter; }
+
+ const ::std::vector< XMLPropertyState > & GetProperties_() { return GetProperties(); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/unoatrcn.hxx b/include/xmloff/unoatrcn.hxx
new file mode 100644
index 000000000..8e5556bb1
--- /dev/null
+++ b/include/xmloff/unoatrcn.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_UNOATRCN_HXX
+#define INCLUDED_XMLOFF_UNOATRCN_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <xmloff/xmlcnimp.hxx>
+
+#include <cppuhelper/implbase3.hxx>
+
+extern css::uno::Reference< css::uno::XInterface > SvUnoAttributeContainer_CreateInstance();
+
+class XMLOFF_DLLPUBLIC SvUnoAttributeContainer final :
+ public ::cppu::WeakAggImplHelper3<
+ css::lang::XServiceInfo,
+ css::lang::XUnoTunnel,
+ css::container::XNameContainer >
+{
+private:
+ std::unique_ptr<SvXMLAttrContainerData> mpContainer;
+
+ SAL_DLLPRIVATE sal_uInt16 getIndexByName(std::u16string_view aName )
+ const;
+
+public:
+ SvUnoAttributeContainer( std::unique_ptr<SvXMLAttrContainerData> pContainer = nullptr );
+ SvXMLAttrContainerData* GetContainerImpl() const { return mpContainer.get(); }
+
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept;
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+
+ // css::container::XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType() override;
+ virtual sal_Bool SAL_CALL hasElements() override;
+
+ // css::container::XNameAccess
+ virtual css::uno::Any SAL_CALL getByName(const OUString& aName) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
+ virtual sal_Bool SAL_CALL hasByName(const OUString& aName) override;
+
+ // css::container::XNameReplace
+ virtual void SAL_CALL replaceByName(const OUString& aName, const css::uno::Any& aElement) override;
+
+ // css::container::XNameContainer
+ virtual void SAL_CALL insertByName(const OUString& aName, const css::uno::Any& aElement) override;
+ virtual void SAL_CALL removeByName(const OUString& Name) override;
+
+ // css::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/unointerfacetouniqueidentifiermapper.hxx b/include/xmloff/unointerfacetouniqueidentifiermapper.hxx
new file mode 100644
index 000000000..332005e72
--- /dev/null
+++ b/include/xmloff/unointerfacetouniqueidentifiermapper.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER_HXX
+#define INCLUDED_XMLOFF_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+
+#include <deque>
+#include <map>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+
+namespace comphelper
+{
+
+typedef ::std::map< OUString, css::uno::Reference< css::uno::XInterface > > IdMap_t;
+
+class XMLOFF_DLLPUBLIC UnoInterfaceToUniqueIdentifierMapper
+{
+ typedef std::deque< OUString > Reserved_t;
+
+public:
+ UnoInterfaceToUniqueIdentifierMapper();
+
+ /** returns a unique identifier for the given uno object. If a UNO object is
+ registered more than once, the returned identifier is always the same.
+ */
+ const OUString& registerReference( const css::uno::Reference< css::uno::XInterface >& rInterface );
+
+ /** registers the given uno object with the given identifier.
+
+ @returns
+ false, if the given identifier already exists and is not associated with the given interface
+ */
+ bool registerReference( const OUString& rIdentifier, const css::uno::Reference< css::uno::XInterface >& rInterface );
+
+ /** reserves an identifier for later registration.
+
+ @returns
+ false, if the identifier already exists
+ */
+ bool reserveIdentifier( const OUString& rIdentifier );
+
+ /** registers the given uno object with reserved identifier.
+ */
+ bool registerReservedReference( const OUString& rIdentifier, const css::uno::Reference< css::uno::XInterface >& rInterface );
+
+ /** @returns
+ the identifier for the given uno object. If this uno object is not already
+ registered, an empty string is returned
+ */
+ const OUString& getIdentifier( const css::uno::Reference< css::uno::XInterface >& rInterface ) const;
+
+ /** @returns
+ the uno object that is registered with the given identifier. If no uno object
+ is registered with the given identifier, an empty reference is returned.
+ */
+ const css::uno::Reference< css::uno::XInterface >& getReference( const OUString& rIdentifier ) const;
+
+private:
+ bool findReference( const css::uno::Reference< css::uno::XInterface >& rInterface, IdMap_t::const_iterator& rIter ) const;
+ bool findIdentifier( const OUString& rIdentifier, IdMap_t::const_iterator& rIter ) const;
+ bool findReserved( const OUString& rIdentifier ) const;
+ bool findReserved( const OUString& rIdentifier, Reserved_t::const_iterator& rIter ) const;
+
+ IdMap_t maEntries;
+ sal_uInt32 mnNextId;
+ Reserved_t maReserved;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xformsexport.hxx b/include/xmloff/xformsexport.hxx
new file mode 100644
index 000000000..4ab7034ec
--- /dev/null
+++ b/include/xmloff/xformsexport.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_XFORMSEXPORT_HXX
+#define INCLUDED_XMLOFF_XFORMSEXPORT_HXX
+
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+
+class SvXMLExport;
+namespace com::sun::star {
+ namespace uno { template<typename T> class Reference; }
+ namespace uno { template<typename T> class Sequence; }
+ namespace beans { class XPropertySet; struct PropertyValue; }
+ namespace container { class XNameAccess; }
+}
+
+
+/** export an XForms model. */
+void exportXForms( SvXMLExport& );
+
+OUString getXFormsBindName( const css::uno::Reference<css::beans::XPropertySet>& xBinding );
+
+OUString getXFormsListBindName( const css::uno::Reference<css::beans::XPropertySet>& xBinding );
+
+OUString getXFormsSubmissionName( const css::uno::Reference<css::beans::XPropertySet>& xBinding );
+
+
+/** returns the settings of the given XForms container, to be exported as document specific settings
+*/
+void XMLOFF_DLLPUBLIC getXFormsSettings(
+ const css::uno::Reference< css::container::XNameAccess >& _rXForms,
+ css::uno::Sequence< css::beans::PropertyValue >& _out_rSettings
+ );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xformsimport.hxx b/include/xmloff/xformsimport.hxx
new file mode 100644
index 000000000..8a7ef2f67
--- /dev/null
+++ b/include/xmloff/xformsimport.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_XFORMSIMPORT_HXX
+#define INCLUDED_XMLOFF_XFORMSIMPORT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+
+class SvXMLImport;
+class SvXMLImportContext;
+
+namespace com::sun::star {
+ namespace uno { template<typename T> class Reference; }
+ namespace uno { template <typename > class Sequence; }
+ namespace beans { class XPropertySet; struct PropertyValue; }
+ namespace frame { class XModel; }
+ namespace container { class XNameAccess; }
+}
+
+/** create import context for xforms:model element. */
+XMLOFF_DLLPUBLIC SvXMLImportContext* createXFormsModelContext(
+ SvXMLImport& rImport );
+
+/** perform the actual binding of an XForms-binding with the suitable control
+ * @param document which contains the XForms-model(s)
+ * @param pair<XForms binding ID, reference to control>
+ */
+void bindXFormsValueBinding(
+ css::uno::Reference<css::frame::XModel> const&,
+ const std::pair<css::uno::Reference<css::beans::XPropertySet>, OUString>&);
+
+/** perform the actual binding of an XForms-binding as list source with a list control
+ * @param document which contains the XForms-model(s)
+ * @param pair<XForms binding ID, reference to control>
+ */
+void bindXFormsListBinding(
+ css::uno::Reference<css::frame::XModel> const&,
+ const std::pair<css::uno::Reference<css::beans::XPropertySet>, OUString>&);
+
+/** perform the actual binding of an XForms submission with the suitable control
+ * @param document which contains the XForms-model(s)
+ * @param pair<XForms submission ID, reference to control>
+ */
+void bindXFormsSubmission(
+ css::uno::Reference<css::frame::XModel> const&,
+ const std::pair<css::uno::Reference<css::beans::XPropertySet>, OUString>&);
+
+/** applies the given settings to the given XForms container
+*/
+void XMLOFF_DLLPUBLIC applyXFormsSettings(
+ const css::uno::Reference< css::container::XNameAccess >& _rXForms,
+ const css::uno::Sequence< css::beans::PropertyValue >& _rSettings
+ );
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlaustp.hxx b/include/xmloff/xmlaustp.hxx
new file mode 100644
index 000000000..1adc3b786
--- /dev/null
+++ b/include/xmloff/xmlaustp.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLAUSTP_HXX
+#define INCLUDED_XMLOFF_XMLAUSTP_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <memory>
+#include <vector>
+
+class SvXMLExportPropertyMapper;
+class SvXMLNamespaceMap;
+class SvXMLAutoStylePoolP_Impl;
+class SvXMLAttributeList;
+class SvXMLExport;
+class SvXMLUnitConverter;
+struct XMLPropertyState;
+enum class XmlStyleFamily;
+
+namespace com::sun::star::uno {
+ template<typename A> class Sequence;
+}
+
+namespace com::sun::star::uno { template <typename > class Reference; }
+
+namespace com::sun::star::xml::sax { class XDocumentHandler; }
+namespace xmloff { struct AutoStyleEntry; }
+namespace rtl { template <class reference_type> class Reference; }
+
+class XMLOFF_DLLPUBLIC SvXMLAutoStylePoolP : public salhelper::SimpleReferenceObject
+{
+ friend class Test;
+ friend class SvXMLAutoStylePoolP_Impl;
+
+ std::unique_ptr<SvXMLAutoStylePoolP_Impl> pImpl;
+
+protected:
+
+ virtual void exportStyleAttributes(
+ SvXMLAttributeList& rAttrList,
+ XmlStyleFamily nFamily,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLExportPropertyMapper& rPropExp,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap
+ ) const;
+
+// this method is executed after Properties Export, so you can e.g. export a map or so on
+ virtual void exportStyleContent(
+ const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler,
+ XmlStyleFamily nFamily,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLExportPropertyMapper& rPropExp,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap
+ ) const;
+
+
+public:
+
+ SvXMLAutoStylePoolP( SvXMLExport& rExport);
+
+ virtual ~SvXMLAutoStylePoolP() override;
+
+ SvXMLExport& GetExport() const;
+
+ /** register a new family with its appropriate instance of a derivation of XMLPropertySetMapper
+ for family numbers see families.hxx
+ */
+ // TODO: Remove this ugly method as soon as possible
+ void AddFamily( XmlStyleFamily nFamily, const OUString& rStrName, SvXMLExportPropertyMapper* pMapper, const OUString& aStrPrefix );
+ void AddFamily( XmlStyleFamily nFamily, const OUString& rStrName,
+ const rtl::Reference< SvXMLExportPropertyMapper >& rMapper,
+ const OUString& rStrPrefix, bool bAsFamily = true );
+ void SetFamilyPropSetMapper( XmlStyleFamily nFamily,
+ const rtl::Reference< SvXMLExportPropertyMapper >& rMapper );
+
+ /// Register a name that must not be used as a generated name.
+ void RegisterName( XmlStyleFamily nFamily, const OUString& rName );
+
+ /// Register a name that may only be used through AddNamed
+ void RegisterDefinedName(XmlStyleFamily nFamily, const OUString& rName);
+
+ /// retrieve the registered names (names + families)
+ void GetRegisteredNames(
+ css::uno::Sequence<sal_Int32>& aFamilies,
+ css::uno::Sequence<OUString>& aNames );
+
+ /// register (families + names)
+ void RegisterNames(
+ css::uno::Sequence<sal_Int32> const & aFamilies,
+ css::uno::Sequence<OUString> const & aNames );
+
+ /// Add an item set to the pool and return its generated name.
+ OUString Add( XmlStyleFamily nFamily, ::std::vector< XMLPropertyState >&& rProperties );
+ OUString Add( XmlStyleFamily nFamily, const OUString& rParent, ::std::vector< XMLPropertyState >&& rProperties, bool bDontSeek = false );
+ bool Add( OUString& rName, XmlStyleFamily nFamily, const OUString& rParent, ::std::vector< XMLPropertyState >&& rProperties );
+
+ /// Add an item set with a pre-defined name (needed for saving sheets separately in Calc).
+ bool AddNamed( const OUString& rName, XmlStyleFamily nFamily, const OUString& rParent,
+ std::vector< XMLPropertyState >&& rProperties );
+
+ /// Find an item set's name.
+ OUString Find( XmlStyleFamily nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ) const;
+
+ /** Export all item sets ofs a certain class in the order in that they have been added. */
+ void exportXML( XmlStyleFamily nFamily ) const;
+
+ void ClearEntries();
+
+ std::vector<xmloff::AutoStyleEntry> GetAutoStyleEntries() const;
+};
+
+#endif // INCLUDED_XMLOFF_XMLAUSTP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlcnimp.hxx b/include/xmloff/xmlcnimp.hxx
new file mode 100644
index 000000000..614a8cae7
--- /dev/null
+++ b/include/xmloff/xmlcnimp.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLCNIMP_HXX
+#define INCLUDED_XMLOFF_XMLCNIMP_HXX
+
+#include <memory>
+
+#include <rtl/ustring.hxx>
+#include <xmloff/dllapi.h>
+
+class SvXMLAttrCollection;
+
+class XMLOFF_DLLPUBLIC SvXMLAttrContainerData
+{
+private:
+ std::unique_ptr<SvXMLAttrCollection> pimpl;
+
+public:
+ SvXMLAttrContainerData();
+ SvXMLAttrContainerData(const SvXMLAttrContainerData &rCopy);
+ ~SvXMLAttrContainerData();
+
+ SvXMLAttrContainerData& operator=( const SvXMLAttrContainerData& rCmp );
+ SvXMLAttrContainerData& operator=( SvXMLAttrContainerData&& rCmp ) noexcept;
+
+ bool operator ==( const SvXMLAttrContainerData& rCmp ) const;
+
+ bool AddAttr( const OUString& rLName, const OUString& rValue );
+ bool AddAttr( const OUString& rPrefix, const OUString& rNamespace,
+ const OUString& rLName, const OUString& rValue );
+ bool AddAttr( const OUString& rPrefix,
+ const OUString& rLName,
+ const OUString& rValue );
+
+ size_t GetAttrCount() const;
+ OUString GetAttrNamespace( size_t i ) const;
+ OUString GetAttrPrefix( size_t i ) const;
+ const OUString& GetAttrLName( size_t i ) const;
+ const OUString& GetAttrValue( size_t i ) const;
+
+ sal_uInt16 GetFirstNamespaceIndex() const;
+ sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const;
+ const OUString& GetNamespace( sal_uInt16 i ) const;
+ const OUString& GetPrefix( sal_uInt16 i ) const;
+
+ bool SetAt( size_t i,
+ const OUString& rLName, const OUString& rValue );
+ bool SetAt( size_t i,
+ const OUString& rPrefix, const OUString& rNamespace,
+ const OUString& rLName, const OUString& rValue );
+ bool SetAt( size_t i,
+ const OUString& rPrefix,
+ const OUString& rLName,
+ const OUString& rValue );
+
+ void Remove( size_t i );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlement.hxx b/include/xmloff/xmlement.hxx
new file mode 100644
index 000000000..bedef86e6
--- /dev/null
+++ b/include/xmloff/xmlement.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLEMENT_HXX
+#define INCLUDED_XMLOFF_XMLEMENT_HXX
+
+#include <sal/types.h>
+#include <xmloff/xmltoken.hxx>
+
+/** Map an XMLTokenEnum to an enum value.
+ * To be used with SvXMLUnitConverter::convertEnum(...)
+ * We store the enum internally as a fixed size field, since there are
+ * places where we want to store a generic pointer to an array of SvXMLEnumMapEntry
+ * and we don't want to templatize the class.
+ */
+template<typename EnumT>
+struct SvXMLEnumMapEntry
+{
+private:
+ ::xmloff::token::XMLTokenEnum eToken;
+ sal_uInt16 nValue;
+public:
+ SvXMLEnumMapEntry(::xmloff::token::XMLTokenEnum eToken_, EnumT nValue_)
+ : eToken(eToken_), nValue(static_cast<sal_uInt16>(nValue_)) {}
+ ::xmloff::token::XMLTokenEnum GetToken() const { return eToken; }
+ sal_uInt16 GetValue() const { return nValue; }
+};
+
+#if defined(_MSC_VER)
+// specialisation to avoid lots of "C2398: conversion from 'const sal_Int16' to 'sal_uInt16' requires a narrowing conversion"
+// errors when compiling on MSVC
+template<>
+struct SvXMLEnumMapEntry<sal_uInt16>
+{
+private:
+ ::xmloff::token::XMLTokenEnum eToken;
+ sal_uInt16 nValue;
+public:
+ SvXMLEnumMapEntry(::xmloff::token::XMLTokenEnum eToken_, sal_Int32 nValue_)
+ : eToken(eToken_), nValue(nValue_) {}
+ ::xmloff::token::XMLTokenEnum GetToken() const { return eToken; }
+ sal_uInt16 GetValue() const { return nValue; }
+};
+#endif
+
+#define ENUM_STRING_MAP_ENTRY(name,tok) { name, sizeof(name)-1, tok }
+
+#define ENUM_STRING_MAP_END() { nullptr, 0, 0 }
+
+/** Map a const char* (with length) to a sal_uInt16 value.
+ * To be used with SvXMLUnitConverter::convertEnum(...)
+ */
+template<typename EnumT>
+struct SvXMLEnumStringMapEntry
+{
+private:
+ const char * pName;
+ sal_Int32 nNameLength;
+ sal_uInt16 nValue;
+public:
+ SvXMLEnumStringMapEntry(const char * pName_, sal_Int32 nNameLength_, EnumT nValue_)
+ : pName(pName_), nNameLength(nNameLength_), nValue(nValue_) {}
+ const char * GetName() const { return pName; }
+ sal_Int32 GetNameLength() const { return nNameLength; }
+ EnumT GetValue() const { return static_cast<EnumT>(nValue); }
+};
+
+#endif // INCLUDED_XMLOFF_XMLEMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlerror.hxx b/include/xmloff/xmlerror.hxx
new file mode 100644
index 000000000..2b4c8717d
--- /dev/null
+++ b/include/xmloff/xmlerror.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLERROR_HXX
+#define INCLUDED_XMLOFF_XMLERROR_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+#include <vector>
+
+// masks for the error ID fields
+#define XMLERROR_MASK_FLAG 0xF0000000
+#define XMLERROR_MASK_CLASS 0x00FF0000
+#define XMLERROR_MASK_NUMBER 0x0000FFFF
+
+// error flags:
+#define XMLERROR_FLAG_WARNING 0x10000000
+#define XMLERROR_FLAG_ERROR 0x20000000
+#define XMLERROR_FLAG_SEVERE 0x40000000
+
+// error classes: Error ID
+#define XMLERROR_CLASS_IO 0x00010000
+#define XMLERROR_CLASS_FORMAT 0x00020000
+#define XMLERROR_CLASS_API 0x00040000
+#define XMLERROR_CLASS_OTHER 0x00080000
+
+// error numbers, listed by error class
+// Within each class, errors should be numbered consecutively. Please
+// always add to error code below the appropriate comment.
+
+// I/O errors:
+
+// format errors:
+#define XMLERROR_SAX ( XMLERROR_CLASS_FORMAT | 0x00000001 )
+#define XMLERROR_STYLE_ATTR_VALUE ( XMLERROR_CLASS_FORMAT | 0x00000002 )
+#define XMLERROR_NO_INDEX_ALLOWED_HERE ( XMLERROR_CLASS_FORMAT | 0x00000003 )
+#define XMLERROR_PARENT_STYLE_NOT_ALLOWED ( XMLERROR_CLASS_FORMAT | 0x00000004 )
+#define XMLERROR_ILLEGAL_EVENT (XMLERROR_CLASS_FORMAT | 0x00000005 )
+#define XMLERROR_NAMESPACE_TROUBLE (XMLERROR_CLASS_FORMAT | 0x00000006 )
+
+#define XMLERROR_XFORMS_NO_SCHEMA_SUPPORT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000007 )
+#define XMLERROR_XFORMS_UNKNOWN ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000008 )
+#define XMLERROR_XFORMS_ONLY_ONE_INSTANCE_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000009 )
+#define XMLERROR_UNKNOWN_ATTRIBUTE ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000a )
+#define XMLERROR_UNKNOWN_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000b )
+#define XMLERROR_UNKNOWN_CHARACTERS ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000c )
+#define XMLERROR_UNKNOWN_ROOT (XMLERROR_CLASS_FORMAT | 0x0000000d )
+
+// API errors:
+#define XMLERROR_STYLE_PROP_VALUE ( XMLERROR_CLASS_API | 0x00000001 )
+#define XMLERROR_STYLE_PROP_UNKNOWN ( XMLERROR_CLASS_API | 0x00000002 )
+#define XMLERROR_STYLE_PROP_OTHER ( XMLERROR_CLASS_API | 0x00000003 )
+#define XMLERROR_API ( XMLERROR_CLASS_API | 0x00000004 )
+
+// other errors:
+#define XMLERROR_CANCEL ( XMLERROR_CLASS_OTHER | 0x00000001 )
+
+// 16bit error flag constants for use in the
+// SvXMLExport/SvXMLImport error flags
+enum class SvXMLErrorFlags {
+ NO = 0x0000,
+ DO_NOTHING = 0x0001,
+ ERROR_OCCURRED = 0x0002,
+ WARNING_OCCURRED = 0x0004,
+};
+
+namespace o3tl
+{
+ template<> struct typed_flags<SvXMLErrorFlags> : is_typed_flags<SvXMLErrorFlags, 0x7> {};
+}
+
+namespace com::sun::star {
+ namespace uno { template<class X> class Sequence; }
+ namespace uno { template<class X> class Reference; }
+ namespace xml::sax { class XLocator; }
+}
+
+class ErrorRecord;
+
+/**
+ * The XMLErrors is used to collect all errors and warnings that occur
+ * for appropriate processing.
+ */
+class XMLErrors
+{
+ /// definition of type for error list
+ typedef ::std::vector<ErrorRecord> ErrorList;
+
+ ErrorList aErrors; /// list of error records
+
+public:
+
+ XMLErrors();
+ ~XMLErrors();
+
+ /// add a new entry to the list of error messages
+ void AddRecord(
+ sal_Int32 nId, /// error ID == error flags + error class + error number
+ const css::uno::Sequence< OUString> & rParams, /// parameters for error message
+ const OUString& rExceptionMessage, /// original exception string
+ sal_Int32 nRow, /// XLocator: file row number
+ sal_Int32 nColumn, /// XLocator: file column number
+ const OUString& rPublicId, /// XLocator: file public ID
+ const OUString& rSystemId ); /// XLocator: file system ID
+
+ void AddRecord(
+ sal_Int32 nId, /// error ID == error flags + error class + error number
+ const css::uno::Sequence<OUString> & rParams, /// parameters for error message
+ const OUString& rExceptionMessage, /// original exception string
+ const css::uno::Reference<css::xml::sax::XLocator> & rLocator); /// location
+
+ /**
+ * throw a SAXParseException that describes the first error that matches
+ * the given mask
+ */
+ /// @throws css::xml::sax::SAXParseException
+ void ThrowErrorAsSAXException( sal_Int32 nIdMask );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlevent.hxx b/include/xmloff/xmlevent.hxx
new file mode 100644
index 000000000..900a03694
--- /dev/null
+++ b/include/xmloff/xmlevent.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLEVENT_HXX
+#define INCLUDED_XMLOFF_XMLEVENT_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+
+
+/**
+ * @#file
+ *
+ * Several definition used in im- and export of events
+ */
+
+namespace com::sun::star {
+ namespace xml::sax { class XFastAttributeList; }
+ namespace beans { struct PropertyValue; }
+}
+
+class SvXMLExport;
+class SvXMLImportContext;
+class SvXMLImport;
+class XMLEventsImportContext;
+
+
+struct XMLEventName
+{
+ sal_uInt16 m_nPrefix;
+ OUString m_aName;
+
+ XMLEventName() : m_nPrefix( 0 ) {}
+ XMLEventName( sal_uInt16 n, const char *p ) :
+ m_nPrefix( n ),
+ m_aName( OUString::createFromAscii(p) )
+ {}
+
+ XMLEventName( sal_uInt16 n, const OUString& r ) :
+ m_nPrefix( n ),
+ m_aName( r )
+ {}
+
+ bool operator<( const XMLEventName& r ) const
+ {
+ return m_nPrefix < r.m_nPrefix ||
+ (m_nPrefix == r.m_nPrefix && m_aName < r.m_aName );
+ }
+
+};
+
+/**
+ * XMLEventNameTranslation: define tables that translate between event names
+ * as used in the XML file format and in the StarOffice API.
+ * The last entry in the table must be { NULL, 0, NULL }.
+ */
+struct XMLEventNameTranslation
+{
+ const char* sAPIName;
+ sal_uInt16 nPrefix; // namespace prefix
+ const char* sXMLName;
+};
+
+/// a translation table for the events defined in the XEventsSupplier service
+/// (implemented in XMLEventExport.cxx)
+extern const XMLEventNameTranslation aStandardEventTable[];
+
+
+/**
+ * Handle export of an event for a certain event type (event type as
+ * defined by the PropertyValue "EventType" in API).
+ *
+ * The Handler has to generate the full <script:event> element.
+ */
+class XMLEventExportHandler
+{
+public:
+ virtual ~XMLEventExportHandler() {};
+
+ virtual void Export(
+ SvXMLExport& rExport, /// the current XML export
+ const OUString& rEventQName, /// the XML name of the event
+ const css::uno::Sequence<css::beans::PropertyValue> & rValues, /// the values for the event
+ bool bUseWhitespace) = 0; /// create whitespace around elements?
+};
+
+
+/**
+ * Handle import of an event for a certain event type (as defined by
+ * the PropertyValue "EventType" in the API).
+ *
+ * EventContextFactories must be registered with the EventImportHelper
+ * that is attached to the SvXMLImport.
+ *
+ * The factory has to create an import context for a <script:event>
+ * element. The context has to call the
+ * EventsImportContext::AddEventValues() method to save its event
+ * registered with the enclosing element. For events consisting only
+ * of attributes (and an empty element) an easy solution is to handle
+ * all attributes in the CreateContext()-method and return a default
+ * context.
+ *
+ * EventContextFactory objects have to be registered with the
+ * EventsImportHelper.
+ */
+class XMLEventContextFactory
+{
+public:
+ virtual ~XMLEventContextFactory() {};
+
+ virtual SvXMLImportContext* CreateContext(
+ SvXMLImport& rImport, /// import context
+ const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList, /// attribute list
+ /// the context for the enclosing <script:events> element
+ XMLEventsImportContext* rEvents,
+ /// the event name (as understood by the API)
+ const OUString& rApiEventName) = 0;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
new file mode 100644
index 000000000..e9dcd2bfe
--- /dev/null
+++ b/include/xmloff/xmlexp.hxx
@@ -0,0 +1,677 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLEXP_HXX
+#define INCLUDED_XMLOFF_XMLEXP_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <rtl/ustring.hxx>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/txtparae.hxx>
+#include <xmloff/formlayerexport.hxx>
+#include <xmloff/xmlnumfe.hxx>
+#include <xmloff/xmlaustp.hxx>
+#include <xmloff/shapeexport.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/SchXMLExportHelper.hxx>
+#include <xmloff/XMLFontAutoStylePool.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+
+#include <unotools/saveopt.hxx>
+#include <unotools/securityoptions.hxx>
+
+#include <xmloff/XMLPageExport.hxx>
+#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <tools/fldunit.hxx>
+#include <vcl/errcode.hxx>
+
+#include <vector>
+#include <memory>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::document { class XEmbeddedObjectResolver; }
+namespace com::sun::star::document { class XGraphicStorageHandler; }
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::graphic { class XGraphic; }
+namespace com::sun::star::lang { class XEventListener; }
+namespace com::sun::star::task { class XStatusIndicator; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::util { class XNumberFormatsSupplier; }
+namespace com::sun::star::xml::sax { class XAttributeList; }
+namespace com::sun::star::xml::sax { class XDocumentHandler; }
+namespace com::sun::star::xml::sax { class XExtendedDocumentHandler; }
+namespace com::sun::star::xml::sax { class XLocator; }
+
+class SvXMLNamespaceMap;
+class SvtSecurityMapPersonalInfo;
+class SvXMLExport_Impl;
+class ProgressBarHelper;
+class XMLEventExport;
+class XMLImageMapExport;
+class XMLErrors;
+class LanguageTag;
+enum class SvXMLErrorFlags;
+
+// Shapes in Writer cannot be named via context menu (#i51726#)
+#include <unotools/moduleoptions.hxx>
+
+namespace com::sun::star {
+ namespace frame { class XModel; }
+ namespace lang { struct Locale; }
+}
+namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
+
+enum class SvXMLExportFlags {
+ NONE = 0,
+ META = 0x0001,
+ STYLES = 0x0002,
+ MASTERSTYLES = 0x0004,
+ AUTOSTYLES = 0x0008,
+ CONTENT = 0x0010,
+ SCRIPTS = 0x0020,
+ SETTINGS = 0x0040,
+ FONTDECLS = 0x0080,
+ EMBEDDED = 0x0100,
+ PRETTY = 0x0400,
+ OASIS = 0x8000,
+ ALL = 0x05ff
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvXMLExportFlags> : is_typed_flags<SvXMLExportFlags, 0x85ff> {};
+}
+
+class XMLOFF_DLLPUBLIC SvXMLExport : public cppu::WeakImplHelper<
+ css::document::XFilter,
+ css::lang::XServiceInfo,
+ css::document::XExporter,
+ css::lang::XInitialization,
+ css::container::XNamed,
+ css::lang::XUnoTunnel>
+{
+ std::unique_ptr<SvXMLExport_Impl> mpImpl; // dummy
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ OUString m_implementationName;
+
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::xml::sax::XDocumentHandler > mxHandler; // the handlers
+ css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > mxExtHandler;
+ css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
+ css::uno::Reference< css::document::XGraphicStorageHandler > mxGraphicStorageHandler;
+ css::uno::Reference< css::document::XEmbeddedObjectResolver > mxEmbeddedResolver;
+ css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator;
+ css::uno::Reference< css::beans::XPropertySet > mxExportInfo;
+ css::uno::Reference< css::lang::XEventListener > mxEventListener;
+
+ rtl::Reference<SvXMLAttributeList> mxAttrList; // a common attribute list
+
+ OUString msOrigFileName; // the original URL
+ OUString msFilterName;
+ OUString msImgFilterName;
+ std::unique_ptr<SvXMLNamespaceMap> mpNamespaceMap; // the namespace map
+ std::unique_ptr<SvtSecurityMapPersonalInfo> mpAuthorIDs; // map authors to remove personal info
+ SvXMLUnitConverter maUnitConv; // the unit converter
+ std::unique_ptr<SvXMLNumFmtExport> mpNumExport;
+ std::unique_ptr<ProgressBarHelper> mpProgressBarHelper;
+
+ rtl::Reference< XMLTextParagraphExport > mxTextParagraphExport;
+ rtl::Reference< XMLShapeExport > mxShapeExport;
+ rtl::Reference< SvXMLAutoStylePoolP > mxAutoStylePool;
+ rtl::Reference< SchXMLExportHelper > mxChartExport;
+ rtl::Reference< XMLPageExport > mxPageExport;
+ rtl::Reference< XMLFontAutoStylePool > mxFontAutoStylePool;
+ rtl::Reference< xmloff::OFormLayerXMLExport > mxFormExport;
+ std::unique_ptr<XMLEventExport> mpEventExport;
+ std::unique_ptr<XMLImageMapExport> mpImageMapExport;
+ std::unique_ptr<XMLErrors> mpXMLErrors;
+
+ const enum ::xmloff::token::XMLTokenEnum meClass;
+ SAL_DLLPRIVATE void InitCtor_();
+
+ SvXMLExportFlags mnExportFlags;
+ SvXMLErrorFlags mnErrorFlags;
+
+ const OUString msWS; // " "
+
+ // Shapes in Writer cannot be named via context menu (#i51726#)
+ SvtModuleOptions::EFactory meModelType;
+ SAL_DLLPRIVATE void DetermineModelType_();
+
+ SAL_DLLPRIVATE void ImplExportMeta(); // <office:meta>
+ SAL_DLLPRIVATE void ImplExportSettings(); // <office:settings>
+ SAL_DLLPRIVATE void ImplExportStyles(); // <office:styles>
+ SAL_DLLPRIVATE void ImplExportAutoStyles();
+ // <office:automatic-styles>
+ SAL_DLLPRIVATE void ImplExportMasterStyles();
+ // <office:master-styles>
+ SAL_DLLPRIVATE void ImplExportContent(); // <office:body>
+ virtual void SetBodyAttributes();
+ void GetViewSettingsAndViews(css::uno::Sequence<css::beans::PropertyValue>& rProps);
+
+protected:
+ void setExportFlags( SvXMLExportFlags nExportFlags ) { mnExportFlags = nExportFlags; }
+
+ // Get (modifiable) namespace map
+ SvXMLNamespaceMap& GetNamespaceMap_() { return *mpNamespaceMap; }
+
+ // get a new namespace map (used in starmath to have a default namespace)
+ void ResetNamespaceMap();
+
+ /// Override this method to export the content of <office:meta>.
+ /// There is a default implementation.
+ virtual void ExportMeta_();
+
+ /// Override this method to export the content of <office:scripts>.
+ /// There is a default implementation.
+ virtual void ExportScripts_();
+
+ /// Override this method to export the font declarations
+ /// The default implementation will export the contents of the
+ /// XMLFontAutoStylePool if it has been created.
+ virtual void ExportFontDecls_();
+
+ /// Override this method to export the content of <style:styles>.
+ /// If bUsed is set, used styles should be exported only.
+ /// Overriding Methods must call this method !
+ virtual void ExportStyles_( bool bUsed );
+
+ /// Override this method to export the contents of <style:auto-styles>.
+ virtual void ExportAutoStyles_() = 0;
+
+ /// Override this method to export the contents of <style:master-styles>.
+ virtual void ExportMasterStyles_() = 0;
+
+ /// Override this method to export the content of <office:body>.
+ virtual void ExportContent_() = 0;
+
+ OUString const & GetSourceShellID() const;
+ OUString const & GetDestinationShellID() const;
+
+ // save linked sections? (may be false in global documents)
+ bool mbSaveLinkedSections;
+
+ virtual XMLTextParagraphExport* CreateTextParagraphExport();
+ virtual XMLShapeExport* CreateShapeExport();
+ virtual SvXMLAutoStylePoolP* CreateAutoStylePool();
+ SchXMLExportHelper* CreateChartExport();
+ virtual XMLPageExport* CreatePageExport();
+ virtual XMLFontAutoStylePool* CreateFontAutoStylePool();
+ xmloff::OFormLayerXMLExport* CreateFormExport();
+ virtual void GetViewSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps);
+ virtual void GetConfigurationSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps);
+
+ struct SettingsGroup
+ {
+ ::xmloff::token::XMLTokenEnum eGroupName;
+ css::uno::Sequence< css::beans::PropertyValue > aSettings;
+
+ SettingsGroup(
+ const ::xmloff::token::XMLTokenEnum _eGroupName,
+ const css::uno::Sequence< css::beans::PropertyValue >& _rSettings )
+ :eGroupName( _eGroupName )
+ ,aSettings( _rSettings )
+ {
+ }
+ };
+ /** returns the current document settings
+
+ The default implementation will obtain the view settings by calling GetViewSettingsAndViews, and the
+ configuration settings by calling GetConfigurationSettings, and return them together with the proper XML token.
+
+ @return
+ the accumulated count of all settings in all groups
+ */
+ virtual sal_Int32 GetDocumentSpecificSettings( ::std::vector< SettingsGroup >& _out_rSettings );
+
+ const css::uno::Reference< css::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; }
+ inline void SetEmbeddedResolver( css::uno::Reference< css::document::XEmbeddedObjectResolver > const & _xEmbeddedResolver );
+
+ const css::uno::Reference<css::document::XGraphicStorageHandler> & GetGraphicStorageHandler() const
+ {
+ return mxGraphicStorageHandler;
+ }
+ void SetGraphicStorageHandler(css::uno::Reference<css::document::XGraphicStorageHandler> const & rxGraphicStorageHandler);
+
+ void SetDocHandler( const css::uno::Reference< css::xml::sax::XDocumentHandler > &rHandler );
+
+ bool mbAutoStylesCollected;
+public:
+
+ SvXMLExport(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ OUString const & implementationName,
+ sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/,
+ const enum ::xmloff::token::XMLTokenEnum eClass,
+ SvXMLExportFlags nExportFlag );
+
+ SvXMLExport(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ OUString const & implementationName,
+ const OUString& rFileName,
+ sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/,
+ const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler);
+
+ SvXMLExport(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ OUString const & implementationName,
+ const OUString& rFileName,
+ const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler,
+ const css::uno::Reference< css::frame::XModel > &,
+ FieldUnit const eDefaultFieldUnit,
+ SvXMLExportFlags nExportFlag );
+
+ virtual ~SvXMLExport() override;
+
+ virtual void collectAutoStyles();
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override;
+ virtual void SAL_CALL cancel() override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) override;
+ virtual void SAL_CALL setName( const OUString& aName ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) final override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) final override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) final override;
+
+ // XUnoTunnel
+ UNO3_GETIMPLEMENTATION_DECL(SvXMLExport)
+
+ /** ensures that the given namespace is in scope at the next started
+ element.
+
+ <p>If the namespace is not yet declared, the necessary attribute will
+ be added, as well.</p>
+
+ @param i_rNamespace the namespace to be declared
+
+ @returns the actual prefix that the namespace is associated with
+ */
+ OUString EnsureNamespace(OUString const & i_rNamespace );
+
+ // Check if common attribute list is empty.
+#ifndef DBG_UTIL
+ void CheckAttrList() { (void) this; /* avoid loplugin:staticmethods */ }
+#else
+ void CheckAttrList();
+#endif
+
+ // Clear common attribute list.
+ void ClearAttrList();
+
+ // Add an attribute to the common attribute list.
+ void AddAttribute( sal_uInt16 nPrefix, const OUString& rName,
+ const OUString& rValue );
+ void AddAttribute( sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ const OUString& rValue );
+ void AddAttribute( sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ enum ::xmloff::token::XMLTokenEnum eValue );
+ void AddAttribute( const OUString& rQName,
+ const OUString& rValue );
+ void AddAttribute( const OUString& rQName,
+ enum ::xmloff::token::XMLTokenEnum eValue );
+
+ /** Add language tag attributes, deciding which are necessary.
+
+ @param nPrefix
+ Namespace prefix for *:language, *:script and *:country
+
+ @param nPrefixRfc
+ Namespace prefix for *:rfc-language-tag
+
+ @param bWriteEmpty
+ Whether to write empty *:language and *:country attribute
+ values in case of an empty locale (denoting system).
+ */
+ void AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPrefixRfc,
+ const css::lang::Locale& rLocale, bool bWriteEmpty);
+
+ /** Same as AddLanguageTagAttributes() but with LanguageTag parameter
+ instead of Locale.
+ */
+ void AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPrefixRfc,
+ const LanguageTag& rLanguageTag, bool bWriteEmpty );
+
+ // add several attributes to the common attribute list
+ void AddAttributeList( const css::uno::Reference<
+ css::xml::sax::XAttributeList >& xAttrList );
+
+ // Get common attribute list as implementation or interface.
+ SvXMLAttributeList &GetAttrList() { return *mxAttrList; }
+ css::uno::Reference< css::xml::sax::XAttributeList > GetXAttrList() const { return mxAttrList; }
+
+ // Get document handler. This methods are not const, because the
+ // reference allows modifications through the handler.
+ const css::uno::Reference< css::xml::sax::XDocumentHandler > & GetDocHandler() const { return mxHandler; }
+
+ // Get original URL.
+ const OUString& GetOrigFileName() const { return msOrigFileName; }
+
+ // Get (const) namespace map.
+ const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
+
+ // Get author id to remove personal info
+ size_t GetInfoID( const OUString sPersonalInfo ) const { return mpAuthorIDs->GetInfoID(sPersonalInfo); }
+
+ // Get unit converter
+ const SvXMLUnitConverter& GetMM100UnitConverter() const { return maUnitConv; }
+
+ SvXMLUnitConverter& GetMM100UnitConverter() { return maUnitConv; }
+
+ void addChaffWhenEncryptedStorage();
+
+ // Export the document.
+ virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
+
+ void collectDataStyles(bool bFromUsedStyles);
+ virtual void addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat = false );
+ virtual void exportDataStyles();
+ virtual void exportAutoDataStyles();
+ virtual OUString getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat = false ) const;
+ sal_Int32 dataStyleForceSystemLanguage(sal_Int32 nFormat) const;
+
+ virtual void exportAnnotationMeta( const css::uno::Reference < css::drawing::XShape >& xShape);
+
+ // Get XModel
+ const css::uno::Reference< css::frame::XModel > &
+ GetModel() const { return mxModel; }
+ // Get XNumberFormatsSupplier
+ css::uno::Reference< css::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier() { return mxNumberFormatsSupplier; }
+ void SetNumberFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
+ {
+ mxNumberFormatsSupplier = _xNumberFormatSupplier;
+ if ( mxNumberFormatsSupplier.is() && mxHandler.is() )
+ mpNumExport.reset( new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier) );
+ }
+
+ // get export helper for text
+ inline rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport();
+
+ // get export helper for shapes
+ inline rtl::Reference< XMLShapeExport > const & GetShapeExport();
+
+ // get auto style pool
+ inline rtl::Reference< SvXMLAutoStylePoolP > const & GetAutoStylePool();
+
+ // get Page Export
+ inline rtl::Reference< XMLPageExport > const & GetPageExport();
+
+ // get chart export helper
+ inline rtl::Reference< SchXMLExportHelper > const & GetChartExport();
+
+ // get font auto style pool
+ inline rtl::Reference< XMLFontAutoStylePool > const & GetFontAutoStylePool();
+
+ ProgressBarHelper* GetProgressBarHelper();
+
+ // get Formlayer Export
+ inline rtl::Reference< xmloff::OFormLayerXMLExport > const & GetFormExport();
+ inline bool HasFormExport() const;
+
+ // get XPropertySet with export information
+ const css::uno::Reference< css::beans::XPropertySet >& getExportInfo() const { return mxExportInfo; }
+
+ const css::uno::Reference< css::task::XStatusIndicator >& GetStatusIndicator() const { return mxStatusIndicator; }
+
+ /// get Event export, with handlers for script types "None" and
+ /// "StarBasic" already registered; other handlers may be registered, too.
+ XMLEventExport& GetEventExport();
+
+ /// get the export for image maps
+ XMLImageMapExport& GetImageMapExport();
+
+ OUString AddEmbeddedXGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic, OUString & rOutMimeType, OUString const & rRequestedName = OUString());
+ bool AddEmbeddedXGraphicAsBase64(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic);
+ bool GetGraphicMimeTypeFromStream(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic, OUString & rOutMimeType);
+
+ OUString AddEmbeddedObject(
+ const OUString& rEmbeddedObjectURL );
+ bool AddEmbeddedObjectAsBase64(
+ const OUString& rEmbeddedObjectURL );
+
+ OUString EncodeStyleName( const OUString& rName,
+ bool *pEncoded=nullptr ) const;
+
+ // save linked sections?
+ bool IsSaveLinkedSections() const { return mbSaveLinkedSections; }
+
+ // get export flags
+ SvXMLExportFlags getExportFlags() const { return mnExportFlags; }
+
+ void ExportEmbeddedOwnObject(
+ css::uno::Reference<css::lang::XComponent > const & rComp );
+
+ OUString GetRelativeReference(const OUString& rValue);
+
+ // methods for accessing the document handler and handling SAX errors
+ void StartElement(sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ bool bIgnWSOutside );
+ void StartElement(const OUString& rName,
+ bool bIgnWSOutside );
+ void Characters(const OUString& rChars);
+ void EndElement(sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ bool bIgnWSInside );
+ void EndElement(const OUString& rName,
+ bool bIgnWSInside );
+ void IgnorableWhitespace();
+
+ /**
+ * Record an error condition that occurred during export. The
+ * behavior of SetError can be modified using the error flag
+ * constants.
+ */
+ void SetError(
+ /// error ID, may contain an error flag
+ sal_Int32 nId,
+ /// string parameters for the error message
+ const css::uno::Sequence< OUString> & rMsgParams,
+ /// original exception message (if applicable)
+ const OUString& rExceptionMessage,
+ /// error location (if applicable)
+ const css::uno::Reference<css::xml::sax::XLocator> & rLocator );
+
+ void SetError(
+ sal_Int32 nId,
+ const css::uno::Sequence< OUString> & rMsgParams);
+
+ virtual void DisposingModel();
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
+
+ const css::uno::Reference< css::uno::XComponentContext >& getComponentContext() const { return m_xContext;}
+
+ // Shapes in Writer cannot be named via context menu (#i51726#)
+ SvtModuleOptions::EFactory GetModelType() const
+ {
+ return meModelType;
+ }
+
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ bool writeOutlineStyleAsNormalListStyle() const;
+
+ css::uno::Reference< css::embed::XStorage > const & GetTargetStorage() const;
+
+ /// returns value of ODF version attribute
+ char const* GetODFVersionAttributeValue() const;
+
+ /// returns the deterministic version for odf export
+ SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const;
+
+ // FIXME: this is only for legacy stuff that has not yet been adapted
+ // to implement XMetadatable; this can write duplicate IDs!
+ /// add xml:id and legacy namespace id
+ void SAL_DLLPRIVATE AddAttributeIdLegacy(
+ sal_uInt16 const nLegacyPrefix, OUString const& rValue);
+
+ /// add xml:id attribute (for RDF metadata)
+ void AddAttributeXmlId(css::uno::Reference<css::uno::XInterface> const & i_xIfc);
+
+ /// add RDFa attributes for a metadatable text content
+ void AddAttributesRDFa( css::uno::Reference<css::text::XTextContent> const & i_xTextContent);
+
+ bool exportTextNumberElement() const;
+
+ /// set null date from model to unit converter, if not already done
+ bool SetNullDateOnUnitConverter();
+
+ /// Get clamped mimetype for image export (empty if none)
+ OUString const & GetImageFilterName() const;
+};
+
+inline rtl::Reference< XMLTextParagraphExport > const & SvXMLExport::GetTextParagraphExport()
+{
+ if( !mxTextParagraphExport.is() )
+ mxTextParagraphExport = CreateTextParagraphExport();
+
+ return mxTextParagraphExport;
+}
+
+inline rtl::Reference< XMLShapeExport > const & SvXMLExport::GetShapeExport()
+{
+ if( !mxShapeExport.is() )
+ mxShapeExport = CreateShapeExport();
+
+ return mxShapeExport;
+}
+
+inline rtl::Reference< SvXMLAutoStylePoolP > const & SvXMLExport::GetAutoStylePool()
+{
+ if( !mxAutoStylePool.is() )
+ mxAutoStylePool = CreateAutoStylePool();
+
+ return mxAutoStylePool;
+}
+
+inline rtl::Reference< SchXMLExportHelper > const & SvXMLExport::GetChartExport()
+{
+ if( !mxChartExport.is() )
+ mxChartExport = CreateChartExport();
+
+ return mxChartExport;
+}
+
+inline rtl::Reference< XMLPageExport > const & SvXMLExport::GetPageExport()
+{
+ if( !mxPageExport.is() )
+ mxPageExport = CreatePageExport();
+
+ return mxPageExport;
+}
+
+inline rtl::Reference< XMLFontAutoStylePool > const & SvXMLExport::GetFontAutoStylePool()
+{
+ if( !mxFontAutoStylePool.is() )
+ mxFontAutoStylePool = CreateFontAutoStylePool();
+
+ return mxFontAutoStylePool;
+}
+
+inline rtl::Reference< xmloff::OFormLayerXMLExport > const & SvXMLExport::GetFormExport()
+{
+ if( !mxFormExport.is() )
+ mxFormExport = CreateFormExport();
+
+ return mxFormExport;
+}
+
+inline bool SvXMLExport::HasFormExport() const
+{
+ return mxFormExport.is();
+}
+
+inline void SvXMLExport::SetEmbeddedResolver(
+ css::uno::Reference< css::document::XEmbeddedObjectResolver > const & _xEmbeddedResolver )
+{
+ mxEmbeddedResolver = _xEmbeddedResolver;
+}
+
+inline void SvXMLExport::SetGraphicStorageHandler(
+ css::uno::Reference<css::document::XGraphicStorageHandler> const & rxGraphicStorageHandler)
+{
+ mxGraphicStorageHandler = rxGraphicStorageHandler;
+}
+
+// Helper class to export an element.
+class XMLOFF_DLLPUBLIC SvXMLElementExport
+{
+ SvXMLExport& mrExport;
+ OUString maElementName;
+ const bool mbIgnoreWhitespaceInside :1;
+ const bool mbDoSomething :1;
+
+ SAL_DLLPRIVATE
+ void StartElement(
+ const sal_uInt16 nPrefix,
+ const OUString& rName,
+ const bool bIgnoreWhitespaceOutside );
+
+public:
+
+ // The constructor prints a start tag that has the common attributes
+ // of the XMLExport instance attached.
+ SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
+ const char *pName,
+ bool bIgnWSOutside, bool bIgnWSInside );
+ SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
+ const OUString& rName,
+ bool bIgnWSOutside, bool bIgnWSInside );
+ SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ bool bIgnWSOutside, bool bIgnWSInside );
+ SvXMLElementExport( SvXMLExport& rExp, const OUString& rQName,
+ bool bIgnWSOutside, bool bIgnWSInside );
+
+ // These constructors do nothing if bDoSomething is not set
+ SvXMLElementExport( SvXMLExport& rExp, bool bDoSomething,
+ sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ bool bIgnWSOutside, bool bIgnWSInside );
+
+ // The destructor prints an end tag.
+ ~SvXMLElementExport();
+};
+
+#endif // _XMLOFF_SVXMLEXP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlexppr.hxx b/include/xmloff/xmlexppr.hxx
new file mode 100644
index 000000000..5e47201a5
--- /dev/null
+++ b/include/xmloff/xmlexppr.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLEXPPR_HXX
+#define INCLUDED_XMLOFF_XMLEXPPR_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <salhelper/simplereferenceobject.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <rtl/ustring.hxx>
+
+#include <memory>
+#include <vector>
+
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace com::sun::star::beans { class XPropertySet; }
+namespace rtl { template <class reference_type> class Reference; }
+
+class XMLPropertySetMapper;
+struct XMLPropertyState;
+
+enum class SvXmlExportFlags {
+ NONE = 0x0000,
+ IGN_WS = 0x0008
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvXmlExportFlags> : is_typed_flags<SvXmlExportFlags, 0x08> {};
+}
+
+class SvXMLUnitConverter;
+class SvXMLAttributeList;
+class SvXMLNamespaceMap;
+class SvXMLExport;
+
+class XMLOFF_DLLPUBLIC SvXMLExportPropertyMapper : public salhelper::SimpleReferenceObject
+{
+ struct Impl;
+ std::unique_ptr<Impl> mpImpl;
+
+protected:
+
+ /** Filter all properties we don't want to export:
+ Take all properties of the XPropertySet which are also found in the
+ XMLPropertyMapEntry-array and which are not set directly (so, the value isn't
+ default and isn't inherited, apart from bDefault is true)
+ After this process It'll called 'Contextfilter' for application-specific
+ filter-processes. */
+ std::vector<XMLPropertyState> Filter_(
+ SvXMLExport const& rExport,
+ const css::uno::Reference<css::beans::XPropertySet>& rPropSet,
+ bool bDefault, bool bDisableFoFontFamily ) const;
+
+ /** Application-specific filter. By default do nothing. */
+ virtual void ContextFilter(
+ bool bEnableFoFontFamily,
+ ::std::vector< XMLPropertyState >& rProperties,
+ const css::uno::Reference<css::beans::XPropertySet >& rPropSet ) const;
+
+ /** fills the given attribute list with the items in the given set */
+ void _exportXML( sal_uInt16 nPropType, sal_uInt16& rPropTypeFlags,
+ SvXMLAttributeList& rAttrList,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ std::vector<sal_uInt16>* pIndexArray,
+ sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx ) const;
+
+ void _exportXML( SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const;
+
+ void exportElementItems(
+ SvXMLExport& rExport,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ SvXmlExportFlags nFlags,
+ const std::vector<sal_uInt16>& rIndexArray ) const;
+
+public:
+
+ SvXMLExportPropertyMapper(
+ const rtl::Reference< XMLPropertySetMapper >& rMapper );
+ virtual ~SvXMLExportPropertyMapper() override;
+
+ // Add a ExportPropertyMapper at the end of the import mapper chain.
+ // The added mapper MUST not be used outside the Mapper chain any longer,
+ // because its PropertyMapper will be replaced.
+ void ChainExportMapper(
+ const rtl::Reference< SvXMLExportPropertyMapper>& rMapper );
+
+ /** Filter all properties we don't want to export:
+ Take all properties of the XPropertySet which are also found in the
+ XMLPropertyMapEntry-array and which are not set directly (so, the value isn't
+ default and isn't inherited)
+ After this process It'll called 'Contextfilter' for application-specific
+ filter-processes. */
+ std::vector<XMLPropertyState> Filter(
+ SvXMLExport const& rExport,
+ const css::uno::Reference<css::beans::XPropertySet>& rPropSet, bool bEnableFoFontFamily = false ) const;
+
+ /** Like Filter(), except that:
+ * - only properties that have the map flag MID_FLAG_DEFAULT_ITEM_EXPORT
+ * set are exported,
+ * - instead of the property's value, its default value is exported.
+ */
+ std::vector<XMLPropertyState> FilterDefaults(
+ SvXMLExport const& rExport,
+ const css::uno::Reference<css::beans::XPropertySet>& rPropSet ) const;
+
+ /** Provides a partial ordering over two arrays of XMLPropertyState,
+ Partial because implementing a full order requires quite a lot of code. */
+ bool LessPartial( const ::std::vector< XMLPropertyState >& aProperties1,
+ const ::std::vector< XMLPropertyState >& aProperties2 ) const;
+
+ /** Compare two arrays of XMLPropertyState */
+ bool Equals( const ::std::vector< XMLPropertyState >& aProperties1,
+ const ::std::vector< XMLPropertyState >& aProperties2 ) const;
+ void exportXML(
+ SvXMLExport& rExport,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ SvXmlExportFlags nFlags,
+ bool bUseExtensionNamespaceForGraphicProperties = false ) const;
+
+ /** like above but only properties whose property map index is within the
+ * specified range are exported
+ *
+ * @param bExtensionNamespace use the extension namespace for graphic-properties
+ */
+ void exportXML(
+ SvXMLExport& rExport,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
+ SvXmlExportFlags nFlags, bool bExtensionNamespace = false ) const;
+
+ /** this method is called for every item that has the
+ MID_FLAG_ELEMENT_EXPORT flag set */
+ virtual void handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ SvXmlExportFlags nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const;
+
+ /** this method is called for every item that has the
+ MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
+ virtual void handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const;
+
+ const rtl::Reference<XMLPropertySetMapper>& getPropertySetMapper() const;
+
+ void SetStyleName( const OUString& rStyleName );
+ const OUString& GetStyleName() const;
+};
+
+#endif // INCLUDED_XMLOFF_XMLEXPPR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlictxt.hxx b/include/xmloff/xmlictxt.hxx
new file mode 100644
index 000000000..7ff91aa84
--- /dev/null
+++ b/include/xmloff/xmlictxt.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLICTXT_HXX
+#define INCLUDED_XMLOFF_XMLICTXT_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/log.hxx>
+#include <sal/types.h>
+#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <rtl/ustring.hxx>
+#include <xmloff/namespacemap.hxx>
+#include <optional>
+
+namespace com::sun::star::xml::sax { class XAttributeList; }
+
+class SvXMLImport;
+
+class SvXMLImportContext;
+
+typedef rtl::Reference<SvXMLImportContext> SvXMLImportContextRef;
+
+/**
+This class deliberately does not support XWeak, to improve performance when loading
+large documents.
+*/
+class XMLOFF_DLLPUBLIC SvXMLImportContext : public css::xml::sax::XFastContextHandler,
+ public css::lang::XTypeProvider
+
+{
+ friend class SvXMLImport;
+
+ SvXMLImport& mrImport;
+ oslInterlockedCount m_nRefCount;
+ std::optional<SvXMLNamespaceMap> m_xRewindMap;
+
+ SAL_DLLPRIVATE std::optional<SvXMLNamespaceMap> TakeRewindMap() { return std::move(m_xRewindMap); }
+ SAL_DLLPRIVATE void PutRewindMap(std::optional<SvXMLNamespaceMap>&& p) { m_xRewindMap = std::move(p); }
+
+protected:
+
+ SvXMLImport& GetImport() { return mrImport; }
+ const SvXMLImport& GetImport() const { return mrImport; }
+
+public:
+
+ /** A contexts constructor does anything that is required if an element
+ * starts. Namespace processing has been done already.
+ * Note that virtual methods cannot be used inside constructors. Use
+ * StartElement instead if this is required. */
+ SvXMLImportContext( SvXMLImport& rImport );
+
+ /** A contexts destructor does anything that is required if an element
+ * ends. By default, nothing is done.
+ * Note that virtual methods cannot be used inside destructors. Use
+ * EndElement instead if this is required. */
+ virtual ~SvXMLImportContext();
+
+ // css::xml::sax::XFastContextHandler:
+ virtual void SAL_CALL startFastElement (sal_Int32 Element,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs) override;
+
+ virtual void SAL_CALL startUnknownElement(const OUString & Namespace, const OUString & Name,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+
+ /** endFastElement is called before a context will be destructed, but
+ * after an elements context has been parsed. It may be used for actions
+ * that require virtual methods. The default is to do nothing. */
+ virtual void SAL_CALL endFastElement(sal_Int32 Element) override;
+
+ virtual void SAL_CALL endUnknownElement(const OUString & Namespace, const OUString & Name) override;
+
+ virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& Attribs) override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext(
+ const OUString & Namespace, const OUString & Name,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+
+ /** This method is called for all characters that are contained in the
+ * current element. The default is to ignore them. */
+ virtual void SAL_CALL characters(const OUString & aChars) override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) final override;
+ virtual void SAL_CALL acquire() noexcept final override
+ { osl_atomic_increment(&m_nRefCount); }
+ virtual void SAL_CALL release() noexcept final override
+ { if (osl_atomic_decrement(&m_nRefCount) == 0) delete this; }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) final override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) final override;
+};
+
+#define XMLOFF_WARN_UNKNOWN(area, rIter) \
+ SAL_WARN(area, "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(rIter.getToken()) << " value=" << rIter.toString());
+
+#define XMLOFF_WARN_UNKNOWN_ATTR(area, token, value) \
+ SAL_WARN(area, "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(token) << "=" << value);
+
+#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token) \
+ SAL_WARN(area, "unknown element " << SvXMLImport::getPrefixAndNameFromToken(token));
+
+#endif // INCLUDED_XMLOFF_XMLICTXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
new file mode 100644
index 000000000..1a7731739
--- /dev/null
+++ b/include/xmloff/xmlimp.hxx
@@ -0,0 +1,664 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLIMP_HXX
+#define INCLUDED_XMLOFF_XMLIMP_HXX
+
+#include <sal/config.h>
+
+#include <set>
+#include <stack>
+#include <string_view>
+
+#include <o3tl/deleter.hxx>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XFastParser.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/shapeimport.hxx>
+#include <xmloff/SchXMLImportHelper.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <xmloff/formlayerimport.hxx>
+#include <sax/fastattribs.hxx>
+#include <rtl/ustring.hxx>
+#include <unordered_map>
+
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <o3tl/typed_flags_set.hxx>
+#include <memory>
+#include <optional>
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::beans { struct NamedValue; }
+namespace com::sun::star::document { class XEmbeddedObjectResolver; }
+namespace com::sun::star::document { class XGraphicStorageHandler; }
+namespace com::sun::star::embed { class XStorage; }
+namespace com::sun::star::graphic { class XGraphic; }
+namespace com::sun::star::task { class XStatusIndicator; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::util { class XNumberFormatsSupplier; }
+namespace com::sun::star::xml::sax { class XAttributeList; }
+namespace com::sun::star::xml::sax { class XFastAttributeList; }
+namespace com::sun::star::xml::sax { class XFastContextHandler; }
+namespace com::sun::star {
+ namespace frame { class XModel; }
+ namespace io { class XOutputStream; }
+ namespace rdf { class XMetadatable; }
+}
+
+namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
+namespace comphelper { class AttributeList; }
+
+namespace xmloff {
+ class RDFaImportHelper;
+}
+namespace xmloff::token {
+ class FastTokenHandler;
+}
+class EmbeddedFontsHelper;
+class ProgressBarHelper;
+class SvXMLNamespaceMap;
+class SvXMLImport_Impl;
+class SvXMLUnitConverter;
+class SvXMLNumFmtHelper;
+class XMLFontStylesContext;
+class XMLEventImportHelper;
+class XMLErrors;
+class StyleMap;
+enum class SvXMLErrorFlags;
+
+constexpr sal_Int32 LAST_NAMESPACE = 121; // last value in xmloff/xmnspe.hxx
+constexpr size_t NMSP_SHIFT = 16;
+constexpr sal_Int32 TOKEN_MASK = 0xffff;
+constexpr sal_Int32 NMSP_MASK = 0xffff0000;
+
+#define XML_ELEMENT( prefix, name ) ( NAMESPACE_TOKEN(XML_NAMESPACE_##prefix) | name )
+
+constexpr sal_Int32 NAMESPACE_TOKEN( sal_uInt16 prefixToken )
+{
+ return ( prefixToken + 1 ) << NMSP_SHIFT;
+}
+
+constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
+{
+ auto nTmp = ((nToken & NMSP_MASK) >> NMSP_SHIFT) - 1;
+ return nTmp == nNamespacePrefix;
+}
+
+
+enum class SvXMLImportFlags {
+ NONE = 0x0000,
+ META = 0x0001,
+ STYLES = 0x0002,
+ MASTERSTYLES = 0x0004,
+ AUTOSTYLES = 0x0008,
+ CONTENT = 0x0010,
+ SCRIPTS = 0x0020,
+ SETTINGS = 0x0040,
+ FONTDECLS = 0x0080,
+ EMBEDDED = 0x0100,
+ ALL = 0xffff
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvXMLImportFlags> : is_typed_flags<SvXMLImportFlags, 0xffff> {};
+}
+
+class SvXMLImportFastNamespaceHandler final : public ::cppu::WeakImplHelper< css::xml::sax::XFastNamespaceHandler >
+{
+private:
+ struct NamespaceDefine
+ {
+ OUString m_aPrefix;
+ OUString m_aNamespaceURI;
+
+ NamespaceDefine( const OUString& rPrefix, const OUString& rNamespaceURI ) : m_aPrefix( rPrefix ), m_aNamespaceURI( rNamespaceURI ) {}
+ };
+ std::vector< NamespaceDefine > m_aNamespaceDefines;
+
+public:
+ SvXMLImportFastNamespaceHandler();
+ void addNSDeclAttributes( rtl::Reference < comphelper::AttributeList > const & rAttrList );
+
+ //XFastNamespaceHandler
+ virtual void SAL_CALL registerNamespace( const OUString& rNamespacePrefix, const OUString& rNamespaceURI ) override;
+ virtual OUString SAL_CALL getNamespaceURI( const OUString& rNamespacePrefix ) override;
+};
+
+class XMLOFF_DLLPUBLIC SvXMLLegacyToFastDocHandler final : public ::cppu::WeakImplHelper<
+ css::xml::sax::XDocumentHandler,
+ css::document::XImporter >
+{
+private:
+ rtl::Reference< SvXMLImport > mrImport;
+ rtl::Reference< sax_fastparser::FastAttributeList > mxFastAttributes;
+ std::stack<sal_uInt16> maDefaultNamespaces;
+
+public:
+ SvXMLLegacyToFastDocHandler( const rtl::Reference< SvXMLImport > & rImport );
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
+
+ // css::xml::sax::XDocumentHandler
+ virtual void SAL_CALL startDocument() override;
+ virtual void SAL_CALL endDocument() override;
+ virtual void SAL_CALL startElement(const OUString& aName,
+ const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs) override;
+ virtual void SAL_CALL endElement(const OUString& aName) override;
+ virtual void SAL_CALL characters(const OUString& aChars) override;
+ virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) override;
+ virtual void SAL_CALL processingInstruction(const OUString& aTarget,
+ const OUString& aData) override;
+ virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > & xLocator) override;
+};
+
+class XMLOFF_DLLPUBLIC SvXMLImport : public cppu::WeakImplHelper<
+ css::xml::sax::XFastDocumentHandler,
+ css::lang::XServiceInfo,
+ css::lang::XInitialization,
+ css::document::XImporter,
+ css::document::XFilter,
+ css::lang::XUnoTunnel,
+ css::xml::sax::XFastParser>
+{
+ friend class SvXMLImportContext;
+ friend class SvXMLLegacyToFastDocHandler;
+
+ css::uno::Reference< css::xml::sax::XLocator > mxLocator;
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
+ css::uno::Reference< css::document::XGraphicStorageHandler > mxGraphicStorageHandler;
+ css::uno::Reference< css::document::XEmbeddedObjectResolver > mxEmbeddedResolver;
+ css::uno::Reference< css::beans::XPropertySet > mxImportInfo;
+
+ rtl::Reference< XMLTextImportHelper > mxTextImport;
+ rtl::Reference< XMLShapeImportHelper > mxShapeImport;
+ rtl::Reference< SchXMLImportHelper > mxChartImport;
+ rtl::Reference< ::xmloff::OFormLayerXMLImport > mxFormImport;
+
+ rtl::Reference<XMLFontStylesContext> mxFontDecls;
+ rtl::Reference<SvXMLStylesContext> mxStyles;
+ rtl::Reference<SvXMLStylesContext> mxAutoStyles;
+ rtl::Reference<SvXMLStylesContext> mxMasterStyles;
+
+ css::uno::Reference< css::container::XNameContainer > mxGradientHelper;
+ css::uno::Reference< css::container::XNameContainer > mxHatchHelper;
+ css::uno::Reference< css::container::XNameContainer > mxBitmapHelper;
+ css::uno::Reference< css::container::XNameContainer > mxTransGradientHelper;
+ css::uno::Reference< css::container::XNameContainer > mxMarkerHelper;
+ css::uno::Reference< css::container::XNameContainer > mxDashHelper;
+ css::uno::Reference< css::container::XNameContainer > mxNumberStyles;
+ css::uno::Reference< css::lang::XEventListener > mxEventListener;
+
+ std::unique_ptr<SvXMLImport_Impl> mpImpl; // dummy
+
+ std::optional<SvXMLNamespaceMap> mxNamespaceMap;
+ std::unique_ptr<SvXMLUnitConverter> mpUnitConv;
+ std::stack<SvXMLImportContextRef, std::vector<SvXMLImportContextRef>>
+ maContexts;
+ std::unique_ptr<SvXMLNumFmtHelper> mpNumImport;
+ std::unique_ptr<ProgressBarHelper> mpProgressBarHelper;
+ std::unique_ptr<XMLEventImportHelper> mpEventImportHelper;
+ std::unique_ptr<XMLErrors> mpXMLErrors;
+ rtl::Reference<StyleMap> mpStyleMap;
+
+ SAL_DLLPRIVATE void InitCtor_();
+
+ SvXMLImportFlags mnImportFlags;
+ std::set< OUString > embeddedFontUrlsKnown;
+ css::uno::Reference< css::xml::sax::XFastParser > mxParser;
+ rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler;
+ rtl::Reference < comphelper::AttributeList > maNamespaceAttrList;
+ css::uno::Reference< css::xml::sax::XFastDocumentHandler > mxFastDocumentHandler;
+ static rtl::Reference< xmloff::token::FastTokenHandler > xTokenHandler;
+ static std::unordered_map< sal_Int32, std::pair< OUString, OUString > > aNamespaceMap;
+ static std::unordered_map< OUString, OUString > aNamespaceURIPrefixMap;
+ static bool bIsNSMapsInitialized;
+
+ static void initializeNamespaceMaps();
+ void registerNamespaces();
+public:
+ static std::optional<SvXMLNamespaceMap> processNSAttributes(
+ std::optional<SvXMLNamespaceMap> & rpNamespaceMap,
+ SvXMLImport *const pImport,
+ const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList);
+private:
+
+ css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator;
+
+ // tdf#69060 & tdf#137643 import embedded fonts and activate them in a
+ // batch in EmbeddedFontsHelper's dtor
+ std::unique_ptr<EmbeddedFontsHelper, o3tl::default_delete<EmbeddedFontsHelper>> mxEmbeddedFontHelper;
+
+protected:
+ bool mbIsFormsSupported;
+ bool mbIsTableShapeSupported;
+ bool mbNotifyMacroEventRead;
+
+ // Create top-level element context.
+ // This method is called after the namespace map has been updated, but
+ // before a context for the current element has been pushed.
+ // This base class implementation returns a context that ignores everything.
+ virtual SvXMLImportContext *CreateFastContext( sal_Int32 Element,
+ const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList >& xAttrList );
+
+ virtual XMLTextImportHelper* CreateTextImport();
+ void ClearTextImport() { mxTextImport = nullptr; }
+ virtual XMLShapeImportHelper* CreateShapeImport();
+ bool HasShapeImport() const { return mxShapeImport.is(); }
+ void ClearShapeImport() { mxShapeImport = nullptr; }
+
+ static SchXMLImportHelper* CreateChartImport();
+ ::xmloff::OFormLayerXMLImport* CreateFormImport();
+
+ void SetFontDecls( XMLFontStylesContext *pFontDecls );
+ void SetStyles( SvXMLStylesContext *pStyles );
+ void SetAutoStyles( SvXMLStylesContext *pAutoStyles );
+ void SetMasterStyles( SvXMLStylesContext *pMasterStyles );
+
+ bool IsODFVersionConsistent( const OUString& aODFVersion );
+
+ const css::uno::Reference< css::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; }
+ inline void SetEmbeddedResolver( css::uno::Reference< css::document::XEmbeddedObjectResolver > const & _xEmbeddedResolver );
+
+ const css::uno::Reference<css::document::XGraphicStorageHandler> & GetGraphicStorageHandler() const
+ {
+ return mxGraphicStorageHandler;
+ }
+ void SetGraphicStorageHandler(css::uno::Reference<css::document::XGraphicStorageHandler> const & rxGraphicStorageHandler);
+
+ void CreateNumberFormatsSupplier_();
+ void CreateDataStylesImport_();
+
+public:
+ // SvXMLImport( sal_uInt16 nImportFlags = IMPORT_ALL ) throw();
+ /**
+ * @param sSupportedServiceNames if this is empty we default to our normal supported service names
+ */
+ SvXMLImport(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ OUString const & implementationName,
+ SvXMLImportFlags nImportFlags = SvXMLImportFlags::ALL,
+ const css::uno::Sequence< OUString > & sSupportedServiceNames = {});
+
+ void cleanup() noexcept;
+
+ virtual ~SvXMLImport() noexcept override;
+
+ virtual void SAL_CALL startDocument() override;
+ virtual void SAL_CALL endDocument() override;
+ virtual void SAL_CALL characters(const OUString& aChars) override;
+ virtual void SAL_CALL processingInstruction(const OUString& aTarget,
+ const OUString& aData) override;
+ virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > & xLocator) override;
+
+ // ::css::xml::sax::XFastContextHandler
+ virtual void SAL_CALL startFastElement(sal_Int32 Element,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+ virtual void SAL_CALL startUnknownElement(const OUString & Namespace,
+ const OUString & Name,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+ virtual void SAL_CALL endFastElement(sal_Int32 Element) override;
+ virtual void SAL_CALL endUnknownElement(const OUString & Namespace,
+ const OUString & Name) override;
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(sal_Int32 Element,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
+ createUnknownChildContext(const OUString & Namespace, const OUString & Name,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+
+ // XFastParser
+ virtual void SAL_CALL parseStream( const css::xml::sax::InputSource& aInputSource ) override;
+ virtual void SAL_CALL setFastDocumentHandler( const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& Handler ) override;
+ virtual void SAL_CALL setTokenHandler( const css::uno::Reference< css::xml::sax::XFastTokenHandler >& Handler ) override;
+ virtual void SAL_CALL registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) override;
+ virtual OUString SAL_CALL getNamespaceURL( const OUString& rPrefix ) override;
+ virtual void SAL_CALL setErrorHandler( const css::uno::Reference< css::xml::sax::XErrorHandler >& Handler ) override;
+ virtual void SAL_CALL setEntityResolver( const css::uno::Reference< css::xml::sax::XEntityResolver >& Resolver ) override;
+ virtual void SAL_CALL setLocale( const css::lang::Locale& rLocale ) override;
+ virtual void SAL_CALL setNamespaceHandler( const css::uno::Reference< css::xml::sax::XFastNamespaceHandler >& Handler) override;
+ virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements ) override;
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override;
+ virtual void SAL_CALL cancel( ) override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
+ // XUnoTunnel
+ static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() noexcept;
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) final override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) final override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) final override;
+
+ // may be called by certain subclasses that handle document meta-data
+ // override to provide customized handling of document statistics
+ // the base class implementation initializes the progress bar and should
+ // be called by overriding methods
+ virtual void SetStatistics(const css::uno::Sequence< css::beans::NamedValue > & i_rStats);
+
+ // get import helper for text
+ inline rtl::Reference< XMLTextImportHelper > const & GetTextImport();
+ bool HasTextImport() const { return mxTextImport.is(); }
+ inline SvXMLNumFmtHelper* GetDataStylesImport();
+
+ // get import helper for shapes
+ inline rtl::Reference< XMLShapeImportHelper > const & GetShapeImport();
+
+ // get import helper for charts
+ inline rtl::Reference< SchXMLImportHelper > const & GetChartImport();
+
+ // get import helper for form layer
+ inline rtl::Reference< ::xmloff::OFormLayerXMLImport > const & GetFormImport();
+
+ // get XPropertySet with import information
+ const css::uno::Reference< css::beans::XPropertySet >& getImportInfo() const { return mxImportInfo; }
+
+ // get import helper for events
+ XMLEventImportHelper& GetEventImport();
+
+ static const OUString & getNameFromToken( sal_Int32 nToken );
+ static OUString getPrefixAndNameFromToken( sal_Int32 nToken );
+ static OUString getNamespacePrefixFromToken(sal_Int32 nToken, const SvXMLNamespaceMap* pMap);
+ static OUString getNamespaceURIFromToken( sal_Int32 nToken );
+ static OUString getNamespacePrefixFromURI( const OUString& rURI );
+ static sal_Int32 getTokenFromName(const OUString& sName);
+
+ SvXMLNamespaceMap& GetNamespaceMap() { return *mxNamespaceMap; }
+ const SvXMLNamespaceMap& GetNamespaceMap() const { return *mxNamespaceMap; }
+ const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; }
+ SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; }
+ const css::uno::Reference< css::xml::sax::XLocator > & GetLocator() const { return mxLocator; }
+ const css::uno::Reference< css::frame::XModel > &
+ GetModel() const { return mxModel; }
+
+ const css::uno::Reference< css::container::XNameContainer > & GetGradientHelper();
+ const css::uno::Reference< css::container::XNameContainer > & GetHatchHelper();
+ const css::uno::Reference< css::container::XNameContainer > & GetBitmapHelper();
+ const css::uno::Reference< css::container::XNameContainer > & GetTransGradientHelper();
+ const css::uno::Reference< css::container::XNameContainer > & GetMarkerHelper();
+ const css::uno::Reference< css::container::XNameContainer > & GetDashHelper();
+ inline css::uno::Reference< css::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier();
+ void SetNumberFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
+ {
+ mxNumberFormatsSupplier = _xNumberFormatSupplier;
+ }
+
+ css::uno::Reference<css::graphic::XGraphic> loadGraphicByURL(OUString const & rURL);
+ css::uno::Reference<css::graphic::XGraphic> loadGraphicFromBase64(css::uno::Reference<css::io::XOutputStream> const & rxOutputStream);
+
+ css::uno::Reference< css::io::XOutputStream > GetStreamForGraphicObjectURLFromBase64() const;
+
+ bool IsPackageURL( const OUString& rURL ) const;
+ OUString ResolveEmbeddedObjectURL( const OUString& rURL,
+ std::u16string_view rClassId );
+ css::uno::Reference< css::io::XOutputStream >
+ GetStreamForEmbeddedObjectURLFromBase64() const;
+ OUString ResolveEmbeddedObjectURLFromBase64();
+
+ // get source storage we're importing from (if available)
+ css::uno::Reference< css::embed::XStorage > const &
+ GetSourceStorage() const;
+
+ void AddStyleDisplayName( XmlStyleFamily nFamily,
+ const OUString& rName,
+ const OUString& rDisplayName );
+ OUString GetStyleDisplayName( XmlStyleFamily nFamily,
+ const OUString& rName ) const;
+
+ ProgressBarHelper* GetProgressBarHelper();
+
+ void AddNumberStyle(sal_Int32 nKey, const OUString& sName);
+
+ virtual void SetViewSettings(const css::uno::Sequence<css::beans::PropertyValue>& aViewProps);
+ virtual void SetConfigurationSettings(const css::uno::Sequence<css::beans::PropertyValue>& aConfigProps);
+ virtual void SetDocumentSpecificSettings(const OUString& _rSettingsGroupName,
+ const css::uno::Sequence<css::beans::PropertyValue>& _rSettings);
+
+ XMLFontStylesContext *GetFontDecls();
+ SvXMLStylesContext *GetStyles();
+ SvXMLStylesContext *GetAutoStyles();
+ const XMLFontStylesContext *GetFontDecls() const;
+ const SvXMLStylesContext *GetStyles() const;
+ const SvXMLStylesContext *GetAutoStyles() const;
+
+ SvXMLImportFlags getImportFlags() const { return mnImportFlags; }
+ bool IsFormsSupported() const { return mbIsFormsSupported; }
+ OUString GetAbsoluteReference(const OUString& rValue) const;
+
+ sal_Unicode ConvStarBatsCharToStarSymbol( sal_Unicode c );
+ sal_Unicode ConvStarMathCharToStarSymbol( sal_Unicode c );
+
+ bool IsTableShapeSupported() const { return mbIsTableShapeSupported; }
+
+ OUString GetODFVersion() const;
+ bool IsOOoXML() const; // legacy non-ODF format?
+ /// Determines if the document was generated by Microsoft Office.
+ bool IsMSO() const;
+
+ /**
+ * Record an error condition that occurred during import. The
+ * behavior of SetError can be modified using the error flag
+ * constants.
+ */
+ void SetError(
+ /// error ID, may contain an error flag
+ sal_Int32 nId,
+ /// string parameters for the error message
+ const css::uno::Sequence< OUString > & rMsgParams,
+ /// original exception message (if applicable)
+ const OUString& rExceptionMessage,
+ /// error location (if applicable)
+ const css::uno::Reference< css::xml::sax::XLocator> & rLocator );
+
+ void SetError(
+ sal_Int32 nId,
+ const css::uno::Sequence< OUString> & rMsgParams = {});
+
+ void SetError( sal_Int32 nId, const OUString& rMsg1 );
+
+ virtual void DisposingModel();
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
+
+ css::uno::Reference< css::uno::XComponentContext > const &
+ GetComponentContext() const;
+
+ // Convert drawing object positions from OOo file format to OASIS file format and vice versa (#i28749#)
+ bool IsShapePositionInHoriL2R() const;
+
+ bool IsTextDocInOOoFileFormat() const;
+
+ OUString GetBaseURL() const;
+ OUString GetDocumentBase() const;
+
+ /// set the XmlId attribute of given UNO object (for RDF metadata)
+ void SetXmlId(css::uno::Reference<
+ css::uno::XInterface> const & i_xIfc,
+ OUString const & i_rXmlId);
+
+ /// Add a RDFa statement; parameters are XML attribute values
+ void AddRDFa( const css::uno::Reference< css::rdf::XMetadatable>& i_xObject,
+ OUString const & i_rAbout,
+ OUString const & i_rProperty,
+ OUString const & i_rContent,
+ OUString const & i_rDatatype);
+
+ /// do not dllexport this; only for advanced cases (bookmark-start)
+ SAL_DLLPRIVATE ::xmloff::RDFaImportHelper & GetRDFaImportHelper();
+
+ // #i31958# XForms helper method
+ // (to be implemented by applications supporting XForms)
+ virtual void initXForms();
+
+ /** returns the upd and build id (f.e. "680m124$Build-8964" gives rMaster = 680 and rBuild = 8964)
+ from the metafile.
+ this only works if the meta.xml was already imported and the
+ import propertyset contains the string property "BuildId".
+ If false is returned the build ids are not available (yet).
+ **/
+ bool getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const;
+
+ static constexpr OUStringLiteral aNamespaceSeparator = u":";
+
+ static const sal_uInt16 OOo_1x = 10;
+ static const sal_uInt16 OOo_2x = 20;
+ static const sal_uInt16 OOo_30x = 30;
+ static const sal_uInt16 OOo_31x = 31;
+ static const sal_uInt16 OOo_32x = 32;
+ static const sal_uInt16 OOo_33x = 33;
+ static const sal_uInt16 OOo_34x = 34;
+ // for AOO, no release overlaps with OOo, so continue OOo version numbers
+ static const sal_uInt16 AOO_40x = 40;
+ // @ATTENTION: it's not usually ok to use the "4x" "wildcard" in an "=="
+ // comparison, since that will match unreleased versions too; it is also
+ // risky to use it in "<" comparison, because it requires checking and
+ // possibly adapting all such uses when a new value for a more specific
+ // version is added.
+ static const sal_uInt16 AOO_4x = 41;
+ static const sal_uInt16 LO_flag = 0x100;
+ static const sal_uInt16 LO_3x = 30 | LO_flag;
+ static const sal_uInt16 LO_41x = 41 | LO_flag;
+ static const sal_uInt16 LO_42x = 42 | LO_flag;
+ static const sal_uInt16 LO_43x = 43 | LO_flag;
+ static const sal_uInt16 LO_44x = 44 | LO_flag;
+ static const sal_uInt16 LO_5x = 50 | LO_flag;
+ /// @ATTENTION: when adding a new value more specific than "6x", grep for
+ /// all current uses and adapt them!!!
+ static const sal_uInt16 LO_6x = 60 | LO_flag;
+ static const sal_uInt16 LO_63x = 63 | LO_flag;
+ static const sal_uInt16 LO_7x = 70 | LO_flag;
+ static const sal_uInt16 ProductVersionUnknown = SAL_MAX_UINT16;
+
+ /** depending on whether the generator version indicates LO, compare
+ against either the given LO or given OOo version */
+ bool isGeneratorVersionOlderThan(
+ sal_uInt16 const nOOoVersion, sal_uInt16 const nLOVersion);
+
+ /** this checks the build ID and returns
+
+ * OOo_1x for files created with OpenOffice.org 1.x or StarOffice 7 (this also includes binary import over binfilter)
+ * OOo_2x for files created with OpenOffice.org 2.x or StarOffice 8
+ * OOo_30x for files created with OpenOffice.org 3.0/3.0.1 or StarOffice 9/9 PU01
+ * OOo_31x for files created with OpenOffice.org 3.1/3.1.1 or StarOffice 9 PU02/9 PU03
+ * OOo_32x for files created with OpenOffice.org 3.2/3.2.1 or StarOffice 9 PU04 or Oracle Open Office 3.2.1
+ * OOo_33x for files created with OpenOffice.org 3.3 (and minors) or Oracle Open Office 3.3 (and minors)
+ * OOo_34x for files created with OpenOffice.org 3.4 Beta or Oracle Open Office 3.4 Beta
+ * ProductVersionUnknown for files not created with OpenOffice.org, StarOffice or Oracle Open Office
+ */
+ sal_uInt16 getGeneratorVersion() const;
+
+ /**
+ Returns true if the embedded font document URL has already been processed.
+ Otherwise returns false and consequent calls with the same URL will return true.
+ */
+ bool embeddedFontAlreadyProcessed( const OUString& url );
+
+ // see EmbeddedFontsHelper::addEmbeddedFont
+ bool addEmbeddedFont( const css::uno::Reference< css::io::XInputStream >& stream,
+ const OUString& fontName, const char* extra,
+ std::vector< unsigned char > const & key, bool eot);
+
+ virtual void NotifyContainsEmbeddedFont() {}
+
+ // something referencing a macro/script was imported
+ void NotifyMacroEventRead();
+
+ bool needFixPositionAfterZ() const;
+};
+
+inline rtl::Reference< XMLTextImportHelper > const & SvXMLImport::GetTextImport()
+{
+ if( !mxTextImport.is() )
+ mxTextImport = CreateTextImport();
+
+ return mxTextImport;
+}
+
+inline rtl::Reference< XMLShapeImportHelper > const & SvXMLImport::GetShapeImport()
+{
+ if( !mxShapeImport.is() )
+ mxShapeImport = CreateShapeImport();
+
+ return mxShapeImport;
+}
+
+inline rtl::Reference< SchXMLImportHelper > const & SvXMLImport::GetChartImport()
+{
+ if( !mxChartImport.is() )
+ mxChartImport = CreateChartImport();
+
+ return mxChartImport;
+}
+
+inline rtl::Reference< ::xmloff::OFormLayerXMLImport > const & SvXMLImport::GetFormImport()
+{
+ if( !mxFormImport.is() )
+ mxFormImport = CreateFormImport();
+
+ return mxFormImport;
+}
+
+inline void SvXMLImport::SetEmbeddedResolver(
+ css::uno::Reference< css::document::XEmbeddedObjectResolver > const & _xEmbeddedResolver )
+{
+ mxEmbeddedResolver = _xEmbeddedResolver;
+}
+
+inline void SvXMLImport::SetGraphicStorageHandler(
+ css::uno::Reference<css::document::XGraphicStorageHandler> const & rxGraphicStorageHandler)
+{
+ mxGraphicStorageHandler = rxGraphicStorageHandler;
+}
+
+inline css::uno::Reference< css::util::XNumberFormatsSupplier > & SvXMLImport::GetNumberFormatsSupplier()
+{
+ if ( ! mxNumberFormatsSupplier.is() && mxModel.is() )
+ CreateNumberFormatsSupplier_();
+
+ return mxNumberFormatsSupplier;
+}
+
+inline SvXMLNumFmtHelper* SvXMLImport::GetDataStylesImport()
+{
+ if ( !mpNumImport )
+ CreateDataStylesImport_();
+
+ return mpNumImport.get();
+}
+
+
+#endif // INCLUDED_XMLOFF_XMLIMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlimppr.hxx b/include/xmloff/xmlimppr.hxx
new file mode 100644
index 000000000..8ce28dd5c
--- /dev/null
+++ b/include/xmloff/xmlimppr.hxx
@@ -0,0 +1,212 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_XMLOFF_XMLIMPPR_HXX
+#define INCLUDED_XMLOFF_XMLIMPPR_HXX
+
+#include <rtl/ref.hxx>
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+#include <vector>
+#include <salhelper/simplereferenceobject.hxx>
+
+namespace com::sun::star::beans { class XMultiPropertySet; }
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::beans { class XPropertySetInfo; }
+namespace com::sun::star::beans { class XTolerantMultiPropertySet; }
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::container { class XNameContainer; }
+namespace com::sun::star::uno { class Any; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+namespace com::sun::star::xml::sax { class XAttributeList; }
+namespace com::sun::star::xml::sax { class XFastAttributeList; }
+namespace com::sun::star::drawing { enum class SAL_DLLPUBLIC_RTTI FillStyle; }
+
+struct XMLPropertyState;
+class XMLPropertySetMapper;
+
+
+class SvXMLUnitConverter;
+class SvXMLNamespaceMap;
+class SvXMLImport;
+
+/** This struct is used as an optional parameter to the static
+ * _FillPropertySet() methods.
+ *
+ * It should not be used in any other context.
+ */
+struct ContextID_Index_Pair
+{
+ sal_Int16 /*const*/ nContextID;
+ sal_Int32 nIndex;
+ css::drawing::FillStyle /*const*/ nExpectedFillStyle;
+};
+
+class XMLOFF_DLLPUBLIC SvXMLImportPropertyMapper : public salhelper::SimpleReferenceObject
+{
+ rtl::Reference< SvXMLImportPropertyMapper> mxNextMapper;
+
+ SvXMLImport& rImport; // access to error handling
+
+ SvXMLImportPropertyMapper(SvXMLImportPropertyMapper const &) = delete;
+ SvXMLImportPropertyMapper& operator =(SvXMLImportPropertyMapper const &) = delete;
+
+protected:
+
+ rtl::Reference< XMLPropertySetMapper > maPropMapper;
+ SvXMLImport& GetImport() const { return rImport;}
+
+public:
+
+ SvXMLImportPropertyMapper(
+ const rtl::Reference< XMLPropertySetMapper >& rMapper,
+ SvXMLImport& rImport);
+ virtual ~SvXMLImportPropertyMapper() override;
+
+ // Add an ImportPropertyMapper at the end of the import mapper chain.
+ // The added mapper MUST not be used outside the Mapper chain any longer,
+ // because its PropertyMapper will be replaced.
+ void ChainImportMapper(
+ const rtl::Reference< SvXMLImportPropertyMapper>& rMapper );
+
+ /** fills the given itemset with the attributes in the given list
+ * the map is only searched within the range
+ * [nStartIdx, nEndIdx[
+ */
+ void importXML(
+ ::std::vector< XMLPropertyState >& rProperties,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt32 nPropType,
+ sal_Int32 nStartIdx, sal_Int32 nEndIdx ) const;
+
+ /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set */
+ virtual bool handleSpecialItem(
+ XMLPropertyState& rProperty,
+ ::std::vector< XMLPropertyState >& rProperties,
+ const OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const;
+
+ /** This method is called when all attributes have benn processed. It may be used to remove items that are incomplete */
+ virtual void finished(
+ ::std::vector< XMLPropertyState >& rProperties,
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
+
+ void CheckSpecialContext(
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
+ ContextID_Index_Pair* pSpecialContextIds ) const;
+
+ bool FillPropertySet(
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
+ ContextID_Index_Pair* pSpecialContextIds = nullptr ) const;
+
+ void FillPropertySequence(
+ const ::std::vector< XMLPropertyState >& aProperties,
+ css::uno::Sequence< css::beans::PropertyValue >& rValues )
+ const;
+
+ inline const rtl::Reference< XMLPropertySetMapper >&
+ getPropertySetMapper() const;
+
+
+ /** implementation helper for FillPropertySet: fill an XPropertySet.
+ * Exceptions will be asserted. */
+ static bool FillPropertySet_(
+ const ::std::vector<XMLPropertyState> & rProperties,
+ const css::uno::Reference< css::beans::XPropertySet> & rPropSet,
+ const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo,
+ const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
+ SvXMLImport& rImport,
+
+ // parameter for use by txtstyli.cxx; allows efficient
+ // catching the combined characters property
+ ContextID_Index_Pair* pSpecialContextIds );
+
+ /** implementation helper for FillPropertySet: fill an XMultiPropertySet.
+ * If unsuccessful, set return value. */
+ static bool FillMultiPropertySet_(
+ const ::std::vector<XMLPropertyState> & rProperties,
+ const css::uno::Reference< css::beans::XMultiPropertySet> & rMultiPropSet,
+ const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo,
+ const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
+
+ // parameters for use by txtstyli.cxx; allows efficient
+ // catching the combined characters property
+ ContextID_Index_Pair* pSpecialContextIds );
+
+ /** implementation helper for FillPropertySet: fill an XTolerantMultiPropertySet.
+ * If unsuccessful, set return value. */
+ static bool FillTolerantMultiPropertySet_(
+ const ::std::vector<XMLPropertyState> & rProperties,
+ const css::uno::Reference< css::beans::XTolerantMultiPropertySet> & rTolPropSet,
+ const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
+ SvXMLImport& rImport,
+
+ // parameters for use by txtstyli.cxx; allows efficient
+ // catching the combined characters property
+ ContextID_Index_Pair* pSpecialContextIds );
+
+
+ static void PrepareForMultiPropertySet_(
+ const ::std::vector<XMLPropertyState> & rProperties,
+ const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo,
+ const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
+ ContextID_Index_Pair* pSpecialContextIds,
+ css::uno::Sequence< OUString >& rNames,
+ css::uno::Sequence< css::uno::Any >& rValues);
+
+private:
+ void importXMLAttribute(
+ std::vector< XMLPropertyState >& rProperties,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt32 nPropType,
+ sal_Int32 nStartIdx,
+ sal_Int32 nEndIdx,
+ css::uno::Reference< css::container::XNameContainer >& xAttrContainer,
+ const OUString& sAttrName,
+ const OUString& aNamespaceURI,
+ const OUString& sValue) const;
+};
+
+
+inline const rtl::Reference< XMLPropertySetMapper >&
+ SvXMLImportPropertyMapper::getPropertySetMapper() const
+{
+ return maPropMapper;
+}
+
+namespace xmloff {
+
+bool IsIgnoreFillStyleNamedItem(
+ css::uno::Reference<css::beans::XPropertySet> const& xProps,
+ css::drawing::FillStyle nExpectedFillStyle);
+
+}
+
+#endif // INCLUDED_XMLOFF_XMLIMPPR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlmetae.hxx b/include/xmloff/xmlmetae.hxx
new file mode 100644
index 000000000..220807f55
--- /dev/null
+++ b/include/xmloff/xmlmetae.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLMETAE_HXX
+#define INCLUDED_XMLOFF_XMLMETAE_HXX
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#include <cppuhelper/implbase.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <vector>
+
+#include <com/sun/star/beans/StringPair.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+
+namespace com::sun::star::document { class XDocumentProperties; }
+namespace com::sun::star::util { struct DateTime; }
+
+
+class SvXMLExport;
+
+/** export meta data from an XDocumentProperties instance.
+
+ <p>
+ This class will start the export at the office:meta element,
+ not at the root element. This means that when <method>Export</method>
+ is called here, the document root element must already be written, but
+ office:meta must <em>not</em> be written.
+ </p>
+ */
+class SvXMLMetaExport final : public cppu::WeakImplHelper<
+ css::xml::sax::XDocumentHandler >
+{
+private:
+ SvXMLExport& mrExport;
+ css::uno::Reference< css::document::XDocumentProperties> mxDocProps;
+ /// counts levels of the xml document. necessary for special handling.
+ int m_level;
+ /// preserved namespaces. necessary because we do not write the root node.
+ std::vector< css::beans::StringPair > m_preservedNSs;
+
+ void SimpleStringElement(
+ const OUString& rText, sal_uInt16 nNamespace,
+ enum ::xmloff::token::XMLTokenEnum eElementName );
+ void SimpleDateTimeElement(
+ const css::util::DateTime & rDate, sal_uInt16 nNamespace,
+ enum ::xmloff::token::XMLTokenEnum eElementName );
+
+ /// currently unused; for exporting via the XDocumentProperties interface
+ void MExport_();
+
+public:
+ SvXMLMetaExport( SvXMLExport& i_rExport,
+ const css::uno::Reference< css::document::XDocumentProperties>& i_rDocProps);
+
+ virtual ~SvXMLMetaExport() override;
+
+ /// export via XSAXWriter interface, with fallback to _MExport
+ void Export();
+
+ static OUString GetISODateTimeString(
+ const css::util::DateTime& rDateTime );
+
+ // css::xml::sax::XDocumentHandler:
+ virtual void SAL_CALL startDocument() override;
+ virtual void SAL_CALL endDocument() override;
+ virtual void SAL_CALL startElement(const OUString & i_rName,
+ const css::uno::Reference<
+ css::xml::sax::XAttributeList > & i_xAttribs) override;
+ virtual void SAL_CALL endElement(const OUString & i_rName) override;
+ virtual void SAL_CALL characters(const OUString & i_rChars) override;
+ virtual void SAL_CALL ignorableWhitespace(
+ const OUString & i_rWhitespaces) override;
+ virtual void SAL_CALL processingInstruction(
+ const OUString & i_rTarget, const OUString & i_rData) override;
+ virtual void SAL_CALL setDocumentLocator(
+ const css::uno::Reference<
+ css::xml::sax::XLocator > & i_xLocator) override;
+
+};
+
+#endif // INCLUDED_XMLOFF_XMLMETAE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlmetai.hxx b/include/xmloff/xmlmetai.hxx
new file mode 100644
index 000000000..92fe0f085
--- /dev/null
+++ b/include/xmloff/xmlmetai.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLMETAI_HXX
+#define INCLUDED_XMLOFF_XMLMETAI_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <xmloff/xmlictxt.hxx>
+
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::document { class XDocumentProperties; }
+namespace com::sun::star::xml::dom { class XSAXDocumentBuilder2; }
+
+/// handles the top-level office:document-meta element of meta.xml documents
+// NB: virtual inheritance is needed so that the context that handles the
+// flat xml file format can multiply inherit properly
+class XMLOFF_DLLPUBLIC SvXMLMetaDocumentContext
+ : public virtual SvXMLImportContext
+{
+private:
+ css::uno::Reference< css::document::XDocumentProperties> mxDocProps;
+ css::uno::Reference< css::xml::dom::XSAXDocumentBuilder2> mxDocBuilder;
+
+public:
+ SvXMLMetaDocumentContext(SvXMLImport& rImport,
+ const css::uno::Reference< css::document::XDocumentProperties>& xDocProps);
+
+ virtual ~SvXMLMetaDocumentContext() override;
+
+ virtual void SAL_CALL startFastElement( sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
+
+public:
+ void FinishMetaElement();
+
+ static void setBuildId(const OUString & rGenerator,
+ const css::uno::Reference< css::beans::XPropertySet>& xImportInfo );
+};
+
+#endif // _ INCLUDED_XMLOFF_XMLMETAI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlnamespace.hxx b/include/xmloff/xmlnamespace.hxx
new file mode 100644
index 000000000..91ff2aae4
--- /dev/null
+++ b/include/xmloff/xmlnamespace.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLNMSPE_HXX
+#define INCLUDED_XMLOFF_XMLNMSPE_HXX
+
+#include <sal/types.h>
+
+// current namespaces
+// These namespaces have the same index in the namespace table as prefix used.
+// If a namespace is added, XML_OLD_NAMESPACE_BASE has to be adjusted!
+// * standard ODF elements and attributes
+constexpr sal_uInt16 XML_NAMESPACE_OFFICE = 0;
+constexpr sal_uInt16 XML_NAMESPACE_STYLE = 1;
+constexpr sal_uInt16 XML_NAMESPACE_TEXT = 2;
+constexpr sal_uInt16 XML_NAMESPACE_TABLE = 3;
+constexpr sal_uInt16 XML_NAMESPACE_DRAW = 4;
+constexpr sal_uInt16 XML_NAMESPACE_FO = 5;
+constexpr sal_uInt16 XML_NAMESPACE_XLINK = 6;
+constexpr sal_uInt16 XML_NAMESPACE_DC = 7;
+constexpr sal_uInt16 XML_NAMESPACE_META = 8;
+constexpr sal_uInt16 XML_NAMESPACE_NUMBER = 9;
+constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION = 10;
+constexpr sal_uInt16 XML_NAMESPACE_SVG = 11;
+constexpr sal_uInt16 XML_NAMESPACE_CHART = 12;
+constexpr sal_uInt16 XML_NAMESPACE_DR3D = 13;
+constexpr sal_uInt16 XML_NAMESPACE_MATH = 14;
+constexpr sal_uInt16 XML_NAMESPACE_FORM = 15;
+constexpr sal_uInt16 XML_NAMESPACE_SCRIPT = 16;
+constexpr sal_uInt16 XML_NAMESPACE_CONFIG = 17;
+constexpr sal_uInt16 XML_NAMESPACE_DB = 18;
+constexpr sal_uInt16 XML_NAMESPACE_XFORMS = 19;
+constexpr sal_uInt16 XML_NAMESPACE_SMIL = 20;
+constexpr sal_uInt16 XML_NAMESPACE_ANIMATION = 21;
+constexpr sal_uInt16 XML_NAMESPACE_XML = 22;
+constexpr sal_uInt16 XML_NAMESPACE_XHTML = 23;
+constexpr sal_uInt16 XML_NAMESPACE_GRDDL = 24;
+// * formula attribute values (standard ODF)
+constexpr sal_uInt16 XML_NAMESPACE_OF = 25; // OpenFormula aka ODFF
+// * event attribute values (standard W3C)
+constexpr sal_uInt16 XML_NAMESPACE_DOM = 26;
+// * XForms attribute values (standard W3C)
+constexpr sal_uInt16 XML_NAMESPACE_XSD = 27;
+constexpr sal_uInt16 XML_NAMESPACE_XSI = 28;
+// * following 3 namespaces are used for non-standard attribute values and non-ODF XML
+constexpr sal_uInt16 XML_NAMESPACE_OOO = 29; // lots of attributes, settings.xml, non-ODF XML
+constexpr sal_uInt16 XML_NAMESPACE_OOOW = 30; // formula attribute values
+constexpr sal_uInt16 XML_NAMESPACE_OOOC = 31; // formula attribute values
+// non-ODF XML namespaces
+constexpr sal_uInt16 XML_NAMESPACE_BLOCKLIST = 32;
+constexpr sal_uInt16 XML_NAMESPACE_FRAMEWORK = 33;
+constexpr sal_uInt16 XML_NAMESPACE_TCD = 34; // text conversion dictionary
+constexpr sal_uInt16 XML_NAMESPACE_DLG = 35;
+constexpr sal_uInt16 XML_NAMESPACE_REPORT = 36;
+constexpr sal_uInt16 XML_NAMESPACE_VERSIONS_LIST = 37;
+// OOo extension digital signatures, used in ODF 1.1
+constexpr sal_uInt16 XML_NAMESPACE_DSIG_OOO = 38;
+// ODF 1.2 digital signature namespaces
+constexpr sal_uInt16 XML_NAMESPACE_DSIG = 39;
+constexpr sal_uInt16 XML_NAMESPACE_DS = 40;
+constexpr sal_uInt16 XML_NAMESPACE_XADES132 = 41;
+constexpr sal_uInt16 XML_NAMESPACE_XADES141 = 42;
+// OOXML digital signature extension namespaces, also based on xmldsig-core
+constexpr sal_uInt16 XML_NAMESPACE_MDSSI = 43;
+constexpr sal_uInt16 XML_NAMESPACE_MSODIGSIG = 44;
+
+// namespaces for ODF extended formats
+constexpr sal_uInt16 XML_NAMESPACE_EXT_BASE = 50;
+constexpr sal_uInt16 XML_NAMESPACE_OFFICE_EXT = XML_NAMESPACE_EXT_BASE + 0;
+constexpr sal_uInt16 XML_NAMESPACE_TABLE_EXT = XML_NAMESPACE_EXT_BASE + 1;
+constexpr sal_uInt16 XML_NAMESPACE_CHART_EXT = XML_NAMESPACE_EXT_BASE + 2;
+constexpr sal_uInt16 XML_NAMESPACE_DRAW_EXT = XML_NAMESPACE_EXT_BASE + 3;
+constexpr sal_uInt16 XML_NAMESPACE_CALC_EXT = XML_NAMESPACE_EXT_BASE + 4;
+constexpr sal_uInt16 XML_NAMESPACE_LO_EXT = XML_NAMESPACE_EXT_BASE + 5;
+
+// experimental ODF extended namespaces
+constexpr sal_uInt16 XML_NAMESPACE_FIELD = XML_NAMESPACE_EXT_BASE + 6;
+constexpr sal_uInt16 XML_NAMESPACE_CSS3TEXT = XML_NAMESPACE_EXT_BASE + 7; // CSS Text Level 3
+constexpr sal_uInt16 XML_NAMESPACE_FORMX = XML_NAMESPACE_EXT_BASE + 8; // form interop extensions
+
+
+// namespaces for OOo formats
+constexpr sal_uInt16 XML_NAMESPACE_OOO_BASE = 60;
+constexpr sal_uInt16 XML_NAMESPACE_OFFICE_OOO = XML_NAMESPACE_OOO_BASE + 0;
+constexpr sal_uInt16 XML_NAMESPACE_META_OOO = XML_NAMESPACE_OOO_BASE + 1;
+constexpr sal_uInt16 XML_NAMESPACE_STYLE_OOO = XML_NAMESPACE_OOO_BASE + 2;
+constexpr sal_uInt16 XML_NAMESPACE_NUMBER_OOO = XML_NAMESPACE_OOO_BASE + 3;
+constexpr sal_uInt16 XML_NAMESPACE_TEXT_OOO = XML_NAMESPACE_OOO_BASE + 4;
+constexpr sal_uInt16 XML_NAMESPACE_TABLE_OOO = XML_NAMESPACE_OOO_BASE + 5;
+constexpr sal_uInt16 XML_NAMESPACE_DRAW_OOO = XML_NAMESPACE_OOO_BASE + 6;
+constexpr sal_uInt16 XML_NAMESPACE_DR3D_OOO = XML_NAMESPACE_OOO_BASE + 7;
+constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION_OOO = XML_NAMESPACE_OOO_BASE + 8;
+constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION_OASIS = XML_NAMESPACE_OOO_BASE + 9; // only used for some config files in sd/
+constexpr sal_uInt16 XML_NAMESPACE_CHART_OOO = XML_NAMESPACE_OOO_BASE + 10;
+constexpr sal_uInt16 XML_NAMESPACE_CONFIG_OOO = XML_NAMESPACE_OOO_BASE + 12;
+constexpr sal_uInt16 XML_NAMESPACE_FORM_OOO = XML_NAMESPACE_OOO_BASE + 13;
+constexpr sal_uInt16 XML_NAMESPACE_SCRIPT_OOO = XML_NAMESPACE_OOO_BASE + 14;
+constexpr sal_uInt16 XML_NAMESPACE_ANIMATION_OOO = XML_NAMESPACE_OOO_BASE + 15;
+
+constexpr sal_uInt16 XML_NAMESPACE_COMPAT_BASE = 80;
+constexpr sal_uInt16 XML_NAMESPACE_SVG_COMPAT = XML_NAMESPACE_COMPAT_BASE + 0;
+constexpr sal_uInt16 XML_NAMESPACE_FO_COMPAT = XML_NAMESPACE_COMPAT_BASE + 1;
+constexpr sal_uInt16 XML_NAMESPACE_SMIL_COMPAT = XML_NAMESPACE_COMPAT_BASE + 2;
+
+constexpr sal_uInt16 XML_NAMESPACE_OASIS_BASE = 90;
+constexpr sal_uInt16 XML_NAMESPACE_DB_OASIS = XML_NAMESPACE_OASIS_BASE + 0;
+constexpr sal_uInt16 XML_NAMESPACE_REPORT_OASIS = XML_NAMESPACE_OASIS_BASE + 1;
+
+// namespaces used in the technical preview (SO 5.2)
+constexpr sal_uInt16 XML_OLD_NAMESPACE_BASE = 100;
+constexpr sal_uInt16 XML_NAMESPACE_FO_SO52 = XML_OLD_NAMESPACE_BASE + 0;
+constexpr sal_uInt16 XML_NAMESPACE_XLINK_SO52 = XML_OLD_NAMESPACE_BASE + 1;
+constexpr sal_uInt16 XML_NAMESPACE_OFFICE_SO52 = XML_OLD_NAMESPACE_BASE + 2;
+constexpr sal_uInt16 XML_NAMESPACE_STYLE_SO52 = XML_OLD_NAMESPACE_BASE + 3;
+constexpr sal_uInt16 XML_NAMESPACE_TEXT_SO52 = XML_OLD_NAMESPACE_BASE + 4;
+constexpr sal_uInt16 XML_NAMESPACE_TABLE_SO52 = XML_OLD_NAMESPACE_BASE + 5;
+constexpr sal_uInt16 XML_NAMESPACE_META_SO52 = XML_OLD_NAMESPACE_BASE + 6;
+constexpr sal_uInt16 XML_NAMESPACE_DRAW_SO52 = XML_OLD_NAMESPACE_BASE + 7;
+constexpr sal_uInt16 XML_NAMESPACE_NUMBER_SO52 = XML_OLD_NAMESPACE_BASE + 8;
+constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION_SO52 = XML_OLD_NAMESPACE_BASE + 9;
+constexpr sal_uInt16 XML_NAMESPACE_CHART_SO52 = XML_OLD_NAMESPACE_BASE + 10;
+constexpr sal_uInt16 XML_NAMESPACE_SMIL_SO52 = XML_OLD_NAMESPACE_BASE + 11;
+
+#endif // INCLUDED_XMLOFF_XMLNMSPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlnume.hxx b/include/xmloff/xmlnume.hxx
new file mode 100644
index 000000000..68818f107
--- /dev/null
+++ b/include/xmloff/xmlnume.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLNUME_HXX
+#define INCLUDED_XMLOFF_XMLNUME_HXX
+
+#include <rtl/ustring.hxx>
+#include <xmloff/dllapi.h>
+
+namespace com::sun::star {
+ namespace style { class XStyle; }
+ namespace container { class XIndexReplace; }
+ namespace beans { struct PropertyValue; }
+}
+
+namespace com::sun::star::uno { template <class E> class Sequence; }
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+
+class SvXMLExport;
+class XMLTextListAutoStylePool;
+
+class XMLOFF_DLLPUBLIC SvxXMLNumRuleExport final
+{
+ SvXMLExport& rExport;
+ // Boolean indicating, if properties for position-and-space-mode LABEL_ALIGNMENT
+ // are exported or not. (#i89178#)
+ // These properties have been introduced in ODF 1.2. Thus, its export have
+ // to be suppressed on writing ODF 1.0 respectively ODF 1.1
+ bool mbExportPositionAndSpaceModeLabelAlignment;
+
+ SAL_DLLPRIVATE void exportLevelStyle(
+ sal_Int32 nLevel,
+ const css::uno::Sequence< css::beans::PropertyValue>& rProps,
+ bool bOutline );
+
+ SAL_DLLPRIVATE void exportStyle( const css::uno::Reference< css::style::XStyle >& rStyle );
+ SAL_DLLPRIVATE void exportOutline();
+
+ SvXMLExport& GetExport() { return rExport; }
+
+public:
+
+ SvxXMLNumRuleExport( SvXMLExport& rExport );
+
+ // should be private but sw::StoredChapterNumberingExport needs it
+ void exportLevelStyles(
+ const css::uno::Reference< css::container::XIndexReplace > & xNumRule,
+ bool bOutline=false );
+
+ void exportStyles( bool bUsed,
+ XMLTextListAutoStylePool *pPool,
+ bool bExportChapterNumbering );
+ void exportNumberingRule(
+ const OUString& rName, bool bIsHidden,
+ const css::uno::Reference< css::container::XIndexReplace > & xNumRule );
+};
+
+#endif // INCLUDED_XMLOFF_XMLNUME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx
new file mode 100644
index 000000000..3d1f48ddf
--- /dev/null
+++ b/include/xmloff/xmlnumfe.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLNUMFE_HXX
+#define INCLUDED_XMLOFF_XMLNUMFE_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ustrbuf.hxx>
+#include <i18nlangtag/lang.h>
+#include <memory>
+
+namespace com::sun::star::lang { struct Locale; }
+namespace com::sun::star::uno { template <typename > class Reference; }
+namespace com::sun::star::util { class XNumberFormatsSupplier; }
+
+inline constexpr OUStringLiteral XML_WRITTENNUMBERSTYLES = u"WrittenNumberStyles";
+
+class Color;
+class LocaleDataWrapper;
+class CharClass;
+class SvXMLExport;
+class SvNumberFormatter;
+class SvNumberformat;
+class SvXMLNumUsedList_Impl;
+
+class SvXMLEmbeddedTextEntryArr;
+
+class XMLOFF_DLLPUBLIC SvXMLNumFmtExport final
+{
+private:
+ SvXMLExport& rExport;
+ OUString sPrefix;
+ SvNumberFormatter* pFormatter;
+ OUStringBuffer sTextContent;
+ bool bHasText;
+ std::unique_ptr<SvXMLNumUsedList_Impl> pUsedList;
+ std::unique_ptr<LocaleDataWrapper> pLocaleData;
+
+ SAL_DLLPRIVATE void AddCalendarAttr_Impl( const OUString& rCalendar );
+ SAL_DLLPRIVATE void AddStyleAttr_Impl( bool bLong );
+ SAL_DLLPRIVATE void AddLanguageAttr_Impl( LanguageType nLang );
+
+ SAL_DLLPRIVATE void AddToTextElement_Impl( std::u16string_view rString );
+ SAL_DLLPRIVATE void FinishTextElement_Impl(bool bUseExtensionNS = false);
+
+ SAL_DLLPRIVATE void WriteColorElement_Impl( const Color& rColor );
+ SAL_DLLPRIVATE void WriteNumberElement_Impl( sal_Int32 nDecimals, sal_Int32 nMinDecimals,
+ sal_Int32 nInteger, const OUString& rDashStr,
+ bool bGrouping, sal_Int32 nTrailingThousands,
+ const SvXMLEmbeddedTextEntryArr& rEmbeddedEntries );
+ SAL_DLLPRIVATE void WriteScientificElement_Impl( sal_Int32 nDecimals, sal_Int32 nMinDecimals, sal_Int32 nInteger,
+ bool bGrouping, sal_Int32 nExp, sal_Int32 nExpInterval, bool bExpSign );
+ SAL_DLLPRIVATE void WriteFractionElement_Impl( sal_Int32 nInteger, bool bGrouping,
+ const SvNumberformat& rFormat, sal_uInt16 nPart );
+ SAL_DLLPRIVATE void WriteCurrencyElement_Impl( const OUString& rString,
+ std::u16string_view rExt );
+ SAL_DLLPRIVATE void WriteBooleanElement_Impl();
+ SAL_DLLPRIVATE void WriteTextContentElement_Impl();
+ SAL_DLLPRIVATE void WriteDayElement_Impl( const OUString& rCalendar, bool bLong );
+ SAL_DLLPRIVATE void WriteMonthElement_Impl( const OUString& rCalendar, bool bLong, bool bText );
+ SAL_DLLPRIVATE void WriteYearElement_Impl( const OUString& rCalendar, bool bLong );
+ SAL_DLLPRIVATE void WriteEraElement_Impl( const OUString& rCalendar, bool bLong );
+ SAL_DLLPRIVATE void WriteDayOfWeekElement_Impl( const OUString& rCalendar, bool bLong );
+ SAL_DLLPRIVATE void WriteWeekElement_Impl( const OUString& rCalendar );
+ SAL_DLLPRIVATE void WriteQuarterElement_Impl( const OUString& rCalendar, bool bLong );
+ SAL_DLLPRIVATE void WriteHoursElement_Impl( bool bLong );
+ SAL_DLLPRIVATE void WriteMinutesElement_Impl( bool bLong );
+ SAL_DLLPRIVATE void WriteSecondsElement_Impl( bool bLong, sal_uInt16 nDecimals );
+ SAL_DLLPRIVATE void WriteAMPMElement_Impl();
+ SAL_DLLPRIVATE void WriteMapElement_Impl( sal_Int32 nOp, double fLimit,
+ sal_Int32 nKey, sal_Int32 nPart );
+
+ SAL_DLLPRIVATE void WriteRepeatedElement_Impl( sal_Unicode ch );
+ SAL_DLLPRIVATE bool WriteTextWithCurrency_Impl( const OUString& rString,
+ const css::lang::Locale& rLocale );
+ SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey,
+ sal_uInt16 nPart, bool bDefPart );
+
+ SAL_DLLPRIVATE void ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey );
+
+public:
+ SvXMLNumFmtExport( SvXMLExport& rExport,
+ const css::uno::Reference< css::util::XNumberFormatsSupplier >& rSupp );
+ SvXMLNumFmtExport( SvXMLExport& rExport,
+ const css::uno::Reference< css::util::XNumberFormatsSupplier >& rSupp,
+ const OUString& rPrefix );
+
+ ~SvXMLNumFmtExport();
+
+ // core API
+ void Export( bool bIsAutoStyle);
+
+ // mark number format as used
+ void SetUsed( sal_uInt32 nKey );
+
+ // get the style name that was generated for a key
+ OUString GetStyleName( sal_uInt32 nKey );
+
+ css::uno::Sequence<sal_Int32> GetWasUsed() const;
+ void SetWasUsed(const css::uno::Sequence<sal_Int32>& rWasUsed);
+
+
+ // two methods to allow the field import/export to treat system languages
+ // properly:
+
+ /// obtain number format with system language for a given key
+ sal_uInt32 ForceSystemLanguage( sal_uInt32 nKey );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlnumfi.hxx b/include/xmloff/xmlnumfi.hxx
new file mode 100644
index 000000000..9a18893df
--- /dev/null
+++ b/include/xmloff/xmlnumfi.hxx
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLNUMFI_HXX
+#define INCLUDED_XMLOFF_XMLNUMFI_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <xmloff/xmlstyle.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <i18nlangtag/lang.h>
+#include <memory>
+#include <vector>
+
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::util { class XNumberFormatsSupplier; }
+namespace com::sun::star::xml::sax { class XAttributeList; }
+
+inline constexpr OUStringLiteral XML_NUMBERSTYLES = u"NumberStyles";
+
+enum class SvXMLStylesTokens
+{
+ NUMBER_STYLE,
+ CURRENCY_STYLE,
+ PERCENTAGE_STYLE,
+ DATE_STYLE,
+ TIME_STYLE,
+ BOOLEAN_STYLE,
+ TEXT_STYLE
+};
+
+enum SvXMLDateElementAttributes
+{
+ XML_DEA_NONE,
+ XML_DEA_ANY,
+ XML_DEA_SHORT,
+ XML_DEA_LONG,
+ XML_DEA_TEXTSHORT,
+ XML_DEA_TEXTLONG
+};
+
+class Color;
+class SvXMLNumImpData;
+class SvXMLImport;
+struct SvXMLNumberInfo;
+class SvNumberFormatter;
+class LocaleDataWrapper;
+
+
+// use SvXMLNumFmtHelper in the context for <office:styles> to create
+// child contexts for data styles
+
+class SvXMLNumFmtHelper
+{
+ std::unique_ptr<SvXMLNumImpData> pData;
+
+public:
+ SvXMLNumFmtHelper(
+ const css::uno::Reference< css::util::XNumberFormatsSupplier >& rSupp,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+
+ SvXMLNumFmtHelper(
+ SvNumberFormatter* pNumberFormatter,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+
+ ~SvXMLNumFmtHelper();
+
+ SvXMLStyleContext* CreateChildContext( SvXMLImport& rImport,
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ SvXMLStylesContext& rStyles);
+
+ SvXMLNumImpData* getData() { return pData.get(); }
+
+ LanguageType GetLanguageForKey(sal_Int32 nKey) const;
+
+// sal_uInt32 GetKeyForName( const OUString& rName );
+};
+
+// SvXMLNumFmtDefaults is used in import and export
+
+class SvXMLNumFmtDefaults
+{
+public:
+ // return value is NfIndexTableOffset
+ static sal_uInt16 GetDefaultDateFormat( SvXMLDateElementAttributes eDOW,
+ SvXMLDateElementAttributes eDay, SvXMLDateElementAttributes eMonth,
+ SvXMLDateElementAttributes eYear, SvXMLDateElementAttributes eHours,
+ SvXMLDateElementAttributes eMins, SvXMLDateElementAttributes eSecs,
+ bool bSystem );
+};
+
+struct MyCondition
+{
+ OUString sCondition;
+ OUString sMapName;
+};
+
+class XMLOFF_DLLPUBLIC SvXMLNumFormatContext : public SvXMLStyleContext
+{
+public:
+ enum ImplicitCalendar
+ {
+ DEFAULT,
+ SECONDARY,
+ OTHER,
+ DEFAULT_FROM_OTHER,
+ SECONDARY_FROM_OTHER
+ };
+
+private:
+
+ SvXMLNumImpData* pData;
+ SvXMLStylesContext* pStyles;
+ std::vector <MyCondition> aMyConditions;
+ SvXMLStylesTokens nType;
+ sal_Int32 nKey;
+// OUString sFormatName;
+ OUString sFormatTitle;
+// OUString sMapName;
+ OUString sCalendar;
+ OUString aImplicitCalendar[2];
+ ImplicitCalendar eImplicitCalendar;
+ LanguageType nFormatLang;
+ bool bAutoOrder;
+ bool bFromSystem;
+ bool bTruncate;
+ bool bAutoDec; // set in AddNumber
+ bool bAutoInt; // set in AddNumber
+ bool bHasExtraText;
+ bool bHasTrailingEmptyText;
+ OUStringBuffer aFormatCode{64};
+ OUStringBuffer aConditions{32};
+ bool bHasLongDoW;
+ bool bHasDateTime;
+ bool bRemoveAfterUse;
+
+ // contained date elements, used to recognize default date formats
+ SvXMLDateElementAttributes eDateDOW;
+ SvXMLDateElementAttributes eDateDay;
+ SvXMLDateElementAttributes eDateMonth;
+ SvXMLDateElementAttributes eDateYear;
+ SvXMLDateElementAttributes eDateHours;
+ SvXMLDateElementAttributes eDateMins;
+ SvXMLDateElementAttributes eDateSecs;
+ bool bDateNoDefault;
+
+ SAL_DLLPRIVATE sal_Int32 PrivateGetKey();
+
+public:
+ SvXMLNumFormatContext( SvXMLImport& rImport,
+ sal_Int32 nElement,
+ SvXMLNumImpData* pNewData,
+ SvXMLStylesTokens nNewType,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
+ SvXMLStylesContext& rStyles );
+ SvXMLNumFormatContext( SvXMLImport& rImport,
+ const OUString& rName,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
+ const sal_Int32 nKey,
+ LanguageType nLang,
+ SvXMLStylesContext& rStyles );
+ virtual ~SvXMLNumFormatContext() override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+ virtual void CreateAndInsert(bool bOverwrite) override;
+
+ sal_Int32 GetKey();
+ sal_Int32 CreateAndInsert( SvNumberFormatter* pFormatter );
+ sal_Int32 CreateAndInsert( css::uno::Reference< css::util::XNumberFormatsSupplier > const & xFormatsSupplier );
+ SvXMLStylesTokens GetType() const { return nType; } // SvXMLStylesTokens
+
+ bool HasLongDoW() const { return bHasLongDoW; }
+ void SetHasLongDoW(bool bSet) { bHasLongDoW = bSet; }
+ void SetHasTrailingEmptyText(bool bSet) { bHasTrailingEmptyText = bSet; }
+
+ void UpdateCalendar( const OUString& rNewCalendar );
+ ImplicitCalendar GetImplicitCalendarState() const { return eImplicitCalendar; }
+
+ const LocaleDataWrapper& GetLocaleData() const;
+
+ void AddToCode( std::u16string_view rString );
+ void AddToCode( sal_Unicode c );
+ void AddNumber( const SvXMLNumberInfo& rInfo );
+ void AddCurrency( const OUString& rContent, LanguageType nLang );
+
+ void AddNfKeyword( sal_uInt16 nIndex );
+ bool ReplaceNfKeyword( sal_uInt16 nOld, sal_uInt16 nNew );
+ void AddCondition( const sal_Int32 nIndex );
+ void AddCondition( const OUString& rCondition, const OUString& rApplyName );
+ void AddColor( Color nColor );
+
+ /// determine whether number format uses the system language
+ bool IsSystemLanguage() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlnumi.hxx b/include/xmloff/xmlnumi.hxx
new file mode 100644
index 000000000..4adfd437b
--- /dev/null
+++ b/include/xmloff/xmlnumi.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLNUMI_HXX
+#define INCLUDED_XMLOFF_XMLNUMI_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+#include <vector>
+
+#include <xmloff/xmlstyle.hxx>
+
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::container { class XIndexReplace; }
+
+class SvxXMLListLevelStyleContext_Impl;
+typedef std::vector<rtl::Reference<SvxXMLListLevelStyleContext_Impl>> SvxXMLListStyle_Impl;
+
+class XMLOFF_DLLPUBLIC SvxXMLListStyleContext final
+ : public SvXMLStyleContext
+{
+ css::uno::Reference< css::container::XIndexReplace > xNumRules;
+
+ std::unique_ptr<SvxXMLListStyle_Impl> pLevelStyles;
+
+ bool bConsecutive : 1;
+ bool bOutline : 1;
+
+ SAL_DLLPRIVATE virtual void SetAttribute( sal_Int32 nElement,
+ const OUString& rValue ) override;
+
+public:
+
+ SvxXMLListStyleContext(
+ SvXMLImport& rImport,
+ bool bOutl = false );
+
+ ~SvxXMLListStyleContext() override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+
+ void FillUnoNumRule(
+ const css::uno::Reference< css::container::XIndexReplace> & rNumRule) const;
+
+ const css::uno::Reference< css::container::XIndexReplace >& GetNumRules() const
+ { return xNumRules; }
+
+ static css::uno::Reference< css::container::XIndexReplace >
+ CreateNumRule(
+ const css::uno::Reference< css::frame::XModel > & rModel );
+
+ static void SetDefaultStyle(
+ const css::uno::Reference< css::container::XIndexReplace > & rNumRule,
+ sal_Int16 nLevel,
+ bool bOrdered );
+
+ virtual void CreateAndInsertLate( bool bOverwrite ) override;
+
+ void CreateAndInsertAuto() const;
+};
+
+#endif // INCLUDED_XMLOFF_XMLNUMI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlprcon.hxx b/include/xmloff/xmlprcon.hxx
new file mode 100644
index 000000000..37ce9ba2c
--- /dev/null
+++ b/include/xmloff/xmlprcon.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLPRCON_HXX
+#define INCLUDED_XMLOFF_XMLPRCON_HXX
+
+#include <xmloff/xmlictxt.hxx>
+
+#include <vector>
+
+class SvXMLImportPropertyMapper;
+struct XMLPropertyState;
+
+class XMLOFF_DLLPUBLIC SvXMLPropertySetContext : public SvXMLImportContext
+{
+protected:
+ sal_Int32 mnStartIdx;
+ sal_Int32 mnEndIdx;
+ sal_uInt32 mnFamily;
+ ::std::vector< XMLPropertyState > &mrProperties;
+ rtl::Reference < SvXMLImportPropertyMapper > mxMapper;
+
+public:
+
+ SvXMLPropertySetContext(
+ SvXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ sal_uInt32 nFamily,
+ ::std::vector< XMLPropertyState > &rProps,
+ const rtl::Reference < SvXMLImportPropertyMapper > &rMap,
+ sal_Int32 nStartIdx = -1, sal_Int32 nEndIdx = -1 );
+
+ virtual ~SvXMLPropertySetContext() override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+
+ // This method is called from this instance implementation of
+ // CreateChildContext if the element matches an entry in the
+ // SvXMLImportItemMapper with the mid flag MID_FLAG_ELEMENT_ITEM_IMPORT
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp );
+
+};
+
+#endif // INCLUDED_XMLOFF_XMLPRCON_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlprhdl.hxx b/include/xmloff/xmlprhdl.hxx
new file mode 100644
index 000000000..e0b5a7edc
--- /dev/null
+++ b/include/xmloff/xmlprhdl.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLPRHDL_HXX
+#define INCLUDED_XMLOFF_XMLPRHDL_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::uno { class Any; }
+
+class SvXMLUnitConverter;
+
+
+/** Abstract base-class for different XML-types. Derivations of this class
+ knows how to compare, im/export a special XML-type
+*/
+class XMLOFF_DLLPUBLIC XMLPropertyHandler
+{
+
+public:
+ // Just needed for virtual destruction
+ virtual ~XMLPropertyHandler();
+
+ /** Compares two Any's in case of the given XML-data-type.
+ By default the Any-equal-operator is called. */
+ virtual bool equals( const css::uno::Any& r1, const css::uno::Any& r2 ) const;
+
+ /** Imports the given value according to the XML-data-type corresponding to
+ the derived class.
+ @retval true if the value was successfully converted to Any
+ @retval false if the value was not recognised (warning will be printed)
+ */
+ virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const =0;
+ /// Exports the given value according to the XML-data-type corresponding to
+ /// the derived class.
+ virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const =0;
+};
+
+#endif // INCLUDED_XMLOFF_XMLPRHDL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlprmap.hxx b/include/xmloff/xmlprmap.hxx
new file mode 100644
index 000000000..2a4b93e84
--- /dev/null
+++ b/include/xmloff/xmlprmap.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLPRMAP_HXX
+#define INCLUDED_XMLOFF_XMLPRMAP_HXX
+
+#include <xmloff/dllapi.h>
+#include <unotools/saveopt.hxx>
+#include <rtl/ustring.hxx>
+
+#include <salhelper/simplereferenceobject.hxx>
+#include <memory>
+
+namespace rtl { template <class reference_type> class Reference; }
+
+class SvXMLUnitConverter;
+class XMLPropertyHandler;
+class XMLPropertyHandlerFactory;
+struct XMLPropertyMapEntry;
+struct XMLPropertyState;
+
+class XMLOFF_DLLPUBLIC XMLPropertySetMapper : public salhelper::SimpleReferenceObject
+{
+ struct Impl;
+
+ std::unique_ptr<Impl> mpImpl;
+
+ XMLPropertySetMapper( const XMLPropertySetMapper& ) = delete;
+ XMLPropertySetMapper& operator= ( const XMLPropertySetMapper& ) = delete;
+
+public:
+ /** The last element of the XMLPropertyMapEntry-array must contain NULL-values.
+
+ @param bForExport
+ If TRUE, only entries that have the mbImportOnly flag not set
+ will be in the mappings.
+ */
+ XMLPropertySetMapper(
+ const XMLPropertyMapEntry* pEntries,
+ const rtl::Reference<XMLPropertyHandlerFactory>& rFactory,
+ bool bForExport );
+
+ virtual ~XMLPropertySetMapper() override;
+
+ void AddMapperEntry( const rtl::Reference < XMLPropertySetMapper >& rMapper );
+
+ /** Return number of entries in input-array */
+ sal_Int32 GetEntryCount() const;
+
+ /** Returns the flags of an entry */
+ sal_uInt32 GetEntryFlags( sal_Int32 nIndex ) const;
+
+ /** Returns the type of an entry */
+ sal_uInt32 GetEntryType( sal_Int32 nIndex ) const;
+
+ /** Returns the namespace-key of an entry */
+ sal_uInt16 GetEntryNameSpace( sal_Int32 nIndex ) const;
+
+ /** Returns the 'local' XML-name of the entry */
+ const OUString& GetEntryXMLName( sal_Int32 nIndex ) const;
+
+ /** Returns the entry API name */
+ const OUString& GetEntryAPIName( sal_Int32 nIndex ) const;
+
+ /** returns the entry context id. -1 is a valid index here. */
+ sal_Int16 GetEntryContextId( sal_Int32 nIndex ) const;
+
+ /** returns the earliest ODF version for which this property should be
+ exported as standard ODF element, which is the earliest ODF version
+ for which the property should not be exported as extension element.
+ */
+ SvtSaveOptions::ODFSaneDefaultVersion GetEarliestODFVersionForExport(sal_Int32 nIndex) const;
+
+ /** Returns the index of an entry with the given XML-name and namespace
+ If there is no matching entry the method returns -1 */
+ sal_Int32 GetEntryIndex(
+ sal_uInt16 nNamespace, std::u16string_view rStrName, sal_uInt32 nPropType,
+ sal_Int32 nStartAt = -1 ) const;
+
+ /** Returns the index of an entry with the given XML-name and namespace
+ If there is no matching entry the method returns -1 */
+ sal_Int32 GetEntryIndex(
+ sal_Int32 nElement, sal_uInt32 nPropType,
+ sal_Int32 nStartAt = -1 ) const;
+
+ /** Retrieves a PropertyHandler for that property which placed at nIndex in the XMLPropertyMapEntry-array */
+ const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nIndex ) const;
+
+ /** import/export
+ This methods calls the respective im/export-method of the respective PropertyHandler. */
+ bool exportXML(
+ OUString& rStrExpValue, const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+
+ bool importXML(
+ const OUString& rStrImpValue, XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+
+ /** searches for an entry that matches the given api name, namespace and local name or -1 if nothing found */
+ sal_Int32 FindEntryIndex(
+ const char* sApiName, sal_uInt16 nNameSpace, std::u16string_view sXMLName ) const;
+
+ /** searches for an entry that matches the given ContextId or gives -1 if nothing found */
+ sal_Int32 FindEntryIndex( const sal_Int16 nContextId ) const;
+
+ /** Remove an entry */
+ void RemoveEntry( sal_Int32 nIndex );
+};
+
+#endif // INCLUDED_XMLOFF_XMLPRMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlscripti.hxx b/include/xmloff/xmlscripti.hxx
new file mode 100644
index 000000000..0be5a0c6f
--- /dev/null
+++ b/include/xmloff/xmlscripti.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLSCRIPTI_HXX
+#define INCLUDED_XMLOFF_XMLSCRIPTI_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <xmloff/xmlictxt.hxx>
+
+namespace com::sun::star::frame {
+ class XModel;
+}
+
+class XMLOFF_DLLPUBLIC XMLScriptContext final : public SvXMLImportContext
+{
+private:
+ css::uno::Reference< css::frame::XModel > m_xModel;
+
+public:
+ XMLScriptContext( SvXMLImport& rImport,
+ const css::uno::Reference< css::frame::XModel>& rDocModel );
+ virtual ~XMLScriptContext() override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+};
+
+#endif // INCLUDED_XMLOFF_XMLSCRIPTI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlstyle.hxx b/include/xmloff/xmlstyle.hxx
new file mode 100644
index 000000000..04a74b841
--- /dev/null
+++ b/include/xmloff/xmlstyle.hxx
@@ -0,0 +1,205 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLSTYLE_HXX
+#define INCLUDED_XMLOFF_XMLSTYLE_HXX
+
+#include <rtl/ref.hxx>
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/families.hxx>
+#include <memory>
+
+class SvXMLStylesContext_Impl;
+class SvXMLImportPropertyMapper;
+class SvXMLTokenMap;
+
+namespace com::sun::star {
+namespace container { class XNameContainer; }
+namespace style { class XAutoStyleFamily; }
+}
+
+class XMLOFF_DLLPUBLIC SvXMLStyleContext : public SvXMLImportContext
+{
+ OUString maName;
+ OUString maDisplayName;
+ OUString maAutoName;
+ OUString maParentName;// Will be moved to XMLPropStyle soon!!!!
+ OUString maFollow; // Will be moved to XMLPropStyle soon!!!!
+ OUString maLinked;
+ bool mbHidden;
+
+ XmlStyleFamily mnFamily;
+
+ bool mbValid : 1; // Set this to false in CreateAndInsert
+ // if the style shouldn't be processed
+ // by Finish() or si somehow invalid.
+ bool mbNew : 1; // Set this to false in CreateAnsInsert
+ // if the style is already existing.
+ bool mbDefaultStyle : 1;
+
+protected:
+
+ virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue );
+
+ void SetFamily( XmlStyleFamily nSet ) { mnFamily = nSet; }
+ void SetAutoName( const OUString& rName ) { maAutoName = rName; }
+
+public:
+
+ SvXMLStyleContext( SvXMLImport& rImport,
+ XmlStyleFamily nFamily=XmlStyleFamily::DATA_STYLE,
+ bool bDefaultStyle = false );
+
+ virtual ~SvXMLStyleContext() override;
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override;
+
+ const OUString& GetName() const { return maName; }
+ const OUString& GetDisplayName() const { return maDisplayName.getLength() ? maDisplayName : maName; }
+ const OUString& GetAutoName() const { return maAutoName; }
+ const OUString& GetParentName() const { return maParentName; }
+ const OUString& GetFollow() const { return maFollow; }
+ const OUString& GetLinked() const { return maLinked; }
+
+ XmlStyleFamily GetFamily() const { return mnFamily; }
+
+ bool IsValid() const { return mbValid; }
+ void SetValid( bool b ) { mbValid = b; }
+
+ bool IsNew() const { return mbNew; }
+ void SetNew( bool b ) { mbNew = b; }
+
+ bool IsHidden() const { return mbHidden; }
+
+ // This method is called for every default style
+ virtual void SetDefaults();
+
+ // This method is called for every style. It must create it and insert
+ // it into the document.
+ virtual void CreateAndInsert( bool bOverwrite );
+
+ // This method is called for every style. It must create it and insert
+ // it into the document if this hasn't happened already in CreateAndInsert().
+ virtual void CreateAndInsertLate( bool bOverwrite );
+
+ // This method is called for every style after all styles have been
+ // inserted into the document.
+ virtual void Finish( bool bOverwrite );
+
+ bool IsDefaultStyle() const { return mbDefaultStyle; }
+
+ /** if this method returns true, its parent styles context
+ should not add it to its container.<br>
+ Transient styles can't be accessed from its
+ parent SvXMLStylesContext after they are imported and
+ the methods CreateAndInsert(), CreateAndInsertLate()
+ and Finish() will not be called.
+ The default return value is false
+ */
+ virtual bool IsTransient() const;
+};
+
+class XMLOFF_DLLPUBLIC SvXMLStylesContext : public SvXMLImportContext
+{
+ std::unique_ptr<SvXMLStylesContext_Impl> mpImpl;
+
+
+ css::uno::Reference< css::container::XNameContainer > mxParaStyles;
+
+ css::uno::Reference< css::container::XNameContainer > mxTextStyles;
+
+ css::uno::Reference< css::style::XAutoStyleFamily > mxParaAutoStyles;
+
+ css::uno::Reference< css::style::XAutoStyleFamily > mxTextAutoStyles;
+
+ rtl::Reference < SvXMLImportPropertyMapper > mxParaImpPropMapper;
+ rtl::Reference < SvXMLImportPropertyMapper > mxTextImpPropMapper;
+ rtl::Reference < SvXMLImportPropertyMapper > mxShapeImpPropMapper;
+ mutable rtl::Reference < SvXMLImportPropertyMapper > mxChartImpPropMapper;
+ mutable rtl::Reference < SvXMLImportPropertyMapper > mxPageImpPropMapper;
+
+ SvXMLStylesContext(SvXMLStylesContext const &) = delete;
+ SvXMLStylesContext& operator =(SvXMLStylesContext const &) = delete;
+
+protected:
+
+ sal_uInt32 GetStyleCount() const;
+ SvXMLStyleContext *GetStyle( sal_uInt32 i );
+ const SvXMLStyleContext *GetStyle( sal_uInt32 i ) const;
+
+ virtual SvXMLStyleContext *CreateStyleChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList );
+
+ virtual SvXMLStyleContext *CreateStyleStyleChildContext( XmlStyleFamily nFamily,
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList );
+
+ virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
+ XmlStyleFamily nFamily, sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList );
+
+ virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const;
+
+public:
+
+ SvXMLStylesContext( SvXMLImport& rImport,
+ bool bAutomatic = false );
+
+ virtual ~SvXMLStylesContext() override;
+
+ // Create child element.
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
+
+ // This allows to add an SvXMLStyleContext to this context from extern
+ void AddStyle(SvXMLStyleContext& rNew);
+
+ const SvXMLStyleContext *FindStyleChildContext(
+ XmlStyleFamily nFamily,
+ const OUString& rName,
+ bool bCreateIndex = false ) const;
+ static XmlStyleFamily GetFamily( std::u16string_view rFamily );
+ virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper(
+ XmlStyleFamily nFamily ) const;
+
+ virtual css::uno::Reference< css::container::XNameContainer >
+ GetStylesContainer( XmlStyleFamily nFamily ) const;
+ virtual OUString GetServiceName( XmlStyleFamily nFamily ) const;
+
+ css::uno::Reference< css::style::XAutoStyleFamily >
+ GetAutoStyles( XmlStyleFamily nFamily ) const;
+ void CopyAutoStylesToDoc();
+ void CopyStylesToDoc( bool bOverwrite, bool bFinish = true );
+ void FinishStyles( bool bOverwrite );
+
+ // This method must be called to release the references to all styles
+ // that are stored in the context.
+ void dispose();
+ bool IsAutomaticStyle() const;
+};
+
+#endif // INCLUDED_XMLOFF_XMLSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmltkmap.hxx b/include/xmloff/xmltkmap.hxx
new file mode 100644
index 000000000..e47719960
--- /dev/null
+++ b/include/xmloff/xmltkmap.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLTKMAP_HXX
+#define INCLUDED_XMLOFF_XMLTKMAP_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+#include <xmloff/xmltoken.hxx>
+#include <memory>
+
+
+class SvXMLTokenMap_Impl;
+
+#define XML_TOK_UNKNOWN 0xffffU
+#define XML_TOKEN_MAP_END { 0xffffU, xmloff::token::XML_TOKEN_INVALID, 0U }
+
+struct SvXMLTokenMapEntry
+{
+ enum xmloff::token::XMLTokenEnum eLocalName;
+ sal_uInt16 nPrefixKey;
+ sal_uInt16 nToken;
+
+ SvXMLTokenMapEntry( sal_uInt16 nPrefix, xmloff::token::XMLTokenEnum eName,
+ sal_uInt16 nTok ) :
+ eLocalName( eName ),
+ nPrefixKey( nPrefix ),
+ nToken( nTok )
+ {
+ }
+};
+
+class XMLOFF_DLLPUBLIC SvXMLTokenMap
+{
+private:
+ std::unique_ptr<SvXMLTokenMap_Impl> m_pImpl;
+
+public:
+
+ SvXMLTokenMap( const SvXMLTokenMapEntry* pMap );
+ ~SvXMLTokenMap();
+
+ sal_uInt16 Get( sal_uInt16 nPrefix, const OUString& rLName ) const;
+};
+
+#endif // INCLUDED_XMLOFF_XMLTKMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
new file mode 100644
index 000000000..77f9c605b
--- /dev/null
+++ b/include/xmloff/xmltoken.hxx
@@ -0,0 +1,3532 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLTOKEN_HXX
+#define INCLUDED_XMLOFF_XMLTOKEN_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sax/fastattribs.hxx>
+
+/**
+ * Handling of tokens in XML:
+ *
+ * This header defines te enum ::xmloff::token::XMLTokenEnum containing one
+ * value for every fixed string used in our XML files.
+ *
+ * Usage:
+ * To obtain an OUString for a token, use the GetXMLToken() function.
+ * To test equality of an OUString and a token, use IsXMLToken().
+ * Additionally, XMLTokenEnum values may be passed to SvXMLExport::AddAttribute
+ * methods and the SvXMLElementExport constructor.
+ */
+
+namespace xmloff::token {
+
+ // IMPORTANT! XMLTokenEnum order MUST be in synch with aTokenList in
+ // xmloff/source/core/xmltoken.cxx, and with xmloff/source/token/tokens.txt.
+
+ /**
+ * The enumeration of all XML tokens.
+ */
+ enum XMLTokenEnum : sal_Int16
+ {
+ XML_TOKEN_START = 0,
+ XML_TOKEN_INVALID = XML_TOKEN_START,
+
+ // common xml
+ XML_CDATA,
+ XML_WS,
+ XML_XML,
+ XML_XMLNS,
+ XML_XML_PI,
+ XML_XML_DOCTYPE_PREFIX,
+ XML_XML_DOCTYPE_SUFFIX,
+
+ // namespace prefixes and names
+ XML_N_XML,
+ XML_NP_OFFICE,
+ XML_N_OFFICE,
+ XML_N_OFFICE_OLD,
+ XML_NP_META,
+ XML_N_META,
+ XML_N_META_OLD,
+ XML_NP_STYLE,
+ XML_N_STYLE,
+ XML_N_STYLE_OLD,
+ XML_NP_NUMBER,
+ XML_N_NUMBER,
+ XML_N_NUMBER_OLD,
+ XML_NP_TEXT,
+ XML_N_TEXT,
+ XML_N_TEXT_OLD,
+ XML_NP_TABLE,
+ XML_N_TABLE,
+ XML_N_TABLE_OLD,
+ XML_NP_DRAW,
+ XML_N_DRAW,
+ XML_NP_DR3D,
+ XML_N_DR3D,
+ XML_N_DRAW_OLD,
+ XML_NP_PRESENTATION,
+ XML_N_PRESENTATION,
+ XML_N_PRESENTATION_OLD,
+ XML_NP_CHART,
+ XML_N_CHART,
+ XML_NP_CONFIG,
+ XML_N_CONFIG,
+ XML_N_CHART_OLD,
+ XML_NP_FO,
+ XML_N_FO_OLD,
+ XML_N_FO,
+ XML_NP_XLINK,
+ XML_N_XLINK,
+ XML_N_XLINK_OLD,
+ XML_NP_DC,
+ XML_N_DC,
+ XML_NP_SVG,
+ XML_N_SVG,
+ XML_NP_FORM,
+ XML_N_FORM,
+ XML_NP_SCRIPT,
+ XML_N_SCRIPT,
+ XML_NP_TCD,
+ XML_N_TCD,
+ XML_NP_XFORMS_1_0,
+ XML_N_XFORMS_1_0,
+ XML_NP_XSD,
+ XML_N_XSD,
+ XML_NP_XSI,
+ XML_N_XSI,
+
+ XML_NP_BLOCK_LIST,
+ XML_N_BLOCK_LIST,
+
+ XML_NP_MATH,
+ XML_N_MATH,
+
+ XML_NP_VERSIONS_LIST,
+ XML_N_VERSIONS_LIST,
+
+ // erAck: 2008-04-09T20:02+0200 OpenFormula aka ODFF
+ XML_NP_OF,
+ XML_N_OF,
+
+ // ODF 1.2 metadata: RDFa and GRDDL
+ XML_NP_XHTML,
+ XML_N_XHTML,
+ XML_NP_GRDDL,
+ XML_N_GRDDL,
+
+ // OOo extension digital signatures, used in ODF 1.1
+ XML_NP_DSIG_OOO,
+ XML_N_DSIG_OOO,
+ // ODF 1.2 digital signatures
+ XML_NP_DSIG,
+ XML_N_DSIG,
+ XML_NP_DS,
+ XML_N_DS,
+ XML_NP_XADES132,
+ XML_N_XADES132,
+ XML_NP_XADES141,
+ XML_N_XADES141,
+
+ // ODF Enhanced namespaces
+ XML_NP_OFFICE_EXT,
+ XML_N_OFFICE_EXT,
+
+ // jonp: 2008-09-24 Excel Interop
+ XML_NP_FORMX,
+ XML_N_FORMX,
+
+ XML_NP_TABLE_EXT,
+ XML_N_TABLE_EXT,
+
+ XML_NP_DRAW_EXT,
+ XML_N_DRAW_EXT,
+
+ // css text level 3
+ XML_NP_CSS3TEXT,
+ XML_N_CSS3TEXT,
+
+ // calc extensions
+ XML_NP_CALC_EXT,
+ XML_N_CALC_EXT,
+ // generic LO extensions
+ XML_NP_LO_EXT,
+ XML_N_LO_EXT,
+
+ // enhanced fields
+ XML_N_FIELD,
+ XML_NP_FIELD,
+
+ // units
+ XML_UNIT_M,
+ XML_UNIT_CM,
+ XML_UNIT_PT,
+ XML_UNIT_PC,
+ XML_UNIT_FOOT,
+
+ // any other
+ XML_1,
+ XML_10,
+ XML_2,
+ XML_3,
+ XML_4,
+ XML_5,
+ XML_6,
+ XML_7,
+ XML_8,
+ XML_9,
+ XML_A_UPCASE,
+ XML_I_UPCASE,
+ XML_IBM437,
+ XML_IBM850,
+ XML_IBM860,
+ XML_IBM861,
+ XML_IBM863,
+ XML_IBM865,
+ XML_ISO_8859_1,
+ XML_OLE2,
+ XML__COLON,
+ XML__EMPTY,
+ XML__UNKNOWN_,
+
+ XML_A,
+ XML_ABBREVIATED_NAME,
+ XML_ABOVE,
+ XML_ABS,
+ XML_ACCENT,
+ XML_ACCENTUNDER,
+ XML_ACCEPTANCE_STATE,
+ XML_ACCEPTED,
+ XML_ACTION,
+ XML_ACTIVE,
+ XML_ACTIVE_SPLIT_RANGE,
+ XML_ACTIVE_TABLE,
+ XML_ACTUATE,
+ XML_ADD_IN,
+ XML_ADD_IN_NAME,
+ XML_ADDRESS,
+ XML_ADJUSTMENT,
+ XML_ALGORITHM,
+ XML_ALIGN,
+ XML_ALL,
+ XML_ALLOW_EMPTY_CELL,
+ XML_ALLOW_DELETES,
+ XML_ALLOW_INSERTS,
+ XML_ALLOW_UPDATES,
+ XML_ALPHABETICAL_INDEX,
+ XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE,
+ XML_ALPHABETICAL_INDEX_ENTRY_TEMPLATE,
+ XML_ALPHABETICAL_INDEX_MARK,
+ XML_ALPHABETICAL_INDEX_MARK_END,
+ XML_ALPHABETICAL_INDEX_MARK_START,
+ XML_ALPHABETICAL_INDEX_SOURCE,
+ XML_ALPHABETICAL_SEPARATORS,
+ XML_ALTERNATE,
+ XML_AM_PM,
+ XML_AMBIENT_COLOR,
+ XML_ANCHOR_PAGE_NUMBER,
+ XML_ANCHOR_TYPE,
+ XML_AND,
+ XML_ANIMATION,
+ XML_ANIMATION_DELAY,
+ XML_ANIMATION_DIRECTION,
+ XML_ANIMATION_REPEAT,
+ XML_ANIMATION_START_INSIDE,
+ XML_ANIMATION_STEPS,
+ XML_ANIMATION_STOP_INSIDE,
+ XML_ANIMATIONS,
+ XML_ANNOTATION,
+ XML_ANNOTATION_END,
+ XML_ANNOTATIONS,
+ XML_ANNOTE,
+ XML_APPEAR,
+ XML_APPLET,
+ XML_APPLET_NAME,
+ XML_APPLICATION_DATA,
+ XML_APPLICATION_XML,
+ XML_APPLY,
+ XML_APPLY_DESIGN_MODE,
+ XML_APPLY_STYLE_NAME,
+ XML_AQUA,
+ XML_ARC,
+ XML_ARCCOS,
+ XML_ARCHIVE,
+ XML_ARCSIN,
+ XML_ARCTAN,
+ XML_AREA,
+ XML_AREA_CIRCLE,
+ XML_AREA_POLYGON,
+ XML_AREA_RECTANGLE,
+ XML_ARTICLE,
+ XML_AS_CHAR,
+ XML_ASCENDING,
+ XML_ATTACHED_AXIS,
+ XML_ATTRACTIVE,
+ XML_AUTHOR,
+ XML_AUTHOR_INITIALS,
+ XML_AUTHOR_NAME,
+ XML_AUTO,
+ XML_AUTO_COMPLETE,
+ XML_AUTO_GROW_HEIGHT,
+ XML_AUTO_GROW_WIDTH,
+ XML_AUTO_RELOAD,
+ XML_AUTO_TEXT,
+ XML_AUTO_TEXT_EVENTS,
+ XML_AUTO_TEXT_GROUP,
+ XML_AUTO_TEXT_INDENT,
+ XML_AUTO_UPDATE,
+ XML_AUTOMATIC,
+ XML_AUTOMATIC_FIND_LABELS,
+ XML_AUTOMATIC_FOCUS,
+ XML_AUTOMATIC_ORDER,
+ XML_AUTOMATIC_STYLES,
+ XML_AUTOMATIC_UPDATE,
+ XML_AUTOSIZE,
+ XML_AVERAGE,
+ XML_AVERAGED_ABSCISSA,
+ XML_AXIS,
+ XML_AXIS_COLOR,
+ XML_BACK_SCALE,
+ XML_BACKFACE_CULLING,
+ XML_BACKGROUND,
+ XML_BACKGROUND_COLOR,
+ XML_BACKGROUND_IMAGE,
+ XML_BACKGROUND_NO_REPEAT,
+ XML_BAR,
+ XML_BASE64BINARY,
+ XML_BASE_CELL_ADDRESS,
+ XML_BASELINE,
+ XML_BEFORE_DATE_TIME,
+ XML_BELOW,
+ XML_BETWEEN_DATE_TIMES,
+ XML_BEVEL,
+ XML_BEVELLED,
+ XML_BIBILIOGRAPHIC_TYPE,
+ XML_BIBLIOGRAPHY,
+ XML_BIBLIOGRAPHY_CONFIGURATION,
+ XML_BIBLIOGRAPHY_DATA_FIELD,
+ XML_BIBLIOGRAPHY_ENTRY_TEMPLATE,
+ XML_BIBLIOGRAPHY_MARK,
+ XML_BIBLIOGRAPHY_SOURCE,
+ XML_BIBLIOGRAPHY_TYPE,
+ XML_BIND_STYLES_TO_CONTENT,
+ XML_BITMAP,
+ XML_BITMAP_TABLE,
+ XML_BLACK,
+ XML_BLEND,
+ XML_BLINKING,
+ XML_BLOCK,
+ XML_BLOCK_LIST,
+ XML_BLUE,
+ XML_BODY,
+ XML_BOLD,
+ XML_BOOK,
+ XML_BOOKLET,
+ XML_BOOKMARK,
+ XML_BOOKMARK_END,
+ XML_BOOKMARK_REF,
+ XML_BOOKMARK_START,
+ XML_BOOKTITLE,
+ XML_BOOLEAN,
+ XML_BOOLEAN_STYLE,
+ XML_BOOLEAN_VALUE,
+ XML_BORDER,
+ XML_BORDER_BOTTOM,
+ XML_BORDER_COLOR,
+ XML_BORDER_LEFT,
+ XML_BORDER_LINE_WIDTH,
+ XML_BORDER_LINE_WIDTH_BOTTOM,
+ XML_BORDER_LINE_WIDTH_LEFT,
+ XML_BORDER_LINE_WIDTH_RIGHT,
+ XML_BORDER_LINE_WIDTH_TOP,
+ XML_BORDER_RIGHT,
+ XML_BORDER_TOP,
+ XML_BOTH,
+ XML_BOTTOM,
+ XML_BOTTOM_LEFT,
+ XML_BOTTOM_PERCENT,
+ XML_BOTTOM_RIGHT,
+ XML_BOTTOM_VALUES,
+ XML_BOTTOMARC,
+ XML_BOTTOMCIRCLE,
+ XML_BOUND_COLUMN,
+ XML_BREAK_AFTER,
+ XML_BREAK_BEFORE,
+ XML_BREAK_INSIDE,
+ XML_BUBBLE,
+ XML_BULLET_CHAR,
+ XML_BULLET_RELATIVE_SIZE,
+ XML_BUTT,
+ XML_BUTTON1,
+ XML_BUTTON2,
+ XML_BUTTON3,
+ XML_BUTTON4,
+ XML_BUTTONS,
+ XML_BUTTON_TYPE,
+ XML_BVAR,
+ XML_C,
+ XML_CALCULATION_SETTINGS,
+ XML_CALENDAR,
+ XML_CAPITALIZE_ENTRIES,
+ XML_CAN_ADD_COMMENT,
+ XML_CAPTION,
+ XML_CAPTION_POINT_X,
+ XML_CAPTION_POINT_Y,
+ XML_CAPTION_SEQUENCE_FORMAT,
+ XML_CAPTION_SEQUENCE_NAME,
+ XML_CASE_SENSITIVE,
+ XML_CASEMAP_CAPITALIZE,
+ XML_CASEMAP_LOWERCASE,
+ XML_CASEMAP_SMALL_CAPS,
+ XML_CASEMAP_UPPERCASE,
+ XML_CATEGORIES,
+ XML_CATEGORY,
+ XML_CATEGORY_AND_VALUE,
+ XML_CELL_ADDRESS,
+ XML_CELL_CONTENT_CHANGE,
+ XML_CELL_CONTENT_DELETION,
+ XML_CELL_COUNT,
+ XML_CELL_PROTECT,
+ XML_CELL_RANGE_ADDRESS,
+ XML_CELL_RANGE_ADDRESS_LIST,
+ XML_CELL_RANGE_SOURCE,
+ XML_CENTER,
+ XML_CENTRAL,
+ XML_CHAIN_NEXT_NAME,
+ XML_CHANGE,
+ XML_CHANGE_DELETION,
+ XML_CHANGE_END,
+ XML_CHANGE_ID,
+ XML_CHANGE_INFO,
+ XML_CHANGE_START,
+ XML_CHANGE_TRACK_TABLE_CELL,
+ XML_CHANGE_VIEW_CONDITIONS,
+ XML_CHANGE_VIEW_SETTINGS,
+ XML_CHANGED_REGION,
+ XML_CHAPTER,
+ XML_CHAR,
+ XML_CHAR_SHADING_VALUE,
+ XML_CHARACTER_COUNT,
+ XML_CHART,
+ XML_CHARTS,
+ XML_CHECKERBOARD,
+ XML_CHG_AUTHOR,
+ XML_CHG_COMMENT,
+ XML_CHG_DATE_TIME,
+ XML_CI,
+ XML_CIRCLE,
+ XML_CITATION_BODY_STYLE_NAME,
+ XML_CITATION_STYLE_NAME,
+ XML_CLASS,
+ XML_CLASS_ID,
+ XML_CLIP,
+ XML_CLOCKWISE,
+ XML_CLOSE,
+ XML_CLOSE_HORIZONTAL,
+ XML_CLOSE_VERTICAL,
+ XML_CN,
+ XML_CODE,
+ XML_CODEBASE,
+ XML_COLLAPSE,
+ XML_COLOR,
+ XML_COLOR_AXIS,
+ XML_COLOR_FIRST,
+ XML_COLOR_HIGH,
+ XML_COLOR_INVERSION,
+ XML_COLOR_LAST,
+ XML_COLOR_LOW,
+ XML_COLOR_MARKERS,
+ XML_COLOR_MODE,
+ XML_COLOR_NEGATIVE,
+ XML_COLOR_SERIES,
+ XML_COLOR_SCALE,
+ XML_COLOR_SCALE_ENTRY,
+ XML_COLOR_TABLE,
+ XML_COLUMN,
+ XML_COLUMN_COUNT,
+ XML_COLUMN_GAP,
+ XML_COLUMN_NAME,
+ XML_COLUMN_SEP,
+ XML_COLUMN_WIDTH,
+ XML_COLUMNALIGN,
+ XML_COLUMNS,
+ XML_COLUMNSPLIT_AVOID,
+ XML_COMBINE_ENTRIES,
+ XML_COMBINE_ENTRIES_WITH_DASH,
+ XML_COMBINE_ENTRIES_WITH_PP,
+ XML_COMMA_SEPARATED,
+ XML_COMMAND,
+ XML_COMMENT,
+ XML_COMPOSE,
+ XML_COND_STYLE_NAME,
+ XML_CONDITION,
+ XML_CONDITION_SOURCE,
+ XML_CONDITION_SOURCE_RANGE_ADDRESS,
+ XML_CONDITIONAL_TEXT,
+ XML_CONDITIONAL_FORMAT,
+ XML_CONDITIONAL_FORMATS,
+ XML_CONE,
+ XML_CONFERENCE,
+ XML_CONFIG_ITEM,
+ XML_CONFIG_ITEM_MAP_ENTRY,
+ XML_CONFIG_ITEM_MAP_INDEXED,
+ XML_CONFIG_ITEM_MAP_NAMED,
+ XML_CONFIG_ITEM_SET,
+ XML_CONFIGURATION_SETTINGS,
+ XML_CONJUGATE,
+ XML_CONNECT_BARS,
+ XML_CONNECTION_NAME,
+ XML_CONNECTOR,
+ XML_CONSECUTIVE_NUMBERING,
+ XML_CONSOLIDATION,
+ XML_CONSTANT,
+ XML_CONTAINS_ERROR,
+ XML_CONTAINS_HEADER,
+ XML_CONTENT,
+ XML_CONTENT_VALIDATION,
+ XML_CONTENT_VALIDATION_NAME,
+ XML_CONTENT_VALIDATIONS,
+ XML_CONTEXTUAL_SPACING,
+ XML_CONTINUE,
+ XML_CONTINUE_NUMBERING,
+ XML_CONTOUR_PATH,
+ XML_CONTOUR_POLYGON,
+ XML_CONTRAST,
+ XML_CONTROL,
+ XML_CONVERSION_MODE,
+ XML_CONVERSION_TYPE,
+ XML_CONVERT_EMPTY_TO_NULL,
+ XML_COPY_BACK,
+ XML_COPY_FORMULAS,
+ XML_COPY_OUTLINE_LEVELS,
+ XML_COPY_RESULTS_ONLY,
+ XML_COPY_STYLES,
+ XML_CORNER_RADIUS,
+ XML_CORRECT,
+ XML_COS,
+ XML_COSH,
+ XML_COT,
+ XML_COTH,
+ XML_COUNT,
+ XML_COUNT_EMPTY_LINES,
+ XML_COUNT_IN_FLOATING_FRAMES,
+ XML_COUNTER_CLOCKWISE,
+ XML_COUNTERCLOCKWISE,
+ XML_COUNTNUMS,
+ XML_COUNTRY,
+ XML_COUNTRY_ASIAN,
+ XML_COUNTRY_COMPLEX,
+ XML_COVERED_TABLE_CELL,
+ XML_CREATE_DATE,
+ XML_CREATE_DATE_STRING,
+ XML_CREATION_DATE,
+ XML_CREATION_TIME,
+ XML_CREATOR,
+ XML_CSC,
+ XML_CSCH,
+ XML_CUBE,
+ XML_CUBOID,
+ XML_CURRENCY,
+ XML_CURRENCY_STYLE,
+ XML_CURRENCY_SYMBOL,
+ XML_CURRENT,
+ XML_CURRENT_VALUE,
+ XML_CURSOR_POSITION,
+ XML_CURSOR_POSITION_X,
+ XML_CURSOR_POSITION_Y,
+ XML_CURVE,
+ XML_CUSTOM1,
+ XML_CUSTOM2,
+ XML_CUSTOM3,
+ XML_CUSTOM4,
+ XML_CUSTOM5,
+ XML_CUSTOM_ICONSET,
+ XML_CUSTOM_ICONSET_INDEX,
+ XML_CUSTOM_ICONSET_NAME,
+ XML_CUSTOM_LABEL_FIELD,
+ XML_CUSTOM_LABEL_POS_X,
+ XML_CUSTOM_LABEL_POS_Y,
+ XML_CUSTOM_LEADERLINES,
+ XML_CUT,
+ XML_CUT_OFFS,
+ XML_CUT_OFFS2,
+ XML_CX,
+ XML_CY,
+ XML_CYLINDER,
+ XML_D,
+ XML_DASH,
+ XML_DASH_DOT,
+ XML_DASH_DOT_DOT,
+ XML_DASH_TABLE,
+ XML_DASHED,
+ XML_DATA,
+ XML_DATA_BAR,
+ XML_DATA_BAR_ENTRY,
+ XML_DATA_CELL_RANGE_ADDRESS,
+ XML_DATA_LABEL,
+ XML_DATA_LABEL_GUID,
+ XML_DATA_LABEL_NUMBER,
+ XML_DATA_LABEL_SYMBOL,
+ XML_DATA_LABEL_TEXT,
+ XML_DATA_LABEL_SERIES,
+ XML_DATA_LABELS_CELL_RANGE,
+ XML_DATA_PILOT_SOURCE,
+ XML_DATA_PILOT_FIELD,
+ XML_DATA_PILOT_GRAND_TOTAL,
+ XML_DATA_PILOT_LEVEL,
+ XML_DATA_PILOT_MEMBER,
+ XML_DATA_PILOT_MEMBERS,
+ XML_DATA_PILOT_SUBTOTAL,
+ XML_DATA_PILOT_SUBTOTALS,
+ XML_DATA_PILOT_TABLE,
+ XML_DATA_PILOT_TABLES,
+ XML_DATA_POINT,
+ XML_DATA_RANGE,
+ XML_DATA_STREAM_SOURCE,
+ XML_DATA_STYLE,
+ XML_DATA_STYLE_NAME,
+ XML_DATA_TYPE,
+ XML_DATABASE_DISPLAY,
+ XML_DATABASE_NAME,
+ XML_DATABASE_NEXT,
+ XML_DATABASE_RANGE,
+ XML_DATABASE_RANGES,
+ XML_DATABASE_ROW_NUMBER,
+ XML_DATABASE_SELECT,
+ XML_DATABASE_SOURCE_QUERY,
+ XML_DATABASE_SOURCE_SQL,
+ XML_DATABASE_SOURCE_TABLE,
+ XML_DATABASE_TABLE_NAME,
+ XML_DATE,
+ XML_DATE_AXIS,
+ XML_DATE_IS,
+ XML_DATE_ADJUST,
+ XML_DATE_STYLE,
+ XML_DATE_TIME,
+ XML_DATE_TIME_UPDATE,
+ XML_DATE_TIME_VISIBLE,
+ XML_DATE_VALUE,
+ XML_DATETIME,
+ XML_DAY,
+ XML_DAY_OF_WEEK,
+ XML_DDE_APPLICATION,
+ XML_DDE_CONNECTION,
+ XML_DDE_CONNECTION_DECL,
+ XML_DDE_CONNECTION_DECLS,
+ XML_DDE_ITEM,
+ XML_DDE_LINK,
+ XML_DDE_LINKS,
+ XML_DDE_SOURCE,
+ XML_DDE_TOPIC,
+ XML_DECIMAL_PLACES,
+ XML_DECIMAL_REPLACEMENT,
+ XML_DECLARE,
+ XML_DECORATE_WORDS_ONLY,
+ XML_DECORATIVE,
+ XML_DEEP,
+ XML_DEFAULT,
+ XML_DEFAULT_BUTTON,
+ XML_DEFAULT_CELL_STYLE_NAME,
+ XML_DEFAULT_STYLE,
+ XML_DEFAULT_STYLE_NAME,
+ XML_DEGREE,
+ XML_DELAY,
+ XML_DELAY_FOR_REPEAT,
+ XML_DELETE_COLUMNS,
+ XML_DELETE_ROWS,
+ XML_DELETION,
+ XML_DELETIONS,
+ XML_DENOMALIGN,
+ XML_DENOMINATOR_VALUE,
+ XML_DEPENDENCE,
+ XML_DEPENDENCES,
+ XML_DEPENDENCIES,
+ XML_DEPTH,
+ XML_DESC,
+ XML_DESCENDING,
+ XML_DESCRIPTION,
+ XML_DETECTIVE,
+ XML_DETERMINANT,
+ XML_DIFF,
+ XML_DIFFUSE_COLOR,
+ XML_DIM,
+ XML_DIRECTION,
+ XML_DISABLED,
+ XML_DISC,
+ XML_DISPLAY,
+ XML_DISPLAY_BORDER,
+ XML_DISPLAY_DETAILS,
+ XML_DISPLAY_DUPLICATES,
+ XML_DISPLAY_EMPTY,
+ XML_DISPLAY_EMPTY_CELLS_AS,
+ XML_DISPLAY_FILTER_BUTTONS,
+ XML_DISPLAY_FORMULA,
+ XML_DISPLAY_HIDDEN,
+ XML_DISPLAY_LABEL,
+ XML_DISPLAY_LEVELS,
+ XML_DISPLAY_NAME,
+ XML_DISPLAY_OUTLINE_LEVEL,
+ XML_DISPLAY_X_AXIS,
+ XML_DISSOLVE,
+ XML_DISTANCE,
+ XML_DISTANCE_AFTER_SEP,
+ XML_DISTANCE_BEFORE_SEP,
+ XML_DISTRIBUTE,
+ XML_DISTRIBUTE_LETTER,
+ XML_DISTRIBUTE_SPACE,
+ XML_DIVIDE,
+ XML_DOCUMENT,
+ XML_DOCUMENT_CONTENT,
+ XML_DOCUMENT_META,
+ XML_DOCUMENT_SETTINGS,
+ XML_DOCUMENT_STATISTIC,
+ XML_DOCUMENT_STYLES,
+ XML_DOMAIN,
+ XML_DOT,
+ XML_DOTS1,
+ XML_DOTS1_LENGTH,
+ XML_DOTS2,
+ XML_DOTS2_LENGTH,
+ XML_DOTTED,
+ XML_DOUBLE,
+ XML_DOUBLE_SIDED,
+ XML_DOUBLE_THIN,
+ XML_DOWN,
+ XML_DRAFT,
+ XML_DRAW,
+ XML_DRAW_ASPECT,
+ XML_DRAWING,
+ XML_DRAWINGS,
+ XML_DRAWPOOL,
+ XML_DROPDOWN,
+ XML_DROP_CAP,
+ XML_DYNAMIC,
+ XML_ECHO_CHAR,
+ XML_EDGE_ROUNDING,
+ XML_EDITABLE,
+ XML_EDITING_CYCLES,
+ XML_EDITING_DURATION,
+ XML_EDITION,
+ XML_EDITOR,
+ XML_EFFECT,
+ XML_ELLIPSE,
+ XML_EMAIL,
+ XML_EMBED,
+ XML_EMBEDDED_VISIBLE_AREA,
+ XML_EMBOSSED,
+ XML_EMISSIVE_COLOR,
+ XML_EMPTY,
+ XML_EMPTY_LINE_REFRESH,
+ XML_ENABLE_NUMBERING,
+ XML_ENABLED,
+ XML_ENCODING,
+ XML_ENCTYPE,
+ XML_END,
+ XML_END_ANGLE,
+ XML_END_CELL_ADDRESS,
+ XML_END_COLOR,
+ XML_END_COLUMN,
+ XML_END_GLUE_POINT,
+ XML_END_GUIDE,
+ XML_END_INTENSITY,
+ XML_END_LINE_SPACING_HORIZONTAL,
+ XML_END_LINE_SPACING_VERTICAL,
+ XML_END_POSITION,
+ XML_END_ROW,
+ XML_END_SHAPE,
+ XML_END_TABLE,
+ XML_END_X,
+ XML_END_Y,
+ XML_ENDLESS,
+ XML_ENDNOTE,
+ XML_ENDNOTE_BODY,
+ XML_ENDNOTE_CITATION,
+ XML_ENDNOTE_REF,
+ XML_ENDNOTES_CONFIGURATION,
+ XML_ENGRAVED,
+ XML_ENTRY,
+ XML_EQ,
+ XML_EQUAL_AUTHOR,
+ XML_EQUAL_COMMENT,
+ XML_EQUAL_DATE,
+ XML_ERA,
+ XML_ERGO_SUM,
+ XML_ERROR_CATEGORY,
+ XML_ERROR_LOWER_INDICATOR,
+ XML_ERROR_LOWER_LIMIT,
+ XML_ERROR_MACRO,
+ XML_ERROR_MARGIN,
+ XML_ERROR_MESSAGE,
+ XML_ERROR_PERCENTAGE,
+ XML_ERROR_UPPER_INDICATOR,
+ XML_ERROR_UPPER_LIMIT,
+ XML_ESCAPEMENT_SUB,
+ XML_ESCAPEMENT_SUPER,
+ XML_EVEN_PAGE,
+ XML_EVENT,
+ XML_EVENT_NAME,
+ XML_EVENTS,
+ XML_EXECUTE,
+ XML_EXECUTE_MACRO,
+ XML_EXISTS,
+ XML_EXP,
+ XML_EXPONENTIAL,
+ XML_EXPRESSION,
+ XML_EXTRA,
+ XML_EXTRUDE,
+ XML_FACTORIAL,
+ XML_FADE,
+ XML_FADE_FROM_BOTTOM,
+ XML_FADE_FROM_CENTER,
+ XML_FADE_FROM_LEFT,
+ XML_FADE_FROM_LOWERLEFT,
+ XML_FADE_FROM_LOWERRIGHT,
+ XML_FADE_FROM_RIGHT,
+ XML_FADE_FROM_TOP,
+ XML_FADE_FROM_UPPERLEFT,
+ XML_FADE_FROM_UPPERRIGHT,
+ XML_FADE_OUT,
+ XML_FADE_TO_CENTER,
+ XML_FALSE,
+ XML_FAMILY,
+ XML_FAST,
+ XML_FENCE,
+ XML_FIELD_NUMBER,
+ XML_FILE_NAME,
+ XML_FILL,
+ XML_FILL_CHARACTER,
+ XML_FILL_COLOR,
+ XML_FILL_GRADIENT_NAME,
+ XML_FILL_HATCH_NAME,
+ XML_FILL_HATCH_SOLID,
+ XML_FILL_IMAGE,
+ XML_FILL_IMAGE_HEIGHT,
+ XML_FILL_IMAGE_NAME,
+ XML_FILL_IMAGE_REF_POINT,
+ XML_FILL_IMAGE_REF_POINT_X,
+ XML_FILL_IMAGE_REF_POINT_Y,
+ XML_FILL_IMAGE_WIDTH,
+ XML_FILL_RULE,
+ XML_FILTER,
+ XML_FILTER_AND,
+ XML_FILTER_CONDITION,
+ XML_FILTER_NAME,
+ XML_FILTER_OPTIONS,
+ XML_FILTER_OR,
+ XML_FILTER_SET_ITEM,
+ XML_FINE_DASHED,
+ XML_FIRST_DATE_TIME,
+ XML_FIRST_PAGE,
+ XML_FIRST_PAGE_NUMBER,
+ XML_FIT_TO_CONTOUR,
+ XML_FIT_TO_SIZE,
+ XML_FIX,
+ XML_FIXED,
+ XML_FLAT,
+ XML_FLOAT,
+ XML_FLOATING_FRAME,
+ XML_FLOOR,
+ XML_FN,
+ XML_FOCAL_LENGTH,
+ XML_FOCUS_ON_CLICK,
+ XML_FONT_CHAR_WIDTH,
+ XML_FONT_CHARSET,
+ XML_FONT_CHARSET_ASIAN,
+ XML_FONT_CHARSET_COMPLEX,
+ XML_FONT_COLOR,
+ XML_FONT_DECL,
+ XML_FONT_DECLS,
+ XML_FONT_FAMILY,
+ XML_FONT_FAMILY_ASIAN,
+ XML_FONT_FAMILY_COMPLEX,
+ XML_FONT_FAMILY_GENERIC,
+ XML_FONT_FAMILY_GENERIC_ASIAN,
+ XML_FONT_FAMILY_GENERIC_COMPLEX,
+ XML_FONT_KERNING,
+ XML_FONT_NAME,
+ XML_FONT_NAME_ASIAN,
+ XML_FONT_NAME_COMPLEX,
+ XML_FONT_PITCH,
+ XML_FONT_PITCH_ASIAN,
+ XML_FONT_PITCH_COMPLEX,
+ XML_FONT_RELIEF,
+ XML_FONT_SIZE,
+ XML_FONT_SIZE_ASIAN,
+ XML_FONT_SIZE_COMPLEX,
+ XML_FONT_SIZE_REL,
+ XML_FONT_SIZE_REL_ASIAN,
+ XML_FONT_SIZE_REL_COMPLEX,
+ XML_FONT_STYLE,
+ XML_FONT_STYLE_ASIAN,
+ XML_FONT_STYLE_COMPLEX,
+ XML_FONT_STYLE_NAME,
+ XML_FONT_STYLE_NAME_ASIAN,
+ XML_FONT_STYLE_NAME_COMPLEX,
+ XML_FONT_VARIANT,
+ XML_FONT_WEIGHT,
+ XML_FONT_WEIGHT_ASIAN,
+ XML_FONT_WEIGHT_COMPLEX,
+ XML_FONT_WIDTH,
+ XML_FONT_WORD_LINE_MODE,
+ XML_FONTFAMILY,
+ XML_FONTSIZE,
+ XML_FONTSTYLE,
+ XML_FONTWEIGHT,
+ XML_FONTWORK_ADJUST,
+ XML_FONTWORK_DISTANCE,
+ XML_FONTWORK_FORM,
+ XML_FONTWORK_HIDE_FORM,
+ XML_FONTWORK_MIRROR,
+ XML_FONTWORK_OUTLINE,
+ XML_FONTWORK_SHADOW,
+ XML_FONTWORK_SHADOW_COLOR,
+ XML_FONTWORK_SHADOW_OFFSET_X,
+ XML_FONTWORK_SHADOW_OFFSET_Y,
+ XML_FONTWORK_SHADOW_TRANSPARENCE,
+ XML_FONTWORK_START,
+ XML_FONTWORK_STYLE,
+ XML_FOOTER,
+ XML_FOOTER_FIRST,
+ XML_FOOTER_LEFT,
+ XML_FOOTER_STYLE,
+ XML_FOOTER_VISIBLE,
+ XML_FOOTNOTE,
+ XML_FOOTNOTE_BODY,
+ XML_FOOTNOTE_CITATION,
+ XML_FOOTNOTE_CONTINUATION_NOTICE_BACKWARD,
+ XML_FOOTNOTE_CONTINUATION_NOTICE_FORWARD,
+ XML_FOOTNOTE_MAX_HEIGHT,
+ XML_FOOTNOTE_REF,
+ XML_FOOTNOTE_SEP,
+ XML_FOOTNOTES_CONFIGURATION,
+ XML_FOOTNOTES_POSITION,
+ XML_FOR,
+ XML_FORALL,
+ XML_FORCE_MANUAL,
+ XML_FOREGROUND,
+ XML_FOREIGN_OBJECT,
+ XML_FORMAT_CHANGE,
+ XML_FORMAT_SOURCE,
+ XML_FORMATTING_ENTRY,
+ XML_FORMS,
+ XML_FORMULA,
+ XML_FORMULA_HIDDEN,
+ XML_FORMULAS,
+ XML_FRACTION,
+ XML_FRAME,
+ XML_FRAME_CONTENT,
+ XML_FRAME_DISPLAY_BORDER,
+ XML_FRAME_DISPLAY_SCROLLBAR,
+ XML_FRAME_END_MARGIN,
+ XML_FRAME_MARGIN_HORIZONTAL,
+ XML_FRAME_MARGIN_VERTICAL,
+ XML_FRAME_NAME,
+ XML_FRAME_START_MARGIN,
+ XML_FREEZE,
+ XML_FREEZE_POSITION,
+ XML_FROM_ANOTHER_TABLE,
+ XML_FROM_BOTTOM,
+ XML_FROM_CENTER,
+ XML_FROM_INSIDE,
+ XML_FROM_LEFT,
+ XML_FROM_LOWER_LEFT,
+ XML_FROM_LOWER_RIGHT,
+ XML_FROM_RIGHT,
+ XML_FROM_SAME_TABLE,
+ XML_FROM_TOP,
+ XML_FROM_UPPER_LEFT,
+ XML_FROM_UPPER_RIGHT,
+ XML_FUCHSIA,
+ XML_FULL,
+ XML_FULL_SCREEN,
+ XML_FUNCTION,
+ XML_FX,
+ XML_FY,
+ XML_G,
+ XML_GAMMA,
+ XML_GAP,
+ XML_GAP_WIDTH,
+ XML_GCD,
+ XML_GENERATOR,
+ XML_GEQ,
+ XML_GLOW_RADIUS,
+ XML_GLOW_COLOR,
+ XML_GLOW_TRANSPARENCY,
+ XML_GOURAUD,
+ XML_GRADIENT,
+ XML_GRADIENT_ANGLE,
+ XML_GRADIENT_STEP_COUNT,
+ XML_GRADIENT_STYLE,
+ XML_GRADIENT_TABLE,
+ XML_GRADIENTSTYLE_AXIAL,
+ XML_GRADIENTSTYLE_ELLIPSOID,
+ XML_GRADIENTSTYLE_RADIAL,
+ XML_GRADIENTSTYLE_RECTANGULAR,
+ XML_GRADIENTSTYLE_SQUARE,
+ XML_GRADIENTTRANSFORM,
+ XML_GRAND_TOTAL,
+ XML_GRAPHIC,
+ XML_GRAY,
+ XML_GREEN,
+ XML_GREYSCALE,
+ XML_GRID,
+ XML_GROOVE,
+ XML_GROUP_BY_FIELD_NUMBER,
+ XML_GROUP_NAME,
+ XML_GROUPING,
+ XML_GT,
+ XML_GUIDE_DISTANCE,
+ XML_GUIDE_OVERHANG,
+ XML_H,
+ XML_HANGING,
+ XML_HAS_PERSISTENT_DATA,
+ XML_HATCH,
+ XML_HATCH_TABLE,
+ XML_HATCHSTYLE_TRIPLE,
+ XML_HEADER,
+ XML_HEADER_FIRST,
+ XML_HEADER_LEFT,
+ XML_HEADER_STYLE,
+ XML_HEADERS,
+ XML_HEIGHT,
+ XML_HELP,
+ XML_HELP_FILE_NAME,
+ XML_HELP_ID,
+ XML_HELP_MESSAGE,
+ XML_HIDDEN,
+ XML_HIDDEN_AND_PROTECTED,
+ XML_HIDDEN_PARAGRAPH,
+ XML_HIDDEN_TEXT,
+ XML_HIDE,
+ XML_HIDE_LEGEND,
+ XML_HIDE_SHAPE,
+ XML_HIDE_TEXT,
+ XML_HIGHLIGHTED_RANGE,
+ XML_HINT,
+ XML_HORIZONTAL,
+ XML_HORIZONTALSTRIKE,
+ XML_HORIZONTAL_LINES,
+ // XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
+ // are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD.
+ // Usage is deprecated, but the old token are needed for the
+ // OpenOffice.org file format import/export filter for the renaming (#i49139#)
+ XML_HORIZONTAL_ON_LEFT_PAGES,
+ XML_HORIZONTAL_ON_RIGHT_PAGES,
+ XML_HORIZONTAL_POS,
+ XML_HORIZONTAL_REL,
+ XML_HORIZONTAL_SCROLLBAR_WIDTH,
+ XML_HORIZONTAL_SEGMENTS,
+ XML_HORIZONTAL_SPLIT_MODE,
+ XML_HORIZONTAL_SPLIT_POSITION,
+ XML_HORIZONTAL_STRIPES,
+ XML_HOURS,
+ XML_HOWPUBLISHED,
+ XML_HREF,
+ XML_HTML,
+ XML_HYPERLINK,
+ XML_HYPERLINK_BEHAVIOUR,
+ XML_HYPHENATE,
+ XML_HYPHENATION_KEEP,
+ XML_HYPHENATION_LADDER_COUNT,
+ XML_HYPHENATION_PUSH_CHAR_COUNT,
+ XML_HYPHENATION_REMAIN_CHAR_COUNT,
+ XML_HYPHENATION_NO_CAPS,
+ XML_HYPHENATION_NO_LAST_WORD,
+ XML_HYPHENATION_WORD_CHAR_COUNT,
+ XML_HYPHENATION_ZONE,
+ XML_I,
+ XML_ICON,
+ XML_ICON_SET,
+ XML_ICON_SET_TYPE,
+ XML_ID,
+ XML_IDENT,
+ XML_IDENTIFIER,
+ XML_IDENTIFY_CATEGORIES,
+ XML_IDEOGRAPH_ALPHA,
+ XML_IGNORE_CASE,
+ XML_IGNORE_EMPTY_ROWS,
+ XML_IGNORE_RESULT,
+ XML_IGNORE_SELECTED_PAGE, // used for ODF compatibility
+ XML_ILLUSTRATION_INDEX,
+ XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE,
+ XML_ILLUSTRATION_INDEX_SOURCE,
+ XML_IMAGE,
+ XML_IMAGE_COUNT,
+ XML_IMAGE_MAP,
+ XML_IMPLIES,
+ XML_IN,
+ XML_IN_RANGE,
+ XML_INBOOK,
+ XML_INCOLLECTION,
+ XML_INCREMENT,
+ XML_INDEX,
+ XML_INDEX_BODY,
+ XML_INDEX_ENTRY_BIBLIOGRAPHY,
+ XML_INDEX_ENTRY_CHAPTER,
+ XML_INDEX_ENTRY_CHAPTER_NUMBER,
+ XML_INDEX_ENTRY_LINK_END,
+ XML_INDEX_ENTRY_LINK_START,
+ XML_INDEX_ENTRY_PAGE_NUMBER,
+ XML_INDEX_ENTRY_SPAN,
+ XML_INDEX_ENTRY_TAB_STOP,
+ XML_INDEX_ENTRY_TEMPLATE,
+ XML_INDEX_ENTRY_TEXT,
+ XML_INDEX_NAME,
+ XML_INDEX_SCOPE,
+ XML_INDEX_SOURCE_STYLE,
+ XML_INDEX_SOURCE_STYLES,
+ XML_INDEX_TITLE,
+ XML_INDEX_TITLE_TEMPLATE,
+ XML_INFORMATION,
+ XML_INITIAL_CREATOR,
+ XML_INPROCEEDINGS,
+ XML_INPUT_REQUIRED,
+ XML_INSERT_COLUMNS,
+ XML_INSERT_ROWS,
+ XML_INSERTION,
+ XML_INSERTION_CUT_OFF,
+ XML_INSERTION_POSITION,
+ XML_INSET,
+ XML_INSIDE,
+ XML_INSTITUTION,
+ XML_INT,
+ XML_INTENSITY,
+ XML_INTER_CHARACTER,
+ XML_INTERSECT,
+ XML_INTERVAL,
+ XML_INTERVAL_MAJOR,
+ XML_INTERVAL_MINOR,
+ XML_INTO_ENGLISH_NUMBER,
+ XML_INVERSE,
+ XML_IS_ACTIVE,
+ XML_IS_DATA_LAYOUT_FIELD,
+ XML_IS_HIDDEN,
+ XML_IS_SELECTION,
+ XML_ISBN,
+ XML_ITALIC,
+ XML_ITEM,
+ XML_ITERATION,
+ XML_JOURNAL,
+ XML_JUSTIFIED,
+ XML_JUSTIFY,
+ XML_JUSTIFY_SINGLE_WORD,
+ XML_KEEP_WITH_NEXT,
+ XML_KEY,
+ XML_KEY1,
+ XML_KEY2,
+ XML_KEYWORD,
+ XML_KEYWORDS,
+ XML_KIND,
+ XML_KM,
+ XML_LABEL,
+ XML_LABEL_ARRANGEMENT,
+ XML_LABEL_CELL_ADDRESS,
+ XML_LABEL_CELL_RANGE_ADDRESS,
+ XML_LABEL_FILL,
+ XML_LABEL_FILL_COLOR,
+ XML_LABEL_RANGE,
+ XML_LABEL_RANGES,
+ XML_LABEL_STRING,
+ XML_LABEL_STROKE,
+ XML_LABEL_STROKE_COLOR,
+ XML_LABEL_STROKE_OPACITY,
+ XML_LABEL_STROKE_WIDTH,
+ XML_LAMBDA,
+ XML_LANDSCAPE,
+ XML_LANG,
+ XML_LANGUAGE,
+ XML_LANGUAGE_ASIAN,
+ XML_LANGUAGE_COMPLEX,
+ XML_LASER,
+ XML_LAST_COLUMN_SPANNED,
+ XML_LAST_PAGE,
+ XML_LAST_ROW_SPANNED,
+ XML_LAYER,
+ XML_LAYER_SET,
+ XML_LEADER_CHAR,
+ XML_LEFT,
+ XML_LEFT_OUTSIDE,
+ XML_LEFT_TEXT,
+ XML_LEFT_TOP_POSITION,
+ XML_LEFTARC,
+ XML_LEFTCIRCLE,
+ XML_LEGEND,
+ XML_LEGEND_POSITION,
+ XML_LENGTH,
+ XML_LEQ,
+ XML_LET_TEXT,
+ XML_KEEP_TEXT,
+ XML_LETTER_KERNING,
+ XML_LETTER_SPACING,
+ XML_LETTERS,
+ XML_LEVEL,
+ XML_LIBRARY,
+ XML_LIBRARY_EMBEDDED,
+ XML_LIBRARY_LINKED,
+ XML_LIGHT,
+ XML_LIGHTING_MODE,
+ XML_LIME,
+ XML_LIMIT,
+ XML_LINE,
+ XML_LINE_BREAK,
+ XML_CLEAR,
+ XML_LINE_DISTANCE,
+ XML_LINE_HEIGHT,
+ XML_LINE_HEIGHT_AT_LEAST,
+ XML_LINE_NUMBER,
+ XML_LINE_SKEW,
+ XML_LINE_SPACING,
+ XML_LINE_STYLE,
+ XML_LINE_WIDTH,
+ XML_LINEAR,
+ XML_LINEARGRADIENT,
+ XML_LINENUMBERING_CONFIGURATION,
+ XML_LINENUMBERING_SEPARATOR,
+ XML_LINES,
+ XML_LINES_USED,
+ XML_LINKED_CELL,
+ XML_LINK_TO_SOURCE_DATA,
+ XML_LIST,
+ XML_LIST_BLOCK,
+ XML_LIST_HEADER,
+ XML_LIST_INFO,
+ XML_LIST_ITEM,
+ XML_LIST_LEVEL,
+ XML_LIST_LEVEL_STYLE_BULLET,
+ XML_LIST_LEVEL_STYLE_IMAGE,
+ XML_LIST_LEVEL_STYLE_NUMBER,
+ XML_LIST_LINKAGE_TYPE,
+ XML_LIST_NAME,
+ XML_LIST_STYLE,
+ XML_LIST_STYLE_NAME,
+ XML_LN,
+ XML_LOCKED,
+ XML_LOG,
+ XML_LOGARITHMIC,
+ XML_LOGBASE,
+ XML_LONG,
+ XML_LOW,
+ XML_LOWLIMIT,
+ XML_LR_TB,
+ XML_LT,
+ XML_LTR,
+ XML_LUMINANCE,
+ XML_MACRO_NAME,
+ XML_MACTION,
+ XML_MAIN_ENTRY_STYLE_NAME,
+ XML_MAJOR,
+ XML_MAJOR_ORIGIN,
+ XML_MALIGNGROUP,
+ XML_MALIGNMARK,
+ XML_MANUAL,
+ XML_MANUAL_MIN,
+ XML_MANUAL_MAX,
+ XML_MAP,
+ XML_MARGIN_BOTTOM,
+ XML_MARGIN_LEFT,
+ XML_MARGIN_RIGHT,
+ XML_MARGIN_TOP,
+ XML_MARGINS,
+ XML_MARKER,
+ XML_MARKERS,
+ XML_MARKER_END,
+ XML_MARKER_END_CENTER,
+ XML_MARKER_END_WIDTH,
+ XML_MARKER_START,
+ XML_MARKER_START_CENTER,
+ XML_MARKER_START_WIDTH,
+ XML_MARKER_TABLE,
+ XML_MAROON,
+ XML_MASTER_PAGE,
+ XML_MASTER_PAGE_NAME,
+ XML_MASTER_STYLES,
+ XML_MASTERSTHESIS,
+ XML_MATCH,
+ XML_MATH,
+ XML_MATRIX,
+ XML_MATRIX_COVERED,
+ XML_MATRIXROW,
+ XML_MAX,
+ XML_MAX_AXIS_TYPE,
+ XML_MAX_EDGE,
+ XML_MAX_HEIGHT,
+ XML_MAX_LENGTH,
+ XML_MAX_WIDTH,
+ XML_MAXIMUM,
+ XML_MAXIMUM_DIFFERENCE,
+ XML_MAY_BREAK_BETWEEN_ROWS,
+ XML_MAY_SCRIPT,
+ XML_MEAN,
+ XML_MEAN_VALUE,
+ XML_MEASURE,
+ XML_MEASURE_ALIGN,
+ XML_MEASURE_VERTICAL_ALIGN,
+ XML_MEDIAN,
+ XML_MEDIUM,
+ XML_MENCLOSE,
+ XML_MERROR,
+ XML_MESSAGE_TYPE,
+ XML_META,
+ XML_MFENCED,
+ XML_MFRAC,
+ XML_MI,
+ XML_MIDDLE,
+ XML_MIME_TYPE,
+ XML_MIN,
+ XML_MIN_AXIS_TYPE,
+ XML_MIN_DENOMINATOR_DIGITS,
+ XML_MIN_EDGE,
+ XML_MIN_EXPONENT_DIGITS,
+ XML_MIN_HEIGHT,
+ XML_MIN_INTEGER_DIGITS,
+ XML_MIN_LABEL_DISTANCE,
+ XML_MIN_LABEL_WIDTH,
+ XML_MIN_LENGTH,
+ XML_MIN_LINE_HEIGHT,
+ XML_MIN_NUMERATOR_DIGITS,
+ XML_MIN_ROW_HEIGHT,
+ XML_MIN_WIDTH,
+ XML_MINIMUM,
+ XML_MINOR,
+ XML_MINUS,
+ XML_MINUTES,
+ XML_MIRROR,
+ XML_MIRRORED,
+ XML_MISC,
+ XML_MITER,
+ XML_MM,
+ XML_MMULTISCRIPTS,
+ XML_MN,
+ XML_MO,
+ XML_MODE,
+ XML_MODERN,
+ XML_MODIFICATION_DATE,
+ XML_MODIFICATION_TIME,
+ XML_MODULATE,
+ XML_MODULE,
+ XML_MOMENT,
+ XML_MONO,
+ XML_MONTH,
+ XML_MOUSE_AS_PEN,
+ XML_MOUSE_VISIBLE,
+ XML_MOVE,
+ XML_MOVE_FROM_BOTTOM,
+ XML_MOVE_FROM_LEFT,
+ XML_MOVE_FROM_RIGHT,
+ XML_MOVE_FROM_TOP,
+ XML_MOVE_PROTECT,
+ XML_MOVE_SHORT,
+ XML_MOVEMENT,
+ XML_MOVEMENT_CUT_OFF,
+ XML_MOVER,
+ XML_MOVING_AVERAGE,
+ XML_MPADDED,
+ XML_MPHANTOM,
+ XML_MPRESCRIPTS,
+ XML_MROOT,
+ XML_MROW,
+ XML_MS,
+ XML_MSPACE,
+ XML_MSQRT,
+ XML_MSTYLE,
+ XML_MSUB,
+ XML_MSUBSUP,
+ XML_MSUP,
+ XML_MTABLE,
+ XML_MTD,
+ XML_MTEXT,
+ XML_MTR,
+ XML_MULTI_DELETION_SPANNED,
+ XML_MULTI_LINE,
+ XML_MULTIPLE,
+ XML_MUNDER,
+ XML_MUNDEROVER,
+ XML_NAME,
+ XML_NAME_AND_EXTENSION,
+ XML_NAMED_EXPRESSION,
+ XML_NAMED_EXPRESSIONS,
+ XML_NAMED_RANGE,
+ XML_NAVIGATION_MODE,
+ XML_NAVY,
+ XML_NEGATIVE,
+ XML_NEGATIVE_COLOR,
+ XML_NEQ,
+ XML_NEW,
+ XML_NEXT,
+ XML_NEXT_PAGE,
+ XML_NEXT_STYLE_NAME,
+ XML_NO_LIMIT,
+ XML_NO_WRAP,
+ XML_NOEMPTY,
+ XML_NOHREF,
+ XML_NOMATCH,
+ XML_NON_WHITESPACE_CHARACTER_COUNT,
+ XML_NONE,
+ XML_NORMAL,
+ XML_NORMALS_DIRECTION,
+ XML_NORMALS_KIND,
+ XML_NOT,
+ XML_NOT_EQUAL_DATE,
+ XML_NOTATION,
+ XML_NOTE,
+ XML_NOTES,
+ XML_NOTIN,
+ XML_NOTPRSUBSET,
+ XML_NOTSUBSET,
+ XML_NULL_DATE,
+ XML_NULL_YEAR,
+ XML_NUM_FORMAT,
+ XML_NUM_LETTER_SYNC,
+ XML_NUM_LIST_FORMAT,
+ XML_NUM_PREFIX,
+ XML_NUM_SUFFIX,
+ XML_NUMALIGN,
+ XML_NUMBER,
+ XML_NUMBER_AND_NAME,
+ XML_NUMBER_COLUMNS_REPEATED,
+ XML_NUMBER_COLUMNS_SPANNED,
+ XML_NUMBER_LINES,
+ XML_NUMBER_MATRIX_COLUMNS_SPANNED,
+ XML_NUMBER_MATRIX_ROWS_SPANNED,
+ XML_NUMBER_POSITION,
+ XML_NUMBER_ROWS_REPEATED,
+ XML_NUMBER_ROWS_SPANNED,
+ XML_NUMBER_STYLE,
+ XML_NUMBER_WRAPPED_PARAGRAPHS,
+ XML_NUMBERED_ENTRIES,
+ XML_OBJECT,
+ XML_OBJECT_COUNT,
+ XML_OBJECT_INDEX,
+ XML_OBJECT_INDEX_ENTRY_TEMPLATE,
+ XML_OBJECT_INDEX_SOURCE,
+ XML_OBJECT_NAME,
+ XML_OBJECT_OLE,
+ XML_OBJECTS,
+ XML_ODD_PAGE,
+ XML_OFFSET,
+ XML_OLIVE,
+ XML_ONLOAD,
+ XML_ONREQUEST,
+ XML_ON_UPDATE_KEEP_SIZE,
+ XML_ON_UPDATE_KEEP_STYLES,
+ XML_ONLINE,
+ XML_ONLINE_TEXT,
+ XML_OPEN,
+ XML_OPEN_HORIZONTAL,
+ XML_OPEN_VERTICAL,
+ XML_OPERATION,
+ XML_OPERATOR,
+ XML_OPTIMAL,
+ XML_OPTION,
+ XML_OR,
+ XML_ORDER,
+ XML_ORDERED_LIST,
+ XML_ORGANIZATIONS,
+ XML_ORIENTATION,
+ XML_ORIENTATION_LANDSCAPE,
+ XML_ORIENTATION_PORTRAIT,
+ XML_ORIGIN,
+ XML_ORPHANS,
+ XML_OUTLINE_CONTENT_VISIBLE,
+ XML_OUTLINE_LEVEL,
+ XML_OUTLINE_LEVEL_STYLE,
+ XML_OUTLINE_STYLE,
+ XML_OUTSET,
+ XML_OUTSIDE,
+ XML_OVERLAP,
+ XML_OVERLAY,
+ XML_P,
+ XML_PACKAGE_NAME,
+ XML_PADDING,
+ XML_PADDING_BOTTOM,
+ XML_PADDING_LEFT,
+ XML_PADDING_RIGHT,
+ XML_PADDING_TOP,
+ XML_PAGE,
+ XML_PAGE_ADJUST,
+ XML_PAGE_BREAKS_ON_GROUP_CHANGE,
+ XML_PAGE_CONTENT,
+ XML_PAGE_CONTINUATION_STRING,
+ XML_PAGE_COUNT,
+ XML_PAGE_END_MARGIN,
+ XML_PAGE_HEIGHT,
+ XML_PAGE_MASTER,
+ XML_PAGE_MASTER_NAME,
+ XML_PAGE_NAME,
+ XML_PAGE_NUMBER,
+ XML_PAGE_NUMBER_VISIBLE,
+ XML_PAGE_START_MARGIN,
+ XML_PAGE_STEP_SIZE,
+ XML_PAGE_STYLE_NAME,
+ XML_PAGE_THUMBNAIL,
+ XML_PAGE_USAGE,
+ XML_PAGE_VARIABLE_GET,
+ XML_PAGE_VARIABLE_SET,
+ XML_PAGE_VIEW_ZOOM_VALUE,
+ XML_PAGE_WIDTH,
+ XML_PAGES,
+ XML_PAPER_TRAY_NUMBER,
+ XML_PARAGRAPH,
+ XML_PARAGRAPH_CONTENT,
+ XML_PARAGRAPH_COUNT,
+ XML_PARAGRAPH_END_MARGIN,
+ XML_PARAGRAPH_START_MARGIN,
+ XML_PARALLEL,
+ XML_PARAM,
+ XML_PARENT_STYLE_NAME,
+ XML_PARSE_SQL_STATEMENT,
+ XML_PARSED,
+ XML_PARTIALDIFF,
+ XML_PASSWORD,
+ XML_PASSWORT,
+ XML_PATH,
+ XML_PATH_ID,
+ XML_PAUSE,
+ XML_PENDING,
+ XML_PERCENTAGE,
+ XML_PERCENTAGE_STYLE,
+ XML_PERSPECTIVE,
+ XML_PHDTHESIS,
+ XML_PHONG,
+ XML_PHYSICS_ANIMATION_START_VELOCITY_X,
+ XML_PHYSICS_ANIMATION_START_VELOCITY_Y,
+ XML_PHYSICS_ANIMATION_DENSITY,
+ XML_PHYSICS_ANIMATION_BOUNCINESS,
+ XML_PIE_OFFSET,
+ XML_PLACEHOLDER,
+ XML_PLACEHOLDER_TYPE,
+ XML_PLACING,
+ XML_PLAIN_NUMBER,
+ XML_PLAIN_NUMBER_AND_NAME,
+ XML_PLAY_FULL,
+ XML_PLOT_AREA,
+ XML_PLUGIN,
+ XML_PLUS,
+ XML_POINTS,
+ XML_POLYGON,
+ XML_POLYLINE,
+ XML_POLYNOMIAL,
+ XML_POOL_ID,
+ XML_PORTRAIT,
+ XML_POSITION,
+ XML_POSITION_BOTTOM,
+ XML_POSITION_LEFT,
+ XML_POSITION_RIGHT,
+ XML_POSITION_TOP,
+ XML_POSITIVE_COLOR,
+ XML_POSTURE_OBLIQUE,
+ XML_POWER,
+ XML_PRECISION_AS_SHOWN,
+ XML_PREFIX,
+ XML_INFIX,
+ XML_POSTFIX,
+ XML_PRESENTATION,
+ XML_PRESENTATION_ORGCHART,
+ XML_PRESENTATION_OUTLINE,
+ XML_PRESENTATION_PAGE_LAYOUT,
+ XML_PRESENTATION_PAGE_LAYOUT_NAME,
+ XML_PREVIOUS,
+ XML_PREVIOUS_PAGE,
+ XML_PRINT,
+ XML_PRINT_CONTENT,
+ XML_PRINT_DATE,
+ XML_PRINT_ORIENTATION,
+ XML_PRINT_PAGE_ORDER,
+ XML_PRINT_RANGE,
+ XML_PRINT_RANGES,
+ XML_PRINT_TIME,
+ XML_PRINTABLE,
+ XML_PRINTED_BY,
+ XML_PRIOR,
+ XML_PROCEEDINGS,
+ XML_PRODUCT,
+ XML_PROJECTION,
+ XML_PROPERTIES,
+ XML_PROTECT,
+ XML_PROTECTED,
+ XML_PROTECTION_KEY,
+ XML_PROTECTION_KEY_DIGEST_ALGORITHM,
+ XML_PROTECTION_KEY_DIGEST_ALGORITHM_2,
+ XML_PRSUBSET,
+ XML_PUBLISHER,
+ XML_PUNCTUATION_WRAP,
+ XML_PURPLE,
+ XML_PYRAMID,
+ XML_QRCODE,
+ XML_QRCODE_BORDER,
+ XML_QRCODE_ERROR_CORRECTION,
+ XML_QRCODE_TYPE,
+ XML_QUARTER,
+ XML_QUERY_NAME,
+ XML_QUO_VADIS,
+ XML_QUOTIENT,
+ XML_R,
+ XML_RADAR,
+ XML_RANDOM,
+ XML_RANGE_ADDRESS,
+ XML_RANGE_USABLE_AS,
+ XML_RECREATE_ON_EDIT,
+ XML_RECT,
+ XML_RED,
+ XML_REF_NAME,
+ XML_REFERENCE,
+ XML_REFERENCE_END,
+ XML_REFERENCE_FORMAT,
+ XML_REFERENCE_MARK,
+ XML_REFERENCE_MARK_END,
+ XML_REFERENCE_MARK_START,
+ XML_REFERENCE_REF,
+ XML_REFERENCE_START,
+ XML_REFERENCE_TYPE,
+ XML_REFRESH_DELAY,
+ XML_REGION_CENTER,
+ XML_REGION_LEFT,
+ XML_REGION_RIGHT,
+ XML_REGISTER_TRUE,
+ XML_REGISTER_TRUTH_REF_STYLE_NAME,
+ XML_REJECTED,
+ XML_REJECTING_CHANGE_ID,
+ XML_REJECTION,
+ XML_REL_COLUMN_WIDTH,
+ XML_REL_HEIGHT,
+ XML_REL_HEIGHT_REL,
+ XML_REL_WIDTH,
+ XML_REL_WIDTH_REL,
+ XML_RELATIVE,
+ XML_RELATIVE_TAB_STOP_POSITION,
+ XML_RELN,
+ XML_REM,
+ XML_REMOVE_DEPENDENTS,
+ XML_REMOVE_PRECEDENTS,
+ XML_REPEAT,
+ XML_REPEAT_COLUMN,
+ XML_REPEAT_ROW,
+ XML_REPEATED,
+ XML_REPLACE,
+ XML_REPORT_TYPE,
+ XML_RESTART_ON_PAGE,
+ XML_REVISION,
+ XML_RIDGE,
+ XML_RIGHT,
+ XML_RIGHT_OUTSIDE,
+ XML_RIGHT_TEXT,
+ XML_RIGHT_TO_LEFT,
+ XML_RIGHTARC,
+ XML_RIGHTCIRCLE,
+ XML_RING,
+ XML_ROLE,
+ XML_ROLL_FROM_BOTTOM,
+ XML_ROLL_FROM_LEFT,
+ XML_ROLL_FROM_RIGHT,
+ XML_ROMAN,
+ XML_ROOT,
+ XML_ROTATE,
+ XML_ROTATION,
+ XML_ROTATION_ALIGN,
+ XML_ROTATION_ANGLE,
+ XML_ROUND,
+ XML_ROW,
+ XML_ROW_HEIGHT,
+ XML_ROW_NUMBER,
+ XML_ROWS,
+ XML_RSID,
+ XML_PARRSID,
+ XML_RUBY,
+ XML_RUBY_ALIGN,
+ XML_RUBY_BASE,
+ XML_RUBY_POSITION,
+ XML_RUBY_TEXT,
+ XML_RUN_THROUGH,
+ XML_RX,
+ XML_RY,
+ XML_S,
+ XML_SCALE,
+ XML_SCALE_MIN,
+ XML_SCALE_TEXT,
+ XML_SCALE_TO,
+ XML_SCALE_TO_PAGES,
+ XML_SCATTER,
+ XML_SCENARIO,
+ XML_SCENARIO_RANGES,
+ XML_SCENE,
+ XML_SCHOOL,
+ XML_SCIENTIFIC_NUMBER,
+ XML_SCORE_SPACES,
+ XML_SCRIPT,
+ XML_SCRIPT_ASIAN,
+ XML_SCRIPT_COMPLEX,
+ XML_SCROLL,
+ XML_SDEV,
+ XML_SEARCH_CRITERIA_MUST_APPLY_TO_WHOLE_CELL,
+ XML_SEC,
+ XML_SECH,
+ XML_SECOND_DATE_TIME,
+ XML_SECONDS,
+ XML_SECTION,
+ XML_SECTION_DESC,
+ XML_SECTION_NAME,
+ XML_SECTION_SOURCE,
+ XML_SELECT_PAGE,
+ XML_SELECT_PROTECTED_CELLS,
+ XML_SELECT_UNPROTECTED_CELLS,
+ XML_SELECTOR,
+ XML_SEMANTICS,
+ XML_SEMI_AUTOMATIC,
+ XML_SENDER_CITY,
+ XML_SENDER_COMPANY,
+ XML_SENDER_COUNTRY,
+ XML_SENDER_EMAIL,
+ XML_SENDER_FAX,
+ XML_SENDER_FIRSTNAME,
+ XML_SENDER_INITIALS,
+ XML_SENDER_LASTNAME,
+ XML_SENDER_PHONE_PRIVATE,
+ XML_SENDER_PHONE_WORK,
+ XML_SENDER_POSITION,
+ XML_SENDER_POSTAL_CODE,
+ XML_SENDER_STATE_OR_PROVINCE,
+ XML_SENDER_STREET,
+ XML_SENDER_TITLE,
+ XML_SEP,
+ XML_SEPARATION_CHARACTER,
+ XML_SEPARATOR,
+ XML_SEQUENCE,
+ XML_SEQUENCE_DECL,
+ XML_SEQUENCE_DECLS,
+ XML_SEQUENCE_REF,
+ XML_SERIES,
+ XML_SERIES_SOURCE,
+ XML_SERVER_MAP,
+ XML_SET,
+ XML_SETDIFF,
+ XML_SETTINGS,
+ XML_SHADE_MODE,
+ XML_SHADOW,
+ XML_SHADOW_COLOR,
+ XML_SHADOW_OFFSET_X,
+ XML_SHADOW_OFFSET_Y,
+ XML_SHADOW_SLANT,
+ XML_SHADOW_TRANSPARENCY,
+ XML_SHADOW_BLUR,
+ XML_SHAPE,
+ XML_SHAPE_ID,
+ XML_SHAPES,
+ XML_SHEET_NAME,
+ XML_SHININESS,
+ XML_SHORT,
+ XML_SHOW,
+ XML_SHOW_ACCEPTED_CHANGES,
+ XML_SHOW_CHANGES,
+ XML_SHOW_CHANGES_BY_AUTHOR,
+ XML_SHOW_CHANGES_BY_AUTHOR_NAME,
+ XML_SHOW_CHANGES_BY_COMMENT,
+ XML_SHOW_CHANGES_BY_COMMENT_TEXT,
+ XML_SHOW_CHANGES_BY_DATETIME,
+ XML_SHOW_CHANGES_BY_DATETIME_FIRST_DATETIME,
+ XML_SHOW_CHANGES_BY_DATETIME_MODE,
+ XML_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME,
+ XML_SHOW_CHANGES_BY_RANGES,
+ XML_SHOW_CHANGES_BY_RANGES_LIST,
+ XML_SHOW_LOGO,
+ XML_SHOW_REJECTED_CHANGES,
+ XML_SHOW_SHAPE,
+ XML_SHOW_TEXT,
+ XML_SHOW_UNIT,
+ XML_SHOW_VALUE,
+ XML_SHOWS,
+ XML_SIDE_BY_SIDE,
+ XML_SILVER,
+ XML_SIMPLE,
+ XML_SIN,
+ XML_SINCE_DATE_TIME,
+ XML_SINCE_SAVE,
+ XML_SINH,
+ XML_SIZE,
+ XML_SIZE_PROTECT,
+ XML_SLANT,
+ XML_SLANT_X,
+ XML_SLANT_Y,
+ XML_SLIDE,
+ XML_SLOW,
+ XML_SOFTEDGE_RADIUS,
+ XML_SOLID,
+ XML_SOLID_TYPE,
+ XML_SORT,
+ XML_SORT_ASCENDING,
+ XML_SORT_BY,
+ XML_SORT_BY_POSITION,
+ XML_SORT_GROUPS,
+ XML_SORT_KEY,
+ XML_SOUND,
+ XML_SOURCE_CELL_RANGE,
+ XML_SOURCE_CELL_RANGE_ADDRESSES,
+ XML_SOURCE_FIELD_NAME,
+ XML_SOURCE_NAME,
+ XML_SOURCE_RANGE_ADDRESS,
+ XML_SOURCE_SERVICE,
+ XML_SPACE_BEFORE,
+ XML_SPARKLINE_GROUPS,
+ XML_SPARKLINE_GROUP,
+ XML_SPARKLINES,
+ XML_SPARKLINE,
+ XML_SPAN,
+ XML_SPECULAR,
+ XML_SPECULAR_COLOR,
+ XML_SPEED,
+ XML_SPHERE,
+ XML_SPIRAL,
+ XML_SPIRAL_IN,
+ XML_SPIRAL_INWARD_LEFT,
+ XML_SPIRAL_INWARD_RIGHT,
+ XML_SPIRAL_OUT,
+ XML_SPIRAL_OUTWARD_LEFT,
+ XML_SPIRAL_OUTWARD_RIGHT,
+ XML_SPIRALIN_LEFT,
+ XML_SPIRALIN_RIGHT,
+ XML_SPIRALOUT_LEFT,
+ XML_SPIRALOUT_RIGHT,
+ XML_SPLINES,
+ XML_SPLIT,
+ XML_SPLIT_COLUMN,
+ XML_SPLIT_POSITION,
+ XML_SPLIT_ROW,
+ XML_SPREADSHEET,
+ XML_SPREADMETHOD,
+ XML_SQL_STATEMENT,
+ XML_STACKED,
+ XML_STAGGER_EVEN,
+ XML_STAGGER_ODD,
+ XML_STANDARD,
+ XML_STANDARD_DEVIATION,
+ XML_STARBASIC,
+ XML_START,
+ XML_START_ANGLE,
+ XML_START_COLOR,
+ XML_START_COLUMN,
+ XML_START_GLUE_POINT,
+ XML_START_GUIDE,
+ XML_START_INTENSITY,
+ XML_START_LINE_SPACING_HORIZONTAL,
+ XML_START_LINE_SPACING_VERTICAL,
+ XML_START_NUMBERING_AT,
+ XML_START_PAGE,
+ XML_START_POSITION,
+ XML_START_ROW,
+ XML_START_SCALE,
+ XML_START_SHAPE,
+ XML_START_TABLE,
+ XML_START_VALUE,
+ XML_START_WITH_NAVIGATOR,
+ XML_STATE,
+ XML_STATISTICS,
+ XML_STATUS,
+ XML_STAY_ON_TOP,
+ XML_STDEV,
+ XML_STDEVP,
+ XML_STEPS,
+ XML_STEP_SIZE,
+ XML_STOCK,
+ XML_STOCK_UPDOWN_BARS,
+ XML_STOCK_WITH_VOLUME,
+ XML_STOP,
+ XML_STOP_COLOR,
+ XML_STOP_OPACITY,
+ XML_STRETCH,
+ XML_STRETCH_FROM_BOTTOM,
+ XML_STRETCH_FROM_LEFT,
+ XML_STRETCH_FROM_RIGHT,
+ XML_STRETCH_FROM_TOP,
+ XML_STRETCHY,
+ XML_STRICT,
+ XML_STRING,
+ XML_STRING_VALUE,
+ XML_STRING_VALUE_IF_FALSE,
+ XML_STRING_VALUE_IF_TRUE,
+ XML_STRIPES,
+ XML_STROKE,
+ XML_STROKE_COLOR,
+ XML_STROKE_DASH,
+ XML_STROKE_LINECAP,
+ XML_STROKE_LINEJOIN,
+ XML_STROKE_OPACITY,
+ XML_STROKE_WIDTH,
+ XML_STRUCTURE_PROTECTED,
+ XML_STYLE,
+ XML_STYLE_NAME,
+ XML_STYLES,
+ XML_STYLESHEET,
+ XML_SUB_TABLE,
+ XML_SUBJECT,
+ XML_SUBSET,
+ XML_SUBTITLE,
+ XML_SUBTOTAL_FIELD,
+ XML_SUBTOTAL_RULE,
+ XML_SUBTOTAL_RULES,
+ XML_SUB_VIEW_SIZE,
+ XML_SUFFIX,
+ XML_SUM,
+ XML_SWISS,
+ XML_SYMBOL,
+ XML_SYMBOL_HEIGHT,
+ XML_SYMBOL_IMAGE_NAME,
+ XML_SYMBOL_WIDTH,
+ XML_SYSTEM,
+ XML_TAB_COLOR,
+ XML_TAB_CYCLE,
+ XML_TAB_INDEX,
+ XML_TAB_STOP,
+ XML_TAB_STOP_DISTANCE,
+ XML_TAB_STOPS,
+ XML_TABLE,
+ XML_TABLE_BACKGROUND,
+ XML_TABLE_CELL,
+ XML_TABLE_CENTERING,
+ XML_TABLE_COLUMN,
+ XML_TABLE_COLUMN_GROUP,
+ XML_TABLE_COLUMNS,
+ XML_TABLE_COUNT,
+ XML_TABLE_HEADER,
+ XML_TABLE_HEADER_COLUMNS,
+ XML_TABLE_HEADER_ROWS,
+ XML_TABLE_INDEX,
+ XML_TABLE_INDEX_ENTRY_TEMPLATE,
+ XML_TABLE_INDEX_SOURCE,
+ XML_TABLE_NAME,
+ XML_TABLE_OF_CONTENT,
+ XML_TABLE_OF_CONTENT_ENTRY_TEMPLATE,
+ XML_TABLE_OF_CONTENT_SOURCE,
+ XML_TABLE_PAGE,
+ XML_TABLE_PROTECTION,
+ XML_TABLE_ROW,
+ XML_TABLE_ROW_GROUP,
+ XML_TABLE_ROWS,
+ XML_TABLE_SOURCE,
+ XML_TABLE_VIEW,
+ XML_TABLES,
+ XML_TAN,
+ XML_TANH,
+ XML_TARGET_CELL_ADDRESS,
+ XML_TARGET_FRAME,
+ XML_TARGET_FRAME_NAME,
+ XML_TARGET_RANGE_ADDRESS,
+ XML_TB_RL,
+ XML_TEAL,
+ XML_TECHREPORT,
+ XML_TEMPLATE,
+ XML_TEMPLATE_NAME,
+ XML_TENDSTO,
+ XML_TEX_FILTER,
+ XML_TEX_GENERATION_MODE_X,
+ XML_TEX_GENERATION_MODE_Y,
+ XML_TEX_KIND,
+ XML_TEX_MODE,
+ XML_TEXT,
+ XML_TEXT_ALIGN,
+ XML_TEXT_ALIGN_LAST,
+ XML_TEXT_ALIGN_SOURCE,
+ XML_TEXT_AUTOSPACE,
+ XML_TEXT_BACKGROUND_COLOR,
+ XML_TEXT_BLINKING,
+ XML_TEXT_BOX,
+ XML_TEXT_CHANGES_ONLY,
+ XML_TEXT_COLOR,
+ XML_TEXT_COMBINE,
+ XML_TEXT_COMBINE_END_CHAR,
+ XML_TEXT_COMBINE_START_CHAR,
+ XML_TEXT_CONTENT,
+ XML_TEXT_CONVERSION_DICTIONARY,
+ XML_TEXT_CROSSING_OUT,
+ XML_TEXT_EMPHASIZE,
+ XML_TEXT_GLOBAL,
+ XML_TEXT_INDENT,
+ XML_TEXT_INPUT,
+ XML_TEXT_JUSTIFY,
+ XML_TEXT_OUTLINE,
+ XML_TEXT_ONLY,
+ XML_TEXT_POSITION,
+ XML_TEXT_ROTATION_ANGLE,
+ XML_TEXT_ROTATION_SCALE,
+ XML_TEXT_SCALE,
+ XML_TEXT_SHADOW,
+ XML_TEXT_STYLE,
+ XML_TEXT_TRANSFORM,
+ XML_TEXT_UNDERLINE,
+ XML_TEXT_UNDERLINE_COLOR,
+ XML_TEXTAREA_HORIZONTAL_ALIGN,
+ XML_TEXTAREA_VERTICAL_ALIGN,
+ XML_TEXTUAL,
+ XML_THICK,
+ XML_THIN,
+ XML_THREE_DIMENSIONAL,
+ XML_THUMBNAIL,
+ XML_TICK_MARKS_MAJOR_INNER,
+ XML_TICK_MARKS_MAJOR_OUTER,
+ XML_TICK_MARKS_MINOR_INNER,
+ XML_TICK_MARKS_MINOR_OUTER,
+ XML_TILE_REPEAT_OFFSET,
+ XML_TIME,
+ XML_TIME_ADJUST,
+ XML_TIME_STYLE,
+ XML_TIME_VALUE,
+ XML_TIMES,
+ XML_TITLE,
+ XML_TO_ANOTHER_TABLE,
+ XML_TO_BOTTOM,
+ XML_TO_CENTER,
+ XML_TO_LEFT,
+ XML_TO_LOWER_LEFT,
+ XML_TO_LOWER_RIGHT,
+ XML_TO_RIGHT,
+ XML_TO_TOP,
+ XML_TO_UPPER_LEFT,
+ XML_TO_UPPER_RIGHT,
+ XML_TOC_MARK,
+ XML_TOC_MARK_END,
+ XML_TOC_MARK_START,
+ XML_TOGGLE,
+ XML_TOP,
+ XML_TOP_LEFT,
+ XML_TOP_PERCENT,
+ XML_TOP_RIGHT,
+ XML_TOP_VALUES,
+ XML_TOPARC,
+ XML_TOPCIRCLE,
+ XML_TRACE_DEPENDENTS,
+ XML_TRACE_ERRORS,
+ XML_TRACE_PRECEDENTS,
+ XML_TRACK_CHANGES,
+ XML_TRACKED_CHANGES,
+ XML_TRACKED_CHANGES_VIEW_SETTINGS,
+ XML_TRANSFORM,
+ XML_TRANSITION_ON_CLICK,
+ XML_TRANSPARENCY,
+ XML_TRANSPARENCY_NAME,
+ XML_TRANSPARENT,
+ XML_TRANSPOSE,
+ XML_TRUE,
+ XML_TRUNCATE_ON_OVERFLOW,
+ XML_TRY_STAGGERING_FIRST,
+ XML_TSPAN,
+ XML_TTB,
+ XML_TYPE,
+ XML_DOT_DASH,
+ XML_DOT_DOT_DASH,
+ XML_LONG_DASH,
+ XML_SHOW_SIGN_DATE,
+ XML_SIGNATURELINE,
+ XML_SIGNING_INSTRUCTIONS,
+ XML_SINGLE,
+ XML_SMALL_WAVE,
+ XML_SUGGESTED_SIGNER_EMAIL,
+ XML_SUGGESTED_SIGNER_NAME,
+ XML_SUGGESTED_SIGNER_TITLE,
+ XML_WAVE,
+ XML_UNFORMATTED_TEXT,
+ XML_UNION,
+ XML_UNIT,
+ XML_UNORDERED_LIST,
+ XML_UNPUBLISHED,
+ XML_UP,
+ XML_UPLIMIT,
+ XML_UPRIGHT,
+ XML_URL,
+ XML_USE,
+ XML_USE_CAPTION,
+ XML_USE_CELL_PROTECTION,
+ XML_USE_CHART_OBJECTS,
+ XML_USE_CONDITION,
+ XML_USE_DRAW_OBJECTS,
+ XML_USE_FLOATING_FRAMES,
+ XML_USE_GRAPHICS,
+ XML_USE_IMAGE_OBJECTS,
+ XML_USE_INDEX_MARKS,
+ XML_USE_INDEX_SOURCE_STYLES,
+ XML_USE_KEYS_AS_ENTRIES,
+ XML_USE_LABEL,
+ XML_USE_MATH_OBJECTS,
+ XML_USE_OBJECTS,
+ XML_USE_OPTIMAL_COLUMN_WIDTH,
+ XML_USE_OPTIMAL_ROW_HEIGHT,
+ XML_USE_OTHER_OBJECTS,
+ XML_USE_SPREADSHEET_OBJECTS,
+ XML_USE_STYLES,
+ XML_USE_TABLES,
+ XML_USE_WINDOW_FONT_COLOR,
+ XML_USED_HIERARCHY,
+ XML_USER_DEFINED,
+ XML_USER_FIELD_DECL,
+ XML_USER_FIELD_DECLS,
+ XML_USER_FIELD_GET,
+ XML_USER_FIELD_INPUT,
+ XML_USER_INDEX,
+ XML_USER_INDEX_ENTRY_TEMPLATE,
+ XML_USER_INDEX_MARK,
+ XML_USER_INDEX_MARK_END,
+ XML_USER_INDEX_MARK_START,
+ XML_USER_INDEX_SOURCE,
+ XML_USER_TRANSFORMED,
+ XML_USERNAME,
+ XML_VALIDATION,
+ XML_VALUE,
+ XML_VALUE_TYPE,
+ XML_VALUES_CELL_RANGE_ADDRESS,
+ XML_VAR,
+ XML_VARIABLE,
+ XML_VARIABLE_DECL,
+ XML_VARIABLE_DECLS,
+ XML_VARIABLE_GET,
+ XML_VARIABLE_INPUT,
+ XML_VARIABLE_SET,
+ XML_VARIANCE,
+ XML_VARP,
+ XML_VECTOR,
+ XML_VERB,
+ XML_VERSION,
+ XML_VERSION_ENTRY,
+ XML_VERSION_LIST,
+ XML_VERTICAL,
+ XML_VERTICAL_ALIGN,
+ XML_VERTICAL_JUSTIFY,
+ XML_VERTICAL_LINES,
+ XML_VERTICAL_POS,
+ XML_VERTICAL_REL,
+ XML_VERTICAL_SEGMENTS,
+ XML_VERTICAL_SPLIT_MODE,
+ XML_VERTICAL_SPLIT_POSITION,
+ XML_VERTICAL_STRIPES,
+ XML_VIEW,
+ XML_VIEWBOX,
+ XML_VIEW_ID,
+ XML_VIEW_SETTINGS,
+ XML_VISIBILITY,
+ XML_VISIBLE,
+ XML_VISIBLE_AREA,
+ XML_VISIBLE_AREA_HEIGHT,
+ XML_VISIBLE_AREA_LEFT,
+ XML_VISIBLE_AREA_TOP,
+ XML_VISIBLE_AREA_WIDTH,
+ XML_VISITED_STYLE_NAME,
+ XML_VISUAL_EFFECT,
+ XML_VOLATILE,
+ XML_VOLUME,
+ XML_VPN,
+ XML_VRP,
+ XML_VUP,
+ XML_WALL,
+ XML_WARNING,
+ XML_WATERMARK,
+ XML_WAVYLINE,
+ XML_WAVYLINE_FROM_BOTTOM,
+ XML_WAVYLINE_FROM_LEFT,
+ XML_WAVYLINE_FROM_RIGHT,
+ XML_WAVYLINE_FROM_TOP,
+ XML_WEEK_OF_YEAR,
+ XML_WHITE,
+ XML_WHOLE_PAGE,
+ XML_WIDOWS,
+ XML_WIDTH,
+ XML_WINDOW_FONT_COLOR,
+ XML_WORD,
+ XML_WORD_COUNT,
+ XML_WRAP,
+ XML_WRAP_CONTOUR,
+ XML_WRAP_CONTOUR_MODE,
+ XML_WRAP_OPTION,
+ XML_WRITING_MODE,
+ XML_WWW,
+ XML_X,
+ XML_X1,
+ XML_X2,
+ XML_X_MAC_ROMAN,
+ XML_X_SYMBOL,
+ XML_X_SYSTEM,
+ XML_XOR,
+ XML_Y,
+ XML_Y1,
+ XML_Y2,
+ XML_YEAR,
+ XML_YELLOW,
+ XML_ZERO_VALUES,
+ XML_ZINDEX,
+ XML_ZOOM_TYPE,
+ XML_ZOOM_VALUE,
+
+ XML_ENABLE,
+ XML_USE_REGULAR_EXPRESSIONS,
+ XML_USE_WILDCARDS,
+ XML_DATA_SOURCE_HAS_LABELS,
+ XML_LINK_DATA_STYLE_TO_SOURCE,
+ XML_SORT_ALGORITHM,
+ XML_STRAIGHT_LINE,
+ XML_ANGLED_LINE,
+ XML_ANGLED_CONNECTOR_LINE,
+ XML_APPLICATION_X_WWW_FORM_URLENCODED,
+ XML_MULTIPART_FORMDATA,
+ XML_APPLICATION_TEXT,
+ XML_GET,
+ XML_POST,
+ XML_QUERY,
+ XML_PARENT,
+ XML_RECORDS,
+ XML_PUSH,
+ XML_SUBMIT,
+ XML_RESET,
+ XML_VALUE_LIST,
+ XML_SQL,
+ XML_SQL_PASS_THROUGH,
+ XML_TABLE_FIELDS,
+ XML_UNCHECKED,
+ XML_CHECKED,
+ XML_UNKNOWN,
+
+ XML_ROLL_FROM_TOP,
+
+ XML_BINARY_DATA,
+ XML_NOTIFY_ON_UPDATE_OF_TABLE,
+
+ XML_0,
+ XML_PLAY,
+ XML_HANDOUT_MASTER,
+ XML_TEXT_STYLE_NAME,
+ XML_ESCAPE_DIRECTION,
+ XML_GLUE_POINT,
+ XML_PRIMARY_X,
+ XML_SECONDARY_X,
+ XML_PRIMARY_Y,
+ XML_SECONDARY_Y,
+ XML_PRIMARY_Z,
+
+ XML_CAPTION_TYPE,
+ XML_CAPTION_ANGLE_TYPE,
+ XML_CAPTION_ANGLE,
+ XML_CAPTION_GAP,
+ XML_CAPTION_ESCAPE_DIRECTION,
+ XML_CAPTION_ESCAPE,
+ XML_CAPTION_LINE_LENGTH,
+ XML_CAPTION_FIT_LINE_LENGTH,
+ XML_FREE,
+
+ XML_TRANSITION_TYPE,
+ XML_TRANSITION_STYLE,
+ XML_TRANSITION_SPEED,
+ XML_DURATION,
+ XML_BACKGROUND_SIZE,
+ XML_BACKGROUND_OBJECTS_VISIBLE,
+ XML_BACKGROUND_VISIBLE,
+
+ XML_MOVE_FROM_UPPERLEFT,
+ XML_MOVE_FROM_UPPERRIGHT,
+ XML_MOVE_FROM_LOWERRIGHT,
+ XML_MOVE_FROM_LOWERLEFT,
+ XML_UNCOVER_TO_LEFT,
+ XML_UNCOVER_TO_UPPERLEFT,
+ XML_UNCOVER_TO_TOP,
+ XML_UNCOVER_TO_UPPERRIGHT,
+ XML_UNCOVER_TO_RIGHT,
+ XML_UNCOVER_TO_LOWERRIGHT,
+ XML_UNCOVER_TO_BOTTOM,
+ XML_UNCOVER_TO_LOWERLEFT,
+ XML_VERTICAL_CHECKERBOARD,
+ XML_HORIZONTAL_CHECKERBOARD,
+ XML_NOTIFY_ON_UPDATE_OF_RANGES,
+ XML_BYTE,
+ XML_MACRO,
+ XML_LOCATION,
+ XML_APPLICATION,
+ XML_SYMBOL_IMAGE,
+ XML_TEXT_OVERLAP,
+ XML_SPLINE_ORDER,
+ XML_SPLINE_RESOLUTION,
+
+ XML_PAPER_TRAY_NAME,
+
+ XML_COLUMN_MAPPING,
+ XML_ROW_MAPPING,
+
+ XML_TABLE_FORMULA,
+
+ XML_EMBEDDED_TEXT,
+
+ XML_MERGE_LAST_PARAGRAPH,
+
+ XML_STOCK_LOSS_MARKER,
+ XML_STOCK_GAIN_MARKER,
+ XML_STOCK_RANGE_LINE,
+
+ XML_RL_TB,
+ XML_TB_LR,
+ XML_BT_LR,
+ XML_LR,
+ XML_RL,
+ XML_TB,
+
+ XML_LAYOUT_GRID_COLOR,
+ XML_LAYOUT_GRID_LINES,
+ XML_LAYOUT_GRID_BASE_HEIGHT,
+ XML_LAYOUT_GRID_RUBY_HEIGHT,
+ XML_LAYOUT_GRID_MODE,
+ XML_LAYOUT_GRID_RUBY_BELOW,
+ XML_LAYOUT_GRID_PRINT,
+ XML_LAYOUT_GRID_DISPLAY,
+
+ //text grid enhancement for better CJK support
+ XML_DEFAULT_PAGE_LAYOUT,
+ XML_LAYOUT_GRID_STANDARD_MODE,
+ XML_LAYOUT_GRID_BASE_WIDTH,
+ XML_LAYOUT_GRID_SNAP_TO_CHARS,
+ XML_LAYOUT_GRID_SNAP_TO,
+
+ XML_SNAP_TO_LAYOUT_GRID,
+ XML_DONT_BALANCE_TEXT_COLUMNS,
+
+ XML_GLYPH_ORIENTATION_VERTICAL,
+
+ XML_MARKED_INVALID,
+
+ XML_REGRESSION_CURVE,
+ XML_REGRESSION_TYPE,
+ XML_REGRESSION_CURVE_NAME,
+ XML_REGRESSION_EXTRAPOLATE_FORWARD,
+ XML_REGRESSION_EXTRAPOLATE_BACKWARD,
+ XML_REGRESSION_MAX_DEGREE,
+ XML_REGRESSION_MIN_DEGREE,
+ XML_REGRESSION_MOVING_TYPE,
+ XML_REGRESSION_PERIOD,
+ XML_REGRESSION_FORCE_INTERCEPT,
+ XML_REGRESSION_INTERCEPT_VALUE,
+ XML_REGRESSION_X_NAME,
+ XML_REGRESSION_Y_NAME,
+
+ XML_ERROR_INDICATOR,
+
+ XML_TABLE_TYPE,
+
+ XML_DISPLAY_FACTOR,
+
+ XML_TRANSLITERATION_FORMAT,
+ XML_TRANSLITERATION_LANGUAGE,
+ XML_TRANSLITERATION_COUNTRY,
+ XML_TRANSLITERATION_STYLE,
+
+ XML_KEY1_PHONETIC,
+ XML_KEY2_PHONETIC,
+ XML_STRING_VALUE_PHONETIC,
+
+ XML_BACKGROUND_TRANSPARENCY,
+ XML_BACKGROUND_IMAGE_TRANSPARENCY,
+
+ XML_DYNAMIC_SPACING,
+ XML_MAIN_ENTRY,
+
+ XML_USE_OUTLINE_LEVEL,
+
+ // #107245# New 3D properties which are possible for lathe and extrude 3d objects
+ XML_CLOSE_FRONT,
+ XML_CLOSE_BACK,
+
+ XML_DROP_DOWN,
+ XML_CURRENT_SELECTED,
+
+ XML_JOIN_BORDER,
+
+ XML_DISPLAY_LIST,
+ XML_NO,
+ XML_UNSORTED,
+ XML_FONT_INDEPENDENT_LINE_SPACING,
+
+ // Wrong! Do not write, use XML_SORT_ASCENDING instead. Only read. fdo#72548
+ XML_SORTED_ASCENDING,
+
+ XML_DATABASE,
+ XML_DATASOURCE, // forms "datasource"
+ XML_DATA_SOURCE, // db "data-source"
+ XML_QUERIES,
+ XML_REPORTS,
+ XML_REPORT,
+ XML_AS_TEMPLATE,
+
+ XML_CONNECTION_RESOURCE,
+ XML_SUPPRESS_VERSION_COLUMNS,
+ XML_JAVA_DRIVER_CLASS,
+ XML_EXTENSION,
+ XML_IS_FIRST_ROW_HEADER_LINE,
+ XML_SHOW_DELETED,
+ XML_IS_TABLE_NAME_LENGTH_LIMITED,
+ XML_SYSTEM_DRIVER_SETTINGS,
+ XML_ENABLE_SQL92_CHECK,
+ XML_APPEND_TABLE_ALIAS_NAME,
+ XML_PARAMETER_NAME_SUBSTITUTION,
+ XML_IGNORE_DRIVER_PRIVILEGES,
+ XML_BOOLEAN_COMPARISON_MODE,
+ XML_USE_CATALOG,
+ XML_BASE_DN,
+ XML_MAX_ROW_COUNT,
+ XML_LOGIN,
+ XML_USER_NAME,
+ XML_IS_PASSWORD_REQUIRED,
+ XML_LOGIN_TIMEOUT,
+ XML_DELIMITER,
+ XML_FIELD,
+ XML_DECIMAL,
+ XML_THOUSAND,
+ XML_TABLE_FILTER,
+ XML_TABLE_FILTER_PATTERN,
+ XML_TABLE_TYPE_FILTER,
+ XML_AUTO_INCREMENT,
+ XML_ADDITIONAL_COLUMN_STATEMENT,
+ XML_ROW_RETRIEVING_STATEMENT,
+ XML_DATA_SOURCE_SETTINGS,
+ XML_DATA_SOURCE_SETTING,
+ XML_DATA_SOURCE_SETTING_VALUE,
+ XML_DATA_SOURCE_SETTING_IS_LIST,
+ XML_DATA_SOURCE_SETTING_TYPE,
+ XML_DATA_SOURCE_SETTING_NAME,
+ XML_COMPONENT,
+ XML_COMPONENT_COLLECTION,
+ XML_QUERY_COLLECTION,
+ XML_UPDATE_TABLE,
+ XML_FILTER_STATEMENT,
+ XML_ORDER_STATEMENT,
+ XML_ESCAPE_PROCESSING,
+ XML_KEYS,
+ XML_INDICES,
+ XML_TYPE_NAME,
+ XML_PRECISION,
+ XML_IS_NULLABLE,
+ XML_IS_AUTOINCREMENT,
+ XML_DEFAULT_VALUE,
+ XML_REFERENCED_TABLE_NAME,
+ XML_UPDATE_RULE,
+ XML_DELETE_RULE,
+ XML_KEY_COLUMNS,
+ XML_KEY_COLUMN,
+ XML_RELATED_COLUMN_NAME,
+ XML_CATALOG_NAME,
+ XML_IS_UNIQUE,
+ XML_IS_CLUSTERED,
+ XML_INDEX_COLUMNS,
+ XML_INDEX_COLUMN,
+ XML_IS_ASCENDING,
+ XML_SCHEMA_NAME,
+ XML_NP_DB,
+ XML_N_DB,
+ XML_APPLY_FILTER,
+ XML_APPLY_ORDER,
+ XML_AUTOMATIC_PRINT_RANGE,
+
+ XML_SELECTION,
+ XML_SELECTION_INDEXES,
+
+ XML_SCALE_TO_X,
+ XML_SCALE_TO_Y,
+
+ XML_KEEP_TOGETHER,
+
+ XML_USE_HEADER_NAME,
+ XML_USE_FOOTER_NAME,
+ XML_USE_DATE_TIME_NAME,
+ XML_DISPLAY_HEADER,
+ XML_DISPLAY_FOOTER,
+ XML_DISPLAY_PAGE_NUMBER,
+ XML_DISPLAY_DATE_TIME,
+ XML_SOURCE,
+ XML_CURRENT_DATE,
+
+ XML_HEADER_DECL,
+ XML_FOOTER_DECL,
+ XML_DATE_TIME_DECL,
+
+ XML_SELECTED_PAGE,
+
+ // DVO, OD 01.10.2003 #i18732
+ XML_FLOW_WITH_TEXT,
+
+ XML_WITH_TAB, // #i21237#
+
+ XML_CUSTOM_SHAPE,
+ XML_ENGINE,
+ XML_ENHANCED_GEOMETRY,
+ XML_TEXT_ROTATE_ANGLE,
+ XML_MIRROR_VERTICAL,
+ XML_MIRROR_HORIZONTAL,
+ XML_EXTRUSION_ALLOWED,
+ XML_TEXT_PATH_ALLOWED,
+ XML_CONCENTRIC_GRADIENT_FILL_ALLOWED,
+ XML_EXTRUSION,
+ XML_EXTRUSION_BRIGHTNESS,
+ XML_EXTRUSION_DEPTH,
+ XML_EXTRUSION_DIFFUSION,
+ XML_EXTRUSION_NUMBER_OF_LINE_SEGMENTS,
+ XML_EXTRUSION_LIGHT_FACE,
+ XML_EXTRUSION_FIRST_LIGHT_HARSH,
+ XML_EXTRUSION_SECOND_LIGHT_HARSH,
+ XML_EXTRUSION_FIRST_LIGHT_LEVEL,
+ XML_EXTRUSION_SECOND_LIGHT_LEVEL,
+ XML_EXTRUSION_FIRST_LIGHT_DIRECTION,
+ XML_EXTRUSION_SECOND_LIGHT_DIRECTION,
+ XML_EXTRUSION_METAL,
+ XML_EXTRUSION_METAL_TYPE,
+ XML_EXTRUSION_ROTATION_ANGLE,
+ XML_EXTRUSION_ROTATION_CENTER,
+ XML_EXTRUSION_SHININESS,
+ XML_EXTRUSION_SKEW,
+ XML_EXTRUSION_SPECULARITY,
+ XML_EXTRUSION_SPECULARITY_LOEXT,
+ XML_EXTRUSION_PROJECTION_MODE,
+ XML_EXTRUSION_VIEWPOINT,
+ XML_EXTRUSION_ORIGIN,
+ XML_EXTRUSION_COLOR,
+ XML_SECONDARY_FILL_COLOR,
+ XML_ENHANCED_PATH,
+ XML_PATH_STRETCHPOINT_X,
+ XML_PATH_STRETCHPOINT_Y,
+ XML_TEXT_AREAS,
+ XML_GLUE_POINTS,
+ XML_GLUE_POINT_TYPE,
+ XML_GLUE_POINT_LEAVING_DIRECTIONS,
+ XML_TEXT_PATH,
+ XML_TEXT_PATH_MODE,
+ XML_TEXT_PATH_SCALE,
+ XML_TEXT_PATH_SAME_LETTER_HEIGHTS,
+ XML_MODIFIERS,
+ XML_EQUATION,
+ XML_XSTRETCH,
+ XML_YSTRETCH,
+ XML_HASSTROKE,
+ XML_HASFILL,
+ XML_LOGWIDTH,
+ XML_LOGHEIGHT,
+ XML_HANDLE,
+ XML_HANDLE_MIRROR_VERTICAL,
+ XML_HANDLE_MIRROR_HORIZONTAL,
+ XML_HANDLE_SWITCHED,
+ XML_HANDLE_POSITION,
+ XML_HANDLE_RANGE_X_MINIMUM,
+ XML_HANDLE_RANGE_X_MAXIMUM,
+ XML_HANDLE_RANGE_Y_MINIMUM,
+ XML_HANDLE_RANGE_Y_MAXIMUM,
+ XML_HANDLE_POLAR,
+ XML_HANDLE_RADIUS_RANGE_MINIMUM,
+ XML_HANDLE_RADIUS_RANGE_MAXIMUM,
+ XML_RECTANGLE,
+ XML_ROUNDRECTANGLE,
+ XML_OVAL,
+ XML_CLOUD,
+ XML_BOUNDINGCUBE,
+ XML_WIREFRAME,
+ XML_SEGMENTS,
+ XML_WORD_WRAP,
+
+ XML_COLLAPSING,
+ XML_SEPARATING,
+ XML_BORDER_MODEL,
+
+ XML_DATA_PILOT_FIELD_REFERENCE,
+ XML_MEMBER_DIFFERENCE,
+ XML_MEMBER_PERCENTAGE,
+ XML_MEMBER_PERCENTAGE_DIFFERENCE,
+ XML_RUNNING_TOTAL,
+ XML_ROW_PERCENTAGE,
+ XML_COLUMN_PERCENTAGE,
+ XML_TOTAL_PERCENTAGE,
+ XML_FIELD_NAME,
+ XML_MEMBER_TYPE,
+ XML_NAMED,
+ XML_MEMBER_NAME,
+ XML_DISPLAY_MEMBER_MODE,
+ XML_MEMBER_COUNT,
+ XML_DATA_FIELD,
+ XML_DATA_PILOT_DISPLAY_INFO,
+ XML_SORT_MODE,
+ XML_DATA_PILOT_SORT_INFO,
+ XML_ADD_EMPTY_LINES,
+ XML_TABULAR_LAYOUT,
+ XML_OUTLINE_SUBTOTALS_TOP,
+ XML_OUTLINE_SUBTOTALS_BOTTOM,
+ XML_LAYOUT_MODE,
+ XML_DATA_PILOT_LAYOUT_INFO,
+
+ XML_SYMBOL_COLOR,
+
+ XML_3D,
+ XML_IMAGE_POSITION,
+ XML_IMAGE_ALIGN,
+
+ XML_DIAGONAL_BL_TR,
+ XML_DIAGONAL_BL_TR_WIDTH,
+ XML_DIAGONAL_TL_BR,
+ XML_DIAGONAL_TL_BR_WIDTH,
+ XML_REPEAT_CONTENT,
+ XML_SHRINK_TO_FIT,
+
+ /* Core impl. of the positioning of floating screen objects without
+ considering its wrapping style (#i28701#)
+ */
+ XML_WRAP_INFLUENCE_ON_POSITION,
+ // Tokens have been renamed and <XML_ITERATIVE> has been added (#i35017#)
+ XML_ONCE_SUCCESSIVE,
+ XML_ONCE_CONCURRENT,
+ XML_ALLOW_OVERLAP,
+
+ // Names for OOo format only
+ XML_N_OFFICE_OOO,
+ XML_N_META_OOO,
+ XML_N_STYLE_OOO,
+ XML_N_NUMBER_OOO,
+ XML_N_TEXT_OOO,
+ XML_N_TABLE_OOO,
+ XML_N_DRAW_OOO,
+ XML_N_DR3D_OOO,
+ XML_N_PRESENTATION_OOO,
+ XML_N_PRESENTATION_OASIS,
+ XML_N_CHART_OOO,
+ XML_N_CONFIG_OOO,
+ XML_N_FORM_OOO,
+ XML_N_SCRIPT_OOO,
+
+ XML_GLOBAL,
+ XML_NOTE_CLASS,
+ XML_NOTE_CITATION,
+ XML_NOTE_BODY,
+ XML_NOTES_CONFIGURATION,
+ XML_NOTE_REF,
+ XML_IS_SUB_TABLE,
+ XML_PAGE_LAYOUT,
+ XML_PAGE_LAYOUT_NAME,
+ XML_GRAPHIC_PROPERTIES,
+ XML_DRAWING_PAGE_PROPERTIES,
+ XML_PAGE_LAYOUT_PROPERTIES,
+ XML_HEADER_FOOTER_PROPERTIES,
+ XML_TEXT_PROPERTIES,
+ XML_PARAGRAPH_PROPERTIES,
+ XML_RUBY_PROPERTIES,
+ XML_SECTION_PROPERTIES,
+ XML_TABLE_PROPERTIES,
+ XML_TABLE_COLUMN_PROPERTIES,
+ XML_TABLE_ROW_PROPERTIES,
+ XML_TABLE_CELL_PROPERTIES,
+ XML_LIST_LEVEL_PROPERTIES,
+ XML_CHART_PROPERTIES,
+ XML_DRAWING_PAGE,
+ XML_GRAPHICS,
+ XML_TAB,
+ XML_TEXT_UNDERLINE_MODE,
+ XML_TEXT_LINE_THROUGH_MODE,
+ XML_CONTINUOUS,
+ XML_SKIP_WHITE_SPACE,
+ XML_SCRIPTS,
+ XML_FONT_FACE_DECLS,
+ XML_FONT_FACE,
+ XML_FONT_FACE_SRC,
+ XML_FONT_FACE_URI,
+ XML_FONT_FACE_FORMAT,
+ XML_FONT_ADORNMENTS,
+ XML_INCH,
+ XML_SPACE_AFTER,
+ XML_START_INDENT,
+ XML_END_INDENT,
+
+ // chart Oasis format additions
+ XML_INTERVAL_MINOR_DIVISOR,
+ XML_DATE_STRING,
+
+ XML_TEXT_UNDERLINE_STYLE,
+ XML_TEXT_UNDERLINE_TYPE,
+ XML_TEXT_UNDERLINE_WIDTH,
+
+ XML_TEXT_OVERLINE_TYPE,
+ XML_TEXT_OVERLINE_STYLE,
+ XML_TEXT_OVERLINE_WIDTH,
+ XML_TEXT_OVERLINE_COLOR,
+ XML_TEXT_OVERLINE_MODE,
+
+ XML_TEXT_LINE_THROUGH_STYLE,
+ XML_TEXT_LINE_THROUGH_TYPE,
+ XML_TEXT_LINE_THROUGH_WIDTH,
+ XML_TEXT_LINE_THROUGH_TEXT,
+
+ XML_LEADER_STYLE,
+ XML_LEADER_TEXT,
+
+ XML_BOLD_DOTTED,
+ XML_BOLD_DASH,
+ XML_BOLD_LONG_DASH,
+ XML_BOLD_DOT_DASH,
+ XML_BOLD_DOT_DOT_DASH,
+ XML_BOLD_WAVE,
+ XML_DOUBLE_WAVE,
+ XML_DOUBLE_LINE,
+ XML_THICK_LINE,
+ XML_SINGLE_LINE,
+ XML_SLASH,
+ XML_TEXT_LINE_THROUGH_COLOR,
+ XML_TEXT_LINE_THROUGH_TEXT_STYLE,
+ XML_LEADER_COLOR,
+ XML_LEADER_TYPE,
+ XML_LEADER_WIDTH,
+ XML_LEADER_TEXT_STYLE,
+
+ XML_OPACITY,
+ XML_OPACITY_NAME,
+ XML_SHADOW_OPACITY,
+ XML_ALWAYS,
+ XML_COUNT_IN_TEXT_BOXES,
+
+ XML_NP_OOO,
+ XML_N_OOO,
+ XML_NP_OOOW,
+ XML_N_OOOW,
+ XML_NP_OOOC,
+ XML_N_OOOC,
+ XML_NP_DOM,
+ XML_N_DOM,
+
+ XML_EVENT_LISTENERS,
+ XML_EVENT_LISTENER,
+
+ XML_FORM,
+ XML_VOID,
+ XML_PROPERTY,
+ XML_PROPERTY_NAME,
+ XML_LIST_PROPERTY,
+ XML_LIST_VALUE,
+ XML_COLUMN_STYLE_NAME,
+
+ XML_TEXTAREA,
+ XML_FIXED_TEXT,
+ XML_FILE,
+ XML_FORMATTED_TEXT,
+ XML_BUTTON,
+ XML_CHECKBOX,
+ XML_RADIO,
+ XML_LISTBOX,
+ XML_COMBOBOX,
+ XML_IMAGE_FRAME,
+ XML_VALUE_RANGE,
+ XML_GENERIC_CONTROL,
+ XML_SERVICE_NAME,
+ XML_PROPERTY_TYPE,
+ XML_INTEGER,
+ XML_PROPERTY_IS_VOID,
+ XML_PROPERTY_IS_LIST,
+ XML_PROPERTY_VALUE,
+ XML_MIMETYPE,
+ XML_DATABASE_ROW_SELECT,
+ XML_CONTROL_IMPLEMENTATION,
+ XML_INTERPOLATION,
+ XML_CUBIC_SPLINE,
+ XML_B_SPLINE,
+ XML_STEP_START,
+ XML_STEP_END,
+ XML_STEP_CENTER_X,
+ XML_STEP_CENTER_Y,
+ XML_GNM_STEP_START,
+ XML_GNM_STEP_END,
+ XML_GNM_STEP_CENTER_X,
+ XML_GNM_STEP_CENTER_Y,
+ XML_N_DB_OASIS,
+
+ XML_SHOW_FILTER_BUTTON,
+ XML_DRILL_DOWN_ON_DOUBLE_CLICK,
+ XML_HEADER_GRID_LAYOUT,
+ XML_GROUPED_BY,
+ XML_DAYS,
+ XML_MONTHS,
+ XML_QUARTERS,
+ XML_YEARS,
+ XML_DATE_START,
+ XML_DATE_END,
+ XML_STEP,
+ XML_DATA_PILOT_GROUPS,
+ XML_DATA_PILOT_GROUP,
+ XML_DATA_PILOT_GROUP_MEMBER,
+
+ XML_JAPANESE_CANDLE_STICK,
+ XML_NAMED_SYMBOL,
+ XML_DIAMOND,
+ XML_ARROW_DOWN,
+ XML_ARROW_UP,
+ XML_ARROW_RIGHT,
+ XML_ARROW_LEFT,
+ XML_BOW_TIE,
+ XML_HOURGLASS,
+ XML_SYMBOL_NAME,
+ XML_SYMBOL_TYPE,
+ XML_IMAGE_OPACITY, // #i25616#
+
+ XML_DEFAULT_OUTLINE_LEVEL,
+ XML_SHOW_DETAILS,
+ XML_SHOW_EMPTY,
+ XML_REPEAT_ITEM_LABELS,
+ XML_ITERATIVE,
+ XML_uX,
+ XML_NP_DLG,
+ XML_N_DLG,
+ XML_SCRIPT_DATA,
+ XML_LIBRARIES,
+ XML_SOURCE_CODE,
+ XML_READONLY,
+
+ XML_Z,
+ XML_DIMENSION,
+ XML_VALIDATION_NAME,
+
+ XML_SCREEN,
+ XML_PRINTER,
+
+ // XForms tokens
+ // already defined: XML_ACTION, XML_VERSION, XML_ENCODING,
+ // XML_REPLACE, XML_SEPARATOR, XML_TYPE, XML_ID
+ XML_MODEL,
+ XML_SCHEMA,
+ XML_BIND,
+ XML_INSTANCE,
+ XML_SUBMISSION,
+ XML_REF,
+ XML_SRC,
+ XML_METHOD,
+ XML_NODESET,
+ XML_INDENT,
+ XML_OMIT_XML_DECLARATION,
+ XML_STANDALONE,
+ XML_CDATA_SECTION_ELEMENTS,
+ XML_REQUIRED,
+ XML_RELEVANT,
+ XML_CALCULATE,
+ XML_CONSTRAINT,
+ XML_MAXOCCURS, // maxOccurs
+ XML_MINOCCURS, // minOccurs
+ XML_P3PTYPE,
+ XML_MEDIATYPE,
+ XML_INCLUDENAMESPACEPREFIXES,
+
+ // XForms/XSD Schema; these tokens use innerWordCapitalization
+ // (already defined: XML_SCHEMA, XML_LENGTH, XML_ID)
+ XML_BASE,
+ XML_TARGETNAMESPACE, // targetNamespace
+ XML_SIMPLETYPE, // simpleType
+ XML_RESTRICTION,
+ XML_MAXLENGTH, // maxLength
+ XML_MINLENGTH, // minLength
+ XML_MININCLUSIVE, // minInclusive
+ XML_MINEXCLUSIVE, // minExclusive
+ XML_MAXINCLUSIVE, // maxInclusive
+ XML_MAXEXCLUSIVE, // maxExclusive
+ XML_PATTERN,
+ XML_ENUMERATION,
+ XML_WHITESPACE, // whiteSpace
+ XML_TOTALDIGITS, // totalDigits
+ XML_FRACTIONDIGITS, // fractionDigits
+ XML_PRESERVE,
+ XML_ANYURI, // anyURI
+ XML_DATETIME_XSD, // dateTime
+ XML_MAIN_ETRY, // #i28755#
+
+ // SMIL
+ XML_REMOVE,
+ XML_HOLD,
+ XML_TRANSITION,
+ XML_INHERIT,
+ XML_FILLDEFAULT,
+ XML_RESTART,
+ XML_RESTARTDEFAULT,
+ XML_WHENNOTACTIVE,
+ XML_NEVER,
+ XML_ACCELERATE,
+ XML_DECELERATE,
+ XML_AUTOREVERSE,
+ XML_INDEFINITE,
+ XML_REPEATCOUNT,
+ XML_REPEATDUR,
+ XML_ENDSYNC,
+ XML_FIRST,
+ XML_LAST,
+ XML_MEDIA,
+ XML_DUR,
+ XML_BEGIN,
+ XML_WHOLE,
+ XML_FROM,
+ XML_TO,
+ XML_BY,
+ XML_VALUES,
+ XML_KEYTIMES,
+ XML_KEYSPLINES,
+ XML_CALCMODE,
+ XML_DISCRETE,
+ XML_PACED,
+ XML_SPLINE,
+ XML_ACCUMULATE,
+ XML_ADDITIVE,
+ XML_MULTIPLY,
+ XML_ANIMATE,
+ XML_ANIMATEMOTION,
+ XML_ANIMATEPHYSICS,
+ XML_ANIMATETRANSFORM,
+ XML_ANIMATECOLOR,
+ XML_TRANSITIONFILTER,
+ XML_ATTRIBUTENAME,
+
+ XML_NP_SMIL,
+ XML_N_SMIL,
+
+ XML_NP_ANIMATION,
+ XML_N_ANIMATION,
+ XML_N_ANIMATION_OOO,
+
+ XML_PAR,
+ XML_SEQ,
+
+ XML_TRANSLATE,
+ XML_SKEWX,
+ XML_SKEWY,
+
+ XML_AUDIO,
+
+ XML_COLOR_INTERPOLATION,
+ XML_COLOR_INTERPOLATION_DIRECTION,
+ XML_HSL,
+ XML_RGB,
+
+ XML_BARWIPE,
+ XML_BOXWIPE,
+ XML_FOURBOXWIPE,
+ XML_BARNDOORWIPE,
+ XML_DIAGONALWIPE,
+ XML_BOWTIEWIPE,
+ XML_MISCDIAGONALWIPE,
+ XML_VEEWIPE,
+ XML_BARNVEEWIPE,
+ XML_ZIGZAGWIPE,
+ XML_BARNZIGZAGWIPE,
+ XML_IRISWIPE,
+ XML_TRIANGLEWIPE,
+ XML_ARROWHEADWIPE,
+ XML_PENTAGONWIPE,
+ XML_HEXAGONWIPE,
+ XML_ELLIPSEWIPE,
+ XML_EYEWIPE,
+ XML_ROUNDRECTWIPE,
+ XML_STARWIPE,
+ XML_MISCSHAPEWIPE,
+ XML_CLOCKWIPE,
+ XML_PINWHEELWIPE,
+ XML_SINGLESWEEPWIPE,
+ XML_FANWIPE,
+ XML_DOUBLEFANWIPE,
+ XML_DOUBLESWEEPWIPE,
+ XML_SALOONDOORWIPE,
+ XML_WINDSHIELDWIPE,
+ XML_SNAKEWIPE,
+ XML_SPIRALWIPE,
+ XML_PARALLELSNAKESWIPE,
+ XML_BOXSNAKESWIPE,
+ XML_WATERFALLWIPE,
+ XML_PUSHWIPE,
+ XML_SLIDEWIPE,
+ XML_BLINDSWIPE,
+ XML_RANDOMBARWIPE,
+ XML_CHECKERBOARDWIPE,
+ XML_ZOOM,
+
+ XML_LEFTTORIGHT,
+ XML_TOPTOBOTTOM,
+ XML_TOPLEFT,
+ XML_TOPRIGHT,
+ XML_BOTTOMRIGHT,
+ XML_BOTTOMLEFT,
+ XML_TOPCENTER,
+ XML_RIGHTCENTER,
+ XML_BOTTOMCENTER,
+ XML_LEFTCENTER,
+ XML_CORNERSIN,
+ XML_CORNERSOUT,
+ XML_DIAGONALBOTTOMLEFT,
+ XML_DIAGONALTOPLEFT,
+ XML_DOUBLEBARNDOOR,
+ XML_DOUBLEDIAMOND,
+ XML_FOURPOINT,
+ XML_FIVEPOINT,
+ XML_SIXPOINT,
+ XML_HEART,
+ XML_KEYHOLE,
+ XML_CLOCKWISETWELVE,
+ XML_CLOCKWISETHREE,
+ XML_CLOCKWISESIX,
+ XML_CLOCKWISENINE,
+ XML_TWOBLADEVERTICAL,
+ XML_TWOBLADEHORIZONTAL,
+ XML_FOURBLADE,
+ XML_CLOCKWISETOP,
+ XML_CLOCKWISERIGHT,
+ XML_CLOCKWISEBOTTOM,
+ XML_CLOCKWISELEFT,
+ XML_CLOCKWISETOPLEFT,
+ XML_COUNTERCLOCKWISEBOTTOMLEFT,
+ XML_CLOCKWISEBOTTOMRIGHT,
+ XML_COUNTERCLOCKWISETOPRIGHT,
+ XML_CENTERTOP,
+ XML_CENTERRIGHT,
+ XML_FANOUTVERTICAL,
+ XML_FANOUTHORIZONTAL,
+ XML_FANINVERTICAL,
+ XML_FANINHORIZONTAL,
+ XML_PARALLELVERTICAL,
+ XML_PARALLELDIAGONAL,
+ XML_OPPOSITEVERTICAL,
+ XML_OPPOSITEHORIZONTAL,
+ XML_PARALLELDIAGONALTOPLEFT,
+ XML_PARALLELDIAGONALBOTTOMLEFT,
+ XML_TOPLEFTHORIZONTAL,
+ XML_TOPLEFTDIAGONAL,
+ XML_TOPLEFTVERTICAL,
+ XML_TOPRIGHTDIAGONAL,
+ XML_BOTTOMRIGHTDIAGONAL,
+ XML_BOTTOMLEFTDIAGONAL,
+ XML_TOPLEFTCLOCKWISE,
+ XML_TOPRIGHTCLOCKWISE,
+ XML_BOTTOMRIGHTCLOCKWISE,
+ XML_BOTTOMLEFTCLOCKWISE,
+ XML_TOPLEFTCOUNTERCLOCKWISE,
+ XML_TOPRIGHTCOUNTERCLOCKWISE,
+ XML_BOTTOMRIGHTCOUNTERCLOCKWISE,
+ XML_BOTTOMLEFTCOUNTERCLOCKWISE,
+ XML_VERTICALTOPSAME,
+ XML_VERTICALBOTTOMSAME,
+ XML_VERTICALTOPLEFTOPPOSITE,
+ XML_VERTICALBOTTOMLEFTOPPOSITE,
+ XML_HORIZONTALLEFTSAME,
+ XML_HORIZONTALRIGHTSAME,
+ XML_HORIZONTALTOPLEFTOPPOSITE,
+ XML_HORIZONTALTOPRIGHTOPPOSITE,
+ XML_DIAGONALBOTTOMLEFTOPPOSITE,
+ XML_DIAGONALTOPLEFTOPPOSITE,
+ XML_TWOBOXTOP,
+ XML_TWOBOXBOTTOM,
+ XML_TWOBOXLEFT,
+ XML_TWOBOXRIGHT,
+ XML_FOURBOXVERTICAL,
+ XML_FOURBOXHORIZONTAL,
+ XML_VERTICALLEFT,
+ XML_VERTICALRIGHT,
+ XML_HORIZONTALLEFT,
+ XML_HORIZONTALRIGHT,
+ XML_FROMLEFT,
+ XML_FROMTOP,
+ XML_FROMRIGHT,
+ XML_FROMBOTTOM,
+ XML_CROSSFADE,
+ XML_FADETOCOLOR,
+ XML_FADEFROMCOLOR,
+ XML_FADEOVERCOLOR,
+ XML_THREEBLADE,
+ XML_EIGHTBLADE,
+ XML_ONEBLADE,
+ XML_ACROSS,
+ XML_COMBHORIZONTAL,
+ XML_COMBVERTICAL,
+ XML_ROTATEIN,
+ XML_ROTATEOUT,
+ XML_FROMTOPLEFT,
+ XML_FROMTOPRIGHT,
+ XML_FROMBOTTOMLEFT,
+ XML_FROMBOTTOMRIGHT,
+
+ XML_SUBTYPE,
+ XML_OUT,
+
+ XML_FORWARD,
+ XML_REVERSE,
+
+ XML_FADECOLOR,
+
+ XML_ONBEGIN,
+ XML_ONEND,
+ XML_CLICK,
+ XML_DOUBLECLICK,
+ XML_MOUSEOVER,
+ XML_MOUSEOUT,
+
+ XML_NODE_TYPE,
+ XML_PRESET_ID,
+ XML_PRESET_SUB_TYPE,
+ XML_PRESET_CLASS,
+ XML_PRESET_PROPERTY,
+ XML_CUSTOM,
+ XML_ENTRANCE,
+ XML_EXIT,
+ XML_EMPHASIS,
+ XML_MOTION_PATH,
+ XML_OLE_ACTION,
+ XML_MEDIA_CALL,
+ XML_ON_CLICK,
+ XML_WITH_PREVIOUS,
+ XML_AFTER_PREVIOUS,
+ XML_MAIN_SEQUENCE,
+ XML_TIMING_ROOT,
+ XML_INTERACTIVE_SEQUENCE,
+
+ XML_SUB_ITEM,
+ XML_ITERATE_TYPE,
+ XML_ITERATE_INTERVAL,
+ XML_ITERATE,
+ XML_BY_PARAGRAPH,
+ XML_BY_WORD,
+ XML_BY_LETTER,
+
+ XML_AFTER_EFFECT,
+ XML_MASTER,
+
+ XML_GROUP_ID,
+ XML_TARGETELEMENT,
+ XML_TOGGLE_PAUSE,
+ XML_MASTER_ELEMENT,
+ XML_STOP_AUDIO,
+
+ XML_AUDIO_LEVEL,
+
+ XML_URN_OASIS_NAMES_TC,
+ XML_OPENDOCUMENT,
+ XML_1_0,
+
+ XML_IS_LIST_HEADER,
+ XML_N_SVG_COMPAT,
+ XML_N_FO_COMPAT,
+ XML_N_SMIL_COMPAT,
+ XML_N_SMIL_OLD,
+ XML_XFORMS_SUBMISSION,
+ XML_XFORMS_LIST_SOURCE,
+
+ XML_URI_W3_PREFIX,
+ XML_URI_XFORMS_SUFFIX,
+
+ // XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
+ // are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD. (#i49139#)
+ XML_HORIZONTAL_ON_EVEN,
+ XML_N_RPT_OASIS,
+ XML_N_RPT,
+ XML_GROUP,
+ XML_GROUPS ,
+ XML_REPORT_HEADER,
+ XML_PAGE_HEADER ,
+ XML_DETAIL ,
+ XML_PAGE_FOOTER ,
+ XML_REPORT_FOOTER,
+ XML_START_NEW_COLUMN ,
+ XML_RESET_PAGE_NUMBER ,
+ XML_PRINT_HEADER_ON_EACH_PAGE ,
+ XML_SORT_EXPRESSION ,
+ XML_GROUP_EXPRESSION ,
+ XML_GROUP_HEADER ,
+ XML_GROUP_FOOTER ,
+ XML_HEADER_ON_NEW_PAGE,
+ XML_FOOTER_ON_NEW_PAGE,
+ XML_PAGE_PRINT_OPTION,
+ XML_PRE_EVALUATED,
+ XML_COMMAND_TYPE,
+ XML_MASTER_FIELDS,
+ XML_DETAIL_FIELDS,
+ XML_CONDITIONAL_PRINT_EXPRESSION,
+ XML_REPORT_COMPONENT,
+ XML_PRINT_REPEATED_VALUES,
+ XML_REPEAT_SECTION,
+ XML_FORCE_NEW_COLUMN,
+ XML_GROUP_ON,
+ XML_FORCE_NEW_PAGE,
+ XML_GROUP_INTERVAL,
+ XML_PRINT_WHEN_GROUP_CHANGE,
+ XML_REPORT_ELEMENT,
+ XML_LIST_SOURCE,
+ XML_LIST_SOURCE_TYPE,
+ XML_IMAGE_DATA,
+ XML_SELECTED,
+ XML_CURRENT_STATE,
+ XML_IS_TRISTATE,
+ XML_ALL_PAGES,
+ XML_NOT_WITH_REPORT_HEADER,
+ XML_NOT_WITH_REPORT_FOOTER,
+ XML_NOT_WITH_REPORT_HEADER_NOR_FOOTER,
+ XML_BEFORE_SECTION,
+ XML_AFTER_SECTION,
+ XML_BEFORE_AFTER_SECTION,
+ XML_PREFIX_CHARACTERS,
+ XML_QUARTAL,
+ XML_WEEK,
+ XML_WHOLE_GROUP,
+ XML_WITH_FIRST_DETAIL,
+ XML_TOP_DOWN,
+ XML_BOTTOM_UP,
+ XML_HOUR,
+ XML_MINUTE,
+ XML_NP_RPT,
+ XML_FORMAT_CONDITION,
+ XML_EXPRESSION1,
+ XML_EXPRESSION2,
+ XML_EQUAL,
+ XML_NOT_EQUAL,
+ XML_LESS,
+ XML_GREATER,
+ XML_LESS_EQUAL,
+ XML_GREATER_EQUAL,
+ XML_BETWEEN,
+ XML_NOT_BETWEEN,
+ XML_TABLE_TEMPLATE,
+ XML_FIRST_ROW,
+ XML_LAST_ROW,
+ XML_FIRST_COLUMN,
+ XML_LAST_COLUMN,
+ XML_EVEN_ROWS,
+ XML_ODD_ROWS,
+ XML_EVEN_COLUMNS,
+ XML_ODD_COLUMNS,
+ // table styles
+ XML_FIRST_ROW_EVEN_COLUMN,
+ XML_LAST_ROW_EVEN_COLUMN,
+ XML_FIRST_ROW_END_COLUMN,
+ XML_FIRST_ROW_START_COLUMN,
+ XML_LAST_ROW_END_COLUMN,
+ XML_LAST_ROW_START_COLUMN,
+
+ XML_HORIZONTAL_ON_ODD,
+ // Password error from 1.4 to 2.0 Beta (#i45874#)
+ XML_RESTART_NUMBERING,
+ // OpenDocument <text:numbered-paragraph> element not supported on OpenDocument import (#i52127#)
+ XML_NUMBERED_PARAGRAPH,
+ XML_MASTER_DETAIL_FIELDS,
+ XML_MASTER_DETAIL_FIELD,
+ XML_SUB_DOCUMENT,
+ XML_FIXED_CONTENT,
+ XML_INITIAL_FORMULA,
+ XML_DEEP_TRAVERSING,
+ XML_PRESERVE_IRI,
+ XML_SORT_BY_X_VALUES,
+ XML_PAGE_CONTINUATION,
+ XML_RIGHT_ANGLED_AXES,
+ XML_SOFT_PAGE_BREAK,
+ XML_USE_SOFT_PAGE_BREAKS,
+ XML_PERCENTAGE_DATA_STYLE_NAME,
+ XML_VALUE_AND_PERCENTAGE,
+ XML_GROUP_BARS_PER_AXIS,
+ XML_INCLUDE_HIDDEN_CELLS,
+ XML_AUTOMATIC_POSITION,
+ XML_AUTOMATIC_SIZE,
+ XML_REVERSE_DIRECTION,
+ XML_LABEL_SEPARATOR,
+ XML_LABEL_POSITION,
+ XML_AVOID_OVERLAP,
+ XML_NEAR_ORIGIN,
+ XML_DEPENDENCY,
+ XML_NAV_ORDER,
+
+ XML_USE_FIRST_ROW_STYLES,
+ XML_USE_LAST_ROW_STYLES,
+ XML_USE_FIRST_COLUMN_STYLES,
+ XML_USE_LAST_COLUMN_STYLES,
+ XML_USE_BANDING_ROWS_STYLES,
+ XML_USE_BANDING_COLUMNS_STYLES,
+
+ XML_AUTOMATIC_CONTENT,
+ XML_DISPLAY_R_SQUARE,
+ XML_DISPLAY_EQUATION,
+ // db odf 12
+ XML_TABLE_REPRESENTATIONS,
+ XML_TABLE_REPRESENTATION,
+ XML_SCHEMA_DEFINITION,
+ XML_CONNECTION_DATA,
+ XML_DATABASE_DESCRIPTION,
+ XML_COMPOUND_DATABASE,
+ XML_FILE_BASED_DATABASE,
+ XML_SERVER_DATABASE,
+ XML_MEDIA_TYPE,
+ XML_HOSTNAME,
+ XML_PORT,
+ XML_LOCAL_SOCKET,
+ XML_USE_SYSTEM_USER,
+ XML_DRIVER_SETTINGS,
+ XML_JAVA_CLASSPATH,
+ XML_CHARACTER_SET,
+ XML_APPLICATION_CONNECTION_SETTINGS,
+ XML_TABLE_INCLUDE_FILTER,
+ XML_DEFAULT_ROW_STYLE_NAME,
+ XML_ANGLE_OFFSET,
+ // Core implementation for direct cross-references (#i81002#)
+ XML_NUMBER_NO_SUPERIOR,
+ XML_NUMBER_ALL_SUPERIOR,
+ XML_LIST_LEVEL_POSITION_AND_SPACE_MODE,
+ XML_LABEL_WIDTH_AND_POSITION,
+ XML_LABEL_ALIGNMENT,
+ XML_LIST_LEVEL_LABEL_ALIGNMENT,
+ XML_LABEL_FOLLOWED_BY,
+ XML_LISTTAB,
+ XML_SPACE,
+ XML_NOTHING,
+ XML_LIST_TAB_STOP_POSITION,
+ XML_STANDARD_ERROR,
+ XML_CELL_RANGE,
+ XML_ERROR_LOWER_RANGE,
+ XML_ERROR_UPPER_RANGE,
+
+ XML_CONTINUE_LIST,
+ XML_STYLE_OVERRIDE,
+
+ // fs: #i90243#
+ XML_XFORM_MODEL_SETTINGS,
+
+ // ODF 1.2 metadata
+ XML_META_FIELD,
+ XML_ABOUT,
+ XML_DATATYPE,
+ XML_TRANSFORMATION,
+
+ // ODF 1.2 numbered-paragraph
+ XML_LIST_ID,
+
+ XML_TREAT_EMPTY_CELLS,
+ XML_LEAVE_GAP,
+ XML_USE_ZERO,
+ XML_IGNORE,
+
+ // enhanced fields
+ XML_FIELDMARK,
+ XML_FIELDMARK_START,
+ XML_FIELDMARK_SEPARATOR,
+ XML_FIELDMARK_END,
+
+ XML_IMAGE_SCALE,
+ XML_ISOTROPIC,
+ XML_ANISOTROPIC,
+
+ XML_AXIS_POSITION,
+ XML_AXIS_LABEL_POSITION,
+ XML_NEAR_AXIS,
+ XML_NEAR_AXIS_OTHER_SIDE,
+ XML_OUTSIDE_START,
+ XML_OUTSIDE_END,
+ XML_TICK_MARK_POSITION,
+ XML_AT_LABELS,
+ XML_AT_AXIS,
+ XML_AT_LABELS_AND_AXIS,
+ XML_FILLED_RADAR,
+ XML_SURFACE,
+
+ // MathML only
+ XML_MATHVARIANT,
+ XML_MATHSIZE,
+ XML_MATHWEIGHT,
+ XML_MATHCOLOR,
+
+ XML_CONTAINS,
+ XML_DOES_NOT_CONTAIN,
+ XML_BEGINS_WITH,
+ XML_DOES_NOT_BEGIN_WITH,
+ XML_ENDS_WITH,
+ XML_DOES_NOT_END_WITH,
+
+ //chart
+ XML_NP_CHART_EXT,
+ XML_N_CHART_EXT,
+ XML_COORDINATE_REGION,
+
+ XML_DIAGONAL_BL_TR_WIDTHS,
+ XML_DIAGONAL_TL_BR_WIDTHS,
+
+ XML_OUTSIDE_MINIMUM,//#i114142#
+ XML_OUTSIDE_MAXIMUM,//#i114142#
+
+ XML_LEGEND_EXPANSION, //#i28760#
+ XML_LEGEND_EXPANSION_ASPECT_RATIO, //#i28760#
+ XML_BALANCED, //#i28760#
+ XML_HIGH, //#i28760#
+ XML_WIDE, //#i28760#
+
+ XML_AXIS_TYPE, //#i25706#
+ XML_DATE_SCALE,
+ XML_BASE_TIME_UNIT,
+ XML_MAJOR_INTERVAL_VALUE,
+ XML_MINOR_INTERVAL_VALUE,
+ XML_MAJOR_INTERVAL_UNIT,
+ XML_MINOR_INTERVAL_UNIT,
+
+ XML_MIN_VALUE,
+ XML_MAX_VALUE,
+
+ XML_MARGIN, // #i117001#
+
+ XML_PROPERTY_MAPPING,
+ XML_PROVIDER,
+ XML_DATA_MAPPINGS,
+ XML_DATA_MAPPING,
+ XML_DATA_FREQUENCY,
+ XML_DATA_TRANSFORMATIONS,
+ XML_COLUMN_REMOVE_TRANSFORMATION,
+ XML_COLUMN_SPLIT_TRANSFORMATION,
+ XML_COLUMN_MERGE_TRANSFORMATION,
+ XML_COLUMN_SORT_TRANSFORMATION,
+ XML_COLUMN_TEXT_TRANSFORMATION,
+ XML_COLUMN_AGGREGATE_TRANSFORMATION,
+ XML_COLUMN_NUMBER_TRANSFORMATION,
+ XML_SORT_PARAM,
+ XML_MERGE_STRING,
+ XML_TRIM,
+ XML_ROUND_UP,
+ XML_ROUND_DOWN,
+ XML_LOG_10,
+ XML_SQUARE,
+ XML_SQUARE_ROOT,
+ XML_EVEN,
+ XML_ODD,
+ XML_SIGN,
+ XML_REPLACE_STRING,
+ XML_COLUMN_REPLACENULL_TRANSFORMATION,
+ XML_COLUMN_DATETIME_TRANSFORMATION,
+ XML_START_OF_YEAR,
+ XML_END_OF_YEAR,
+ XML_MONTH_NAME,
+ XML_START_OF_MONTH,
+ XML_END_OF_MONTH,
+ XML_DAY_OF_YEAR,
+ XML_START_OF_QUARTER,
+ XML_END_OF_QUARTER,
+
+ //Already defined XML_SEPARATOR,
+
+ // regina, ODF1.2 additional symbols in charts
+ XML_STAR,
+ XML_ASTERISK,
+ XML_HORIZONTAL_BAR,
+ XML_VERTICAL_BAR,
+
+ XML_ERROR_STANDARD_WEIGHT, // errorbar standard deviation error weight
+
+ // erAck: 2013-07-02 BCP 47 language tags
+ XML_RFC_LANGUAGE_TAG,
+ XML_RFC_LANGUAGE_TAG_ASIAN,
+ XML_RFC_LANGUAGE_TAG_COMPLEX,
+ // Chart data table properties
+ XML_DATA_TABLE_SHOW_HORZ_BORDER,
+ XML_DATA_TABLE_SHOW_VERT_BORDER,
+ XML_DATA_TABLE_SHOW_OUTLINE,
+ // Chart Display units properties
+ XML_CHART_DUNITS_DISPLAYUNITS,
+ XML_CHART_DUNITS_BUILTINUNIT,
+ XML_EXTERNALDATA,
+
+ XML_EXPONENT_INTERVAL,
+ XML_FORCED_EXPONENT_SIGN,
+ XML_MIN_DECIMAL_PLACES,
+ XML_MAX_DENOMINATOR_VALUE,
+ XML_MAX_NUMERATOR_DIGITS,
+ XML_ZEROS_NUMERATOR_DIGITS,
+ XML_ZEROS_DENOMINATOR_DIGITS,
+ XML_INTEGER_FRACTION_DELIMITER,
+
+ // tdf#115319
+ XML_REFERENCE_LANGUAGE,
+
+ XML_NEWLINE,
+
+ XML_CREATOR_INITIALS,
+
+ // tdf#115007
+ XML_TRANSLITERATION_SPELLOUT,
+
+ XML_RESOLVED,
+
+ XML_PAGE_CONTENT_TOP,
+
+ XML_PAGE_CONTENT_BOTTOM,
+ XML_MARGIN_GUTTER,
+
+ XML_LOCAL_URL,
+
+ // Math ml
+ XML_DIR,
+ XML_DISPLAYSTYLE,
+ XML_INFINITY,
+ XML_LSPACE,
+ XML_MATHBACKGROUND,
+ XML_MAXSIZE,
+ XML_MINSIZE,
+ XML_MOVABLELIMITS,
+ XML_RSPACE,
+ XML_RTL,
+ XML_SYMMETRIC,
+
+ XML_LINKED_STYLE_NAME,
+
+ XML_THEME,
+ XML_THEME_COLOR,
+ XML_FILL_THEME_COLOR,
+ XML_DK1,
+ XML_LT1,
+ XML_DK2,
+ XML_LT2,
+ XML_ACCENT1,
+ XML_ACCENT2,
+ XML_ACCENT3,
+ XML_ACCENT4,
+ XML_ACCENT5,
+ XML_ACCENT6,
+ XML_HLINK,
+ XML_FOLHLINK,
+ XML_COLOR_LUM_MOD,
+ XML_COLOR_LUM_OFF,
+ XML_FILL_COLOR_LUM_MOD,
+ XML_FILL_COLOR_LUM_OFF,
+
+ XML_CONTENT_CONTROL,
+ XML_SHOWING_PLACE_HOLDER,
+ XML_CHECKED_STATE,
+ XML_UNCHECKED_STATE,
+ XML_DISPLAY_TEXT,
+ XML_PICTURE,
+ XML_DATE_FORMAT,
+ XML_DATE_RFC_LANGUAGE_TAG,
+
+ XML_FILL_USE_SLIDE_BACKGROUND,
+
+ XML_TOKEN_END
+ };
+
+
+ /// return the OUString representation for eToken
+ XMLOFF_DLLPUBLIC const OUString& GetXMLToken(
+ enum XMLTokenEnum eToken );
+
+ /// compare eToken to the string
+ XMLOFF_DLLPUBLIC bool IsXMLToken(
+ std::u16string_view rString,
+ enum XMLTokenEnum eToken );
+
+ /// compare eToken to the string
+ bool IsXMLToken(
+ std::string_view rString,
+ enum XMLTokenEnum eToken );
+
+ XMLOFF_DLLPUBLIC bool IsXMLToken(
+ const sax_fastparser::FastAttributeList::FastAttributeIter& aIter,
+ enum XMLTokenEnum eToken );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmltypes.hxx b/include/xmloff/xmltypes.hxx
new file mode 100644
index 000000000..13e7c3fcc
--- /dev/null
+++ b/include/xmloff/xmltypes.hxx
@@ -0,0 +1,301 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLTYPES_HXX
+#define INCLUDED_XMLOFF_XMLTYPES_HXX
+
+
+// Flags to specify how to im/export the property
+
+// OLD:
+// 8421.8421.8421.8421.8421.8421.8421.8421
+// n n m mmmd m baaa tttt.tttt.tttt
+// spsp eep paef e ppp tttt.tttt.tttt
+// iiee iei ieie i ppp tttt.tttt.tttt
+// NOW:
+// n n mm mmdm pp ppba aatt.tttt.tttt
+// spsp eepp aefe p pptt.tttt.tttt
+// iiee ieii eiei p pptt.tttt.tttt
+
+#define MID_FLAG_MASK 0x00003fff
+
+// Import only: In general, properties may not throw exception, but
+// this one may. If it throws an IllegalArgumentException, it will be
+// silently ignored. This should be used for properties whose values
+// cannot be checked. (E.g., the printer paper tray: The tray names
+// are different for all printers, and we don't know ahead whether a
+// printer supports the trays in the current document.)
+#define MID_FLAG_PROPERTY_MAY_THROW 0x00100000
+
+// Export only: When exporting defaults, export this property even if it is
+// not set
+#define MID_FLAG_DEFAULT_ITEM_EXPORT 0x00200000
+
+// Import and Export: The property in question must exist. No call to
+// hasPropertyByName is required.
+#define MID_FLAG_MUST_EXIST 0x00400000
+
+// Export only: If an xml attribute with the same name has been exported
+// already, supply its value to the exportXML call and delete the existing
+// attribute afterwards.
+#define MID_FLAG_MERGE_ATTRIBUTE 0x00800000
+
+// Import only: If a property with the same name has been set already, supply
+// the current value to the importXML call.
+#define MID_FLAG_MERGE_PROPERTY 0x01000000
+
+// Import only: there are more entries for the same xml attribute existing
+#define MID_FLAG_MULTI_PROPERTY 0x02000000
+
+// the map entry denotes the name of an element item
+#define MID_FLAG_ELEMENT_ITEM_EXPORT 0x04000000
+#define MID_FLAG_ELEMENT_ITEM_IMPORT 0x08000000
+
+#define MID_FLAG_ELEMENT_ITEM 0x0c000000 // both import and export
+
+// the property is ignored
+#define MID_FLAG_NO_PROPERTY_EXPORT 0x10000000
+
+// the attribute is ignored (not yet implemented)
+#define MID_FLAG_NO_PROPERTY_IMPORT 0x40000000
+
+#define MID_FLAG_NO_PROPERTY 0x50000000 // both import and export
+
+// Import only: the xml attribute's value is evaluated by a call to
+// handleSpecialItem instead of calling the property handler's importXML method
+#define MID_FLAG_SPECIAL_ITEM_IMPORT 0x80000000
+
+// Export only: the property's value is exported by a call to handleSpecialItem
+// instead of calling the property handler's exportXML method
+#define MID_FLAG_SPECIAL_ITEM_EXPORT 0x20000000
+#define MID_FLAG_SPECIAL_ITEM 0xa0000000 // both import and export
+
+
+#define XML_TYPE_PROP_SHIFT 14
+#define XML_TYPE_PROP_MASK (0xf << XML_TYPE_PROP_SHIFT)
+
+#define XML_TYPE_PROP_START (0x1 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_GRAPHIC (0x1 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_DRAWING_PAGE (0x2 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_PAGE_LAYOUT (0x3 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_HEADER_FOOTER (0x4 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_TEXT (0x5 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_PARAGRAPH (0x6 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_RUBY (0x7 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_SECTION (0x8 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_TABLE (0x9 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_TABLE_COLUMN (0xa << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_TABLE_ROW (0xb << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_TABLE_CELL (0xc << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_LIST_LEVEL (0xd << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_CHART (0xe << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_END (0xf << XML_TYPE_PROP_SHIFT)
+
+#define XML_TYPE_APP_SHIFT 10
+
+#define XML_SC_TYPES_START (0x1 << XML_TYPE_APP_SHIFT)
+#define XML_SD_TYPES_START (0x2 << XML_TYPE_APP_SHIFT)
+#define XML_TEXT_TYPES_START (0x3 << XML_TYPE_APP_SHIFT)
+#define XML_SCH_TYPES_START (0x4 << XML_TYPE_APP_SHIFT)
+#define XML_PM_TYPES_START (0x5 << XML_TYPE_APP_SHIFT) // page master
+#define XML_DB_TYPES_START (0x6 << XML_TYPE_APP_SHIFT)
+
+// XML-data-type-ID's
+
+// simple types, no special compare necessary
+#define XML_TYPE_BUILDIN_CMP 0x00002000
+
+// basic types (all also XML_TYPE_BUILDIN_CMP)
+#define XML_TYPE_BOOL 0x00002001 // true/false
+#define XML_TYPE_MEASURE 0x00002002 // 1cm
+#define XML_TYPE_MEASURE8 0x00002003 // 1cm
+#define XML_TYPE_MEASURE16 0x00002004 // 1cm
+#define XML_TYPE_PERCENT 0x00002005 // 50%
+#define XML_TYPE_PERCENT8 0x00002006 // 50%
+#define XML_TYPE_PERCENT16 0x00002007 // 50%
+#define XML_TYPE_STRING 0x00002008 // "blablabla"
+#define XML_TYPE_COLOR 0x00002009 // Colors
+#define XML_TYPE_NUMBER 0x0000200a // 123
+#define XML_TYPE_NUMBER8 0x0000200b // 123
+#define XML_TYPE_NUMBER16 0x0000200c // 123
+#define XML_TYPE_NUMBER_NONE 0x0000200d // 123 and "no-limit" for 0
+#define XML_TYPE_DOUBLE 0x0000200e // for doubles
+#define XML_TYPE_NBOOL 0x0000200f // !true/false
+#define XML_TYPE_COLORTRANSPARENT 0x00002010 // Colors or "transparent"
+#define XML_TYPE_ISTRANSPARENT 0x00002011 // "transparent"
+#define XML_TYPE_BUILDIN_CMP_ONLY 0x00002012 // Only buildin comparison is required, so no handler exists
+#define XML_TYPE_NUMBER8_NONE 0x00002013 // 123 and "no-limit" for 0
+#define XML_TYPE_NUMBER16_NONE 0x00002014 // 123 and "no-limit" for 0
+#define XML_TYPE_COLOR_MODE 0x00002015
+#define XML_TYPE_DURATION16_MS 0x00002016 // PT00H00M01S to ms in sal_Int16
+#define XML_TYPE_MEASURE_PX 0x00002017 // 1px
+#define XML_TYPE_COLORAUTO 0x00002018 // color if not -1
+#define XML_TYPE_ISAUTOCOLOR 0x00002019 // true if -1
+#define XML_TYPE_STYLENAME 0x00002020 // "blablabla"
+#define XML_TYPE_NEG_PERCENT 0x00002021 // (100-x)%
+#define XML_TYPE_NEG_PERCENT8 0x00002022 // (100-x)%
+#define XML_TYPE_NEG_PERCENT16 0x00002023 // (100-x)
+#define XML_TYPE_DOUBLE_PERCENT 0x00002024 // 50% (source is a double from 0.0 to 1.0)
+#define XML_TYPE_HEX 0x00002025 // 00544F1B
+#define XML_TYPE_PERCENT100 0x00002026 // 100th percent
+
+// special basic types
+#define XML_TYPE_RECTANGLE_LEFT 0x00000100 // the Left member of an awt::Rectangle as a measure
+#define XML_TYPE_RECTANGLE_TOP 0x00000101 // the Top member of an awt::Rectangle as a measure
+#define XML_TYPE_RECTANGLE_WIDTH 0x00000102 // the Width member of an awt::Rectangle as a measure
+#define XML_TYPE_RECTANGLE_HEIGHT 0x00000103 // the Height member of an awt::Rectangle as a measure
+
+#define XML_TYPE_TEXT_CROSSEDOUT_STYLE (XML_TEXT_TYPES_START + 0)
+#define XML_TYPE_TEXT_CASEMAP (XML_TEXT_TYPES_START + 1)
+#define XML_TYPE_TEXT_FONTFAMILYNAME (XML_TEXT_TYPES_START + 2)
+#define XML_TYPE_TEXT_FONTFAMILY (XML_TEXT_TYPES_START + 3)
+#define XML_TYPE_TEXT_FONTENCODING (XML_TEXT_TYPES_START + 4)
+#define XML_TYPE_TEXT_FONTPITCH (XML_TEXT_TYPES_START + 5)
+#define XML_TYPE_TEXT_KERNING (XML_TEXT_TYPES_START + 6)
+#define XML_TYPE_TEXT_POSTURE (XML_TEXT_TYPES_START + 7)
+#define XML_TYPE_TEXT_SHADOWED (XML_TEXT_TYPES_START + 8)
+#define XML_TYPE_TEXT_UNDERLINE_STYLE (XML_TEXT_TYPES_START + 9)
+#define XML_TYPE_TEXT_WEIGHT (XML_TEXT_TYPES_START + 10)
+#define XML_TYPE_TEXT_SPLIT (XML_TEXT_TYPES_START + 11)
+#define XML_TYPE_TEXT_BREAKBEFORE (XML_TEXT_TYPES_START + 12)
+#define XML_TYPE_TEXT_BREAKAFTER (XML_TEXT_TYPES_START + 13)
+#define XML_TYPE_TEXT_SHADOW (XML_TEXT_TYPES_START + 14)
+#define XML_TYPE_TEXT_ADJUST (XML_TEXT_TYPES_START + 15)
+#define XML_TYPE_TEXT_ADJUSTLAST (XML_TEXT_TYPES_START + 16)
+#define XML_TYPE_TEXT_CASEMAP_VAR (XML_TEXT_TYPES_START + 17)
+#define XML_TYPE_TEXT_ESCAPEMENT (XML_TEXT_TYPES_START + 18)
+#define XML_TYPE_TEXT_ESCAPEMENT_HEIGHT (XML_TEXT_TYPES_START + 19)
+#define XML_TYPE_CHAR_HEIGHT (XML_TEXT_TYPES_START + 20)
+#define XML_TYPE_CHAR_HEIGHT_PROP (XML_TEXT_TYPES_START + 21)
+#define XML_TYPE_CHAR_LANGUAGE (XML_TEXT_TYPES_START + 22)
+#define XML_TYPE_CHAR_COUNTRY (XML_TEXT_TYPES_START + 23)
+#define XML_TYPE_LINE_SPACE_FIXED (XML_TEXT_TYPES_START + 24)
+#define XML_TYPE_LINE_SPACE_MINIMUM (XML_TEXT_TYPES_START + 25)
+#define XML_TYPE_LINE_SPACE_DISTANCE (XML_TEXT_TYPES_START + 26)
+#define XML_TYPE_BORDER (XML_TEXT_TYPES_START + 27)
+#define XML_TYPE_BORDER_WIDTH (XML_TEXT_TYPES_START + 28)
+#define XML_TYPE_TEXT_DROPCAP (XML_TEXT_TYPES_START + 29)
+#define XML_TYPE_TEXT_TABSTOP (XML_TEXT_TYPES_START + 30)
+#define XML_TYPE_TEXT_BOOLCROSSEDOUT (XML_TEXT_TYPES_START + 31)
+#define XML_TYPE_TEXT_WRAP (XML_TEXT_TYPES_START + 32)
+#define XML_TYPE_TEXT_PARAGRAPH_ONLY (XML_TEXT_TYPES_START + 33)
+#define XML_TYPE_TEXT_WRAP_OUTSIDE (XML_TEXT_TYPES_START + 34)
+#define XML_TYPE_TEXT_OPAQUE (XML_TEXT_TYPES_START + 35)
+#define XML_TYPE_TEXT_PROTECT_CONTENT (XML_TEXT_TYPES_START + 36)
+#define XML_TYPE_TEXT_PROTECT_SIZE (XML_TEXT_TYPES_START + 37)
+#define XML_TYPE_TEXT_PROTECT_POSITION (XML_TEXT_TYPES_START + 38)
+#define XML_TYPE_TEXT_ANCHOR_TYPE (XML_TEXT_TYPES_START + 39)
+#define XML_TYPE_TEXT_COLUMNS (XML_TEXT_TYPES_START + 40)
+#define XML_TYPE_TEXT_HORIZONTAL_POS (XML_TEXT_TYPES_START + 41)
+#define XML_TYPE_TEXT_HORIZONTAL_POS_MIRRORED (XML_TEXT_TYPES_START + 42)
+#define XML_TYPE_TEXT_HORIZONTAL_REL (XML_TEXT_TYPES_START + 43)
+#define XML_TYPE_TEXT_HORIZONTAL_REL_FRAME (XML_TEXT_TYPES_START + 44)
+#define XML_TYPE_TEXT_HORIZONTAL_MIRROR (XML_TEXT_TYPES_START + 45)
+#define XML_TYPE_TEXT_VERTICAL_POS (XML_TEXT_TYPES_START + 46)
+#define XML_TYPE_TEXT_VERTICAL_REL (XML_TEXT_TYPES_START + 47)
+#define XML_TYPE_TEXT_VERTICAL_REL_PAGE (XML_TEXT_TYPES_START + 48)
+#define XML_TYPE_TEXT_VERTICAL_REL_FRAME (XML_TEXT_TYPES_START + 49)
+#define XML_TYPE_TEXT_VERTICAL_REL_AS_CHAR (XML_TEXT_TYPES_START + 50)
+#define XML_TYPE_TEXT_MIRROR_VERTICAL (XML_TEXT_TYPES_START + 51)
+#define XML_TYPE_TEXT_MIRROR_HORIZONTAL_LEFT (XML_TEXT_TYPES_START + 52)
+#define XML_TYPE_TEXT_MIRROR_HORIZONTAL_RIGHT (XML_TEXT_TYPES_START + 53)
+#define XML_TYPE_TEXT_CLIP11 (XML_TEXT_TYPES_START + 54)
+#define XML_TYPE_ATTRIBUTE_CONTAINER (XML_TEXT_TYPES_START + 55 )
+#define XML_TYPE_CHAR_HEIGHT_DIFF (XML_TEXT_TYPES_START + 56)
+#define XML_TYPE_TEXT_EMPHASIZE (XML_TEXT_TYPES_START + 57)
+#define XML_TYPE_TEXT_COMBINE (XML_TEXT_TYPES_START + 58)
+#define XML_TYPE_TEXT_COMBINECHAR (XML_TEXT_TYPES_START + 59)
+#define XML_TYPE_TEXT_UNDERLINE_COLOR (XML_TEXT_TYPES_START + 60)
+#define XML_TYPE_TEXT_UNDERLINE_HASCOLOR (XML_TEXT_TYPES_START + 61)
+#define XML_TYPE_TEXT_AUTOSPACE (XML_TEXT_TYPES_START + 62)
+#define XML_TYPE_TEXT_PUNCTUATION_WRAP (XML_TEXT_TYPES_START + 63)
+#define XML_TYPE_TEXT_LINE_BREAK (XML_TEXT_TYPES_START + 64)
+
+#define XML_TYPE_TEXT_ALIGN (XML_TEXT_TYPES_START + 65)
+#define XML_TYPE_FONT_WIDTH (XML_TEXT_TYPES_START + 66)
+#define XML_TYPE_ROTATION_ANGLE (XML_TEXT_TYPES_START + 67)
+#define XML_TYPE_CONTROL_BORDER (XML_TEXT_TYPES_START + 68)
+#define XML_TYPE_TEXT_REL_WIDTH_HEIGHT (XML_TEXT_TYPES_START + 69)
+#define XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT (XML_TEXT_TYPES_START + 70)
+#define XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT_MIN (XML_TEXT_TYPES_START + 71)
+#define XML_TYPE_TEXT_COMBINE_CHARACTERS (XML_TEXT_TYPES_START + 72)
+#define XML_TYPE_TEXT_ANIMATION (XML_TEXT_TYPES_START + 73)
+#define XML_TYPE_TEXT_ANIMATION_DIRECTION (XML_TEXT_TYPES_START + 74)
+#define XML_TYPE_TEXT_HORIZONTAL_ADJUST (XML_TEXT_TYPES_START + 75)
+#define XML_TYPE_TEXT_RUBY_ADJUST (XML_TEXT_TYPES_START + 76)
+#define XML_TYPE_TEXT_FONT_RELIEF (XML_TEXT_TYPES_START + 77)
+#define XML_TYPE_TEXT_ROTATION_ANGLE (XML_TEXT_TYPES_START + 78)
+#define XML_TYPE_TEXT_ROTATION_SCALE (XML_TEXT_TYPES_START + 79)
+#define XML_TYPE_TEXT_VERTICAL_ALIGN (XML_TEXT_TYPES_START + 80)
+#define XML_TYPE_TEXT_DRAW_ASPECT (XML_TEXT_TYPES_START + 81)
+#define XML_TYPE_CONTROL_TEXT_EMPHASIZE (XML_TEXT_TYPES_START + 82)
+#define XML_TYPE_TEXT_RUBY_POSITION (XML_TEXT_TYPES_START + 83)
+#define XML_TYPE_TEXT_VERTICAL_POS_AT_CHAR (XML_TEXT_TYPES_START + 84)
+#define XML_TYPE_TEXT_WRITING_MODE (XML_TEXT_TYPES_START + 85)
+#define XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT (XML_TEXT_TYPES_START + 86)
+#define XML_TYPE_LAYOUT_GRID_MODE (XML_TEXT_TYPES_START + 87)
+#define XML_TYPE_TEXT_HIDDEN_AS_DISPLAY (XML_TEXT_TYPES_START + 88)
+#define XML_TYPE_CONTROL_BORDER_COLOR (XML_TEXT_TYPES_START + 89)
+#define XML_TYPE_BORDER_MODEL (XML_TEXT_TYPES_START + 90)
+#define XML_TYPE_TEXT_LINE_MODE (XML_TEXT_TYPES_START + 91)
+#define XML_TYPE_TEXT_UNDERLINE_TYPE (XML_TEXT_TYPES_START + 92)
+#define XML_TYPE_TEXT_UNDERLINE_WIDTH (XML_TEXT_TYPES_START + 93)
+#define XML_TYPE_TEXT_CROSSEDOUT_TYPE (XML_TEXT_TYPES_START + 94)
+#define XML_TYPE_TEXT_CROSSEDOUT_WIDTH (XML_TEXT_TYPES_START + 95)
+#define XML_TYPE_TEXT_CROSSEDOUT_TEXT (XML_TEXT_TYPES_START + 96)
+#define XML_TYPE_TEXT_KEEP (XML_TEXT_TYPES_START + 97)
+#define XML_TYPE_TEXT_NKEEP (XML_TEXT_TYPES_START + 98)
+#define XML_TYPE_WRAP_INFLUENCE_ON_POSITION (XML_TEXT_TYPES_START + 99)
+#define XML_TYPE_WRAP_OPTION (XML_TEXT_TYPES_START + 100)
+#define XML_TYPE_TEXT_NUMBER8_ONE_BASED (XML_TEXT_TYPES_START + 101)
+#define XML_TYPE_NUMBER_NO_ZERO (XML_TEXT_TYPES_START + 102)
+#define XML_TYPE_NUMBER8_NO_ZERO (XML_TEXT_TYPES_START + 103)
+#define XML_TYPE_NUMBER16_NO_ZERO (XML_TEXT_TYPES_START + 104)
+#define XML_TYPE_NUMBER16_AUTO (XML_TEXT_TYPES_START + 105)
+#define XML_TYPE_TEXT_SOFT_PAGE_BREAK (XML_TEXT_TYPES_START + 106)
+#define XML_TYPE_TEXT_USE_SOFT_PAGE_BREAKS (XML_TEXT_TYPES_START + 107)
+#define XML_TYPE_TEXT_CLIP (XML_TEXT_TYPES_START + 108)
+#define XML_TYPE_TEXT_OVERLINE_TYPE (XML_TEXT_TYPES_START + 109)
+#define XML_TYPE_TEXT_OVERLINE_STYLE (XML_TEXT_TYPES_START + 110)
+#define XML_TYPE_TEXT_OVERLINE_WIDTH (XML_TEXT_TYPES_START + 111)
+#define XML_TYPE_TEXT_OVERLINE_COLOR (XML_TEXT_TYPES_START + 112)
+#define XML_TYPE_TEXT_OVERLINE_HASCOLOR (XML_TEXT_TYPES_START + 113)
+#define XML_TYPE_BOOL_FALSE (XML_TEXT_TYPES_START + 114)
+
+#define XML_TYPE_CHAR_SCRIPT (XML_TEXT_TYPES_START + 116)
+#define XML_TYPE_CHAR_RFC_LANGUAGE_TAG (XML_TEXT_TYPES_START + 117)
+#define XML_TYPE_VERTICAL_ALIGN (XML_TEXT_TYPES_START + 118)
+
+#define XML_SW_TYPE_FILLSTYLE (XML_TEXT_TYPES_START + 119)
+#define XML_SW_TYPE_FILLBITMAPSIZE (XML_TEXT_TYPES_START + 120)
+#define XML_SW_TYPE_LOGICAL_SIZE (XML_TEXT_TYPES_START + 121)
+#define XML_SW_TYPE_BITMAP_REFPOINT (XML_TEXT_TYPES_START + 122)
+#define XML_SW_TYPE_BITMAP_MODE (XML_TEXT_TYPES_START + 123)
+#define XML_SW_TYPE_BITMAPREPOFFSETX (XML_TEXT_TYPES_START + 124)
+#define XML_SW_TYPE_BITMAPREPOFFSETY (XML_TEXT_TYPES_START + 125)
+
+#define XML_TYPE_TEXT_RUBY_IS_ABOVE (XML_TEXT_TYPES_START + 126)
+#define XML_TYPE_GRAPHIC (XML_TEXT_TYPES_START + 127)
+#define XML_SW_TYPE_PRESPAGE_BACKSIZE (XML_TEXT_TYPES_START + 128)
+#define XML_SW_TYPE_RTLGUTTER (XML_TEXT_TYPES_START + 129)
+#define XML_TYPE_THEME_COLOR (XML_TEXT_TYPES_START + 130)
+
+#endif // INCLUDED_XMLOFF_XMLTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmluconv.hxx b/include/xmloff/xmluconv.hxx
new file mode 100644
index 000000000..9af400344
--- /dev/null
+++ b/include/xmloff/xmluconv.hxx
@@ -0,0 +1,330 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_XMLOFF_XMLUCONV_HXX
+#define INCLUDED_XMLOFF_XMLUCONV_HXX
+
+#include <sal/config.h>
+#include <xmloff/dllapi.h>
+#include <sal/types.h>
+
+#include <memory>
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <unotools/saveopt.hxx>
+
+#include <tools/fldunit.hxx>
+
+namespace com::sun::star {
+ namespace text { class XNumberingTypeInfo; }
+}
+
+namespace basegfx
+{
+ class B3DVector;
+}
+
+namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::drawing { struct Position3D; }
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::uno { template <class E> class Sequence; }
+namespace com::sun::star::util { struct Date; }
+template <typename EnumT> struct SvXMLEnumMapEntry;
+template <typename EnumT> struct SvXMLEnumStringMapEntry;
+
+class XMLOFF_DLLPUBLIC SvXMLTokenEnumerator
+{
+private:
+ std::u16string_view maTokenString;
+ size_t mnNextTokenPos;
+ sal_Unicode mcSeparator;
+
+public:
+ SvXMLTokenEnumerator( std::u16string_view rString, sal_Unicode cSeparator = u' ' );
+ /** just so no-one accidentally passes a temporary to this, and ends up with this class
+ * accessing the temporary after the temporary has been deleted. */
+ SvXMLTokenEnumerator( OUString&& , sal_Unicode cSeparator = u' ' ) = delete;
+
+ bool getNextToken( std::u16string_view& rToken );
+};
+
+/** the SvXMLTypeConverter converts values of various types from
+ their internal representation to the textual form used in xml
+ and back.
+ Most of the methods are static but the SvXMLTypeConverter can
+ also store default units for both numerical and textual measures.
+
+ @attention:
+ a lot of the methods here have been moved to <sax/tools/converter.hxx>!
+*/
+
+class XMLOFF_DLLPUBLIC SvXMLUnitConverter final
+{
+private:
+ SvXMLUnitConverter(const SvXMLUnitConverter&) = delete;
+ SvXMLUnitConverter& operator=(const SvXMLUnitConverter&) = delete;
+
+ struct SAL_DLLPRIVATE Impl;
+ ::std::unique_ptr<Impl> m_pImpl;
+
+public:
+ /** constructs a SvXMLUnitConverter. The core measure unit is the
+ default unit for numerical measures, the XML measure unit is
+ the default unit for textual measures */
+ SvXMLUnitConverter(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ sal_Int16 eCoreMeasureUnit /*css::util::MeasureUnit*/,
+ sal_Int16 eXMLMeasureUnit /*css::util::MeasureUnit*/,
+ SvtSaveOptions::ODFSaneDefaultVersion const nODFVersion);
+
+ ~SvXMLUnitConverter();
+
+ static sal_Int16 GetMeasureUnit(FieldUnit const nFieldUnit);
+
+ /** sets the default unit for numerical measures */
+ void SetCoreMeasureUnit( sal_Int16 const eCoreMeasureUnit /*css::util::MeasureUnit*/);
+
+ /** sets the default unit for textual measures */
+ void SetXMLMeasureUnit( sal_Int16 const eXMLMeasureUnit /*css::util::MeasureUnit*/);
+
+ /** gets the default unit for textual measures */
+ sal_Int16 GetXMLMeasureUnit() const;
+
+ /// ODF version, only when exporting
+ SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const;
+ void overrideSaneDefaultVersion(SvtSaveOptions::ODFSaneDefaultVersion const);
+
+ /** gets XNumberingTypeInfo */
+ const css::uno::Reference< css::text::XNumberingTypeInfo >& getNumTypeInfo() const;
+
+ /** convert string to measure with meCoreMeasureUnit,
+ using optional min and max values*/
+ bool convertMeasureToCore( sal_Int32& rValue,
+ std::u16string_view rString,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32) const;
+
+ /** convert string to measure with meCoreMeasureUnit,
+ using optional min and max values*/
+ bool convertMeasureToCore( sal_Int32& rValue,
+ std::string_view rString,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32) const;
+
+ /** convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit */
+ void convertMeasureToXML( OUStringBuffer& rBuffer,
+ sal_Int32 nMeasure ) const;
+
+ /** convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit */
+ OUString convertMeasureToXML( sal_Int32 nMeasure ) const;
+
+ /** convert string to enum using given enum map, if the enum is
+ not found in the map, this method will return false */
+ template<typename EnumT>
+ static bool convertEnum( EnumT& rEnum,
+ std::u16string_view rValue,
+ const SvXMLEnumMapEntry<EnumT> *pMap )
+ {
+ sal_uInt16 nTmp;
+ bool bRet = convertEnumImpl(nTmp, rValue,
+ reinterpret_cast<const SvXMLEnumMapEntry<sal_uInt16>*>(pMap));
+ if (bRet)
+ rEnum = static_cast<EnumT>(nTmp);
+ return bRet;
+ }
+
+ /** convert string to enum using given enum map, if the enum is
+ not found in the map, this method will return false */
+ template<typename EnumT>
+ static bool convertEnum( EnumT& rEnum,
+ std::string_view rValue,
+ const SvXMLEnumMapEntry<EnumT> *pMap )
+ {
+ sal_uInt16 nTmp;
+ bool bRet = convertEnumImpl(nTmp, rValue,
+ reinterpret_cast<const SvXMLEnumMapEntry<sal_uInt16>*>(pMap));
+ if (bRet)
+ rEnum = static_cast<EnumT>(nTmp);
+ return bRet;
+ }
+
+ /** convert string to enum using given token map, if the enum is
+ not found in the map, this method will return false */
+ template<typename EnumT>
+ static bool convertEnum( EnumT& rEnum,
+ std::u16string_view rValue,
+ const SvXMLEnumStringMapEntry<EnumT> *pMap )
+ {
+ sal_uInt16 nTmp;
+ bool bRet = convertEnumImpl(nTmp, rValue,
+ reinterpret_cast<const SvXMLEnumStringMapEntry<sal_uInt16>*>(pMap));
+ if (bRet)
+ rEnum = static_cast<EnumT>(nTmp);
+ return bRet;
+ }
+
+ /** convert string to enum using given token map, if the enum is
+ not found in the map, this method will return false */
+ template<typename EnumT>
+ static bool convertEnum( EnumT& rEnum,
+ std::string_view rValue,
+ const SvXMLEnumStringMapEntry<EnumT> *pMap )
+ {
+ sal_uInt16 nTmp;
+ bool bRet = convertEnumImpl(nTmp, rValue,
+ reinterpret_cast<const SvXMLEnumStringMapEntry<sal_uInt16>*>(pMap));
+ if (bRet)
+ rEnum = static_cast<EnumT>(nTmp);
+ return bRet;
+ }
+
+ /** convert enum to string using given enum map with an optional
+ default token. If the enum is not found in the map,
+ this method will either use the given default or return
+ false if not default is set */
+ template<typename EnumT>
+ static bool convertEnum( OUStringBuffer& rBuffer,
+ EnumT nValue,
+ const SvXMLEnumMapEntry<EnumT> *pMap,
+ enum ::xmloff::token::XMLTokenEnum eDefault =
+ ::xmloff::token::XML_TOKEN_INVALID )
+ {
+ return convertEnumImpl(rBuffer, static_cast<sal_uInt16>(nValue),
+ reinterpret_cast<const SvXMLEnumMapEntry<sal_uInt16>*>(pMap), eDefault);
+ }
+
+ /** convert double number to string (using ::rtl::math) and DO
+ convert to export MapUnit using meCoreMeasureUnit/meXMLMeasureUnit */
+ void convertDouble(OUStringBuffer& rBuffer,
+ double fNumber) const;
+
+ /** convert string to double number (using ::rtl::math) and DO convert. */
+ bool convertDouble(double& rValue, std::u16string_view rString) const;
+
+ /** convert string to double number (using ::rtl::math) and DO convert. */
+ bool convertDouble(double& rValue, std::string_view rString) const;
+
+ /** get the Null Date of the XModel and set it to the UnitConverter */
+ bool setNullDate (
+ const css::uno::Reference <css::frame::XModel>& xModel);
+
+ /** convert double to ISO Date Time String */
+ void convertDateTime( OUStringBuffer& rBuffer,
+ const double& fDateTime,
+ bool const bAddTimeIf0AM = false);
+
+ /** convert ISO Date Time String to double */
+ bool convertDateTime(double& fDateTime,
+ std::u16string_view rString) const;
+
+ /** convert ISO Date Time String to double */
+ bool convertDateTime(double& fDateTime,
+ std::string_view rString) const;
+
+ /// these 2 functions use tools Date, so they're not yet moved to sax
+
+ /** convert double to ISO Date Time String */
+ static void convertDateTime( OUStringBuffer& rBuffer,
+ const double& fDateTime,
+ const css::util::Date& aNullDate,
+ bool bAddTimeIf0AM = false);
+ /** convert ISO Date Time String to double */
+ static bool convertDateTime( double& fDateTime,
+ std::u16string_view rString,
+ const css::util::Date& aNullDate);
+ /** convert ISO Date Time String to double */
+ static bool convertDateTime( double& fDateTime,
+ std::string_view rString,
+ const css::util::Date& aNullDate);
+
+ /** convert string to ::basegfx::B3DVector */
+ static bool convertB3DVector( ::basegfx::B3DVector& rVector,
+ std::string_view rValue );
+
+ /** convert B3DVector to string */
+ static void convertB3DVector( OUStringBuffer &rBuffer,
+ const ::basegfx::B3DVector& rVector );
+
+ /** convert string to Position3D */
+ bool convertPosition3D( css::drawing::Position3D& rPosition,
+ std::string_view rValue ) const;
+
+ /** convert Position3D to string */
+ void convertPosition3D( OUStringBuffer &rBuffer,
+ const css::drawing::Position3D& rVector );
+
+
+ /** convert num-format and num-letter-sync values to NumberingType */
+ bool convertNumFormat( sal_Int16& rType,
+ const OUString& rNumFormat,
+ std::u16string_view rNumLetterSync,
+ bool bNumberNone = false ) const;
+
+ /** convert NumberingType to num-format and num-letter-sync values */
+ void convertNumFormat( OUStringBuffer& rBuffer,
+ sal_Int16 nType ) const;
+ static void convertNumLetterSync( OUStringBuffer& rBuffer,
+ sal_Int16 nType );
+
+ static void convertPropertySet(css::uno::Sequence<css::beans::PropertyValue>& rProps,
+ const css::uno::Reference<css::beans::XPropertySet>& aProperties);
+ static void convertPropertySet(css::uno::Reference<css::beans::XPropertySet> const & rProperties,
+ const css::uno::Sequence<css::beans::PropertyValue>& aProps);
+
+ OUString encodeStyleName( const OUString& rName,
+ bool *pEncoded=nullptr ) const;
+ /** convert string (hex) to number (sal_uInt32) */
+ static bool convertHex( sal_uInt32& nVal,
+ std::u16string_view rValue );
+
+ /** convert number (sal_uInt32) to string (hex) */
+ static void convertHex( OUStringBuffer& rBuffer,
+ sal_uInt32 nVal );
+
+private:
+ static bool convertEnumImpl( sal_uInt16& rEnum,
+ std::u16string_view rValue,
+ const SvXMLEnumMapEntry<sal_uInt16> *pMap );
+
+ static bool convertEnumImpl( sal_uInt16& rEnum,
+ std::u16string_view rValue,
+ const SvXMLEnumStringMapEntry<sal_uInt16> *pMap );
+
+ static bool convertEnumImpl( sal_uInt16& rEnum,
+ std::string_view rValue,
+ const SvXMLEnumMapEntry<sal_uInt16> *pMap );
+
+ static bool convertEnumImpl( sal_uInt16& rEnum,
+ std::string_view rValue,
+ const SvXMLEnumStringMapEntry<sal_uInt16> *pMap );
+
+ static bool convertEnumImpl( OUStringBuffer& rBuffer,
+ sal_uInt16 nValue,
+ const SvXMLEnumMapEntry<sal_uInt16> *pMap,
+ enum ::xmloff::token::XMLTokenEnum eDefault );
+};
+
+#endif // INCLUDED_XMLOFF_XMLUCONV_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmlreader/README b/include/xmlreader/README
new file mode 100644
index 000000000..41b43e7e8
--- /dev/null
+++ b/include/xmlreader/README
@@ -0,0 +1,28 @@
+#**************************************************************
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#**************************************************************
+
+<http://qa.openoffice.org/issues/show_bug.cgi?id=115203>: "Issue 113189
+extracted xmlreader from configmgr, to make the former available within URE.
+The xmlreader library is for now considered a private part of URE (cf.
+ure/source/README), for simplicity uses OOO_DLLPUBLIC_XMLREADER-based symbol
+visibility (and thus no symbol versioning), but is of course used from outside
+URE in configmgr. This works as long as its ABI does not change. If it ever
+changes, symbol versioning will have to be added (in some form or other)."
diff --git a/include/xmlreader/detail/xmlreaderdllapi.hxx b/include/xmlreader/detail/xmlreaderdllapi.hxx
new file mode 100644
index 000000000..10708b71e
--- /dev/null
+++ b/include/xmlreader/detail/xmlreaderdllapi.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+#if defined OOO_DLLIMPLEMENTATION_XMLREADER
+#define OOO_DLLPUBLIC_XMLREADER SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_XMLREADER SAL_DLLPUBLIC_IMPORT
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmlreader/pad.hxx b/include/xmlreader/pad.hxx
new file mode 100644
index 000000000..2c4b0f4c1
--- /dev/null
+++ b/include/xmlreader/pad.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <cstddef>
+
+#include <rtl/strbuf.hxx>
+#include <sal/types.h>
+#include <xmlreader/detail/xmlreaderdllapi.hxx>
+#include <xmlreader/span.hxx>
+
+namespace xmlreader
+{
+class SAL_WARN_UNUSED OOO_DLLPUBLIC_XMLREADER Pad
+{
+public:
+ void add(char const* begin, sal_Int32 length);
+
+ template <std::size_t N> void add(char const (&literal)[N]) { add(literal, N - 1); }
+
+ SAL_DLLPRIVATE void addEphemeral(char const* begin, sal_Int32 length);
+
+ void clear();
+
+ Span get() const;
+
+private:
+ SAL_DLLPRIVATE void flushSpan();
+
+ Span span_;
+ OStringBuffer buffer_{ 256 };
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmlreader/span.hxx b/include/xmlreader/span.hxx
new file mode 100644
index 000000000..4d1455cd3
--- /dev/null
+++ b/include/xmlreader/span.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <cstddef>
+#include <cstring>
+
+#include <sal/types.h>
+#include <xmlreader/detail/xmlreaderdllapi.hxx>
+
+namespace rtl { class OUString; }
+
+namespace xmlreader {
+
+struct SAL_WARN_UNUSED OOO_DLLPUBLIC_XMLREADER Span {
+ char const * begin;
+ sal_Int32 length;
+
+ Span(): begin(nullptr), length(0) {}
+ // init length to avoid compiler warnings
+
+ Span(char const * theBegin, sal_Int32 theLength):
+ begin(theBegin), length(theLength) {}
+
+ template< std::size_t N > explicit Span(char const (& literal)[N]):
+ begin(literal), length(N - 1)
+ {}
+
+ void clear() noexcept { begin = nullptr; }
+
+ bool is() const { return begin != nullptr; }
+
+ bool operator==(Span const & text) const {
+ return length == text.length
+ && std::memcmp(begin, text.begin, text.length) == 0;
+ }
+
+ bool operator!=(Span const & text) const {
+ return !(operator==(text));
+ }
+
+ bool equals(char const * textBegin, sal_Int32 textLength) const {
+ return operator==(Span(textBegin, textLength));
+ }
+
+ template< std::size_t N > bool operator==(char const (& literal)[N])
+ const
+ {
+ return operator==(Span(literal, N - 1));
+ }
+
+ template< std::size_t N > bool operator!=(char const (& literal)[N])
+ const
+ {
+ return operator!=(Span(literal, N - 1));
+ }
+
+ rtl::OUString convertFromUtf8() const;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmlreader/xmlreader.hxx b/include/xmlreader/xmlreader.hxx
new file mode 100644
index 000000000..e55e5d2ca
--- /dev/null
+++ b/include/xmlreader/xmlreader.hxx
@@ -0,0 +1,186 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <stack>
+#include <vector>
+
+#include <osl/file.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <xmlreader/detail/xmlreaderdllapi.hxx>
+#include <xmlreader/pad.hxx>
+#include <xmlreader/span.hxx>
+
+namespace xmlreader {
+
+class OOO_DLLPUBLIC_XMLREADER XmlReader {
+public:
+ explicit XmlReader(OUString const & fileUrl);
+
+ ~XmlReader();
+
+ enum { NAMESPACE_NONE = -2, NAMESPACE_UNKNOWN = -1, NAMESPACE_XML = 0 };
+
+ enum class Text { NONE, Raw, Normalized };
+
+ enum class Result { Begin, End, Text, Done };
+
+ int registerNamespaceIri(Span const & iri);
+
+ // RESULT_BEGIN: data = localName, ns = ns
+ // RESULT_END: data, ns unused
+ // RESULT_TEXT: data = text, ns unused
+ Result nextItem(Text reportText, Span * data, int * nsId);
+
+ bool nextAttribute(int * nsId, Span * localName);
+
+ // the span returned by getAttributeValue is only valid until the next call
+ // to nextItem or getAttributeValue
+ Span getAttributeValue(bool fullyNormalize);
+
+ int getNamespaceId(Span const & prefix) const;
+
+ const OUString& getUrl() const { return fileUrl_;}
+
+private:
+ XmlReader(const XmlReader&) = delete;
+ XmlReader& operator=(const XmlReader&) = delete;
+
+ typedef std::vector< Span > NamespaceIris;
+
+ // If NamespaceData (and similarly ElementData and AttributeData) is made
+ // SAL_DLLPRIVATE, at least gcc 4.2.3 erroneously warns about
+ // "'xmlreader::XmlReader' declared with greater visibility than the type of
+ // its field 'xmlreader::XmlReader::namespaces_'" (and similarly for
+ // elements_ and attributes_):
+
+ struct NamespaceData {
+ Span prefix;
+ int nsId;
+
+ NamespaceData():
+ nsId(-1) {}
+
+ NamespaceData(Span const & thePrefix, int theNsId):
+ prefix(thePrefix), nsId(theNsId) {}
+ };
+
+ typedef std::vector< NamespaceData > NamespaceList;
+
+ struct ElementData {
+ Span name;
+ NamespaceList::size_type inheritedNamespaces;
+ int defaultNamespaceId;
+
+ ElementData(
+ Span const & theName,
+ NamespaceList::size_type theInheritedNamespaces,
+ int theDefaultNamespaceId):
+ name(theName), inheritedNamespaces(theInheritedNamespaces),
+ defaultNamespaceId(theDefaultNamespaceId)
+ {}
+ };
+
+ typedef std::stack< ElementData > ElementStack;
+
+ struct AttributeData {
+ char const * nameBegin;
+ char const * nameEnd;
+ char const * nameColon;
+ char const * valueBegin;
+ char const * valueEnd;
+
+ AttributeData(
+ char const * theNameBegin, char const * theNameEnd,
+ char const * theNameColon, char const * theValueBegin,
+ char const * theValueEnd):
+ nameBegin(theNameBegin), nameEnd(theNameEnd),
+ nameColon(theNameColon), valueBegin(theValueBegin),
+ valueEnd(theValueEnd)
+ {}
+ };
+
+ typedef std::vector< AttributeData > Attributes;
+
+ enum class State { Content, StartTag, EndTag, EmptyElementTag, Done };
+
+ SAL_DLLPRIVATE char read() { return pos_ == end_ ? '\0' : *pos_++; }
+
+ SAL_DLLPRIVATE char peek() const { return pos_ == end_ ? '\0' : *pos_; }
+
+ SAL_DLLPRIVATE void normalizeLineEnds(Span const & text);
+
+ SAL_DLLPRIVATE void skipSpace();
+
+ SAL_DLLPRIVATE bool skipComment();
+
+ SAL_DLLPRIVATE void skipProcessingInstruction();
+
+ SAL_DLLPRIVATE void skipDocumentTypeDeclaration();
+
+ SAL_DLLPRIVATE Span scanCdataSection();
+
+ SAL_DLLPRIVATE bool scanName(char const ** nameColon);
+
+ SAL_DLLPRIVATE int scanNamespaceIri(
+ char const * begin, char const * end);
+
+ SAL_DLLPRIVATE char const * handleReference(
+ char const * position, char const * end);
+
+ SAL_DLLPRIVATE Span handleAttributeValue(
+ char const * begin, char const * end, bool fullyNormalize);
+
+ SAL_DLLPRIVATE Result handleStartTag(int * nsId, Span * localName);
+
+ SAL_DLLPRIVATE Result handleEndTag();
+
+ SAL_DLLPRIVATE void handleElementEnd();
+
+ SAL_DLLPRIVATE Result handleSkippedText(Span * data, int * nsId);
+
+ SAL_DLLPRIVATE Result handleRawText(Span * text);
+
+ SAL_DLLPRIVATE Result handleNormalizedText(Span * text);
+
+ SAL_DLLPRIVATE static int toNamespaceId(NamespaceIris::size_type pos);
+
+ OUString const fileUrl_;
+ oslFileHandle fileHandle_;
+ sal_uInt64 fileSize_;
+ void * fileAddress_;
+ NamespaceIris namespaceIris_;
+ NamespaceList namespaces_;
+ ElementStack elements_;
+ char const * pos_;
+ char const * end_;
+ State state_;
+ Attributes attributes_;
+ Attributes::iterator currentAttribute_;
+ bool firstAttribute_;
+ Pad pad_;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmlscript/xml_helper.hxx b/include/xmlscript/xml_helper.hxx
new file mode 100644
index 000000000..4baed88da
--- /dev/null
+++ b/include/xmlscript/xml_helper.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <vector>
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+
+#include <xmlscript/xmlscriptdllapi.h>
+
+namespace com::sun::star::xml::sax { class XDocumentHandler; }
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::io { class XOutputStream; }
+
+namespace xmlscript
+{
+
+/*##################################################################################################
+
+ EXPORTING
+
+##################################################################################################*/
+
+
+class XMLElement
+ : public cppu::WeakImplHelper< css::xml::sax::XAttributeList >
+{
+public:
+ XMLElement( OUString const & name )
+ : _name( name )
+ {}
+
+ /** Adds a sub element of element.
+
+ @param xElem element reference
+ */
+ void addSubElement(
+ css::uno::Reference< css::xml::sax::XAttributeList > const & xElem );
+
+ /** Gets sub element of given index. The index follows order in which sub elements were added.
+
+ @param nIndex index of sub element
+ */
+ css::uno::Reference< css::xml::sax::XAttributeList > const & getSubElement( sal_Int32 nIndex );
+
+ /** Adds an attribute to elements.
+
+ @param rAttrName qname of attribute
+ @param rValue value string of element
+ */
+ void addAttribute( OUString const & rAttrName, OUString const & rValue );
+
+ /** Dumps out element (and all sub elements).
+
+ @param xOut document handler to be written to
+ */
+ void dump(
+ css::uno::Reference< css::xml::sax::XDocumentHandler > const & xOut );
+ /** Dumps out sub elements (and all further sub elements).
+
+ @param xOut document handler to be written to
+ */
+ void dumpSubElements(
+ css::uno::Reference< css::xml::sax::XDocumentHandler > const & xOut );
+
+ // XAttributeList
+ virtual sal_Int16 SAL_CALL getLength() override;
+ virtual OUString SAL_CALL getNameByIndex( sal_Int16 nPos ) override;
+ virtual OUString SAL_CALL getTypeByIndex( sal_Int16 nPos ) override;
+ virtual OUString SAL_CALL getTypeByName( OUString const & rName ) override;
+ virtual OUString SAL_CALL getValueByIndex( sal_Int16 nPos ) override;
+ virtual OUString SAL_CALL getValueByName( OUString const & rName ) override;
+
+protected:
+ ::std::vector< css::uno::Reference<
+ css::xml::sax::XAttributeList > > _subElems;
+private:
+ OUString const _name;
+ ::std::vector< OUString > _attrNames;
+ ::std::vector< OUString > _attrValues;
+
+};
+
+
+/*##################################################################################################
+
+ STREAMING
+
+##################################################################################################*/
+
+XMLSCRIPT_DLLPUBLIC css::uno::Reference< css::io::XInputStream >
+createInputStream(
+ std::vector<sal_Int8>&& rInData );
+
+XMLSCRIPT_DLLPUBLIC css::uno::Reference< css::io::XInputStream >
+createInputStream(
+ const sal_Int8* pData, int len );
+
+XMLSCRIPT_DLLPUBLIC css::uno::Reference< css::io::XOutputStream >
+createOutputStream(
+ std::vector<sal_Int8> * pOutData );
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmlscript/xmldlg_imexp.hxx b/include/xmlscript/xmldlg_imexp.hxx
new file mode 100644
index 000000000..2ee082a5a
--- /dev/null
+++ b/include/xmlscript/xmldlg_imexp.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <xmlscript/xmlscriptdllapi.h>
+
+namespace com::sun::star::container { class XNameContainer; }
+namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::io { class XInputStreamProvider; }
+namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::xml::sax { class XDocumentHandler; }
+namespace com::sun::star::xml::sax { class XExtendedDocumentHandler; }
+
+namespace xmlscript
+{
+
+void exportDialogModel(
+ css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > const & xOut,
+ css::uno::Reference< css::container::XNameContainer > const & xDialogModel,
+ css::uno::Reference< css::frame::XModel > const & xDocument );
+
+XMLSCRIPT_DLLPUBLIC css::uno::Reference< css::xml::sax::XDocumentHandler >
+importDialogModel(
+ css::uno::Reference< css::container::XNameContainer > const & xDialogModel,
+ css::uno::Reference< css::uno::XComponentContext > const & xContext,
+ css::uno::Reference< css::frame::XModel > const & xDocument );
+
+// additional functions for convenience
+
+XMLSCRIPT_DLLPUBLIC css::uno::Reference< css::io::XInputStreamProvider >
+exportDialogModel(
+ css::uno::Reference< css::container::XNameContainer > const & xDialogModel,
+ css::uno::Reference< css::uno::XComponentContext > const & xContext,
+ css::uno::Reference< css::frame::XModel > const & xDocument );
+
+XMLSCRIPT_DLLPUBLIC void importDialogModel(
+ css::uno::Reference< css::io::XInputStream > const & xInput,
+ css::uno::Reference< css::container::XNameContainer > const & xDialogModel,
+ css::uno::Reference< css::uno::XComponentContext > const & xContext,
+ css::uno::Reference< css::frame::XModel > const & xDocument );
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmlscript/xmllib_imexp.hxx b/include/xmlscript/xmllib_imexp.hxx
new file mode 100644
index 000000000..f39a6e32d
--- /dev/null
+++ b/include/xmlscript/xmllib_imexp.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <xmlscript/xmlscriptdllapi.h>
+
+#include <memory>
+
+namespace com::sun::star::xml::sax { class XDocumentHandler; }
+namespace com::sun::star::xml::sax { class XWriter; }
+
+namespace xmlscript
+{
+
+
+// Library container export
+// HACK C++ struct to transport info. Later the container
+// itself should do the export/import and use exported XML
+// functionality from xmlscript
+struct XMLSCRIPT_DLLPUBLIC LibDescriptor
+{
+ OUString aName;
+ OUString aStorageURL;
+ bool bLink;
+ bool bReadOnly;
+ bool bPasswordProtected;
+ css::uno::Sequence< OUString > aElementNames;
+ bool bPreload;
+};
+
+struct XMLSCRIPT_DLLPUBLIC LibDescriptorArray
+{
+ std::unique_ptr<LibDescriptor[]> mpLibs;
+ sal_Int32 mnLibCount;
+
+ LibDescriptorArray() { mpLibs = nullptr; mnLibCount = 0; }
+ LibDescriptorArray( sal_Int32 nLibCount );
+
+ ~LibDescriptorArray();
+
+};
+
+XMLSCRIPT_DLLPUBLIC void
+exportLibraryContainer(
+ css::uno::Reference< css::xml::sax::XWriter > const & xOut,
+ const LibDescriptorArray* pLibArray );
+
+XMLSCRIPT_DLLPUBLIC css::uno::Reference<
+ css::xml::sax::XDocumentHandler >
+importLibraryContainer( LibDescriptorArray* pLibArray );
+
+
+XMLSCRIPT_DLLPUBLIC void
+exportLibrary(
+ css::uno::Reference< css::xml::sax::XWriter > const & xOut,
+ const LibDescriptor& rLib );
+
+XMLSCRIPT_DLLPUBLIC css::uno::Reference<
+ css::xml::sax::XDocumentHandler >
+importLibrary( LibDescriptor& rLib );
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmlscript/xmlmod_imexp.hxx b/include/xmlscript/xmlmod_imexp.hxx
new file mode 100644
index 000000000..19623b251
--- /dev/null
+++ b/include/xmlscript/xmlmod_imexp.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
+#include <xmlscript/xmlscriptdllapi.h>
+
+namespace com::sun::star::xml::sax { class XDocumentHandler; }
+namespace com::sun::star::xml::sax { class XWriter; }
+
+namespace xmlscript
+{
+
+
+// Script module import/export
+// HACK C++ struct to transport info. Later the container
+// itself should do the export/import and use exported XML
+// functionality from xmlscript
+struct XMLSCRIPT_DLLPUBLIC ModuleDescriptor
+{
+ OUString aName;
+ OUString aLanguage;
+ OUString aCode;
+ OUString aModuleType; // VBA
+};
+
+XMLSCRIPT_DLLPUBLIC void
+exportScriptModule(
+ css::uno::Reference< css::xml::sax::XWriter > const & xOut,
+ const ModuleDescriptor& rMod );
+
+XMLSCRIPT_DLLPUBLIC css::uno::Reference< css::xml::sax::XDocumentHandler >
+importScriptModule( ModuleDescriptor& rMod );
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmlscript/xmlns.h b/include/xmlscript/xmlns.h
new file mode 100644
index 000000000..1b06d390f
--- /dev/null
+++ b/include/xmlscript/xmlns.h
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <rtl/ustring.hxx>
+
+inline constexpr OUStringLiteral XMLNS_DIALOGS_URI = u"http://openoffice.org/2000/dialog";
+#define XMLNS_DIALOGS_PREFIX "dlg"
+
+inline constexpr OUStringLiteral XMLNS_SCRIPT_URI = u"http://openoffice.org/2000/script";
+#define XMLNS_SCRIPT_PREFIX "script"
+
+inline constexpr OUStringLiteral XMLNS_OOO_URI = u"http://openoffice.org/2004/office";
+inline constexpr OUStringLiteral XMLNS_OOO_PREFIX = u"ooo";
+
+inline constexpr OUStringLiteral XMLNS_LIBRARY_URI = u"http://openoffice.org/2000/library";
+#define XMLNS_LIBRARY_PREFIX "library"
+
+inline constexpr OUStringLiteral XMLNS_XLINK_URI = u"http://www.w3.org/1999/xlink";
+#define XMLNS_XLINK_PREFIX "xlink"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmlscript/xmlscriptdllapi.h b/include/xmlscript/xmlscriptdllapi.h
new file mode 100644
index 000000000..caacac12c
--- /dev/null
+++ b/include/xmlscript/xmlscriptdllapi.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/types.h>
+
+#if defined(XMLSCRIPT_DLLIMPLEMENTATION)
+#define XMLSCRIPT_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define XMLSCRIPT_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define XMLSCRIPT_DLLPRIVATE SAL_DLLPRIVATE
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */